From 0d78bbdee3ef3a3458b4ec542ab3f93115de70af Mon Sep 17 00:00:00 2001 From: Andrea Bianco Date: Wed, 5 Jan 2022 17:05:01 +0100 Subject: [PATCH] Built motion from commit 9d5c653a.|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/migrations/2.5.44.js | 1 + 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 +- 1170 files changed, 1170 insertions(+), 1169 deletions(-) diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 78673e2..d2d9301 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-01-05T14:58:44.336Z", + "time": "2022-01-05T15:52:30.426Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 0cf5496..cad1ade 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-01-05T14:58:44.336Z", + "time": "2022-01-05T15:52:30.426Z", "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 a02ec83..32c39f4 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 _0x613c=['STRING','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','getDataValue','integration','motionbar','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0xbee241,_0x2a041a){var _0x4c2031=function(_0x376ece){while(--_0x376ece){_0xbee241['push'](_0xbee241['shift']());}};_0x4c2031(++_0x2a041a);}(_0x613c,0x1d2));var _0xc613=function(_0x1fb922,_0x27cc49){_0x1fb922=_0x1fb922-0x0;var _0x96f3da=_0x613c[_0x1fb922];return _0x96f3da;};'use strict';var Sequelize=require(_0xc613('0x0'));module[_0xc613('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x50e251){return this[_0xc613('0x2')]('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0xc613('0x3'),_0xc613('0x4'),'jscripty',_0xc613('0x5'),_0xc613('0x6'),_0xc613('0x7'),_0xc613('0x8')]],'msg':_0xc613('0x9')}},'comment':_0xc613('0x9')},'data1':{'type':Sequelize[_0xc613('0xa')](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[_0xc613('0xa')](0x1000),'comment':_0xc613('0xb')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0xc613('0xa')](0x1000),'comments':_0xc613('0xc')},'data5':{'type':Sequelize[_0xc613('0xa')](0x1000),'comments':_0xc613('0xd')},'data6':{'type':Sequelize[_0xc613('0xa')],'comments':_0xc613('0xe')},'data7':{'type':Sequelize[_0xc613('0xf')],'comments':_0xc613('0x10')}}; \ No newline at end of file +var _0x7217=['STRING','motionbar','jscripty','urlForward','browser','bot','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[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','VIRTUAL','getDataValue','action'];(function(_0x3b1c7d,_0x449292){var _0x18d023=function(_0x476048){while(--_0x476048){_0x3b1c7d['push'](_0x3b1c7d['shift']());}};_0x18d023(++_0x449292);}(_0x7217,0x19e));var _0x7721=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x7217[_0x1c546c];return _0x2cc384;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'name':{'type':Sequelize[_0x7721('0x1')],'get':function(_0x4170dd){return this[_0x7721('0x2')](_0x7721('0x3'));}},'action':{'type':Sequelize[_0x7721('0x4')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager','integration',_0x7721('0x5'),_0x7721('0x6'),_0x7721('0x7'),_0x7721('0x8'),_0x7721('0x9'),_0x7721('0xa')]],'msg':_0x7721('0xb')}},'comment':_0x7721('0xb')},'data1':{'type':Sequelize[_0x7721('0x4')](0x1000),'comment':_0x7721('0xc')},'data2':{'type':Sequelize[_0x7721('0x4')](0x1000),'comment':_0x7721('0xd')},'data3':{'type':Sequelize[_0x7721('0x4')](0x1000),'comment':_0x7721('0xe')},'data4':{'type':Sequelize[_0x7721('0x4')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x7721('0x4')](0x1000),'comments':_0x7721('0xf')},'data6':{'type':Sequelize[_0x7721('0x4')],'comments':_0x7721('0x10')},'data7':{'type':Sequelize[_0x7721('0x11')],'comments':_0x7721('0x12')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 14a1b00..1852d35 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 _0xa6cd=['ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','body','Action','find','params','catch','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv'];(function(_0x65e996,_0x2870eb){var _0x4d0b82=function(_0x33b6f7){while(--_0x33b6f7){_0x65e996['push'](_0x65e996['shift']());}};_0x4d0b82(++_0x2870eb);}(_0xa6cd,0xcf));var _0xda6c=function(_0x102e83,_0xcf6a0b){_0x102e83=_0x102e83-0x0;var _0x312936=_0xa6cd[_0x102e83];return _0x312936;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xda6c('0x0'));var zipdir=require(_0xda6c('0x1'));var jsonpatch=require(_0xda6c('0x2'));var rp=require(_0xda6c('0x3'));var moment=require('moment');var BPromise=require(_0xda6c('0x4'));var Mustache=require(_0xda6c('0x5'));var util=require('util');var path=require('path');var sox=require(_0xda6c('0x6'));var csv=require(_0xda6c('0x7'));var ejs=require(_0xda6c('0x8'));var fs=require('fs');var fs_extra=require(_0xda6c('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xda6c('0xa'));var jsforce=require(_0xda6c('0xb'));var deskjs=require(_0xda6c('0xc'));var toCsv=require(_0xda6c('0x7'));var querystring=require(_0xda6c('0xd'));var Papa=require('papaparse');var Redis=require(_0xda6c('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xda6c('0xf'));var logger=require(_0xda6c('0x10'))('api');var utils=require(_0xda6c('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xda6c('0x12'));var db=require(_0xda6c('0x13'))['db'];function respondWithStatusCode(_0x513553,_0x49b467){_0x49b467=_0x49b467||0xcc;return function(_0x3d38bb){if(_0x3d38bb){return _0x513553[_0xda6c('0x14')](_0x49b467);}return _0x513553[_0xda6c('0x15')](_0x49b467)[_0xda6c('0x16')]();};}function respondWithResult(_0x5f53aa,_0x5e2a74){_0x5e2a74=_0x5e2a74||0xc8;return function(_0xc52339){if(_0xc52339){return _0x5f53aa[_0xda6c('0x15')](_0x5e2a74)[_0xda6c('0x17')](_0xc52339);}};}function respondWithFilteredResult(_0x1e9504,_0x5c3681){return function(_0x2f2c96){if(_0x2f2c96){var _0x5b12d0=typeof _0x5c3681['offset']===_0xda6c('0x18')&&typeof _0x5c3681['limit']===_0xda6c('0x18');var _0x276f52=_0x2f2c96[_0xda6c('0x19')];var _0x45d6dc=_0x5b12d0?0x0:_0x5c3681[_0xda6c('0x1a')];var _0x26928f=_0x5b12d0?_0x2f2c96[_0xda6c('0x19')]:_0x5c3681['offset']+_0x5c3681['limit'];var _0x2d5dc8;if(_0x26928f>=_0x276f52){_0x26928f=_0x276f52;_0x2d5dc8=0xc8;}else{_0x2d5dc8=0xce;}_0x1e9504['status'](_0x2d5dc8);return _0x1e9504[_0xda6c('0x1b')](_0xda6c('0x1c'),_0x45d6dc+'-'+_0x26928f+'/'+_0x276f52)[_0xda6c('0x17')](_0x2f2c96);}return null;};}function patchUpdates(_0x462f25){return function(_0x3e507e){try{jsonpatch[_0xda6c('0x1d')](_0x3e507e,_0x462f25,!![]);}catch(_0x3ef346){return BPromise[_0xda6c('0x1e')](_0x3ef346);}return _0x3e507e['save']();};}function saveUpdates(_0x9c77c4,_0x1f2efc){return function(_0x16a79b){if(_0x16a79b){return _0x16a79b[_0xda6c('0x1f')](_0x9c77c4)['then'](function(_0x8637fd){return _0x8637fd;});}return null;};}function removeEntity(_0xa4a5de,_0x13e2af){return function(_0x53e3e9){if(_0x53e3e9){return _0x53e3e9[_0xda6c('0x20')]()[_0xda6c('0x21')](function(){_0xa4a5de[_0xda6c('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9bffcc,_0x41cb34){return function(_0x504f7a){if(!_0x504f7a){_0x9bffcc['sendStatus'](0x194);}return _0x504f7a;};}function handleError(_0x28e2ea,_0x998c94){_0x998c94=_0x998c94||0x1f4;return function(_0x601545){logger[_0xda6c('0x22')](_0x601545[_0xda6c('0x23')]);if(_0x601545[_0xda6c('0x24')]){delete _0x601545['name'];}_0x28e2ea[_0xda6c('0x15')](_0x998c94)[_0xda6c('0x25')](_0x601545);};}exports['update']=function(_0x4c6cf6,_0x26308e){if(_0x4c6cf6[_0xda6c('0x26')]['id']){delete _0x4c6cf6['body']['id'];}return db[_0xda6c('0x27')]['find']({'where':{'id':_0x4c6cf6['params']['id']}})[_0xda6c('0x21')](handleEntityNotFound(_0x26308e,null))[_0xda6c('0x21')](saveUpdates(_0x4c6cf6[_0xda6c('0x26')],null))['then'](respondWithResult(_0x26308e,null))['catch'](handleError(_0x26308e,null));};exports[_0xda6c('0x20')]=function(_0x430962,_0x553a72){return db[_0xda6c('0x27')][_0xda6c('0x28')]({'where':{'id':_0x430962[_0xda6c('0x29')]['id']}})[_0xda6c('0x21')](handleEntityNotFound(_0x553a72,null))[_0xda6c('0x21')](removeEntity(_0x553a72,null))[_0xda6c('0x2a')](handleError(_0x553a72,null));}; \ No newline at end of file +var _0xca69=['path','to-csv','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','find','catch','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x845fcc,_0x518cfb){var _0x3a0e79=function(_0x240732){while(--_0x240732){_0x845fcc['push'](_0x845fcc['shift']());}};_0x3a0e79(++_0x518cfb);}(_0xca69,0xcf));var _0x9ca6=function(_0x3f5e5b,_0x350dbf){_0x3f5e5b=_0x3f5e5b-0x0;var _0x2e899d=_0xca69[_0x3f5e5b];return _0x2e899d;};'use strict';var emlformat=require(_0x9ca6('0x0'));var rimraf=require(_0x9ca6('0x1'));var zipdir=require(_0x9ca6('0x2'));var jsonpatch=require(_0x9ca6('0x3'));var rp=require(_0x9ca6('0x4'));var moment=require(_0x9ca6('0x5'));var BPromise=require(_0x9ca6('0x6'));var Mustache=require('mustache');var util=require(_0x9ca6('0x7'));var path=require(_0x9ca6('0x8'));var sox=require('sox');var csv=require(_0x9ca6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9ca6('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9ca6('0xb'));var jsforce=require(_0x9ca6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9ca6('0xd'));var Papa=require(_0x9ca6('0xe'));var Redis=require(_0x9ca6('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9ca6('0x10'))('api');var utils=require(_0x9ca6('0x11'));var config=require(_0x9ca6('0x12'));var licenseUtil=require(_0x9ca6('0x13'));var db=require(_0x9ca6('0x14'))['db'];function respondWithStatusCode(_0x504af4,_0x16c875){_0x16c875=_0x16c875||0xcc;return function(_0x25119f){if(_0x25119f){return _0x504af4['sendStatus'](_0x16c875);}return _0x504af4[_0x9ca6('0x15')](_0x16c875)[_0x9ca6('0x16')]();};}function respondWithResult(_0x598859,_0x35fe8e){_0x35fe8e=_0x35fe8e||0xc8;return function(_0x46f174){if(_0x46f174){return _0x598859[_0x9ca6('0x15')](_0x35fe8e)[_0x9ca6('0x17')](_0x46f174);}};}function respondWithFilteredResult(_0x3a67ed,_0x3f2461){return function(_0x12bb62){if(_0x12bb62){var _0xb34745=typeof _0x3f2461['offset']==='undefined'&&typeof _0x3f2461[_0x9ca6('0x18')]===_0x9ca6('0x19');var _0xba5fa1=_0x12bb62[_0x9ca6('0x1a')];var _0x2f4429=_0xb34745?0x0:_0x3f2461[_0x9ca6('0x1b')];var _0x41414e=_0xb34745?_0x12bb62['count']:_0x3f2461[_0x9ca6('0x1b')]+_0x3f2461['limit'];var _0x3417bc;if(_0x41414e>=_0xba5fa1){_0x41414e=_0xba5fa1;_0x3417bc=0xc8;}else{_0x3417bc=0xce;}_0x3a67ed[_0x9ca6('0x15')](_0x3417bc);return _0x3a67ed[_0x9ca6('0x1c')](_0x9ca6('0x1d'),_0x2f4429+'-'+_0x41414e+'/'+_0xba5fa1)[_0x9ca6('0x17')](_0x12bb62);}return null;};}function patchUpdates(_0x26e40f){return function(_0x563b24){try{jsonpatch['apply'](_0x563b24,_0x26e40f,!![]);}catch(_0x1800da){return BPromise[_0x9ca6('0x1e')](_0x1800da);}return _0x563b24[_0x9ca6('0x1f')]();};}function saveUpdates(_0x53e9e8,_0x380d75){return function(_0xfcaf98){if(_0xfcaf98){return _0xfcaf98[_0x9ca6('0x20')](_0x53e9e8)[_0x9ca6('0x21')](function(_0x1c3086){return _0x1c3086;});}return null;};}function removeEntity(_0x3398ef,_0x519554){return function(_0x26f160){if(_0x26f160){return _0x26f160[_0x9ca6('0x22')]()[_0x9ca6('0x21')](function(){_0x3398ef[_0x9ca6('0x15')](0xcc)[_0x9ca6('0x16')]();});}};}function handleEntityNotFound(_0x44563d,_0x38ae3b){return function(_0x5b4598){if(!_0x5b4598){_0x44563d['sendStatus'](0x194);}return _0x5b4598;};}function handleError(_0x57856f,_0x47da42){_0x47da42=_0x47da42||0x1f4;return function(_0x246fb4){logger[_0x9ca6('0x23')](_0x246fb4[_0x9ca6('0x24')]);if(_0x246fb4[_0x9ca6('0x25')]){delete _0x246fb4[_0x9ca6('0x25')];}_0x57856f[_0x9ca6('0x15')](_0x47da42)[_0x9ca6('0x26')](_0x246fb4);};}exports[_0x9ca6('0x20')]=function(_0xbba154,_0x2f8494){if(_0xbba154[_0x9ca6('0x27')]['id']){delete _0xbba154[_0x9ca6('0x27')]['id'];}return db['Action'][_0x9ca6('0x28')]({'where':{'id':_0xbba154['params']['id']}})[_0x9ca6('0x21')](handleEntityNotFound(_0x2f8494,null))[_0x9ca6('0x21')](saveUpdates(_0xbba154['body'],null))[_0x9ca6('0x21')](respondWithResult(_0x2f8494,null))[_0x9ca6('0x29')](handleError(_0x2f8494,null));};exports[_0x9ca6('0x22')]=function(_0x3bbc51,_0x47b207){return db[_0x9ca6('0x2a')][_0x9ca6('0x28')]({'where':{'id':_0x3bbc51['params']['id']}})['then'](handleEntityNotFound(_0x47b207,null))[_0x9ca6('0x21')](removeEntity(_0x47b207,null))[_0x9ca6('0x29')](handleError(_0x47b207,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 1c0946e..13859df 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 _0x9ef8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','exports','define','Action','lodash'];(function(_0x1926f3,_0x1aa9e2){var _0xe6bb80=function(_0x260293){while(--_0x260293){_0x1926f3['push'](_0x1926f3['shift']());}};_0xe6bb80(++_0x1aa9e2);}(_0x9ef8,0x78));var _0x89ef=function(_0x1af5b2,_0x1b82fe){_0x1af5b2=_0x1af5b2-0x0;var _0xf1aa2d=_0x9ef8[_0x1af5b2];return _0xf1aa2d;};'use strict';var _=require(_0x89ef('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x89ef('0x1'));var BPromise=require(_0x89ef('0x2'));var rp=require(_0x89ef('0x3'));var fs=require('fs');var path=require(_0x89ef('0x4'));var rimraf=require(_0x89ef('0x5'));var config=require(_0x89ef('0x6'));var attributes=require(_0x89ef('0x7'));module[_0x89ef('0x8')]=function(_0x51e28e,_0x1b1cbc){return _0x51e28e[_0x89ef('0x9')](_0x89ef('0xa'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x315b=['exports','Action','tools_actions','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./action.attributes'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x315b,0x162));var _0xb315=function(_0x8546f5,_0x18c576){_0x8546f5=_0x8546f5-0x0;var _0x939bfe=_0x315b[_0x8546f5];return _0x939bfe;};'use strict';var _=require(_0xb315('0x0'));var util=require(_0xb315('0x1'));var logger=require(_0xb315('0x2'))(_0xb315('0x3'));var moment=require(_0xb315('0x4'));var BPromise=require('bluebird');var rp=require(_0xb315('0x5'));var fs=require('fs');var path=require(_0xb315('0x6'));var rimraf=require(_0xb315('0x7'));var config=require(_0xb315('0x8'));var attributes=require(_0xb315('0x9'));module[_0xb315('0xa')]=function(_0x308d9f,_0x90d8aa){return _0x308d9f['define'](_0xb315('0xb'),attributes,{'tableName':_0xb315('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index d465ade..253cb81 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 _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0xd85fec,_0x4cb304){var _0x21e407=function(_0x10cc5b){while(--_0x10cc5b){_0xd85fec['push'](_0xd85fec['shift']());}};_0x21e407(++_0x4cb304);}(_0x5fc3,0xa8));var _0x35fc=function(_0xbc4560,_0x4020b8){_0xbc4560=_0xbc4560-0x0;var _0x298cfb=_0x5fc3[_0xbc4560];return _0x298cfb;};'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')]('Action,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Action,\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']('Action,\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 _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x53ec,0x192));var _0xc53e=function(_0x35007a,_0x58a0d4){_0x35007a=_0x35007a-0x0;var _0x574f68=_0x53ec[_0x35007a];return _0x574f68;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 1173d58..1f2fe63 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 _0xec1e=['../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x28ab7d,_0x5afc4d){var _0x413bc4=function(_0x49528b){while(--_0x49528b){_0x28ab7d['push'](_0x28ab7d['shift']());}};_0x413bc4(++_0x5afc4d);}(_0xec1e,0x7f));var _0xeec1=function(_0x59fc7c,_0x1146f2){_0x59fc7c=_0x59fc7c-0x0;var _0x2653ff=_0xec1e[_0x59fc7c];return _0x2653ff;};'use strict';var multer=require(_0xeec1('0x0'));var util=require(_0xeec1('0x1'));var path=require(_0xeec1('0x2'));var timeout=require(_0xeec1('0x3'));var express=require(_0xeec1('0x4'));var router=express[_0xeec1('0x5')]();var fs_extra=require(_0xeec1('0x6'));var auth=require(_0xeec1('0x7'));var interaction=require(_0xeec1('0x8'));var config=require(_0xeec1('0x9'));var controller=require('./action.controller');router[_0xeec1('0xa')](_0xeec1('0xb'),auth[_0xeec1('0xc')](),controller['update']);router[_0xeec1('0xd')](_0xeec1('0xb'),auth['isAuthenticated'](),controller[_0xeec1('0xe')]);module['exports']=router; \ No newline at end of file +var _0x1ffc=['update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','./action.controller','put','/:id','isAuthenticated'];(function(_0x6899b6,_0x384538){var _0xfe5591=function(_0x450533){while(--_0x450533){_0x6899b6['push'](_0x6899b6['shift']());}};_0xfe5591(++_0x384538);}(_0x1ffc,0x74));var _0xc1ff=function(_0x13528f,_0xc6204d){_0x13528f=_0x13528f-0x0;var _0x532307=_0x1ffc[_0x13528f];return _0x532307;};'use strict';var multer=require(_0xc1ff('0x0'));var util=require(_0xc1ff('0x1'));var path=require(_0xc1ff('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc1ff('0x3')]();var fs_extra=require(_0xc1ff('0x4'));var auth=require(_0xc1ff('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc1ff('0x6'));router[_0xc1ff('0x7')](_0xc1ff('0x8'),auth[_0xc1ff('0x9')](),controller[_0xc1ff('0xa')]);router[_0xc1ff('0xb')]('/:id',auth[_0xc1ff('0x9')](),controller[_0xc1ff('0xc')]);module[_0xc1ff('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index ad4c48e..5e22587 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 _0xe14b=['exports','STRING','TEXT','sequelize'];(function(_0x25cee4,_0x493f3c){var _0x4cb430=function(_0x36762c){while(--_0x36762c){_0x25cee4['push'](_0x25cee4['shift']());}};_0x4cb430(++_0x493f3c);}(_0xe14b,0x93));var _0xbe14=function(_0x9d8aca,_0x3c4176){_0x9d8aca=_0x9d8aca-0x0;var _0x4b1d70=_0xe14b[_0x9d8aca];return _0x4b1d70;};'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 +var _0x4819=['TEXT','exports','STRING'];(function(_0xc77819,_0x139fdc){var _0x1c9434=function(_0x11d15d){while(--_0x11d15d){_0xc77819['push'](_0xc77819['shift']());}};_0x1c9434(++_0x139fdc);}(_0x4819,0xcd));var _0x9481=function(_0xc61ea8,_0x56e451){_0xc61ea8=_0xc61ea8-0x0;var _0x22c845=_0x4819[_0xc61ea8];return _0x22c845;};'use strict';var Sequelize=require('sequelize');module[_0x9481('0x0')]={'name':{'type':Sequelize[_0x9481('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x9481('0x1')]},'parent':{'type':Sequelize[_0x9481('0x1')]},'table':{'type':Sequelize[_0x9481('0x1')]},'conditions':{'type':Sequelize[_0x9481('0x2')]},'joins':{'type':Sequelize[_0x9481('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 1e47b33..1253137 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 _0x315f=['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','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','stack','name','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','CustomReports','error','params','preview','left_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','rules','group','condition','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','MetricId','metric','function','replace','format','groupBy','order','DESC','alias','joins','includes','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','debug','Limited\x20Query:','toString','sequelize','QueryTypes','join','cross_join','MIN(%s)','DATE(%s)','IS\x20NOT\x20EMPTY','operator','field','getFields','ValidationErrorItem','keyBy','orderBy','clone','output','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','fork','../../components/export/','savename','countTable','COUNT(*)','SELECT','run','runReport','right_join','COUNT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20EMPTY','value','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto'];(function(_0x46025b,_0x4f1caa){var _0x570209=function(_0x52ca70){while(--_0x52ca70){_0x46025b['push'](_0x46025b['shift']());}};_0x570209(++_0x4f1caa);}(_0x315f,0x1f4));var _0xf315=function(_0xb6e43,_0x1568fc){_0xb6e43=_0xb6e43-0x0;var _0x47c40f=_0x315f[_0xb6e43];return _0x47c40f;};'use strict';var emlformat=require(_0xf315('0x0'));var rimraf=require(_0xf315('0x1'));var zipdir=require(_0xf315('0x2'));var jsonpatch=require(_0xf315('0x3'));var rp=require('request-promise');var moment=require(_0xf315('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf315('0x5'));var util=require(_0xf315('0x6'));var path=require(_0xf315('0x7'));var sox=require(_0xf315('0x8'));var csv=require(_0xf315('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf315('0xa'));var _=require('lodash');var squel=require(_0xf315('0xb'));var crypto=require(_0xf315('0xc'));var jsforce=require(_0xf315('0xd'));var deskjs=require(_0xf315('0xe'));var toCsv=require(_0xf315('0x9'));var querystring=require(_0xf315('0xf'));var Papa=require(_0xf315('0x10'));var Redis=require(_0xf315('0x11'));var authService=require(_0xf315('0x12'));var qs=require(_0xf315('0x13'));var as=require(_0xf315('0x14'));var hardwareService=require(_0xf315('0x15'));var logger=require(_0xf315('0x16'))(_0xf315('0x17'));var utils=require(_0xf315('0x18'));var config=require(_0xf315('0x19'));var licenseUtil=require(_0xf315('0x1a'));var db=require(_0xf315('0x1b'))['db'];var dbH=require(_0xf315('0x1b'))[_0xf315('0x1c')];function respondWithStatusCode(_0x4f29df,_0x508b3e){_0x508b3e=_0x508b3e||0xcc;return function(_0xa2610f){if(_0xa2610f){return _0x4f29df[_0xf315('0x1d')](_0x508b3e);}return _0x4f29df[_0xf315('0x1e')](_0x508b3e)[_0xf315('0x1f')]();};}function respondWithResult(_0x35e910,_0x5ccb75){_0x5ccb75=_0x5ccb75||0xc8;return function(_0x787eda){if(_0x787eda){return _0x35e910[_0xf315('0x1e')](_0x5ccb75)[_0xf315('0x20')](_0x787eda);}};}function respondWithFilteredResult(_0x5bcfa5,_0x5964d1){return function(_0x1ae16e){if(_0x1ae16e){var _0x31444d=typeof _0x5964d1[_0xf315('0x21')]===_0xf315('0x22')&&typeof _0x5964d1[_0xf315('0x23')]==='undefined';var _0x4ad049=_0x1ae16e[_0xf315('0x24')];var _0x3073f9=_0x31444d?0x0:_0x5964d1['offset'];var _0x30c5cc=_0x31444d?_0x1ae16e[_0xf315('0x24')]:_0x5964d1['offset']+_0x5964d1[_0xf315('0x23')];var _0x39cabc;if(_0x30c5cc>=_0x4ad049){_0x30c5cc=_0x4ad049;_0x39cabc=0xc8;}else{_0x39cabc=0xce;}_0x5bcfa5[_0xf315('0x1e')](_0x39cabc);return _0x5bcfa5[_0xf315('0x25')]('Content-Range',_0x3073f9+'-'+_0x30c5cc+'/'+_0x4ad049)['json'](_0x1ae16e);}return null;};}function patchUpdates(_0x494e10){return function(_0x2931a7){try{jsonpatch[_0xf315('0x26')](_0x2931a7,_0x494e10,!![]);}catch(_0x10eb49){return BPromise[_0xf315('0x27')](_0x10eb49);}return _0x2931a7[_0xf315('0x28')]();};}function saveUpdates(_0x4d4c46,_0x50c66e){return function(_0x4a8be6){if(_0x4a8be6){return _0x4a8be6[_0xf315('0x29')](_0x4d4c46)['then'](function(_0x44b761){return _0x44b761;});}return null;};}function removeEntity(_0x28aa06,_0x2204a6){return function(_0x47ee36){if(_0x47ee36){return _0x47ee36['destroy']()[_0xf315('0x2a')](function(){var _0x2cf951=_0x47ee36[_0xf315('0x2b')]({'plain':!![]});var _0x551cdc='CustomReports';return db['UserProfileResource']['destroy']({'where':{'type':_0x551cdc,'resourceId':_0x2cf951['id']}})[_0xf315('0x2a')](function(){return _0x47ee36;});})[_0xf315('0x2a')](function(){_0x28aa06[_0xf315('0x1e')](0xcc)[_0xf315('0x1f')]();});}};}function handleEntityNotFound(_0x43a322,_0x6a014e){return function(_0xa213bf){if(!_0xa213bf){_0x43a322[_0xf315('0x1d')](0x194);}return _0xa213bf;};}function handleError(_0x55f20b,_0x32c1ec){_0x32c1ec=_0x32c1ec||0x1f4;return function(_0x5b5e97){logger['error'](_0x5b5e97[_0xf315('0x2c')]);if(_0x5b5e97[_0xf315('0x2d')]){delete _0x5b5e97['name'];}_0x55f20b[_0xf315('0x1e')](_0x32c1ec)['send'](_0x5b5e97);};}exports[_0xf315('0x2e')]=function(_0x5cbe6a,_0x464233){var _0x3df688={},_0x70fd3f={},_0x361dc2={'count':0x0,'rows':[]};var _0x4bb572=_[_0xf315('0x2f')](db[_0xf315('0x30')][_0xf315('0x31')],function(_0x53b497){return{'name':_0x53b497[_0xf315('0x32')],'type':_0x53b497[_0xf315('0x33')][_0xf315('0x34')]};});_0x70fd3f[_0xf315('0x35')]=_[_0xf315('0x2f')](_0x4bb572,_0xf315('0x2d'));_0x70fd3f[_0xf315('0x36')]=_[_0xf315('0x37')](_0x5cbe6a[_0xf315('0x36')]);_0x70fd3f[_0xf315('0x38')]=_[_0xf315('0x39')](_0x70fd3f['model'],_0x70fd3f[_0xf315('0x36')]);_0x3df688[_0xf315('0x3a')]=_[_0xf315('0x39')](_0x70fd3f[_0xf315('0x35')],qs[_0xf315('0x3b')](_0x5cbe6a['query'][_0xf315('0x3b')]));_0x3df688[_0xf315('0x3a')]=_0x3df688['attributes'][_0xf315('0x3c')]?_0x3df688[_0xf315('0x3a')]:_0x70fd3f[_0xf315('0x35')];if(!_0x5cbe6a[_0xf315('0x36')][_0xf315('0x3d')](_0xf315('0x3e'))){_0x3df688['limit']=qs[_0xf315('0x23')](_0x5cbe6a[_0xf315('0x36')][_0xf315('0x23')]);_0x3df688[_0xf315('0x21')]=qs[_0xf315('0x21')](_0x5cbe6a[_0xf315('0x36')][_0xf315('0x21')]);}_0x3df688['order']=qs[_0xf315('0x3f')](_0x5cbe6a['query']['sort']);_0x3df688[_0xf315('0x40')]=qs[_0xf315('0x38')](_[_0xf315('0x41')](_0x5cbe6a[_0xf315('0x36')],_0x70fd3f[_0xf315('0x38')]),_0x4bb572);if(_0x5cbe6a[_0xf315('0x36')][_0xf315('0x42')]){_0x3df688[_0xf315('0x40')]=_[_0xf315('0x43')](_0x3df688['where'],{'$or':_[_0xf315('0x2f')](_0x4bb572,function(_0xf2fff9){if(_0xf2fff9[_0xf315('0x33')]!==_0xf315('0x44')){var _0x3b68b2={};_0x3b68b2[_0xf2fff9[_0xf315('0x2d')]]={'$like':'%'+_0x5cbe6a[_0xf315('0x36')][_0xf315('0x42')]+'%'};return _0x3b68b2;}})});}_0x3df688=_[_0xf315('0x43')]({},_0x3df688,_0x5cbe6a[_0xf315('0x45')]);var _0x50aee4={'where':_0x3df688[_0xf315('0x40')]};return db[_0xf315('0x30')][_0xf315('0x24')](_0x50aee4)[_0xf315('0x2a')](function(_0x373e24){_0x361dc2['count']=_0x373e24;if(_0x5cbe6a[_0xf315('0x36')][_0xf315('0x46')]){_0x3df688['include']=[{'all':!![]}];}return db[_0xf315('0x30')][_0xf315('0x47')](_0x3df688);})['then'](function(_0x3efc96){_0x361dc2[_0xf315('0x48')]=_0x3efc96;return _0x361dc2;})[_0xf315('0x2a')](respondWithFilteredResult(_0x464233,_0x3df688))[_0xf315('0x49')](handleError(_0x464233,null));};exports[_0xf315('0x4a')]=function(_0x4c4702,_0x2ce0a0){var _0x46220e={'raw':![],'where':{'id':_0x4c4702['params']['id']}},_0x17767b={};_0x17767b[_0xf315('0x35')]=_[_0xf315('0x37')](db[_0xf315('0x30')][_0xf315('0x31')]);_0x17767b[_0xf315('0x36')]=_[_0xf315('0x37')](_0x4c4702[_0xf315('0x36')]);_0x17767b['filters']=_[_0xf315('0x39')](_0x17767b[_0xf315('0x35')],_0x17767b[_0xf315('0x36')]);_0x46220e['attributes']=_[_0xf315('0x39')](_0x17767b[_0xf315('0x35')],qs[_0xf315('0x3b')](_0x4c4702[_0xf315('0x36')][_0xf315('0x3b')]));_0x46220e[_0xf315('0x3a')]=_0x46220e[_0xf315('0x3a')][_0xf315('0x3c')]?_0x46220e[_0xf315('0x3a')]:_0x17767b[_0xf315('0x35')];if(_0x4c4702[_0xf315('0x36')][_0xf315('0x46')]){_0x46220e['include']=[{'all':!![]}];}_0x46220e=_[_0xf315('0x43')]({},_0x46220e,_0x4c4702[_0xf315('0x45')]);return db[_0xf315('0x30')]['find'](_0x46220e)[_0xf315('0x2a')](handleEntityNotFound(_0x2ce0a0,null))[_0xf315('0x2a')](respondWithResult(_0x2ce0a0,null))[_0xf315('0x49')](handleError(_0x2ce0a0,null));};exports[_0xf315('0x4b')]=function(_0x2ffe5e,_0x48c432){return db['AnalyticCustomReport']['create'](_0x2ffe5e[_0xf315('0x4c')],{})[_0xf315('0x2a')](function(_0x4c6cd1){var _0x1409b3=_0x2ffe5e[_0xf315('0x4d')][_0xf315('0x2b')]({'plain':!![]});if(!_0x1409b3)throw new Error(_0xf315('0x4e'));if(_0x1409b3[_0xf315('0x4f')]===_0xf315('0x4d')){var _0x2803fd=_0x4c6cd1['get']({'plain':!![]});var _0x5e5458=_0xf315('0x50');return db[_0xf315('0x51')][_0xf315('0x52')]({'where':{'name':_0x5e5458,'userProfileId':_0x1409b3[_0xf315('0x53')]},'raw':!![]})[_0xf315('0x2a')](function(_0x42cc8d){if(_0x42cc8d&&_0x42cc8d[_0xf315('0x54')]===0x0){return db['UserProfileResource'][_0xf315('0x4b')]({'name':_0x2803fd[_0xf315('0x2d')],'resourceId':_0x2803fd['id'],'type':_0xf315('0x55'),'sectionId':_0x42cc8d['id']},{})['then'](function(){return _0x4c6cd1;});}else{return _0x4c6cd1;}})[_0xf315('0x49')](function(_0x487b7a){logger[_0xf315('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x487b7a);throw _0x487b7a;});}return _0x4c6cd1;})[_0xf315('0x2a')](respondWithResult(_0x48c432,0xc9))[_0xf315('0x49')](handleError(_0x48c432,null));};exports['update']=function(_0x38d769,_0x5a7342){if(_0x38d769[_0xf315('0x4c')]['id']){delete _0x38d769[_0xf315('0x4c')]['id'];}return db[_0xf315('0x30')]['find']({'where':{'id':_0x38d769[_0xf315('0x57')]['id']}})[_0xf315('0x2a')](handleEntityNotFound(_0x5a7342,null))[_0xf315('0x2a')](saveUpdates(_0x38d769['body'],null))[_0xf315('0x2a')](respondWithResult(_0x5a7342,null))[_0xf315('0x49')](handleError(_0x5a7342,null));};exports['destroy']=function(_0x372bc2,_0x3301f6){return db[_0xf315('0x30')][_0xf315('0x52')]({'where':{'id':_0x372bc2[_0xf315('0x57')]['id']}})['then'](handleEntityNotFound(_0x3301f6,null))[_0xf315('0x2a')](removeEntity(_0x3301f6,null))[_0xf315('0x49')](handleError(_0x3301f6,null));};exports[_0xf315('0x58')]=function(_0x258127,_0xa79895){var _0x119dd7=0xa;var _0xda40ed=['join',_0xf315('0x59'),'right_join','cross_join'];var _0x3a9d1a={'SUM':_0xf315('0x5a'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xf315('0x5b'),'MAX':_0xf315('0x5c'),'MIN':'MIN(%s)','AVG':_0xf315('0x5d'),'GROUP_CONCAT':_0xf315('0x5e'),'GROUP_CONCAT ASC':_0xf315('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1d0cce={'SEC_TO_TIME':_0xf315('0x60'),'DATE':'DATE(%s)','HOUR':_0xf315('0x61'),'ROUND':_0xf315('0x62'),'UNIX_TIMESTAMP':_0xf315('0x63')};var _0x74e68b=function(_0x2b6129){return!_['includes']([_0xf315('0x64'),_0xf315('0x65'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x2b6129);};var _0x2610ab=function(_0x1fee9f){if(!_0x1fee9f||!_0x1fee9f[_0xf315('0x66')][_0xf315('0x3c')]){return'';}for(var _0x328c0c='(',_0xf8495e=0x0;_0xf8495e<_0x1fee9f[_0xf315('0x66')]['length'];_0xf8495e+=0x1){_0xf8495e>0x0&&(_0x328c0c+='\x20'+_0x1fee9f['operator']+'\x20');_0x328c0c+=_0x1fee9f[_0xf315('0x66')][_0xf8495e]['group']?_0x2610ab(_0x1fee9f[_0xf315('0x66')][_0xf8495e][_0xf315('0x67')]):_0x1fee9f[_0xf315('0x66')][_0xf8495e]['field']+'\x20'+_0x1fee9f[_0xf315('0x66')][_0xf8495e][_0xf315('0x68')]+(_0x74e68b(_0x1fee9f[_0xf315('0x66')][_0xf8495e][_0xf315('0x68')])?'\x20'+_0x1fee9f[_0xf315('0x66')][_0xf8495e]['value']:'');}return _0x328c0c+')';};var _0x1e5595={'where':{'id':_0x258127['params']['id']}},_0x96d736,_0x523acb,_0xb1aaf3,_0x17b644,_0x4f0023;_0x1e5595=_[_0xf315('0x43')]({},_0x1e5595,_0x258127['options']);return db[_0xf315('0x30')]['find'](_0x1e5595)[_0xf315('0x2a')](function(_0x5ab0ab){if(_0x5ab0ab){_0x96d736=_0x5ab0ab;return _0x5ab0ab['getFields']();}return null;})['then'](function(_0x4c49b3){if(_0x4c49b3){if(!_0x4c49b3[_0xf315('0x3c')]){throw new db[(_0xf315('0x69'))]['ValidationErrorItem'](_0xf315('0x6a'),0x193);}_0x523acb=_0x4c49b3;return db[_0xf315('0x6b')][_0xf315('0x47')]({'raw':!![]});}return null;})[_0xf315('0x2a')](function(_0x1d1e3a){if(_0x1d1e3a){_0xb1aaf3=_['keyBy'](_0x1d1e3a,'id');var _0x50d84e;var _0x89633b=squel[_0xf315('0x6c')]();_0x89633b[_0xf315('0x6d')](_0x96d736[_0xf315('0x6e')]);for(var _0x208e07=0x0;_0x208e07<_0x523acb[_0xf315('0x3c')];_0x208e07+=0x1){_0x50d84e=_0x523acb[_0x208e07][_0xf315('0x6f')]?_0xb1aaf3[_0x523acb[_0x208e07][_0xf315('0x6f')]][_0xf315('0x70')]:_0x523acb[_0x208e07]['field'];_0x50d84e=_0x523acb[_0x208e07][_0xf315('0x71')]?_[_0xf315('0x72')](_0x3a9d1a[_0x523acb[_0x208e07][_0xf315('0x71')]],'%s',_0x50d84e):_0x50d84e;_0x50d84e=_0x523acb[_0x208e07][_0xf315('0x73')]?_[_0xf315('0x72')](_0x1d0cce[_0x523acb[_0x208e07][_0xf315('0x73')]],'%s',_0x50d84e):_0x50d84e;if(_0x523acb[_0x208e07][_0xf315('0x74')]){_0x89633b[_0xf315('0x67')](_0x50d84e);}_0x523acb[_0x208e07]['orderBy']&&_0x89633b[_0xf315('0x75')](_0x50d84e,_0x523acb[_0x208e07]['orderBy']===_0xf315('0x76')?![]:!![]);_0x89633b['field'](_0x50d84e,_0x523acb[_0x208e07][_0xf315('0x77')]||_0x50d84e);}if(_0x96d736[_0xf315('0x78')]){_0x96d736['joins']=JSON['parse'](_0x96d736[_0xf315('0x78')]);for(var _0x507b29=0x0;_0x507b29<_0x96d736[_0xf315('0x78')][_0xf315('0x3c')];_0x507b29+=0x1){if(_0x96d736['joins'][_0x507b29][_0xf315('0x33')]&&_[_0xf315('0x79')](_0xda40ed,_0x96d736[_0xf315('0x78')][_0x507b29]['type'])&&_0x96d736[_0xf315('0x78')][_0x507b29][_0xf315('0x7a')]&&_0x96d736[_0xf315('0x78')][_0x507b29][_0xf315('0x7b')]&&_0x96d736[_0xf315('0x78')][_0x507b29][_0xf315('0x7c')]){_0x89633b[_0x96d736[_0xf315('0x78')][_0x507b29][_0xf315('0x33')]](_0x96d736['joins'][_0x507b29][_0xf315('0x7b')],null,util[_0xf315('0x73')](_0xf315('0x7d'),_0x96d736[_0xf315('0x6e')],_0x96d736['joins'][_0x507b29][_0xf315('0x7a')],_0x96d736[_0xf315('0x78')][_0x507b29]['foreignTable'],_0x96d736['joins'][_0x507b29]['foreignKey']));}}}if(_0x96d736[_0xf315('0x7e')]){_0x96d736[_0xf315('0x7e')]=JSON[_0xf315('0x7f')](_0x96d736[_0xf315('0x7e')]);_0x89633b['where'](_0x2610ab(_0x96d736[_0xf315('0x7e')][_0xf315('0x67')]));}_0x4f0023=_0x89633b['clone']();_0x89633b['limit'](_0x119dd7);_0x89633b['offset'](0x0);logger[_0xf315('0x80')](_0xf315('0x81'),_0x89633b[_0xf315('0x82')]());return dbH[_0xf315('0x83')]['query'](_0x89633b[_0xf315('0x82')](),{'type':dbH[_0xf315('0x83')][_0xf315('0x84')]['SELECT']});}})[_0xf315('0x2a')](respondWithResult(_0xa79895,null))[_0xf315('0x49')](handleError(_0xa79895,null));};function runReport(_0x1d84d6,_0x384ade,_0x3e97a3){var _0x4e935e=_0x384ade['name'];var _0x2cfac9=0xa;var _0x5c0bc2=[_0xf315('0x85'),_0xf315('0x59'),'right_join',_0xf315('0x86')];var _0x2303aa={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xf315('0x5b'),'MAX':_0xf315('0x5c'),'MIN':_0xf315('0x87'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xf315('0x5e'),'GROUP_CONCAT ASC':_0xf315('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xffe17={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf315('0x88'),'HOUR':_0xf315('0x61'),'ROUND':_0xf315('0x62'),'UNIX_TIMESTAMP':_0xf315('0x63')};var _0x41bf36=function(_0x54940b){return!_['includes']([_0xf315('0x64'),_0xf315('0x65'),'IS\x20EMPTY',_0xf315('0x89')],_0x54940b);};var _0x3c49ee=function(_0x504244){if(!_0x504244||!_0x504244['rules'][_0xf315('0x3c')]){return'';}for(var _0xc754a8='(',_0xcd6249=0x0;_0xcd6249<_0x504244['rules']['length'];_0xcd6249+=0x1){_0xcd6249>0x0&&(_0xc754a8+='\x20'+_0x504244[_0xf315('0x8a')]+'\x20');_0xc754a8+=_0x504244['rules'][_0xcd6249][_0xf315('0x67')]?_0x3c49ee(_0x504244[_0xf315('0x66')][_0xcd6249][_0xf315('0x67')]):_0x504244[_0xf315('0x66')][_0xcd6249][_0xf315('0x8b')]+'\x20'+_0x504244[_0xf315('0x66')][_0xcd6249][_0xf315('0x68')]+(_0x41bf36(_0x504244[_0xf315('0x66')][_0xcd6249][_0xf315('0x68')])?'\x20'+_0x504244[_0xf315('0x66')][_0xcd6249]['value']:'');}return _0xc754a8+')';};var _0x3bd61c={'where':{'id':_0x1d84d6['id']}},_0x1cee84,_0x3d23da,_0x2c4ff0,_0xcc0898,_0xe9b63d;_0x3bd61c=_[_0xf315('0x43')]({},_0x3bd61c,_0x3e97a3);return db[_0xf315('0x30')]['find'](_0x3bd61c)[_0xf315('0x2a')](function(_0x192749){if(_0x192749){_0x1cee84=_0x192749;return _0x192749[_0xf315('0x8c')]();}return null;})['then'](function(_0x328d0e){if(_0x328d0e){if(!_0x328d0e['length']){throw new db[(_0xf315('0x69'))][(_0xf315('0x8d'))](_0xf315('0x6a'),0x193);}_0x3d23da=_0x328d0e;return db[_0xf315('0x6b')]['findAll']({'raw':!![]});}return null;})[_0xf315('0x2a')](function(_0x26773e){if(_0x26773e){_0x2c4ff0=_[_0xf315('0x8e')](_0x26773e,'id');var _0x59829e;var _0x25b4bb=squel[_0xf315('0x6c')]();_0x25b4bb[_0xf315('0x6d')](_0x1cee84[_0xf315('0x6e')]);for(var _0x128547=0x0;_0x128547<_0x3d23da[_0xf315('0x3c')];_0x128547+=0x1){_0x59829e=_0x3d23da[_0x128547]['MetricId']?_0x2c4ff0[_0x3d23da[_0x128547][_0xf315('0x6f')]][_0xf315('0x70')]:_0x3d23da[_0x128547][_0xf315('0x8b')];_0x59829e=_0x3d23da[_0x128547][_0xf315('0x71')]?_['replace'](_0x2303aa[_0x3d23da[_0x128547][_0xf315('0x71')]],'%s',_0x59829e):_0x59829e;_0x59829e=_0x3d23da[_0x128547][_0xf315('0x73')]?_[_0xf315('0x72')](_0xffe17[_0x3d23da[_0x128547][_0xf315('0x73')]],'%s',_0x59829e):_0x59829e;if(_0x3d23da[_0x128547][_0xf315('0x74')]){_0x25b4bb[_0xf315('0x67')](_0x59829e);}_0x3d23da[_0x128547][_0xf315('0x8f')]&&_0x25b4bb['order'](_0x59829e,_0x3d23da[_0x128547][_0xf315('0x8f')]===_0xf315('0x76')?![]:!![]);_0x25b4bb[_0xf315('0x8b')](_0x59829e,_0x3d23da[_0x128547][_0xf315('0x77')]||_0x59829e);}if(_0x1cee84[_0xf315('0x78')]){_0x1cee84[_0xf315('0x78')]=JSON[_0xf315('0x7f')](_0x1cee84[_0xf315('0x78')]);for(var _0xb9b54=0x0;_0xb9b54<_0x1cee84['joins'][_0xf315('0x3c')];_0xb9b54+=0x1){if(_0x1cee84[_0xf315('0x78')][_0xb9b54][_0xf315('0x33')]&&_[_0xf315('0x79')](_0x5c0bc2,_0x1cee84['joins'][_0xb9b54][_0xf315('0x33')])&&_0x1cee84[_0xf315('0x78')][_0xb9b54]['parentKey']&&_0x1cee84[_0xf315('0x78')][_0xb9b54][_0xf315('0x7b')]&&_0x1cee84[_0xf315('0x78')][_0xb9b54][_0xf315('0x7c')]){_0x25b4bb[_0x1cee84[_0xf315('0x78')][_0xb9b54][_0xf315('0x33')]](_0x1cee84['joins'][_0xb9b54]['foreignTable'],null,util[_0xf315('0x73')]('%s.%s\x20=\x20%s.%s',_0x1cee84[_0xf315('0x6e')],_0x1cee84[_0xf315('0x78')][_0xb9b54][_0xf315('0x7a')],_0x1cee84[_0xf315('0x78')][_0xb9b54]['foreignTable'],_0x1cee84['joins'][_0xb9b54][_0xf315('0x7c')]));}}}if(_0x1cee84[_0xf315('0x7e')]){_0x1cee84[_0xf315('0x7e')]=JSON['parse'](_0x1cee84[_0xf315('0x7e')]);_0x25b4bb[_0xf315('0x40')](_0x3c49ee(_0x1cee84[_0xf315('0x7e')][_0xf315('0x67')]));}_0xe9b63d=_0x25b4bb[_0xf315('0x90')]();_0x25b4bb[_0xf315('0x23')](_0x2cfac9);_0x25b4bb['offset'](0x0);return;}})[_0xf315('0x2a')](function(){if(_0x384ade[_0xf315('0x91')]==='web'){return null;}var _0x44e938=_[_0xf315('0x43')](_0x384ade,{'name':_0x384ade[_0xf315('0x92')]||_0x384ade[_0xf315('0x2d')]||_0x1cee84['name'],'basename':_0x4e935e,'savename':util[_0xf315('0x73')](_0xf315('0x93'),_0x384ade[_0xf315('0x2d')]||_0x1cee84['name'],require(_0xf315('0x94'))[_0xf315('0x95')](0x4),_0x384ade['output']||_0xf315('0x96')),'reportId':_0x1cee84['id'],'reportType':_0xf315('0x97')});return db[_0xf315('0x98')][_0xf315('0x4b')](_0x44e938,{'raw':!![]});})[_0xf315('0x2a')](function(_0x55487b){if(_0x1cee84[_0xf315('0x6e')]==='cdr'){_0xe9b63d['where'](_0x1cee84[_0xf315('0x6e')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x384ade[_0xf315('0x99')],_0x384ade[_0xf315('0x9a')]);}else{_0xe9b63d[_0xf315('0x40')](_0x1cee84[_0xf315('0x6e')]+_0xf315('0x9b'),_0x384ade[_0xf315('0x99')],_0x384ade[_0xf315('0x9a')]);}if(_0x55487b){logger[_0xf315('0x9c')](_0xf315('0x9d'),_0xe9b63d['toString']());require('child_process')[_0xf315('0x9e')](path[_0xf315('0x85')](__dirname,_0xf315('0x9f'),_0x55487b[_0xf315('0x91')]),[_0x55487b['id'],_0xe9b63d['toString'](),path[_0xf315('0x85')](__dirname,'../../files/reports',_0x55487b[_0xf315('0xa0')]),_0x4e935e]);return _0x55487b;}else{var _0x4fbe48=squel['select']();_0x4fbe48[_0xf315('0x6d')]('('+_0xe9b63d[_0xf315('0x82')]()+')',_0xf315('0xa1'));_0x4fbe48[_0xf315('0x8b')](_0xf315('0xa2'),_0xf315('0x24'));_0xe9b63d['limit'](_0x384ade['limit']||_0x2cfac9);_0xe9b63d[_0xf315('0x21')](_0x384ade[_0xf315('0x21')]||0x0);return dbH['sequelize'][_0xf315('0x36')](_0x4fbe48[_0xf315('0x82')](),{'type':dbH[_0xf315('0x83')]['QueryTypes'][_0xf315('0xa3')]})[_0xf315('0x2a')](function(_0x4da8d5){if(!_0x4da8d5[_0xf315('0x3c')]){_0xcc0898=0x0;}else{_0xcc0898=_0x4da8d5[0x0][_0xf315('0x24')]||0x0;}return dbH[_0xf315('0x83')]['query'](_0xe9b63d[_0xf315('0x82')](),{'type':dbH['sequelize'][_0xf315('0x84')][_0xf315('0xa3')]});})[_0xf315('0x2a')](function(_0x56be51){return{'rows':_0x56be51||[],'count':_0xcc0898};});}});}exports[_0xf315('0xa4')]=function(_0x4ce7eb,_0x16efe3){return runReport(_0x4ce7eb[_0xf315('0x57')],_0x4ce7eb[_0xf315('0x36')],_0x4ce7eb['options'])[_0xf315('0x2a')](respondWithResult(_0x16efe3,null))[_0xf315('0x49')](handleError(_0x16efe3,null));};exports[_0xf315('0xa5')]=runReport;exports[_0xf315('0x36')]=function(_0x117646,_0x44296e){var _0x10587d=0xa;var _0x5694cc=[_0xf315('0x85'),_0xf315('0x59'),_0xf315('0xa6'),_0xf315('0x86')];var _0x5d8e3a={'SUM':'SUM(%s)','COUNT':_0xf315('0xa7'),'COUNT DISTINCT':_0xf315('0x5b'),'MAX':'MAX(%s)','MIN':_0xf315('0x87'),'AVG':_0xf315('0x5d'),'GROUP_CONCAT':_0xf315('0x5e'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xf315('0xa8')};var _0x1bd5f1={'SEC_TO_TIME':_0xf315('0x60'),'DATE':'DATE(%s)','HOUR':_0xf315('0x61'),'ROUND':_0xf315('0x62'),'UNIX_TIMESTAMP':_0xf315('0x63')};var _0x21d965=function(_0x1ad0b5){return!_[_0xf315('0x79')]([_0xf315('0x64'),_0xf315('0x65'),_0xf315('0xa9'),_0xf315('0x89')],_0x1ad0b5);};var _0x103000=function(_0x727abd){if(!_0x727abd||!_0x727abd[_0xf315('0x66')][_0xf315('0x3c')]){return'';}for(var _0x430f7e='(',_0x50cf3a=0x0;_0x50cf3a<_0x727abd['rules'][_0xf315('0x3c')];_0x50cf3a+=0x1){_0x50cf3a>0x0&&(_0x430f7e+='\x20'+_0x727abd[_0xf315('0x8a')]+'\x20');_0x430f7e+=_0x727abd[_0xf315('0x66')][_0x50cf3a][_0xf315('0x67')]?_0x103000(_0x727abd[_0xf315('0x66')][_0x50cf3a]['group']):_0x727abd[_0xf315('0x66')][_0x50cf3a][_0xf315('0x8b')]+'\x20'+_0x727abd[_0xf315('0x66')][_0x50cf3a]['condition']+(_0x21d965(_0x727abd[_0xf315('0x66')][_0x50cf3a][_0xf315('0x68')])?'\x20'+_0x727abd[_0xf315('0x66')][_0x50cf3a][_0xf315('0xaa')]:'');}return _0x430f7e+')';};var _0x38f754={'where':{'id':_0x117646[_0xf315('0x57')]['id']}},_0x1a1f63,_0x354c36,_0x35be20,_0x2ffc84,_0xadb328;_0x38f754=_[_0xf315('0x43')]({},_0x38f754,_0x117646[_0xf315('0x45')]);return db[_0xf315('0x30')][_0xf315('0x52')](_0x38f754)[_0xf315('0x2a')](function(_0x89c743){if(_0x89c743){_0x1a1f63=_0x89c743;return _0x89c743['getFields']();}return null;})[_0xf315('0x2a')](function(_0x35cffc){if(_0x35cffc){if(!_0x35cffc[_0xf315('0x3c')]){throw new db[(_0xf315('0x69'))][(_0xf315('0x8d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x354c36=_0x35cffc;return db[_0xf315('0x6b')][_0xf315('0x47')]({'raw':!![]});}return null;})[_0xf315('0x2a')](function(_0x4ec659){if(_0x4ec659){_0x35be20=_[_0xf315('0x8e')](_0x4ec659,'id');var _0x537ee5;var _0x38ac78=squel[_0xf315('0x6c')]();_0x38ac78[_0xf315('0x6d')](_0x1a1f63[_0xf315('0x6e')]);for(var _0x3c6bf9=0x0;_0x3c6bf9<_0x354c36[_0xf315('0x3c')];_0x3c6bf9+=0x1){_0x537ee5=_0x354c36[_0x3c6bf9][_0xf315('0x6f')]?_0x35be20[_0x354c36[_0x3c6bf9]['MetricId']][_0xf315('0x70')]:_0x354c36[_0x3c6bf9][_0xf315('0x8b')];_0x537ee5=_0x354c36[_0x3c6bf9][_0xf315('0x71')]?_[_0xf315('0x72')](_0x5d8e3a[_0x354c36[_0x3c6bf9][_0xf315('0x71')]],'%s',_0x537ee5):_0x537ee5;_0x537ee5=_0x354c36[_0x3c6bf9][_0xf315('0x73')]?_[_0xf315('0x72')](_0x1bd5f1[_0x354c36[_0x3c6bf9][_0xf315('0x73')]],'%s',_0x537ee5):_0x537ee5;if(_0x354c36[_0x3c6bf9]['groupBy']){_0x38ac78[_0xf315('0x67')](_0x537ee5);}_0x354c36[_0x3c6bf9][_0xf315('0x8f')]&&_0x38ac78[_0xf315('0x75')](_0x537ee5,_0x354c36[_0x3c6bf9]['orderBy']===_0xf315('0x76')?![]:!![]);_0x38ac78[_0xf315('0x8b')](_0x537ee5,_0x354c36[_0x3c6bf9]['alias']||_0x537ee5);}if(_0x1a1f63[_0xf315('0x78')]){_0x1a1f63[_0xf315('0x78')]=JSON[_0xf315('0x7f')](_0x1a1f63[_0xf315('0x78')]);for(var _0x1f6b05=0x0;_0x1f6b05<_0x1a1f63[_0xf315('0x78')][_0xf315('0x3c')];_0x1f6b05+=0x1){if(_0x1a1f63[_0xf315('0x78')][_0x1f6b05][_0xf315('0x33')]&&_['includes'](_0x5694cc,_0x1a1f63[_0xf315('0x78')][_0x1f6b05][_0xf315('0x33')])&&_0x1a1f63[_0xf315('0x78')][_0x1f6b05][_0xf315('0x7a')]&&_0x1a1f63[_0xf315('0x78')][_0x1f6b05][_0xf315('0x7b')]&&_0x1a1f63['joins'][_0x1f6b05][_0xf315('0x7c')]){_0x38ac78[_0x1a1f63[_0xf315('0x78')][_0x1f6b05][_0xf315('0x33')]](_0x1a1f63[_0xf315('0x78')][_0x1f6b05][_0xf315('0x7b')],null,util['format'](_0xf315('0x7d'),_0x1a1f63[_0xf315('0x6e')],_0x1a1f63[_0xf315('0x78')][_0x1f6b05][_0xf315('0x7a')],_0x1a1f63['joins'][_0x1f6b05][_0xf315('0x7b')],_0x1a1f63[_0xf315('0x78')][_0x1f6b05][_0xf315('0x7c')]));}}}if(_0x1a1f63[_0xf315('0x7e')]){_0x1a1f63[_0xf315('0x7e')]=JSON[_0xf315('0x7f')](_0x1a1f63['conditions']);_0x38ac78['where'](_0x103000(_0x1a1f63[_0xf315('0x7e')]['group']));}_0xadb328=_0x38ac78[_0xf315('0x90')]();_0x38ac78[_0xf315('0x23')](_0x10587d);_0x38ac78[_0xf315('0x21')](0x0);logger[_0xf315('0x80')](_0xf315('0x81'),_0x38ac78['toString']());return dbH[_0xf315('0x83')][_0xf315('0x36')](_0x38ac78[_0xf315('0x82')](),{'type':dbH[_0xf315('0x83')][_0xf315('0x84')][_0xf315('0xa3')]});}})[_0xf315('0x2a')](function(){return{'sql':_0xadb328[_0xf315('0x82')]()};})[_0xf315('0x2a')](respondWithResult(_0x44296e,null))['catch'](handleError(_0x44296e,null));}; \ No newline at end of file +var _0x69c5=['run','runReport','Please\x20insert\x20at\x20least\x20one\x20field','alias','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','AnalyticCustomReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','format','groupBy','orderBy','DESC','joins','parse','parentKey','foreignTable','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','right_join','cross_join','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20EMPTY','getFields','Sequelize','replace','foreignKey','output','web','%s-%s.%s','randomstring','generate','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','COUNT(*)','QueryTypes'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x69c5,0xad));var _0x569c=function(_0x4075fc,_0x527e26){_0x4075fc=_0x4075fc-0x0;var _0x2d79a1=_0x69c5[_0x4075fc];return _0x2d79a1;};'use strict';var emlformat=require(_0x569c('0x0'));var rimraf=require(_0x569c('0x1'));var zipdir=require(_0x569c('0x2'));var jsonpatch=require(_0x569c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x569c('0x4'));var Mustache=require(_0x569c('0x5'));var util=require(_0x569c('0x6'));var path=require(_0x569c('0x7'));var sox=require(_0x569c('0x8'));var csv=require(_0x569c('0x9'));var ejs=require(_0x569c('0xa'));var fs=require('fs');var fs_extra=require(_0x569c('0xb'));var _=require(_0x569c('0xc'));var squel=require('squel');var crypto=require(_0x569c('0xd'));var jsforce=require(_0x569c('0xe'));var deskjs=require(_0x569c('0xf'));var toCsv=require(_0x569c('0x9'));var querystring=require(_0x569c('0x10'));var Papa=require(_0x569c('0x11'));var Redis=require(_0x569c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x569c('0x13'));var as=require(_0x569c('0x14'));var hardwareService=require(_0x569c('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x569c('0x16'));var config=require(_0x569c('0x17'));var licenseUtil=require(_0x569c('0x18'));var db=require(_0x569c('0x19'))['db'];var dbH=require(_0x569c('0x19'))[_0x569c('0x1a')];function respondWithStatusCode(_0x5acc17,_0x151c1f){_0x151c1f=_0x151c1f||0xcc;return function(_0x29d188){if(_0x29d188){return _0x5acc17[_0x569c('0x1b')](_0x151c1f);}return _0x5acc17['status'](_0x151c1f)[_0x569c('0x1c')]();};}function respondWithResult(_0x41fc38,_0x4545da){_0x4545da=_0x4545da||0xc8;return function(_0x5863b){if(_0x5863b){return _0x41fc38[_0x569c('0x1d')](_0x4545da)['json'](_0x5863b);}};}function respondWithFilteredResult(_0x274805,_0x5cbfcb){return function(_0x40a19d){if(_0x40a19d){var _0x176b68=typeof _0x5cbfcb[_0x569c('0x1e')]===_0x569c('0x1f')&&typeof _0x5cbfcb[_0x569c('0x20')]===_0x569c('0x1f');var _0x168e85=_0x40a19d[_0x569c('0x21')];var _0x4acefd=_0x176b68?0x0:_0x5cbfcb[_0x569c('0x1e')];var _0x575497=_0x176b68?_0x40a19d[_0x569c('0x21')]:_0x5cbfcb[_0x569c('0x1e')]+_0x5cbfcb[_0x569c('0x20')];var _0x5cecb8;if(_0x575497>=_0x168e85){_0x575497=_0x168e85;_0x5cecb8=0xc8;}else{_0x5cecb8=0xce;}_0x274805[_0x569c('0x1d')](_0x5cecb8);return _0x274805[_0x569c('0x22')]('Content-Range',_0x4acefd+'-'+_0x575497+'/'+_0x168e85)[_0x569c('0x23')](_0x40a19d);}return null;};}function patchUpdates(_0xf11cba){return function(_0x500c3b){try{jsonpatch[_0x569c('0x24')](_0x500c3b,_0xf11cba,!![]);}catch(_0x3980c2){return BPromise['reject'](_0x3980c2);}return _0x500c3b[_0x569c('0x25')]();};}function saveUpdates(_0x5c613d,_0x316726){return function(_0x3f4ac1){if(_0x3f4ac1){return _0x3f4ac1[_0x569c('0x26')](_0x5c613d)[_0x569c('0x27')](function(_0x1ad84a){return _0x1ad84a;});}return null;};}function removeEntity(_0x383481,_0x30c0ab){return function(_0x1dce88){if(_0x1dce88){return _0x1dce88[_0x569c('0x28')]()[_0x569c('0x27')](function(){var _0x2bef04=_0x1dce88[_0x569c('0x29')]({'plain':!![]});var _0x4acb47='CustomReports';return db[_0x569c('0x2a')][_0x569c('0x28')]({'where':{'type':_0x4acb47,'resourceId':_0x2bef04['id']}})[_0x569c('0x27')](function(){return _0x1dce88;});})['then'](function(){_0x383481[_0x569c('0x1d')](0xcc)[_0x569c('0x1c')]();});}};}function handleEntityNotFound(_0x20785a,_0x37e97b){return function(_0x401c51){if(!_0x401c51){_0x20785a['sendStatus'](0x194);}return _0x401c51;};}function handleError(_0x2c42bd,_0x156fd5){_0x156fd5=_0x156fd5||0x1f4;return function(_0x13e378){logger[_0x569c('0x2b')](_0x13e378[_0x569c('0x2c')]);if(_0x13e378[_0x569c('0x2d')]){delete _0x13e378['name'];}_0x2c42bd['status'](_0x156fd5)['send'](_0x13e378);};}exports['index']=function(_0x4aa5a2,_0x2a83d5){var _0x58856d={},_0x49ceff={},_0x1aa45b={'count':0x0,'rows':[]};var _0x11261f=_['map'](db['AnalyticCustomReport'][_0x569c('0x2e')],function(_0x281775){return{'name':_0x281775[_0x569c('0x2f')],'type':_0x281775[_0x569c('0x30')]['key']};});_0x49ceff[_0x569c('0x31')]=_[_0x569c('0x32')](_0x11261f,_0x569c('0x2d'));_0x49ceff[_0x569c('0x33')]=_[_0x569c('0x34')](_0x4aa5a2[_0x569c('0x33')]);_0x49ceff[_0x569c('0x35')]=_[_0x569c('0x36')](_0x49ceff['model'],_0x49ceff[_0x569c('0x33')]);_0x58856d[_0x569c('0x37')]=_[_0x569c('0x36')](_0x49ceff[_0x569c('0x31')],qs[_0x569c('0x38')](_0x4aa5a2[_0x569c('0x33')]['fields']));_0x58856d[_0x569c('0x37')]=_0x58856d['attributes'][_0x569c('0x39')]?_0x58856d[_0x569c('0x37')]:_0x49ceff[_0x569c('0x31')];if(!_0x4aa5a2[_0x569c('0x33')][_0x569c('0x3a')]('nolimit')){_0x58856d[_0x569c('0x20')]=qs[_0x569c('0x20')](_0x4aa5a2[_0x569c('0x33')]['limit']);_0x58856d[_0x569c('0x1e')]=qs[_0x569c('0x1e')](_0x4aa5a2[_0x569c('0x33')][_0x569c('0x1e')]);}_0x58856d[_0x569c('0x3b')]=qs[_0x569c('0x3c')](_0x4aa5a2['query'][_0x569c('0x3c')]);_0x58856d['where']=qs[_0x569c('0x35')](_[_0x569c('0x3d')](_0x4aa5a2[_0x569c('0x33')],_0x49ceff[_0x569c('0x35')]),_0x11261f);if(_0x4aa5a2[_0x569c('0x33')][_0x569c('0x3e')]){_0x58856d[_0x569c('0x3f')]=_[_0x569c('0x40')](_0x58856d[_0x569c('0x3f')],{'$or':_['map'](_0x11261f,function(_0xe530bb){if(_0xe530bb[_0x569c('0x30')]!==_0x569c('0x41')){var _0x59009b={};_0x59009b[_0xe530bb['name']]={'$like':'%'+_0x4aa5a2[_0x569c('0x33')][_0x569c('0x3e')]+'%'};return _0x59009b;}})});}_0x58856d=_[_0x569c('0x40')]({},_0x58856d,_0x4aa5a2[_0x569c('0x42')]);var _0x38fd8a={'where':_0x58856d[_0x569c('0x3f')]};return db[_0x569c('0x43')][_0x569c('0x21')](_0x38fd8a)[_0x569c('0x27')](function(_0x1e875c){_0x1aa45b['count']=_0x1e875c;if(_0x4aa5a2['query'][_0x569c('0x44')]){_0x58856d[_0x569c('0x45')]=[{'all':!![]}];}return db[_0x569c('0x43')][_0x569c('0x46')](_0x58856d);})['then'](function(_0x4bf478){_0x1aa45b[_0x569c('0x47')]=_0x4bf478;return _0x1aa45b;})[_0x569c('0x27')](respondWithFilteredResult(_0x2a83d5,_0x58856d))[_0x569c('0x48')](handleError(_0x2a83d5,null));};exports[_0x569c('0x49')]=function(_0x4a1172,_0x5677da){var _0x10d4a3={'raw':![],'where':{'id':_0x4a1172[_0x569c('0x4a')]['id']}},_0x4f8812={};_0x4f8812[_0x569c('0x31')]=_[_0x569c('0x34')](db[_0x569c('0x43')]['rawAttributes']);_0x4f8812['query']=_['keys'](_0x4a1172['query']);_0x4f8812['filters']=_[_0x569c('0x36')](_0x4f8812[_0x569c('0x31')],_0x4f8812[_0x569c('0x33')]);_0x10d4a3[_0x569c('0x37')]=_['intersection'](_0x4f8812[_0x569c('0x31')],qs[_0x569c('0x38')](_0x4a1172[_0x569c('0x33')]['fields']));_0x10d4a3[_0x569c('0x37')]=_0x10d4a3[_0x569c('0x37')][_0x569c('0x39')]?_0x10d4a3[_0x569c('0x37')]:_0x4f8812['model'];if(_0x4a1172[_0x569c('0x33')][_0x569c('0x44')]){_0x10d4a3['include']=[{'all':!![]}];}_0x10d4a3=_['merge']({},_0x10d4a3,_0x4a1172[_0x569c('0x42')]);return db[_0x569c('0x43')][_0x569c('0x4b')](_0x10d4a3)[_0x569c('0x27')](handleEntityNotFound(_0x5677da,null))[_0x569c('0x27')](respondWithResult(_0x5677da,null))[_0x569c('0x48')](handleError(_0x5677da,null));};exports[_0x569c('0x4c')]=function(_0x32f6c7,_0x4c2b41){return db['AnalyticCustomReport'][_0x569c('0x4c')](_0x32f6c7[_0x569c('0x4d')],{})[_0x569c('0x27')](function(_0x49c922){var _0x514449=_0x32f6c7[_0x569c('0x4e')][_0x569c('0x29')]({'plain':!![]});if(!_0x514449)throw new Error(_0x569c('0x4f'));if(_0x514449[_0x569c('0x50')]==='user'){var _0xb68f87=_0x49c922[_0x569c('0x29')]({'plain':!![]});var _0x1743c5=_0x569c('0x51');return db[_0x569c('0x52')]['find']({'where':{'name':_0x1743c5,'userProfileId':_0x514449[_0x569c('0x53')]},'raw':!![]})[_0x569c('0x27')](function(_0x25076e){if(_0x25076e&&_0x25076e[_0x569c('0x54')]===0x0){return db['UserProfileResource'][_0x569c('0x4c')]({'name':_0xb68f87[_0x569c('0x2d')],'resourceId':_0xb68f87['id'],'type':_0x569c('0x55'),'sectionId':_0x25076e['id']},{})[_0x569c('0x27')](function(){return _0x49c922;});}else{return _0x49c922;}})['catch'](function(_0x3a18e0){logger[_0x569c('0x2b')](_0x569c('0x56'),_0x3a18e0);throw _0x3a18e0;});}return _0x49c922;})[_0x569c('0x27')](respondWithResult(_0x4c2b41,0xc9))[_0x569c('0x48')](handleError(_0x4c2b41,null));};exports['update']=function(_0xbcb71a,_0x19e3da){if(_0xbcb71a[_0x569c('0x4d')]['id']){delete _0xbcb71a[_0x569c('0x4d')]['id'];}return db[_0x569c('0x43')][_0x569c('0x4b')]({'where':{'id':_0xbcb71a[_0x569c('0x4a')]['id']}})[_0x569c('0x27')](handleEntityNotFound(_0x19e3da,null))[_0x569c('0x27')](saveUpdates(_0xbcb71a['body'],null))[_0x569c('0x27')](respondWithResult(_0x19e3da,null))['catch'](handleError(_0x19e3da,null));};exports[_0x569c('0x28')]=function(_0x8ba5d4,_0x366faa){return db[_0x569c('0x43')][_0x569c('0x4b')]({'where':{'id':_0x8ba5d4[_0x569c('0x4a')]['id']}})[_0x569c('0x27')](handleEntityNotFound(_0x366faa,null))[_0x569c('0x27')](removeEntity(_0x366faa,null))[_0x569c('0x48')](handleError(_0x366faa,null));};exports[_0x569c('0x57')]=function(_0x387a38,_0x74843d){var _0x2f0220=0xa;var _0x40091a=[_0x569c('0x58'),_0x569c('0x59'),'right_join','cross_join'];var _0x4e6cdb={'SUM':_0x569c('0x5a'),'COUNT':_0x569c('0x5b'),'COUNT DISTINCT':_0x569c('0x5c'),'MAX':_0x569c('0x5d'),'MIN':'MIN(%s)','AVG':_0x569c('0x5e'),'GROUP_CONCAT':_0x569c('0x5f'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x569c('0x60')};var _0x2642c9={'SEC_TO_TIME':_0x569c('0x61'),'DATE':_0x569c('0x62'),'HOUR':_0x569c('0x63'),'ROUND':_0x569c('0x64'),'UNIX_TIMESTAMP':_0x569c('0x65')};var _0x1e986c=function(_0x366ba3){return!_[_0x569c('0x66')]([_0x569c('0x67'),_0x569c('0x68'),_0x569c('0x69'),'IS\x20NOT\x20EMPTY'],_0x366ba3);};var _0x211faa=function(_0x43aa75){if(!_0x43aa75||!_0x43aa75[_0x569c('0x6a')][_0x569c('0x39')]){return'';}for(var _0x275806='(',_0x584dc9=0x0;_0x584dc9<_0x43aa75[_0x569c('0x6a')][_0x569c('0x39')];_0x584dc9+=0x1){_0x584dc9>0x0&&(_0x275806+='\x20'+_0x43aa75[_0x569c('0x6b')]+'\x20');_0x275806+=_0x43aa75[_0x569c('0x6a')][_0x584dc9][_0x569c('0x6c')]?_0x211faa(_0x43aa75[_0x569c('0x6a')][_0x584dc9][_0x569c('0x6c')]):_0x43aa75['rules'][_0x584dc9][_0x569c('0x6d')]+'\x20'+_0x43aa75[_0x569c('0x6a')][_0x584dc9][_0x569c('0x6e')]+(_0x1e986c(_0x43aa75['rules'][_0x584dc9][_0x569c('0x6e')])?'\x20'+_0x43aa75[_0x569c('0x6a')][_0x584dc9][_0x569c('0x6f')]:'');}return _0x275806+')';};var _0x160a09={'where':{'id':_0x387a38[_0x569c('0x4a')]['id']}},_0x53795f,_0x22a34e,_0x515c43,_0x5afcd4,_0x2744d4;_0x160a09=_[_0x569c('0x40')]({},_0x160a09,_0x387a38[_0x569c('0x42')]);return db[_0x569c('0x43')]['find'](_0x160a09)['then'](function(_0x3bac9e){if(_0x3bac9e){_0x53795f=_0x3bac9e;return _0x3bac9e['getFields']();}return null;})['then'](function(_0x5a4340){if(_0x5a4340){if(!_0x5a4340[_0x569c('0x39')]){throw new db['Sequelize'][(_0x569c('0x70'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x22a34e=_0x5a4340;return db[_0x569c('0x71')]['findAll']({'raw':!![]});}return null;})[_0x569c('0x27')](function(_0x11661c){if(_0x11661c){_0x515c43=_[_0x569c('0x72')](_0x11661c,'id');var _0x364d20;var _0x4f0705=squel[_0x569c('0x73')]();_0x4f0705[_0x569c('0x74')](_0x53795f[_0x569c('0x75')]);for(var _0x2e3526=0x0;_0x2e3526<_0x22a34e[_0x569c('0x39')];_0x2e3526+=0x1){_0x364d20=_0x22a34e[_0x2e3526]['MetricId']?_0x515c43[_0x22a34e[_0x2e3526][_0x569c('0x76')]][_0x569c('0x77')]:_0x22a34e[_0x2e3526][_0x569c('0x6d')];_0x364d20=_0x22a34e[_0x2e3526][_0x569c('0x78')]?_['replace'](_0x4e6cdb[_0x22a34e[_0x2e3526][_0x569c('0x78')]],'%s',_0x364d20):_0x364d20;_0x364d20=_0x22a34e[_0x2e3526][_0x569c('0x79')]?_['replace'](_0x2642c9[_0x22a34e[_0x2e3526][_0x569c('0x79')]],'%s',_0x364d20):_0x364d20;if(_0x22a34e[_0x2e3526][_0x569c('0x7a')]){_0x4f0705[_0x569c('0x6c')](_0x364d20);}_0x22a34e[_0x2e3526][_0x569c('0x7b')]&&_0x4f0705[_0x569c('0x3b')](_0x364d20,_0x22a34e[_0x2e3526][_0x569c('0x7b')]===_0x569c('0x7c')?![]:!![]);_0x4f0705[_0x569c('0x6d')](_0x364d20,_0x22a34e[_0x2e3526]['alias']||_0x364d20);}if(_0x53795f[_0x569c('0x7d')]){_0x53795f[_0x569c('0x7d')]=JSON[_0x569c('0x7e')](_0x53795f[_0x569c('0x7d')]);for(var _0x481e42=0x0;_0x481e42<_0x53795f['joins'][_0x569c('0x39')];_0x481e42+=0x1){if(_0x53795f[_0x569c('0x7d')][_0x481e42][_0x569c('0x30')]&&_[_0x569c('0x66')](_0x40091a,_0x53795f['joins'][_0x481e42][_0x569c('0x30')])&&_0x53795f[_0x569c('0x7d')][_0x481e42][_0x569c('0x7f')]&&_0x53795f[_0x569c('0x7d')][_0x481e42][_0x569c('0x80')]&&_0x53795f[_0x569c('0x7d')][_0x481e42]['foreignKey']){_0x4f0705[_0x53795f['joins'][_0x481e42][_0x569c('0x30')]](_0x53795f[_0x569c('0x7d')][_0x481e42]['foreignTable'],null,util[_0x569c('0x79')]('%s.%s\x20=\x20%s.%s',_0x53795f['table'],_0x53795f[_0x569c('0x7d')][_0x481e42][_0x569c('0x7f')],_0x53795f[_0x569c('0x7d')][_0x481e42]['foreignTable'],_0x53795f[_0x569c('0x7d')][_0x481e42]['foreignKey']));}}}if(_0x53795f['conditions']){_0x53795f[_0x569c('0x81')]=JSON[_0x569c('0x7e')](_0x53795f['conditions']);_0x4f0705[_0x569c('0x3f')](_0x211faa(_0x53795f[_0x569c('0x81')][_0x569c('0x6c')]));}_0x2744d4=_0x4f0705[_0x569c('0x82')]();_0x4f0705[_0x569c('0x20')](_0x2f0220);_0x4f0705[_0x569c('0x1e')](0x0);logger[_0x569c('0x83')](_0x569c('0x84'),_0x4f0705[_0x569c('0x85')]());return dbH['sequelize'][_0x569c('0x33')](_0x4f0705[_0x569c('0x85')](),{'type':dbH[_0x569c('0x86')]['QueryTypes'][_0x569c('0x87')]});}})[_0x569c('0x27')](respondWithResult(_0x74843d,null))[_0x569c('0x48')](handleError(_0x74843d,null));};function runReport(_0x5bd7f2,_0x1d7376,_0x3b2eb1){var _0x529da9=_0x1d7376[_0x569c('0x2d')];var _0x4cf392=0xa;var _0x37f9bb=[_0x569c('0x58'),_0x569c('0x59'),_0x569c('0x88'),_0x569c('0x89')];var _0x23928c={'SUM':_0x569c('0x5a'),'COUNT':_0x569c('0x5b'),'COUNT DISTINCT':_0x569c('0x5c'),'MAX':_0x569c('0x5d'),'MIN':_0x569c('0x8a'),'AVG':_0x569c('0x5e'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x569c('0x8b'),'GROUP_CONCAT DESC':_0x569c('0x60')};var _0x395a2b={'SEC_TO_TIME':_0x569c('0x61'),'DATE':_0x569c('0x62'),'HOUR':'HOUR(%s)','ROUND':_0x569c('0x64'),'UNIX_TIMESTAMP':_0x569c('0x65')};var _0x72609a=function(_0x15aa64){return!_[_0x569c('0x66')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x569c('0x69'),_0x569c('0x8c')],_0x15aa64);};var _0x5092c2=function(_0x1702cb){if(!_0x1702cb||!_0x1702cb[_0x569c('0x6a')][_0x569c('0x39')]){return'';}for(var _0x4670d2='(',_0x21242f=0x0;_0x21242f<_0x1702cb[_0x569c('0x6a')][_0x569c('0x39')];_0x21242f+=0x1){_0x21242f>0x0&&(_0x4670d2+='\x20'+_0x1702cb[_0x569c('0x6b')]+'\x20');_0x4670d2+=_0x1702cb[_0x569c('0x6a')][_0x21242f][_0x569c('0x6c')]?_0x5092c2(_0x1702cb[_0x569c('0x6a')][_0x21242f]['group']):_0x1702cb['rules'][_0x21242f][_0x569c('0x6d')]+'\x20'+_0x1702cb[_0x569c('0x6a')][_0x21242f][_0x569c('0x6e')]+(_0x72609a(_0x1702cb['rules'][_0x21242f][_0x569c('0x6e')])?'\x20'+_0x1702cb[_0x569c('0x6a')][_0x21242f][_0x569c('0x6f')]:'');}return _0x4670d2+')';};var _0x180a3f={'where':{'id':_0x5bd7f2['id']}},_0x2c68b7,_0x20f106,_0x180241,_0x1eba0e,_0x21cda8;_0x180a3f=_[_0x569c('0x40')]({},_0x180a3f,_0x3b2eb1);return db['AnalyticCustomReport'][_0x569c('0x4b')](_0x180a3f)[_0x569c('0x27')](function(_0x5b60b2){if(_0x5b60b2){_0x2c68b7=_0x5b60b2;return _0x5b60b2[_0x569c('0x8d')]();}return null;})[_0x569c('0x27')](function(_0x55fb49){if(_0x55fb49){if(!_0x55fb49['length']){throw new db[(_0x569c('0x8e'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x20f106=_0x55fb49;return db[_0x569c('0x71')][_0x569c('0x46')]({'raw':!![]});}return null;})[_0x569c('0x27')](function(_0x5689f3){if(_0x5689f3){_0x180241=_[_0x569c('0x72')](_0x5689f3,'id');var _0x5485fa;var _0x3f1ce7=squel[_0x569c('0x73')]();_0x3f1ce7[_0x569c('0x74')](_0x2c68b7[_0x569c('0x75')]);for(var _0x4b1d56=0x0;_0x4b1d56<_0x20f106['length'];_0x4b1d56+=0x1){_0x5485fa=_0x20f106[_0x4b1d56][_0x569c('0x76')]?_0x180241[_0x20f106[_0x4b1d56][_0x569c('0x76')]][_0x569c('0x77')]:_0x20f106[_0x4b1d56][_0x569c('0x6d')];_0x5485fa=_0x20f106[_0x4b1d56]['function']?_[_0x569c('0x8f')](_0x23928c[_0x20f106[_0x4b1d56][_0x569c('0x78')]],'%s',_0x5485fa):_0x5485fa;_0x5485fa=_0x20f106[_0x4b1d56]['format']?_[_0x569c('0x8f')](_0x395a2b[_0x20f106[_0x4b1d56][_0x569c('0x79')]],'%s',_0x5485fa):_0x5485fa;if(_0x20f106[_0x4b1d56]['groupBy']){_0x3f1ce7[_0x569c('0x6c')](_0x5485fa);}_0x20f106[_0x4b1d56][_0x569c('0x7b')]&&_0x3f1ce7[_0x569c('0x3b')](_0x5485fa,_0x20f106[_0x4b1d56][_0x569c('0x7b')]===_0x569c('0x7c')?![]:!![]);_0x3f1ce7[_0x569c('0x6d')](_0x5485fa,_0x20f106[_0x4b1d56]['alias']||_0x5485fa);}if(_0x2c68b7['joins']){_0x2c68b7[_0x569c('0x7d')]=JSON['parse'](_0x2c68b7[_0x569c('0x7d')]);for(var _0x542bd3=0x0;_0x542bd3<_0x2c68b7[_0x569c('0x7d')]['length'];_0x542bd3+=0x1){if(_0x2c68b7[_0x569c('0x7d')][_0x542bd3][_0x569c('0x30')]&&_[_0x569c('0x66')](_0x37f9bb,_0x2c68b7[_0x569c('0x7d')][_0x542bd3][_0x569c('0x30')])&&_0x2c68b7[_0x569c('0x7d')][_0x542bd3][_0x569c('0x7f')]&&_0x2c68b7[_0x569c('0x7d')][_0x542bd3][_0x569c('0x80')]&&_0x2c68b7[_0x569c('0x7d')][_0x542bd3][_0x569c('0x90')]){_0x3f1ce7[_0x2c68b7[_0x569c('0x7d')][_0x542bd3][_0x569c('0x30')]](_0x2c68b7[_0x569c('0x7d')][_0x542bd3]['foreignTable'],null,util[_0x569c('0x79')]('%s.%s\x20=\x20%s.%s',_0x2c68b7['table'],_0x2c68b7['joins'][_0x542bd3][_0x569c('0x7f')],_0x2c68b7['joins'][_0x542bd3][_0x569c('0x80')],_0x2c68b7['joins'][_0x542bd3][_0x569c('0x90')]));}}}if(_0x2c68b7[_0x569c('0x81')]){_0x2c68b7[_0x569c('0x81')]=JSON['parse'](_0x2c68b7[_0x569c('0x81')]);_0x3f1ce7['where'](_0x5092c2(_0x2c68b7['conditions'][_0x569c('0x6c')]));}_0x21cda8=_0x3f1ce7[_0x569c('0x82')]();_0x3f1ce7[_0x569c('0x20')](_0x4cf392);_0x3f1ce7[_0x569c('0x1e')](0x0);return;}})[_0x569c('0x27')](function(){if(_0x1d7376[_0x569c('0x91')]===_0x569c('0x92')){return null;}var _0x4c13fa=_[_0x569c('0x40')](_0x1d7376,{'name':_0x1d7376['fullPath']||_0x1d7376['name']||_0x2c68b7['name'],'basename':_0x529da9,'savename':util[_0x569c('0x79')](_0x569c('0x93'),_0x1d7376[_0x569c('0x2d')]||_0x2c68b7['name'],require(_0x569c('0x94'))[_0x569c('0x95')](0x4),_0x1d7376['output']||'csv'),'reportId':_0x2c68b7['id'],'reportType':_0x569c('0x96')});return db[_0x569c('0x97')]['create'](_0x4c13fa,{'raw':!![]});})[_0x569c('0x27')](function(_0x3868c3){if(_0x2c68b7[_0x569c('0x75')]===_0x569c('0x98')){_0x21cda8[_0x569c('0x3f')](_0x2c68b7[_0x569c('0x75')]+_0x569c('0x99'),_0x1d7376[_0x569c('0x9a')],_0x1d7376[_0x569c('0x9b')]);}else{_0x21cda8[_0x569c('0x3f')](_0x2c68b7[_0x569c('0x75')]+_0x569c('0x9c'),_0x1d7376['startDate'],_0x1d7376[_0x569c('0x9b')]);}if(_0x3868c3){logger[_0x569c('0x9d')](_0x569c('0x9e'),_0x21cda8[_0x569c('0x85')]());require(_0x569c('0x9f'))['fork'](path[_0x569c('0x58')](__dirname,_0x569c('0xa0'),_0x3868c3['output']),[_0x3868c3['id'],_0x21cda8[_0x569c('0x85')](),path[_0x569c('0x58')](__dirname,_0x569c('0xa1'),_0x3868c3[_0x569c('0xa2')]),_0x529da9]);return _0x3868c3;}else{var _0x2a018d=squel[_0x569c('0x73')]();_0x2a018d['from']('('+_0x21cda8[_0x569c('0x85')]()+')','countTable');_0x2a018d['field'](_0x569c('0xa3'),'count');_0x21cda8[_0x569c('0x20')](_0x1d7376[_0x569c('0x20')]||_0x4cf392);_0x21cda8[_0x569c('0x1e')](_0x1d7376[_0x569c('0x1e')]||0x0);return dbH[_0x569c('0x86')][_0x569c('0x33')](_0x2a018d[_0x569c('0x85')](),{'type':dbH[_0x569c('0x86')][_0x569c('0xa4')]['SELECT']})['then'](function(_0x496f61){if(!_0x496f61[_0x569c('0x39')]){_0x1eba0e=0x0;}else{_0x1eba0e=_0x496f61[0x0][_0x569c('0x21')]||0x0;}return dbH[_0x569c('0x86')][_0x569c('0x33')](_0x21cda8[_0x569c('0x85')](),{'type':dbH[_0x569c('0x86')][_0x569c('0xa4')]['SELECT']});})[_0x569c('0x27')](function(_0x1b1b91){return{'rows':_0x1b1b91||[],'count':_0x1eba0e};});}});}exports[_0x569c('0xa5')]=function(_0x3a7aa5,_0x142769){return runReport(_0x3a7aa5['params'],_0x3a7aa5['query'],_0x3a7aa5[_0x569c('0x42')])['then'](respondWithResult(_0x142769,null))['catch'](handleError(_0x142769,null));};exports[_0x569c('0xa6')]=runReport;exports[_0x569c('0x33')]=function(_0x218545,_0x99fe10){var _0x587dc4=0xa;var _0x49a16c=[_0x569c('0x58'),_0x569c('0x59'),_0x569c('0x88'),_0x569c('0x89')];var _0x1c77c4={'SUM':_0x569c('0x5a'),'COUNT':_0x569c('0x5b'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x569c('0x5d'),'MIN':_0x569c('0x8a'),'AVG':_0x569c('0x5e'),'GROUP_CONCAT':_0x569c('0x5f'),'GROUP_CONCAT ASC':_0x569c('0x8b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x33c868={'SEC_TO_TIME':_0x569c('0x61'),'DATE':_0x569c('0x62'),'HOUR':_0x569c('0x63'),'ROUND':_0x569c('0x64'),'UNIX_TIMESTAMP':_0x569c('0x65')};var _0x2b1ace=function(_0x3db435){return!_[_0x569c('0x66')]([_0x569c('0x67'),_0x569c('0x68'),_0x569c('0x69'),_0x569c('0x8c')],_0x3db435);};var _0x1af7ef=function(_0x8ae814){if(!_0x8ae814||!_0x8ae814[_0x569c('0x6a')]['length']){return'';}for(var _0x40a03a='(',_0xcb46e8=0x0;_0xcb46e8<_0x8ae814[_0x569c('0x6a')][_0x569c('0x39')];_0xcb46e8+=0x1){_0xcb46e8>0x0&&(_0x40a03a+='\x20'+_0x8ae814['operator']+'\x20');_0x40a03a+=_0x8ae814['rules'][_0xcb46e8][_0x569c('0x6c')]?_0x1af7ef(_0x8ae814[_0x569c('0x6a')][_0xcb46e8][_0x569c('0x6c')]):_0x8ae814['rules'][_0xcb46e8]['field']+'\x20'+_0x8ae814[_0x569c('0x6a')][_0xcb46e8][_0x569c('0x6e')]+(_0x2b1ace(_0x8ae814[_0x569c('0x6a')][_0xcb46e8][_0x569c('0x6e')])?'\x20'+_0x8ae814[_0x569c('0x6a')][_0xcb46e8][_0x569c('0x6f')]:'');}return _0x40a03a+')';};var _0x53d27={'where':{'id':_0x218545[_0x569c('0x4a')]['id']}},_0x4edb86,_0x2943fe,_0x1b8b65,_0x58b5e6,_0x2801dd;_0x53d27=_[_0x569c('0x40')]({},_0x53d27,_0x218545[_0x569c('0x42')]);return db[_0x569c('0x43')][_0x569c('0x4b')](_0x53d27)[_0x569c('0x27')](function(_0x22928c){if(_0x22928c){_0x4edb86=_0x22928c;return _0x22928c['getFields']();}return null;})[_0x569c('0x27')](function(_0x4e75dd){if(_0x4e75dd){if(!_0x4e75dd['length']){throw new db['Sequelize'][(_0x569c('0x70'))](_0x569c('0xa7'),0x193);}_0x2943fe=_0x4e75dd;return db[_0x569c('0x71')][_0x569c('0x46')]({'raw':!![]});}return null;})[_0x569c('0x27')](function(_0x2f1d35){if(_0x2f1d35){_0x1b8b65=_[_0x569c('0x72')](_0x2f1d35,'id');var _0xd00063;var _0x49f317=squel[_0x569c('0x73')]();_0x49f317[_0x569c('0x74')](_0x4edb86[_0x569c('0x75')]);for(var _0x13a48b=0x0;_0x13a48b<_0x2943fe[_0x569c('0x39')];_0x13a48b+=0x1){_0xd00063=_0x2943fe[_0x13a48b]['MetricId']?_0x1b8b65[_0x2943fe[_0x13a48b]['MetricId']][_0x569c('0x77')]:_0x2943fe[_0x13a48b][_0x569c('0x6d')];_0xd00063=_0x2943fe[_0x13a48b][_0x569c('0x78')]?_[_0x569c('0x8f')](_0x1c77c4[_0x2943fe[_0x13a48b][_0x569c('0x78')]],'%s',_0xd00063):_0xd00063;_0xd00063=_0x2943fe[_0x13a48b][_0x569c('0x79')]?_['replace'](_0x33c868[_0x2943fe[_0x13a48b][_0x569c('0x79')]],'%s',_0xd00063):_0xd00063;if(_0x2943fe[_0x13a48b][_0x569c('0x7a')]){_0x49f317[_0x569c('0x6c')](_0xd00063);}_0x2943fe[_0x13a48b]['orderBy']&&_0x49f317[_0x569c('0x3b')](_0xd00063,_0x2943fe[_0x13a48b][_0x569c('0x7b')]===_0x569c('0x7c')?![]:!![]);_0x49f317[_0x569c('0x6d')](_0xd00063,_0x2943fe[_0x13a48b][_0x569c('0xa8')]||_0xd00063);}if(_0x4edb86[_0x569c('0x7d')]){_0x4edb86['joins']=JSON[_0x569c('0x7e')](_0x4edb86[_0x569c('0x7d')]);for(var _0x4c5512=0x0;_0x4c5512<_0x4edb86[_0x569c('0x7d')][_0x569c('0x39')];_0x4c5512+=0x1){if(_0x4edb86['joins'][_0x4c5512][_0x569c('0x30')]&&_[_0x569c('0x66')](_0x49a16c,_0x4edb86[_0x569c('0x7d')][_0x4c5512]['type'])&&_0x4edb86[_0x569c('0x7d')][_0x4c5512]['parentKey']&&_0x4edb86[_0x569c('0x7d')][_0x4c5512][_0x569c('0x80')]&&_0x4edb86[_0x569c('0x7d')][_0x4c5512][_0x569c('0x90')]){_0x49f317[_0x4edb86[_0x569c('0x7d')][_0x4c5512][_0x569c('0x30')]](_0x4edb86[_0x569c('0x7d')][_0x4c5512][_0x569c('0x80')],null,util[_0x569c('0x79')]('%s.%s\x20=\x20%s.%s',_0x4edb86[_0x569c('0x75')],_0x4edb86['joins'][_0x4c5512][_0x569c('0x7f')],_0x4edb86['joins'][_0x4c5512][_0x569c('0x80')],_0x4edb86['joins'][_0x4c5512][_0x569c('0x90')]));}}}if(_0x4edb86[_0x569c('0x81')]){_0x4edb86[_0x569c('0x81')]=JSON[_0x569c('0x7e')](_0x4edb86[_0x569c('0x81')]);_0x49f317[_0x569c('0x3f')](_0x1af7ef(_0x4edb86[_0x569c('0x81')][_0x569c('0x6c')]));}_0x2801dd=_0x49f317[_0x569c('0x82')]();_0x49f317['limit'](_0x587dc4);_0x49f317['offset'](0x0);logger[_0x569c('0x83')](_0x569c('0x84'),_0x49f317[_0x569c('0x85')]());return dbH['sequelize'][_0x569c('0x33')](_0x49f317[_0x569c('0x85')](),{'type':dbH[_0x569c('0x86')][_0x569c('0xa4')][_0x569c('0x87')]});}})[_0x569c('0x27')](function(){return{'sql':_0x2801dd['toString']()};})[_0x569c('0x27')](respondWithResult(_0x99fe10,null))[_0x569c('0x48')](handleError(_0x99fe10,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 1e0f050..3f216ea 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 _0x89f4=['util','api','moment','bluebird','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports'];(function(_0x4e0a44,_0xbadb96){var _0x45ed17=function(_0x2324a8){while(--_0x2324a8){_0x4e0a44['push'](_0x4e0a44['shift']());}};_0x45ed17(++_0xbadb96);}(_0x89f4,0x13f));var _0x489f=function(_0x3f4ad3,_0x5e3fe1){_0x3f4ad3=_0x3f4ad3-0x0;var _0x5e96a7=_0x89f4[_0x3f4ad3];return _0x5e96a7;};'use strict';var _=require('lodash');var util=require(_0x489f('0x0'));var logger=require('../../config/logger')(_0x489f('0x1'));var moment=require(_0x489f('0x2'));var BPromise=require(_0x489f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x489f('0x4'));var config=require(_0x489f('0x5'));var attributes=require(_0x489f('0x6'));module[_0x489f('0x7')]=function(_0x3d4c08,_0x5bc68a){return _0x3d4c08[_0x489f('0x8')](_0x489f('0x9'),attributes,{'tableName':_0x489f('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7783=['../../config/environment','./analyticCustomReport.attributes','define','analytics_custom_reports','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x1f7e2f,_0x5d0530){var _0x56f6cb=function(_0x53a8b5){while(--_0x53a8b5){_0x1f7e2f['push'](_0x1f7e2f['shift']());}};_0x56f6cb(++_0x5d0530);}(_0x7783,0x88));var _0x3778=function(_0x1f0690,_0x1666e0){_0x1f0690=_0x1f0690-0x0;var _0x2a821e=_0x7783[_0x1f0690];return _0x2a821e;};'use strict';var _=require(_0x3778('0x0'));var util=require(_0x3778('0x1'));var logger=require(_0x3778('0x2'))('api');var moment=require(_0x3778('0x3'));var BPromise=require(_0x3778('0x4'));var rp=require(_0x3778('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3778('0x6'));var config=require(_0x3778('0x7'));var attributes=require(_0x3778('0x8'));module['exports']=function(_0x3f9e49,_0x2b4564){return _0x3f9e49[_0x3778('0x9')]('AnalyticCustomReport',attributes,{'tableName':_0x3778('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index e39148b..25e752d 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 _0x5b09=['http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x274680,_0x3db2f4){var _0x397b48=function(_0x21306f){while(--_0x21306f){_0x274680['push'](_0x274680['shift']());}};_0x397b48(++_0x3db2f4);}(_0x5b09,0x10a));var _0x95b0=function(_0x2dc0a9,_0x4a02ce){_0x2dc0a9=_0x2dc0a9-0x0;var _0x27a33a=_0x5b09[_0x2dc0a9];return _0x27a33a;};'use strict';var _=require('lodash');var util=require(_0x95b0('0x0'));var moment=require(_0x95b0('0x1'));var BPromise=require(_0x95b0('0x2'));var rs=require(_0x95b0('0x3'));var fs=require('fs');var Redis=require(_0x95b0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x95b0('0x5'));var logger=require(_0x95b0('0x6'))('rpc');var config=require(_0x95b0('0x7'));var jayson=require(_0x95b0('0x8'));var client=jayson[_0x95b0('0x9')][_0x95b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2952f1,_0x15c6f5,_0x5b0168){return new BPromise(function(_0xaa763a,_0xeff2fb){return client[_0x95b0('0xb')](_0x2952f1,_0x5b0168)[_0x95b0('0xc')](function(_0x1a0d11){logger[_0x95b0('0xd')](_0x95b0('0xe'),_0x15c6f5,_0x95b0('0xf'));logger['debug'](_0x95b0('0x10'),_0x15c6f5,_0x95b0('0xf'),JSON[_0x95b0('0x11')](_0x1a0d11));if(_0x1a0d11['error']){if(_0x1a0d11[_0x95b0('0x12')][_0x95b0('0x13')]===0x1f4){logger[_0x95b0('0x12')](_0x95b0('0xe'),_0x15c6f5,_0x1a0d11[_0x95b0('0x12')]['message']);return _0xeff2fb(_0x1a0d11['error']['message']);}logger[_0x95b0('0x12')](_0x95b0('0xe'),_0x15c6f5,_0x1a0d11[_0x95b0('0x12')]['message']);return _0xaa763a(_0x1a0d11[_0x95b0('0x12')][_0x95b0('0x14')]);}else{logger[_0x95b0('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x15c6f5,'request\x20sent');_0xaa763a(_0x1a0d11[_0x95b0('0x15')][_0x95b0('0x14')]);}})[_0x95b0('0x16')](function(_0x588908){logger[_0x95b0('0x12')](_0x95b0('0xe'),_0x15c6f5,_0x588908);_0xeff2fb(_0x588908);});});} \ No newline at end of file +var _0x9227=['../../config/environment','jayson/promise','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x512188,_0x4a94d1){var _0x2fb8d5=function(_0x2e17d2){while(--_0x2e17d2){_0x512188['push'](_0x512188['shift']());}};_0x2fb8d5(++_0x4a94d1);}(_0x9227,0x16f));var _0x7922=function(_0x36994a,_0x4c3e2f){_0x36994a=_0x36994a-0x0;var _0x7b68ea=_0x9227[_0x36994a];return _0x7b68ea;};'use strict';var _=require(_0x7922('0x0'));var util=require(_0x7922('0x1'));var moment=require(_0x7922('0x2'));var BPromise=require('bluebird');var rs=require(_0x7922('0x3'));var fs=require('fs');var Redis=require(_0x7922('0x4'));var db=require(_0x7922('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7922('0x6'))('rpc');var config=require(_0x7922('0x7'));var jayson=require(_0x7922('0x8'));var client=jayson[_0x7922('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x931e5,_0x3a5785,_0x94ac59){return new BPromise(function(_0x49045c,_0x3bd780){return client[_0x7922('0xa')](_0x931e5,_0x94ac59)[_0x7922('0xb')](function(_0x1c79d7){logger[_0x7922('0xc')](_0x7922('0xd'),_0x3a5785,_0x7922('0xe'));logger[_0x7922('0xf')](_0x7922('0x10'),_0x3a5785,'request\x20sent',JSON[_0x7922('0x11')](_0x1c79d7));if(_0x1c79d7[_0x7922('0x12')]){if(_0x1c79d7[_0x7922('0x12')][_0x7922('0x13')]===0x1f4){logger['error'](_0x7922('0xd'),_0x3a5785,_0x1c79d7[_0x7922('0x12')]['message']);return _0x3bd780(_0x1c79d7['error'][_0x7922('0x14')]);}logger[_0x7922('0x12')](_0x7922('0xd'),_0x3a5785,_0x1c79d7[_0x7922('0x12')][_0x7922('0x14')]);return _0x49045c(_0x1c79d7[_0x7922('0x12')]['message']);}else{logger[_0x7922('0xc')](_0x7922('0xd'),_0x3a5785,_0x7922('0xe'));_0x49045c(_0x1c79d7['result'][_0x7922('0x14')]);}})[_0x7922('0x15')](function(_0xc139ac){logger[_0x7922('0x12')](_0x7922('0xd'),_0x3a5785,_0xc139ac);_0x3bd780(_0xc139ac);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index aa91ece..220824d 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 _0x80f8=['../../config/environment','get','isAuthenticated','/:id','show','/:id/run','run','query','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x48291a,_0x5a29dc){var _0xf76871=function(_0x2a4be5){while(--_0x2a4be5){_0x48291a['push'](_0x48291a['shift']());}};_0xf76871(++_0x5a29dc);}(_0x80f8,0xad));var _0x880f=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x80f8[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x880f('0x0'));var util=require('util');var path=require(_0x880f('0x1'));var timeout=require(_0x880f('0x2'));var express=require(_0x880f('0x3'));var router=express[_0x880f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x880f('0x5'));var interaction=require(_0x880f('0x6'));var config=require(_0x880f('0x7'));var controller=require('./analyticCustomReport.controller');router[_0x880f('0x8')]('/',auth[_0x880f('0x9')](),controller['index']);router[_0x880f('0x8')](_0x880f('0xa'),auth[_0x880f('0x9')](),controller[_0x880f('0xb')]);router[_0x880f('0x8')]('/:id/preview',auth[_0x880f('0x9')](),controller['preview']);router[_0x880f('0x8')](_0x880f('0xc'),auth[_0x880f('0x9')](),controller[_0x880f('0xd')]);router['get']('/:id/query',auth[_0x880f('0x9')](),controller[_0x880f('0xe')]);router['post']('/',auth[_0x880f('0x9')](),controller[_0x880f('0xf')]);router[_0x880f('0x10')](_0x880f('0xa'),auth[_0x880f('0x9')](),controller[_0x880f('0x11')]);router[_0x880f('0x12')](_0x880f('0xa'),auth[_0x880f('0x9')](),controller['destroy']);module[_0x880f('0x13')]=router; \ No newline at end of file +var _0x94ef=['/:id/preview','isAuthenticated','preview','/:id/run','run','/:id/query','query','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','index','/:id'];(function(_0x5a3f99,_0x3aa69e){var _0x51f530=function(_0x545664){while(--_0x545664){_0x5a3f99['push'](_0x5a3f99['shift']());}};_0x51f530(++_0x3aa69e);}(_0x94ef,0x1ee));var _0xf94e=function(_0xdd0fdb,_0x575b6b){_0xdd0fdb=_0xdd0fdb-0x0;var _0x64a044=_0x94ef[_0xdd0fdb];return _0x64a044;};'use strict';var multer=require(_0xf94e('0x0'));var util=require(_0xf94e('0x1'));var path=require(_0xf94e('0x2'));var timeout=require(_0xf94e('0x3'));var express=require('express');var router=express[_0xf94e('0x4')]();var fs_extra=require(_0xf94e('0x5'));var auth=require(_0xf94e('0x6'));var interaction=require(_0xf94e('0x7'));var config=require('../../config/environment');var controller=require(_0xf94e('0x8'));router[_0xf94e('0x9')]('/',auth['isAuthenticated'](),controller[_0xf94e('0xa')]);router['get'](_0xf94e('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xf94e('0x9')](_0xf94e('0xc'),auth[_0xf94e('0xd')](),controller[_0xf94e('0xe')]);router[_0xf94e('0x9')](_0xf94e('0xf'),auth[_0xf94e('0xd')](),controller[_0xf94e('0x10')]);router[_0xf94e('0x9')](_0xf94e('0x11'),auth[_0xf94e('0xd')](),controller[_0xf94e('0x12')]);router['post']('/',auth[_0xf94e('0xd')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xf94e('0x13')]);router[_0xf94e('0x14')](_0xf94e('0xb'),auth[_0xf94e('0xd')](),controller[_0xf94e('0x15')]);module[_0xf94e('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 7841656..d079813 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 _0x2eb2=['TEXT','exports','STRING'];(function(_0x1f46e1,_0x118eb6){var _0x2276ae=function(_0x5a99b0){while(--_0x5a99b0){_0x1f46e1['push'](_0x1f46e1['shift']());}};_0x2276ae(++_0x118eb6);}(_0x2eb2,0x19f));var _0x22eb=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x2eb2[_0x1ddedd];return _0xa3e1ac;};'use strict';var Sequelize=require('sequelize');module[_0x22eb('0x0')]={'name':{'type':Sequelize[_0x22eb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x22eb('0x1')]},'parent':{'type':Sequelize[_0x22eb('0x1')]},'table':{'type':Sequelize[_0x22eb('0x1')]},'conditions':{'type':Sequelize[_0x22eb('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xeff8=['STRING','TEXT','sequelize','exports'];(function(_0x30a0b8,_0x18308b){var _0x14bcaa=function(_0x38f5cd){while(--_0x38f5cd){_0x30a0b8['push'](_0x30a0b8['shift']());}};_0x14bcaa(++_0x18308b);}(_0xeff8,0x186));var _0x8eff=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0xeff8[_0x424a9a];return _0xa7831c;};'use strict';var Sequelize=require(_0x8eff('0x0'));module[_0x8eff('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8eff('0x2')]},'parent':{'type':Sequelize[_0x8eff('0x2')]},'table':{'type':Sequelize[_0x8eff('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x8eff('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 3eeaf13..6721d3b 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda19=['ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','field','function','replace','groupBy','orderBy','order','alias','joins','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20EMPTY','operator','Sequelize','metric','format','DESC','parse','parentKey','web','output','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','run','runReport','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','dbH','status','json','offset','undefined','limit','count','set','apply','update','then','DefaultReports','destroy','end','error','stack','name','send','map','AnalyticDefaultReport','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','merge','includeAll','include','findAll','show','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','condition','value','options','find','getFields'];(function(_0x5b7106,_0x19aca3){var _0x1313a8=function(_0x2ee898){while(--_0x2ee898){_0x5b7106['push'](_0x5b7106['shift']());}};_0x1313a8(++_0x19aca3);}(_0xda19,0xd5));var _0x9da1=function(_0x28feb1,_0xb1fe19){_0x28feb1=_0x28feb1-0x0;var _0x4cdbaf=_0xda19[_0x28feb1];return _0x4cdbaf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9da1('0x0'));var zipdir=require(_0x9da1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9da1('0x2'));var moment=require('moment');var BPromise=require(_0x9da1('0x3'));var Mustache=require('mustache');var util=require(_0x9da1('0x4'));var path=require(_0x9da1('0x5'));var sox=require(_0x9da1('0x6'));var csv=require(_0x9da1('0x7'));var ejs=require(_0x9da1('0x8'));var fs=require('fs');var fs_extra=require(_0x9da1('0x9'));var _=require(_0x9da1('0xa'));var squel=require(_0x9da1('0xb'));var crypto=require(_0x9da1('0xc'));var jsforce=require(_0x9da1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9da1('0xe'));var Redis=require('ioredis');var authService=require(_0x9da1('0xf'));var qs=require(_0x9da1('0x10'));var as=require(_0x9da1('0x11'));var hardwareService=require(_0x9da1('0x12'));var logger=require(_0x9da1('0x13'))(_0x9da1('0x14'));var utils=require(_0x9da1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9da1('0x16'))['db'];var dbH=require('../../mysqldb')[_0x9da1('0x17')];function respondWithStatusCode(_0x1d93f8,_0xd2d225){_0xd2d225=_0xd2d225||0xcc;return function(_0x1ffa2a){if(_0x1ffa2a){return _0x1d93f8['sendStatus'](_0xd2d225);}return _0x1d93f8[_0x9da1('0x18')](_0xd2d225)['end']();};}function respondWithResult(_0x4d17e1,_0x40ba9d){_0x40ba9d=_0x40ba9d||0xc8;return function(_0x479ccd){if(_0x479ccd){return _0x4d17e1[_0x9da1('0x18')](_0x40ba9d)[_0x9da1('0x19')](_0x479ccd);}};}function respondWithFilteredResult(_0x37653d,_0x1a1a6b){return function(_0x7f1a64){if(_0x7f1a64){var _0x514d8e=typeof _0x1a1a6b[_0x9da1('0x1a')]===_0x9da1('0x1b')&&typeof _0x1a1a6b[_0x9da1('0x1c')]===_0x9da1('0x1b');var _0xfb278d=_0x7f1a64[_0x9da1('0x1d')];var _0x497676=_0x514d8e?0x0:_0x1a1a6b['offset'];var _0x17205d=_0x514d8e?_0x7f1a64[_0x9da1('0x1d')]:_0x1a1a6b[_0x9da1('0x1a')]+_0x1a1a6b[_0x9da1('0x1c')];var _0x40a967;if(_0x17205d>=_0xfb278d){_0x17205d=_0xfb278d;_0x40a967=0xc8;}else{_0x40a967=0xce;}_0x37653d[_0x9da1('0x18')](_0x40a967);return _0x37653d[_0x9da1('0x1e')]('Content-Range',_0x497676+'-'+_0x17205d+'/'+_0xfb278d)[_0x9da1('0x19')](_0x7f1a64);}return null;};}function patchUpdates(_0x554845){return function(_0x9c3b37){try{jsonpatch[_0x9da1('0x1f')](_0x9c3b37,_0x554845,!![]);}catch(_0x1fc065){return BPromise['reject'](_0x1fc065);}return _0x9c3b37['save']();};}function saveUpdates(_0x14793b,_0x3e6f85){return function(_0x16ee0c){if(_0x16ee0c){return _0x16ee0c[_0x9da1('0x20')](_0x14793b)[_0x9da1('0x21')](function(_0x165b73){return _0x165b73;});}return null;};}function removeEntity(_0x4c60aa,_0x2413fe){return function(_0x3bfa40){if(_0x3bfa40){return _0x3bfa40['destroy']()[_0x9da1('0x21')](function(){var _0x3f5680=_0x3bfa40['get']({'plain':!![]});var _0x2fd49c=_0x9da1('0x22');return db['UserProfileResource'][_0x9da1('0x23')]({'where':{'type':_0x2fd49c,'resourceId':_0x3f5680['id']}})[_0x9da1('0x21')](function(){return _0x3bfa40;});})['then'](function(){_0x4c60aa['status'](0xcc)[_0x9da1('0x24')]();});}};}function handleEntityNotFound(_0x47055e,_0x5eca5b){return function(_0x27c6e2){if(!_0x27c6e2){_0x47055e['sendStatus'](0x194);}return _0x27c6e2;};}function handleError(_0x5a6f2d,_0x5a59c2){_0x5a59c2=_0x5a59c2||0x1f4;return function(_0x31b826){logger[_0x9da1('0x25')](_0x31b826[_0x9da1('0x26')]);if(_0x31b826[_0x9da1('0x27')]){delete _0x31b826[_0x9da1('0x27')];}_0x5a6f2d['status'](_0x5a59c2)[_0x9da1('0x28')](_0x31b826);};}exports['index']=function(_0x1feae0,_0x235ced){var _0x5b38b3={},_0xc29ba8={},_0x2eb48f={'count':0x0,'rows':[]};var _0x4f318b=_[_0x9da1('0x29')](db[_0x9da1('0x2a')][_0x9da1('0x2b')],function(_0x2b2b48){return{'name':_0x2b2b48['fieldName'],'type':_0x2b2b48['type'][_0x9da1('0x2c')]};});_0xc29ba8[_0x9da1('0x2d')]=_[_0x9da1('0x29')](_0x4f318b,_0x9da1('0x27'));_0xc29ba8[_0x9da1('0x2e')]=_['keys'](_0x1feae0[_0x9da1('0x2e')]);_0xc29ba8[_0x9da1('0x2f')]=_[_0x9da1('0x30')](_0xc29ba8[_0x9da1('0x2d')],_0xc29ba8[_0x9da1('0x2e')]);_0x5b38b3[_0x9da1('0x31')]=_['intersection'](_0xc29ba8[_0x9da1('0x2d')],qs['fields'](_0x1feae0['query'][_0x9da1('0x32')]));_0x5b38b3['attributes']=_0x5b38b3[_0x9da1('0x31')][_0x9da1('0x33')]?_0x5b38b3[_0x9da1('0x31')]:_0xc29ba8[_0x9da1('0x2d')];if(!_0x1feae0[_0x9da1('0x2e')][_0x9da1('0x34')](_0x9da1('0x35'))){_0x5b38b3[_0x9da1('0x1c')]=qs['limit'](_0x1feae0[_0x9da1('0x2e')]['limit']);_0x5b38b3[_0x9da1('0x1a')]=qs['offset'](_0x1feae0['query'][_0x9da1('0x1a')]);}_0x5b38b3['order']=qs[_0x9da1('0x36')](_0x1feae0[_0x9da1('0x2e')]['sort']);_0x5b38b3[_0x9da1('0x37')]=qs[_0x9da1('0x2f')](_[_0x9da1('0x38')](_0x1feae0[_0x9da1('0x2e')],_0xc29ba8['filters']),_0x4f318b);if(_0x1feae0[_0x9da1('0x2e')]['filter']){_0x5b38b3[_0x9da1('0x37')]=_['merge'](_0x5b38b3[_0x9da1('0x37')],{'$or':_[_0x9da1('0x29')](_0x4f318b,function(_0x58e165){if(_0x58e165[_0x9da1('0x39')]!==_0x9da1('0x3a')){var _0x394acf={};_0x394acf[_0x58e165['name']]={'$like':'%'+_0x1feae0['query']['filter']+'%'};return _0x394acf;}})});}_0x5b38b3=_[_0x9da1('0x3b')]({},_0x5b38b3,_0x1feae0['options']);var _0x5b215c={'where':_0x5b38b3[_0x9da1('0x37')]};return db[_0x9da1('0x2a')][_0x9da1('0x1d')](_0x5b215c)['then'](function(_0x42dbd8){_0x2eb48f[_0x9da1('0x1d')]=_0x42dbd8;if(_0x1feae0[_0x9da1('0x2e')][_0x9da1('0x3c')]){_0x5b38b3[_0x9da1('0x3d')]=[{'all':!![]}];}return db[_0x9da1('0x2a')][_0x9da1('0x3e')](_0x5b38b3);})['then'](function(_0x467350){_0x2eb48f['rows']=_0x467350;return _0x2eb48f;})[_0x9da1('0x21')](respondWithFilteredResult(_0x235ced,_0x5b38b3))['catch'](handleError(_0x235ced,null));};exports[_0x9da1('0x3f')]=function(_0x40d848,_0x599211){var _0x265366={'raw':!![],'where':{'id':_0x40d848['params']['id']}},_0xfeec5f={};_0xfeec5f[_0x9da1('0x2d')]=_['keys'](db[_0x9da1('0x2a')][_0x9da1('0x2b')]);_0xfeec5f['query']=_['keys'](_0x40d848[_0x9da1('0x2e')]);_0xfeec5f[_0x9da1('0x2f')]=_[_0x9da1('0x30')](_0xfeec5f[_0x9da1('0x2d')],_0xfeec5f[_0x9da1('0x2e')]);_0x265366[_0x9da1('0x31')]=_[_0x9da1('0x30')](_0xfeec5f[_0x9da1('0x2d')],qs['fields'](_0x40d848[_0x9da1('0x2e')][_0x9da1('0x32')]));_0x265366[_0x9da1('0x31')]=_0x265366['attributes'][_0x9da1('0x33')]?_0x265366[_0x9da1('0x31')]:_0xfeec5f[_0x9da1('0x2d')];if(_0x40d848['query'][_0x9da1('0x3c')]){_0x265366[_0x9da1('0x3d')]=[{'all':!![]}];}_0x265366=_[_0x9da1('0x3b')]({},_0x265366,_0x40d848['options']);return db[_0x9da1('0x2a')]['find'](_0x265366)['then'](handleEntityNotFound(_0x599211,null))[_0x9da1('0x21')](respondWithResult(_0x599211,null))[_0x9da1('0x40')](handleError(_0x599211,null));};exports['create']=function(_0x712d10,_0x2066d2){return db['AnalyticDefaultReport'][_0x9da1('0x41')](_0x712d10[_0x9da1('0x42')],{})[_0x9da1('0x21')](function(_0x3a529d){var _0x4780ca=_0x712d10[_0x9da1('0x43')][_0x9da1('0x44')]({'plain':!![]});if(!_0x4780ca)throw new Error(_0x9da1('0x45'));if(_0x4780ca[_0x9da1('0x46')]==='user'){var _0x147c65=_0x3a529d[_0x9da1('0x44')]({'plain':!![]});var _0x34a203=_0x9da1('0x47');return db['UserProfileSection']['find']({'where':{'name':_0x34a203,'userProfileId':_0x4780ca[_0x9da1('0x48')]},'raw':!![]})[_0x9da1('0x21')](function(_0x3870dd){if(_0x3870dd&&_0x3870dd[_0x9da1('0x49')]===0x0){return db[_0x9da1('0x4a')][_0x9da1('0x41')]({'name':_0x147c65[_0x9da1('0x27')],'resourceId':_0x147c65['id'],'type':_0x9da1('0x22'),'sectionId':_0x3870dd['id']},{})[_0x9da1('0x21')](function(){return _0x3a529d;});}else{return _0x3a529d;}})[_0x9da1('0x40')](function(_0x868167){logger[_0x9da1('0x25')](_0x9da1('0x4b'),_0x868167);throw _0x868167;});}return _0x3a529d;})[_0x9da1('0x21')](respondWithResult(_0x2066d2,0xc9))['catch'](handleError(_0x2066d2,null));};exports[_0x9da1('0x20')]=function(_0x1fbb5d,_0x4d241a){if(_0x1fbb5d[_0x9da1('0x42')]['id']){delete _0x1fbb5d['body']['id'];}return db[_0x9da1('0x2a')]['find']({'where':{'id':_0x1fbb5d[_0x9da1('0x4c')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x4d241a,null))[_0x9da1('0x21')](saveUpdates(_0x1fbb5d[_0x9da1('0x42')],null))[_0x9da1('0x21')](respondWithResult(_0x4d241a,null))[_0x9da1('0x40')](handleError(_0x4d241a,null));};exports[_0x9da1('0x23')]=function(_0x343b05,_0x170351){return db[_0x9da1('0x2a')]['find']({'where':{'id':_0x343b05[_0x9da1('0x4c')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x170351,null))[_0x9da1('0x21')](removeEntity(_0x170351,null))[_0x9da1('0x40')](handleError(_0x170351,null));};exports[_0x9da1('0x4d')]=function(_0x4607a9,_0x2020d0){var _0x3c01c3=0xa;var _0xfa8d3f=[_0x9da1('0x4e'),'left_join',_0x9da1('0x4f'),_0x9da1('0x50')];var _0x5bda2a={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0xc27b00={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':_0x9da1('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x9da1('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x27ac84=function(_0x10ebc9){return!_[_0x9da1('0x5c')]([_0x9da1('0x5d'),_0x9da1('0x5e'),_0x9da1('0x5f'),'IS\x20NOT\x20EMPTY'],_0x10ebc9);};var _0x5f5dc2=function(_0x454a68){if(!_0x454a68||!_0x454a68['rules']['length']){return'';}for(var _0x5b4a05='(',_0x6f86c3=0x0;_0x6f86c3<_0x454a68['rules'][_0x9da1('0x33')];_0x6f86c3+=0x1){_0x6f86c3>0x0&&(_0x5b4a05+='\x20'+_0x454a68['operator']+'\x20');_0x5b4a05+=_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x61')]?_0x5f5dc2(_0x454a68['rules'][_0x6f86c3][_0x9da1('0x61')]):_0x454a68[_0x9da1('0x60')][_0x6f86c3]['field']+'\x20'+_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x62')]+(_0x27ac84(_0x454a68['rules'][_0x6f86c3]['condition'])?'\x20'+_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x63')]:'');}return _0x5b4a05+')';};var _0x21d00c={'where':{'id':_0x4607a9['params']['id']}},_0x3ca531,_0x236b01,_0x44d7fe,_0x5cb102,_0x3d2c25;_0x21d00c=_['merge']({},_0x21d00c,_0x4607a9[_0x9da1('0x64')]);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0x21d00c)[_0x9da1('0x21')](function(_0x3382b1){if(_0x3382b1){_0x3ca531=_0x3382b1;return _0x3382b1[_0x9da1('0x66')]();}return null;})[_0x9da1('0x21')](function(_0x1f2a4b){if(_0x1f2a4b){if(!_0x1f2a4b[_0x9da1('0x33')]){throw new db['Sequelize'][(_0x9da1('0x67'))](_0x9da1('0x68'),0x193);}_0x236b01=_0x1f2a4b;return db[_0x9da1('0x69')][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x491fcb){if(_0x491fcb){_0x44d7fe=_[_0x9da1('0x6a')](_0x491fcb,'id');var _0x13fadd;var _0x419f78=squel[_0x9da1('0x6b')]();_0x419f78[_0x9da1('0x6c')](_0x3ca531[_0x9da1('0x6d')]);for(var _0x55a6d2=0x0;_0x55a6d2<_0x236b01[_0x9da1('0x33')];_0x55a6d2+=0x1){_0x13fadd=_0x236b01[_0x55a6d2]['MetricId']?_0x44d7fe[_0x236b01[_0x55a6d2][_0x9da1('0x6e')]]['metric']:_0x236b01[_0x55a6d2][_0x9da1('0x6f')];_0x13fadd=_0x236b01[_0x55a6d2][_0x9da1('0x70')]?_[_0x9da1('0x71')](_0x5bda2a[_0x236b01[_0x55a6d2][_0x9da1('0x70')]],'%s',_0x13fadd):_0x13fadd;_0x13fadd=_0x236b01[_0x55a6d2]['format']?_['replace'](_0xc27b00[_0x236b01[_0x55a6d2]['format']],'%s',_0x13fadd):_0x13fadd;if(_0x236b01[_0x55a6d2][_0x9da1('0x72')]){_0x419f78[_0x9da1('0x61')](_0x13fadd);}_0x236b01[_0x55a6d2][_0x9da1('0x73')]&&_0x419f78[_0x9da1('0x74')](_0x13fadd,_0x236b01[_0x55a6d2]['orderBy']==='DESC'?![]:!![]);_0x419f78[_0x9da1('0x6f')](_0x13fadd,_0x236b01[_0x55a6d2][_0x9da1('0x75')]||_0x13fadd);}if(_0x3ca531[_0x9da1('0x76')]){_0x3ca531['joins']=JSON['parse'](_0x3ca531[_0x9da1('0x76')]);for(var _0x1deb93=0x0;_0x1deb93<_0x3ca531[_0x9da1('0x76')]['length'];_0x1deb93+=0x1){if(_0x3ca531['joins'][_0x1deb93][_0x9da1('0x39')]&&_[_0x9da1('0x5c')](_0xfa8d3f,_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x39')])&&_0x3ca531[_0x9da1('0x76')][_0x1deb93]['parentKey']&&_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')]&&_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x78')]){_0x419f78[_0x3ca531['joins'][_0x1deb93][_0x9da1('0x39')]](_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')],null,util['format'](_0x9da1('0x79'),_0x3ca531[_0x9da1('0x6d')],_0x3ca531[_0x9da1('0x76')][_0x1deb93]['parentKey'],_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')],_0x3ca531['joins'][_0x1deb93][_0x9da1('0x78')]));}}}if(_0x3ca531['conditions']){_0x3ca531[_0x9da1('0x7a')]=JSON['parse'](_0x3ca531[_0x9da1('0x7a')]);_0x419f78[_0x9da1('0x37')](_0x5f5dc2(_0x3ca531[_0x9da1('0x7a')][_0x9da1('0x61')]));}_0x3d2c25=_0x419f78[_0x9da1('0x7b')]();_0x419f78[_0x9da1('0x1c')](_0x3c01c3);_0x419f78[_0x9da1('0x1a')](0x0);logger[_0x9da1('0x7c')](_0x9da1('0x7d'),_0x419f78[_0x9da1('0x7e')]());return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x419f78[_0x9da1('0x7e')](),{'type':dbH['sequelize'][_0x9da1('0x80')][_0x9da1('0x81')]});}})[_0x9da1('0x21')](respondWithResult(_0x2020d0,null))[_0x9da1('0x40')](handleError(_0x2020d0,null));};function runReport(_0x162597,_0x4f39bc,_0x1ca102){var _0x2eb5e6=_0x4f39bc['name'];var _0x4a4cda=0xa;var _0x84f8d8=[_0x9da1('0x4e'),_0x9da1('0x82'),_0x9da1('0x4f'),_0x9da1('0x50')];var _0x4701b3={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0x3a0a84={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':_0x9da1('0x5a'),'HOUR':_0x9da1('0x83'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9da1('0x84')};var _0x354c5a=function(_0x53ab6a){return!_[_0x9da1('0x5c')](['IS\x20NULL',_0x9da1('0x5e'),'IS\x20EMPTY',_0x9da1('0x85')],_0x53ab6a);};var _0x106bd9=function(_0x347cb8){if(!_0x347cb8||!_0x347cb8[_0x9da1('0x60')][_0x9da1('0x33')]){return'';}for(var _0x3e331a='(',_0x1f785c=0x0;_0x1f785c<_0x347cb8[_0x9da1('0x60')][_0x9da1('0x33')];_0x1f785c+=0x1){_0x1f785c>0x0&&(_0x3e331a+='\x20'+_0x347cb8[_0x9da1('0x86')]+'\x20');_0x3e331a+=_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x61')]?_0x106bd9(_0x347cb8['rules'][_0x1f785c][_0x9da1('0x61')]):_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x6f')]+'\x20'+_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x62')]+(_0x354c5a(_0x347cb8[_0x9da1('0x60')][_0x1f785c]['condition'])?'\x20'+_0x347cb8['rules'][_0x1f785c][_0x9da1('0x63')]:'');}return _0x3e331a+')';};var _0xdecc82={'where':{'id':_0x162597['id']}},_0xe12dd7,_0x4cd85f,_0x4bf74c,_0x28335d,_0x175b4b;_0xdecc82=_[_0x9da1('0x3b')]({},_0xdecc82,_0x1ca102);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0xdecc82)[_0x9da1('0x21')](function(_0x5561f0){if(_0x5561f0){_0xe12dd7=_0x5561f0;return _0x5561f0[_0x9da1('0x66')]();}return null;})[_0x9da1('0x21')](function(_0x5a64fd){if(_0x5a64fd){if(!_0x5a64fd['length']){throw new db[(_0x9da1('0x87'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4cd85f=_0x5a64fd;return db[_0x9da1('0x69')][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x18ae08){if(_0x18ae08){_0x4bf74c=_[_0x9da1('0x6a')](_0x18ae08,'id');var _0x30065d;var _0x40a2ef=squel[_0x9da1('0x6b')]();_0x40a2ef['from'](_0xe12dd7['table']);for(var _0xd10ba4=0x0;_0xd10ba4<_0x4cd85f[_0x9da1('0x33')];_0xd10ba4+=0x1){_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x6e')]?_0x4bf74c[_0x4cd85f[_0xd10ba4][_0x9da1('0x6e')]][_0x9da1('0x88')]:_0x4cd85f[_0xd10ba4][_0x9da1('0x6f')];_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x70')]?_[_0x9da1('0x71')](_0x4701b3[_0x4cd85f[_0xd10ba4]['function']],'%s',_0x30065d):_0x30065d;_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x89')]?_['replace'](_0x3a0a84[_0x4cd85f[_0xd10ba4][_0x9da1('0x89')]],'%s',_0x30065d):_0x30065d;if(_0x4cd85f[_0xd10ba4][_0x9da1('0x72')]){_0x40a2ef[_0x9da1('0x61')](_0x30065d);}_0x4cd85f[_0xd10ba4][_0x9da1('0x73')]&&_0x40a2ef[_0x9da1('0x74')](_0x30065d,_0x4cd85f[_0xd10ba4][_0x9da1('0x73')]===_0x9da1('0x8a')?![]:!![]);_0x40a2ef['field'](_0x30065d,_0x4cd85f[_0xd10ba4][_0x9da1('0x75')]||_0x30065d);}if(_0xe12dd7['joins']){_0xe12dd7[_0x9da1('0x76')]=JSON[_0x9da1('0x8b')](_0xe12dd7[_0x9da1('0x76')]);for(var _0x22b679=0x0;_0x22b679<_0xe12dd7['joins'][_0x9da1('0x33')];_0x22b679+=0x1){if(_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')]&&_[_0x9da1('0x5c')](_0x84f8d8,_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')])&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x8c')]&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x77')]&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x78')]){_0x40a2ef[_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')]](_0xe12dd7['joins'][_0x22b679][_0x9da1('0x77')],null,util['format'](_0x9da1('0x79'),_0xe12dd7['table'],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x8c')],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x77')],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x78')]));}}}if(_0xe12dd7[_0x9da1('0x7a')]){_0xe12dd7[_0x9da1('0x7a')]=JSON['parse'](_0xe12dd7[_0x9da1('0x7a')]);_0x40a2ef[_0x9da1('0x37')](_0x106bd9(_0xe12dd7['conditions'][_0x9da1('0x61')]));}_0x175b4b=_0x40a2ef[_0x9da1('0x7b')]();_0x40a2ef[_0x9da1('0x1c')](_0x4a4cda);_0x40a2ef['offset'](0x0);return;}})['then'](function(){if(_0x4f39bc['output']===_0x9da1('0x8d')){return null;}var _0x3b17aa=_[_0x9da1('0x3b')](_0x4f39bc,{'name':_0x4f39bc['fullPath']||_0x4f39bc['name']||_0xe12dd7[_0x9da1('0x27')],'basename':_0x2eb5e6,'savename':util[_0x9da1('0x89')]('%s-%s.%s',_0x4f39bc[_0x9da1('0x27')]||_0xe12dd7['name'],require('randomstring')['generate'](0x4),_0x4f39bc[_0x9da1('0x8e')]||_0x9da1('0x8f')),'reportId':_0xe12dd7['id'],'reportType':_0x9da1('0x90')});return db[_0x9da1('0x91')][_0x9da1('0x41')](_0x3b17aa,{'raw':!![]});})[_0x9da1('0x21')](function(_0x2aac99){if(_0xe12dd7[_0x9da1('0x6d')]===_0x9da1('0x92')){_0x175b4b[_0x9da1('0x37')](_0xe12dd7[_0x9da1('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x4f39bc['startDate'],_0x4f39bc['endDate']);}else{_0x175b4b[_0x9da1('0x37')](_0xe12dd7[_0x9da1('0x6d')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4f39bc[_0x9da1('0x93')],_0x4f39bc[_0x9da1('0x94')]);}if(_0x2aac99){logger[_0x9da1('0x95')](_0x9da1('0x96'),_0x175b4b[_0x9da1('0x7e')]());require(_0x9da1('0x97'))[_0x9da1('0x98')](path[_0x9da1('0x4e')](__dirname,'../../components/export/',_0x2aac99[_0x9da1('0x8e')]),[_0x2aac99['id'],_0x175b4b[_0x9da1('0x7e')](),path[_0x9da1('0x4e')](__dirname,_0x9da1('0x99'),_0x2aac99[_0x9da1('0x9a')]),_0x2eb5e6]);return _0x2aac99;}else{var _0x5ad3f8=squel[_0x9da1('0x6b')]();_0x5ad3f8['from']('('+_0x175b4b[_0x9da1('0x7e')]()+')',_0x9da1('0x9b'));_0x5ad3f8[_0x9da1('0x6f')]('COUNT(*)','count');_0x175b4b[_0x9da1('0x1c')](_0x4f39bc[_0x9da1('0x1c')]||_0x4a4cda);_0x175b4b[_0x9da1('0x1a')](_0x4f39bc['offset']||0x0);return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x5ad3f8['toString'](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')]['SELECT']})['then'](function(_0x489b3f){if(!_0x489b3f[_0x9da1('0x33')]){_0x28335d=0x0;}else{_0x28335d=_0x489b3f[0x0]['count']||0x0;}return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x175b4b[_0x9da1('0x7e')](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')][_0x9da1('0x81')]});})['then'](function(_0x355a71){return{'rows':_0x355a71||[],'count':_0x28335d};});}});}exports[_0x9da1('0x9c')]=function(_0x492e1a,_0x449a17){return runReport(_0x492e1a[_0x9da1('0x4c')],_0x492e1a[_0x9da1('0x2e')],_0x492e1a[_0x9da1('0x64')])['then'](respondWithResult(_0x449a17,null))[_0x9da1('0x40')](handleError(_0x449a17,null));};exports[_0x9da1('0x9d')]=runReport;exports[_0x9da1('0x2e')]=function(_0x8280a9,_0x374754){var _0x1e466a=0xa;var _0x3f9133=[_0x9da1('0x4e'),'left_join',_0x9da1('0x4f'),'cross_join'];var _0x3dd3e0={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0x52e4a6={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x9da1('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4aa903=function(_0x55d7f2){return!_['includes'](['IS\x20NULL',_0x9da1('0x5e'),_0x9da1('0x5f'),_0x9da1('0x85')],_0x55d7f2);};var _0x3212ad=function(_0x5ac65b){if(!_0x5ac65b||!_0x5ac65b[_0x9da1('0x60')][_0x9da1('0x33')]){return'';}for(var _0x21a99d='(',_0xd19a7c=0x0;_0xd19a7c<_0x5ac65b[_0x9da1('0x60')][_0x9da1('0x33')];_0xd19a7c+=0x1){_0xd19a7c>0x0&&(_0x21a99d+='\x20'+_0x5ac65b[_0x9da1('0x86')]+'\x20');_0x21a99d+=_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x61')]?_0x3212ad(_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x61')]):_0x5ac65b['rules'][_0xd19a7c][_0x9da1('0x6f')]+'\x20'+_0x5ac65b[_0x9da1('0x60')][_0xd19a7c]['condition']+(_0x4aa903(_0x5ac65b['rules'][_0xd19a7c][_0x9da1('0x62')])?'\x20'+_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x63')]:'');}return _0x21a99d+')';};var _0xb14af1={'where':{'id':_0x8280a9[_0x9da1('0x4c')]['id']}},_0x245566,_0x5b2591,_0x3c51e3,_0x54b83d,_0x23bf86;_0xb14af1=_['merge']({},_0xb14af1,_0x8280a9[_0x9da1('0x64')]);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0xb14af1)[_0x9da1('0x21')](function(_0x4bb140){if(_0x4bb140){_0x245566=_0x4bb140;return _0x4bb140[_0x9da1('0x66')]();}return null;})['then'](function(_0x47cbdd){if(_0x47cbdd){if(!_0x47cbdd['length']){throw new db[(_0x9da1('0x87'))][(_0x9da1('0x67'))](_0x9da1('0x68'),0x193);}_0x5b2591=_0x47cbdd;return db['AnalyticMetric'][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x5e1e24){if(_0x5e1e24){_0x3c51e3=_[_0x9da1('0x6a')](_0x5e1e24,'id');var _0x49ddec;var _0x407218=squel['select']();_0x407218['from'](_0x245566['table']);for(var _0x316fee=0x0;_0x316fee<_0x5b2591['length'];_0x316fee+=0x1){_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x6e')]?_0x3c51e3[_0x5b2591[_0x316fee][_0x9da1('0x6e')]]['metric']:_0x5b2591[_0x316fee]['field'];_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x70')]?_['replace'](_0x3dd3e0[_0x5b2591[_0x316fee][_0x9da1('0x70')]],'%s',_0x49ddec):_0x49ddec;_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x89')]?_['replace'](_0x52e4a6[_0x5b2591[_0x316fee]['format']],'%s',_0x49ddec):_0x49ddec;if(_0x5b2591[_0x316fee][_0x9da1('0x72')]){_0x407218[_0x9da1('0x61')](_0x49ddec);}_0x5b2591[_0x316fee][_0x9da1('0x73')]&&_0x407218[_0x9da1('0x74')](_0x49ddec,_0x5b2591[_0x316fee]['orderBy']==='DESC'?![]:!![]);_0x407218[_0x9da1('0x6f')](_0x49ddec,_0x5b2591[_0x316fee][_0x9da1('0x75')]||_0x49ddec);}if(_0x245566[_0x9da1('0x76')]){_0x245566[_0x9da1('0x76')]=JSON[_0x9da1('0x8b')](_0x245566['joins']);for(var _0x56ec7d=0x0;_0x56ec7d<_0x245566[_0x9da1('0x76')][_0x9da1('0x33')];_0x56ec7d+=0x1){if(_0x245566['joins'][_0x56ec7d][_0x9da1('0x39')]&&_['includes'](_0x3f9133,_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x39')])&&_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x8c')]&&_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x77')]&&_0x245566['joins'][_0x56ec7d][_0x9da1('0x78')]){_0x407218[_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x39')]](_0x245566[_0x9da1('0x76')][_0x56ec7d]['foreignTable'],null,util[_0x9da1('0x89')](_0x9da1('0x79'),_0x245566[_0x9da1('0x6d')],_0x245566['joins'][_0x56ec7d]['parentKey'],_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x77')],_0x245566['joins'][_0x56ec7d]['foreignKey']));}}}if(_0x245566[_0x9da1('0x7a')]){_0x245566[_0x9da1('0x7a')]=JSON[_0x9da1('0x8b')](_0x245566[_0x9da1('0x7a')]);_0x407218[_0x9da1('0x37')](_0x3212ad(_0x245566['conditions'][_0x9da1('0x61')]));}_0x23bf86=_0x407218['clone']();_0x407218[_0x9da1('0x1c')](_0x1e466a);_0x407218[_0x9da1('0x1a')](0x0);logger[_0x9da1('0x7c')](_0x9da1('0x7d'),_0x407218['toString']());return dbH['sequelize'][_0x9da1('0x2e')](_0x407218[_0x9da1('0x7e')](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')][_0x9da1('0x81')]});}})[_0x9da1('0x21')](function(){return{'sql':_0x23bf86['toString']()};})[_0x9da1('0x21')](respondWithResult(_0x374754,null))[_0x9da1('0x40')](handleError(_0x374754,null));}; \ No newline at end of file +var _0x187d=['fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','limit','undefined','count','offset','set','json','save','update','then','get','destroy','error','name','send','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','keys','filters','intersection','query','fields','attributes','order','sort','filter','where','merge','options','includeAll','rows','catch','include','create','role','user','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','params','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','length','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','findAll','keyBy','from','table','MetricId','metric','replace','format','groupBy','orderBy','field','alias','joins','parse','parentKey','foreignKey','foreignTable','conditions','clone','Limited\x20Query:','toString','sequelize','SELECT','join','IS\x20EMPTY','operator','AnalyticMetric','function','DESC','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','fork','../../components/export/','savename','select','countTable','QueryTypes','runReport','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs'];(function(_0x461f41,_0x405481){var _0x22c772=function(_0x1b5823){while(--_0x1b5823){_0x461f41['push'](_0x461f41['shift']());}};_0x22c772(++_0x405481);}(_0x187d,0x93));var _0xd187=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x187d[_0x618414];return _0x21c19a;};'use strict';var emlformat=require(_0xd187('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd187('0x1'));var jsonpatch=require(_0xd187('0x2'));var rp=require(_0xd187('0x3'));var moment=require(_0xd187('0x4'));var BPromise=require(_0xd187('0x5'));var Mustache=require(_0xd187('0x6'));var util=require('util');var path=require(_0xd187('0x7'));var sox=require(_0xd187('0x8'));var csv=require('to-csv');var ejs=require(_0xd187('0x9'));var fs=require('fs');var fs_extra=require(_0xd187('0xa'));var _=require(_0xd187('0xb'));var squel=require(_0xd187('0xc'));var crypto=require(_0xd187('0xd'));var jsforce=require(_0xd187('0xe'));var deskjs=require(_0xd187('0xf'));var toCsv=require(_0xd187('0x10'));var querystring=require('querystring');var Papa=require(_0xd187('0x11'));var Redis=require(_0xd187('0x12'));var authService=require(_0xd187('0x13'));var qs=require(_0xd187('0x14'));var as=require(_0xd187('0x15'));var hardwareService=require(_0xd187('0x16'));var logger=require('../../config/logger')(_0xd187('0x17'));var utils=require(_0xd187('0x18'));var config=require(_0xd187('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd187('0x1a'))['db'];var dbH=require(_0xd187('0x1a'))[_0xd187('0x1b')];function respondWithStatusCode(_0x59ee4a,_0x33e3d5){_0x33e3d5=_0x33e3d5||0xcc;return function(_0x18ce42){if(_0x18ce42){return _0x59ee4a[_0xd187('0x1c')](_0x33e3d5);}return _0x59ee4a[_0xd187('0x1d')](_0x33e3d5)['end']();};}function respondWithResult(_0x39a927,_0x2050d5){_0x2050d5=_0x2050d5||0xc8;return function(_0x45ab10){if(_0x45ab10){return _0x39a927[_0xd187('0x1d')](_0x2050d5)['json'](_0x45ab10);}};}function respondWithFilteredResult(_0x245d3e,_0x52a208){return function(_0x5cf218){if(_0x5cf218){var _0x40ed84=typeof _0x52a208['offset']==='undefined'&&typeof _0x52a208[_0xd187('0x1e')]===_0xd187('0x1f');var _0x374fe0=_0x5cf218[_0xd187('0x20')];var _0x21df74=_0x40ed84?0x0:_0x52a208[_0xd187('0x21')];var _0x12b388=_0x40ed84?_0x5cf218[_0xd187('0x20')]:_0x52a208[_0xd187('0x21')]+_0x52a208[_0xd187('0x1e')];var _0x170d5c;if(_0x12b388>=_0x374fe0){_0x12b388=_0x374fe0;_0x170d5c=0xc8;}else{_0x170d5c=0xce;}_0x245d3e[_0xd187('0x1d')](_0x170d5c);return _0x245d3e[_0xd187('0x22')]('Content-Range',_0x21df74+'-'+_0x12b388+'/'+_0x374fe0)[_0xd187('0x23')](_0x5cf218);}return null;};}function patchUpdates(_0x81b988){return function(_0xc5bba5){try{jsonpatch['apply'](_0xc5bba5,_0x81b988,!![]);}catch(_0x5a0360){return BPromise['reject'](_0x5a0360);}return _0xc5bba5[_0xd187('0x24')]();};}function saveUpdates(_0x33741d,_0x249a82){return function(_0x4f62c8){if(_0x4f62c8){return _0x4f62c8[_0xd187('0x25')](_0x33741d)['then'](function(_0x145771){return _0x145771;});}return null;};}function removeEntity(_0x5a7a23,_0x1047f4){return function(_0x54f340){if(_0x54f340){return _0x54f340['destroy']()[_0xd187('0x26')](function(){var _0x4d992b=_0x54f340[_0xd187('0x27')]({'plain':!![]});var _0x598aa4='DefaultReports';return db['UserProfileResource'][_0xd187('0x28')]({'where':{'type':_0x598aa4,'resourceId':_0x4d992b['id']}})[_0xd187('0x26')](function(){return _0x54f340;});})[_0xd187('0x26')](function(){_0x5a7a23[_0xd187('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a20ed,_0x2875c8){return function(_0x5c8e52){if(!_0x5c8e52){_0x2a20ed[_0xd187('0x1c')](0x194);}return _0x5c8e52;};}function handleError(_0x1c87ee,_0x34febe){_0x34febe=_0x34febe||0x1f4;return function(_0x4c50a5){logger[_0xd187('0x29')](_0x4c50a5['stack']);if(_0x4c50a5[_0xd187('0x2a')]){delete _0x4c50a5[_0xd187('0x2a')];}_0x1c87ee[_0xd187('0x1d')](_0x34febe)[_0xd187('0x2b')](_0x4c50a5);};}exports['index']=function(_0x140e54,_0xb38778){var _0x5bba10={},_0x4cc587={},_0x1a1922={'count':0x0,'rows':[]};var _0x1836cf=_[_0xd187('0x2c')](db[_0xd187('0x2d')][_0xd187('0x2e')],function(_0x2d8843){return{'name':_0x2d8843[_0xd187('0x2f')],'type':_0x2d8843[_0xd187('0x30')]['key']};});_0x4cc587[_0xd187('0x31')]=_[_0xd187('0x2c')](_0x1836cf,_0xd187('0x2a'));_0x4cc587['query']=_[_0xd187('0x32')](_0x140e54['query']);_0x4cc587[_0xd187('0x33')]=_[_0xd187('0x34')](_0x4cc587[_0xd187('0x31')],_0x4cc587['query']);_0x5bba10['attributes']=_[_0xd187('0x34')](_0x4cc587[_0xd187('0x31')],qs['fields'](_0x140e54[_0xd187('0x35')][_0xd187('0x36')]));_0x5bba10[_0xd187('0x37')]=_0x5bba10['attributes']['length']?_0x5bba10[_0xd187('0x37')]:_0x4cc587[_0xd187('0x31')];if(!_0x140e54['query']['hasOwnProperty']('nolimit')){_0x5bba10[_0xd187('0x1e')]=qs['limit'](_0x140e54[_0xd187('0x35')][_0xd187('0x1e')]);_0x5bba10['offset']=qs[_0xd187('0x21')](_0x140e54['query'][_0xd187('0x21')]);}_0x5bba10[_0xd187('0x38')]=qs['sort'](_0x140e54[_0xd187('0x35')][_0xd187('0x39')]);_0x5bba10['where']=qs[_0xd187('0x33')](_['pick'](_0x140e54['query'],_0x4cc587[_0xd187('0x33')]),_0x1836cf);if(_0x140e54[_0xd187('0x35')][_0xd187('0x3a')]){_0x5bba10[_0xd187('0x3b')]=_[_0xd187('0x3c')](_0x5bba10['where'],{'$or':_[_0xd187('0x2c')](_0x1836cf,function(_0xe090ad){if(_0xe090ad[_0xd187('0x30')]!=='VIRTUAL'){var _0x4b121c={};_0x4b121c[_0xe090ad['name']]={'$like':'%'+_0x140e54['query'][_0xd187('0x3a')]+'%'};return _0x4b121c;}})});}_0x5bba10=_[_0xd187('0x3c')]({},_0x5bba10,_0x140e54[_0xd187('0x3d')]);var _0x367303={'where':_0x5bba10[_0xd187('0x3b')]};return db[_0xd187('0x2d')][_0xd187('0x20')](_0x367303)[_0xd187('0x26')](function(_0x526060){_0x1a1922[_0xd187('0x20')]=_0x526060;if(_0x140e54[_0xd187('0x35')][_0xd187('0x3e')]){_0x5bba10['include']=[{'all':!![]}];}return db[_0xd187('0x2d')]['findAll'](_0x5bba10);})[_0xd187('0x26')](function(_0x406d29){_0x1a1922[_0xd187('0x3f')]=_0x406d29;return _0x1a1922;})[_0xd187('0x26')](respondWithFilteredResult(_0xb38778,_0x5bba10))[_0xd187('0x40')](handleError(_0xb38778,null));};exports['show']=function(_0x3f0484,_0x3d9e60){var _0x3215b1={'raw':!![],'where':{'id':_0x3f0484['params']['id']}},_0x3fa19c={};_0x3fa19c[_0xd187('0x31')]=_[_0xd187('0x32')](db['AnalyticDefaultReport'][_0xd187('0x2e')]);_0x3fa19c[_0xd187('0x35')]=_['keys'](_0x3f0484['query']);_0x3fa19c[_0xd187('0x33')]=_[_0xd187('0x34')](_0x3fa19c['model'],_0x3fa19c['query']);_0x3215b1['attributes']=_[_0xd187('0x34')](_0x3fa19c[_0xd187('0x31')],qs[_0xd187('0x36')](_0x3f0484[_0xd187('0x35')][_0xd187('0x36')]));_0x3215b1[_0xd187('0x37')]=_0x3215b1[_0xd187('0x37')]['length']?_0x3215b1[_0xd187('0x37')]:_0x3fa19c[_0xd187('0x31')];if(_0x3f0484[_0xd187('0x35')][_0xd187('0x3e')]){_0x3215b1[_0xd187('0x41')]=[{'all':!![]}];}_0x3215b1=_[_0xd187('0x3c')]({},_0x3215b1,_0x3f0484[_0xd187('0x3d')]);return db[_0xd187('0x2d')]['find'](_0x3215b1)[_0xd187('0x26')](handleEntityNotFound(_0x3d9e60,null))[_0xd187('0x26')](respondWithResult(_0x3d9e60,null))[_0xd187('0x40')](handleError(_0x3d9e60,null));};exports[_0xd187('0x42')]=function(_0x36b99d,_0x5ad646){return db[_0xd187('0x2d')][_0xd187('0x42')](_0x36b99d['body'],{})[_0xd187('0x26')](function(_0xd9635d){var _0x55fac6=_0x36b99d['user']['get']({'plain':!![]});if(!_0x55fac6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x55fac6[_0xd187('0x43')]===_0xd187('0x44')){var _0x12d448=_0xd9635d[_0xd187('0x27')]({'plain':!![]});var _0x460202=_0xd187('0x45');return db[_0xd187('0x46')]['find']({'where':{'name':_0x460202,'userProfileId':_0x55fac6[_0xd187('0x47')]},'raw':!![]})[_0xd187('0x26')](function(_0x1b12c4){if(_0x1b12c4&&_0x1b12c4[_0xd187('0x48')]===0x0){return db['UserProfileResource'][_0xd187('0x42')]({'name':_0x12d448['name'],'resourceId':_0x12d448['id'],'type':'DefaultReports','sectionId':_0x1b12c4['id']},{})[_0xd187('0x26')](function(){return _0xd9635d;});}else{return _0xd9635d;}})['catch'](function(_0x1a1252){logger[_0xd187('0x29')](_0xd187('0x49'),_0x1a1252);throw _0x1a1252;});}return _0xd9635d;})[_0xd187('0x26')](respondWithResult(_0x5ad646,0xc9))[_0xd187('0x40')](handleError(_0x5ad646,null));};exports[_0xd187('0x25')]=function(_0x3c7ba6,_0x2b4f9d){if(_0x3c7ba6[_0xd187('0x4a')]['id']){delete _0x3c7ba6['body']['id'];}return db[_0xd187('0x2d')][_0xd187('0x4b')]({'where':{'id':_0x3c7ba6['params']['id']}})[_0xd187('0x26')](handleEntityNotFound(_0x2b4f9d,null))[_0xd187('0x26')](saveUpdates(_0x3c7ba6[_0xd187('0x4a')],null))['then'](respondWithResult(_0x2b4f9d,null))[_0xd187('0x40')](handleError(_0x2b4f9d,null));};exports[_0xd187('0x28')]=function(_0x50073d,_0x457da1){return db[_0xd187('0x2d')]['find']({'where':{'id':_0x50073d[_0xd187('0x4c')]['id']}})['then'](handleEntityNotFound(_0x457da1,null))[_0xd187('0x26')](removeEntity(_0x457da1,null))[_0xd187('0x40')](handleError(_0x457da1,null));};exports[_0xd187('0x4d')]=function(_0x508866,_0x100d64){var _0x2265fb=0xa;var _0x1675d9=['join',_0xd187('0x4e'),_0xd187('0x4f'),_0xd187('0x50')];var _0x56b36b={'SUM':_0xd187('0x51'),'COUNT':_0xd187('0x52'),'COUNT DISTINCT':_0xd187('0x53'),'MAX':_0xd187('0x54'),'MIN':_0xd187('0x55'),'AVG':_0xd187('0x56'),'GROUP_CONCAT':_0xd187('0x57'),'GROUP_CONCAT ASC':_0xd187('0x58'),'GROUP_CONCAT DESC':_0xd187('0x59')};var _0x2c7dd9={'SEC_TO_TIME':_0xd187('0x5a'),'DATE':_0xd187('0x5b'),'HOUR':_0xd187('0x5c'),'ROUND':_0xd187('0x5d'),'UNIX_TIMESTAMP':_0xd187('0x5e')};var _0xaff1e6=function(_0x42fb32){return!_[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),'IS\x20EMPTY',_0xd187('0x62')],_0x42fb32);};var _0x48c82d=function(_0x13d118){if(!_0x13d118||!_0x13d118[_0xd187('0x63')][_0xd187('0x64')]){return'';}for(var _0x4225e6='(',_0x51fbdb=0x0;_0x51fbdb<_0x13d118[_0xd187('0x63')][_0xd187('0x64')];_0x51fbdb+=0x1){_0x51fbdb>0x0&&(_0x4225e6+='\x20'+_0x13d118['operator']+'\x20');_0x4225e6+=_0x13d118['rules'][_0x51fbdb][_0xd187('0x65')]?_0x48c82d(_0x13d118[_0xd187('0x63')][_0x51fbdb][_0xd187('0x65')]):_0x13d118[_0xd187('0x63')][_0x51fbdb]['field']+'\x20'+_0x13d118[_0xd187('0x63')][_0x51fbdb]['condition']+(_0xaff1e6(_0x13d118[_0xd187('0x63')][_0x51fbdb][_0xd187('0x66')])?'\x20'+_0x13d118[_0xd187('0x63')][_0x51fbdb][_0xd187('0x67')]:'');}return _0x4225e6+')';};var _0x57cad7={'where':{'id':_0x508866['params']['id']}},_0x2409a8,_0xaea7e0,_0xd12560,_0x9e82c,_0x151f3c;_0x57cad7=_['merge']({},_0x57cad7,_0x508866[_0xd187('0x3d')]);return db[_0xd187('0x2d')][_0xd187('0x4b')](_0x57cad7)[_0xd187('0x26')](function(_0x13e05a){if(_0x13e05a){_0x2409a8=_0x13e05a;return _0x13e05a[_0xd187('0x68')]();}return null;})[_0xd187('0x26')](function(_0x1291cc){if(_0x1291cc){if(!_0x1291cc[_0xd187('0x64')]){throw new db[(_0xd187('0x69'))][(_0xd187('0x6a'))](_0xd187('0x6b'),0x193);}_0xaea7e0=_0x1291cc;return db['AnalyticMetric'][_0xd187('0x6c')]({'raw':!![]});}return null;})[_0xd187('0x26')](function(_0x54e908){if(_0x54e908){_0xd12560=_[_0xd187('0x6d')](_0x54e908,'id');var _0x1a9979;var _0x4bec3e=squel['select']();_0x4bec3e[_0xd187('0x6e')](_0x2409a8[_0xd187('0x6f')]);for(var _0x2ac56f=0x0;_0x2ac56f<_0xaea7e0[_0xd187('0x64')];_0x2ac56f+=0x1){_0x1a9979=_0xaea7e0[_0x2ac56f]['MetricId']?_0xd12560[_0xaea7e0[_0x2ac56f][_0xd187('0x70')]][_0xd187('0x71')]:_0xaea7e0[_0x2ac56f]['field'];_0x1a9979=_0xaea7e0[_0x2ac56f]['function']?_[_0xd187('0x72')](_0x56b36b[_0xaea7e0[_0x2ac56f]['function']],'%s',_0x1a9979):_0x1a9979;_0x1a9979=_0xaea7e0[_0x2ac56f][_0xd187('0x73')]?_[_0xd187('0x72')](_0x2c7dd9[_0xaea7e0[_0x2ac56f]['format']],'%s',_0x1a9979):_0x1a9979;if(_0xaea7e0[_0x2ac56f][_0xd187('0x74')]){_0x4bec3e['group'](_0x1a9979);}_0xaea7e0[_0x2ac56f][_0xd187('0x75')]&&_0x4bec3e['order'](_0x1a9979,_0xaea7e0[_0x2ac56f]['orderBy']==='DESC'?![]:!![]);_0x4bec3e[_0xd187('0x76')](_0x1a9979,_0xaea7e0[_0x2ac56f][_0xd187('0x77')]||_0x1a9979);}if(_0x2409a8[_0xd187('0x78')]){_0x2409a8[_0xd187('0x78')]=JSON[_0xd187('0x79')](_0x2409a8[_0xd187('0x78')]);for(var _0x11858e=0x0;_0x11858e<_0x2409a8[_0xd187('0x78')]['length'];_0x11858e+=0x1){if(_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x30')]&&_[_0xd187('0x5f')](_0x1675d9,_0x2409a8['joins'][_0x11858e][_0xd187('0x30')])&&_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x7a')]&&_0x2409a8[_0xd187('0x78')][_0x11858e]['foreignTable']&&_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x7b')]){_0x4bec3e[_0x2409a8['joins'][_0x11858e][_0xd187('0x30')]](_0x2409a8[_0xd187('0x78')][_0x11858e][_0xd187('0x7c')],null,util[_0xd187('0x73')]('%s.%s\x20=\x20%s.%s',_0x2409a8[_0xd187('0x6f')],_0x2409a8[_0xd187('0x78')][_0x11858e]['parentKey'],_0x2409a8[_0xd187('0x78')][_0x11858e]['foreignTable'],_0x2409a8['joins'][_0x11858e]['foreignKey']));}}}if(_0x2409a8[_0xd187('0x7d')]){_0x2409a8[_0xd187('0x7d')]=JSON[_0xd187('0x79')](_0x2409a8[_0xd187('0x7d')]);_0x4bec3e[_0xd187('0x3b')](_0x48c82d(_0x2409a8[_0xd187('0x7d')]['group']));}_0x151f3c=_0x4bec3e[_0xd187('0x7e')]();_0x4bec3e[_0xd187('0x1e')](_0x2265fb);_0x4bec3e['offset'](0x0);logger['debug'](_0xd187('0x7f'),_0x4bec3e[_0xd187('0x80')]());return dbH[_0xd187('0x81')][_0xd187('0x35')](_0x4bec3e[_0xd187('0x80')](),{'type':dbH[_0xd187('0x81')]['QueryTypes'][_0xd187('0x82')]});}})[_0xd187('0x26')](respondWithResult(_0x100d64,null))[_0xd187('0x40')](handleError(_0x100d64,null));};function runReport(_0xbc650f,_0x1da684,_0x2879ff){var _0x1982cd=_0x1da684[_0xd187('0x2a')];var _0x3d9b2f=0xa;var _0xf31fac=[_0xd187('0x83'),_0xd187('0x4e'),'right_join','cross_join'];var _0x3d7e97={'SUM':_0xd187('0x51'),'COUNT':_0xd187('0x52'),'COUNT DISTINCT':_0xd187('0x53'),'MAX':_0xd187('0x54'),'MIN':_0xd187('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xd187('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd187('0x59')};var _0x520f86={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd187('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0xd187('0x5d'),'UNIX_TIMESTAMP':_0xd187('0x5e')};var _0x1ccb17=function(_0x432995){return!_[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),_0xd187('0x84'),_0xd187('0x62')],_0x432995);};var _0x395e45=function(_0x1e8839){if(!_0x1e8839||!_0x1e8839[_0xd187('0x63')][_0xd187('0x64')]){return'';}for(var _0x2101a3='(',_0x25fc08=0x0;_0x25fc08<_0x1e8839['rules'][_0xd187('0x64')];_0x25fc08+=0x1){_0x25fc08>0x0&&(_0x2101a3+='\x20'+_0x1e8839[_0xd187('0x85')]+'\x20');_0x2101a3+=_0x1e8839[_0xd187('0x63')][_0x25fc08][_0xd187('0x65')]?_0x395e45(_0x1e8839['rules'][_0x25fc08][_0xd187('0x65')]):_0x1e8839[_0xd187('0x63')][_0x25fc08]['field']+'\x20'+_0x1e8839['rules'][_0x25fc08][_0xd187('0x66')]+(_0x1ccb17(_0x1e8839[_0xd187('0x63')][_0x25fc08][_0xd187('0x66')])?'\x20'+_0x1e8839[_0xd187('0x63')][_0x25fc08][_0xd187('0x67')]:'');}return _0x2101a3+')';};var _0x475ea9={'where':{'id':_0xbc650f['id']}},_0x4dd0c7,_0x22900,_0x22424d,_0x5b7870,_0x3244dd;_0x475ea9=_[_0xd187('0x3c')]({},_0x475ea9,_0x2879ff);return db[_0xd187('0x2d')][_0xd187('0x4b')](_0x475ea9)['then'](function(_0x5be1c9){if(_0x5be1c9){_0x4dd0c7=_0x5be1c9;return _0x5be1c9[_0xd187('0x68')]();}return null;})[_0xd187('0x26')](function(_0x1cd0d2){if(_0x1cd0d2){if(!_0x1cd0d2['length']){throw new db[(_0xd187('0x69'))][(_0xd187('0x6a'))](_0xd187('0x6b'),0x193);}_0x22900=_0x1cd0d2;return db[_0xd187('0x86')]['findAll']({'raw':!![]});}return null;})[_0xd187('0x26')](function(_0x4efb9f){if(_0x4efb9f){_0x22424d=_['keyBy'](_0x4efb9f,'id');var _0x4a9310;var _0x54bf98=squel['select']();_0x54bf98['from'](_0x4dd0c7['table']);for(var _0x323311=0x0;_0x323311<_0x22900[_0xd187('0x64')];_0x323311+=0x1){_0x4a9310=_0x22900[_0x323311]['MetricId']?_0x22424d[_0x22900[_0x323311][_0xd187('0x70')]][_0xd187('0x71')]:_0x22900[_0x323311][_0xd187('0x76')];_0x4a9310=_0x22900[_0x323311][_0xd187('0x87')]?_[_0xd187('0x72')](_0x3d7e97[_0x22900[_0x323311]['function']],'%s',_0x4a9310):_0x4a9310;_0x4a9310=_0x22900[_0x323311][_0xd187('0x73')]?_['replace'](_0x520f86[_0x22900[_0x323311][_0xd187('0x73')]],'%s',_0x4a9310):_0x4a9310;if(_0x22900[_0x323311][_0xd187('0x74')]){_0x54bf98[_0xd187('0x65')](_0x4a9310);}_0x22900[_0x323311][_0xd187('0x75')]&&_0x54bf98[_0xd187('0x38')](_0x4a9310,_0x22900[_0x323311][_0xd187('0x75')]===_0xd187('0x88')?![]:!![]);_0x54bf98['field'](_0x4a9310,_0x22900[_0x323311][_0xd187('0x77')]||_0x4a9310);}if(_0x4dd0c7[_0xd187('0x78')]){_0x4dd0c7['joins']=JSON[_0xd187('0x79')](_0x4dd0c7[_0xd187('0x78')]);for(var _0x5df926=0x0;_0x5df926<_0x4dd0c7[_0xd187('0x78')][_0xd187('0x64')];_0x5df926+=0x1){if(_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x30')]&&_[_0xd187('0x5f')](_0xf31fac,_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x30')])&&_0x4dd0c7[_0xd187('0x78')][_0x5df926]['parentKey']&&_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7c')]&&_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7b')]){_0x54bf98[_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x30')]](_0x4dd0c7['joins'][_0x5df926]['foreignTable'],null,util[_0xd187('0x73')](_0xd187('0x89'),_0x4dd0c7['table'],_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7a')],_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7c')],_0x4dd0c7[_0xd187('0x78')][_0x5df926][_0xd187('0x7b')]));}}}if(_0x4dd0c7['conditions']){_0x4dd0c7[_0xd187('0x7d')]=JSON[_0xd187('0x79')](_0x4dd0c7[_0xd187('0x7d')]);_0x54bf98[_0xd187('0x3b')](_0x395e45(_0x4dd0c7[_0xd187('0x7d')][_0xd187('0x65')]));}_0x3244dd=_0x54bf98[_0xd187('0x7e')]();_0x54bf98[_0xd187('0x1e')](_0x3d9b2f);_0x54bf98[_0xd187('0x21')](0x0);return;}})['then'](function(){if(_0x1da684[_0xd187('0x8a')]===_0xd187('0x8b')){return null;}var _0x25a053=_['merge'](_0x1da684,{'name':_0x1da684[_0xd187('0x8c')]||_0x1da684[_0xd187('0x2a')]||_0x4dd0c7[_0xd187('0x2a')],'basename':_0x1982cd,'savename':util[_0xd187('0x73')](_0xd187('0x8d'),_0x1da684[_0xd187('0x2a')]||_0x4dd0c7['name'],require(_0xd187('0x8e'))[_0xd187('0x8f')](0x4),_0x1da684[_0xd187('0x8a')]||'csv'),'reportId':_0x4dd0c7['id'],'reportType':_0xd187('0x90')});return db[_0xd187('0x91')][_0xd187('0x42')](_0x25a053,{'raw':!![]});})[_0xd187('0x26')](function(_0x12599e){if(_0x4dd0c7[_0xd187('0x6f')]==='cdr'){_0x3244dd[_0xd187('0x3b')](_0x4dd0c7[_0xd187('0x6f')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x1da684[_0xd187('0x92')],_0x1da684[_0xd187('0x93')]);}else{_0x3244dd['where'](_0x4dd0c7[_0xd187('0x6f')]+_0xd187('0x94'),_0x1da684['startDate'],_0x1da684[_0xd187('0x93')]);}if(_0x12599e){logger[_0xd187('0x95')]('Run\x20Query:',_0x3244dd[_0xd187('0x80')]());require('child_process')[_0xd187('0x96')](path[_0xd187('0x83')](__dirname,_0xd187('0x97'),_0x12599e[_0xd187('0x8a')]),[_0x12599e['id'],_0x3244dd[_0xd187('0x80')](),path['join'](__dirname,'../../files/reports',_0x12599e[_0xd187('0x98')]),_0x1982cd]);return _0x12599e;}else{var _0x2a2c7f=squel[_0xd187('0x99')]();_0x2a2c7f[_0xd187('0x6e')]('('+_0x3244dd[_0xd187('0x80')]()+')',_0xd187('0x9a'));_0x2a2c7f[_0xd187('0x76')]('COUNT(*)',_0xd187('0x20'));_0x3244dd[_0xd187('0x1e')](_0x1da684[_0xd187('0x1e')]||_0x3d9b2f);_0x3244dd[_0xd187('0x21')](_0x1da684[_0xd187('0x21')]||0x0);return dbH[_0xd187('0x81')]['query'](_0x2a2c7f[_0xd187('0x80')](),{'type':dbH[_0xd187('0x81')][_0xd187('0x9b')][_0xd187('0x82')]})[_0xd187('0x26')](function(_0x38a7cd){if(!_0x38a7cd[_0xd187('0x64')]){_0x5b7870=0x0;}else{_0x5b7870=_0x38a7cd[0x0][_0xd187('0x20')]||0x0;}return dbH['sequelize'][_0xd187('0x35')](_0x3244dd['toString'](),{'type':dbH[_0xd187('0x81')][_0xd187('0x9b')]['SELECT']});})[_0xd187('0x26')](function(_0x254e0a){return{'rows':_0x254e0a||[],'count':_0x5b7870};});}});}exports['run']=function(_0x1776c1,_0x497a94){return runReport(_0x1776c1[_0xd187('0x4c')],_0x1776c1['query'],_0x1776c1['options'])[_0xd187('0x26')](respondWithResult(_0x497a94,null))[_0xd187('0x40')](handleError(_0x497a94,null));};exports[_0xd187('0x9c')]=runReport;exports[_0xd187('0x35')]=function(_0x568f72,_0x357526){var _0x13ee40=0xa;var _0x20c269=[_0xd187('0x83'),_0xd187('0x4e'),_0xd187('0x4f'),_0xd187('0x50')];var _0x25ff89={'SUM':_0xd187('0x51'),'COUNT':_0xd187('0x52'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xd187('0x54'),'MIN':_0xd187('0x55'),'AVG':_0xd187('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd187('0x59')};var _0x28798f={'SEC_TO_TIME':_0xd187('0x5a'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xd187('0x5d'),'UNIX_TIMESTAMP':_0xd187('0x5e')};var _0x56fcde=function(_0x37b1b0){return!_[_0xd187('0x5f')]([_0xd187('0x60'),_0xd187('0x61'),'IS\x20EMPTY',_0xd187('0x62')],_0x37b1b0);};var _0x428e6c=function(_0x4524c3){if(!_0x4524c3||!_0x4524c3[_0xd187('0x63')][_0xd187('0x64')]){return'';}for(var _0x3a2937='(',_0xf03f9a=0x0;_0xf03f9a<_0x4524c3['rules'][_0xd187('0x64')];_0xf03f9a+=0x1){_0xf03f9a>0x0&&(_0x3a2937+='\x20'+_0x4524c3['operator']+'\x20');_0x3a2937+=_0x4524c3[_0xd187('0x63')][_0xf03f9a]['group']?_0x428e6c(_0x4524c3[_0xd187('0x63')][_0xf03f9a]['group']):_0x4524c3[_0xd187('0x63')][_0xf03f9a][_0xd187('0x76')]+'\x20'+_0x4524c3[_0xd187('0x63')][_0xf03f9a]['condition']+(_0x56fcde(_0x4524c3[_0xd187('0x63')][_0xf03f9a][_0xd187('0x66')])?'\x20'+_0x4524c3[_0xd187('0x63')][_0xf03f9a][_0xd187('0x67')]:'');}return _0x3a2937+')';};var _0x37405d={'where':{'id':_0x568f72[_0xd187('0x4c')]['id']}},_0xe84f78,_0x12b4a4,_0x3d09a6,_0x5acea7,_0x2a756f;_0x37405d=_[_0xd187('0x3c')]({},_0x37405d,_0x568f72['options']);return db[_0xd187('0x2d')][_0xd187('0x4b')](_0x37405d)[_0xd187('0x26')](function(_0x110af6){if(_0x110af6){_0xe84f78=_0x110af6;return _0x110af6[_0xd187('0x68')]();}return null;})[_0xd187('0x26')](function(_0x2e4db4){if(_0x2e4db4){if(!_0x2e4db4[_0xd187('0x64')]){throw new db[(_0xd187('0x69'))][(_0xd187('0x6a'))](_0xd187('0x6b'),0x193);}_0x12b4a4=_0x2e4db4;return db['AnalyticMetric'][_0xd187('0x6c')]({'raw':!![]});}return null;})[_0xd187('0x26')](function(_0x50d5b8){if(_0x50d5b8){_0x3d09a6=_[_0xd187('0x6d')](_0x50d5b8,'id');var _0x48ef98;var _0x2008e9=squel['select']();_0x2008e9[_0xd187('0x6e')](_0xe84f78[_0xd187('0x6f')]);for(var _0x9b8840=0x0;_0x9b8840<_0x12b4a4[_0xd187('0x64')];_0x9b8840+=0x1){_0x48ef98=_0x12b4a4[_0x9b8840][_0xd187('0x70')]?_0x3d09a6[_0x12b4a4[_0x9b8840]['MetricId']][_0xd187('0x71')]:_0x12b4a4[_0x9b8840][_0xd187('0x76')];_0x48ef98=_0x12b4a4[_0x9b8840][_0xd187('0x87')]?_[_0xd187('0x72')](_0x25ff89[_0x12b4a4[_0x9b8840][_0xd187('0x87')]],'%s',_0x48ef98):_0x48ef98;_0x48ef98=_0x12b4a4[_0x9b8840]['format']?_[_0xd187('0x72')](_0x28798f[_0x12b4a4[_0x9b8840][_0xd187('0x73')]],'%s',_0x48ef98):_0x48ef98;if(_0x12b4a4[_0x9b8840][_0xd187('0x74')]){_0x2008e9['group'](_0x48ef98);}_0x12b4a4[_0x9b8840]['orderBy']&&_0x2008e9[_0xd187('0x38')](_0x48ef98,_0x12b4a4[_0x9b8840][_0xd187('0x75')]===_0xd187('0x88')?![]:!![]);_0x2008e9[_0xd187('0x76')](_0x48ef98,_0x12b4a4[_0x9b8840]['alias']||_0x48ef98);}if(_0xe84f78[_0xd187('0x78')]){_0xe84f78[_0xd187('0x78')]=JSON[_0xd187('0x79')](_0xe84f78[_0xd187('0x78')]);for(var _0x4bff96=0x0;_0x4bff96<_0xe84f78[_0xd187('0x78')]['length'];_0x4bff96+=0x1){if(_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x30')]&&_[_0xd187('0x5f')](_0x20c269,_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x30')])&&_0xe84f78['joins'][_0x4bff96][_0xd187('0x7a')]&&_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7c')]&&_0xe84f78[_0xd187('0x78')][_0x4bff96]['foreignKey']){_0x2008e9[_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x30')]](_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7c')],null,util[_0xd187('0x73')](_0xd187('0x89'),_0xe84f78[_0xd187('0x6f')],_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7a')],_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7c')],_0xe84f78[_0xd187('0x78')][_0x4bff96][_0xd187('0x7b')]));}}}if(_0xe84f78['conditions']){_0xe84f78[_0xd187('0x7d')]=JSON['parse'](_0xe84f78[_0xd187('0x7d')]);_0x2008e9['where'](_0x428e6c(_0xe84f78[_0xd187('0x7d')][_0xd187('0x65')]));}_0x2a756f=_0x2008e9[_0xd187('0x7e')]();_0x2008e9[_0xd187('0x1e')](_0x13ee40);_0x2008e9['offset'](0x0);logger['debug'](_0xd187('0x7f'),_0x2008e9[_0xd187('0x80')]());return dbH[_0xd187('0x81')][_0xd187('0x35')](_0x2008e9[_0xd187('0x80')](),{'type':dbH[_0xd187('0x81')]['QueryTypes']['SELECT']});}})[_0xd187('0x26')](function(){return{'sql':_0x2a756f[_0xd187('0x80')]()};})[_0xd187('0x26')](respondWithResult(_0x357526,null))['catch'](handleError(_0x357526,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index f8d65bc..c36632d 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 _0xa8e7=['define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticDefaultReport.attributes','exports'];(function(_0xccd430,_0x20c70c){var _0x3b4056=function(_0x3fc684){while(--_0x3fc684){_0xccd430['push'](_0xccd430['shift']());}};_0x3b4056(++_0x20c70c);}(_0xa8e7,0x65));var _0x7a8e=function(_0xb8acdd,_0x11b6bc){_0xb8acdd=_0xb8acdd-0x0;var _0x41ea5f=_0xa8e7[_0xb8acdd];return _0x41ea5f;};'use strict';var _=require(_0x7a8e('0x0'));var util=require(_0x7a8e('0x1'));var logger=require(_0x7a8e('0x2'))(_0x7a8e('0x3'));var moment=require(_0x7a8e('0x4'));var BPromise=require(_0x7a8e('0x5'));var rp=require(_0x7a8e('0x6'));var fs=require('fs');var path=require(_0x7a8e('0x7'));var rimraf=require('rimraf');var config=require(_0x7a8e('0x8'));var attributes=require(_0x7a8e('0x9'));module[_0x7a8e('0xa')]=function(_0x50e986,_0x59acbd){return _0x50e986[_0x7a8e('0xb')](_0x7a8e('0xc'),attributes,{'tableName':_0x7a8e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2312=['exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticDefaultReport.attributes'];(function(_0x40833f,_0xd4a58f){var _0x4de617=function(_0x1b4e30){while(--_0x1b4e30){_0x40833f['push'](_0x40833f['shift']());}};_0x4de617(++_0xd4a58f);}(_0x2312,0xf4));var _0x2231=function(_0x3b3f24,_0x3457e0){_0x3b3f24=_0x3b3f24-0x0;var _0x2d7aed=_0x2312[_0x3b3f24];return _0x2d7aed;};'use strict';var _=require(_0x2231('0x0'));var util=require(_0x2231('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2231('0x2'));var BPromise=require(_0x2231('0x3'));var rp=require(_0x2231('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2231('0x5'));var config=require(_0x2231('0x6'));var attributes=require(_0x2231('0x7'));module[_0x2231('0x8')]=function(_0x23bf20,_0x546eae){return _0x23bf20[_0x2231('0x9')](_0x2231('0xa'),attributes,{'tableName':_0x2231('0xb'),'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 c0512ac..c0bc3ae 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 _0x0157=['debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0157,0x146));var _0x7015=function(_0x199839,_0xe15542){_0x199839=_0x199839-0x0;var _0x2f8888=_0x0157[_0x199839];return _0x2f8888;};'use strict';var _=require(_0x7015('0x0'));var util=require(_0x7015('0x1'));var moment=require(_0x7015('0x2'));var BPromise=require(_0x7015('0x3'));var rs=require(_0x7015('0x4'));var fs=require('fs');var Redis=require(_0x7015('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7015('0x6'))(_0x7015('0x7'));var config=require(_0x7015('0x8'));var jayson=require(_0x7015('0x9'));var client=jayson['client'][_0x7015('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x278ba9,_0x393dfa,_0x7d4ec7){return new BPromise(function(_0x44706b,_0x3e409b){return client['request'](_0x278ba9,_0x7d4ec7)[_0x7015('0xb')](function(_0x176dc7){logger['info'](_0x7015('0xc'),_0x393dfa,_0x7015('0xd'));logger[_0x7015('0xe')](_0x7015('0xf'),_0x393dfa,_0x7015('0xd'),JSON['stringify'](_0x176dc7));if(_0x176dc7[_0x7015('0x10')]){if(_0x176dc7['error']['code']===0x1f4){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x393dfa,_0x176dc7[_0x7015('0x10')]['message']);return _0x3e409b(_0x176dc7['error']['message']);}logger[_0x7015('0x10')](_0x7015('0xc'),_0x393dfa,_0x176dc7['error'][_0x7015('0x11')]);return _0x44706b(_0x176dc7['error'][_0x7015('0x11')]);}else{logger[_0x7015('0x12')](_0x7015('0xc'),_0x393dfa,_0x7015('0xd'));_0x44706b(_0x176dc7['result'][_0x7015('0x11')]);}})[_0x7015('0x13')](function(_0x4ccdeb){logger[_0x7015('0x10')](_0x7015('0xc'),_0x393dfa,_0x4ccdeb);_0x3e409b(_0x4ccdeb);});});} \ No newline at end of file +var _0x34a4=['code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1d83c8,_0x2f280b){var _0x4804a2=function(_0x2e1b2a){while(--_0x2e1b2a){_0x1d83c8['push'](_0x1d83c8['shift']());}};_0x4804a2(++_0x2f280b);}(_0x34a4,0x9d));var _0x434a=function(_0x5232bb,_0x4fcb6c){_0x5232bb=_0x5232bb-0x0;var _0x2ba6d1=_0x34a4[_0x5232bb];return _0x2ba6d1;};'use strict';var _=require(_0x434a('0x0'));var util=require(_0x434a('0x1'));var moment=require(_0x434a('0x2'));var BPromise=require(_0x434a('0x3'));var rs=require(_0x434a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x434a('0x5'))['db'];var utils=require(_0x434a('0x6'));var logger=require(_0x434a('0x7'))(_0x434a('0x8'));var config=require(_0x434a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x434a('0xa')][_0x434a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x55c2de,_0x59f909,_0x3e04a0){return new BPromise(function(_0x45eddf,_0x16dae9){return client[_0x434a('0xc')](_0x55c2de,_0x3e04a0)[_0x434a('0xd')](function(_0x4ed5ac){logger[_0x434a('0xe')](_0x434a('0xf'),_0x59f909,_0x434a('0x10'));logger['debug']('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x59f909,_0x434a('0x10'),JSON[_0x434a('0x11')](_0x4ed5ac));if(_0x4ed5ac[_0x434a('0x12')]){if(_0x4ed5ac[_0x434a('0x12')][_0x434a('0x13')]===0x1f4){logger[_0x434a('0x12')](_0x434a('0xf'),_0x59f909,_0x4ed5ac[_0x434a('0x12')]['message']);return _0x16dae9(_0x4ed5ac[_0x434a('0x12')][_0x434a('0x14')]);}logger[_0x434a('0x12')](_0x434a('0xf'),_0x59f909,_0x4ed5ac[_0x434a('0x12')][_0x434a('0x14')]);return _0x45eddf(_0x4ed5ac[_0x434a('0x12')]['message']);}else{logger[_0x434a('0xe')](_0x434a('0xf'),_0x59f909,'request\x20sent');_0x45eddf(_0x4ed5ac['result'][_0x434a('0x14')]);}})[_0x434a('0x15')](function(_0x201d12){logger['error'](_0x434a('0xf'),_0x59f909,_0x201d12);_0x16dae9(_0x201d12);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 8c15dbc..6fe2c34 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 _0xee61=['/:id','show','/:id/preview','/:id/run','run','/:id/query','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','get','isAuthenticated'];(function(_0x35a321,_0x5ccb58){var _0x1c17b1=function(_0x59a20b){while(--_0x59a20b){_0x35a321['push'](_0x35a321['shift']());}};_0x1c17b1(++_0x5ccb58);}(_0xee61,0x145));var _0x1ee6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xee61[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x1ee6('0x0'));var util=require(_0x1ee6('0x1'));var path=require('path');var timeout=require(_0x1ee6('0x2'));var express=require(_0x1ee6('0x3'));var router=express[_0x1ee6('0x4')]();var fs_extra=require(_0x1ee6('0x5'));var auth=require(_0x1ee6('0x6'));var interaction=require(_0x1ee6('0x7'));var config=require('../../config/environment');var controller=require(_0x1ee6('0x8'));router[_0x1ee6('0x9')]('/',auth[_0x1ee6('0xa')](),controller['index']);router[_0x1ee6('0x9')](_0x1ee6('0xb'),auth[_0x1ee6('0xa')](),controller[_0x1ee6('0xc')]);router[_0x1ee6('0x9')](_0x1ee6('0xd'),auth[_0x1ee6('0xa')](),controller['preview']);router[_0x1ee6('0x9')](_0x1ee6('0xe'),auth['isAuthenticated'](),controller[_0x1ee6('0xf')]);router[_0x1ee6('0x9')](_0x1ee6('0x10'),auth[_0x1ee6('0xa')](),controller['query']);router[_0x1ee6('0x11')]('/',auth[_0x1ee6('0xa')](),controller[_0x1ee6('0x12')]);router[_0x1ee6('0x13')]('/:id',auth[_0x1ee6('0xa')](),controller[_0x1ee6('0x14')]);router[_0x1ee6('0x15')](_0x1ee6('0xb'),auth[_0x1ee6('0xa')](),controller[_0x1ee6('0x16')]);module[_0x1ee6('0x17')]=router; \ No newline at end of file +var _0xe7de=['create','put','update','delete','destroy','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','preview','run','/:id/query','query','post'];(function(_0x59be2b,_0x3d5909){var _0xcfec1f=function(_0x443c76){while(--_0x443c76){_0x59be2b['push'](_0x59be2b['shift']());}};_0xcfec1f(++_0x3d5909);}(_0xe7de,0x1d1));var _0xee7d=function(_0x3bd741,_0x2fb100){_0x3bd741=_0x3bd741-0x0;var _0x3c945b=_0xe7de[_0x3bd741];return _0x3c945b;};'use strict';var multer=require(_0xee7d('0x0'));var util=require(_0xee7d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xee7d('0x2'));var router=express['Router']();var fs_extra=require(_0xee7d('0x3'));var auth=require(_0xee7d('0x4'));var interaction=require(_0xee7d('0x5'));var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router[_0xee7d('0x6')]('/',auth[_0xee7d('0x7')](),controller[_0xee7d('0x8')]);router[_0xee7d('0x6')](_0xee7d('0x9'),auth[_0xee7d('0x7')](),controller['show']);router[_0xee7d('0x6')]('/:id/preview',auth[_0xee7d('0x7')](),controller[_0xee7d('0xa')]);router[_0xee7d('0x6')]('/:id/run',auth[_0xee7d('0x7')](),controller[_0xee7d('0xb')]);router[_0xee7d('0x6')](_0xee7d('0xc'),auth[_0xee7d('0x7')](),controller[_0xee7d('0xd')]);router[_0xee7d('0xe')]('/',auth[_0xee7d('0x7')](),controller[_0xee7d('0xf')]);router[_0xee7d('0x10')]('/:id',auth[_0xee7d('0x7')](),controller[_0xee7d('0x11')]);router[_0xee7d('0x12')](_0xee7d('0x9'),auth[_0xee7d('0x7')](),controller[_0xee7d('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 4496273..7987b4d 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 _0xbb1a=['ENUM','pdf','csv','DATE','Loading','INTEGER','UNSIGNED','exports','STRING'];(function(_0x91b8d8,_0x3e9c58){var _0x1d50a0=function(_0x1c0269){while(--_0x1c0269){_0x91b8d8['push'](_0x91b8d8['shift']());}};_0x1d50a0(++_0x3e9c58);}(_0xbb1a,0xa0));var _0xabb1=function(_0x53cb02,_0x28355a){_0x53cb02=_0x53cb02-0x0;var _0x509e67=_0xbb1a[_0x53cb02];return _0x509e67;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xabb1('0x0')]={'name':{'type':Sequelize[_0xabb1('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0xabb1('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0xabb1('0x2')]('csv',_0xabb1('0x3'),'xlsx'),'allowNull':![],'defaultValue':_0xabb1('0x4')},'savename':{'type':Sequelize[_0xabb1('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0xabb1('0x5')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize['STRING'],'defaultValue':_0xabb1('0x6')},'type':{'type':Sequelize['ENUM']('manual','scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0xabb1('0x7')](0xb)[_0xabb1('0x8')]},'reportType':{'type':Sequelize[_0xabb1('0x1')]}}; \ No newline at end of file +var _0x2eef=['STRING','ENUM','csv','pdf','xlsx','DATE','Loading','manual','UNSIGNED','sequelize','moment','exports'];(function(_0x26be6e,_0x8819ef){var _0x54ac97=function(_0x290d5b){while(--_0x290d5b){_0x26be6e['push'](_0x26be6e['shift']());}};_0x54ac97(++_0x8819ef);}(_0x2eef,0xd5));var _0xf2ee=function(_0x1e0184,_0x13f27e){_0x1e0184=_0x1e0184-0x0;var _0x225e8b=_0x2eef[_0x1e0184];return _0x225e8b;};'use strict';var Sequelize=require(_0xf2ee('0x0'));var moment=require(_0xf2ee('0x1'));module[_0xf2ee('0x2')]={'name':{'type':Sequelize[_0xf2ee('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xf2ee('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xf2ee('0x4')](_0xf2ee('0x5'),_0xf2ee('0x6'),_0xf2ee('0x7')),'allowNull':![],'defaultValue':_0xf2ee('0x5')},'savename':{'type':Sequelize[_0xf2ee('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xf2ee('0x8')]},'endDate':{'type':Sequelize[_0xf2ee('0x8')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0xf2ee('0x9')},'type':{'type':Sequelize[_0xf2ee('0x4')](_0xf2ee('0xa'),'scheduled'),'allowNull':![],'defaultValue':_0xf2ee('0xa')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xf2ee('0xb')]},'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 7630b4f..e5b8b1b 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 _0x3646=['util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','count','status','set','Content-Range','apply','reject','save','then','destroy','ExtractedReports','UserProfileResource','sendStatus','error','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','body','user','role','get','UserProfileSection','create','download','join','root','server/files/reports','savename','Sequelize','ValidationError','%s.%s','basename','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x3335f5,_0x1a6c6e){var _0x965dc=function(_0x56bd97){while(--_0x56bd97){_0x3335f5['push'](_0x3335f5['shift']());}};_0x965dc(++_0x1a6c6e);}(_0x3646,0xb3));var _0x6364=function(_0x2bb56b,_0x332739){_0x2bb56b=_0x2bb56b-0x0;var _0x377242=_0x3646[_0x2bb56b];return _0x377242;};'use strict';var emlformat=require(_0x6364('0x0'));var rimraf=require(_0x6364('0x1'));var zipdir=require(_0x6364('0x2'));var jsonpatch=require(_0x6364('0x3'));var rp=require(_0x6364('0x4'));var moment=require(_0x6364('0x5'));var BPromise=require(_0x6364('0x6'));var Mustache=require('mustache');var util=require(_0x6364('0x7'));var path=require('path');var sox=require(_0x6364('0x8'));var csv=require(_0x6364('0x9'));var ejs=require(_0x6364('0xa'));var fs=require('fs');var fs_extra=require(_0x6364('0xb'));var _=require(_0x6364('0xc'));var squel=require('squel');var crypto=require(_0x6364('0xd'));var jsforce=require(_0x6364('0xe'));var deskjs=require(_0x6364('0xf'));var toCsv=require(_0x6364('0x9'));var querystring=require(_0x6364('0x10'));var Papa=require(_0x6364('0x11'));var Redis=require('ioredis');var authService=require(_0x6364('0x12'));var qs=require(_0x6364('0x13'));var as=require(_0x6364('0x14'));var hardwareService=require(_0x6364('0x15'));var logger=require('../../config/logger')(_0x6364('0x16'));var utils=require(_0x6364('0x17'));var config=require(_0x6364('0x18'));var licenseUtil=require(_0x6364('0x19'));var db=require(_0x6364('0x1a'))['db'];function respondWithStatusCode(_0x28c6d7,_0xbcb4a2){_0xbcb4a2=_0xbcb4a2||0xcc;return function(_0xd2776b){if(_0xd2776b){return _0x28c6d7['sendStatus'](_0xbcb4a2);}return _0x28c6d7['status'](_0xbcb4a2)[_0x6364('0x1b')]();};}function respondWithResult(_0xc37a9c,_0x16b460){_0x16b460=_0x16b460||0xc8;return function(_0x289a31){if(_0x289a31){return _0xc37a9c['status'](_0x16b460)[_0x6364('0x1c')](_0x289a31);}};}function respondWithFilteredResult(_0x2e5d08,_0x353ed3){return function(_0x3f6993){if(_0x3f6993){var _0x3a8a83=typeof _0x353ed3[_0x6364('0x1d')]===_0x6364('0x1e')&&typeof _0x353ed3['limit']==='undefined';var _0x2826e0=_0x3f6993[_0x6364('0x1f')];var _0x1e8939=_0x3a8a83?0x0:_0x353ed3[_0x6364('0x1d')];var _0x435ec1=_0x3a8a83?_0x3f6993[_0x6364('0x1f')]:_0x353ed3[_0x6364('0x1d')]+_0x353ed3['limit'];var _0x2474c2;if(_0x435ec1>=_0x2826e0){_0x435ec1=_0x2826e0;_0x2474c2=0xc8;}else{_0x2474c2=0xce;}_0x2e5d08[_0x6364('0x20')](_0x2474c2);return _0x2e5d08[_0x6364('0x21')](_0x6364('0x22'),_0x1e8939+'-'+_0x435ec1+'/'+_0x2826e0)['json'](_0x3f6993);}return null;};}function patchUpdates(_0x2df839){return function(_0x2ee7b1){try{jsonpatch[_0x6364('0x23')](_0x2ee7b1,_0x2df839,!![]);}catch(_0x273008){return BPromise[_0x6364('0x24')](_0x273008);}return _0x2ee7b1[_0x6364('0x25')]();};}function saveUpdates(_0x5e7782,_0x141d4c){return function(_0x5030cc){if(_0x5030cc){return _0x5030cc['update'](_0x5e7782)[_0x6364('0x26')](function(_0x1bb178){return _0x1bb178;});}return null;};}function removeEntity(_0x1e98f3,_0x58f943){return function(_0xf133fc){if(_0xf133fc){return _0xf133fc[_0x6364('0x27')]()['then'](function(){var _0x54e083=_0xf133fc['get']({'plain':!![]});var _0x1afff0=_0x6364('0x28');return db[_0x6364('0x29')][_0x6364('0x27')]({'where':{'type':_0x1afff0,'resourceId':_0x54e083['id']}})['then'](function(){return _0xf133fc;});})['then'](function(){_0x1e98f3[_0x6364('0x20')](0xcc)[_0x6364('0x1b')]();});}};}function handleEntityNotFound(_0x3da3a2,_0x15d437){return function(_0x5077ca){if(!_0x5077ca){_0x3da3a2[_0x6364('0x2a')](0x194);}return _0x5077ca;};}function handleError(_0x270d1d,_0x438cf5){_0x438cf5=_0x438cf5||0x1f4;return function(_0x4c85fb){logger[_0x6364('0x2b')](_0x4c85fb['stack']);if(_0x4c85fb['name']){delete _0x4c85fb[_0x6364('0x2c')];}_0x270d1d[_0x6364('0x20')](_0x438cf5)[_0x6364('0x2d')](_0x4c85fb);};}exports[_0x6364('0x2e')]=function(_0x40c035,_0x1afb6c){var _0x3d535f={},_0x140679={},_0x1f9807={'count':0x0,'rows':[]};var _0x1f11be=_[_0x6364('0x2f')](db[_0x6364('0x30')][_0x6364('0x31')],function(_0x325826){return{'name':_0x325826[_0x6364('0x32')],'type':_0x325826[_0x6364('0x33')]['key']};});_0x140679[_0x6364('0x34')]=_[_0x6364('0x2f')](_0x1f11be,_0x6364('0x2c'));_0x140679[_0x6364('0x35')]=_[_0x6364('0x36')](_0x40c035[_0x6364('0x35')]);_0x140679[_0x6364('0x37')]=_[_0x6364('0x38')](_0x140679[_0x6364('0x34')],_0x140679[_0x6364('0x35')]);_0x3d535f[_0x6364('0x39')]=_[_0x6364('0x38')](_0x140679['model'],qs['fields'](_0x40c035[_0x6364('0x35')][_0x6364('0x3a')]));_0x3d535f['attributes']=_0x3d535f['attributes'][_0x6364('0x3b')]?_0x3d535f[_0x6364('0x39')]:_0x140679[_0x6364('0x34')];if(!_0x40c035[_0x6364('0x35')]['hasOwnProperty'](_0x6364('0x3c'))){_0x3d535f[_0x6364('0x3d')]=qs[_0x6364('0x3d')](_0x40c035[_0x6364('0x35')][_0x6364('0x3d')]);_0x3d535f['offset']=qs[_0x6364('0x1d')](_0x40c035['query']['offset']);}_0x3d535f[_0x6364('0x3e')]=qs[_0x6364('0x3f')](_0x40c035[_0x6364('0x35')]['sort']);_0x3d535f[_0x6364('0x40')]=qs[_0x6364('0x37')](_[_0x6364('0x41')](_0x40c035[_0x6364('0x35')],_0x140679[_0x6364('0x37')]),_0x1f11be);if(_0x40c035[_0x6364('0x35')][_0x6364('0x42')]){_0x3d535f[_0x6364('0x40')]=_[_0x6364('0x43')](_0x3d535f[_0x6364('0x40')],{'$or':_[_0x6364('0x2f')](_0x1f11be,function(_0x2bbb15){if(_0x2bbb15[_0x6364('0x33')]!==_0x6364('0x44')){var _0x393cb3={};_0x393cb3[_0x2bbb15[_0x6364('0x2c')]]={'$like':'%'+_0x40c035['query'][_0x6364('0x42')]+'%'};return _0x393cb3;}})});}_0x3d535f=_[_0x6364('0x43')]({},_0x3d535f,_0x40c035[_0x6364('0x45')]);var _0x2b3817={'where':_0x3d535f[_0x6364('0x40')]};return db['AnalyticExtractedReport'][_0x6364('0x1f')](_0x2b3817)[_0x6364('0x26')](function(_0x29670b){_0x1f9807[_0x6364('0x1f')]=_0x29670b;if(_0x40c035[_0x6364('0x35')]['includeAll']){_0x3d535f[_0x6364('0x46')]=[{'all':!![]}];}return db[_0x6364('0x30')][_0x6364('0x47')](_0x3d535f);})[_0x6364('0x26')](function(_0x12bcec){_0x1f9807['rows']=_0x12bcec;return _0x1f9807;})[_0x6364('0x26')](respondWithFilteredResult(_0x1afb6c,_0x3d535f))[_0x6364('0x48')](handleError(_0x1afb6c,null));};exports[_0x6364('0x49')]=function(_0x1ba800,_0x32a4b9){var _0x3060db={'raw':!![],'where':{'id':_0x1ba800[_0x6364('0x4a')]['id']}},_0x4a749={};_0x4a749[_0x6364('0x34')]=_[_0x6364('0x36')](db[_0x6364('0x30')]['rawAttributes']);_0x4a749['query']=_[_0x6364('0x36')](_0x1ba800['query']);_0x4a749[_0x6364('0x37')]=_[_0x6364('0x38')](_0x4a749[_0x6364('0x34')],_0x4a749[_0x6364('0x35')]);_0x3060db[_0x6364('0x39')]=_['intersection'](_0x4a749[_0x6364('0x34')],qs['fields'](_0x1ba800['query'][_0x6364('0x3a')]));_0x3060db[_0x6364('0x39')]=_0x3060db['attributes']['length']?_0x3060db[_0x6364('0x39')]:_0x4a749[_0x6364('0x34')];if(_0x1ba800[_0x6364('0x35')][_0x6364('0x4b')]){_0x3060db[_0x6364('0x46')]=[{'all':!![]}];}_0x3060db=_[_0x6364('0x43')]({},_0x3060db,_0x1ba800[_0x6364('0x45')]);return db[_0x6364('0x30')][_0x6364('0x4c')](_0x3060db)[_0x6364('0x26')](handleEntityNotFound(_0x32a4b9,null))[_0x6364('0x26')](respondWithResult(_0x32a4b9,null))[_0x6364('0x48')](handleError(_0x32a4b9,null));};exports['create']=function(_0x4eb069,_0x5f1c3f){return db[_0x6364('0x30')]['create'](_0x4eb069[_0x6364('0x4d')],{})[_0x6364('0x26')](function(_0x1efd89){var _0x4e75d8=_0x4eb069[_0x6364('0x4e')]['get']({'plain':!![]});if(!_0x4e75d8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4e75d8[_0x6364('0x4f')]===_0x6364('0x4e')){var _0x17ceb4=_0x1efd89[_0x6364('0x50')]({'plain':!![]});var _0x4fc7d0=_0x6364('0x28');return db[_0x6364('0x51')][_0x6364('0x4c')]({'where':{'name':_0x4fc7d0,'userProfileId':_0x4e75d8['userProfileId']},'raw':!![]})[_0x6364('0x26')](function(_0xf4802){if(_0xf4802&&_0xf4802['autoAssociation']===0x0){return db[_0x6364('0x29')][_0x6364('0x52')]({'name':_0x17ceb4[_0x6364('0x2c')],'resourceId':_0x17ceb4['id'],'type':_0xf4802['name'],'sectionId':_0xf4802['id']},{})[_0x6364('0x26')](function(){return _0x1efd89;});}else{return _0x1efd89;}})[_0x6364('0x48')](function(_0x36e079){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36e079);throw _0x36e079;});}return _0x1efd89;})[_0x6364('0x26')](respondWithResult(_0x5f1c3f,0xc9))[_0x6364('0x48')](handleError(_0x5f1c3f,null));};exports['update']=function(_0x5c15b2,_0x16c60b){if(_0x5c15b2['body']['id']){delete _0x5c15b2[_0x6364('0x4d')]['id'];}return db[_0x6364('0x30')][_0x6364('0x4c')]({'where':{'id':_0x5c15b2[_0x6364('0x4a')]['id']}})[_0x6364('0x26')](handleEntityNotFound(_0x16c60b,null))[_0x6364('0x26')](saveUpdates(_0x5c15b2[_0x6364('0x4d')],null))[_0x6364('0x26')](respondWithResult(_0x16c60b,null))[_0x6364('0x48')](handleError(_0x16c60b,null));};exports[_0x6364('0x27')]=function(_0x39f1ad,_0x50b9ac){return db[_0x6364('0x30')][_0x6364('0x4c')]({'where':{'id':_0x39f1ad[_0x6364('0x4a')]['id']}})[_0x6364('0x26')](handleEntityNotFound(_0x50b9ac,null))['then'](removeEntity(_0x50b9ac,null))[_0x6364('0x48')](handleError(_0x50b9ac,null));};exports[_0x6364('0x53')]=function(_0x51b440,_0x25c14a,_0x15d02e){return db[_0x6364('0x30')][_0x6364('0x4c')]({'where':{'id':_0x51b440[_0x6364('0x4a')]['id']},'attributes':['name','basename','savename','output'],'raw':!![]})[_0x6364('0x26')](handleEntityNotFound(_0x25c14a,null))['then'](function(_0x52211c){if(_0x52211c){if(!fs['existsSync'](path[_0x6364('0x54')](config[_0x6364('0x55')],_0x6364('0x56'),_0x52211c[_0x6364('0x57')]))){throw new db[(_0x6364('0x58'))][(_0x6364('0x59'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x51b440[_0x6364('0x35')]['exists']){return _0x25c14a[_0x6364('0x2a')](0xc8);}return _0x25c14a[_0x6364('0x53')](path['join'](config[_0x6364('0x55')],_0x6364('0x56'),_0x52211c['savename']),util['format'](_0x6364('0x5a'),_0x52211c[_0x6364('0x5b')]||_0x52211c['name'],_0x52211c['output'][_0x6364('0x5c')]()));}})['catch'](handleError(_0x25c14a,null));}; \ No newline at end of file +var _0xb0ec=['save','update','then','get','ExtractedReports','destroy','stack','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','name','options','includeAll','include','findAll','rows','show','merge','find','catch','create','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','body','basename','output','existsSync','join','root','server/files/reports','savename','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','download','%s.%s','toLowerCase','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','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','offset','undefined','count','limit','Content-Range','reject'];(function(_0x2a8c21,_0x163576){var _0x5f3061=function(_0x4dc8eb){while(--_0x4dc8eb){_0x2a8c21['push'](_0x2a8c21['shift']());}};_0x5f3061(++_0x163576);}(_0xb0ec,0x103));var _0xcb0e=function(_0x4e3394,_0x9c1abe){_0x4e3394=_0x4e3394-0x0;var _0x3d6bd7=_0xb0ec[_0x4e3394];return _0x3d6bd7;};'use strict';var emlformat=require(_0xcb0e('0x0'));var rimraf=require(_0xcb0e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcb0e('0x2'));var moment=require(_0xcb0e('0x3'));var BPromise=require(_0xcb0e('0x4'));var Mustache=require(_0xcb0e('0x5'));var util=require(_0xcb0e('0x6'));var path=require(_0xcb0e('0x7'));var sox=require(_0xcb0e('0x8'));var csv=require(_0xcb0e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcb0e('0xa'));var _=require(_0xcb0e('0xb'));var squel=require('squel');var crypto=require(_0xcb0e('0xc'));var jsforce=require(_0xcb0e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xcb0e('0x9'));var querystring=require(_0xcb0e('0xe'));var Papa=require(_0xcb0e('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcb0e('0x10'));var as=require(_0xcb0e('0x11'));var hardwareService=require(_0xcb0e('0x12'));var logger=require(_0xcb0e('0x13'))(_0xcb0e('0x14'));var utils=require(_0xcb0e('0x15'));var config=require(_0xcb0e('0x16'));var licenseUtil=require(_0xcb0e('0x17'));var db=require(_0xcb0e('0x18'))['db'];function respondWithStatusCode(_0x27ce0b,_0x17e073){_0x17e073=_0x17e073||0xcc;return function(_0x59a086){if(_0x59a086){return _0x27ce0b[_0xcb0e('0x19')](_0x17e073);}return _0x27ce0b[_0xcb0e('0x1a')](_0x17e073)[_0xcb0e('0x1b')]();};}function respondWithResult(_0x1fd362,_0x36dd66){_0x36dd66=_0x36dd66||0xc8;return function(_0x123d6e){if(_0x123d6e){return _0x1fd362[_0xcb0e('0x1a')](_0x36dd66)[_0xcb0e('0x1c')](_0x123d6e);}};}function respondWithFilteredResult(_0x59e3f9,_0x44e96e){return function(_0x247bb0){if(_0x247bb0){var _0x67e5c1=typeof _0x44e96e[_0xcb0e('0x1d')]==='undefined'&&typeof _0x44e96e['limit']===_0xcb0e('0x1e');var _0x45c67f=_0x247bb0[_0xcb0e('0x1f')];var _0x439997=_0x67e5c1?0x0:_0x44e96e[_0xcb0e('0x1d')];var _0x2e8b97=_0x67e5c1?_0x247bb0[_0xcb0e('0x1f')]:_0x44e96e['offset']+_0x44e96e[_0xcb0e('0x20')];var _0x45dcd1;if(_0x2e8b97>=_0x45c67f){_0x2e8b97=_0x45c67f;_0x45dcd1=0xc8;}else{_0x45dcd1=0xce;}_0x59e3f9[_0xcb0e('0x1a')](_0x45dcd1);return _0x59e3f9['set'](_0xcb0e('0x21'),_0x439997+'-'+_0x2e8b97+'/'+_0x45c67f)[_0xcb0e('0x1c')](_0x247bb0);}return null;};}function patchUpdates(_0x16e832){return function(_0x43858c){try{jsonpatch['apply'](_0x43858c,_0x16e832,!![]);}catch(_0x2dab8b){return BPromise[_0xcb0e('0x22')](_0x2dab8b);}return _0x43858c[_0xcb0e('0x23')]();};}function saveUpdates(_0x1c5846,_0x5667ca){return function(_0x558791){if(_0x558791){return _0x558791[_0xcb0e('0x24')](_0x1c5846)[_0xcb0e('0x25')](function(_0x200303){return _0x200303;});}return null;};}function removeEntity(_0x4dd545,_0x418f90){return function(_0x5328cb){if(_0x5328cb){return _0x5328cb['destroy']()[_0xcb0e('0x25')](function(){var _0x2963c1=_0x5328cb[_0xcb0e('0x26')]({'plain':!![]});var _0x14a0a7=_0xcb0e('0x27');return db['UserProfileResource'][_0xcb0e('0x28')]({'where':{'type':_0x14a0a7,'resourceId':_0x2963c1['id']}})[_0xcb0e('0x25')](function(){return _0x5328cb;});})[_0xcb0e('0x25')](function(){_0x4dd545[_0xcb0e('0x1a')](0xcc)[_0xcb0e('0x1b')]();});}};}function handleEntityNotFound(_0x3181c3,_0x3429a2){return function(_0x3d1d9d){if(!_0x3d1d9d){_0x3181c3['sendStatus'](0x194);}return _0x3d1d9d;};}function handleError(_0x3b6342,_0x3ab7f0){_0x3ab7f0=_0x3ab7f0||0x1f4;return function(_0x1fe34d){logger['error'](_0x1fe34d[_0xcb0e('0x29')]);if(_0x1fe34d['name']){delete _0x1fe34d['name'];}_0x3b6342[_0xcb0e('0x1a')](_0x3ab7f0)[_0xcb0e('0x2a')](_0x1fe34d);};}exports[_0xcb0e('0x2b')]=function(_0x386be1,_0x30ee0a){var _0x28c12b={},_0x15fa6e={},_0xade4ea={'count':0x0,'rows':[]};var _0x5f16e0=_[_0xcb0e('0x2c')](db[_0xcb0e('0x2d')][_0xcb0e('0x2e')],function(_0x39004d){return{'name':_0x39004d[_0xcb0e('0x2f')],'type':_0x39004d[_0xcb0e('0x30')][_0xcb0e('0x31')]};});_0x15fa6e[_0xcb0e('0x32')]=_[_0xcb0e('0x2c')](_0x5f16e0,'name');_0x15fa6e[_0xcb0e('0x33')]=_[_0xcb0e('0x34')](_0x386be1['query']);_0x15fa6e[_0xcb0e('0x35')]=_[_0xcb0e('0x36')](_0x15fa6e['model'],_0x15fa6e['query']);_0x28c12b[_0xcb0e('0x37')]=_[_0xcb0e('0x36')](_0x15fa6e[_0xcb0e('0x32')],qs[_0xcb0e('0x38')](_0x386be1[_0xcb0e('0x33')][_0xcb0e('0x38')]));_0x28c12b[_0xcb0e('0x37')]=_0x28c12b[_0xcb0e('0x37')][_0xcb0e('0x39')]?_0x28c12b[_0xcb0e('0x37')]:_0x15fa6e['model'];if(!_0x386be1[_0xcb0e('0x33')]['hasOwnProperty'](_0xcb0e('0x3a'))){_0x28c12b[_0xcb0e('0x20')]=qs['limit'](_0x386be1[_0xcb0e('0x33')]['limit']);_0x28c12b[_0xcb0e('0x1d')]=qs[_0xcb0e('0x1d')](_0x386be1[_0xcb0e('0x33')][_0xcb0e('0x1d')]);}_0x28c12b[_0xcb0e('0x3b')]=qs['sort'](_0x386be1[_0xcb0e('0x33')][_0xcb0e('0x3c')]);_0x28c12b[_0xcb0e('0x3d')]=qs[_0xcb0e('0x35')](_[_0xcb0e('0x3e')](_0x386be1['query'],_0x15fa6e[_0xcb0e('0x35')]),_0x5f16e0);if(_0x386be1['query'][_0xcb0e('0x3f')]){_0x28c12b[_0xcb0e('0x3d')]=_['merge'](_0x28c12b[_0xcb0e('0x3d')],{'$or':_[_0xcb0e('0x2c')](_0x5f16e0,function(_0x367261){if(_0x367261[_0xcb0e('0x30')]!==_0xcb0e('0x40')){var _0x4c0cd1={};_0x4c0cd1[_0x367261[_0xcb0e('0x41')]]={'$like':'%'+_0x386be1[_0xcb0e('0x33')][_0xcb0e('0x3f')]+'%'};return _0x4c0cd1;}})});}_0x28c12b=_['merge']({},_0x28c12b,_0x386be1[_0xcb0e('0x42')]);var _0x3e11cc={'where':_0x28c12b['where']};return db[_0xcb0e('0x2d')][_0xcb0e('0x1f')](_0x3e11cc)['then'](function(_0x430562){_0xade4ea[_0xcb0e('0x1f')]=_0x430562;if(_0x386be1[_0xcb0e('0x33')][_0xcb0e('0x43')]){_0x28c12b[_0xcb0e('0x44')]=[{'all':!![]}];}return db[_0xcb0e('0x2d')][_0xcb0e('0x45')](_0x28c12b);})[_0xcb0e('0x25')](function(_0x5c52fe){_0xade4ea[_0xcb0e('0x46')]=_0x5c52fe;return _0xade4ea;})['then'](respondWithFilteredResult(_0x30ee0a,_0x28c12b))['catch'](handleError(_0x30ee0a,null));};exports[_0xcb0e('0x47')]=function(_0x236caa,_0x3c3217){var _0x3e6b8d={'raw':!![],'where':{'id':_0x236caa['params']['id']}},_0xc61ab0={};_0xc61ab0[_0xcb0e('0x32')]=_['keys'](db[_0xcb0e('0x2d')][_0xcb0e('0x2e')]);_0xc61ab0['query']=_[_0xcb0e('0x34')](_0x236caa[_0xcb0e('0x33')]);_0xc61ab0['filters']=_[_0xcb0e('0x36')](_0xc61ab0[_0xcb0e('0x32')],_0xc61ab0[_0xcb0e('0x33')]);_0x3e6b8d[_0xcb0e('0x37')]=_['intersection'](_0xc61ab0['model'],qs['fields'](_0x236caa['query'][_0xcb0e('0x38')]));_0x3e6b8d[_0xcb0e('0x37')]=_0x3e6b8d['attributes'][_0xcb0e('0x39')]?_0x3e6b8d[_0xcb0e('0x37')]:_0xc61ab0[_0xcb0e('0x32')];if(_0x236caa[_0xcb0e('0x33')]['includeAll']){_0x3e6b8d[_0xcb0e('0x44')]=[{'all':!![]}];}_0x3e6b8d=_[_0xcb0e('0x48')]({},_0x3e6b8d,_0x236caa[_0xcb0e('0x42')]);return db['AnalyticExtractedReport'][_0xcb0e('0x49')](_0x3e6b8d)[_0xcb0e('0x25')](handleEntityNotFound(_0x3c3217,null))[_0xcb0e('0x25')](respondWithResult(_0x3c3217,null))[_0xcb0e('0x4a')](handleError(_0x3c3217,null));};exports[_0xcb0e('0x4b')]=function(_0x53251a,_0x26009f){return db['AnalyticExtractedReport'][_0xcb0e('0x4b')](_0x53251a['body'],{})['then'](function(_0x577207){var _0x12c15b=_0x53251a['user'][_0xcb0e('0x26')]({'plain':!![]});if(!_0x12c15b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x12c15b['role']==='user'){var _0x5ea820=_0x577207[_0xcb0e('0x26')]({'plain':!![]});var _0xf5d5b1=_0xcb0e('0x27');return db[_0xcb0e('0x4c')][_0xcb0e('0x49')]({'where':{'name':_0xf5d5b1,'userProfileId':_0x12c15b[_0xcb0e('0x4d')]},'raw':!![]})[_0xcb0e('0x25')](function(_0x1e6c27){if(_0x1e6c27&&_0x1e6c27[_0xcb0e('0x4e')]===0x0){return db[_0xcb0e('0x4f')]['create']({'name':_0x5ea820[_0xcb0e('0x41')],'resourceId':_0x5ea820['id'],'type':_0x1e6c27[_0xcb0e('0x41')],'sectionId':_0x1e6c27['id']},{})['then'](function(){return _0x577207;});}else{return _0x577207;}})[_0xcb0e('0x4a')](function(_0x36b6aa){logger[_0xcb0e('0x50')](_0xcb0e('0x51'),_0x36b6aa);throw _0x36b6aa;});}return _0x577207;})[_0xcb0e('0x25')](respondWithResult(_0x26009f,0xc9))[_0xcb0e('0x4a')](handleError(_0x26009f,null));};exports['update']=function(_0x4216a9,_0x5c1666){if(_0x4216a9['body']['id']){delete _0x4216a9['body']['id'];}return db[_0xcb0e('0x2d')][_0xcb0e('0x49')]({'where':{'id':_0x4216a9[_0xcb0e('0x52')]['id']}})[_0xcb0e('0x25')](handleEntityNotFound(_0x5c1666,null))[_0xcb0e('0x25')](saveUpdates(_0x4216a9[_0xcb0e('0x53')],null))[_0xcb0e('0x25')](respondWithResult(_0x5c1666,null))[_0xcb0e('0x4a')](handleError(_0x5c1666,null));};exports[_0xcb0e('0x28')]=function(_0x530769,_0x1093fd){return db[_0xcb0e('0x2d')][_0xcb0e('0x49')]({'where':{'id':_0x530769['params']['id']}})['then'](handleEntityNotFound(_0x1093fd,null))[_0xcb0e('0x25')](removeEntity(_0x1093fd,null))[_0xcb0e('0x4a')](handleError(_0x1093fd,null));};exports['download']=function(_0x4c4826,_0x3fab84,_0x5cdbe6){return db[_0xcb0e('0x2d')][_0xcb0e('0x49')]({'where':{'id':_0x4c4826['params']['id']},'attributes':['name',_0xcb0e('0x54'),'savename',_0xcb0e('0x55')],'raw':!![]})[_0xcb0e('0x25')](handleEntityNotFound(_0x3fab84,null))[_0xcb0e('0x25')](function(_0x422c26){if(_0x422c26){if(!fs[_0xcb0e('0x56')](path[_0xcb0e('0x57')](config[_0xcb0e('0x58')],_0xcb0e('0x59'),_0x422c26[_0xcb0e('0x5a')]))){throw new db[(_0xcb0e('0x5b'))][(_0xcb0e('0x5c'))](_0xcb0e('0x5d'));}if(_0x4c4826['query'][_0xcb0e('0x5e')]){return _0x3fab84['sendStatus'](0xc8);}return _0x3fab84[_0xcb0e('0x5f')](path['join'](config[_0xcb0e('0x58')],_0xcb0e('0x59'),_0x422c26[_0xcb0e('0x5a')]),util['format'](_0xcb0e('0x60'),_0x422c26[_0xcb0e('0x54')]||_0x422c26[_0xcb0e('0x41')],_0x422c26[_0xcb0e('0x55')][_0xcb0e('0x61')]()));}})[_0xcb0e('0x4a')](handleError(_0x3fab84,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 54ec6ca..1c21012 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 _0x212a=['request-promise','path','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger','api','moment','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x212a,0xb1));var _0xa212=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x212a[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0xa212('0x0'));var logger=require(_0xa212('0x1'))(_0xa212('0x2'));var moment=require(_0xa212('0x3'));var BPromise=require(_0xa212('0x4'));var rp=require(_0xa212('0x5'));var fs=require('fs');var path=require(_0xa212('0x6'));var rimraf=require('rimraf');var config=require(_0xa212('0x7'));var attributes=require(_0xa212('0x8'));module[_0xa212('0x9')]=function(_0x5952c6,_0x4bd524){return _0x5952c6[_0xa212('0xa')](_0xa212('0xb'),attributes,{'tableName':_0xa212('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf727=['define','analytics_extracted_reports','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./analyticExtractedReport.attributes','exports'];(function(_0x8116e5,_0x256790){var _0x11d114=function(_0x4e73dd){while(--_0x4e73dd){_0x8116e5['push'](_0x8116e5['shift']());}};_0x11d114(++_0x256790);}(_0xf727,0x1ee));var _0x7f72=function(_0x21856a,_0x206eff){_0x21856a=_0x21856a-0x0;var _0x424cf5=_0xf727[_0x21856a];return _0x424cf5;};'use strict';var _=require(_0x7f72('0x0'));var util=require(_0x7f72('0x1'));var logger=require(_0x7f72('0x2'))(_0x7f72('0x3'));var moment=require('moment');var BPromise=require(_0x7f72('0x4'));var rp=require(_0x7f72('0x5'));var fs=require('fs');var path=require(_0x7f72('0x6'));var rimraf=require('rimraf');var config=require(_0x7f72('0x7'));var attributes=require(_0x7f72('0x8'));module[_0x7f72('0x9')]=function(_0x173620,_0x32ee17){return _0x173620[_0x7f72('0xa')]('AnalyticExtractedReport',attributes,{'tableName':_0x7f72('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index d3abbd0..d110c84 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 _0x1241=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x21ff65,_0x2d7a83){var _0x3dd562=function(_0x8cafa1){while(--_0x8cafa1){_0x21ff65['push'](_0x21ff65['shift']());}};_0x3dd562(++_0x2d7a83);}(_0x1241,0x155));var _0x1124=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1241[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1124('0x0'));var util=require(_0x1124('0x1'));var moment=require(_0x1124('0x2'));var BPromise=require(_0x1124('0x3'));var rs=require(_0x1124('0x4'));var fs=require('fs');var Redis=require(_0x1124('0x5'));var db=require(_0x1124('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1124('0x7'))(_0x1124('0x8'));var config=require(_0x1124('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1124('0xa')][_0x1124('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x214742,_0x58128a,_0x243606){return new BPromise(function(_0x5ca885,_0xcc972f){return client['request'](_0x214742,_0x243606)[_0x1124('0xc')](function(_0xb04f55){logger[_0x1124('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x58128a,'request\x20sent');logger['debug'](_0x1124('0xe'),_0x58128a,_0x1124('0xf'),JSON[_0x1124('0x10')](_0xb04f55));if(_0xb04f55['error']){if(_0xb04f55[_0x1124('0x11')][_0x1124('0x12')]===0x1f4){logger[_0x1124('0x11')](_0x1124('0x13'),_0x58128a,_0xb04f55['error']['message']);return _0xcc972f(_0xb04f55[_0x1124('0x11')][_0x1124('0x14')]);}logger[_0x1124('0x11')](_0x1124('0x13'),_0x58128a,_0xb04f55[_0x1124('0x11')][_0x1124('0x14')]);return _0x5ca885(_0xb04f55[_0x1124('0x11')]['message']);}else{logger[_0x1124('0xd')](_0x1124('0x13'),_0x58128a,_0x1124('0xf'));_0x5ca885(_0xb04f55[_0x1124('0x15')][_0x1124('0x14')]);}})[_0x1124('0x16')](function(_0x51cabc){logger[_0x1124('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x58128a,_0x51cabc);_0xcc972f(_0x51cabc);});});} \ No newline at end of file +var _0x5a9c=['stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s'];(function(_0x129832,_0x662f06){var _0x4d9121=function(_0x401a41){while(--_0x401a41){_0x129832['push'](_0x129832['shift']());}};_0x4d9121(++_0x662f06);}(_0x5a9c,0xcb));var _0xc5a9=function(_0x31e702,_0x28efe2){_0x31e702=_0x31e702-0x0;var _0x518cf5=_0x5a9c[_0x31e702];return _0x518cf5;};'use strict';var _=require('lodash');var util=require(_0xc5a9('0x0'));var moment=require(_0xc5a9('0x1'));var BPromise=require(_0xc5a9('0x2'));var rs=require(_0xc5a9('0x3'));var fs=require('fs');var Redis=require(_0xc5a9('0x4'));var db=require(_0xc5a9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc5a9('0x6'))(_0xc5a9('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc5a9('0x8')][_0xc5a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e8073,_0x1457da,_0x392686){return new BPromise(function(_0x1f6010,_0x4b9531){return client[_0xc5a9('0xa')](_0x3e8073,_0x392686)[_0xc5a9('0xb')](function(_0x4fa73b){logger[_0xc5a9('0xc')](_0xc5a9('0xd'),_0x1457da,_0xc5a9('0xe'));logger[_0xc5a9('0xf')](_0xc5a9('0x10'),_0x1457da,_0xc5a9('0xe'),JSON[_0xc5a9('0x11')](_0x4fa73b));if(_0x4fa73b[_0xc5a9('0x12')]){if(_0x4fa73b[_0xc5a9('0x12')][_0xc5a9('0x13')]===0x1f4){logger[_0xc5a9('0x12')](_0xc5a9('0xd'),_0x1457da,_0x4fa73b[_0xc5a9('0x12')][_0xc5a9('0x14')]);return _0x4b9531(_0x4fa73b[_0xc5a9('0x12')][_0xc5a9('0x14')]);}logger['error'](_0xc5a9('0xd'),_0x1457da,_0x4fa73b[_0xc5a9('0x12')][_0xc5a9('0x14')]);return _0x1f6010(_0x4fa73b[_0xc5a9('0x12')][_0xc5a9('0x14')]);}else{logger[_0xc5a9('0xc')](_0xc5a9('0xd'),_0x1457da,'request\x20sent');_0x1f6010(_0x4fa73b[_0xc5a9('0x15')]['message']);}})['catch'](function(_0x1e106a){logger['error'](_0xc5a9('0xd'),_0x1457da,_0x1e106a);_0x4b9531(_0x1e106a);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index f855a0e..a39bd5c 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 _0x165a=['update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','put'];(function(_0x4bfa67,_0x5b4371){var _0x388f57=function(_0x1cbf1a){while(--_0x1cbf1a){_0x4bfa67['push'](_0x4bfa67['shift']());}};_0x388f57(++_0x5b4371);}(_0x165a,0x135));var _0xa165=function(_0x276988,_0x183c5c){_0x276988=_0x276988-0x0;var _0x2e22be=_0x165a[_0x276988];return _0x2e22be;};'use strict';var multer=require(_0xa165('0x0'));var util=require(_0xa165('0x1'));var path=require('path');var timeout=require(_0xa165('0x2'));var express=require(_0xa165('0x3'));var router=express[_0xa165('0x4')]();var fs_extra=require(_0xa165('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa165('0x6'));var controller=require('./analyticExtractedReport.controller');router[_0xa165('0x7')]('/',auth[_0xa165('0x8')](),controller[_0xa165('0x9')]);router[_0xa165('0x7')](_0xa165('0xa'),auth[_0xa165('0x8')](),controller[_0xa165('0xb')]);router[_0xa165('0x7')](_0xa165('0xc'),auth[_0xa165('0x8')](),controller[_0xa165('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xa165('0xe')](_0xa165('0xa'),auth[_0xa165('0x8')](),controller[_0xa165('0xf')]);router['delete'](_0xa165('0xa'),auth[_0xa165('0x8')](),controller[_0xa165('0x10')]);module[_0xa165('0x11')]=router; \ No newline at end of file +var _0x92c4=['multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','exports'];(function(_0x4dbc9f,_0x2b1e24){var _0x25b232=function(_0x32ca65){while(--_0x32ca65){_0x4dbc9f['push'](_0x4dbc9f['shift']());}};_0x25b232(++_0x2b1e24);}(_0x92c4,0x1f4));var _0x492c=function(_0x1025c2,_0x26b5db){_0x1025c2=_0x1025c2-0x0;var _0x25e5c2=_0x92c4[_0x1025c2];return _0x25e5c2;};'use strict';var multer=require(_0x492c('0x0'));var util=require(_0x492c('0x1'));var path=require('path');var timeout=require(_0x492c('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x492c('0x3'));var auth=require(_0x492c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x492c('0x5'));var controller=require(_0x492c('0x6'));router[_0x492c('0x7')]('/',auth[_0x492c('0x8')](),controller['index']);router['get'](_0x492c('0x9'),auth[_0x492c('0x8')](),controller[_0x492c('0xa')]);router[_0x492c('0x7')](_0x492c('0xb'),auth[_0x492c('0x8')](),controller[_0x492c('0xc')]);router[_0x492c('0xd')]('/',auth[_0x492c('0x8')](),controller[_0x492c('0xe')]);router[_0x492c('0xf')]('/:id',auth[_0x492c('0x8')](),controller[_0x492c('0x10')]);router[_0x492c('0x11')](_0x492c('0x9'),auth[_0x492c('0x8')](),controller[_0x492c('0x12')]);module[_0x492c('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index e082564..ee763b3 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 _0x48a9=['BOOLEAN','sequelize','TEXT','STRING'];(function(_0x5cf0ac,_0x2c452d){var _0x58856a=function(_0x33712d){while(--_0x33712d){_0x5cf0ac['push'](_0x5cf0ac['shift']());}};_0x58856a(++_0x2c452d);}(_0x48a9,0x1e9));var _0x948a=function(_0x328534,_0x33b41e){_0x328534=_0x328534-0x0;var _0x2796c0=_0x48a9[_0x328534];return _0x2796c0;};'use strict';var Sequelize=require(_0x948a('0x0'));module['exports']={'field':{'type':Sequelize[_0x948a('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x948a('0x2')]},'custom':{'type':Sequelize[_0x948a('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x3ccc=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x3fc426,_0x410d83){var _0xd7830e=function(_0x291e0f){while(--_0x291e0f){_0x3fc426['push'](_0x3fc426['shift']());}};_0xd7830e(++_0x410d83);}(_0x3ccc,0x6d));var _0xc3cc=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x3ccc[_0x409353];return _0x4f4b59;};'use strict';var Sequelize=require(_0xc3cc('0x0'));module[_0xc3cc('0x1')]={'field':{'type':Sequelize[_0xc3cc('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xc3cc('0x3')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0xc3cc('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0xc3cc('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 c9a289b..276b0cc 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 _0x737c=['fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','apply','reject','save','update','then','error','stack','name','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','AnalyticFieldReport','include','findAll','rows','catch','params','includeAll','find','create','body','bulkCreate','destroy','AnalyticCustomReport','findOne','sequelize','transaction','eml-format'];(function(_0x421446,_0x19af26){var _0x40e2a6=function(_0x254616){while(--_0x254616){_0x421446['push'](_0x421446['shift']());}};_0x40e2a6(++_0x19af26);}(_0x737c,0x1d3));var _0xc737=function(_0x205e5b,_0x3d9293){_0x205e5b=_0x205e5b-0x0;var _0x2e60db=_0x737c[_0x205e5b];return _0x2e60db;};'use strict';var emlformat=require(_0xc737('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc737('0x1'));var rp=require('request-promise');var moment=require(_0xc737('0x2'));var BPromise=require(_0xc737('0x3'));var Mustache=require(_0xc737('0x4'));var util=require(_0xc737('0x5'));var path=require(_0xc737('0x6'));var sox=require(_0xc737('0x7'));var csv=require(_0xc737('0x8'));var ejs=require(_0xc737('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc737('0xa'));var squel=require(_0xc737('0xb'));var crypto=require(_0xc737('0xc'));var jsforce=require(_0xc737('0xd'));var deskjs=require(_0xc737('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc737('0xf'));var Papa=require(_0xc737('0x10'));var Redis=require(_0xc737('0x11'));var authService=require(_0xc737('0x12'));var qs=require(_0xc737('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc737('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xc737('0x15'));var config=require(_0xc737('0x16'));var licenseUtil=require(_0xc737('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45eca6,_0x377c4a){_0x377c4a=_0x377c4a||0xcc;return function(_0x37666e){if(_0x37666e){return _0x45eca6[_0xc737('0x18')](_0x377c4a);}return _0x45eca6[_0xc737('0x19')](_0x377c4a)[_0xc737('0x1a')]();};}function respondWithResult(_0x495fc3,_0x46262f){_0x46262f=_0x46262f||0xc8;return function(_0x5d07ff){if(_0x5d07ff){return _0x495fc3[_0xc737('0x19')](_0x46262f)['json'](_0x5d07ff);}};}function respondWithFilteredResult(_0xc8acd6,_0x41a0e1){return function(_0x492196){if(_0x492196){var _0x28ded1=typeof _0x41a0e1[_0xc737('0x1b')]===_0xc737('0x1c')&&typeof _0x41a0e1['limit']===_0xc737('0x1c');var _0x3222f0=_0x492196[_0xc737('0x1d')];var _0x7a6313=_0x28ded1?0x0:_0x41a0e1[_0xc737('0x1b')];var _0x13576f=_0x28ded1?_0x492196[_0xc737('0x1d')]:_0x41a0e1['offset']+_0x41a0e1[_0xc737('0x1e')];var _0x5f416f;if(_0x13576f>=_0x3222f0){_0x13576f=_0x3222f0;_0x5f416f=0xc8;}else{_0x5f416f=0xce;}_0xc8acd6[_0xc737('0x19')](_0x5f416f);return _0xc8acd6['set']('Content-Range',_0x7a6313+'-'+_0x13576f+'/'+_0x3222f0)['json'](_0x492196);}return null;};}function patchUpdates(_0x136a30){return function(_0xd4ddc9){try{jsonpatch[_0xc737('0x1f')](_0xd4ddc9,_0x136a30,!![]);}catch(_0x1b064e){return BPromise[_0xc737('0x20')](_0x1b064e);}return _0xd4ddc9[_0xc737('0x21')]();};}function saveUpdates(_0x840956,_0x4a7332){return function(_0xfd576d){if(_0xfd576d){return _0xfd576d[_0xc737('0x22')](_0x840956)[_0xc737('0x23')](function(_0x12741d){return _0x12741d;});}return null;};}function removeEntity(_0x1d7aed,_0x5badc2){return function(_0x3380d6){if(_0x3380d6){return _0x3380d6['destroy']()['then'](function(){_0x1d7aed[_0xc737('0x19')](0xcc)[_0xc737('0x1a')]();});}};}function handleEntityNotFound(_0x250ce1,_0x49ec99){return function(_0x14389d){if(!_0x14389d){_0x250ce1[_0xc737('0x18')](0x194);}return _0x14389d;};}function handleError(_0x55018c,_0x51cba2){_0x51cba2=_0x51cba2||0x1f4;return function(_0x47280e){logger[_0xc737('0x24')](_0x47280e[_0xc737('0x25')]);if(_0x47280e['name']){delete _0x47280e[_0xc737('0x26')];}_0x55018c[_0xc737('0x19')](_0x51cba2)['send'](_0x47280e);};}exports[_0xc737('0x27')]=function(_0x43c672,_0x28e7f6){var _0xa230c9={},_0x311338={},_0x1ee974={'count':0x0,'rows':[]};var _0x3840ed=_['map'](db['AnalyticFieldReport'][_0xc737('0x28')],function(_0x415aac){return{'name':_0x415aac[_0xc737('0x29')],'type':_0x415aac[_0xc737('0x2a')][_0xc737('0x2b')]};});_0x311338[_0xc737('0x2c')]=_['map'](_0x3840ed,_0xc737('0x26'));_0x311338[_0xc737('0x2d')]=_[_0xc737('0x2e')](_0x43c672[_0xc737('0x2d')]);_0x311338[_0xc737('0x2f')]=_[_0xc737('0x30')](_0x311338[_0xc737('0x2c')],_0x311338[_0xc737('0x2d')]);_0xa230c9[_0xc737('0x31')]=_[_0xc737('0x30')](_0x311338[_0xc737('0x2c')],qs[_0xc737('0x32')](_0x43c672[_0xc737('0x2d')]['fields']));_0xa230c9['attributes']=_0xa230c9[_0xc737('0x31')][_0xc737('0x33')]?_0xa230c9['attributes']:_0x311338[_0xc737('0x2c')];if(!_0x43c672[_0xc737('0x2d')]['hasOwnProperty'](_0xc737('0x34'))){_0xa230c9[_0xc737('0x1e')]=qs[_0xc737('0x1e')](_0x43c672[_0xc737('0x2d')][_0xc737('0x1e')]);_0xa230c9[_0xc737('0x1b')]=qs[_0xc737('0x1b')](_0x43c672['query'][_0xc737('0x1b')]);}_0xa230c9[_0xc737('0x35')]=qs[_0xc737('0x36')](_0x43c672[_0xc737('0x2d')][_0xc737('0x36')]);_0xa230c9[_0xc737('0x37')]=qs[_0xc737('0x2f')](_[_0xc737('0x38')](_0x43c672['query'],_0x311338[_0xc737('0x2f')]),_0x3840ed);if(_0x43c672[_0xc737('0x2d')][_0xc737('0x39')]){_0xa230c9[_0xc737('0x37')]=_[_0xc737('0x3a')](_0xa230c9[_0xc737('0x37')],{'$or':_[_0xc737('0x3b')](_0x3840ed,function(_0x2fa877){if(_0x2fa877['type']!==_0xc737('0x3c')){var _0x5cf2b3={};_0x5cf2b3[_0x2fa877[_0xc737('0x26')]]={'$like':'%'+_0x43c672[_0xc737('0x2d')][_0xc737('0x39')]+'%'};return _0x5cf2b3;}})});}_0xa230c9=_[_0xc737('0x3a')]({},_0xa230c9,_0x43c672[_0xc737('0x3d')]);var _0x7cbd9f={'where':_0xa230c9['where']};return db[_0xc737('0x3e')][_0xc737('0x1d')](_0x7cbd9f)['then'](function(_0x6b8f97){_0x1ee974[_0xc737('0x1d')]=_0x6b8f97;if(_0x43c672['query']['includeAll']){_0xa230c9[_0xc737('0x3f')]=[{'all':!![]}];}return db[_0xc737('0x3e')][_0xc737('0x40')](_0xa230c9);})['then'](function(_0x2c7e9b){_0x1ee974[_0xc737('0x41')]=_0x2c7e9b;return _0x1ee974;})[_0xc737('0x23')](respondWithFilteredResult(_0x28e7f6,_0xa230c9))[_0xc737('0x42')](handleError(_0x28e7f6,null));};exports['show']=function(_0x2e3741,_0x204865){var _0xafd5d4={'raw':![],'where':{'id':_0x2e3741[_0xc737('0x43')]['id']}},_0x53c4d0={};_0x53c4d0[_0xc737('0x2c')]=_[_0xc737('0x2e')](db['AnalyticFieldReport']['rawAttributes']);_0x53c4d0[_0xc737('0x2d')]=_['keys'](_0x2e3741[_0xc737('0x2d')]);_0x53c4d0['filters']=_[_0xc737('0x30')](_0x53c4d0[_0xc737('0x2c')],_0x53c4d0['query']);_0xafd5d4[_0xc737('0x31')]=_[_0xc737('0x30')](_0x53c4d0[_0xc737('0x2c')],qs['fields'](_0x2e3741[_0xc737('0x2d')][_0xc737('0x32')]));_0xafd5d4[_0xc737('0x31')]=_0xafd5d4[_0xc737('0x31')][_0xc737('0x33')]?_0xafd5d4[_0xc737('0x31')]:_0x53c4d0[_0xc737('0x2c')];if(_0x2e3741[_0xc737('0x2d')][_0xc737('0x44')]){_0xafd5d4[_0xc737('0x3f')]=[{'all':!![]}];}_0xafd5d4=_[_0xc737('0x3a')]({},_0xafd5d4,_0x2e3741[_0xc737('0x3d')]);return db['AnalyticFieldReport'][_0xc737('0x45')](_0xafd5d4)[_0xc737('0x23')](handleEntityNotFound(_0x204865,null))[_0xc737('0x23')](respondWithResult(_0x204865,null))[_0xc737('0x42')](handleError(_0x204865,null));};exports[_0xc737('0x46')]=function(_0x15600c,_0x178351){return db[_0xc737('0x3e')][_0xc737('0x46')](_0x15600c[_0xc737('0x47')],{})[_0xc737('0x23')](respondWithResult(_0x178351,0xc9))['catch'](handleError(_0x178351,null));};exports[_0xc737('0x48')]=function(_0x6ff134,_0x1ea678){return db['AnalyticFieldReport'][_0xc737('0x48')](_0x6ff134[_0xc737('0x47')],{'raw':![],'individualHooks':!![]})[_0xc737('0x23')](respondWithResult(_0x1ea678,0xc9))[_0xc737('0x42')](handleError(_0x1ea678,null));};exports['update']=function(_0x4d0460,_0x3f184e){if(_0x4d0460['body']['id']){delete _0x4d0460[_0xc737('0x47')]['id'];}return db[_0xc737('0x3e')][_0xc737('0x45')]({'where':{'id':_0x4d0460[_0xc737('0x43')]['id']}})[_0xc737('0x23')](handleEntityNotFound(_0x3f184e,null))[_0xc737('0x23')](saveUpdates(_0x4d0460[_0xc737('0x47')],null))[_0xc737('0x23')](respondWithResult(_0x3f184e,null))[_0xc737('0x42')](handleError(_0x3f184e,null));};exports[_0xc737('0x49')]=function(_0x20d585,_0x36f401){return db['AnalyticFieldReport'][_0xc737('0x45')]({'where':{'id':_0x20d585[_0xc737('0x43')]['id']}})[_0xc737('0x23')](handleEntityNotFound(_0x36f401,null))[_0xc737('0x23')](removeEntity(_0x36f401,null))[_0xc737('0x42')](handleError(_0x36f401,null));};exports['bulkDestroy']=function(_0x1a82b6,_0x2f5df2){return db[_0xc737('0x3e')][_0xc737('0x49')]({'where':{'id':_0x1a82b6[_0xc737('0x2d')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0xc737('0x23')](respondWithResult(_0x2f5df2,0xcc))[_0xc737('0x42')](handleError(_0x2f5df2,null));};exports['addFields']=function(_0x1a67d9,_0x4e7c0d,_0x34764d){return db[_0xc737('0x4a')][_0xc737('0x4b')]({'where':{'id':_0x1a67d9[_0xc737('0x43')]['id']}})[_0xc737('0x23')](handleEntityNotFound(_0x4e7c0d,null))[_0xc737('0x23')](function(_0x37d284){if(_0x37d284){return db[_0xc737('0x4c')][_0xc737('0x4d')](function(_0x1acb7e){return db['AnalyticFieldReport'][_0xc737('0x49')]({'where':{'CustomReportId':_0x1a67d9[_0xc737('0x43')]['id']},'transaction':_0x1acb7e})['then'](function(_0x4ebe08){var _0x118490=_[_0xc737('0x3b')](_0x1a67d9['body'],function(_0x325461){delete _0x325461['id'];_0x325461['CustomReportId']=_0x1a67d9['params']['id'];return _0x325461;});return db[_0xc737('0x3e')][_0xc737('0x48')](_0x118490,{'transaction':_0x1acb7e});});})[_0xc737('0x23')](function(){return db[_0xc737('0x3e')][_0xc737('0x40')]({'where':{'CustomReportId':_0x1a67d9[_0xc737('0x43')]['id']}});});}})['then'](respondWithResult(_0x4e7c0d,null))['catch'](handleError(_0x4e7c0d,null));}; \ No newline at end of file +var _0xd793=['Content-Range','reject','destroy','error','stack','name','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','then','includeAll','include','findAll','rows','show','params','find','catch','create','body','bulkCreate','update','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','fs-extra','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x4f2a1d,_0x3ec975){var _0x334455=function(_0x1e26b1){while(--_0x1e26b1){_0x4f2a1d['push'](_0x4f2a1d['shift']());}};_0x334455(++_0x3ec975);}(_0xd793,0x16c));var _0x3d79=function(_0x373a52,_0xf9ea14){_0x373a52=_0x373a52-0x0;var _0x43b5d6=_0xd793[_0x373a52];return _0x43b5d6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3d79('0x0'));var zipdir=require(_0x3d79('0x1'));var jsonpatch=require(_0x3d79('0x2'));var rp=require(_0x3d79('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3d79('0x4'));var util=require(_0x3d79('0x5'));var path=require(_0x3d79('0x6'));var sox=require(_0x3d79('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3d79('0x8'));var _=require(_0x3d79('0x9'));var squel=require(_0x3d79('0xa'));var crypto=require(_0x3d79('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3d79('0xc'));var querystring=require('querystring');var Papa=require(_0x3d79('0xd'));var Redis=require(_0x3d79('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3d79('0xf'));var as=require(_0x3d79('0x10'));var hardwareService=require(_0x3d79('0x11'));var logger=require(_0x3d79('0x12'))('api');var utils=require(_0x3d79('0x13'));var config=require(_0x3d79('0x14'));var licenseUtil=require(_0x3d79('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x263578,_0x34122f){_0x34122f=_0x34122f||0xcc;return function(_0x1d57d4){if(_0x1d57d4){return _0x263578[_0x3d79('0x16')](_0x34122f);}return _0x263578[_0x3d79('0x17')](_0x34122f)[_0x3d79('0x18')]();};}function respondWithResult(_0x5ecd9d,_0x1f4ea3){_0x1f4ea3=_0x1f4ea3||0xc8;return function(_0x5219c7){if(_0x5219c7){return _0x5ecd9d['status'](_0x1f4ea3)[_0x3d79('0x19')](_0x5219c7);}};}function respondWithFilteredResult(_0x585a6c,_0x2f965d){return function(_0x44e5d7){if(_0x44e5d7){var _0x1de79e=typeof _0x2f965d[_0x3d79('0x1a')]===_0x3d79('0x1b')&&typeof _0x2f965d[_0x3d79('0x1c')]==='undefined';var _0x43a6eb=_0x44e5d7[_0x3d79('0x1d')];var _0x2c3725=_0x1de79e?0x0:_0x2f965d[_0x3d79('0x1a')];var _0x85c722=_0x1de79e?_0x44e5d7['count']:_0x2f965d[_0x3d79('0x1a')]+_0x2f965d['limit'];var _0x5650ae;if(_0x85c722>=_0x43a6eb){_0x85c722=_0x43a6eb;_0x5650ae=0xc8;}else{_0x5650ae=0xce;}_0x585a6c[_0x3d79('0x17')](_0x5650ae);return _0x585a6c[_0x3d79('0x1e')](_0x3d79('0x1f'),_0x2c3725+'-'+_0x85c722+'/'+_0x43a6eb)['json'](_0x44e5d7);}return null;};}function patchUpdates(_0x34e3f4){return function(_0x4d05ce){try{jsonpatch['apply'](_0x4d05ce,_0x34e3f4,!![]);}catch(_0x3f955f){return BPromise[_0x3d79('0x20')](_0x3f955f);}return _0x4d05ce['save']();};}function saveUpdates(_0x28c3c2,_0x5118e8){return function(_0x3cec8c){if(_0x3cec8c){return _0x3cec8c['update'](_0x28c3c2)['then'](function(_0xa37a99){return _0xa37a99;});}return null;};}function removeEntity(_0x38e781,_0x148585){return function(_0x545b1d){if(_0x545b1d){return _0x545b1d[_0x3d79('0x21')]()['then'](function(){_0x38e781[_0x3d79('0x17')](0xcc)[_0x3d79('0x18')]();});}};}function handleEntityNotFound(_0x40f890,_0xa04479){return function(_0x212c9b){if(!_0x212c9b){_0x40f890[_0x3d79('0x16')](0x194);}return _0x212c9b;};}function handleError(_0x289f44,_0x577927){_0x577927=_0x577927||0x1f4;return function(_0x496caa){logger[_0x3d79('0x22')](_0x496caa[_0x3d79('0x23')]);if(_0x496caa[_0x3d79('0x24')]){delete _0x496caa[_0x3d79('0x24')];}_0x289f44[_0x3d79('0x17')](_0x577927)['send'](_0x496caa);};}exports[_0x3d79('0x25')]=function(_0x3d3866,_0x1d1dcc){var _0x4755e2={},_0x301bc9={},_0x89eb55={'count':0x0,'rows':[]};var _0x36d913=_[_0x3d79('0x26')](db[_0x3d79('0x27')][_0x3d79('0x28')],function(_0x26345e){return{'name':_0x26345e[_0x3d79('0x29')],'type':_0x26345e[_0x3d79('0x2a')][_0x3d79('0x2b')]};});_0x301bc9[_0x3d79('0x2c')]=_[_0x3d79('0x26')](_0x36d913,_0x3d79('0x24'));_0x301bc9[_0x3d79('0x2d')]=_[_0x3d79('0x2e')](_0x3d3866['query']);_0x301bc9[_0x3d79('0x2f')]=_['intersection'](_0x301bc9[_0x3d79('0x2c')],_0x301bc9[_0x3d79('0x2d')]);_0x4755e2['attributes']=_[_0x3d79('0x30')](_0x301bc9['model'],qs[_0x3d79('0x31')](_0x3d3866[_0x3d79('0x2d')][_0x3d79('0x31')]));_0x4755e2[_0x3d79('0x32')]=_0x4755e2[_0x3d79('0x32')][_0x3d79('0x33')]?_0x4755e2[_0x3d79('0x32')]:_0x301bc9[_0x3d79('0x2c')];if(!_0x3d3866[_0x3d79('0x2d')][_0x3d79('0x34')](_0x3d79('0x35'))){_0x4755e2[_0x3d79('0x1c')]=qs[_0x3d79('0x1c')](_0x3d3866[_0x3d79('0x2d')][_0x3d79('0x1c')]);_0x4755e2[_0x3d79('0x1a')]=qs[_0x3d79('0x1a')](_0x3d3866[_0x3d79('0x2d')][_0x3d79('0x1a')]);}_0x4755e2['order']=qs[_0x3d79('0x36')](_0x3d3866[_0x3d79('0x2d')][_0x3d79('0x36')]);_0x4755e2['where']=qs[_0x3d79('0x2f')](_[_0x3d79('0x37')](_0x3d3866[_0x3d79('0x2d')],_0x301bc9[_0x3d79('0x2f')]),_0x36d913);if(_0x3d3866['query'][_0x3d79('0x38')]){_0x4755e2['where']=_['merge'](_0x4755e2[_0x3d79('0x39')],{'$or':_['map'](_0x36d913,function(_0x605345){if(_0x605345[_0x3d79('0x2a')]!==_0x3d79('0x3a')){var _0xec76c8={};_0xec76c8[_0x605345[_0x3d79('0x24')]]={'$like':'%'+_0x3d3866[_0x3d79('0x2d')][_0x3d79('0x38')]+'%'};return _0xec76c8;}})});}_0x4755e2=_[_0x3d79('0x3b')]({},_0x4755e2,_0x3d3866['options']);var _0x45fbc5={'where':_0x4755e2[_0x3d79('0x39')]};return db['AnalyticFieldReport'][_0x3d79('0x1d')](_0x45fbc5)[_0x3d79('0x3c')](function(_0x7f8e69){_0x89eb55[_0x3d79('0x1d')]=_0x7f8e69;if(_0x3d3866[_0x3d79('0x2d')][_0x3d79('0x3d')]){_0x4755e2[_0x3d79('0x3e')]=[{'all':!![]}];}return db[_0x3d79('0x27')][_0x3d79('0x3f')](_0x4755e2);})['then'](function(_0x49c8d9){_0x89eb55[_0x3d79('0x40')]=_0x49c8d9;return _0x89eb55;})['then'](respondWithFilteredResult(_0x1d1dcc,_0x4755e2))['catch'](handleError(_0x1d1dcc,null));};exports[_0x3d79('0x41')]=function(_0x1b51c2,_0x5d21a4){var _0x4f329e={'raw':![],'where':{'id':_0x1b51c2[_0x3d79('0x42')]['id']}},_0x3b7129={};_0x3b7129['model']=_[_0x3d79('0x2e')](db[_0x3d79('0x27')]['rawAttributes']);_0x3b7129[_0x3d79('0x2d')]=_['keys'](_0x1b51c2['query']);_0x3b7129[_0x3d79('0x2f')]=_['intersection'](_0x3b7129[_0x3d79('0x2c')],_0x3b7129['query']);_0x4f329e[_0x3d79('0x32')]=_[_0x3d79('0x30')](_0x3b7129[_0x3d79('0x2c')],qs[_0x3d79('0x31')](_0x1b51c2[_0x3d79('0x2d')]['fields']));_0x4f329e[_0x3d79('0x32')]=_0x4f329e[_0x3d79('0x32')][_0x3d79('0x33')]?_0x4f329e[_0x3d79('0x32')]:_0x3b7129[_0x3d79('0x2c')];if(_0x1b51c2[_0x3d79('0x2d')]['includeAll']){_0x4f329e[_0x3d79('0x3e')]=[{'all':!![]}];}_0x4f329e=_[_0x3d79('0x3b')]({},_0x4f329e,_0x1b51c2['options']);return db[_0x3d79('0x27')][_0x3d79('0x43')](_0x4f329e)[_0x3d79('0x3c')](handleEntityNotFound(_0x5d21a4,null))[_0x3d79('0x3c')](respondWithResult(_0x5d21a4,null))[_0x3d79('0x44')](handleError(_0x5d21a4,null));};exports['create']=function(_0xb67cab,_0x5acc5b){return db[_0x3d79('0x27')][_0x3d79('0x45')](_0xb67cab[_0x3d79('0x46')],{})[_0x3d79('0x3c')](respondWithResult(_0x5acc5b,0xc9))[_0x3d79('0x44')](handleError(_0x5acc5b,null));};exports['bulkCreate']=function(_0xaed1bc,_0x5eaa1c){return db[_0x3d79('0x27')][_0x3d79('0x47')](_0xaed1bc[_0x3d79('0x46')],{'raw':![],'individualHooks':!![]})[_0x3d79('0x3c')](respondWithResult(_0x5eaa1c,0xc9))[_0x3d79('0x44')](handleError(_0x5eaa1c,null));};exports[_0x3d79('0x48')]=function(_0x47fb5c,_0x1f505e){if(_0x47fb5c[_0x3d79('0x46')]['id']){delete _0x47fb5c[_0x3d79('0x46')]['id'];}return db[_0x3d79('0x27')][_0x3d79('0x43')]({'where':{'id':_0x47fb5c['params']['id']}})[_0x3d79('0x3c')](handleEntityNotFound(_0x1f505e,null))[_0x3d79('0x3c')](saveUpdates(_0x47fb5c['body'],null))[_0x3d79('0x3c')](respondWithResult(_0x1f505e,null))[_0x3d79('0x44')](handleError(_0x1f505e,null));};exports['destroy']=function(_0x48be4d,_0x6d8b72){return db['AnalyticFieldReport'][_0x3d79('0x43')]({'where':{'id':_0x48be4d['params']['id']}})[_0x3d79('0x3c')](handleEntityNotFound(_0x6d8b72,null))[_0x3d79('0x3c')](removeEntity(_0x6d8b72,null))[_0x3d79('0x44')](handleError(_0x6d8b72,null));};exports['bulkDestroy']=function(_0x5b8763,_0x5cc734){return db[_0x3d79('0x27')][_0x3d79('0x21')]({'where':{'id':_0x5b8763['query']['ids']||[]},'raw':![],'individualHooks':!![]})[_0x3d79('0x3c')](respondWithResult(_0x5cc734,0xcc))[_0x3d79('0x44')](handleError(_0x5cc734,null));};exports[_0x3d79('0x49')]=function(_0x91d688,_0x439ba4,_0x150d72){return db[_0x3d79('0x4a')][_0x3d79('0x4b')]({'where':{'id':_0x91d688[_0x3d79('0x42')]['id']}})[_0x3d79('0x3c')](handleEntityNotFound(_0x439ba4,null))[_0x3d79('0x3c')](function(_0x5f4bd7){if(_0x5f4bd7){return db[_0x3d79('0x4c')][_0x3d79('0x4d')](function(_0x4630af){return db[_0x3d79('0x27')][_0x3d79('0x21')]({'where':{'CustomReportId':_0x91d688[_0x3d79('0x42')]['id']},'transaction':_0x4630af})[_0x3d79('0x3c')](function(_0x29c363){var _0x4d5fd5=_[_0x3d79('0x26')](_0x91d688[_0x3d79('0x46')],function(_0x2a7f4f){delete _0x2a7f4f['id'];_0x2a7f4f[_0x3d79('0x4e')]=_0x91d688['params']['id'];return _0x2a7f4f;});return db['AnalyticFieldReport'][_0x3d79('0x47')](_0x4d5fd5,{'transaction':_0x4630af});});})[_0x3d79('0x3c')](function(){return db[_0x3d79('0x27')]['findAll']({'where':{'CustomReportId':_0x91d688[_0x3d79('0x42')]['id']}});});}})[_0x3d79('0x3c')](respondWithResult(_0x439ba4,null))['catch'](handleError(_0x439ba4,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index b5059bd..bae2a22 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 _0xeaf2=['rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x14f132,_0x4cf31e){var _0x24bf39=function(_0x10ddad){while(--_0x10ddad){_0x14f132['push'](_0x14f132['shift']());}};_0x24bf39(++_0x4cf31e);}(_0xeaf2,0x18f));var _0x2eaf=function(_0x258919,_0x1754e6){_0x258919=_0x258919-0x0;var _0xfbd68b=_0xeaf2[_0x258919];return _0xfbd68b;};'use strict';var _=require(_0x2eaf('0x0'));var util=require(_0x2eaf('0x1'));var logger=require(_0x2eaf('0x2'))(_0x2eaf('0x3'));var moment=require(_0x2eaf('0x4'));var BPromise=require('bluebird');var rp=require(_0x2eaf('0x5'));var fs=require('fs');var path=require(_0x2eaf('0x6'));var rimraf=require(_0x2eaf('0x7'));var config=require(_0x2eaf('0x8'));var attributes=require(_0x2eaf('0x9'));module[_0x2eaf('0xa')]=function(_0x4b4b3b,_0x9924d4){return _0x4b4b3b[_0x2eaf('0xb')](_0x2eaf('0xc'),attributes,{'tableName':_0x2eaf('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5dfa=['util','../../config/logger','api','moment','bluebird','path','rimraf','./analyticFieldReport.attributes','define','AnalyticFieldReport','analytics_report_fields'];(function(_0x2c22ae,_0x58e4bb){var _0x13a751=function(_0x5f88f5){while(--_0x5f88f5){_0x2c22ae['push'](_0x2c22ae['shift']());}};_0x13a751(++_0x58e4bb);}(_0x5dfa,0x1a2));var _0xa5df=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5dfa[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xa5df('0x0'));var logger=require(_0xa5df('0x1'))(_0xa5df('0x2'));var moment=require(_0xa5df('0x3'));var BPromise=require(_0xa5df('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa5df('0x5'));var rimraf=require(_0xa5df('0x6'));var config=require('../../config/environment');var attributes=require(_0xa5df('0x7'));module['exports']=function(_0x5976d6,_0x5c8eae){return _0x5976d6[_0xa5df('0x8')](_0xa5df('0x9'),attributes,{'tableName':_0xa5df('0xa'),'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 531bbca..8e307bd 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 _0x0a34=['error','code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s'];(function(_0xf7124b,_0x139d92){var _0x26f73d=function(_0x3586d0){while(--_0x3586d0){_0xf7124b['push'](_0xf7124b['shift']());}};_0x26f73d(++_0x139d92);}(_0x0a34,0x1bd));var _0x40a3=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x0a34[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require('lodash');var util=require(_0x40a3('0x0'));var moment=require(_0x40a3('0x1'));var BPromise=require('bluebird');var rs=require(_0x40a3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x40a3('0x3'))['db'];var utils=require(_0x40a3('0x4'));var logger=require(_0x40a3('0x5'))(_0x40a3('0x6'));var config=require(_0x40a3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x40a3('0x8')][_0x40a3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19783f,_0x1cefe7,_0x3da194){return new BPromise(function(_0x149880,_0x3ad869){return client[_0x40a3('0xa')](_0x19783f,_0x3da194)[_0x40a3('0xb')](function(_0x278567){logger[_0x40a3('0xc')](_0x40a3('0xd'),_0x1cefe7,_0x40a3('0xe'));logger[_0x40a3('0xf')](_0x40a3('0x10'),_0x1cefe7,_0x40a3('0xe'),JSON['stringify'](_0x278567));if(_0x278567[_0x40a3('0x11')]){if(_0x278567[_0x40a3('0x11')][_0x40a3('0x12')]===0x1f4){logger['error'](_0x40a3('0xd'),_0x1cefe7,_0x278567[_0x40a3('0x11')][_0x40a3('0x13')]);return _0x3ad869(_0x278567[_0x40a3('0x11')][_0x40a3('0x13')]);}logger[_0x40a3('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1cefe7,_0x278567['error'][_0x40a3('0x13')]);return _0x149880(_0x278567[_0x40a3('0x11')]['message']);}else{logger[_0x40a3('0xc')](_0x40a3('0xd'),_0x1cefe7,_0x40a3('0xe'));_0x149880(_0x278567[_0x40a3('0x14')][_0x40a3('0x13')]);}})[_0x40a3('0x15')](function(_0x2f0f38){logger[_0x40a3('0x11')](_0x40a3('0xd'),_0x1cefe7,_0x2f0f38);_0x3ad869(_0x2f0f38);});});} \ No newline at end of file +var _0xf35f=['../../config/logger','rpc','jayson/promise','http','request','info','debug','request\x20sent','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x250393,_0xac6bf5){var _0x408ff3=function(_0x582ec7){while(--_0x582ec7){_0x250393['push'](_0x250393['shift']());}};_0x408ff3(++_0xac6bf5);}(_0xf35f,0x1f3));var _0xff35=function(_0x53d934,_0x346ce2){_0x53d934=_0x53d934-0x0;var _0x190dfc=_0xf35f[_0x53d934];return _0x190dfc;};'use strict';var _=require(_0xff35('0x0'));var util=require(_0xff35('0x1'));var moment=require(_0xff35('0x2'));var BPromise=require('bluebird');var rs=require(_0xff35('0x3'));var fs=require('fs');var Redis=require(_0xff35('0x4'));var db=require(_0xff35('0x5'))['db'];var utils=require(_0xff35('0x6'));var logger=require(_0xff35('0x7'))(_0xff35('0x8'));var config=require('../../config/environment');var jayson=require(_0xff35('0x9'));var client=jayson['client'][_0xff35('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29636d,_0xc3f56b,_0x3224b4){return new BPromise(function(_0x23ba57,_0x128753){return client[_0xff35('0xb')](_0x29636d,_0x3224b4)['then'](function(_0xdd5381){logger[_0xff35('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0xc3f56b,'request\x20sent');logger[_0xff35('0xd')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0xc3f56b,_0xff35('0xe'),JSON[_0xff35('0xf')](_0xdd5381));if(_0xdd5381[_0xff35('0x10')]){if(_0xdd5381['error'][_0xff35('0x11')]===0x1f4){logger[_0xff35('0x10')](_0xff35('0x12'),_0xc3f56b,_0xdd5381[_0xff35('0x10')]['message']);return _0x128753(_0xdd5381[_0xff35('0x10')][_0xff35('0x13')]);}logger[_0xff35('0x10')](_0xff35('0x12'),_0xc3f56b,_0xdd5381[_0xff35('0x10')][_0xff35('0x13')]);return _0x23ba57(_0xdd5381['error'][_0xff35('0x13')]);}else{logger[_0xff35('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0xc3f56b,_0xff35('0xe'));_0x23ba57(_0xdd5381[_0xff35('0x14')][_0xff35('0x13')]);}})[_0xff35('0x15')](function(_0x39b11d){logger['error'](_0xff35('0x12'),_0xc3f56b,_0x39b11d);_0x128753(_0x39b11d);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 6eab910..e24d75a 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(_0x21d360,_0x2a26e2){var _0x4e7e88=function(_0xb5f68){while(--_0xb5f68){_0x21d360['push'](_0x21d360['shift']());}};_0x4e7e88(++_0x2a26e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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(_0x251d58,_0x21bcfd){var _0x2c699e=function(_0x159f95){while(--_0x159f95){_0x251d58['push'](_0x251d58['shift']());}};_0x2c699e(++_0x21bcfd);}(_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'));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 d4f7404..ef92b7c 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 _0x8caf=['STRING','name','TEXT','exports'];(function(_0x312931,_0x22e92b){var _0xdf26e5=function(_0x5be735){while(--_0x5be735){_0x312931['push'](_0x312931['shift']());}};_0xdf26e5(++_0x22e92b);}(_0x8caf,0x1ab));var _0xf8ca=function(_0x574617,_0x42eccc){_0x574617=_0x574617-0x0;var _0x29de90=_0x8caf[_0x574617];return _0x29de90;};'use strict';var Sequelize=require('sequelize');module[_0xf8ca('0x0')]={'name':{'type':Sequelize[_0xf8ca('0x1')],'allowNull':![],'unique':_0xf8ca('0x2')},'table':{'type':Sequelize[_0xf8ca('0x1')]},'metric':{'type':Sequelize[_0xf8ca('0x3')]},'description':{'type':Sequelize[_0xf8ca('0x1')]}}; \ No newline at end of file +var _0xe3d4=['name','TEXT','exports','STRING'];(function(_0x4a3373,_0x76bb7){var _0x526560=function(_0x12fe46){while(--_0x12fe46){_0x4a3373['push'](_0x4a3373['shift']());}};_0x526560(++_0x76bb7);}(_0xe3d4,0xc6));var _0x4e3d=function(_0x55e5b9,_0x1be20e){_0x55e5b9=_0x55e5b9-0x0;var _0x58d1e7=_0xe3d4[_0x55e5b9];return _0x58d1e7;};'use strict';var Sequelize=require('sequelize');module[_0x4e3d('0x0')]={'name':{'type':Sequelize[_0x4e3d('0x1')],'allowNull':![],'unique':_0x4e3d('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x4e3d('0x3')]},'description':{'type':Sequelize[_0x4e3d('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index a12aea6..807fef0 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 _0x4b84=['status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Metrics','UserProfileResource','sendStatus','stack','name','map','AnalyticMetric','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','mustache','util','path','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x1c2ea4,_0x16ac04){var _0x575866=function(_0x47272b){while(--_0x47272b){_0x1c2ea4['push'](_0x1c2ea4['shift']());}};_0x575866(++_0x16ac04);}(_0x4b84,0x1cc));var _0x44b8=function(_0x4394b6,_0x12357f){_0x4394b6=_0x4394b6-0x0;var _0x360244=_0x4b84[_0x4394b6];return _0x360244;};'use strict';var emlformat=require(_0x44b8('0x0'));var rimraf=require(_0x44b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x44b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44b8('0x3'));var util=require(_0x44b8('0x4'));var path=require(_0x44b8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44b8('0x6'));var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x44b8('0x13'))['db'];function respondWithStatusCode(_0x4301a6,_0x4bcc43){_0x4bcc43=_0x4bcc43||0xcc;return function(_0x194230){if(_0x194230){return _0x4301a6['sendStatus'](_0x4bcc43);}return _0x4301a6[_0x44b8('0x14')](_0x4bcc43)[_0x44b8('0x15')]();};}function respondWithResult(_0x4df670,_0x63e8f6){_0x63e8f6=_0x63e8f6||0xc8;return function(_0x4be54c){if(_0x4be54c){return _0x4df670['status'](_0x63e8f6)[_0x44b8('0x16')](_0x4be54c);}};}function respondWithFilteredResult(_0x2af0ad,_0x1722da){return function(_0x41ab46){if(_0x41ab46){var _0x5e52f2=typeof _0x1722da['offset']==='undefined'&&typeof _0x1722da[_0x44b8('0x17')]==='undefined';var _0x28ef36=_0x41ab46[_0x44b8('0x18')];var _0x55e258=_0x5e52f2?0x0:_0x1722da[_0x44b8('0x19')];var _0xe3de8f=_0x5e52f2?_0x41ab46['count']:_0x1722da[_0x44b8('0x19')]+_0x1722da[_0x44b8('0x17')];var _0x4b600f;if(_0xe3de8f>=_0x28ef36){_0xe3de8f=_0x28ef36;_0x4b600f=0xc8;}else{_0x4b600f=0xce;}_0x2af0ad[_0x44b8('0x14')](_0x4b600f);return _0x2af0ad[_0x44b8('0x1a')](_0x44b8('0x1b'),_0x55e258+'-'+_0xe3de8f+'/'+_0x28ef36)[_0x44b8('0x16')](_0x41ab46);}return null;};}function patchUpdates(_0x102ef9){return function(_0x369c09){try{jsonpatch[_0x44b8('0x1c')](_0x369c09,_0x102ef9,!![]);}catch(_0x9b0536){return BPromise[_0x44b8('0x1d')](_0x9b0536);}return _0x369c09[_0x44b8('0x1e')]();};}function saveUpdates(_0x1d642b,_0x14996c){return function(_0x48327e){if(_0x48327e){return _0x48327e[_0x44b8('0x1f')](_0x1d642b)[_0x44b8('0x20')](function(_0x416b34){return _0x416b34;});}return null;};}function removeEntity(_0x1418db,_0x305a5c){return function(_0x51a34a){if(_0x51a34a){return _0x51a34a[_0x44b8('0x21')]()['then'](function(){var _0x41a922=_0x51a34a[_0x44b8('0x22')]({'plain':!![]});var _0x25a0c1=_0x44b8('0x23');return db[_0x44b8('0x24')]['destroy']({'where':{'type':_0x25a0c1,'resourceId':_0x41a922['id']}})[_0x44b8('0x20')](function(){return _0x51a34a;});})['then'](function(){_0x1418db[_0x44b8('0x14')](0xcc)[_0x44b8('0x15')]();});}};}function handleEntityNotFound(_0x549a26,_0x17ac44){return function(_0x470f49){if(!_0x470f49){_0x549a26[_0x44b8('0x25')](0x194);}return _0x470f49;};}function handleError(_0x59c1bf,_0xb22107){_0xb22107=_0xb22107||0x1f4;return function(_0x242342){logger['error'](_0x242342[_0x44b8('0x26')]);if(_0x242342['name']){delete _0x242342[_0x44b8('0x27')];}_0x59c1bf['status'](_0xb22107)['send'](_0x242342);};}exports['index']=function(_0x387293,_0x29b18d){var _0x44ce5a={},_0x1bd1be={},_0x38cd17={'count':0x0,'rows':[]};var _0xc3f667=_[_0x44b8('0x28')](db[_0x44b8('0x29')][_0x44b8('0x2a')],function(_0x28f918){return{'name':_0x28f918[_0x44b8('0x2b')],'type':_0x28f918[_0x44b8('0x2c')][_0x44b8('0x2d')]};});_0x1bd1be['model']=_[_0x44b8('0x28')](_0xc3f667,'name');_0x1bd1be[_0x44b8('0x2e')]=_[_0x44b8('0x2f')](_0x387293[_0x44b8('0x2e')]);_0x1bd1be[_0x44b8('0x30')]=_[_0x44b8('0x31')](_0x1bd1be['model'],_0x1bd1be[_0x44b8('0x2e')]);_0x44ce5a[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x1bd1be[_0x44b8('0x33')],qs[_0x44b8('0x34')](_0x387293['query'][_0x44b8('0x34')]));_0x44ce5a[_0x44b8('0x32')]=_0x44ce5a[_0x44b8('0x32')][_0x44b8('0x35')]?_0x44ce5a[_0x44b8('0x32')]:_0x1bd1be[_0x44b8('0x33')];if(!_0x387293[_0x44b8('0x2e')][_0x44b8('0x36')](_0x44b8('0x37'))){_0x44ce5a[_0x44b8('0x17')]=qs[_0x44b8('0x17')](_0x387293[_0x44b8('0x2e')][_0x44b8('0x17')]);_0x44ce5a[_0x44b8('0x19')]=qs[_0x44b8('0x19')](_0x387293[_0x44b8('0x2e')][_0x44b8('0x19')]);}_0x44ce5a[_0x44b8('0x38')]=qs[_0x44b8('0x39')](_0x387293[_0x44b8('0x2e')][_0x44b8('0x39')]);_0x44ce5a[_0x44b8('0x3a')]=qs['filters'](_[_0x44b8('0x3b')](_0x387293[_0x44b8('0x2e')],_0x1bd1be['filters']),_0xc3f667);if(_0x387293[_0x44b8('0x2e')][_0x44b8('0x3c')]){_0x44ce5a[_0x44b8('0x3a')]=_[_0x44b8('0x3d')](_0x44ce5a['where'],{'$or':_[_0x44b8('0x28')](_0xc3f667,function(_0x11e4e3){if(_0x11e4e3[_0x44b8('0x2c')]!==_0x44b8('0x3e')){var _0x9cb2a={};_0x9cb2a[_0x11e4e3[_0x44b8('0x27')]]={'$like':'%'+_0x387293[_0x44b8('0x2e')][_0x44b8('0x3c')]+'%'};return _0x9cb2a;}})});}_0x44ce5a=_[_0x44b8('0x3d')]({},_0x44ce5a,_0x387293[_0x44b8('0x3f')]);var _0x1c9983={'where':_0x44ce5a[_0x44b8('0x3a')]};return db[_0x44b8('0x29')][_0x44b8('0x18')](_0x1c9983)[_0x44b8('0x20')](function(_0x29b43f){_0x38cd17['count']=_0x29b43f;if(_0x387293[_0x44b8('0x2e')][_0x44b8('0x40')]){_0x44ce5a[_0x44b8('0x41')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x44b8('0x42')](_0x44ce5a);})[_0x44b8('0x20')](function(_0x229cc9){_0x38cd17['rows']=_0x229cc9;return _0x38cd17;})[_0x44b8('0x20')](respondWithFilteredResult(_0x29b18d,_0x44ce5a))[_0x44b8('0x43')](handleError(_0x29b18d,null));};exports[_0x44b8('0x44')]=function(_0x334f86,_0xfd590a){var _0x499a3e={'raw':!![],'where':{'id':_0x334f86[_0x44b8('0x45')]['id']}},_0x5ae5f9={};_0x5ae5f9[_0x44b8('0x33')]=_[_0x44b8('0x2f')](db[_0x44b8('0x29')][_0x44b8('0x2a')]);_0x5ae5f9[_0x44b8('0x2e')]=_[_0x44b8('0x2f')](_0x334f86[_0x44b8('0x2e')]);_0x5ae5f9[_0x44b8('0x30')]=_[_0x44b8('0x31')](_0x5ae5f9[_0x44b8('0x33')],_0x5ae5f9[_0x44b8('0x2e')]);_0x499a3e[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x5ae5f9[_0x44b8('0x33')],qs[_0x44b8('0x34')](_0x334f86[_0x44b8('0x2e')][_0x44b8('0x34')]));_0x499a3e[_0x44b8('0x32')]=_0x499a3e['attributes']['length']?_0x499a3e[_0x44b8('0x32')]:_0x5ae5f9[_0x44b8('0x33')];if(_0x334f86[_0x44b8('0x2e')][_0x44b8('0x40')]){_0x499a3e[_0x44b8('0x41')]=[{'all':!![]}];}_0x499a3e=_[_0x44b8('0x3d')]({},_0x499a3e,_0x334f86[_0x44b8('0x3f')]);return db['AnalyticMetric'][_0x44b8('0x46')](_0x499a3e)['then'](handleEntityNotFound(_0xfd590a,null))[_0x44b8('0x20')](respondWithResult(_0xfd590a,null))[_0x44b8('0x43')](handleError(_0xfd590a,null));};exports[_0x44b8('0x47')]=function(_0x9207bf,_0x103d57){return db[_0x44b8('0x29')]['create'](_0x9207bf[_0x44b8('0x48')],{})[_0x44b8('0x20')](function(_0x10602c){var _0x25d266=_0x9207bf['user'][_0x44b8('0x22')]({'plain':!![]});if(!_0x25d266)throw new Error(_0x44b8('0x49'));if(_0x25d266[_0x44b8('0x4a')]===_0x44b8('0x4b')){var _0x44ec23=_0x10602c[_0x44b8('0x22')]({'plain':!![]});var _0x500bad=_0x44b8('0x23');return db[_0x44b8('0x4c')][_0x44b8('0x46')]({'where':{'name':_0x500bad,'userProfileId':_0x25d266[_0x44b8('0x4d')]},'raw':!![]})[_0x44b8('0x20')](function(_0x57d0e2){if(_0x57d0e2&&_0x57d0e2['autoAssociation']===0x0){return db[_0x44b8('0x24')]['create']({'name':_0x44ec23[_0x44b8('0x27')],'resourceId':_0x44ec23['id'],'type':_0x57d0e2['name'],'sectionId':_0x57d0e2['id']},{})[_0x44b8('0x20')](function(){return _0x10602c;});}else{return _0x10602c;}})[_0x44b8('0x43')](function(_0x1a29f6){logger[_0x44b8('0x4e')](_0x44b8('0x4f'),_0x1a29f6);throw _0x1a29f6;});}return _0x10602c;})[_0x44b8('0x20')](respondWithResult(_0x103d57,0xc9))[_0x44b8('0x43')](handleError(_0x103d57,null));};exports['update']=function(_0x3ad278,_0x37b2c2){if(_0x3ad278[_0x44b8('0x48')]['id']){delete _0x3ad278['body']['id'];}return db[_0x44b8('0x29')][_0x44b8('0x46')]({'where':{'id':_0x3ad278[_0x44b8('0x45')]['id']}})[_0x44b8('0x20')](handleEntityNotFound(_0x37b2c2,null))['then'](saveUpdates(_0x3ad278[_0x44b8('0x48')],null))[_0x44b8('0x20')](respondWithResult(_0x37b2c2,null))['catch'](handleError(_0x37b2c2,null));};exports[_0x44b8('0x21')]=function(_0x19f22b,_0x35136e){return db[_0x44b8('0x29')][_0x44b8('0x46')]({'where':{'id':_0x19f22b['params']['id']}})['then'](handleEntityNotFound(_0x35136e,null))[_0x44b8('0x20')](removeEntity(_0x35136e,null))[_0x44b8('0x43')](handleError(_0x35136e,null));}; \ No newline at end of file +var _0xdbf5=['../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','save','update','then','destroy','get','Metrics','UserProfileResource','end','error','name','send','index','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','VIRTUAL','AnalyticMetric','includeAll','include','findAll','rows','catch','show','keys','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0xc56b79,_0x31ff15){var _0x4c0536=function(_0x19a928){while(--_0x19a928){_0xc56b79['push'](_0xc56b79['shift']());}};_0x4c0536(++_0x31ff15);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x580ce7,_0x1ed061){_0x580ce7=_0x580ce7-0x0;var _0x3957c1=_0xdbf5[_0x580ce7];return _0x3957c1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5dbf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5dbf('0x1'));var moment=require(_0x5dbf('0x2'));var BPromise=require(_0x5dbf('0x3'));var Mustache=require(_0x5dbf('0x4'));var util=require(_0x5dbf('0x5'));var path=require(_0x5dbf('0x6'));var sox=require(_0x5dbf('0x7'));var csv=require(_0x5dbf('0x8'));var ejs=require(_0x5dbf('0x9'));var fs=require('fs');var fs_extra=require(_0x5dbf('0xa'));var _=require(_0x5dbf('0xb'));var squel=require(_0x5dbf('0xc'));var crypto=require(_0x5dbf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5dbf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5dbf('0xf'));var Papa=require(_0x5dbf('0x10'));var Redis=require(_0x5dbf('0x11'));var authService=require(_0x5dbf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5dbf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5dbf('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5dbf('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x182cec,_0x2bb7ed){_0x2bb7ed=_0x2bb7ed||0xcc;return function(_0x1453a9){if(_0x1453a9){return _0x182cec[_0x5dbf('0x16')](_0x2bb7ed);}return _0x182cec[_0x5dbf('0x17')](_0x2bb7ed)['end']();};}function respondWithResult(_0x4803ca,_0x2b4e1c){_0x2b4e1c=_0x2b4e1c||0xc8;return function(_0x3480c8){if(_0x3480c8){return _0x4803ca['status'](_0x2b4e1c)[_0x5dbf('0x18')](_0x3480c8);}};}function respondWithFilteredResult(_0x248e3c,_0x23f763){return function(_0x2dfa44){if(_0x2dfa44){var _0x181816=typeof _0x23f763[_0x5dbf('0x19')]===_0x5dbf('0x1a')&&typeof _0x23f763['limit']==='undefined';var _0x16dc82=_0x2dfa44[_0x5dbf('0x1b')];var _0x39c7aa=_0x181816?0x0:_0x23f763[_0x5dbf('0x19')];var _0x20c2b0=_0x181816?_0x2dfa44['count']:_0x23f763[_0x5dbf('0x19')]+_0x23f763['limit'];var _0x565efa;if(_0x20c2b0>=_0x16dc82){_0x20c2b0=_0x16dc82;_0x565efa=0xc8;}else{_0x565efa=0xce;}_0x248e3c['status'](_0x565efa);return _0x248e3c[_0x5dbf('0x1c')](_0x5dbf('0x1d'),_0x39c7aa+'-'+_0x20c2b0+'/'+_0x16dc82)[_0x5dbf('0x18')](_0x2dfa44);}return null;};}function patchUpdates(_0x2ab57c){return function(_0x1e3cce){try{jsonpatch['apply'](_0x1e3cce,_0x2ab57c,!![]);}catch(_0x2764ea){return BPromise['reject'](_0x2764ea);}return _0x1e3cce[_0x5dbf('0x1e')]();};}function saveUpdates(_0x11cc67,_0x14d133){return function(_0x43a612){if(_0x43a612){return _0x43a612[_0x5dbf('0x1f')](_0x11cc67)[_0x5dbf('0x20')](function(_0x58085e){return _0x58085e;});}return null;};}function removeEntity(_0x4027c3,_0x3e3a2d){return function(_0x2d3e1b){if(_0x2d3e1b){return _0x2d3e1b[_0x5dbf('0x21')]()[_0x5dbf('0x20')](function(){var _0x226b93=_0x2d3e1b[_0x5dbf('0x22')]({'plain':!![]});var _0x20ab1b=_0x5dbf('0x23');return db[_0x5dbf('0x24')][_0x5dbf('0x21')]({'where':{'type':_0x20ab1b,'resourceId':_0x226b93['id']}})[_0x5dbf('0x20')](function(){return _0x2d3e1b;});})[_0x5dbf('0x20')](function(){_0x4027c3[_0x5dbf('0x17')](0xcc)[_0x5dbf('0x25')]();});}};}function handleEntityNotFound(_0x17f135,_0x466985){return function(_0x3f8341){if(!_0x3f8341){_0x17f135[_0x5dbf('0x16')](0x194);}return _0x3f8341;};}function handleError(_0x22ec42,_0x6a9757){_0x6a9757=_0x6a9757||0x1f4;return function(_0x471027){logger[_0x5dbf('0x26')](_0x471027['stack']);if(_0x471027[_0x5dbf('0x27')]){delete _0x471027[_0x5dbf('0x27')];}_0x22ec42[_0x5dbf('0x17')](_0x6a9757)[_0x5dbf('0x28')](_0x471027);};}exports[_0x5dbf('0x29')]=function(_0x6a276d,_0x2a65c5){var _0x31d57a={},_0x406ce6={},_0x273b63={'count':0x0,'rows':[]};var _0x294dd7=_['map'](db['AnalyticMetric'][_0x5dbf('0x2a')],function(_0x19015a){return{'name':_0x19015a[_0x5dbf('0x2b')],'type':_0x19015a[_0x5dbf('0x2c')][_0x5dbf('0x2d')]};});_0x406ce6['model']=_['map'](_0x294dd7,_0x5dbf('0x27'));_0x406ce6[_0x5dbf('0x2e')]=_['keys'](_0x6a276d[_0x5dbf('0x2e')]);_0x406ce6[_0x5dbf('0x2f')]=_[_0x5dbf('0x30')](_0x406ce6[_0x5dbf('0x31')],_0x406ce6[_0x5dbf('0x2e')]);_0x31d57a['attributes']=_[_0x5dbf('0x30')](_0x406ce6[_0x5dbf('0x31')],qs[_0x5dbf('0x32')](_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x32')]));_0x31d57a['attributes']=_0x31d57a[_0x5dbf('0x33')][_0x5dbf('0x34')]?_0x31d57a[_0x5dbf('0x33')]:_0x406ce6[_0x5dbf('0x31')];if(!_0x6a276d['query'][_0x5dbf('0x35')](_0x5dbf('0x36'))){_0x31d57a[_0x5dbf('0x37')]=qs[_0x5dbf('0x37')](_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x37')]);_0x31d57a[_0x5dbf('0x19')]=qs[_0x5dbf('0x19')](_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x19')]);}_0x31d57a[_0x5dbf('0x38')]=qs['sort'](_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x39')]);_0x31d57a[_0x5dbf('0x3a')]=qs['filters'](_[_0x5dbf('0x3b')](_0x6a276d[_0x5dbf('0x2e')],_0x406ce6[_0x5dbf('0x2f')]),_0x294dd7);if(_0x6a276d['query'][_0x5dbf('0x3c')]){_0x31d57a[_0x5dbf('0x3a')]=_[_0x5dbf('0x3d')](_0x31d57a['where'],{'$or':_[_0x5dbf('0x3e')](_0x294dd7,function(_0x29a62d){if(_0x29a62d[_0x5dbf('0x2c')]!==_0x5dbf('0x3f')){var _0x10537d={};_0x10537d[_0x29a62d[_0x5dbf('0x27')]]={'$like':'%'+_0x6a276d[_0x5dbf('0x2e')][_0x5dbf('0x3c')]+'%'};return _0x10537d;}})});}_0x31d57a=_['merge']({},_0x31d57a,_0x6a276d['options']);var _0x57ee72={'where':_0x31d57a['where']};return db[_0x5dbf('0x40')][_0x5dbf('0x1b')](_0x57ee72)['then'](function(_0x3ef0eb){_0x273b63[_0x5dbf('0x1b')]=_0x3ef0eb;if(_0x6a276d['query'][_0x5dbf('0x41')]){_0x31d57a[_0x5dbf('0x42')]=[{'all':!![]}];}return db[_0x5dbf('0x40')][_0x5dbf('0x43')](_0x31d57a);})[_0x5dbf('0x20')](function(_0x7c390d){_0x273b63[_0x5dbf('0x44')]=_0x7c390d;return _0x273b63;})[_0x5dbf('0x20')](respondWithFilteredResult(_0x2a65c5,_0x31d57a))[_0x5dbf('0x45')](handleError(_0x2a65c5,null));};exports[_0x5dbf('0x46')]=function(_0x50ac70,_0x78aef3){var _0x22f958={'raw':!![],'where':{'id':_0x50ac70['params']['id']}},_0xec1d28={};_0xec1d28[_0x5dbf('0x31')]=_[_0x5dbf('0x47')](db[_0x5dbf('0x40')][_0x5dbf('0x2a')]);_0xec1d28['query']=_[_0x5dbf('0x47')](_0x50ac70['query']);_0xec1d28[_0x5dbf('0x2f')]=_[_0x5dbf('0x30')](_0xec1d28[_0x5dbf('0x31')],_0xec1d28[_0x5dbf('0x2e')]);_0x22f958['attributes']=_['intersection'](_0xec1d28[_0x5dbf('0x31')],qs[_0x5dbf('0x32')](_0x50ac70[_0x5dbf('0x2e')]['fields']));_0x22f958[_0x5dbf('0x33')]=_0x22f958['attributes']['length']?_0x22f958['attributes']:_0xec1d28['model'];if(_0x50ac70[_0x5dbf('0x2e')][_0x5dbf('0x41')]){_0x22f958['include']=[{'all':!![]}];}_0x22f958=_[_0x5dbf('0x3d')]({},_0x22f958,_0x50ac70[_0x5dbf('0x48')]);return db['AnalyticMetric'][_0x5dbf('0x49')](_0x22f958)[_0x5dbf('0x20')](handleEntityNotFound(_0x78aef3,null))['then'](respondWithResult(_0x78aef3,null))[_0x5dbf('0x45')](handleError(_0x78aef3,null));};exports['create']=function(_0x5ab862,_0x337897){return db[_0x5dbf('0x40')][_0x5dbf('0x4a')](_0x5ab862['body'],{})['then'](function(_0x442a43){var _0x3e8612=_0x5ab862[_0x5dbf('0x4b')][_0x5dbf('0x22')]({'plain':!![]});if(!_0x3e8612)throw new Error(_0x5dbf('0x4c'));if(_0x3e8612[_0x5dbf('0x4d')]===_0x5dbf('0x4b')){var _0x319906=_0x442a43['get']({'plain':!![]});var _0x3f38a0=_0x5dbf('0x23');return db[_0x5dbf('0x4e')][_0x5dbf('0x49')]({'where':{'name':_0x3f38a0,'userProfileId':_0x3e8612[_0x5dbf('0x4f')]},'raw':!![]})[_0x5dbf('0x20')](function(_0x328dc5){if(_0x328dc5&&_0x328dc5['autoAssociation']===0x0){return db[_0x5dbf('0x24')]['create']({'name':_0x319906[_0x5dbf('0x27')],'resourceId':_0x319906['id'],'type':_0x328dc5[_0x5dbf('0x27')],'sectionId':_0x328dc5['id']},{})[_0x5dbf('0x20')](function(){return _0x442a43;});}else{return _0x442a43;}})[_0x5dbf('0x45')](function(_0x78ab84){logger[_0x5dbf('0x26')](_0x5dbf('0x50'),_0x78ab84);throw _0x78ab84;});}return _0x442a43;})['then'](respondWithResult(_0x337897,0xc9))['catch'](handleError(_0x337897,null));};exports['update']=function(_0x1e1876,_0xfdacc7){if(_0x1e1876[_0x5dbf('0x51')]['id']){delete _0x1e1876['body']['id'];}return db['AnalyticMetric'][_0x5dbf('0x49')]({'where':{'id':_0x1e1876[_0x5dbf('0x52')]['id']}})[_0x5dbf('0x20')](handleEntityNotFound(_0xfdacc7,null))['then'](saveUpdates(_0x1e1876[_0x5dbf('0x51')],null))['then'](respondWithResult(_0xfdacc7,null))[_0x5dbf('0x45')](handleError(_0xfdacc7,null));};exports[_0x5dbf('0x21')]=function(_0x2145ea,_0x5da14b){return db['AnalyticMetric'][_0x5dbf('0x49')]({'where':{'id':_0x2145ea[_0x5dbf('0x52')]['id']}})[_0x5dbf('0x20')](handleEntityNotFound(_0x5da14b,null))[_0x5dbf('0x20')](removeEntity(_0x5da14b,null))['catch'](handleError(_0x5da14b,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index db75942..ddc2170 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 _0x10dc=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','lodash'];(function(_0x52c3b9,_0xcaae22){var _0x486b94=function(_0x12a841){while(--_0x12a841){_0x52c3b9['push'](_0x52c3b9['shift']());}};_0x486b94(++_0xcaae22);}(_0x10dc,0x107));var _0xc10d=function(_0x4c953c,_0x2edbb8){_0x4c953c=_0x4c953c-0x0;var _0xfa0543=_0x10dc[_0x4c953c];return _0xfa0543;};'use strict';var _=require(_0xc10d('0x0'));var util=require(_0xc10d('0x1'));var logger=require('../../config/logger')(_0xc10d('0x2'));var moment=require('moment');var BPromise=require(_0xc10d('0x3'));var rp=require(_0xc10d('0x4'));var fs=require('fs');var path=require(_0xc10d('0x5'));var rimraf=require(_0xc10d('0x6'));var config=require(_0xc10d('0x7'));var attributes=require(_0xc10d('0x8'));module[_0xc10d('0x9')]=function(_0x25e10c,_0x48baac){return _0x25e10c[_0xc10d('0xa')]('AnalyticMetric',attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e65=['api','moment','bluebird','request-promise','path','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2e65,0x193));var _0x52e6=function(_0x2ff238,_0x1811d2){_0x2ff238=_0x2ff238-0x0;var _0x204a56=_0x2e65[_0x2ff238];return _0x204a56;};'use strict';var _=require(_0x52e6('0x0'));var util=require(_0x52e6('0x1'));var logger=require(_0x52e6('0x2'))(_0x52e6('0x3'));var moment=require(_0x52e6('0x4'));var BPromise=require(_0x52e6('0x5'));var rp=require(_0x52e6('0x6'));var fs=require('fs');var path=require(_0x52e6('0x7'));var rimraf=require('rimraf');var config=require(_0x52e6('0x8'));var attributes=require(_0x52e6('0x9'));module[_0x52e6('0xa')]=function(_0xe67caa,_0x1cf6d2){return _0xe67caa[_0x52e6('0xb')](_0x52e6('0xc'),attributes,{'tableName':_0x52e6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 5ac62cc..a0b4064 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 _0x04a0=['code','AnalyticMetric,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5f42f1,_0x956be5){var _0x5534ee=function(_0x532333){while(--_0x532333){_0x5f42f1['push'](_0x5f42f1['shift']());}};_0x5534ee(++_0x956be5);}(_0x04a0,0x125));var _0x004a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x04a0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x004a('0x0'));var util=require(_0x004a('0x1'));var moment=require(_0x004a('0x2'));var BPromise=require(_0x004a('0x3'));var rs=require(_0x004a('0x4'));var fs=require('fs');var Redis=require(_0x004a('0x5'));var db=require(_0x004a('0x6'))['db'];var utils=require(_0x004a('0x7'));var logger=require(_0x004a('0x8'))(_0x004a('0x9'));var config=require('../../config/environment');var jayson=require(_0x004a('0xa'));var client=jayson[_0x004a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4838aa,_0x1b3d16,_0x5688e9){return new BPromise(function(_0x4d253d,_0x281a28){return client[_0x004a('0xc')](_0x4838aa,_0x5688e9)[_0x004a('0xd')](function(_0x5d14a2){logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x1b3d16,_0x004a('0xe'));logger[_0x004a('0xf')](_0x004a('0x10'),_0x1b3d16,'request\x20sent',JSON[_0x004a('0x11')](_0x5d14a2));if(_0x5d14a2['error']){if(_0x5d14a2[_0x004a('0x12')][_0x004a('0x13')]===0x1f4){logger['error'](_0x004a('0x14'),_0x1b3d16,_0x5d14a2[_0x004a('0x12')][_0x004a('0x15')]);return _0x281a28(_0x5d14a2[_0x004a('0x12')][_0x004a('0x15')]);}logger[_0x004a('0x12')](_0x004a('0x14'),_0x1b3d16,_0x5d14a2[_0x004a('0x12')]['message']);return _0x4d253d(_0x5d14a2[_0x004a('0x12')]['message']);}else{logger['info'](_0x004a('0x14'),_0x1b3d16,_0x004a('0xe'));_0x4d253d(_0x5d14a2[_0x004a('0x16')][_0x004a('0x15')]);}})[_0x004a('0x17')](function(_0x3db537){logger[_0x004a('0x12')](_0x004a('0x14'),_0x1b3d16,_0x3db537);_0x281a28(_0x3db537);});});} \ No newline at end of file +var _0xb07a=['../../config/logger','http','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x537a7d,_0x373173){var _0x59c010=function(_0x500c86){while(--_0x500c86){_0x537a7d['push'](_0x537a7d['shift']());}};_0x59c010(++_0x373173);}(_0xb07a,0xad));var _0xab07=function(_0x24d344,_0x4a2291){_0x24d344=_0x24d344-0x0;var _0x341736=_0xb07a[_0x24d344];return _0x341736;};'use strict';var _=require(_0xab07('0x0'));var util=require(_0xab07('0x1'));var moment=require(_0xab07('0x2'));var BPromise=require(_0xab07('0x3'));var rs=require(_0xab07('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab07('0x5'))['db'];var utils=require(_0xab07('0x6'));var logger=require(_0xab07('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xab07('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xcd4850,_0x1a40ce,_0xe0e0e4){return new BPromise(function(_0x1ee4c8,_0x5d324b){return client['request'](_0xcd4850,_0xe0e0e4)['then'](function(_0x1ff2c5){logger['info'](_0xab07('0x9'),_0x1a40ce,_0xab07('0xa'));logger['debug'](_0xab07('0xb'),_0x1a40ce,_0xab07('0xa'),JSON[_0xab07('0xc')](_0x1ff2c5));if(_0x1ff2c5['error']){if(_0x1ff2c5['error'][_0xab07('0xd')]===0x1f4){logger[_0xab07('0xe')](_0xab07('0x9'),_0x1a40ce,_0x1ff2c5['error']['message']);return _0x5d324b(_0x1ff2c5['error'][_0xab07('0xf')]);}logger[_0xab07('0xe')](_0xab07('0x9'),_0x1a40ce,_0x1ff2c5[_0xab07('0xe')][_0xab07('0xf')]);return _0x1ee4c8(_0x1ff2c5['error'][_0xab07('0xf')]);}else{logger[_0xab07('0x10')](_0xab07('0x9'),_0x1a40ce,_0xab07('0xa'));_0x1ee4c8(_0x1ff2c5[_0xab07('0x11')][_0xab07('0xf')]);}})['catch'](function(_0x24c659){logger[_0xab07('0xe')](_0xab07('0x9'),_0x1a40ce,_0x24c659);_0x5d324b(_0x24c659);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index d775d2c..ab4b7bf 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 _0xe49a=['show','post','create','put','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticMetric.controller','get','index','/:id','isAuthenticated'];(function(_0x618644,_0x24242b){var _0x401623=function(_0x58dcce){while(--_0x58dcce){_0x618644['push'](_0x618644['shift']());}};_0x401623(++_0x24242b);}(_0xe49a,0xd7));var _0xae49=function(_0x2db98d,_0x364e98){_0x2db98d=_0x2db98d-0x0;var _0x3c0ffe=_0xe49a[_0x2db98d];return _0x3c0ffe;};'use strict';var multer=require('multer');var util=require(_0xae49('0x0'));var path=require(_0xae49('0x1'));var timeout=require(_0xae49('0x2'));var express=require(_0xae49('0x3'));var router=express[_0xae49('0x4')]();var fs_extra=require(_0xae49('0x5'));var auth=require(_0xae49('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xae49('0x7'));var controller=require(_0xae49('0x8'));router[_0xae49('0x9')]('/',auth['isAuthenticated'](),controller[_0xae49('0xa')]);router['get'](_0xae49('0xb'),auth[_0xae49('0xc')](),controller[_0xae49('0xd')]);router[_0xae49('0xe')]('/',auth[_0xae49('0xc')](),controller[_0xae49('0xf')]);router[_0xae49('0x10')]('/:id',auth[_0xae49('0xc')](),controller['update']);router[_0xae49('0x11')](_0xae49('0xb'),auth[_0xae49('0xc')](),controller['destroy']);module[_0xae49('0x12')]=router; \ No newline at end of file +var _0x102b=['index','get','/:id','post','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','isAuthenticated'];(function(_0x41b1c8,_0x45554b){var _0x36ab29=function(_0x4bf3f0){while(--_0x4bf3f0){_0x41b1c8['push'](_0x41b1c8['shift']());}};_0x36ab29(++_0x45554b);}(_0x102b,0x1be));var _0xb102=function(_0x5920b8,_0x3788ca){_0x5920b8=_0x5920b8-0x0;var _0x30a8f4=_0x102b[_0x5920b8];return _0x30a8f4;};'use strict';var multer=require('multer');var util=require(_0xb102('0x0'));var path=require('path');var timeout=require(_0xb102('0x1'));var express=require(_0xb102('0x2'));var router=express[_0xb102('0x3')]();var fs_extra=require(_0xb102('0x4'));var auth=require(_0xb102('0x5'));var interaction=require(_0xb102('0x6'));var config=require(_0xb102('0x7'));var controller=require(_0xb102('0x8'));router['get']('/',auth[_0xb102('0x9')](),controller[_0xb102('0xa')]);router[_0xb102('0xb')](_0xb102('0xc'),auth[_0xb102('0x9')](),controller['show']);router[_0xb102('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb102('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xb102('0xf')]);router[_0xb102('0x10')]('/:id',auth[_0xb102('0x9')](),controller[_0xb102('0x11')]);module[_0xb102('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 271ce9f..823653e 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 _0x8bb0=['TEXT','sequelize','exports'];(function(_0x5e6d65,_0x5db89c){var _0x5e1f75=function(_0x3729a1){while(--_0x3729a1){_0x5e6d65['push'](_0x5e6d65['shift']());}};_0x5e1f75(++_0x5db89c);}(_0x8bb0,0xd9));var _0x08bb=function(_0x1af256,_0x1be485){_0x1af256=_0x1af256-0x0;var _0x2ea468=_0x8bb0[_0x1af256];return _0x2ea468;};'use strict';var Sequelize=require(_0x08bb('0x0'));module[_0x08bb('0x1')]={'tree':{'type':Sequelize[_0x08bb('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x4252=['exports','TEXT','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4252,0x89));var _0x2425=function(_0x33f8b1,_0x1b5f48){_0x33f8b1=_0x33f8b1-0x0;var _0x250036=_0x4252[_0x33f8b1];return _0x250036;};'use strict';var Sequelize=require(_0x2425('0x0'));module[_0x2425('0x1')]={'tree':{'type':Sequelize[_0x2425('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 b32c7ac..5bc3f4e 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 _0x2301=['error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','order','sort','merge','where','VIRTUAL','filter','options','include','then','rows','catch','show','params','includeAll','create','body','find','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','apply','reject','save','update','destroy','sendStatus'];(function(_0x3199ad,_0x1c1159){var _0x2ac22f=function(_0x70375d){while(--_0x70375d){_0x3199ad['push'](_0x3199ad['shift']());}};_0x2ac22f(++_0x1c1159);}(_0x2301,0x6f));var _0x1230=function(_0x118355,_0x201311){_0x118355=_0x118355-0x0;var _0x32f7ea=_0x2301[_0x118355];return _0x32f7ea;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1230('0x0'));var zipdir=require(_0x1230('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1230('0x2'));var moment=require(_0x1230('0x3'));var BPromise=require(_0x1230('0x4'));var Mustache=require(_0x1230('0x5'));var util=require(_0x1230('0x6'));var path=require(_0x1230('0x7'));var sox=require(_0x1230('0x8'));var csv=require(_0x1230('0x9'));var ejs=require(_0x1230('0xa'));var fs=require('fs');var fs_extra=require(_0x1230('0xb'));var _=require(_0x1230('0xc'));var squel=require('squel');var crypto=require(_0x1230('0xd'));var jsforce=require(_0x1230('0xe'));var deskjs=require(_0x1230('0xf'));var toCsv=require(_0x1230('0x9'));var querystring=require(_0x1230('0x10'));var Papa=require('papaparse');var Redis=require(_0x1230('0x11'));var authService=require(_0x1230('0x12'));var qs=require(_0x1230('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1230('0x14'));var logger=require(_0x1230('0x15'))(_0x1230('0x16'));var utils=require(_0x1230('0x17'));var config=require(_0x1230('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1230('0x19'))['db'];function respondWithStatusCode(_0x328559,_0x1d36db){_0x1d36db=_0x1d36db||0xcc;return function(_0x70d06d){if(_0x70d06d){return _0x328559['sendStatus'](_0x1d36db);}return _0x328559[_0x1230('0x1a')](_0x1d36db)[_0x1230('0x1b')]();};}function respondWithResult(_0x202a0c,_0x3e322c){_0x3e322c=_0x3e322c||0xc8;return function(_0xdbecaf){if(_0xdbecaf){return _0x202a0c[_0x1230('0x1a')](_0x3e322c)[_0x1230('0x1c')](_0xdbecaf);}};}function respondWithFilteredResult(_0x4530b6,_0x3b295f){return function(_0x5bdcb5){if(_0x5bdcb5){var _0x2540ea=typeof _0x3b295f[_0x1230('0x1d')]===_0x1230('0x1e')&&typeof _0x3b295f['limit']===_0x1230('0x1e');var _0x18aa45=_0x5bdcb5['count'];var _0x255cc1=_0x2540ea?0x0:_0x3b295f['offset'];var _0x12366d=_0x2540ea?_0x5bdcb5[_0x1230('0x1f')]:_0x3b295f['offset']+_0x3b295f[_0x1230('0x20')];var _0x4f9603;if(_0x12366d>=_0x18aa45){_0x12366d=_0x18aa45;_0x4f9603=0xc8;}else{_0x4f9603=0xce;}_0x4530b6[_0x1230('0x1a')](_0x4f9603);return _0x4530b6['set']('Content-Range',_0x255cc1+'-'+_0x12366d+'/'+_0x18aa45)[_0x1230('0x1c')](_0x5bdcb5);}return null;};}function patchUpdates(_0x31914c){return function(_0x4364bc){try{jsonpatch[_0x1230('0x21')](_0x4364bc,_0x31914c,!![]);}catch(_0xcaf388){return BPromise[_0x1230('0x22')](_0xcaf388);}return _0x4364bc[_0x1230('0x23')]();};}function saveUpdates(_0x53e2af,_0x215449){return function(_0x4f3f42){if(_0x4f3f42){return _0x4f3f42[_0x1230('0x24')](_0x53e2af)['then'](function(_0x5f2761){return _0x5f2761;});}return null;};}function removeEntity(_0x3ddd58,_0x2c01ea){return function(_0xe8f944){if(_0xe8f944){return _0xe8f944[_0x1230('0x25')]()['then'](function(){_0x3ddd58['status'](0xcc)[_0x1230('0x1b')]();});}};}function handleEntityNotFound(_0x367e60,_0xe7f76d){return function(_0x52d7f2){if(!_0x52d7f2){_0x367e60[_0x1230('0x26')](0x194);}return _0x52d7f2;};}function handleError(_0x3445e7,_0x358c71){_0x358c71=_0x358c71||0x1f4;return function(_0x3907d0){logger[_0x1230('0x27')](_0x3907d0[_0x1230('0x28')]);if(_0x3907d0[_0x1230('0x29')]){delete _0x3907d0[_0x1230('0x29')];}_0x3445e7['status'](_0x358c71)[_0x1230('0x2a')](_0x3907d0);};}exports[_0x1230('0x2b')]=function(_0x11e12d,_0x27dec6){var _0x47d17a={},_0xf9b470={},_0x24d34a={'count':0x0,'rows':[]};var _0x1ad8b2=_[_0x1230('0x2c')](db[_0x1230('0x2d')][_0x1230('0x2e')],function(_0x1bbb72){return{'name':_0x1bbb72[_0x1230('0x2f')],'type':_0x1bbb72[_0x1230('0x30')][_0x1230('0x31')]};});_0xf9b470[_0x1230('0x32')]=_[_0x1230('0x2c')](_0x1ad8b2,_0x1230('0x29'));_0xf9b470['query']=_[_0x1230('0x33')](_0x11e12d[_0x1230('0x34')]);_0xf9b470[_0x1230('0x35')]=_['intersection'](_0xf9b470[_0x1230('0x32')],_0xf9b470['query']);_0x47d17a[_0x1230('0x36')]=_[_0x1230('0x37')](_0xf9b470[_0x1230('0x32')],qs[_0x1230('0x38')](_0x11e12d['query'][_0x1230('0x38')]));_0x47d17a[_0x1230('0x36')]=_0x47d17a['attributes'][_0x1230('0x39')]?_0x47d17a[_0x1230('0x36')]:_0xf9b470[_0x1230('0x32')];if(!_0x11e12d[_0x1230('0x34')]['hasOwnProperty']('nolimit')){_0x47d17a[_0x1230('0x20')]=qs['limit'](_0x11e12d[_0x1230('0x34')][_0x1230('0x20')]);_0x47d17a[_0x1230('0x1d')]=qs[_0x1230('0x1d')](_0x11e12d[_0x1230('0x34')][_0x1230('0x1d')]);}_0x47d17a[_0x1230('0x3a')]=qs[_0x1230('0x3b')](_0x11e12d[_0x1230('0x34')][_0x1230('0x3b')]);_0x47d17a['where']=qs[_0x1230('0x35')](_['pick'](_0x11e12d[_0x1230('0x34')],_0xf9b470[_0x1230('0x35')]),_0x1ad8b2);if(_0x11e12d['query']['filter']){_0x47d17a['where']=_[_0x1230('0x3c')](_0x47d17a[_0x1230('0x3d')],{'$or':_[_0x1230('0x2c')](_0x1ad8b2,function(_0x53316d){if(_0x53316d[_0x1230('0x30')]!==_0x1230('0x3e')){var _0x28ab82={};_0x28ab82[_0x53316d[_0x1230('0x29')]]={'$like':'%'+_0x11e12d[_0x1230('0x34')][_0x1230('0x3f')]+'%'};return _0x28ab82;}})});}_0x47d17a=_[_0x1230('0x3c')]({},_0x47d17a,_0x11e12d[_0x1230('0x40')]);var _0x35421d={'where':_0x47d17a['where']};return db[_0x1230('0x2d')][_0x1230('0x1f')](_0x35421d)['then'](function(_0x5f3ab6){_0x24d34a[_0x1230('0x1f')]=_0x5f3ab6;if(_0x11e12d[_0x1230('0x34')]['includeAll']){_0x47d17a[_0x1230('0x41')]=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0x47d17a);})[_0x1230('0x42')](function(_0x4f1aa7){_0x24d34a[_0x1230('0x43')]=_0x4f1aa7;return _0x24d34a;})[_0x1230('0x42')](respondWithFilteredResult(_0x27dec6,_0x47d17a))[_0x1230('0x44')](handleError(_0x27dec6,null));};exports[_0x1230('0x45')]=function(_0x17cb5c,_0x25aa29){var _0x2419b2={'raw':!![],'where':{'id':_0x17cb5c[_0x1230('0x46')]['id']}},_0x4921ab={};_0x4921ab[_0x1230('0x32')]=_[_0x1230('0x33')](db[_0x1230('0x2d')]['rawAttributes']);_0x4921ab[_0x1230('0x34')]=_[_0x1230('0x33')](_0x17cb5c[_0x1230('0x34')]);_0x4921ab[_0x1230('0x35')]=_[_0x1230('0x37')](_0x4921ab[_0x1230('0x32')],_0x4921ab[_0x1230('0x34')]);_0x2419b2[_0x1230('0x36')]=_[_0x1230('0x37')](_0x4921ab[_0x1230('0x32')],qs[_0x1230('0x38')](_0x17cb5c[_0x1230('0x34')][_0x1230('0x38')]));_0x2419b2['attributes']=_0x2419b2[_0x1230('0x36')][_0x1230('0x39')]?_0x2419b2['attributes']:_0x4921ab[_0x1230('0x32')];if(_0x17cb5c[_0x1230('0x34')][_0x1230('0x47')]){_0x2419b2['include']=[{'all':!![]}];}_0x2419b2=_[_0x1230('0x3c')]({},_0x2419b2,_0x17cb5c[_0x1230('0x40')]);return db[_0x1230('0x2d')]['find'](_0x2419b2)[_0x1230('0x42')](handleEntityNotFound(_0x25aa29,null))[_0x1230('0x42')](respondWithResult(_0x25aa29,null))[_0x1230('0x44')](handleError(_0x25aa29,null));};exports[_0x1230('0x48')]=function(_0x1abcee,_0x436d99){return db[_0x1230('0x2d')][_0x1230('0x48')](_0x1abcee[_0x1230('0x49')],{})['then'](respondWithResult(_0x436d99,0xc9))[_0x1230('0x44')](handleError(_0x436d99,null));};exports[_0x1230('0x24')]=function(_0x6d47ff,_0x6ccc00){if(_0x6d47ff[_0x1230('0x49')]['id']){delete _0x6d47ff[_0x1230('0x49')]['id'];}return db[_0x1230('0x2d')][_0x1230('0x4a')]({'where':{'id':_0x6d47ff[_0x1230('0x46')]['id']}})['then'](handleEntityNotFound(_0x6ccc00,null))[_0x1230('0x42')](saveUpdates(_0x6d47ff['body'],null))[_0x1230('0x42')](respondWithResult(_0x6ccc00,null))[_0x1230('0x44')](handleError(_0x6ccc00,null));};exports[_0x1230('0x25')]=function(_0x4ad7d6,_0xbd085){return db[_0x1230('0x2d')][_0x1230('0x4a')]({'where':{'id':_0x4ad7d6[_0x1230('0x46')]['id']}})[_0x1230('0x42')](handleEntityNotFound(_0xbd085,null))[_0x1230('0x42')](removeEntity(_0xbd085,null))[_0x1230('0x44')](handleError(_0xbd085,null));}; \ No newline at end of file +var _0xc11c=['../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','keys','create','body','find','params','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment'];(function(_0x35ec19,_0x49c986){var _0x103b25=function(_0x393b65){while(--_0x393b65){_0x35ec19['push'](_0x35ec19['shift']());}};_0x103b25(++_0x49c986);}(_0xc11c,0x7f));var _0xcc11=function(_0x5dcbbb,_0x52c3e3){_0x5dcbbb=_0x5dcbbb-0x0;var _0x16d1f0=_0xc11c[_0x5dcbbb];return _0x16d1f0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcc11('0x0'));var zipdir=require(_0xcc11('0x1'));var jsonpatch=require(_0xcc11('0x2'));var rp=require(_0xcc11('0x3'));var moment=require('moment');var BPromise=require(_0xcc11('0x4'));var Mustache=require(_0xcc11('0x5'));var util=require(_0xcc11('0x6'));var path=require('path');var sox=require(_0xcc11('0x7'));var csv=require(_0xcc11('0x8'));var ejs=require(_0xcc11('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xcc11('0xa'));var crypto=require(_0xcc11('0xb'));var jsforce=require(_0xcc11('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xcc11('0x8'));var querystring=require(_0xcc11('0xd'));var Papa=require(_0xcc11('0xe'));var Redis=require(_0xcc11('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xcc11('0x10'));var as=require(_0xcc11('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcc11('0x12'));var utils=require(_0xcc11('0x13'));var config=require(_0xcc11('0x14'));var licenseUtil=require(_0xcc11('0x15'));var db=require(_0xcc11('0x16'))['db'];function respondWithStatusCode(_0x1ddd16,_0x22c907){_0x22c907=_0x22c907||0xcc;return function(_0xbd9fb9){if(_0xbd9fb9){return _0x1ddd16['sendStatus'](_0x22c907);}return _0x1ddd16[_0xcc11('0x17')](_0x22c907)[_0xcc11('0x18')]();};}function respondWithResult(_0x3dc7c9,_0x736cdc){_0x736cdc=_0x736cdc||0xc8;return function(_0x3fc069){if(_0x3fc069){return _0x3dc7c9[_0xcc11('0x17')](_0x736cdc)[_0xcc11('0x19')](_0x3fc069);}};}function respondWithFilteredResult(_0xecdd2,_0x1d3083){return function(_0x11d2db){if(_0x11d2db){var _0x488efd=typeof _0x1d3083[_0xcc11('0x1a')]==='undefined'&&typeof _0x1d3083[_0xcc11('0x1b')]===_0xcc11('0x1c');var _0x191348=_0x11d2db['count'];var _0x48f25a=_0x488efd?0x0:_0x1d3083[_0xcc11('0x1a')];var _0x32fb3c=_0x488efd?_0x11d2db['count']:_0x1d3083[_0xcc11('0x1a')]+_0x1d3083[_0xcc11('0x1b')];var _0xc125ee;if(_0x32fb3c>=_0x191348){_0x32fb3c=_0x191348;_0xc125ee=0xc8;}else{_0xc125ee=0xce;}_0xecdd2['status'](_0xc125ee);return _0xecdd2['set']('Content-Range',_0x48f25a+'-'+_0x32fb3c+'/'+_0x191348)[_0xcc11('0x19')](_0x11d2db);}return null;};}function patchUpdates(_0x4782cf){return function(_0xe271d4){try{jsonpatch[_0xcc11('0x1d')](_0xe271d4,_0x4782cf,!![]);}catch(_0x323ac1){return BPromise[_0xcc11('0x1e')](_0x323ac1);}return _0xe271d4[_0xcc11('0x1f')]();};}function saveUpdates(_0x332e7a,_0xdb8d20){return function(_0x37c312){if(_0x37c312){return _0x37c312[_0xcc11('0x20')](_0x332e7a)[_0xcc11('0x21')](function(_0x325c86){return _0x325c86;});}return null;};}function removeEntity(_0x206f6c,_0x13269a){return function(_0x1c8b5e){if(_0x1c8b5e){return _0x1c8b5e['destroy']()[_0xcc11('0x21')](function(){_0x206f6c[_0xcc11('0x17')](0xcc)[_0xcc11('0x18')]();});}};}function handleEntityNotFound(_0x3ff4df,_0x38b63f){return function(_0x3449a8){if(!_0x3449a8){_0x3ff4df[_0xcc11('0x22')](0x194);}return _0x3449a8;};}function handleError(_0x10b01c,_0x3959be){_0x3959be=_0x3959be||0x1f4;return function(_0x1af6e0){logger[_0xcc11('0x23')](_0x1af6e0[_0xcc11('0x24')]);if(_0x1af6e0[_0xcc11('0x25')]){delete _0x1af6e0['name'];}_0x10b01c[_0xcc11('0x17')](_0x3959be)[_0xcc11('0x26')](_0x1af6e0);};}exports[_0xcc11('0x27')]=function(_0x47cd1f,_0x555dc1){var _0x1d0322={},_0x11b6e4={},_0x1a9464={'count':0x0,'rows':[]};var _0x5a533f=_[_0xcc11('0x28')](db[_0xcc11('0x29')][_0xcc11('0x2a')],function(_0x106197){return{'name':_0x106197[_0xcc11('0x2b')],'type':_0x106197['type'][_0xcc11('0x2c')]};});_0x11b6e4[_0xcc11('0x2d')]=_[_0xcc11('0x28')](_0x5a533f,_0xcc11('0x25'));_0x11b6e4[_0xcc11('0x2e')]=_['keys'](_0x47cd1f[_0xcc11('0x2e')]);_0x11b6e4[_0xcc11('0x2f')]=_[_0xcc11('0x30')](_0x11b6e4['model'],_0x11b6e4[_0xcc11('0x2e')]);_0x1d0322[_0xcc11('0x31')]=_[_0xcc11('0x30')](_0x11b6e4['model'],qs[_0xcc11('0x32')](_0x47cd1f[_0xcc11('0x2e')]['fields']));_0x1d0322[_0xcc11('0x31')]=_0x1d0322['attributes'][_0xcc11('0x33')]?_0x1d0322[_0xcc11('0x31')]:_0x11b6e4[_0xcc11('0x2d')];if(!_0x47cd1f[_0xcc11('0x2e')][_0xcc11('0x34')](_0xcc11('0x35'))){_0x1d0322[_0xcc11('0x1b')]=qs[_0xcc11('0x1b')](_0x47cd1f[_0xcc11('0x2e')][_0xcc11('0x1b')]);_0x1d0322[_0xcc11('0x1a')]=qs[_0xcc11('0x1a')](_0x47cd1f[_0xcc11('0x2e')][_0xcc11('0x1a')]);}_0x1d0322[_0xcc11('0x36')]=qs[_0xcc11('0x37')](_0x47cd1f[_0xcc11('0x2e')]['sort']);_0x1d0322[_0xcc11('0x38')]=qs[_0xcc11('0x2f')](_['pick'](_0x47cd1f[_0xcc11('0x2e')],_0x11b6e4[_0xcc11('0x2f')]),_0x5a533f);if(_0x47cd1f['query']['filter']){_0x1d0322[_0xcc11('0x38')]=_[_0xcc11('0x39')](_0x1d0322[_0xcc11('0x38')],{'$or':_[_0xcc11('0x28')](_0x5a533f,function(_0x379578){if(_0x379578[_0xcc11('0x3a')]!==_0xcc11('0x3b')){var _0x3f6925={};_0x3f6925[_0x379578[_0xcc11('0x25')]]={'$like':'%'+_0x47cd1f[_0xcc11('0x2e')]['filter']+'%'};return _0x3f6925;}})});}_0x1d0322=_[_0xcc11('0x39')]({},_0x1d0322,_0x47cd1f[_0xcc11('0x3c')]);var _0x1cd336={'where':_0x1d0322[_0xcc11('0x38')]};return db['AnalyticTreeReport'][_0xcc11('0x3d')](_0x1cd336)[_0xcc11('0x21')](function(_0xd0573d){_0x1a9464[_0xcc11('0x3d')]=_0xd0573d;if(_0x47cd1f[_0xcc11('0x2e')][_0xcc11('0x3e')]){_0x1d0322[_0xcc11('0x3f')]=[{'all':!![]}];}return db[_0xcc11('0x29')][_0xcc11('0x40')](_0x1d0322);})['then'](function(_0x317d7d){_0x1a9464[_0xcc11('0x41')]=_0x317d7d;return _0x1a9464;})[_0xcc11('0x21')](respondWithFilteredResult(_0x555dc1,_0x1d0322))[_0xcc11('0x42')](handleError(_0x555dc1,null));};exports[_0xcc11('0x43')]=function(_0x5e40e5,_0x7c98bd){var _0x54c170={'raw':!![],'where':{'id':_0x5e40e5['params']['id']}},_0x422d9b={};_0x422d9b['model']=_[_0xcc11('0x44')](db[_0xcc11('0x29')][_0xcc11('0x2a')]);_0x422d9b[_0xcc11('0x2e')]=_[_0xcc11('0x44')](_0x5e40e5[_0xcc11('0x2e')]);_0x422d9b[_0xcc11('0x2f')]=_[_0xcc11('0x30')](_0x422d9b[_0xcc11('0x2d')],_0x422d9b['query']);_0x54c170[_0xcc11('0x31')]=_[_0xcc11('0x30')](_0x422d9b[_0xcc11('0x2d')],qs[_0xcc11('0x32')](_0x5e40e5[_0xcc11('0x2e')][_0xcc11('0x32')]));_0x54c170[_0xcc11('0x31')]=_0x54c170[_0xcc11('0x31')][_0xcc11('0x33')]?_0x54c170['attributes']:_0x422d9b[_0xcc11('0x2d')];if(_0x5e40e5[_0xcc11('0x2e')][_0xcc11('0x3e')]){_0x54c170[_0xcc11('0x3f')]=[{'all':!![]}];}_0x54c170=_[_0xcc11('0x39')]({},_0x54c170,_0x5e40e5[_0xcc11('0x3c')]);return db[_0xcc11('0x29')]['find'](_0x54c170)['then'](handleEntityNotFound(_0x7c98bd,null))[_0xcc11('0x21')](respondWithResult(_0x7c98bd,null))[_0xcc11('0x42')](handleError(_0x7c98bd,null));};exports[_0xcc11('0x45')]=function(_0x51de8f,_0x1a0246){return db[_0xcc11('0x29')]['create'](_0x51de8f[_0xcc11('0x46')],{})['then'](respondWithResult(_0x1a0246,0xc9))['catch'](handleError(_0x1a0246,null));};exports[_0xcc11('0x20')]=function(_0x42acd3,_0x3806ad){if(_0x42acd3['body']['id']){delete _0x42acd3[_0xcc11('0x46')]['id'];}return db['AnalyticTreeReport'][_0xcc11('0x47')]({'where':{'id':_0x42acd3[_0xcc11('0x48')]['id']}})[_0xcc11('0x21')](handleEntityNotFound(_0x3806ad,null))[_0xcc11('0x21')](saveUpdates(_0x42acd3['body'],null))[_0xcc11('0x21')](respondWithResult(_0x3806ad,null))['catch'](handleError(_0x3806ad,null));};exports[_0xcc11('0x49')]=function(_0x38cc1d,_0x5bcd4a){return db[_0xcc11('0x29')][_0xcc11('0x47')]({'where':{'id':_0x38cc1d[_0xcc11('0x48')]['id']}})['then'](handleEntityNotFound(_0x5bcd4a,null))[_0xcc11('0x21')](removeEntity(_0x5bcd4a,null))[_0xcc11('0x42')](handleError(_0x5bcd4a,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 8656bf4..b9021f7 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 _0x2197=['analytics_report_trees','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport'];(function(_0x2bd7f2,_0x478c7e){var _0x14d845=function(_0x271082){while(--_0x271082){_0x2bd7f2['push'](_0x2bd7f2['shift']());}};_0x14d845(++_0x478c7e);}(_0x2197,0x1ae));var _0x7219=function(_0x22ab8a,_0x3c43b5){_0x22ab8a=_0x22ab8a-0x0;var _0x879afd=_0x2197[_0x22ab8a];return _0x879afd;};'use strict';var _=require('lodash');var util=require(_0x7219('0x0'));var logger=require(_0x7219('0x1'))(_0x7219('0x2'));var moment=require(_0x7219('0x3'));var BPromise=require(_0x7219('0x4'));var rp=require(_0x7219('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7219('0x6'));var config=require(_0x7219('0x7'));var attributes=require(_0x7219('0x8'));module[_0x7219('0x9')]=function(_0x4ac3c5,_0x12535b){return _0x4ac3c5[_0x7219('0xa')](_0x7219('0xb'),attributes,{'tableName':_0x7219('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec39=['rimraf','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','request-promise'];(function(_0x380954,_0x57eed0){var _0x2176c4=function(_0x4ea683){while(--_0x4ea683){_0x380954['push'](_0x380954['shift']());}};_0x2176c4(++_0x57eed0);}(_0xec39,0xb9));var _0x9ec3=function(_0x508b92,_0x44a50){_0x508b92=_0x508b92-0x0;var _0x1f264c=_0xec39[_0x508b92];return _0x1f264c;};'use strict';var _=require(_0x9ec3('0x0'));var util=require(_0x9ec3('0x1'));var logger=require(_0x9ec3('0x2'))(_0x9ec3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9ec3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ec3('0x5'));var config=require('../../config/environment');var attributes=require('./analyticTreeReport.attributes');module[_0x9ec3('0x6')]=function(_0x4429f5,_0x2589cb){return _0x4429f5[_0x9ec3('0x7')](_0x9ec3('0x8'),attributes,{'tableName':_0x9ec3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 954caec..5486c0e 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x8fa132,_0x1c9194){var _0x186d8c=function(_0x3a9096){while(--_0x3a9096){_0x8fa132['push'](_0x8fa132['shift']());}};_0x186d8c(++_0x1c9194);}(_0xdb28,0x106));var _0x8db2=function(_0x1b5c7c,_0x586a2e){_0x1b5c7c=_0x1b5c7c-0x0;var _0x5e463f=_0xdb28[_0x1b5c7c];return _0x5e463f;};'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')]('AnalyticTreeReport,\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);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x176ead,_0x5286fd){var _0x51104f=function(_0x105306){while(--_0x105306){_0x176ead['push'](_0x176ead['shift']());}};_0x51104f(++_0x5286fd);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xc4aa[_0x346737];return _0x1ade2e;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index c0fe875..9b80991 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 _0x374f=['get','index','/:id','isAuthenticated','show','post','put','update','delete','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x374f,0xd0));var _0xf374=function(_0x592ff4,_0x59be04){_0x592ff4=_0x592ff4-0x0;var _0x3c7eb3=_0x374f[_0x592ff4];return _0x3c7eb3;};'use strict';var multer=require('multer');var util=require(_0xf374('0x0'));var path=require(_0xf374('0x1'));var timeout=require(_0xf374('0x2'));var express=require('express');var router=express[_0xf374('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf374('0x4'));var interaction=require(_0xf374('0x5'));var config=require(_0xf374('0x6'));var controller=require(_0xf374('0x7'));router[_0xf374('0x8')]('/',auth['isAuthenticated'](),controller[_0xf374('0x9')]);router[_0xf374('0x8')](_0xf374('0xa'),auth[_0xf374('0xb')](),controller[_0xf374('0xc')]);router[_0xf374('0xd')]('/',auth[_0xf374('0xb')](),controller['create']);router[_0xf374('0xe')](_0xf374('0xa'),auth[_0xf374('0xb')](),controller[_0xf374('0xf')]);router[_0xf374('0x10')](_0xf374('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xf374('0x11')]=router; \ No newline at end of file +var _0x0c7e=['isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticTreeReport.controller','get'];(function(_0x3ec335,_0x2e7f67){var _0x3c567a=function(_0x44484f){while(--_0x44484f){_0x3ec335['push'](_0x3ec335['shift']());}};_0x3c567a(++_0x2e7f67);}(_0x0c7e,0xac));var _0xe0c7=function(_0x4d1aaf,_0x1f9532){_0x4d1aaf=_0x4d1aaf-0x0;var _0x5e2faa=_0x0c7e[_0x4d1aaf];return _0x5e2faa;};'use strict';var multer=require('multer');var util=require(_0xe0c7('0x0'));var path=require(_0xe0c7('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe0c7('0x2')]();var fs_extra=require(_0xe0c7('0x3'));var auth=require(_0xe0c7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe0c7('0x5'));var controller=require(_0xe0c7('0x6'));router[_0xe0c7('0x7')]('/',auth[_0xe0c7('0x8')](),controller[_0xe0c7('0x9')]);router[_0xe0c7('0x7')](_0xe0c7('0xa'),auth[_0xe0c7('0x8')](),controller[_0xe0c7('0xb')]);router[_0xe0c7('0xc')]('/',auth['isAuthenticated'](),controller[_0xe0c7('0xd')]);router[_0xe0c7('0xe')](_0xe0c7('0xa'),auth[_0xe0c7('0x8')](),controller[_0xe0c7('0xf')]);router[_0xe0c7('0x10')](_0xe0c7('0xa'),auth[_0xe0c7('0x8')](),controller['destroy']);module[_0xe0c7('0x11')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 2425051..e121945 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 _0x5ab4=['sequelize','exports','STRING'];(function(_0x2e647f,_0x166064){var _0x20beb5=function(_0x2bd0ac){while(--_0x2bd0ac){_0x2e647f['push'](_0x2e647f['shift']());}};_0x20beb5(++_0x166064);}(_0x5ab4,0x9f));var _0x45ab=function(_0x2b9817,_0x282c23){_0x2b9817=_0x2b9817-0x0;var _0x493add=_0x5ab4[_0x2b9817];return _0x493add;};'use strict';var Sequelize=require(_0x45ab('0x0'));module[_0x45ab('0x1')]={'name':{'type':Sequelize[_0x45ab('0x2')]},'basename':{'type':Sequelize[_0x45ab('0x2')]},'type':{'type':Sequelize[_0x45ab('0x2')]}}; \ No newline at end of file +var _0xc999=['exports','STRING'];(function(_0x30e7ad,_0x243b85){var _0x521171=function(_0x28b1df){while(--_0x28b1df){_0x30e7ad['push'](_0x30e7ad['shift']());}};_0x521171(++_0x243b85);}(_0xc999,0x176));var _0x9c99=function(_0x695b76,_0x551526){_0x695b76=_0x695b76-0x0;var _0x1dc21f=_0xc999[_0x695b76];return _0x1dc21f;};'use strict';var Sequelize=require('sequelize');module[_0x9c99('0x0')]={'name':{'type':Sequelize[_0x9c99('0x1')]},'basename':{'type':Sequelize[_0x9c99('0x1')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 61a7c77..e6906ed 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 _0xdaa4=['fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','include','Attachment','rows','catch','show','params','find','clone','includeAll','get','omit','updatedAt','body','create','file','originalname','basename','filename','mimetype','download','ChatOfflineMessageId','join','root','server/files/attachments/','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','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/environment','sendStatus','status','json','offset','undefined','count','limit','set','save','update','then','destroy','stack','name','map','rawAttributes'];(function(_0x3ed941,_0x9e96bc){var _0xde4c6e=function(_0x5e8335){while(--_0x5e8335){_0x3ed941['push'](_0x3ed941['shift']());}};_0xde4c6e(++_0x9e96bc);}(_0xdaa4,0x1d5));var _0x4daa=function(_0x37e775,_0x3bb1c6){_0x37e775=_0x37e775-0x0;var _0x3c1ab5=_0xdaa4[_0x37e775];return _0x3c1ab5;};'use strict';var emlformat=require(_0x4daa('0x0'));var rimraf=require(_0x4daa('0x1'));var zipdir=require(_0x4daa('0x2'));var jsonpatch=require(_0x4daa('0x3'));var rp=require('request-promise');var moment=require(_0x4daa('0x4'));var BPromise=require(_0x4daa('0x5'));var Mustache=require('mustache');var util=require(_0x4daa('0x6'));var path=require(_0x4daa('0x7'));var sox=require('sox');var csv=require(_0x4daa('0x8'));var ejs=require(_0x4daa('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4daa('0xa'));var squel=require(_0x4daa('0xb'));var crypto=require(_0x4daa('0xc'));var jsforce=require(_0x4daa('0xd'));var deskjs=require(_0x4daa('0xe'));var toCsv=require(_0x4daa('0x8'));var querystring=require(_0x4daa('0xf'));var Papa=require(_0x4daa('0x10'));var Redis=require(_0x4daa('0x11'));var authService=require(_0x4daa('0x12'));var qs=require(_0x4daa('0x13'));var as=require(_0x4daa('0x14'));var hardwareService=require(_0x4daa('0x15'));var logger=require(_0x4daa('0x16'))(_0x4daa('0x17'));var utils=require('../../config/utils');var config=require(_0x4daa('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x825303,_0x45fa7e){_0x45fa7e=_0x45fa7e||0xcc;return function(_0x4fd660){if(_0x4fd660){return _0x825303[_0x4daa('0x19')](_0x45fa7e);}return _0x825303['status'](_0x45fa7e)['end']();};}function respondWithResult(_0x2840b2,_0xf5797c){_0xf5797c=_0xf5797c||0xc8;return function(_0x511286){if(_0x511286){return _0x2840b2[_0x4daa('0x1a')](_0xf5797c)[_0x4daa('0x1b')](_0x511286);}};}function respondWithFilteredResult(_0x31ea13,_0x5681fe){return function(_0x41e639){if(_0x41e639){var _0x464e64=typeof _0x5681fe[_0x4daa('0x1c')]===_0x4daa('0x1d')&&typeof _0x5681fe['limit']===_0x4daa('0x1d');var _0x35d3b5=_0x41e639[_0x4daa('0x1e')];var _0x462c56=_0x464e64?0x0:_0x5681fe[_0x4daa('0x1c')];var _0x4f2539=_0x464e64?_0x41e639[_0x4daa('0x1e')]:_0x5681fe[_0x4daa('0x1c')]+_0x5681fe[_0x4daa('0x1f')];var _0x5d547a;if(_0x4f2539>=_0x35d3b5){_0x4f2539=_0x35d3b5;_0x5d547a=0xc8;}else{_0x5d547a=0xce;}_0x31ea13[_0x4daa('0x1a')](_0x5d547a);return _0x31ea13[_0x4daa('0x20')]('Content-Range',_0x462c56+'-'+_0x4f2539+'/'+_0x35d3b5)[_0x4daa('0x1b')](_0x41e639);}return null;};}function patchUpdates(_0x3004ee){return function(_0x530333){try{jsonpatch['apply'](_0x530333,_0x3004ee,!![]);}catch(_0x4f105c){return BPromise['reject'](_0x4f105c);}return _0x530333[_0x4daa('0x21')]();};}function saveUpdates(_0x4186a4,_0x138138){return function(_0x30a554){if(_0x30a554){return _0x30a554[_0x4daa('0x22')](_0x4186a4)[_0x4daa('0x23')](function(_0x58aa43){return _0x58aa43;});}return null;};}function removeEntity(_0x1de455,_0x16dbc0){return function(_0xccbf18){if(_0xccbf18){return _0xccbf18[_0x4daa('0x24')]()[_0x4daa('0x23')](function(){_0x1de455[_0x4daa('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a0a9e,_0x54709f){return function(_0x508db8){if(!_0x508db8){_0x5a0a9e[_0x4daa('0x19')](0x194);}return _0x508db8;};}function handleError(_0x2c20ab,_0x101921){_0x101921=_0x101921||0x1f4;return function(_0x8e9609){logger['error'](_0x8e9609[_0x4daa('0x25')]);if(_0x8e9609['name']){delete _0x8e9609[_0x4daa('0x26')];}_0x2c20ab['status'](_0x101921)['send'](_0x8e9609);};}exports['index']=function(_0x19de2a,_0x1f81ca){var _0x3477f4={},_0xe6b50a={},_0x55b01f={'count':0x0,'rows':[]};var _0x31be12=_[_0x4daa('0x27')](db['Attachment'][_0x4daa('0x28')],function(_0x3108e4){return{'name':_0x3108e4[_0x4daa('0x29')],'type':_0x3108e4[_0x4daa('0x2a')][_0x4daa('0x2b')]};});_0xe6b50a[_0x4daa('0x2c')]=_['map'](_0x31be12,_0x4daa('0x26'));_0xe6b50a[_0x4daa('0x2d')]=_[_0x4daa('0x2e')](_0x19de2a[_0x4daa('0x2d')]);_0xe6b50a[_0x4daa('0x2f')]=_['intersection'](_0xe6b50a[_0x4daa('0x2c')],_0xe6b50a[_0x4daa('0x2d')]);_0x3477f4[_0x4daa('0x30')]=_[_0x4daa('0x31')](_0xe6b50a[_0x4daa('0x2c')],qs['fields'](_0x19de2a[_0x4daa('0x2d')][_0x4daa('0x32')]));_0x3477f4[_0x4daa('0x30')]=_0x3477f4[_0x4daa('0x30')][_0x4daa('0x33')]?_0x3477f4[_0x4daa('0x30')]:_0xe6b50a[_0x4daa('0x2c')];if(!_0x19de2a[_0x4daa('0x2d')][_0x4daa('0x34')]('nolimit')){_0x3477f4[_0x4daa('0x1f')]=qs[_0x4daa('0x1f')](_0x19de2a[_0x4daa('0x2d')][_0x4daa('0x1f')]);_0x3477f4[_0x4daa('0x1c')]=qs[_0x4daa('0x1c')](_0x19de2a[_0x4daa('0x2d')][_0x4daa('0x1c')]);}_0x3477f4[_0x4daa('0x35')]=qs[_0x4daa('0x36')](_0x19de2a['query'][_0x4daa('0x36')]);_0x3477f4['where']=qs[_0x4daa('0x2f')](_[_0x4daa('0x37')](_0x19de2a['query'],_0xe6b50a['filters']),_0x31be12);if(_0x19de2a[_0x4daa('0x2d')][_0x4daa('0x38')]){_0x3477f4[_0x4daa('0x39')]=_[_0x4daa('0x3a')](_0x3477f4[_0x4daa('0x39')],{'$or':_[_0x4daa('0x27')](_0x31be12,function(_0xb9b9a6){if(_0xb9b9a6[_0x4daa('0x2a')]!==_0x4daa('0x3b')){var _0xcc6e23={};_0xcc6e23[_0xb9b9a6['name']]={'$like':'%'+_0x19de2a['query'][_0x4daa('0x38')]+'%'};return _0xcc6e23;}})});}_0x3477f4=_[_0x4daa('0x3a')]({},_0x3477f4,_0x19de2a[_0x4daa('0x3c')]);var _0xcfb2b={'where':_0x3477f4[_0x4daa('0x39')]};return db['Attachment'][_0x4daa('0x1e')](_0xcfb2b)[_0x4daa('0x23')](function(_0x5aae9b){_0x55b01f[_0x4daa('0x1e')]=_0x5aae9b;if(_0x19de2a['query']['includeAll']){_0x3477f4[_0x4daa('0x3d')]=[{'all':!![]}];}return db[_0x4daa('0x3e')]['findAll'](_0x3477f4);})[_0x4daa('0x23')](function(_0x11a431){_0x55b01f[_0x4daa('0x3f')]=_0x11a431;return _0x55b01f;})[_0x4daa('0x23')](respondWithFilteredResult(_0x1f81ca,_0x3477f4))[_0x4daa('0x40')](handleError(_0x1f81ca,null));};exports[_0x4daa('0x41')]=function(_0x3ab73e,_0x13bc38){var _0x27d358={'raw':!![],'where':{'id':_0x3ab73e[_0x4daa('0x42')]['id']}},_0x1c1ef5={};_0x1c1ef5[_0x4daa('0x2c')]=_['keys'](db['Attachment'][_0x4daa('0x28')]);_0x1c1ef5[_0x4daa('0x2d')]=_[_0x4daa('0x2e')](_0x3ab73e[_0x4daa('0x2d')]);_0x1c1ef5[_0x4daa('0x2f')]=_[_0x4daa('0x31')](_0x1c1ef5[_0x4daa('0x2c')],_0x1c1ef5[_0x4daa('0x2d')]);_0x27d358[_0x4daa('0x30')]=_[_0x4daa('0x31')](_0x1c1ef5[_0x4daa('0x2c')],qs[_0x4daa('0x32')](_0x3ab73e[_0x4daa('0x2d')][_0x4daa('0x32')]));_0x27d358[_0x4daa('0x30')]=_0x27d358[_0x4daa('0x30')][_0x4daa('0x33')]?_0x27d358['attributes']:_0x1c1ef5['model'];if(_0x3ab73e[_0x4daa('0x2d')]['includeAll']){_0x27d358[_0x4daa('0x3d')]=[{'all':!![]}];}_0x27d358=_[_0x4daa('0x3a')]({},_0x27d358,_0x3ab73e[_0x4daa('0x3c')]);return db['Attachment'][_0x4daa('0x43')](_0x27d358)['then'](handleEntityNotFound(_0x13bc38,null))[_0x4daa('0x23')](respondWithResult(_0x13bc38,null))[_0x4daa('0x40')](handleError(_0x13bc38,null));};exports[_0x4daa('0x44')]=function(_0xf1e2e9,_0x203e4e){var _0x52e27f={'where':{'id':_0xf1e2e9[_0x4daa('0x42')]['id']}},_0x30b9f5={};_0x30b9f5[_0x4daa('0x2c')]=_[_0x4daa('0x2e')](db[_0x4daa('0x3e')][_0x4daa('0x28')]);_0x52e27f[_0x4daa('0x30')]=_[_0x4daa('0x31')](_0x30b9f5[_0x4daa('0x2c')],qs[_0x4daa('0x32')](_0xf1e2e9[_0x4daa('0x2d')][_0x4daa('0x32')]));_0x52e27f[_0x4daa('0x30')]=_0x52e27f['attributes'][_0x4daa('0x33')]?_0x52e27f[_0x4daa('0x30')]:_0x30b9f5['model'];if(_0xf1e2e9[_0x4daa('0x2d')][_0x4daa('0x45')]){_0x52e27f[_0x4daa('0x3d')]=[{'all':!![]}];}_0x52e27f=_[_0x4daa('0x3a')]({},_0x52e27f,_0xf1e2e9[_0x4daa('0x3c')]);return db[_0x4daa('0x3e')][_0x4daa('0x43')](_0x52e27f)[_0x4daa('0x23')](handleEntityNotFound(_0x203e4e,null))['then'](function(_0x24d7b6){if(_0x24d7b6){var _0x5bf59=_0x24d7b6[_0x4daa('0x46')]({'plain':!![]});_0x5bf59=qs[_0x4daa('0x47')](_0x5bf59,['id','createdAt',_0x4daa('0x48')]);_0xf1e2e9[_0x4daa('0x49')]=_[_0x4daa('0x47')](_0xf1e2e9['body'],['id','createdAt',_0x4daa('0x48')]);return db[_0x4daa('0x3e')][_0x4daa('0x4a')](_[_0x4daa('0x3a')](_0x5bf59,_0xf1e2e9[_0x4daa('0x49')]),{'include':_0xf1e2e9[_0x4daa('0x2d')][_0x4daa('0x45')]?[{'all':!![]}]:undefined});}})[_0x4daa('0x23')](respondWithResult(_0x203e4e,0xc9))[_0x4daa('0x40')](handleError(_0x203e4e,null));};exports[_0x4daa('0x22')]=function(_0x1699e2,_0x59687d){if(_0x1699e2[_0x4daa('0x49')]['id']){delete _0x1699e2[_0x4daa('0x49')]['id'];}return db['Attachment'][_0x4daa('0x43')]({'where':{'id':_0x1699e2[_0x4daa('0x42')]['id']}})[_0x4daa('0x23')](handleEntityNotFound(_0x59687d,null))['then'](saveUpdates(_0x1699e2[_0x4daa('0x49')],null))[_0x4daa('0x23')](respondWithResult(_0x59687d,null))[_0x4daa('0x40')](handleError(_0x59687d,null));};exports[_0x4daa('0x24')]=function(_0x7fa1a2,_0x36a269){return db[_0x4daa('0x3e')][_0x4daa('0x43')]({'where':{'id':_0x7fa1a2['params']['id']}})[_0x4daa('0x23')](handleEntityNotFound(_0x36a269,null))[_0x4daa('0x23')](removeEntity(_0x36a269,null))[_0x4daa('0x40')](handleError(_0x36a269,null));};exports[_0x4daa('0x4a')]=function(_0x5f2164,_0x5a8bdf,_0x545a1d){_0x5f2164['body'][_0x4daa('0x26')]=_0x5f2164[_0x4daa('0x4b')][_0x4daa('0x4c')];_0x5f2164[_0x4daa('0x49')][_0x4daa('0x4d')]=_0x5f2164['file'][_0x4daa('0x4e')];_0x5f2164['body'][_0x4daa('0x2a')]=_0x5f2164[_0x4daa('0x4b')][_0x4daa('0x4f')];return db[_0x4daa('0x3e')][_0x4daa('0x4a')](_0x5f2164['body'])[_0x4daa('0x23')](respondWithResult(_0x5a8bdf,0xc9))[_0x4daa('0x40')](handleError(_0x5a8bdf,null));};exports[_0x4daa('0x50')]=function(_0x1ea422,_0x52ac05,_0x1c029b){return db[_0x4daa('0x3e')]['findOne']({'where':{'id':_0x1ea422[_0x4daa('0x42')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x52ac05,null))['then'](function(_0x3bb137){if(_0x3bb137){var _0x9db59e=_0x3bb137[_0x4daa('0x51')]!==null;var _0x29b032=path[_0x4daa('0x52')](config[_0x4daa('0x53')],_0x4daa('0x54'));if(_0x9db59e){_0x29b032=path[_0x4daa('0x52')](_0x29b032,'offline-chat/');}var _0x1f2d76=path['join'](_0x29b032,_0x3bb137[_0x4daa('0x4d')]);return _0x52ac05[_0x4daa('0x50')](_0x1f2d76);}})[_0x4daa('0x40')](handleError(_0x52ac05,null));}; \ No newline at end of file +var _0x97b5=['key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','rows','catch','show','params','include','clone','length','find','get','omit','createdAt','updatedAt','body','create','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','fast-json-patch','request-promise','mustache','util','sox','to-csv','squel','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','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','name','send','index','Attachment','rawAttributes','fieldName','type'];(function(_0x324549,_0x26371b){var _0xf42de=function(_0x29f9e3){while(--_0x29f9e3){_0x324549['push'](_0x324549['shift']());}};_0xf42de(++_0x26371b);}(_0x97b5,0x7c));var _0x597b=function(_0x16b133,_0x1fc6f3){_0x16b133=_0x16b133-0x0;var _0x248b99=_0x97b5[_0x16b133];return _0x248b99;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x597b('0x0'));var rp=require(_0x597b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x597b('0x2'));var util=require(_0x597b('0x3'));var path=require('path');var sox=require(_0x597b('0x4'));var csv=require(_0x597b('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x597b('0x6'));var crypto=require('crypto');var jsforce=require(_0x597b('0x7'));var deskjs=require(_0x597b('0x8'));var toCsv=require('to-csv');var querystring=require(_0x597b('0x9'));var Papa=require(_0x597b('0xa'));var Redis=require(_0x597b('0xb'));var authService=require(_0x597b('0xc'));var qs=require(_0x597b('0xd'));var as=require(_0x597b('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x597b('0xf'))(_0x597b('0x10'));var utils=require('../../config/utils');var config=require(_0x597b('0x11'));var licenseUtil=require(_0x597b('0x12'));var db=require(_0x597b('0x13'))['db'];function respondWithStatusCode(_0x48207e,_0x5dee97){_0x5dee97=_0x5dee97||0xcc;return function(_0x4fe0e0){if(_0x4fe0e0){return _0x48207e[_0x597b('0x14')](_0x5dee97);}return _0x48207e[_0x597b('0x15')](_0x5dee97)[_0x597b('0x16')]();};}function respondWithResult(_0x4f094e,_0x3e15f2){_0x3e15f2=_0x3e15f2||0xc8;return function(_0x32e2ce){if(_0x32e2ce){return _0x4f094e[_0x597b('0x15')](_0x3e15f2)[_0x597b('0x17')](_0x32e2ce);}};}function respondWithFilteredResult(_0x2fc258,_0x5e763e){return function(_0x1e732a){if(_0x1e732a){var _0x4eb8f5=typeof _0x5e763e[_0x597b('0x18')]===_0x597b('0x19')&&typeof _0x5e763e[_0x597b('0x1a')]===_0x597b('0x19');var _0x552eb7=_0x1e732a[_0x597b('0x1b')];var _0x37af98=_0x4eb8f5?0x0:_0x5e763e[_0x597b('0x18')];var _0x15eb47=_0x4eb8f5?_0x1e732a[_0x597b('0x1b')]:_0x5e763e[_0x597b('0x18')]+_0x5e763e[_0x597b('0x1a')];var _0x3bde9d;if(_0x15eb47>=_0x552eb7){_0x15eb47=_0x552eb7;_0x3bde9d=0xc8;}else{_0x3bde9d=0xce;}_0x2fc258[_0x597b('0x15')](_0x3bde9d);return _0x2fc258['set'](_0x597b('0x1c'),_0x37af98+'-'+_0x15eb47+'/'+_0x552eb7)['json'](_0x1e732a);}return null;};}function patchUpdates(_0x7b17c1){return function(_0x46a6e0){try{jsonpatch[_0x597b('0x1d')](_0x46a6e0,_0x7b17c1,!![]);}catch(_0x4d9f9a){return BPromise[_0x597b('0x1e')](_0x4d9f9a);}return _0x46a6e0['save']();};}function saveUpdates(_0x53aa30,_0x5b4f7e){return function(_0x37f43b){if(_0x37f43b){return _0x37f43b[_0x597b('0x1f')](_0x53aa30)['then'](function(_0x1469d7){return _0x1469d7;});}return null;};}function removeEntity(_0x2666ff,_0x2c0d19){return function(_0x50e5f0){if(_0x50e5f0){return _0x50e5f0['destroy']()[_0x597b('0x20')](function(){_0x2666ff[_0x597b('0x15')](0xcc)[_0x597b('0x16')]();});}};}function handleEntityNotFound(_0x109f8b,_0x51b112){return function(_0x5a1a27){if(!_0x5a1a27){_0x109f8b[_0x597b('0x14')](0x194);}return _0x5a1a27;};}function handleError(_0x3f3e4e,_0x3ee531){_0x3ee531=_0x3ee531||0x1f4;return function(_0x5451ed){logger['error'](_0x5451ed['stack']);if(_0x5451ed[_0x597b('0x21')]){delete _0x5451ed[_0x597b('0x21')];}_0x3f3e4e[_0x597b('0x15')](_0x3ee531)[_0x597b('0x22')](_0x5451ed);};}exports[_0x597b('0x23')]=function(_0x2b00cb,_0x7b5e8c){var _0x11add9={},_0x1da2a0={},_0x480183={'count':0x0,'rows':[]};var _0x19dea6=_['map'](db[_0x597b('0x24')][_0x597b('0x25')],function(_0x1086d0){return{'name':_0x1086d0[_0x597b('0x26')],'type':_0x1086d0[_0x597b('0x27')][_0x597b('0x28')]};});_0x1da2a0[_0x597b('0x29')]=_[_0x597b('0x2a')](_0x19dea6,_0x597b('0x21'));_0x1da2a0[_0x597b('0x2b')]=_[_0x597b('0x2c')](_0x2b00cb[_0x597b('0x2b')]);_0x1da2a0[_0x597b('0x2d')]=_['intersection'](_0x1da2a0[_0x597b('0x29')],_0x1da2a0[_0x597b('0x2b')]);_0x11add9['attributes']=_[_0x597b('0x2e')](_0x1da2a0[_0x597b('0x29')],qs['fields'](_0x2b00cb['query'][_0x597b('0x2f')]));_0x11add9['attributes']=_0x11add9[_0x597b('0x30')]['length']?_0x11add9[_0x597b('0x30')]:_0x1da2a0[_0x597b('0x29')];if(!_0x2b00cb[_0x597b('0x2b')][_0x597b('0x31')](_0x597b('0x32'))){_0x11add9[_0x597b('0x1a')]=qs[_0x597b('0x1a')](_0x2b00cb[_0x597b('0x2b')][_0x597b('0x1a')]);_0x11add9[_0x597b('0x18')]=qs['offset'](_0x2b00cb[_0x597b('0x2b')][_0x597b('0x18')]);}_0x11add9['order']=qs['sort'](_0x2b00cb['query'][_0x597b('0x33')]);_0x11add9[_0x597b('0x34')]=qs[_0x597b('0x2d')](_[_0x597b('0x35')](_0x2b00cb[_0x597b('0x2b')],_0x1da2a0[_0x597b('0x2d')]),_0x19dea6);if(_0x2b00cb[_0x597b('0x2b')][_0x597b('0x36')]){_0x11add9[_0x597b('0x34')]=_[_0x597b('0x37')](_0x11add9[_0x597b('0x34')],{'$or':_[_0x597b('0x2a')](_0x19dea6,function(_0x4dcfdc){if(_0x4dcfdc['type']!=='VIRTUAL'){var _0x3d36ba={};_0x3d36ba[_0x4dcfdc[_0x597b('0x21')]]={'$like':'%'+_0x2b00cb[_0x597b('0x2b')]['filter']+'%'};return _0x3d36ba;}})});}_0x11add9=_[_0x597b('0x37')]({},_0x11add9,_0x2b00cb[_0x597b('0x38')]);var _0x2a9462={'where':_0x11add9[_0x597b('0x34')]};return db['Attachment'][_0x597b('0x1b')](_0x2a9462)[_0x597b('0x20')](function(_0x17cd5b){_0x480183[_0x597b('0x1b')]=_0x17cd5b;if(_0x2b00cb[_0x597b('0x2b')][_0x597b('0x39')]){_0x11add9['include']=[{'all':!![]}];}return db[_0x597b('0x24')]['findAll'](_0x11add9);})[_0x597b('0x20')](function(_0x58e7fc){_0x480183[_0x597b('0x3a')]=_0x58e7fc;return _0x480183;})[_0x597b('0x20')](respondWithFilteredResult(_0x7b5e8c,_0x11add9))[_0x597b('0x3b')](handleError(_0x7b5e8c,null));};exports[_0x597b('0x3c')]=function(_0x55325c,_0x4955f3){var _0x16cac1={'raw':!![],'where':{'id':_0x55325c[_0x597b('0x3d')]['id']}},_0x268122={};_0x268122[_0x597b('0x29')]=_[_0x597b('0x2c')](db['Attachment'][_0x597b('0x25')]);_0x268122[_0x597b('0x2b')]=_[_0x597b('0x2c')](_0x55325c[_0x597b('0x2b')]);_0x268122[_0x597b('0x2d')]=_[_0x597b('0x2e')](_0x268122[_0x597b('0x29')],_0x268122['query']);_0x16cac1[_0x597b('0x30')]=_['intersection'](_0x268122[_0x597b('0x29')],qs[_0x597b('0x2f')](_0x55325c[_0x597b('0x2b')]['fields']));_0x16cac1[_0x597b('0x30')]=_0x16cac1[_0x597b('0x30')]['length']?_0x16cac1[_0x597b('0x30')]:_0x268122['model'];if(_0x55325c[_0x597b('0x2b')][_0x597b('0x39')]){_0x16cac1[_0x597b('0x3e')]=[{'all':!![]}];}_0x16cac1=_[_0x597b('0x37')]({},_0x16cac1,_0x55325c[_0x597b('0x38')]);return db['Attachment']['find'](_0x16cac1)[_0x597b('0x20')](handleEntityNotFound(_0x4955f3,null))[_0x597b('0x20')](respondWithResult(_0x4955f3,null))[_0x597b('0x3b')](handleError(_0x4955f3,null));};exports[_0x597b('0x3f')]=function(_0x453ba7,_0x2df7bd){var _0x213e86={'where':{'id':_0x453ba7[_0x597b('0x3d')]['id']}},_0x28075c={};_0x28075c[_0x597b('0x29')]=_[_0x597b('0x2c')](db[_0x597b('0x24')][_0x597b('0x25')]);_0x213e86[_0x597b('0x30')]=_[_0x597b('0x2e')](_0x28075c[_0x597b('0x29')],qs[_0x597b('0x2f')](_0x453ba7[_0x597b('0x2b')][_0x597b('0x2f')]));_0x213e86['attributes']=_0x213e86[_0x597b('0x30')][_0x597b('0x40')]?_0x213e86[_0x597b('0x30')]:_0x28075c['model'];if(_0x453ba7[_0x597b('0x2b')]['includeAll']){_0x213e86[_0x597b('0x3e')]=[{'all':!![]}];}_0x213e86=_[_0x597b('0x37')]({},_0x213e86,_0x453ba7['options']);return db[_0x597b('0x24')][_0x597b('0x41')](_0x213e86)[_0x597b('0x20')](handleEntityNotFound(_0x2df7bd,null))[_0x597b('0x20')](function(_0x208362){if(_0x208362){var _0x34664f=_0x208362[_0x597b('0x42')]({'plain':!![]});_0x34664f=qs[_0x597b('0x43')](_0x34664f,['id',_0x597b('0x44'),_0x597b('0x45')]);_0x453ba7[_0x597b('0x46')]=_[_0x597b('0x43')](_0x453ba7[_0x597b('0x46')],['id',_0x597b('0x44'),_0x597b('0x45')]);return db[_0x597b('0x24')][_0x597b('0x47')](_[_0x597b('0x37')](_0x34664f,_0x453ba7['body']),{'include':_0x453ba7[_0x597b('0x2b')][_0x597b('0x39')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x2df7bd,0xc9))['catch'](handleError(_0x2df7bd,null));};exports[_0x597b('0x1f')]=function(_0x1bafcf,_0x4be783){if(_0x1bafcf[_0x597b('0x46')]['id']){delete _0x1bafcf[_0x597b('0x46')]['id'];}return db['Attachment'][_0x597b('0x41')]({'where':{'id':_0x1bafcf[_0x597b('0x3d')]['id']}})[_0x597b('0x20')](handleEntityNotFound(_0x4be783,null))['then'](saveUpdates(_0x1bafcf[_0x597b('0x46')],null))[_0x597b('0x20')](respondWithResult(_0x4be783,null))[_0x597b('0x3b')](handleError(_0x4be783,null));};exports['destroy']=function(_0x374c5b,_0x5d9a41){return db[_0x597b('0x24')][_0x597b('0x41')]({'where':{'id':_0x374c5b[_0x597b('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5d9a41,null))[_0x597b('0x20')](removeEntity(_0x5d9a41,null))['catch'](handleError(_0x5d9a41,null));};exports[_0x597b('0x47')]=function(_0x190fae,_0x3956de,_0x116565){_0x190fae['body'][_0x597b('0x21')]=_0x190fae[_0x597b('0x48')][_0x597b('0x49')];_0x190fae[_0x597b('0x46')][_0x597b('0x4a')]=_0x190fae['file'][_0x597b('0x4b')];_0x190fae[_0x597b('0x46')][_0x597b('0x27')]=_0x190fae[_0x597b('0x48')][_0x597b('0x4c')];return db[_0x597b('0x24')][_0x597b('0x47')](_0x190fae[_0x597b('0x46')])[_0x597b('0x20')](respondWithResult(_0x3956de,0xc9))['catch'](handleError(_0x3956de,null));};exports[_0x597b('0x4d')]=function(_0x524b14,_0x2826d9,_0x19e2f9){return db['Attachment'][_0x597b('0x4e')]({'where':{'id':_0x524b14['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2826d9,null))[_0x597b('0x20')](function(_0x5ad536){if(_0x5ad536){var _0x250552=_0x5ad536[_0x597b('0x4f')]!==null;var _0x1d40f8=path[_0x597b('0x50')](config[_0x597b('0x51')],'server/files/attachments/');if(_0x250552){_0x1d40f8=path['join'](_0x1d40f8,'offline-chat/');}var _0x40fb7a=path[_0x597b('0x50')](_0x1d40f8,_0x5ad536['basename']);return _0x2826d9[_0x597b('0x4d')](_0x40fb7a);}})[_0x597b('0x3b')](handleError(_0x2826d9,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 6ce656d..7de728e 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 _0x0001=['path','rimraf','../../config/environment','./attachment.attributes','exports','define','attachments','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x507a80,_0x5e15b9){var _0x45f4af=function(_0x4319f3){while(--_0x4319f3){_0x507a80['push'](_0x507a80['shift']());}};_0x45f4af(++_0x5e15b9);}(_0x0001,0x93));var _0x1000=function(_0x5a60ba,_0x39e5a9){_0x5a60ba=_0x5a60ba-0x0;var _0x1e9c6c=_0x0001[_0x5a60ba];return _0x1e9c6c;};'use strict';var _=require(_0x1000('0x0'));var util=require(_0x1000('0x1'));var logger=require(_0x1000('0x2'))(_0x1000('0x3'));var moment=require(_0x1000('0x4'));var BPromise=require(_0x1000('0x5'));var rp=require(_0x1000('0x6'));var fs=require('fs');var path=require(_0x1000('0x7'));var rimraf=require(_0x1000('0x8'));var config=require(_0x1000('0x9'));var attributes=require(_0x1000('0xa'));module[_0x1000('0xb')]=function(_0x1f579f,_0x39519d){return _0x1f579f[_0x1000('0xc')]('Attachment',attributes,{'tableName':_0x1000('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c4d=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','attachments'];(function(_0x1484e5,_0x2a588b){var _0x1243f7=function(_0x4fd767){while(--_0x4fd767){_0x1484e5['push'](_0x1484e5['shift']());}};_0x1243f7(++_0x2a588b);}(_0x3c4d,0x1ce));var _0xd3c4=function(_0x1b6670,_0xe03ee3){_0x1b6670=_0x1b6670-0x0;var _0x56d04e=_0x3c4d[_0x1b6670];return _0x56d04e;};'use strict';var _=require(_0xd3c4('0x0'));var util=require('util');var logger=require(_0xd3c4('0x1'))(_0xd3c4('0x2'));var moment=require(_0xd3c4('0x3'));var BPromise=require(_0xd3c4('0x4'));var rp=require(_0xd3c4('0x5'));var fs=require('fs');var path=require(_0xd3c4('0x6'));var rimraf=require(_0xd3c4('0x7'));var config=require(_0xd3c4('0x8'));var attributes=require(_0xd3c4('0x9'));module['exports']=function(_0x247cb5,_0x2f5fcc){return _0x247cb5['define']('Attachment',attributes,{'tableName':_0xd3c4('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 32c2ab2..444e354 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 _0xca66=['body','options','raw','CreateAttachment','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','Attachment','create'];(function(_0x3c4327,_0x5951b2){var _0x45ad35=function(_0x53a347){while(--_0x53a347){_0x3c4327['push'](_0x3c4327['shift']());}};_0x45ad35(++_0x5951b2);}(_0xca66,0x8b));var _0x6ca6=function(_0x5757fe,_0x8eb45b){_0x5757fe=_0x5757fe-0x0;var _0x2e3f15=_0xca66[_0x5757fe];return _0x2e3f15;};'use strict';var _=require(_0x6ca6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6ca6('0x1'));var rs=require(_0x6ca6('0x2'));var fs=require('fs');var Redis=require(_0x6ca6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ca6('0x4'));var logger=require('../../config/logger')(_0x6ca6('0x5'));var config=require('../../config/environment');var jayson=require(_0x6ca6('0x6'));var client=jayson[_0x6ca6('0x7')][_0x6ca6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44019c,_0x407e66,_0x27a210){return new BPromise(function(_0x27d280,_0x4f5651){return client[_0x6ca6('0x9')](_0x44019c,_0x27a210)[_0x6ca6('0xa')](function(_0x34b71b){logger[_0x6ca6('0xb')](_0x6ca6('0xc'),_0x407e66,_0x6ca6('0xd'));logger[_0x6ca6('0xe')]('Attachment,\x20%s,\x20%s,\x20%s',_0x407e66,_0x6ca6('0xd'),JSON[_0x6ca6('0xf')](_0x34b71b));if(_0x34b71b[_0x6ca6('0x10')]){if(_0x34b71b[_0x6ca6('0x10')][_0x6ca6('0x11')]===0x1f4){logger[_0x6ca6('0x10')]('Attachment,\x20%s,\x20%s',_0x407e66,_0x34b71b[_0x6ca6('0x10')][_0x6ca6('0x12')]);return _0x4f5651(_0x34b71b['error'][_0x6ca6('0x12')]);}logger[_0x6ca6('0x10')](_0x6ca6('0xc'),_0x407e66,_0x34b71b[_0x6ca6('0x10')][_0x6ca6('0x12')]);return _0x27d280(_0x34b71b[_0x6ca6('0x10')]['message']);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x407e66,_0x6ca6('0xd'));_0x27d280(_0x34b71b[_0x6ca6('0x13')][_0x6ca6('0x12')]);}})[_0x6ca6('0x14')](function(_0x2c4a5c){logger[_0x6ca6('0x10')](_0x6ca6('0xc'),_0x407e66,_0x2c4a5c);_0x4f5651(_0x2c4a5c);});});}exports['CreateAttachment']=function(_0x2391ce){var _0x10be57=this;return new Promise(function(_0xc97f0,_0x1f21ff){return db[_0x6ca6('0x15')][_0x6ca6('0x16')](_0x2391ce[_0x6ca6('0x17')],{'raw':_0x2391ce[_0x6ca6('0x18')]?_0x2391ce[_0x6ca6('0x18')][_0x6ca6('0x19')]===undefined?!![]:![]:!![]})[_0x6ca6('0xa')](function(_0x4c3be9){logger[_0x6ca6('0xb')](_0x6ca6('0x1a'),_0x2391ce);logger[_0x6ca6('0xe')](_0x6ca6('0x1a'),_0x2391ce,JSON[_0x6ca6('0xf')](_0x4c3be9));_0xc97f0(_0x4c3be9);})[_0x6ca6('0x14')](function(_0x593f15){logger[_0x6ca6('0x10')](_0x6ca6('0x1a'),_0x593f15['message'],_0x2391ce);_0x1f21ff(_0x10be57['error'](0x1f4,_0x593f15[_0x6ca6('0x12')]));});});}; \ No newline at end of file +var _0xde13=['then','info','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateAttachment','Attachment','body','options','raw'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xde13,0x146));var _0x3de1=function(_0x5d613c,_0x4a0d75){_0x5d613c=_0x5d613c-0x0;var _0x18dda8=_0xde13[_0x5d613c];return _0x18dda8;};'use strict';var _=require(_0x3de1('0x0'));var util=require(_0x3de1('0x1'));var moment=require(_0x3de1('0x2'));var BPromise=require(_0x3de1('0x3'));var rs=require(_0x3de1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3de1('0x5'))['db'];var utils=require(_0x3de1('0x6'));var logger=require(_0x3de1('0x7'))('rpc');var config=require(_0x3de1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3de1('0x9')][_0x3de1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d2169,_0x34291a,_0x5f1aff){return new BPromise(function(_0x11df45,_0x41b5bb){return client[_0x3de1('0xb')](_0x3d2169,_0x5f1aff)['then'](function(_0x4eb503){logger['info'](_0x3de1('0xc'),_0x34291a,_0x3de1('0xd'));logger[_0x3de1('0xe')]('Attachment,\x20%s,\x20%s,\x20%s',_0x34291a,_0x3de1('0xd'),JSON[_0x3de1('0xf')](_0x4eb503));if(_0x4eb503[_0x3de1('0x10')]){if(_0x4eb503['error']['code']===0x1f4){logger[_0x3de1('0x10')]('Attachment,\x20%s,\x20%s',_0x34291a,_0x4eb503['error']['message']);return _0x41b5bb(_0x4eb503[_0x3de1('0x10')][_0x3de1('0x11')]);}logger[_0x3de1('0x10')](_0x3de1('0xc'),_0x34291a,_0x4eb503['error'][_0x3de1('0x11')]);return _0x11df45(_0x4eb503['error'][_0x3de1('0x11')]);}else{logger['info'](_0x3de1('0xc'),_0x34291a,_0x3de1('0xd'));_0x11df45(_0x4eb503[_0x3de1('0x12')]['message']);}})[_0x3de1('0x13')](function(_0x25f619){logger[_0x3de1('0x10')](_0x3de1('0xc'),_0x34291a,_0x25f619);_0x41b5bb(_0x25f619);});});}exports[_0x3de1('0x14')]=function(_0x510e5a){var _0x19254b=this;return new Promise(function(_0x5a10f2,_0x1e5a06){return db[_0x3de1('0x15')]['create'](_0x510e5a[_0x3de1('0x16')],{'raw':_0x510e5a['options']?_0x510e5a[_0x3de1('0x17')][_0x3de1('0x18')]===undefined?!![]:![]:!![]})[_0x3de1('0x19')](function(_0x5635b5){logger[_0x3de1('0x1a')](_0x3de1('0x14'),_0x510e5a);logger[_0x3de1('0xe')]('CreateAttachment',_0x510e5a,JSON[_0x3de1('0xf')](_0x5635b5));_0x5a10f2(_0x5635b5);})[_0x3de1('0x13')](function(_0x594bdb){logger['error'](_0x3de1('0x14'),_0x594bdb[_0x3de1('0x11')],_0x510e5a);_0x1e5a06(_0x19254b[_0x3de1('0x10')](0x1f4,_0x594bdb[_0x3de1('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 9120fa5..539a3bb 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x47b15f,_0x103e93){var _0x55bf25=function(_0x51fe7f){while(--_0x51fe7f){_0x47b15f['push'](_0x47b15f['shift']());}};_0x55bf25(++_0x103e93);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5f66[_0x3e5086];return _0xfeb102;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./attachment.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file +var _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(_0x45271f,_0x4b7389){var _0x1ff8ab=function(_0x222ae2){while(--_0x222ae2){_0x45271f['push'](_0x45271f['shift']());}};_0x1ff8ab(++_0x4b7389);}(_0x2032,0xd9));var _0x2203=function(_0x4057ec,_0x28f6ab){_0x4057ec=_0x4057ec-0x0;var _0x2090e6=_0x2032[_0x4057ec];return _0x2090e6;};'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 6b4308f..098359e 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 _0x66ad=['Strategy','moment','activedirectory2','bluebird','util','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','disabled','blockedAt','online','admin','user','agent','clearBlockUser','catch','status','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','passport','passport-local'];(function(_0x423b7e,_0x3387b8){var _0x1974cb=function(_0x1697b0){while(--_0x1697b0){_0x423b7e['push'](_0x423b7e['shift']());}};_0x1974cb(++_0x3387b8);}(_0x66ad,0x1d7));var _0xd66a=function(_0x5e7235,_0x241f0c){_0x5e7235=_0x5e7235-0x0;var _0x5b2e45=_0x66ad[_0x5e7235];return _0x5b2e45;};'use strict';var passport=require(_0xd66a('0x0'));var LocalStrategy=require(_0xd66a('0x1'))[_0xd66a('0x2')];var moment=require(_0xd66a('0x3'));var ActiveDirectory=require(_0xd66a('0x4'));var BPromise=require(_0xd66a('0x5'));var util=require(_0xd66a('0x6'));var db=require('../../mysqldb')['db'];var authService=require(_0xd66a('0x7'));var utils=require(_0xd66a('0x8'));var config=require(_0xd66a('0x9'));var logger=require(_0xd66a('0xa'))(_0xd66a('0xb'));function isActiveDirectoryConfigured(_0x2a0a95){var _0x442cc8=![];if(typeof _0x2a0a95[_0xd66a('0xc')]!==_0xd66a('0xd')){_0x442cc8=_0x2a0a95['activedirectory'][_0xd66a('0xe')]&&_0x2a0a95['activedirectory']['url']&&_0x2a0a95['activedirectory'][_0xd66a('0xf')];}return _0x442cc8;}function adAuthenticate(_0x618032,_0x2ef18c,_0x92b1f2){return new BPromise(function(_0x39dc71,_0x3404c3){try{var _0x48bc80=new ActiveDirectory(_0x618032);_0x48bc80[_0xd66a('0x10')](_0x2ef18c,_0x92b1f2,function(_0x517ede,_0x1f5837){if(_0x517ede){logger[_0xd66a('0x11')](_0xd66a('0x12'),_0x2ef18c,util['inspect'](_0x517ede,{'showHidden':![],'depth':null}));_0x3404c3(_0xd66a('0x13'));}else if(!_0x1f5837){logger[_0xd66a('0x11')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x2ef18c);_0x3404c3('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x39dc71(_0x1f5837);}});}catch(_0x163f37){_0x3404c3(_0x163f37);}});}function ActiveDirectoryAuthenticate(_0x42abac,_0x794cae,_0x323b17,_0x30a4b3){var _0x9d4ccb,_0xfc96a3;if(!isActiveDirectoryConfigured(config)){logger[_0xd66a('0x11')](_0xd66a('0x14'),_0x794cae);return _0x30a4b3(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db['Setting'][_0xd66a('0x15')]({'where':{'id':0x1},'attributes':[_0xd66a('0x16'),_0xd66a('0x17')],'raw':!![]})[_0xd66a('0x18')](function(_0x982a9f){_0x9d4ccb=_0x982a9f;if(!_0x9d4ccb[_0xd66a('0x16')]){logger[_0xd66a('0x11')](_0xd66a('0x19'),_0x794cae);throw new Error(_0xd66a('0x13'));}return _0x42abac[_0xd66a('0x15')]({'logging':!![],'attributes':['id',_0xd66a('0x1a'),_0xd66a('0x1b'),_0xd66a('0x1c'),'role',_0xd66a('0x1d'),'blocked',_0xd66a('0x1e'),_0xd66a('0x1f')],'where':{'name':_0x794cae,'role':{'$or':[_0xd66a('0x20'),_0xd66a('0x21'),_0xd66a('0x22')]},'adSsoEnabled':!![]}});})['then'](function(_0xc4c854){if(!_0xc4c854||_0xc4c854&&_0xc4c854[_0xd66a('0x1a')]!==_0x794cae){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0xfc96a3=_0xc4c854;var _0x5f098c=_0xfc96a3['name']+'@'+config[_0xd66a('0xc')]['domain'];return adAuthenticate(config[_0xd66a('0xc')],_0x5f098c,_0x323b17);})[_0xd66a('0x18')](function(_0x628408){if(_0xfc96a3[_0xd66a('0x1d')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x9d4ccb[_0xd66a('0x17')]>0x0){if(_0xfc96a3['blocked']){if(moment(_0xfc96a3[_0xd66a('0x1e')])['add'](_0x9d4ccb[_0xd66a('0x17')],'minutes')>moment()){throw new Error(_0xd66a('0x13'));}return utils[_0xd66a('0x23')](_0xfc96a3,0x0,![],null)['then'](function(){return utils['getLicense'](_0xfc96a3);})[_0xd66a('0x18')](function(){return _0x30a4b3(null,_0xfc96a3);});}else{return utils['getLicense'](_0xfc96a3)[_0xd66a('0x18')](function(){return _0x30a4b3(null,_0xfc96a3);});}}else{return utils['getLicense'](_0xfc96a3)[_0xd66a('0x18')](function(){return _0x30a4b3(null,_0xfc96a3);});}})[_0xd66a('0x24')](function(_0x1a7d0f){return _0x30a4b3(null,![],_0x1a7d0f);});}function handleError(_0x1af3ed,_0x2156c5,_0x373892){return _0x1af3ed[_0xd66a('0x25')](_0x2156c5||0x1f4)['send']({'message':_0x373892?_0x373892['message']||_0x373892:''});}exports[_0xd66a('0x26')]=function(_0x406b34,_0x8d5c7,_0x5706ca){passport[_0xd66a('0x10')](_0xd66a('0x27'),function(_0x29e518,_0x51621c,_0x18344b){var _0x2dc078=_0x29e518||_0x18344b;if(_0x2dc078){return handleError(_0x8d5c7,0x191,_0x2dc078);}if(!_0x51621c){return handleError(_0x8d5c7,0x194,{'message':_0xd66a('0x28')});}else{var _0x2f48b7={'payload':{'id':_0x51621c['id'],'role':_0x51621c[_0xd66a('0x29')]},'options':{'expiresIn':0x15180}};return authService[_0xd66a('0x2a')](_0x2f48b7)[_0xd66a('0x18')](function(_0xcc0015){_0x8d5c7['json']({'id':_0x51621c['id'],'token':_0xcc0015,'statusCall':'','isAlreadyLogged':_0x51621c[_0xd66a('0x1f')]});});}})(_0x406b34,_0x8d5c7,_0x5706ca);};passport['use'](_0xd66a('0x27'),new LocalStrategy({'usernameField':_0xd66a('0x1a'),'passwordField':'password'},function(_0x27d037,_0x197886,_0xb3ff2e){return ActiveDirectoryAuthenticate(db['User'],_0x27d037,_0x197886,_0xb3ff2e);})); \ No newline at end of file +var _0x2207=['../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','undefined','activedirectory','url','domain','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:\x20Active\x20Directory\x20not\x20configured','adSsoEnabled','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','name','password','salt','disabled','blockedAt','online','admin','blockDuration','blocked','minutes','clearBlockUser','getLicense','catch','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','passport','passport-local','Strategy','activedirectory2','bluebird','util'];(function(_0x56a3a8,_0x356ae0){var _0x4d9814=function(_0x4aae00){while(--_0x4aae00){_0x56a3a8['push'](_0x56a3a8['shift']());}};_0x4d9814(++_0x356ae0);}(_0x2207,0x15a));var _0x7220=function(_0xc95853,_0x165cfa){_0xc95853=_0xc95853-0x0;var _0x23d7e1=_0x2207[_0xc95853];return _0x23d7e1;};'use strict';var passport=require(_0x7220('0x0'));var LocalStrategy=require(_0x7220('0x1'))[_0x7220('0x2')];var moment=require('moment');var ActiveDirectory=require(_0x7220('0x3'));var BPromise=require(_0x7220('0x4'));var util=require(_0x7220('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0x7220('0x6'));var utils=require(_0x7220('0x7'));var config=require(_0x7220('0x8'));var logger=require(_0x7220('0x9'))(_0x7220('0xa'));function isActiveDirectoryConfigured(_0xb53e89){var _0x17e21d=![];if(typeof _0xb53e89['activedirectory']!==_0x7220('0xb')){_0x17e21d=_0xb53e89[_0x7220('0xc')]['baseDN']&&_0xb53e89['activedirectory'][_0x7220('0xd')]&&_0xb53e89[_0x7220('0xc')][_0x7220('0xe')];}return _0x17e21d;}function adAuthenticate(_0x6ce05a,_0x426893,_0x1e5be3){return new BPromise(function(_0x57457c,_0x4db8fb){try{var _0x531747=new ActiveDirectory(_0x6ce05a);_0x531747[_0x7220('0xf')](_0x426893,_0x1e5be3,function(_0x556de5,_0x3711d9){if(_0x556de5){logger[_0x7220('0x10')](_0x7220('0x11'),_0x426893,util[_0x7220('0x12')](_0x556de5,{'showHidden':![],'depth':null}));_0x4db8fb(_0x7220('0x13'));}else if(!_0x3711d9){logger[_0x7220('0x10')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x426893);_0x4db8fb(_0x7220('0x13'));}else{_0x57457c(_0x3711d9);}});}catch(_0x4d60fe){_0x4db8fb(_0x4d60fe);}});}function ActiveDirectoryAuthenticate(_0x1bc60a,_0xece26f,_0x466f05,_0x5c53f3){var _0x58e94f,_0x332223;if(!isActiveDirectoryConfigured(config)){logger[_0x7220('0x10')](_0x7220('0x14'),_0xece26f);return _0x5c53f3(null,![],{'message':_0x7220('0x13')});}return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x7220('0x15'),'blockDuration'],'raw':!![]})[_0x7220('0x16')](function(_0x4bd026){_0x58e94f=_0x4bd026;if(!_0x58e94f['adSsoEnabled']){logger['error'](_0x7220('0x17'),_0xece26f);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x1bc60a[_0x7220('0x18')]({'logging':!![],'attributes':['id',_0x7220('0x19'),_0x7220('0x1a'),_0x7220('0x1b'),'role',_0x7220('0x1c'),'blocked',_0x7220('0x1d'),_0x7220('0x1e')],'where':{'name':_0xece26f,'role':{'$or':[_0x7220('0x1f'),'user','agent']},'adSsoEnabled':!![]}});})['then'](function(_0x37408d){if(!_0x37408d||_0x37408d&&_0x37408d[_0x7220('0x19')]!==_0xece26f){throw new Error(_0x7220('0x13'));}_0x332223=_0x37408d;var _0x3c5e1e=_0x332223['name']+'@'+config[_0x7220('0xc')]['domain'];return adAuthenticate(config[_0x7220('0xc')],_0x3c5e1e,_0x466f05);})['then'](function(_0x1a3741){if(_0x332223[_0x7220('0x1c')]){throw new Error(_0x7220('0x13'));}if(_0x58e94f[_0x7220('0x20')]>0x0){if(_0x332223[_0x7220('0x21')]){if(moment(_0x332223[_0x7220('0x1d')])['add'](_0x58e94f[_0x7220('0x20')],_0x7220('0x22'))>moment()){throw new Error(_0x7220('0x13'));}return utils[_0x7220('0x23')](_0x332223,0x0,![],null)[_0x7220('0x16')](function(){return utils['getLicense'](_0x332223);})[_0x7220('0x16')](function(){return _0x5c53f3(null,_0x332223);});}else{return utils[_0x7220('0x24')](_0x332223)[_0x7220('0x16')](function(){return _0x5c53f3(null,_0x332223);});}}else{return utils[_0x7220('0x24')](_0x332223)[_0x7220('0x16')](function(){return _0x5c53f3(null,_0x332223);});}})[_0x7220('0x25')](function(_0x2d7d99){return _0x5c53f3(null,![],_0x2d7d99);});}function handleError(_0x3fe4eb,_0x2cd026,_0x683625){return _0x3fe4eb[_0x7220('0x26')](_0x2cd026||0x1f4)[_0x7220('0x27')]({'message':_0x683625?_0x683625[_0x7220('0x28')]||_0x683625:''});}exports[_0x7220('0x29')]=function(_0x52a4a5,_0x48a43b,_0x23d3aa){passport[_0x7220('0xf')](_0x7220('0x2a'),function(_0x14c56b,_0x14380b,_0x3ce6b9){var _0x2ce307=_0x14c56b||_0x3ce6b9;if(_0x2ce307){return handleError(_0x48a43b,0x191,_0x2ce307);}if(!_0x14380b){return handleError(_0x48a43b,0x194,{'message':_0x7220('0x2b')});}else{var _0xa5e8ab={'payload':{'id':_0x14380b['id'],'role':_0x14380b['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0xa5e8ab)[_0x7220('0x16')](function(_0x1aab84){_0x48a43b['json']({'id':_0x14380b['id'],'token':_0x1aab84,'statusCall':'','isAlreadyLogged':_0x14380b['online']});});}})(_0x52a4a5,_0x48a43b,_0x23d3aa);};passport['use']('ad-login',new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x1642bd,_0x3c1d1e,_0x56fe11){return ActiveDirectoryAuthenticate(db['User'],_0x1642bd,_0x3c1d1e,_0x56fe11);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index e771873..8a2732d 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 _0x2f98=['./authActiveDirectory.controller','post','login','exports','Router'];(function(_0x3b150c,_0x2f93f8){var _0x5cd414=function(_0x26305e){while(--_0x26305e){_0x3b150c['push'](_0x3b150c['shift']());}};_0x5cd414(++_0x2f93f8);}(_0x2f98,0x1e9));var _0x82f9=function(_0x59b776,_0x1f35fb){_0x59b776=_0x59b776-0x0;var _0x3b7e00=_0x2f98[_0x59b776];return _0x3b7e00;};'use strict';var express=require('express');var router=express[_0x82f9('0x0')]();var controller=require(_0x82f9('0x1'));router[_0x82f9('0x2')]('/',controller[_0x82f9('0x3')]);module[_0x82f9('0x4')]=router; \ No newline at end of file +var _0x0021=['exports','express','Router','post','login'];(function(_0x382bea,_0x5a8ef7){var _0x1ab45b=function(_0x1b7387){while(--_0x1b7387){_0x382bea['push'](_0x382bea['shift']());}};_0x1ab45b(++_0x5a8ef7);}(_0x0021,0x74));var _0x1002=function(_0x340756,_0xad31ae){_0x340756=_0x340756-0x0;var _0x2ef745=_0x0021[_0x340756];return _0x2ef745;};'use strict';var express=require(_0x1002('0x0'));var router=express[_0x1002('0x1')]();var controller=require('./authActiveDirectory.controller');router[_0x1002('0x2')]('/',controller[_0x1002('0x3')]);module[_0x1002('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 41a7ef0..a78ca81 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(_0x2115ef,_0xcdb4ee){var _0x2804ac=function(_0x85546b){while(--_0x85546b){_0x2115ef['push'](_0x2115ef['shift']());}};_0x2804ac(++_0xcdb4ee);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 _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(_0x37843a,_0x584515){var _0x14914c=function(_0x334f61){while(--_0x334f61){_0x37843a['push'](_0x37843a['shift']());}};_0x14914c(++_0x584515);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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 diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 47a320a..a3156d2 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 _0x8512=['get','login','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js'];(function(_0x28688d,_0x190a6c){var _0x2c043e=function(_0x3f5c61){while(--_0x3f5c61){_0x28688d['push'](_0x28688d['shift']());}};_0x2c043e(++_0x190a6c);}(_0x8512,0x70));var _0x2851=function(_0x3653d5,_0x153721){_0x3653d5=_0x3653d5-0x0;var _0x2079c1=_0x8512[_0x3653d5];return _0x2079c1;};'use strict';var express=require(_0x2851('0x0'));var passport=require(_0x2851('0x1'));var router=express[_0x2851('0x2')]();var controller=require(_0x2851('0x3'));var userController=require(_0x2851('0x4'));var authService=require('../../components/auth/service');router[_0x2851('0x5')]('/',controller[_0x2851('0x6')]);router[_0x2851('0x5')]('/callback',controller['callback'],authService['isMiddleware'],userController[_0x2851('0x6')],authService[_0x2851('0x7')]);module[_0x2851('0x8')]=router; \ No newline at end of file +var _0xff19=['get','/callback','callback','login','setTokenCookie','exports','express','passport','../user/user.controller.js','../../components/auth/service'];(function(_0x41d0c5,_0x25be23){var _0x202119=function(_0x3d21e4){while(--_0x3d21e4){_0x41d0c5['push'](_0x41d0c5['shift']());}};_0x202119(++_0x25be23);}(_0xff19,0x100));var _0x9ff1=function(_0x5b1be8,_0x52c4ac){_0x5b1be8=_0x5b1be8-0x0;var _0x24cd44=_0xff19[_0x5b1be8];return _0x24cd44;};'use strict';var express=require(_0x9ff1('0x0'));var passport=require(_0x9ff1('0x1'));var router=express['Router']();var controller=require('./authGoogle.controller');var userController=require(_0x9ff1('0x2'));var authService=require(_0x9ff1('0x3'));router[_0x9ff1('0x4')]('/',controller['login']);router['get'](_0x9ff1('0x5'),controller[_0x9ff1('0x6')],authService['isMiddleware'],userController[_0x9ff1('0x7')],authService[_0x9ff1('0x8')]);module[_0x9ff1('0x9')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index f94e82e..c27dcb8 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 _0xf009=['Email\x20parameter\x20is\x20missing','generate','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','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','previousPasswords','validatePasswordHistory','Password\x20reset!','use','passport','passport-local','Strategy','lodash','randomstring','../../mysqldb','../../config/utils','client','Setting','findOne','allowedLoginAttempts','blockDuration','then','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','auth','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','message','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','forgot','body'];(function(_0x355316,_0x41e384){var _0x1e4853=function(_0x443e02){while(--_0x443e02){_0x355316['push'](_0x355316['shift']());}};_0x1e4853(++_0x41e384);}(_0xf009,0x174));var _0x9f00=function(_0x4ba8c3,_0x33c457){_0x4ba8c3=_0x4ba8c3-0x0;var _0xf65364=_0xf009[_0x4ba8c3];return _0xf65364;};'use strict';var util=require('util');var passport=require(_0x9f00('0x0'));var LocalStrategy=require(_0x9f00('0x1'))[_0x9f00('0x2')];var jayson=require('jayson/promise');var _=require(_0x9f00('0x3'));var rs=require(_0x9f00('0x4'));var moment=require('moment');var db=require(_0x9f00('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x9f00('0x6'));var client=jayson[_0x9f00('0x7')]['http']({'port':0x232b});function localAuthenticate(_0x4527a1,_0x18a40d,_0x33516e,_0x363ffc){var _0x422c5c,_0x1457b0;return db[_0x9f00('0x8')][_0x9f00('0x9')]({'where':{'id':0x1},'attributes':[_0x9f00('0xa'),_0x9f00('0xb')],'raw':!![]})[_0x9f00('0xc')](function(_0x755bd3){_0x422c5c=_0x755bd3;return _0x4527a1[_0x9f00('0x9')]({'attributes':['id','name',_0x9f00('0xd'),_0x9f00('0xe'),_0x9f00('0xf'),_0x9f00('0x10'),_0x9f00('0x11'),_0x9f00('0x12'),_0x9f00('0x13')],'where':{'name':_0x18a40d,'role':{'$or':[_0x9f00('0x14'),_0x9f00('0x15'),'agent']}}});})[_0x9f00('0xc')](function(_0x5b422d){if(!_0x5b422d||_0x5b422d&&_0x5b422d[_0x9f00('0x16')]!==_0x18a40d){throw new Error(_0x9f00('0x17'));}else{_0x1457b0=_0x5b422d;return _0x1457b0;}})[_0x9f00('0xc')](function(){_0x1457b0[_0x9f00('0x18')](_0x33516e,function(_0x5cfedc,_0xe06a71){var _0x21a25c=_0x1457b0[_0x9f00('0x13')]+0x1;if(_0x5cfedc){return _0x363ffc(_0x5cfedc);}else if(!_0xe06a71){if(_0x1457b0[_0x9f00('0x10')]){return _0x363ffc(null,![],{'message':_0x9f00('0x17')});}else if(_0x422c5c[_0x9f00('0xa')]>0x0){if(_0x1457b0[_0x9f00('0x11')]){if(_0x422c5c['blockDuration']>0x0){if(moment(_0x1457b0[_0x9f00('0x12')])[_0x9f00('0x19')](_0x422c5c[_0x9f00('0xb')],_0x9f00('0x1a'))>moment()){return _0x363ffc(null,![],{'message':_0x9f00('0x17')});}else{return utils[_0x9f00('0x1b')](_0x1457b0,_0x21a25c,![],null)[_0x9f00('0xc')](function(){return _0x363ffc(null,![],{'message':_0x9f00('0x17')});});}}else{return _0x363ffc(null,![],{'message':_0x9f00('0x17')});}}else{if(_0x21a25c>=_0x422c5c[_0x9f00('0xa')]){return utils[_0x9f00('0x1b')](_0x1457b0,0x0,!![],moment())[_0x9f00('0xc')](function(){return _0x363ffc(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0x1457b0,_0x21a25c,![],null)['then'](function(){return _0x363ffc(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x363ffc(null,![],{'message':_0x9f00('0x17')});}}else{if(_0x1457b0[_0x9f00('0x10')]){return _0x363ffc(null,![],{'message':_0x9f00('0x17')});}else if(_0x422c5c[_0x9f00('0xa')]>0x0){if(_0x1457b0['blocked']){if(_0x422c5c[_0x9f00('0xb')]>0x0){if(moment(_0x1457b0[_0x9f00('0x12')])[_0x9f00('0x19')](_0x422c5c['blockDuration'],_0x9f00('0x1a'))>moment()){return _0x363ffc(null,![],{'message':_0x9f00('0x17')});}else{return utils[_0x9f00('0x1b')](_0x1457b0,0x0,![],null)[_0x9f00('0xc')](function(){return utils[_0x9f00('0x1c')](_0x1457b0);})[_0x9f00('0xc')](function(){return _0x363ffc(null,_0x1457b0);});}}else{return _0x363ffc(null,![],{'message':_0x9f00('0x17')});}}else{return utils['clearBlockUser'](_0x1457b0,0x0,![],null)[_0x9f00('0xc')](function(){return utils[_0x9f00('0x1c')](_0x1457b0);})[_0x9f00('0xc')](function(){return _0x363ffc(null,_0x1457b0);})[_0x9f00('0x1d')](function(_0x1b83a9){return _0x363ffc(null,![],_0x1b83a9);});}}else{if(_0x1457b0[_0x9f00('0x11')]){return _0x363ffc(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x9f00('0x1c')](_0x1457b0)[_0x9f00('0xc')](function(){return _0x363ffc(null,_0x1457b0);});}}}});})[_0x9f00('0x1d')](function(_0x1cfa41){return _0x363ffc(null,![],_0x1cfa41);});}function sendServiceMail(_0x14aec5){return db[_0x9f00('0x1e')][_0x9f00('0x1f')]({'where':{'service':!![]},'attributes':['id','name',_0x9f00('0x20')],'include':[{'model':db[_0x9f00('0x21')],'as':_0x9f00('0x22')}]})['then'](function(_0x123571){if(!_0x123571){throw new Error(_0x9f00('0x23'));}var _0x19a5cb={'tls':{'rejectUnauthorized':![]}};if(_0x123571['Smtp'][_0x9f00('0x24')]){_0x19a5cb[_0x9f00('0x24')]=_0x123571[_0x9f00('0x22')][_0x9f00('0x24')];}else{_0x19a5cb['host']=_0x123571[_0x9f00('0x22')][_0x9f00('0x25')];_0x19a5cb['port']=_0x123571[_0x9f00('0x22')][_0x9f00('0x26')];_0x19a5cb[_0x9f00('0x27')]=_0x123571[_0x9f00('0x22')][_0x9f00('0x27')];}if(_0x123571[_0x9f00('0x22')]['authentication']){_0x19a5cb[_0x9f00('0x28')]={'user':_0x123571['Smtp']['user'],'pass':_0x123571[_0x9f00('0x22')]['pass']};}var _0x48a0d4={'account':_0x19a5cb,'message':_['merge']({'from':util[_0x9f00('0x29')](_0x9f00('0x2a'),_0x123571[_0x9f00('0x16')],_0x123571[_0x9f00('0x20')]||_0x123571[_0x9f00('0x22')][_0x9f00('0x15')])},_0x14aec5)};return client[_0x9f00('0x2b')](_0x9f00('0x2c'),_0x48a0d4);})['then'](function(_0x2bedfa){if(_0x2bedfa[_0x9f00('0x2d')]){throw new Error(util[_0x9f00('0x29')](_0x9f00('0x2e'),_0x2bedfa['error']['message']||JSON[_0x9f00('0x2f')](_0x2bedfa[_0x9f00('0x2d')])));}return!![];});}function handleError(_0x1212ce,_0x205edb,_0x38fe54){return _0x1212ce[_0x9f00('0x30')](_0x205edb||0x1f4)[_0x9f00('0x31')]({'message':_0x38fe54?_0x38fe54[_0x9f00('0x32')]||_0x38fe54:''});}exports[_0x9f00('0x33')]=function(_0x390341,_0xe3e634,_0x248f4e){passport[_0x9f00('0x18')](_0x9f00('0x34'),function(_0x129942,_0x60a347,_0x501b4c){var _0x44cbe8=_0x129942||_0x501b4c;if(_0x44cbe8){return handleError(_0xe3e634,0x191,_0x44cbe8);}if(!_0x60a347){return handleError(_0xe3e634,0x194,{'message':_0x9f00('0x35')});}else{var _0x95a01a={'payload':{'id':_0x60a347['id'],'role':_0x60a347[_0x9f00('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0x9f00('0x36')](_0x95a01a)[_0x9f00('0xc')](function(_0x3a7449){_0xe3e634['json']({'id':_0x60a347['id'],'token':_0x3a7449,'statusCall':'','isAlreadyLogged':_0x60a347[_0x9f00('0x37')]});});}})(_0x390341,_0xe3e634,_0x248f4e);};exports[_0x9f00('0x38')]=function(_0x592fe8,_0x2740d5,_0x4a97fc){if(!_0x592fe8[_0x9f00('0x39')][_0x9f00('0x20')]){return handleError(_0x2740d5,0x1f4,{'message':_0x9f00('0x3a')});}var _0x182071=rs[_0x9f00('0x3b')]();_0x592fe8['body'][_0x9f00('0x20')]=_0x592fe8[_0x9f00('0x39')][_0x9f00('0x20')][_0x9f00('0x3c')]()[_0x9f00('0x3d')]();var _0x451062;return db[_0x9f00('0x8')][_0x9f00('0x9')]({'where':{'id':0x1},'attributes':[_0x9f00('0xa'),_0x9f00('0xb')],'raw':!![]})[_0x9f00('0xc')](function(_0x4f03ef){_0x451062=_0x4f03ef;return db[_0x9f00('0x3e')][_0x9f00('0x1f')]({'where':{'email':_0x592fe8['body'][_0x9f00('0x20')]}});})['then'](function(_0x2231cb){if(!_0x2231cb){throw new Error(_0x9f00('0x3f'));}if(_0x2231cb['disabled']){throw new Error(_0x9f00('0x40'));}if(_0x2231cb[_0x9f00('0x11')]){if(moment(_0x2231cb[_0x9f00('0x12')])[_0x9f00('0x19')](_0x451062[_0x9f00('0xb')],_0x9f00('0x1a'))>moment()){throw new Error(_0x9f00('0x41'));}else{_0x2231cb[_0x9f00('0x11')]=![];_0x2231cb[_0x9f00('0x12')]=null;}}_0x2231cb[_0x9f00('0x42')]=_0x182071;_0x2231cb[_0x9f00('0x43')]=Date[_0x9f00('0x44')]()+0x36ee80;return _0x2231cb[_0x9f00('0x45')]();})[_0x9f00('0xc')](function(){return sendServiceMail({'to':_0x592fe8[_0x9f00('0x39')][_0x9f00('0x20')],'subject':_0x9f00('0x46'),'text':_0x9f00('0x47')+_0x9f00('0x48')+'https://'+_0x592fe8[_0x9f00('0x49')][_0x9f00('0x25')]+_0x9f00('0x4a')+_0x182071+'\x0a\x0a'+_0x9f00('0x4b')});})[_0x9f00('0xc')](function(){_0x2740d5['status'](0xc8)[_0x9f00('0x31')]({'message':_0x9f00('0x4c')});})[_0x9f00('0x1d')](function(_0x20a615){return handleError(_0x2740d5,0x1f4,_0x20a615);});};exports['reset']=function(_0xea5140,_0x3346c7,_0x4051a1){return db[_0x9f00('0x3e')][_0x9f00('0x1f')]({'where':{'resetPasswordToken':_0xea5140[_0x9f00('0x4d')]['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x9f00('0xc')](function(_0x13cd17){if(!_0x13cd17){throw new Error(_0x9f00('0x4e'));}return db[_0x9f00('0x8')]['findOne']({'attributes':['id','securePassword','enforcePasswordHistory',_0x9f00('0x4f')]})[_0x9f00('0xc')](function(_0x1b6c86){if(_0x1b6c86['securePassword'])authService[_0x9f00('0x50')](_0xea5140[_0x9f00('0x39')]['password']);if(!_0x1b6c86[_0x9f00('0x51')]||!_0x13cd17[_0x9f00('0x52')])return _0x13cd17;authService[_0x9f00('0x53')](_0xea5140[_0x9f00('0x39')][_0x9f00('0xd')],_0x13cd17[_0x9f00('0x52')],_0x1b6c86['passwordHistoryLimit']);return _0x13cd17;})[_0x9f00('0xc')](function(){_0x13cd17[_0x9f00('0xd')]=_0xea5140['body'][_0x9f00('0xd')];_0x13cd17[_0x9f00('0x42')]=null;_0x13cd17['resetPasswordExpires']=null;return _0x13cd17[_0x9f00('0x45')]();});})[_0x9f00('0xc')](function(){_0x3346c7['status'](0xc8)[_0x9f00('0x31')]({'message':_0x9f00('0x54')});})[_0x9f00('0x1d')](function(_0x3d6747){return handleError(_0x3346c7,0x1f4,_0x3d6747);});};passport[_0x9f00('0x55')]('local-login',new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x4982fe,_0x3038aa,_0x16f30d){return localAuthenticate(db[_0x9f00('0x3e')],_0x4982fe,_0x3038aa,_0x16f30d);})); \ No newline at end of file +var _0xae91=['clearBlockUser','blockedAt','getLicense','catch','MailAccount','find','MailServerOut','service','Smtp','host','port','secure','authentication','merge','format','\x22%s\x22\x20<%s>','email','error','message','stringify','status','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','generate','trim','toLowerCase','User','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','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://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','Reset\x20Email\x20sent!','reset','params','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','findOne','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','Password\x20reset!','util','passport','jayson/promise','lodash','randomstring','../../components/auth/service','../../config/utils','http','Setting','allowedLoginAttempts','blockDuration','name','password','salt','disabled','blocked','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','then','authenticate','loginAttempts','add','minutes'];(function(_0x1a111e,_0x1b6e92){var _0x55664b=function(_0x1ccbc7){while(--_0x1ccbc7){_0x1a111e['push'](_0x1a111e['shift']());}};_0x55664b(++_0x1b6e92);}(_0xae91,0xe0));var _0x1ae9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xae91[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0x1ae9('0x0'));var passport=require(_0x1ae9('0x1'));var LocalStrategy=require('passport-local')['Strategy'];var jayson=require(_0x1ae9('0x2'));var _=require(_0x1ae9('0x3'));var rs=require(_0x1ae9('0x4'));var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0x1ae9('0x5'));var utils=require(_0x1ae9('0x6'));var client=jayson['client'][_0x1ae9('0x7')]({'port':0x232b});function localAuthenticate(_0x3de499,_0x8d30eb,_0x16a618,_0x1d3dd6){var _0x54d5df,_0x26bbd2;return db[_0x1ae9('0x8')]['findOne']({'where':{'id':0x1},'attributes':[_0x1ae9('0x9'),_0x1ae9('0xa')],'raw':!![]})['then'](function(_0x13a385){_0x54d5df=_0x13a385;return _0x3de499['findOne']({'attributes':['id',_0x1ae9('0xb'),_0x1ae9('0xc'),_0x1ae9('0xd'),'role',_0x1ae9('0xe'),_0x1ae9('0xf'),'blockedAt','loginAttempts'],'where':{'name':_0x8d30eb,'role':{'$or':[_0x1ae9('0x10'),_0x1ae9('0x11'),_0x1ae9('0x12')]}}});})['then'](function(_0x3bd864){if(!_0x3bd864||_0x3bd864&&_0x3bd864[_0x1ae9('0xb')]!==_0x8d30eb){throw new Error(_0x1ae9('0x13'));}else{_0x26bbd2=_0x3bd864;return _0x26bbd2;}})[_0x1ae9('0x14')](function(){_0x26bbd2[_0x1ae9('0x15')](_0x16a618,function(_0x4323d7,_0x346cf4){var _0x12599f=_0x26bbd2[_0x1ae9('0x16')]+0x1;if(_0x4323d7){return _0x1d3dd6(_0x4323d7);}else if(!_0x346cf4){if(_0x26bbd2[_0x1ae9('0xe')]){return _0x1d3dd6(null,![],{'message':_0x1ae9('0x13')});}else if(_0x54d5df['allowedLoginAttempts']>0x0){if(_0x26bbd2[_0x1ae9('0xf')]){if(_0x54d5df[_0x1ae9('0xa')]>0x0){if(moment(_0x26bbd2['blockedAt'])[_0x1ae9('0x17')](_0x54d5df['blockDuration'],_0x1ae9('0x18'))>moment()){return _0x1d3dd6(null,![],{'message':_0x1ae9('0x13')});}else{return utils[_0x1ae9('0x19')](_0x26bbd2,_0x12599f,![],null)[_0x1ae9('0x14')](function(){return _0x1d3dd6(null,![],{'message':_0x1ae9('0x13')});});}}else{return _0x1d3dd6(null,![],{'message':_0x1ae9('0x13')});}}else{if(_0x12599f>=_0x54d5df[_0x1ae9('0x9')]){return utils[_0x1ae9('0x19')](_0x26bbd2,0x0,!![],moment())['then'](function(){return _0x1d3dd6(null,![],{'message':_0x1ae9('0x13')});});}else{return utils[_0x1ae9('0x19')](_0x26bbd2,_0x12599f,![],null)[_0x1ae9('0x14')](function(){return _0x1d3dd6(null,![],{'message':_0x1ae9('0x13')});});}}}else{return _0x1d3dd6(null,![],{'message':_0x1ae9('0x13')});}}else{if(_0x26bbd2[_0x1ae9('0xe')]){return _0x1d3dd6(null,![],{'message':_0x1ae9('0x13')});}else if(_0x54d5df[_0x1ae9('0x9')]>0x0){if(_0x26bbd2['blocked']){if(_0x54d5df['blockDuration']>0x0){if(moment(_0x26bbd2[_0x1ae9('0x1a')])[_0x1ae9('0x17')](_0x54d5df['blockDuration'],_0x1ae9('0x18'))>moment()){return _0x1d3dd6(null,![],{'message':_0x1ae9('0x13')});}else{return utils[_0x1ae9('0x19')](_0x26bbd2,0x0,![],null)[_0x1ae9('0x14')](function(){return utils[_0x1ae9('0x1b')](_0x26bbd2);})[_0x1ae9('0x14')](function(){return _0x1d3dd6(null,_0x26bbd2);});}}else{return _0x1d3dd6(null,![],{'message':_0x1ae9('0x13')});}}else{return utils[_0x1ae9('0x19')](_0x26bbd2,0x0,![],null)[_0x1ae9('0x14')](function(){return utils[_0x1ae9('0x1b')](_0x26bbd2);})[_0x1ae9('0x14')](function(){return _0x1d3dd6(null,_0x26bbd2);})['catch'](function(_0x267c7b){return _0x1d3dd6(null,![],_0x267c7b);});}}else{if(_0x26bbd2['blocked']){return _0x1d3dd6(null,![],{'message':_0x1ae9('0x13')});}else{return utils[_0x1ae9('0x1b')](_0x26bbd2)[_0x1ae9('0x14')](function(){return _0x1d3dd6(null,_0x26bbd2);});}}}});})[_0x1ae9('0x1c')](function(_0x11ab23){return _0x1d3dd6(null,![],_0x11ab23);});}function sendServiceMail(_0x5460cc){return db[_0x1ae9('0x1d')][_0x1ae9('0x1e')]({'where':{'service':!![]},'attributes':['id',_0x1ae9('0xb'),'email'],'include':[{'model':db[_0x1ae9('0x1f')],'as':'Smtp'}]})[_0x1ae9('0x14')](function(_0x3850c7){if(!_0x3850c7){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x331231={'tls':{'rejectUnauthorized':![]}};if(_0x3850c7['Smtp'][_0x1ae9('0x20')]){_0x331231[_0x1ae9('0x20')]=_0x3850c7[_0x1ae9('0x21')][_0x1ae9('0x20')];}else{_0x331231[_0x1ae9('0x22')]=_0x3850c7[_0x1ae9('0x21')][_0x1ae9('0x22')];_0x331231['port']=_0x3850c7['Smtp'][_0x1ae9('0x23')];_0x331231[_0x1ae9('0x24')]=_0x3850c7[_0x1ae9('0x21')][_0x1ae9('0x24')];}if(_0x3850c7['Smtp'][_0x1ae9('0x25')]){_0x331231['auth']={'user':_0x3850c7['Smtp'][_0x1ae9('0x11')],'pass':_0x3850c7[_0x1ae9('0x21')]['pass']};}var _0x51da55={'account':_0x331231,'message':_[_0x1ae9('0x26')]({'from':util[_0x1ae9('0x27')](_0x1ae9('0x28'),_0x3850c7['name'],_0x3850c7[_0x1ae9('0x29')]||_0x3850c7[_0x1ae9('0x21')][_0x1ae9('0x11')])},_0x5460cc)};return client['request']('SendMail',_0x51da55);})['then'](function(_0x414a08){if(_0x414a08[_0x1ae9('0x2a')]){throw new Error(util[_0x1ae9('0x27')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x414a08['error'][_0x1ae9('0x2b')]||JSON[_0x1ae9('0x2c')](_0x414a08[_0x1ae9('0x2a')])));}return!![];});}function handleError(_0x2fb49f,_0x1850f9,_0xccdbdc){return _0x2fb49f[_0x1ae9('0x2d')](_0x1850f9||0x1f4)['send']({'message':_0xccdbdc?_0xccdbdc[_0x1ae9('0x2b')]||_0xccdbdc:''});}exports[_0x1ae9('0x2e')]=function(_0x5d1ef3,_0xda1821,_0x444a93){passport[_0x1ae9('0x15')](_0x1ae9('0x2f'),function(_0x3c7ebd,_0x284b68,_0x5148da){var _0x339642=_0x3c7ebd||_0x5148da;if(_0x339642){return handleError(_0xda1821,0x191,_0x339642);}if(!_0x284b68){return handleError(_0xda1821,0x194,{'message':_0x1ae9('0x30')});}else{var _0x2718fa={'payload':{'id':_0x284b68['id'],'role':_0x284b68['role']},'options':{'expiresIn':0x15180}};return authService[_0x1ae9('0x31')](_0x2718fa)[_0x1ae9('0x14')](function(_0x44253c){_0xda1821[_0x1ae9('0x32')]({'id':_0x284b68['id'],'token':_0x44253c,'statusCall':'','isAlreadyLogged':_0x284b68[_0x1ae9('0x33')]});});}})(_0x5d1ef3,_0xda1821,_0x444a93);};exports[_0x1ae9('0x34')]=function(_0x49b567,_0x466df7,_0x41ffc7){if(!_0x49b567[_0x1ae9('0x35')][_0x1ae9('0x29')]){return handleError(_0x466df7,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x2b3cb5=rs[_0x1ae9('0x36')]();_0x49b567[_0x1ae9('0x35')][_0x1ae9('0x29')]=_0x49b567[_0x1ae9('0x35')][_0x1ae9('0x29')][_0x1ae9('0x37')]()[_0x1ae9('0x38')]();var _0x403f1f;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x1ae9('0xa')],'raw':!![]})[_0x1ae9('0x14')](function(_0x2d888d){_0x403f1f=_0x2d888d;return db[_0x1ae9('0x39')][_0x1ae9('0x1e')]({'where':{'email':_0x49b567[_0x1ae9('0x35')][_0x1ae9('0x29')]}});})[_0x1ae9('0x14')](function(_0xcd79ec){if(!_0xcd79ec){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0xcd79ec[_0x1ae9('0xe')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0xcd79ec[_0x1ae9('0xf')]){if(moment(_0xcd79ec[_0x1ae9('0x1a')])[_0x1ae9('0x17')](_0x403f1f[_0x1ae9('0xa')],_0x1ae9('0x18'))>moment()){throw new Error(_0x1ae9('0x3a'));}else{_0xcd79ec[_0x1ae9('0xf')]=![];_0xcd79ec['blockedAt']=null;}}_0xcd79ec[_0x1ae9('0x3b')]=_0x2b3cb5;_0xcd79ec[_0x1ae9('0x3c')]=Date['now']()+0x36ee80;return _0xcd79ec[_0x1ae9('0x3d')]();})[_0x1ae9('0x14')](function(){return sendServiceMail({'to':_0x49b567[_0x1ae9('0x35')][_0x1ae9('0x29')],'subject':_0x1ae9('0x3e'),'text':_0x1ae9('0x3f')+_0x1ae9('0x40')+_0x1ae9('0x41')+_0x49b567[_0x1ae9('0x42')][_0x1ae9('0x22')]+_0x1ae9('0x43')+_0x2b3cb5+'\x0a\x0a'+_0x1ae9('0x44')});})['then'](function(){_0x466df7[_0x1ae9('0x2d')](0xc8)[_0x1ae9('0x45')]({'message':_0x1ae9('0x46')});})[_0x1ae9('0x1c')](function(_0xc7cf4){return handleError(_0x466df7,0x1f4,_0xc7cf4);});};exports[_0x1ae9('0x47')]=function(_0x4ec6a3,_0x1a3408,_0x1613ce){return db['User'][_0x1ae9('0x1e')]({'where':{'resetPasswordToken':_0x4ec6a3[_0x1ae9('0x48')]['token'],'resetPasswordExpires':{'$gt':Date[_0x1ae9('0x49')]()}}})[_0x1ae9('0x14')](function(_0x3b11b0){if(!_0x3b11b0){throw new Error(_0x1ae9('0x4a'));}return db[_0x1ae9('0x8')][_0x1ae9('0x4b')]({'attributes':['id',_0x1ae9('0x4c'),_0x1ae9('0x4d'),_0x1ae9('0x4e')]})[_0x1ae9('0x14')](function(_0x5f1405){if(_0x5f1405[_0x1ae9('0x4c')])authService[_0x1ae9('0x4f')](_0x4ec6a3[_0x1ae9('0x35')][_0x1ae9('0xc')]);if(!_0x5f1405[_0x1ae9('0x4d')]||!_0x3b11b0[_0x1ae9('0x50')])return _0x3b11b0;authService[_0x1ae9('0x51')](_0x4ec6a3[_0x1ae9('0x35')][_0x1ae9('0xc')],_0x3b11b0['previousPasswords'],_0x5f1405[_0x1ae9('0x4e')]);return _0x3b11b0;})[_0x1ae9('0x14')](function(){_0x3b11b0[_0x1ae9('0xc')]=_0x4ec6a3[_0x1ae9('0x35')][_0x1ae9('0xc')];_0x3b11b0[_0x1ae9('0x3b')]=null;_0x3b11b0[_0x1ae9('0x3c')]=null;return _0x3b11b0[_0x1ae9('0x3d')]();});})[_0x1ae9('0x14')](function(){_0x1a3408[_0x1ae9('0x2d')](0xc8)[_0x1ae9('0x45')]({'message':_0x1ae9('0x52')});})[_0x1ae9('0x1c')](function(_0x1c44c9){return handleError(_0x1a3408,0x1f4,_0x1c44c9);});};passport['use'](_0x1ae9('0x2f'),new LocalStrategy({'usernameField':_0x1ae9('0xb'),'passwordField':_0x1ae9('0xc')},function(_0x21126d,_0x1767e2,_0x29fcbc){return localAuthenticate(db['User'],_0x21126d,_0x1767e2,_0x29fcbc);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 81cf376..b2a5314 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 _0x46f9=['post','login','/forgot','forgot','/reset/:token','reset','exports','express','Router'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x46f9,0xb2));var _0x946f=function(_0x3678e7,_0xe378be){_0x3678e7=_0x3678e7-0x0;var _0x273d50=_0x46f9[_0x3678e7];return _0x273d50;};'use strict';var express=require(_0x946f('0x0'));var router=express[_0x946f('0x1')]();var controller=require('./authLocal.controller');router[_0x946f('0x2')]('/',controller[_0x946f('0x3')]);router['post'](_0x946f('0x4'),controller[_0x946f('0x5')]);router[_0x946f('0x2')](_0x946f('0x6'),controller[_0x946f('0x7')]);module[_0x946f('0x8')]=router; \ No newline at end of file +var _0x6757=['exports','express','Router','post','login','/forgot','forgot','/reset/:token','reset'];(function(_0x77934,_0xe8f5de){var _0x3c7e4b=function(_0x5f4917){while(--_0x5f4917){_0x77934['push'](_0x77934['shift']());}};_0x3c7e4b(++_0xe8f5de);}(_0x6757,0x10f));var _0x7675=function(_0x24b767,_0x153dee){_0x24b767=_0x24b767-0x0;var _0x2aeb6b=_0x6757[_0x24b767];return _0x2aeb6b;};'use strict';var express=require(_0x7675('0x0'));var router=express[_0x7675('0x1')]();var controller=require('./authLocal.controller');router[_0x7675('0x2')]('/',controller[_0x7675('0x3')]);router[_0x7675('0x2')](_0x7675('0x4'),controller[_0x7675('0x5')]);router[_0x7675('0x2')](_0x7675('0x6'),controller[_0x7675('0x7')]);module[_0x7675('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 0608065..4447078 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 _0x97b6=['INTEGER','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x97b6,0x79));var _0x697b=function(_0x168765,_0x534f44){_0x168765=_0x168765-0x0;var _0x3ee3a0=_0x97b6[_0x168765];return _0x3ee3a0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x697b('0x0')],'allowNull':![]},'channel':{'type':Sequelize[_0x697b('0x0')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x697b('0x1')],'defaultValue':0xa}}; \ No newline at end of file +var _0x9415=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x3adc44,_0x5187ec){var _0x463184=function(_0x3cd2c1){while(--_0x3cd2c1){_0x3adc44['push'](_0x3adc44['shift']());}};_0x463184(++_0x5187ec);}(_0x9415,0x1af));var _0x5941=function(_0x3a7e01,_0x51204c){_0x3a7e01=_0x3a7e01-0x0;var _0x5b8398=_0x9415[_0x3a7e01];return _0x5b8398;};'use strict';var Sequelize=require(_0x5941('0x0'));module[_0x5941('0x1')]={'name':{'type':Sequelize[_0x5941('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x5941('0x2')]},'description':{'type':Sequelize[_0x5941('0x2')]},'status':{'type':Sequelize[_0x5941('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x5941('0x4')],'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 bc693ec..cabff00 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 _0x99b9=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','save','update','destroy','then','end','error','stack','name','send','index','map','Automation','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','keys','find','create','body','addConditions','ids','findOne','Condition','getConditions','addActions','Action','omit','getActions','order','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service'];(function(_0x4e5f6e,_0x36c990){var _0x22d060=function(_0x486ff9){while(--_0x486ff9){_0x4e5f6e['push'](_0x4e5f6e['shift']());}};_0x22d060(++_0x36c990);}(_0x99b9,0x182));var _0x999b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x99b9[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x999b('0x0'));var rimraf=require(_0x999b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x999b('0x2'));var rp=require(_0x999b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x999b('0x4'));var util=require(_0x999b('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x999b('0x6'));var fs=require('fs');var fs_extra=require(_0x999b('0x7'));var _=require(_0x999b('0x8'));var squel=require(_0x999b('0x9'));var crypto=require(_0x999b('0xa'));var jsforce=require(_0x999b('0xb'));var deskjs=require(_0x999b('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x999b('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x999b('0xe'));var hardwareService=require(_0x999b('0xf'));var logger=require('../../config/logger')(_0x999b('0x10'));var utils=require('../../config/utils');var config=require(_0x999b('0x11'));var licenseUtil=require(_0x999b('0x12'));var db=require(_0x999b('0x13'))['db'];function respondWithStatusCode(_0x33b809,_0x126524){_0x126524=_0x126524||0xcc;return function(_0x5c2ebb){if(_0x5c2ebb){return _0x33b809[_0x999b('0x14')](_0x126524);}return _0x33b809[_0x999b('0x15')](_0x126524)['end']();};}function respondWithResult(_0x499212,_0x486703){_0x486703=_0x486703||0xc8;return function(_0x22f724){if(_0x22f724){return _0x499212[_0x999b('0x15')](_0x486703)['json'](_0x22f724);}};}function respondWithFilteredResult(_0x35bed4,_0x96c7ec){return function(_0x3b34fb){if(_0x3b34fb){var _0x6a1303=typeof _0x96c7ec[_0x999b('0x16')]===_0x999b('0x17')&&typeof _0x96c7ec[_0x999b('0x18')]==='undefined';var _0x54593f=_0x3b34fb[_0x999b('0x19')];var _0x3446ff=_0x6a1303?0x0:_0x96c7ec[_0x999b('0x16')];var _0x5f3d35=_0x6a1303?_0x3b34fb[_0x999b('0x19')]:_0x96c7ec[_0x999b('0x16')]+_0x96c7ec[_0x999b('0x18')];var _0x4d7cf7;if(_0x5f3d35>=_0x54593f){_0x5f3d35=_0x54593f;_0x4d7cf7=0xc8;}else{_0x4d7cf7=0xce;}_0x35bed4[_0x999b('0x15')](_0x4d7cf7);return _0x35bed4[_0x999b('0x1a')]('Content-Range',_0x3446ff+'-'+_0x5f3d35+'/'+_0x54593f)[_0x999b('0x1b')](_0x3b34fb);}return null;};}function patchUpdates(_0x57f51b){return function(_0x40b911){try{jsonpatch[_0x999b('0x1c')](_0x40b911,_0x57f51b,!![]);}catch(_0x4056c3){return BPromise['reject'](_0x4056c3);}return _0x40b911[_0x999b('0x1d')]();};}function saveUpdates(_0x367271,_0x5bfc41){return function(_0x227571){if(_0x227571){return _0x227571[_0x999b('0x1e')](_0x367271)['then'](function(_0x5ed404){return _0x5ed404;});}return null;};}function removeEntity(_0x20d25e,_0x38aa89){return function(_0x365a25){if(_0x365a25){return _0x365a25[_0x999b('0x1f')]()[_0x999b('0x20')](function(){_0x20d25e['status'](0xcc)[_0x999b('0x21')]();});}};}function handleEntityNotFound(_0x272891,_0x277bd2){return function(_0x8d40d3){if(!_0x8d40d3){_0x272891['sendStatus'](0x194);}return _0x8d40d3;};}function handleError(_0x4e5137,_0x4585b7){_0x4585b7=_0x4585b7||0x1f4;return function(_0x58b77d){logger[_0x999b('0x22')](_0x58b77d[_0x999b('0x23')]);if(_0x58b77d[_0x999b('0x24')]){delete _0x58b77d[_0x999b('0x24')];}_0x4e5137[_0x999b('0x15')](_0x4585b7)[_0x999b('0x25')](_0x58b77d);};}exports[_0x999b('0x26')]=function(_0x2ad158,_0x4da34f){var _0x3455ff={},_0x30d609={},_0x4d0d11={'count':0x0,'rows':[]};var _0x59fbd3=_[_0x999b('0x27')](db[_0x999b('0x28')]['rawAttributes'],function(_0x176ca9){return{'name':_0x176ca9[_0x999b('0x29')],'type':_0x176ca9[_0x999b('0x2a')][_0x999b('0x2b')]};});_0x30d609['model']=_[_0x999b('0x27')](_0x59fbd3,_0x999b('0x24'));_0x30d609[_0x999b('0x2c')]=_['keys'](_0x2ad158[_0x999b('0x2c')]);_0x30d609[_0x999b('0x2d')]=_[_0x999b('0x2e')](_0x30d609[_0x999b('0x2f')],_0x30d609['query']);_0x3455ff[_0x999b('0x30')]=_[_0x999b('0x2e')](_0x30d609['model'],qs[_0x999b('0x31')](_0x2ad158[_0x999b('0x2c')]['fields']));_0x3455ff['attributes']=_0x3455ff['attributes'][_0x999b('0x32')]?_0x3455ff[_0x999b('0x30')]:_0x30d609['model'];if(!_0x2ad158['query'][_0x999b('0x33')](_0x999b('0x34'))){_0x3455ff[_0x999b('0x18')]=qs[_0x999b('0x18')](_0x2ad158[_0x999b('0x2c')][_0x999b('0x18')]);_0x3455ff[_0x999b('0x16')]=qs['offset'](_0x2ad158[_0x999b('0x2c')][_0x999b('0x16')]);}_0x3455ff['order']=qs['sort'](_0x2ad158[_0x999b('0x2c')][_0x999b('0x35')]);_0x3455ff[_0x999b('0x36')]=qs['filters'](_[_0x999b('0x37')](_0x2ad158[_0x999b('0x2c')],_0x30d609[_0x999b('0x2d')]),_0x59fbd3);if(_0x2ad158[_0x999b('0x2c')]['filter']){_0x3455ff[_0x999b('0x36')]=_['merge'](_0x3455ff[_0x999b('0x36')],{'$or':_['map'](_0x59fbd3,function(_0x175447){if(_0x175447[_0x999b('0x2a')]!=='VIRTUAL'){var _0x3f5d00={};_0x3f5d00[_0x175447[_0x999b('0x24')]]={'$like':'%'+_0x2ad158['query'][_0x999b('0x38')]+'%'};return _0x3f5d00;}})});}_0x3455ff=_[_0x999b('0x39')]({},_0x3455ff,_0x2ad158[_0x999b('0x3a')]);var _0x1b353c={'where':_0x3455ff[_0x999b('0x36')]};return db[_0x999b('0x28')][_0x999b('0x19')](_0x1b353c)[_0x999b('0x20')](function(_0x4cd043){_0x4d0d11[_0x999b('0x19')]=_0x4cd043;if(_0x2ad158['query'][_0x999b('0x3b')]){_0x3455ff[_0x999b('0x3c')]=[{'all':!![]}];}return db[_0x999b('0x28')][_0x999b('0x3d')](_0x3455ff);})[_0x999b('0x20')](function(_0x3e2279){_0x4d0d11['rows']=_0x3e2279;return _0x4d0d11;})[_0x999b('0x20')](respondWithFilteredResult(_0x4da34f,_0x3455ff))[_0x999b('0x3e')](handleError(_0x4da34f,null));};exports[_0x999b('0x3f')]=function(_0xd07040,_0x9d7391){var _0x44e9c4={'raw':![],'where':{'id':_0xd07040[_0x999b('0x40')]['id']}},_0x4afc51={};_0x4afc51[_0x999b('0x2f')]=_['keys'](db[_0x999b('0x28')][_0x999b('0x41')]);_0x4afc51[_0x999b('0x2c')]=_[_0x999b('0x42')](_0xd07040[_0x999b('0x2c')]);_0x4afc51[_0x999b('0x2d')]=_[_0x999b('0x2e')](_0x4afc51['model'],_0x4afc51[_0x999b('0x2c')]);_0x44e9c4[_0x999b('0x30')]=_[_0x999b('0x2e')](_0x4afc51[_0x999b('0x2f')],qs[_0x999b('0x31')](_0xd07040[_0x999b('0x2c')][_0x999b('0x31')]));_0x44e9c4[_0x999b('0x30')]=_0x44e9c4['attributes'][_0x999b('0x32')]?_0x44e9c4['attributes']:_0x4afc51[_0x999b('0x2f')];if(_0xd07040[_0x999b('0x2c')][_0x999b('0x3b')]){_0x44e9c4[_0x999b('0x3c')]=[{'all':!![]}];}_0x44e9c4=_[_0x999b('0x39')]({},_0x44e9c4,_0xd07040['options']);return db[_0x999b('0x28')][_0x999b('0x43')](_0x44e9c4)[_0x999b('0x20')](handleEntityNotFound(_0x9d7391,null))[_0x999b('0x20')](respondWithResult(_0x9d7391,null))['catch'](handleError(_0x9d7391,null));};exports[_0x999b('0x44')]=function(_0xf0ec5b,_0x3cc30a){return db['Automation'][_0x999b('0x44')](_0xf0ec5b[_0x999b('0x45')],{})[_0x999b('0x20')](respondWithResult(_0x3cc30a,0xc9))[_0x999b('0x3e')](handleError(_0x3cc30a,null));};exports[_0x999b('0x1e')]=function(_0x3d206a,_0x32cbda){if(_0x3d206a[_0x999b('0x45')]['id']){delete _0x3d206a[_0x999b('0x45')]['id'];}return db[_0x999b('0x28')][_0x999b('0x43')]({'where':{'id':_0x3d206a[_0x999b('0x40')]['id']}})[_0x999b('0x20')](handleEntityNotFound(_0x32cbda,null))[_0x999b('0x20')](saveUpdates(_0x3d206a[_0x999b('0x45')],null))[_0x999b('0x20')](respondWithResult(_0x32cbda,null))[_0x999b('0x3e')](handleError(_0x32cbda,null));};exports['destroy']=function(_0x465c5f,_0x5f0cfe){return db[_0x999b('0x28')][_0x999b('0x43')]({'where':{'id':_0x465c5f[_0x999b('0x40')]['id']}})[_0x999b('0x20')](handleEntityNotFound(_0x5f0cfe,null))[_0x999b('0x20')](removeEntity(_0x5f0cfe,null))[_0x999b('0x3e')](handleError(_0x5f0cfe,null));};exports[_0x999b('0x46')]=function(_0x3cc15d,_0x3f6013,_0x48325d){return db['Condition'][_0x999b('0x43')]({'where':{'id':_0x3cc15d[_0x999b('0x40')]['id']}})[_0x999b('0x20')](handleEntityNotFound(_0x3f6013,null))[_0x999b('0x20')](function(_0x45a139){if(_0x45a139){return _0x45a139[_0x999b('0x46')](_0x3cc15d[_0x999b('0x45')][_0x999b('0x47')],_['omit'](_0x3cc15d['body'],[_0x999b('0x47'),'id'])||{});}})[_0x999b('0x20')](respondWithResult(_0x3f6013,null))[_0x999b('0x3e')](handleError(_0x3f6013,null));};exports['getConditions']=function(_0x65eae7,_0x23c23a,_0x136258){var _0x12e59f={};var _0x42fc9d={};var _0x9d98fb;var _0x267321;return db['Automation'][_0x999b('0x48')]({'where':{'id':_0x65eae7[_0x999b('0x40')]['id']}})[_0x999b('0x20')](handleEntityNotFound(_0x23c23a,null))[_0x999b('0x20')](function(_0x49087e){if(_0x49087e){_0x9d98fb=_0x49087e;_0x42fc9d[_0x999b('0x2f')]=_[_0x999b('0x42')](db[_0x999b('0x49')][_0x999b('0x41')]);_0x42fc9d['query']=_[_0x999b('0x42')](_0x65eae7[_0x999b('0x2c')]);_0x42fc9d[_0x999b('0x2d')]=_[_0x999b('0x2e')](_0x42fc9d['model'],_0x42fc9d[_0x999b('0x2c')]);_0x12e59f[_0x999b('0x30')]=_[_0x999b('0x2e')](_0x42fc9d[_0x999b('0x2f')],qs[_0x999b('0x31')](_0x65eae7[_0x999b('0x2c')][_0x999b('0x31')]));_0x12e59f['attributes']=_0x12e59f[_0x999b('0x30')][_0x999b('0x32')]?_0x12e59f[_0x999b('0x30')]:_0x42fc9d[_0x999b('0x2f')];_0x12e59f['order']=qs[_0x999b('0x35')](_0x65eae7[_0x999b('0x2c')][_0x999b('0x35')]);_0x12e59f[_0x999b('0x36')]=qs['filters'](_['pick'](_0x65eae7['query'],_0x42fc9d[_0x999b('0x2d')]));if(_0x65eae7['query']['filter']){_0x12e59f['where']=_[_0x999b('0x39')](_0x12e59f['where'],{'$or':_['map'](_0x12e59f[_0x999b('0x30')],function(_0x45a750){var _0x9c2851={};_0x9c2851[_0x45a750]={'$like':'%'+_0x65eae7[_0x999b('0x2c')][_0x999b('0x38')]+'%'};return _0x9c2851;})});}_0x12e59f=_[_0x999b('0x39')]({},_0x12e59f,_0x65eae7[_0x999b('0x3a')]);return _0x9d98fb[_0x999b('0x4a')](_0x12e59f);}})[_0x999b('0x20')](function(_0x207403){if(_0x207403){_0x267321=_0x207403[_0x999b('0x32')];if(!_0x65eae7[_0x999b('0x2c')][_0x999b('0x33')]('nolimit')){_0x12e59f[_0x999b('0x18')]=qs[_0x999b('0x18')](_0x65eae7[_0x999b('0x2c')]['limit']);_0x12e59f[_0x999b('0x16')]=qs[_0x999b('0x16')](_0x65eae7[_0x999b('0x2c')]['offset']);}return _0x9d98fb[_0x999b('0x4a')](_0x12e59f);}})[_0x999b('0x20')](function(_0x2af596){if(_0x2af596){return _0x2af596?{'count':_0x267321,'rows':_0x2af596}:null;}})[_0x999b('0x20')](respondWithResult(_0x23c23a,null))[_0x999b('0x3e')](handleError(_0x23c23a,null));};exports[_0x999b('0x4b')]=function(_0x26e19c,_0x1a9740,_0x6f093d){return db[_0x999b('0x4c')]['find']({'where':{'id':_0x26e19c[_0x999b('0x40')]['id']}})[_0x999b('0x20')](handleEntityNotFound(_0x1a9740,null))[_0x999b('0x20')](function(_0x304b91){if(_0x304b91){return _0x304b91[_0x999b('0x4b')](_0x26e19c[_0x999b('0x45')][_0x999b('0x47')],_[_0x999b('0x4d')](_0x26e19c[_0x999b('0x45')],[_0x999b('0x47'),'id'])||{});}})[_0x999b('0x20')](respondWithResult(_0x1a9740,null))['catch'](handleError(_0x1a9740,null));};exports[_0x999b('0x4e')]=function(_0x468c92,_0x2dfc25,_0x5aa169){var _0x5b5bf5={};var _0x160069={};var _0x56d35b;var _0x17edf0;return db[_0x999b('0x28')][_0x999b('0x48')]({'where':{'id':_0x468c92[_0x999b('0x40')]['id']}})[_0x999b('0x20')](handleEntityNotFound(_0x2dfc25,null))['then'](function(_0xf2116){if(_0xf2116){_0x56d35b=_0xf2116;_0x160069[_0x999b('0x2f')]=_['keys'](db[_0x999b('0x4c')][_0x999b('0x41')]);_0x160069['query']=_['keys'](_0x468c92[_0x999b('0x2c')]);_0x160069['filters']=_[_0x999b('0x2e')](_0x160069[_0x999b('0x2f')],_0x160069[_0x999b('0x2c')]);_0x5b5bf5[_0x999b('0x30')]=_[_0x999b('0x2e')](_0x160069[_0x999b('0x2f')],qs['fields'](_0x468c92[_0x999b('0x2c')][_0x999b('0x31')]));_0x5b5bf5[_0x999b('0x30')]=_0x5b5bf5[_0x999b('0x30')][_0x999b('0x32')]?_0x5b5bf5[_0x999b('0x30')]:_0x160069[_0x999b('0x2f')];_0x5b5bf5[_0x999b('0x4f')]=qs[_0x999b('0x35')](_0x468c92['query'][_0x999b('0x35')]);_0x5b5bf5[_0x999b('0x36')]=qs[_0x999b('0x2d')](_[_0x999b('0x37')](_0x468c92[_0x999b('0x2c')],_0x160069[_0x999b('0x2d')]));if(_0x468c92[_0x999b('0x2c')][_0x999b('0x38')]){_0x5b5bf5[_0x999b('0x36')]=_[_0x999b('0x39')](_0x5b5bf5['where'],{'$or':_[_0x999b('0x27')](_0x5b5bf5[_0x999b('0x30')],function(_0x25cc5e){var _0x3e3b78={};_0x3e3b78[_0x25cc5e]={'$like':'%'+_0x468c92[_0x999b('0x2c')][_0x999b('0x38')]+'%'};return _0x3e3b78;})});}_0x5b5bf5=_[_0x999b('0x39')]({},_0x5b5bf5,_0x468c92['options']);return _0x56d35b[_0x999b('0x4e')](_0x5b5bf5);}})[_0x999b('0x20')](function(_0x5c3bd5){if(_0x5c3bd5){_0x17edf0=_0x5c3bd5[_0x999b('0x32')];if(!_0x468c92[_0x999b('0x2c')]['hasOwnProperty']('nolimit')){_0x5b5bf5[_0x999b('0x18')]=qs[_0x999b('0x18')](_0x468c92[_0x999b('0x2c')]['limit']);_0x5b5bf5[_0x999b('0x16')]=qs[_0x999b('0x16')](_0x468c92[_0x999b('0x2c')][_0x999b('0x16')]);}return _0x56d35b[_0x999b('0x4e')](_0x5b5bf5);}})[_0x999b('0x20')](function(_0x5c8bb9){if(_0x5c8bb9){return _0x5c8bb9?{'count':_0x17edf0,'rows':_0x5c8bb9}:null;}})[_0x999b('0x20')](respondWithResult(_0x2dfc25,null))[_0x999b('0x3e')](handleError(_0x2dfc25,null));}; \ No newline at end of file +var _0x7ba8=['options','includeAll','include','rows','catch','show','params','find','create','body','Condition','addConditions','omit','ids','getConditions','findOne','keys','hasOwnProperty','addActions','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','Automation','rawAttributes','fieldName','key','model','map','filters','intersection','query','fields','attributes','length','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge'];(function(_0x12a0ee,_0x18bf27){var _0x21cfff=function(_0x679c12){while(--_0x679c12){_0x12a0ee['push'](_0x12a0ee['shift']());}};_0x21cfff(++_0x18bf27);}(_0x7ba8,0xbf));var _0x87ba=function(_0x8daad,_0x504a0c){_0x8daad=_0x8daad-0x0;var _0x2efed7=_0x7ba8[_0x8daad];return _0x2efed7;};'use strict';var emlformat=require(_0x87ba('0x0'));var rimraf=require(_0x87ba('0x1'));var zipdir=require(_0x87ba('0x2'));var jsonpatch=require(_0x87ba('0x3'));var rp=require('request-promise');var moment=require(_0x87ba('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x87ba('0x5'));var util=require(_0x87ba('0x6'));var path=require(_0x87ba('0x7'));var sox=require(_0x87ba('0x8'));var csv=require(_0x87ba('0x9'));var ejs=require(_0x87ba('0xa'));var fs=require('fs');var fs_extra=require(_0x87ba('0xb'));var _=require(_0x87ba('0xc'));var squel=require(_0x87ba('0xd'));var crypto=require(_0x87ba('0xe'));var jsforce=require(_0x87ba('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x87ba('0x9'));var querystring=require(_0x87ba('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x87ba('0x11'));var qs=require(_0x87ba('0x12'));var as=require(_0x87ba('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x87ba('0x14'))(_0x87ba('0x15'));var utils=require(_0x87ba('0x16'));var config=require(_0x87ba('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x87ba('0x18'))['db'];function respondWithStatusCode(_0x2b70ed,_0x1ba455){_0x1ba455=_0x1ba455||0xcc;return function(_0x5973f1){if(_0x5973f1){return _0x2b70ed['sendStatus'](_0x1ba455);}return _0x2b70ed[_0x87ba('0x19')](_0x1ba455)[_0x87ba('0x1a')]();};}function respondWithResult(_0x16aea9,_0x5cf2d3){_0x5cf2d3=_0x5cf2d3||0xc8;return function(_0x56c1df){if(_0x56c1df){return _0x16aea9[_0x87ba('0x19')](_0x5cf2d3)[_0x87ba('0x1b')](_0x56c1df);}};}function respondWithFilteredResult(_0x1b4f1b,_0xad4e4){return function(_0xdb7ea8){if(_0xdb7ea8){var _0x1ec22e=typeof _0xad4e4['offset']==='undefined'&&typeof _0xad4e4[_0x87ba('0x1c')]===_0x87ba('0x1d');var _0xce3773=_0xdb7ea8[_0x87ba('0x1e')];var _0x2c926c=_0x1ec22e?0x0:_0xad4e4['offset'];var _0xdad086=_0x1ec22e?_0xdb7ea8['count']:_0xad4e4[_0x87ba('0x1f')]+_0xad4e4[_0x87ba('0x1c')];var _0x37e2e5;if(_0xdad086>=_0xce3773){_0xdad086=_0xce3773;_0x37e2e5=0xc8;}else{_0x37e2e5=0xce;}_0x1b4f1b[_0x87ba('0x19')](_0x37e2e5);return _0x1b4f1b[_0x87ba('0x20')](_0x87ba('0x21'),_0x2c926c+'-'+_0xdad086+'/'+_0xce3773)['json'](_0xdb7ea8);}return null;};}function patchUpdates(_0x17a2cf){return function(_0x5bb51c){try{jsonpatch[_0x87ba('0x22')](_0x5bb51c,_0x17a2cf,!![]);}catch(_0x1b8da2){return BPromise['reject'](_0x1b8da2);}return _0x5bb51c['save']();};}function saveUpdates(_0x1741e5,_0x36b668){return function(_0x597269){if(_0x597269){return _0x597269[_0x87ba('0x23')](_0x1741e5)[_0x87ba('0x24')](function(_0x30d308){return _0x30d308;});}return null;};}function removeEntity(_0xa1e187,_0x3a4944){return function(_0x4d415f){if(_0x4d415f){return _0x4d415f[_0x87ba('0x25')]()[_0x87ba('0x24')](function(){_0xa1e187['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x15cdc5,_0x123f5b){return function(_0x529d4b){if(!_0x529d4b){_0x15cdc5['sendStatus'](0x194);}return _0x529d4b;};}function handleError(_0x15de34,_0x576011){_0x576011=_0x576011||0x1f4;return function(_0x1e6070){logger[_0x87ba('0x26')](_0x1e6070[_0x87ba('0x27')]);if(_0x1e6070[_0x87ba('0x28')]){delete _0x1e6070[_0x87ba('0x28')];}_0x15de34[_0x87ba('0x19')](_0x576011)[_0x87ba('0x29')](_0x1e6070);};}exports[_0x87ba('0x2a')]=function(_0xdf240d,_0xe0f0be){var _0x2a6a6c={},_0x56c380={},_0x5753fc={'count':0x0,'rows':[]};var _0x4923c2=_['map'](db[_0x87ba('0x2b')][_0x87ba('0x2c')],function(_0x25327d){return{'name':_0x25327d[_0x87ba('0x2d')],'type':_0x25327d['type'][_0x87ba('0x2e')]};});_0x56c380[_0x87ba('0x2f')]=_[_0x87ba('0x30')](_0x4923c2,_0x87ba('0x28'));_0x56c380['query']=_['keys'](_0xdf240d['query']);_0x56c380[_0x87ba('0x31')]=_[_0x87ba('0x32')](_0x56c380[_0x87ba('0x2f')],_0x56c380[_0x87ba('0x33')]);_0x2a6a6c['attributes']=_['intersection'](_0x56c380[_0x87ba('0x2f')],qs[_0x87ba('0x34')](_0xdf240d[_0x87ba('0x33')]['fields']));_0x2a6a6c[_0x87ba('0x35')]=_0x2a6a6c[_0x87ba('0x35')][_0x87ba('0x36')]?_0x2a6a6c[_0x87ba('0x35')]:_0x56c380['model'];if(!_0xdf240d[_0x87ba('0x33')]['hasOwnProperty'](_0x87ba('0x37'))){_0x2a6a6c[_0x87ba('0x1c')]=qs['limit'](_0xdf240d[_0x87ba('0x33')][_0x87ba('0x1c')]);_0x2a6a6c[_0x87ba('0x1f')]=qs['offset'](_0xdf240d['query'][_0x87ba('0x1f')]);}_0x2a6a6c[_0x87ba('0x38')]=qs['sort'](_0xdf240d[_0x87ba('0x33')][_0x87ba('0x39')]);_0x2a6a6c[_0x87ba('0x3a')]=qs[_0x87ba('0x31')](_[_0x87ba('0x3b')](_0xdf240d[_0x87ba('0x33')],_0x56c380[_0x87ba('0x31')]),_0x4923c2);if(_0xdf240d[_0x87ba('0x33')]['filter']){_0x2a6a6c[_0x87ba('0x3a')]=_['merge'](_0x2a6a6c['where'],{'$or':_['map'](_0x4923c2,function(_0x332828){if(_0x332828[_0x87ba('0x3c')]!==_0x87ba('0x3d')){var _0x2617bb={};_0x2617bb[_0x332828[_0x87ba('0x28')]]={'$like':'%'+_0xdf240d[_0x87ba('0x33')][_0x87ba('0x3e')]+'%'};return _0x2617bb;}})});}_0x2a6a6c=_[_0x87ba('0x3f')]({},_0x2a6a6c,_0xdf240d[_0x87ba('0x40')]);var _0x4aa6dc={'where':_0x2a6a6c[_0x87ba('0x3a')]};return db[_0x87ba('0x2b')][_0x87ba('0x1e')](_0x4aa6dc)[_0x87ba('0x24')](function(_0x564917){_0x5753fc[_0x87ba('0x1e')]=_0x564917;if(_0xdf240d[_0x87ba('0x33')][_0x87ba('0x41')]){_0x2a6a6c[_0x87ba('0x42')]=[{'all':!![]}];}return db[_0x87ba('0x2b')]['findAll'](_0x2a6a6c);})[_0x87ba('0x24')](function(_0xbc4937){_0x5753fc[_0x87ba('0x43')]=_0xbc4937;return _0x5753fc;})[_0x87ba('0x24')](respondWithFilteredResult(_0xe0f0be,_0x2a6a6c))[_0x87ba('0x44')](handleError(_0xe0f0be,null));};exports[_0x87ba('0x45')]=function(_0x3b6ad4,_0x2920f8){var _0x4b1127={'raw':![],'where':{'id':_0x3b6ad4[_0x87ba('0x46')]['id']}},_0x2e7f07={};_0x2e7f07['model']=_['keys'](db[_0x87ba('0x2b')]['rawAttributes']);_0x2e7f07[_0x87ba('0x33')]=_['keys'](_0x3b6ad4['query']);_0x2e7f07[_0x87ba('0x31')]=_['intersection'](_0x2e7f07[_0x87ba('0x2f')],_0x2e7f07[_0x87ba('0x33')]);_0x4b1127['attributes']=_['intersection'](_0x2e7f07[_0x87ba('0x2f')],qs[_0x87ba('0x34')](_0x3b6ad4[_0x87ba('0x33')][_0x87ba('0x34')]));_0x4b1127[_0x87ba('0x35')]=_0x4b1127[_0x87ba('0x35')][_0x87ba('0x36')]?_0x4b1127[_0x87ba('0x35')]:_0x2e7f07[_0x87ba('0x2f')];if(_0x3b6ad4[_0x87ba('0x33')]['includeAll']){_0x4b1127[_0x87ba('0x42')]=[{'all':!![]}];}_0x4b1127=_[_0x87ba('0x3f')]({},_0x4b1127,_0x3b6ad4[_0x87ba('0x40')]);return db['Automation'][_0x87ba('0x47')](_0x4b1127)['then'](handleEntityNotFound(_0x2920f8,null))[_0x87ba('0x24')](respondWithResult(_0x2920f8,null))[_0x87ba('0x44')](handleError(_0x2920f8,null));};exports[_0x87ba('0x48')]=function(_0xeedc33,_0xc56bb8){return db[_0x87ba('0x2b')][_0x87ba('0x48')](_0xeedc33['body'],{})[_0x87ba('0x24')](respondWithResult(_0xc56bb8,0xc9))[_0x87ba('0x44')](handleError(_0xc56bb8,null));};exports['update']=function(_0x2a1fa4,_0x139739){if(_0x2a1fa4[_0x87ba('0x49')]['id']){delete _0x2a1fa4[_0x87ba('0x49')]['id'];}return db['Automation'][_0x87ba('0x47')]({'where':{'id':_0x2a1fa4[_0x87ba('0x46')]['id']}})['then'](handleEntityNotFound(_0x139739,null))[_0x87ba('0x24')](saveUpdates(_0x2a1fa4['body'],null))[_0x87ba('0x24')](respondWithResult(_0x139739,null))['catch'](handleError(_0x139739,null));};exports['destroy']=function(_0x22c9fc,_0x3d0edc){return db[_0x87ba('0x2b')]['find']({'where':{'id':_0x22c9fc[_0x87ba('0x46')]['id']}})[_0x87ba('0x24')](handleEntityNotFound(_0x3d0edc,null))[_0x87ba('0x24')](removeEntity(_0x3d0edc,null))['catch'](handleError(_0x3d0edc,null));};exports['addConditions']=function(_0x23e2da,_0x4acb46,_0x330e13){return db[_0x87ba('0x4a')]['find']({'where':{'id':_0x23e2da[_0x87ba('0x46')]['id']}})[_0x87ba('0x24')](handleEntityNotFound(_0x4acb46,null))[_0x87ba('0x24')](function(_0x314ff9){if(_0x314ff9){return _0x314ff9[_0x87ba('0x4b')](_0x23e2da[_0x87ba('0x49')]['ids'],_[_0x87ba('0x4c')](_0x23e2da[_0x87ba('0x49')],[_0x87ba('0x4d'),'id'])||{});}})[_0x87ba('0x24')](respondWithResult(_0x4acb46,null))[_0x87ba('0x44')](handleError(_0x4acb46,null));};exports[_0x87ba('0x4e')]=function(_0xff53da,_0x3ca8e6,_0x315f45){var _0x58bfcb={};var _0x1f607b={};var _0x29afe9;var _0x5a171f;return db['Automation'][_0x87ba('0x4f')]({'where':{'id':_0xff53da['params']['id']}})[_0x87ba('0x24')](handleEntityNotFound(_0x3ca8e6,null))[_0x87ba('0x24')](function(_0x316b3b){if(_0x316b3b){_0x29afe9=_0x316b3b;_0x1f607b['model']=_[_0x87ba('0x50')](db[_0x87ba('0x4a')][_0x87ba('0x2c')]);_0x1f607b[_0x87ba('0x33')]=_[_0x87ba('0x50')](_0xff53da[_0x87ba('0x33')]);_0x1f607b[_0x87ba('0x31')]=_[_0x87ba('0x32')](_0x1f607b[_0x87ba('0x2f')],_0x1f607b[_0x87ba('0x33')]);_0x58bfcb['attributes']=_[_0x87ba('0x32')](_0x1f607b['model'],qs[_0x87ba('0x34')](_0xff53da['query']['fields']));_0x58bfcb['attributes']=_0x58bfcb[_0x87ba('0x35')]['length']?_0x58bfcb['attributes']:_0x1f607b[_0x87ba('0x2f')];_0x58bfcb['order']=qs[_0x87ba('0x39')](_0xff53da[_0x87ba('0x33')][_0x87ba('0x39')]);_0x58bfcb[_0x87ba('0x3a')]=qs[_0x87ba('0x31')](_['pick'](_0xff53da['query'],_0x1f607b[_0x87ba('0x31')]));if(_0xff53da[_0x87ba('0x33')][_0x87ba('0x3e')]){_0x58bfcb['where']=_[_0x87ba('0x3f')](_0x58bfcb['where'],{'$or':_['map'](_0x58bfcb[_0x87ba('0x35')],function(_0x497af6){var _0x4b9bb3={};_0x4b9bb3[_0x497af6]={'$like':'%'+_0xff53da[_0x87ba('0x33')][_0x87ba('0x3e')]+'%'};return _0x4b9bb3;})});}_0x58bfcb=_['merge']({},_0x58bfcb,_0xff53da[_0x87ba('0x40')]);return _0x29afe9['getConditions'](_0x58bfcb);}})[_0x87ba('0x24')](function(_0x1099d6){if(_0x1099d6){_0x5a171f=_0x1099d6[_0x87ba('0x36')];if(!_0xff53da[_0x87ba('0x33')][_0x87ba('0x51')](_0x87ba('0x37'))){_0x58bfcb['limit']=qs[_0x87ba('0x1c')](_0xff53da['query'][_0x87ba('0x1c')]);_0x58bfcb[_0x87ba('0x1f')]=qs[_0x87ba('0x1f')](_0xff53da[_0x87ba('0x33')][_0x87ba('0x1f')]);}return _0x29afe9[_0x87ba('0x4e')](_0x58bfcb);}})[_0x87ba('0x24')](function(_0x497378){if(_0x497378){return _0x497378?{'count':_0x5a171f,'rows':_0x497378}:null;}})[_0x87ba('0x24')](respondWithResult(_0x3ca8e6,null))[_0x87ba('0x44')](handleError(_0x3ca8e6,null));};exports[_0x87ba('0x52')]=function(_0x422352,_0x1163a7,_0x216184){return db['Action'][_0x87ba('0x47')]({'where':{'id':_0x422352[_0x87ba('0x46')]['id']}})[_0x87ba('0x24')](handleEntityNotFound(_0x1163a7,null))[_0x87ba('0x24')](function(_0x34bfc9){if(_0x34bfc9){return _0x34bfc9[_0x87ba('0x52')](_0x422352['body'][_0x87ba('0x4d')],_[_0x87ba('0x4c')](_0x422352['body'],[_0x87ba('0x4d'),'id'])||{});}})[_0x87ba('0x24')](respondWithResult(_0x1163a7,null))[_0x87ba('0x44')](handleError(_0x1163a7,null));};exports['getActions']=function(_0x4cdb7c,_0x1e50bc,_0x2bab29){var _0x221a2b={};var _0x4bcad2={};var _0x18f8d4;var _0x2aa50a;return db[_0x87ba('0x2b')]['findOne']({'where':{'id':_0x4cdb7c[_0x87ba('0x46')]['id']}})[_0x87ba('0x24')](handleEntityNotFound(_0x1e50bc,null))[_0x87ba('0x24')](function(_0x2f9d76){if(_0x2f9d76){_0x18f8d4=_0x2f9d76;_0x4bcad2[_0x87ba('0x2f')]=_['keys'](db[_0x87ba('0x53')]['rawAttributes']);_0x4bcad2[_0x87ba('0x33')]=_[_0x87ba('0x50')](_0x4cdb7c[_0x87ba('0x33')]);_0x4bcad2[_0x87ba('0x31')]=_[_0x87ba('0x32')](_0x4bcad2['model'],_0x4bcad2[_0x87ba('0x33')]);_0x221a2b['attributes']=_[_0x87ba('0x32')](_0x4bcad2[_0x87ba('0x2f')],qs['fields'](_0x4cdb7c[_0x87ba('0x33')][_0x87ba('0x34')]));_0x221a2b['attributes']=_0x221a2b[_0x87ba('0x35')][_0x87ba('0x36')]?_0x221a2b[_0x87ba('0x35')]:_0x4bcad2[_0x87ba('0x2f')];_0x221a2b[_0x87ba('0x38')]=qs[_0x87ba('0x39')](_0x4cdb7c[_0x87ba('0x33')][_0x87ba('0x39')]);_0x221a2b[_0x87ba('0x3a')]=qs[_0x87ba('0x31')](_[_0x87ba('0x3b')](_0x4cdb7c[_0x87ba('0x33')],_0x4bcad2[_0x87ba('0x31')]));if(_0x4cdb7c[_0x87ba('0x33')]['filter']){_0x221a2b[_0x87ba('0x3a')]=_[_0x87ba('0x3f')](_0x221a2b['where'],{'$or':_[_0x87ba('0x30')](_0x221a2b[_0x87ba('0x35')],function(_0x2fde0d){var _0x14c364={};_0x14c364[_0x2fde0d]={'$like':'%'+_0x4cdb7c[_0x87ba('0x33')][_0x87ba('0x3e')]+'%'};return _0x14c364;})});}_0x221a2b=_[_0x87ba('0x3f')]({},_0x221a2b,_0x4cdb7c['options']);return _0x18f8d4[_0x87ba('0x54')](_0x221a2b);}})[_0x87ba('0x24')](function(_0x670a5f){if(_0x670a5f){_0x2aa50a=_0x670a5f[_0x87ba('0x36')];if(!_0x4cdb7c[_0x87ba('0x33')]['hasOwnProperty'](_0x87ba('0x37'))){_0x221a2b['limit']=qs[_0x87ba('0x1c')](_0x4cdb7c[_0x87ba('0x33')][_0x87ba('0x1c')]);_0x221a2b['offset']=qs['offset'](_0x4cdb7c[_0x87ba('0x33')][_0x87ba('0x1f')]);}return _0x18f8d4[_0x87ba('0x54')](_0x221a2b);}})[_0x87ba('0x24')](function(_0x4a7a7f){if(_0x4a7a7f){return _0x4a7a7f?{'count':_0x2aa50a,'rows':_0x4a7a7f}:null;}})['then'](respondWithResult(_0x1e50bc,null))[_0x87ba('0x44')](handleError(_0x1e50bc,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 0bb4bb8..3fa0c91 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 _0xe1bc=['exports','define','Automation','tools_automations','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./automation.attributes'];(function(_0x43b99a,_0x327ce5){var _0x13085b=function(_0x326752){while(--_0x326752){_0x43b99a['push'](_0x43b99a['shift']());}};_0x13085b(++_0x327ce5);}(_0xe1bc,0x100));var _0xce1b=function(_0x4f8830,_0x5ea11b){_0x4f8830=_0x4f8830-0x0;var _0xacf1bc=_0xe1bc[_0x4f8830];return _0xacf1bc;};'use strict';var _=require(_0xce1b('0x0'));var util=require('util');var logger=require(_0xce1b('0x1'))(_0xce1b('0x2'));var moment=require('moment');var BPromise=require(_0xce1b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xce1b('0x4'));var rimraf=require(_0xce1b('0x5'));var config=require(_0xce1b('0x6'));var attributes=require(_0xce1b('0x7'));module[_0xce1b('0x8')]=function(_0x9e9d37,_0x491cff){return _0x9e9d37[_0xce1b('0x9')](_0xce1b('0xa'),attributes,{'tableName':_0xce1b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a82=['../../config/logger','moment','bluebird','request-promise','path','rimraf','./automation.attributes','exports','define','Automation','tools_automations','lodash','util'];(function(_0x3955db,_0x449a25){var _0x176d4b=function(_0x274356){while(--_0x274356){_0x3955db['push'](_0x3955db['shift']());}};_0x176d4b(++_0x449a25);}(_0x3a82,0x11c));var _0x23a8=function(_0x245e7f,_0x15adb1){_0x245e7f=_0x245e7f-0x0;var _0x531bcb=_0x3a82[_0x245e7f];return _0x531bcb;};'use strict';var _=require(_0x23a8('0x0'));var util=require(_0x23a8('0x1'));var logger=require(_0x23a8('0x2'))('api');var moment=require(_0x23a8('0x3'));var BPromise=require(_0x23a8('0x4'));var rp=require(_0x23a8('0x5'));var fs=require('fs');var path=require(_0x23a8('0x6'));var rimraf=require(_0x23a8('0x7'));var config=require('../../config/environment');var attributes=require(_0x23a8('0x8'));module[_0x23a8('0x9')]=function(_0x404caa,_0x3c6b8b){return _0x404caa[_0x23a8('0xa')](_0x23a8('0xb'),attributes,{'tableName':_0x23a8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index a5b14d6..0f042d6 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 _0xae1b=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis'];(function(_0x4fbeb9,_0x5e1c8f){var _0x8a4c5d=function(_0x104ba5){while(--_0x104ba5){_0x4fbeb9['push'](_0x4fbeb9['shift']());}};_0x8a4c5d(++_0x5e1c8f);}(_0xae1b,0x96));var _0xbae1=function(_0x317ea5,_0x54ab55){_0x317ea5=_0x317ea5-0x0;var _0x24cde2=_0xae1b[_0x317ea5];return _0x24cde2;};'use strict';var _=require('lodash');var util=require(_0xbae1('0x0'));var moment=require('moment');var BPromise=require(_0xbae1('0x1'));var rs=require(_0xbae1('0x2'));var fs=require('fs');var Redis=require(_0xbae1('0x3'));var db=require(_0xbae1('0x4'))['db'];var utils=require(_0xbae1('0x5'));var logger=require(_0xbae1('0x6'))('rpc');var config=require(_0xbae1('0x7'));var jayson=require(_0xbae1('0x8'));var client=jayson['client'][_0xbae1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d7130,_0xac9c47,_0x54ba1f){return new BPromise(function(_0x3f0ff5,_0x340ff9){return client['request'](_0x5d7130,_0x54ba1f)[_0xbae1('0xa')](function(_0x366106){logger[_0xbae1('0xb')](_0xbae1('0xc'),_0xac9c47,_0xbae1('0xd'));logger[_0xbae1('0xe')](_0xbae1('0xf'),_0xac9c47,_0xbae1('0xd'),JSON[_0xbae1('0x10')](_0x366106));if(_0x366106[_0xbae1('0x11')]){if(_0x366106[_0xbae1('0x11')][_0xbae1('0x12')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0xac9c47,_0x366106['error']['message']);return _0x340ff9(_0x366106[_0xbae1('0x11')][_0xbae1('0x13')]);}logger[_0xbae1('0x11')](_0xbae1('0xc'),_0xac9c47,_0x366106[_0xbae1('0x11')]['message']);return _0x3f0ff5(_0x366106[_0xbae1('0x11')][_0xbae1('0x13')]);}else{logger[_0xbae1('0xb')]('Automation,\x20%s,\x20%s',_0xac9c47,_0xbae1('0xd'));_0x3f0ff5(_0x366106[_0xbae1('0x14')][_0xbae1('0x13')]);}})[_0xbae1('0x15')](function(_0x7d92b7){logger[_0xbae1('0x11')](_0xbae1('0xc'),_0xac9c47,_0x7d92b7);_0x340ff9(_0x7d92b7);});});} \ No newline at end of file +var _0xf7d9=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x147bac,_0x1e97a6){var _0x222850=function(_0x354211){while(--_0x354211){_0x147bac['push'](_0x147bac['shift']());}};_0x222850(++_0x1e97a6);}(_0xf7d9,0x122));var _0x9f7d=function(_0x39048d,_0x5ab950){_0x39048d=_0x39048d-0x0;var _0x178a16=_0xf7d9[_0x39048d];return _0x178a16;};'use strict';var _=require(_0x9f7d('0x0'));var util=require(_0x9f7d('0x1'));var moment=require(_0x9f7d('0x2'));var BPromise=require(_0x9f7d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f7d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9f7d('0x5'))(_0x9f7d('0x6'));var config=require(_0x9f7d('0x7'));var jayson=require(_0x9f7d('0x8'));var client=jayson[_0x9f7d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4dc6b9,_0xf09259,_0x2333e8){return new BPromise(function(_0x218628,_0x2893a5){return client[_0x9f7d('0xa')](_0x4dc6b9,_0x2333e8)[_0x9f7d('0xb')](function(_0x5290e2){logger[_0x9f7d('0xc')](_0x9f7d('0xd'),_0xf09259,'request\x20sent');logger[_0x9f7d('0xe')](_0x9f7d('0xf'),_0xf09259,_0x9f7d('0x10'),JSON['stringify'](_0x5290e2));if(_0x5290e2[_0x9f7d('0x11')]){if(_0x5290e2[_0x9f7d('0x11')][_0x9f7d('0x12')]===0x1f4){logger[_0x9f7d('0x11')](_0x9f7d('0xd'),_0xf09259,_0x5290e2[_0x9f7d('0x11')]['message']);return _0x2893a5(_0x5290e2[_0x9f7d('0x11')][_0x9f7d('0x13')]);}logger[_0x9f7d('0x11')](_0x9f7d('0xd'),_0xf09259,_0x5290e2['error'][_0x9f7d('0x13')]);return _0x218628(_0x5290e2[_0x9f7d('0x11')][_0x9f7d('0x13')]);}else{logger[_0x9f7d('0xc')](_0x9f7d('0xd'),_0xf09259,_0x9f7d('0x10'));_0x218628(_0x5290e2[_0x9f7d('0x14')]['message']);}})['catch'](function(_0x402609){logger[_0x9f7d('0x11')](_0x9f7d('0xd'),_0xf09259,_0x402609);_0x2893a5(_0x402609);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 58b43f3..06e4c3f 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 _0x665c=['../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','/:id/conditions','isAuthenticated','getConditions','/:id/actions','getActions','post','addConditions','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3c19ab,_0x8fe884){var _0x2a460a=function(_0x96e396){while(--_0x96e396){_0x3c19ab['push'](_0x3c19ab['shift']());}};_0x2a460a(++_0x8fe884);}(_0x665c,0x1a9));var _0xc665=function(_0x2bfc7a,_0x1b0b10){_0x2bfc7a=_0x2bfc7a-0x0;var _0x3cfea3=_0x665c[_0x2bfc7a];return _0x3cfea3;};'use strict';var multer=require(_0xc665('0x0'));var util=require(_0xc665('0x1'));var path=require(_0xc665('0x2'));var timeout=require(_0xc665('0x3'));var express=require(_0xc665('0x4'));var router=express[_0xc665('0x5')]();var fs_extra=require(_0xc665('0x6'));var auth=require(_0xc665('0x7'));var interaction=require(_0xc665('0x8'));var config=require(_0xc665('0x9'));var controller=require('./automation.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc665('0xa')]);router[_0xc665('0xb')](_0xc665('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xc665('0xb')](_0xc665('0xd'),auth[_0xc665('0xe')](),controller[_0xc665('0xf')]);router[_0xc665('0xb')](_0xc665('0x10'),auth[_0xc665('0xe')](),controller[_0xc665('0x11')]);router['post']('/',auth[_0xc665('0xe')](),controller['create']);router[_0xc665('0x12')](_0xc665('0xd'),auth[_0xc665('0xe')](),controller[_0xc665('0x13')]);router[_0xc665('0x12')](_0xc665('0x10'),auth[_0xc665('0xe')](),controller['addActions']);router[_0xc665('0x14')](_0xc665('0xc'),auth[_0xc665('0xe')](),controller['update']);router[_0xc665('0x15')](_0xc665('0xc'),auth[_0xc665('0xe')](),controller[_0xc665('0x16')]);module[_0xc665('0x17')]=router; \ No newline at end of file +var _0x9901=['create','addConditions','put','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post'];(function(_0xe420c1,_0x3ceda5){var _0x1eb9b2=function(_0x6b4d76){while(--_0x6b4d76){_0xe420c1['push'](_0xe420c1['shift']());}};_0x1eb9b2(++_0x3ceda5);}(_0x9901,0x15e));var _0x1990=function(_0x4de9e8,_0x565ffa){_0x4de9e8=_0x4de9e8-0x0;var _0x4db0de=_0x9901[_0x4de9e8];return _0x4db0de;};'use strict';var multer=require('multer');var util=require(_0x1990('0x0'));var path=require('path');var timeout=require(_0x1990('0x1'));var express=require(_0x1990('0x2'));var router=express[_0x1990('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1990('0x4'));var interaction=require(_0x1990('0x5'));var config=require(_0x1990('0x6'));var controller=require(_0x1990('0x7'));router[_0x1990('0x8')]('/',auth[_0x1990('0x9')](),controller[_0x1990('0xa')]);router[_0x1990('0x8')](_0x1990('0xb'),auth[_0x1990('0x9')](),controller[_0x1990('0xc')]);router['get'](_0x1990('0xd'),auth[_0x1990('0x9')](),controller[_0x1990('0xe')]);router[_0x1990('0x8')](_0x1990('0xf'),auth[_0x1990('0x9')](),controller[_0x1990('0x10')]);router[_0x1990('0x11')]('/',auth[_0x1990('0x9')](),controller[_0x1990('0x12')]);router[_0x1990('0x11')](_0x1990('0xd'),auth['isAuthenticated'](),controller[_0x1990('0x13')]);router['post']('/:id/actions',auth[_0x1990('0x9')](),controller['addActions']);router[_0x1990('0x14')](_0x1990('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x1990('0x15')](_0x1990('0xb'),auth[_0x1990('0x9')](),controller[_0x1990('0x16')]);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 4fc528b..8f8840a 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 _0x8e8c=['Max\x20200\x20calls.','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','BOOLEAN','#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)','#AMD\x20Maximum\x20Word\x20Length','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\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)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','Active/Disactive\x20Campaign','INTEGER'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x8e8c,0x1cc));var _0xc8e8=function(_0x16be20,_0x3f7898){_0x16be20=_0x16be20-0x0;var _0x38f195=_0x8e8c[_0x16be20];return _0x38f195;};'use strict';var Sequelize=require(_0xc8e8('0x0'));module[_0xc8e8('0x1')]={'name':{'type':Sequelize[_0xc8e8('0x2')],'unique':_0xc8e8('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xc8e8('0x4')](_0xc8e8('0x5')),'allowNull':![],'defaultValue':_0xc8e8('0x5')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xc8e8('0x6')},'limitCalls':{'type':Sequelize[_0xc8e8('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xc8e8('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xc8e8('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc8e8('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xc8e8('0x7')](0x3)[_0xc8e8('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xc8e8('0x7')](0x3)[_0xc8e8('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc8e8('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc8e8('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc8e8('0xb')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc8e8('0xc')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc8e8('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc8e8('0x7')](0x3)[_0xc8e8('0x9')],'defaultValue':0x3,'comment':_0xc8e8('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xc8e8('0x7')](0x3)[_0xc8e8('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xc8e8('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xc8e8('0x2')],'defaultValue':_0xc8e8('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xc8e8('0x4')](_0xc8e8('0xf'),_0xc8e8('0x10'),_0xc8e8('0x11')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xc8e8('0x12')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xc8e8('0x7')](0x9)[_0xc8e8('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xc8e8('0x13')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xc8e8('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc8e8('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc8e8('0x7')](0x9)[_0xc8e8('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc8e8('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0xc8e8('0x7')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc8e8('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc8e8('0x7')](0x9)[_0xc8e8('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc8e8('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xc8e8('0x7')](0x9)[_0xc8e8('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc8e8('0x7')](0x5)[_0xc8e8('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc8e8('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc8e8('0x7')](0x9)[_0xc8e8('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc8e8('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0xc8e8('0x4')]('DESC',_0xc8e8('0x1a')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0xc8e8('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xc8e8('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc8e8('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc8e8('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc8e8('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc8e8('0x1d')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc8e8('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc8e8('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0xc8e8('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc8e8('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc8e8('0x7')](0x3)[_0xc8e8('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc8e8('0x7')](0x5)[_0xc8e8('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc8e8('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0xc8e8('0x7')](0x3)[_0xc8e8('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc8e8('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0xc8e8('0x7')](0x5)[_0xc8e8('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xc8e8('0x7')](0x3)[_0xc8e8('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc8e8('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xc8e8('0x7')](0x5)[_0xc8e8('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc8e8('0x23')}}; \ No newline at end of file +var _0xf99c=['#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x420c4c,_0xb72fcc){var _0x5a2a08=function(_0x486e53){while(--_0x486e53){_0x420c4c['push'](_0x420c4c['shift']());}};_0x5a2a08(++_0xb72fcc);}(_0xf99c,0x129));var _0xcf99=function(_0x436ebb,_0x3d0389){_0x436ebb=_0x436ebb-0x0;var _0x35ddf3=_0xf99c[_0x436ebb];return _0x35ddf3;};'use strict';var Sequelize=require(_0xcf99('0x0'));module[_0xcf99('0x1')]={'name':{'type':Sequelize[_0xcf99('0x2')],'unique':_0xcf99('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xcf99('0x4')](_0xcf99('0x5')),'allowNull':![],'defaultValue':_0xcf99('0x5')},'description':{'type':Sequelize[_0xcf99('0x2')]},'active':{'type':Sequelize[_0xcf99('0x6')],'defaultValue':0x0,'comment':_0xcf99('0x7')},'limitCalls':{'type':Sequelize[_0xcf99('0x8')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xcf99('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0xcf99('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xcf99('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xcf99('0x8')](0x3)[_0xcf99('0xa')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xcf99('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcf99('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xcf99('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcf99('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0xcf99('0x8')](0x3)[_0xcf99('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcf99('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0xcf99('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcf99('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xcf99('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xcf99('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xcf99('0x8')](0x5)[_0xcf99('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcf99('0x10')},'dialGlobalMaxRetry':{'type':Sequelize[_0xcf99('0x8')](0x3)[_0xcf99('0xa')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xcf99('0x11')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xcf99('0x12')},'dialCheckDuplicateType':{'type':Sequelize[_0xcf99('0x4')](_0xcf99('0x13'),_0xcf99('0x14'),_0xcf99('0x15')),'defaultValue':_0xcf99('0x13')},'dialAMDActive':{'type':Sequelize[_0xcf99('0x6')],'defaultValue':0x0,'comment':_0xcf99('0x16')},'dialAMDInitialSilence':{'type':Sequelize[_0xcf99('0x8')](0x9)[_0xcf99('0xa')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xcf99('0x17')},'dialAMDGreeting':{'type':Sequelize[_0xcf99('0x8')](0x9)[_0xcf99('0xa')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xcf99('0x18')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xcf99('0x8')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xcf99('0x8')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xcf99('0x19')},'dialAMDMinWordLength':{'type':Sequelize[_0xcf99('0x8')](0x9)[_0xcf99('0xa')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xcf99('0xa')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xcf99('0x8')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xcf99('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xcf99('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xcf99('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xcf99('0xa')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xcf99('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize[_0xcf99('0x4')](_0xcf99('0x1d'),_0xcf99('0x1e')),'defaultValue':_0xcf99('0x1d')},'dialPrefix':{'type':Sequelize[_0xcf99('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xcf99('0xa')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xcf99('0xa')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xcf99('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xcf99('0x8')](0x5)[_0xcf99('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcf99('0x1f')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xcf99('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcf99('0x20')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xcf99('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xcf99('0x8')](0x3)[_0xcf99('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcf99('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xcf99('0x8')](0x5)[_0xcf99('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcf99('0x22')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xcf99('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xcf99('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcf99('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xcf99('0x8')](0x3)[_0xcf99('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcf99('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xcf99('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 427d50c..df028b6 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 _0x9da9=['omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','getHopperHistories','CampaignId','CmHopperFinal','order','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','toString','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','cm_hopper','fromQuery','cm_contacts','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','reject','save','update','then','get','IvrCampaigns','UserProfileResource','destroy','error','name','send','index','map','Campaign','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','show','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','clone','params','rawAttributes','includeAll'];(function(_0x3d6d05,_0x16c8b8){var _0x288baf=function(_0x2e0179){while(--_0x2e0179){_0x3d6d05['push'](_0x3d6d05['shift']());}};_0x288baf(++_0x16c8b8);}(_0x9da9,0x140));var _0x99da=function(_0x5a0681,_0x5cbc10){_0x5a0681=_0x5a0681-0x0;var _0x2d3a74=_0x9da9[_0x5a0681];return _0x2d3a74;};'use strict';var emlformat=require(_0x99da('0x0'));var rimraf=require(_0x99da('0x1'));var zipdir=require(_0x99da('0x2'));var jsonpatch=require(_0x99da('0x3'));var rp=require(_0x99da('0x4'));var moment=require(_0x99da('0x5'));var BPromise=require(_0x99da('0x6'));var Mustache=require(_0x99da('0x7'));var util=require(_0x99da('0x8'));var path=require('path');var sox=require(_0x99da('0x9'));var csv=require('to-csv');var ejs=require(_0x99da('0xa'));var fs=require('fs');var fs_extra=require(_0x99da('0xb'));var _=require('lodash');var squel=require(_0x99da('0xc'));var crypto=require(_0x99da('0xd'));var jsforce=require(_0x99da('0xe'));var deskjs=require(_0x99da('0xf'));var toCsv=require('to-csv');var querystring=require(_0x99da('0x10'));var Papa=require('papaparse');var Redis=require(_0x99da('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x99da('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x99da('0x13'));var logger=require(_0x99da('0x14'))(_0x99da('0x15'));var utils=require(_0x99da('0x16'));var config=require(_0x99da('0x17'));var licenseUtil=require(_0x99da('0x18'));var db=require(_0x99da('0x19'))['db'];function respondWithStatusCode(_0x25fe8c,_0x3c0360){_0x3c0360=_0x3c0360||0xcc;return function(_0x15ae9f){if(_0x15ae9f){return _0x25fe8c[_0x99da('0x1a')](_0x3c0360);}return _0x25fe8c[_0x99da('0x1b')](_0x3c0360)[_0x99da('0x1c')]();};}function respondWithResult(_0x5ea14d,_0x3673c2){_0x3673c2=_0x3673c2||0xc8;return function(_0x43bef2){if(_0x43bef2){return _0x5ea14d[_0x99da('0x1b')](_0x3673c2)[_0x99da('0x1d')](_0x43bef2);}};}function respondWithFilteredResult(_0x32050c,_0x360469){return function(_0x441d0b){if(_0x441d0b){var _0x32d30f=typeof _0x360469[_0x99da('0x1e')]==='undefined'&&typeof _0x360469[_0x99da('0x1f')]==='undefined';var _0x241f18=_0x441d0b['count'];var _0x42c825=_0x32d30f?0x0:_0x360469[_0x99da('0x1e')];var _0x7d15ca=_0x32d30f?_0x441d0b[_0x99da('0x20')]:_0x360469[_0x99da('0x1e')]+_0x360469['limit'];var _0x2a318d;if(_0x7d15ca>=_0x241f18){_0x7d15ca=_0x241f18;_0x2a318d=0xc8;}else{_0x2a318d=0xce;}_0x32050c[_0x99da('0x1b')](_0x2a318d);return _0x32050c[_0x99da('0x21')]('Content-Range',_0x42c825+'-'+_0x7d15ca+'/'+_0x241f18)[_0x99da('0x1d')](_0x441d0b);}return null;};}function patchUpdates(_0x5ea04c){return function(_0x1e77b4){try{jsonpatch['apply'](_0x1e77b4,_0x5ea04c,!![]);}catch(_0x46c2c7){return BPromise[_0x99da('0x22')](_0x46c2c7);}return _0x1e77b4[_0x99da('0x23')]();};}function saveUpdates(_0xf42060,_0x30facf){return function(_0x4ef573){if(_0x4ef573){return _0x4ef573[_0x99da('0x24')](_0xf42060)[_0x99da('0x25')](function(_0x279c36){return _0x279c36;});}return null;};}function removeEntity(_0x1702b5,_0x4df08a){return function(_0x1b011d){if(_0x1b011d){return _0x1b011d['destroy']()[_0x99da('0x25')](function(){var _0x58a1ea=_0x1b011d[_0x99da('0x26')]({'plain':!![]});var _0x25cc3a=_0x99da('0x27');return db[_0x99da('0x28')][_0x99da('0x29')]({'where':{'type':_0x25cc3a,'resourceId':_0x58a1ea['id']}})[_0x99da('0x25')](function(){return _0x1b011d;});})['then'](function(){_0x1702b5[_0x99da('0x1b')](0xcc)[_0x99da('0x1c')]();});}};}function handleEntityNotFound(_0x3bd1fc,_0x42e412){return function(_0x4c825d){if(!_0x4c825d){_0x3bd1fc[_0x99da('0x1a')](0x194);}return _0x4c825d;};}function handleError(_0x3891ea,_0x10a404){_0x10a404=_0x10a404||0x1f4;return function(_0x3e5ff3){logger[_0x99da('0x2a')](_0x3e5ff3['stack']);if(_0x3e5ff3[_0x99da('0x2b')]){delete _0x3e5ff3[_0x99da('0x2b')];}_0x3891ea[_0x99da('0x1b')](_0x10a404)[_0x99da('0x2c')](_0x3e5ff3);};}exports[_0x99da('0x2d')]=function(_0x479828,_0x556bd7){var _0xfac56c={},_0x496981={},_0x1b0427={'count':0x0,'rows':[]};var _0x15fff2=_[_0x99da('0x2e')](db[_0x99da('0x2f')]['rawAttributes'],function(_0x173da3){return{'name':_0x173da3[_0x99da('0x30')],'type':_0x173da3[_0x99da('0x31')][_0x99da('0x32')]};});_0x496981[_0x99da('0x33')]=_[_0x99da('0x2e')](_0x15fff2,_0x99da('0x2b'));_0x496981[_0x99da('0x34')]=_[_0x99da('0x35')](_0x479828['query']);_0x496981[_0x99da('0x36')]=_[_0x99da('0x37')](_0x496981[_0x99da('0x33')],_0x496981[_0x99da('0x34')]);_0xfac56c[_0x99da('0x38')]=_[_0x99da('0x37')](_0x496981[_0x99da('0x33')],qs['fields'](_0x479828[_0x99da('0x34')][_0x99da('0x39')]));_0xfac56c[_0x99da('0x38')]=_0xfac56c[_0x99da('0x38')][_0x99da('0x3a')]?_0xfac56c[_0x99da('0x38')]:_0x496981[_0x99da('0x33')];if(!_0x479828[_0x99da('0x34')][_0x99da('0x3b')](_0x99da('0x3c'))){_0xfac56c[_0x99da('0x1f')]=qs[_0x99da('0x1f')](_0x479828[_0x99da('0x34')]['limit']);_0xfac56c['offset']=qs[_0x99da('0x1e')](_0x479828[_0x99da('0x34')][_0x99da('0x1e')]);}_0xfac56c['order']=qs[_0x99da('0x3d')](_0x479828[_0x99da('0x34')][_0x99da('0x3d')]);_0xfac56c[_0x99da('0x3e')]=qs[_0x99da('0x36')](_[_0x99da('0x3f')](_0x479828[_0x99da('0x34')],_0x496981['filters']),_0x15fff2);if(_0x479828['query']['filter']){_0xfac56c[_0x99da('0x3e')]=_[_0x99da('0x40')](_0xfac56c[_0x99da('0x3e')],{'$or':_[_0x99da('0x2e')](_0x15fff2,function(_0x3351dd){if(_0x3351dd[_0x99da('0x31')]!==_0x99da('0x41')){var _0x2f866d={};_0x2f866d[_0x3351dd[_0x99da('0x2b')]]={'$like':'%'+_0x479828[_0x99da('0x34')][_0x99da('0x42')]+'%'};return _0x2f866d;}})});}_0xfac56c=_[_0x99da('0x40')]({},_0xfac56c,_0x479828[_0x99da('0x43')]);var _0x425705={'where':_0xfac56c[_0x99da('0x3e')]};return db['Campaign']['count'](_0x425705)['then'](function(_0x2447d6){_0x1b0427[_0x99da('0x20')]=_0x2447d6;if(_0x479828[_0x99da('0x34')]['includeAll']){_0xfac56c[_0x99da('0x44')]=[{'all':!![]}];}return db[_0x99da('0x2f')][_0x99da('0x45')](_0xfac56c);})[_0x99da('0x25')](function(_0x47ac4e){_0x1b0427[_0x99da('0x46')]=_0x47ac4e;return _0x1b0427;})[_0x99da('0x25')](respondWithFilteredResult(_0x556bd7,_0xfac56c))['catch'](handleError(_0x556bd7,null));};exports[_0x99da('0x47')]=function(_0x18e687,_0x1d47e8){var _0x2cd7bb={'raw':![],'where':{'id':_0x18e687['params']['id']}},_0x4dd02a={};_0x4dd02a[_0x99da('0x33')]=_[_0x99da('0x35')](db[_0x99da('0x2f')]['rawAttributes']);_0x4dd02a[_0x99da('0x34')]=_['keys'](_0x18e687[_0x99da('0x34')]);_0x4dd02a[_0x99da('0x36')]=_[_0x99da('0x37')](_0x4dd02a[_0x99da('0x33')],_0x4dd02a[_0x99da('0x34')]);_0x2cd7bb[_0x99da('0x38')]=_[_0x99da('0x37')](_0x4dd02a[_0x99da('0x33')],qs[_0x99da('0x39')](_0x18e687[_0x99da('0x34')][_0x99da('0x39')]));_0x2cd7bb['attributes']=_0x2cd7bb[_0x99da('0x38')]['length']?_0x2cd7bb[_0x99da('0x38')]:_0x4dd02a[_0x99da('0x33')];if(_0x18e687[_0x99da('0x34')]['includeAll']){_0x2cd7bb[_0x99da('0x44')]=[{'all':!![]}];}_0x2cd7bb=_[_0x99da('0x40')]({},_0x2cd7bb,_0x18e687[_0x99da('0x43')]);return db[_0x99da('0x2f')]['find'](_0x2cd7bb)[_0x99da('0x25')](handleEntityNotFound(_0x1d47e8,null))[_0x99da('0x25')](respondWithResult(_0x1d47e8,null))[_0x99da('0x48')](handleError(_0x1d47e8,null));};exports[_0x99da('0x49')]=function(_0x31dd7e,_0x746eb5){return db['Campaign'][_0x99da('0x49')](_0x31dd7e[_0x99da('0x4a')],{})[_0x99da('0x25')](function(_0x39a33f){var _0x8c2ac5=_0x31dd7e[_0x99da('0x4b')][_0x99da('0x26')]({'plain':!![]});if(!_0x8c2ac5)throw new Error(_0x99da('0x4c'));if(_0x8c2ac5['role']===_0x99da('0x4b')){var _0x2df6a6=_0x39a33f[_0x99da('0x26')]({'plain':!![]});var _0x31b7da=_0x99da('0x27');return db[_0x99da('0x4d')][_0x99da('0x4e')]({'where':{'name':_0x31b7da,'userProfileId':_0x8c2ac5[_0x99da('0x4f')]},'raw':!![]})[_0x99da('0x25')](function(_0x3cf1c4){if(_0x3cf1c4&&_0x3cf1c4[_0x99da('0x50')]===0x0){return db[_0x99da('0x28')][_0x99da('0x49')]({'name':_0x2df6a6[_0x99da('0x2b')],'resourceId':_0x2df6a6['id'],'type':_0x3cf1c4['name'],'sectionId':_0x3cf1c4['id']},{})['then'](function(){return _0x39a33f;});}else{return _0x39a33f;}})[_0x99da('0x48')](function(_0x51b2e0){logger[_0x99da('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x51b2e0);throw _0x51b2e0;});}return _0x39a33f;})[_0x99da('0x25')](respondWithResult(_0x746eb5,0xc9))[_0x99da('0x48')](handleError(_0x746eb5,null));};exports[_0x99da('0x51')]=function(_0x2255f9,_0x53ddcd){var _0x3402d2={'where':{'id':_0x2255f9[_0x99da('0x52')]['id']}},_0x3001ee={};_0x3001ee[_0x99da('0x33')]=_[_0x99da('0x35')](db[_0x99da('0x2f')][_0x99da('0x53')]);_0x3402d2[_0x99da('0x38')]=_[_0x99da('0x37')](_0x3001ee[_0x99da('0x33')],qs['fields'](_0x2255f9[_0x99da('0x34')][_0x99da('0x39')]));_0x3402d2[_0x99da('0x38')]=_0x3402d2[_0x99da('0x38')][_0x99da('0x3a')]?_0x3402d2[_0x99da('0x38')]:_0x3001ee[_0x99da('0x33')];if(_0x2255f9[_0x99da('0x34')][_0x99da('0x54')]){_0x3402d2[_0x99da('0x44')]=[{'all':!![]}];}_0x3402d2=_[_0x99da('0x40')]({},_0x3402d2,_0x2255f9[_0x99da('0x43')]);return db[_0x99da('0x2f')][_0x99da('0x4e')](_0x3402d2)['then'](handleEntityNotFound(_0x53ddcd,null))[_0x99da('0x25')](function(_0x39774b){if(_0x39774b){var _0x3a5cd2=_0x39774b[_0x99da('0x26')]({'plain':!![]});_0x3a5cd2=qs[_0x99da('0x55')](_0x3a5cd2,['id',_0x99da('0x56'),_0x99da('0x57')]);_0x2255f9[_0x99da('0x4a')]=_[_0x99da('0x55')](_0x2255f9[_0x99da('0x4a')],['id',_0x99da('0x56'),_0x99da('0x57')]);return db[_0x99da('0x2f')][_0x99da('0x49')](_[_0x99da('0x40')](_0x3a5cd2,_0x2255f9[_0x99da('0x4a')]),{'include':_0x2255f9[_0x99da('0x34')][_0x99da('0x54')]?[{'all':!![]}]:undefined})[_0x99da('0x25')](function(_0x40b8ff){var _0x12fe9e=_0x2255f9[_0x99da('0x4b')][_0x99da('0x26')]({'plain':!![]});if(!_0x12fe9e)throw new Error(_0x99da('0x4c'));if(_0x12fe9e['role']===_0x99da('0x4b')){var _0xf26b42=_0x40b8ff[_0x99da('0x26')]({'plain':!![]});var _0x4843a2=_0x99da('0x27');return db[_0x99da('0x4d')][_0x99da('0x4e')]({'where':{'name':_0x4843a2,'userProfileId':_0x12fe9e[_0x99da('0x4f')]},'raw':!![]})[_0x99da('0x25')](function(_0x3f5c94){if(_0x3f5c94&&_0x3f5c94[_0x99da('0x50')]===0x0){return db['UserProfileResource'][_0x99da('0x49')]({'name':_0xf26b42[_0x99da('0x2b')],'resourceId':_0xf26b42['id'],'type':_0x3f5c94[_0x99da('0x2b')],'sectionId':_0x3f5c94['id']},{})['then'](function(){return _0x40b8ff;});}else{return _0x40b8ff;}})[_0x99da('0x48')](function(_0x219223){logger['error'](_0x99da('0x58'),_0x219223);throw _0x219223;});}return _0x40b8ff;});}})[_0x99da('0x25')](respondWithResult(_0x53ddcd,0xc9))[_0x99da('0x48')](handleError(_0x53ddcd,null));};exports[_0x99da('0x24')]=function(_0x35948d,_0x1d8561){if(_0x35948d[_0x99da('0x4a')]['id']){delete _0x35948d[_0x99da('0x4a')]['id'];}return db[_0x99da('0x2f')][_0x99da('0x4e')]({'where':{'id':_0x35948d[_0x99da('0x52')]['id']}})[_0x99da('0x25')](handleEntityNotFound(_0x1d8561,null))[_0x99da('0x25')](saveUpdates(_0x35948d[_0x99da('0x4a')],null))[_0x99da('0x25')](respondWithResult(_0x1d8561,null))[_0x99da('0x48')](handleError(_0x1d8561,null));};exports[_0x99da('0x29')]=function(_0x514314,_0x25acf9){return db[_0x99da('0x2f')][_0x99da('0x4e')]({'where':{'id':_0x514314[_0x99da('0x52')]['id']}})[_0x99da('0x25')](handleEntityNotFound(_0x25acf9,null))[_0x99da('0x25')](removeEntity(_0x25acf9,null))[_0x99da('0x48')](handleError(_0x25acf9,null));};exports[_0x99da('0x59')]=function(_0x276bb9,_0x26bda6,_0x144fcf){var _0x315b9d={'raw':!![],'where':{}};var _0x568fe0={};var _0x134f32={'count':0x0,'rows':[]};return db[_0x99da('0x2f')][_0x99da('0x5a')]({'where':{'id':_0x276bb9[_0x99da('0x52')]['id']}})[_0x99da('0x25')](handleEntityNotFound(_0x26bda6,null))[_0x99da('0x25')](function(_0x27072f){if(_0x27072f){_0x568fe0['model']=_[_0x99da('0x35')](db[_0x99da('0x5b')][_0x99da('0x53')]);_0x568fe0[_0x99da('0x34')]=_[_0x99da('0x35')](_0x276bb9['query']);_0x568fe0[_0x99da('0x36')]=_['intersection'](_0x568fe0['model'],_0x568fe0[_0x99da('0x34')]);_0x315b9d[_0x99da('0x38')]=_[_0x99da('0x37')](_0x568fe0[_0x99da('0x33')],qs[_0x99da('0x39')](_0x276bb9[_0x99da('0x34')][_0x99da('0x39')]));_0x315b9d['attributes']=_0x315b9d['attributes'][_0x99da('0x3a')]?_0x315b9d[_0x99da('0x38')]:_0x568fe0['model'];if(!_0x276bb9[_0x99da('0x34')][_0x99da('0x3b')]('nolimit')){_0x315b9d[_0x99da('0x1f')]=qs[_0x99da('0x1f')](_0x276bb9['query'][_0x99da('0x1f')]);_0x315b9d[_0x99da('0x1e')]=qs[_0x99da('0x1e')](_0x276bb9[_0x99da('0x34')][_0x99da('0x1e')]);}_0x315b9d['order']=qs['sort'](_0x276bb9['query']['sort']);_0x315b9d[_0x99da('0x3e')]=qs['filters'](_[_0x99da('0x3f')](_0x276bb9[_0x99da('0x34')],_0x568fe0['filters']));_0x315b9d['where']['CampaignId']=_0x27072f['id'];if(_0x276bb9[_0x99da('0x34')][_0x99da('0x42')]){_0x315b9d[_0x99da('0x3e')]=_[_0x99da('0x40')](_0x315b9d['where'],{'$or':_[_0x99da('0x2e')](_0x315b9d[_0x99da('0x38')],function(_0x57ce0d){var _0x383596={};_0x383596[_0x57ce0d]={'$like':'%'+_0x276bb9[_0x99da('0x34')]['filter']+'%'};return _0x383596;})});}_0x315b9d=_[_0x99da('0x40')]({},_0x315b9d,_0x276bb9['options']);return db[_0x99da('0x5b')]['count']({'where':_0x315b9d[_0x99da('0x3e')]})[_0x99da('0x25')](function(_0x453249){_0x134f32['count']=_0x453249;if(_0x276bb9['query']['includeAll']){_0x315b9d[_0x99da('0x44')]=[{'all':!![]}];}return db[_0x99da('0x5b')][_0x99da('0x45')](_0x315b9d);})[_0x99da('0x25')](function(_0x3071d2){_0x134f32['rows']=_0x3071d2;return _0x134f32;});}})[_0x99da('0x25')](respondWithFilteredResult(_0x26bda6,_0x315b9d))[_0x99da('0x48')](handleError(_0x26bda6,null));};exports[_0x99da('0x5c')]=function(_0x765828,_0x311fe9,_0x3fed56){var _0x1224fe={'raw':!![],'where':{}};var _0x1b7ec0={};var _0x13be60={'count':0x0,'rows':[]};return db['Campaign'][_0x99da('0x5a')]({'where':{'id':_0x765828['params']['id']}})[_0x99da('0x25')](handleEntityNotFound(_0x311fe9,null))['then'](function(_0x17bf0b){if(_0x17bf0b){_0x1b7ec0[_0x99da('0x33')]=_[_0x99da('0x35')](db['CmHopperHistory'][_0x99da('0x53')]);_0x1b7ec0[_0x99da('0x34')]=_[_0x99da('0x35')](_0x765828['query']);_0x1b7ec0['filters']=_[_0x99da('0x37')](_0x1b7ec0['model'],_0x1b7ec0[_0x99da('0x34')]);_0x1224fe['attributes']=_[_0x99da('0x37')](_0x1b7ec0[_0x99da('0x33')],qs[_0x99da('0x39')](_0x765828[_0x99da('0x34')]['fields']));_0x1224fe[_0x99da('0x38')]=_0x1224fe['attributes'][_0x99da('0x3a')]?_0x1224fe['attributes']:_0x1b7ec0[_0x99da('0x33')];if(!_0x765828[_0x99da('0x34')][_0x99da('0x3b')]('nolimit')){_0x1224fe[_0x99da('0x1f')]=qs['limit'](_0x765828[_0x99da('0x34')][_0x99da('0x1f')]);_0x1224fe[_0x99da('0x1e')]=qs[_0x99da('0x1e')](_0x765828[_0x99da('0x34')][_0x99da('0x1e')]);}_0x1224fe['order']=qs[_0x99da('0x3d')](_0x765828[_0x99da('0x34')][_0x99da('0x3d')]);_0x1224fe['where']=qs[_0x99da('0x36')](_[_0x99da('0x3f')](_0x765828['query'],_0x1b7ec0[_0x99da('0x36')]));_0x1224fe[_0x99da('0x3e')][_0x99da('0x5d')]=_0x17bf0b['id'];if(_0x765828[_0x99da('0x34')]['filter']){_0x1224fe[_0x99da('0x3e')]=_[_0x99da('0x40')](_0x1224fe[_0x99da('0x3e')],{'$or':_[_0x99da('0x2e')](_0x1224fe[_0x99da('0x38')],function(_0x12bd59){var _0x40b29d={};_0x40b29d[_0x12bd59]={'$like':'%'+_0x765828['query'][_0x99da('0x42')]+'%'};return _0x40b29d;})});}_0x1224fe=_[_0x99da('0x40')]({},_0x1224fe,_0x765828[_0x99da('0x43')]);return db['CmHopperHistory']['count']({'where':_0x1224fe[_0x99da('0x3e')]})[_0x99da('0x25')](function(_0x1c22c8){_0x13be60['count']=_0x1c22c8;if(_0x765828['query']['includeAll']){_0x1224fe['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x99da('0x45')](_0x1224fe);})['then'](function(_0x574f08){_0x13be60[_0x99da('0x46')]=_0x574f08;return _0x13be60;});}})[_0x99da('0x25')](respondWithFilteredResult(_0x311fe9,_0x1224fe))[_0x99da('0x48')](handleError(_0x311fe9,null));};exports['getHopperFinals']=function(_0xd76c80,_0x11e539,_0x511918){var _0x1df9f={'raw':!![],'where':{}};var _0x3c58c9={};var _0x5969da={'count':0x0,'rows':[]};return db[_0x99da('0x2f')][_0x99da('0x5a')]({'where':{'id':_0xd76c80[_0x99da('0x52')]['id']}})[_0x99da('0x25')](handleEntityNotFound(_0x11e539,null))[_0x99da('0x25')](function(_0x33f33c){if(_0x33f33c){_0x3c58c9['model']=_[_0x99da('0x35')](db[_0x99da('0x5e')][_0x99da('0x53')]);_0x3c58c9[_0x99da('0x34')]=_[_0x99da('0x35')](_0xd76c80[_0x99da('0x34')]);_0x3c58c9['filters']=_['intersection'](_0x3c58c9[_0x99da('0x33')],_0x3c58c9[_0x99da('0x34')]);_0x1df9f[_0x99da('0x38')]=_[_0x99da('0x37')](_0x3c58c9[_0x99da('0x33')],qs[_0x99da('0x39')](_0xd76c80[_0x99da('0x34')][_0x99da('0x39')]));_0x1df9f[_0x99da('0x38')]=_0x1df9f[_0x99da('0x38')][_0x99da('0x3a')]?_0x1df9f[_0x99da('0x38')]:_0x3c58c9['model'];if(!_0xd76c80['query'][_0x99da('0x3b')](_0x99da('0x3c'))){_0x1df9f[_0x99da('0x1f')]=qs[_0x99da('0x1f')](_0xd76c80['query'][_0x99da('0x1f')]);_0x1df9f[_0x99da('0x1e')]=qs['offset'](_0xd76c80[_0x99da('0x34')][_0x99da('0x1e')]);}_0x1df9f[_0x99da('0x5f')]=qs[_0x99da('0x3d')](_0xd76c80['query'][_0x99da('0x3d')]);_0x1df9f['where']=qs[_0x99da('0x36')](_[_0x99da('0x3f')](_0xd76c80['query'],_0x3c58c9['filters']));_0x1df9f[_0x99da('0x3e')]['CampaignId']=_0x33f33c['id'];if(_0xd76c80['query'][_0x99da('0x42')]){_0x1df9f[_0x99da('0x3e')]=_[_0x99da('0x40')](_0x1df9f[_0x99da('0x3e')],{'$or':_[_0x99da('0x2e')](_0x1df9f['attributes'],function(_0x45e8ff){var _0x198ebe={};_0x198ebe[_0x45e8ff]={'$like':'%'+_0xd76c80[_0x99da('0x34')][_0x99da('0x42')]+'%'};return _0x198ebe;})});}_0x1df9f=_[_0x99da('0x40')]({},_0x1df9f,_0xd76c80[_0x99da('0x43')]);return db[_0x99da('0x5e')][_0x99da('0x20')]({'where':_0x1df9f['where']})[_0x99da('0x25')](function(_0x4450a2){_0x5969da[_0x99da('0x20')]=_0x4450a2;if(_0xd76c80['query'][_0x99da('0x54')]){_0x1df9f[_0x99da('0x44')]=[{'all':!![]}];}return db[_0x99da('0x5e')][_0x99da('0x45')](_0x1df9f);})[_0x99da('0x25')](function(_0xa330e6){_0x5969da['rows']=_0xa330e6;return _0x5969da;});}})['then'](respondWithFilteredResult(_0x11e539,_0x1df9f))[_0x99da('0x48')](handleError(_0x11e539,null));};exports['getHopperBlacks']=function(_0x463655,_0x6c6ff1,_0x51c894){var _0x103164={'raw':!![],'where':{}};var _0x5ed12a={};var _0x1f98a2={'count':0x0,'rows':[]};return db['Campaign'][_0x99da('0x5a')]({'where':{'id':_0x463655[_0x99da('0x52')]['id']}})[_0x99da('0x25')](handleEntityNotFound(_0x6c6ff1,null))[_0x99da('0x25')](function(_0x179f15){if(_0x179f15){_0x5ed12a[_0x99da('0x33')]=_[_0x99da('0x35')](db[_0x99da('0x60')][_0x99da('0x53')]);_0x5ed12a[_0x99da('0x34')]=_[_0x99da('0x35')](_0x463655['query']);_0x5ed12a[_0x99da('0x36')]=_[_0x99da('0x37')](_0x5ed12a[_0x99da('0x33')],_0x5ed12a[_0x99da('0x34')]);_0x103164[_0x99da('0x38')]=_['intersection'](_0x5ed12a[_0x99da('0x33')],qs['fields'](_0x463655['query'][_0x99da('0x39')]));_0x103164['attributes']=_0x103164[_0x99da('0x38')][_0x99da('0x3a')]?_0x103164['attributes']:_0x5ed12a[_0x99da('0x33')];if(!_0x463655[_0x99da('0x34')][_0x99da('0x3b')](_0x99da('0x3c'))){_0x103164[_0x99da('0x1f')]=qs[_0x99da('0x1f')](_0x463655['query'][_0x99da('0x1f')]);_0x103164[_0x99da('0x1e')]=qs[_0x99da('0x1e')](_0x463655[_0x99da('0x34')][_0x99da('0x1e')]);}_0x103164[_0x99da('0x5f')]=qs['sort'](_0x463655[_0x99da('0x34')][_0x99da('0x3d')]);_0x103164[_0x99da('0x3e')]=qs[_0x99da('0x36')](_[_0x99da('0x3f')](_0x463655[_0x99da('0x34')],_0x5ed12a[_0x99da('0x36')]));_0x103164[_0x99da('0x3e')][_0x99da('0x5d')]=_0x179f15['id'];if(_0x463655[_0x99da('0x34')]['filter']){_0x103164[_0x99da('0x3e')]=_[_0x99da('0x40')](_0x103164[_0x99da('0x3e')],{'$or':_[_0x99da('0x2e')](_0x103164[_0x99da('0x38')],function(_0x4151d0){var _0x33d588={};_0x33d588[_0x4151d0]={'$like':'%'+_0x463655[_0x99da('0x34')][_0x99da('0x42')]+'%'};return _0x33d588;})});}_0x103164=_[_0x99da('0x40')]({},_0x103164,_0x463655[_0x99da('0x43')]);return db[_0x99da('0x60')][_0x99da('0x20')]({'where':_0x103164['where']})['then'](function(_0x15e5f3){_0x1f98a2['count']=_0x15e5f3;if(_0x463655[_0x99da('0x34')][_0x99da('0x54')]){_0x103164[_0x99da('0x44')]=[{'all':!![]}];}return db[_0x99da('0x60')][_0x99da('0x45')](_0x103164);})[_0x99da('0x25')](function(_0x4bc72a){_0x1f98a2[_0x99da('0x46')]=_0x4bc72a;return _0x1f98a2;});}})[_0x99da('0x25')](respondWithFilteredResult(_0x6c6ff1,_0x103164))[_0x99da('0x48')](handleError(_0x6c6ff1,null));};exports[_0x99da('0x61')]=function(_0x4011a8,_0x53df1b,_0x5d9e6f){var _0x2b3348={};var _0x1c5501={};var _0x1254bb;var _0x14e5e;return db[_0x99da('0x2f')]['findOne']({'where':{'id':_0x4011a8[_0x99da('0x52')]['id']}})['then'](handleEntityNotFound(_0x53df1b,null))[_0x99da('0x25')](function(_0x2b5b32){if(_0x2b5b32){_0x1254bb=_0x2b5b32;_0x1c5501['model']=_[_0x99da('0x35')](db[_0x99da('0x62')][_0x99da('0x53')]);_0x1c5501[_0x99da('0x34')]=_['keys'](_0x4011a8[_0x99da('0x34')]);_0x1c5501[_0x99da('0x36')]=_[_0x99da('0x37')](_0x1c5501[_0x99da('0x33')],_0x1c5501[_0x99da('0x34')]);_0x2b3348[_0x99da('0x38')]=_[_0x99da('0x37')](_0x1c5501['model'],qs[_0x99da('0x39')](_0x4011a8['query'][_0x99da('0x39')]));_0x2b3348[_0x99da('0x38')]=_0x2b3348[_0x99da('0x38')]['length']?_0x2b3348[_0x99da('0x38')]:_0x1c5501[_0x99da('0x33')];_0x2b3348['order']=qs[_0x99da('0x3d')](_0x4011a8[_0x99da('0x34')][_0x99da('0x3d')]);_0x2b3348['where']=qs[_0x99da('0x36')](_['pick'](_0x4011a8[_0x99da('0x34')],_0x1c5501['filters']));if(_0x4011a8[_0x99da('0x34')]['filter']){_0x2b3348[_0x99da('0x3e')]=_[_0x99da('0x40')](_0x2b3348[_0x99da('0x3e')],{'$or':_[_0x99da('0x2e')](_0x2b3348['attributes'],function(_0x30849b){var _0x46bd96={};_0x46bd96[_0x30849b]={'$like':'%'+_0x4011a8[_0x99da('0x34')]['filter']+'%'};return _0x46bd96;})});}_0x2b3348=_['merge']({},_0x2b3348,_0x4011a8[_0x99da('0x43')]);return _0x1254bb['getLists'](_0x2b3348);}})[_0x99da('0x25')](function(_0x48734b){if(_0x48734b){_0x14e5e=_0x48734b[_0x99da('0x3a')];if(!_0x4011a8[_0x99da('0x34')][_0x99da('0x3b')]('nolimit')){_0x2b3348[_0x99da('0x1f')]=qs[_0x99da('0x1f')](_0x4011a8['query'][_0x99da('0x1f')]);_0x2b3348['offset']=qs[_0x99da('0x1e')](_0x4011a8['query'][_0x99da('0x1e')]);}return _0x1254bb['getLists'](_0x2b3348);}})[_0x99da('0x25')](function(_0x5797df){if(_0x5797df){return _0x5797df?{'count':_0x14e5e,'rows':_0x5797df}:null;}})['then'](respondWithResult(_0x53df1b,null))[_0x99da('0x48')](handleError(_0x53df1b,null));};exports[_0x99da('0x63')]=function(_0x2c5450,_0x50fd64,_0x5c53ea){var _0xecbafd,_0x4b0081;return db[_0x99da('0x2f')][_0x99da('0x4e')]({'where':{'id':_0x2c5450['params']['id']}})[_0x99da('0x25')](handleEntityNotFound(_0x50fd64,null))[_0x99da('0x25')](function(_0x47e6d9){if(_0x47e6d9){_0x4b0081=_0x47e6d9;return _0x47e6d9[_0x99da('0x63')](_0x2c5450[_0x99da('0x4a')][_0x99da('0x64')],_['omit'](_0x2c5450[_0x99da('0x4a')],['ids','id'])||{});}return null;})[_0x99da('0x65')](function(_0x394d5d){var _0x3af076;_0xecbafd=_0x394d5d||[];var _0x1941d8=[];if(_0x394d5d){for(var _0x1159b6=0x0;_0x1159b6<_0x394d5d[_0x99da('0x3a')];_0x1159b6+=0x1){var _0x32675c=_0x394d5d[_0x1159b6][_0x99da('0x26')]({'plain':!![]});_0x4b0081[_0x99da('0x66')]=_0x2c5450[_0x99da('0x4a')][_0x99da('0x66')]?_0x2c5450[_0x99da('0x4a')][_0x99da('0x66')]:_0x4b0081['dialCheckDuplicateType'];switch(_0x4b0081[_0x99da('0x66')]){case _0x99da('0x67'):_0x3af076=squel[_0x99da('0x68')]()[_0x99da('0x69')]('cm_hopper')['fromQuery']([_0x99da('0x6a'),_0x99da('0x6b'),_0x99da('0x6c'),_0x99da('0x6d'),'CampaignId',_0x99da('0x56'),_0x99da('0x57')],squel[_0x99da('0x6e')]()[_0x99da('0x6f')](_0x99da('0x6a'),_0x99da('0x6a'))['field'](_0x99da('0x70'),'scheduledAt')[_0x99da('0x6f')]('id',_0x99da('0x6c'))[_0x99da('0x6f')](_0x32675c[_0x99da('0x71')]['toString'](),_0x99da('0x6d'))['field'](_0x2c5450[_0x99da('0x52')]['id']['toString'](),_0x99da('0x5d'))['field']('NOW()',_0x99da('0x56'))[_0x99da('0x6f')](_0x99da('0x70'),_0x99da('0x57'))[_0x99da('0x72')]('cm_contacts')[_0x99da('0x3e')](_0x99da('0x73'))[_0x99da('0x3e')](_0x99da('0x74'),_0x32675c[_0x99da('0x71')][_0x99da('0x75')]())[_0x99da('0x3e')](_0x99da('0x76'))['where'](_0x99da('0x77'),squel[_0x99da('0x6e')]()[_0x99da('0x6f')](_0x99da('0x78'))['from'](_0x99da('0x79'))[_0x99da('0x3e')]('CampaignId\x20=\x20?',_0x2c5450[_0x99da('0x52')]['id'][_0x99da('0x75')]()))[_0x99da('0x3e')](_0x99da('0x77'),squel[_0x99da('0x6e')]()[_0x99da('0x6f')](_0x99da('0x7a'))[_0x99da('0x72')]('cm_hopper')['where'](_0x99da('0x7b'),_0x2c5450[_0x99da('0x52')]['id'][_0x99da('0x75')]())))[_0x99da('0x75')]();break;case _0x99da('0x7c'):_0x3af076=squel[_0x99da('0x68')]()[_0x99da('0x69')](_0x99da('0x7d'))[_0x99da('0x7e')]([_0x99da('0x6a'),_0x99da('0x6b'),_0x99da('0x6c'),_0x99da('0x6d'),_0x99da('0x5d'),_0x99da('0x56'),'updatedAt'],squel[_0x99da('0x6e')]()[_0x99da('0x6f')](_0x99da('0x6a'),_0x99da('0x6a'))[_0x99da('0x6f')](_0x99da('0x70'),'scheduledAt')[_0x99da('0x6f')]('id','ContactId')[_0x99da('0x6f')](_0x32675c[_0x99da('0x71')]['toString'](),_0x99da('0x6d'))['field'](_0x2c5450[_0x99da('0x52')]['id'][_0x99da('0x75')](),_0x99da('0x5d'))['field']('NOW()',_0x99da('0x56'))[_0x99da('0x6f')](_0x99da('0x70'),_0x99da('0x57'))['from'](_0x99da('0x7f'))['where'](_0x99da('0x73'))[_0x99da('0x3e')]('ListId\x20=\x20?',_0x32675c['CmListId'][_0x99da('0x75')]())[_0x99da('0x3e')](_0x99da('0x76'))[_0x99da('0x3e')](_0x99da('0x77'),squel[_0x99da('0x6e')]()['field'](_0x99da('0x7a'))[_0x99da('0x72')](_0x99da('0x7d'))[_0x99da('0x3e')](_0x99da('0x7b'),_0x2c5450[_0x99da('0x52')]['id'][_0x99da('0x75')]())))[_0x99da('0x75')]();break;default:_0x3af076=squel[_0x99da('0x68')]()[_0x99da('0x69')](_0x99da('0x7d'))['fromQuery']([_0x99da('0x6a'),_0x99da('0x6b'),_0x99da('0x6c'),_0x99da('0x6d'),'CampaignId',_0x99da('0x56'),'updatedAt'],squel[_0x99da('0x6e')]()['field'](_0x99da('0x6a'),_0x99da('0x6a'))[_0x99da('0x6f')](_0x99da('0x70'),_0x99da('0x6b'))['field']('id',_0x99da('0x6c'))[_0x99da('0x6f')](_0x32675c[_0x99da('0x71')][_0x99da('0x75')](),_0x99da('0x6d'))[_0x99da('0x6f')](_0x2c5450['params']['id'][_0x99da('0x75')](),_0x99da('0x5d'))[_0x99da('0x6f')](_0x99da('0x70'),_0x99da('0x56'))[_0x99da('0x6f')](_0x99da('0x70'),_0x99da('0x57'))[_0x99da('0x72')](_0x99da('0x7f'))['where'](_0x99da('0x73'))[_0x99da('0x3e')](_0x99da('0x74'),_0x32675c['CmListId']['toString']())['where'](_0x99da('0x76')))[_0x99da('0x75')]();}_0x1941d8[_0x99da('0x80')](db[_0x99da('0x81')]['query'](_0x3af076));}return BPromise[_0x99da('0x82')](_0x1941d8);}})[_0x99da('0x25')](function(){return _0xecbafd;})['then'](respondWithResult(_0x50fd64,null))[_0x99da('0x48')](handleError(_0x50fd64,null));};exports[_0x99da('0x83')]=function(_0x78e4ad,_0x2993c2,_0x37c52f){return db[_0x99da('0x2f')][_0x99da('0x4e')]({'where':{'id':_0x78e4ad['params']['id']}})['then'](handleEntityNotFound(_0x2993c2,null))['then'](function(_0x91f9e0){if(_0x91f9e0){return _0x91f9e0['removeLists'](_0x78e4ad[_0x99da('0x34')][_0x99da('0x64')]);}})[_0x99da('0x25')](function(_0x1661fd){if(_0x1661fd){return db[_0x99da('0x5b')][_0x99da('0x29')]({'where':{'ListId':_0x78e4ad['query'][_0x99da('0x64')],'CampaignId':_0x78e4ad[_0x99da('0x52')]['id']}})['then'](function(){return _0x1661fd;});}})[_0x99da('0x25')](respondWithStatusCode(_0x2993c2,null))[_0x99da('0x48')](handleError(_0x2993c2,null));};exports[_0x99da('0x84')]=function(_0x1e9b77,_0x13ac8f,_0x1a770c){var _0x2991a4={};var _0x4258fb={};var _0x4eb684;var _0x5a974a;return db[_0x99da('0x2f')]['findOne']({'where':{'id':_0x1e9b77[_0x99da('0x52')]['id']}})['then'](handleEntityNotFound(_0x13ac8f,null))['then'](function(_0x5edc7d){if(_0x5edc7d){_0x4eb684=_0x5edc7d;_0x4258fb[_0x99da('0x33')]=_['keys'](db[_0x99da('0x62')][_0x99da('0x53')]);_0x4258fb[_0x99da('0x34')]=_[_0x99da('0x35')](_0x1e9b77[_0x99da('0x34')]);_0x4258fb[_0x99da('0x36')]=_[_0x99da('0x37')](_0x4258fb['model'],_0x4258fb[_0x99da('0x34')]);_0x2991a4['attributes']=_['intersection'](_0x4258fb['model'],qs[_0x99da('0x39')](_0x1e9b77[_0x99da('0x34')][_0x99da('0x39')]));_0x2991a4[_0x99da('0x38')]=_0x2991a4['attributes'][_0x99da('0x3a')]?_0x2991a4[_0x99da('0x38')]:_0x4258fb[_0x99da('0x33')];_0x2991a4[_0x99da('0x5f')]=qs['sort'](_0x1e9b77[_0x99da('0x34')][_0x99da('0x3d')]);_0x2991a4[_0x99da('0x3e')]=qs['filters'](_['pick'](_0x1e9b77[_0x99da('0x34')],_0x4258fb[_0x99da('0x36')]));if(_0x1e9b77['query'][_0x99da('0x42')]){_0x2991a4[_0x99da('0x3e')]=_[_0x99da('0x40')](_0x2991a4[_0x99da('0x3e')],{'$or':_['map'](_0x2991a4[_0x99da('0x38')],function(_0x12200e){var _0x136071={};_0x136071[_0x12200e]={'$like':'%'+_0x1e9b77[_0x99da('0x34')]['filter']+'%'};return _0x136071;})});}_0x2991a4=_['merge']({},_0x2991a4,_0x1e9b77[_0x99da('0x43')]);return _0x4eb684[_0x99da('0x84')](_0x2991a4);}})[_0x99da('0x25')](function(_0xafc83f){if(_0xafc83f){_0x5a974a=_0xafc83f[_0x99da('0x3a')];if(!_0x1e9b77[_0x99da('0x34')][_0x99da('0x3b')]('nolimit')){_0x2991a4['limit']=qs['limit'](_0x1e9b77[_0x99da('0x34')][_0x99da('0x1f')]);_0x2991a4[_0x99da('0x1e')]=qs[_0x99da('0x1e')](_0x1e9b77[_0x99da('0x34')]['offset']);}return _0x4eb684['getBlackLists'](_0x2991a4);}})['then'](function(_0x4d15ac){if(_0x4d15ac){return _0x4d15ac?{'count':_0x5a974a,'rows':_0x4d15ac}:null;}})['then'](respondWithResult(_0x13ac8f,null))[_0x99da('0x48')](handleError(_0x13ac8f,null));};exports[_0x99da('0x85')]=function(_0x40a328,_0x287a46,_0x50c529){var _0x55116e,_0x106bbe;return db[_0x99da('0x2f')]['find']({'where':{'id':_0x40a328[_0x99da('0x52')]['id']}})[_0x99da('0x25')](handleEntityNotFound(_0x287a46,null))[_0x99da('0x25')](function(_0x2fb687){if(_0x2fb687){_0x106bbe=_0x2fb687;return _0x2fb687['addBlackLists'](_0x40a328[_0x99da('0x4a')]['ids'],_[_0x99da('0x55')](_0x40a328['body'],[_0x99da('0x64'),'id'])||{});}return null;})[_0x99da('0x65')](function(_0x2f6bd8){var _0x1d9a55;_0x55116e=_0x2f6bd8||[];var _0x78426d=[];if(_0x2f6bd8){for(var _0x28f934=0x0;_0x28f934<_0x2f6bd8['length'];_0x28f934+=0x1){var _0x559155=_0x2f6bd8[_0x28f934][_0x99da('0x26')]({'plain':!![]});_0x1d9a55=squel[_0x99da('0x68')]()['into'](_0x99da('0x86'))['fromQuery']([_0x99da('0x6a'),_0x99da('0x6c'),_0x99da('0x6d'),_0x99da('0x5d'),_0x99da('0x56'),'updatedAt'],squel[_0x99da('0x6e')]()['field']('phone',_0x99da('0x6a'))[_0x99da('0x6f')]('id',_0x99da('0x6c'))['field'](_0x559155['CmListId']['toString'](),_0x99da('0x6d'))[_0x99da('0x6f')](_0x40a328['params']['id']['toString'](),_0x99da('0x5d'))['field'](_0x99da('0x70'),_0x99da('0x56'))[_0x99da('0x6f')](_0x99da('0x70'),_0x99da('0x57'))['from'](_0x99da('0x7f'))[_0x99da('0x3e')](_0x99da('0x73'))[_0x99da('0x3e')](_0x99da('0x74'),_0x559155[_0x99da('0x71')]['toString']())[_0x99da('0x3e')](_0x99da('0x76')))['toString']();_0x78426d[_0x99da('0x80')](db[_0x99da('0x81')][_0x99da('0x34')](_0x1d9a55));}return BPromise[_0x99da('0x82')](_0x78426d);}})[_0x99da('0x25')](function(){return _0x55116e;})[_0x99da('0x25')](respondWithResult(_0x287a46,null))[_0x99da('0x48')](handleError(_0x287a46,null));};exports['removeBlackLists']=function(_0x241609,_0x4396dc,_0x2b0fd7){return db[_0x99da('0x2f')][_0x99da('0x4e')]({'where':{'id':_0x241609['params']['id']}})[_0x99da('0x25')](handleEntityNotFound(_0x4396dc,null))[_0x99da('0x25')](function(_0x3e2ff9){if(_0x3e2ff9){return _0x3e2ff9['removeBlackLists'](_0x241609[_0x99da('0x34')][_0x99da('0x64')]);}})['then'](function(_0x13ffb6){if(_0x13ffb6){return db[_0x99da('0x60')]['destroy']({'where':{'ListId':_0x241609['query']['ids'],'CampaignId':_0x241609['params']['id']}})[_0x99da('0x25')](function(){return _0x13ffb6;});}})['then'](respondWithStatusCode(_0x4396dc,null))[_0x99da('0x48')](handleError(_0x4396dc,null));}; \ No newline at end of file +var _0xa96b=['spread','dialCheckDuplicateType','always','insert','into','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','fromQuery','push','sequelize','removeLists','getBlackLists','addBlackLists','removeBlackLists','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','get','IvrCampaigns','UserProfileResource','destroy','error','stack','name','send','index','Campaign','rawAttributes','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','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','clone','omit','createdAt','updatedAt','getHoppers','findOne','CmHopper','CmHopperHistory','getHopperFinals','CmHopperFinal','CampaignId','CmHopperBlack','getLists','CmList','addLists','ids'];(function(_0x56a04b,_0x1d0877){var _0x43f696=function(_0x20dcfd){while(--_0x20dcfd){_0x56a04b['push'](_0x56a04b['shift']());}};_0x43f696(++_0x1d0877);}(_0xa96b,0x133));var _0xba96=function(_0x32f8e1,_0x25ac59){_0x32f8e1=_0x32f8e1-0x0;var _0x8b0e2b=_0xa96b[_0x32f8e1];return _0x8b0e2b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xba96('0x0'));var jsonpatch=require(_0xba96('0x1'));var rp=require(_0xba96('0x2'));var moment=require(_0xba96('0x3'));var BPromise=require(_0xba96('0x4'));var Mustache=require(_0xba96('0x5'));var util=require(_0xba96('0x6'));var path=require(_0xba96('0x7'));var sox=require(_0xba96('0x8'));var csv=require(_0xba96('0x9'));var ejs=require(_0xba96('0xa'));var fs=require('fs');var fs_extra=require(_0xba96('0xb'));var _=require(_0xba96('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xba96('0xd'));var deskjs=require(_0xba96('0xe'));var toCsv=require('to-csv');var querystring=require(_0xba96('0xf'));var Papa=require('papaparse');var Redis=require(_0xba96('0x10'));var authService=require(_0xba96('0x11'));var qs=require(_0xba96('0x12'));var as=require(_0xba96('0x13'));var hardwareService=require(_0xba96('0x14'));var logger=require(_0xba96('0x15'))(_0xba96('0x16'));var utils=require(_0xba96('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xba96('0x18'))['db'];function respondWithStatusCode(_0x116fcb,_0x12765a){_0x12765a=_0x12765a||0xcc;return function(_0x4ac37a){if(_0x4ac37a){return _0x116fcb[_0xba96('0x19')](_0x12765a);}return _0x116fcb[_0xba96('0x1a')](_0x12765a)[_0xba96('0x1b')]();};}function respondWithResult(_0x476b52,_0xe27480){_0xe27480=_0xe27480||0xc8;return function(_0x4fbc79){if(_0x4fbc79){return _0x476b52[_0xba96('0x1a')](_0xe27480)['json'](_0x4fbc79);}};}function respondWithFilteredResult(_0x39917f,_0x13619e){return function(_0xfed4f5){if(_0xfed4f5){var _0x5e0318=typeof _0x13619e[_0xba96('0x1c')]===_0xba96('0x1d')&&typeof _0x13619e['limit']===_0xba96('0x1d');var _0x530964=_0xfed4f5['count'];var _0x4cac0e=_0x5e0318?0x0:_0x13619e[_0xba96('0x1c')];var _0x2a60af=_0x5e0318?_0xfed4f5[_0xba96('0x1e')]:_0x13619e[_0xba96('0x1c')]+_0x13619e[_0xba96('0x1f')];var _0x302b8e;if(_0x2a60af>=_0x530964){_0x2a60af=_0x530964;_0x302b8e=0xc8;}else{_0x302b8e=0xce;}_0x39917f['status'](_0x302b8e);return _0x39917f[_0xba96('0x20')](_0xba96('0x21'),_0x4cac0e+'-'+_0x2a60af+'/'+_0x530964)[_0xba96('0x22')](_0xfed4f5);}return null;};}function patchUpdates(_0x3e03c4){return function(_0x2706ce){try{jsonpatch[_0xba96('0x23')](_0x2706ce,_0x3e03c4,!![]);}catch(_0x1cd26c){return BPromise[_0xba96('0x24')](_0x1cd26c);}return _0x2706ce[_0xba96('0x25')]();};}function saveUpdates(_0x9d6002,_0x215410){return function(_0x179c3a){if(_0x179c3a){return _0x179c3a[_0xba96('0x26')](_0x9d6002)[_0xba96('0x27')](function(_0x42106f){return _0x42106f;});}return null;};}function removeEntity(_0x2627cb,_0x1d2b32){return function(_0x148dbe){if(_0x148dbe){return _0x148dbe['destroy']()[_0xba96('0x27')](function(){var _0x17dcc9=_0x148dbe[_0xba96('0x28')]({'plain':!![]});var _0x306593=_0xba96('0x29');return db[_0xba96('0x2a')][_0xba96('0x2b')]({'where':{'type':_0x306593,'resourceId':_0x17dcc9['id']}})[_0xba96('0x27')](function(){return _0x148dbe;});})[_0xba96('0x27')](function(){_0x2627cb[_0xba96('0x1a')](0xcc)[_0xba96('0x1b')]();});}};}function handleEntityNotFound(_0x2c9b03,_0x1c46e1){return function(_0x41c71f){if(!_0x41c71f){_0x2c9b03[_0xba96('0x19')](0x194);}return _0x41c71f;};}function handleError(_0x41bd92,_0x547d40){_0x547d40=_0x547d40||0x1f4;return function(_0x22aeb1){logger[_0xba96('0x2c')](_0x22aeb1[_0xba96('0x2d')]);if(_0x22aeb1[_0xba96('0x2e')]){delete _0x22aeb1[_0xba96('0x2e')];}_0x41bd92[_0xba96('0x1a')](_0x547d40)[_0xba96('0x2f')](_0x22aeb1);};}exports[_0xba96('0x30')]=function(_0x30288f,_0x512383){var _0x35c57d={},_0x31b46e={},_0x90972f={'count':0x0,'rows':[]};var _0x36140b=_['map'](db[_0xba96('0x31')][_0xba96('0x32')],function(_0x2295cb){return{'name':_0x2295cb['fieldName'],'type':_0x2295cb['type'][_0xba96('0x33')]};});_0x31b46e[_0xba96('0x34')]=_[_0xba96('0x35')](_0x36140b,_0xba96('0x2e'));_0x31b46e['query']=_[_0xba96('0x36')](_0x30288f[_0xba96('0x37')]);_0x31b46e[_0xba96('0x38')]=_[_0xba96('0x39')](_0x31b46e[_0xba96('0x34')],_0x31b46e[_0xba96('0x37')]);_0x35c57d['attributes']=_[_0xba96('0x39')](_0x31b46e[_0xba96('0x34')],qs[_0xba96('0x3a')](_0x30288f[_0xba96('0x37')][_0xba96('0x3a')]));_0x35c57d[_0xba96('0x3b')]=_0x35c57d['attributes'][_0xba96('0x3c')]?_0x35c57d[_0xba96('0x3b')]:_0x31b46e[_0xba96('0x34')];if(!_0x30288f[_0xba96('0x37')][_0xba96('0x3d')](_0xba96('0x3e'))){_0x35c57d[_0xba96('0x1f')]=qs[_0xba96('0x1f')](_0x30288f[_0xba96('0x37')][_0xba96('0x1f')]);_0x35c57d[_0xba96('0x1c')]=qs[_0xba96('0x1c')](_0x30288f['query'][_0xba96('0x1c')]);}_0x35c57d[_0xba96('0x3f')]=qs[_0xba96('0x40')](_0x30288f['query'][_0xba96('0x40')]);_0x35c57d[_0xba96('0x41')]=qs[_0xba96('0x38')](_[_0xba96('0x42')](_0x30288f['query'],_0x31b46e[_0xba96('0x38')]),_0x36140b);if(_0x30288f['query'][_0xba96('0x43')]){_0x35c57d[_0xba96('0x41')]=_['merge'](_0x35c57d[_0xba96('0x41')],{'$or':_[_0xba96('0x35')](_0x36140b,function(_0x209f77){if(_0x209f77[_0xba96('0x44')]!==_0xba96('0x45')){var _0x13a8a3={};_0x13a8a3[_0x209f77[_0xba96('0x2e')]]={'$like':'%'+_0x30288f[_0xba96('0x37')][_0xba96('0x43')]+'%'};return _0x13a8a3;}})});}_0x35c57d=_[_0xba96('0x46')]({},_0x35c57d,_0x30288f[_0xba96('0x47')]);var _0xa0a87={'where':_0x35c57d[_0xba96('0x41')]};return db[_0xba96('0x31')][_0xba96('0x1e')](_0xa0a87)[_0xba96('0x27')](function(_0xf33363){_0x90972f[_0xba96('0x1e')]=_0xf33363;if(_0x30288f[_0xba96('0x37')][_0xba96('0x48')]){_0x35c57d['include']=[{'all':!![]}];}return db[_0xba96('0x31')][_0xba96('0x49')](_0x35c57d);})[_0xba96('0x27')](function(_0x506a93){_0x90972f[_0xba96('0x4a')]=_0x506a93;return _0x90972f;})['then'](respondWithFilteredResult(_0x512383,_0x35c57d))[_0xba96('0x4b')](handleError(_0x512383,null));};exports['show']=function(_0x5adebe,_0x1f6a02){var _0x4ac54b={'raw':![],'where':{'id':_0x5adebe[_0xba96('0x4c')]['id']}},_0x2ca3dc={};_0x2ca3dc[_0xba96('0x34')]=_[_0xba96('0x36')](db[_0xba96('0x31')][_0xba96('0x32')]);_0x2ca3dc[_0xba96('0x37')]=_[_0xba96('0x36')](_0x5adebe[_0xba96('0x37')]);_0x2ca3dc[_0xba96('0x38')]=_[_0xba96('0x39')](_0x2ca3dc[_0xba96('0x34')],_0x2ca3dc['query']);_0x4ac54b['attributes']=_[_0xba96('0x39')](_0x2ca3dc[_0xba96('0x34')],qs[_0xba96('0x3a')](_0x5adebe[_0xba96('0x37')][_0xba96('0x3a')]));_0x4ac54b[_0xba96('0x3b')]=_0x4ac54b[_0xba96('0x3b')][_0xba96('0x3c')]?_0x4ac54b[_0xba96('0x3b')]:_0x2ca3dc['model'];if(_0x5adebe[_0xba96('0x37')][_0xba96('0x48')]){_0x4ac54b[_0xba96('0x4d')]=[{'all':!![]}];}_0x4ac54b=_[_0xba96('0x46')]({},_0x4ac54b,_0x5adebe[_0xba96('0x47')]);return db[_0xba96('0x31')]['find'](_0x4ac54b)[_0xba96('0x27')](handleEntityNotFound(_0x1f6a02,null))[_0xba96('0x27')](respondWithResult(_0x1f6a02,null))[_0xba96('0x4b')](handleError(_0x1f6a02,null));};exports[_0xba96('0x4e')]=function(_0x28796c,_0x4d098b){return db[_0xba96('0x31')]['create'](_0x28796c[_0xba96('0x4f')],{})['then'](function(_0x2dfb8e){var _0x350bb6=_0x28796c[_0xba96('0x50')][_0xba96('0x28')]({'plain':!![]});if(!_0x350bb6)throw new Error(_0xba96('0x51'));if(_0x350bb6[_0xba96('0x52')]===_0xba96('0x50')){var _0x37a638=_0x2dfb8e[_0xba96('0x28')]({'plain':!![]});var _0x258531=_0xba96('0x29');return db[_0xba96('0x53')][_0xba96('0x54')]({'where':{'name':_0x258531,'userProfileId':_0x350bb6[_0xba96('0x55')]},'raw':!![]})['then'](function(_0x3a30f5){if(_0x3a30f5&&_0x3a30f5[_0xba96('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0x37a638[_0xba96('0x2e')],'resourceId':_0x37a638['id'],'type':_0x3a30f5[_0xba96('0x2e')],'sectionId':_0x3a30f5['id']},{})[_0xba96('0x27')](function(){return _0x2dfb8e;});}else{return _0x2dfb8e;}})[_0xba96('0x4b')](function(_0x15f965){logger['error'](_0xba96('0x57'),_0x15f965);throw _0x15f965;});}return _0x2dfb8e;})['then'](respondWithResult(_0x4d098b,0xc9))['catch'](handleError(_0x4d098b,null));};exports[_0xba96('0x58')]=function(_0x3c6e8c,_0x5a979b){var _0x54ff8e={'where':{'id':_0x3c6e8c['params']['id']}},_0x4b8303={};_0x4b8303[_0xba96('0x34')]=_[_0xba96('0x36')](db['Campaign'][_0xba96('0x32')]);_0x54ff8e[_0xba96('0x3b')]=_[_0xba96('0x39')](_0x4b8303[_0xba96('0x34')],qs[_0xba96('0x3a')](_0x3c6e8c['query'][_0xba96('0x3a')]));_0x54ff8e['attributes']=_0x54ff8e['attributes'][_0xba96('0x3c')]?_0x54ff8e[_0xba96('0x3b')]:_0x4b8303['model'];if(_0x3c6e8c[_0xba96('0x37')][_0xba96('0x48')]){_0x54ff8e[_0xba96('0x4d')]=[{'all':!![]}];}_0x54ff8e=_[_0xba96('0x46')]({},_0x54ff8e,_0x3c6e8c[_0xba96('0x47')]);return db['Campaign']['find'](_0x54ff8e)[_0xba96('0x27')](handleEntityNotFound(_0x5a979b,null))[_0xba96('0x27')](function(_0x50b52c){if(_0x50b52c){var _0x391e5f=_0x50b52c[_0xba96('0x28')]({'plain':!![]});_0x391e5f=qs[_0xba96('0x59')](_0x391e5f,['id',_0xba96('0x5a'),_0xba96('0x5b')]);_0x3c6e8c['body']=_[_0xba96('0x59')](_0x3c6e8c['body'],['id',_0xba96('0x5a'),'updatedAt']);return db['Campaign']['create'](_[_0xba96('0x46')](_0x391e5f,_0x3c6e8c[_0xba96('0x4f')]),{'include':_0x3c6e8c[_0xba96('0x37')][_0xba96('0x48')]?[{'all':!![]}]:undefined})[_0xba96('0x27')](function(_0x5d7401){var _0x4c13c3=_0x3c6e8c['user']['get']({'plain':!![]});if(!_0x4c13c3)throw new Error(_0xba96('0x51'));if(_0x4c13c3[_0xba96('0x52')]==='user'){var _0x382c36=_0x5d7401[_0xba96('0x28')]({'plain':!![]});var _0x484d9f=_0xba96('0x29');return db[_0xba96('0x53')][_0xba96('0x54')]({'where':{'name':_0x484d9f,'userProfileId':_0x4c13c3[_0xba96('0x55')]},'raw':!![]})[_0xba96('0x27')](function(_0x57a671){if(_0x57a671&&_0x57a671[_0xba96('0x56')]===0x0){return db[_0xba96('0x2a')][_0xba96('0x4e')]({'name':_0x382c36['name'],'resourceId':_0x382c36['id'],'type':_0x57a671[_0xba96('0x2e')],'sectionId':_0x57a671['id']},{})['then'](function(){return _0x5d7401;});}else{return _0x5d7401;}})['catch'](function(_0x39526d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x39526d);throw _0x39526d;});}return _0x5d7401;});}})['then'](respondWithResult(_0x5a979b,0xc9))[_0xba96('0x4b')](handleError(_0x5a979b,null));};exports[_0xba96('0x26')]=function(_0x147b4c,_0x334c96){if(_0x147b4c[_0xba96('0x4f')]['id']){delete _0x147b4c[_0xba96('0x4f')]['id'];}return db[_0xba96('0x31')][_0xba96('0x54')]({'where':{'id':_0x147b4c['params']['id']}})[_0xba96('0x27')](handleEntityNotFound(_0x334c96,null))[_0xba96('0x27')](saveUpdates(_0x147b4c[_0xba96('0x4f')],null))[_0xba96('0x27')](respondWithResult(_0x334c96,null))[_0xba96('0x4b')](handleError(_0x334c96,null));};exports[_0xba96('0x2b')]=function(_0x273989,_0x5559ec){return db[_0xba96('0x31')][_0xba96('0x54')]({'where':{'id':_0x273989[_0xba96('0x4c')]['id']}})[_0xba96('0x27')](handleEntityNotFound(_0x5559ec,null))[_0xba96('0x27')](removeEntity(_0x5559ec,null))[_0xba96('0x4b')](handleError(_0x5559ec,null));};exports[_0xba96('0x5c')]=function(_0x37cdb1,_0x26d9f1,_0x238b72){var _0x51e0ac={'raw':!![],'where':{}};var _0x4bfe1f={};var _0x589017={'count':0x0,'rows':[]};return db[_0xba96('0x31')][_0xba96('0x5d')]({'where':{'id':_0x37cdb1[_0xba96('0x4c')]['id']}})['then'](handleEntityNotFound(_0x26d9f1,null))['then'](function(_0x2ee51d){if(_0x2ee51d){_0x4bfe1f[_0xba96('0x34')]=_[_0xba96('0x36')](db[_0xba96('0x5e')][_0xba96('0x32')]);_0x4bfe1f[_0xba96('0x37')]=_['keys'](_0x37cdb1['query']);_0x4bfe1f[_0xba96('0x38')]=_[_0xba96('0x39')](_0x4bfe1f[_0xba96('0x34')],_0x4bfe1f['query']);_0x51e0ac['attributes']=_[_0xba96('0x39')](_0x4bfe1f['model'],qs['fields'](_0x37cdb1[_0xba96('0x37')]['fields']));_0x51e0ac[_0xba96('0x3b')]=_0x51e0ac[_0xba96('0x3b')]['length']?_0x51e0ac[_0xba96('0x3b')]:_0x4bfe1f[_0xba96('0x34')];if(!_0x37cdb1[_0xba96('0x37')][_0xba96('0x3d')](_0xba96('0x3e'))){_0x51e0ac[_0xba96('0x1f')]=qs[_0xba96('0x1f')](_0x37cdb1['query'][_0xba96('0x1f')]);_0x51e0ac[_0xba96('0x1c')]=qs[_0xba96('0x1c')](_0x37cdb1[_0xba96('0x37')][_0xba96('0x1c')]);}_0x51e0ac[_0xba96('0x3f')]=qs['sort'](_0x37cdb1['query'][_0xba96('0x40')]);_0x51e0ac['where']=qs['filters'](_[_0xba96('0x42')](_0x37cdb1['query'],_0x4bfe1f['filters']));_0x51e0ac['where']['CampaignId']=_0x2ee51d['id'];if(_0x37cdb1[_0xba96('0x37')][_0xba96('0x43')]){_0x51e0ac[_0xba96('0x41')]=_['merge'](_0x51e0ac['where'],{'$or':_['map'](_0x51e0ac[_0xba96('0x3b')],function(_0x59e15a){var _0x5d37bd={};_0x5d37bd[_0x59e15a]={'$like':'%'+_0x37cdb1[_0xba96('0x37')][_0xba96('0x43')]+'%'};return _0x5d37bd;})});}_0x51e0ac=_['merge']({},_0x51e0ac,_0x37cdb1['options']);return db[_0xba96('0x5e')][_0xba96('0x1e')]({'where':_0x51e0ac[_0xba96('0x41')]})[_0xba96('0x27')](function(_0x4e3ac8){_0x589017[_0xba96('0x1e')]=_0x4e3ac8;if(_0x37cdb1['query']['includeAll']){_0x51e0ac[_0xba96('0x4d')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x51e0ac);})[_0xba96('0x27')](function(_0x6cd5f6){_0x589017[_0xba96('0x4a')]=_0x6cd5f6;return _0x589017;});}})[_0xba96('0x27')](respondWithFilteredResult(_0x26d9f1,_0x51e0ac))[_0xba96('0x4b')](handleError(_0x26d9f1,null));};exports['getHopperHistories']=function(_0x34aa8c,_0x216432,_0x1b0bc5){var _0x373dd9={'raw':!![],'where':{}};var _0x4b5309={};var _0x12b82f={'count':0x0,'rows':[]};return db['Campaign'][_0xba96('0x5d')]({'where':{'id':_0x34aa8c[_0xba96('0x4c')]['id']}})[_0xba96('0x27')](handleEntityNotFound(_0x216432,null))['then'](function(_0x566388){if(_0x566388){_0x4b5309['model']=_[_0xba96('0x36')](db[_0xba96('0x5f')][_0xba96('0x32')]);_0x4b5309[_0xba96('0x37')]=_['keys'](_0x34aa8c[_0xba96('0x37')]);_0x4b5309[_0xba96('0x38')]=_[_0xba96('0x39')](_0x4b5309[_0xba96('0x34')],_0x4b5309[_0xba96('0x37')]);_0x373dd9[_0xba96('0x3b')]=_[_0xba96('0x39')](_0x4b5309['model'],qs['fields'](_0x34aa8c[_0xba96('0x37')][_0xba96('0x3a')]));_0x373dd9[_0xba96('0x3b')]=_0x373dd9['attributes'][_0xba96('0x3c')]?_0x373dd9[_0xba96('0x3b')]:_0x4b5309[_0xba96('0x34')];if(!_0x34aa8c[_0xba96('0x37')][_0xba96('0x3d')](_0xba96('0x3e'))){_0x373dd9[_0xba96('0x1f')]=qs[_0xba96('0x1f')](_0x34aa8c[_0xba96('0x37')][_0xba96('0x1f')]);_0x373dd9[_0xba96('0x1c')]=qs['offset'](_0x34aa8c[_0xba96('0x37')][_0xba96('0x1c')]);}_0x373dd9[_0xba96('0x3f')]=qs[_0xba96('0x40')](_0x34aa8c['query'][_0xba96('0x40')]);_0x373dd9[_0xba96('0x41')]=qs[_0xba96('0x38')](_[_0xba96('0x42')](_0x34aa8c['query'],_0x4b5309[_0xba96('0x38')]));_0x373dd9[_0xba96('0x41')]['CampaignId']=_0x566388['id'];if(_0x34aa8c['query']['filter']){_0x373dd9['where']=_['merge'](_0x373dd9[_0xba96('0x41')],{'$or':_[_0xba96('0x35')](_0x373dd9['attributes'],function(_0xf70b0b){var _0x379c2a={};_0x379c2a[_0xf70b0b]={'$like':'%'+_0x34aa8c[_0xba96('0x37')][_0xba96('0x43')]+'%'};return _0x379c2a;})});}_0x373dd9=_[_0xba96('0x46')]({},_0x373dd9,_0x34aa8c[_0xba96('0x47')]);return db['CmHopperHistory'][_0xba96('0x1e')]({'where':_0x373dd9[_0xba96('0x41')]})[_0xba96('0x27')](function(_0x585aa2){_0x12b82f[_0xba96('0x1e')]=_0x585aa2;if(_0x34aa8c[_0xba96('0x37')][_0xba96('0x48')]){_0x373dd9[_0xba96('0x4d')]=[{'all':!![]}];}return db[_0xba96('0x5f')][_0xba96('0x49')](_0x373dd9);})['then'](function(_0x348381){_0x12b82f[_0xba96('0x4a')]=_0x348381;return _0x12b82f;});}})[_0xba96('0x27')](respondWithFilteredResult(_0x216432,_0x373dd9))[_0xba96('0x4b')](handleError(_0x216432,null));};exports[_0xba96('0x60')]=function(_0x2bafc1,_0x41ef72,_0x3bd369){var _0x2871c4={'raw':!![],'where':{}};var _0x4270e9={};var _0x42f5c6={'count':0x0,'rows':[]};return db[_0xba96('0x31')][_0xba96('0x5d')]({'where':{'id':_0x2bafc1[_0xba96('0x4c')]['id']}})['then'](handleEntityNotFound(_0x41ef72,null))[_0xba96('0x27')](function(_0x48b694){if(_0x48b694){_0x4270e9[_0xba96('0x34')]=_[_0xba96('0x36')](db[_0xba96('0x61')][_0xba96('0x32')]);_0x4270e9['query']=_[_0xba96('0x36')](_0x2bafc1['query']);_0x4270e9[_0xba96('0x38')]=_[_0xba96('0x39')](_0x4270e9[_0xba96('0x34')],_0x4270e9[_0xba96('0x37')]);_0x2871c4[_0xba96('0x3b')]=_[_0xba96('0x39')](_0x4270e9[_0xba96('0x34')],qs[_0xba96('0x3a')](_0x2bafc1[_0xba96('0x37')]['fields']));_0x2871c4[_0xba96('0x3b')]=_0x2871c4[_0xba96('0x3b')][_0xba96('0x3c')]?_0x2871c4[_0xba96('0x3b')]:_0x4270e9[_0xba96('0x34')];if(!_0x2bafc1[_0xba96('0x37')][_0xba96('0x3d')](_0xba96('0x3e'))){_0x2871c4[_0xba96('0x1f')]=qs[_0xba96('0x1f')](_0x2bafc1['query']['limit']);_0x2871c4[_0xba96('0x1c')]=qs[_0xba96('0x1c')](_0x2bafc1[_0xba96('0x37')][_0xba96('0x1c')]);}_0x2871c4[_0xba96('0x3f')]=qs['sort'](_0x2bafc1['query'][_0xba96('0x40')]);_0x2871c4[_0xba96('0x41')]=qs[_0xba96('0x38')](_[_0xba96('0x42')](_0x2bafc1[_0xba96('0x37')],_0x4270e9[_0xba96('0x38')]));_0x2871c4[_0xba96('0x41')][_0xba96('0x62')]=_0x48b694['id'];if(_0x2bafc1[_0xba96('0x37')][_0xba96('0x43')]){_0x2871c4['where']=_[_0xba96('0x46')](_0x2871c4[_0xba96('0x41')],{'$or':_[_0xba96('0x35')](_0x2871c4['attributes'],function(_0x3379b5){var _0x354e10={};_0x354e10[_0x3379b5]={'$like':'%'+_0x2bafc1[_0xba96('0x37')][_0xba96('0x43')]+'%'};return _0x354e10;})});}_0x2871c4=_[_0xba96('0x46')]({},_0x2871c4,_0x2bafc1['options']);return db[_0xba96('0x61')][_0xba96('0x1e')]({'where':_0x2871c4[_0xba96('0x41')]})['then'](function(_0x4ad976){_0x42f5c6[_0xba96('0x1e')]=_0x4ad976;if(_0x2bafc1[_0xba96('0x37')][_0xba96('0x48')]){_0x2871c4[_0xba96('0x4d')]=[{'all':!![]}];}return db[_0xba96('0x61')][_0xba96('0x49')](_0x2871c4);})[_0xba96('0x27')](function(_0x274179){_0x42f5c6[_0xba96('0x4a')]=_0x274179;return _0x42f5c6;});}})[_0xba96('0x27')](respondWithFilteredResult(_0x41ef72,_0x2871c4))[_0xba96('0x4b')](handleError(_0x41ef72,null));};exports['getHopperBlacks']=function(_0x438c58,_0x465907,_0x208549){var _0x49bf9f={'raw':!![],'where':{}};var _0x503280={};var _0x58ef9f={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x438c58[_0xba96('0x4c')]['id']}})[_0xba96('0x27')](handleEntityNotFound(_0x465907,null))['then'](function(_0x40fd98){if(_0x40fd98){_0x503280[_0xba96('0x34')]=_[_0xba96('0x36')](db['CmHopperBlack'][_0xba96('0x32')]);_0x503280[_0xba96('0x37')]=_[_0xba96('0x36')](_0x438c58['query']);_0x503280[_0xba96('0x38')]=_[_0xba96('0x39')](_0x503280[_0xba96('0x34')],_0x503280[_0xba96('0x37')]);_0x49bf9f[_0xba96('0x3b')]=_['intersection'](_0x503280['model'],qs[_0xba96('0x3a')](_0x438c58['query'][_0xba96('0x3a')]));_0x49bf9f[_0xba96('0x3b')]=_0x49bf9f[_0xba96('0x3b')][_0xba96('0x3c')]?_0x49bf9f[_0xba96('0x3b')]:_0x503280[_0xba96('0x34')];if(!_0x438c58[_0xba96('0x37')][_0xba96('0x3d')]('nolimit')){_0x49bf9f[_0xba96('0x1f')]=qs[_0xba96('0x1f')](_0x438c58[_0xba96('0x37')][_0xba96('0x1f')]);_0x49bf9f[_0xba96('0x1c')]=qs[_0xba96('0x1c')](_0x438c58[_0xba96('0x37')]['offset']);}_0x49bf9f['order']=qs[_0xba96('0x40')](_0x438c58[_0xba96('0x37')][_0xba96('0x40')]);_0x49bf9f[_0xba96('0x41')]=qs[_0xba96('0x38')](_['pick'](_0x438c58[_0xba96('0x37')],_0x503280['filters']));_0x49bf9f['where']['CampaignId']=_0x40fd98['id'];if(_0x438c58[_0xba96('0x37')]['filter']){_0x49bf9f[_0xba96('0x41')]=_[_0xba96('0x46')](_0x49bf9f[_0xba96('0x41')],{'$or':_[_0xba96('0x35')](_0x49bf9f[_0xba96('0x3b')],function(_0x4997df){var _0x5b337b={};_0x5b337b[_0x4997df]={'$like':'%'+_0x438c58[_0xba96('0x37')][_0xba96('0x43')]+'%'};return _0x5b337b;})});}_0x49bf9f=_[_0xba96('0x46')]({},_0x49bf9f,_0x438c58['options']);return db[_0xba96('0x63')]['count']({'where':_0x49bf9f[_0xba96('0x41')]})['then'](function(_0x28bd47){_0x58ef9f[_0xba96('0x1e')]=_0x28bd47;if(_0x438c58[_0xba96('0x37')][_0xba96('0x48')]){_0x49bf9f[_0xba96('0x4d')]=[{'all':!![]}];}return db[_0xba96('0x63')]['findAll'](_0x49bf9f);})['then'](function(_0x443e44){_0x58ef9f[_0xba96('0x4a')]=_0x443e44;return _0x58ef9f;});}})[_0xba96('0x27')](respondWithFilteredResult(_0x465907,_0x49bf9f))['catch'](handleError(_0x465907,null));};exports[_0xba96('0x64')]=function(_0x2e5c19,_0x3e8a5f,_0x4e1974){var _0x2a99d9={};var _0x24f003={};var _0x417d84;var _0x3336cc;return db['Campaign'][_0xba96('0x5d')]({'where':{'id':_0x2e5c19[_0xba96('0x4c')]['id']}})[_0xba96('0x27')](handleEntityNotFound(_0x3e8a5f,null))[_0xba96('0x27')](function(_0x182e48){if(_0x182e48){_0x417d84=_0x182e48;_0x24f003['model']=_['keys'](db[_0xba96('0x65')][_0xba96('0x32')]);_0x24f003[_0xba96('0x37')]=_[_0xba96('0x36')](_0x2e5c19[_0xba96('0x37')]);_0x24f003[_0xba96('0x38')]=_[_0xba96('0x39')](_0x24f003[_0xba96('0x34')],_0x24f003['query']);_0x2a99d9[_0xba96('0x3b')]=_['intersection'](_0x24f003['model'],qs['fields'](_0x2e5c19[_0xba96('0x37')][_0xba96('0x3a')]));_0x2a99d9['attributes']=_0x2a99d9['attributes'][_0xba96('0x3c')]?_0x2a99d9['attributes']:_0x24f003[_0xba96('0x34')];_0x2a99d9[_0xba96('0x3f')]=qs[_0xba96('0x40')](_0x2e5c19['query']['sort']);_0x2a99d9[_0xba96('0x41')]=qs['filters'](_['pick'](_0x2e5c19[_0xba96('0x37')],_0x24f003[_0xba96('0x38')]));if(_0x2e5c19[_0xba96('0x37')][_0xba96('0x43')]){_0x2a99d9['where']=_[_0xba96('0x46')](_0x2a99d9[_0xba96('0x41')],{'$or':_[_0xba96('0x35')](_0x2a99d9['attributes'],function(_0xfb7a48){var _0xa3fb63={};_0xa3fb63[_0xfb7a48]={'$like':'%'+_0x2e5c19[_0xba96('0x37')]['filter']+'%'};return _0xa3fb63;})});}_0x2a99d9=_['merge']({},_0x2a99d9,_0x2e5c19['options']);return _0x417d84['getLists'](_0x2a99d9);}})[_0xba96('0x27')](function(_0x5d99a8){if(_0x5d99a8){_0x3336cc=_0x5d99a8[_0xba96('0x3c')];if(!_0x2e5c19['query'][_0xba96('0x3d')](_0xba96('0x3e'))){_0x2a99d9[_0xba96('0x1f')]=qs[_0xba96('0x1f')](_0x2e5c19[_0xba96('0x37')][_0xba96('0x1f')]);_0x2a99d9['offset']=qs['offset'](_0x2e5c19[_0xba96('0x37')]['offset']);}return _0x417d84['getLists'](_0x2a99d9);}})['then'](function(_0x26b342){if(_0x26b342){return _0x26b342?{'count':_0x3336cc,'rows':_0x26b342}:null;}})['then'](respondWithResult(_0x3e8a5f,null))[_0xba96('0x4b')](handleError(_0x3e8a5f,null));};exports['addLists']=function(_0x1a9974,_0x2baa1c,_0x17e591){var _0x3c8a25,_0x311169;return db[_0xba96('0x31')][_0xba96('0x54')]({'where':{'id':_0x1a9974[_0xba96('0x4c')]['id']}})[_0xba96('0x27')](handleEntityNotFound(_0x2baa1c,null))['then'](function(_0x4b41d2){if(_0x4b41d2){_0x311169=_0x4b41d2;return _0x4b41d2[_0xba96('0x66')](_0x1a9974[_0xba96('0x4f')][_0xba96('0x67')],_[_0xba96('0x59')](_0x1a9974[_0xba96('0x4f')],[_0xba96('0x67'),'id'])||{});}return null;})[_0xba96('0x68')](function(_0x3e0ec7){var _0x46c6fd;_0x3c8a25=_0x3e0ec7||[];var _0x412ad7=[];if(_0x3e0ec7){for(var _0x23d219=0x0;_0x23d219<_0x3e0ec7['length'];_0x23d219+=0x1){var _0x328192=_0x3e0ec7[_0x23d219]['get']({'plain':!![]});_0x311169[_0xba96('0x69')]=_0x1a9974['body'][_0xba96('0x69')]?_0x1a9974['body'][_0xba96('0x69')]:_0x311169[_0xba96('0x69')];switch(_0x311169[_0xba96('0x69')]){case _0xba96('0x6a'):_0x46c6fd=squel[_0xba96('0x6b')]()[_0xba96('0x6c')]('cm_hopper')['fromQuery']([_0xba96('0x6d'),_0xba96('0x6e'),_0xba96('0x6f'),_0xba96('0x70'),'CampaignId',_0xba96('0x5a'),_0xba96('0x5b')],squel[_0xba96('0x71')]()[_0xba96('0x72')](_0xba96('0x6d'),_0xba96('0x6d'))['field'](_0xba96('0x73'),'scheduledAt')[_0xba96('0x72')]('id',_0xba96('0x6f'))[_0xba96('0x72')](_0x328192[_0xba96('0x74')][_0xba96('0x75')](),_0xba96('0x70'))[_0xba96('0x72')](_0x1a9974['params']['id'][_0xba96('0x75')](),_0xba96('0x62'))[_0xba96('0x72')](_0xba96('0x73'),'createdAt')['field'](_0xba96('0x73'),_0xba96('0x5b'))[_0xba96('0x76')](_0xba96('0x77'))[_0xba96('0x41')](_0xba96('0x78'))['where'](_0xba96('0x79'),_0x328192['CmListId'][_0xba96('0x75')]())['where'](_0xba96('0x7a'))[_0xba96('0x41')](_0xba96('0x7b'),squel[_0xba96('0x71')]()[_0xba96('0x72')](_0xba96('0x7c'))[_0xba96('0x76')](_0xba96('0x7d'))[_0xba96('0x41')](_0xba96('0x7e'),_0x1a9974['params']['id'][_0xba96('0x75')]()))[_0xba96('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0xba96('0x71')]()[_0xba96('0x72')](_0xba96('0x7f'))[_0xba96('0x76')](_0xba96('0x80'))['where'](_0xba96('0x7e'),_0x1a9974[_0xba96('0x4c')]['id'][_0xba96('0x75')]())))[_0xba96('0x75')]();break;case _0xba96('0x81'):_0x46c6fd=squel['insert']()[_0xba96('0x6c')](_0xba96('0x80'))[_0xba96('0x82')]([_0xba96('0x6d'),_0xba96('0x6e'),_0xba96('0x6f'),_0xba96('0x70'),_0xba96('0x62'),_0xba96('0x5a'),_0xba96('0x5b')],squel['select']()[_0xba96('0x72')](_0xba96('0x6d'),_0xba96('0x6d'))['field'](_0xba96('0x73'),_0xba96('0x6e'))[_0xba96('0x72')]('id',_0xba96('0x6f'))[_0xba96('0x72')](_0x328192['CmListId'][_0xba96('0x75')](),'ListId')[_0xba96('0x72')](_0x1a9974[_0xba96('0x4c')]['id'][_0xba96('0x75')](),'CampaignId')[_0xba96('0x72')](_0xba96('0x73'),_0xba96('0x5a'))[_0xba96('0x72')](_0xba96('0x73'),_0xba96('0x5b'))[_0xba96('0x76')](_0xba96('0x77'))[_0xba96('0x41')](_0xba96('0x78'))[_0xba96('0x41')](_0xba96('0x79'),_0x328192[_0xba96('0x74')][_0xba96('0x75')]())[_0xba96('0x41')]('phone\x20IS\x20NOT\x20NULL')[_0xba96('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0xba96('0x71')]()[_0xba96('0x72')](_0xba96('0x7f'))['from']('cm_hopper')['where'](_0xba96('0x7e'),_0x1a9974[_0xba96('0x4c')]['id'][_0xba96('0x75')]())))[_0xba96('0x75')]();break;default:_0x46c6fd=squel[_0xba96('0x6b')]()['into'](_0xba96('0x80'))['fromQuery']([_0xba96('0x6d'),_0xba96('0x6e'),'ContactId',_0xba96('0x70'),_0xba96('0x62'),_0xba96('0x5a'),_0xba96('0x5b')],squel[_0xba96('0x71')]()[_0xba96('0x72')]('phone',_0xba96('0x6d'))[_0xba96('0x72')](_0xba96('0x73'),'scheduledAt')[_0xba96('0x72')]('id',_0xba96('0x6f'))[_0xba96('0x72')](_0x328192[_0xba96('0x74')][_0xba96('0x75')](),_0xba96('0x70'))[_0xba96('0x72')](_0x1a9974[_0xba96('0x4c')]['id'][_0xba96('0x75')](),_0xba96('0x62'))['field'](_0xba96('0x73'),_0xba96('0x5a'))['field']('NOW()',_0xba96('0x5b'))[_0xba96('0x76')](_0xba96('0x77'))[_0xba96('0x41')](_0xba96('0x78'))['where'](_0xba96('0x79'),_0x328192['CmListId'][_0xba96('0x75')]())[_0xba96('0x41')](_0xba96('0x7a')))[_0xba96('0x75')]();}_0x412ad7[_0xba96('0x83')](db[_0xba96('0x84')][_0xba96('0x37')](_0x46c6fd));}return BPromise['all'](_0x412ad7);}})[_0xba96('0x27')](function(){return _0x3c8a25;})[_0xba96('0x27')](respondWithResult(_0x2baa1c,null))[_0xba96('0x4b')](handleError(_0x2baa1c,null));};exports[_0xba96('0x85')]=function(_0x4c6426,_0x67661b,_0x5680d1){return db[_0xba96('0x31')][_0xba96('0x54')]({'where':{'id':_0x4c6426['params']['id']}})['then'](handleEntityNotFound(_0x67661b,null))[_0xba96('0x27')](function(_0x33d414){if(_0x33d414){return _0x33d414['removeLists'](_0x4c6426[_0xba96('0x37')]['ids']);}})[_0xba96('0x27')](function(_0x2ad84f){if(_0x2ad84f){return db[_0xba96('0x5e')][_0xba96('0x2b')]({'where':{'ListId':_0x4c6426[_0xba96('0x37')]['ids'],'CampaignId':_0x4c6426[_0xba96('0x4c')]['id']}})[_0xba96('0x27')](function(){return _0x2ad84f;});}})[_0xba96('0x27')](respondWithStatusCode(_0x67661b,null))[_0xba96('0x4b')](handleError(_0x67661b,null));};exports[_0xba96('0x86')]=function(_0x5ebdda,_0x17ecba,_0x7709ac){var _0x264085={};var _0x4580cc={};var _0x19875a;var _0x27d8ea;return db['Campaign'][_0xba96('0x5d')]({'where':{'id':_0x5ebdda['params']['id']}})[_0xba96('0x27')](handleEntityNotFound(_0x17ecba,null))['then'](function(_0x287e62){if(_0x287e62){_0x19875a=_0x287e62;_0x4580cc[_0xba96('0x34')]=_[_0xba96('0x36')](db[_0xba96('0x65')][_0xba96('0x32')]);_0x4580cc[_0xba96('0x37')]=_[_0xba96('0x36')](_0x5ebdda[_0xba96('0x37')]);_0x4580cc[_0xba96('0x38')]=_[_0xba96('0x39')](_0x4580cc[_0xba96('0x34')],_0x4580cc[_0xba96('0x37')]);_0x264085[_0xba96('0x3b')]=_[_0xba96('0x39')](_0x4580cc['model'],qs[_0xba96('0x3a')](_0x5ebdda[_0xba96('0x37')][_0xba96('0x3a')]));_0x264085[_0xba96('0x3b')]=_0x264085[_0xba96('0x3b')][_0xba96('0x3c')]?_0x264085['attributes']:_0x4580cc[_0xba96('0x34')];_0x264085[_0xba96('0x3f')]=qs['sort'](_0x5ebdda['query'][_0xba96('0x40')]);_0x264085[_0xba96('0x41')]=qs[_0xba96('0x38')](_['pick'](_0x5ebdda['query'],_0x4580cc[_0xba96('0x38')]));if(_0x5ebdda[_0xba96('0x37')]['filter']){_0x264085[_0xba96('0x41')]=_['merge'](_0x264085[_0xba96('0x41')],{'$or':_[_0xba96('0x35')](_0x264085[_0xba96('0x3b')],function(_0x2ece68){var _0x5c9aec={};_0x5c9aec[_0x2ece68]={'$like':'%'+_0x5ebdda['query'][_0xba96('0x43')]+'%'};return _0x5c9aec;})});}_0x264085=_['merge']({},_0x264085,_0x5ebdda[_0xba96('0x47')]);return _0x19875a[_0xba96('0x86')](_0x264085);}})[_0xba96('0x27')](function(_0x191197){if(_0x191197){_0x27d8ea=_0x191197[_0xba96('0x3c')];if(!_0x5ebdda[_0xba96('0x37')]['hasOwnProperty']('nolimit')){_0x264085[_0xba96('0x1f')]=qs['limit'](_0x5ebdda[_0xba96('0x37')][_0xba96('0x1f')]);_0x264085[_0xba96('0x1c')]=qs[_0xba96('0x1c')](_0x5ebdda[_0xba96('0x37')][_0xba96('0x1c')]);}return _0x19875a[_0xba96('0x86')](_0x264085);}})['then'](function(_0x1ff93e){if(_0x1ff93e){return _0x1ff93e?{'count':_0x27d8ea,'rows':_0x1ff93e}:null;}})[_0xba96('0x27')](respondWithResult(_0x17ecba,null))[_0xba96('0x4b')](handleError(_0x17ecba,null));};exports[_0xba96('0x87')]=function(_0x3b7a28,_0x158cc7,_0x3a8347){var _0x1dac23,_0xbb57e6;return db[_0xba96('0x31')][_0xba96('0x54')]({'where':{'id':_0x3b7a28[_0xba96('0x4c')]['id']}})[_0xba96('0x27')](handleEntityNotFound(_0x158cc7,null))['then'](function(_0x3278b8){if(_0x3278b8){_0xbb57e6=_0x3278b8;return _0x3278b8[_0xba96('0x87')](_0x3b7a28['body']['ids'],_[_0xba96('0x59')](_0x3b7a28[_0xba96('0x4f')],[_0xba96('0x67'),'id'])||{});}return null;})[_0xba96('0x68')](function(_0xe5b065){var _0x5df950;_0x1dac23=_0xe5b065||[];var _0x405ffb=[];if(_0xe5b065){for(var _0x564a9d=0x0;_0x564a9d<_0xe5b065[_0xba96('0x3c')];_0x564a9d+=0x1){var _0x1e4f17=_0xe5b065[_0x564a9d]['get']({'plain':!![]});_0x5df950=squel[_0xba96('0x6b')]()[_0xba96('0x6c')]('cm_hopper_black')[_0xba96('0x82')](['phone',_0xba96('0x6f'),_0xba96('0x70'),_0xba96('0x62'),_0xba96('0x5a'),_0xba96('0x5b')],squel[_0xba96('0x71')]()[_0xba96('0x72')](_0xba96('0x6d'),'phone')[_0xba96('0x72')]('id',_0xba96('0x6f'))['field'](_0x1e4f17[_0xba96('0x74')][_0xba96('0x75')](),_0xba96('0x70'))[_0xba96('0x72')](_0x3b7a28[_0xba96('0x4c')]['id'][_0xba96('0x75')](),_0xba96('0x62'))[_0xba96('0x72')](_0xba96('0x73'),_0xba96('0x5a'))[_0xba96('0x72')](_0xba96('0x73'),_0xba96('0x5b'))['from'](_0xba96('0x77'))[_0xba96('0x41')](_0xba96('0x78'))['where'](_0xba96('0x79'),_0x1e4f17[_0xba96('0x74')][_0xba96('0x75')]())[_0xba96('0x41')](_0xba96('0x7a')))[_0xba96('0x75')]();_0x405ffb[_0xba96('0x83')](db[_0xba96('0x84')][_0xba96('0x37')](_0x5df950));}return BPromise['all'](_0x405ffb);}})['then'](function(){return _0x1dac23;})['then'](respondWithResult(_0x158cc7,null))[_0xba96('0x4b')](handleError(_0x158cc7,null));};exports['removeBlackLists']=function(_0x736237,_0x2fdd81,_0x2f101e){return db[_0xba96('0x31')][_0xba96('0x54')]({'where':{'id':_0x736237['params']['id']}})['then'](handleEntityNotFound(_0x2fdd81,null))[_0xba96('0x27')](function(_0x469190){if(_0x469190){return _0x469190[_0xba96('0x88')](_0x736237[_0xba96('0x37')][_0xba96('0x67')]);}})[_0xba96('0x27')](function(_0x2b4671){if(_0x2b4671){return db['CmHopperBlack'][_0xba96('0x2b')]({'where':{'ListId':_0x736237[_0xba96('0x37')]['ids'],'CampaignId':_0x736237[_0xba96('0x4c')]['id']}})[_0xba96('0x27')](function(){return _0x2b4671;});}})[_0xba96('0x27')](respondWithStatusCode(_0x2fdd81,null))[_0xba96('0x4b')](handleError(_0x2fdd81,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 15c5724..fdba8d4 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(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'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(_0x17ce4c,_0x334562){var _0x484a33=function(_0x2c072c){while(--_0x2c072c){_0x17ce4c['push'](_0x17ce4c['shift']());}};_0x484a33(++_0x334562);}(_0x7a54,0x106));var _0x47a5=function(_0x181365,_0x222b65){_0x181365=_0x181365-0x0;var _0x45ba54=_0x7a54[_0x181365];return _0x45ba54;};'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 702e016..d3fe1a5 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 _0x52b2=['http','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCampaign','findAll','options','raw','where','limit','include','map','model','attributes','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x53b9af,_0x4a90c6){var _0x5d38f4=function(_0x423ad6){while(--_0x423ad6){_0x53b9af['push'](_0x53b9af['shift']());}};_0x5d38f4(++_0x4a90c6);}(_0x52b2,0x11e));var _0x252b=function(_0x1554f2,_0x5f41e6){_0x1554f2=_0x1554f2-0x0;var _0x2cab4d=_0x52b2[_0x1554f2];return _0x2cab4d;};'use strict';var _=require(_0x252b('0x0'));var util=require(_0x252b('0x1'));var moment=require(_0x252b('0x2'));var BPromise=require(_0x252b('0x3'));var rs=require(_0x252b('0x4'));var fs=require('fs');var Redis=require(_0x252b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x252b('0x6'));var logger=require(_0x252b('0x7'))(_0x252b('0x8'));var config=require(_0x252b('0x9'));var jayson=require(_0x252b('0xa'));var client=jayson['client'][_0x252b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x409365,_0x3e071a,_0x81d77a){return new BPromise(function(_0x147e21,_0x1f3992){return client['request'](_0x409365,_0x81d77a)[_0x252b('0xc')](function(_0x1d0fb2){logger['info'](_0x252b('0xd'),_0x3e071a,_0x252b('0xe'));logger[_0x252b('0xf')](_0x252b('0x10'),_0x3e071a,_0x252b('0xe'),JSON[_0x252b('0x11')](_0x1d0fb2));if(_0x1d0fb2[_0x252b('0x12')]){if(_0x1d0fb2[_0x252b('0x12')][_0x252b('0x13')]===0x1f4){logger[_0x252b('0x12')](_0x252b('0xd'),_0x3e071a,_0x1d0fb2['error'][_0x252b('0x14')]);return _0x1f3992(_0x1d0fb2[_0x252b('0x12')][_0x252b('0x14')]);}logger[_0x252b('0x12')](_0x252b('0xd'),_0x3e071a,_0x1d0fb2[_0x252b('0x12')][_0x252b('0x14')]);return _0x147e21(_0x1d0fb2[_0x252b('0x12')][_0x252b('0x14')]);}else{logger['info'](_0x252b('0xd'),_0x3e071a,_0x252b('0xe'));_0x147e21(_0x1d0fb2[_0x252b('0x15')][_0x252b('0x14')]);}})['catch'](function(_0x4d852e){logger[_0x252b('0x12')]('Campaign,\x20%s,\x20%s',_0x3e071a,_0x4d852e);_0x1f3992(_0x4d852e);});});}exports[_0x252b('0x16')]=function(_0x20ffd6){var _0x15247b=this;return new Promise(function(_0x1048f3,_0x2fcf48){return db['Campaign'][_0x252b('0x17')]({'raw':_0x20ffd6[_0x252b('0x18')]?_0x20ffd6[_0x252b('0x18')][_0x252b('0x19')]===undefined?!![]:![]:!![],'where':_0x20ffd6[_0x252b('0x18')]?_0x20ffd6[_0x252b('0x18')][_0x252b('0x1a')]||null:null,'attributes':_0x20ffd6[_0x252b('0x18')]?_0x20ffd6[_0x252b('0x18')]['attributes']||null:null,'limit':_0x20ffd6[_0x252b('0x18')]?_0x20ffd6[_0x252b('0x18')][_0x252b('0x1b')]||null:null,'include':_0x20ffd6[_0x252b('0x18')]?_0x20ffd6['options'][_0x252b('0x1c')]?_[_0x252b('0x1d')](_0x20ffd6['options'][_0x252b('0x1c')],function(_0x1f5924){return{'model':db[_0x1f5924[_0x252b('0x1e')]],'as':_0x1f5924['as'],'attributes':_0x1f5924[_0x252b('0x1f')],'include':_0x1f5924[_0x252b('0x1c')]?_['map'](_0x1f5924[_0x252b('0x1c')],function(_0x39649d){return{'model':db[_0x39649d['model']],'as':_0x39649d['as'],'attributes':_0x39649d[_0x252b('0x1f')],'include':_0x39649d[_0x252b('0x1c')]?_[_0x252b('0x1d')](_0x39649d[_0x252b('0x1c')],function(_0x239b4a){return{'model':db[_0x239b4a[_0x252b('0x1e')]],'as':_0x239b4a['as'],'attributes':_0x239b4a[_0x252b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x252b('0xc')](function(_0x57fa7b){logger['info'](_0x252b('0x16'),_0x20ffd6);logger[_0x252b('0xf')](_0x252b('0x16'),_0x20ffd6,JSON[_0x252b('0x11')](_0x57fa7b));_0x1048f3(_0x57fa7b);})[_0x252b('0x20')](function(_0x425060){logger[_0x252b('0x12')]('GetCampaign',_0x425060[_0x252b('0x14')],_0x20ffd6);_0x2fcf48(_0x15247b[_0x252b('0x12')](0x1f4,_0x425060[_0x252b('0x14')]));});});}; \ No newline at end of file +var _0x8482=['Campaign,\x20%s,\x20%s','message','info','GetCampaign','Campaign','findAll','options','where','attributes','limit','include','map','model','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2a4b23,_0x68af4d){var _0x89217c=function(_0x349aac){while(--_0x349aac){_0x2a4b23['push'](_0x2a4b23['shift']());}};_0x89217c(++_0x68af4d);}(_0x8482,0x14e));var _0x2848=function(_0x3d3cab,_0x4cf42b){_0x3d3cab=_0x3d3cab-0x0;var _0x19c337=_0x8482[_0x3d3cab];return _0x19c337;};'use strict';var _=require('lodash');var util=require(_0x2848('0x0'));var moment=require(_0x2848('0x1'));var BPromise=require(_0x2848('0x2'));var rs=require(_0x2848('0x3'));var fs=require('fs');var Redis=require(_0x2848('0x4'));var db=require(_0x2848('0x5'))['db'];var utils=require(_0x2848('0x6'));var logger=require(_0x2848('0x7'))(_0x2848('0x8'));var config=require(_0x2848('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2848('0xa')][_0x2848('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x503238,_0xeca507,_0x48c0f3){return new BPromise(function(_0x53c865,_0xff7900){return client['request'](_0x503238,_0x48c0f3)[_0x2848('0xc')](function(_0x4a117b){logger['info']('Campaign,\x20%s,\x20%s',_0xeca507,_0x2848('0xd'));logger[_0x2848('0xe')](_0x2848('0xf'),_0xeca507,_0x2848('0xd'),JSON[_0x2848('0x10')](_0x4a117b));if(_0x4a117b[_0x2848('0x11')]){if(_0x4a117b['error']['code']===0x1f4){logger[_0x2848('0x11')](_0x2848('0x12'),_0xeca507,_0x4a117b[_0x2848('0x11')]['message']);return _0xff7900(_0x4a117b[_0x2848('0x11')][_0x2848('0x13')]);}logger[_0x2848('0x11')]('Campaign,\x20%s,\x20%s',_0xeca507,_0x4a117b[_0x2848('0x11')]['message']);return _0x53c865(_0x4a117b[_0x2848('0x11')]['message']);}else{logger[_0x2848('0x14')](_0x2848('0x12'),_0xeca507,_0x2848('0xd'));_0x53c865(_0x4a117b['result']['message']);}})['catch'](function(_0x5f5616){logger[_0x2848('0x11')](_0x2848('0x12'),_0xeca507,_0x5f5616);_0xff7900(_0x5f5616);});});}exports[_0x2848('0x15')]=function(_0x46755c){var _0x3f9472=this;return new Promise(function(_0x3b4eeb,_0x34de28){return db[_0x2848('0x16')][_0x2848('0x17')]({'raw':_0x46755c[_0x2848('0x18')]?_0x46755c[_0x2848('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x46755c[_0x2848('0x18')]?_0x46755c[_0x2848('0x18')][_0x2848('0x19')]||null:null,'attributes':_0x46755c['options']?_0x46755c[_0x2848('0x18')][_0x2848('0x1a')]||null:null,'limit':_0x46755c[_0x2848('0x18')]?_0x46755c[_0x2848('0x18')][_0x2848('0x1b')]||null:null,'include':_0x46755c['options']?_0x46755c[_0x2848('0x18')][_0x2848('0x1c')]?_[_0x2848('0x1d')](_0x46755c[_0x2848('0x18')][_0x2848('0x1c')],function(_0x40f510){return{'model':db[_0x40f510['model']],'as':_0x40f510['as'],'attributes':_0x40f510[_0x2848('0x1a')],'include':_0x40f510['include']?_[_0x2848('0x1d')](_0x40f510[_0x2848('0x1c')],function(_0x2d936a){return{'model':db[_0x2d936a[_0x2848('0x1e')]],'as':_0x2d936a['as'],'attributes':_0x2d936a['attributes'],'include':_0x2d936a[_0x2848('0x1c')]?_[_0x2848('0x1d')](_0x2d936a[_0x2848('0x1c')],function(_0x2dc32e){return{'model':db[_0x2dc32e[_0x2848('0x1e')]],'as':_0x2dc32e['as'],'attributes':_0x2dc32e[_0x2848('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2848('0xc')](function(_0x4ec4b5){logger['info']('GetCampaign',_0x46755c);logger[_0x2848('0xe')](_0x2848('0x15'),_0x46755c,JSON[_0x2848('0x10')](_0x4ec4b5));_0x3b4eeb(_0x4ec4b5);})[_0x2848('0x1f')](function(_0x189701){logger[_0x2848('0x11')]('GetCampaign',_0x189701['message'],_0x46755c);_0x34de28(_0x3f9472[_0x2848('0x11')](0x1f4,_0x189701[_0x2848('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 31785a7..1de04a5 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 _0x1f61=['getHopperFinals','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','create','post','clone','addLists','addBlackLists','put','destroy','removeLists','delete','removeBlackLists','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','isAuthenticated','index','get','/:id','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals'];(function(_0x4ef3f1,_0x5c6d21){var _0x2a6885=function(_0x194a34){while(--_0x194a34){_0x4ef3f1['push'](_0x4ef3f1['shift']());}};_0x2a6885(++_0x5c6d21);}(_0x1f61,0x14c));var _0x11f6=function(_0x3797ba,_0x2478f2){_0x3797ba=_0x3797ba-0x0;var _0x55c7fd=_0x1f61[_0x3797ba];return _0x55c7fd;};'use strict';var multer=require(_0x11f6('0x0'));var util=require('util');var path=require(_0x11f6('0x1'));var timeout=require(_0x11f6('0x2'));var express=require(_0x11f6('0x3'));var router=express['Router']();var fs_extra=require(_0x11f6('0x4'));var auth=require(_0x11f6('0x5'));var interaction=require(_0x11f6('0x6'));var config=require(_0x11f6('0x7'));var controller=require(_0x11f6('0x8'));router['get']('/',auth[_0x11f6('0x9')](),controller[_0x11f6('0xa')]);router[_0x11f6('0xb')](_0x11f6('0xc'),auth[_0x11f6('0x9')](),controller[_0x11f6('0xd')]);router[_0x11f6('0xb')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x11f6('0xe')]);router[_0x11f6('0xb')](_0x11f6('0xf'),auth[_0x11f6('0x9')](),controller[_0x11f6('0x10')]);router['get'](_0x11f6('0x11'),auth['isAuthenticated'](),controller[_0x11f6('0x12')]);router['get']('/:id/hopper_black',auth[_0x11f6('0x9')](),controller[_0x11f6('0x13')]);router[_0x11f6('0xb')](_0x11f6('0x14'),auth[_0x11f6('0x9')](),controller[_0x11f6('0x15')]);router['get'](_0x11f6('0x16'),auth[_0x11f6('0x9')](),controller[_0x11f6('0x17')]);router['post']('/',auth[_0x11f6('0x9')](),controller[_0x11f6('0x18')]);router[_0x11f6('0x19')]('/:id/clone',auth[_0x11f6('0x9')](),controller[_0x11f6('0x1a')]);router[_0x11f6('0x19')](_0x11f6('0x14'),auth[_0x11f6('0x9')](),controller[_0x11f6('0x1b')]);router[_0x11f6('0x19')]('/:id/blacklists',auth[_0x11f6('0x9')](),controller[_0x11f6('0x1c')]);router[_0x11f6('0x1d')](_0x11f6('0xc'),auth[_0x11f6('0x9')](),controller['update']);router['delete'](_0x11f6('0xc'),auth[_0x11f6('0x9')](),controller[_0x11f6('0x1e')]);router['delete']('/:id/lists',auth[_0x11f6('0x9')](),controller[_0x11f6('0x1f')]);router[_0x11f6('0x20')](_0x11f6('0x16'),auth[_0x11f6('0x9')](),controller[_0x11f6('0x21')]);module[_0x11f6('0x22')]=router; \ No newline at end of file +var _0x5ed3=['/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','/:id/blacklists','post','create','/:id/clone','addBlackLists','update','delete','destroy','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./campaign.controller','index','get'];(function(_0x3210de,_0x8ef1bd){var _0x3a7ffd=function(_0x31113f){while(--_0x31113f){_0x3210de['push'](_0x3210de['shift']());}};_0x3a7ffd(++_0x8ef1bd);}(_0x5ed3,0x9e));var _0x35ed=function(_0x36fc85,_0x1d2e27){_0x36fc85=_0x36fc85-0x0;var _0x245179=_0x5ed3[_0x36fc85];return _0x245179;};'use strict';var multer=require(_0x35ed('0x0'));var util=require(_0x35ed('0x1'));var path=require(_0x35ed('0x2'));var timeout=require(_0x35ed('0x3'));var express=require(_0x35ed('0x4'));var router=express[_0x35ed('0x5')]();var fs_extra=require(_0x35ed('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x35ed('0x7'));var config=require(_0x35ed('0x8'));var controller=require(_0x35ed('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x35ed('0xa')]);router[_0x35ed('0xb')](_0x35ed('0xc'),auth[_0x35ed('0xd')](),controller[_0x35ed('0xe')]);router[_0x35ed('0xb')](_0x35ed('0xf'),auth[_0x35ed('0xd')](),controller[_0x35ed('0x10')]);router[_0x35ed('0xb')](_0x35ed('0x11'),auth['isAuthenticated'](),controller[_0x35ed('0x12')]);router['get'](_0x35ed('0x13'),auth[_0x35ed('0xd')](),controller['getHopperFinals']);router[_0x35ed('0xb')](_0x35ed('0x14'),auth[_0x35ed('0xd')](),controller[_0x35ed('0x15')]);router['get'](_0x35ed('0x16'),auth[_0x35ed('0xd')](),controller['getLists']);router[_0x35ed('0xb')](_0x35ed('0x17'),auth[_0x35ed('0xd')](),controller['getBlackLists']);router[_0x35ed('0x18')]('/',auth[_0x35ed('0xd')](),controller[_0x35ed('0x19')]);router['post'](_0x35ed('0x1a'),auth[_0x35ed('0xd')](),controller['clone']);router[_0x35ed('0x18')](_0x35ed('0x16'),auth[_0x35ed('0xd')](),controller['addLists']);router[_0x35ed('0x18')](_0x35ed('0x17'),auth[_0x35ed('0xd')](),controller[_0x35ed('0x1b')]);router['put'](_0x35ed('0xc'),auth[_0x35ed('0xd')](),controller[_0x35ed('0x1c')]);router[_0x35ed('0x1d')](_0x35ed('0xc'),auth[_0x35ed('0xd')](),controller[_0x35ed('0x1e')]);router[_0x35ed('0x1d')]('/:id/lists',auth[_0x35ed('0xd')](),controller[_0x35ed('0x1f')]);router[_0x35ed('0x1d')](_0x35ed('0x17'),auth[_0x35ed('0xd')](),controller[_0x35ed('0x20')]);module[_0x35ed('0x21')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 02c9490..8654fd1 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 _0x923d=['key','exports','STRING','TEXT','VIRTUAL'];(function(_0x1060b7,_0xe9fbb0){var _0x15c24f=function(_0x5b0232){while(--_0x5b0232){_0x1060b7['push'](_0x1060b7['shift']());}};_0x15c24f(++_0xe9fbb0);}(_0x923d,0x178));var _0xd923=function(_0x568c51,_0x150e89){_0x568c51=_0x568c51-0x0;var _0x2f86bf=_0x923d[_0x568c51];return _0x2f86bf;};'use strict';var Sequelize=require('sequelize');module[_0xd923('0x0')]={'key':{'type':Sequelize[_0xd923('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xd923('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xd923('0x3')],'get':function(){return this['getDataValue'](_0xd923('0x4'));}}}; \ No newline at end of file +var _0x4fda=['TEXT','VIRTUAL','key','exports','STRING'];(function(_0xc5544f,_0x183e91){var _0x1bd946=function(_0x45be25){while(--_0x45be25){_0xc5544f['push'](_0xc5544f['shift']());}};_0x1bd946(++_0x183e91);}(_0x4fda,0x161));var _0xa4fd=function(_0x31a576,_0x424419){_0x31a576=_0x31a576-0x0;var _0x30b1d3=_0x4fda[_0x31a576];return _0x30b1d3;};'use strict';var Sequelize=require('sequelize');module[_0xa4fd('0x0')]={'key':{'type':Sequelize[_0xa4fd('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xa4fd('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa4fd('0x1')]},'name':{'type':Sequelize[_0xa4fd('0x3')],'get':function(){return this['getDataValue'](_0xa4fd('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index bae801e..cc9ad36 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 _0x5857=['ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','CannedAnswers','UserProfileResource','stack','name','send','map','CannedAnswer','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','fields','find','catch','update','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','util','to-csv'];(function(_0x561ff7,_0x156137){var _0x33e6a7=function(_0x491fba){while(--_0x491fba){_0x561ff7['push'](_0x561ff7['shift']());}};_0x33e6a7(++_0x156137);}(_0x5857,0xb1));var _0x7585=function(_0x6300e2,_0x103d88){_0x6300e2=_0x6300e2-0x0;var _0x9a9392=_0x5857[_0x6300e2];return _0x9a9392;};'use strict';var emlformat=require(_0x7585('0x0'));var rimraf=require(_0x7585('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7585('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7585('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0x7585('0x4'));var ejs=require(_0x7585('0x5'));var fs=require('fs');var fs_extra=require(_0x7585('0x6'));var _=require(_0x7585('0x7'));var squel=require(_0x7585('0x8'));var crypto=require(_0x7585('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x7585('0xa'));var toCsv=require(_0x7585('0x4'));var querystring=require(_0x7585('0xb'));var Papa=require(_0x7585('0xc'));var Redis=require(_0x7585('0xd'));var authService=require(_0x7585('0xe'));var qs=require(_0x7585('0xf'));var as=require(_0x7585('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7585('0x11'))(_0x7585('0x12'));var utils=require('../../config/utils');var config=require(_0x7585('0x13'));var licenseUtil=require(_0x7585('0x14'));var db=require(_0x7585('0x15'))['db'];function respondWithStatusCode(_0x36ed46,_0x583660){_0x583660=_0x583660||0xcc;return function(_0x21ae35){if(_0x21ae35){return _0x36ed46[_0x7585('0x16')](_0x583660);}return _0x36ed46[_0x7585('0x17')](_0x583660)[_0x7585('0x18')]();};}function respondWithResult(_0x449adc,_0x16f562){_0x16f562=_0x16f562||0xc8;return function(_0x2e95cb){if(_0x2e95cb){return _0x449adc['status'](_0x16f562)[_0x7585('0x19')](_0x2e95cb);}};}function respondWithFilteredResult(_0x5c3bd7,_0x28b555){return function(_0x4c3efe){if(_0x4c3efe){var _0x57ad53=typeof _0x28b555[_0x7585('0x1a')]===_0x7585('0x1b')&&typeof _0x28b555[_0x7585('0x1c')]===_0x7585('0x1b');var _0x1021fe=_0x4c3efe[_0x7585('0x1d')];var _0x53cd17=_0x57ad53?0x0:_0x28b555[_0x7585('0x1a')];var _0x59b77a=_0x57ad53?_0x4c3efe[_0x7585('0x1d')]:_0x28b555[_0x7585('0x1a')]+_0x28b555['limit'];var _0x4830bd;if(_0x59b77a>=_0x1021fe){_0x59b77a=_0x1021fe;_0x4830bd=0xc8;}else{_0x4830bd=0xce;}_0x5c3bd7[_0x7585('0x17')](_0x4830bd);return _0x5c3bd7[_0x7585('0x1e')](_0x7585('0x1f'),_0x53cd17+'-'+_0x59b77a+'/'+_0x1021fe)[_0x7585('0x19')](_0x4c3efe);}return null;};}function patchUpdates(_0x1884e0){return function(_0x51de67){try{jsonpatch[_0x7585('0x20')](_0x51de67,_0x1884e0,!![]);}catch(_0x1832df){return BPromise[_0x7585('0x21')](_0x1832df);}return _0x51de67[_0x7585('0x22')]();};}function saveUpdates(_0x322f56,_0x12f089){return function(_0x539995){if(_0x539995){return _0x539995['update'](_0x322f56)[_0x7585('0x23')](function(_0x1c97e6){return _0x1c97e6;});}return null;};}function removeEntity(_0xdab0d3,_0x4761c4){return function(_0x53fdd0){if(_0x53fdd0){return _0x53fdd0[_0x7585('0x24')]()[_0x7585('0x23')](function(){var _0x4d9d99=_0x53fdd0['get']({'plain':!![]});var _0x519636=_0x7585('0x25');return db[_0x7585('0x26')][_0x7585('0x24')]({'where':{'type':_0x519636,'resourceId':_0x4d9d99['id']}})[_0x7585('0x23')](function(){return _0x53fdd0;});})[_0x7585('0x23')](function(){_0xdab0d3[_0x7585('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52befe,_0x76f2df){return function(_0x518976){if(!_0x518976){_0x52befe[_0x7585('0x16')](0x194);}return _0x518976;};}function handleError(_0x2a98eb,_0x211179){_0x211179=_0x211179||0x1f4;return function(_0x363284){logger['error'](_0x363284[_0x7585('0x27')]);if(_0x363284['name']){delete _0x363284[_0x7585('0x28')];}_0x2a98eb[_0x7585('0x17')](_0x211179)[_0x7585('0x29')](_0x363284);};}exports['index']=function(_0x40a960,_0x508eb3){var _0x153a36={},_0x4e60c6={},_0xa7b677={'count':0x0,'rows':[]};var _0x5119dd=_[_0x7585('0x2a')](db[_0x7585('0x2b')][_0x7585('0x2c')],function(_0x4d2b66){return{'name':_0x4d2b66[_0x7585('0x2d')],'type':_0x4d2b66[_0x7585('0x2e')][_0x7585('0x2f')]};});_0x4e60c6['model']=_[_0x7585('0x2a')](_0x5119dd,_0x7585('0x28'));_0x4e60c6[_0x7585('0x30')]=_[_0x7585('0x31')](_0x40a960[_0x7585('0x30')]);_0x4e60c6[_0x7585('0x32')]=_[_0x7585('0x33')](_0x4e60c6[_0x7585('0x34')],_0x4e60c6['query']);_0x153a36[_0x7585('0x35')]=_[_0x7585('0x33')](_0x4e60c6[_0x7585('0x34')],qs['fields'](_0x40a960['query']['fields']));_0x153a36[_0x7585('0x35')]=_0x153a36[_0x7585('0x35')][_0x7585('0x36')]?_0x153a36[_0x7585('0x35')]:_0x4e60c6['model'];if(!_0x40a960['query'][_0x7585('0x37')](_0x7585('0x38'))){_0x153a36[_0x7585('0x1c')]=qs['limit'](_0x40a960['query'][_0x7585('0x1c')]);_0x153a36[_0x7585('0x1a')]=qs[_0x7585('0x1a')](_0x40a960[_0x7585('0x30')][_0x7585('0x1a')]);}_0x153a36[_0x7585('0x39')]=qs[_0x7585('0x3a')](_0x40a960[_0x7585('0x30')]['sort']);_0x153a36[_0x7585('0x3b')]=qs[_0x7585('0x32')](_[_0x7585('0x3c')](_0x40a960[_0x7585('0x30')],_0x4e60c6['filters']),_0x5119dd);if(_0x40a960[_0x7585('0x30')][_0x7585('0x3d')]){_0x153a36['where']=_[_0x7585('0x3e')](_0x153a36[_0x7585('0x3b')],{'$or':[{'key':{'$like':'%'+_0x40a960[_0x7585('0x30')]['filter']+'%'}},{'value':{'$like':'%'+_0x40a960[_0x7585('0x30')][_0x7585('0x3d')]+'%'}}]});}_0x153a36=_[_0x7585('0x3e')]({},_0x153a36,_0x40a960[_0x7585('0x3f')]);var _0x2f56c7={'where':_0x153a36[_0x7585('0x3b')]};return db['CannedAnswer']['count'](_0x2f56c7)[_0x7585('0x23')](function(_0x2dd135){_0xa7b677[_0x7585('0x1d')]=_0x2dd135;if(_0x40a960[_0x7585('0x30')][_0x7585('0x40')]){_0x153a36[_0x7585('0x41')]=[{'all':!![]}];}return db[_0x7585('0x2b')][_0x7585('0x42')](_0x153a36);})[_0x7585('0x23')](function(_0x5d7bc0){_0xa7b677[_0x7585('0x43')]=_0x5d7bc0;return _0xa7b677;})['then'](respondWithFilteredResult(_0x508eb3,_0x153a36))['catch'](handleError(_0x508eb3,null));};exports[_0x7585('0x44')]=function(_0x6c6b7b,_0x5e8389){var _0x18fa14={'raw':!![],'where':{'id':_0x6c6b7b['params']['id']}},_0x403aec={};_0x403aec[_0x7585('0x34')]=_[_0x7585('0x31')](db[_0x7585('0x2b')][_0x7585('0x2c')]);_0x403aec[_0x7585('0x30')]=_['keys'](_0x6c6b7b[_0x7585('0x30')]);_0x403aec[_0x7585('0x32')]=_[_0x7585('0x33')](_0x403aec[_0x7585('0x34')],_0x403aec[_0x7585('0x30')]);_0x18fa14[_0x7585('0x35')]=_[_0x7585('0x33')](_0x403aec['model'],qs[_0x7585('0x45')](_0x6c6b7b[_0x7585('0x30')][_0x7585('0x45')]));_0x18fa14['attributes']=_0x18fa14['attributes'][_0x7585('0x36')]?_0x18fa14[_0x7585('0x35')]:_0x403aec['model'];if(_0x6c6b7b['query'][_0x7585('0x40')]){_0x18fa14[_0x7585('0x41')]=[{'all':!![]}];}_0x18fa14=_[_0x7585('0x3e')]({},_0x18fa14,_0x6c6b7b['options']);return db[_0x7585('0x2b')][_0x7585('0x46')](_0x18fa14)['then'](handleEntityNotFound(_0x5e8389,null))[_0x7585('0x23')](respondWithResult(_0x5e8389,null))[_0x7585('0x47')](handleError(_0x5e8389,null));};exports[_0x7585('0x48')]=function(_0x1a386a,_0x1fe2e5){if(_0x1a386a['body']['id']){delete _0x1a386a[_0x7585('0x49')]['id'];}return db[_0x7585('0x2b')][_0x7585('0x46')]({'where':{'id':_0x1a386a[_0x7585('0x4a')]['id']}})[_0x7585('0x23')](handleEntityNotFound(_0x1fe2e5,null))['then'](saveUpdates(_0x1a386a['body'],null))[_0x7585('0x23')](respondWithResult(_0x1fe2e5,null))[_0x7585('0x47')](handleError(_0x1fe2e5,null));};exports[_0x7585('0x24')]=function(_0x5760f3,_0x444997){return db[_0x7585('0x2b')][_0x7585('0x46')]({'where':{'id':_0x5760f3[_0x7585('0x4a')]['id']}})[_0x7585('0x23')](handleEntityNotFound(_0x444997,null))[_0x7585('0x23')](removeEntity(_0x444997,null))[_0x7585('0x47')](handleError(_0x444997,null));};exports[_0x7585('0x4b')]=function(_0x5113fa,_0x997832){var _0x2c1299={'key':_0x5113fa['body'][_0x7585('0x2f')]};if(_0x5113fa[_0x7585('0x49')][_0x7585('0x4c')]){_0x2c1299[_0x7585('0x4c')]=_0x5113fa[_0x7585('0x49')][_0x7585('0x4c')];}else if(_0x5113fa['body'][_0x7585('0x4d')]){_0x2c1299[_0x7585('0x4d')]=_0x5113fa[_0x7585('0x49')][_0x7585('0x4d')];}else if(_0x5113fa[_0x7585('0x49')][_0x7585('0x4e')]){_0x2c1299[_0x7585('0x4e')]=_0x5113fa[_0x7585('0x49')][_0x7585('0x4e')];}else if(_0x5113fa[_0x7585('0x49')][_0x7585('0x4f')]){_0x2c1299[_0x7585('0x4f')]=_0x5113fa[_0x7585('0x49')][_0x7585('0x4f')];}return db[_0x7585('0x2b')][_0x7585('0x46')]({'where':_0x2c1299})[_0x7585('0x23')](function(_0x5d3011){if(_0x5d3011){throw new db[(_0x7585('0x50'))][(_0x7585('0x51'))](_0x7585('0x52'));}return db[_0x7585('0x2b')][_0x7585('0x4b')](_0x5113fa[_0x7585('0x49')]);})[_0x7585('0x23')](function(_0x4fd81d){var _0x752e2e=_0x5113fa[_0x7585('0x53')][_0x7585('0x54')]({'plain':!![]});if(!_0x752e2e)throw new Error(_0x7585('0x55'));if(_0x752e2e[_0x7585('0x56')]===_0x7585('0x53')){var _0x5b6db5=_0x4fd81d[_0x7585('0x54')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x7585('0x25'),'userProfileId':_0x752e2e[_0x7585('0x57')]},'raw':!![]})[_0x7585('0x23')](function(_0x570ce8){if(_0x570ce8&&_0x570ce8[_0x7585('0x58')]===0x0){return db[_0x7585('0x26')][_0x7585('0x4b')]({'name':_0x5b6db5[_0x7585('0x28')],'resourceId':_0x5b6db5['id'],'type':_0x570ce8[_0x7585('0x28')],'sectionId':_0x570ce8['id']},{})['then'](function(){return _0x4fd81d;});}else{return _0x4fd81d;}})[_0x7585('0x47')](function(_0x2b6c56){logger[_0x7585('0x59')](_0x7585('0x5a'),_0x2b6c56);throw _0x2b6c56;});}return _0x4fd81d;})[_0x7585('0x23')](respondWithResult(_0x997832,0xc9))[_0x7585('0x47')](handleError(_0x997832,null));}; \ No newline at end of file +var _0xdb3d=['../../mysqldb','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name','send','index','map','CannedAnswer','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','include','findAll','rows','catch','params','rawAttributes','includeAll','find','body','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','CannedAnswers','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0x22a6dd,_0x4f7b79){var _0x57de14=function(_0x135187){while(--_0x135187){_0x22a6dd['push'](_0x22a6dd['shift']());}};_0x57de14(++_0x4f7b79);}(_0xdb3d,0x1a6));var _0xddb3=function(_0x5473e7,_0xec03b7){_0x5473e7=_0x5473e7-0x0;var _0x3afd0d=_0xdb3d[_0x5473e7];return _0x3afd0d;};'use strict';var emlformat=require(_0xddb3('0x0'));var rimraf=require(_0xddb3('0x1'));var zipdir=require(_0xddb3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xddb3('0x3'));var moment=require(_0xddb3('0x4'));var BPromise=require(_0xddb3('0x5'));var Mustache=require(_0xddb3('0x6'));var util=require(_0xddb3('0x7'));var path=require(_0xddb3('0x8'));var sox=require('sox');var csv=require(_0xddb3('0x9'));var ejs=require(_0xddb3('0xa'));var fs=require('fs');var fs_extra=require(_0xddb3('0xb'));var _=require(_0xddb3('0xc'));var squel=require(_0xddb3('0xd'));var crypto=require('crypto');var jsforce=require(_0xddb3('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xddb3('0xf'));var authService=require(_0xddb3('0x10'));var qs=require(_0xddb3('0x11'));var as=require(_0xddb3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xddb3('0x13'))(_0xddb3('0x14'));var utils=require(_0xddb3('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xddb3('0x16'));var db=require(_0xddb3('0x17'))['db'];function respondWithStatusCode(_0x448449,_0x55bfda){_0x55bfda=_0x55bfda||0xcc;return function(_0x988680){if(_0x988680){return _0x448449['sendStatus'](_0x55bfda);}return _0x448449['status'](_0x55bfda)[_0xddb3('0x18')]();};}function respondWithResult(_0x5711c5,_0x273d1f){_0x273d1f=_0x273d1f||0xc8;return function(_0x517ac6){if(_0x517ac6){return _0x5711c5[_0xddb3('0x19')](_0x273d1f)[_0xddb3('0x1a')](_0x517ac6);}};}function respondWithFilteredResult(_0x460677,_0x1d0105){return function(_0x50345d){if(_0x50345d){var _0x1b1e55=typeof _0x1d0105[_0xddb3('0x1b')]===_0xddb3('0x1c')&&typeof _0x1d0105['limit']===_0xddb3('0x1c');var _0x581e80=_0x50345d[_0xddb3('0x1d')];var _0x160de0=_0x1b1e55?0x0:_0x1d0105[_0xddb3('0x1b')];var _0xd4651=_0x1b1e55?_0x50345d[_0xddb3('0x1d')]:_0x1d0105[_0xddb3('0x1b')]+_0x1d0105[_0xddb3('0x1e')];var _0x5c0dc6;if(_0xd4651>=_0x581e80){_0xd4651=_0x581e80;_0x5c0dc6=0xc8;}else{_0x5c0dc6=0xce;}_0x460677['status'](_0x5c0dc6);return _0x460677['set'](_0xddb3('0x1f'),_0x160de0+'-'+_0xd4651+'/'+_0x581e80)[_0xddb3('0x1a')](_0x50345d);}return null;};}function patchUpdates(_0x1ce6e6){return function(_0x22cca4){try{jsonpatch[_0xddb3('0x20')](_0x22cca4,_0x1ce6e6,!![]);}catch(_0x45e6c1){return BPromise[_0xddb3('0x21')](_0x45e6c1);}return _0x22cca4['save']();};}function saveUpdates(_0x1ea4fd,_0x38e2df){return function(_0x47a394){if(_0x47a394){return _0x47a394[_0xddb3('0x22')](_0x1ea4fd)[_0xddb3('0x23')](function(_0x18f8c6){return _0x18f8c6;});}return null;};}function removeEntity(_0x3e26f5,_0x3408f8){return function(_0x155cd8){if(_0x155cd8){return _0x155cd8['destroy']()['then'](function(){var _0x5082b0=_0x155cd8['get']({'plain':!![]});var _0x3df7fa='CannedAnswers';return db['UserProfileResource'][_0xddb3('0x24')]({'where':{'type':_0x3df7fa,'resourceId':_0x5082b0['id']}})[_0xddb3('0x23')](function(){return _0x155cd8;});})[_0xddb3('0x23')](function(){_0x3e26f5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e522e,_0x12a85a){return function(_0xc6da02){if(!_0xc6da02){_0x1e522e[_0xddb3('0x25')](0x194);}return _0xc6da02;};}function handleError(_0x419692,_0x411b6e){_0x411b6e=_0x411b6e||0x1f4;return function(_0x472355){logger[_0xddb3('0x26')](_0x472355['stack']);if(_0x472355[_0xddb3('0x27')]){delete _0x472355[_0xddb3('0x27')];}_0x419692[_0xddb3('0x19')](_0x411b6e)[_0xddb3('0x28')](_0x472355);};}exports[_0xddb3('0x29')]=function(_0x19a1b7,_0x4c2114){var _0x1a022f={},_0x206cda={},_0x1ec319={'count':0x0,'rows':[]};var _0x269c31=_[_0xddb3('0x2a')](db[_0xddb3('0x2b')]['rawAttributes'],function(_0x7d5713){return{'name':_0x7d5713[_0xddb3('0x2c')],'type':_0x7d5713[_0xddb3('0x2d')]['key']};});_0x206cda[_0xddb3('0x2e')]=_[_0xddb3('0x2a')](_0x269c31,_0xddb3('0x27'));_0x206cda[_0xddb3('0x2f')]=_[_0xddb3('0x30')](_0x19a1b7[_0xddb3('0x2f')]);_0x206cda[_0xddb3('0x31')]=_[_0xddb3('0x32')](_0x206cda[_0xddb3('0x2e')],_0x206cda[_0xddb3('0x2f')]);_0x1a022f[_0xddb3('0x33')]=_[_0xddb3('0x32')](_0x206cda[_0xddb3('0x2e')],qs[_0xddb3('0x34')](_0x19a1b7[_0xddb3('0x2f')][_0xddb3('0x34')]));_0x1a022f[_0xddb3('0x33')]=_0x1a022f[_0xddb3('0x33')][_0xddb3('0x35')]?_0x1a022f[_0xddb3('0x33')]:_0x206cda[_0xddb3('0x2e')];if(!_0x19a1b7[_0xddb3('0x2f')][_0xddb3('0x36')](_0xddb3('0x37'))){_0x1a022f[_0xddb3('0x1e')]=qs[_0xddb3('0x1e')](_0x19a1b7['query'][_0xddb3('0x1e')]);_0x1a022f[_0xddb3('0x1b')]=qs[_0xddb3('0x1b')](_0x19a1b7[_0xddb3('0x2f')]['offset']);}_0x1a022f[_0xddb3('0x38')]=qs[_0xddb3('0x39')](_0x19a1b7['query'][_0xddb3('0x39')]);_0x1a022f['where']=qs['filters'](_[_0xddb3('0x3a')](_0x19a1b7[_0xddb3('0x2f')],_0x206cda[_0xddb3('0x31')]),_0x269c31);if(_0x19a1b7[_0xddb3('0x2f')][_0xddb3('0x3b')]){_0x1a022f[_0xddb3('0x3c')]=_[_0xddb3('0x3d')](_0x1a022f[_0xddb3('0x3c')],{'$or':[{'key':{'$like':'%'+_0x19a1b7[_0xddb3('0x2f')][_0xddb3('0x3b')]+'%'}},{'value':{'$like':'%'+_0x19a1b7[_0xddb3('0x2f')][_0xddb3('0x3b')]+'%'}}]});}_0x1a022f=_[_0xddb3('0x3d')]({},_0x1a022f,_0x19a1b7[_0xddb3('0x3e')]);var _0x270427={'where':_0x1a022f['where']};return db[_0xddb3('0x2b')][_0xddb3('0x1d')](_0x270427)['then'](function(_0x21acb1){_0x1ec319[_0xddb3('0x1d')]=_0x21acb1;if(_0x19a1b7[_0xddb3('0x2f')]['includeAll']){_0x1a022f[_0xddb3('0x3f')]=[{'all':!![]}];}return db[_0xddb3('0x2b')][_0xddb3('0x40')](_0x1a022f);})[_0xddb3('0x23')](function(_0x126d96){_0x1ec319[_0xddb3('0x41')]=_0x126d96;return _0x1ec319;})[_0xddb3('0x23')](respondWithFilteredResult(_0x4c2114,_0x1a022f))[_0xddb3('0x42')](handleError(_0x4c2114,null));};exports['show']=function(_0x5ea28f,_0x5c8a8c){var _0x35a7f2={'raw':!![],'where':{'id':_0x5ea28f[_0xddb3('0x43')]['id']}},_0x1a0cb0={};_0x1a0cb0[_0xddb3('0x2e')]=_[_0xddb3('0x30')](db['CannedAnswer'][_0xddb3('0x44')]);_0x1a0cb0['query']=_[_0xddb3('0x30')](_0x5ea28f['query']);_0x1a0cb0[_0xddb3('0x31')]=_[_0xddb3('0x32')](_0x1a0cb0['model'],_0x1a0cb0['query']);_0x35a7f2[_0xddb3('0x33')]=_[_0xddb3('0x32')](_0x1a0cb0[_0xddb3('0x2e')],qs[_0xddb3('0x34')](_0x5ea28f['query'][_0xddb3('0x34')]));_0x35a7f2['attributes']=_0x35a7f2[_0xddb3('0x33')][_0xddb3('0x35')]?_0x35a7f2[_0xddb3('0x33')]:_0x1a0cb0['model'];if(_0x5ea28f[_0xddb3('0x2f')][_0xddb3('0x45')]){_0x35a7f2['include']=[{'all':!![]}];}_0x35a7f2=_[_0xddb3('0x3d')]({},_0x35a7f2,_0x5ea28f[_0xddb3('0x3e')]);return db[_0xddb3('0x2b')][_0xddb3('0x46')](_0x35a7f2)[_0xddb3('0x23')](handleEntityNotFound(_0x5c8a8c,null))[_0xddb3('0x23')](respondWithResult(_0x5c8a8c,null))[_0xddb3('0x42')](handleError(_0x5c8a8c,null));};exports[_0xddb3('0x22')]=function(_0x18f569,_0x10533c){if(_0x18f569[_0xddb3('0x47')]['id']){delete _0x18f569[_0xddb3('0x47')]['id'];}return db['CannedAnswer'][_0xddb3('0x46')]({'where':{'id':_0x18f569[_0xddb3('0x43')]['id']}})[_0xddb3('0x23')](handleEntityNotFound(_0x10533c,null))[_0xddb3('0x23')](saveUpdates(_0x18f569[_0xddb3('0x47')],null))[_0xddb3('0x23')](respondWithResult(_0x10533c,null))[_0xddb3('0x42')](handleError(_0x10533c,null));};exports[_0xddb3('0x24')]=function(_0x2b6b84,_0x1ac964){return db['CannedAnswer']['find']({'where':{'id':_0x2b6b84[_0xddb3('0x43')]['id']}})['then'](handleEntityNotFound(_0x1ac964,null))['then'](removeEntity(_0x1ac964,null))['catch'](handleError(_0x1ac964,null));};exports[_0xddb3('0x48')]=function(_0xdd5537,_0x4b0f16){var _0x4a447d={'key':_0xdd5537[_0xddb3('0x47')][_0xddb3('0x49')]};if(_0xdd5537['body'][_0xddb3('0x4a')]){_0x4a447d[_0xddb3('0x4a')]=_0xdd5537[_0xddb3('0x47')]['MailAccountId'];}else if(_0xdd5537[_0xddb3('0x47')][_0xddb3('0x4b')]){_0x4a447d['SmsAccountId']=_0xdd5537[_0xddb3('0x47')][_0xddb3('0x4b')];}else if(_0xdd5537[_0xddb3('0x47')]['OpenchannelAccountId']){_0x4a447d['OpenchannelAccountId']=_0xdd5537[_0xddb3('0x47')][_0xddb3('0x4c')];}else if(_0xdd5537[_0xddb3('0x47')][_0xddb3('0x4d')]){_0x4a447d['ChatWebsiteId']=_0xdd5537[_0xddb3('0x47')][_0xddb3('0x4d')];}return db[_0xddb3('0x2b')]['find']({'where':_0x4a447d})[_0xddb3('0x23')](function(_0x5b3eaf){if(_0x5b3eaf){throw new db[(_0xddb3('0x4e'))][(_0xddb3('0x4f'))](_0xddb3('0x50'));}return db[_0xddb3('0x2b')][_0xddb3('0x48')](_0xdd5537[_0xddb3('0x47')]);})[_0xddb3('0x23')](function(_0x477355){var _0x2cd427=_0xdd5537[_0xddb3('0x51')][_0xddb3('0x52')]({'plain':!![]});if(!_0x2cd427)throw new Error(_0xddb3('0x53'));if(_0x2cd427['role']===_0xddb3('0x51')){var _0x371575=_0x477355[_0xddb3('0x52')]({'plain':!![]});return db[_0xddb3('0x54')][_0xddb3('0x46')]({'where':{'name':_0xddb3('0x55'),'userProfileId':_0x2cd427[_0xddb3('0x56')]},'raw':!![]})['then'](function(_0x373f9f){if(_0x373f9f&&_0x373f9f['autoAssociation']===0x0){return db[_0xddb3('0x57')][_0xddb3('0x48')]({'name':_0x371575[_0xddb3('0x27')],'resourceId':_0x371575['id'],'type':_0x373f9f['name'],'sectionId':_0x373f9f['id']},{})['then'](function(){return _0x477355;});}else{return _0x477355;}})[_0xddb3('0x42')](function(_0xac760){logger[_0xddb3('0x26')](_0xddb3('0x58'),_0xac760);throw _0xac760;});}return _0x477355;})[_0xddb3('0x23')](respondWithResult(_0x4b0f16,0xc9))[_0xddb3('0x42')](handleError(_0x4b0f16,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index d477a94..f2a54f3 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 _0x791a=['define','tools_canned_answers','lodash','../../config/logger','api','moment','request-promise','./cannedAnswer.attributes','exports'];(function(_0x27fd3b,_0x5336e4){var _0x4a1373=function(_0x4d4190){while(--_0x4d4190){_0x27fd3b['push'](_0x27fd3b['shift']());}};_0x4a1373(++_0x5336e4);}(_0x791a,0x6e));var _0xa791=function(_0x3c09c8,_0x389b9d){_0x3c09c8=_0x3c09c8-0x0;var _0x49870d=_0x791a[_0x3c09c8];return _0x49870d;};'use strict';var _=require(_0xa791('0x0'));var util=require('util');var logger=require(_0xa791('0x1'))(_0xa791('0x2'));var moment=require(_0xa791('0x3'));var BPromise=require('bluebird');var rp=require(_0xa791('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa791('0x5'));module[_0xa791('0x6')]=function(_0x1e3803,_0x4b58ab){return _0x1e3803[_0xa791('0x7')]('CannedAnswer',attributes,{'tableName':_0xa791('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xaaf2=['utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4'];(function(_0x5a0f51,_0xad99d9){var _0x527b94=function(_0x4ac4b2){while(--_0x4ac4b2){_0x5a0f51['push'](_0x5a0f51['shift']());}};_0x527b94(++_0xad99d9);}(_0xaaf2,0x71));var _0x2aaf=function(_0x20bb65,_0x3f2981){_0x20bb65=_0x20bb65-0x0;var _0x1a5f00=_0xaaf2[_0x20bb65];return _0x1a5f00;};'use strict';var _=require(_0x2aaf('0x0'));var util=require('util');var logger=require(_0x2aaf('0x1'))(_0x2aaf('0x2'));var moment=require(_0x2aaf('0x3'));var BPromise=require(_0x2aaf('0x4'));var rp=require(_0x2aaf('0x5'));var fs=require('fs');var path=require(_0x2aaf('0x6'));var rimraf=require(_0x2aaf('0x7'));var config=require(_0x2aaf('0x8'));var attributes=require(_0x2aaf('0x9'));module[_0x2aaf('0xa')]=function(_0x35b32b,_0x2abdff){return _0x35b32b[_0x2aaf('0xb')](_0x2aaf('0xc'),attributes,{'tableName':_0x2aaf('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2aaf('0xe'),'collate':_0x2aaf('0xf')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 211407b..7faa5cf 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(_0x2ce94a,_0x1b1c43){var _0x4439bb=function(_0x54bbe9){while(--_0x54bbe9){_0x2ce94a['push'](_0x2ce94a['shift']());}};_0x4439bb(++_0x1b1c43);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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(_0x3d76f7,_0xeb8ef){var _0x13297d=function(_0x17a2d9){while(--_0x17a2d9){_0x3d76f7['push'](_0x3d76f7['shift']());}};_0x13297d(++_0xeb8ef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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 716d6a2..1a28006 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 _0x316f=['delete','destroy','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','create','update'];(function(_0x117f99,_0x3a257c){var _0x2e7268=function(_0x26e104){while(--_0x26e104){_0x117f99['push'](_0x117f99['shift']());}};_0x2e7268(++_0x3a257c);}(_0x316f,0x134));var _0xf316=function(_0x1eb856,_0x3ab151){_0x1eb856=_0x1eb856-0x0;var _0x629b2b=_0x316f[_0x1eb856];return _0x629b2b;};'use strict';var multer=require(_0xf316('0x0'));var util=require(_0xf316('0x1'));var path=require('path');var timeout=require(_0xf316('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf316('0x3'));var interaction=require(_0xf316('0x4'));var config=require(_0xf316('0x5'));var controller=require(_0xf316('0x6'));router[_0xf316('0x7')]('/',auth[_0xf316('0x8')](),controller[_0xf316('0x9')]);router[_0xf316('0x7')](_0xf316('0xa'),auth['isAuthenticated'](),controller[_0xf316('0xb')]);router[_0xf316('0xc')]('/',auth[_0xf316('0x8')](),controller[_0xf316('0xd')]);router['put'](_0xf316('0xa'),auth[_0xf316('0x8')](),controller[_0xf316('0xe')]);router[_0xf316('0xf')](_0xf316('0xa'),auth[_0xf316('0x8')](),controller[_0xf316('0x10')]);module['exports']=router; \ No newline at end of file +var _0x8834=['destroy','exports','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','post','create','put','update','delete','/:id'];(function(_0x59c5c1,_0x311105){var _0x3da010=function(_0x48d0b1){while(--_0x48d0b1){_0x59c5c1['push'](_0x59c5c1['shift']());}};_0x3da010(++_0x311105);}(_0x8834,0xb6));var _0x4883=function(_0xeb10f2,_0x50a4cd){_0xeb10f2=_0xeb10f2-0x0;var _0x176b3d=_0x8834[_0xeb10f2];return _0x176b3d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4883('0x0'));var router=express[_0x4883('0x1')]();var fs_extra=require(_0x4883('0x2'));var auth=require(_0x4883('0x3'));var interaction=require(_0x4883('0x4'));var config=require(_0x4883('0x5'));var controller=require(_0x4883('0x6'));router[_0x4883('0x7')]('/',auth[_0x4883('0x8')](),controller[_0x4883('0x9')]);router[_0x4883('0x7')]('/:id',auth[_0x4883('0x8')](),controller['show']);router[_0x4883('0xa')]('/',auth['isAuthenticated'](),controller[_0x4883('0xb')]);router[_0x4883('0xc')]('/:id',auth[_0x4883('0x8')](),controller[_0x4883('0xd')]);router[_0x4883('0xe')](_0x4883('0xf'),auth[_0x4883('0x8')](),controller[_0x4883('0x10')]);module[_0x4883('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 174627e..56863ed 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 _0xa870=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x1fd518,_0xebe006){var _0x1fec77=function(_0x55f2e1){while(--_0x55f2e1){_0x1fd518['push'](_0x1fd518['shift']());}};_0x1fec77(++_0xebe006);}(_0xa870,0x143));var _0x0a87=function(_0x18a7e5,_0x295651){_0x18a7e5=_0x18a7e5-0x0;var _0x5a62f9=_0xa870[_0x18a7e5];return _0x5a62f9;};'use strict';var Sequelize=require(_0x0a87('0x0'));module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x0a87('0x1')},'clid':{'type':Sequelize[_0x0a87('0x2')]},'src':{'type':Sequelize[_0x0a87('0x2')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x0a87('0x2')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x0a87('0x2')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x0a87('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x0a87('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x0a87('0x2')]},'amaflags':{'type':Sequelize[_0x0a87('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x0a87('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x0a87('0x2')]},'sequence':{'type':Sequelize[_0x0a87('0x2')]},'peeraccount':{'type':Sequelize[_0x0a87('0x2')]},'type':{'type':Sequelize[_0x0a87('0x2')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6268=['DATE','STRING','INTEGER','sequelize'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0x6268,0x193));var _0x8626=function(_0x4d327b,_0x30e318){_0x4d327b=_0x4d327b-0x0;var _0x2f8fa2=_0x6268[_0x4d327b];return _0x2f8fa2;};'use strict';var Sequelize=require(_0x8626('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x8626('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x8626('0x2')]},'src':{'type':Sequelize[_0x8626('0x2')]},'dst':{'type':Sequelize[_0x8626('0x2')]},'dcontext':{'type':Sequelize[_0x8626('0x2')]},'channel':{'type':Sequelize[_0x8626('0x2')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x8626('0x2')]},'lastdata':{'type':Sequelize[_0x8626('0x2')]},'duration':{'type':Sequelize[_0x8626('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x8626('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x8626('0x2')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x8626('0x2')]},'uniqueid':{'type':Sequelize[_0x8626('0x2')]},'linkedid':{'type':Sequelize[_0x8626('0x2')]},'sequence':{'type':Sequelize[_0x8626('0x2')]},'peeraccount':{'type':Sequelize[_0x8626('0x2')]},'type':{'type':Sequelize[_0x8626('0x2')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index ecb9f2f..7e11dd7 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 _0x950a=['end','status','json','offset','limit','undefined','count','set','apply','save','update','then','destroy','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x2a5b3b,_0x4ebe31){var _0xae665a=function(_0x59e86a){while(--_0x59e86a){_0x2a5b3b['push'](_0x2a5b3b['shift']());}};_0xae665a(++_0x4ebe31);}(_0x950a,0x111));var _0xa950=function(_0xb0ec50,_0x3ec1b7){_0xb0ec50=_0xb0ec50-0x0;var _0x211502=_0x950a[_0xb0ec50];return _0x211502;};'use strict';var emlformat=require(_0xa950('0x0'));var rimraf=require(_0xa950('0x1'));var zipdir=require(_0xa950('0x2'));var jsonpatch=require(_0xa950('0x3'));var rp=require('request-promise');var moment=require(_0xa950('0x4'));var BPromise=require(_0xa950('0x5'));var Mustache=require(_0xa950('0x6'));var util=require(_0xa950('0x7'));var path=require('path');var sox=require(_0xa950('0x8'));var csv=require(_0xa950('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa950('0xa'));var _=require(_0xa950('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa950('0xc'));var deskjs=require(_0xa950('0xd'));var toCsv=require(_0xa950('0x9'));var querystring=require(_0xa950('0xe'));var Papa=require(_0xa950('0xf'));var Redis=require(_0xa950('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa950('0x11'));var logger=require('../../config/logger')(_0xa950('0x12'));var utils=require(_0xa950('0x13'));var config=require(_0xa950('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xa950('0x15'))['db'];function respondWithStatusCode(_0x4f9c04,_0x10e64a){_0x10e64a=_0x10e64a||0xcc;return function(_0x439097){if(_0x439097){return _0x4f9c04[_0xa950('0x16')](_0x10e64a);}return _0x4f9c04['status'](_0x10e64a)[_0xa950('0x17')]();};}function respondWithResult(_0x2aed6a,_0x1c7adb){_0x1c7adb=_0x1c7adb||0xc8;return function(_0x4ba74f){if(_0x4ba74f){return _0x2aed6a[_0xa950('0x18')](_0x1c7adb)[_0xa950('0x19')](_0x4ba74f);}};}function respondWithFilteredResult(_0x425201,_0x5d5f4c){return function(_0x31b25b){if(_0x31b25b){var _0x46fca7=typeof _0x5d5f4c[_0xa950('0x1a')]==='undefined'&&typeof _0x5d5f4c[_0xa950('0x1b')]===_0xa950('0x1c');var _0x162586=_0x31b25b[_0xa950('0x1d')];var _0x16aabc=_0x46fca7?0x0:_0x5d5f4c[_0xa950('0x1a')];var _0x2b0e44=_0x46fca7?_0x31b25b[_0xa950('0x1d')]:_0x5d5f4c[_0xa950('0x1a')]+_0x5d5f4c[_0xa950('0x1b')];var _0x28fedf;if(_0x2b0e44>=_0x162586){_0x2b0e44=_0x162586;_0x28fedf=0xc8;}else{_0x28fedf=0xce;}_0x425201[_0xa950('0x18')](_0x28fedf);return _0x425201[_0xa950('0x1e')]('Content-Range',_0x16aabc+'-'+_0x2b0e44+'/'+_0x162586)[_0xa950('0x19')](_0x31b25b);}return null;};}function patchUpdates(_0x1a10fe){return function(_0x50abe1){try{jsonpatch[_0xa950('0x1f')](_0x50abe1,_0x1a10fe,!![]);}catch(_0x41c405){return BPromise['reject'](_0x41c405);}return _0x50abe1[_0xa950('0x20')]();};}function saveUpdates(_0x5ad191,_0x2eda79){return function(_0x14ada5){if(_0x14ada5){return _0x14ada5[_0xa950('0x21')](_0x5ad191)[_0xa950('0x22')](function(_0x5617cd){return _0x5617cd;});}return null;};}function removeEntity(_0x11b8af,_0x3f4633){return function(_0x31c135){if(_0x31c135){return _0x31c135[_0xa950('0x23')]()[_0xa950('0x22')](function(){_0x11b8af[_0xa950('0x18')](0xcc)[_0xa950('0x17')]();});}};}function handleEntityNotFound(_0x23cb20,_0x12dcb8){return function(_0xc4894b){if(!_0xc4894b){_0x23cb20[_0xa950('0x16')](0x194);}return _0xc4894b;};}function handleError(_0x26f366,_0x43f8c8){_0x43f8c8=_0x43f8c8||0x1f4;return function(_0x5d82d8){logger[_0xa950('0x24')](_0x5d82d8[_0xa950('0x25')]);if(_0x5d82d8[_0xa950('0x26')]){delete _0x5d82d8[_0xa950('0x26')];}_0x26f366[_0xa950('0x18')](_0x43f8c8)[_0xa950('0x27')](_0x5d82d8);};}exports[_0xa950('0x28')]=function(_0x52e133,_0x19ad7a){var _0x442a94={},_0x5e4c94={},_0x44ee6e={'count':0x0,'rows':[]};var _0x2e7674=_[_0xa950('0x29')](db[_0xa950('0x2a')][_0xa950('0x2b')],function(_0x1945ca){return{'name':_0x1945ca[_0xa950('0x2c')],'type':_0x1945ca[_0xa950('0x2d')][_0xa950('0x2e')]};});_0x5e4c94[_0xa950('0x2f')]=_['map'](_0x2e7674,_0xa950('0x26'));_0x5e4c94['query']=_['keys'](_0x52e133[_0xa950('0x30')]);_0x5e4c94['filters']=_[_0xa950('0x31')](_0x5e4c94[_0xa950('0x2f')],_0x5e4c94[_0xa950('0x30')]);_0x442a94[_0xa950('0x32')]=_['intersection'](_0x5e4c94[_0xa950('0x2f')],qs['fields'](_0x52e133[_0xa950('0x30')][_0xa950('0x33')]));_0x442a94['attributes']=_0x442a94['attributes'][_0xa950('0x34')]?_0x442a94[_0xa950('0x32')]:_0x5e4c94[_0xa950('0x2f')];if(!_0x52e133[_0xa950('0x30')][_0xa950('0x35')](_0xa950('0x36'))){_0x442a94['limit']=qs['limit'](_0x52e133[_0xa950('0x30')]['limit']);_0x442a94[_0xa950('0x1a')]=qs[_0xa950('0x1a')](_0x52e133[_0xa950('0x30')][_0xa950('0x1a')]);}_0x442a94[_0xa950('0x37')]=qs[_0xa950('0x38')](_0x52e133[_0xa950('0x30')][_0xa950('0x38')]);_0x442a94[_0xa950('0x39')]=qs[_0xa950('0x3a')](_['pick'](_0x52e133[_0xa950('0x30')],_0x5e4c94['filters']),_0x2e7674);if(_0x52e133[_0xa950('0x30')][_0xa950('0x3b')]){_0x442a94['where']=_['merge'](_0x442a94[_0xa950('0x39')],{'$or':_[_0xa950('0x29')](_0x2e7674,function(_0x57e9cb){if(_0x57e9cb[_0xa950('0x2d')]!==_0xa950('0x3c')){var _0x4bf63b={};_0x4bf63b[_0x57e9cb[_0xa950('0x26')]]={'$like':'%'+_0x52e133[_0xa950('0x30')][_0xa950('0x3b')]+'%'};return _0x4bf63b;}})});}_0x442a94=_[_0xa950('0x3d')]({},_0x442a94,_0x52e133[_0xa950('0x3e')]);var _0x35cfcc={'where':_0x442a94[_0xa950('0x39')]};return db[_0xa950('0x2a')]['count'](_0x35cfcc)[_0xa950('0x22')](function(_0x1764b2){_0x44ee6e['count']=_0x1764b2;if(_0x52e133[_0xa950('0x30')][_0xa950('0x3f')]){_0x442a94[_0xa950('0x40')]=[{'all':!![]}];}return db['Cdr'][_0xa950('0x41')](_0x442a94);})[_0xa950('0x22')](function(_0x8bdd37){_0x44ee6e['rows']=_0x8bdd37;return _0x44ee6e;})['then'](respondWithFilteredResult(_0x19ad7a,_0x442a94))[_0xa950('0x42')](handleError(_0x19ad7a,null));};exports[_0xa950('0x43')]=function(_0x1f2572,_0x54dc62){var _0x49a235={'raw':!![],'where':{'id':_0x1f2572[_0xa950('0x44')]['id']}},_0x51f5a5={};_0x51f5a5[_0xa950('0x2f')]=_[_0xa950('0x45')](db[_0xa950('0x2a')][_0xa950('0x2b')]);_0x51f5a5['query']=_[_0xa950('0x45')](_0x1f2572[_0xa950('0x30')]);_0x51f5a5['filters']=_['intersection'](_0x51f5a5[_0xa950('0x2f')],_0x51f5a5[_0xa950('0x30')]);_0x49a235['attributes']=_['intersection'](_0x51f5a5['model'],qs['fields'](_0x1f2572[_0xa950('0x30')][_0xa950('0x33')]));_0x49a235['attributes']=_0x49a235['attributes'][_0xa950('0x34')]?_0x49a235['attributes']:_0x51f5a5[_0xa950('0x2f')];if(_0x1f2572[_0xa950('0x30')][_0xa950('0x3f')]){_0x49a235[_0xa950('0x40')]=[{'all':!![]}];}_0x49a235=_[_0xa950('0x3d')]({},_0x49a235,_0x1f2572[_0xa950('0x3e')]);return db[_0xa950('0x2a')][_0xa950('0x46')](_0x49a235)['then'](handleEntityNotFound(_0x54dc62,null))[_0xa950('0x22')](respondWithResult(_0x54dc62,null))['catch'](handleError(_0x54dc62,null));};exports[_0xa950('0x47')]=function(_0x42813e,_0x22675d){return db[_0xa950('0x2a')][_0xa950('0x47')](_0x42813e[_0xa950('0x48')],{})[_0xa950('0x22')](respondWithResult(_0x22675d,0xc9))[_0xa950('0x42')](handleError(_0x22675d,null));};exports[_0xa950('0x21')]=function(_0x4f777a,_0x3cf01c){if(_0x4f777a[_0xa950('0x48')]['id']){delete _0x4f777a[_0xa950('0x48')]['id'];}return db[_0xa950('0x2a')][_0xa950('0x46')]({'where':{'id':_0x4f777a['params']['id']}})[_0xa950('0x22')](handleEntityNotFound(_0x3cf01c,null))[_0xa950('0x22')](saveUpdates(_0x4f777a[_0xa950('0x48')],null))[_0xa950('0x22')](respondWithResult(_0x3cf01c,null))[_0xa950('0x42')](handleError(_0x3cf01c,null));};exports[_0xa950('0x23')]=function(_0x2752e7,_0x5dd6ce){return db[_0xa950('0x2a')][_0xa950('0x46')]({'where':{'id':_0x2752e7[_0xa950('0x44')]['id']}})['then'](handleEntityNotFound(_0x5dd6ce,null))['then'](removeEntity(_0x5dd6ce,null))[_0xa950('0x42')](handleError(_0x5dd6ce,null));};exports[_0xa950('0x49')]=function(_0x38c370,_0x16572e){return db[_0xa950('0x2a')][_0xa950('0x49')]()[_0xa950('0x22')](respondWithResult(_0x16572e,null))[_0xa950('0x42')](handleError(_0x16572e,null));}; \ No newline at end of file +var _0xf69d=['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','sendStatus','status','end','json','offset','undefined','count','set','reject','save','update','then','send','map','Cdr','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','rows','catch','keys','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x5540d5,_0x449e41){var _0x162e5f=function(_0x25eaa5){while(--_0x25eaa5){_0x5540d5['push'](_0x5540d5['shift']());}};_0x162e5f(++_0x449e41);}(_0xf69d,0xd3));var _0xdf69=function(_0x1c413c,_0x34d864){_0x1c413c=_0x1c413c-0x0;var _0x1faa8d=_0xf69d[_0x1c413c];return _0x1faa8d;};'use strict';var emlformat=require(_0xdf69('0x0'));var rimraf=require(_0xdf69('0x1'));var zipdir=require(_0xdf69('0x2'));var jsonpatch=require(_0xdf69('0x3'));var rp=require(_0xdf69('0x4'));var moment=require('moment');var BPromise=require(_0xdf69('0x5'));var Mustache=require(_0xdf69('0x6'));var util=require(_0xdf69('0x7'));var path=require(_0xdf69('0x8'));var sox=require(_0xdf69('0x9'));var csv=require(_0xdf69('0xa'));var ejs=require(_0xdf69('0xb'));var fs=require('fs');var fs_extra=require(_0xdf69('0xc'));var _=require(_0xdf69('0xd'));var squel=require(_0xdf69('0xe'));var crypto=require(_0xdf69('0xf'));var jsforce=require(_0xdf69('0x10'));var deskjs=require(_0xdf69('0x11'));var toCsv=require(_0xdf69('0xa'));var querystring=require(_0xdf69('0x12'));var Papa=require(_0xdf69('0x13'));var Redis=require(_0xdf69('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xdf69('0x15'));var as=require(_0xdf69('0x16'));var hardwareService=require(_0xdf69('0x17'));var logger=require(_0xdf69('0x18'))(_0xdf69('0x19'));var utils=require(_0xdf69('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5df98a,_0x3dcda8){_0x3dcda8=_0x3dcda8||0xcc;return function(_0xbacdc6){if(_0xbacdc6){return _0x5df98a[_0xdf69('0x1b')](_0x3dcda8);}return _0x5df98a[_0xdf69('0x1c')](_0x3dcda8)[_0xdf69('0x1d')]();};}function respondWithResult(_0x38aee2,_0x584cbd){_0x584cbd=_0x584cbd||0xc8;return function(_0x41cc77){if(_0x41cc77){return _0x38aee2[_0xdf69('0x1c')](_0x584cbd)[_0xdf69('0x1e')](_0x41cc77);}};}function respondWithFilteredResult(_0xef2df5,_0x4f28fc){return function(_0xa4242f){if(_0xa4242f){var _0x56be66=typeof _0x4f28fc[_0xdf69('0x1f')]===_0xdf69('0x20')&&typeof _0x4f28fc['limit']===_0xdf69('0x20');var _0x449908=_0xa4242f[_0xdf69('0x21')];var _0x85d1d=_0x56be66?0x0:_0x4f28fc['offset'];var _0x5ae237=_0x56be66?_0xa4242f[_0xdf69('0x21')]:_0x4f28fc[_0xdf69('0x1f')]+_0x4f28fc['limit'];var _0x32cf65;if(_0x5ae237>=_0x449908){_0x5ae237=_0x449908;_0x32cf65=0xc8;}else{_0x32cf65=0xce;}_0xef2df5[_0xdf69('0x1c')](_0x32cf65);return _0xef2df5[_0xdf69('0x22')]('Content-Range',_0x85d1d+'-'+_0x5ae237+'/'+_0x449908)[_0xdf69('0x1e')](_0xa4242f);}return null;};}function patchUpdates(_0x452cfa){return function(_0x4d09d5){try{jsonpatch['apply'](_0x4d09d5,_0x452cfa,!![]);}catch(_0x32505a){return BPromise[_0xdf69('0x23')](_0x32505a);}return _0x4d09d5[_0xdf69('0x24')]();};}function saveUpdates(_0x5d91b8,_0x50ef18){return function(_0x5be7dd){if(_0x5be7dd){return _0x5be7dd[_0xdf69('0x25')](_0x5d91b8)['then'](function(_0x21f757){return _0x21f757;});}return null;};}function removeEntity(_0x311534,_0x1d37d8){return function(_0x54d2ca){if(_0x54d2ca){return _0x54d2ca['destroy']()[_0xdf69('0x26')](function(){_0x311534[_0xdf69('0x1c')](0xcc)[_0xdf69('0x1d')]();});}};}function handleEntityNotFound(_0x3fd933,_0x549191){return function(_0x3b727c){if(!_0x3b727c){_0x3fd933[_0xdf69('0x1b')](0x194);}return _0x3b727c;};}function handleError(_0x3e4f28,_0x5969cb){_0x5969cb=_0x5969cb||0x1f4;return function(_0x2da3df){logger['error'](_0x2da3df['stack']);if(_0x2da3df['name']){delete _0x2da3df['name'];}_0x3e4f28[_0xdf69('0x1c')](_0x5969cb)[_0xdf69('0x27')](_0x2da3df);};}exports['index']=function(_0x301bd2,_0xd81d0a){var _0x19cf2d={},_0x12aec3={},_0x1b7c16={'count':0x0,'rows':[]};var _0x1b57b3=_[_0xdf69('0x28')](db[_0xdf69('0x29')][_0xdf69('0x2a')],function(_0x3b97df){return{'name':_0x3b97df[_0xdf69('0x2b')],'type':_0x3b97df[_0xdf69('0x2c')][_0xdf69('0x2d')]};});_0x12aec3[_0xdf69('0x2e')]=_[_0xdf69('0x28')](_0x1b57b3,_0xdf69('0x2f'));_0x12aec3[_0xdf69('0x30')]=_['keys'](_0x301bd2[_0xdf69('0x30')]);_0x12aec3[_0xdf69('0x31')]=_[_0xdf69('0x32')](_0x12aec3[_0xdf69('0x2e')],_0x12aec3[_0xdf69('0x30')]);_0x19cf2d['attributes']=_[_0xdf69('0x32')](_0x12aec3['model'],qs[_0xdf69('0x33')](_0x301bd2[_0xdf69('0x30')]['fields']));_0x19cf2d[_0xdf69('0x34')]=_0x19cf2d['attributes'][_0xdf69('0x35')]?_0x19cf2d[_0xdf69('0x34')]:_0x12aec3[_0xdf69('0x2e')];if(!_0x301bd2[_0xdf69('0x30')][_0xdf69('0x36')]('nolimit')){_0x19cf2d[_0xdf69('0x37')]=qs['limit'](_0x301bd2[_0xdf69('0x30')][_0xdf69('0x37')]);_0x19cf2d[_0xdf69('0x1f')]=qs[_0xdf69('0x1f')](_0x301bd2['query'][_0xdf69('0x1f')]);}_0x19cf2d['order']=qs[_0xdf69('0x38')](_0x301bd2['query'][_0xdf69('0x38')]);_0x19cf2d['where']=qs[_0xdf69('0x31')](_[_0xdf69('0x39')](_0x301bd2[_0xdf69('0x30')],_0x12aec3[_0xdf69('0x31')]),_0x1b57b3);if(_0x301bd2[_0xdf69('0x30')]['filter']){_0x19cf2d[_0xdf69('0x3a')]=_[_0xdf69('0x3b')](_0x19cf2d['where'],{'$or':_['map'](_0x1b57b3,function(_0x4ee03c){if(_0x4ee03c['type']!==_0xdf69('0x3c')){var _0x5aff7d={};_0x5aff7d[_0x4ee03c[_0xdf69('0x2f')]]={'$like':'%'+_0x301bd2[_0xdf69('0x30')][_0xdf69('0x3d')]+'%'};return _0x5aff7d;}})});}_0x19cf2d=_[_0xdf69('0x3b')]({},_0x19cf2d,_0x301bd2['options']);var _0x3de096={'where':_0x19cf2d[_0xdf69('0x3a')]};return db[_0xdf69('0x29')]['count'](_0x3de096)[_0xdf69('0x26')](function(_0xdd919d){_0x1b7c16[_0xdf69('0x21')]=_0xdd919d;if(_0x301bd2[_0xdf69('0x30')][_0xdf69('0x3e')]){_0x19cf2d[_0xdf69('0x3f')]=[{'all':!![]}];}return db[_0xdf69('0x29')]['findAll'](_0x19cf2d);})['then'](function(_0x1fc4aa){_0x1b7c16[_0xdf69('0x40')]=_0x1fc4aa;return _0x1b7c16;})[_0xdf69('0x26')](respondWithFilteredResult(_0xd81d0a,_0x19cf2d))[_0xdf69('0x41')](handleError(_0xd81d0a,null));};exports['show']=function(_0x4a972c,_0x5980b1){var _0x5454e1={'raw':!![],'where':{'id':_0x4a972c['params']['id']}},_0x2abc7f={};_0x2abc7f[_0xdf69('0x2e')]=_['keys'](db[_0xdf69('0x29')][_0xdf69('0x2a')]);_0x2abc7f[_0xdf69('0x30')]=_[_0xdf69('0x42')](_0x4a972c[_0xdf69('0x30')]);_0x2abc7f[_0xdf69('0x31')]=_[_0xdf69('0x32')](_0x2abc7f[_0xdf69('0x2e')],_0x2abc7f[_0xdf69('0x30')]);_0x5454e1['attributes']=_['intersection'](_0x2abc7f[_0xdf69('0x2e')],qs['fields'](_0x4a972c[_0xdf69('0x30')][_0xdf69('0x33')]));_0x5454e1[_0xdf69('0x34')]=_0x5454e1['attributes'][_0xdf69('0x35')]?_0x5454e1[_0xdf69('0x34')]:_0x2abc7f[_0xdf69('0x2e')];if(_0x4a972c[_0xdf69('0x30')]['includeAll']){_0x5454e1[_0xdf69('0x3f')]=[{'all':!![]}];}_0x5454e1=_[_0xdf69('0x3b')]({},_0x5454e1,_0x4a972c['options']);return db['Cdr'][_0xdf69('0x43')](_0x5454e1)[_0xdf69('0x26')](handleEntityNotFound(_0x5980b1,null))[_0xdf69('0x26')](respondWithResult(_0x5980b1,null))[_0xdf69('0x41')](handleError(_0x5980b1,null));};exports[_0xdf69('0x44')]=function(_0x1b46c6,_0x578eec){return db['Cdr'][_0xdf69('0x44')](_0x1b46c6[_0xdf69('0x45')],{})[_0xdf69('0x26')](respondWithResult(_0x578eec,0xc9))[_0xdf69('0x41')](handleError(_0x578eec,null));};exports['update']=function(_0x4bc70f,_0xb34f76){if(_0x4bc70f[_0xdf69('0x45')]['id']){delete _0x4bc70f[_0xdf69('0x45')]['id'];}return db[_0xdf69('0x29')][_0xdf69('0x43')]({'where':{'id':_0x4bc70f[_0xdf69('0x46')]['id']}})[_0xdf69('0x26')](handleEntityNotFound(_0xb34f76,null))[_0xdf69('0x26')](saveUpdates(_0x4bc70f[_0xdf69('0x45')],null))[_0xdf69('0x26')](respondWithResult(_0xb34f76,null))[_0xdf69('0x41')](handleError(_0xb34f76,null));};exports[_0xdf69('0x47')]=function(_0x9a24c9,_0x439b06){return db['Cdr'][_0xdf69('0x43')]({'where':{'id':_0x9a24c9[_0xdf69('0x46')]['id']}})[_0xdf69('0x26')](handleEntityNotFound(_0x439b06,null))['then'](removeEntity(_0x439b06,null))[_0xdf69('0x41')](handleError(_0x439b06,null));};exports[_0xdf69('0x48')]=function(_0x15ca48,_0x4abeb7){return db[_0xdf69('0x29')]['describe']()[_0xdf69('0x26')](respondWithResult(_0x4abeb7,null))[_0xdf69('0x41')](handleError(_0x4abeb7,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 53883b5..f85de86 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x4153c9,_0x920efd){var _0x5d873e=function(_0x46de37){while(--_0x46de37){_0x4153c9['push'](_0x4153c9['shift']());}};_0x5d873e(++_0x920efd);}(_0x7a54,0x106));var _0x47a5=function(_0x1be169,_0x47b443){_0x1be169=_0x1be169-0x0;var _0x518fe6=_0x7a54[_0x1be169];return _0x518fe6;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x3a3500,_0x37c562){var _0x84a50d=function(_0x5c74a1){while(--_0x5c74a1){_0x3a3500['push'](_0x3a3500['shift']());}};_0x84a50d(++_0x37c562);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 105397c..ad22aed 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 _0x21a5=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Cdr,\x20%s,\x20%s','request\x20sent','catch','util','moment','bluebird','randomstring'];(function(_0x2a57a2,_0x2db547){var _0x4066dd=function(_0x2052c7){while(--_0x2052c7){_0x2a57a2['push'](_0x2a57a2['shift']());}};_0x4066dd(++_0x2db547);}(_0x21a5,0x1c4));var _0x521a=function(_0x55ff79,_0x3d45e7){_0x55ff79=_0x55ff79-0x0;var _0x579067=_0x21a5[_0x55ff79];return _0x579067;};'use strict';var _=require('lodash');var util=require(_0x521a('0x0'));var moment=require(_0x521a('0x1'));var BPromise=require(_0x521a('0x2'));var rs=require(_0x521a('0x3'));var fs=require('fs');var Redis=require(_0x521a('0x4'));var db=require(_0x521a('0x5'))['db'];var utils=require(_0x521a('0x6'));var logger=require(_0x521a('0x7'))(_0x521a('0x8'));var config=require(_0x521a('0x9'));var jayson=require(_0x521a('0xa'));var client=jayson['client'][_0x521a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5da5a9,_0x171fbd,_0x3b156f){return new BPromise(function(_0x512e03,_0x1c9893){return client[_0x521a('0xc')](_0x5da5a9,_0x3b156f)[_0x521a('0xd')](function(_0x4f9b52){logger[_0x521a('0xe')]('Cdr,\x20%s,\x20%s',_0x171fbd,'request\x20sent');logger[_0x521a('0xf')](_0x521a('0x10'),_0x171fbd,'request\x20sent',JSON[_0x521a('0x11')](_0x4f9b52));if(_0x4f9b52[_0x521a('0x12')]){if(_0x4f9b52[_0x521a('0x12')][_0x521a('0x13')]===0x1f4){logger[_0x521a('0x12')]('Cdr,\x20%s,\x20%s',_0x171fbd,_0x4f9b52[_0x521a('0x12')][_0x521a('0x14')]);return _0x1c9893(_0x4f9b52[_0x521a('0x12')]['message']);}logger[_0x521a('0x12')](_0x521a('0x15'),_0x171fbd,_0x4f9b52[_0x521a('0x12')][_0x521a('0x14')]);return _0x512e03(_0x4f9b52[_0x521a('0x12')][_0x521a('0x14')]);}else{logger[_0x521a('0xe')](_0x521a('0x15'),_0x171fbd,_0x521a('0x16'));_0x512e03(_0x4f9b52['result']['message']);}})[_0x521a('0x17')](function(_0x11a715){logger['error'](_0x521a('0x15'),_0x171fbd,_0x11a715);_0x1c9893(_0x11a715);});});} \ No newline at end of file +var _0xd1c1=['request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','info','Cdr,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd1c1,0x1d5));var _0x1d1c=function(_0xe45118,_0x5dffbc){_0xe45118=_0xe45118-0x0;var _0x15e15d=_0xd1c1[_0xe45118];return _0x15e15d;};'use strict';var _=require(_0x1d1c('0x0'));var util=require(_0x1d1c('0x1'));var moment=require(_0x1d1c('0x2'));var BPromise=require(_0x1d1c('0x3'));var rs=require(_0x1d1c('0x4'));var fs=require('fs');var Redis=require(_0x1d1c('0x5'));var db=require(_0x1d1c('0x6'))['db'];var utils=require(_0x1d1c('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x1d1c('0x8'));var jayson=require(_0x1d1c('0x9'));var client=jayson['client'][_0x1d1c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e3a2e,_0x56a47d,_0xd624a4){return new BPromise(function(_0x18f5ff,_0x1d1395){return client['request'](_0x5e3a2e,_0xd624a4)[_0x1d1c('0xb')](function(_0xd40944){logger[_0x1d1c('0xc')](_0x1d1c('0xd'),_0x56a47d,_0x1d1c('0xe'));logger[_0x1d1c('0xf')](_0x1d1c('0x10'),_0x56a47d,_0x1d1c('0xe'),JSON['stringify'](_0xd40944));if(_0xd40944[_0x1d1c('0x11')]){if(_0xd40944[_0x1d1c('0x11')]['code']===0x1f4){logger[_0x1d1c('0x11')](_0x1d1c('0xd'),_0x56a47d,_0xd40944[_0x1d1c('0x11')]['message']);return _0x1d1395(_0xd40944[_0x1d1c('0x11')]['message']);}logger[_0x1d1c('0x11')](_0x1d1c('0xd'),_0x56a47d,_0xd40944['error'][_0x1d1c('0x12')]);return _0x18f5ff(_0xd40944[_0x1d1c('0x11')][_0x1d1c('0x12')]);}else{logger[_0x1d1c('0xc')]('Cdr,\x20%s,\x20%s',_0x56a47d,_0x1d1c('0xe'));_0x18f5ff(_0xd40944[_0x1d1c('0x13')]['message']);}})[_0x1d1c('0x14')](function(_0x519536){logger['error'](_0x1d1c('0xd'),_0x56a47d,_0x519536);_0x1d1395(_0x519536);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 7a8b630..2b4005d 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x5d0609,_0x127562){var _0xaa3fd1=function(_0x47f457){while(--_0x47f457){_0x5d0609['push'](_0x5d0609['shift']());}};_0xaa3fd1(++_0x127562);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x102ff9,_0x907658){var _0x24fa97=function(_0x3622ff){while(--_0x3622ff){_0x102ff9['push'](_0x102ff9['shift']());}};_0x24fa97(++_0x907658);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 0b5e011..ca5b6c0 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 _0x1fce=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1fce,0x14c));var _0xe1fc=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x1fce[_0x47a349];return _0x18ab75;};'use strict';var Sequelize=require(_0xe1fc('0x0'));module[_0xe1fc('0x1')]={'priority':{'type':Sequelize[_0xe1fc('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe1fc('0x3')],'allowNull':![],'defaultValue':_0xe1fc('0x4')},'appdata':{'type':Sequelize[_0xe1fc('0x5')]()},'description':{'type':Sequelize[_0xe1fc('0x3')]},'interval':{'type':Sequelize[_0xe1fc('0x3')],'defaultValue':_0xe1fc('0x6')}}; \ No newline at end of file +var _0x0e2e=['exports','INTEGER','STRING','noop','TEXT','sequelize'];(function(_0x235573,_0x3433a0){var _0x94cee4=function(_0x4f7166){while(--_0x4f7166){_0x235573['push'](_0x235573['shift']());}};_0x94cee4(++_0x3433a0);}(_0x0e2e,0x1cd));var _0xe0e2=function(_0x1f5463,_0x4c1c48){_0x1f5463=_0x1f5463-0x0;var _0x15739a=_0x0e2e[_0x1f5463];return _0x15739a;};'use strict';var Sequelize=require(_0xe0e2('0x0'));module[_0xe0e2('0x1')]={'priority':{'type':Sequelize[_0xe0e2('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe0e2('0x3')],'allowNull':![],'defaultValue':_0xe0e2('0x4')},'appdata':{'type':Sequelize[_0xe0e2('0x5')]()},'description':{'type':Sequelize[_0xe0e2('0x3')]},'interval':{'type':Sequelize[_0xe0e2('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 22bcd9f..baf3406 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 _0xf9bc=['attributes','length','includeAll','merge','options','find','body','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','send','params','model','ChatApplication','rawAttributes','query','keys','filters','intersection','fields'];(function(_0x471933,_0x3560c5){var _0x56dff8=function(_0x3bae54){while(--_0x3bae54){_0x471933['push'](_0x471933['shift']());}};_0x56dff8(++_0x3560c5);}(_0xf9bc,0x7e));var _0xcf9b=function(_0x1728ca,_0x16c3af){_0x1728ca=_0x1728ca-0x0;var _0x1c99ed=_0xf9bc[_0x1728ca];return _0x1c99ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcf9b('0x0'));var zipdir=require(_0xcf9b('0x1'));var jsonpatch=require(_0xcf9b('0x2'));var rp=require(_0xcf9b('0x3'));var moment=require(_0xcf9b('0x4'));var BPromise=require(_0xcf9b('0x5'));var Mustache=require(_0xcf9b('0x6'));var util=require(_0xcf9b('0x7'));var path=require(_0xcf9b('0x8'));var sox=require(_0xcf9b('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcf9b('0xa'));var _=require(_0xcf9b('0xb'));var squel=require(_0xcf9b('0xc'));var crypto=require(_0xcf9b('0xd'));var jsforce=require(_0xcf9b('0xe'));var deskjs=require(_0xcf9b('0xf'));var toCsv=require(_0xcf9b('0x10'));var querystring=require(_0xcf9b('0x11'));var Papa=require(_0xcf9b('0x12'));var Redis=require('ioredis');var authService=require(_0xcf9b('0x13'));var qs=require(_0xcf9b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcf9b('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xcf9b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xcf9b('0x17'))['db'];function respondWithStatusCode(_0xb74875,_0x4b199a){_0x4b199a=_0x4b199a||0xcc;return function(_0x1033e6){if(_0x1033e6){return _0xb74875[_0xcf9b('0x18')](_0x4b199a);}return _0xb74875[_0xcf9b('0x19')](_0x4b199a)[_0xcf9b('0x1a')]();};}function respondWithResult(_0x2363cb,_0x573748){_0x573748=_0x573748||0xc8;return function(_0x37d3a1){if(_0x37d3a1){return _0x2363cb[_0xcf9b('0x19')](_0x573748)[_0xcf9b('0x1b')](_0x37d3a1);}};}function respondWithFilteredResult(_0x1ee95f,_0x49d7f8){return function(_0x5a61f8){if(_0x5a61f8){var _0x1cb45f=typeof _0x49d7f8[_0xcf9b('0x1c')]===_0xcf9b('0x1d')&&typeof _0x49d7f8[_0xcf9b('0x1e')]===_0xcf9b('0x1d');var _0x1a6531=_0x5a61f8['count'];var _0x1e4017=_0x1cb45f?0x0:_0x49d7f8[_0xcf9b('0x1c')];var _0x4a6a42=_0x1cb45f?_0x5a61f8[_0xcf9b('0x1f')]:_0x49d7f8['offset']+_0x49d7f8[_0xcf9b('0x1e')];var _0x2671d6;if(_0x4a6a42>=_0x1a6531){_0x4a6a42=_0x1a6531;_0x2671d6=0xc8;}else{_0x2671d6=0xce;}_0x1ee95f['status'](_0x2671d6);return _0x1ee95f[_0xcf9b('0x20')]('Content-Range',_0x1e4017+'-'+_0x4a6a42+'/'+_0x1a6531)[_0xcf9b('0x1b')](_0x5a61f8);}return null;};}function patchUpdates(_0x249b02){return function(_0x1adb55){try{jsonpatch[_0xcf9b('0x21')](_0x1adb55,_0x249b02,!![]);}catch(_0x12ebbe){return BPromise[_0xcf9b('0x22')](_0x12ebbe);}return _0x1adb55[_0xcf9b('0x23')]();};}function saveUpdates(_0x44802a,_0x2a20c5){return function(_0x285c99){if(_0x285c99){return _0x285c99[_0xcf9b('0x24')](_0x44802a)[_0xcf9b('0x25')](function(_0x455b5a){return _0x455b5a;});}return null;};}function removeEntity(_0x55c840,_0x14b23c){return function(_0x9ed593){if(_0x9ed593){return _0x9ed593[_0xcf9b('0x26')]()[_0xcf9b('0x25')](function(){_0x55c840[_0xcf9b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x926630,_0x20387b){return function(_0x13ff2a){if(!_0x13ff2a){_0x926630['sendStatus'](0x194);}return _0x13ff2a;};}function handleError(_0x1c22df,_0x45b3c1){_0x45b3c1=_0x45b3c1||0x1f4;return function(_0x166b9d){logger['error'](_0x166b9d[_0xcf9b('0x27')]);if(_0x166b9d[_0xcf9b('0x28')]){delete _0x166b9d[_0xcf9b('0x28')];}_0x1c22df['status'](_0x45b3c1)[_0xcf9b('0x29')](_0x166b9d);};}exports['show']=function(_0xab8e7f,_0x26fea2){var _0x2ff53d={'raw':!![],'where':{'id':_0xab8e7f[_0xcf9b('0x2a')]['id']}},_0x341f8c={};_0x341f8c[_0xcf9b('0x2b')]=_['keys'](db[_0xcf9b('0x2c')][_0xcf9b('0x2d')]);_0x341f8c[_0xcf9b('0x2e')]=_[_0xcf9b('0x2f')](_0xab8e7f[_0xcf9b('0x2e')]);_0x341f8c[_0xcf9b('0x30')]=_[_0xcf9b('0x31')](_0x341f8c[_0xcf9b('0x2b')],_0x341f8c[_0xcf9b('0x2e')]);_0x2ff53d['attributes']=_[_0xcf9b('0x31')](_0x341f8c['model'],qs[_0xcf9b('0x32')](_0xab8e7f[_0xcf9b('0x2e')]['fields']));_0x2ff53d[_0xcf9b('0x33')]=_0x2ff53d[_0xcf9b('0x33')][_0xcf9b('0x34')]?_0x2ff53d[_0xcf9b('0x33')]:_0x341f8c[_0xcf9b('0x2b')];if(_0xab8e7f[_0xcf9b('0x2e')][_0xcf9b('0x35')]){_0x2ff53d['include']=[{'all':!![]}];}_0x2ff53d=_[_0xcf9b('0x36')]({},_0x2ff53d,_0xab8e7f[_0xcf9b('0x37')]);return db[_0xcf9b('0x2c')][_0xcf9b('0x38')](_0x2ff53d)['then'](handleEntityNotFound(_0x26fea2,null))[_0xcf9b('0x25')](respondWithResult(_0x26fea2,null))['catch'](handleError(_0x26fea2,null));};exports[_0xcf9b('0x24')]=function(_0x40d566,_0x19d8fa){if(_0x40d566['body']['id']){delete _0x40d566[_0xcf9b('0x39')]['id'];}return db['ChatApplication'][_0xcf9b('0x38')]({'where':{'id':_0x40d566['params']['id']}})[_0xcf9b('0x25')](handleEntityNotFound(_0x19d8fa,null))[_0xcf9b('0x25')](saveUpdates(_0x40d566[_0xcf9b('0x39')],null))[_0xcf9b('0x25')](respondWithResult(_0x19d8fa,null))[_0xcf9b('0x3a')](handleError(_0x19d8fa,null));};exports[_0xcf9b('0x26')]=function(_0x2e31c6,_0x2c79cd){return db[_0xcf9b('0x2c')][_0xcf9b('0x38')]({'where':{'id':_0x2e31c6[_0xcf9b('0x2a')]['id']}})[_0xcf9b('0x25')](handleEntityNotFound(_0x2c79cd,null))['then'](removeEntity(_0x2c79cd,null))[_0xcf9b('0x3a')](handleError(_0x2c79cd,null));}; \ No newline at end of file +var _0xfa7c=['merge','ChatApplication','catch','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','update','then','destroy','error','stack','name','send','show','params','model','rawAttributes','query','filters','intersection','attributes','fields','includeAll'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xfa7c,0x15b));var _0xcfa7=function(_0x97359,_0x230c12){_0x97359=_0x97359-0x0;var _0x2ee800=_0xfa7c[_0x97359];return _0x2ee800;};'use strict';var emlformat=require(_0xcfa7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcfa7('0x1'));var jsonpatch=require(_0xcfa7('0x2'));var rp=require(_0xcfa7('0x3'));var moment=require(_0xcfa7('0x4'));var BPromise=require(_0xcfa7('0x5'));var Mustache=require(_0xcfa7('0x6'));var util=require(_0xcfa7('0x7'));var path=require(_0xcfa7('0x8'));var sox=require('sox');var csv=require(_0xcfa7('0x9'));var ejs=require(_0xcfa7('0xa'));var fs=require('fs');var fs_extra=require(_0xcfa7('0xb'));var _=require(_0xcfa7('0xc'));var squel=require('squel');var crypto=require(_0xcfa7('0xd'));var jsforce=require(_0xcfa7('0xe'));var deskjs=require(_0xcfa7('0xf'));var toCsv=require(_0xcfa7('0x9'));var querystring=require(_0xcfa7('0x10'));var Papa=require(_0xcfa7('0x11'));var Redis=require('ioredis');var authService=require(_0xcfa7('0x12'));var qs=require(_0xcfa7('0x13'));var as=require(_0xcfa7('0x14'));var hardwareService=require(_0xcfa7('0x15'));var logger=require(_0xcfa7('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xcfa7('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xcfa7('0x18'))['db'];function respondWithStatusCode(_0x18e202,_0x53d0fb){_0x53d0fb=_0x53d0fb||0xcc;return function(_0x299280){if(_0x299280){return _0x18e202[_0xcfa7('0x19')](_0x53d0fb);}return _0x18e202[_0xcfa7('0x1a')](_0x53d0fb)[_0xcfa7('0x1b')]();};}function respondWithResult(_0x2f69ef,_0x578718){_0x578718=_0x578718||0xc8;return function(_0x42500c){if(_0x42500c){return _0x2f69ef['status'](_0x578718)['json'](_0x42500c);}};}function respondWithFilteredResult(_0x465d21,_0x470a55){return function(_0x29cef5){if(_0x29cef5){var _0x349679=typeof _0x470a55[_0xcfa7('0x1c')]==='undefined'&&typeof _0x470a55[_0xcfa7('0x1d')]===_0xcfa7('0x1e');var _0x1236d5=_0x29cef5[_0xcfa7('0x1f')];var _0x4e2a46=_0x349679?0x0:_0x470a55[_0xcfa7('0x1c')];var _0x34f829=_0x349679?_0x29cef5['count']:_0x470a55['offset']+_0x470a55[_0xcfa7('0x1d')];var _0x3f582f;if(_0x34f829>=_0x1236d5){_0x34f829=_0x1236d5;_0x3f582f=0xc8;}else{_0x3f582f=0xce;}_0x465d21[_0xcfa7('0x1a')](_0x3f582f);return _0x465d21[_0xcfa7('0x20')](_0xcfa7('0x21'),_0x4e2a46+'-'+_0x34f829+'/'+_0x1236d5)[_0xcfa7('0x22')](_0x29cef5);}return null;};}function patchUpdates(_0x2312fd){return function(_0x602f15){try{jsonpatch['apply'](_0x602f15,_0x2312fd,!![]);}catch(_0x47519a){return BPromise['reject'](_0x47519a);}return _0x602f15['save']();};}function saveUpdates(_0x5a567d,_0xdf35fa){return function(_0x49e624){if(_0x49e624){return _0x49e624[_0xcfa7('0x23')](_0x5a567d)[_0xcfa7('0x24')](function(_0x3816fb){return _0x3816fb;});}return null;};}function removeEntity(_0x3423ad,_0xdd7c11){return function(_0x2d00e1){if(_0x2d00e1){return _0x2d00e1[_0xcfa7('0x25')]()[_0xcfa7('0x24')](function(){_0x3423ad['status'](0xcc)[_0xcfa7('0x1b')]();});}};}function handleEntityNotFound(_0x222ce2,_0x312efb){return function(_0x1d5e9c){if(!_0x1d5e9c){_0x222ce2['sendStatus'](0x194);}return _0x1d5e9c;};}function handleError(_0x49a904,_0xabfa5b){_0xabfa5b=_0xabfa5b||0x1f4;return function(_0x3fece6){logger[_0xcfa7('0x26')](_0x3fece6[_0xcfa7('0x27')]);if(_0x3fece6['name']){delete _0x3fece6[_0xcfa7('0x28')];}_0x49a904[_0xcfa7('0x1a')](_0xabfa5b)[_0xcfa7('0x29')](_0x3fece6);};}exports[_0xcfa7('0x2a')]=function(_0x5daee2,_0x4c8bf0){var _0x569f4e={'raw':!![],'where':{'id':_0x5daee2[_0xcfa7('0x2b')]['id']}},_0x10f85f={};_0x10f85f[_0xcfa7('0x2c')]=_['keys'](db['ChatApplication'][_0xcfa7('0x2d')]);_0x10f85f['query']=_['keys'](_0x5daee2[_0xcfa7('0x2e')]);_0x10f85f[_0xcfa7('0x2f')]=_[_0xcfa7('0x30')](_0x10f85f[_0xcfa7('0x2c')],_0x10f85f[_0xcfa7('0x2e')]);_0x569f4e[_0xcfa7('0x31')]=_[_0xcfa7('0x30')](_0x10f85f[_0xcfa7('0x2c')],qs['fields'](_0x5daee2['query'][_0xcfa7('0x32')]));_0x569f4e[_0xcfa7('0x31')]=_0x569f4e[_0xcfa7('0x31')]['length']?_0x569f4e['attributes']:_0x10f85f[_0xcfa7('0x2c')];if(_0x5daee2[_0xcfa7('0x2e')][_0xcfa7('0x33')]){_0x569f4e['include']=[{'all':!![]}];}_0x569f4e=_[_0xcfa7('0x34')]({},_0x569f4e,_0x5daee2['options']);return db[_0xcfa7('0x35')]['find'](_0x569f4e)[_0xcfa7('0x24')](handleEntityNotFound(_0x4c8bf0,null))[_0xcfa7('0x24')](respondWithResult(_0x4c8bf0,null))[_0xcfa7('0x36')](handleError(_0x4c8bf0,null));};exports[_0xcfa7('0x23')]=function(_0xb4aa94,_0x23fcca){if(_0xb4aa94[_0xcfa7('0x37')]['id']){delete _0xb4aa94['body']['id'];}return db[_0xcfa7('0x35')][_0xcfa7('0x38')]({'where':{'id':_0xb4aa94[_0xcfa7('0x2b')]['id']}})[_0xcfa7('0x24')](handleEntityNotFound(_0x23fcca,null))[_0xcfa7('0x24')](saveUpdates(_0xb4aa94[_0xcfa7('0x37')],null))[_0xcfa7('0x24')](respondWithResult(_0x23fcca,null))[_0xcfa7('0x36')](handleError(_0x23fcca,null));};exports[_0xcfa7('0x25')]=function(_0x42a16a,_0x4b1507){return db['ChatApplication'][_0xcfa7('0x38')]({'where':{'id':_0x42a16a['params']['id']}})[_0xcfa7('0x24')](handleEntityNotFound(_0x4b1507,null))[_0xcfa7('0x24')](removeEntity(_0x4b1507,null))[_0xcfa7('0x36')](handleError(_0x4b1507,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index f206689..2e6dda5 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 _0xaa3f=['chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication'];(function(_0x12b6a2,_0x321a7b){var _0x31efba=function(_0x5bcf27){while(--_0x5bcf27){_0x12b6a2['push'](_0x12b6a2['shift']());}};_0x31efba(++_0x321a7b);}(_0xaa3f,0x1f3));var _0xfaa3=function(_0x2e9685,_0x9ff127){_0x2e9685=_0x2e9685-0x0;var _0x33bbe6=_0xaa3f[_0x2e9685];return _0x33bbe6;};'use strict';var _=require(_0xfaa3('0x0'));var util=require('util');var logger=require(_0xfaa3('0x1'))(_0xfaa3('0x2'));var moment=require(_0xfaa3('0x3'));var BPromise=require(_0xfaa3('0x4'));var rp=require(_0xfaa3('0x5'));var fs=require('fs');var path=require(_0xfaa3('0x6'));var rimraf=require(_0xfaa3('0x7'));var config=require(_0xfaa3('0x8'));var attributes=require(_0xfaa3('0x9'));module[_0xfaa3('0xa')]=function(_0xe9a86d,_0x46e6b9){return _0xe9a86d[_0xfaa3('0xb')](_0xfaa3('0xc'),attributes,{'tableName':_0xfaa3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfaa3('0xe'),'collate':_0xfaa3('0xf')});}; \ No newline at end of file +var _0xe7b5=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports','ChatApplication','utf8mb4_unicode_ci'];(function(_0xc2214f,_0x28f22f){var _0x3c3900=function(_0x54f1be){while(--_0x54f1be){_0xc2214f['push'](_0xc2214f['shift']());}};_0x3c3900(++_0x28f22f);}(_0xe7b5,0x9a));var _0x5e7b=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xe7b5[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require(_0x5e7b('0x0'));var logger=require(_0x5e7b('0x1'))('api');var moment=require(_0x5e7b('0x2'));var BPromise=require(_0x5e7b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e7b('0x4'));var rimraf=require(_0x5e7b('0x5'));var config=require(_0x5e7b('0x6'));var attributes=require(_0x5e7b('0x7'));module[_0x5e7b('0x8')]=function(_0x22f8e4,_0x151bac){return _0x22f8e4['define'](_0x5e7b('0x9'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x5e7b('0xa')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 98150a3..dd73781 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 _0xafcf=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','catch','lodash','moment','bluebird'];(function(_0x1fdad8,_0x5b080e){var _0x56641b=function(_0x313f45){while(--_0x313f45){_0x1fdad8['push'](_0x1fdad8['shift']());}};_0x56641b(++_0x5b080e);}(_0xafcf,0xb5));var _0xfafc=function(_0x4fac58,_0x213b99){_0x4fac58=_0x4fac58-0x0;var _0x10e5d1=_0xafcf[_0x4fac58];return _0x10e5d1;};'use strict';var _=require(_0xfafc('0x0'));var util=require('util');var moment=require(_0xfafc('0x1'));var BPromise=require(_0xfafc('0x2'));var rs=require(_0xfafc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfafc('0x4'))['db'];var utils=require(_0xfafc('0x5'));var logger=require(_0xfafc('0x6'))(_0xfafc('0x7'));var config=require(_0xfafc('0x8'));var jayson=require(_0xfafc('0x9'));var client=jayson[_0xfafc('0xa')][_0xfafc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d4963,_0x4e2817,_0x34d1bf){return new BPromise(function(_0xa8e3cd,_0xce33f0){return client[_0xfafc('0xc')](_0x3d4963,_0x34d1bf)['then'](function(_0x27e5bb){logger[_0xfafc('0xd')]('ChatApplication,\x20%s,\x20%s',_0x4e2817,_0xfafc('0xe'));logger[_0xfafc('0xf')](_0xfafc('0x10'),_0x4e2817,_0xfafc('0xe'),JSON[_0xfafc('0x11')](_0x27e5bb));if(_0x27e5bb[_0xfafc('0x12')]){if(_0x27e5bb[_0xfafc('0x12')][_0xfafc('0x13')]===0x1f4){logger[_0xfafc('0x12')](_0xfafc('0x14'),_0x4e2817,_0x27e5bb[_0xfafc('0x12')][_0xfafc('0x15')]);return _0xce33f0(_0x27e5bb[_0xfafc('0x12')][_0xfafc('0x15')]);}logger[_0xfafc('0x12')]('ChatApplication,\x20%s,\x20%s',_0x4e2817,_0x27e5bb['error'][_0xfafc('0x15')]);return _0xa8e3cd(_0x27e5bb[_0xfafc('0x12')][_0xfafc('0x15')]);}else{logger[_0xfafc('0xd')](_0xfafc('0x14'),_0x4e2817,_0xfafc('0xe'));_0xa8e3cd(_0x27e5bb['result'][_0xfafc('0x15')]);}})[_0xfafc('0x16')](function(_0x11b56d){logger['error']('ChatApplication,\x20%s,\x20%s',_0x4e2817,_0x11b56d);_0xce33f0(_0x11b56d);});});} \ No newline at end of file +var _0x622b=['moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x4117bf,_0x5cb3de){var _0x4e3d7b=function(_0xdd2260){while(--_0xdd2260){_0x4117bf['push'](_0x4117bf['shift']());}};_0x4e3d7b(++_0x5cb3de);}(_0x622b,0x168));var _0xb622=function(_0x29f1b5,_0x19ac42){_0x29f1b5=_0x29f1b5-0x0;var _0x5bcfbd=_0x622b[_0x29f1b5];return _0x5bcfbd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb622('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb622('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xb622('0x2'));var logger=require('../../config/logger')(_0xb622('0x3'));var config=require(_0xb622('0x4'));var jayson=require(_0xb622('0x5'));var client=jayson[_0xb622('0x6')][_0xb622('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2ce1e4,_0x173f7c,_0x8158b){return new BPromise(function(_0x4dea4d,_0x4f21b6){return client[_0xb622('0x8')](_0x2ce1e4,_0x8158b)[_0xb622('0x9')](function(_0x49b4a7){logger[_0xb622('0xa')](_0xb622('0xb'),_0x173f7c,_0xb622('0xc'));logger[_0xb622('0xd')](_0xb622('0xe'),_0x173f7c,_0xb622('0xc'),JSON[_0xb622('0xf')](_0x49b4a7));if(_0x49b4a7[_0xb622('0x10')]){if(_0x49b4a7[_0xb622('0x10')]['code']===0x1f4){logger['error'](_0xb622('0xb'),_0x173f7c,_0x49b4a7['error'][_0xb622('0x11')]);return _0x4f21b6(_0x49b4a7[_0xb622('0x10')][_0xb622('0x11')]);}logger[_0xb622('0x10')](_0xb622('0xb'),_0x173f7c,_0x49b4a7[_0xb622('0x10')][_0xb622('0x11')]);return _0x4dea4d(_0x49b4a7[_0xb622('0x10')][_0xb622('0x11')]);}else{logger[_0xb622('0xa')]('ChatApplication,\x20%s,\x20%s',_0x173f7c,'request\x20sent');_0x4dea4d(_0x49b4a7[_0xb622('0x12')]['message']);}})[_0xb622('0x13')](function(_0x319d12){logger[_0xb622('0x10')](_0xb622('0xb'),_0x173f7c,_0x319d12);_0x4f21b6(_0x319d12);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index afcb59f..6c7290a 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 _0x6fe4=['isAuthenticated','show','put','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','/:id'];(function(_0x4c44a3,_0x144371){var _0x2b434c=function(_0x43da93){while(--_0x43da93){_0x4c44a3['push'](_0x4c44a3['shift']());}};_0x2b434c(++_0x144371);}(_0x6fe4,0x1a5));var _0x46fe=function(_0x31a19f,_0x2a685c){_0x31a19f=_0x31a19f-0x0;var _0x3c39aa=_0x6fe4[_0x31a19f];return _0x3c39aa;};'use strict';var multer=require(_0x46fe('0x0'));var util=require(_0x46fe('0x1'));var path=require(_0x46fe('0x2'));var timeout=require('connect-timeout');var express=require(_0x46fe('0x3'));var router=express[_0x46fe('0x4')]();var fs_extra=require(_0x46fe('0x5'));var auth=require(_0x46fe('0x6'));var interaction=require(_0x46fe('0x7'));var config=require('../../config/environment');var controller=require(_0x46fe('0x8'));router[_0x46fe('0x9')](_0x46fe('0xa'),auth[_0x46fe('0xb')](),controller[_0x46fe('0xc')]);router[_0x46fe('0xd')](_0x46fe('0xa'),auth[_0x46fe('0xb')](),controller['update']);router[_0x46fe('0xe')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x46fe('0xf')]=router; \ No newline at end of file +var _0x32e4=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','update','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0xe70f6c,_0x3b734d){var _0x29d959=function(_0x37c8d9){while(--_0x37c8d9){_0xe70f6c['push'](_0xe70f6c['shift']());}};_0x29d959(++_0x3b734d);}(_0x32e4,0xeb));var _0x432e=function(_0x5e7514,_0x30c2e1){_0x5e7514=_0x5e7514-0x0;var _0x12f472=_0x32e4[_0x5e7514];return _0x12f472;};'use strict';var multer=require(_0x432e('0x0'));var util=require(_0x432e('0x1'));var path=require('path');var timeout=require(_0x432e('0x2'));var express=require(_0x432e('0x3'));var router=express[_0x432e('0x4')]();var fs_extra=require(_0x432e('0x5'));var auth=require(_0x432e('0x6'));var interaction=require(_0x432e('0x7'));var config=require(_0x432e('0x8'));var controller=require('./chatApplication.controller');router[_0x432e('0x9')](_0x432e('0xa'),auth[_0x432e('0xb')](),controller['show']);router['put'](_0x432e('0xa'),auth[_0x432e('0xb')](),controller[_0x432e('0xc')]);router['delete']('/:id',auth[_0x432e('0xb')](),controller[_0x432e('0xd')]);module[_0x432e('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 105b938..0c02231 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 _0x0e26=['sequelize','exports','BOOLEAN'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0e26,0x12c));var _0x60e2=function(_0x3754ec,_0x2727cd){_0x3754ec=_0x3754ec-0x0;var _0x2bfc0f=_0x0e26[_0x3754ec];return _0x2bfc0f;};'use strict';var Sequelize=require(_0x60e2('0x0'));module[_0x60e2('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x60e2('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7b92=['STRING','sequelize'];(function(_0x4f9729,_0xa36102){var _0x3bbab0=function(_0x59fef8){while(--_0x59fef8){_0x4f9729['push'](_0x4f9729['shift']());}};_0x3bbab0(++_0xa36102);}(_0x7b92,0x1e3));var _0x27b9=function(_0x1a809b,_0x4c15e3){_0x1a809b=_0x1a809b-0x0;var _0x5d90e6=_0x7b92[_0x1a809b];return _0x5d90e6;};'use strict';var Sequelize=require(_0x27b9('0x0'));module['exports']={'name':{'type':Sequelize[_0x27b9('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x27b9('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 899c6ef..9a1f6f1 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 _0xbd35=['length','hasOwnProperty','nolimit','order','sort','pick','where','filter','merge','options','includeAll','include','findAll','rows','params','find','catch','create','body','destroy','describe','ChatInternalMessage','user','toInteger','addMembers','ids','getMembers','findOne','rawAttributes','removeMembers','getMessages','$gte','split','format','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','stack','send','map','ChatGroup','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','fields'];(function(_0xbb6254,_0x2778a1){var _0x2cb864=function(_0x1c7813){while(--_0x1c7813){_0xbb6254['push'](_0xbb6254['shift']());}};_0x2cb864(++_0x2778a1);}(_0xbd35,0x196));var _0x5bd3=function(_0x42ac4d,_0x387c90){_0x42ac4d=_0x42ac4d-0x0;var _0x4a6e46=_0xbd35[_0x42ac4d];return _0x4a6e46;};'use strict';var emlformat=require(_0x5bd3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5bd3('0x1'));var jsonpatch=require(_0x5bd3('0x2'));var rp=require(_0x5bd3('0x3'));var moment=require('moment');var BPromise=require(_0x5bd3('0x4'));var Mustache=require(_0x5bd3('0x5'));var util=require(_0x5bd3('0x6'));var path=require(_0x5bd3('0x7'));var sox=require(_0x5bd3('0x8'));var csv=require(_0x5bd3('0x9'));var ejs=require(_0x5bd3('0xa'));var fs=require('fs');var fs_extra=require(_0x5bd3('0xb'));var _=require(_0x5bd3('0xc'));var squel=require('squel');var crypto=require(_0x5bd3('0xd'));var jsforce=require(_0x5bd3('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5bd3('0x9'));var querystring=require('querystring');var Papa=require(_0x5bd3('0xf'));var Redis=require(_0x5bd3('0x10'));var authService=require(_0x5bd3('0x11'));var qs=require(_0x5bd3('0x12'));var as=require(_0x5bd3('0x13'));var hardwareService=require(_0x5bd3('0x14'));var logger=require(_0x5bd3('0x15'))(_0x5bd3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5bd3('0x17'));var db=require('../../mysqldb')['db'];config[_0x5bd3('0x18')]=_[_0x5bd3('0x19')](config[_0x5bd3('0x18')],{'host':_0x5bd3('0x1a'),'port':0x18eb});var socket=require(_0x5bd3('0x1b'))(new Redis(config[_0x5bd3('0x18')]));require(_0x5bd3('0x1c'))['register'](socket);function respondWithStatusCode(_0x238cec,_0x36f34e){_0x36f34e=_0x36f34e||0xcc;return function(_0x5d6988){if(_0x5d6988){return _0x238cec[_0x5bd3('0x1d')](_0x36f34e);}return _0x238cec[_0x5bd3('0x1e')](_0x36f34e)[_0x5bd3('0x1f')]();};}function respondWithResult(_0xefd17a,_0x4f0f2f){_0x4f0f2f=_0x4f0f2f||0xc8;return function(_0x522c7e){if(_0x522c7e){return _0xefd17a[_0x5bd3('0x1e')](_0x4f0f2f)[_0x5bd3('0x20')](_0x522c7e);}};}function respondWithFilteredResult(_0x1a70a1,_0x31b6bd){return function(_0x4163dc){if(_0x4163dc){var _0x4ff7c1=typeof _0x31b6bd['offset']===_0x5bd3('0x21')&&typeof _0x31b6bd[_0x5bd3('0x22')]===_0x5bd3('0x21');var _0x8e4652=_0x4163dc['count'];var _0x5e7706=_0x4ff7c1?0x0:_0x31b6bd[_0x5bd3('0x23')];var _0x51956b=_0x4ff7c1?_0x4163dc[_0x5bd3('0x24')]:_0x31b6bd[_0x5bd3('0x23')]+_0x31b6bd['limit'];var _0x8ba5b0;if(_0x51956b>=_0x8e4652){_0x51956b=_0x8e4652;_0x8ba5b0=0xc8;}else{_0x8ba5b0=0xce;}_0x1a70a1[_0x5bd3('0x1e')](_0x8ba5b0);return _0x1a70a1[_0x5bd3('0x25')](_0x5bd3('0x26'),_0x5e7706+'-'+_0x51956b+'/'+_0x8e4652)['json'](_0x4163dc);}return null;};}function patchUpdates(_0x1e8f8d){return function(_0x1b7b19){try{jsonpatch[_0x5bd3('0x27')](_0x1b7b19,_0x1e8f8d,!![]);}catch(_0x3b2cae){return BPromise[_0x5bd3('0x28')](_0x3b2cae);}return _0x1b7b19[_0x5bd3('0x29')]();};}function saveUpdates(_0x47bc22,_0x52ddfa){return function(_0x1b03e2){if(_0x1b03e2){return _0x1b03e2[_0x5bd3('0x2a')](_0x47bc22)[_0x5bd3('0x2b')](function(_0x5eaf7d){return _0x5eaf7d;});}return null;};}function removeEntity(_0x44f05b,_0x40f4c0){return function(_0x250937){if(_0x250937){return _0x250937['destroy']()[_0x5bd3('0x2b')](function(){_0x44f05b[_0x5bd3('0x1e')](0xcc)[_0x5bd3('0x1f')]();});}};}function handleEntityNotFound(_0x54852d,_0x1ab3ae){return function(_0x2e0d32){if(!_0x2e0d32){_0x54852d['sendStatus'](0x194);}return _0x2e0d32;};}function handleError(_0xe40bfe,_0x1a99d7){_0x1a99d7=_0x1a99d7||0x1f4;return function(_0x1adcb9){logger['error'](_0x1adcb9[_0x5bd3('0x2c')]);if(_0x1adcb9['name']){delete _0x1adcb9['name'];}_0xe40bfe[_0x5bd3('0x1e')](_0x1a99d7)[_0x5bd3('0x2d')](_0x1adcb9);};}exports['index']=function(_0xa5013a,_0x2a219d){var _0x34a2f7={},_0x4146d4={},_0xe77783={'count':0x0,'rows':[]};var _0x59ab00=_[_0x5bd3('0x2e')](db[_0x5bd3('0x2f')]['rawAttributes'],function(_0x99b300){return{'name':_0x99b300[_0x5bd3('0x30')],'type':_0x99b300[_0x5bd3('0x31')][_0x5bd3('0x32')]};});_0x4146d4[_0x5bd3('0x33')]=_['map'](_0x59ab00,_0x5bd3('0x34'));_0x4146d4['query']=_[_0x5bd3('0x35')](_0xa5013a[_0x5bd3('0x36')]);_0x4146d4[_0x5bd3('0x37')]=_[_0x5bd3('0x38')](_0x4146d4[_0x5bd3('0x33')],_0x4146d4[_0x5bd3('0x36')]);_0x34a2f7[_0x5bd3('0x39')]=_[_0x5bd3('0x38')](_0x4146d4[_0x5bd3('0x33')],qs[_0x5bd3('0x3a')](_0xa5013a[_0x5bd3('0x36')][_0x5bd3('0x3a')]));_0x34a2f7[_0x5bd3('0x39')]=_0x34a2f7['attributes'][_0x5bd3('0x3b')]?_0x34a2f7['attributes']:_0x4146d4[_0x5bd3('0x33')];if(!_0xa5013a[_0x5bd3('0x36')][_0x5bd3('0x3c')](_0x5bd3('0x3d'))){_0x34a2f7[_0x5bd3('0x22')]=qs['limit'](_0xa5013a[_0x5bd3('0x36')][_0x5bd3('0x22')]);_0x34a2f7[_0x5bd3('0x23')]=qs[_0x5bd3('0x23')](_0xa5013a[_0x5bd3('0x36')][_0x5bd3('0x23')]);}_0x34a2f7[_0x5bd3('0x3e')]=qs['sort'](_0xa5013a[_0x5bd3('0x36')][_0x5bd3('0x3f')]);_0x34a2f7['where']=qs[_0x5bd3('0x37')](_[_0x5bd3('0x40')](_0xa5013a[_0x5bd3('0x36')],_0x4146d4[_0x5bd3('0x37')]),_0x59ab00);if(_0xa5013a[_0x5bd3('0x36')]['filter']){_0x34a2f7['where']=_['merge'](_0x34a2f7[_0x5bd3('0x41')],{'$or':_['map'](_0x59ab00,function(_0x401f0f){if(_0x401f0f['type']!=='VIRTUAL'){var _0x3b4193={};_0x3b4193[_0x401f0f[_0x5bd3('0x34')]]={'$like':'%'+_0xa5013a['query'][_0x5bd3('0x42')]+'%'};return _0x3b4193;}})});}_0x34a2f7=_[_0x5bd3('0x43')]({},_0x34a2f7,_0xa5013a[_0x5bd3('0x44')]);var _0x3d7ab8={'where':_0x34a2f7[_0x5bd3('0x41')]};return db[_0x5bd3('0x2f')][_0x5bd3('0x24')](_0x3d7ab8)[_0x5bd3('0x2b')](function(_0x50ce2f){_0xe77783[_0x5bd3('0x24')]=_0x50ce2f;if(_0xa5013a['query'][_0x5bd3('0x45')]){_0x34a2f7[_0x5bd3('0x46')]=[{'all':!![]}];}return db[_0x5bd3('0x2f')][_0x5bd3('0x47')](_0x34a2f7);})[_0x5bd3('0x2b')](function(_0x197e45){_0xe77783[_0x5bd3('0x48')]=_0x197e45;return _0xe77783;})[_0x5bd3('0x2b')](respondWithFilteredResult(_0x2a219d,_0x34a2f7))['catch'](handleError(_0x2a219d,null));};exports['show']=function(_0x39ee19,_0x781d52){var _0x3e05ef={'raw':!![],'where':{'id':_0x39ee19[_0x5bd3('0x49')]['id']}},_0x982d9c={};_0x982d9c[_0x5bd3('0x33')]=_[_0x5bd3('0x35')](db[_0x5bd3('0x2f')]['rawAttributes']);_0x982d9c[_0x5bd3('0x36')]=_['keys'](_0x39ee19[_0x5bd3('0x36')]);_0x982d9c[_0x5bd3('0x37')]=_[_0x5bd3('0x38')](_0x982d9c['model'],_0x982d9c[_0x5bd3('0x36')]);_0x3e05ef[_0x5bd3('0x39')]=_[_0x5bd3('0x38')](_0x982d9c[_0x5bd3('0x33')],qs[_0x5bd3('0x3a')](_0x39ee19[_0x5bd3('0x36')][_0x5bd3('0x3a')]));_0x3e05ef['attributes']=_0x3e05ef['attributes']['length']?_0x3e05ef[_0x5bd3('0x39')]:_0x982d9c['model'];if(_0x39ee19[_0x5bd3('0x36')][_0x5bd3('0x45')]){_0x3e05ef[_0x5bd3('0x46')]=[{'all':!![]}];}_0x3e05ef=_[_0x5bd3('0x43')]({},_0x3e05ef,_0x39ee19[_0x5bd3('0x44')]);return db[_0x5bd3('0x2f')][_0x5bd3('0x4a')](_0x3e05ef)[_0x5bd3('0x2b')](handleEntityNotFound(_0x781d52,null))['then'](respondWithResult(_0x781d52,null))[_0x5bd3('0x4b')](handleError(_0x781d52,null));};exports['create']=function(_0x2a0136,_0x4bad28){return db[_0x5bd3('0x2f')][_0x5bd3('0x4c')](_0x2a0136[_0x5bd3('0x4d')],{})[_0x5bd3('0x2b')](respondWithResult(_0x4bad28,0xc9))['catch'](handleError(_0x4bad28,null));};exports[_0x5bd3('0x2a')]=function(_0x1822f1,_0x7ec13f){if(_0x1822f1[_0x5bd3('0x4d')]['id']){delete _0x1822f1['body']['id'];}return db[_0x5bd3('0x2f')][_0x5bd3('0x4a')]({'where':{'id':_0x1822f1[_0x5bd3('0x49')]['id']}})['then'](handleEntityNotFound(_0x7ec13f,null))[_0x5bd3('0x2b')](saveUpdates(_0x1822f1[_0x5bd3('0x4d')],null))[_0x5bd3('0x2b')](respondWithResult(_0x7ec13f,null))[_0x5bd3('0x4b')](handleError(_0x7ec13f,null));};exports[_0x5bd3('0x4e')]=function(_0x7f77f2,_0x2b12a1){return db[_0x5bd3('0x2f')][_0x5bd3('0x4a')]({'where':{'id':_0x7f77f2[_0x5bd3('0x49')]['id']}})['then'](handleEntityNotFound(_0x2b12a1,null))['then'](removeEntity(_0x2b12a1,null))[_0x5bd3('0x4b')](handleError(_0x2b12a1,null));};exports[_0x5bd3('0x4f')]=function(_0x3e9f89,_0x1a50c2){return db['ChatGroup'][_0x5bd3('0x4f')]()['then'](respondWithResult(_0x1a50c2,null))[_0x5bd3('0x4b')](handleError(_0x1a50c2,null));};exports['getUnread']=function(_0x355a6b,_0x18c29f,_0x79f9ed){return db[_0x5bd3('0x50')][_0x5bd3('0x24')]({'where':{'ChatGroupId':_0x355a6b[_0x5bd3('0x49')]['id'],'ToId':_0x355a6b[_0x5bd3('0x51')]['id'],'read':![]}})[_0x5bd3('0x2b')](function(_0x555d32){return{'id':_[_0x5bd3('0x52')](_0x355a6b[_0x5bd3('0x49')]['id']),'count':_0x555d32};})[_0x5bd3('0x2b')](respondWithResult(_0x18c29f,null))[_0x5bd3('0x4b')](handleError(_0x18c29f,null));};exports[_0x5bd3('0x53')]=function(_0x5b1826,_0x13d823,_0x386553){return db[_0x5bd3('0x2f')][_0x5bd3('0x4a')]({'where':{'id':_0x5b1826[_0x5bd3('0x49')]['id']}})[_0x5bd3('0x2b')](handleEntityNotFound(_0x13d823,null))[_0x5bd3('0x2b')](function(_0x40f4ce){if(_0x40f4ce){return _0x40f4ce['addMembers'](_0x5b1826['body'][_0x5bd3('0x54')],_['omit'](_0x5b1826[_0x5bd3('0x4d')],[_0x5bd3('0x54'),'id'])||{});}})[_0x5bd3('0x2b')](respondWithResult(_0x13d823,null))[_0x5bd3('0x4b')](handleError(_0x13d823,null));};exports[_0x5bd3('0x55')]=function(_0x24a1a4,_0x356994,_0x75c6c){var _0x228554={};var _0x498ac8={};var _0x37d9e0;var _0x3cec81;return db[_0x5bd3('0x2f')][_0x5bd3('0x56')]({'where':{'id':_0x24a1a4[_0x5bd3('0x49')]['id']}})[_0x5bd3('0x2b')](handleEntityNotFound(_0x356994,null))['then'](function(_0x27cee1){if(_0x27cee1){_0x37d9e0=_0x27cee1;_0x498ac8[_0x5bd3('0x33')]=_['keys'](db['User'][_0x5bd3('0x57')]);_0x498ac8[_0x5bd3('0x36')]=_['keys'](_0x24a1a4[_0x5bd3('0x36')]);_0x498ac8[_0x5bd3('0x37')]=_[_0x5bd3('0x38')](_0x498ac8['model'],_0x498ac8['query']);_0x228554[_0x5bd3('0x39')]=_[_0x5bd3('0x38')](_0x498ac8[_0x5bd3('0x33')],qs['fields'](_0x24a1a4[_0x5bd3('0x36')][_0x5bd3('0x3a')]));_0x228554[_0x5bd3('0x39')]=_0x228554[_0x5bd3('0x39')][_0x5bd3('0x3b')]?_0x228554[_0x5bd3('0x39')]:_0x498ac8[_0x5bd3('0x33')];_0x228554[_0x5bd3('0x3e')]=qs[_0x5bd3('0x3f')](_0x24a1a4[_0x5bd3('0x36')][_0x5bd3('0x3f')]);_0x228554['where']=qs['filters'](_[_0x5bd3('0x40')](_0x24a1a4[_0x5bd3('0x36')],_0x498ac8[_0x5bd3('0x37')]));if(_0x24a1a4[_0x5bd3('0x36')][_0x5bd3('0x42')]){_0x228554[_0x5bd3('0x41')]=_['merge'](_0x228554[_0x5bd3('0x41')],{'$or':_[_0x5bd3('0x2e')](_0x228554['attributes'],function(_0x26c12e){var _0x2aee4a={};_0x2aee4a[_0x26c12e]={'$like':'%'+_0x24a1a4['query'][_0x5bd3('0x42')]+'%'};return _0x2aee4a;})});}_0x228554=_['merge']({},_0x228554,_0x24a1a4[_0x5bd3('0x44')]);return _0x37d9e0[_0x5bd3('0x55')](_0x228554);}})[_0x5bd3('0x2b')](function(_0x59ff0d){if(_0x59ff0d){_0x3cec81=_0x59ff0d[_0x5bd3('0x3b')];if(!_0x24a1a4['query'][_0x5bd3('0x3c')](_0x5bd3('0x3d'))){_0x228554[_0x5bd3('0x22')]=qs[_0x5bd3('0x22')](_0x24a1a4[_0x5bd3('0x36')][_0x5bd3('0x22')]);_0x228554[_0x5bd3('0x23')]=qs[_0x5bd3('0x23')](_0x24a1a4[_0x5bd3('0x36')]['offset']);}return _0x37d9e0['getMembers'](_0x228554);}})[_0x5bd3('0x2b')](function(_0x1293e7){if(_0x1293e7){return _0x1293e7?{'count':_0x3cec81,'rows':_0x1293e7}:null;}})[_0x5bd3('0x2b')](respondWithResult(_0x356994,null))[_0x5bd3('0x4b')](handleError(_0x356994,null));};exports[_0x5bd3('0x58')]=function(_0x4db53e,_0x38f45c,_0x43e3c2){return db['ChatGroup'][_0x5bd3('0x4a')]({'where':{'id':_0x4db53e[_0x5bd3('0x49')]['id']}})[_0x5bd3('0x2b')](handleEntityNotFound(_0x38f45c,null))[_0x5bd3('0x2b')](function(_0x5a498f){if(_0x5a498f){return _0x5a498f['removeMembers'](_0x4db53e[_0x5bd3('0x36')][_0x5bd3('0x54')]);}})[_0x5bd3('0x2b')](respondWithStatusCode(_0x38f45c,null))[_0x5bd3('0x4b')](handleError(_0x38f45c,null));};exports['addMessage']=function(_0x2a7c6d,_0x5f44e4,_0x231afc){if(_0x2a7c6d['body']['id']){delete _0x2a7c6d['body']['id'];}return db[_0x5bd3('0x2f')][_0x5bd3('0x4a')]({'where':{'id':_0x2a7c6d['params']['id']}})[_0x5bd3('0x2b')](handleEntityNotFound(_0x5f44e4,null))[_0x5bd3('0x2b')](function(_0xb4f025){if(_0xb4f025){_0x2a7c6d[_0x5bd3('0x4d')]['ChatGroupId']=_0xb4f025['id'];return db[_0x5bd3('0x50')][_0x5bd3('0x4c')](_0x2a7c6d[_0x5bd3('0x4d')]);}})[_0x5bd3('0x2b')](respondWithResult(_0x5f44e4,null))[_0x5bd3('0x4b')](handleError(_0x5f44e4,null));};exports[_0x5bd3('0x59')]=function(_0x367f48,_0x42131b,_0x447657){var _0x325de7={};var _0x4d6e71={};var _0x1606de;var _0x58b347;return db[_0x5bd3('0x2f')][_0x5bd3('0x56')]({'where':{'id':_0x367f48[_0x5bd3('0x49')]['id']}})[_0x5bd3('0x2b')](handleEntityNotFound(_0x42131b,null))[_0x5bd3('0x2b')](function(_0x203936){if(_0x203936){_0x1606de=_0x203936;_0x4d6e71[_0x5bd3('0x33')]=_[_0x5bd3('0x35')](db[_0x5bd3('0x50')][_0x5bd3('0x57')]);_0x4d6e71['query']=_[_0x5bd3('0x35')](_0x367f48[_0x5bd3('0x36')]);_0x4d6e71[_0x5bd3('0x37')]=_[_0x5bd3('0x38')](_0x4d6e71[_0x5bd3('0x33')],_0x4d6e71[_0x5bd3('0x36')]);_0x325de7[_0x5bd3('0x39')]=_[_0x5bd3('0x38')](_0x4d6e71['model'],qs[_0x5bd3('0x3a')](_0x367f48[_0x5bd3('0x36')][_0x5bd3('0x3a')]));_0x325de7['attributes']=_0x325de7[_0x5bd3('0x39')][_0x5bd3('0x3b')]?_0x325de7['attributes']:_0x4d6e71[_0x5bd3('0x33')];_0x325de7[_0x5bd3('0x3e')]=qs[_0x5bd3('0x3f')](_0x367f48[_0x5bd3('0x36')]['sort']);_0x325de7[_0x5bd3('0x41')]=qs[_0x5bd3('0x37')](_[_0x5bd3('0x40')](_0x367f48['query'],_0x4d6e71['filters']));if(_0x367f48[_0x5bd3('0x36')][_0x5bd3('0x42')]){_0x325de7[_0x5bd3('0x41')]=_[_0x5bd3('0x43')](_0x325de7[_0x5bd3('0x41')],{'$or':_['map'](_0x325de7['attributes'],function(_0x1e9535){var _0x355f2e={};_0x355f2e[_0x1e9535]={'$like':'%'+_0x367f48['query'][_0x5bd3('0x42')]+'%'};return _0x355f2e;})});}if(_0x367f48[_0x5bd3('0x36')][_0x5bd3('0x5a')]){var _0x8641d1=_0x367f48[_0x5bd3('0x36')][_0x5bd3('0x5a')][_0x5bd3('0x5b')](',');var _0x126968={};_0x126968[_0x8641d1[0x0]]={'$gte':moment(_0x8641d1[0x1])[_0x5bd3('0x5c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x325de7[_0x5bd3('0x41')]=_[_0x5bd3('0x43')](_0x325de7[_0x5bd3('0x41')],_0x126968);}_0x325de7=_['merge']({},_0x325de7,_0x367f48['options']);return _0x1606de[_0x5bd3('0x59')](_0x325de7);}})[_0x5bd3('0x2b')](function(_0x1b7aaa){if(_0x1b7aaa){_0x58b347=_0x1b7aaa['length'];if(!_0x367f48[_0x5bd3('0x36')][_0x5bd3('0x3c')]('nolimit')){_0x325de7[_0x5bd3('0x22')]=qs['limit'](_0x367f48[_0x5bd3('0x36')][_0x5bd3('0x22')]);_0x325de7[_0x5bd3('0x23')]=qs[_0x5bd3('0x23')](_0x367f48[_0x5bd3('0x36')][_0x5bd3('0x23')]);}return _0x1606de[_0x5bd3('0x59')](_0x325de7);}})['then'](function(_0x57352a){if(_0x57352a){return _0x57352a?{'count':_0x58b347,'rows':_0x57352a}:null;}})[_0x5bd3('0x2b')](respondWithResult(_0x42131b,null))[_0x5bd3('0x4b')](handleError(_0x42131b,null));}; \ No newline at end of file +var _0xa1b6=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./chatGroup.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','ChatGroup','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','rawAttributes','include','find','update','body','params','describe','getUnread','toInteger','ids','getMembers','findOne','User','removeMembers','addMessage','ChatGroupId','create','order','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x1b0278,_0x2d8d04){var _0x25584f=function(_0x5b5576){while(--_0x5b5576){_0x1b0278['push'](_0x1b0278['shift']());}};_0x25584f(++_0x2d8d04);}(_0xa1b6,0x176));var _0x6a1b=function(_0x33a620,_0x57def8){_0x33a620=_0x33a620-0x0;var _0x16d9bf=_0xa1b6[_0x33a620];return _0x16d9bf;};'use strict';var emlformat=require(_0x6a1b('0x0'));var rimraf=require(_0x6a1b('0x1'));var zipdir=require(_0x6a1b('0x2'));var jsonpatch=require(_0x6a1b('0x3'));var rp=require(_0x6a1b('0x4'));var moment=require(_0x6a1b('0x5'));var BPromise=require(_0x6a1b('0x6'));var Mustache=require(_0x6a1b('0x7'));var util=require('util');var path=require(_0x6a1b('0x8'));var sox=require(_0x6a1b('0x9'));var csv=require('to-csv');var ejs=require(_0x6a1b('0xa'));var fs=require('fs');var fs_extra=require(_0x6a1b('0xb'));var _=require(_0x6a1b('0xc'));var squel=require(_0x6a1b('0xd'));var crypto=require(_0x6a1b('0xe'));var jsforce=require(_0x6a1b('0xf'));var deskjs=require(_0x6a1b('0x10'));var toCsv=require(_0x6a1b('0x11'));var querystring=require('querystring');var Papa=require(_0x6a1b('0x12'));var Redis=require(_0x6a1b('0x13'));var authService=require(_0x6a1b('0x14'));var qs=require(_0x6a1b('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6a1b('0x16'));var logger=require(_0x6a1b('0x17'))('api');var utils=require(_0x6a1b('0x18'));var config=require(_0x6a1b('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x6a1b('0x1a'))['db'];config['redis']=_[_0x6a1b('0x1b')](config[_0x6a1b('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x6a1b('0x1d'))(new Redis(config[_0x6a1b('0x1c')]));require(_0x6a1b('0x1e'))['register'](socket);function respondWithStatusCode(_0x310f73,_0x26b714){_0x26b714=_0x26b714||0xcc;return function(_0x29ad39){if(_0x29ad39){return _0x310f73[_0x6a1b('0x1f')](_0x26b714);}return _0x310f73[_0x6a1b('0x20')](_0x26b714)[_0x6a1b('0x21')]();};}function respondWithResult(_0xeafd1d,_0x385dde){_0x385dde=_0x385dde||0xc8;return function(_0x276c71){if(_0x276c71){return _0xeafd1d[_0x6a1b('0x20')](_0x385dde)['json'](_0x276c71);}};}function respondWithFilteredResult(_0x2b6fc8,_0x8ccd7e){return function(_0x4d849d){if(_0x4d849d){var _0x793190=typeof _0x8ccd7e[_0x6a1b('0x22')]===_0x6a1b('0x23')&&typeof _0x8ccd7e[_0x6a1b('0x24')]===_0x6a1b('0x23');var _0x424c2c=_0x4d849d[_0x6a1b('0x25')];var _0x1ba3d4=_0x793190?0x0:_0x8ccd7e[_0x6a1b('0x22')];var _0x1256a3=_0x793190?_0x4d849d[_0x6a1b('0x25')]:_0x8ccd7e['offset']+_0x8ccd7e[_0x6a1b('0x24')];var _0x4b805f;if(_0x1256a3>=_0x424c2c){_0x1256a3=_0x424c2c;_0x4b805f=0xc8;}else{_0x4b805f=0xce;}_0x2b6fc8[_0x6a1b('0x20')](_0x4b805f);return _0x2b6fc8[_0x6a1b('0x26')](_0x6a1b('0x27'),_0x1ba3d4+'-'+_0x1256a3+'/'+_0x424c2c)['json'](_0x4d849d);}return null;};}function patchUpdates(_0x1510d4){return function(_0x434bbe){try{jsonpatch[_0x6a1b('0x28')](_0x434bbe,_0x1510d4,!![]);}catch(_0x2e180f){return BPromise[_0x6a1b('0x29')](_0x2e180f);}return _0x434bbe[_0x6a1b('0x2a')]();};}function saveUpdates(_0x20c3f5,_0x508c35){return function(_0x36a309){if(_0x36a309){return _0x36a309['update'](_0x20c3f5)[_0x6a1b('0x2b')](function(_0x6cc19){return _0x6cc19;});}return null;};}function removeEntity(_0x23cc56,_0x101153){return function(_0x1fef7c){if(_0x1fef7c){return _0x1fef7c[_0x6a1b('0x2c')]()[_0x6a1b('0x2b')](function(){_0x23cc56[_0x6a1b('0x20')](0xcc)[_0x6a1b('0x21')]();});}};}function handleEntityNotFound(_0x482e6d,_0x43eed9){return function(_0x6f18cc){if(!_0x6f18cc){_0x482e6d['sendStatus'](0x194);}return _0x6f18cc;};}function handleError(_0x38b8eb,_0x239f9f){_0x239f9f=_0x239f9f||0x1f4;return function(_0x572a78){logger[_0x6a1b('0x2d')](_0x572a78[_0x6a1b('0x2e')]);if(_0x572a78[_0x6a1b('0x2f')]){delete _0x572a78['name'];}_0x38b8eb[_0x6a1b('0x20')](_0x239f9f)[_0x6a1b('0x30')](_0x572a78);};}exports[_0x6a1b('0x31')]=function(_0x35a842,_0x108831){var _0x3af34b={},_0x42804d={},_0x29fbaf={'count':0x0,'rows':[]};var _0x42d250=_['map'](db[_0x6a1b('0x32')]['rawAttributes'],function(_0x46a09c){return{'name':_0x46a09c[_0x6a1b('0x33')],'type':_0x46a09c['type'][_0x6a1b('0x34')]};});_0x42804d[_0x6a1b('0x35')]=_[_0x6a1b('0x36')](_0x42d250,_0x6a1b('0x2f'));_0x42804d[_0x6a1b('0x37')]=_['keys'](_0x35a842[_0x6a1b('0x37')]);_0x42804d['filters']=_[_0x6a1b('0x38')](_0x42804d[_0x6a1b('0x35')],_0x42804d['query']);_0x3af34b[_0x6a1b('0x39')]=_['intersection'](_0x42804d[_0x6a1b('0x35')],qs[_0x6a1b('0x3a')](_0x35a842[_0x6a1b('0x37')][_0x6a1b('0x3a')]));_0x3af34b['attributes']=_0x3af34b['attributes'][_0x6a1b('0x3b')]?_0x3af34b[_0x6a1b('0x39')]:_0x42804d['model'];if(!_0x35a842[_0x6a1b('0x37')][_0x6a1b('0x3c')](_0x6a1b('0x3d'))){_0x3af34b['limit']=qs[_0x6a1b('0x24')](_0x35a842[_0x6a1b('0x37')]['limit']);_0x3af34b[_0x6a1b('0x22')]=qs[_0x6a1b('0x22')](_0x35a842[_0x6a1b('0x37')]['offset']);}_0x3af34b['order']=qs[_0x6a1b('0x3e')](_0x35a842[_0x6a1b('0x37')]['sort']);_0x3af34b[_0x6a1b('0x3f')]=qs[_0x6a1b('0x40')](_[_0x6a1b('0x41')](_0x35a842['query'],_0x42804d[_0x6a1b('0x40')]),_0x42d250);if(_0x35a842[_0x6a1b('0x37')][_0x6a1b('0x42')]){_0x3af34b['where']=_[_0x6a1b('0x43')](_0x3af34b['where'],{'$or':_[_0x6a1b('0x36')](_0x42d250,function(_0x41e596){if(_0x41e596[_0x6a1b('0x44')]!==_0x6a1b('0x45')){var _0x1fd623={};_0x1fd623[_0x41e596[_0x6a1b('0x2f')]]={'$like':'%'+_0x35a842[_0x6a1b('0x37')][_0x6a1b('0x42')]+'%'};return _0x1fd623;}})});}_0x3af34b=_[_0x6a1b('0x43')]({},_0x3af34b,_0x35a842[_0x6a1b('0x46')]);var _0x3c8523={'where':_0x3af34b[_0x6a1b('0x3f')]};return db[_0x6a1b('0x32')][_0x6a1b('0x25')](_0x3c8523)[_0x6a1b('0x2b')](function(_0x25d80e){_0x29fbaf['count']=_0x25d80e;if(_0x35a842[_0x6a1b('0x37')][_0x6a1b('0x47')]){_0x3af34b['include']=[{'all':!![]}];}return db[_0x6a1b('0x32')][_0x6a1b('0x48')](_0x3af34b);})['then'](function(_0x217ea0){_0x29fbaf[_0x6a1b('0x49')]=_0x217ea0;return _0x29fbaf;})[_0x6a1b('0x2b')](respondWithFilteredResult(_0x108831,_0x3af34b))[_0x6a1b('0x4a')](handleError(_0x108831,null));};exports[_0x6a1b('0x4b')]=function(_0x19f5f7,_0x49bc51){var _0x7ec3d3={'raw':!![],'where':{'id':_0x19f5f7['params']['id']}},_0x5fd3c5={};_0x5fd3c5[_0x6a1b('0x35')]=_[_0x6a1b('0x4c')](db['ChatGroup'][_0x6a1b('0x4d')]);_0x5fd3c5[_0x6a1b('0x37')]=_['keys'](_0x19f5f7[_0x6a1b('0x37')]);_0x5fd3c5['filters']=_[_0x6a1b('0x38')](_0x5fd3c5[_0x6a1b('0x35')],_0x5fd3c5[_0x6a1b('0x37')]);_0x7ec3d3['attributes']=_[_0x6a1b('0x38')](_0x5fd3c5['model'],qs[_0x6a1b('0x3a')](_0x19f5f7[_0x6a1b('0x37')][_0x6a1b('0x3a')]));_0x7ec3d3['attributes']=_0x7ec3d3[_0x6a1b('0x39')][_0x6a1b('0x3b')]?_0x7ec3d3[_0x6a1b('0x39')]:_0x5fd3c5[_0x6a1b('0x35')];if(_0x19f5f7[_0x6a1b('0x37')][_0x6a1b('0x47')]){_0x7ec3d3[_0x6a1b('0x4e')]=[{'all':!![]}];}_0x7ec3d3=_['merge']({},_0x7ec3d3,_0x19f5f7[_0x6a1b('0x46')]);return db['ChatGroup'][_0x6a1b('0x4f')](_0x7ec3d3)[_0x6a1b('0x2b')](handleEntityNotFound(_0x49bc51,null))[_0x6a1b('0x2b')](respondWithResult(_0x49bc51,null))['catch'](handleError(_0x49bc51,null));};exports['create']=function(_0x3a8387,_0x10a8c5){return db[_0x6a1b('0x32')]['create'](_0x3a8387['body'],{})['then'](respondWithResult(_0x10a8c5,0xc9))[_0x6a1b('0x4a')](handleError(_0x10a8c5,null));};exports[_0x6a1b('0x50')]=function(_0x433bb5,_0x35b9df){if(_0x433bb5[_0x6a1b('0x51')]['id']){delete _0x433bb5[_0x6a1b('0x51')]['id'];}return db[_0x6a1b('0x32')][_0x6a1b('0x4f')]({'where':{'id':_0x433bb5[_0x6a1b('0x52')]['id']}})['then'](handleEntityNotFound(_0x35b9df,null))[_0x6a1b('0x2b')](saveUpdates(_0x433bb5[_0x6a1b('0x51')],null))[_0x6a1b('0x2b')](respondWithResult(_0x35b9df,null))[_0x6a1b('0x4a')](handleError(_0x35b9df,null));};exports[_0x6a1b('0x2c')]=function(_0x199e50,_0x27cd73){return db[_0x6a1b('0x32')][_0x6a1b('0x4f')]({'where':{'id':_0x199e50[_0x6a1b('0x52')]['id']}})[_0x6a1b('0x2b')](handleEntityNotFound(_0x27cd73,null))[_0x6a1b('0x2b')](removeEntity(_0x27cd73,null))[_0x6a1b('0x4a')](handleError(_0x27cd73,null));};exports[_0x6a1b('0x53')]=function(_0x5c2937,_0xfbc1bc){return db[_0x6a1b('0x32')][_0x6a1b('0x53')]()[_0x6a1b('0x2b')](respondWithResult(_0xfbc1bc,null))[_0x6a1b('0x4a')](handleError(_0xfbc1bc,null));};exports[_0x6a1b('0x54')]=function(_0x527a38,_0x9d6375,_0x5c27de){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0x527a38[_0x6a1b('0x52')]['id'],'ToId':_0x527a38['user']['id'],'read':![]}})[_0x6a1b('0x2b')](function(_0x2abf70){return{'id':_[_0x6a1b('0x55')](_0x527a38['params']['id']),'count':_0x2abf70};})[_0x6a1b('0x2b')](respondWithResult(_0x9d6375,null))['catch'](handleError(_0x9d6375,null));};exports['addMembers']=function(_0x200684,_0x2d60d3,_0x380ed6){return db[_0x6a1b('0x32')]['find']({'where':{'id':_0x200684[_0x6a1b('0x52')]['id']}})[_0x6a1b('0x2b')](handleEntityNotFound(_0x2d60d3,null))[_0x6a1b('0x2b')](function(_0x3c5d75){if(_0x3c5d75){return _0x3c5d75['addMembers'](_0x200684[_0x6a1b('0x51')][_0x6a1b('0x56')],_['omit'](_0x200684[_0x6a1b('0x51')],['ids','id'])||{});}})[_0x6a1b('0x2b')](respondWithResult(_0x2d60d3,null))['catch'](handleError(_0x2d60d3,null));};exports[_0x6a1b('0x57')]=function(_0x586397,_0x58ae1a,_0x7e2844){var _0x2261b4={};var _0x476391={};var _0x26929f;var _0x45a818;return db[_0x6a1b('0x32')][_0x6a1b('0x58')]({'where':{'id':_0x586397[_0x6a1b('0x52')]['id']}})['then'](handleEntityNotFound(_0x58ae1a,null))[_0x6a1b('0x2b')](function(_0x5b0e39){if(_0x5b0e39){_0x26929f=_0x5b0e39;_0x476391[_0x6a1b('0x35')]=_[_0x6a1b('0x4c')](db[_0x6a1b('0x59')][_0x6a1b('0x4d')]);_0x476391['query']=_[_0x6a1b('0x4c')](_0x586397[_0x6a1b('0x37')]);_0x476391[_0x6a1b('0x40')]=_[_0x6a1b('0x38')](_0x476391[_0x6a1b('0x35')],_0x476391[_0x6a1b('0x37')]);_0x2261b4[_0x6a1b('0x39')]=_[_0x6a1b('0x38')](_0x476391[_0x6a1b('0x35')],qs[_0x6a1b('0x3a')](_0x586397[_0x6a1b('0x37')][_0x6a1b('0x3a')]));_0x2261b4[_0x6a1b('0x39')]=_0x2261b4[_0x6a1b('0x39')]['length']?_0x2261b4[_0x6a1b('0x39')]:_0x476391[_0x6a1b('0x35')];_0x2261b4['order']=qs[_0x6a1b('0x3e')](_0x586397[_0x6a1b('0x37')][_0x6a1b('0x3e')]);_0x2261b4[_0x6a1b('0x3f')]=qs['filters'](_[_0x6a1b('0x41')](_0x586397[_0x6a1b('0x37')],_0x476391[_0x6a1b('0x40')]));if(_0x586397[_0x6a1b('0x37')][_0x6a1b('0x42')]){_0x2261b4['where']=_[_0x6a1b('0x43')](_0x2261b4[_0x6a1b('0x3f')],{'$or':_['map'](_0x2261b4[_0x6a1b('0x39')],function(_0x49a857){var _0x398d78={};_0x398d78[_0x49a857]={'$like':'%'+_0x586397[_0x6a1b('0x37')][_0x6a1b('0x42')]+'%'};return _0x398d78;})});}_0x2261b4=_['merge']({},_0x2261b4,_0x586397[_0x6a1b('0x46')]);return _0x26929f['getMembers'](_0x2261b4);}})[_0x6a1b('0x2b')](function(_0xefdc17){if(_0xefdc17){_0x45a818=_0xefdc17[_0x6a1b('0x3b')];if(!_0x586397[_0x6a1b('0x37')][_0x6a1b('0x3c')](_0x6a1b('0x3d'))){_0x2261b4[_0x6a1b('0x24')]=qs[_0x6a1b('0x24')](_0x586397['query'][_0x6a1b('0x24')]);_0x2261b4[_0x6a1b('0x22')]=qs[_0x6a1b('0x22')](_0x586397[_0x6a1b('0x37')][_0x6a1b('0x22')]);}return _0x26929f[_0x6a1b('0x57')](_0x2261b4);}})[_0x6a1b('0x2b')](function(_0x5dc1a8){if(_0x5dc1a8){return _0x5dc1a8?{'count':_0x45a818,'rows':_0x5dc1a8}:null;}})[_0x6a1b('0x2b')](respondWithResult(_0x58ae1a,null))[_0x6a1b('0x4a')](handleError(_0x58ae1a,null));};exports[_0x6a1b('0x5a')]=function(_0x55df19,_0x4ca9f1,_0x69c7ac){return db[_0x6a1b('0x32')][_0x6a1b('0x4f')]({'where':{'id':_0x55df19['params']['id']}})[_0x6a1b('0x2b')](handleEntityNotFound(_0x4ca9f1,null))[_0x6a1b('0x2b')](function(_0x27ceef){if(_0x27ceef){return _0x27ceef[_0x6a1b('0x5a')](_0x55df19[_0x6a1b('0x37')]['ids']);}})[_0x6a1b('0x2b')](respondWithStatusCode(_0x4ca9f1,null))['catch'](handleError(_0x4ca9f1,null));};exports[_0x6a1b('0x5b')]=function(_0x199492,_0x2c433d,_0x26ec85){if(_0x199492['body']['id']){delete _0x199492['body']['id'];}return db['ChatGroup'][_0x6a1b('0x4f')]({'where':{'id':_0x199492['params']['id']}})[_0x6a1b('0x2b')](handleEntityNotFound(_0x2c433d,null))['then'](function(_0x396d66){if(_0x396d66){_0x199492[_0x6a1b('0x51')][_0x6a1b('0x5c')]=_0x396d66['id'];return db['ChatInternalMessage'][_0x6a1b('0x5d')](_0x199492['body']);}})[_0x6a1b('0x2b')](respondWithResult(_0x2c433d,null))[_0x6a1b('0x4a')](handleError(_0x2c433d,null));};exports['getMessages']=function(_0x32000f,_0x1eca26,_0x1eb247){var _0x9f9606={};var _0x3c6f98={};var _0x2768be;var _0x27670d;return db[_0x6a1b('0x32')][_0x6a1b('0x58')]({'where':{'id':_0x32000f['params']['id']}})[_0x6a1b('0x2b')](handleEntityNotFound(_0x1eca26,null))[_0x6a1b('0x2b')](function(_0x37f966){if(_0x37f966){_0x2768be=_0x37f966;_0x3c6f98[_0x6a1b('0x35')]=_[_0x6a1b('0x4c')](db['ChatInternalMessage'][_0x6a1b('0x4d')]);_0x3c6f98[_0x6a1b('0x37')]=_['keys'](_0x32000f[_0x6a1b('0x37')]);_0x3c6f98[_0x6a1b('0x40')]=_[_0x6a1b('0x38')](_0x3c6f98[_0x6a1b('0x35')],_0x3c6f98[_0x6a1b('0x37')]);_0x9f9606[_0x6a1b('0x39')]=_[_0x6a1b('0x38')](_0x3c6f98[_0x6a1b('0x35')],qs[_0x6a1b('0x3a')](_0x32000f['query'][_0x6a1b('0x3a')]));_0x9f9606[_0x6a1b('0x39')]=_0x9f9606[_0x6a1b('0x39')]['length']?_0x9f9606['attributes']:_0x3c6f98[_0x6a1b('0x35')];_0x9f9606[_0x6a1b('0x5e')]=qs[_0x6a1b('0x3e')](_0x32000f[_0x6a1b('0x37')][_0x6a1b('0x3e')]);_0x9f9606[_0x6a1b('0x3f')]=qs[_0x6a1b('0x40')](_[_0x6a1b('0x41')](_0x32000f[_0x6a1b('0x37')],_0x3c6f98['filters']));if(_0x32000f['query'][_0x6a1b('0x42')]){_0x9f9606[_0x6a1b('0x3f')]=_[_0x6a1b('0x43')](_0x9f9606[_0x6a1b('0x3f')],{'$or':_['map'](_0x9f9606[_0x6a1b('0x39')],function(_0x333599){var _0x513254={};_0x513254[_0x333599]={'$like':'%'+_0x32000f[_0x6a1b('0x37')][_0x6a1b('0x42')]+'%'};return _0x513254;})});}if(_0x32000f[_0x6a1b('0x37')]['$gte']){var _0x39fd63=_0x32000f[_0x6a1b('0x37')]['$gte'][_0x6a1b('0x5f')](',');var _0x3565e3={};_0x3565e3[_0x39fd63[0x0]]={'$gte':moment(_0x39fd63[0x1])[_0x6a1b('0x60')](_0x6a1b('0x61'))};_0x9f9606[_0x6a1b('0x3f')]=_[_0x6a1b('0x43')](_0x9f9606[_0x6a1b('0x3f')],_0x3565e3);}_0x9f9606=_['merge']({},_0x9f9606,_0x32000f[_0x6a1b('0x46')]);return _0x2768be['getMessages'](_0x9f9606);}})['then'](function(_0x7b2405){if(_0x7b2405){_0x27670d=_0x7b2405[_0x6a1b('0x3b')];if(!_0x32000f[_0x6a1b('0x37')][_0x6a1b('0x3c')](_0x6a1b('0x3d'))){_0x9f9606[_0x6a1b('0x24')]=qs[_0x6a1b('0x24')](_0x32000f[_0x6a1b('0x37')][_0x6a1b('0x24')]);_0x9f9606[_0x6a1b('0x22')]=qs[_0x6a1b('0x22')](_0x32000f[_0x6a1b('0x37')][_0x6a1b('0x22')]);}return _0x2768be[_0x6a1b('0x62')](_0x9f9606);}})[_0x6a1b('0x2b')](function(_0x27e48d){if(_0x27e48d){return _0x27e48d?{'count':_0x27670d,'rows':_0x27e48d}:null;}})[_0x6a1b('0x2b')](respondWithResult(_0x1eca26,null))[_0x6a1b('0x4a')](handleError(_0x1eca26,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 6bd89cc..a43156c 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 _0xfb6e=['ChatGroup','setMaxListeners','save','update','remove','emit','hasOwnProperty','../../mysqldb'];(function(_0x5b89a0,_0x315a2a){var _0x44d81a=function(_0x2529f4){while(--_0x2529f4){_0x5b89a0['push'](_0x5b89a0['shift']());}};_0x44d81a(++_0x315a2a);}(_0xfb6e,0x177));var _0xefb6=function(_0x59ef1c,_0xaf626a){_0x59ef1c=_0x59ef1c-0x0;var _0x3eb6f8=_0xfb6e[_0x59ef1c];return _0x3eb6f8;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0xefb6('0x0'))['db'][_0xefb6('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xefb6('0x2')](0x0);var events={'afterCreate':_0xefb6('0x3'),'afterUpdate':_0xefb6('0x4'),'afterDestroy':_0xefb6('0x5')};function emitEvent(_0x239335){return function(_0x468f2,_0x5cf1f9,_0xaefbef){ChatGroupEvents[_0xefb6('0x6')](_0x239335+':'+_0x468f2['id'],_0x468f2);ChatGroupEvents[_0xefb6('0x6')](_0x239335,_0x468f2);_0xaefbef(null);};}for(var e in events){if(events[_0xefb6('0x7')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0xea21=['hook','exports','events','ChatGroup','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x33facd,_0x1bff45){var _0x365229=function(_0xb1b3c0){while(--_0xb1b3c0){_0x33facd['push'](_0x33facd['shift']());}};_0x365229(++_0x1bff45);}(_0xea21,0x80));var _0x1ea2=function(_0x28617c,_0x2dbb84){_0x28617c=_0x28617c-0x0;var _0x27ff6a=_0xea21[_0x28617c];return _0x27ff6a;};'use strict';var EventEmitter=require(_0x1ea2('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0x1ea2('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x1ea2('0x2')](0x0);var events={'afterCreate':_0x1ea2('0x3'),'afterUpdate':'update','afterDestroy':_0x1ea2('0x4')};function emitEvent(_0x5e1519){return function(_0xd183cc,_0x1d1d87,_0x324637){ChatGroupEvents[_0x1ea2('0x5')](_0x5e1519+':'+_0xd183cc['id'],_0xd183cc);ChatGroupEvents['emit'](_0x5e1519,_0xd183cc);_0x324637(null);};}for(var e in events){if(events[_0x1ea2('0x6')](e)){var event=events[e];ChatGroup[_0x1ea2('0x7')](e,emitEvent(event));}}module[_0x1ea2('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 0224079..89f80c3 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 _0xa945=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./chatGroup.attributes','exports','ChatGroup','chat_groups'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa945,0x90));var _0x5a94=function(_0x4fe84e,_0x59795c){_0x4fe84e=_0x4fe84e-0x0;var _0x57037c=_0xa945[_0x4fe84e];return _0x57037c;};'use strict';var _=require(_0x5a94('0x0'));var util=require(_0x5a94('0x1'));var logger=require(_0x5a94('0x2'))(_0x5a94('0x3'));var moment=require('moment');var BPromise=require(_0x5a94('0x4'));var rp=require(_0x5a94('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5a94('0x6'));var config=require(_0x5a94('0x7'));var attributes=require(_0x5a94('0x8'));module[_0x5a94('0x9')]=function(_0x196f9c,_0xe3246f){return _0x196f9c['define'](_0x5a94('0xa'),attributes,{'tableName':_0x5a94('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x17b5=['request-promise','path','rimraf','./chatGroup.attributes','exports','ChatGroup','lodash','../../config/logger','api','bluebird'];(function(_0x18abd2,_0x22d4b3){var _0x1dcad6=function(_0xcc08c4){while(--_0xcc08c4){_0x18abd2['push'](_0x18abd2['shift']());}};_0x1dcad6(++_0x22d4b3);}(_0x17b5,0x1be));var _0x517b=function(_0x37dbf3,_0x4ad77d){_0x37dbf3=_0x37dbf3-0x0;var _0x1cda9b=_0x17b5[_0x37dbf3];return _0x1cda9b;};'use strict';var _=require(_0x517b('0x0'));var util=require('util');var logger=require(_0x517b('0x1'))(_0x517b('0x2'));var moment=require('moment');var BPromise=require(_0x517b('0x3'));var rp=require(_0x517b('0x4'));var fs=require('fs');var path=require(_0x517b('0x5'));var rimraf=require(_0x517b('0x6'));var config=require('../../config/environment');var attributes=require(_0x517b('0x7'));module[_0x517b('0x8')]=function(_0x52a7b7,_0x31d1ae){return _0x52a7b7['define'](_0x517b('0x9'),attributes,{'tableName':'chat_groups','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 120ec50..993b15b 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 _0x7bbd=['localhost','socket.io-emitter','register','request','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x7bbd,0x12c));var _0xd7bb=function(_0x54f5a9,_0x3d7a03){_0x54f5a9=_0x54f5a9-0x0;var _0x48b472=_0x7bbd[_0x54f5a9];return _0x48b472;};'use strict';var _=require(_0xd7bb('0x0'));var util=require('util');var moment=require(_0xd7bb('0x1'));var BPromise=require(_0xd7bb('0x2'));var rs=require(_0xd7bb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd7bb('0x4'))['db'];var utils=require(_0xd7bb('0x5'));var logger=require(_0xd7bb('0x6'))(_0xd7bb('0x7'));var config=require(_0xd7bb('0x8'));var jayson=require(_0xd7bb('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xd7bb('0xa')]=_[_0xd7bb('0xb')](config[_0xd7bb('0xa')],{'host':_0xd7bb('0xc'),'port':0x18eb});var socket=require(_0xd7bb('0xd'))(new Redis(config[_0xd7bb('0xa')]));require('./chatGroup.socket')[_0xd7bb('0xe')](socket);function respondWithRpcPromise(_0x5d4077,_0x5bbfc3,_0x233a18){return new BPromise(function(_0x2c3615,_0x5c8e8c){return client[_0xd7bb('0xf')](_0x5d4077,_0x233a18)['then'](function(_0x49322b){logger['info']('ChatGroup,\x20%s,\x20%s',_0x5bbfc3,_0xd7bb('0x10'));logger[_0xd7bb('0x11')](_0xd7bb('0x12'),_0x5bbfc3,_0xd7bb('0x10'),JSON[_0xd7bb('0x13')](_0x49322b));if(_0x49322b[_0xd7bb('0x14')]){if(_0x49322b['error'][_0xd7bb('0x15')]===0x1f4){logger['error'](_0xd7bb('0x16'),_0x5bbfc3,_0x49322b[_0xd7bb('0x14')][_0xd7bb('0x17')]);return _0x5c8e8c(_0x49322b[_0xd7bb('0x14')][_0xd7bb('0x17')]);}logger[_0xd7bb('0x14')](_0xd7bb('0x16'),_0x5bbfc3,_0x49322b['error'][_0xd7bb('0x17')]);return _0x2c3615(_0x49322b[_0xd7bb('0x14')][_0xd7bb('0x17')]);}else{logger['info'](_0xd7bb('0x16'),_0x5bbfc3,_0xd7bb('0x10'));_0x2c3615(_0x49322b[_0xd7bb('0x18')][_0xd7bb('0x17')]);}})[_0xd7bb('0x19')](function(_0x1f43d5){logger[_0xd7bb('0x14')](_0xd7bb('0x16'),_0x5bbfc3,_0x1f43d5);_0x5c8e8c(_0x1f43d5);});});} \ No newline at end of file +var _0x851c=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','localhost','./chatGroup.socket','register','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment'];(function(_0x2cbc3d,_0x2b7891){var _0x5945c9=function(_0x5a3fe4){while(--_0x5a3fe4){_0x2cbc3d['push'](_0x2cbc3d['shift']());}};_0x5945c9(++_0x2b7891);}(_0x851c,0x19d));var _0xc851=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x851c[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xc851('0x0'));var util=require(_0xc851('0x1'));var moment=require(_0xc851('0x2'));var BPromise=require(_0xc851('0x3'));var rs=require(_0xc851('0x4'));var fs=require('fs');var Redis=require(_0xc851('0x5'));var db=require(_0xc851('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc851('0x7'))(_0xc851('0x8'));var config=require('../../config/environment');var jayson=require(_0xc851('0x9'));var client=jayson[_0xc851('0xa')]['http']({'port':0x232a});config[_0xc851('0xb')]=_['defaults'](config['redis'],{'host':_0xc851('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc851('0xd'))[_0xc851('0xe')](socket);function respondWithRpcPromise(_0x3b4e80,_0x177de0,_0x1f1524){return new BPromise(function(_0x1ee38d,_0x33772a){return client[_0xc851('0xf')](_0x3b4e80,_0x1f1524)['then'](function(_0x3a1ce8){logger[_0xc851('0x10')](_0xc851('0x11'),_0x177de0,_0xc851('0x12'));logger[_0xc851('0x13')](_0xc851('0x14'),_0x177de0,_0xc851('0x12'),JSON[_0xc851('0x15')](_0x3a1ce8));if(_0x3a1ce8[_0xc851('0x16')]){if(_0x3a1ce8[_0xc851('0x16')][_0xc851('0x17')]===0x1f4){logger[_0xc851('0x16')](_0xc851('0x11'),_0x177de0,_0x3a1ce8[_0xc851('0x16')][_0xc851('0x18')]);return _0x33772a(_0x3a1ce8[_0xc851('0x16')]['message']);}logger[_0xc851('0x16')]('ChatGroup,\x20%s,\x20%s',_0x177de0,_0x3a1ce8[_0xc851('0x16')]['message']);return _0x1ee38d(_0x3a1ce8[_0xc851('0x16')][_0xc851('0x18')]);}else{logger[_0xc851('0x10')](_0xc851('0x11'),_0x177de0,_0xc851('0x12'));_0x1ee38d(_0x3a1ce8[_0xc851('0x19')][_0xc851('0x18')]);}})['catch'](function(_0x27c098){logger[_0xc851('0x16')]('ChatGroup,\x20%s,\x20%s',_0x177de0,_0x27c098);_0x33772a(_0x27c098);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 2047df0..769b689 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 _0x4a2e=['register','length','chatGroup:','./chatGroup.events','save','remove','update','removeListener'];(function(_0x5d7031,_0x4e9523){var _0x269c4d=function(_0x37f797){while(--_0x37f797){_0x5d7031['push'](_0x5d7031['shift']());}};_0x269c4d(++_0x4e9523);}(_0x4a2e,0xc3));var _0xe4a2=function(_0x59bd2d,_0x307929){_0x59bd2d=_0x59bd2d-0x0;var _0x572487=_0x4a2e[_0x59bd2d];return _0x572487;};'use strict';var ChatGroupEvents=require(_0xe4a2('0x0'));var events=[_0xe4a2('0x1'),_0xe4a2('0x2'),_0xe4a2('0x3')];function createListener(_0xe2fa07,_0x2bcae2){return function(_0xe2434a){_0x2bcae2['emit'](_0xe2fa07,_0xe2434a);};}function removeListener(_0x1b3e3,_0x35b72b){return function(){ChatGroupEvents[_0xe4a2('0x4')](_0x1b3e3,_0x35b72b);};}exports[_0xe4a2('0x5')]=function(_0x504956){for(var _0x39b534=0x0,_0x32a6f3=events[_0xe4a2('0x6')];_0x39b534<_0x32a6f3;_0x39b534++){var _0x13d500=events[_0x39b534];var _0x2fbb53=createListener(_0xe4a2('0x7')+_0x13d500,_0x504956);ChatGroupEvents['on'](_0x13d500,_0x2fbb53);}}; \ No newline at end of file +var _0xf976=['remove','emit','register','./chatGroup.events','save'];(function(_0xb3fd1e,_0x48300a){var _0x4fc6f1=function(_0x51d481){while(--_0x51d481){_0xb3fd1e['push'](_0xb3fd1e['shift']());}};_0x4fc6f1(++_0x48300a);}(_0xf976,0x19d));var _0x6f97=function(_0x296218,_0x5543d1){_0x296218=_0x296218-0x0;var _0x1247d5=_0xf976[_0x296218];return _0x1247d5;};'use strict';var ChatGroupEvents=require(_0x6f97('0x0'));var events=[_0x6f97('0x1'),_0x6f97('0x2'),'update'];function createListener(_0x519514,_0x4ad5b7){return function(_0x233a2e){_0x4ad5b7[_0x6f97('0x3')](_0x519514,_0x233a2e);};}function removeListener(_0x2cb3c0,_0x20eae4){return function(){ChatGroupEvents['removeListener'](_0x2cb3c0,_0x20eae4);};}exports[_0x6f97('0x4')]=function(_0x2de2ac){for(var _0x356691=0x0,_0xb3ff3e=events['length'];_0x356691<_0xb3ff3e;_0x356691++){var _0x1bb973=events[_0x356691];var _0x32ef2e=createListener('chatGroup:'+_0x1bb973,_0x2de2ac);ChatGroupEvents['on'](_0x1bb973,_0x32ef2e);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index b37a355..7afa014 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 _0x4c4c=['/:id/messages','post','addMessage','put','/:id','update','delete','destroy','removeMembers','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','show','/:id/unread','getUnread','/:id/members'];(function(_0x414048,_0x521f72){var _0x5630dc=function(_0x5aee26){while(--_0x5aee26){_0x414048['push'](_0x414048['shift']());}};_0x5630dc(++_0x521f72);}(_0x4c4c,0xa6));var _0xc4c4=function(_0x288fef,_0x3232f0){_0x288fef=_0x288fef-0x0;var _0x1edb33=_0x4c4c[_0x288fef];return _0x1edb33;};'use strict';var multer=require('multer');var util=require(_0xc4c4('0x0'));var path=require(_0xc4c4('0x1'));var timeout=require(_0xc4c4('0x2'));var express=require(_0xc4c4('0x3'));var router=express[_0xc4c4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc4c4('0x5'));var interaction=require(_0xc4c4('0x6'));var config=require(_0xc4c4('0x7'));var controller=require('./chatGroup.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc4c4('0x8')](_0xc4c4('0x9'),auth[_0xc4c4('0xa')](),controller[_0xc4c4('0xb')]);router[_0xc4c4('0x8')]('/:id',auth[_0xc4c4('0xa')](),controller[_0xc4c4('0xc')]);router['get'](_0xc4c4('0xd'),auth[_0xc4c4('0xa')](),controller[_0xc4c4('0xe')]);router['get'](_0xc4c4('0xf'),auth[_0xc4c4('0xa')](),controller['getMembers']);router[_0xc4c4('0x8')](_0xc4c4('0x10'),auth[_0xc4c4('0xa')](),controller['getMessages']);router[_0xc4c4('0x11')]('/',auth[_0xc4c4('0xa')](),controller['create']);router[_0xc4c4('0x11')](_0xc4c4('0xf'),auth[_0xc4c4('0xa')](),controller['addMembers']);router['post'](_0xc4c4('0x10'),auth[_0xc4c4('0xa')](),controller[_0xc4c4('0x12')]);router[_0xc4c4('0x13')](_0xc4c4('0x14'),auth[_0xc4c4('0xa')](),controller[_0xc4c4('0x15')]);router[_0xc4c4('0x16')](_0xc4c4('0x14'),auth[_0xc4c4('0xa')](),controller[_0xc4c4('0x17')]);router[_0xc4c4('0x16')]('/:id/members',auth[_0xc4c4('0xa')](),controller[_0xc4c4('0x18')]);module[_0xc4c4('0x19')]=router; \ No newline at end of file +var _0x7802=['post','addMembers','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','getUnread','/:id/members','getMembers','/:id/messages','create'];(function(_0x23f9c8,_0xa5b76d){var _0x3cf348=function(_0x23efad){while(--_0x23efad){_0x23f9c8['push'](_0x23f9c8['shift']());}};_0x3cf348(++_0xa5b76d);}(_0x7802,0x124));var _0x2780=function(_0x44532f,_0x2dac86){_0x44532f=_0x44532f-0x0;var _0x11e878=_0x7802[_0x44532f];return _0x11e878;};'use strict';var multer=require(_0x2780('0x0'));var util=require(_0x2780('0x1'));var path=require(_0x2780('0x2'));var timeout=require(_0x2780('0x3'));var express=require(_0x2780('0x4'));var router=express[_0x2780('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2780('0x6'));var interaction=require(_0x2780('0x7'));var config=require('../../config/environment');var controller=require(_0x2780('0x8'));router[_0x2780('0x9')]('/',auth[_0x2780('0xa')](),controller[_0x2780('0xb')]);router[_0x2780('0x9')](_0x2780('0xc'),auth['isAuthenticated'](),controller[_0x2780('0xd')]);router[_0x2780('0x9')](_0x2780('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x2780('0x9')]('/:id/unread',auth[_0x2780('0xa')](),controller[_0x2780('0xf')]);router['get'](_0x2780('0x10'),auth[_0x2780('0xa')](),controller[_0x2780('0x11')]);router[_0x2780('0x9')](_0x2780('0x12'),auth[_0x2780('0xa')](),controller['getMessages']);router['post']('/',auth['isAuthenticated'](),controller[_0x2780('0x13')]);router[_0x2780('0x14')](_0x2780('0x10'),auth['isAuthenticated'](),controller[_0x2780('0x15')]);router[_0x2780('0x14')](_0x2780('0x12'),auth[_0x2780('0xa')](),controller['addMessage']);router[_0x2780('0x16')]('/:id',auth[_0x2780('0xa')](),controller['update']);router[_0x2780('0x17')](_0x2780('0xe'),auth[_0x2780('0xa')](),controller[_0x2780('0x18')]);router['delete'](_0x2780('0x10'),auth[_0x2780('0xa')](),controller['removeMembers']);module[_0x2780('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 44e2c7d..5f9f495 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 _0x5106=['BOOLEAN','ENUM','star','TEXT','STRING','DATE','long','out','sequelize'];(function(_0x721e8b,_0x5e679d){var _0x3a0b53=function(_0x1b3fd3){while(--_0x1b3fd3){_0x721e8b['push'](_0x721e8b['shift']());}};_0x3a0b53(++_0x5e679d);}(_0x5106,0x116));var _0x6510=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5106[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x6510('0x0'));module['exports']={'closed':{'type':Sequelize[_0x6510('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x6510('0x2')](_0x6510('0x3'),'thumb'),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x6510('0x4')]},'pathTranscript':{'type':Sequelize[_0x6510('0x4')]},'mailTranscript':{'type':Sequelize[_0x6510('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x6510('0x6')]},'disposition':{'type':Sequelize[_0x6510('0x5')]},'secondDisposition':{'type':Sequelize[_0x6510('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x6510('0x5')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x6510('0x5')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x6510('0x5')]},'deviceType':{'type':Sequelize[_0x6510('0x5')]},'referer':{'type':Sequelize[_0x6510('0x4')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0x6510('0x7'))},'read1stAt':{'type':Sequelize[_0x6510('0x6')]},'lastMsgAt':{'type':Sequelize[_0x6510('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x6510('0x2')]('in',_0x6510('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x6510('0x5')]},'vidaooSessionId':{'type':Sequelize[_0x6510('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x6510('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0xa321=['long','DATE','ENUM','sequelize','exports','BOOLEAN','INTEGER','star','thumb','TEXT','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa321,0x9d));var _0x1a32=function(_0x138d06,_0x33edf2){_0x138d06=_0x138d06-0x0;var _0x1a01eb=_0xa321[_0x138d06];return _0x1a01eb;};'use strict';var Sequelize=require(_0x1a32('0x0'));module[_0x1a32('0x1')]={'closed':{'type':Sequelize[_0x1a32('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x1a32('0x3')]},'ratingType':{'type':Sequelize['ENUM'](_0x1a32('0x4'),_0x1a32('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x1a32('0x6')]},'pathTranscript':{'type':Sequelize[_0x1a32('0x6')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x1a32('0x7')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x1a32('0x7')]},'browserName':{'type':Sequelize[_0x1a32('0x7')]},'browserVersion':{'type':Sequelize[_0x1a32('0x7')]},'osName':{'type':Sequelize[_0x1a32('0x7')]},'osVersion':{'type':Sequelize[_0x1a32('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x1a32('0x7')]},'deviceType':{'type':Sequelize[_0x1a32('0x7')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x1a32('0x7')]},'formData':{'type':Sequelize[_0x1a32('0x6')](_0x1a32('0x8'))},'read1stAt':{'type':Sequelize[_0x1a32('0x9')]},'lastMsgAt':{'type':Sequelize[_0x1a32('0x9')]},'lastMsgDirection':{'type':Sequelize[_0x1a32('0xa')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x1a32('0x7')]},'customerPort':{'type':Sequelize[_0x1a32('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x1a32('0x6')]},'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 9e09ae4..187b468 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 _0x9c52=['User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','some','compact','isEmpty','ChatWebsiteId','where','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','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','Contact.email','c.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','all','params','rawAttributes','fields','includeAll','include','create','describe','createVidaooSession','ChatWebsite','findOne','vidaooApiKey','vidaooNote','vidaooEscalation','account','POST','https://api-vidaoo.xcally.com/api/v1/meetings','email','vidaooTopic','isNull','follow','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','updateAttributes','customUpdate','CmContact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','Interaction\x20already\x20assigned','attachmentUpload','file','basename','filename','attachmentDownload','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','root','download','close','mailTranscript','server/files/chat/upload/','transcript-%s.txt','now','Messages','format','%s%d','agentAlias','System','customer','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','auth','SendMail','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ChatMessage','ids','omit','getMessages','YYYY-MM-DD\x20HH:mm:ss','options','findAll','getMyMessages','addTags','emit','removeTags','unix','files','tmp','server','attachments','firstName','lastName','Account','Owner','get','mkdirSync','Chat','N.A.','browserName','osName','customerIp','customerPort','tail','existsSync','createWriteStream','views','transcript-','.pdf','createPdfFromHTML','unlinkSync','sendStatus','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','client','http','then','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','info','result','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','destroy','end','stack','name','send','body','agent','interaction','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','waiting','talking','answered','unmanaged','UserId','disposition','abandoned','closed','total','ChatInteraction','fieldName','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','u.id','u.fullname','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','value','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','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union'];(function(_0x39f773,_0x2289be){var _0x1a1aac=function(_0x47c537){while(--_0x47c537){_0x39f773['push'](_0x39f773['shift']());}};_0x1a1aac(++_0x2289be);}(_0x9c52,0xb0));var _0x29c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c52[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x29c5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29c5('0x1'));var rp=require(_0x29c5('0x2'));var moment=require(_0x29c5('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x29c5('0x4'));var util=require(_0x29c5('0x5'));var path=require(_0x29c5('0x6'));var sox=require(_0x29c5('0x7'));var csv=require(_0x29c5('0x8'));var ejs=require(_0x29c5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x29c5('0xa'));var squel=require('squel');var crypto=require(_0x29c5('0xb'));var jsforce=require(_0x29c5('0xc'));var deskjs=require(_0x29c5('0xd'));var toCsv=require('to-csv');var querystring=require(_0x29c5('0xe'));var Papa=require(_0x29c5('0xf'));var Redis=require(_0x29c5('0x10'));var authService=require(_0x29c5('0x11'));var qs=require(_0x29c5('0x12'));var as=require(_0x29c5('0x13'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x29c5('0x14'));var logger=require('../../config/logger')(_0x29c5('0x15'));var utils=require(_0x29c5('0x16'));var config=require(_0x29c5('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x29c5('0x18'))['db'];config[_0x29c5('0x19')]=_[_0x29c5('0x1a')](config[_0x29c5('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x29c5('0x1b'))(new Redis(config[_0x29c5('0x19')]));require(_0x29c5('0x1c'))[_0x29c5('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x29c5('0x1e')][_0x29c5('0x1f')]({'port':0x232b});var client9004=jayson[_0x29c5('0x1e')][_0x29c5('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x30ba3d,_0x54c7aa,_0x1ef3d0,_0x534287){return new BPromise(function(_0x3a649b,_0x24d30b){var _0x962b45=_0x534287||client;return _0x962b45['request'](_0x30ba3d,_0x1ef3d0)[_0x29c5('0x20')](function(_0x2068e4){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x54c7aa,_0x29c5('0x21'));logger[_0x29c5('0x22')](_0x29c5('0x23'),_0x54c7aa,_0x29c5('0x21'),JSON[_0x29c5('0x24')](_0x2068e4));if(_0x2068e4[_0x29c5('0x25')]){if(_0x2068e4[_0x29c5('0x25')][_0x29c5('0x26')]===0x1f4){logger[_0x29c5('0x25')](_0x29c5('0x27'),_0x54c7aa,_0x2068e4['error'][_0x29c5('0x28')]);return _0x24d30b(_0x2068e4['error'][_0x29c5('0x28')]);}logger[_0x29c5('0x25')](_0x29c5('0x27'),_0x54c7aa,_0x2068e4[_0x29c5('0x25')][_0x29c5('0x28')]);return _0x3a649b(_0x2068e4[_0x29c5('0x25')][_0x29c5('0x28')]);}else{logger[_0x29c5('0x29')](_0x29c5('0x27'),_0x54c7aa,_0x29c5('0x21'));_0x3a649b(_0x2068e4[_0x29c5('0x2a')]['message']);}})['catch'](function(_0x2cd4de){logger[_0x29c5('0x25')](_0x29c5('0x27'),_0x54c7aa,_0x2cd4de);_0x24d30b(_0x2cd4de);});});}function respondWithStatusCode(_0x356ea9,_0x46a4c8){_0x46a4c8=_0x46a4c8||0xcc;return function(_0x1973fc){if(_0x1973fc){return _0x356ea9['sendStatus'](_0x46a4c8);}return _0x356ea9[_0x29c5('0x2b')](_0x46a4c8)['end']();};}function respondWithResult(_0x661721,_0x2b111c){_0x2b111c=_0x2b111c||0xc8;return function(_0x332186){if(_0x332186){return _0x661721[_0x29c5('0x2b')](_0x2b111c)[_0x29c5('0x2c')](_0x332186);}};}function respondWithFilteredResult(_0x52f67e,_0x54cb99){return function(_0x4815f9){if(_0x4815f9){var _0x35992f=typeof _0x54cb99['offset']===_0x29c5('0x2d')&&typeof _0x54cb99[_0x29c5('0x2e')]===_0x29c5('0x2d');var _0x248cef=_0x4815f9['count'];var _0x486515=_0x35992f?0x0:_0x54cb99[_0x29c5('0x2f')];var _0x1cf44a=_0x35992f?_0x4815f9[_0x29c5('0x30')]:_0x54cb99[_0x29c5('0x2f')]+_0x54cb99[_0x29c5('0x2e')];var _0x342af9;if(_0x1cf44a>=_0x248cef){_0x1cf44a=_0x248cef;_0x342af9=0xc8;}else{_0x342af9=0xce;}_0x52f67e[_0x29c5('0x2b')](_0x342af9);return _0x52f67e[_0x29c5('0x31')](_0x29c5('0x32'),_0x486515+'-'+_0x1cf44a+'/'+_0x248cef)[_0x29c5('0x2c')](_0x4815f9);}return null;};}function patchUpdates(_0x1fd0be){return function(_0x45e665){try{jsonpatch[_0x29c5('0x33')](_0x45e665,_0x1fd0be,!![]);}catch(_0x4743d1){return BPromise['reject'](_0x4743d1);}return _0x45e665[_0x29c5('0x34')]();};}function saveUpdates(_0x639ed7,_0x116f6b){return function(_0x44644b){if(_0x44644b){return _0x44644b[_0x29c5('0x35')](_0x639ed7)[_0x29c5('0x20')](function(_0x8ec0af){return _0x8ec0af;});}return null;};}function removeEntity(_0x3045c9,_0x351253){return function(_0x11f42b){if(_0x11f42b){return _0x11f42b[_0x29c5('0x36')]()[_0x29c5('0x20')](function(){_0x3045c9['status'](0xcc)[_0x29c5('0x37')]();});}};}function handleEntityNotFound(_0x228745,_0x3eb5b8){return function(_0x136ade){if(!_0x136ade){_0x228745['sendStatus'](0x194);}return _0x136ade;};}function handleError(_0x10b2be,_0x58d653){_0x58d653=_0x58d653||0x1f4;return function(_0x4e6e9e){logger[_0x29c5('0x25')](_0x4e6e9e[_0x29c5('0x38')]);if(_0x4e6e9e[_0x29c5('0x39')]){delete _0x4e6e9e[_0x29c5('0x39')];}_0x10b2be[_0x29c5('0x2b')](_0x58d653)[_0x29c5('0x3a')](_0x4e6e9e);};}function getMustacheRender(_0x30d5e3,_0xec04c6){return Mustache['render'](_0x30d5e3,_['merge'](_0xec04c6[_0x29c5('0x3b')],{'contact':_0xec04c6['contact'],'message':_0xec04c6[_0x29c5('0x28')],'agent':_0xec04c6[_0x29c5('0x3c')],'interaction':_0xec04c6[_0x29c5('0x3d')],'account':_0xec04c6['account']}))||'';}function getInteractionUsers(_0x3985db,_0x3a6398){return new BPromise(function(_0x161446,_0x249142){try{if(_0x3a6398[_0x3985db['id']]){_0x3985db[_0x29c5('0x3e')]=_[_0x29c5('0x3f')](_0x3a6398[_0x3985db['id']],function(_0x31bd0c){return{'id':_0x31bd0c['id'],'fullname':_0x31bd0c[_0x29c5('0x40')]};});}}catch(_0x398b69){_0x249142(_0x398b69);}_0x161446(_0x3985db);});}function getInteractionTags(_0x40df47,_0x5c1865){return new BPromise(function(_0x3ccf57,_0x4be7b0){try{if(_0x40df47[_0x29c5('0x41')]){_0x40df47[_0x29c5('0x42')]=[];_0x40df47[_0x29c5('0x41')][_0x29c5('0x43')](',')[_0x29c5('0x44')](function(_0x28dd44){_0x40df47['Tags'][_0x29c5('0x45')](_0x5c1865[_0x28dd44]);});}delete _0x40df47[_0x29c5('0x41')];}catch(_0x5142d3){_0x4be7b0(_0x5142d3);}_0x3ccf57(_0x40df47);});}function updateChatInteraction(_0x4cfefb,_0x1d9fb3,_0x4730a1){return new BPromise(function(_0x224ea5,_0x3de3f8){return getInteractionUsers(_0x4cfefb,_0x4730a1)[_0x29c5('0x20')](function(_0x1859f9){return getInteractionTags(_0x1859f9,_0x1d9fb3);})[_0x29c5('0x20')](function(_0x33135e){return getStateInteraction(_0x33135e);})[_0x29c5('0x20')](function(_0x1d5735){_0x224ea5(_0x1d5735);})[_0x29c5('0x46')](function(_0x45576a){_0x3de3f8(_0x45576a);});});}function getStateInteraction(_0x3e56bb){return new BPromise(function(_0x1e6840){_0x3e56bb[_0x29c5('0x47')]=0x0;_0x3e56bb[_0x29c5('0x48')]=0x0;_0x3e56bb[_0x29c5('0x49')]=0x0;_0x3e56bb[_0x29c5('0x4a')]=0x0;_0x3e56bb['abandoned']=0x0;_0x3e56bb['total']=0x0;if(!_0x3e56bb['closed']&&!_0x3e56bb['UserId']){_0x3e56bb[_0x29c5('0x47')]+=0x1;}if(!_0x3e56bb['closed']&&_0x3e56bb[_0x29c5('0x4b')]){_0x3e56bb[_0x29c5('0x48')]+=0x1;if(_0x3e56bb[_0x29c5('0x47')]){_0x3e56bb[_0x29c5('0x47')]-=0x1;}}if(_0x3e56bb['closed']&&_0x3e56bb[_0x29c5('0x4c')]===_0x29c5('0x4d')){_0x3e56bb[_0x29c5('0x4d')]+=0x1;if(_0x3e56bb[_0x29c5('0x47')]){_0x3e56bb[_0x29c5('0x47')]-=0x1;}}else if(_0x3e56bb[_0x29c5('0x4e')]&&!_0x3e56bb['UserId']&&_0x3e56bb['disposition']){_0x3e56bb['unmanaged']+=0x1;if(_0x3e56bb[_0x29c5('0x47')]){_0x3e56bb['waiting']-=0x1;}}else if(_0x3e56bb[_0x29c5('0x4e')]&&_0x3e56bb[_0x29c5('0x4b')]){_0x3e56bb[_0x29c5('0x49')]+=0x1;if(_0x3e56bb[_0x29c5('0x48')]){_0x3e56bb[_0x29c5('0x48')]-=0x1;}}_0x3e56bb[_0x29c5('0x4f')]+=0x1;_0x1e6840(_0x3e56bb);});}exports['index']=function(_0x1c7f97,_0x290365){var _0x20d8cd={},_0x398d23={},_0x2d35b4={'count':0x0,'rows':[]};var _0x228e74=_[_0x29c5('0x3f')](db[_0x29c5('0x50')]['rawAttributes'],function(_0x25d343){return{'name':_0x25d343[_0x29c5('0x51')],'type':_0x25d343['type']['key']};});_0x398d23[_0x29c5('0x52')]=_['map'](_0x228e74,_0x29c5('0x39'));_0x398d23[_0x29c5('0x53')]=_[_0x29c5('0x54')](_0x1c7f97[_0x29c5('0x53')]);_0x398d23[_0x29c5('0x55')]=_[_0x29c5('0x56')](_0x398d23[_0x29c5('0x52')],_0x398d23[_0x29c5('0x53')]);_0x20d8cd[_0x29c5('0x57')]=_[_0x29c5('0x56')](_0x398d23[_0x29c5('0x52')],qs['fields'](_0x1c7f97[_0x29c5('0x53')]['fields']));_0x20d8cd[_0x29c5('0x57')]=_0x20d8cd[_0x29c5('0x57')][_0x29c5('0x58')]?_0x20d8cd['attributes']:_0x398d23['model'];if(!_0x1c7f97[_0x29c5('0x53')][_0x29c5('0x59')](_0x29c5('0x5a'))){_0x20d8cd['limit']=qs['limit'](_0x1c7f97[_0x29c5('0x53')]['limit']);_0x20d8cd[_0x29c5('0x2f')]=qs[_0x29c5('0x2f')](_0x1c7f97[_0x29c5('0x53')][_0x29c5('0x2f')]);}_0x20d8cd[_0x29c5('0x5b')]=qs[_0x29c5('0x5c')](_0x1c7f97[_0x29c5('0x53')][_0x29c5('0x5c')]);_0x20d8cd['where']=qs[_0x29c5('0x55')](_[_0x29c5('0x5d')](_0x1c7f97[_0x29c5('0x53')],_0x398d23[_0x29c5('0x55')]),_0x228e74);var _0x509f32=[];var _0x52db02=squel[_0x29c5('0x5e')]()[_0x29c5('0x5f')]('id')[_0x29c5('0x5f')](_0x29c5('0x39'))[_0x29c5('0x5f')](_0x29c5('0x60'))[_0x29c5('0x61')]('tools_tags');var _0x2ee7de=squel['select']()[_0x29c5('0x5f')](_0x29c5('0x62'))[_0x29c5('0x5f')](_0x29c5('0x63'))['field']('ui.ChatInteractionId')['from'](_0x29c5('0x64'),'ui')[_0x29c5('0x65')](_0x29c5('0x66'),'u',_0x29c5('0x67'));var _0xd10195=squel[_0x29c5('0x5e')]()['from']('chat_interactions','i')['left_join']('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x29c5('0x65')]('users','o',_0x29c5('0x68'))[_0x29c5('0x65')](_0x29c5('0x69'),'a',_0x29c5('0x6a'))[_0x29c5('0x65')]('chat_messages','me',_0x29c5('0x6b'))[_0x29c5('0x65')](_0x29c5('0x6c'),'it',_0x29c5('0x6d'))[_0x29c5('0x65')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x3ad674=squel[_0x29c5('0x6e')]();var _0xed9fda=[];var _0x1e99d7=squel[_0x29c5('0x6e')]();var _0x119a6c;if(_0x1c7f97[_0x29c5('0x53')][_0x29c5('0x6f')]){_0x119a6c=as[_0x29c5('0x70')](_0x1c7f97[_0x29c5('0x53')]['search']);var _0x5f1db2=_0x119a6c['sqlOperator'];for(var _0x41ae84=0x0;_0x41ae84<_0x119a6c[_0x29c5('0x71')]['length'];_0x41ae84++){var _0x26877d=_0x119a6c['conditions'][_0x41ae84];var _0x3c90c3='i';var _0x11182e=_[_0x29c5('0x72')](_0x228e74,['name',_0x26877d[_0x29c5('0x5f')]]);if(!_0x11182e){switch(_0x26877d[_0x29c5('0x5f')]){case _0x29c5('0x73'):if(_0x26877d['value']==0x1){_0xd10195[_0x29c5('0x74')]('`'+_0x26877d[_0x29c5('0x5f')]+_0x29c5('0x75'));}else{_0xd10195[_0x29c5('0x74')]('`'+_0x26877d[_0x29c5('0x5f')]+_0x29c5('0x76'));}break;case _0x29c5('0x77'):if(_0x26877d[_0x29c5('0x78')]==='$substring'){if(_0x26877d[_0x29c5('0x79')][_0x29c5('0x43')]('\x20')[_0x29c5('0x58')]>0x1){_0x3ad674[_0x5f1db2](_0x29c5('0x7a'),qs[_0x29c5('0x7b')](_0x26877d[_0x29c5('0x79')]),null);}else{var _0xc08353='%'+_0x26877d[_0x29c5('0x79')]+'%';_0x3ad674[_0x5f1db2]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0xc08353,_0xc08353,_0xc08353);}}else{_0x11182e=_[_0x29c5('0x72')](_0x228e74,['name',_0x29c5('0x7c')]);_0x26877d[_0x29c5('0x5f')]=_0x29c5('0x7c');_0x37da6f=as[_0x29c5('0x7d')](_0x3c90c3,_0x11182e[_0x29c5('0x7e')],_0x26877d);_0x3ad674[_0x5f1db2](_0x37da6f[_0x29c5('0x7f')],_0x37da6f['value']['start'],_0x37da6f[_0x29c5('0x79')][_0x29c5('0x37')]);}break;case _0x29c5('0x80'):var _0x384c07=_0x26877d['value'][_0x29c5('0x43')](',')[_0x29c5('0x3f')](function(_0x4e7218){return Number(_0x4e7218);});_0x384c07[_0x29c5('0x44')](function(_0x5db105){_0x1e99d7['or'](_0x29c5('0x81'),'%,'+_0x5db105+',%');});_0xed9fda=_[_0x29c5('0x82')](_0xed9fda,_0x384c07);break;case _0x29c5('0x83'):if(_0x26877d[_0x29c5('0x78')]===_0x29c5('0x84')){_0x3ad674[_0x5f1db2](_0x29c5('0x85'),'%'+_0x26877d[_0x29c5('0x79')]+'%',null);}else{_0x11182e=_[_0x29c5('0x72')](_0x228e74,[_0x29c5('0x39'),_0x29c5('0x4b')]);_0x26877d[_0x29c5('0x5f')]=_0x29c5('0x4b');_0x37da6f=as[_0x29c5('0x7d')](_0x3c90c3,_0x11182e[_0x29c5('0x7e')],_0x26877d);_0x3ad674[_0x5f1db2](_0x37da6f['text'],_0x37da6f[_0x29c5('0x79')][_0x29c5('0x86')],_0x37da6f[_0x29c5('0x79')]['end']);}break;case'body':_0x37da6f=as['buildExpression']('me',null,_0x26877d);_0x3ad674[_0x5f1db2](_0x37da6f[_0x29c5('0x7f')],_0x37da6f[_0x29c5('0x79')][_0x29c5('0x86')],_0x37da6f['value']['end']);break;}}else{var _0x37da6f=as[_0x29c5('0x7d')](_0x3c90c3,_0x11182e['type'],_0x26877d);_0x3ad674[_0x5f1db2](_0x37da6f[_0x29c5('0x7f')],_0x37da6f[_0x29c5('0x79')]['start'],_0x37da6f[_0x29c5('0x79')][_0x29c5('0x37')]);}}}else{var _0x19335c=_(_0x1c7f97[_0x29c5('0x53')])[_0x29c5('0x54')]()[_0x29c5('0x3f')](function(_0x3e053f){return _[_0x29c5('0x87')](_0x228e74,[_0x29c5('0x39'),_0x3e053f])?_0x3e053f:undefined;})[_0x29c5('0x88')]()[_0x29c5('0x79')]();if(!_[_0x29c5('0x89')](_0x19335c)){_0x19335c[_0x29c5('0x44')](function(_0x441384){if(_0x441384===_0x29c5('0x8a')){_0xd10195[_0x29c5('0x8b')](_0x29c5('0x8c'),[][_0x29c5('0x8d')](_0x1c7f97[_0x29c5('0x53')][_0x441384]));}else if(_0x441384===_0x29c5('0x8e')){var _0xdd8451=JSON['parse'](_0x1c7f97[_0x29c5('0x53')][_0x441384])[_0x29c5('0x8f')];var _0x50ff2a=JSON[_0x29c5('0x90')](_0x1c7f97[_0x29c5('0x53')][_0x441384])[_0x29c5('0x91')];_0xd10195[_0x29c5('0x8b')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xdd8451,_0x50ff2a);}else{if(_0x1c7f97['query'][_0x441384]==='null'){_0xd10195[_0x29c5('0x8b')]('i.'+_0x441384+_0x29c5('0x92'));}else{_0xd10195[_0x29c5('0x8b')]('i.'+_0x441384+_0x29c5('0x93'),_0x1c7f97['query'][_0x441384]);}}});}if(_0x1c7f97['query']['read']){if(_0x1c7f97[_0x29c5('0x53')][_0x29c5('0x94')]==0x1){_0xd10195['having'](_0x29c5('0x95'));}else{_0xd10195[_0x29c5('0x74')](_0x29c5('0x96'));}}if(_0x1c7f97[_0x29c5('0x53')][_0x29c5('0x97')]){_0xed9fda=_[_0x29c5('0x98')](_0x1c7f97[_0x29c5('0x53')][_0x29c5('0x97')])?_0x1c7f97['query'][_0x29c5('0x97')]:new Array(_0x1c7f97['query'][_0x29c5('0x97')]);_0xed9fda[_0x29c5('0x44')](function(_0x512809){_0x1e99d7['or'](_0x29c5('0x81'),'%,'+_0x512809+',%');});}if(_0x1c7f97[_0x29c5('0x53')][_0x29c5('0x99')]){var _0x554130=_0x1c7f97[_0x29c5('0x53')]['filter'][_0x29c5('0x9a')]('\x5c','\x5c\x5c')[_0x29c5('0x9a')](/'/g,'\x27\x27');if(qs[_0x29c5('0x9b')](_0x554130)){_0x3ad674['or'](_0x29c5('0x9c'),_0x554130+'%');}else{_0x3ad674['or'](_0x29c5('0x9d'),qs[_0x29c5('0x7b')](_0x554130))['or'](_0x29c5('0x9e'),_0x554130+'%');}}}_0xd10195[_0x29c5('0x8b')](_0x3ad674);_0xd10195[_0x29c5('0x9f')](_0x29c5('0xa0'));var _0x444dfe={'type':db[_0x29c5('0xa1')]['QueryTypes'][_0x29c5('0xa2')],'raw':!![]};var _0x438511=_0xd10195['clone']();_0x438511[_0x29c5('0x5f')](_0x29c5('0xa0'));_0x438511['field'](_0x29c5('0xa3'),_0x29c5('0x73'));if(_0x20d8cd[_0x29c5('0x5b')]){_0x20d8cd['order'][_0x29c5('0x44')](function(_0x3ac49a){var _0x2976cf=_0x3ac49a[0x0]===_0x29c5('0xa4')?_0x3ac49a[0x0]:'i.'+_0x3ac49a[0x0];_0xd10195[_0x29c5('0x5b')](_0x2976cf,_0x3ac49a[0x1]===_0x29c5('0xa5')?![]:!![]);});}if(!_[_0x29c5('0x89')](_0xed9fda)){_0xd10195[_0x29c5('0x74')](_0x1e99d7);_0x438511[_0x29c5('0x8b')]('t.id\x20IN\x20?',_0xed9fda);}BPromise[_0x29c5('0xa6')]()['then'](function(){if(!_0x119a6c){if(_0x1c7f97['query'][_0x29c5('0x8a')])return;_0x438511[_0x29c5('0x8b')](_0x29c5('0xa7'));_0xd10195['where'](_0x29c5('0xa7'));return;}if(_0x1c7f97[_0x29c5('0xa8')][_0x29c5('0xa9')]!==_0x29c5('0x3c'))return;return _0x1c7f97[_0x29c5('0xa8')]['getChatWebsites']({'attributes':['id'],'raw':!![]})[_0x29c5('0x20')](function(_0x2acb39){if(_[_0x29c5('0x89')](_0x2acb39)){_0x438511[_0x29c5('0x8b')]('i.ChatWebsiteId\x20IS\x20NULL');_0xd10195['where']('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x438511[_0x29c5('0x8b')](_0x29c5('0x8c'),_['map'](_0x2acb39,'id'));_0xd10195['where'](_0x29c5('0x8c'),_['map'](_0x2acb39,'id'));}});})[_0x29c5('0x20')](function(){if(_0x1c7f97[_0x29c5('0xa8')]['role']==='agent'&&!_0x119a6c&&!_0x1c7f97[_0x29c5('0x53')][_0x29c5('0x8a')])return[];return db[_0x29c5('0xaa')][_0x29c5('0x53')](_0x438511[_0x29c5('0xab')](),_0x444dfe);})[_0x29c5('0x20')](function(_0x2e6f84){_0x2d35b4['count']=_0x2e6f84[_0x29c5('0x58')];if(_0x2d35b4['count']===0x0)return[];return db[_0x29c5('0xaa')][_0x29c5('0x53')](_0x52db02[_0x29c5('0xab')](),_0x444dfe)[_0x29c5('0x20')](function(_0xaf6c5c){_0x509f32=_[_0x29c5('0xac')](_0xaf6c5c,'id');_0x444dfe=_[_0x29c5('0xad')](_0x444dfe,{'model':db[_0x29c5('0x50')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1c7f97[_0x29c5('0x53')]['fields']){_0x20d8cd[_0x29c5('0x57')][_0x29c5('0x44')](function(_0x2ef23c){_0xd10195[_0x29c5('0x5f')]('i.'+_0x2ef23c);});}else{_0xd10195[_0x29c5('0x5f')](_0x29c5('0xa3'),_0x29c5('0x73'));_0xd10195['field']('a.key',_0x29c5('0xae'));_0xd10195[_0x29c5('0x5f')](_0x29c5('0xaf'),_0x29c5('0xb0'));_0xd10195['field'](_0x29c5('0xb1'),'contactName');_0xd10195[_0x29c5('0x5f')](_0x29c5('0xb2'));_0xd10195[_0x29c5('0x5f')](_0x29c5('0xb3'),_0x29c5('0xb4'));_0xd10195[_0x29c5('0x5f')](_0x29c5('0xb5'),_0x29c5('0xb6'));_0xd10195['field'](_0x29c5('0xb7'),_0x29c5('0xb8'));_0xd10195[_0x29c5('0x5f')](_0x29c5('0xb9'),'Contact.phone');_0xd10195[_0x29c5('0x5f')](_0x29c5('0xba'),_0x29c5('0xbb'));_0xd10195[_0x29c5('0x5f')]('c.fax',_0x29c5('0xbc'));_0xd10195[_0x29c5('0x5f')](_0x29c5('0xbd'),'Owner.fullname');_0xd10195[_0x29c5('0x5f')]('o.internal',_0x29c5('0xbe'));_0xd10195['field'](_0x29c5('0xbf'),'TagIds');}if(_0x20d8cd[_0x29c5('0x2e')])_0xd10195[_0x29c5('0x2e')](_0x20d8cd['limit']);if(_0x20d8cd['offset'])_0xd10195[_0x29c5('0x2f')](_0x20d8cd['offset']);return db['sequelize']['query'](_0xd10195[_0x29c5('0xab')](),_0x444dfe);})[_0x29c5('0x20')](function(_0x50b657){if(_0x50b657[_0x29c5('0x58')]>0x0)_0x2ee7de['where'](_0x29c5('0xc0'),_[_0x29c5('0x3f')](_0x50b657,'id'));return db[_0x29c5('0xaa')][_0x29c5('0x53')](_0x2ee7de[_0x29c5('0xab')](),_0x444dfe)[_0x29c5('0x20')](function(_0x754195){var _0x32857c=_['groupBy'](_0x754195,_0x29c5('0xc1'));var _0x5cc9c7=[];_0x50b657[_0x29c5('0x44')](function(_0x111b3d){_0x5cc9c7[_0x29c5('0x45')](updateChatInteraction(_0x111b3d,_0x509f32,_0x32857c));});return BPromise[_0x29c5('0xc2')](_0x5cc9c7);});});})[_0x29c5('0x20')](function(_0x5231ee){_0x2d35b4['rows']=_0x5231ee;return _0x2d35b4;})[_0x29c5('0x20')](respondWithFilteredResult(_0x290365,_0x20d8cd))[_0x29c5('0x46')](handleError(_0x290365,null));};exports['show']=function(_0x4ca72d,_0x48dfbf){var _0x40ce22={'raw':![],'where':{'id':_0x4ca72d[_0x29c5('0xc3')]['id']}},_0x2bcece={};_0x2bcece[_0x29c5('0x52')]=_['keys'](db[_0x29c5('0x50')][_0x29c5('0xc4')]);_0x2bcece[_0x29c5('0x53')]=_['keys'](_0x4ca72d[_0x29c5('0x53')]);_0x2bcece['filters']=_['intersection'](_0x2bcece[_0x29c5('0x52')],_0x2bcece[_0x29c5('0x53')]);_0x40ce22[_0x29c5('0x57')]=_[_0x29c5('0x56')](_0x2bcece[_0x29c5('0x52')],qs[_0x29c5('0xc5')](_0x4ca72d['query']['fields']));_0x40ce22[_0x29c5('0x57')]=_0x40ce22[_0x29c5('0x57')]['length']?_0x40ce22[_0x29c5('0x57')]:_0x2bcece['model'];if(_0x4ca72d[_0x29c5('0x53')][_0x29c5('0xc6')]){_0x40ce22[_0x29c5('0xc7')]=[{'all':!![]}];}_0x40ce22=_[_0x29c5('0xad')]({},_0x40ce22,_0x4ca72d['options']);return db[_0x29c5('0x50')][_0x29c5('0x72')](_0x40ce22)[_0x29c5('0x20')](handleEntityNotFound(_0x48dfbf,null))[_0x29c5('0x20')](respondWithResult(_0x48dfbf,null))['catch'](handleError(_0x48dfbf,null));};exports[_0x29c5('0xc8')]=function(_0x10096f,_0x49716a){return db[_0x29c5('0x50')][_0x29c5('0xc8')](_0x10096f[_0x29c5('0x3b')],{})['then'](respondWithResult(_0x49716a,0xc9))[_0x29c5('0x46')](handleError(_0x49716a,null));};exports[_0x29c5('0x35')]=function(_0x363c6b,_0x41ee3a){if(_0x363c6b['body']['id']){delete _0x363c6b[_0x29c5('0x3b')]['id'];}return db[_0x29c5('0x50')][_0x29c5('0x72')]({'where':{'id':_0x363c6b[_0x29c5('0xc3')]['id']}})[_0x29c5('0x20')](handleEntityNotFound(_0x41ee3a,null))[_0x29c5('0x20')](saveUpdates(_0x363c6b['body'],null))['then'](respondWithResult(_0x41ee3a,null))[_0x29c5('0x46')](handleError(_0x41ee3a,null));};exports[_0x29c5('0x36')]=function(_0x56ce75,_0x8e5c57){return db[_0x29c5('0x50')]['find']({'where':{'id':_0x56ce75[_0x29c5('0xc3')]['id']}})[_0x29c5('0x20')](handleEntityNotFound(_0x8e5c57,null))[_0x29c5('0x20')](removeEntity(_0x8e5c57,null))[_0x29c5('0x46')](handleError(_0x8e5c57,null));};exports[_0x29c5('0xc9')]=function(_0x5f5b0a,_0x19df66){return db[_0x29c5('0x50')][_0x29c5('0xc9')]()['then'](respondWithResult(_0x19df66,null))['catch'](handleError(_0x19df66,null));};exports[_0x29c5('0xca')]=function(_0x897623,_0x5c1d8b){var _0x58d632=_0x897623[_0x29c5('0xc3')]['id'];var _0x43a45a;var _0x23b2bb;var _0x4bc7b1;return db[_0x29c5('0x50')]['findOne']({'where':{'id':_0x58d632}})[_0x29c5('0x20')](function(_0x2f77aa){_0x43a45a=_0x2f77aa;return db[_0x29c5('0xcb')][_0x29c5('0xcc')]({'where':{'id':_0x2f77aa[_0x29c5('0x8a')]},'attributes':['id',_0x29c5('0xcd'),'vidaooEscalation','vidaooTopic',_0x29c5('0xce'),'vidaooMetadata'],'raw':!![]});})['then'](function(_0x33bbeb){if(_0x33bbeb&&_0x33bbeb[_0x29c5('0xcd')]&&_0x33bbeb[_0x29c5('0xcf')]){_0x23b2bb=_0x33bbeb;var _0x336930={'interaction':{'id':_0x58d632},'agent':{'id':_0x897623[_0x29c5('0xa8')]['id'],'name':_0x897623[_0x29c5('0xa8')]['name'],'fullname':_0x897623[_0x29c5('0xa8')]['fullname'],'email':_0x897623[_0x29c5('0xa8')]['email']},'contact':_0x897623[_0x29c5('0x3b')]['contact'],'account':_0x897623['body'][_0x29c5('0xd0')]};var _0x5573f5={'rejectUnauthorized':![],'method':_0x29c5('0xd1'),'url':_0x29c5('0xd2'),'headers':{'X-APIKEY':_0x33bbeb['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x897623['user'][_0x29c5('0xd3')]],'buttons':null,'topic':_0x23b2bb[_0x29c5('0xd4')],'note':_[_0x29c5('0xd5')](_0x23b2bb[_0x29c5('0xce')])?null:getMustacheRender(_0x23b2bb[_0x29c5('0xce')],_0x336930),'metadata':null},'redirect':_0x29c5('0xd6'),'json':!![]};try{if(!_[_0x29c5('0xd5')](_0x23b2bb['vidaooMetadata'])){var _0xa53b66=getMustacheRender(_0x23b2bb['vidaooMetadata'],_0x336930);var _0xc17fd8=JSON[_0x29c5('0x90')](_0xa53b66);_0x5573f5[_0x29c5('0x3b')][_0x29c5('0xd7')]=_0xc17fd8;}}catch(_0x513880){throw new db[(_0x29c5('0xa1'))][(_0x29c5('0xd8'))](_0x29c5('0xd9'));}return rp(_0x5573f5);}else{throw new db['Sequelize']['ValidationError'](_0x29c5('0xda'));}})[_0x29c5('0x20')](function(_0x5eccb7){_0x4bc7b1=_0x5eccb7;if(_0x4bc7b1['id']){var _0x10d1a4={'body':_0x4bc7b1[_0x29c5('0xdb')],'ChatWebsiteId':_0x23b2bb['id'],'ChatInteractionId':_0x43a45a['id'],'direction':_0x29c5('0xdc'),'UserId':_0x897623[_0x29c5('0xa8')]['id']};return db['ChatMessage'][_0x29c5('0xc8')](_0x10d1a4,{});}else{throw new db[(_0x29c5('0xa1'))][(_0x29c5('0xd8'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x29c5('0x20')](function(){return _0x43a45a[_0x29c5('0xdd')]({'vidaooSessionId':_0x4bc7b1['id']});})['then'](respondWithResult(_0x5c1d8b,null))[_0x29c5('0x46')](handleError(_0x5c1d8b,null));};exports[_0x29c5('0xde')]=function(_0x1b62e0,_0x56868c){if(_0x1b62e0[_0x29c5('0x3b')]['id']){delete _0x1b62e0[_0x29c5('0x3b')]['id'];}return db[_0x29c5('0x50')][_0x29c5('0x72')]({'where':{'id':_0x1b62e0[_0x29c5('0xc3')]['id']},'include':[{'model':db[_0x29c5('0xdf')],'as':_0x29c5('0x77')}]})[_0x29c5('0x20')](handleEntityNotFound(_0x56868c,null))[_0x29c5('0x20')](saveUpdates(_0x1b62e0[_0x29c5('0x3b')],null))[_0x29c5('0x20')](respondWithResult(_0x56868c,null))[_0x29c5('0x46')](handleError(_0x56868c,null));};exports['abandon']=function(_0x376eba,_0x299bba,_0x6e9b29){if(_0x376eba[_0x29c5('0x3b')]['id']){delete _0x376eba['body']['id'];}return db[_0x29c5('0x50')]['find']({'where':{'id':_0x376eba['params']['id']}})[_0x29c5('0x20')](function(_0x259c26){if(!_0x259c26){logger[_0x29c5('0x25')](_0x29c5('0xe0'),_0x29c5('0xe1'),0x194,'entity\x20not\x20found');_0x299bba['sendStatus'](0x194);}else{if(_0x259c26[_0x29c5('0x4b')]){throw new db['Sequelize'][(_0x29c5('0xd8'))](_0x29c5('0xe2'));}}return _0x259c26;})[_0x29c5('0x20')](function(_0x2835ac){if(_0x2835ac){return _0x2835ac[_0x29c5('0x35')]({'closed':_0x376eba['body'][_0x29c5('0x4e')],'disposition':_0x376eba[_0x29c5('0x3b')][_0x29c5('0x4c')]})['then'](function(_0x345215){return _0x345215;});}})[_0x29c5('0x20')](function(_0x2e5e94){return respondWithRpcPromise('AbandonInteraction',_0x29c5('0xe1'),_0x376eba[_0x29c5('0x3b')],client9004);})[_0x29c5('0x20')](respondWithResult(_0x299bba,null))[_0x29c5('0x46')](handleError(_0x299bba,null));};exports[_0x29c5('0xe3')]=function(_0x35c8d5,_0xd54815,_0x5ad08d){_0x35c8d5[_0x29c5('0x3b')][_0x29c5('0x39')]=_0x35c8d5[_0x29c5('0xe4')]['originalname'];_0x35c8d5['body'][_0x29c5('0xe5')]=_0x35c8d5[_0x29c5('0xe4')][_0x29c5('0xe6')];_0x35c8d5[_0x29c5('0x3b')][_0x29c5('0x7e')]=_0x35c8d5[_0x29c5('0xe4')]['mimetype'];return db['Attachment'][_0x29c5('0xc8')](_0x35c8d5[_0x29c5('0x3b')])[_0x29c5('0x20')](respondWithResult(_0xd54815,0xc9))[_0x29c5('0x46')](handleError(_0xd54815,null));};exports[_0x29c5('0xe7')]=function(_0x51c0b0,_0xbf0a9c,_0x711f02){return db[_0x29c5('0x50')]['findOne']({'where':{'id':_0x51c0b0['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0xbf0a9c,null))[_0x29c5('0x20')](function(_0x59ae6a){if(_0x59ae6a){if(_0x59ae6a[_0x29c5('0x4e')]){return _0xbf0a9c[_0x29c5('0x2b')](0x193)[_0x29c5('0x2c')]({'status':0x193,'message':_0x29c5('0xe8')});}return db[_0x29c5('0xe9')]['findOne']({'where':{'id':_0x51c0b0[_0x29c5('0x53')][_0x29c5('0xea')]},'raw':!![]})[_0x29c5('0x20')](handleEntityNotFound(_0xbf0a9c,null));}})[_0x29c5('0x20')](function(_0x431423){if(_0x431423){var _0x3055e4=_0x431423[_0x29c5('0xeb')]!==null;var _0x5e7266=path[_0x29c5('0xec')](config[_0x29c5('0xed')],'server/files/attachments/');if(_0x3055e4){_0x5e7266=path['join'](_0x5e7266,'offline-chat/');}var _0x3f6820=path[_0x29c5('0xec')](_0x5e7266,_0x431423[_0x29c5('0xe5')]);return _0xbf0a9c[_0x29c5('0xee')](_0x3f6820);}})[_0x29c5('0x46')](handleError(_0xbf0a9c,null));};exports[_0x29c5('0xef')]=function(_0x2b5256,_0x3c281b){var _0x1f67a2=null;var _0x4f6e02=null;var _0x35aba2=null;var _0x140e49=null;if(_0x2b5256[_0x29c5('0x3b')]['id']){delete _0x2b5256['body']['id'];}if(_0x2b5256['body'][_0x29c5('0xf0')]){_0x140e49=path[_0x29c5('0xec')](config[_0x29c5('0xed')],_0x29c5('0xf1'),util['format'](_0x29c5('0xf2'),Date[_0x29c5('0xf3')]()));_0x2b5256['body']['pathTranscript']=_0x140e49;}return db[_0x29c5('0x50')][_0x29c5('0x72')]({'where':{'id':_0x2b5256['params']['id']},'include':[{'model':db['ChatMessage'],'as':_0x29c5('0xf4'),'include':[{'model':db['User'],'as':'User'}]}]})[_0x29c5('0x20')](handleEntityNotFound(_0x3c281b,null))[_0x29c5('0x20')](saveUpdates(_0x2b5256[_0x29c5('0x3b')],null))[_0x29c5('0x20')](function(_0x1ba7ae){if(_0x1ba7ae){_0x1f67a2=_0x1ba7ae;return db[_0x29c5('0xcb')][_0x29c5('0x72')]({'where':{'id':_0x1f67a2[_0x29c5('0x8a')]}});}})[_0x29c5('0x20')](function(_0x358742){if(_0x358742){_0x35aba2=_0x358742;return db[_0x29c5('0xdf')][_0x29c5('0x72')]({'where':{'id':_0x1f67a2['ContactId']}});}})[_0x29c5('0x20')](function(_0x39d3ea){if(_0x39d3ea){_0x4f6e02=_0x39d3ea;if(_0x140e49){var _0x3deed7=null;for(var _0x45b778=0x1;_0x45b778<_0x1f67a2[_0x29c5('0xf4')][_0x29c5('0x58')];++_0x45b778){_0x3deed7=_0x1f67a2[_0x29c5('0xf4')][_0x45b778];var _0x60b655=_0x3deed7[_0x29c5('0x4b')]?util[_0x29c5('0xf5')](_0x29c5('0xf6'),_0x35aba2[_0x29c5('0xf7')],_0x3deed7[_0x29c5('0x4b')]):_0x29c5('0xf8');var _0x4b1199=_0x2b5256[_0x29c5('0x3b')][_0x29c5('0xf9')]||util['format'](_0x29c5('0xf6'),'Visitor',_0x3deed7[_0x29c5('0x7c')]);switch(_0x35aba2['agentIdentifier']){case _0x29c5('0xfa'):_0x60b655=_0x3deed7[_0x29c5('0x4b')]?util[_0x29c5('0xf5')](_0x29c5('0xf6'),_0x35aba2[_0x29c5('0xf7')],_0x3deed7['UserId']):_0x29c5('0xf8');break;case _0x29c5('0xfb'):_0x60b655=_0x3deed7[_0x29c5('0x4b')]?_0x3deed7[_0x29c5('0x83')][_0x29c5('0xfc')]||_0x3deed7[_0x29c5('0x83')]['fullname']:_0x29c5('0xf8');break;case _0x29c5('0xfd'):_0x60b655=_0x3deed7[_0x29c5('0x4b')]?_0x3deed7[_0x29c5('0x83')]['fullname']:_0x29c5('0xf8');break;default:_0x60b655=_0x3deed7['UserId']?util[_0x29c5('0xf5')](_0x29c5('0xf6'),_0x35aba2[_0x29c5('0xf7')],_0x3deed7[_0x29c5('0x4b')]):_0x29c5('0xf8');}var _0x2c0f54=util[_0x29c5('0xf5')](_0x29c5('0xfe'),moment(_0x3deed7[_0x29c5('0x8e')])[_0x29c5('0xf5')](_0x29c5('0xff')),_0x3deed7[_0x29c5('0x100')]==='in'?_0x4b1199:_0x60b655,_0x3deed7['body']);if(!_0x3deed7[_0x29c5('0x101')]){fs[_0x29c5('0x102')](_0x140e49,_0x2c0f54);}}return db[_0x29c5('0x103')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x29c5('0x104')],'as':_0x29c5('0x105'),'raw':!![]}]});}}})['then'](function(_0x3387f1){if(_0x3387f1&&_0x3387f1['Smtp']&&_0x2b5256[_0x29c5('0x3b')]){var _0x5c910a={'tls':{'rejectUnauthorized':![]}};if(_0x3387f1['Smtp'][_0x29c5('0x106')]){_0x5c910a['service']=_0x3387f1[_0x29c5('0x105')][_0x29c5('0x106')];}else{_0x5c910a[_0x29c5('0x107')]=_0x3387f1['Smtp'][_0x29c5('0x107')];_0x5c910a[_0x29c5('0x108')]=_0x3387f1[_0x29c5('0x105')][_0x29c5('0x108')];_0x5c910a[_0x29c5('0x109')]=_0x3387f1[_0x29c5('0x105')][_0x29c5('0x109')];}if(_0x3387f1[_0x29c5('0x105')]['authentication']){_0x5c910a[_0x29c5('0x10a')]={'user':_0x3387f1[_0x29c5('0x105')][_0x29c5('0xa8')],'pass':_0x3387f1[_0x29c5('0x105')]['pass']};}return respondWithRpcPromise(_0x29c5('0x10b'),'sendMail',{'account':_0x5c910a,'message':{'from':util[_0x29c5('0xf5')]('\x22%s\x22\x20<%s>',_0x3387f1[_0x29c5('0x39')],_0x3387f1['email']||_0x3387f1[_0x29c5('0x105')]['user']),'to':_0x2b5256[_0x29c5('0x3b')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util[_0x29c5('0xf5')](_0x29c5('0x10c'),_0x2b5256['body']['mailTranscript']),'attachments':[{'path':_0x140e49}]}})[_0x29c5('0x20')](function(){return _0x1f67a2;})['catch'](function(_0x17c418){console['error'](_0x17c418);});}else{return _0x1f67a2;}})[_0x29c5('0x20')](respondWithStatusCode(_0x3c281b,0xc8))[_0x29c5('0x46')](handleError(_0x3c281b,null));};exports[_0x29c5('0x10d')]=function(_0x2ef475,_0x305fef,_0x34a24e){return db[_0x29c5('0x10e')][_0x29c5('0x72')]({'where':{'id':_0x2ef475[_0x29c5('0xc3')]['id']}})[_0x29c5('0x20')](handleEntityNotFound(_0x305fef,null))[_0x29c5('0x20')](function(_0x1365ad){if(_0x1365ad){return _0x1365ad[_0x29c5('0x10d')](_0x2ef475['body'][_0x29c5('0x10f')],_[_0x29c5('0x110')](_0x2ef475['body'],[_0x29c5('0x10f'),'id'])||{});}})[_0x29c5('0x20')](respondWithResult(_0x305fef,null))['catch'](handleError(_0x305fef,null));};exports[_0x29c5('0x111')]=function(_0x346f89,_0x390f13,_0x2e7f6c){var _0x4211dd={'raw':![],'where':{}};var _0x12ca08={};var _0x51d2c6={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x29c5('0xcc')]({'where':{'id':_0x346f89[_0x29c5('0xc3')]['id']}})[_0x29c5('0x20')](handleEntityNotFound(_0x390f13,null))[_0x29c5('0x20')](function(_0x203600){if(_0x203600){_0x12ca08['model']=_['keys'](db[_0x29c5('0x10e')][_0x29c5('0xc4')]);_0x12ca08[_0x29c5('0x53')]=_['keys'](_0x346f89[_0x29c5('0x53')]);_0x12ca08[_0x29c5('0x55')]=_['intersection'](_0x12ca08[_0x29c5('0x52')],_0x12ca08[_0x29c5('0x53')]);_0x4211dd[_0x29c5('0x57')]=_[_0x29c5('0x56')](_0x12ca08[_0x29c5('0x52')],qs[_0x29c5('0xc5')](_0x346f89['query']['fields']));_0x4211dd['attributes']=_0x4211dd[_0x29c5('0x57')]['length']?_0x4211dd[_0x29c5('0x57')]:_0x12ca08[_0x29c5('0x52')];if(!_0x346f89[_0x29c5('0x53')]['hasOwnProperty'](_0x29c5('0x5a'))){_0x4211dd[_0x29c5('0x2e')]=qs[_0x29c5('0x2e')](_0x346f89['query'][_0x29c5('0x2e')]);_0x4211dd[_0x29c5('0x2f')]=qs[_0x29c5('0x2f')](_0x346f89[_0x29c5('0x53')][_0x29c5('0x2f')]);}_0x4211dd['order']=qs[_0x29c5('0x5c')](_0x346f89['query']['sort']);_0x4211dd[_0x29c5('0x8b')]=qs[_0x29c5('0x55')](_[_0x29c5('0x5d')](_0x346f89[_0x29c5('0x53')],_0x12ca08['filters']));_0x4211dd[_0x29c5('0x8b')][_0x29c5('0xc1')]=_0x203600['id'];if(_0x346f89[_0x29c5('0x53')][_0x29c5('0x99')]){_0x4211dd[_0x29c5('0x8b')]=_[_0x29c5('0xad')](_0x4211dd[_0x29c5('0x8b')],{'$or':_[_0x29c5('0x3f')](_0x4211dd[_0x29c5('0x57')],function(_0x1fe20c){var _0x977ccf={};_0x977ccf[_0x1fe20c]={'$like':'%'+_0x346f89[_0x29c5('0x53')][_0x29c5('0x99')]+'%'};return _0x977ccf;})});}if(_0x346f89[_0x29c5('0x53')][_0x29c5('0x8f')]){var _0x330f86=_0x346f89[_0x29c5('0x53')]['$gte'][_0x29c5('0x43')](',');var _0x3f5fd3={};_0x3f5fd3[_0x330f86[0x0]]={'$gte':moment(_0x330f86[0x1])[_0x29c5('0xf5')](_0x29c5('0x112'))};_0x4211dd[_0x29c5('0x8b')]=_[_0x29c5('0xad')](_0x4211dd[_0x29c5('0x8b')],_0x3f5fd3);}_0x4211dd=_[_0x29c5('0xad')]({},_0x4211dd,_0x346f89[_0x29c5('0x113')]);return db[_0x29c5('0x10e')][_0x29c5('0x30')]({'where':_0x4211dd[_0x29c5('0x8b')]})[_0x29c5('0x20')](function(_0x22b7b6){_0x51d2c6['count']=_0x22b7b6;if(_0x346f89['query'][_0x29c5('0xc6')]){_0x4211dd[_0x29c5('0xc7')]=[{'all':!![]}];}return db['ChatMessage'][_0x29c5('0x114')](_0x4211dd);})[_0x29c5('0x20')](function(_0x148366){_0x51d2c6['rows']=_0x148366;return _0x51d2c6;});}})[_0x29c5('0x20')](respondWithFilteredResult(_0x390f13,_0x4211dd))[_0x29c5('0x46')](handleError(_0x390f13,null));};exports[_0x29c5('0x115')]=function(_0x4d49ab,_0x104b6f,_0x134692){var _0x499f6e={'where':{}},_0x4175d3={},_0x552f79={'count':0x0,'rows':[]};return db[_0x29c5('0x50')][_0x29c5('0xcc')]({'where':{'id':_0x4d49ab[_0x29c5('0xc3')]['id']}})[_0x29c5('0x20')](handleEntityNotFound(_0x104b6f,null))[_0x29c5('0x20')](function(_0x3cd134){if(_0x3cd134){_0x4175d3['model']=_['keys'](db['ChatMessage'][_0x29c5('0xc4')]);_0x4175d3[_0x29c5('0x53')]=_[_0x29c5('0x54')](_0x4d49ab[_0x29c5('0x53')]);_0x4175d3['filters']=_[_0x29c5('0x56')](_0x4175d3['model'],_0x4175d3[_0x29c5('0x53')]);_0x499f6e['attributes']=_[_0x29c5('0x56')](_0x4175d3[_0x29c5('0x52')],qs['fields'](_0x4d49ab['query'][_0x29c5('0xc5')]));_0x499f6e['attributes']=_0x499f6e['attributes']['length']?_0x499f6e[_0x29c5('0x57')]:_0x4175d3['model'];if(!_0x4d49ab['query'][_0x29c5('0x59')]('nolimit')){_0x499f6e[_0x29c5('0x2e')]=qs[_0x29c5('0x2e')](_0x4d49ab['query'][_0x29c5('0x2e')]);_0x499f6e[_0x29c5('0x2f')]=qs[_0x29c5('0x2f')](_0x4d49ab['query'][_0x29c5('0x2f')]);}_0x499f6e[_0x29c5('0x5b')]=qs[_0x29c5('0x5c')](_0x4d49ab[_0x29c5('0x53')]['sort']);_0x499f6e[_0x29c5('0x8b')]=qs[_0x29c5('0x55')](_['pick'](_0x4d49ab[_0x29c5('0x53')],_0x4175d3[_0x29c5('0x55')]));_0x499f6e[_0x29c5('0x8b')][_0x29c5('0xc1')]=_0x3cd134['id'];if(_0x4d49ab['query'][_0x29c5('0x99')]){_0x499f6e[_0x29c5('0x8b')]=_['merge'](_0x499f6e[_0x29c5('0x8b')],{'$or':_[_0x29c5('0x3f')](_0x499f6e[_0x29c5('0x57')],function(_0x4d6483){var _0x2dcb4d={};_0x2dcb4d[_0x4d6483]={'$like':'%'+_0x4d49ab[_0x29c5('0x53')][_0x29c5('0x99')]+'%'};return _0x2dcb4d;})});}_0x499f6e['where'][_0x29c5('0x101')]=![];if(_0x4d49ab['query']['id']){_0x499f6e[_0x29c5('0x8b')]['id']={'$gt':_0x4d49ab[_0x29c5('0x53')]['id']};}_0x499f6e=_[_0x29c5('0xad')]({},_0x499f6e,_0x4d49ab[_0x29c5('0x113')]);return db[_0x29c5('0x10e')][_0x29c5('0x30')]({'where':_0x499f6e[_0x29c5('0x8b')]})[_0x29c5('0x20')](function(_0x4b2576){_0x552f79['count']=_0x4b2576;_0x499f6e[_0x29c5('0xc7')]=[];if(_0x4d49ab['query']['includeAgent']){_0x499f6e[_0x29c5('0xc7')][_0x29c5('0x45')]({'model':db[_0x29c5('0x83')],'as':_0x29c5('0x83'),'attributes':['id','fullname','alias']});}if(_0x4d49ab[_0x29c5('0x53')]['includeAll']){_0x499f6e['include']=[{'all':!![]}];}return db[_0x29c5('0x10e')][_0x29c5('0x114')](_0x499f6e);})[_0x29c5('0x20')](function(_0xfc51ce){_0x552f79['rows']=_0xfc51ce;return _0x552f79;});}})[_0x29c5('0x20')](respondWithFilteredResult(_0x104b6f,_0x499f6e))['catch'](handleError(_0x104b6f,null));};exports[_0x29c5('0x116')]=function(_0x191898,_0xd328c9,_0x919451){return db[_0x29c5('0x50')][_0x29c5('0x72')]({'where':{'id':_0x191898[_0x29c5('0xc3')]['id']}})[_0x29c5('0x20')](handleEntityNotFound(_0xd328c9,null))['then'](function(_0x2f4852){if(_0x2f4852){return _0x2f4852['setTags'](_0x191898[_0x29c5('0x3b')][_0x29c5('0x10f')],_[_0x29c5('0x110')](_0x191898[_0x29c5('0x3b')],[_0x29c5('0x10f'),'id'])||{})['spread'](function(){return db[_0x29c5('0x80')][_0x29c5('0x114')]({'attributes':['id',_0x29c5('0x39'),_0x29c5('0x60')],'where':{'id':_0x191898[_0x29c5('0x3b')][_0x29c5('0x10f')]}});})[_0x29c5('0x20')](function(_0x13bd85){socket[_0x29c5('0x117')]('chatInteractionTags:save',{'id':Number(_0x191898[_0x29c5('0xc3')]['id']),'tags':_0x13bd85||[]});return{'id':Number(_0x191898[_0x29c5('0xc3')]['id']),'tags':_0x13bd85||[]};});}})['then'](respondWithResult(_0xd328c9,null))[_0x29c5('0x46')](handleError(_0xd328c9,null));};exports['removeTags']=function(_0x5aed63,_0x39e61a,_0xeff84a){return db['ChatInteraction']['find']({'where':{'id':_0x5aed63[_0x29c5('0xc3')]['id']}})['then'](handleEntityNotFound(_0x39e61a,null))[_0x29c5('0x20')](function(_0x5efc10){if(_0x5efc10){return _0x5efc10[_0x29c5('0x118')](_0x5aed63['query'][_0x29c5('0x10f')]);}})[_0x29c5('0x20')](respondWithStatusCode(_0x39e61a,null))['catch'](handleError(_0x39e61a,null));};exports['download']=function(_0x968c9b,_0x3ca047){var _0x26011d=moment()[_0x29c5('0x119')]()[_0x29c5('0xab')]();var _0x4db50c=path[_0x29c5('0xec')](config[_0x29c5('0xed')],'server',_0x29c5('0x11a'),_0x29c5('0x11b'));var _0x351ac7=path[_0x29c5('0xec')](config[_0x29c5('0xed')],_0x29c5('0x11c'),'files',_0x29c5('0x11d'));var _0x2128a7=path[_0x29c5('0xec')](_0x4db50c,_0x26011d);var _0x555835=util['format']('transcript-%d-%s.zip',_0x968c9b[_0x29c5('0xc3')]['id'],_0x26011d);var _0x2a259a=path[_0x29c5('0xec')](_0x4db50c,_0x555835);var _0x4b8112=[];_0x4b8112[_0x29c5('0x45')]({'model':db[_0x29c5('0x83')],'as':_0x29c5('0x83'),'attributes':['id',_0x29c5('0x40')],'raw':!![]});_0x4b8112[_0x29c5('0x45')]({'model':db[_0x29c5('0xdf')],'as':'Contact','attributes':['id',_0x29c5('0x11e'),_0x29c5('0x11f')],'raw':!![]});if(_0x968c9b['query'][_0x29c5('0x11d')]){_0x4b8112[_0x29c5('0x45')]({'model':db[_0x29c5('0xe9')],'as':_0x29c5('0xe9'),'raw':!![]});}var _0xeb3843=[{'model':db[_0x29c5('0x10e')],'as':'Messages','attributes':['id',_0x29c5('0x3b'),_0x29c5('0x8e'),'direction',_0x29c5('0x101'),_0x29c5('0x94')],'include':_0x4b8112}];_0xeb3843[_0x29c5('0x45')]({'model':db[_0x29c5('0xcb')],'as':_0x29c5('0x120'),'attributes':['id','name']});_0xeb3843[_0x29c5('0x45')]({'model':db[_0x29c5('0x83')],'as':_0x29c5('0x121'),'attributes':['id',_0x29c5('0x40')]});return db[_0x29c5('0x50')][_0x29c5('0x72')]({'where':{'id':_0x968c9b['params']['id']},'include':_0xeb3843})[_0x29c5('0x20')](handleEntityNotFound(_0x3ca047,null))[_0x29c5('0x20')](function(_0x162aa1){if(_0x162aa1){var _0x5860a8=_0x162aa1[_0x29c5('0x122')]({'plain':!![]});fs[_0x29c5('0x123')](_0x2128a7);var _0x494b7a={'channel':_0x29c5('0x124'),'account':_0x5860a8[_0x29c5('0x120')][_0x29c5('0x39')],'agent':_0x5860a8[_0x29c5('0x121')]?_0x5860a8[_0x29c5('0x121')]['fullname']:_0x29c5('0x125'),'createdAt':moment(_0x5860a8[_0x29c5('0x8e')])[_0x29c5('0xf5')](_0x29c5('0x112'))[_0x29c5('0xab')](),'closedAt':_0x5860a8[_0x29c5('0x4e')]?moment(_0x5860a8['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x29c5('0xab')]():'','disposition':_0x5860a8[_0x29c5('0x4c')],'chatInfo':{'browser':_0x5860a8[_0x29c5('0x126')],'os':_0x5860a8[_0x29c5('0x127')],'referer':_0x5860a8['referer'],'customerIp':_0x5860a8[_0x29c5('0x128')],'customerPort':_0x5860a8[_0x29c5('0x129')]?_0x5860a8[_0x29c5('0x129')]:'N.A.'},'messages':_(_0x5860a8[_0x29c5('0xf4')])[_0x29c5('0x12a')]()['filter']({'secret':![]})[_0x29c5('0x3f')](function(_0x3c31fd){if(_0x3c31fd['Attachment']){var _0x5b253a=path[_0x29c5('0xec')](_0x351ac7,_0x3c31fd['Attachment'][_0x29c5('0xe5')]);if(fs[_0x29c5('0x12b')](_0x5b253a)){fs['createReadStream'](_0x5b253a)['pipe'](fs[_0x29c5('0x12c')](path[_0x29c5('0xec')](_0x2128a7,_0x3c31fd[_0x29c5('0xe9')]['basename'])));}}return{'date':moment(_0x3c31fd['createdAt'])[_0x29c5('0xf5')]('YYYY-MM-DD\x20HH:mm:ss')[_0x29c5('0xab')](),'sender':_0x3c31fd[_0x29c5('0x100')]===_0x29c5('0xdc')?_0x3c31fd['User']?_0x3c31fd['User'][_0x29c5('0x40')]:_0x29c5('0xf8'):_0x3c31fd[_0x29c5('0x77')][_0x29c5('0x11e')]+(_0x3c31fd[_0x29c5('0x77')]['lastName']?'\x20'+_0x3c31fd[_0x29c5('0x77')]['lastName']:''),'body':_0x3c31fd[_0x29c5('0xe9')]?_0x3c31fd[_0x29c5('0xe9')][_0x29c5('0xe5')]:_0x3c31fd[_0x29c5('0x3b')],'direction':_0x3c31fd[_0x29c5('0x100')]===_0x29c5('0xdc')?'A':'C','secret':_0x3c31fd[_0x29c5('0x101')],'read':_0x3c31fd['read'],'attachment':_0x3c31fd['Attachment']};})[_0x29c5('0x79')]()};return ejs['renderFile'](path[_0x29c5('0xec')](config['root'],_0x29c5('0x11c'),_0x29c5('0x12d'),'downloadInteraction.ejs'),{'interaction':_0x494b7a})[_0x29c5('0x20')](function(_0x1007c6){var _0x1280ac=path['join'](_0x2128a7,_0x29c5('0x12e')+_0x5860a8['id']+'-'+_0x26011d+_0x29c5('0x12f'));var _0x2ebef3={'path':_0x1280ac,'channel':_0x29c5('0x124'),'interactionId':_0x5860a8['id']};return pdf[_0x29c5('0x130')](_0x1007c6,_0x2ebef3);})[_0x29c5('0x20')](function(){return new BPromise(function(_0x10c538,_0x406fdf){zipdir(_0x2128a7,{'saveTo':_0x2a259a},function(_0x41d804,_0xbf8ee2){if(_0x41d804)return _0x406fdf(_0x41d804);return _0x10c538(_0xbf8ee2);});})[_0x29c5('0x20')](function(){return new BPromise(function(_0x585346,_0x5691ba){rimraf(_0x2128a7,function(_0x314829){if(_0x314829)_0x5691ba(_0x314829);return _0x585346();});});})[_0x29c5('0x20')](function(){return _0x3ca047[_0x29c5('0xee')](_0x2a259a,_0x555835,function(_0x13b797){if(_0x13b797){console['log']('err',_0x13b797);}else{fs[_0x29c5('0x131')](_0x2a259a);}});});});}else{return _0x3ca047[_0x29c5('0x132')](0xc8);}})['catch'](handleError(_0x3ca047,null));}; \ No newline at end of file +var _0x3ab6=['all','rows','show','params','rawAttributes','includeAll','include','options','create','describe','createVidaooSession','findOne','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','follow','isNull','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','AbandonInteraction','attachmentUpload','originalname','basename','filename','mimetype','Attachment','Unauthorized','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','Messages','ChatWebsite','%s%d','agentAlias','System','customer','Visitor','website_alias','agent_alias','alias','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','Smtp','service','host','port','secure','authentication','pass','SendMail','sendMail','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','hasOwnProperty','sort','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','includeAgent','addTags','setTags','spread','color','emit','removeTags','download','server','files','tmp','transcript-%d-%s.zip','firstName','lastName','attachments','Account','Owner','get','N.A.','osName','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','renderFile','downloadInteraction.ejs','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','render','merge','body','contact','interaction','account','Users','fullname','TagIds','split','forEach','push','waiting','unmanaged','abandoned','closed','UserId','talking','disposition','total','index','map','ChatInteraction','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','where','pick','select','field','from','tools_tags','u.id','u.fullname','user_has_chat_interactions','u.id\x20=\x20ui.UserId','chat_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','find','unreadMessages','value','`\x20=\x200','having','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','some','compact','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','filter','replace','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','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','isEmpty','t.id\x20IN\x20?','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','agent','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','role','keyBy','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','i.*','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','toString','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x3ab6,0x76));var _0x63ab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ab6[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x63ab('0x0'));var zipdir=require(_0x63ab('0x1'));var jsonpatch=require(_0x63ab('0x2'));var rp=require(_0x63ab('0x3'));var moment=require('moment');var BPromise=require(_0x63ab('0x4'));var Mustache=require(_0x63ab('0x5'));var util=require('util');var path=require(_0x63ab('0x6'));var sox=require(_0x63ab('0x7'));var csv=require(_0x63ab('0x8'));var ejs=require(_0x63ab('0x9'));var fs=require('fs');var fs_extra=require(_0x63ab('0xa'));var _=require(_0x63ab('0xb'));var squel=require(_0x63ab('0xc'));var crypto=require('crypto');var jsforce=require(_0x63ab('0xd'));var deskjs=require(_0x63ab('0xe'));var toCsv=require(_0x63ab('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x63ab('0xf'));var authService=require(_0x63ab('0x10'));var qs=require(_0x63ab('0x11'));var as=require(_0x63ab('0x12'));var pdf=require(_0x63ab('0x13'));var hardwareService=require(_0x63ab('0x14'));var logger=require(_0x63ab('0x15'))('api');var utils=require(_0x63ab('0x16'));var config=require(_0x63ab('0x17'));var licenseUtil=require(_0x63ab('0x18'));var db=require(_0x63ab('0x19'))['db'];config[_0x63ab('0x1a')]=_['defaults'](config[_0x63ab('0x1a')],{'host':_0x63ab('0x1b'),'port':0x18eb});var socket=require(_0x63ab('0x1c'))(new Redis(config['redis']));require('./chatInteraction.socket')[_0x63ab('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x63ab('0x1e')][_0x63ab('0x1f')]({'port':0x232b});var client9004=jayson[_0x63ab('0x1e')][_0x63ab('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x534e22,_0x2f0b47,_0x428d12,_0x4c0020){return new BPromise(function(_0x12dbf9,_0x163066){var _0x333537=_0x4c0020||client;return _0x333537[_0x63ab('0x20')](_0x534e22,_0x428d12)[_0x63ab('0x21')](function(_0x4e71d7){logger[_0x63ab('0x22')](_0x63ab('0x23'),_0x2f0b47,'request\x20sent');logger[_0x63ab('0x24')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x2f0b47,_0x63ab('0x25'),JSON[_0x63ab('0x26')](_0x4e71d7));if(_0x4e71d7[_0x63ab('0x27')]){if(_0x4e71d7[_0x63ab('0x27')][_0x63ab('0x28')]===0x1f4){logger[_0x63ab('0x27')](_0x63ab('0x23'),_0x2f0b47,_0x4e71d7[_0x63ab('0x27')]['message']);return _0x163066(_0x4e71d7[_0x63ab('0x27')][_0x63ab('0x29')]);}logger[_0x63ab('0x27')](_0x63ab('0x23'),_0x2f0b47,_0x4e71d7[_0x63ab('0x27')]['message']);return _0x12dbf9(_0x4e71d7[_0x63ab('0x27')][_0x63ab('0x29')]);}else{logger[_0x63ab('0x22')](_0x63ab('0x23'),_0x2f0b47,_0x63ab('0x25'));_0x12dbf9(_0x4e71d7[_0x63ab('0x2a')]['message']);}})[_0x63ab('0x2b')](function(_0x563423){logger[_0x63ab('0x27')]('ChatInteraction,\x20%s,\x20%s',_0x2f0b47,_0x563423);_0x163066(_0x563423);});});}function respondWithStatusCode(_0x54b104,_0x394c6d){_0x394c6d=_0x394c6d||0xcc;return function(_0xf0f110){if(_0xf0f110){return _0x54b104[_0x63ab('0x2c')](_0x394c6d);}return _0x54b104[_0x63ab('0x2d')](_0x394c6d)[_0x63ab('0x2e')]();};}function respondWithResult(_0x5398d9,_0x129209){_0x129209=_0x129209||0xc8;return function(_0xc1136a){if(_0xc1136a){return _0x5398d9[_0x63ab('0x2d')](_0x129209)[_0x63ab('0x2f')](_0xc1136a);}};}function respondWithFilteredResult(_0x55b74b,_0x5241d4){return function(_0x1727d8){if(_0x1727d8){var _0x1ca91d=typeof _0x5241d4['offset']===_0x63ab('0x30')&&typeof _0x5241d4[_0x63ab('0x31')]===_0x63ab('0x30');var _0x1afb0a=_0x1727d8[_0x63ab('0x32')];var _0x56f48c=_0x1ca91d?0x0:_0x5241d4[_0x63ab('0x33')];var _0x5e8798=_0x1ca91d?_0x1727d8[_0x63ab('0x32')]:_0x5241d4['offset']+_0x5241d4[_0x63ab('0x31')];var _0x5d43b5;if(_0x5e8798>=_0x1afb0a){_0x5e8798=_0x1afb0a;_0x5d43b5=0xc8;}else{_0x5d43b5=0xce;}_0x55b74b[_0x63ab('0x2d')](_0x5d43b5);return _0x55b74b[_0x63ab('0x34')](_0x63ab('0x35'),_0x56f48c+'-'+_0x5e8798+'/'+_0x1afb0a)[_0x63ab('0x2f')](_0x1727d8);}return null;};}function patchUpdates(_0x2099d6){return function(_0x23714c){try{jsonpatch[_0x63ab('0x36')](_0x23714c,_0x2099d6,!![]);}catch(_0xe15ae5){return BPromise[_0x63ab('0x37')](_0xe15ae5);}return _0x23714c[_0x63ab('0x38')]();};}function saveUpdates(_0x2d1f7f,_0xf6e007){return function(_0x413c91){if(_0x413c91){return _0x413c91[_0x63ab('0x39')](_0x2d1f7f)[_0x63ab('0x21')](function(_0xcfdf26){return _0xcfdf26;});}return null;};}function removeEntity(_0x5dafcd,_0x51dd6a){return function(_0x2bc3bb){if(_0x2bc3bb){return _0x2bc3bb[_0x63ab('0x3a')]()[_0x63ab('0x21')](function(){_0x5dafcd[_0x63ab('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x213efb,_0x571fb8){return function(_0x5a6c14){if(!_0x5a6c14){_0x213efb[_0x63ab('0x2c')](0x194);}return _0x5a6c14;};}function handleError(_0x33c0fd,_0x99a69f){_0x99a69f=_0x99a69f||0x1f4;return function(_0x330ff9){logger[_0x63ab('0x27')](_0x330ff9[_0x63ab('0x3b')]);if(_0x330ff9[_0x63ab('0x3c')]){delete _0x330ff9[_0x63ab('0x3c')];}_0x33c0fd[_0x63ab('0x2d')](_0x99a69f)['send'](_0x330ff9);};}function getMustacheRender(_0x14e1f6,_0x2d68b5){return Mustache[_0x63ab('0x3d')](_0x14e1f6,_[_0x63ab('0x3e')](_0x2d68b5[_0x63ab('0x3f')],{'contact':_0x2d68b5[_0x63ab('0x40')],'message':_0x2d68b5['message'],'agent':_0x2d68b5['agent'],'interaction':_0x2d68b5[_0x63ab('0x41')],'account':_0x2d68b5[_0x63ab('0x42')]}))||'';}function getInteractionUsers(_0x3a338f,_0x2e22fb){return new BPromise(function(_0x863067,_0x164373){try{if(_0x2e22fb[_0x3a338f['id']]){_0x3a338f[_0x63ab('0x43')]=_['map'](_0x2e22fb[_0x3a338f['id']],function(_0x49e3c6){return{'id':_0x49e3c6['id'],'fullname':_0x49e3c6[_0x63ab('0x44')]};});}}catch(_0x456559){_0x164373(_0x456559);}_0x863067(_0x3a338f);});}function getInteractionTags(_0x47baa6,_0x34d06b){return new BPromise(function(_0x3c3bfd,_0x5714ed){try{if(_0x47baa6[_0x63ab('0x45')]){_0x47baa6['Tags']=[];_0x47baa6[_0x63ab('0x45')][_0x63ab('0x46')](',')[_0x63ab('0x47')](function(_0x12a9fc){_0x47baa6['Tags'][_0x63ab('0x48')](_0x34d06b[_0x12a9fc]);});}delete _0x47baa6[_0x63ab('0x45')];}catch(_0x2bf5d5){_0x5714ed(_0x2bf5d5);}_0x3c3bfd(_0x47baa6);});}function updateChatInteraction(_0x5efda2,_0x7b7bae,_0x57e31f){return new BPromise(function(_0x3b1dfd,_0x1f666){return getInteractionUsers(_0x5efda2,_0x57e31f)[_0x63ab('0x21')](function(_0x2ce686){return getInteractionTags(_0x2ce686,_0x7b7bae);})[_0x63ab('0x21')](function(_0x57236d){return getStateInteraction(_0x57236d);})[_0x63ab('0x21')](function(_0x589461){_0x3b1dfd(_0x589461);})[_0x63ab('0x2b')](function(_0x50029d){_0x1f666(_0x50029d);});});}function getStateInteraction(_0x34a350){return new BPromise(function(_0x182722){_0x34a350[_0x63ab('0x49')]=0x0;_0x34a350['talking']=0x0;_0x34a350['answered']=0x0;_0x34a350[_0x63ab('0x4a')]=0x0;_0x34a350[_0x63ab('0x4b')]=0x0;_0x34a350['total']=0x0;if(!_0x34a350[_0x63ab('0x4c')]&&!_0x34a350['UserId']){_0x34a350[_0x63ab('0x49')]+=0x1;}if(!_0x34a350[_0x63ab('0x4c')]&&_0x34a350[_0x63ab('0x4d')]){_0x34a350[_0x63ab('0x4e')]+=0x1;if(_0x34a350[_0x63ab('0x49')]){_0x34a350[_0x63ab('0x49')]-=0x1;}}if(_0x34a350['closed']&&_0x34a350[_0x63ab('0x4f')]==='abandoned'){_0x34a350[_0x63ab('0x4b')]+=0x1;if(_0x34a350[_0x63ab('0x49')]){_0x34a350['waiting']-=0x1;}}else if(_0x34a350['closed']&&!_0x34a350['UserId']&&_0x34a350[_0x63ab('0x4f')]){_0x34a350[_0x63ab('0x4a')]+=0x1;if(_0x34a350[_0x63ab('0x49')]){_0x34a350[_0x63ab('0x49')]-=0x1;}}else if(_0x34a350[_0x63ab('0x4c')]&&_0x34a350['UserId']){_0x34a350['answered']+=0x1;if(_0x34a350[_0x63ab('0x4e')]){_0x34a350[_0x63ab('0x4e')]-=0x1;}}_0x34a350[_0x63ab('0x50')]+=0x1;_0x182722(_0x34a350);});}exports[_0x63ab('0x51')]=function(_0x15bf6a,_0x447927){var _0x6d9aa9={},_0xe32d1a={},_0x2fb476={'count':0x0,'rows':[]};var _0x3f2385=_[_0x63ab('0x52')](db[_0x63ab('0x53')]['rawAttributes'],function(_0x278032){return{'name':_0x278032[_0x63ab('0x54')],'type':_0x278032[_0x63ab('0x55')][_0x63ab('0x56')]};});_0xe32d1a['model']=_[_0x63ab('0x52')](_0x3f2385,_0x63ab('0x3c'));_0xe32d1a[_0x63ab('0x57')]=_[_0x63ab('0x58')](_0x15bf6a[_0x63ab('0x57')]);_0xe32d1a[_0x63ab('0x59')]=_['intersection'](_0xe32d1a[_0x63ab('0x5a')],_0xe32d1a['query']);_0x6d9aa9[_0x63ab('0x5b')]=_[_0x63ab('0x5c')](_0xe32d1a[_0x63ab('0x5a')],qs[_0x63ab('0x5d')](_0x15bf6a[_0x63ab('0x57')][_0x63ab('0x5d')]));_0x6d9aa9['attributes']=_0x6d9aa9[_0x63ab('0x5b')][_0x63ab('0x5e')]?_0x6d9aa9[_0x63ab('0x5b')]:_0xe32d1a[_0x63ab('0x5a')];if(!_0x15bf6a[_0x63ab('0x57')]['hasOwnProperty'](_0x63ab('0x5f'))){_0x6d9aa9[_0x63ab('0x31')]=qs['limit'](_0x15bf6a['query'][_0x63ab('0x31')]);_0x6d9aa9[_0x63ab('0x33')]=qs[_0x63ab('0x33')](_0x15bf6a[_0x63ab('0x57')][_0x63ab('0x33')]);}_0x6d9aa9[_0x63ab('0x60')]=qs['sort'](_0x15bf6a[_0x63ab('0x57')]['sort']);_0x6d9aa9[_0x63ab('0x61')]=qs[_0x63ab('0x59')](_[_0x63ab('0x62')](_0x15bf6a[_0x63ab('0x57')],_0xe32d1a[_0x63ab('0x59')]),_0x3f2385);var _0x151226=[];var _0x3115bd=squel[_0x63ab('0x63')]()['field']('id')[_0x63ab('0x64')]('name')[_0x63ab('0x64')]('color')[_0x63ab('0x65')](_0x63ab('0x66'));var _0x5f4149=squel[_0x63ab('0x63')]()[_0x63ab('0x64')](_0x63ab('0x67'))[_0x63ab('0x64')](_0x63ab('0x68'))[_0x63ab('0x64')]('ui.ChatInteractionId')[_0x63ab('0x65')](_0x63ab('0x69'),'ui')['left_join']('users','u',_0x63ab('0x6a'));var _0x81f901=squel[_0x63ab('0x63')]()[_0x63ab('0x65')](_0x63ab('0x6b'),'i')[_0x63ab('0x6c')](_0x63ab('0x6d'),'c',_0x63ab('0x6e'))[_0x63ab('0x6c')](_0x63ab('0x6f'),'o','o.id\x20=\x20i.UserId')[_0x63ab('0x6c')]('chat_websites','a',_0x63ab('0x70'))[_0x63ab('0x6c')](_0x63ab('0x71'),'me',_0x63ab('0x72'))[_0x63ab('0x6c')]('chat_interaction_has_tags','it',_0x63ab('0x73'))['left_join']('tools_tags','t',_0x63ab('0x74'));var _0x3b7c30=squel[_0x63ab('0x75')]();var _0x33d4e8=[];var _0x2f7bab=squel[_0x63ab('0x75')]();var _0x5f399b;if(_0x15bf6a[_0x63ab('0x57')][_0x63ab('0x76')]){_0x5f399b=as['parseSearch'](_0x15bf6a['query']['search']);var _0x593db7=_0x5f399b['sqlOperator'];for(var _0x531ad6=0x0;_0x531ad6<_0x5f399b[_0x63ab('0x77')][_0x63ab('0x5e')];_0x531ad6++){var _0x25527f=_0x5f399b[_0x63ab('0x77')][_0x531ad6];var _0x1663f8='i';var _0x5ec3b6=_[_0x63ab('0x78')](_0x3f2385,[_0x63ab('0x3c'),_0x25527f[_0x63ab('0x64')]]);if(!_0x5ec3b6){switch(_0x25527f['field']){case _0x63ab('0x79'):if(_0x25527f[_0x63ab('0x7a')]==0x1){_0x81f901['having']('`'+_0x25527f[_0x63ab('0x64')]+_0x63ab('0x7b'));}else{_0x81f901[_0x63ab('0x7c')]('`'+_0x25527f[_0x63ab('0x64')]+'`\x20>\x200');}break;case _0x63ab('0x7d'):if(_0x25527f[_0x63ab('0x7e')]===_0x63ab('0x7f')){if(_0x25527f['value'][_0x63ab('0x46')]('\x20')['length']>0x1){_0x3b7c30[_0x593db7](_0x63ab('0x80'),qs[_0x63ab('0x81')](_0x25527f[_0x63ab('0x7a')]),null);}else{var _0x3b48d6='%'+_0x25527f['value']+'%';_0x3b7c30[_0x593db7](_0x63ab('0x82'),_0x3b48d6,_0x3b48d6,_0x3b48d6);}}else{_0x5ec3b6=_[_0x63ab('0x78')](_0x3f2385,['name',_0x63ab('0x83')]);_0x25527f['field']='ContactId';_0xac3035=as[_0x63ab('0x84')](_0x1663f8,_0x5ec3b6['type'],_0x25527f);_0x3b7c30[_0x593db7](_0xac3035[_0x63ab('0x85')],_0xac3035[_0x63ab('0x7a')][_0x63ab('0x86')],_0xac3035[_0x63ab('0x7a')][_0x63ab('0x2e')]);}break;case _0x63ab('0x87'):var _0x10cc64=_0x25527f[_0x63ab('0x7a')][_0x63ab('0x46')](',')[_0x63ab('0x52')](function(_0x1f0345){return Number(_0x1f0345);});_0x10cc64[_0x63ab('0x47')](function(_0x2dab33){_0x2f7bab['or'](_0x63ab('0x88'),'%,'+_0x2dab33+',%');});_0x33d4e8=_['union'](_0x33d4e8,_0x10cc64);break;case _0x63ab('0x89'):if(_0x25527f[_0x63ab('0x7e')]==='$substring'){_0x3b7c30[_0x593db7]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x25527f[_0x63ab('0x7a')]+'%',null);}else{_0x5ec3b6=_[_0x63ab('0x78')](_0x3f2385,[_0x63ab('0x3c'),_0x63ab('0x4d')]);_0x25527f['field']=_0x63ab('0x4d');_0xac3035=as[_0x63ab('0x84')](_0x1663f8,_0x5ec3b6[_0x63ab('0x55')],_0x25527f);_0x3b7c30[_0x593db7](_0xac3035[_0x63ab('0x85')],_0xac3035[_0x63ab('0x7a')][_0x63ab('0x86')],_0xac3035[_0x63ab('0x7a')]['end']);}break;case _0x63ab('0x3f'):_0xac3035=as[_0x63ab('0x84')]('me',null,_0x25527f);_0x3b7c30[_0x593db7](_0xac3035['text'],_0xac3035[_0x63ab('0x7a')][_0x63ab('0x86')],_0xac3035[_0x63ab('0x7a')]['end']);break;}}else{var _0xac3035=as['buildExpression'](_0x1663f8,_0x5ec3b6[_0x63ab('0x55')],_0x25527f);_0x3b7c30[_0x593db7](_0xac3035[_0x63ab('0x85')],_0xac3035[_0x63ab('0x7a')]['start'],_0xac3035[_0x63ab('0x7a')][_0x63ab('0x2e')]);}}}else{var _0x3fdfad=_(_0x15bf6a[_0x63ab('0x57')])[_0x63ab('0x58')]()[_0x63ab('0x52')](function(_0x3c84e2){return _[_0x63ab('0x8a')](_0x3f2385,[_0x63ab('0x3c'),_0x3c84e2])?_0x3c84e2:undefined;})[_0x63ab('0x8b')]()['value']();if(!_['isEmpty'](_0x3fdfad)){_0x3fdfad[_0x63ab('0x47')](function(_0xf502bb){if(_0xf502bb===_0x63ab('0x8c')){_0x81f901[_0x63ab('0x61')](_0x63ab('0x8d'),[][_0x63ab('0x8e')](_0x15bf6a[_0x63ab('0x57')][_0xf502bb]));}else if(_0xf502bb===_0x63ab('0x8f')){var _0x2c6295=JSON[_0x63ab('0x90')](_0x15bf6a[_0x63ab('0x57')][_0xf502bb])[_0x63ab('0x91')];var _0x3257c0=JSON[_0x63ab('0x90')](_0x15bf6a[_0x63ab('0x57')][_0xf502bb])[_0x63ab('0x92')];_0x81f901[_0x63ab('0x61')](_0x63ab('0x93'),_0x2c6295,_0x3257c0);}else{if(_0x15bf6a[_0x63ab('0x57')][_0xf502bb]==='null'){_0x81f901['where']('i.'+_0xf502bb+'\x20IS\x20NULL');}else{_0x81f901['where']('i.'+_0xf502bb+_0x63ab('0x94'),_0x15bf6a[_0x63ab('0x57')][_0xf502bb]);}}});}if(_0x15bf6a[_0x63ab('0x57')][_0x63ab('0x95')]){if(_0x15bf6a['query'][_0x63ab('0x95')]==0x1){_0x81f901['having']('`unreadMessages`\x20=\x200');}else{_0x81f901[_0x63ab('0x7c')](_0x63ab('0x96'));}}if(_0x15bf6a[_0x63ab('0x57')]['tag']){_0x33d4e8=_['isArray'](_0x15bf6a[_0x63ab('0x57')][_0x63ab('0x97')])?_0x15bf6a['query'][_0x63ab('0x97')]:new Array(_0x15bf6a[_0x63ab('0x57')][_0x63ab('0x97')]);_0x33d4e8[_0x63ab('0x47')](function(_0x44b8c2){_0x2f7bab['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x44b8c2+',%');});}if(_0x15bf6a[_0x63ab('0x57')][_0x63ab('0x98')]){var _0x5ded88=_0x15bf6a[_0x63ab('0x57')][_0x63ab('0x98')][_0x63ab('0x99')]('\x5c','\x5c\x5c')[_0x63ab('0x99')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x5ded88)){_0x3b7c30['or'](_0x63ab('0x9a'),_0x5ded88+'%');}else{_0x3b7c30['or'](_0x63ab('0x9b'),qs[_0x63ab('0x81')](_0x5ded88))['or'](_0x63ab('0x9c'),_0x5ded88+'%');}}}_0x81f901[_0x63ab('0x61')](_0x3b7c30);_0x81f901[_0x63ab('0x9d')](_0x63ab('0x9e'));var _0x22a20a={'type':db['Sequelize'][_0x63ab('0x9f')][_0x63ab('0xa0')],'raw':!![]};var _0x55b85e=_0x81f901[_0x63ab('0xa1')]();_0x55b85e[_0x63ab('0x64')](_0x63ab('0x9e'));_0x55b85e[_0x63ab('0x64')](_0x63ab('0xa2'),_0x63ab('0x79'));if(_0x6d9aa9['order']){_0x6d9aa9[_0x63ab('0x60')][_0x63ab('0x47')](function(_0x33f0da){var _0x345827=_0x33f0da[0x0]==='contactName'?_0x33f0da[0x0]:'i.'+_0x33f0da[0x0];_0x81f901[_0x63ab('0x60')](_0x345827,_0x33f0da[0x1]===_0x63ab('0xa3')?![]:!![]);});}if(!_[_0x63ab('0xa4')](_0x33d4e8)){_0x81f901['having'](_0x2f7bab);_0x55b85e['where'](_0x63ab('0xa5'),_0x33d4e8);}BPromise['resolve']()[_0x63ab('0x21')](function(){if(!_0x5f399b){if(_0x15bf6a[_0x63ab('0x57')][_0x63ab('0x8c')])return;_0x55b85e['where'](_0x63ab('0xa6'));_0x81f901[_0x63ab('0x61')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x15bf6a[_0x63ab('0xa7')]['role']!==_0x63ab('0xa8'))return;return _0x15bf6a['user'][_0x63ab('0xa9')]({'attributes':['id'],'raw':!![]})[_0x63ab('0x21')](function(_0x180c29){if(_[_0x63ab('0xa4')](_0x180c29)){_0x55b85e['where'](_0x63ab('0xaa'));_0x81f901['where'](_0x63ab('0xaa'));}else{_0x55b85e[_0x63ab('0x61')](_0x63ab('0x8d'),_[_0x63ab('0x52')](_0x180c29,'id'));_0x81f901[_0x63ab('0x61')](_0x63ab('0x8d'),_[_0x63ab('0x52')](_0x180c29,'id'));}});})[_0x63ab('0x21')](function(){if(_0x15bf6a[_0x63ab('0xa7')][_0x63ab('0xab')]==='agent'&&!_0x5f399b&&!_0x15bf6a[_0x63ab('0x57')][_0x63ab('0x8c')])return[];return db['sequelize'][_0x63ab('0x57')](_0x55b85e['toString'](),_0x22a20a);})[_0x63ab('0x21')](function(_0x5a66e3){_0x2fb476[_0x63ab('0x32')]=_0x5a66e3[_0x63ab('0x5e')];if(_0x2fb476[_0x63ab('0x32')]===0x0)return[];return db['sequelize'][_0x63ab('0x57')](_0x3115bd['toString'](),_0x22a20a)[_0x63ab('0x21')](function(_0x6f2147){_0x151226=_[_0x63ab('0xac')](_0x6f2147,'id');_0x22a20a=_[_0x63ab('0x3e')](_0x22a20a,{'model':db[_0x63ab('0x53')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x15bf6a[_0x63ab('0x57')][_0x63ab('0x5d')]){_0x6d9aa9[_0x63ab('0x5b')][_0x63ab('0x47')](function(_0x43ca77){_0x81f901[_0x63ab('0x64')]('i.'+_0x43ca77);});}else{_0x81f901[_0x63ab('0x64')](_0x63ab('0xa2'),_0x63ab('0x79'));_0x81f901[_0x63ab('0x64')](_0x63ab('0xad'),_0x63ab('0xae'));_0x81f901[_0x63ab('0x64')](_0x63ab('0xaf'),_0x63ab('0xb0'));_0x81f901[_0x63ab('0x64')](_0x63ab('0xb1'),_0x63ab('0xb2'));_0x81f901[_0x63ab('0x64')](_0x63ab('0xb3'));_0x81f901[_0x63ab('0x64')]('c.firstName','Contact.firstName');_0x81f901[_0x63ab('0x64')](_0x63ab('0xb4'),'Contact.lastName');_0x81f901[_0x63ab('0x64')](_0x63ab('0xb5'),_0x63ab('0xb6'));_0x81f901[_0x63ab('0x64')](_0x63ab('0xb7'),_0x63ab('0xb8'));_0x81f901[_0x63ab('0x64')](_0x63ab('0xb9'),_0x63ab('0xba'));_0x81f901[_0x63ab('0x64')](_0x63ab('0xbb'),'Contact.fax');_0x81f901[_0x63ab('0x64')](_0x63ab('0xbc'),'Owner.fullname');_0x81f901[_0x63ab('0x64')]('o.internal','Owner.internal');_0x81f901['field'](_0x63ab('0xbd'),_0x63ab('0x45'));}if(_0x6d9aa9[_0x63ab('0x31')])_0x81f901[_0x63ab('0x31')](_0x6d9aa9[_0x63ab('0x31')]);if(_0x6d9aa9['offset'])_0x81f901[_0x63ab('0x33')](_0x6d9aa9['offset']);return db[_0x63ab('0xbe')][_0x63ab('0x57')](_0x81f901[_0x63ab('0xbf')](),_0x22a20a);})[_0x63ab('0x21')](function(_0x189ef6){if(_0x189ef6[_0x63ab('0x5e')]>0x0)_0x5f4149[_0x63ab('0x61')](_0x63ab('0xc0'),_['map'](_0x189ef6,'id'));return db[_0x63ab('0xbe')]['query'](_0x5f4149['toString'](),_0x22a20a)[_0x63ab('0x21')](function(_0x5d7b91){var _0x3f2597=_[_0x63ab('0xc1')](_0x5d7b91,_0x63ab('0xc2'));var _0x15efd4=[];_0x189ef6['forEach'](function(_0xfa7f18){_0x15efd4[_0x63ab('0x48')](updateChatInteraction(_0xfa7f18,_0x151226,_0x3f2597));});return BPromise[_0x63ab('0xc3')](_0x15efd4);});});})[_0x63ab('0x21')](function(_0x454663){_0x2fb476[_0x63ab('0xc4')]=_0x454663;return _0x2fb476;})[_0x63ab('0x21')](respondWithFilteredResult(_0x447927,_0x6d9aa9))[_0x63ab('0x2b')](handleError(_0x447927,null));};exports[_0x63ab('0xc5')]=function(_0xb4127f,_0x24100a){var _0x3bb33d={'raw':![],'where':{'id':_0xb4127f[_0x63ab('0xc6')]['id']}},_0x4d14bb={};_0x4d14bb[_0x63ab('0x5a')]=_['keys'](db[_0x63ab('0x53')][_0x63ab('0xc7')]);_0x4d14bb[_0x63ab('0x57')]=_[_0x63ab('0x58')](_0xb4127f[_0x63ab('0x57')]);_0x4d14bb[_0x63ab('0x59')]=_[_0x63ab('0x5c')](_0x4d14bb[_0x63ab('0x5a')],_0x4d14bb[_0x63ab('0x57')]);_0x3bb33d[_0x63ab('0x5b')]=_[_0x63ab('0x5c')](_0x4d14bb[_0x63ab('0x5a')],qs[_0x63ab('0x5d')](_0xb4127f[_0x63ab('0x57')][_0x63ab('0x5d')]));_0x3bb33d['attributes']=_0x3bb33d[_0x63ab('0x5b')][_0x63ab('0x5e')]?_0x3bb33d[_0x63ab('0x5b')]:_0x4d14bb['model'];if(_0xb4127f[_0x63ab('0x57')][_0x63ab('0xc8')]){_0x3bb33d[_0x63ab('0xc9')]=[{'all':!![]}];}_0x3bb33d=_[_0x63ab('0x3e')]({},_0x3bb33d,_0xb4127f[_0x63ab('0xca')]);return db[_0x63ab('0x53')][_0x63ab('0x78')](_0x3bb33d)[_0x63ab('0x21')](handleEntityNotFound(_0x24100a,null))[_0x63ab('0x21')](respondWithResult(_0x24100a,null))['catch'](handleError(_0x24100a,null));};exports[_0x63ab('0xcb')]=function(_0x1b455b,_0x5383f6){return db[_0x63ab('0x53')][_0x63ab('0xcb')](_0x1b455b[_0x63ab('0x3f')],{})[_0x63ab('0x21')](respondWithResult(_0x5383f6,0xc9))[_0x63ab('0x2b')](handleError(_0x5383f6,null));};exports[_0x63ab('0x39')]=function(_0x36f37f,_0x2f4745){if(_0x36f37f['body']['id']){delete _0x36f37f[_0x63ab('0x3f')]['id'];}return db['ChatInteraction'][_0x63ab('0x78')]({'where':{'id':_0x36f37f['params']['id']}})[_0x63ab('0x21')](handleEntityNotFound(_0x2f4745,null))['then'](saveUpdates(_0x36f37f[_0x63ab('0x3f')],null))[_0x63ab('0x21')](respondWithResult(_0x2f4745,null))[_0x63ab('0x2b')](handleError(_0x2f4745,null));};exports[_0x63ab('0x3a')]=function(_0x52b5cc,_0x59145c){return db[_0x63ab('0x53')][_0x63ab('0x78')]({'where':{'id':_0x52b5cc[_0x63ab('0xc6')]['id']}})[_0x63ab('0x21')](handleEntityNotFound(_0x59145c,null))['then'](removeEntity(_0x59145c,null))[_0x63ab('0x2b')](handleError(_0x59145c,null));};exports['describe']=function(_0x1d3970,_0x2c1eb5){return db['ChatInteraction'][_0x63ab('0xcc')]()[_0x63ab('0x21')](respondWithResult(_0x2c1eb5,null))[_0x63ab('0x2b')](handleError(_0x2c1eb5,null));};exports[_0x63ab('0xcd')]=function(_0x294c92,_0x36772a){var _0x792f80=_0x294c92[_0x63ab('0xc6')]['id'];var _0x2882af;var _0x3c9899;var _0x33110f;return db['ChatInteraction']['findOne']({'where':{'id':_0x792f80}})[_0x63ab('0x21')](function(_0x4f63bb){_0x2882af=_0x4f63bb;return db['ChatWebsite'][_0x63ab('0xce')]({'where':{'id':_0x4f63bb[_0x63ab('0x8c')]},'attributes':['id',_0x63ab('0xcf'),_0x63ab('0xd0'),_0x63ab('0xd1'),_0x63ab('0xd2'),_0x63ab('0xd3')],'raw':!![]});})[_0x63ab('0x21')](function(_0x5dfa9f){if(_0x5dfa9f&&_0x5dfa9f[_0x63ab('0xcf')]&&_0x5dfa9f[_0x63ab('0xd0')]){_0x3c9899=_0x5dfa9f;var _0x3830ca={'interaction':{'id':_0x792f80},'agent':{'id':_0x294c92['user']['id'],'name':_0x294c92[_0x63ab('0xa7')][_0x63ab('0x3c')],'fullname':_0x294c92[_0x63ab('0xa7')][_0x63ab('0x44')],'email':_0x294c92[_0x63ab('0xa7')][_0x63ab('0xd4')]},'contact':_0x294c92[_0x63ab('0x3f')]['contact'],'account':_0x294c92[_0x63ab('0x3f')][_0x63ab('0x42')]};var _0x37d144={'rejectUnauthorized':![],'method':_0x63ab('0xd5'),'url':_0x63ab('0xd6'),'headers':{'X-APIKEY':_0x5dfa9f['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x294c92['user']['email']],'buttons':null,'topic':_0x3c9899[_0x63ab('0xd1')],'note':_['isNull'](_0x3c9899['vidaooNote'])?null:getMustacheRender(_0x3c9899['vidaooNote'],_0x3830ca),'metadata':null},'redirect':_0x63ab('0xd7'),'json':!![]};try{if(!_[_0x63ab('0xd8')](_0x3c9899[_0x63ab('0xd3')])){var _0x1b992a=getMustacheRender(_0x3c9899[_0x63ab('0xd3')],_0x3830ca);var _0x112c5c=JSON[_0x63ab('0x90')](_0x1b992a);_0x37d144[_0x63ab('0x3f')][_0x63ab('0xd9')]=_0x112c5c;}}catch(_0x4f2b6a){throw new db[(_0x63ab('0xda'))][(_0x63ab('0xdb'))](_0x63ab('0xdc'));}return rp(_0x37d144);}else{throw new db[(_0x63ab('0xda'))][(_0x63ab('0xdb'))](_0x63ab('0xdd'));}})[_0x63ab('0x21')](function(_0x418fa6){_0x33110f=_0x418fa6;if(_0x33110f['id']){var _0x33b45c={'body':_0x33110f['join_url'],'ChatWebsiteId':_0x3c9899['id'],'ChatInteractionId':_0x2882af['id'],'direction':_0x63ab('0xde'),'UserId':_0x294c92[_0x63ab('0xa7')]['id']};return db[_0x63ab('0xdf')]['create'](_0x33b45c,{});}else{throw new db[(_0x63ab('0xda'))][(_0x63ab('0xdb'))](_0x63ab('0xe0'));}})[_0x63ab('0x21')](function(){return _0x2882af['updateAttributes']({'vidaooSessionId':_0x33110f['id']});})[_0x63ab('0x21')](respondWithResult(_0x36772a,null))[_0x63ab('0x2b')](handleError(_0x36772a,null));};exports[_0x63ab('0xe1')]=function(_0xa207a3,_0x411fb7){if(_0xa207a3['body']['id']){delete _0xa207a3['body']['id'];}return db[_0x63ab('0x53')][_0x63ab('0x78')]({'where':{'id':_0xa207a3[_0x63ab('0xc6')]['id']},'include':[{'model':db[_0x63ab('0xe2')],'as':_0x63ab('0x7d')}]})[_0x63ab('0x21')](handleEntityNotFound(_0x411fb7,null))[_0x63ab('0x21')](saveUpdates(_0xa207a3[_0x63ab('0x3f')],null))[_0x63ab('0x21')](respondWithResult(_0x411fb7,null))[_0x63ab('0x2b')](handleError(_0x411fb7,null));};exports[_0x63ab('0xe3')]=function(_0xee836d,_0x4c3726,_0x156e9f){if(_0xee836d[_0x63ab('0x3f')]['id']){delete _0xee836d[_0x63ab('0x3f')]['id'];}return db[_0x63ab('0x53')]['find']({'where':{'id':_0xee836d[_0x63ab('0xc6')]['id']}})[_0x63ab('0x21')](function(_0x3fe0d0){if(!_0x3fe0d0){logger[_0x63ab('0x27')](_0x63ab('0xe4'),'abandon',0x194,_0x63ab('0xe5'));_0x4c3726[_0x63ab('0x2c')](0x194);}else{if(_0x3fe0d0[_0x63ab('0x4d')]){throw new db[(_0x63ab('0xda'))][(_0x63ab('0xdb'))](_0x63ab('0xe6'));}}return _0x3fe0d0;})[_0x63ab('0x21')](function(_0x3916e0){if(_0x3916e0){return _0x3916e0[_0x63ab('0x39')]({'closed':_0xee836d[_0x63ab('0x3f')][_0x63ab('0x4c')],'disposition':_0xee836d[_0x63ab('0x3f')]['disposition']})['then'](function(_0x3aef53){return _0x3aef53;});}})['then'](function(_0x16da5c){return respondWithRpcPromise(_0x63ab('0xe7'),_0x63ab('0xe3'),_0xee836d[_0x63ab('0x3f')],client9004);})[_0x63ab('0x21')](respondWithResult(_0x4c3726,null))[_0x63ab('0x2b')](handleError(_0x4c3726,null));};exports[_0x63ab('0xe8')]=function(_0x5d2950,_0x40d314,_0x39e6cb){_0x5d2950[_0x63ab('0x3f')][_0x63ab('0x3c')]=_0x5d2950['file'][_0x63ab('0xe9')];_0x5d2950[_0x63ab('0x3f')][_0x63ab('0xea')]=_0x5d2950['file'][_0x63ab('0xeb')];_0x5d2950[_0x63ab('0x3f')]['type']=_0x5d2950['file'][_0x63ab('0xec')];return db[_0x63ab('0xed')]['create'](_0x5d2950[_0x63ab('0x3f')])[_0x63ab('0x21')](respondWithResult(_0x40d314,0xc9))[_0x63ab('0x2b')](handleError(_0x40d314,null));};exports['attachmentDownload']=function(_0x4d250c,_0x420ed7,_0x2aeeaa){return db[_0x63ab('0x53')][_0x63ab('0xce')]({'where':{'id':_0x4d250c['params']['id']},'raw':!![]})[_0x63ab('0x21')](handleEntityNotFound(_0x420ed7,null))['then'](function(_0x126e77){if(_0x126e77){if(_0x126e77['closed']){return _0x420ed7[_0x63ab('0x2d')](0x193)[_0x63ab('0x2f')]({'status':0x193,'message':_0x63ab('0xee')});}return db[_0x63ab('0xed')][_0x63ab('0xce')]({'where':{'id':_0x4d250c[_0x63ab('0x57')]['attachId']},'raw':!![]})[_0x63ab('0x21')](handleEntityNotFound(_0x420ed7,null));}})['then'](function(_0xf05ade){if(_0xf05ade){var _0x245ddd=_0xf05ade[_0x63ab('0xef')]!==null;var _0x58ccc9=path[_0x63ab('0xf0')](config[_0x63ab('0xf1')],_0x63ab('0xf2'));if(_0x245ddd){_0x58ccc9=path[_0x63ab('0xf0')](_0x58ccc9,_0x63ab('0xf3'));}var _0x19470c=path[_0x63ab('0xf0')](_0x58ccc9,_0xf05ade[_0x63ab('0xea')]);return _0x420ed7['download'](_0x19470c);}})[_0x63ab('0x2b')](handleError(_0x420ed7,null));};exports['close']=function(_0x8e1f0c,_0x364faf){var _0x5aa183=null;var _0x5edbbc=null;var _0x4de756=null;var _0x5734a8=null;if(_0x8e1f0c[_0x63ab('0x3f')]['id']){delete _0x8e1f0c[_0x63ab('0x3f')]['id'];}if(_0x8e1f0c[_0x63ab('0x3f')][_0x63ab('0xf4')]){_0x5734a8=path[_0x63ab('0xf0')](config[_0x63ab('0xf1')],_0x63ab('0xf5'),util[_0x63ab('0xf6')](_0x63ab('0xf7'),Date[_0x63ab('0xf8')]()));_0x8e1f0c[_0x63ab('0x3f')]['pathTranscript']=_0x5734a8;}return db[_0x63ab('0x53')][_0x63ab('0x78')]({'where':{'id':_0x8e1f0c['params']['id']},'include':[{'model':db['ChatMessage'],'as':_0x63ab('0xf9'),'include':[{'model':db[_0x63ab('0x89')],'as':'User'}]}]})[_0x63ab('0x21')](handleEntityNotFound(_0x364faf,null))[_0x63ab('0x21')](saveUpdates(_0x8e1f0c[_0x63ab('0x3f')],null))['then'](function(_0x547f5e){if(_0x547f5e){_0x5aa183=_0x547f5e;return db[_0x63ab('0xfa')][_0x63ab('0x78')]({'where':{'id':_0x5aa183['ChatWebsiteId']}});}})[_0x63ab('0x21')](function(_0x49ae97){if(_0x49ae97){_0x4de756=_0x49ae97;return db['CmContact'][_0x63ab('0x78')]({'where':{'id':_0x5aa183[_0x63ab('0x83')]}});}})['then'](function(_0x298e8d){if(_0x298e8d){_0x5edbbc=_0x298e8d;if(_0x5734a8){var _0x4bfec8=null;for(var _0x226fa4=0x1;_0x226fa4<_0x5aa183[_0x63ab('0xf9')][_0x63ab('0x5e')];++_0x226fa4){_0x4bfec8=_0x5aa183[_0x63ab('0xf9')][_0x226fa4];var _0x2a74c1=_0x4bfec8[_0x63ab('0x4d')]?util[_0x63ab('0xf6')](_0x63ab('0xfb'),_0x4de756[_0x63ab('0xfc')],_0x4bfec8['UserId']):_0x63ab('0xfd');var _0x2defb4=_0x8e1f0c['body'][_0x63ab('0xfe')]||util['format']('%s%d',_0x63ab('0xff'),_0x4bfec8[_0x63ab('0x83')]);switch(_0x4de756['agentIdentifier']){case _0x63ab('0x100'):_0x2a74c1=_0x4bfec8[_0x63ab('0x4d')]?util[_0x63ab('0xf6')](_0x63ab('0xfb'),_0x4de756[_0x63ab('0xfc')],_0x4bfec8[_0x63ab('0x4d')]):'System';break;case _0x63ab('0x101'):_0x2a74c1=_0x4bfec8['UserId']?_0x4bfec8[_0x63ab('0x89')][_0x63ab('0x102')]||_0x4bfec8[_0x63ab('0x89')][_0x63ab('0x44')]:_0x63ab('0xfd');break;case'agent_fullname':_0x2a74c1=_0x4bfec8[_0x63ab('0x4d')]?_0x4bfec8[_0x63ab('0x89')][_0x63ab('0x44')]:'System';break;default:_0x2a74c1=_0x4bfec8[_0x63ab('0x4d')]?util[_0x63ab('0xf6')](_0x63ab('0xfb'),_0x4de756[_0x63ab('0xfc')],_0x4bfec8[_0x63ab('0x4d')]):'System';}var _0x851d50=util[_0x63ab('0xf6')]('[%s]\x20%s:\x20%s\x0a',moment(_0x4bfec8[_0x63ab('0x8f')])['format'](_0x63ab('0x103')),_0x4bfec8[_0x63ab('0x104')]==='in'?_0x2defb4:_0x2a74c1,_0x4bfec8[_0x63ab('0x3f')]);if(!_0x4bfec8[_0x63ab('0x105')]){fs[_0x63ab('0x106')](_0x5734a8,_0x851d50);}}return db[_0x63ab('0x107')][_0x63ab('0xce')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x63ab('0x108'),'raw':!![]}]});}}})[_0x63ab('0x21')](function(_0x5c60bb){if(_0x5c60bb&&_0x5c60bb[_0x63ab('0x108')]&&_0x8e1f0c[_0x63ab('0x3f')]){var _0x48a1da={'tls':{'rejectUnauthorized':![]}};if(_0x5c60bb['Smtp'][_0x63ab('0x109')]){_0x48a1da[_0x63ab('0x109')]=_0x5c60bb['Smtp'][_0x63ab('0x109')];}else{_0x48a1da[_0x63ab('0x10a')]=_0x5c60bb['Smtp']['host'];_0x48a1da[_0x63ab('0x10b')]=_0x5c60bb[_0x63ab('0x108')][_0x63ab('0x10b')];_0x48a1da['secure']=_0x5c60bb['Smtp'][_0x63ab('0x10c')];}if(_0x5c60bb[_0x63ab('0x108')][_0x63ab('0x10d')]){_0x48a1da['auth']={'user':_0x5c60bb['Smtp'][_0x63ab('0xa7')],'pass':_0x5c60bb[_0x63ab('0x108')][_0x63ab('0x10e')]};}return respondWithRpcPromise(_0x63ab('0x10f'),_0x63ab('0x110'),{'account':_0x48a1da,'message':{'from':util[_0x63ab('0xf6')]('\x22%s\x22\x20<%s>',_0x5c60bb[_0x63ab('0x3c')],_0x5c60bb['email']||_0x5c60bb['Smtp'][_0x63ab('0xa7')]),'to':_0x8e1f0c[_0x63ab('0x3f')][_0x63ab('0xf4')],'subject':'Mail\x20Transcript','text':util[_0x63ab('0xf6')](_0x63ab('0x111'),_0x8e1f0c[_0x63ab('0x3f')][_0x63ab('0xf4')]),'attachments':[{'path':_0x5734a8}]}})['then'](function(){return _0x5aa183;})[_0x63ab('0x2b')](function(_0x27730f){console[_0x63ab('0x27')](_0x27730f);});}else{return _0x5aa183;}})['then'](respondWithStatusCode(_0x364faf,0xc8))['catch'](handleError(_0x364faf,null));};exports['addMessage']=function(_0x2669bd,_0x26915c,_0x409939){return db['ChatMessage'][_0x63ab('0x78')]({'where':{'id':_0x2669bd[_0x63ab('0xc6')]['id']}})[_0x63ab('0x21')](handleEntityNotFound(_0x26915c,null))['then'](function(_0x119e74){if(_0x119e74){return _0x119e74[_0x63ab('0x112')](_0x2669bd[_0x63ab('0x3f')][_0x63ab('0x113')],_[_0x63ab('0x114')](_0x2669bd[_0x63ab('0x3f')],[_0x63ab('0x113'),'id'])||{});}})['then'](respondWithResult(_0x26915c,null))[_0x63ab('0x2b')](handleError(_0x26915c,null));};exports['getMessages']=function(_0x57463c,_0x23899b,_0x1bb002){var _0x1875e4={'raw':![],'where':{}};var _0x23c288={};var _0x3b7d18={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x63ab('0xce')]({'where':{'id':_0x57463c[_0x63ab('0xc6')]['id']}})['then'](handleEntityNotFound(_0x23899b,null))[_0x63ab('0x21')](function(_0x75ea36){if(_0x75ea36){_0x23c288[_0x63ab('0x5a')]=_['keys'](db['ChatMessage']['rawAttributes']);_0x23c288[_0x63ab('0x57')]=_[_0x63ab('0x58')](_0x57463c[_0x63ab('0x57')]);_0x23c288[_0x63ab('0x59')]=_[_0x63ab('0x5c')](_0x23c288[_0x63ab('0x5a')],_0x23c288[_0x63ab('0x57')]);_0x1875e4[_0x63ab('0x5b')]=_[_0x63ab('0x5c')](_0x23c288[_0x63ab('0x5a')],qs[_0x63ab('0x5d')](_0x57463c[_0x63ab('0x57')][_0x63ab('0x5d')]));_0x1875e4[_0x63ab('0x5b')]=_0x1875e4[_0x63ab('0x5b')][_0x63ab('0x5e')]?_0x1875e4[_0x63ab('0x5b')]:_0x23c288[_0x63ab('0x5a')];if(!_0x57463c[_0x63ab('0x57')][_0x63ab('0x115')](_0x63ab('0x5f'))){_0x1875e4[_0x63ab('0x31')]=qs[_0x63ab('0x31')](_0x57463c['query'][_0x63ab('0x31')]);_0x1875e4[_0x63ab('0x33')]=qs[_0x63ab('0x33')](_0x57463c[_0x63ab('0x57')]['offset']);}_0x1875e4['order']=qs['sort'](_0x57463c[_0x63ab('0x57')][_0x63ab('0x116')]);_0x1875e4[_0x63ab('0x61')]=qs[_0x63ab('0x59')](_[_0x63ab('0x62')](_0x57463c[_0x63ab('0x57')],_0x23c288[_0x63ab('0x59')]));_0x1875e4[_0x63ab('0x61')][_0x63ab('0xc2')]=_0x75ea36['id'];if(_0x57463c['query']['filter']){_0x1875e4[_0x63ab('0x61')]=_['merge'](_0x1875e4[_0x63ab('0x61')],{'$or':_[_0x63ab('0x52')](_0x1875e4[_0x63ab('0x5b')],function(_0x4a6ef3){var _0x29ecb6={};_0x29ecb6[_0x4a6ef3]={'$like':'%'+_0x57463c['query']['filter']+'%'};return _0x29ecb6;})});}if(_0x57463c['query'][_0x63ab('0x91')]){var _0x2fb6f2=_0x57463c[_0x63ab('0x57')]['$gte']['split'](',');var _0x30f3e7={};_0x30f3e7[_0x2fb6f2[0x0]]={'$gte':moment(_0x2fb6f2[0x1])['format'](_0x63ab('0x117'))};_0x1875e4[_0x63ab('0x61')]=_[_0x63ab('0x3e')](_0x1875e4[_0x63ab('0x61')],_0x30f3e7);}_0x1875e4=_[_0x63ab('0x3e')]({},_0x1875e4,_0x57463c[_0x63ab('0xca')]);return db[_0x63ab('0xdf')]['count']({'where':_0x1875e4[_0x63ab('0x61')]})['then'](function(_0x7638f9){_0x3b7d18[_0x63ab('0x32')]=_0x7638f9;if(_0x57463c[_0x63ab('0x57')][_0x63ab('0xc8')]){_0x1875e4[_0x63ab('0xc9')]=[{'all':!![]}];}return db[_0x63ab('0xdf')][_0x63ab('0x118')](_0x1875e4);})[_0x63ab('0x21')](function(_0x39fd0d){_0x3b7d18[_0x63ab('0xc4')]=_0x39fd0d;return _0x3b7d18;});}})[_0x63ab('0x21')](respondWithFilteredResult(_0x23899b,_0x1875e4))[_0x63ab('0x2b')](handleError(_0x23899b,null));};exports[_0x63ab('0x119')]=function(_0x53c4f9,_0x8c3b35,_0x5c12fc){var _0x4a565e={'where':{}},_0x2b24b9={},_0x316c90={'count':0x0,'rows':[]};return db[_0x63ab('0x53')][_0x63ab('0xce')]({'where':{'id':_0x53c4f9['params']['id']}})[_0x63ab('0x21')](handleEntityNotFound(_0x8c3b35,null))[_0x63ab('0x21')](function(_0x57ad51){if(_0x57ad51){_0x2b24b9[_0x63ab('0x5a')]=_[_0x63ab('0x58')](db['ChatMessage'][_0x63ab('0xc7')]);_0x2b24b9[_0x63ab('0x57')]=_['keys'](_0x53c4f9[_0x63ab('0x57')]);_0x2b24b9[_0x63ab('0x59')]=_['intersection'](_0x2b24b9[_0x63ab('0x5a')],_0x2b24b9[_0x63ab('0x57')]);_0x4a565e['attributes']=_[_0x63ab('0x5c')](_0x2b24b9['model'],qs['fields'](_0x53c4f9[_0x63ab('0x57')][_0x63ab('0x5d')]));_0x4a565e['attributes']=_0x4a565e[_0x63ab('0x5b')][_0x63ab('0x5e')]?_0x4a565e[_0x63ab('0x5b')]:_0x2b24b9['model'];if(!_0x53c4f9[_0x63ab('0x57')][_0x63ab('0x115')]('nolimit')){_0x4a565e[_0x63ab('0x31')]=qs[_0x63ab('0x31')](_0x53c4f9[_0x63ab('0x57')][_0x63ab('0x31')]);_0x4a565e[_0x63ab('0x33')]=qs['offset'](_0x53c4f9['query'][_0x63ab('0x33')]);}_0x4a565e['order']=qs[_0x63ab('0x116')](_0x53c4f9[_0x63ab('0x57')]['sort']);_0x4a565e[_0x63ab('0x61')]=qs['filters'](_[_0x63ab('0x62')](_0x53c4f9[_0x63ab('0x57')],_0x2b24b9[_0x63ab('0x59')]));_0x4a565e[_0x63ab('0x61')][_0x63ab('0xc2')]=_0x57ad51['id'];if(_0x53c4f9[_0x63ab('0x57')][_0x63ab('0x98')]){_0x4a565e[_0x63ab('0x61')]=_[_0x63ab('0x3e')](_0x4a565e[_0x63ab('0x61')],{'$or':_[_0x63ab('0x52')](_0x4a565e[_0x63ab('0x5b')],function(_0x185a76){var _0x445b0d={};_0x445b0d[_0x185a76]={'$like':'%'+_0x53c4f9['query'][_0x63ab('0x98')]+'%'};return _0x445b0d;})});}_0x4a565e[_0x63ab('0x61')]['secret']=![];if(_0x53c4f9['query']['id']){_0x4a565e[_0x63ab('0x61')]['id']={'$gt':_0x53c4f9['query']['id']};}_0x4a565e=_[_0x63ab('0x3e')]({},_0x4a565e,_0x53c4f9[_0x63ab('0xca')]);return db[_0x63ab('0xdf')][_0x63ab('0x32')]({'where':_0x4a565e[_0x63ab('0x61')]})[_0x63ab('0x21')](function(_0x4102b8){_0x316c90[_0x63ab('0x32')]=_0x4102b8;_0x4a565e[_0x63ab('0xc9')]=[];if(_0x53c4f9['query'][_0x63ab('0x11a')]){_0x4a565e[_0x63ab('0xc9')][_0x63ab('0x48')]({'model':db[_0x63ab('0x89')],'as':_0x63ab('0x89'),'attributes':['id',_0x63ab('0x44'),_0x63ab('0x102')]});}if(_0x53c4f9[_0x63ab('0x57')][_0x63ab('0xc8')]){_0x4a565e[_0x63ab('0xc9')]=[{'all':!![]}];}return db[_0x63ab('0xdf')]['findAll'](_0x4a565e);})[_0x63ab('0x21')](function(_0x4faca8){_0x316c90['rows']=_0x4faca8;return _0x316c90;});}})[_0x63ab('0x21')](respondWithFilteredResult(_0x8c3b35,_0x4a565e))[_0x63ab('0x2b')](handleError(_0x8c3b35,null));};exports[_0x63ab('0x11b')]=function(_0x2d6e79,_0x57d57e,_0x54630e){return db['ChatInteraction']['find']({'where':{'id':_0x2d6e79['params']['id']}})[_0x63ab('0x21')](handleEntityNotFound(_0x57d57e,null))['then'](function(_0x2533f8){if(_0x2533f8){return _0x2533f8[_0x63ab('0x11c')](_0x2d6e79[_0x63ab('0x3f')][_0x63ab('0x113')],_[_0x63ab('0x114')](_0x2d6e79[_0x63ab('0x3f')],[_0x63ab('0x113'),'id'])||{})[_0x63ab('0x11d')](function(){return db[_0x63ab('0x87')][_0x63ab('0x118')]({'attributes':['id',_0x63ab('0x3c'),_0x63ab('0x11e')],'where':{'id':_0x2d6e79[_0x63ab('0x3f')][_0x63ab('0x113')]}});})['then'](function(_0x1ae5f7){socket[_0x63ab('0x11f')]('chatInteractionTags:save',{'id':Number(_0x2d6e79[_0x63ab('0xc6')]['id']),'tags':_0x1ae5f7||[]});return{'id':Number(_0x2d6e79[_0x63ab('0xc6')]['id']),'tags':_0x1ae5f7||[]};});}})[_0x63ab('0x21')](respondWithResult(_0x57d57e,null))[_0x63ab('0x2b')](handleError(_0x57d57e,null));};exports['removeTags']=function(_0x41f3eb,_0x354818,_0xc8bc7e){return db['ChatInteraction'][_0x63ab('0x78')]({'where':{'id':_0x41f3eb['params']['id']}})[_0x63ab('0x21')](handleEntityNotFound(_0x354818,null))[_0x63ab('0x21')](function(_0x2f239a){if(_0x2f239a){return _0x2f239a[_0x63ab('0x120')](_0x41f3eb['query'][_0x63ab('0x113')]);}})[_0x63ab('0x21')](respondWithStatusCode(_0x354818,null))['catch'](handleError(_0x354818,null));};exports[_0x63ab('0x121')]=function(_0x1d6aa0,_0x222825){var _0xf7d182=moment()['unix']()[_0x63ab('0xbf')]();var _0x17426a=path[_0x63ab('0xf0')](config['root'],_0x63ab('0x122'),_0x63ab('0x123'),_0x63ab('0x124'));var _0x262c93=path[_0x63ab('0xf0')](config[_0x63ab('0xf1')],_0x63ab('0x122'),_0x63ab('0x123'),'attachments');var _0x2855b6=path[_0x63ab('0xf0')](_0x17426a,_0xf7d182);var _0x32722a=util['format'](_0x63ab('0x125'),_0x1d6aa0[_0x63ab('0xc6')]['id'],_0xf7d182);var _0x55c817=path[_0x63ab('0xf0')](_0x17426a,_0x32722a);var _0x4430ca=[];_0x4430ca[_0x63ab('0x48')]({'model':db[_0x63ab('0x89')],'as':_0x63ab('0x89'),'attributes':['id',_0x63ab('0x44')],'raw':!![]});_0x4430ca[_0x63ab('0x48')]({'model':db[_0x63ab('0xe2')],'as':'Contact','attributes':['id',_0x63ab('0x126'),_0x63ab('0x127')],'raw':!![]});if(_0x1d6aa0['query'][_0x63ab('0x128')]){_0x4430ca['push']({'model':db[_0x63ab('0xed')],'as':_0x63ab('0xed'),'raw':!![]});}var _0x50e6a3=[{'model':db['ChatMessage'],'as':'Messages','attributes':['id',_0x63ab('0x3f'),'createdAt',_0x63ab('0x104'),_0x63ab('0x105'),_0x63ab('0x95')],'include':_0x4430ca}];_0x50e6a3[_0x63ab('0x48')]({'model':db['ChatWebsite'],'as':_0x63ab('0x129'),'attributes':['id',_0x63ab('0x3c')]});_0x50e6a3['push']({'model':db['User'],'as':_0x63ab('0x12a'),'attributes':['id',_0x63ab('0x44')]});return db[_0x63ab('0x53')]['find']({'where':{'id':_0x1d6aa0['params']['id']},'include':_0x50e6a3})[_0x63ab('0x21')](handleEntityNotFound(_0x222825,null))[_0x63ab('0x21')](function(_0x1d9a1b){if(_0x1d9a1b){var _0x49ae68=_0x1d9a1b[_0x63ab('0x12b')]({'plain':!![]});fs['mkdirSync'](_0x2855b6);var _0x312cef={'channel':'Chat','account':_0x49ae68[_0x63ab('0x129')][_0x63ab('0x3c')],'agent':_0x49ae68[_0x63ab('0x12a')]?_0x49ae68['Owner'][_0x63ab('0x44')]:_0x63ab('0x12c'),'createdAt':moment(_0x49ae68['createdAt'])[_0x63ab('0xf6')](_0x63ab('0x117'))[_0x63ab('0xbf')](),'closedAt':_0x49ae68['closed']?moment(_0x49ae68['closedAt'])[_0x63ab('0xf6')](_0x63ab('0x117'))[_0x63ab('0xbf')]():'','disposition':_0x49ae68[_0x63ab('0x4f')],'chatInfo':{'browser':_0x49ae68['browserName'],'os':_0x49ae68[_0x63ab('0x12d')],'referer':_0x49ae68['referer'],'customerIp':_0x49ae68[_0x63ab('0x12e')],'customerPort':_0x49ae68['customerPort']?_0x49ae68[_0x63ab('0x12f')]:'N.A.'},'messages':_(_0x49ae68['Messages'])[_0x63ab('0x130')]()[_0x63ab('0x98')]({'secret':![]})[_0x63ab('0x52')](function(_0x4c4e05){if(_0x4c4e05[_0x63ab('0xed')]){var _0x1df169=path[_0x63ab('0xf0')](_0x262c93,_0x4c4e05['Attachment'][_0x63ab('0xea')]);if(fs[_0x63ab('0x131')](_0x1df169)){fs['createReadStream'](_0x1df169)[_0x63ab('0x132')](fs[_0x63ab('0x133')](path[_0x63ab('0xf0')](_0x2855b6,_0x4c4e05[_0x63ab('0xed')][_0x63ab('0xea')])));}}return{'date':moment(_0x4c4e05[_0x63ab('0x8f')])['format'](_0x63ab('0x117'))[_0x63ab('0xbf')](),'sender':_0x4c4e05[_0x63ab('0x104')]==='out'?_0x4c4e05[_0x63ab('0x89')]?_0x4c4e05[_0x63ab('0x89')][_0x63ab('0x44')]:_0x63ab('0xfd'):_0x4c4e05['Contact'][_0x63ab('0x126')]+(_0x4c4e05['Contact']['lastName']?'\x20'+_0x4c4e05[_0x63ab('0x7d')][_0x63ab('0x127')]:''),'body':_0x4c4e05[_0x63ab('0xed')]?_0x4c4e05[_0x63ab('0xed')][_0x63ab('0xea')]:_0x4c4e05[_0x63ab('0x3f')],'direction':_0x4c4e05[_0x63ab('0x104')]===_0x63ab('0xde')?'A':'C','secret':_0x4c4e05[_0x63ab('0x105')],'read':_0x4c4e05[_0x63ab('0x95')],'attachment':_0x4c4e05['Attachment']};})[_0x63ab('0x7a')]()};return ejs[_0x63ab('0x134')](path[_0x63ab('0xf0')](config['root'],_0x63ab('0x122'),'views',_0x63ab('0x135')),{'interaction':_0x312cef})['then'](function(_0x13162a){var _0x57a230=path['join'](_0x2855b6,'transcript-'+_0x49ae68['id']+'-'+_0xf7d182+'.pdf');var _0x252acb={'path':_0x57a230,'channel':'Chat','interactionId':_0x49ae68['id']};return pdf['createPdfFromHTML'](_0x13162a,_0x252acb);})[_0x63ab('0x21')](function(){return new BPromise(function(_0xaebc82,_0x366338){zipdir(_0x2855b6,{'saveTo':_0x55c817},function(_0x96772a,_0x61f29f){if(_0x96772a)return _0x366338(_0x96772a);return _0xaebc82(_0x61f29f);});})[_0x63ab('0x21')](function(){return new BPromise(function(_0x4cfc03,_0x3f0ab2){rimraf(_0x2855b6,function(_0x2454d4){if(_0x2454d4)_0x3f0ab2(_0x2454d4);return _0x4cfc03();});});})[_0x63ab('0x21')](function(){return _0x222825[_0x63ab('0x121')](_0x55c817,_0x32722a,function(_0x42ba6a){if(_0x42ba6a){console[_0x63ab('0x136')](_0x63ab('0x137'),_0x42ba6a);}else{fs[_0x63ab('0x138')](_0x55c817);}});});});}else{return _0x222825[_0x63ab('0x2c')](0xc8);}})[_0x63ab('0x2b')](handleError(_0x222825,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 2a447b3..c2c719d 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 _0x925d=['findAll','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map'];(function(_0x47c337,_0x6b2958){var _0xff941b=function(_0x314f88){while(--_0x314f88){_0x47c337['push'](_0x47c337['shift']());}};_0xff941b(++_0x6b2958);}(_0x925d,0xbb));var _0xd925=function(_0x5a4fb9,_0xd0a16e){_0x5a4fb9=_0x5a4fb9-0x0;var _0x56e16e=_0x925d[_0x5a4fb9];return _0x56e16e;};'use strict';var EventEmitter=require(_0xd925('0x0'));var ChatInteraction=require(_0xd925('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0xd925('0x1'))['db'][_0xd925('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xd925('0x3')](0x0);var events={'afterCreate':_0xd925('0x4'),'afterUpdate':_0xd925('0x5'),'afterDestroy':'remove'};function emitEvent(_0x15c5c7){return function(_0x1ca25f,_0x55fc35,_0x4ac892){_0x1ca25f[_0xd925('0x6')]({'attributes':['id'],'raw':!![]})[_0xd925('0x7')](function(_0x9a9edb){_0x1ca25f[_0xd925('0x8')](_0xd925('0x9'),_0x9a9edb[_0xd925('0xa')](function(_0x184ad2){return{'id':_0x184ad2['id']};}));return ChatMessage[_0xd925('0xb')]({'where':{'ChatInteractionId':_0x1ca25f['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd925('0x7')](function(_0x58b2f5){_0x1ca25f[_0xd925('0x8')]('unreadMessages',_0x58b2f5[_0xd925('0xc')]);ChatInteractionEvents[_0xd925('0xd')](_0x15c5c7+':'+_0x1ca25f['id'],_0x1ca25f);ChatInteractionEvents[_0xd925('0xd')](_0x15c5c7,_0x1ca25f);_0x4ac892(null);})[_0xd925('0xe')](_0x4ac892(null));};}for(var e in events){if(events[_0xd925('0xf')](e)){var event=events[e];ChatInteraction[_0xd925('0x10')](e,emitEvent(event));}}module[_0xd925('0x11')]=ChatInteractionEvents; \ No newline at end of file +var _0xb2c3=['then','setDataValue','Users','map','findAll','length','emit','catch','hook','events','../../mysqldb','ChatMessage','setMaxListeners','save','update'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0xb2c3,0xdb));var _0x3b2c=function(_0x198446,_0x119c8f){_0x198446=_0x198446-0x0;var _0x38d7b7=_0xb2c3[_0x198446];return _0x38d7b7;};'use strict';var EventEmitter=require(_0x3b2c('0x0'));var ChatInteraction=require(_0x3b2c('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0x3b2c('0x1'))['db'][_0x3b2c('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x3b2c('0x3')](0x0);var events={'afterCreate':_0x3b2c('0x4'),'afterUpdate':_0x3b2c('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1b466f){return function(_0x16f155,_0x21cccb,_0x32bde6){_0x16f155['getUsers']({'attributes':['id'],'raw':!![]})[_0x3b2c('0x6')](function(_0x54eb55){_0x16f155[_0x3b2c('0x7')](_0x3b2c('0x8'),_0x54eb55[_0x3b2c('0x9')](function(_0x4677e2){return{'id':_0x4677e2['id']};}));return ChatMessage[_0x3b2c('0xa')]({'where':{'ChatInteractionId':_0x16f155['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3b2c('0x6')](function(_0x2a245c){_0x16f155[_0x3b2c('0x7')]('unreadMessages',_0x2a245c[_0x3b2c('0xb')]);ChatInteractionEvents[_0x3b2c('0xc')](_0x1b466f+':'+_0x16f155['id'],_0x16f155);ChatInteractionEvents[_0x3b2c('0xc')](_0x1b466f,_0x16f155);_0x32bde6(null);})[_0x3b2c('0xd')](_0x32bde6(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x3b2c('0xe')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index cbc9c4b..3748fed 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 _0x1296=['utf8mb4','utf8mb4_unicode_ci','lodash','util','api','request-promise','path','rimraf','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4c06a3,_0x1e6b6f){var _0x7ff53c=function(_0x559eff){while(--_0x559eff){_0x4c06a3['push'](_0x4c06a3['shift']());}};_0x7ff53c(++_0x1e6b6f);}(_0x1296,0x134));var _0x6129=function(_0x440a1f,_0x13e782){_0x440a1f=_0x440a1f-0x0;var _0x1ef57c=_0x1296[_0x440a1f];return _0x1ef57c;};'use strict';var _=require(_0x6129('0x0'));var util=require(_0x6129('0x1'));var logger=require('../../config/logger')(_0x6129('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6129('0x3'));var fs=require('fs');var path=require(_0x6129('0x4'));var rimraf=require(_0x6129('0x5'));var config=require('../../config/environment');var attributes=require(_0x6129('0x6'));module[_0x6129('0x7')]=function(_0x2ac1c1,_0x2b898b){return _0x2ac1c1[_0x6129('0x8')](_0x6129('0x9'),attributes,{'tableName':_0x6129('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x587ae5,_0x3c1851,_0x1f5f94){if(_0x587ae5[_0x6129('0xb')](_0x6129('0xc'))){_0x587ae5['closedAt']=moment()[_0x6129('0xd')](_0x6129('0xe'));}_0x1f5f94(null,_0x587ae5);}},'charset':_0x6129('0xf'),'collate':_0x6129('0x10')});}; \ No newline at end of file +var _0x2fbe=['util','bluebird','rimraf','./chatInteraction.attributes','exports','define','ChatInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x4de1c7,_0x1dd3e4){var _0x396948=function(_0xf62595){while(--_0xf62595){_0x4de1c7['push'](_0x4de1c7['shift']());}};_0x396948(++_0x1dd3e4);}(_0x2fbe,0xd1));var _0xe2fb=function(_0x158444,_0x13f2f1){_0x158444=_0x158444-0x0;var _0x3e29f3=_0x2fbe[_0x158444];return _0x3e29f3;};'use strict';var _=require(_0xe2fb('0x0'));var util=require(_0xe2fb('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xe2fb('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe2fb('0x3'));var config=require('../../config/environment');var attributes=require(_0xe2fb('0x4'));module[_0xe2fb('0x5')]=function(_0x2e3908,_0x25e377){return _0x2e3908[_0xe2fb('0x6')](_0xe2fb('0x7'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x538c5c,_0x4606f6,_0x45ce58){if(_0x538c5c[_0xe2fb('0x8')](_0xe2fb('0x9'))){_0x538c5c[_0xe2fb('0xa')]=moment()[_0xe2fb('0xb')](_0xe2fb('0xc'));}_0x45ce58(null,_0x538c5c);}},'charset':_0xe2fb('0xd'),'collate':_0xe2fb('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index df16507..579af6f 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 _0xe94c=['stringify','where','ids','omit','spread','AddTags','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','redis','localhost','socket.io-emitter','register','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateChatInteraction','ChatInteraction','body','options','raw','attributes','then'];(function(_0x268698,_0x49d523){var _0x5b8946=function(_0x35f6ec){while(--_0x35f6ec){_0x268698['push'](_0x268698['shift']());}};_0x5b8946(++_0x49d523);}(_0xe94c,0x19e));var _0xce94=function(_0x2225dc,_0x3fac7e){_0x2225dc=_0x2225dc-0x0;var _0x434d11=_0xe94c[_0x2225dc];return _0x434d11;};'use strict';var _=require(_0xce94('0x0'));var util=require(_0xce94('0x1'));var moment=require(_0xce94('0x2'));var BPromise=require(_0xce94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xce94('0x4'));var logger=require(_0xce94('0x5'))(_0xce94('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xce94('0x7')]=_['defaults'](config[_0xce94('0x7')],{'host':_0xce94('0x8'),'port':0x18eb});var socket=require(_0xce94('0x9'))(new Redis(config[_0xce94('0x7')]));require('./chatInteraction.socket')[_0xce94('0xa')](socket);function respondWithRpcPromise(_0x101af9,_0x4d6b78,_0x4bad78){return new BPromise(function(_0x366c52,_0x1067ac){return client[_0xce94('0xb')](_0x101af9,_0x4bad78)['then'](function(_0x22ad22){logger[_0xce94('0xc')](_0xce94('0xd'),_0x4d6b78,_0xce94('0xe'));logger[_0xce94('0xf')](_0xce94('0x10'),_0x4d6b78,'request\x20sent',JSON['stringify'](_0x22ad22));if(_0x22ad22[_0xce94('0x11')]){if(_0x22ad22[_0xce94('0x11')]['code']===0x1f4){logger['error'](_0xce94('0xd'),_0x4d6b78,_0x22ad22['error'][_0xce94('0x12')]);return _0x1067ac(_0x22ad22[_0xce94('0x11')]['message']);}logger[_0xce94('0x11')](_0xce94('0xd'),_0x4d6b78,_0x22ad22['error'][_0xce94('0x12')]);return _0x366c52(_0x22ad22[_0xce94('0x11')]['message']);}else{logger[_0xce94('0xc')](_0xce94('0xd'),_0x4d6b78,_0xce94('0xe'));_0x366c52(_0x22ad22[_0xce94('0x13')][_0xce94('0x12')]);}})[_0xce94('0x14')](function(_0x419190){logger[_0xce94('0x11')](_0xce94('0xd'),_0x4d6b78,_0x419190);_0x1067ac(_0x419190);});});}exports[_0xce94('0x15')]=function(_0x3aa8aa){var _0x9db70c=this;return new Promise(function(_0x7823ae,_0x26fc77){return db[_0xce94('0x16')]['update'](_0x3aa8aa[_0xce94('0x17')],{'raw':_0x3aa8aa[_0xce94('0x18')]?_0x3aa8aa[_0xce94('0x18')][_0xce94('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3aa8aa['options']?_0x3aa8aa['options']['where']||null:null,'attributes':_0x3aa8aa[_0xce94('0x18')]?_0x3aa8aa[_0xce94('0x18')][_0xce94('0x1a')]||null:null,'limit':_0x3aa8aa[_0xce94('0x18')]?_0x3aa8aa[_0xce94('0x18')]['limit']||null:null})[_0xce94('0x1b')](function(_0x1b7962){logger['info'](_0xce94('0x15'),_0x3aa8aa);logger['debug'](_0xce94('0x15'),_0x3aa8aa,JSON[_0xce94('0x1c')](_0x1b7962));_0x7823ae(_0x1b7962);})[_0xce94('0x14')](function(_0x557e76){logger[_0xce94('0x11')]('UpdateChatInteraction',_0x557e76[_0xce94('0x12')],_0x3aa8aa);_0x26fc77(_0x9db70c['error'](0x1f4,_0x557e76[_0xce94('0x12')]));});});};exports['AddTagsToChatInteraction']=function(_0x35acee){return new Promise(function(_0x4926b8,_0x90ae04){return db[_0xce94('0x16')]['find']({'where':_0x35acee[_0xce94('0x18')]?_0x35acee['options'][_0xce94('0x1d')]||null:null})[_0xce94('0x1b')](function(_0x23da2a){if(_0x23da2a){return _0x23da2a['addTags'](_0x35acee[_0xce94('0x17')][_0xce94('0x1e')],_[_0xce94('0x1f')](_0x35acee[_0xce94('0x17')],[_0xce94('0x1e'),'id'])||{});}})[_0xce94('0x20')](function(_0x5048fd){logger[_0xce94('0xc')](_0xce94('0x21'),_0x35acee);logger[_0xce94('0xf')]('AddTags',_0x35acee,JSON[_0xce94('0x1c')](_0x5048fd));_0x4926b8(_0x5048fd);})['catch'](function(_0x57716f){logger['error'](_0xce94('0x21'),_0x57716f['message'],_0x35acee);_0x90ae04(_this[_0xce94('0x11')](0x1f4,_0x57716f[_0xce94('0x12')]));});});}; \ No newline at end of file +var _0x52e5=['./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','AddTagsToChatInteraction','find','addTags','ids','spread','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter'];(function(_0x2ae15f,_0x3e1860){var _0x42a3d3=function(_0xcd0e60){while(--_0xcd0e60){_0x2ae15f['push'](_0x2ae15f['shift']());}};_0x42a3d3(++_0x3e1860);}(_0x52e5,0x13a));var _0x552e=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x52e5[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x552e('0x0'));var util=require('util');var moment=require(_0x552e('0x1'));var BPromise=require('bluebird');var rs=require(_0x552e('0x2'));var fs=require('fs');var Redis=require(_0x552e('0x3'));var db=require(_0x552e('0x4'))['db'];var utils=require(_0x552e('0x5'));var logger=require(_0x552e('0x6'))(_0x552e('0x7'));var config=require(_0x552e('0x8'));var jayson=require(_0x552e('0x9'));var client=jayson['client'][_0x552e('0xa')]({'port':0x232a});config[_0x552e('0xb')]=_[_0x552e('0xc')](config[_0x552e('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x552e('0xd'))(new Redis(config[_0x552e('0xb')]));require(_0x552e('0xe'))['register'](socket);function respondWithRpcPromise(_0x596d27,_0x29e52c,_0x2c3496){return new BPromise(function(_0x368512,_0x3091ce){return client[_0x552e('0xf')](_0x596d27,_0x2c3496)[_0x552e('0x10')](function(_0x271f39){logger[_0x552e('0x11')](_0x552e('0x12'),_0x29e52c,_0x552e('0x13'));logger[_0x552e('0x14')](_0x552e('0x15'),_0x29e52c,_0x552e('0x13'),JSON[_0x552e('0x16')](_0x271f39));if(_0x271f39[_0x552e('0x17')]){if(_0x271f39[_0x552e('0x17')][_0x552e('0x18')]===0x1f4){logger[_0x552e('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x29e52c,_0x271f39['error'][_0x552e('0x19')]);return _0x3091ce(_0x271f39[_0x552e('0x17')][_0x552e('0x19')]);}logger[_0x552e('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x29e52c,_0x271f39[_0x552e('0x17')]['message']);return _0x368512(_0x271f39[_0x552e('0x17')][_0x552e('0x19')]);}else{logger[_0x552e('0x11')](_0x552e('0x12'),_0x29e52c,_0x552e('0x13'));_0x368512(_0x271f39['result']['message']);}})[_0x552e('0x1a')](function(_0x52c6eb){logger[_0x552e('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x29e52c,_0x52c6eb);_0x3091ce(_0x52c6eb);});});}exports[_0x552e('0x1b')]=function(_0x19340a){var _0x1c7807=this;return new Promise(function(_0x23b6cf,_0x2f28f5){return db[_0x552e('0x1c')][_0x552e('0x1d')](_0x19340a[_0x552e('0x1e')],{'raw':_0x19340a[_0x552e('0x1f')]?_0x19340a['options'][_0x552e('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19340a['options']?_0x19340a[_0x552e('0x1f')][_0x552e('0x21')]||null:null,'attributes':_0x19340a['options']?_0x19340a[_0x552e('0x1f')][_0x552e('0x22')]||null:null,'limit':_0x19340a[_0x552e('0x1f')]?_0x19340a[_0x552e('0x1f')]['limit']||null:null})['then'](function(_0x425cc3){logger['info'](_0x552e('0x1b'),_0x19340a);logger[_0x552e('0x14')]('UpdateChatInteraction',_0x19340a,JSON[_0x552e('0x16')](_0x425cc3));_0x23b6cf(_0x425cc3);})[_0x552e('0x1a')](function(_0x493bcc){logger[_0x552e('0x17')](_0x552e('0x1b'),_0x493bcc[_0x552e('0x19')],_0x19340a);_0x2f28f5(_0x1c7807[_0x552e('0x17')](0x1f4,_0x493bcc[_0x552e('0x19')]));});});};exports[_0x552e('0x23')]=function(_0x5e15e2){return new Promise(function(_0x2900ce,_0x2cc854){return db[_0x552e('0x1c')][_0x552e('0x24')]({'where':_0x5e15e2[_0x552e('0x1f')]?_0x5e15e2['options']['where']||null:null})[_0x552e('0x10')](function(_0x33113b){if(_0x33113b){return _0x33113b[_0x552e('0x25')](_0x5e15e2[_0x552e('0x1e')][_0x552e('0x26')],_['omit'](_0x5e15e2[_0x552e('0x1e')],[_0x552e('0x26'),'id'])||{});}})[_0x552e('0x27')](function(_0x55809b){logger['info'](_0x552e('0x28'),_0x5e15e2);logger[_0x552e('0x14')](_0x552e('0x28'),_0x5e15e2,JSON[_0x552e('0x16')](_0x55809b));_0x2900ce(_0x55809b);})[_0x552e('0x1a')](function(_0x506589){logger[_0x552e('0x17')](_0x552e('0x28'),_0x506589[_0x552e('0x19')],_0x5e15e2);_0x2cc854(_this['error'](0x1f4,_0x506589['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 9feafa3..26ed46c 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 _0x29cb=['save','emit','register','length','chatInteraction:','./chatInteraction.events'];(function(_0x4dadd0,_0xd02549){var _0x3daaac=function(_0x58347d){while(--_0x58347d){_0x4dadd0['push'](_0x4dadd0['shift']());}};_0x3daaac(++_0xd02549);}(_0x29cb,0x107));var _0xb29c=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x29cb[_0x3bf83f];return _0x22c4a9;};'use strict';var ChatInteractionEvents=require(_0xb29c('0x0'));var events=[_0xb29c('0x1'),'remove','update'];function createListener(_0x413c32,_0x1ee7a5){return function(_0x3f6ce4){_0x1ee7a5[_0xb29c('0x2')](_0x413c32,_0x3f6ce4);};}function removeListener(_0x50f07a,_0x1dc4de){return function(){ChatInteractionEvents['removeListener'](_0x50f07a,_0x1dc4de);};}exports[_0xb29c('0x3')]=function(_0x572913){for(var _0x3dc922=0x0,_0xb0c6db=events[_0xb29c('0x4')];_0x3dc922<_0xb0c6db;_0x3dc922++){var _0x101549=events[_0x3dc922];var _0xfc3ddf=createListener(_0xb29c('0x5')+_0x101549,_0x572913);ChatInteractionEvents['on'](_0x101549,_0xfc3ddf);}}; \ No newline at end of file +var _0x5d89=['save','remove','update','removeListener','register','length','chatInteraction:','./chatInteraction.events'];(function(_0x5d8e7f,_0x3912ef){var _0x382811=function(_0x42c860){while(--_0x42c860){_0x5d8e7f['push'](_0x5d8e7f['shift']());}};_0x382811(++_0x3912ef);}(_0x5d89,0xd7));var _0x95d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d89[_0x3dd15e];return _0x231fd0;};'use strict';var ChatInteractionEvents=require(_0x95d8('0x0'));var events=[_0x95d8('0x1'),_0x95d8('0x2'),_0x95d8('0x3')];function createListener(_0x3aaa8d,_0xd883e7){return function(_0x253c65){_0xd883e7['emit'](_0x3aaa8d,_0x253c65);};}function removeListener(_0x4d8536,_0x49c1f4){return function(){ChatInteractionEvents[_0x95d8('0x4')](_0x4d8536,_0x49c1f4);};}exports[_0x95d8('0x5')]=function(_0x529a5f){for(var _0x14302f=0x0,_0x366ee4=events[_0x95d8('0x6')];_0x14302f<_0x366ee4;_0x14302f++){var _0x30adbc=events[_0x14302f];var _0x330b52=createListener(_0x95d8('0x7')+_0x30adbc,_0x529a5f);ChatInteractionEvents['on'](_0x30adbc,_0x330b52);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 0d13d13..802f447 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 _0x3b4c=['/:id','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','/:id/my_messages','getMyMessages','/:id/download','download','create','createVidaooSession','diskStorage','root','server/files/attachments/','now','originalname','replace','/:id/attachment_upload','file','attachmentUpload','post','addMessage','tracked','chat','chatinteraction:addtags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','delete','chatinteraction:destroy','removeTags','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','get','/describe','describe'];(function(_0x505493,_0xa913c8){var _0x5604cc=function(_0x23f626){while(--_0x23f626){_0x505493['push'](_0x505493['shift']());}};_0x5604cc(++_0xa913c8);}(_0x3b4c,0x14b));var _0xc3b4=function(_0xf639ec,_0x361622){_0xf639ec=_0xf639ec-0x0;var _0x45e7fc=_0x3b4c[_0xf639ec];return _0x45e7fc;};'use strict';var multer=require('multer');var util=require(_0xc3b4('0x0'));var path=require(_0xc3b4('0x1'));var timeout=require(_0xc3b4('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc3b4('0x3'));var auth=require(_0xc3b4('0x4'));var interaction=require(_0xc3b4('0x5'));var config=require(_0xc3b4('0x6'));var controller=require(_0xc3b4('0x7'));router['get']('/',auth[_0xc3b4('0x8')](),controller['index']);router[_0xc3b4('0x9')](_0xc3b4('0xa'),auth[_0xc3b4('0x8')](),controller[_0xc3b4('0xb')]);router[_0xc3b4('0x9')](_0xc3b4('0xc'),auth[_0xc3b4('0xd')](),controller[_0xc3b4('0xe')]);router[_0xc3b4('0x9')](_0xc3b4('0xf'),auth[_0xc3b4('0xd')](),controller['attachmentDownload']);router[_0xc3b4('0x9')](_0xc3b4('0x10'),auth['isAuthenticated'](),controller['getMessages']);router[_0xc3b4('0x9')](_0xc3b4('0x11'),auth[_0xc3b4('0xd')](),controller[_0xc3b4('0x12')]);router[_0xc3b4('0x9')](_0xc3b4('0x13'),auth[_0xc3b4('0x8')](),controller[_0xc3b4('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc3b4('0x15')]);router['post']('/:id/vidaoo',auth[_0xc3b4('0x8')](),controller[_0xc3b4('0x16')]);var upload=multer({'storage':multer[_0xc3b4('0x17')]({'destination':function(_0x424977,_0x5e8c6b,_0x1a0857){_0x1a0857(null,path['join'](config[_0xc3b4('0x18')],_0xc3b4('0x19')));},'filename':function(_0x561bd0,_0x3238b5,_0x4fd64a){_0x4fd64a(null,util['format']('%s-%s',Date[_0xc3b4('0x1a')](),_0x3238b5[_0xc3b4('0x1b')][_0xc3b4('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xc3b4('0x1d'),upload['single'](_0xc3b4('0x1e')),controller[_0xc3b4('0x1f')]);router[_0xc3b4('0x20')](_0xc3b4('0x10'),auth[_0xc3b4('0xd')](),controller[_0xc3b4('0x21')]);router[_0xc3b4('0x20')]('/:id/tags',auth[_0xc3b4('0x8')](),interaction[_0xc3b4('0x22')](_0xc3b4('0x23'),_0xc3b4('0x24')),controller['addTags']);router[_0xc3b4('0x25')](_0xc3b4('0xc'),auth['isAuthenticated'](),interaction['tracked']('chat',_0xc3b4('0x26')),controller[_0xc3b4('0x27')]);router[_0xc3b4('0x25')](_0xc3b4('0x28'),controller[_0xc3b4('0x29')]);router[_0xc3b4('0x25')](_0xc3b4('0x2a'),auth['isChatInteractionAuthorized'](),controller[_0xc3b4('0x2b')]);router['put'](_0xc3b4('0x2c'),controller['close']);router[_0xc3b4('0x2d')](_0xc3b4('0xc'),auth['isAuthenticated'](),interaction['tracked'](_0xc3b4('0x23'),_0xc3b4('0x2e')),controller['destroy']);router[_0xc3b4('0x2d')]('/:id/tags',auth[_0xc3b4('0x8')](),controller[_0xc3b4('0x2f')]);module[_0xc3b4('0x30')]=router; \ No newline at end of file +var _0x5b65=['/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','server/files/attachments/','format','%s-%s','originalname','replace','/:id/attachment_upload','single','attachmentUpload','/:id/tags','tracked','addTags','chat','chatinteraction:update','update','put','/:id/custom_update','customUpdate'];(function(_0x302bdb,_0x42a7b3){var _0xebf218=function(_0x55b8f2){while(--_0x55b8f2){_0x302bdb['push'](_0x302bdb['shift']());}};_0xebf218(++_0x42a7b3);}(_0x5b65,0x189));var _0x55b6=function(_0xc8ac92,_0x3fd196){_0xc8ac92=_0xc8ac92-0x0;var _0x1057f6=_0x5b65[_0xc8ac92];return _0x1057f6;};'use strict';var multer=require(_0x55b6('0x0'));var util=require(_0x55b6('0x1'));var path=require('path');var timeout=require(_0x55b6('0x2'));var express=require(_0x55b6('0x3'));var router=express[_0x55b6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x55b6('0x5'));var interaction=require(_0x55b6('0x6'));var config=require(_0x55b6('0x7'));var controller=require(_0x55b6('0x8'));router[_0x55b6('0x9')]('/',auth[_0x55b6('0xa')](),controller[_0x55b6('0xb')]);router['get'](_0x55b6('0xc'),auth[_0x55b6('0xa')](),controller[_0x55b6('0xd')]);router[_0x55b6('0x9')](_0x55b6('0xe'),auth[_0x55b6('0xf')](),controller[_0x55b6('0x10')]);router[_0x55b6('0x9')](_0x55b6('0x11'),auth[_0x55b6('0xf')](),controller[_0x55b6('0x12')]);router[_0x55b6('0x9')](_0x55b6('0x13'),auth['isAuthenticated'](),controller[_0x55b6('0x14')]);router[_0x55b6('0x9')](_0x55b6('0x15'),auth[_0x55b6('0xf')](),controller['getMyMessages']);router[_0x55b6('0x9')](_0x55b6('0x16'),auth[_0x55b6('0xa')](),controller[_0x55b6('0x17')]);router[_0x55b6('0x18')]('/',auth['isAuthenticated'](),controller[_0x55b6('0x19')]);router[_0x55b6('0x18')](_0x55b6('0x1a'),auth[_0x55b6('0xa')](),controller[_0x55b6('0x1b')]);var upload=multer({'storage':multer[_0x55b6('0x1c')]({'destination':function(_0x15ce3a,_0x3ee380,_0x5dbdda){_0x5dbdda(null,path[_0x55b6('0x1d')](config['root'],_0x55b6('0x1e')));},'filename':function(_0x4038d4,_0x554ce0,_0x2d3a3b){_0x2d3a3b(null,util[_0x55b6('0x1f')](_0x55b6('0x20'),Date['now'](),_0x554ce0[_0x55b6('0x21')][_0x55b6('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x55b6('0x18')](_0x55b6('0x23'),upload[_0x55b6('0x24')]('file'),controller[_0x55b6('0x25')]);router[_0x55b6('0x18')](_0x55b6('0x13'),auth[_0x55b6('0xf')](),controller['addMessage']);router[_0x55b6('0x18')](_0x55b6('0x26'),auth['isAuthenticated'](),interaction[_0x55b6('0x27')]('chat','chatinteraction:addtags'),controller[_0x55b6('0x28')]);router['put'](_0x55b6('0xe'),auth[_0x55b6('0xa')](),interaction[_0x55b6('0x27')](_0x55b6('0x29'),_0x55b6('0x2a')),controller[_0x55b6('0x2b')]);router[_0x55b6('0x2c')](_0x55b6('0x2d'),controller[_0x55b6('0x2e')]);router['put'](_0x55b6('0x2f'),auth[_0x55b6('0xf')](),controller[_0x55b6('0x30')]);router[_0x55b6('0x2c')](_0x55b6('0x31'),controller[_0x55b6('0x32')]);router[_0x55b6('0x33')](_0x55b6('0xe'),auth['isAuthenticated'](),interaction[_0x55b6('0x27')](_0x55b6('0x29'),_0x55b6('0x34')),controller['destroy']);router[_0x55b6('0x33')](_0x55b6('0x26'),auth['isAuthenticated'](),controller[_0x55b6('0x35')]);module[_0x55b6('0x36')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 7ab18c4..52cdf8c 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 _0xe9a6=['medium','BOOLEAN','INTEGER','exports','TEXT'];(function(_0x2bab61,_0x499005){var _0x1f91d1=function(_0xf1bca9){while(--_0xf1bca9){_0x2bab61['push'](_0x2bab61['shift']());}};_0x1f91d1(++_0x499005);}(_0xe9a6,0xee));var _0x6e9a=function(_0x34e0db,_0x399690){_0x34e0db=_0x34e0db-0x0;var _0x6f452c=_0xe9a6[_0x34e0db];return _0x6f452c;};'use strict';var Sequelize=require('sequelize');module[_0x6e9a('0x0')]={'body':{'type':Sequelize[_0x6e9a('0x1')](_0x6e9a('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x6e9a('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x6e9a('0x4')]}}; \ No newline at end of file +var _0x4b00=['TEXT','medium','INTEGER','sequelize','exports'];(function(_0x515099,_0x46bdbd){var _0x26e0a7=function(_0x47df3b){while(--_0x47df3b){_0x515099['push'](_0x515099['shift']());}};_0x26e0a7(++_0x46bdbd);}(_0x4b00,0xa8));var _0x04b0=function(_0x2b01fe,_0x2794ed){_0x2b01fe=_0x2b01fe-0x0;var _0x40e106=_0x4b00[_0x2b01fe];return _0x40e106;};'use strict';var Sequelize=require(_0x04b0('0x0'));module[_0x04b0('0x1')]={'body':{'type':Sequelize[_0x04b0('0x2')](_0x04b0('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x04b0('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index e8d567c..89497dc 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 _0x5a27=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','stack','name','send','rawAttributes','fieldName','type','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','ChatInternalMessage','then','includeAll','include','findAll','rows','show','params','create','body','catch','find','destroy','describe','get','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','admin','user','fullname','role','userpic','internal','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','isEmpty','agent','resourceId','push','messages','ToId','read','-createdAt','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x20b01d,_0x5400d5){var _0x3d336a=function(_0xa97597){while(--_0xa97597){_0x20b01d['push'](_0x20b01d['shift']());}};_0x3d336a(++_0x5400d5);}(_0x5a27,0xd1));var _0x75a2=function(_0x17c598,_0x64a191){_0x17c598=_0x17c598-0x0;var _0xcf097=_0x5a27[_0x17c598];return _0xcf097;};'use strict';var emlformat=require(_0x75a2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x75a2('0x1'));var rp=require(_0x75a2('0x2'));var moment=require(_0x75a2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x75a2('0x4'));var util=require(_0x75a2('0x5'));var path=require(_0x75a2('0x6'));var sox=require(_0x75a2('0x7'));var csv=require(_0x75a2('0x8'));var ejs=require(_0x75a2('0x9'));var fs=require('fs');var fs_extra=require(_0x75a2('0xa'));var _=require(_0x75a2('0xb'));var squel=require(_0x75a2('0xc'));var crypto=require(_0x75a2('0xd'));var jsforce=require(_0x75a2('0xe'));var deskjs=require(_0x75a2('0xf'));var toCsv=require(_0x75a2('0x8'));var querystring=require(_0x75a2('0x10'));var Papa=require(_0x75a2('0x11'));var Redis=require(_0x75a2('0x12'));var authService=require(_0x75a2('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x75a2('0x14'));var hardwareService=require(_0x75a2('0x15'));var logger=require('../../config/logger')(_0x75a2('0x16'));var utils=require('../../config/utils');var config=require(_0x75a2('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x75a2('0x18'))['db'];config[_0x75a2('0x19')]=_[_0x75a2('0x1a')](config['redis'],{'host':_0x75a2('0x1b'),'port':0x18eb});var socket=require(_0x75a2('0x1c'))(new Redis(config['redis']));require(_0x75a2('0x1d'))[_0x75a2('0x1e')](socket);function respondWithStatusCode(_0xe9e218,_0x35963a){_0x35963a=_0x35963a||0xcc;return function(_0x213e33){if(_0x213e33){return _0xe9e218[_0x75a2('0x1f')](_0x35963a);}return _0xe9e218[_0x75a2('0x20')](_0x35963a)[_0x75a2('0x21')]();};}function respondWithResult(_0x995ac6,_0x4fdb2c){_0x4fdb2c=_0x4fdb2c||0xc8;return function(_0x2b0b33){if(_0x2b0b33){return _0x995ac6[_0x75a2('0x20')](_0x4fdb2c)[_0x75a2('0x22')](_0x2b0b33);}};}function respondWithFilteredResult(_0x2a190e,_0x153d46){return function(_0x4b114a){if(_0x4b114a){var _0x598a86=typeof _0x153d46[_0x75a2('0x23')]===_0x75a2('0x24')&&typeof _0x153d46[_0x75a2('0x25')]==='undefined';var _0x38c8fb=_0x4b114a[_0x75a2('0x26')];var _0x56b1a7=_0x598a86?0x0:_0x153d46[_0x75a2('0x23')];var _0xcf8024=_0x598a86?_0x4b114a[_0x75a2('0x26')]:_0x153d46['offset']+_0x153d46[_0x75a2('0x25')];var _0x709e7e;if(_0xcf8024>=_0x38c8fb){_0xcf8024=_0x38c8fb;_0x709e7e=0xc8;}else{_0x709e7e=0xce;}_0x2a190e[_0x75a2('0x20')](_0x709e7e);return _0x2a190e[_0x75a2('0x27')](_0x75a2('0x28'),_0x56b1a7+'-'+_0xcf8024+'/'+_0x38c8fb)[_0x75a2('0x22')](_0x4b114a);}return null;};}function patchUpdates(_0x1bfe52){return function(_0x126b56){try{jsonpatch[_0x75a2('0x29')](_0x126b56,_0x1bfe52,!![]);}catch(_0x1a7ff4){return BPromise[_0x75a2('0x2a')](_0x1a7ff4);}return _0x126b56[_0x75a2('0x2b')]();};}function saveUpdates(_0x28b515,_0x4b50a1){return function(_0x132efa){if(_0x132efa){return _0x132efa[_0x75a2('0x2c')](_0x28b515)['then'](function(_0xf5a89d){return _0xf5a89d;});}return null;};}function removeEntity(_0x39d891,_0xa8dd1d){return function(_0x1c2125){if(_0x1c2125){return _0x1c2125['destroy']()['then'](function(){_0x39d891[_0x75a2('0x20')](0xcc)[_0x75a2('0x21')]();});}};}function handleEntityNotFound(_0x5bbaf3,_0x350155){return function(_0x38c7c4){if(!_0x38c7c4){_0x5bbaf3[_0x75a2('0x1f')](0x194);}return _0x38c7c4;};}function handleError(_0x2badba,_0x58c541){_0x58c541=_0x58c541||0x1f4;return function(_0x454657){logger['error'](_0x454657[_0x75a2('0x2d')]);if(_0x454657[_0x75a2('0x2e')]){delete _0x454657[_0x75a2('0x2e')];}_0x2badba[_0x75a2('0x20')](_0x58c541)[_0x75a2('0x2f')](_0x454657);};}exports['index']=function(_0x1910c4,_0x2c7c2c){var _0x5568aa={},_0x3e0559={},_0x2c25c7={'count':0x0,'rows':[]};var _0x427f23=_['map'](db['ChatInternalMessage'][_0x75a2('0x30')],function(_0x12b8b2){return{'name':_0x12b8b2[_0x75a2('0x31')],'type':_0x12b8b2[_0x75a2('0x32')]['key']};});_0x3e0559[_0x75a2('0x33')]=_[_0x75a2('0x34')](_0x427f23,_0x75a2('0x2e'));_0x3e0559[_0x75a2('0x35')]=_[_0x75a2('0x36')](_0x1910c4[_0x75a2('0x35')]);_0x3e0559['filters']=_[_0x75a2('0x37')](_0x3e0559[_0x75a2('0x33')],_0x3e0559[_0x75a2('0x35')]);_0x5568aa['attributes']=_[_0x75a2('0x37')](_0x3e0559[_0x75a2('0x33')],qs[_0x75a2('0x38')](_0x1910c4[_0x75a2('0x35')][_0x75a2('0x38')]));_0x5568aa[_0x75a2('0x39')]=_0x5568aa[_0x75a2('0x39')][_0x75a2('0x3a')]?_0x5568aa['attributes']:_0x3e0559[_0x75a2('0x33')];if(!_0x1910c4[_0x75a2('0x35')][_0x75a2('0x3b')](_0x75a2('0x3c'))){_0x5568aa[_0x75a2('0x25')]=qs[_0x75a2('0x25')](_0x1910c4[_0x75a2('0x35')][_0x75a2('0x25')]);_0x5568aa['offset']=qs[_0x75a2('0x23')](_0x1910c4[_0x75a2('0x35')]['offset']);}_0x5568aa[_0x75a2('0x3d')]=qs[_0x75a2('0x3e')](_0x1910c4['query'][_0x75a2('0x3e')]);_0x5568aa[_0x75a2('0x3f')]=qs[_0x75a2('0x40')](_[_0x75a2('0x41')](_0x1910c4[_0x75a2('0x35')],_0x3e0559[_0x75a2('0x40')]),_0x427f23);if(_0x1910c4[_0x75a2('0x35')][_0x75a2('0x42')]){_0x5568aa[_0x75a2('0x3f')]=_[_0x75a2('0x43')](_0x5568aa[_0x75a2('0x3f')],{'$or':_[_0x75a2('0x34')](_0x427f23,function(_0x469e12){if(_0x469e12[_0x75a2('0x32')]!==_0x75a2('0x44')){var _0x1b13eb={};_0x1b13eb[_0x469e12[_0x75a2('0x2e')]]={'$like':'%'+_0x1910c4[_0x75a2('0x35')]['filter']+'%'};return _0x1b13eb;}})});}_0x5568aa=_[_0x75a2('0x43')]({},_0x5568aa,_0x1910c4['options']);var _0x254b6b={'where':_0x5568aa['where']};return db[_0x75a2('0x45')][_0x75a2('0x26')](_0x254b6b)[_0x75a2('0x46')](function(_0xa16069){_0x2c25c7[_0x75a2('0x26')]=_0xa16069;if(_0x1910c4[_0x75a2('0x35')][_0x75a2('0x47')]){_0x5568aa[_0x75a2('0x48')]=[{'all':!![]}];}return db[_0x75a2('0x45')][_0x75a2('0x49')](_0x5568aa);})[_0x75a2('0x46')](function(_0x25f99a){_0x2c25c7[_0x75a2('0x4a')]=_0x25f99a;return _0x2c25c7;})[_0x75a2('0x46')](respondWithFilteredResult(_0x2c7c2c,_0x5568aa))['catch'](handleError(_0x2c7c2c,null));};exports[_0x75a2('0x4b')]=function(_0x163596,_0x40c743){var _0x2189cf={'raw':!![],'where':{'id':_0x163596[_0x75a2('0x4c')]['id']}},_0x4f10f9={};_0x4f10f9[_0x75a2('0x33')]=_[_0x75a2('0x36')](db[_0x75a2('0x45')]['rawAttributes']);_0x4f10f9[_0x75a2('0x35')]=_[_0x75a2('0x36')](_0x163596[_0x75a2('0x35')]);_0x4f10f9[_0x75a2('0x40')]=_[_0x75a2('0x37')](_0x4f10f9['model'],_0x4f10f9['query']);_0x2189cf[_0x75a2('0x39')]=_[_0x75a2('0x37')](_0x4f10f9[_0x75a2('0x33')],qs[_0x75a2('0x38')](_0x163596['query']['fields']));_0x2189cf[_0x75a2('0x39')]=_0x2189cf[_0x75a2('0x39')][_0x75a2('0x3a')]?_0x2189cf[_0x75a2('0x39')]:_0x4f10f9[_0x75a2('0x33')];if(_0x163596[_0x75a2('0x35')][_0x75a2('0x47')]){_0x2189cf[_0x75a2('0x48')]=[{'all':!![]}];}_0x2189cf=_[_0x75a2('0x43')]({},_0x2189cf,_0x163596['options']);return db[_0x75a2('0x45')]['find'](_0x2189cf)[_0x75a2('0x46')](handleEntityNotFound(_0x40c743,null))[_0x75a2('0x46')](respondWithResult(_0x40c743,null))['catch'](handleError(_0x40c743,null));};exports[_0x75a2('0x4d')]=function(_0x1a43a1,_0x1a32e7){return db['ChatInternalMessage']['create'](_0x1a43a1[_0x75a2('0x4e')],{})[_0x75a2('0x46')](respondWithResult(_0x1a32e7,0xc9))[_0x75a2('0x4f')](handleError(_0x1a32e7,null));};exports['update']=function(_0x3acfc7,_0x4a1de6){if(_0x3acfc7[_0x75a2('0x4e')]['id']){delete _0x3acfc7[_0x75a2('0x4e')]['id'];}return db[_0x75a2('0x45')][_0x75a2('0x50')]({'where':{'id':_0x3acfc7[_0x75a2('0x4c')]['id']}})[_0x75a2('0x46')](handleEntityNotFound(_0x4a1de6,null))[_0x75a2('0x46')](saveUpdates(_0x3acfc7['body'],null))[_0x75a2('0x46')](respondWithResult(_0x4a1de6,null))[_0x75a2('0x4f')](handleError(_0x4a1de6,null));};exports[_0x75a2('0x51')]=function(_0xbf9764,_0x5d0fd5){return db['ChatInternalMessage'][_0x75a2('0x50')]({'where':{'id':_0xbf9764[_0x75a2('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5d0fd5,null))[_0x75a2('0x46')](removeEntity(_0x5d0fd5,null))['catch'](handleError(_0x5d0fd5,null));};exports[_0x75a2('0x52')]=function(_0x88148b,_0x5cf77e){return db[_0x75a2('0x45')][_0x75a2('0x52')]()[_0x75a2('0x46')](respondWithResult(_0x5cf77e,null))[_0x75a2('0x4f')](handleError(_0x5cf77e,null));};function wrapUser(_0x58ee0d){return function(_0x448e59){var _0x358172=_0x58ee0d[_0x75a2('0x53')]({'plain':!![]});_0x358172['messages']=[];if(_0x448e59){_0x358172['lastMessageAt']=_0x448e59[_0x75a2('0x54')];_0x358172[_0x75a2('0x55')]=_0x448e59;}else{_0x358172[_0x75a2('0x56')]=moment(0x0)[_0x75a2('0x57')](_0x75a2('0x58'));_0x358172[_0x75a2('0x55')]={};}return _0x358172;};}exports['getUsers']=function(_0x2e503b,_0x5151e0,_0x1d3a57){var _0x371667=[];return db['User'][_0x75a2('0x49')]({'where':{'role':['agent',_0x75a2('0x59'),_0x75a2('0x5a')]},'attributes':['id',_0x75a2('0x5b'),_0x75a2('0x2e'),_0x75a2('0x5c'),_0x75a2('0x5d'),_0x75a2('0x5e'),'online',_0x75a2('0x5f'),_0x75a2('0x60'),_0x75a2('0x61')],'order':qs[_0x75a2('0x3e')]('-online'),'include':[{'model':db[_0x75a2('0x62')],'as':_0x75a2('0x63'),'attributes':['id','name',_0x75a2('0x32')],'through':{'attributes':[]}}]})[_0x75a2('0x46')](function(_0xe65161){if(_0xe65161){var _0x44254e=_0x2e503b[_0x75a2('0x5a')]['get']({'plain':!![]});if(!_0x44254e)throw new Error(_0x75a2('0x64'));if(_0x44254e[_0x75a2('0x5c')]===_0x75a2('0x5a')){return db[_0x75a2('0x65')]['find']({'where':{'name':_0x75a2('0x66'),'userProfileId':_0x44254e[_0x75a2('0x67')]},'raw':!![]})[_0x75a2('0x46')](function(_0x140441){if(_0x140441){if(_0x140441[_0x75a2('0x68')]===0x0){return db['UserProfileResource'][_0x75a2('0x49')]({'where':{'sectionId':_0x140441['id']},'raw':!![]})[_0x75a2('0x46')](function(_0x37fb7d){var _0x1c1390=[];if(_[_0x75a2('0x69')](_0x37fb7d)){_0x1c1390=_[_0x75a2('0x42')](_0xe65161,function(_0x3926d3){if(_0x3926d3[_0x75a2('0x5c')]!=='agent'){return _0x3926d3;}});return _0x1c1390;}else{for(var _0x52a086=0x0;_0x52a086<_0xe65161[_0x75a2('0x3a')];_0x52a086++){var _0x4cd275=_0xe65161[_0x52a086];if(_0x4cd275[_0x75a2('0x5c')]===_0x75a2('0x6a')){var _0x479c4e=_[_0x75a2('0x50')](_0x37fb7d,function(_0x33b6be){return _0x33b6be[_0x75a2('0x6b')]===_0x4cd275['id'];});if(_0x479c4e)_0x1c1390[_0x75a2('0x6c')](_0x4cd275);}else{_0x1c1390[_0x75a2('0x6c')](_0x4cd275);}}return _0x1c1390;}});}else{return _0xe65161;}}else{var _0x48f14a=_[_0x75a2('0x42')](_0xe65161,function(_0x2e7bb2){if(_0x2e7bb2[_0x75a2('0x5c')]!==_0x75a2('0x6a')){return _0x2e7bb2;}});return _0x48f14a;}});}else{return _0xe65161;}}})['then'](function(_0x2abd77){var _0x4d43bf=[];if(_0x2abd77){_0x371667=_0x2abd77;for(var _0x29aa7e=0x0;_0x29aa7e<_0x2abd77[_0x75a2('0x3a')];_0x29aa7e+=0x1){_0x371667[_0x29aa7e][_0x75a2('0x6d')]=[];_0x4d43bf['push'](db['ChatInternalMessage'][_0x75a2('0x50')]({'where':{'FromId':[_0x2e503b['user']['id'],_0x2abd77[_0x29aa7e]['id']],'ToId':[_0x2e503b[_0x75a2('0x5a')]['id'],_0x2abd77[_0x29aa7e]['id']],'ChatGroupId':null},'attributes':['id','createdAt','FromId',_0x75a2('0x6e'),_0x75a2('0x6f'),'body'],'order':qs[_0x75a2('0x3e')](_0x75a2('0x70')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x75a2('0x46')](wrapUser(_0x2abd77[_0x29aa7e])));}return BPromise['all'](_0x4d43bf);}return[];})[_0x75a2('0x46')](function(_0x123b4b){return{'rows':_0x123b4b,'count':_0x123b4b[_0x75a2('0x3a')]};})[_0x75a2('0x46')](respondWithResult(_0x5151e0,null))[_0x75a2('0x4f')](handleError(_0x5151e0,null));}; \ No newline at end of file +var _0x527e=['get','lastMessageAt','createdAt','lastMessage','format','getUsers','User','findAll','agent','user','fullname','userpic','internal','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','UserProfileResource','isEmpty','role','resourceId','push','messages','read','all','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','end','name','send','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatInternalMessage','includeAll','catch','params','keys','rawAttributes','include','create','body','update','find','destroy','describe'];(function(_0x1bd323,_0x1c16ab){var _0x13097b=function(_0x4cc5de){while(--_0x4cc5de){_0x1bd323['push'](_0x1bd323['shift']());}};_0x13097b(++_0x1c16ab);}(_0x527e,0x148));var _0xe527=function(_0xdf3a75,_0x13cc0e){_0xdf3a75=_0xdf3a75-0x0;var _0x290aed=_0x527e[_0xdf3a75];return _0x290aed;};'use strict';var emlformat=require(_0xe527('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe527('0x1'));var jsonpatch=require(_0xe527('0x2'));var rp=require(_0xe527('0x3'));var moment=require('moment');var BPromise=require(_0xe527('0x4'));var Mustache=require('mustache');var util=require(_0xe527('0x5'));var path=require('path');var sox=require(_0xe527('0x6'));var csv=require(_0xe527('0x7'));var ejs=require(_0xe527('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe527('0x9'));var jsforce=require(_0xe527('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xe527('0x7'));var querystring=require(_0xe527('0xb'));var Papa=require(_0xe527('0xc'));var Redis=require(_0xe527('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xe527('0xe'));var as=require(_0xe527('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe527('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xe527('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xe527('0x12'))['db'];config['redis']=_[_0xe527('0x13')](config[_0xe527('0x14')],{'host':_0xe527('0x15'),'port':0x18eb});var socket=require(_0xe527('0x16'))(new Redis(config[_0xe527('0x14')]));require(_0xe527('0x17'))[_0xe527('0x18')](socket);function respondWithStatusCode(_0xc5a030,_0x4cd27f){_0x4cd27f=_0x4cd27f||0xcc;return function(_0x381037){if(_0x381037){return _0xc5a030[_0xe527('0x19')](_0x4cd27f);}return _0xc5a030[_0xe527('0x1a')](_0x4cd27f)['end']();};}function respondWithResult(_0x4d9a71,_0x3d34f0){_0x3d34f0=_0x3d34f0||0xc8;return function(_0x44cbc7){if(_0x44cbc7){return _0x4d9a71['status'](_0x3d34f0)[_0xe527('0x1b')](_0x44cbc7);}};}function respondWithFilteredResult(_0x5900fc,_0x221778){return function(_0x13cb58){if(_0x13cb58){var _0x447fe8=typeof _0x221778[_0xe527('0x1c')]===_0xe527('0x1d')&&typeof _0x221778[_0xe527('0x1e')]==='undefined';var _0x268df8=_0x13cb58[_0xe527('0x1f')];var _0x13b73f=_0x447fe8?0x0:_0x221778['offset'];var _0x4f504c=_0x447fe8?_0x13cb58['count']:_0x221778[_0xe527('0x1c')]+_0x221778[_0xe527('0x1e')];var _0x20aa50;if(_0x4f504c>=_0x268df8){_0x4f504c=_0x268df8;_0x20aa50=0xc8;}else{_0x20aa50=0xce;}_0x5900fc[_0xe527('0x1a')](_0x20aa50);return _0x5900fc['set'](_0xe527('0x20'),_0x13b73f+'-'+_0x4f504c+'/'+_0x268df8)[_0xe527('0x1b')](_0x13cb58);}return null;};}function patchUpdates(_0x17022d){return function(_0x164e33){try{jsonpatch[_0xe527('0x21')](_0x164e33,_0x17022d,!![]);}catch(_0xd64dee){return BPromise[_0xe527('0x22')](_0xd64dee);}return _0x164e33['save']();};}function saveUpdates(_0x3e08c2,_0x2f740d){return function(_0x4c2a8e){if(_0x4c2a8e){return _0x4c2a8e['update'](_0x3e08c2)[_0xe527('0x23')](function(_0x2f8482){return _0x2f8482;});}return null;};}function removeEntity(_0x577824,_0x299e05){return function(_0x287dd7){if(_0x287dd7){return _0x287dd7['destroy']()['then'](function(){_0x577824['status'](0xcc)[_0xe527('0x24')]();});}};}function handleEntityNotFound(_0x2f6cb4,_0x25c2ee){return function(_0x1ed27b){if(!_0x1ed27b){_0x2f6cb4['sendStatus'](0x194);}return _0x1ed27b;};}function handleError(_0x4cf5d9,_0x5e7f9c){_0x5e7f9c=_0x5e7f9c||0x1f4;return function(_0x100f4b){logger['error'](_0x100f4b['stack']);if(_0x100f4b['name']){delete _0x100f4b[_0xe527('0x25')];}_0x4cf5d9[_0xe527('0x1a')](_0x5e7f9c)[_0xe527('0x26')](_0x100f4b);};}exports[_0xe527('0x27')]=function(_0x4763cf,_0x4a01b6){var _0x4d0725={},_0x1e8784={},_0x312182={'count':0x0,'rows':[]};var _0x19850b=_[_0xe527('0x28')](db['ChatInternalMessage']['rawAttributes'],function(_0x32d366){return{'name':_0x32d366[_0xe527('0x29')],'type':_0x32d366[_0xe527('0x2a')][_0xe527('0x2b')]};});_0x1e8784[_0xe527('0x2c')]=_['map'](_0x19850b,_0xe527('0x25'));_0x1e8784[_0xe527('0x2d')]=_['keys'](_0x4763cf[_0xe527('0x2d')]);_0x1e8784[_0xe527('0x2e')]=_['intersection'](_0x1e8784['model'],_0x1e8784[_0xe527('0x2d')]);_0x4d0725['attributes']=_[_0xe527('0x2f')](_0x1e8784[_0xe527('0x2c')],qs['fields'](_0x4763cf[_0xe527('0x2d')][_0xe527('0x30')]));_0x4d0725[_0xe527('0x31')]=_0x4d0725[_0xe527('0x31')][_0xe527('0x32')]?_0x4d0725[_0xe527('0x31')]:_0x1e8784[_0xe527('0x2c')];if(!_0x4763cf[_0xe527('0x2d')][_0xe527('0x33')](_0xe527('0x34'))){_0x4d0725['limit']=qs['limit'](_0x4763cf[_0xe527('0x2d')][_0xe527('0x1e')]);_0x4d0725[_0xe527('0x1c')]=qs[_0xe527('0x1c')](_0x4763cf['query'][_0xe527('0x1c')]);}_0x4d0725['order']=qs[_0xe527('0x35')](_0x4763cf[_0xe527('0x2d')][_0xe527('0x35')]);_0x4d0725[_0xe527('0x36')]=qs[_0xe527('0x2e')](_['pick'](_0x4763cf['query'],_0x1e8784[_0xe527('0x2e')]),_0x19850b);if(_0x4763cf['query'][_0xe527('0x37')]){_0x4d0725['where']=_[_0xe527('0x38')](_0x4d0725[_0xe527('0x36')],{'$or':_[_0xe527('0x28')](_0x19850b,function(_0x29a79c){if(_0x29a79c[_0xe527('0x2a')]!==_0xe527('0x39')){var _0x7f104a={};_0x7f104a[_0x29a79c[_0xe527('0x25')]]={'$like':'%'+_0x4763cf[_0xe527('0x2d')][_0xe527('0x37')]+'%'};return _0x7f104a;}})});}_0x4d0725=_[_0xe527('0x38')]({},_0x4d0725,_0x4763cf[_0xe527('0x3a')]);var _0x5e8494={'where':_0x4d0725[_0xe527('0x36')]};return db[_0xe527('0x3b')][_0xe527('0x1f')](_0x5e8494)[_0xe527('0x23')](function(_0xde3e07){_0x312182[_0xe527('0x1f')]=_0xde3e07;if(_0x4763cf[_0xe527('0x2d')][_0xe527('0x3c')]){_0x4d0725['include']=[{'all':!![]}];}return db['ChatInternalMessage']['findAll'](_0x4d0725);})[_0xe527('0x23')](function(_0x3237ee){_0x312182['rows']=_0x3237ee;return _0x312182;})[_0xe527('0x23')](respondWithFilteredResult(_0x4a01b6,_0x4d0725))[_0xe527('0x3d')](handleError(_0x4a01b6,null));};exports['show']=function(_0x17c510,_0x29b44b){var _0x572cc3={'raw':!![],'where':{'id':_0x17c510[_0xe527('0x3e')]['id']}},_0x3287e4={};_0x3287e4[_0xe527('0x2c')]=_[_0xe527('0x3f')](db[_0xe527('0x3b')][_0xe527('0x40')]);_0x3287e4['query']=_[_0xe527('0x3f')](_0x17c510['query']);_0x3287e4['filters']=_[_0xe527('0x2f')](_0x3287e4[_0xe527('0x2c')],_0x3287e4[_0xe527('0x2d')]);_0x572cc3['attributes']=_[_0xe527('0x2f')](_0x3287e4[_0xe527('0x2c')],qs[_0xe527('0x30')](_0x17c510[_0xe527('0x2d')][_0xe527('0x30')]));_0x572cc3[_0xe527('0x31')]=_0x572cc3[_0xe527('0x31')]['length']?_0x572cc3['attributes']:_0x3287e4[_0xe527('0x2c')];if(_0x17c510[_0xe527('0x2d')][_0xe527('0x3c')]){_0x572cc3[_0xe527('0x41')]=[{'all':!![]}];}_0x572cc3=_[_0xe527('0x38')]({},_0x572cc3,_0x17c510[_0xe527('0x3a')]);return db['ChatInternalMessage']['find'](_0x572cc3)[_0xe527('0x23')](handleEntityNotFound(_0x29b44b,null))[_0xe527('0x23')](respondWithResult(_0x29b44b,null))[_0xe527('0x3d')](handleError(_0x29b44b,null));};exports[_0xe527('0x42')]=function(_0x7b15f,_0x3dc2d0){return db[_0xe527('0x3b')][_0xe527('0x42')](_0x7b15f[_0xe527('0x43')],{})[_0xe527('0x23')](respondWithResult(_0x3dc2d0,0xc9))[_0xe527('0x3d')](handleError(_0x3dc2d0,null));};exports[_0xe527('0x44')]=function(_0x229c84,_0x10661a){if(_0x229c84[_0xe527('0x43')]['id']){delete _0x229c84[_0xe527('0x43')]['id'];}return db['ChatInternalMessage'][_0xe527('0x45')]({'where':{'id':_0x229c84[_0xe527('0x3e')]['id']}})['then'](handleEntityNotFound(_0x10661a,null))[_0xe527('0x23')](saveUpdates(_0x229c84[_0xe527('0x43')],null))[_0xe527('0x23')](respondWithResult(_0x10661a,null))[_0xe527('0x3d')](handleError(_0x10661a,null));};exports[_0xe527('0x46')]=function(_0x18ef7b,_0x1c23de){return db['ChatInternalMessage'][_0xe527('0x45')]({'where':{'id':_0x18ef7b['params']['id']}})[_0xe527('0x23')](handleEntityNotFound(_0x1c23de,null))['then'](removeEntity(_0x1c23de,null))[_0xe527('0x3d')](handleError(_0x1c23de,null));};exports[_0xe527('0x47')]=function(_0x32ba50,_0x254f42){return db[_0xe527('0x3b')][_0xe527('0x47')]()[_0xe527('0x23')](respondWithResult(_0x254f42,null))[_0xe527('0x3d')](handleError(_0x254f42,null));};function wrapUser(_0x4ccd6e){return function(_0x4b2ae2){var _0x2a5308=_0x4ccd6e[_0xe527('0x48')]({'plain':!![]});_0x2a5308['messages']=[];if(_0x4b2ae2){_0x2a5308[_0xe527('0x49')]=_0x4b2ae2[_0xe527('0x4a')];_0x2a5308[_0xe527('0x4b')]=_0x4b2ae2;}else{_0x2a5308[_0xe527('0x49')]=moment(0x0)[_0xe527('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x2a5308['lastMessage']={};}return _0x2a5308;};}exports[_0xe527('0x4d')]=function(_0x47ae3f,_0x5ab911,_0x2648d3){var _0x15ddb2=[];return db[_0xe527('0x4e')][_0xe527('0x4f')]({'where':{'role':[_0xe527('0x50'),'admin',_0xe527('0x51')]},'attributes':['id',_0xe527('0x52'),'name','role',_0xe527('0x53'),_0xe527('0x54'),'online',_0xe527('0x55'),_0xe527('0x56'),_0xe527('0x57')],'order':qs[_0xe527('0x35')]('-online'),'include':[{'model':db[_0xe527('0x58')],'as':_0xe527('0x59'),'attributes':['id',_0xe527('0x25'),_0xe527('0x2a')],'through':{'attributes':[]}}]})[_0xe527('0x23')](function(_0x2729b6){if(_0x2729b6){var _0x5c3c75=_0x47ae3f[_0xe527('0x51')][_0xe527('0x48')]({'plain':!![]});if(!_0x5c3c75)throw new Error(_0xe527('0x5a'));if(_0x5c3c75['role']===_0xe527('0x51')){return db[_0xe527('0x5b')][_0xe527('0x45')]({'where':{'name':'Agents','userProfileId':_0x5c3c75['userProfileId']},'raw':!![]})[_0xe527('0x23')](function(_0x21ba95){if(_0x21ba95){if(_0x21ba95['autoAssociation']===0x0){return db[_0xe527('0x5c')][_0xe527('0x4f')]({'where':{'sectionId':_0x21ba95['id']},'raw':!![]})[_0xe527('0x23')](function(_0x3436a7){var _0x37c794=[];if(_[_0xe527('0x5d')](_0x3436a7)){_0x37c794=_[_0xe527('0x37')](_0x2729b6,function(_0x1c9ce8){if(_0x1c9ce8[_0xe527('0x5e')]!==_0xe527('0x50')){return _0x1c9ce8;}});return _0x37c794;}else{for(var _0x4ef830=0x0;_0x4ef830<_0x2729b6[_0xe527('0x32')];_0x4ef830++){var _0x5d8521=_0x2729b6[_0x4ef830];if(_0x5d8521[_0xe527('0x5e')]===_0xe527('0x50')){var _0x5f1fb1=_[_0xe527('0x45')](_0x3436a7,function(_0x40d3bb){return _0x40d3bb[_0xe527('0x5f')]===_0x5d8521['id'];});if(_0x5f1fb1)_0x37c794[_0xe527('0x60')](_0x5d8521);}else{_0x37c794['push'](_0x5d8521);}}return _0x37c794;}});}else{return _0x2729b6;}}else{var _0x562083=_[_0xe527('0x37')](_0x2729b6,function(_0x359a8b){if(_0x359a8b[_0xe527('0x5e')]!==_0xe527('0x50')){return _0x359a8b;}});return _0x562083;}});}else{return _0x2729b6;}}})[_0xe527('0x23')](function(_0x53fcd8){var _0x906fa6=[];if(_0x53fcd8){_0x15ddb2=_0x53fcd8;for(var _0x21354f=0x0;_0x21354f<_0x53fcd8[_0xe527('0x32')];_0x21354f+=0x1){_0x15ddb2[_0x21354f][_0xe527('0x61')]=[];_0x906fa6[_0xe527('0x60')](db[_0xe527('0x3b')][_0xe527('0x45')]({'where':{'FromId':[_0x47ae3f[_0xe527('0x51')]['id'],_0x53fcd8[_0x21354f]['id']],'ToId':[_0x47ae3f[_0xe527('0x51')]['id'],_0x53fcd8[_0x21354f]['id']],'ChatGroupId':null},'attributes':['id',_0xe527('0x4a'),'FromId','ToId',_0xe527('0x62'),_0xe527('0x43')],'order':qs[_0xe527('0x35')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x53fcd8[_0x21354f])));}return BPromise[_0xe527('0x63')](_0x906fa6);}return[];})[_0xe527('0x23')](function(_0x1f9ee8){return{'rows':_0x1f9ee8,'count':_0x1f9ee8[_0xe527('0x32')]};})[_0xe527('0x23')](respondWithResult(_0x5ab911,null))[_0xe527('0x3d')](handleError(_0x5ab911,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 2bd014a..637ab9e 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 _0x04a9=['hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x543b44,_0x498d91){var _0x122b01=function(_0xfdae85){while(--_0xfdae85){_0x543b44['push'](_0x543b44['shift']());}};_0x122b01(++_0x498d91);}(_0x04a9,0xd3));var _0x904a=function(_0x38e111,_0x390293){_0x38e111=_0x38e111-0x0;var _0x1d701c=_0x04a9[_0x38e111];return _0x1d701c;};'use strict';var EventEmitter=require(_0x904a('0x0'));var ChatInternalMessage=require(_0x904a('0x1'))['db'][_0x904a('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x904a('0x3')](0x0);var events={'afterCreate':_0x904a('0x4'),'afterUpdate':_0x904a('0x5'),'afterDestroy':_0x904a('0x6')};function emitEvent(_0x694459){return function(_0x3bf757,_0x29843e,_0x3a471c){ChatInternalMessageEvents[_0x904a('0x7')](_0x694459+':'+_0x3bf757['id'],_0x3bf757);ChatInternalMessageEvents[_0x904a('0x7')](_0x694459,_0x3bf757);_0x3a471c(null);};}for(var e in events){if(events[_0x904a('0x8')](e)){var event=events[e];ChatInternalMessage[_0x904a('0x9')](e,emitEvent(event));}}module[_0x904a('0xa')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xa195=['hook','exports','events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x373371,_0x329bac){var _0x1238f6=function(_0x13afd3){while(--_0x13afd3){_0x373371['push'](_0x373371['shift']());}};_0x1238f6(++_0x329bac);}(_0xa195,0x1b2));var _0x5a19=function(_0x13c39a,_0x3be868){_0x13c39a=_0x13c39a-0x0;var _0xabc3c4=_0xa195[_0x13c39a];return _0xabc3c4;};'use strict';var EventEmitter=require(_0x5a19('0x0'));var ChatInternalMessage=require(_0x5a19('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x5a19('0x2')](0x0);var events={'afterCreate':_0x5a19('0x3'),'afterUpdate':'update','afterDestroy':_0x5a19('0x4')};function emitEvent(_0x54e4c0){return function(_0x1779be,_0x4c4c09,_0x960524){ChatInternalMessageEvents[_0x5a19('0x5')](_0x54e4c0+':'+_0x1779be['id'],_0x1779be);ChatInternalMessageEvents['emit'](_0x54e4c0,_0x1779be);_0x960524(null);};}for(var e in events){if(events[_0x5a19('0x6')](e)){var event=events[e];ChatInternalMessage[_0x5a19('0x7')](e,emitEvent(event));}}module[_0x5a19('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 88e8923..fcf2e85 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 _0x1307=['./chatInternalMessage.attributes','chat_internal_messages','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x5df14e,_0xc2328d){var _0x51cd81=function(_0x43271d){while(--_0x43271d){_0x5df14e['push'](_0x5df14e['shift']());}};_0x51cd81(++_0xc2328d);}(_0x1307,0x142));var _0x7130=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x1307[_0x2112d4];return _0x434972;};'use strict';var _=require(_0x7130('0x0'));var util=require(_0x7130('0x1'));var logger=require('../../config/logger')(_0x7130('0x2'));var moment=require(_0x7130('0x3'));var BPromise=require(_0x7130('0x4'));var rp=require(_0x7130('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7130('0x6'));var config=require(_0x7130('0x7'));var attributes=require(_0x7130('0x8'));module['exports']=function(_0x1b18ff,_0x157f58){return _0x1b18ff['define']('ChatInternalMessage',attributes,{'tableName':_0x7130('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa9ce=['path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird'];(function(_0x44f241,_0x312696){var _0x217de9=function(_0x38622c){while(--_0x38622c){_0x44f241['push'](_0x44f241['shift']());}};_0x217de9(++_0x312696);}(_0xa9ce,0x10d));var _0xea9c=function(_0x56be45,_0x10cd0e){_0x56be45=_0x56be45-0x0;var _0x1b75d3=_0xa9ce[_0x56be45];return _0x1b75d3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xea9c('0x0'))(_0xea9c('0x1'));var moment=require(_0xea9c('0x2'));var BPromise=require(_0xea9c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea9c('0x4'));var rimraf=require(_0xea9c('0x5'));var config=require(_0xea9c('0x6'));var attributes=require(_0xea9c('0x7'));module[_0xea9c('0x8')]=function(_0xa77952,_0x181aca){return _0xa77952['define'](_0xea9c('0x9'),attributes,{'tableName':_0xea9c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xea9c('0xb'),'collate':_0xea9c('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 0e849e3..ea8f579 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 _0x0817=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x191bfa,_0x5c938c){var _0x5527ee=function(_0x148984){while(--_0x148984){_0x191bfa['push'](_0x191bfa['shift']());}};_0x5527ee(++_0x5c938c);}(_0x0817,0x139));var _0x7081=function(_0x3dcf99,_0x11ee13){_0x3dcf99=_0x3dcf99-0x0;var _0x551457=_0x0817[_0x3dcf99];return _0x551457;};'use strict';var _=require(_0x7081('0x0'));var util=require(_0x7081('0x1'));var moment=require(_0x7081('0x2'));var BPromise=require(_0x7081('0x3'));var rs=require(_0x7081('0x4'));var fs=require('fs');var Redis=require(_0x7081('0x5'));var db=require(_0x7081('0x6'))['db'];var utils=require(_0x7081('0x7'));var logger=require(_0x7081('0x8'))(_0x7081('0x9'));var config=require('../../config/environment');var jayson=require(_0x7081('0xa'));var client=jayson[_0x7081('0xb')][_0x7081('0xc')]({'port':0x232a});config[_0x7081('0xd')]=_[_0x7081('0xe')](config[_0x7081('0xd')],{'host':_0x7081('0xf'),'port':0x18eb});var socket=require(_0x7081('0x10'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0x7081('0x11')](socket);function respondWithRpcPromise(_0x3dc7a7,_0x59f0f6,_0x55b432){return new BPromise(function(_0xfa4887,_0x241fbb){return client[_0x7081('0x12')](_0x3dc7a7,_0x55b432)[_0x7081('0x13')](function(_0x1170ca){logger[_0x7081('0x14')](_0x7081('0x15'),_0x59f0f6,'request\x20sent');logger[_0x7081('0x16')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x59f0f6,_0x7081('0x17'),JSON[_0x7081('0x18')](_0x1170ca));if(_0x1170ca[_0x7081('0x19')]){if(_0x1170ca[_0x7081('0x19')]['code']===0x1f4){logger[_0x7081('0x19')](_0x7081('0x15'),_0x59f0f6,_0x1170ca[_0x7081('0x19')][_0x7081('0x1a')]);return _0x241fbb(_0x1170ca[_0x7081('0x19')][_0x7081('0x1a')]);}logger[_0x7081('0x19')]('ChatInternalMessage,\x20%s,\x20%s',_0x59f0f6,_0x1170ca[_0x7081('0x19')]['message']);return _0xfa4887(_0x1170ca[_0x7081('0x19')][_0x7081('0x1a')]);}else{logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x59f0f6,'request\x20sent');_0xfa4887(_0x1170ca[_0x7081('0x1b')][_0x7081('0x1a')]);}})[_0x7081('0x1c')](function(_0x7cb24d){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x59f0f6,_0x7cb24d);_0x241fbb(_0x7cb24d);});});} \ No newline at end of file +var _0x931f=['code','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error'];(function(_0x46f5e7,_0x36fa6e){var _0x370d56=function(_0x340db6){while(--_0x340db6){_0x46f5e7['push'](_0x46f5e7['shift']());}};_0x370d56(++_0x36fa6e);}(_0x931f,0x184));var _0xf931=function(_0x3da3c4,_0x2b874d){_0x3da3c4=_0x3da3c4-0x0;var _0x36a3af=_0x931f[_0x3da3c4];return _0x36a3af;};'use strict';var _=require(_0xf931('0x0'));var util=require(_0xf931('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf931('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf931('0x3'))['db'];var utils=require(_0xf931('0x4'));var logger=require(_0xf931('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf931('0x6'));var client=jayson[_0xf931('0x7')][_0xf931('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0xf931('0x9')],{'host':_0xf931('0xa'),'port':0x18eb});var socket=require(_0xf931('0xb'))(new Redis(config['redis']));require(_0xf931('0xc'))[_0xf931('0xd')](socket);function respondWithRpcPromise(_0x488ea1,_0x559c0b,_0x4d0e82){return new BPromise(function(_0x22589c,_0x127e7f){return client[_0xf931('0xe')](_0x488ea1,_0x4d0e82)['then'](function(_0x5571c0){logger[_0xf931('0xf')](_0xf931('0x10'),_0x559c0b,_0xf931('0x11'));logger['debug'](_0xf931('0x12'),_0x559c0b,_0xf931('0x11'),JSON['stringify'](_0x5571c0));if(_0x5571c0[_0xf931('0x13')]){if(_0x5571c0[_0xf931('0x13')][_0xf931('0x14')]===0x1f4){logger[_0xf931('0x13')](_0xf931('0x10'),_0x559c0b,_0x5571c0[_0xf931('0x13')]['message']);return _0x127e7f(_0x5571c0[_0xf931('0x13')][_0xf931('0x15')]);}logger[_0xf931('0x13')](_0xf931('0x10'),_0x559c0b,_0x5571c0[_0xf931('0x13')]['message']);return _0x22589c(_0x5571c0['error'][_0xf931('0x15')]);}else{logger[_0xf931('0xf')](_0xf931('0x10'),_0x559c0b,_0xf931('0x11'));_0x22589c(_0x5571c0[_0xf931('0x16')][_0xf931('0x15')]);}})[_0xf931('0x17')](function(_0x50f648){logger[_0xf931('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x559c0b,_0x50f648);_0x127e7f(_0x50f648);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index c77a34b..c802af2 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 _0x39bf=['update','emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','remove'];(function(_0x1d6bb0,_0x2e6f36){var _0x13849c=function(_0x2ed09e){while(--_0x2ed09e){_0x1d6bb0['push'](_0x1d6bb0['shift']());}};_0x13849c(++_0x2e6f36);}(_0x39bf,0xbe));var _0xf39b=function(_0x5858ea,_0x3d9ce5){_0x5858ea=_0x5858ea-0x0;var _0x19e02c=_0x39bf[_0x5858ea];return _0x19e02c;};'use strict';var ChatInternalMessageEvents=require(_0xf39b('0x0'));var events=['save',_0xf39b('0x1'),_0xf39b('0x2')];function createListener(_0x571fe5,_0x11b5de){return function(_0x1a0f1a){_0x11b5de[_0xf39b('0x3')](_0x571fe5,_0x1a0f1a);};}function removeListener(_0x208b04,_0x491490){return function(){ChatInternalMessageEvents[_0xf39b('0x4')](_0x208b04,_0x491490);};}exports[_0xf39b('0x5')]=function(_0xbf7388){for(var _0xe61a0a=0x0,_0x28134d=events[_0xf39b('0x6')];_0xe61a0a<_0x28134d;_0xe61a0a++){var _0x30f5b8=events[_0xe61a0a];var _0x5dde44=createListener(_0xf39b('0x7')+_0x30f5b8,_0xbf7388);ChatInternalMessageEvents['on'](_0x30f5b8,_0x5dde44);}}; \ No newline at end of file +var _0x5194=['remove','update','removeListener','length','chatInternalMessage:','./chatInternalMessage.events'];(function(_0x2b9706,_0x26db97){var _0x20051e=function(_0x16caea){while(--_0x16caea){_0x2b9706['push'](_0x2b9706['shift']());}};_0x20051e(++_0x26db97);}(_0x5194,0x95));var _0x4519=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x5194[_0x3bf83f];return _0x22c4a9;};'use strict';var ChatInternalMessageEvents=require(_0x4519('0x0'));var events=['save',_0x4519('0x1'),_0x4519('0x2')];function createListener(_0x4882d2,_0x5e6d4f){return function(_0x43de29){_0x5e6d4f['emit'](_0x4882d2,_0x43de29);};}function removeListener(_0x19a852,_0xc130c8){return function(){ChatInternalMessageEvents[_0x4519('0x3')](_0x19a852,_0xc130c8);};}exports['register']=function(_0x3c18c1){for(var _0x5d5575=0x0,_0x2da6c7=events[_0x4519('0x4')];_0x5d5575<_0x2da6c7;_0x5d5575++){var _0x4accd0=events[_0x5d5575];var _0x17aeef=createListener(_0x4519('0x5')+_0x4accd0,_0x3c18c1);ChatInternalMessageEvents['on'](_0x4accd0,_0x17aeef);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 16bf519..d486753 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 _0x6bcb=['./chatInternalMessage.controller','get','isAuthenticated','index','describe','getUsers','show','post','put','/:id','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x263af6,_0x55912e){var _0xcb2469=function(_0x1ba4ac){while(--_0x1ba4ac){_0x263af6['push'](_0x263af6['shift']());}};_0xcb2469(++_0x55912e);}(_0x6bcb,0x172));var _0xb6bc=function(_0x5976f8,_0x1265b7){_0x5976f8=_0x5976f8-0x0;var _0x179715=_0x6bcb[_0x5976f8];return _0x179715;};'use strict';var multer=require(_0xb6bc('0x0'));var util=require('util');var path=require(_0xb6bc('0x1'));var timeout=require(_0xb6bc('0x2'));var express=require('express');var router=express[_0xb6bc('0x3')]();var fs_extra=require(_0xb6bc('0x4'));var auth=require(_0xb6bc('0x5'));var interaction=require(_0xb6bc('0x6'));var config=require(_0xb6bc('0x7'));var controller=require(_0xb6bc('0x8'));router[_0xb6bc('0x9')]('/',auth[_0xb6bc('0xa')](),controller[_0xb6bc('0xb')]);router[_0xb6bc('0x9')]('/describe',auth[_0xb6bc('0xa')](),controller[_0xb6bc('0xc')]);router[_0xb6bc('0x9')]('/users',auth[_0xb6bc('0xa')](),controller[_0xb6bc('0xd')]);router[_0xb6bc('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xb6bc('0xe')]);router[_0xb6bc('0xf')]('/',auth[_0xb6bc('0xa')](),controller['create']);router[_0xb6bc('0x10')](_0xb6bc('0x11'),controller['update']);router[_0xb6bc('0x12')](_0xb6bc('0x11'),auth[_0xb6bc('0xa')](),controller[_0xb6bc('0x13')]);module[_0xb6bc('0x14')]=router; \ No newline at end of file +var _0x28ad=['update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','describe','/users','getUsers','/:id','show','post','create','put'];(function(_0x4fbf33,_0x318fbc){var _0x1997d2=function(_0xe41ffc){while(--_0xe41ffc){_0x4fbf33['push'](_0x4fbf33['shift']());}};_0x1997d2(++_0x318fbc);}(_0x28ad,0x1e4));var _0xd28a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x28ad[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0xd28a('0x0'));var path=require('path');var timeout=require(_0xd28a('0x1'));var express=require(_0xd28a('0x2'));var router=express[_0xd28a('0x3')]();var fs_extra=require(_0xd28a('0x4'));var auth=require(_0xd28a('0x5'));var interaction=require(_0xd28a('0x6'));var config=require(_0xd28a('0x7'));var controller=require(_0xd28a('0x8'));router[_0xd28a('0x9')]('/',auth[_0xd28a('0xa')](),controller[_0xd28a('0xb')]);router[_0xd28a('0x9')]('/describe',auth[_0xd28a('0xa')](),controller[_0xd28a('0xc')]);router[_0xd28a('0x9')](_0xd28a('0xd'),auth[_0xd28a('0xa')](),controller[_0xd28a('0xe')]);router[_0xd28a('0x9')](_0xd28a('0xf'),auth[_0xd28a('0xa')](),controller[_0xd28a('0x10')]);router[_0xd28a('0x11')]('/',auth[_0xd28a('0xa')](),controller[_0xd28a('0x12')]);router[_0xd28a('0x13')]('/:id',controller[_0xd28a('0x14')]);router[_0xd28a('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xd28a('0x16')]);module[_0xd28a('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 3c0f568..777f618 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 _0x15b8=['DATE','STRING','exports','TEXT','medium','BOOLEAN','out'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x15b8,0xcd));var _0x815b=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x15b8[_0x4fde08];return _0x12e725;};'use strict';var Sequelize=require('sequelize');module[_0x815b('0x0')]={'body':{'type':Sequelize[_0x815b('0x1')](_0x815b('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x815b('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x815b('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x815b('0x4')),'defaultValue':_0x815b('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x815b('0x5')]},'providerName':{'type':Sequelize[_0x815b('0x6')]},'providerResponse':{'type':Sequelize[_0x815b('0x1')]}}; \ No newline at end of file +var _0xdc9b=['TEXT','BOOLEAN','out','DATE','sequelize','exports'];(function(_0x402d31,_0x3f10aa){var _0x199386=function(_0x4ce6bb){while(--_0x4ce6bb){_0x402d31['push'](_0x402d31['shift']());}};_0x199386(++_0x3f10aa);}(_0xdc9b,0x70));var _0xbdc9=function(_0x3c7a97,_0x283152){_0x3c7a97=_0x3c7a97-0x0;var _0x42b768=_0xdc9b[_0x3c7a97];return _0x42b768;};'use strict';var Sequelize=require(_0xbdc9('0x0'));module[_0xbdc9('0x1')]={'body':{'type':Sequelize[_0xbdc9('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xbdc9('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xbdc9('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xbdc9('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xbdc9('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xbdc9('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 6f0dfd3..8ceea87 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 _0x0ca4=['include','findAll','show','rawAttributes','find','create','body','update','describe','accept','chat','read','format','UserId','user','get','ChatInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','agent','channel','motionChannel','event','EventManager','acceptmessage','params','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','internal','rejectmessage','parse','formData','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','destroy','sendStatus','stack','name','send','index','map','fieldName','type','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatMessage','includeAll'];(function(_0x2c32ae,_0x5c1998){var _0x47ab92=function(_0x16c1d3){while(--_0x16c1d3){_0x2c32ae['push'](_0x2c32ae['shift']());}};_0x47ab92(++_0x5c1998);}(_0x0ca4,0x142));var _0x40ca=function(_0x7fb867,_0x1efd25){_0x7fb867=_0x7fb867-0x0;var _0x24a417=_0x0ca4[_0x7fb867];return _0x24a417;};'use strict';var emlformat=require(_0x40ca('0x0'));var rimraf=require(_0x40ca('0x1'));var zipdir=require(_0x40ca('0x2'));var jsonpatch=require(_0x40ca('0x3'));var rp=require(_0x40ca('0x4'));var moment=require(_0x40ca('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x40ca('0x6'));var util=require('util');var path=require(_0x40ca('0x7'));var sox=require(_0x40ca('0x8'));var csv=require(_0x40ca('0x9'));var ejs=require(_0x40ca('0xa'));var fs=require('fs');var fs_extra=require(_0x40ca('0xb'));var _=require('lodash');var squel=require(_0x40ca('0xc'));var crypto=require(_0x40ca('0xd'));var jsforce=require(_0x40ca('0xe'));var deskjs=require(_0x40ca('0xf'));var toCsv=require(_0x40ca('0x9'));var querystring=require(_0x40ca('0x10'));var Papa=require(_0x40ca('0x11'));var Redis=require(_0x40ca('0x12'));var authService=require(_0x40ca('0x13'));var qs=require(_0x40ca('0x14'));var as=require(_0x40ca('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x40ca('0x16'))(_0x40ca('0x17'));var utils=require(_0x40ca('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x40ca('0x19'));var db=require(_0x40ca('0x1a'))['db'];config[_0x40ca('0x1b')]=_[_0x40ca('0x1c')](config[_0x40ca('0x1b')],{'host':_0x40ca('0x1d'),'port':0x18eb});var socket=require(_0x40ca('0x1e'))(new Redis(config[_0x40ca('0x1b')]));require(_0x40ca('0x1f'))[_0x40ca('0x20')](socket);var jayson=require(_0x40ca('0x21'));var client=jayson[_0x40ca('0x22')][_0x40ca('0x23')]({'port':0x232c});var client9002=jayson['client'][_0x40ca('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x113bcf,_0x53338c,_0x270505,_0x233f29){return new BPromise(function(_0x283237,_0xbd36b2){var _0x4d977d=_0x233f29||client;return _0x4d977d[_0x40ca('0x24')](_0x113bcf,_0x270505)[_0x40ca('0x25')](function(_0x207827){logger[_0x40ca('0x26')]('ChatMessage,\x20%s,\x20%s',_0x53338c,_0x40ca('0x27'));logger[_0x40ca('0x28')](_0x40ca('0x29'),_0x53338c,'request\x20sent',JSON[_0x40ca('0x2a')](_0x207827));if(_0x207827[_0x40ca('0x2b')]){if(_0x207827[_0x40ca('0x2b')][_0x40ca('0x2c')]===0x1f4){logger[_0x40ca('0x2b')](_0x40ca('0x2d'),_0x53338c,_0x207827['error'][_0x40ca('0x2e')]);return _0xbd36b2(_0x207827[_0x40ca('0x2b')]['message']);}logger[_0x40ca('0x2b')](_0x40ca('0x2d'),_0x53338c,_0x207827[_0x40ca('0x2b')][_0x40ca('0x2e')]);return _0x283237(_0x207827[_0x40ca('0x2b')][_0x40ca('0x2e')]);}else{logger['info'](_0x40ca('0x2d'),_0x53338c,_0x40ca('0x27'));_0x283237(_0x207827[_0x40ca('0x2f')][_0x40ca('0x2e')]);}})[_0x40ca('0x30')](function(_0xe2126b){logger[_0x40ca('0x2b')](_0x40ca('0x2d'),_0x53338c,_0xe2126b);_0xbd36b2(_0xe2126b);});});}function respondWithStatusCode(_0x11ade7,_0x4a1792){_0x4a1792=_0x4a1792||0xcc;return function(_0x248261){if(_0x248261){return _0x11ade7['sendStatus'](_0x4a1792);}return _0x11ade7[_0x40ca('0x31')](_0x4a1792)[_0x40ca('0x32')]();};}function respondWithResult(_0x2f246e,_0x55fcc0){_0x55fcc0=_0x55fcc0||0xc8;return function(_0x11a620){if(_0x11a620){return _0x2f246e[_0x40ca('0x31')](_0x55fcc0)[_0x40ca('0x33')](_0x11a620);}};}function respondWithFilteredResult(_0x1e8ee1,_0x40d366){return function(_0x4c4aeb){if(_0x4c4aeb){var _0x4143e6=typeof _0x40d366['offset']===_0x40ca('0x34')&&typeof _0x40d366['limit']===_0x40ca('0x34');var _0x446fcb=_0x4c4aeb['count'];var _0x182c19=_0x4143e6?0x0:_0x40d366[_0x40ca('0x35')];var _0x1a2d0e=_0x4143e6?_0x4c4aeb[_0x40ca('0x36')]:_0x40d366['offset']+_0x40d366[_0x40ca('0x37')];var _0x5a6786;if(_0x1a2d0e>=_0x446fcb){_0x1a2d0e=_0x446fcb;_0x5a6786=0xc8;}else{_0x5a6786=0xce;}_0x1e8ee1[_0x40ca('0x31')](_0x5a6786);return _0x1e8ee1[_0x40ca('0x38')](_0x40ca('0x39'),_0x182c19+'-'+_0x1a2d0e+'/'+_0x446fcb)[_0x40ca('0x33')](_0x4c4aeb);}return null;};}function patchUpdates(_0x1e776d){return function(_0x5918ca){try{jsonpatch[_0x40ca('0x3a')](_0x5918ca,_0x1e776d,!![]);}catch(_0x3daccb){return BPromise[_0x40ca('0x3b')](_0x3daccb);}return _0x5918ca[_0x40ca('0x3c')]();};}function saveUpdates(_0x5edd96,_0x548ccd){return function(_0x5b95cc){if(_0x5b95cc){return _0x5b95cc['update'](_0x5edd96)[_0x40ca('0x25')](function(_0x2ffe1d){return _0x2ffe1d;});}return null;};}function removeEntity(_0x38e812,_0x5dfcfd){return function(_0x2c3977){if(_0x2c3977){return _0x2c3977[_0x40ca('0x3d')]()[_0x40ca('0x25')](function(){_0x38e812[_0x40ca('0x31')](0xcc)[_0x40ca('0x32')]();});}};}function handleEntityNotFound(_0x1aa886,_0x127722){return function(_0x415edf){if(!_0x415edf){_0x1aa886[_0x40ca('0x3e')](0x194);}return _0x415edf;};}function handleError(_0x265a7e,_0x5fb615){_0x5fb615=_0x5fb615||0x1f4;return function(_0x17dc78){logger[_0x40ca('0x2b')](_0x17dc78[_0x40ca('0x3f')]);if(_0x17dc78[_0x40ca('0x40')]){delete _0x17dc78[_0x40ca('0x40')];}_0x265a7e[_0x40ca('0x31')](_0x5fb615)[_0x40ca('0x41')](_0x17dc78);};}exports[_0x40ca('0x42')]=function(_0x5373d8,_0x560fd7){var _0x3d6cf1={},_0x9454fd={},_0x3fa0c5={'count':0x0,'rows':[]};var _0x13e33c=_[_0x40ca('0x43')](db['ChatMessage']['rawAttributes'],function(_0x582d72){return{'name':_0x582d72[_0x40ca('0x44')],'type':_0x582d72[_0x40ca('0x45')]['key']};});_0x9454fd['model']=_[_0x40ca('0x43')](_0x13e33c,'name');_0x9454fd[_0x40ca('0x46')]=_[_0x40ca('0x47')](_0x5373d8[_0x40ca('0x46')]);_0x9454fd[_0x40ca('0x48')]=_['intersection'](_0x9454fd[_0x40ca('0x49')],_0x9454fd[_0x40ca('0x46')]);_0x3d6cf1['attributes']=_[_0x40ca('0x4a')](_0x9454fd[_0x40ca('0x49')],qs[_0x40ca('0x4b')](_0x5373d8[_0x40ca('0x46')]['fields']));_0x3d6cf1['attributes']=_0x3d6cf1[_0x40ca('0x4c')][_0x40ca('0x4d')]?_0x3d6cf1['attributes']:_0x9454fd[_0x40ca('0x49')];if(!_0x5373d8[_0x40ca('0x46')][_0x40ca('0x4e')]('nolimit')){_0x3d6cf1[_0x40ca('0x37')]=qs[_0x40ca('0x37')](_0x5373d8[_0x40ca('0x46')][_0x40ca('0x37')]);_0x3d6cf1['offset']=qs[_0x40ca('0x35')](_0x5373d8['query'][_0x40ca('0x35')]);}_0x3d6cf1[_0x40ca('0x4f')]=qs[_0x40ca('0x50')](_0x5373d8[_0x40ca('0x46')][_0x40ca('0x50')]);_0x3d6cf1[_0x40ca('0x51')]=qs['filters'](_[_0x40ca('0x52')](_0x5373d8['query'],_0x9454fd[_0x40ca('0x48')]),_0x13e33c);if(_0x5373d8[_0x40ca('0x46')][_0x40ca('0x53')]){_0x3d6cf1[_0x40ca('0x51')]=_[_0x40ca('0x54')](_0x3d6cf1['where'],{'$or':_[_0x40ca('0x43')](_0x13e33c,function(_0x29c427){if(_0x29c427['type']!==_0x40ca('0x55')){var _0x38a88c={};_0x38a88c[_0x29c427[_0x40ca('0x40')]]={'$like':'%'+_0x5373d8[_0x40ca('0x46')][_0x40ca('0x53')]+'%'};return _0x38a88c;}})});}_0x3d6cf1=_['merge']({},_0x3d6cf1,_0x5373d8[_0x40ca('0x56')]);var _0x39d3f7={'where':_0x3d6cf1[_0x40ca('0x51')]};return db[_0x40ca('0x57')][_0x40ca('0x36')](_0x39d3f7)[_0x40ca('0x25')](function(_0x41facc){_0x3fa0c5['count']=_0x41facc;if(_0x5373d8[_0x40ca('0x46')][_0x40ca('0x58')]){_0x3d6cf1[_0x40ca('0x59')]=[{'all':!![]}];}return db[_0x40ca('0x57')][_0x40ca('0x5a')](_0x3d6cf1);})[_0x40ca('0x25')](function(_0x1717eb){_0x3fa0c5['rows']=_0x1717eb;return _0x3fa0c5;})[_0x40ca('0x25')](respondWithFilteredResult(_0x560fd7,_0x3d6cf1))[_0x40ca('0x30')](handleError(_0x560fd7,null));};exports[_0x40ca('0x5b')]=function(_0x19ea6a,_0x371eb3){var _0x1ef324={'raw':!![],'where':{'id':_0x19ea6a['params']['id']}},_0x526096={};_0x526096[_0x40ca('0x49')]=_[_0x40ca('0x47')](db[_0x40ca('0x57')][_0x40ca('0x5c')]);_0x526096[_0x40ca('0x46')]=_[_0x40ca('0x47')](_0x19ea6a['query']);_0x526096[_0x40ca('0x48')]=_['intersection'](_0x526096['model'],_0x526096[_0x40ca('0x46')]);_0x1ef324[_0x40ca('0x4c')]=_[_0x40ca('0x4a')](_0x526096['model'],qs[_0x40ca('0x4b')](_0x19ea6a[_0x40ca('0x46')][_0x40ca('0x4b')]));_0x1ef324[_0x40ca('0x4c')]=_0x1ef324['attributes'][_0x40ca('0x4d')]?_0x1ef324['attributes']:_0x526096['model'];if(_0x19ea6a[_0x40ca('0x46')]['includeAll']){_0x1ef324[_0x40ca('0x59')]=[{'all':!![]}];}_0x1ef324=_[_0x40ca('0x54')]({},_0x1ef324,_0x19ea6a[_0x40ca('0x56')]);return db[_0x40ca('0x57')][_0x40ca('0x5d')](_0x1ef324)[_0x40ca('0x25')](handleEntityNotFound(_0x371eb3,null))[_0x40ca('0x25')](respondWithResult(_0x371eb3,null))['catch'](handleError(_0x371eb3,null));};exports['create']=function(_0x457b5d,_0x161e45){return db[_0x40ca('0x57')][_0x40ca('0x5e')](_0x457b5d[_0x40ca('0x5f')],{})[_0x40ca('0x25')](respondWithResult(_0x161e45,0xc9))[_0x40ca('0x30')](handleError(_0x161e45,null));};exports[_0x40ca('0x60')]=function(_0x153208,_0x1a501c){if(_0x153208[_0x40ca('0x5f')]['id']){delete _0x153208[_0x40ca('0x5f')]['id'];}return db['ChatMessage'][_0x40ca('0x5d')]({'where':{'id':_0x153208['params']['id']}})['then'](handleEntityNotFound(_0x1a501c,null))[_0x40ca('0x25')](saveUpdates(_0x153208[_0x40ca('0x5f')],null))['then'](respondWithResult(_0x1a501c,null))[_0x40ca('0x30')](handleError(_0x1a501c,null));};exports[_0x40ca('0x3d')]=function(_0x1d8e87,_0x33c90d){return db[_0x40ca('0x57')]['find']({'where':{'id':_0x1d8e87['params']['id']}})['then'](handleEntityNotFound(_0x33c90d,null))[_0x40ca('0x25')](removeEntity(_0x33c90d,null))[_0x40ca('0x30')](handleError(_0x33c90d,null));};exports[_0x40ca('0x61')]=function(_0x565497,_0x59b32b){return db['ChatMessage'][_0x40ca('0x61')]()[_0x40ca('0x25')](respondWithResult(_0x59b32b,null))[_0x40ca('0x30')](handleError(_0x59b32b,null));};var interaction_log=require(_0x40ca('0x16'))('chat-interactions');exports[_0x40ca('0x62')]=function(_0x4be2bf,_0x32fed0,_0x4200fb){var _0x1f5e95={'agent':{},'channel':_0x40ca('0x63')};if(_0x4be2bf[_0x40ca('0x5f')]['id']){delete _0x4be2bf['body']['id'];}_0x4be2bf[_0x40ca('0x5f')][_0x40ca('0x64')]=!![];_0x4be2bf[_0x40ca('0x5f')]['readAt']=moment()[_0x40ca('0x65')]('YYYY-MM-DD\x20HH:mm:ss');_0x4be2bf[_0x40ca('0x5f')][_0x40ca('0x66')]=_0x4be2bf[_0x40ca('0x5f')]['UserId']||_0x4be2bf[_0x40ca('0x67')]['id'];_0x1f5e95['agent']['id']=_0x4be2bf['body']['UserId'];return db[_0x40ca('0x57')]['find']({'where':{'id':_0x4be2bf['params']['id'],'UserId':null}})[_0x40ca('0x25')](handleEntityNotFound(_0x32fed0,null))[_0x40ca('0x25')](saveUpdates(_0x4be2bf['body'],null))['then'](function(_0x437aae){if(_0x437aae){_0x1f5e95['message']=_0x437aae[_0x40ca('0x68')]({'plain':!![]});return db[_0x40ca('0x69')][_0x40ca('0x5d')]({'where':{'id':_0x437aae['ChatInteractionId']}});}return null;})[_0x40ca('0x25')](handleEntityNotFound(_0x32fed0,null))[_0x40ca('0x25')](function(_0x2ed325){if(_0x2ed325){return _0x2ed325[_0x40ca('0x60')]({'UserId':_0x4be2bf[_0x40ca('0x5f')][_0x40ca('0x66')],'read1stAt':_[_0x40ca('0x6a')](_0x2ed325[_0x40ca('0x6b')])?moment()[_0x40ca('0x65')](_0x40ca('0x6c')):undefined});}return null;})[_0x40ca('0x25')](function(_0x1476f7){if(_0x1476f7){_0x1f5e95[_0x40ca('0x6d')]=_0x1476f7[_0x40ca('0x68')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4be2bf['user']['id'],_0x4be2bf['user'][_0x40ca('0x40')],_0x4be2bf[_0x40ca('0x67')][_0x40ca('0x6e')],_0x1f5e95[_0x40ca('0x6d')]['id'],_0x4be2bf[_0x40ca('0x5f')]?JSON[_0x40ca('0x2a')](_0x4be2bf['body']):_0x40ca('0x6f'));return respondWithRpcPromise(_0x40ca('0x70'),_0x40ca('0x71'),_0x1f5e95);}return null;})[_0x40ca('0x25')](function(_0x5daadb){var _0x59080f=_0x40ca('0x72')+_0x5daadb[_0x40ca('0x2e')][_0x40ca('0x73')];return db[_0x40ca('0x74')]['query'](_0x59080f,{'type':db[_0x40ca('0x75')]['QueryTypes'][_0x40ca('0x76')],'raw':!![]})[_0x40ca('0x25')](function(_0x58d0c3){return _0x58d0c3;});})[_0x40ca('0x25')](function(_0x24a67b){if(_0x24a67b){_0x1f5e95[_0x40ca('0x2e')][_0x40ca('0x77')]=_0x24a67b[0x0];if(!_0x4be2bf[_0x40ca('0x5f')]['UserId'])return;return db[_0x40ca('0x78')]['find']({'where':{'id':_0x4be2bf[_0x40ca('0x5f')][_0x40ca('0x66')],'role':'agent'},'attributes':['id','name',_0x40ca('0x79'),_0x40ca('0x7a'),'internal'],'raw':!![]});}return null;})[_0x40ca('0x25')](function(_0x3f956d){if(!_0x3f956d)return null;_0x1f5e95[_0x40ca('0x2e')][_0x40ca('0x7b')]=_0x3f956d;return _0x1f5e95;})[_0x40ca('0x25')](function(_0x53c466){if(_0x53c466){if(_0x4be2bf[_0x40ca('0x5f')]['manual']){_0x1f5e95[_0x40ca('0x2e')]['interface']=util[_0x40ca('0x65')]('SIP/%s',_0x4be2bf[_0x40ca('0x67')][_0x40ca('0x40')]);_0x1f5e95['message'][_0x40ca('0x7c')]=_0x1f5e95['channel'];_0x1f5e95[_0x40ca('0x2e')][_0x40ca('0x7d')]=_0x1f5e95['channel'];_0x1f5e95[_0x40ca('0x2e')][_0x40ca('0x7e')]=_0x40ca('0x62');return respondWithRpcPromise(_0x40ca('0x7f'),_0x40ca('0x7f'),{'event':_0x40ca('0x80'),'message':_['merge'](_0x1f5e95[_0x40ca('0x2e')],JSON['parse'](_0x1f5e95[_0x40ca('0x6d')]['formData']))},client9002)[_0x40ca('0x25')](function(){return _0x1f5e95;});}return _0x1f5e95;}return null;})[_0x40ca('0x25')](respondWithResult(_0x32fed0,null))['catch'](handleError(_0x32fed0,null));};var interaction_log=require(_0x40ca('0x16'))('chat-interactions');exports[_0x40ca('0x3b')]=function(_0x5381bb,_0xba794a,_0x35895b){var _0x3aa302={'agent':{},'channel':_0x40ca('0x63')};if(_0x5381bb['body']['id']){delete _0x5381bb[_0x40ca('0x5f')]['id'];}_0x5381bb[_0x40ca('0x5f')][_0x40ca('0x66')]=_0x5381bb[_0x40ca('0x5f')][_0x40ca('0x66')]||_0x5381bb['user']['id'];_0x3aa302['agent']['id']=_0x5381bb[_0x40ca('0x5f')][_0x40ca('0x66')];return db['ChatMessage'][_0x40ca('0x5d')]({'where':{'id':_0x5381bb[_0x40ca('0x81')]['id'],'UserId':null}})[_0x40ca('0x25')](handleEntityNotFound(_0xba794a,null))[_0x40ca('0x25')](function(_0x2a3e33){if(_0x2a3e33){_0x3aa302['message']=_0x2a3e33[_0x40ca('0x68')]({'plain':!![]});return db[_0x40ca('0x69')][_0x40ca('0x5d')]({'where':{'id':_0x2a3e33[_0x40ca('0x82')]}});}return null;})[_0x40ca('0x25')](handleEntityNotFound(_0xba794a,null))[_0x40ca('0x25')](function(_0x406bb6){if(_0x406bb6){_0x3aa302[_0x40ca('0x6d')]=_0x406bb6['get']({'plain':!![]});interaction_log[_0x40ca('0x26')](_0x40ca('0x83'),_0x5381bb[_0x40ca('0x67')]['id'],_0x5381bb[_0x40ca('0x67')]['name'],_0x5381bb[_0x40ca('0x67')][_0x40ca('0x6e')],_0x3aa302[_0x40ca('0x6d')]['id'],_0x5381bb[_0x40ca('0x5f')]?JSON[_0x40ca('0x2a')](_0x5381bb[_0x40ca('0x5f')]):_0x40ca('0x6f'));return respondWithRpcPromise('RejectMessage',_0x40ca('0x84'),_0x3aa302);}return null;})[_0x40ca('0x25')](function(_0x20ded1){var _0x688bf=_0x40ca('0x72')+_0x20ded1['message'][_0x40ca('0x73')];return db['sequelize']['query'](_0x688bf,{'type':db['Sequelize']['QueryTypes'][_0x40ca('0x76')],'raw':!![]})[_0x40ca('0x25')](function(_0x39ce63){return _0x39ce63;});})['then'](function(_0x14532b){if(_0x14532b){_0x3aa302[_0x40ca('0x2e')]['contact']=_0x14532b[0x0];if(!_0x5381bb[_0x40ca('0x5f')]['UserId'])return;return db['User'][_0x40ca('0x5d')]({'where':{'id':_0x5381bb[_0x40ca('0x5f')][_0x40ca('0x66')],'role':'agent'},'attributes':['id',_0x40ca('0x40'),'fullname',_0x40ca('0x7a'),_0x40ca('0x85')],'raw':!![]});}return null;})[_0x40ca('0x25')](function(_0x32b1e5){if(!_0x32b1e5)return null;_0x3aa302[_0x40ca('0x2e')]['agent']=_0x32b1e5;return _0x3aa302;})['then'](function(_0x372dcc){if(_0x372dcc){_0x372dcc['message']['interface']=util[_0x40ca('0x65')]('SIP/%s',_0x5381bb[_0x40ca('0x67')][_0x40ca('0x40')]);_0x372dcc[_0x40ca('0x2e')]['channel']=_0x3aa302[_0x40ca('0x7c')];_0x372dcc[_0x40ca('0x2e')][_0x40ca('0x7d')]=_0x3aa302[_0x40ca('0x7c')];_0x372dcc[_0x40ca('0x2e')][_0x40ca('0x7e')]=_0x40ca('0x3b');respondWithRpcPromise('EventManager',_0x40ca('0x7f'),{'event':_0x40ca('0x86'),'message':_[_0x40ca('0x54')](_0x3aa302[_0x40ca('0x2e')],JSON[_0x40ca('0x87')](_0x3aa302[_0x40ca('0x6d')][_0x40ca('0x88')]))},client9002);return _0x3aa302;}return null;})[_0x40ca('0x25')](respondWithResult(_0xba794a,null))[_0x40ca('0x30')](handleError(_0xba794a,null));}; \ No newline at end of file +var _0x6102=['options','includeAll','include','findAll','rows','show','keys','find','create','update','body','params','describe','chat-interactions','accept','chat','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','format','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','internal','interface','SIP/%s','channel','motionChannel','event','acceptmessage','formData','reject','rejectMessage','EventManager','parse','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./chatMessage.socket','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','sendStatus','status','end','json','offset','count','limit','set','Content-Range','save','destroy','stack','name','send','index','ChatMessage','rawAttributes','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL'];(function(_0x5d0725,_0x1ae8ad){var _0x157c30=function(_0x19c1ad){while(--_0x19c1ad){_0x5d0725['push'](_0x5d0725['shift']());}};_0x157c30(++_0x1ae8ad);}(_0x6102,0x1a8));var _0x2610=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x6102[_0x9dfc10];return _0x4f938a;};'use strict';var emlformat=require(_0x2610('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2610('0x1'));var jsonpatch=require(_0x2610('0x2'));var rp=require(_0x2610('0x3'));var moment=require(_0x2610('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2610('0x5'));var util=require(_0x2610('0x6'));var path=require(_0x2610('0x7'));var sox=require('sox');var csv=require(_0x2610('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2610('0x9'));var _=require(_0x2610('0xa'));var squel=require(_0x2610('0xb'));var crypto=require(_0x2610('0xc'));var jsforce=require(_0x2610('0xd'));var deskjs=require(_0x2610('0xe'));var toCsv=require(_0x2610('0x8'));var querystring=require(_0x2610('0xf'));var Papa=require(_0x2610('0x10'));var Redis=require(_0x2610('0x11'));var authService=require(_0x2610('0x12'));var qs=require(_0x2610('0x13'));var as=require(_0x2610('0x14'));var hardwareService=require(_0x2610('0x15'));var logger=require(_0x2610('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2610('0x17'));var db=require(_0x2610('0x18'))['db'];config['redis']=_[_0x2610('0x19')](config['redis'],{'host':_0x2610('0x1a'),'port':0x18eb});var socket=require(_0x2610('0x1b'))(new Redis(config[_0x2610('0x1c')]));require(_0x2610('0x1d'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x2610('0x1e')][_0x2610('0x1f')]({'port':0x232c});var client9002=jayson[_0x2610('0x1e')][_0x2610('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1f28da,_0x3c4757,_0x340214,_0x10b8ee){return new BPromise(function(_0x1fe3f8,_0x49ba00){var _0x41959d=_0x10b8ee||client;return _0x41959d[_0x2610('0x20')](_0x1f28da,_0x340214)[_0x2610('0x21')](function(_0x2a4e29){logger[_0x2610('0x22')](_0x2610('0x23'),_0x3c4757,'request\x20sent');logger['debug'](_0x2610('0x24'),_0x3c4757,'request\x20sent',JSON[_0x2610('0x25')](_0x2a4e29));if(_0x2a4e29[_0x2610('0x26')]){if(_0x2a4e29['error']['code']===0x1f4){logger['error'](_0x2610('0x23'),_0x3c4757,_0x2a4e29[_0x2610('0x26')][_0x2610('0x27')]);return _0x49ba00(_0x2a4e29['error'][_0x2610('0x27')]);}logger[_0x2610('0x26')](_0x2610('0x23'),_0x3c4757,_0x2a4e29['error'][_0x2610('0x27')]);return _0x1fe3f8(_0x2a4e29[_0x2610('0x26')][_0x2610('0x27')]);}else{logger[_0x2610('0x22')](_0x2610('0x23'),_0x3c4757,_0x2610('0x28'));_0x1fe3f8(_0x2a4e29['result'][_0x2610('0x27')]);}})[_0x2610('0x29')](function(_0x4dce46){logger[_0x2610('0x26')](_0x2610('0x23'),_0x3c4757,_0x4dce46);_0x49ba00(_0x4dce46);});});}function respondWithStatusCode(_0xdb1894,_0xeba552){_0xeba552=_0xeba552||0xcc;return function(_0x58356b){if(_0x58356b){return _0xdb1894[_0x2610('0x2a')](_0xeba552);}return _0xdb1894[_0x2610('0x2b')](_0xeba552)[_0x2610('0x2c')]();};}function respondWithResult(_0x27dd50,_0x3b5a64){_0x3b5a64=_0x3b5a64||0xc8;return function(_0x54a13e){if(_0x54a13e){return _0x27dd50[_0x2610('0x2b')](_0x3b5a64)[_0x2610('0x2d')](_0x54a13e);}};}function respondWithFilteredResult(_0x2bd4e9,_0xfcb8a4){return function(_0x4b9dbd){if(_0x4b9dbd){var _0x48e89a=typeof _0xfcb8a4[_0x2610('0x2e')]==='undefined'&&typeof _0xfcb8a4['limit']==='undefined';var _0x179ed1=_0x4b9dbd['count'];var _0x3d0e21=_0x48e89a?0x0:_0xfcb8a4[_0x2610('0x2e')];var _0x7caaa8=_0x48e89a?_0x4b9dbd[_0x2610('0x2f')]:_0xfcb8a4[_0x2610('0x2e')]+_0xfcb8a4[_0x2610('0x30')];var _0x26a7b1;if(_0x7caaa8>=_0x179ed1){_0x7caaa8=_0x179ed1;_0x26a7b1=0xc8;}else{_0x26a7b1=0xce;}_0x2bd4e9[_0x2610('0x2b')](_0x26a7b1);return _0x2bd4e9[_0x2610('0x31')](_0x2610('0x32'),_0x3d0e21+'-'+_0x7caaa8+'/'+_0x179ed1)[_0x2610('0x2d')](_0x4b9dbd);}return null;};}function patchUpdates(_0x4c4392){return function(_0x1dd308){try{jsonpatch['apply'](_0x1dd308,_0x4c4392,!![]);}catch(_0x574b08){return BPromise['reject'](_0x574b08);}return _0x1dd308[_0x2610('0x33')]();};}function saveUpdates(_0x5be6b1,_0x57a783){return function(_0xcb5e92){if(_0xcb5e92){return _0xcb5e92['update'](_0x5be6b1)[_0x2610('0x21')](function(_0xe60265){return _0xe60265;});}return null;};}function removeEntity(_0x1b09ea,_0x3be6bc){return function(_0x4db9f7){if(_0x4db9f7){return _0x4db9f7[_0x2610('0x34')]()[_0x2610('0x21')](function(){_0x1b09ea[_0x2610('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x144883,_0x1d9e2a){return function(_0xb44ed8){if(!_0xb44ed8){_0x144883[_0x2610('0x2a')](0x194);}return _0xb44ed8;};}function handleError(_0x25becf,_0x19af37){_0x19af37=_0x19af37||0x1f4;return function(_0x56404b){logger[_0x2610('0x26')](_0x56404b[_0x2610('0x35')]);if(_0x56404b['name']){delete _0x56404b[_0x2610('0x36')];}_0x25becf[_0x2610('0x2b')](_0x19af37)[_0x2610('0x37')](_0x56404b);};}exports[_0x2610('0x38')]=function(_0x352594,_0x12e180){var _0x591b71={},_0x156e6d={},_0x2f5f9c={'count':0x0,'rows':[]};var _0x7c04f3=_['map'](db[_0x2610('0x39')][_0x2610('0x3a')],function(_0x3cca58){return{'name':_0x3cca58['fieldName'],'type':_0x3cca58['type']['key']};});_0x156e6d[_0x2610('0x3b')]=_[_0x2610('0x3c')](_0x7c04f3,_0x2610('0x36'));_0x156e6d[_0x2610('0x3d')]=_['keys'](_0x352594[_0x2610('0x3d')]);_0x156e6d[_0x2610('0x3e')]=_[_0x2610('0x3f')](_0x156e6d[_0x2610('0x3b')],_0x156e6d[_0x2610('0x3d')]);_0x591b71[_0x2610('0x40')]=_[_0x2610('0x3f')](_0x156e6d[_0x2610('0x3b')],qs[_0x2610('0x41')](_0x352594[_0x2610('0x3d')]['fields']));_0x591b71[_0x2610('0x40')]=_0x591b71[_0x2610('0x40')][_0x2610('0x42')]?_0x591b71[_0x2610('0x40')]:_0x156e6d[_0x2610('0x3b')];if(!_0x352594[_0x2610('0x3d')][_0x2610('0x43')](_0x2610('0x44'))){_0x591b71[_0x2610('0x30')]=qs[_0x2610('0x30')](_0x352594[_0x2610('0x3d')][_0x2610('0x30')]);_0x591b71[_0x2610('0x2e')]=qs[_0x2610('0x2e')](_0x352594[_0x2610('0x3d')][_0x2610('0x2e')]);}_0x591b71[_0x2610('0x45')]=qs['sort'](_0x352594[_0x2610('0x3d')][_0x2610('0x46')]);_0x591b71['where']=qs['filters'](_[_0x2610('0x47')](_0x352594[_0x2610('0x3d')],_0x156e6d[_0x2610('0x3e')]),_0x7c04f3);if(_0x352594['query'][_0x2610('0x48')]){_0x591b71['where']=_[_0x2610('0x49')](_0x591b71[_0x2610('0x4a')],{'$or':_[_0x2610('0x3c')](_0x7c04f3,function(_0x14746c){if(_0x14746c['type']!==_0x2610('0x4b')){var _0x40721c={};_0x40721c[_0x14746c[_0x2610('0x36')]]={'$like':'%'+_0x352594[_0x2610('0x3d')][_0x2610('0x48')]+'%'};return _0x40721c;}})});}_0x591b71=_['merge']({},_0x591b71,_0x352594[_0x2610('0x4c')]);var _0xef5029={'where':_0x591b71[_0x2610('0x4a')]};return db['ChatMessage'][_0x2610('0x2f')](_0xef5029)['then'](function(_0x3ca956){_0x2f5f9c[_0x2610('0x2f')]=_0x3ca956;if(_0x352594[_0x2610('0x3d')][_0x2610('0x4d')]){_0x591b71[_0x2610('0x4e')]=[{'all':!![]}];}return db[_0x2610('0x39')][_0x2610('0x4f')](_0x591b71);})['then'](function(_0x7e17a6){_0x2f5f9c[_0x2610('0x50')]=_0x7e17a6;return _0x2f5f9c;})['then'](respondWithFilteredResult(_0x12e180,_0x591b71))[_0x2610('0x29')](handleError(_0x12e180,null));};exports[_0x2610('0x51')]=function(_0x1983d0,_0x1201c0){var _0x141d21={'raw':!![],'where':{'id':_0x1983d0['params']['id']}},_0x22b2a6={};_0x22b2a6[_0x2610('0x3b')]=_[_0x2610('0x52')](db[_0x2610('0x39')][_0x2610('0x3a')]);_0x22b2a6[_0x2610('0x3d')]=_['keys'](_0x1983d0['query']);_0x22b2a6[_0x2610('0x3e')]=_[_0x2610('0x3f')](_0x22b2a6[_0x2610('0x3b')],_0x22b2a6[_0x2610('0x3d')]);_0x141d21[_0x2610('0x40')]=_[_0x2610('0x3f')](_0x22b2a6['model'],qs['fields'](_0x1983d0[_0x2610('0x3d')][_0x2610('0x41')]));_0x141d21[_0x2610('0x40')]=_0x141d21[_0x2610('0x40')][_0x2610('0x42')]?_0x141d21[_0x2610('0x40')]:_0x22b2a6[_0x2610('0x3b')];if(_0x1983d0[_0x2610('0x3d')]['includeAll']){_0x141d21[_0x2610('0x4e')]=[{'all':!![]}];}_0x141d21=_['merge']({},_0x141d21,_0x1983d0[_0x2610('0x4c')]);return db[_0x2610('0x39')][_0x2610('0x53')](_0x141d21)[_0x2610('0x21')](handleEntityNotFound(_0x1201c0,null))[_0x2610('0x21')](respondWithResult(_0x1201c0,null))[_0x2610('0x29')](handleError(_0x1201c0,null));};exports[_0x2610('0x54')]=function(_0x43df4c,_0x37b19b){return db[_0x2610('0x39')]['create'](_0x43df4c['body'],{})[_0x2610('0x21')](respondWithResult(_0x37b19b,0xc9))[_0x2610('0x29')](handleError(_0x37b19b,null));};exports[_0x2610('0x55')]=function(_0x2f580c,_0x46097b){if(_0x2f580c[_0x2610('0x56')]['id']){delete _0x2f580c[_0x2610('0x56')]['id'];}return db[_0x2610('0x39')][_0x2610('0x53')]({'where':{'id':_0x2f580c[_0x2610('0x57')]['id']}})['then'](handleEntityNotFound(_0x46097b,null))[_0x2610('0x21')](saveUpdates(_0x2f580c[_0x2610('0x56')],null))['then'](respondWithResult(_0x46097b,null))[_0x2610('0x29')](handleError(_0x46097b,null));};exports[_0x2610('0x34')]=function(_0x1ec7d8,_0x4319e9){return db[_0x2610('0x39')][_0x2610('0x53')]({'where':{'id':_0x1ec7d8[_0x2610('0x57')]['id']}})[_0x2610('0x21')](handleEntityNotFound(_0x4319e9,null))[_0x2610('0x21')](removeEntity(_0x4319e9,null))['catch'](handleError(_0x4319e9,null));};exports[_0x2610('0x58')]=function(_0x4aa4bb,_0x23456a){return db[_0x2610('0x39')]['describe']()['then'](respondWithResult(_0x23456a,null))[_0x2610('0x29')](handleError(_0x23456a,null));};var interaction_log=require(_0x2610('0x16'))(_0x2610('0x59'));exports[_0x2610('0x5a')]=function(_0x276352,_0x448387,_0x5157d4){var _0xe89672={'agent':{},'channel':_0x2610('0x5b')};if(_0x276352[_0x2610('0x56')]['id']){delete _0x276352[_0x2610('0x56')]['id'];}_0x276352['body']['read']=!![];_0x276352[_0x2610('0x56')][_0x2610('0x5c')]=moment()['format'](_0x2610('0x5d'));_0x276352[_0x2610('0x56')]['UserId']=_0x276352[_0x2610('0x56')][_0x2610('0x5e')]||_0x276352[_0x2610('0x5f')]['id'];_0xe89672[_0x2610('0x60')]['id']=_0x276352['body']['UserId'];return db[_0x2610('0x39')]['find']({'where':{'id':_0x276352['params']['id'],'UserId':null}})[_0x2610('0x21')](handleEntityNotFound(_0x448387,null))[_0x2610('0x21')](saveUpdates(_0x276352[_0x2610('0x56')],null))[_0x2610('0x21')](function(_0x2d59b2){if(_0x2d59b2){_0xe89672['message']=_0x2d59b2[_0x2610('0x61')]({'plain':!![]});return db[_0x2610('0x62')][_0x2610('0x53')]({'where':{'id':_0x2d59b2[_0x2610('0x63')]}});}return null;})[_0x2610('0x21')](handleEntityNotFound(_0x448387,null))['then'](function(_0x38f2a5){if(_0x38f2a5){return _0x38f2a5[_0x2610('0x55')]({'UserId':_0x276352[_0x2610('0x56')][_0x2610('0x5e')],'read1stAt':_['isNil'](_0x38f2a5['read1stAt'])?moment()[_0x2610('0x64')](_0x2610('0x5d')):undefined});}return null;})[_0x2610('0x21')](function(_0xa839c9){if(_0xa839c9){_0xe89672['interaction']=_0xa839c9[_0x2610('0x61')]({'plain':!![]});interaction_log[_0x2610('0x22')](_0x2610('0x65'),_0x276352[_0x2610('0x5f')]['id'],_0x276352[_0x2610('0x5f')][_0x2610('0x36')],_0x276352[_0x2610('0x5f')]['role'],_0xe89672[_0x2610('0x66')]['id'],_0x276352['body']?JSON[_0x2610('0x25')](_0x276352[_0x2610('0x56')]):_0x2610('0x67'));return respondWithRpcPromise('AcceptMessage',_0x2610('0x68'),_0xe89672);}return null;})['then'](function(_0x1b5cf0){var _0x271ca2=_0x2610('0x69')+_0x1b5cf0[_0x2610('0x27')][_0x2610('0x6a')];return db[_0x2610('0x6b')][_0x2610('0x3d')](_0x271ca2,{'type':db[_0x2610('0x6c')][_0x2610('0x6d')][_0x2610('0x6e')],'raw':!![]})[_0x2610('0x21')](function(_0x4d7ba7){return _0x4d7ba7;});})[_0x2610('0x21')](function(_0xb746eb){if(_0xb746eb){_0xe89672[_0x2610('0x27')][_0x2610('0x6f')]=_0xb746eb[0x0];if(!_0x276352[_0x2610('0x56')][_0x2610('0x5e')])return;return db['User'][_0x2610('0x53')]({'where':{'id':_0x276352['body'][_0x2610('0x5e')],'role':'agent'},'attributes':['id','name',_0x2610('0x70'),'email',_0x2610('0x71')],'raw':!![]});}return null;})[_0x2610('0x21')](function(_0x324952){if(!_0x324952)return null;_0xe89672['message'][_0x2610('0x60')]=_0x324952;return _0xe89672;})['then'](function(_0x4c684d){if(_0x4c684d){if(_0x276352[_0x2610('0x56')]['manual']){_0xe89672[_0x2610('0x27')][_0x2610('0x72')]=util['format'](_0x2610('0x73'),_0x276352['user'][_0x2610('0x36')]);_0xe89672['message'][_0x2610('0x74')]=_0xe89672[_0x2610('0x74')];_0xe89672['message'][_0x2610('0x75')]=_0xe89672[_0x2610('0x74')];_0xe89672[_0x2610('0x27')][_0x2610('0x76')]=_0x2610('0x5a');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x2610('0x77'),'message':_['merge'](_0xe89672[_0x2610('0x27')],JSON['parse'](_0xe89672[_0x2610('0x66')][_0x2610('0x78')]))},client9002)[_0x2610('0x21')](function(){return _0xe89672;});}return _0xe89672;}return null;})['then'](respondWithResult(_0x448387,null))[_0x2610('0x29')](handleError(_0x448387,null));};var interaction_log=require('../../config/logger')(_0x2610('0x59'));exports[_0x2610('0x79')]=function(_0x132abb,_0x32ad41,_0xe3c07f){var _0x5b83bd={'agent':{},'channel':'chat'};if(_0x132abb[_0x2610('0x56')]['id']){delete _0x132abb[_0x2610('0x56')]['id'];}_0x132abb['body']['UserId']=_0x132abb[_0x2610('0x56')][_0x2610('0x5e')]||_0x132abb['user']['id'];_0x5b83bd['agent']['id']=_0x132abb['body'][_0x2610('0x5e')];return db['ChatMessage'][_0x2610('0x53')]({'where':{'id':_0x132abb['params']['id'],'UserId':null}})[_0x2610('0x21')](handleEntityNotFound(_0x32ad41,null))[_0x2610('0x21')](function(_0x51ac99){if(_0x51ac99){_0x5b83bd[_0x2610('0x27')]=_0x51ac99[_0x2610('0x61')]({'plain':!![]});return db['ChatInteraction'][_0x2610('0x53')]({'where':{'id':_0x51ac99[_0x2610('0x63')]}});}return null;})[_0x2610('0x21')](handleEntityNotFound(_0x32ad41,null))[_0x2610('0x21')](function(_0x541edf){if(_0x541edf){_0x5b83bd[_0x2610('0x66')]=_0x541edf[_0x2610('0x61')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x132abb[_0x2610('0x5f')]['id'],_0x132abb[_0x2610('0x5f')]['name'],_0x132abb['user']['role'],_0x5b83bd[_0x2610('0x66')]['id'],_0x132abb[_0x2610('0x56')]?JSON[_0x2610('0x25')](_0x132abb[_0x2610('0x56')]):_0x2610('0x67'));return respondWithRpcPromise('RejectMessage',_0x2610('0x7a'),_0x5b83bd);}return null;})[_0x2610('0x21')](function(_0x4fda23){var _0x4024e5='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4fda23[_0x2610('0x27')]['ContactId'];return db[_0x2610('0x6b')]['query'](_0x4024e5,{'type':db[_0x2610('0x6c')][_0x2610('0x6d')]['SELECT'],'raw':!![]})[_0x2610('0x21')](function(_0x143913){return _0x143913;});})['then'](function(_0x31646b){if(_0x31646b){_0x5b83bd['message'][_0x2610('0x6f')]=_0x31646b[0x0];if(!_0x132abb[_0x2610('0x56')][_0x2610('0x5e')])return;return db['User'][_0x2610('0x53')]({'where':{'id':_0x132abb[_0x2610('0x56')][_0x2610('0x5e')],'role':'agent'},'attributes':['id',_0x2610('0x36'),_0x2610('0x70'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x5742d0){if(!_0x5742d0)return null;_0x5b83bd[_0x2610('0x27')][_0x2610('0x60')]=_0x5742d0;return _0x5b83bd;})[_0x2610('0x21')](function(_0x4d190e){if(_0x4d190e){_0x4d190e[_0x2610('0x27')][_0x2610('0x72')]=util[_0x2610('0x64')](_0x2610('0x73'),_0x132abb[_0x2610('0x5f')][_0x2610('0x36')]);_0x4d190e[_0x2610('0x27')][_0x2610('0x74')]=_0x5b83bd[_0x2610('0x74')];_0x4d190e[_0x2610('0x27')][_0x2610('0x75')]=_0x5b83bd['channel'];_0x4d190e[_0x2610('0x27')][_0x2610('0x76')]=_0x2610('0x79');respondWithRpcPromise('EventManager',_0x2610('0x7b'),{'event':'rejectmessage','message':_[_0x2610('0x49')](_0x5b83bd[_0x2610('0x27')],JSON[_0x2610('0x7c')](_0x5b83bd[_0x2610('0x66')]['formData']))},client9002);return _0x5b83bd;}return null;})[_0x2610('0x21')](respondWithResult(_0x32ad41,null))[_0x2610('0x29')](handleError(_0x32ad41,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 5ee34e5..f95fe01 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 _0x2b23=['hasOwnProperty','exports','ChatMessage','setMaxListeners','save','update','remove','emit'];(function(_0xe27810,_0x8b3e76){var _0x53dcec=function(_0x4a83c7){while(--_0x4a83c7){_0xe27810['push'](_0xe27810['shift']());}};_0x53dcec(++_0x8b3e76);}(_0x2b23,0x18a));var _0x32b2=function(_0x4ec46b,_0x2fe648){_0x4ec46b=_0x4ec46b-0x0;var _0x4fb398=_0x2b23[_0x4ec46b];return _0x4fb398;};'use strict';var EventEmitter=require('events');var ChatMessage=require('../../mysqldb')['db'][_0x32b2('0x0')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x32b2('0x1')](0x0);var events={'afterCreate':_0x32b2('0x2'),'afterUpdate':_0x32b2('0x3'),'afterDestroy':_0x32b2('0x4')};function emitEvent(_0x2bf782){return function(_0x51d2ff,_0x4d7c27,_0x19763a){ChatMessageEvents[_0x32b2('0x5')](_0x2bf782+':'+_0x51d2ff['id'],_0x51d2ff);ChatMessageEvents[_0x32b2('0x5')](_0x2bf782,_0x51d2ff);_0x19763a(null);};}for(var e in events){if(events[_0x32b2('0x6')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x32b2('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x5473=['events','ChatMessage','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports'];(function(_0x531e20,_0x59d57e){var _0x100113=function(_0x38d53c){while(--_0x38d53c){_0x531e20['push'](_0x531e20['shift']());}};_0x100113(++_0x59d57e);}(_0x5473,0x10e));var _0x3547=function(_0x11b273,_0xfca019){_0x11b273=_0x11b273-0x0;var _0x2ea894=_0x5473[_0x11b273];return _0x2ea894;};'use strict';var EventEmitter=require(_0x3547('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x3547('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x3547('0x2')](0x0);var events={'afterCreate':_0x3547('0x3'),'afterUpdate':_0x3547('0x4'),'afterDestroy':_0x3547('0x5')};function emitEvent(_0x58a3c5){return function(_0x5b7fcb,_0x4e641f,_0xef1a3a){ChatMessageEvents['emit'](_0x58a3c5+':'+_0x5b7fcb['id'],_0x5b7fcb);ChatMessageEvents['emit'](_0x58a3c5,_0x5b7fcb);_0xef1a3a(null);};}for(var e in events){if(events[_0x3547('0x6')](e)){var event=events[e];ChatMessage[_0x3547('0x7')](e,emitEvent(event));}}module[_0x3547('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index a29a6d8..5240b3c 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 _0xa8ad=['ChatMessage','chat_messages','models','get','direction','toLowerCase','out','secret','isNil','ChatInteraction','then','update','createdAt','error','utf8mb4_unicode_ci','lodash','../../config/logger','bluebird','rimraf','../../config/environment','./chatMessage.attributes','exports','define'];(function(_0x55c077,_0x18a5e3){var _0x3e60cc=function(_0x370722){while(--_0x370722){_0x55c077['push'](_0x55c077['shift']());}};_0x3e60cc(++_0x18a5e3);}(_0xa8ad,0x10c));var _0xda8a=function(_0x5181e6,_0x554c30){_0x5181e6=_0x5181e6-0x0;var _0x5ad1c4=_0xa8ad[_0x5181e6];return _0x5ad1c4;};'use strict';var _=require(_0xda8a('0x0'));var util=require('util');var logger=require(_0xda8a('0x1'))('api');var moment=require('moment');var BPromise=require(_0xda8a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xda8a('0x3'));var config=require(_0xda8a('0x4'));var attributes=require(_0xda8a('0x5'));module[_0xda8a('0x6')]=function(_0x5e8b5e,_0x7fe7ff){return _0x5e8b5e[_0xda8a('0x7')](_0xda8a('0x8'),attributes,{'tableName':_0xda8a('0x9'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x39176a,_0x2f2104,_0x41922d){var _0x4c72da=_0x5e8b5e[_0xda8a('0xa')];var _0x273abe=_0x39176a[_0xda8a('0xb')]({'plain':!![]});if(_0x273abe[_0xda8a('0xc')]['toLowerCase']()==='in'||_0x273abe[_0xda8a('0xc')][_0xda8a('0xd')]()===_0xda8a('0xe')&&!_0x273abe[_0xda8a('0xf')]&&!_[_0xda8a('0x10')](_0x273abe['UserId'])){_0x4c72da[_0xda8a('0x11')]['findOne']({'where':{'id':_0x273abe['ChatInteractionId']}})[_0xda8a('0x12')](function(_0x2953af){if(_0x2953af){_0x2953af[_0xda8a('0x13')]({'lastMsgAt':_0x273abe[_0xda8a('0x14')],'lastMsgDirection':_0x273abe[_0xda8a('0xc')]['toLowerCase']()});}})['catch'](function(_0x3c7101){console[_0xda8a('0x15')](_0x3c7101);});}_0x41922d();}},'charset':'utf8mb4','collate':_0xda8a('0x16')});}; \ No newline at end of file +var _0xf1a7=['rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','models','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','update','createdAt','catch','error','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x480a7d,_0x5f9f50){var _0x1bb436=function(_0x1a3c46){while(--_0x1a3c46){_0x480a7d['push'](_0x480a7d['shift']());}};_0x1bb436(++_0x5f9f50);}(_0xf1a7,0x1d9));var _0x7f1a=function(_0x1867b2,_0x2650fb){_0x1867b2=_0x1867b2-0x0;var _0xf51282=_0xf1a7[_0x1867b2];return _0xf51282;};'use strict';var _=require(_0x7f1a('0x0'));var util=require('util');var logger=require(_0x7f1a('0x1'))(_0x7f1a('0x2'));var moment=require(_0x7f1a('0x3'));var BPromise=require(_0x7f1a('0x4'));var rp=require(_0x7f1a('0x5'));var fs=require('fs');var path=require(_0x7f1a('0x6'));var rimraf=require(_0x7f1a('0x7'));var config=require(_0x7f1a('0x8'));var attributes=require(_0x7f1a('0x9'));module[_0x7f1a('0xa')]=function(_0x22f140,_0x29c313){return _0x22f140[_0x7f1a('0xb')](_0x7f1a('0xc'),attributes,{'tableName':_0x7f1a('0xd'),'paranoid':![],'indexes':[{'name':_0x7f1a('0xe'),'fields':[_0x7f1a('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5df090,_0x3f6ef4,_0x1859cc){var _0x52d525=_0x22f140[_0x7f1a('0x10')];var _0x8f66bc=_0x5df090['get']({'plain':!![]});if(_0x8f66bc[_0x7f1a('0x11')][_0x7f1a('0x12')]()==='in'||_0x8f66bc[_0x7f1a('0x11')][_0x7f1a('0x12')]()===_0x7f1a('0x13')&&!_0x8f66bc[_0x7f1a('0x14')]&&!_[_0x7f1a('0x15')](_0x8f66bc[_0x7f1a('0x16')])){_0x52d525[_0x7f1a('0x17')][_0x7f1a('0x18')]({'where':{'id':_0x8f66bc[_0x7f1a('0x19')]}})['then'](function(_0x38fa0c){if(_0x38fa0c){_0x38fa0c[_0x7f1a('0x1a')]({'lastMsgAt':_0x8f66bc[_0x7f1a('0x1b')],'lastMsgDirection':_0x8f66bc[_0x7f1a('0x11')][_0x7f1a('0x12')]()});}})[_0x7f1a('0x1c')](function(_0x3290a7){console[_0x7f1a('0x1d')](_0x3290a7);});}_0x1859cc();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index d7832a4..7a5902b 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 _0x78b5=['ChatMessage','create','body','options','raw','then','CreateChatMessage','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','./chatMessage.socket','register','request','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0x48e6f1,_0x1bd3e8){var _0x154ae1=function(_0x253b58){while(--_0x253b58){_0x48e6f1['push'](_0x48e6f1['shift']());}};_0x154ae1(++_0x1bd3e8);}(_0x78b5,0x172));var _0x578b=function(_0x14224d,_0x3b3d33){_0x14224d=_0x14224d-0x0;var _0x16d87c=_0x78b5[_0x14224d];return _0x16d87c;};'use strict';var _=require(_0x578b('0x0'));var util=require(_0x578b('0x1'));var moment=require('moment');var BPromise=require(_0x578b('0x2'));var rs=require(_0x578b('0x3'));var fs=require('fs');var Redis=require(_0x578b('0x4'));var db=require(_0x578b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x578b('0x6'))(_0x578b('0x7'));var config=require('../../config/environment');var jayson=require(_0x578b('0x8'));var client=jayson[_0x578b('0x9')][_0x578b('0xa')]({'port':0x232a});config[_0x578b('0xb')]=_[_0x578b('0xc')](config[_0x578b('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x578b('0xb')]));require(_0x578b('0xd'))[_0x578b('0xe')](socket);function respondWithRpcPromise(_0x2d482d,_0x550d5f,_0x51fc9f){return new BPromise(function(_0x43c6ac,_0x282343){return client[_0x578b('0xf')](_0x2d482d,_0x51fc9f)['then'](function(_0x55023a){logger[_0x578b('0x10')](_0x578b('0x11'),_0x550d5f,'request\x20sent');logger[_0x578b('0x12')](_0x578b('0x13'),_0x550d5f,_0x578b('0x14'),JSON[_0x578b('0x15')](_0x55023a));if(_0x55023a['error']){if(_0x55023a['error']['code']===0x1f4){logger[_0x578b('0x16')](_0x578b('0x11'),_0x550d5f,_0x55023a[_0x578b('0x16')][_0x578b('0x17')]);return _0x282343(_0x55023a[_0x578b('0x16')][_0x578b('0x17')]);}logger[_0x578b('0x16')](_0x578b('0x11'),_0x550d5f,_0x55023a[_0x578b('0x16')][_0x578b('0x17')]);return _0x43c6ac(_0x55023a[_0x578b('0x16')]['message']);}else{logger['info'](_0x578b('0x11'),_0x550d5f,'request\x20sent');_0x43c6ac(_0x55023a[_0x578b('0x18')][_0x578b('0x17')]);}})[_0x578b('0x19')](function(_0x3f0292){logger[_0x578b('0x16')](_0x578b('0x11'),_0x550d5f,_0x3f0292);_0x282343(_0x3f0292);});});}exports['CreateChatMessage']=function(_0x1835d6){var _0x2ca979=this;return new Promise(function(_0x20cb24,_0xb166cf){return db[_0x578b('0x1a')][_0x578b('0x1b')](_0x1835d6[_0x578b('0x1c')],{'raw':_0x1835d6[_0x578b('0x1d')]?_0x1835d6[_0x578b('0x1d')][_0x578b('0x1e')]===undefined?!![]:![]:!![]})[_0x578b('0x1f')](function(_0x4241e1){logger[_0x578b('0x10')](_0x578b('0x20'),_0x1835d6);logger[_0x578b('0x12')](_0x578b('0x20'),_0x1835d6,JSON[_0x578b('0x15')](_0x4241e1));_0x20cb24(_0x4241e1);})['catch'](function(_0x130ff9){logger[_0x578b('0x16')](_0x578b('0x20'),_0x130ff9['message'],_0x1835d6);_0xb166cf(_0x2ca979[_0x578b('0x16')](0x1f4,_0x130ff9[_0x578b('0x17')]));});});}; \ No newline at end of file +var _0x9cee=['../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','register','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','options','raw','then','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x27beea,_0x3bc9f4){var _0x122645=function(_0x2c848){while(--_0x2c848){_0x27beea['push'](_0x27beea['shift']());}};_0x122645(++_0x3bc9f4);}(_0x9cee,0x143));var _0xe9ce=function(_0x30a1c4,_0x156223){_0x30a1c4=_0x30a1c4-0x0;var _0x555e13=_0x9cee[_0x30a1c4];return _0x555e13;};'use strict';var _=require('lodash');var util=require(_0xe9ce('0x0'));var moment=require(_0xe9ce('0x1'));var BPromise=require(_0xe9ce('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9ce('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe9ce('0x4'));var logger=require(_0xe9ce('0x5'))(_0xe9ce('0x6'));var config=require(_0xe9ce('0x7'));var jayson=require(_0xe9ce('0x8'));var client=jayson['client'][_0xe9ce('0x9')]({'port':0x232a});config['redis']=_[_0xe9ce('0xa')](config[_0xe9ce('0xb')],{'host':_0xe9ce('0xc'),'port':0x18eb});var socket=require(_0xe9ce('0xd'))(new Redis(config[_0xe9ce('0xb')]));require('./chatMessage.socket')[_0xe9ce('0xe')](socket);function respondWithRpcPromise(_0x260205,_0x3f9a39,_0x5ca839){return new BPromise(function(_0x25b50f,_0x3f6f3a){return client[_0xe9ce('0xf')](_0x260205,_0x5ca839)['then'](function(_0xa3cadf){logger[_0xe9ce('0x10')](_0xe9ce('0x11'),_0x3f9a39,_0xe9ce('0x12'));logger[_0xe9ce('0x13')](_0xe9ce('0x14'),_0x3f9a39,_0xe9ce('0x12'),JSON[_0xe9ce('0x15')](_0xa3cadf));if(_0xa3cadf[_0xe9ce('0x16')]){if(_0xa3cadf[_0xe9ce('0x16')][_0xe9ce('0x17')]===0x1f4){logger[_0xe9ce('0x16')]('ChatMessage,\x20%s,\x20%s',_0x3f9a39,_0xa3cadf[_0xe9ce('0x16')][_0xe9ce('0x18')]);return _0x3f6f3a(_0xa3cadf[_0xe9ce('0x16')][_0xe9ce('0x18')]);}logger['error'](_0xe9ce('0x11'),_0x3f9a39,_0xa3cadf[_0xe9ce('0x16')]['message']);return _0x25b50f(_0xa3cadf[_0xe9ce('0x16')][_0xe9ce('0x18')]);}else{logger[_0xe9ce('0x10')](_0xe9ce('0x11'),_0x3f9a39,_0xe9ce('0x12'));_0x25b50f(_0xa3cadf[_0xe9ce('0x19')][_0xe9ce('0x18')]);}})[_0xe9ce('0x1a')](function(_0x1e6ff8){logger['error']('ChatMessage,\x20%s,\x20%s',_0x3f9a39,_0x1e6ff8);_0x3f6f3a(_0x1e6ff8);});});}exports[_0xe9ce('0x1b')]=function(_0x5911bb){var _0x3d4bfe=this;return new Promise(function(_0x17b436,_0x40a24c){return db[_0xe9ce('0x1c')][_0xe9ce('0x1d')](_0x5911bb['body'],{'raw':_0x5911bb['options']?_0x5911bb[_0xe9ce('0x1e')][_0xe9ce('0x1f')]===undefined?!![]:![]:!![]})[_0xe9ce('0x20')](function(_0x59a61a){logger[_0xe9ce('0x10')](_0xe9ce('0x1b'),_0x5911bb);logger[_0xe9ce('0x13')]('CreateChatMessage',_0x5911bb,JSON[_0xe9ce('0x15')](_0x59a61a));_0x17b436(_0x59a61a);})['catch'](function(_0x2f2566){logger['error'](_0xe9ce('0x1b'),_0x2f2566[_0xe9ce('0x18')],_0x5911bb);_0x40a24c(_0x3d4bfe[_0xe9ce('0x16')](0x1f4,_0x2f2566[_0xe9ce('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index c2dfddc..15e3dc6 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 _0x3d6d=['update','emit','removeListener','length','./chatMessage.events','save','remove'];(function(_0x55ded5,_0x4cc8d6){var _0x39a4fb=function(_0x4f364a){while(--_0x4f364a){_0x55ded5['push'](_0x55ded5['shift']());}};_0x39a4fb(++_0x4cc8d6);}(_0x3d6d,0xb3));var _0xd3d6=function(_0xbb36a0,_0x1cb1e4){_0xbb36a0=_0xbb36a0-0x0;var _0x306db2=_0x3d6d[_0xbb36a0];return _0x306db2;};'use strict';var ChatMessageEvents=require(_0xd3d6('0x0'));var events=[_0xd3d6('0x1'),_0xd3d6('0x2'),_0xd3d6('0x3')];function createListener(_0x380c09,_0x1e1915){return function(_0x366f41){_0x1e1915[_0xd3d6('0x4')](_0x380c09,_0x366f41);};}function removeListener(_0x297bd6,_0x3d5e37){return function(){ChatMessageEvents[_0xd3d6('0x5')](_0x297bd6,_0x3d5e37);};}exports['register']=function(_0x5400f8){for(var _0x3f36=0x0,_0x1f02f5=events[_0xd3d6('0x6')];_0x3f36<_0x1f02f5;_0x3f36++){var _0x3c2a9b=events[_0x3f36];var _0x4356b7=createListener('chatMessage:'+_0x3c2a9b,_0x5400f8);ChatMessageEvents['on'](_0x3c2a9b,_0x4356b7);}}; \ No newline at end of file +var _0x83d3=['emit','register','length','chatMessage:','./chatMessage.events','save','remove','update'];(function(_0x339aa1,_0x2a6089){var _0x1679b9=function(_0x53ee7a){while(--_0x53ee7a){_0x339aa1['push'](_0x339aa1['shift']());}};_0x1679b9(++_0x2a6089);}(_0x83d3,0x17c));var _0x383d=function(_0x49036e,_0x1eed49){_0x49036e=_0x49036e-0x0;var _0xb21daf=_0x83d3[_0x49036e];return _0xb21daf;};'use strict';var ChatMessageEvents=require(_0x383d('0x0'));var events=[_0x383d('0x1'),_0x383d('0x2'),_0x383d('0x3')];function createListener(_0x37aa24,_0x5af289){return function(_0x9287d4){_0x5af289[_0x383d('0x4')](_0x37aa24,_0x9287d4);};}function removeListener(_0x31cbfc,_0x202ffc){return function(){ChatMessageEvents['removeListener'](_0x31cbfc,_0x202ffc);};}exports[_0x383d('0x5')]=function(_0x4f3c10){for(var _0x50eaff=0x0,_0xbc074b=events[_0x383d('0x6')];_0x50eaff<_0xbc074b;_0x50eaff++){var _0x360bee=events[_0x50eaff];var _0x5641df=createListener(_0x383d('0x7')+_0x360bee,_0x4f3c10);ChatMessageEvents['on'](_0x360bee,_0x5641df);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 282d8e1..6cddff0 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 _0x119e=['multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','chat','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy'];(function(_0x352b7f,_0xfbd224){var _0x544d92=function(_0x360db6){while(--_0x360db6){_0x352b7f['push'](_0x352b7f['shift']());}};_0x544d92(++_0xfbd224);}(_0x119e,0x17a));var _0xe119=function(_0x552f6d,_0x852364){_0x552f6d=_0x552f6d-0x0;var _0x526c06=_0x119e[_0x552f6d];return _0x526c06;};'use strict';var multer=require(_0xe119('0x0'));var util=require(_0xe119('0x1'));var path=require(_0xe119('0x2'));var timeout=require(_0xe119('0x3'));var express=require(_0xe119('0x4'));var router=express['Router']();var fs_extra=require(_0xe119('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe119('0x6'));var config=require(_0xe119('0x7'));var controller=require(_0xe119('0x8'));router[_0xe119('0x9')]('/',auth[_0xe119('0xa')](),controller[_0xe119('0xb')]);router[_0xe119('0x9')](_0xe119('0xc'),auth[_0xe119('0xa')](),controller[_0xe119('0xd')]);router[_0xe119('0x9')](_0xe119('0xe'),auth[_0xe119('0xa')](),controller[_0xe119('0xf')]);router[_0xe119('0x10')]('/',auth[_0xe119('0xa')](),interaction['tracked'](_0xe119('0x11'),'chatmessage:create'),controller[_0xe119('0x12')]);router[_0xe119('0x13')](_0xe119('0xe'),controller[_0xe119('0x14')]);router['put'](_0xe119('0x15'),auth['isAuthenticated'](),controller[_0xe119('0x16')]);router[_0xe119('0x13')](_0xe119('0x17'),auth[_0xe119('0xa')](),controller[_0xe119('0x18')]);router[_0xe119('0x19')](_0xe119('0xe'),auth[_0xe119('0xa')](),controller[_0xe119('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x0ad8=['chatmessage:create','create','put','/:id/reject','reject','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','chat'];(function(_0x421cf8,_0x23152c){var _0x145c48=function(_0x565862){while(--_0x565862){_0x421cf8['push'](_0x421cf8['shift']());}};_0x145c48(++_0x23152c);}(_0x0ad8,0x11a));var _0x80ad=function(_0x254dfb,_0x58baca){_0x254dfb=_0x254dfb-0x0;var _0x4ed355=_0x0ad8[_0x254dfb];return _0x4ed355;};'use strict';var multer=require(_0x80ad('0x0'));var util=require(_0x80ad('0x1'));var path=require(_0x80ad('0x2'));var timeout=require('connect-timeout');var express=require(_0x80ad('0x3'));var router=express[_0x80ad('0x4')]();var fs_extra=require(_0x80ad('0x5'));var auth=require(_0x80ad('0x6'));var interaction=require(_0x80ad('0x7'));var config=require(_0x80ad('0x8'));var controller=require('./chatMessage.controller');router[_0x80ad('0x9')]('/',auth[_0x80ad('0xa')](),controller[_0x80ad('0xb')]);router['get'](_0x80ad('0xc'),auth[_0x80ad('0xa')](),controller[_0x80ad('0xd')]);router[_0x80ad('0x9')](_0x80ad('0xe'),auth[_0x80ad('0xa')](),controller['show']);router[_0x80ad('0xf')]('/',auth[_0x80ad('0xa')](),interaction[_0x80ad('0x10')](_0x80ad('0x11'),_0x80ad('0x12')),controller[_0x80ad('0x13')]);router['put']('/:id',controller['update']);router[_0x80ad('0x14')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router['put'](_0x80ad('0x15'),auth[_0x80ad('0xa')](),controller[_0x80ad('0x16')]);router['delete'](_0x80ad('0xe'),auth[_0x80ad('0xa')](),controller[_0x80ad('0x17')]);module[_0x80ad('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 9966017..89b51cc 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(_0x1dcf0a,_0x2d19c1){var _0x52fd48=function(_0x485320){while(--_0x485320){_0x1dcf0a['push'](_0x1dcf0a['shift']());}};_0x52fd48(++_0x2d19c1);}(_0xdb28,0x106));var _0x8db2=function(_0x999d7a,_0x4b9169){_0x999d7a=_0x999d7a-0x0;var _0x2e18c6=_0xdb28[_0x999d7a];return _0x2e18c6;};'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 _0x0b0e=['medium','sequelize','TEXT'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1ac6ec,_0x1f81fc){_0x1ac6ec=_0x1ac6ec-0x0;var _0x48a489=_0x0b0e[_0x1ac6ec];return _0x48a489;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe0b0('0x1')](_0xe0b0('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index e8205dd..85e4df3 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(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x7a54,0x106));var _0x47a5=function(_0x26ebee,_0x11b490){_0x26ebee=_0x26ebee-0x0;var _0xe61389=_0x7a54[_0x26ebee];return _0xe61389;};'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(_0x18e763,_0x25f1de){var _0xaaedfd=function(_0x3e7e0b){while(--_0x3e7e0b){_0x18e763['push'](_0x18e763['shift']());}};_0xaaedfd(++_0x25f1de);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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 531f103..b7076a3 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 _0xb294=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update'];(function(_0x38e1df,_0x458b12){var _0x4a9992=function(_0x376268){while(--_0x376268){_0x38e1df['push'](_0x38e1df['shift']());}};_0x4a9992(++_0x458b12);}(_0xb294,0x159));var _0x4b29=function(_0x254726,_0x1c55f2){_0x254726=_0x254726-0x0;var _0x1b8e98=_0xb294[_0x254726];return _0x1b8e98;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x4b29('0x0'))['db'][_0x4b29('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x4b29('0x2')](0x0);var events={'afterCreate':_0x4b29('0x3'),'afterUpdate':_0x4b29('0x4'),'afterDestroy':_0x4b29('0x5')};function emitEvent(_0x82d078){return function(_0x2483fc,_0x55fc1b,_0x208476){ChatOfflineMessageEvents['emit'](_0x82d078+':'+_0x2483fc['id'],_0x2483fc);ChatOfflineMessageEvents[_0x4b29('0x6')](_0x82d078,_0x2483fc);_0x208476(null);};}for(var e in events){if(events[_0x4b29('0x7')](e)){var event=events[e];ChatOfflineMessage[_0x4b29('0x8')](e,emitEvent(event));}}module[_0x4b29('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x3832=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update','remove','emit'];(function(_0x2e3d39,_0x549ca2){var _0x2d9eb4=function(_0x2c95b5){while(--_0x2c95b5){_0x2e3d39['push'](_0x2e3d39['shift']());}};_0x2d9eb4(++_0x549ca2);}(_0x3832,0x9d));var _0x2383=function(_0x554ec5,_0x4a9e0b){_0x554ec5=_0x554ec5-0x0;var _0x3665b7=_0x3832[_0x554ec5];return _0x3665b7;};'use strict';var EventEmitter=require(_0x2383('0x0'));var ChatOfflineMessage=require(_0x2383('0x1'))['db'][_0x2383('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x2383('0x3')](0x0);var events={'afterCreate':_0x2383('0x4'),'afterUpdate':_0x2383('0x5'),'afterDestroy':_0x2383('0x6')};function emitEvent(_0x1c1931){return function(_0x543b67,_0x394167,_0x1557f1){ChatOfflineMessageEvents[_0x2383('0x7')](_0x1c1931+':'+_0x543b67['id'],_0x543b67);ChatOfflineMessageEvents['emit'](_0x1c1931,_0x543b67);_0x1557f1(null);};}for(var e in events){if(events[_0x2383('0x8')](e)){var event=events[e];ChatOfflineMessage[_0x2383('0x9')](e,emitEvent(event));}}module[_0x2383('0xa')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 4b925d5..41a3342 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 _0x9f28=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4'];(function(_0x416183,_0x11b36f){var _0x46f1d2=function(_0x127da0){while(--_0x127da0){_0x416183['push'](_0x416183['shift']());}};_0x46f1d2(++_0x11b36f);}(_0x9f28,0xbe));var _0x89f2=function(_0x1d49e3,_0x71d171){_0x1d49e3=_0x1d49e3-0x0;var _0x2a3c95=_0x9f28[_0x1d49e3];return _0x2a3c95;};'use strict';var attributes=require(_0x89f2('0x0'));module[_0x89f2('0x1')]=function(_0x367df8){return _0x367df8[_0x89f2('0x2')](_0x89f2('0x3'),attributes,{'tableName':_0x89f2('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x89f2('0x5'),'collate':_0x89f2('0x6')});}; \ No newline at end of file +var _0x71e6=['define','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes'];(function(_0x1054f8,_0x166da8){var _0x33d005=function(_0x26d532){while(--_0x26d532){_0x1054f8['push'](_0x1054f8['shift']());}};_0x33d005(++_0x166da8);}(_0x71e6,0x13f));var _0x671e=function(_0x1303b6,_0x3d7288){_0x1303b6=_0x1303b6-0x0;var _0x4a983f=_0x71e6[_0x1303b6];return _0x4a983f;};'use strict';var attributes=require(_0x671e('0x0'));module['exports']=function(_0x2a1142){return _0x2a1142[_0x671e('0x1')]('ChatOfflineMessage',attributes,{'tableName':_0x671e('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x671e('0x3'),'collate':_0x671e('0x4')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index f9ad0ee..88f766a 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 _0xcca7=['request\x20sent','debug','stringify','error','code','message','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s'];(function(_0x3a6e4b,_0x118cd9){var _0x36572d=function(_0x2a53cf){while(--_0x2a53cf){_0x3a6e4b['push'](_0x3a6e4b['shift']());}};_0x36572d(++_0x118cd9);}(_0xcca7,0x1aa));var _0x7cca=function(_0x3e774a,_0x21eb79){_0x3e774a=_0x3e774a-0x0;var _0xf50420=_0xcca7[_0x3e774a];return _0xf50420;};'use strict';var _=require(_0x7cca('0x0'));var util=require(_0x7cca('0x1'));var moment=require(_0x7cca('0x2'));var BPromise=require(_0x7cca('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7cca('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7cca('0x5'))(_0x7cca('0x6'));var config=require(_0x7cca('0x7'));var jayson=require(_0x7cca('0x8'));var client=jayson[_0x7cca('0x9')][_0x7cca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5aec51,_0x508f29,_0x937fad){return new BPromise(function(_0xd7a28d,_0x1aed1b){return client[_0x7cca('0xb')](_0x5aec51,_0x937fad)[_0x7cca('0xc')](function(_0xe800a5){logger[_0x7cca('0xd')](_0x7cca('0xe'),_0x508f29,_0x7cca('0xf'));logger[_0x7cca('0x10')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x508f29,_0x7cca('0xf'),JSON[_0x7cca('0x11')](_0xe800a5));if(_0xe800a5[_0x7cca('0x12')]){if(_0xe800a5[_0x7cca('0x12')][_0x7cca('0x13')]===0x1f4){logger['error'](_0x7cca('0xe'),_0x508f29,_0xe800a5[_0x7cca('0x12')][_0x7cca('0x14')]);return _0x1aed1b(_0xe800a5['error']['message']);}logger[_0x7cca('0x12')](_0x7cca('0xe'),_0x508f29,_0xe800a5[_0x7cca('0x12')][_0x7cca('0x14')]);return _0xd7a28d(_0xe800a5[_0x7cca('0x12')][_0x7cca('0x14')]);}else{logger[_0x7cca('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x508f29,_0x7cca('0xf'));_0xd7a28d(_0xe800a5['result']['message']);}})['catch'](function(_0x33a466){logger[_0x7cca('0x12')](_0x7cca('0xe'),_0x508f29,_0x33a466);_0x1aed1b(_0x33a466);});});} \ No newline at end of file +var _0x3423=['jayson/promise','client','http','then','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatOfflineMessage,\x20%s,\x20%s','info','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x166e96,_0x55191d){var _0x553d73=function(_0x586142){while(--_0x586142){_0x166e96['push'](_0x166e96['shift']());}};_0x553d73(++_0x55191d);}(_0x3423,0x1f0));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3342('0x0'));var util=require(_0x3342('0x1'));var moment=require('moment');var BPromise=require(_0x3342('0x2'));var rs=require(_0x3342('0x3'));var fs=require('fs');var Redis=require(_0x3342('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3342('0x5'));var logger=require(_0x3342('0x6'))(_0x3342('0x7'));var config=require('../../config/environment');var jayson=require(_0x3342('0x8'));var client=jayson[_0x3342('0x9')][_0x3342('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2807ea,_0x40d69c,_0x43072d){return new BPromise(function(_0x1cd4ff,_0xac0c37){return client['request'](_0x2807ea,_0x43072d)[_0x3342('0xb')](function(_0x1f4aee){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x40d69c,_0x3342('0xc'));logger[_0x3342('0xd')](_0x3342('0xe'),_0x40d69c,'request\x20sent',JSON[_0x3342('0xf')](_0x1f4aee));if(_0x1f4aee['error']){if(_0x1f4aee[_0x3342('0x10')]['code']===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x40d69c,_0x1f4aee[_0x3342('0x10')]['message']);return _0xac0c37(_0x1f4aee['error'][_0x3342('0x11')]);}logger[_0x3342('0x10')](_0x3342('0x12'),_0x40d69c,_0x1f4aee[_0x3342('0x10')][_0x3342('0x11')]);return _0x1cd4ff(_0x1f4aee['error'][_0x3342('0x11')]);}else{logger[_0x3342('0x13')](_0x3342('0x12'),_0x40d69c,_0x3342('0xc'));_0x1cd4ff(_0x1f4aee[_0x3342('0x14')][_0x3342('0x11')]);}})['catch'](function(_0x39d5b9){logger[_0x3342('0x10')](_0x3342('0x12'),_0x40d69c,_0x39d5b9);_0xac0c37(_0x39d5b9);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 4b7fe98..03eeda3 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 _0x25ff=['Router','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','put','/:id','delete','destroy','util','connect-timeout','express'];(function(_0x2c547a,_0xd1e02c){var _0x26bd6b=function(_0x35d511){while(--_0x35d511){_0x2c547a['push'](_0x2c547a['shift']());}};_0x26bd6b(++_0xd1e02c);}(_0x25ff,0x14d));var _0xf25f=function(_0x6ee7c8,_0x3bbcc2){_0x6ee7c8=_0x6ee7c8-0x0;var _0x336dad=_0x25ff[_0x6ee7c8];return _0x336dad;};'use strict';var multer=require('multer');var util=require(_0xf25f('0x0'));var path=require('path');var timeout=require(_0xf25f('0x1'));var express=require(_0xf25f('0x2'));var router=express[_0xf25f('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf25f('0x4'));var config=require(_0xf25f('0x5'));var controller=require(_0xf25f('0x6'));router[_0xf25f('0x7')]('/',auth[_0xf25f('0x8')](),controller[_0xf25f('0x9')]);router[_0xf25f('0x7')](_0xf25f('0xa'),auth[_0xf25f('0x8')](),controller[_0xf25f('0xb')]);router[_0xf25f('0x7')]('/:id',auth[_0xf25f('0x8')](),controller['show']);router['post']('/',auth[_0xf25f('0x8')](),controller['create']);router[_0xf25f('0xc')](_0xf25f('0xd'),auth[_0xf25f('0x8')](),controller['update']);router[_0xf25f('0xe')](_0xf25f('0xd'),auth[_0xf25f('0x8')](),controller[_0xf25f('0xf')]);module['exports']=router; \ No newline at end of file +var _0x1b25=['show','post','create','/:id','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','get','isAuthenticated','index','describe'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x1b25,0x149));var _0x51b2=function(_0x113c93,_0x6509bf){_0x113c93=_0x113c93-0x0;var _0x3763b2=_0x1b25[_0x113c93];return _0x3763b2;};'use strict';var multer=require(_0x51b2('0x0'));var util=require(_0x51b2('0x1'));var path=require('path');var timeout=require(_0x51b2('0x2'));var express=require(_0x51b2('0x3'));var router=express[_0x51b2('0x4')]();var fs_extra=require(_0x51b2('0x5'));var auth=require(_0x51b2('0x6'));var interaction=require(_0x51b2('0x7'));var config=require('../../config/environment');var controller=require(_0x51b2('0x8'));router[_0x51b2('0x9')]('/',auth[_0x51b2('0xa')](),controller[_0x51b2('0xb')]);router[_0x51b2('0x9')]('/describe',auth[_0x51b2('0xa')](),controller[_0x51b2('0xc')]);router['get']('/:id',auth[_0x51b2('0xa')](),controller[_0x51b2('0xd')]);router[_0x51b2('0xe')]('/',auth['isAuthenticated'](),controller[_0x51b2('0xf')]);router['put'](_0x51b2('0x10'),auth[_0x51b2('0xa')](),controller[_0x51b2('0x11')]);router['delete'](_0x51b2('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x51b2('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 6235299..34e7630 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 _0x88aa=['mouseOver','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x15f87d,_0x4fef8e){var _0xe33cf0=function(_0x472edd){while(--_0x472edd){_0x15f87d['push'](_0x15f87d['shift']());}};_0xe33cf0(++_0x4fef8e);}(_0x88aa,0xb0));var _0xa88a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x88aa[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0xa88a('0x0'));module[_0xa88a('0x1')]={'name':{'type':Sequelize[_0xa88a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa88a('0x3')](_0xa88a('0x4'),'timeout'),'defaultValue':_0xa88a('0x4')},'selector':{'type':Sequelize[_0xa88a('0x2')]},'timeout':{'type':Sequelize[_0xa88a('0x5')]}}; \ No newline at end of file +var _0xc073=['STRING','ENUM','timeout','INTEGER','exports'];(function(_0x351a37,_0x3a7e8f){var _0x292c12=function(_0xd126dd){while(--_0xd126dd){_0x351a37['push'](_0x351a37['shift']());}};_0x292c12(++_0x3a7e8f);}(_0xc073,0xf9));var _0x3c07=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc073[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x3c07('0x0')]={'name':{'type':Sequelize[_0x3c07('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x3c07('0x2')]('mouseOver',_0x3c07('0x3')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x3c07('0x1')]},'timeout':{'type':Sequelize[_0x3c07('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index fcbda54..7156f69 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 _0x503a=['path','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','options','ChatProactiveAction','find','catch','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x40b089,_0x385c9d){var _0x590b4e=function(_0x54ec1c){while(--_0x54ec1c){_0x40b089['push'](_0x40b089['shift']());}};_0x590b4e(++_0x385c9d);}(_0x503a,0x19d));var _0xa503=function(_0x48c4ef,_0x319d44){_0x48c4ef=_0x48c4ef-0x0;var _0x435715=_0x503a[_0x48c4ef];return _0x435715;};'use strict';var emlformat=require(_0xa503('0x0'));var rimraf=require(_0xa503('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa503('0x2'));var rp=require('request-promise');var moment=require(_0xa503('0x3'));var BPromise=require(_0xa503('0x4'));var Mustache=require(_0xa503('0x5'));var util=require(_0xa503('0x6'));var path=require(_0xa503('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa503('0x8'));var _=require(_0xa503('0x9'));var squel=require('squel');var crypto=require(_0xa503('0xa'));var jsforce=require(_0xa503('0xb'));var deskjs=require(_0xa503('0xc'));var toCsv=require(_0xa503('0xd'));var querystring=require(_0xa503('0xe'));var Papa=require(_0xa503('0xf'));var Redis=require(_0xa503('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa503('0x11'));var as=require(_0xa503('0x12'));var hardwareService=require(_0xa503('0x13'));var logger=require('../../config/logger')(_0xa503('0x14'));var utils=require('../../config/utils');var config=require(_0xa503('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa503('0x16'))['db'];function respondWithStatusCode(_0x29df40,_0x4a47a2){_0x4a47a2=_0x4a47a2||0xcc;return function(_0x524b6c){if(_0x524b6c){return _0x29df40[_0xa503('0x17')](_0x4a47a2);}return _0x29df40[_0xa503('0x18')](_0x4a47a2)[_0xa503('0x19')]();};}function respondWithResult(_0x1db19b,_0x32174a){_0x32174a=_0x32174a||0xc8;return function(_0x1c1971){if(_0x1c1971){return _0x1db19b[_0xa503('0x18')](_0x32174a)[_0xa503('0x1a')](_0x1c1971);}};}function respondWithFilteredResult(_0x3ae1b0,_0x3e81b7){return function(_0x3cbfb6){if(_0x3cbfb6){var _0x36f98d=typeof _0x3e81b7[_0xa503('0x1b')]===_0xa503('0x1c')&&typeof _0x3e81b7['limit']===_0xa503('0x1c');var _0x2a9557=_0x3cbfb6[_0xa503('0x1d')];var _0x11e4a5=_0x36f98d?0x0:_0x3e81b7[_0xa503('0x1b')];var _0x5aae98=_0x36f98d?_0x3cbfb6[_0xa503('0x1d')]:_0x3e81b7['offset']+_0x3e81b7[_0xa503('0x1e')];var _0x4157f5;if(_0x5aae98>=_0x2a9557){_0x5aae98=_0x2a9557;_0x4157f5=0xc8;}else{_0x4157f5=0xce;}_0x3ae1b0[_0xa503('0x18')](_0x4157f5);return _0x3ae1b0[_0xa503('0x1f')](_0xa503('0x20'),_0x11e4a5+'-'+_0x5aae98+'/'+_0x2a9557)[_0xa503('0x1a')](_0x3cbfb6);}return null;};}function patchUpdates(_0x207bfb){return function(_0x10486f){try{jsonpatch[_0xa503('0x21')](_0x10486f,_0x207bfb,!![]);}catch(_0x22f758){return BPromise[_0xa503('0x22')](_0x22f758);}return _0x10486f[_0xa503('0x23')]();};}function saveUpdates(_0x57a26e,_0x5d56e8){return function(_0x420de8){if(_0x420de8){return _0x420de8[_0xa503('0x24')](_0x57a26e)[_0xa503('0x25')](function(_0x469ad6){return _0x469ad6;});}return null;};}function removeEntity(_0x1b125c,_0x5e0402){return function(_0x19f679){if(_0x19f679){return _0x19f679[_0xa503('0x26')]()[_0xa503('0x25')](function(){_0x1b125c['status'](0xcc)[_0xa503('0x19')]();});}};}function handleEntityNotFound(_0x22c7ec,_0x49df0e){return function(_0x686750){if(!_0x686750){_0x22c7ec['sendStatus'](0x194);}return _0x686750;};}function handleError(_0x26b787,_0x2b059d){_0x2b059d=_0x2b059d||0x1f4;return function(_0x3289d4){logger[_0xa503('0x27')](_0x3289d4['stack']);if(_0x3289d4['name']){delete _0x3289d4[_0xa503('0x28')];}_0x26b787[_0xa503('0x18')](_0x2b059d)[_0xa503('0x29')](_0x3289d4);};}exports[_0xa503('0x2a')]=function(_0x37dee2,_0x404733){var _0x57f92b={'raw':!![],'where':{'id':_0x37dee2[_0xa503('0x2b')]['id']}},_0x156f08={};_0x156f08[_0xa503('0x2c')]=_[_0xa503('0x2d')](db['ChatProactiveAction'][_0xa503('0x2e')]);_0x156f08['query']=_[_0xa503('0x2d')](_0x37dee2[_0xa503('0x2f')]);_0x156f08[_0xa503('0x30')]=_[_0xa503('0x31')](_0x156f08[_0xa503('0x2c')],_0x156f08[_0xa503('0x2f')]);_0x57f92b[_0xa503('0x32')]=_['intersection'](_0x156f08[_0xa503('0x2c')],qs[_0xa503('0x33')](_0x37dee2[_0xa503('0x2f')][_0xa503('0x33')]));_0x57f92b[_0xa503('0x32')]=_0x57f92b[_0xa503('0x32')][_0xa503('0x34')]?_0x57f92b[_0xa503('0x32')]:_0x156f08[_0xa503('0x2c')];if(_0x37dee2['query'][_0xa503('0x35')]){_0x57f92b['include']=[{'all':!![]}];}_0x57f92b=_['merge']({},_0x57f92b,_0x37dee2[_0xa503('0x36')]);return db[_0xa503('0x37')][_0xa503('0x38')](_0x57f92b)[_0xa503('0x25')](handleEntityNotFound(_0x404733,null))[_0xa503('0x25')](respondWithResult(_0x404733,null))[_0xa503('0x39')](handleError(_0x404733,null));};exports[_0xa503('0x3a')]=function(_0x5477b9,_0x5952ec){return db[_0xa503('0x37')][_0xa503('0x3a')](_0x5477b9[_0xa503('0x3b')],{})[_0xa503('0x25')](respondWithResult(_0x5952ec,0xc9))[_0xa503('0x39')](handleError(_0x5952ec,null));};exports[_0xa503('0x24')]=function(_0x9d39c2,_0x22bcd5){if(_0x9d39c2['body']['id']){delete _0x9d39c2[_0xa503('0x3b')]['id'];}return db[_0xa503('0x37')][_0xa503('0x38')]({'where':{'id':_0x9d39c2[_0xa503('0x2b')]['id']}})['then'](handleEntityNotFound(_0x22bcd5,null))[_0xa503('0x25')](saveUpdates(_0x9d39c2[_0xa503('0x3b')],null))['then'](respondWithResult(_0x22bcd5,null))[_0xa503('0x39')](handleError(_0x22bcd5,null));};exports['destroy']=function(_0xcc6711,_0x21e6b8){return db['ChatProactiveAction'][_0xa503('0x38')]({'where':{'id':_0xcc6711[_0xa503('0x2b')]['id']}})['then'](handleEntityNotFound(_0x21e6b8,null))[_0xa503('0x25')](removeEntity(_0x21e6b8,null))[_0xa503('0x39')](handleError(_0x21e6b8,null));}; \ No newline at end of file +var _0x98d3=['destroy','then','error','stack','name','show','params','model','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','options','catch','create','ChatProactiveAction','body','find','eml-format','rimraf','fast-json-patch','moment','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','save','update'];(function(_0xd43bed,_0x3670f1){var _0xfd2221=function(_0x4525f1){while(--_0x4525f1){_0xd43bed['push'](_0xd43bed['shift']());}};_0xfd2221(++_0x3670f1);}(_0x98d3,0x173));var _0x398d=function(_0x364192,_0x2ce6b4){_0x364192=_0x364192-0x0;var _0x493370=_0x98d3[_0x364192];return _0x493370;};'use strict';var emlformat=require(_0x398d('0x0'));var rimraf=require(_0x398d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x398d('0x2'));var rp=require('request-promise');var moment=require(_0x398d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x398d('0x4'));var util=require(_0x398d('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x398d('0x6'));var ejs=require(_0x398d('0x7'));var fs=require('fs');var fs_extra=require(_0x398d('0x8'));var _=require('lodash');var squel=require(_0x398d('0x9'));var crypto=require(_0x398d('0xa'));var jsforce=require(_0x398d('0xb'));var deskjs=require(_0x398d('0xc'));var toCsv=require(_0x398d('0x6'));var querystring=require('querystring');var Papa=require(_0x398d('0xd'));var Redis=require(_0x398d('0xe'));var authService=require(_0x398d('0xf'));var qs=require(_0x398d('0x10'));var as=require(_0x398d('0x11'));var hardwareService=require(_0x398d('0x12'));var logger=require(_0x398d('0x13'))(_0x398d('0x14'));var utils=require('../../config/utils');var config=require(_0x398d('0x15'));var licenseUtil=require(_0x398d('0x16'));var db=require(_0x398d('0x17'))['db'];function respondWithStatusCode(_0x12eb91,_0x15a424){_0x15a424=_0x15a424||0xcc;return function(_0x91619e){if(_0x91619e){return _0x12eb91[_0x398d('0x18')](_0x15a424);}return _0x12eb91[_0x398d('0x19')](_0x15a424)[_0x398d('0x1a')]();};}function respondWithResult(_0x396015,_0x1fc998){_0x1fc998=_0x1fc998||0xc8;return function(_0x537bb6){if(_0x537bb6){return _0x396015['status'](_0x1fc998)[_0x398d('0x1b')](_0x537bb6);}};}function respondWithFilteredResult(_0x36cde2,_0x347508){return function(_0x2197b4){if(_0x2197b4){var _0x278004=typeof _0x347508[_0x398d('0x1c')]===_0x398d('0x1d')&&typeof _0x347508[_0x398d('0x1e')]==='undefined';var _0x26b9a0=_0x2197b4['count'];var _0x673840=_0x278004?0x0:_0x347508[_0x398d('0x1c')];var _0x297768=_0x278004?_0x2197b4['count']:_0x347508['offset']+_0x347508['limit'];var _0x28b124;if(_0x297768>=_0x26b9a0){_0x297768=_0x26b9a0;_0x28b124=0xc8;}else{_0x28b124=0xce;}_0x36cde2[_0x398d('0x19')](_0x28b124);return _0x36cde2[_0x398d('0x1f')](_0x398d('0x20'),_0x673840+'-'+_0x297768+'/'+_0x26b9a0)[_0x398d('0x1b')](_0x2197b4);}return null;};}function patchUpdates(_0x1d9e75){return function(_0x38659b){try{jsonpatch['apply'](_0x38659b,_0x1d9e75,!![]);}catch(_0x55c98e){return BPromise['reject'](_0x55c98e);}return _0x38659b[_0x398d('0x21')]();};}function saveUpdates(_0x3b275a,_0x1ea5f9){return function(_0x2affed){if(_0x2affed){return _0x2affed[_0x398d('0x22')](_0x3b275a)['then'](function(_0x5c4c70){return _0x5c4c70;});}return null;};}function removeEntity(_0x31e87d,_0x497ad1){return function(_0x55a48d){if(_0x55a48d){return _0x55a48d[_0x398d('0x23')]()[_0x398d('0x24')](function(){_0x31e87d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4aad76,_0x104069){return function(_0x2cc4ef){if(!_0x2cc4ef){_0x4aad76[_0x398d('0x18')](0x194);}return _0x2cc4ef;};}function handleError(_0x248555,_0x2a1f4d){_0x2a1f4d=_0x2a1f4d||0x1f4;return function(_0xd614bf){logger[_0x398d('0x25')](_0xd614bf[_0x398d('0x26')]);if(_0xd614bf['name']){delete _0xd614bf[_0x398d('0x27')];}_0x248555['status'](_0x2a1f4d)['send'](_0xd614bf);};}exports[_0x398d('0x28')]=function(_0x27bc6e,_0x585fe0){var _0x373326={'raw':!![],'where':{'id':_0x27bc6e[_0x398d('0x29')]['id']}},_0x558249={};_0x558249[_0x398d('0x2a')]=_['keys'](db['ChatProactiveAction'][_0x398d('0x2b')]);_0x558249[_0x398d('0x2c')]=_['keys'](_0x27bc6e[_0x398d('0x2c')]);_0x558249[_0x398d('0x2d')]=_[_0x398d('0x2e')](_0x558249[_0x398d('0x2a')],_0x558249[_0x398d('0x2c')]);_0x373326[_0x398d('0x2f')]=_['intersection'](_0x558249['model'],qs[_0x398d('0x30')](_0x27bc6e[_0x398d('0x2c')][_0x398d('0x30')]));_0x373326[_0x398d('0x2f')]=_0x373326[_0x398d('0x2f')][_0x398d('0x31')]?_0x373326[_0x398d('0x2f')]:_0x558249[_0x398d('0x2a')];if(_0x27bc6e[_0x398d('0x2c')]['includeAll']){_0x373326[_0x398d('0x32')]=[{'all':!![]}];}_0x373326=_[_0x398d('0x33')]({},_0x373326,_0x27bc6e[_0x398d('0x34')]);return db['ChatProactiveAction']['find'](_0x373326)[_0x398d('0x24')](handleEntityNotFound(_0x585fe0,null))[_0x398d('0x24')](respondWithResult(_0x585fe0,null))[_0x398d('0x35')](handleError(_0x585fe0,null));};exports[_0x398d('0x36')]=function(_0x20fe0d,_0x321a49){return db[_0x398d('0x37')][_0x398d('0x36')](_0x20fe0d[_0x398d('0x38')],{})[_0x398d('0x24')](respondWithResult(_0x321a49,0xc9))[_0x398d('0x35')](handleError(_0x321a49,null));};exports[_0x398d('0x22')]=function(_0x32ab00,_0x1c7859){if(_0x32ab00[_0x398d('0x38')]['id']){delete _0x32ab00[_0x398d('0x38')]['id'];}return db[_0x398d('0x37')][_0x398d('0x39')]({'where':{'id':_0x32ab00[_0x398d('0x29')]['id']}})['then'](handleEntityNotFound(_0x1c7859,null))[_0x398d('0x24')](saveUpdates(_0x32ab00[_0x398d('0x38')],null))[_0x398d('0x24')](respondWithResult(_0x1c7859,null))[_0x398d('0x35')](handleError(_0x1c7859,null));};exports[_0x398d('0x23')]=function(_0x4b0045,_0xb8894f){return db['ChatProactiveAction'][_0x398d('0x39')]({'where':{'id':_0x4b0045[_0x398d('0x29')]['id']}})[_0x398d('0x24')](handleEntityNotFound(_0xb8894f,null))[_0x398d('0x24')](removeEntity(_0xb8894f,null))[_0x398d('0x35')](handleError(_0xb8894f,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 84b70f1..581b623 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 _0x21c4=['request-promise','path','rimraf','../../config/environment','define','ChatProactiveAction','chat_proactive_actions','util','../../config/logger','api','moment','bluebird'];(function(_0x5c75d1,_0x1551ef){var _0x4d994a=function(_0x1c57a4){while(--_0x1c57a4){_0x5c75d1['push'](_0x5c75d1['shift']());}};_0x4d994a(++_0x1551ef);}(_0x21c4,0x1e7));var _0x421c=function(_0x3cdbe7,_0x3d6df1){_0x3cdbe7=_0x3cdbe7-0x0;var _0x38886e=_0x21c4[_0x3cdbe7];return _0x38886e;};'use strict';var _=require('lodash');var util=require(_0x421c('0x0'));var logger=require(_0x421c('0x1'))(_0x421c('0x2'));var moment=require(_0x421c('0x3'));var BPromise=require(_0x421c('0x4'));var rp=require(_0x421c('0x5'));var fs=require('fs');var path=require(_0x421c('0x6'));var rimraf=require(_0x421c('0x7'));var config=require(_0x421c('0x8'));var attributes=require('./chatProactiveAction.attributes');module['exports']=function(_0x2da70a,_0x4ca86c){return _0x2da70a[_0x421c('0x9')](_0x421c('0xa'),attributes,{'tableName':_0x421c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0dbf=['./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xc84552,_0x28369d){var _0x4ed409=function(_0xaed735){while(--_0xaed735){_0xc84552['push'](_0xc84552['shift']());}};_0x4ed409(++_0x28369d);}(_0x0dbf,0x155));var _0xf0db=function(_0x48ec91,_0x212edc){_0x48ec91=_0x48ec91-0x0;var _0x22766c=_0x0dbf[_0x48ec91];return _0x22766c;};'use strict';var _=require(_0xf0db('0x0'));var util=require(_0xf0db('0x1'));var logger=require('../../config/logger')(_0xf0db('0x2'));var moment=require(_0xf0db('0x3'));var BPromise=require(_0xf0db('0x4'));var rp=require(_0xf0db('0x5'));var fs=require('fs');var path=require(_0xf0db('0x6'));var rimraf=require(_0xf0db('0x7'));var config=require(_0xf0db('0x8'));var attributes=require(_0xf0db('0x9'));module[_0xf0db('0xa')]=function(_0x337eab,_0x39b30a){return _0x337eab[_0xf0db('0xb')](_0xf0db('0xc'),attributes,{'tableName':_0xf0db('0xd'),'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 478527d..b646a6a 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 _0x6df6=['jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6df6,0x10c));var _0x66df=function(_0x5cbf0e,_0x4cd140){_0x5cbf0e=_0x5cbf0e-0x0;var _0x1c76f8=_0x6df6[_0x5cbf0e];return _0x1c76f8;};'use strict';var _=require(_0x66df('0x0'));var util=require('util');var moment=require(_0x66df('0x1'));var BPromise=require('bluebird');var rs=require(_0x66df('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x66df('0x3'))['db'];var utils=require(_0x66df('0x4'));var logger=require(_0x66df('0x5'))(_0x66df('0x6'));var config=require(_0x66df('0x7'));var jayson=require(_0x66df('0x8'));var client=jayson[_0x66df('0x9')][_0x66df('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x338c27,_0x39d43b,_0x1697a4){return new BPromise(function(_0x1313a0,_0x3b5542){return client[_0x66df('0xb')](_0x338c27,_0x1697a4)[_0x66df('0xc')](function(_0x4139e8){logger[_0x66df('0xd')](_0x66df('0xe'),_0x39d43b,_0x66df('0xf'));logger[_0x66df('0x10')](_0x66df('0x11'),_0x39d43b,_0x66df('0xf'),JSON[_0x66df('0x12')](_0x4139e8));if(_0x4139e8[_0x66df('0x13')]){if(_0x4139e8[_0x66df('0x13')][_0x66df('0x14')]===0x1f4){logger[_0x66df('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x39d43b,_0x4139e8['error']['message']);return _0x3b5542(_0x4139e8[_0x66df('0x13')][_0x66df('0x15')]);}logger[_0x66df('0x13')](_0x66df('0xe'),_0x39d43b,_0x4139e8[_0x66df('0x13')][_0x66df('0x15')]);return _0x1313a0(_0x4139e8[_0x66df('0x13')][_0x66df('0x15')]);}else{logger[_0x66df('0xd')](_0x66df('0xe'),_0x39d43b,_0x66df('0xf'));_0x1313a0(_0x4139e8[_0x66df('0x16')]['message']);}})['catch'](function(_0x45554d){logger[_0x66df('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x39d43b,_0x45554d);_0x3b5542(_0x45554d);});});} \ No newline at end of file +var _0xbe9d=['info','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x412ec4,_0x1dc62a){var _0x52e28b=function(_0x550238){while(--_0x550238){_0x412ec4['push'](_0x412ec4['shift']());}};_0x52e28b(++_0x1dc62a);}(_0xbe9d,0x163));var _0xdbe9=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbe9d[_0x432682];return _0x463d05;};'use strict';var _=require(_0xdbe9('0x0'));var util=require(_0xdbe9('0x1'));var moment=require(_0xdbe9('0x2'));var BPromise=require(_0xdbe9('0x3'));var rs=require(_0xdbe9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdbe9('0x5'))['db'];var utils=require(_0xdbe9('0x6'));var logger=require(_0xdbe9('0x7'))(_0xdbe9('0x8'));var config=require(_0xdbe9('0x9'));var jayson=require(_0xdbe9('0xa'));var client=jayson[_0xdbe9('0xb')][_0xdbe9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x39b178,_0x1335d4,_0x38a5fa){return new BPromise(function(_0x3178f7,_0x42124f){return client['request'](_0x39b178,_0x38a5fa)['then'](function(_0x255d62){logger[_0xdbe9('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x1335d4,_0xdbe9('0xe'));logger['debug'](_0xdbe9('0xf'),_0x1335d4,_0xdbe9('0xe'),JSON[_0xdbe9('0x10')](_0x255d62));if(_0x255d62[_0xdbe9('0x11')]){if(_0x255d62['error'][_0xdbe9('0x12')]===0x1f4){logger[_0xdbe9('0x11')](_0xdbe9('0x13'),_0x1335d4,_0x255d62[_0xdbe9('0x11')][_0xdbe9('0x14')]);return _0x42124f(_0x255d62[_0xdbe9('0x11')]['message']);}logger[_0xdbe9('0x11')](_0xdbe9('0x13'),_0x1335d4,_0x255d62['error']['message']);return _0x3178f7(_0x255d62[_0xdbe9('0x11')][_0xdbe9('0x14')]);}else{logger[_0xdbe9('0xd')](_0xdbe9('0x13'),_0x1335d4,_0xdbe9('0xe'));_0x3178f7(_0x255d62[_0xdbe9('0x15')][_0xdbe9('0x14')]);}})[_0xdbe9('0x16')](function(_0x1dbf8a){logger[_0xdbe9('0x11')](_0xdbe9('0x13'),_0x1335d4,_0x1dbf8a);_0x42124f(_0x1dbf8a);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 4b9a8e8..e627258 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 _0x7217=['Router','fs-extra','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0xa1de8d,_0x1399a8){var _0x478b44=function(_0x3c8db7){while(--_0x3c8db7){_0xa1de8d['push'](_0xa1de8d['shift']());}};_0x478b44(++_0x1399a8);}(_0x7217,0x19e));var _0x7721=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x7217[_0x297fd3];return _0x2af381;};'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')](_0x7721('0x9'),auth[_0x7721('0xa')](),controller[_0x7721('0xb')]);router[_0x7721('0xc')]('/',auth[_0x7721('0xa')](),controller[_0x7721('0xd')]);router[_0x7721('0xe')](_0x7721('0x9'),auth[_0x7721('0xa')](),controller[_0x7721('0xf')]);router[_0x7721('0x10')](_0x7721('0x9'),auth['isAuthenticated'](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file +var _0x5075=['show','create','put','update','delete','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','isAuthenticated'];(function(_0x2e2f0a,_0x5f434d){var _0x4fb272=function(_0x476ca0){while(--_0x476ca0){_0x2e2f0a['push'](_0x2e2f0a['shift']());}};_0x4fb272(++_0x5f434d);}(_0x5075,0x73));var _0x5507=function(_0x463a6e,_0x1b47b5){_0x463a6e=_0x463a6e-0x0;var _0x51d8c6=_0x5075[_0x463a6e];return _0x51d8c6;};'use strict';var multer=require(_0x5507('0x0'));var util=require(_0x5507('0x1'));var path=require(_0x5507('0x2'));var timeout=require(_0x5507('0x3'));var express=require(_0x5507('0x4'));var router=express[_0x5507('0x5')]();var fs_extra=require(_0x5507('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5507('0x7'));var config=require(_0x5507('0x8'));var controller=require(_0x5507('0x9'));router['get']('/:id',auth[_0x5507('0xa')](),controller[_0x5507('0xb')]);router['post']('/',auth[_0x5507('0xa')](),controller[_0x5507('0xc')]);router[_0x5507('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x5507('0xe')]);router[_0x5507('0xf')](_0x5507('0x10'),auth[_0x5507('0xa')](),controller['destroy']);module[_0x5507('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 e92f0d7..66c3eb9 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 _0x541e=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x236029,_0x5d4c17){var _0x350df5=function(_0x551862){while(--_0x551862){_0x236029['push'](_0x236029['shift']());}};_0x350df5(++_0x5d4c17);}(_0x541e,0xa7));var _0xe541=function(_0x5ece36,_0x252932){_0x5ece36=_0x5ece36-0x0;var _0x2a62a6=_0x541e[_0x5ece36];return _0x2a62a6;};'use strict';var Sequelize=require(_0xe541('0x0'));module[_0xe541('0x1')]={'name':{'type':Sequelize[_0xe541('0x2')],'unique':_0xe541('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe541('0x2')]},'timeout':{'type':Sequelize[_0xe541('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe541('0x5')](_0xe541('0x6'),_0xe541('0x7'),_0xe541('0x8'))}}; \ No newline at end of file +var _0xb98b=['roundrobin','sequelize','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x7973e,_0x2cc195){var _0x3f4e18=function(_0x57c668){while(--_0x57c668){_0x7973e['push'](_0x7973e['shift']());}};_0x3f4e18(++_0x2cc195);}(_0xb98b,0x191));var _0xbb98=function(_0x2e2754,_0x16ff1e){_0x2e2754=_0x2e2754-0x0;var _0x11a1dc=_0xb98b[_0x2e2754];return _0x11a1dc;};'use strict';var Sequelize=require(_0xbb98('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb98('0x1')],'unique':_0xbb98('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xbb98('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbb98('0x4')](_0xbb98('0x5'),_0xbb98('0x6'),_0xbb98('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 716d792..9a9a655 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 _0x2f53=['ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','get','ChatQueues','UserProfileResource','stack','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','name','options','includeAll','include','findAll','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','UserChatQueue','ChatQueueId','User','findAndCountAll','agent','chatPause','createdAt','rows','%s/%s','SIP','getTeams','findOne','ids','interface','flatMap','Agents','sequelize','transaction','addTeams','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','toString','QueryTypes','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','spread','isArray','userChatQueue:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','client','http','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x3e7d1c,_0x4d2e60){var _0x406e14=function(_0x5c77eb){while(--_0x5c77eb){_0x3e7d1c['push'](_0x3e7d1c['shift']());}};_0x406e14(++_0x4d2e60);}(_0x2f53,0x196));var _0x32f5=function(_0x4ed263,_0x44aa6c){_0x4ed263=_0x4ed263-0x0;var _0x5e25c7=_0x2f53[_0x4ed263];return _0x5e25c7;};'use strict';var emlformat=require(_0x32f5('0x0'));var rimraf=require(_0x32f5('0x1'));var zipdir=require(_0x32f5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x32f5('0x3'));var moment=require(_0x32f5('0x4'));var BPromise=require(_0x32f5('0x5'));var Mustache=require(_0x32f5('0x6'));var util=require(_0x32f5('0x7'));var path=require('path');var sox=require(_0x32f5('0x8'));var csv=require(_0x32f5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x32f5('0xa'));var _=require(_0x32f5('0xb'));var squel=require('squel');var crypto=require(_0x32f5('0xc'));var jsforce=require(_0x32f5('0xd'));var deskjs=require(_0x32f5('0xe'));var toCsv=require(_0x32f5('0x9'));var querystring=require(_0x32f5('0xf'));var Papa=require(_0x32f5('0x10'));var Redis=require(_0x32f5('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x32f5('0x12'));var utils=require(_0x32f5('0x13'));var config=require(_0x32f5('0x14'));var licenseUtil=require(_0x32f5('0x15'));var db=require(_0x32f5('0x16'))['db'];config[_0x32f5('0x17')]=_[_0x32f5('0x18')](config['redis'],{'host':_0x32f5('0x19'),'port':0x18eb});var socket=require(_0x32f5('0x1a'))(new Redis(config['redis']));require(_0x32f5('0x1b'))[_0x32f5('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x32f5('0x1d')][_0x32f5('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x36f5fc,_0x2480dc,_0x1fd6e4,_0x766f49){return new BPromise(function(_0x4d7a67,_0x5a7bbd){var _0x135dc0=_0x766f49||client;return _0x135dc0['request'](_0x36f5fc,_0x1fd6e4)[_0x32f5('0x1f')](function(_0x862e5d){logger[_0x32f5('0x20')](_0x32f5('0x21'),_0x2480dc,_0x32f5('0x22'));logger['debug'](_0x32f5('0x23'),_0x2480dc,_0x32f5('0x22'),JSON['stringify'](_0x862e5d));if(_0x862e5d[_0x32f5('0x24')]){if(_0x862e5d['error'][_0x32f5('0x25')]===0x1f4){logger[_0x32f5('0x24')](_0x32f5('0x21'),_0x2480dc,_0x862e5d[_0x32f5('0x24')][_0x32f5('0x26')]);return _0x5a7bbd(_0x862e5d[_0x32f5('0x24')][_0x32f5('0x26')]);}logger[_0x32f5('0x24')]('ChatQueue,\x20%s,\x20%s',_0x2480dc,_0x862e5d[_0x32f5('0x24')][_0x32f5('0x26')]);return _0x4d7a67(_0x862e5d[_0x32f5('0x24')][_0x32f5('0x26')]);}else{logger[_0x32f5('0x20')](_0x32f5('0x21'),_0x2480dc,_0x32f5('0x22'));_0x4d7a67(_0x862e5d[_0x32f5('0x27')][_0x32f5('0x26')]);}})[_0x32f5('0x28')](function(_0x5c1395){logger[_0x32f5('0x24')](_0x32f5('0x21'),_0x2480dc,_0x5c1395);_0x5a7bbd(_0x5c1395);});});}function respondWithStatusCode(_0x39530e,_0x2ec5c4){_0x2ec5c4=_0x2ec5c4||0xcc;return function(_0x38d3b5){if(_0x38d3b5){return _0x39530e[_0x32f5('0x29')](_0x2ec5c4);}return _0x39530e[_0x32f5('0x2a')](_0x2ec5c4)['end']();};}function respondWithResult(_0x47be82,_0x2f75ff){_0x2f75ff=_0x2f75ff||0xc8;return function(_0x52b969){if(_0x52b969){return _0x47be82['status'](_0x2f75ff)[_0x32f5('0x2b')](_0x52b969);}};}function respondWithFilteredResult(_0x3b70a0,_0x3dee96){return function(_0x523e49){if(_0x523e49){var _0x23c840=typeof _0x3dee96[_0x32f5('0x2c')]===_0x32f5('0x2d')&&typeof _0x3dee96[_0x32f5('0x2e')]===_0x32f5('0x2d');var _0x5c0d0f=_0x523e49[_0x32f5('0x2f')];var _0xe74d39=_0x23c840?0x0:_0x3dee96[_0x32f5('0x2c')];var _0x2c571d=_0x23c840?_0x523e49['count']:_0x3dee96['offset']+_0x3dee96[_0x32f5('0x2e')];var _0x4306f1;if(_0x2c571d>=_0x5c0d0f){_0x2c571d=_0x5c0d0f;_0x4306f1=0xc8;}else{_0x4306f1=0xce;}_0x3b70a0['status'](_0x4306f1);return _0x3b70a0[_0x32f5('0x30')](_0x32f5('0x31'),_0xe74d39+'-'+_0x2c571d+'/'+_0x5c0d0f)[_0x32f5('0x2b')](_0x523e49);}return null;};}function patchUpdates(_0x2ecc68){return function(_0x4bf277){try{jsonpatch[_0x32f5('0x32')](_0x4bf277,_0x2ecc68,!![]);}catch(_0x575395){return BPromise[_0x32f5('0x33')](_0x575395);}return _0x4bf277[_0x32f5('0x34')]();};}function saveUpdates(_0x2ec38e,_0x59d162){return function(_0x1a9b11){if(_0x1a9b11){return _0x1a9b11['update'](_0x2ec38e)['then'](function(_0x2bdb4b){return _0x2bdb4b;});}return null;};}function removeEntity(_0x1a105e,_0x21d7dc){return function(_0x1c40f8){if(_0x1c40f8){return _0x1c40f8[_0x32f5('0x35')]()[_0x32f5('0x1f')](function(){var _0x37eeda=_0x1c40f8[_0x32f5('0x36')]({'plain':!![]});var _0x536862=_0x32f5('0x37');return db[_0x32f5('0x38')]['destroy']({'where':{'type':_0x536862,'resourceId':_0x37eeda['id']}})[_0x32f5('0x1f')](function(){return _0x1c40f8;});})[_0x32f5('0x1f')](function(){_0x1a105e[_0x32f5('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x374585,_0x3330b1){return function(_0x47143b){if(!_0x47143b){_0x374585['sendStatus'](0x194);}return _0x47143b;};}function handleError(_0x4f3b3b,_0x2f6617){_0x2f6617=_0x2f6617||0x1f4;return function(_0x3a546d){logger[_0x32f5('0x24')](_0x3a546d[_0x32f5('0x39')]);if(_0x3a546d['name']){delete _0x3a546d['name'];}_0x4f3b3b[_0x32f5('0x2a')](_0x2f6617)[_0x32f5('0x3a')](_0x3a546d);};}exports[_0x32f5('0x3b')]=function(_0x2d3814,_0x52ac4a){var _0x1ec7bf={},_0x1b6f91={},_0x21d239={'count':0x0,'rows':[]};var _0x4f7259=_[_0x32f5('0x3c')](db[_0x32f5('0x3d')][_0x32f5('0x3e')],function(_0xae9ec1){return{'name':_0xae9ec1[_0x32f5('0x3f')],'type':_0xae9ec1[_0x32f5('0x40')][_0x32f5('0x41')]};});_0x1b6f91[_0x32f5('0x42')]=_[_0x32f5('0x3c')](_0x4f7259,'name');_0x1b6f91[_0x32f5('0x43')]=_[_0x32f5('0x44')](_0x2d3814['query']);_0x1b6f91[_0x32f5('0x45')]=_[_0x32f5('0x46')](_0x1b6f91[_0x32f5('0x42')],_0x1b6f91['query']);_0x1ec7bf[_0x32f5('0x47')]=_[_0x32f5('0x46')](_0x1b6f91[_0x32f5('0x42')],qs['fields'](_0x2d3814[_0x32f5('0x43')][_0x32f5('0x48')]));_0x1ec7bf[_0x32f5('0x47')]=_0x1ec7bf[_0x32f5('0x47')]['length']?_0x1ec7bf['attributes']:_0x1b6f91[_0x32f5('0x42')];if(!_0x2d3814['query'][_0x32f5('0x49')](_0x32f5('0x4a'))){_0x1ec7bf[_0x32f5('0x2e')]=qs['limit'](_0x2d3814['query'][_0x32f5('0x2e')]);_0x1ec7bf[_0x32f5('0x2c')]=qs[_0x32f5('0x2c')](_0x2d3814['query'][_0x32f5('0x2c')]);}_0x1ec7bf[_0x32f5('0x4b')]=qs[_0x32f5('0x4c')](_0x2d3814[_0x32f5('0x43')]['sort']);_0x1ec7bf['where']=qs[_0x32f5('0x45')](_[_0x32f5('0x4d')](_0x2d3814['query'],_0x1b6f91[_0x32f5('0x45')]),_0x4f7259);if(_0x2d3814[_0x32f5('0x43')][_0x32f5('0x4e')]){_0x1ec7bf[_0x32f5('0x4f')]=_[_0x32f5('0x50')](_0x1ec7bf['where'],{'$or':_[_0x32f5('0x3c')](_0x4f7259,function(_0x4fd6bb){if(_0x4fd6bb[_0x32f5('0x40')]!==_0x32f5('0x51')){var _0x503c5e={};_0x503c5e[_0x4fd6bb[_0x32f5('0x52')]]={'$like':'%'+_0x2d3814[_0x32f5('0x43')][_0x32f5('0x4e')]+'%'};return _0x503c5e;}})});}_0x1ec7bf=_[_0x32f5('0x50')]({},_0x1ec7bf,_0x2d3814[_0x32f5('0x53')]);var _0x23a6eb={'where':_0x1ec7bf['where']};return db[_0x32f5('0x3d')][_0x32f5('0x2f')](_0x23a6eb)['then'](function(_0xb3eca0){_0x21d239['count']=_0xb3eca0;if(_0x2d3814[_0x32f5('0x43')][_0x32f5('0x54')]){_0x1ec7bf[_0x32f5('0x55')]=[{'all':!![]}];}return db[_0x32f5('0x3d')][_0x32f5('0x56')](_0x1ec7bf);})['then'](function(_0x3be4d1){_0x21d239['rows']=_0x3be4d1;return _0x21d239;})['then'](respondWithFilteredResult(_0x52ac4a,_0x1ec7bf))[_0x32f5('0x28')](handleError(_0x52ac4a,null));};exports[_0x32f5('0x57')]=function(_0x45c0d0,_0x1c1975){var _0x5f1182={'raw':!![],'where':{'id':_0x45c0d0[_0x32f5('0x58')]['id']}},_0x37cb6f={};_0x37cb6f[_0x32f5('0x42')]=_[_0x32f5('0x44')](db['ChatQueue']['rawAttributes']);_0x37cb6f[_0x32f5('0x43')]=_['keys'](_0x45c0d0[_0x32f5('0x43')]);_0x37cb6f['filters']=_[_0x32f5('0x46')](_0x37cb6f['model'],_0x37cb6f[_0x32f5('0x43')]);_0x5f1182[_0x32f5('0x47')]=_[_0x32f5('0x46')](_0x37cb6f[_0x32f5('0x42')],qs[_0x32f5('0x48')](_0x45c0d0['query']['fields']));_0x5f1182[_0x32f5('0x47')]=_0x5f1182[_0x32f5('0x47')][_0x32f5('0x59')]?_0x5f1182['attributes']:_0x37cb6f['model'];if(_0x45c0d0[_0x32f5('0x43')]['includeAll']){_0x5f1182[_0x32f5('0x55')]=[{'all':!![]}];}_0x5f1182=_[_0x32f5('0x50')]({},_0x5f1182,_0x45c0d0['options']);return db['ChatQueue'][_0x32f5('0x5a')](_0x5f1182)['then'](handleEntityNotFound(_0x1c1975,null))[_0x32f5('0x1f')](respondWithResult(_0x1c1975,null))['catch'](handleError(_0x1c1975,null));};exports['create']=function(_0x5c208d,_0x464412){return db[_0x32f5('0x3d')][_0x32f5('0x5b')](_0x5c208d[_0x32f5('0x5c')],{})['then'](function(_0x2c86db){var _0x4c8c3f=_0x5c208d[_0x32f5('0x5d')]['get']({'plain':!![]});if(!_0x4c8c3f)throw new Error(_0x32f5('0x5e'));if(_0x4c8c3f['role']===_0x32f5('0x5d')){var _0x4b1368=_0x2c86db[_0x32f5('0x36')]({'plain':!![]});var _0x1e7a8d=_0x32f5('0x37');return db[_0x32f5('0x5f')][_0x32f5('0x5a')]({'where':{'name':_0x1e7a8d,'userProfileId':_0x4c8c3f[_0x32f5('0x60')]},'raw':!![]})[_0x32f5('0x1f')](function(_0x1eeb4f){if(_0x1eeb4f&&_0x1eeb4f['autoAssociation']===0x0){return db[_0x32f5('0x38')][_0x32f5('0x5b')]({'name':_0x4b1368[_0x32f5('0x52')],'resourceId':_0x4b1368['id'],'type':_0x1eeb4f['name'],'sectionId':_0x1eeb4f['id']},{})[_0x32f5('0x1f')](function(){return _0x2c86db;});}else{return _0x2c86db;}})[_0x32f5('0x28')](function(_0x566392){logger['error'](_0x32f5('0x61'),_0x566392);throw _0x566392;});}return _0x2c86db;})['then'](respondWithResult(_0x464412,0xc9))[_0x32f5('0x28')](handleError(_0x464412,null));};exports[_0x32f5('0x62')]=function(_0x3a3e24,_0x37bcee){if(_0x3a3e24[_0x32f5('0x5c')]['id']){delete _0x3a3e24[_0x32f5('0x5c')]['id'];}return db[_0x32f5('0x3d')][_0x32f5('0x5a')]({'where':{'id':_0x3a3e24[_0x32f5('0x58')]['id']}})[_0x32f5('0x1f')](handleEntityNotFound(_0x37bcee,null))[_0x32f5('0x1f')](saveUpdates(_0x3a3e24[_0x32f5('0x5c')],null))[_0x32f5('0x1f')](respondWithResult(_0x37bcee,null))[_0x32f5('0x28')](handleError(_0x37bcee,null));};exports[_0x32f5('0x35')]=function(_0x5ec5de,_0x275d25){return db[_0x32f5('0x3d')]['find']({'where':{'id':_0x5ec5de['params']['id']}})[_0x32f5('0x1f')](handleEntityNotFound(_0x275d25,null))[_0x32f5('0x1f')](removeEntity(_0x275d25,null))[_0x32f5('0x28')](handleError(_0x275d25,null));};exports['describe']=function(_0x54b676,_0x1dee49){return db['ChatQueue'][_0x32f5('0x63')]()['then'](respondWithResult(_0x1dee49,null))[_0x32f5('0x28')](handleError(_0x1dee49,null));};exports[_0x32f5('0x64')]=function(_0x4360b4,_0xb49118,_0x1a5d67){var _0x397553={'raw':!![],'where':{}},_0x15b1b4={},_0x5070d7;return db[_0x32f5('0x3d')]['findOne']({'where':{'id':_0x4360b4['params']['id']}})['then'](handleEntityNotFound(_0xb49118,null))['then'](function(_0xd7b1e9){if(_0xd7b1e9){_0x5070d7=_0xd7b1e9[_0x32f5('0x36')]({'plain':!![]});_0x15b1b4[_0x32f5('0x42')]=_[_0x32f5('0x44')](db[_0x32f5('0x65')][_0x32f5('0x3e')]);_0x15b1b4[_0x32f5('0x43')]=_[_0x32f5('0x44')](_0x4360b4[_0x32f5('0x43')]);_0x15b1b4[_0x32f5('0x45')]=_[_0x32f5('0x46')](_0x15b1b4[_0x32f5('0x42')],_0x15b1b4['query']);_0x397553['attributes']=_['intersection'](_0x15b1b4[_0x32f5('0x42')],qs[_0x32f5('0x48')](_0x4360b4[_0x32f5('0x43')][_0x32f5('0x48')]));_0x397553[_0x32f5('0x47')]=_0x397553[_0x32f5('0x47')][_0x32f5('0x59')]?_0x397553[_0x32f5('0x47')]:_0x15b1b4[_0x32f5('0x42')];if(!_0x4360b4[_0x32f5('0x43')][_0x32f5('0x49')](_0x32f5('0x4a'))){_0x397553[_0x32f5('0x2e')]=qs['limit'](_0x4360b4[_0x32f5('0x43')][_0x32f5('0x2e')]);_0x397553[_0x32f5('0x2c')]=qs['offset'](_0x4360b4[_0x32f5('0x43')][_0x32f5('0x2c')]);}_0x397553[_0x32f5('0x4b')]=qs[_0x32f5('0x4c')](_0x4360b4['query'][_0x32f5('0x4c')]);_0x397553[_0x32f5('0x4f')]=qs['filters'](_['pick'](_0x4360b4['query'],_0x15b1b4[_0x32f5('0x45')]));_0x397553[_0x32f5('0x4f')][_0x32f5('0x66')]=_0xd7b1e9['id'];if(_0x4360b4[_0x32f5('0x43')][_0x32f5('0x4e')]){_0x397553['where']=_[_0x32f5('0x50')](_0x397553[_0x32f5('0x4f')],{'$or':_[_0x32f5('0x3c')](_0x397553['attributes'],function(_0x4f87df){var _0x205cb9={};_0x205cb9[_0x4f87df]={'$like':'%'+_0x4360b4[_0x32f5('0x43')][_0x32f5('0x4e')]+'%'};return _0x205cb9;})});}_0x397553=_['merge']({},_0x397553,_0x4360b4['options']);return db['UserChatQueue'][_0x32f5('0x56')](_0x397553);}})['then'](function(_0x298d38){if(_0x298d38){return db[_0x32f5('0x67')][_0x32f5('0x68')]({'where':{'id':_['map'](_0x298d38,'UserId'),'role':_0x32f5('0x69')},'attributes':['id',_0x32f5('0x52'),_0x32f5('0x6a'),'updatedAt',_0x32f5('0x6b')]});}})[_0x32f5('0x1f')](function(_0x36e577){if(_0x36e577){return{'count':_0x36e577[_0x32f5('0x2f')],'rows':_['map'](_0x36e577[_0x32f5('0x6c')],function(_0x1e11d3){return{'membername':_0x1e11d3[_0x32f5('0x52')],'UserId':_0x1e11d3['id'],'queue_name':_0x5070d7['name'],'ChatQueueId':_0x5070d7['id'],'interface':util['format'](_0x32f5('0x6d'),_0x32f5('0x6e'),_0x1e11d3[_0x32f5('0x52')]),'penalty':0x0,'paused':_0x1e11d3[_0x32f5('0x6a')],'createdAt':_0x1e11d3[_0x32f5('0x6b')],'updatedAt':_0x1e11d3['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xb49118,_0x397553))[_0x32f5('0x28')](handleError(_0xb49118,null));};exports[_0x32f5('0x6f')]=function(_0x59fb41,_0x44394c,_0x5d1b96){var _0x1eeca0={};var _0x49ea69={};var _0x314a82;var _0xce021c;return db[_0x32f5('0x3d')][_0x32f5('0x70')]({'where':{'id':_0x59fb41[_0x32f5('0x58')]['id']}})[_0x32f5('0x1f')](handleEntityNotFound(_0x44394c,null))[_0x32f5('0x1f')](function(_0x28342f){if(_0x28342f){_0x314a82=_0x28342f;_0x49ea69['model']=_[_0x32f5('0x44')](db['Team'][_0x32f5('0x3e')]);_0x49ea69['query']=_[_0x32f5('0x44')](_0x59fb41[_0x32f5('0x43')]);_0x49ea69[_0x32f5('0x45')]=_[_0x32f5('0x46')](_0x49ea69[_0x32f5('0x42')],_0x49ea69['query']);_0x1eeca0['attributes']=_[_0x32f5('0x46')](_0x49ea69['model'],qs[_0x32f5('0x48')](_0x59fb41[_0x32f5('0x43')][_0x32f5('0x48')]));_0x1eeca0[_0x32f5('0x47')]=_0x1eeca0['attributes'][_0x32f5('0x59')]?_0x1eeca0[_0x32f5('0x47')]:_0x49ea69[_0x32f5('0x42')];_0x1eeca0[_0x32f5('0x4b')]=qs[_0x32f5('0x4c')](_0x59fb41[_0x32f5('0x43')][_0x32f5('0x4c')]);_0x1eeca0[_0x32f5('0x4f')]=qs[_0x32f5('0x45')](_[_0x32f5('0x4d')](_0x59fb41[_0x32f5('0x43')],_0x49ea69['filters']));if(_0x59fb41[_0x32f5('0x43')][_0x32f5('0x4e')]){_0x1eeca0['where']=_[_0x32f5('0x50')](_0x1eeca0[_0x32f5('0x4f')],{'$or':_[_0x32f5('0x3c')](_0x1eeca0[_0x32f5('0x47')],function(_0x59a076){var _0x53e2e3={};_0x53e2e3[_0x59a076]={'$like':'%'+_0x59fb41[_0x32f5('0x43')][_0x32f5('0x4e')]+'%'};return _0x53e2e3;})});}_0x1eeca0=_[_0x32f5('0x50')]({},_0x1eeca0,_0x59fb41[_0x32f5('0x53')]);return _0x314a82['getTeams'](_0x1eeca0);}})[_0x32f5('0x1f')](function(_0x425297){if(_0x425297){_0xce021c=_0x425297[_0x32f5('0x59')];if(!_0x59fb41[_0x32f5('0x43')][_0x32f5('0x49')](_0x32f5('0x4a'))){_0x1eeca0[_0x32f5('0x2e')]=qs[_0x32f5('0x2e')](_0x59fb41['query'][_0x32f5('0x2e')]);_0x1eeca0[_0x32f5('0x2c')]=qs[_0x32f5('0x2c')](_0x59fb41[_0x32f5('0x43')]['offset']);}return _0x314a82['getTeams'](_0x1eeca0);}})[_0x32f5('0x1f')](function(_0x22a85b){if(_0x22a85b){return _0x22a85b?{'count':_0xce021c,'rows':_0x22a85b}:null;}})[_0x32f5('0x1f')](respondWithResult(_0x44394c,null))[_0x32f5('0x28')](handleError(_0x44394c,null));};exports['addTeams']=function(_0x110af7,_0x141988,_0x34c0a7){var _0x3d3a02=_0x110af7['body'][_0x32f5('0x71')];return db['Team'][_0x32f5('0x56')]({'where':{'id':_0x3d3a02},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x32f5('0x52'),'online','voicePause',_0x32f5('0x72')],'raw':!![]}]})[_0x32f5('0x1f')](function(_0x29593d){if(_0x29593d){var _0x3e6c7a=_[_0x32f5('0x73')](_0x29593d,function(_0x134887){var _0x29c783=_0x134887[_0x32f5('0x36')]({'plain':!![]});return _0x29c783[_0x32f5('0x74')];});return db[_0x32f5('0x3d')]['find']({'where':{'id':_0x110af7[_0x32f5('0x58')]['id']}})[_0x32f5('0x1f')](function(_0x4e6791){return db[_0x32f5('0x75')][_0x32f5('0x76')](function(_0x4fcbcf){return _0x4e6791[_0x32f5('0x77')](_0x3d3a02,{'transaction':_0x4fcbcf})['then'](function(){return BPromise['each'](_0x3e6c7a,function(_0x3b3a44){return db[_0x32f5('0x65')]['findOrCreate']({'where':{'UserId':_0x3b3a44['id'],'ChatQueueId':_0x110af7[_0x32f5('0x58')]['id']},'transaction':_0x4fcbcf});});})['then'](function(){_0x3e6c7a[_0x32f5('0x78')](function(_0x553cfb){socket[_0x32f5('0x79')](_0x32f5('0x7a'),{'UserId':_0x553cfb['id'],'ChatQueueId':_0x4e6791['id']});});});});});}})[_0x32f5('0x1f')](respondWithStatusCode(_0x141988,null))[_0x32f5('0x28')](handleError(_0x141988,null));};exports[_0x32f5('0x7b')]=function(_0x162f3f,_0x32099a,_0x15670c){return db['Team'][_0x32f5('0x56')]({'where':{'id':_0x162f3f['query'][_0x32f5('0x71')]},'attributes':['id'],'include':[{'model':db[_0x32f5('0x67')],'as':_0x32f5('0x74'),'attributes':['id'],'raw':!![]}]})[_0x32f5('0x1f')](handleEntityNotFound(_0x32099a,null))['then'](function(_0x2bd308){var _0x543cb1=_[_0x32f5('0x3c')](_0x2bd308,'id');var _0xa09f6a=[];var _0x5497ec=[];var _0x5ae466=squel[_0x32f5('0x7c')]();_0x5ae466[_0x32f5('0x7d')](_0x32f5('0x7e'))[_0x32f5('0x7f')]('team_has_chat_queues','tq')[_0x32f5('0x80')](_0x32f5('0x81'),'ut',_0x32f5('0x82'))[_0x32f5('0x4f')]('ChatQueueId\x20=\x20?',_0x162f3f[_0x32f5('0x58')]['id']);for(var _0x489cbd=0x0;_0x489cbd<_0x2bd308[_0x32f5('0x59')];_0x489cbd+=0x1){let _0x3d5e32=_0x2bd308[_0x489cbd];for(var _0x45e3de=0x0;_0x45e3de<_0x3d5e32['Agents'][_0x32f5('0x59')];_0x45e3de+=0x1){let _0x1ab62b=_0x3d5e32[_0x32f5('0x74')][_0x45e3de];var _0x5e3a66=_0x5ae466[_0x32f5('0x83')]();_0x5e3a66[_0x32f5('0x4f')]('ut.UserId\x20=\x20?',_0x1ab62b['id']);_0x5497ec['push'](db['sequelize'][_0x32f5('0x43')](_0x5e3a66[_0x32f5('0x84')](),{'type':db[_0x32f5('0x75')][_0x32f5('0x85')]['SELECT']})[_0x32f5('0x1f')](function(_0x7bdd91){if(_0x7bdd91['length']===0x1){return _0x1ab62b['id'];}else{var _0x5d255f=_['every'](_[_0x32f5('0x3c')](_0x7bdd91,_0x32f5('0x86')),function(_0x3ac87d){return _[_0x32f5('0x87')](_0x543cb1,_0x3ac87d);});if(_0x5d255f){return _0x1ab62b['id'];}}}));}}return BPromise[_0x32f5('0x88')](_0x5497ec)['then'](function(_0x5b652e){_0xa09f6a=_(_0xa09f6a)[_0x32f5('0x89')](_0x5b652e)[_0x32f5('0x8a')]()[_0x32f5('0x8b')]();return db[_0x32f5('0x3d')]['find']({'where':{'id':_0x162f3f[_0x32f5('0x58')]['id']}})[_0x32f5('0x1f')](function(_0x117e31){return db[_0x32f5('0x75')][_0x32f5('0x76')](function(_0x23f543){return _0x117e31[_0x32f5('0x7b')](_0x162f3f['query'][_0x32f5('0x71')],{'transaction':_0x23f543})[_0x32f5('0x1f')](function(){if(!_[_0x32f5('0x8c')](_0xa09f6a)){return _0x117e31[_0x32f5('0x8d')](_0xa09f6a,{'transaction':_0x23f543});}})['then'](function(){_0xa09f6a[_0x32f5('0x78')](function(_0x43a2a6){socket[_0x32f5('0x79')]('userChatQueue:remove',{'UserId':_0x43a2a6,'ChatQueueId':_0x117e31['id']});});});});});});})[_0x32f5('0x1f')](respondWithStatusCode(_0x32099a,null))[_0x32f5('0x28')](handleError(_0x32099a,null));};exports[_0x32f5('0x8e')]=function(_0x3adffc,_0x4663d9,_0x220806){return db[_0x32f5('0x3d')][_0x32f5('0x5a')]({'where':{'id':_0x3adffc[_0x32f5('0x58')]['id']}})[_0x32f5('0x1f')](handleEntityNotFound(_0x4663d9,null))[_0x32f5('0x1f')](function(_0x349d3c){if(_0x349d3c){return _0x349d3c['addAgents'](_0x3adffc['body'][_0x32f5('0x71')],_['omit'](_0x3adffc[_0x32f5('0x5c')],[_0x32f5('0x71'),'id'])||{})[_0x32f5('0x8f')](function(_0x30dea4){for(var _0x2fffbf=0x0;_0x2fffbf<_0x3adffc[_0x32f5('0x5c')]['ids'][_0x32f5('0x59')];_0x2fffbf+=0x1){socket[_0x32f5('0x79')]('userChatQueue:save',{'UserId':Number(_0x3adffc['body'][_0x32f5('0x71')][_0x2fffbf]),'ChatQueueId':Number(_0x3adffc['params']['id'])});}return _0x30dea4;});}})[_0x32f5('0x1f')](respondWithResult(_0x4663d9,null))[_0x32f5('0x28')](handleError(_0x4663d9,null));};exports[_0x32f5('0x8d')]=function(_0x11a8e8,_0x465fc0,_0x57ed62){return db[_0x32f5('0x3d')][_0x32f5('0x5a')]({'where':{'id':_0x11a8e8['params']['id']}})[_0x32f5('0x1f')](handleEntityNotFound(_0x465fc0,null))[_0x32f5('0x1f')](function(_0x341468){if(_0x341468){return _0x341468['removeAgents'](_0x11a8e8[_0x32f5('0x43')]['ids'])[_0x32f5('0x1f')](function(){if(_[_0x32f5('0x90')](_0x11a8e8[_0x32f5('0x43')][_0x32f5('0x71')])){for(var _0x58a9d8=0x0;_0x58a9d8<_0x11a8e8[_0x32f5('0x43')][_0x32f5('0x71')]['length'];_0x58a9d8+=0x1){socket[_0x32f5('0x79')](_0x32f5('0x91'),{'UserId':Number(_0x11a8e8[_0x32f5('0x43')][_0x32f5('0x71')][_0x58a9d8]),'ChatQueueId':Number(_0x11a8e8[_0x32f5('0x58')]['id'])});}}else{socket[_0x32f5('0x79')](_0x32f5('0x91'),{'UserId':Number(_0x11a8e8[_0x32f5('0x43')][_0x32f5('0x71')]),'ChatQueueId':Number(_0x11a8e8[_0x32f5('0x58')]['id'])});}});}})[_0x32f5('0x1f')](respondWithStatusCode(_0x465fc0,null))['catch'](handleError(_0x465fc0,null));};exports[_0x32f5('0x92')]=function(_0xa3c7a9,_0x447e6e,_0x3f2c60){var _0x37abb5={};var _0x17aafd={};var _0xc3e512;var _0x1ff734;return db[_0x32f5('0x3d')][_0x32f5('0x70')]({'where':{'id':_0xa3c7a9[_0x32f5('0x58')]['id']}})['then'](handleEntityNotFound(_0x447e6e,null))[_0x32f5('0x1f')](function(_0x5ddc1a){if(_0x5ddc1a){_0xc3e512=_0x5ddc1a;_0x17aafd['model']=_[_0x32f5('0x44')](db[_0x32f5('0x67')][_0x32f5('0x3e')]);_0x17aafd[_0x32f5('0x43')]=_[_0x32f5('0x44')](_0xa3c7a9[_0x32f5('0x43')]);_0x17aafd['filters']=_[_0x32f5('0x46')](_0x17aafd[_0x32f5('0x42')],_0x17aafd[_0x32f5('0x43')]);_0x37abb5[_0x32f5('0x47')]=_[_0x32f5('0x46')](_0x17aafd[_0x32f5('0x42')],qs[_0x32f5('0x48')](_0xa3c7a9[_0x32f5('0x43')]['fields']));_0x37abb5['attributes']=_0x37abb5[_0x32f5('0x47')][_0x32f5('0x59')]?_0x37abb5['attributes']:_0x17aafd['model'];_0x37abb5[_0x32f5('0x4b')]=qs['sort'](_0xa3c7a9[_0x32f5('0x43')][_0x32f5('0x4c')]);_0x37abb5[_0x32f5('0x4f')]=qs[_0x32f5('0x45')](_['pick'](_0xa3c7a9['query'],_0x17aafd[_0x32f5('0x45')]));if(_0xa3c7a9['query'][_0x32f5('0x4e')]){_0x37abb5[_0x32f5('0x4f')]=_['merge'](_0x37abb5[_0x32f5('0x4f')],{'$or':_['map'](_0x37abb5[_0x32f5('0x47')],function(_0x58974e){var _0x2d60c2={};_0x2d60c2[_0x58974e]={'$like':'%'+_0xa3c7a9[_0x32f5('0x43')][_0x32f5('0x4e')]+'%'};return _0x2d60c2;})});}_0x37abb5=_[_0x32f5('0x50')]({},_0x37abb5,_0xa3c7a9['options']);return _0xc3e512[_0x32f5('0x92')](_0x37abb5);}})[_0x32f5('0x1f')](function(_0x34797a){if(_0x34797a){_0x1ff734=_0x34797a['length'];if(!_0xa3c7a9[_0x32f5('0x43')]['hasOwnProperty'](_0x32f5('0x4a'))){_0x37abb5['limit']=qs['limit'](_0xa3c7a9['query'][_0x32f5('0x2e')]);_0x37abb5['offset']=qs[_0x32f5('0x2c')](_0xa3c7a9['query'][_0x32f5('0x2c')]);}return _0xc3e512['getAgents'](_0x37abb5);}})[_0x32f5('0x1f')](function(_0x209ec2){if(_0x209ec2){return _0x209ec2?{'count':_0x1ff734,'rows':_0x209ec2}:null;}})[_0x32f5('0x1f')](respondWithResult(_0x447e6e,null))[_0x32f5('0x28')](handleError(_0x447e6e,null));}; \ No newline at end of file +var _0x0202=['fs-extra','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','client','http','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','catch','end','status','json','offset','limit','undefined','count','set','save','update','destroy','get','ChatQueues','UserProfileResource','stack','name','index','map','ChatQueue','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserChatQueue','order','ChatQueueId','User','findAndCountAll','UserId','updatedAt','createdAt','%s/%s','SIP','chatPause','getTeams','findOne','Team','rawAttributes','ids','Agents','interface','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','removeAgents','userChatQueue:remove','addAgents','omit','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0202,0x1a4));var _0x2020=function(_0x1edb27,_0x4b7c40){_0x1edb27=_0x1edb27-0x0;var _0x71550e=_0x0202[_0x1edb27];return _0x71550e;};'use strict';var emlformat=require(_0x2020('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2020('0x1'));var jsonpatch=require(_0x2020('0x2'));var rp=require(_0x2020('0x3'));var moment=require(_0x2020('0x4'));var BPromise=require(_0x2020('0x5'));var Mustache=require(_0x2020('0x6'));var util=require(_0x2020('0x7'));var path=require('path');var sox=require(_0x2020('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2020('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2020('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2020('0xb'));var toCsv=require(_0x2020('0xc'));var querystring=require(_0x2020('0xd'));var Papa=require('papaparse');var Redis=require(_0x2020('0xe'));var authService=require(_0x2020('0xf'));var qs=require(_0x2020('0x10'));var as=require(_0x2020('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2020('0x12'))(_0x2020('0x13'));var utils=require(_0x2020('0x14'));var config=require(_0x2020('0x15'));var licenseUtil=require(_0x2020('0x16'));var db=require(_0x2020('0x17'))['db'];config[_0x2020('0x18')]=_['defaults'](config[_0x2020('0x18')],{'host':_0x2020('0x19'),'port':0x18eb});var socket=require(_0x2020('0x1a'))(new Redis(config[_0x2020('0x18')]));require('./chatQueue.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x2020('0x1b')][_0x2020('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x10743c,_0x11cef6,_0x1f75bf,_0x48c153){return new BPromise(function(_0x5c5737,_0x24b985){var _0x5b1e38=_0x48c153||client;return _0x5b1e38[_0x2020('0x1d')](_0x10743c,_0x1f75bf)[_0x2020('0x1e')](function(_0x4f1f65){logger[_0x2020('0x1f')]('ChatQueue,\x20%s,\x20%s',_0x11cef6,_0x2020('0x20'));logger[_0x2020('0x21')](_0x2020('0x22'),_0x11cef6,'request\x20sent',JSON[_0x2020('0x23')](_0x4f1f65));if(_0x4f1f65[_0x2020('0x24')]){if(_0x4f1f65['error'][_0x2020('0x25')]===0x1f4){logger[_0x2020('0x24')](_0x2020('0x26'),_0x11cef6,_0x4f1f65['error'][_0x2020('0x27')]);return _0x24b985(_0x4f1f65[_0x2020('0x24')][_0x2020('0x27')]);}logger[_0x2020('0x24')](_0x2020('0x26'),_0x11cef6,_0x4f1f65[_0x2020('0x24')][_0x2020('0x27')]);return _0x5c5737(_0x4f1f65[_0x2020('0x24')]['message']);}else{logger[_0x2020('0x1f')](_0x2020('0x26'),_0x11cef6,_0x2020('0x20'));_0x5c5737(_0x4f1f65['result']['message']);}})[_0x2020('0x28')](function(_0x2822cf){logger[_0x2020('0x24')](_0x2020('0x26'),_0x11cef6,_0x2822cf);_0x24b985(_0x2822cf);});});}function respondWithStatusCode(_0x4aa8ca,_0x4662dc){_0x4662dc=_0x4662dc||0xcc;return function(_0x5733f4){if(_0x5733f4){return _0x4aa8ca['sendStatus'](_0x4662dc);}return _0x4aa8ca['status'](_0x4662dc)[_0x2020('0x29')]();};}function respondWithResult(_0x1d2b0b,_0xc9f09c){_0xc9f09c=_0xc9f09c||0xc8;return function(_0x4f9a7b){if(_0x4f9a7b){return _0x1d2b0b[_0x2020('0x2a')](_0xc9f09c)[_0x2020('0x2b')](_0x4f9a7b);}};}function respondWithFilteredResult(_0x3a7715,_0x394e4a){return function(_0xd01c01){if(_0xd01c01){var _0x79be77=typeof _0x394e4a[_0x2020('0x2c')]==='undefined'&&typeof _0x394e4a[_0x2020('0x2d')]===_0x2020('0x2e');var _0x3d3213=_0xd01c01[_0x2020('0x2f')];var _0x5c85d6=_0x79be77?0x0:_0x394e4a[_0x2020('0x2c')];var _0x585278=_0x79be77?_0xd01c01[_0x2020('0x2f')]:_0x394e4a[_0x2020('0x2c')]+_0x394e4a[_0x2020('0x2d')];var _0x19451b;if(_0x585278>=_0x3d3213){_0x585278=_0x3d3213;_0x19451b=0xc8;}else{_0x19451b=0xce;}_0x3a7715[_0x2020('0x2a')](_0x19451b);return _0x3a7715[_0x2020('0x30')]('Content-Range',_0x5c85d6+'-'+_0x585278+'/'+_0x3d3213)[_0x2020('0x2b')](_0xd01c01);}return null;};}function patchUpdates(_0x4f4d9e){return function(_0x55cd12){try{jsonpatch['apply'](_0x55cd12,_0x4f4d9e,!![]);}catch(_0xc463fa){return BPromise['reject'](_0xc463fa);}return _0x55cd12[_0x2020('0x31')]();};}function saveUpdates(_0x33eb3c,_0x41210b){return function(_0x4e97bc){if(_0x4e97bc){return _0x4e97bc[_0x2020('0x32')](_0x33eb3c)[_0x2020('0x1e')](function(_0x2c9c55){return _0x2c9c55;});}return null;};}function removeEntity(_0x4951e1,_0x3ba66a){return function(_0x41d2f9){if(_0x41d2f9){return _0x41d2f9[_0x2020('0x33')]()['then'](function(){var _0x29dc1b=_0x41d2f9[_0x2020('0x34')]({'plain':!![]});var _0x291ac5=_0x2020('0x35');return db[_0x2020('0x36')][_0x2020('0x33')]({'where':{'type':_0x291ac5,'resourceId':_0x29dc1b['id']}})[_0x2020('0x1e')](function(){return _0x41d2f9;});})[_0x2020('0x1e')](function(){_0x4951e1[_0x2020('0x2a')](0xcc)[_0x2020('0x29')]();});}};}function handleEntityNotFound(_0x16baab,_0x409194){return function(_0x306a70){if(!_0x306a70){_0x16baab['sendStatus'](0x194);}return _0x306a70;};}function handleError(_0x3cb1da,_0x3a0b3e){_0x3a0b3e=_0x3a0b3e||0x1f4;return function(_0x336e84){logger['error'](_0x336e84[_0x2020('0x37')]);if(_0x336e84[_0x2020('0x38')]){delete _0x336e84[_0x2020('0x38')];}_0x3cb1da[_0x2020('0x2a')](_0x3a0b3e)['send'](_0x336e84);};}exports[_0x2020('0x39')]=function(_0x12b983,_0x3e5a2a){var _0x5eaefc={},_0x1e53af={},_0x55d497={'count':0x0,'rows':[]};var _0x55c803=_[_0x2020('0x3a')](db[_0x2020('0x3b')]['rawAttributes'],function(_0x588d60){return{'name':_0x588d60['fieldName'],'type':_0x588d60[_0x2020('0x3c')][_0x2020('0x3d')]};});_0x1e53af[_0x2020('0x3e')]=_[_0x2020('0x3a')](_0x55c803,_0x2020('0x38'));_0x1e53af['query']=_[_0x2020('0x3f')](_0x12b983[_0x2020('0x40')]);_0x1e53af[_0x2020('0x41')]=_[_0x2020('0x42')](_0x1e53af['model'],_0x1e53af[_0x2020('0x40')]);_0x5eaefc['attributes']=_['intersection'](_0x1e53af['model'],qs[_0x2020('0x43')](_0x12b983[_0x2020('0x40')][_0x2020('0x43')]));_0x5eaefc[_0x2020('0x44')]=_0x5eaefc[_0x2020('0x44')][_0x2020('0x45')]?_0x5eaefc[_0x2020('0x44')]:_0x1e53af['model'];if(!_0x12b983[_0x2020('0x40')][_0x2020('0x46')](_0x2020('0x47'))){_0x5eaefc['limit']=qs[_0x2020('0x2d')](_0x12b983[_0x2020('0x40')]['limit']);_0x5eaefc[_0x2020('0x2c')]=qs[_0x2020('0x2c')](_0x12b983[_0x2020('0x40')]['offset']);}_0x5eaefc['order']=qs[_0x2020('0x48')](_0x12b983['query'][_0x2020('0x48')]);_0x5eaefc[_0x2020('0x49')]=qs[_0x2020('0x41')](_[_0x2020('0x4a')](_0x12b983[_0x2020('0x40')],_0x1e53af[_0x2020('0x41')]),_0x55c803);if(_0x12b983[_0x2020('0x40')][_0x2020('0x4b')]){_0x5eaefc['where']=_[_0x2020('0x4c')](_0x5eaefc[_0x2020('0x49')],{'$or':_[_0x2020('0x3a')](_0x55c803,function(_0x50c83b){if(_0x50c83b[_0x2020('0x3c')]!=='VIRTUAL'){var _0xfcc1bb={};_0xfcc1bb[_0x50c83b[_0x2020('0x38')]]={'$like':'%'+_0x12b983['query']['filter']+'%'};return _0xfcc1bb;}})});}_0x5eaefc=_['merge']({},_0x5eaefc,_0x12b983[_0x2020('0x4d')]);var _0x228a5a={'where':_0x5eaefc['where']};return db[_0x2020('0x3b')][_0x2020('0x2f')](_0x228a5a)[_0x2020('0x1e')](function(_0x489dda){_0x55d497[_0x2020('0x2f')]=_0x489dda;if(_0x12b983[_0x2020('0x40')][_0x2020('0x4e')]){_0x5eaefc[_0x2020('0x4f')]=[{'all':!![]}];}return db[_0x2020('0x3b')][_0x2020('0x50')](_0x5eaefc);})[_0x2020('0x1e')](function(_0x1c9a38){_0x55d497[_0x2020('0x51')]=_0x1c9a38;return _0x55d497;})[_0x2020('0x1e')](respondWithFilteredResult(_0x3e5a2a,_0x5eaefc))[_0x2020('0x28')](handleError(_0x3e5a2a,null));};exports['show']=function(_0x371685,_0x1ccdb7){var _0xe29960={'raw':!![],'where':{'id':_0x371685[_0x2020('0x52')]['id']}},_0x43195b={};_0x43195b['model']=_[_0x2020('0x3f')](db[_0x2020('0x3b')]['rawAttributes']);_0x43195b['query']=_['keys'](_0x371685[_0x2020('0x40')]);_0x43195b[_0x2020('0x41')]=_[_0x2020('0x42')](_0x43195b[_0x2020('0x3e')],_0x43195b[_0x2020('0x40')]);_0xe29960[_0x2020('0x44')]=_['intersection'](_0x43195b['model'],qs[_0x2020('0x43')](_0x371685[_0x2020('0x40')][_0x2020('0x43')]));_0xe29960[_0x2020('0x44')]=_0xe29960[_0x2020('0x44')]['length']?_0xe29960[_0x2020('0x44')]:_0x43195b[_0x2020('0x3e')];if(_0x371685['query'][_0x2020('0x4e')]){_0xe29960['include']=[{'all':!![]}];}_0xe29960=_['merge']({},_0xe29960,_0x371685[_0x2020('0x4d')]);return db[_0x2020('0x3b')][_0x2020('0x53')](_0xe29960)[_0x2020('0x1e')](handleEntityNotFound(_0x1ccdb7,null))[_0x2020('0x1e')](respondWithResult(_0x1ccdb7,null))['catch'](handleError(_0x1ccdb7,null));};exports[_0x2020('0x54')]=function(_0x5ad4a8,_0x2def15){return db[_0x2020('0x3b')][_0x2020('0x54')](_0x5ad4a8[_0x2020('0x55')],{})[_0x2020('0x1e')](function(_0x3ad062){var _0x5d3815=_0x5ad4a8[_0x2020('0x56')][_0x2020('0x34')]({'plain':!![]});if(!_0x5d3815)throw new Error(_0x2020('0x57'));if(_0x5d3815['role']===_0x2020('0x56')){var _0x50a65d=_0x3ad062[_0x2020('0x34')]({'plain':!![]});var _0x2df4eb='ChatQueues';return db['UserProfileSection']['find']({'where':{'name':_0x2df4eb,'userProfileId':_0x5d3815[_0x2020('0x58')]},'raw':!![]})[_0x2020('0x1e')](function(_0x7e119e){if(_0x7e119e&&_0x7e119e['autoAssociation']===0x0){return db['UserProfileResource'][_0x2020('0x54')]({'name':_0x50a65d['name'],'resourceId':_0x50a65d['id'],'type':_0x7e119e[_0x2020('0x38')],'sectionId':_0x7e119e['id']},{})[_0x2020('0x1e')](function(){return _0x3ad062;});}else{return _0x3ad062;}})[_0x2020('0x28')](function(_0x52cd53){logger[_0x2020('0x24')](_0x2020('0x59'),_0x52cd53);throw _0x52cd53;});}return _0x3ad062;})[_0x2020('0x1e')](respondWithResult(_0x2def15,0xc9))['catch'](handleError(_0x2def15,null));};exports[_0x2020('0x32')]=function(_0x329df,_0x5cc7bb){if(_0x329df[_0x2020('0x55')]['id']){delete _0x329df[_0x2020('0x55')]['id'];}return db['ChatQueue'][_0x2020('0x53')]({'where':{'id':_0x329df[_0x2020('0x52')]['id']}})[_0x2020('0x1e')](handleEntityNotFound(_0x5cc7bb,null))[_0x2020('0x1e')](saveUpdates(_0x329df[_0x2020('0x55')],null))[_0x2020('0x1e')](respondWithResult(_0x5cc7bb,null))[_0x2020('0x28')](handleError(_0x5cc7bb,null));};exports[_0x2020('0x33')]=function(_0x4c882f,_0x2873fd){return db[_0x2020('0x3b')]['find']({'where':{'id':_0x4c882f[_0x2020('0x52')]['id']}})[_0x2020('0x1e')](handleEntityNotFound(_0x2873fd,null))[_0x2020('0x1e')](removeEntity(_0x2873fd,null))[_0x2020('0x28')](handleError(_0x2873fd,null));};exports[_0x2020('0x5a')]=function(_0x348af5,_0x12c726){return db[_0x2020('0x3b')][_0x2020('0x5a')]()[_0x2020('0x1e')](respondWithResult(_0x12c726,null))[_0x2020('0x28')](handleError(_0x12c726,null));};exports['getMembers']=function(_0x24b791,_0x4b211d,_0x2c112e){var _0x226c04={'raw':!![],'where':{}},_0x2e9071={},_0x33eee0;return db['ChatQueue']['findOne']({'where':{'id':_0x24b791[_0x2020('0x52')]['id']}})['then'](handleEntityNotFound(_0x4b211d,null))[_0x2020('0x1e')](function(_0x56d77b){if(_0x56d77b){_0x33eee0=_0x56d77b[_0x2020('0x34')]({'plain':!![]});_0x2e9071[_0x2020('0x3e')]=_[_0x2020('0x3f')](db[_0x2020('0x5b')]['rawAttributes']);_0x2e9071[_0x2020('0x40')]=_['keys'](_0x24b791[_0x2020('0x40')]);_0x2e9071[_0x2020('0x41')]=_[_0x2020('0x42')](_0x2e9071[_0x2020('0x3e')],_0x2e9071['query']);_0x226c04['attributes']=_[_0x2020('0x42')](_0x2e9071['model'],qs[_0x2020('0x43')](_0x24b791[_0x2020('0x40')][_0x2020('0x43')]));_0x226c04['attributes']=_0x226c04['attributes'][_0x2020('0x45')]?_0x226c04[_0x2020('0x44')]:_0x2e9071[_0x2020('0x3e')];if(!_0x24b791[_0x2020('0x40')][_0x2020('0x46')](_0x2020('0x47'))){_0x226c04['limit']=qs[_0x2020('0x2d')](_0x24b791['query']['limit']);_0x226c04[_0x2020('0x2c')]=qs[_0x2020('0x2c')](_0x24b791['query'][_0x2020('0x2c')]);}_0x226c04[_0x2020('0x5c')]=qs[_0x2020('0x48')](_0x24b791[_0x2020('0x40')][_0x2020('0x48')]);_0x226c04['where']=qs['filters'](_[_0x2020('0x4a')](_0x24b791[_0x2020('0x40')],_0x2e9071[_0x2020('0x41')]));_0x226c04[_0x2020('0x49')][_0x2020('0x5d')]=_0x56d77b['id'];if(_0x24b791['query'][_0x2020('0x4b')]){_0x226c04[_0x2020('0x49')]=_[_0x2020('0x4c')](_0x226c04[_0x2020('0x49')],{'$or':_['map'](_0x226c04[_0x2020('0x44')],function(_0x320c16){var _0x2ce3e3={};_0x2ce3e3[_0x320c16]={'$like':'%'+_0x24b791[_0x2020('0x40')][_0x2020('0x4b')]+'%'};return _0x2ce3e3;})});}_0x226c04=_[_0x2020('0x4c')]({},_0x226c04,_0x24b791[_0x2020('0x4d')]);return db['UserChatQueue']['findAll'](_0x226c04);}})[_0x2020('0x1e')](function(_0x53eb64){if(_0x53eb64){return db[_0x2020('0x5e')][_0x2020('0x5f')]({'where':{'id':_[_0x2020('0x3a')](_0x53eb64,_0x2020('0x60')),'role':'agent'},'attributes':['id',_0x2020('0x38'),'chatPause',_0x2020('0x61'),_0x2020('0x62')]});}})['then'](function(_0x2ef03c){if(_0x2ef03c){return{'count':_0x2ef03c[_0x2020('0x2f')],'rows':_[_0x2020('0x3a')](_0x2ef03c[_0x2020('0x51')],function(_0x5ea3cf){return{'membername':_0x5ea3cf['name'],'UserId':_0x5ea3cf['id'],'queue_name':_0x33eee0['name'],'ChatQueueId':_0x33eee0['id'],'interface':util['format'](_0x2020('0x63'),_0x2020('0x64'),_0x5ea3cf['name']),'penalty':0x0,'paused':_0x5ea3cf[_0x2020('0x65')],'createdAt':_0x5ea3cf[_0x2020('0x62')],'updatedAt':_0x5ea3cf[_0x2020('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2020('0x1e')](respondWithFilteredResult(_0x4b211d,_0x226c04))['catch'](handleError(_0x4b211d,null));};exports[_0x2020('0x66')]=function(_0x4b531f,_0x364126,_0x226987){var _0x2d1916={};var _0x5b1d15={};var _0x5560c2;var _0x5b0a88;return db['ChatQueue'][_0x2020('0x67')]({'where':{'id':_0x4b531f[_0x2020('0x52')]['id']}})[_0x2020('0x1e')](handleEntityNotFound(_0x364126,null))['then'](function(_0x279b29){if(_0x279b29){_0x5560c2=_0x279b29;_0x5b1d15[_0x2020('0x3e')]=_[_0x2020('0x3f')](db[_0x2020('0x68')][_0x2020('0x69')]);_0x5b1d15['query']=_['keys'](_0x4b531f[_0x2020('0x40')]);_0x5b1d15['filters']=_[_0x2020('0x42')](_0x5b1d15[_0x2020('0x3e')],_0x5b1d15[_0x2020('0x40')]);_0x2d1916[_0x2020('0x44')]=_[_0x2020('0x42')](_0x5b1d15[_0x2020('0x3e')],qs[_0x2020('0x43')](_0x4b531f[_0x2020('0x40')][_0x2020('0x43')]));_0x2d1916[_0x2020('0x44')]=_0x2d1916[_0x2020('0x44')][_0x2020('0x45')]?_0x2d1916[_0x2020('0x44')]:_0x5b1d15[_0x2020('0x3e')];_0x2d1916[_0x2020('0x5c')]=qs[_0x2020('0x48')](_0x4b531f[_0x2020('0x40')][_0x2020('0x48')]);_0x2d1916[_0x2020('0x49')]=qs[_0x2020('0x41')](_[_0x2020('0x4a')](_0x4b531f[_0x2020('0x40')],_0x5b1d15[_0x2020('0x41')]));if(_0x4b531f[_0x2020('0x40')]['filter']){_0x2d1916[_0x2020('0x49')]=_[_0x2020('0x4c')](_0x2d1916[_0x2020('0x49')],{'$or':_[_0x2020('0x3a')](_0x2d1916[_0x2020('0x44')],function(_0x54e77b){var _0x5829d8={};_0x5829d8[_0x54e77b]={'$like':'%'+_0x4b531f[_0x2020('0x40')][_0x2020('0x4b')]+'%'};return _0x5829d8;})});}_0x2d1916=_[_0x2020('0x4c')]({},_0x2d1916,_0x4b531f[_0x2020('0x4d')]);return _0x5560c2[_0x2020('0x66')](_0x2d1916);}})[_0x2020('0x1e')](function(_0xc97ed0){if(_0xc97ed0){_0x5b0a88=_0xc97ed0['length'];if(!_0x4b531f['query'][_0x2020('0x46')](_0x2020('0x47'))){_0x2d1916[_0x2020('0x2d')]=qs[_0x2020('0x2d')](_0x4b531f[_0x2020('0x40')][_0x2020('0x2d')]);_0x2d1916[_0x2020('0x2c')]=qs[_0x2020('0x2c')](_0x4b531f[_0x2020('0x40')][_0x2020('0x2c')]);}return _0x5560c2[_0x2020('0x66')](_0x2d1916);}})[_0x2020('0x1e')](function(_0x6fde8){if(_0x6fde8){return _0x6fde8?{'count':_0x5b0a88,'rows':_0x6fde8}:null;}})[_0x2020('0x1e')](respondWithResult(_0x364126,null))[_0x2020('0x28')](handleError(_0x364126,null));};exports['addTeams']=function(_0x5cca90,_0x474789,_0x4c0959){var _0x529da3=_0x5cca90[_0x2020('0x55')][_0x2020('0x6a')];return db['Team'][_0x2020('0x50')]({'where':{'id':_0x529da3},'attributes':['id'],'include':[{'model':db[_0x2020('0x5e')],'as':_0x2020('0x6b'),'attributes':['id',_0x2020('0x38'),'online','voicePause',_0x2020('0x6c')],'raw':!![]}]})[_0x2020('0x1e')](function(_0x3e8d23){if(_0x3e8d23){var _0xefb87=_['flatMap'](_0x3e8d23,function(_0xb3aa9c){var _0x24fd2a=_0xb3aa9c[_0x2020('0x34')]({'plain':!![]});return _0x24fd2a['Agents'];});return db[_0x2020('0x3b')]['find']({'where':{'id':_0x5cca90[_0x2020('0x52')]['id']}})[_0x2020('0x1e')](function(_0x24f27c){return db[_0x2020('0x6d')][_0x2020('0x6e')](function(_0x2fdf8a){return _0x24f27c[_0x2020('0x6f')](_0x529da3,{'transaction':_0x2fdf8a})['then'](function(){return BPromise[_0x2020('0x70')](_0xefb87,function(_0x1eb1ff){return db['UserChatQueue'][_0x2020('0x71')]({'where':{'UserId':_0x1eb1ff['id'],'ChatQueueId':_0x5cca90['params']['id']},'transaction':_0x2fdf8a});});})[_0x2020('0x1e')](function(){_0xefb87[_0x2020('0x72')](function(_0x237f23){socket[_0x2020('0x73')](_0x2020('0x74'),{'UserId':_0x237f23['id'],'ChatQueueId':_0x24f27c['id']});});});});});}})['then'](respondWithStatusCode(_0x474789,null))[_0x2020('0x28')](handleError(_0x474789,null));};exports[_0x2020('0x75')]=function(_0x30db60,_0x5cc52b,_0x3947b0){return db[_0x2020('0x68')][_0x2020('0x50')]({'where':{'id':_0x30db60[_0x2020('0x40')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2020('0x5e')],'as':_0x2020('0x6b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5cc52b,null))[_0x2020('0x1e')](function(_0x29b6b4){var _0x5ac650=_[_0x2020('0x3a')](_0x29b6b4,'id');var _0x4d510f=[];var _0xc6a1d2=[];var _0x145c15=squel[_0x2020('0x76')]();_0x145c15[_0x2020('0x77')](_0x2020('0x78'))[_0x2020('0x79')](_0x2020('0x7a'),'tq')[_0x2020('0x7b')](_0x2020('0x7c'),'ut',_0x2020('0x7d'))[_0x2020('0x49')]('ChatQueueId\x20=\x20?',_0x30db60[_0x2020('0x52')]['id']);for(var _0xccc97a=0x0;_0xccc97a<_0x29b6b4['length'];_0xccc97a+=0x1){let _0x3f9e20=_0x29b6b4[_0xccc97a];for(var _0x58739a=0x0;_0x58739a<_0x3f9e20[_0x2020('0x6b')]['length'];_0x58739a+=0x1){let _0x11c892=_0x3f9e20['Agents'][_0x58739a];var _0xa50398=_0x145c15[_0x2020('0x7e')]();_0xa50398['where'](_0x2020('0x7f'),_0x11c892['id']);_0xc6a1d2[_0x2020('0x80')](db[_0x2020('0x6d')]['query'](_0xa50398[_0x2020('0x81')](),{'type':db[_0x2020('0x6d')]['QueryTypes'][_0x2020('0x82')]})[_0x2020('0x1e')](function(_0x4db355){if(_0x4db355['length']===0x1){return _0x11c892['id'];}else{var _0xe3f3ac=_[_0x2020('0x83')](_[_0x2020('0x3a')](_0x4db355,_0x2020('0x84')),function(_0x5e6b99){return _[_0x2020('0x85')](_0x5ac650,_0x5e6b99);});if(_0xe3f3ac){return _0x11c892['id'];}}}));}}return BPromise[_0x2020('0x86')](_0xc6a1d2)[_0x2020('0x1e')](function(_0x1b5b94){_0x4d510f=_(_0x4d510f)[_0x2020('0x87')](_0x1b5b94)[_0x2020('0x88')]()['value']();return db[_0x2020('0x3b')]['find']({'where':{'id':_0x30db60[_0x2020('0x52')]['id']}})[_0x2020('0x1e')](function(_0x1b7bd0){return db[_0x2020('0x6d')][_0x2020('0x6e')](function(_0x19b604){return _0x1b7bd0[_0x2020('0x75')](_0x30db60['query']['ids'],{'transaction':_0x19b604})[_0x2020('0x1e')](function(){if(!_['isEmpty'](_0x4d510f)){return _0x1b7bd0[_0x2020('0x89')](_0x4d510f,{'transaction':_0x19b604});}})['then'](function(){_0x4d510f[_0x2020('0x72')](function(_0x51ce50){socket['emit'](_0x2020('0x8a'),{'UserId':_0x51ce50,'ChatQueueId':_0x1b7bd0['id']});});});});});});})[_0x2020('0x1e')](respondWithStatusCode(_0x5cc52b,null))[_0x2020('0x28')](handleError(_0x5cc52b,null));};exports[_0x2020('0x8b')]=function(_0x5cc995,_0xab714c,_0x4de7bb){return db[_0x2020('0x3b')]['find']({'where':{'id':_0x5cc995['params']['id']}})[_0x2020('0x1e')](handleEntityNotFound(_0xab714c,null))['then'](function(_0x28311c){if(_0x28311c){return _0x28311c['addAgents'](_0x5cc995[_0x2020('0x55')]['ids'],_[_0x2020('0x8c')](_0x5cc995['body'],[_0x2020('0x6a'),'id'])||{})['spread'](function(_0x49746e){for(var _0x3b05c2=0x0;_0x3b05c2<_0x5cc995[_0x2020('0x55')]['ids']['length'];_0x3b05c2+=0x1){socket[_0x2020('0x73')](_0x2020('0x74'),{'UserId':Number(_0x5cc995[_0x2020('0x55')][_0x2020('0x6a')][_0x3b05c2]),'ChatQueueId':Number(_0x5cc995[_0x2020('0x52')]['id'])});}return _0x49746e;});}})[_0x2020('0x1e')](respondWithResult(_0xab714c,null))[_0x2020('0x28')](handleError(_0xab714c,null));};exports[_0x2020('0x89')]=function(_0x267af1,_0xb7a87f,_0x23fa72){return db[_0x2020('0x3b')][_0x2020('0x53')]({'where':{'id':_0x267af1[_0x2020('0x52')]['id']}})[_0x2020('0x1e')](handleEntityNotFound(_0xb7a87f,null))['then'](function(_0x316d9c){if(_0x316d9c){return _0x316d9c[_0x2020('0x89')](_0x267af1['query'][_0x2020('0x6a')])[_0x2020('0x1e')](function(){if(_[_0x2020('0x8d')](_0x267af1['query'][_0x2020('0x6a')])){for(var _0x263c26=0x0;_0x263c26<_0x267af1[_0x2020('0x40')]['ids'][_0x2020('0x45')];_0x263c26+=0x1){socket['emit'](_0x2020('0x8a'),{'UserId':Number(_0x267af1[_0x2020('0x40')][_0x2020('0x6a')][_0x263c26]),'ChatQueueId':Number(_0x267af1[_0x2020('0x52')]['id'])});}}else{socket['emit'](_0x2020('0x8a'),{'UserId':Number(_0x267af1[_0x2020('0x40')][_0x2020('0x6a')]),'ChatQueueId':Number(_0x267af1[_0x2020('0x52')]['id'])});}});}})[_0x2020('0x1e')](respondWithStatusCode(_0xb7a87f,null))[_0x2020('0x28')](handleError(_0xb7a87f,null));};exports[_0x2020('0x8e')]=function(_0x44a5de,_0x2b87a7,_0x115951){var _0x319a15={};var _0x472be8={};var _0x2869de;var _0x5afd64;return db['ChatQueue'][_0x2020('0x67')]({'where':{'id':_0x44a5de[_0x2020('0x52')]['id']}})[_0x2020('0x1e')](handleEntityNotFound(_0x2b87a7,null))[_0x2020('0x1e')](function(_0x30c927){if(_0x30c927){_0x2869de=_0x30c927;_0x472be8[_0x2020('0x3e')]=_[_0x2020('0x3f')](db[_0x2020('0x5e')][_0x2020('0x69')]);_0x472be8[_0x2020('0x40')]=_[_0x2020('0x3f')](_0x44a5de['query']);_0x472be8['filters']=_[_0x2020('0x42')](_0x472be8['model'],_0x472be8[_0x2020('0x40')]);_0x319a15[_0x2020('0x44')]=_['intersection'](_0x472be8['model'],qs[_0x2020('0x43')](_0x44a5de[_0x2020('0x40')]['fields']));_0x319a15[_0x2020('0x44')]=_0x319a15[_0x2020('0x44')][_0x2020('0x45')]?_0x319a15['attributes']:_0x472be8['model'];_0x319a15[_0x2020('0x5c')]=qs['sort'](_0x44a5de[_0x2020('0x40')][_0x2020('0x48')]);_0x319a15[_0x2020('0x49')]=qs[_0x2020('0x41')](_[_0x2020('0x4a')](_0x44a5de[_0x2020('0x40')],_0x472be8['filters']));if(_0x44a5de[_0x2020('0x40')][_0x2020('0x4b')]){_0x319a15[_0x2020('0x49')]=_[_0x2020('0x4c')](_0x319a15['where'],{'$or':_[_0x2020('0x3a')](_0x319a15[_0x2020('0x44')],function(_0x2c2ab8){var _0x426a1a={};_0x426a1a[_0x2c2ab8]={'$like':'%'+_0x44a5de[_0x2020('0x40')][_0x2020('0x4b')]+'%'};return _0x426a1a;})});}_0x319a15=_[_0x2020('0x4c')]({},_0x319a15,_0x44a5de['options']);return _0x2869de[_0x2020('0x8e')](_0x319a15);}})[_0x2020('0x1e')](function(_0x6b4e5a){if(_0x6b4e5a){_0x5afd64=_0x6b4e5a[_0x2020('0x45')];if(!_0x44a5de[_0x2020('0x40')][_0x2020('0x46')](_0x2020('0x47'))){_0x319a15[_0x2020('0x2d')]=qs[_0x2020('0x2d')](_0x44a5de[_0x2020('0x40')][_0x2020('0x2d')]);_0x319a15[_0x2020('0x2c')]=qs[_0x2020('0x2c')](_0x44a5de['query'][_0x2020('0x2c')]);}return _0x2869de[_0x2020('0x8e')](_0x319a15);}})[_0x2020('0x1e')](function(_0x535735){if(_0x535735){return _0x535735?{'count':_0x5afd64,'rows':_0x535735}:null;}})[_0x2020('0x1e')](respondWithResult(_0x2b87a7,null))[_0x2020('0x28')](handleError(_0x2b87a7,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index ddc2da3..d898174 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 _0xa3d4=['setMaxListeners','update','remove','emit','hook','exports','../../mysqldb','ChatQueue'];(function(_0x29bcd1,_0x321aab){var _0xe7f9cb=function(_0x250661){while(--_0x250661){_0x29bcd1['push'](_0x29bcd1['shift']());}};_0xe7f9cb(++_0x321aab);}(_0xa3d4,0x12e));var _0x4a3d=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xa3d4[_0x4b369d];return _0x571a98;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x4a3d('0x0'))['db'][_0x4a3d('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x4a3d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4a3d('0x3'),'afterDestroy':_0x4a3d('0x4')};function emitEvent(_0x2bc5d2){return function(_0x33ff2f,_0x335971,_0xaef77c){ChatQueueEvents[_0x4a3d('0x5')](_0x2bc5d2+':'+_0x33ff2f['id'],_0x33ff2f);ChatQueueEvents[_0x4a3d('0x5')](_0x2bc5d2,_0x33ff2f);_0xaef77c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x4a3d('0x6')](e,emitEvent(event));}}module[_0x4a3d('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0xa037=['setMaxListeners','save','remove','emit','exports','events','../../mysqldb'];(function(_0xdc7170,_0x571276){var _0x9e8216=function(_0x4ebfbc){while(--_0x4ebfbc){_0xdc7170['push'](_0xdc7170['shift']());}};_0x9e8216(++_0x571276);}(_0xa037,0x11d));var _0x7a03=function(_0xc20637,_0x1c49db){_0xc20637=_0xc20637-0x0;var _0x3a4243=_0xa037[_0xc20637];return _0x3a4243;};'use strict';var EventEmitter=require(_0x7a03('0x0'));var ChatQueue=require(_0x7a03('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x7a03('0x2')](0x0);var events={'afterCreate':_0x7a03('0x3'),'afterUpdate':'update','afterDestroy':_0x7a03('0x4')};function emitEvent(_0x8a34aa){return function(_0x26514b,_0x43ee60,_0x408a67){ChatQueueEvents[_0x7a03('0x5')](_0x8a34aa+':'+_0x26514b['id'],_0x26514b);ChatQueueEvents[_0x7a03('0x5')](_0x8a34aa,_0x26514b);_0x408a67(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x7a03('0x6')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index adc1644..d1d1886 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 _0x0344=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','ChatQueue','chat_queues','lodash','util'];(function(_0x4a0e1c,_0x136907){var _0x32ea10=function(_0x42e919){while(--_0x42e919){_0x4a0e1c['push'](_0x4a0e1c['shift']());}};_0x32ea10(++_0x136907);}(_0x0344,0xa3));var _0x4034=function(_0x49284b,_0x3895e3){_0x49284b=_0x49284b-0x0;var _0xd4a527=_0x0344[_0x49284b];return _0xd4a527;};'use strict';var _=require(_0x4034('0x0'));var util=require(_0x4034('0x1'));var logger=require(_0x4034('0x2'))(_0x4034('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4034('0x4'));var fs=require('fs');var path=require(_0x4034('0x5'));var rimraf=require(_0x4034('0x6'));var config=require(_0x4034('0x7'));var attributes=require('./chatQueue.attributes');module[_0x4034('0x8')]=function(_0x53cf3f,_0x32ee8f){return _0x53cf3f['define'](_0x4034('0x9'),attributes,{'tableName':_0x4034('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6fcc=['rimraf','../../config/environment','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x983196,_0xdb4225){var _0x201777=function(_0x522b6e){while(--_0x522b6e){_0x983196['push'](_0x983196['shift']());}};_0x201777(++_0xdb4225);}(_0x6fcc,0x162));var _0xc6fc=function(_0x3b623e,_0x4b4f39){_0x3b623e=_0x3b623e-0x0;var _0x385c0e=_0x6fcc[_0x3b623e];return _0x385c0e;};'use strict';var _=require(_0xc6fc('0x0'));var util=require(_0xc6fc('0x1'));var logger=require(_0xc6fc('0x2'))(_0xc6fc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc6fc('0x4'));var fs=require('fs');var path=require(_0xc6fc('0x5'));var rimraf=require(_0xc6fc('0x6'));var config=require(_0xc6fc('0x7'));var attributes=require('./chatQueue.attributes');module[_0xc6fc('0x8')]=function(_0x1c0ce3,_0xa802db){return _0x1c0ce3[_0xc6fc('0x9')](_0xc6fc('0xa'),attributes,{'tableName':_0xc6fc('0xb'),'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 b380c39..6302052 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 _0x2fe3=['code','ChatQueue,\x20%s,\x20%s','message','result','catch','ChatQueue','findAll','raw','options','where','attributes','limit','include','model','map','GetChatQueue','ShowChatQueue','find','lodash','util','randomstring','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','./chatQueue.socket','register','request','then','info','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x543d2d,_0x4436e2){var _0x3d5343=function(_0x479c1f){while(--_0x479c1f){_0x543d2d['push'](_0x543d2d['shift']());}};_0x3d5343(++_0x4436e2);}(_0x2fe3,0x87));var _0x32fe=function(_0x458f06,_0x5125d1){_0x458f06=_0x458f06-0x0;var _0x14890e=_0x2fe3[_0x458f06];return _0x14890e;};'use strict';var _=require(_0x32fe('0x0'));var util=require(_0x32fe('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x32fe('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x32fe('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x32fe('0x4'));var config=require(_0x32fe('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x32fe('0x6')][_0x32fe('0x7')]({'port':0x232a});config[_0x32fe('0x8')]=_[_0x32fe('0x9')](config[_0x32fe('0x8')],{'host':_0x32fe('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x32fe('0x8')]));require(_0x32fe('0xb'))[_0x32fe('0xc')](socket);function respondWithRpcPromise(_0x2b9bb7,_0x47abd9,_0x5448d8){return new BPromise(function(_0x3b2d24,_0x37b3ae){return client[_0x32fe('0xd')](_0x2b9bb7,_0x5448d8)[_0x32fe('0xe')](function(_0x501ddd){logger[_0x32fe('0xf')]('ChatQueue,\x20%s,\x20%s',_0x47abd9,'request\x20sent');logger[_0x32fe('0x10')](_0x32fe('0x11'),_0x47abd9,_0x32fe('0x12'),JSON[_0x32fe('0x13')](_0x501ddd));if(_0x501ddd[_0x32fe('0x14')]){if(_0x501ddd[_0x32fe('0x14')][_0x32fe('0x15')]===0x1f4){logger[_0x32fe('0x14')](_0x32fe('0x16'),_0x47abd9,_0x501ddd[_0x32fe('0x14')][_0x32fe('0x17')]);return _0x37b3ae(_0x501ddd[_0x32fe('0x14')][_0x32fe('0x17')]);}logger[_0x32fe('0x14')](_0x32fe('0x16'),_0x47abd9,_0x501ddd['error']['message']);return _0x3b2d24(_0x501ddd[_0x32fe('0x14')][_0x32fe('0x17')]);}else{logger['info'](_0x32fe('0x16'),_0x47abd9,_0x32fe('0x12'));_0x3b2d24(_0x501ddd[_0x32fe('0x18')]['message']);}})[_0x32fe('0x19')](function(_0xb7ac89){logger[_0x32fe('0x14')](_0x32fe('0x16'),_0x47abd9,_0xb7ac89);_0x37b3ae(_0xb7ac89);});});}exports['GetChatQueue']=function(_0x26a555){var _0x4881cf=this;return new Promise(function(_0xd5a771,_0x2702ad){return db[_0x32fe('0x1a')][_0x32fe('0x1b')]({'raw':_0x26a555['options']?_0x26a555['options'][_0x32fe('0x1c')]===undefined?!![]:![]:!![],'where':_0x26a555[_0x32fe('0x1d')]?_0x26a555[_0x32fe('0x1d')][_0x32fe('0x1e')]||null:null,'attributes':_0x26a555[_0x32fe('0x1d')]?_0x26a555[_0x32fe('0x1d')][_0x32fe('0x1f')]||null:null,'limit':_0x26a555[_0x32fe('0x1d')]?_0x26a555['options'][_0x32fe('0x20')]||null:null,'include':_0x26a555['options']?_0x26a555[_0x32fe('0x1d')][_0x32fe('0x21')]?_['map'](_0x26a555[_0x32fe('0x1d')][_0x32fe('0x21')],function(_0x84f0c4){return{'model':db[_0x84f0c4[_0x32fe('0x22')]],'as':_0x84f0c4['as'],'attributes':_0x84f0c4['attributes'],'include':_0x84f0c4['include']?_[_0x32fe('0x23')](_0x84f0c4['include'],function(_0x5e20ac){return{'model':db[_0x5e20ac[_0x32fe('0x22')]],'as':_0x5e20ac['as'],'attributes':_0x5e20ac['attributes'],'include':_0x5e20ac[_0x32fe('0x21')]?_[_0x32fe('0x23')](_0x5e20ac[_0x32fe('0x21')],function(_0x382242){return{'model':db[_0x382242['model']],'as':_0x382242['as'],'attributes':_0x382242[_0x32fe('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xcd74fa){logger['info']('GetChatQueue',_0x26a555);logger[_0x32fe('0x10')]('GetChatQueue',_0x26a555,JSON[_0x32fe('0x13')](_0xcd74fa));_0xd5a771(_0xcd74fa);})['catch'](function(_0x231b06){logger[_0x32fe('0x14')](_0x32fe('0x24'),_0x231b06[_0x32fe('0x17')],_0x26a555);_0x2702ad(_0x4881cf[_0x32fe('0x14')](0x1f4,_0x231b06[_0x32fe('0x17')]));});});};exports[_0x32fe('0x25')]=function(_0x1c42cb){var _0x3559c0=this;return new Promise(function(_0x5f5869,_0x3c6a22){return db[_0x32fe('0x1a')][_0x32fe('0x26')]({'raw':_0x1c42cb['options']?_0x1c42cb[_0x32fe('0x1d')][_0x32fe('0x1c')]===undefined?!![]:![]:!![],'where':_0x1c42cb[_0x32fe('0x1d')]?_0x1c42cb[_0x32fe('0x1d')][_0x32fe('0x1e')]||null:null,'attributes':_0x1c42cb['options']?_0x1c42cb['options'][_0x32fe('0x1f')]||null:null,'include':_0x1c42cb[_0x32fe('0x1d')]?_0x1c42cb['options'][_0x32fe('0x21')]?_[_0x32fe('0x23')](_0x1c42cb[_0x32fe('0x1d')][_0x32fe('0x21')],function(_0x35b8a0){return{'model':db[_0x35b8a0[_0x32fe('0x22')]],'as':_0x35b8a0['as'],'attributes':_0x35b8a0['attributes'],'include':_0x35b8a0[_0x32fe('0x21')]?_[_0x32fe('0x23')](_0x35b8a0['include'],function(_0x34fd3c){return{'model':db[_0x34fd3c[_0x32fe('0x22')]],'as':_0x34fd3c['as'],'attributes':_0x34fd3c[_0x32fe('0x1f')],'include':_0x34fd3c[_0x32fe('0x21')]?_[_0x32fe('0x23')](_0x34fd3c[_0x32fe('0x21')],function(_0x28ac9d){return{'model':db[_0x28ac9d[_0x32fe('0x22')]],'as':_0x28ac9d['as'],'attributes':_0x28ac9d[_0x32fe('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x32fe('0xe')](function(_0x900870){logger[_0x32fe('0xf')]('ShowChatQueue',_0x1c42cb);logger[_0x32fe('0x10')]('ShowChatQueue',_0x1c42cb,JSON['stringify'](_0x900870));_0x5f5869(_0x900870);})[_0x32fe('0x19')](function(_0x41d7b2){logger[_0x32fe('0x14')]('ShowChatQueue',_0x41d7b2[_0x32fe('0x17')],_0x1c42cb);_0x3c6a22(_0x3559c0['error'](0x1f4,_0x41d7b2[_0x32fe('0x17')]));});});}; \ No newline at end of file +var _0xeb43=['include','map','model','ShowChatQueue','find','lodash','util','moment','randomstring','../../config/utils','../../config/logger','jayson/promise','client','redis','socket.io-emitter','./chatQueue.socket','register','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','attributes','limit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb43,0x149));var _0x3eb4=function(_0x22ee0f,_0x22e6d2){_0x22ee0f=_0x22ee0f-0x0;var _0x204696=_0xeb43[_0x22ee0f];return _0x204696;};'use strict';var _=require(_0x3eb4('0x0'));var util=require(_0x3eb4('0x1'));var moment=require(_0x3eb4('0x2'));var BPromise=require('bluebird');var rs=require(_0x3eb4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3eb4('0x4'));var logger=require(_0x3eb4('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3eb4('0x6'));var client=jayson[_0x3eb4('0x7')]['http']({'port':0x232a});config[_0x3eb4('0x8')]=_['defaults'](config[_0x3eb4('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x3eb4('0x9'))(new Redis(config[_0x3eb4('0x8')]));require(_0x3eb4('0xa'))[_0x3eb4('0xb')](socket);function respondWithRpcPromise(_0xde2fac,_0x5cb468,_0x42b9b5){return new BPromise(function(_0x4bdf6e,_0x25fedc){return client[_0x3eb4('0xc')](_0xde2fac,_0x42b9b5)[_0x3eb4('0xd')](function(_0x35cb9b){logger['info'](_0x3eb4('0xe'),_0x5cb468,_0x3eb4('0xf'));logger[_0x3eb4('0x10')](_0x3eb4('0x11'),_0x5cb468,_0x3eb4('0xf'),JSON[_0x3eb4('0x12')](_0x35cb9b));if(_0x35cb9b['error']){if(_0x35cb9b[_0x3eb4('0x13')]['code']===0x1f4){logger['error'](_0x3eb4('0xe'),_0x5cb468,_0x35cb9b['error'][_0x3eb4('0x14')]);return _0x25fedc(_0x35cb9b[_0x3eb4('0x13')][_0x3eb4('0x14')]);}logger[_0x3eb4('0x13')](_0x3eb4('0xe'),_0x5cb468,_0x35cb9b[_0x3eb4('0x13')][_0x3eb4('0x14')]);return _0x4bdf6e(_0x35cb9b[_0x3eb4('0x13')][_0x3eb4('0x14')]);}else{logger[_0x3eb4('0x15')]('ChatQueue,\x20%s,\x20%s',_0x5cb468,_0x3eb4('0xf'));_0x4bdf6e(_0x35cb9b[_0x3eb4('0x16')][_0x3eb4('0x14')]);}})[_0x3eb4('0x17')](function(_0x299ce2){logger[_0x3eb4('0x13')](_0x3eb4('0xe'),_0x5cb468,_0x299ce2);_0x25fedc(_0x299ce2);});});}exports[_0x3eb4('0x18')]=function(_0x50f36a){var _0x3d9d80=this;return new Promise(function(_0x5bb3bc,_0x55fe47){return db[_0x3eb4('0x19')][_0x3eb4('0x1a')]({'raw':_0x50f36a[_0x3eb4('0x1b')]?_0x50f36a[_0x3eb4('0x1b')][_0x3eb4('0x1c')]===undefined?!![]:![]:!![],'where':_0x50f36a['options']?_0x50f36a[_0x3eb4('0x1b')]['where']||null:null,'attributes':_0x50f36a[_0x3eb4('0x1b')]?_0x50f36a['options'][_0x3eb4('0x1d')]||null:null,'limit':_0x50f36a[_0x3eb4('0x1b')]?_0x50f36a[_0x3eb4('0x1b')][_0x3eb4('0x1e')]||null:null,'include':_0x50f36a[_0x3eb4('0x1b')]?_0x50f36a['options'][_0x3eb4('0x1f')]?_[_0x3eb4('0x20')](_0x50f36a['options'][_0x3eb4('0x1f')],function(_0x28c235){return{'model':db[_0x28c235[_0x3eb4('0x21')]],'as':_0x28c235['as'],'attributes':_0x28c235[_0x3eb4('0x1d')],'include':_0x28c235['include']?_[_0x3eb4('0x20')](_0x28c235[_0x3eb4('0x1f')],function(_0x96d1e){return{'model':db[_0x96d1e['model']],'as':_0x96d1e['as'],'attributes':_0x96d1e[_0x3eb4('0x1d')],'include':_0x96d1e[_0x3eb4('0x1f')]?_[_0x3eb4('0x20')](_0x96d1e[_0x3eb4('0x1f')],function(_0x51ef72){return{'model':db[_0x51ef72['model']],'as':_0x51ef72['as'],'attributes':_0x51ef72[_0x3eb4('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x225933){logger['info']('GetChatQueue',_0x50f36a);logger[_0x3eb4('0x10')]('GetChatQueue',_0x50f36a,JSON[_0x3eb4('0x12')](_0x225933));_0x5bb3bc(_0x225933);})[_0x3eb4('0x17')](function(_0xc8bb50){logger[_0x3eb4('0x13')](_0x3eb4('0x18'),_0xc8bb50[_0x3eb4('0x14')],_0x50f36a);_0x55fe47(_0x3d9d80['error'](0x1f4,_0xc8bb50['message']));});});};exports[_0x3eb4('0x22')]=function(_0x1aa9c7){var _0x1fa16e=this;return new Promise(function(_0x116b77,_0x21a784){return db['ChatQueue'][_0x3eb4('0x23')]({'raw':_0x1aa9c7[_0x3eb4('0x1b')]?_0x1aa9c7[_0x3eb4('0x1b')][_0x3eb4('0x1c')]===undefined?!![]:![]:!![],'where':_0x1aa9c7[_0x3eb4('0x1b')]?_0x1aa9c7['options']['where']||null:null,'attributes':_0x1aa9c7[_0x3eb4('0x1b')]?_0x1aa9c7[_0x3eb4('0x1b')][_0x3eb4('0x1d')]||null:null,'include':_0x1aa9c7[_0x3eb4('0x1b')]?_0x1aa9c7[_0x3eb4('0x1b')][_0x3eb4('0x1f')]?_[_0x3eb4('0x20')](_0x1aa9c7['options'][_0x3eb4('0x1f')],function(_0x4dba0b){return{'model':db[_0x4dba0b[_0x3eb4('0x21')]],'as':_0x4dba0b['as'],'attributes':_0x4dba0b['attributes'],'include':_0x4dba0b[_0x3eb4('0x1f')]?_[_0x3eb4('0x20')](_0x4dba0b[_0x3eb4('0x1f')],function(_0x58a1c4){return{'model':db[_0x58a1c4['model']],'as':_0x58a1c4['as'],'attributes':_0x58a1c4[_0x3eb4('0x1d')],'include':_0x58a1c4[_0x3eb4('0x1f')]?_[_0x3eb4('0x20')](_0x58a1c4[_0x3eb4('0x1f')],function(_0x26ed5a){return{'model':db[_0x26ed5a['model']],'as':_0x26ed5a['as'],'attributes':_0x26ed5a[_0x3eb4('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3eb4('0xd')](function(_0x54b434){logger[_0x3eb4('0x15')](_0x3eb4('0x22'),_0x1aa9c7);logger[_0x3eb4('0x10')]('ShowChatQueue',_0x1aa9c7,JSON['stringify'](_0x54b434));_0x116b77(_0x54b434);})[_0x3eb4('0x17')](function(_0x498f4d){logger[_0x3eb4('0x13')](_0x3eb4('0x22'),_0x498f4d[_0x3eb4('0x14')],_0x1aa9c7);_0x21a784(_0x1fa16e[_0x3eb4('0x13')](0x1f4,_0x498f4d['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 8313022..2801b07 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 _0x0ba7=['emit','removeListener','register','length','chatQueue:','./chatQueue.events','remove','update'];(function(_0x4d1166,_0x37df8b){var _0x2e669f=function(_0x4f3608){while(--_0x4f3608){_0x4d1166['push'](_0x4d1166['shift']());}};_0x2e669f(++_0x37df8b);}(_0x0ba7,0x16d));var _0x70ba=function(_0x4a1e08,_0x3bc110){_0x4a1e08=_0x4a1e08-0x0;var _0x364d10=_0x0ba7[_0x4a1e08];return _0x364d10;};'use strict';var ChatQueueEvents=require(_0x70ba('0x0'));var events=['save',_0x70ba('0x1'),_0x70ba('0x2')];function createListener(_0xadfc69,_0x42d93c){return function(_0x5e5368){_0x42d93c[_0x70ba('0x3')](_0xadfc69,_0x5e5368);};}function removeListener(_0x3e20ab,_0x3cb2e3){return function(){ChatQueueEvents[_0x70ba('0x4')](_0x3e20ab,_0x3cb2e3);};}exports[_0x70ba('0x5')]=function(_0x3f9877){for(var _0x17a00c=0x0,_0x2d5a16=events[_0x70ba('0x6')];_0x17a00c<_0x2d5a16;_0x17a00c++){var _0x1185cb=events[_0x17a00c];var _0x1a968b=createListener(_0x70ba('0x7')+_0x1185cb,_0x3f9877);ChatQueueEvents['on'](_0x1185cb,_0x1a968b);}}; \ No newline at end of file +var _0xed1f=['register','length','./chatQueue.events','save','remove','update','emit','removeListener'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xed1f,0x6a));var _0xfed1=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0xed1f[_0x476bf4];return _0x788ffe;};'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 5a5ad30..5769b04 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 _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2e6dbf,_0x57dd06){_0x2e6dbf=_0x2e6dbf-0x0;var _0x2680e5=_0x5fc3[_0x2e6dbf];return _0x2680e5;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router; \ No newline at end of file +var _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3e74,0x175));var _0x43e7=function(_0xa8d5ea,_0x294983){_0xa8d5ea=_0xa8d5ea-0x0;var _0x569776=_0x3e74[_0xa8d5ea];return _0x569776;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 749cc92..9e28f0c 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 _0x0997=['moment','STRING','DATE'];(function(_0x552781,_0x59fef2){var _0x51aef0=function(_0x21ccfb){while(--_0x21ccfb){_0x552781['push'](_0x552781['shift']());}};_0x51aef0(++_0x59fef2);}(_0x0997,0x6f));var _0x7099=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0997[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require(_0x7099('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x7099('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x7099('0x1')]},'joinAt':{'type':Sequelize[_0x7099('0x2')]},'leaveAt':{'type':Sequelize[_0x7099('0x2')]},'acceptAt':{'type':Sequelize[_0x7099('0x2')]},'exitAt':{'type':Sequelize[_0x7099('0x2')]},'reason':{'type':Sequelize[_0x7099('0x1')]}}; \ No newline at end of file +var _0x37c3=['sequelize','exports','STRING','DATE','moment'];(function(_0x4c8fa3,_0x12a507){var _0x3e0b0f=function(_0x1b9142){while(--_0x1b9142){_0x4c8fa3['push'](_0x4c8fa3['shift']());}};_0x3e0b0f(++_0x12a507);}(_0x37c3,0xd1));var _0x337c=function(_0xc7c78d,_0x1dd9fb){_0xc7c78d=_0xc7c78d-0x0;var _0x175f3d=_0x37c3[_0xc7c78d];return _0x175f3d;};'use strict';var moment=require(_0x337c('0x0'));var Sequelize=require(_0x337c('0x1'));module[_0x337c('0x2')]={'uniqueid':{'type':Sequelize[_0x337c('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x337c('0x3')]},'joinAt':{'type':Sequelize[_0x337c('0x4')]},'leaveAt':{'type':Sequelize[_0x337c('0x4')]},'acceptAt':{'type':Sequelize[_0x337c('0x4')]},'exitAt':{'type':Sequelize[_0x337c('0x4')]},'reason':{'type':Sequelize[_0x337c('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 9922763..136d0b2 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 _0xee55=['update','then','name','send','index','ChatQueueReport','rawAttributes','fieldName','type','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','destroy','describe','eml-format','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save'];(function(_0x84bcd8,_0x59ba63){var _0x54af42=function(_0x1562e6){while(--_0x1562e6){_0x84bcd8['push'](_0x84bcd8['shift']());}};_0x54af42(++_0x59ba63);}(_0xee55,0x1a0));var _0x5ee5=function(_0x4d82ea,_0x4d459f){_0x4d82ea=_0x4d82ea-0x0;var _0x257f4a=_0xee55[_0x4d82ea];return _0x257f4a;};'use strict';var emlformat=require(_0x5ee5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5ee5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5ee5('0x2'));var moment=require('moment');var BPromise=require(_0x5ee5('0x3'));var Mustache=require(_0x5ee5('0x4'));var util=require('util');var path=require(_0x5ee5('0x5'));var sox=require(_0x5ee5('0x6'));var csv=require(_0x5ee5('0x7'));var ejs=require(_0x5ee5('0x8'));var fs=require('fs');var fs_extra=require(_0x5ee5('0x9'));var _=require(_0x5ee5('0xa'));var squel=require(_0x5ee5('0xb'));var crypto=require('crypto');var jsforce=require(_0x5ee5('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5ee5('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5ee5('0xe'));var qs=require(_0x5ee5('0xf'));var as=require(_0x5ee5('0x10'));var hardwareService=require(_0x5ee5('0x11'));var logger=require('../../config/logger')(_0x5ee5('0x12'));var utils=require(_0x5ee5('0x13'));var config=require(_0x5ee5('0x14'));var licenseUtil=require(_0x5ee5('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a9abc,_0x38437c){_0x38437c=_0x38437c||0xcc;return function(_0x349c46){if(_0x349c46){return _0x4a9abc[_0x5ee5('0x16')](_0x38437c);}return _0x4a9abc['status'](_0x38437c)[_0x5ee5('0x17')]();};}function respondWithResult(_0x2cbfab,_0x1a5da4){_0x1a5da4=_0x1a5da4||0xc8;return function(_0x1cd19c){if(_0x1cd19c){return _0x2cbfab[_0x5ee5('0x18')](_0x1a5da4)[_0x5ee5('0x19')](_0x1cd19c);}};}function respondWithFilteredResult(_0x2ef66a,_0x5dd990){return function(_0x2773ab){if(_0x2773ab){var _0x184e53=typeof _0x5dd990[_0x5ee5('0x1a')]===_0x5ee5('0x1b')&&typeof _0x5dd990['limit']==='undefined';var _0x3bb1b5=_0x2773ab[_0x5ee5('0x1c')];var _0x173043=_0x184e53?0x0:_0x5dd990['offset'];var _0x1eafc3=_0x184e53?_0x2773ab['count']:_0x5dd990[_0x5ee5('0x1a')]+_0x5dd990['limit'];var _0x2c859a;if(_0x1eafc3>=_0x3bb1b5){_0x1eafc3=_0x3bb1b5;_0x2c859a=0xc8;}else{_0x2c859a=0xce;}_0x2ef66a[_0x5ee5('0x18')](_0x2c859a);return _0x2ef66a[_0x5ee5('0x1d')](_0x5ee5('0x1e'),_0x173043+'-'+_0x1eafc3+'/'+_0x3bb1b5)[_0x5ee5('0x19')](_0x2773ab);}return null;};}function patchUpdates(_0x24ce1b){return function(_0x46416a){try{jsonpatch[_0x5ee5('0x1f')](_0x46416a,_0x24ce1b,!![]);}catch(_0x45e278){return BPromise[_0x5ee5('0x20')](_0x45e278);}return _0x46416a[_0x5ee5('0x21')]();};}function saveUpdates(_0x72a60d,_0x3a15e2){return function(_0xb133d4){if(_0xb133d4){return _0xb133d4[_0x5ee5('0x22')](_0x72a60d)[_0x5ee5('0x23')](function(_0x3aa2d5){return _0x3aa2d5;});}return null;};}function removeEntity(_0x1e0f65,_0x1c2004){return function(_0x218f79){if(_0x218f79){return _0x218f79['destroy']()['then'](function(){_0x1e0f65[_0x5ee5('0x18')](0xcc)[_0x5ee5('0x17')]();});}};}function handleEntityNotFound(_0x6a7dca,_0x59c422){return function(_0x1df98d){if(!_0x1df98d){_0x6a7dca['sendStatus'](0x194);}return _0x1df98d;};}function handleError(_0x474d24,_0xbcc308){_0xbcc308=_0xbcc308||0x1f4;return function(_0x252da3){logger['error'](_0x252da3['stack']);if(_0x252da3[_0x5ee5('0x24')]){delete _0x252da3[_0x5ee5('0x24')];}_0x474d24[_0x5ee5('0x18')](_0xbcc308)[_0x5ee5('0x25')](_0x252da3);};}exports[_0x5ee5('0x26')]=function(_0x14254a,_0x334295){var _0x483c28={},_0x3d78a8={},_0x1947ae={'count':0x0,'rows':[]};var _0x422e71=_['map'](db[_0x5ee5('0x27')][_0x5ee5('0x28')],function(_0x2542da){return{'name':_0x2542da[_0x5ee5('0x29')],'type':_0x2542da[_0x5ee5('0x2a')][_0x5ee5('0x2b')]};});_0x3d78a8[_0x5ee5('0x2c')]=_[_0x5ee5('0x2d')](_0x422e71,'name');_0x3d78a8[_0x5ee5('0x2e')]=_['keys'](_0x14254a[_0x5ee5('0x2e')]);_0x3d78a8['filters']=_[_0x5ee5('0x2f')](_0x3d78a8[_0x5ee5('0x2c')],_0x3d78a8['query']);_0x483c28['attributes']=_[_0x5ee5('0x2f')](_0x3d78a8[_0x5ee5('0x2c')],qs[_0x5ee5('0x30')](_0x14254a[_0x5ee5('0x2e')]['fields']));_0x483c28[_0x5ee5('0x31')]=_0x483c28['attributes'][_0x5ee5('0x32')]?_0x483c28['attributes']:_0x3d78a8[_0x5ee5('0x2c')];if(!_0x14254a['query'][_0x5ee5('0x33')](_0x5ee5('0x34'))){_0x483c28[_0x5ee5('0x35')]=qs[_0x5ee5('0x35')](_0x14254a[_0x5ee5('0x2e')][_0x5ee5('0x35')]);_0x483c28[_0x5ee5('0x1a')]=qs['offset'](_0x14254a[_0x5ee5('0x2e')][_0x5ee5('0x1a')]);}_0x483c28[_0x5ee5('0x36')]=qs[_0x5ee5('0x37')](_0x14254a['query'][_0x5ee5('0x37')]);_0x483c28['where']=qs[_0x5ee5('0x38')](_[_0x5ee5('0x39')](_0x14254a['query'],_0x3d78a8[_0x5ee5('0x38')]),_0x422e71);if(_0x14254a['query'][_0x5ee5('0x3a')]){_0x483c28[_0x5ee5('0x3b')]=_[_0x5ee5('0x3c')](_0x483c28[_0x5ee5('0x3b')],{'$or':_[_0x5ee5('0x2d')](_0x422e71,function(_0xeab8e3){if(_0xeab8e3['type']!=='VIRTUAL'){var _0x11fad0={};_0x11fad0[_0xeab8e3['name']]={'$like':'%'+_0x14254a['query'][_0x5ee5('0x3a')]+'%'};return _0x11fad0;}})});}_0x483c28=_['merge']({},_0x483c28,_0x14254a[_0x5ee5('0x3d')]);var _0x36062b={'where':_0x483c28[_0x5ee5('0x3b')]};return db[_0x5ee5('0x27')]['count'](_0x36062b)['then'](function(_0xe5607e){_0x1947ae[_0x5ee5('0x1c')]=_0xe5607e;if(_0x14254a[_0x5ee5('0x2e')][_0x5ee5('0x3e')]){_0x483c28[_0x5ee5('0x3f')]=[{'all':!![]}];}return db[_0x5ee5('0x27')][_0x5ee5('0x40')](_0x483c28);})[_0x5ee5('0x23')](function(_0x1973e0){_0x1947ae[_0x5ee5('0x41')]=_0x1973e0;return _0x1947ae;})[_0x5ee5('0x23')](respondWithFilteredResult(_0x334295,_0x483c28))[_0x5ee5('0x42')](handleError(_0x334295,null));};exports[_0x5ee5('0x43')]=function(_0x5ed5f7,_0x21cbfb){var _0x199667={'raw':!![],'where':{'id':_0x5ed5f7[_0x5ee5('0x44')]['id']}},_0x5a5d3c={};_0x5a5d3c[_0x5ee5('0x2c')]=_['keys'](db['ChatQueueReport'][_0x5ee5('0x28')]);_0x5a5d3c[_0x5ee5('0x2e')]=_[_0x5ee5('0x45')](_0x5ed5f7[_0x5ee5('0x2e')]);_0x5a5d3c[_0x5ee5('0x38')]=_[_0x5ee5('0x2f')](_0x5a5d3c['model'],_0x5a5d3c[_0x5ee5('0x2e')]);_0x199667[_0x5ee5('0x31')]=_[_0x5ee5('0x2f')](_0x5a5d3c[_0x5ee5('0x2c')],qs[_0x5ee5('0x30')](_0x5ed5f7['query']['fields']));_0x199667[_0x5ee5('0x31')]=_0x199667['attributes'][_0x5ee5('0x32')]?_0x199667[_0x5ee5('0x31')]:_0x5a5d3c[_0x5ee5('0x2c')];if(_0x5ed5f7[_0x5ee5('0x2e')][_0x5ee5('0x3e')]){_0x199667[_0x5ee5('0x3f')]=[{'all':!![]}];}_0x199667=_[_0x5ee5('0x3c')]({},_0x199667,_0x5ed5f7[_0x5ee5('0x3d')]);return db['ChatQueueReport'][_0x5ee5('0x46')](_0x199667)[_0x5ee5('0x23')](handleEntityNotFound(_0x21cbfb,null))[_0x5ee5('0x23')](respondWithResult(_0x21cbfb,null))[_0x5ee5('0x42')](handleError(_0x21cbfb,null));};exports[_0x5ee5('0x47')]=function(_0x1373ba,_0x4b11d0){return db['ChatQueueReport']['create'](_0x1373ba[_0x5ee5('0x48')],{})[_0x5ee5('0x23')](respondWithResult(_0x4b11d0,0xc9))[_0x5ee5('0x42')](handleError(_0x4b11d0,null));};exports[_0x5ee5('0x22')]=function(_0x117086,_0x2b2c79){if(_0x117086['body']['id']){delete _0x117086[_0x5ee5('0x48')]['id'];}return db[_0x5ee5('0x27')]['find']({'where':{'id':_0x117086[_0x5ee5('0x44')]['id']}})[_0x5ee5('0x23')](handleEntityNotFound(_0x2b2c79,null))[_0x5ee5('0x23')](saveUpdates(_0x117086[_0x5ee5('0x48')],null))['then'](respondWithResult(_0x2b2c79,null))[_0x5ee5('0x42')](handleError(_0x2b2c79,null));};exports[_0x5ee5('0x49')]=function(_0x5586d3,_0x4ffd24){return db[_0x5ee5('0x27')][_0x5ee5('0x46')]({'where':{'id':_0x5586d3['params']['id']}})['then'](handleEntityNotFound(_0x4ffd24,null))[_0x5ee5('0x23')](removeEntity(_0x4ffd24,null))[_0x5ee5('0x42')](handleError(_0x4ffd24,null));};exports['describe']=function(_0x52646a,_0xc1600f){return db[_0x5ee5('0x27')][_0x5ee5('0x4a')]()[_0x5ee5('0x23')](respondWithResult(_0xc1600f,null))['catch'](handleError(_0xc1600f,null));}; \ No newline at end of file +var _0xf603=['moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','find','catch','body','describe','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x105717,_0x134b61){var _0x4b5c62=function(_0x3686a1){while(--_0x3686a1){_0x105717['push'](_0x105717['shift']());}};_0x4b5c62(++_0x134b61);}(_0xf603,0x124));var _0x3f60=function(_0x2843ea,_0x4ad6d5){_0x2843ea=_0x2843ea-0x0;var _0x51baf8=_0xf603[_0x2843ea];return _0x51baf8;};'use strict';var emlformat=require(_0x3f60('0x0'));var rimraf=require(_0x3f60('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3f60('0x2'));var rp=require(_0x3f60('0x3'));var moment=require(_0x3f60('0x4'));var BPromise=require(_0x3f60('0x5'));var Mustache=require(_0x3f60('0x6'));var util=require(_0x3f60('0x7'));var path=require(_0x3f60('0x8'));var sox=require(_0x3f60('0x9'));var csv=require(_0x3f60('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3f60('0xb'));var crypto=require(_0x3f60('0xc'));var jsforce=require(_0x3f60('0xd'));var deskjs=require(_0x3f60('0xe'));var toCsv=require(_0x3f60('0xa'));var querystring=require(_0x3f60('0xf'));var Papa=require(_0x3f60('0x10'));var Redis=require(_0x3f60('0x11'));var authService=require(_0x3f60('0x12'));var qs=require(_0x3f60('0x13'));var as=require(_0x3f60('0x14'));var hardwareService=require(_0x3f60('0x15'));var logger=require(_0x3f60('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3f60('0x17'));var db=require(_0x3f60('0x18'))['db'];function respondWithStatusCode(_0x2e79e8,_0x58e120){_0x58e120=_0x58e120||0xcc;return function(_0xeb6151){if(_0xeb6151){return _0x2e79e8[_0x3f60('0x19')](_0x58e120);}return _0x2e79e8['status'](_0x58e120)[_0x3f60('0x1a')]();};}function respondWithResult(_0x1b3e74,_0x53ec7a){_0x53ec7a=_0x53ec7a||0xc8;return function(_0x1ec7f4){if(_0x1ec7f4){return _0x1b3e74['status'](_0x53ec7a)[_0x3f60('0x1b')](_0x1ec7f4);}};}function respondWithFilteredResult(_0x2cd28f,_0x5e7718){return function(_0x3c0e9d){if(_0x3c0e9d){var _0x4e84b5=typeof _0x5e7718[_0x3f60('0x1c')]==='undefined'&&typeof _0x5e7718[_0x3f60('0x1d')]===_0x3f60('0x1e');var _0xbc26c=_0x3c0e9d[_0x3f60('0x1f')];var _0x3ae771=_0x4e84b5?0x0:_0x5e7718[_0x3f60('0x1c')];var _0x52aa44=_0x4e84b5?_0x3c0e9d[_0x3f60('0x1f')]:_0x5e7718[_0x3f60('0x1c')]+_0x5e7718[_0x3f60('0x1d')];var _0x9c845f;if(_0x52aa44>=_0xbc26c){_0x52aa44=_0xbc26c;_0x9c845f=0xc8;}else{_0x9c845f=0xce;}_0x2cd28f[_0x3f60('0x20')](_0x9c845f);return _0x2cd28f[_0x3f60('0x21')]('Content-Range',_0x3ae771+'-'+_0x52aa44+'/'+_0xbc26c)[_0x3f60('0x1b')](_0x3c0e9d);}return null;};}function patchUpdates(_0x2f1735){return function(_0x4dace9){try{jsonpatch[_0x3f60('0x22')](_0x4dace9,_0x2f1735,!![]);}catch(_0x2dba08){return BPromise[_0x3f60('0x23')](_0x2dba08);}return _0x4dace9[_0x3f60('0x24')]();};}function saveUpdates(_0x1d23bb,_0x1b161e){return function(_0x44b665){if(_0x44b665){return _0x44b665[_0x3f60('0x25')](_0x1d23bb)[_0x3f60('0x26')](function(_0x31847d){return _0x31847d;});}return null;};}function removeEntity(_0x3f6fa7,_0x35b8f6){return function(_0x1f9390){if(_0x1f9390){return _0x1f9390[_0x3f60('0x27')]()[_0x3f60('0x26')](function(){_0x3f6fa7['status'](0xcc)[_0x3f60('0x1a')]();});}};}function handleEntityNotFound(_0x3cdef4,_0x15315b){return function(_0x4581d6){if(!_0x4581d6){_0x3cdef4[_0x3f60('0x19')](0x194);}return _0x4581d6;};}function handleError(_0x36dfdb,_0xc106a9){_0xc106a9=_0xc106a9||0x1f4;return function(_0x23e265){logger['error'](_0x23e265[_0x3f60('0x28')]);if(_0x23e265[_0x3f60('0x29')]){delete _0x23e265[_0x3f60('0x29')];}_0x36dfdb[_0x3f60('0x20')](_0xc106a9)[_0x3f60('0x2a')](_0x23e265);};}exports[_0x3f60('0x2b')]=function(_0x39e14c,_0x4520a5){var _0x16b590={},_0x3cd0a7={},_0x2f1bc9={'count':0x0,'rows':[]};var _0x457e5b=_[_0x3f60('0x2c')](db[_0x3f60('0x2d')][_0x3f60('0x2e')],function(_0x14d83c){return{'name':_0x14d83c[_0x3f60('0x2f')],'type':_0x14d83c[_0x3f60('0x30')][_0x3f60('0x31')]};});_0x3cd0a7[_0x3f60('0x32')]=_[_0x3f60('0x2c')](_0x457e5b,_0x3f60('0x29'));_0x3cd0a7[_0x3f60('0x33')]=_[_0x3f60('0x34')](_0x39e14c[_0x3f60('0x33')]);_0x3cd0a7[_0x3f60('0x35')]=_[_0x3f60('0x36')](_0x3cd0a7[_0x3f60('0x32')],_0x3cd0a7[_0x3f60('0x33')]);_0x16b590[_0x3f60('0x37')]=_[_0x3f60('0x36')](_0x3cd0a7['model'],qs[_0x3f60('0x38')](_0x39e14c[_0x3f60('0x33')]['fields']));_0x16b590[_0x3f60('0x37')]=_0x16b590[_0x3f60('0x37')][_0x3f60('0x39')]?_0x16b590[_0x3f60('0x37')]:_0x3cd0a7['model'];if(!_0x39e14c[_0x3f60('0x33')][_0x3f60('0x3a')]('nolimit')){_0x16b590['limit']=qs[_0x3f60('0x1d')](_0x39e14c['query'][_0x3f60('0x1d')]);_0x16b590[_0x3f60('0x1c')]=qs[_0x3f60('0x1c')](_0x39e14c[_0x3f60('0x33')]['offset']);}_0x16b590['order']=qs[_0x3f60('0x3b')](_0x39e14c[_0x3f60('0x33')][_0x3f60('0x3b')]);_0x16b590[_0x3f60('0x3c')]=qs[_0x3f60('0x35')](_[_0x3f60('0x3d')](_0x39e14c['query'],_0x3cd0a7[_0x3f60('0x35')]),_0x457e5b);if(_0x39e14c['query'][_0x3f60('0x3e')]){_0x16b590['where']=_[_0x3f60('0x3f')](_0x16b590[_0x3f60('0x3c')],{'$or':_[_0x3f60('0x2c')](_0x457e5b,function(_0x466d05){if(_0x466d05[_0x3f60('0x30')]!=='VIRTUAL'){var _0x4fa98d={};_0x4fa98d[_0x466d05[_0x3f60('0x29')]]={'$like':'%'+_0x39e14c[_0x3f60('0x33')][_0x3f60('0x3e')]+'%'};return _0x4fa98d;}})});}_0x16b590=_['merge']({},_0x16b590,_0x39e14c[_0x3f60('0x40')]);var _0x42f82d={'where':_0x16b590['where']};return db['ChatQueueReport'][_0x3f60('0x1f')](_0x42f82d)[_0x3f60('0x26')](function(_0x3f2129){_0x2f1bc9[_0x3f60('0x1f')]=_0x3f2129;if(_0x39e14c[_0x3f60('0x33')]['includeAll']){_0x16b590[_0x3f60('0x41')]=[{'all':!![]}];}return db[_0x3f60('0x2d')][_0x3f60('0x42')](_0x16b590);})[_0x3f60('0x26')](function(_0x4c6346){_0x2f1bc9[_0x3f60('0x43')]=_0x4c6346;return _0x2f1bc9;})['then'](respondWithFilteredResult(_0x4520a5,_0x16b590))['catch'](handleError(_0x4520a5,null));};exports[_0x3f60('0x44')]=function(_0x20422a,_0x4ef8f2){var _0x5cfc2f={'raw':!![],'where':{'id':_0x20422a[_0x3f60('0x45')]['id']}},_0x4f0752={};_0x4f0752[_0x3f60('0x32')]=_['keys'](db['ChatQueueReport']['rawAttributes']);_0x4f0752[_0x3f60('0x33')]=_['keys'](_0x20422a['query']);_0x4f0752[_0x3f60('0x35')]=_[_0x3f60('0x36')](_0x4f0752['model'],_0x4f0752['query']);_0x5cfc2f[_0x3f60('0x37')]=_['intersection'](_0x4f0752[_0x3f60('0x32')],qs['fields'](_0x20422a[_0x3f60('0x33')][_0x3f60('0x38')]));_0x5cfc2f[_0x3f60('0x37')]=_0x5cfc2f[_0x3f60('0x37')][_0x3f60('0x39')]?_0x5cfc2f['attributes']:_0x4f0752[_0x3f60('0x32')];if(_0x20422a[_0x3f60('0x33')]['includeAll']){_0x5cfc2f['include']=[{'all':!![]}];}_0x5cfc2f=_[_0x3f60('0x3f')]({},_0x5cfc2f,_0x20422a[_0x3f60('0x40')]);return db[_0x3f60('0x2d')][_0x3f60('0x46')](_0x5cfc2f)[_0x3f60('0x26')](handleEntityNotFound(_0x4ef8f2,null))['then'](respondWithResult(_0x4ef8f2,null))[_0x3f60('0x47')](handleError(_0x4ef8f2,null));};exports['create']=function(_0xe5a2a6,_0x253d2f){return db[_0x3f60('0x2d')]['create'](_0xe5a2a6[_0x3f60('0x48')],{})[_0x3f60('0x26')](respondWithResult(_0x253d2f,0xc9))[_0x3f60('0x47')](handleError(_0x253d2f,null));};exports['update']=function(_0x217348,_0x55f75f){if(_0x217348[_0x3f60('0x48')]['id']){delete _0x217348[_0x3f60('0x48')]['id'];}return db[_0x3f60('0x2d')][_0x3f60('0x46')]({'where':{'id':_0x217348['params']['id']}})[_0x3f60('0x26')](handleEntityNotFound(_0x55f75f,null))[_0x3f60('0x26')](saveUpdates(_0x217348['body'],null))[_0x3f60('0x26')](respondWithResult(_0x55f75f,null))['catch'](handleError(_0x55f75f,null));};exports['destroy']=function(_0x4ce17d,_0x55dd97){return db['ChatQueueReport'][_0x3f60('0x46')]({'where':{'id':_0x4ce17d['params']['id']}})[_0x3f60('0x26')](handleEntityNotFound(_0x55dd97,null))[_0x3f60('0x26')](removeEntity(_0x55dd97,null))[_0x3f60('0x47')](handleError(_0x55dd97,null));};exports['describe']=function(_0x1f9921,_0x1c09a0){return db[_0x3f60('0x2d')][_0x3f60('0x49')]()[_0x3f60('0x26')](respondWithResult(_0x1c09a0,null))[_0x3f60('0x47')](handleError(_0x1c09a0,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 2776eb7..0875b83 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x47bc58,_0x1e1998){var _0x4a0860=function(_0x2a5b23){while(--_0x2a5b23){_0x47bc58['push'](_0x47bc58['shift']());}};_0x4a0860(++_0x1e1998);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x5420a9,_0x29a4ca){var _0x2851c4=function(_0x26ddee){while(--_0x26ddee){_0x5420a9['push'](_0x5420a9['shift']());}};_0x2851c4(++_0x29a4ca);}(_0x757a,0xde));var _0xa757=function(_0x26970b,_0x17d442){_0x26970b=_0x26970b-0x0;var _0x2fc853=_0x757a[_0x26970b];return _0x2fc853;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 44c8216..8e66993 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 _0xc283=['then','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','ChatQueueReport','create','options','raw','CreateChatQueueReport','catch','UpdateChatQueueReport','update','body','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request'];(function(_0x5d4dd4,_0x24b836){var _0x398131=function(_0x27996a){while(--_0x27996a){_0x5d4dd4['push'](_0x5d4dd4['shift']());}};_0x398131(++_0x24b836);}(_0xc283,0x17f));var _0x3c28=function(_0x4de365,_0x21de62){_0x4de365=_0x4de365-0x0;var _0x2c7941=_0xc283[_0x4de365];return _0x2c7941;};'use strict';var _=require(_0x3c28('0x0'));var util=require(_0x3c28('0x1'));var moment=require(_0x3c28('0x2'));var BPromise=require(_0x3c28('0x3'));var rs=require(_0x3c28('0x4'));var fs=require('fs');var Redis=require(_0x3c28('0x5'));var db=require(_0x3c28('0x6'))['db'];var utils=require(_0x3c28('0x7'));var logger=require('../../config/logger')(_0x3c28('0x8'));var config=require('../../config/environment');var jayson=require(_0x3c28('0x9'));var client=jayson[_0x3c28('0xa')][_0x3c28('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30dc66,_0x585fb8,_0x51cce0){return new BPromise(function(_0x44ae7b,_0x21062e){return client[_0x3c28('0xc')](_0x30dc66,_0x51cce0)[_0x3c28('0xd')](function(_0x50b967){logger[_0x3c28('0xe')](_0x3c28('0xf'),_0x585fb8,'request\x20sent');logger[_0x3c28('0x10')](_0x3c28('0x11'),_0x585fb8,'request\x20sent',JSON[_0x3c28('0x12')](_0x50b967));if(_0x50b967[_0x3c28('0x13')]){if(_0x50b967[_0x3c28('0x13')]['code']===0x1f4){logger[_0x3c28('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x585fb8,_0x50b967[_0x3c28('0x13')][_0x3c28('0x14')]);return _0x21062e(_0x50b967['error'][_0x3c28('0x14')]);}logger[_0x3c28('0x13')](_0x3c28('0xf'),_0x585fb8,_0x50b967['error'][_0x3c28('0x14')]);return _0x44ae7b(_0x50b967['error'][_0x3c28('0x14')]);}else{logger['info'](_0x3c28('0xf'),_0x585fb8,_0x3c28('0x15'));_0x44ae7b(_0x50b967[_0x3c28('0x16')]['message']);}})['catch'](function(_0x1a067a){logger[_0x3c28('0x13')](_0x3c28('0xf'),_0x585fb8,_0x1a067a);_0x21062e(_0x1a067a);});});}exports['CreateChatQueueReport']=function(_0x3e967e){var _0x38eaae=this;return new Promise(function(_0xa5eb84,_0x4c3f69){return db[_0x3c28('0x17')][_0x3c28('0x18')](_0x3e967e['body'],{'raw':_0x3e967e[_0x3c28('0x19')]?_0x3e967e[_0x3c28('0x19')][_0x3c28('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x42f5c4){logger['info'](_0x3c28('0x1b'),_0x3e967e);logger[_0x3c28('0x10')](_0x3c28('0x1b'),_0x3e967e,JSON[_0x3c28('0x12')](_0x42f5c4));_0xa5eb84(_0x42f5c4);})[_0x3c28('0x1c')](function(_0x30e889){logger[_0x3c28('0x13')]('CreateChatQueueReport',_0x30e889[_0x3c28('0x14')],_0x3e967e);_0x4c3f69(_0x38eaae[_0x3c28('0x13')](0x1f4,_0x30e889[_0x3c28('0x14')]));});});};exports[_0x3c28('0x1d')]=function(_0x271bcd){var _0x5795d6=this;return new Promise(function(_0x188260,_0xbe8df){return db[_0x3c28('0x17')][_0x3c28('0x1e')](_0x271bcd[_0x3c28('0x1f')],{'raw':_0x271bcd[_0x3c28('0x19')]?_0x271bcd['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x271bcd[_0x3c28('0x19')]?_0x271bcd[_0x3c28('0x19')]['where']||null:null,'attributes':_0x271bcd[_0x3c28('0x19')]?_0x271bcd[_0x3c28('0x19')]['attributes']||null:null,'limit':_0x271bcd[_0x3c28('0x19')]?_0x271bcd['options'][_0x3c28('0x20')]||null:null})[_0x3c28('0xd')](function(_0x21d343){logger['info'](_0x3c28('0x1d'),_0x271bcd);logger['debug'](_0x3c28('0x1d'),_0x271bcd,JSON[_0x3c28('0x12')](_0x21d343));_0x188260(_0x21d343);})[_0x3c28('0x1c')](function(_0x26d26c){logger[_0x3c28('0x13')](_0x3c28('0x1d'),_0x26d26c[_0x3c28('0x14')],_0x271bcd);_0xbe8df(_0x5795d6['error'](0x1f4,_0x26d26c[_0x3c28('0x14')]));});});}; \ No newline at end of file +var _0x674d=['http','request','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','options','raw','then','UpdateChatQueueReport','update','body','limit','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1f7c5d,_0x597d4a){var _0xac5b38=function(_0x1b86f9){while(--_0x1b86f9){_0x1f7c5d['push'](_0x1f7c5d['shift']());}};_0xac5b38(++_0x597d4a);}(_0x674d,0xfe));var _0xd674=function(_0x511c6c,_0x1366f0){_0x511c6c=_0x511c6c-0x0;var _0x59d285=_0x674d[_0x511c6c];return _0x59d285;};'use strict';var _=require(_0xd674('0x0'));var util=require(_0xd674('0x1'));var moment=require(_0xd674('0x2'));var BPromise=require(_0xd674('0x3'));var rs=require(_0xd674('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd674('0x5'));var logger=require(_0xd674('0x6'))(_0xd674('0x7'));var config=require(_0xd674('0x8'));var jayson=require(_0xd674('0x9'));var client=jayson['client'][_0xd674('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18bb84,_0x2b17e0,_0x18209b){return new BPromise(function(_0x266a3a,_0xed1277){return client[_0xd674('0xb')](_0x18bb84,_0x18209b)['then'](function(_0xe20b2a){logger[_0xd674('0xc')](_0xd674('0xd'),_0x2b17e0,'request\x20sent');logger[_0xd674('0xe')](_0xd674('0xf'),_0x2b17e0,_0xd674('0x10'),JSON[_0xd674('0x11')](_0xe20b2a));if(_0xe20b2a[_0xd674('0x12')]){if(_0xe20b2a[_0xd674('0x12')][_0xd674('0x13')]===0x1f4){logger[_0xd674('0x12')](_0xd674('0xd'),_0x2b17e0,_0xe20b2a[_0xd674('0x12')][_0xd674('0x14')]);return _0xed1277(_0xe20b2a['error'][_0xd674('0x14')]);}logger[_0xd674('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x2b17e0,_0xe20b2a[_0xd674('0x12')][_0xd674('0x14')]);return _0x266a3a(_0xe20b2a[_0xd674('0x12')]['message']);}else{logger[_0xd674('0xc')]('ChatQueueReport,\x20%s,\x20%s',_0x2b17e0,'request\x20sent');_0x266a3a(_0xe20b2a[_0xd674('0x15')]['message']);}})[_0xd674('0x16')](function(_0x8e83e){logger[_0xd674('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x2b17e0,_0x8e83e);_0xed1277(_0x8e83e);});});}exports[_0xd674('0x17')]=function(_0xb34aa1){var _0x1a946a=this;return new Promise(function(_0x348074,_0x278624){return db[_0xd674('0x18')][_0xd674('0x19')](_0xb34aa1['body'],{'raw':_0xb34aa1[_0xd674('0x1a')]?_0xb34aa1['options'][_0xd674('0x1b')]===undefined?!![]:![]:!![]})[_0xd674('0x1c')](function(_0x16b263){logger[_0xd674('0xc')](_0xd674('0x17'),_0xb34aa1);logger[_0xd674('0xe')](_0xd674('0x17'),_0xb34aa1,JSON[_0xd674('0x11')](_0x16b263));_0x348074(_0x16b263);})[_0xd674('0x16')](function(_0x3d1be8){logger[_0xd674('0x12')](_0xd674('0x17'),_0x3d1be8[_0xd674('0x14')],_0xb34aa1);_0x278624(_0x1a946a[_0xd674('0x12')](0x1f4,_0x3d1be8[_0xd674('0x14')]));});});};exports[_0xd674('0x1d')]=function(_0xb44086){var _0x1eca18=this;return new Promise(function(_0x3f075b,_0x2a1768){return db[_0xd674('0x18')][_0xd674('0x1e')](_0xb44086[_0xd674('0x1f')],{'raw':_0xb44086[_0xd674('0x1a')]?_0xb44086['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb44086[_0xd674('0x1a')]?_0xb44086[_0xd674('0x1a')]['where']||null:null,'attributes':_0xb44086[_0xd674('0x1a')]?_0xb44086[_0xd674('0x1a')]['attributes']||null:null,'limit':_0xb44086['options']?_0xb44086[_0xd674('0x1a')][_0xd674('0x20')]||null:null})[_0xd674('0x1c')](function(_0x345158){logger[_0xd674('0xc')]('UpdateChatQueueReport',_0xb44086);logger[_0xd674('0xe')](_0xd674('0x1d'),_0xb44086,JSON[_0xd674('0x11')](_0x345158));_0x3f075b(_0x345158);})[_0xd674('0x16')](function(_0x1cc12e){logger[_0xd674('0x12')]('UpdateChatQueueReport',_0x1cc12e[_0xd674('0x14')],_0xb44086);_0x2a1768(_0x1eca18[_0xd674('0x12')](0x1f4,_0x1cc12e[_0xd674('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 6b2fcb9..8147e5f 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 _0x3725=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create'];(function(_0x322522,_0x4db288){var _0x293bcf=function(_0xf108b8){while(--_0xf108b8){_0x322522['push'](_0x322522['shift']());}};_0x293bcf(++_0x4db288);}(_0x3725,0x1ba));var _0x5372=function(_0x59130b,_0x4c230d){_0x59130b=_0x59130b-0x0;var _0x121e1b=_0x3725[_0x59130b];return _0x121e1b;};'use strict';var multer=require(_0x5372('0x0'));var util=require('util');var path=require(_0x5372('0x1'));var timeout=require(_0x5372('0x2'));var express=require(_0x5372('0x3'));var router=express[_0x5372('0x4')]();var fs_extra=require(_0x5372('0x5'));var auth=require(_0x5372('0x6'));var interaction=require(_0x5372('0x7'));var config=require(_0x5372('0x8'));var controller=require(_0x5372('0x9'));router[_0x5372('0xa')]('/',auth[_0x5372('0xb')](),controller[_0x5372('0xc')]);router[_0x5372('0xa')](_0x5372('0xd'),auth[_0x5372('0xb')](),controller[_0x5372('0xe')]);router[_0x5372('0xa')](_0x5372('0xf'),auth[_0x5372('0xb')](),controller[_0x5372('0x10')]);router['post']('/',auth[_0x5372('0xb')](),controller[_0x5372('0x11')]);router[_0x5372('0x12')](_0x5372('0xf'),auth[_0x5372('0xb')](),controller[_0x5372('0x13')]);router[_0x5372('0x14')](_0x5372('0xf'),auth[_0x5372('0xb')](),controller[_0x5372('0x15')]);module[_0x5372('0x16')]=router; \ No newline at end of file +var _0x8394=['show','create','put','update','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','describe','/:id'];(function(_0x6cb959,_0x5d5a05){var _0x1f257=function(_0x536fbe){while(--_0x536fbe){_0x6cb959['push'](_0x6cb959['shift']());}};_0x1f257(++_0x5d5a05);}(_0x8394,0x8b));var _0x4839=function(_0x3c0b2f,_0x243ae3){_0x3c0b2f=_0x3c0b2f-0x0;var _0x191926=_0x8394[_0x3c0b2f];return _0x191926;};'use strict';var multer=require(_0x4839('0x0'));var util=require(_0x4839('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4839('0x2'));var router=express[_0x4839('0x3')]();var fs_extra=require(_0x4839('0x4'));var auth=require(_0x4839('0x5'));var interaction=require(_0x4839('0x6'));var config=require('../../config/environment');var controller=require('./chatQueueReport.controller');router[_0x4839('0x7')]('/',auth[_0x4839('0x8')](),controller['index']);router[_0x4839('0x7')]('/describe',auth[_0x4839('0x8')](),controller[_0x4839('0x9')]);router[_0x4839('0x7')](_0x4839('0xa'),auth['isAuthenticated'](),controller[_0x4839('0xb')]);router['post']('/',auth[_0x4839('0x8')](),controller[_0x4839('0xc')]);router[_0x4839('0xd')]('/:id',auth[_0x4839('0x8')](),controller[_0x4839('0xe')]);router['delete'](_0x4839('0xa'),auth[_0x4839('0x8')](),controller['destroy']);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 02d973b..2a21c6f 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0xed3c45,_0x28d9fa){var _0x255723=function(_0x1c9339){while(--_0x1c9339){_0xed3c45['push'](_0xed3c45['shift']());}};_0x255723(++_0x28d9fa);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x4b3e49,_0x9e566c){_0x4b3e49=_0x4b3e49-0x0;var _0x57e339=_0xf3cd[_0x4b3e49];return _0x57e339;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0xd6993f,_0x445170){var _0x3f6cf8=function(_0x1c481e){while(--_0x1c481e){_0xd6993f['push'](_0xd6993f['shift']());}};_0x3f6cf8(++_0x445170);}(_0x70e0,0x17b));var _0x070e=function(_0x1764be,_0x42e773){_0x1764be=_0x1764be-0x0;var _0x55427b=_0x70e0[_0x1764be];return _0x55427b;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 93532a9..9f5e3ff 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 _0x1730=['jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','update','destroy','end','error','name','send','map','ChatTransferReport','type','keys','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','then','include','findAll','catch','rawAttributes','includeAll','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','crypto'];(function(_0xc80f71,_0x218f08){var _0x5644b6=function(_0x53db7b){while(--_0x53db7b){_0xc80f71['push'](_0xc80f71['shift']());}};_0x5644b6(++_0x218f08);}(_0x1730,0x187));var _0x0173=function(_0x8088ea,_0x389b70){_0x8088ea=_0x8088ea-0x0;var _0x27c8a8=_0x1730[_0x8088ea];return _0x27c8a8;};'use strict';var emlformat=require(_0x0173('0x0'));var rimraf=require(_0x0173('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0173('0x2'));var rp=require(_0x0173('0x3'));var moment=require(_0x0173('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0173('0x5'));var util=require('util');var path=require('path');var sox=require(_0x0173('0x6'));var csv=require(_0x0173('0x7'));var ejs=require(_0x0173('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0173('0x9'));var squel=require('squel');var crypto=require(_0x0173('0xa'));var jsforce=require(_0x0173('0xb'));var deskjs=require(_0x0173('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0173('0xd'));var Papa=require('papaparse');var Redis=require(_0x0173('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0173('0xf'));var as=require(_0x0173('0x10'));var hardwareService=require(_0x0173('0x11'));var logger=require(_0x0173('0x12'))('api');var utils=require(_0x0173('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x0173('0x14'));var db=require(_0x0173('0x15'))['db'];function respondWithStatusCode(_0x5af21b,_0x221d45){_0x221d45=_0x221d45||0xcc;return function(_0x38c7fa){if(_0x38c7fa){return _0x5af21b[_0x0173('0x16')](_0x221d45);}return _0x5af21b[_0x0173('0x17')](_0x221d45)['end']();};}function respondWithResult(_0x35e6c9,_0x83fd47){_0x83fd47=_0x83fd47||0xc8;return function(_0x10c2c8){if(_0x10c2c8){return _0x35e6c9[_0x0173('0x17')](_0x83fd47)[_0x0173('0x18')](_0x10c2c8);}};}function respondWithFilteredResult(_0x1ed5f5,_0x4c15b3){return function(_0x216ab7){if(_0x216ab7){var _0x5d2be9=typeof _0x4c15b3[_0x0173('0x19')]===_0x0173('0x1a')&&typeof _0x4c15b3[_0x0173('0x1b')]===_0x0173('0x1a');var _0x4c9b90=_0x216ab7['count'];var _0x2e393d=_0x5d2be9?0x0:_0x4c15b3[_0x0173('0x19')];var _0xb1d8ef=_0x5d2be9?_0x216ab7[_0x0173('0x1c')]:_0x4c15b3[_0x0173('0x19')]+_0x4c15b3[_0x0173('0x1b')];var _0x2795e5;if(_0xb1d8ef>=_0x4c9b90){_0xb1d8ef=_0x4c9b90;_0x2795e5=0xc8;}else{_0x2795e5=0xce;}_0x1ed5f5[_0x0173('0x17')](_0x2795e5);return _0x1ed5f5['set'](_0x0173('0x1d'),_0x2e393d+'-'+_0xb1d8ef+'/'+_0x4c9b90)[_0x0173('0x18')](_0x216ab7);}return null;};}function patchUpdates(_0x5298e2){return function(_0x56c3b9){try{jsonpatch['apply'](_0x56c3b9,_0x5298e2,!![]);}catch(_0x3373d1){return BPromise['reject'](_0x3373d1);}return _0x56c3b9[_0x0173('0x1e')]();};}function saveUpdates(_0x34d265,_0x35dd2a){return function(_0x4781e5){if(_0x4781e5){return _0x4781e5[_0x0173('0x1f')](_0x34d265)['then'](function(_0x4547f2){return _0x4547f2;});}return null;};}function removeEntity(_0x28670d,_0x26a7ac){return function(_0x329d79){if(_0x329d79){return _0x329d79[_0x0173('0x20')]()['then'](function(){_0x28670d['status'](0xcc)[_0x0173('0x21')]();});}};}function handleEntityNotFound(_0x322686,_0x4a87a5){return function(_0x2bc8f5){if(!_0x2bc8f5){_0x322686[_0x0173('0x16')](0x194);}return _0x2bc8f5;};}function handleError(_0xe73ab6,_0x4b5ee6){_0x4b5ee6=_0x4b5ee6||0x1f4;return function(_0x2a4544){logger[_0x0173('0x22')](_0x2a4544['stack']);if(_0x2a4544[_0x0173('0x23')]){delete _0x2a4544[_0x0173('0x23')];}_0xe73ab6[_0x0173('0x17')](_0x4b5ee6)[_0x0173('0x24')](_0x2a4544);};}exports['index']=function(_0x48d3f3,_0x312e64){var _0x90638b={},_0x123bf0={},_0x550a96={'count':0x0,'rows':[]};var _0x12c230=_[_0x0173('0x25')](db[_0x0173('0x26')]['rawAttributes'],function(_0x3e469c){return{'name':_0x3e469c['fieldName'],'type':_0x3e469c[_0x0173('0x27')]['key']};});_0x123bf0['model']=_['map'](_0x12c230,_0x0173('0x23'));_0x123bf0['query']=_[_0x0173('0x28')](_0x48d3f3[_0x0173('0x29')]);_0x123bf0['filters']=_['intersection'](_0x123bf0[_0x0173('0x2a')],_0x123bf0['query']);_0x90638b[_0x0173('0x2b')]=_[_0x0173('0x2c')](_0x123bf0['model'],qs[_0x0173('0x2d')](_0x48d3f3[_0x0173('0x29')][_0x0173('0x2d')]));_0x90638b[_0x0173('0x2b')]=_0x90638b[_0x0173('0x2b')][_0x0173('0x2e')]?_0x90638b[_0x0173('0x2b')]:_0x123bf0[_0x0173('0x2a')];if(!_0x48d3f3[_0x0173('0x29')][_0x0173('0x2f')](_0x0173('0x30'))){_0x90638b['limit']=qs['limit'](_0x48d3f3['query'][_0x0173('0x1b')]);_0x90638b[_0x0173('0x19')]=qs['offset'](_0x48d3f3[_0x0173('0x29')][_0x0173('0x19')]);}_0x90638b[_0x0173('0x31')]=qs[_0x0173('0x32')](_0x48d3f3[_0x0173('0x29')]['sort']);_0x90638b[_0x0173('0x33')]=qs[_0x0173('0x34')](_['pick'](_0x48d3f3[_0x0173('0x29')],_0x123bf0[_0x0173('0x34')]),_0x12c230);if(_0x48d3f3[_0x0173('0x29')][_0x0173('0x35')]){_0x90638b[_0x0173('0x33')]=_[_0x0173('0x36')](_0x90638b[_0x0173('0x33')],{'$or':_[_0x0173('0x25')](_0x12c230,function(_0x113509){if(_0x113509['type']!=='VIRTUAL'){var _0x58d149={};_0x58d149[_0x113509[_0x0173('0x23')]]={'$like':'%'+_0x48d3f3['query'][_0x0173('0x35')]+'%'};return _0x58d149;}})});}_0x90638b=_[_0x0173('0x36')]({},_0x90638b,_0x48d3f3[_0x0173('0x37')]);var _0x410708={'where':_0x90638b[_0x0173('0x33')]};return db['ChatTransferReport']['count'](_0x410708)[_0x0173('0x38')](function(_0x39dd1a){_0x550a96[_0x0173('0x1c')]=_0x39dd1a;if(_0x48d3f3[_0x0173('0x29')]['includeAll']){_0x90638b[_0x0173('0x39')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x0173('0x3a')](_0x90638b);})[_0x0173('0x38')](function(_0x26476d){_0x550a96['rows']=_0x26476d;return _0x550a96;})[_0x0173('0x38')](respondWithFilteredResult(_0x312e64,_0x90638b))[_0x0173('0x3b')](handleError(_0x312e64,null));};exports['show']=function(_0x2767b1,_0x44bc49){var _0x3b84e7={'raw':!![],'where':{'id':_0x2767b1['params']['id']}},_0x40b98b={};_0x40b98b[_0x0173('0x2a')]=_['keys'](db[_0x0173('0x26')][_0x0173('0x3c')]);_0x40b98b[_0x0173('0x29')]=_['keys'](_0x2767b1[_0x0173('0x29')]);_0x40b98b[_0x0173('0x34')]=_['intersection'](_0x40b98b[_0x0173('0x2a')],_0x40b98b[_0x0173('0x29')]);_0x3b84e7[_0x0173('0x2b')]=_[_0x0173('0x2c')](_0x40b98b['model'],qs['fields'](_0x2767b1[_0x0173('0x29')][_0x0173('0x2d')]));_0x3b84e7[_0x0173('0x2b')]=_0x3b84e7['attributes'][_0x0173('0x2e')]?_0x3b84e7[_0x0173('0x2b')]:_0x40b98b[_0x0173('0x2a')];if(_0x2767b1[_0x0173('0x29')][_0x0173('0x3d')]){_0x3b84e7[_0x0173('0x39')]=[{'all':!![]}];}_0x3b84e7=_[_0x0173('0x36')]({},_0x3b84e7,_0x2767b1[_0x0173('0x37')]);return db[_0x0173('0x26')][_0x0173('0x3e')](_0x3b84e7)[_0x0173('0x38')](handleEntityNotFound(_0x44bc49,null))[_0x0173('0x38')](respondWithResult(_0x44bc49,null))[_0x0173('0x3b')](handleError(_0x44bc49,null));};exports[_0x0173('0x3f')]=function(_0x234cef,_0x1cbc88){return db[_0x0173('0x26')]['create'](_0x234cef[_0x0173('0x40')],{})[_0x0173('0x38')](respondWithResult(_0x1cbc88,0xc9))[_0x0173('0x3b')](handleError(_0x1cbc88,null));};exports[_0x0173('0x1f')]=function(_0x38f69d,_0x418e86){if(_0x38f69d[_0x0173('0x40')]['id']){delete _0x38f69d[_0x0173('0x40')]['id'];}return db[_0x0173('0x26')]['find']({'where':{'id':_0x38f69d[_0x0173('0x41')]['id']}})['then'](handleEntityNotFound(_0x418e86,null))[_0x0173('0x38')](saveUpdates(_0x38f69d[_0x0173('0x40')],null))[_0x0173('0x38')](respondWithResult(_0x418e86,null))[_0x0173('0x3b')](handleError(_0x418e86,null));};exports[_0x0173('0x20')]=function(_0x467490,_0x438bfd){return db[_0x0173('0x26')][_0x0173('0x3e')]({'where':{'id':_0x467490[_0x0173('0x41')]['id']}})[_0x0173('0x38')](handleEntityNotFound(_0x438bfd,null))['then'](removeEntity(_0x438bfd,null))[_0x0173('0x3b')](handleError(_0x438bfd,null));};exports[_0x0173('0x42')]=function(_0x4e793a,_0x52eb6a){return db['ChatTransferReport'][_0x0173('0x42')]()[_0x0173('0x38')](respondWithResult(_0x52eb6a,null))[_0x0173('0x3b')](handleError(_0x52eb6a,null));}; \ No newline at end of file +var _0x01d1=['../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','error','name','send','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','ChatTransferReport','includeAll','include','findAll','catch','show','params','length','create','body','update','find','destroy','describe','rimraf','fast-json-patch','moment','mustache','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'];(function(_0x29f938,_0x8a14a2){var _0xa05394=function(_0x4d31fc){while(--_0x4d31fc){_0x29f938['push'](_0x29f938['shift']());}};_0xa05394(++_0x8a14a2);}(_0x01d1,0x160));var _0x101d=function(_0x548eae,_0xad69de){_0x548eae=_0x548eae-0x0;var _0x5b1a01=_0x01d1[_0x548eae];return _0x5b1a01;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x101d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x101d('0x1'));var rp=require('request-promise');var moment=require(_0x101d('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x101d('0x3'));var util=require(_0x101d('0x4'));var path=require('path');var sox=require(_0x101d('0x5'));var csv=require(_0x101d('0x6'));var ejs=require(_0x101d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x101d('0x8'));var squel=require(_0x101d('0x9'));var crypto=require(_0x101d('0xa'));var jsforce=require(_0x101d('0xb'));var deskjs=require(_0x101d('0xc'));var toCsv=require(_0x101d('0x6'));var querystring=require(_0x101d('0xd'));var Papa=require(_0x101d('0xe'));var Redis=require(_0x101d('0xf'));var authService=require(_0x101d('0x10'));var qs=require(_0x101d('0x11'));var as=require(_0x101d('0x12'));var hardwareService=require(_0x101d('0x13'));var logger=require(_0x101d('0x14'))('api');var utils=require(_0x101d('0x15'));var config=require(_0x101d('0x16'));var licenseUtil=require(_0x101d('0x17'));var db=require(_0x101d('0x18'))['db'];function respondWithStatusCode(_0x389e06,_0x1ddb5e){_0x1ddb5e=_0x1ddb5e||0xcc;return function(_0x2c7474){if(_0x2c7474){return _0x389e06[_0x101d('0x19')](_0x1ddb5e);}return _0x389e06[_0x101d('0x1a')](_0x1ddb5e)[_0x101d('0x1b')]();};}function respondWithResult(_0xc97233,_0x52a508){_0x52a508=_0x52a508||0xc8;return function(_0x47554a){if(_0x47554a){return _0xc97233[_0x101d('0x1a')](_0x52a508)['json'](_0x47554a);}};}function respondWithFilteredResult(_0x536541,_0x12591f){return function(_0x5987db){if(_0x5987db){var _0x42550e=typeof _0x12591f[_0x101d('0x1c')]===_0x101d('0x1d')&&typeof _0x12591f[_0x101d('0x1e')]===_0x101d('0x1d');var _0x450119=_0x5987db[_0x101d('0x1f')];var _0x84d9dc=_0x42550e?0x0:_0x12591f['offset'];var _0x118ff3=_0x42550e?_0x5987db[_0x101d('0x1f')]:_0x12591f['offset']+_0x12591f['limit'];var _0x5065b6;if(_0x118ff3>=_0x450119){_0x118ff3=_0x450119;_0x5065b6=0xc8;}else{_0x5065b6=0xce;}_0x536541['status'](_0x5065b6);return _0x536541[_0x101d('0x20')](_0x101d('0x21'),_0x84d9dc+'-'+_0x118ff3+'/'+_0x450119)[_0x101d('0x22')](_0x5987db);}return null;};}function patchUpdates(_0x25bb52){return function(_0x26745d){try{jsonpatch[_0x101d('0x23')](_0x26745d,_0x25bb52,!![]);}catch(_0x42fa5d){return BPromise['reject'](_0x42fa5d);}return _0x26745d[_0x101d('0x24')]();};}function saveUpdates(_0x536196,_0x32db02){return function(_0x42fce2){if(_0x42fce2){return _0x42fce2['update'](_0x536196)[_0x101d('0x25')](function(_0x3aa436){return _0x3aa436;});}return null;};}function removeEntity(_0x13094a,_0x4e5753){return function(_0x51643b){if(_0x51643b){return _0x51643b['destroy']()['then'](function(){_0x13094a[_0x101d('0x1a')](0xcc)[_0x101d('0x1b')]();});}};}function handleEntityNotFound(_0x4859ce,_0x31e3da){return function(_0x1440f2){if(!_0x1440f2){_0x4859ce['sendStatus'](0x194);}return _0x1440f2;};}function handleError(_0x2204e2,_0x53bac5){_0x53bac5=_0x53bac5||0x1f4;return function(_0x465f96){logger[_0x101d('0x26')](_0x465f96['stack']);if(_0x465f96[_0x101d('0x27')]){delete _0x465f96[_0x101d('0x27')];}_0x2204e2[_0x101d('0x1a')](_0x53bac5)[_0x101d('0x28')](_0x465f96);};}exports['index']=function(_0x3c5983,_0xe97f64){var _0x5ca07c={},_0x2d7786={},_0xa3b7b4={'count':0x0,'rows':[]};var _0x936216=_['map'](db['ChatTransferReport'][_0x101d('0x29')],function(_0x498164){return{'name':_0x498164['fieldName'],'type':_0x498164[_0x101d('0x2a')][_0x101d('0x2b')]};});_0x2d7786[_0x101d('0x2c')]=_[_0x101d('0x2d')](_0x936216,_0x101d('0x27'));_0x2d7786[_0x101d('0x2e')]=_[_0x101d('0x2f')](_0x3c5983[_0x101d('0x2e')]);_0x2d7786[_0x101d('0x30')]=_[_0x101d('0x31')](_0x2d7786[_0x101d('0x2c')],_0x2d7786['query']);_0x5ca07c['attributes']=_[_0x101d('0x31')](_0x2d7786[_0x101d('0x2c')],qs[_0x101d('0x32')](_0x3c5983['query'][_0x101d('0x32')]));_0x5ca07c[_0x101d('0x33')]=_0x5ca07c[_0x101d('0x33')]['length']?_0x5ca07c['attributes']:_0x2d7786[_0x101d('0x2c')];if(!_0x3c5983[_0x101d('0x2e')][_0x101d('0x34')](_0x101d('0x35'))){_0x5ca07c['limit']=qs[_0x101d('0x1e')](_0x3c5983[_0x101d('0x2e')][_0x101d('0x1e')]);_0x5ca07c[_0x101d('0x1c')]=qs[_0x101d('0x1c')](_0x3c5983[_0x101d('0x2e')][_0x101d('0x1c')]);}_0x5ca07c[_0x101d('0x36')]=qs[_0x101d('0x37')](_0x3c5983['query'][_0x101d('0x37')]);_0x5ca07c['where']=qs[_0x101d('0x30')](_['pick'](_0x3c5983[_0x101d('0x2e')],_0x2d7786[_0x101d('0x30')]),_0x936216);if(_0x3c5983[_0x101d('0x2e')][_0x101d('0x38')]){_0x5ca07c[_0x101d('0x39')]=_[_0x101d('0x3a')](_0x5ca07c[_0x101d('0x39')],{'$or':_[_0x101d('0x2d')](_0x936216,function(_0x1a0cd2){if(_0x1a0cd2['type']!==_0x101d('0x3b')){var _0x446403={};_0x446403[_0x1a0cd2[_0x101d('0x27')]]={'$like':'%'+_0x3c5983[_0x101d('0x2e')][_0x101d('0x38')]+'%'};return _0x446403;}})});}_0x5ca07c=_[_0x101d('0x3a')]({},_0x5ca07c,_0x3c5983[_0x101d('0x3c')]);var _0x55cbef={'where':_0x5ca07c['where']};return db[_0x101d('0x3d')][_0x101d('0x1f')](_0x55cbef)[_0x101d('0x25')](function(_0x546496){_0xa3b7b4[_0x101d('0x1f')]=_0x546496;if(_0x3c5983[_0x101d('0x2e')][_0x101d('0x3e')]){_0x5ca07c[_0x101d('0x3f')]=[{'all':!![]}];}return db[_0x101d('0x3d')][_0x101d('0x40')](_0x5ca07c);})[_0x101d('0x25')](function(_0x14762f){_0xa3b7b4['rows']=_0x14762f;return _0xa3b7b4;})[_0x101d('0x25')](respondWithFilteredResult(_0xe97f64,_0x5ca07c))[_0x101d('0x41')](handleError(_0xe97f64,null));};exports[_0x101d('0x42')]=function(_0x24486d,_0x117ed4){var _0x346e14={'raw':!![],'where':{'id':_0x24486d[_0x101d('0x43')]['id']}},_0x25e80a={};_0x25e80a['model']=_[_0x101d('0x2f')](db['ChatTransferReport'][_0x101d('0x29')]);_0x25e80a[_0x101d('0x2e')]=_[_0x101d('0x2f')](_0x24486d[_0x101d('0x2e')]);_0x25e80a[_0x101d('0x30')]=_['intersection'](_0x25e80a[_0x101d('0x2c')],_0x25e80a[_0x101d('0x2e')]);_0x346e14['attributes']=_[_0x101d('0x31')](_0x25e80a[_0x101d('0x2c')],qs['fields'](_0x24486d[_0x101d('0x2e')]['fields']));_0x346e14['attributes']=_0x346e14[_0x101d('0x33')][_0x101d('0x44')]?_0x346e14[_0x101d('0x33')]:_0x25e80a[_0x101d('0x2c')];if(_0x24486d[_0x101d('0x2e')][_0x101d('0x3e')]){_0x346e14[_0x101d('0x3f')]=[{'all':!![]}];}_0x346e14=_[_0x101d('0x3a')]({},_0x346e14,_0x24486d[_0x101d('0x3c')]);return db[_0x101d('0x3d')]['find'](_0x346e14)['then'](handleEntityNotFound(_0x117ed4,null))[_0x101d('0x25')](respondWithResult(_0x117ed4,null))[_0x101d('0x41')](handleError(_0x117ed4,null));};exports['create']=function(_0x57d337,_0x5c059f){return db['ChatTransferReport'][_0x101d('0x45')](_0x57d337[_0x101d('0x46')],{})[_0x101d('0x25')](respondWithResult(_0x5c059f,0xc9))[_0x101d('0x41')](handleError(_0x5c059f,null));};exports[_0x101d('0x47')]=function(_0x288c63,_0x3eb454){if(_0x288c63['body']['id']){delete _0x288c63[_0x101d('0x46')]['id'];}return db['ChatTransferReport'][_0x101d('0x48')]({'where':{'id':_0x288c63[_0x101d('0x43')]['id']}})[_0x101d('0x25')](handleEntityNotFound(_0x3eb454,null))[_0x101d('0x25')](saveUpdates(_0x288c63[_0x101d('0x46')],null))[_0x101d('0x25')](respondWithResult(_0x3eb454,null))['catch'](handleError(_0x3eb454,null));};exports[_0x101d('0x49')]=function(_0x414ce4,_0x3d6334){return db[_0x101d('0x3d')][_0x101d('0x48')]({'where':{'id':_0x414ce4[_0x101d('0x43')]['id']}})[_0x101d('0x25')](handleEntityNotFound(_0x3d6334,null))['then'](removeEntity(_0x3d6334,null))['catch'](handleError(_0x3d6334,null));};exports['describe']=function(_0x4236c6,_0x47494a){return db[_0x101d('0x3d')][_0x101d('0x4a')]()['then'](respondWithResult(_0x47494a,null))[_0x101d('0x41')](handleError(_0x47494a,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 70ffcc6..14ba0bf 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 _0x9bcb=['path','rimraf','./chatTransferReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x4b55c8,_0x490d98){var _0x13b1c8=function(_0x16f218){while(--_0x16f218){_0x4b55c8['push'](_0x4b55c8['shift']());}};_0x13b1c8(++_0x490d98);}(_0x9bcb,0x1b6));var _0xb9bc=function(_0x26ac59,_0x4973e8){_0x26ac59=_0x26ac59-0x0;var _0x101852=_0x9bcb[_0x26ac59];return _0x101852;};'use strict';var _=require(_0xb9bc('0x0'));var util=require(_0xb9bc('0x1'));var logger=require(_0xb9bc('0x2'))(_0xb9bc('0x3'));var moment=require(_0xb9bc('0x4'));var BPromise=require('bluebird');var rp=require(_0xb9bc('0x5'));var fs=require('fs');var path=require(_0xb9bc('0x6'));var rimraf=require(_0xb9bc('0x7'));var config=require('../../config/environment');var attributes=require(_0xb9bc('0x8'));module[_0xb9bc('0x9')]=function(_0x10cf67,_0x48f0cd){return _0x10cf67[_0xb9bc('0xa')]('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xb9bc('0xb'),'fields':[_0xb9bc('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3921=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./chatTransferReport.attributes','exports','define','ChatTransferReport','uniqueid'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3921,0x12c));var _0x1392=function(_0x2a8695,_0x4b5f91){_0x2a8695=_0x2a8695-0x0;var _0x439f05=_0x3921[_0x2a8695];return _0x439f05;};'use strict';var _=require(_0x1392('0x0'));var util=require(_0x1392('0x1'));var logger=require(_0x1392('0x2'))('api');var moment=require(_0x1392('0x3'));var BPromise=require(_0x1392('0x4'));var rp=require(_0x1392('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1392('0x6'));var config=require('../../config/environment');var attributes=require(_0x1392('0x7'));module[_0x1392('0x8')]=function(_0x1c5fc7,_0x13e293){return _0x1c5fc7[_0x1392('0x9')](_0x1392('0xa'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x1392('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index fba5c7a..0440fbd 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 _0x8c4d=['message','result','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','info','request\x20sent','error','code','ChatTransferReport,\x20%s,\x20%s'];(function(_0x3aa8eb,_0x24ef37){var _0x3de7ee=function(_0x49ff31){while(--_0x49ff31){_0x3aa8eb['push'](_0x3aa8eb['shift']());}};_0x3de7ee(++_0x24ef37);}(_0x8c4d,0xb8));var _0xd8c4=function(_0x448255,_0x2e681d){_0x448255=_0x448255-0x0;var _0x55d7ec=_0x8c4d[_0x448255];return _0x55d7ec;};'use strict';var _=require(_0xd8c4('0x0'));var util=require('util');var moment=require(_0xd8c4('0x1'));var BPromise=require('bluebird');var rs=require(_0xd8c4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd8c4('0x3'))['db'];var utils=require(_0xd8c4('0x4'));var logger=require('../../config/logger')(_0xd8c4('0x5'));var config=require(_0xd8c4('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1c2135,_0x5b0020,_0x5104a9){return new BPromise(function(_0x1cafa2,_0x810d6c){return client['request'](_0x1c2135,_0x5104a9)['then'](function(_0x53c8b7){logger[_0xd8c4('0x7')]('ChatTransferReport,\x20%s,\x20%s',_0x5b0020,_0xd8c4('0x8'));logger['debug']('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x5b0020,'request\x20sent',JSON['stringify'](_0x53c8b7));if(_0x53c8b7[_0xd8c4('0x9')]){if(_0x53c8b7[_0xd8c4('0x9')][_0xd8c4('0xa')]===0x1f4){logger[_0xd8c4('0x9')](_0xd8c4('0xb'),_0x5b0020,_0x53c8b7[_0xd8c4('0x9')][_0xd8c4('0xc')]);return _0x810d6c(_0x53c8b7[_0xd8c4('0x9')][_0xd8c4('0xc')]);}logger[_0xd8c4('0x9')](_0xd8c4('0xb'),_0x5b0020,_0x53c8b7[_0xd8c4('0x9')]['message']);return _0x1cafa2(_0x53c8b7[_0xd8c4('0x9')]['message']);}else{logger[_0xd8c4('0x7')](_0xd8c4('0xb'),_0x5b0020,_0xd8c4('0x8'));_0x1cafa2(_0x53c8b7[_0xd8c4('0xd')][_0xd8c4('0xc')]);}})['catch'](function(_0x4ec217){logger[_0xd8c4('0x9')](_0xd8c4('0xb'),_0x5b0020,_0x4ec217);_0x810d6c(_0x4ec217);});});} \ No newline at end of file +var _0x7280=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring'];(function(_0x34879b,_0x9891f){var _0x4fe6aa=function(_0x1cf14e){while(--_0x1cf14e){_0x34879b['push'](_0x34879b['shift']());}};_0x4fe6aa(++_0x9891f);}(_0x7280,0x11a));var _0x0728=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x7280[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require('lodash');var util=require(_0x0728('0x0'));var moment=require(_0x0728('0x1'));var BPromise=require(_0x0728('0x2'));var rs=require(_0x0728('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0728('0x4'))['db'];var utils=require(_0x0728('0x5'));var logger=require('../../config/logger')(_0x0728('0x6'));var config=require(_0x0728('0x7'));var jayson=require(_0x0728('0x8'));var client=jayson[_0x0728('0x9')][_0x0728('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cc3f9,_0x35b620,_0x245ffa){return new BPromise(function(_0x37aca1,_0x1ff726){return client[_0x0728('0xb')](_0x3cc3f9,_0x245ffa)[_0x0728('0xc')](function(_0x1038d6){logger[_0x0728('0xd')](_0x0728('0xe'),_0x35b620,'request\x20sent');logger['debug'](_0x0728('0xf'),_0x35b620,_0x0728('0x10'),JSON[_0x0728('0x11')](_0x1038d6));if(_0x1038d6[_0x0728('0x12')]){if(_0x1038d6[_0x0728('0x12')][_0x0728('0x13')]===0x1f4){logger[_0x0728('0x12')](_0x0728('0xe'),_0x35b620,_0x1038d6[_0x0728('0x12')][_0x0728('0x14')]);return _0x1ff726(_0x1038d6[_0x0728('0x12')][_0x0728('0x14')]);}logger[_0x0728('0x12')](_0x0728('0xe'),_0x35b620,_0x1038d6[_0x0728('0x12')][_0x0728('0x14')]);return _0x37aca1(_0x1038d6[_0x0728('0x12')][_0x0728('0x14')]);}else{logger[_0x0728('0xd')](_0x0728('0xe'),_0x35b620,'request\x20sent');_0x37aca1(_0x1038d6['result'][_0x0728('0x14')]);}})[_0x0728('0x15')](function(_0x3307dd){logger[_0x0728('0x12')](_0x0728('0xe'),_0x35b620,_0x3307dd);_0x1ff726(_0x3307dd);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 1f615f2..63a04af 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 _0x55fc=['isAuthenticated','index','get','/describe','post','create','put','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller'];(function(_0x214ad7,_0x493952){var _0x4b5334=function(_0x4003e5){while(--_0x4003e5){_0x214ad7['push'](_0x214ad7['shift']());}};_0x4b5334(++_0x493952);}(_0x55fc,0x170));var _0xc55f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x55fc[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc55f('0x0'));var util=require(_0xc55f('0x1'));var path=require(_0xc55f('0x2'));var timeout=require(_0xc55f('0x3'));var express=require(_0xc55f('0x4'));var router=express[_0xc55f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc55f('0x6'));var interaction=require(_0xc55f('0x7'));var config=require(_0xc55f('0x8'));var controller=require(_0xc55f('0x9'));router['get']('/',auth[_0xc55f('0xa')](),controller[_0xc55f('0xb')]);router[_0xc55f('0xc')](_0xc55f('0xd'),auth[_0xc55f('0xa')](),controller['describe']);router[_0xc55f('0xc')]('/:id',auth[_0xc55f('0xa')](),controller['show']);router[_0xc55f('0xe')]('/',auth[_0xc55f('0xa')](),controller[_0xc55f('0xf')]);router[_0xc55f('0x10')]('/:id',auth[_0xc55f('0xa')](),controller['update']);router[_0xc55f('0x11')](_0xc55f('0x12'),auth[_0xc55f('0xa')](),controller[_0xc55f('0x13')]);module[_0xc55f('0x14')]=router; \ No newline at end of file +var _0x4510=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy'];(function(_0x13c174,_0xda25fe){var _0x160654=function(_0x1b6ac2){while(--_0x1b6ac2){_0x13c174['push'](_0x13c174['shift']());}};_0x160654(++_0xda25fe);}(_0x4510,0x17d));var _0x0451=function(_0x3a32e8,_0x274dcb){_0x3a32e8=_0x3a32e8-0x0;var _0xc379f8=_0x4510[_0x3a32e8];return _0xc379f8;};'use strict';var multer=require('multer');var util=require(_0x0451('0x0'));var path=require(_0x0451('0x1'));var timeout=require(_0x0451('0x2'));var express=require(_0x0451('0x3'));var router=express[_0x0451('0x4')]();var fs_extra=require(_0x0451('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0451('0x6'));var config=require('../../config/environment');var controller=require('./chatTransferReport.controller');router[_0x0451('0x7')]('/',auth[_0x0451('0x8')](),controller[_0x0451('0x9')]);router['get'](_0x0451('0xa'),auth[_0x0451('0x8')](),controller[_0x0451('0xb')]);router[_0x0451('0x7')](_0x0451('0xc'),auth[_0x0451('0x8')](),controller[_0x0451('0xd')]);router[_0x0451('0xe')]('/',auth[_0x0451('0x8')](),controller[_0x0451('0xf')]);router['put'](_0x0451('0xc'),auth[_0x0451('0x8')](),controller[_0x0451('0x10')]);router[_0x0451('0x11')]('/:id',auth[_0x0451('0x8')](),controller[_0x0451('0x12')]);module[_0x0451('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index bca3335..1c7876a 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 _0x1270=['mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','exports','STRING','address','email','Agent','#011F6A','#ffffff','ENUM','rounded','squared','We\x20are\x20here!','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','BOOLEAN','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','thumb','TEXT','input','name','text','getDataValue','onlineForm','parse','stringify','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1270,0x1d6));var _0x0127=function(_0x202a21,_0x3c4b9e){_0x202a21=_0x202a21-0x0;var _0x3c04a6=_0x1270[_0x202a21];return _0x3c04a6;};'use strict';var Sequelize=require(_0x0127('0x0'));var rs=require('randomstring');module[_0x0127('0x1')]={'name':{'type':Sequelize[_0x0127('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x0127('0x2')],'allowNull':![],'unique':_0x0127('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x0127('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x0127('0x5')},'customerAlias':{'type':Sequelize[_0x0127('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x0127('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x0127('0x2')],'allowNull':![],'defaultValue':_0x0127('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x0127('0x2')],'allowNull':![],'defaultValue':_0x0127('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x0127('0x2')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x0127('0x8')](_0x0127('0x9'),_0x0127('0xa')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x0127('0x2')],'defaultValue':_0x0127('0xb')},'start_chat_button':{'type':Sequelize[_0x0127('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x0127('0x2')],'defaultValue':_0x0127('0xc')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x0127('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x0127('0xe')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x0127('0x2')],'defaultValue':_0x0127('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x0127('0x10')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x0127('0x2')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x0127('0x2')],'defaultValue':_0x0127('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x0127('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x0127('0x2')],'defaultValue':_0x0127('0x12')},'placeholderMessage':{'type':Sequelize[_0x0127('0x2')],'defaultValue':_0x0127('0x13')},'closingMessage':{'type':Sequelize[_0x0127('0x2')],'defaultValue':_0x0127('0x14')},'closingMessageButton':{'type':Sequelize[_0x0127('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x0127('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x0127('0x10')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x0127('0x10')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x0127('0x10')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x0127('0x2')],'defaultValue':_0x0127('0x15')},'ratingType':{'type':Sequelize[_0x0127('0x8')](_0x0127('0x16'),_0x0127('0x17')),'defaultValue':_0x0127('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x0127('0xe')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x0127('0x18')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x0127('0x19'),'variable':null,'config':{'placeholder':_0x0127('0x1a'),'type':_0x0127('0x1b'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':'input','props':{'title':_0x0127('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x0127('0x4'),'type':_0x0127('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x0127('0x1c')](_0x0127('0x1d'))?JSON[_0x0127('0x1e')](this[_0x0127('0x1c')](_0x0127('0x1d'))):{};},'set':function(_0x2cc018){return this['setDataValue'](_0x0127('0x1d'),JSON[_0x0127('0x1f')](_0x2cc018));}},'offlineForm':{'type':Sequelize[_0x0127('0x18')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','props':{'title':_0x0127('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x0127('0x4')},'variable':null},{'type':_0x0127('0x20'),'config':{'placeholder':_0x0127('0x21')},'props':{'title':_0x0127('0x21'),'helpText':_0x0127('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x0127('0x1c')]('offlineForm')?JSON[_0x0127('0x1e')](this['getDataValue'](_0x0127('0x23'))):{};},'set':function(_0x1d7ad6){return this[_0x0127('0x24')]('offlineForm',JSON[_0x0127('0x1f')](_0x1d7ad6));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x0127('0x10')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x0127('0x10')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x0127('0x10')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x0127('0x10')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x0127('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x0127('0x25')},'waitingMessage':{'type':Sequelize[_0x0127('0x2')],'defaultValue':_0x0127('0x26')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x0127('0x27')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x0127('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0x0127('0x10')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x0127('0x29')},'skipUnmanaged':{'type':Sequelize[_0x0127('0x2')],'defaultValue':_0x0127('0x2a')},'sendUnmanaged':{'type':Sequelize[_0x0127('0x2')],'defaultValue':_0x0127('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0x0127('0x10')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x0127('0x10')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x0127('0x18')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x0127('0x18')],'defaultValue':function(){return _0x0127('0x2b');}},'notificationSound':{'type':Sequelize[_0x0127('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0127('0x10')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x0127('0x10')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x0127('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize[_0x0127('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x0127('0x2')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x0127('0xe')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x0127('0x2')],'defaultValue':_0x0127('0x2d')},'defaultTitle':{'type':Sequelize[_0x0127('0x2')]},'customerAvatar':{'type':Sequelize[_0x0127('0x18')]},'showCustomerAvatar':{'type':Sequelize[_0x0127('0x10')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x0127('0xe')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x0127('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0127('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0127('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0127('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x0127('0x2')],'defaultValue':_0x0127('0x2e')},'systemAvatar':{'type':Sequelize[_0x0127('0x18')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0127('0xe')],'comment':_0x0127('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0x0127('0x10')],'defaultValue':![],'comment':_0x0127('0x30'),'set':function(_0x5c4e57){if(!_0x5c4e57)this[_0x0127('0x24')](_0x0127('0x31'),null);this['setDataValue'](_0x0127('0x32'),_0x5c4e57);}},'vidaooEscalation':{'type':Sequelize[_0x0127('0x10')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x0127('0x2')]},'vidaooTopic':{'type':Sequelize[_0x0127('0x2')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0x0127('0x2')],'defaultValue':function(){return _0x0127('0x33');}},'vidaooMetadata':{'type':Sequelize[_0x0127('0x18')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x0127('0x18')]}}; \ No newline at end of file +var _0x3d51=['rounded','squared','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','text','name','input','onlineForm','parse','getDataValue','setDataValue','stringify','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','exports','STRING','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x3d51,0xf6));var _0x13d5=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x3d51[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x13d5('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x13d5('0x1')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x13d5('0x1')],'defaultValue':_0x13d5('0x2')},'mapKeyOffline':{'type':Sequelize[_0x13d5('0x1')],'defaultValue':_0x13d5('0x2')},'key':{'type':Sequelize[_0x13d5('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x13d5('0x1')],'defaultValue':_0x13d5('0x3')},'customerAlias':{'type':Sequelize[_0x13d5('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x13d5('0x1')],'allowNull':![],'defaultValue':_0x13d5('0x4'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x13d5('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x13d5('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x13d5('0x1')]},'animation':{'type':Sequelize[_0x13d5('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x13d5('0x8')](_0x13d5('0x9'),_0x13d5('0xa')),'defaultValue':_0x13d5('0x9')},'header_online':{'type':Sequelize[_0x13d5('0x1')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x13d5('0x1')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x13d5('0x1')],'defaultValue':_0x13d5('0xb')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x13d5('0xc')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x13d5('0x1')],'defaultValue':_0x13d5('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0x13d5('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x13d5('0xe')]},'closingQuestion':{'type':Sequelize[_0x13d5('0x1')],'defaultValue':_0x13d5('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x13d5('0x1')],'defaultValue':_0x13d5('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x13d5('0x1')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x13d5('0x11')},'placeholderMessage':{'type':Sequelize[_0x13d5('0x1')],'defaultValue':_0x13d5('0x12')},'closingMessage':{'type':Sequelize[_0x13d5('0x1')],'defaultValue':_0x13d5('0x13')},'closingMessageButton':{'type':Sequelize[_0x13d5('0x1')],'defaultValue':_0x13d5('0xb')},'skipMessageButton':{'type':Sequelize[_0x13d5('0x1')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x13d5('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x13d5('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x13d5('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x13d5('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x13d5('0x1')],'defaultValue':_0x13d5('0x14')},'ratingType':{'type':Sequelize['ENUM'](_0x13d5('0x15'),'thumb'),'defaultValue':_0x13d5('0x15')},'ratingStarsNumber':{'type':Sequelize[_0x13d5('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','variable':null,'config':{'placeholder':'name','type':_0x13d5('0x16'),'required':!![]},'props':{'title':_0x13d5('0x17'),'helpText':''}},{'type':_0x13d5('0x18'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x13d5('0x2')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x13d5('0x19'))?JSON[_0x13d5('0x1a')](this[_0x13d5('0x1b')]('onlineForm')):{};},'set':function(_0x170f15){return this[_0x13d5('0x1c')](_0x13d5('0x19'),JSON['stringify'](_0x170f15));}},'offlineForm':{'type':Sequelize[_0x13d5('0xe')],'defaultValue':function(){return JSON[_0x13d5('0x1d')]({'items':[{'type':_0x13d5('0x18'),'props':{'title':_0x13d5('0x2'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x13d5('0x2')},'variable':null},{'type':_0x13d5('0x1e'),'config':{'placeholder':'Comments'},'props':{'title':_0x13d5('0x1f'),'helpText':_0x13d5('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0x13d5('0x1b')](_0x13d5('0x21'))?JSON[_0x13d5('0x1a')](this['getDataValue'](_0x13d5('0x21'))):{};},'set':function(_0x3b7610){return this[_0x13d5('0x1c')](_0x13d5('0x21'),JSON[_0x13d5('0x1d')](_0x3b7610));}},'token':{'type':Sequelize[_0x13d5('0x1')],'defaultValue':function(){return rs[_0x13d5('0x22')]();}},'autoclose':{'type':Sequelize[_0x13d5('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x13d5('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x13d5('0x1')]},'forwardOffline':{'type':Sequelize[_0x13d5('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x13d5('0x1')],'defaultValue':_0x13d5('0x23')},'waitingMessage':{'type':Sequelize[_0x13d5('0x1')],'defaultValue':_0x13d5('0x24')},'offlineMessageSubject':{'type':Sequelize[_0x13d5('0x1')],'defaultValue':_0x13d5('0x25')},'offlineMessageBody':{'type':Sequelize[_0x13d5('0x1')],'defaultValue':_0x13d5('0x26')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x13d5('0x27')},'skipUnmanaged':{'type':Sequelize[_0x13d5('0x1')],'defaultValue':_0x13d5('0x28')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x13d5('0xb')},'enableCustomerAttachment':{'type':Sequelize[_0x13d5('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x13d5('0xe')]},'showAgentAvatar':{'type':Sequelize[_0x13d5('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x13d5('0xe')],'defaultValue':function(){return _0x13d5('0x29');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x13d5('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x13d5('0x1')],'defaultValue':_0x13d5('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0x13d5('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x13d5('0x2b')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x13d5('0x1')],'defaultValue':_0x13d5('0x2c')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x13d5('0x2d')},'defaultTitle':{'type':Sequelize[_0x13d5('0x1')]},'customerAvatar':{'type':Sequelize[_0x13d5('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0x13d5('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x13d5('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x13d5('0x1')],'allowNull':![],'defaultValue':_0x13d5('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x13d5('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x13d5('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x13d5('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x13d5('0x1')],'defaultValue':_0x13d5('0x2f')},'systemAvatar':{'type':Sequelize[_0x13d5('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x13d5('0x6')],'comment':_0x13d5('0x30')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4d9889){if(!_0x4d9889)this[_0x13d5('0x1c')](_0x13d5('0x31'),null);this[_0x13d5('0x1c')]('mandatoryDisposition',_0x4d9889);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x13d5('0x1')]},'vidaooTopic':{'type':Sequelize[_0x13d5('0x1')],'allowNull':![],'defaultValue':_0x13d5('0x32')},'vidaooNote':{'type':Sequelize[_0x13d5('0x1')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x13d5('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x13d5('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x13d5('0xe')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 2d96469..f050577 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 _0x2032=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','length','nolimit','pick','options','removeDispositions','ids','addAnswer','CannedAnswer','findOne','rows','file','filename','addAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','getLogo','join','root','sitepic','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','user-agent-parser','setUA','user-agent','getResult','CmContact','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','Applications','account','list','List','applications','orderBy','priority','asc','Contacts','contact','customerIp','headers','cf-connecting-ip','x-forwarded-for','split','lastName','x-real-port','browser','format','%s\x20%s','version','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','firstName','messageId','created','autoclose','push','close','unmanaged','ChatMessage','AttachmentId','UserId','User','unshift','*,*,*,*','Start','startRouting','EventManager','offline','files','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','server','attachments','offline-chat','basename','sequelize','Attachment','bulkCreate','MailServerOut','forwardOffline','forwardOfflineAddress','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','openNewInteraction','MailAccountId','mimetype','subjectOffline','toPairsIn','mapValues','email','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','internal','Tag','tag','Command','getSnippet','timezone','interval','indexOf','true','ONLINE','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','Interval','Intervals','getProactiveActions','virtual','License','increment','chatLicenseExceeded','some','server/files/chat/iframe.ejs','remote','x-real-ip','remoteAddress','referer','replace','alignment','verticalAlignment','color','textColor','backgroundColor','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','findAndCountAll','finally','getApplications','chatProactiveAction','addProactiveActions','online','false','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','spread','emit','userChatWebsite:save','userChatWebsite:remove','getAgents','mustache','util','path','fs-extra','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','result','end','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','sendStatus','stack','name','send','index','Pause','map','ChatWebsite','fieldName','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','type','includeAll','findAll','catch','mandatoryDispositionPause','rawAttributes','include','find','create','body','user','get','ChatWebsites','UserProfileSection','userProfileId','autoAssociation'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x2032,0xd9));var _0x2203=function(_0x1bb300,_0x19ea29){_0x1bb300=_0x1bb300-0x0;var _0xbd713f=_0x2032[_0x1bb300];return _0xbd713f;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0x2203('0x0'));var util=require(_0x2203('0x1'));var path=require(_0x2203('0x2'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2203('0x3'));var _=require(_0x2203('0x4'));var querystring=require('querystring');var Redis=require(_0x2203('0x5'));var qs=require(_0x2203('0x6'));var logger=require(_0x2203('0x7'))(_0x2203('0x8'));var config=require(_0x2203('0x9'));var db=require(_0x2203('0xa'))['db'];config[_0x2203('0xb')]=_[_0x2203('0xc')](config[_0x2203('0xb')],{'host':_0x2203('0xd'),'port':0x18eb});var socket=require(_0x2203('0xe'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0x2203('0xf')](socket);var htmlToText=require('html-to-text');var jayson=require(_0x2203('0x10'));var client=jayson[_0x2203('0x11')][_0x2203('0x12')]({'port':0x232c});var client9002=jayson['client'][_0x2203('0x12')]({'port':0x232a});var client9003=jayson['client'][_0x2203('0x12')]({'port':0x232b});var client9001=jayson['client'][_0x2203('0x12')]({'port':0x2329});function respondWithRpcPromise(_0x1abb51,_0x4b9376,_0x583bc7,_0x585c76){return new BPromise(function(_0x5f56ff,_0x4bad7c){var _0x238772=_0x585c76||client;return _0x238772['request'](_0x1abb51,_0x583bc7)['then'](function(_0x21a3af){logger[_0x2203('0x13')](_0x2203('0x14'),_0x4b9376,_0x2203('0x15'));logger[_0x2203('0x16')](_0x2203('0x17'),_0x4b9376,_0x2203('0x15'),JSON[_0x2203('0x18')](_0x21a3af));if(_0x21a3af[_0x2203('0x19')]){if(_0x21a3af[_0x2203('0x19')]['code']===0x1f4){logger[_0x2203('0x19')](_0x2203('0x14'),_0x4b9376,_0x21a3af['error'][_0x2203('0x1a')]);return _0x4bad7c(_0x21a3af[_0x2203('0x19')]['message']);}logger[_0x2203('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x4b9376,_0x21a3af[_0x2203('0x19')][_0x2203('0x1a')]);return _0x5f56ff(_0x21a3af[_0x2203('0x19')][_0x2203('0x1a')]);}else{logger[_0x2203('0x13')](_0x2203('0x14'),_0x4b9376,'request\x20sent');_0x5f56ff(_0x21a3af[_0x2203('0x1b')]['message']);}})['catch'](function(_0x15f543){logger['error'](_0x2203('0x14'),_0x4b9376,_0x15f543);_0x4bad7c(_0x15f543);});});}function respondWithStatusCode(_0x5bfe61,_0x5d4c4e){_0x5d4c4e=_0x5d4c4e||0xcc;return function(_0x3ee25b){if(_0x3ee25b){return _0x5bfe61['sendStatus'](_0x5d4c4e);}return _0x5bfe61['status'](_0x5d4c4e)[_0x2203('0x1c')]();};}function respondWithResult(_0x2718f5,_0x21f930){_0x21f930=_0x21f930||0xc8;return function(_0xfd0970){if(_0xfd0970){return _0x2718f5[_0x2203('0x1d')](_0x21f930)[_0x2203('0x1e')](_0xfd0970);}};}function respondWithFilteredResult(_0x49c12,_0x250349){return function(_0x576378){if(_0x576378){var _0x143f41=typeof _0x250349[_0x2203('0x1f')]===_0x2203('0x20')&&typeof _0x250349['limit']===_0x2203('0x20');var _0x1cec17=_0x576378['count'];var _0xd6e109=_0x143f41?0x0:_0x250349[_0x2203('0x1f')];var _0x1c6a77=_0x143f41?_0x576378[_0x2203('0x21')]:_0x250349[_0x2203('0x1f')]+_0x250349[_0x2203('0x22')];var _0x9c53f;if(_0x1c6a77>=_0x1cec17){_0x1c6a77=_0x1cec17;_0x9c53f=0xc8;}else{_0x9c53f=0xce;}_0x49c12['status'](_0x9c53f);return _0x49c12[_0x2203('0x23')](_0x2203('0x24'),_0xd6e109+'-'+_0x1c6a77+'/'+_0x1cec17)[_0x2203('0x1e')](_0x576378);}return null;};}function saveUpdates(_0x74f035){return function(_0x52a426){if(_0x52a426){return _0x52a426[_0x2203('0x25')](_0x74f035)[_0x2203('0x26')](function(_0x287c95){return _0x287c95;});}return null;};}function removeEntity(_0xf59954){return function(_0x520602){if(_0x520602){return _0x520602[_0x2203('0x27')]()[_0x2203('0x26')](function(){var _0x5e6560=_0x520602['get']({'plain':!![]});var _0x1d5f74='ChatWebsites';return db['UserProfileResource'][_0x2203('0x27')]({'where':{'type':_0x1d5f74,'resourceId':_0x5e6560['id']}})[_0x2203('0x26')](function(){return _0x520602;});})[_0x2203('0x26')](function(){_0xf59954[_0x2203('0x1d')](0xcc)[_0x2203('0x1c')]();});}};}function handleEntityNotFound(_0x5ac74b){return function(_0xb22e28){if(!_0xb22e28){_0x5ac74b[_0x2203('0x28')](0x194);}return _0xb22e28;};}function handleError(_0x49caec,_0x2a2ee7){_0x2a2ee7=_0x2a2ee7||0x1f4;return function(_0x20fbe1){logger[_0x2203('0x19')](_0x20fbe1[_0x2203('0x29')]);if(_0x20fbe1[_0x2203('0x2a')]){delete _0x20fbe1[_0x2203('0x2a')];}_0x49caec[_0x2203('0x1d')](_0x2a2ee7)[_0x2203('0x2b')](_0x20fbe1);};}exports[_0x2203('0x2c')]=function(_0x522a69,_0x15c0ad){var _0x347d3e={'include':[{'model':db[_0x2203('0x2d')],'as':'mandatoryDispositionPause'}]},_0x56f9b2={},_0x54b90b={'count':0x0,'rows':[]};var _0x25cc97=_[_0x2203('0x2e')](db[_0x2203('0x2f')]['rawAttributes'],function(_0x5a2b90){return{'name':_0x5a2b90[_0x2203('0x30')],'type':_0x5a2b90['type'][_0x2203('0x31')]};});_0x56f9b2['model']=_[_0x2203('0x2e')](_0x25cc97,'name');_0x56f9b2[_0x2203('0x32')]=_[_0x2203('0x33')](_0x522a69[_0x2203('0x32')]);_0x56f9b2[_0x2203('0x34')]=_[_0x2203('0x35')](_0x56f9b2['model'],_0x56f9b2['query']);_0x347d3e['attributes']=_[_0x2203('0x35')](_0x56f9b2[_0x2203('0x36')],qs[_0x2203('0x37')](_0x522a69[_0x2203('0x32')][_0x2203('0x37')]));_0x347d3e[_0x2203('0x38')]=_0x347d3e[_0x2203('0x38')]['length']?_0x347d3e[_0x2203('0x38')]:_0x56f9b2[_0x2203('0x36')];if(!_0x522a69[_0x2203('0x32')][_0x2203('0x39')]('nolimit')){_0x347d3e['limit']=qs[_0x2203('0x22')](_0x522a69['query'][_0x2203('0x22')]);_0x347d3e[_0x2203('0x1f')]=qs[_0x2203('0x1f')](_0x522a69['query']['offset']);}_0x347d3e[_0x2203('0x3a')]=qs[_0x2203('0x3b')](_0x522a69[_0x2203('0x32')][_0x2203('0x3b')]);_0x347d3e[_0x2203('0x3c')]=qs[_0x2203('0x34')](_['pick'](_0x522a69[_0x2203('0x32')],_0x56f9b2[_0x2203('0x34')]),_0x25cc97);if(_0x522a69[_0x2203('0x32')][_0x2203('0x3d')]){_0x347d3e[_0x2203('0x3c')]=_[_0x2203('0x3e')](_0x347d3e[_0x2203('0x3c')],{'$or':_[_0x2203('0x2e')](_0x25cc97,function(_0x36b8e4){if(_0x36b8e4[_0x2203('0x3f')]!=='VIRTUAL'){var _0x2e2ca5={};_0x2e2ca5[_0x36b8e4[_0x2203('0x2a')]]={'$like':'%'+_0x522a69[_0x2203('0x32')][_0x2203('0x3d')]+'%'};return _0x2e2ca5;}})});}_0x347d3e=_['merge']({},_0x347d3e,_0x522a69['options']);var _0x1c6661={'where':_0x347d3e['where']};return db[_0x2203('0x2f')][_0x2203('0x21')](_0x1c6661)[_0x2203('0x26')](function(_0x35dba9){_0x54b90b['count']=_0x35dba9;if(_0x522a69[_0x2203('0x32')][_0x2203('0x40')]){_0x347d3e['include']=[{'all':!![]}];}return db[_0x2203('0x2f')][_0x2203('0x41')](_0x347d3e);})[_0x2203('0x26')](function(_0x2600a9){_0x54b90b['rows']=_0x2600a9;return _0x54b90b;})['then'](respondWithFilteredResult(_0x15c0ad,_0x347d3e))[_0x2203('0x42')](handleError(_0x15c0ad,null));};exports['show']=function(_0x543fde,_0x450082){var _0x33b7b5={'raw':![],'where':{'id':_0x543fde['params']['id']},'include':[{'model':db['Pause'],'as':_0x2203('0x43')}]},_0x1a2665={};_0x1a2665[_0x2203('0x36')]=_[_0x2203('0x33')](db[_0x2203('0x2f')][_0x2203('0x44')]);_0x1a2665[_0x2203('0x32')]=_['keys'](_0x543fde[_0x2203('0x32')]);_0x1a2665['filters']=_[_0x2203('0x35')](_0x1a2665[_0x2203('0x36')],_0x1a2665[_0x2203('0x32')]);_0x33b7b5[_0x2203('0x38')]=_['intersection'](_0x1a2665['model'],qs[_0x2203('0x37')](_0x543fde[_0x2203('0x32')][_0x2203('0x37')]));_0x33b7b5[_0x2203('0x38')]=_0x33b7b5['attributes']['length']?_0x33b7b5['attributes']:_0x1a2665[_0x2203('0x36')];if(_0x543fde[_0x2203('0x32')]['includeAll']){_0x33b7b5[_0x2203('0x45')]=[{'all':!![]}];}_0x33b7b5=_[_0x2203('0x3e')]({},_0x33b7b5,_0x543fde['options']);return db[_0x2203('0x2f')][_0x2203('0x46')](_0x33b7b5)[_0x2203('0x26')](handleEntityNotFound(_0x450082,null))[_0x2203('0x26')](respondWithResult(_0x450082,null))['catch'](handleError(_0x450082,null));};exports[_0x2203('0x47')]=function(_0x5268d6,_0x3858f0){return db[_0x2203('0x2f')]['create'](_0x5268d6[_0x2203('0x48')],{})[_0x2203('0x26')](function(_0x11c581){var _0x378132=_0x5268d6[_0x2203('0x49')][_0x2203('0x4a')]({'plain':!![]});if(!_0x378132)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x378132['role']===_0x2203('0x49')){var _0x524356=_0x11c581['get']({'plain':!![]});var _0xfddc3b=_0x2203('0x4b');return db[_0x2203('0x4c')]['find']({'where':{'name':_0xfddc3b,'userProfileId':_0x378132[_0x2203('0x4d')]},'raw':!![]})['then'](function(_0x5ddf9e){if(_0x5ddf9e&&_0x5ddf9e[_0x2203('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x524356['name'],'resourceId':_0x524356['id'],'type':_0x5ddf9e[_0x2203('0x2a')],'sectionId':_0x5ddf9e['id']},{})[_0x2203('0x26')](function(){return _0x11c581;});}else{return _0x11c581;}})[_0x2203('0x42')](function(_0x1c6c90){logger[_0x2203('0x19')](_0x2203('0x4f'),_0x1c6c90);throw _0x1c6c90;});}return _0x11c581;})[_0x2203('0x26')](respondWithResult(_0x3858f0,0xc9))[_0x2203('0x42')](handleError(_0x3858f0,null));};exports[_0x2203('0x25')]=function(_0x216641,_0x384a59){if(_0x216641[_0x2203('0x48')]['id']){delete _0x216641['body']['id'];}return db['ChatWebsite'][_0x2203('0x46')]({'where':{'id':_0x216641[_0x2203('0x50')]['id']},'include':[{'model':db[_0x2203('0x2d')],'as':_0x2203('0x43')}]})[_0x2203('0x26')](handleEntityNotFound(_0x384a59,null))[_0x2203('0x26')](saveUpdates(_0x216641['body'],null))['then'](respondWithResult(_0x384a59,null))[_0x2203('0x42')](handleError(_0x384a59,null));};exports[_0x2203('0x27')]=function(_0x21ee59,_0x1e6d21){return db[_0x2203('0x2f')][_0x2203('0x46')]({'where':{'id':_0x21ee59[_0x2203('0x50')]['id']}})[_0x2203('0x26')](handleEntityNotFound(_0x1e6d21,null))[_0x2203('0x26')](removeEntity(_0x1e6d21,null))[_0x2203('0x42')](handleError(_0x1e6d21,null));};exports[_0x2203('0x51')]=function(_0x48bed1,_0x1ea97a){return db[_0x2203('0x2f')][_0x2203('0x51')]()[_0x2203('0x26')](respondWithResult(_0x1ea97a,null))[_0x2203('0x42')](handleError(_0x1ea97a,null));};exports[_0x2203('0x52')]=function(_0x52c159,_0x544756){if(_0x52c159[_0x2203('0x48')]['id']){delete _0x52c159[_0x2203('0x48')]['id'];}return db[_0x2203('0x2f')][_0x2203('0x46')]({'where':{'id':_0x52c159[_0x2203('0x50')]['id']}})[_0x2203('0x26')](handleEntityNotFound(_0x544756,null))[_0x2203('0x26')](function(_0x34e820){if(_0x34e820){_0x52c159[_0x2203('0x48')][_0x2203('0x53')]=_0x34e820['id'];return db[_0x2203('0x54')][_0x2203('0x47')](_0x52c159['body']);}})[_0x2203('0x26')](respondWithResult(_0x544756,null))[_0x2203('0x42')](handleError(_0x544756,null));};exports[_0x2203('0x55')]=function(_0x4e461e,_0x68855d){var _0x3f73e1={'raw':![],'where':{}};var _0x1b4f96={};var _0x1b7aa8={'count':0x0,'rows':[]};return db[_0x2203('0x2f')]['findOne']({'where':{'id':_0x4e461e[_0x2203('0x50')]['id']}})[_0x2203('0x26')](handleEntityNotFound(_0x68855d,null))[_0x2203('0x26')](function(_0x4dde80){if(_0x4dde80){_0x1b4f96['model']=_['keys'](db['Disposition']['rawAttributes']);_0x1b4f96[_0x2203('0x32')]=_[_0x2203('0x33')](_0x4e461e[_0x2203('0x32')]);_0x1b4f96[_0x2203('0x34')]=_[_0x2203('0x35')](_0x1b4f96[_0x2203('0x36')],_0x1b4f96[_0x2203('0x32')]);_0x3f73e1[_0x2203('0x38')]=_['intersection'](_0x1b4f96['model'],qs[_0x2203('0x37')](_0x4e461e[_0x2203('0x32')][_0x2203('0x37')]));_0x3f73e1[_0x2203('0x38')]=_0x3f73e1[_0x2203('0x38')][_0x2203('0x56')]?_0x3f73e1[_0x2203('0x38')]:_0x1b4f96[_0x2203('0x36')];if(!_0x4e461e[_0x2203('0x32')][_0x2203('0x39')](_0x2203('0x57'))){_0x3f73e1[_0x2203('0x22')]=qs[_0x2203('0x22')](_0x4e461e[_0x2203('0x32')][_0x2203('0x22')]);_0x3f73e1[_0x2203('0x1f')]=qs[_0x2203('0x1f')](_0x4e461e[_0x2203('0x32')][_0x2203('0x1f')]);}_0x3f73e1['order']=qs[_0x2203('0x3b')](_0x4e461e['query'][_0x2203('0x3b')]);_0x3f73e1['where']=qs[_0x2203('0x34')](_[_0x2203('0x58')](_0x4e461e[_0x2203('0x32')],_0x1b4f96[_0x2203('0x34')]));_0x3f73e1[_0x2203('0x3c')][_0x2203('0x53')]=_0x4dde80['id'];if(_0x4e461e[_0x2203('0x32')][_0x2203('0x3d')]){_0x3f73e1['where']=_['merge'](_0x3f73e1[_0x2203('0x3c')],{'$or':_[_0x2203('0x2e')](_0x3f73e1[_0x2203('0x38')],function(_0x484549){var _0x48c6c9={};_0x48c6c9[_0x484549]={'$like':'%'+_0x4e461e['query'][_0x2203('0x3d')]+'%'};return _0x48c6c9;})});}_0x3f73e1=_[_0x2203('0x3e')]({},_0x3f73e1,_0x4e461e[_0x2203('0x59')]);return db[_0x2203('0x54')]['count']({'where':_0x3f73e1[_0x2203('0x3c')]})['then'](function(_0x48bd5){_0x1b7aa8[_0x2203('0x21')]=_0x48bd5;if(_0x4e461e[_0x2203('0x32')][_0x2203('0x40')]){_0x3f73e1[_0x2203('0x45')]=[{'all':!![]}];}return db['Disposition'][_0x2203('0x41')](_0x3f73e1);})[_0x2203('0x26')](function(_0x18663f){_0x1b7aa8['rows']=_0x18663f;return _0x1b7aa8;});}})[_0x2203('0x26')](respondWithFilteredResult(_0x68855d,_0x3f73e1))[_0x2203('0x42')](handleError(_0x68855d,null));};exports[_0x2203('0x5a')]=function(_0xd76624,_0x1c65f9){return db[_0x2203('0x2f')][_0x2203('0x46')]({'where':{'id':_0xd76624[_0x2203('0x50')]['id']}})[_0x2203('0x26')](handleEntityNotFound(_0x1c65f9,null))[_0x2203('0x26')](function(_0x112385){if(_0x112385){return _0x112385['removeDispositions'](_0xd76624[_0x2203('0x32')][_0x2203('0x5b')]);}})[_0x2203('0x26')](respondWithStatusCode(_0x1c65f9,null))[_0x2203('0x42')](handleError(_0x1c65f9,null));};exports[_0x2203('0x5c')]=function(_0x52c35e,_0x23f7b1){if(_0x52c35e[_0x2203('0x48')]['id']){delete _0x52c35e[_0x2203('0x48')]['id'];}return db[_0x2203('0x2f')][_0x2203('0x46')]({'where':{'id':_0x52c35e[_0x2203('0x50')]['id']}})['then'](handleEntityNotFound(_0x23f7b1,null))['then'](function(_0x26cfd7){if(_0x26cfd7){_0x52c35e[_0x2203('0x48')][_0x2203('0x53')]=_0x26cfd7['id'];return db[_0x2203('0x5d')][_0x2203('0x47')](_0x52c35e['body']);}})[_0x2203('0x26')](respondWithResult(_0x23f7b1,null))[_0x2203('0x42')](handleError(_0x23f7b1,null));};exports['getAnswers']=function(_0x511689,_0x4edac6){var _0x4fc51a={'raw':![],'where':{}};var _0x5e07d7={};var _0x2952fc={'count':0x0,'rows':[]};return db[_0x2203('0x2f')][_0x2203('0x5e')]({'where':{'id':_0x511689['params']['id']}})['then'](handleEntityNotFound(_0x4edac6,null))['then'](function(_0x1e1969){if(_0x1e1969){_0x5e07d7[_0x2203('0x36')]=_[_0x2203('0x33')](db[_0x2203('0x5d')][_0x2203('0x44')]);_0x5e07d7[_0x2203('0x32')]=_[_0x2203('0x33')](_0x511689['query']);_0x5e07d7[_0x2203('0x34')]=_[_0x2203('0x35')](_0x5e07d7[_0x2203('0x36')],_0x5e07d7[_0x2203('0x32')]);_0x4fc51a[_0x2203('0x38')]=_[_0x2203('0x35')](_0x5e07d7[_0x2203('0x36')],qs['fields'](_0x511689[_0x2203('0x32')]['fields']));_0x4fc51a['attributes']=_0x4fc51a[_0x2203('0x38')]['length']?_0x4fc51a[_0x2203('0x38')]:_0x5e07d7[_0x2203('0x36')];if(!_0x511689['query'][_0x2203('0x39')](_0x2203('0x57'))){_0x4fc51a[_0x2203('0x22')]=qs[_0x2203('0x22')](_0x511689[_0x2203('0x32')][_0x2203('0x22')]);_0x4fc51a['offset']=qs[_0x2203('0x1f')](_0x511689[_0x2203('0x32')]['offset']);}_0x4fc51a['order']=qs[_0x2203('0x3b')](_0x511689[_0x2203('0x32')][_0x2203('0x3b')]);_0x4fc51a[_0x2203('0x3c')]=qs[_0x2203('0x34')](_[_0x2203('0x58')](_0x511689[_0x2203('0x32')],_0x5e07d7[_0x2203('0x34')]));_0x4fc51a[_0x2203('0x3c')][_0x2203('0x53')]=_0x1e1969['id'];if(_0x511689[_0x2203('0x32')][_0x2203('0x3d')]){_0x4fc51a[_0x2203('0x3c')]=_[_0x2203('0x3e')](_0x4fc51a[_0x2203('0x3c')],{'$or':_[_0x2203('0x2e')](_0x4fc51a['attributes'],function(_0x4e2d30){var _0x2cb712={};_0x2cb712[_0x4e2d30]={'$like':'%'+_0x511689[_0x2203('0x32')]['filter']+'%'};return _0x2cb712;})});}_0x4fc51a=_[_0x2203('0x3e')]({},_0x4fc51a,_0x511689[_0x2203('0x59')]);return db['CannedAnswer'][_0x2203('0x21')]({'where':_0x4fc51a[_0x2203('0x3c')]})['then'](function(_0x21f357){_0x2952fc[_0x2203('0x21')]=_0x21f357;if(_0x511689['query'][_0x2203('0x40')]){_0x4fc51a[_0x2203('0x45')]=[{'all':!![]}];}return db[_0x2203('0x5d')][_0x2203('0x41')](_0x4fc51a);})['then'](function(_0x511c66){_0x2952fc[_0x2203('0x5f')]=_0x511c66;return _0x2952fc;});}})[_0x2203('0x26')](respondWithFilteredResult(_0x4edac6,_0x4fc51a))[_0x2203('0x42')](handleError(_0x4edac6,null));};exports['removeAnswers']=function(_0x5ef759,_0x8df62d){return db[_0x2203('0x2f')][_0x2203('0x46')]({'where':{'id':_0x5ef759['params']['id']}})['then'](handleEntityNotFound(_0x8df62d,null))[_0x2203('0x26')](function(_0x348ce6){if(_0x348ce6){return _0x348ce6['removeAnswers'](_0x5ef759[_0x2203('0x32')][_0x2203('0x5b')]);}})['then'](respondWithStatusCode(_0x8df62d,null))[_0x2203('0x42')](handleError(_0x8df62d,null));};exports['addLogo']=function(_0x1feca9,_0x5505e9){_0x1feca9['body']['sitepic']=_0x1feca9[_0x2203('0x60')][_0x2203('0x61')];return db['ChatWebsite'][_0x2203('0x46')]({'where':{'id':_0x1feca9[_0x2203('0x50')]['id']}})[_0x2203('0x26')](handleEntityNotFound(_0x5505e9,null))['then'](saveUpdates(_0x1feca9[_0x2203('0x48')],null))['then'](respondWithResult(_0x5505e9,null))[_0x2203('0x42')](handleError(_0x5505e9,null));};exports[_0x2203('0x62')]=function(_0x486563,_0x4358c1){_0x486563[_0x2203('0x48')]['agentAvatar']=_0x486563[_0x2203('0x60')][_0x2203('0x61')];return db[_0x2203('0x2f')][_0x2203('0x46')]({'where':{'id':_0x486563[_0x2203('0x50')]['id']}})['then'](handleEntityNotFound(_0x4358c1,null))[_0x2203('0x26')](saveUpdates(_0x486563[_0x2203('0x48')],null))[_0x2203('0x26')](respondWithResult(_0x4358c1,null))[_0x2203('0x42')](handleError(_0x4358c1,null));};exports[_0x2203('0x63')]=function(_0x180b8c,_0x579ddf){_0x180b8c[_0x2203('0x48')][_0x2203('0x64')]=_0x180b8c['file'][_0x2203('0x61')];return db['ChatWebsite'][_0x2203('0x46')]({'where':{'id':_0x180b8c[_0x2203('0x50')]['id']}})[_0x2203('0x26')](handleEntityNotFound(_0x579ddf,null))['then'](saveUpdates(_0x180b8c[_0x2203('0x48')],null))[_0x2203('0x26')](respondWithResult(_0x579ddf,null))[_0x2203('0x42')](handleError(_0x579ddf,null));};exports[_0x2203('0x65')]=function(_0x2c275f,_0x2cd816){_0x2c275f[_0x2203('0x48')]['systemAvatar']=_0x2c275f['file'][_0x2203('0x61')];return db[_0x2203('0x2f')][_0x2203('0x46')]({'where':{'id':_0x2c275f[_0x2203('0x50')]['id']}})[_0x2203('0x26')](handleEntityNotFound(_0x2cd816,null))[_0x2203('0x26')](saveUpdates(_0x2c275f[_0x2203('0x48')],null))['then'](respondWithResult(_0x2cd816,null))[_0x2203('0x42')](handleError(_0x2cd816,null));};exports[_0x2203('0x66')]=function(_0x5d331b,_0x1f18cd){var _0x53b134=path[_0x2203('0x67')](config[_0x2203('0x68')],'server/files/images/logos/default_logo.svg');var _0x2d8d8c={'where':{'id':_0x5d331b[_0x2203('0x50')]['id']},'attributes':['id',_0x2203('0x69')],'raw':!![]};var _0x9d0f9b=![];return require(_0x2203('0x6a'))[_0x2203('0x6b')]()[_0x2203('0x26')](function(_0x46dc26){if(_0x46dc26){_0x9d0f9b=_0x46dc26[_0x2203('0x6c')];}})[_0x2203('0x26')](function(){return db[_0x2203('0x2f')][_0x2203('0x46')](_0x2d8d8c);})['then'](handleEntityNotFound(_0x1f18cd,null))[_0x2203('0x26')](function(_0x50275d){if(_0x50275d){if(!_[_0x2203('0x6d')](_0x50275d[_0x2203('0x69')])){if(fs[_0x2203('0x6e')](path[_0x2203('0x67')](config[_0x2203('0x68')],_0x2203('0x6f'),_0x50275d[_0x2203('0x69')]))&&_0x9d0f9b){_0x53b134=path[_0x2203('0x67')](config[_0x2203('0x68')],_0x2203('0x6f'),_0x50275d[_0x2203('0x69')]);}}return _0x1f18cd['download'](_0x53b134);}})[_0x2203('0x42')](handleError(_0x1f18cd,null));};exports['getAvatar']=function(_0x44e091,_0x3deb3b){var _0x6b8ea4=path['join'](config[_0x2203('0x68')],_0x2203('0x70'));var _0x1add92={'where':{'id':_0x44e091[_0x2203('0x50')]['id']},'attributes':['id',_0x2203('0x71')],'raw':!![]};return db['ChatWebsite'][_0x2203('0x46')](_0x1add92)['then'](handleEntityNotFound(_0x3deb3b,null))[_0x2203('0x26')](function(_0x17e7e7){if(_0x17e7e7){if(!_['isNil'](_0x17e7e7[_0x2203('0x71')])){if(fs[_0x2203('0x6e')](path[_0x2203('0x67')](config[_0x2203('0x68')],'server/files/images/avatars/',_0x17e7e7[_0x2203('0x71')]))){_0x6b8ea4=path['join'](config['root'],_0x2203('0x72'),_0x17e7e7[_0x2203('0x71')]);}}return _0x3deb3b[_0x2203('0x73')](_0x6b8ea4);}})[_0x2203('0x42')](handleError(_0x3deb3b,null));};exports[_0x2203('0x74')]=function(_0x368b54,_0x206502){var _0x4b6d6f=path[_0x2203('0x67')](config[_0x2203('0x68')],_0x2203('0x75'));var _0x492179={'where':{'id':_0x368b54['params']['id']},'attributes':['id','customerAvatar',_0x2203('0x76')],'raw':!![]};return db[_0x2203('0x2f')][_0x2203('0x46')](_0x492179)[_0x2203('0x26')](handleEntityNotFound(_0x206502,null))['then'](function(_0x238e6f){if(_0x238e6f){if(!_[_0x2203('0x6d')](_0x238e6f[_0x2203('0x64')])){if(fs[_0x2203('0x6e')](path['join'](config['root'],_0x2203('0x72'),_0x238e6f[_0x2203('0x64')]))&&_0x238e6f[_0x2203('0x76')]){_0x4b6d6f=path['join'](config[_0x2203('0x68')],_0x2203('0x72'),_0x238e6f[_0x2203('0x64')]);}}return _0x206502[_0x2203('0x73')](_0x4b6d6f);}})[_0x2203('0x42')](handleError(_0x206502,null));};exports[_0x2203('0x77')]=function(_0xbee79c,_0x529bfb){var _0x2e33df=path[_0x2203('0x67')](config[_0x2203('0x68')],_0x2203('0x78'));var _0x268aca={'where':{'id':_0xbee79c[_0x2203('0x50')]['id']},'attributes':['id',_0x2203('0x79')],'raw':!![]};return db[_0x2203('0x2f')][_0x2203('0x46')](_0x268aca)['then'](handleEntityNotFound(_0x529bfb,null))[_0x2203('0x26')](function(_0xa53324){if(_0xa53324){if(!_[_0x2203('0x6d')](_0xa53324[_0x2203('0x79')])){if(fs['existsSync'](path[_0x2203('0x67')](config[_0x2203('0x68')],_0x2203('0x72'),_0xa53324[_0x2203('0x79')]))){_0x2e33df=path[_0x2203('0x67')](config[_0x2203('0x68')],_0x2203('0x72'),_0xa53324[_0x2203('0x79')]);}}return _0x529bfb[_0x2203('0x73')](_0x2e33df);}})['catch'](handleError(_0x529bfb,null));};exports['notify']=function(_0x225ea1,_0x4670e4){var _0x18f1b6=require(_0x2203('0x7a'));var _0x5bbb78=new _0x18f1b6();var _0x411e9e=_0x5bbb78[_0x2203('0x7b')](_0x225ea1['headers'][_0x2203('0x7c')])[_0x2203('0x7d')]();var _0x330f4d={'body':_0x225ea1[_0x2203('0x48')],'channel':'chat'};var _0x3f3690=[];var _0x11639a=[];var _0x1aab65={};var _0x487f71=![];return db[_0x2203('0x7e')][_0x2203('0x51')]()[_0x2203('0x26')](function(_0x5909b8){if(!_0x5909b8){throw new db['Sequelize'][(_0x2203('0x7f'))](_0x2203('0x80'));}_0x3f3690=_[_0x2203('0x81')](_[_0x2203('0x33')](_0x5909b8),['createdAt',_0x2203('0x82')]);_0x11639a=_[_0x2203('0x81')](_[_0x2203('0x33')](_0x5909b8),['createdAt','updatedAt',_0x2203('0x83'),_0x2203('0x84')]);if(_0x225ea1[_0x2203('0x48')]['id']){delete _0x225ea1[_0x2203('0x48')]['id'];}if(_[_0x2203('0x6d')](_0x225ea1[_0x2203('0x48')][_0x2203('0x85')])){throw new db[(_0x2203('0x86'))][(_0x2203('0x7f'))](_0x2203('0x87'));}if(_[_0x2203('0x6d')](_0x225ea1['body'][_0x2203('0x48')])||_0x225ea1['body'][_0x2203('0x48')]===''){throw new db[(_0x2203('0x86'))][(_0x2203('0x7f'))](_0x2203('0x88'));}if(_[_0x2203('0x6d')](_0x225ea1['body'][_0x2203('0x89')])){throw new db[(_0x2203('0x86'))][(_0x2203('0x7f'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x11639a);}if(!_[_0x2203('0x8a')](_0x11639a,_0x225ea1[_0x2203('0x48')][_0x2203('0x89')])){throw new db[(_0x2203('0x86'))]['ValidationError'](_0x2203('0x8b')+_0x11639a);}_0x1aab65[_0x225ea1[_0x2203('0x48')][_0x2203('0x89')]]=_0x225ea1[_0x2203('0x48')]['from'];})[_0x2203('0x26')](function(){return db[_0x2203('0x2f')]['find']({'where':{'id':_0x225ea1[_0x2203('0x50')]['id']},'include':[{'model':db[_0x2203('0x8c')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x1aab65,'limit':0x1,'order':[['updatedAt',_0x2203('0x8d')]]}]},{'model':db['ChatApplication'],'as':_0x2203('0x8e')}]});})['then'](handleEntityNotFound(_0x4670e4,null))['then'](function(_0x3b9b12){if(_0x3b9b12&&_0x3b9b12['List']){_0x330f4d[_0x2203('0x8f')]=_0x3b9b12;_0x330f4d['applications']=_0x3b9b12[_0x2203('0x8e')];_0x330f4d[_0x2203('0x90')]=_0x3b9b12[_0x2203('0x91')];_0x330f4d[_0x2203('0x92')]=_[_0x2203('0x93')](_0x330f4d[_0x2203('0x92')],[_0x2203('0x94')],[_0x2203('0x95')]);if(_0x330f4d[_0x2203('0x8f')][_0x2203('0x8e')]){delete _0x330f4d[_0x2203('0x8f')][_0x2203('0x8e')];}if(_0x330f4d['account'][_0x2203('0x91')]&&_0x330f4d[_0x2203('0x8f')][_0x2203('0x91')][_0x2203('0x96')][_0x2203('0x56')]){return _0x330f4d[_0x2203('0x8f')]['List'][_0x2203('0x96')][0x0];}var _0x367bb3=_[_0x2203('0xc')](_0x225ea1[_0x2203('0x48')],{'firstName':_0x225ea1[_0x2203('0x48')][_0x2203('0x85')],'ListId':_0x3b9b12['ListId']});_0x367bb3[_0x225ea1[_0x2203('0x48')][_0x2203('0x89')]]=_0x225ea1[_0x2203('0x48')]['from'];return db[_0x2203('0x7e')][_0x2203('0x47')](_0x367bb3,{'fields':_0x3f3690,'raw':!![]});}})[_0x2203('0x26')](handleEntityNotFound(_0x4670e4,null))[_0x2203('0x26')](function(_0x51d662){_0x330f4d[_0x2203('0x97')]=_0x51d662;var _0x4598cb=_0x225ea1[_0x2203('0x48')][_0x2203('0x98')];if(_0x225ea1[_0x2203('0x99')][_0x2203('0x9a')]){_0x4598cb=_0x225ea1[_0x2203('0x99')][_0x2203('0x9a')];}else if(_0x225ea1['headers']['x-forwarded-for']){_0x4598cb=_['first'](_0x225ea1[_0x2203('0x99')][_0x2203('0x9b')][_0x2203('0x9c')](','));}if(_0x51d662){var _0xed2e6d={'ContactId':_0x51d662['id'],'ChatWebsiteId':_0x225ea1['params']['id'],'from':(_0x51d662['firstName']||'')+'\x20'+(_0x51d662[_0x2203('0x9d')]||''),'customerIp':_0x4598cb,'customerPort':_0x225ea1[_0x2203('0x99')]['x-real-port']?_0x225ea1[_0x2203('0x99')][_0x2203('0x9e')]:null,'referer':_0x225ea1[_0x2203('0x48')]['referer'],'browserName':_0x411e9e[_0x2203('0x9f')]['name']&&_0x411e9e[_0x2203('0x9f')]['version']?util[_0x2203('0xa0')](_0x2203('0xa1'),_0x411e9e[_0x2203('0x9f')][_0x2203('0x2a')],_0x411e9e['browser'][_0x2203('0xa2')]):'unknown','browserVersion':_0x411e9e[_0x2203('0x9f')]['version']||_0x2203('0xa3'),'osName':util[_0x2203('0xa0')](_0x2203('0xa1'),_0x411e9e['os'][_0x2203('0x2a')],_0x411e9e['os']['version']),'osVersion':_0x411e9e['os'][_0x2203('0xa2')],'deviceModel':_0x411e9e[_0x2203('0xa4')][_0x2203('0x36')]&&_0x411e9e[_0x2203('0xa4')][_0x2203('0xa5')]?util[_0x2203('0xa0')](_0x2203('0xa6'),_0x411e9e[_0x2203('0xa4')][_0x2203('0x36')],_0x411e9e[_0x2203('0xa4')][_0x2203('0xa5')],_0x411e9e[_0x2203('0xa4')][_0x2203('0x3f')]):null,'deviceVendor':_0x411e9e[_0x2203('0xa4')][_0x2203('0xa5')],'deviceType':_0x411e9e['device']['type'],'formData':JSON['stringify'](_0x225ea1[_0x2203('0x48')])};var _0x1f423e={'ChatWebsiteId':_0x225ea1[_0x2203('0x50')]['id'],'closed':![]};if(_0x225ea1[_0x2203('0x48')][_0x2203('0xa7')]){_0x1f423e[_0x2203('0xa7')]=_0x225ea1['body'][_0x2203('0xa7')];return db[_0x2203('0xa8')]['find']({'where':_0x1f423e})['then'](function(_0x3f4973){if(_0x3f4973){return[_0x3f4973,![]];}_0xed2e6d['threadId']=_0x225ea1[_0x2203('0x48')][_0x2203('0xa7')];_0xed2e6d['externalUrl']=_0x225ea1[_0x2203('0x48')][_0x2203('0xa9')];return db['ChatInteraction'][_0x2203('0x47')](_0xed2e6d)['then'](function(_0x2d94a1){return[_0x2d94a1,!![]];});});}_0x1f423e[_0x2203('0xaa')]=_0x51d662['id'];if(_0x225ea1[_0x2203('0x48')]['interaction']&&_0x225ea1[_0x2203('0x48')][_0x2203('0xab')]['id']){_0x1f423e['id']=_0x225ea1[_0x2203('0x48')][_0x2203('0xab')]['id'];return db[_0x2203('0xa8')]['find']({'where':_0x1f423e})[_0x2203('0x26')](function(_0x20f50b){if(_0x20f50b){return[_0x20f50b,![]];}return db[_0x2203('0xa8')][_0x2203('0x47')](_0xed2e6d)['then'](function(_0x1b645b){return[_0x1b645b,!![]];});});}return db[_0x2203('0xa8')][_0x2203('0x47')](_0xed2e6d)[_0x2203('0x26')](function(_0x43c0bb){return[_0x43c0bb,!![]];});}})['spread'](function(_0x9c7f35,_0x4d594c){if(_0x9c7f35){_0x487f71=_0x4d594c;if(!_0x4d594c){var _0x2edd2f={'from':(_0x330f4d[_0x2203('0x97')][_0x2203('0xac')]||'')+'\x20'+(_0x330f4d[_0x2203('0x97')]['lastName']||'')};if(_0x225ea1[_0x2203('0x48')][_0x2203('0xa7')]&&_0x225ea1[_0x2203('0x48')][_0x2203('0xad')]&&_0x225ea1[_0x2203('0x48')][_0x2203('0xa7')]!=_0x225ea1[_0x2203('0x48')][_0x2203('0xad')]){_0x2edd2f[_0x2203('0xa7')]=_0x225ea1[_0x2203('0x48')][_0x2203('0xad')];}return _0x9c7f35[_0x2203('0x25')](_0x2edd2f);}else{return _0x9c7f35;}}})[_0x2203('0x26')](function(_0xd4c10e){_0x330f4d[_0x2203('0xab')]=_0xd4c10e[_0x2203('0x4a')]({'plain':!![]});_0x330f4d['interaction']['created']=_0x487f71;if(_0x330f4d['interaction'][_0x2203('0xae')]){if(_0x330f4d[_0x2203('0x8f')][_0x2203('0xaf')]){_0x330f4d['applications'][_0x2203('0xb0')]({'id':0x0,'priority':_0x330f4d[_0x2203('0x92')][_0x2203('0x56')]+0x1,'app':_0x2203('0xb1'),'appdata':_0x2203('0xb2'),'interval':'*,*,*,*'});}}return db[_0x2203('0xb3')][_0x2203('0x47')]({'body':_0x225ea1[_0x2203('0x48')][_0x2203('0x48')],'ChatWebsiteId':_0x225ea1[_0x2203('0x50')]['id'],'ChatInteractionId':_0xd4c10e['id'],'direction':'in','ContactId':_0x330f4d['contact']['id'],'AttachmentId':_0x225ea1[_0x2203('0x48')][_0x2203('0xb4')]});})['then'](function(_0x574471){_0x330f4d[_0x2203('0x1a')]=_0x574471;if(_0x330f4d[_0x2203('0xab')][_0x2203('0xb5')]){return db[_0x2203('0xb6')][_0x2203('0x46')]({'attributes':['id',_0x2203('0x2a')],'where':{'id':_0x330f4d['interaction']['UserId']}})[_0x2203('0x26')](function(_0x385c9a){if(_0x385c9a){_0x330f4d[_0x2203('0x92')][_0x2203('0xb7')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x385c9a[_0x2203('0x2a')]+','+(_0x330f4d[_0x2203('0x8f')]['waitForTheAssignedAgent']||0xa),'interval':_0x2203('0xb8')});_0x330f4d['forcedOwnership']=!![];}return respondWithRpcPromise(_0x2203('0xb9'),_0x2203('0xba'),_0x330f4d);});}return respondWithRpcPromise('Start','startRouting',_0x330f4d);})[_0x2203('0x26')](function(_0x1350e3){respondWithRpcPromise('EventManager',_0x2203('0xbb'),{'event':'notify','message':_0x1350e3},client9002);return _0x1350e3;})[_0x2203('0x26')](respondWithResult(_0x4670e4,null))['catch'](handleError(_0x4670e4,null));};exports[_0x2203('0xbc')]=function(_0xcb8c16,_0x226c23){var _0x55f80c,_0x3655b1,_0x17927c;var _0x46d93b=[];var _0x8ad33f={};var _0x1468a5=_0xcb8c16[_0x2203('0xbd')]||[];var _0x23edae=[];var _0xa620b2;return db[_0x2203('0x7e')][_0x2203('0x51')]()['then'](function(_0x2a2e3e){if(!_0x2a2e3e){throw new db['Sequelize'][(_0x2203('0x7f'))](_0x2203('0x80'));}_0x46d93b=_[_0x2203('0x81')](_[_0x2203('0x33')](_0x2a2e3e),['createdAt','updatedAt',_0x2203('0x83'),'ListId']);if(_0xcb8c16[_0x2203('0x48')]['id']){delete _0xcb8c16['body']['id'];}if(_[_0x2203('0x6d')](_0xcb8c16['body']['from'])){throw _0x226c23[_0x2203('0x1d')](0x1f4)[_0x2203('0x2b')](new db['Sequelize'][(_0x2203('0x7f'))](_0x2203('0x87')));}if(_[_0x2203('0x6d')](_0xcb8c16[_0x2203('0x48')][_0x2203('0x48')])||_0xcb8c16[_0x2203('0x48')][_0x2203('0x48')]===''){throw _0x226c23['status'](0x1f4)[_0x2203('0x2b')](new db[(_0x2203('0x86'))][(_0x2203('0x7f'))](_0x2203('0x88')));}if(_[_0x2203('0x6d')](_0xcb8c16[_0x2203('0x48')][_0x2203('0xbe')])){throw _0x226c23[_0x2203('0x1d')](0x1f4)[_0x2203('0x2b')](new db[(_0x2203('0x86'))]['ValidationError'](_0x2203('0xbf')+_0x46d93b));}if(!_[_0x2203('0x8a')](_0x46d93b,_0xcb8c16[_0x2203('0x48')][_0x2203('0xbe')])){throw _0x226c23[_0x2203('0x1d')](0x1f4)[_0x2203('0x2b')](new db[(_0x2203('0x86'))][(_0x2203('0x7f'))](_0x2203('0xc0')+_0x46d93b));}_0x8ad33f[_0xcb8c16[_0x2203('0x48')][_0x2203('0xbe')]]=_0xcb8c16[_0x2203('0x48')][_0x2203('0x85')];})['then'](function(){return db[_0x2203('0x2f')][_0x2203('0x46')]({'where':{'id':_0xcb8c16['params']['id']},'include':[{'model':db[_0x2203('0x8c')],'as':_0x2203('0x91')},{'model':db[_0x2203('0xc1')],'as':_0x2203('0xc1')}]});})[_0x2203('0x26')](handleEntityNotFound(_0x226c23,null))[_0x2203('0x26')](function(_0x2efdb8){if(_0x2efdb8&&_0x2efdb8[_0x2203('0x91')]){_0x3655b1=_0x2efdb8;var _0x3e4a72=_['defaults'](_0xcb8c16[_0x2203('0x48')],{'firstName':_0xcb8c16[_0x2203('0x48')][_0x2203('0x85')],'phone':_0xcb8c16[_0x2203('0x48')][_0x2203('0x85')],'ListId':_0x2efdb8[_0x2203('0x84')]});_0x3e4a72[_0xcb8c16[_0x2203('0x48')][_0x2203('0xbe')]]=_0xcb8c16['body'][_0x2203('0x85')];return db['CmContact'][_0x2203('0xc2')]({'where':_0x8ad33f,'defaults':_0x3e4a72});}})['spread'](function(_0x4118af){if(_0x4118af){_0x17927c=_0x4118af;var _0x581c4f=fs[_0x2203('0xc3')](path[_0x2203('0x67')](config[_0x2203('0x68')],_0x2203('0xc4')),_0x2203('0xc5'));var _0x525a98=ejs[_0x2203('0xc6')](_0x581c4f,{'body':_[_0x2203('0xc7')](_0xcb8c16[_0x2203('0x48')][_0x2203('0x48')]),'bodyTitle':_0x3655b1[_0x2203('0xc8')]});return db[_0x2203('0xc9')][_0x2203('0x47')]({'body':_0x525a98,'plainBody':htmlToText[_0x2203('0xca')](_0x525a98),'ContactId':_0x4118af['id'],'ChatWebsiteId':_0x3655b1['id']});}})['then'](function(_0x4b0ef0){_0xa620b2=_0x4b0ef0;if(_0x1468a5['length']){var _0x13fec6=_0x1468a5['map'](function(_0x5507e9){return{'name':_0x5507e9[_0x2203('0xcb')],'basename':_0x5507e9[_0x2203('0x61')],'type':_0x5507e9['mimetype'],'ChatOfflineMessageId':_0x4b0ef0['id']};});_0x23edae=_0x13fec6['map'](_0xe4ef10=>{var _0x314669={'filename':_0xe4ef10[_0x2203('0x2a')],'path':path['join'](config[_0x2203('0x68')],_0x2203('0xcc'),_0x2203('0xbd'),_0x2203('0xcd'),_0x2203('0xce'),_0xe4ef10[_0x2203('0xcf')])};return _0x314669;});if(!_0x3655b1['openNewInteraction']){return db[_0x2203('0xd0')]['transaction'](function(_0x26d72f){return db[_0x2203('0xd1')][_0x2203('0xd2')](_0x13fec6,{'transaction':_0x26d72f});});}}})[_0x2203('0x26')](function(){if(_0xa620b2){_0x55f80c=_0xa620b2;return db[_0x2203('0xc1')][_0x2203('0x5e')]({'where':{'active':!![]},'include':[{'model':db[_0x2203('0xd3')],'as':'Smtp','raw':!![]}]});}})[_0x2203('0x26')](function(_0xb75c36){if(_0xb75c36&&_0xb75c36['Smtp']&&_0x3655b1[_0x2203('0xd4')]&&_0x3655b1[_0x2203('0xd5')]){var _0x3185e6={'tls':{'rejectUnauthorized':![]}};if(_0xb75c36[_0x2203('0xd6')][_0x2203('0xd7')]){_0x3185e6[_0x2203('0xd7')]=_0xb75c36[_0x2203('0xd6')][_0x2203('0xd7')];}else{_0x3185e6[_0x2203('0xd8')]=_0xb75c36[_0x2203('0xd6')]['host'];_0x3185e6[_0x2203('0xd9')]=_0xb75c36[_0x2203('0xd6')][_0x2203('0xd9')];_0x3185e6['secure']=_0xb75c36[_0x2203('0xd6')][_0x2203('0xda')];}if(_0xb75c36[_0x2203('0xd6')][_0x2203('0xdb')]){_0x3185e6[_0x2203('0xdc')]={'user':_0xb75c36[_0x2203('0xd6')][_0x2203('0x49')],'pass':_0xb75c36[_0x2203('0xd6')][_0x2203('0xdd')]};}return respondWithRpcPromise(_0x2203('0xde'),_0x2203('0xdf'),{'account':_0x3185e6,'message':{'from':util['format'](_0x2203('0xe0'),_0xb75c36[_0x2203('0x2a')],_0xb75c36['email']||_0xb75c36[_0x2203('0xd6')][_0x2203('0x49')]),'to':_0x3655b1[_0x2203('0xd5')],'subject':_0x3655b1[_0x2203('0xe1')],'html':_0x55f80c[_0x2203('0x48')],'attachments':_0x23edae}},client9003)[_0x2203('0x26')](function(){return _0x55f80c;})[_0x2203('0x42')](function(_0xaea451){console[_0x2203('0x19')](_0xaea451);});}})['then'](function(){if(_0x3655b1&&_0x3655b1[_0x2203('0xe2')]&&_0x3655b1[_0x2203('0xe3')]){var _0x5a8ae9=[];if(_0x1468a5[_0x2203('0x56')]){_0x5a8ae9=_0x1468a5[_0x2203('0x2e')](function(_0x15ee70){return{'name':_0x15ee70[_0x2203('0xcb')],'basename':_0x15ee70[_0x2203('0x61')],'type':_0x15ee70[_0x2203('0xe4')],'ChatOfflineMessageId':_0xa620b2['id']};});}var _0x26d6cc;if(!_[_0x2203('0x6d')](_0x3655b1[_0x2203('0xe5')])){var _0x44d30c=_[_0x2203('0x2e')](_0xcb8c16[_0x2203('0x48')],function(_0x40620e){return _0x40620e;});var _0xcfef6a=_[_0x2203('0xe6')](_0x44d30c)[0x0];var _0x529742=_[_0x2203('0xe7')](_0xcfef6a,function(_0x5da1d3){return _0x5da1d3;});_0x26d6cc=_0x529742[0x1][_0x3655b1['subjectOffline']];}var _0x6adba5={'from':_0x17927c['email'],'firstName':_0x17927c['firstName'],'lastName':_0x17927c['lastName'],'mapKey':'email','message':{'from':_0x17927c[_0x2203('0xe8')],'to':_0x3655b1[_0x2203('0xc1')][_0x2203('0xe8')],'cc':'','subject':_[_0x2203('0x6d')](_0x26d6cc)?_0x3655b1['offlineMessageSubject']:_0x26d6cc,'messageId':'','sentAt':new Date(),'attach':_0x5a8ae9[_0x2203('0x56')],'attachments':_0x5a8ae9,'originChannel':_0x2203('0xe9'),'ChatWebsiteId':_0x3655b1['id'],'ChatOfflineMessageId':_0x55f80c['id'],'originTo':_0x3655b1[_0x2203('0xc1')]['email']},'body':_0x55f80c['body']};var _0x39a1c3={'account':{'id':_0x3655b1[_0x2203('0xe3')]},'body':_0x6adba5,'log':_0x2203('0xea')};return respondWithRpcPromise(_0x2203('0xea'),_0x2203('0xeb'),_0x39a1c3,client9001)[_0x2203('0x26')](function(){return _0x55f80c;})[_0x2203('0x42')](function(_0x2481f5){console[_0x2203('0x19')](_0x2481f5);});}return;})[_0x2203('0x26')](function(){if(_0x55f80c){return _0x55f80c;}})[_0x2203('0x26')](respondWithResult(_0x226c23,null))['catch'](function(_0x5298e8){console[_0x2203('0x19')](_0x2203('0x42'),_0x5298e8);for(var _0x1b5a7c of _0x1468a5){var _0x14bbc0=path['join'](config[_0x2203('0x68')],_0x2203('0xcc'),_0x2203('0xbd'),'attachments',_0x2203('0xce'),_0x1b5a7c[_0x2203('0x61')]);fs_extra[_0x2203('0xec')](_0x14bbc0)['catch'](function(_0x3e2946){console['error'](_0x2203('0xed'),_0x14bbc0,_0x3e2946);});}});};exports[_0x2203('0xee')]=function(_0x38a7c4,_0x2111b4){return db[_0x2203('0xa8')][_0x2203('0x46')]({'where':{'id':_0x38a7c4[_0x2203('0x50')]['id']}})[_0x2203('0x26')](handleEntityNotFound(_0x2111b4,null))[_0x2203('0x26')](function(_0x20a488){if(_0x20a488){return _0x20a488[_0x2203('0xee')](_0x38a7c4['body'][_0x2203('0x5b')],_[_0x2203('0xef')](_0x38a7c4[_0x2203('0x48')],[_0x2203('0x5b'),'id'])||{});}})[_0x2203('0x26')](respondWithResult(_0x2111b4,null))[_0x2203('0x42')](handleError(_0x2111b4,null));};exports[_0x2203('0xf0')]=function(_0x46f053,_0x29b90d){var _0x3ac5e2={'raw':![],'where':{}};var _0x160ecb={};var _0x556dd4={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x2203('0x5e')]({'where':{'id':_0x46f053[_0x2203('0x50')]['id']}})[_0x2203('0x26')](handleEntityNotFound(_0x29b90d,null))[_0x2203('0x26')](function(_0x973a9c){if(_0x973a9c){_0x160ecb[_0x2203('0x36')]=_[_0x2203('0x33')](db[_0x2203('0xa8')][_0x2203('0x44')]);_0x160ecb[_0x2203('0x32')]=_[_0x2203('0x33')](_0x46f053[_0x2203('0x32')]);_0x160ecb['filters']=_['intersection'](_0x160ecb[_0x2203('0x36')],_0x160ecb['query']);_0x3ac5e2['attributes']=_[_0x2203('0x35')](_0x160ecb['model'],qs[_0x2203('0x37')](_0x46f053[_0x2203('0x32')][_0x2203('0x37')]));_0x3ac5e2[_0x2203('0x38')]=_0x3ac5e2[_0x2203('0x38')][_0x2203('0x56')]?_0x3ac5e2[_0x2203('0x38')]:_0x160ecb[_0x2203('0x36')];if(!_0x46f053[_0x2203('0x32')]['hasOwnProperty'](_0x2203('0x57'))){_0x3ac5e2['limit']=qs[_0x2203('0x22')](_0x46f053[_0x2203('0x32')][_0x2203('0x22')]);_0x3ac5e2[_0x2203('0x1f')]=qs[_0x2203('0x1f')](_0x46f053['query'][_0x2203('0x1f')]);}_0x3ac5e2['order']=qs[_0x2203('0x3b')](_0x46f053['query']['sort']);_0x3ac5e2[_0x2203('0x3c')]=qs[_0x2203('0x34')](_[_0x2203('0x58')](_0x46f053[_0x2203('0x32')],_0x160ecb['filters']));_0x3ac5e2['where'][_0x2203('0x53')]=_0x973a9c['id'];if(_0x46f053[_0x2203('0x32')][_0x2203('0x3d')]){_0x3ac5e2['where']=_['merge'](_0x3ac5e2[_0x2203('0x3c')],{'$or':_[_0x2203('0x2e')](_0x3ac5e2[_0x2203('0x38')],function(_0x102591){var _0x345283={};_0x345283[_0x102591]={'$like':'%'+_0x46f053[_0x2203('0x32')][_0x2203('0x3d')]+'%'};return _0x345283;})});}_0x3ac5e2=_[_0x2203('0x3e')]({},_0x3ac5e2,_0x46f053[_0x2203('0x59')]);return db[_0x2203('0xa8')][_0x2203('0x21')]({'where':_0x3ac5e2['where']})['then'](function(_0x3f4b71){_0x556dd4['count']=_0x3f4b71;if(_0x46f053[_0x2203('0x32')][_0x2203('0x40')]){_0x3ac5e2['include']=[{'model':db['CmContact'],'as':_0x2203('0xf1'),'required':![]},{'model':db[_0x2203('0xb6')],'as':_0x2203('0xf2'),'attributes':[_0x2203('0x2a'),'fullname',_0x2203('0xf3')],'required':![]},{'model':db[_0x2203('0xf4')],'as':'Tags','attributes':['id',_0x2203('0x2a'),'color'],'where':_0x46f053[_0x2203('0x32')]['tag']?{'id':_0x46f053[_0x2203('0x32')][_0x2203('0xf5')]}:undefined,'required':_0x46f053[_0x2203('0x32')][_0x2203('0xf5')]?!![]:![]}];}return db[_0x2203('0xa8')][_0x2203('0x41')](_0x3ac5e2);})[_0x2203('0x26')](function(_0x48f227){_0x556dd4[_0x2203('0x5f')]=_0x48f227;return _0x556dd4;});}})['then'](respondWithFilteredResult(_0x29b90d,_0x3ac5e2))[_0x2203('0x42')](handleError(_0x29b90d,null));};function iftimePromise(_0x2b802c,_0x1d3c00){return respondWithRpcPromise(_0x2203('0xf6'),_0x2203('0xf7'),{'command':_0x1d3c00[_0x2203('0xf8')]?util['format']('iftime\x20%s,%s',_0x2b802c[_0x2203('0xf9')],_0x1d3c00[_0x2203('0xf8')]):util[_0x2203('0xa0')]('iftime\x20%s',_0x2b802c[_0x2203('0xf9')])},client9002)[_0x2203('0x26')](function(_0x4419a8){var _0x3f4e0f=_0x4419a8&&_0x4419a8[_0x2203('0xfa')](_0x2203('0xfb'))>=0x0?!![]:![];logger[_0x2203('0x13')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x1d3c00['id'],_0x2b802c['id'],_0x2b802c[_0x2203('0xf9')],_0x3f4e0f?_0x2203('0xfc'):_0x2203('0xfd'),_0x1d3c00[_0x2203('0xf8')]?_0x1d3c00[_0x2203('0xf8')]:_0x2203('0xfe'));return _0x3f4e0f;})[_0x2203('0x42')](function(_0x1c3684){logger[_0x2203('0x19')](_0x2203('0xff'),_0x1d3c00['id'],_0x2b802c['id'],_0x2b802c[_0x2203('0xf9')],util['inspect'](_0x1c3684,{'showHidden':![],'depth':null}),_0x1d3c00[_0x2203('0xf8')]?_0x1d3c00[_0x2203('0xf8')]:_0x2203('0xfe'));return![];});}exports[_0x2203('0xf7')]=function(_0x2237ba,_0x57665c){var _0x2bc4b8=0x0;var _0x4d4684=0x0;var _0x362eb2=![];var _0x3e38cd;var _0x189c7b;return db[_0x2203('0x2f')][_0x2203('0x46')]({'where':{'id':_0x2237ba[_0x2203('0x50')]['id']},'include':[{'model':db[_0x2203('0x100')],'as':_0x2203('0x100'),'include':[{'model':db[_0x2203('0x100')],'as':_0x2203('0x101'),'attributes':['id',_0x2203('0xf9')],'raw':!![]}]}]})[_0x2203('0x26')](handleEntityNotFound(_0x57665c,null))['then'](function(_0x2e3e42){if(_0x2e3e42){_0x3e38cd=_0x2e3e42;return _0x2e3e42[_0x2203('0x102')]({'raw':!![]});}})[_0x2203('0x26')](function(_0x4574fe){if(_0x3e38cd){if(_0x4574fe){_0x189c7b=_0x4574fe;}}return require(_0x2203('0x6a'))[_0x2203('0x6b')]();})[_0x2203('0x26')](function(_0x2ff7f7){if(_0x2ff7f7){_0x4d4684=_0x2ff7f7[_0x2203('0x103')];_0x362eb2=_0x2ff7f7[_0x2203('0x6c')];}})[_0x2203('0x26')](function(){return db[_0x2203('0xa8')]['count']({'where':{'closed':![]}});})[_0x2203('0x26')](function(_0x2fc0df){_0x2bc4b8=_0x2fc0df;if(_0x4d4684&&_0x2fc0df>_0x4d4684){return db[_0x2203('0x104')][_0x2203('0x5e')]({'where':{'id':0x1}})['then'](function(_0x7a3db2){if(_0x7a3db2){_0x7a3db2[_0x2203('0x105')](_0x2203('0x106'));}});}})[_0x2203('0x26')](function(){if(_0x3e38cd[_0x2203('0x100')]&&_0x3e38cd['Interval'][_0x2203('0x101')]){var _0x5ce868=[];for(var _0xe78125=0x0;_0xe78125<_0x3e38cd['Interval'][_0x2203('0x101')][_0x2203('0x56')];_0xe78125++){var _0x18dc4f=_0x3e38cd[_0x2203('0x100')]['Intervals'][_0xe78125][_0x2203('0x4a')]({'plain':!![]});_0x5ce868['push'](iftimePromise(_0x18dc4f,_0x3e38cd));}return BPromise['all'](_0x5ce868)[_0x2203('0x26')](function(_0x16ae32){return _[_0x2203('0x107')](_0x16ae32);});}else{return!![];}})[_0x2203('0x26')](function(_0xe54582){var _0x56e08e=fs['readFileSync'](path[_0x2203('0x67')](config[_0x2203('0x68')],_0x2203('0x108')),_0x2203('0xc5'));var _0x1361db={'remote':_0x3e38cd[_0x2203('0x109')],'query':querystring[_0x2203('0x18')](_[_0x2203('0x3e')](_0x3e38cd[_0x2203('0x4a')]({'plain':!![]}),{'customerIp':_0x2237ba[_0x2203('0x99')][_0x2203('0x9b')]||_0x2237ba['headers'][_0x2203('0x10a')]||_0x2237ba['connection'][_0x2203('0x10b')]||_0x2237ba['ip'],'referer':_0x2237ba['headers'][_0x2203('0x10c')],'openedInteractions':_0x2bc4b8,'maxInteractions':_0x4d4684,'virtual':_0x362eb2[_0x2203('0x103')],'online':_0xe54582,'custom':_0x362eb2}))[_0x2203('0x10d')](/'/g,'\x5c\x27')};_0x57665c[_0x2203('0x2b')](ejs[_0x2203('0xc6')](Mustache[_0x2203('0xc6')](_0x56e08e,_0x1361db),{'proactiveActions':_0x189c7b,'alignment':_0x3e38cd[_0x2203('0x10e')],'verticalAlignment':_0x3e38cd[_0x2203('0x10f')],'div_color':_0x3e38cd[_0x2203('0x110')],'labelText':_0x3e38cd['labelText'],'text_color':_0x3e38cd[_0x2203('0x111')],'button_color':_0x3e38cd['color_button'],'background_color':_0x3e38cd[_0x2203('0x112')]}));})[_0x2203('0x42')](handleError(_0x57665c,null));};exports['addApplications']=function(_0x32a0be,_0x2aa207){var _0xb52b88=_0x32a0be[_0x2203('0x50')]['id'];var _0x1d3e2d=_0x32a0be[_0x2203('0x48')];var _0x2efa01=0xc8;var _0x1c9339=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x2203('0xd0')]['Transaction'][_0x2203('0x113')][_0x2203('0x114')]},function(_0x374cec){return db['ChatWebsite'][_0x2203('0x5e')]({'where':{'id':_0xb52b88},'transaction':_0x374cec})[_0x2203('0x26')](function(_0x59b35b){if(_0x59b35b){return db[_0x2203('0x115')]['destroy']({'where':{'ChatWebsiteId':_0xb52b88},'transaction':_0x374cec})[_0x2203('0x26')](function(){var _0x56538e=_[_0x2203('0x2e')](_0x1d3e2d,function(_0xa203f0){_0xa203f0[_0x2203('0x53')]=_0xb52b88;return _0xa203f0;});return db[_0x2203('0x115')][_0x2203('0xd2')](_0x56538e,{'transaction':_0x374cec});});}else{_0x2efa01=0x194;_0x1c9339=[];}});})['then'](function(){if(_0x2efa01!==0x194){return db[_0x2203('0x115')][_0x2203('0x116')]({'where':{'ChatWebsiteId':_0xb52b88},'order':_0x2203('0x94')})['then'](function(_0x14c2f1){_0x1c9339=_0x14c2f1;});}})['catch'](function(_0x14dd3e){_0x2efa01=0x1f4;logger[_0x2203('0x19')](_0x14dd3e['stack']);if(_0x14dd3e[_0x2203('0x2a')]){delete _0x14dd3e[_0x2203('0x2a')];}_0x1c9339=_0x14dd3e;})[_0x2203('0x117')](function(){if(_0x1c9339===null){_0x2aa207[_0x2203('0x28')](_0x2efa01);}else{if(_0x2efa01===0x1f4){_0x2aa207[_0x2203('0x1d')](_0x2efa01)[_0x2203('0x2b')](_0x1c9339);}else{_0x2aa207[_0x2203('0x1d')](_0x2efa01)[_0x2203('0x1e')](_0x1c9339);}}});};exports[_0x2203('0x118')]=function(_0x41e423,_0x4adf48){var _0x594167={};var _0x206ac8={};var _0x248885;var _0x25e548;return db['ChatWebsite']['findOne']({'where':{'id':_0x41e423['params']['id']}})[_0x2203('0x26')](handleEntityNotFound(_0x4adf48,null))[_0x2203('0x26')](function(_0x4220a7){if(_0x4220a7){_0x248885=_0x4220a7;_0x206ac8['model']=_['keys'](db[_0x2203('0x115')]['rawAttributes']);_0x206ac8[_0x2203('0x32')]=_['keys'](_0x41e423[_0x2203('0x32')]);_0x206ac8[_0x2203('0x34')]=_[_0x2203('0x35')](_0x206ac8[_0x2203('0x36')],_0x206ac8[_0x2203('0x32')]);_0x594167[_0x2203('0x38')]=_[_0x2203('0x35')](_0x206ac8[_0x2203('0x36')],qs[_0x2203('0x37')](_0x41e423[_0x2203('0x32')][_0x2203('0x37')]));_0x594167[_0x2203('0x38')]=_0x594167[_0x2203('0x38')][_0x2203('0x56')]?_0x594167[_0x2203('0x38')]:_0x206ac8['model'];_0x594167[_0x2203('0x3a')]=qs[_0x2203('0x3b')](_0x41e423[_0x2203('0x32')][_0x2203('0x3b')]);_0x594167['where']=qs['filters'](_['pick'](_0x41e423[_0x2203('0x32')],_0x206ac8['filters']));if(_0x41e423[_0x2203('0x32')][_0x2203('0x3d')]){_0x594167[_0x2203('0x3c')]=_['merge'](_0x594167[_0x2203('0x3c')],{'$or':_['map'](_0x594167[_0x2203('0x38')],function(_0x5c6564){var _0x542f01={};_0x542f01[_0x5c6564]={'$like':'%'+_0x41e423[_0x2203('0x32')][_0x2203('0x3d')]+'%'};return _0x542f01;})});}_0x594167=_['merge']({},_0x594167,_0x41e423[_0x2203('0x59')]);return _0x248885[_0x2203('0x118')](_0x594167);}})[_0x2203('0x26')](function(_0x50457d){if(_0x50457d){_0x25e548=_0x50457d[_0x2203('0x56')];if(!_0x41e423[_0x2203('0x32')][_0x2203('0x39')](_0x2203('0x57'))){_0x594167[_0x2203('0x22')]=qs[_0x2203('0x22')](_0x41e423[_0x2203('0x32')][_0x2203('0x22')]);_0x594167[_0x2203('0x1f')]=qs[_0x2203('0x1f')](_0x41e423[_0x2203('0x32')][_0x2203('0x1f')]);}return _0x248885['getApplications'](_0x594167);}})[_0x2203('0x26')](function(_0x28eb24){if(_0x28eb24){return _0x28eb24?{'count':_0x25e548,'rows':_0x28eb24}:null;}})[_0x2203('0x26')](respondWithResult(_0x4adf48,null))[_0x2203('0x42')](handleError(_0x4adf48,null));};exports['addProactiveActions']=function(_0x2d4daf,_0x7f22d6){return db[_0x2203('0x119')][_0x2203('0x46')]({'where':{'id':_0x2d4daf[_0x2203('0x50')]['id']}})[_0x2203('0x26')](handleEntityNotFound(_0x7f22d6,null))[_0x2203('0x26')](function(_0x243a85){if(_0x243a85){return _0x243a85[_0x2203('0x11a')](_0x2d4daf[_0x2203('0x48')][_0x2203('0x5b')],_['omit'](_0x2d4daf[_0x2203('0x48')],[_0x2203('0x5b'),'id'])||{});}})['then'](respondWithResult(_0x7f22d6,null))[_0x2203('0x42')](handleError(_0x7f22d6,null));};exports[_0x2203('0x102')]=function(_0x5c9ceb,_0x47660a){var _0x4afe90={};var _0x47f1cc={};var _0x1de009;var _0x4c6b1f;return db[_0x2203('0x2f')][_0x2203('0x5e')]({'where':{'id':_0x5c9ceb[_0x2203('0x50')]['id']}})['then'](handleEntityNotFound(_0x47660a,null))[_0x2203('0x26')](function(_0x3b6fa7){if(_0x3b6fa7){_0x1de009=_0x3b6fa7;_0x47f1cc[_0x2203('0x36')]=_['keys'](db['ChatProactiveAction'][_0x2203('0x44')]);_0x47f1cc[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5c9ceb['query']);_0x47f1cc['filters']=_[_0x2203('0x35')](_0x47f1cc[_0x2203('0x36')],_0x47f1cc[_0x2203('0x32')]);_0x4afe90['attributes']=_['intersection'](_0x47f1cc[_0x2203('0x36')],qs['fields'](_0x5c9ceb[_0x2203('0x32')]['fields']));_0x4afe90['attributes']=_0x4afe90[_0x2203('0x38')][_0x2203('0x56')]?_0x4afe90[_0x2203('0x38')]:_0x47f1cc[_0x2203('0x36')];_0x4afe90[_0x2203('0x3a')]=qs[_0x2203('0x3b')](_0x5c9ceb[_0x2203('0x32')][_0x2203('0x3b')]);_0x4afe90['where']=qs[_0x2203('0x34')](_[_0x2203('0x58')](_0x5c9ceb[_0x2203('0x32')],_0x47f1cc[_0x2203('0x34')]));if(_0x5c9ceb[_0x2203('0x32')][_0x2203('0x3d')]){_0x4afe90[_0x2203('0x3c')]=_[_0x2203('0x3e')](_0x4afe90[_0x2203('0x3c')],{'$or':_[_0x2203('0x2e')](_0x4afe90['attributes'],function(_0x55d335){var _0x2b4179={};_0x2b4179[_0x55d335]={'$like':'%'+_0x5c9ceb['query'][_0x2203('0x3d')]+'%'};return _0x2b4179;})});}_0x4afe90=_[_0x2203('0x3e')]({},_0x4afe90,_0x5c9ceb[_0x2203('0x59')]);return _0x1de009[_0x2203('0x102')](_0x4afe90);}})['then'](function(_0xcb2757){if(_0xcb2757){_0x4c6b1f=_0xcb2757[_0x2203('0x56')];if(!_0x5c9ceb[_0x2203('0x32')][_0x2203('0x39')]('nolimit')){_0x4afe90['limit']=qs[_0x2203('0x22')](_0x5c9ceb[_0x2203('0x32')][_0x2203('0x22')]);_0x4afe90[_0x2203('0x1f')]=qs['offset'](_0x5c9ceb[_0x2203('0x32')][_0x2203('0x1f')]);}return _0x1de009[_0x2203('0x102')](_0x4afe90);}})[_0x2203('0x26')](function(_0x35b738){if(_0x35b738){return _0x35b738?{'count':_0x4c6b1f,'rows':_0x35b738}:null;}})['then'](respondWithResult(_0x47660a,null))['catch'](handleError(_0x47660a,null));};exports['getFields']=function(_0x5e35b6,_0x5cda8c){var _0x14b87a=_0x5e35b6[_0x2203('0x32')][_0x2203('0x11b')]===_0x2203('0x11c')?'offlineForm':_0x2203('0x11d');return db[_0x2203('0x2f')][_0x2203('0x46')]({'attributes':['id',_0x14b87a],'where':{'id':_0x5e35b6[_0x2203('0x50')]['id']}})[_0x2203('0x26')](handleEntityNotFound(_0x5cda8c,null))[_0x2203('0x26')](function(_0x4b427b){if(_0x4b427b){var _0x521cfd=_0x4b427b[_0x14b87a];var _0x531cbe=_0x521cfd&&_0x521cfd[_0x2203('0x11e')]?_0x521cfd[_0x2203('0x11e')]:[];_0x5cda8c[_0x2203('0x2b')]({'fromKey':_['isNil'](_0x521cfd[_0x2203('0x11f')])?undefined:_0x521cfd[_0x2203('0x11f')],'count':_0x531cbe[_0x2203('0x56')],'rows':_0x531cbe});}})['catch'](handleError(_0x5cda8c,null));};exports[_0x2203('0x120')]=function(_0x3688f3,_0x5c8865){var _0x315eb4={'raw':![],'where':{}};var _0x30c8ff={};var _0x5dd144={'count':0x0,'rows':[]};return db[_0x2203('0x2f')][_0x2203('0x5e')]({'where':{'id':_0x3688f3[_0x2203('0x50')]['id']}})[_0x2203('0x26')](handleEntityNotFound(_0x5c8865,null))[_0x2203('0x26')](function(_0x3a8325){if(_0x3a8325){_0x30c8ff[_0x2203('0x36')]=_['keys'](db['ChatOfflineMessage'][_0x2203('0x44')]);_0x30c8ff[_0x2203('0x32')]=_['keys'](_0x3688f3[_0x2203('0x32')]);_0x30c8ff[_0x2203('0x34')]=_[_0x2203('0x35')](_0x30c8ff[_0x2203('0x36')],_0x30c8ff[_0x2203('0x32')]);_0x315eb4['attributes']=_[_0x2203('0x35')](_0x30c8ff[_0x2203('0x36')],qs['fields'](_0x3688f3[_0x2203('0x32')][_0x2203('0x37')]));_0x315eb4[_0x2203('0x38')]=_0x315eb4[_0x2203('0x38')][_0x2203('0x56')]?_0x315eb4['attributes']:_0x30c8ff[_0x2203('0x36')];if(!_0x3688f3[_0x2203('0x32')][_0x2203('0x39')]('nolimit')){_0x315eb4[_0x2203('0x22')]=qs[_0x2203('0x22')](_0x3688f3[_0x2203('0x32')][_0x2203('0x22')]);_0x315eb4[_0x2203('0x1f')]=qs['offset'](_0x3688f3[_0x2203('0x32')]['offset']);}_0x315eb4['order']=qs[_0x2203('0x3b')](_0x3688f3['query'][_0x2203('0x3b')]);_0x315eb4['where']=qs['filters'](_['pick'](_0x3688f3[_0x2203('0x32')],_0x30c8ff[_0x2203('0x34')]));_0x315eb4['where'][_0x2203('0x53')]=_0x3a8325['id'];if(_0x3688f3[_0x2203('0x32')][_0x2203('0x3d')]){_0x315eb4['where']=_[_0x2203('0x3e')](_0x315eb4[_0x2203('0x3c')],{'$or':_[_0x2203('0x2e')](_0x315eb4[_0x2203('0x38')],function(_0x5dbb0f){var _0x255fcc={};_0x255fcc[_0x5dbb0f]={'$like':'%'+_0x3688f3[_0x2203('0x32')]['filter']+'%'};return _0x255fcc;})});}_0x315eb4=_[_0x2203('0x3e')]({},_0x315eb4,_0x3688f3['options']);return db[_0x2203('0xc9')]['count']({'where':_0x315eb4[_0x2203('0x3c')]})[_0x2203('0x26')](function(_0x3b43fb){_0x5dd144['count']=_0x3b43fb;if(_0x3688f3['query']['includeAll']){_0x315eb4[_0x2203('0x45')]=[{'all':!![]}];}else{_0x315eb4[_0x2203('0x45')]=[{'model':db['CmContact'],'as':_0x2203('0xf1'),'required':![]},{'model':db['Attachment'],'as':_0x2203('0x121'),'required':![]}];}return db['ChatOfflineMessage'][_0x2203('0x41')](_0x315eb4);})['then'](function(_0x1b31d1){_0x5dd144[_0x2203('0x5f')]=_0x1b31d1;return _0x5dd144;});}})[_0x2203('0x26')](respondWithFilteredResult(_0x5c8865,_0x315eb4))[_0x2203('0x42')](handleError(_0x5c8865,null));};exports[_0x2203('0x122')]=function(_0xf03cfc,_0x4e62c7){return db['ChatWebsite'][_0x2203('0x46')]({'where':{'id':_0xf03cfc[_0x2203('0x50')]['id']}})[_0x2203('0x26')](handleEntityNotFound(_0x4e62c7,null))[_0x2203('0x26')](function(_0x2a4524){if(_0x2a4524){return _0x2a4524[_0x2203('0x122')](_0xf03cfc[_0x2203('0x48')][_0x2203('0x5b')],_[_0x2203('0xef')](_0xf03cfc[_0x2203('0x48')],['ids','id'])||{})[_0x2203('0x123')](function(_0x1c72a3){for(var _0x50aeb9=0x0;_0x50aeb9<_0xf03cfc['body'][_0x2203('0x5b')]['length'];_0x50aeb9+=0x1){socket[_0x2203('0x124')](_0x2203('0x125'),{'UserId':Number(_0xf03cfc[_0x2203('0x48')]['ids'][_0x50aeb9]),'ChatWebsiteId':Number(_0xf03cfc[_0x2203('0x50')]['id'])});}return _0x1c72a3;});}})[_0x2203('0x26')](respondWithResult(_0x4e62c7,null))['catch'](handleError(_0x4e62c7,null));};exports['removeAgents']=function(_0x3404f0,_0x1363d2){return db['ChatWebsite'][_0x2203('0x46')]({'where':{'id':_0x3404f0['params']['id']}})[_0x2203('0x26')](handleEntityNotFound(_0x1363d2,null))[_0x2203('0x26')](function(_0x1ec67a){if(_0x1ec67a){return _0x1ec67a['removeAgents'](_0x3404f0[_0x2203('0x32')][_0x2203('0x5b')])[_0x2203('0x26')](function(){if(_['isArray'](_0x3404f0[_0x2203('0x32')][_0x2203('0x5b')])){for(var _0x39e22d=0x0;_0x39e22d<_0x3404f0[_0x2203('0x32')][_0x2203('0x5b')][_0x2203('0x56')];_0x39e22d+=0x1){socket[_0x2203('0x124')]('userChatWebsite:remove',{'UserId':Number(_0x3404f0[_0x2203('0x32')]['ids'][_0x39e22d]),'ChatWebsiteId':Number(_0x3404f0[_0x2203('0x50')]['id'])});}}else{socket['emit'](_0x2203('0x126'),{'UserId':Number(_0x3404f0[_0x2203('0x32')][_0x2203('0x5b')]),'ChatWebsiteId':Number(_0x3404f0['params']['id'])});}});}})[_0x2203('0x26')](respondWithStatusCode(_0x1363d2,null))[_0x2203('0x42')](handleError(_0x1363d2,null));};exports[_0x2203('0x127')]=function(_0x4aa271,_0x541ada){var _0x3c9c2c={};var _0x20c49b={};var _0x329725;var _0x14b58b;return db[_0x2203('0x2f')]['findOne']({'where':{'id':_0x4aa271[_0x2203('0x50')]['id']}})[_0x2203('0x26')](handleEntityNotFound(_0x541ada,null))[_0x2203('0x26')](function(_0x5b37a4){if(_0x5b37a4){_0x329725=_0x5b37a4;_0x20c49b[_0x2203('0x36')]=_[_0x2203('0x33')](db['User'][_0x2203('0x44')]);_0x20c49b['query']=_['keys'](_0x4aa271['query']);_0x20c49b[_0x2203('0x34')]=_[_0x2203('0x35')](_0x20c49b['model'],_0x20c49b[_0x2203('0x32')]);_0x3c9c2c[_0x2203('0x38')]=_[_0x2203('0x35')](_0x20c49b['model'],qs['fields'](_0x4aa271[_0x2203('0x32')][_0x2203('0x37')]));_0x3c9c2c['attributes']=_0x3c9c2c[_0x2203('0x38')][_0x2203('0x56')]?_0x3c9c2c['attributes']:_0x20c49b[_0x2203('0x36')];_0x3c9c2c[_0x2203('0x3a')]=qs['sort'](_0x4aa271[_0x2203('0x32')]['sort']);_0x3c9c2c[_0x2203('0x3c')]=qs[_0x2203('0x34')](_['pick'](_0x4aa271[_0x2203('0x32')],_0x20c49b[_0x2203('0x34')]));if(_0x4aa271['query'][_0x2203('0x3d')]){_0x3c9c2c[_0x2203('0x3c')]=_[_0x2203('0x3e')](_0x3c9c2c['where'],{'$or':_['map'](_0x3c9c2c[_0x2203('0x38')],function(_0x196296){var _0x5f52b0={};_0x5f52b0[_0x196296]={'$like':'%'+_0x4aa271[_0x2203('0x32')][_0x2203('0x3d')]+'%'};return _0x5f52b0;})});}_0x3c9c2c=_['merge']({},_0x3c9c2c,_0x4aa271[_0x2203('0x59')]);return _0x329725['getAgents'](_0x3c9c2c);}})[_0x2203('0x26')](function(_0x59cebc){if(_0x59cebc){_0x14b58b=_0x59cebc[_0x2203('0x56')];if(!_0x4aa271['query'][_0x2203('0x39')]('nolimit')){_0x3c9c2c['limit']=qs[_0x2203('0x22')](_0x4aa271[_0x2203('0x32')]['limit']);_0x3c9c2c['offset']=qs[_0x2203('0x1f')](_0x4aa271[_0x2203('0x32')][_0x2203('0x1f')]);}return _0x329725[_0x2203('0x127')](_0x3c9c2c);}})['then'](function(_0x135d0b){if(_0x135d0b){return _0x135d0b?{'count':_0x14b58b,'rows':_0x135d0b}:null;}})['then'](respondWithResult(_0x541ada,null))[_0x2203('0x42')](handleError(_0x541ada,null));}; \ No newline at end of file +var _0x5f2f=['*,*,*,*','Start','startRouting','EventManager','offline','files','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','fromString','originalname','mimetype','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','email','offlineMessageSubject','MailAccountId','subjectOffline','mapValues','Chat','NotifyMailAccount','notifyMail','server','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','iftime\x20%s','interval','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','virtual','License','increment','all','some','remote','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','labelText','textColor','color_button','backgroundColor','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','false','offlineForm','items','fromKey','ChatOfflineMessage','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','fs-extra','lodash','querystring','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','html-to-text','jayson/promise','http','client','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','update','destroy','ChatWebsites','UserProfileResource','stack','name','index','map','ChatWebsite','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','mandatoryDispositionPause','create','user','get','role','UserProfileSection','find','userProfileId','body','params','Pause','describe','addDisposition','ChatWebsiteId','getDispositions','findOne','Disposition','order','rows','removeDispositions','ids','addAnswer','CannedAnswer','rawAttributes','removeAnswers','addLogo','sitepic','file','addAvatar','agentAvatar','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','root','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/','getSystemAvatar','notify','user-agent-parser','setUA','headers','user-agent','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','ChatApplication','Applications','list','applications','orderBy','priority','account','Contacts','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','externalUrl','ContactId','interaction','ChatInteraction','messageId','created','autoclose','push','close','AttachmentId','UserId','User','agent','waitForTheAssignedAgent'];(function(_0x443ab4,_0x40aaa1){var _0x6d6789=function(_0x21ee21){while(--_0x21ee21){_0x443ab4['push'](_0x443ab4['shift']());}};_0x6d6789(++_0x40aaa1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x25a35f,_0x578517){_0x25a35f=_0x25a35f-0x0;var _0x4205ff=_0x5f2f[_0x25a35f];return _0x4205ff;};'use strict';var BPromise=require(_0xf5f2('0x0'));var Mustache=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var path=require(_0xf5f2('0x3'));var ejs=require(_0xf5f2('0x4'));var fs=require('fs');var fs_extra=require(_0xf5f2('0x5'));var _=require(_0xf5f2('0x6'));var querystring=require(_0xf5f2('0x7'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xf5f2('0x8'))(_0xf5f2('0x9'));var config=require(_0xf5f2('0xa'));var db=require(_0xf5f2('0xb'))['db'];config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./chatWebsite.socket')[_0xf5f2('0x10')](socket);var htmlToText=require(_0xf5f2('0x11'));var jayson=require(_0xf5f2('0x12'));var client=jayson['client'][_0xf5f2('0x13')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});var client9003=jayson[_0xf5f2('0x14')][_0xf5f2('0x13')]({'port':0x232b});var client9001=jayson['client'][_0xf5f2('0x13')]({'port':0x2329});function respondWithRpcPromise(_0x14b51f,_0x331482,_0x3f2997,_0x59bb6c){return new BPromise(function(_0x3e5956,_0x5c01b8){var _0x5850f4=_0x59bb6c||client;return _0x5850f4[_0xf5f2('0x15')](_0x14b51f,_0x3f2997)[_0xf5f2('0x16')](function(_0x1c1a5c){logger[_0xf5f2('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x331482,_0xf5f2('0x18'));logger[_0xf5f2('0x19')](_0xf5f2('0x1a'),_0x331482,_0xf5f2('0x18'),JSON[_0xf5f2('0x1b')](_0x1c1a5c));if(_0x1c1a5c[_0xf5f2('0x1c')]){if(_0x1c1a5c[_0xf5f2('0x1c')][_0xf5f2('0x1d')]===0x1f4){logger[_0xf5f2('0x1c')](_0xf5f2('0x1e'),_0x331482,_0x1c1a5c[_0xf5f2('0x1c')][_0xf5f2('0x1f')]);return _0x5c01b8(_0x1c1a5c[_0xf5f2('0x1c')][_0xf5f2('0x1f')]);}logger[_0xf5f2('0x1c')](_0xf5f2('0x1e'),_0x331482,_0x1c1a5c[_0xf5f2('0x1c')]['message']);return _0x3e5956(_0x1c1a5c[_0xf5f2('0x1c')][_0xf5f2('0x1f')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x331482,_0xf5f2('0x18'));_0x3e5956(_0x1c1a5c[_0xf5f2('0x20')]['message']);}})[_0xf5f2('0x21')](function(_0x170042){logger[_0xf5f2('0x1c')](_0xf5f2('0x1e'),_0x331482,_0x170042);_0x5c01b8(_0x170042);});});}function respondWithStatusCode(_0x36f1cb,_0x4c691a){_0x4c691a=_0x4c691a||0xcc;return function(_0x21cd91){if(_0x21cd91){return _0x36f1cb[_0xf5f2('0x22')](_0x4c691a);}return _0x36f1cb[_0xf5f2('0x23')](_0x4c691a)[_0xf5f2('0x24')]();};}function respondWithResult(_0x287ad5,_0x5bdf4a){_0x5bdf4a=_0x5bdf4a||0xc8;return function(_0x529f07){if(_0x529f07){return _0x287ad5[_0xf5f2('0x23')](_0x5bdf4a)[_0xf5f2('0x25')](_0x529f07);}};}function respondWithFilteredResult(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(_0xf6c58d){var _0x788a8d=typeof _0x1a5bb3[_0xf5f2('0x26')]===_0xf5f2('0x27')&&typeof _0x1a5bb3[_0xf5f2('0x28')]==='undefined';var _0xaa2602=_0xf6c58d[_0xf5f2('0x29')];var _0x375ca8=_0x788a8d?0x0:_0x1a5bb3[_0xf5f2('0x26')];var _0x198c73=_0x788a8d?_0xf6c58d[_0xf5f2('0x29')]:_0x1a5bb3['offset']+_0x1a5bb3['limit'];var _0x22c826;if(_0x198c73>=_0xaa2602){_0x198c73=_0xaa2602;_0x22c826=0xc8;}else{_0x22c826=0xce;}_0x13da6f[_0xf5f2('0x23')](_0x22c826);return _0x13da6f[_0xf5f2('0x2a')]('Content-Range',_0x375ca8+'-'+_0x198c73+'/'+_0xaa2602)['json'](_0xf6c58d);}return null;};}function saveUpdates(_0x29571b){return function(_0x50b8a2){if(_0x50b8a2){return _0x50b8a2[_0xf5f2('0x2b')](_0x29571b)[_0xf5f2('0x16')](function(_0x1b381e){return _0x1b381e;});}return null;};}function removeEntity(_0x54c0c8){return function(_0x52e959){if(_0x52e959){return _0x52e959[_0xf5f2('0x2c')]()['then'](function(){var _0xb744b9=_0x52e959['get']({'plain':!![]});var _0x45b643=_0xf5f2('0x2d');return db[_0xf5f2('0x2e')][_0xf5f2('0x2c')]({'where':{'type':_0x45b643,'resourceId':_0xb744b9['id']}})[_0xf5f2('0x16')](function(){return _0x52e959;});})[_0xf5f2('0x16')](function(){_0x54c0c8[_0xf5f2('0x23')](0xcc)[_0xf5f2('0x24')]();});}};}function handleEntityNotFound(_0x5ca917){return function(_0x4149e6){if(!_0x4149e6){_0x5ca917[_0xf5f2('0x22')](0x194);}return _0x4149e6;};}function handleError(_0x4590ec,_0x43c77d){_0x43c77d=_0x43c77d||0x1f4;return function(_0x1408b9){logger[_0xf5f2('0x1c')](_0x1408b9[_0xf5f2('0x2f')]);if(_0x1408b9['name']){delete _0x1408b9[_0xf5f2('0x30')];}_0x4590ec[_0xf5f2('0x23')](_0x43c77d)['send'](_0x1408b9);};}exports[_0xf5f2('0x31')]=function(_0x4b8c42,_0x18ae07){var _0x3930fb={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2a2c31={},_0x2e3cca={'count':0x0,'rows':[]};var _0x41088b=_[_0xf5f2('0x32')](db[_0xf5f2('0x33')]['rawAttributes'],function(_0x41447f){return{'name':_0x41447f['fieldName'],'type':_0x41447f[_0xf5f2('0x34')]['key']};});_0x2a2c31[_0xf5f2('0x35')]=_[_0xf5f2('0x32')](_0x41088b,'name');_0x2a2c31[_0xf5f2('0x36')]=_[_0xf5f2('0x37')](_0x4b8c42[_0xf5f2('0x36')]);_0x2a2c31[_0xf5f2('0x38')]=_['intersection'](_0x2a2c31['model'],_0x2a2c31[_0xf5f2('0x36')]);_0x3930fb[_0xf5f2('0x39')]=_[_0xf5f2('0x3a')](_0x2a2c31[_0xf5f2('0x35')],qs[_0xf5f2('0x3b')](_0x4b8c42[_0xf5f2('0x36')][_0xf5f2('0x3b')]));_0x3930fb['attributes']=_0x3930fb[_0xf5f2('0x39')][_0xf5f2('0x3c')]?_0x3930fb['attributes']:_0x2a2c31[_0xf5f2('0x35')];if(!_0x4b8c42[_0xf5f2('0x36')][_0xf5f2('0x3d')](_0xf5f2('0x3e'))){_0x3930fb[_0xf5f2('0x28')]=qs[_0xf5f2('0x28')](_0x4b8c42[_0xf5f2('0x36')][_0xf5f2('0x28')]);_0x3930fb['offset']=qs[_0xf5f2('0x26')](_0x4b8c42[_0xf5f2('0x36')][_0xf5f2('0x26')]);}_0x3930fb['order']=qs['sort'](_0x4b8c42['query'][_0xf5f2('0x3f')]);_0x3930fb[_0xf5f2('0x40')]=qs['filters'](_[_0xf5f2('0x41')](_0x4b8c42[_0xf5f2('0x36')],_0x2a2c31[_0xf5f2('0x38')]),_0x41088b);if(_0x4b8c42[_0xf5f2('0x36')][_0xf5f2('0x42')]){_0x3930fb[_0xf5f2('0x40')]=_[_0xf5f2('0x43')](_0x3930fb[_0xf5f2('0x40')],{'$or':_[_0xf5f2('0x32')](_0x41088b,function(_0x106062){if(_0x106062[_0xf5f2('0x34')]!==_0xf5f2('0x44')){var _0x4252a3={};_0x4252a3[_0x106062[_0xf5f2('0x30')]]={'$like':'%'+_0x4b8c42['query'][_0xf5f2('0x42')]+'%'};return _0x4252a3;}})});}_0x3930fb=_['merge']({},_0x3930fb,_0x4b8c42[_0xf5f2('0x45')]);var _0xc04f44={'where':_0x3930fb[_0xf5f2('0x40')]};return db[_0xf5f2('0x33')][_0xf5f2('0x29')](_0xc04f44)[_0xf5f2('0x16')](function(_0x55a633){_0x2e3cca[_0xf5f2('0x29')]=_0x55a633;if(_0x4b8c42[_0xf5f2('0x36')][_0xf5f2('0x46')]){_0x3930fb[_0xf5f2('0x47')]=[{'all':!![]}];}return db[_0xf5f2('0x33')][_0xf5f2('0x48')](_0x3930fb);})[_0xf5f2('0x16')](function(_0x297f07){_0x2e3cca['rows']=_0x297f07;return _0x2e3cca;})[_0xf5f2('0x16')](respondWithFilteredResult(_0x18ae07,_0x3930fb))[_0xf5f2('0x21')](handleError(_0x18ae07,null));};exports[_0xf5f2('0x49')]=function(_0x492eea,_0x1177ba){var _0xc91b64={'raw':![],'where':{'id':_0x492eea['params']['id']},'include':[{'model':db['Pause'],'as':_0xf5f2('0x4a')}]},_0x3179a9={};_0x3179a9[_0xf5f2('0x35')]=_['keys'](db[_0xf5f2('0x33')]['rawAttributes']);_0x3179a9[_0xf5f2('0x36')]=_['keys'](_0x492eea[_0xf5f2('0x36')]);_0x3179a9['filters']=_[_0xf5f2('0x3a')](_0x3179a9[_0xf5f2('0x35')],_0x3179a9[_0xf5f2('0x36')]);_0xc91b64[_0xf5f2('0x39')]=_['intersection'](_0x3179a9[_0xf5f2('0x35')],qs[_0xf5f2('0x3b')](_0x492eea['query']['fields']));_0xc91b64[_0xf5f2('0x39')]=_0xc91b64[_0xf5f2('0x39')]['length']?_0xc91b64[_0xf5f2('0x39')]:_0x3179a9[_0xf5f2('0x35')];if(_0x492eea[_0xf5f2('0x36')][_0xf5f2('0x46')]){_0xc91b64['include']=[{'all':!![]}];}_0xc91b64=_['merge']({},_0xc91b64,_0x492eea[_0xf5f2('0x45')]);return db[_0xf5f2('0x33')]['find'](_0xc91b64)[_0xf5f2('0x16')](handleEntityNotFound(_0x1177ba,null))[_0xf5f2('0x16')](respondWithResult(_0x1177ba,null))[_0xf5f2('0x21')](handleError(_0x1177ba,null));};exports[_0xf5f2('0x4b')]=function(_0x2b038e,_0x73c9f1){return db[_0xf5f2('0x33')]['create'](_0x2b038e['body'],{})[_0xf5f2('0x16')](function(_0x27665d){var _0x3c349f=_0x2b038e[_0xf5f2('0x4c')][_0xf5f2('0x4d')]({'plain':!![]});if(!_0x3c349f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c349f[_0xf5f2('0x4e')]===_0xf5f2('0x4c')){var _0x18b124=_0x27665d['get']({'plain':!![]});var _0x1aa34b='ChatWebsites';return db[_0xf5f2('0x4f')][_0xf5f2('0x50')]({'where':{'name':_0x1aa34b,'userProfileId':_0x3c349f[_0xf5f2('0x51')]},'raw':!![]})[_0xf5f2('0x16')](function(_0x4afa4d){if(_0x4afa4d&&_0x4afa4d['autoAssociation']===0x0){return db[_0xf5f2('0x2e')]['create']({'name':_0x18b124[_0xf5f2('0x30')],'resourceId':_0x18b124['id'],'type':_0x4afa4d[_0xf5f2('0x30')],'sectionId':_0x4afa4d['id']},{})['then'](function(){return _0x27665d;});}else{return _0x27665d;}})[_0xf5f2('0x21')](function(_0xa4c0be){logger[_0xf5f2('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa4c0be);throw _0xa4c0be;});}return _0x27665d;})[_0xf5f2('0x16')](respondWithResult(_0x73c9f1,0xc9))[_0xf5f2('0x21')](handleError(_0x73c9f1,null));};exports[_0xf5f2('0x2b')]=function(_0x4579f4,_0x51fa7e){if(_0x4579f4[_0xf5f2('0x52')]['id']){delete _0x4579f4['body']['id'];}return db[_0xf5f2('0x33')][_0xf5f2('0x50')]({'where':{'id':_0x4579f4[_0xf5f2('0x53')]['id']},'include':[{'model':db[_0xf5f2('0x54')],'as':_0xf5f2('0x4a')}]})['then'](handleEntityNotFound(_0x51fa7e,null))[_0xf5f2('0x16')](saveUpdates(_0x4579f4[_0xf5f2('0x52')],null))[_0xf5f2('0x16')](respondWithResult(_0x51fa7e,null))[_0xf5f2('0x21')](handleError(_0x51fa7e,null));};exports[_0xf5f2('0x2c')]=function(_0x5359b5,_0x31e16b){return db['ChatWebsite']['find']({'where':{'id':_0x5359b5[_0xf5f2('0x53')]['id']}})['then'](handleEntityNotFound(_0x31e16b,null))[_0xf5f2('0x16')](removeEntity(_0x31e16b,null))[_0xf5f2('0x21')](handleError(_0x31e16b,null));};exports[_0xf5f2('0x55')]=function(_0x123b93,_0x5767fc){return db[_0xf5f2('0x33')][_0xf5f2('0x55')]()[_0xf5f2('0x16')](respondWithResult(_0x5767fc,null))[_0xf5f2('0x21')](handleError(_0x5767fc,null));};exports[_0xf5f2('0x56')]=function(_0x35d868,_0x158768){if(_0x35d868['body']['id']){delete _0x35d868[_0xf5f2('0x52')]['id'];}return db[_0xf5f2('0x33')][_0xf5f2('0x50')]({'where':{'id':_0x35d868[_0xf5f2('0x53')]['id']}})['then'](handleEntityNotFound(_0x158768,null))[_0xf5f2('0x16')](function(_0x4cce08){if(_0x4cce08){_0x35d868[_0xf5f2('0x52')][_0xf5f2('0x57')]=_0x4cce08['id'];return db['Disposition'][_0xf5f2('0x4b')](_0x35d868[_0xf5f2('0x52')]);}})[_0xf5f2('0x16')](respondWithResult(_0x158768,null))[_0xf5f2('0x21')](handleError(_0x158768,null));};exports[_0xf5f2('0x58')]=function(_0x4bd113,_0x3e821c){var _0x21c107={'raw':![],'where':{}};var _0x3a0e75={};var _0xbf9f55={'count':0x0,'rows':[]};return db[_0xf5f2('0x33')][_0xf5f2('0x59')]({'where':{'id':_0x4bd113['params']['id']}})[_0xf5f2('0x16')](handleEntityNotFound(_0x3e821c,null))[_0xf5f2('0x16')](function(_0x4800fe){if(_0x4800fe){_0x3a0e75[_0xf5f2('0x35')]=_[_0xf5f2('0x37')](db[_0xf5f2('0x5a')]['rawAttributes']);_0x3a0e75['query']=_['keys'](_0x4bd113[_0xf5f2('0x36')]);_0x3a0e75[_0xf5f2('0x38')]=_[_0xf5f2('0x3a')](_0x3a0e75[_0xf5f2('0x35')],_0x3a0e75[_0xf5f2('0x36')]);_0x21c107['attributes']=_[_0xf5f2('0x3a')](_0x3a0e75[_0xf5f2('0x35')],qs[_0xf5f2('0x3b')](_0x4bd113[_0xf5f2('0x36')][_0xf5f2('0x3b')]));_0x21c107[_0xf5f2('0x39')]=_0x21c107[_0xf5f2('0x39')][_0xf5f2('0x3c')]?_0x21c107[_0xf5f2('0x39')]:_0x3a0e75[_0xf5f2('0x35')];if(!_0x4bd113[_0xf5f2('0x36')]['hasOwnProperty']('nolimit')){_0x21c107['limit']=qs[_0xf5f2('0x28')](_0x4bd113[_0xf5f2('0x36')][_0xf5f2('0x28')]);_0x21c107[_0xf5f2('0x26')]=qs[_0xf5f2('0x26')](_0x4bd113['query'][_0xf5f2('0x26')]);}_0x21c107[_0xf5f2('0x5b')]=qs[_0xf5f2('0x3f')](_0x4bd113[_0xf5f2('0x36')][_0xf5f2('0x3f')]);_0x21c107['where']=qs[_0xf5f2('0x38')](_[_0xf5f2('0x41')](_0x4bd113['query'],_0x3a0e75[_0xf5f2('0x38')]));_0x21c107[_0xf5f2('0x40')][_0xf5f2('0x57')]=_0x4800fe['id'];if(_0x4bd113[_0xf5f2('0x36')]['filter']){_0x21c107[_0xf5f2('0x40')]=_[_0xf5f2('0x43')](_0x21c107[_0xf5f2('0x40')],{'$or':_[_0xf5f2('0x32')](_0x21c107[_0xf5f2('0x39')],function(_0x4f47e1){var _0x5cab92={};_0x5cab92[_0x4f47e1]={'$like':'%'+_0x4bd113[_0xf5f2('0x36')][_0xf5f2('0x42')]+'%'};return _0x5cab92;})});}_0x21c107=_[_0xf5f2('0x43')]({},_0x21c107,_0x4bd113[_0xf5f2('0x45')]);return db['Disposition']['count']({'where':_0x21c107[_0xf5f2('0x40')]})['then'](function(_0x4c4420){_0xbf9f55['count']=_0x4c4420;if(_0x4bd113['query'][_0xf5f2('0x46')]){_0x21c107[_0xf5f2('0x47')]=[{'all':!![]}];}return db[_0xf5f2('0x5a')][_0xf5f2('0x48')](_0x21c107);})[_0xf5f2('0x16')](function(_0x9f941e){_0xbf9f55[_0xf5f2('0x5c')]=_0x9f941e;return _0xbf9f55;});}})[_0xf5f2('0x16')](respondWithFilteredResult(_0x3e821c,_0x21c107))[_0xf5f2('0x21')](handleError(_0x3e821c,null));};exports[_0xf5f2('0x5d')]=function(_0x9afb3c,_0x2afeac){return db[_0xf5f2('0x33')][_0xf5f2('0x50')]({'where':{'id':_0x9afb3c[_0xf5f2('0x53')]['id']}})[_0xf5f2('0x16')](handleEntityNotFound(_0x2afeac,null))[_0xf5f2('0x16')](function(_0x2778ed){if(_0x2778ed){return _0x2778ed['removeDispositions'](_0x9afb3c[_0xf5f2('0x36')][_0xf5f2('0x5e')]);}})[_0xf5f2('0x16')](respondWithStatusCode(_0x2afeac,null))[_0xf5f2('0x21')](handleError(_0x2afeac,null));};exports[_0xf5f2('0x5f')]=function(_0x308220,_0x16491c){if(_0x308220[_0xf5f2('0x52')]['id']){delete _0x308220['body']['id'];}return db[_0xf5f2('0x33')]['find']({'where':{'id':_0x308220['params']['id']}})['then'](handleEntityNotFound(_0x16491c,null))['then'](function(_0x50befc){if(_0x50befc){_0x308220['body'][_0xf5f2('0x57')]=_0x50befc['id'];return db[_0xf5f2('0x60')][_0xf5f2('0x4b')](_0x308220[_0xf5f2('0x52')]);}})[_0xf5f2('0x16')](respondWithResult(_0x16491c,null))[_0xf5f2('0x21')](handleError(_0x16491c,null));};exports['getAnswers']=function(_0x4a0005,_0x2fb1a6){var _0x578a22={'raw':![],'where':{}};var _0x418ece={};var _0x186fdd={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x4a0005[_0xf5f2('0x53')]['id']}})[_0xf5f2('0x16')](handleEntityNotFound(_0x2fb1a6,null))['then'](function(_0x1c624f){if(_0x1c624f){_0x418ece[_0xf5f2('0x35')]=_['keys'](db[_0xf5f2('0x60')][_0xf5f2('0x61')]);_0x418ece[_0xf5f2('0x36')]=_['keys'](_0x4a0005[_0xf5f2('0x36')]);_0x418ece[_0xf5f2('0x38')]=_[_0xf5f2('0x3a')](_0x418ece[_0xf5f2('0x35')],_0x418ece[_0xf5f2('0x36')]);_0x578a22[_0xf5f2('0x39')]=_[_0xf5f2('0x3a')](_0x418ece[_0xf5f2('0x35')],qs[_0xf5f2('0x3b')](_0x4a0005[_0xf5f2('0x36')][_0xf5f2('0x3b')]));_0x578a22[_0xf5f2('0x39')]=_0x578a22[_0xf5f2('0x39')][_0xf5f2('0x3c')]?_0x578a22[_0xf5f2('0x39')]:_0x418ece[_0xf5f2('0x35')];if(!_0x4a0005[_0xf5f2('0x36')][_0xf5f2('0x3d')](_0xf5f2('0x3e'))){_0x578a22[_0xf5f2('0x28')]=qs[_0xf5f2('0x28')](_0x4a0005['query'][_0xf5f2('0x28')]);_0x578a22[_0xf5f2('0x26')]=qs['offset'](_0x4a0005[_0xf5f2('0x36')][_0xf5f2('0x26')]);}_0x578a22['order']=qs[_0xf5f2('0x3f')](_0x4a0005[_0xf5f2('0x36')][_0xf5f2('0x3f')]);_0x578a22['where']=qs['filters'](_[_0xf5f2('0x41')](_0x4a0005[_0xf5f2('0x36')],_0x418ece[_0xf5f2('0x38')]));_0x578a22['where']['ChatWebsiteId']=_0x1c624f['id'];if(_0x4a0005[_0xf5f2('0x36')][_0xf5f2('0x42')]){_0x578a22[_0xf5f2('0x40')]=_['merge'](_0x578a22['where'],{'$or':_['map'](_0x578a22['attributes'],function(_0x560b39){var _0x4e884b={};_0x4e884b[_0x560b39]={'$like':'%'+_0x4a0005['query'][_0xf5f2('0x42')]+'%'};return _0x4e884b;})});}_0x578a22=_[_0xf5f2('0x43')]({},_0x578a22,_0x4a0005[_0xf5f2('0x45')]);return db[_0xf5f2('0x60')][_0xf5f2('0x29')]({'where':_0x578a22[_0xf5f2('0x40')]})[_0xf5f2('0x16')](function(_0x40e921){_0x186fdd[_0xf5f2('0x29')]=_0x40e921;if(_0x4a0005[_0xf5f2('0x36')][_0xf5f2('0x46')]){_0x578a22[_0xf5f2('0x47')]=[{'all':!![]}];}return db[_0xf5f2('0x60')]['findAll'](_0x578a22);})[_0xf5f2('0x16')](function(_0x2a4fed){_0x186fdd['rows']=_0x2a4fed;return _0x186fdd;});}})[_0xf5f2('0x16')](respondWithFilteredResult(_0x2fb1a6,_0x578a22))[_0xf5f2('0x21')](handleError(_0x2fb1a6,null));};exports['removeAnswers']=function(_0x433ba0,_0xfe9cf5){return db[_0xf5f2('0x33')]['find']({'where':{'id':_0x433ba0[_0xf5f2('0x53')]['id']}})[_0xf5f2('0x16')](handleEntityNotFound(_0xfe9cf5,null))['then'](function(_0xbac6d2){if(_0xbac6d2){return _0xbac6d2[_0xf5f2('0x62')](_0x433ba0[_0xf5f2('0x36')]['ids']);}})[_0xf5f2('0x16')](respondWithStatusCode(_0xfe9cf5,null))['catch'](handleError(_0xfe9cf5,null));};exports[_0xf5f2('0x63')]=function(_0x5c0f89,_0xfc2784){_0x5c0f89[_0xf5f2('0x52')][_0xf5f2('0x64')]=_0x5c0f89[_0xf5f2('0x65')]['filename'];return db[_0xf5f2('0x33')]['find']({'where':{'id':_0x5c0f89['params']['id']}})['then'](handleEntityNotFound(_0xfc2784,null))[_0xf5f2('0x16')](saveUpdates(_0x5c0f89[_0xf5f2('0x52')],null))['then'](respondWithResult(_0xfc2784,null))[_0xf5f2('0x21')](handleError(_0xfc2784,null));};exports[_0xf5f2('0x66')]=function(_0x35790b,_0x3962b2){_0x35790b[_0xf5f2('0x52')][_0xf5f2('0x67')]=_0x35790b['file'][_0xf5f2('0x68')];return db[_0xf5f2('0x33')]['find']({'where':{'id':_0x35790b[_0xf5f2('0x53')]['id']}})[_0xf5f2('0x16')](handleEntityNotFound(_0x3962b2,null))['then'](saveUpdates(_0x35790b[_0xf5f2('0x52')],null))[_0xf5f2('0x16')](respondWithResult(_0x3962b2,null))[_0xf5f2('0x21')](handleError(_0x3962b2,null));};exports[_0xf5f2('0x69')]=function(_0xb2b4e4,_0x28dd0c){_0xb2b4e4['body'][_0xf5f2('0x6a')]=_0xb2b4e4[_0xf5f2('0x65')][_0xf5f2('0x68')];return db[_0xf5f2('0x33')][_0xf5f2('0x50')]({'where':{'id':_0xb2b4e4[_0xf5f2('0x53')]['id']}})[_0xf5f2('0x16')](handleEntityNotFound(_0x28dd0c,null))[_0xf5f2('0x16')](saveUpdates(_0xb2b4e4[_0xf5f2('0x52')],null))['then'](respondWithResult(_0x28dd0c,null))[_0xf5f2('0x21')](handleError(_0x28dd0c,null));};exports[_0xf5f2('0x6b')]=function(_0xdbb2cd,_0x934a7d){_0xdbb2cd[_0xf5f2('0x52')][_0xf5f2('0x6c')]=_0xdbb2cd[_0xf5f2('0x65')][_0xf5f2('0x68')];return db[_0xf5f2('0x33')][_0xf5f2('0x50')]({'where':{'id':_0xdbb2cd['params']['id']}})['then'](handleEntityNotFound(_0x934a7d,null))[_0xf5f2('0x16')](saveUpdates(_0xdbb2cd[_0xf5f2('0x52')],null))[_0xf5f2('0x16')](respondWithResult(_0x934a7d,null))[_0xf5f2('0x21')](handleError(_0x934a7d,null));};exports['getLogo']=function(_0x3d38d6,_0xffb639){var _0x3bb238=path[_0xf5f2('0x6d')](config[_0xf5f2('0x6e')],'server/files/images/logos/default_logo.svg');var _0xf7885f={'where':{'id':_0x3d38d6[_0xf5f2('0x53')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x4511f4=![];return require(_0xf5f2('0x6f'))[_0xf5f2('0x70')]()[_0xf5f2('0x16')](function(_0x4a9c05){if(_0x4a9c05){_0x4511f4=_0x4a9c05[_0xf5f2('0x71')];}})[_0xf5f2('0x16')](function(){return db[_0xf5f2('0x33')]['find'](_0xf7885f);})['then'](handleEntityNotFound(_0xffb639,null))[_0xf5f2('0x16')](function(_0x2a082c){if(_0x2a082c){if(!_[_0xf5f2('0x72')](_0x2a082c[_0xf5f2('0x64')])){if(fs[_0xf5f2('0x73')](path[_0xf5f2('0x6d')](config['root'],_0xf5f2('0x74'),_0x2a082c['sitepic']))&&_0x4511f4){_0x3bb238=path[_0xf5f2('0x6d')](config[_0xf5f2('0x6e')],_0xf5f2('0x74'),_0x2a082c[_0xf5f2('0x64')]);}}return _0xffb639[_0xf5f2('0x75')](_0x3bb238);}})[_0xf5f2('0x21')](handleError(_0xffb639,null));};exports['getAvatar']=function(_0x13321d,_0x409ed1){var _0x457b53=path[_0xf5f2('0x6d')](config[_0xf5f2('0x6e')],_0xf5f2('0x76'));var _0x12d215={'where':{'id':_0x13321d['params']['id']},'attributes':['id',_0xf5f2('0x67')],'raw':!![]};return db['ChatWebsite']['find'](_0x12d215)['then'](handleEntityNotFound(_0x409ed1,null))[_0xf5f2('0x16')](function(_0x45c57f){if(_0x45c57f){if(!_['isNil'](_0x45c57f[_0xf5f2('0x67')])){if(fs[_0xf5f2('0x73')](path[_0xf5f2('0x6d')](config[_0xf5f2('0x6e')],'server/files/images/avatars/',_0x45c57f[_0xf5f2('0x67')]))){_0x457b53=path[_0xf5f2('0x6d')](config[_0xf5f2('0x6e')],'server/files/images/avatars/',_0x45c57f[_0xf5f2('0x67')]);}}return _0x409ed1[_0xf5f2('0x75')](_0x457b53);}})['catch'](handleError(_0x409ed1,null));};exports[_0xf5f2('0x77')]=function(_0x38e879,_0x11ed38){var _0x1583bb=path[_0xf5f2('0x6d')](config[_0xf5f2('0x6e')],_0xf5f2('0x78'));var _0x2c242b={'where':{'id':_0x38e879[_0xf5f2('0x53')]['id']},'attributes':['id',_0xf5f2('0x6a'),_0xf5f2('0x79')],'raw':!![]};return db['ChatWebsite'][_0xf5f2('0x50')](_0x2c242b)[_0xf5f2('0x16')](handleEntityNotFound(_0x11ed38,null))['then'](function(_0x2275ba){if(_0x2275ba){if(!_['isNil'](_0x2275ba[_0xf5f2('0x6a')])){if(fs[_0xf5f2('0x73')](path[_0xf5f2('0x6d')](config[_0xf5f2('0x6e')],'server/files/images/avatars/',_0x2275ba[_0xf5f2('0x6a')]))&&_0x2275ba['showCustomerAvatar']){_0x1583bb=path[_0xf5f2('0x6d')](config['root'],_0xf5f2('0x7a'),_0x2275ba[_0xf5f2('0x6a')]);}}return _0x11ed38['download'](_0x1583bb);}})[_0xf5f2('0x21')](handleError(_0x11ed38,null));};exports[_0xf5f2('0x7b')]=function(_0x16619b,_0x325243){var _0x344e90=path[_0xf5f2('0x6d')](config['root'],'server/files/images/avatars/system_avatar.png');var _0x16a189={'where':{'id':_0x16619b[_0xf5f2('0x53')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xf5f2('0x33')][_0xf5f2('0x50')](_0x16a189)[_0xf5f2('0x16')](handleEntityNotFound(_0x325243,null))[_0xf5f2('0x16')](function(_0xf809c0){if(_0xf809c0){if(!_[_0xf5f2('0x72')](_0xf809c0[_0xf5f2('0x6c')])){if(fs['existsSync'](path[_0xf5f2('0x6d')](config['root'],_0xf5f2('0x7a'),_0xf809c0['systemAvatar']))){_0x344e90=path[_0xf5f2('0x6d')](config['root'],_0xf5f2('0x7a'),_0xf809c0['systemAvatar']);}}return _0x325243['download'](_0x344e90);}})[_0xf5f2('0x21')](handleError(_0x325243,null));};exports[_0xf5f2('0x7c')]=function(_0x57708f,_0x38cb63){var _0x3ebd59=require(_0xf5f2('0x7d'));var _0x3a76f4=new _0x3ebd59();var _0x1d1588=_0x3a76f4[_0xf5f2('0x7e')](_0x57708f[_0xf5f2('0x7f')][_0xf5f2('0x80')])['getResult']();var _0x545739={'body':_0x57708f[_0xf5f2('0x52')],'channel':'chat'};var _0x1cbc75=[];var _0x31a8e3=[];var _0x3a0e5c={};var _0x12a0cb=![];return db[_0xf5f2('0x81')][_0xf5f2('0x55')]()[_0xf5f2('0x16')](function(_0x63dc22){if(!_0x63dc22){throw new db[(_0xf5f2('0x82'))][(_0xf5f2('0x83'))](_0xf5f2('0x84'));}_0x1cbc75=_[_0xf5f2('0x85')](_['keys'](_0x63dc22),[_0xf5f2('0x86'),'updatedAt']);_0x31a8e3=_[_0xf5f2('0x85')](_[_0xf5f2('0x37')](_0x63dc22),[_0xf5f2('0x86'),_0xf5f2('0x87'),_0xf5f2('0x88'),_0xf5f2('0x89')]);if(_0x57708f[_0xf5f2('0x52')]['id']){delete _0x57708f[_0xf5f2('0x52')]['id'];}if(_[_0xf5f2('0x72')](_0x57708f[_0xf5f2('0x52')][_0xf5f2('0x8a')])){throw new db['Sequelize'][(_0xf5f2('0x83'))](_0xf5f2('0x8b'));}if(_[_0xf5f2('0x72')](_0x57708f[_0xf5f2('0x52')][_0xf5f2('0x52')])||_0x57708f[_0xf5f2('0x52')][_0xf5f2('0x52')]===''){throw new db['Sequelize'][(_0xf5f2('0x83'))](_0xf5f2('0x8c'));}if(_[_0xf5f2('0x72')](_0x57708f[_0xf5f2('0x52')][_0xf5f2('0x8d')])){throw new db[(_0xf5f2('0x82'))][(_0xf5f2('0x83'))](_0xf5f2('0x8e')+_0x31a8e3);}if(!_[_0xf5f2('0x8f')](_0x31a8e3,_0x57708f[_0xf5f2('0x52')][_0xf5f2('0x8d')])){throw new db[(_0xf5f2('0x82'))][(_0xf5f2('0x83'))](_0xf5f2('0x90')+_0x31a8e3);}_0x3a0e5c[_0x57708f[_0xf5f2('0x52')][_0xf5f2('0x8d')]]=_0x57708f['body'][_0xf5f2('0x8a')];})[_0xf5f2('0x16')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x57708f[_0xf5f2('0x53')]['id']},'include':[{'model':db[_0xf5f2('0x91')],'as':_0xf5f2('0x92'),'include':[{'model':db[_0xf5f2('0x81')],'as':'Contacts','where':_0x3a0e5c,'limit':0x1,'order':[[_0xf5f2('0x87'),_0xf5f2('0x93')]]}]},{'model':db[_0xf5f2('0x94')],'as':_0xf5f2('0x95')}]});})[_0xf5f2('0x16')](handleEntityNotFound(_0x38cb63,null))[_0xf5f2('0x16')](function(_0x5960d4){if(_0x5960d4&&_0x5960d4[_0xf5f2('0x92')]){_0x545739['account']=_0x5960d4;_0x545739['applications']=_0x5960d4[_0xf5f2('0x95')];_0x545739[_0xf5f2('0x96')]=_0x5960d4[_0xf5f2('0x92')];_0x545739[_0xf5f2('0x97')]=_[_0xf5f2('0x98')](_0x545739[_0xf5f2('0x97')],[_0xf5f2('0x99')],['asc']);if(_0x545739[_0xf5f2('0x9a')][_0xf5f2('0x95')]){delete _0x545739[_0xf5f2('0x9a')]['Applications'];}if(_0x545739[_0xf5f2('0x9a')]['List']&&_0x545739['account'][_0xf5f2('0x92')]['Contacts'][_0xf5f2('0x3c')]){return _0x545739[_0xf5f2('0x9a')]['List'][_0xf5f2('0x9b')][0x0];}var _0xdf8f44=_['defaults'](_0x57708f[_0xf5f2('0x52')],{'firstName':_0x57708f[_0xf5f2('0x52')][_0xf5f2('0x8a')],'ListId':_0x5960d4[_0xf5f2('0x89')]});_0xdf8f44[_0x57708f[_0xf5f2('0x52')]['mapKey']]=_0x57708f[_0xf5f2('0x52')][_0xf5f2('0x8a')];return db['CmContact']['create'](_0xdf8f44,{'fields':_0x1cbc75,'raw':!![]});}})[_0xf5f2('0x16')](handleEntityNotFound(_0x38cb63,null))[_0xf5f2('0x16')](function(_0x2d3ed2){_0x545739[_0xf5f2('0x9c')]=_0x2d3ed2;var _0x1f51d8=_0x57708f[_0xf5f2('0x52')][_0xf5f2('0x9d')];if(_0x57708f[_0xf5f2('0x7f')]['cf-connecting-ip']){_0x1f51d8=_0x57708f['headers'][_0xf5f2('0x9e')];}else if(_0x57708f['headers'][_0xf5f2('0x9f')]){_0x1f51d8=_[_0xf5f2('0xa0')](_0x57708f[_0xf5f2('0x7f')][_0xf5f2('0x9f')]['split'](','));}if(_0x2d3ed2){var _0x412a24={'ContactId':_0x2d3ed2['id'],'ChatWebsiteId':_0x57708f[_0xf5f2('0x53')]['id'],'from':(_0x2d3ed2[_0xf5f2('0xa1')]||'')+'\x20'+(_0x2d3ed2[_0xf5f2('0xa2')]||''),'customerIp':_0x1f51d8,'customerPort':_0x57708f[_0xf5f2('0x7f')]['x-real-port']?_0x57708f[_0xf5f2('0x7f')][_0xf5f2('0xa3')]:null,'referer':_0x57708f[_0xf5f2('0x52')][_0xf5f2('0xa4')],'browserName':_0x1d1588[_0xf5f2('0xa5')][_0xf5f2('0x30')]&&_0x1d1588[_0xf5f2('0xa5')][_0xf5f2('0xa6')]?util[_0xf5f2('0xa7')](_0xf5f2('0xa8'),_0x1d1588[_0xf5f2('0xa5')][_0xf5f2('0x30')],_0x1d1588['browser'][_0xf5f2('0xa6')]):'unknown','browserVersion':_0x1d1588[_0xf5f2('0xa5')][_0xf5f2('0xa6')]||_0xf5f2('0xa9'),'osName':util[_0xf5f2('0xa7')](_0xf5f2('0xa8'),_0x1d1588['os'][_0xf5f2('0x30')],_0x1d1588['os'][_0xf5f2('0xa6')]),'osVersion':_0x1d1588['os'][_0xf5f2('0xa6')],'deviceModel':_0x1d1588[_0xf5f2('0xaa')][_0xf5f2('0x35')]&&_0x1d1588[_0xf5f2('0xaa')][_0xf5f2('0xab')]?util[_0xf5f2('0xa7')](_0xf5f2('0xac'),_0x1d1588[_0xf5f2('0xaa')][_0xf5f2('0x35')],_0x1d1588[_0xf5f2('0xaa')][_0xf5f2('0xab')],_0x1d1588['device'][_0xf5f2('0x34')]):null,'deviceVendor':_0x1d1588['device']['vendor'],'deviceType':_0x1d1588[_0xf5f2('0xaa')][_0xf5f2('0x34')],'formData':JSON['stringify'](_0x57708f[_0xf5f2('0x52')])};var _0xfb1a4f={'ChatWebsiteId':_0x57708f[_0xf5f2('0x53')]['id'],'closed':![]};if(_0x57708f[_0xf5f2('0x52')][_0xf5f2('0xad')]){_0xfb1a4f[_0xf5f2('0xad')]=_0x57708f[_0xf5f2('0x52')][_0xf5f2('0xad')];return db['ChatInteraction'][_0xf5f2('0x50')]({'where':_0xfb1a4f})[_0xf5f2('0x16')](function(_0x10f398){if(_0x10f398){return[_0x10f398,![]];}_0x412a24['threadId']=_0x57708f[_0xf5f2('0x52')][_0xf5f2('0xad')];_0x412a24[_0xf5f2('0xae')]=_0x57708f[_0xf5f2('0x52')]['externalUrl'];return db['ChatInteraction'][_0xf5f2('0x4b')](_0x412a24)[_0xf5f2('0x16')](function(_0x46a0ee){return[_0x46a0ee,!![]];});});}_0xfb1a4f[_0xf5f2('0xaf')]=_0x2d3ed2['id'];if(_0x57708f[_0xf5f2('0x52')][_0xf5f2('0xb0')]&&_0x57708f[_0xf5f2('0x52')][_0xf5f2('0xb0')]['id']){_0xfb1a4f['id']=_0x57708f[_0xf5f2('0x52')][_0xf5f2('0xb0')]['id'];return db['ChatInteraction'][_0xf5f2('0x50')]({'where':_0xfb1a4f})[_0xf5f2('0x16')](function(_0x3881cd){if(_0x3881cd){return[_0x3881cd,![]];}return db['ChatInteraction'][_0xf5f2('0x4b')](_0x412a24)[_0xf5f2('0x16')](function(_0x51f883){return[_0x51f883,!![]];});});}return db[_0xf5f2('0xb1')]['create'](_0x412a24)[_0xf5f2('0x16')](function(_0x155b57){return[_0x155b57,!![]];});}})['spread'](function(_0x73c242,_0x59d257){if(_0x73c242){_0x12a0cb=_0x59d257;if(!_0x59d257){var _0x3815bf={'from':(_0x545739[_0xf5f2('0x9c')]['firstName']||'')+'\x20'+(_0x545739[_0xf5f2('0x9c')][_0xf5f2('0xa2')]||'')};if(_0x57708f[_0xf5f2('0x52')][_0xf5f2('0xad')]&&_0x57708f[_0xf5f2('0x52')]['messageId']&&_0x57708f[_0xf5f2('0x52')][_0xf5f2('0xad')]!=_0x57708f[_0xf5f2('0x52')][_0xf5f2('0xb2')]){_0x3815bf[_0xf5f2('0xad')]=_0x57708f[_0xf5f2('0x52')][_0xf5f2('0xb2')];}return _0x73c242[_0xf5f2('0x2b')](_0x3815bf);}else{return _0x73c242;}}})[_0xf5f2('0x16')](function(_0x4918d4){_0x545739[_0xf5f2('0xb0')]=_0x4918d4['get']({'plain':!![]});_0x545739['interaction'][_0xf5f2('0xb3')]=_0x12a0cb;if(_0x545739[_0xf5f2('0xb0')][_0xf5f2('0xb3')]){if(_0x545739[_0xf5f2('0x9a')][_0xf5f2('0xb4')]){_0x545739[_0xf5f2('0x97')][_0xf5f2('0xb5')]({'id':0x0,'priority':_0x545739[_0xf5f2('0x97')][_0xf5f2('0x3c')]+0x1,'app':_0xf5f2('0xb6'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db['ChatMessage'][_0xf5f2('0x4b')]({'body':_0x57708f['body'][_0xf5f2('0x52')],'ChatWebsiteId':_0x57708f[_0xf5f2('0x53')]['id'],'ChatInteractionId':_0x4918d4['id'],'direction':'in','ContactId':_0x545739[_0xf5f2('0x9c')]['id'],'AttachmentId':_0x57708f['body'][_0xf5f2('0xb7')]});})[_0xf5f2('0x16')](function(_0x5e1f90){_0x545739['message']=_0x5e1f90;if(_0x545739['interaction'][_0xf5f2('0xb8')]){return db[_0xf5f2('0xb9')][_0xf5f2('0x50')]({'attributes':['id','name'],'where':{'id':_0x545739[_0xf5f2('0xb0')]['UserId']}})[_0xf5f2('0x16')](function(_0x103c39){if(_0x103c39){_0x545739[_0xf5f2('0x97')]['unshift']({'id':0x0,'priority':0x0,'app':_0xf5f2('0xba'),'appdata':_0x103c39['name']+','+(_0x545739[_0xf5f2('0x9a')][_0xf5f2('0xbb')]||0xa),'interval':_0xf5f2('0xbc')});_0x545739['forcedOwnership']=!![];}return respondWithRpcPromise(_0xf5f2('0xbd'),_0xf5f2('0xbe'),_0x545739);});}return respondWithRpcPromise('Start',_0xf5f2('0xbe'),_0x545739);})[_0xf5f2('0x16')](function(_0xf4ddc1){respondWithRpcPromise(_0xf5f2('0xbf'),_0xf5f2('0xbf'),{'event':_0xf5f2('0x7c'),'message':_0xf4ddc1},client9002);return _0xf4ddc1;})[_0xf5f2('0x16')](respondWithResult(_0x38cb63,null))[_0xf5f2('0x21')](handleError(_0x38cb63,null));};exports[_0xf5f2('0xc0')]=function(_0x2cbe4d,_0x443e22){var _0x371700,_0xf136bd,_0x16d956;var _0x23675a=[];var _0x131b59={};var _0x43bfd0=_0x2cbe4d[_0xf5f2('0xc1')]||[];var _0x2597b6=[];var _0x180f3d;return db[_0xf5f2('0x81')][_0xf5f2('0x55')]()['then'](function(_0x22964e){if(!_0x22964e){throw new db[(_0xf5f2('0x82'))][(_0xf5f2('0x83'))](_0xf5f2('0x84'));}_0x23675a=_['difference'](_[_0xf5f2('0x37')](_0x22964e),['createdAt',_0xf5f2('0x87'),_0xf5f2('0x88'),_0xf5f2('0x89')]);if(_0x2cbe4d[_0xf5f2('0x52')]['id']){delete _0x2cbe4d[_0xf5f2('0x52')]['id'];}if(_[_0xf5f2('0x72')](_0x2cbe4d[_0xf5f2('0x52')]['from'])){throw _0x443e22['status'](0x1f4)[_0xf5f2('0xc2')](new db[(_0xf5f2('0x82'))][(_0xf5f2('0x83'))](_0xf5f2('0x8b')));}if(_['isNil'](_0x2cbe4d[_0xf5f2('0x52')][_0xf5f2('0x52')])||_0x2cbe4d[_0xf5f2('0x52')][_0xf5f2('0x52')]===''){throw _0x443e22[_0xf5f2('0x23')](0x1f4)[_0xf5f2('0xc2')](new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xf5f2('0x72')](_0x2cbe4d[_0xf5f2('0x52')][_0xf5f2('0xc3')])){throw _0x443e22['status'](0x1f4)[_0xf5f2('0xc2')](new db['Sequelize'][(_0xf5f2('0x83'))](_0xf5f2('0xc4')+_0x23675a));}if(!_[_0xf5f2('0x8f')](_0x23675a,_0x2cbe4d[_0xf5f2('0x52')][_0xf5f2('0xc3')])){throw _0x443e22[_0xf5f2('0x23')](0x1f4)[_0xf5f2('0xc2')](new db[(_0xf5f2('0x82'))][(_0xf5f2('0x83'))](_0xf5f2('0xc5')+_0x23675a));}_0x131b59[_0x2cbe4d[_0xf5f2('0x52')][_0xf5f2('0xc3')]]=_0x2cbe4d[_0xf5f2('0x52')][_0xf5f2('0x8a')];})['then'](function(){return db[_0xf5f2('0x33')][_0xf5f2('0x50')]({'where':{'id':_0x2cbe4d[_0xf5f2('0x53')]['id']},'include':[{'model':db[_0xf5f2('0x91')],'as':'List'},{'model':db[_0xf5f2('0xc6')],'as':_0xf5f2('0xc6')}]});})[_0xf5f2('0x16')](handleEntityNotFound(_0x443e22,null))[_0xf5f2('0x16')](function(_0x493932){if(_0x493932&&_0x493932[_0xf5f2('0x92')]){_0xf136bd=_0x493932;var _0x5462ac=_[_0xf5f2('0xd')](_0x2cbe4d[_0xf5f2('0x52')],{'firstName':_0x2cbe4d[_0xf5f2('0x52')][_0xf5f2('0x8a')],'phone':_0x2cbe4d['body'][_0xf5f2('0x8a')],'ListId':_0x493932[_0xf5f2('0x89')]});_0x5462ac[_0x2cbe4d[_0xf5f2('0x52')][_0xf5f2('0xc3')]]=_0x2cbe4d[_0xf5f2('0x52')][_0xf5f2('0x8a')];return db['CmContact'][_0xf5f2('0xc7')]({'where':_0x131b59,'defaults':_0x5462ac});}})[_0xf5f2('0xc8')](function(_0x424b57){if(_0x424b57){_0x16d956=_0x424b57;var _0x3dcf4e=fs[_0xf5f2('0xc9')](path[_0xf5f2('0x6d')](config[_0xf5f2('0x6e')],_0xf5f2('0xca')),_0xf5f2('0xcb'));var _0x52fe4e=ejs[_0xf5f2('0xcc')](_0x3dcf4e,{'body':_[_0xf5f2('0xcd')](_0x2cbe4d[_0xf5f2('0x52')][_0xf5f2('0x52')]),'bodyTitle':_0xf136bd['offlineMessageBody']});return db['ChatOfflineMessage'][_0xf5f2('0x4b')]({'body':_0x52fe4e,'plainBody':htmlToText[_0xf5f2('0xce')](_0x52fe4e),'ContactId':_0x424b57['id'],'ChatWebsiteId':_0xf136bd['id']});}})[_0xf5f2('0x16')](function(_0x5851da){_0x180f3d=_0x5851da;if(_0x43bfd0['length']){var _0x29488a=_0x43bfd0[_0xf5f2('0x32')](function(_0x575a29){return{'name':_0x575a29[_0xf5f2('0xcf')],'basename':_0x575a29[_0xf5f2('0x68')],'type':_0x575a29[_0xf5f2('0xd0')],'ChatOfflineMessageId':_0x5851da['id']};});_0x2597b6=_0x29488a['map'](_0x1be84b=>{var _0x30f6d7={'filename':_0x1be84b[_0xf5f2('0x30')],'path':path[_0xf5f2('0x6d')](config['root'],'server',_0xf5f2('0xc1'),'attachments',_0xf5f2('0xd1'),_0x1be84b[_0xf5f2('0xd2')])};return _0x30f6d7;});if(!_0xf136bd[_0xf5f2('0xd3')]){return db[_0xf5f2('0xd4')][_0xf5f2('0xd5')](function(_0x3d6d4c){return db[_0xf5f2('0xd6')][_0xf5f2('0xd7')](_0x29488a,{'transaction':_0x3d6d4c});});}}})[_0xf5f2('0x16')](function(){if(_0x180f3d){_0x371700=_0x180f3d;return db[_0xf5f2('0xc6')][_0xf5f2('0x59')]({'where':{'active':!![]},'include':[{'model':db[_0xf5f2('0xd8')],'as':_0xf5f2('0xd9'),'raw':!![]}]});}})[_0xf5f2('0x16')](function(_0x56a2ed){if(_0x56a2ed&&_0x56a2ed[_0xf5f2('0xd9')]&&_0xf136bd[_0xf5f2('0xda')]&&_0xf136bd[_0xf5f2('0xdb')]){var _0x3eedf3={'tls':{'rejectUnauthorized':![]}};if(_0x56a2ed[_0xf5f2('0xd9')]['service']){_0x3eedf3[_0xf5f2('0xdc')]=_0x56a2ed[_0xf5f2('0xd9')]['service'];}else{_0x3eedf3[_0xf5f2('0xdd')]=_0x56a2ed[_0xf5f2('0xd9')]['host'];_0x3eedf3['port']=_0x56a2ed[_0xf5f2('0xd9')][_0xf5f2('0xde')];_0x3eedf3[_0xf5f2('0xdf')]=_0x56a2ed['Smtp']['secure'];}if(_0x56a2ed[_0xf5f2('0xd9')][_0xf5f2('0xe0')]){_0x3eedf3[_0xf5f2('0xe1')]={'user':_0x56a2ed[_0xf5f2('0xd9')][_0xf5f2('0x4c')],'pass':_0x56a2ed[_0xf5f2('0xd9')][_0xf5f2('0xe2')]};}return respondWithRpcPromise(_0xf5f2('0xe3'),_0xf5f2('0xe4'),{'account':_0x3eedf3,'message':{'from':util[_0xf5f2('0xa7')]('\x22%s\x22\x20<%s>',_0x56a2ed[_0xf5f2('0x30')],_0x56a2ed[_0xf5f2('0xe5')]||_0x56a2ed['Smtp'][_0xf5f2('0x4c')]),'to':_0xf136bd[_0xf5f2('0xdb')],'subject':_0xf136bd[_0xf5f2('0xe6')],'html':_0x371700[_0xf5f2('0x52')],'attachments':_0x2597b6}},client9003)[_0xf5f2('0x16')](function(){return _0x371700;})['catch'](function(_0x5c6893){console[_0xf5f2('0x1c')](_0x5c6893);});}})[_0xf5f2('0x16')](function(){if(_0xf136bd&&_0xf136bd[_0xf5f2('0xd3')]&&_0xf136bd[_0xf5f2('0xe7')]){var _0x4a45d4=[];if(_0x43bfd0[_0xf5f2('0x3c')]){_0x4a45d4=_0x43bfd0[_0xf5f2('0x32')](function(_0x1860d9){return{'name':_0x1860d9[_0xf5f2('0xcf')],'basename':_0x1860d9['filename'],'type':_0x1860d9['mimetype'],'ChatOfflineMessageId':_0x180f3d['id']};});}var _0x5a54f2;if(!_['isNil'](_0xf136bd[_0xf5f2('0xe8')])){var _0x496802=_['map'](_0x2cbe4d['body'],function(_0x4966cf){return _0x4966cf;});var _0x16bcfa=_['toPairsIn'](_0x496802)[0x0];var _0x4b6023=_[_0xf5f2('0xe9')](_0x16bcfa,function(_0x14b886){return _0x14b886;});_0x5a54f2=_0x4b6023[0x1][_0xf136bd[_0xf5f2('0xe8')]];}var _0x327e03={'from':_0x16d956['email'],'firstName':_0x16d956[_0xf5f2('0xa1')],'lastName':_0x16d956[_0xf5f2('0xa2')],'mapKey':_0xf5f2('0xe5'),'message':{'from':_0x16d956[_0xf5f2('0xe5')],'to':_0xf136bd[_0xf5f2('0xc6')][_0xf5f2('0xe5')],'cc':'','subject':_[_0xf5f2('0x72')](_0x5a54f2)?_0xf136bd['offlineMessageSubject']:_0x5a54f2,'messageId':'','sentAt':new Date(),'attach':_0x4a45d4[_0xf5f2('0x3c')],'attachments':_0x4a45d4,'originChannel':_0xf5f2('0xea'),'ChatWebsiteId':_0xf136bd['id'],'ChatOfflineMessageId':_0x371700['id'],'originTo':_0xf136bd['MailAccount'][_0xf5f2('0xe5')]},'body':_0x371700[_0xf5f2('0x52')]};var _0x519952={'account':{'id':_0xf136bd[_0xf5f2('0xe7')]},'body':_0x327e03,'log':_0xf5f2('0xeb')};return respondWithRpcPromise('NotifyMailAccount',_0xf5f2('0xec'),_0x519952,client9001)['then'](function(){return _0x371700;})[_0xf5f2('0x21')](function(_0x2bbc23){console[_0xf5f2('0x1c')](_0x2bbc23);});}return;})[_0xf5f2('0x16')](function(){if(_0x371700){return _0x371700;}})['then'](respondWithResult(_0x443e22,null))['catch'](function(_0x320ca1){console[_0xf5f2('0x1c')](_0xf5f2('0x21'),_0x320ca1);for(var _0x4444db of _0x43bfd0){var _0x20ea21=path[_0xf5f2('0x6d')](config[_0xf5f2('0x6e')],_0xf5f2('0xed'),'files','attachments',_0xf5f2('0xd1'),_0x4444db[_0xf5f2('0x68')]);fs_extra['remove'](_0x20ea21)[_0xf5f2('0x21')](function(_0x74e188){console[_0xf5f2('0x1c')](_0xf5f2('0xee'),_0x20ea21,_0x74e188);});}});};exports[_0xf5f2('0xef')]=function(_0x33ad09,_0x2bc493){return db[_0xf5f2('0xb1')][_0xf5f2('0x50')]({'where':{'id':_0x33ad09[_0xf5f2('0x53')]['id']}})[_0xf5f2('0x16')](handleEntityNotFound(_0x2bc493,null))[_0xf5f2('0x16')](function(_0x212d97){if(_0x212d97){return _0x212d97[_0xf5f2('0xef')](_0x33ad09[_0xf5f2('0x52')][_0xf5f2('0x5e')],_[_0xf5f2('0xf0')](_0x33ad09['body'],[_0xf5f2('0x5e'),'id'])||{});}})['then'](respondWithResult(_0x2bc493,null))[_0xf5f2('0x21')](handleError(_0x2bc493,null));};exports['getInteractions']=function(_0x47bc74,_0x2e249e){var _0x424cf3={'raw':![],'where':{}};var _0x3844a0={};var _0x1e33c7={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xf5f2('0x59')]({'where':{'id':_0x47bc74[_0xf5f2('0x53')]['id']}})['then'](handleEntityNotFound(_0x2e249e,null))['then'](function(_0x5d685d){if(_0x5d685d){_0x3844a0[_0xf5f2('0x35')]=_[_0xf5f2('0x37')](db['ChatInteraction'][_0xf5f2('0x61')]);_0x3844a0[_0xf5f2('0x36')]=_[_0xf5f2('0x37')](_0x47bc74['query']);_0x3844a0[_0xf5f2('0x38')]=_[_0xf5f2('0x3a')](_0x3844a0[_0xf5f2('0x35')],_0x3844a0[_0xf5f2('0x36')]);_0x424cf3[_0xf5f2('0x39')]=_[_0xf5f2('0x3a')](_0x3844a0['model'],qs['fields'](_0x47bc74[_0xf5f2('0x36')][_0xf5f2('0x3b')]));_0x424cf3['attributes']=_0x424cf3['attributes'][_0xf5f2('0x3c')]?_0x424cf3['attributes']:_0x3844a0[_0xf5f2('0x35')];if(!_0x47bc74[_0xf5f2('0x36')][_0xf5f2('0x3d')](_0xf5f2('0x3e'))){_0x424cf3[_0xf5f2('0x28')]=qs[_0xf5f2('0x28')](_0x47bc74[_0xf5f2('0x36')][_0xf5f2('0x28')]);_0x424cf3[_0xf5f2('0x26')]=qs[_0xf5f2('0x26')](_0x47bc74['query'][_0xf5f2('0x26')]);}_0x424cf3[_0xf5f2('0x5b')]=qs[_0xf5f2('0x3f')](_0x47bc74[_0xf5f2('0x36')]['sort']);_0x424cf3[_0xf5f2('0x40')]=qs[_0xf5f2('0x38')](_['pick'](_0x47bc74[_0xf5f2('0x36')],_0x3844a0['filters']));_0x424cf3[_0xf5f2('0x40')][_0xf5f2('0x57')]=_0x5d685d['id'];if(_0x47bc74['query'][_0xf5f2('0x42')]){_0x424cf3[_0xf5f2('0x40')]=_[_0xf5f2('0x43')](_0x424cf3[_0xf5f2('0x40')],{'$or':_['map'](_0x424cf3[_0xf5f2('0x39')],function(_0x2acdea){var _0x20d3b6={};_0x20d3b6[_0x2acdea]={'$like':'%'+_0x47bc74['query'][_0xf5f2('0x42')]+'%'};return _0x20d3b6;})});}_0x424cf3=_[_0xf5f2('0x43')]({},_0x424cf3,_0x47bc74['options']);return db[_0xf5f2('0xb1')][_0xf5f2('0x29')]({'where':_0x424cf3[_0xf5f2('0x40')]})[_0xf5f2('0x16')](function(_0x1ce278){_0x1e33c7[_0xf5f2('0x29')]=_0x1ce278;if(_0x47bc74[_0xf5f2('0x36')][_0xf5f2('0x46')]){_0x424cf3[_0xf5f2('0x47')]=[{'model':db['CmContact'],'as':_0xf5f2('0xf1'),'required':![]},{'model':db[_0xf5f2('0xb9')],'as':_0xf5f2('0xf2'),'attributes':[_0xf5f2('0x30'),_0xf5f2('0xf3'),_0xf5f2('0xf4')],'required':![]},{'model':db[_0xf5f2('0xf5')],'as':_0xf5f2('0xf6'),'attributes':['id',_0xf5f2('0x30'),_0xf5f2('0xf7')],'where':_0x47bc74[_0xf5f2('0x36')]['tag']?{'id':_0x47bc74['query']['tag']}:undefined,'required':_0x47bc74[_0xf5f2('0x36')][_0xf5f2('0xf8')]?!![]:![]}];}return db[_0xf5f2('0xb1')]['findAll'](_0x424cf3);})[_0xf5f2('0x16')](function(_0xf297ac){_0x1e33c7[_0xf5f2('0x5c')]=_0xf297ac;return _0x1e33c7;});}})['then'](respondWithFilteredResult(_0x2e249e,_0x424cf3))[_0xf5f2('0x21')](handleError(_0x2e249e,null));};function iftimePromise(_0x39da07,_0xdd1f59){return respondWithRpcPromise(_0xf5f2('0xf9'),_0xf5f2('0xfa'),{'command':_0xdd1f59[_0xf5f2('0xfb')]?util[_0xf5f2('0xa7')](_0xf5f2('0xfc'),_0x39da07['interval'],_0xdd1f59[_0xf5f2('0xfb')]):util[_0xf5f2('0xa7')](_0xf5f2('0xfd'),_0x39da07[_0xf5f2('0xfe')])},client9002)['then'](function(_0x319b39){var _0x2603fc=_0x319b39&&_0x319b39[_0xf5f2('0xff')]('true')>=0x0?!![]:![];logger[_0xf5f2('0x17')](_0xf5f2('0x100'),_0xdd1f59['id'],_0x39da07['id'],_0x39da07[_0xf5f2('0xfe')],_0x2603fc?_0xf5f2('0x101'):_0xf5f2('0x102'),_0xdd1f59['timezone']?_0xdd1f59[_0xf5f2('0xfb')]:_0xf5f2('0x103'));return _0x2603fc;})[_0xf5f2('0x21')](function(_0x4d8a71){logger[_0xf5f2('0x1c')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0xdd1f59['id'],_0x39da07['id'],_0x39da07[_0xf5f2('0xfe')],util[_0xf5f2('0x104')](_0x4d8a71,{'showHidden':![],'depth':null}),_0xdd1f59['timezone']?_0xdd1f59[_0xf5f2('0xfb')]:_0xf5f2('0x103'));return![];});}exports[_0xf5f2('0xfa')]=function(_0x51a144,_0x913112){var _0x2080a5=0x0;var _0x4054f4=0x0;var _0x34e335=![];var _0x373050;var _0x16ecd0;return db[_0xf5f2('0x33')][_0xf5f2('0x50')]({'where':{'id':_0x51a144[_0xf5f2('0x53')]['id']},'include':[{'model':db[_0xf5f2('0x105')],'as':_0xf5f2('0x105'),'include':[{'model':db['Interval'],'as':_0xf5f2('0x106'),'attributes':['id',_0xf5f2('0xfe')],'raw':!![]}]}]})[_0xf5f2('0x16')](handleEntityNotFound(_0x913112,null))[_0xf5f2('0x16')](function(_0x245f3a){if(_0x245f3a){_0x373050=_0x245f3a;return _0x245f3a[_0xf5f2('0x107')]({'raw':!![]});}})[_0xf5f2('0x16')](function(_0x520b61){if(_0x373050){if(_0x520b61){_0x16ecd0=_0x520b61;}}return require(_0xf5f2('0x6f'))[_0xf5f2('0x70')]();})[_0xf5f2('0x16')](function(_0x2afb04){if(_0x2afb04){_0x4054f4=_0x2afb04[_0xf5f2('0x108')];_0x34e335=_0x2afb04[_0xf5f2('0x71')];}})['then'](function(){return db[_0xf5f2('0xb1')][_0xf5f2('0x29')]({'where':{'closed':![]}});})[_0xf5f2('0x16')](function(_0x40f64c){_0x2080a5=_0x40f64c;if(_0x4054f4&&_0x40f64c>_0x4054f4){return db[_0xf5f2('0x109')][_0xf5f2('0x59')]({'where':{'id':0x1}})[_0xf5f2('0x16')](function(_0x36f113){if(_0x36f113){_0x36f113[_0xf5f2('0x10a')]('chatLicenseExceeded');}});}})[_0xf5f2('0x16')](function(){if(_0x373050['Interval']&&_0x373050[_0xf5f2('0x105')][_0xf5f2('0x106')]){var _0x36ced0=[];for(var _0x12c45b=0x0;_0x12c45b<_0x373050[_0xf5f2('0x105')][_0xf5f2('0x106')][_0xf5f2('0x3c')];_0x12c45b++){var _0x53745d=_0x373050[_0xf5f2('0x105')][_0xf5f2('0x106')][_0x12c45b][_0xf5f2('0x4d')]({'plain':!![]});_0x36ced0['push'](iftimePromise(_0x53745d,_0x373050));}return BPromise[_0xf5f2('0x10b')](_0x36ced0)[_0xf5f2('0x16')](function(_0x40c8ab){return _[_0xf5f2('0x10c')](_0x40c8ab);});}else{return!![];}})['then'](function(_0x368691){var _0x56c1dd=fs['readFileSync'](path[_0xf5f2('0x6d')](config[_0xf5f2('0x6e')],'server/files/chat/iframe.ejs'),'utf8');var _0x5b850a={'remote':_0x373050[_0xf5f2('0x10d')],'query':querystring['stringify'](_['merge'](_0x373050[_0xf5f2('0x4d')]({'plain':!![]}),{'customerIp':_0x51a144[_0xf5f2('0x7f')][_0xf5f2('0x9f')]||_0x51a144[_0xf5f2('0x7f')][_0xf5f2('0x10e')]||_0x51a144[_0xf5f2('0x10f')][_0xf5f2('0x110')]||_0x51a144['ip'],'referer':_0x51a144[_0xf5f2('0x7f')]['referer'],'openedInteractions':_0x2080a5,'maxInteractions':_0x4054f4,'virtual':_0x34e335[_0xf5f2('0x108')],'online':_0x368691,'custom':_0x34e335}))[_0xf5f2('0x111')](/'/g,'\x5c\x27')};_0x913112[_0xf5f2('0xc2')](ejs[_0xf5f2('0xcc')](Mustache['render'](_0x56c1dd,_0x5b850a),{'proactiveActions':_0x16ecd0,'alignment':_0x373050[_0xf5f2('0x112')],'verticalAlignment':_0x373050[_0xf5f2('0x113')],'div_color':_0x373050[_0xf5f2('0xf7')],'labelText':_0x373050[_0xf5f2('0x114')],'text_color':_0x373050[_0xf5f2('0x115')],'button_color':_0x373050[_0xf5f2('0x116')],'background_color':_0x373050[_0xf5f2('0x117')]}));})[_0xf5f2('0x21')](handleError(_0x913112,null));};exports['addApplications']=function(_0x35f35d,_0x3f7cb0){var _0x3dce25=_0x35f35d['params']['id'];var _0x85f863=_0x35f35d[_0xf5f2('0x52')];var _0x178617=0xc8;var _0x4e0693=null;return db['sequelize'][_0xf5f2('0xd5')]({'isolationLevel':db[_0xf5f2('0xd4')][_0xf5f2('0x118')][_0xf5f2('0x119')][_0xf5f2('0x11a')]},function(_0x3ce5f4){return db[_0xf5f2('0x33')][_0xf5f2('0x59')]({'where':{'id':_0x3dce25},'transaction':_0x3ce5f4})[_0xf5f2('0x16')](function(_0x1ea3a1){if(_0x1ea3a1){return db[_0xf5f2('0x94')][_0xf5f2('0x2c')]({'where':{'ChatWebsiteId':_0x3dce25},'transaction':_0x3ce5f4})[_0xf5f2('0x16')](function(){var _0x449fcb=_[_0xf5f2('0x32')](_0x85f863,function(_0x161284){_0x161284[_0xf5f2('0x57')]=_0x3dce25;return _0x161284;});return db[_0xf5f2('0x94')]['bulkCreate'](_0x449fcb,{'transaction':_0x3ce5f4});});}else{_0x178617=0x194;_0x4e0693=[];}});})[_0xf5f2('0x16')](function(){if(_0x178617!==0x194){return db[_0xf5f2('0x94')][_0xf5f2('0x11b')]({'where':{'ChatWebsiteId':_0x3dce25},'order':'priority'})[_0xf5f2('0x16')](function(_0x3e3761){_0x4e0693=_0x3e3761;});}})['catch'](function(_0x32de20){_0x178617=0x1f4;logger[_0xf5f2('0x1c')](_0x32de20[_0xf5f2('0x2f')]);if(_0x32de20[_0xf5f2('0x30')]){delete _0x32de20[_0xf5f2('0x30')];}_0x4e0693=_0x32de20;})[_0xf5f2('0x11c')](function(){if(_0x4e0693===null){_0x3f7cb0[_0xf5f2('0x22')](_0x178617);}else{if(_0x178617===0x1f4){_0x3f7cb0['status'](_0x178617)[_0xf5f2('0xc2')](_0x4e0693);}else{_0x3f7cb0[_0xf5f2('0x23')](_0x178617)[_0xf5f2('0x25')](_0x4e0693);}}});};exports[_0xf5f2('0x11d')]=function(_0x3da8ff,_0x2d4a46){var _0x2e82da={};var _0x230137={};var _0x39096d;var _0x2eda17;return db[_0xf5f2('0x33')]['findOne']({'where':{'id':_0x3da8ff[_0xf5f2('0x53')]['id']}})[_0xf5f2('0x16')](handleEntityNotFound(_0x2d4a46,null))[_0xf5f2('0x16')](function(_0x1b09e1){if(_0x1b09e1){_0x39096d=_0x1b09e1;_0x230137[_0xf5f2('0x35')]=_[_0xf5f2('0x37')](db['ChatApplication'][_0xf5f2('0x61')]);_0x230137['query']=_[_0xf5f2('0x37')](_0x3da8ff['query']);_0x230137[_0xf5f2('0x38')]=_[_0xf5f2('0x3a')](_0x230137[_0xf5f2('0x35')],_0x230137[_0xf5f2('0x36')]);_0x2e82da[_0xf5f2('0x39')]=_[_0xf5f2('0x3a')](_0x230137[_0xf5f2('0x35')],qs[_0xf5f2('0x3b')](_0x3da8ff['query'][_0xf5f2('0x3b')]));_0x2e82da['attributes']=_0x2e82da['attributes'][_0xf5f2('0x3c')]?_0x2e82da[_0xf5f2('0x39')]:_0x230137[_0xf5f2('0x35')];_0x2e82da['order']=qs[_0xf5f2('0x3f')](_0x3da8ff[_0xf5f2('0x36')]['sort']);_0x2e82da[_0xf5f2('0x40')]=qs[_0xf5f2('0x38')](_[_0xf5f2('0x41')](_0x3da8ff[_0xf5f2('0x36')],_0x230137[_0xf5f2('0x38')]));if(_0x3da8ff[_0xf5f2('0x36')][_0xf5f2('0x42')]){_0x2e82da[_0xf5f2('0x40')]=_[_0xf5f2('0x43')](_0x2e82da[_0xf5f2('0x40')],{'$or':_[_0xf5f2('0x32')](_0x2e82da[_0xf5f2('0x39')],function(_0x3ae449){var _0x40da7b={};_0x40da7b[_0x3ae449]={'$like':'%'+_0x3da8ff[_0xf5f2('0x36')][_0xf5f2('0x42')]+'%'};return _0x40da7b;})});}_0x2e82da=_['merge']({},_0x2e82da,_0x3da8ff[_0xf5f2('0x45')]);return _0x39096d[_0xf5f2('0x11d')](_0x2e82da);}})[_0xf5f2('0x16')](function(_0xabf41d){if(_0xabf41d){_0x2eda17=_0xabf41d[_0xf5f2('0x3c')];if(!_0x3da8ff[_0xf5f2('0x36')][_0xf5f2('0x3d')]('nolimit')){_0x2e82da[_0xf5f2('0x28')]=qs[_0xf5f2('0x28')](_0x3da8ff['query']['limit']);_0x2e82da[_0xf5f2('0x26')]=qs[_0xf5f2('0x26')](_0x3da8ff[_0xf5f2('0x36')][_0xf5f2('0x26')]);}return _0x39096d['getApplications'](_0x2e82da);}})[_0xf5f2('0x16')](function(_0x181fec){if(_0x181fec){return _0x181fec?{'count':_0x2eda17,'rows':_0x181fec}:null;}})['then'](respondWithResult(_0x2d4a46,null))[_0xf5f2('0x21')](handleError(_0x2d4a46,null));};exports[_0xf5f2('0x11e')]=function(_0xd0089a,_0x4eba0f){return db[_0xf5f2('0x11f')]['find']({'where':{'id':_0xd0089a['params']['id']}})['then'](handleEntityNotFound(_0x4eba0f,null))['then'](function(_0x4e8602){if(_0x4e8602){return _0x4e8602['addProactiveActions'](_0xd0089a[_0xf5f2('0x52')][_0xf5f2('0x5e')],_[_0xf5f2('0xf0')](_0xd0089a[_0xf5f2('0x52')],[_0xf5f2('0x5e'),'id'])||{});}})[_0xf5f2('0x16')](respondWithResult(_0x4eba0f,null))['catch'](handleError(_0x4eba0f,null));};exports['getProactiveActions']=function(_0x4a5170,_0x2200d7){var _0x529a0d={};var _0x362425={};var _0x35e34d;var _0x52ca4e;return db['ChatWebsite']['findOne']({'where':{'id':_0x4a5170[_0xf5f2('0x53')]['id']}})[_0xf5f2('0x16')](handleEntityNotFound(_0x2200d7,null))[_0xf5f2('0x16')](function(_0xb9c30e){if(_0xb9c30e){_0x35e34d=_0xb9c30e;_0x362425[_0xf5f2('0x35')]=_['keys'](db[_0xf5f2('0x120')]['rawAttributes']);_0x362425['query']=_[_0xf5f2('0x37')](_0x4a5170['query']);_0x362425[_0xf5f2('0x38')]=_[_0xf5f2('0x3a')](_0x362425[_0xf5f2('0x35')],_0x362425[_0xf5f2('0x36')]);_0x529a0d['attributes']=_['intersection'](_0x362425['model'],qs['fields'](_0x4a5170['query'][_0xf5f2('0x3b')]));_0x529a0d[_0xf5f2('0x39')]=_0x529a0d[_0xf5f2('0x39')][_0xf5f2('0x3c')]?_0x529a0d['attributes']:_0x362425[_0xf5f2('0x35')];_0x529a0d[_0xf5f2('0x5b')]=qs[_0xf5f2('0x3f')](_0x4a5170[_0xf5f2('0x36')][_0xf5f2('0x3f')]);_0x529a0d[_0xf5f2('0x40')]=qs[_0xf5f2('0x38')](_[_0xf5f2('0x41')](_0x4a5170['query'],_0x362425[_0xf5f2('0x38')]));if(_0x4a5170['query'][_0xf5f2('0x42')]){_0x529a0d['where']=_[_0xf5f2('0x43')](_0x529a0d[_0xf5f2('0x40')],{'$or':_[_0xf5f2('0x32')](_0x529a0d[_0xf5f2('0x39')],function(_0x2a5906){var _0x309bf0={};_0x309bf0[_0x2a5906]={'$like':'%'+_0x4a5170[_0xf5f2('0x36')][_0xf5f2('0x42')]+'%'};return _0x309bf0;})});}_0x529a0d=_['merge']({},_0x529a0d,_0x4a5170[_0xf5f2('0x45')]);return _0x35e34d['getProactiveActions'](_0x529a0d);}})[_0xf5f2('0x16')](function(_0x374f8f){if(_0x374f8f){_0x52ca4e=_0x374f8f['length'];if(!_0x4a5170[_0xf5f2('0x36')][_0xf5f2('0x3d')](_0xf5f2('0x3e'))){_0x529a0d[_0xf5f2('0x28')]=qs[_0xf5f2('0x28')](_0x4a5170['query']['limit']);_0x529a0d[_0xf5f2('0x26')]=qs[_0xf5f2('0x26')](_0x4a5170['query'][_0xf5f2('0x26')]);}return _0x35e34d[_0xf5f2('0x107')](_0x529a0d);}})[_0xf5f2('0x16')](function(_0x3d3172){if(_0x3d3172){return _0x3d3172?{'count':_0x52ca4e,'rows':_0x3d3172}:null;}})[_0xf5f2('0x16')](respondWithResult(_0x2200d7,null))[_0xf5f2('0x21')](handleError(_0x2200d7,null));};exports[_0xf5f2('0x121')]=function(_0x3c3d4b,_0x9fa01a){var _0x4f77b3=_0x3c3d4b[_0xf5f2('0x36')]['online']===_0xf5f2('0x122')?_0xf5f2('0x123'):'onlineForm';return db[_0xf5f2('0x33')][_0xf5f2('0x50')]({'attributes':['id',_0x4f77b3],'where':{'id':_0x3c3d4b[_0xf5f2('0x53')]['id']}})['then'](handleEntityNotFound(_0x9fa01a,null))[_0xf5f2('0x16')](function(_0x2a3171){if(_0x2a3171){var _0x3c0b9d=_0x2a3171[_0x4f77b3];var _0x540ad7=_0x3c0b9d&&_0x3c0b9d[_0xf5f2('0x124')]?_0x3c0b9d[_0xf5f2('0x124')]:[];_0x9fa01a['send']({'fromKey':_['isNil'](_0x3c0b9d[_0xf5f2('0x125')])?undefined:_0x3c0b9d[_0xf5f2('0x125')],'count':_0x540ad7[_0xf5f2('0x3c')],'rows':_0x540ad7});}})[_0xf5f2('0x21')](handleError(_0x9fa01a,null));};exports['getOfflineMessages']=function(_0x238d3c,_0x4f6f34){var _0x41dace={'raw':![],'where':{}};var _0x4bc856={};var _0x2fb3a8={'count':0x0,'rows':[]};return db[_0xf5f2('0x33')][_0xf5f2('0x59')]({'where':{'id':_0x238d3c[_0xf5f2('0x53')]['id']}})[_0xf5f2('0x16')](handleEntityNotFound(_0x4f6f34,null))[_0xf5f2('0x16')](function(_0xe195b2){if(_0xe195b2){_0x4bc856['model']=_[_0xf5f2('0x37')](db['ChatOfflineMessage'][_0xf5f2('0x61')]);_0x4bc856[_0xf5f2('0x36')]=_['keys'](_0x238d3c['query']);_0x4bc856['filters']=_[_0xf5f2('0x3a')](_0x4bc856['model'],_0x4bc856['query']);_0x41dace[_0xf5f2('0x39')]=_['intersection'](_0x4bc856[_0xf5f2('0x35')],qs[_0xf5f2('0x3b')](_0x238d3c['query'][_0xf5f2('0x3b')]));_0x41dace[_0xf5f2('0x39')]=_0x41dace[_0xf5f2('0x39')]['length']?_0x41dace[_0xf5f2('0x39')]:_0x4bc856['model'];if(!_0x238d3c[_0xf5f2('0x36')][_0xf5f2('0x3d')]('nolimit')){_0x41dace[_0xf5f2('0x28')]=qs[_0xf5f2('0x28')](_0x238d3c[_0xf5f2('0x36')][_0xf5f2('0x28')]);_0x41dace[_0xf5f2('0x26')]=qs['offset'](_0x238d3c[_0xf5f2('0x36')][_0xf5f2('0x26')]);}_0x41dace['order']=qs[_0xf5f2('0x3f')](_0x238d3c['query'][_0xf5f2('0x3f')]);_0x41dace['where']=qs['filters'](_['pick'](_0x238d3c[_0xf5f2('0x36')],_0x4bc856['filters']));_0x41dace[_0xf5f2('0x40')]['ChatWebsiteId']=_0xe195b2['id'];if(_0x238d3c[_0xf5f2('0x36')][_0xf5f2('0x42')]){_0x41dace[_0xf5f2('0x40')]=_['merge'](_0x41dace[_0xf5f2('0x40')],{'$or':_[_0xf5f2('0x32')](_0x41dace['attributes'],function(_0x607363){var _0x1bc32a={};_0x1bc32a[_0x607363]={'$like':'%'+_0x238d3c[_0xf5f2('0x36')][_0xf5f2('0x42')]+'%'};return _0x1bc32a;})});}_0x41dace=_[_0xf5f2('0x43')]({},_0x41dace,_0x238d3c[_0xf5f2('0x45')]);return db[_0xf5f2('0x126')][_0xf5f2('0x29')]({'where':_0x41dace[_0xf5f2('0x40')]})[_0xf5f2('0x16')](function(_0x27dc66){_0x2fb3a8[_0xf5f2('0x29')]=_0x27dc66;if(_0x238d3c[_0xf5f2('0x36')][_0xf5f2('0x46')]){_0x41dace['include']=[{'all':!![]}];}else{_0x41dace[_0xf5f2('0x47')]=[{'model':db[_0xf5f2('0x81')],'as':'Contact','required':![]},{'model':db[_0xf5f2('0xd6')],'as':_0xf5f2('0x127'),'required':![]}];}return db['ChatOfflineMessage'][_0xf5f2('0x48')](_0x41dace);})[_0xf5f2('0x16')](function(_0x24a45d){_0x2fb3a8[_0xf5f2('0x5c')]=_0x24a45d;return _0x2fb3a8;});}})[_0xf5f2('0x16')](respondWithFilteredResult(_0x4f6f34,_0x41dace))['catch'](handleError(_0x4f6f34,null));};exports[_0xf5f2('0x128')]=function(_0x5a7d2d,_0x1cb020){return db['ChatWebsite'][_0xf5f2('0x50')]({'where':{'id':_0x5a7d2d[_0xf5f2('0x53')]['id']}})[_0xf5f2('0x16')](handleEntityNotFound(_0x1cb020,null))[_0xf5f2('0x16')](function(_0x316498){if(_0x316498){return _0x316498[_0xf5f2('0x128')](_0x5a7d2d['body']['ids'],_[_0xf5f2('0xf0')](_0x5a7d2d[_0xf5f2('0x52')],[_0xf5f2('0x5e'),'id'])||{})[_0xf5f2('0xc8')](function(_0x561d6e){for(var _0x578fee=0x0;_0x578fee<_0x5a7d2d['body']['ids']['length'];_0x578fee+=0x1){socket[_0xf5f2('0x129')](_0xf5f2('0x12a'),{'UserId':Number(_0x5a7d2d[_0xf5f2('0x52')][_0xf5f2('0x5e')][_0x578fee]),'ChatWebsiteId':Number(_0x5a7d2d[_0xf5f2('0x53')]['id'])});}return _0x561d6e;});}})[_0xf5f2('0x16')](respondWithResult(_0x1cb020,null))[_0xf5f2('0x21')](handleError(_0x1cb020,null));};exports[_0xf5f2('0x12b')]=function(_0x525c61,_0x3cbaff){return db['ChatWebsite'][_0xf5f2('0x50')]({'where':{'id':_0x525c61[_0xf5f2('0x53')]['id']}})[_0xf5f2('0x16')](handleEntityNotFound(_0x3cbaff,null))['then'](function(_0x452579){if(_0x452579){return _0x452579[_0xf5f2('0x12b')](_0x525c61['query']['ids'])[_0xf5f2('0x16')](function(){if(_[_0xf5f2('0x12c')](_0x525c61[_0xf5f2('0x36')][_0xf5f2('0x5e')])){for(var _0x4eb8f2=0x0;_0x4eb8f2<_0x525c61[_0xf5f2('0x36')][_0xf5f2('0x5e')][_0xf5f2('0x3c')];_0x4eb8f2+=0x1){socket[_0xf5f2('0x129')](_0xf5f2('0x12d'),{'UserId':Number(_0x525c61[_0xf5f2('0x36')]['ids'][_0x4eb8f2]),'ChatWebsiteId':Number(_0x525c61[_0xf5f2('0x53')]['id'])});}}else{socket[_0xf5f2('0x129')](_0xf5f2('0x12d'),{'UserId':Number(_0x525c61[_0xf5f2('0x36')][_0xf5f2('0x5e')]),'ChatWebsiteId':Number(_0x525c61[_0xf5f2('0x53')]['id'])});}});}})[_0xf5f2('0x16')](respondWithStatusCode(_0x3cbaff,null))[_0xf5f2('0x21')](handleError(_0x3cbaff,null));};exports[_0xf5f2('0x12e')]=function(_0x197063,_0x1d0612){var _0x4af319={};var _0x31a5e6={};var _0x2f11b0;var _0x4dcc08;return db[_0xf5f2('0x33')][_0xf5f2('0x59')]({'where':{'id':_0x197063[_0xf5f2('0x53')]['id']}})[_0xf5f2('0x16')](handleEntityNotFound(_0x1d0612,null))[_0xf5f2('0x16')](function(_0x5776fa){if(_0x5776fa){_0x2f11b0=_0x5776fa;_0x31a5e6[_0xf5f2('0x35')]=_[_0xf5f2('0x37')](db['User'][_0xf5f2('0x61')]);_0x31a5e6['query']=_['keys'](_0x197063[_0xf5f2('0x36')]);_0x31a5e6[_0xf5f2('0x38')]=_[_0xf5f2('0x3a')](_0x31a5e6[_0xf5f2('0x35')],_0x31a5e6['query']);_0x4af319[_0xf5f2('0x39')]=_[_0xf5f2('0x3a')](_0x31a5e6[_0xf5f2('0x35')],qs['fields'](_0x197063['query']['fields']));_0x4af319[_0xf5f2('0x39')]=_0x4af319[_0xf5f2('0x39')]['length']?_0x4af319[_0xf5f2('0x39')]:_0x31a5e6[_0xf5f2('0x35')];_0x4af319[_0xf5f2('0x5b')]=qs[_0xf5f2('0x3f')](_0x197063[_0xf5f2('0x36')][_0xf5f2('0x3f')]);_0x4af319[_0xf5f2('0x40')]=qs['filters'](_[_0xf5f2('0x41')](_0x197063[_0xf5f2('0x36')],_0x31a5e6[_0xf5f2('0x38')]));if(_0x197063['query'][_0xf5f2('0x42')]){_0x4af319[_0xf5f2('0x40')]=_[_0xf5f2('0x43')](_0x4af319[_0xf5f2('0x40')],{'$or':_[_0xf5f2('0x32')](_0x4af319['attributes'],function(_0x1cc467){var _0x5834eb={};_0x5834eb[_0x1cc467]={'$like':'%'+_0x197063[_0xf5f2('0x36')][_0xf5f2('0x42')]+'%'};return _0x5834eb;})});}_0x4af319=_[_0xf5f2('0x43')]({},_0x4af319,_0x197063[_0xf5f2('0x45')]);return _0x2f11b0[_0xf5f2('0x12e')](_0x4af319);}})[_0xf5f2('0x16')](function(_0x3e68d7){if(_0x3e68d7){_0x4dcc08=_0x3e68d7[_0xf5f2('0x3c')];if(!_0x197063['query'][_0xf5f2('0x3d')](_0xf5f2('0x3e'))){_0x4af319[_0xf5f2('0x28')]=qs['limit'](_0x197063['query'][_0xf5f2('0x28')]);_0x4af319[_0xf5f2('0x26')]=qs[_0xf5f2('0x26')](_0x197063[_0xf5f2('0x36')][_0xf5f2('0x26')]);}return _0x2f11b0[_0xf5f2('0x12e')](_0x4af319);}})[_0xf5f2('0x16')](function(_0x4b7724){if(_0x4b7724){return _0x4b7724?{'count':_0x4dcc08,'rows':_0x4b7724}:null;}})['then'](respondWithResult(_0x1d0612,null))['catch'](handleError(_0x1d0612,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index f660032..e35ef6e 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 _0xa9b1=['exports','ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0xa9b1,0x133));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var ChatWebsite=require('../../mysqldb')['db'][_0x1a9b('0x0')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x1a9b('0x1')](0x0);var events={'afterCreate':_0x1a9b('0x2'),'afterUpdate':_0x1a9b('0x3'),'afterDestroy':_0x1a9b('0x4')};function emitEvent(_0x10c90c){return function(_0x52f55f,_0x57b453,_0x4914cd){ChatWebsiteEvents[_0x1a9b('0x5')](_0x10c90c+':'+_0x52f55f['id'],_0x52f55f);ChatWebsiteEvents[_0x1a9b('0x5')](_0x10c90c,_0x52f55f);_0x4914cd(null);};}for(var e in events){if(events[_0x1a9b('0x6')](e)){var event=events[e];ChatWebsite[_0x1a9b('0x7')](e,emitEvent(event));}}module[_0x1a9b('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x5ad3=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatWebsite','setMaxListeners'];(function(_0x4b82d8,_0x28260a){var _0x203e91=function(_0x427a6d){while(--_0x427a6d){_0x4b82d8['push'](_0x4b82d8['shift']());}};_0x203e91(++_0x28260a);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x30b145,_0x5b1406){_0x30b145=_0x30b145-0x0;var _0x5acce4=_0x5ad3[_0x30b145];return _0x5acce4;};'use strict';var EventEmitter=require(_0x35ad('0x0'));var ChatWebsite=require(_0x35ad('0x1'))['db'][_0x35ad('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x35ad('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x35ad('0x4'),'afterDestroy':_0x35ad('0x5')};function emitEvent(_0xc77352){return function(_0x69a0b3,_0x450f55,_0x1fed0d){ChatWebsiteEvents[_0x35ad('0x6')](_0xc77352+':'+_0x69a0b3['id'],_0x69a0b3);ChatWebsiteEvents[_0x35ad('0x6')](_0xc77352,_0x69a0b3);_0x1fed0d(null);};}for(var e in events){if(events[_0x35ad('0x7')](e)){var event=events[e];ChatWebsite[_0x35ad('0x8')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index df2e99e..09ab168 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 _0xb2d2=['request-promise','path','./chatWebsite.attributes','exports','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x152fe3,_0x12b0c8){var _0xc5bb39=function(_0x1fde42){while(--_0x1fde42){_0x152fe3['push'](_0x152fe3['shift']());}};_0xc5bb39(++_0x12b0c8);}(_0xb2d2,0x156));var _0x2b2d=function(_0x9b7e97,_0x33ecb8){_0x9b7e97=_0x9b7e97-0x0;var _0x2127ef=_0xb2d2[_0x9b7e97];return _0x2127ef;};'use strict';var _=require(_0x2b2d('0x0'));var util=require(_0x2b2d('0x1'));var logger=require(_0x2b2d('0x2'))(_0x2b2d('0x3'));var moment=require(_0x2b2d('0x4'));var BPromise=require(_0x2b2d('0x5'));var rp=require(_0x2b2d('0x6'));var fs=require('fs');var path=require(_0x2b2d('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2b2d('0x8'));module[_0x2b2d('0x9')]=function(_0x66fa5a,_0x3bb709){return _0x66fa5a['define'](_0x2b2d('0xa'),attributes,{'tableName':_0x2b2d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x364b=['util','../../config/logger','api','bluebird','request-promise','path','define','lodash'];(function(_0x182753,_0x34f324){var _0x14f610=function(_0x83e109){while(--_0x83e109){_0x182753['push'](_0x182753['shift']());}};_0x14f610(++_0x34f324);}(_0x364b,0x177));var _0xb364=function(_0x430c62,_0x129472){_0x430c62=_0x430c62-0x0;var _0x4ec150=_0x364b[_0x430c62];return _0x4ec150;};'use strict';var _=require(_0xb364('0x0'));var util=require(_0xb364('0x1'));var logger=require(_0xb364('0x2'))(_0xb364('0x3'));var moment=require('moment');var BPromise=require(_0xb364('0x4'));var rp=require(_0xb364('0x5'));var fs=require('fs');var path=require(_0xb364('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x31f68c,_0x506710){return _0x31f68c[_0xb364('0x7')]('ChatWebsite',attributes,{'tableName':'chat_websites','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 bd490b4..c9438c1 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 _0x79a3=['ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','localhost','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x47da69,_0x1be693){var _0x55ce6c=function(_0x2009fa){while(--_0x2009fa){_0x47da69['push'](_0x47da69['shift']());}};_0x55ce6c(++_0x1be693);}(_0x79a3,0x16e));var _0x379a=function(_0x43ff9f,_0x25f58f){_0x43ff9f=_0x43ff9f-0x0;var _0x5ebe13=_0x79a3[_0x43ff9f];return _0x5ebe13;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x379a('0x0'));var BPromise=require(_0x379a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x379a('0x2'));var db=require(_0x379a('0x3'))['db'];var utils=require(_0x379a('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x379a('0x5'));var jayson=require(_0x379a('0x6'));var client=jayson[_0x379a('0x7')][_0x379a('0x8')]({'port':0x232a});config['redis']=_[_0x379a('0x9')](config['redis'],{'host':_0x379a('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x379a('0xb'))[_0x379a('0xc')](socket);function respondWithRpcPromise(_0x56f247,_0x3dc5c0,_0xfaab3d){return new BPromise(function(_0x5ef612,_0x3f74f5){return client[_0x379a('0xd')](_0x56f247,_0xfaab3d)[_0x379a('0xe')](function(_0xecda0e){logger['info'](_0x379a('0xf'),_0x3dc5c0,_0x379a('0x10'));logger[_0x379a('0x11')](_0x379a('0x12'),_0x3dc5c0,_0x379a('0x10'),JSON[_0x379a('0x13')](_0xecda0e));if(_0xecda0e[_0x379a('0x14')]){if(_0xecda0e['error'][_0x379a('0x15')]===0x1f4){logger['error'](_0x379a('0xf'),_0x3dc5c0,_0xecda0e[_0x379a('0x14')][_0x379a('0x16')]);return _0x3f74f5(_0xecda0e[_0x379a('0x14')]['message']);}logger[_0x379a('0x14')](_0x379a('0xf'),_0x3dc5c0,_0xecda0e[_0x379a('0x14')][_0x379a('0x16')]);return _0x5ef612(_0xecda0e[_0x379a('0x14')][_0x379a('0x16')]);}else{logger['info'](_0x379a('0xf'),_0x3dc5c0,_0x379a('0x10'));_0x5ef612(_0xecda0e['result'][_0x379a('0x16')]);}})[_0x379a('0x17')](function(_0x36ade5){logger[_0x379a('0x14')](_0x379a('0xf'),_0x3dc5c0,_0x36ade5);_0x3f74f5(_0x36ade5);});});} \ No newline at end of file +var _0x4c17=['randomstring','../../mysqldb','../../config/utils','client','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x3c68f3,_0x9c4ca8){var _0x33f981=function(_0x598065){while(--_0x598065){_0x3c68f3['push'](_0x3c68f3['shift']());}};_0x33f981(++_0x9c4ca8);}(_0x4c17,0x1e0));var _0x74c1=function(_0x8fc888,_0x438200){_0x8fc888=_0x8fc888-0x0;var _0x34b3bf=_0x4c17[_0x8fc888];return _0x34b3bf;};'use strict';var _=require(_0x74c1('0x0'));var util=require(_0x74c1('0x1'));var moment=require(_0x74c1('0x2'));var BPromise=require('bluebird');var rs=require(_0x74c1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x74c1('0x4'))['db'];var utils=require(_0x74c1('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x74c1('0x6')]['http']({'port':0x232a});config['redis']=_[_0x74c1('0x7')](config[_0x74c1('0x8')],{'host':_0x74c1('0x9'),'port':0x18eb});var socket=require(_0x74c1('0xa'))(new Redis(config[_0x74c1('0x8')]));require(_0x74c1('0xb'))['register'](socket);function respondWithRpcPromise(_0xaed30e,_0x526ed6,_0x31b915){return new BPromise(function(_0x228a0a,_0x458c2f){return client[_0x74c1('0xc')](_0xaed30e,_0x31b915)[_0x74c1('0xd')](function(_0x198c91){logger[_0x74c1('0xe')](_0x74c1('0xf'),_0x526ed6,_0x74c1('0x10'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x526ed6,'request\x20sent',JSON[_0x74c1('0x11')](_0x198c91));if(_0x198c91[_0x74c1('0x12')]){if(_0x198c91[_0x74c1('0x12')][_0x74c1('0x13')]===0x1f4){logger[_0x74c1('0x12')](_0x74c1('0xf'),_0x526ed6,_0x198c91[_0x74c1('0x12')][_0x74c1('0x14')]);return _0x458c2f(_0x198c91['error'][_0x74c1('0x14')]);}logger['error'](_0x74c1('0xf'),_0x526ed6,_0x198c91['error'][_0x74c1('0x14')]);return _0x228a0a(_0x198c91[_0x74c1('0x12')][_0x74c1('0x14')]);}else{logger[_0x74c1('0xe')](_0x74c1('0xf'),_0x526ed6,_0x74c1('0x10'));_0x228a0a(_0x198c91[_0x74c1('0x15')][_0x74c1('0x14')]);}})[_0x74c1('0x16')](function(_0x277680){logger[_0x74c1('0x12')](_0x74c1('0xf'),_0x526ed6,_0x277680);_0x458c2f(_0x277680);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 63515fb..01a2896 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 _0x8b69=['save','emit','removeListener','register','length','./chatWebsite.events'];(function(_0x438e11,_0x53a0cf){var _0x3e7136=function(_0x5bc6b3){while(--_0x5bc6b3){_0x438e11['push'](_0x438e11['shift']());}};_0x3e7136(++_0x53a0cf);}(_0x8b69,0x89));var _0x98b6=function(_0xe5a7ae,_0x1ee36d){_0xe5a7ae=_0xe5a7ae-0x0;var _0x232b8a=_0x8b69[_0xe5a7ae];return _0x232b8a;};'use strict';var ChatWebsiteEvents=require(_0x98b6('0x0'));var events=[_0x98b6('0x1'),'remove','update'];function createListener(_0x1f2c68,_0x34f3d9){return function(_0x3adb83){_0x34f3d9[_0x98b6('0x2')](_0x1f2c68,_0x3adb83);};}function removeListener(_0x25258c,_0x266511){return function(){ChatWebsiteEvents[_0x98b6('0x3')](_0x25258c,_0x266511);};}exports[_0x98b6('0x4')]=function(_0x5b06a4){for(var _0x491e33=0x0,_0x6997ee=events[_0x98b6('0x5')];_0x491e33<_0x6997ee;_0x491e33++){var _0x18f597=events[_0x491e33];var _0x111d6e=createListener('chatWebsite:'+_0x18f597,_0x5b06a4);ChatWebsiteEvents['on'](_0x18f597,_0x111d6e);}}; \ No newline at end of file +var _0x6fb0=['emit','chatWebsite:','./chatWebsite.events'];(function(_0x5ebe34,_0x421337){var _0x36a3ee=function(_0x1d3306){while(--_0x1d3306){_0x5ebe34['push'](_0x5ebe34['shift']());}};_0x36a3ee(++_0x421337);}(_0x6fb0,0x1c1));var _0x06fb=function(_0x269419,_0x40747f){_0x269419=_0x269419-0x0;var _0x1667e4=_0x6fb0[_0x269419];return _0x1667e4;};'use strict';var ChatWebsiteEvents=require(_0x06fb('0x0'));var events=['save','remove','update'];function createListener(_0x1e2c0a,_0xfdcd62){return function(_0x597683){_0xfdcd62[_0x06fb('0x1')](_0x1e2c0a,_0x597683);};}function removeListener(_0x462ded,_0x10d612){return function(){ChatWebsiteEvents['removeListener'](_0x462ded,_0x10d612);};}exports['register']=function(_0x23f741){for(var _0x2bbaa6=0x0,_0x3f6b5a=events['length'];_0x2bbaa6<_0x3f6b5a;_0x2bbaa6++){var _0x492bad=events[_0x2bbaa6];var _0x288f85=createListener(_0x06fb('0x2')+_0x492bad,_0x23f741);ChatWebsiteEvents['on'](_0x492bad,_0x288f85);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 5c1f650..79b39d5 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 _0x6bc7=['addAgents','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','/:id/fields','getFields','getOfflineMessages','/:id/users','post','create','addDisposition','/:id/canned_answers','addAnswer','diskStorage','join','root','server/files/images/logos/','format','now','originalname','file','server/files/images/avatars/','%s-%s','single','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','offline','addInteraction'];(function(_0x422b1a,_0x3d28b4){var _0x286506=function(_0x19f350){while(--_0x19f350){_0x422b1a['push'](_0x422b1a['shift']());}};_0x286506(++_0x3d28b4);}(_0x6bc7,0x165));var _0x76bc=function(_0x23fbf0,_0x505f60){_0x23fbf0=_0x23fbf0-0x0;var _0x443648=_0x6bc7[_0x23fbf0];return _0x443648;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x76bc('0x0'));var timeout=require(_0x76bc('0x1'));var express=require('express');var router=express[_0x76bc('0x2')]();var fs_extra=require(_0x76bc('0x3'));var auth=require(_0x76bc('0x4'));var interaction=require(_0x76bc('0x5'));var config=require(_0x76bc('0x6'));var controller=require(_0x76bc('0x7'));router[_0x76bc('0x8')]('/',auth[_0x76bc('0x9')](),controller[_0x76bc('0xa')]);router['get']('/describe',auth[_0x76bc('0x9')](),controller[_0x76bc('0xb')]);router[_0x76bc('0x8')](_0x76bc('0xc'),auth[_0x76bc('0x9')](),controller[_0x76bc('0xd')]);router[_0x76bc('0x8')](_0x76bc('0xe'),auth[_0x76bc('0x9')](),controller[_0x76bc('0xf')]);router[_0x76bc('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x76bc('0x10')]);router[_0x76bc('0x8')]('/:id/logo',controller[_0x76bc('0x11')]);router[_0x76bc('0x8')](_0x76bc('0x12'),controller[_0x76bc('0x13')]);router[_0x76bc('0x8')](_0x76bc('0x14'),controller[_0x76bc('0x15')]);router[_0x76bc('0x8')](_0x76bc('0x16'),controller['getSystemAvatar']);router['get'](_0x76bc('0x17'),auth[_0x76bc('0x9')](),controller[_0x76bc('0x18')]);router[_0x76bc('0x8')](_0x76bc('0x19'),controller[_0x76bc('0x1a')]);router[_0x76bc('0x8')](_0x76bc('0x1b'),auth[_0x76bc('0x9')](),controller[_0x76bc('0x1c')]);router[_0x76bc('0x8')]('/:id/proactive_actions',auth[_0x76bc('0x9')](),controller[_0x76bc('0x1d')]);router[_0x76bc('0x8')](_0x76bc('0x1e'),controller[_0x76bc('0x1f')]);router[_0x76bc('0x8')]('/:id/offline_messages',auth['isAuthenticated'](),controller[_0x76bc('0x20')]);router[_0x76bc('0x8')](_0x76bc('0x21'),auth['isAuthenticated'](),controller['getAgents']);router[_0x76bc('0x22')]('/',auth[_0x76bc('0x9')](),controller[_0x76bc('0x23')]);router[_0x76bc('0x22')](_0x76bc('0xe'),auth[_0x76bc('0x9')](),controller[_0x76bc('0x24')]);router[_0x76bc('0x22')](_0x76bc('0x25'),auth[_0x76bc('0x9')](),controller[_0x76bc('0x26')]);var upload=multer({'storage':multer[_0x76bc('0x27')]({'destination':function(_0x487212,_0x3d6156,_0x4e7e20){_0x4e7e20(null,path[_0x76bc('0x28')](config[_0x76bc('0x29')],_0x76bc('0x2a')));},'filename':function(_0x55a424,_0x26d776,_0x52a205){_0x52a205(null,util[_0x76bc('0x2b')]('%s-%s',Date[_0x76bc('0x2c')](),_0x26d776[_0x76bc('0x2d')]));}})});router[_0x76bc('0x22')]('/:id/logo',upload['single'](_0x76bc('0x2e')),controller['addLogo']);var upload=multer({'storage':multer[_0x76bc('0x27')]({'destination':function(_0x1b8c38,_0x2ef300,_0x559a35){_0x559a35(null,path[_0x76bc('0x28')](config[_0x76bc('0x29')],_0x76bc('0x2f')));},'filename':function(_0x20e5fe,_0x4b9ffa,_0x479ca1){_0x479ca1(null,util[_0x76bc('0x2b')](_0x76bc('0x30'),Date[_0x76bc('0x2c')](),_0x4b9ffa[_0x76bc('0x2d')]));}})});router['post'](_0x76bc('0x12'),upload[_0x76bc('0x31')](_0x76bc('0x2e')),controller[_0x76bc('0x32')]);var upload=multer({'storage':multer[_0x76bc('0x27')]({'destination':function(_0x27b289,_0x18fef0,_0xefa7af){_0xefa7af(null,path[_0x76bc('0x28')](config['root'],_0x76bc('0x2f')));},'filename':function(_0x5d162f,_0x2668b9,_0x6b75ea){_0x6b75ea(null,util[_0x76bc('0x2b')](_0x76bc('0x30'),Date['now'](),_0x2668b9['originalname']));}})});router[_0x76bc('0x22')](_0x76bc('0x14'),upload[_0x76bc('0x31')](_0x76bc('0x2e')),controller[_0x76bc('0x33')]);var upload=multer({'storage':multer[_0x76bc('0x27')]({'destination':function(_0x2a32f0,_0x43e52d,_0x168283){_0x168283(null,path['join'](config['root'],'server/files/images/avatars/'));},'filename':function(_0x14e0c6,_0x32e466,_0x25825c){_0x25825c(null,util[_0x76bc('0x2b')](_0x76bc('0x30'),Date[_0x76bc('0x2c')](),_0x32e466[_0x76bc('0x2d')]));}})});router[_0x76bc('0x22')](_0x76bc('0x16'),upload[_0x76bc('0x31')](_0x76bc('0x2e')),controller[_0x76bc('0x34')]);router[_0x76bc('0x22')](_0x76bc('0x35'),controller[_0x76bc('0x36')]);const offlineUploadMulter=multer({'storage':multer[_0x76bc('0x27')]({'destination':function(_0x4e6f1b,_0x3d22da,_0x47465f){const _0x3753b6=path[_0x76bc('0x28')](config['root'],'server/files',_0x76bc('0x37'),_0x76bc('0x38'));fs_extra[_0x76bc('0x39')](_0x3753b6,function(){_0x47465f(null,_0x3753b6);});},'filename':function(_0x37b53f,_0x296281,_0x526709){const _0x5383e1=_0x296281['originalname'][_0x76bc('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x171020=path[_0x76bc('0x3b')](_0x5383e1);const _0x1fa879=Date[_0x76bc('0x2c')]()+'-'+_0x5383e1[_0x76bc('0x3a')](_0x171020,'')+_0x171020;_0x526709(null,_0x1fa879);}})});router[_0x76bc('0x22')](_0x76bc('0x3c'),offlineUploadMulter['any'](),controller[_0x76bc('0x3d')]);router[_0x76bc('0x22')]('/:id/interactions',auth[_0x76bc('0x9')](),controller[_0x76bc('0x3e')]);router[_0x76bc('0x22')](_0x76bc('0x1b'),auth[_0x76bc('0x9')](),controller['addApplications']);router[_0x76bc('0x22')]('/:id/proactive_actions',auth[_0x76bc('0x9')](),controller['addProactiveActions']);router[_0x76bc('0x22')](_0x76bc('0x21'),auth[_0x76bc('0x9')](),controller[_0x76bc('0x3f')]);router[_0x76bc('0x40')](_0x76bc('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x76bc('0x41')](_0x76bc('0xc'),auth[_0x76bc('0x9')](),controller[_0x76bc('0x42')]);router['delete'](_0x76bc('0xe'),auth['isAuthenticated'](),controller[_0x76bc('0x43')]);router['delete']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x76bc('0x44')]);router['delete']('/:id/users',auth[_0x76bc('0x9')](),controller[_0x76bc('0x45')]);module['exports']=router; \ No newline at end of file +var _0x4111=['/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','/:id/customer_avatar','server/files/images/avatars/','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','extname','/:id/offline','any','addProactiveActions','addAgents','put','update','destroy','delete','removeDispositions','removeAgents','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions'];(function(_0x2146dc,_0x5736a0){var _0x958647=function(_0xca09d){while(--_0xca09d){_0x2146dc['push'](_0x2146dc['shift']());}};_0x958647(++_0x5736a0);}(_0x4111,0x7b));var _0x1411=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4111[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1411('0x0'));var util=require(_0x1411('0x1'));var path=require('path');var timeout=require(_0x1411('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1411('0x3'));var auth=require(_0x1411('0x4'));var interaction=require(_0x1411('0x5'));var config=require('../../config/environment');var controller=require(_0x1411('0x6'));router[_0x1411('0x7')]('/',auth[_0x1411('0x8')](),controller[_0x1411('0x9')]);router['get'](_0x1411('0xa'),auth[_0x1411('0x8')](),controller[_0x1411('0xb')]);router['get'](_0x1411('0xc'),auth[_0x1411('0x8')](),controller[_0x1411('0xd')]);router['get']('/:id/dispositions',auth[_0x1411('0x8')](),controller[_0x1411('0xe')]);router[_0x1411('0x7')](_0x1411('0xf'),auth[_0x1411('0x8')](),controller['getAnswers']);router[_0x1411('0x7')](_0x1411('0x10'),controller[_0x1411('0x11')]);router[_0x1411('0x7')](_0x1411('0x12'),controller['getAvatar']);router[_0x1411('0x7')]('/:id/customer_avatar',controller[_0x1411('0x13')]);router[_0x1411('0x7')](_0x1411('0x14'),controller[_0x1411('0x15')]);router[_0x1411('0x7')](_0x1411('0x16'),auth[_0x1411('0x8')](),controller['getInteractions']);router[_0x1411('0x7')]('/:id/snippet',controller[_0x1411('0x17')]);router[_0x1411('0x7')](_0x1411('0x18'),auth[_0x1411('0x8')](),controller[_0x1411('0x19')]);router['get'](_0x1411('0x1a'),auth[_0x1411('0x8')](),controller[_0x1411('0x1b')]);router[_0x1411('0x7')](_0x1411('0x1c'),controller[_0x1411('0x1d')]);router[_0x1411('0x7')](_0x1411('0x1e'),auth[_0x1411('0x8')](),controller['getOfflineMessages']);router[_0x1411('0x7')](_0x1411('0x1f'),auth[_0x1411('0x8')](),controller[_0x1411('0x20')]);router[_0x1411('0x21')]('/',auth['isAuthenticated'](),controller[_0x1411('0x22')]);router[_0x1411('0x21')](_0x1411('0x23'),auth[_0x1411('0x8')](),controller[_0x1411('0x24')]);router[_0x1411('0x21')]('/:id/canned_answers',auth[_0x1411('0x8')](),controller[_0x1411('0x25')]);var upload=multer({'storage':multer[_0x1411('0x26')]({'destination':function(_0x5b6950,_0x3c3769,_0x4249a5){_0x4249a5(null,path[_0x1411('0x27')](config[_0x1411('0x28')],_0x1411('0x29')));},'filename':function(_0x4b0066,_0x10ce00,_0x4d836d){_0x4d836d(null,util[_0x1411('0x2a')](_0x1411('0x2b'),Date[_0x1411('0x2c')](),_0x10ce00[_0x1411('0x2d')]));}})});router['post'](_0x1411('0x10'),upload[_0x1411('0x2e')](_0x1411('0x2f')),controller[_0x1411('0x30')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2e6a29,_0x371811,_0x52ffa1){_0x52ffa1(null,path['join'](config['root'],'server/files/images/avatars/'));},'filename':function(_0x4bd816,_0x3b09fe,_0x6e3b56){_0x6e3b56(null,util['format'](_0x1411('0x2b'),Date['now'](),_0x3b09fe['originalname']));}})});router[_0x1411('0x21')]('/:id/avatar',upload['single'](_0x1411('0x2f')),controller['addAvatar']);var upload=multer({'storage':multer[_0x1411('0x26')]({'destination':function(_0x559f53,_0x15a432,_0x4efd87){_0x4efd87(null,path[_0x1411('0x27')](config[_0x1411('0x28')],'server/files/images/avatars/'));},'filename':function(_0xb8f882,_0x5943af,_0x1798d7){_0x1798d7(null,util[_0x1411('0x2a')](_0x1411('0x2b'),Date[_0x1411('0x2c')](),_0x5943af[_0x1411('0x2d')]));}})});router['post'](_0x1411('0x31'),upload[_0x1411('0x2e')](_0x1411('0x2f')),controller['addCustomerAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x20d32b,_0x23d638,_0x27b4ce){_0x27b4ce(null,path[_0x1411('0x27')](config[_0x1411('0x28')],_0x1411('0x32')));},'filename':function(_0x4299fd,_0x2c0813,_0xb8b37d){_0xb8b37d(null,util['format'](_0x1411('0x2b'),Date[_0x1411('0x2c')](),_0x2c0813[_0x1411('0x2d')]));}})});router[_0x1411('0x21')](_0x1411('0x14'),upload[_0x1411('0x2e')](_0x1411('0x2f')),controller[_0x1411('0x33')]);router[_0x1411('0x21')](_0x1411('0x34'),controller[_0x1411('0x35')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x45075f,_0x26782f,_0xa6f097){const _0x13c8b9=path['join'](config['root'],_0x1411('0x36'),_0x1411('0x37'),_0x1411('0x38'));fs_extra['ensureDir'](_0x13c8b9,function(){_0xa6f097(null,_0x13c8b9);});},'filename':function(_0x486882,_0x52dfb7,_0x1e5644){const _0x14b2ce=_0x52dfb7[_0x1411('0x2d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x40cda6=path[_0x1411('0x39')](_0x14b2ce);const _0x448403=Date['now']()+'-'+_0x14b2ce['replace'](_0x40cda6,'')+_0x40cda6;_0x1e5644(null,_0x448403);}})});router[_0x1411('0x21')](_0x1411('0x3a'),offlineUploadMulter[_0x1411('0x3b')](),controller['offline']);router[_0x1411('0x21')](_0x1411('0x16'),auth[_0x1411('0x8')](),controller['addInteraction']);router[_0x1411('0x21')](_0x1411('0x18'),auth[_0x1411('0x8')](),controller['addApplications']);router['post'](_0x1411('0x1a'),auth[_0x1411('0x8')](),controller[_0x1411('0x3c')]);router[_0x1411('0x21')]('/:id/users',auth[_0x1411('0x8')](),controller[_0x1411('0x3d')]);router[_0x1411('0x3e')](_0x1411('0xc'),auth['isAuthenticated'](),controller[_0x1411('0x3f')]);router['delete']('/:id',auth[_0x1411('0x8')](),controller[_0x1411('0x40')]);router[_0x1411('0x41')](_0x1411('0x23'),auth[_0x1411('0x8')](),controller[_0x1411('0x42')]);router[_0x1411('0x41')](_0x1411('0xf'),auth[_0x1411('0x8')](),controller['removeAnswers']);router['delete'](_0x1411('0x1f'),auth[_0x1411('0x8')](),controller[_0x1411('0x43')]);module[_0x1411('0x44')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index fe9aa09..ad96088 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 _0x8232=['Router','env','production','app','get','client-side-logger','expressEndpoint','/client-logs','use','exports','beaver-logger/server','express','../components/auth/service'];(function(_0x266e57,_0x41125b){var _0x4cdc1d=function(_0x3d3734){while(--_0x3d3734){_0x266e57['push'](_0x266e57['shift']());}};_0x4cdc1d(++_0x41125b);}(_0x8232,0x1eb));var _0x2823=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x8232[_0x2bf141];return _0x48277b;};var beaverLogger=require(_0x2823('0x0'));var express=require(_0x2823('0x1'));var auth=require(_0x2823('0x2'));var config=require('../config/environment');var router=express[_0x2823('0x3')]();var isProduction=config[_0x2823('0x4')]===_0x2823('0x5')||![];function clientSideLogs(_0x1c7109,_0x217648,_0x52e27d){var _0x355959=_0x1c7109[_0x2823('0x6')][_0x2823('0x7')](_0x2823('0x8'));if(!_0x355959){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0x2823('0x9')]({'uri':_0x2823('0xa'),'logger':_0x355959,'enableCors':!isProduction})(_0x1c7109,_0x217648,_0x52e27d);}router[_0x2823('0xb')](auth['isAuthenticated'](),clientSideLogs);module[_0x2823('0xc')]=router; \ No newline at end of file +var _0xe3b7=['Client-Side\x20logger\x20not\x20found!','expressEndpoint','exports','beaver-logger/server','../components/auth/service','../config/environment','production','app','get','client-side-logger'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xe3b7,0x193));var _0x7e3b=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xe3b7[_0x55e08b];return _0xd1a7ff;};var beaverLogger=require(_0x7e3b('0x0'));var express=require('express');var auth=require(_0x7e3b('0x1'));var config=require(_0x7e3b('0x2'));var router=express['Router']();var isProduction=config['env']===_0x7e3b('0x3')||![];function clientSideLogs(_0x2214fe,_0x265656,_0x10cc6c){var _0x44df04=_0x2214fe[_0x7e3b('0x4')][_0x7e3b('0x5')](_0x7e3b('0x6'));if(!_0x44df04){throw new Error(_0x7e3b('0x7'));}return beaverLogger[_0x7e3b('0x8')]({'uri':'/client-logs','logger':_0x44df04,'enableCors':!isProduction})(_0x2214fe,_0x265656,_0x10cc6c);}router['use'](auth['isAuthenticated'](),clientSideLogs);module[_0x7e3b('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 16af980..37d1018 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 _0x5cad=['Outlook365','STRING','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20refresh_token','sequelize','exports','ENUM','Google','MicrosoftAzure'];(function(_0x5d0594,_0x3d8ede){var _0x179e9a=function(_0x149b4e){while(--_0x149b4e){_0x5d0594['push'](_0x5d0594['shift']());}};_0x179e9a(++_0x3d8ede);}(_0x5cad,0x157));var _0xd5ca=function(_0x404d52,_0x68f0ae){_0x404d52=_0x404d52-0x0;var _0x433640=_0x5cad[_0x404d52];return _0x433640;};'use strict';var Sequelize=require(_0xd5ca('0x0'));module[_0xd5ca('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xd5ca('0x2')]('AmazonAWS',_0xd5ca('0x3'),_0xd5ca('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xd5ca('0x2')](_0xd5ca('0x5'),'Dynamics365')},'data1':{'type':Sequelize[_0xd5ca('0x6')],'comment':_0xd5ca('0x7')},'data2':{'type':Sequelize[_0xd5ca('0x6')],'comment':_0xd5ca('0x8')},'data3':{'type':Sequelize[_0xd5ca('0x6')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0xd5ca('0x6')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize['TEXT'],'comment':_0xd5ca('0x9')},'data6':{'type':Sequelize[_0xd5ca('0xa')],'comment':_0xd5ca('0xb')},'data7':{'type':Sequelize[_0xd5ca('0xa')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file +var _0x6e59=['MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','TEXT'];(function(_0x486e40,_0x1e58a0){var _0x48f516=function(_0x374993){while(--_0x374993){_0x486e40['push'](_0x486e40['shift']());}};_0x48f516(++_0x1e58a0);}(_0x6e59,0x1d1));var _0x96e5=function(_0x33db2b,_0x339202){_0x33db2b=_0x33db2b-0x0;var _0x3a998f=_0x6e59[_0x33db2b];return _0x3a998f;};'use strict';var Sequelize=require('sequelize');module[_0x96e5('0x0')]={'name':{'type':Sequelize[_0x96e5('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x96e5('0x2')](_0x96e5('0x3'),_0x96e5('0x4'),_0x96e5('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x96e5('0x2')](_0x96e5('0x6'),_0x96e5('0x7'))},'data1':{'type':Sequelize[_0x96e5('0x1')],'comment':_0x96e5('0x8')},'data2':{'type':Sequelize[_0x96e5('0x1')],'comment':_0x96e5('0x9')},'data3':{'type':Sequelize[_0x96e5('0x1')],'comment':_0x96e5('0xa')},'data4':{'type':Sequelize[_0x96e5('0x1')],'comment':_0x96e5('0xb')},'data5':{'type':Sequelize['TEXT'],'comment':_0x96e5('0xc')},'data6':{'type':Sequelize['TEXT'],'comment':_0x96e5('0xd')},'data7':{'type':Sequelize[_0x96e5('0xe')],'comment':_0x96e5('0xf')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 5266111..bd8b8bc 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 _0xb7b9=['isValidIdToken','id_token','oauth2Claims','del','getOauth2MicrosoftAccessToken','data5','access_token','data6','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','undefined','count','offset','set','Content-Range','update','then','destroy','name','send','padEnd','slice','map','CloudProvider','rawAttributes','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','find','Name\x20parameter\x20not\x20specified','body','Service\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','create','params','oauth2MicrosoftAuthorize','findOne','user','oauth2MicrosoftCallback','error','Invalid\x20state\x20parameter','parse','from','state','base64','toString','ascii'];(function(_0x20210e,_0x1603f6){var _0x439c00=function(_0x5b4cc2){while(--_0x5b4cc2){_0x20210e['push'](_0x20210e['shift']());}};_0x439c00(++_0x1603f6);}(_0xb7b9,0x1f4));var _0x9b7b=function(_0x33fa60,_0x2b78db){_0x33fa60=_0x33fa60-0x0;var _0x4220f=_0xb7b9[_0x33fa60];return _0x4220f;};'use strict';var _=require(_0x9b7b('0x0'));var Redis=require(_0x9b7b('0x1'));var qs=require(_0x9b7b('0x2'));var encryptor=require(_0x9b7b('0x3'));var config=require(_0x9b7b('0x4'));var logger=require(_0x9b7b('0x5'))(_0x9b7b('0x6'));var db=require(_0x9b7b('0x7'))['db'];var oauth=require(_0x9b7b('0x8'));config[_0x9b7b('0x9')]=_[_0x9b7b('0xa')](config['redis'],{'host':_0x9b7b('0xb'),'port':0x18eb});var socket=require(_0x9b7b('0xc'))(new Redis(config[_0x9b7b('0x9')]));var redis=new Redis(config[_0x9b7b('0x9')]);function respondWithStatusCode(_0x478d64,_0x224aec){_0x224aec=_0x224aec||0xcc;return function(_0x559d63){if(_0x559d63){return _0x478d64[_0x9b7b('0xd')](_0x224aec);}return _0x478d64[_0x9b7b('0xe')](_0x224aec)[_0x9b7b('0xf')]();};}function respondWithResult(_0x58c9dd,_0x27835d){_0x27835d=_0x27835d||0xc8;return function(_0x2e749e){if(_0x2e749e){return _0x58c9dd[_0x9b7b('0xe')](_0x27835d)['json'](_0x2e749e);}};}function respondWithFilteredResult(_0x2ecb18,_0x2c3a70){return function(_0x4d07e4){if(_0x4d07e4){var _0x615efb=typeof _0x2c3a70['offset']==='undefined'&&typeof _0x2c3a70['limit']===_0x9b7b('0x10');var _0x32361e=_0x4d07e4[_0x9b7b('0x11')];var _0x181bb1=_0x615efb?0x0:_0x2c3a70[_0x9b7b('0x12')];var _0x46ba06=_0x615efb?_0x4d07e4[_0x9b7b('0x11')]:_0x2c3a70[_0x9b7b('0x12')]+_0x2c3a70['limit'];var _0x292666;if(_0x46ba06>=_0x32361e){_0x46ba06=_0x32361e;_0x292666=0xc8;}else{_0x292666=0xce;}_0x2ecb18[_0x9b7b('0xe')](_0x292666);return _0x2ecb18[_0x9b7b('0x13')](_0x9b7b('0x14'),_0x181bb1+'-'+_0x46ba06+'/'+_0x32361e)['json'](_0x4d07e4);}return null;};}function saveUpdates(_0x3ef67a){return function(_0x5cab3b){if(_0x5cab3b){return _0x5cab3b[_0x9b7b('0x15')](_0x3ef67a)[_0x9b7b('0x16')](function(_0x44fe8b){return _0x44fe8b;});}return null;};}function removeEntity(_0x1b8a32){return function(_0x1626e1){if(_0x1626e1){return _0x1626e1[_0x9b7b('0x17')]()[_0x9b7b('0x16')](function(){_0x1b8a32[_0x9b7b('0xe')](0xcc)[_0x9b7b('0xf')]();});}};}function handleEntityNotFound(_0x15ff73){return function(_0x416894){if(!_0x416894){_0x15ff73['sendStatus'](0x194);}return _0x416894;};}function handleError(_0x531bd2,_0x277201){_0x277201=_0x277201||0x1f4;return function(_0x41d105){logger['error'](_0x41d105['stack']);if(_0x41d105['name']){delete _0x41d105[_0x9b7b('0x18')];}_0x531bd2[_0x9b7b('0xe')](_0x277201)[_0x9b7b('0x19')](_0x41d105);};}function maskClientSecret(_0x380249){return _[_0x9b7b('0x1a')](_0x380249[_0x9b7b('0x1b')](0x0,0x3),0x14,'*');}exports['index']=function(_0x3364ea,_0x579303){var _0xec87bb={},_0x14c401={},_0x3ecaf9={'count':0x0,'rows':[]};var _0x29f065=_[_0x9b7b('0x1c')](db[_0x9b7b('0x1d')][_0x9b7b('0x1e')],function(_0x1d82f5){return{'name':_0x1d82f5['fieldName'],'type':_0x1d82f5[_0x9b7b('0x1f')][_0x9b7b('0x20')]};});_0x14c401['model']=_['map'](_0x29f065,'name');_0x14c401['query']=_[_0x9b7b('0x21')](_0x3364ea[_0x9b7b('0x22')]);_0x14c401['filters']=_[_0x9b7b('0x23')](_0x14c401[_0x9b7b('0x24')],_0x14c401[_0x9b7b('0x22')]);_0xec87bb['attributes']=_[_0x9b7b('0x23')](_0x14c401[_0x9b7b('0x24')],qs[_0x9b7b('0x25')](_0x3364ea[_0x9b7b('0x22')][_0x9b7b('0x25')]));_0xec87bb['attributes']=_0xec87bb[_0x9b7b('0x26')][_0x9b7b('0x27')]?_0xec87bb[_0x9b7b('0x26')]:_0x14c401[_0x9b7b('0x24')];if(!_0x3364ea[_0x9b7b('0x22')][_0x9b7b('0x28')]('nolimit')){_0xec87bb[_0x9b7b('0x29')]=qs[_0x9b7b('0x29')](_0x3364ea[_0x9b7b('0x22')][_0x9b7b('0x29')]);_0xec87bb['offset']=qs[_0x9b7b('0x12')](_0x3364ea[_0x9b7b('0x22')][_0x9b7b('0x12')]);}_0xec87bb[_0x9b7b('0x2a')]=qs[_0x9b7b('0x2b')](_0x3364ea[_0x9b7b('0x22')][_0x9b7b('0x2b')]);_0xec87bb[_0x9b7b('0x2c')]=qs[_0x9b7b('0x2d')](_['pick'](_0x3364ea[_0x9b7b('0x22')],_0x14c401[_0x9b7b('0x2d')]),_0x29f065);if(_0x3364ea[_0x9b7b('0x22')][_0x9b7b('0x2e')]){_0xec87bb[_0x9b7b('0x2c')]=_[_0x9b7b('0x2f')](_0xec87bb['where'],{'$or':_['map'](_0x29f065,function(_0x39bbfc){if(_0x39bbfc[_0x9b7b('0x1f')]!==_0x9b7b('0x30')){var _0x2a90fd={};_0x2a90fd[_0x39bbfc[_0x9b7b('0x18')]]={'$like':'%'+_0x3364ea['query'][_0x9b7b('0x2e')]+'%'};return _0x2a90fd;}})});}_0xec87bb=_[_0x9b7b('0x2f')]({},_0xec87bb,_0x3364ea[_0x9b7b('0x31')]);var _0x5b6ec5={'where':_0xec87bb[_0x9b7b('0x2c')]};return db['CloudProvider'][_0x9b7b('0x11')](_0x5b6ec5)[_0x9b7b('0x16')](function(_0x5cb3e7){_0x3ecaf9[_0x9b7b('0x11')]=_0x5cb3e7;if(_0x3364ea[_0x9b7b('0x22')][_0x9b7b('0x32')]){_0xec87bb[_0x9b7b('0x33')]=[{'all':!![]}];}return db[_0x9b7b('0x1d')][_0x9b7b('0x34')](_0xec87bb);})[_0x9b7b('0x16')](function(_0x113d80){_0x3ecaf9[_0x9b7b('0x35')]=_[_0x9b7b('0x1c')](_0x113d80,function(_0x544a8a){if(_0x544a8a[_0x9b7b('0x36')]===_0x9b7b('0x37')){var _0x1cfcd5=encryptor[_0x9b7b('0x38')](_0x544a8a[_0x9b7b('0x39')]);_0x544a8a[_0x9b7b('0x39')]=maskClientSecret(_0x1cfcd5);}return _0x544a8a;});return _0x3ecaf9;})[_0x9b7b('0x16')](respondWithFilteredResult(_0x579303,_0xec87bb))[_0x9b7b('0x3a')](handleError(_0x579303,null));};exports[_0x9b7b('0x3b')]=function(_0x321a6a,_0x39047f){var _0x34e3a4={'raw':!![],'where':{'id':_0x321a6a['params']['id']}},_0x583945={};_0x583945[_0x9b7b('0x24')]=_[_0x9b7b('0x21')](db[_0x9b7b('0x1d')][_0x9b7b('0x1e')]);_0x583945[_0x9b7b('0x22')]=_['keys'](_0x321a6a[_0x9b7b('0x22')]);_0x583945['filters']=_[_0x9b7b('0x23')](_0x583945[_0x9b7b('0x24')],_0x583945[_0x9b7b('0x22')]);_0x34e3a4[_0x9b7b('0x26')]=_[_0x9b7b('0x23')](_0x583945[_0x9b7b('0x24')],qs[_0x9b7b('0x25')](_0x321a6a[_0x9b7b('0x22')][_0x9b7b('0x25')]));_0x34e3a4[_0x9b7b('0x26')]=_0x34e3a4[_0x9b7b('0x26')][_0x9b7b('0x27')]?_0x34e3a4[_0x9b7b('0x26')]:_0x583945[_0x9b7b('0x24')];if(_0x321a6a[_0x9b7b('0x22')][_0x9b7b('0x32')]){_0x34e3a4['include']=[{'all':!![]}];}_0x34e3a4=_[_0x9b7b('0x2f')]({},_0x34e3a4,_0x321a6a[_0x9b7b('0x31')]);return db[_0x9b7b('0x1d')][_0x9b7b('0x3c')](_0x34e3a4)['then'](handleEntityNotFound(_0x39047f,null))[_0x9b7b('0x16')](function(_0x54dba5){if(_0x54dba5[_0x9b7b('0x36')]==='MicrosoftAzure'){var _0x25cf4e=encryptor[_0x9b7b('0x38')](_0x54dba5[_0x9b7b('0x39')]);_0x54dba5[_0x9b7b('0x39')]=maskClientSecret(_0x25cf4e);}return _0x54dba5;})[_0x9b7b('0x16')](respondWithResult(_0x39047f,null))['catch'](handleError(_0x39047f,null));};exports['create']=function(_0x29ce70,_0x503b39){if(!_0x29ce70['body'][_0x9b7b('0x18')])throw new Error(_0x9b7b('0x3d'));if(!_0x29ce70[_0x9b7b('0x3e')][_0x9b7b('0x36')])throw new Error(_0x9b7b('0x3f'));var _0x3f7b56=db[_0x9b7b('0x1d')][_0x9b7b('0x1e')][_0x9b7b('0x36')]['values'];if(!_0x3f7b56[_0x9b7b('0x40')](_0x29ce70['body'][_0x9b7b('0x36')]))throw new Error(_0x9b7b('0x41')+_0x3f7b56[_0x9b7b('0x42')](',\x20'));if(_0x29ce70[_0x9b7b('0x3e')]['service']===_0x9b7b('0x37')&&_0x29ce70[_0x9b7b('0x3e')][_0x9b7b('0x39')]){_0x29ce70[_0x9b7b('0x3e')][_0x9b7b('0x39')]=encryptor[_0x9b7b('0x43')](_0x29ce70[_0x9b7b('0x3e')]['data3']);}return db[_0x9b7b('0x1d')][_0x9b7b('0x44')](_0x29ce70['body'],{})['then'](respondWithResult(_0x503b39,0xc9))[_0x9b7b('0x3a')](handleError(_0x503b39,null));};exports[_0x9b7b('0x15')]=function(_0x4e0acc,_0x57fcdb){if(_0x4e0acc[_0x9b7b('0x3e')]['id']){delete _0x4e0acc['body']['id'];}return db[_0x9b7b('0x1d')]['find']({'where':{'id':_0x4e0acc[_0x9b7b('0x45')]['id']}})[_0x9b7b('0x16')](handleEntityNotFound(_0x57fcdb,null))[_0x9b7b('0x16')](function(_0x1346fe){if(_0x1346fe[_0x9b7b('0x36')]===_0x9b7b('0x37')&&_0x4e0acc[_0x9b7b('0x3e')][_0x9b7b('0x39')]){_0x4e0acc[_0x9b7b('0x3e')][_0x9b7b('0x39')]=encryptor[_0x9b7b('0x43')](_0x4e0acc[_0x9b7b('0x3e')]['data3']);}return _0x1346fe;})[_0x9b7b('0x16')](saveUpdates(_0x4e0acc[_0x9b7b('0x3e')],null))[_0x9b7b('0x16')](respondWithResult(_0x57fcdb,null))['catch'](handleError(_0x57fcdb,null));};exports['destroy']=function(_0x356d3a,_0x56f8b6){return db[_0x9b7b('0x1d')]['find']({'where':{'id':_0x356d3a[_0x9b7b('0x45')]['id']}})['then'](handleEntityNotFound(_0x56f8b6,null))[_0x9b7b('0x16')](removeEntity(_0x56f8b6,null))[_0x9b7b('0x3a')](handleError(_0x56f8b6,null));};exports[_0x9b7b('0x46')]=function(_0x20a323,_0x4373fc){return db[_0x9b7b('0x1d')][_0x9b7b('0x47')]({'where':{'id':_0x20a323[_0x9b7b('0x45')]['id']},'raw':!![]})[_0x9b7b('0x16')](function(_0x16d7ab){if(!_0x16d7ab)return _0x4373fc['sendStatus'](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x16d7ab,_0x20a323[_0x9b7b('0x48')]['id'])};})[_0x9b7b('0x16')](respondWithResult(_0x4373fc,null))[_0x9b7b('0x3a')](handleError(_0x4373fc,null));};exports[_0x9b7b('0x49')]=function(_0x21ee81,_0x31f335){var _0x47ddb8=_0x21ee81[_0x9b7b('0x3e')];var _0x27e6ad;var _0x36a4e5;if(_0x47ddb8[_0x9b7b('0x4a')])throw _0x47ddb8;redis['get'](_0x47ddb8['state'])[_0x9b7b('0x16')](function(_0x3d1e42){if(!_0x3d1e42)throw new Error(_0x9b7b('0x4b'));_0x27e6ad=JSON[_0x9b7b('0x4c')](_0x3d1e42);var _0x29e114=Buffer[_0x9b7b('0x4d')](_0x47ddb8[_0x9b7b('0x4e')],_0x9b7b('0x4f'))[_0x9b7b('0x50')](_0x9b7b('0x51'));_0x36a4e5=JSON['parse'](_0x29e114);if(!oauth[_0x9b7b('0x52')](_0x47ddb8[_0x9b7b('0x53')],_0x27e6ad[_0x9b7b('0x54')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0x9b7b('0x55')](_0x47ddb8[_0x9b7b('0x4e')]);return oauth[_0x9b7b('0x56')](_0x47ddb8['code'],_0x27e6ad);})['then'](function(_0x1a1f4d){_0x27e6ad[_0x9b7b('0x57')]=_0x1a1f4d[_0x9b7b('0x58')];_0x27e6ad[_0x9b7b('0x59')]=_0x1a1f4d['refresh_token'];return db['CloudProvider']['update']({'data5':_0x27e6ad[_0x9b7b('0x57')],'data6':_0x27e6ad['data6']},{'where':{'id':_0x27e6ad['id']}});})[_0x9b7b('0x16')](function(){oauth['startRefreshInterval'](_0x27e6ad);socket[_0x9b7b('0x5a')](_0x9b7b('0x5b'),{'id':_0x36a4e5['id']});return;})[_0x9b7b('0x16')](respondWithStatusCode(_0x31f335,null))[_0x9b7b('0x3a')](function(_0x2d33a8){if(_0x36a4e5){socket[_0x9b7b('0x5a')](_0x9b7b('0x5c'),{'id':_0x36a4e5['id']});}if(!_0x27e6ad){logger[_0x9b7b('0x4a')](_0x9b7b('0x5d'),_0x2d33a8);return _0x31f335[_0x9b7b('0xe')](0x1f4)[_0x9b7b('0x19')](_0x2d33a8[_0x9b7b('0x5e')]);}logger[_0x9b7b('0x4a')](_0x9b7b('0x5f'),_0x27e6ad['id'],JSON[_0x9b7b('0x60')](_0x2d33a8));});}; \ No newline at end of file +var _0x2d93=['Invalid\x20state\x20parameter','parse','state','base64','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','access_token','data6','refresh_token','data5','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','socket.io-emitter','status','json','limit','undefined','count','offset','Content-Range','update','then','end','error','stack','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','filter','options','includeAll','findAll','MicrosoftAzure','data3','catch','show','params','find','service','decryptString','create','body','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','destroy','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','get'];(function(_0x1792cf,_0x3a45d9){var _0x74ebd6=function(_0x1bccc0){while(--_0x1bccc0){_0x1792cf['push'](_0x1792cf['shift']());}};_0x74ebd6(++_0x3a45d9);}(_0x2d93,0xd5));var _0x32d9=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x2d93[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x32d9('0x0'));var Redis=require(_0x32d9('0x1'));var qs=require(_0x32d9('0x2'));var encryptor=require(_0x32d9('0x3'));var config=require(_0x32d9('0x4'));var logger=require(_0x32d9('0x5'))(_0x32d9('0x6'));var db=require(_0x32d9('0x7'))['db'];var oauth=require(_0x32d9('0x8'));config[_0x32d9('0x9')]=_[_0x32d9('0xa')](config[_0x32d9('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x32d9('0xb'))(new Redis(config[_0x32d9('0x9')]));var redis=new Redis(config[_0x32d9('0x9')]);function respondWithStatusCode(_0x1d978d,_0x5a1a78){_0x5a1a78=_0x5a1a78||0xcc;return function(_0x161d8b){if(_0x161d8b){return _0x1d978d['sendStatus'](_0x5a1a78);}return _0x1d978d[_0x32d9('0xc')](_0x5a1a78)['end']();};}function respondWithResult(_0x4e8705,_0x1f0d2e){_0x1f0d2e=_0x1f0d2e||0xc8;return function(_0x1775dc){if(_0x1775dc){return _0x4e8705['status'](_0x1f0d2e)[_0x32d9('0xd')](_0x1775dc);}};}function respondWithFilteredResult(_0x431dbb,_0x254f03){return function(_0x3f6cd1){if(_0x3f6cd1){var _0x21cf93=typeof _0x254f03['offset']==='undefined'&&typeof _0x254f03[_0x32d9('0xe')]===_0x32d9('0xf');var _0x310fa0=_0x3f6cd1[_0x32d9('0x10')];var _0x383f0e=_0x21cf93?0x0:_0x254f03[_0x32d9('0x11')];var _0x2ea562=_0x21cf93?_0x3f6cd1[_0x32d9('0x10')]:_0x254f03[_0x32d9('0x11')]+_0x254f03[_0x32d9('0xe')];var _0x5798d4;if(_0x2ea562>=_0x310fa0){_0x2ea562=_0x310fa0;_0x5798d4=0xc8;}else{_0x5798d4=0xce;}_0x431dbb['status'](_0x5798d4);return _0x431dbb['set'](_0x32d9('0x12'),_0x383f0e+'-'+_0x2ea562+'/'+_0x310fa0)[_0x32d9('0xd')](_0x3f6cd1);}return null;};}function saveUpdates(_0x5da89c){return function(_0x5dc339){if(_0x5dc339){return _0x5dc339[_0x32d9('0x13')](_0x5da89c)[_0x32d9('0x14')](function(_0x487182){return _0x487182;});}return null;};}function removeEntity(_0x344205){return function(_0x1acf76){if(_0x1acf76){return _0x1acf76['destroy']()['then'](function(){_0x344205[_0x32d9('0xc')](0xcc)[_0x32d9('0x15')]();});}};}function handleEntityNotFound(_0x424b06){return function(_0x4e2e48){if(!_0x4e2e48){_0x424b06['sendStatus'](0x194);}return _0x4e2e48;};}function handleError(_0x31a323,_0x17ce87){_0x17ce87=_0x17ce87||0x1f4;return function(_0x336d9c){logger[_0x32d9('0x16')](_0x336d9c[_0x32d9('0x17')]);if(_0x336d9c[_0x32d9('0x18')]){delete _0x336d9c[_0x32d9('0x18')];}_0x31a323[_0x32d9('0xc')](_0x17ce87)[_0x32d9('0x19')](_0x336d9c);};}function maskClientSecret(_0x3dac79){return _[_0x32d9('0x1a')](_0x3dac79[_0x32d9('0x1b')](0x0,0x3),0x14,'*');}exports[_0x32d9('0x1c')]=function(_0x5c9fbd,_0x54a443){var _0x17027d={},_0x284cdb={},_0x508143={'count':0x0,'rows':[]};var _0x4fdf0f=_[_0x32d9('0x1d')](db[_0x32d9('0x1e')][_0x32d9('0x1f')],function(_0x48d7ea){return{'name':_0x48d7ea[_0x32d9('0x20')],'type':_0x48d7ea[_0x32d9('0x21')][_0x32d9('0x22')]};});_0x284cdb[_0x32d9('0x23')]=_[_0x32d9('0x1d')](_0x4fdf0f,'name');_0x284cdb['query']=_[_0x32d9('0x24')](_0x5c9fbd[_0x32d9('0x25')]);_0x284cdb[_0x32d9('0x26')]=_[_0x32d9('0x27')](_0x284cdb[_0x32d9('0x23')],_0x284cdb['query']);_0x17027d['attributes']=_[_0x32d9('0x27')](_0x284cdb[_0x32d9('0x23')],qs[_0x32d9('0x28')](_0x5c9fbd[_0x32d9('0x25')]['fields']));_0x17027d['attributes']=_0x17027d[_0x32d9('0x29')][_0x32d9('0x2a')]?_0x17027d[_0x32d9('0x29')]:_0x284cdb[_0x32d9('0x23')];if(!_0x5c9fbd[_0x32d9('0x25')]['hasOwnProperty'](_0x32d9('0x2b'))){_0x17027d[_0x32d9('0xe')]=qs['limit'](_0x5c9fbd[_0x32d9('0x25')][_0x32d9('0xe')]);_0x17027d[_0x32d9('0x11')]=qs[_0x32d9('0x11')](_0x5c9fbd['query'][_0x32d9('0x11')]);}_0x17027d[_0x32d9('0x2c')]=qs[_0x32d9('0x2d')](_0x5c9fbd[_0x32d9('0x25')][_0x32d9('0x2d')]);_0x17027d[_0x32d9('0x2e')]=qs['filters'](_[_0x32d9('0x2f')](_0x5c9fbd[_0x32d9('0x25')],_0x284cdb[_0x32d9('0x26')]),_0x4fdf0f);if(_0x5c9fbd[_0x32d9('0x25')]['filter']){_0x17027d['where']=_[_0x32d9('0x30')](_0x17027d[_0x32d9('0x2e')],{'$or':_[_0x32d9('0x1d')](_0x4fdf0f,function(_0x444ec2){if(_0x444ec2[_0x32d9('0x21')]!=='VIRTUAL'){var _0x1cdd06={};_0x1cdd06[_0x444ec2[_0x32d9('0x18')]]={'$like':'%'+_0x5c9fbd[_0x32d9('0x25')][_0x32d9('0x31')]+'%'};return _0x1cdd06;}})});}_0x17027d=_[_0x32d9('0x30')]({},_0x17027d,_0x5c9fbd[_0x32d9('0x32')]);var _0x2946d0={'where':_0x17027d[_0x32d9('0x2e')]};return db[_0x32d9('0x1e')][_0x32d9('0x10')](_0x2946d0)[_0x32d9('0x14')](function(_0x2eef00){_0x508143[_0x32d9('0x10')]=_0x2eef00;if(_0x5c9fbd[_0x32d9('0x25')][_0x32d9('0x33')]){_0x17027d['include']=[{'all':!![]}];}return db['CloudProvider'][_0x32d9('0x34')](_0x17027d);})[_0x32d9('0x14')](function(_0x41ab54){_0x508143['rows']=_[_0x32d9('0x1d')](_0x41ab54,function(_0x4d9018){if(_0x4d9018['service']===_0x32d9('0x35')){var _0x57a03f=encryptor['decryptString'](_0x4d9018[_0x32d9('0x36')]);_0x4d9018[_0x32d9('0x36')]=maskClientSecret(_0x57a03f);}return _0x4d9018;});return _0x508143;})[_0x32d9('0x14')](respondWithFilteredResult(_0x54a443,_0x17027d))[_0x32d9('0x37')](handleError(_0x54a443,null));};exports[_0x32d9('0x38')]=function(_0x3e0afa,_0x3d0109){var _0x505e86={'raw':!![],'where':{'id':_0x3e0afa[_0x32d9('0x39')]['id']}},_0x363905={};_0x363905[_0x32d9('0x23')]=_['keys'](db[_0x32d9('0x1e')][_0x32d9('0x1f')]);_0x363905['query']=_['keys'](_0x3e0afa[_0x32d9('0x25')]);_0x363905[_0x32d9('0x26')]=_[_0x32d9('0x27')](_0x363905['model'],_0x363905[_0x32d9('0x25')]);_0x505e86[_0x32d9('0x29')]=_['intersection'](_0x363905['model'],qs['fields'](_0x3e0afa[_0x32d9('0x25')][_0x32d9('0x28')]));_0x505e86[_0x32d9('0x29')]=_0x505e86['attributes'][_0x32d9('0x2a')]?_0x505e86['attributes']:_0x363905[_0x32d9('0x23')];if(_0x3e0afa['query'][_0x32d9('0x33')]){_0x505e86['include']=[{'all':!![]}];}_0x505e86=_[_0x32d9('0x30')]({},_0x505e86,_0x3e0afa[_0x32d9('0x32')]);return db[_0x32d9('0x1e')][_0x32d9('0x3a')](_0x505e86)[_0x32d9('0x14')](handleEntityNotFound(_0x3d0109,null))[_0x32d9('0x14')](function(_0x15f63f){if(_0x15f63f[_0x32d9('0x3b')]===_0x32d9('0x35')){var _0x34e7e2=encryptor[_0x32d9('0x3c')](_0x15f63f[_0x32d9('0x36')]);_0x15f63f[_0x32d9('0x36')]=maskClientSecret(_0x34e7e2);}return _0x15f63f;})['then'](respondWithResult(_0x3d0109,null))[_0x32d9('0x37')](handleError(_0x3d0109,null));};exports[_0x32d9('0x3d')]=function(_0x319635,_0x27e211){if(!_0x319635[_0x32d9('0x3e')][_0x32d9('0x18')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x319635['body'][_0x32d9('0x3b')])throw new Error(_0x32d9('0x3f'));var _0x310e18=db[_0x32d9('0x1e')][_0x32d9('0x1f')]['service'][_0x32d9('0x40')];if(!_0x310e18[_0x32d9('0x41')](_0x319635['body'][_0x32d9('0x3b')]))throw new Error(_0x32d9('0x42')+_0x310e18[_0x32d9('0x43')](',\x20'));if(_0x319635[_0x32d9('0x3e')][_0x32d9('0x3b')]===_0x32d9('0x35')&&_0x319635[_0x32d9('0x3e')][_0x32d9('0x36')]){_0x319635[_0x32d9('0x3e')][_0x32d9('0x36')]=encryptor['encryptString'](_0x319635['body'][_0x32d9('0x36')]);}return db[_0x32d9('0x1e')][_0x32d9('0x3d')](_0x319635[_0x32d9('0x3e')],{})[_0x32d9('0x14')](respondWithResult(_0x27e211,0xc9))[_0x32d9('0x37')](handleError(_0x27e211,null));};exports[_0x32d9('0x13')]=function(_0x5ec18a,_0x5aa2f8){if(_0x5ec18a['body']['id']){delete _0x5ec18a[_0x32d9('0x3e')]['id'];}return db[_0x32d9('0x1e')]['find']({'where':{'id':_0x5ec18a[_0x32d9('0x39')]['id']}})['then'](handleEntityNotFound(_0x5aa2f8,null))['then'](function(_0x46d194){if(_0x46d194['service']===_0x32d9('0x35')&&_0x5ec18a['body'][_0x32d9('0x36')]){_0x5ec18a[_0x32d9('0x3e')][_0x32d9('0x36')]=encryptor[_0x32d9('0x44')](_0x5ec18a['body']['data3']);}return _0x46d194;})[_0x32d9('0x14')](saveUpdates(_0x5ec18a['body'],null))[_0x32d9('0x14')](respondWithResult(_0x5aa2f8,null))[_0x32d9('0x37')](handleError(_0x5aa2f8,null));};exports[_0x32d9('0x45')]=function(_0xf36b3d,_0x46bd34){return db[_0x32d9('0x1e')][_0x32d9('0x3a')]({'where':{'id':_0xf36b3d[_0x32d9('0x39')]['id']}})[_0x32d9('0x14')](handleEntityNotFound(_0x46bd34,null))['then'](removeEntity(_0x46bd34,null))['catch'](handleError(_0x46bd34,null));};exports[_0x32d9('0x46')]=function(_0x5d1089,_0x5f01fb){return db[_0x32d9('0x1e')][_0x32d9('0x47')]({'where':{'id':_0x5d1089['params']['id']},'raw':!![]})[_0x32d9('0x14')](function(_0xcf58e9){if(!_0xcf58e9)return _0x5f01fb['sendStatus'](0x194);return{'url':oauth[_0x32d9('0x48')](_0xcf58e9,_0x5d1089[_0x32d9('0x49')]['id'])};})[_0x32d9('0x14')](respondWithResult(_0x5f01fb,null))[_0x32d9('0x37')](handleError(_0x5f01fb,null));};exports['oauth2MicrosoftCallback']=function(_0x3f32cb,_0x5e9ff7){var _0xe5a730=_0x3f32cb[_0x32d9('0x3e')];var _0x129bb4;var _0x2b8d57;if(_0xe5a730[_0x32d9('0x16')])throw _0xe5a730;redis[_0x32d9('0x4a')](_0xe5a730['state'])[_0x32d9('0x14')](function(_0x2b2c21){if(!_0x2b2c21)throw new Error(_0x32d9('0x4b'));_0x129bb4=JSON[_0x32d9('0x4c')](_0x2b2c21);var _0x33605e=Buffer['from'](_0xe5a730[_0x32d9('0x4d')],_0x32d9('0x4e'))['toString']('ascii');_0x2b8d57=JSON[_0x32d9('0x4c')](_0x33605e);if(!oauth[_0x32d9('0x4f')](_0xe5a730[_0x32d9('0x50')],_0x129bb4[_0x32d9('0x51')]))throw new Error(_0x32d9('0x52'));redis[_0x32d9('0x53')](_0xe5a730[_0x32d9('0x4d')]);return oauth[_0x32d9('0x54')](_0xe5a730[_0x32d9('0x55')],_0x129bb4);})[_0x32d9('0x14')](function(_0x411d7d){_0x129bb4['data5']=_0x411d7d[_0x32d9('0x56')];_0x129bb4[_0x32d9('0x57')]=_0x411d7d[_0x32d9('0x58')];return db[_0x32d9('0x1e')]['update']({'data5':_0x129bb4[_0x32d9('0x59')],'data6':_0x129bb4['data6']},{'where':{'id':_0x129bb4['id']}});})['then'](function(){oauth[_0x32d9('0x5a')](_0x129bb4);socket[_0x32d9('0x5b')](_0x32d9('0x5c'),{'id':_0x2b8d57['id']});return;})['then'](respondWithStatusCode(_0x5e9ff7,null))['catch'](function(_0x435ba8){if(_0x2b8d57){socket[_0x32d9('0x5b')](_0x32d9('0x5d'),{'id':_0x2b8d57['id']});}if(!_0x129bb4){logger[_0x32d9('0x16')](_0x32d9('0x5e'),_0x435ba8);return _0x5e9ff7[_0x32d9('0xc')](0x1f4)[_0x32d9('0x19')](_0x435ba8[_0x32d9('0x5f')]);}logger[_0x32d9('0x16')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x129bb4['id'],JSON['stringify'](_0x435ba8));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 2e939b5..6a3223c 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 _0x022b=['api','moment','bluebird','path','rimraf','./cloudProvider.attributes','exports','CloudProvider','cloud_providers','util','../../config/logger'];(function(_0x295314,_0x17b250){var _0x584b0c=function(_0x51cc84){while(--_0x51cc84){_0x295314['push'](_0x295314['shift']());}};_0x584b0c(++_0x17b250);}(_0x022b,0x6c));var _0xb022=function(_0x504e94,_0x42f630){_0x504e94=_0x504e94-0x0;var _0x1de301=_0x022b[_0x504e94];return _0x1de301;};'use strict';var _=require('lodash');var util=require(_0xb022('0x0'));var logger=require(_0xb022('0x1'))(_0xb022('0x2'));var moment=require(_0xb022('0x3'));var BPromise=require(_0xb022('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb022('0x5'));var rimraf=require(_0xb022('0x6'));var config=require('../../config/environment');var attributes=require(_0xb022('0x7'));module[_0xb022('0x8')]=function(_0x4e16f6,_0x4294ed){return _0x4e16f6['define'](_0xb022('0x9'),attributes,{'tableName':_0xb022('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53ce=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./cloudProvider.attributes','define','CloudProvider','cloud_providers','lodash','util'];(function(_0x23ca3a,_0xe44c43){var _0x5c1aab=function(_0x29bcdd){while(--_0x29bcdd){_0x23ca3a['push'](_0x23ca3a['shift']());}};_0x5c1aab(++_0xe44c43);}(_0x53ce,0xfa));var _0xe53c=function(_0x3ff73c,_0x192819){_0x3ff73c=_0x3ff73c-0x0;var _0x11d93c=_0x53ce[_0x3ff73c];return _0x11d93c;};'use strict';var _=require(_0xe53c('0x0'));var util=require(_0xe53c('0x1'));var logger=require(_0xe53c('0x2'))(_0xe53c('0x3'));var moment=require('moment');var BPromise=require(_0xe53c('0x4'));var rp=require(_0xe53c('0x5'));var fs=require('fs');var path=require(_0xe53c('0x6'));var rimraf=require('rimraf');var config=require(_0xe53c('0x7'));var attributes=require(_0xe53c('0x8'));module['exports']=function(_0x555f24,_0x3bb10b){return _0x555f24[_0xe53c('0x9')](_0xe53c('0xa'),attributes,{'tableName':_0xe53c('0xb'),'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 4df2512..b411cb8 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 _0xa205=['api','../../mysqldb','defaults','localhost','redis','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','push','data7','/.default','join','Outlook365','replace','{TENANT_ID}','data2','code','id_token','from','toString','base64','randomBytes','client_id','response_type','redirect_uri','data4','response_mode','form_post','scope','state','nonce','prompt','login','key','value','oauth2/','data1','set','stringify','decode','audience','isAfter','unix','data3','CloudProvider','findOne','then','refresh_token','data6','decryptString','POST','data5','access_token','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','bind','intervals','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','jsonwebtoken','ioredis','util','../../components/encryptor','../../config/environment','../../config/logger'];(function(_0x47e9f3,_0x2169a5){var _0x5383ef=function(_0x3026c9){while(--_0x3026c9){_0x47e9f3['push'](_0x47e9f3['shift']());}};_0x5383ef(++_0x2169a5);}(_0xa205,0x8f));var _0x5a20=function(_0x367a3d,_0x452717){_0x367a3d=_0x367a3d-0x0;var _0x460539=_0xa205[_0x367a3d];return _0x460539;};'use strict';var _=require(_0x5a20('0x0'));var crypto=require('crypto');var jwt=require(_0x5a20('0x1'));var moment=require('moment');var Redis=require(_0x5a20('0x2'));var rp=require('request-promise');var util=require(_0x5a20('0x3'));var encryptor=require(_0x5a20('0x4'));var config=require(_0x5a20('0x5'));var logger=require(_0x5a20('0x6'))(_0x5a20('0x7'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0x5a20('0x8'))['db'];config['redis']=_[_0x5a20('0x9')](config['redis'],{'host':_0x5a20('0xa'),'port':0x18eb});var redis=new Redis(config[_0x5a20('0xb')]);var MICROSOFT_AUTH_URL=_0x5a20('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0x5a20('0xd'),'profile',_0x5a20('0xe'),'offline_access',_0x5a20('0xf'),_0x5a20('0x10'),_0x5a20('0x11')],'Dynamics365':[_0x5a20('0xd'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0x5a20('0x12');var MICROSOFT_TOKEN_ENDPOINT=_0x5a20('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x15599d){var _0x5ccb03=_[_0x5a20('0x14')](AZURE_AUTH_SCOPES[_0x15599d[_0x5a20('0x15')]]);if(_0x15599d[_0x5a20('0x15')]==='Dynamics365')_0x5ccb03[_0x5a20('0x16')](_0x15599d[_0x5a20('0x17')]+_0x5a20('0x18'));return _0x5ccb03[_0x5a20('0x19')]('\x20');}function getAccessTokenScope(_0x508c80){if(_0x508c80['type']===_0x5a20('0x1a'))return _0x5a20('0xf');if(_0x508c80[_0x5a20('0x15')]==='Dynamics365')return _0x508c80[_0x5a20('0x17')]+_0x5a20('0x18');}function generateMicrosoftAuthorizationUrl(_0xa54b0f,_0xa53877){var _0x59abf4=MICROSOFT_AUTH_URL[_0x5a20('0x1b')](_0x5a20('0x1c'),_0xa54b0f[_0x5a20('0x1d')]);var _0x5990d4=[_0x5a20('0x1e'),_0x5a20('0x1f')];var _0x3282b6=Buffer[_0x5a20('0x20')](JSON['stringify']({'id':_0xa53877}))[_0x5a20('0x21')](_0x5a20('0x22'));var _0x512dc0=crypto[_0x5a20('0x23')](0x10)[_0x5a20('0x21')]('hex');var _0x1df41e=getAuthorizationScopes(_0xa54b0f);var _0x5eacd0=[{'key':_0x5a20('0x24'),'value':_0xa54b0f['data1']},{'key':_0x5a20('0x25'),'value':encodeURIComponent(_0x5990d4[_0x5a20('0x19')]('\x20'))},{'key':_0x5a20('0x26'),'value':_0xa54b0f[_0x5a20('0x27')]},{'key':_0x5a20('0x28'),'value':_0x5a20('0x29')},{'key':_0x5a20('0x2a'),'value':encodeURIComponent(_0x1df41e)},{'key':_0x5a20('0x2b'),'value':_0x3282b6},{'key':_0x5a20('0x2c'),'value':_0x512dc0},{'key':_0x5a20('0x2d'),'value':_0x5a20('0x2e')}];var _0x49d4b6=_0x59abf4+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x5a20('0x14')](_0x5eacd0,function(_0x1bec09){return _0x1bec09[_0x5a20('0x2f')]+'='+_0x1bec09[_0x5a20('0x30')];})['join']('&');_0xa54b0f['oauth2Claims']={'issuer':_0x59abf4[_0x5a20('0x1b')](_0x5a20('0x31'),''),'audience':_0xa54b0f[_0x5a20('0x32')],'state':_0x3282b6,'nonce':_0x512dc0};redis[_0x5a20('0x33')](_0x3282b6,JSON[_0x5a20('0x34')](_0xa54b0f));return _0x49d4b6;}function isValidIdToken(_0x4b7944,_0x568c76){try{var _0x37181a=jwt[_0x5a20('0x35')](_0x4b7944,{'complete':!![]});var _0x392ed8=_0x37181a['payload'];if(_0x392ed8['iss']!==_0x568c76['issuer'])return![];if(_0x392ed8['aud']!==_0x568c76[_0x5a20('0x36')])return![];if(_0x392ed8[_0x5a20('0x2c')]!==_0x568c76[_0x5a20('0x2c')])return![];if(moment()[_0x5a20('0x37')](moment[_0x5a20('0x38')](_0x392ed8['exp'])))return![];return!![];}catch(_0x175ebd){throw _0x175ebd;}}function refreshOauth2MicrosoftAccessToken(_0x4b881d){return Promise['resolve']()['then'](function(){if(_0x4b881d[_0x5a20('0x39')])return _0x4b881d;return db[_0x5a20('0x3a')][_0x5a20('0x3b')]({'where':{'id':_0x4b881d['id']},'raw':!![]});})[_0x5a20('0x3c')](function(_0x3711e9){var _0x3145b4={'grant_type':_0x5a20('0x3d'),'refresh_token':_0x3711e9[_0x5a20('0x3e')],'scope':getAccessTokenScope(_0x3711e9),'redirect_uri':_0x3711e9[_0x5a20('0x27')],'client_id':_0x3711e9[_0x5a20('0x32')],'client_secret':encryptor[_0x5a20('0x3f')](_0x3711e9[_0x5a20('0x39')])};var _0x254486={'method':_0x5a20('0x40'),'uri':MICROSOFT_AUTH_URL[_0x5a20('0x1b')]('{TENANT_ID}',_0x3711e9[_0x5a20('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3145b4,'json':!![]};return rp(_0x254486);})[_0x5a20('0x3c')](function(_0x2709ea){_0x4b881d[_0x5a20('0x41')]=_0x2709ea[_0x5a20('0x42')];_0x4b881d[_0x5a20('0x3e')]=_0x2709ea['refresh_token'];return db[_0x5a20('0x3a')]['update']({'data5':_0x4b881d[_0x5a20('0x41')],'data6':_0x4b881d[_0x5a20('0x3e')]},{'where':{'id':_0x4b881d['id']}});})[_0x5a20('0x3c')](function(){return _0x4b881d;})[_0x5a20('0x43')](function(_0x312d75){logger[_0x5a20('0x44')](_0x5a20('0x45'),_0x4b881d['id'],_0x312d75);});}function getOauth2MicrosoftAccessToken(_0x16c8aa,_0x515efd){var _0x2a876e={'grant_type':_0x5a20('0x46'),'code':_0x16c8aa,'scope':getAccessTokenScope(_0x515efd),'redirect_uri':_0x515efd['data4'],'client_id':_0x515efd[_0x5a20('0x32')],'client_secret':encryptor[_0x5a20('0x3f')](_0x515efd[_0x5a20('0x39')])};var _0x6e32f={'method':_0x5a20('0x40'),'uri':MICROSOFT_AUTH_URL[_0x5a20('0x1b')](_0x5a20('0x1c'),_0x515efd[_0x5a20('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2a876e,'json':!![]};return rp(_0x6e32f);}function startRefreshInterval(_0x226dac){var _0x1a9fa5=schedule['intervals'];if(_0x1a9fa5[_0x226dac['id']])clearInterval(_0x1a9fa5[_0x226dac['id']]);_0x1a9fa5[_0x226dac['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x5a20('0x47')](this,{'id':_0x226dac['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x5a20('0x48')]=_0x1a9fa5;}function startAllRefreshIntervals(){return db[_0x5a20('0x3a')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x5a20('0x3c')](function(_0x24f7b2){var _0x1a20e5=_0x24f7b2[_0x5a20('0x14')](function(_0x1eeb39){return refreshOauth2MicrosoftAccessToken(_0x1eeb39)[_0x5a20('0x3c')](function(_0x2beb88){startRefreshInterval(_0x2beb88);});});return Promise['all'](_0x1a20e5);})[_0x5a20('0x43')](function(_0x4d274a){var _0x28c2c2=_0x4d274a?util['inspect'](_0x4d274a,{'showHidden':![],'depth':null}):'';logger[_0x5a20('0x44')](_0x5a20('0x49'),_0x28c2c2);});}module[_0x5a20('0x4a')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x633b=['decryptString','POST','data5','access_token','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','crypto','moment','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','/authorize','map','Dynamics365','push','data7','/.default','join','Outlook365','type','{TENANT_ID}','data2','id_token','stringify','toString','hex','client_id','data1','response_type','redirect_uri','data4','response_mode','scope','state','nonce','prompt','login','key','value','oauth2Claims','replace','set','payload','iss','issuer','aud','audience','isAfter','exp','then','data3','CloudProvider','findOne','refresh_token','data6'];(function(_0x4c93f8,_0x2ac397){var _0x59f0cd=function(_0x2d2182){while(--_0x2d2182){_0x4c93f8['push'](_0x4c93f8['shift']());}};_0x59f0cd(++_0x2ac397);}(_0x633b,0x13b));var _0xb633=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x633b[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var crypto=require(_0xb633('0x0'));var jwt=require('jsonwebtoken');var moment=require(_0xb633('0x1'));var Redis=require('ioredis');var rp=require(_0xb633('0x2'));var util=require(_0xb633('0x3'));var encryptor=require(_0xb633('0x4'));var config=require(_0xb633('0x5'));var logger=require(_0xb633('0x6'))('api');var schedule=require(_0xb633('0x7'));var db=require(_0xb633('0x8'))['db'];config[_0xb633('0x9')]=_['defaults'](config[_0xb633('0x9')],{'host':_0xb633('0xa'),'port':0x18eb});var redis=new Redis(config[_0xb633('0x9')]);var MICROSOFT_AUTH_URL=_0xb633('0xb');var AZURE_AUTH_SCOPES={'Outlook365':['openid','profile','email',_0xb633('0xc'),_0xb633('0xd'),'https://outlook.office.com/POP.AccessAsUser.All',_0xb633('0xe')],'Dynamics365':[_0xb633('0xf'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0xb633('0x10');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x454689){var _0x54fe16=_[_0xb633('0x11')](AZURE_AUTH_SCOPES[_0x454689['type']]);if(_0x454689['type']===_0xb633('0x12'))_0x54fe16[_0xb633('0x13')](_0x454689[_0xb633('0x14')]+_0xb633('0x15'));return _0x54fe16[_0xb633('0x16')]('\x20');}function getAccessTokenScope(_0x15f0a3){if(_0x15f0a3['type']===_0xb633('0x17'))return _0xb633('0xd');if(_0x15f0a3[_0xb633('0x18')]===_0xb633('0x12'))return _0x15f0a3[_0xb633('0x14')]+_0xb633('0x15');}function generateMicrosoftAuthorizationUrl(_0x49889a,_0x17d348){var _0x3fa3ff=MICROSOFT_AUTH_URL['replace'](_0xb633('0x19'),_0x49889a[_0xb633('0x1a')]);var _0x234c01=['code',_0xb633('0x1b')];var _0x56fc9b=Buffer['from'](JSON[_0xb633('0x1c')]({'id':_0x17d348}))['toString']('base64');var _0x361cb4=crypto['randomBytes'](0x10)[_0xb633('0x1d')](_0xb633('0x1e'));var _0x5e1fff=getAuthorizationScopes(_0x49889a);var _0x3e9786=[{'key':_0xb633('0x1f'),'value':_0x49889a[_0xb633('0x20')]},{'key':_0xb633('0x21'),'value':encodeURIComponent(_0x234c01[_0xb633('0x16')]('\x20'))},{'key':_0xb633('0x22'),'value':_0x49889a[_0xb633('0x23')]},{'key':_0xb633('0x24'),'value':'form_post'},{'key':_0xb633('0x25'),'value':encodeURIComponent(_0x5e1fff)},{'key':_0xb633('0x26'),'value':_0x56fc9b},{'key':_0xb633('0x27'),'value':_0x361cb4},{'key':_0xb633('0x28'),'value':_0xb633('0x29')}];var _0x3e889d=_0x3fa3ff+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xb633('0x11')](_0x3e9786,function(_0x5d2bf3){return _0x5d2bf3[_0xb633('0x2a')]+'='+_0x5d2bf3[_0xb633('0x2b')];})[_0xb633('0x16')]('&');_0x49889a[_0xb633('0x2c')]={'issuer':_0x3fa3ff[_0xb633('0x2d')]('oauth2/',''),'audience':_0x49889a[_0xb633('0x20')],'state':_0x56fc9b,'nonce':_0x361cb4};redis[_0xb633('0x2e')](_0x56fc9b,JSON[_0xb633('0x1c')](_0x49889a));return _0x3e889d;}function isValidIdToken(_0x10dcb8,_0xa348f6){try{var _0x314759=jwt['decode'](_0x10dcb8,{'complete':!![]});var _0x281fd9=_0x314759[_0xb633('0x2f')];if(_0x281fd9[_0xb633('0x30')]!==_0xa348f6[_0xb633('0x31')])return![];if(_0x281fd9[_0xb633('0x32')]!==_0xa348f6[_0xb633('0x33')])return![];if(_0x281fd9[_0xb633('0x27')]!==_0xa348f6[_0xb633('0x27')])return![];if(moment()[_0xb633('0x34')](moment['unix'](_0x281fd9[_0xb633('0x35')])))return![];return!![];}catch(_0x3fb263){throw _0x3fb263;}}function refreshOauth2MicrosoftAccessToken(_0x73e795){return Promise['resolve']()[_0xb633('0x36')](function(){if(_0x73e795[_0xb633('0x37')])return _0x73e795;return db[_0xb633('0x38')][_0xb633('0x39')]({'where':{'id':_0x73e795['id']},'raw':!![]});})[_0xb633('0x36')](function(_0x3771f8){var _0x48f1e8={'grant_type':_0xb633('0x3a'),'refresh_token':_0x3771f8[_0xb633('0x3b')],'scope':getAccessTokenScope(_0x3771f8),'redirect_uri':_0x3771f8[_0xb633('0x23')],'client_id':_0x3771f8[_0xb633('0x20')],'client_secret':encryptor[_0xb633('0x3c')](_0x3771f8[_0xb633('0x37')])};var _0xc40d24={'method':_0xb633('0x3d'),'uri':MICROSOFT_AUTH_URL[_0xb633('0x2d')](_0xb633('0x19'),_0x3771f8[_0xb633('0x1a')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x48f1e8,'json':!![]};return rp(_0xc40d24);})[_0xb633('0x36')](function(_0xb2d7a9){_0x73e795[_0xb633('0x3e')]=_0xb2d7a9[_0xb633('0x3f')];_0x73e795['data6']=_0xb2d7a9['refresh_token'];return db[_0xb633('0x38')][_0xb633('0x40')]({'data5':_0x73e795[_0xb633('0x3e')],'data6':_0x73e795[_0xb633('0x3b')]},{'where':{'id':_0x73e795['id']}});})[_0xb633('0x36')](function(){return _0x73e795;})[_0xb633('0x41')](function(_0xc5ee22){logger[_0xb633('0x42')](_0xb633('0x43'),_0x73e795['id'],_0xc5ee22);});}function getOauth2MicrosoftAccessToken(_0x221eb1,_0x26f50f){var _0x554c8d={'grant_type':_0xb633('0x44'),'code':_0x221eb1,'scope':getAccessTokenScope(_0x26f50f),'redirect_uri':_0x26f50f[_0xb633('0x23')],'client_id':_0x26f50f[_0xb633('0x20')],'client_secret':encryptor[_0xb633('0x3c')](_0x26f50f[_0xb633('0x37')])};var _0x41c54b={'method':_0xb633('0x3d'),'uri':MICROSOFT_AUTH_URL[_0xb633('0x2d')](_0xb633('0x19'),_0x26f50f[_0xb633('0x1a')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x554c8d,'json':!![]};return rp(_0x41c54b);}function startRefreshInterval(_0x51a69a){var _0x33f1bb=schedule['intervals'];if(_0x33f1bb[_0x51a69a['id']])clearInterval(_0x33f1bb[_0x51a69a['id']]);_0x33f1bb[_0x51a69a['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x51a69a['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xb633('0x45')]=_0x33f1bb;}function startAllRefreshIntervals(){return db[_0xb633('0x38')][_0xb633('0x46')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xb633('0x36')](function(_0x24f9fe){var _0x3a7ff5=_0x24f9fe['map'](function(_0x135950){return refreshOauth2MicrosoftAccessToken(_0x135950)[_0xb633('0x36')](function(_0x25bd22){startRefreshInterval(_0x25bd22);});});return Promise[_0xb633('0x47')](_0x3a7ff5);})[_0xb633('0x41')](function(_0x1bc692){var _0x54657c=_0x1bc692?util[_0xb633('0x48')](_0x1bc692,{'showHidden':![],'depth':null}):'';logger[_0xb633('0x42')](_0xb633('0x49'),_0x54657c);});}module[_0xb633('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 4416075..bd1e6ef 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 _0xc224=['jayson/promise','request','then','CloudProvider,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc224,0x1af));var _0x4c22=function(_0x10da20,_0x43b8cf){_0x10da20=_0x10da20-0x0;var _0x59e57e=_0xc224[_0x10da20];return _0x59e57e;};'use strict';var _=require(_0x4c22('0x0'));var util=require(_0x4c22('0x1'));var moment=require(_0x4c22('0x2'));var BPromise=require('bluebird');var rs=require(_0x4c22('0x3'));var fs=require('fs');var Redis=require(_0x4c22('0x4'));var db=require(_0x4c22('0x5'))['db'];var utils=require(_0x4c22('0x6'));var logger=require(_0x4c22('0x7'))(_0x4c22('0x8'));var config=require(_0x4c22('0x9'));var jayson=require(_0x4c22('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x49f782,_0x4195b6,_0x3a6191){return new BPromise(function(_0x45397c,_0x309dad){return client[_0x4c22('0xb')](_0x49f782,_0x3a6191)[_0x4c22('0xc')](function(_0x44ec98){logger['info'](_0x4c22('0xd'),_0x4195b6,_0x4c22('0xe'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0x4195b6,_0x4c22('0xe'),JSON[_0x4c22('0xf')](_0x44ec98));if(_0x44ec98[_0x4c22('0x10')]){if(_0x44ec98['error'][_0x4c22('0x11')]===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0x4195b6,_0x44ec98['error'][_0x4c22('0x12')]);return _0x309dad(_0x44ec98[_0x4c22('0x10')][_0x4c22('0x12')]);}logger[_0x4c22('0x10')](_0x4c22('0xd'),_0x4195b6,_0x44ec98['error'][_0x4c22('0x12')]);return _0x45397c(_0x44ec98[_0x4c22('0x10')][_0x4c22('0x12')]);}else{logger[_0x4c22('0x13')](_0x4c22('0xd'),_0x4195b6,'request\x20sent');_0x45397c(_0x44ec98['result'][_0x4c22('0x12')]);}})[_0x4c22('0x14')](function(_0x46aaaa){logger[_0x4c22('0x10')](_0x4c22('0xd'),_0x4195b6,_0x46aaaa);_0x309dad(_0x46aaaa);});});} \ No newline at end of file +var _0x7292=['http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2f9b9c,_0x3b7f47){var _0x1aeea8=function(_0x2d31a0){while(--_0x2d31a0){_0x2f9b9c['push'](_0x2f9b9c['shift']());}};_0x1aeea8(++_0x3b7f47);}(_0x7292,0x107));var _0x2729=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x7292[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0x2729('0x0'));var util=require(_0x2729('0x1'));var moment=require(_0x2729('0x2'));var BPromise=require(_0x2729('0x3'));var rs=require(_0x2729('0x4'));var fs=require('fs');var Redis=require(_0x2729('0x5'));var db=require(_0x2729('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2729('0x7'))(_0x2729('0x8'));var config=require(_0x2729('0x9'));var jayson=require(_0x2729('0xa'));var client=jayson[_0x2729('0xb')][_0x2729('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3562b9,_0xc89855,_0x1081fd){return new BPromise(function(_0x4c0952,_0x5f4f01){return client[_0x2729('0xd')](_0x3562b9,_0x1081fd)[_0x2729('0xe')](function(_0x47be81){logger[_0x2729('0xf')](_0x2729('0x10'),_0xc89855,_0x2729('0x11'));logger[_0x2729('0x12')](_0x2729('0x13'),_0xc89855,_0x2729('0x11'),JSON[_0x2729('0x14')](_0x47be81));if(_0x47be81[_0x2729('0x15')]){if(_0x47be81[_0x2729('0x15')]['code']===0x1f4){logger[_0x2729('0x15')](_0x2729('0x10'),_0xc89855,_0x47be81[_0x2729('0x15')]['message']);return _0x5f4f01(_0x47be81[_0x2729('0x15')][_0x2729('0x16')]);}logger[_0x2729('0x15')](_0x2729('0x10'),_0xc89855,_0x47be81[_0x2729('0x15')][_0x2729('0x16')]);return _0x4c0952(_0x47be81[_0x2729('0x15')][_0x2729('0x16')]);}else{logger['info'](_0x2729('0x10'),_0xc89855,_0x2729('0x11'));_0x4c0952(_0x47be81[_0x2729('0x17')]['message']);}})[_0x2729('0x18')](function(_0x5c3e88){logger['error'](_0x2729('0x10'),_0xc89855,_0x5c3e88);_0x5f4f01(_0x5c3e88);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index d4f106f..156025b 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 _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x32df63,_0x5b45c4){var _0x2d1bfb=function(_0x3fd1cb){while(--_0x3fd1cb){_0x32df63['push'](_0x32df63['shift']());}};_0x2d1bfb(++_0x5b45c4);}(_0x2ef3,0xba));var _0x32ef=function(_0xad6f6,_0x3781a5){_0xad6f6=_0xad6f6-0x0;var _0x383d4d=_0x2ef3[_0xad6f6];return _0x383d4d;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file +var _0x5f2f=['exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback'];(function(_0x2d9c6a,_0x59393d){var _0xf3c918=function(_0x4f3f26){while(--_0x4f3f26){_0x2d9c6a['push'](_0x2d9c6a['shift']());}};_0xf3c918(++_0x59393d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4efa25,_0x3e2bb0){_0x4efa25=_0x4efa25-0x0;var _0x279ac3=_0x5f2f[_0x4efa25];return _0x279ac3;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);router[_0xf5f2('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x7')]);router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x9')]);router[_0xf5f2('0xa')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xc')]);router[_0xf5f2('0xd')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x4')](_0xf5f2('0xf'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router['post']('/oauth2/microsoft/callback',controller[_0xf5f2('0x11')]);module[_0xf5f2('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 2956a18..2d11eaf 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 _0xf03c=['STRING','sequelize','exports'];(function(_0x385355,_0x398779){var _0x4c088d=function(_0x19362b){while(--_0x19362b){_0x385355['push'](_0x385355['shift']());}};_0x4c088d(++_0x398779);}(_0xf03c,0x199));var _0xcf03=function(_0x303bb0,_0xdb6179){_0x303bb0=_0x303bb0-0x0;var _0x243658=_0xf03c[_0x303bb0];return _0x243658;};'use strict';var Sequelize=require(_0xcf03('0x0'));module[_0xcf03('0x1')]={'name':{'type':Sequelize[_0xcf03('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xcf03('0x2')]},'companyId':{'type':Sequelize[_0xcf03('0x2')]},'website':{'type':Sequelize[_0xcf03('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xcf03('0x2')]},'type':{'type':Sequelize[_0xcf03('0x2')]},'street':{'type':Sequelize[_0xcf03('0x2')]},'postalCode':{'type':Sequelize[_0xcf03('0x2')]},'city':{'type':Sequelize[_0xcf03('0x2')]},'country':{'type':Sequelize[_0xcf03('0x2')]},'email':{'type':Sequelize[_0xcf03('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xcf03('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0xcf03('0x2')]},'sCountry':{'type':Sequelize[_0xcf03('0x2')]},'description':{'type':Sequelize[_0xcf03('0x2')]}}; \ No newline at end of file +var _0x2e3d=['name','STRING','sequelize'];(function(_0x34c3ac,_0x40a7f4){var _0x6661a1=function(_0x14f2ec){while(--_0x14f2ec){_0x34c3ac['push'](_0x34c3ac['shift']());}};_0x6661a1(++_0x40a7f4);}(_0x2e3d,0x1be));var _0xd2e3=function(_0x3a0012,_0x3b2bba){_0x3a0012=_0x3a0012-0x0;var _0x494b09=_0x2e3d[_0x3a0012];return _0x494b09;};'use strict';var Sequelize=require(_0xd2e3('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xd2e3('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xd2e3('0x2')]},'companyId':{'type':Sequelize[_0xd2e3('0x2')]},'website':{'type':Sequelize[_0xd2e3('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xd2e3('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xd2e3('0x2')]},'city':{'type':Sequelize[_0xd2e3('0x2')]},'country':{'type':Sequelize[_0xd2e3('0x2')]},'email':{'type':Sequelize[_0xd2e3('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xd2e3('0x2')]},'sStreet':{'type':Sequelize[_0xd2e3('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0xd2e3('0x2')]},'sCountry':{'type':Sequelize[_0xd2e3('0x2')]},'description':{'type':Sequelize[_0xd2e3('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index cb0c0f9..5dc6f79 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 _0x9d73=['fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','includeAll','include','rows','catch','show','params','rawAttributes','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','omit','findOne','options','getContacts','eml-format','rimraf','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','end','status','limit','undefined','count','offset','set','Content-Range','json','apply','reject','update','then','destroy','get','Companies','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection'];(function(_0x4a715d,_0x2e9a15){var _0xcf321d=function(_0x817650){while(--_0x817650){_0x4a715d['push'](_0x4a715d['shift']());}};_0xcf321d(++_0x2e9a15);}(_0x9d73,0x126));var _0x39d7=function(_0xff3f04,_0x5af459){_0xff3f04=_0xff3f04-0x0;var _0x372500=_0x9d73[_0xff3f04];return _0x372500;};'use strict';var emlformat=require(_0x39d7('0x0'));var rimraf=require(_0x39d7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x39d7('0x2'));var moment=require(_0x39d7('0x3'));var BPromise=require(_0x39d7('0x4'));var Mustache=require(_0x39d7('0x5'));var util=require('util');var path=require('path');var sox=require(_0x39d7('0x6'));var csv=require(_0x39d7('0x7'));var ejs=require(_0x39d7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x39d7('0x9'));var squel=require(_0x39d7('0xa'));var crypto=require(_0x39d7('0xb'));var jsforce=require(_0x39d7('0xc'));var deskjs=require(_0x39d7('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x39d7('0xe'));var Redis=require(_0x39d7('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x39d7('0x10'));var as=require(_0x39d7('0x11'));var hardwareService=require(_0x39d7('0x12'));var logger=require(_0x39d7('0x13'))('api');var utils=require(_0x39d7('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x39d7('0x15'))['db'];function respondWithStatusCode(_0x127777,_0x2e600c){_0x2e600c=_0x2e600c||0xcc;return function(_0x58dee8){if(_0x58dee8){return _0x127777['sendStatus'](_0x2e600c);}return _0x127777['status'](_0x2e600c)[_0x39d7('0x16')]();};}function respondWithResult(_0x22f9f0,_0x155817){_0x155817=_0x155817||0xc8;return function(_0x5c0176){if(_0x5c0176){return _0x22f9f0[_0x39d7('0x17')](_0x155817)['json'](_0x5c0176);}};}function respondWithFilteredResult(_0x2d20c8,_0x73fa2f){return function(_0x27dbc6){if(_0x27dbc6){var _0x28f01e=typeof _0x73fa2f['offset']==='undefined'&&typeof _0x73fa2f[_0x39d7('0x18')]===_0x39d7('0x19');var _0x5cd02f=_0x27dbc6[_0x39d7('0x1a')];var _0x1110f4=_0x28f01e?0x0:_0x73fa2f[_0x39d7('0x1b')];var _0x3452a2=_0x28f01e?_0x27dbc6[_0x39d7('0x1a')]:_0x73fa2f[_0x39d7('0x1b')]+_0x73fa2f[_0x39d7('0x18')];var _0x4d1211;if(_0x3452a2>=_0x5cd02f){_0x3452a2=_0x5cd02f;_0x4d1211=0xc8;}else{_0x4d1211=0xce;}_0x2d20c8['status'](_0x4d1211);return _0x2d20c8[_0x39d7('0x1c')](_0x39d7('0x1d'),_0x1110f4+'-'+_0x3452a2+'/'+_0x5cd02f)[_0x39d7('0x1e')](_0x27dbc6);}return null;};}function patchUpdates(_0x5c97cf){return function(_0x656a7b){try{jsonpatch[_0x39d7('0x1f')](_0x656a7b,_0x5c97cf,!![]);}catch(_0x959565){return BPromise[_0x39d7('0x20')](_0x959565);}return _0x656a7b['save']();};}function saveUpdates(_0x19a9fb,_0x25e550){return function(_0x89c29e){if(_0x89c29e){return _0x89c29e[_0x39d7('0x21')](_0x19a9fb)[_0x39d7('0x22')](function(_0x47ab8b){return _0x47ab8b;});}return null;};}function removeEntity(_0x2e497c,_0x4bb4af){return function(_0x194e19){if(_0x194e19){return _0x194e19[_0x39d7('0x23')]()[_0x39d7('0x22')](function(){var _0x404795=_0x194e19[_0x39d7('0x24')]({'plain':!![]});var _0xf96032=_0x39d7('0x25');return db['UserProfileResource'][_0x39d7('0x23')]({'where':{'type':_0xf96032,'resourceId':_0x404795['id']}})[_0x39d7('0x22')](function(){return _0x194e19;});})[_0x39d7('0x22')](function(){_0x2e497c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3acf9e,_0x5c645e){return function(_0x479ca4){if(!_0x479ca4){_0x3acf9e['sendStatus'](0x194);}return _0x479ca4;};}function handleError(_0x4fff86,_0x5270b2){_0x5270b2=_0x5270b2||0x1f4;return function(_0x3510d2){logger[_0x39d7('0x26')](_0x3510d2[_0x39d7('0x27')]);if(_0x3510d2[_0x39d7('0x28')]){delete _0x3510d2[_0x39d7('0x28')];}_0x4fff86[_0x39d7('0x17')](_0x5270b2)[_0x39d7('0x29')](_0x3510d2);};}exports[_0x39d7('0x2a')]=function(_0x3028e8,_0x28ae45){var _0xa60f36={},_0x1c37af={},_0x3557e1={'count':0x0,'rows':[]};return db[_0x39d7('0x2b')][_0x39d7('0x2c')]()[_0x39d7('0x22')](function(_0x13bf6){_0x1c37af[_0x39d7('0x2d')]=_[_0x39d7('0x2e')](_0x13bf6);_0x1c37af[_0x39d7('0x2f')]=_[_0x39d7('0x2e')](_0x3028e8['query']);_0x1c37af[_0x39d7('0x30')]=_[_0x39d7('0x31')](_0x1c37af['model'],_0x1c37af[_0x39d7('0x2f')]);_0xa60f36['attributes']=_['intersection'](_0x1c37af[_0x39d7('0x2d')],qs['fields'](_0x3028e8[_0x39d7('0x2f')][_0x39d7('0x32')]));_0xa60f36[_0x39d7('0x33')]=_0xa60f36[_0x39d7('0x33')]['length']?_0xa60f36[_0x39d7('0x33')]:_0x1c37af['model'];if(!_0x3028e8[_0x39d7('0x2f')][_0x39d7('0x34')](_0x39d7('0x35'))){_0xa60f36[_0x39d7('0x18')]=qs[_0x39d7('0x18')](_0x3028e8[_0x39d7('0x2f')][_0x39d7('0x18')]);_0xa60f36[_0x39d7('0x1b')]=qs['offset'](_0x3028e8[_0x39d7('0x2f')][_0x39d7('0x1b')]);}_0xa60f36[_0x39d7('0x36')]=qs[_0x39d7('0x37')](_0x3028e8[_0x39d7('0x2f')][_0x39d7('0x37')]);_0xa60f36[_0x39d7('0x38')]=qs[_0x39d7('0x30')](_[_0x39d7('0x39')](_0x3028e8[_0x39d7('0x2f')],_0x1c37af[_0x39d7('0x30')]),_0x13bf6);if(_0x3028e8[_0x39d7('0x2f')][_0x39d7('0x3a')]){_0xa60f36[_0x39d7('0x38')]=_[_0x39d7('0x3b')](_0xa60f36['where'],{'$or':_[_0x39d7('0x3c')](_0xa60f36['attributes'],function(_0x4072db){var _0x2a555b={};_0x2a555b[_0x4072db]={'$like':'%'+_0x3028e8[_0x39d7('0x2f')][_0x39d7('0x3a')]+'%'};return _0x2a555b;})});}_0xa60f36=_['merge']({},_0xa60f36,_0x3028e8['options']);var _0x514957={'where':_0xa60f36[_0x39d7('0x38')]};return db[_0x39d7('0x2b')][_0x39d7('0x1a')](_0x514957)[_0x39d7('0x22')](function(_0x1b1d47){_0x3557e1[_0x39d7('0x1a')]=_0x1b1d47;if(_0x3028e8['query'][_0x39d7('0x3d')]){_0xa60f36[_0x39d7('0x3e')]=[{'all':!![]}];}return db['CmCompany']['findAll'](_0xa60f36);})[_0x39d7('0x22')](function(_0x4069c2){_0x3557e1[_0x39d7('0x3f')]=_0x4069c2;return _0x3557e1;})[_0x39d7('0x22')](respondWithFilteredResult(_0x28ae45,_0xa60f36))[_0x39d7('0x40')](handleError(_0x28ae45,null));})[_0x39d7('0x40')](handleError(_0x28ae45,null));};exports[_0x39d7('0x41')]=function(_0xa47989,_0x446ec9){var _0x5a56e8={'raw':![],'where':{'id':_0xa47989[_0x39d7('0x42')]['id']}},_0xccb5cc={};_0xccb5cc['model']=_[_0x39d7('0x2e')](db['CmCompany'][_0x39d7('0x43')]);_0xccb5cc[_0x39d7('0x2f')]=_['keys'](_0xa47989[_0x39d7('0x2f')]);_0xccb5cc[_0x39d7('0x30')]=_[_0x39d7('0x31')](_0xccb5cc[_0x39d7('0x2d')],_0xccb5cc[_0x39d7('0x2f')]);_0x5a56e8[_0x39d7('0x33')]=_[_0x39d7('0x31')](_0xccb5cc['model'],qs[_0x39d7('0x32')](_0xa47989[_0x39d7('0x2f')][_0x39d7('0x32')]));_0x5a56e8['attributes']=_0x5a56e8[_0x39d7('0x33')][_0x39d7('0x44')]?_0x5a56e8[_0x39d7('0x33')]:_0xccb5cc['model'];if(_0xa47989['query'][_0x39d7('0x3d')]){_0x5a56e8[_0x39d7('0x3e')]=[{'all':!![]}];}_0x5a56e8=_[_0x39d7('0x3b')]({},_0x5a56e8,_0xa47989['options']);return db['CmCompany']['find'](_0x5a56e8)[_0x39d7('0x22')](handleEntityNotFound(_0x446ec9,null))[_0x39d7('0x22')](respondWithResult(_0x446ec9,null))['catch'](handleError(_0x446ec9,null));};exports[_0x39d7('0x45')]=function(_0x14175e,_0x511ed6){return db[_0x39d7('0x2b')][_0x39d7('0x45')](_0x14175e[_0x39d7('0x46')],{})[_0x39d7('0x22')](function(_0x19cd66){var _0x3b260f=_0x14175e[_0x39d7('0x47')]['get']({'plain':!![]});if(!_0x3b260f)throw new Error(_0x39d7('0x48'));if(_0x3b260f[_0x39d7('0x49')]===_0x39d7('0x47')){var _0x36fd94=_0x19cd66['get']({'plain':!![]});var _0x16511e=_0x39d7('0x25');return db[_0x39d7('0x4a')][_0x39d7('0x4b')]({'where':{'name':_0x16511e,'userProfileId':_0x3b260f[_0x39d7('0x4c')]},'raw':!![]})[_0x39d7('0x22')](function(_0x401b91){if(_0x401b91&&_0x401b91[_0x39d7('0x4d')]===0x0){return db[_0x39d7('0x4e')]['create']({'name':_0x36fd94[_0x39d7('0x28')],'resourceId':_0x36fd94['id'],'type':_0x401b91['name'],'sectionId':_0x401b91['id']},{})['then'](function(){return _0x19cd66;});}else{return _0x19cd66;}})['catch'](function(_0x1c15e3){logger[_0x39d7('0x26')](_0x39d7('0x4f'),_0x1c15e3);throw _0x1c15e3;});}return _0x19cd66;})[_0x39d7('0x22')](respondWithResult(_0x511ed6,0xc9))[_0x39d7('0x40')](handleError(_0x511ed6,null));};exports[_0x39d7('0x21')]=function(_0x31b43c,_0x3b2082){if(_0x31b43c[_0x39d7('0x46')]['id']){delete _0x31b43c[_0x39d7('0x46')]['id'];}return db['CmCompany'][_0x39d7('0x4b')]({'where':{'id':_0x31b43c[_0x39d7('0x42')]['id']}})[_0x39d7('0x22')](handleEntityNotFound(_0x3b2082,null))[_0x39d7('0x22')](saveUpdates(_0x31b43c[_0x39d7('0x46')],null))[_0x39d7('0x22')](respondWithResult(_0x3b2082,null))[_0x39d7('0x40')](handleError(_0x3b2082,null));};exports[_0x39d7('0x23')]=function(_0x237bdb,_0x555170){return db[_0x39d7('0x2b')][_0x39d7('0x4b')]({'where':{'id':_0x237bdb['params']['id']}})['then'](handleEntityNotFound(_0x555170,null))[_0x39d7('0x22')](removeEntity(_0x555170,null))[_0x39d7('0x40')](handleError(_0x555170,null));};exports[_0x39d7('0x2c')]=function(_0x31c579,_0x24750c){return db['CmCompany'][_0x39d7('0x2c')]()[_0x39d7('0x22')](respondWithResult(_0x24750c,null))[_0x39d7('0x40')](handleError(_0x24750c,null));};exports[_0x39d7('0x50')]=function(_0x3bcc58,_0x5d6cfa,_0x1f3040){return db[_0x39d7('0x51')]['find']({'where':{'id':_0x3bcc58[_0x39d7('0x42')]['id']}})[_0x39d7('0x22')](handleEntityNotFound(_0x5d6cfa,null))[_0x39d7('0x22')](function(_0xd53a57){if(_0xd53a57){return _0xd53a57['addContacts'](_0x3bcc58[_0x39d7('0x46')]['ids'],_[_0x39d7('0x52')](_0x3bcc58[_0x39d7('0x46')],['ids','id'])||{});}})[_0x39d7('0x22')](respondWithResult(_0x5d6cfa,null))[_0x39d7('0x40')](handleError(_0x5d6cfa,null));};exports['getContacts']=function(_0x494b0d,_0x5828a2,_0x1c7240){var _0x5197f0={};var _0x16019f={};var _0x4a1b36;var _0x33e797;return db[_0x39d7('0x2b')][_0x39d7('0x53')]({'where':{'id':_0x494b0d[_0x39d7('0x42')]['id']}})[_0x39d7('0x22')](handleEntityNotFound(_0x5828a2,null))['then'](function(_0x3c6d12){if(_0x3c6d12){_0x4a1b36=_0x3c6d12;_0x16019f['model']=_[_0x39d7('0x2e')](db[_0x39d7('0x51')][_0x39d7('0x43')]);_0x16019f[_0x39d7('0x2f')]=_[_0x39d7('0x2e')](_0x494b0d[_0x39d7('0x2f')]);_0x16019f[_0x39d7('0x30')]=_[_0x39d7('0x31')](_0x16019f[_0x39d7('0x2d')],_0x16019f[_0x39d7('0x2f')]);_0x5197f0['attributes']=_[_0x39d7('0x31')](_0x16019f[_0x39d7('0x2d')],qs['fields'](_0x494b0d[_0x39d7('0x2f')]['fields']));_0x5197f0[_0x39d7('0x33')]=_0x5197f0[_0x39d7('0x33')]['length']?_0x5197f0[_0x39d7('0x33')]:_0x16019f[_0x39d7('0x2d')];_0x5197f0['order']=qs['sort'](_0x494b0d[_0x39d7('0x2f')]['sort']);_0x5197f0[_0x39d7('0x38')]=qs[_0x39d7('0x30')](_[_0x39d7('0x39')](_0x494b0d[_0x39d7('0x2f')],_0x16019f[_0x39d7('0x30')]));if(_0x494b0d['query'][_0x39d7('0x3a')]){_0x5197f0[_0x39d7('0x38')]=_[_0x39d7('0x3b')](_0x5197f0[_0x39d7('0x38')],{'$or':_[_0x39d7('0x3c')](_0x5197f0[_0x39d7('0x33')],function(_0x4cb75a){var _0x530084={};_0x530084[_0x4cb75a]={'$like':'%'+_0x494b0d[_0x39d7('0x2f')]['filter']+'%'};return _0x530084;})});}_0x5197f0=_['merge']({},_0x5197f0,_0x494b0d[_0x39d7('0x54')]);return _0x4a1b36['getContacts'](_0x5197f0);}})[_0x39d7('0x22')](function(_0xca2f73){if(_0xca2f73){_0x33e797=_0xca2f73['length'];if(!_0x494b0d[_0x39d7('0x2f')][_0x39d7('0x34')](_0x39d7('0x35'))){_0x5197f0[_0x39d7('0x18')]=qs[_0x39d7('0x18')](_0x494b0d[_0x39d7('0x2f')][_0x39d7('0x18')]);_0x5197f0[_0x39d7('0x1b')]=qs[_0x39d7('0x1b')](_0x494b0d[_0x39d7('0x2f')]['offset']);}return _0x4a1b36[_0x39d7('0x55')](_0x5197f0);}})[_0x39d7('0x22')](function(_0x58c54c){if(_0x58c54c){return _0x58c54c?{'count':_0x33e797,'rows':_0x58c54c}:null;}})[_0x39d7('0x22')](respondWithResult(_0x5828a2,null))[_0x39d7('0x40')](handleError(_0x5828a2,null));}; \ No newline at end of file +var _0xfae2=['nolimit','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','Content-Range','apply','save','update','then','get','Companies','destroy','error','name','index','CmCompany','describe','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','offset','order','sort','where','pick','map','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addContacts','ids','getContacts','findOne','CmContact'];(function(_0x334c83,_0xe72805){var _0x109584=function(_0x35ba6e){while(--_0x35ba6e){_0x334c83['push'](_0x334c83['shift']());}};_0x109584(++_0xe72805);}(_0xfae2,0xf1));var _0x2fae=function(_0x3f8a03,_0x319b9c){_0x3f8a03=_0x3f8a03-0x0;var _0x147fb2=_0xfae2[_0x3f8a03];return _0x147fb2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2fae('0x0'));var rp=require(_0x2fae('0x1'));var moment=require('moment');var BPromise=require(_0x2fae('0x2'));var Mustache=require(_0x2fae('0x3'));var util=require(_0x2fae('0x4'));var path=require('path');var sox=require(_0x2fae('0x5'));var csv=require(_0x2fae('0x6'));var ejs=require(_0x2fae('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2fae('0x8'));var squel=require(_0x2fae('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2fae('0xa'));var toCsv=require(_0x2fae('0x6'));var querystring=require('querystring');var Papa=require(_0x2fae('0xb'));var Redis=require('ioredis');var authService=require(_0x2fae('0xc'));var qs=require(_0x2fae('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2fae('0xe'));var logger=require('../../config/logger')(_0x2fae('0xf'));var utils=require(_0x2fae('0x10'));var config=require(_0x2fae('0x11'));var licenseUtil=require(_0x2fae('0x12'));var db=require(_0x2fae('0x13'))['db'];function respondWithStatusCode(_0x56c3b7,_0x48d134){_0x48d134=_0x48d134||0xcc;return function(_0x2391bf){if(_0x2391bf){return _0x56c3b7[_0x2fae('0x14')](_0x48d134);}return _0x56c3b7[_0x2fae('0x15')](_0x48d134)[_0x2fae('0x16')]();};}function respondWithResult(_0x17aafa,_0x209035){_0x209035=_0x209035||0xc8;return function(_0x3819c7){if(_0x3819c7){return _0x17aafa[_0x2fae('0x15')](_0x209035)[_0x2fae('0x17')](_0x3819c7);}};}function respondWithFilteredResult(_0x3a3dad,_0x4883e8){return function(_0x178441){if(_0x178441){var _0xbc64fe=typeof _0x4883e8['offset']===_0x2fae('0x18')&&typeof _0x4883e8[_0x2fae('0x19')]===_0x2fae('0x18');var _0x3bf54f=_0x178441[_0x2fae('0x1a')];var _0x10021e=_0xbc64fe?0x0:_0x4883e8['offset'];var _0x5dc2e1=_0xbc64fe?_0x178441[_0x2fae('0x1a')]:_0x4883e8['offset']+_0x4883e8[_0x2fae('0x19')];var _0x34fe57;if(_0x5dc2e1>=_0x3bf54f){_0x5dc2e1=_0x3bf54f;_0x34fe57=0xc8;}else{_0x34fe57=0xce;}_0x3a3dad[_0x2fae('0x15')](_0x34fe57);return _0x3a3dad['set'](_0x2fae('0x1b'),_0x10021e+'-'+_0x5dc2e1+'/'+_0x3bf54f)[_0x2fae('0x17')](_0x178441);}return null;};}function patchUpdates(_0x5c7677){return function(_0x23773e){try{jsonpatch[_0x2fae('0x1c')](_0x23773e,_0x5c7677,!![]);}catch(_0x3d8a17){return BPromise['reject'](_0x3d8a17);}return _0x23773e[_0x2fae('0x1d')]();};}function saveUpdates(_0x3897c0,_0x400214){return function(_0x448945){if(_0x448945){return _0x448945[_0x2fae('0x1e')](_0x3897c0)[_0x2fae('0x1f')](function(_0x4b64a3){return _0x4b64a3;});}return null;};}function removeEntity(_0x46a8dd,_0x523613){return function(_0x59b5f3){if(_0x59b5f3){return _0x59b5f3['destroy']()[_0x2fae('0x1f')](function(){var _0x34b3bd=_0x59b5f3[_0x2fae('0x20')]({'plain':!![]});var _0x3fbb98=_0x2fae('0x21');return db['UserProfileResource'][_0x2fae('0x22')]({'where':{'type':_0x3fbb98,'resourceId':_0x34b3bd['id']}})[_0x2fae('0x1f')](function(){return _0x59b5f3;});})[_0x2fae('0x1f')](function(){_0x46a8dd[_0x2fae('0x15')](0xcc)[_0x2fae('0x16')]();});}};}function handleEntityNotFound(_0x9a2621,_0x35831f){return function(_0x537748){if(!_0x537748){_0x9a2621[_0x2fae('0x14')](0x194);}return _0x537748;};}function handleError(_0x5e8be6,_0x450da1){_0x450da1=_0x450da1||0x1f4;return function(_0x59c541){logger[_0x2fae('0x23')](_0x59c541['stack']);if(_0x59c541[_0x2fae('0x24')]){delete _0x59c541[_0x2fae('0x24')];}_0x5e8be6[_0x2fae('0x15')](_0x450da1)['send'](_0x59c541);};}exports[_0x2fae('0x25')]=function(_0x533ba6,_0x174ff8){var _0x48d315={},_0x22317d={},_0x4530a3={'count':0x0,'rows':[]};return db[_0x2fae('0x26')][_0x2fae('0x27')]()['then'](function(_0x5c45b0){_0x22317d[_0x2fae('0x28')]=_['keys'](_0x5c45b0);_0x22317d['query']=_[_0x2fae('0x29')](_0x533ba6[_0x2fae('0x2a')]);_0x22317d[_0x2fae('0x2b')]=_['intersection'](_0x22317d['model'],_0x22317d[_0x2fae('0x2a')]);_0x48d315[_0x2fae('0x2c')]=_[_0x2fae('0x2d')](_0x22317d[_0x2fae('0x28')],qs[_0x2fae('0x2e')](_0x533ba6[_0x2fae('0x2a')][_0x2fae('0x2e')]));_0x48d315['attributes']=_0x48d315[_0x2fae('0x2c')][_0x2fae('0x2f')]?_0x48d315[_0x2fae('0x2c')]:_0x22317d[_0x2fae('0x28')];if(!_0x533ba6[_0x2fae('0x2a')][_0x2fae('0x30')]('nolimit')){_0x48d315[_0x2fae('0x19')]=qs[_0x2fae('0x19')](_0x533ba6[_0x2fae('0x2a')][_0x2fae('0x19')]);_0x48d315['offset']=qs['offset'](_0x533ba6[_0x2fae('0x2a')][_0x2fae('0x31')]);}_0x48d315[_0x2fae('0x32')]=qs[_0x2fae('0x33')](_0x533ba6[_0x2fae('0x2a')][_0x2fae('0x33')]);_0x48d315[_0x2fae('0x34')]=qs[_0x2fae('0x2b')](_[_0x2fae('0x35')](_0x533ba6['query'],_0x22317d[_0x2fae('0x2b')]),_0x5c45b0);if(_0x533ba6[_0x2fae('0x2a')]['filter']){_0x48d315[_0x2fae('0x34')]=_['merge'](_0x48d315[_0x2fae('0x34')],{'$or':_[_0x2fae('0x36')](_0x48d315[_0x2fae('0x2c')],function(_0x150e7d){var _0x4f20cf={};_0x4f20cf[_0x150e7d]={'$like':'%'+_0x533ba6[_0x2fae('0x2a')][_0x2fae('0x37')]+'%'};return _0x4f20cf;})});}_0x48d315=_[_0x2fae('0x38')]({},_0x48d315,_0x533ba6[_0x2fae('0x39')]);var _0x7dde8e={'where':_0x48d315['where']};return db['CmCompany'][_0x2fae('0x1a')](_0x7dde8e)[_0x2fae('0x1f')](function(_0x8680fc){_0x4530a3[_0x2fae('0x1a')]=_0x8680fc;if(_0x533ba6[_0x2fae('0x2a')][_0x2fae('0x3a')]){_0x48d315[_0x2fae('0x3b')]=[{'all':!![]}];}return db[_0x2fae('0x26')][_0x2fae('0x3c')](_0x48d315);})[_0x2fae('0x1f')](function(_0x6a9f6){_0x4530a3[_0x2fae('0x3d')]=_0x6a9f6;return _0x4530a3;})['then'](respondWithFilteredResult(_0x174ff8,_0x48d315))[_0x2fae('0x3e')](handleError(_0x174ff8,null));})['catch'](handleError(_0x174ff8,null));};exports[_0x2fae('0x3f')]=function(_0x2c9ef9,_0x23722f){var _0x1dff4d={'raw':![],'where':{'id':_0x2c9ef9[_0x2fae('0x40')]['id']}},_0x4f57fe={};_0x4f57fe[_0x2fae('0x28')]=_[_0x2fae('0x29')](db[_0x2fae('0x26')][_0x2fae('0x41')]);_0x4f57fe[_0x2fae('0x2a')]=_[_0x2fae('0x29')](_0x2c9ef9[_0x2fae('0x2a')]);_0x4f57fe[_0x2fae('0x2b')]=_[_0x2fae('0x2d')](_0x4f57fe[_0x2fae('0x28')],_0x4f57fe[_0x2fae('0x2a')]);_0x1dff4d['attributes']=_[_0x2fae('0x2d')](_0x4f57fe[_0x2fae('0x28')],qs[_0x2fae('0x2e')](_0x2c9ef9[_0x2fae('0x2a')][_0x2fae('0x2e')]));_0x1dff4d[_0x2fae('0x2c')]=_0x1dff4d[_0x2fae('0x2c')][_0x2fae('0x2f')]?_0x1dff4d[_0x2fae('0x2c')]:_0x4f57fe[_0x2fae('0x28')];if(_0x2c9ef9[_0x2fae('0x2a')]['includeAll']){_0x1dff4d['include']=[{'all':!![]}];}_0x1dff4d=_[_0x2fae('0x38')]({},_0x1dff4d,_0x2c9ef9[_0x2fae('0x39')]);return db[_0x2fae('0x26')][_0x2fae('0x42')](_0x1dff4d)['then'](handleEntityNotFound(_0x23722f,null))['then'](respondWithResult(_0x23722f,null))[_0x2fae('0x3e')](handleError(_0x23722f,null));};exports[_0x2fae('0x43')]=function(_0x162e16,_0x41803c){return db[_0x2fae('0x26')][_0x2fae('0x43')](_0x162e16['body'],{})[_0x2fae('0x1f')](function(_0x466f1e){var _0x4ac416=_0x162e16[_0x2fae('0x44')][_0x2fae('0x20')]({'plain':!![]});if(!_0x4ac416)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ac416['role']===_0x2fae('0x44')){var _0x51e04a=_0x466f1e[_0x2fae('0x20')]({'plain':!![]});var _0x108fa4=_0x2fae('0x21');return db[_0x2fae('0x45')][_0x2fae('0x42')]({'where':{'name':_0x108fa4,'userProfileId':_0x4ac416[_0x2fae('0x46')]},'raw':!![]})[_0x2fae('0x1f')](function(_0x5835ae){if(_0x5835ae&&_0x5835ae[_0x2fae('0x47')]===0x0){return db['UserProfileResource']['create']({'name':_0x51e04a[_0x2fae('0x24')],'resourceId':_0x51e04a['id'],'type':_0x5835ae[_0x2fae('0x24')],'sectionId':_0x5835ae['id']},{})['then'](function(){return _0x466f1e;});}else{return _0x466f1e;}})[_0x2fae('0x3e')](function(_0x3434de){logger[_0x2fae('0x23')](_0x2fae('0x48'),_0x3434de);throw _0x3434de;});}return _0x466f1e;})[_0x2fae('0x1f')](respondWithResult(_0x41803c,0xc9))[_0x2fae('0x3e')](handleError(_0x41803c,null));};exports[_0x2fae('0x1e')]=function(_0x331369,_0x209ff7){if(_0x331369[_0x2fae('0x49')]['id']){delete _0x331369['body']['id'];}return db[_0x2fae('0x26')][_0x2fae('0x42')]({'where':{'id':_0x331369[_0x2fae('0x40')]['id']}})[_0x2fae('0x1f')](handleEntityNotFound(_0x209ff7,null))['then'](saveUpdates(_0x331369[_0x2fae('0x49')],null))[_0x2fae('0x1f')](respondWithResult(_0x209ff7,null))[_0x2fae('0x3e')](handleError(_0x209ff7,null));};exports['destroy']=function(_0x5db8b1,_0x57e590){return db[_0x2fae('0x26')][_0x2fae('0x42')]({'where':{'id':_0x5db8b1[_0x2fae('0x40')]['id']}})[_0x2fae('0x1f')](handleEntityNotFound(_0x57e590,null))[_0x2fae('0x1f')](removeEntity(_0x57e590,null))[_0x2fae('0x3e')](handleError(_0x57e590,null));};exports[_0x2fae('0x27')]=function(_0x126629,_0x10f720){return db['CmCompany'][_0x2fae('0x27')]()[_0x2fae('0x1f')](respondWithResult(_0x10f720,null))[_0x2fae('0x3e')](handleError(_0x10f720,null));};exports[_0x2fae('0x4a')]=function(_0x1a617b,_0x1db542,_0x5e9372){return db['CmContact'][_0x2fae('0x42')]({'where':{'id':_0x1a617b[_0x2fae('0x40')]['id']}})['then'](handleEntityNotFound(_0x1db542,null))[_0x2fae('0x1f')](function(_0x49bb63){if(_0x49bb63){return _0x49bb63[_0x2fae('0x4a')](_0x1a617b[_0x2fae('0x49')][_0x2fae('0x4b')],_['omit'](_0x1a617b['body'],[_0x2fae('0x4b'),'id'])||{});}})[_0x2fae('0x1f')](respondWithResult(_0x1db542,null))['catch'](handleError(_0x1db542,null));};exports[_0x2fae('0x4c')]=function(_0x382c8f,_0xa293e1,_0x3614f4){var _0x46f98a={};var _0x299ff5={};var _0x50647f;var _0x1b096c;return db[_0x2fae('0x26')][_0x2fae('0x4d')]({'where':{'id':_0x382c8f[_0x2fae('0x40')]['id']}})[_0x2fae('0x1f')](handleEntityNotFound(_0xa293e1,null))[_0x2fae('0x1f')](function(_0x1f689b){if(_0x1f689b){_0x50647f=_0x1f689b;_0x299ff5[_0x2fae('0x28')]=_[_0x2fae('0x29')](db[_0x2fae('0x4e')]['rawAttributes']);_0x299ff5[_0x2fae('0x2a')]=_[_0x2fae('0x29')](_0x382c8f['query']);_0x299ff5[_0x2fae('0x2b')]=_[_0x2fae('0x2d')](_0x299ff5[_0x2fae('0x28')],_0x299ff5[_0x2fae('0x2a')]);_0x46f98a[_0x2fae('0x2c')]=_[_0x2fae('0x2d')](_0x299ff5[_0x2fae('0x28')],qs[_0x2fae('0x2e')](_0x382c8f[_0x2fae('0x2a')]['fields']));_0x46f98a[_0x2fae('0x2c')]=_0x46f98a[_0x2fae('0x2c')]['length']?_0x46f98a[_0x2fae('0x2c')]:_0x299ff5[_0x2fae('0x28')];_0x46f98a[_0x2fae('0x32')]=qs[_0x2fae('0x33')](_0x382c8f['query'][_0x2fae('0x33')]);_0x46f98a[_0x2fae('0x34')]=qs[_0x2fae('0x2b')](_[_0x2fae('0x35')](_0x382c8f[_0x2fae('0x2a')],_0x299ff5[_0x2fae('0x2b')]));if(_0x382c8f[_0x2fae('0x2a')][_0x2fae('0x37')]){_0x46f98a[_0x2fae('0x34')]=_[_0x2fae('0x38')](_0x46f98a[_0x2fae('0x34')],{'$or':_['map'](_0x46f98a[_0x2fae('0x2c')],function(_0x4b1de6){var _0x502ee4={};_0x502ee4[_0x4b1de6]={'$like':'%'+_0x382c8f[_0x2fae('0x2a')][_0x2fae('0x37')]+'%'};return _0x502ee4;})});}_0x46f98a=_[_0x2fae('0x38')]({},_0x46f98a,_0x382c8f[_0x2fae('0x39')]);return _0x50647f[_0x2fae('0x4c')](_0x46f98a);}})['then'](function(_0x1d9022){if(_0x1d9022){_0x1b096c=_0x1d9022[_0x2fae('0x2f')];if(!_0x382c8f['query'][_0x2fae('0x30')](_0x2fae('0x4f'))){_0x46f98a[_0x2fae('0x19')]=qs[_0x2fae('0x19')](_0x382c8f['query'][_0x2fae('0x19')]);_0x46f98a[_0x2fae('0x31')]=qs['offset'](_0x382c8f[_0x2fae('0x2a')][_0x2fae('0x31')]);}return _0x50647f[_0x2fae('0x4c')](_0x46f98a);}})[_0x2fae('0x1f')](function(_0x3906ff){if(_0x3906ff){return _0x3906ff?{'count':_0x1b096c,'rows':_0x3906ff}:null;}})[_0x2fae('0x1f')](respondWithResult(_0xa293e1,null))['catch'](handleError(_0xa293e1,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 5970185..cd42ef3 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 _0x34cd=['request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','define','CmCompany','lodash','../../config/logger','api','bluebird'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x34cd,0x188));var _0xd34c=function(_0x4b457c,_0x24e826){_0x4b457c=_0x4b457c-0x0;var _0x4105b5=_0x34cd[_0x4b457c];return _0x4105b5;};'use strict';var _=require(_0xd34c('0x0'));var util=require('util');var logger=require(_0xd34c('0x1'))(_0xd34c('0x2'));var moment=require('moment');var BPromise=require(_0xd34c('0x3'));var rp=require(_0xd34c('0x4'));var fs=require('fs');var path=require(_0xd34c('0x5'));var rimraf=require(_0xd34c('0x6'));var config=require(_0xd34c('0x7'));var attributes=require(_0xd34c('0x8'));module['exports']=function(_0x3c1856,_0xa983c1){return _0x3c1856[_0xd34c('0x9')](_0xd34c('0xa'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd8d=['request-promise','rimraf','./cmCompany.attributes','define','cm_companies','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3df223,_0x1740fc){var _0x562d11=function(_0x343009){while(--_0x343009){_0x3df223['push'](_0x3df223['shift']());}};_0x562d11(++_0x1740fc);}(_0xdd8d,0x1bd));var _0xddd8=function(_0x249e96,_0x3ea39d){_0x249e96=_0x249e96-0x0;var _0x17444c=_0xdd8d[_0x249e96];return _0x17444c;};'use strict';var _=require(_0xddd8('0x0'));var util=require(_0xddd8('0x1'));var logger=require(_0xddd8('0x2'))(_0xddd8('0x3'));var moment=require(_0xddd8('0x4'));var BPromise=require(_0xddd8('0x5'));var rp=require(_0xddd8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xddd8('0x7'));var config=require('../../config/environment');var attributes=require(_0xddd8('0x8'));module['exports']=function(_0x92402a,_0x294ab0){return _0x92402a[_0xddd8('0x9')]('CmCompany',attributes,{'tableName':_0xddd8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 535b1c7..d529c20 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 _0x372b=['request','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x385d87,_0x2e44b2){var _0x56969c=function(_0x2978fa){while(--_0x2978fa){_0x385d87['push'](_0x385d87['shift']());}};_0x56969c(++_0x2e44b2);}(_0x372b,0x110));var _0xb372=function(_0x1094f2,_0xfa56f4){_0x1094f2=_0x1094f2-0x0;var _0x385abf=_0x372b[_0x1094f2];return _0x385abf;};'use strict';var _=require(_0xb372('0x0'));var util=require(_0xb372('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb372('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb372('0x3'))(_0xb372('0x4'));var config=require('../../config/environment');var jayson=require(_0xb372('0x5'));var client=jayson[_0xb372('0x6')][_0xb372('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5b0729,_0x499e8e,_0x6266f7){return new BPromise(function(_0x1d0236,_0x516c04){return client[_0xb372('0x8')](_0x5b0729,_0x6266f7)['then'](function(_0x30bb39){logger[_0xb372('0x9')](_0xb372('0xa'),_0x499e8e,_0xb372('0xb'));logger[_0xb372('0xc')](_0xb372('0xd'),_0x499e8e,'request\x20sent',JSON[_0xb372('0xe')](_0x30bb39));if(_0x30bb39['error']){if(_0x30bb39[_0xb372('0xf')][_0xb372('0x10')]===0x1f4){logger[_0xb372('0xf')](_0xb372('0xa'),_0x499e8e,_0x30bb39[_0xb372('0xf')]['message']);return _0x516c04(_0x30bb39[_0xb372('0xf')]['message']);}logger[_0xb372('0xf')](_0xb372('0xa'),_0x499e8e,_0x30bb39[_0xb372('0xf')][_0xb372('0x11')]);return _0x1d0236(_0x30bb39[_0xb372('0xf')][_0xb372('0x11')]);}else{logger[_0xb372('0x9')](_0xb372('0xa'),_0x499e8e,_0xb372('0xb'));_0x1d0236(_0x30bb39[_0xb372('0x12')][_0xb372('0x11')]);}})[_0xb372('0x13')](function(_0x2781b4){logger[_0xb372('0xf')](_0xb372('0xa'),_0x499e8e,_0x2781b4);_0x516c04(_0x2781b4);});});} \ No newline at end of file +var _0xfe9b=['rpc','../../config/environment','jayson/promise','http','then','info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xfe9b,0x10c));var _0xbfe9=function(_0x53ae5d,_0x227b13){_0x53ae5d=_0x53ae5d-0x0;var _0x323505=_0xfe9b[_0x53ae5d];return _0x323505;};'use strict';var _=require(_0xbfe9('0x0'));var util=require(_0xbfe9('0x1'));var moment=require('moment');var BPromise=require(_0xbfe9('0x2'));var rs=require(_0xbfe9('0x3'));var fs=require('fs');var Redis=require(_0xbfe9('0x4'));var db=require(_0xbfe9('0x5'))['db'];var utils=require(_0xbfe9('0x6'));var logger=require(_0xbfe9('0x7'))(_0xbfe9('0x8'));var config=require(_0xbfe9('0x9'));var jayson=require(_0xbfe9('0xa'));var client=jayson['client'][_0xbfe9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4022fd,_0x252cc8,_0x11e2d4){return new BPromise(function(_0x88c22b,_0x1cf60c){return client['request'](_0x4022fd,_0x11e2d4)[_0xbfe9('0xc')](function(_0x73bea7){logger[_0xbfe9('0xd')](_0xbfe9('0xe'),_0x252cc8,'request\x20sent');logger[_0xbfe9('0xf')](_0xbfe9('0x10'),_0x252cc8,_0xbfe9('0x11'),JSON[_0xbfe9('0x12')](_0x73bea7));if(_0x73bea7[_0xbfe9('0x13')]){if(_0x73bea7['error']['code']===0x1f4){logger['error'](_0xbfe9('0xe'),_0x252cc8,_0x73bea7[_0xbfe9('0x13')][_0xbfe9('0x14')]);return _0x1cf60c(_0x73bea7['error'][_0xbfe9('0x14')]);}logger['error'](_0xbfe9('0xe'),_0x252cc8,_0x73bea7[_0xbfe9('0x13')]['message']);return _0x88c22b(_0x73bea7[_0xbfe9('0x13')][_0xbfe9('0x14')]);}else{logger[_0xbfe9('0xd')](_0xbfe9('0xe'),_0x252cc8,_0xbfe9('0x11'));_0x88c22b(_0x73bea7[_0xbfe9('0x15')]['message']);}})[_0xbfe9('0x16')](function(_0x3e6ed8){logger['error']('CmCompany,\x20%s,\x20%s',_0x252cc8,_0x3e6ed8);_0x1cf60c(_0x3e6ed8);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index ea25785..486eb6f 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 _0xf045=['create','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','show','/:id/contacts','getContacts','post'];(function(_0x178668,_0x1ec300){var _0x26107d=function(_0x4c0aa8){while(--_0x4c0aa8){_0x178668['push'](_0x178668['shift']());}};_0x26107d(++_0x1ec300);}(_0xf045,0x192));var _0x5f04=function(_0x34dfc6,_0x533486){_0x34dfc6=_0x34dfc6-0x0;var _0x2d24da=_0xf045[_0x34dfc6];return _0x2d24da;};'use strict';var multer=require(_0x5f04('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5f04('0x1'));var express=require(_0x5f04('0x2'));var router=express[_0x5f04('0x3')]();var fs_extra=require(_0x5f04('0x4'));var auth=require(_0x5f04('0x5'));var interaction=require(_0x5f04('0x6'));var config=require(_0x5f04('0x7'));var controller=require(_0x5f04('0x8'));router[_0x5f04('0x9')]('/',auth[_0x5f04('0xa')](),controller[_0x5f04('0xb')]);router[_0x5f04('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x5f04('0xa')](),controller[_0x5f04('0xc')]);router[_0x5f04('0x9')](_0x5f04('0xd'),auth[_0x5f04('0xa')](),controller[_0x5f04('0xe')]);router[_0x5f04('0xf')]('/',auth['isAuthenticated'](),controller[_0x5f04('0x10')]);router[_0x5f04('0xf')](_0x5f04('0xd'),auth[_0x5f04('0xa')](),controller['addContacts']);router['put'](_0x5f04('0x11'),auth[_0x5f04('0xa')](),controller[_0x5f04('0x12')]);router[_0x5f04('0x13')](_0x5f04('0x11'),auth['isAuthenticated'](),controller[_0x5f04('0x14')]);module[_0x5f04('0x15')]=router; \ No newline at end of file +var _0x74a9=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/contacts','getContacts','post','create','/:id','update','delete'];(function(_0x523d69,_0x34cec7){var _0x260fc2=function(_0x28bbcb){while(--_0x28bbcb){_0x523d69['push'](_0x523d69['shift']());}};_0x260fc2(++_0x34cec7);}(_0x74a9,0xc2));var _0x974a=function(_0x1fc1f9,_0x454fb2){_0x1fc1f9=_0x1fc1f9-0x0;var _0x4987ca=_0x74a9[_0x1fc1f9];return _0x4987ca;};'use strict';var multer=require(_0x974a('0x0'));var util=require(_0x974a('0x1'));var path=require(_0x974a('0x2'));var timeout=require(_0x974a('0x3'));var express=require(_0x974a('0x4'));var router=express[_0x974a('0x5')]();var fs_extra=require(_0x974a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x974a('0x7'));var config=require(_0x974a('0x8'));var controller=require('./cmCompany.controller');router[_0x974a('0x9')]('/',auth[_0x974a('0xa')](),controller[_0x974a('0xb')]);router[_0x974a('0x9')](_0x974a('0xc'),auth['isAuthenticated'](),controller[_0x974a('0xd')]);router[_0x974a('0x9')]('/:id',auth[_0x974a('0xa')](),controller[_0x974a('0xe')]);router['get'](_0x974a('0xf'),auth[_0x974a('0xa')](),controller[_0x974a('0x10')]);router[_0x974a('0x11')]('/',auth[_0x974a('0xa')](),controller[_0x974a('0x12')]);router[_0x974a('0x11')](_0x974a('0xf'),auth[_0x974a('0xa')](),controller['addContacts']);router['put'](_0x974a('0x13'),auth[_0x974a('0xa')](),controller[_0x974a('0x14')]);router[_0x974a('0x15')]('/:id',auth[_0x974a('0xa')](),controller[_0x974a('0x16')]);module[_0x974a('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index d1ce92d..471c73e 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 _0xb10b=['TEXT','INTEGER','UNSIGNED','DATE','lodash','exports','STRING'];(function(_0x310cab,_0x23f98e){var _0x177b44=function(_0x3761cb){while(--_0x3761cb){_0x310cab['push'](_0x310cab['shift']());}};_0x177b44(++_0x23f98e);}(_0xb10b,0x12a));var _0xbb10=function(_0x5811e5,_0x946ee2){_0x5811e5=_0x5811e5-0x0;var _0x1642da=_0xb10b[_0x5811e5];return _0x1642da;};'use strict';var _=require(_0xbb10('0x0'));var Sequelize=require('sequelize');module[_0xbb10('0x1')]={'firstName':{'type':Sequelize[_0xbb10('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xbb10('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xbb10('0x2')]},'city':{'type':Sequelize[_0xbb10('0x2')]},'country':{'type':Sequelize[_0xbb10('0x2')]},'dateOfBirth':{'type':Sequelize[_0xbb10('0x2')]},'description':{'type':Sequelize[_0xbb10('0x3')]},'phone':{'type':Sequelize[_0xbb10('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xbb10('0x2')]},'email':{'type':Sequelize[_0xbb10('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xbb10('0x2')]},'fb_data':{'type':Sequelize[_0xbb10('0x2')]},'twitter':{'type':Sequelize[_0xbb10('0x2')]},'skype':{'type':Sequelize[_0xbb10('0x2')]},'teams':{'type':Sequelize[_0xbb10('0x2')]},'viber':{'type':Sequelize[_0xbb10('0x2')]},'line':{'type':Sequelize[_0xbb10('0x2')]},'wechat':{'type':Sequelize[_0xbb10('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0xbb10('0x4')](0x2)[_0xbb10('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xbb10('0x6')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0xbb10('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x757a=['STRING','TEXT','INTEGER','UNSIGNED','DATE','sequelize','exports'];(function(_0xd93b26,_0x12bbf2){var _0x25f668=function(_0x133ff7){while(--_0x133ff7){_0xd93b26['push'](_0xd93b26['shift']());}};_0x25f668(++_0x12bbf2);}(_0x757a,0xde));var _0xa757=function(_0x3f934d,_0x34ead4){_0x3f934d=_0x3f934d-0x0;var _0x24fae2=_0x757a[_0x3f934d];return _0x24fae2;};'use strict';var _=require('lodash');var Sequelize=require(_0xa757('0x0'));module[_0xa757('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xa757('0x2')]},'city':{'type':Sequelize[_0xa757('0x2')]},'country':{'type':Sequelize[_0xa757('0x2')]},'dateOfBirth':{'type':Sequelize[_0xa757('0x2')]},'description':{'type':Sequelize[_0xa757('0x3')]},'phone':{'type':Sequelize[_0xa757('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xa757('0x2')]},'email':{'type':Sequelize[_0xa757('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xa757('0x2')]},'fb_data':{'type':Sequelize[_0xa757('0x2')]},'twitter':{'type':Sequelize[_0xa757('0x2')]},'skype':{'type':Sequelize[_0xa757('0x2')]},'teams':{'type':Sequelize[_0xa757('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xa757('0x2')]},'wechat':{'type':Sequelize[_0xa757('0x2')]},'telegram':{'type':Sequelize[_0xa757('0x2')]},'UserId':{'type':Sequelize[_0xa757('0x4')]},'priority':{'type':Sequelize[_0xa757('0x4')](0x2)[_0xa757('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xa757('0x6')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 0379670..c9d3138 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 _0xa5d2=['left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','find','field','Tag','value','split','forEach','union','User','and','uc.UserId\x20=\x20?','dateOfBirth','datetime','DATE','buildExpression','text','start','map','filter','isNil','Contact','push','isEmpty','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','c.id','Sequelize','QueryTypes','SELECT','order','having','t.id\x20IN\x20?','resolve','user','agent','some','getLists','c.ListId\x20IS\x20NULL','toString','sequelize','keyBy','c.firstName','c.phone','c.mobile','c.fax','c.email','c.ListId','c.createdAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','tags','startsWith','columnName','displayName','analytics','alias','values','merge','body','findAll','get','mergeWith','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','utcOffset','timezones','each','duplicates','$or','ListId','findOrCreate','spread','show','$and','format','cf_%d','params','omit','pickBy','table','cm_contacts','setFields','id\x20=\x20?','toParam','phone','getTags','findOne','rawAttributes','options','setTags','getHoppers','ContactId','include','includeAll','getHopperFinals','JscriptySessionReport','uploadCsv','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','chmodSync','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','upload','createReadStream','file','path','parse','meta','import','No\x20ListId\x20specified','../../components/import/cm/csv2','message','pid','exit','error\x20child\x20process','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','channel','toLowerCase','range','isValid','source','destination','starttime','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','DESC','Website','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','key','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','mail','subject','substatus','startCase','Interaction','findAndCountAll','Owner','flatten','sortBy','reverse','slice','moment','squel','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','status','json','offset','undefined','count','set','update','then','destroy','end','sendStatus','error','stack','name','send','index','CmContact','describe','length','keys','cf_','CmCustomField','trimStart','all','fieldType','type','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','filters','pick','color','from','tools_tags','select'];(function(_0x2b7577,_0x422c99){var _0x1a7c9b=function(_0x386a67){while(--_0x386a67){_0x2b7577['push'](_0x2b7577['shift']());}};_0x1a7c9b(++_0x422c99);}(_0xa5d2,0xe7));var _0x2a5d=function(_0x265fbf,_0x401471){_0x265fbf=_0x265fbf-0x0;var _0x2d6bf8=_0xa5d2[_0x265fbf];return _0x2d6bf8;};'use strict';var moment=require(_0x2a5d('0x0'));var BPromise=require('bluebird');var util=require('util');var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x2a5d('0x1'));var Papa=require(_0x2a5d('0x2'));var Redis=require(_0x2a5d('0x3'));var qs=require(_0x2a5d('0x4'));var as=require(_0x2a5d('0x5'));var logger=require('../../config/logger')(_0x2a5d('0x6'));var config=require(_0x2a5d('0x7'));var shared=require(_0x2a5d('0x8'));var db=require(_0x2a5d('0x9'))['db'];config[_0x2a5d('0xa')]=_[_0x2a5d('0xb')](config[_0x2a5d('0xa')],{'host':_0x2a5d('0xc'),'port':0x18eb});var socket=require(_0x2a5d('0xd'))(new Redis(config[_0x2a5d('0xa')]));require(_0x2a5d('0xe'))[_0x2a5d('0xf')](socket);function respondWithResult(_0x803f1d,_0x28fcbe){_0x28fcbe=_0x28fcbe||0xc8;return function(_0x337e2d){if(_0x337e2d){return _0x803f1d[_0x2a5d('0x10')](_0x28fcbe)[_0x2a5d('0x11')](_0x337e2d);}};}function respondWithFilteredResult(_0xa992d6,_0x236108){return function(_0x5dd875){if(_0x5dd875){var _0x2ae71b=typeof _0x236108[_0x2a5d('0x12')]===_0x2a5d('0x13')&&typeof _0x236108['limit']===_0x2a5d('0x13');var _0x42f7e5=_0x5dd875['count'];var _0x5f4722=_0x2ae71b?0x0:_0x236108[_0x2a5d('0x12')];var _0x342999=_0x2ae71b?_0x5dd875[_0x2a5d('0x14')]:_0x236108[_0x2a5d('0x12')]+_0x236108['limit'];var _0x4ef1ce;if(_0x342999>=_0x42f7e5){_0x342999=_0x42f7e5;_0x4ef1ce=0xc8;}else{_0x4ef1ce=0xce;}_0xa992d6[_0x2a5d('0x10')](_0x4ef1ce);return _0xa992d6[_0x2a5d('0x15')]('Content-Range',_0x5f4722+'-'+_0x342999+'/'+_0x42f7e5)[_0x2a5d('0x11')](_0x5dd875);}return null;};}function saveUpdates(_0x182535){return function(_0xbabaf5){if(_0xbabaf5){return _0xbabaf5[_0x2a5d('0x16')](_0x182535)[_0x2a5d('0x17')](function(_0x316193){return _0x316193;});}return null;};}function removeEntity(_0x9a12ad){return function(_0x506f07){if(_0x506f07){return _0x506f07[_0x2a5d('0x18')]()[_0x2a5d('0x17')](function(){_0x9a12ad[_0x2a5d('0x10')](0xcc)[_0x2a5d('0x19')]();});}};}function handleEntityNotFound(_0x491eb5){return function(_0x2cee86){if(!_0x2cee86){_0x491eb5[_0x2a5d('0x1a')](0x194);}return _0x2cee86;};}function handleError(_0x54234c,_0x5daa54){_0x5daa54=_0x5daa54||0x1f4;return function(_0x39cf3f){logger[_0x2a5d('0x1b')](_0x39cf3f[_0x2a5d('0x1c')]);if(_0x39cf3f[_0x2a5d('0x1d')]){delete _0x39cf3f['name'];}_0x54234c[_0x2a5d('0x10')](_0x5daa54)[_0x2a5d('0x1e')](_0x39cf3f);};}exports[_0x2a5d('0x1f')]=function(_0x3d1f66,_0x23ba1e){var _0x321f14={},_0x18f3f5={},_0x5eef6b={'count':0x0,'rows':[]};return db[_0x2a5d('0x20')][_0x2a5d('0x21')]()['then'](function(_0x5c87c3){var _0x297c1e=[];for(var _0x37bef0=0x0;_0x37bef00x1){_0xa57602['or'](_0x2a5d('0x61'),qs[_0x2a5d('0x62')](_0x813c29),null);}else{if(qs['isNumeric'](_0x813c29)){_0xa57602['or'](_0x2a5d('0x63'),_0x813c29+'%');_0xa57602['or'](_0x2a5d('0x64'),_0x813c29+'%');_0xa57602['or']('c.mobile\x20LIKE\x20?',_0x813c29+'%');_0xa57602['or'](_0x2a5d('0x65'),_0x813c29+'%');}else if(qs[_0x2a5d('0x66')](_0x813c29)){_0xa57602['or']('c.email\x20LIKE\x20?',_0x813c29+'%');}else{_0xa57602['or'](_0x2a5d('0x67'),'%'+_0x813c29+'%');_0xa57602['or'](_0x2a5d('0x68'),'%'+_0x813c29+'%');_0xa57602['or'](_0x2a5d('0x69'),'%'+_0x813c29+'%');}}}}_0x2094af['where'](_0xa57602);_0x2094af['group'](_0x2a5d('0x6a'));var _0x5b423d={'type':db[_0x2a5d('0x6b')][_0x2a5d('0x6c')][_0x2a5d('0x6d')],'raw':!![]};var _0x27ed54=_0x2094af['clone']()[_0x2a5d('0x46')]('c.id');if(_0x321f14[_0x2a5d('0x6e')]){_0x321f14[_0x2a5d('0x6e')][_0x2a5d('0x4a')](function(_0xb0a58d){_0x2094af['order']('c.'+_0xb0a58d[0x0],_0xb0a58d[0x1]==='DESC'?![]:!![]);});}if(!_[_0x2a5d('0x5a')](_0x5124ba)){_0x2094af[_0x2a5d('0x6f')](_0x5e167a);_0x27ed54[_0x2a5d('0x33')](_0x2a5d('0x70'),_0x5124ba);}BPromise[_0x2a5d('0x71')]()['then'](function(){if(!_0x342517)return;if(_0x3d1f66[_0x2a5d('0x72')]['role']!==_0x2a5d('0x73'))return;if(!_[_0x2a5d('0x74')](_0x342517[_0x2a5d('0x44')],[_0x2a5d('0x46'),_0x2a5d('0x4c')])){return _0x3d1f66[_0x2a5d('0x72')][_0x2a5d('0x75')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5391a8){if(_[_0x2a5d('0x5a')](_0x5391a8)){_0x27ed54[_0x2a5d('0x33')](_0x2a5d('0x76'));_0x2094af[_0x2a5d('0x33')](_0x2a5d('0x76'));}else{_0x27ed54[_0x2a5d('0x33')](_0x2a5d('0x5b'),_['map'](_0x5391a8,'id'));_0x2094af['where']('c.ListId\x20IN\x20?',_[_0x2a5d('0x55')](_0x5391a8,'id'));}});}})[_0x2a5d('0x17')](function(){if(_0x3d1f66[_0x2a5d('0x72')]['role']===_0x2a5d('0x73')&&!_0x342517&&!_0x3d1f66[_0x2a5d('0x2b')]['ListId'])return[];return db['sequelize'][_0x2a5d('0x2b')](_0x27ed54[_0x2a5d('0x77')](),_0x5b423d);})[_0x2a5d('0x17')](function(_0x2f6a6f){_0x5eef6b[_0x2a5d('0x14')]=_0x2f6a6f['length'];if(_0x5eef6b['count']===0x0)return[];return db[_0x2a5d('0x78')]['query'](_0x445863[_0x2a5d('0x77')](),_0x5b423d)[_0x2a5d('0x17')](function(_0x379989){_0x27978=_[_0x2a5d('0x79')](_0x379989,'id');_0x5b423d=_['merge'](_0x5b423d,{'model':db[_0x2a5d('0x20')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3d1f66[_0x2a5d('0x2b')][_0x2a5d('0x2d')]){_0x321f14['attributes']['forEach'](function(_0x49067e){_0x2094af[_0x2a5d('0x46')]('c.'+_0x49067e);});}else{_0x2094af[_0x2a5d('0x46')]('c.id');_0x2094af[_0x2a5d('0x46')](_0x2a5d('0x7a'));_0x2094af['field']('c.lastName');_0x2094af[_0x2a5d('0x46')](_0x2a5d('0x7b'));_0x2094af[_0x2a5d('0x46')](_0x2a5d('0x7c'));_0x2094af[_0x2a5d('0x46')](_0x2a5d('0x7d'));_0x2094af['field'](_0x2a5d('0x7e'));_0x2094af[_0x2a5d('0x46')](_0x2a5d('0x7f'));_0x2094af[_0x2a5d('0x46')](_0x2a5d('0x80'));_0x2094af[_0x2a5d('0x46')]('c.deletedAt');_0x2094af[_0x2a5d('0x46')](_0x2a5d('0x81'));_0x2094af[_0x2a5d('0x46')](_0x2a5d('0x82'),'TagIds');}if(_0x321f14[_0x2a5d('0x31')])_0x2094af[_0x2a5d('0x31')](_0x321f14[_0x2a5d('0x31')]);if(_0x321f14['offset'])_0x2094af[_0x2a5d('0x12')](_0x321f14[_0x2a5d('0x12')]);return db['sequelize'][_0x2a5d('0x2b')](_0x2094af[_0x2a5d('0x77')](),_0x5b423d);});})['then'](function(_0x4a5503){_0x4a5503[_0x2a5d('0x4a')](function(_0x2c321d){if(_0x2c321d[_0x2a5d('0x83')]){_0x2c321d[_0x2a5d('0x84')]=[];_0x2c321d['TagIds']['split'](',')[_0x2a5d('0x4a')](function(_0x3a44ca){_0x2c321d[_0x2a5d('0x84')][_0x2a5d('0x59')](_0x27978[_0x3a44ca]);});}delete _0x2c321d['TagIds'];});_0x5eef6b[_0x2a5d('0x85')]=_0x4a5503;return _0x5eef6b;})[_0x2a5d('0x17')](respondWithFilteredResult(_0x23ba1e,_0x321f14));})[_0x2a5d('0x86')](handleError(_0x23ba1e,null));};exports['destroy']=function(_0x46490b,_0x16f3be){return db[_0x2a5d('0x20')][_0x2a5d('0x45')]({'where':{'id':_0x46490b['params']['id']}})['then'](handleEntityNotFound(_0x16f3be,null))[_0x2a5d('0x17')](removeEntity(_0x16f3be,null))[_0x2a5d('0x86')](handleError(_0x16f3be,null));};exports[_0x2a5d('0x21')]=function(_0x359864,_0x1995e8){return db[_0x2a5d('0x20')]['describe']()[_0x2a5d('0x17')](function(_0x228aaf){delete _0x228aaf[_0x2a5d('0x87')];for(var _0x9a8516=0x0;_0x9a8516=_0x5a0c03){_0x256b73=_0x5a0c03;_0x5e592e=0xc8;}else{_0x5e592e=0xce;}_0x5ed86e[_0x0640('0xf')](_0x5e592e);return _0x5ed86e['set'](_0x0640('0x15'),_0x432437+'-'+_0x256b73+'/'+_0x5a0c03)[_0x0640('0x10')](_0x378f75);}return null;};}function saveUpdates(_0x38843b){return function(_0x15ed3a){if(_0x15ed3a){return _0x15ed3a[_0x0640('0x16')](_0x38843b)[_0x0640('0x17')](function(_0xe5a079){return _0xe5a079;});}return null;};}function removeEntity(_0x3f43ac){return function(_0x37b2f3){if(_0x37b2f3){return _0x37b2f3[_0x0640('0x18')]()['then'](function(){_0x3f43ac[_0x0640('0xf')](0xcc)[_0x0640('0x19')]();});}};}function handleEntityNotFound(_0x3b0b18){return function(_0xa01af1){if(!_0xa01af1){_0x3b0b18[_0x0640('0x1a')](0x194);}return _0xa01af1;};}function handleError(_0x532fb0,_0x46e1f3){_0x46e1f3=_0x46e1f3||0x1f4;return function(_0x2ac318){logger['error'](_0x2ac318[_0x0640('0x1b')]);if(_0x2ac318[_0x0640('0x1c')]){delete _0x2ac318[_0x0640('0x1c')];}_0x532fb0[_0x0640('0xf')](_0x46e1f3)[_0x0640('0x1d')](_0x2ac318);};}exports[_0x0640('0x1e')]=function(_0x428766,_0x1a94e1){var _0x6064f2={},_0x5d6935={},_0x3793ac={'count':0x0,'rows':[]};return db[_0x0640('0x1f')][_0x0640('0x20')]()[_0x0640('0x17')](function(_0xd8054c){var _0x1d0b3c=[];for(var _0x30d202=0x0;_0x30d2020x1){_0x4b856a['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0640('0x61')](_0x17e1e3),null);}else{if(qs['isNumeric'](_0x17e1e3)){_0x4b856a['or'](_0x0640('0x62'),_0x17e1e3+'%');_0x4b856a['or'](_0x0640('0x63'),_0x17e1e3+'%');_0x4b856a['or'](_0x0640('0x64'),_0x17e1e3+'%');_0x4b856a['or'](_0x0640('0x65'),_0x17e1e3+'%');}else if(qs[_0x0640('0x66')](_0x17e1e3)){_0x4b856a['or'](_0x0640('0x67'),_0x17e1e3+'%');}else{_0x4b856a['or'](_0x0640('0x68'),'%'+_0x17e1e3+'%');_0x4b856a['or'](_0x0640('0x69'),'%'+_0x17e1e3+'%');_0x4b856a['or'](_0x0640('0x67'),'%'+_0x17e1e3+'%');}}}}_0x396abc[_0x0640('0x33')](_0x4b856a);_0x396abc[_0x0640('0x6a')]('c.id');var _0x3912df={'type':db[_0x0640('0x6b')][_0x0640('0x6c')][_0x0640('0x6d')],'raw':!![]};var _0x5f4a92=_0x396abc['clone']()[_0x0640('0x37')](_0x0640('0x6e'));if(_0x6064f2[_0x0640('0x6f')]){_0x6064f2[_0x0640('0x6f')]['forEach'](function(_0x548c97){_0x396abc[_0x0640('0x6f')]('c.'+_0x548c97[0x0],_0x548c97[0x1]===_0x0640('0x70')?![]:!![]);});}if(!_[_0x0640('0x5a')](_0x219a9a)){_0x396abc['having'](_0x1f59c6);_0x5f4a92[_0x0640('0x33')](_0x0640('0x71'),_0x219a9a);}BPromise[_0x0640('0x72')]()[_0x0640('0x17')](function(){if(!_0x134305)return;if(_0x428766[_0x0640('0x73')][_0x0640('0x74')]!==_0x0640('0x75'))return;if(!_[_0x0640('0x76')](_0x134305['conditions'],[_0x0640('0x37'),_0x0640('0x77')])){return _0x428766[_0x0640('0x73')]['getLists']({'attributes':['id'],'raw':!![]})[_0x0640('0x17')](function(_0x13dca7){if(_['isEmpty'](_0x13dca7)){_0x5f4a92[_0x0640('0x33')]('c.ListId\x20IS\x20NULL');_0x396abc['where']('c.ListId\x20IS\x20NULL');}else{_0x5f4a92[_0x0640('0x33')](_0x0640('0x5c'),_[_0x0640('0x49')](_0x13dca7,'id'));_0x396abc[_0x0640('0x33')](_0x0640('0x5c'),_['map'](_0x13dca7,'id'));}});}})[_0x0640('0x17')](function(){if(_0x428766[_0x0640('0x73')]['role']===_0x0640('0x75')&&!_0x134305&&!_0x428766['query'][_0x0640('0x5b')])return[];return db[_0x0640('0x78')][_0x0640('0x2c')](_0x5f4a92[_0x0640('0x79')](),_0x3912df);})['then'](function(_0x359b53){_0x3793ac[_0x0640('0x14')]=_0x359b53[_0x0640('0x22')];if(_0x3793ac['count']===0x0)return[];return db[_0x0640('0x78')][_0x0640('0x2c')](_0x2aa937[_0x0640('0x79')](),_0x3912df)[_0x0640('0x17')](function(_0x369912){_0x2b96ee=_[_0x0640('0x7a')](_0x369912,'id');_0x3912df=_[_0x0640('0x7b')](_0x3912df,{'model':db[_0x0640('0x1f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x428766[_0x0640('0x2c')]['fields']){_0x6064f2['attributes'][_0x0640('0x4a')](function(_0x13c09b){_0x396abc[_0x0640('0x37')]('c.'+_0x13c09b);});}else{_0x396abc[_0x0640('0x37')](_0x0640('0x6e'));_0x396abc[_0x0640('0x37')]('c.firstName');_0x396abc[_0x0640('0x37')](_0x0640('0x7c'));_0x396abc[_0x0640('0x37')](_0x0640('0x7d'));_0x396abc[_0x0640('0x37')]('c.mobile');_0x396abc[_0x0640('0x37')](_0x0640('0x7e'));_0x396abc['field'](_0x0640('0x7f'));_0x396abc[_0x0640('0x37')](_0x0640('0x80'));_0x396abc[_0x0640('0x37')](_0x0640('0x81'));_0x396abc[_0x0640('0x37')]('c.deletedAt');_0x396abc[_0x0640('0x37')](_0x0640('0x82'));_0x396abc[_0x0640('0x37')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x0640('0x83'));}if(_0x6064f2[_0x0640('0x13')])_0x396abc[_0x0640('0x13')](_0x6064f2[_0x0640('0x13')]);if(_0x6064f2[_0x0640('0x11')])_0x396abc[_0x0640('0x11')](_0x6064f2['offset']);return db['sequelize']['query'](_0x396abc[_0x0640('0x79')](),_0x3912df);});})[_0x0640('0x17')](function(_0x563f1f){_0x563f1f[_0x0640('0x4a')](function(_0x20febe){if(_0x20febe['TagIds']){_0x20febe[_0x0640('0x84')]=[];_0x20febe[_0x0640('0x83')][_0x0640('0x48')](',')[_0x0640('0x4a')](function(_0x12736a){_0x20febe[_0x0640('0x84')][_0x0640('0x25')](_0x2b96ee[_0x12736a]);});}delete _0x20febe[_0x0640('0x83')];});_0x3793ac['rows']=_0x563f1f;return _0x3793ac;})[_0x0640('0x17')](respondWithFilteredResult(_0x1a94e1,_0x6064f2));})['catch'](handleError(_0x1a94e1,null));};exports[_0x0640('0x18')]=function(_0x559d03,_0x20d9f1){return db['CmContact'][_0x0640('0x46')]({'where':{'id':_0x559d03['params']['id']}})['then'](handleEntityNotFound(_0x20d9f1,null))[_0x0640('0x17')](removeEntity(_0x20d9f1,null))[_0x0640('0x85')](handleError(_0x20d9f1,null));};exports['describe']=function(_0x5030e4,_0x55c4a8){return db[_0x0640('0x1f')]['describe']()[_0x0640('0x17')](function(_0x685a42){delete _0x685a42[_0x0640('0x86')];for(var _0x5d7b63=0x0;_0x5d7b63{}\s\\|]/g,'-');_0x1f7f8d(null,util[_0xc9f2('0x22')](_0xc9f2('0x23'),path[_0xc9f2('0x24')](_0x22a475[_0xc9f2('0x21')],path['extname'](_0x22a475['originalname'])),Date['now'](),path[_0xc9f2('0x25')](_0x22a475['originalname'])));}})});router[_0xc9f2('0x1a')](_0xc9f2('0x26'),upload[_0xc9f2('0x27')](_0xc9f2('0x28')),controller[_0xc9f2('0x29')]);var upload=multer({'storage':multer[_0xc9f2('0x1d')]({'destination':function(_0x281de4,_0x4abc73,_0x2f4947){_0x2f4947(null,path['join'](config[_0xc9f2('0x1f')],_0xc9f2('0x20')));},'filename':function(_0x59adcb,_0x4b397d,_0x4001ea){_0x4b397d[_0xc9f2('0x21')]=_0x4b397d[_0xc9f2('0x21')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4001ea(null,util[_0xc9f2('0x22')](_0xc9f2('0x23'),path[_0xc9f2('0x24')](_0x4b397d['originalname'],path[_0xc9f2('0x25')](_0x4b397d[_0xc9f2('0x21')])),Date[_0xc9f2('0x2a')](),path[_0xc9f2('0x25')](_0x4b397d[_0xc9f2('0x21')])));}})});router[_0xc9f2('0x1a')]('/upload',upload[_0xc9f2('0x27')](_0xc9f2('0x28')),controller[_0xc9f2('0x2b')]);router[_0xc9f2('0x1a')](_0xc9f2('0x2c'),auth[_0xc9f2('0x9')](),controller[_0xc9f2('0x2d')]);router[_0xc9f2('0x2e')]('/:id',auth['isAuthenticated'](),controller[_0xc9f2('0x2f')]);router[_0xc9f2('0x30')](_0xc9f2('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xc9f2('0x31')]=router; \ No newline at end of file +var _0x85a6=['path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/tags','getTags','/:id/hoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','/merge','create','bulkCreate','setTags','diskStorage','join','server/files/tmp','originalname','replace','format','%s-%s%s','extname','now','uploadCsv','/upload','single','file','/upload/:id','import','put','destroy','multer','util'];(function(_0x8238,_0x39c08c){var _0x5dd502=function(_0x5a3ea5){while(--_0x5a3ea5){_0x8238['push'](_0x8238['shift']());}};_0x5dd502(++_0x39c08c);}(_0x85a6,0x1c0));var _0x685a=function(_0x37c5fe,_0x74a61b){_0x37c5fe=_0x37c5fe-0x0;var _0x24c532=_0x85a6[_0x37c5fe];return _0x24c532;};'use strict';var multer=require(_0x685a('0x0'));var util=require(_0x685a('0x1'));var path=require(_0x685a('0x2'));var timeout=require(_0x685a('0x3'));var express=require(_0x685a('0x4'));var router=express[_0x685a('0x5')]();var fs_extra=require(_0x685a('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x685a('0x7'));var controller=require('./cmContact.controller');router[_0x685a('0x8')]('/',auth[_0x685a('0x9')](),controller['index']);router[_0x685a('0x8')]('/describe',auth[_0x685a('0x9')](),controller[_0x685a('0xa')]);router[_0x685a('0x8')](_0x685a('0xb'),auth[_0x685a('0x9')](),controller[_0x685a('0xc')]);router[_0x685a('0x8')](_0x685a('0xd'),auth[_0x685a('0x9')](),controller[_0x685a('0xe')]);router[_0x685a('0x8')](_0x685a('0xf'),auth[_0x685a('0x9')](),controller['getHoppers']);router[_0x685a('0x8')]('/:id/hopper_histories',auth[_0x685a('0x9')](),controller[_0x685a('0x10')]);router[_0x685a('0x8')](_0x685a('0x11'),auth[_0x685a('0x9')](),controller[_0x685a('0x12')]);router[_0x685a('0x8')](_0x685a('0x13'),auth[_0x685a('0x9')](),controller[_0x685a('0x14')]);router[_0x685a('0x8')](_0x685a('0x15'),auth['isAuthenticated'](),controller[_0x685a('0x16')]);router[_0x685a('0x17')](_0x685a('0x18'),auth['isAuthenticated'](),controller['merge']);router[_0x685a('0x17')]('/',auth[_0x685a('0x9')](),controller[_0x685a('0x19')]);router[_0x685a('0x17')]('/create_many',auth[_0x685a('0x9')](),controller[_0x685a('0x1a')]);router[_0x685a('0x17')](_0x685a('0xd'),auth[_0x685a('0x9')](),controller[_0x685a('0x1b')]);var upload=multer({'storage':multer[_0x685a('0x1c')]({'destination':function(_0x178a0c,_0x2f90ac,_0x19e359){_0x19e359(null,path[_0x685a('0x1d')](config['root'],_0x685a('0x1e')));},'filename':function(_0x1f6c76,_0x5dffea,_0x5a21f7){_0x5dffea['originalname']=_0x5dffea[_0x685a('0x1f')][_0x685a('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5a21f7(null,util[_0x685a('0x21')](_0x685a('0x22'),path['basename'](_0x5dffea[_0x685a('0x1f')],path[_0x685a('0x23')](_0x5dffea[_0x685a('0x1f')])),Date[_0x685a('0x24')](),path[_0x685a('0x23')](_0x5dffea[_0x685a('0x1f')])));}})});router[_0x685a('0x17')]('/csv',upload['single']('file'),controller[_0x685a('0x25')]);var upload=multer({'storage':multer[_0x685a('0x1c')]({'destination':function(_0x1c86f4,_0x3f4b89,_0x20afa2){_0x20afa2(null,path[_0x685a('0x1d')](config['root'],_0x685a('0x1e')));},'filename':function(_0x3c9ac8,_0x1b6c16,_0x32121f){_0x1b6c16[_0x685a('0x1f')]=_0x1b6c16[_0x685a('0x1f')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x32121f(null,util[_0x685a('0x21')]('%s-%s%s',path['basename'](_0x1b6c16[_0x685a('0x1f')],path[_0x685a('0x23')](_0x1b6c16[_0x685a('0x1f')])),Date[_0x685a('0x24')](),path[_0x685a('0x23')](_0x1b6c16[_0x685a('0x1f')])));}})});router[_0x685a('0x17')](_0x685a('0x26'),upload[_0x685a('0x27')](_0x685a('0x28')),controller['upload']);router[_0x685a('0x17')](_0x685a('0x29'),auth[_0x685a('0x9')](),controller[_0x685a('0x2a')]);router[_0x685a('0x2b')](_0x685a('0xb'),auth[_0x685a('0x9')](),controller['update']);router['delete']('/:id',auth[_0x685a('0x9')](),controller[_0x685a('0x2c')]);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 a7d19a5..a4d64ed 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 _0xe4d9=['VIRTUAL','getDataValue','alias','STRING','setDataValue','TEXT','type','select','parse','values','voice','sequelize','lodash','exports'];(function(_0x5e24a3,_0x40120f){var _0x3214fd=function(_0x42f861){while(--_0x42f861){_0x5e24a3['push'](_0x5e24a3['shift']());}};_0x3214fd(++_0x40120f);}(_0xe4d9,0x6d));var _0x9e4d=function(_0x4ca621,_0x11c0c7){_0x4ca621=_0x4ca621-0x0;var _0x166bf0=_0xe4d9[_0x4ca621];return _0x166bf0;};'use strict';var Sequelize=require(_0x9e4d('0x0'));var _=require(_0x9e4d('0x1'));module[_0x9e4d('0x2')]={'name':{'type':Sequelize[_0x9e4d('0x3')],'get':function(_0x362793){return this[_0x9e4d('0x4')](_0x9e4d('0x5'));}},'alias':{'type':Sequelize[_0x9e4d('0x6')],'allowNull':![],'set':function(_0x3de9f8){this[_0x9e4d('0x7')]('alias',_0x3de9f8?_0x3de9f8:this[_0x9e4d('0x4')]('name'));}},'type':{'type':Sequelize[_0x9e4d('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x9e4d('0x8')]('long'),'get':function(){if(this[_0x9e4d('0x4')](_0x9e4d('0x9'))===_0x9e4d('0xa')){return JSON[_0x9e4d('0xb')](this[_0x9e4d('0x4')]('values'));}else{return this[_0x9e4d('0x4')](_0x9e4d('0xc'));}},'set':function(_0x4e31f6){if(Array['isArray'](_0x4e31f6)){this[_0x9e4d('0x7')](_0x9e4d('0xc'),JSON['stringify'](_0x4e31f6));}else{this[_0x9e4d('0x7')](_0x9e4d('0xc'),_0x4e31f6);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x9e4d('0xd'))}}; \ No newline at end of file +var _0x9e68=['exports','VIRTUAL','STRING','setDataValue','name','TEXT','long','getDataValue','type','parse','values','isArray','stringify','BOOLEAN','ENUM','sequelize'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9e68,0xff));var _0x89e6=function(_0x262009,_0x58f8a6){_0x262009=_0x262009-0x0;var _0x4c7476=_0x9e68[_0x262009];return _0x4c7476;};'use strict';var Sequelize=require(_0x89e6('0x0'));var _=require('lodash');module[_0x89e6('0x1')]={'name':{'type':Sequelize[_0x89e6('0x2')],'get':function(_0x556258){return this['getDataValue']('alias');}},'alias':{'type':Sequelize[_0x89e6('0x3')],'allowNull':![],'set':function(_0xafd8bd){this[_0x89e6('0x4')]('alias',_0xafd8bd?_0xafd8bd:this['getDataValue'](_0x89e6('0x5')));}},'type':{'type':Sequelize[_0x89e6('0x3')],'allowNull':![]},'values':{'type':Sequelize[_0x89e6('0x6')](_0x89e6('0x7')),'get':function(){if(this[_0x89e6('0x8')](_0x89e6('0x9'))==='select'){return JSON[_0x89e6('0xa')](this[_0x89e6('0x8')]('values'));}else{return this['getDataValue'](_0x89e6('0xb'));}},'set':function(_0x31af57){if(Array[_0x89e6('0xc')](_0x31af57)){this[_0x89e6('0x4')](_0x89e6('0xb'),JSON[_0x89e6('0xd')](_0x31af57));}else{this[_0x89e6('0x4')](_0x89e6('0xb'),_0x31af57);}}},'required':{'type':Sequelize[_0x89e6('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x89e6('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x89e6('0xf')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 78bdf19..22f0ddf 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 _0x565d=['BOOLEAN','queryInterface','addColumn','cm_contacts','format','cf_%d','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','name','index','map','CmCustomField','rawAttributes','fieldName','key','model','differenceBy','query','filters','intersection','attributes','fields','length','nolimit','order','where','filter','merge','VIRTUAL','includeAll','catch','show','params','keys','include','options','body','find','create','sequelize','transaction','TEXT','type','Sequelize','number','INTEGER'];(function(_0x572a95,_0x15452f){var _0x10ea48=function(_0x58d27e){while(--_0x58d27e){_0x572a95['push'](_0x572a95['shift']());}};_0x10ea48(++_0x15452f);}(_0x565d,0x1f2));var _0xd565=function(_0x2f88c9,_0x1d1962){_0x2f88c9=_0x2f88c9-0x0;var _0x2b4a5b=_0x565d[_0x2f88c9];return _0x2b4a5b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd565('0x0'));var zipdir=require(_0xd565('0x1'));var jsonpatch=require(_0xd565('0x2'));var rp=require(_0xd565('0x3'));var moment=require(_0xd565('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd565('0x5'));var util=require(_0xd565('0x6'));var path=require('path');var sox=require(_0xd565('0x7'));var csv=require('to-csv');var ejs=require(_0xd565('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd565('0x9'));var squel=require('squel');var crypto=require(_0xd565('0xa'));var jsforce=require(_0xd565('0xb'));var deskjs=require(_0xd565('0xc'));var toCsv=require(_0xd565('0xd'));var querystring=require('querystring');var Papa=require(_0xd565('0xe'));var Redis=require(_0xd565('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd565('0x10'));var as=require(_0xd565('0x11'));var hardwareService=require(_0xd565('0x12'));var logger=require(_0xd565('0x13'))(_0xd565('0x14'));var utils=require('../../config/utils');var config=require(_0xd565('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a8ae2,_0x7200fd){_0x7200fd=_0x7200fd||0xcc;return function(_0x35050c){if(_0x35050c){return _0x2a8ae2[_0xd565('0x16')](_0x7200fd);}return _0x2a8ae2[_0xd565('0x17')](_0x7200fd)[_0xd565('0x18')]();};}function respondWithResult(_0x241601,_0x305df1){_0x305df1=_0x305df1||0xc8;return function(_0x2b5591){if(_0x2b5591){return _0x241601['status'](_0x305df1)[_0xd565('0x19')](_0x2b5591);}};}function respondWithFilteredResult(_0x368bb1,_0x442e9b){return function(_0x1b193d){if(_0x1b193d){var _0x39d855=typeof _0x442e9b[_0xd565('0x1a')]===_0xd565('0x1b')&&typeof _0x442e9b[_0xd565('0x1c')]===_0xd565('0x1b');var _0x20b72f=_0x1b193d[_0xd565('0x1d')];var _0x5d5a4a=_0x39d855?0x0:_0x442e9b['offset'];var _0x1682b5=_0x39d855?_0x1b193d[_0xd565('0x1d')]:_0x442e9b[_0xd565('0x1a')]+_0x442e9b[_0xd565('0x1c')];var _0x364ed0;if(_0x1682b5>=_0x20b72f){_0x1682b5=_0x20b72f;_0x364ed0=0xc8;}else{_0x364ed0=0xce;}_0x368bb1[_0xd565('0x17')](_0x364ed0);return _0x368bb1[_0xd565('0x1e')]('Content-Range',_0x5d5a4a+'-'+_0x1682b5+'/'+_0x20b72f)[_0xd565('0x19')](_0x1b193d);}return null;};}function patchUpdates(_0x224ed8){return function(_0x58ea9e){try{jsonpatch[_0xd565('0x1f')](_0x58ea9e,_0x224ed8,!![]);}catch(_0x222870){return BPromise[_0xd565('0x20')](_0x222870);}return _0x58ea9e[_0xd565('0x21')]();};}function saveUpdates(_0x58171e,_0x46ad14){return function(_0x260664){if(_0x260664){return _0x260664[_0xd565('0x22')](_0x58171e)['then'](function(_0x1c2134){return _0x1c2134;});}return null;};}function removeEntity(_0x3e016c,_0x119405){return function(_0x305762){if(_0x305762){return _0x305762[_0xd565('0x23')]()[_0xd565('0x24')](function(){_0x3e016c['status'](0xcc)[_0xd565('0x18')]();});}};}function handleEntityNotFound(_0x46c6c6,_0x4e27d9){return function(_0x41f22e){if(!_0x41f22e){_0x46c6c6[_0xd565('0x16')](0x194);}return _0x41f22e;};}function handleError(_0x58757b,_0x13210e){_0x13210e=_0x13210e||0x1f4;return function(_0x203a50){logger[_0xd565('0x25')](_0x203a50['stack']);if(_0x203a50[_0xd565('0x26')]){delete _0x203a50[_0xd565('0x26')];}_0x58757b[_0xd565('0x17')](_0x13210e)['send'](_0x203a50);};}exports[_0xd565('0x27')]=function(_0x443045,_0x359dbf){var _0x816f80={},_0x3ceeb1={},_0x75e4dd={'count':0x0,'rows':[]};var _0x2bf07f=_[_0xd565('0x28')](db[_0xd565('0x29')][_0xd565('0x2a')],function(_0x450d52){return{'name':_0x450d52[_0xd565('0x2b')],'type':_0x450d52['type'][_0xd565('0x2c')]};});_0x3ceeb1[_0xd565('0x2d')]=_[_0xd565('0x2e')](_[_0xd565('0x28')](_0x2bf07f,_0xd565('0x26')),[_0xd565('0x26')]);_0x3ceeb1[_0xd565('0x2f')]=_['keys'](_0x443045[_0xd565('0x2f')]);_0x3ceeb1[_0xd565('0x30')]=_[_0xd565('0x31')](_0x3ceeb1['model'],_0x3ceeb1[_0xd565('0x2f')]);_0x816f80[_0xd565('0x32')]=_[_0xd565('0x31')](_0x3ceeb1[_0xd565('0x2d')],qs[_0xd565('0x33')](_0x443045['query'][_0xd565('0x33')]));_0x816f80[_0xd565('0x32')]=_0x816f80[_0xd565('0x32')][_0xd565('0x34')]?_0x816f80['attributes']:_0x3ceeb1[_0xd565('0x2d')];if(!_0x443045[_0xd565('0x2f')]['hasOwnProperty'](_0xd565('0x35'))){_0x816f80[_0xd565('0x1c')]=qs[_0xd565('0x1c')](_0x443045[_0xd565('0x2f')][_0xd565('0x1c')]);_0x816f80['offset']=qs[_0xd565('0x1a')](_0x443045[_0xd565('0x2f')][_0xd565('0x1a')]);}_0x816f80[_0xd565('0x36')]=qs['sort'](_0x443045[_0xd565('0x2f')]['sort']);_0x816f80[_0xd565('0x37')]=qs['filters'](_['pick'](_0x443045['query'],_0x3ceeb1['filters']),_0x2bf07f);if(_0x443045[_0xd565('0x2f')][_0xd565('0x38')]){_0x816f80[_0xd565('0x37')]=_[_0xd565('0x39')](_0x816f80[_0xd565('0x37')],{'$or':_[_0xd565('0x28')](_0x2bf07f,function(_0x4e60b9){if(_0x4e60b9['type']!==_0xd565('0x3a')){var _0x411abd={};_0x411abd[_0x4e60b9[_0xd565('0x26')]]={'$like':'%'+_0x443045[_0xd565('0x2f')]['filter']+'%'};return _0x411abd;}})});}_0x816f80=_[_0xd565('0x39')]({},_0x816f80,_0x443045['options']);var _0x39fd3f={'where':_0x816f80[_0xd565('0x37')]};return db['CmCustomField'][_0xd565('0x1d')](_0x39fd3f)[_0xd565('0x24')](function(_0x5105d7){_0x75e4dd[_0xd565('0x1d')]=_0x5105d7;if(_0x443045[_0xd565('0x2f')][_0xd565('0x3b')]){_0x816f80['include']=[{'all':!![]}];}return db[_0xd565('0x29')]['findAll'](_0x816f80);})[_0xd565('0x24')](function(_0x316071){_0x75e4dd['rows']=_0x316071;return _0x75e4dd;})[_0xd565('0x24')](respondWithFilteredResult(_0x359dbf,_0x816f80))[_0xd565('0x3c')](handleError(_0x359dbf,null));};exports[_0xd565('0x3d')]=function(_0x46d2c2,_0x347df5){var _0x39c692={'raw':!![],'where':{'id':_0x46d2c2[_0xd565('0x3e')]['id']}},_0x1c7a26={};_0x1c7a26[_0xd565('0x2d')]=_['keys'](db[_0xd565('0x29')]['rawAttributes']);_0x1c7a26[_0xd565('0x2f')]=_[_0xd565('0x3f')](_0x46d2c2[_0xd565('0x2f')]);_0x1c7a26[_0xd565('0x30')]=_[_0xd565('0x31')](_0x1c7a26[_0xd565('0x2d')],_0x1c7a26[_0xd565('0x2f')]);_0x39c692[_0xd565('0x32')]=_['intersection'](_0x1c7a26[_0xd565('0x2d')],qs['fields'](_0x46d2c2[_0xd565('0x2f')]['fields']));_0x39c692['attributes']=_0x39c692[_0xd565('0x32')]['length']?_0x39c692['attributes']:_0x1c7a26['model'];if(_0x46d2c2[_0xd565('0x2f')][_0xd565('0x3b')]){_0x39c692[_0xd565('0x40')]=[{'all':!![]}];}_0x39c692=_['merge']({},_0x39c692,_0x46d2c2[_0xd565('0x41')]);return db[_0xd565('0x29')]['find'](_0x39c692)[_0xd565('0x24')](handleEntityNotFound(_0x347df5,null))['then'](respondWithResult(_0x347df5,null))[_0xd565('0x3c')](handleError(_0x347df5,null));};exports[_0xd565('0x22')]=function(_0x330e8c,_0x4b73a4){if(_0x330e8c[_0xd565('0x42')]['id']){delete _0x330e8c['body']['id'];}return db[_0xd565('0x29')]['find']({'where':{'id':_0x330e8c[_0xd565('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4b73a4,null))[_0xd565('0x24')](saveUpdates(_0x330e8c[_0xd565('0x42')],null))[_0xd565('0x24')](respondWithResult(_0x4b73a4,null))[_0xd565('0x3c')](handleError(_0x4b73a4,null));};exports[_0xd565('0x23')]=function(_0xc61358,_0x294f23){return db[_0xd565('0x29')][_0xd565('0x43')]({'where':{'id':_0xc61358[_0xd565('0x3e')]['id']}})[_0xd565('0x24')](handleEntityNotFound(_0x294f23,null))[_0xd565('0x24')](removeEntity(_0x294f23,null))[_0xd565('0x3c')](handleError(_0x294f23,null));};exports[_0xd565('0x44')]=function(_0x22c575,_0x23b79d){var _0x456dee;return db[_0xd565('0x45')][_0xd565('0x46')](function(_0x224c7a){return db[_0xd565('0x29')][_0xd565('0x44')](_0x22c575[_0xd565('0x42')],{'transaction':_0x224c7a})[_0xd565('0x24')](function(_0x274c94){_0x456dee=_0x274c94;var _0x34dbb={'type':db['Sequelize'][_0xd565('0x47')],'transaction':_0x224c7a};switch(_0x22c575['body']['type']){case'text':_0x34dbb[_0xd565('0x48')]=db[_0xd565('0x49')]['TEXT'];break;case _0xd565('0x4a'):_0x34dbb[_0xd565('0x48')]=db[_0xd565('0x49')][_0xd565('0x4b')];break;case'switch':_0x34dbb[_0xd565('0x48')]=db[_0xd565('0x49')][_0xd565('0x4c')];_0x34dbb['defaultValue']=![];break;default:}return db[_0xd565('0x45')][_0xd565('0x4d')][_0xd565('0x4e')](_0xd565('0x4f'),util[_0xd565('0x50')](_0xd565('0x51'),_0x456dee['id']),_0x34dbb);})[_0xd565('0x24')](function(){return _0x456dee;});})['then'](respondWithResult(_0x23b79d,0xc9))[_0xd565('0x3c')](handleError(_0x23b79d,null));}; \ No newline at end of file +var _0xf777=['api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','sendStatus','error','stack','name','index','map','CmCustomField','fieldName','type','key','model','differenceBy','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','then','include','findAll','catch','show','params','find','body','destroy','create','sequelize','transaction','Sequelize','TEXT','number','INTEGER','BOOLEAN','queryInterface','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xf777,0x1e9));var _0x7f77=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf777[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x7f77('0x0'));var rimraf=require(_0x7f77('0x1'));var zipdir=require(_0x7f77('0x2'));var jsonpatch=require(_0x7f77('0x3'));var rp=require(_0x7f77('0x4'));var moment=require(_0x7f77('0x5'));var BPromise=require(_0x7f77('0x6'));var Mustache=require(_0x7f77('0x7'));var util=require(_0x7f77('0x8'));var path=require('path');var sox=require(_0x7f77('0x9'));var csv=require(_0x7f77('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7f77('0xb'));var _=require('lodash');var squel=require(_0x7f77('0xc'));var crypto=require('crypto');var jsforce=require(_0x7f77('0xd'));var deskjs=require(_0x7f77('0xe'));var toCsv=require(_0x7f77('0xa'));var querystring=require(_0x7f77('0xf'));var Papa=require(_0x7f77('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7f77('0x11'));var as=require(_0x7f77('0x12'));var hardwareService=require(_0x7f77('0x13'));var logger=require(_0x7f77('0x14'))(_0x7f77('0x15'));var utils=require('../../config/utils');var config=require(_0x7f77('0x16'));var licenseUtil=require(_0x7f77('0x17'));var db=require(_0x7f77('0x18'))['db'];function respondWithStatusCode(_0x2ab82d,_0xd625fb){_0xd625fb=_0xd625fb||0xcc;return function(_0x484018){if(_0x484018){return _0x2ab82d['sendStatus'](_0xd625fb);}return _0x2ab82d[_0x7f77('0x19')](_0xd625fb)[_0x7f77('0x1a')]();};}function respondWithResult(_0x3f7a60,_0x3f99e2){_0x3f99e2=_0x3f99e2||0xc8;return function(_0xe15bf7){if(_0xe15bf7){return _0x3f7a60[_0x7f77('0x19')](_0x3f99e2)[_0x7f77('0x1b')](_0xe15bf7);}};}function respondWithFilteredResult(_0x2efdd1,_0x13e9a1){return function(_0x3d8a45){if(_0x3d8a45){var _0x2c104a=typeof _0x13e9a1[_0x7f77('0x1c')]===_0x7f77('0x1d')&&typeof _0x13e9a1[_0x7f77('0x1e')]===_0x7f77('0x1d');var _0x40577e=_0x3d8a45['count'];var _0x5b2c85=_0x2c104a?0x0:_0x13e9a1[_0x7f77('0x1c')];var _0x53ec10=_0x2c104a?_0x3d8a45[_0x7f77('0x1f')]:_0x13e9a1['offset']+_0x13e9a1[_0x7f77('0x1e')];var _0x16eaf0;if(_0x53ec10>=_0x40577e){_0x53ec10=_0x40577e;_0x16eaf0=0xc8;}else{_0x16eaf0=0xce;}_0x2efdd1[_0x7f77('0x19')](_0x16eaf0);return _0x2efdd1['set'](_0x7f77('0x20'),_0x5b2c85+'-'+_0x53ec10+'/'+_0x40577e)[_0x7f77('0x1b')](_0x3d8a45);}return null;};}function patchUpdates(_0x4d7283){return function(_0x175e9c){try{jsonpatch[_0x7f77('0x21')](_0x175e9c,_0x4d7283,!![]);}catch(_0x2d7654){return BPromise['reject'](_0x2d7654);}return _0x175e9c[_0x7f77('0x22')]();};}function saveUpdates(_0x5b869c,_0x5c4049){return function(_0xcb6a79){if(_0xcb6a79){return _0xcb6a79[_0x7f77('0x23')](_0x5b869c)['then'](function(_0x5e98b5){return _0x5e98b5;});}return null;};}function removeEntity(_0x2493a0,_0x87e6b6){return function(_0x1d8fe3){if(_0x1d8fe3){return _0x1d8fe3['destroy']()['then'](function(){_0x2493a0[_0x7f77('0x19')](0xcc)[_0x7f77('0x1a')]();});}};}function handleEntityNotFound(_0x303043,_0x3d66d5){return function(_0xd78c83){if(!_0xd78c83){_0x303043[_0x7f77('0x24')](0x194);}return _0xd78c83;};}function handleError(_0x56484c,_0x106ce3){_0x106ce3=_0x106ce3||0x1f4;return function(_0x4e38e4){logger[_0x7f77('0x25')](_0x4e38e4[_0x7f77('0x26')]);if(_0x4e38e4['name']){delete _0x4e38e4[_0x7f77('0x27')];}_0x56484c[_0x7f77('0x19')](_0x106ce3)['send'](_0x4e38e4);};}exports[_0x7f77('0x28')]=function(_0x53ac60,_0x341b5a){var _0x25fcae={},_0x1bae99={},_0x600238={'count':0x0,'rows':[]};var _0x6995bf=_[_0x7f77('0x29')](db[_0x7f77('0x2a')]['rawAttributes'],function(_0x268c18){return{'name':_0x268c18[_0x7f77('0x2b')],'type':_0x268c18[_0x7f77('0x2c')][_0x7f77('0x2d')]};});_0x1bae99[_0x7f77('0x2e')]=_[_0x7f77('0x2f')](_[_0x7f77('0x29')](_0x6995bf,'name'),['name']);_0x1bae99['query']=_[_0x7f77('0x30')](_0x53ac60[_0x7f77('0x31')]);_0x1bae99[_0x7f77('0x32')]=_[_0x7f77('0x33')](_0x1bae99[_0x7f77('0x2e')],_0x1bae99[_0x7f77('0x31')]);_0x25fcae[_0x7f77('0x34')]=_[_0x7f77('0x33')](_0x1bae99[_0x7f77('0x2e')],qs[_0x7f77('0x35')](_0x53ac60[_0x7f77('0x31')]['fields']));_0x25fcae[_0x7f77('0x34')]=_0x25fcae[_0x7f77('0x34')][_0x7f77('0x36')]?_0x25fcae[_0x7f77('0x34')]:_0x1bae99[_0x7f77('0x2e')];if(!_0x53ac60[_0x7f77('0x31')][_0x7f77('0x37')](_0x7f77('0x38'))){_0x25fcae[_0x7f77('0x1e')]=qs[_0x7f77('0x1e')](_0x53ac60['query'][_0x7f77('0x1e')]);_0x25fcae['offset']=qs[_0x7f77('0x1c')](_0x53ac60[_0x7f77('0x31')]['offset']);}_0x25fcae['order']=qs[_0x7f77('0x39')](_0x53ac60[_0x7f77('0x31')]['sort']);_0x25fcae[_0x7f77('0x3a')]=qs['filters'](_[_0x7f77('0x3b')](_0x53ac60[_0x7f77('0x31')],_0x1bae99['filters']),_0x6995bf);if(_0x53ac60[_0x7f77('0x31')][_0x7f77('0x3c')]){_0x25fcae[_0x7f77('0x3a')]=_[_0x7f77('0x3d')](_0x25fcae[_0x7f77('0x3a')],{'$or':_[_0x7f77('0x29')](_0x6995bf,function(_0x397991){if(_0x397991[_0x7f77('0x2c')]!==_0x7f77('0x3e')){var _0x5185b5={};_0x5185b5[_0x397991[_0x7f77('0x27')]]={'$like':'%'+_0x53ac60[_0x7f77('0x31')][_0x7f77('0x3c')]+'%'};return _0x5185b5;}})});}_0x25fcae=_[_0x7f77('0x3d')]({},_0x25fcae,_0x53ac60[_0x7f77('0x3f')]);var _0x186ca2={'where':_0x25fcae['where']};return db[_0x7f77('0x2a')]['count'](_0x186ca2)[_0x7f77('0x40')](function(_0x26b1be){_0x600238['count']=_0x26b1be;if(_0x53ac60[_0x7f77('0x31')]['includeAll']){_0x25fcae[_0x7f77('0x41')]=[{'all':!![]}];}return db[_0x7f77('0x2a')][_0x7f77('0x42')](_0x25fcae);})[_0x7f77('0x40')](function(_0x2540e0){_0x600238['rows']=_0x2540e0;return _0x600238;})[_0x7f77('0x40')](respondWithFilteredResult(_0x341b5a,_0x25fcae))[_0x7f77('0x43')](handleError(_0x341b5a,null));};exports[_0x7f77('0x44')]=function(_0x144ff9,_0x5e326b){var _0x32a7fd={'raw':!![],'where':{'id':_0x144ff9[_0x7f77('0x45')]['id']}},_0x212707={};_0x212707['model']=_[_0x7f77('0x30')](db[_0x7f77('0x2a')]['rawAttributes']);_0x212707[_0x7f77('0x31')]=_['keys'](_0x144ff9['query']);_0x212707[_0x7f77('0x32')]=_[_0x7f77('0x33')](_0x212707['model'],_0x212707[_0x7f77('0x31')]);_0x32a7fd[_0x7f77('0x34')]=_[_0x7f77('0x33')](_0x212707[_0x7f77('0x2e')],qs['fields'](_0x144ff9[_0x7f77('0x31')][_0x7f77('0x35')]));_0x32a7fd[_0x7f77('0x34')]=_0x32a7fd[_0x7f77('0x34')]['length']?_0x32a7fd[_0x7f77('0x34')]:_0x212707[_0x7f77('0x2e')];if(_0x144ff9[_0x7f77('0x31')]['includeAll']){_0x32a7fd[_0x7f77('0x41')]=[{'all':!![]}];}_0x32a7fd=_['merge']({},_0x32a7fd,_0x144ff9[_0x7f77('0x3f')]);return db[_0x7f77('0x2a')][_0x7f77('0x46')](_0x32a7fd)['then'](handleEntityNotFound(_0x5e326b,null))['then'](respondWithResult(_0x5e326b,null))[_0x7f77('0x43')](handleError(_0x5e326b,null));};exports[_0x7f77('0x23')]=function(_0x390c64,_0x3b19fc){if(_0x390c64[_0x7f77('0x47')]['id']){delete _0x390c64[_0x7f77('0x47')]['id'];}return db[_0x7f77('0x2a')][_0x7f77('0x46')]({'where':{'id':_0x390c64[_0x7f77('0x45')]['id']}})[_0x7f77('0x40')](handleEntityNotFound(_0x3b19fc,null))[_0x7f77('0x40')](saveUpdates(_0x390c64[_0x7f77('0x47')],null))['then'](respondWithResult(_0x3b19fc,null))[_0x7f77('0x43')](handleError(_0x3b19fc,null));};exports[_0x7f77('0x48')]=function(_0x4675ed,_0x1edb18){return db[_0x7f77('0x2a')][_0x7f77('0x46')]({'where':{'id':_0x4675ed[_0x7f77('0x45')]['id']}})[_0x7f77('0x40')](handleEntityNotFound(_0x1edb18,null))[_0x7f77('0x40')](removeEntity(_0x1edb18,null))[_0x7f77('0x43')](handleError(_0x1edb18,null));};exports[_0x7f77('0x49')]=function(_0x55dd28,_0x4cd8ee){var _0x393665;return db[_0x7f77('0x4a')][_0x7f77('0x4b')](function(_0x69b580){return db['CmCustomField'][_0x7f77('0x49')](_0x55dd28['body'],{'transaction':_0x69b580})[_0x7f77('0x40')](function(_0x1db6dc){_0x393665=_0x1db6dc;var _0x2c6a92={'type':db[_0x7f77('0x4c')][_0x7f77('0x4d')],'transaction':_0x69b580};switch(_0x55dd28['body'][_0x7f77('0x2c')]){case'text':_0x2c6a92[_0x7f77('0x2c')]=db['Sequelize'][_0x7f77('0x4d')];break;case _0x7f77('0x4e'):_0x2c6a92[_0x7f77('0x2c')]=db[_0x7f77('0x4c')][_0x7f77('0x4f')];break;case'switch':_0x2c6a92['type']=db[_0x7f77('0x4c')][_0x7f77('0x50')];_0x2c6a92['defaultValue']=![];break;default:}return db[_0x7f77('0x4a')][_0x7f77('0x51')]['addColumn'](_0x7f77('0x52'),util[_0x7f77('0x53')](_0x7f77('0x54'),_0x393665['id']),_0x2c6a92);})[_0x7f77('0x40')](function(){return _0x393665;});})[_0x7f77('0x40')](respondWithResult(_0x4cd8ee,0xc9))[_0x7f77('0x43')](handleError(_0x4cd8ee,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index c74f88d..dee3875 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 _0x05ed=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','util'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x05ed,0xbd));var _0xd05e=function(_0xe4d6c6,_0x3bdbf2){_0xe4d6c6=_0xe4d6c6-0x0;var _0x3a8935=_0x05ed[_0xe4d6c6];return _0x3a8935;};'use strict';var _=require('lodash');var util=require(_0xd05e('0x0'));var logger=require(_0xd05e('0x1'))('api');var moment=require(_0xd05e('0x2'));var BPromise=require(_0xd05e('0x3'));var rp=require(_0xd05e('0x4'));var fs=require('fs');var path=require(_0xd05e('0x5'));var rimraf=require(_0xd05e('0x6'));var config=require(_0xd05e('0x7'));var attributes=require(_0xd05e('0x8'));module[_0xd05e('0x9')]=function(_0x59b8cf,_0x2c6c76){return _0x59b8cf['define']('CmCustomField',attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba3d=['lodash','util','bluebird','path','rimraf','../../config/environment','exports','define','CmCustomField','cm_custom_fields'];(function(_0x2d364e,_0x301c5e){var _0x1b9312=function(_0x1b05bb){while(--_0x1b05bb){_0x2d364e['push'](_0x2d364e['shift']());}};_0x1b9312(++_0x301c5e);}(_0xba3d,0x168));var _0xdba3=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xba3d[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xdba3('0x0'));var util=require(_0xdba3('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xdba3('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdba3('0x3'));var rimraf=require(_0xdba3('0x4'));var config=require(_0xdba3('0x5'));var attributes=require('./cmCustomField.attributes');module[_0xdba3('0x6')]=function(_0x1eac12,_0x3abbda){return _0x1eac12[_0xdba3('0x7')](_0xdba3('0x8'),attributes,{'tableName':_0xdba3('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 0037607..1d9e5f7 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 _0x54cd=['CmCustomField,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x4cd21c,_0x35fa45){var _0x5d8e5e=function(_0x3af223){while(--_0x3af223){_0x4cd21c['push'](_0x4cd21c['shift']());}};_0x5d8e5e(++_0x35fa45);}(_0x54cd,0x142));var _0xd54c=function(_0xceab94,_0x3c4b46){_0xceab94=_0xceab94-0x0;var _0x343dc4=_0x54cd[_0xceab94];return _0x343dc4;};'use strict';var _=require('lodash');var util=require(_0xd54c('0x0'));var moment=require(_0xd54c('0x1'));var BPromise=require(_0xd54c('0x2'));var rs=require(_0xd54c('0x3'));var fs=require('fs');var Redis=require(_0xd54c('0x4'));var db=require(_0xd54c('0x5'))['db'];var utils=require(_0xd54c('0x6'));var logger=require(_0xd54c('0x7'))(_0xd54c('0x8'));var config=require(_0xd54c('0x9'));var jayson=require(_0xd54c('0xa'));var client=jayson['client'][_0xd54c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x506542,_0x133a95,_0x5162ef){return new BPromise(function(_0x16d251,_0x477a2e){return client[_0xd54c('0xc')](_0x506542,_0x5162ef)[_0xd54c('0xd')](function(_0x195aae){logger['info'](_0xd54c('0xe'),_0x133a95,'request\x20sent');logger[_0xd54c('0xf')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x133a95,_0xd54c('0x10'),JSON[_0xd54c('0x11')](_0x195aae));if(_0x195aae['error']){if(_0x195aae['error'][_0xd54c('0x12')]===0x1f4){logger[_0xd54c('0x13')](_0xd54c('0xe'),_0x133a95,_0x195aae[_0xd54c('0x13')][_0xd54c('0x14')]);return _0x477a2e(_0x195aae[_0xd54c('0x13')][_0xd54c('0x14')]);}logger[_0xd54c('0x13')](_0xd54c('0xe'),_0x133a95,_0x195aae[_0xd54c('0x13')][_0xd54c('0x14')]);return _0x16d251(_0x195aae['error'][_0xd54c('0x14')]);}else{logger['info'](_0xd54c('0xe'),_0x133a95,_0xd54c('0x10'));_0x16d251(_0x195aae['result'][_0xd54c('0x14')]);}})['catch'](function(_0x2c311f){logger['error']('CmCustomField,\x20%s,\x20%s',_0x133a95,_0x2c311f);_0x477a2e(_0x2c311f);});});} \ No newline at end of file +var _0xe7fe=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','moment','bluebird','randomstring'];(function(_0x30c649,_0x2ebbac){var _0x3edfb9=function(_0xab82f5){while(--_0xab82f5){_0x30c649['push'](_0x30c649['shift']());}};_0x3edfb9(++_0x2ebbac);}(_0xe7fe,0x1de));var _0xee7f=function(_0x2db964,_0x249285){_0x2db964=_0x2db964-0x0;var _0x225c0e=_0xe7fe[_0x2db964];return _0x225c0e;};'use strict';var _=require(_0xee7f('0x0'));var util=require(_0xee7f('0x1'));var moment=require(_0xee7f('0x2'));var BPromise=require(_0xee7f('0x3'));var rs=require(_0xee7f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xee7f('0x5'))['db'];var utils=require(_0xee7f('0x6'));var logger=require(_0xee7f('0x7'))(_0xee7f('0x8'));var config=require(_0xee7f('0x9'));var jayson=require(_0xee7f('0xa'));var client=jayson[_0xee7f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f832a,_0x547609,_0x56c4d6){return new BPromise(function(_0x11eada,_0x47d98d){return client[_0xee7f('0xc')](_0x3f832a,_0x56c4d6)['then'](function(_0x1b27ca){logger['info'](_0xee7f('0xd'),_0x547609,_0xee7f('0xe'));logger['debug'](_0xee7f('0xf'),_0x547609,'request\x20sent',JSON[_0xee7f('0x10')](_0x1b27ca));if(_0x1b27ca['error']){if(_0x1b27ca[_0xee7f('0x11')]['code']===0x1f4){logger[_0xee7f('0x11')](_0xee7f('0xd'),_0x547609,_0x1b27ca[_0xee7f('0x11')]['message']);return _0x47d98d(_0x1b27ca[_0xee7f('0x11')][_0xee7f('0x12')]);}logger['error'](_0xee7f('0xd'),_0x547609,_0x1b27ca['error'][_0xee7f('0x12')]);return _0x11eada(_0x1b27ca[_0xee7f('0x11')]['message']);}else{logger[_0xee7f('0x13')](_0xee7f('0xd'),_0x547609,_0xee7f('0xe'));_0x11eada(_0x1b27ca[_0xee7f('0x14')][_0xee7f('0x12')]);}})['catch'](function(_0x525472){logger[_0xee7f('0x11')](_0xee7f('0xd'),_0x547609,_0x525472);_0x47d98d(_0x525472);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index ee5df63..dd4f0f9 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 _0x4af9=['../../components/interaction/service','../../config/environment','./cmCustomField.controller','isAuthenticated','index','get','/:id','show','post','update','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service'];(function(_0x46a777,_0x42a4c9){var _0x28967e=function(_0x2bf025){while(--_0x2bf025){_0x46a777['push'](_0x46a777['shift']());}};_0x28967e(++_0x42a4c9);}(_0x4af9,0x12c));var _0x94af=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4af9[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x94af('0x0'));var util=require(_0x94af('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x94af('0x2'));var router=express[_0x94af('0x3')]();var fs_extra=require(_0x94af('0x4'));var auth=require(_0x94af('0x5'));var interaction=require(_0x94af('0x6'));var config=require(_0x94af('0x7'));var controller=require(_0x94af('0x8'));router['get']('/',auth[_0x94af('0x9')](),controller[_0x94af('0xa')]);router[_0x94af('0xb')](_0x94af('0xc'),auth['isAuthenticated'](),controller[_0x94af('0xd')]);router[_0x94af('0xe')]('/',auth[_0x94af('0x9')](),controller['create']);router['put'](_0x94af('0xc'),auth[_0x94af('0x9')](),controller[_0x94af('0xf')]);router[_0x94af('0x10')](_0x94af('0xc'),auth[_0x94af('0x9')](),controller['destroy']);module[_0x94af('0x11')]=router; \ No newline at end of file +var _0xe008=['./cmCustomField.controller','get','index','/:id','isAuthenticated','show','create','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0xe008,0x14f));var _0x8e00=function(_0x155e9b,_0xbfa8e8){_0x155e9b=_0x155e9b-0x0;var _0xd673f8=_0xe008[_0x155e9b];return _0xd673f8;};'use strict';var multer=require('multer');var util=require(_0x8e00('0x0'));var path=require(_0x8e00('0x1'));var timeout=require(_0x8e00('0x2'));var express=require(_0x8e00('0x3'));var router=express[_0x8e00('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8e00('0x5'));var interaction=require(_0x8e00('0x6'));var config=require('../../config/environment');var controller=require(_0x8e00('0x7'));router[_0x8e00('0x8')]('/',auth['isAuthenticated'](),controller[_0x8e00('0x9')]);router[_0x8e00('0x8')](_0x8e00('0xa'),auth[_0x8e00('0xb')](),controller[_0x8e00('0xc')]);router['post']('/',auth[_0x8e00('0xb')](),controller[_0x8e00('0xd')]);router[_0x8e00('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x8e00('0xf')]);router[_0x8e00('0x10')]('/:id',auth[_0x8e00('0xb')](),controller['destroy']);module[_0x8e00('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index b7bb520..2750eb2 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 _0xacf4=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','exports','STRING','BOOLEAN'];(function(_0x29950b,_0x1f817e){var _0x10b8db=function(_0x14fdfd){while(--_0x14fdfd){_0x29950b['push'](_0x29950b['shift']());}};_0x10b8db(++_0x1f817e);}(_0xacf4,0xe7));var _0x4acf=function(_0x503f4d,_0x476e97){_0x503f4d=_0x503f4d-0x0;var _0x4ce6d1=_0xacf4[_0x503f4d];return _0x4ce6d1;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x4acf('0x0')]={'phone':{'type':Sequelize[_0x4acf('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x4acf('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x4acf('0x3')],'defaultValue':moment()[_0x4acf('0x4')](_0x4acf('0x5'))},'countbusyretry':{'type':Sequelize[_0x4acf('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4acf('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x4acf('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4acf('0x3')]},'priority':{'type':Sequelize[_0x4acf('0x6')](0x2)[_0x4acf('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x4acf('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x4acf('0x6')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x4acf('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x4acf('0x6')],'unique':_0x4acf('0x8')},'CampaignId':{'type':Sequelize[_0x4acf('0x6')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4acf('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4acf('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x4acf('0x1')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x896e=['format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE'];(function(_0x1009ff,_0x10ac07){var _0x35cba0=function(_0x1d7fbc){while(--_0x1d7fbc){_0x1009ff['push'](_0x1009ff['shift']());}};_0x35cba0(++_0x10ac07);}(_0x896e,0x1e9));var _0xe896=function(_0x5780ad,_0x32a242){_0x5780ad=_0x5780ad-0x0;var _0x3d95ae=_0x896e[_0x5780ad];return _0x3d95ae;};'use strict';var moment=require(_0xe896('0x0'));var Sequelize=require(_0xe896('0x1'));module[_0xe896('0x2')]={'phone':{'type':Sequelize[_0xe896('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xe896('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xe896('0x5')],'defaultValue':moment()[_0xe896('0x6')](_0xe896('0x7'))},'countbusyretry':{'type':Sequelize[_0xe896('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe896('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe896('0x8')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xe896('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe896('0x5')]},'priority':{'type':Sequelize[_0xe896('0x8')](0x2)[_0xe896('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xe896('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xe896('0x8')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xe896('0x8')],'unique':_0xe896('0xa')},'UserId':{'type':Sequelize[_0xe896('0x8')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xe896('0xa')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0xe896('0x8')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe896('0x8')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe896('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe896('0x8')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0xe896('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index b15e813..f1d99ce 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 _0x7b10=['map','CmHopper','fieldName','type','query','filters','intersection','model','$and','$or','$gt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','create','body','describe','params','VoiceQueueId','CampaignId','Campaign','omit','state','statedesc','campaign','user','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','outbound','preview','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','dialOrderByScheduledAt','DESC','priority','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','recallme','LOCK','UPDATE','Contact','CmList','Queue','dialActive','getPreviewRecall','getVoiceQueues','scheduledat','Company','List','VoiceQueue','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','timezones','utcOffset','getTimezone','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','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','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','name','send'];(function(_0x576d8a,_0x2d7bde){var _0x3dc3ef=function(_0xc76758){while(--_0xc76758){_0x576d8a['push'](_0x576d8a['shift']());}};_0x3dc3ef(++_0x2d7bde);}(_0x7b10,0x1ac));var _0x07b1=function(_0x38ae89,_0x3cc519){_0x38ae89=_0x38ae89-0x0;var _0x347ddd=_0x7b10[_0x38ae89];return _0x347ddd;};'use strict';var emlformat=require(_0x07b1('0x0'));var rimraf=require(_0x07b1('0x1'));var zipdir=require(_0x07b1('0x2'));var jsonpatch=require(_0x07b1('0x3'));var rp=require(_0x07b1('0x4'));var moment=require('moment');var BPromise=require(_0x07b1('0x5'));var Mustache=require(_0x07b1('0x6'));var util=require(_0x07b1('0x7'));var path=require(_0x07b1('0x8'));var sox=require(_0x07b1('0x9'));var csv=require('to-csv');var ejs=require(_0x07b1('0xa'));var fs=require('fs');var fs_extra=require(_0x07b1('0xb'));var _=require(_0x07b1('0xc'));var squel=require(_0x07b1('0xd'));var crypto=require(_0x07b1('0xe'));var jsforce=require(_0x07b1('0xf'));var deskjs=require(_0x07b1('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x07b1('0x11'));var qs=require(_0x07b1('0x12'));var as=require(_0x07b1('0x13'));var hardwareService=require(_0x07b1('0x14'));var logger=require(_0x07b1('0x15'))(_0x07b1('0x16'));var utils=require(_0x07b1('0x17'));var config=require('../../config/environment');var shared=require(_0x07b1('0x18'));var licenseUtil=require(_0x07b1('0x19'));var db=require(_0x07b1('0x1a'))['db'];function respondWithStatusCode(_0x47e2e7,_0x2dccb2){_0x2dccb2=_0x2dccb2||0xcc;return function(_0x41955f){if(_0x41955f){return _0x47e2e7['sendStatus'](_0x2dccb2);}return _0x47e2e7[_0x07b1('0x1b')](_0x2dccb2)[_0x07b1('0x1c')]();};}function respondWithResult(_0x506383,_0x180b05){_0x180b05=_0x180b05||0xc8;return function(_0x47fd0e){if(_0x47fd0e){return _0x506383['status'](_0x180b05)[_0x07b1('0x1d')](_0x47fd0e);}};}function respondWithFilteredResult(_0x11a638,_0x31628c){return function(_0x1c3638){if(_0x1c3638){var _0x5a4858=typeof _0x31628c['offset']===_0x07b1('0x1e')&&typeof _0x31628c[_0x07b1('0x1f')]===_0x07b1('0x1e');var _0x5ae981=_0x1c3638[_0x07b1('0x20')];var _0x3ebc7c=_0x5a4858?0x0:_0x31628c[_0x07b1('0x21')];var _0x4f2231=_0x5a4858?_0x1c3638[_0x07b1('0x20')]:_0x31628c['offset']+_0x31628c['limit'];var _0x5d94e7;if(_0x4f2231>=_0x5ae981){_0x4f2231=_0x5ae981;_0x5d94e7=0xc8;}else{_0x5d94e7=0xce;}_0x11a638[_0x07b1('0x1b')](_0x5d94e7);return _0x11a638[_0x07b1('0x22')](_0x07b1('0x23'),_0x3ebc7c+'-'+_0x4f2231+'/'+_0x5ae981)['json'](_0x1c3638);}return null;};}function patchUpdates(_0x117de7){return function(_0x3a1792){try{jsonpatch[_0x07b1('0x24')](_0x3a1792,_0x117de7,!![]);}catch(_0x242721){return BPromise[_0x07b1('0x25')](_0x242721);}return _0x3a1792[_0x07b1('0x26')]();};}function saveUpdates(_0x59572a,_0x1dc2de){return function(_0x5bd40c){if(_0x5bd40c){return _0x5bd40c[_0x07b1('0x27')](_0x59572a)['then'](function(_0x162761){return _0x162761;});}return null;};}function removeEntity(_0x364214,_0x2f0a05){return function(_0x55b539){if(_0x55b539){return _0x55b539[_0x07b1('0x28')]()[_0x07b1('0x29')](function(){_0x364214[_0x07b1('0x1b')](0xcc)[_0x07b1('0x1c')]();});}};}function handleEntityNotFound(_0x452331,_0x4337af){return function(_0x434636){if(!_0x434636){_0x452331[_0x07b1('0x2a')](0x194);}return _0x434636;};}function handleError(_0x56dc18,_0x2db40d){_0x2db40d=_0x2db40d||0x1f4;return function(_0xaa8986){logger[_0x07b1('0x2b')](_0xaa8986['stack']);if(_0xaa8986[_0x07b1('0x2c')]){delete _0xaa8986['name'];}_0x56dc18[_0x07b1('0x1b')](_0x2db40d)[_0x07b1('0x2d')](_0xaa8986);};}exports['index']=function(_0x5950b9,_0x5710f8){var _0x281eaf={},_0x5017a5={},_0x43aefc={'count':0x0,'rows':[]};var _0x2e2c38=_[_0x07b1('0x2e')](db[_0x07b1('0x2f')]['rawAttributes'],function(_0xaa8ae9){return{'name':_0xaa8ae9[_0x07b1('0x30')],'type':_0xaa8ae9[_0x07b1('0x31')]['key']};});_0x5017a5['model']=_['map'](_0x2e2c38,_0x07b1('0x2c'));_0x5017a5['query']=_['keys'](_0x5950b9[_0x07b1('0x32')]);_0x5017a5[_0x07b1('0x33')]=_[_0x07b1('0x34')](_0x5017a5[_0x07b1('0x35')],_0x5017a5[_0x07b1('0x32')]);_0x5017a5[_0x07b1('0x33')]=_['concat'](_0x5017a5[_0x07b1('0x33')],[_0x07b1('0x36'),_0x07b1('0x37'),_0x07b1('0x38'),'$gte','$lt',_0x07b1('0x39'),_0x07b1('0x3a'),_0x07b1('0x3b'),_0x07b1('0x3c'),_0x07b1('0x3d'),_0x07b1('0x3e'),_0x07b1('0x3f'),_0x07b1('0x40'),_0x07b1('0x41'),'$notLike',_0x07b1('0x42'),_0x07b1('0x43'),'$like',_0x07b1('0x44'),_0x07b1('0x45'),_0x07b1('0x46'),_0x07b1('0x47')]);_0x281eaf[_0x07b1('0x48')]=_[_0x07b1('0x34')](_0x5017a5[_0x07b1('0x35')],qs['fields'](_0x5950b9[_0x07b1('0x32')][_0x07b1('0x49')]));_0x281eaf[_0x07b1('0x48')]=_0x281eaf['attributes'][_0x07b1('0x4a')]?_0x281eaf[_0x07b1('0x48')]:_0x5017a5[_0x07b1('0x35')];if(!_0x5950b9[_0x07b1('0x32')][_0x07b1('0x4b')](_0x07b1('0x4c'))){_0x281eaf[_0x07b1('0x1f')]=qs[_0x07b1('0x1f')](_0x5950b9[_0x07b1('0x32')][_0x07b1('0x1f')]);_0x281eaf[_0x07b1('0x21')]=qs[_0x07b1('0x21')](_0x5950b9[_0x07b1('0x32')][_0x07b1('0x21')]);}_0x281eaf['order']=qs[_0x07b1('0x4d')](_0x5950b9[_0x07b1('0x32')][_0x07b1('0x4d')]);_0x281eaf[_0x07b1('0x4e')]=qs['filters'](_[_0x07b1('0x4f')](_0x5950b9[_0x07b1('0x32')],_0x5017a5['filters']),_0x2e2c38);if(_0x5950b9[_0x07b1('0x32')][_0x07b1('0x50')]){_0x281eaf[_0x07b1('0x4e')]=_[_0x07b1('0x51')](_0x281eaf['where'],{'$or':_[_0x07b1('0x2e')](_0x2e2c38,function(_0x22ebe0){if(_0x22ebe0[_0x07b1('0x31')]!==_0x07b1('0x52')){var _0x1bd209={};_0x1bd209[_0x22ebe0[_0x07b1('0x2c')]]={'$like':'%'+_0x5950b9[_0x07b1('0x32')]['filter']+'%'};return _0x1bd209;}})});}_0x281eaf=_[_0x07b1('0x51')]({},_0x281eaf,_0x5950b9[_0x07b1('0x53')]);var _0x2a65ec={'where':_0x281eaf['where']};return db[_0x07b1('0x2f')][_0x07b1('0x20')](_0x2a65ec)['then'](function(_0x5394a6){_0x43aefc[_0x07b1('0x20')]=_0x5394a6;if(_0x5950b9[_0x07b1('0x32')][_0x07b1('0x54')]){_0x281eaf[_0x07b1('0x55')]=[{'all':!![]}];}return db[_0x07b1('0x2f')][_0x07b1('0x56')](_0x281eaf);})[_0x07b1('0x29')](function(_0x2aaf90){_0x43aefc[_0x07b1('0x57')]=_0x2aaf90;return _0x43aefc;})[_0x07b1('0x29')](respondWithFilteredResult(_0x5710f8,_0x281eaf))[_0x07b1('0x58')](handleError(_0x5710f8,null));};exports[_0x07b1('0x59')]=function(_0x52772c,_0x2f9ccb){var _0x51d2be={'raw':!![],'where':{'id':_0x52772c['params']['id']}},_0x4fea77={};_0x4fea77[_0x07b1('0x35')]=_[_0x07b1('0x5a')](db[_0x07b1('0x2f')][_0x07b1('0x5b')]);_0x4fea77[_0x07b1('0x32')]=_[_0x07b1('0x5a')](_0x52772c[_0x07b1('0x32')]);_0x4fea77[_0x07b1('0x33')]=_[_0x07b1('0x34')](_0x4fea77[_0x07b1('0x35')],_0x4fea77[_0x07b1('0x32')]);_0x51d2be[_0x07b1('0x48')]=_[_0x07b1('0x34')](_0x4fea77[_0x07b1('0x35')],qs[_0x07b1('0x49')](_0x52772c[_0x07b1('0x32')][_0x07b1('0x49')]));_0x51d2be[_0x07b1('0x48')]=_0x51d2be[_0x07b1('0x48')][_0x07b1('0x4a')]?_0x51d2be['attributes']:_0x4fea77[_0x07b1('0x35')];if(_0x52772c['query'][_0x07b1('0x54')]){_0x51d2be[_0x07b1('0x55')]=[{'all':!![]}];}_0x51d2be=_['merge']({},_0x51d2be,_0x52772c['options']);return db[_0x07b1('0x2f')][_0x07b1('0x5c')](_0x51d2be)[_0x07b1('0x29')](handleEntityNotFound(_0x2f9ccb,null))[_0x07b1('0x29')](respondWithResult(_0x2f9ccb,null))['catch'](handleError(_0x2f9ccb,null));};exports[_0x07b1('0x5d')]=function(_0x4210c6,_0x229ebf){return db[_0x07b1('0x2f')][_0x07b1('0x5d')](_0x4210c6[_0x07b1('0x5e')],{})[_0x07b1('0x29')](respondWithResult(_0x229ebf,0xc9))[_0x07b1('0x58')](handleError(_0x229ebf,null));};exports[_0x07b1('0x27')]=function(_0x29475b,_0x1fbc37){if(_0x29475b[_0x07b1('0x5e')]['id']){delete _0x29475b[_0x07b1('0x5e')]['id'];}return db['CmHopper'][_0x07b1('0x5c')]({'where':{'id':_0x29475b['params']['id']}})['then'](handleEntityNotFound(_0x1fbc37,null))[_0x07b1('0x29')](saveUpdates(_0x29475b['body'],null))[_0x07b1('0x29')](respondWithResult(_0x1fbc37,null))[_0x07b1('0x58')](handleError(_0x1fbc37,null));};exports[_0x07b1('0x5f')]=function(_0x5a93bd,_0x25ef9c){return db[_0x07b1('0x2f')][_0x07b1('0x5f')]()[_0x07b1('0x29')](respondWithResult(_0x25ef9c,null))[_0x07b1('0x58')](handleError(_0x25ef9c,null));};exports[_0x07b1('0x28')]=function(_0x2589dd,_0x3a6c4b){var _0x1587ee;return db['CmHopper'][_0x07b1('0x5c')]({'where':{'id':_0x2589dd[_0x07b1('0x60')]['id']}})[_0x07b1('0x29')](handleEntityNotFound(_0x3a6c4b,null))[_0x07b1('0x29')](function(_0x4741bc){if(_0x4741bc){return _0x4741bc[_0x07b1('0x28')]()[_0x07b1('0x29')](function(_0x175892){return _0x175892;});}})['then'](function(_0x3500ed){_0x1587ee=_0x3500ed;if(_0x3500ed){if(_0x3500ed[_0x07b1('0x61')]||_0x3500ed[_0x07b1('0x62')]){return db[_0x3500ed[_0x07b1('0x61')]?'VoiceQueue':_0x07b1('0x63')][_0x07b1('0x5c')]({'where':{'id':_0x3500ed[_0x07b1('0x61')]?_0x3500ed['VoiceQueueId']:_0x3500ed[_0x07b1('0x62')]},'attributes':['id',_0x07b1('0x2c')],'raw':!![]});}}})[_0x07b1('0x29')](function(_0x4bb730){var _0x428e9e={};if(_0x4bb730){_[_0x07b1('0x51')](_0x428e9e,_[_0x07b1('0x64')](_0x1587ee['dataValues'],['createdAt','updatedAt','id']));_0x428e9e[_0x07b1('0x65')]=0x15;_0x428e9e[_0x07b1('0x66')]='deleted';_0x428e9e[_0x07b1('0x67')]=_0x4bb730[_0x07b1('0x2c')];_0x428e9e['membername']=_0x2589dd[_0x07b1('0x68')][_0x07b1('0x2c')];_0x428e9e['UserId']=_0x2589dd[_0x07b1('0x68')]['id'];_0x428e9e[_0x07b1('0x69')]=!![];_0x428e9e[_0x07b1('0x6a')]=moment()[_0x07b1('0x6b')](_0x07b1('0x6c'));_0x428e9e[_0x07b1('0x6d')]=_0x1587ee[_0x07b1('0x6e')];_0x428e9e[_0x07b1('0x6f')]=_0x1587ee[_0x07b1('0x61')]?_0x07b1('0x70'):'ivr';return db[_0x07b1('0x71')]['find']({'where':{'id':_0x428e9e[_0x07b1('0x72')]},'attributes':[_0x07b1('0x73'),_0x07b1('0x74')]})[_0x07b1('0x29')](function(_0x28904e){if(!_['isNil'](_0x3a6c4b)&&!_[_0x07b1('0x75')](_0x28904e[_0x07b1('0x73')])){_0x428e9e['calleridname']=_0x28904e['firstName'];if(!_['isNil'](_0x28904e[_0x07b1('0x74')])){_0x428e9e[_0x07b1('0x76')]+='\x20'+_0x28904e[_0x07b1('0x74')];}}})[_0x07b1('0x77')](function(){return db[_0x07b1('0x78')]['create'](_0x428e9e);});}})[_0x07b1('0x29')](function(){return _0x3a6c4b['status'](0xcc)['end']();})[_0x07b1('0x58')](handleError(_0x3a6c4b,null));};exports[_0x07b1('0x79')]=function(_0x13c765,_0xf577e6,_0x29d2d9){var _0x281e50=[];return db[_0x07b1('0x71')][_0x07b1('0x5f')]()['then'](function(_0xb7d08f){_0x281e50=_['keys'](_0xb7d08f);return _0x13c765[_0x07b1('0x68')]['getVoiceQueues']({'where':{'type':_0x07b1('0x7a'),'dialActive':!![],'dialMethod':_0x07b1('0x7b')},'attributes':['id','dialOrderByScheduledAt',_0x07b1('0x7c')],'raw':!![]});})['then'](function(_0x572eaa){if(_0x572eaa&&_0x572eaa[_0x07b1('0x4a')]){return db[_0x07b1('0x7d')][_0x07b1('0x7e')](function(_0x289996){var _0x120231={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x07b1('0x6b')](_0x07b1('0x6c'))},'VoiceQueueId':{'$in':_[_0x07b1('0x2e')](_0x572eaa,'id')},'$or':[{'UserId':null},{'UserId':_0x13c765[_0x07b1('0x68')]['id']}]};var _0x2b6463={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x572eaa)[_0x07b1('0x50')]([_0x07b1('0x7c'),0x0])[_0x07b1('0x2e')]('id')[_0x07b1('0x7f')]()},'$or':[{'UserId':null},{'UserId':_0x13c765[_0x07b1('0x68')]['id']}]};var _0x647ce1={'$or':[_0x120231,_0x2b6463]};var _0x4c6d63=[];if(_0x13c765[_0x07b1('0x5e')][_0x07b1('0x80')]&&_0x13c765[_0x07b1('0x5e')][_0x07b1('0x80')]===_0x07b1('0x81')){if(!_[_0x07b1('0x82')](_0x13c765[_0x07b1('0x5e')][_0x07b1('0x83')])){_0x647ce1['id']={'$in':_0x13c765[_0x07b1('0x5e')][_0x07b1('0x83')]};}_0x4c6d63=[['priority',_0x07b1('0x84')],[_0x07b1('0x85'),_0x572eaa[0x0][_0x07b1('0x86')]===_0x07b1('0x84')?_0x07b1('0x87'):_0x07b1('0x84')],db[_0x07b1('0x7d')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id','DESC']];}else{if(!_[_0x07b1('0x82')](_0x13c765[_0x07b1('0x5e')][_0x07b1('0x83')])){_0x647ce1['id']={'$notIn':_0x13c765[_0x07b1('0x5e')][_0x07b1('0x83')]};}_0x4c6d63=[[_0x07b1('0x88'),_0x07b1('0x87')],[_0x07b1('0x85'),_0x572eaa[0x0][_0x07b1('0x86')]],db[_0x07b1('0x7d')]['literal'](_0x07b1('0x89')),['id',_0x07b1('0x84')]];}return db[_0x07b1('0x2f')][_0x07b1('0x8a')]({'attributes':['id','scheduledat',_0x07b1('0x8b')],'where':_0x647ce1,'order':_0x4c6d63,'transaction':_0x289996,'lock':_0x289996[_0x07b1('0x8c')][_0x07b1('0x8d')],'include':[{'model':db[_0x07b1('0x71')],'as':_0x07b1('0x8e'),'attributes':_0x281e50,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id',_0x07b1('0x2c')]}]},{'model':db[_0x07b1('0x8f')],'as':'List','attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0x07b1('0x90'),'attributes':['id',_0x07b1('0x2c'),_0x07b1('0x91')]}]})[_0x07b1('0x29')](function(_0x5885da){if(_0x5885da){return _0x5885da[_0x07b1('0x27')]({'UserId':_0x13c765[_0x07b1('0x68')]['id']},{'transaction':_0x289996});}});});}})[_0x07b1('0x29')](handleEntityNotFound(_0xf577e6,null))[_0x07b1('0x29')](respondWithResult(_0xf577e6,null))[_0x07b1('0x58')](handleError(_0xf577e6,null));};exports[_0x07b1('0x92')]=function(_0x4df6f3,_0x5ce928,_0x28af70){var _0x520168=[];return db['CmContact'][_0x07b1('0x5f')]()[_0x07b1('0x29')](function(_0x477332){_0x520168=_[_0x07b1('0x5a')](_0x477332);return _0x4df6f3['user'][_0x07b1('0x93')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x07b1('0x7b')},'attributes':['id','dialOrderByScheduledAt',_0x07b1('0x7c')],'raw':!![]});})['then'](function(_0x2ab114){if(_0x2ab114&&_0x2ab114[_0x07b1('0x4a')]){return db[_0x07b1('0x7d')][_0x07b1('0x7e')](function(_0x1a2e1b){var _0x274c3a={'active':![],'recallme':!![],'id':_0x4df6f3[_0x07b1('0x5e')]['hopperId']};return db[_0x07b1('0x2f')]['findOne']({'attributes':['id',_0x07b1('0x94'),_0x07b1('0x8b')],'where':_0x274c3a,'transaction':_0x1a2e1b,'lock':_0x1a2e1b[_0x07b1('0x8c')][_0x07b1('0x8d')],'include':[{'model':db[_0x07b1('0x71')],'as':_0x07b1('0x8e'),'attributes':_0x520168,'include':[{'model':db['CmCompany'],'as':_0x07b1('0x95'),'attributes':['id',_0x07b1('0x2c')]}]},{'model':db[_0x07b1('0x8f')],'as':_0x07b1('0x96'),'attributes':['id',_0x07b1('0x2c')]},{'model':db[_0x07b1('0x97')],'as':_0x07b1('0x90'),'attributes':['id',_0x07b1('0x2c'),_0x07b1('0x91')]}]})['then'](function(_0x4c3792){if(_0x4c3792){return _0x4c3792[_0x07b1('0x27')]({'UserId':_0x4df6f3['user']['id']},{'transaction':_0x1a2e1b});}});});}})['then'](handleEntityNotFound(_0x5ce928,null))[_0x07b1('0x29')](respondWithResult(_0x5ce928,null))[_0x07b1('0x58')](handleError(_0x5ce928,null));};exports[_0x07b1('0x98')]=function(_0x135070,_0x3f4891,_0x1e7702){return _0x135070[_0x07b1('0x68')]['getVoiceQueues']({'where':{'type':_0x07b1('0x7a'),'dialActive':!![],'dialMethod':_0x07b1('0x7b')},'attributes':['id'],'raw':!![]})[_0x07b1('0x29')](function(_0x271fd0){if(_0x271fd0&&_0x271fd0['length']){return db[_0x07b1('0x2f')][_0x07b1('0x20')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x07b1('0x6b')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x07b1('0x2e')](_0x271fd0,'id')},'$or':[{'UserId':null},{'UserId':_0x135070[_0x07b1('0x68')]['id']}]}});}return 0x0;})[_0x07b1('0x29')](function(_0x399c75){if(!_[_0x07b1('0x75')](_0x399c75)&&_[_0x07b1('0x99')](_0x399c75)){return _0x3f4891[_0x07b1('0x1b')](0xc8)[_0x07b1('0x1d')]({'contacts':_0x399c75});}else{logger[_0x07b1('0x2b')](_0x07b1('0x9a'),'getOpenContacts',0x194,'entity\x20not\x20found');_0x3f4891[_0x07b1('0x2a')](0x194);}})[_0x07b1('0x58')](handleError(_0x3f4891,null));};exports['getTimezones']=function(_0x235bd5,_0x5d00c8,_0xd2aea1){var _0x3834bd=shared[_0x07b1('0x9b')];var _0x938c02=[];_['map'](_0x3834bd,function(_0x225c30){_0x938c02['push']({'id':_0x225c30['name'],'name':_0x225c30[_0x07b1('0x2c')],'utcOffset':_0x225c30[_0x07b1('0x9c')]});});return _0x5d00c8[_0x07b1('0x1b')](0xc8)[_0x07b1('0x1d')]({'tz':_0x938c02});};exports[_0x07b1('0x9d')]=function(_0x48e9af,_0x3d6884,_0x49dbe2){var _0x2bf1ec=shared['timezones'];var _0x57f3f={};if(!_[_0x07b1('0x75')](_0x2bf1ec[_0x48e9af[_0x07b1('0x5e')]['id']]))_0x57f3f=_0x2bf1ec[_0x48e9af[_0x07b1('0x5e')]['id']];return _0x3d6884[_0x07b1('0x1b')](0xc8)['json'](_0x57f3f);}; \ No newline at end of file +var _0x7e93=['sendStatus','error','stack','name','send','index','type','key','model','query','keys','filters','concat','$and','$or','$gt','$gte','$lt','$lte','$eq','$not','$between','$notBetween','$in','$notIn','$like','$iLike','$overlap','$contains','$contained','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','map','VIRTUAL','options','CmHopper','then','include','findAll','catch','show','params','includeAll','find','create','body','destroy','VoiceQueueId','VoiceQueue','omit','updatedAt','state','deleted','campaign','membername','user','deletedat','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','isNil','lastName','calleridname','finally','CmHopperFinal','getPreview','describe','outbound','preview','sequelize','transaction','YYYY-MM-DD\x20HH:mm:ss','dialPreviewAutoRecallMe','value','direction','prev','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','dialOrderByScheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','LOCK','UPDATE','Contact','CmList','dialActive','getPreviewRecall','hopperId','Company','List','Queue','getOpenContacts','format','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update'];(function(_0x7a35b1,_0x925417){var _0x3c4535=function(_0x140109){while(--_0x140109){_0x7a35b1['push'](_0x7a35b1['shift']());}};_0x3c4535(++_0x925417);}(_0x7e93,0x78));var _0x37e9=function(_0x4d15a8,_0x5242ed){_0x4d15a8=_0x4d15a8-0x0;var _0x55f3b6=_0x7e93[_0x4d15a8];return _0x55f3b6;};'use strict';var emlformat=require(_0x37e9('0x0'));var rimraf=require(_0x37e9('0x1'));var zipdir=require(_0x37e9('0x2'));var jsonpatch=require(_0x37e9('0x3'));var rp=require('request-promise');var moment=require(_0x37e9('0x4'));var BPromise=require(_0x37e9('0x5'));var Mustache=require('mustache');var util=require(_0x37e9('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x37e9('0x7'));var ejs=require(_0x37e9('0x8'));var fs=require('fs');var fs_extra=require(_0x37e9('0x9'));var _=require('lodash');var squel=require(_0x37e9('0xa'));var crypto=require(_0x37e9('0xb'));var jsforce=require(_0x37e9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x37e9('0x7'));var querystring=require(_0x37e9('0xd'));var Papa=require(_0x37e9('0xe'));var Redis=require(_0x37e9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x37e9('0x10'));var as=require(_0x37e9('0x11'));var hardwareService=require(_0x37e9('0x12'));var logger=require(_0x37e9('0x13'))(_0x37e9('0x14'));var utils=require(_0x37e9('0x15'));var config=require(_0x37e9('0x16'));var shared=require(_0x37e9('0x16'));var licenseUtil=require(_0x37e9('0x17'));var db=require(_0x37e9('0x18'))['db'];function respondWithStatusCode(_0x22e7dc,_0xb416ff){_0xb416ff=_0xb416ff||0xcc;return function(_0x4daae1){if(_0x4daae1){return _0x22e7dc['sendStatus'](_0xb416ff);}return _0x22e7dc[_0x37e9('0x19')](_0xb416ff)[_0x37e9('0x1a')]();};}function respondWithResult(_0x160eb2,_0x2a8c56){_0x2a8c56=_0x2a8c56||0xc8;return function(_0x2b2afd){if(_0x2b2afd){return _0x160eb2[_0x37e9('0x19')](_0x2a8c56)[_0x37e9('0x1b')](_0x2b2afd);}};}function respondWithFilteredResult(_0x3fc9a8,_0x5323bd){return function(_0x113b90){if(_0x113b90){var _0x3ffa1c=typeof _0x5323bd[_0x37e9('0x1c')]==='undefined'&&typeof _0x5323bd[_0x37e9('0x1d')]===_0x37e9('0x1e');var _0x1dfb06=_0x113b90[_0x37e9('0x1f')];var _0x2cb032=_0x3ffa1c?0x0:_0x5323bd[_0x37e9('0x1c')];var _0x4bbd62=_0x3ffa1c?_0x113b90[_0x37e9('0x1f')]:_0x5323bd[_0x37e9('0x1c')]+_0x5323bd[_0x37e9('0x1d')];var _0x263c66;if(_0x4bbd62>=_0x1dfb06){_0x4bbd62=_0x1dfb06;_0x263c66=0xc8;}else{_0x263c66=0xce;}_0x3fc9a8[_0x37e9('0x19')](_0x263c66);return _0x3fc9a8[_0x37e9('0x20')](_0x37e9('0x21'),_0x2cb032+'-'+_0x4bbd62+'/'+_0x1dfb06)[_0x37e9('0x1b')](_0x113b90);}return null;};}function patchUpdates(_0x425c8e){return function(_0x46f2ee){try{jsonpatch[_0x37e9('0x22')](_0x46f2ee,_0x425c8e,!![]);}catch(_0x2b6f71){return BPromise['reject'](_0x2b6f71);}return _0x46f2ee['save']();};}function saveUpdates(_0x454be6,_0x5e80ee){return function(_0xcc175d){if(_0xcc175d){return _0xcc175d[_0x37e9('0x23')](_0x454be6)['then'](function(_0x3faedd){return _0x3faedd;});}return null;};}function removeEntity(_0x49af9e,_0x26dab4){return function(_0x456fa8){if(_0x456fa8){return _0x456fa8['destroy']()['then'](function(){_0x49af9e[_0x37e9('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1107a5,_0x392839){return function(_0x4a8d07){if(!_0x4a8d07){_0x1107a5[_0x37e9('0x24')](0x194);}return _0x4a8d07;};}function handleError(_0x1f2883,_0x41aa29){_0x41aa29=_0x41aa29||0x1f4;return function(_0x3cc9a1){logger[_0x37e9('0x25')](_0x3cc9a1[_0x37e9('0x26')]);if(_0x3cc9a1['name']){delete _0x3cc9a1[_0x37e9('0x27')];}_0x1f2883[_0x37e9('0x19')](_0x41aa29)[_0x37e9('0x28')](_0x3cc9a1);};}exports[_0x37e9('0x29')]=function(_0x1abfea,_0x1b7287){var _0xa5086f={},_0x84b1f8={},_0x635f4c={'count':0x0,'rows':[]};var _0x5956ad=_['map'](db['CmHopper']['rawAttributes'],function(_0x5b196a){return{'name':_0x5b196a['fieldName'],'type':_0x5b196a[_0x37e9('0x2a')][_0x37e9('0x2b')]};});_0x84b1f8[_0x37e9('0x2c')]=_['map'](_0x5956ad,_0x37e9('0x27'));_0x84b1f8[_0x37e9('0x2d')]=_[_0x37e9('0x2e')](_0x1abfea[_0x37e9('0x2d')]);_0x84b1f8[_0x37e9('0x2f')]=_['intersection'](_0x84b1f8[_0x37e9('0x2c')],_0x84b1f8[_0x37e9('0x2d')]);_0x84b1f8['filters']=_[_0x37e9('0x30')](_0x84b1f8[_0x37e9('0x2f')],[_0x37e9('0x31'),_0x37e9('0x32'),_0x37e9('0x33'),_0x37e9('0x34'),_0x37e9('0x35'),_0x37e9('0x36'),'$ne',_0x37e9('0x37'),_0x37e9('0x38'),_0x37e9('0x39'),_0x37e9('0x3a'),_0x37e9('0x3b'),_0x37e9('0x3c'),_0x37e9('0x3d'),'$notLike',_0x37e9('0x3e'),'$notILike','$like',_0x37e9('0x3f'),_0x37e9('0x40'),_0x37e9('0x41'),'$any']);_0xa5086f[_0x37e9('0x42')]=_[_0x37e9('0x43')](_0x84b1f8[_0x37e9('0x2c')],qs[_0x37e9('0x44')](_0x1abfea['query']['fields']));_0xa5086f['attributes']=_0xa5086f[_0x37e9('0x42')][_0x37e9('0x45')]?_0xa5086f['attributes']:_0x84b1f8[_0x37e9('0x2c')];if(!_0x1abfea[_0x37e9('0x2d')][_0x37e9('0x46')](_0x37e9('0x47'))){_0xa5086f[_0x37e9('0x1d')]=qs[_0x37e9('0x1d')](_0x1abfea['query'][_0x37e9('0x1d')]);_0xa5086f[_0x37e9('0x1c')]=qs['offset'](_0x1abfea['query'][_0x37e9('0x1c')]);}_0xa5086f[_0x37e9('0x48')]=qs[_0x37e9('0x49')](_0x1abfea[_0x37e9('0x2d')][_0x37e9('0x49')]);_0xa5086f['where']=qs[_0x37e9('0x2f')](_['pick'](_0x1abfea['query'],_0x84b1f8[_0x37e9('0x2f')]),_0x5956ad);if(_0x1abfea['query'][_0x37e9('0x4a')]){_0xa5086f[_0x37e9('0x4b')]=_[_0x37e9('0x4c')](_0xa5086f[_0x37e9('0x4b')],{'$or':_[_0x37e9('0x4d')](_0x5956ad,function(_0xd71ddb){if(_0xd71ddb[_0x37e9('0x2a')]!==_0x37e9('0x4e')){var _0xce7adf={};_0xce7adf[_0xd71ddb[_0x37e9('0x27')]]={'$like':'%'+_0x1abfea['query'][_0x37e9('0x4a')]+'%'};return _0xce7adf;}})});}_0xa5086f=_[_0x37e9('0x4c')]({},_0xa5086f,_0x1abfea[_0x37e9('0x4f')]);var _0x4ce4a9={'where':_0xa5086f[_0x37e9('0x4b')]};return db[_0x37e9('0x50')]['count'](_0x4ce4a9)[_0x37e9('0x51')](function(_0x4f4454){_0x635f4c[_0x37e9('0x1f')]=_0x4f4454;if(_0x1abfea[_0x37e9('0x2d')]['includeAll']){_0xa5086f[_0x37e9('0x52')]=[{'all':!![]}];}return db[_0x37e9('0x50')][_0x37e9('0x53')](_0xa5086f);})[_0x37e9('0x51')](function(_0x3b410c){_0x635f4c['rows']=_0x3b410c;return _0x635f4c;})[_0x37e9('0x51')](respondWithFilteredResult(_0x1b7287,_0xa5086f))[_0x37e9('0x54')](handleError(_0x1b7287,null));};exports[_0x37e9('0x55')]=function(_0x2d1583,_0x122782){var _0x2e670e={'raw':!![],'where':{'id':_0x2d1583[_0x37e9('0x56')]['id']}},_0x2e44dd={};_0x2e44dd[_0x37e9('0x2c')]=_[_0x37e9('0x2e')](db[_0x37e9('0x50')]['rawAttributes']);_0x2e44dd[_0x37e9('0x2d')]=_[_0x37e9('0x2e')](_0x2d1583[_0x37e9('0x2d')]);_0x2e44dd[_0x37e9('0x2f')]=_[_0x37e9('0x43')](_0x2e44dd['model'],_0x2e44dd[_0x37e9('0x2d')]);_0x2e670e['attributes']=_['intersection'](_0x2e44dd[_0x37e9('0x2c')],qs[_0x37e9('0x44')](_0x2d1583['query'][_0x37e9('0x44')]));_0x2e670e['attributes']=_0x2e670e[_0x37e9('0x42')][_0x37e9('0x45')]?_0x2e670e['attributes']:_0x2e44dd['model'];if(_0x2d1583[_0x37e9('0x2d')][_0x37e9('0x57')]){_0x2e670e[_0x37e9('0x52')]=[{'all':!![]}];}_0x2e670e=_[_0x37e9('0x4c')]({},_0x2e670e,_0x2d1583['options']);return db[_0x37e9('0x50')][_0x37e9('0x58')](_0x2e670e)[_0x37e9('0x51')](handleEntityNotFound(_0x122782,null))[_0x37e9('0x51')](respondWithResult(_0x122782,null))[_0x37e9('0x54')](handleError(_0x122782,null));};exports[_0x37e9('0x59')]=function(_0x1ea94e,_0x24c968){return db['CmHopper'][_0x37e9('0x59')](_0x1ea94e['body'],{})['then'](respondWithResult(_0x24c968,0xc9))[_0x37e9('0x54')](handleError(_0x24c968,null));};exports[_0x37e9('0x23')]=function(_0x48bd74,_0x8c126a){if(_0x48bd74['body']['id']){delete _0x48bd74['body']['id'];}return db[_0x37e9('0x50')]['find']({'where':{'id':_0x48bd74[_0x37e9('0x56')]['id']}})[_0x37e9('0x51')](handleEntityNotFound(_0x8c126a,null))['then'](saveUpdates(_0x48bd74[_0x37e9('0x5a')],null))[_0x37e9('0x51')](respondWithResult(_0x8c126a,null))[_0x37e9('0x54')](handleError(_0x8c126a,null));};exports['describe']=function(_0x12e59b,_0x20cda3){return db[_0x37e9('0x50')]['describe']()['then'](respondWithResult(_0x20cda3,null))[_0x37e9('0x54')](handleError(_0x20cda3,null));};exports['destroy']=function(_0xdb1218,_0x40ae28){var _0x5045b3;return db[_0x37e9('0x50')][_0x37e9('0x58')]({'where':{'id':_0xdb1218['params']['id']}})[_0x37e9('0x51')](handleEntityNotFound(_0x40ae28,null))[_0x37e9('0x51')](function(_0xc40fcc){if(_0xc40fcc){return _0xc40fcc[_0x37e9('0x5b')]()[_0x37e9('0x51')](function(_0x481047){return _0x481047;});}})[_0x37e9('0x51')](function(_0x10b0a4){_0x5045b3=_0x10b0a4;if(_0x10b0a4){if(_0x10b0a4[_0x37e9('0x5c')]||_0x10b0a4['CampaignId']){return db[_0x10b0a4[_0x37e9('0x5c')]?_0x37e9('0x5d'):'Campaign'][_0x37e9('0x58')]({'where':{'id':_0x10b0a4[_0x37e9('0x5c')]?_0x10b0a4[_0x37e9('0x5c')]:_0x10b0a4['CampaignId']},'attributes':['id',_0x37e9('0x27')],'raw':!![]});}}})[_0x37e9('0x51')](function(_0xd966e5){var _0xd69db4={};if(_0xd966e5){_[_0x37e9('0x4c')](_0xd69db4,_[_0x37e9('0x5e')](_0x5045b3['dataValues'],['createdAt',_0x37e9('0x5f'),'id']));_0xd69db4[_0x37e9('0x60')]=0x15;_0xd69db4['statedesc']=_0x37e9('0x61');_0xd69db4[_0x37e9('0x62')]=_0xd966e5[_0x37e9('0x27')];_0xd69db4[_0x37e9('0x63')]=_0xdb1218[_0x37e9('0x64')]['name'];_0xd69db4['UserId']=_0xdb1218[_0x37e9('0x64')]['id'];_0xd69db4[_0x37e9('0x61')]=!![];_0xd69db4[_0x37e9('0x65')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xd69db4[_0x37e9('0x66')]=_0x5045b3[_0x37e9('0x67')];_0xd69db4[_0x37e9('0x68')]=_0x5045b3[_0x37e9('0x5c')]?_0x37e9('0x69'):_0x37e9('0x6a');return db[_0x37e9('0x6b')][_0x37e9('0x58')]({'where':{'id':_0xd69db4[_0x37e9('0x6c')]},'attributes':['firstName','lastName']})['then'](function(_0xf2db27){if(!_['isNil'](_0x40ae28)&&!_['isNil'](_0xf2db27['firstName'])){_0xd69db4['calleridname']=_0xf2db27['firstName'];if(!_[_0x37e9('0x6d')](_0xf2db27[_0x37e9('0x6e')])){_0xd69db4[_0x37e9('0x6f')]+='\x20'+_0xf2db27['lastName'];}}})[_0x37e9('0x70')](function(){return db[_0x37e9('0x71')][_0x37e9('0x59')](_0xd69db4);});}})[_0x37e9('0x51')](function(){return _0x40ae28[_0x37e9('0x19')](0xcc)[_0x37e9('0x1a')]();})[_0x37e9('0x54')](handleError(_0x40ae28,null));};exports[_0x37e9('0x72')]=function(_0x5ad597,_0x354d6f,_0x3c581b){var _0x576c20=[];return db['CmContact'][_0x37e9('0x73')]()['then'](function(_0x3c902e){_0x576c20=_[_0x37e9('0x2e')](_0x3c902e);return _0x5ad597[_0x37e9('0x64')]['getVoiceQueues']({'where':{'type':_0x37e9('0x74'),'dialActive':!![],'dialMethod':_0x37e9('0x75')},'attributes':['id','dialOrderByScheduledAt','dialPreviewAutoRecallMe'],'raw':!![]});})[_0x37e9('0x51')](function(_0x37cecb){if(_0x37cecb&&_0x37cecb[_0x37e9('0x45')]){return db[_0x37e9('0x76')][_0x37e9('0x77')](function(_0x352a71){var _0x2350f2={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x37e9('0x78'))},'VoiceQueueId':{'$in':_[_0x37e9('0x4d')](_0x37cecb,'id')},'$or':[{'UserId':null},{'UserId':_0x5ad597['user']['id']}]};var _0x5632b3={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x37cecb)[_0x37e9('0x4a')]([_0x37e9('0x79'),0x0])[_0x37e9('0x4d')]('id')[_0x37e9('0x7a')]()},'$or':[{'UserId':null},{'UserId':_0x5ad597[_0x37e9('0x64')]['id']}]};var _0x5a2940={'$or':[_0x2350f2,_0x5632b3]};var _0x5c861c=[];if(_0x5ad597[_0x37e9('0x5a')][_0x37e9('0x7b')]&&_0x5ad597[_0x37e9('0x5a')]['direction']===_0x37e9('0x7c')){if(!_['isEmpty'](_0x5ad597[_0x37e9('0x5a')]['hopperIds'])){_0x5a2940['id']={'$in':_0x5ad597[_0x37e9('0x5a')][_0x37e9('0x7d')]};}_0x5c861c=[[_0x37e9('0x7e'),_0x37e9('0x7f')],[_0x37e9('0x80'),_0x37cecb[0x0]['dialOrderByScheduledAt']==='ASC'?_0x37e9('0x81'):'ASC'],db[_0x37e9('0x76')][_0x37e9('0x82')](_0x37e9('0x83')),['id',_0x37e9('0x81')]];}else{if(!_['isEmpty'](_0x5ad597[_0x37e9('0x5a')][_0x37e9('0x7d')])){_0x5a2940['id']={'$notIn':_0x5ad597[_0x37e9('0x5a')][_0x37e9('0x7d')]};}_0x5c861c=[[_0x37e9('0x7e'),_0x37e9('0x81')],['scheduledAt',_0x37cecb[0x0][_0x37e9('0x84')]],db[_0x37e9('0x76')]['literal'](_0x37e9('0x85')),['id',_0x37e9('0x7f')]];}return db['CmHopper'][_0x37e9('0x86')]({'attributes':['id',_0x37e9('0x87'),_0x37e9('0x88')],'where':_0x5a2940,'order':_0x5c861c,'transaction':_0x352a71,'lock':_0x352a71[_0x37e9('0x89')][_0x37e9('0x8a')],'include':[{'model':db[_0x37e9('0x6b')],'as':_0x37e9('0x8b'),'attributes':_0x576c20,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id',_0x37e9('0x27')]}]},{'model':db[_0x37e9('0x8c')],'as':'List','attributes':['id',_0x37e9('0x27')]},{'model':db[_0x37e9('0x5d')],'as':'Queue','attributes':['id',_0x37e9('0x27'),_0x37e9('0x8d')]}]})[_0x37e9('0x51')](function(_0x17a0c0){if(_0x17a0c0){return _0x17a0c0[_0x37e9('0x23')]({'UserId':_0x5ad597[_0x37e9('0x64')]['id']},{'transaction':_0x352a71});}});});}})[_0x37e9('0x51')](handleEntityNotFound(_0x354d6f,null))[_0x37e9('0x51')](respondWithResult(_0x354d6f,null))[_0x37e9('0x54')](handleError(_0x354d6f,null));};exports[_0x37e9('0x8e')]=function(_0x5d4782,_0x1d42ae,_0x124577){var _0x3991f4=[];return db[_0x37e9('0x6b')][_0x37e9('0x73')]()[_0x37e9('0x51')](function(_0x20d469){_0x3991f4=_[_0x37e9('0x2e')](_0x20d469);return _0x5d4782['user']['getVoiceQueues']({'where':{'type':_0x37e9('0x74'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x37e9('0x84'),_0x37e9('0x79')],'raw':!![]});})[_0x37e9('0x51')](function(_0x1826ec){if(_0x1826ec&&_0x1826ec[_0x37e9('0x45')]){return db[_0x37e9('0x76')]['transaction'](function(_0x44eee1){var _0x2b2321={'active':![],'recallme':!![],'id':_0x5d4782[_0x37e9('0x5a')][_0x37e9('0x8f')]};return db[_0x37e9('0x50')][_0x37e9('0x86')]({'attributes':['id',_0x37e9('0x87'),'recallme'],'where':_0x2b2321,'transaction':_0x44eee1,'lock':_0x44eee1['LOCK'][_0x37e9('0x8a')],'include':[{'model':db[_0x37e9('0x6b')],'as':_0x37e9('0x8b'),'attributes':_0x3991f4,'include':[{'model':db['CmCompany'],'as':_0x37e9('0x90'),'attributes':['id',_0x37e9('0x27')]}]},{'model':db[_0x37e9('0x8c')],'as':_0x37e9('0x91'),'attributes':['id',_0x37e9('0x27')]},{'model':db[_0x37e9('0x5d')],'as':_0x37e9('0x92'),'attributes':['id',_0x37e9('0x27'),_0x37e9('0x8d')]}]})[_0x37e9('0x51')](function(_0xcc90c0){if(_0xcc90c0){return _0xcc90c0[_0x37e9('0x23')]({'UserId':_0x5d4782[_0x37e9('0x64')]['id']},{'transaction':_0x44eee1});}});});}})[_0x37e9('0x51')](handleEntityNotFound(_0x1d42ae,null))[_0x37e9('0x51')](respondWithResult(_0x1d42ae,null))[_0x37e9('0x54')](handleError(_0x1d42ae,null));};exports[_0x37e9('0x93')]=function(_0x1de745,_0x41c859,_0x3821e3){return _0x1de745[_0x37e9('0x64')]['getVoiceQueues']({'where':{'type':_0x37e9('0x74'),'dialActive':!![],'dialMethod':_0x37e9('0x75')},'attributes':['id'],'raw':!![]})[_0x37e9('0x51')](function(_0x4e101a){if(_0x4e101a&&_0x4e101a[_0x37e9('0x45')]){return db['CmHopper'][_0x37e9('0x1f')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x37e9('0x94')](_0x37e9('0x78'))},'VoiceQueueId':{'$in':_[_0x37e9('0x4d')](_0x4e101a,'id')},'$or':[{'UserId':null},{'UserId':_0x1de745[_0x37e9('0x64')]['id']}]}});}return 0x0;})[_0x37e9('0x51')](function(_0x357279){if(!_[_0x37e9('0x6d')](_0x357279)&&_['isNumber'](_0x357279)){return _0x41c859[_0x37e9('0x19')](0xc8)[_0x37e9('0x1b')]({'contacts':_0x357279});}else{logger['error'](_0x37e9('0x95'),'getOpenContacts',0x194,_0x37e9('0x96'));_0x41c859['sendStatus'](0x194);}})[_0x37e9('0x54')](handleError(_0x41c859,null));};exports[_0x37e9('0x97')]=function(_0x29edaf,_0x9c4cff,_0x5059e4){var _0x35b33f=shared[_0x37e9('0x98')];var _0x1ec9c6=[];_['map'](_0x35b33f,function(_0x562810){_0x1ec9c6[_0x37e9('0x99')]({'id':_0x562810[_0x37e9('0x27')],'name':_0x562810['name'],'utcOffset':_0x562810[_0x37e9('0x9a')]});});return _0x9c4cff[_0x37e9('0x19')](0xc8)[_0x37e9('0x1b')]({'tz':_0x1ec9c6});};exports[_0x37e9('0x9b')]=function(_0x2d5ee7,_0x2fa0ee,_0x5a079e){var _0xc7a2f9=shared[_0x37e9('0x98')];var _0x57ab9f={};if(!_['isNil'](_0xc7a2f9[_0x2d5ee7['body']['id']]))_0x57ab9f=_0xc7a2f9[_0x2d5ee7[_0x37e9('0x5a')]['id']];return _0x2fa0ee[_0x37e9('0x19')](0xc8)[_0x37e9('0x1b')](_0x57ab9f);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 1f1c202..d5a4a16 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 _0x2675=['path','rimraf','./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone','priority','lodash','moment','bluebird'];(function(_0x14e1cb,_0xd3465e){var _0x18a337=function(_0x3b97f3){while(--_0x3b97f3){_0x14e1cb['push'](_0x14e1cb['shift']());}};_0x18a337(++_0xd3465e);}(_0x2675,0x75));var _0x5267=function(_0x4d5e44,_0x18a577){_0x4d5e44=_0x4d5e44-0x0;var _0x4921d2=_0x2675[_0x4d5e44];return _0x4921d2;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5267('0x1'));var BPromise=require(_0x5267('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5267('0x3'));var rimraf=require(_0x5267('0x4'));var config=require('../../config/environment');var attributes=require(_0x5267('0x5'));module[_0x5267('0x6')]=function(_0x4bd042,_0x10f92c){return _0x4bd042[_0x5267('0x7')](_0x5267('0x8'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x5267('0x9'),'fields':[_0x5267('0x9')]},{'name':'phone','fields':[_0x5267('0xa')]},{'name':'priority','fields':[_0x5267('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5496=['request-promise','rimraf','../../config/environment','./cmHopper.attributes','define','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment'];(function(_0x5bf00b,_0x89acc0){var _0x2fe3b8=function(_0x6dc99d){while(--_0x6dc99d){_0x5bf00b['push'](_0x5bf00b['shift']());}};_0x2fe3b8(++_0x89acc0);}(_0x5496,0x175));var _0x6549=function(_0x1424c5,_0x1e8e61){_0x1424c5=_0x1424c5-0x0;var _0x5f1a99=_0x5496[_0x1424c5];return _0x5f1a99;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));module['exports']=function(_0x5a4658,_0x43cb17){return _0x5a4658[_0x6549('0x9')]('CmHopper',attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[{'name':_0x6549('0xb'),'fields':[_0x6549('0xb')]},{'name':'phone','fields':[_0x6549('0xc')]},{'name':_0x6549('0xd'),'fields':[_0x6549('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 1fd7e25..7abb5f2 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 _0xc210=['MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','CountReScheduled','literal','`scheduledat`\x20>=\x20','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','describe','GetCmHopperPreview','GetContactByPhone','findOne','phone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','User','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','twilio/lib/webhooks/webhooks','client','request','info','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopper,\x20%s,\x20%s','message','result','catch','GetCmHopper','CmHopper','findAll','options','raw','attributes','map','model','include','then','ShowCmHopper','create','body','CreateCmHopper','UpdateCmHopper','update','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','where','GetContactDialer','sequelize','transaction','order','LOCK','UPDATE','CmContact','Contact','keys','Agent','name','voicePause','length','UserId','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','CmHopperFinal'];(function(_0x54906b,_0x80236b){var _0x5c7a91=function(_0x5d3e36){while(--_0x5d3e36){_0x54906b['push'](_0x54906b['shift']());}};_0x5c7a91(++_0x80236b);}(_0xc210,0x6c));var _0x0c21=function(_0x5a3c24,_0x26512a){_0x5a3c24=_0x5a3c24-0x0;var _0x15da7f=_0xc210[_0x5a3c24];return _0x15da7f;};'use strict';var _=require(_0x0c21('0x0'));var util=require(_0x0c21('0x1'));var moment=require(_0x0c21('0x2'));var BPromise=require(_0x0c21('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c21('0x4'));var db=require(_0x0c21('0x5'))['db'];var utils=require(_0x0c21('0x6'));var logger=require(_0x0c21('0x7'))(_0x0c21('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');const {validateExpressRequest}=require(_0x0c21('0x9'));var client=jayson[_0x0c21('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a91c9,_0x3387e8,_0x492007){return new BPromise(function(_0x2544bc,_0x2d41b4){return client[_0x0c21('0xb')](_0x3a91c9,_0x492007)['then'](function(_0x3781d3){logger[_0x0c21('0xc')]('CmHopper,\x20%s,\x20%s',_0x3387e8,_0x0c21('0xd'));logger[_0x0c21('0xe')](_0x0c21('0xf'),_0x3387e8,_0x0c21('0xd'),JSON[_0x0c21('0x10')](_0x3781d3));if(_0x3781d3[_0x0c21('0x11')]){if(_0x3781d3[_0x0c21('0x11')][_0x0c21('0x12')]===0x1f4){logger[_0x0c21('0x11')](_0x0c21('0x13'),_0x3387e8,_0x3781d3[_0x0c21('0x11')][_0x0c21('0x14')]);return _0x2d41b4(_0x3781d3[_0x0c21('0x11')][_0x0c21('0x14')]);}logger[_0x0c21('0x11')]('CmHopper,\x20%s,\x20%s',_0x3387e8,_0x3781d3['error'][_0x0c21('0x14')]);return _0x2544bc(_0x3781d3[_0x0c21('0x11')][_0x0c21('0x14')]);}else{logger[_0x0c21('0xc')](_0x0c21('0x13'),_0x3387e8,_0x0c21('0xd'));_0x2544bc(_0x3781d3[_0x0c21('0x15')]['message']);}})[_0x0c21('0x16')](function(_0x14e95e){logger[_0x0c21('0x11')](_0x0c21('0x13'),_0x3387e8,_0x14e95e);_0x2d41b4(_0x14e95e);});});}exports[_0x0c21('0x17')]=function(_0x5af781){var _0x2f96c9=this;return new Promise(function(_0x48e9d9,_0x1e54eb){return db[_0x0c21('0x18')][_0x0c21('0x19')]({'raw':_0x5af781[_0x0c21('0x1a')]?_0x5af781[_0x0c21('0x1a')][_0x0c21('0x1b')]===undefined?!![]:![]:!![],'where':_0x5af781[_0x0c21('0x1a')]?_0x5af781[_0x0c21('0x1a')]['where']||null:null,'attributes':_0x5af781[_0x0c21('0x1a')]?_0x5af781[_0x0c21('0x1a')][_0x0c21('0x1c')]||null:null,'limit':_0x5af781['options']?_0x5af781[_0x0c21('0x1a')]['limit']||null:null,'include':_0x5af781[_0x0c21('0x1a')]?_0x5af781[_0x0c21('0x1a')]['include']?_[_0x0c21('0x1d')](_0x5af781[_0x0c21('0x1a')]['include'],function(_0x36153b){return{'model':db[_0x36153b[_0x0c21('0x1e')]],'as':_0x36153b['as'],'attributes':_0x36153b[_0x0c21('0x1c')],'include':_0x36153b[_0x0c21('0x1f')]?_[_0x0c21('0x1d')](_0x36153b[_0x0c21('0x1f')],function(_0x5af022){return{'model':db[_0x5af022['model']],'as':_0x5af022['as'],'attributes':_0x5af022[_0x0c21('0x1c')],'include':_0x5af022[_0x0c21('0x1f')]?_[_0x0c21('0x1d')](_0x5af022[_0x0c21('0x1f')],function(_0x2cfed7){return{'model':db[_0x2cfed7[_0x0c21('0x1e')]],'as':_0x2cfed7['as'],'attributes':_0x2cfed7[_0x0c21('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0c21('0x20')](function(_0x15a6d5){logger[_0x0c21('0xc')](_0x0c21('0x17'),_0x5af781);logger['debug'](_0x0c21('0x17'),_0x5af781,JSON[_0x0c21('0x10')](_0x15a6d5));_0x48e9d9(_0x15a6d5);})['catch'](function(_0x3c7e8a){logger[_0x0c21('0x11')](_0x0c21('0x17'),_0x3c7e8a[_0x0c21('0x14')],_0x5af781);_0x1e54eb(_0x2f96c9[_0x0c21('0x11')](0x1f4,_0x3c7e8a[_0x0c21('0x14')]));});});};exports[_0x0c21('0x21')]=function(_0x4ec5cb){var _0x2291dd=this;return new Promise(function(_0x196f47,_0x236538){return db[_0x0c21('0x18')]['find']({'raw':_0x4ec5cb[_0x0c21('0x1a')]?_0x4ec5cb['options']['raw']===undefined?!![]:![]:!![],'where':_0x4ec5cb['options']?_0x4ec5cb[_0x0c21('0x1a')]['where']||null:null,'attributes':_0x4ec5cb[_0x0c21('0x1a')]?_0x4ec5cb['options']['attributes']||null:null,'include':_0x4ec5cb[_0x0c21('0x1a')]?_0x4ec5cb[_0x0c21('0x1a')][_0x0c21('0x1f')]?_[_0x0c21('0x1d')](_0x4ec5cb[_0x0c21('0x1a')][_0x0c21('0x1f')],function(_0x1b2482){return{'model':db[_0x1b2482[_0x0c21('0x1e')]],'as':_0x1b2482['as'],'attributes':_0x1b2482[_0x0c21('0x1c')],'include':_0x1b2482['include']?_['map'](_0x1b2482[_0x0c21('0x1f')],function(_0x499cfb){return{'model':db[_0x499cfb[_0x0c21('0x1e')]],'as':_0x499cfb['as'],'attributes':_0x499cfb[_0x0c21('0x1c')],'include':_0x499cfb[_0x0c21('0x1f')]?_[_0x0c21('0x1d')](_0x499cfb[_0x0c21('0x1f')],function(_0x56ad22){return{'model':db[_0x56ad22[_0x0c21('0x1e')]],'as':_0x56ad22['as'],'attributes':_0x56ad22['attributes']};}):[]};}):[]};}):[]:[]})[_0x0c21('0x20')](function(_0x10cf6b){logger[_0x0c21('0xc')](_0x0c21('0x21'),_0x4ec5cb);logger[_0x0c21('0xe')](_0x0c21('0x21'),_0x4ec5cb,JSON['stringify'](_0x10cf6b));_0x196f47(_0x10cf6b);})['catch'](function(_0x283069){logger[_0x0c21('0x11')](_0x0c21('0x21'),_0x283069[_0x0c21('0x14')],_0x4ec5cb);_0x236538(_0x2291dd[_0x0c21('0x11')](0x1f4,_0x283069[_0x0c21('0x14')]));});});};exports['CreateCmHopper']=function(_0x57f716){var _0x47aa42=this;return new Promise(function(_0x345e9e,_0x4d7633){return db[_0x0c21('0x18')][_0x0c21('0x22')](_0x57f716[_0x0c21('0x23')],{'raw':_0x57f716[_0x0c21('0x1a')]?_0x57f716[_0x0c21('0x1a')][_0x0c21('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0xfb94ec){logger[_0x0c21('0xc')](_0x0c21('0x24'),_0x57f716);logger[_0x0c21('0xe')]('CreateCmHopper',_0x57f716,JSON['stringify'](_0xfb94ec));_0x345e9e(_0xfb94ec);})[_0x0c21('0x16')](function(_0x3af60a){logger[_0x0c21('0x11')](_0x0c21('0x24'),_0x3af60a[_0x0c21('0x14')],_0x57f716);_0x4d7633(_0x47aa42['error'](0x1f4,_0x3af60a[_0x0c21('0x14')]));});});};exports[_0x0c21('0x25')]=function(_0x56405a){var _0x4f01d5=this;return new Promise(function(_0x35c726,_0x1e6a23){return db[_0x0c21('0x18')][_0x0c21('0x26')](_0x56405a['body'],{'raw':_0x56405a[_0x0c21('0x1a')]?_0x56405a['options'][_0x0c21('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56405a[_0x0c21('0x1a')]?_0x56405a[_0x0c21('0x1a')]['where']||null:null,'attributes':_0x56405a['options']?_0x56405a[_0x0c21('0x1a')]['attributes']||null:null,'limit':_0x56405a['options']?_0x56405a[_0x0c21('0x1a')][_0x0c21('0x27')]||null:null})[_0x0c21('0x20')](function(_0x490659){logger[_0x0c21('0xc')](_0x0c21('0x25'),_0x56405a);logger[_0x0c21('0xc')](_0x0c21('0x28'),JSON['stringify'](_0x56405a['options']['where']),_0x56405a[_0x0c21('0x23')][_0x0c21('0x29')]);logger[_0x0c21('0xe')](_0x0c21('0x25'),_0x56405a,JSON[_0x0c21('0x10')](_0x490659));_0x35c726(_0x490659);})[_0x0c21('0x16')](function(_0x321a6c){logger['error'](_0x0c21('0x25'),_0x321a6c[_0x0c21('0x14')],_0x56405a);_0x1e6a23(_0x4f01d5[_0x0c21('0x11')](0x1f4,_0x321a6c[_0x0c21('0x14')]));});});};exports[_0x0c21('0x2a')]=function(_0x24bb70){var _0xf27b89=this;return new Promise(function(_0x4338cf,_0x900930){return db[_0x0c21('0x18')][_0x0c21('0x2b')]({'where':_0x24bb70[_0x0c21('0x1a')]?_0x24bb70[_0x0c21('0x1a')][_0x0c21('0x2c')]||null:null})['then'](function(_0x103ce4){logger[_0x0c21('0xc')](_0x0c21('0x2a'),_0x24bb70);logger[_0x0c21('0xe')](_0x0c21('0x2a'),_0x24bb70,JSON[_0x0c21('0x10')](_0x103ce4));_0x4338cf(_0x103ce4);})['catch'](function(_0x23e1af){logger[_0x0c21('0x11')](_0x0c21('0x2a'),_0x23e1af[_0x0c21('0x14')],_0x24bb70);_0x900930(_0xf27b89['error'](0x1f4,_0x23e1af['message']));});});};exports[_0x0c21('0x2d')]=function(_0xfa13ae){var _0x3a333f=this;return new Promise(function(_0x24fc81,_0x4bd0fb){return db['CmContact']['describe']()[_0x0c21('0x20')](function(_0x2bb71f){return db[_0x0c21('0x2e')][_0x0c21('0x2f')](function(_0x2a68e4){return db[_0x0c21('0x18')][_0x0c21('0x19')]({'where':_0xfa13ae[_0x0c21('0x1a')]?_0xfa13ae[_0x0c21('0x1a')][_0x0c21('0x2c')]||null:null,'attributes':_0xfa13ae[_0x0c21('0x1a')]?_0xfa13ae[_0x0c21('0x1a')]['attributes']||null:null,'limit':_0xfa13ae['options']?_0xfa13ae[_0x0c21('0x1a')][_0x0c21('0x27')]||null:null,'order':_0xfa13ae[_0x0c21('0x1a')]?_0xfa13ae[_0x0c21('0x1a')][_0x0c21('0x30')]||null:null,'transaction':_0x2a68e4,'lock':_0x2a68e4[_0x0c21('0x31')][_0x0c21('0x32')],'include':[{'model':db[_0x0c21('0x33')],'as':_0x0c21('0x34'),'attributes':_[_0x0c21('0x35')](_0x2bb71f)},{'model':db['User'],'as':_0x0c21('0x36'),'attributes':['id',_0x0c21('0x37'),_0x0c21('0x38')]}]})['then'](function(_0x545959){var _0x584d7a=[];var _0x209b93=[];for(var _0x35e502=0x0;_0x35e502<_0x545959[_0x0c21('0x39')];_0x35e502+=0x1){var _0x15fc1e=_0x545959[_0x35e502][_0x0c21('0x3a')];if(_0x15fc1e===null){_0x584d7a[_0x0c21('0x3b')](_0x545959[_0x35e502][_0x0c21('0x26')](_0xfa13ae[_0x0c21('0x23')],{'transaction':_0x2a68e4}));}else if(!_0x209b93['includes'](_0x15fc1e)){_0x209b93['push'](_0x15fc1e);_0x584d7a[_0x0c21('0x3b')](_0x545959[_0x35e502][_0x0c21('0x26')](_0xfa13ae[_0x0c21('0x23')],{'transaction':_0x2a68e4}));}}return BPromise[_0x0c21('0x3c')](_0x584d7a);});})[_0x0c21('0x20')](function(_0x160e01){logger[_0x0c21('0xc')](_0x0c21('0x2d'),_0xfa13ae);if(_0x160e01[_0x0c21('0x39')]>0x0){logger[_0x0c21('0xc')](_0x0c21('0x3d'),_0x160e01[0x0]['dataValues']['id'],_0x160e01[0x0][_0x0c21('0x3e')]['ContactId'],_0x160e01[0x0][_0x0c21('0x3e')][_0x0c21('0x29')]);}logger[_0x0c21('0xe')](_0x0c21('0x2d'),_0xfa13ae,JSON['stringify'](_0x160e01));_0x24fc81(_0x160e01);})[_0x0c21('0x16')](function(_0x49755e){logger[_0x0c21('0x11')](_0x0c21('0x2d'),_0x49755e['message'],_0xfa13ae);_0x4bd0fb(_0x3a333f[_0x0c21('0x11')](0x1f4,_0x49755e[_0x0c21('0x14')]));});});});};exports['MoveContactManagedDialer']=function(_0x261446){var _0x3618ef=this;return new Promise(function(_0x3c0881,_0x3eb80a){return db[_0x0c21('0x2e')][_0x0c21('0x2f')](function(_0x2ab3bd){return db[_0x0c21('0x3f')][_0x0c21('0x22')](_0x261446[_0x0c21('0x23')],{'raw':_0x261446[_0x0c21('0x1a')]?_0x261446[_0x0c21('0x1a')][_0x0c21('0x1b')]===undefined?!![]:![]:!![],'transaction':_0x2ab3bd})[_0x0c21('0x20')](function(){logger[_0x0c21('0xc')](_0x0c21('0x40'),JSON[_0x0c21('0x10')](_0x261446[_0x0c21('0x1a')][_0x0c21('0x2c')]),_0x261446['options']['where'][_0x0c21('0x29')]);return db[_0x0c21('0x18')]['destroy']({'where':_0x261446['options']?_0x261446[_0x0c21('0x1a')]['where']||null:null,'transaction':_0x2ab3bd});});})[_0x0c21('0x20')](function(_0x1afd62){logger[_0x0c21('0xc')](_0x0c21('0x41'),_0x261446);logger['debug'](_0x0c21('0x41'),_0x261446,JSON[_0x0c21('0x10')](_0x1afd62));_0x3c0881(_0x1afd62);})[_0x0c21('0x16')](function(_0x193ac4){logger['error'](_0x0c21('0x41'),_0x193ac4['message'],_0x261446);_0x3eb80a(_0x3618ef[_0x0c21('0x11')](0x1f4,_0x193ac4[_0x0c21('0x14')]));});});};exports[_0x0c21('0x42')]=function(_0x14454b){var _0x638018=this;return new Promise(function(_0x4d8c18,_0x8d6091){return db[_0x0c21('0x18')][_0x0c21('0x19')]({'raw':_0x14454b[_0x0c21('0x1a')]?_0x14454b[_0x0c21('0x1a')][_0x0c21('0x1b')]===undefined?!![]:![]:!![],'where':_0x14454b[_0x0c21('0x1a')]?_0x14454b[_0x0c21('0x1a')]['where']||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x0c21('0x2e')]['fn']('IF',db['sequelize'][_0x0c21('0x43')](_0x0c21('0x44')+util['format'](_0x0c21('0x45'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'))+_0x0c21('0x46')))),_0x0c21('0x47')]]})[_0x0c21('0x20')](function(_0x351c88){logger[_0x0c21('0xc')](_0x0c21('0x42'),_0x14454b);logger[_0x0c21('0xe')](_0x0c21('0x42'),_0x14454b,JSON[_0x0c21('0x10')](_0x351c88));_0x4d8c18(_0x351c88);})[_0x0c21('0x16')](function(_0x2a680e){logger[_0x0c21('0x11')](_0x0c21('0x42'),_0x2a680e[_0x0c21('0x14')],_0x14454b);_0x8d6091(_0x638018[_0x0c21('0x11')](0x1f4,_0x2a680e[_0x0c21('0x14')]));});});};exports[_0x0c21('0x48')]=function(_0x54fd7c){var _0x5b0acf=this;return new Promise(function(_0x1315ee,_0x23958c){return db[_0x0c21('0x33')][_0x0c21('0x49')]()[_0x0c21('0x20')](function(_0x269248){return db['sequelize'][_0x0c21('0x2f')](function(_0x106228){return db['CmHopper'][_0x0c21('0x19')]({'where':_0x54fd7c[_0x0c21('0x1a')]?_0x54fd7c[_0x0c21('0x1a')][_0x0c21('0x2c')]||null:null,'attributes':_0x54fd7c[_0x0c21('0x1a')]?_0x54fd7c[_0x0c21('0x1a')][_0x0c21('0x1c')]||null:null,'limit':0x1,'order':_0x54fd7c[_0x0c21('0x1a')]?_0x54fd7c[_0x0c21('0x1a')][_0x0c21('0x30')]||null:null,'group':db[_0x0c21('0x18')]['UserId'],'transaction':_0x106228,'lock':_0x106228[_0x0c21('0x31')][_0x0c21('0x32')],'include':_0x54fd7c['options']?_0x54fd7c[_0x0c21('0x1a')]['include']?_[_0x0c21('0x1d')](_0x54fd7c[_0x0c21('0x1a')][_0x0c21('0x1f')],function(_0xa6cb5b){return{'model':db[_0xa6cb5b[_0x0c21('0x1e')]],'as':_0xa6cb5b['as'],'attributes':_0xa6cb5b[_0x0c21('0x1c')],'include':_0xa6cb5b[_0x0c21('0x1f')]?_[_0x0c21('0x1d')](_0xa6cb5b[_0x0c21('0x1f')],function(_0x42746d){return{'model':db[_0x42746d[_0x0c21('0x1e')]],'as':_0x42746d['as'],'attributes':_0x42746d[_0x0c21('0x1c')],'include':_0x42746d[_0x0c21('0x1f')]?_['map'](_0x42746d['include'],function(_0x340199){return{'model':db[_0x340199[_0x0c21('0x1e')]],'as':_0x340199['as'],'attributes':_0x340199[_0x0c21('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d526f){var _0x4d9900=[];for(var _0x4dfbba=0x0;_0x4dfbba<_0x2d526f[_0x0c21('0x39')];_0x4dfbba+=0x1){_0x4d9900[_0x0c21('0x3b')](_0x2d526f[_0x4dfbba][_0x0c21('0x26')](_0x54fd7c['body'],{'transaction':_0x106228}));}return BPromise[_0x0c21('0x3c')](_0x4d9900);});})[_0x0c21('0x20')](function(_0x3993cf){logger[_0x0c21('0xc')](_0x0c21('0x48'),_0x54fd7c);logger[_0x0c21('0xe')](_0x0c21('0x48'),_0x54fd7c,JSON[_0x0c21('0x10')](_0x3993cf));_0x1315ee(_0x3993cf);})[_0x0c21('0x16')](function(_0x4835ce){logger['error']('GetContactRecallMe',_0x4835ce[_0x0c21('0x14')],_0x54fd7c);_0x23958c(_0x5b0acf[_0x0c21('0x11')](0x1f4,_0x4835ce['message']));});});});};exports[_0x0c21('0x4a')]=function(_0x4682a4){var _0x5b1648=this;return new Promise(function(_0x533ac8,_0x51ac67){db[_0x0c21('0x33')][_0x0c21('0x49')]()[_0x0c21('0x20')](function(_0x210cee){return db[_0x0c21('0x18')][_0x0c21('0x19')]({'raw':_0x4682a4[_0x0c21('0x1a')]?_0x4682a4[_0x0c21('0x1a')][_0x0c21('0x1b')]===undefined?!![]:![]:!![],'where':_0x4682a4[_0x0c21('0x1a')]?_0x4682a4['options'][_0x0c21('0x2c')]||null:null,'attributes':_0x4682a4[_0x0c21('0x1a')]?_0x4682a4['options']['attributes']||null:null,'limit':_0x4682a4[_0x0c21('0x1a')]?_0x4682a4[_0x0c21('0x1a')][_0x0c21('0x27')]||null:null,'include':_0x4682a4[_0x0c21('0x1a')]?_0x4682a4[_0x0c21('0x1a')]['include']?_[_0x0c21('0x1d')](_0x4682a4[_0x0c21('0x1a')]['include'],function(_0x32af31){return{'model':db[_0x32af31[_0x0c21('0x1e')]],'as':_0x32af31['as'],'attributes':_0x32af31['as']===_0x0c21('0x34')?_[_0x0c21('0x35')](_0x210cee):_0x32af31[_0x0c21('0x1c')],'include':_0x32af31[_0x0c21('0x1f')]?_[_0x0c21('0x1d')](_0x32af31['include'],function(_0x276b42){return{'model':db[_0x276b42[_0x0c21('0x1e')]],'as':_0x276b42['as'],'attributes':_0x276b42[_0x0c21('0x1c')],'include':_0x276b42['include']?_[_0x0c21('0x1d')](_0x276b42['include'],function(_0x4a4bce){return{'model':db[_0x4a4bce[_0x0c21('0x1e')]],'as':_0x4a4bce['as'],'attributes':_0x4a4bce[_0x0c21('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0c21('0x20')](function(_0x14d8ff){logger[_0x0c21('0xc')](_0x0c21('0x17'),_0x4682a4);logger[_0x0c21('0xe')](_0x0c21('0x17'),_0x4682a4,JSON[_0x0c21('0x10')](_0x14d8ff));_0x533ac8(_0x14d8ff);})['catch'](function(_0x46192f){logger[_0x0c21('0x11')](_0x0c21('0x17'),_0x46192f[_0x0c21('0x14')],_0x4682a4);_0x51ac67(_0x5b1648[_0x0c21('0x11')](0x1f4,_0x46192f['message']));});});});};exports[_0x0c21('0x4b')]=function(_0x277ea1){var _0x4b387c=this;return new Promise(function(_0x3c7bac,_0x1af0d4){return db[_0x0c21('0x33')][_0x0c21('0x4c')]({'raw':!![],'where':{'phone':_0x277ea1[_0x0c21('0x1a')]['where'][_0x0c21('0x4d')]},'attributes':['id','dialTimezone'],'order':[['id','DESC']]})[_0x0c21('0x20')](function(_0x4b95c6){logger[_0x0c21('0xc')]('getContactByPhone',_0x277ea1);logger[_0x0c21('0xe')](_0x0c21('0x4e'),_0x277ea1,JSON[_0x0c21('0x10')](_0x4b95c6));_0x3c7bac(_0x4b95c6);})['catch'](function(_0x2f87fe){logger[_0x0c21('0x11')](_0x0c21('0x4e'),_0x2f87fe['message'],_0x277ea1);_0x1af0d4(_0x4b387c[_0x0c21('0x11')](0x1f4,_0x2f87fe[_0x0c21('0x14')]));});});};exports[_0x0c21('0x4f')]=function(_0x5a7573){var _0x13c1ce=this;return new Promise(function(_0x172771,_0xfc7071){return db[_0x0c21('0x2e')][_0x0c21('0x2f')](function(_0x2a1974){return db[_0x0c21('0x18')]['update']({'active':![]},{'where':{},'transaction':_0x2a1974})['then'](function(_0x23b5d9){logger['info'](_0x0c21('0x4f'),_0x5a7573);logger['debug'](_0x0c21('0x4f'),_0x5a7573,JSON[_0x0c21('0x10')](_0x23b5d9));_0x172771(_0x23b5d9);})['catch'](function(_0x27d6c0){logger[_0x0c21('0x11')](_0x0c21('0x4f'),_0x27d6c0[_0x0c21('0x14')],_0x5a7573);_0xfc7071(_0x13c1ce[_0x0c21('0x11')](0x1f4,_0x27d6c0['message']));});});});};exports[_0x0c21('0x50')]=function(_0x3a88ea){var _0x1316a9=this;var _0x12d9b0=_0x3a88ea['body'][_0x0c21('0x2c')][_0x0c21('0x51')];var _0x5171df=_0x3a88ea[_0x0c21('0x23')][_0x0c21('0x2c')][_0x0c21('0x52')];return new Promise(function(_0x475e1a,_0x165b03){return db[_0x0c21('0x18')][_0x0c21('0x19')]({'where':{'voiceQueueId':_0x12d9b0,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x0c21('0x2e')]['literal'](_0x0c21('0x53')+_0x5171df+_0x0c21('0x54'))}},'include':[{'model':db[_0x0c21('0x33')],'as':_0x0c21('0x34')},{'model':db[_0x0c21('0x55')],'as':_0x0c21('0x36'),'attributes':['id',_0x0c21('0x37'),_0x0c21('0x38')]},{'model':db['CmList'],'as':'List'}]})[_0x0c21('0x20')](function(_0xd48293){return db[_0x0c21('0x2e')][_0x0c21('0x2f')](function(_0x2d159d){return db[_0x0c21('0x18')][_0x0c21('0x26')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x12d9b0,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db['sequelize'][_0x0c21('0x43')](_0x0c21('0x53')+_0x5171df+_0x0c21('0x54'))}},'transaction':_0x2d159d})[_0x0c21('0x20')](function(_0x5eaf06){_0x475e1a(_0xd48293);})[_0x0c21('0x16')](function(_0x1c965b){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x1c965b[_0x0c21('0x14')],_0x3a88ea);_0x165b03(validateExpressRequest);});});})[_0x0c21('0x16')](function(_0x1e6dc9){logger[_0x0c21('0x11')](_0x0c21('0x50'),_0x1e6dc9[_0x0c21('0x14')],_0x3a88ea);_0x165b03(_0x1316a9[_0x0c21('0x11')](0x1f4,_0x1e6dc9[_0x0c21('0x14')]));});});}; \ No newline at end of file +var _0x4989=['ShowCmHopper','find','CreateCmHopper','create','UpdateCmHopper','update','body','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','describe','transaction','order','LOCK','CmContact','Contact','User','name','voicePause','length','UserId','push','includes','all','GetContactDialer','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','sequelize','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','COUNT','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','UPDATE','GetCmHopperPreview','GetContactByPhone','findOne','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','interval','literal','\x20MINUTE','Agent','CmList','List','NOW()\x20+\x20INTERVAL\x20','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','twilio/lib/webhooks/webhooks','client','http','request','then','debug','request\x20sent','error','code','CmHopper,\x20%s,\x20%s','message','result','catch','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','info','GetCmHopper','stringify'];(function(_0x57f474,_0x2d049b){var _0x496b7a=function(_0x17fccc){while(--_0x17fccc){_0x57f474['push'](_0x57f474['shift']());}};_0x496b7a(++_0x2d049b);}(_0x4989,0x14d));var _0x9498=function(_0x17f716,_0x4a06c7){_0x17f716=_0x17f716-0x0;var _0x31f0de=_0x4989[_0x17f716];return _0x31f0de;};'use strict';var _=require(_0x9498('0x0'));var util=require(_0x9498('0x1'));var moment=require(_0x9498('0x2'));var BPromise=require(_0x9498('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9498('0x4'))['db'];var utils=require(_0x9498('0x5'));var logger=require('../../config/logger')(_0x9498('0x6'));var config=require(_0x9498('0x7'));var jayson=require(_0x9498('0x8'));const {validateExpressRequest}=require(_0x9498('0x9'));var client=jayson[_0x9498('0xa')][_0x9498('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ca0a9,_0x219659,_0x415605){return new BPromise(function(_0x20cc98,_0x18a9b8){return client[_0x9498('0xc')](_0x2ca0a9,_0x415605)[_0x9498('0xd')](function(_0x5784b3){logger['info']('CmHopper,\x20%s,\x20%s',_0x219659,'request\x20sent');logger[_0x9498('0xe')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x219659,_0x9498('0xf'),JSON['stringify'](_0x5784b3));if(_0x5784b3[_0x9498('0x10')]){if(_0x5784b3['error'][_0x9498('0x11')]===0x1f4){logger[_0x9498('0x10')](_0x9498('0x12'),_0x219659,_0x5784b3[_0x9498('0x10')][_0x9498('0x13')]);return _0x18a9b8(_0x5784b3[_0x9498('0x10')][_0x9498('0x13')]);}logger[_0x9498('0x10')]('CmHopper,\x20%s,\x20%s',_0x219659,_0x5784b3['error'][_0x9498('0x13')]);return _0x20cc98(_0x5784b3[_0x9498('0x10')]['message']);}else{logger['info'](_0x9498('0x12'),_0x219659,'request\x20sent');_0x20cc98(_0x5784b3[_0x9498('0x14')]['message']);}})[_0x9498('0x15')](function(_0x57cd67){logger[_0x9498('0x10')](_0x9498('0x12'),_0x219659,_0x57cd67);_0x18a9b8(_0x57cd67);});});}exports['GetCmHopper']=function(_0x2372fb){var _0x386724=this;return new Promise(function(_0x65abd5,_0xefd962){return db[_0x9498('0x16')][_0x9498('0x17')]({'raw':_0x2372fb[_0x9498('0x18')]?_0x2372fb[_0x9498('0x18')][_0x9498('0x19')]===undefined?!![]:![]:!![],'where':_0x2372fb[_0x9498('0x18')]?_0x2372fb[_0x9498('0x18')][_0x9498('0x1a')]||null:null,'attributes':_0x2372fb[_0x9498('0x18')]?_0x2372fb[_0x9498('0x18')][_0x9498('0x1b')]||null:null,'limit':_0x2372fb[_0x9498('0x18')]?_0x2372fb['options'][_0x9498('0x1c')]||null:null,'include':_0x2372fb['options']?_0x2372fb['options'][_0x9498('0x1d')]?_[_0x9498('0x1e')](_0x2372fb[_0x9498('0x18')][_0x9498('0x1d')],function(_0x3786f2){return{'model':db[_0x3786f2[_0x9498('0x1f')]],'as':_0x3786f2['as'],'attributes':_0x3786f2[_0x9498('0x1b')],'include':_0x3786f2[_0x9498('0x1d')]?_[_0x9498('0x1e')](_0x3786f2['include'],function(_0x5d8b55){return{'model':db[_0x5d8b55[_0x9498('0x1f')]],'as':_0x5d8b55['as'],'attributes':_0x5d8b55[_0x9498('0x1b')],'include':_0x5d8b55[_0x9498('0x1d')]?_['map'](_0x5d8b55[_0x9498('0x1d')],function(_0x5caed9){return{'model':db[_0x5caed9[_0x9498('0x1f')]],'as':_0x5caed9['as'],'attributes':_0x5caed9[_0x9498('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9498('0xd')](function(_0x3dbc0f){logger[_0x9498('0x20')](_0x9498('0x21'),_0x2372fb);logger[_0x9498('0xe')](_0x9498('0x21'),_0x2372fb,JSON[_0x9498('0x22')](_0x3dbc0f));_0x65abd5(_0x3dbc0f);})[_0x9498('0x15')](function(_0x1a3b06){logger[_0x9498('0x10')](_0x9498('0x21'),_0x1a3b06['message'],_0x2372fb);_0xefd962(_0x386724[_0x9498('0x10')](0x1f4,_0x1a3b06['message']));});});};exports[_0x9498('0x23')]=function(_0xe5a09d){var _0x7900be=this;return new Promise(function(_0x5cdb4a,_0x54206a){return db[_0x9498('0x16')][_0x9498('0x24')]({'raw':_0xe5a09d['options']?_0xe5a09d[_0x9498('0x18')][_0x9498('0x19')]===undefined?!![]:![]:!![],'where':_0xe5a09d['options']?_0xe5a09d[_0x9498('0x18')][_0x9498('0x1a')]||null:null,'attributes':_0xe5a09d[_0x9498('0x18')]?_0xe5a09d[_0x9498('0x18')]['attributes']||null:null,'include':_0xe5a09d[_0x9498('0x18')]?_0xe5a09d[_0x9498('0x18')]['include']?_[_0x9498('0x1e')](_0xe5a09d[_0x9498('0x18')][_0x9498('0x1d')],function(_0x38f1b7){return{'model':db[_0x38f1b7['model']],'as':_0x38f1b7['as'],'attributes':_0x38f1b7[_0x9498('0x1b')],'include':_0x38f1b7[_0x9498('0x1d')]?_[_0x9498('0x1e')](_0x38f1b7['include'],function(_0x459cdc){return{'model':db[_0x459cdc[_0x9498('0x1f')]],'as':_0x459cdc['as'],'attributes':_0x459cdc['attributes'],'include':_0x459cdc[_0x9498('0x1d')]?_[_0x9498('0x1e')](_0x459cdc[_0x9498('0x1d')],function(_0x447cfd){return{'model':db[_0x447cfd[_0x9498('0x1f')]],'as':_0x447cfd['as'],'attributes':_0x447cfd[_0x9498('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9498('0xd')](function(_0x15f28f){logger['info'](_0x9498('0x23'),_0xe5a09d);logger['debug']('ShowCmHopper',_0xe5a09d,JSON[_0x9498('0x22')](_0x15f28f));_0x5cdb4a(_0x15f28f);})[_0x9498('0x15')](function(_0x1ab998){logger[_0x9498('0x10')](_0x9498('0x23'),_0x1ab998[_0x9498('0x13')],_0xe5a09d);_0x54206a(_0x7900be[_0x9498('0x10')](0x1f4,_0x1ab998[_0x9498('0x13')]));});});};exports[_0x9498('0x25')]=function(_0x3919be){var _0x5a2c29=this;return new Promise(function(_0x12b575,_0x570f2a){return db[_0x9498('0x16')][_0x9498('0x26')](_0x3919be['body'],{'raw':_0x3919be['options']?_0x3919be[_0x9498('0x18')][_0x9498('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x585068){logger[_0x9498('0x20')](_0x9498('0x25'),_0x3919be);logger['debug'](_0x9498('0x25'),_0x3919be,JSON[_0x9498('0x22')](_0x585068));_0x12b575(_0x585068);})[_0x9498('0x15')](function(_0x747764){logger['error'](_0x9498('0x25'),_0x747764[_0x9498('0x13')],_0x3919be);_0x570f2a(_0x5a2c29[_0x9498('0x10')](0x1f4,_0x747764[_0x9498('0x13')]));});});};exports[_0x9498('0x27')]=function(_0x32f0e8){var _0x2161a2=this;return new Promise(function(_0x222e9f,_0x5de440){return db['CmHopper'][_0x9498('0x28')](_0x32f0e8[_0x9498('0x29')],{'raw':_0x32f0e8[_0x9498('0x18')]?_0x32f0e8[_0x9498('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32f0e8['options']?_0x32f0e8[_0x9498('0x18')][_0x9498('0x1a')]||null:null,'attributes':_0x32f0e8[_0x9498('0x18')]?_0x32f0e8[_0x9498('0x18')][_0x9498('0x1b')]||null:null,'limit':_0x32f0e8[_0x9498('0x18')]?_0x32f0e8[_0x9498('0x18')]['limit']||null:null})[_0x9498('0xd')](function(_0x9537bc){logger[_0x9498('0x20')]('UpdateCmHopper',_0x32f0e8);logger[_0x9498('0x20')](_0x9498('0x2a'),JSON[_0x9498('0x22')](_0x32f0e8[_0x9498('0x18')][_0x9498('0x1a')]),_0x32f0e8[_0x9498('0x29')][_0x9498('0x2b')]);logger[_0x9498('0xe')](_0x9498('0x27'),_0x32f0e8,JSON[_0x9498('0x22')](_0x9537bc));_0x222e9f(_0x9537bc);})[_0x9498('0x15')](function(_0x1a3155){logger[_0x9498('0x10')]('UpdateCmHopper',_0x1a3155[_0x9498('0x13')],_0x32f0e8);_0x5de440(_0x2161a2[_0x9498('0x10')](0x1f4,_0x1a3155[_0x9498('0x13')]));});});};exports[_0x9498('0x2c')]=function(_0x2c368f){var _0x249a04=this;return new Promise(function(_0x4bb21b,_0x5030c6){return db[_0x9498('0x16')][_0x9498('0x2d')]({'where':_0x2c368f[_0x9498('0x18')]?_0x2c368f[_0x9498('0x18')]['where']||null:null})[_0x9498('0xd')](function(_0x5ba9a8){logger[_0x9498('0x20')](_0x9498('0x2c'),_0x2c368f);logger['debug'](_0x9498('0x2c'),_0x2c368f,JSON[_0x9498('0x22')](_0x5ba9a8));_0x4bb21b(_0x5ba9a8);})[_0x9498('0x15')](function(_0x93d3de){logger[_0x9498('0x10')]('DestroyCmHopper',_0x93d3de['message'],_0x2c368f);_0x5030c6(_0x249a04[_0x9498('0x10')](0x1f4,_0x93d3de[_0x9498('0x13')]));});});};exports['GetContactDialer']=function(_0x83bcbc){var _0x269a23=this;return new Promise(function(_0x424bdd,_0x2f95d0){return db['CmContact'][_0x9498('0x2e')]()['then'](function(_0x16b0be){return db['sequelize'][_0x9498('0x2f')](function(_0x20537c){return db[_0x9498('0x16')][_0x9498('0x17')]({'where':_0x83bcbc[_0x9498('0x18')]?_0x83bcbc[_0x9498('0x18')][_0x9498('0x1a')]||null:null,'attributes':_0x83bcbc['options']?_0x83bcbc[_0x9498('0x18')][_0x9498('0x1b')]||null:null,'limit':_0x83bcbc[_0x9498('0x18')]?_0x83bcbc[_0x9498('0x18')]['limit']||null:null,'order':_0x83bcbc[_0x9498('0x18')]?_0x83bcbc['options'][_0x9498('0x30')]||null:null,'transaction':_0x20537c,'lock':_0x20537c[_0x9498('0x31')]['UPDATE'],'include':[{'model':db[_0x9498('0x32')],'as':_0x9498('0x33'),'attributes':_['keys'](_0x16b0be)},{'model':db[_0x9498('0x34')],'as':'Agent','attributes':['id',_0x9498('0x35'),_0x9498('0x36')]}]})[_0x9498('0xd')](function(_0x254715){var _0x65b7da=[];var _0x3c2726=[];for(var _0x1626a1=0x0;_0x1626a1<_0x254715[_0x9498('0x37')];_0x1626a1+=0x1){var _0x3d81b4=_0x254715[_0x1626a1][_0x9498('0x38')];if(_0x3d81b4===null){_0x65b7da[_0x9498('0x39')](_0x254715[_0x1626a1]['update'](_0x83bcbc[_0x9498('0x29')],{'transaction':_0x20537c}));}else if(!_0x3c2726[_0x9498('0x3a')](_0x3d81b4)){_0x3c2726['push'](_0x3d81b4);_0x65b7da[_0x9498('0x39')](_0x254715[_0x1626a1][_0x9498('0x28')](_0x83bcbc[_0x9498('0x29')],{'transaction':_0x20537c}));}}return BPromise[_0x9498('0x3b')](_0x65b7da);});})[_0x9498('0xd')](function(_0x1f7c2e){logger['info'](_0x9498('0x3c'),_0x83bcbc);if(_0x1f7c2e['length']>0x0){logger[_0x9498('0x20')](_0x9498('0x3d'),_0x1f7c2e[0x0][_0x9498('0x3e')]['id'],_0x1f7c2e[0x0][_0x9498('0x3e')]['ContactId'],_0x1f7c2e[0x0][_0x9498('0x3e')][_0x9498('0x2b')]);}logger[_0x9498('0xe')](_0x9498('0x3c'),_0x83bcbc,JSON[_0x9498('0x22')](_0x1f7c2e));_0x424bdd(_0x1f7c2e);})[_0x9498('0x15')](function(_0xd171ac){logger[_0x9498('0x10')](_0x9498('0x3c'),_0xd171ac[_0x9498('0x13')],_0x83bcbc);_0x2f95d0(_0x269a23[_0x9498('0x10')](0x1f4,_0xd171ac[_0x9498('0x13')]));});});});};exports['MoveContactManagedDialer']=function(_0x4fef60){var _0x2bdad8=this;return new Promise(function(_0x5da953,_0x5329d5){return db[_0x9498('0x3f')]['transaction'](function(_0x3fa93c){return db[_0x9498('0x40')]['create'](_0x4fef60[_0x9498('0x29')],{'raw':_0x4fef60[_0x9498('0x18')]?_0x4fef60[_0x9498('0x18')][_0x9498('0x19')]===undefined?!![]:![]:!![],'transaction':_0x3fa93c})[_0x9498('0xd')](function(){logger['info'](_0x9498('0x41'),JSON['stringify'](_0x4fef60[_0x9498('0x18')]['where']),_0x4fef60[_0x9498('0x18')][_0x9498('0x1a')][_0x9498('0x2b')]);return db['CmHopper'][_0x9498('0x2d')]({'where':_0x4fef60[_0x9498('0x18')]?_0x4fef60[_0x9498('0x18')][_0x9498('0x1a')]||null:null,'transaction':_0x3fa93c});});})['then'](function(_0x34ec63){logger[_0x9498('0x20')](_0x9498('0x42'),_0x4fef60);logger[_0x9498('0xe')](_0x9498('0x42'),_0x4fef60,JSON['stringify'](_0x34ec63));_0x5da953(_0x34ec63);})['catch'](function(_0x2bf6c1){logger[_0x9498('0x10')](_0x9498('0x42'),_0x2bf6c1['message'],_0x4fef60);_0x5329d5(_0x2bdad8[_0x9498('0x10')](0x1f4,_0x2bf6c1['message']));});});};exports['CountReScheduled']=function(_0x4bc405){var _0x4db035=this;return new Promise(function(_0x459b28,_0x17a216){return db[_0x9498('0x16')][_0x9498('0x17')]({'raw':_0x4bc405[_0x9498('0x18')]?_0x4bc405[_0x9498('0x18')][_0x9498('0x19')]===undefined?!![]:![]:!![],'where':_0x4bc405[_0x9498('0x18')]?_0x4bc405[_0x9498('0x18')]['where']||null:null,'attributes':[[db[_0x9498('0x3f')]['fn'](_0x9498('0x43'),db['sequelize']['fn']('IF',db[_0x9498('0x3f')]['literal'](_0x9498('0x44')+util['format']('\x22%s\x22',moment()[_0x9498('0x45')](_0x9498('0x46')))+_0x9498('0x47')))),_0x9498('0x48')]]})['then'](function(_0x338215){logger[_0x9498('0x20')](_0x9498('0x49'),_0x4bc405);logger[_0x9498('0xe')](_0x9498('0x49'),_0x4bc405,JSON[_0x9498('0x22')](_0x338215));_0x459b28(_0x338215);})[_0x9498('0x15')](function(_0x1d1a99){logger[_0x9498('0x10')](_0x9498('0x49'),_0x1d1a99[_0x9498('0x13')],_0x4bc405);_0x17a216(_0x4db035[_0x9498('0x10')](0x1f4,_0x1d1a99['message']));});});};exports[_0x9498('0x4a')]=function(_0x448771){var _0x589d1b=this;return new Promise(function(_0x450cf6,_0x5e2793){return db[_0x9498('0x32')][_0x9498('0x2e')]()[_0x9498('0xd')](function(_0x5e4c76){return db[_0x9498('0x3f')]['transaction'](function(_0x5c6ad4){return db[_0x9498('0x16')][_0x9498('0x17')]({'where':_0x448771['options']?_0x448771[_0x9498('0x18')][_0x9498('0x1a')]||null:null,'attributes':_0x448771[_0x9498('0x18')]?_0x448771[_0x9498('0x18')]['attributes']||null:null,'limit':0x1,'order':_0x448771[_0x9498('0x18')]?_0x448771[_0x9498('0x18')][_0x9498('0x30')]||null:null,'group':db[_0x9498('0x16')][_0x9498('0x38')],'transaction':_0x5c6ad4,'lock':_0x5c6ad4['LOCK'][_0x9498('0x4b')],'include':_0x448771[_0x9498('0x18')]?_0x448771[_0x9498('0x18')]['include']?_['map'](_0x448771['options'][_0x9498('0x1d')],function(_0x3d5f9d){return{'model':db[_0x3d5f9d[_0x9498('0x1f')]],'as':_0x3d5f9d['as'],'attributes':_0x3d5f9d[_0x9498('0x1b')],'include':_0x3d5f9d['include']?_[_0x9498('0x1e')](_0x3d5f9d[_0x9498('0x1d')],function(_0x56303c){return{'model':db[_0x56303c['model']],'as':_0x56303c['as'],'attributes':_0x56303c['attributes'],'include':_0x56303c[_0x9498('0x1d')]?_[_0x9498('0x1e')](_0x56303c[_0x9498('0x1d')],function(_0x26e6ca){return{'model':db[_0x26e6ca['model']],'as':_0x26e6ca['as'],'attributes':_0x26e6ca['attributes']};}):[]};}):[]};}):[]:[]})[_0x9498('0xd')](function(_0x322ff5){var _0x382b8f=[];for(var _0x28e006=0x0;_0x28e006<_0x322ff5['length'];_0x28e006+=0x1){_0x382b8f[_0x9498('0x39')](_0x322ff5[_0x28e006]['update'](_0x448771[_0x9498('0x29')],{'transaction':_0x5c6ad4}));}return BPromise['all'](_0x382b8f);});})[_0x9498('0xd')](function(_0x14bf32){logger[_0x9498('0x20')](_0x9498('0x4a'),_0x448771);logger[_0x9498('0xe')](_0x9498('0x4a'),_0x448771,JSON[_0x9498('0x22')](_0x14bf32));_0x450cf6(_0x14bf32);})['catch'](function(_0x40805e){logger[_0x9498('0x10')](_0x9498('0x4a'),_0x40805e[_0x9498('0x13')],_0x448771);_0x5e2793(_0x589d1b[_0x9498('0x10')](0x1f4,_0x40805e[_0x9498('0x13')]));});});});};exports[_0x9498('0x4c')]=function(_0x38aca4){var _0x49148c=this;return new Promise(function(_0xf24cb8,_0x345e56){db[_0x9498('0x32')][_0x9498('0x2e')]()[_0x9498('0xd')](function(_0x3cfc50){return db[_0x9498('0x16')]['findAll']({'raw':_0x38aca4[_0x9498('0x18')]?_0x38aca4[_0x9498('0x18')][_0x9498('0x19')]===undefined?!![]:![]:!![],'where':_0x38aca4[_0x9498('0x18')]?_0x38aca4[_0x9498('0x18')][_0x9498('0x1a')]||null:null,'attributes':_0x38aca4['options']?_0x38aca4['options']['attributes']||null:null,'limit':_0x38aca4[_0x9498('0x18')]?_0x38aca4[_0x9498('0x18')][_0x9498('0x1c')]||null:null,'include':_0x38aca4[_0x9498('0x18')]?_0x38aca4[_0x9498('0x18')][_0x9498('0x1d')]?_[_0x9498('0x1e')](_0x38aca4[_0x9498('0x18')]['include'],function(_0x16f99f){return{'model':db[_0x16f99f[_0x9498('0x1f')]],'as':_0x16f99f['as'],'attributes':_0x16f99f['as']===_0x9498('0x33')?_['keys'](_0x3cfc50):_0x16f99f[_0x9498('0x1b')],'include':_0x16f99f[_0x9498('0x1d')]?_[_0x9498('0x1e')](_0x16f99f[_0x9498('0x1d')],function(_0x34b748){return{'model':db[_0x34b748['model']],'as':_0x34b748['as'],'attributes':_0x34b748[_0x9498('0x1b')],'include':_0x34b748['include']?_[_0x9498('0x1e')](_0x34b748['include'],function(_0x2f97fa){return{'model':db[_0x2f97fa['model']],'as':_0x2f97fa['as'],'attributes':_0x2f97fa[_0x9498('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9498('0xd')](function(_0x193ca1){logger[_0x9498('0x20')](_0x9498('0x21'),_0x38aca4);logger[_0x9498('0xe')](_0x9498('0x21'),_0x38aca4,JSON['stringify'](_0x193ca1));_0xf24cb8(_0x193ca1);})[_0x9498('0x15')](function(_0x43b2cc){logger[_0x9498('0x10')](_0x9498('0x21'),_0x43b2cc[_0x9498('0x13')],_0x38aca4);_0x345e56(_0x49148c[_0x9498('0x10')](0x1f4,_0x43b2cc[_0x9498('0x13')]));});});});};exports[_0x9498('0x4d')]=function(_0x1beeab){var _0x550328=this;return new Promise(function(_0x2ff7a3,_0x372c22){return db['CmContact'][_0x9498('0x4e')]({'raw':!![],'where':{'phone':_0x1beeab[_0x9498('0x18')][_0x9498('0x1a')]['phone']},'attributes':['id',_0x9498('0x4f')],'order':[['id',_0x9498('0x50')]]})[_0x9498('0xd')](function(_0x5ec0b7){logger[_0x9498('0x20')](_0x9498('0x51'),_0x1beeab);logger['debug']('getContactByPhone',_0x1beeab,JSON['stringify'](_0x5ec0b7));_0x2ff7a3(_0x5ec0b7);})['catch'](function(_0xa2c01f){logger['error'](_0x9498('0x51'),_0xa2c01f['message'],_0x1beeab);_0x372c22(_0x550328[_0x9498('0x10')](0x1f4,_0xa2c01f['message']));});});};exports[_0x9498('0x52')]=function(_0xa37b26){var _0x1dc3a1=this;return new Promise(function(_0x579273,_0x5d88a1){return db[_0x9498('0x3f')][_0x9498('0x2f')](function(_0x4fd7a5){return db[_0x9498('0x16')]['update']({'active':![]},{'where':{},'transaction':_0x4fd7a5})[_0x9498('0xd')](function(_0x3394f7){logger[_0x9498('0x20')](_0x9498('0x52'),_0xa37b26);logger[_0x9498('0xe')](_0x9498('0x52'),_0xa37b26,JSON['stringify'](_0x3394f7));_0x579273(_0x3394f7);})[_0x9498('0x15')](function(_0x181c9f){logger[_0x9498('0x10')]('ResetActiveCalls',_0x181c9f['message'],_0xa37b26);_0x5d88a1(_0x1dc3a1[_0x9498('0x10')](0x1f4,_0x181c9f[_0x9498('0x13')]));});});});};exports[_0x9498('0x53')]=function(_0x507b40){var _0x4fa152=this;var _0x27af1b=_0x507b40[_0x9498('0x29')][_0x9498('0x1a')][_0x9498('0x54')];var _0x2eb9ef=_0x507b40['body'][_0x9498('0x1a')][_0x9498('0x55')];return new Promise(function(_0x16bc50,_0x52bd52){return db[_0x9498('0x16')][_0x9498('0x17')]({'where':{'voiceQueueId':_0x27af1b,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x9498('0x3f')][_0x9498('0x56')]('NOW()\x20+\x20INTERVAL\x20'+_0x2eb9ef+_0x9498('0x57'))}},'include':[{'model':db[_0x9498('0x32')],'as':_0x9498('0x33')},{'model':db[_0x9498('0x34')],'as':_0x9498('0x58'),'attributes':['id',_0x9498('0x35'),'voicePause']},{'model':db[_0x9498('0x59')],'as':_0x9498('0x5a')}]})[_0x9498('0xd')](function(_0x10daa7){return db[_0x9498('0x3f')][_0x9498('0x2f')](function(_0x43aa51){return db[_0x9498('0x16')][_0x9498('0x28')]({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x27af1b,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x9498('0x3f')][_0x9498('0x56')](_0x9498('0x5b')+_0x2eb9ef+_0x9498('0x57'))}},'transaction':_0x43aa51})[_0x9498('0xd')](function(_0x2e4dbd){_0x16bc50(_0x10daa7);})[_0x9498('0x15')](function(_0x3bdd20){logger[_0x9498('0x10')](_0x9498('0x53'),_0x3bdd20[_0x9498('0x13')],_0x507b40);_0x52bd52(validateExpressRequest);});});})[_0x9498('0x15')](function(_0x24c457){logger[_0x9498('0x10')]('CmHopperHandlePreviewRecallNotifications',_0x24c457['message'],_0x507b40);_0x52bd52(_0x4fa152['error'](0x1f4,_0x24c457[_0x9498('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 60ef009..b90cc7e 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 _0x9c5a=['get','index','describe','isAuthenticated','getOpenContacts','/timezones','/:id','show','post','create','/preview','getPreview','/timezone','getTimezone','/previewrecall','getPreviewRecall','put','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x56d039,_0x1c04cb){var _0x1ea0b0=function(_0x568ede){while(--_0x568ede){_0x56d039['push'](_0x56d039['shift']());}};_0x1ea0b0(++_0x1c04cb);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x41e0d1,_0x25f9ad){_0x41e0d1=_0x41e0d1-0x0;var _0x27993e=_0x9c5a[_0x41e0d1];return _0x27993e;};'use strict';var multer=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var path=require('path');var timeout=require(_0xa9c5('0x2'));var express=require(_0xa9c5('0x3'));var router=express[_0xa9c5('0x4')]();var fs_extra=require(_0xa9c5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var controller=require('./cmHopper.controller');router[_0xa9c5('0x8')]('/',auth['isAuthenticated'](),controller[_0xa9c5('0x9')]);router[_0xa9c5('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xa9c5('0xa')]);router[_0xa9c5('0x8')]('/opencontacts',auth[_0xa9c5('0xb')](),controller[_0xa9c5('0xc')]);router['get'](_0xa9c5('0xd'),auth[_0xa9c5('0xb')](),controller['getTimezones']);router['get'](_0xa9c5('0xe'),auth[_0xa9c5('0xb')](),controller[_0xa9c5('0xf')]);router[_0xa9c5('0x10')]('/',auth[_0xa9c5('0xb')](),controller[_0xa9c5('0x11')]);router[_0xa9c5('0x10')](_0xa9c5('0x12'),auth[_0xa9c5('0xb')](),controller[_0xa9c5('0x13')]);router['post'](_0xa9c5('0x14'),auth[_0xa9c5('0xb')](),controller[_0xa9c5('0x15')]);router[_0xa9c5('0x10')](_0xa9c5('0x16'),auth[_0xa9c5('0xb')](),controller[_0xa9c5('0x17')]);router[_0xa9c5('0x18')](_0xa9c5('0xe'),auth[_0xa9c5('0xb')](),controller['update']);router[_0xa9c5('0x19')](_0xa9c5('0xe'),auth[_0xa9c5('0xb')](),controller['destroy']);module[_0xa9c5('0x1a')]=router; \ No newline at end of file +var _0x5b6b=['index','describe','/opencontacts','getOpenContacts','/timezones','/:id','create','post','/preview','getPreview','/timezone','getTimezone','/previewrecall','getPreviewRecall','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated'];(function(_0x18a121,_0x540c78){var _0x51a5af=function(_0x4557f8){while(--_0x4557f8){_0x18a121['push'](_0x18a121['shift']());}};_0x51a5af(++_0x540c78);}(_0x5b6b,0x121));var _0xb5b6=function(_0x10ac9d,_0x129feb){_0x10ac9d=_0x10ac9d-0x0;var _0x482435=_0x5b6b[_0x10ac9d];return _0x482435;};'use strict';var multer=require(_0xb5b6('0x0'));var util=require('util');var path=require(_0xb5b6('0x1'));var timeout=require('connect-timeout');var express=require(_0xb5b6('0x2'));var router=express[_0xb5b6('0x3')]();var fs_extra=require(_0xb5b6('0x4'));var auth=require(_0xb5b6('0x5'));var interaction=require(_0xb5b6('0x6'));var config=require(_0xb5b6('0x7'));var controller=require(_0xb5b6('0x8'));router[_0xb5b6('0x9')]('/',auth[_0xb5b6('0xa')](),controller[_0xb5b6('0xb')]);router[_0xb5b6('0x9')]('/describe',auth[_0xb5b6('0xa')](),controller[_0xb5b6('0xc')]);router[_0xb5b6('0x9')](_0xb5b6('0xd'),auth[_0xb5b6('0xa')](),controller[_0xb5b6('0xe')]);router[_0xb5b6('0x9')](_0xb5b6('0xf'),auth[_0xb5b6('0xa')](),controller['getTimezones']);router[_0xb5b6('0x9')](_0xb5b6('0x10'),auth[_0xb5b6('0xa')](),controller['show']);router['post']('/',auth[_0xb5b6('0xa')](),controller[_0xb5b6('0x11')]);router[_0xb5b6('0x12')](_0xb5b6('0x13'),auth[_0xb5b6('0xa')](),controller[_0xb5b6('0x14')]);router[_0xb5b6('0x12')](_0xb5b6('0x15'),auth[_0xb5b6('0xa')](),controller[_0xb5b6('0x16')]);router[_0xb5b6('0x12')](_0xb5b6('0x17'),auth[_0xb5b6('0xa')](),controller[_0xb5b6('0x18')]);router[_0xb5b6('0x19')](_0xb5b6('0x10'),auth[_0xb5b6('0xa')](),controller[_0xb5b6('0x1a')]);router[_0xb5b6('0x1b')](_0xb5b6('0x10'),auth[_0xb5b6('0xa')](),controller[_0xb5b6('0x1c')]);module[_0xb5b6('0x1d')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 86b3f0b..b1c2ed6 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 _0xf131=['STRING','INTEGER','contactListQueue','moment','sequelize','exports'];(function(_0x532807,_0x92d7fd){var _0x40b83f=function(_0x1c312c){while(--_0x1c312c){_0x532807['push'](_0x532807['shift']());}};_0x40b83f(++_0x92d7fd);}(_0xf131,0x1a1));var _0x1f13=function(_0x2f1051,_0x3ccde2){_0x2f1051=_0x2f1051-0x0;var _0x24cb2f=_0xf131[_0x2f1051];return _0x24cb2f;};'use strict';var moment=require(_0x1f13('0x0'));var Sequelize=require(_0x1f13('0x1'));module[_0x1f13('0x2')]={'phone':{'type':Sequelize[_0x1f13('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x1f13('0x4')],'unique':_0x1f13('0x5')},'ListId':{'type':Sequelize[_0x1f13('0x4')],'unique':_0x1f13('0x5')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x1f13('0x5')}}; \ No newline at end of file +var _0x1b65=['exports','STRING','contactListQueue','INTEGER','moment','sequelize'];(function(_0x3060e3,_0x14f2c6){var _0x497d2c=function(_0x2a274a){while(--_0x2a274a){_0x3060e3['push'](_0x3060e3['shift']());}};_0x497d2c(++_0x14f2c6);}(_0x1b65,0x1b4));var _0x51b6=function(_0x4faad9,_0x3ba3b5){_0x4faad9=_0x4faad9-0x0;var _0xd3503d=_0x1b65[_0x4faad9];return _0xd3503d;};'use strict';var moment=require(_0x51b6('0x0'));var Sequelize=require(_0x51b6('0x1'));module[_0x51b6('0x2')]={'phone':{'type':Sequelize[_0x51b6('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x51b6('0x4')},'ListId':{'type':Sequelize[_0x51b6('0x5')],'unique':_0x51b6('0x4')},'VoiceQueueId':{'type':Sequelize[_0x51b6('0x5')],'unique':_0x51b6('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 37308d0..ddf0563 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 _0xf8f5=['options','includeAll','include','findAll','catch','params','keys','find','update','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','index','map','CmHopperBlack','rawAttributes','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL'];(function(_0x39efbf,_0x118364){var _0xcbd510=function(_0x4e152f){while(--_0x4e152f){_0x39efbf['push'](_0x39efbf['shift']());}};_0xcbd510(++_0x118364);}(_0xf8f5,0x127));var _0x5f8f=function(_0x1cabde,_0x13d4af){_0x1cabde=_0x1cabde-0x0;var _0x2aa6f9=_0xf8f5[_0x1cabde];return _0x2aa6f9;};'use strict';var emlformat=require(_0x5f8f('0x0'));var rimraf=require(_0x5f8f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5f8f('0x2'));var rp=require(_0x5f8f('0x3'));var moment=require('moment');var BPromise=require(_0x5f8f('0x4'));var Mustache=require(_0x5f8f('0x5'));var util=require('util');var path=require(_0x5f8f('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5f8f('0x7'));var fs=require('fs');var fs_extra=require(_0x5f8f('0x8'));var _=require(_0x5f8f('0x9'));var squel=require(_0x5f8f('0xa'));var crypto=require(_0x5f8f('0xb'));var jsforce=require(_0x5f8f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5f8f('0xd'));var querystring=require(_0x5f8f('0xe'));var Papa=require(_0x5f8f('0xf'));var Redis=require(_0x5f8f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5f8f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5f8f('0x12'))(_0x5f8f('0x13'));var utils=require(_0x5f8f('0x14'));var config=require(_0x5f8f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x5f8f('0x16'))['db'];function respondWithStatusCode(_0x2c9da9,_0x289617){_0x289617=_0x289617||0xcc;return function(_0x4cbd63){if(_0x4cbd63){return _0x2c9da9[_0x5f8f('0x17')](_0x289617);}return _0x2c9da9[_0x5f8f('0x18')](_0x289617)[_0x5f8f('0x19')]();};}function respondWithResult(_0x206b41,_0x5711f6){_0x5711f6=_0x5711f6||0xc8;return function(_0x2b8813){if(_0x2b8813){return _0x206b41[_0x5f8f('0x18')](_0x5711f6)[_0x5f8f('0x1a')](_0x2b8813);}};}function respondWithFilteredResult(_0x43cb5c,_0x1c4b5c){return function(_0x42c93e){if(_0x42c93e){var _0x1a44b4=typeof _0x1c4b5c[_0x5f8f('0x1b')]==='undefined'&&typeof _0x1c4b5c[_0x5f8f('0x1c')]==='undefined';var _0x17f4ca=_0x42c93e['count'];var _0x3b73a1=_0x1a44b4?0x0:_0x1c4b5c[_0x5f8f('0x1b')];var _0x4202d3=_0x1a44b4?_0x42c93e[_0x5f8f('0x1d')]:_0x1c4b5c[_0x5f8f('0x1b')]+_0x1c4b5c[_0x5f8f('0x1c')];var _0x1f45c1;if(_0x4202d3>=_0x17f4ca){_0x4202d3=_0x17f4ca;_0x1f45c1=0xc8;}else{_0x1f45c1=0xce;}_0x43cb5c['status'](_0x1f45c1);return _0x43cb5c[_0x5f8f('0x1e')](_0x5f8f('0x1f'),_0x3b73a1+'-'+_0x4202d3+'/'+_0x17f4ca)[_0x5f8f('0x1a')](_0x42c93e);}return null;};}function patchUpdates(_0x24c96f){return function(_0x1e6a8f){try{jsonpatch[_0x5f8f('0x20')](_0x1e6a8f,_0x24c96f,!![]);}catch(_0x10639b){return BPromise['reject'](_0x10639b);}return _0x1e6a8f[_0x5f8f('0x21')]();};}function saveUpdates(_0x4eb23f,_0x2b194e){return function(_0x43574e){if(_0x43574e){return _0x43574e['update'](_0x4eb23f)[_0x5f8f('0x22')](function(_0x5214e6){return _0x5214e6;});}return null;};}function removeEntity(_0x54ef1b,_0x11f526){return function(_0x4bf48f){if(_0x4bf48f){return _0x4bf48f[_0x5f8f('0x23')]()[_0x5f8f('0x22')](function(){_0x54ef1b[_0x5f8f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x218a84,_0x3aa9f6){return function(_0x4ea579){if(!_0x4ea579){_0x218a84[_0x5f8f('0x17')](0x194);}return _0x4ea579;};}function handleError(_0x3dc851,_0x1b3525){_0x1b3525=_0x1b3525||0x1f4;return function(_0x4e0d64){logger[_0x5f8f('0x24')](_0x4e0d64[_0x5f8f('0x25')]);if(_0x4e0d64[_0x5f8f('0x26')]){delete _0x4e0d64[_0x5f8f('0x26')];}_0x3dc851[_0x5f8f('0x18')](_0x1b3525)['send'](_0x4e0d64);};}exports[_0x5f8f('0x27')]=function(_0x3201af,_0x4a900f){var _0x5dabb9={},_0x436851={},_0x17d5e5={'count':0x0,'rows':[]};var _0x1eb71e=_[_0x5f8f('0x28')](db[_0x5f8f('0x29')][_0x5f8f('0x2a')],function(_0x3ebe67){return{'name':_0x3ebe67['fieldName'],'type':_0x3ebe67[_0x5f8f('0x2b')][_0x5f8f('0x2c')]};});_0x436851[_0x5f8f('0x2d')]=_[_0x5f8f('0x28')](_0x1eb71e,_0x5f8f('0x26'));_0x436851['query']=_['keys'](_0x3201af[_0x5f8f('0x2e')]);_0x436851['filters']=_['intersection'](_0x436851[_0x5f8f('0x2d')],_0x436851[_0x5f8f('0x2e')]);_0x5dabb9['attributes']=_[_0x5f8f('0x2f')](_0x436851['model'],qs[_0x5f8f('0x30')](_0x3201af[_0x5f8f('0x2e')][_0x5f8f('0x30')]));_0x5dabb9[_0x5f8f('0x31')]=_0x5dabb9[_0x5f8f('0x31')][_0x5f8f('0x32')]?_0x5dabb9[_0x5f8f('0x31')]:_0x436851[_0x5f8f('0x2d')];if(!_0x3201af[_0x5f8f('0x2e')][_0x5f8f('0x33')](_0x5f8f('0x34'))){_0x5dabb9[_0x5f8f('0x1c')]=qs[_0x5f8f('0x1c')](_0x3201af[_0x5f8f('0x2e')][_0x5f8f('0x1c')]);_0x5dabb9[_0x5f8f('0x1b')]=qs[_0x5f8f('0x1b')](_0x3201af['query'][_0x5f8f('0x1b')]);}_0x5dabb9[_0x5f8f('0x35')]=qs[_0x5f8f('0x36')](_0x3201af[_0x5f8f('0x2e')][_0x5f8f('0x36')]);_0x5dabb9[_0x5f8f('0x37')]=qs[_0x5f8f('0x38')](_['pick'](_0x3201af[_0x5f8f('0x2e')],_0x436851[_0x5f8f('0x38')]),_0x1eb71e);if(_0x3201af[_0x5f8f('0x2e')][_0x5f8f('0x39')]){_0x5dabb9['where']=_[_0x5f8f('0x3a')](_0x5dabb9['where'],{'$or':_[_0x5f8f('0x28')](_0x1eb71e,function(_0x1f115c){if(_0x1f115c[_0x5f8f('0x2b')]!==_0x5f8f('0x3b')){var _0x578076={};_0x578076[_0x1f115c[_0x5f8f('0x26')]]={'$like':'%'+_0x3201af[_0x5f8f('0x2e')][_0x5f8f('0x39')]+'%'};return _0x578076;}})});}_0x5dabb9=_[_0x5f8f('0x3a')]({},_0x5dabb9,_0x3201af[_0x5f8f('0x3c')]);var _0x2f2a9c={'where':_0x5dabb9['where']};return db[_0x5f8f('0x29')][_0x5f8f('0x1d')](_0x2f2a9c)[_0x5f8f('0x22')](function(_0x444c27){_0x17d5e5[_0x5f8f('0x1d')]=_0x444c27;if(_0x3201af[_0x5f8f('0x2e')][_0x5f8f('0x3d')]){_0x5dabb9[_0x5f8f('0x3e')]=[{'all':!![]}];}return db[_0x5f8f('0x29')][_0x5f8f('0x3f')](_0x5dabb9);})[_0x5f8f('0x22')](function(_0x309e35){_0x17d5e5['rows']=_0x309e35;return _0x17d5e5;})[_0x5f8f('0x22')](respondWithFilteredResult(_0x4a900f,_0x5dabb9))[_0x5f8f('0x40')](handleError(_0x4a900f,null));};exports['show']=function(_0x2bea6c,_0x542593){var _0x5b4761={'raw':!![],'where':{'id':_0x2bea6c[_0x5f8f('0x41')]['id']}},_0x1c5b54={};_0x1c5b54[_0x5f8f('0x2d')]=_[_0x5f8f('0x42')](db['CmHopperBlack'][_0x5f8f('0x2a')]);_0x1c5b54[_0x5f8f('0x2e')]=_['keys'](_0x2bea6c[_0x5f8f('0x2e')]);_0x1c5b54[_0x5f8f('0x38')]=_[_0x5f8f('0x2f')](_0x1c5b54['model'],_0x1c5b54['query']);_0x5b4761[_0x5f8f('0x31')]=_[_0x5f8f('0x2f')](_0x1c5b54[_0x5f8f('0x2d')],qs['fields'](_0x2bea6c['query'][_0x5f8f('0x30')]));_0x5b4761[_0x5f8f('0x31')]=_0x5b4761[_0x5f8f('0x31')]['length']?_0x5b4761[_0x5f8f('0x31')]:_0x1c5b54[_0x5f8f('0x2d')];if(_0x2bea6c[_0x5f8f('0x2e')][_0x5f8f('0x3d')]){_0x5b4761[_0x5f8f('0x3e')]=[{'all':!![]}];}_0x5b4761=_['merge']({},_0x5b4761,_0x2bea6c['options']);return db[_0x5f8f('0x29')][_0x5f8f('0x43')](_0x5b4761)['then'](handleEntityNotFound(_0x542593,null))['then'](respondWithResult(_0x542593,null))[_0x5f8f('0x40')](handleError(_0x542593,null));};exports[_0x5f8f('0x44')]=function(_0x5e16f4,_0x203690){if(_0x5e16f4[_0x5f8f('0x45')]['id']){delete _0x5e16f4[_0x5f8f('0x45')]['id'];}return db[_0x5f8f('0x29')]['find']({'where':{'id':_0x5e16f4[_0x5f8f('0x41')]['id']}})[_0x5f8f('0x22')](handleEntityNotFound(_0x203690,null))[_0x5f8f('0x22')](saveUpdates(_0x5e16f4[_0x5f8f('0x45')],null))[_0x5f8f('0x22')](respondWithResult(_0x203690,null))[_0x5f8f('0x40')](handleError(_0x203690,null));};exports[_0x5f8f('0x23')]=function(_0x1a4130,_0x41cc53){return db[_0x5f8f('0x29')]['find']({'where':{'id':_0x1a4130['params']['id']}})[_0x5f8f('0x22')](handleEntityNotFound(_0x41cc53,null))[_0x5f8f('0x22')](removeEntity(_0x41cc53,null))['catch'](handleError(_0x41cc53,null));};exports[_0x5f8f('0x46')]=function(_0x189821,_0x28aea1){return db[_0x5f8f('0x29')][_0x5f8f('0x46')]()[_0x5f8f('0x22')](respondWithResult(_0x28aea1,null))[_0x5f8f('0x40')](handleError(_0x28aea1,null));}; \ No newline at end of file +var _0xd6d1=['pick','merge','VIRTUAL','filter','includeAll','include','findAll','catch','show','params','options','find','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0xd6d1,0x14a));var _0x1d6d=function(_0xcc91ee,_0x259259){_0xcc91ee=_0xcc91ee-0x0;var _0x3e51ca=_0xd6d1[_0xcc91ee];return _0x3e51ca;};'use strict';var emlformat=require(_0x1d6d('0x0'));var rimraf=require(_0x1d6d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1d6d('0x2'));var moment=require(_0x1d6d('0x3'));var BPromise=require(_0x1d6d('0x4'));var Mustache=require(_0x1d6d('0x5'));var util=require(_0x1d6d('0x6'));var path=require(_0x1d6d('0x7'));var sox=require(_0x1d6d('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1d6d('0x9'));var squel=require(_0x1d6d('0xa'));var crypto=require(_0x1d6d('0xb'));var jsforce=require(_0x1d6d('0xc'));var deskjs=require(_0x1d6d('0xd'));var toCsv=require(_0x1d6d('0xe'));var querystring=require(_0x1d6d('0xf'));var Papa=require(_0x1d6d('0x10'));var Redis=require('ioredis');var authService=require(_0x1d6d('0x11'));var qs=require(_0x1d6d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d6d('0x13'));var logger=require(_0x1d6d('0x14'))(_0x1d6d('0x15'));var utils=require(_0x1d6d('0x16'));var config=require(_0x1d6d('0x17'));var licenseUtil=require(_0x1d6d('0x18'));var db=require(_0x1d6d('0x19'))['db'];function respondWithStatusCode(_0x1fa352,_0x57134a){_0x57134a=_0x57134a||0xcc;return function(_0x55c117){if(_0x55c117){return _0x1fa352[_0x1d6d('0x1a')](_0x57134a);}return _0x1fa352[_0x1d6d('0x1b')](_0x57134a)['end']();};}function respondWithResult(_0x1e3f78,_0xc9b5c6){_0xc9b5c6=_0xc9b5c6||0xc8;return function(_0x3ef5cf){if(_0x3ef5cf){return _0x1e3f78['status'](_0xc9b5c6)[_0x1d6d('0x1c')](_0x3ef5cf);}};}function respondWithFilteredResult(_0xea9dc0,_0x39df0c){return function(_0x2a4100){if(_0x2a4100){var _0x5d6a07=typeof _0x39df0c['offset']===_0x1d6d('0x1d')&&typeof _0x39df0c[_0x1d6d('0x1e')]===_0x1d6d('0x1d');var _0x45b06f=_0x2a4100[_0x1d6d('0x1f')];var _0x44cf87=_0x5d6a07?0x0:_0x39df0c[_0x1d6d('0x20')];var _0x21b255=_0x5d6a07?_0x2a4100[_0x1d6d('0x1f')]:_0x39df0c[_0x1d6d('0x20')]+_0x39df0c[_0x1d6d('0x1e')];var _0x3fd015;if(_0x21b255>=_0x45b06f){_0x21b255=_0x45b06f;_0x3fd015=0xc8;}else{_0x3fd015=0xce;}_0xea9dc0[_0x1d6d('0x1b')](_0x3fd015);return _0xea9dc0['set'](_0x1d6d('0x21'),_0x44cf87+'-'+_0x21b255+'/'+_0x45b06f)['json'](_0x2a4100);}return null;};}function patchUpdates(_0x414b4f){return function(_0x42d01a){try{jsonpatch[_0x1d6d('0x22')](_0x42d01a,_0x414b4f,!![]);}catch(_0x5c42b7){return BPromise[_0x1d6d('0x23')](_0x5c42b7);}return _0x42d01a[_0x1d6d('0x24')]();};}function saveUpdates(_0x261bce,_0x354284){return function(_0x38d6ae){if(_0x38d6ae){return _0x38d6ae[_0x1d6d('0x25')](_0x261bce)[_0x1d6d('0x26')](function(_0x1c4284){return _0x1c4284;});}return null;};}function removeEntity(_0x55f4b7,_0x3d8668){return function(_0x1af567){if(_0x1af567){return _0x1af567[_0x1d6d('0x27')]()[_0x1d6d('0x26')](function(){_0x55f4b7[_0x1d6d('0x1b')](0xcc)[_0x1d6d('0x28')]();});}};}function handleEntityNotFound(_0x413591,_0x3e6b0f){return function(_0x177e48){if(!_0x177e48){_0x413591['sendStatus'](0x194);}return _0x177e48;};}function handleError(_0x5b15e8,_0x50def4){_0x50def4=_0x50def4||0x1f4;return function(_0x2243b0){logger[_0x1d6d('0x29')](_0x2243b0[_0x1d6d('0x2a')]);if(_0x2243b0[_0x1d6d('0x2b')]){delete _0x2243b0[_0x1d6d('0x2b')];}_0x5b15e8[_0x1d6d('0x1b')](_0x50def4)[_0x1d6d('0x2c')](_0x2243b0);};}exports[_0x1d6d('0x2d')]=function(_0x3f05ea,_0x10e3fe){var _0x34c576={},_0x54e79c={},_0x32e21d={'count':0x0,'rows':[]};var _0x24eeee=_[_0x1d6d('0x2e')](db[_0x1d6d('0x2f')][_0x1d6d('0x30')],function(_0x2a27bf){return{'name':_0x2a27bf[_0x1d6d('0x31')],'type':_0x2a27bf[_0x1d6d('0x32')][_0x1d6d('0x33')]};});_0x54e79c[_0x1d6d('0x34')]=_[_0x1d6d('0x2e')](_0x24eeee,_0x1d6d('0x2b'));_0x54e79c[_0x1d6d('0x35')]=_[_0x1d6d('0x36')](_0x3f05ea[_0x1d6d('0x35')]);_0x54e79c['filters']=_['intersection'](_0x54e79c['model'],_0x54e79c[_0x1d6d('0x35')]);_0x34c576[_0x1d6d('0x37')]=_[_0x1d6d('0x38')](_0x54e79c[_0x1d6d('0x34')],qs[_0x1d6d('0x39')](_0x3f05ea[_0x1d6d('0x35')][_0x1d6d('0x39')]));_0x34c576[_0x1d6d('0x37')]=_0x34c576[_0x1d6d('0x37')][_0x1d6d('0x3a')]?_0x34c576[_0x1d6d('0x37')]:_0x54e79c[_0x1d6d('0x34')];if(!_0x3f05ea[_0x1d6d('0x35')][_0x1d6d('0x3b')](_0x1d6d('0x3c'))){_0x34c576[_0x1d6d('0x1e')]=qs['limit'](_0x3f05ea[_0x1d6d('0x35')][_0x1d6d('0x1e')]);_0x34c576[_0x1d6d('0x20')]=qs[_0x1d6d('0x20')](_0x3f05ea[_0x1d6d('0x35')]['offset']);}_0x34c576[_0x1d6d('0x3d')]=qs['sort'](_0x3f05ea[_0x1d6d('0x35')][_0x1d6d('0x3e')]);_0x34c576[_0x1d6d('0x3f')]=qs[_0x1d6d('0x40')](_[_0x1d6d('0x41')](_0x3f05ea[_0x1d6d('0x35')],_0x54e79c[_0x1d6d('0x40')]),_0x24eeee);if(_0x3f05ea[_0x1d6d('0x35')]['filter']){_0x34c576[_0x1d6d('0x3f')]=_[_0x1d6d('0x42')](_0x34c576[_0x1d6d('0x3f')],{'$or':_[_0x1d6d('0x2e')](_0x24eeee,function(_0x49a1b7){if(_0x49a1b7['type']!==_0x1d6d('0x43')){var _0x2ed386={};_0x2ed386[_0x49a1b7['name']]={'$like':'%'+_0x3f05ea[_0x1d6d('0x35')][_0x1d6d('0x44')]+'%'};return _0x2ed386;}})});}_0x34c576=_[_0x1d6d('0x42')]({},_0x34c576,_0x3f05ea['options']);var _0x4a90a7={'where':_0x34c576[_0x1d6d('0x3f')]};return db['CmHopperBlack'][_0x1d6d('0x1f')](_0x4a90a7)[_0x1d6d('0x26')](function(_0x280cb3){_0x32e21d['count']=_0x280cb3;if(_0x3f05ea[_0x1d6d('0x35')][_0x1d6d('0x45')]){_0x34c576[_0x1d6d('0x46')]=[{'all':!![]}];}return db[_0x1d6d('0x2f')][_0x1d6d('0x47')](_0x34c576);})['then'](function(_0x460c74){_0x32e21d['rows']=_0x460c74;return _0x32e21d;})[_0x1d6d('0x26')](respondWithFilteredResult(_0x10e3fe,_0x34c576))[_0x1d6d('0x48')](handleError(_0x10e3fe,null));};exports[_0x1d6d('0x49')]=function(_0xfb0fd0,_0x13401c){var _0x2cc48f={'raw':!![],'where':{'id':_0xfb0fd0[_0x1d6d('0x4a')]['id']}},_0x41e6cf={};_0x41e6cf['model']=_['keys'](db[_0x1d6d('0x2f')][_0x1d6d('0x30')]);_0x41e6cf[_0x1d6d('0x35')]=_['keys'](_0xfb0fd0['query']);_0x41e6cf[_0x1d6d('0x40')]=_[_0x1d6d('0x38')](_0x41e6cf['model'],_0x41e6cf[_0x1d6d('0x35')]);_0x2cc48f[_0x1d6d('0x37')]=_['intersection'](_0x41e6cf['model'],qs[_0x1d6d('0x39')](_0xfb0fd0['query'][_0x1d6d('0x39')]));_0x2cc48f[_0x1d6d('0x37')]=_0x2cc48f['attributes'][_0x1d6d('0x3a')]?_0x2cc48f['attributes']:_0x41e6cf['model'];if(_0xfb0fd0[_0x1d6d('0x35')][_0x1d6d('0x45')]){_0x2cc48f[_0x1d6d('0x46')]=[{'all':!![]}];}_0x2cc48f=_[_0x1d6d('0x42')]({},_0x2cc48f,_0xfb0fd0[_0x1d6d('0x4b')]);return db[_0x1d6d('0x2f')][_0x1d6d('0x4c')](_0x2cc48f)['then'](handleEntityNotFound(_0x13401c,null))['then'](respondWithResult(_0x13401c,null))[_0x1d6d('0x48')](handleError(_0x13401c,null));};exports[_0x1d6d('0x25')]=function(_0x519612,_0x315bc4){if(_0x519612[_0x1d6d('0x4d')]['id']){delete _0x519612[_0x1d6d('0x4d')]['id'];}return db[_0x1d6d('0x2f')][_0x1d6d('0x4c')]({'where':{'id':_0x519612['params']['id']}})[_0x1d6d('0x26')](handleEntityNotFound(_0x315bc4,null))['then'](saveUpdates(_0x519612[_0x1d6d('0x4d')],null))['then'](respondWithResult(_0x315bc4,null))['catch'](handleError(_0x315bc4,null));};exports['destroy']=function(_0x489621,_0xa6086f){return db[_0x1d6d('0x2f')][_0x1d6d('0x4c')]({'where':{'id':_0x489621[_0x1d6d('0x4a')]['id']}})[_0x1d6d('0x26')](handleEntityNotFound(_0xa6086f,null))[_0x1d6d('0x26')](removeEntity(_0xa6086f,null))['catch'](handleError(_0xa6086f,null));};exports[_0x1d6d('0x4e')]=function(_0x509b31,_0x233147){return db['CmHopperBlack']['describe']()[_0x1d6d('0x26')](respondWithResult(_0x233147,null))[_0x1d6d('0x48')](handleError(_0x233147,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 605e241..e373bb9 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 _0x1a38=['bluebird','request-promise','path','rimraf','exports','define','CmHopperBlack','lodash','util','api','moment'];(function(_0x583419,_0xba8746){var _0xa7d0bf=function(_0x56a6aa){while(--_0x56a6aa){_0x583419['push'](_0x583419['shift']());}};_0xa7d0bf(++_0xba8746);}(_0x1a38,0x10f));var _0x81a3=function(_0x3c59fc,_0x10dbd2){_0x3c59fc=_0x3c59fc-0x0;var _0x2b78d4=_0x1a38[_0x3c59fc];return _0x2b78d4;};'use strict';var _=require(_0x81a3('0x0'));var util=require(_0x81a3('0x1'));var logger=require('../../config/logger')(_0x81a3('0x2'));var moment=require(_0x81a3('0x3'));var BPromise=require(_0x81a3('0x4'));var rp=require(_0x81a3('0x5'));var fs=require('fs');var path=require(_0x81a3('0x6'));var rimraf=require(_0x81a3('0x7'));var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module[_0x81a3('0x8')]=function(_0x5946b5,_0x442b6b){return _0x5946b5[_0x81a3('0x9')](_0x81a3('0xa'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ffe=['exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x2106eb,_0x272f84){var _0x3e1c29=function(_0x8b0af5){while(--_0x8b0af5){_0x2106eb['push'](_0x2106eb['shift']());}};_0x3e1c29(++_0x272f84);}(_0x8ffe,0x185));var _0xe8ff=function(_0x3a4517,_0x30e4d5){_0x3a4517=_0x3a4517-0x0;var _0x1a726b=_0x8ffe[_0x3a4517];return _0x1a726b;};'use strict';var _=require(_0xe8ff('0x0'));var util=require(_0xe8ff('0x1'));var logger=require(_0xe8ff('0x2'))(_0xe8ff('0x3'));var moment=require(_0xe8ff('0x4'));var BPromise=require(_0xe8ff('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe8ff('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module[_0xe8ff('0x7')]=function(_0x1f87c2,_0x178233){return _0x1f87c2[_0xe8ff('0x8')](_0xe8ff('0x9'),attributes,{'tableName':_0xe8ff('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 be6715f..444c59b 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 _0x732a=['UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','update','body'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x732a,0x143));var _0xa732=function(_0x260859,_0x3cfcff){_0x260859=_0x260859-0x0;var _0x4b77f8=_0x732a[_0x260859];return _0x4b77f8;};'use strict';var _=require(_0xa732('0x0'));var util=require('util');var moment=require(_0xa732('0x1'));var BPromise=require(_0xa732('0x2'));var rs=require(_0xa732('0x3'));var fs=require('fs');var Redis=require(_0xa732('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa732('0x5'))(_0xa732('0x6'));var config=require(_0xa732('0x7'));var jayson=require(_0xa732('0x8'));var client=jayson[_0xa732('0x9')][_0xa732('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2869b1,_0x2cd2e4,_0x1a786d){return new BPromise(function(_0x44d505,_0x145966){return client[_0xa732('0xb')](_0x2869b1,_0x1a786d)[_0xa732('0xc')](function(_0x3b2e4e){logger[_0xa732('0xd')](_0xa732('0xe'),_0x2cd2e4,_0xa732('0xf'));logger[_0xa732('0x10')](_0xa732('0x11'),_0x2cd2e4,_0xa732('0xf'),JSON[_0xa732('0x12')](_0x3b2e4e));if(_0x3b2e4e[_0xa732('0x13')]){if(_0x3b2e4e[_0xa732('0x13')][_0xa732('0x14')]===0x1f4){logger[_0xa732('0x13')](_0xa732('0xe'),_0x2cd2e4,_0x3b2e4e['error']['message']);return _0x145966(_0x3b2e4e['error'][_0xa732('0x15')]);}logger[_0xa732('0x13')](_0xa732('0xe'),_0x2cd2e4,_0x3b2e4e[_0xa732('0x13')][_0xa732('0x15')]);return _0x44d505(_0x3b2e4e[_0xa732('0x13')][_0xa732('0x15')]);}else{logger[_0xa732('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x2cd2e4,_0xa732('0xf'));_0x44d505(_0x3b2e4e[_0xa732('0x16')][_0xa732('0x15')]);}})[_0xa732('0x17')](function(_0x3c53ba){logger[_0xa732('0x13')](_0xa732('0xe'),_0x2cd2e4,_0x3c53ba);_0x145966(_0x3c53ba);});});}exports[_0xa732('0x18')]=function(_0x2146d0){var _0x164cc8=this;return new Promise(function(_0x3f8876,_0x32ee86){return db[_0xa732('0x19')][_0xa732('0x1a')]({'raw':_0x2146d0[_0xa732('0x1b')]?_0x2146d0[_0xa732('0x1b')][_0xa732('0x1c')]===undefined?!![]:![]:!![],'where':_0x2146d0['options']?_0x2146d0[_0xa732('0x1b')][_0xa732('0x1d')]||null:null,'attributes':_0x2146d0[_0xa732('0x1b')]?_0x2146d0[_0xa732('0x1b')][_0xa732('0x1e')]||null:null,'limit':_0x2146d0[_0xa732('0x1b')]?_0x2146d0[_0xa732('0x1b')][_0xa732('0x1f')]||null:null,'include':_0x2146d0[_0xa732('0x1b')]?_0x2146d0[_0xa732('0x1b')][_0xa732('0x20')]?_[_0xa732('0x21')](_0x2146d0['options'][_0xa732('0x20')],function(_0x207460){return{'model':db[_0x207460['model']],'as':_0x207460['as'],'attributes':_0x207460[_0xa732('0x1e')],'include':_0x207460['include']?_[_0xa732('0x21')](_0x207460[_0xa732('0x20')],function(_0x111cb6){return{'model':db[_0x111cb6[_0xa732('0x22')]],'as':_0x111cb6['as'],'attributes':_0x111cb6['attributes'],'include':_0x111cb6[_0xa732('0x20')]?_[_0xa732('0x21')](_0x111cb6['include'],function(_0x3dfddb){return{'model':db[_0x3dfddb[_0xa732('0x22')]],'as':_0x3dfddb['as'],'attributes':_0x3dfddb[_0xa732('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa732('0xc')](function(_0xfc451d){logger[_0xa732('0xd')](_0xa732('0x18'),_0x2146d0);logger[_0xa732('0x10')](_0xa732('0x18'),_0x2146d0,JSON[_0xa732('0x12')](_0xfc451d));_0x3f8876(_0xfc451d);})['catch'](function(_0x5662ab){logger[_0xa732('0x13')](_0xa732('0x18'),_0x5662ab[_0xa732('0x15')],_0x2146d0);_0x32ee86(_0x164cc8[_0xa732('0x13')](0x1f4,_0x5662ab[_0xa732('0x15')]));});});};exports['UpdateCmHopperBlack']=function(_0x170deb){var _0x24ff26=this;return new Promise(function(_0x2b7f5e,_0x537b18){return db[_0xa732('0x19')][_0xa732('0x23')](_0x170deb[_0xa732('0x24')],{'raw':_0x170deb[_0xa732('0x1b')]?_0x170deb[_0xa732('0x1b')][_0xa732('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x170deb[_0xa732('0x1b')]?_0x170deb[_0xa732('0x1b')][_0xa732('0x1d')]||null:null,'attributes':_0x170deb[_0xa732('0x1b')]?_0x170deb['options'][_0xa732('0x1e')]||null:null,'limit':_0x170deb[_0xa732('0x1b')]?_0x170deb[_0xa732('0x1b')][_0xa732('0x1f')]||null:null})[_0xa732('0xc')](function(_0x5727da){logger[_0xa732('0xd')]('UpdateCmHopperBlack',_0x170deb);logger['debug'](_0xa732('0x25'),_0x170deb,JSON[_0xa732('0x12')](_0x5727da));_0x2b7f5e(_0x5727da);})[_0xa732('0x17')](function(_0x49173d){logger[_0xa732('0x13')]('UpdateCmHopperBlack',_0x49173d['message'],_0x170deb);_0x537b18(_0x24ff26[_0xa732('0x13')](0x1f4,_0x49173d[_0xa732('0x15')]));});});};exports[_0xa732('0x26')]=function(_0x2e8bdd){var _0x528ce2=this;return new Promise(function(_0x3a7099,_0x715e05){return db[_0xa732('0x19')][_0xa732('0x27')]({'where':_0x2e8bdd['options']?_0x2e8bdd[_0xa732('0x1b')][_0xa732('0x1d')]||null:null})[_0xa732('0xc')](function(_0x2a14c6){logger[_0xa732('0xd')]('DestroyCmHopperBlack',_0x2e8bdd);logger[_0xa732('0x10')](_0xa732('0x26'),_0x2e8bdd,JSON[_0xa732('0x12')](_0x2a14c6));_0x3a7099(_0x2a14c6);})[_0xa732('0x17')](function(_0xe69043){logger[_0xa732('0x13')]('DestroyCmHopperBlack',_0xe69043[_0xa732('0x15')],_0x2e8bdd);_0x715e05(_0x528ce2[_0xa732('0x13')](0x1f4,_0xe69043[_0xa732('0x15')]));});});}; \ No newline at end of file +var _0xdc4b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','catch','GetCmHopperBlack','options','raw','where','attributes','limit','include','map','model','UpdateCmHopperBlack','update','DestroyCmHopperBlack','CmHopperBlack','lodash','util','moment','bluebird','randomstring'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdc4b,0x136));var _0xbdc4=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xdc4b[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xbdc4('0x0'));var util=require(_0xbdc4('0x1'));var moment=require(_0xbdc4('0x2'));var BPromise=require(_0xbdc4('0x3'));var rs=require(_0xbdc4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbdc4('0x5'))(_0xbdc4('0x6'));var config=require(_0xbdc4('0x7'));var jayson=require(_0xbdc4('0x8'));var client=jayson[_0xbdc4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57d720,_0x46cea4,_0x48cea4){return new BPromise(function(_0x5cc670,_0x454471){return client['request'](_0x57d720,_0x48cea4)[_0xbdc4('0xa')](function(_0x4e2edb){logger[_0xbdc4('0xb')]('CmHopperBlack,\x20%s,\x20%s',_0x46cea4,'request\x20sent');logger[_0xbdc4('0xc')](_0xbdc4('0xd'),_0x46cea4,_0xbdc4('0xe'),JSON[_0xbdc4('0xf')](_0x4e2edb));if(_0x4e2edb[_0xbdc4('0x10')]){if(_0x4e2edb[_0xbdc4('0x10')][_0xbdc4('0x11')]===0x1f4){logger['error'](_0xbdc4('0x12'),_0x46cea4,_0x4e2edb[_0xbdc4('0x10')][_0xbdc4('0x13')]);return _0x454471(_0x4e2edb['error'][_0xbdc4('0x13')]);}logger[_0xbdc4('0x10')](_0xbdc4('0x12'),_0x46cea4,_0x4e2edb['error'][_0xbdc4('0x13')]);return _0x5cc670(_0x4e2edb[_0xbdc4('0x10')][_0xbdc4('0x13')]);}else{logger[_0xbdc4('0xb')](_0xbdc4('0x12'),_0x46cea4,_0xbdc4('0xe'));_0x5cc670(_0x4e2edb[_0xbdc4('0x14')][_0xbdc4('0x13')]);}})[_0xbdc4('0x15')](function(_0x25c0d9){logger[_0xbdc4('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x46cea4,_0x25c0d9);_0x454471(_0x25c0d9);});});}exports[_0xbdc4('0x16')]=function(_0x1a2bf6){var _0x18cfb0=this;return new Promise(function(_0x43cb2e,_0x27dbdb){return db['CmHopperBlack']['findAll']({'raw':_0x1a2bf6[_0xbdc4('0x17')]?_0x1a2bf6[_0xbdc4('0x17')][_0xbdc4('0x18')]===undefined?!![]:![]:!![],'where':_0x1a2bf6[_0xbdc4('0x17')]?_0x1a2bf6[_0xbdc4('0x17')][_0xbdc4('0x19')]||null:null,'attributes':_0x1a2bf6[_0xbdc4('0x17')]?_0x1a2bf6['options'][_0xbdc4('0x1a')]||null:null,'limit':_0x1a2bf6[_0xbdc4('0x17')]?_0x1a2bf6[_0xbdc4('0x17')][_0xbdc4('0x1b')]||null:null,'include':_0x1a2bf6[_0xbdc4('0x17')]?_0x1a2bf6[_0xbdc4('0x17')][_0xbdc4('0x1c')]?_[_0xbdc4('0x1d')](_0x1a2bf6[_0xbdc4('0x17')][_0xbdc4('0x1c')],function(_0x432e91){return{'model':db[_0x432e91[_0xbdc4('0x1e')]],'as':_0x432e91['as'],'attributes':_0x432e91[_0xbdc4('0x1a')],'include':_0x432e91[_0xbdc4('0x1c')]?_[_0xbdc4('0x1d')](_0x432e91[_0xbdc4('0x1c')],function(_0x443cef){return{'model':db[_0x443cef[_0xbdc4('0x1e')]],'as':_0x443cef['as'],'attributes':_0x443cef['attributes'],'include':_0x443cef[_0xbdc4('0x1c')]?_[_0xbdc4('0x1d')](_0x443cef[_0xbdc4('0x1c')],function(_0x48201f){return{'model':db[_0x48201f['model']],'as':_0x48201f['as'],'attributes':_0x48201f[_0xbdc4('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x462a33){logger[_0xbdc4('0xb')]('GetCmHopperBlack',_0x1a2bf6);logger[_0xbdc4('0xc')]('GetCmHopperBlack',_0x1a2bf6,JSON[_0xbdc4('0xf')](_0x462a33));_0x43cb2e(_0x462a33);})[_0xbdc4('0x15')](function(_0x508b4d){logger[_0xbdc4('0x10')](_0xbdc4('0x16'),_0x508b4d[_0xbdc4('0x13')],_0x1a2bf6);_0x27dbdb(_0x18cfb0['error'](0x1f4,_0x508b4d[_0xbdc4('0x13')]));});});};exports[_0xbdc4('0x1f')]=function(_0x3f0f47){var _0x17f9c9=this;return new Promise(function(_0x1f2c8d,_0x2f13ac){return db['CmHopperBlack'][_0xbdc4('0x20')](_0x3f0f47['body'],{'raw':_0x3f0f47[_0xbdc4('0x17')]?_0x3f0f47[_0xbdc4('0x17')][_0xbdc4('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f0f47['options']?_0x3f0f47['options'][_0xbdc4('0x19')]||null:null,'attributes':_0x3f0f47[_0xbdc4('0x17')]?_0x3f0f47[_0xbdc4('0x17')]['attributes']||null:null,'limit':_0x3f0f47[_0xbdc4('0x17')]?_0x3f0f47['options'][_0xbdc4('0x1b')]||null:null})[_0xbdc4('0xa')](function(_0x3cb625){logger[_0xbdc4('0xb')](_0xbdc4('0x1f'),_0x3f0f47);logger[_0xbdc4('0xc')](_0xbdc4('0x1f'),_0x3f0f47,JSON[_0xbdc4('0xf')](_0x3cb625));_0x1f2c8d(_0x3cb625);})[_0xbdc4('0x15')](function(_0x31153a){logger[_0xbdc4('0x10')]('UpdateCmHopperBlack',_0x31153a['message'],_0x3f0f47);_0x2f13ac(_0x17f9c9['error'](0x1f4,_0x31153a['message']));});});};exports[_0xbdc4('0x21')]=function(_0x15400c){var _0xebbe7b=this;return new Promise(function(_0x3c7b85,_0x41f6cc){return db[_0xbdc4('0x22')]['destroy']({'where':_0x15400c[_0xbdc4('0x17')]?_0x15400c[_0xbdc4('0x17')][_0xbdc4('0x19')]||null:null})[_0xbdc4('0xa')](function(_0x557ee1){logger[_0xbdc4('0xb')](_0xbdc4('0x21'),_0x15400c);logger[_0xbdc4('0xc')]('DestroyCmHopperBlack',_0x15400c,JSON['stringify'](_0x557ee1));_0x3c7b85(_0x557ee1);})[_0xbdc4('0x15')](function(_0x5c0bf7){logger['error'](_0xbdc4('0x21'),_0x5c0bf7[_0xbdc4('0x13')],_0x15400c);_0x41f6cc(_0xebbe7b[_0xbdc4('0x10')](0x1f4,_0x5c0bf7[_0xbdc4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 035c6a8..33bce98 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 _0x2d72=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','/:id','show','update','delete','multer','util','path'];(function(_0xcfe1e3,_0x1d2820){var _0x2f305e=function(_0x48b4a1){while(--_0x48b4a1){_0xcfe1e3['push'](_0xcfe1e3['shift']());}};_0x2f305e(++_0x1d2820);}(_0x2d72,0xa8));var _0x22d7=function(_0x1981a0,_0x3eb309){_0x1981a0=_0x1981a0-0x0;var _0x5053dd=_0x2d72[_0x1981a0];return _0x5053dd;};'use strict';var multer=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var path=require(_0x22d7('0x2'));var timeout=require(_0x22d7('0x3'));var express=require(_0x22d7('0x4'));var router=express[_0x22d7('0x5')]();var fs_extra=require(_0x22d7('0x6'));var auth=require(_0x22d7('0x7'));var interaction=require(_0x22d7('0x8'));var config=require(_0x22d7('0x9'));var controller=require(_0x22d7('0xa'));router[_0x22d7('0xb')]('/',auth[_0x22d7('0xc')](),controller[_0x22d7('0xd')]);router['get'](_0x22d7('0xe'),auth[_0x22d7('0xc')](),controller['describe']);router[_0x22d7('0xb')](_0x22d7('0xf'),auth[_0x22d7('0xc')](),controller[_0x22d7('0x10')]);router['put']('/:id',auth[_0x22d7('0xc')](),controller[_0x22d7('0x11')]);router[_0x22d7('0x12')](_0x22d7('0xf'),auth[_0x22d7('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x01d9=['update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','index','/describe','isAuthenticated','describe','/:id','show','put'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var path=require(_0x901d('0x2'));var timeout=require(_0x901d('0x3'));var express=require('express');var router=express[_0x901d('0x4')]();var fs_extra=require(_0x901d('0x5'));var auth=require(_0x901d('0x6'));var interaction=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var controller=require(_0x901d('0x9'));router[_0x901d('0xa')]('/',auth['isAuthenticated'](),controller[_0x901d('0xb')]);router[_0x901d('0xa')](_0x901d('0xc'),auth[_0x901d('0xd')](),controller[_0x901d('0xe')]);router[_0x901d('0xa')](_0x901d('0xf'),auth[_0x901d('0xd')](),controller[_0x901d('0x10')]);router[_0x901d('0x11')](_0x901d('0xf'),auth[_0x901d('0xd')](),controller[_0x901d('0x12')]);router['delete'](_0x901d('0xf'),auth['isAuthenticated'](),controller[_0x901d('0x13')]);module[_0x901d('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index dfcbc42..e796760 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 _0x24e9=['diff','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime'];(function(_0x3c5d70,_0x1b9c3f){var _0x425578=function(_0x390766){while(--_0x390766){_0x3c5d70['push'](_0x3c5d70['shift']());}};_0x425578(++_0x1b9c3f);}(_0x24e9,0x1b2));var _0x924e=function(_0x4c7935,_0x4a53fb){_0x4c7935=_0x4c7935-0x0;var _0x30651d=_0x24e9[_0x4c7935];return _0x30651d;};'use strict';var Sequelize=require(_0x924e('0x0'));var moment=require(_0x924e('0x1'));module[_0x924e('0x2')]={'state':{'type':Sequelize[_0x924e('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x924e('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x924e('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x924e('0x4')]},'starttime':{'type':Sequelize[_0x924e('0x5')]},'responsetime':{'type':Sequelize[_0x924e('0x5')]},'answertime':{'type':Sequelize[_0x924e('0x5')]},'droptime':{'type':Sequelize[_0x924e('0x5')]},'endtime':{'type':Sequelize[_0x924e('0x5')]},'ringtime':{'type':Sequelize[_0x924e('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x924e('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x924e('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x924e('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x924e('0x4')]},'campaign':{'type':Sequelize[_0x924e('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x924e('0x4')]},'reason':{'type':Sequelize[_0x924e('0x4')]},'disposition':{'type':Sequelize[_0x924e('0x4')]},'secondDisposition':{'type':Sequelize[_0x924e('0x4')]},'thirdDisposition':{'type':Sequelize[_0x924e('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x5e5139){var _0x1bd6b4=this[_0x924e('0x6')](_0x924e('0x7'));if(_0x1bd6b4&&_0x5e5139){this[_0x924e('0x8')](_0x924e('0x9'),moment(_0x5e5139)[_0x924e('0xa')](moment(_0x1bd6b4),'seconds'));}return this[_0x924e('0x8')]('dispositionat',_0x5e5139);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x924e('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x924e('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x924e('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x924e('0x5')]},'callback':{'type':Sequelize[_0x924e('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x924e('0x5')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x924e('0x5')]},'recallme':{'type':Sequelize[_0x924e('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x924e('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x924e('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x924e('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x924e('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x924e('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x924e('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe6db=['INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','dispositionat','BOOLEAN','sequelize','moment'];(function(_0x353dd2,_0x5b8289){var _0x4af8a5=function(_0xebcb2){while(--_0xebcb2){_0x353dd2['push'](_0x353dd2['shift']());}};_0x4af8a5(++_0x5b8289);}(_0xe6db,0xb2));var _0xbe6d=function(_0x6f858b,_0x3c0c0a){_0x6f858b=_0x6f858b-0x0;var _0x4e3327=_0xe6db[_0x6f858b];return _0x4e3327;};'use strict';var Sequelize=require(_0xbe6d('0x0'));var moment=require(_0xbe6d('0x1'));module['exports']={'state':{'type':Sequelize[_0xbe6d('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xbe6d('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbe6d('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xbe6d('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xbe6d('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xbe6d('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xbe6d('0x3')]},'originatecalleridname':{'type':Sequelize[_0xbe6d('0x3')]},'calleridnum':{'type':Sequelize[_0xbe6d('0x3')]},'calleridname':{'type':Sequelize[_0xbe6d('0x3')]},'starttime':{'type':Sequelize[_0xbe6d('0x4')]},'responsetime':{'type':Sequelize[_0xbe6d('0x4')]},'answertime':{'type':Sequelize[_0xbe6d('0x4')]},'droptime':{'type':Sequelize[_0xbe6d('0x4')]},'endtime':{'type':Sequelize[_0xbe6d('0x4')]},'ringtime':{'type':Sequelize[_0xbe6d('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xbe6d('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xbe6d('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xbe6d('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xbe6d('0x3')]},'campaign':{'type':Sequelize[_0xbe6d('0x3')]},'campaigntype':{'type':Sequelize[_0xbe6d('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xbe6d('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xbe6d('0x3')]},'thirdDisposition':{'type':Sequelize[_0xbe6d('0x3')]},'dispositionat':{'type':Sequelize[_0xbe6d('0x4')],'set':function(_0x15df5a){var _0x165e96=this[_0xbe6d('0x5')](_0xbe6d('0x6'));if(_0x165e96&&_0x15df5a){this[_0xbe6d('0x7')](_0xbe6d('0x8'),moment(_0x15df5a)[_0xbe6d('0x9')](moment(_0x165e96),'seconds'));}return this[_0xbe6d('0x7')](_0xbe6d('0xa'),_0x15df5a);}},'amd':{'type':Sequelize[_0xbe6d('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0xbe6d('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xbe6d('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xbe6d('0x4')]},'callback':{'type':Sequelize[_0xbe6d('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xbe6d('0x4')]},'deleted':{'type':Sequelize[_0xbe6d('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xbe6d('0x4')]},'recallme':{'type':Sequelize[_0xbe6d('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xbe6d('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbe6d('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbe6d('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 6910dad..a2ea13b 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 _0xc4aa=['ContactId','ListId','ANY_VALUE(VoiceQueueId)','NOW()','createdAt','from','cm_hopper_final','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','cm_hopper','VoiceQueueId\x20=\x20?','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','phone','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','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','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','CmHopperFinal','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','describe','uniqueid','find','body','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','fromQuery','scheduledAt','VoiceQueueId','updatedAt','field','ANY_VALUE(calleridnum)'];(function(_0x5d85ec,_0x4f6f1c){var _0xa01f0d=function(_0x2686fd){while(--_0x2686fd){_0x5d85ec['push'](_0x5d85ec['shift']());}};_0xa01f0d(++_0x4f6f1c);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xc4aa[_0x4b055c];return _0x4b62bb;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];function respondWithStatusCode(_0x24291d,_0x5e16aa){_0x5e16aa=_0x5e16aa||0xcc;return function(_0x21a79){if(_0x21a79){return _0x24291d[_0xac4a('0x17')](_0x5e16aa);}return _0x24291d[_0xac4a('0x18')](_0x5e16aa)[_0xac4a('0x19')]();};}function respondWithResult(_0x1b4313,_0x3b71c0){_0x3b71c0=_0x3b71c0||0xc8;return function(_0x34bc01){if(_0x34bc01){return _0x1b4313[_0xac4a('0x18')](_0x3b71c0)[_0xac4a('0x1a')](_0x34bc01);}};}function respondWithFilteredResult(_0x42c7fc,_0x11e101){return function(_0x26dbb8){if(_0x26dbb8){var _0x4a2119=typeof _0x11e101[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x11e101[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x3e88e3=_0x26dbb8[_0xac4a('0x1e')];var _0x28e304=_0x4a2119?0x0:_0x11e101[_0xac4a('0x1b')];var _0x546c5d=_0x4a2119?_0x26dbb8['count']:_0x11e101[_0xac4a('0x1b')]+_0x11e101[_0xac4a('0x1d')];var _0x39b691;if(_0x546c5d>=_0x3e88e3){_0x546c5d=_0x3e88e3;_0x39b691=0xc8;}else{_0x39b691=0xce;}_0x42c7fc['status'](_0x39b691);return _0x42c7fc[_0xac4a('0x1f')](_0xac4a('0x20'),_0x28e304+'-'+_0x546c5d+'/'+_0x3e88e3)[_0xac4a('0x1a')](_0x26dbb8);}return null;};}function patchUpdates(_0x3a3cdb){return function(_0x123694){try{jsonpatch[_0xac4a('0x21')](_0x123694,_0x3a3cdb,!![]);}catch(_0xe38996){return BPromise[_0xac4a('0x22')](_0xe38996);}return _0x123694['save']();};}function saveUpdates(_0x3d8f0a,_0x3204ad){return function(_0x599787){if(_0x599787){return _0x599787[_0xac4a('0x23')](_0x3d8f0a)[_0xac4a('0x24')](function(_0x3eacd3){return _0x3eacd3;});}return null;};}function removeEntity(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(_0x1b7998){return _0x1b7998[_0xac4a('0x25')]()[_0xac4a('0x24')](function(){_0x947d8e[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x2b0dc2,_0x222507){return function(_0x36054a){if(!_0x36054a){_0x2b0dc2[_0xac4a('0x17')](0x194);}return _0x36054a;};}function handleError(_0x3bc318,_0x1d0539){_0x1d0539=_0x1d0539||0x1f4;return function(_0x215a31){logger[_0xac4a('0x26')](_0x215a31[_0xac4a('0x27')]);if(_0x215a31[_0xac4a('0x28')]){delete _0x215a31[_0xac4a('0x28')];}_0x3bc318['status'](_0x1d0539)[_0xac4a('0x29')](_0x215a31);};}exports[_0xac4a('0x2a')]=function(_0x42a33c,_0x2772fe){var _0x116700={},_0x4a5a9e={},_0x47f49c={'count':0x0,'rows':[]};var _0xdb7e=_[_0xac4a('0x2b')](db[_0xac4a('0x2c')]['rawAttributes'],function(_0x4bda1f){return{'name':_0x4bda1f[_0xac4a('0x2d')],'type':_0x4bda1f[_0xac4a('0x2e')][_0xac4a('0x2f')]};});_0x4a5a9e[_0xac4a('0x30')]=_[_0xac4a('0x2b')](_0xdb7e,'name');_0x4a5a9e[_0xac4a('0x31')]=_['keys'](_0x42a33c[_0xac4a('0x31')]);_0x4a5a9e['filters']=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],_0x4a5a9e[_0xac4a('0x31')]);_0x116700[_0xac4a('0x33')]=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x34')]));_0x116700[_0xac4a('0x33')]=_0x116700[_0xac4a('0x33')][_0xac4a('0x35')]?_0x116700[_0xac4a('0x33')]:_0x4a5a9e[_0xac4a('0x30')];if(!_0x42a33c['query'][_0xac4a('0x36')](_0xac4a('0x37'))){_0x116700['limit']=qs[_0xac4a('0x1d')](_0x42a33c[_0xac4a('0x31')]['limit']);_0x116700['offset']=qs[_0xac4a('0x1b')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x1b')]);}_0x116700[_0xac4a('0x38')]=qs['sort'](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x39')]);_0x116700['where']=qs[_0xac4a('0x3a')](_[_0xac4a('0x3b')](_0x42a33c[_0xac4a('0x31')],_0x4a5a9e['filters']),_0xdb7e);if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x3c')]){_0x116700[_0xac4a('0x3d')]=_['merge'](_0x116700[_0xac4a('0x3d')],{'$or':_[_0xac4a('0x2b')](_0xdb7e,function(_0x4b9faf){if(_0x4b9faf['type']!==_0xac4a('0x3e')){var _0x5e0926={};_0x5e0926[_0x4b9faf['name']]={'$like':'%'+_0x42a33c['query']['filter']+'%'};return _0x5e0926;}})});}_0x116700=_[_0xac4a('0x3f')]({},_0x116700,_0x42a33c[_0xac4a('0x40')]);var _0x37834b={'where':_0x116700[_0xac4a('0x3d')]};return db[_0xac4a('0x2c')][_0xac4a('0x1e')](_0x37834b)[_0xac4a('0x24')](function(_0x2b16f0){_0x47f49c[_0xac4a('0x1e')]=_0x2b16f0;if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x41')]){_0x116700[_0xac4a('0x42')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x116700);})['then'](function(_0x1e1cc5){_0x47f49c[_0xac4a('0x43')]=_0x1e1cc5;return _0x47f49c;})[_0xac4a('0x24')](respondWithFilteredResult(_0x2772fe,_0x116700))[_0xac4a('0x44')](handleError(_0x2772fe,null));};exports[_0xac4a('0x45')]=function(_0x411543,_0x8febf0){var _0x3441f2={'raw':!![],'where':{'id':_0x411543[_0xac4a('0x46')]['id']}},_0x3e9973={};_0x3e9973['model']=_[_0xac4a('0x47')](db[_0xac4a('0x2c')][_0xac4a('0x48')]);_0x3e9973[_0xac4a('0x31')]=_[_0xac4a('0x47')](_0x411543['query']);_0x3e9973[_0xac4a('0x3a')]=_[_0xac4a('0x32')](_0x3e9973['model'],_0x3e9973[_0xac4a('0x31')]);_0x3441f2['attributes']=_[_0xac4a('0x32')](_0x3e9973[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x411543[_0xac4a('0x31')][_0xac4a('0x34')]));_0x3441f2[_0xac4a('0x33')]=_0x3441f2[_0xac4a('0x33')][_0xac4a('0x35')]?_0x3441f2[_0xac4a('0x33')]:_0x3e9973[_0xac4a('0x30')];if(_0x411543[_0xac4a('0x31')][_0xac4a('0x41')]){_0x3441f2['include']=[{'all':!![]}];}_0x3441f2=_[_0xac4a('0x3f')]({},_0x3441f2,_0x411543[_0xac4a('0x40')]);return db[_0xac4a('0x2c')]['find'](_0x3441f2)[_0xac4a('0x24')](handleEntityNotFound(_0x8febf0,null))[_0xac4a('0x24')](respondWithResult(_0x8febf0,null))['catch'](handleError(_0x8febf0,null));};exports[_0xac4a('0x49')]=function(_0x5a7f6e,_0x244950){return db[_0xac4a('0x2c')][_0xac4a('0x49')]()['then'](respondWithResult(_0x244950,null))['catch'](handleError(_0x244950,null));};exports[_0xac4a('0x23')]=function(_0x4aaeff,_0x18ae96){if(_0x4aaeff['body'][_0xac4a('0x4a')]){delete _0x4aaeff['body'][_0xac4a('0x4a')];}return db[_0xac4a('0x2c')][_0xac4a('0x4b')]({'where':{'uniqueid':_0x4aaeff[_0xac4a('0x46')]['id']}})['then'](handleEntityNotFound(_0x18ae96,null))[_0xac4a('0x24')](saveUpdates(_0x4aaeff[_0xac4a('0x4c')],null))[_0xac4a('0x24')](respondWithResult(_0x18ae96,null))[_0xac4a('0x44')](handleError(_0x18ae96,null));};exports[_0xac4a('0x4d')]=function(_0x138876,_0x187306,_0x4e6e19){return db[_0xac4a('0x2c')][_0xac4a('0x4e')]({'raw':![],'where':{'VoiceQueueId':_0x138876['params']['id']},'attributes':[[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')]['literal'](_0xac4a('0x51')))),_0xac4a('0x52')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db['sequelize'][_0xac4a('0x53')]('`state`\x20=\x203,\x201,\x20null'))),_0xac4a('0x54')],[db[_0xac4a('0x4f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')]('`state`\x20=\x205,\x201,\x20null'))),_0xac4a('0x55')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db['sequelize'][_0xac4a('0x53')](_0xac4a('0x56')))),_0xac4a('0x57')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')]['literal'](_0xac4a('0x58')))),_0xac4a('0x59')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5a')))),_0xac4a('0x5b')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5c')))),_0xac4a('0x5d')],[db['sequelize']['fn'](_0xac4a('0x50'),db['sequelize']['fn']('IF',db[_0xac4a('0x4f')]['literal'](_0xac4a('0x5e')))),'answeringMachine']]})[_0xac4a('0x24')](handleEntityNotFound(_0x187306,null))['then'](respondWithResult(_0x187306,null))['catch'](handleError(_0x187306,null));};exports[_0xac4a('0x5f')]=function(_0x568ffb,_0x3bcae2,_0x3c2f84){return db[_0xac4a('0x2c')][_0xac4a('0x4e')]({'raw':![],'where':{'CampaignId':_0x568ffb['params']['id']},'attributes':[[db[_0xac4a('0x4f')]['fn']('COUNT',db[_0xac4a('0x4f')]['fn']('IF',db['sequelize'][_0xac4a('0x53')](_0xac4a('0x51')))),_0xac4a('0x52')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x60')))),_0xac4a('0x54')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x61')))),_0xac4a('0x55')],[db['sequelize']['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db['sequelize'][_0xac4a('0x53')](_0xac4a('0x56')))),_0xac4a('0x57')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db['sequelize']['fn']('IF',db['sequelize'][_0xac4a('0x53')](_0xac4a('0x58')))),_0xac4a('0x59')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5a')))),_0xac4a('0x5b')],[db[_0xac4a('0x4f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5c')))),_0xac4a('0x5d')],[db[_0xac4a('0x4f')]['fn'](_0xac4a('0x50'),db[_0xac4a('0x4f')]['fn']('IF',db[_0xac4a('0x4f')][_0xac4a('0x53')](_0xac4a('0x5e')))),_0xac4a('0x62')]]})[_0xac4a('0x24')](handleEntityNotFound(_0x3bcae2,null))['then'](respondWithResult(_0x3bcae2,null))[_0xac4a('0x44')](handleError(_0x3bcae2,null));};exports[_0xac4a('0x63')]=function(_0x26bd31,_0x231932,_0x513976){return db[_0xac4a('0x64')]['find']({'where':{'id':_0x26bd31[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x231932,null))['then'](function(_0x5bd95b){var _0x17eac2;if(_0x5bd95b){_0x17eac2=squel[_0xac4a('0x65')]()[_0xac4a('0x66')]('cm_hopper')[_0xac4a('0x67')](['phone',_0xac4a('0x68'),'ContactId','ListId',_0xac4a('0x69'),'createdAt',_0xac4a('0x6a')],squel['select']()[_0xac4a('0x6b')](_0xac4a('0x6c'),'phone')[_0xac4a('0x6b')]('NOW()',_0xac4a('0x68'))[_0xac4a('0x6b')]('ANY_VALUE(ContactId)',_0xac4a('0x6d'))['field']('ANY_VALUE(ListId)',_0xac4a('0x6e'))['field'](_0xac4a('0x6f'),'VoiceQueueId')['field'](_0xac4a('0x70'),_0xac4a('0x71'))[_0xac4a('0x6b')]('NOW()','updatedAt')[_0xac4a('0x72')](_0xac4a('0x73'))['where']('VoiceQueueId\x20=\x20?',_0x26bd31[_0xac4a('0x46')]['id'][_0xac4a('0x74')]())[_0xac4a('0x3d')](_0xac4a('0x75'),_0x26bd31[_0xac4a('0x4c')][_0xac4a('0x76')][_0xac4a('0x74')]())[_0xac4a('0x3d')](_0xac4a('0x77'))['where'](_0xac4a('0x78'),squel[_0xac4a('0x79')]()[_0xac4a('0x6b')]('phone')[_0xac4a('0x72')](_0xac4a('0x7a'))[_0xac4a('0x3d')](_0xac4a('0x7b'),_0x26bd31[_0xac4a('0x46')]['id']['toString']()))[_0xac4a('0x3d')](_0xac4a('0x78'),squel[_0xac4a('0x79')]()[_0xac4a('0x6b')](_0xac4a('0x7c'))[_0xac4a('0x72')](_0xac4a('0x73'))['where'](_0xac4a('0x7b'),_0x26bd31[_0xac4a('0x46')]['id'][_0xac4a('0x74')]())[_0xac4a('0x3d')](_0xac4a('0x7d')))[_0xac4a('0x7e')]('ContactId'))[_0xac4a('0x74')]();return db[_0xac4a('0x4f')][_0xac4a('0x31')](_0x17eac2);}return[];})[_0xac4a('0x24')](respondWithResult(_0x231932,null))['catch'](handleError(_0x231932,null));};exports[_0xac4a('0x7f')]=function(_0x56a934,_0x4447b5,_0x22b718){return db['Campaign']['find']({'where':{'id':_0x56a934[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x4447b5,null))[_0xac4a('0x24')](function(_0x4bb03d){var _0x1f3f1c;if(_0x4bb03d){_0x1f3f1c=squel['insert']()[_0xac4a('0x66')](_0xac4a('0x7a'))[_0xac4a('0x67')]([_0xac4a('0x80'),_0xac4a('0x68'),'ContactId','ListId',_0xac4a('0x81'),_0xac4a('0x71'),_0xac4a('0x6a')],squel[_0xac4a('0x79')]()[_0xac4a('0x6b')](_0xac4a('0x6c'),_0xac4a('0x80'))[_0xac4a('0x6b')]('NOW()','scheduledAt')[_0xac4a('0x6b')](_0xac4a('0x82'),_0xac4a('0x6d'))[_0xac4a('0x6b')](_0xac4a('0x83'),_0xac4a('0x6e'))[_0xac4a('0x6b')](_0xac4a('0x84'),'CampaignId')['field'](_0xac4a('0x70'),_0xac4a('0x71'))[_0xac4a('0x6b')](_0xac4a('0x70'),_0xac4a('0x6a'))[_0xac4a('0x72')](_0xac4a('0x73'))['where'](_0xac4a('0x85'),_0x56a934[_0xac4a('0x46')]['id'][_0xac4a('0x74')]())['where'](_0xac4a('0x75'),_0x56a934[_0xac4a('0x4c')][_0xac4a('0x76')][_0xac4a('0x74')]())[_0xac4a('0x3d')](_0xac4a('0x77'))[_0xac4a('0x3d')](_0xac4a('0x78'),squel[_0xac4a('0x79')]()['field'](_0xac4a('0x80'))['from'](_0xac4a('0x7a'))[_0xac4a('0x3d')](_0xac4a('0x85'),_0x56a934[_0xac4a('0x46')]['id'][_0xac4a('0x74')]()))[_0xac4a('0x3d')](_0xac4a('0x78'),squel['select']()[_0xac4a('0x6b')](_0xac4a('0x7c'))[_0xac4a('0x72')](_0xac4a('0x73'))[_0xac4a('0x3d')]('CampaignId\x20=\x20?',_0x56a934[_0xac4a('0x46')]['id'][_0xac4a('0x74')]())['where']('state\x20=\x204'))[_0xac4a('0x7e')](_0xac4a('0x6d')))['toString']();return db[_0xac4a('0x4f')][_0xac4a('0x31')](_0x1f3f1c);}return[];})[_0xac4a('0x24')](respondWithResult(_0x4447b5,null))[_0xac4a('0x44')](handleError(_0x4447b5,null));};exports[_0xac4a('0x86')]=function(_0x34787c,_0x599775,_0xbdff4b){return db[_0xac4a('0x87')][_0xac4a('0x88')]({'where':{'VoiceQueueId':_0x34787c['body'][_0xac4a('0x69')],'CampaignId':_0x34787c[_0xac4a('0x4c')][_0xac4a('0x81')],'ContactId':_0x34787c[_0xac4a('0x4c')][_0xac4a('0x6d')]}})[_0xac4a('0x24')](handleEntityNotFound(_0x599775,null))['then'](function(_0xe84bf7){if(_0xe84bf7){return _0xe84bf7;}return null;})[_0xac4a('0x24')](respondWithResult(_0x599775,null))['catch'](handleError(_0x599775,null));}; \ No newline at end of file +var _0x90b1=['uniqueid','countContactsQueueCampaignHopperFinal','findAll','params','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','VoiceQueue','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20NOT\x20IN\x20(?)','select','calleridnum','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','into','ListId','ANY_VALUE(CampaignId)','CampaignId','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','CmHopper','findOne','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','then','destroy','error','name','send','index','map','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','merge','where','type','options','CmHopperFinal','includeAll','rows','include','find','catch','update','body'];(function(_0x31d0c1,_0x58ce88){var _0x549610=function(_0x2d4240){while(--_0x2d4240){_0x31d0c1['push'](_0x31d0c1['shift']());}};_0x549610(++_0x58ce88);}(_0x90b1,0x1bb));var _0x190b=function(_0x22382f,_0x5c2e54){_0x22382f=_0x22382f-0x0;var _0x35213b=_0x90b1[_0x22382f];return _0x35213b;};'use strict';var emlformat=require(_0x190b('0x0'));var rimraf=require(_0x190b('0x1'));var zipdir=require(_0x190b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x190b('0x3'));var BPromise=require(_0x190b('0x4'));var Mustache=require(_0x190b('0x5'));var util=require(_0x190b('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x190b('0x7'));var _=require(_0x190b('0x8'));var squel=require(_0x190b('0x9'));var crypto=require(_0x190b('0xa'));var jsforce=require(_0x190b('0xb'));var deskjs=require(_0x190b('0xc'));var toCsv=require(_0x190b('0xd'));var querystring=require('querystring');var Papa=require(_0x190b('0xe'));var Redis=require(_0x190b('0xf'));var authService=require(_0x190b('0x10'));var qs=require(_0x190b('0x11'));var as=require(_0x190b('0x12'));var hardwareService=require(_0x190b('0x13'));var logger=require(_0x190b('0x14'))(_0x190b('0x15'));var utils=require('../../config/utils');var config=require(_0x190b('0x16'));var licenseUtil=require(_0x190b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d63ac,_0x596c48){_0x596c48=_0x596c48||0xcc;return function(_0x286c81){if(_0x286c81){return _0x4d63ac[_0x190b('0x18')](_0x596c48);}return _0x4d63ac[_0x190b('0x19')](_0x596c48)[_0x190b('0x1a')]();};}function respondWithResult(_0x2e12d4,_0x13544c){_0x13544c=_0x13544c||0xc8;return function(_0x1ff180){if(_0x1ff180){return _0x2e12d4[_0x190b('0x19')](_0x13544c)[_0x190b('0x1b')](_0x1ff180);}};}function respondWithFilteredResult(_0x1a046f,_0xab346){return function(_0x3e8781){if(_0x3e8781){var _0x3fbfc3=typeof _0xab346[_0x190b('0x1c')]===_0x190b('0x1d')&&typeof _0xab346['limit']===_0x190b('0x1d');var _0x5efbed=_0x3e8781[_0x190b('0x1e')];var _0x21e458=_0x3fbfc3?0x0:_0xab346[_0x190b('0x1c')];var _0x16c009=_0x3fbfc3?_0x3e8781['count']:_0xab346[_0x190b('0x1c')]+_0xab346[_0x190b('0x1f')];var _0x441a2b;if(_0x16c009>=_0x5efbed){_0x16c009=_0x5efbed;_0x441a2b=0xc8;}else{_0x441a2b=0xce;}_0x1a046f[_0x190b('0x19')](_0x441a2b);return _0x1a046f[_0x190b('0x20')](_0x190b('0x21'),_0x21e458+'-'+_0x16c009+'/'+_0x5efbed)['json'](_0x3e8781);}return null;};}function patchUpdates(_0x3ed24c){return function(_0x14f0a5){try{jsonpatch['apply'](_0x14f0a5,_0x3ed24c,!![]);}catch(_0xb4c32b){return BPromise['reject'](_0xb4c32b);}return _0x14f0a5['save']();};}function saveUpdates(_0xcd15e5,_0x42e7f2){return function(_0x332006){if(_0x332006){return _0x332006['update'](_0xcd15e5)[_0x190b('0x22')](function(_0x2e633e){return _0x2e633e;});}return null;};}function removeEntity(_0x16e989,_0x292ce3){return function(_0x3b8c74){if(_0x3b8c74){return _0x3b8c74[_0x190b('0x23')]()[_0x190b('0x22')](function(){_0x16e989['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x262a63,_0x1a5f86){return function(_0x50605b){if(!_0x50605b){_0x262a63['sendStatus'](0x194);}return _0x50605b;};}function handleError(_0x3260d5,_0x4e2a93){_0x4e2a93=_0x4e2a93||0x1f4;return function(_0x328e5e){logger[_0x190b('0x24')](_0x328e5e['stack']);if(_0x328e5e[_0x190b('0x25')]){delete _0x328e5e[_0x190b('0x25')];}_0x3260d5['status'](_0x4e2a93)[_0x190b('0x26')](_0x328e5e);};}exports[_0x190b('0x27')]=function(_0x359b4a,_0x494f3f){var _0x536d7b={},_0x3730cc={},_0x4d5f3f={'count':0x0,'rows':[]};var _0x14be2c=_[_0x190b('0x28')](db['CmHopperFinal'][_0x190b('0x29')],function(_0x580b92){return{'name':_0x580b92[_0x190b('0x2a')],'type':_0x580b92['type'][_0x190b('0x2b')]};});_0x3730cc['model']=_[_0x190b('0x28')](_0x14be2c,_0x190b('0x25'));_0x3730cc['query']=_[_0x190b('0x2c')](_0x359b4a[_0x190b('0x2d')]);_0x3730cc[_0x190b('0x2e')]=_[_0x190b('0x2f')](_0x3730cc[_0x190b('0x30')],_0x3730cc[_0x190b('0x2d')]);_0x536d7b[_0x190b('0x31')]=_[_0x190b('0x2f')](_0x3730cc['model'],qs['fields'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x32')]));_0x536d7b['attributes']=_0x536d7b[_0x190b('0x31')][_0x190b('0x33')]?_0x536d7b[_0x190b('0x31')]:_0x3730cc[_0x190b('0x30')];if(!_0x359b4a[_0x190b('0x2d')][_0x190b('0x34')](_0x190b('0x35'))){_0x536d7b['limit']=qs['limit'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x1f')]);_0x536d7b[_0x190b('0x1c')]=qs['offset'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x1c')]);}_0x536d7b[_0x190b('0x36')]=qs['sort'](_0x359b4a[_0x190b('0x2d')]['sort']);_0x536d7b['where']=qs[_0x190b('0x2e')](_[_0x190b('0x37')](_0x359b4a['query'],_0x3730cc[_0x190b('0x2e')]),_0x14be2c);if(_0x359b4a[_0x190b('0x2d')][_0x190b('0x38')]){_0x536d7b['where']=_[_0x190b('0x39')](_0x536d7b[_0x190b('0x3a')],{'$or':_['map'](_0x14be2c,function(_0x5d006d){if(_0x5d006d[_0x190b('0x3b')]!=='VIRTUAL'){var _0x46bdba={};_0x46bdba[_0x5d006d[_0x190b('0x25')]]={'$like':'%'+_0x359b4a[_0x190b('0x2d')][_0x190b('0x38')]+'%'};return _0x46bdba;}})});}_0x536d7b=_['merge']({},_0x536d7b,_0x359b4a[_0x190b('0x3c')]);var _0x5f118c={'where':_0x536d7b[_0x190b('0x3a')]};return db[_0x190b('0x3d')]['count'](_0x5f118c)[_0x190b('0x22')](function(_0x2a75d2){_0x4d5f3f[_0x190b('0x1e')]=_0x2a75d2;if(_0x359b4a['query'][_0x190b('0x3e')]){_0x536d7b['include']=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x536d7b);})[_0x190b('0x22')](function(_0x3aef1d){_0x4d5f3f[_0x190b('0x3f')]=_0x3aef1d;return _0x4d5f3f;})[_0x190b('0x22')](respondWithFilteredResult(_0x494f3f,_0x536d7b))['catch'](handleError(_0x494f3f,null));};exports['show']=function(_0x4045b7,_0x492240){var _0x110891={'raw':!![],'where':{'id':_0x4045b7['params']['id']}},_0x3d67f0={};_0x3d67f0[_0x190b('0x30')]=_[_0x190b('0x2c')](db[_0x190b('0x3d')]['rawAttributes']);_0x3d67f0[_0x190b('0x2d')]=_[_0x190b('0x2c')](_0x4045b7['query']);_0x3d67f0[_0x190b('0x2e')]=_['intersection'](_0x3d67f0[_0x190b('0x30')],_0x3d67f0[_0x190b('0x2d')]);_0x110891[_0x190b('0x31')]=_['intersection'](_0x3d67f0[_0x190b('0x30')],qs['fields'](_0x4045b7[_0x190b('0x2d')][_0x190b('0x32')]));_0x110891[_0x190b('0x31')]=_0x110891[_0x190b('0x31')][_0x190b('0x33')]?_0x110891[_0x190b('0x31')]:_0x3d67f0[_0x190b('0x30')];if(_0x4045b7['query'][_0x190b('0x3e')]){_0x110891[_0x190b('0x40')]=[{'all':!![]}];}_0x110891=_[_0x190b('0x39')]({},_0x110891,_0x4045b7['options']);return db[_0x190b('0x3d')][_0x190b('0x41')](_0x110891)[_0x190b('0x22')](handleEntityNotFound(_0x492240,null))[_0x190b('0x22')](respondWithResult(_0x492240,null))[_0x190b('0x42')](handleError(_0x492240,null));};exports['describe']=function(_0x1f2262,_0xadc789){return db[_0x190b('0x3d')]['describe']()[_0x190b('0x22')](respondWithResult(_0xadc789,null))[_0x190b('0x42')](handleError(_0xadc789,null));};exports[_0x190b('0x43')]=function(_0x505e52,_0x4cb561){if(_0x505e52[_0x190b('0x44')][_0x190b('0x45')]){delete _0x505e52[_0x190b('0x44')][_0x190b('0x45')];}return db[_0x190b('0x3d')][_0x190b('0x41')]({'where':{'uniqueid':_0x505e52['params']['id']}})[_0x190b('0x22')](handleEntityNotFound(_0x4cb561,null))[_0x190b('0x22')](saveUpdates(_0x505e52[_0x190b('0x44')],null))['then'](respondWithResult(_0x4cb561,null))[_0x190b('0x42')](handleError(_0x4cb561,null));};exports[_0x190b('0x46')]=function(_0x215ab6,_0x503700,_0xbc6757){return db[_0x190b('0x3d')][_0x190b('0x47')]({'raw':![],'where':{'VoiceQueueId':_0x215ab6[_0x190b('0x48')]['id']},'attributes':[[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x4c')))),_0x190b('0x4d')],[db['sequelize']['fn'](_0x190b('0x4a'),db['sequelize']['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')]('`state`\x20=\x203,\x201,\x20null'))),_0x190b('0x4e')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x4f')))),_0x190b('0x50')],[db['sequelize']['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')]['literal'](_0x190b('0x51')))),'congestionContacts'],[db['sequelize']['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x52')))),_0x190b('0x53')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x54')))),_0x190b('0x55')],[db[_0x190b('0x49')]['fn']('COUNT',db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x56')))),'reCallContacts'],[db['sequelize']['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db['sequelize'][_0x190b('0x4b')]('`state`\x20=\x2019,\x201,\x20null'))),_0x190b('0x57')]]})[_0x190b('0x22')](handleEntityNotFound(_0x503700,null))[_0x190b('0x22')](respondWithResult(_0x503700,null))['catch'](handleError(_0x503700,null));};exports[_0x190b('0x58')]=function(_0x270b59,_0xffe7cb,_0x405e04){return db[_0x190b('0x3d')][_0x190b('0x47')]({'raw':![],'where':{'CampaignId':_0x270b59[_0x190b('0x48')]['id']},'attributes':[[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db['sequelize']['fn']('IF',db['sequelize'][_0x190b('0x4b')](_0x190b('0x4c')))),_0x190b('0x4d')],[db[_0x190b('0x49')]['fn']('COUNT',db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')]['literal'](_0x190b('0x59')))),_0x190b('0x4e')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x4f')))),'busyContacts'],[db[_0x190b('0x49')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x51')))),'congestionContacts'],[db['sequelize']['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x52')))),_0x190b('0x53')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db['sequelize']['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x54')))),_0x190b('0x55')],[db[_0x190b('0x49')]['fn']('COUNT',db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')]('`state`\x20=\x2022,\x201,\x20null'))),_0x190b('0x5a')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db['sequelize'][_0x190b('0x4b')](_0x190b('0x5b')))),_0x190b('0x57')]]})[_0x190b('0x22')](handleEntityNotFound(_0xffe7cb,null))['then'](respondWithResult(_0xffe7cb,null))[_0x190b('0x42')](handleError(_0xffe7cb,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x2495c9,_0x348beb,_0x360d39){return db[_0x190b('0x5c')]['find']({'where':{'id':_0x2495c9[_0x190b('0x48')]['id']}})['then'](handleEntityNotFound(_0x348beb,null))[_0x190b('0x22')](function(_0x5073d2){var _0x49b60c;if(_0x5073d2){_0x49b60c=squel[_0x190b('0x5d')]()['into'](_0x190b('0x5e'))[_0x190b('0x5f')]([_0x190b('0x60'),_0x190b('0x61'),_0x190b('0x62'),'ListId',_0x190b('0x63'),_0x190b('0x64'),_0x190b('0x65')],squel['select']()[_0x190b('0x66')](_0x190b('0x67'),'phone')[_0x190b('0x66')](_0x190b('0x68'),_0x190b('0x61'))['field'](_0x190b('0x69'),_0x190b('0x62'))[_0x190b('0x66')](_0x190b('0x6a'),'ListId')[_0x190b('0x66')](_0x190b('0x6b'),_0x190b('0x63'))['field'](_0x190b('0x68'),_0x190b('0x64'))[_0x190b('0x66')]('NOW()',_0x190b('0x65'))[_0x190b('0x6c')](_0x190b('0x6d'))[_0x190b('0x3a')](_0x190b('0x6e'),_0x2495c9['params']['id']['toString']())[_0x190b('0x3a')](_0x190b('0x6f'),_0x2495c9['body'][_0x190b('0x70')][_0x190b('0x71')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0x190b('0x3a')](_0x190b('0x72'),squel['select']()['field'](_0x190b('0x60'))[_0x190b('0x6c')](_0x190b('0x5e'))[_0x190b('0x3a')](_0x190b('0x6e'),_0x2495c9['params']['id']['toString']()))[_0x190b('0x3a')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x190b('0x73')]()[_0x190b('0x66')](_0x190b('0x74'))[_0x190b('0x6c')](_0x190b('0x6d'))[_0x190b('0x3a')](_0x190b('0x6e'),_0x2495c9[_0x190b('0x48')]['id'][_0x190b('0x71')]())[_0x190b('0x3a')](_0x190b('0x75')))['group'](_0x190b('0x62')))[_0x190b('0x71')]();return db[_0x190b('0x49')]['query'](_0x49b60c);}return[];})['then'](respondWithResult(_0x348beb,null))[_0x190b('0x42')](handleError(_0x348beb,null));};exports[_0x190b('0x76')]=function(_0x4b988d,_0x40ac95,_0x18c5f4){return db[_0x190b('0x77')]['find']({'where':{'id':_0x4b988d[_0x190b('0x48')]['id']}})[_0x190b('0x22')](handleEntityNotFound(_0x40ac95,null))['then'](function(_0x23298e){var _0x2ba27b;if(_0x23298e){_0x2ba27b=squel['insert']()[_0x190b('0x78')]('cm_hopper')['fromQuery'](['phone','scheduledAt',_0x190b('0x62'),_0x190b('0x79'),'CampaignId',_0x190b('0x64'),_0x190b('0x65')],squel['select']()[_0x190b('0x66')](_0x190b('0x67'),_0x190b('0x60'))[_0x190b('0x66')](_0x190b('0x68'),_0x190b('0x61'))[_0x190b('0x66')](_0x190b('0x69'),_0x190b('0x62'))['field'](_0x190b('0x6a'),'ListId')['field'](_0x190b('0x7a'),_0x190b('0x7b'))[_0x190b('0x66')](_0x190b('0x68'),_0x190b('0x64'))[_0x190b('0x66')](_0x190b('0x68'),_0x190b('0x65'))[_0x190b('0x6c')](_0x190b('0x6d'))[_0x190b('0x3a')](_0x190b('0x7c'),_0x4b988d['params']['id'][_0x190b('0x71')]())[_0x190b('0x3a')](_0x190b('0x6f'),_0x4b988d[_0x190b('0x44')][_0x190b('0x70')][_0x190b('0x71')]())[_0x190b('0x3a')](_0x190b('0x7d'))[_0x190b('0x3a')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x190b('0x73')]()[_0x190b('0x66')](_0x190b('0x60'))['from'](_0x190b('0x5e'))[_0x190b('0x3a')]('CampaignId\x20=\x20?',_0x4b988d['params']['id'][_0x190b('0x71')]()))[_0x190b('0x3a')](_0x190b('0x72'),squel[_0x190b('0x73')]()[_0x190b('0x66')](_0x190b('0x74'))[_0x190b('0x6c')](_0x190b('0x6d'))[_0x190b('0x3a')](_0x190b('0x7c'),_0x4b988d['params']['id'][_0x190b('0x71')]())[_0x190b('0x3a')](_0x190b('0x75')))['group'](_0x190b('0x62')))[_0x190b('0x71')]();return db[_0x190b('0x49')][_0x190b('0x2d')](_0x2ba27b);}return[];})[_0x190b('0x22')](respondWithResult(_0x40ac95,null))[_0x190b('0x42')](handleError(_0x40ac95,null));};exports['checkContactHopper']=function(_0x476c86,_0x298824,_0x5e7c76){return db[_0x190b('0x7e')][_0x190b('0x7f')]({'where':{'VoiceQueueId':_0x476c86[_0x190b('0x44')][_0x190b('0x63')],'CampaignId':_0x476c86[_0x190b('0x44')][_0x190b('0x7b')],'ContactId':_0x476c86[_0x190b('0x44')][_0x190b('0x62')]}})['then'](handleEntityNotFound(_0x298824,null))[_0x190b('0x22')](function(_0x1b3168){if(_0x1b3168){return _0x1b3168;}return null;})[_0x190b('0x22')](respondWithResult(_0x298824,null))[_0x190b('0x42')](handleError(_0x298824,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 43e894c..7172f2b 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 _0x9b6d=['bluebird','request-promise','path','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x232c7a,_0x3fa4fa){var _0x37d42d=function(_0x5bb6aa){while(--_0x5bb6aa){_0x232c7a['push'](_0x232c7a['shift']());}};_0x37d42d(++_0x3fa4fa);}(_0x9b6d,0x13e));var _0xd9b6=function(_0x235343,_0x5664cf){_0x235343=_0x235343-0x0;var _0x15a543=_0x9b6d[_0x235343];return _0x15a543;};'use strict';var _=require(_0xd9b6('0x0'));var util=require('util');var logger=require(_0xd9b6('0x1'))(_0xd9b6('0x2'));var moment=require(_0xd9b6('0x3'));var BPromise=require(_0xd9b6('0x4'));var rp=require(_0xd9b6('0x5'));var fs=require('fs');var path=require(_0xd9b6('0x6'));var rimraf=require('rimraf');var config=require(_0xd9b6('0x7'));var attributes=require(_0xd9b6('0x8'));module[_0xd9b6('0x9')]=function(_0x308d80,_0x40684e){return _0x308d80[_0xd9b6('0xa')](_0xd9b6('0xb'),attributes,{'tableName':_0xd9b6('0xc'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':['calleridnum']},{'name':_0xd9b6('0xd'),'fields':[_0xd9b6('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8307=['calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./cmHopperFinal.attributes','exports','define','cm_hopper_final'];(function(_0x34df12,_0x1f36e5){var _0x1ca0ca=function(_0x17e01a){while(--_0x17e01a){_0x34df12['push'](_0x34df12['shift']());}};_0x1ca0ca(++_0x1f36e5);}(_0x8307,0x8e));var _0x7830=function(_0x59fc6f,_0x4a71cf){_0x59fc6f=_0x59fc6f-0x0;var _0x2687ce=_0x8307[_0x59fc6f];return _0x2687ce;};'use strict';var _=require(_0x7830('0x0'));var util=require(_0x7830('0x1'));var logger=require(_0x7830('0x2'))(_0x7830('0x3'));var moment=require(_0x7830('0x4'));var BPromise=require(_0x7830('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7830('0x6'));var rimraf=require('rimraf');var config=require(_0x7830('0x7'));var attributes=require(_0x7830('0x8'));module[_0x7830('0x9')]=function(_0x20bfa4,_0x1c8243){return _0x20bfa4[_0x7830('0xa')]('CmHopperFinal',attributes,{'tableName':_0x7830('0xb'),'paranoid':![],'indexes':[{'name':_0x7830('0xc'),'fields':[_0x7830('0xc')]},{'name':_0x7830('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 33ebbe0..e6f12dc 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(_0x2a9ef0,_0x3aecdc){var _0x46ffc1=function(_0x41bd33){while(--_0x41bd33){_0x2a9ef0['push'](_0x2a9ef0['shift']());}};_0x46ffc1(++_0x3aecdc);}(_0xb10b,0x12a));var _0xbb10=function(_0x1800cb,_0xba50f9){_0x1800cb=_0x1800cb-0x0;var _0x3b5e95=_0xb10b[_0x1800cb];return _0x3b5e95;};'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(_0x3379a6,_0x51add1){var _0xb5812d=function(_0x4a6112){while(--_0x4a6112){_0x3379a6['push'](_0x3379a6['shift']());}};_0xb5812d(++_0x51add1);}(_0x7a54,0x106));var _0x47a5=function(_0x225d87,_0x355e80){_0x225d87=_0x225d87-0x0;var _0x4af59f=_0x7a54[_0x225d87];return _0x4af59f;};'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 86cfd77..3821820 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 _0x82ad=['show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','update','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x7dadac,_0x51e7ff){var _0x556769=function(_0x580855){while(--_0x580855){_0x7dadac['push'](_0x7dadac['shift']());}};_0x556769(++_0x51e7ff);}(_0x82ad,0xac));var _0xd82a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x82ad[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xd82a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd82a('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0xd82a('0x2'));var interaction=require(_0xd82a('0x3'));var config=require(_0xd82a('0x4'));var controller=require(_0xd82a('0x5'));router[_0xd82a('0x6')]('/',auth[_0xd82a('0x7')](),controller[_0xd82a('0x8')]);router[_0xd82a('0x6')](_0xd82a('0x9'),auth[_0xd82a('0x7')](),controller[_0xd82a('0xa')]);router['get'](_0xd82a('0xb'),auth[_0xd82a('0x7')](),controller[_0xd82a('0xc')]);router[_0xd82a('0x6')](_0xd82a('0xd'),auth[_0xd82a('0x7')](),controller[_0xd82a('0xe')]);router[_0xd82a('0x6')](_0xd82a('0xf'),auth[_0xd82a('0x7')](),controller[_0xd82a('0x10')]);router['post'](_0xd82a('0x11'),auth[_0xd82a('0x7')](),controller[_0xd82a('0x12')]);router[_0xd82a('0x13')](_0xd82a('0x14'),auth[_0xd82a('0x7')](),controller[_0xd82a('0x15')]);router[_0xd82a('0x13')]('/checkContactHopper',auth['isAuthenticated'](),controller['checkContactHopper']);router['put']('/:id',auth[_0xd82a('0x7')](),controller[_0xd82a('0x16')]);module['exports']=router; \ No newline at end of file +var _0x03cf=['countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','/checkContactHopper','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal'];(function(_0x4f53d2,_0x373000){var _0x1587db=function(_0x4d2c4c){while(--_0x4d2c4c){_0x4f53d2['push'](_0x4f53d2['shift']());}};_0x1587db(++_0x373000);}(_0x03cf,0x67));var _0xf03c=function(_0x51d8a3,_0x5be78d){_0x51d8a3=_0x51d8a3-0x0;var _0x451bc1=_0x03cf[_0x51d8a3];return _0x451bc1;};'use strict';var multer=require(_0xf03c('0x0'));var util=require('util');var path=require(_0xf03c('0x1'));var timeout=require(_0xf03c('0x2'));var express=require(_0xf03c('0x3'));var router=express[_0xf03c('0x4')]();var fs_extra=require(_0xf03c('0x5'));var auth=require(_0xf03c('0x6'));var interaction=require(_0xf03c('0x7'));var config=require(_0xf03c('0x8'));var controller=require('./cmHopperFinal.controller');router[_0xf03c('0x9')]('/',auth[_0xf03c('0xa')](),controller[_0xf03c('0xb')]);router[_0xf03c('0x9')](_0xf03c('0xc'),auth['isAuthenticated'](),controller[_0xf03c('0xd')]);router[_0xf03c('0x9')]('/:id',auth[_0xf03c('0xa')](),controller[_0xf03c('0xe')]);router['get'](_0xf03c('0xf'),auth['isAuthenticated'](),controller[_0xf03c('0x10')]);router[_0xf03c('0x9')]('/campaign/countAttributes/:id',auth[_0xf03c('0xa')](),controller[_0xf03c('0x11')]);router[_0xf03c('0x12')](_0xf03c('0x13'),auth[_0xf03c('0xa')](),controller[_0xf03c('0x14')]);router[_0xf03c('0x12')]('/voice/campaign/moveContacts/:id',auth['isAuthenticated'](),controller[_0xf03c('0x15')]);router['post'](_0xf03c('0x16'),auth[_0xf03c('0xa')](),controller['checkContactHopper']);router['put']('/:id',auth[_0xf03c('0xa')](),controller['update']);module[_0xf03c('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 6a16bb9..c4a5f43 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 _0x55aa=['BOOLEAN','exports','INTEGER','STRING','DATE'];(function(_0x6522af,_0x200962){var _0x39f7de=function(_0x2da9f7){while(--_0x2da9f7){_0x6522af['push'](_0x6522af['shift']());}};_0x39f7de(++_0x200962);}(_0x55aa,0x146));var _0xa55a=function(_0x3951a4,_0x3e61fa){_0x3951a4=_0x3951a4-0x0;var _0x36ccb3=_0x55aa[_0x3951a4];return _0x36ccb3;};'use strict';var Sequelize=require('sequelize');module[_0xa55a('0x0')]={'state':{'type':Sequelize[_0xa55a('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xa55a('0x2')]},'scheduledat':{'type':Sequelize[_0xa55a('0x3')]},'countbusyretry':{'type':Sequelize[_0xa55a('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa55a('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa55a('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xa55a('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xa55a('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xa55a('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xa55a('0x3')]},'droptime':{'type':Sequelize[_0xa55a('0x3')]},'endtime':{'type':Sequelize[_0xa55a('0x3')]},'ringtime':{'type':Sequelize[_0xa55a('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xa55a('0x2')]},'campaigntype':{'type':Sequelize[_0xa55a('0x2')]},'membername':{'type':Sequelize[_0xa55a('0x2')]},'reason':{'type':Sequelize[_0xa55a('0x2')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa55a('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa55a('0x3')]},'recallme':{'type':Sequelize[_0xa55a('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xa55a('0x3')]},'edited':{'type':Sequelize[_0xa55a('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xa55a('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa55a('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa55a('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa55a('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa55a('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xa55a('0x2')]}}; \ No newline at end of file +var _0x14d8=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x31637d,_0x5116df){var _0x265eda=function(_0x1cedb7){while(--_0x1cedb7){_0x31637d['push'](_0x31637d['shift']());}};_0x265eda(++_0x5116df);}(_0x14d8,0x87));var _0x814d=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x14d8[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0x814d('0x0'));module[_0x814d('0x1')]={'state':{'type':Sequelize[_0x814d('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x814d('0x3')]},'scheduledat':{'type':Sequelize[_0x814d('0x4')]},'countbusyretry':{'type':Sequelize[_0x814d('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x814d('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x814d('0x3')]},'calleridnum':{'type':Sequelize[_0x814d('0x3')]},'calleridname':{'type':Sequelize[_0x814d('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x814d('0x4')]},'answertime':{'type':Sequelize[_0x814d('0x4')]},'droptime':{'type':Sequelize[_0x814d('0x4')]},'endtime':{'type':Sequelize[_0x814d('0x4')]},'ringtime':{'type':Sequelize[_0x814d('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x814d('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x814d('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x814d('0x3')]},'campaign':{'type':Sequelize[_0x814d('0x3')]},'campaigntype':{'type':Sequelize[_0x814d('0x3')]},'membername':{'type':Sequelize[_0x814d('0x3')]},'reason':{'type':Sequelize[_0x814d('0x3')]},'amd':{'type':Sequelize[_0x814d('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x814d('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x814d('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x814d('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x814d('0x4')]},'recallme':{'type':Sequelize[_0x814d('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x814d('0x4')]},'edited':{'type':Sequelize[_0x814d('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x814d('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x814d('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x814d('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x814d('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index a5eba7e..06db331 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 _0x7428=['name','send','index','map','CmHopperHistory','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack'];(function(_0x17475c,_0x42bdb4){var _0x4cf0cb=function(_0x13b7f9){while(--_0x13b7f9){_0x17475c['push'](_0x17475c['shift']());}};_0x4cf0cb(++_0x42bdb4);}(_0x7428,0x161));var _0x8742=function(_0x7d03a6,_0x26f4ad){_0x7d03a6=_0x7d03a6-0x0;var _0x223583=_0x7428[_0x7d03a6];return _0x223583;};'use strict';var emlformat=require(_0x8742('0x0'));var rimraf=require(_0x8742('0x1'));var zipdir=require(_0x8742('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8742('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8742('0x4'));var path=require(_0x8742('0x5'));var sox=require(_0x8742('0x6'));var csv=require(_0x8742('0x7'));var ejs=require(_0x8742('0x8'));var fs=require('fs');var fs_extra=require(_0x8742('0x9'));var _=require(_0x8742('0xa'));var squel=require(_0x8742('0xb'));var crypto=require(_0x8742('0xc'));var jsforce=require(_0x8742('0xd'));var deskjs=require(_0x8742('0xe'));var toCsv=require(_0x8742('0x7'));var querystring=require(_0x8742('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8742('0x10'));var qs=require(_0x8742('0x11'));var as=require(_0x8742('0x12'));var hardwareService=require(_0x8742('0x13'));var logger=require(_0x8742('0x14'))(_0x8742('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8742('0x16'));var db=require(_0x8742('0x17'))['db'];function respondWithStatusCode(_0x36b74b,_0x4e6d11){_0x4e6d11=_0x4e6d11||0xcc;return function(_0x2ada0b){if(_0x2ada0b){return _0x36b74b[_0x8742('0x18')](_0x4e6d11);}return _0x36b74b['status'](_0x4e6d11)[_0x8742('0x19')]();};}function respondWithResult(_0xad9b02,_0x88acb){_0x88acb=_0x88acb||0xc8;return function(_0x4f5a7c){if(_0x4f5a7c){return _0xad9b02['status'](_0x88acb)[_0x8742('0x1a')](_0x4f5a7c);}};}function respondWithFilteredResult(_0xfff0bc,_0x1c1979){return function(_0x2c6a84){if(_0x2c6a84){var _0xbf6299=typeof _0x1c1979[_0x8742('0x1b')]===_0x8742('0x1c')&&typeof _0x1c1979[_0x8742('0x1d')]===_0x8742('0x1c');var _0xef1227=_0x2c6a84['count'];var _0xf62041=_0xbf6299?0x0:_0x1c1979['offset'];var _0x2de3f7=_0xbf6299?_0x2c6a84[_0x8742('0x1e')]:_0x1c1979['offset']+_0x1c1979[_0x8742('0x1d')];var _0x3e41cc;if(_0x2de3f7>=_0xef1227){_0x2de3f7=_0xef1227;_0x3e41cc=0xc8;}else{_0x3e41cc=0xce;}_0xfff0bc[_0x8742('0x1f')](_0x3e41cc);return _0xfff0bc[_0x8742('0x20')](_0x8742('0x21'),_0xf62041+'-'+_0x2de3f7+'/'+_0xef1227)[_0x8742('0x1a')](_0x2c6a84);}return null;};}function patchUpdates(_0x684a2c){return function(_0x1b2159){try{jsonpatch[_0x8742('0x22')](_0x1b2159,_0x684a2c,!![]);}catch(_0x1d899a){return BPromise[_0x8742('0x23')](_0x1d899a);}return _0x1b2159[_0x8742('0x24')]();};}function saveUpdates(_0x58f82c,_0x219875){return function(_0x137b80){if(_0x137b80){return _0x137b80[_0x8742('0x25')](_0x58f82c)[_0x8742('0x26')](function(_0x59aff0){return _0x59aff0;});}return null;};}function removeEntity(_0x2eca48,_0x20b162){return function(_0x248a90){if(_0x248a90){return _0x248a90[_0x8742('0x27')]()[_0x8742('0x26')](function(){_0x2eca48[_0x8742('0x1f')](0xcc)[_0x8742('0x19')]();});}};}function handleEntityNotFound(_0x452735,_0x36f70b){return function(_0x9733e4){if(!_0x9733e4){_0x452735['sendStatus'](0x194);}return _0x9733e4;};}function handleError(_0x49fde3,_0x221a36){_0x221a36=_0x221a36||0x1f4;return function(_0x50ab31){logger[_0x8742('0x28')](_0x50ab31[_0x8742('0x29')]);if(_0x50ab31[_0x8742('0x2a')]){delete _0x50ab31['name'];}_0x49fde3['status'](_0x221a36)[_0x8742('0x2b')](_0x50ab31);};}exports[_0x8742('0x2c')]=function(_0x537d39,_0x424990){var _0x364417={},_0x30ff1f={},_0x52a089={'count':0x0,'rows':[]};var _0x46e7f4=_[_0x8742('0x2d')](db[_0x8742('0x2e')][_0x8742('0x2f')],function(_0x329532){return{'name':_0x329532['fieldName'],'type':_0x329532[_0x8742('0x30')][_0x8742('0x31')]};});_0x30ff1f[_0x8742('0x32')]=_[_0x8742('0x2d')](_0x46e7f4,_0x8742('0x2a'));_0x30ff1f[_0x8742('0x33')]=_['keys'](_0x537d39['query']);_0x30ff1f[_0x8742('0x34')]=_[_0x8742('0x35')](_0x30ff1f[_0x8742('0x32')],_0x30ff1f[_0x8742('0x33')]);_0x364417[_0x8742('0x36')]=_['intersection'](_0x30ff1f[_0x8742('0x32')],qs[_0x8742('0x37')](_0x537d39[_0x8742('0x33')][_0x8742('0x37')]));_0x364417[_0x8742('0x36')]=_0x364417['attributes'][_0x8742('0x38')]?_0x364417['attributes']:_0x30ff1f['model'];if(!_0x537d39[_0x8742('0x33')][_0x8742('0x39')](_0x8742('0x3a'))){_0x364417[_0x8742('0x1d')]=qs[_0x8742('0x1d')](_0x537d39['query'][_0x8742('0x1d')]);_0x364417['offset']=qs[_0x8742('0x1b')](_0x537d39['query'][_0x8742('0x1b')]);}_0x364417[_0x8742('0x3b')]=qs[_0x8742('0x3c')](_0x537d39[_0x8742('0x33')][_0x8742('0x3c')]);_0x364417[_0x8742('0x3d')]=qs[_0x8742('0x34')](_[_0x8742('0x3e')](_0x537d39[_0x8742('0x33')],_0x30ff1f[_0x8742('0x34')]),_0x46e7f4);if(_0x537d39['query'][_0x8742('0x3f')]){_0x364417[_0x8742('0x3d')]=_[_0x8742('0x40')](_0x364417[_0x8742('0x3d')],{'$or':_['map'](_0x46e7f4,function(_0x4dc195){if(_0x4dc195['type']!=='VIRTUAL'){var _0x5a093d={};_0x5a093d[_0x4dc195[_0x8742('0x2a')]]={'$like':'%'+_0x537d39[_0x8742('0x33')]['filter']+'%'};return _0x5a093d;}})});}_0x364417=_[_0x8742('0x40')]({},_0x364417,_0x537d39[_0x8742('0x41')]);var _0x37ca99={'where':_0x364417[_0x8742('0x3d')]};return db[_0x8742('0x2e')]['count'](_0x37ca99)[_0x8742('0x26')](function(_0x4b8fca){_0x52a089['count']=_0x4b8fca;if(_0x537d39[_0x8742('0x33')][_0x8742('0x42')]){_0x364417[_0x8742('0x43')]=[{'all':!![]}];}return db[_0x8742('0x2e')][_0x8742('0x44')](_0x364417);})[_0x8742('0x26')](function(_0x8d0de2){_0x52a089[_0x8742('0x45')]=_0x8d0de2;return _0x52a089;})[_0x8742('0x26')](respondWithFilteredResult(_0x424990,_0x364417))[_0x8742('0x46')](handleError(_0x424990,null));};exports[_0x8742('0x47')]=function(_0x218a6e,_0x170091){var _0x3e8ce9={'raw':!![],'where':{'id':_0x218a6e[_0x8742('0x48')]['id']}},_0x14b87b={};_0x14b87b[_0x8742('0x32')]=_['keys'](db[_0x8742('0x2e')][_0x8742('0x2f')]);_0x14b87b[_0x8742('0x33')]=_[_0x8742('0x49')](_0x218a6e[_0x8742('0x33')]);_0x14b87b[_0x8742('0x34')]=_[_0x8742('0x35')](_0x14b87b[_0x8742('0x32')],_0x14b87b[_0x8742('0x33')]);_0x3e8ce9['attributes']=_[_0x8742('0x35')](_0x14b87b[_0x8742('0x32')],qs['fields'](_0x218a6e[_0x8742('0x33')][_0x8742('0x37')]));_0x3e8ce9[_0x8742('0x36')]=_0x3e8ce9['attributes'][_0x8742('0x38')]?_0x3e8ce9['attributes']:_0x14b87b[_0x8742('0x32')];if(_0x218a6e[_0x8742('0x33')]['includeAll']){_0x3e8ce9[_0x8742('0x43')]=[{'all':!![]}];}_0x3e8ce9=_[_0x8742('0x40')]({},_0x3e8ce9,_0x218a6e[_0x8742('0x41')]);return db[_0x8742('0x2e')][_0x8742('0x4a')](_0x3e8ce9)[_0x8742('0x26')](handleEntityNotFound(_0x170091,null))[_0x8742('0x26')](respondWithResult(_0x170091,null))[_0x8742('0x46')](handleError(_0x170091,null));};exports['create']=function(_0x58624b,_0x260307){return db['CmHopperHistory'][_0x8742('0x4b')](_0x58624b[_0x8742('0x4c')],{})['then'](respondWithResult(_0x260307,0xc9))['catch'](handleError(_0x260307,null));};exports[_0x8742('0x4d')]=function(_0x2e1031,_0xf8029f){return db[_0x8742('0x2e')][_0x8742('0x4d')]()['then'](respondWithResult(_0xf8029f,null))[_0x8742('0x46')](handleError(_0xf8029f,null));};exports[_0x8742('0x25')]=function(_0x37fdcd,_0x56cc12){if(_0x37fdcd[_0x8742('0x4c')][_0x8742('0x4e')]){delete _0x37fdcd[_0x8742('0x4c')][_0x8742('0x4e')];}return db['CmHopperHistory'][_0x8742('0x4a')]({'where':{'uniqueid':_0x37fdcd[_0x8742('0x48')]['id']}})['then'](handleEntityNotFound(_0x56cc12,null))[_0x8742('0x26')](saveUpdates(_0x37fdcd[_0x8742('0x4c')],null))['then'](respondWithResult(_0x56cc12,null))[_0x8742('0x46')](handleError(_0x56cc12,null));}; \ No newline at end of file +var _0x0068=['../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','map','CmHopperHistory','fieldName','key','model','query','intersection','attributes','fields','length','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','show','keys','rawAttributes','find','catch','create','body','describe','params','eml-format','zip-dir','fast-json-patch','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/logger','../../config/utils'];(function(_0x1fba68,_0x4f8ef8){var _0x4d30fd=function(_0x516482){while(--_0x516482){_0x1fba68['push'](_0x1fba68['shift']());}};_0x4d30fd(++_0x4f8ef8);}(_0x0068,0x1f4));var _0x8006=function(_0x2106e0,_0x57e335){_0x2106e0=_0x2106e0-0x0;var _0x22e4f0=_0x0068[_0x2106e0];return _0x22e4f0;};'use strict';var emlformat=require(_0x8006('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8006('0x1'));var jsonpatch=require(_0x8006('0x2'));var rp=require(_0x8006('0x3'));var moment=require(_0x8006('0x4'));var BPromise=require(_0x8006('0x5'));var Mustache=require(_0x8006('0x6'));var util=require(_0x8006('0x7'));var path=require(_0x8006('0x8'));var sox=require(_0x8006('0x9'));var csv=require('to-csv');var ejs=require(_0x8006('0xa'));var fs=require('fs');var fs_extra=require(_0x8006('0xb'));var _=require(_0x8006('0xc'));var squel=require(_0x8006('0xd'));var crypto=require(_0x8006('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8006('0xf'));var toCsv=require(_0x8006('0x10'));var querystring=require(_0x8006('0x11'));var Papa=require(_0x8006('0x12'));var Redis=require(_0x8006('0x13'));var authService=require(_0x8006('0x14'));var qs=require(_0x8006('0x15'));var as=require(_0x8006('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8006('0x17'))('api');var utils=require(_0x8006('0x18'));var config=require(_0x8006('0x19'));var licenseUtil=require(_0x8006('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b2d55,_0x3c7e2a){_0x3c7e2a=_0x3c7e2a||0xcc;return function(_0xf488c0){if(_0xf488c0){return _0x1b2d55['sendStatus'](_0x3c7e2a);}return _0x1b2d55[_0x8006('0x1b')](_0x3c7e2a)[_0x8006('0x1c')]();};}function respondWithResult(_0x106eed,_0x3b7fba){_0x3b7fba=_0x3b7fba||0xc8;return function(_0x1772c3){if(_0x1772c3){return _0x106eed['status'](_0x3b7fba)[_0x8006('0x1d')](_0x1772c3);}};}function respondWithFilteredResult(_0x23af64,_0x223c9){return function(_0x3d8168){if(_0x3d8168){var _0x59f0e4=typeof _0x223c9[_0x8006('0x1e')]===_0x8006('0x1f')&&typeof _0x223c9[_0x8006('0x20')]===_0x8006('0x1f');var _0x5d279e=_0x3d8168['count'];var _0x2e0dd4=_0x59f0e4?0x0:_0x223c9[_0x8006('0x1e')];var _0x327e03=_0x59f0e4?_0x3d8168[_0x8006('0x21')]:_0x223c9[_0x8006('0x1e')]+_0x223c9[_0x8006('0x20')];var _0x228f08;if(_0x327e03>=_0x5d279e){_0x327e03=_0x5d279e;_0x228f08=0xc8;}else{_0x228f08=0xce;}_0x23af64[_0x8006('0x1b')](_0x228f08);return _0x23af64[_0x8006('0x22')](_0x8006('0x23'),_0x2e0dd4+'-'+_0x327e03+'/'+_0x5d279e)['json'](_0x3d8168);}return null;};}function patchUpdates(_0x44936c){return function(_0x29aa62){try{jsonpatch[_0x8006('0x24')](_0x29aa62,_0x44936c,!![]);}catch(_0x2059e3){return BPromise[_0x8006('0x25')](_0x2059e3);}return _0x29aa62[_0x8006('0x26')]();};}function saveUpdates(_0x50771a,_0x478b75){return function(_0x28bf60){if(_0x28bf60){return _0x28bf60[_0x8006('0x27')](_0x50771a)[_0x8006('0x28')](function(_0x14cdd8){return _0x14cdd8;});}return null;};}function removeEntity(_0x1befeb,_0x167543){return function(_0x4541d4){if(_0x4541d4){return _0x4541d4[_0x8006('0x29')]()[_0x8006('0x28')](function(){_0x1befeb['status'](0xcc)[_0x8006('0x1c')]();});}};}function handleEntityNotFound(_0x21869b,_0x12f73e){return function(_0x36e53e){if(!_0x36e53e){_0x21869b[_0x8006('0x2a')](0x194);}return _0x36e53e;};}function handleError(_0x3547e6,_0x5c1dab){_0x5c1dab=_0x5c1dab||0x1f4;return function(_0x2bff66){logger[_0x8006('0x2b')](_0x2bff66['stack']);if(_0x2bff66['name']){delete _0x2bff66[_0x8006('0x2c')];}_0x3547e6['status'](_0x5c1dab)['send'](_0x2bff66);};}exports['index']=function(_0xd78e32,_0x3e4c2a){var _0x283be5={},_0xd3fcb7={},_0x569f72={'count':0x0,'rows':[]};var _0x50350c=_[_0x8006('0x2d')](db[_0x8006('0x2e')]['rawAttributes'],function(_0x2cb8b7){return{'name':_0x2cb8b7[_0x8006('0x2f')],'type':_0x2cb8b7['type'][_0x8006('0x30')]};});_0xd3fcb7[_0x8006('0x31')]=_[_0x8006('0x2d')](_0x50350c,'name');_0xd3fcb7[_0x8006('0x32')]=_['keys'](_0xd78e32[_0x8006('0x32')]);_0xd3fcb7['filters']=_[_0x8006('0x33')](_0xd3fcb7['model'],_0xd3fcb7[_0x8006('0x32')]);_0x283be5[_0x8006('0x34')]=_[_0x8006('0x33')](_0xd3fcb7['model'],qs[_0x8006('0x35')](_0xd78e32[_0x8006('0x32')][_0x8006('0x35')]));_0x283be5['attributes']=_0x283be5[_0x8006('0x34')][_0x8006('0x36')]?_0x283be5[_0x8006('0x34')]:_0xd3fcb7['model'];if(!_0xd78e32[_0x8006('0x32')]['hasOwnProperty']('nolimit')){_0x283be5[_0x8006('0x20')]=qs[_0x8006('0x20')](_0xd78e32[_0x8006('0x32')][_0x8006('0x20')]);_0x283be5[_0x8006('0x1e')]=qs[_0x8006('0x1e')](_0xd78e32[_0x8006('0x32')][_0x8006('0x1e')]);}_0x283be5['order']=qs[_0x8006('0x37')](_0xd78e32[_0x8006('0x32')][_0x8006('0x37')]);_0x283be5[_0x8006('0x38')]=qs[_0x8006('0x39')](_[_0x8006('0x3a')](_0xd78e32['query'],_0xd3fcb7[_0x8006('0x39')]),_0x50350c);if(_0xd78e32['query']['filter']){_0x283be5[_0x8006('0x38')]=_['merge'](_0x283be5[_0x8006('0x38')],{'$or':_[_0x8006('0x2d')](_0x50350c,function(_0x1cdb20){if(_0x1cdb20['type']!==_0x8006('0x3b')){var _0x58d315={};_0x58d315[_0x1cdb20['name']]={'$like':'%'+_0xd78e32['query'][_0x8006('0x3c')]+'%'};return _0x58d315;}})});}_0x283be5=_[_0x8006('0x3d')]({},_0x283be5,_0xd78e32[_0x8006('0x3e')]);var _0x492be0={'where':_0x283be5[_0x8006('0x38')]};return db[_0x8006('0x2e')][_0x8006('0x21')](_0x492be0)[_0x8006('0x28')](function(_0x43b3ae){_0x569f72['count']=_0x43b3ae;if(_0xd78e32[_0x8006('0x32')][_0x8006('0x3f')]){_0x283be5[_0x8006('0x40')]=[{'all':!![]}];}return db[_0x8006('0x2e')][_0x8006('0x41')](_0x283be5);})[_0x8006('0x28')](function(_0x4ccec5){_0x569f72['rows']=_0x4ccec5;return _0x569f72;})[_0x8006('0x28')](respondWithFilteredResult(_0x3e4c2a,_0x283be5))['catch'](handleError(_0x3e4c2a,null));};exports[_0x8006('0x42')]=function(_0x362981,_0x27b7bf){var _0x250320={'raw':!![],'where':{'id':_0x362981['params']['id']}},_0x2d1326={};_0x2d1326[_0x8006('0x31')]=_[_0x8006('0x43')](db[_0x8006('0x2e')][_0x8006('0x44')]);_0x2d1326[_0x8006('0x32')]=_['keys'](_0x362981[_0x8006('0x32')]);_0x2d1326[_0x8006('0x39')]=_[_0x8006('0x33')](_0x2d1326[_0x8006('0x31')],_0x2d1326[_0x8006('0x32')]);_0x250320[_0x8006('0x34')]=_[_0x8006('0x33')](_0x2d1326[_0x8006('0x31')],qs[_0x8006('0x35')](_0x362981['query'][_0x8006('0x35')]));_0x250320[_0x8006('0x34')]=_0x250320['attributes'][_0x8006('0x36')]?_0x250320['attributes']:_0x2d1326[_0x8006('0x31')];if(_0x362981[_0x8006('0x32')][_0x8006('0x3f')]){_0x250320[_0x8006('0x40')]=[{'all':!![]}];}_0x250320=_[_0x8006('0x3d')]({},_0x250320,_0x362981[_0x8006('0x3e')]);return db[_0x8006('0x2e')][_0x8006('0x45')](_0x250320)['then'](handleEntityNotFound(_0x27b7bf,null))['then'](respondWithResult(_0x27b7bf,null))[_0x8006('0x46')](handleError(_0x27b7bf,null));};exports[_0x8006('0x47')]=function(_0x13bf13,_0x31000e){return db[_0x8006('0x2e')][_0x8006('0x47')](_0x13bf13[_0x8006('0x48')],{})[_0x8006('0x28')](respondWithResult(_0x31000e,0xc9))[_0x8006('0x46')](handleError(_0x31000e,null));};exports[_0x8006('0x49')]=function(_0x207b7a,_0x23f2d1){return db['CmHopperHistory']['describe']()[_0x8006('0x28')](respondWithResult(_0x23f2d1,null))[_0x8006('0x46')](handleError(_0x23f2d1,null));};exports[_0x8006('0x27')]=function(_0x1a4d1b,_0x79a680){if(_0x1a4d1b[_0x8006('0x48')]['uniqueid']){delete _0x1a4d1b[_0x8006('0x48')]['uniqueid'];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x1a4d1b[_0x8006('0x4a')]['id']}})[_0x8006('0x28')](handleEntityNotFound(_0x79a680,null))[_0x8006('0x28')](saveUpdates(_0x1a4d1b[_0x8006('0x48')],null))[_0x8006('0x28')](respondWithResult(_0x79a680,null))['catch'](handleError(_0x79a680,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 10d842d..a0fb3d0 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 _0x095b=['define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperHistory.attributes','exports'];(function(_0x159cad,_0x448268){var _0x590bfb=function(_0x359f75){while(--_0x359f75){_0x159cad['push'](_0x159cad['shift']());}};_0x590bfb(++_0x448268);}(_0x095b,0x6e));var _0xb095=function(_0x164821,_0x4ac056){_0x164821=_0x164821-0x0;var _0x1f3760=_0x095b[_0x164821];return _0x1f3760;};'use strict';var _=require(_0xb095('0x0'));var util=require('util');var logger=require(_0xb095('0x1'))(_0xb095('0x2'));var moment=require(_0xb095('0x3'));var BPromise=require(_0xb095('0x4'));var rp=require(_0xb095('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb095('0x6'));var config=require(_0xb095('0x7'));var attributes=require(_0xb095('0x8'));module[_0xb095('0x9')]=function(_0x10a03d,_0x3e4cc9){return _0x10a03d[_0xb095('0xa')](_0xb095('0xb'),attributes,{'tableName':_0xb095('0xc'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0xb095('0xd')]},{'name':_0xb095('0xe'),'fields':[_0xb095('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8506=['endtime','uniqueid','util','api','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x4dadad,_0xb556a6){var _0x36bb0b=function(_0x558c49){while(--_0x558c49){_0x4dadad['push'](_0x4dadad['shift']());}};_0x36bb0b(++_0xb556a6);}(_0x8506,0xe8));var _0x6850=function(_0x42dbc5,_0x4755bc){_0x42dbc5=_0x42dbc5-0x0;var _0x456541=_0x8506[_0x42dbc5];return _0x456541;};'use strict';var _=require('lodash');var util=require(_0x6850('0x0'));var logger=require('../../config/logger')(_0x6850('0x1'));var moment=require('moment');var BPromise=require(_0x6850('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6850('0x3'));var rimraf=require(_0x6850('0x4'));var config=require(_0x6850('0x5'));var attributes=require('./cmHopperHistory.attributes');module[_0x6850('0x6')]=function(_0x372f0b,_0x232459){return _0x372f0b[_0x6850('0x7')]('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':'endtime','fields':[_0x6850('0x8')]},{'name':_0x6850('0x9'),'fields':[_0x6850('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index f53e6c8..abe24d5 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 _0xd9b4=['`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetVoiceQueueHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','CmHopperHistory','create','body','options','raw','CreateCmHopperHistory','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0xd9b4,0x1f0));var _0x4d9b=function(_0x5d71b0,_0x2f8911){_0x5d71b0=_0x5d71b0-0x0;var _0x483033=_0xd9b4[_0x5d71b0];return _0x483033;};'use strict';var _=require(_0x4d9b('0x0'));var util=require(_0x4d9b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d9b('0x2'));var db=require(_0x4d9b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4d9b('0x4'))(_0x4d9b('0x5'));var config=require(_0x4d9b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4d9b('0x7')][_0x4d9b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x472c89,_0x2afeb9,_0x57b437){return new BPromise(function(_0x436af7,_0x3b05cc){return client['request'](_0x472c89,_0x57b437)[_0x4d9b('0x9')](function(_0x2a0c39){logger['info'](_0x4d9b('0xa'),_0x2afeb9,_0x4d9b('0xb'));logger[_0x4d9b('0xc')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x2afeb9,'request\x20sent',JSON[_0x4d9b('0xd')](_0x2a0c39));if(_0x2a0c39[_0x4d9b('0xe')]){if(_0x2a0c39['error']['code']===0x1f4){logger[_0x4d9b('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x2afeb9,_0x2a0c39[_0x4d9b('0xe')][_0x4d9b('0xf')]);return _0x3b05cc(_0x2a0c39[_0x4d9b('0xe')][_0x4d9b('0xf')]);}logger[_0x4d9b('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x2afeb9,_0x2a0c39[_0x4d9b('0xe')]['message']);return _0x436af7(_0x2a0c39['error']['message']);}else{logger[_0x4d9b('0x10')](_0x4d9b('0xa'),_0x2afeb9,'request\x20sent');_0x436af7(_0x2a0c39[_0x4d9b('0x11')][_0x4d9b('0xf')]);}})[_0x4d9b('0x12')](function(_0x5e9caf){logger[_0x4d9b('0xe')](_0x4d9b('0xa'),_0x2afeb9,_0x5e9caf);_0x3b05cc(_0x5e9caf);});});}exports['CreateCmHopperHistory']=function(_0x194648){var _0x5d4bd7=this;return new Promise(function(_0x445083,_0x31c3f7){return db[_0x4d9b('0x13')][_0x4d9b('0x14')](_0x194648[_0x4d9b('0x15')],{'raw':_0x194648[_0x4d9b('0x16')]?_0x194648['options'][_0x4d9b('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x3a1da6){logger[_0x4d9b('0x10')]('CreateCmHopperHistory',_0x194648);logger[_0x4d9b('0xc')]('CreateCmHopperHistory',_0x194648,JSON[_0x4d9b('0xd')](_0x3a1da6));_0x445083(_0x3a1da6);})[_0x4d9b('0x12')](function(_0x114e4e){logger[_0x4d9b('0xe')](_0x4d9b('0x18'),_0x114e4e[_0x4d9b('0xf')],_0x194648);_0x31c3f7(_0x5d4bd7[_0x4d9b('0xe')](0x1f4,_0x114e4e['message']));});});};exports[_0x4d9b('0x19')]=function(_0x5528c2){var _0x3e897a=this;return new Promise(function(_0x579bf2,_0x3ec599){return db[_0x4d9b('0x13')][_0x4d9b('0x1a')]({'raw':_0x5528c2[_0x4d9b('0x16')]?_0x5528c2['options'][_0x4d9b('0x17')]===undefined?!![]:![]:!![],'where':_0x5528c2[_0x4d9b('0x16')]?_0x5528c2['options'][_0x4d9b('0x1b')]||null:null,'attributes':[[db[_0x4d9b('0x1c')]['fn'](_0x4d9b('0x1d'),db[_0x4d9b('0x1c')][_0x4d9b('0x1e')]('id')),_0x4d9b('0x1f')],[db['sequelize']['fn'](_0x4d9b('0x1d'),db[_0x4d9b('0x1c')]['fn']('IF',db['sequelize'][_0x4d9b('0x20')]('`state`\x20=\x204,\x201,\x20null'))),_0x4d9b('0x21')],[db[_0x4d9b('0x1c')]['fn']('COUNT',db[_0x4d9b('0x1c')]['fn']('IF',db['sequelize']['literal'](_0x4d9b('0x22')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x4d9b('0x1c')]['fn'](_0x4d9b('0x1d'),db['sequelize']['fn']('IF',db[_0x4d9b('0x1c')][_0x4d9b('0x20')](_0x4d9b('0x23')))),_0x4d9b('0x24')],[db['sequelize']['fn'](_0x4d9b('0x25'),db['sequelize']['fn']('IF',db[_0x4d9b('0x1c')][_0x4d9b('0x20')](_0x4d9b('0x26')))),_0x4d9b('0x27')],[db['sequelize']['fn']('AVG',db[_0x4d9b('0x1c')]['fn']('IF',db[_0x4d9b('0x1c')]['literal'](_0x4d9b('0x28')))),_0x4d9b('0x29')]]})['then'](function(_0x13647c){logger['info'](_0x4d9b('0x19'),_0x5528c2);logger[_0x4d9b('0xc')](_0x4d9b('0x19'),_0x5528c2,JSON[_0x4d9b('0xd')](_0x13647c));_0x579bf2(_0x13647c);})['catch'](function(_0x2aeeac){logger[_0x4d9b('0xe')](_0x4d9b('0x19'),_0x2aeeac[_0x4d9b('0xf')],_0x5528c2);_0x3ec599(_0x3e897a['error'](0x1f4,_0x2aeeac[_0x4d9b('0xf')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x434c65){var _0x58b09c=this;return new Promise(function(_0x4ec3a,_0x318cb7){return db[_0x4d9b('0x13')][_0x4d9b('0x1a')]({'raw':_0x434c65[_0x4d9b('0x16')]?_0x434c65[_0x4d9b('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x434c65['options']?_0x434c65[_0x4d9b('0x16')]['where']||null:null,'attributes':[[_0x4d9b('0x2a'),_0x4d9b('0x2b')],[db[_0x4d9b('0x1c')]['fn'](_0x4d9b('0x1d'),db[_0x4d9b('0x1c')]['fn']('IF',db[_0x4d9b('0x1c')]['literal'](_0x4d9b('0x2c')))),'outboundNoSuchCallsDay'],[db[_0x4d9b('0x1c')]['fn'](_0x4d9b('0x1d'),db[_0x4d9b('0x1c')]['fn']('IF',db[_0x4d9b('0x1c')][_0x4d9b('0x20')]('`state`\x20=\x203,\x201,\x20null'))),_0x4d9b('0x2d')],[db[_0x4d9b('0x1c')]['fn'](_0x4d9b('0x1d'),db['sequelize']['fn']('IF',db[_0x4d9b('0x1c')]['literal'](_0x4d9b('0x2e')))),_0x4d9b('0x2f')],[db[_0x4d9b('0x1c')]['fn'](_0x4d9b('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0x4d9b('0x20')](_0x4d9b('0x30')))),'outboundBusyCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x4d9b('0x1c')]['fn']('IF',db[_0x4d9b('0x1c')][_0x4d9b('0x20')](_0x4d9b('0x31')))),_0x4d9b('0x32')],[db[_0x4d9b('0x1c')]['fn']('COUNT',db[_0x4d9b('0x1c')]['fn']('IF',db[_0x4d9b('0x1c')][_0x4d9b('0x20')](_0x4d9b('0x33')))),_0x4d9b('0x34')],[db[_0x4d9b('0x1c')]['fn']('COUNT',db[_0x4d9b('0x1c')]['fn']('IF',db['sequelize'][_0x4d9b('0x20')](_0x4d9b('0x35')))),'outboundDropCallsDayCallersExit'],[db[_0x4d9b('0x1c')]['fn'](_0x4d9b('0x1d'),db[_0x4d9b('0x1c')]['fn']('IF',db[_0x4d9b('0x1c')][_0x4d9b('0x20')](_0x4d9b('0x36')))),_0x4d9b('0x37')],[db['sequelize']['fn'](_0x4d9b('0x1d'),db[_0x4d9b('0x1c')]['fn']('IF',db['sequelize'][_0x4d9b('0x20')](_0x4d9b('0x38')))),'outboundBlacklistCallsDay'],[db[_0x4d9b('0x1c')]['fn'](_0x4d9b('0x1d'),db[_0x4d9b('0x1c')]['fn']('IF',db[_0x4d9b('0x1c')][_0x4d9b('0x20')](_0x4d9b('0x39')))),_0x4d9b('0x3a')],[db['sequelize']['fn']('COUNT',db[_0x4d9b('0x1c')]['fn']('IF',db[_0x4d9b('0x1c')][_0x4d9b('0x20')]('`state`\x20=\x2018,\x201,\x20null'))),_0x4d9b('0x3b')],[db[_0x4d9b('0x1c')]['fn']('COUNT',db[_0x4d9b('0x1c')]['fn']('IF',db['sequelize'][_0x4d9b('0x20')](_0x4d9b('0x3c')))),_0x4d9b('0x3d')],[db[_0x4d9b('0x1c')]['fn']('COUNT',db[_0x4d9b('0x1c')]['fn']('IF',db[_0x4d9b('0x1c')][_0x4d9b('0x20')](_0x4d9b('0x3e')))),'outboundRejectCallsDay'],[db[_0x4d9b('0x1c')]['fn'](_0x4d9b('0x1d'),db['sequelize']['fn']('IF',db[_0x4d9b('0x1c')][_0x4d9b('0x20')](_0x4d9b('0x3f')))),'outboundReCallsDay']],'group':[_0x4d9b('0x2a')]})[_0x4d9b('0x9')](function(_0x479ac6){logger[_0x4d9b('0x10')]('GetVoiceQueueHopperHistory',_0x434c65);logger[_0x4d9b('0xc')](_0x4d9b('0x40'),_0x434c65,JSON['stringify'](_0x479ac6));_0x4ec3a(_0x479ac6);})['catch'](function(_0x2e3615){logger[_0x4d9b('0xe')](_0x4d9b('0x40'),_0x2e3615[_0x4d9b('0xf')],_0x434c65);_0x318cb7(_0x58b09c[_0x4d9b('0xe')](0x1f4,_0x2e3615['message']));});});};exports['GetCampaignHopperHistory']=function(_0x3e5d95){var _0x344ee9=this;return new Promise(function(_0x5f04e6,_0x10b1e6){return db[_0x4d9b('0x13')][_0x4d9b('0x1a')]({'raw':_0x3e5d95[_0x4d9b('0x16')]?_0x3e5d95[_0x4d9b('0x16')][_0x4d9b('0x17')]===undefined?!![]:![]:!![],'where':_0x3e5d95[_0x4d9b('0x16')]?_0x3e5d95[_0x4d9b('0x16')]['where']||null:null,'attributes':[[_0x4d9b('0x2a'),_0x4d9b('0x2b')],[db['sequelize']['fn']('COUNT',db[_0x4d9b('0x1c')]['col']('id')),_0x4d9b('0x41')],[db[_0x4d9b('0x1c')]['fn']('COUNT',db[_0x4d9b('0x1c')]['fn']('IF',db[_0x4d9b('0x1c')][_0x4d9b('0x20')](_0x4d9b('0x2e')))),_0x4d9b('0x42')]],'group':[_0x4d9b('0x2a')]})['then'](function(_0x21b3fb){logger['info'](_0x4d9b('0x43'),_0x3e5d95);logger[_0x4d9b('0xc')](_0x4d9b('0x43'),_0x3e5d95,JSON[_0x4d9b('0xd')](_0x21b3fb));_0x5f04e6(_0x21b3fb);})[_0x4d9b('0x12')](function(_0x58bc0a){logger['error'](_0x4d9b('0x43'),_0x58bc0a[_0x4d9b('0xf')],_0x3e5d95);_0x10b1e6(_0x344ee9[_0x4d9b('0xe')](0x1f4,_0x58bc0a[_0x4d9b('0xf')]));});});}; \ No newline at end of file +var _0xd404=['name','ivrAnswerCallsDay','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CmHopperHistory','body','options','raw','CreateCmHopperHistory','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','`state`\x20=\x204,\x20`holdtime`,\x20null','AVG','predictiveIntervalAvgTalktime','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','then','GetVoiceQueueHopperHistory','GetCampaignHopperHistory'];(function(_0x975e61,_0x4815e2){var _0x4295c0=function(_0x58584b){while(--_0x58584b){_0x975e61['push'](_0x975e61['shift']());}};_0x4295c0(++_0x4815e2);}(_0xd404,0x15b));var _0x4d40=function(_0x4d3c3b,_0xd4e4ee){_0x4d3c3b=_0x4d3c3b-0x0;var _0x3983aa=_0xd404[_0x4d3c3b];return _0x3983aa;};'use strict';var _=require(_0x4d40('0x0'));var util=require(_0x4d40('0x1'));var moment=require('moment');var BPromise=require(_0x4d40('0x2'));var rs=require(_0x4d40('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4d40('0x4'))['db'];var utils=require(_0x4d40('0x5'));var logger=require(_0x4d40('0x6'))(_0x4d40('0x7'));var config=require(_0x4d40('0x8'));var jayson=require(_0x4d40('0x9'));var client=jayson[_0x4d40('0xa')][_0x4d40('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e4bd8,_0x4a635e,_0x292180){return new BPromise(function(_0x116941,_0x5a23a2){return client[_0x4d40('0xc')](_0x2e4bd8,_0x292180)['then'](function(_0x5aeb91){logger[_0x4d40('0xd')](_0x4d40('0xe'),_0x4a635e,_0x4d40('0xf'));logger[_0x4d40('0x10')](_0x4d40('0x11'),_0x4a635e,_0x4d40('0xf'),JSON[_0x4d40('0x12')](_0x5aeb91));if(_0x5aeb91[_0x4d40('0x13')]){if(_0x5aeb91[_0x4d40('0x13')][_0x4d40('0x14')]===0x1f4){logger[_0x4d40('0x13')](_0x4d40('0xe'),_0x4a635e,_0x5aeb91[_0x4d40('0x13')][_0x4d40('0x15')]);return _0x5a23a2(_0x5aeb91['error'][_0x4d40('0x15')]);}logger[_0x4d40('0x13')](_0x4d40('0xe'),_0x4a635e,_0x5aeb91[_0x4d40('0x13')][_0x4d40('0x15')]);return _0x116941(_0x5aeb91['error'][_0x4d40('0x15')]);}else{logger[_0x4d40('0xd')](_0x4d40('0xe'),_0x4a635e,_0x4d40('0xf'));_0x116941(_0x5aeb91[_0x4d40('0x16')][_0x4d40('0x15')]);}})[_0x4d40('0x17')](function(_0x43c902){logger[_0x4d40('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x4a635e,_0x43c902);_0x5a23a2(_0x43c902);});});}exports['CreateCmHopperHistory']=function(_0x1ae5c7){var _0x1c0cd8=this;return new Promise(function(_0x4e505f,_0x23b8fd){return db[_0x4d40('0x18')]['create'](_0x1ae5c7[_0x4d40('0x19')],{'raw':_0x1ae5c7['options']?_0x1ae5c7[_0x4d40('0x1a')][_0x4d40('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x57c997){logger[_0x4d40('0xd')](_0x4d40('0x1c'),_0x1ae5c7);logger['debug'](_0x4d40('0x1c'),_0x1ae5c7,JSON[_0x4d40('0x12')](_0x57c997));_0x4e505f(_0x57c997);})[_0x4d40('0x17')](function(_0x5d4c24){logger[_0x4d40('0x13')](_0x4d40('0x1c'),_0x5d4c24[_0x4d40('0x15')],_0x1ae5c7);_0x23b8fd(_0x1c0cd8['error'](0x1f4,_0x5d4c24['message']));});});};exports[_0x4d40('0x1d')]=function(_0x90b652){var _0x1285f6=this;return new Promise(function(_0x470411,_0x4677c9){return db['CmHopperHistory'][_0x4d40('0x1e')]({'raw':_0x90b652[_0x4d40('0x1a')]?_0x90b652['options']['raw']===undefined?!![]:![]:!![],'where':_0x90b652[_0x4d40('0x1a')]?_0x90b652[_0x4d40('0x1a')][_0x4d40('0x1f')]||null:null,'attributes':[[db[_0x4d40('0x20')]['fn'](_0x4d40('0x21'),db[_0x4d40('0x20')][_0x4d40('0x22')]('id')),_0x4d40('0x23')],[db[_0x4d40('0x20')]['fn'](_0x4d40('0x21'),db[_0x4d40('0x20')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x4d40('0x24')],[db[_0x4d40('0x20')]['fn'](_0x4d40('0x21'),db[_0x4d40('0x20')]['fn']('IF',db['sequelize'][_0x4d40('0x25')](_0x4d40('0x26')))),_0x4d40('0x27')],[db['sequelize']['fn'](_0x4d40('0x21'),db[_0x4d40('0x20')]['fn']('IF',db[_0x4d40('0x20')][_0x4d40('0x25')](_0x4d40('0x28')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x4d40('0x20')]['fn']('AVG',db[_0x4d40('0x20')]['fn']('IF',db[_0x4d40('0x20')][_0x4d40('0x25')](_0x4d40('0x29')))),'predictiveIntervalAvgHoldtime'],[db['sequelize']['fn'](_0x4d40('0x2a'),db[_0x4d40('0x20')]['fn']('IF',db[_0x4d40('0x20')][_0x4d40('0x25')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x4d40('0x2b')]]})['then'](function(_0x2fde16){logger[_0x4d40('0xd')](_0x4d40('0x1d'),_0x90b652);logger[_0x4d40('0x10')](_0x4d40('0x1d'),_0x90b652,JSON[_0x4d40('0x12')](_0x2fde16));_0x470411(_0x2fde16);})[_0x4d40('0x17')](function(_0x10306b){logger[_0x4d40('0x13')](_0x4d40('0x1d'),_0x10306b['message'],_0x90b652);_0x4677c9(_0x1285f6[_0x4d40('0x13')](0x1f4,_0x10306b[_0x4d40('0x15')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x5bad1c){var _0x5087e1=this;return new Promise(function(_0x246b9f,_0xcb42f6){return db['CmHopperHistory'][_0x4d40('0x1e')]({'raw':_0x5bad1c[_0x4d40('0x1a')]?_0x5bad1c[_0x4d40('0x1a')][_0x4d40('0x1b')]===undefined?!![]:![]:!![],'where':_0x5bad1c[_0x4d40('0x1a')]?_0x5bad1c['options'][_0x4d40('0x1f')]||null:null,'attributes':[[_0x4d40('0x2c'),'name'],[db['sequelize']['fn'](_0x4d40('0x21'),db[_0x4d40('0x20')]['fn']('IF',db['sequelize'][_0x4d40('0x25')](_0x4d40('0x2d')))),'outboundNoSuchCallsDay'],[db[_0x4d40('0x20')]['fn'](_0x4d40('0x21'),db['sequelize']['fn']('IF',db[_0x4d40('0x20')][_0x4d40('0x25')]('`state`\x20=\x203,\x201,\x20null'))),_0x4d40('0x2e')],[db['sequelize']['fn'](_0x4d40('0x21'),db[_0x4d40('0x20')]['fn']('IF',db[_0x4d40('0x20')][_0x4d40('0x25')](_0x4d40('0x2f')))),_0x4d40('0x30')],[db[_0x4d40('0x20')]['fn'](_0x4d40('0x21'),db[_0x4d40('0x20')]['fn']('IF',db['sequelize'][_0x4d40('0x25')](_0x4d40('0x31')))),_0x4d40('0x32')],[db[_0x4d40('0x20')]['fn'](_0x4d40('0x21'),db['sequelize']['fn']('IF',db[_0x4d40('0x20')]['literal'](_0x4d40('0x33')))),_0x4d40('0x34')],[db[_0x4d40('0x20')]['fn'](_0x4d40('0x21'),db['sequelize']['fn']('IF',db[_0x4d40('0x20')][_0x4d40('0x25')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x4d40('0x35')],[db['sequelize']['fn'](_0x4d40('0x21'),db[_0x4d40('0x20')]['fn']('IF',db[_0x4d40('0x20')][_0x4d40('0x25')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x4d40('0x36')],[db['sequelize']['fn'](_0x4d40('0x21'),db[_0x4d40('0x20')]['fn']('IF',db[_0x4d40('0x20')][_0x4d40('0x25')]('`state`\x20=\x2012,\x201,\x20null'))),_0x4d40('0x37')],[db[_0x4d40('0x20')]['fn'](_0x4d40('0x21'),db[_0x4d40('0x20')]['fn']('IF',db['sequelize'][_0x4d40('0x25')](_0x4d40('0x38')))),'outboundBlacklistCallsDay'],[db[_0x4d40('0x20')]['fn']('COUNT',db[_0x4d40('0x20')]['fn']('IF',db[_0x4d40('0x20')][_0x4d40('0x25')](_0x4d40('0x39')))),_0x4d40('0x3a')],[db[_0x4d40('0x20')]['fn'](_0x4d40('0x21'),db[_0x4d40('0x20')]['fn']('IF',db[_0x4d40('0x20')]['literal'](_0x4d40('0x3b')))),_0x4d40('0x3c')],[db[_0x4d40('0x20')]['fn'](_0x4d40('0x21'),db[_0x4d40('0x20')]['fn']('IF',db['sequelize'][_0x4d40('0x25')](_0x4d40('0x3d')))),'outboundAnswerAgiCallsDay'],[db[_0x4d40('0x20')]['fn']('COUNT',db[_0x4d40('0x20')]['fn']('IF',db[_0x4d40('0x20')][_0x4d40('0x25')]('`state`\x20=\x2020,\x201,\x20null'))),_0x4d40('0x3c')],[db[_0x4d40('0x20')]['fn'](_0x4d40('0x21'),db[_0x4d40('0x20')]['fn']('IF',db[_0x4d40('0x20')]['literal'](_0x4d40('0x3e')))),_0x4d40('0x3f')]],'group':['campaign']})[_0x4d40('0x40')](function(_0x584552){logger[_0x4d40('0xd')]('GetVoiceQueueHopperHistory',_0x5bad1c);logger[_0x4d40('0x10')](_0x4d40('0x41'),_0x5bad1c,JSON['stringify'](_0x584552));_0x246b9f(_0x584552);})[_0x4d40('0x17')](function(_0x1c930d){logger[_0x4d40('0x13')](_0x4d40('0x41'),_0x1c930d[_0x4d40('0x15')],_0x5bad1c);_0xcb42f6(_0x5087e1[_0x4d40('0x13')](0x1f4,_0x1c930d[_0x4d40('0x15')]));});});};exports[_0x4d40('0x42')]=function(_0x25e42e){var _0x217a94=this;return new Promise(function(_0x36ed10,_0x15636a){return db[_0x4d40('0x18')][_0x4d40('0x1e')]({'raw':_0x25e42e[_0x4d40('0x1a')]?_0x25e42e[_0x4d40('0x1a')][_0x4d40('0x1b')]===undefined?!![]:![]:!![],'where':_0x25e42e[_0x4d40('0x1a')]?_0x25e42e[_0x4d40('0x1a')]['where']||null:null,'attributes':[[_0x4d40('0x2c'),_0x4d40('0x43')],[db['sequelize']['fn']('COUNT',db[_0x4d40('0x20')][_0x4d40('0x22')]('id')),'ivrTotalCallsDays'],[db['sequelize']['fn'](_0x4d40('0x21'),db['sequelize']['fn']('IF',db[_0x4d40('0x20')]['literal'](_0x4d40('0x2f')))),_0x4d40('0x44')]],'group':[_0x4d40('0x2c')]})[_0x4d40('0x40')](function(_0x3fdd8d){logger['info']('GetCampaignHopperHistory',_0x25e42e);logger['debug'](_0x4d40('0x42'),_0x25e42e,JSON[_0x4d40('0x12')](_0x3fdd8d));_0x36ed10(_0x3fdd8d);})[_0x4d40('0x17')](function(_0x21a798){logger[_0x4d40('0x13')]('GetCampaignHopperHistory',_0x21a798[_0x4d40('0x15')],_0x25e42e);_0x15636a(_0x217a94['error'](0x1f4,_0x21a798[_0x4d40('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 464fc32..3c854ba 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 _0xdafb=['/describe','describe','/:id','show','put','update','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdafb,0x183));var _0xbdaf=function(_0x4cf773,_0x676271){_0x4cf773=_0x4cf773-0x0;var _0x5b327d=_0xdafb[_0x4cf773];return _0x5b327d;};'use strict';var multer=require(_0xbdaf('0x0'));var util=require(_0xbdaf('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbdaf('0x2'));var router=express[_0xbdaf('0x3')]();var fs_extra=require(_0xbdaf('0x4'));var auth=require(_0xbdaf('0x5'));var interaction=require(_0xbdaf('0x6'));var config=require(_0xbdaf('0x7'));var controller=require(_0xbdaf('0x8'));router[_0xbdaf('0x9')]('/',auth[_0xbdaf('0xa')](),controller[_0xbdaf('0xb')]);router[_0xbdaf('0x9')](_0xbdaf('0xc'),auth[_0xbdaf('0xa')](),controller[_0xbdaf('0xd')]);router['get'](_0xbdaf('0xe'),auth['isAuthenticated'](),controller[_0xbdaf('0xf')]);router['post']('/',auth[_0xbdaf('0xa')](),controller['create']);router[_0xbdaf('0x10')](_0xbdaf('0xe'),auth['isAuthenticated'](),controller[_0xbdaf('0x11')]);module[_0xbdaf('0x12')]=router; \ No newline at end of file +var _0x213d=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','exports','multer','util','connect-timeout'];(function(_0x39f1e0,_0x22de14){var _0x1b5c42=function(_0x525950){while(--_0x525950){_0x39f1e0['push'](_0x39f1e0['shift']());}};_0x1b5c42(++_0x22de14);}(_0x213d,0x18d));var _0xd213=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x213d[_0x50a0c2];return _0x5ebadd;};'use strict';var multer=require(_0xd213('0x0'));var util=require(_0xd213('0x1'));var path=require('path');var timeout=require(_0xd213('0x2'));var express=require(_0xd213('0x3'));var router=express[_0xd213('0x4')]();var fs_extra=require(_0xd213('0x5'));var auth=require(_0xd213('0x6'));var interaction=require(_0xd213('0x7'));var config=require('../../config/environment');var controller=require(_0xd213('0x8'));router[_0xd213('0x9')]('/',auth[_0xd213('0xa')](),controller['index']);router[_0xd213('0x9')](_0xd213('0xb'),auth['isAuthenticated'](),controller[_0xd213('0xc')]);router[_0xd213('0x9')](_0xd213('0xd'),auth[_0xd213('0xa')](),controller[_0xd213('0xe')]);router[_0xd213('0xf')]('/',auth[_0xd213('0xa')](),controller[_0xd213('0x10')]);router[_0xd213('0x11')](_0xd213('0xd'),auth[_0xd213('0xa')](),controller[_0xd213('0x12')]);module[_0xd213('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index a35efde..ef06c4e 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 _0xc997=['STRING','name','exports'];(function(_0x2901fd,_0x22aa89){var _0x523c43=function(_0x5045b6){while(--_0x5045b6){_0x2901fd['push'](_0x2901fd['shift']());}};_0x523c43(++_0x22aa89);}(_0xc997,0x1ac));var _0x7c99=function(_0x3f1f15,_0x4d1b5f){_0x3f1f15=_0x3f1f15-0x0;var _0xb3b928=_0xc997[_0x3f1f15];return _0xb3b928;};'use strict';var Sequelize=require('sequelize');module[_0x7c99('0x0')]={'name':{'type':Sequelize[_0x7c99('0x1')],'unique':_0x7c99('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7c99('0x1')]},'dialPrefix':{'type':Sequelize[_0x7c99('0x1')]}}; \ No newline at end of file +var _0xcca7=['STRING','name','sequelize','exports'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xcca7,0x1aa));var _0x7cca=function(_0x252723,_0x409249){_0x252723=_0x252723-0x0;var _0x614dd6=_0xcca7[_0x252723];return _0x614dd6;};'use strict';var Sequelize=require(_0x7cca('0x0'));module[_0x7cca('0x1')]={'name':{'type':Sequelize[_0x7cca('0x2')],'unique':_0x7cca('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 004c79a..e7de032 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 _0xfc4d=['redis','defaults','localhost','./cmList.socket','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','reject','save','then','get','Lists','destroy','name','send','map','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','CmList','includeAll','rows','catch','show','params','keys','rawAttributes','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ListId','getDispositions','findOne','Disposition','filter','removeDispositions','ids','CmContact','tags','isArray','join','each','omit','success','errors','message','CmCustomField','CustomFields','format','cf_%d','raw','getContacts','getContactsCsv','concat','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','transaction','Sequelize','TEXT','type','text','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0xfc4d,0x198));var _0xdfc4=function(_0x2712d5,_0x3a66fe){_0x2712d5=_0x2712d5-0x0;var _0x3b20e9=_0xfc4d[_0x2712d5];return _0x3b20e9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdfc4('0x0'));var zipdir=require(_0xdfc4('0x1'));var jsonpatch=require(_0xdfc4('0x2'));var rp=require(_0xdfc4('0x3'));var moment=require(_0xdfc4('0x4'));var BPromise=require(_0xdfc4('0x5'));var Mustache=require(_0xdfc4('0x6'));var util=require(_0xdfc4('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xdfc4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdfc4('0x9'));var _=require(_0xdfc4('0xa'));var squel=require(_0xdfc4('0xb'));var crypto=require(_0xdfc4('0xc'));var jsforce=require(_0xdfc4('0xd'));var deskjs=require(_0xdfc4('0xe'));var toCsv=require(_0xdfc4('0x8'));var querystring=require('querystring');var Papa=require(_0xdfc4('0xf'));var Redis=require(_0xdfc4('0x10'));var authService=require(_0xdfc4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xdfc4('0x12'));var hardwareService=require(_0xdfc4('0x13'));var logger=require('../../config/logger')(_0xdfc4('0x14'));var utils=require('../../config/utils');var config=require(_0xdfc4('0x15'));var licenseUtil=require(_0xdfc4('0x16'));var db=require(_0xdfc4('0x17'))['db'];config[_0xdfc4('0x18')]=_[_0xdfc4('0x19')](config[_0xdfc4('0x18')],{'host':_0xdfc4('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdfc4('0x18')]));require(_0xdfc4('0x1b'))['register'](socket);function respondWithStatusCode(_0x319b65,_0x3f33be){_0x3f33be=_0x3f33be||0xcc;return function(_0x4a05e3){if(_0x4a05e3){return _0x319b65[_0xdfc4('0x1c')](_0x3f33be);}return _0x319b65[_0xdfc4('0x1d')](_0x3f33be)[_0xdfc4('0x1e')]();};}function respondWithResult(_0x23e8c1,_0x13e752){_0x13e752=_0x13e752||0xc8;return function(_0x30493){if(_0x30493){return _0x23e8c1[_0xdfc4('0x1d')](_0x13e752)['json'](_0x30493);}};}function respondWithFilteredResult(_0xf41dda,_0x93ea63){return function(_0x40a349){if(_0x40a349){var _0x7a87bb=typeof _0x93ea63['offset']===_0xdfc4('0x1f')&&typeof _0x93ea63['limit']===_0xdfc4('0x1f');var _0x2cabca=_0x40a349[_0xdfc4('0x20')];var _0x18cee3=_0x7a87bb?0x0:_0x93ea63[_0xdfc4('0x21')];var _0x4c4b3a=_0x7a87bb?_0x40a349[_0xdfc4('0x20')]:_0x93ea63[_0xdfc4('0x21')]+_0x93ea63[_0xdfc4('0x22')];var _0x5ab39a;if(_0x4c4b3a>=_0x2cabca){_0x4c4b3a=_0x2cabca;_0x5ab39a=0xc8;}else{_0x5ab39a=0xce;}_0xf41dda[_0xdfc4('0x1d')](_0x5ab39a);return _0xf41dda[_0xdfc4('0x23')](_0xdfc4('0x24'),_0x18cee3+'-'+_0x4c4b3a+'/'+_0x2cabca)[_0xdfc4('0x25')](_0x40a349);}return null;};}function patchUpdates(_0x1a897e){return function(_0x48600d){try{jsonpatch['apply'](_0x48600d,_0x1a897e,!![]);}catch(_0x10cd58){return BPromise[_0xdfc4('0x26')](_0x10cd58);}return _0x48600d[_0xdfc4('0x27')]();};}function saveUpdates(_0x112c03,_0x328dcf){return function(_0x10499f){if(_0x10499f){return _0x10499f['update'](_0x112c03)[_0xdfc4('0x28')](function(_0x583e7a){return _0x583e7a;});}return null;};}function removeEntity(_0x449b15,_0x315615){return function(_0x6d61d5){if(_0x6d61d5){return _0x6d61d5['destroy']()['then'](function(){var _0xfb32e4=_0x6d61d5[_0xdfc4('0x29')]({'plain':!![]});var _0x53cfc9=_0xdfc4('0x2a');return db['UserProfileResource'][_0xdfc4('0x2b')]({'where':{'type':_0x53cfc9,'resourceId':_0xfb32e4['id']}})[_0xdfc4('0x28')](function(){return _0x6d61d5;});})[_0xdfc4('0x28')](function(){_0x449b15[_0xdfc4('0x1d')](0xcc)[_0xdfc4('0x1e')]();});}};}function handleEntityNotFound(_0x5c28cf,_0x375a02){return function(_0x5ec432){if(!_0x5ec432){_0x5c28cf[_0xdfc4('0x1c')](0x194);}return _0x5ec432;};}function handleError(_0x1d0fee,_0x2d3ec0){_0x2d3ec0=_0x2d3ec0||0x1f4;return function(_0x437ff6){logger['error'](_0x437ff6['stack']);if(_0x437ff6[_0xdfc4('0x2c')]){delete _0x437ff6[_0xdfc4('0x2c')];}_0x1d0fee['status'](_0x2d3ec0)[_0xdfc4('0x2d')](_0x437ff6);};}exports['index']=function(_0xce546d,_0x5bc192){var _0x303d63={},_0x2a18e0={},_0x4624ed={'count':0x0,'rows':[]};var _0x2ed8d4=_[_0xdfc4('0x2e')](db['CmList']['rawAttributes'],function(_0x48a357){return{'name':_0x48a357['fieldName'],'type':_0x48a357['type'][_0xdfc4('0x2f')]};});_0x2a18e0[_0xdfc4('0x30')]=_[_0xdfc4('0x2e')](_0x2ed8d4,'name');_0x2a18e0[_0xdfc4('0x31')]=_['keys'](_0xce546d[_0xdfc4('0x31')]);_0x2a18e0[_0xdfc4('0x32')]=_[_0xdfc4('0x33')](_0x2a18e0[_0xdfc4('0x30')],_0x2a18e0[_0xdfc4('0x31')]);_0x303d63[_0xdfc4('0x34')]=_[_0xdfc4('0x33')](_0x2a18e0[_0xdfc4('0x30')],qs[_0xdfc4('0x35')](_0xce546d['query'][_0xdfc4('0x35')]));_0x303d63[_0xdfc4('0x34')]=_0x303d63[_0xdfc4('0x34')][_0xdfc4('0x36')]?_0x303d63['attributes']:_0x2a18e0['model'];if(!_0xce546d['query'][_0xdfc4('0x37')](_0xdfc4('0x38'))){_0x303d63['limit']=qs['limit'](_0xce546d['query'][_0xdfc4('0x22')]);_0x303d63[_0xdfc4('0x21')]=qs[_0xdfc4('0x21')](_0xce546d[_0xdfc4('0x31')][_0xdfc4('0x21')]);}_0x303d63[_0xdfc4('0x39')]=qs['sort'](_0xce546d[_0xdfc4('0x31')][_0xdfc4('0x3a')]);_0x303d63[_0xdfc4('0x3b')]=qs[_0xdfc4('0x32')](_[_0xdfc4('0x3c')](_0xce546d['query'],_0x2a18e0[_0xdfc4('0x32')]),_0x2ed8d4);if(_0xce546d['query']['filter']){_0x303d63[_0xdfc4('0x3b')]=_[_0xdfc4('0x3d')](_0x303d63[_0xdfc4('0x3b')],{'$or':_['map'](_0x2ed8d4,function(_0xef9839){if(_0xef9839['type']!==_0xdfc4('0x3e')){var _0x1de17f={};_0x1de17f[_0xef9839[_0xdfc4('0x2c')]]={'$like':'%'+_0xce546d[_0xdfc4('0x31')]['filter']+'%'};return _0x1de17f;}})});}_0x303d63=_[_0xdfc4('0x3d')]({},_0x303d63,_0xce546d[_0xdfc4('0x3f')]);var _0x5488e9={'where':_0x303d63[_0xdfc4('0x3b')]};return db[_0xdfc4('0x40')][_0xdfc4('0x20')](_0x5488e9)[_0xdfc4('0x28')](function(_0x3f5aee){_0x4624ed[_0xdfc4('0x20')]=_0x3f5aee;if(_0xce546d[_0xdfc4('0x31')][_0xdfc4('0x41')]){_0x303d63['include']=[{'all':!![]}];}return db[_0xdfc4('0x40')]['findAll'](_0x303d63);})[_0xdfc4('0x28')](function(_0x553f9b){_0x4624ed[_0xdfc4('0x42')]=_0x553f9b;return _0x4624ed;})['then'](respondWithFilteredResult(_0x5bc192,_0x303d63))[_0xdfc4('0x43')](handleError(_0x5bc192,null));};exports[_0xdfc4('0x44')]=function(_0x3376f3,_0x310fe4){var _0x400a6d={'raw':![],'where':{'id':_0x3376f3[_0xdfc4('0x45')]['id']}},_0x11ac3b={};_0x11ac3b[_0xdfc4('0x30')]=_[_0xdfc4('0x46')](db[_0xdfc4('0x40')][_0xdfc4('0x47')]);_0x11ac3b[_0xdfc4('0x31')]=_[_0xdfc4('0x46')](_0x3376f3[_0xdfc4('0x31')]);_0x11ac3b[_0xdfc4('0x32')]=_[_0xdfc4('0x33')](_0x11ac3b['model'],_0x11ac3b[_0xdfc4('0x31')]);_0x400a6d[_0xdfc4('0x34')]=_[_0xdfc4('0x33')](_0x11ac3b['model'],qs['fields'](_0x3376f3[_0xdfc4('0x31')]['fields']));_0x400a6d[_0xdfc4('0x34')]=_0x400a6d['attributes'][_0xdfc4('0x36')]?_0x400a6d[_0xdfc4('0x34')]:_0x11ac3b[_0xdfc4('0x30')];if(_0x3376f3['query'][_0xdfc4('0x41')]){_0x400a6d[_0xdfc4('0x48')]=[{'all':!![]}];}_0x400a6d=_[_0xdfc4('0x3d')]({},_0x400a6d,_0x3376f3[_0xdfc4('0x3f')]);return db[_0xdfc4('0x40')][_0xdfc4('0x49')](_0x400a6d)[_0xdfc4('0x28')](handleEntityNotFound(_0x310fe4,null))[_0xdfc4('0x28')](respondWithResult(_0x310fe4,null))[_0xdfc4('0x43')](handleError(_0x310fe4,null));};exports['create']=function(_0x25cfef,_0x309eb3){return db[_0xdfc4('0x40')]['create'](_0x25cfef[_0xdfc4('0x4a')],{})['then'](function(_0x2caa6d){var _0x452315=_0x25cfef[_0xdfc4('0x4b')]['get']({'plain':!![]});if(!_0x452315)throw new Error(_0xdfc4('0x4c'));if(_0x452315[_0xdfc4('0x4d')]===_0xdfc4('0x4b')){var _0x171634=_0x2caa6d['get']({'plain':!![]});var _0x12f19b=_0xdfc4('0x2a');return db[_0xdfc4('0x4e')]['find']({'where':{'name':_0x12f19b,'userProfileId':_0x452315['userProfileId']},'raw':!![]})['then'](function(_0x538af3){if(_0x538af3&&_0x538af3[_0xdfc4('0x4f')]===0x0){return db[_0xdfc4('0x50')][_0xdfc4('0x51')]({'name':_0x171634[_0xdfc4('0x2c')],'resourceId':_0x171634['id'],'type':_0x538af3[_0xdfc4('0x2c')],'sectionId':_0x538af3['id']},{})[_0xdfc4('0x28')](function(){return _0x2caa6d;});}else{return _0x2caa6d;}})[_0xdfc4('0x43')](function(_0x2b33f3){logger[_0xdfc4('0x52')](_0xdfc4('0x53'),_0x2b33f3);throw _0x2b33f3;});}return _0x2caa6d;})[_0xdfc4('0x28')](respondWithResult(_0x309eb3,0xc9))[_0xdfc4('0x43')](handleError(_0x309eb3,null));};exports[_0xdfc4('0x54')]=function(_0x49a733,_0x11bf0b){if(_0x49a733[_0xdfc4('0x4a')]['id']){delete _0x49a733['body']['id'];}return db[_0xdfc4('0x40')][_0xdfc4('0x49')]({'where':{'id':_0x49a733[_0xdfc4('0x45')]['id']}})[_0xdfc4('0x28')](handleEntityNotFound(_0x11bf0b,null))['then'](saveUpdates(_0x49a733[_0xdfc4('0x4a')],null))['then'](respondWithResult(_0x11bf0b,null))[_0xdfc4('0x43')](handleError(_0x11bf0b,null));};exports[_0xdfc4('0x2b')]=function(_0x4deedb,_0x589b18){return db[_0xdfc4('0x40')][_0xdfc4('0x49')]({'where':{'id':_0x4deedb[_0xdfc4('0x45')]['id']}})[_0xdfc4('0x28')](handleEntityNotFound(_0x589b18,null))[_0xdfc4('0x28')](removeEntity(_0x589b18,null))[_0xdfc4('0x43')](handleError(_0x589b18,null));};exports['describe']=function(_0x151043,_0x40ea1a){return db[_0xdfc4('0x40')][_0xdfc4('0x55')]()[_0xdfc4('0x28')](respondWithResult(_0x40ea1a,null))[_0xdfc4('0x43')](handleError(_0x40ea1a,null));};exports[_0xdfc4('0x56')]=function(_0x307b45,_0x41f4ec,_0x4fcd95){if(_0x307b45[_0xdfc4('0x4a')]['id']){delete _0x307b45['body']['id'];}return db['CmList']['find']({'where':{'id':_0x307b45[_0xdfc4('0x45')]['id']}})[_0xdfc4('0x28')](handleEntityNotFound(_0x41f4ec,null))['then'](function(_0x3c45ec){if(_0x3c45ec){_0x307b45[_0xdfc4('0x4a')][_0xdfc4('0x57')]=_0x3c45ec['id'];return db['Disposition'][_0xdfc4('0x51')](_0x307b45[_0xdfc4('0x4a')]);}})[_0xdfc4('0x28')](respondWithResult(_0x41f4ec,null))[_0xdfc4('0x43')](handleError(_0x41f4ec,null));};exports[_0xdfc4('0x58')]=function(_0x35a73c,_0x3f6a01,_0x113a0f){var _0x3c483d={'raw':![],'where':{}};var _0x4a5234={};var _0x273e53={'count':0x0,'rows':[]};return db['CmList'][_0xdfc4('0x59')]({'where':{'id':_0x35a73c[_0xdfc4('0x45')]['id']}})[_0xdfc4('0x28')](handleEntityNotFound(_0x3f6a01,null))[_0xdfc4('0x28')](function(_0x54e9bd){if(_0x54e9bd){_0x4a5234[_0xdfc4('0x30')]=_['keys'](db[_0xdfc4('0x5a')][_0xdfc4('0x47')]);_0x4a5234[_0xdfc4('0x31')]=_[_0xdfc4('0x46')](_0x35a73c[_0xdfc4('0x31')]);_0x4a5234[_0xdfc4('0x32')]=_['intersection'](_0x4a5234[_0xdfc4('0x30')],_0x4a5234[_0xdfc4('0x31')]);_0x3c483d['attributes']=_[_0xdfc4('0x33')](_0x4a5234[_0xdfc4('0x30')],qs['fields'](_0x35a73c['query']['fields']));_0x3c483d[_0xdfc4('0x34')]=_0x3c483d['attributes'][_0xdfc4('0x36')]?_0x3c483d[_0xdfc4('0x34')]:_0x4a5234[_0xdfc4('0x30')];if(!_0x35a73c[_0xdfc4('0x31')]['hasOwnProperty']('nolimit')){_0x3c483d['limit']=qs[_0xdfc4('0x22')](_0x35a73c['query']['limit']);_0x3c483d[_0xdfc4('0x21')]=qs[_0xdfc4('0x21')](_0x35a73c[_0xdfc4('0x31')][_0xdfc4('0x21')]);}_0x3c483d[_0xdfc4('0x39')]=qs[_0xdfc4('0x3a')](_0x35a73c[_0xdfc4('0x31')][_0xdfc4('0x3a')]);_0x3c483d['where']=qs['filters'](_[_0xdfc4('0x3c')](_0x35a73c[_0xdfc4('0x31')],_0x4a5234[_0xdfc4('0x32')]));_0x3c483d[_0xdfc4('0x3b')][_0xdfc4('0x57')]=_0x54e9bd['id'];if(_0x35a73c[_0xdfc4('0x31')]['filter']){_0x3c483d[_0xdfc4('0x3b')]=_[_0xdfc4('0x3d')](_0x3c483d[_0xdfc4('0x3b')],{'$or':_[_0xdfc4('0x2e')](_0x3c483d[_0xdfc4('0x34')],function(_0x2e7812){var _0x2b7943={};_0x2b7943[_0x2e7812]={'$like':'%'+_0x35a73c['query'][_0xdfc4('0x5b')]+'%'};return _0x2b7943;})});}_0x3c483d=_['merge']({},_0x3c483d,_0x35a73c['options']);return db[_0xdfc4('0x5a')][_0xdfc4('0x20')]({'where':_0x3c483d[_0xdfc4('0x3b')]})[_0xdfc4('0x28')](function(_0x445f81){_0x273e53[_0xdfc4('0x20')]=_0x445f81;if(_0x35a73c[_0xdfc4('0x31')][_0xdfc4('0x41')]){_0x3c483d['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x3c483d);})[_0xdfc4('0x28')](function(_0x1df373){_0x273e53[_0xdfc4('0x42')]=_0x1df373;return _0x273e53;});}})[_0xdfc4('0x28')](respondWithFilteredResult(_0x3f6a01,_0x3c483d))[_0xdfc4('0x43')](handleError(_0x3f6a01,null));};exports[_0xdfc4('0x5c')]=function(_0x76202f,_0x23e7ea,_0x54baeb){return db[_0xdfc4('0x40')][_0xdfc4('0x49')]({'where':{'id':_0x76202f[_0xdfc4('0x45')]['id']}})['then'](handleEntityNotFound(_0x23e7ea,null))[_0xdfc4('0x28')](function(_0x321c1c){if(_0x321c1c){return _0x321c1c[_0xdfc4('0x5c')](_0x76202f[_0xdfc4('0x31')][_0xdfc4('0x5d')]);}})[_0xdfc4('0x28')](respondWithStatusCode(_0x23e7ea,null))['catch'](handleError(_0x23e7ea,null));};exports['addContacts']=function(_0x20e771,_0x24248c,_0x4a7343){return db[_0xdfc4('0x40')][_0xdfc4('0x49')]({'where':{'id':_0x20e771['params']['id']}})['then'](handleEntityNotFound(_0x24248c,null))[_0xdfc4('0x28')](function(_0x1e8238){if(_0x1e8238){var _0x27cfd9=[];var _0x5daea3={'success':[],'errors':[]};return db[_0xdfc4('0x5e')][_0xdfc4('0x55')]()['then'](function(_0x9720af){if(_0x20e771[_0xdfc4('0x4a')][_0xdfc4('0x5f')]&&_[_0xdfc4('0x60')](_0x20e771[_0xdfc4('0x4a')][_0xdfc4('0x5f')])){if(_0x20e771[_0xdfc4('0x4a')][_0xdfc4('0x5f')][_0xdfc4('0x36')]){_0x20e771['body'][_0xdfc4('0x5f')]=_0x20e771['body'][_0xdfc4('0x5f')][_0xdfc4('0x61')](';')+';';}else{_0x20e771['body'][_0xdfc4('0x5f')]=null;}}else{_0x20e771[_0xdfc4('0x4a')]['tags']=null;}if(_0x20e771['body']&&_[_0xdfc4('0x60')](_0x20e771[_0xdfc4('0x4a')])){for(var _0x2eaa9b=0x0;_0x2eaa9b<_0x20e771['body']['length'];_0x2eaa9b+=0x1){_0x20e771['body'][_0x2eaa9b]['ListId']=_0x20e771['params']['id'];_0x27cfd9['push'](_0x20e771[_0xdfc4('0x4a')][_0x2eaa9b]);}return BPromise[_0xdfc4('0x62')](_0x27cfd9,function(_0x167d17){return db[_0xdfc4('0x5e')][_0xdfc4('0x51')](_[_0xdfc4('0x63')](_0x167d17,['ids','id'])||{},{'fields':_[_0xdfc4('0x46')](_0x9720af),'raw':!![]})[_0xdfc4('0x28')](function(_0xe2399c){_0x5daea3[_0xdfc4('0x64')]['push'](_0xe2399c['dataValues']);})[_0xdfc4('0x43')](function(_0xf20671){_0x5daea3[_0xdfc4('0x65')]['push']({'data':_0x167d17,'error':_0xf20671[_0xdfc4('0x66')]});});})[_0xdfc4('0x28')](function(_0x150c44){return _0x5daea3;})['catch'](function(_0x138138){return _0x138138;});}else{_0x24248c[_0xdfc4('0x1d')](0x190)[_0xdfc4('0x25')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0xdfc4('0x28')](respondWithResult(_0x24248c,null))[_0xdfc4('0x43')](handleError(_0x24248c,null));};exports['getContacts']=function(_0x3e666d,_0x3fce44,_0x756cf7){var _0x96b88b;return db['CmList'][_0xdfc4('0x49')]({'where':{'id':_0x3e666d['params']['id']},'include':[{'model':db[_0xdfc4('0x67')],'as':_0xdfc4('0x68')}]})['then'](handleEntityNotFound(_0x3fce44,null))['then'](function(_0x310ed4){if(_0x310ed4){_0x96b88b=_0x310ed4;return db[_0xdfc4('0x5e')]['rawAttributes'];}})[_0xdfc4('0x28')](function(_0x21e9fb){if(_0x21e9fb){var _0x359598={};var _0x59b1cc={};_0x59b1cc[_0xdfc4('0x30')]=_['concat'](_[_0xdfc4('0x46')](_0x21e9fb),_[_0xdfc4('0x2e')](_0x96b88b[_0xdfc4('0x68')],function(_0xca4fc5){return util[_0xdfc4('0x69')](_0xdfc4('0x6a'),_0xca4fc5['id']);}));_0x59b1cc[_0xdfc4('0x31')]=_[_0xdfc4('0x46')](_0x3e666d[_0xdfc4('0x31')]);_0x59b1cc[_0xdfc4('0x32')]=_[_0xdfc4('0x33')](_0x59b1cc['model'],_0x59b1cc[_0xdfc4('0x31')]);_0x359598[_0xdfc4('0x34')]=_[_0xdfc4('0x33')](_0x59b1cc['model'],qs[_0xdfc4('0x35')](_0x3e666d[_0xdfc4('0x31')]['fields']));_0x359598['attributes']=_0x359598[_0xdfc4('0x34')][_0xdfc4('0x36')]?_0x359598['attributes']:_0x59b1cc['model'];if(!_0x3e666d[_0xdfc4('0x31')][_0xdfc4('0x37')](_0xdfc4('0x38'))){_0x359598[_0xdfc4('0x22')]=qs[_0xdfc4('0x22')](_0x3e666d[_0xdfc4('0x31')]['limit']);_0x359598[_0xdfc4('0x21')]=qs[_0xdfc4('0x21')](_0x3e666d[_0xdfc4('0x31')]['offset']);}_0x359598[_0xdfc4('0x39')]=qs[_0xdfc4('0x3a')](_0x3e666d[_0xdfc4('0x31')][_0xdfc4('0x3a')]);_0x359598[_0xdfc4('0x3b')]=qs[_0xdfc4('0x32')](_[_0xdfc4('0x3c')](_0x3e666d[_0xdfc4('0x31')],_0x59b1cc[_0xdfc4('0x32')]));_0x359598[_0xdfc4('0x6b')]=!![];if(_0x3e666d[_0xdfc4('0x31')][_0xdfc4('0x5b')]){_0x359598[_0xdfc4('0x3b')]=_[_0xdfc4('0x3d')](_0x359598[_0xdfc4('0x3b')],{'$or':_[_0xdfc4('0x2e')](_0x359598[_0xdfc4('0x34')],function(_0x42a828){var _0x132f06={};_0x132f06[_0x42a828]={'$like':'%'+_0x3e666d['query'][_0xdfc4('0x5b')]+'%'};return _0x132f06;})});}_0x359598=_[_0xdfc4('0x3d')]({},_0x359598,_0x3e666d[_0xdfc4('0x3f')]);return _0x96b88b[_0xdfc4('0x6c')](_0x359598);}})[_0xdfc4('0x28')](respondWithResult(_0x3fce44,null))[_0xdfc4('0x43')](handleError(_0x3fce44,null));};exports[_0xdfc4('0x6d')]=function(_0x34d871,_0x3ae187,_0x4b2966){var _0x44e8de;return db[_0xdfc4('0x40')]['find']({'where':{'id':_0x34d871[_0xdfc4('0x45')]['id']},'include':[{'model':db[_0xdfc4('0x67')],'as':'CustomFields'}]})[_0xdfc4('0x28')](handleEntityNotFound(_0x3ae187,null))['then'](function(_0xac1fc1){if(_0xac1fc1){_0x44e8de=_0xac1fc1;return db[_0xdfc4('0x5e')]['rawAttributes'];}})['then'](function(_0x11856b){if(_0x11856b){var _0x47cbe7={};var _0x1c7f40={};_0x1c7f40['model']=_[_0xdfc4('0x6e')](_[_0xdfc4('0x46')](_0x11856b),_['map'](_0x44e8de[_0xdfc4('0x68')],function(_0x3388b1){return util[_0xdfc4('0x69')](_0xdfc4('0x6a'),_0x3388b1['id']);}));_0x1c7f40[_0xdfc4('0x31')]=_['keys'](_0x34d871['query']);_0x1c7f40[_0xdfc4('0x32')]=_[_0xdfc4('0x33')](_0x1c7f40['model'],_0x1c7f40['query']);_0x47cbe7[_0xdfc4('0x34')]=_[_0xdfc4('0x33')](_0x1c7f40['model'],qs['fields'](_0x34d871[_0xdfc4('0x31')][_0xdfc4('0x35')]));_0x47cbe7['attributes']=_0x47cbe7[_0xdfc4('0x34')][_0xdfc4('0x36')]?_0x47cbe7[_0xdfc4('0x34')]:_0x1c7f40[_0xdfc4('0x30')];if(!_0x34d871['query'][_0xdfc4('0x37')]('nolimit')){_0x47cbe7[_0xdfc4('0x22')]=qs[_0xdfc4('0x22')](_0x34d871[_0xdfc4('0x31')][_0xdfc4('0x22')]);_0x47cbe7[_0xdfc4('0x21')]=qs['offset'](_0x34d871[_0xdfc4('0x31')][_0xdfc4('0x21')]);}_0x47cbe7[_0xdfc4('0x39')]=qs['sort'](_0x34d871[_0xdfc4('0x31')][_0xdfc4('0x3a')]);_0x47cbe7[_0xdfc4('0x3b')]=qs[_0xdfc4('0x32')](_[_0xdfc4('0x3c')](_0x34d871[_0xdfc4('0x31')],_0x1c7f40['filters']));_0x47cbe7['raw']=!![];if(_0x34d871[_0xdfc4('0x31')]['filter']){_0x47cbe7[_0xdfc4('0x3b')]=_['merge'](_0x47cbe7[_0xdfc4('0x3b')],{'$or':_[_0xdfc4('0x2e')](_0x47cbe7[_0xdfc4('0x34')],function(_0xca5c18){var _0x274160={};_0x274160[_0xca5c18]={'$like':'%'+_0x34d871[_0xdfc4('0x31')][_0xdfc4('0x5b')]+'%'};return _0x274160;})});}_0x47cbe7=_[_0xdfc4('0x3d')]({},_0x47cbe7,_0x34d871['options']);return _0x44e8de[_0xdfc4('0x6c')](_0x47cbe7);}})[_0xdfc4('0x28')](function(_0x39b1a3){if(!_[_0xdfc4('0x6f')](_0x39b1a3)){var _0x3b7e65=toCsv(_0x39b1a3);var _0x3ddfa0=Date[_0xdfc4('0x70')]();fs[_0xdfc4('0x71')](util[_0xdfc4('0x69')]('/tmp/list_%d_%s.csv',_0x44e8de['id'],_0x3ddfa0),_0x3b7e65);_0x3ae187[_0xdfc4('0x72')](_0xdfc4('0x73'),_0xdfc4('0x74')+util[_0xdfc4('0x69')](_0xdfc4('0x75'),_0x44e8de['id'],_0x3ddfa0));_0x3ae187[_0xdfc4('0x72')](_0xdfc4('0x76'),_0xdfc4('0x77'));return _0x3ae187[_0xdfc4('0x78')](util['format'](_0xdfc4('0x79'),_0x44e8de['id'],_0x3ddfa0));}else{return _0x3ae187[_0xdfc4('0x1c')](0xcc);}})[_0xdfc4('0x43')](handleError(_0x3ae187,null));};exports[_0xdfc4('0x7a')]=function(_0x242d60,_0x14d02f,_0x4a2c7f){var _0x516c69;delete _0x242d60['body']['id'];return db[_0xdfc4('0x40')]['findOne']({'where':{'id':_0x242d60['params']['id']}})[_0xdfc4('0x28')](handleEntityNotFound(_0x14d02f,null))[_0xdfc4('0x28')](function(_0x418a9c){if(_0x418a9c){return db[_0xdfc4('0x7b')][_0xdfc4('0x7c')](function(_0xd89898){return db[_0xdfc4('0x67')]['create'](_0x242d60[_0xdfc4('0x4a')],{'transaction':_0xd89898})[_0xdfc4('0x28')](function(_0x11ca85){_0x516c69=_0x11ca85;return _0x418a9c['addCustomFields'](_0x11ca85,{'transaction':_0xd89898});})['then'](function(){var _0x37a81d={'type':db[_0xdfc4('0x7d')][_0xdfc4('0x7e')],'transaction':_0xd89898};switch(_0x242d60[_0xdfc4('0x4a')][_0xdfc4('0x7f')]){case _0xdfc4('0x80'):_0x37a81d['type']=db[_0xdfc4('0x7d')][_0xdfc4('0x7e')];break;case _0xdfc4('0x81'):_0x37a81d[_0xdfc4('0x7f')]=db[_0xdfc4('0x7d')]['INTEGER'];break;case _0xdfc4('0x82'):_0x37a81d['type']=db['Sequelize'][_0xdfc4('0x83')];_0x37a81d[_0xdfc4('0x84')]=![];break;default:}return db[_0xdfc4('0x7b')][_0xdfc4('0x85')][_0xdfc4('0x86')]('cm_contacts',util['format'](_0xdfc4('0x87'),_0x516c69['id']),_0x37a81d);})[_0xdfc4('0x28')](function(){return _0x516c69;});});}})[_0xdfc4('0x28')](respondWithResult(_0x14d02f,null))[_0xdfc4('0x43')](handleError(_0x14d02f,null));};exports[_0xdfc4('0x88')]=function(_0x56e086,_0x4185eb,_0x587401){var _0x4857b6={};var _0x2ffdc2={};var _0x20b04a;var _0x45dc65;return db[_0xdfc4('0x40')][_0xdfc4('0x59')]({'where':{'id':_0x56e086[_0xdfc4('0x45')]['id']}})[_0xdfc4('0x28')](handleEntityNotFound(_0x4185eb,null))[_0xdfc4('0x28')](function(_0x2001e){if(_0x2001e){_0x20b04a=_0x2001e;_0x2ffdc2[_0xdfc4('0x30')]=_[_0xdfc4('0x46')](db[_0xdfc4('0x67')]['rawAttributes']);_0x2ffdc2[_0xdfc4('0x31')]=_['keys'](_0x56e086[_0xdfc4('0x31')]);_0x2ffdc2[_0xdfc4('0x32')]=_[_0xdfc4('0x33')](_0x2ffdc2[_0xdfc4('0x30')],_0x2ffdc2[_0xdfc4('0x31')]);_0x4857b6[_0xdfc4('0x34')]=_[_0xdfc4('0x33')](_0x2ffdc2['model'],qs[_0xdfc4('0x35')](_0x56e086[_0xdfc4('0x31')][_0xdfc4('0x35')]));_0x4857b6[_0xdfc4('0x34')]=_0x4857b6[_0xdfc4('0x34')][_0xdfc4('0x36')]?_0x4857b6[_0xdfc4('0x34')]:_0x2ffdc2[_0xdfc4('0x30')];_0x4857b6[_0xdfc4('0x39')]=qs[_0xdfc4('0x3a')](_0x56e086[_0xdfc4('0x31')][_0xdfc4('0x3a')]);_0x4857b6[_0xdfc4('0x3b')]=qs[_0xdfc4('0x32')](_[_0xdfc4('0x3c')](_0x56e086['query'],_0x2ffdc2[_0xdfc4('0x32')]));_0x4857b6[_0xdfc4('0x3b')]=_[_0xdfc4('0x3d')](_0x4857b6[_0xdfc4('0x3b')],{'$or':[{'ListId':_0x2001e['id']},{'ListId':null}]});if(_0x56e086[_0xdfc4('0x31')][_0xdfc4('0x5b')]){_0x4857b6[_0xdfc4('0x3b')]=_[_0xdfc4('0x3d')](_0x4857b6['where'],{'$or':_[_0xdfc4('0x2e')](_0x4857b6['attributes'],function(_0x1ae1f2){var _0x3d32a3={};_0x3d32a3[_0x1ae1f2]={'$like':'%'+_0x56e086['query'][_0xdfc4('0x5b')]+'%'};return _0x3d32a3;})});}_0x4857b6=_[_0xdfc4('0x3d')]({},_0x4857b6,_0x56e086['options']);return db['CmCustomField']['findAndCountAll'](_0x4857b6);}})['then'](respondWithResult(_0x4185eb,null))['catch'](handleError(_0x4185eb,null));};exports[_0xdfc4('0x89')]=function(_0x41afa4,_0x2610c7,_0x46420b){return db[_0xdfc4('0x40')][_0xdfc4('0x49')]({'where':{'id':_0x41afa4['params']['id']}})['then'](handleEntityNotFound(_0x2610c7,null))[_0xdfc4('0x28')](function(_0x36e532){if(_0x36e532){return _0x36e532[_0xdfc4('0x89')](_0x41afa4[_0xdfc4('0x4a')][_0xdfc4('0x5d')],_['omit'](_0x41afa4['body'],[_0xdfc4('0x5d'),'id'])||{})['spread'](function(_0x19e4b9){for(var _0x341c35=0x0;_0x341c35<_0x41afa4[_0xdfc4('0x4a')][_0xdfc4('0x5d')][_0xdfc4('0x36')];_0x341c35+=0x1){socket[_0xdfc4('0x8a')](_0xdfc4('0x8b'),{'UserId':Number(_0x41afa4[_0xdfc4('0x4a')][_0xdfc4('0x5d')][_0x341c35]),'CmListId':Number(_0x41afa4[_0xdfc4('0x45')]['id'])});}return _0x19e4b9;});}})['then'](respondWithResult(_0x2610c7,null))['catch'](handleError(_0x2610c7,null));};exports[_0xdfc4('0x8c')]=function(_0x5d28e5,_0x2581b8,_0x3e6393){return db[_0xdfc4('0x40')]['find']({'where':{'id':_0x5d28e5[_0xdfc4('0x45')]['id']}})['then'](handleEntityNotFound(_0x2581b8,null))['then'](function(_0x15dc58){if(_0x15dc58){return _0x15dc58[_0xdfc4('0x8c')](_0x5d28e5[_0xdfc4('0x31')]['ids'])[_0xdfc4('0x28')](function(){if(_[_0xdfc4('0x60')](_0x5d28e5[_0xdfc4('0x31')][_0xdfc4('0x5d')])){for(var _0x256d7e=0x0;_0x256d7e<_0x5d28e5[_0xdfc4('0x31')][_0xdfc4('0x5d')][_0xdfc4('0x36')];_0x256d7e+=0x1){socket[_0xdfc4('0x8a')](_0xdfc4('0x8d'),{'UserId':Number(_0x5d28e5['query'][_0xdfc4('0x5d')][_0x256d7e]),'CmListId':Number(_0x5d28e5[_0xdfc4('0x45')]['id'])});}}else{socket[_0xdfc4('0x8a')]('userCmList:remove',{'UserId':Number(_0x5d28e5[_0xdfc4('0x31')][_0xdfc4('0x5d')]),'CmListId':Number(_0x5d28e5[_0xdfc4('0x45')]['id'])});}});}})[_0xdfc4('0x28')](respondWithStatusCode(_0x2581b8,null))['catch'](handleError(_0x2581b8,null));};exports[_0xdfc4('0x8e')]=function(_0x194941,_0xf434f1,_0x1c4024){var _0x485a9f={};var _0x5e28b0={};var _0x20aa94;var _0x50b5eb;return db[_0xdfc4('0x40')][_0xdfc4('0x59')]({'where':{'id':_0x194941[_0xdfc4('0x45')]['id']}})[_0xdfc4('0x28')](handleEntityNotFound(_0xf434f1,null))[_0xdfc4('0x28')](function(_0x24f757){if(_0x24f757){_0x20aa94=_0x24f757;_0x5e28b0[_0xdfc4('0x30')]=_[_0xdfc4('0x46')](db[_0xdfc4('0x8f')][_0xdfc4('0x47')]);_0x5e28b0[_0xdfc4('0x31')]=_['keys'](_0x194941[_0xdfc4('0x31')]);_0x5e28b0['filters']=_[_0xdfc4('0x33')](_0x5e28b0[_0xdfc4('0x30')],_0x5e28b0[_0xdfc4('0x31')]);_0x485a9f['attributes']=_[_0xdfc4('0x33')](_0x5e28b0[_0xdfc4('0x30')],qs[_0xdfc4('0x35')](_0x194941[_0xdfc4('0x31')][_0xdfc4('0x35')]));_0x485a9f[_0xdfc4('0x34')]=_0x485a9f['attributes']['length']?_0x485a9f['attributes']:_0x5e28b0['model'];_0x485a9f[_0xdfc4('0x39')]=qs['sort'](_0x194941[_0xdfc4('0x31')][_0xdfc4('0x3a')]);_0x485a9f['where']=qs[_0xdfc4('0x32')](_[_0xdfc4('0x3c')](_0x194941[_0xdfc4('0x31')],_0x5e28b0[_0xdfc4('0x32')]));if(_0x194941[_0xdfc4('0x31')][_0xdfc4('0x5b')]){_0x485a9f[_0xdfc4('0x3b')]=_[_0xdfc4('0x3d')](_0x485a9f[_0xdfc4('0x3b')],{'$or':_[_0xdfc4('0x2e')](_0x485a9f[_0xdfc4('0x34')],function(_0x546102){var _0x21af6b={};_0x21af6b[_0x546102]={'$like':'%'+_0x194941[_0xdfc4('0x31')][_0xdfc4('0x5b')]+'%'};return _0x21af6b;})});}_0x485a9f=_[_0xdfc4('0x3d')]({},_0x485a9f,_0x194941['options']);return _0x20aa94[_0xdfc4('0x8e')](_0x485a9f);}})[_0xdfc4('0x28')](function(_0x3aa9f2){if(_0x3aa9f2){_0x50b5eb=_0x3aa9f2[_0xdfc4('0x36')];if(!_0x194941[_0xdfc4('0x31')][_0xdfc4('0x37')](_0xdfc4('0x38'))){_0x485a9f[_0xdfc4('0x22')]=qs['limit'](_0x194941['query']['limit']);_0x485a9f[_0xdfc4('0x21')]=qs[_0xdfc4('0x21')](_0x194941[_0xdfc4('0x31')]['offset']);}return _0x20aa94[_0xdfc4('0x8e')](_0x485a9f);}})[_0xdfc4('0x28')](function(_0x125c24){if(_0x125c24){return _0x125c24?{'count':_0x50b5eb,'rows':_0x125c24}:null;}})['then'](respondWithResult(_0xf434f1,null))[_0xdfc4('0x43')](handleError(_0xf434f1,null));}; \ No newline at end of file +var _0x25e0=['cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:remove','getAgents','User','eml-format','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','Lists','UserProfileResource','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','find','getDispositions','findOne','ListId','Disposition','findAll','removeDispositions','ids','addContacts','CmContact','tags','join','isArray','push','each','omit','success','dataValues','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','format','cf_%d','raw','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','/tmp/list_%d_%s.csv','sequelize','transaction','addCustomFields','Sequelize','TEXT','number','BOOLEAN','defaultValue','queryInterface','cm_contacts'];(function(_0x5a2162,_0x5a90a3){var _0x4561a7=function(_0x11849e){while(--_0x11849e){_0x5a2162['push'](_0x5a2162['shift']());}};_0x4561a7(++_0x5a90a3);}(_0x25e0,0x11f));var _0x025e=function(_0x1b0c8c,_0x486222){_0x1b0c8c=_0x1b0c8c-0x0;var _0x2e67c9=_0x25e0[_0x1b0c8c];return _0x2e67c9;};'use strict';var emlformat=require(_0x025e('0x0'));var rimraf=require(_0x025e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x025e('0x2'));var rp=require(_0x025e('0x3'));var moment=require(_0x025e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x025e('0x5'));var path=require('path');var sox=require(_0x025e('0x6'));var csv=require(_0x025e('0x7'));var ejs=require(_0x025e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x025e('0x9'));var squel=require('squel');var crypto=require(_0x025e('0xa'));var jsforce=require(_0x025e('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x025e('0xc'));var Papa=require(_0x025e('0xd'));var Redis=require(_0x025e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x025e('0xf'));var hardwareService=require(_0x025e('0x10'));var logger=require(_0x025e('0x11'))(_0x025e('0x12'));var utils=require('../../config/utils');var config=require(_0x025e('0x13'));var licenseUtil=require(_0x025e('0x14'));var db=require(_0x025e('0x15'))['db'];config[_0x025e('0x16')]=_[_0x025e('0x17')](config['redis'],{'host':_0x025e('0x18'),'port':0x18eb});var socket=require(_0x025e('0x19'))(new Redis(config[_0x025e('0x16')]));require('./cmList.socket')['register'](socket);function respondWithStatusCode(_0x36a9c3,_0x5d9d5e){_0x5d9d5e=_0x5d9d5e||0xcc;return function(_0x11094e){if(_0x11094e){return _0x36a9c3[_0x025e('0x1a')](_0x5d9d5e);}return _0x36a9c3['status'](_0x5d9d5e)[_0x025e('0x1b')]();};}function respondWithResult(_0x315f92,_0x190a59){_0x190a59=_0x190a59||0xc8;return function(_0x2446ca){if(_0x2446ca){return _0x315f92[_0x025e('0x1c')](_0x190a59)[_0x025e('0x1d')](_0x2446ca);}};}function respondWithFilteredResult(_0x23c48e,_0x39d4ba){return function(_0x234c8c){if(_0x234c8c){var _0x21c928=typeof _0x39d4ba[_0x025e('0x1e')]===_0x025e('0x1f')&&typeof _0x39d4ba['limit']==='undefined';var _0x481dd0=_0x234c8c['count'];var _0x11ea28=_0x21c928?0x0:_0x39d4ba['offset'];var _0x5b95c7=_0x21c928?_0x234c8c[_0x025e('0x20')]:_0x39d4ba[_0x025e('0x1e')]+_0x39d4ba[_0x025e('0x21')];var _0x34f588;if(_0x5b95c7>=_0x481dd0){_0x5b95c7=_0x481dd0;_0x34f588=0xc8;}else{_0x34f588=0xce;}_0x23c48e[_0x025e('0x1c')](_0x34f588);return _0x23c48e[_0x025e('0x22')](_0x025e('0x23'),_0x11ea28+'-'+_0x5b95c7+'/'+_0x481dd0)['json'](_0x234c8c);}return null;};}function patchUpdates(_0x46e468){return function(_0x3f72db){try{jsonpatch[_0x025e('0x24')](_0x3f72db,_0x46e468,!![]);}catch(_0x469938){return BPromise[_0x025e('0x25')](_0x469938);}return _0x3f72db[_0x025e('0x26')]();};}function saveUpdates(_0x564586,_0x3388b9){return function(_0x250e36){if(_0x250e36){return _0x250e36[_0x025e('0x27')](_0x564586)['then'](function(_0x4066df){return _0x4066df;});}return null;};}function removeEntity(_0x1218cc,_0x25487c){return function(_0x203e44){if(_0x203e44){return _0x203e44[_0x025e('0x28')]()[_0x025e('0x29')](function(){var _0x38ad93=_0x203e44[_0x025e('0x2a')]({'plain':!![]});var _0x35526b=_0x025e('0x2b');return db[_0x025e('0x2c')]['destroy']({'where':{'type':_0x35526b,'resourceId':_0x38ad93['id']}})[_0x025e('0x29')](function(){return _0x203e44;});})['then'](function(){_0x1218cc['status'](0xcc)[_0x025e('0x1b')]();});}};}function handleEntityNotFound(_0x45ad1d,_0x36057e){return function(_0x128e10){if(!_0x128e10){_0x45ad1d['sendStatus'](0x194);}return _0x128e10;};}function handleError(_0x49875c,_0xce02cb){_0xce02cb=_0xce02cb||0x1f4;return function(_0x265733){logger[_0x025e('0x2d')](_0x265733[_0x025e('0x2e')]);if(_0x265733[_0x025e('0x2f')]){delete _0x265733[_0x025e('0x2f')];}_0x49875c['status'](_0xce02cb)[_0x025e('0x30')](_0x265733);};}exports[_0x025e('0x31')]=function(_0x540892,_0x544cce){var _0x1159d9={},_0x331d15={},_0x3e0d90={'count':0x0,'rows':[]};var _0x22b8c7=_[_0x025e('0x32')](db[_0x025e('0x33')][_0x025e('0x34')],function(_0x53d83a){return{'name':_0x53d83a[_0x025e('0x35')],'type':_0x53d83a[_0x025e('0x36')]['key']};});_0x331d15[_0x025e('0x37')]=_[_0x025e('0x32')](_0x22b8c7,_0x025e('0x2f'));_0x331d15['query']=_[_0x025e('0x38')](_0x540892[_0x025e('0x39')]);_0x331d15[_0x025e('0x3a')]=_['intersection'](_0x331d15[_0x025e('0x37')],_0x331d15[_0x025e('0x39')]);_0x1159d9[_0x025e('0x3b')]=_[_0x025e('0x3c')](_0x331d15[_0x025e('0x37')],qs[_0x025e('0x3d')](_0x540892['query'][_0x025e('0x3d')]));_0x1159d9[_0x025e('0x3b')]=_0x1159d9['attributes'][_0x025e('0x3e')]?_0x1159d9[_0x025e('0x3b')]:_0x331d15['model'];if(!_0x540892[_0x025e('0x39')][_0x025e('0x3f')](_0x025e('0x40'))){_0x1159d9[_0x025e('0x21')]=qs[_0x025e('0x21')](_0x540892['query'][_0x025e('0x21')]);_0x1159d9[_0x025e('0x1e')]=qs[_0x025e('0x1e')](_0x540892[_0x025e('0x39')]['offset']);}_0x1159d9[_0x025e('0x41')]=qs[_0x025e('0x42')](_0x540892['query']['sort']);_0x1159d9[_0x025e('0x43')]=qs['filters'](_[_0x025e('0x44')](_0x540892[_0x025e('0x39')],_0x331d15['filters']),_0x22b8c7);if(_0x540892[_0x025e('0x39')][_0x025e('0x45')]){_0x1159d9[_0x025e('0x43')]=_[_0x025e('0x46')](_0x1159d9[_0x025e('0x43')],{'$or':_[_0x025e('0x32')](_0x22b8c7,function(_0x8150a8){if(_0x8150a8[_0x025e('0x36')]!==_0x025e('0x47')){var _0x5e98ab={};_0x5e98ab[_0x8150a8[_0x025e('0x2f')]]={'$like':'%'+_0x540892[_0x025e('0x39')][_0x025e('0x45')]+'%'};return _0x5e98ab;}})});}_0x1159d9=_[_0x025e('0x46')]({},_0x1159d9,_0x540892[_0x025e('0x48')]);var _0xd41310={'where':_0x1159d9[_0x025e('0x43')]};return db['CmList']['count'](_0xd41310)[_0x025e('0x29')](function(_0x3e4879){_0x3e0d90[_0x025e('0x20')]=_0x3e4879;if(_0x540892['query'][_0x025e('0x49')]){_0x1159d9[_0x025e('0x4a')]=[{'all':!![]}];}return db[_0x025e('0x33')]['findAll'](_0x1159d9);})[_0x025e('0x29')](function(_0x39c065){_0x3e0d90[_0x025e('0x4b')]=_0x39c065;return _0x3e0d90;})[_0x025e('0x29')](respondWithFilteredResult(_0x544cce,_0x1159d9))[_0x025e('0x4c')](handleError(_0x544cce,null));};exports[_0x025e('0x4d')]=function(_0x2c9854,_0x354a78){var _0x83c128={'raw':![],'where':{'id':_0x2c9854[_0x025e('0x4e')]['id']}},_0xdbed06={};_0xdbed06[_0x025e('0x37')]=_[_0x025e('0x38')](db[_0x025e('0x33')][_0x025e('0x34')]);_0xdbed06[_0x025e('0x39')]=_[_0x025e('0x38')](_0x2c9854[_0x025e('0x39')]);_0xdbed06['filters']=_['intersection'](_0xdbed06[_0x025e('0x37')],_0xdbed06[_0x025e('0x39')]);_0x83c128[_0x025e('0x3b')]=_[_0x025e('0x3c')](_0xdbed06[_0x025e('0x37')],qs[_0x025e('0x3d')](_0x2c9854[_0x025e('0x39')][_0x025e('0x3d')]));_0x83c128[_0x025e('0x3b')]=_0x83c128['attributes'][_0x025e('0x3e')]?_0x83c128[_0x025e('0x3b')]:_0xdbed06['model'];if(_0x2c9854[_0x025e('0x39')]['includeAll']){_0x83c128[_0x025e('0x4a')]=[{'all':!![]}];}_0x83c128=_['merge']({},_0x83c128,_0x2c9854[_0x025e('0x48')]);return db[_0x025e('0x33')]['find'](_0x83c128)[_0x025e('0x29')](handleEntityNotFound(_0x354a78,null))[_0x025e('0x29')](respondWithResult(_0x354a78,null))['catch'](handleError(_0x354a78,null));};exports[_0x025e('0x4f')]=function(_0x4a57ca,_0x335e07){return db[_0x025e('0x33')]['create'](_0x4a57ca[_0x025e('0x50')],{})[_0x025e('0x29')](function(_0x179a20){var _0x343b66=_0x4a57ca[_0x025e('0x51')]['get']({'plain':!![]});if(!_0x343b66)throw new Error(_0x025e('0x52'));if(_0x343b66[_0x025e('0x53')]===_0x025e('0x51')){var _0x3877b8=_0x179a20[_0x025e('0x2a')]({'plain':!![]});var _0x18dd78=_0x025e('0x2b');return db[_0x025e('0x54')]['find']({'where':{'name':_0x18dd78,'userProfileId':_0x343b66['userProfileId']},'raw':!![]})[_0x025e('0x29')](function(_0x2c6c01){if(_0x2c6c01&&_0x2c6c01['autoAssociation']===0x0){return db[_0x025e('0x2c')]['create']({'name':_0x3877b8[_0x025e('0x2f')],'resourceId':_0x3877b8['id'],'type':_0x2c6c01[_0x025e('0x2f')],'sectionId':_0x2c6c01['id']},{})[_0x025e('0x29')](function(){return _0x179a20;});}else{return _0x179a20;}})[_0x025e('0x4c')](function(_0x1e3529){logger[_0x025e('0x2d')](_0x025e('0x55'),_0x1e3529);throw _0x1e3529;});}return _0x179a20;})[_0x025e('0x29')](respondWithResult(_0x335e07,0xc9))[_0x025e('0x4c')](handleError(_0x335e07,null));};exports[_0x025e('0x27')]=function(_0x47ede3,_0x5509d1){if(_0x47ede3[_0x025e('0x50')]['id']){delete _0x47ede3[_0x025e('0x50')]['id'];}return db['CmList']['find']({'where':{'id':_0x47ede3[_0x025e('0x4e')]['id']}})[_0x025e('0x29')](handleEntityNotFound(_0x5509d1,null))['then'](saveUpdates(_0x47ede3['body'],null))['then'](respondWithResult(_0x5509d1,null))[_0x025e('0x4c')](handleError(_0x5509d1,null));};exports[_0x025e('0x28')]=function(_0x26b1c2,_0x29ee58){return db[_0x025e('0x33')]['find']({'where':{'id':_0x26b1c2['params']['id']}})[_0x025e('0x29')](handleEntityNotFound(_0x29ee58,null))['then'](removeEntity(_0x29ee58,null))[_0x025e('0x4c')](handleError(_0x29ee58,null));};exports[_0x025e('0x56')]=function(_0x5cf181,_0xc9ba8c){return db['CmList']['describe']()[_0x025e('0x29')](respondWithResult(_0xc9ba8c,null))[_0x025e('0x4c')](handleError(_0xc9ba8c,null));};exports['addDisposition']=function(_0x448272,_0x3cae58,_0x731084){if(_0x448272[_0x025e('0x50')]['id']){delete _0x448272[_0x025e('0x50')]['id'];}return db[_0x025e('0x33')][_0x025e('0x57')]({'where':{'id':_0x448272[_0x025e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3cae58,null))[_0x025e('0x29')](function(_0x58a44e){if(_0x58a44e){_0x448272[_0x025e('0x50')]['ListId']=_0x58a44e['id'];return db['Disposition']['create'](_0x448272[_0x025e('0x50')]);}})[_0x025e('0x29')](respondWithResult(_0x3cae58,null))[_0x025e('0x4c')](handleError(_0x3cae58,null));};exports[_0x025e('0x58')]=function(_0x2e19c6,_0x448303,_0x5190f1){var _0x3342ec={'raw':![],'where':{}};var _0x38e1e9={};var _0x9b0867={'count':0x0,'rows':[]};return db[_0x025e('0x33')][_0x025e('0x59')]({'where':{'id':_0x2e19c6[_0x025e('0x4e')]['id']}})[_0x025e('0x29')](handleEntityNotFound(_0x448303,null))[_0x025e('0x29')](function(_0x223c98){if(_0x223c98){_0x38e1e9['model']=_[_0x025e('0x38')](db['Disposition'][_0x025e('0x34')]);_0x38e1e9[_0x025e('0x39')]=_[_0x025e('0x38')](_0x2e19c6[_0x025e('0x39')]);_0x38e1e9[_0x025e('0x3a')]=_[_0x025e('0x3c')](_0x38e1e9['model'],_0x38e1e9[_0x025e('0x39')]);_0x3342ec[_0x025e('0x3b')]=_['intersection'](_0x38e1e9[_0x025e('0x37')],qs[_0x025e('0x3d')](_0x2e19c6[_0x025e('0x39')]['fields']));_0x3342ec[_0x025e('0x3b')]=_0x3342ec[_0x025e('0x3b')]['length']?_0x3342ec['attributes']:_0x38e1e9[_0x025e('0x37')];if(!_0x2e19c6[_0x025e('0x39')][_0x025e('0x3f')](_0x025e('0x40'))){_0x3342ec[_0x025e('0x21')]=qs['limit'](_0x2e19c6['query'][_0x025e('0x21')]);_0x3342ec[_0x025e('0x1e')]=qs['offset'](_0x2e19c6[_0x025e('0x39')]['offset']);}_0x3342ec[_0x025e('0x41')]=qs['sort'](_0x2e19c6[_0x025e('0x39')][_0x025e('0x42')]);_0x3342ec[_0x025e('0x43')]=qs[_0x025e('0x3a')](_['pick'](_0x2e19c6[_0x025e('0x39')],_0x38e1e9[_0x025e('0x3a')]));_0x3342ec['where'][_0x025e('0x5a')]=_0x223c98['id'];if(_0x2e19c6[_0x025e('0x39')][_0x025e('0x45')]){_0x3342ec[_0x025e('0x43')]=_[_0x025e('0x46')](_0x3342ec[_0x025e('0x43')],{'$or':_[_0x025e('0x32')](_0x3342ec[_0x025e('0x3b')],function(_0x22229b){var _0x4cd47f={};_0x4cd47f[_0x22229b]={'$like':'%'+_0x2e19c6[_0x025e('0x39')]['filter']+'%'};return _0x4cd47f;})});}_0x3342ec=_[_0x025e('0x46')]({},_0x3342ec,_0x2e19c6['options']);return db[_0x025e('0x5b')][_0x025e('0x20')]({'where':_0x3342ec[_0x025e('0x43')]})['then'](function(_0x2ef2da){_0x9b0867[_0x025e('0x20')]=_0x2ef2da;if(_0x2e19c6[_0x025e('0x39')][_0x025e('0x49')]){_0x3342ec[_0x025e('0x4a')]=[{'all':!![]}];}return db[_0x025e('0x5b')][_0x025e('0x5c')](_0x3342ec);})['then'](function(_0x514f76){_0x9b0867[_0x025e('0x4b')]=_0x514f76;return _0x9b0867;});}})[_0x025e('0x29')](respondWithFilteredResult(_0x448303,_0x3342ec))[_0x025e('0x4c')](handleError(_0x448303,null));};exports[_0x025e('0x5d')]=function(_0x3a0c9a,_0x35fe17,_0x33d344){return db[_0x025e('0x33')][_0x025e('0x57')]({'where':{'id':_0x3a0c9a[_0x025e('0x4e')]['id']}})[_0x025e('0x29')](handleEntityNotFound(_0x35fe17,null))['then'](function(_0x546885){if(_0x546885){return _0x546885[_0x025e('0x5d')](_0x3a0c9a[_0x025e('0x39')][_0x025e('0x5e')]);}})[_0x025e('0x29')](respondWithStatusCode(_0x35fe17,null))['catch'](handleError(_0x35fe17,null));};exports[_0x025e('0x5f')]=function(_0x2769ec,_0x5931af,_0x4f57ad){return db[_0x025e('0x33')][_0x025e('0x57')]({'where':{'id':_0x2769ec[_0x025e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5931af,null))['then'](function(_0x446352){if(_0x446352){var _0x2006e6=[];var _0x4a085b={'success':[],'errors':[]};return db[_0x025e('0x60')][_0x025e('0x56')]()['then'](function(_0x1fc044){if(_0x2769ec['body'][_0x025e('0x61')]&&_['isArray'](_0x2769ec[_0x025e('0x50')][_0x025e('0x61')])){if(_0x2769ec[_0x025e('0x50')]['tags'][_0x025e('0x3e')]){_0x2769ec[_0x025e('0x50')][_0x025e('0x61')]=_0x2769ec[_0x025e('0x50')][_0x025e('0x61')][_0x025e('0x62')](';')+';';}else{_0x2769ec[_0x025e('0x50')][_0x025e('0x61')]=null;}}else{_0x2769ec[_0x025e('0x50')][_0x025e('0x61')]=null;}if(_0x2769ec[_0x025e('0x50')]&&_[_0x025e('0x63')](_0x2769ec['body'])){for(var _0x3b0258=0x0;_0x3b0258<_0x2769ec['body'][_0x025e('0x3e')];_0x3b0258+=0x1){_0x2769ec[_0x025e('0x50')][_0x3b0258][_0x025e('0x5a')]=_0x2769ec['params']['id'];_0x2006e6[_0x025e('0x64')](_0x2769ec[_0x025e('0x50')][_0x3b0258]);}return BPromise[_0x025e('0x65')](_0x2006e6,function(_0x43bca7){return db[_0x025e('0x60')][_0x025e('0x4f')](_[_0x025e('0x66')](_0x43bca7,[_0x025e('0x5e'),'id'])||{},{'fields':_[_0x025e('0x38')](_0x1fc044),'raw':!![]})[_0x025e('0x29')](function(_0x5badac){_0x4a085b[_0x025e('0x67')][_0x025e('0x64')](_0x5badac[_0x025e('0x68')]);})['catch'](function(_0x2f8a9f){_0x4a085b['errors']['push']({'data':_0x43bca7,'error':_0x2f8a9f[_0x025e('0x69')]});});})['then'](function(_0x48b412){return _0x4a085b;})[_0x025e('0x4c')](function(_0x28c6fc){return _0x28c6fc;});}else{_0x5931af[_0x025e('0x1c')](0x190)[_0x025e('0x1d')]({'message':_0x025e('0x6a')});}});}})[_0x025e('0x29')](respondWithResult(_0x5931af,null))['catch'](handleError(_0x5931af,null));};exports[_0x025e('0x6b')]=function(_0x5b79e6,_0x5084a0,_0x366fe8){var _0x24563a;return db[_0x025e('0x33')][_0x025e('0x57')]({'where':{'id':_0x5b79e6[_0x025e('0x4e')]['id']},'include':[{'model':db[_0x025e('0x6c')],'as':_0x025e('0x6d')}]})[_0x025e('0x29')](handleEntityNotFound(_0x5084a0,null))[_0x025e('0x29')](function(_0x5d5710){if(_0x5d5710){_0x24563a=_0x5d5710;return db[_0x025e('0x60')][_0x025e('0x34')];}})['then'](function(_0x4af115){if(_0x4af115){var _0xff3f43={};var _0xc1ead6={};_0xc1ead6[_0x025e('0x37')]=_['concat'](_[_0x025e('0x38')](_0x4af115),_[_0x025e('0x32')](_0x24563a[_0x025e('0x6d')],function(_0x55252b){return util[_0x025e('0x6e')](_0x025e('0x6f'),_0x55252b['id']);}));_0xc1ead6[_0x025e('0x39')]=_[_0x025e('0x38')](_0x5b79e6['query']);_0xc1ead6['filters']=_[_0x025e('0x3c')](_0xc1ead6[_0x025e('0x37')],_0xc1ead6['query']);_0xff3f43[_0x025e('0x3b')]=_[_0x025e('0x3c')](_0xc1ead6[_0x025e('0x37')],qs['fields'](_0x5b79e6[_0x025e('0x39')]['fields']));_0xff3f43['attributes']=_0xff3f43[_0x025e('0x3b')][_0x025e('0x3e')]?_0xff3f43['attributes']:_0xc1ead6['model'];if(!_0x5b79e6[_0x025e('0x39')][_0x025e('0x3f')]('nolimit')){_0xff3f43[_0x025e('0x21')]=qs[_0x025e('0x21')](_0x5b79e6[_0x025e('0x39')][_0x025e('0x21')]);_0xff3f43[_0x025e('0x1e')]=qs[_0x025e('0x1e')](_0x5b79e6[_0x025e('0x39')][_0x025e('0x1e')]);}_0xff3f43[_0x025e('0x41')]=qs['sort'](_0x5b79e6[_0x025e('0x39')]['sort']);_0xff3f43[_0x025e('0x43')]=qs[_0x025e('0x3a')](_[_0x025e('0x44')](_0x5b79e6[_0x025e('0x39')],_0xc1ead6[_0x025e('0x3a')]));_0xff3f43['raw']=!![];if(_0x5b79e6['query'][_0x025e('0x45')]){_0xff3f43[_0x025e('0x43')]=_[_0x025e('0x46')](_0xff3f43['where'],{'$or':_[_0x025e('0x32')](_0xff3f43['attributes'],function(_0x3cc81e){var _0x32c04a={};_0x32c04a[_0x3cc81e]={'$like':'%'+_0x5b79e6['query'][_0x025e('0x45')]+'%'};return _0x32c04a;})});}_0xff3f43=_['merge']({},_0xff3f43,_0x5b79e6[_0x025e('0x48')]);return _0x24563a['getContacts'](_0xff3f43);}})[_0x025e('0x29')](respondWithResult(_0x5084a0,null))['catch'](handleError(_0x5084a0,null));};exports['getContactsCsv']=function(_0x42c017,_0x555f8a,_0x34cafb){var _0x395c9b;return db['CmList']['find']({'where':{'id':_0x42c017[_0x025e('0x4e')]['id']},'include':[{'model':db[_0x025e('0x6c')],'as':_0x025e('0x6d')}]})[_0x025e('0x29')](handleEntityNotFound(_0x555f8a,null))['then'](function(_0x59e508){if(_0x59e508){_0x395c9b=_0x59e508;return db[_0x025e('0x60')][_0x025e('0x34')];}})[_0x025e('0x29')](function(_0x168e63){if(_0x168e63){var _0x5a3bee={};var _0x597544={};_0x597544['model']=_['concat'](_[_0x025e('0x38')](_0x168e63),_[_0x025e('0x32')](_0x395c9b[_0x025e('0x6d')],function(_0x2367b3){return util['format'](_0x025e('0x6f'),_0x2367b3['id']);}));_0x597544[_0x025e('0x39')]=_[_0x025e('0x38')](_0x42c017[_0x025e('0x39')]);_0x597544['filters']=_[_0x025e('0x3c')](_0x597544[_0x025e('0x37')],_0x597544[_0x025e('0x39')]);_0x5a3bee['attributes']=_['intersection'](_0x597544['model'],qs[_0x025e('0x3d')](_0x42c017[_0x025e('0x39')][_0x025e('0x3d')]));_0x5a3bee[_0x025e('0x3b')]=_0x5a3bee[_0x025e('0x3b')][_0x025e('0x3e')]?_0x5a3bee[_0x025e('0x3b')]:_0x597544[_0x025e('0x37')];if(!_0x42c017['query'][_0x025e('0x3f')](_0x025e('0x40'))){_0x5a3bee[_0x025e('0x21')]=qs[_0x025e('0x21')](_0x42c017[_0x025e('0x39')][_0x025e('0x21')]);_0x5a3bee[_0x025e('0x1e')]=qs[_0x025e('0x1e')](_0x42c017[_0x025e('0x39')][_0x025e('0x1e')]);}_0x5a3bee[_0x025e('0x41')]=qs[_0x025e('0x42')](_0x42c017[_0x025e('0x39')][_0x025e('0x42')]);_0x5a3bee[_0x025e('0x43')]=qs[_0x025e('0x3a')](_[_0x025e('0x44')](_0x42c017['query'],_0x597544[_0x025e('0x3a')]));_0x5a3bee[_0x025e('0x70')]=!![];if(_0x42c017[_0x025e('0x39')]['filter']){_0x5a3bee[_0x025e('0x43')]=_['merge'](_0x5a3bee['where'],{'$or':_[_0x025e('0x32')](_0x5a3bee['attributes'],function(_0x3ad94b){var _0xad5d51={};_0xad5d51[_0x3ad94b]={'$like':'%'+_0x42c017[_0x025e('0x39')]['filter']+'%'};return _0xad5d51;})});}_0x5a3bee=_[_0x025e('0x46')]({},_0x5a3bee,_0x42c017['options']);return _0x395c9b[_0x025e('0x6b')](_0x5a3bee);}})[_0x025e('0x29')](function(_0x1bbd26){if(!_['isEmpty'](_0x1bbd26)){var _0x25d8b4=toCsv(_0x1bbd26);var _0x46b124=Date['now']();fs['writeFileSync'](util['format']('/tmp/list_%d_%s.csv',_0x395c9b['id'],_0x46b124),_0x25d8b4);_0x555f8a[_0x025e('0x71')](_0x025e('0x72'),_0x025e('0x73')+util[_0x025e('0x6e')]('list_%d_%s.csv',_0x395c9b['id'],_0x46b124));_0x555f8a['setHeader'](_0x025e('0x74'),_0x025e('0x75'));return _0x555f8a[_0x025e('0x76')](util['format'](_0x025e('0x77'),_0x395c9b['id'],_0x46b124));}else{return _0x555f8a['sendStatus'](0xcc);}})[_0x025e('0x4c')](handleError(_0x555f8a,null));};exports['addCustomField']=function(_0x44e9fe,_0x4fd7f5,_0x5f367e){var _0x41aed7;delete _0x44e9fe[_0x025e('0x50')]['id'];return db['CmList'][_0x025e('0x59')]({'where':{'id':_0x44e9fe[_0x025e('0x4e')]['id']}})[_0x025e('0x29')](handleEntityNotFound(_0x4fd7f5,null))[_0x025e('0x29')](function(_0x3dda60){if(_0x3dda60){return db[_0x025e('0x78')][_0x025e('0x79')](function(_0x2d78b7){return db['CmCustomField']['create'](_0x44e9fe[_0x025e('0x50')],{'transaction':_0x2d78b7})['then'](function(_0x1f2ee0){_0x41aed7=_0x1f2ee0;return _0x3dda60[_0x025e('0x7a')](_0x1f2ee0,{'transaction':_0x2d78b7});})[_0x025e('0x29')](function(){var _0x4e5e63={'type':db[_0x025e('0x7b')][_0x025e('0x7c')],'transaction':_0x2d78b7};switch(_0x44e9fe[_0x025e('0x50')][_0x025e('0x36')]){case'text':_0x4e5e63[_0x025e('0x36')]=db[_0x025e('0x7b')]['TEXT'];break;case _0x025e('0x7d'):_0x4e5e63[_0x025e('0x36')]=db['Sequelize']['INTEGER'];break;case'switch':_0x4e5e63[_0x025e('0x36')]=db[_0x025e('0x7b')][_0x025e('0x7e')];_0x4e5e63[_0x025e('0x7f')]=![];break;default:}return db[_0x025e('0x78')][_0x025e('0x80')]['addColumn'](_0x025e('0x81'),util[_0x025e('0x6e')](_0x025e('0x82'),_0x41aed7['id']),_0x4e5e63);})['then'](function(){return _0x41aed7;});});}})[_0x025e('0x29')](respondWithResult(_0x4fd7f5,null))['catch'](handleError(_0x4fd7f5,null));};exports[_0x025e('0x83')]=function(_0x3b0b84,_0x1f085a,_0x273332){var _0x145b62={};var _0x303eca={};var _0x37081b;var _0x18ac89;return db[_0x025e('0x33')][_0x025e('0x59')]({'where':{'id':_0x3b0b84[_0x025e('0x4e')]['id']}})[_0x025e('0x29')](handleEntityNotFound(_0x1f085a,null))[_0x025e('0x29')](function(_0x12a3e8){if(_0x12a3e8){_0x37081b=_0x12a3e8;_0x303eca[_0x025e('0x37')]=_[_0x025e('0x38')](db[_0x025e('0x6c')]['rawAttributes']);_0x303eca[_0x025e('0x39')]=_[_0x025e('0x38')](_0x3b0b84[_0x025e('0x39')]);_0x303eca[_0x025e('0x3a')]=_['intersection'](_0x303eca['model'],_0x303eca['query']);_0x145b62[_0x025e('0x3b')]=_['intersection'](_0x303eca[_0x025e('0x37')],qs[_0x025e('0x3d')](_0x3b0b84[_0x025e('0x39')]['fields']));_0x145b62['attributes']=_0x145b62[_0x025e('0x3b')][_0x025e('0x3e')]?_0x145b62[_0x025e('0x3b')]:_0x303eca['model'];_0x145b62[_0x025e('0x41')]=qs[_0x025e('0x42')](_0x3b0b84[_0x025e('0x39')][_0x025e('0x42')]);_0x145b62[_0x025e('0x43')]=qs['filters'](_[_0x025e('0x44')](_0x3b0b84[_0x025e('0x39')],_0x303eca['filters']));_0x145b62[_0x025e('0x43')]=_[_0x025e('0x46')](_0x145b62[_0x025e('0x43')],{'$or':[{'ListId':_0x12a3e8['id']},{'ListId':null}]});if(_0x3b0b84[_0x025e('0x39')][_0x025e('0x45')]){_0x145b62[_0x025e('0x43')]=_[_0x025e('0x46')](_0x145b62[_0x025e('0x43')],{'$or':_[_0x025e('0x32')](_0x145b62[_0x025e('0x3b')],function(_0xfbdfed){var _0x35a3b8={};_0x35a3b8[_0xfbdfed]={'$like':'%'+_0x3b0b84[_0x025e('0x39')][_0x025e('0x45')]+'%'};return _0x35a3b8;})});}_0x145b62=_[_0x025e('0x46')]({},_0x145b62,_0x3b0b84[_0x025e('0x48')]);return db['CmCustomField'][_0x025e('0x84')](_0x145b62);}})[_0x025e('0x29')](respondWithResult(_0x1f085a,null))['catch'](handleError(_0x1f085a,null));};exports[_0x025e('0x85')]=function(_0x103b8a,_0x6e7e90,_0x1ad644){return db[_0x025e('0x33')][_0x025e('0x57')]({'where':{'id':_0x103b8a[_0x025e('0x4e')]['id']}})[_0x025e('0x29')](handleEntityNotFound(_0x6e7e90,null))[_0x025e('0x29')](function(_0x23f4b4){if(_0x23f4b4){return _0x23f4b4['addAgents'](_0x103b8a[_0x025e('0x50')][_0x025e('0x5e')],_[_0x025e('0x66')](_0x103b8a[_0x025e('0x50')],['ids','id'])||{})[_0x025e('0x86')](function(_0x3ddaa9){for(var _0x1156d9=0x0;_0x1156d9<_0x103b8a[_0x025e('0x50')][_0x025e('0x5e')][_0x025e('0x3e')];_0x1156d9+=0x1){socket['emit']('userCmList:save',{'UserId':Number(_0x103b8a['body'][_0x025e('0x5e')][_0x1156d9]),'CmListId':Number(_0x103b8a[_0x025e('0x4e')]['id'])});}return _0x3ddaa9;});}})[_0x025e('0x29')](respondWithResult(_0x6e7e90,null))[_0x025e('0x4c')](handleError(_0x6e7e90,null));};exports['removeAgents']=function(_0x26560f,_0x14ba88,_0x3463ec){return db['CmList'][_0x025e('0x57')]({'where':{'id':_0x26560f[_0x025e('0x4e')]['id']}})[_0x025e('0x29')](handleEntityNotFound(_0x14ba88,null))[_0x025e('0x29')](function(_0x2ec203){if(_0x2ec203){return _0x2ec203['removeAgents'](_0x26560f[_0x025e('0x39')][_0x025e('0x5e')])[_0x025e('0x29')](function(){if(_['isArray'](_0x26560f[_0x025e('0x39')][_0x025e('0x5e')])){for(var _0x443008=0x0;_0x443008<_0x26560f[_0x025e('0x39')][_0x025e('0x5e')][_0x025e('0x3e')];_0x443008+=0x1){socket[_0x025e('0x87')]('userCmList:remove',{'UserId':Number(_0x26560f[_0x025e('0x39')]['ids'][_0x443008]),'CmListId':Number(_0x26560f[_0x025e('0x4e')]['id'])});}}else{socket[_0x025e('0x87')](_0x025e('0x88'),{'UserId':Number(_0x26560f[_0x025e('0x39')][_0x025e('0x5e')]),'CmListId':Number(_0x26560f[_0x025e('0x4e')]['id'])});}});}})[_0x025e('0x29')](respondWithStatusCode(_0x14ba88,null))[_0x025e('0x4c')](handleError(_0x14ba88,null));};exports[_0x025e('0x89')]=function(_0x4fc12f,_0x491e24,_0x4cb8e1){var _0x2ec828={};var _0x430557={};var _0x216eb0;var _0x563db5;return db[_0x025e('0x33')]['findOne']({'where':{'id':_0x4fc12f[_0x025e('0x4e')]['id']}})[_0x025e('0x29')](handleEntityNotFound(_0x491e24,null))['then'](function(_0x5d2e33){if(_0x5d2e33){_0x216eb0=_0x5d2e33;_0x430557[_0x025e('0x37')]=_[_0x025e('0x38')](db[_0x025e('0x8a')]['rawAttributes']);_0x430557[_0x025e('0x39')]=_[_0x025e('0x38')](_0x4fc12f[_0x025e('0x39')]);_0x430557[_0x025e('0x3a')]=_[_0x025e('0x3c')](_0x430557[_0x025e('0x37')],_0x430557[_0x025e('0x39')]);_0x2ec828[_0x025e('0x3b')]=_[_0x025e('0x3c')](_0x430557[_0x025e('0x37')],qs['fields'](_0x4fc12f[_0x025e('0x39')]['fields']));_0x2ec828['attributes']=_0x2ec828[_0x025e('0x3b')]['length']?_0x2ec828[_0x025e('0x3b')]:_0x430557[_0x025e('0x37')];_0x2ec828[_0x025e('0x41')]=qs[_0x025e('0x42')](_0x4fc12f[_0x025e('0x39')][_0x025e('0x42')]);_0x2ec828['where']=qs[_0x025e('0x3a')](_['pick'](_0x4fc12f[_0x025e('0x39')],_0x430557[_0x025e('0x3a')]));if(_0x4fc12f[_0x025e('0x39')][_0x025e('0x45')]){_0x2ec828['where']=_[_0x025e('0x46')](_0x2ec828[_0x025e('0x43')],{'$or':_[_0x025e('0x32')](_0x2ec828['attributes'],function(_0x19c1ab){var _0x21ba43={};_0x21ba43[_0x19c1ab]={'$like':'%'+_0x4fc12f['query']['filter']+'%'};return _0x21ba43;})});}_0x2ec828=_[_0x025e('0x46')]({},_0x2ec828,_0x4fc12f[_0x025e('0x48')]);return _0x216eb0['getAgents'](_0x2ec828);}})['then'](function(_0x4e2f42){if(_0x4e2f42){_0x563db5=_0x4e2f42[_0x025e('0x3e')];if(!_0x4fc12f['query'][_0x025e('0x3f')]('nolimit')){_0x2ec828[_0x025e('0x21')]=qs[_0x025e('0x21')](_0x4fc12f[_0x025e('0x39')]['limit']);_0x2ec828[_0x025e('0x1e')]=qs['offset'](_0x4fc12f[_0x025e('0x39')][_0x025e('0x1e')]);}return _0x216eb0[_0x025e('0x89')](_0x2ec828);}})[_0x025e('0x29')](function(_0x12edd7){if(_0x12edd7){return _0x12edd7?{'count':_0x563db5,'rows':_0x12edd7}:null;}})[_0x025e('0x29')](respondWithResult(_0x491e24,null))['catch'](handleError(_0x491e24,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 78c8ddd..3187c54 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x40fd71,_0x40227a){var _0x501d09=function(_0x574eef){while(--_0x574eef){_0x40fd71['push'](_0x40fd71['shift']());}};_0x501d09(++_0x40227a);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file +var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x2e68db,_0x275d04){var _0x12df4c=function(_0x1b6701){while(--_0x1b6701){_0x2e68db['push'](_0x2e68db['shift']());}};_0x12df4c(++_0x275d04);}(_0x814b,0x1a2));var _0xb814=function(_0x79cd47,_0x16102d){_0x79cd47=_0x79cd47-0x0;var _0x3b9484=_0x814b[_0x79cd47];return _0x3b9484;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index e2b84ce..3482dd2 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 _0x96cc=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists'];(function(_0x408698,_0xcbd1e8){var _0x35a9d7=function(_0x17c01a){while(--_0x17c01a){_0x408698['push'](_0x408698['shift']());}};_0x35a9d7(++_0xcbd1e8);}(_0x96cc,0x16c));var _0xc96c=function(_0x18b5fb,_0x36862b){_0x18b5fb=_0x18b5fb-0x0;var _0x56f0e2=_0x96cc[_0x18b5fb];return _0x56f0e2;};'use strict';var _=require(_0xc96c('0x0'));var util=require('util');var logger=require(_0xc96c('0x1'))('api');var moment=require(_0xc96c('0x2'));var BPromise=require(_0xc96c('0x3'));var rp=require(_0xc96c('0x4'));var fs=require('fs');var path=require(_0xc96c('0x5'));var rimraf=require(_0xc96c('0x6'));var config=require(_0xc96c('0x7'));var attributes=require(_0xc96c('0x8'));module[_0xc96c('0x9')]=function(_0x3b7f45,_0x5142cd){return _0x3b7f45[_0xc96c('0xa')](_0xc96c('0xb'),attributes,{'tableName':_0xc96c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbec5=['request-promise','path','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util','api','moment','bluebird'];(function(_0x256b08,_0x1151e2){var _0x190712=function(_0x309db4){while(--_0x309db4){_0x256b08['push'](_0x256b08['shift']());}};_0x190712(++_0x1151e2);}(_0xbec5,0xe5));var _0x5bec=function(_0x497b1e,_0x586379){_0x497b1e=_0x497b1e-0x0;var _0x3f72e1=_0xbec5[_0x497b1e];return _0x3f72e1;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var logger=require('../../config/logger')(_0x5bec('0x2'));var moment=require(_0x5bec('0x3'));var BPromise=require(_0x5bec('0x4'));var rp=require(_0x5bec('0x5'));var fs=require('fs');var path=require(_0x5bec('0x6'));var rimraf=require('rimraf');var config=require(_0x5bec('0x7'));var attributes=require(_0x5bec('0x8'));module[_0x5bec('0x9')]=function(_0x4aaac6,_0x3ed67a){return _0x4aaac6[_0x5bec('0xa')](_0x5bec('0xb'),attributes,{'tableName':_0x5bec('0xc'),'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 3dc6680..9f05f20 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 _0xe159=['info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','request','then'];(function(_0x2e3a07,_0x3b55c7){var _0x398986=function(_0x24c810){while(--_0x24c810){_0x2e3a07['push'](_0x2e3a07['shift']());}};_0x398986(++_0x3b55c7);}(_0xe159,0x192));var _0x9e15=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe159[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0x9e15('0x0'));var moment=require(_0x9e15('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e15('0x2'));var db=require(_0x9e15('0x3'))['db'];var utils=require(_0x9e15('0x4'));var logger=require(_0x9e15('0x5'))(_0x9e15('0x6'));var config=require(_0x9e15('0x7'));var jayson=require(_0x9e15('0x8'));var client=jayson[_0x9e15('0x9')][_0x9e15('0xa')]({'port':0x232a});config[_0x9e15('0xb')]=_[_0x9e15('0xc')](config[_0x9e15('0xb')],{'host':_0x9e15('0xd'),'port':0x18eb});var socket=require(_0x9e15('0xe'))(new Redis(config['redis']));require(_0x9e15('0xf'))['register'](socket);function respondWithRpcPromise(_0x30f7e5,_0x2a343b,_0x1de112){return new BPromise(function(_0x4e0504,_0x26ee2e){return client[_0x9e15('0x10')](_0x30f7e5,_0x1de112)[_0x9e15('0x11')](function(_0x3f569a){logger[_0x9e15('0x12')](_0x9e15('0x13'),_0x2a343b,_0x9e15('0x14'));logger[_0x9e15('0x15')](_0x9e15('0x16'),_0x2a343b,'request\x20sent',JSON['stringify'](_0x3f569a));if(_0x3f569a[_0x9e15('0x17')]){if(_0x3f569a[_0x9e15('0x17')][_0x9e15('0x18')]===0x1f4){logger['error'](_0x9e15('0x13'),_0x2a343b,_0x3f569a[_0x9e15('0x17')][_0x9e15('0x19')]);return _0x26ee2e(_0x3f569a[_0x9e15('0x17')][_0x9e15('0x19')]);}logger[_0x9e15('0x17')]('CmList,\x20%s,\x20%s',_0x2a343b,_0x3f569a[_0x9e15('0x17')][_0x9e15('0x19')]);return _0x4e0504(_0x3f569a[_0x9e15('0x17')]['message']);}else{logger[_0x9e15('0x12')](_0x9e15('0x13'),_0x2a343b,_0x9e15('0x14'));_0x4e0504(_0x3f569a[_0x9e15('0x1a')]['message']);}})[_0x9e15('0x1b')](function(_0x1780a9){logger[_0x9e15('0x17')](_0x9e15('0x13'),_0x2a343b,_0x1780a9);_0x26ee2e(_0x1780a9);});});} \ No newline at end of file +var _0xbbae=['error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./cmList.socket','then','info','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3e0cf2,_0x2c9df5){var _0xa2dee6=function(_0x5649d9){while(--_0x5649d9){_0x3e0cf2['push'](_0x3e0cf2['shift']());}};_0xa2dee6(++_0x2c9df5);}(_0xbbae,0xf4));var _0xebba=function(_0xe37ca8,_0x1c19b6){_0xe37ca8=_0xe37ca8-0x0;var _0xed9211=_0xbbae[_0xe37ca8];return _0xed9211;};'use strict';var _=require(_0xebba('0x0'));var util=require(_0xebba('0x1'));var moment=require(_0xebba('0x2'));var BPromise=require(_0xebba('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xebba('0x4'));var db=require(_0xebba('0x5'))['db'];var utils=require(_0xebba('0x6'));var logger=require('../../config/logger')(_0xebba('0x7'));var config=require(_0xebba('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xebba('0x9')]=_[_0xebba('0xa')](config[_0xebba('0x9')],{'host':_0xebba('0xb'),'port':0x18eb});var socket=require(_0xebba('0xc'))(new Redis(config[_0xebba('0x9')]));require(_0xebba('0xd'))['register'](socket);function respondWithRpcPromise(_0x586c60,_0x1be243,_0xbd875f){return new BPromise(function(_0x41b2ef,_0x7c49c5){return client['request'](_0x586c60,_0xbd875f)[_0xebba('0xe')](function(_0x7452ea){logger[_0xebba('0xf')](_0xebba('0x10'),_0x1be243,'request\x20sent');logger[_0xebba('0x11')](_0xebba('0x12'),_0x1be243,_0xebba('0x13'),JSON['stringify'](_0x7452ea));if(_0x7452ea[_0xebba('0x14')]){if(_0x7452ea['error'][_0xebba('0x15')]===0x1f4){logger[_0xebba('0x14')](_0xebba('0x10'),_0x1be243,_0x7452ea[_0xebba('0x14')][_0xebba('0x16')]);return _0x7c49c5(_0x7452ea[_0xebba('0x14')]['message']);}logger[_0xebba('0x14')](_0xebba('0x10'),_0x1be243,_0x7452ea[_0xebba('0x14')]['message']);return _0x41b2ef(_0x7452ea[_0xebba('0x14')][_0xebba('0x16')]);}else{logger[_0xebba('0xf')](_0xebba('0x10'),_0x1be243,'request\x20sent');_0x41b2ef(_0x7452ea['result'][_0xebba('0x16')]);}})[_0xebba('0x17')](function(_0x1bfced){logger[_0xebba('0x14')](_0xebba('0x10'),_0x1be243,_0x1bfced);_0x7c49c5(_0x1bfced);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 50c1ed3..c9363f9 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 _0x74fa=['removeListener','register','length','cmList:','./cmList.events','save','remove','update','emit'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x74fa,0x12d));var _0xa74f=function(_0x4fe816,_0x3ecb00){_0x4fe816=_0x4fe816-0x0;var _0x38b7f7=_0x74fa[_0x4fe816];return _0x38b7f7;};'use strict';var CmListEvents=require(_0xa74f('0x0'));var events=[_0xa74f('0x1'),_0xa74f('0x2'),_0xa74f('0x3')];function createListener(_0x5e7c6d,_0x31cfd6){return function(_0x5ebc92){_0x31cfd6[_0xa74f('0x4')](_0x5e7c6d,_0x5ebc92);};}function removeListener(_0x53a596,_0x4dca77){return function(){CmListEvents[_0xa74f('0x5')](_0x53a596,_0x4dca77);};}exports[_0xa74f('0x6')]=function(_0x418cc9){for(var _0x1ba26c=0x0,_0xdf4f14=events[_0xa74f('0x7')];_0x1ba26c<_0xdf4f14;_0x1ba26c++){var _0x5421b8=events[_0x1ba26c];var _0x22a0ad=createListener(_0xa74f('0x8')+_0x5421b8,_0x418cc9);CmListEvents['on'](_0x5421b8,_0x22a0ad);}}; \ No newline at end of file +var _0x977f=['save','remove','update','emit','removeListener','register'];(function(_0x570697,_0x324251){var _0x1a0dbe=function(_0x660d50){while(--_0x660d50){_0x570697['push'](_0x570697['shift']());}};_0x1a0dbe(++_0x324251);}(_0x977f,0x120));var _0xf977=function(_0x565a1d,_0x23f3b0){_0x565a1d=_0x565a1d-0x0;var _0xdcee5d=_0x977f[_0x565a1d];return _0xdcee5d;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xf977('0x0'),_0xf977('0x1'),_0xf977('0x2')];function createListener(_0x42b096,_0x301ff9){return function(_0x20b4ae){_0x301ff9[_0xf977('0x3')](_0x42b096,_0x20b4ae);};}function removeListener(_0xf7f064,_0x9c80a8){return function(){CmListEvents[_0xf977('0x4')](_0xf7f064,_0x9c80a8);};}exports[_0xf977('0x5')]=function(_0x1932ca){for(var _0x4307a1=0x0,_0x13d722=events['length'];_0x4307a1<_0x13d722;_0x4307a1++){var _0x3e621c=events[_0x4307a1];var _0x2c60c1=createListener('cmList:'+_0x3e621c,_0x1932ca);CmListEvents['on'](_0x3e621c,_0x2c60c1);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 61f03b6..473d951 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 _0xc82c=['addCustomField','/:id/users','addAgents','update','delete','destroy','removeDispositions','removeAgents','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmList.controller','isAuthenticated','index','describe','get','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','post','create','addDisposition'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0xc82c,0x1d6));var _0xcc82=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xc82c[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0xcc82('0x0'));var util=require(_0xcc82('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcc82('0x2'));var router=express[_0xcc82('0x3')]();var fs_extra=require(_0xcc82('0x4'));var auth=require(_0xcc82('0x5'));var interaction=require(_0xcc82('0x6'));var config=require('../../config/environment');var controller=require(_0xcc82('0x7'));router['get']('/',auth[_0xcc82('0x8')](),controller[_0xcc82('0x9')]);router['get']('/describe',auth[_0xcc82('0x8')](),controller[_0xcc82('0xa')]);router[_0xcc82('0xb')](_0xcc82('0xc'),auth[_0xcc82('0x8')](),controller[_0xcc82('0xd')]);router['get'](_0xcc82('0xe'),auth[_0xcc82('0x8')](),controller[_0xcc82('0xf')]);router[_0xcc82('0xb')](_0xcc82('0x10'),auth[_0xcc82('0x8')](),controller[_0xcc82('0x11')]);router[_0xcc82('0xb')](_0xcc82('0x12'),auth['isAuthenticated'](),controller[_0xcc82('0x13')]);router['get'](_0xcc82('0x14'),auth[_0xcc82('0x8')](),controller[_0xcc82('0x15')]);router[_0xcc82('0xb')]('/:id/users',auth[_0xcc82('0x8')](),controller['getAgents']);router[_0xcc82('0x16')]('/',auth['isAuthenticated'](),controller[_0xcc82('0x17')]);router[_0xcc82('0x16')](_0xcc82('0xe'),auth['isAuthenticated'](),controller[_0xcc82('0x18')]);router[_0xcc82('0x16')](_0xcc82('0x10'),auth[_0xcc82('0x8')](),controller['addContacts']);router[_0xcc82('0x16')](_0xcc82('0x14'),auth[_0xcc82('0x8')](),controller[_0xcc82('0x19')]);router[_0xcc82('0x16')](_0xcc82('0x1a'),auth[_0xcc82('0x8')](),controller[_0xcc82('0x1b')]);router['put'](_0xcc82('0xc'),auth[_0xcc82('0x8')](),controller[_0xcc82('0x1c')]);router[_0xcc82('0x1d')](_0xcc82('0xc'),auth['isAuthenticated'](),controller[_0xcc82('0x1e')]);router[_0xcc82('0x1d')](_0xcc82('0xe'),auth[_0xcc82('0x8')](),controller[_0xcc82('0x1f')]);router['delete']('/:id/users',auth[_0xcc82('0x8')](),controller[_0xcc82('0x20')]);module['exports']=router; \ No newline at end of file +var _0x1e10=['connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addContacts','addCustomField','update','delete','removeAgents','exports','path'];(function(_0x52648d,_0x5ea085){var _0x4ba6e7=function(_0x2848b0){while(--_0x2848b0){_0x52648d['push'](_0x52648d['shift']());}};_0x4ba6e7(++_0x5ea085);}(_0x1e10,0x179));var _0x01e1=function(_0x444c2b,_0x1d9920){_0x444c2b=_0x444c2b-0x0;var _0x333ed0=_0x1e10[_0x444c2b];return _0x333ed0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x01e1('0x0'));var timeout=require(_0x01e1('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x01e1('0x2'));var interaction=require(_0x01e1('0x3'));var config=require(_0x01e1('0x4'));var controller=require('./cmList.controller');router[_0x01e1('0x5')]('/',auth[_0x01e1('0x6')](),controller['index']);router['get'](_0x01e1('0x7'),auth[_0x01e1('0x6')](),controller[_0x01e1('0x8')]);router[_0x01e1('0x5')](_0x01e1('0x9'),auth['isAuthenticated'](),controller[_0x01e1('0xa')]);router['get'](_0x01e1('0xb'),auth[_0x01e1('0x6')](),controller['getDispositions']);router[_0x01e1('0x5')](_0x01e1('0xc'),auth[_0x01e1('0x6')](),controller['getContacts']);router[_0x01e1('0x5')](_0x01e1('0xd'),auth['isAuthenticated'](),controller[_0x01e1('0xe')]);router[_0x01e1('0x5')]('/:id/fields',auth['isAuthenticated'](),controller[_0x01e1('0xf')]);router[_0x01e1('0x5')](_0x01e1('0x10'),auth['isAuthenticated'](),controller[_0x01e1('0x11')]);router[_0x01e1('0x12')]('/',auth[_0x01e1('0x6')](),controller[_0x01e1('0x13')]);router[_0x01e1('0x12')](_0x01e1('0xb'),auth['isAuthenticated'](),controller[_0x01e1('0x14')]);router['post']('/:id/contacts',auth[_0x01e1('0x6')](),controller[_0x01e1('0x15')]);router['post']('/:id/fields',auth[_0x01e1('0x6')](),controller[_0x01e1('0x16')]);router[_0x01e1('0x12')](_0x01e1('0x10'),auth[_0x01e1('0x6')](),controller['addAgents']);router['put'](_0x01e1('0x9'),auth[_0x01e1('0x6')](),controller[_0x01e1('0x17')]);router[_0x01e1('0x18')](_0x01e1('0x9'),auth['isAuthenticated'](),controller['destroy']);router[_0x01e1('0x18')](_0x01e1('0xb'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x01e1('0x18')](_0x01e1('0x10'),auth[_0x01e1('0x6')](),controller[_0x01e1('0x19')]);module[_0x01e1('0x1a')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index b7e6206..df1e692 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 _0x80ec=['getDataValue','field','STRING','sequelize','exports','VIRTUAL'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x80ec,0x135));var _0xc80e=function(_0x596352,_0x1ff75a){_0x596352=_0x596352-0x0;var _0x45e47b=_0x80ec[_0x596352];return _0x45e47b;};'use strict';var Sequelize=require(_0xc80e('0x0'));module[_0xc80e('0x1')]={'name':{'type':Sequelize[_0xc80e('0x2')],'get':function(_0x4d8aed){return this[_0xc80e('0x3')](_0xc80e('0x4'));}},'field':{'type':Sequelize[_0xc80e('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0xc80e('0x5')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xa893=['getDataValue','STRING','sequelize','exports'];(function(_0x8ae5f9,_0x49ff8c){var _0x181054=function(_0x160708){while(--_0x160708){_0x8ae5f9['push'](_0x8ae5f9['shift']());}};_0x181054(++_0x49ff8c);}(_0xa893,0x7a));var _0x3a89=function(_0x3efb36,_0x2ab42e){_0x3efb36=_0x3efb36-0x0;var _0x3321bd=_0xa893[_0x3efb36];return _0x3321bd;};'use strict';var Sequelize=require(_0x3a89('0x0'));module[_0x3a89('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5a1f91){return this[_0x3a89('0x2')]('field');}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x3a89('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index a492294..4f611ac 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(_0x3408cc,_0x14f3c5){var _0x313583=function(_0x29544a){while(--_0x29544a){_0x3408cc['push'](_0x3408cc['shift']());}};_0x313583(++_0x14f3c5);}(_0x7a54,0x106));var _0x47a5=function(_0x24f0dc,_0x246d07){_0x24f0dc=_0x24f0dc-0x0;var _0x2a0a5b=_0x7a54[_0x24f0dc];return _0x2a0a5b;};'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(_0x3d3716,_0x27dbf5){var _0x14f956=function(_0x165116){while(--_0x165116){_0x3d3716['push'](_0x3d3716['shift']());}};_0x14f956(++_0x27dbf5);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 12183cd..84c7df7 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 _0x8f91=['tools_conditions','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','exports','define','Condition'];(function(_0x4dd95f,_0x5993ef){var _0x4c6990=function(_0x5a5771){while(--_0x5a5771){_0x4dd95f['push'](_0x4dd95f['shift']());}};_0x4c6990(++_0x5993ef);}(_0x8f91,0x12d));var _0x18f9=function(_0x5b263d,_0x86845c){_0x5b263d=_0x5b263d-0x0;var _0x40d203=_0x8f91[_0x5b263d];return _0x40d203;};'use strict';var _=require(_0x18f9('0x0'));var util=require(_0x18f9('0x1'));var logger=require(_0x18f9('0x2'))(_0x18f9('0x3'));var moment=require(_0x18f9('0x4'));var BPromise=require('bluebird');var rp=require(_0x18f9('0x5'));var fs=require('fs');var path=require(_0x18f9('0x6'));var rimraf=require('rimraf');var config=require(_0x18f9('0x7'));var attributes=require('./condition.attributes');module[_0x18f9('0x8')]=function(_0x472e65,_0xa52c76){return _0x472e65[_0x18f9('0x9')](_0x18f9('0xa'),attributes,{'tableName':_0x18f9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x93aa=['../../config/environment','./condition.attributes','exports','define','Condition','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x235f0f,_0x227cde){var _0x5a7946=function(_0x59b85c){while(--_0x59b85c){_0x235f0f['push'](_0x235f0f['shift']());}};_0x5a7946(++_0x227cde);}(_0x93aa,0x1a7));var _0xa93a=function(_0x1a3243,_0x48d1a1){_0x1a3243=_0x1a3243-0x0;var _0x103bec=_0x93aa[_0x1a3243];return _0x103bec;};'use strict';var _=require('lodash');var util=require(_0xa93a('0x0'));var logger=require(_0xa93a('0x1'))('api');var moment=require(_0xa93a('0x2'));var BPromise=require(_0xa93a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa93a('0x4'));var rimraf=require(_0xa93a('0x5'));var config=require(_0xa93a('0x6'));var attributes=require(_0xa93a('0x7'));module[_0xa93a('0x8')]=function(_0x3d2c3c,_0x350354){return _0x3d2c3c[_0xa93a('0x9')](_0xa93a('0xa'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index a3ed8fd..00ac0de 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 _0xd783=['message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','Condition,\x20%s,\x20%s'];(function(_0xe2ead6,_0x579dec){var _0x392c2b=function(_0x16209e){while(--_0x16209e){_0xe2ead6['push'](_0xe2ead6['shift']());}};_0x392c2b(++_0x579dec);}(_0xd783,0x12d));var _0x3d78=function(_0x1cd585,_0x54276b){_0x1cd585=_0x1cd585-0x0;var _0x3ca87f=_0xd783[_0x1cd585];return _0x3ca87f;};'use strict';var _=require(_0x3d78('0x0'));var util=require(_0x3d78('0x1'));var moment=require(_0x3d78('0x2'));var BPromise=require(_0x3d78('0x3'));var rs=require(_0x3d78('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3d78('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3d78('0x6'));var config=require(_0x3d78('0x7'));var jayson=require(_0x3d78('0x8'));var client=jayson[_0x3d78('0x9')][_0x3d78('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x826b1b,_0x223aca,_0x219d89){return new BPromise(function(_0x13afda,_0x1e767f){return client[_0x3d78('0xb')](_0x826b1b,_0x219d89)[_0x3d78('0xc')](function(_0x38ae5d){logger[_0x3d78('0xd')]('Condition,\x20%s,\x20%s',_0x223aca,_0x3d78('0xe'));logger[_0x3d78('0xf')](_0x3d78('0x10'),_0x223aca,_0x3d78('0xe'),JSON[_0x3d78('0x11')](_0x38ae5d));if(_0x38ae5d[_0x3d78('0x12')]){if(_0x38ae5d[_0x3d78('0x12')][_0x3d78('0x13')]===0x1f4){logger[_0x3d78('0x12')](_0x3d78('0x14'),_0x223aca,_0x38ae5d[_0x3d78('0x12')]['message']);return _0x1e767f(_0x38ae5d[_0x3d78('0x12')][_0x3d78('0x15')]);}logger[_0x3d78('0x12')]('Condition,\x20%s,\x20%s',_0x223aca,_0x38ae5d[_0x3d78('0x12')][_0x3d78('0x15')]);return _0x13afda(_0x38ae5d[_0x3d78('0x12')]['message']);}else{logger[_0x3d78('0xd')](_0x3d78('0x14'),_0x223aca,'request\x20sent');_0x13afda(_0x38ae5d['result'][_0x3d78('0x15')]);}})[_0x3d78('0x16')](function(_0x3bd5bf){logger[_0x3d78('0x12')](_0x3d78('0x14'),_0x223aca,_0x3bd5bf);_0x1e767f(_0x3bd5bf);});});} \ No newline at end of file +var _0xaa3d=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x2f6c38,_0x4b067a){var _0x66279f=function(_0x13c4b5){while(--_0x13c4b5){_0x2f6c38['push'](_0x2f6c38['shift']());}};_0x66279f(++_0x4b067a);}(_0xaa3d,0x17c));var _0xdaa3=function(_0x13da79,_0x314884){_0x13da79=_0x13da79-0x0;var _0x335de1=_0xaa3d[_0x13da79];return _0x335de1;};'use strict';var _=require(_0xdaa3('0x0'));var util=require('util');var moment=require(_0xdaa3('0x1'));var BPromise=require(_0xdaa3('0x2'));var rs=require(_0xdaa3('0x3'));var fs=require('fs');var Redis=require(_0xdaa3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdaa3('0x5'));var logger=require(_0xdaa3('0x6'))('rpc');var config=require(_0xdaa3('0x7'));var jayson=require(_0xdaa3('0x8'));var client=jayson[_0xdaa3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5900d9,_0x4353da,_0x32532d){return new BPromise(function(_0x4d19d4,_0x2339a3){return client[_0xdaa3('0xa')](_0x5900d9,_0x32532d)[_0xdaa3('0xb')](function(_0x3adc79){logger[_0xdaa3('0xc')](_0xdaa3('0xd'),_0x4353da,_0xdaa3('0xe'));logger['debug'](_0xdaa3('0xf'),_0x4353da,'request\x20sent',JSON[_0xdaa3('0x10')](_0x3adc79));if(_0x3adc79[_0xdaa3('0x11')]){if(_0x3adc79['error']['code']===0x1f4){logger[_0xdaa3('0x11')](_0xdaa3('0xd'),_0x4353da,_0x3adc79[_0xdaa3('0x11')]['message']);return _0x2339a3(_0x3adc79[_0xdaa3('0x11')][_0xdaa3('0x12')]);}logger[_0xdaa3('0x11')]('Condition,\x20%s,\x20%s',_0x4353da,_0x3adc79[_0xdaa3('0x11')][_0xdaa3('0x12')]);return _0x4d19d4(_0x3adc79[_0xdaa3('0x11')][_0xdaa3('0x12')]);}else{logger['info']('Condition,\x20%s,\x20%s',_0x4353da,_0xdaa3('0xe'));_0x4d19d4(_0x3adc79[_0xdaa3('0x13')][_0xdaa3('0x12')]);}})[_0xdaa3('0x14')](function(_0x3a2ab8){logger[_0xdaa3('0x11')]('Condition,\x20%s,\x20%s',_0x4353da,_0x3a2ab8);_0x2339a3(_0x3a2ab8);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index fcea542..43becbd 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 _0x8ad4=['fs-extra','../../components/auth/service','../../config/environment','put','/:id','isAuthenticated','update','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x4c3b50,_0x471aee){var _0x40dc4c=function(_0xf4775d){while(--_0xf4775d){_0x4c3b50['push'](_0x4c3b50['shift']());}};_0x40dc4c(++_0x471aee);}(_0x8ad4,0x126));var _0x48ad=function(_0x3b6848,_0x4d6c0d){_0x3b6848=_0x3b6848-0x0;var _0x13b0f6=_0x8ad4[_0x3b6848];return _0x13b0f6;};'use strict';var multer=require(_0x48ad('0x0'));var util=require(_0x48ad('0x1'));var path=require(_0x48ad('0x2'));var timeout=require(_0x48ad('0x3'));var express=require(_0x48ad('0x4'));var router=express[_0x48ad('0x5')]();var fs_extra=require(_0x48ad('0x6'));var auth=require(_0x48ad('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x48ad('0x8'));var controller=require('./condition.controller');router[_0x48ad('0x9')](_0x48ad('0xa'),auth[_0x48ad('0xb')](),controller[_0x48ad('0xc')]);router[_0x48ad('0xd')](_0x48ad('0xa'),auth[_0x48ad('0xb')](),controller[_0x48ad('0xe')]);module['exports']=router; \ No newline at end of file +var _0x19aa=['put','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','./condition.controller'];(function(_0xbb5c0e,_0x4b388f){var _0x1ed9d8=function(_0x20a530){while(--_0x20a530){_0xbb5c0e['push'](_0xbb5c0e['shift']());}};_0x1ed9d8(++_0x4b388f);}(_0x19aa,0xca));var _0xa19a=function(_0x415415,_0x290fc7){_0x415415=_0x415415-0x0;var _0x211d04=_0x19aa[_0x415415];return _0x211d04;};'use strict';var multer=require(_0xa19a('0x0'));var util=require(_0xa19a('0x1'));var path=require(_0xa19a('0x2'));var timeout=require('connect-timeout');var express=require(_0xa19a('0x3'));var router=express[_0xa19a('0x4')]();var fs_extra=require(_0xa19a('0x5'));var auth=require(_0xa19a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa19a('0x7'));router[_0xa19a('0x8')](_0xa19a('0x9'),auth[_0xa19a('0xa')](),controller[_0xa19a('0xb')]);router[_0xa19a('0xc')]('/:id',auth[_0xa19a('0xa')](),controller[_0xa19a('0xd')]);module[_0xa19a('0xe')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 50921f7..2b9d9d6 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['name','exports','STRING'];(function(_0x17ad08,_0x24779f){var _0x32a561=function(_0x590766){while(--_0x590766){_0x17ad08['push'](_0x17ad08['shift']());}};_0x32a561(++_0x24779f);}(_0x2032,0xd9));var _0x2203=function(_0x2658b8,_0x56295b){_0x2658b8=_0x2658b8-0x0;var _0x276206=_0x2032[_0x2658b8];return _0x276206;};'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(_0xed437e,_0x1d08ee){var _0xea4d38=function(_0x5d9f03){while(--_0x5d9f03){_0xed437e['push'](_0xed437e['shift']());}};_0xea4d38(++_0x1d08ee);}(_0xb10b,0x12a));var _0xbb10=function(_0x337d97,_0x19c381){_0x337d97=_0x337d97-0x0;var _0x53aa89=_0xb10b[_0x337d97];return _0x53aa89;};'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/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index be18722..02a5719 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 _0x8ecd=['show','params','keys','rawAttributes','length','include','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','omit','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','type','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','nolimit','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./dashboard.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','map','Dashboard','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch'];(function(_0x73350e,_0x3bbeb2){var _0x1a93e1=function(_0x4b5f18){while(--_0x4b5f18){_0x73350e['push'](_0x73350e['shift']());}};_0x1a93e1(++_0x3bbeb2);}(_0x8ecd,0xbb));var _0xd8ec=function(_0x2eb828,_0x5b4396){_0x2eb828=_0x2eb828-0x0;var _0xdb47b7=_0x8ecd[_0x2eb828];return _0xdb47b7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd8ec('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd8ec('0x1'));var rp=require(_0xd8ec('0x2'));var moment=require('moment');var BPromise=require(_0xd8ec('0x3'));var Mustache=require('mustache');var util=require(_0xd8ec('0x4'));var path=require(_0xd8ec('0x5'));var sox=require(_0xd8ec('0x6'));var csv=require(_0xd8ec('0x7'));var ejs=require(_0xd8ec('0x8'));var fs=require('fs');var fs_extra=require(_0xd8ec('0x9'));var _=require(_0xd8ec('0xa'));var squel=require(_0xd8ec('0xb'));var crypto=require('crypto');var jsforce=require(_0xd8ec('0xc'));var deskjs=require(_0xd8ec('0xd'));var toCsv=require(_0xd8ec('0x7'));var querystring=require(_0xd8ec('0xe'));var Papa=require(_0xd8ec('0xf'));var Redis=require(_0xd8ec('0x10'));var authService=require(_0xd8ec('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd8ec('0x12'));var logger=require(_0xd8ec('0x13'))(_0xd8ec('0x14'));var utils=require(_0xd8ec('0x15'));var config=require(_0xd8ec('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd8ec('0x17'))['db'];config[_0xd8ec('0x18')]=_['defaults'](config['redis'],{'host':_0xd8ec('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd8ec('0x1a'))[_0xd8ec('0x1b')](socket);function respondWithStatusCode(_0x197c53,_0x5ab940){_0x5ab940=_0x5ab940||0xcc;return function(_0x3f9be2){if(_0x3f9be2){return _0x197c53[_0xd8ec('0x1c')](_0x5ab940);}return _0x197c53[_0xd8ec('0x1d')](_0x5ab940)[_0xd8ec('0x1e')]();};}function respondWithResult(_0x28d0f9,_0x148d1a){_0x148d1a=_0x148d1a||0xc8;return function(_0x408f96){if(_0x408f96){return _0x28d0f9[_0xd8ec('0x1d')](_0x148d1a)[_0xd8ec('0x1f')](_0x408f96);}};}function respondWithFilteredResult(_0x13634d,_0x180f66){return function(_0x4d2853){if(_0x4d2853){var _0x4e0c51=typeof _0x180f66[_0xd8ec('0x20')]===_0xd8ec('0x21')&&typeof _0x180f66['limit']===_0xd8ec('0x21');var _0x260c7c=_0x4d2853[_0xd8ec('0x22')];var _0x1c3d85=_0x4e0c51?0x0:_0x180f66[_0xd8ec('0x20')];var _0x2e5386=_0x4e0c51?_0x4d2853['count']:_0x180f66[_0xd8ec('0x20')]+_0x180f66[_0xd8ec('0x23')];var _0x231e16;if(_0x2e5386>=_0x260c7c){_0x2e5386=_0x260c7c;_0x231e16=0xc8;}else{_0x231e16=0xce;}_0x13634d[_0xd8ec('0x1d')](_0x231e16);return _0x13634d[_0xd8ec('0x24')]('Content-Range',_0x1c3d85+'-'+_0x2e5386+'/'+_0x260c7c)[_0xd8ec('0x1f')](_0x4d2853);}return null;};}function patchUpdates(_0xa49d33){return function(_0x578025){try{jsonpatch[_0xd8ec('0x25')](_0x578025,_0xa49d33,!![]);}catch(_0x12c848){return BPromise[_0xd8ec('0x26')](_0x12c848);}return _0x578025[_0xd8ec('0x27')]();};}function saveUpdates(_0x2b41d5,_0x15d240){return function(_0x4b8f02){if(_0x4b8f02){return _0x4b8f02[_0xd8ec('0x28')](_0x2b41d5)[_0xd8ec('0x29')](function(_0x2055bd){return _0x2055bd;});}return null;};}function removeEntity(_0x211a10,_0x472dee){return function(_0x13e6d5){if(_0x13e6d5){return _0x13e6d5[_0xd8ec('0x2a')]()[_0xd8ec('0x29')](function(){var _0x872ec4=_0x13e6d5[_0xd8ec('0x2b')]({'plain':!![]});var _0x382378=_0xd8ec('0x2c');return db[_0xd8ec('0x2d')][_0xd8ec('0x2a')]({'where':{'type':_0x382378,'resourceId':_0x872ec4['id']}})[_0xd8ec('0x29')](function(){return _0x13e6d5;});})['then'](function(){_0x211a10[_0xd8ec('0x1d')](0xcc)[_0xd8ec('0x1e')]();});}};}function handleEntityNotFound(_0x26158b,_0x5ee8cf){return function(_0x52bb77){if(!_0x52bb77){_0x26158b[_0xd8ec('0x1c')](0x194);}return _0x52bb77;};}function handleError(_0x152af5,_0x360a84){_0x360a84=_0x360a84||0x1f4;return function(_0x418ca1){logger[_0xd8ec('0x2e')](_0x418ca1[_0xd8ec('0x2f')]);if(_0x418ca1[_0xd8ec('0x30')]){delete _0x418ca1['name'];}_0x152af5[_0xd8ec('0x1d')](_0x360a84)[_0xd8ec('0x31')](_0x418ca1);};}exports[_0xd8ec('0x32')]=function(_0x44e3bd,_0x2bb157){var _0x979b14={},_0x332cc4={},_0x1db8a9={'count':0x0,'rows':[]};var _0x1dd5ed=_[_0xd8ec('0x33')](db[_0xd8ec('0x34')]['rawAttributes'],function(_0x415c81){return{'name':_0x415c81['fieldName'],'type':_0x415c81['type'][_0xd8ec('0x35')]};});_0x332cc4['model']=_['map'](_0x1dd5ed,_0xd8ec('0x30'));_0x332cc4['query']=_['keys'](_0x44e3bd[_0xd8ec('0x36')]);_0x332cc4[_0xd8ec('0x37')]=_[_0xd8ec('0x38')](_0x332cc4[_0xd8ec('0x39')],_0x332cc4[_0xd8ec('0x36')]);_0x979b14['attributes']=_[_0xd8ec('0x38')](_0x332cc4[_0xd8ec('0x39')],qs[_0xd8ec('0x3a')](_0x44e3bd['query'][_0xd8ec('0x3a')]));_0x979b14[_0xd8ec('0x3b')]=_0x979b14[_0xd8ec('0x3b')]['length']?_0x979b14[_0xd8ec('0x3b')]:_0x332cc4[_0xd8ec('0x39')];if(!_0x44e3bd[_0xd8ec('0x36')][_0xd8ec('0x3c')]('nolimit')){_0x979b14[_0xd8ec('0x23')]=qs['limit'](_0x44e3bd['query'][_0xd8ec('0x23')]);_0x979b14['offset']=qs[_0xd8ec('0x20')](_0x44e3bd[_0xd8ec('0x36')]['offset']);}_0x979b14[_0xd8ec('0x3d')]=qs[_0xd8ec('0x3e')](_0x44e3bd[_0xd8ec('0x36')][_0xd8ec('0x3e')]);_0x979b14[_0xd8ec('0x3f')]=qs[_0xd8ec('0x37')](_[_0xd8ec('0x40')](_0x44e3bd[_0xd8ec('0x36')],_0x332cc4[_0xd8ec('0x37')]),_0x1dd5ed);if(_0x44e3bd[_0xd8ec('0x36')][_0xd8ec('0x41')]){_0x979b14['where']=_[_0xd8ec('0x42')](_0x979b14[_0xd8ec('0x3f')],{'$or':_['map'](_0x1dd5ed,function(_0x4dbe9d){if(_0x4dbe9d['type']!==_0xd8ec('0x43')){var _0x4aa47d={};_0x4aa47d[_0x4dbe9d[_0xd8ec('0x30')]]={'$like':'%'+_0x44e3bd['query'][_0xd8ec('0x41')]+'%'};return _0x4aa47d;}})});}_0x979b14=_[_0xd8ec('0x42')]({},_0x979b14,_0x44e3bd[_0xd8ec('0x44')]);var _0x537a32={'where':_0x979b14[_0xd8ec('0x3f')]};return db['Dashboard'][_0xd8ec('0x22')](_0x537a32)[_0xd8ec('0x29')](function(_0x4f7e44){_0x1db8a9['count']=_0x4f7e44;if(_0x44e3bd[_0xd8ec('0x36')][_0xd8ec('0x45')]){_0x979b14['include']=[{'all':!![]}];}return db[_0xd8ec('0x34')][_0xd8ec('0x46')](_0x979b14);})[_0xd8ec('0x29')](function(_0x44ee12){_0x1db8a9[_0xd8ec('0x47')]=_0x44ee12;return _0x1db8a9;})[_0xd8ec('0x29')](respondWithFilteredResult(_0x2bb157,_0x979b14))[_0xd8ec('0x48')](handleError(_0x2bb157,null));};exports[_0xd8ec('0x49')]=function(_0x5bef38,_0x280642){var _0x55251f={'raw':![],'where':{'id':_0x5bef38[_0xd8ec('0x4a')]['id']}},_0x5c19ff={};_0x5c19ff[_0xd8ec('0x39')]=_[_0xd8ec('0x4b')](db[_0xd8ec('0x34')][_0xd8ec('0x4c')]);_0x5c19ff[_0xd8ec('0x36')]=_[_0xd8ec('0x4b')](_0x5bef38[_0xd8ec('0x36')]);_0x5c19ff['filters']=_[_0xd8ec('0x38')](_0x5c19ff[_0xd8ec('0x39')],_0x5c19ff[_0xd8ec('0x36')]);_0x55251f[_0xd8ec('0x3b')]=_[_0xd8ec('0x38')](_0x5c19ff['model'],qs[_0xd8ec('0x3a')](_0x5bef38['query'][_0xd8ec('0x3a')]));_0x55251f[_0xd8ec('0x3b')]=_0x55251f[_0xd8ec('0x3b')][_0xd8ec('0x4d')]?_0x55251f['attributes']:_0x5c19ff['model'];if(_0x5bef38['query'][_0xd8ec('0x45')]){_0x55251f[_0xd8ec('0x4e')]=[{'all':!![]}];}_0x55251f=_[_0xd8ec('0x42')]({},_0x55251f,_0x5bef38[_0xd8ec('0x44')]);return db[_0xd8ec('0x34')]['find'](_0x55251f)[_0xd8ec('0x29')](handleEntityNotFound(_0x280642,null))[_0xd8ec('0x29')](respondWithResult(_0x280642,null))[_0xd8ec('0x48')](handleError(_0x280642,null));};exports[_0xd8ec('0x4f')]=function(_0x5ba466,_0x4047c1){return db[_0xd8ec('0x34')]['create'](_0x5ba466[_0xd8ec('0x50')],{})[_0xd8ec('0x29')](function(_0x120406){var _0x1883c2=_0x5ba466[_0xd8ec('0x51')][_0xd8ec('0x2b')]({'plain':!![]});if(!_0x1883c2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1883c2[_0xd8ec('0x52')]===_0xd8ec('0x51')){var _0x14d9f1=_0x120406[_0xd8ec('0x2b')]({'plain':!![]});var _0x3c0c0d=_0xd8ec('0x2c');return db[_0xd8ec('0x53')][_0xd8ec('0x54')]({'where':{'name':_0x3c0c0d,'userProfileId':_0x1883c2[_0xd8ec('0x55')]},'raw':!![]})[_0xd8ec('0x29')](function(_0x3e19a1){if(_0x3e19a1&&_0x3e19a1[_0xd8ec('0x56')]===0x0){return db[_0xd8ec('0x2d')]['create']({'name':_0x14d9f1['name'],'resourceId':_0x14d9f1['id'],'type':_0x3e19a1[_0xd8ec('0x30')],'sectionId':_0x3e19a1['id']},{})[_0xd8ec('0x29')](function(){return _0x120406;});}else{return _0x120406;}})[_0xd8ec('0x48')](function(_0x5b0244){logger[_0xd8ec('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b0244);throw _0x5b0244;});}return _0x120406;})[_0xd8ec('0x29')](respondWithResult(_0x4047c1,0xc9))[_0xd8ec('0x48')](handleError(_0x4047c1,null));};exports['clone']=function(_0x364050,_0x4af930){var _0x2fbdc2={'where':{'id':_0x364050[_0xd8ec('0x4a')]['id']}},_0x58d9f5={};_0x58d9f5[_0xd8ec('0x39')]=_[_0xd8ec('0x4b')](db[_0xd8ec('0x34')][_0xd8ec('0x4c')]);_0x2fbdc2[_0xd8ec('0x3b')]=_[_0xd8ec('0x38')](_0x58d9f5[_0xd8ec('0x39')],qs[_0xd8ec('0x3a')](_0x364050[_0xd8ec('0x36')]['fields']));_0x2fbdc2[_0xd8ec('0x3b')]=_0x2fbdc2['attributes'][_0xd8ec('0x4d')]?_0x2fbdc2[_0xd8ec('0x3b')]:_0x58d9f5[_0xd8ec('0x39')];if(_0x364050[_0xd8ec('0x36')]['includeAll']){_0x2fbdc2[_0xd8ec('0x4e')]=[{'all':!![]}];}_0x2fbdc2=_[_0xd8ec('0x42')]({},_0x2fbdc2,_0x364050['options']);return db[_0xd8ec('0x34')][_0xd8ec('0x54')](_0x2fbdc2)[_0xd8ec('0x29')](handleEntityNotFound(_0x4af930,null))[_0xd8ec('0x29')](function(_0xd4a3ba){if(_0xd4a3ba){var _0x509a56=_0xd4a3ba[_0xd8ec('0x2b')]({'plain':!![]});_0x509a56=qs[_0xd8ec('0x57')](_0x509a56,['id','createdAt',_0xd8ec('0x58')]);_0x364050[_0xd8ec('0x50')]=_['omit'](_0x364050['body'],['id','createdAt',_0xd8ec('0x58')]);return db[_0xd8ec('0x34')][_0xd8ec('0x4f')](_[_0xd8ec('0x42')](_0x509a56,_0x364050['body']),{'include':_0x364050[_0xd8ec('0x36')][_0xd8ec('0x45')]?[{'all':!![]}]:undefined})[_0xd8ec('0x29')](function(_0x2c86a5){var _0xbd3343=_0x364050[_0xd8ec('0x51')][_0xd8ec('0x2b')]({'plain':!![]});if(!_0xbd3343)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xbd3343[_0xd8ec('0x52')]===_0xd8ec('0x51')){var _0x236f57=_0x2c86a5[_0xd8ec('0x2b')]({'plain':!![]});var _0xa41252=_0xd8ec('0x2c');return db['UserProfileSection'][_0xd8ec('0x54')]({'where':{'name':_0xa41252,'userProfileId':_0xbd3343[_0xd8ec('0x55')]},'raw':!![]})[_0xd8ec('0x29')](function(_0x10f472){if(_0x10f472&&_0x10f472[_0xd8ec('0x56')]===0x0){return db[_0xd8ec('0x2d')][_0xd8ec('0x4f')]({'name':_0x236f57[_0xd8ec('0x30')],'resourceId':_0x236f57['id'],'type':_0x10f472[_0xd8ec('0x30')],'sectionId':_0x10f472['id']},{})[_0xd8ec('0x29')](function(){return _0x2c86a5;});}else{return _0x2c86a5;}})[_0xd8ec('0x48')](function(_0x1f5ed9){logger[_0xd8ec('0x2e')](_0xd8ec('0x59'),_0x1f5ed9);throw _0x1f5ed9;});}return _0x2c86a5;});}})[_0xd8ec('0x29')](respondWithResult(_0x4af930,0xc9))[_0xd8ec('0x48')](handleError(_0x4af930,null));};exports[_0xd8ec('0x28')]=function(_0x179334,_0x88650){if(_0x179334['body']['id']){delete _0x179334['body']['id'];}return db['Dashboard'][_0xd8ec('0x54')]({'where':{'id':_0x179334[_0xd8ec('0x4a')]['id']}})[_0xd8ec('0x29')](handleEntityNotFound(_0x88650,null))[_0xd8ec('0x29')](saveUpdates(_0x179334['body'],null))[_0xd8ec('0x29')](respondWithResult(_0x88650,null))[_0xd8ec('0x48')](handleError(_0x88650,null));};exports['destroy']=function(_0x3b214c,_0x452033){return db[_0xd8ec('0x34')][_0xd8ec('0x54')]({'where':{'id':_0x3b214c[_0xd8ec('0x4a')]['id']}})['then'](handleEntityNotFound(_0x452033,null))['then'](removeEntity(_0x452033,null))[_0xd8ec('0x48')](handleError(_0x452033,null));};function widgetAttributes(_0x231481){try{switch(_0x231481[_0xd8ec('0x5a')]){case'iframe':return[{'name':'attrUrl','value':_0x231481['attrUrl']||(_0x231481[_0xd8ec('0x5b')]&&_0x231481[_0xd8ec('0x5b')][0x0]?_0x231481[_0xd8ec('0x5b')][0x0][_0xd8ec('0x5c')]:undefined)||_0xd8ec('0x5d')}];case _0xd8ec('0x5e'):return[{'name':_0xd8ec('0x5f'),'value':_0x231481[_0xd8ec('0x5f')]||(_0x231481[_0xd8ec('0x5b')]&&_0x231481[_0xd8ec('0x5b')][0x0]?_0x231481[_0xd8ec('0x5b')][0x0][_0xd8ec('0x5c')]:undefined)||''}];case _0xd8ec('0x60'):return[{'name':'attrHourFormat','value':_0x231481[_0xd8ec('0x61')]||(_0x231481[_0xd8ec('0x5b')]&&_0x231481[_0xd8ec('0x5b')][0x0]?_0x231481[_0xd8ec('0x5b')][0x0][_0xd8ec('0x5c')]:undefined)||_0xd8ec('0x62')},{'name':_0xd8ec('0x63'),'value':_0x231481[_0xd8ec('0x63')]||(_0x231481['attrs']&&_0x231481[_0xd8ec('0x5b')][0x1]?_0x231481[_0xd8ec('0x5b')][0x1][_0xd8ec('0x5c')]:undefined)||'0.00'},{'name':_0xd8ec('0x64'),'value':_0x231481[_0xd8ec('0x64')]||(_0x231481[_0xd8ec('0x5b')]&&_0x231481['attrs'][0x2]?_0x231481[_0xd8ec('0x5b')][0x2][_0xd8ec('0x5c')]:undefined)||0xc}];case _0xd8ec('0x65'):return[{'name':'attrMetric','value':_0x231481[_0xd8ec('0x66')]||(_0x231481[_0xd8ec('0x5b')]&&_0x231481[_0xd8ec('0x5b')][0x0]?_0x231481[_0xd8ec('0x5b')][0x0][_0xd8ec('0x5c')]:undefined)||_0xd8ec('0x67')},{'name':_0xd8ec('0x68'),'value':_0x231481[_0xd8ec('0x68')]||(_0x231481[_0xd8ec('0x5b')]&&_0x231481[_0xd8ec('0x5b')][0x1]?_0x231481[_0xd8ec('0x5b')][0x1][_0xd8ec('0x5c')]:undefined)||[]},{'name':'attrFontSize','value':_0x231481[_0xd8ec('0x64')]||(_0x231481[_0xd8ec('0x5b')]&&_0x231481['attrs'][0x2]?_0x231481[_0xd8ec('0x5b')][0x2][_0xd8ec('0x5c')]:undefined)||0x14},{'name':_0xd8ec('0x69'),'value':_0x231481[_0xd8ec('0x69')]||(_0x231481[_0xd8ec('0x5b')]&&_0x231481[_0xd8ec('0x5b')][0x3]?_0x231481[_0xd8ec('0x5b')][0x3][_0xd8ec('0x5c')]:undefined)||_0xd8ec('0x6a')},{'name':_0xd8ec('0x6b'),'value':_0x231481[_0xd8ec('0x6b')]||(_0x231481['attrs']&&_0x231481['attrs'][0x4]?_0x231481[_0xd8ec('0x5b')][0x4]['value']:undefined)||''},{'name':_0xd8ec('0x6c'),'value':_0x231481['attrFaxAccounts']||(_0x231481['attrs']&&_0x231481[_0xd8ec('0x5b')][0x5]?_0x231481[_0xd8ec('0x5b')][0x5]['value']:undefined)||''},{'name':_0xd8ec('0x6d'),'value':_0x231481[_0xd8ec('0x6d')]||(_0x231481['attrs']&&_0x231481[_0xd8ec('0x5b')][0x6]?_0x231481[_0xd8ec('0x5b')][0x6][_0xd8ec('0x5c')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x231481[_0xd8ec('0x6e')]||(_0x231481['attrs']&&_0x231481[_0xd8ec('0x5b')][0x7]?_0x231481[_0xd8ec('0x5b')][0x7][_0xd8ec('0x5c')]:undefined)||''},{'name':_0xd8ec('0x6f'),'value':_0x231481['attrWhatsappAccounts']||(_0x231481[_0xd8ec('0x5b')]&&_0x231481[_0xd8ec('0x5b')][0x8]?_0x231481[_0xd8ec('0x5b')][0x8][_0xd8ec('0x5c')]:undefined)||''},{'name':_0xd8ec('0x70'),'value':_0x231481[_0xd8ec('0x70')]||(_0x231481[_0xd8ec('0x5b')]&&_0x231481[_0xd8ec('0x5b')][0x9]?_0x231481[_0xd8ec('0x5b')][0x9][_0xd8ec('0x5c')]:undefined)||''}];case _0xd8ec('0x71'):case _0xd8ec('0x72'):return[{'name':'attrSerie1','value':_0x231481[_0xd8ec('0x73')]||(_0x231481[_0xd8ec('0x5b')]&&_0x231481[_0xd8ec('0x5b')][0x0]?_0x231481[_0xd8ec('0x5b')][0x0][_0xd8ec('0x5c')]:undefined)||_0xd8ec('0x67')},{'name':_0xd8ec('0x74'),'value':_0x231481['attrSerie2']||(_0x231481[_0xd8ec('0x5b')]&&_0x231481['attrs'][0x1]?_0x231481[_0xd8ec('0x5b')][0x1][_0xd8ec('0x5c')]:undefined)||null},{'name':'attrSerie3','value':_0x231481[_0xd8ec('0x75')]||(_0x231481[_0xd8ec('0x5b')]&&_0x231481[_0xd8ec('0x5b')][0x2]?_0x231481[_0xd8ec('0x5b')][0x2][_0xd8ec('0x5c')]:undefined)||null},{'name':_0xd8ec('0x68'),'value':_0x231481[_0xd8ec('0x68')]||(_0x231481[_0xd8ec('0x5b')]&&_0x231481[_0xd8ec('0x5b')][0x3]?_0x231481['attrs'][0x3][_0xd8ec('0x5c')]:undefined)||[]},{'name':_0xd8ec('0x69'),'value':_0x231481[_0xd8ec('0x69')]||(_0x231481[_0xd8ec('0x5b')]&&_0x231481[_0xd8ec('0x5b')][0x4]?_0x231481[_0xd8ec('0x5b')][0x4][_0xd8ec('0x5c')]:undefined)||_0xd8ec('0x6a')},{'name':_0xd8ec('0x6b'),'value':_0x231481[_0xd8ec('0x6b')]||(_0x231481['attrs']&&_0x231481[_0xd8ec('0x5b')][0x5]?_0x231481['attrs'][0x5][_0xd8ec('0x5c')]:undefined)||''},{'name':_0xd8ec('0x6c'),'value':_0x231481[_0xd8ec('0x6c')]||(_0x231481[_0xd8ec('0x5b')]&&_0x231481[_0xd8ec('0x5b')][0x6]?_0x231481[_0xd8ec('0x5b')][0x6][_0xd8ec('0x5c')]:undefined)||''},{'name':_0xd8ec('0x6d'),'value':_0x231481[_0xd8ec('0x6d')]||(_0x231481[_0xd8ec('0x5b')]&&_0x231481[_0xd8ec('0x5b')][0x7]?_0x231481[_0xd8ec('0x5b')][0x7]['value']:undefined)||''},{'name':_0xd8ec('0x6e'),'value':_0x231481[_0xd8ec('0x6e')]||(_0x231481[_0xd8ec('0x5b')]&&_0x231481[_0xd8ec('0x5b')][0x8]?_0x231481[_0xd8ec('0x5b')][0x8][_0xd8ec('0x5c')]:undefined)||''},{'name':_0xd8ec('0x6f'),'value':_0x231481['attrWhatsappAccounts']||(_0x231481[_0xd8ec('0x5b')]&&_0x231481[_0xd8ec('0x5b')][0x9]?_0x231481[_0xd8ec('0x5b')][0x9][_0xd8ec('0x5c')]:undefined)||''},{'name':'attrChatWebsites','value':_0x231481[_0xd8ec('0x70')]||(_0x231481['attrs']&&_0x231481['attrs'][0xa]?_0x231481[_0xd8ec('0x5b')][0xa][_0xd8ec('0x5c')]:undefined)||''}];case _0xd8ec('0x76'):return[{'name':_0xd8ec('0x77'),'type':_0x231481[_0xd8ec('0x78')]||(_0x231481['attrs']&&_0x231481[_0xd8ec('0x5b')][0x0]?_0x231481[_0xd8ec('0x5b')][0x0]['type']:undefined)||null,'value':_0x231481[_0xd8ec('0x77')]||(_0x231481[_0xd8ec('0x5b')]&&_0x231481[_0xd8ec('0x5b')][0x0]?_0x231481['attrs'][0x0][_0xd8ec('0x5c')]:undefined)||null},{'name':_0xd8ec('0x79'),'value':_0x231481[_0xd8ec('0x79')]||(_0x231481[_0xd8ec('0x5b')]&&_0x231481[_0xd8ec('0x5b')][0x1]?_0x231481[_0xd8ec('0x5b')][0x1][_0xd8ec('0x5c')]:undefined)||0x0}];default:return[];}}catch(_0x445e04){logger[_0xd8ec('0x2e')](_0xd8ec('0x7a'),JSON[_0xd8ec('0x7b')](_0x445e04));return[];}}exports[_0xd8ec('0x7c')]=function(_0x5cac60,_0xe2e2da,_0x7733ba){if(_0x5cac60['body']['id']){delete _0x5cac60[_0xd8ec('0x50')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x5cac60['params']['id']}})[_0xd8ec('0x29')](handleEntityNotFound(_0xe2e2da,null))['then'](function(_0x33971f){if(_0x33971f){_0x5cac60[_0xd8ec('0x50')][_0xd8ec('0x7d')]=_0x33971f['id'];_0x5cac60[_0xd8ec('0x50')][_0xd8ec('0x5b')]=widgetAttributes(_0x5cac60[_0xd8ec('0x50')]);return db[_0xd8ec('0x7e')][_0xd8ec('0x4f')](_0x5cac60[_0xd8ec('0x50')]);}})[_0xd8ec('0x29')](respondWithResult(_0xe2e2da,null))['catch'](handleError(_0xe2e2da,null));};exports[_0xd8ec('0x7f')]=function(_0x20049d,_0x3a8db7,_0x204b4a){var _0x8f8389={};var _0x47875c={};var _0x48ebe8;var _0x33e096;return db[_0xd8ec('0x34')][_0xd8ec('0x80')]({'where':{'id':_0x20049d[_0xd8ec('0x4a')]['id']}})[_0xd8ec('0x29')](handleEntityNotFound(_0x3a8db7,null))[_0xd8ec('0x29')](function(_0xcd1377){if(_0xcd1377){_0x48ebe8=_0xcd1377;_0x47875c[_0xd8ec('0x39')]=_[_0xd8ec('0x4b')](db['DashboardItem']['rawAttributes']);_0x47875c[_0xd8ec('0x36')]=_['keys'](_0x20049d['query']);_0x47875c[_0xd8ec('0x37')]=_[_0xd8ec('0x38')](_0x47875c[_0xd8ec('0x39')],_0x47875c[_0xd8ec('0x36')]);_0x8f8389[_0xd8ec('0x3b')]=_[_0xd8ec('0x38')](_0x47875c[_0xd8ec('0x39')],qs['fields'](_0x20049d[_0xd8ec('0x36')][_0xd8ec('0x3a')]));_0x8f8389[_0xd8ec('0x3b')]=_0x8f8389['attributes']['length']?_0x8f8389[_0xd8ec('0x3b')]:_0x47875c[_0xd8ec('0x39')];_0x8f8389['order']=qs[_0xd8ec('0x3e')](_0x20049d[_0xd8ec('0x36')][_0xd8ec('0x3e')]);_0x8f8389[_0xd8ec('0x3f')]=qs['filters'](_[_0xd8ec('0x40')](_0x20049d[_0xd8ec('0x36')],_0x47875c[_0xd8ec('0x37')]));if(_0x20049d[_0xd8ec('0x36')]['filter']){_0x8f8389['where']=_[_0xd8ec('0x42')](_0x8f8389[_0xd8ec('0x3f')],{'$or':_[_0xd8ec('0x33')](_0x8f8389[_0xd8ec('0x3b')],function(_0x16f634){var _0x176194={};_0x176194[_0x16f634]={'$like':'%'+_0x20049d[_0xd8ec('0x36')][_0xd8ec('0x41')]+'%'};return _0x176194;})});}_0x8f8389=_[_0xd8ec('0x42')]({},_0x8f8389,_0x20049d[_0xd8ec('0x44')]);return _0x48ebe8[_0xd8ec('0x7f')](_0x8f8389);}})['then'](function(_0x254244){if(_0x254244){_0x33e096=_0x254244[_0xd8ec('0x4d')];if(!_0x20049d[_0xd8ec('0x36')][_0xd8ec('0x3c')](_0xd8ec('0x81'))){_0x8f8389[_0xd8ec('0x23')]=qs['limit'](_0x20049d[_0xd8ec('0x36')][_0xd8ec('0x23')]);_0x8f8389[_0xd8ec('0x20')]=qs[_0xd8ec('0x20')](_0x20049d['query'][_0xd8ec('0x20')]);}return _0x48ebe8[_0xd8ec('0x7f')](_0x8f8389);}})[_0xd8ec('0x29')](function(_0xc3c7d4){if(_0xc3c7d4){return _0xc3c7d4?{'count':_0x33e096,'rows':_0xc3c7d4}:null;}})[_0xd8ec('0x29')](respondWithResult(_0x3a8db7,null))[_0xd8ec('0x48')](handleError(_0x3a8db7,null));}; \ No newline at end of file +var _0x3b69=['clone','omit','updatedAt','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','error','params','attrUrl','attrs','value','https://','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrChatWebsites','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','findOne','getItems','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','CustomDashboards','UserProfileResource','stack','name','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','findAll','rows','catch','show','include','find','body','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x26a494,_0x35b08){var _0x26f2b6=function(_0x5ef100){while(--_0x5ef100){_0x26a494['push'](_0x26a494['shift']());}};_0x26f2b6(++_0x35b08);}(_0x3b69,0xaa));var _0x93b6=function(_0x43e38e,_0x563dd8){_0x43e38e=_0x43e38e-0x0;var _0x22c34e=_0x3b69[_0x43e38e];return _0x22c34e;};'use strict';var emlformat=require(_0x93b6('0x0'));var rimraf=require(_0x93b6('0x1'));var zipdir=require(_0x93b6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x93b6('0x3'));var moment=require(_0x93b6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x93b6('0x5'));var util=require(_0x93b6('0x6'));var path=require(_0x93b6('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x93b6('0x8'));var fs=require('fs');var fs_extra=require(_0x93b6('0x9'));var _=require(_0x93b6('0xa'));var squel=require(_0x93b6('0xb'));var crypto=require('crypto');var jsforce=require(_0x93b6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x93b6('0xd'));var querystring=require(_0x93b6('0xe'));var Papa=require(_0x93b6('0xf'));var Redis=require(_0x93b6('0x10'));var authService=require(_0x93b6('0x11'));var qs=require(_0x93b6('0x12'));var as=require(_0x93b6('0x13'));var hardwareService=require(_0x93b6('0x14'));var logger=require('../../config/logger')(_0x93b6('0x15'));var utils=require(_0x93b6('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x93b6('0x17'))['db'];config[_0x93b6('0x18')]=_[_0x93b6('0x19')](config[_0x93b6('0x18')],{'host':_0x93b6('0x1a'),'port':0x18eb});var socket=require(_0x93b6('0x1b'))(new Redis(config[_0x93b6('0x18')]));require(_0x93b6('0x1c'))[_0x93b6('0x1d')](socket);function respondWithStatusCode(_0x305a25,_0x43545a){_0x43545a=_0x43545a||0xcc;return function(_0x5b7764){if(_0x5b7764){return _0x305a25[_0x93b6('0x1e')](_0x43545a);}return _0x305a25[_0x93b6('0x1f')](_0x43545a)[_0x93b6('0x20')]();};}function respondWithResult(_0x585b42,_0x3e9b40){_0x3e9b40=_0x3e9b40||0xc8;return function(_0xcf198b){if(_0xcf198b){return _0x585b42[_0x93b6('0x1f')](_0x3e9b40)[_0x93b6('0x21')](_0xcf198b);}};}function respondWithFilteredResult(_0x3d900d,_0x5c17a6){return function(_0x9bf628){if(_0x9bf628){var _0x58dd35=typeof _0x5c17a6[_0x93b6('0x22')]===_0x93b6('0x23')&&typeof _0x5c17a6[_0x93b6('0x24')]===_0x93b6('0x23');var _0x9ecf42=_0x9bf628[_0x93b6('0x25')];var _0x37051c=_0x58dd35?0x0:_0x5c17a6[_0x93b6('0x22')];var _0x2590f0=_0x58dd35?_0x9bf628[_0x93b6('0x25')]:_0x5c17a6[_0x93b6('0x22')]+_0x5c17a6[_0x93b6('0x24')];var _0x4dbec2;if(_0x2590f0>=_0x9ecf42){_0x2590f0=_0x9ecf42;_0x4dbec2=0xc8;}else{_0x4dbec2=0xce;}_0x3d900d['status'](_0x4dbec2);return _0x3d900d[_0x93b6('0x26')](_0x93b6('0x27'),_0x37051c+'-'+_0x2590f0+'/'+_0x9ecf42)['json'](_0x9bf628);}return null;};}function patchUpdates(_0xcc1b59){return function(_0x115951){try{jsonpatch[_0x93b6('0x28')](_0x115951,_0xcc1b59,!![]);}catch(_0x1303e0){return BPromise[_0x93b6('0x29')](_0x1303e0);}return _0x115951[_0x93b6('0x2a')]();};}function saveUpdates(_0x20a762,_0x385985){return function(_0x1f2751){if(_0x1f2751){return _0x1f2751['update'](_0x20a762)['then'](function(_0x43e1c9){return _0x43e1c9;});}return null;};}function removeEntity(_0x5e20b8,_0x45d1e0){return function(_0x500f23){if(_0x500f23){return _0x500f23[_0x93b6('0x2b')]()[_0x93b6('0x2c')](function(){var _0x1882a4=_0x500f23[_0x93b6('0x2d')]({'plain':!![]});var _0x29d657=_0x93b6('0x2e');return db[_0x93b6('0x2f')][_0x93b6('0x2b')]({'where':{'type':_0x29d657,'resourceId':_0x1882a4['id']}})[_0x93b6('0x2c')](function(){return _0x500f23;});})[_0x93b6('0x2c')](function(){_0x5e20b8[_0x93b6('0x1f')](0xcc)[_0x93b6('0x20')]();});}};}function handleEntityNotFound(_0x3ebca9,_0x4eb8df){return function(_0x2d2482){if(!_0x2d2482){_0x3ebca9[_0x93b6('0x1e')](0x194);}return _0x2d2482;};}function handleError(_0x51e944,_0x5e77b9){_0x5e77b9=_0x5e77b9||0x1f4;return function(_0x2eb1c9){logger['error'](_0x2eb1c9[_0x93b6('0x30')]);if(_0x2eb1c9[_0x93b6('0x31')]){delete _0x2eb1c9[_0x93b6('0x31')];}_0x51e944[_0x93b6('0x1f')](_0x5e77b9)['send'](_0x2eb1c9);};}exports['index']=function(_0xe1b0f0,_0x656abf){var _0x2616ff={},_0x3cea02={},_0x45ad86={'count':0x0,'rows':[]};var _0x573d4f=_[_0x93b6('0x32')](db[_0x93b6('0x33')][_0x93b6('0x34')],function(_0x5784ff){return{'name':_0x5784ff[_0x93b6('0x35')],'type':_0x5784ff[_0x93b6('0x36')][_0x93b6('0x37')]};});_0x3cea02[_0x93b6('0x38')]=_['map'](_0x573d4f,'name');_0x3cea02[_0x93b6('0x39')]=_[_0x93b6('0x3a')](_0xe1b0f0['query']);_0x3cea02[_0x93b6('0x3b')]=_[_0x93b6('0x3c')](_0x3cea02['model'],_0x3cea02['query']);_0x2616ff[_0x93b6('0x3d')]=_[_0x93b6('0x3c')](_0x3cea02[_0x93b6('0x38')],qs[_0x93b6('0x3e')](_0xe1b0f0[_0x93b6('0x39')][_0x93b6('0x3e')]));_0x2616ff['attributes']=_0x2616ff['attributes'][_0x93b6('0x3f')]?_0x2616ff[_0x93b6('0x3d')]:_0x3cea02[_0x93b6('0x38')];if(!_0xe1b0f0[_0x93b6('0x39')][_0x93b6('0x40')](_0x93b6('0x41'))){_0x2616ff[_0x93b6('0x24')]=qs[_0x93b6('0x24')](_0xe1b0f0[_0x93b6('0x39')][_0x93b6('0x24')]);_0x2616ff[_0x93b6('0x22')]=qs[_0x93b6('0x22')](_0xe1b0f0['query'][_0x93b6('0x22')]);}_0x2616ff[_0x93b6('0x42')]=qs[_0x93b6('0x43')](_0xe1b0f0[_0x93b6('0x39')]['sort']);_0x2616ff['where']=qs[_0x93b6('0x3b')](_[_0x93b6('0x44')](_0xe1b0f0[_0x93b6('0x39')],_0x3cea02[_0x93b6('0x3b')]),_0x573d4f);if(_0xe1b0f0[_0x93b6('0x39')][_0x93b6('0x45')]){_0x2616ff[_0x93b6('0x46')]=_[_0x93b6('0x47')](_0x2616ff[_0x93b6('0x46')],{'$or':_['map'](_0x573d4f,function(_0x30f8b6){if(_0x30f8b6[_0x93b6('0x36')]!=='VIRTUAL'){var _0x3b2ced={};_0x3b2ced[_0x30f8b6[_0x93b6('0x31')]]={'$like':'%'+_0xe1b0f0[_0x93b6('0x39')]['filter']+'%'};return _0x3b2ced;}})});}_0x2616ff=_['merge']({},_0x2616ff,_0xe1b0f0[_0x93b6('0x48')]);var _0x21196d={'where':_0x2616ff[_0x93b6('0x46')]};return db['Dashboard']['count'](_0x21196d)['then'](function(_0x36c14a){_0x45ad86[_0x93b6('0x25')]=_0x36c14a;if(_0xe1b0f0[_0x93b6('0x39')][_0x93b6('0x49')]){_0x2616ff['include']=[{'all':!![]}];}return db['Dashboard'][_0x93b6('0x4a')](_0x2616ff);})[_0x93b6('0x2c')](function(_0x216578){_0x45ad86[_0x93b6('0x4b')]=_0x216578;return _0x45ad86;})['then'](respondWithFilteredResult(_0x656abf,_0x2616ff))[_0x93b6('0x4c')](handleError(_0x656abf,null));};exports[_0x93b6('0x4d')]=function(_0x3fc056,_0x5a3c39){var _0x40a9a1={'raw':![],'where':{'id':_0x3fc056['params']['id']}},_0x10fb7b={};_0x10fb7b['model']=_['keys'](db[_0x93b6('0x33')][_0x93b6('0x34')]);_0x10fb7b['query']=_[_0x93b6('0x3a')](_0x3fc056[_0x93b6('0x39')]);_0x10fb7b[_0x93b6('0x3b')]=_[_0x93b6('0x3c')](_0x10fb7b[_0x93b6('0x38')],_0x10fb7b[_0x93b6('0x39')]);_0x40a9a1[_0x93b6('0x3d')]=_[_0x93b6('0x3c')](_0x10fb7b[_0x93b6('0x38')],qs['fields'](_0x3fc056[_0x93b6('0x39')][_0x93b6('0x3e')]));_0x40a9a1[_0x93b6('0x3d')]=_0x40a9a1[_0x93b6('0x3d')]['length']?_0x40a9a1[_0x93b6('0x3d')]:_0x10fb7b[_0x93b6('0x38')];if(_0x3fc056['query'][_0x93b6('0x49')]){_0x40a9a1[_0x93b6('0x4e')]=[{'all':!![]}];}_0x40a9a1=_[_0x93b6('0x47')]({},_0x40a9a1,_0x3fc056['options']);return db[_0x93b6('0x33')][_0x93b6('0x4f')](_0x40a9a1)[_0x93b6('0x2c')](handleEntityNotFound(_0x5a3c39,null))[_0x93b6('0x2c')](respondWithResult(_0x5a3c39,null))[_0x93b6('0x4c')](handleError(_0x5a3c39,null));};exports['create']=function(_0x31ca2e,_0x3368da){return db[_0x93b6('0x33')]['create'](_0x31ca2e[_0x93b6('0x50')],{})['then'](function(_0x15d994){var _0x102d8a=_0x31ca2e[_0x93b6('0x51')]['get']({'plain':!![]});if(!_0x102d8a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x102d8a['role']===_0x93b6('0x51')){var _0x4874ad=_0x15d994['get']({'plain':!![]});var _0x5a3dec=_0x93b6('0x2e');return db['UserProfileSection'][_0x93b6('0x4f')]({'where':{'name':_0x5a3dec,'userProfileId':_0x102d8a['userProfileId']},'raw':!![]})['then'](function(_0xa03227){if(_0xa03227&&_0xa03227[_0x93b6('0x52')]===0x0){return db[_0x93b6('0x2f')]['create']({'name':_0x4874ad[_0x93b6('0x31')],'resourceId':_0x4874ad['id'],'type':_0xa03227[_0x93b6('0x31')],'sectionId':_0xa03227['id']},{})[_0x93b6('0x2c')](function(){return _0x15d994;});}else{return _0x15d994;}})[_0x93b6('0x4c')](function(_0x1d7c4d){logger['error'](_0x93b6('0x53'),_0x1d7c4d);throw _0x1d7c4d;});}return _0x15d994;})[_0x93b6('0x2c')](respondWithResult(_0x3368da,0xc9))[_0x93b6('0x4c')](handleError(_0x3368da,null));};exports[_0x93b6('0x54')]=function(_0x34509f,_0x3149f6){var _0x29d91e={'where':{'id':_0x34509f['params']['id']}},_0x5a41c3={};_0x5a41c3[_0x93b6('0x38')]=_[_0x93b6('0x3a')](db[_0x93b6('0x33')][_0x93b6('0x34')]);_0x29d91e[_0x93b6('0x3d')]=_[_0x93b6('0x3c')](_0x5a41c3[_0x93b6('0x38')],qs[_0x93b6('0x3e')](_0x34509f['query'][_0x93b6('0x3e')]));_0x29d91e[_0x93b6('0x3d')]=_0x29d91e['attributes']['length']?_0x29d91e['attributes']:_0x5a41c3[_0x93b6('0x38')];if(_0x34509f[_0x93b6('0x39')][_0x93b6('0x49')]){_0x29d91e[_0x93b6('0x4e')]=[{'all':!![]}];}_0x29d91e=_[_0x93b6('0x47')]({},_0x29d91e,_0x34509f[_0x93b6('0x48')]);return db[_0x93b6('0x33')][_0x93b6('0x4f')](_0x29d91e)[_0x93b6('0x2c')](handleEntityNotFound(_0x3149f6,null))[_0x93b6('0x2c')](function(_0x28dad8){if(_0x28dad8){var _0x1ee049=_0x28dad8['get']({'plain':!![]});_0x1ee049=qs[_0x93b6('0x55')](_0x1ee049,['id','createdAt','updatedAt']);_0x34509f[_0x93b6('0x50')]=_[_0x93b6('0x55')](_0x34509f[_0x93b6('0x50')],['id','createdAt',_0x93b6('0x56')]);return db[_0x93b6('0x33')][_0x93b6('0x57')](_[_0x93b6('0x47')](_0x1ee049,_0x34509f[_0x93b6('0x50')]),{'include':_0x34509f['query'][_0x93b6('0x49')]?[{'all':!![]}]:undefined})['then'](function(_0x2a42fd){var _0x224991=_0x34509f[_0x93b6('0x51')][_0x93b6('0x2d')]({'plain':!![]});if(!_0x224991)throw new Error(_0x93b6('0x58'));if(_0x224991['role']===_0x93b6('0x51')){var _0x17bb70=_0x2a42fd['get']({'plain':!![]});var _0x254a7b=_0x93b6('0x2e');return db['UserProfileSection'][_0x93b6('0x4f')]({'where':{'name':_0x254a7b,'userProfileId':_0x224991['userProfileId']},'raw':!![]})[_0x93b6('0x2c')](function(_0x3ca52e){if(_0x3ca52e&&_0x3ca52e[_0x93b6('0x52')]===0x0){return db[_0x93b6('0x2f')]['create']({'name':_0x17bb70[_0x93b6('0x31')],'resourceId':_0x17bb70['id'],'type':_0x3ca52e[_0x93b6('0x31')],'sectionId':_0x3ca52e['id']},{})[_0x93b6('0x2c')](function(){return _0x2a42fd;});}else{return _0x2a42fd;}})[_0x93b6('0x4c')](function(_0x5b2b2e){logger[_0x93b6('0x59')](_0x93b6('0x53'),_0x5b2b2e);throw _0x5b2b2e;});}return _0x2a42fd;});}})[_0x93b6('0x2c')](respondWithResult(_0x3149f6,0xc9))['catch'](handleError(_0x3149f6,null));};exports['update']=function(_0x2ebfa5,_0x5e34b5){if(_0x2ebfa5[_0x93b6('0x50')]['id']){delete _0x2ebfa5[_0x93b6('0x50')]['id'];}return db[_0x93b6('0x33')][_0x93b6('0x4f')]({'where':{'id':_0x2ebfa5[_0x93b6('0x5a')]['id']}})[_0x93b6('0x2c')](handleEntityNotFound(_0x5e34b5,null))[_0x93b6('0x2c')](saveUpdates(_0x2ebfa5[_0x93b6('0x50')],null))[_0x93b6('0x2c')](respondWithResult(_0x5e34b5,null))[_0x93b6('0x4c')](handleError(_0x5e34b5,null));};exports['destroy']=function(_0x501b84,_0x927cf5){return db['Dashboard'][_0x93b6('0x4f')]({'where':{'id':_0x501b84['params']['id']}})[_0x93b6('0x2c')](handleEntityNotFound(_0x927cf5,null))[_0x93b6('0x2c')](removeEntity(_0x927cf5,null))[_0x93b6('0x4c')](handleError(_0x927cf5,null));};function widgetAttributes(_0x3d9dcf){try{switch(_0x3d9dcf[_0x93b6('0x36')]){case'iframe':return[{'name':'attrUrl','value':_0x3d9dcf[_0x93b6('0x5b')]||(_0x3d9dcf[_0x93b6('0x5c')]&&_0x3d9dcf[_0x93b6('0x5c')][0x0]?_0x3d9dcf['attrs'][0x0][_0x93b6('0x5d')]:undefined)||_0x93b6('0x5e')}];case'custom':return[{'name':'attrPath','value':_0x3d9dcf[_0x93b6('0x5f')]||(_0x3d9dcf[_0x93b6('0x5c')]&&_0x3d9dcf['attrs'][0x0]?_0x3d9dcf['attrs'][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0x93b6('0x60'),'value':_0x3d9dcf[_0x93b6('0x60')]||(_0x3d9dcf[_0x93b6('0x5c')]&&_0x3d9dcf['attrs'][0x0]?_0x3d9dcf['attrs'][0x0][_0x93b6('0x5d')]:undefined)||_0x93b6('0x61')},{'name':_0x93b6('0x62'),'value':_0x3d9dcf['attrTimezone']||(_0x3d9dcf[_0x93b6('0x5c')]&&_0x3d9dcf[_0x93b6('0x5c')][0x1]?_0x3d9dcf[_0x93b6('0x5c')][0x1]['value']:undefined)||_0x93b6('0x63')},{'name':_0x93b6('0x64'),'value':_0x3d9dcf[_0x93b6('0x64')]||(_0x3d9dcf[_0x93b6('0x5c')]&&_0x3d9dcf[_0x93b6('0x5c')][0x2]?_0x3d9dcf[_0x93b6('0x5c')][0x2][_0x93b6('0x5d')]:undefined)||0xc}];case _0x93b6('0x65'):return[{'name':_0x93b6('0x66'),'value':_0x3d9dcf[_0x93b6('0x66')]||(_0x3d9dcf['attrs']&&_0x3d9dcf[_0x93b6('0x5c')][0x0]?_0x3d9dcf[_0x93b6('0x5c')][0x0][_0x93b6('0x5d')]:undefined)||_0x93b6('0x67')},{'name':_0x93b6('0x68'),'value':_0x3d9dcf[_0x93b6('0x68')]||(_0x3d9dcf[_0x93b6('0x5c')]&&_0x3d9dcf[_0x93b6('0x5c')][0x1]?_0x3d9dcf[_0x93b6('0x5c')][0x1]['value']:undefined)||[]},{'name':_0x93b6('0x64'),'value':_0x3d9dcf[_0x93b6('0x64')]||(_0x3d9dcf[_0x93b6('0x5c')]&&_0x3d9dcf[_0x93b6('0x5c')][0x2]?_0x3d9dcf[_0x93b6('0x5c')][0x2][_0x93b6('0x5d')]:undefined)||0x14},{'name':_0x93b6('0x69'),'value':_0x3d9dcf['attrChannel']||(_0x3d9dcf[_0x93b6('0x5c')]&&_0x3d9dcf['attrs'][0x3]?_0x3d9dcf[_0x93b6('0x5c')][0x3]['value']:undefined)||_0x93b6('0x6a')},{'name':'attrEmailAccounts','value':_0x3d9dcf[_0x93b6('0x6b')]||(_0x3d9dcf[_0x93b6('0x5c')]&&_0x3d9dcf[_0x93b6('0x5c')][0x4]?_0x3d9dcf[_0x93b6('0x5c')][0x4][_0x93b6('0x5d')]:undefined)||''},{'name':_0x93b6('0x6c'),'value':_0x3d9dcf['attrFaxAccounts']||(_0x3d9dcf['attrs']&&_0x3d9dcf[_0x93b6('0x5c')][0x5]?_0x3d9dcf[_0x93b6('0x5c')][0x5][_0x93b6('0x5d')]:undefined)||''},{'name':_0x93b6('0x6d'),'value':_0x3d9dcf['attrSmsAccounts']||(_0x3d9dcf['attrs']&&_0x3d9dcf[_0x93b6('0x5c')][0x6]?_0x3d9dcf[_0x93b6('0x5c')][0x6][_0x93b6('0x5d')]:undefined)||''},{'name':_0x93b6('0x6e'),'value':_0x3d9dcf['attrOpenchannelAccounts']||(_0x3d9dcf[_0x93b6('0x5c')]&&_0x3d9dcf['attrs'][0x7]?_0x3d9dcf[_0x93b6('0x5c')][0x7][_0x93b6('0x5d')]:undefined)||''},{'name':_0x93b6('0x6f'),'value':_0x3d9dcf['attrWhatsappAccounts']||(_0x3d9dcf[_0x93b6('0x5c')]&&_0x3d9dcf[_0x93b6('0x5c')][0x8]?_0x3d9dcf[_0x93b6('0x5c')][0x8][_0x93b6('0x5d')]:undefined)||''},{'name':'attrChatWebsites','value':_0x3d9dcf['attrChatWebsites']||(_0x3d9dcf[_0x93b6('0x5c')]&&_0x3d9dcf[_0x93b6('0x5c')][0x9]?_0x3d9dcf[_0x93b6('0x5c')][0x9][_0x93b6('0x5d')]:undefined)||''}];case _0x93b6('0x70'):case _0x93b6('0x71'):return[{'name':_0x93b6('0x72'),'value':_0x3d9dcf[_0x93b6('0x72')]||(_0x3d9dcf['attrs']&&_0x3d9dcf[_0x93b6('0x5c')][0x0]?_0x3d9dcf[_0x93b6('0x5c')][0x0][_0x93b6('0x5d')]:undefined)||'total'},{'name':_0x93b6('0x73'),'value':_0x3d9dcf[_0x93b6('0x73')]||(_0x3d9dcf[_0x93b6('0x5c')]&&_0x3d9dcf[_0x93b6('0x5c')][0x1]?_0x3d9dcf[_0x93b6('0x5c')][0x1][_0x93b6('0x5d')]:undefined)||null},{'name':_0x93b6('0x74'),'value':_0x3d9dcf['attrSerie3']||(_0x3d9dcf['attrs']&&_0x3d9dcf[_0x93b6('0x5c')][0x2]?_0x3d9dcf[_0x93b6('0x5c')][0x2][_0x93b6('0x5d')]:undefined)||null},{'name':_0x93b6('0x68'),'value':_0x3d9dcf[_0x93b6('0x68')]||(_0x3d9dcf['attrs']&&_0x3d9dcf[_0x93b6('0x5c')][0x3]?_0x3d9dcf['attrs'][0x3][_0x93b6('0x5d')]:undefined)||[]},{'name':_0x93b6('0x69'),'value':_0x3d9dcf['attrChannel']||(_0x3d9dcf['attrs']&&_0x3d9dcf['attrs'][0x4]?_0x3d9dcf[_0x93b6('0x5c')][0x4]['value']:undefined)||_0x93b6('0x6a')},{'name':'attrEmailAccounts','value':_0x3d9dcf[_0x93b6('0x6b')]||(_0x3d9dcf[_0x93b6('0x5c')]&&_0x3d9dcf['attrs'][0x5]?_0x3d9dcf[_0x93b6('0x5c')][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x3d9dcf[_0x93b6('0x6c')]||(_0x3d9dcf[_0x93b6('0x5c')]&&_0x3d9dcf[_0x93b6('0x5c')][0x6]?_0x3d9dcf[_0x93b6('0x5c')][0x6][_0x93b6('0x5d')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x3d9dcf[_0x93b6('0x6d')]||(_0x3d9dcf['attrs']&&_0x3d9dcf[_0x93b6('0x5c')][0x7]?_0x3d9dcf['attrs'][0x7][_0x93b6('0x5d')]:undefined)||''},{'name':_0x93b6('0x6e'),'value':_0x3d9dcf[_0x93b6('0x6e')]||(_0x3d9dcf[_0x93b6('0x5c')]&&_0x3d9dcf[_0x93b6('0x5c')][0x8]?_0x3d9dcf[_0x93b6('0x5c')][0x8][_0x93b6('0x5d')]:undefined)||''},{'name':_0x93b6('0x6f'),'value':_0x3d9dcf[_0x93b6('0x6f')]||(_0x3d9dcf[_0x93b6('0x5c')]&&_0x3d9dcf['attrs'][0x9]?_0x3d9dcf['attrs'][0x9][_0x93b6('0x5d')]:undefined)||''},{'name':_0x93b6('0x75'),'value':_0x3d9dcf['attrChatWebsites']||(_0x3d9dcf[_0x93b6('0x5c')]&&_0x3d9dcf[_0x93b6('0x5c')][0xa]?_0x3d9dcf[_0x93b6('0x5c')][0xa][_0x93b6('0x5d')]:undefined)||''}];case'web-report':return[{'name':_0x93b6('0x76'),'type':_0x3d9dcf[_0x93b6('0x77')]||(_0x3d9dcf[_0x93b6('0x5c')]&&_0x3d9dcf['attrs'][0x0]?_0x3d9dcf['attrs'][0x0][_0x93b6('0x36')]:undefined)||null,'value':_0x3d9dcf[_0x93b6('0x76')]||(_0x3d9dcf[_0x93b6('0x5c')]&&_0x3d9dcf[_0x93b6('0x5c')][0x0]?_0x3d9dcf[_0x93b6('0x5c')][0x0][_0x93b6('0x5d')]:undefined)||null},{'name':_0x93b6('0x78'),'value':_0x3d9dcf[_0x93b6('0x78')]||(_0x3d9dcf[_0x93b6('0x5c')]&&_0x3d9dcf[_0x93b6('0x5c')][0x1]?_0x3d9dcf[_0x93b6('0x5c')][0x1][_0x93b6('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x3907be){logger[_0x93b6('0x59')](_0x93b6('0x79'),JSON[_0x93b6('0x7a')](_0x3907be));return[];}}exports[_0x93b6('0x7b')]=function(_0x418355,_0x5dab44,_0x15e28d){if(_0x418355[_0x93b6('0x50')]['id']){delete _0x418355[_0x93b6('0x50')]['id'];}return db[_0x93b6('0x33')][_0x93b6('0x4f')]({'where':{'id':_0x418355[_0x93b6('0x5a')]['id']}})[_0x93b6('0x2c')](handleEntityNotFound(_0x5dab44,null))[_0x93b6('0x2c')](function(_0x459238){if(_0x459238){_0x418355[_0x93b6('0x50')]['DashboardId']=_0x459238['id'];_0x418355[_0x93b6('0x50')][_0x93b6('0x5c')]=widgetAttributes(_0x418355['body']);return db[_0x93b6('0x7c')][_0x93b6('0x57')](_0x418355['body']);}})['then'](respondWithResult(_0x5dab44,null))[_0x93b6('0x4c')](handleError(_0x5dab44,null));};exports['getItems']=function(_0x443f8e,_0x58418b,_0x1ce73f){var _0xdd76e5={};var _0x131d3a={};var _0x340520;var _0x158fec;return db['Dashboard'][_0x93b6('0x7d')]({'where':{'id':_0x443f8e[_0x93b6('0x5a')]['id']}})[_0x93b6('0x2c')](handleEntityNotFound(_0x58418b,null))[_0x93b6('0x2c')](function(_0x9db573){if(_0x9db573){_0x340520=_0x9db573;_0x131d3a[_0x93b6('0x38')]=_[_0x93b6('0x3a')](db['DashboardItem']['rawAttributes']);_0x131d3a[_0x93b6('0x39')]=_[_0x93b6('0x3a')](_0x443f8e[_0x93b6('0x39')]);_0x131d3a[_0x93b6('0x3b')]=_[_0x93b6('0x3c')](_0x131d3a[_0x93b6('0x38')],_0x131d3a[_0x93b6('0x39')]);_0xdd76e5[_0x93b6('0x3d')]=_[_0x93b6('0x3c')](_0x131d3a[_0x93b6('0x38')],qs[_0x93b6('0x3e')](_0x443f8e['query'][_0x93b6('0x3e')]));_0xdd76e5[_0x93b6('0x3d')]=_0xdd76e5['attributes'][_0x93b6('0x3f')]?_0xdd76e5[_0x93b6('0x3d')]:_0x131d3a['model'];_0xdd76e5[_0x93b6('0x42')]=qs[_0x93b6('0x43')](_0x443f8e[_0x93b6('0x39')][_0x93b6('0x43')]);_0xdd76e5[_0x93b6('0x46')]=qs[_0x93b6('0x3b')](_[_0x93b6('0x44')](_0x443f8e['query'],_0x131d3a[_0x93b6('0x3b')]));if(_0x443f8e[_0x93b6('0x39')][_0x93b6('0x45')]){_0xdd76e5['where']=_[_0x93b6('0x47')](_0xdd76e5['where'],{'$or':_[_0x93b6('0x32')](_0xdd76e5['attributes'],function(_0x2f642b){var _0x59c984={};_0x59c984[_0x2f642b]={'$like':'%'+_0x443f8e[_0x93b6('0x39')][_0x93b6('0x45')]+'%'};return _0x59c984;})});}_0xdd76e5=_['merge']({},_0xdd76e5,_0x443f8e['options']);return _0x340520[_0x93b6('0x7e')](_0xdd76e5);}})['then'](function(_0x2ab957){if(_0x2ab957){_0x158fec=_0x2ab957[_0x93b6('0x3f')];if(!_0x443f8e[_0x93b6('0x39')]['hasOwnProperty'](_0x93b6('0x41'))){_0xdd76e5[_0x93b6('0x24')]=qs[_0x93b6('0x24')](_0x443f8e['query'][_0x93b6('0x24')]);_0xdd76e5[_0x93b6('0x22')]=qs[_0x93b6('0x22')](_0x443f8e[_0x93b6('0x39')][_0x93b6('0x22')]);}return _0x340520[_0x93b6('0x7e')](_0xdd76e5);}})[_0x93b6('0x2c')](function(_0x5125a6){if(_0x5125a6){return _0x5125a6?{'count':_0x158fec,'rows':_0x5125a6}:null;}})[_0x93b6('0x2c')](respondWithResult(_0x58418b,null))[_0x93b6('0x4c')](handleError(_0x58418b,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 74809c2..c9c9cbf 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 _0x8294=['../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty','hook','events'];(function(_0x52cd3a,_0x4e3609){var _0x5b41e8=function(_0x742310){while(--_0x742310){_0x52cd3a['push'](_0x52cd3a['shift']());}};_0x5b41e8(++_0x4e3609);}(_0x8294,0x1c6));var _0x4829=function(_0x830690,_0x18b311){_0x830690=_0x830690-0x0;var _0x483ab2=_0x8294[_0x830690];return _0x483ab2;};'use strict';var EventEmitter=require(_0x4829('0x0'));var Dashboard=require(_0x4829('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x4829('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x4829('0x3')};function emitEvent(_0x31c3ac){return function(_0x27a714,_0x494a7d,_0x1cbde3){DashboardEvents['emit'](_0x31c3ac+':'+_0x27a714['id'],_0x27a714);DashboardEvents[_0x4829('0x4')](_0x31c3ac,_0x27a714);_0x1cbde3(null);};}for(var e in events){if(events[_0x4829('0x5')](e)){var event=events[e];Dashboard[_0x4829('0x6')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0xe0a6=['emit','hasOwnProperty','hook','exports','Dashboard','setMaxListeners','save','update','remove'];(function(_0x4a2501,_0x5c68be){var _0x304500=function(_0x4ea73b){while(--_0x4ea73b){_0x4a2501['push'](_0x4a2501['shift']());}};_0x304500(++_0x5c68be);}(_0xe0a6,0x1ea));var _0x6e0a=function(_0x2ba948,_0x18646b){_0x2ba948=_0x2ba948-0x0;var _0x419ed3=_0xe0a6[_0x2ba948];return _0x419ed3;};'use strict';var EventEmitter=require('events');var Dashboard=require('../../mysqldb')['db'][_0x6e0a('0x0')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x6e0a('0x1')](0x0);var events={'afterCreate':_0x6e0a('0x2'),'afterUpdate':_0x6e0a('0x3'),'afterDestroy':_0x6e0a('0x4')};function emitEvent(_0x11aa8c){return function(_0x523085,_0x5ca371,_0xfaf01c){DashboardEvents[_0x6e0a('0x5')](_0x11aa8c+':'+_0x523085['id'],_0x523085);DashboardEvents[_0x6e0a('0x5')](_0x11aa8c,_0x523085);_0xfaf01c(null);};}for(var e in events){if(events[_0x6e0a('0x6')](e)){var event=events[e];Dashboard[_0x6e0a('0x7')](e,emitEvent(event));}}module[_0x6e0a('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index a6e3162..a89b11d 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 _0xad95=['../../config/environment','define','Dashboard','dashboards','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x316c15,_0x832101){var _0x42b2b6=function(_0x5c702c){while(--_0x5c702c){_0x316c15['push'](_0x316c15['shift']());}};_0x42b2b6(++_0x832101);}(_0xad95,0x70));var _0x5ad9=function(_0x30bff5,_0xf80950){_0x30bff5=_0x30bff5-0x0;var _0x26389c=_0xad95[_0x30bff5];return _0x26389c;};'use strict';var _=require(_0x5ad9('0x0'));var util=require(_0x5ad9('0x1'));var logger=require(_0x5ad9('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5ad9('0x3'));var rp=require(_0x5ad9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5ad9('0x5'));var attributes=require('./dashboard.attributes');module['exports']=function(_0x5e4279,_0x5b81f9){return _0x5e4279[_0x5ad9('0x6')](_0x5ad9('0x7'),attributes,{'tableName':_0x5ad9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb633=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util'];(function(_0xf2e13d,_0x424179){var _0x26e9a1=function(_0x422aa2){while(--_0x422aa2){_0xf2e13d['push'](_0xf2e13d['shift']());}};_0x26e9a1(++_0x424179);}(_0xb633,0x1be));var _0x3b63=function(_0x1e82b6,_0x4d8f82){_0x1e82b6=_0x1e82b6-0x0;var _0x5eaa3c=_0xb633[_0x1e82b6];return _0x5eaa3c;};'use strict';var _=require(_0x3b63('0x0'));var util=require(_0x3b63('0x1'));var logger=require(_0x3b63('0x2'))(_0x3b63('0x3'));var moment=require(_0x3b63('0x4'));var BPromise=require('bluebird');var rp=require(_0x3b63('0x5'));var fs=require('fs');var path=require(_0x3b63('0x6'));var rimraf=require(_0x3b63('0x7'));var config=require(_0x3b63('0x8'));var attributes=require(_0x3b63('0x9'));module[_0x3b63('0xa')]=function(_0x5608ba,_0x3151b5){return _0x5608ba[_0x3b63('0xb')](_0x3b63('0xc'),attributes,{'tableName':_0x3b63('0xd'),'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 daee334..a132b2b 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 _0xc5fd=['client','http','defaults','socket.io-emitter','redis','./dashboard.socket','then','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','Dashboard,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc5fd,0xfa));var _0xdc5f=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0xc5fd[_0x2555d0];return _0x3bb486;};'use strict';var _=require(_0xdc5f('0x0'));var util=require(_0xdc5f('0x1'));var moment=require(_0xdc5f('0x2'));var BPromise=require(_0xdc5f('0x3'));var rs=require(_0xdc5f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdc5f('0x5'))['db'];var utils=require(_0xdc5f('0x6'));var logger=require(_0xdc5f('0x7'))(_0xdc5f('0x8'));var config=require(_0xdc5f('0x9'));var jayson=require(_0xdc5f('0xa'));var client=jayson[_0xdc5f('0xb')][_0xdc5f('0xc')]({'port':0x232a});config['redis']=_[_0xdc5f('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xdc5f('0xe'))(new Redis(config[_0xdc5f('0xf')]));require(_0xdc5f('0x10'))['register'](socket);function respondWithRpcPromise(_0x186d46,_0x588d4e,_0x141650){return new BPromise(function(_0x27f71b,_0x14f6db){return client['request'](_0x186d46,_0x141650)[_0xdc5f('0x11')](function(_0x43bc30){logger[_0xdc5f('0x12')]('Dashboard,\x20%s,\x20%s',_0x588d4e,_0xdc5f('0x13'));logger[_0xdc5f('0x14')](_0xdc5f('0x15'),_0x588d4e,_0xdc5f('0x13'),JSON[_0xdc5f('0x16')](_0x43bc30));if(_0x43bc30['error']){if(_0x43bc30[_0xdc5f('0x17')][_0xdc5f('0x18')]===0x1f4){logger[_0xdc5f('0x17')](_0xdc5f('0x19'),_0x588d4e,_0x43bc30['error'][_0xdc5f('0x1a')]);return _0x14f6db(_0x43bc30['error']['message']);}logger[_0xdc5f('0x17')](_0xdc5f('0x19'),_0x588d4e,_0x43bc30['error'][_0xdc5f('0x1a')]);return _0x27f71b(_0x43bc30[_0xdc5f('0x17')][_0xdc5f('0x1a')]);}else{logger['info'](_0xdc5f('0x19'),_0x588d4e,_0xdc5f('0x13'));_0x27f71b(_0x43bc30[_0xdc5f('0x1b')]['message']);}})[_0xdc5f('0x1c')](function(_0x530c75){logger[_0xdc5f('0x17')]('Dashboard,\x20%s,\x20%s',_0x588d4e,_0x530c75);_0x14f6db(_0x530c75);});});} \ No newline at end of file +var _0x828d=['info','request\x20sent','stringify','error','code','Dashboard,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboard.socket','request'];(function(_0x33674c,_0x33f38b){var _0x221fa7=function(_0x241529){while(--_0x241529){_0x33674c['push'](_0x33674c['shift']());}};_0x221fa7(++_0x33f38b);}(_0x828d,0xb7));var _0xd828=function(_0x409a8f,_0xa8d109){_0x409a8f=_0x409a8f-0x0;var _0x548c1e=_0x828d[_0x409a8f];return _0x548c1e;};'use strict';var _=require(_0xd828('0x0'));var util=require(_0xd828('0x1'));var moment=require(_0xd828('0x2'));var BPromise=require(_0xd828('0x3'));var rs=require(_0xd828('0x4'));var fs=require('fs');var Redis=require(_0xd828('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd828('0x6'))(_0xd828('0x7'));var config=require(_0xd828('0x8'));var jayson=require(_0xd828('0x9'));var client=jayson[_0xd828('0xa')][_0xd828('0xb')]({'port':0x232a});config[_0xd828('0xc')]=_['defaults'](config[_0xd828('0xc')],{'host':_0xd828('0xd'),'port':0x18eb});var socket=require(_0xd828('0xe'))(new Redis(config[_0xd828('0xc')]));require(_0xd828('0xf'))['register'](socket);function respondWithRpcPromise(_0x4cbe0e,_0x48c3e8,_0x4bb91a){return new BPromise(function(_0x193fd0,_0x2a8eeb){return client[_0xd828('0x10')](_0x4cbe0e,_0x4bb91a)['then'](function(_0x58e20f){logger[_0xd828('0x11')]('Dashboard,\x20%s,\x20%s',_0x48c3e8,_0xd828('0x12'));logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0x48c3e8,_0xd828('0x12'),JSON[_0xd828('0x13')](_0x58e20f));if(_0x58e20f[_0xd828('0x14')]){if(_0x58e20f[_0xd828('0x14')][_0xd828('0x15')]===0x1f4){logger[_0xd828('0x14')](_0xd828('0x16'),_0x48c3e8,_0x58e20f[_0xd828('0x14')]['message']);return _0x2a8eeb(_0x58e20f[_0xd828('0x14')][_0xd828('0x17')]);}logger['error'](_0xd828('0x16'),_0x48c3e8,_0x58e20f[_0xd828('0x14')][_0xd828('0x17')]);return _0x193fd0(_0x58e20f[_0xd828('0x14')][_0xd828('0x17')]);}else{logger[_0xd828('0x11')](_0xd828('0x16'),_0x48c3e8,_0xd828('0x12'));_0x193fd0(_0x58e20f['result'][_0xd828('0x17')]);}})[_0xd828('0x18')](function(_0x5a9f90){logger[_0xd828('0x14')]('Dashboard,\x20%s,\x20%s',_0x48c3e8,_0x5a9f90);_0x2a8eeb(_0x5a9f90);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 4f9373f..9b30145 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 _0x5349=['./dashboard.events','save','update','emit','length','dashboard:'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x5349,0xae));var _0x9534=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x5349[_0x8de54f];return _0x14cba4;};'use strict';var DashboardEvents=require(_0x9534('0x0'));var events=[_0x9534('0x1'),'remove',_0x9534('0x2')];function createListener(_0x316125,_0x5d3442){return function(_0x291bb9){_0x5d3442[_0x9534('0x3')](_0x316125,_0x291bb9);};}function removeListener(_0x2e2334,_0x4808bb){return function(){DashboardEvents['removeListener'](_0x2e2334,_0x4808bb);};}exports['register']=function(_0x2469c5){for(var _0x4f6dab=0x0,_0x533de6=events[_0x9534('0x4')];_0x4f6dab<_0x533de6;_0x4f6dab++){var _0x14e884=events[_0x4f6dab];var _0x10d732=createListener(_0x9534('0x5')+_0x14e884,_0x2469c5);DashboardEvents['on'](_0x14e884,_0x10d732);}}; \ No newline at end of file +var _0x8639=['dashboard:','./dashboard.events','save','remove','update','removeListener','register','length'];(function(_0x4634b8,_0x119be8){var _0x520991=function(_0x56605c){while(--_0x56605c){_0x4634b8['push'](_0x4634b8['shift']());}};_0x520991(++_0x119be8);}(_0x8639,0xb9));var _0x9863=function(_0x2a43b1,_0x3ebd77){_0x2a43b1=_0x2a43b1-0x0;var _0x56f4d3=_0x8639[_0x2a43b1];return _0x56f4d3;};'use strict';var DashboardEvents=require(_0x9863('0x0'));var events=[_0x9863('0x1'),_0x9863('0x2'),_0x9863('0x3')];function createListener(_0x59dd16,_0x1db69b){return function(_0x4ae7d8){_0x1db69b['emit'](_0x59dd16,_0x4ae7d8);};}function removeListener(_0x37f202,_0x10d3d9){return function(){DashboardEvents[_0x9863('0x4')](_0x37f202,_0x10d3d9);};}exports[_0x9863('0x5')]=function(_0x55dc0f){for(var _0x4e6514=0x0,_0x197802=events[_0x9863('0x6')];_0x4e6514<_0x197802;_0x4e6514++){var _0x40924e=events[_0x4e6514];var _0x148cdb=createListener(_0x9863('0x7')+_0x40924e,_0x55dc0f);DashboardEvents['on'](_0x40924e,_0x148cdb);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index f27b20d..7824083 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 _0xe5e7=['Router','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','create','post','/:id/clone','clone','addItem','put','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x44f4c5,_0x60cd8b){var _0x35cf6a=function(_0x43a904){while(--_0x43a904){_0x44f4c5['push'](_0x44f4c5['shift']());}};_0x35cf6a(++_0x60cd8b);}(_0xe5e7,0xf9));var _0x7e5e=function(_0x10d6c4,_0xce2013){_0x10d6c4=_0x10d6c4-0x0;var _0x3096f0=_0xe5e7[_0x10d6c4];return _0x3096f0;};'use strict';var multer=require(_0x7e5e('0x0'));var util=require(_0x7e5e('0x1'));var path=require(_0x7e5e('0x2'));var timeout=require(_0x7e5e('0x3'));var express=require('express');var router=express[_0x7e5e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7e5e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7e5e('0x6'));var controller=require(_0x7e5e('0x7'));router[_0x7e5e('0x8')]('/',auth[_0x7e5e('0x9')](),controller[_0x7e5e('0xa')]);router[_0x7e5e('0x8')](_0x7e5e('0xb'),auth['isAuthenticated'](),controller[_0x7e5e('0xc')]);router[_0x7e5e('0x8')](_0x7e5e('0xd'),auth[_0x7e5e('0x9')](),controller['getItems']);router['post']('/',auth['isAuthenticated'](),controller[_0x7e5e('0xe')]);router[_0x7e5e('0xf')](_0x7e5e('0x10'),auth[_0x7e5e('0x9')](),controller[_0x7e5e('0x11')]);router['post'](_0x7e5e('0xd'),auth[_0x7e5e('0x9')](),controller[_0x7e5e('0x12')]);router[_0x7e5e('0x13')]('/:id',auth[_0x7e5e('0x9')](),controller['update']);router[_0x7e5e('0x14')](_0x7e5e('0xb'),auth[_0x7e5e('0x9')](),controller[_0x7e5e('0x15')]);module[_0x7e5e('0x16')]=router; \ No newline at end of file +var _0xec16=['exports','multer','util','path','connect-timeout','Router','./dashboard.controller','get','index','/:id','isAuthenticated','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','update','delete'];(function(_0x51276e,_0x28b616){var _0x1f5f30=function(_0x3ab106){while(--_0x3ab106){_0x51276e['push'](_0x51276e['shift']());}};_0x1f5f30(++_0x28b616);}(_0xec16,0xa9));var _0x6ec1=function(_0x5a4a1f,_0x3f90b6){_0x5a4a1f=_0x5a4a1f-0x0;var _0x43db26=_0xec16[_0x5a4a1f];return _0x43db26;};'use strict';var multer=require(_0x6ec1('0x0'));var util=require(_0x6ec1('0x1'));var path=require(_0x6ec1('0x2'));var timeout=require(_0x6ec1('0x3'));var express=require('express');var router=express[_0x6ec1('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6ec1('0x5'));router[_0x6ec1('0x6')]('/',auth['isAuthenticated'](),controller[_0x6ec1('0x7')]);router[_0x6ec1('0x6')](_0x6ec1('0x8'),auth[_0x6ec1('0x9')](),controller['show']);router['get'](_0x6ec1('0xa'),auth[_0x6ec1('0x9')](),controller[_0x6ec1('0xb')]);router[_0x6ec1('0xc')]('/',auth['isAuthenticated'](),controller[_0x6ec1('0xd')]);router[_0x6ec1('0xc')](_0x6ec1('0xe'),auth[_0x6ec1('0x9')](),controller[_0x6ec1('0xf')]);router[_0x6ec1('0xc')](_0x6ec1('0xa'),auth[_0x6ec1('0x9')](),controller[_0x6ec1('0x10')]);router[_0x6ec1('0x11')]('/:id',auth[_0x6ec1('0x9')](),controller[_0x6ec1('0x12')]);router[_0x6ec1('0x13')](_0x6ec1('0x8'),auth[_0x6ec1('0x9')](),controller['destroy']);module[_0x6ec1('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index f73a294..33b121e 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 _0xc1c6=['long','parse','setDataValue','stringify','attrs','INTEGER','#ffffff','sequelize','squel','lodash','STRING','TEXT'];(function(_0x3d2ebd,_0x46bce1){var _0x9e397e=function(_0x27c59e){while(--_0x27c59e){_0x3d2ebd['push'](_0x3d2ebd['shift']());}};_0x9e397e(++_0x46bce1);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x20b859,_0x535d59){_0x20b859=_0x20b859-0x0;var _0x5b7840=_0xc1c6[_0x20b859];return _0x5b7840;};'use strict';var Sequelize=require(_0x6c1c('0x0'));var squel=require(_0x6c1c('0x1'));var _=require(_0x6c1c('0x2'));module['exports']={'title':{'type':Sequelize[_0x6c1c('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x6c1c('0x4')](_0x6c1c('0x5')),'get':function(){try{return JSON[_0x6c1c('0x6')](this['getDataValue']('attrs'));}catch(_0x32af84){return[];}},'set':function(_0x524a6b){try{this[_0x6c1c('0x7')]('attrs',JSON[_0x6c1c('0x8')](_0x524a6b));}catch(_0x2eb1ba){this[_0x6c1c('0x7')](_0x6c1c('0x9'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x6c1c('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x6c1c('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x6c1c('0xa')]},'background':{'type':Sequelize[_0x6c1c('0x3')],'allowNull':![],'defaultValue':_0x6c1c('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x6c1c('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x6c1c('0x3')]},'titleFontSize':{'type':Sequelize[_0x6c1c('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0x2542=['exports','STRING','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash'];(function(_0x81dcac,_0x8ff7db){var _0xc7803b=function(_0x499b29){while(--_0x499b29){_0x81dcac['push'](_0x81dcac['shift']());}};_0xc7803b(++_0x8ff7db);}(_0x2542,0x169));var _0x2254=function(_0x32c79f,_0x1f8cef){_0x32c79f=_0x32c79f-0x0;var _0x27ae75=_0x2542[_0x32c79f];return _0x27ae75;};'use strict';var Sequelize=require(_0x2254('0x0'));var squel=require(_0x2254('0x1'));var _=require(_0x2254('0x2'));module[_0x2254('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x2254('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x2254('0x5')),'get':function(){try{return JSON[_0x2254('0x6')](this[_0x2254('0x7')](_0x2254('0x8')));}catch(_0x76c902){return[];}},'set':function(_0x508183){try{this[_0x2254('0x9')](_0x2254('0x8'),JSON[_0x2254('0xa')](_0x508183));}catch(_0x3c45ec){this[_0x2254('0x9')](_0x2254('0x8'),JSON[_0x2254('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x2254('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x2254('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x2254('0xb')]},'col':{'type':Sequelize[_0x2254('0xb')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2254('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x2254('0x4')],'allowNull':![],'defaultValue':_0x2254('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x2254('0x4')]},'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 66585db..7672242 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 _0x938d=['rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','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','redis','defaults','localhost','socket.io-emitter','sendStatus','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','params','model','keys','DashboardItem','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','options','catch','find','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format'];(function(_0x44d17a,_0x219c54){var _0x8ee2bb=function(_0x2707e5){while(--_0x2707e5){_0x44d17a['push'](_0x44d17a['shift']());}};_0x8ee2bb(++_0x219c54);}(_0x938d,0x122));var _0xd938=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x938d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd938('0x0'));var rimraf=require(_0xd938('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd938('0x2'));var rp=require(_0xd938('0x3'));var moment=require(_0xd938('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd938('0x5'));var path=require(_0xd938('0x6'));var sox=require(_0xd938('0x7'));var csv=require('to-csv');var ejs=require(_0xd938('0x8'));var fs=require('fs');var fs_extra=require(_0xd938('0x9'));var _=require(_0xd938('0xa'));var squel=require(_0xd938('0xb'));var crypto=require(_0xd938('0xc'));var jsforce=require(_0xd938('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd938('0xe'));var querystring=require(_0xd938('0xf'));var Papa=require(_0xd938('0x10'));var Redis=require(_0xd938('0x11'));var authService=require(_0xd938('0x12'));var qs=require(_0xd938('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd938('0x14'));var logger=require(_0xd938('0x15'))(_0xd938('0x16'));var utils=require(_0xd938('0x17'));var config=require(_0xd938('0x18'));var licenseUtil=require(_0xd938('0x19'));var db=require(_0xd938('0x1a'))['db'];config[_0xd938('0x1b')]=_[_0xd938('0x1c')](config[_0xd938('0x1b')],{'host':_0xd938('0x1d'),'port':0x18eb});var socket=require(_0xd938('0x1e'))(new Redis(config[_0xd938('0x1b')]));require('./dashboardItem.socket')['register'](socket);function respondWithStatusCode(_0x5c9f99,_0x2f07e7){_0x2f07e7=_0x2f07e7||0xcc;return function(_0x12b804){if(_0x12b804){return _0x5c9f99[_0xd938('0x1f')](_0x2f07e7);}return _0x5c9f99['status'](_0x2f07e7)['end']();};}function respondWithResult(_0x9ab113,_0x33921f){_0x33921f=_0x33921f||0xc8;return function(_0x4de1aa){if(_0x4de1aa){return _0x9ab113['status'](_0x33921f)['json'](_0x4de1aa);}};}function respondWithFilteredResult(_0x352648,_0x1e3c7f){return function(_0x355185){if(_0x355185){var _0x54b652=typeof _0x1e3c7f[_0xd938('0x20')]===_0xd938('0x21')&&typeof _0x1e3c7f[_0xd938('0x22')]===_0xd938('0x21');var _0x1f31bc=_0x355185['count'];var _0x3fa45c=_0x54b652?0x0:_0x1e3c7f['offset'];var _0x5a783f=_0x54b652?_0x355185[_0xd938('0x23')]:_0x1e3c7f['offset']+_0x1e3c7f[_0xd938('0x22')];var _0x2f8bf2;if(_0x5a783f>=_0x1f31bc){_0x5a783f=_0x1f31bc;_0x2f8bf2=0xc8;}else{_0x2f8bf2=0xce;}_0x352648[_0xd938('0x24')](_0x2f8bf2);return _0x352648[_0xd938('0x25')](_0xd938('0x26'),_0x3fa45c+'-'+_0x5a783f+'/'+_0x1f31bc)['json'](_0x355185);}return null;};}function patchUpdates(_0x20e9f9){return function(_0x18d427){try{jsonpatch[_0xd938('0x27')](_0x18d427,_0x20e9f9,!![]);}catch(_0x3afd46){return BPromise[_0xd938('0x28')](_0x3afd46);}return _0x18d427[_0xd938('0x29')]();};}function saveUpdates(_0x2f571b,_0x114e02){return function(_0x2385de){if(_0x2385de){return _0x2385de[_0xd938('0x2a')](_0x2f571b)[_0xd938('0x2b')](function(_0x5bc216){return _0x5bc216;});}return null;};}function removeEntity(_0x595d85,_0x30dbd7){return function(_0x316835){if(_0x316835){return _0x316835[_0xd938('0x2c')]()['then'](function(){_0x595d85[_0xd938('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cd8aa,_0x5e931d){return function(_0x43fc62){if(!_0x43fc62){_0x1cd8aa['sendStatus'](0x194);}return _0x43fc62;};}function handleError(_0x1f0f53,_0x706f76){_0x706f76=_0x706f76||0x1f4;return function(_0x37c08f){logger[_0xd938('0x2d')](_0x37c08f['stack']);if(_0x37c08f[_0xd938('0x2e')]){delete _0x37c08f[_0xd938('0x2e')];}_0x1f0f53[_0xd938('0x24')](_0x706f76)[_0xd938('0x2f')](_0x37c08f);};}exports['show']=function(_0x2442ca,_0x350e6e){var _0xd55990={'raw':![],'where':{'id':_0x2442ca[_0xd938('0x30')]['id']}},_0x4bf006={};_0x4bf006[_0xd938('0x31')]=_[_0xd938('0x32')](db[_0xd938('0x33')][_0xd938('0x34')]);_0x4bf006[_0xd938('0x35')]=_[_0xd938('0x32')](_0x2442ca[_0xd938('0x35')]);_0x4bf006['filters']=_[_0xd938('0x36')](_0x4bf006[_0xd938('0x31')],_0x4bf006[_0xd938('0x35')]);_0xd55990[_0xd938('0x37')]=_['intersection'](_0x4bf006[_0xd938('0x31')],qs[_0xd938('0x38')](_0x2442ca[_0xd938('0x35')][_0xd938('0x38')]));_0xd55990['attributes']=_0xd55990[_0xd938('0x37')][_0xd938('0x39')]?_0xd55990[_0xd938('0x37')]:_0x4bf006[_0xd938('0x31')];if(_0x2442ca['query'][_0xd938('0x3a')]){_0xd55990[_0xd938('0x3b')]=[{'all':!![]}];}_0xd55990=_['merge']({},_0xd55990,_0x2442ca[_0xd938('0x3c')]);return db['DashboardItem']['find'](_0xd55990)[_0xd938('0x2b')](handleEntityNotFound(_0x350e6e,null))[_0xd938('0x2b')](respondWithResult(_0x350e6e,null))[_0xd938('0x3d')](handleError(_0x350e6e,null));};exports['destroy']=function(_0x35461c,_0x100594){return db[_0xd938('0x33')][_0xd938('0x3e')]({'where':{'id':_0x35461c['params']['id']}})['then'](handleEntityNotFound(_0x100594,null))[_0xd938('0x2b')](removeEntity(_0x100594,null))[_0xd938('0x3d')](handleError(_0x100594,null));};function widgetAttributes(_0x5e49e0){try{switch(_0x5e49e0['type']){case'iframe':return[{'name':_0xd938('0x3f'),'value':_0x5e49e0[_0xd938('0x3f')]||(_0x5e49e0[_0xd938('0x40')]&&_0x5e49e0[_0xd938('0x40')][0x0]?_0x5e49e0[_0xd938('0x40')][0x0][_0xd938('0x41')]:undefined)||'https://'}];case _0xd938('0x42'):return[{'name':_0xd938('0x43'),'value':_0x5e49e0[_0xd938('0x43')]||(_0x5e49e0['attrs']&&_0x5e49e0['attrs'][0x0]?_0x5e49e0[_0xd938('0x40')][0x0]['value']:undefined)||''}];case _0xd938('0x44'):return[{'name':_0xd938('0x45'),'value':_0x5e49e0[_0xd938('0x45')]||(_0x5e49e0[_0xd938('0x40')]&&_0x5e49e0[_0xd938('0x40')][0x0]?_0x5e49e0[_0xd938('0x40')][0x0][_0xd938('0x41')]:undefined)||'HH:mm:ss'},{'name':_0xd938('0x46'),'value':_0x5e49e0[_0xd938('0x46')]||(_0x5e49e0[_0xd938('0x40')]&&_0x5e49e0[_0xd938('0x40')][0x1]?_0x5e49e0[_0xd938('0x40')][0x1][_0xd938('0x41')]:undefined)||_0xd938('0x47')},{'name':'attrFontSize','value':_0x5e49e0[_0xd938('0x48')]||(_0x5e49e0[_0xd938('0x40')]&&_0x5e49e0['attrs'][0x2]?_0x5e49e0[_0xd938('0x40')][0x2][_0xd938('0x41')]:undefined)||0xc}];case'counter':return[{'name':_0xd938('0x49'),'value':_0x5e49e0[_0xd938('0x49')]||(_0x5e49e0[_0xd938('0x40')]&&_0x5e49e0[_0xd938('0x40')][0x0]?_0x5e49e0['attrs'][0x0]['value']:undefined)||_0xd938('0x4a')},{'name':_0xd938('0x4b'),'value':_0x5e49e0[_0xd938('0x4b')]||(_0x5e49e0[_0xd938('0x40')]&&_0x5e49e0[_0xd938('0x40')][0x1]?_0x5e49e0['attrs'][0x1][_0xd938('0x41')]:undefined)||[]},{'name':_0xd938('0x48'),'value':_0x5e49e0['attrFontSize']||(_0x5e49e0[_0xd938('0x40')]&&_0x5e49e0['attrs'][0x2]?_0x5e49e0[_0xd938('0x40')][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x5e49e0[_0xd938('0x4c')]||(_0x5e49e0['attrs']&&_0x5e49e0[_0xd938('0x40')][0x3]?_0x5e49e0[_0xd938('0x40')][0x3]['value']:undefined)||_0xd938('0x4d')},{'name':_0xd938('0x4e'),'value':_0x5e49e0['attrEmailAccounts']||(_0x5e49e0[_0xd938('0x40')]&&_0x5e49e0[_0xd938('0x40')][0x4]?_0x5e49e0['attrs'][0x4][_0xd938('0x41')]:undefined)||''},{'name':_0xd938('0x4f'),'value':_0x5e49e0[_0xd938('0x4f')]||(_0x5e49e0[_0xd938('0x40')]&&_0x5e49e0[_0xd938('0x40')][0x5]?_0x5e49e0[_0xd938('0x40')][0x5][_0xd938('0x41')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x5e49e0[_0xd938('0x50')]||(_0x5e49e0[_0xd938('0x40')]&&_0x5e49e0[_0xd938('0x40')][0x6]?_0x5e49e0[_0xd938('0x40')][0x6][_0xd938('0x41')]:undefined)||''},{'name':_0xd938('0x51'),'value':_0x5e49e0['attrOpenchannelAccounts']||(_0x5e49e0[_0xd938('0x40')]&&_0x5e49e0[_0xd938('0x40')][0x7]?_0x5e49e0[_0xd938('0x40')][0x7][_0xd938('0x41')]:undefined)||''},{'name':_0xd938('0x52'),'value':_0x5e49e0[_0xd938('0x52')]||(_0x5e49e0[_0xd938('0x40')]&&_0x5e49e0[_0xd938('0x40')][0x8]?_0x5e49e0[_0xd938('0x40')][0x8][_0xd938('0x41')]:undefined)||''},{'name':_0xd938('0x53'),'value':_0x5e49e0[_0xd938('0x53')]||(_0x5e49e0['attrs']&&_0x5e49e0['attrs'][0x9]?_0x5e49e0['attrs'][0x9][_0xd938('0x41')]:undefined)||''}];case _0xd938('0x54'):case _0xd938('0x55'):return[{'name':_0xd938('0x56'),'value':_0x5e49e0[_0xd938('0x56')]||(_0x5e49e0[_0xd938('0x40')]&&_0x5e49e0[_0xd938('0x40')][0x0]?_0x5e49e0['attrs'][0x0]['value']:undefined)||_0xd938('0x4a')},{'name':_0xd938('0x57'),'value':_0x5e49e0[_0xd938('0x57')]||(_0x5e49e0['attrs']&&_0x5e49e0[_0xd938('0x40')][0x1]?_0x5e49e0[_0xd938('0x40')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x5e49e0[_0xd938('0x58')]||(_0x5e49e0['attrs']&&_0x5e49e0[_0xd938('0x40')][0x2]?_0x5e49e0[_0xd938('0x40')][0x2][_0xd938('0x41')]:undefined)||null},{'name':_0xd938('0x4b'),'value':_0x5e49e0[_0xd938('0x4b')]||(_0x5e49e0[_0xd938('0x40')]&&_0x5e49e0[_0xd938('0x40')][0x3]?_0x5e49e0['attrs'][0x3][_0xd938('0x41')]:undefined)||[]},{'name':_0xd938('0x4c'),'value':_0x5e49e0[_0xd938('0x4c')]||(_0x5e49e0['attrs']&&_0x5e49e0[_0xd938('0x40')][0x4]?_0x5e49e0[_0xd938('0x40')][0x4][_0xd938('0x41')]:undefined)||_0xd938('0x4d')},{'name':_0xd938('0x4e'),'value':_0x5e49e0['attrEmailAccounts']||(_0x5e49e0[_0xd938('0x40')]&&_0x5e49e0[_0xd938('0x40')][0x5]?_0x5e49e0[_0xd938('0x40')][0x5][_0xd938('0x41')]:undefined)||''},{'name':_0xd938('0x4f'),'value':_0x5e49e0['attrFaxAccounts']||(_0x5e49e0[_0xd938('0x40')]&&_0x5e49e0[_0xd938('0x40')][0x6]?_0x5e49e0[_0xd938('0x40')][0x6][_0xd938('0x41')]:undefined)||''},{'name':_0xd938('0x50'),'value':_0x5e49e0[_0xd938('0x50')]||(_0x5e49e0[_0xd938('0x40')]&&_0x5e49e0['attrs'][0x7]?_0x5e49e0[_0xd938('0x40')][0x7][_0xd938('0x41')]:undefined)||''},{'name':_0xd938('0x51'),'value':_0x5e49e0['attrOpenchannelAccounts']||(_0x5e49e0['attrs']&&_0x5e49e0[_0xd938('0x40')][0x8]?_0x5e49e0[_0xd938('0x40')][0x8][_0xd938('0x41')]:undefined)||''},{'name':_0xd938('0x52'),'value':_0x5e49e0[_0xd938('0x52')]||(_0x5e49e0[_0xd938('0x40')]&&_0x5e49e0[_0xd938('0x40')][0x9]?_0x5e49e0[_0xd938('0x40')][0x9][_0xd938('0x41')]:undefined)||''},{'name':_0xd938('0x53'),'value':_0x5e49e0[_0xd938('0x53')]||(_0x5e49e0['attrs']&&_0x5e49e0[_0xd938('0x40')][0xa]?_0x5e49e0[_0xd938('0x40')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':_0xd938('0x59'),'type':_0x5e49e0[_0xd938('0x5a')]||(_0x5e49e0[_0xd938('0x40')]&&_0x5e49e0['attrs'][0x0]?_0x5e49e0['attrs'][0x0][_0xd938('0x5b')]:undefined)||null,'value':_0x5e49e0[_0xd938('0x59')]||(_0x5e49e0[_0xd938('0x40')]&&_0x5e49e0[_0xd938('0x40')][0x0]?_0x5e49e0[_0xd938('0x40')][0x0][_0xd938('0x41')]:undefined)||null},{'name':_0xd938('0x5c'),'value':_0x5e49e0['attrRefresh']||(_0x5e49e0[_0xd938('0x40')]&&_0x5e49e0['attrs'][0x1]?_0x5e49e0[_0xd938('0x40')][0x1][_0xd938('0x41')]:undefined)||0x0}];default:return[];}}catch(_0xed1a46){logger['error'](_0xd938('0x5d'),JSON[_0xd938('0x5e')](_0xed1a46));return[];}}exports[_0xd938('0x5f')]=function(_0x4e4cb0,_0x436536){if(_0x4e4cb0[_0xd938('0x60')]){_0x4e4cb0[_0xd938('0x60')][_0xd938('0x40')]=widgetAttributes(_0x4e4cb0[_0xd938('0x60')]);}return db[_0xd938('0x33')]['create'](_0x4e4cb0[_0xd938('0x60')],{})[_0xd938('0x2b')](respondWithResult(_0x436536,0xc9))[_0xd938('0x3d')](handleError(_0x436536,null));};exports[_0xd938('0x2a')]=function(_0x226ba7,_0x445aed){if(_0x226ba7[_0xd938('0x60')]['id']){delete _0x226ba7['body']['id'];}_0x226ba7[_0xd938('0x60')][_0xd938('0x40')]=widgetAttributes(_0x226ba7[_0xd938('0x60')]);return db[_0xd938('0x33')][_0xd938('0x3e')]({'where':{'id':_0x226ba7[_0xd938('0x30')]['id']}})[_0xd938('0x2b')](handleEntityNotFound(_0x445aed,null))[_0xd938('0x2b')](saveUpdates(_0x226ba7[_0xd938('0x60')],null))[_0xd938('0x2b')](respondWithResult(_0x445aed,null))['catch'](handleError(_0x445aed,null));}; \ No newline at end of file +var _0xecb2=['query','keys','filters','attributes','intersection','fields','length','includeAll','merge','options','catch','find','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrWhatsappAccounts','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','undefined','limit','count','offset','set','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','model','DashboardItem','rawAttributes'];(function(_0x27b650,_0x485d1a){var _0x31d46f=function(_0x1e1475){while(--_0x1e1475){_0x27b650['push'](_0x27b650['shift']());}};_0x31d46f(++_0x485d1a);}(_0xecb2,0xf6));var _0x2ecb=function(_0xc54cbc,_0x595007){_0xc54cbc=_0xc54cbc-0x0;var _0x443ff9=_0xecb2[_0xc54cbc];return _0x443ff9;};'use strict';var emlformat=require(_0x2ecb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2ecb('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2ecb('0x2'));var Mustache=require(_0x2ecb('0x3'));var util=require(_0x2ecb('0x4'));var path=require(_0x2ecb('0x5'));var sox=require(_0x2ecb('0x6'));var csv=require(_0x2ecb('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2ecb('0x8'));var crypto=require(_0x2ecb('0x9'));var jsforce=require(_0x2ecb('0xa'));var deskjs=require(_0x2ecb('0xb'));var toCsv=require(_0x2ecb('0x7'));var querystring=require('querystring');var Papa=require(_0x2ecb('0xc'));var Redis=require(_0x2ecb('0xd'));var authService=require(_0x2ecb('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x2ecb('0xf'));var hardwareService=require(_0x2ecb('0x10'));var logger=require(_0x2ecb('0x11'))(_0x2ecb('0x12'));var utils=require(_0x2ecb('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2ecb('0x14'));var db=require(_0x2ecb('0x15'))['db'];config[_0x2ecb('0x16')]=_[_0x2ecb('0x17')](config[_0x2ecb('0x16')],{'host':_0x2ecb('0x18'),'port':0x18eb});var socket=require(_0x2ecb('0x19'))(new Redis(config['redis']));require(_0x2ecb('0x1a'))[_0x2ecb('0x1b')](socket);function respondWithStatusCode(_0x48505e,_0x121af9){_0x121af9=_0x121af9||0xcc;return function(_0x2764b4){if(_0x2764b4){return _0x48505e[_0x2ecb('0x1c')](_0x121af9);}return _0x48505e[_0x2ecb('0x1d')](_0x121af9)[_0x2ecb('0x1e')]();};}function respondWithResult(_0x37ea40,_0x3b25e){_0x3b25e=_0x3b25e||0xc8;return function(_0x35620a){if(_0x35620a){return _0x37ea40[_0x2ecb('0x1d')](_0x3b25e)['json'](_0x35620a);}};}function respondWithFilteredResult(_0x1c3e62,_0x2035a0){return function(_0x5a1d41){if(_0x5a1d41){var _0x46e3bc=typeof _0x2035a0['offset']===_0x2ecb('0x1f')&&typeof _0x2035a0[_0x2ecb('0x20')]===_0x2ecb('0x1f');var _0x3101fa=_0x5a1d41[_0x2ecb('0x21')];var _0x46e471=_0x46e3bc?0x0:_0x2035a0[_0x2ecb('0x22')];var _0x586728=_0x46e3bc?_0x5a1d41[_0x2ecb('0x21')]:_0x2035a0[_0x2ecb('0x22')]+_0x2035a0[_0x2ecb('0x20')];var _0x4c8330;if(_0x586728>=_0x3101fa){_0x586728=_0x3101fa;_0x4c8330=0xc8;}else{_0x4c8330=0xce;}_0x1c3e62[_0x2ecb('0x1d')](_0x4c8330);return _0x1c3e62[_0x2ecb('0x23')]('Content-Range',_0x46e471+'-'+_0x586728+'/'+_0x3101fa)['json'](_0x5a1d41);}return null;};}function patchUpdates(_0x2db610){return function(_0x5544ce){try{jsonpatch[_0x2ecb('0x24')](_0x5544ce,_0x2db610,!![]);}catch(_0x2a1834){return BPromise[_0x2ecb('0x25')](_0x2a1834);}return _0x5544ce[_0x2ecb('0x26')]();};}function saveUpdates(_0x1ff315,_0x51e8a6){return function(_0x5208f2){if(_0x5208f2){return _0x5208f2[_0x2ecb('0x27')](_0x1ff315)['then'](function(_0x3fa13f){return _0x3fa13f;});}return null;};}function removeEntity(_0x8f21c,_0x45249b){return function(_0x2d9800){if(_0x2d9800){return _0x2d9800[_0x2ecb('0x28')]()[_0x2ecb('0x29')](function(){_0x8f21c[_0x2ecb('0x1d')](0xcc)[_0x2ecb('0x1e')]();});}};}function handleEntityNotFound(_0x28ee7a,_0x1e2df4){return function(_0x32e88a){if(!_0x32e88a){_0x28ee7a[_0x2ecb('0x1c')](0x194);}return _0x32e88a;};}function handleError(_0x45c0ac,_0x211e0f){_0x211e0f=_0x211e0f||0x1f4;return function(_0x75c8cb){logger[_0x2ecb('0x2a')](_0x75c8cb[_0x2ecb('0x2b')]);if(_0x75c8cb[_0x2ecb('0x2c')]){delete _0x75c8cb[_0x2ecb('0x2c')];}_0x45c0ac[_0x2ecb('0x1d')](_0x211e0f)[_0x2ecb('0x2d')](_0x75c8cb);};}exports[_0x2ecb('0x2e')]=function(_0x4cfa56,_0x52f9f4){var _0x354734={'raw':![],'where':{'id':_0x4cfa56[_0x2ecb('0x2f')]['id']}},_0x3c97d1={};_0x3c97d1[_0x2ecb('0x30')]=_['keys'](db[_0x2ecb('0x31')][_0x2ecb('0x32')]);_0x3c97d1[_0x2ecb('0x33')]=_[_0x2ecb('0x34')](_0x4cfa56[_0x2ecb('0x33')]);_0x3c97d1[_0x2ecb('0x35')]=_['intersection'](_0x3c97d1[_0x2ecb('0x30')],_0x3c97d1['query']);_0x354734[_0x2ecb('0x36')]=_[_0x2ecb('0x37')](_0x3c97d1[_0x2ecb('0x30')],qs[_0x2ecb('0x38')](_0x4cfa56[_0x2ecb('0x33')][_0x2ecb('0x38')]));_0x354734[_0x2ecb('0x36')]=_0x354734[_0x2ecb('0x36')][_0x2ecb('0x39')]?_0x354734['attributes']:_0x3c97d1[_0x2ecb('0x30')];if(_0x4cfa56[_0x2ecb('0x33')][_0x2ecb('0x3a')]){_0x354734['include']=[{'all':!![]}];}_0x354734=_[_0x2ecb('0x3b')]({},_0x354734,_0x4cfa56[_0x2ecb('0x3c')]);return db[_0x2ecb('0x31')]['find'](_0x354734)[_0x2ecb('0x29')](handleEntityNotFound(_0x52f9f4,null))[_0x2ecb('0x29')](respondWithResult(_0x52f9f4,null))[_0x2ecb('0x3d')](handleError(_0x52f9f4,null));};exports[_0x2ecb('0x28')]=function(_0x2aa8ca,_0x29be){return db[_0x2ecb('0x31')][_0x2ecb('0x3e')]({'where':{'id':_0x2aa8ca[_0x2ecb('0x2f')]['id']}})[_0x2ecb('0x29')](handleEntityNotFound(_0x29be,null))['then'](removeEntity(_0x29be,null))[_0x2ecb('0x3d')](handleError(_0x29be,null));};function widgetAttributes(_0x5d9252){try{switch(_0x5d9252[_0x2ecb('0x3f')]){case _0x2ecb('0x40'):return[{'name':_0x2ecb('0x41'),'value':_0x5d9252[_0x2ecb('0x41')]||(_0x5d9252[_0x2ecb('0x42')]&&_0x5d9252[_0x2ecb('0x42')][0x0]?_0x5d9252['attrs'][0x0][_0x2ecb('0x43')]:undefined)||_0x2ecb('0x44')}];case _0x2ecb('0x45'):return[{'name':_0x2ecb('0x46'),'value':_0x5d9252[_0x2ecb('0x46')]||(_0x5d9252[_0x2ecb('0x42')]&&_0x5d9252[_0x2ecb('0x42')][0x0]?_0x5d9252[_0x2ecb('0x42')][0x0][_0x2ecb('0x43')]:undefined)||''}];case _0x2ecb('0x47'):return[{'name':_0x2ecb('0x48'),'value':_0x5d9252[_0x2ecb('0x48')]||(_0x5d9252[_0x2ecb('0x42')]&&_0x5d9252['attrs'][0x0]?_0x5d9252[_0x2ecb('0x42')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0x2ecb('0x49'),'value':_0x5d9252[_0x2ecb('0x49')]||(_0x5d9252[_0x2ecb('0x42')]&&_0x5d9252[_0x2ecb('0x42')][0x1]?_0x5d9252['attrs'][0x1]['value']:undefined)||'0.00'},{'name':_0x2ecb('0x4a'),'value':_0x5d9252['attrFontSize']||(_0x5d9252[_0x2ecb('0x42')]&&_0x5d9252[_0x2ecb('0x42')][0x2]?_0x5d9252[_0x2ecb('0x42')][0x2][_0x2ecb('0x43')]:undefined)||0xc}];case _0x2ecb('0x4b'):return[{'name':_0x2ecb('0x4c'),'value':_0x5d9252[_0x2ecb('0x4c')]||(_0x5d9252[_0x2ecb('0x42')]&&_0x5d9252[_0x2ecb('0x42')][0x0]?_0x5d9252[_0x2ecb('0x42')][0x0][_0x2ecb('0x43')]:undefined)||_0x2ecb('0x4d')},{'name':'attrVoiceQueues','value':_0x5d9252[_0x2ecb('0x4e')]||(_0x5d9252[_0x2ecb('0x42')]&&_0x5d9252['attrs'][0x1]?_0x5d9252[_0x2ecb('0x42')][0x1][_0x2ecb('0x43')]:undefined)||[]},{'name':_0x2ecb('0x4a'),'value':_0x5d9252['attrFontSize']||(_0x5d9252['attrs']&&_0x5d9252[_0x2ecb('0x42')][0x2]?_0x5d9252[_0x2ecb('0x42')][0x2][_0x2ecb('0x43')]:undefined)||0x14},{'name':_0x2ecb('0x4f'),'value':_0x5d9252['attrChannel']||(_0x5d9252[_0x2ecb('0x42')]&&_0x5d9252[_0x2ecb('0x42')][0x3]?_0x5d9252[_0x2ecb('0x42')][0x3][_0x2ecb('0x43')]:undefined)||_0x2ecb('0x50')},{'name':'attrEmailAccounts','value':_0x5d9252[_0x2ecb('0x51')]||(_0x5d9252[_0x2ecb('0x42')]&&_0x5d9252[_0x2ecb('0x42')][0x4]?_0x5d9252[_0x2ecb('0x42')][0x4]['value']:undefined)||''},{'name':_0x2ecb('0x52'),'value':_0x5d9252['attrFaxAccounts']||(_0x5d9252[_0x2ecb('0x42')]&&_0x5d9252[_0x2ecb('0x42')][0x5]?_0x5d9252[_0x2ecb('0x42')][0x5]['value']:undefined)||''},{'name':_0x2ecb('0x53'),'value':_0x5d9252[_0x2ecb('0x53')]||(_0x5d9252['attrs']&&_0x5d9252[_0x2ecb('0x42')][0x6]?_0x5d9252[_0x2ecb('0x42')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x5d9252[_0x2ecb('0x54')]||(_0x5d9252[_0x2ecb('0x42')]&&_0x5d9252[_0x2ecb('0x42')][0x7]?_0x5d9252['attrs'][0x7][_0x2ecb('0x43')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x5d9252['attrWhatsappAccounts']||(_0x5d9252[_0x2ecb('0x42')]&&_0x5d9252[_0x2ecb('0x42')][0x8]?_0x5d9252[_0x2ecb('0x42')][0x8]['value']:undefined)||''},{'name':_0x2ecb('0x55'),'value':_0x5d9252['attrChatWebsites']||(_0x5d9252[_0x2ecb('0x42')]&&_0x5d9252[_0x2ecb('0x42')][0x9]?_0x5d9252[_0x2ecb('0x42')][0x9][_0x2ecb('0x43')]:undefined)||''}];case _0x2ecb('0x56'):case'pie-chart':return[{'name':_0x2ecb('0x57'),'value':_0x5d9252['attrSerie1']||(_0x5d9252['attrs']&&_0x5d9252[_0x2ecb('0x42')][0x0]?_0x5d9252[_0x2ecb('0x42')][0x0][_0x2ecb('0x43')]:undefined)||_0x2ecb('0x4d')},{'name':_0x2ecb('0x58'),'value':_0x5d9252[_0x2ecb('0x58')]||(_0x5d9252[_0x2ecb('0x42')]&&_0x5d9252[_0x2ecb('0x42')][0x1]?_0x5d9252[_0x2ecb('0x42')][0x1][_0x2ecb('0x43')]:undefined)||null},{'name':_0x2ecb('0x59'),'value':_0x5d9252[_0x2ecb('0x59')]||(_0x5d9252['attrs']&&_0x5d9252[_0x2ecb('0x42')][0x2]?_0x5d9252[_0x2ecb('0x42')][0x2][_0x2ecb('0x43')]:undefined)||null},{'name':_0x2ecb('0x4e'),'value':_0x5d9252['attrVoiceQueues']||(_0x5d9252[_0x2ecb('0x42')]&&_0x5d9252[_0x2ecb('0x42')][0x3]?_0x5d9252[_0x2ecb('0x42')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x5d9252['attrChannel']||(_0x5d9252[_0x2ecb('0x42')]&&_0x5d9252[_0x2ecb('0x42')][0x4]?_0x5d9252['attrs'][0x4][_0x2ecb('0x43')]:undefined)||_0x2ecb('0x50')},{'name':'attrEmailAccounts','value':_0x5d9252[_0x2ecb('0x51')]||(_0x5d9252[_0x2ecb('0x42')]&&_0x5d9252[_0x2ecb('0x42')][0x5]?_0x5d9252[_0x2ecb('0x42')][0x5]['value']:undefined)||''},{'name':_0x2ecb('0x52'),'value':_0x5d9252[_0x2ecb('0x52')]||(_0x5d9252['attrs']&&_0x5d9252[_0x2ecb('0x42')][0x6]?_0x5d9252[_0x2ecb('0x42')][0x6]['value']:undefined)||''},{'name':_0x2ecb('0x53'),'value':_0x5d9252[_0x2ecb('0x53')]||(_0x5d9252[_0x2ecb('0x42')]&&_0x5d9252[_0x2ecb('0x42')][0x7]?_0x5d9252['attrs'][0x7][_0x2ecb('0x43')]:undefined)||''},{'name':_0x2ecb('0x54'),'value':_0x5d9252[_0x2ecb('0x54')]||(_0x5d9252[_0x2ecb('0x42')]&&_0x5d9252['attrs'][0x8]?_0x5d9252[_0x2ecb('0x42')][0x8][_0x2ecb('0x43')]:undefined)||''},{'name':_0x2ecb('0x5a'),'value':_0x5d9252[_0x2ecb('0x5a')]||(_0x5d9252[_0x2ecb('0x42')]&&_0x5d9252[_0x2ecb('0x42')][0x9]?_0x5d9252['attrs'][0x9][_0x2ecb('0x43')]:undefined)||''},{'name':_0x2ecb('0x55'),'value':_0x5d9252[_0x2ecb('0x55')]||(_0x5d9252[_0x2ecb('0x42')]&&_0x5d9252[_0x2ecb('0x42')][0xa]?_0x5d9252[_0x2ecb('0x42')][0xa][_0x2ecb('0x43')]:undefined)||''}];case _0x2ecb('0x5b'):return[{'name':_0x2ecb('0x5c'),'type':_0x5d9252[_0x2ecb('0x5d')]||(_0x5d9252[_0x2ecb('0x42')]&&_0x5d9252[_0x2ecb('0x42')][0x0]?_0x5d9252[_0x2ecb('0x42')][0x0][_0x2ecb('0x3f')]:undefined)||null,'value':_0x5d9252[_0x2ecb('0x5c')]||(_0x5d9252['attrs']&&_0x5d9252[_0x2ecb('0x42')][0x0]?_0x5d9252[_0x2ecb('0x42')][0x0][_0x2ecb('0x43')]:undefined)||null},{'name':_0x2ecb('0x5e'),'value':_0x5d9252['attrRefresh']||(_0x5d9252[_0x2ecb('0x42')]&&_0x5d9252['attrs'][0x1]?_0x5d9252[_0x2ecb('0x42')][0x1][_0x2ecb('0x43')]:undefined)||0x0}];default:return[];}}catch(_0x4565d2){logger['error'](_0x2ecb('0x5f'),JSON[_0x2ecb('0x60')](_0x4565d2));return[];}}exports[_0x2ecb('0x61')]=function(_0x5723b5,_0x16e2db){if(_0x5723b5['body']){_0x5723b5[_0x2ecb('0x62')]['attrs']=widgetAttributes(_0x5723b5['body']);}return db['DashboardItem'][_0x2ecb('0x61')](_0x5723b5[_0x2ecb('0x62')],{})[_0x2ecb('0x29')](respondWithResult(_0x16e2db,0xc9))[_0x2ecb('0x3d')](handleError(_0x16e2db,null));};exports[_0x2ecb('0x27')]=function(_0x338fe6,_0x2b709f){if(_0x338fe6[_0x2ecb('0x62')]['id']){delete _0x338fe6[_0x2ecb('0x62')]['id'];}_0x338fe6[_0x2ecb('0x62')][_0x2ecb('0x42')]=widgetAttributes(_0x338fe6['body']);return db[_0x2ecb('0x31')]['find']({'where':{'id':_0x338fe6[_0x2ecb('0x2f')]['id']}})[_0x2ecb('0x29')](handleEntityNotFound(_0x2b709f,null))[_0x2ecb('0x29')](saveUpdates(_0x338fe6[_0x2ecb('0x62')],null))[_0x2ecb('0x29')](respondWithResult(_0x2b709f,null))[_0x2ecb('0x3d')](handleError(_0x2b709f,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index f5b7d44..59df7f9 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 _0x4d63=['exports','events','../../mysqldb','DashboardItem','setMaxListeners','emit','hook'];(function(_0x51a56a,_0x18f295){var _0x1b1c75=function(_0x5ce986){while(--_0x5ce986){_0x51a56a['push'](_0x51a56a['shift']());}};_0x1b1c75(++_0x18f295);}(_0x4d63,0x189));var _0x34d6=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4d63[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0x34d6('0x0'));var DashboardItem=require(_0x34d6('0x1'))['db'][_0x34d6('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x34d6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5f5744){return function(_0x433a0f,_0x169a42,_0x14a202){DashboardItemEvents[_0x34d6('0x4')](_0x5f5744+':'+_0x433a0f['id'],_0x433a0f);DashboardItemEvents[_0x34d6('0x4')](_0x5f5744,_0x433a0f);_0x14a202(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x34d6('0x5')](e,emitEvent(event));}}module[_0x34d6('0x6')]=DashboardItemEvents; \ No newline at end of file +var _0x66fa=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','update','remove'];(function(_0x630045,_0x5e241e){var _0x39700d=function(_0x41be92){while(--_0x41be92){_0x630045['push'](_0x630045['shift']());}};_0x39700d(++_0x5e241e);}(_0x66fa,0x126));var _0xa66f=function(_0x5397cc,_0x2b8920){_0x5397cc=_0x5397cc-0x0;var _0x2c7446=_0x66fa[_0x5397cc];return _0x2c7446;};'use strict';var EventEmitter=require(_0xa66f('0x0'));var DashboardItem=require(_0xa66f('0x1'))['db'][_0xa66f('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xa66f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa66f('0x4'),'afterDestroy':_0xa66f('0x5')};function emitEvent(_0x23fd46){return function(_0x5c3197,_0x5d1fb2,_0x5c9ed9){DashboardItemEvents[_0xa66f('0x6')](_0x23fd46+':'+_0x5c3197['id'],_0x5c3197);DashboardItemEvents[_0xa66f('0x6')](_0x23fd46,_0x5c3197);_0x5c9ed9(null);};}for(var e in events){if(events[_0xa66f('0x7')](e)){var event=events[e];DashboardItem[_0xa66f('0x8')](e,emitEvent(event));}}module[_0xa66f('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 61acbb0..842ad9f 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 _0x2f74=['moment','request-promise','path','rimraf','exports','define','DashboardItem','lodash','util','../../config/logger','api'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2f74,0xb7));var _0x42f7=function(_0xf915a7,_0x3c5104){_0xf915a7=_0xf915a7-0x0;var _0x714195=_0x2f74[_0xf915a7];return _0x714195;};'use strict';var _=require(_0x42f7('0x0'));var util=require(_0x42f7('0x1'));var logger=require(_0x42f7('0x2'))(_0x42f7('0x3'));var moment=require(_0x42f7('0x4'));var BPromise=require('bluebird');var rp=require(_0x42f7('0x5'));var fs=require('fs');var path=require(_0x42f7('0x6'));var rimraf=require(_0x42f7('0x7'));var config=require('../../config/environment');var attributes=require('./dashboardItem.attributes');module[_0x42f7('0x8')]=function(_0x64156e,_0x194f53){return _0x64156e[_0x42f7('0x9')](_0x42f7('0xa'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6113=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','define','dashboard_items'];(function(_0x43026b,_0x928d8c){var _0x4a96cd=function(_0x362cbd){while(--_0x362cbd){_0x43026b['push'](_0x43026b['shift']());}};_0x4a96cd(++_0x928d8c);}(_0x6113,0x1c8));var _0x3611=function(_0x59e7e0,_0x3ec148){_0x59e7e0=_0x59e7e0-0x0;var _0x26b058=_0x6113[_0x59e7e0];return _0x26b058;};'use strict';var _=require(_0x3611('0x0'));var util=require(_0x3611('0x1'));var logger=require(_0x3611('0x2'))('api');var moment=require(_0x3611('0x3'));var BPromise=require(_0x3611('0x4'));var rp=require(_0x3611('0x5'));var fs=require('fs');var path=require(_0x3611('0x6'));var rimraf=require(_0x3611('0x7'));var config=require(_0x3611('0x8'));var attributes=require(_0x3611('0x9'));module['exports']=function(_0x377654,_0x18306f){return _0x377654[_0x3611('0xa')]('DashboardItem',attributes,{'tableName':_0x3611('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 ba9a81a..e946fac 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 _0x585f=['code','DashboardItem,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','debug','request\x20sent','stringify','error'];(function(_0x18c618,_0x484959){var _0x4c1381=function(_0x53e849){while(--_0x53e849){_0x18c618['push'](_0x18c618['shift']());}};_0x4c1381(++_0x484959);}(_0x585f,0x8f));var _0xf585=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x585f[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xf585('0x0'));var util=require(_0xf585('0x1'));var moment=require(_0xf585('0x2'));var BPromise=require(_0xf585('0x3'));var rs=require(_0xf585('0x4'));var fs=require('fs');var Redis=require(_0xf585('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf585('0x6'));var logger=require(_0xf585('0x7'))(_0xf585('0x8'));var config=require('../../config/environment');var jayson=require(_0xf585('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xf585('0xa')]=_[_0xf585('0xb')](config[_0xf585('0xa')],{'host':_0xf585('0xc'),'port':0x18eb});var socket=require(_0xf585('0xd'))(new Redis(config['redis']));require('./dashboardItem.socket')['register'](socket);function respondWithRpcPromise(_0xae1c73,_0x433dbe,_0x9107cb){return new BPromise(function(_0x1d1645,_0x227486){return client['request'](_0xae1c73,_0x9107cb)['then'](function(_0x49b1ce){logger['info']('DashboardItem,\x20%s,\x20%s',_0x433dbe,'request\x20sent');logger[_0xf585('0xe')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x433dbe,_0xf585('0xf'),JSON[_0xf585('0x10')](_0x49b1ce));if(_0x49b1ce['error']){if(_0x49b1ce[_0xf585('0x11')][_0xf585('0x12')]===0x1f4){logger['error'](_0xf585('0x13'),_0x433dbe,_0x49b1ce[_0xf585('0x11')][_0xf585('0x14')]);return _0x227486(_0x49b1ce['error'][_0xf585('0x14')]);}logger[_0xf585('0x11')](_0xf585('0x13'),_0x433dbe,_0x49b1ce['error'][_0xf585('0x14')]);return _0x1d1645(_0x49b1ce[_0xf585('0x11')][_0xf585('0x14')]);}else{logger['info'](_0xf585('0x13'),_0x433dbe,_0xf585('0xf'));_0x1d1645(_0x49b1ce[_0xf585('0x15')][_0xf585('0x14')]);}})[_0xf585('0x16')](function(_0x368f91){logger['error']('DashboardItem,\x20%s,\x20%s',_0x433dbe,_0x368f91);_0x227486(_0x368f91);});});} \ No newline at end of file +var _0xfd3a=['client','redis','defaults','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x264589,_0x2c74b9){var _0x529f04=function(_0x3cb6f7){while(--_0x3cb6f7){_0x264589['push'](_0x264589['shift']());}};_0x529f04(++_0x2c74b9);}(_0xfd3a,0xfa));var _0xafd3=function(_0x1e8ec7,_0x589fd4){_0x1e8ec7=_0x1e8ec7-0x0;var _0x4bd170=_0xfd3a[_0x1e8ec7];return _0x4bd170;};'use strict';var _=require(_0xafd3('0x0'));var util=require(_0xafd3('0x1'));var moment=require(_0xafd3('0x2'));var BPromise=require('bluebird');var rs=require(_0xafd3('0x3'));var fs=require('fs');var Redis=require(_0xafd3('0x4'));var db=require(_0xafd3('0x5'))['db'];var utils=require(_0xafd3('0x6'));var logger=require('../../config/logger')(_0xafd3('0x7'));var config=require(_0xafd3('0x8'));var jayson=require(_0xafd3('0x9'));var client=jayson[_0xafd3('0xa')]['http']({'port':0x232a});config[_0xafd3('0xb')]=_[_0xafd3('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xafd3('0xb')]));require(_0xafd3('0xd'))[_0xafd3('0xe')](socket);function respondWithRpcPromise(_0x3e7a89,_0x31852d,_0x513ab3){return new BPromise(function(_0x16f127,_0x2cf0bd){return client[_0xafd3('0xf')](_0x3e7a89,_0x513ab3)[_0xafd3('0x10')](function(_0x54719b){logger[_0xafd3('0x11')]('DashboardItem,\x20%s,\x20%s',_0x31852d,'request\x20sent');logger['debug'](_0xafd3('0x12'),_0x31852d,_0xafd3('0x13'),JSON[_0xafd3('0x14')](_0x54719b));if(_0x54719b[_0xafd3('0x15')]){if(_0x54719b['error'][_0xafd3('0x16')]===0x1f4){logger[_0xafd3('0x15')](_0xafd3('0x17'),_0x31852d,_0x54719b[_0xafd3('0x15')][_0xafd3('0x18')]);return _0x2cf0bd(_0x54719b['error'][_0xafd3('0x18')]);}logger['error'](_0xafd3('0x17'),_0x31852d,_0x54719b[_0xafd3('0x15')][_0xafd3('0x18')]);return _0x16f127(_0x54719b[_0xafd3('0x15')][_0xafd3('0x18')]);}else{logger[_0xafd3('0x11')](_0xafd3('0x17'),_0x31852d,_0xafd3('0x13'));_0x16f127(_0x54719b[_0xafd3('0x19')]['message']);}})['catch'](function(_0x2f21f2){logger['error'](_0xafd3('0x17'),_0x31852d,_0x2f21f2);_0x2cf0bd(_0x2f21f2);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index dfd248d..b10e9ae 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 _0xf06c=['register','dashboardItem:','./dashboardItem.events','save','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf06c,0x19c));var _0xcf06=function(_0x23e398,_0x29bf58){_0x23e398=_0x23e398-0x0;var _0x24d6f8=_0xf06c[_0x23e398];return _0x24d6f8;};'use strict';var DashboardItemEvents=require(_0xcf06('0x0'));var events=[_0xcf06('0x1'),'remove','update'];function createListener(_0x20e5d1,_0x37232e){return function(_0x57aa2c){_0x37232e['emit'](_0x20e5d1,_0x57aa2c);};}function removeListener(_0x3978b6,_0x20e289){return function(){DashboardItemEvents[_0xcf06('0x2')](_0x3978b6,_0x20e289);};}exports[_0xcf06('0x3')]=function(_0x4d9593){for(var _0x6a9ef6=0x0,_0x379189=events['length'];_0x6a9ef6<_0x379189;_0x6a9ef6++){var _0x3951d0=events[_0x6a9ef6];var _0xc07672=createListener(_0xcf06('0x4')+_0x3951d0,_0x4d9593);DashboardItemEvents['on'](_0x3951d0,_0xc07672);}}; \ No newline at end of file +var _0xf5f9=['update','./dashboardItem.events','save','remove'];(function(_0x582d9d,_0x1c958d){var _0x44c0ef=function(_0x4ea975){while(--_0x4ea975){_0x582d9d['push'](_0x582d9d['shift']());}};_0x44c0ef(++_0x1c958d);}(_0xf5f9,0xb9));var _0x9f5f=function(_0x16c93b,_0x1cb549){_0x16c93b=_0x16c93b-0x0;var _0x1f240d=_0xf5f9[_0x16c93b];return _0x1f240d;};'use strict';var DashboardItemEvents=require(_0x9f5f('0x0'));var events=[_0x9f5f('0x1'),_0x9f5f('0x2'),_0x9f5f('0x3')];function createListener(_0x3d055b,_0x38f746){return function(_0x8d628c){_0x38f746['emit'](_0x3d055b,_0x8d628c);};}function removeListener(_0x2dd9ff,_0x21a6b2){return function(){DashboardItemEvents['removeListener'](_0x2dd9ff,_0x21a6b2);};}exports['register']=function(_0x262774){for(var _0x57e640=0x0,_0x3b7986=events['length'];_0x57e640<_0x3b7986;_0x57e640++){var _0x500ea3=events[_0x57e640];var _0x47236c=createListener('dashboardItem:'+_0x500ea3,_0x262774);DashboardItemEvents['on'](_0x500ea3,_0x47236c);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 73460ce..fbe9675 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 _0x908e=['put','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','show','post','isAuthenticated'];(function(_0x492535,_0x46524a){var _0x256620=function(_0x3015f8){while(--_0x3015f8){_0x492535['push'](_0x492535['shift']());}};_0x256620(++_0x46524a);}(_0x908e,0x71));var _0xe908=function(_0x5b621b,_0x3df21e){_0x5b621b=_0x5b621b-0x0;var _0x8eda75=_0x908e[_0x5b621b];return _0x8eda75;};'use strict';var multer=require('multer');var util=require(_0xe908('0x0'));var path=require(_0xe908('0x1'));var timeout=require(_0xe908('0x2'));var express=require(_0xe908('0x3'));var router=express[_0xe908('0x4')]();var fs_extra=require(_0xe908('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe908('0x6'));var config=require(_0xe908('0x7'));var controller=require('./dashboardItem.controller');router[_0xe908('0x8')](_0xe908('0x9'),auth['isAuthenticated'](),controller[_0xe908('0xa')]);router[_0xe908('0xb')]('/',auth[_0xe908('0xc')](),controller['create']);router[_0xe908('0xd')](_0xe908('0x9'),auth[_0xe908('0xc')](),controller['update']);router['delete'](_0xe908('0x9'),auth[_0xe908('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc537=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','get','/:id','isAuthenticated','show','post','create','put'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xc537,0x112));var _0x7c53=function(_0x316c1e,_0x24715d){_0x316c1e=_0x316c1e-0x0;var _0x456122=_0xc537[_0x316c1e];return _0x456122;};'use strict';var multer=require(_0x7c53('0x0'));var util=require(_0x7c53('0x1'));var path=require(_0x7c53('0x2'));var timeout=require(_0x7c53('0x3'));var express=require(_0x7c53('0x4'));var router=express[_0x7c53('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7c53('0x6'));var controller=require('./dashboardItem.controller');router[_0x7c53('0x7')](_0x7c53('0x8'),auth[_0x7c53('0x9')](),controller[_0x7c53('0xa')]);router[_0x7c53('0xb')]('/',auth[_0x7c53('0x9')](),controller[_0x7c53('0xc')]);router[_0x7c53('0xd')](_0x7c53('0x8'),auth[_0x7c53('0x9')](),controller[_0x7c53('0xe')]);router[_0x7c53('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x7c53('0x10')]);module[_0x7c53('0x11')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 4b986c9..89bcb70 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 _0x280a=['exports','first','third','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x280a,0x1b2));var _0xa280=function(_0x405fb7,_0xb788df){_0x405fb7=_0x405fb7-0x0;var _0x1b4117=_0x280a[_0x405fb7];return _0x1b4117;};'use strict';var Sequelize=require(_0xa280('0x0'));module[_0xa280('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xa280('0x2'),'second',_0xa280('0x3')),'allowNull':![],'defaultValue':_0xa280('0x2')},'description':{'type':Sequelize[_0xa280('0x4')]}}; \ No newline at end of file +var _0xc302=['second','third','first','STRING','sequelize','exports','ENUM'];(function(_0x24f04d,_0x198dc7){var _0x2930f0=function(_0x4f3f7c){while(--_0x4f3f7c){_0x24f04d['push'](_0x24f04d['shift']());}};_0x2930f0(++_0x198dc7);}(_0xc302,0x15b));var _0x2c30=function(_0x3eead2,_0x17d614){_0x3eead2=_0x3eead2-0x0;var _0x2aba07=_0xc302[_0x3eead2];return _0x2aba07;};'use strict';var Sequelize=require(_0x2c30('0x0'));module[_0x2c30('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x2c30('0x2')]('first',_0x2c30('0x3'),_0x2c30('0x4')),'allowNull':![],'defaultValue':_0x2c30('0x5')},'description':{'type':Sequelize[_0x2c30('0x6')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index a467a9e..f550333 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 _0xc746=['error','stack','name','send','index','map','Disposition','fieldName','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','ejs','fs-extra','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','then','Dispositions','UserProfileResource','destroy'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xc746,0xc9));var _0x6c74=function(_0x50e743,_0xb5bd01){_0x50e743=_0x50e743-0x0;var _0x4c2715=_0xc746[_0x50e743];return _0x4c2715;};'use strict';var emlformat=require(_0x6c74('0x0'));var rimraf=require(_0x6c74('0x1'));var zipdir=require(_0x6c74('0x2'));var jsonpatch=require(_0x6c74('0x3'));var rp=require(_0x6c74('0x4'));var moment=require(_0x6c74('0x5'));var BPromise=require(_0x6c74('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6c74('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6c74('0x8'));var fs=require('fs');var fs_extra=require(_0x6c74('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6c74('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x6c74('0xb'));var querystring=require(_0x6c74('0xc'));var Papa=require(_0x6c74('0xd'));var Redis=require(_0x6c74('0xe'));var authService=require(_0x6c74('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6c74('0x10'));var hardwareService=require(_0x6c74('0x11'));var logger=require(_0x6c74('0x12'))('api');var utils=require(_0x6c74('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ac823,_0x5f53bb){_0x5f53bb=_0x5f53bb||0xcc;return function(_0x4a534d){if(_0x4a534d){return _0x2ac823[_0x6c74('0x14')](_0x5f53bb);}return _0x2ac823[_0x6c74('0x15')](_0x5f53bb)[_0x6c74('0x16')]();};}function respondWithResult(_0x167c89,_0x504061){_0x504061=_0x504061||0xc8;return function(_0xb7ce50){if(_0xb7ce50){return _0x167c89[_0x6c74('0x15')](_0x504061)[_0x6c74('0x17')](_0xb7ce50);}};}function respondWithFilteredResult(_0x3f7b2a,_0x19bb25){return function(_0x1d2ae1){if(_0x1d2ae1){var _0x55ec61=typeof _0x19bb25[_0x6c74('0x18')]==='undefined'&&typeof _0x19bb25[_0x6c74('0x19')]==='undefined';var _0x2cc3be=_0x1d2ae1[_0x6c74('0x1a')];var _0x9e9e87=_0x55ec61?0x0:_0x19bb25[_0x6c74('0x18')];var _0x352d25=_0x55ec61?_0x1d2ae1['count']:_0x19bb25[_0x6c74('0x18')]+_0x19bb25[_0x6c74('0x19')];var _0x5b959e;if(_0x352d25>=_0x2cc3be){_0x352d25=_0x2cc3be;_0x5b959e=0xc8;}else{_0x5b959e=0xce;}_0x3f7b2a[_0x6c74('0x15')](_0x5b959e);return _0x3f7b2a[_0x6c74('0x1b')](_0x6c74('0x1c'),_0x9e9e87+'-'+_0x352d25+'/'+_0x2cc3be)['json'](_0x1d2ae1);}return null;};}function patchUpdates(_0x1349b4){return function(_0xf82837){try{jsonpatch[_0x6c74('0x1d')](_0xf82837,_0x1349b4,!![]);}catch(_0x12d9ea){return BPromise[_0x6c74('0x1e')](_0x12d9ea);}return _0xf82837['save']();};}function saveUpdates(_0x218f37,_0x352afc){return function(_0x2d0b2a){if(_0x2d0b2a){return _0x2d0b2a[_0x6c74('0x1f')](_0x218f37)[_0x6c74('0x20')](function(_0x158c08){return _0x158c08;});}return null;};}function removeEntity(_0x44db67,_0x2cf4d0){return function(_0x590e44){if(_0x590e44){return _0x590e44['destroy']()[_0x6c74('0x20')](function(){var _0x355687=_0x590e44['get']({'plain':!![]});var _0x56c7d3=_0x6c74('0x21');return db[_0x6c74('0x22')][_0x6c74('0x23')]({'where':{'type':_0x56c7d3,'resourceId':_0x355687['id']}})[_0x6c74('0x20')](function(){return _0x590e44;});})['then'](function(){_0x44db67['status'](0xcc)[_0x6c74('0x16')]();});}};}function handleEntityNotFound(_0x92e6df,_0x1c0e62){return function(_0x13e41d){if(!_0x13e41d){_0x92e6df[_0x6c74('0x14')](0x194);}return _0x13e41d;};}function handleError(_0x42c451,_0x21f019){_0x21f019=_0x21f019||0x1f4;return function(_0x2b422c){logger[_0x6c74('0x24')](_0x2b422c[_0x6c74('0x25')]);if(_0x2b422c[_0x6c74('0x26')]){delete _0x2b422c[_0x6c74('0x26')];}_0x42c451[_0x6c74('0x15')](_0x21f019)[_0x6c74('0x27')](_0x2b422c);};}exports[_0x6c74('0x28')]=function(_0x53c495,_0x583a65){var _0x5bfd2f={},_0x22e291={},_0x41e5f5={'count':0x0,'rows':[]};var _0x5120b5=_[_0x6c74('0x29')](db[_0x6c74('0x2a')]['rawAttributes'],function(_0x599b2c){return{'name':_0x599b2c[_0x6c74('0x2b')],'type':_0x599b2c[_0x6c74('0x2c')]['key']};});_0x22e291[_0x6c74('0x2d')]=_['map'](_0x5120b5,'name');_0x22e291['query']=_[_0x6c74('0x2e')](_0x53c495[_0x6c74('0x2f')]);_0x22e291['filters']=_[_0x6c74('0x30')](_0x22e291[_0x6c74('0x2d')],_0x22e291[_0x6c74('0x2f')]);_0x5bfd2f[_0x6c74('0x31')]=_[_0x6c74('0x30')](_0x22e291[_0x6c74('0x2d')],qs[_0x6c74('0x32')](_0x53c495[_0x6c74('0x2f')][_0x6c74('0x32')]));_0x5bfd2f[_0x6c74('0x31')]=_0x5bfd2f[_0x6c74('0x31')][_0x6c74('0x33')]?_0x5bfd2f[_0x6c74('0x31')]:_0x22e291[_0x6c74('0x2d')];if(!_0x53c495[_0x6c74('0x2f')][_0x6c74('0x34')]('nolimit')){_0x5bfd2f[_0x6c74('0x19')]=qs[_0x6c74('0x19')](_0x53c495[_0x6c74('0x2f')][_0x6c74('0x19')]);_0x5bfd2f[_0x6c74('0x18')]=qs[_0x6c74('0x18')](_0x53c495['query'][_0x6c74('0x18')]);}_0x5bfd2f[_0x6c74('0x35')]=qs[_0x6c74('0x36')](_0x53c495['query'][_0x6c74('0x36')]);_0x5bfd2f[_0x6c74('0x37')]=qs[_0x6c74('0x38')](_[_0x6c74('0x39')](_0x53c495[_0x6c74('0x2f')],_0x22e291[_0x6c74('0x38')]),_0x5120b5);if(_0x53c495[_0x6c74('0x2f')][_0x6c74('0x3a')]){_0x5bfd2f[_0x6c74('0x37')]=_[_0x6c74('0x3b')](_0x5bfd2f[_0x6c74('0x37')],{'$or':_['map'](_0x5120b5,function(_0x25ae27){if(_0x25ae27['type']!=='VIRTUAL'){var _0x16e2c7={};_0x16e2c7[_0x25ae27[_0x6c74('0x26')]]={'$like':'%'+_0x53c495[_0x6c74('0x2f')][_0x6c74('0x3a')]+'%'};return _0x16e2c7;}})});}_0x5bfd2f=_[_0x6c74('0x3b')]({},_0x5bfd2f,_0x53c495[_0x6c74('0x3c')]);var _0x86a56b={'where':_0x5bfd2f[_0x6c74('0x37')]};return db[_0x6c74('0x2a')][_0x6c74('0x1a')](_0x86a56b)[_0x6c74('0x20')](function(_0x4aae32){_0x41e5f5['count']=_0x4aae32;if(_0x53c495[_0x6c74('0x2f')][_0x6c74('0x3d')]){_0x5bfd2f[_0x6c74('0x3e')]=[{'all':!![]}];}return db[_0x6c74('0x2a')][_0x6c74('0x3f')](_0x5bfd2f);})[_0x6c74('0x20')](function(_0x8c7595){_0x41e5f5[_0x6c74('0x40')]=_0x8c7595;return _0x41e5f5;})['then'](respondWithFilteredResult(_0x583a65,_0x5bfd2f))[_0x6c74('0x41')](handleError(_0x583a65,null));};exports[_0x6c74('0x42')]=function(_0x1dfcbd,_0x3a2f80){var _0x40dfd6={'raw':!![],'where':{'id':_0x1dfcbd[_0x6c74('0x43')]['id']}},_0x4fb0c5={};_0x4fb0c5[_0x6c74('0x2d')]=_[_0x6c74('0x2e')](db[_0x6c74('0x2a')][_0x6c74('0x44')]);_0x4fb0c5[_0x6c74('0x2f')]=_[_0x6c74('0x2e')](_0x1dfcbd[_0x6c74('0x2f')]);_0x4fb0c5[_0x6c74('0x38')]=_[_0x6c74('0x30')](_0x4fb0c5[_0x6c74('0x2d')],_0x4fb0c5[_0x6c74('0x2f')]);_0x40dfd6[_0x6c74('0x31')]=_[_0x6c74('0x30')](_0x4fb0c5['model'],qs[_0x6c74('0x32')](_0x1dfcbd['query'][_0x6c74('0x32')]));_0x40dfd6[_0x6c74('0x31')]=_0x40dfd6['attributes'][_0x6c74('0x33')]?_0x40dfd6[_0x6c74('0x31')]:_0x4fb0c5['model'];if(_0x1dfcbd[_0x6c74('0x2f')][_0x6c74('0x3d')]){_0x40dfd6[_0x6c74('0x3e')]=[{'all':!![]}];}_0x40dfd6=_[_0x6c74('0x3b')]({},_0x40dfd6,_0x1dfcbd['options']);return db['Disposition']['find'](_0x40dfd6)[_0x6c74('0x20')](handleEntityNotFound(_0x3a2f80,null))[_0x6c74('0x20')](respondWithResult(_0x3a2f80,null))[_0x6c74('0x41')](handleError(_0x3a2f80,null));};exports[_0x6c74('0x45')]=function(_0x5d46f4,_0x204d7d){return db[_0x6c74('0x2a')][_0x6c74('0x45')](_0x5d46f4['body'],{})[_0x6c74('0x20')](function(_0x363928){var _0x63a7dc=_0x5d46f4[_0x6c74('0x46')]['get']({'plain':!![]});if(!_0x63a7dc)throw new Error(_0x6c74('0x47'));if(_0x63a7dc[_0x6c74('0x48')]===_0x6c74('0x46')){var _0x4c34b7=_0x363928[_0x6c74('0x49')]({'plain':!![]});var _0x21ad25='Dispositions';return db['UserProfileSection'][_0x6c74('0x4a')]({'where':{'name':_0x21ad25,'userProfileId':_0x63a7dc[_0x6c74('0x4b')]},'raw':!![]})['then'](function(_0x1c42a9){if(_0x1c42a9&&_0x1c42a9[_0x6c74('0x4c')]===0x0){return db['UserProfileResource']['create']({'name':_0x4c34b7[_0x6c74('0x26')],'resourceId':_0x4c34b7['id'],'type':_0x1c42a9['name'],'sectionId':_0x1c42a9['id']},{})[_0x6c74('0x20')](function(){return _0x363928;});}else{return _0x363928;}})[_0x6c74('0x41')](function(_0x14b301){logger[_0x6c74('0x24')](_0x6c74('0x4d'),_0x14b301);throw _0x14b301;});}return _0x363928;})[_0x6c74('0x20')](respondWithResult(_0x204d7d,0xc9))[_0x6c74('0x41')](handleError(_0x204d7d,null));};exports[_0x6c74('0x1f')]=function(_0x36c91e,_0x4f9756){if(_0x36c91e[_0x6c74('0x4e')]['id']){delete _0x36c91e['body']['id'];}return db[_0x6c74('0x2a')][_0x6c74('0x4a')]({'where':{'id':_0x36c91e['params']['id']}})[_0x6c74('0x20')](handleEntityNotFound(_0x4f9756,null))[_0x6c74('0x20')](saveUpdates(_0x36c91e[_0x6c74('0x4e')],null))[_0x6c74('0x20')](respondWithResult(_0x4f9756,null))[_0x6c74('0x41')](handleError(_0x4f9756,null));};exports[_0x6c74('0x23')]=function(_0x2fd51a,_0x50226e){return db['Disposition'][_0x6c74('0x4a')]({'where':{'id':_0x2fd51a[_0x6c74('0x43')]['id']}})[_0x6c74('0x20')](handleEntityNotFound(_0x50226e,null))[_0x6c74('0x20')](removeEntity(_0x50226e,null))[_0x6c74('0x41')](handleError(_0x50226e,null));}; \ No newline at end of file +var _0x59cf=['rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','map','VIRTUAL','filter','Disposition','findAll','rows','keys','includeAll','include','options','catch','create','role','user','UserProfileSection','userProfileId','autoAssociation','body','find','params','eml-format','rimraf','zip-dir','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','save','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','index'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x59cf,0x158));var _0xf59c=function(_0x3dfeb9,_0x1cc6e4){_0x3dfeb9=_0x3dfeb9-0x0;var _0x412314=_0x59cf[_0x3dfeb9];return _0x412314;};'use strict';var emlformat=require(_0xf59c('0x0'));var rimraf=require(_0xf59c('0x1'));var zipdir=require(_0xf59c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf59c('0x3'));var util=require(_0xf59c('0x4'));var path=require(_0xf59c('0x5'));var sox=require('sox');var csv=require(_0xf59c('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf59c('0x7'));var _=require(_0xf59c('0x8'));var squel=require('squel');var crypto=require(_0xf59c('0x9'));var jsforce=require(_0xf59c('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xf59c('0x6'));var querystring=require(_0xf59c('0xb'));var Papa=require(_0xf59c('0xc'));var Redis=require(_0xf59c('0xd'));var authService=require(_0xf59c('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xf59c('0xf'));var hardwareService=require(_0xf59c('0x10'));var logger=require(_0xf59c('0x11'))(_0xf59c('0x12'));var utils=require('../../config/utils');var config=require(_0xf59c('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xab4c72,_0x3125d7){_0x3125d7=_0x3125d7||0xcc;return function(_0x2f9189){if(_0x2f9189){return _0xab4c72[_0xf59c('0x14')](_0x3125d7);}return _0xab4c72[_0xf59c('0x15')](_0x3125d7)[_0xf59c('0x16')]();};}function respondWithResult(_0x23e363,_0x16620e){_0x16620e=_0x16620e||0xc8;return function(_0x3322f2){if(_0x3322f2){return _0x23e363[_0xf59c('0x15')](_0x16620e)[_0xf59c('0x17')](_0x3322f2);}};}function respondWithFilteredResult(_0x5b9f03,_0x3d98b9){return function(_0x32d81d){if(_0x32d81d){var _0x2592bb=typeof _0x3d98b9['offset']===_0xf59c('0x18')&&typeof _0x3d98b9[_0xf59c('0x19')]===_0xf59c('0x18');var _0x59af47=_0x32d81d[_0xf59c('0x1a')];var _0x2c1d97=_0x2592bb?0x0:_0x3d98b9[_0xf59c('0x1b')];var _0x4ca790=_0x2592bb?_0x32d81d[_0xf59c('0x1a')]:_0x3d98b9[_0xf59c('0x1b')]+_0x3d98b9[_0xf59c('0x19')];var _0x156fd5;if(_0x4ca790>=_0x59af47){_0x4ca790=_0x59af47;_0x156fd5=0xc8;}else{_0x156fd5=0xce;}_0x5b9f03[_0xf59c('0x15')](_0x156fd5);return _0x5b9f03[_0xf59c('0x1c')]('Content-Range',_0x2c1d97+'-'+_0x4ca790+'/'+_0x59af47)['json'](_0x32d81d);}return null;};}function patchUpdates(_0x58ced1){return function(_0xe3464b){try{jsonpatch['apply'](_0xe3464b,_0x58ced1,!![]);}catch(_0x2dfd0f){return BPromise['reject'](_0x2dfd0f);}return _0xe3464b[_0xf59c('0x1d')]();};}function saveUpdates(_0x5a91c7,_0x355eef){return function(_0x37965d){if(_0x37965d){return _0x37965d[_0xf59c('0x1e')](_0x5a91c7)[_0xf59c('0x1f')](function(_0x3237ca){return _0x3237ca;});}return null;};}function removeEntity(_0x403837,_0x4a4981){return function(_0x2c8a87){if(_0x2c8a87){return _0x2c8a87[_0xf59c('0x20')]()[_0xf59c('0x1f')](function(){var _0x344c06=_0x2c8a87[_0xf59c('0x21')]({'plain':!![]});var _0x1db0ba=_0xf59c('0x22');return db[_0xf59c('0x23')][_0xf59c('0x20')]({'where':{'type':_0x1db0ba,'resourceId':_0x344c06['id']}})[_0xf59c('0x1f')](function(){return _0x2c8a87;});})[_0xf59c('0x1f')](function(){_0x403837[_0xf59c('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x145232,_0x1958fe){return function(_0x1660b7){if(!_0x1660b7){_0x145232[_0xf59c('0x14')](0x194);}return _0x1660b7;};}function handleError(_0x43ba18,_0x4fd741){_0x4fd741=_0x4fd741||0x1f4;return function(_0x1112d7){logger[_0xf59c('0x24')](_0x1112d7[_0xf59c('0x25')]);if(_0x1112d7[_0xf59c('0x26')]){delete _0x1112d7['name'];}_0x43ba18['status'](_0x4fd741)[_0xf59c('0x27')](_0x1112d7);};}exports[_0xf59c('0x28')]=function(_0xdb64a2,_0xad8f82){var _0xa3645a={},_0x3136c4={},_0x3152de={'count':0x0,'rows':[]};var _0xa30be8=_['map'](db['Disposition'][_0xf59c('0x29')],function(_0x539c51){return{'name':_0x539c51['fieldName'],'type':_0x539c51[_0xf59c('0x2a')][_0xf59c('0x2b')]};});_0x3136c4[_0xf59c('0x2c')]=_['map'](_0xa30be8,_0xf59c('0x26'));_0x3136c4[_0xf59c('0x2d')]=_['keys'](_0xdb64a2['query']);_0x3136c4[_0xf59c('0x2e')]=_[_0xf59c('0x2f')](_0x3136c4['model'],_0x3136c4[_0xf59c('0x2d')]);_0xa3645a[_0xf59c('0x30')]=_['intersection'](_0x3136c4[_0xf59c('0x2c')],qs[_0xf59c('0x31')](_0xdb64a2[_0xf59c('0x2d')][_0xf59c('0x31')]));_0xa3645a[_0xf59c('0x30')]=_0xa3645a[_0xf59c('0x30')][_0xf59c('0x32')]?_0xa3645a[_0xf59c('0x30')]:_0x3136c4[_0xf59c('0x2c')];if(!_0xdb64a2[_0xf59c('0x2d')][_0xf59c('0x33')]('nolimit')){_0xa3645a[_0xf59c('0x19')]=qs[_0xf59c('0x19')](_0xdb64a2[_0xf59c('0x2d')]['limit']);_0xa3645a['offset']=qs[_0xf59c('0x1b')](_0xdb64a2[_0xf59c('0x2d')][_0xf59c('0x1b')]);}_0xa3645a[_0xf59c('0x34')]=qs[_0xf59c('0x35')](_0xdb64a2[_0xf59c('0x2d')][_0xf59c('0x35')]);_0xa3645a[_0xf59c('0x36')]=qs[_0xf59c('0x2e')](_[_0xf59c('0x37')](_0xdb64a2[_0xf59c('0x2d')],_0x3136c4[_0xf59c('0x2e')]),_0xa30be8);if(_0xdb64a2[_0xf59c('0x2d')]['filter']){_0xa3645a['where']=_[_0xf59c('0x38')](_0xa3645a[_0xf59c('0x36')],{'$or':_[_0xf59c('0x39')](_0xa30be8,function(_0x5c6911){if(_0x5c6911['type']!==_0xf59c('0x3a')){var _0x284575={};_0x284575[_0x5c6911[_0xf59c('0x26')]]={'$like':'%'+_0xdb64a2[_0xf59c('0x2d')][_0xf59c('0x3b')]+'%'};return _0x284575;}})});}_0xa3645a=_[_0xf59c('0x38')]({},_0xa3645a,_0xdb64a2['options']);var _0xb6d1c7={'where':_0xa3645a[_0xf59c('0x36')]};return db[_0xf59c('0x3c')]['count'](_0xb6d1c7)[_0xf59c('0x1f')](function(_0x244e0b){_0x3152de['count']=_0x244e0b;if(_0xdb64a2['query']['includeAll']){_0xa3645a['include']=[{'all':!![]}];}return db[_0xf59c('0x3c')][_0xf59c('0x3d')](_0xa3645a);})['then'](function(_0x4265d4){_0x3152de[_0xf59c('0x3e')]=_0x4265d4;return _0x3152de;})[_0xf59c('0x1f')](respondWithFilteredResult(_0xad8f82,_0xa3645a))['catch'](handleError(_0xad8f82,null));};exports['show']=function(_0x22ef0e,_0x5b29fa){var _0x223271={'raw':!![],'where':{'id':_0x22ef0e['params']['id']}},_0x5c020f={};_0x5c020f[_0xf59c('0x2c')]=_[_0xf59c('0x3f')](db['Disposition']['rawAttributes']);_0x5c020f['query']=_[_0xf59c('0x3f')](_0x22ef0e[_0xf59c('0x2d')]);_0x5c020f[_0xf59c('0x2e')]=_['intersection'](_0x5c020f[_0xf59c('0x2c')],_0x5c020f[_0xf59c('0x2d')]);_0x223271[_0xf59c('0x30')]=_[_0xf59c('0x2f')](_0x5c020f[_0xf59c('0x2c')],qs[_0xf59c('0x31')](_0x22ef0e[_0xf59c('0x2d')]['fields']));_0x223271[_0xf59c('0x30')]=_0x223271[_0xf59c('0x30')]['length']?_0x223271[_0xf59c('0x30')]:_0x5c020f[_0xf59c('0x2c')];if(_0x22ef0e[_0xf59c('0x2d')][_0xf59c('0x40')]){_0x223271[_0xf59c('0x41')]=[{'all':!![]}];}_0x223271=_[_0xf59c('0x38')]({},_0x223271,_0x22ef0e[_0xf59c('0x42')]);return db[_0xf59c('0x3c')]['find'](_0x223271)[_0xf59c('0x1f')](handleEntityNotFound(_0x5b29fa,null))['then'](respondWithResult(_0x5b29fa,null))[_0xf59c('0x43')](handleError(_0x5b29fa,null));};exports[_0xf59c('0x44')]=function(_0xe6d54f,_0x13e515){return db['Disposition']['create'](_0xe6d54f['body'],{})[_0xf59c('0x1f')](function(_0x3b1595){var _0x38b937=_0xe6d54f['user'][_0xf59c('0x21')]({'plain':!![]});if(!_0x38b937)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38b937[_0xf59c('0x45')]===_0xf59c('0x46')){var _0x51bf3a=_0x3b1595['get']({'plain':!![]});var _0x1489d2=_0xf59c('0x22');return db[_0xf59c('0x47')]['find']({'where':{'name':_0x1489d2,'userProfileId':_0x38b937[_0xf59c('0x48')]},'raw':!![]})[_0xf59c('0x1f')](function(_0x2d8b5a){if(_0x2d8b5a&&_0x2d8b5a[_0xf59c('0x49')]===0x0){return db[_0xf59c('0x23')]['create']({'name':_0x51bf3a['name'],'resourceId':_0x51bf3a['id'],'type':_0x2d8b5a[_0xf59c('0x26')],'sectionId':_0x2d8b5a['id']},{})[_0xf59c('0x1f')](function(){return _0x3b1595;});}else{return _0x3b1595;}})[_0xf59c('0x43')](function(_0x5b32d8){logger[_0xf59c('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b32d8);throw _0x5b32d8;});}return _0x3b1595;})['then'](respondWithResult(_0x13e515,0xc9))[_0xf59c('0x43')](handleError(_0x13e515,null));};exports[_0xf59c('0x1e')]=function(_0x23920f,_0x4436cf){if(_0x23920f[_0xf59c('0x4a')]['id']){delete _0x23920f[_0xf59c('0x4a')]['id'];}return db[_0xf59c('0x3c')][_0xf59c('0x4b')]({'where':{'id':_0x23920f[_0xf59c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4436cf,null))[_0xf59c('0x1f')](saveUpdates(_0x23920f[_0xf59c('0x4a')],null))[_0xf59c('0x1f')](respondWithResult(_0x4436cf,null))['catch'](handleError(_0x4436cf,null));};exports[_0xf59c('0x20')]=function(_0x4d769,_0x298d9c){return db[_0xf59c('0x3c')][_0xf59c('0x4b')]({'where':{'id':_0x4d769[_0xf59c('0x4c')]['id']}})[_0xf59c('0x1f')](handleEntityNotFound(_0x298d9c,null))[_0xf59c('0x1f')](removeEntity(_0x298d9c,null))[_0xf59c('0x43')](handleError(_0x298d9c,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index ce77c0a..880d903 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 _0x0e03=['ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','name_fax','name_openchannel','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','request-promise','path','rimraf','./disposition.attributes','define','Disposition','name_voice','name'];(function(_0x23fbde,_0x7e05a7){var _0x1ef60d=function(_0x24d27d){while(--_0x24d27d){_0x23fbde['push'](_0x23fbde['shift']());}};_0x1ef60d(++_0x7e05a7);}(_0x0e03,0x78));var _0x30e0=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x0e03[_0x35885a];return _0xe86249;};'use strict';var _=require(_0x30e0('0x0'));var util=require(_0x30e0('0x1'));var logger=require(_0x30e0('0x2'))(_0x30e0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x30e0('0x4'));var fs=require('fs');var path=require(_0x30e0('0x5'));var rimraf=require(_0x30e0('0x6'));var config=require('../../config/environment');var attributes=require(_0x30e0('0x7'));module['exports']=function(_0x1b0909,_0x2aa69d){return _0x1b0909[_0x30e0('0x8')](_0x30e0('0x9'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x30e0('0xa'),'fields':[_0x30e0('0xb'),_0x30e0('0xc')]},{'unique':!![],'name':_0x30e0('0xd'),'fields':[_0x30e0('0xb'),_0x30e0('0xe')]},{'unique':!![],'name':_0x30e0('0xf'),'fields':[_0x30e0('0xb'),_0x30e0('0x10')]},{'unique':!![],'name':_0x30e0('0x11'),'fields':[_0x30e0('0xb'),'SmsAccountId']},{'unique':!![],'name':_0x30e0('0x12'),'fields':[_0x30e0('0xb'),'FaxAccountId']},{'unique':!![],'name':_0x30e0('0x13'),'fields':[_0x30e0('0xb'),'OpenchannelAccountId']},{'unique':!![],'name':_0x30e0('0x14'),'fields':[_0x30e0('0xb'),_0x30e0('0x15')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe4b4=['bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','name_voice','name','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','name_fax','FaxAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','moment'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xe4b4,0xbc));var _0x4e4b=function(_0x18e84d,_0x400654){_0x18e84d=_0x18e84d-0x0;var _0x154f7c=_0xe4b4[_0x18e84d];return _0x154f7c;};'use strict';var _=require(_0x4e4b('0x0'));var util=require(_0x4e4b('0x1'));var logger=require(_0x4e4b('0x2'))('api');var moment=require(_0x4e4b('0x3'));var BPromise=require(_0x4e4b('0x4'));var rp=require(_0x4e4b('0x5'));var fs=require('fs');var path=require(_0x4e4b('0x6'));var rimraf=require(_0x4e4b('0x7'));var config=require(_0x4e4b('0x8'));var attributes=require(_0x4e4b('0x9'));module[_0x4e4b('0xa')]=function(_0x5b0401,_0xf1787f){return _0x5b0401[_0x4e4b('0xb')](_0x4e4b('0xc'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x4e4b('0xd'),'fields':[_0x4e4b('0xe'),'ListId']},{'unique':!![],'name':_0x4e4b('0xf'),'fields':[_0x4e4b('0xe'),_0x4e4b('0x10')]},{'unique':!![],'name':_0x4e4b('0x11'),'fields':[_0x4e4b('0xe'),_0x4e4b('0x12')]},{'unique':!![],'name':_0x4e4b('0x13'),'fields':[_0x4e4b('0xe'),'SmsAccountId']},{'unique':!![],'name':_0x4e4b('0x14'),'fields':['name',_0x4e4b('0x15')]},{'unique':!![],'name':'name_openchannel','fields':[_0x4e4b('0xe'),'OpenchannelAccountId']},{'unique':!![],'name':_0x4e4b('0x16'),'fields':[_0x4e4b('0xe'),_0x4e4b('0x17')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index c7d622b..37b8dbd 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(_0x3b92f5,_0x4516ea){var _0x109233=function(_0x4e3ce6){while(--_0x4e3ce6){_0x3b92f5['push'](_0x3b92f5['shift']());}};_0x109233(++_0x4516ea);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +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(_0x404c03,_0x58776b){var _0x289bbb=function(_0x6219ef){while(--_0x6219ef){_0x404c03['push'](_0x404c03['shift']());}};_0x289bbb(++_0x58776b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index fe699df..d7b171e 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 _0xf93a=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','/:id','show','post','create','put','update','delete'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xf93a,0x157));var _0xaf93=function(_0x35da7e,_0x1f856c){_0x35da7e=_0x35da7e-0x0;var _0x1daf0f=_0xf93a[_0x35da7e];return _0x1daf0f;};'use strict';var multer=require(_0xaf93('0x0'));var util=require(_0xaf93('0x1'));var path=require(_0xaf93('0x2'));var timeout=require(_0xaf93('0x3'));var express=require(_0xaf93('0x4'));var router=express[_0xaf93('0x5')]();var fs_extra=require(_0xaf93('0x6'));var auth=require(_0xaf93('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0xaf93('0x8')]('/',auth[_0xaf93('0x9')](),controller['index']);router[_0xaf93('0x8')](_0xaf93('0xa'),auth[_0xaf93('0x9')](),controller[_0xaf93('0xb')]);router[_0xaf93('0xc')]('/',auth[_0xaf93('0x9')](),controller[_0xaf93('0xd')]);router[_0xaf93('0xe')](_0xaf93('0xa'),auth[_0xaf93('0x9')](),controller[_0xaf93('0xf')]);router[_0xaf93('0x10')](_0xaf93('0xa'),auth[_0xaf93('0x9')](),controller['destroy']);module[_0xaf93('0x11')]=router; \ No newline at end of file +var _0x3ede=['../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','isAuthenticated','index','get','/:id','post','create','update','delete','destroy','multer','util','connect-timeout','Router'];(function(_0x1acb96,_0x108216){var _0x5da6cf=function(_0x495410){while(--_0x495410){_0x1acb96['push'](_0x1acb96['shift']());}};_0x5da6cf(++_0x108216);}(_0x3ede,0xd9));var _0xe3ed=function(_0xc84e3,_0xd631b){_0xc84e3=_0xc84e3-0x0;var _0x437a90=_0x3ede[_0xc84e3];return _0x437a90;};'use strict';var multer=require(_0xe3ed('0x0'));var util=require(_0xe3ed('0x1'));var path=require('path');var timeout=require(_0xe3ed('0x2'));var express=require('express');var router=express[_0xe3ed('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe3ed('0x4'));var interaction=require(_0xe3ed('0x5'));var config=require(_0xe3ed('0x6'));var controller=require(_0xe3ed('0x7'));router['get']('/',auth[_0xe3ed('0x8')](),controller[_0xe3ed('0x9')]);router[_0xe3ed('0xa')](_0xe3ed('0xb'),auth[_0xe3ed('0x8')](),controller['show']);router[_0xe3ed('0xc')]('/',auth[_0xe3ed('0x8')](),controller[_0xe3ed('0xd')]);router['put'](_0xe3ed('0xb'),auth[_0xe3ed('0x8')](),controller[_0xe3ed('0xe')]);router[_0xe3ed('0xf')]('/:id',auth[_0xe3ed('0x8')](),controller[_0xe3ed('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 70c835a..8e97369 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 _0x4544=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM','yes','localstationid','2400','4800','7200','12000','14400','9600','INTEGER','SIP','DADHI','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x275935,_0x174333){var _0x105bb0=function(_0x168c15){while(--_0x168c15){_0x275935['push'](_0x275935['shift']());}};_0x105bb0(++_0x174333);}(_0x4544,0x17d));var _0x4454=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4544[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x4454('0x0'));module['exports']={'name':{'type':Sequelize[_0x4454('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4454('0x1')]},'ecm':{'type':Sequelize[_0x4454('0x2')]('yes','no'),'defaultValue':_0x4454('0x3')},'headerinfo':{'type':Sequelize[_0x4454('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize['STRING'],'unique':_0x4454('0x4')},'minrate':{'type':Sequelize[_0x4454('0x2')](_0x4454('0x5'),_0x4454('0x6'),_0x4454('0x7'),'9600',_0x4454('0x8'),_0x4454('0x9')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x4454('0x2')](_0x4454('0x5'),_0x4454('0x6'),_0x4454('0x7'),_0x4454('0xa'),_0x4454('0x8'),'14400'),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x4454('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x4454('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x4454('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x4454('0xc'),'IAX',_0x4454('0xd'),'KHOMP'),'defaultValue':_0x4454('0xc')},'key':{'type':Sequelize[_0x4454('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4454('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x4454('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4454('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4454('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4454('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4454('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4454('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4454('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0x4454('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x4454('0xf')],'defaultValue':![],'comment':_0x4454('0x11'),'set':function(_0x50ea31){if(!_0x50ea31)this[_0x4454('0x12')](_0x4454('0x13'),null);this['setDataValue'](_0x4454('0x14'),_0x50ea31);}}}; \ No newline at end of file +var _0x4057=['2400','v17,v27,v29','INTEGER','SIP','DADHI','KHOMP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800','7200','9600','12000','14400'];(function(_0x529f90,_0x2ee2f1){var _0x352617=function(_0x2a8cbc){while(--_0x2a8cbc){_0x529f90['push'](_0x529f90['shift']());}};_0x352617(++_0x2ee2f1);}(_0x4057,0x144));var _0x7405=function(_0x4cf31f,_0x285ba6){_0x4cf31f=_0x4cf31f-0x0;var _0x5a2de3=_0x4057[_0x4cf31f];return _0x5a2de3;};'use strict';var Sequelize=require(_0x7405('0x0'));module[_0x7405('0x1')]={'name':{'type':Sequelize[_0x7405('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x7405('0x3')](_0x7405('0x4'),'no'),'defaultValue':_0x7405('0x4')},'headerinfo':{'type':Sequelize[_0x7405('0x2')],'defaultValue':_0x7405('0x5')},'localstationid':{'type':Sequelize[_0x7405('0x2')],'unique':_0x7405('0x6')},'minrate':{'type':Sequelize[_0x7405('0x3')]('2400',_0x7405('0x7'),_0x7405('0x8'),_0x7405('0x9'),_0x7405('0xa'),_0x7405('0xb')),'defaultValue':_0x7405('0x7')},'maxrate':{'type':Sequelize[_0x7405('0x3')](_0x7405('0xc'),'4800','7200','9600',_0x7405('0xa'),_0x7405('0xb')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x7405('0x2')],'defaultValue':_0x7405('0xd')},'gateway':{'type':Sequelize[_0x7405('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x7405('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x7405('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x7405('0x3')](_0x7405('0xf'),'IAX',_0x7405('0x10'),_0x7405('0x11')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x7405('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x7405('0x12')],'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[_0x7405('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7405('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7405('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7405('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7405('0xe')],'allowNull':!![],'defaultValue':null,'comment':_0x7405('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x7405('0x13')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x43197d){if(!_0x43197d)this[_0x7405('0x15')](_0x7405('0x16'),null);this[_0x7405('0x15')](_0x7405('0x17'),_0x43197d);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 7bb1002..bf51421 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 _0x1675=['removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','FaxInteraction','addInteraction','getInteractions','CmContact','Contact','User','Owner','internal','Tag','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','stack','getApplications','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','priority','appdata','Answer','push','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','VoiceExtension','updateAccountApplications','omit','updatedAt','findById','$gte','split','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','format','\x22%s\x22\x20<%s>','fax','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','filename','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','then','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','name','send','Pause','mandatoryDispositionPause','FaxAccount','type','key','model','map','query','intersection','attributes','fields','length','nolimit','sort','filters','filter','where','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','keys','find','create','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','hasOwnProperty','order','pick'];(function(_0xd1c39b,_0x16f0c6){var _0x58f5bc=function(_0x412cf3){while(--_0x412cf3){_0xd1c39b['push'](_0xd1c39b['shift']());}};_0x58f5bc(++_0x16f0c6);}(_0x1675,0x122));var _0x5167=function(_0x5596a2,_0x46816d){_0x5596a2=_0x5596a2-0x0;var _0x12dbe1=_0x1675[_0x5596a2];return _0x12dbe1;};'use strict';var emlformat=require(_0x5167('0x0'));var rimraf=require(_0x5167('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5167('0x2'));var rp=require(_0x5167('0x3'));var moment=require(_0x5167('0x4'));var BPromise=require(_0x5167('0x5'));var Mustache=require('mustache');var util=require(_0x5167('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x5167('0x7'));var ejs=require(_0x5167('0x8'));var fs=require('fs');var fs_extra=require(_0x5167('0x9'));var _=require(_0x5167('0xa'));var squel=require(_0x5167('0xb'));var crypto=require(_0x5167('0xc'));var jsforce=require(_0x5167('0xd'));var deskjs=require(_0x5167('0xe'));var toCsv=require(_0x5167('0x7'));var querystring=require(_0x5167('0xf'));var Papa=require(_0x5167('0x10'));var Redis=require(_0x5167('0x11'));var authService=require(_0x5167('0x12'));var qs=require(_0x5167('0x13'));var as=require(_0x5167('0x14'));var hardwareService=require(_0x5167('0x15'));var logger=require('../../config/logger')(_0x5167('0x16'));var utils=require(_0x5167('0x17'));var config=require(_0x5167('0x18'));var licenseUtil=require(_0x5167('0x19'));var db=require('../../mysqldb')['db'];config[_0x5167('0x1a')]=_[_0x5167('0x1b')](config[_0x5167('0x1a')],{'host':_0x5167('0x1c'),'port':0x18eb});var socket=require(_0x5167('0x1d'))(new Redis(config['redis']));require(_0x5167('0x1e'))[_0x5167('0x1f')](socket);var jayson=require(_0x5167('0x20'));var client=jayson[_0x5167('0x21')][_0x5167('0x22')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x579029,_0x439bed,_0x1ea7e6,_0x2b7fc3){return new BPromise(function(_0x56479e,_0x57e762){var _0xac038c=_0x2b7fc3||client;return _0xac038c['request'](_0x579029,_0x1ea7e6)[_0x5167('0x23')](function(_0x2d4e34){logger['info'](_0x5167('0x24'),_0x439bed,_0x5167('0x25'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x439bed,_0x5167('0x25'),JSON[_0x5167('0x26')](_0x2d4e34));if(_0x2d4e34[_0x5167('0x27')]){if(_0x2d4e34[_0x5167('0x27')][_0x5167('0x28')]===0x1f4){logger[_0x5167('0x27')](_0x5167('0x24'),_0x439bed,_0x2d4e34[_0x5167('0x27')][_0x5167('0x29')]);return _0x57e762(_0x2d4e34[_0x5167('0x27')][_0x5167('0x29')]);}logger[_0x5167('0x27')](_0x5167('0x24'),_0x439bed,_0x2d4e34[_0x5167('0x27')]['message']);return _0x56479e(_0x2d4e34['error'][_0x5167('0x29')]);}else{logger[_0x5167('0x2a')](_0x5167('0x24'),_0x439bed,_0x5167('0x25'));_0x56479e(_0x2d4e34[_0x5167('0x2b')]['message']);}})[_0x5167('0x2c')](function(_0x13f407){logger[_0x5167('0x27')](_0x5167('0x24'),_0x439bed,_0x13f407);_0x57e762(_0x13f407);});});}function respondWithStatusCode(_0x2b5498,_0x4e16e5){_0x4e16e5=_0x4e16e5||0xcc;return function(_0x3edf23){if(_0x3edf23){return _0x2b5498[_0x5167('0x2d')](_0x4e16e5);}return _0x2b5498['status'](_0x4e16e5)[_0x5167('0x2e')]();};}function respondWithResult(_0x23bc24,_0x589d71){_0x589d71=_0x589d71||0xc8;return function(_0x4a39d3){if(_0x4a39d3){return _0x23bc24[_0x5167('0x2f')](_0x589d71)[_0x5167('0x30')](_0x4a39d3);}};}function respondWithFilteredResult(_0xfc4af,_0x2557c2){return function(_0x24fb10){if(_0x24fb10){var _0x268c6a=typeof _0x2557c2[_0x5167('0x31')]===_0x5167('0x32')&&typeof _0x2557c2[_0x5167('0x33')]===_0x5167('0x32');var _0x359dc6=_0x24fb10[_0x5167('0x34')];var _0x2ca965=_0x268c6a?0x0:_0x2557c2[_0x5167('0x31')];var _0x1ad0b1=_0x268c6a?_0x24fb10[_0x5167('0x34')]:_0x2557c2[_0x5167('0x31')]+_0x2557c2[_0x5167('0x33')];var _0x4e0282;if(_0x1ad0b1>=_0x359dc6){_0x1ad0b1=_0x359dc6;_0x4e0282=0xc8;}else{_0x4e0282=0xce;}_0xfc4af[_0x5167('0x2f')](_0x4e0282);return _0xfc4af[_0x5167('0x35')](_0x5167('0x36'),_0x2ca965+'-'+_0x1ad0b1+'/'+_0x359dc6)[_0x5167('0x30')](_0x24fb10);}return null;};}function patchUpdates(_0x9c724){return function(_0x480baf){try{jsonpatch['apply'](_0x480baf,_0x9c724,!![]);}catch(_0x1f1051){return BPromise[_0x5167('0x37')](_0x1f1051);}return _0x480baf[_0x5167('0x38')]();};}function saveUpdates(_0x5eecfa,_0x57f5ed){return function(_0x5c78ff){if(_0x5c78ff){return _0x5c78ff[_0x5167('0x39')](_0x5eecfa)[_0x5167('0x23')](function(_0x40cd30){return _0x40cd30;});}return null;};}function removeEntity(_0x34ba23,_0x3eec20){return function(_0xa93a9e){if(_0xa93a9e){return _0xa93a9e[_0x5167('0x3a')]()[_0x5167('0x23')](function(){var _0x7fe7c5=_0xa93a9e[_0x5167('0x3b')]({'plain':!![]});var _0x3c44ed=_0x5167('0x3c');return db[_0x5167('0x3d')][_0x5167('0x3a')]({'where':{'type':_0x3c44ed,'resourceId':_0x7fe7c5['id']}})[_0x5167('0x23')](function(){return _0xa93a9e;});})[_0x5167('0x23')](function(){_0x34ba23[_0x5167('0x2f')](0xcc)[_0x5167('0x2e')]();});}};}function handleEntityNotFound(_0x4dbf39,_0x16cbe1){return function(_0xc1f2aa){if(!_0xc1f2aa){_0x4dbf39[_0x5167('0x2d')](0x194);}return _0xc1f2aa;};}function handleError(_0x4cf739,_0x469193){_0x469193=_0x469193||0x1f4;return function(_0x3fa47e){logger[_0x5167('0x27')](_0x3fa47e['stack']);if(_0x3fa47e[_0x5167('0x3e')]){delete _0x3fa47e[_0x5167('0x3e')];}_0x4cf739[_0x5167('0x2f')](_0x469193)[_0x5167('0x3f')](_0x3fa47e);};}exports['index']=function(_0x21620d,_0x3ea1a8){var _0x295bac={'include':[{'model':db[_0x5167('0x40')],'as':_0x5167('0x41')}]},_0x466940={},_0xb97737={'count':0x0,'rows':[]};var _0x1563eb=_['map'](db[_0x5167('0x42')]['rawAttributes'],function(_0x38067b){return{'name':_0x38067b['fieldName'],'type':_0x38067b[_0x5167('0x43')][_0x5167('0x44')]};});_0x466940[_0x5167('0x45')]=_[_0x5167('0x46')](_0x1563eb,_0x5167('0x3e'));_0x466940[_0x5167('0x47')]=_['keys'](_0x21620d[_0x5167('0x47')]);_0x466940['filters']=_[_0x5167('0x48')](_0x466940[_0x5167('0x45')],_0x466940[_0x5167('0x47')]);_0x295bac[_0x5167('0x49')]=_['intersection'](_0x466940['model'],qs[_0x5167('0x4a')](_0x21620d[_0x5167('0x47')]['fields']));_0x295bac[_0x5167('0x49')]=_0x295bac['attributes'][_0x5167('0x4b')]?_0x295bac[_0x5167('0x49')]:_0x466940['model'];if(!_0x21620d[_0x5167('0x47')]['hasOwnProperty'](_0x5167('0x4c'))){_0x295bac[_0x5167('0x33')]=qs[_0x5167('0x33')](_0x21620d[_0x5167('0x47')][_0x5167('0x33')]);_0x295bac[_0x5167('0x31')]=qs[_0x5167('0x31')](_0x21620d['query'][_0x5167('0x31')]);}_0x295bac['order']=qs[_0x5167('0x4d')](_0x21620d[_0x5167('0x47')]['sort']);_0x295bac['where']=qs[_0x5167('0x4e')](_['pick'](_0x21620d['query'],_0x466940['filters']),_0x1563eb);if(_0x21620d[_0x5167('0x47')][_0x5167('0x4f')]){_0x295bac[_0x5167('0x50')]=_[_0x5167('0x51')](_0x295bac[_0x5167('0x50')],{'$or':_[_0x5167('0x46')](_0x1563eb,function(_0x3e6d85){if(_0x3e6d85[_0x5167('0x43')]!=='VIRTUAL'){var _0xff5a8f={};_0xff5a8f[_0x3e6d85[_0x5167('0x3e')]]={'$like':'%'+_0x21620d['query'][_0x5167('0x4f')]+'%'};return _0xff5a8f;}})});}_0x295bac=_[_0x5167('0x51')]({},_0x295bac,_0x21620d[_0x5167('0x52')]);var _0x20b1d4={'where':_0x295bac['where']};return db[_0x5167('0x42')][_0x5167('0x34')](_0x20b1d4)['then'](function(_0x1d2aa1){_0xb97737[_0x5167('0x34')]=_0x1d2aa1;if(_0x21620d['query'][_0x5167('0x53')]){_0x295bac[_0x5167('0x54')]=[{'all':!![]}];}return db['FaxAccount'][_0x5167('0x55')](_0x295bac);})[_0x5167('0x23')](function(_0x3c0ac5){_0xb97737[_0x5167('0x56')]=_0x3c0ac5;return _0xb97737;})[_0x5167('0x23')](respondWithFilteredResult(_0x3ea1a8,_0x295bac))[_0x5167('0x2c')](handleError(_0x3ea1a8,null));};exports[_0x5167('0x57')]=function(_0x24dfa8,_0x3be80b){var _0xc7736b={'raw':![],'where':{'id':_0x24dfa8[_0x5167('0x58')]['id']},'include':[{'model':db[_0x5167('0x40')],'as':'mandatoryDispositionPause'}]},_0x367b59={};_0x367b59[_0x5167('0x45')]=_['keys'](db[_0x5167('0x42')][_0x5167('0x59')]);_0x367b59[_0x5167('0x47')]=_[_0x5167('0x5a')](_0x24dfa8[_0x5167('0x47')]);_0x367b59[_0x5167('0x4e')]=_[_0x5167('0x48')](_0x367b59[_0x5167('0x45')],_0x367b59[_0x5167('0x47')]);_0xc7736b[_0x5167('0x49')]=_[_0x5167('0x48')](_0x367b59['model'],qs['fields'](_0x24dfa8[_0x5167('0x47')]['fields']));_0xc7736b['attributes']=_0xc7736b['attributes'][_0x5167('0x4b')]?_0xc7736b[_0x5167('0x49')]:_0x367b59[_0x5167('0x45')];if(_0x24dfa8['query'][_0x5167('0x53')]){_0xc7736b[_0x5167('0x54')]=[{'all':!![]}];}_0xc7736b=_[_0x5167('0x51')]({},_0xc7736b,_0x24dfa8['options']);return db[_0x5167('0x42')][_0x5167('0x5b')](_0xc7736b)['then'](handleEntityNotFound(_0x3be80b,null))[_0x5167('0x23')](respondWithResult(_0x3be80b,null))['catch'](handleError(_0x3be80b,null));};exports[_0x5167('0x5c')]=function(_0x2d782f,_0x4a0143){return db[_0x5167('0x42')][_0x5167('0x5c')](_0x2d782f['body'],{})[_0x5167('0x23')](function(_0x30dc29){var _0x505c37=_0x2d782f[_0x5167('0x5d')][_0x5167('0x3b')]({'plain':!![]});if(!_0x505c37)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x505c37[_0x5167('0x5e')]===_0x5167('0x5d')){var _0x1c483f=_0x30dc29[_0x5167('0x3b')]({'plain':!![]});var _0x4a5af7=_0x5167('0x3c');return db[_0x5167('0x5f')][_0x5167('0x5b')]({'where':{'name':_0x4a5af7,'userProfileId':_0x505c37['userProfileId']},'raw':!![]})[_0x5167('0x23')](function(_0xf97eb1){if(_0xf97eb1&&_0xf97eb1[_0x5167('0x60')]===0x0){return db[_0x5167('0x3d')][_0x5167('0x5c')]({'name':_0x1c483f[_0x5167('0x3e')],'resourceId':_0x1c483f['id'],'type':_0xf97eb1['name'],'sectionId':_0xf97eb1['id']},{})[_0x5167('0x23')](function(){return _0x30dc29;});}else{return _0x30dc29;}})['catch'](function(_0x5c3c20){logger[_0x5167('0x27')](_0x5167('0x61'),_0x5c3c20);throw _0x5c3c20;});}return _0x30dc29;})[_0x5167('0x23')](respondWithResult(_0x4a0143,0xc9))[_0x5167('0x2c')](handleError(_0x4a0143,null));};exports[_0x5167('0x39')]=function(_0x2fc88b,_0x525265){if(_0x2fc88b[_0x5167('0x62')]['id']){delete _0x2fc88b[_0x5167('0x62')]['id'];}return db[_0x5167('0x42')][_0x5167('0x5b')]({'where':{'id':_0x2fc88b[_0x5167('0x58')]['id']},'include':[{'model':db[_0x5167('0x40')],'as':_0x5167('0x41')}]})[_0x5167('0x23')](handleEntityNotFound(_0x525265,null))[_0x5167('0x23')](saveUpdates(_0x2fc88b['body'],null))['then'](respondWithResult(_0x525265,null))[_0x5167('0x2c')](handleError(_0x525265,null));};exports[_0x5167('0x3a')]=function(_0x4b425a,_0x3fe242){return db[_0x5167('0x42')][_0x5167('0x5b')]({'where':{'id':_0x4b425a['params']['id']}})[_0x5167('0x23')](handleEntityNotFound(_0x3fe242,null))[_0x5167('0x23')](removeEntity(_0x3fe242,null))[_0x5167('0x2c')](handleError(_0x3fe242,null));};exports[_0x5167('0x63')]=function(_0x16f337,_0x571fcc){return db[_0x5167('0x42')][_0x5167('0x63')]()['then'](respondWithResult(_0x571fcc,null))[_0x5167('0x2c')](handleError(_0x571fcc,null));};exports[_0x5167('0x64')]=function(_0x34c958,_0x554439,_0xf2fd14){if(_0x34c958[_0x5167('0x62')]['id']){delete _0x34c958['body']['id'];}return db[_0x5167('0x42')][_0x5167('0x5b')]({'where':{'id':_0x34c958[_0x5167('0x58')]['id']}})[_0x5167('0x23')](handleEntityNotFound(_0x554439,null))['then'](function(_0x2fc7d1){if(_0x2fc7d1){_0x34c958[_0x5167('0x62')][_0x5167('0x65')]=_0x2fc7d1['id'];return db[_0x5167('0x66')][_0x5167('0x5c')](_0x34c958[_0x5167('0x62')]);}})['then'](respondWithResult(_0x554439,null))['catch'](handleError(_0x554439,null));};exports[_0x5167('0x67')]=function(_0x163d1a,_0x1fa97b,_0x330e6f){var _0x23e82e={'raw':![],'where':{}};var _0x44072b={};var _0x3f4940={'count':0x0,'rows':[]};return db['FaxAccount'][_0x5167('0x68')]({'where':{'id':_0x163d1a[_0x5167('0x58')]['id']}})[_0x5167('0x23')](handleEntityNotFound(_0x1fa97b,null))[_0x5167('0x23')](function(_0x1d1243){if(_0x1d1243){_0x44072b['model']=_['keys'](db[_0x5167('0x66')][_0x5167('0x59')]);_0x44072b[_0x5167('0x47')]=_[_0x5167('0x5a')](_0x163d1a['query']);_0x44072b['filters']=_[_0x5167('0x48')](_0x44072b[_0x5167('0x45')],_0x44072b[_0x5167('0x47')]);_0x23e82e[_0x5167('0x49')]=_[_0x5167('0x48')](_0x44072b[_0x5167('0x45')],qs[_0x5167('0x4a')](_0x163d1a[_0x5167('0x47')][_0x5167('0x4a')]));_0x23e82e[_0x5167('0x49')]=_0x23e82e[_0x5167('0x49')][_0x5167('0x4b')]?_0x23e82e[_0x5167('0x49')]:_0x44072b[_0x5167('0x45')];if(!_0x163d1a[_0x5167('0x47')][_0x5167('0x69')](_0x5167('0x4c'))){_0x23e82e[_0x5167('0x33')]=qs[_0x5167('0x33')](_0x163d1a['query'][_0x5167('0x33')]);_0x23e82e['offset']=qs[_0x5167('0x31')](_0x163d1a[_0x5167('0x47')]['offset']);}_0x23e82e[_0x5167('0x6a')]=qs['sort'](_0x163d1a[_0x5167('0x47')][_0x5167('0x4d')]);_0x23e82e['where']=qs['filters'](_[_0x5167('0x6b')](_0x163d1a[_0x5167('0x47')],_0x44072b[_0x5167('0x4e')]));_0x23e82e[_0x5167('0x50')]['FaxAccountId']=_0x1d1243['id'];if(_0x163d1a[_0x5167('0x47')][_0x5167('0x4f')]){_0x23e82e[_0x5167('0x50')]=_[_0x5167('0x51')](_0x23e82e[_0x5167('0x50')],{'$or':_['map'](_0x23e82e['attributes'],function(_0x320e18){var _0x74d1da={};_0x74d1da[_0x320e18]={'$like':'%'+_0x163d1a[_0x5167('0x47')]['filter']+'%'};return _0x74d1da;})});}_0x23e82e=_['merge']({},_0x23e82e,_0x163d1a[_0x5167('0x52')]);return db[_0x5167('0x66')][_0x5167('0x34')]({'where':_0x23e82e['where']})['then'](function(_0x9afa79){_0x3f4940[_0x5167('0x34')]=_0x9afa79;if(_0x163d1a[_0x5167('0x47')]['includeAll']){_0x23e82e[_0x5167('0x54')]=[{'all':!![]}];}return db[_0x5167('0x66')]['findAll'](_0x23e82e);})[_0x5167('0x23')](function(_0x3d7294){_0x3f4940[_0x5167('0x56')]=_0x3d7294;return _0x3f4940;});}})[_0x5167('0x23')](respondWithFilteredResult(_0x1fa97b,_0x23e82e))[_0x5167('0x2c')](handleError(_0x1fa97b,null));};exports[_0x5167('0x6c')]=function(_0x415edb,_0x1d1a64,_0x2d2772){return db[_0x5167('0x42')]['find']({'where':{'id':_0x415edb[_0x5167('0x58')]['id']}})[_0x5167('0x23')](handleEntityNotFound(_0x1d1a64,null))[_0x5167('0x23')](function(_0x1e0ad2){if(_0x1e0ad2){return _0x1e0ad2[_0x5167('0x6c')](_0x415edb['query'][_0x5167('0x6d')]);}})[_0x5167('0x23')](respondWithStatusCode(_0x1d1a64,null))[_0x5167('0x2c')](handleError(_0x1d1a64,null));};exports[_0x5167('0x6e')]=function(_0x574bce,_0x4478a1,_0x506f0d){if(_0x574bce[_0x5167('0x62')]['id']){delete _0x574bce[_0x5167('0x62')]['id'];}return db[_0x5167('0x42')][_0x5167('0x5b')]({'where':{'id':_0x574bce[_0x5167('0x58')]['id']}})['then'](handleEntityNotFound(_0x4478a1,null))[_0x5167('0x23')](function(_0x5c31e7){if(_0x5c31e7){_0x574bce[_0x5167('0x62')][_0x5167('0x65')]=_0x5c31e7['id'];return db['CannedAnswer'][_0x5167('0x5c')](_0x574bce[_0x5167('0x62')]);}})['then'](respondWithResult(_0x4478a1,null))[_0x5167('0x2c')](handleError(_0x4478a1,null));};exports[_0x5167('0x6f')]=function(_0x5d47f5,_0x1edefc,_0x2c1b2d){var _0x29a29f={'raw':![],'where':{}};var _0x242cbc={};var _0x1493c6={'count':0x0,'rows':[]};return db[_0x5167('0x42')][_0x5167('0x68')]({'where':{'id':_0x5d47f5[_0x5167('0x58')]['id']}})[_0x5167('0x23')](handleEntityNotFound(_0x1edefc,null))[_0x5167('0x23')](function(_0x5da80f){if(_0x5da80f){_0x242cbc[_0x5167('0x45')]=_[_0x5167('0x5a')](db[_0x5167('0x70')]['rawAttributes']);_0x242cbc[_0x5167('0x47')]=_['keys'](_0x5d47f5[_0x5167('0x47')]);_0x242cbc[_0x5167('0x4e')]=_[_0x5167('0x48')](_0x242cbc[_0x5167('0x45')],_0x242cbc[_0x5167('0x47')]);_0x29a29f[_0x5167('0x49')]=_[_0x5167('0x48')](_0x242cbc[_0x5167('0x45')],qs['fields'](_0x5d47f5['query'][_0x5167('0x4a')]));_0x29a29f[_0x5167('0x49')]=_0x29a29f[_0x5167('0x49')][_0x5167('0x4b')]?_0x29a29f[_0x5167('0x49')]:_0x242cbc[_0x5167('0x45')];if(!_0x5d47f5['query'][_0x5167('0x69')](_0x5167('0x4c'))){_0x29a29f[_0x5167('0x33')]=qs[_0x5167('0x33')](_0x5d47f5[_0x5167('0x47')][_0x5167('0x33')]);_0x29a29f[_0x5167('0x31')]=qs[_0x5167('0x31')](_0x5d47f5[_0x5167('0x47')][_0x5167('0x31')]);}_0x29a29f[_0x5167('0x6a')]=qs[_0x5167('0x4d')](_0x5d47f5[_0x5167('0x47')][_0x5167('0x4d')]);_0x29a29f['where']=qs[_0x5167('0x4e')](_[_0x5167('0x6b')](_0x5d47f5[_0x5167('0x47')],_0x242cbc[_0x5167('0x4e')]));_0x29a29f[_0x5167('0x50')]['FaxAccountId']=_0x5da80f['id'];if(_0x5d47f5[_0x5167('0x47')][_0x5167('0x4f')]){_0x29a29f[_0x5167('0x50')]=_[_0x5167('0x51')](_0x29a29f['where'],{'$or':_[_0x5167('0x46')](_0x29a29f[_0x5167('0x49')],function(_0x574060){var _0x29dbdf={};_0x29dbdf[_0x574060]={'$like':'%'+_0x5d47f5[_0x5167('0x47')][_0x5167('0x4f')]+'%'};return _0x29dbdf;})});}_0x29a29f=_['merge']({},_0x29a29f,_0x5d47f5[_0x5167('0x52')]);return db[_0x5167('0x70')][_0x5167('0x34')]({'where':_0x29a29f[_0x5167('0x50')]})[_0x5167('0x23')](function(_0x345b7d){_0x1493c6[_0x5167('0x34')]=_0x345b7d;if(_0x5d47f5['query'][_0x5167('0x53')]){_0x29a29f[_0x5167('0x54')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x29a29f);})[_0x5167('0x23')](function(_0x15f361){_0x1493c6['rows']=_0x15f361;return _0x1493c6;});}})[_0x5167('0x23')](respondWithFilteredResult(_0x1edefc,_0x29a29f))['catch'](handleError(_0x1edefc,null));};exports[_0x5167('0x71')]=function(_0x4bd8c4,_0x252970,_0x48f61f){return db[_0x5167('0x42')]['find']({'where':{'id':_0x4bd8c4[_0x5167('0x58')]['id']}})['then'](handleEntityNotFound(_0x252970,null))[_0x5167('0x23')](function(_0xc49e3b){if(_0xc49e3b){return _0xc49e3b[_0x5167('0x71')](_0x4bd8c4[_0x5167('0x47')][_0x5167('0x6d')]);}})[_0x5167('0x23')](respondWithStatusCode(_0x252970,null))['catch'](handleError(_0x252970,null));};exports['addInteraction']=function(_0x245bcd,_0xbbc79e,_0x3504d1){return db[_0x5167('0x72')][_0x5167('0x5b')]({'where':{'id':_0x245bcd[_0x5167('0x58')]['id']}})[_0x5167('0x23')](handleEntityNotFound(_0xbbc79e,null))[_0x5167('0x23')](function(_0x3f0ab0){if(_0x3f0ab0){return _0x3f0ab0[_0x5167('0x73')](_0x245bcd[_0x5167('0x62')][_0x5167('0x6d')],_['omit'](_0x245bcd[_0x5167('0x62')],[_0x5167('0x6d'),'id'])||{});}})[_0x5167('0x23')](respondWithResult(_0xbbc79e,null))[_0x5167('0x2c')](handleError(_0xbbc79e,null));};exports[_0x5167('0x74')]=function(_0x2fd8fc,_0x8b0aa8,_0x36957d){var _0x2a9c38={'raw':![],'where':{}};var _0x320a35={};var _0x5a1182={'count':0x0,'rows':[]};return db[_0x5167('0x42')][_0x5167('0x68')]({'where':{'id':_0x2fd8fc[_0x5167('0x58')]['id']}})['then'](handleEntityNotFound(_0x8b0aa8,null))[_0x5167('0x23')](function(_0x47ac2a){if(_0x47ac2a){_0x320a35[_0x5167('0x45')]=_[_0x5167('0x5a')](db[_0x5167('0x72')]['rawAttributes']);_0x320a35['query']=_[_0x5167('0x5a')](_0x2fd8fc['query']);_0x320a35[_0x5167('0x4e')]=_['intersection'](_0x320a35[_0x5167('0x45')],_0x320a35[_0x5167('0x47')]);_0x2a9c38['attributes']=_[_0x5167('0x48')](_0x320a35[_0x5167('0x45')],qs[_0x5167('0x4a')](_0x2fd8fc['query'][_0x5167('0x4a')]));_0x2a9c38[_0x5167('0x49')]=_0x2a9c38[_0x5167('0x49')][_0x5167('0x4b')]?_0x2a9c38['attributes']:_0x320a35[_0x5167('0x45')];if(!_0x2fd8fc[_0x5167('0x47')][_0x5167('0x69')](_0x5167('0x4c'))){_0x2a9c38['limit']=qs['limit'](_0x2fd8fc['query']['limit']);_0x2a9c38[_0x5167('0x31')]=qs['offset'](_0x2fd8fc[_0x5167('0x47')][_0x5167('0x31')]);}_0x2a9c38[_0x5167('0x6a')]=qs['sort'](_0x2fd8fc[_0x5167('0x47')][_0x5167('0x4d')]);_0x2a9c38[_0x5167('0x50')]=qs[_0x5167('0x4e')](_[_0x5167('0x6b')](_0x2fd8fc[_0x5167('0x47')],_0x320a35[_0x5167('0x4e')]));_0x2a9c38[_0x5167('0x50')]['FaxAccountId']=_0x47ac2a['id'];if(_0x2fd8fc[_0x5167('0x47')][_0x5167('0x4f')]){_0x2a9c38[_0x5167('0x50')]=_[_0x5167('0x51')](_0x2a9c38['where'],{'$or':_[_0x5167('0x46')](_0x2a9c38[_0x5167('0x49')],function(_0x599970){var _0x1eaa0e={};_0x1eaa0e[_0x599970]={'$like':'%'+_0x2fd8fc[_0x5167('0x47')]['filter']+'%'};return _0x1eaa0e;})});}_0x2a9c38=_[_0x5167('0x51')]({},_0x2a9c38,_0x2fd8fc[_0x5167('0x52')]);return db['FaxInteraction'][_0x5167('0x34')]({'where':_0x2a9c38[_0x5167('0x50')]})[_0x5167('0x23')](function(_0x1b226e){_0x5a1182[_0x5167('0x34')]=_0x1b226e;if(_0x2fd8fc['query'][_0x5167('0x53')]){_0x2a9c38[_0x5167('0x54')]=[{'model':db[_0x5167('0x75')],'as':_0x5167('0x76'),'required':![]},{'model':db[_0x5167('0x77')],'as':_0x5167('0x78'),'attributes':['name','fullname',_0x5167('0x79')],'required':![]},{'model':db[_0x5167('0x7a')],'as':'Tags','attributes':['id',_0x5167('0x3e'),_0x5167('0x7b')],'where':_0x2fd8fc[_0x5167('0x47')][_0x5167('0x7c')]?{'id':_0x2fd8fc[_0x5167('0x47')][_0x5167('0x7c')]}:undefined,'required':_0x2fd8fc[_0x5167('0x47')][_0x5167('0x7c')]?!![]:![]}];}return db[_0x5167('0x72')]['findAll'](_0x2a9c38);})[_0x5167('0x23')](function(_0x2b55fd){_0x5a1182['rows']=_0x2b55fd;return _0x5a1182;});}})['then'](respondWithFilteredResult(_0x8b0aa8,_0x2a9c38))[_0x5167('0x2c')](handleError(_0x8b0aa8,null));};exports[_0x5167('0x7d')]=function(_0x3a18a1,_0x689cb0){var _0x371bd7=_0x3a18a1[_0x5167('0x58')]['id'];var _0xdc10d6=_0x3a18a1[_0x5167('0x62')];var _0x2e78dd=0xc8;var _0x1edbcc=null;return db[_0x5167('0x7e')][_0x5167('0x7f')]({'isolationLevel':db[_0x5167('0x7e')][_0x5167('0x80')][_0x5167('0x81')][_0x5167('0x82')]},function(_0x391e72){return db[_0x5167('0x42')][_0x5167('0x68')]({'where':{'id':_0x371bd7},'transaction':_0x391e72})[_0x5167('0x23')](function(_0x3764a3){if(_0x3764a3){return db[_0x5167('0x83')][_0x5167('0x3a')]({'where':{'FaxAccountId':_0x371bd7},'transaction':_0x391e72})['then'](function(){var _0x5c2878=_[_0x5167('0x46')](_0xdc10d6,function(_0x2475e3){_0x2475e3[_0x5167('0x65')]=_0x371bd7;return _0x2475e3;});return db['FaxApplication'][_0x5167('0x84')](_0x5c2878,{'transaction':_0x391e72});});}else{_0x2e78dd=0x194;_0x1edbcc=[];}});})[_0x5167('0x23')](function(){if(_0x2e78dd!==0x194){return db[_0x5167('0x83')][_0x5167('0x85')]({'where':{'FaxAccountId':_0x371bd7},'order':'priority'})[_0x5167('0x23')](function(_0x11195e){_0x1edbcc=_0x11195e;});}})[_0x5167('0x2c')](function(_0x2a5011){_0x2e78dd=0x1f4;logger[_0x5167('0x27')](_0x2a5011[_0x5167('0x86')]);if(_0x2a5011[_0x5167('0x3e')]){delete _0x2a5011[_0x5167('0x3e')];}_0x1edbcc=_0x2a5011;})['finally'](function(){if(_0x1edbcc===null){_0x689cb0['sendStatus'](_0x2e78dd);}else{if(_0x2e78dd===0x1f4){_0x689cb0[_0x5167('0x2f')](_0x2e78dd)[_0x5167('0x3f')](_0x1edbcc);}else{_0x689cb0[_0x5167('0x2f')](_0x2e78dd)['json'](_0x1edbcc);}}});};exports[_0x5167('0x87')]=function(_0x41890b,_0x3febe2,_0xad5474){var _0x34ebed={};var _0x147139={};var _0x156fe9;var _0x198536;return db[_0x5167('0x42')][_0x5167('0x68')]({'where':{'id':_0x41890b[_0x5167('0x58')]['id']}})[_0x5167('0x23')](handleEntityNotFound(_0x3febe2,null))[_0x5167('0x23')](function(_0x20f4db){if(_0x20f4db){_0x156fe9=_0x20f4db;_0x147139[_0x5167('0x45')]=_[_0x5167('0x5a')](db[_0x5167('0x83')][_0x5167('0x59')]);_0x147139[_0x5167('0x47')]=_[_0x5167('0x5a')](_0x41890b[_0x5167('0x47')]);_0x147139[_0x5167('0x4e')]=_[_0x5167('0x48')](_0x147139[_0x5167('0x45')],_0x147139[_0x5167('0x47')]);_0x34ebed[_0x5167('0x49')]=_['intersection'](_0x147139['model'],qs[_0x5167('0x4a')](_0x41890b['query'][_0x5167('0x4a')]));_0x34ebed[_0x5167('0x49')]=_0x34ebed[_0x5167('0x49')][_0x5167('0x4b')]?_0x34ebed[_0x5167('0x49')]:_0x147139[_0x5167('0x45')];_0x34ebed['order']=qs[_0x5167('0x4d')](_0x41890b[_0x5167('0x47')][_0x5167('0x4d')]);_0x34ebed[_0x5167('0x50')]=qs['filters'](_['pick'](_0x41890b[_0x5167('0x47')],_0x147139[_0x5167('0x4e')]));if(_0x41890b['query'][_0x5167('0x4f')]){_0x34ebed[_0x5167('0x50')]=_[_0x5167('0x51')](_0x34ebed['where'],{'$or':_['map'](_0x34ebed[_0x5167('0x49')],function(_0x432223){var _0x510a3={};_0x510a3[_0x432223]={'$like':'%'+_0x41890b[_0x5167('0x47')][_0x5167('0x4f')]+'%'};return _0x510a3;})});}_0x34ebed=_['merge']({},_0x34ebed,_0x41890b[_0x5167('0x52')]);return _0x156fe9[_0x5167('0x87')](_0x34ebed);}})[_0x5167('0x23')](function(_0x2d69b7){if(_0x2d69b7){_0x198536=_0x2d69b7[_0x5167('0x4b')];if(!_0x41890b[_0x5167('0x47')]['hasOwnProperty']('nolimit')){_0x34ebed['limit']=qs['limit'](_0x41890b[_0x5167('0x47')][_0x5167('0x33')]);_0x34ebed[_0x5167('0x31')]=qs[_0x5167('0x31')](_0x41890b[_0x5167('0x47')][_0x5167('0x31')]);}return _0x156fe9[_0x5167('0x87')](_0x34ebed);}})[_0x5167('0x23')](function(_0x495985){if(_0x495985){return _0x495985?{'count':_0x198536,'rows':_0x495985}:null;}})[_0x5167('0x23')](respondWithResult(_0x3febe2,null))[_0x5167('0x2c')](handleError(_0x3febe2,null));};function Extension(_0x29de62,_0x216a76,_0xc97df,_0x275521){this['context']=_0x5167('0x88');this[_0x5167('0x89')]=_0x29de62[_0x5167('0x8a')];this[_0x5167('0x8b')]=_0x275521;this[_0x5167('0x43')]=_0x5167('0x8c');this[_0x5167('0x8d')]=_0x5167('0x8e');this[_0x5167('0x65')]=_0x29de62['id'];this[_0x5167('0x8f')]=_0x216a76;this[_0x5167('0x90')]=_0xc97df;}function createExtensionsReciveFax(_0x2f3a6b){var _0x13d62c=0x1;var _0x2e7b52=[];_0x2e7b52['push'](new Extension(_0x2f3a6b,_0x13d62c,'',_0x5167('0x91')));_0x13d62c+=0x1;_0x2e7b52[_0x5167('0x92')](new Extension(_0x2f3a6b,_0x13d62c,_0x5167('0x93'),_0x5167('0x94')));_0x13d62c+=0x1;for(var _0x5a013b in _0x2f3a6b){if(_0x2f3a6b[_0x5167('0x69')](_0x5a013b)&&(_0x5a013b===_0x5167('0x95')||_0x5a013b===_0x5167('0x8a')||_0x5a013b===_0x5167('0x96')||_0x5a013b===_0x5167('0x97')||_0x5a013b===_0x5167('0x98')||_0x5a013b===_0x5167('0x99')||_0x5a013b===_0x5167('0x9a')||_0x5a013b==='modem'||_0x5a013b==='t38timeout')){_0x2e7b52[_0x5167('0x92')](new Extension(_0x2f3a6b,_0x13d62c,_0x5167('0x9b')+_0x5a013b+')='+_0x2f3a6b[_0x5a013b],_0x5167('0x94')));_0x13d62c+=0x1;}}_0x2e7b52[_0x5167('0x92')](new Extension(_0x2f3a6b,_0x13d62c,'6',_0x5167('0x9c')));_0x13d62c+=0x1;_0x2e7b52[_0x5167('0x92')](new Extension(_0x2f3a6b,_0x13d62c,_0x5167('0x9d'),'ReceiveFax'));_0x13d62c=0x0;return _0x2e7b52;}exports['addAccountApplications']=function(_0x3a0bd7,_0x2e57eb,_0x42f48c){var _0x1b5fe9;return db[_0x5167('0x7e')][_0x5167('0x7f')](function(_0x3b401e){return db['FaxAccount']['create'](_0x3a0bd7[_0x5167('0x62')],{'transaction':_0x3b401e})[_0x5167('0x23')](function(_0x250fe5){_0x1b5fe9=_0x250fe5['get']({'plain':!![]});return db[_0x5167('0x9e')]['bulkCreate'](createExtensionsReciveFax(_0x1b5fe9),{'transaction':_0x3b401e});});})['then'](function(){return _0x1b5fe9;})[_0x5167('0x23')](respondWithResult(_0x2e57eb,null))[_0x5167('0x2c')](handleError(_0x2e57eb,null));};exports[_0x5167('0x9f')]=function(_0x38b19e,_0x4d312c,_0x106e7a){var _0x44d378;return db[_0x5167('0x7e')][_0x5167('0x7f')](function(_0xd64cf6){return db[_0x5167('0x42')][_0x5167('0x39')](_0x38b19e[_0x5167('0x62')],{'where':{'id':_0x38b19e[_0x5167('0x62')]['id']},'transaction':_0xd64cf6})[_0x5167('0x23')](function(_0x14958c){return db['VoiceExtension']['destroy']({'where':{'FaxAccountId':_0x38b19e[_0x5167('0x62')]['id']},'transaction':_0xd64cf6})[_0x5167('0x23')](function(_0x5667a3){return db[_0x5167('0x9e')][_0x5167('0x84')](createExtensionsReciveFax(_[_0x5167('0xa0')](_0x38b19e[_0x5167('0x62')],['tech',_0x5167('0x44'),'createdAt',_0x5167('0xa1'),'TrunkId','ListId'])),{'transaction':_0xd64cf6});});});})[_0x5167('0x23')](function(){return db['FaxAccount'][_0x5167('0xa2')](_0x38b19e[_0x5167('0x62')]['id']);})[_0x5167('0x23')](respondWithResult(_0x4d312c,null))['catch'](handleError(_0x4d312c,null));};exports['getMessages']=function(_0x50a848,_0x6225fa,_0x1c32ae){var _0x45e678={'raw':!![],'where':{}};var _0x9b39ec={};var _0xd08153={'count':0x0,'rows':[]};return db[_0x5167('0x42')]['findOne']({'where':{'id':_0x50a848[_0x5167('0x58')]['id']}})[_0x5167('0x23')](handleEntityNotFound(_0x6225fa,null))[_0x5167('0x23')](function(_0x2377a9){if(_0x2377a9){_0x9b39ec[_0x5167('0x45')]=_[_0x5167('0x5a')](db['FaxMessage'][_0x5167('0x59')]);_0x9b39ec['query']=_[_0x5167('0x5a')](_0x50a848[_0x5167('0x47')]);_0x9b39ec[_0x5167('0x4e')]=_[_0x5167('0x48')](_0x9b39ec[_0x5167('0x45')],_0x9b39ec[_0x5167('0x47')]);_0x45e678[_0x5167('0x49')]=_[_0x5167('0x48')](_0x9b39ec[_0x5167('0x45')],qs['fields'](_0x50a848[_0x5167('0x47')]['fields']));_0x45e678[_0x5167('0x49')]=_0x45e678[_0x5167('0x49')][_0x5167('0x4b')]?_0x45e678[_0x5167('0x49')]:_0x9b39ec['model'];if(!_0x50a848[_0x5167('0x47')][_0x5167('0x69')](_0x5167('0x4c'))){_0x45e678[_0x5167('0x33')]=qs[_0x5167('0x33')](_0x50a848[_0x5167('0x47')][_0x5167('0x33')]);_0x45e678['offset']=qs[_0x5167('0x31')](_0x50a848['query'][_0x5167('0x31')]);}_0x45e678[_0x5167('0x6a')]=qs[_0x5167('0x4d')](_0x50a848[_0x5167('0x47')][_0x5167('0x4d')]);_0x45e678[_0x5167('0x50')]=qs[_0x5167('0x4e')](_[_0x5167('0x6b')](_0x50a848[_0x5167('0x47')],_0x9b39ec[_0x5167('0x4e')]));_0x45e678[_0x5167('0x50')][_0x5167('0x65')]=_0x2377a9['id'];if(_0x50a848[_0x5167('0x47')]['filter']){_0x45e678['where']=_[_0x5167('0x51')](_0x45e678[_0x5167('0x50')],{'$or':_[_0x5167('0x46')](_0x45e678[_0x5167('0x49')],function(_0x42334a){var _0x545014={};_0x545014[_0x42334a]={'$like':'%'+_0x50a848[_0x5167('0x47')][_0x5167('0x4f')]+'%'};return _0x545014;})});}if(_0x50a848[_0x5167('0x47')][_0x5167('0xa3')]){var _0x518a75=_0x50a848[_0x5167('0x47')][_0x5167('0xa3')][_0x5167('0xa4')](',');var _0x2e3d61={};_0x2e3d61[_0x518a75[0x0]]={'$gte':moment(_0x518a75[0x1])['format'](_0x5167('0xa5'))};_0x45e678[_0x5167('0x50')]=_[_0x5167('0x51')](_0x45e678[_0x5167('0x50')],_0x2e3d61);}_0x45e678=_['merge']({},_0x45e678,_0x50a848[_0x5167('0x52')]);return db[_0x5167('0xa6')][_0x5167('0x34')]({'where':_0x45e678[_0x5167('0x50')]})[_0x5167('0x23')](function(_0xd0ea58){_0xd08153[_0x5167('0x34')]=_0xd0ea58;if(_0x50a848[_0x5167('0x47')][_0x5167('0x53')]){_0x45e678[_0x5167('0x54')]=[{'all':!![]}];}return db[_0x5167('0xa6')][_0x5167('0x55')](_0x45e678);})[_0x5167('0x23')](function(_0xdccf81){_0xd08153[_0x5167('0x56')]=_0xdccf81;return _0xd08153;});}})[_0x5167('0x23')](respondWithFilteredResult(_0x6225fa,_0x45e678))[_0x5167('0x2c')](handleError(_0x6225fa,null));};exports[_0x5167('0x3f')]=function(_0x4fad00,_0x112ca7,_0x19d2b5){var _0x466432,_0x26dd16={},_0x922a27;if(_0x4fad00[_0x5167('0x62')]['to']){_0x922a27=_0x4fad00[_0x5167('0x62')]['to'][0x0];}return db[_0x5167('0x42')][_0x5167('0x5b')]({'where':{'id':_0x4fad00[_0x5167('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0x5167('0xa7'),'include':[{'model':db[_0x5167('0x75')],'as':_0x5167('0xa8'),'where':{'fax':_0x922a27},'limit':0x1,'order':[[_0x5167('0xa1'),_0x5167('0xa9')]]}]}]})['then'](handleEntityNotFound(_0x112ca7,null))[_0x5167('0x23')](function(_0x3902ad){_0x466432=_0x3902ad;if(_0x4fad00[_0x5167('0x62')][_0x5167('0xaa')]&&_0x4fad00[_0x5167('0x62')][_0x5167('0xaa')][_0x5167('0x4b')]){for(var _0xe5b5a1=0x0;_0xe5b5a1<_0x4fad00[_0x5167('0x62')][_0x5167('0xaa')][_0x5167('0x4b')];_0xe5b5a1+=0x1){_0x4fad00[_0x5167('0x62')]['attachments'][_0xe5b5a1]={'filename':_0x4fad00[_0x5167('0x62')]['attachments'][_0xe5b5a1][_0x5167('0x3e')],'id':_0x4fad00[_0x5167('0x62')]['attachments'][_0xe5b5a1]['id'],'path':path[_0x5167('0xab')](config[_0x5167('0xac')],_0x5167('0xad'),_0x4fad00[_0x5167('0x62')][_0x5167('0xaa')][_0xe5b5a1][_0x5167('0xae')])};}}return respondWithRpcPromise(_0x5167('0xaf'),_0x5167('0xaf'),{'FaxAccountId':_[_0x5167('0xb0')](_0x4fad00['params']['id'])?undefined:_0x4fad00[_0x5167('0x58')]['id'],'path':_['isNil'](_0x4fad00['body'][_0x5167('0xaa')][0x0][_0x5167('0xb1')])?undefined:_0x4fad00[_0x5167('0x62')][_0x5167('0xaa')][0x0][_0x5167('0xb1')],'fax':_['isNil'](_0x4fad00['body']['to'][0x0])?undefined:_0x4fad00[_0x5167('0x62')]['to'][0x0]},client9002);})['then'](function(){if(_0x466432){if(_['isNil'](_0x4fad00[_0x5167('0x62')][_0x5167('0xb2')])){_0x4fad00[_0x5167('0x62')][_0x5167('0xb2')]=util[_0x5167('0xb3')](_0x5167('0xb4'),_0x466432[_0x5167('0x3e')],_0x466432[_0x5167('0xb5')]);}if(_0x466432[_0x5167('0xa7')]){if(_0x466432[_0x5167('0xa7')][_0x5167('0xa8')][_0x5167('0x4b')]){return _0x466432[_0x5167('0xa7')]['Contacts'][0x0];}else{return db['CmContact']['create'](_['defaults'](_0x4fad00[_0x5167('0x62')],{'firstName':_0x4fad00[_0x5167('0x62')]['to'][0x0],'phone':_0x4fad00['body']['to'][0x0],'fax':_0x4fad00[_0x5167('0x62')]['to'][0x0],'ListId':_0x466432[_0x5167('0xb6')]}));}}else{throw new Error(_0x5167('0xb7'));}}else{throw new Error(_0x5167('0xb8'));}})[_0x5167('0x23')](function(_0x21f0c7){if(_0x21f0c7){return db[_0x5167('0x72')][_0x5167('0x5b')]({'where':{'ContactId':_0x21f0c7['id'],'closed':![],'FaxAccountId':_0x466432['id']}})[_0x5167('0x23')](function(_0x1c2dc7){if(_0x1c2dc7){return[_0x1c2dc7,![]];}return db[_0x5167('0x72')][_0x5167('0x5c')]({'UserId':_0x4fad00[_0x5167('0x5d')]['id'],'ContactId':_0x21f0c7['id'],'FaxAccountId':_0x466432['id'],'fax':_0x4fad00[_0x5167('0x62')]['to'][0x0],'firstMsgDirection':_0x5167('0xb9'),'Messages':[_[_0x5167('0x51')](_0x4fad00[_0x5167('0x62')],{'read':![],'body':_0x4fad00[_0x5167('0x62')][_0x5167('0xaa')][0x0]['filename'],'FaxAccountId':_0x466432['id'],'UserId':_0x4fad00['user']['id'],'ContactId':_0x21f0c7['id'],'AttachmentId':_0x4fad00['body'][_0x5167('0xaa')][0x0]['id']})]},{'include':[{'model':db[_0x5167('0xa6')],'as':_0x5167('0xba')}]})[_0x5167('0x23')](function(_0x38afd0){return[_0x38afd0,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x203c8c,_0xca6f0e){if(_0xca6f0e){return _0x203c8c;}return db['FaxMessage'][_0x5167('0x5c')]({'direction':_0x5167('0xb9'),'read':![],'body':_0x4fad00[_0x5167('0x62')][_0x5167('0xaa')][0x0][_0x5167('0xbb')],'FaxAccountId':_0x466432['id'],'FaxInteractionId':_0x203c8c['id'],'UserId':_0x4fad00[_0x5167('0x5d')]['id'],'ContactId':_0x203c8c['ContactId'],'AttachmentId':_0x4fad00[_0x5167('0x62')][_0x5167('0xaa')][0x0]['id']})[_0x5167('0x23')](function(_0x2b31a1){_0x203c8c[_0x5167('0xbc')]['Messages']=[];_0x203c8c[_0x5167('0xbc')][_0x5167('0xba')][_0x5167('0x92')](_0x2b31a1[_0x5167('0xbc')]);return _0x203c8c;});})['then'](function(_0x1369c3){respondWithRpcPromise(_0x5167('0xbd'),_0x5167('0xbd'),{'FaxAccountId':_[_0x5167('0xb0')](_0x4fad00[_0x5167('0x58')]['id'])?undefined:_0x4fad00[_0x5167('0x58')]['id'],'path':_[_0x5167('0xb0')](_0x4fad00[_0x5167('0x62')][_0x5167('0xaa')][0x0][_0x5167('0xb1')])?undefined:_0x4fad00[_0x5167('0x62')]['attachments'][0x0][_0x5167('0xb1')],'fax':_[_0x5167('0xb0')](_0x4fad00[_0x5167('0x62')]['to'][0x0])?undefined:_0x4fad00[_0x5167('0x62')]['to'][0x0],'AttachmentId':_0x4fad00[_0x5167('0x62')]['attachments'][0x0]['id']},client9002)[_0x5167('0x23')](function(_0x3d1a64){logger['info'](_0x5167('0xbe'),_0x3d1a64);})[_0x5167('0x2c')](function(_0xef69a1){logger[_0x5167('0x2a')](_0x5167('0xbe'),_0xef69a1);});return _0x1369c3;})['then'](respondWithResult(_0x112ca7,null))[_0x5167('0x2c')](handleError(_0x112ca7,null));};exports[_0x5167('0xbf')]=function(_0x579f27,_0x3f8e1d,_0xa158e){return db[_0x5167('0x42')][_0x5167('0x5b')]({'where':{'id':_0x579f27['params']['id']}})[_0x5167('0x23')](handleEntityNotFound(_0x3f8e1d,null))[_0x5167('0x23')](function(_0x477c23){if(_0x477c23){return _0x477c23[_0x5167('0xbf')](_0x579f27[_0x5167('0x62')]['ids'],_['omit'](_0x579f27[_0x5167('0x62')],[_0x5167('0x6d'),'id'])||{})[_0x5167('0xc0')](function(_0x4722f4){for(var _0x326fa3=0x0;_0x326fa3<_0x579f27['body'][_0x5167('0x6d')]['length'];_0x326fa3+=0x1){socket[_0x5167('0xc1')](_0x5167('0xc2'),{'UserId':Number(_0x579f27[_0x5167('0x62')][_0x5167('0x6d')][_0x326fa3]),'FaxAccountId':Number(_0x579f27[_0x5167('0x58')]['id'])});}return _0x4722f4;});}})['then'](respondWithResult(_0x3f8e1d,null))[_0x5167('0x2c')](handleError(_0x3f8e1d,null));};exports['removeAgents']=function(_0x5055fe,_0x3dbb0b,_0x230d9b){return db[_0x5167('0x42')][_0x5167('0x5b')]({'where':{'id':_0x5055fe[_0x5167('0x58')]['id']}})['then'](handleEntityNotFound(_0x3dbb0b,null))[_0x5167('0x23')](function(_0xd9a075){if(_0xd9a075){return _0xd9a075[_0x5167('0xc3')](_0x5055fe[_0x5167('0x47')]['ids'])[_0x5167('0x23')](function(){if(_[_0x5167('0xc4')](_0x5055fe[_0x5167('0x47')][_0x5167('0x6d')])){for(var _0x551388=0x0;_0x551388<_0x5055fe[_0x5167('0x47')][_0x5167('0x6d')][_0x5167('0x4b')];_0x551388+=0x1){socket[_0x5167('0xc1')](_0x5167('0xc5'),{'UserId':Number(_0x5055fe['query'][_0x5167('0x6d')][_0x551388]),'FaxAccountId':Number(_0x5055fe[_0x5167('0x58')]['id'])});}}else{socket[_0x5167('0xc1')](_0x5167('0xc5'),{'UserId':Number(_0x5055fe['query'][_0x5167('0x6d')]),'FaxAccountId':Number(_0x5055fe[_0x5167('0x58')]['id'])});}});}})[_0x5167('0x23')](respondWithStatusCode(_0x3dbb0b,null))['catch'](handleError(_0x3dbb0b,null));};exports[_0x5167('0xc6')]=function(_0x4510b6,_0xa5d7d0,_0x3ac352){var _0x38c6ed={};var _0x3a95e6={};var _0x477a66;var _0x1b15fa;return db[_0x5167('0x42')][_0x5167('0x68')]({'where':{'id':_0x4510b6[_0x5167('0x58')]['id']}})['then'](handleEntityNotFound(_0xa5d7d0,null))[_0x5167('0x23')](function(_0x221da6){if(_0x221da6){_0x477a66=_0x221da6;_0x3a95e6['model']=_[_0x5167('0x5a')](db['User'][_0x5167('0x59')]);_0x3a95e6[_0x5167('0x47')]=_[_0x5167('0x5a')](_0x4510b6[_0x5167('0x47')]);_0x3a95e6[_0x5167('0x4e')]=_[_0x5167('0x48')](_0x3a95e6[_0x5167('0x45')],_0x3a95e6['query']);_0x38c6ed[_0x5167('0x49')]=_[_0x5167('0x48')](_0x3a95e6[_0x5167('0x45')],qs[_0x5167('0x4a')](_0x4510b6[_0x5167('0x47')][_0x5167('0x4a')]));_0x38c6ed[_0x5167('0x49')]=_0x38c6ed[_0x5167('0x49')][_0x5167('0x4b')]?_0x38c6ed[_0x5167('0x49')]:_0x3a95e6[_0x5167('0x45')];_0x38c6ed['order']=qs[_0x5167('0x4d')](_0x4510b6[_0x5167('0x47')][_0x5167('0x4d')]);_0x38c6ed[_0x5167('0x50')]=qs[_0x5167('0x4e')](_[_0x5167('0x6b')](_0x4510b6['query'],_0x3a95e6['filters']));if(_0x4510b6[_0x5167('0x47')]['filter']){_0x38c6ed[_0x5167('0x50')]=_[_0x5167('0x51')](_0x38c6ed[_0x5167('0x50')],{'$or':_[_0x5167('0x46')](_0x38c6ed['attributes'],function(_0x30639b){var _0x17f229={};_0x17f229[_0x30639b]={'$like':'%'+_0x4510b6['query'][_0x5167('0x4f')]+'%'};return _0x17f229;})});}_0x38c6ed=_[_0x5167('0x51')]({},_0x38c6ed,_0x4510b6[_0x5167('0x52')]);return _0x477a66['getAgents'](_0x38c6ed);}})[_0x5167('0x23')](function(_0x43eac6){if(_0x43eac6){_0x1b15fa=_0x43eac6['length'];if(!_0x4510b6[_0x5167('0x47')][_0x5167('0x69')](_0x5167('0x4c'))){_0x38c6ed['limit']=qs['limit'](_0x4510b6[_0x5167('0x47')][_0x5167('0x33')]);_0x38c6ed[_0x5167('0x31')]=qs[_0x5167('0x31')](_0x4510b6[_0x5167('0x47')][_0x5167('0x31')]);}return _0x477a66[_0x5167('0xc6')](_0x38c6ed);}})[_0x5167('0x23')](function(_0x5ef5f6){if(_0x5ef5f6){return _0x5ef5f6?{'count':_0x1b15fa,'rows':_0x5ef5f6}:null;}})[_0x5167('0x23')](respondWithResult(_0xa5d7d0,null))[_0x5167('0x2c')](handleError(_0xa5d7d0,null));}; \ No newline at end of file +var _0x6820=['info','FaxAccount,\x20%s,\x20%s','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','destroy','get','FaxAccounts','UserProfileResource','name','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','FaxAccountId','Disposition','getDispositions','findOne','filter','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','priority','finally','send','getApplications','context','from-voip-provider','localstationid','app','system','description','Fax\x20Extension','push','Answer','CDR(type)=inbound-fax','ecm','gateway','faxdetect','maxrate','minrate','FAXOPT(','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','ListId','findById','getMessages','FaxMessage','$gte','split','CmList','List','Contacts','DESC','attachments','join','server/files/attachments','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','spread','userFaxAccount:save','isArray','emit','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','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','redis','localhost','register','jayson/promise','client','http','request','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x338332,_0x4c71c1){var _0x165878=function(_0x57d096){while(--_0x57d096){_0x338332['push'](_0x338332['shift']());}};_0x165878(++_0x4c71c1);}(_0x6820,0x15e));var _0x0682=function(_0x359247,_0x34860e){_0x359247=_0x359247-0x0;var _0xb8bc23=_0x6820[_0x359247];return _0xb8bc23;};'use strict';var emlformat=require(_0x0682('0x0'));var rimraf=require(_0x0682('0x1'));var zipdir=require(_0x0682('0x2'));var jsonpatch=require(_0x0682('0x3'));var rp=require(_0x0682('0x4'));var moment=require(_0x0682('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0682('0x6'));var path=require(_0x0682('0x7'));var sox=require(_0x0682('0x8'));var csv=require('to-csv');var ejs=require(_0x0682('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0682('0xa'));var squel=require(_0x0682('0xb'));var crypto=require(_0x0682('0xc'));var jsforce=require(_0x0682('0xd'));var deskjs=require(_0x0682('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0682('0xf'));var Papa=require('papaparse');var Redis=require(_0x0682('0x10'));var authService=require(_0x0682('0x11'));var qs=require(_0x0682('0x12'));var as=require(_0x0682('0x13'));var hardwareService=require(_0x0682('0x14'));var logger=require(_0x0682('0x15'))(_0x0682('0x16'));var utils=require(_0x0682('0x17'));var config=require(_0x0682('0x18'));var licenseUtil=require(_0x0682('0x19'));var db=require(_0x0682('0x1a'))['db'];config[_0x0682('0x1b')]=_['defaults'](config[_0x0682('0x1b')],{'host':_0x0682('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0682('0x1b')]));require('./faxAccount.socket')[_0x0682('0x1d')](socket);var jayson=require(_0x0682('0x1e'));var client=jayson[_0x0682('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x0682('0x1f')][_0x0682('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x11e75b,_0x377988,_0x39a0ba,_0x9cf5a8){return new BPromise(function(_0x280820,_0x98b5a1){var _0x50cb70=_0x9cf5a8||client;return _0x50cb70[_0x0682('0x21')](_0x11e75b,_0x39a0ba)[_0x0682('0x22')](function(_0x5e626a){logger['info']('FaxAccount,\x20%s,\x20%s',_0x377988,_0x0682('0x23'));logger[_0x0682('0x24')](_0x0682('0x25'),_0x377988,'request\x20sent',JSON['stringify'](_0x5e626a));if(_0x5e626a[_0x0682('0x26')]){if(_0x5e626a['error']['code']===0x1f4){logger[_0x0682('0x26')]('FaxAccount,\x20%s,\x20%s',_0x377988,_0x5e626a['error'][_0x0682('0x27')]);return _0x98b5a1(_0x5e626a[_0x0682('0x26')][_0x0682('0x27')]);}logger[_0x0682('0x26')]('FaxAccount,\x20%s,\x20%s',_0x377988,_0x5e626a[_0x0682('0x26')][_0x0682('0x27')]);return _0x280820(_0x5e626a['error'][_0x0682('0x27')]);}else{logger[_0x0682('0x28')](_0x0682('0x29'),_0x377988,_0x0682('0x23'));_0x280820(_0x5e626a['result'][_0x0682('0x27')]);}})['catch'](function(_0x217b66){logger[_0x0682('0x26')](_0x0682('0x29'),_0x377988,_0x217b66);_0x98b5a1(_0x217b66);});});}function respondWithStatusCode(_0x5ee423,_0x2d0dc5){_0x2d0dc5=_0x2d0dc5||0xcc;return function(_0x4edc6b){if(_0x4edc6b){return _0x5ee423[_0x0682('0x2a')](_0x2d0dc5);}return _0x5ee423[_0x0682('0x2b')](_0x2d0dc5)[_0x0682('0x2c')]();};}function respondWithResult(_0x3d4836,_0x19cada){_0x19cada=_0x19cada||0xc8;return function(_0xaa5ae1){if(_0xaa5ae1){return _0x3d4836[_0x0682('0x2b')](_0x19cada)[_0x0682('0x2d')](_0xaa5ae1);}};}function respondWithFilteredResult(_0x98a3d1,_0x87dc9){return function(_0x3e55e1){if(_0x3e55e1){var _0x54bf92=typeof _0x87dc9[_0x0682('0x2e')]===_0x0682('0x2f')&&typeof _0x87dc9['limit']==='undefined';var _0x3400e3=_0x3e55e1[_0x0682('0x30')];var _0x360120=_0x54bf92?0x0:_0x87dc9[_0x0682('0x2e')];var _0x1be2f4=_0x54bf92?_0x3e55e1['count']:_0x87dc9['offset']+_0x87dc9[_0x0682('0x31')];var _0x2f08ab;if(_0x1be2f4>=_0x3400e3){_0x1be2f4=_0x3400e3;_0x2f08ab=0xc8;}else{_0x2f08ab=0xce;}_0x98a3d1[_0x0682('0x2b')](_0x2f08ab);return _0x98a3d1['set'](_0x0682('0x32'),_0x360120+'-'+_0x1be2f4+'/'+_0x3400e3)[_0x0682('0x2d')](_0x3e55e1);}return null;};}function patchUpdates(_0x2d6ed3){return function(_0xc3649c){try{jsonpatch[_0x0682('0x33')](_0xc3649c,_0x2d6ed3,!![]);}catch(_0x1f0cf4){return BPromise['reject'](_0x1f0cf4);}return _0xc3649c['save']();};}function saveUpdates(_0x43b004,_0x4490ae){return function(_0x35d19f){if(_0x35d19f){return _0x35d19f['update'](_0x43b004)[_0x0682('0x22')](function(_0x518416){return _0x518416;});}return null;};}function removeEntity(_0x4bd09c,_0x5d495b){return function(_0x51078e){if(_0x51078e){return _0x51078e[_0x0682('0x34')]()[_0x0682('0x22')](function(){var _0x96338d=_0x51078e[_0x0682('0x35')]({'plain':!![]});var _0xf7b356=_0x0682('0x36');return db[_0x0682('0x37')][_0x0682('0x34')]({'where':{'type':_0xf7b356,'resourceId':_0x96338d['id']}})[_0x0682('0x22')](function(){return _0x51078e;});})[_0x0682('0x22')](function(){_0x4bd09c[_0x0682('0x2b')](0xcc)[_0x0682('0x2c')]();});}};}function handleEntityNotFound(_0x190af6,_0x22cb97){return function(_0x1e9c6c){if(!_0x1e9c6c){_0x190af6[_0x0682('0x2a')](0x194);}return _0x1e9c6c;};}function handleError(_0x52f36d,_0x1ff492){_0x1ff492=_0x1ff492||0x1f4;return function(_0x3f59aa){logger[_0x0682('0x26')](_0x3f59aa['stack']);if(_0x3f59aa['name']){delete _0x3f59aa[_0x0682('0x38')];}_0x52f36d['status'](_0x1ff492)['send'](_0x3f59aa);};}exports[_0x0682('0x39')]=function(_0x563e45,_0x3124d3){var _0x1e58e4={'include':[{'model':db[_0x0682('0x3a')],'as':_0x0682('0x3b')}]},_0x55cdc7={},_0x2950d1={'count':0x0,'rows':[]};var _0x24856a=_[_0x0682('0x3c')](db[_0x0682('0x3d')][_0x0682('0x3e')],function(_0x478eea){return{'name':_0x478eea[_0x0682('0x3f')],'type':_0x478eea[_0x0682('0x40')][_0x0682('0x41')]};});_0x55cdc7[_0x0682('0x42')]=_[_0x0682('0x3c')](_0x24856a,_0x0682('0x38'));_0x55cdc7[_0x0682('0x43')]=_[_0x0682('0x44')](_0x563e45[_0x0682('0x43')]);_0x55cdc7[_0x0682('0x45')]=_[_0x0682('0x46')](_0x55cdc7['model'],_0x55cdc7[_0x0682('0x43')]);_0x1e58e4[_0x0682('0x47')]=_['intersection'](_0x55cdc7[_0x0682('0x42')],qs[_0x0682('0x48')](_0x563e45['query'][_0x0682('0x48')]));_0x1e58e4[_0x0682('0x47')]=_0x1e58e4[_0x0682('0x47')][_0x0682('0x49')]?_0x1e58e4[_0x0682('0x47')]:_0x55cdc7[_0x0682('0x42')];if(!_0x563e45[_0x0682('0x43')][_0x0682('0x4a')](_0x0682('0x4b'))){_0x1e58e4[_0x0682('0x31')]=qs['limit'](_0x563e45[_0x0682('0x43')][_0x0682('0x31')]);_0x1e58e4[_0x0682('0x2e')]=qs[_0x0682('0x2e')](_0x563e45[_0x0682('0x43')][_0x0682('0x2e')]);}_0x1e58e4[_0x0682('0x4c')]=qs['sort'](_0x563e45[_0x0682('0x43')][_0x0682('0x4d')]);_0x1e58e4['where']=qs[_0x0682('0x45')](_[_0x0682('0x4e')](_0x563e45[_0x0682('0x43')],_0x55cdc7[_0x0682('0x45')]),_0x24856a);if(_0x563e45[_0x0682('0x43')]['filter']){_0x1e58e4[_0x0682('0x4f')]=_[_0x0682('0x50')](_0x1e58e4[_0x0682('0x4f')],{'$or':_[_0x0682('0x3c')](_0x24856a,function(_0x3acc5f){if(_0x3acc5f[_0x0682('0x40')]!==_0x0682('0x51')){var _0xf90365={};_0xf90365[_0x3acc5f['name']]={'$like':'%'+_0x563e45[_0x0682('0x43')]['filter']+'%'};return _0xf90365;}})});}_0x1e58e4=_['merge']({},_0x1e58e4,_0x563e45[_0x0682('0x52')]);var _0x42269a={'where':_0x1e58e4[_0x0682('0x4f')]};return db[_0x0682('0x3d')][_0x0682('0x30')](_0x42269a)['then'](function(_0x282da2){_0x2950d1[_0x0682('0x30')]=_0x282da2;if(_0x563e45[_0x0682('0x43')]['includeAll']){_0x1e58e4[_0x0682('0x53')]=[{'all':!![]}];}return db[_0x0682('0x3d')][_0x0682('0x54')](_0x1e58e4);})[_0x0682('0x22')](function(_0x2815f5){_0x2950d1[_0x0682('0x55')]=_0x2815f5;return _0x2950d1;})[_0x0682('0x22')](respondWithFilteredResult(_0x3124d3,_0x1e58e4))[_0x0682('0x56')](handleError(_0x3124d3,null));};exports[_0x0682('0x57')]=function(_0x6ace1f,_0x27cafb){var _0x119de4={'raw':![],'where':{'id':_0x6ace1f['params']['id']},'include':[{'model':db[_0x0682('0x3a')],'as':_0x0682('0x3b')}]},_0x1e44e7={};_0x1e44e7[_0x0682('0x42')]=_['keys'](db[_0x0682('0x3d')][_0x0682('0x3e')]);_0x1e44e7['query']=_[_0x0682('0x44')](_0x6ace1f[_0x0682('0x43')]);_0x1e44e7[_0x0682('0x45')]=_['intersection'](_0x1e44e7[_0x0682('0x42')],_0x1e44e7[_0x0682('0x43')]);_0x119de4[_0x0682('0x47')]=_[_0x0682('0x46')](_0x1e44e7[_0x0682('0x42')],qs['fields'](_0x6ace1f[_0x0682('0x43')][_0x0682('0x48')]));_0x119de4[_0x0682('0x47')]=_0x119de4[_0x0682('0x47')][_0x0682('0x49')]?_0x119de4[_0x0682('0x47')]:_0x1e44e7['model'];if(_0x6ace1f[_0x0682('0x43')][_0x0682('0x58')]){_0x119de4[_0x0682('0x53')]=[{'all':!![]}];}_0x119de4=_[_0x0682('0x50')]({},_0x119de4,_0x6ace1f[_0x0682('0x52')]);return db[_0x0682('0x3d')]['find'](_0x119de4)['then'](handleEntityNotFound(_0x27cafb,null))[_0x0682('0x22')](respondWithResult(_0x27cafb,null))[_0x0682('0x56')](handleError(_0x27cafb,null));};exports['create']=function(_0x42979e,_0x14ea08){return db[_0x0682('0x3d')][_0x0682('0x59')](_0x42979e[_0x0682('0x5a')],{})[_0x0682('0x22')](function(_0x55f585){var _0x37720f=_0x42979e[_0x0682('0x5b')]['get']({'plain':!![]});if(!_0x37720f)throw new Error(_0x0682('0x5c'));if(_0x37720f[_0x0682('0x5d')]==='user'){var _0x5e21bb=_0x55f585[_0x0682('0x35')]({'plain':!![]});var _0x11c273=_0x0682('0x36');return db[_0x0682('0x5e')][_0x0682('0x5f')]({'where':{'name':_0x11c273,'userProfileId':_0x37720f[_0x0682('0x60')]},'raw':!![]})[_0x0682('0x22')](function(_0xde6485){if(_0xde6485&&_0xde6485['autoAssociation']===0x0){return db['UserProfileResource'][_0x0682('0x59')]({'name':_0x5e21bb[_0x0682('0x38')],'resourceId':_0x5e21bb['id'],'type':_0xde6485[_0x0682('0x38')],'sectionId':_0xde6485['id']},{})[_0x0682('0x22')](function(){return _0x55f585;});}else{return _0x55f585;}})['catch'](function(_0x34516a){logger['error'](_0x0682('0x61'),_0x34516a);throw _0x34516a;});}return _0x55f585;})[_0x0682('0x22')](respondWithResult(_0x14ea08,0xc9))['catch'](handleError(_0x14ea08,null));};exports[_0x0682('0x62')]=function(_0x415d1b,_0x3c72b4){if(_0x415d1b['body']['id']){delete _0x415d1b['body']['id'];}return db[_0x0682('0x3d')][_0x0682('0x5f')]({'where':{'id':_0x415d1b[_0x0682('0x63')]['id']},'include':[{'model':db[_0x0682('0x3a')],'as':_0x0682('0x3b')}]})[_0x0682('0x22')](handleEntityNotFound(_0x3c72b4,null))[_0x0682('0x22')](saveUpdates(_0x415d1b[_0x0682('0x5a')],null))['then'](respondWithResult(_0x3c72b4,null))[_0x0682('0x56')](handleError(_0x3c72b4,null));};exports['destroy']=function(_0x1380c9,_0x1b3b90){return db[_0x0682('0x3d')]['find']({'where':{'id':_0x1380c9['params']['id']}})[_0x0682('0x22')](handleEntityNotFound(_0x1b3b90,null))[_0x0682('0x22')](removeEntity(_0x1b3b90,null))[_0x0682('0x56')](handleError(_0x1b3b90,null));};exports[_0x0682('0x64')]=function(_0x105c24,_0x443947){return db[_0x0682('0x3d')][_0x0682('0x64')]()[_0x0682('0x22')](respondWithResult(_0x443947,null))[_0x0682('0x56')](handleError(_0x443947,null));};exports['addDisposition']=function(_0x1ab027,_0x1bf0cc,_0x37da95){if(_0x1ab027[_0x0682('0x5a')]['id']){delete _0x1ab027['body']['id'];}return db[_0x0682('0x3d')][_0x0682('0x5f')]({'where':{'id':_0x1ab027['params']['id']}})[_0x0682('0x22')](handleEntityNotFound(_0x1bf0cc,null))[_0x0682('0x22')](function(_0x184072){if(_0x184072){_0x1ab027[_0x0682('0x5a')][_0x0682('0x65')]=_0x184072['id'];return db[_0x0682('0x66')]['create'](_0x1ab027[_0x0682('0x5a')]);}})[_0x0682('0x22')](respondWithResult(_0x1bf0cc,null))[_0x0682('0x56')](handleError(_0x1bf0cc,null));};exports[_0x0682('0x67')]=function(_0x219418,_0x41d13c,_0x4fdb2d){var _0x47f561={'raw':![],'where':{}};var _0xf66b6b={};var _0x3b7956={'count':0x0,'rows':[]};return db[_0x0682('0x3d')][_0x0682('0x68')]({'where':{'id':_0x219418[_0x0682('0x63')]['id']}})[_0x0682('0x22')](handleEntityNotFound(_0x41d13c,null))[_0x0682('0x22')](function(_0x4b9cf2){if(_0x4b9cf2){_0xf66b6b[_0x0682('0x42')]=_[_0x0682('0x44')](db[_0x0682('0x66')]['rawAttributes']);_0xf66b6b[_0x0682('0x43')]=_[_0x0682('0x44')](_0x219418[_0x0682('0x43')]);_0xf66b6b[_0x0682('0x45')]=_[_0x0682('0x46')](_0xf66b6b[_0x0682('0x42')],_0xf66b6b[_0x0682('0x43')]);_0x47f561[_0x0682('0x47')]=_[_0x0682('0x46')](_0xf66b6b[_0x0682('0x42')],qs[_0x0682('0x48')](_0x219418[_0x0682('0x43')][_0x0682('0x48')]));_0x47f561[_0x0682('0x47')]=_0x47f561[_0x0682('0x47')][_0x0682('0x49')]?_0x47f561[_0x0682('0x47')]:_0xf66b6b[_0x0682('0x42')];if(!_0x219418[_0x0682('0x43')]['hasOwnProperty'](_0x0682('0x4b'))){_0x47f561[_0x0682('0x31')]=qs[_0x0682('0x31')](_0x219418[_0x0682('0x43')]['limit']);_0x47f561['offset']=qs[_0x0682('0x2e')](_0x219418[_0x0682('0x43')][_0x0682('0x2e')]);}_0x47f561[_0x0682('0x4c')]=qs[_0x0682('0x4d')](_0x219418[_0x0682('0x43')][_0x0682('0x4d')]);_0x47f561[_0x0682('0x4f')]=qs[_0x0682('0x45')](_['pick'](_0x219418[_0x0682('0x43')],_0xf66b6b['filters']));_0x47f561[_0x0682('0x4f')][_0x0682('0x65')]=_0x4b9cf2['id'];if(_0x219418[_0x0682('0x43')][_0x0682('0x69')]){_0x47f561[_0x0682('0x4f')]=_[_0x0682('0x50')](_0x47f561[_0x0682('0x4f')],{'$or':_[_0x0682('0x3c')](_0x47f561[_0x0682('0x47')],function(_0x5db229){var _0x2dd3db={};_0x2dd3db[_0x5db229]={'$like':'%'+_0x219418['query']['filter']+'%'};return _0x2dd3db;})});}_0x47f561=_[_0x0682('0x50')]({},_0x47f561,_0x219418[_0x0682('0x52')]);return db['Disposition'][_0x0682('0x30')]({'where':_0x47f561[_0x0682('0x4f')]})[_0x0682('0x22')](function(_0x5693a5){_0x3b7956[_0x0682('0x30')]=_0x5693a5;if(_0x219418['query'][_0x0682('0x58')]){_0x47f561[_0x0682('0x53')]=[{'all':!![]}];}return db[_0x0682('0x66')]['findAll'](_0x47f561);})['then'](function(_0x1caa4d){_0x3b7956[_0x0682('0x55')]=_0x1caa4d;return _0x3b7956;});}})[_0x0682('0x22')](respondWithFilteredResult(_0x41d13c,_0x47f561))[_0x0682('0x56')](handleError(_0x41d13c,null));};exports[_0x0682('0x6a')]=function(_0x4d3fab,_0x4ae1de,_0x1a7986){return db[_0x0682('0x3d')][_0x0682('0x5f')]({'where':{'id':_0x4d3fab[_0x0682('0x63')]['id']}})[_0x0682('0x22')](handleEntityNotFound(_0x4ae1de,null))[_0x0682('0x22')](function(_0x518efd){if(_0x518efd){return _0x518efd[_0x0682('0x6a')](_0x4d3fab['query'][_0x0682('0x6b')]);}})[_0x0682('0x22')](respondWithStatusCode(_0x4ae1de,null))[_0x0682('0x56')](handleError(_0x4ae1de,null));};exports['addAnswer']=function(_0x1e7a5b,_0x3ae16e,_0x3ce7c5){if(_0x1e7a5b[_0x0682('0x5a')]['id']){delete _0x1e7a5b[_0x0682('0x5a')]['id'];}return db[_0x0682('0x3d')][_0x0682('0x5f')]({'where':{'id':_0x1e7a5b[_0x0682('0x63')]['id']}})['then'](handleEntityNotFound(_0x3ae16e,null))[_0x0682('0x22')](function(_0x116a26){if(_0x116a26){_0x1e7a5b['body'][_0x0682('0x65')]=_0x116a26['id'];return db[_0x0682('0x6c')][_0x0682('0x59')](_0x1e7a5b[_0x0682('0x5a')]);}})[_0x0682('0x22')](respondWithResult(_0x3ae16e,null))[_0x0682('0x56')](handleError(_0x3ae16e,null));};exports[_0x0682('0x6d')]=function(_0x161a89,_0x5a8aed,_0x127578){var _0x832444={'raw':![],'where':{}};var _0x1e1cd0={};var _0x439741={'count':0x0,'rows':[]};return db['FaxAccount'][_0x0682('0x68')]({'where':{'id':_0x161a89[_0x0682('0x63')]['id']}})[_0x0682('0x22')](handleEntityNotFound(_0x5a8aed,null))[_0x0682('0x22')](function(_0x4abbf3){if(_0x4abbf3){_0x1e1cd0[_0x0682('0x42')]=_[_0x0682('0x44')](db[_0x0682('0x6c')]['rawAttributes']);_0x1e1cd0['query']=_[_0x0682('0x44')](_0x161a89[_0x0682('0x43')]);_0x1e1cd0[_0x0682('0x45')]=_[_0x0682('0x46')](_0x1e1cd0[_0x0682('0x42')],_0x1e1cd0[_0x0682('0x43')]);_0x832444[_0x0682('0x47')]=_[_0x0682('0x46')](_0x1e1cd0[_0x0682('0x42')],qs['fields'](_0x161a89[_0x0682('0x43')][_0x0682('0x48')]));_0x832444[_0x0682('0x47')]=_0x832444[_0x0682('0x47')]['length']?_0x832444[_0x0682('0x47')]:_0x1e1cd0[_0x0682('0x42')];if(!_0x161a89[_0x0682('0x43')]['hasOwnProperty'](_0x0682('0x4b'))){_0x832444['limit']=qs[_0x0682('0x31')](_0x161a89[_0x0682('0x43')]['limit']);_0x832444['offset']=qs[_0x0682('0x2e')](_0x161a89[_0x0682('0x43')][_0x0682('0x2e')]);}_0x832444[_0x0682('0x4c')]=qs['sort'](_0x161a89[_0x0682('0x43')][_0x0682('0x4d')]);_0x832444[_0x0682('0x4f')]=qs['filters'](_[_0x0682('0x4e')](_0x161a89[_0x0682('0x43')],_0x1e1cd0['filters']));_0x832444[_0x0682('0x4f')][_0x0682('0x65')]=_0x4abbf3['id'];if(_0x161a89[_0x0682('0x43')]['filter']){_0x832444[_0x0682('0x4f')]=_[_0x0682('0x50')](_0x832444[_0x0682('0x4f')],{'$or':_[_0x0682('0x3c')](_0x832444[_0x0682('0x47')],function(_0x5743e2){var _0x23ce79={};_0x23ce79[_0x5743e2]={'$like':'%'+_0x161a89[_0x0682('0x43')][_0x0682('0x69')]+'%'};return _0x23ce79;})});}_0x832444=_['merge']({},_0x832444,_0x161a89[_0x0682('0x52')]);return db[_0x0682('0x6c')]['count']({'where':_0x832444[_0x0682('0x4f')]})[_0x0682('0x22')](function(_0x2f5eec){_0x439741['count']=_0x2f5eec;if(_0x161a89[_0x0682('0x43')][_0x0682('0x58')]){_0x832444[_0x0682('0x53')]=[{'all':!![]}];}return db[_0x0682('0x6c')][_0x0682('0x54')](_0x832444);})[_0x0682('0x22')](function(_0x2d81f7){_0x439741[_0x0682('0x55')]=_0x2d81f7;return _0x439741;});}})[_0x0682('0x22')](respondWithFilteredResult(_0x5a8aed,_0x832444))[_0x0682('0x56')](handleError(_0x5a8aed,null));};exports[_0x0682('0x6e')]=function(_0x3fdb3f,_0x262b28,_0x537860){return db[_0x0682('0x3d')][_0x0682('0x5f')]({'where':{'id':_0x3fdb3f[_0x0682('0x63')]['id']}})[_0x0682('0x22')](handleEntityNotFound(_0x262b28,null))[_0x0682('0x22')](function(_0x831929){if(_0x831929){return _0x831929[_0x0682('0x6e')](_0x3fdb3f[_0x0682('0x43')][_0x0682('0x6b')]);}})[_0x0682('0x22')](respondWithStatusCode(_0x262b28,null))['catch'](handleError(_0x262b28,null));};exports[_0x0682('0x6f')]=function(_0x48e370,_0xe3d44c,_0x553a12){return db[_0x0682('0x70')]['find']({'where':{'id':_0x48e370[_0x0682('0x63')]['id']}})['then'](handleEntityNotFound(_0xe3d44c,null))['then'](function(_0x41ac2d){if(_0x41ac2d){return _0x41ac2d[_0x0682('0x6f')](_0x48e370[_0x0682('0x5a')]['ids'],_[_0x0682('0x71')](_0x48e370[_0x0682('0x5a')],['ids','id'])||{});}})[_0x0682('0x22')](respondWithResult(_0xe3d44c,null))['catch'](handleError(_0xe3d44c,null));};exports[_0x0682('0x72')]=function(_0x27f320,_0x10f7f5,_0xd64664){var _0x128d5c={'raw':![],'where':{}};var _0x5be100={};var _0x5393ae={'count':0x0,'rows':[]};return db[_0x0682('0x3d')]['findOne']({'where':{'id':_0x27f320[_0x0682('0x63')]['id']}})[_0x0682('0x22')](handleEntityNotFound(_0x10f7f5,null))[_0x0682('0x22')](function(_0x248e85){if(_0x248e85){_0x5be100[_0x0682('0x42')]=_[_0x0682('0x44')](db[_0x0682('0x70')][_0x0682('0x3e')]);_0x5be100[_0x0682('0x43')]=_[_0x0682('0x44')](_0x27f320['query']);_0x5be100['filters']=_[_0x0682('0x46')](_0x5be100['model'],_0x5be100['query']);_0x128d5c[_0x0682('0x47')]=_['intersection'](_0x5be100[_0x0682('0x42')],qs[_0x0682('0x48')](_0x27f320[_0x0682('0x43')][_0x0682('0x48')]));_0x128d5c['attributes']=_0x128d5c[_0x0682('0x47')][_0x0682('0x49')]?_0x128d5c['attributes']:_0x5be100[_0x0682('0x42')];if(!_0x27f320['query'][_0x0682('0x4a')](_0x0682('0x4b'))){_0x128d5c[_0x0682('0x31')]=qs['limit'](_0x27f320[_0x0682('0x43')][_0x0682('0x31')]);_0x128d5c[_0x0682('0x2e')]=qs['offset'](_0x27f320[_0x0682('0x43')][_0x0682('0x2e')]);}_0x128d5c[_0x0682('0x4c')]=qs[_0x0682('0x4d')](_0x27f320['query'][_0x0682('0x4d')]);_0x128d5c[_0x0682('0x4f')]=qs['filters'](_[_0x0682('0x4e')](_0x27f320[_0x0682('0x43')],_0x5be100[_0x0682('0x45')]));_0x128d5c[_0x0682('0x4f')]['FaxAccountId']=_0x248e85['id'];if(_0x27f320[_0x0682('0x43')][_0x0682('0x69')]){_0x128d5c[_0x0682('0x4f')]=_[_0x0682('0x50')](_0x128d5c[_0x0682('0x4f')],{'$or':_[_0x0682('0x3c')](_0x128d5c['attributes'],function(_0x31ed6c){var _0x277da6={};_0x277da6[_0x31ed6c]={'$like':'%'+_0x27f320[_0x0682('0x43')][_0x0682('0x69')]+'%'};return _0x277da6;})});}_0x128d5c=_[_0x0682('0x50')]({},_0x128d5c,_0x27f320[_0x0682('0x52')]);return db[_0x0682('0x70')][_0x0682('0x30')]({'where':_0x128d5c[_0x0682('0x4f')]})[_0x0682('0x22')](function(_0x15aaac){_0x5393ae[_0x0682('0x30')]=_0x15aaac;if(_0x27f320[_0x0682('0x43')][_0x0682('0x58')]){_0x128d5c[_0x0682('0x53')]=[{'model':db[_0x0682('0x73')],'as':_0x0682('0x74'),'required':![]},{'model':db[_0x0682('0x75')],'as':'Owner','attributes':['name',_0x0682('0x76'),_0x0682('0x77')],'required':![]},{'model':db[_0x0682('0x78')],'as':_0x0682('0x79'),'attributes':['id',_0x0682('0x38'),_0x0682('0x7a')],'where':_0x27f320[_0x0682('0x43')][_0x0682('0x7b')]?{'id':_0x27f320[_0x0682('0x43')][_0x0682('0x7b')]}:undefined,'required':_0x27f320[_0x0682('0x43')]['tag']?!![]:![]}];}return db[_0x0682('0x70')]['findAll'](_0x128d5c);})['then'](function(_0x371e52){_0x5393ae[_0x0682('0x55')]=_0x371e52;return _0x5393ae;});}})[_0x0682('0x22')](respondWithFilteredResult(_0x10f7f5,_0x128d5c))[_0x0682('0x56')](handleError(_0x10f7f5,null));};exports[_0x0682('0x7c')]=function(_0x19af64,_0x50c12b){var _0x4fc453=_0x19af64[_0x0682('0x63')]['id'];var _0x4f83ea=_0x19af64['body'];var _0x1888bf=0xc8;var _0x10cfa3=null;return db[_0x0682('0x7d')][_0x0682('0x7e')]({'isolationLevel':db[_0x0682('0x7d')][_0x0682('0x7f')][_0x0682('0x80')]['READ_COMMITTED']},function(_0x528af8){return db[_0x0682('0x3d')][_0x0682('0x68')]({'where':{'id':_0x4fc453},'transaction':_0x528af8})[_0x0682('0x22')](function(_0x1bc3e9){if(_0x1bc3e9){return db[_0x0682('0x81')][_0x0682('0x34')]({'where':{'FaxAccountId':_0x4fc453},'transaction':_0x528af8})[_0x0682('0x22')](function(){var _0x62f1ab=_[_0x0682('0x3c')](_0x4f83ea,function(_0x30d354){_0x30d354[_0x0682('0x65')]=_0x4fc453;return _0x30d354;});return db['FaxApplication'][_0x0682('0x82')](_0x62f1ab,{'transaction':_0x528af8});});}else{_0x1888bf=0x194;_0x10cfa3=[];}});})[_0x0682('0x22')](function(){if(_0x1888bf!==0x194){return db[_0x0682('0x81')]['findAndCountAll']({'where':{'FaxAccountId':_0x4fc453},'order':_0x0682('0x83')})['then'](function(_0xb7e0e1){_0x10cfa3=_0xb7e0e1;});}})[_0x0682('0x56')](function(_0x368e96){_0x1888bf=0x1f4;logger[_0x0682('0x26')](_0x368e96['stack']);if(_0x368e96[_0x0682('0x38')]){delete _0x368e96[_0x0682('0x38')];}_0x10cfa3=_0x368e96;})[_0x0682('0x84')](function(){if(_0x10cfa3===null){_0x50c12b[_0x0682('0x2a')](_0x1888bf);}else{if(_0x1888bf===0x1f4){_0x50c12b[_0x0682('0x2b')](_0x1888bf)[_0x0682('0x85')](_0x10cfa3);}else{_0x50c12b[_0x0682('0x2b')](_0x1888bf)[_0x0682('0x2d')](_0x10cfa3);}}});};exports[_0x0682('0x86')]=function(_0x4560c1,_0xe1f3da,_0xea5143){var _0x2e82ac={};var _0xd410dc={};var _0x45c24d;var _0x573796;return db[_0x0682('0x3d')][_0x0682('0x68')]({'where':{'id':_0x4560c1['params']['id']}})[_0x0682('0x22')](handleEntityNotFound(_0xe1f3da,null))['then'](function(_0x2a02a0){if(_0x2a02a0){_0x45c24d=_0x2a02a0;_0xd410dc[_0x0682('0x42')]=_['keys'](db[_0x0682('0x81')][_0x0682('0x3e')]);_0xd410dc[_0x0682('0x43')]=_[_0x0682('0x44')](_0x4560c1[_0x0682('0x43')]);_0xd410dc[_0x0682('0x45')]=_['intersection'](_0xd410dc['model'],_0xd410dc[_0x0682('0x43')]);_0x2e82ac['attributes']=_[_0x0682('0x46')](_0xd410dc['model'],qs['fields'](_0x4560c1['query'][_0x0682('0x48')]));_0x2e82ac[_0x0682('0x47')]=_0x2e82ac[_0x0682('0x47')]['length']?_0x2e82ac['attributes']:_0xd410dc[_0x0682('0x42')];_0x2e82ac['order']=qs['sort'](_0x4560c1['query'][_0x0682('0x4d')]);_0x2e82ac[_0x0682('0x4f')]=qs[_0x0682('0x45')](_[_0x0682('0x4e')](_0x4560c1[_0x0682('0x43')],_0xd410dc['filters']));if(_0x4560c1['query'][_0x0682('0x69')]){_0x2e82ac[_0x0682('0x4f')]=_['merge'](_0x2e82ac[_0x0682('0x4f')],{'$or':_[_0x0682('0x3c')](_0x2e82ac[_0x0682('0x47')],function(_0x12617a){var _0x208ba8={};_0x208ba8[_0x12617a]={'$like':'%'+_0x4560c1[_0x0682('0x43')][_0x0682('0x69')]+'%'};return _0x208ba8;})});}_0x2e82ac=_[_0x0682('0x50')]({},_0x2e82ac,_0x4560c1[_0x0682('0x52')]);return _0x45c24d['getApplications'](_0x2e82ac);}})[_0x0682('0x22')](function(_0x5b53e1){if(_0x5b53e1){_0x573796=_0x5b53e1['length'];if(!_0x4560c1[_0x0682('0x43')][_0x0682('0x4a')]('nolimit')){_0x2e82ac[_0x0682('0x31')]=qs[_0x0682('0x31')](_0x4560c1[_0x0682('0x43')]['limit']);_0x2e82ac[_0x0682('0x2e')]=qs[_0x0682('0x2e')](_0x4560c1[_0x0682('0x43')][_0x0682('0x2e')]);}return _0x45c24d[_0x0682('0x86')](_0x2e82ac);}})[_0x0682('0x22')](function(_0x37a965){if(_0x37a965){return _0x37a965?{'count':_0x573796,'rows':_0x37a965}:null;}})[_0x0682('0x22')](respondWithResult(_0xe1f3da,null))[_0x0682('0x56')](handleError(_0xe1f3da,null));};function Extension(_0x34b9cd,_0x30d933,_0x15db49,_0x185b68){this[_0x0682('0x87')]=_0x0682('0x88');this['exten']=_0x34b9cd[_0x0682('0x89')];this[_0x0682('0x8a')]=_0x185b68;this[_0x0682('0x40')]=_0x0682('0x8b');this[_0x0682('0x8c')]=_0x0682('0x8d');this[_0x0682('0x65')]=_0x34b9cd['id'];this[_0x0682('0x83')]=_0x30d933;this['appdata']=_0x15db49;}function createExtensionsReciveFax(_0x3a2fa5){var _0x41c51e=0x1;var _0x273fa5=[];_0x273fa5[_0x0682('0x8e')](new Extension(_0x3a2fa5,_0x41c51e,'',_0x0682('0x8f')));_0x41c51e+=0x1;_0x273fa5[_0x0682('0x8e')](new Extension(_0x3a2fa5,_0x41c51e,_0x0682('0x90'),'Set'));_0x41c51e+=0x1;for(var _0x619d3 in _0x3a2fa5){if(_0x3a2fa5[_0x0682('0x4a')](_0x619d3)&&(_0x619d3===_0x0682('0x91')||_0x619d3===_0x0682('0x89')||_0x619d3===_0x0682('0x92')||_0x619d3===_0x0682('0x93')||_0x619d3==='headerinfo'||_0x619d3===_0x0682('0x94')||_0x619d3===_0x0682('0x95')||_0x619d3==='modem'||_0x619d3==='t38timeout')){_0x273fa5['push'](new Extension(_0x3a2fa5,_0x41c51e,_0x0682('0x96')+_0x619d3+')='+_0x3a2fa5[_0x619d3],_0x0682('0x97')));_0x41c51e+=0x1;}}_0x273fa5[_0x0682('0x8e')](new Extension(_0x3a2fa5,_0x41c51e,'6',_0x0682('0x98')));_0x41c51e+=0x1;_0x273fa5['push'](new Extension(_0x3a2fa5,_0x41c51e,_0x0682('0x99'),_0x0682('0x9a')));_0x41c51e=0x0;return _0x273fa5;}exports['addAccountApplications']=function(_0x190782,_0x2a4a6b,_0x4c4d8d){var _0x1f4ccb;return db[_0x0682('0x7d')]['transaction'](function(_0x4c8ce3){return db['FaxAccount'][_0x0682('0x59')](_0x190782[_0x0682('0x5a')],{'transaction':_0x4c8ce3})[_0x0682('0x22')](function(_0xfc922e){_0x1f4ccb=_0xfc922e['get']({'plain':!![]});return db[_0x0682('0x9b')][_0x0682('0x82')](createExtensionsReciveFax(_0x1f4ccb),{'transaction':_0x4c8ce3});});})[_0x0682('0x22')](function(){return _0x1f4ccb;})[_0x0682('0x22')](respondWithResult(_0x2a4a6b,null))[_0x0682('0x56')](handleError(_0x2a4a6b,null));};exports[_0x0682('0x9c')]=function(_0x4883bf,_0x122891,_0x44102b){var _0x57fea8;return db[_0x0682('0x7d')]['transaction'](function(_0xaac13d){return db[_0x0682('0x3d')][_0x0682('0x62')](_0x4883bf[_0x0682('0x5a')],{'where':{'id':_0x4883bf[_0x0682('0x5a')]['id']},'transaction':_0xaac13d})[_0x0682('0x22')](function(_0x4c906b){return db['VoiceExtension'][_0x0682('0x34')]({'where':{'FaxAccountId':_0x4883bf['body']['id']},'transaction':_0xaac13d})[_0x0682('0x22')](function(_0x94f04b){return db[_0x0682('0x9b')]['bulkCreate'](createExtensionsReciveFax(_['omit'](_0x4883bf[_0x0682('0x5a')],[_0x0682('0x9d'),_0x0682('0x41'),_0x0682('0x9e'),_0x0682('0x9f'),'TrunkId',_0x0682('0xa0')])),{'transaction':_0xaac13d});});});})['then'](function(){return db[_0x0682('0x3d')][_0x0682('0xa1')](_0x4883bf[_0x0682('0x5a')]['id']);})['then'](respondWithResult(_0x122891,null))[_0x0682('0x56')](handleError(_0x122891,null));};exports[_0x0682('0xa2')]=function(_0x37be19,_0x38790b,_0x580619){var _0x11ef26={'raw':!![],'where':{}};var _0x28353c={};var _0x297cb4={'count':0x0,'rows':[]};return db[_0x0682('0x3d')][_0x0682('0x68')]({'where':{'id':_0x37be19['params']['id']}})[_0x0682('0x22')](handleEntityNotFound(_0x38790b,null))[_0x0682('0x22')](function(_0x264022){if(_0x264022){_0x28353c[_0x0682('0x42')]=_[_0x0682('0x44')](db[_0x0682('0xa3')][_0x0682('0x3e')]);_0x28353c[_0x0682('0x43')]=_[_0x0682('0x44')](_0x37be19[_0x0682('0x43')]);_0x28353c['filters']=_[_0x0682('0x46')](_0x28353c[_0x0682('0x42')],_0x28353c[_0x0682('0x43')]);_0x11ef26[_0x0682('0x47')]=_['intersection'](_0x28353c[_0x0682('0x42')],qs[_0x0682('0x48')](_0x37be19[_0x0682('0x43')][_0x0682('0x48')]));_0x11ef26[_0x0682('0x47')]=_0x11ef26[_0x0682('0x47')]['length']?_0x11ef26['attributes']:_0x28353c[_0x0682('0x42')];if(!_0x37be19['query']['hasOwnProperty'](_0x0682('0x4b'))){_0x11ef26[_0x0682('0x31')]=qs[_0x0682('0x31')](_0x37be19[_0x0682('0x43')][_0x0682('0x31')]);_0x11ef26['offset']=qs[_0x0682('0x2e')](_0x37be19[_0x0682('0x43')][_0x0682('0x2e')]);}_0x11ef26['order']=qs['sort'](_0x37be19[_0x0682('0x43')][_0x0682('0x4d')]);_0x11ef26[_0x0682('0x4f')]=qs[_0x0682('0x45')](_[_0x0682('0x4e')](_0x37be19[_0x0682('0x43')],_0x28353c[_0x0682('0x45')]));_0x11ef26[_0x0682('0x4f')][_0x0682('0x65')]=_0x264022['id'];if(_0x37be19['query']['filter']){_0x11ef26['where']=_[_0x0682('0x50')](_0x11ef26[_0x0682('0x4f')],{'$or':_[_0x0682('0x3c')](_0x11ef26[_0x0682('0x47')],function(_0x586514){var _0x446b45={};_0x446b45[_0x586514]={'$like':'%'+_0x37be19[_0x0682('0x43')][_0x0682('0x69')]+'%'};return _0x446b45;})});}if(_0x37be19['query'][_0x0682('0xa4')]){var _0x21e47a=_0x37be19['query']['$gte'][_0x0682('0xa5')](',');var _0x468c32={};_0x468c32[_0x21e47a[0x0]]={'$gte':moment(_0x21e47a[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x11ef26['where']=_['merge'](_0x11ef26[_0x0682('0x4f')],_0x468c32);}_0x11ef26=_[_0x0682('0x50')]({},_0x11ef26,_0x37be19['options']);return db[_0x0682('0xa3')][_0x0682('0x30')]({'where':_0x11ef26[_0x0682('0x4f')]})['then'](function(_0x542c22){_0x297cb4[_0x0682('0x30')]=_0x542c22;if(_0x37be19['query'][_0x0682('0x58')]){_0x11ef26['include']=[{'all':!![]}];}return db[_0x0682('0xa3')]['findAll'](_0x11ef26);})[_0x0682('0x22')](function(_0x4659ce){_0x297cb4[_0x0682('0x55')]=_0x4659ce;return _0x297cb4;});}})[_0x0682('0x22')](respondWithFilteredResult(_0x38790b,_0x11ef26))['catch'](handleError(_0x38790b,null));};exports[_0x0682('0x85')]=function(_0x58a89e,_0x86c0b8,_0x47bcab){var _0x3045fe,_0x2d889b={},_0x471d39;if(_0x58a89e[_0x0682('0x5a')]['to']){_0x471d39=_0x58a89e[_0x0682('0x5a')]['to'][0x0];}return db[_0x0682('0x3d')][_0x0682('0x5f')]({'where':{'id':_0x58a89e['params']['id']},'include':[{'model':db[_0x0682('0xa6')],'as':_0x0682('0xa7'),'include':[{'model':db[_0x0682('0x73')],'as':_0x0682('0xa8'),'where':{'fax':_0x471d39},'limit':0x1,'order':[[_0x0682('0x9f'),_0x0682('0xa9')]]}]}]})[_0x0682('0x22')](handleEntityNotFound(_0x86c0b8,null))[_0x0682('0x22')](function(_0x3f6d32){_0x3045fe=_0x3f6d32;if(_0x58a89e[_0x0682('0x5a')]['attachments']&&_0x58a89e['body']['attachments']['length']){for(var _0x30fa80=0x0;_0x30fa80<_0x58a89e[_0x0682('0x5a')][_0x0682('0xaa')][_0x0682('0x49')];_0x30fa80+=0x1){_0x58a89e['body'][_0x0682('0xaa')][_0x30fa80]={'filename':_0x58a89e[_0x0682('0x5a')][_0x0682('0xaa')][_0x30fa80][_0x0682('0x38')],'id':_0x58a89e[_0x0682('0x5a')][_0x0682('0xaa')][_0x30fa80]['id'],'path':path[_0x0682('0xab')](config['root'],_0x0682('0xac'),_0x58a89e[_0x0682('0x5a')][_0x0682('0xaa')][_0x30fa80]['basename'])};}}return respondWithRpcPromise(_0x0682('0xad'),'CheckAfterSend',{'FaxAccountId':_[_0x0682('0xae')](_0x58a89e['params']['id'])?undefined:_0x58a89e['params']['id'],'path':_[_0x0682('0xae')](_0x58a89e[_0x0682('0x5a')][_0x0682('0xaa')][0x0][_0x0682('0x7')])?undefined:_0x58a89e[_0x0682('0x5a')][_0x0682('0xaa')][0x0][_0x0682('0x7')],'fax':_[_0x0682('0xae')](_0x58a89e[_0x0682('0x5a')]['to'][0x0])?undefined:_0x58a89e[_0x0682('0x5a')]['to'][0x0]},client9002);})[_0x0682('0x22')](function(){if(_0x3045fe){if(_[_0x0682('0xae')](_0x58a89e[_0x0682('0x5a')][_0x0682('0xaf')])){_0x58a89e[_0x0682('0x5a')][_0x0682('0xaf')]=util[_0x0682('0xb0')](_0x0682('0xb1'),_0x3045fe['name'],_0x3045fe[_0x0682('0xb2')]);}if(_0x3045fe[_0x0682('0xa7')]){if(_0x3045fe[_0x0682('0xa7')]['Contacts'][_0x0682('0x49')]){return _0x3045fe[_0x0682('0xa7')][_0x0682('0xa8')][0x0];}else{return db['CmContact'][_0x0682('0x59')](_['defaults'](_0x58a89e[_0x0682('0x5a')],{'firstName':_0x58a89e['body']['to'][0x0],'phone':_0x58a89e['body']['to'][0x0],'fax':_0x58a89e['body']['to'][0x0],'ListId':_0x3045fe[_0x0682('0xa0')]}));}}else{throw new Error(_0x0682('0xb3'));}}else{throw new Error(_0x0682('0xb4'));}})['then'](function(_0x38f1cc){if(_0x38f1cc){return db[_0x0682('0x70')][_0x0682('0x5f')]({'where':{'ContactId':_0x38f1cc['id'],'closed':![],'FaxAccountId':_0x3045fe['id']}})['then'](function(_0x1a9ff8){if(_0x1a9ff8){return[_0x1a9ff8,![]];}return db['FaxInteraction']['create']({'UserId':_0x58a89e['user']['id'],'ContactId':_0x38f1cc['id'],'FaxAccountId':_0x3045fe['id'],'fax':_0x58a89e['body']['to'][0x0],'firstMsgDirection':_0x0682('0xb5'),'Messages':[_[_0x0682('0x50')](_0x58a89e[_0x0682('0x5a')],{'read':![],'body':_0x58a89e[_0x0682('0x5a')][_0x0682('0xaa')][0x0][_0x0682('0xb6')],'FaxAccountId':_0x3045fe['id'],'UserId':_0x58a89e[_0x0682('0x5b')]['id'],'ContactId':_0x38f1cc['id'],'AttachmentId':_0x58a89e[_0x0682('0x5a')]['attachments'][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})['then'](function(_0x3dd13e){return[_0x3dd13e,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x4df90b,_0x5427bf){if(_0x5427bf){return _0x4df90b;}return db['FaxMessage'][_0x0682('0x59')]({'direction':_0x0682('0xb5'),'read':![],'body':_0x58a89e[_0x0682('0x5a')]['attachments'][0x0][_0x0682('0xb6')],'FaxAccountId':_0x3045fe['id'],'FaxInteractionId':_0x4df90b['id'],'UserId':_0x58a89e[_0x0682('0x5b')]['id'],'ContactId':_0x4df90b[_0x0682('0xb7')],'AttachmentId':_0x58a89e[_0x0682('0x5a')][_0x0682('0xaa')][0x0]['id']})[_0x0682('0x22')](function(_0x43420a){_0x4df90b[_0x0682('0xb8')]['Messages']=[];_0x4df90b[_0x0682('0xb8')][_0x0682('0xb9')][_0x0682('0x8e')](_0x43420a['dataValues']);return _0x4df90b;});})[_0x0682('0x22')](function(_0x50647b){respondWithRpcPromise(_0x0682('0xba'),_0x0682('0xba'),{'FaxAccountId':_[_0x0682('0xae')](_0x58a89e[_0x0682('0x63')]['id'])?undefined:_0x58a89e[_0x0682('0x63')]['id'],'path':_['isNil'](_0x58a89e['body']['attachments'][0x0][_0x0682('0x7')])?undefined:_0x58a89e[_0x0682('0x5a')]['attachments'][0x0][_0x0682('0x7')],'fax':_[_0x0682('0xae')](_0x58a89e[_0x0682('0x5a')]['to'][0x0])?undefined:_0x58a89e[_0x0682('0x5a')]['to'][0x0],'AttachmentId':_0x58a89e[_0x0682('0x5a')][_0x0682('0xaa')][0x0]['id']},client9002)[_0x0682('0x22')](function(_0x5e72b7){logger['info'](_0x0682('0xbb'),_0x5e72b7);})[_0x0682('0x56')](function(_0x21b62e){logger[_0x0682('0x28')]('SendFaxRpc,\x20%s',_0x21b62e);});return _0x50647b;})[_0x0682('0x22')](respondWithResult(_0x86c0b8,null))[_0x0682('0x56')](handleError(_0x86c0b8,null));};exports[_0x0682('0xbc')]=function(_0x4b8b8f,_0x83a82b,_0x2044fc){return db['FaxAccount'][_0x0682('0x5f')]({'where':{'id':_0x4b8b8f[_0x0682('0x63')]['id']}})[_0x0682('0x22')](handleEntityNotFound(_0x83a82b,null))[_0x0682('0x22')](function(_0x374981){if(_0x374981){return _0x374981[_0x0682('0xbc')](_0x4b8b8f[_0x0682('0x5a')]['ids'],_[_0x0682('0x71')](_0x4b8b8f['body'],[_0x0682('0x6b'),'id'])||{})[_0x0682('0xbd')](function(_0x58eeaf){for(var _0x3d9983=0x0;_0x3d9983<_0x4b8b8f[_0x0682('0x5a')][_0x0682('0x6b')][_0x0682('0x49')];_0x3d9983+=0x1){socket['emit'](_0x0682('0xbe'),{'UserId':Number(_0x4b8b8f[_0x0682('0x5a')][_0x0682('0x6b')][_0x3d9983]),'FaxAccountId':Number(_0x4b8b8f[_0x0682('0x63')]['id'])});}return _0x58eeaf;});}})[_0x0682('0x22')](respondWithResult(_0x83a82b,null))[_0x0682('0x56')](handleError(_0x83a82b,null));};exports['removeAgents']=function(_0x45396d,_0x45bd7c,_0x5c33f3){return db['FaxAccount'][_0x0682('0x5f')]({'where':{'id':_0x45396d['params']['id']}})[_0x0682('0x22')](handleEntityNotFound(_0x45bd7c,null))['then'](function(_0x871c98){if(_0x871c98){return _0x871c98['removeAgents'](_0x45396d['query']['ids'])[_0x0682('0x22')](function(){if(_[_0x0682('0xbf')](_0x45396d[_0x0682('0x43')][_0x0682('0x6b')])){for(var _0x8eaaad=0x0;_0x8eaaad<_0x45396d[_0x0682('0x43')][_0x0682('0x6b')][_0x0682('0x49')];_0x8eaaad+=0x1){socket[_0x0682('0xc0')](_0x0682('0xc1'),{'UserId':Number(_0x45396d[_0x0682('0x43')][_0x0682('0x6b')][_0x8eaaad]),'FaxAccountId':Number(_0x45396d['params']['id'])});}}else{socket['emit'](_0x0682('0xc1'),{'UserId':Number(_0x45396d['query'][_0x0682('0x6b')]),'FaxAccountId':Number(_0x45396d[_0x0682('0x63')]['id'])});}});}})[_0x0682('0x22')](respondWithStatusCode(_0x45bd7c,null))[_0x0682('0x56')](handleError(_0x45bd7c,null));};exports[_0x0682('0xc2')]=function(_0x4d9fc1,_0x108bd3,_0x39395c){var _0x4bd1df={};var _0x3c67a7={};var _0x488b09;var _0xda395e;return db['FaxAccount'][_0x0682('0x68')]({'where':{'id':_0x4d9fc1['params']['id']}})[_0x0682('0x22')](handleEntityNotFound(_0x108bd3,null))[_0x0682('0x22')](function(_0x575e0b){if(_0x575e0b){_0x488b09=_0x575e0b;_0x3c67a7['model']=_[_0x0682('0x44')](db['User'][_0x0682('0x3e')]);_0x3c67a7[_0x0682('0x43')]=_['keys'](_0x4d9fc1[_0x0682('0x43')]);_0x3c67a7[_0x0682('0x45')]=_[_0x0682('0x46')](_0x3c67a7[_0x0682('0x42')],_0x3c67a7[_0x0682('0x43')]);_0x4bd1df[_0x0682('0x47')]=_['intersection'](_0x3c67a7['model'],qs[_0x0682('0x48')](_0x4d9fc1['query'][_0x0682('0x48')]));_0x4bd1df[_0x0682('0x47')]=_0x4bd1df['attributes'][_0x0682('0x49')]?_0x4bd1df[_0x0682('0x47')]:_0x3c67a7[_0x0682('0x42')];_0x4bd1df['order']=qs['sort'](_0x4d9fc1[_0x0682('0x43')]['sort']);_0x4bd1df[_0x0682('0x4f')]=qs['filters'](_['pick'](_0x4d9fc1[_0x0682('0x43')],_0x3c67a7[_0x0682('0x45')]));if(_0x4d9fc1[_0x0682('0x43')][_0x0682('0x69')]){_0x4bd1df['where']=_[_0x0682('0x50')](_0x4bd1df[_0x0682('0x4f')],{'$or':_[_0x0682('0x3c')](_0x4bd1df[_0x0682('0x47')],function(_0x46ea94){var _0xfaca71={};_0xfaca71[_0x46ea94]={'$like':'%'+_0x4d9fc1[_0x0682('0x43')]['filter']+'%'};return _0xfaca71;})});}_0x4bd1df=_[_0x0682('0x50')]({},_0x4bd1df,_0x4d9fc1[_0x0682('0x52')]);return _0x488b09[_0x0682('0xc2')](_0x4bd1df);}})[_0x0682('0x22')](function(_0x5dc47c){if(_0x5dc47c){_0xda395e=_0x5dc47c[_0x0682('0x49')];if(!_0x4d9fc1[_0x0682('0x43')][_0x0682('0x4a')](_0x0682('0x4b'))){_0x4bd1df['limit']=qs['limit'](_0x4d9fc1[_0x0682('0x43')][_0x0682('0x31')]);_0x4bd1df[_0x0682('0x2e')]=qs['offset'](_0x4d9fc1['query'][_0x0682('0x2e')]);}return _0x488b09[_0x0682('0xc2')](_0x4bd1df);}})['then'](function(_0x3ee08a){if(_0x3ee08a){return _0x3ee08a?{'count':_0xda395e,'rows':_0x3ee08a}:null;}})[_0x0682('0x22')](respondWithResult(_0x108bd3,null))['catch'](handleError(_0x108bd3,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 962f288..c528778 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 _0x5b3d=['exports','events','../../mysqldb','FaxAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x3b14c1,_0x562a02){var _0x536381=function(_0x597b65){while(--_0x597b65){_0x3b14c1['push'](_0x3b14c1['shift']());}};_0x536381(++_0x562a02);}(_0x5b3d,0xb5));var _0xd5b3=function(_0x578062,_0x2858e9){_0x578062=_0x578062-0x0;var _0x2ba7f5=_0x5b3d[_0x578062];return _0x2ba7f5;};'use strict';var EventEmitter=require(_0xd5b3('0x0'));var FaxAccount=require(_0xd5b3('0x1'))['db'][_0xd5b3('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xd5b3('0x3')](0x0);var events={'afterCreate':_0xd5b3('0x4'),'afterUpdate':'update','afterDestroy':_0xd5b3('0x5')};function emitEvent(_0xdb50be){return function(_0xabe01f,_0x4564b1,_0x11f7ef){FaxAccountEvents[_0xd5b3('0x6')](_0xdb50be+':'+_0xabe01f['id'],_0xabe01f);FaxAccountEvents[_0xd5b3('0x6')](_0xdb50be,_0xabe01f);_0x11f7ef(null);};}for(var e in events){if(events[_0xd5b3('0x7')](e)){var event=events[e];FaxAccount[_0xd5b3('0x8')](e,emitEvent(event));}}module[_0xd5b3('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0xe0ea=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners'];(function(_0x18eccf,_0x32581c){var _0x32e862=function(_0x2e7731){while(--_0x2e7731){_0x18eccf['push'](_0x18eccf['shift']());}};_0x32e862(++_0x32581c);}(_0xe0ea,0xb9));var _0xae0e=function(_0x2ce6e9,_0x5524de){_0x2ce6e9=_0x2ce6e9-0x0;var _0x902c93=_0xe0ea[_0x2ce6e9];return _0x902c93;};'use strict';var EventEmitter=require(_0xae0e('0x0'));var FaxAccount=require(_0xae0e('0x1'))['db'][_0xae0e('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xae0e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xae0e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x23bc66){return function(_0x2ad983,_0x3ec29c,_0x21fe9a){FaxAccountEvents[_0xae0e('0x5')](_0x23bc66+':'+_0x2ad983['id'],_0x2ad983);FaxAccountEvents[_0xae0e('0x5')](_0x23bc66,_0x2ad983);_0x21fe9a(null);};}for(var e in events){if(events[_0xae0e('0x6')](e)){var event=events[e];FaxAccount[_0xae0e('0x7')](e,emitEvent(event));}}module[_0xae0e('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 59c1f35..c4b984a 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 _0x3123=['./faxAccount.attributes','exports','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x16db8b,_0xca7d28){var _0x5ba017=function(_0x35b933){while(--_0x35b933){_0x16db8b['push'](_0x16db8b['shift']());}};_0x5ba017(++_0xca7d28);}(_0x3123,0x146));var _0x3312=function(_0x2daf2d,_0x18182b){_0x2daf2d=_0x2daf2d-0x0;var _0x4bfd04=_0x3123[_0x2daf2d];return _0x4bfd04;};'use strict';var _=require(_0x3312('0x0'));var util=require('util');var logger=require(_0x3312('0x1'))(_0x3312('0x2'));var moment=require(_0x3312('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3312('0x4'));var rimraf=require(_0x3312('0x5'));var config=require(_0x3312('0x6'));var attributes=require(_0x3312('0x7'));module[_0x3312('0x8')]=function(_0x189698,_0x1f19a7){return _0x189698['define']('FaxAccount',attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a08=['exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x0a08,0x9c));var _0x80a0=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x0a08[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x80a0('0x0'));var util=require(_0x80a0('0x1'));var logger=require(_0x80a0('0x2'))(_0x80a0('0x3'));var moment=require(_0x80a0('0x4'));var BPromise=require(_0x80a0('0x5'));var rp=require(_0x80a0('0x6'));var fs=require('fs');var path=require(_0x80a0('0x7'));var rimraf=require('rimraf');var config=require(_0x80a0('0x8'));var attributes=require('./faxAccount.attributes');module[_0x80a0('0x9')]=function(_0x273b73,_0x518223){return _0x273b73[_0x80a0('0xa')]('FaxAccount',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 dce13a7..65f6ddf 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 _0xefa3=['create','contact','FaxInteraction','find','Contact\x20not\x20found','spread','autoclose','close','unmanaged','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','limit','include','map','model','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','keys','createdAt','updatedAt','difference','CompanyId','ListId','isNil','from','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','FaxApplication','List','get','list','applications','orderBy','asc','Applications','length'];(function(_0x4f9923,_0x25197c){var _0x2e2597=function(_0x4a6cc1){while(--_0x4a6cc1){_0x4f9923['push'](_0x4f9923['shift']());}};_0x2e2597(++_0x25197c);}(_0xefa3,0x70));var _0x3efa=function(_0x4c9380,_0x2fefc0){_0x4c9380=_0x4c9380-0x0;var _0x49a523=_0xefa3[_0x4c9380];return _0x49a523;};'use strict';var _=require(_0x3efa('0x0'));var util=require(_0x3efa('0x1'));var moment=require(_0x3efa('0x2'));var BPromise=require(_0x3efa('0x3'));var rs=require(_0x3efa('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3efa('0x5'))['db'];var utils=require(_0x3efa('0x6'));var logger=require(_0x3efa('0x7'))(_0x3efa('0x8'));var config=require(_0x3efa('0x9'));var jayson=require(_0x3efa('0xa'));var client=jayson[_0x3efa('0xb')][_0x3efa('0xc')]({'port':0x232c});config['redis']=_[_0x3efa('0xd')](config[_0x3efa('0xe')],{'host':_0x3efa('0xf'),'port':0x18eb});var socket=require(_0x3efa('0x10'))(new Redis(config[_0x3efa('0xe')]));require('./faxAccount.socket')[_0x3efa('0x11')](socket);function respondWithRpcPromise(_0x584b43,_0x26ae59,_0x1f8007){return new BPromise(function(_0x17f226,_0x28847b){return client[_0x3efa('0x12')](_0x584b43,_0x1f8007)[_0x3efa('0x13')](function(_0xcfe7ff){logger[_0x3efa('0x14')](_0x3efa('0x15'),_0x26ae59,_0x3efa('0x16'));logger['debug'](_0x3efa('0x17'),_0x26ae59,_0x3efa('0x16'),JSON[_0x3efa('0x18')](_0xcfe7ff));if(_0xcfe7ff[_0x3efa('0x19')]){if(_0xcfe7ff[_0x3efa('0x19')]['code']===0x1f4){logger[_0x3efa('0x19')](_0x3efa('0x15'),_0x26ae59,_0xcfe7ff[_0x3efa('0x19')][_0x3efa('0x1a')]);return _0x28847b(_0xcfe7ff['error'][_0x3efa('0x1a')]);}logger['error'](_0x3efa('0x15'),_0x26ae59,_0xcfe7ff['error'][_0x3efa('0x1a')]);return _0x17f226(_0xcfe7ff[_0x3efa('0x19')][_0x3efa('0x1a')]);}else{logger[_0x3efa('0x14')]('FaxAccount,\x20%s,\x20%s',_0x26ae59,_0x3efa('0x16'));_0x17f226(_0xcfe7ff['result'][_0x3efa('0x1a')]);}})[_0x3efa('0x1b')](function(_0x358d7f){logger[_0x3efa('0x19')](_0x3efa('0x15'),_0x26ae59,_0x358d7f);_0x28847b(_0x358d7f);});});}exports[_0x3efa('0x1c')]=function(_0x2ab65f){var _0x2a4906=this;return new Promise(function(_0x3acb32,_0x42a450){return db[_0x3efa('0x1d')][_0x3efa('0x1e')]({'raw':_0x2ab65f[_0x3efa('0x1f')]?_0x2ab65f[_0x3efa('0x1f')][_0x3efa('0x20')]===undefined?!![]:![]:!![],'where':_0x2ab65f[_0x3efa('0x1f')]?_0x2ab65f[_0x3efa('0x1f')]['where']||null:null,'attributes':_0x2ab65f[_0x3efa('0x1f')]?_0x2ab65f[_0x3efa('0x1f')][_0x3efa('0x21')]||null:null,'limit':_0x2ab65f[_0x3efa('0x1f')]?_0x2ab65f[_0x3efa('0x1f')][_0x3efa('0x22')]||null:null,'include':_0x2ab65f[_0x3efa('0x1f')]?_0x2ab65f[_0x3efa('0x1f')][_0x3efa('0x23')]?_[_0x3efa('0x24')](_0x2ab65f['options'][_0x3efa('0x23')],function(_0x6bc04a){return{'model':db[_0x6bc04a[_0x3efa('0x25')]],'as':_0x6bc04a['as'],'attributes':_0x6bc04a[_0x3efa('0x21')],'include':_0x6bc04a['include']?_['map'](_0x6bc04a['include'],function(_0xcb57e0){return{'model':db[_0xcb57e0[_0x3efa('0x25')]],'as':_0xcb57e0['as'],'attributes':_0xcb57e0[_0x3efa('0x21')],'include':_0xcb57e0[_0x3efa('0x23')]?_[_0x3efa('0x24')](_0xcb57e0[_0x3efa('0x23')],function(_0x56f7e4){return{'model':db[_0x56f7e4['model']],'as':_0x56f7e4['as'],'attributes':_0x56f7e4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2dc119){logger['info']('GetFaxAccount',_0x2ab65f);logger['debug'](_0x3efa('0x1c'),_0x2ab65f,JSON[_0x3efa('0x18')](_0x2dc119));_0x3acb32(_0x2dc119);})['catch'](function(_0x334fb2){logger[_0x3efa('0x19')](_0x3efa('0x1c'),_0x334fb2[_0x3efa('0x1a')],_0x2ab65f);_0x42a450(_0x2a4906['error'](0x1f4,_0x334fb2[_0x3efa('0x1a')]));});});};exports[_0x3efa('0x26')]=function(_0x35c358,_0x4fcf3f,_0x1b45d4){var _0x4c9f97=this;return new Promise(function(_0x4ec86d,_0x39e014){var _0x5403b3={'body':_0x35c358[_0x3efa('0x27')],'channel':_0x3efa('0x28')};var _0x16911b=[];var _0x1d6387=[];var _0xb4f893={};return db[_0x3efa('0x29')][_0x3efa('0x2a')]()[_0x3efa('0x13')](function(_0x3dccf8){if(!_0x3dccf8){throw new db[(_0x3efa('0x2b'))][(_0x3efa('0x2c'))](_0x3efa('0x2d'));}_0x16911b=_['difference'](_[_0x3efa('0x2e')](_0x3dccf8),[_0x3efa('0x2f'),_0x3efa('0x30')]);_0x1d6387=_[_0x3efa('0x31')](_[_0x3efa('0x2e')](_0x3dccf8),[_0x3efa('0x2f'),'updatedAt',_0x3efa('0x32'),_0x3efa('0x33')]);if(_0x35c358[_0x3efa('0x27')]['id']){delete _0x35c358[_0x3efa('0x27')]['id'];}if(_[_0x3efa('0x34')](_0x35c358['body'][_0x3efa('0x35')])){throw new db['Sequelize'][(_0x3efa('0x2c'))]('from\x20is\x20mandatory');}if(_[_0x3efa('0x34')](_0x35c358['body'][_0x3efa('0x27')])||_0x35c358['body'][_0x3efa('0x27')]===''){throw new db['Sequelize'][(_0x3efa('0x2c'))](_0x3efa('0x36'));}if(_[_0x3efa('0x34')](_0x35c358[_0x3efa('0x27')][_0x3efa('0x37')])){throw new db[(_0x3efa('0x2b'))][(_0x3efa('0x2c'))](_0x3efa('0x38')+_0x1d6387);}if(!_['includes'](_0x1d6387,_0x35c358[_0x3efa('0x27')]['mapKey'])){throw new db['Sequelize'][(_0x3efa('0x2c'))](_0x3efa('0x39')+_0x1d6387);}_0xb4f893[_0x35c358[_0x3efa('0x27')][_0x3efa('0x37')]]=_0x35c358[_0x3efa('0x27')][_0x3efa('0x35')];})[_0x3efa('0x13')](function(){return db[_0x3efa('0x1d')]['find']({'where':{'id':_0x35c358[_0x3efa('0x3a')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x3efa('0x29')],'as':'Contacts','where':_0xb4f893,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x3efa('0x3b')],'as':'Applications'}]});})[_0x3efa('0x13')](function(_0x40fe1a){if(_0x40fe1a&&_0x40fe1a[_0x3efa('0x3c')]){var _0x363519=_0x40fe1a[_0x3efa('0x3d')]({'plain':!![]});_0x5403b3[_0x3efa('0x3a')]=_0x363519;_0x5403b3['applications']=_0x363519['Applications'];_0x5403b3[_0x3efa('0x3e')]=_0x363519[_0x3efa('0x3c')];_0x5403b3[_0x3efa('0x3f')]=_[_0x3efa('0x40')](_0x5403b3['applications'],['priority'],[_0x3efa('0x41')]);if(_0x5403b3['account']['Applications']){delete _0x5403b3['account'][_0x3efa('0x42')];}if(_0x5403b3[_0x3efa('0x3a')][_0x3efa('0x3c')]&&_0x5403b3['account'][_0x3efa('0x3c')]['Contacts'][_0x3efa('0x43')]){return _0x5403b3[_0x3efa('0x3a')][_0x3efa('0x3c')]['Contacts'][0x0];}var _0x2fd65c=_[_0x3efa('0xd')](_0x35c358[_0x3efa('0x27')],{'firstName':_0x35c358['body']['from'],'ListId':_0x363519[_0x3efa('0x33')]});_0x2fd65c[_0x35c358['body'][_0x3efa('0x37')]]=_0x35c358[_0x3efa('0x27')][_0x3efa('0x35')];return db[_0x3efa('0x29')][_0x3efa('0x44')](_0x2fd65c,{'fields':_0x16911b,'raw':!![]});}})[_0x3efa('0x13')](function(_0x18e452){_0x5403b3[_0x3efa('0x45')]=_0x18e452;if(_0x18e452){var _0x4a6136={'ContactId':_0x18e452['id'],'FaxAccountId':_0x35c358[_0x3efa('0x3a')]['id'],'fax':_0x18e452[_0x3efa('0x28')]};return db[_0x3efa('0x46')][_0x3efa('0x47')]({'where':{'ContactId':_0x18e452['id'],'closed':![],'FaxAccountId':_0x35c358['account']['id']}})[_0x3efa('0x13')](function(_0x477edc){if(_0x477edc){return[_0x477edc,![]];}return db[_0x3efa('0x46')]['create'](_0x4a6136)['then'](function(_0x423351){return[_0x423351,!![]];});});}else{throw new Error(_0x3efa('0x48'));}})[_0x3efa('0x49')](function(_0x7b14ea,_0x3c135d){var _0x3f9714=_0x7b14ea[_0x3efa('0x3d')]({'plain':!![]});if(_0x3c135d){if(_0x5403b3[_0x3efa('0x3a')][_0x3efa('0x4a')]){_0x5403b3[_0x3efa('0x3f')]['push']({'id':0x0,'priority':_0x5403b3['applications']['length']+0x1,'app':_0x3efa('0x4b'),'appdata':_0x3efa('0x4c'),'interval':'*,*,*,*'});}_0x3f9714[_0x3efa('0x4d')]=!![];}else{_0x3f9714[_0x3efa('0x4d')]=![];}_0x5403b3[_0x3efa('0x4e')]=_0x3f9714;return db[_0x3efa('0x4f')][_0x3efa('0x44')]({'body':_0x35c358[_0x3efa('0x27')][_0x3efa('0x27')],'FaxAccountId':_0x35c358[_0x3efa('0x3a')]['id'],'FaxInteractionId':_0x7b14ea['id'],'direction':'in','ContactId':_0x7b14ea[_0x3efa('0x50')],'AttachmentId':_0x35c358['body'][_0x3efa('0x51')]});})[_0x3efa('0x13')](function(_0x545680){_0x5403b3[_0x3efa('0x1a')]=_0x545680;if(_0x5403b3[_0x3efa('0x4e')][_0x3efa('0x52')]){return db[_0x3efa('0x53')][_0x3efa('0x47')]({'attributes':['id',_0x3efa('0x54')],'where':{'id':_0x5403b3['interaction'][_0x3efa('0x52')]}})[_0x3efa('0x13')](function(_0x1d3054){if(_0x1d3054){_0x5403b3[_0x3efa('0x3f')][_0x3efa('0x55')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1d3054['name']+','+(_0x5403b3[_0x3efa('0x3a')][_0x3efa('0x56')]||0xa),'interval':_0x3efa('0x57')});}return respondWithRpcPromise(_0x3efa('0x58'),_0x3efa('0x59'),_0x5403b3);});}return respondWithRpcPromise(_0x3efa('0x58'),'startRouting',_0x5403b3);})[_0x3efa('0x13')](function(_0x4ee3f5){_0x4ec86d(_0x4ee3f5);})['catch'](function(_0xd09006){_0x39e014(_0x4c9f97['error'](0x1f4,_0xd09006[_0x3efa('0x1a')]));});});}; \ No newline at end of file +var _0x3b67=['agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','GetFaxAccount','FaxAccount','options','where','attributes','model','include','map','stringify','NotifyFaxAccount','fax','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','keys','CompanyId','ListId','body','from','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','DESC','applications','list','orderBy','priority','asc','Applications','length','contact','FaxInteraction','create','spread','get','push','close','*,*,*,*','created','ContactId','AttachmentId','UserId','User','name','interaction','unshift'];(function(_0x2c5987,_0x101621){var _0x55773d=function(_0x1ba37c){while(--_0x1ba37c){_0x2c5987['push'](_0x2c5987['shift']());}};_0x55773d(++_0x101621);}(_0x3b67,0x16c));var _0x73b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3b67[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x73b6('0x0'));var util=require(_0x73b6('0x1'));var moment=require(_0x73b6('0x2'));var BPromise=require(_0x73b6('0x3'));var rs=require(_0x73b6('0x4'));var fs=require('fs');var Redis=require(_0x73b6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x73b6('0x6'));var logger=require(_0x73b6('0x7'))(_0x73b6('0x8'));var config=require(_0x73b6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x73b6('0xa')][_0x73b6('0xb')]({'port':0x232c});config[_0x73b6('0xc')]=_[_0x73b6('0xd')](config[_0x73b6('0xc')],{'host':_0x73b6('0xe'),'port':0x18eb});var socket=require(_0x73b6('0xf'))(new Redis(config[_0x73b6('0xc')]));require(_0x73b6('0x10'))[_0x73b6('0x11')](socket);function respondWithRpcPromise(_0x260d3f,_0x47c749,_0x2768af){return new BPromise(function(_0x9a49cf,_0x22173a){return client[_0x73b6('0x12')](_0x260d3f,_0x2768af)[_0x73b6('0x13')](function(_0x275f1f){logger[_0x73b6('0x14')](_0x73b6('0x15'),_0x47c749,'request\x20sent');logger[_0x73b6('0x16')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x47c749,_0x73b6('0x17'),JSON['stringify'](_0x275f1f));if(_0x275f1f[_0x73b6('0x18')]){if(_0x275f1f[_0x73b6('0x18')][_0x73b6('0x19')]===0x1f4){logger[_0x73b6('0x18')](_0x73b6('0x15'),_0x47c749,_0x275f1f[_0x73b6('0x18')][_0x73b6('0x1a')]);return _0x22173a(_0x275f1f['error'][_0x73b6('0x1a')]);}logger[_0x73b6('0x18')](_0x73b6('0x15'),_0x47c749,_0x275f1f[_0x73b6('0x18')][_0x73b6('0x1a')]);return _0x9a49cf(_0x275f1f[_0x73b6('0x18')]['message']);}else{logger['info'](_0x73b6('0x15'),_0x47c749,'request\x20sent');_0x9a49cf(_0x275f1f[_0x73b6('0x1b')]['message']);}})[_0x73b6('0x1c')](function(_0x2e28af){logger[_0x73b6('0x18')](_0x73b6('0x15'),_0x47c749,_0x2e28af);_0x22173a(_0x2e28af);});});}exports[_0x73b6('0x1d')]=function(_0x5f35e3){var _0x3c6ff1=this;return new Promise(function(_0x48343a,_0xec212f){return db[_0x73b6('0x1e')]['findAll']({'raw':_0x5f35e3['options']?_0x5f35e3[_0x73b6('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x5f35e3[_0x73b6('0x1f')]?_0x5f35e3['options'][_0x73b6('0x20')]||null:null,'attributes':_0x5f35e3[_0x73b6('0x1f')]?_0x5f35e3[_0x73b6('0x1f')][_0x73b6('0x21')]||null:null,'limit':_0x5f35e3['options']?_0x5f35e3[_0x73b6('0x1f')]['limit']||null:null,'include':_0x5f35e3[_0x73b6('0x1f')]?_0x5f35e3[_0x73b6('0x1f')]['include']?_['map'](_0x5f35e3[_0x73b6('0x1f')]['include'],function(_0x49809b){return{'model':db[_0x49809b[_0x73b6('0x22')]],'as':_0x49809b['as'],'attributes':_0x49809b[_0x73b6('0x21')],'include':_0x49809b[_0x73b6('0x23')]?_['map'](_0x49809b[_0x73b6('0x23')],function(_0x10f5c5){return{'model':db[_0x10f5c5['model']],'as':_0x10f5c5['as'],'attributes':_0x10f5c5[_0x73b6('0x21')],'include':_0x10f5c5[_0x73b6('0x23')]?_[_0x73b6('0x24')](_0x10f5c5[_0x73b6('0x23')],function(_0x371da3){return{'model':db[_0x371da3[_0x73b6('0x22')]],'as':_0x371da3['as'],'attributes':_0x371da3[_0x73b6('0x21')]};}):[]};}):[]};}):[]:[]})[_0x73b6('0x13')](function(_0x4935fa){logger['info'](_0x73b6('0x1d'),_0x5f35e3);logger[_0x73b6('0x16')](_0x73b6('0x1d'),_0x5f35e3,JSON[_0x73b6('0x25')](_0x4935fa));_0x48343a(_0x4935fa);})[_0x73b6('0x1c')](function(_0xe1aa0b){logger['error']('GetFaxAccount',_0xe1aa0b[_0x73b6('0x1a')],_0x5f35e3);_0xec212f(_0x3c6ff1[_0x73b6('0x18')](0x1f4,_0xe1aa0b[_0x73b6('0x1a')]));});});};exports[_0x73b6('0x26')]=function(_0x51ced8,_0x3d555a,_0x22b506){var _0xce314a=this;return new Promise(function(_0x279869,_0x1e23f2){var _0x2dafad={'body':_0x51ced8['body'],'channel':_0x73b6('0x27')};var _0x116baa=[];var _0x29ee50=[];var _0x2381d8={};return db[_0x73b6('0x28')][_0x73b6('0x29')]()['then'](function(_0x5182af){if(!_0x5182af){throw new db['Sequelize'][(_0x73b6('0x2a'))](_0x73b6('0x2b'));}_0x116baa=_[_0x73b6('0x2c')](_['keys'](_0x5182af),[_0x73b6('0x2d'),_0x73b6('0x2e')]);_0x29ee50=_['difference'](_[_0x73b6('0x2f')](_0x5182af),['createdAt',_0x73b6('0x2e'),_0x73b6('0x30'),_0x73b6('0x31')]);if(_0x51ced8[_0x73b6('0x32')]['id']){delete _0x51ced8['body']['id'];}if(_['isNil'](_0x51ced8[_0x73b6('0x32')][_0x73b6('0x33')])){throw new db[(_0x73b6('0x34'))][(_0x73b6('0x2a'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x51ced8['body']['body'])||_0x51ced8['body'][_0x73b6('0x32')]===''){throw new db['Sequelize'][(_0x73b6('0x2a'))](_0x73b6('0x35'));}if(_['isNil'](_0x51ced8[_0x73b6('0x32')][_0x73b6('0x36')])){throw new db[(_0x73b6('0x34'))][(_0x73b6('0x2a'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x29ee50);}if(!_[_0x73b6('0x37')](_0x29ee50,_0x51ced8[_0x73b6('0x32')][_0x73b6('0x36')])){throw new db[(_0x73b6('0x34'))][(_0x73b6('0x2a'))](_0x73b6('0x38')+_0x29ee50);}_0x2381d8[_0x51ced8[_0x73b6('0x32')][_0x73b6('0x36')]]=_0x51ced8[_0x73b6('0x32')][_0x73b6('0x33')];})[_0x73b6('0x13')](function(){return db[_0x73b6('0x1e')][_0x73b6('0x39')]({'where':{'id':_0x51ced8[_0x73b6('0x3a')]['id']},'include':[{'model':db[_0x73b6('0x3b')],'as':_0x73b6('0x3c'),'include':[{'model':db[_0x73b6('0x28')],'as':_0x73b6('0x3d'),'where':_0x2381d8,'limit':0x1,'order':[[_0x73b6('0x2e'),_0x73b6('0x3e')]]}]},{'model':db['FaxApplication'],'as':'Applications'}]});})[_0x73b6('0x13')](function(_0x28b0db){if(_0x28b0db&&_0x28b0db['List']){var _0x23ce3f=_0x28b0db['get']({'plain':!![]});_0x2dafad[_0x73b6('0x3a')]=_0x23ce3f;_0x2dafad[_0x73b6('0x3f')]=_0x23ce3f['Applications'];_0x2dafad[_0x73b6('0x40')]=_0x23ce3f[_0x73b6('0x3c')];_0x2dafad[_0x73b6('0x3f')]=_[_0x73b6('0x41')](_0x2dafad[_0x73b6('0x3f')],[_0x73b6('0x42')],[_0x73b6('0x43')]);if(_0x2dafad['account'][_0x73b6('0x44')]){delete _0x2dafad[_0x73b6('0x3a')][_0x73b6('0x44')];}if(_0x2dafad[_0x73b6('0x3a')][_0x73b6('0x3c')]&&_0x2dafad[_0x73b6('0x3a')][_0x73b6('0x3c')]['Contacts'][_0x73b6('0x45')]){return _0x2dafad[_0x73b6('0x3a')][_0x73b6('0x3c')][_0x73b6('0x3d')][0x0];}var _0x3d9390=_[_0x73b6('0xd')](_0x51ced8[_0x73b6('0x32')],{'firstName':_0x51ced8['body'][_0x73b6('0x33')],'ListId':_0x23ce3f[_0x73b6('0x31')]});_0x3d9390[_0x51ced8[_0x73b6('0x32')][_0x73b6('0x36')]]=_0x51ced8[_0x73b6('0x32')][_0x73b6('0x33')];return db[_0x73b6('0x28')]['create'](_0x3d9390,{'fields':_0x116baa,'raw':!![]});}})[_0x73b6('0x13')](function(_0x3c67d3){_0x2dafad[_0x73b6('0x46')]=_0x3c67d3;if(_0x3c67d3){var _0x2e05e6={'ContactId':_0x3c67d3['id'],'FaxAccountId':_0x51ced8[_0x73b6('0x3a')]['id'],'fax':_0x3c67d3[_0x73b6('0x27')]};return db[_0x73b6('0x47')]['find']({'where':{'ContactId':_0x3c67d3['id'],'closed':![],'FaxAccountId':_0x51ced8['account']['id']}})[_0x73b6('0x13')](function(_0x292cf3){if(_0x292cf3){return[_0x292cf3,![]];}return db['FaxInteraction'][_0x73b6('0x48')](_0x2e05e6)[_0x73b6('0x13')](function(_0x310356){return[_0x310356,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x73b6('0x49')](function(_0x1516b8,_0x591760){var _0x426a67=_0x1516b8[_0x73b6('0x4a')]({'plain':!![]});if(_0x591760){if(_0x2dafad[_0x73b6('0x3a')]['autoclose']){_0x2dafad[_0x73b6('0x3f')][_0x73b6('0x4b')]({'id':0x0,'priority':_0x2dafad[_0x73b6('0x3f')]['length']+0x1,'app':_0x73b6('0x4c'),'appdata':'unmanaged','interval':_0x73b6('0x4d')});}_0x426a67[_0x73b6('0x4e')]=!![];}else{_0x426a67[_0x73b6('0x4e')]=![];}_0x2dafad['interaction']=_0x426a67;return db['FaxMessage']['create']({'body':_0x51ced8[_0x73b6('0x32')]['body'],'FaxAccountId':_0x51ced8[_0x73b6('0x3a')]['id'],'FaxInteractionId':_0x1516b8['id'],'direction':'in','ContactId':_0x1516b8[_0x73b6('0x4f')],'AttachmentId':_0x51ced8['body'][_0x73b6('0x50')]});})['then'](function(_0x273834){_0x2dafad[_0x73b6('0x1a')]=_0x273834;if(_0x2dafad['interaction'][_0x73b6('0x51')]){return db[_0x73b6('0x52')][_0x73b6('0x39')]({'attributes':['id',_0x73b6('0x53')],'where':{'id':_0x2dafad[_0x73b6('0x54')][_0x73b6('0x51')]}})[_0x73b6('0x13')](function(_0x1947b0){if(_0x1947b0){_0x2dafad['applications'][_0x73b6('0x55')]({'id':0x0,'priority':0x0,'app':_0x73b6('0x56'),'appdata':_0x1947b0[_0x73b6('0x53')]+','+(_0x2dafad[_0x73b6('0x3a')][_0x73b6('0x57')]||0xa),'interval':_0x73b6('0x4d')});}return respondWithRpcPromise(_0x73b6('0x58'),_0x73b6('0x59'),_0x2dafad);});}return respondWithRpcPromise(_0x73b6('0x58'),_0x73b6('0x59'),_0x2dafad);})[_0x73b6('0x13')](function(_0x19b2c7){_0x279869(_0x19b2c7);})[_0x73b6('0x1c')](function(_0x334333){_0x1e23f2(_0xce314a[_0x73b6('0x18')](0x1f4,_0x334333['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index cef2630..345d2ed 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 _0xc004=['faxAccount:','./faxAccount.events','save','remove','update','emit','register','length'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xc004,0x1b9));var _0x4c00=function(_0x541ea6,_0x51cab6){_0x541ea6=_0x541ea6-0x0;var _0x3c3e84=_0xc004[_0x541ea6];return _0x3c3e84;};'use strict';var FaxAccountEvents=require(_0x4c00('0x0'));var events=[_0x4c00('0x1'),_0x4c00('0x2'),_0x4c00('0x3')];function createListener(_0x45a95e,_0x53eea8){return function(_0x34d29d){_0x53eea8[_0x4c00('0x4')](_0x45a95e,_0x34d29d);};}function removeListener(_0xf0d955,_0x3fbf91){return function(){FaxAccountEvents['removeListener'](_0xf0d955,_0x3fbf91);};}exports[_0x4c00('0x5')]=function(_0x51c6c1){for(var _0x1dd81c=0x0,_0x4fbaff=events[_0x4c00('0x6')];_0x1dd81c<_0x4fbaff;_0x1dd81c++){var _0x53d94a=events[_0x1dd81c];var _0x17947b=createListener(_0x4c00('0x7')+_0x53d94a,_0x51c6c1);FaxAccountEvents['on'](_0x53d94a,_0x17947b);}}; \ No newline at end of file +var _0x7e6c=['save','remove','removeListener','register','length','faxAccount:','./faxAccount.events'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x7e6c,0x195));var _0xc7e6=function(_0x367ac0,_0x5ddbf7){_0x367ac0=_0x367ac0-0x0;var _0x5c6ea7=_0x7e6c[_0x367ac0];return _0x5c6ea7;};'use strict';var FaxAccountEvents=require(_0xc7e6('0x0'));var events=[_0xc7e6('0x1'),_0xc7e6('0x2'),'update'];function createListener(_0x3920b2,_0x47c23d){return function(_0xdc4fc7){_0x47c23d['emit'](_0x3920b2,_0xdc4fc7);};}function removeListener(_0x4a2bf9,_0x45cef3){return function(){FaxAccountEvents[_0xc7e6('0x3')](_0x4a2bf9,_0x45cef3);};}exports[_0xc7e6('0x4')]=function(_0x3c43e8){for(var _0x4eb092=0x0,_0x4bb9cf=events[_0xc7e6('0x5')];_0x4eb092<_0x4bb9cf;_0x4eb092++){var _0x11c9e2=events[_0x4eb092];var _0x1fda4d=createListener(_0xc7e6('0x6')+_0x11c9e2,_0x3c43e8);FaxAccountEvents['on'](_0x11c9e2,_0x1fda4d);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index d33f4a2..8e68c25 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(_0x4c5787,_0x3ca1e0){var _0x1c0b72=function(_0x140194){while(--_0x140194){_0x4c5787['push'](_0x4c5787['shift']());}};_0x1c0b72(++_0x3ca1e0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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(_0x5ce992,_0x1c854a){var _0x479d37=function(_0x40abfd){while(--_0x40abfd){_0x5ce992['push'](_0x5ce992['shift']());}};_0x479d37(++_0x1c854a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 a8a74bd..8ddcac3 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 _0xb3ec=['sequelize','exports','INTEGER','noop','TEXT','STRING','*,*,*,*'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xb3ec,0x181));var _0xcb3e=function(_0x4c1e1b,_0x4d6411){_0x4c1e1b=_0x4c1e1b-0x0;var _0xc0a3f=_0xb3ec[_0x4c1e1b];return _0xc0a3f;};'use strict';var Sequelize=require(_0xcb3e('0x0'));module[_0xcb3e('0x1')]={'priority':{'type':Sequelize[_0xcb3e('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xcb3e('0x3')},'appdata':{'type':Sequelize[_0xcb3e('0x4')]()},'description':{'type':Sequelize[_0xcb3e('0x5')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xcb3e('0x6')}}; \ No newline at end of file +var _0xc747=['TEXT','STRING','sequelize','INTEGER','noop'];(function(_0x1beafd,_0x5bc2a2){var _0x2bb475=function(_0x2b1acf){while(--_0x2b1acf){_0x1beafd['push'](_0x1beafd['shift']());}};_0x2bb475(++_0x5bc2a2);}(_0xc747,0x1e7));var _0x7c74=function(_0x9b243f,_0x3f5ece){_0x9b243f=_0x9b243f-0x0;var _0x2a3d3b=_0xc747[_0x9b243f];return _0x2a3d3b;};'use strict';var Sequelize=require(_0x7c74('0x0'));module['exports']={'priority':{'type':Sequelize[_0x7c74('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7c74('0x2')},'appdata':{'type':Sequelize[_0x7c74('0x3')]()},'description':{'type':Sequelize[_0x7c74('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 8d04ac8..7dfa56b 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 _0x30e5=['sort','pick','where','VIRTUAL','filter','options','include','findAll','rows','catch','params','fields','length','includeAll','merge','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','end','sendStatus','stack','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','hasOwnProperty','order'];(function(_0xbf8b24,_0x15a25e){var _0x3c71c1=function(_0x2beeed){while(--_0x2beeed){_0xbf8b24['push'](_0xbf8b24['shift']());}};_0x3c71c1(++_0x15a25e);}(_0x30e5,0xf7));var _0x530e=function(_0x116538,_0x1d9449){_0x116538=_0x116538-0x0;var _0x521263=_0x30e5[_0x116538];return _0x521263;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x530e('0x0'));var zipdir=require(_0x530e('0x1'));var jsonpatch=require(_0x530e('0x2'));var rp=require(_0x530e('0x3'));var moment=require('moment');var BPromise=require(_0x530e('0x4'));var Mustache=require(_0x530e('0x5'));var util=require('util');var path=require(_0x530e('0x6'));var sox=require(_0x530e('0x7'));var csv=require(_0x530e('0x8'));var ejs=require(_0x530e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x530e('0xa'));var squel=require(_0x530e('0xb'));var crypto=require(_0x530e('0xc'));var jsforce=require(_0x530e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x530e('0x8'));var querystring=require(_0x530e('0xe'));var Papa=require('papaparse');var Redis=require(_0x530e('0xf'));var authService=require(_0x530e('0x10'));var qs=require(_0x530e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x530e('0x12'));var logger=require(_0x530e('0x13'))('api');var utils=require(_0x530e('0x14'));var config=require(_0x530e('0x15'));var licenseUtil=require(_0x530e('0x16'));var db=require(_0x530e('0x17'))['db'];function respondWithStatusCode(_0x37a0c9,_0x45c569){_0x45c569=_0x45c569||0xcc;return function(_0x337cc0){if(_0x337cc0){return _0x37a0c9['sendStatus'](_0x45c569);}return _0x37a0c9[_0x530e('0x18')](_0x45c569)['end']();};}function respondWithResult(_0x5aad29,_0x39826d){_0x39826d=_0x39826d||0xc8;return function(_0x10790d){if(_0x10790d){return _0x5aad29[_0x530e('0x18')](_0x39826d)[_0x530e('0x19')](_0x10790d);}};}function respondWithFilteredResult(_0x446aa0,_0x2ee0ca){return function(_0x4bf027){if(_0x4bf027){var _0x3c2040=typeof _0x2ee0ca['offset']===_0x530e('0x1a')&&typeof _0x2ee0ca[_0x530e('0x1b')]===_0x530e('0x1a');var _0x5dd776=_0x4bf027['count'];var _0x41da2d=_0x3c2040?0x0:_0x2ee0ca[_0x530e('0x1c')];var _0x146891=_0x3c2040?_0x4bf027[_0x530e('0x1d')]:_0x2ee0ca[_0x530e('0x1c')]+_0x2ee0ca[_0x530e('0x1b')];var _0x200482;if(_0x146891>=_0x5dd776){_0x146891=_0x5dd776;_0x200482=0xc8;}else{_0x200482=0xce;}_0x446aa0['status'](_0x200482);return _0x446aa0[_0x530e('0x1e')](_0x530e('0x1f'),_0x41da2d+'-'+_0x146891+'/'+_0x5dd776)['json'](_0x4bf027);}return null;};}function patchUpdates(_0x4ccfd8){return function(_0x187e7a){try{jsonpatch[_0x530e('0x20')](_0x187e7a,_0x4ccfd8,!![]);}catch(_0x1ba936){return BPromise[_0x530e('0x21')](_0x1ba936);}return _0x187e7a[_0x530e('0x22')]();};}function saveUpdates(_0x15e1d2,_0x4224f3){return function(_0x5cd272){if(_0x5cd272){return _0x5cd272[_0x530e('0x23')](_0x15e1d2)['then'](function(_0x2e09c9){return _0x2e09c9;});}return null;};}function removeEntity(_0x4386a3,_0xd43d40){return function(_0x30da3e){if(_0x30da3e){return _0x30da3e['destroy']()[_0x530e('0x24')](function(){_0x4386a3[_0x530e('0x18')](0xcc)[_0x530e('0x25')]();});}};}function handleEntityNotFound(_0x3075d8,_0x569136){return function(_0xb5d2db){if(!_0xb5d2db){_0x3075d8[_0x530e('0x26')](0x194);}return _0xb5d2db;};}function handleError(_0xf02e4,_0x25d0aa){_0x25d0aa=_0x25d0aa||0x1f4;return function(_0x1fa0e3){logger['error'](_0x1fa0e3[_0x530e('0x27')]);if(_0x1fa0e3['name']){delete _0x1fa0e3['name'];}_0xf02e4[_0x530e('0x18')](_0x25d0aa)[_0x530e('0x28')](_0x1fa0e3);};}exports[_0x530e('0x29')]=function(_0x17a12,_0x50ab87){var _0x5325f8={},_0x278f15={},_0x2472d6={'count':0x0,'rows':[]};var _0x31a1f1=_[_0x530e('0x2a')](db[_0x530e('0x2b')][_0x530e('0x2c')],function(_0x310b91){return{'name':_0x310b91[_0x530e('0x2d')],'type':_0x310b91[_0x530e('0x2e')][_0x530e('0x2f')]};});_0x278f15[_0x530e('0x30')]=_[_0x530e('0x2a')](_0x31a1f1,_0x530e('0x31'));_0x278f15[_0x530e('0x32')]=_[_0x530e('0x33')](_0x17a12['query']);_0x278f15[_0x530e('0x34')]=_['intersection'](_0x278f15[_0x530e('0x30')],_0x278f15[_0x530e('0x32')]);_0x5325f8[_0x530e('0x35')]=_[_0x530e('0x36')](_0x278f15[_0x530e('0x30')],qs['fields'](_0x17a12[_0x530e('0x32')]['fields']));_0x5325f8['attributes']=_0x5325f8[_0x530e('0x35')]['length']?_0x5325f8['attributes']:_0x278f15['model'];if(!_0x17a12[_0x530e('0x32')][_0x530e('0x37')]('nolimit')){_0x5325f8['limit']=qs[_0x530e('0x1b')](_0x17a12[_0x530e('0x32')]['limit']);_0x5325f8[_0x530e('0x1c')]=qs[_0x530e('0x1c')](_0x17a12[_0x530e('0x32')][_0x530e('0x1c')]);}_0x5325f8[_0x530e('0x38')]=qs['sort'](_0x17a12[_0x530e('0x32')][_0x530e('0x39')]);_0x5325f8['where']=qs[_0x530e('0x34')](_[_0x530e('0x3a')](_0x17a12['query'],_0x278f15[_0x530e('0x34')]),_0x31a1f1);if(_0x17a12[_0x530e('0x32')]['filter']){_0x5325f8[_0x530e('0x3b')]=_['merge'](_0x5325f8['where'],{'$or':_[_0x530e('0x2a')](_0x31a1f1,function(_0x1e325b){if(_0x1e325b['type']!==_0x530e('0x3c')){var _0x5ad02c={};_0x5ad02c[_0x1e325b[_0x530e('0x31')]]={'$like':'%'+_0x17a12[_0x530e('0x32')][_0x530e('0x3d')]+'%'};return _0x5ad02c;}})});}_0x5325f8=_['merge']({},_0x5325f8,_0x17a12[_0x530e('0x3e')]);var _0x44a7e2={'where':_0x5325f8[_0x530e('0x3b')]};return db[_0x530e('0x2b')][_0x530e('0x1d')](_0x44a7e2)[_0x530e('0x24')](function(_0x53bd0c){_0x2472d6['count']=_0x53bd0c;if(_0x17a12[_0x530e('0x32')]['includeAll']){_0x5325f8[_0x530e('0x3f')]=[{'all':!![]}];}return db[_0x530e('0x2b')][_0x530e('0x40')](_0x5325f8);})['then'](function(_0xe28980){_0x2472d6[_0x530e('0x41')]=_0xe28980;return _0x2472d6;})[_0x530e('0x24')](respondWithFilteredResult(_0x50ab87,_0x5325f8))[_0x530e('0x42')](handleError(_0x50ab87,null));};exports['show']=function(_0x5c3be3,_0x2c1aec){var _0x5a9e97={'raw':!![],'where':{'id':_0x5c3be3[_0x530e('0x43')]['id']}},_0x21e718={};_0x21e718['model']=_[_0x530e('0x33')](db[_0x530e('0x2b')][_0x530e('0x2c')]);_0x21e718[_0x530e('0x32')]=_[_0x530e('0x33')](_0x5c3be3[_0x530e('0x32')]);_0x21e718['filters']=_[_0x530e('0x36')](_0x21e718[_0x530e('0x30')],_0x21e718[_0x530e('0x32')]);_0x5a9e97[_0x530e('0x35')]=_[_0x530e('0x36')](_0x21e718[_0x530e('0x30')],qs[_0x530e('0x44')](_0x5c3be3[_0x530e('0x32')][_0x530e('0x44')]));_0x5a9e97[_0x530e('0x35')]=_0x5a9e97[_0x530e('0x35')][_0x530e('0x45')]?_0x5a9e97[_0x530e('0x35')]:_0x21e718[_0x530e('0x30')];if(_0x5c3be3[_0x530e('0x32')][_0x530e('0x46')]){_0x5a9e97[_0x530e('0x3f')]=[{'all':!![]}];}_0x5a9e97=_[_0x530e('0x47')]({},_0x5a9e97,_0x5c3be3[_0x530e('0x3e')]);return db[_0x530e('0x2b')][_0x530e('0x48')](_0x5a9e97)[_0x530e('0x24')](handleEntityNotFound(_0x2c1aec,null))['then'](respondWithResult(_0x2c1aec,null))[_0x530e('0x42')](handleError(_0x2c1aec,null));};exports[_0x530e('0x49')]=function(_0x523d66,_0x5c49e5){return db['FaxApplication']['create'](_0x523d66['body'],{})['then'](respondWithResult(_0x5c49e5,0xc9))[_0x530e('0x42')](handleError(_0x5c49e5,null));};exports['update']=function(_0x41dfef,_0x23c3a5){if(_0x41dfef['body']['id']){delete _0x41dfef[_0x530e('0x4a')]['id'];}return db[_0x530e('0x2b')][_0x530e('0x48')]({'where':{'id':_0x41dfef['params']['id']}})['then'](handleEntityNotFound(_0x23c3a5,null))[_0x530e('0x24')](saveUpdates(_0x41dfef['body'],null))[_0x530e('0x24')](respondWithResult(_0x23c3a5,null))[_0x530e('0x42')](handleError(_0x23c3a5,null));};exports[_0x530e('0x4b')]=function(_0x2ed397,_0x3cb33c){return db['FaxApplication']['find']({'where':{'id':_0x2ed397[_0x530e('0x43')]['id']}})[_0x530e('0x24')](handleEntityNotFound(_0x3cb33c,null))['then'](removeEntity(_0x3cb33c,null))[_0x530e('0x42')](handleError(_0x3cb33c,null));}; \ No newline at end of file +var _0x2736=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','FaxApplication','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','create','body','find','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0x2736,0x1b8));var _0x6273=function(_0x3f7855,_0x535342){_0x3f7855=_0x3f7855-0x0;var _0x301fb7=_0x2736[_0x3f7855];return _0x301fb7;};'use strict';var emlformat=require(_0x6273('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6273('0x1'));var jsonpatch=require(_0x6273('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6273('0x3'));var Mustache=require(_0x6273('0x4'));var util=require(_0x6273('0x5'));var path=require(_0x6273('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6273('0x7'));var fs=require('fs');var fs_extra=require(_0x6273('0x8'));var _=require(_0x6273('0x9'));var squel=require(_0x6273('0xa'));var crypto=require(_0x6273('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6273('0xc'));var toCsv=require(_0x6273('0xd'));var querystring=require(_0x6273('0xe'));var Papa=require(_0x6273('0xf'));var Redis=require(_0x6273('0x10'));var authService=require(_0x6273('0x11'));var qs=require(_0x6273('0x12'));var as=require(_0x6273('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x6273('0x14'));var config=require(_0x6273('0x15'));var licenseUtil=require(_0x6273('0x16'));var db=require(_0x6273('0x17'))['db'];function respondWithStatusCode(_0x2d7d6b,_0x20c8c3){_0x20c8c3=_0x20c8c3||0xcc;return function(_0xb84212){if(_0xb84212){return _0x2d7d6b[_0x6273('0x18')](_0x20c8c3);}return _0x2d7d6b['status'](_0x20c8c3)[_0x6273('0x19')]();};}function respondWithResult(_0xb60496,_0x335aca){_0x335aca=_0x335aca||0xc8;return function(_0x398ce6){if(_0x398ce6){return _0xb60496[_0x6273('0x1a')](_0x335aca)[_0x6273('0x1b')](_0x398ce6);}};}function respondWithFilteredResult(_0x34f153,_0x8d2187){return function(_0x5e15ca){if(_0x5e15ca){var _0xbfc766=typeof _0x8d2187['offset']===_0x6273('0x1c')&&typeof _0x8d2187[_0x6273('0x1d')]===_0x6273('0x1c');var _0x271b2b=_0x5e15ca[_0x6273('0x1e')];var _0x1e4881=_0xbfc766?0x0:_0x8d2187[_0x6273('0x1f')];var _0x3dc02e=_0xbfc766?_0x5e15ca[_0x6273('0x1e')]:_0x8d2187[_0x6273('0x1f')]+_0x8d2187[_0x6273('0x1d')];var _0xc9728b;if(_0x3dc02e>=_0x271b2b){_0x3dc02e=_0x271b2b;_0xc9728b=0xc8;}else{_0xc9728b=0xce;}_0x34f153[_0x6273('0x1a')](_0xc9728b);return _0x34f153['set'](_0x6273('0x20'),_0x1e4881+'-'+_0x3dc02e+'/'+_0x271b2b)[_0x6273('0x1b')](_0x5e15ca);}return null;};}function patchUpdates(_0x4176aa){return function(_0x56a44b){try{jsonpatch['apply'](_0x56a44b,_0x4176aa,!![]);}catch(_0x135fb6){return BPromise[_0x6273('0x21')](_0x135fb6);}return _0x56a44b[_0x6273('0x22')]();};}function saveUpdates(_0x3cce01,_0x5733aa){return function(_0x5c2550){if(_0x5c2550){return _0x5c2550[_0x6273('0x23')](_0x3cce01)[_0x6273('0x24')](function(_0x9952d3){return _0x9952d3;});}return null;};}function removeEntity(_0x1084b6,_0x2149f2){return function(_0x3c57ec){if(_0x3c57ec){return _0x3c57ec[_0x6273('0x25')]()[_0x6273('0x24')](function(){_0x1084b6[_0x6273('0x1a')](0xcc)[_0x6273('0x19')]();});}};}function handleEntityNotFound(_0x4c6e62,_0x1a00f8){return function(_0x524a9d){if(!_0x524a9d){_0x4c6e62[_0x6273('0x18')](0x194);}return _0x524a9d;};}function handleError(_0x4f7607,_0x1d54df){_0x1d54df=_0x1d54df||0x1f4;return function(_0xc83d3){logger[_0x6273('0x26')](_0xc83d3[_0x6273('0x27')]);if(_0xc83d3[_0x6273('0x28')]){delete _0xc83d3[_0x6273('0x28')];}_0x4f7607[_0x6273('0x1a')](_0x1d54df)[_0x6273('0x29')](_0xc83d3);};}exports[_0x6273('0x2a')]=function(_0xbdf79e,_0x2d0e09){var _0x228ab8={},_0x11928a={},_0x579dc2={'count':0x0,'rows':[]};var _0x50e2c5=_[_0x6273('0x2b')](db[_0x6273('0x2c')]['rawAttributes'],function(_0x15e982){return{'name':_0x15e982[_0x6273('0x2d')],'type':_0x15e982['type'][_0x6273('0x2e')]};});_0x11928a[_0x6273('0x2f')]=_[_0x6273('0x2b')](_0x50e2c5,_0x6273('0x28'));_0x11928a[_0x6273('0x30')]=_['keys'](_0xbdf79e[_0x6273('0x30')]);_0x11928a[_0x6273('0x31')]=_[_0x6273('0x32')](_0x11928a[_0x6273('0x2f')],_0x11928a[_0x6273('0x30')]);_0x228ab8[_0x6273('0x33')]=_['intersection'](_0x11928a[_0x6273('0x2f')],qs[_0x6273('0x34')](_0xbdf79e[_0x6273('0x30')][_0x6273('0x34')]));_0x228ab8[_0x6273('0x33')]=_0x228ab8[_0x6273('0x33')][_0x6273('0x35')]?_0x228ab8[_0x6273('0x33')]:_0x11928a['model'];if(!_0xbdf79e[_0x6273('0x30')][_0x6273('0x36')](_0x6273('0x37'))){_0x228ab8[_0x6273('0x1d')]=qs[_0x6273('0x1d')](_0xbdf79e[_0x6273('0x30')][_0x6273('0x1d')]);_0x228ab8[_0x6273('0x1f')]=qs[_0x6273('0x1f')](_0xbdf79e['query'][_0x6273('0x1f')]);}_0x228ab8[_0x6273('0x38')]=qs[_0x6273('0x39')](_0xbdf79e[_0x6273('0x30')][_0x6273('0x39')]);_0x228ab8[_0x6273('0x3a')]=qs[_0x6273('0x31')](_[_0x6273('0x3b')](_0xbdf79e[_0x6273('0x30')],_0x11928a[_0x6273('0x31')]),_0x50e2c5);if(_0xbdf79e[_0x6273('0x30')]['filter']){_0x228ab8[_0x6273('0x3a')]=_[_0x6273('0x3c')](_0x228ab8[_0x6273('0x3a')],{'$or':_['map'](_0x50e2c5,function(_0x345c64){if(_0x345c64[_0x6273('0x3d')]!==_0x6273('0x3e')){var _0x418314={};_0x418314[_0x345c64['name']]={'$like':'%'+_0xbdf79e[_0x6273('0x30')][_0x6273('0x3f')]+'%'};return _0x418314;}})});}_0x228ab8=_[_0x6273('0x3c')]({},_0x228ab8,_0xbdf79e[_0x6273('0x40')]);var _0x5cc0fb={'where':_0x228ab8['where']};return db[_0x6273('0x2c')][_0x6273('0x1e')](_0x5cc0fb)[_0x6273('0x24')](function(_0x48aaa2){_0x579dc2[_0x6273('0x1e')]=_0x48aaa2;if(_0xbdf79e[_0x6273('0x30')][_0x6273('0x41')]){_0x228ab8[_0x6273('0x42')]=[{'all':!![]}];}return db[_0x6273('0x2c')]['findAll'](_0x228ab8);})[_0x6273('0x24')](function(_0x5c422f){_0x579dc2[_0x6273('0x43')]=_0x5c422f;return _0x579dc2;})['then'](respondWithFilteredResult(_0x2d0e09,_0x228ab8))[_0x6273('0x44')](handleError(_0x2d0e09,null));};exports[_0x6273('0x45')]=function(_0x53cb41,_0x55faf1){var _0xeb8005={'raw':!![],'where':{'id':_0x53cb41[_0x6273('0x46')]['id']}},_0x2e7ae4={};_0x2e7ae4[_0x6273('0x2f')]=_[_0x6273('0x47')](db[_0x6273('0x2c')][_0x6273('0x48')]);_0x2e7ae4['query']=_['keys'](_0x53cb41[_0x6273('0x30')]);_0x2e7ae4[_0x6273('0x31')]=_[_0x6273('0x32')](_0x2e7ae4[_0x6273('0x2f')],_0x2e7ae4['query']);_0xeb8005[_0x6273('0x33')]=_[_0x6273('0x32')](_0x2e7ae4[_0x6273('0x2f')],qs['fields'](_0x53cb41[_0x6273('0x30')]['fields']));_0xeb8005[_0x6273('0x33')]=_0xeb8005[_0x6273('0x33')][_0x6273('0x35')]?_0xeb8005[_0x6273('0x33')]:_0x2e7ae4[_0x6273('0x2f')];if(_0x53cb41['query'][_0x6273('0x41')]){_0xeb8005['include']=[{'all':!![]}];}_0xeb8005=_['merge']({},_0xeb8005,_0x53cb41['options']);return db['FaxApplication']['find'](_0xeb8005)['then'](handleEntityNotFound(_0x55faf1,null))[_0x6273('0x24')](respondWithResult(_0x55faf1,null))[_0x6273('0x44')](handleError(_0x55faf1,null));};exports[_0x6273('0x49')]=function(_0x3aa1d8,_0x47584f){return db[_0x6273('0x2c')][_0x6273('0x49')](_0x3aa1d8[_0x6273('0x4a')],{})[_0x6273('0x24')](respondWithResult(_0x47584f,0xc9))[_0x6273('0x44')](handleError(_0x47584f,null));};exports[_0x6273('0x23')]=function(_0x57b6ec,_0x245d74){if(_0x57b6ec['body']['id']){delete _0x57b6ec['body']['id'];}return db['FaxApplication'][_0x6273('0x4b')]({'where':{'id':_0x57b6ec[_0x6273('0x46')]['id']}})[_0x6273('0x24')](handleEntityNotFound(_0x245d74,null))[_0x6273('0x24')](saveUpdates(_0x57b6ec[_0x6273('0x4a')],null))[_0x6273('0x24')](respondWithResult(_0x245d74,null))[_0x6273('0x44')](handleError(_0x245d74,null));};exports[_0x6273('0x25')]=function(_0x1c385a,_0x34726b){return db[_0x6273('0x2c')]['find']({'where':{'id':_0x1c385a[_0x6273('0x46')]['id']}})[_0x6273('0x24')](handleEntityNotFound(_0x34726b,null))[_0x6273('0x24')](removeEntity(_0x34726b,null))[_0x6273('0x44')](handleError(_0x34726b,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 5d3ca06..c0df36f 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 _0x3534=['define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxApplication.attributes','exports'];(function(_0x17d5d8,_0x2a542d){var _0x4d193c=function(_0x3115a0){while(--_0x3115a0){_0x17d5d8['push'](_0x17d5d8['shift']());}};_0x4d193c(++_0x2a542d);}(_0x3534,0x15e));var _0x4353=function(_0x241b58,_0x3ed6a8){_0x241b58=_0x241b58-0x0;var _0x3ee8aa=_0x3534[_0x241b58];return _0x3ee8aa;};'use strict';var _=require(_0x4353('0x0'));var util=require('util');var logger=require(_0x4353('0x1'))(_0x4353('0x2'));var moment=require(_0x4353('0x3'));var BPromise=require(_0x4353('0x4'));var rp=require(_0x4353('0x5'));var fs=require('fs');var path=require(_0x4353('0x6'));var rimraf=require(_0x4353('0x7'));var config=require('../../config/environment');var attributes=require(_0x4353('0x8'));module[_0x4353('0x9')]=function(_0x550264,_0x19b4b6){return _0x550264[_0x4353('0xa')](_0x4353('0xb'),attributes,{'tableName':_0x4353('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4353('0xd'),'collate':_0x4353('0xe')});}; \ No newline at end of file +var _0x8b19=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./faxApplication.attributes','exports','FaxApplication','fax_applications','utf8mb4'];(function(_0x289891,_0x49a0fa){var _0x31cf2e=function(_0x8cebce){while(--_0x8cebce){_0x289891['push'](_0x289891['shift']());}};_0x31cf2e(++_0x49a0fa);}(_0x8b19,0x119));var _0x98b1=function(_0x5b7dae,_0x1f97a1){_0x5b7dae=_0x5b7dae-0x0;var _0x5bea72=_0x8b19[_0x5b7dae];return _0x5bea72;};'use strict';var _=require(_0x98b1('0x0'));var util=require(_0x98b1('0x1'));var logger=require(_0x98b1('0x2'))(_0x98b1('0x3'));var moment=require('moment');var BPromise=require(_0x98b1('0x4'));var rp=require(_0x98b1('0x5'));var fs=require('fs');var path=require(_0x98b1('0x6'));var rimraf=require('rimraf');var config=require(_0x98b1('0x7'));var attributes=require(_0x98b1('0x8'));module[_0x98b1('0x9')]=function(_0x967a47,_0x913e1a){return _0x967a47['define'](_0x98b1('0xa'),attributes,{'tableName':_0x98b1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x98b1('0xc'),'collate':_0x98b1('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 766eb9a..56e2ba1 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 _0x6170=['options','attributes','limit','info','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','UpdateFaxApplication','FaxApplication','update','body'];(function(_0x4ec1e6,_0x192494){var _0x2ebb85=function(_0x4ceb7c){while(--_0x4ceb7c){_0x4ec1e6['push'](_0x4ec1e6['shift']());}};_0x2ebb85(++_0x192494);}(_0x6170,0x1d5));var _0x0617=function(_0x449e02,_0x3e3f6a){_0x449e02=_0x449e02-0x0;var _0x5f0df6=_0x6170[_0x449e02];return _0x5f0df6;};'use strict';var _=require(_0x0617('0x0'));var util=require('util');var moment=require(_0x0617('0x1'));var BPromise=require(_0x0617('0x2'));var rs=require(_0x0617('0x3'));var fs=require('fs');var Redis=require(_0x0617('0x4'));var db=require(_0x0617('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0617('0x6'))(_0x0617('0x7'));var config=require(_0x0617('0x8'));var jayson=require(_0x0617('0x9'));var client=jayson[_0x0617('0xa')][_0x0617('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b49be,_0x1324b4,_0x39d9ee){return new BPromise(function(_0x4eb881,_0x25f482){return client['request'](_0x1b49be,_0x39d9ee)[_0x0617('0xc')](function(_0x2a84d9){logger['info'](_0x0617('0xd'),_0x1324b4,'request\x20sent');logger[_0x0617('0xe')](_0x0617('0xf'),_0x1324b4,_0x0617('0x10'),JSON[_0x0617('0x11')](_0x2a84d9));if(_0x2a84d9['error']){if(_0x2a84d9['error'][_0x0617('0x12')]===0x1f4){logger[_0x0617('0x13')]('FaxApplication,\x20%s,\x20%s',_0x1324b4,_0x2a84d9[_0x0617('0x13')][_0x0617('0x14')]);return _0x25f482(_0x2a84d9['error'][_0x0617('0x14')]);}logger[_0x0617('0x13')](_0x0617('0xd'),_0x1324b4,_0x2a84d9[_0x0617('0x13')][_0x0617('0x14')]);return _0x4eb881(_0x2a84d9[_0x0617('0x13')][_0x0617('0x14')]);}else{logger['info'](_0x0617('0xd'),_0x1324b4,_0x0617('0x10'));_0x4eb881(_0x2a84d9[_0x0617('0x15')]['message']);}})[_0x0617('0x16')](function(_0x517ae3){logger['error'](_0x0617('0xd'),_0x1324b4,_0x517ae3);_0x25f482(_0x517ae3);});});}exports[_0x0617('0x17')]=function(_0x4a2e4c){var _0x19639f=this;return new Promise(function(_0x18ed18,_0x519b99){return db[_0x0617('0x18')][_0x0617('0x19')](_0x4a2e4c[_0x0617('0x1a')],{'raw':_0x4a2e4c[_0x0617('0x1b')]?_0x4a2e4c[_0x0617('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a2e4c[_0x0617('0x1b')]?_0x4a2e4c['options']['where']||null:null,'attributes':_0x4a2e4c[_0x0617('0x1b')]?_0x4a2e4c[_0x0617('0x1b')][_0x0617('0x1c')]||null:null,'limit':_0x4a2e4c[_0x0617('0x1b')]?_0x4a2e4c[_0x0617('0x1b')][_0x0617('0x1d')]||null:null})[_0x0617('0xc')](function(_0x51c4be){logger[_0x0617('0x1e')](_0x0617('0x17'),_0x4a2e4c);logger['debug'](_0x0617('0x17'),_0x4a2e4c,JSON[_0x0617('0x11')](_0x51c4be));_0x18ed18(_0x51c4be);})[_0x0617('0x16')](function(_0x102365){logger['error'](_0x0617('0x17'),_0x102365[_0x0617('0x14')],_0x4a2e4c);_0x519b99(_0x19639f[_0x0617('0x13')](0x1f4,_0x102365[_0x0617('0x14')]));});});}; \ No newline at end of file +var _0xee66=['where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateFaxApplication','FaxApplication','update','options','raw'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0xee66,0xa3));var _0x6ee6=function(_0x2e41e2,_0x4e7250){_0x2e41e2=_0x2e41e2-0x0;var _0x2844d6=_0xee66[_0x2e41e2];return _0x2844d6;};'use strict';var _=require(_0x6ee6('0x0'));var util=require(_0x6ee6('0x1'));var moment=require('moment');var BPromise=require(_0x6ee6('0x2'));var rs=require(_0x6ee6('0x3'));var fs=require('fs');var Redis=require(_0x6ee6('0x4'));var db=require(_0x6ee6('0x5'))['db'];var utils=require(_0x6ee6('0x6'));var logger=require(_0x6ee6('0x7'))(_0x6ee6('0x8'));var config=require(_0x6ee6('0x9'));var jayson=require(_0x6ee6('0xa'));var client=jayson[_0x6ee6('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20fa4b,_0x3a6c4f,_0x1c2f92){return new BPromise(function(_0x1fe591,_0x1eb83b){return client[_0x6ee6('0xc')](_0x20fa4b,_0x1c2f92)[_0x6ee6('0xd')](function(_0x50576d){logger[_0x6ee6('0xe')](_0x6ee6('0xf'),_0x3a6c4f,_0x6ee6('0x10'));logger[_0x6ee6('0x11')](_0x6ee6('0x12'),_0x3a6c4f,_0x6ee6('0x10'),JSON[_0x6ee6('0x13')](_0x50576d));if(_0x50576d[_0x6ee6('0x14')]){if(_0x50576d['error']['code']===0x1f4){logger['error'](_0x6ee6('0xf'),_0x3a6c4f,_0x50576d[_0x6ee6('0x14')][_0x6ee6('0x15')]);return _0x1eb83b(_0x50576d['error']['message']);}logger[_0x6ee6('0x14')](_0x6ee6('0xf'),_0x3a6c4f,_0x50576d[_0x6ee6('0x14')]['message']);return _0x1fe591(_0x50576d[_0x6ee6('0x14')][_0x6ee6('0x15')]);}else{logger[_0x6ee6('0xe')](_0x6ee6('0xf'),_0x3a6c4f,_0x6ee6('0x10'));_0x1fe591(_0x50576d[_0x6ee6('0x16')][_0x6ee6('0x15')]);}})[_0x6ee6('0x17')](function(_0x2230a1){logger[_0x6ee6('0x14')]('FaxApplication,\x20%s,\x20%s',_0x3a6c4f,_0x2230a1);_0x1eb83b(_0x2230a1);});});}exports[_0x6ee6('0x18')]=function(_0x5c3186){var _0x3d46bd=this;return new Promise(function(_0x36dbbf,_0x5779b4){return db[_0x6ee6('0x19')][_0x6ee6('0x1a')](_0x5c3186['body'],{'raw':_0x5c3186[_0x6ee6('0x1b')]?_0x5c3186[_0x6ee6('0x1b')][_0x6ee6('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c3186[_0x6ee6('0x1b')]?_0x5c3186[_0x6ee6('0x1b')][_0x6ee6('0x1d')]||null:null,'attributes':_0x5c3186['options']?_0x5c3186['options'][_0x6ee6('0x1e')]||null:null,'limit':_0x5c3186['options']?_0x5c3186[_0x6ee6('0x1b')][_0x6ee6('0x1f')]||null:null})[_0x6ee6('0xd')](function(_0x48988a){logger[_0x6ee6('0xe')](_0x6ee6('0x18'),_0x5c3186);logger[_0x6ee6('0x11')](_0x6ee6('0x18'),_0x5c3186,JSON['stringify'](_0x48988a));_0x36dbbf(_0x48988a);})[_0x6ee6('0x17')](function(_0x89df69){logger[_0x6ee6('0x14')]('UpdateFaxApplication',_0x89df69[_0x6ee6('0x15')],_0x5c3186);_0x5779b4(_0x3d46bd['error'](0x1f4,_0x89df69[_0x6ee6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 915a740..99fad0d 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 _0x34b7=['express','Router','fs-extra','../../components/auth/service','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','path','connect-timeout'];(function(_0x13841c,_0x26c0c2){var _0x117565=function(_0x4ce568){while(--_0x4ce568){_0x13841c['push'](_0x13841c['shift']());}};_0x117565(++_0x26c0c2);}(_0x34b7,0x196));var _0x734b=function(_0x1817b0,_0x3aaaa1){_0x1817b0=_0x1817b0-0x0;var _0x5c10e6=_0x34b7[_0x1817b0];return _0x5c10e6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x734b('0x0'));var timeout=require(_0x734b('0x1'));var express=require(_0x734b('0x2'));var router=express[_0x734b('0x3')]();var fs_extra=require(_0x734b('0x4'));var auth=require(_0x734b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x734b('0x6'));router[_0x734b('0x7')]('/',auth[_0x734b('0x8')](),controller[_0x734b('0x9')]);router[_0x734b('0x7')](_0x734b('0xa'),auth['isAuthenticated'](),controller[_0x734b('0xb')]);router[_0x734b('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x734b('0xa'),auth['isAuthenticated'](),controller[_0x734b('0xd')]);router[_0x734b('0xe')](_0x734b('0xa'),auth[_0x734b('0x8')](),controller[_0x734b('0xf')]);module[_0x734b('0x10')]=router; \ No newline at end of file +var _0x34b7=['express','Router','fs-extra','../../components/auth/service','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','path','connect-timeout'];(function(_0x5b4d68,_0x4d8822){var _0x12f8f2=function(_0x218e60){while(--_0x218e60){_0x5b4d68['push'](_0x5b4d68['shift']());}};_0x12f8f2(++_0x4d8822);}(_0x34b7,0x196));var _0x734b=function(_0x6c75da,_0x1b96d6){_0x6c75da=_0x6c75da-0x0;var _0x5f5d21=_0x34b7[_0x6c75da];return _0x5f5d21;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x734b('0x0'));var timeout=require(_0x734b('0x1'));var express=require(_0x734b('0x2'));var router=express[_0x734b('0x3')]();var fs_extra=require(_0x734b('0x4'));var auth=require(_0x734b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x734b('0x6'));router[_0x734b('0x7')]('/',auth[_0x734b('0x8')](),controller[_0x734b('0x9')]);router[_0x734b('0x7')](_0x734b('0xa'),auth['isAuthenticated'](),controller[_0x734b('0xb')]);router[_0x734b('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x734b('0xa'),auth['isAuthenticated'](),controller[_0x734b('0xd')]);router[_0x734b('0xe')](_0x734b('0xa'),auth[_0x734b('0x8')](),controller[_0x734b('0xf')]);module[_0x734b('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 8bf5b6c..3e53268 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 _0x13ec=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x174a72,_0x46034c){var _0x32cecd=function(_0x188a47){while(--_0x188a47){_0x174a72['push'](_0x174a72['shift']());}};_0x32cecd(++_0x46034c);}(_0x13ec,0x187));var _0xc13e=function(_0xb95770,_0x348a16){_0xb95770=_0xb95770-0x0;var _0x31c181=_0x13ec[_0xb95770];return _0x31c181;};'use strict';var Sequelize=require(_0xc13e('0x0'));module[_0xc13e('0x1')]={'closed':{'type':Sequelize[_0xc13e('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc13e('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xc13e('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xc13e('0x3')]},'fax':{'type':Sequelize[_0xc13e('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xc13e('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc13e('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xc13e('0x5')]('in',_0xc13e('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xba65=['ENUM','out','sequelize','exports','BOOLEAN','STRING','DATE'];(function(_0x3d91ee,_0x574c3e){var _0x1dc68c=function(_0x4e014b){while(--_0x4e014b){_0x3d91ee['push'](_0x3d91ee['shift']());}};_0x1dc68c(++_0x574c3e);}(_0xba65,0x175));var _0x5ba6=function(_0x2867d8,_0xef3ee0){_0x2867d8=_0x2867d8-0x0;var _0x3b8176=_0xba65[_0x2867d8];return _0x3b8176;};'use strict';var Sequelize=require(_0x5ba6('0x0'));module[_0x5ba6('0x1')]={'closed':{'type':Sequelize[_0x5ba6('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x5ba6('0x3')]},'secondDisposition':{'type':Sequelize[_0x5ba6('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x5ba6('0x3')]},'read1stAt':{'type':Sequelize[_0x5ba6('0x4')]},'fax':{'type':Sequelize[_0x5ba6('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x5ba6('0x5')]('in',_0x5ba6('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x5ba6('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index bb3da23..8e5f4bb 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 _0x4597=['getMessages','findOne','FaxMessage','format','YYYY-MM-DD\x20HH:mm:ss','options','rows','addTags','setTags','spread','findAll','color','emit','faxInteractionTags:save','removeTags','download','unix','join','files','tmp','root','server','transcript-%d-%s.zip','Attachment','Messages','mkdirSync','basename','pipe','createWriteStream','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','limit','undefined','count','offset','set','apply','save','then','end','error','name','send','Users','map','fullname','Tags','TagIds','split','forEach','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index','FaxInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','tools_tags','u.id','u.fullname','ui.FaxInteractionId','from','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','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','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','conditions','find','value','having','operator','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','text','some','compact','i.FaxAccountId\x20IN\x20?','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','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','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','isEmpty','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','agent','i.FaxAccountId\x20IS\x20NULL','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','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','FaxInteractionId','push','all','keys','includeAll','include','create','update','params','describe','addMessage','ids','omit'];(function(_0x3ec69d,_0xf8aade){var _0x394c7e=function(_0x16764b){while(--_0x16764b){_0x3ec69d['push'](_0x3ec69d['shift']());}};_0x394c7e(++_0xf8aade);}(_0x4597,0x1db));var _0x7459=function(_0x12fb2c,_0xad4eb9){_0x12fb2c=_0x12fb2c-0x0;var _0x1431cf=_0x4597[_0x12fb2c];return _0x1431cf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7459('0x0'));var zipdir=require(_0x7459('0x1'));var jsonpatch=require(_0x7459('0x2'));var rp=require(_0x7459('0x3'));var moment=require('moment');var BPromise=require(_0x7459('0x4'));var Mustache=require(_0x7459('0x5'));var util=require(_0x7459('0x6'));var path=require(_0x7459('0x7'));var sox=require('sox');var csv=require(_0x7459('0x8'));var ejs=require(_0x7459('0x9'));var fs=require('fs');var fs_extra=require(_0x7459('0xa'));var _=require(_0x7459('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7459('0xc'));var deskjs=require(_0x7459('0xd'));var toCsv=require(_0x7459('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7459('0xe'));var authService=require(_0x7459('0xf'));var qs=require(_0x7459('0x10'));var as=require(_0x7459('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7459('0x12'))(_0x7459('0x13'));var utils=require(_0x7459('0x14'));var config=require(_0x7459('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7459('0x16'))['db'];config[_0x7459('0x17')]=_[_0x7459('0x18')](config[_0x7459('0x17')],{'host':_0x7459('0x19'),'port':0x18eb});var socket=require(_0x7459('0x1a'))(new Redis(config[_0x7459('0x17')]));require(_0x7459('0x1b'))[_0x7459('0x1c')](socket);function respondWithStatusCode(_0x19ad8a,_0x42932e){_0x42932e=_0x42932e||0xcc;return function(_0x4a61b2){if(_0x4a61b2){return _0x19ad8a[_0x7459('0x1d')](_0x42932e);}return _0x19ad8a[_0x7459('0x1e')](_0x42932e)['end']();};}function respondWithResult(_0x3c5e77,_0x3482a4){_0x3482a4=_0x3482a4||0xc8;return function(_0x22c2d6){if(_0x22c2d6){return _0x3c5e77[_0x7459('0x1e')](_0x3482a4)[_0x7459('0x1f')](_0x22c2d6);}};}function respondWithFilteredResult(_0xf4de65,_0x3e3da7){return function(_0x4e0874){if(_0x4e0874){var _0x5bf39c=typeof _0x3e3da7['offset']==='undefined'&&typeof _0x3e3da7[_0x7459('0x20')]===_0x7459('0x21');var _0x25eca1=_0x4e0874[_0x7459('0x22')];var _0xa0b8c0=_0x5bf39c?0x0:_0x3e3da7['offset'];var _0x1692c9=_0x5bf39c?_0x4e0874[_0x7459('0x22')]:_0x3e3da7[_0x7459('0x23')]+_0x3e3da7[_0x7459('0x20')];var _0x1bdb0c;if(_0x1692c9>=_0x25eca1){_0x1692c9=_0x25eca1;_0x1bdb0c=0xc8;}else{_0x1bdb0c=0xce;}_0xf4de65[_0x7459('0x1e')](_0x1bdb0c);return _0xf4de65[_0x7459('0x24')]('Content-Range',_0xa0b8c0+'-'+_0x1692c9+'/'+_0x25eca1)[_0x7459('0x1f')](_0x4e0874);}return null;};}function patchUpdates(_0x341e4d){return function(_0x5d0247){try{jsonpatch[_0x7459('0x25')](_0x5d0247,_0x341e4d,!![]);}catch(_0x3ae43b){return BPromise['reject'](_0x3ae43b);}return _0x5d0247[_0x7459('0x26')]();};}function saveUpdates(_0x214b31,_0x13a392){return function(_0x5949db){if(_0x5949db){return _0x5949db['update'](_0x214b31)[_0x7459('0x27')](function(_0x53587b){return _0x53587b;});}return null;};}function removeEntity(_0x4508e3,_0x219796){return function(_0x2129e0){if(_0x2129e0){return _0x2129e0['destroy']()[_0x7459('0x27')](function(){_0x4508e3[_0x7459('0x1e')](0xcc)[_0x7459('0x28')]();});}};}function handleEntityNotFound(_0x300d36,_0x4936ff){return function(_0x2d4854){if(!_0x2d4854){_0x300d36[_0x7459('0x1d')](0x194);}return _0x2d4854;};}function handleError(_0x21d926,_0x3733c6){_0x3733c6=_0x3733c6||0x1f4;return function(_0x593d25){logger[_0x7459('0x29')](_0x593d25['stack']);if(_0x593d25['name']){delete _0x593d25[_0x7459('0x2a')];}_0x21d926['status'](_0x3733c6)[_0x7459('0x2b')](_0x593d25);};}function getInteractionUsers(_0x168cc4,_0x1bf0b4){return new BPromise(function(_0x3971a5,_0x5a3573){try{if(_0x1bf0b4[_0x168cc4['id']]){_0x168cc4[_0x7459('0x2c')]=_[_0x7459('0x2d')](_0x1bf0b4[_0x168cc4['id']],function(_0x4d35b2){return{'id':_0x4d35b2['id'],'fullname':_0x4d35b2[_0x7459('0x2e')]};});}}catch(_0x2b11e1){_0x5a3573(_0x2b11e1);}_0x3971a5(_0x168cc4);});}function getInteractionTags(_0x23167e,_0x1c6253){return new BPromise(function(_0x42c842,_0x192939){try{if(_0x23167e['TagIds']){_0x23167e[_0x7459('0x2f')]=[];_0x23167e[_0x7459('0x30')][_0x7459('0x31')](',')[_0x7459('0x32')](function(_0x3fe27e){_0x23167e[_0x7459('0x2f')]['push'](_0x1c6253[_0x3fe27e]);});}delete _0x23167e[_0x7459('0x30')];}catch(_0x37651a){_0x192939(_0x37651a);}_0x42c842(_0x23167e);});}function updateFaxInteraction(_0xb7ffd4,_0x3c9428,_0x39e137){return new BPromise(function(_0x5a85a5,_0x381b3a){return getInteractionUsers(_0xb7ffd4,_0x39e137)[_0x7459('0x27')](function(_0xa02b93){return getInteractionTags(_0xa02b93,_0x3c9428);})[_0x7459('0x27')](function(_0x427460){return getStateInteraction(_0x427460);})[_0x7459('0x27')](function(_0xaf7b8a){_0x5a85a5(_0xaf7b8a);})[_0x7459('0x33')](function(_0x2e4c6b){_0x381b3a(_0x2e4c6b);});});}function getStateInteraction(_0x3c516d){return new BPromise(function(_0x2730d7){_0x3c516d[_0x7459('0x34')]=0x0;_0x3c516d[_0x7459('0x35')]=0x0;_0x3c516d[_0x7459('0x36')]=0x0;_0x3c516d[_0x7459('0x37')]=0x0;_0x3c516d[_0x7459('0x38')]=0x0;if(!_0x3c516d[_0x7459('0x39')]&&!_0x3c516d['UserId']){_0x3c516d[_0x7459('0x34')]+=0x1;}if(!_0x3c516d[_0x7459('0x39')]&&_0x3c516d[_0x7459('0x3a')]){_0x3c516d[_0x7459('0x35')]+=0x1;if(_0x3c516d[_0x7459('0x34')]){_0x3c516d[_0x7459('0x34')]-=0x1;}}if(_0x3c516d[_0x7459('0x39')]&&_0x3c516d[_0x7459('0x3a')]){_0x3c516d[_0x7459('0x36')]+=0x1;if(_0x3c516d[_0x7459('0x35')]){_0x3c516d['talking']-=0x1;}}if(_0x3c516d[_0x7459('0x39')]&&!_0x3c516d[_0x7459('0x3a')]){_0x3c516d['unmanaged']+=0x1;if(_0x3c516d[_0x7459('0x34')]){_0x3c516d[_0x7459('0x34')]-=0x1;}}_0x3c516d[_0x7459('0x38')]+=0x1;_0x2730d7(_0x3c516d);});}exports[_0x7459('0x3b')]=function(_0x432a33,_0x3bd691){var _0x493642={},_0x250422={},_0x30b42f={'count':0x0,'rows':[]};var _0x906f7=_[_0x7459('0x2d')](db[_0x7459('0x3c')][_0x7459('0x3d')],function(_0x179f19){return{'name':_0x179f19[_0x7459('0x3e')],'type':_0x179f19[_0x7459('0x3f')][_0x7459('0x40')]};});_0x250422[_0x7459('0x41')]=_[_0x7459('0x2d')](_0x906f7,_0x7459('0x2a'));_0x250422[_0x7459('0x42')]=_['keys'](_0x432a33[_0x7459('0x42')]);_0x250422[_0x7459('0x43')]=_[_0x7459('0x44')](_0x250422[_0x7459('0x41')],_0x250422[_0x7459('0x42')]);_0x493642[_0x7459('0x45')]=_['intersection'](_0x250422['model'],qs['fields'](_0x432a33[_0x7459('0x42')][_0x7459('0x46')]));_0x493642[_0x7459('0x45')]=_0x493642[_0x7459('0x45')][_0x7459('0x47')]?_0x493642[_0x7459('0x45')]:_0x250422[_0x7459('0x41')];if(!_0x432a33[_0x7459('0x42')][_0x7459('0x48')](_0x7459('0x49'))){_0x493642[_0x7459('0x20')]=qs[_0x7459('0x20')](_0x432a33['query'][_0x7459('0x20')]);_0x493642[_0x7459('0x23')]=qs[_0x7459('0x23')](_0x432a33[_0x7459('0x42')][_0x7459('0x23')]);}_0x493642[_0x7459('0x4a')]=qs[_0x7459('0x4b')](_0x432a33[_0x7459('0x42')][_0x7459('0x4b')]);_0x493642[_0x7459('0x4c')]=qs[_0x7459('0x43')](_[_0x7459('0x4d')](_0x432a33[_0x7459('0x42')],_0x250422[_0x7459('0x43')]),_0x906f7);var _0x3813eb=[];var _0x2672b5=squel[_0x7459('0x4e')]()['field']('id')[_0x7459('0x4f')](_0x7459('0x2a'))[_0x7459('0x4f')]('color')['from'](_0x7459('0x50'));var _0x16474a=squel[_0x7459('0x4e')]()[_0x7459('0x4f')](_0x7459('0x51'))[_0x7459('0x4f')](_0x7459('0x52'))[_0x7459('0x4f')](_0x7459('0x53'))[_0x7459('0x54')](_0x7459('0x55'),'ui')['left_join'](_0x7459('0x56'),'u',_0x7459('0x57'));var _0x4ac443=squel[_0x7459('0x4e')]()[_0x7459('0x54')]('fax_interactions','i')[_0x7459('0x58')](_0x7459('0x59'),'c',_0x7459('0x5a'))['left_join'](_0x7459('0x56'),'o',_0x7459('0x5b'))[_0x7459('0x58')](_0x7459('0x5c'),'a',_0x7459('0x5d'))[_0x7459('0x58')](_0x7459('0x5e'),'me',_0x7459('0x5f'))[_0x7459('0x58')](_0x7459('0x60'),'it',_0x7459('0x61'))[_0x7459('0x58')](_0x7459('0x50'),'t',_0x7459('0x62'));var _0x242f6d=squel[_0x7459('0x63')]();var _0x113762=[];var _0x34f95f=squel[_0x7459('0x63')]();var _0x171b2b;if(_0x432a33[_0x7459('0x42')]['search']){_0x171b2b=as[_0x7459('0x64')](_0x432a33[_0x7459('0x42')]['search']);var _0x5dedcf=_0x171b2b[_0x7459('0x65')];for(var _0x472ee0=0x0;_0x472ee0<_0x171b2b[_0x7459('0x66')]['length'];_0x472ee0++){var _0x2a73e2=_0x171b2b[_0x7459('0x66')][_0x472ee0];var _0x239861='i';var _0x52cbf4=_[_0x7459('0x67')](_0x906f7,[_0x7459('0x2a'),_0x2a73e2[_0x7459('0x4f')]]);if(!_0x52cbf4){switch(_0x2a73e2[_0x7459('0x4f')]){case'unreadMessages':if(_0x2a73e2[_0x7459('0x68')]==0x1){_0x4ac443[_0x7459('0x69')]('`'+_0x2a73e2[_0x7459('0x4f')]+'`\x20=\x200');}else{_0x4ac443['having']('`'+_0x2a73e2['field']+'`\x20>\x200');}break;case'Contact':if(_0x2a73e2[_0x7459('0x6a')]===_0x7459('0x6b')){if(_0x2a73e2[_0x7459('0x68')][_0x7459('0x31')]('\x20')[_0x7459('0x47')]>0x1){_0x242f6d[_0x5dedcf]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x2a73e2[_0x7459('0x68')]),null);}else{var _0x128637='%'+_0x2a73e2[_0x7459('0x68')]+'%';_0x242f6d[_0x5dedcf](_0x7459('0x6c'),_0x128637,_0x128637,_0x128637);}}else{_0x52cbf4=_[_0x7459('0x67')](_0x906f7,[_0x7459('0x2a'),_0x7459('0x6d')]);_0x2a73e2[_0x7459('0x4f')]=_0x7459('0x6d');_0x2df3b6=as[_0x7459('0x6e')](_0x239861,_0x52cbf4['type'],_0x2a73e2);_0x242f6d[_0x5dedcf](_0x2df3b6['text'],_0x2df3b6[_0x7459('0x68')][_0x7459('0x6f')],_0x2df3b6['value'][_0x7459('0x28')]);}break;case _0x7459('0x70'):var _0x4497f5=_0x2a73e2[_0x7459('0x68')][_0x7459('0x31')](',')[_0x7459('0x2d')](function(_0x1fe1e3){return Number(_0x1fe1e3);});_0x4497f5[_0x7459('0x32')](function(_0x17cda8){_0x34f95f['or'](_0x7459('0x71'),'%,'+_0x17cda8+',%');});_0x113762=_[_0x7459('0x72')](_0x113762,_0x4497f5);break;case _0x7459('0x73'):if(_0x2a73e2['operator']==='$substring'){_0x242f6d[_0x5dedcf](_0x7459('0x74'),'%'+_0x2a73e2[_0x7459('0x68')]+'%',null);}else{_0x52cbf4=_[_0x7459('0x67')](_0x906f7,['name',_0x7459('0x3a')]);_0x2a73e2['field']=_0x7459('0x3a');_0x2df3b6=as['buildExpression'](_0x239861,_0x52cbf4[_0x7459('0x3f')],_0x2a73e2);_0x242f6d[_0x5dedcf](_0x2df3b6['text'],_0x2df3b6[_0x7459('0x68')][_0x7459('0x6f')],_0x2df3b6[_0x7459('0x68')][_0x7459('0x28')]);}break;case _0x7459('0x75'):_0x2df3b6=as['buildExpression']('me',null,_0x2a73e2);_0x242f6d[_0x5dedcf](_0x2df3b6[_0x7459('0x76')],_0x2df3b6[_0x7459('0x68')][_0x7459('0x6f')],_0x2df3b6[_0x7459('0x68')]['end']);break;}}else{var _0x2df3b6=as[_0x7459('0x6e')](_0x239861,_0x52cbf4[_0x7459('0x3f')],_0x2a73e2);_0x242f6d[_0x5dedcf](_0x2df3b6[_0x7459('0x76')],_0x2df3b6['value'][_0x7459('0x6f')],_0x2df3b6['value']['end']);}}}else{var _0x4b1331=_(_0x432a33['query'])['keys']()[_0x7459('0x2d')](function(_0x258b64){return _[_0x7459('0x77')](_0x906f7,[_0x7459('0x2a'),_0x258b64])?_0x258b64:undefined;})[_0x7459('0x78')]()[_0x7459('0x68')]();if(!_['isEmpty'](_0x4b1331)){_0x4b1331[_0x7459('0x32')](function(_0x2f1894){if(_0x2f1894==='FaxAccountId'){_0x4ac443[_0x7459('0x4c')](_0x7459('0x79'),[]['concat'](_0x432a33[_0x7459('0x42')][_0x2f1894]));}else if(_0x2f1894===_0x7459('0x7a')){var _0x509cc9=JSON['parse'](_0x432a33[_0x7459('0x42')][_0x2f1894])[_0x7459('0x7b')];var _0x4b6606=JSON[_0x7459('0x7c')](_0x432a33[_0x7459('0x42')][_0x2f1894])[_0x7459('0x7d')];_0x4ac443['where'](_0x7459('0x7e'),_0x509cc9,_0x4b6606);}else{if(_0x432a33[_0x7459('0x42')][_0x2f1894]===_0x7459('0x7f')){_0x4ac443[_0x7459('0x4c')]('i.'+_0x2f1894+_0x7459('0x80'));}else{_0x4ac443[_0x7459('0x4c')]('i.'+_0x2f1894+_0x7459('0x81'),_0x432a33[_0x7459('0x42')][_0x2f1894]);}}});}if(_0x432a33[_0x7459('0x42')]['read']){if(_0x432a33[_0x7459('0x42')]['read']==0x1){_0x4ac443[_0x7459('0x69')](_0x7459('0x82'));}else{_0x4ac443[_0x7459('0x69')](_0x7459('0x83'));}}if(_0x432a33['query'][_0x7459('0x84')]){_0x113762=_[_0x7459('0x85')](_0x432a33['query']['tag'])?_0x432a33[_0x7459('0x42')][_0x7459('0x84')]:new Array(_0x432a33['query'][_0x7459('0x84')]);_0x113762[_0x7459('0x32')](function(_0x437492){_0x34f95f['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x437492+',%');});}if(_0x432a33[_0x7459('0x42')][_0x7459('0x86')]){var _0x4fe993=_0x432a33[_0x7459('0x42')]['filter'][_0x7459('0x87')]('\x5c','\x5c\x5c')[_0x7459('0x87')](/'/g,'\x27\x27');if(qs[_0x7459('0x88')](_0x4fe993)){_0x242f6d['or'](_0x7459('0x89'),_0x4fe993+'%')['or'](_0x7459('0x8a'),_0x4fe993+'%');}_0x242f6d['or'](_0x7459('0x8b'),_0x4fe993+'%');}}_0x4ac443[_0x7459('0x4c')](_0x242f6d);_0x4ac443[_0x7459('0x8c')](_0x7459('0x8d'));var _0x148abf={'type':db[_0x7459('0x8e')]['QueryTypes']['SELECT'],'raw':!![]};var _0x241e32=_0x4ac443[_0x7459('0x8f')]();_0x241e32[_0x7459('0x4f')](_0x7459('0x8d'));_0x241e32[_0x7459('0x4f')](_0x7459('0x90'),_0x7459('0x91'));if(_0x493642[_0x7459('0x4a')]){_0x493642['order']['forEach'](function(_0x52a03c){var _0x50f77c=_0x52a03c[0x0]===_0x7459('0x92')?_0x52a03c[0x0]:'i.'+_0x52a03c[0x0];_0x4ac443[_0x7459('0x4a')](_0x50f77c,_0x52a03c[0x1]==='DESC'?![]:!![]);});}if(!_[_0x7459('0x93')](_0x113762)){_0x4ac443[_0x7459('0x69')](_0x34f95f);_0x241e32[_0x7459('0x4c')](_0x7459('0x94'),_0x113762);}BPromise[_0x7459('0x95')]()[_0x7459('0x27')](function(){if(!_0x171b2b){if(_0x432a33[_0x7459('0x42')]['FaxAccountId'])return;_0x241e32[_0x7459('0x4c')](_0x7459('0x96'));_0x4ac443[_0x7459('0x4c')](_0x7459('0x96'));return;}if(_0x432a33[_0x7459('0x97')]['role']!==_0x7459('0x98'))return;return _0x432a33['user']['getFaxAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x5e0f94){if(_[_0x7459('0x93')](_0x5e0f94)){_0x241e32[_0x7459('0x4c')](_0x7459('0x99'));_0x4ac443['where']('i.FaxAccountId\x20IS\x20NULL');}else{_0x241e32[_0x7459('0x4c')](_0x7459('0x79'),_[_0x7459('0x2d')](_0x5e0f94,'id'));_0x4ac443[_0x7459('0x4c')]('i.FaxAccountId\x20IN\x20?',_[_0x7459('0x2d')](_0x5e0f94,'id'));}});})[_0x7459('0x27')](function(){if(_0x432a33[_0x7459('0x97')]['role']===_0x7459('0x98')&&!_0x171b2b&&!_0x432a33[_0x7459('0x42')]['FaxAccountId'])return[];return db[_0x7459('0x9a')][_0x7459('0x42')](_0x241e32[_0x7459('0x9b')](),_0x148abf);})[_0x7459('0x27')](function(_0x43ff4f){_0x30b42f[_0x7459('0x22')]=_0x43ff4f[_0x7459('0x47')];if(_0x30b42f['count']===0x0)return[];return db['sequelize'][_0x7459('0x42')](_0x2672b5[_0x7459('0x9b')](),_0x148abf)[_0x7459('0x27')](function(_0x5d144d){_0x3813eb=_[_0x7459('0x9c')](_0x5d144d,'id');_0x148abf=_[_0x7459('0x9d')](_0x148abf,{'model':db[_0x7459('0x3c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x432a33[_0x7459('0x42')][_0x7459('0x46')]){_0x493642['attributes']['forEach'](function(_0x1c50f6){_0x4ac443['field']('i.'+_0x1c50f6);});}else{_0x4ac443[_0x7459('0x4f')](_0x7459('0x90'),_0x7459('0x91'));_0x4ac443['field']('a.key',_0x7459('0x9e'));_0x4ac443[_0x7459('0x4f')](_0x7459('0x9f'),_0x7459('0xa0'));_0x4ac443['field'](_0x7459('0xa1'),_0x7459('0x92'));_0x4ac443[_0x7459('0x4f')](_0x7459('0xa2'));_0x4ac443[_0x7459('0x4f')](_0x7459('0xa3'),_0x7459('0xa4'));_0x4ac443['field'](_0x7459('0xa5'),_0x7459('0xa6'));_0x4ac443[_0x7459('0x4f')]('c.email',_0x7459('0xa7'));_0x4ac443['field'](_0x7459('0xa8'),_0x7459('0xa9'));_0x4ac443[_0x7459('0x4f')](_0x7459('0xaa'),_0x7459('0xab'));_0x4ac443['field'](_0x7459('0xac'),_0x7459('0xad'));_0x4ac443[_0x7459('0x4f')](_0x7459('0xae'),_0x7459('0xaf'));_0x4ac443['field']('o.internal','Owner.internal');_0x4ac443[_0x7459('0x4f')](_0x7459('0xb0'),_0x7459('0x30'));}if(_0x493642['limit'])_0x4ac443['limit'](_0x493642[_0x7459('0x20')]);if(_0x493642[_0x7459('0x23')])_0x4ac443[_0x7459('0x23')](_0x493642['offset']);return db[_0x7459('0x9a')]['query'](_0x4ac443[_0x7459('0x9b')](),_0x148abf);})[_0x7459('0x27')](function(_0xc26a06){if(_0xc26a06[_0x7459('0x47')]>0x0)_0x16474a['where'](_0x7459('0xb1'),_[_0x7459('0x2d')](_0xc26a06,'id'));return db[_0x7459('0x9a')][_0x7459('0x42')](_0x16474a[_0x7459('0x9b')](),_0x148abf)[_0x7459('0x27')](function(_0x4301ad){var _0x48ab3=_['groupBy'](_0x4301ad,_0x7459('0xb2'));var _0x28da83=[];_0xc26a06[_0x7459('0x32')](function(_0x965e0e){_0x28da83[_0x7459('0xb3')](updateFaxInteraction(_0x965e0e,_0x3813eb,_0x48ab3));});return BPromise[_0x7459('0xb4')](_0x28da83);});});})[_0x7459('0x27')](function(_0x42a1f9){_0x30b42f['rows']=_0x42a1f9;return _0x30b42f;})[_0x7459('0x27')](respondWithFilteredResult(_0x3bd691,_0x493642))[_0x7459('0x33')](handleError(_0x3bd691,null));};exports['show']=function(_0x4b1857,_0x46954b){var _0x254773={'raw':![],'where':{'id':_0x4b1857['params']['id']}},_0x4793c1={};_0x4793c1[_0x7459('0x41')]=_['keys'](db[_0x7459('0x3c')][_0x7459('0x3d')]);_0x4793c1[_0x7459('0x42')]=_[_0x7459('0xb5')](_0x4b1857[_0x7459('0x42')]);_0x4793c1[_0x7459('0x43')]=_[_0x7459('0x44')](_0x4793c1[_0x7459('0x41')],_0x4793c1[_0x7459('0x42')]);_0x254773[_0x7459('0x45')]=_['intersection'](_0x4793c1['model'],qs['fields'](_0x4b1857['query'][_0x7459('0x46')]));_0x254773['attributes']=_0x254773['attributes'][_0x7459('0x47')]?_0x254773[_0x7459('0x45')]:_0x4793c1[_0x7459('0x41')];if(_0x4b1857['query'][_0x7459('0xb6')]){_0x254773[_0x7459('0xb7')]=[{'all':!![]}];}_0x254773=_['merge']({},_0x254773,_0x4b1857['options']);return db[_0x7459('0x3c')]['find'](_0x254773)[_0x7459('0x27')](handleEntityNotFound(_0x46954b,null))[_0x7459('0x27')](respondWithResult(_0x46954b,null))[_0x7459('0x33')](handleError(_0x46954b,null));};exports[_0x7459('0xb8')]=function(_0x17757f,_0x3ac312){return db['FaxInteraction']['create'](_0x17757f[_0x7459('0x75')],{})[_0x7459('0x27')](respondWithResult(_0x3ac312,0xc9))[_0x7459('0x33')](handleError(_0x3ac312,null));};exports[_0x7459('0xb9')]=function(_0xec3fa0,_0x45af5f){if(_0xec3fa0[_0x7459('0x75')]['id']){delete _0xec3fa0['body']['id'];}return db[_0x7459('0x3c')][_0x7459('0x67')]({'where':{'id':_0xec3fa0['params']['id']}})[_0x7459('0x27')](handleEntityNotFound(_0x45af5f,null))[_0x7459('0x27')](saveUpdates(_0xec3fa0[_0x7459('0x75')],null))['then'](respondWithResult(_0x45af5f,null))[_0x7459('0x33')](handleError(_0x45af5f,null));};exports['destroy']=function(_0x56d296,_0x59fbdd){return db[_0x7459('0x3c')]['find']({'where':{'id':_0x56d296[_0x7459('0xba')]['id']}})[_0x7459('0x27')](handleEntityNotFound(_0x59fbdd,null))['then'](removeEntity(_0x59fbdd,null))[_0x7459('0x33')](handleError(_0x59fbdd,null));};exports['describe']=function(_0x5d227a,_0x52a0b0){return db[_0x7459('0x3c')][_0x7459('0xbb')]()[_0x7459('0x27')](respondWithResult(_0x52a0b0,null))[_0x7459('0x33')](handleError(_0x52a0b0,null));};exports['addMessage']=function(_0x1db26f,_0x26259d,_0x23df68){return db['FaxMessage'][_0x7459('0x67')]({'where':{'id':_0x1db26f[_0x7459('0xba')]['id']}})[_0x7459('0x27')](handleEntityNotFound(_0x26259d,null))[_0x7459('0x27')](function(_0x63967f){if(_0x63967f){return _0x63967f[_0x7459('0xbc')](_0x1db26f[_0x7459('0x75')][_0x7459('0xbd')],_[_0x7459('0xbe')](_0x1db26f['body'],[_0x7459('0xbd'),'id'])||{});}})[_0x7459('0x27')](respondWithResult(_0x26259d,null))[_0x7459('0x33')](handleError(_0x26259d,null));};exports[_0x7459('0xbf')]=function(_0x178d32,_0x4c1167,_0x25a58e){var _0xd509b8={'raw':![],'where':{}};var _0x458e67={};var _0x3b381b={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x7459('0xc0')]({'where':{'id':_0x178d32[_0x7459('0xba')]['id']}})[_0x7459('0x27')](handleEntityNotFound(_0x4c1167,null))[_0x7459('0x27')](function(_0x5a7c55){if(_0x5a7c55){_0x458e67[_0x7459('0x41')]=_[_0x7459('0xb5')](db[_0x7459('0xc1')][_0x7459('0x3d')]);_0x458e67['query']=_['keys'](_0x178d32[_0x7459('0x42')]);_0x458e67['filters']=_['intersection'](_0x458e67[_0x7459('0x41')],_0x458e67[_0x7459('0x42')]);_0xd509b8['attributes']=_[_0x7459('0x44')](_0x458e67[_0x7459('0x41')],qs['fields'](_0x178d32[_0x7459('0x42')]['fields']));_0xd509b8[_0x7459('0x45')]=_0xd509b8[_0x7459('0x45')][_0x7459('0x47')]?_0xd509b8[_0x7459('0x45')]:_0x458e67['model'];if(!_0x178d32[_0x7459('0x42')][_0x7459('0x48')]('nolimit')){_0xd509b8[_0x7459('0x20')]=qs[_0x7459('0x20')](_0x178d32[_0x7459('0x42')]['limit']);_0xd509b8[_0x7459('0x23')]=qs[_0x7459('0x23')](_0x178d32[_0x7459('0x42')][_0x7459('0x23')]);}_0xd509b8['order']=qs[_0x7459('0x4b')](_0x178d32['query']['sort']);_0xd509b8['where']=qs[_0x7459('0x43')](_[_0x7459('0x4d')](_0x178d32['query'],_0x458e67[_0x7459('0x43')]));_0xd509b8[_0x7459('0x4c')][_0x7459('0xb2')]=_0x5a7c55['id'];if(_0x178d32[_0x7459('0x42')][_0x7459('0x86')]){_0xd509b8[_0x7459('0x4c')]=_[_0x7459('0x9d')](_0xd509b8[_0x7459('0x4c')],{'$or':_[_0x7459('0x2d')](_0xd509b8['attributes'],function(_0x459dc2){var _0x5b119b={};_0x5b119b[_0x459dc2]={'$like':'%'+_0x178d32[_0x7459('0x42')]['filter']+'%'};return _0x5b119b;})});}if(_0x178d32['query'][_0x7459('0x7b')]){var _0x16c92a=_0x178d32[_0x7459('0x42')]['$gte']['split'](',');var _0x243477={};_0x243477[_0x16c92a[0x0]]={'$gte':moment(_0x16c92a[0x1])[_0x7459('0xc2')](_0x7459('0xc3'))};_0xd509b8['where']=_[_0x7459('0x9d')](_0xd509b8[_0x7459('0x4c')],_0x243477);}_0xd509b8=_[_0x7459('0x9d')]({},_0xd509b8,_0x178d32[_0x7459('0xc4')]);return db[_0x7459('0xc1')]['count']({'where':_0xd509b8[_0x7459('0x4c')]})[_0x7459('0x27')](function(_0x2c37ae){_0x3b381b[_0x7459('0x22')]=_0x2c37ae;if(_0x178d32['query'][_0x7459('0xb6')]){_0xd509b8[_0x7459('0xb7')]=[{'all':!![]}];}return db[_0x7459('0xc1')]['findAll'](_0xd509b8);})['then'](function(_0x34981b){_0x3b381b[_0x7459('0xc5')]=_0x34981b;return _0x3b381b;});}})[_0x7459('0x27')](respondWithFilteredResult(_0x4c1167,_0xd509b8))[_0x7459('0x33')](handleError(_0x4c1167,null));};exports[_0x7459('0xc6')]=function(_0x260955,_0x56b7b7,_0x1863e1){return db[_0x7459('0x3c')][_0x7459('0x67')]({'where':{'id':_0x260955[_0x7459('0xba')]['id']}})[_0x7459('0x27')](handleEntityNotFound(_0x56b7b7,null))[_0x7459('0x27')](function(_0x5370d8){if(_0x5370d8){return _0x5370d8[_0x7459('0xc7')](_0x260955[_0x7459('0x75')]['ids'],_[_0x7459('0xbe')](_0x260955[_0x7459('0x75')],[_0x7459('0xbd'),'id'])||{})[_0x7459('0xc8')](function(){return db[_0x7459('0x70')][_0x7459('0xc9')]({'attributes':['id','name',_0x7459('0xca')],'where':{'id':_0x260955['body'][_0x7459('0xbd')]}});})['then'](function(_0x1fb489){socket[_0x7459('0xcb')](_0x7459('0xcc'),{'id':Number(_0x260955[_0x7459('0xba')]['id']),'tags':_0x1fb489||[]});return{'id':Number(_0x260955[_0x7459('0xba')]['id']),'tags':_0x1fb489||[]};});}})[_0x7459('0x27')](respondWithResult(_0x56b7b7,null))[_0x7459('0x33')](handleError(_0x56b7b7,null));};exports['removeTags']=function(_0x3246c4,_0x2b9682,_0x127bb7){return db['FaxInteraction'][_0x7459('0x67')]({'where':{'id':_0x3246c4['params']['id']}})[_0x7459('0x27')](handleEntityNotFound(_0x2b9682,null))[_0x7459('0x27')](function(_0xd1b1d){if(_0xd1b1d){return _0xd1b1d[_0x7459('0xcd')](_0x3246c4[_0x7459('0x42')][_0x7459('0xbd')]);}})[_0x7459('0x27')](respondWithStatusCode(_0x2b9682,null))[_0x7459('0x33')](handleError(_0x2b9682,null));};exports[_0x7459('0xce')]=function(_0x2c80d2,_0x11bb38){var _0x54271d=moment()[_0x7459('0xcf')]()[_0x7459('0x9b')]();var _0x3fe937=path[_0x7459('0xd0')](config['root'],'server',_0x7459('0xd1'),_0x7459('0xd2'));var _0x5da756=path[_0x7459('0xd0')](config[_0x7459('0xd3')],_0x7459('0xd4'),'files','attachments');var _0x46c000=path[_0x7459('0xd0')](_0x3fe937,_0x54271d);var _0x22b8f9=util['format'](_0x7459('0xd5'),_0x2c80d2[_0x7459('0xba')]['id'],_0x54271d);var _0x35299d=path[_0x7459('0xd0')](_0x3fe937,_0x22b8f9);var _0x51059e=[];_0x51059e[_0x7459('0xb3')]({'model':db[_0x7459('0xd6')],'as':_0x7459('0xd6'),'raw':!![]});var _0x3660a7=[{'model':db['FaxMessage'],'as':'Messages','attributes':['id',_0x7459('0x75'),_0x7459('0x7a')],'include':_0x51059e}];return db[_0x7459('0x3c')][_0x7459('0x67')]({'where':{'id':_0x2c80d2[_0x7459('0xba')]['id']},'include':_0x3660a7})['then'](handleEntityNotFound(_0x11bb38,null))[_0x7459('0x27')](function(_0x5077d4){if(_0x5077d4&&_0x5077d4[_0x7459('0xd7')]){var _0x36914e=_0x5077d4['get']({'plain':!![]});fs[_0x7459('0xd8')](_0x46c000);for(var _0x2530e0=0x0;_0x2530e0<_0x36914e[_0x7459('0xd7')][_0x7459('0x47')];_0x2530e0++){var _0x1f7c7e=_0x36914e[_0x7459('0xd7')][_0x2530e0][_0x7459('0xd6')];if(_0x1f7c7e){var _0x5d4518=path[_0x7459('0xd0')](_0x5da756,_0x1f7c7e[_0x7459('0xd9')]);if(fs['existsSync'](_0x5d4518)){fs['createReadStream'](_0x5d4518)[_0x7459('0xda')](fs[_0x7459('0xdb')](path[_0x7459('0xd0')](_0x46c000,_0x1f7c7e[_0x7459('0xd9')])));}}}return BPromise[_0x7459('0x95')]()['then'](function(){return new BPromise(function(_0x5ed520,_0x133d2d){zipdir(_0x46c000,{'saveTo':_0x35299d},function(_0x33e938,_0x248bb2){if(_0x33e938)return _0x133d2d(_0x33e938);return _0x5ed520(_0x248bb2);});})[_0x7459('0x27')](function(){return new BPromise(function(_0x171be3,_0x7008cc){rimraf(_0x46c000,function(_0x33f4ee){if(_0x33f4ee)_0x7008cc(_0x33f4ee);return _0x171be3();});});})[_0x7459('0x27')](function(){return _0x11bb38[_0x7459('0xce')](_0x35299d,_0x22b8f9,function(_0x4992cc){if(_0x4992cc){console['log'](_0x7459('0xdc'),_0x4992cc);}else{fs[_0x7459('0xdd')](_0x35299d);}});});});}else{return _0x11bb38['sendStatus'](0xc8);}})['catch'](handleError(_0x11bb38,null));}; \ No newline at end of file +var _0x229d=['i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','FaxInteraction','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','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','rows','show','keys','includeAll','include','options','create','params','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','pick','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','findAll','emit','removeTags','download','join','root','server','files','attachments','transcript-%d-%s.zip','Messages','get','mkdirSync','Attachment','basename','existsSync','createReadStream','pipe','log','err','unlinkSync','eml-format','rimraf','zip-dir','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','./faxInteraction.socket','register','sendStatus','end','status','json','limit','count','offset','Content-Range','apply','reject','update','destroy','then','error','name','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','waiting','answered','unmanaged','closed','UserId','talking','total','index','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','field','color','from','u.id','ui.FaxInteractionId','left_join','users','select','fax_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','body','some','compact','FaxAccountId','where','i.FaxAccountId\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','isNumeric','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','resolve'];(function(_0x19be86,_0x1d382d){var _0x3bc07b=function(_0x3fdfe3){while(--_0x3fdfe3){_0x19be86['push'](_0x19be86['shift']());}};_0x3bc07b(++_0x1d382d);}(_0x229d,0x12a));var _0xd229=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x229d[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0xd229('0x0'));var rimraf=require(_0xd229('0x1'));var zipdir=require(_0xd229('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd229('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd229('0x4'));var util=require(_0xd229('0x5'));var path=require('path');var sox=require(_0xd229('0x6'));var csv=require(_0xd229('0x7'));var ejs=require(_0xd229('0x8'));var fs=require('fs');var fs_extra=require(_0xd229('0x9'));var _=require(_0xd229('0xa'));var squel=require(_0xd229('0xb'));var crypto=require(_0xd229('0xc'));var jsforce=require(_0xd229('0xd'));var deskjs=require(_0xd229('0xe'));var toCsv=require(_0xd229('0x7'));var querystring=require(_0xd229('0xf'));var Papa=require(_0xd229('0x10'));var Redis=require(_0xd229('0x11'));var authService=require(_0xd229('0x12'));var qs=require(_0xd229('0x13'));var as=require(_0xd229('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd229('0x15'));var utils=require(_0xd229('0x16'));var config=require(_0xd229('0x17'));var licenseUtil=require(_0xd229('0x18'));var db=require('../../mysqldb')['db'];config[_0xd229('0x19')]=_[_0xd229('0x1a')](config[_0xd229('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd229('0x19')]));require(_0xd229('0x1b'))[_0xd229('0x1c')](socket);function respondWithStatusCode(_0x5e6622,_0x249a59){_0x249a59=_0x249a59||0xcc;return function(_0x1020d9){if(_0x1020d9){return _0x5e6622[_0xd229('0x1d')](_0x249a59);}return _0x5e6622['status'](_0x249a59)[_0xd229('0x1e')]();};}function respondWithResult(_0x319376,_0x3e84ae){_0x3e84ae=_0x3e84ae||0xc8;return function(_0x180188){if(_0x180188){return _0x319376[_0xd229('0x1f')](_0x3e84ae)[_0xd229('0x20')](_0x180188);}};}function respondWithFilteredResult(_0x2643a1,_0xde7070){return function(_0x47f493){if(_0x47f493){var _0x319a25=typeof _0xde7070['offset']==='undefined'&&typeof _0xde7070[_0xd229('0x21')]==='undefined';var _0xb1fbb6=_0x47f493[_0xd229('0x22')];var _0x37a3f1=_0x319a25?0x0:_0xde7070['offset'];var _0xb7d537=_0x319a25?_0x47f493[_0xd229('0x22')]:_0xde7070[_0xd229('0x23')]+_0xde7070['limit'];var _0x20d0ae;if(_0xb7d537>=_0xb1fbb6){_0xb7d537=_0xb1fbb6;_0x20d0ae=0xc8;}else{_0x20d0ae=0xce;}_0x2643a1[_0xd229('0x1f')](_0x20d0ae);return _0x2643a1['set'](_0xd229('0x24'),_0x37a3f1+'-'+_0xb7d537+'/'+_0xb1fbb6)[_0xd229('0x20')](_0x47f493);}return null;};}function patchUpdates(_0x10a932){return function(_0x409baf){try{jsonpatch[_0xd229('0x25')](_0x409baf,_0x10a932,!![]);}catch(_0x34ce3d){return BPromise[_0xd229('0x26')](_0x34ce3d);}return _0x409baf['save']();};}function saveUpdates(_0x48c49e,_0x2b1e78){return function(_0x29a97e){if(_0x29a97e){return _0x29a97e[_0xd229('0x27')](_0x48c49e)['then'](function(_0x51335a){return _0x51335a;});}return null;};}function removeEntity(_0x5a5172,_0x1ae5c9){return function(_0xf81a7b){if(_0xf81a7b){return _0xf81a7b[_0xd229('0x28')]()[_0xd229('0x29')](function(){_0x5a5172[_0xd229('0x1f')](0xcc)[_0xd229('0x1e')]();});}};}function handleEntityNotFound(_0x273686,_0x5724c7){return function(_0x1d5989){if(!_0x1d5989){_0x273686[_0xd229('0x1d')](0x194);}return _0x1d5989;};}function handleError(_0x7ac9f1,_0x3f2317){_0x3f2317=_0x3f2317||0x1f4;return function(_0x1ccca8){logger[_0xd229('0x2a')](_0x1ccca8['stack']);if(_0x1ccca8['name']){delete _0x1ccca8[_0xd229('0x2b')];}_0x7ac9f1['status'](_0x3f2317)['send'](_0x1ccca8);};}function getInteractionUsers(_0x102a9c,_0x513d80){return new BPromise(function(_0xc61801,_0x3a3148){try{if(_0x513d80[_0x102a9c['id']]){_0x102a9c[_0xd229('0x2c')]=_[_0xd229('0x2d')](_0x513d80[_0x102a9c['id']],function(_0x166e3d){return{'id':_0x166e3d['id'],'fullname':_0x166e3d[_0xd229('0x2e')]};});}}catch(_0x344db7){_0x3a3148(_0x344db7);}_0xc61801(_0x102a9c);});}function getInteractionTags(_0x14f948,_0x3f5bee){return new BPromise(function(_0x17025f,_0xa9994b){try{if(_0x14f948[_0xd229('0x2f')]){_0x14f948[_0xd229('0x30')]=[];_0x14f948[_0xd229('0x2f')][_0xd229('0x31')](',')[_0xd229('0x32')](function(_0xc46d0b){_0x14f948['Tags'][_0xd229('0x33')](_0x3f5bee[_0xc46d0b]);});}delete _0x14f948[_0xd229('0x2f')];}catch(_0x21cad9){_0xa9994b(_0x21cad9);}_0x17025f(_0x14f948);});}function updateFaxInteraction(_0x471a28,_0x394cc3,_0x3432f4){return new BPromise(function(_0x572fb7,_0x51013a){return getInteractionUsers(_0x471a28,_0x3432f4)[_0xd229('0x29')](function(_0x40d30c){return getInteractionTags(_0x40d30c,_0x394cc3);})['then'](function(_0x38e118){return getStateInteraction(_0x38e118);})['then'](function(_0x13d1a4){_0x572fb7(_0x13d1a4);})[_0xd229('0x34')](function(_0x2e08a0){_0x51013a(_0x2e08a0);});});}function getStateInteraction(_0x26b8b4){return new BPromise(function(_0x1813f0){_0x26b8b4[_0xd229('0x35')]=0x0;_0x26b8b4['talking']=0x0;_0x26b8b4[_0xd229('0x36')]=0x0;_0x26b8b4[_0xd229('0x37')]=0x0;_0x26b8b4['total']=0x0;if(!_0x26b8b4[_0xd229('0x38')]&&!_0x26b8b4[_0xd229('0x39')]){_0x26b8b4[_0xd229('0x35')]+=0x1;}if(!_0x26b8b4['closed']&&_0x26b8b4[_0xd229('0x39')]){_0x26b8b4['talking']+=0x1;if(_0x26b8b4[_0xd229('0x35')]){_0x26b8b4[_0xd229('0x35')]-=0x1;}}if(_0x26b8b4[_0xd229('0x38')]&&_0x26b8b4[_0xd229('0x39')]){_0x26b8b4[_0xd229('0x36')]+=0x1;if(_0x26b8b4['talking']){_0x26b8b4[_0xd229('0x3a')]-=0x1;}}if(_0x26b8b4[_0xd229('0x38')]&&!_0x26b8b4['UserId']){_0x26b8b4[_0xd229('0x37')]+=0x1;if(_0x26b8b4[_0xd229('0x35')]){_0x26b8b4[_0xd229('0x35')]-=0x1;}}_0x26b8b4[_0xd229('0x3b')]+=0x1;_0x1813f0(_0x26b8b4);});}exports[_0xd229('0x3c')]=function(_0x169d8a,_0x4fcbfa){var _0x2c63a6={},_0x44ac63={},_0x394ab2={'count':0x0,'rows':[]};var _0x461298=_[_0xd229('0x2d')](db['FaxInteraction'][_0xd229('0x3d')],function(_0x250c3c){return{'name':_0x250c3c[_0xd229('0x3e')],'type':_0x250c3c[_0xd229('0x3f')][_0xd229('0x40')]};});_0x44ac63['model']=_[_0xd229('0x2d')](_0x461298,'name');_0x44ac63[_0xd229('0x41')]=_['keys'](_0x169d8a[_0xd229('0x41')]);_0x44ac63[_0xd229('0x42')]=_[_0xd229('0x43')](_0x44ac63['model'],_0x44ac63[_0xd229('0x41')]);_0x2c63a6[_0xd229('0x44')]=_[_0xd229('0x43')](_0x44ac63[_0xd229('0x45')],qs['fields'](_0x169d8a[_0xd229('0x41')][_0xd229('0x46')]));_0x2c63a6[_0xd229('0x44')]=_0x2c63a6[_0xd229('0x44')][_0xd229('0x47')]?_0x2c63a6[_0xd229('0x44')]:_0x44ac63[_0xd229('0x45')];if(!_0x169d8a[_0xd229('0x41')][_0xd229('0x48')](_0xd229('0x49'))){_0x2c63a6[_0xd229('0x21')]=qs[_0xd229('0x21')](_0x169d8a[_0xd229('0x41')][_0xd229('0x21')]);_0x2c63a6[_0xd229('0x23')]=qs[_0xd229('0x23')](_0x169d8a['query'][_0xd229('0x23')]);}_0x2c63a6[_0xd229('0x4a')]=qs[_0xd229('0x4b')](_0x169d8a[_0xd229('0x41')][_0xd229('0x4b')]);_0x2c63a6['where']=qs[_0xd229('0x42')](_['pick'](_0x169d8a[_0xd229('0x41')],_0x44ac63[_0xd229('0x42')]),_0x461298);var _0x2d9076=[];var _0x138cc3=squel['select']()[_0xd229('0x4c')]('id')[_0xd229('0x4c')]('name')['field'](_0xd229('0x4d'))[_0xd229('0x4e')]('tools_tags');var _0x5b8942=squel['select']()[_0xd229('0x4c')](_0xd229('0x4f'))[_0xd229('0x4c')]('u.fullname')[_0xd229('0x4c')](_0xd229('0x50'))[_0xd229('0x4e')]('user_has_fax_interactions','ui')[_0xd229('0x51')](_0xd229('0x52'),'u','u.id\x20=\x20ui.UserId');var _0x5e4aa8=squel[_0xd229('0x53')]()[_0xd229('0x4e')](_0xd229('0x54'),'i')['left_join']('cm_contacts','c',_0xd229('0x55'))[_0xd229('0x51')](_0xd229('0x52'),'o',_0xd229('0x56'))[_0xd229('0x51')](_0xd229('0x57'),'a',_0xd229('0x58'))[_0xd229('0x51')]('fax_messages','me','me.FaxInteractionId\x20=\x20i.id')['left_join'](_0xd229('0x59'),'it',_0xd229('0x5a'))[_0xd229('0x51')](_0xd229('0x5b'),'t',_0xd229('0x5c'));var _0x55d4e6=squel[_0xd229('0x5d')]();var _0x44f526=[];var _0x5f30ee=squel['expr']();var _0x2dc4d4;if(_0x169d8a[_0xd229('0x41')][_0xd229('0x5e')]){_0x2dc4d4=as[_0xd229('0x5f')](_0x169d8a[_0xd229('0x41')]['search']);var _0x41dd31=_0x2dc4d4[_0xd229('0x60')];for(var _0x4cb92c=0x0;_0x4cb92c<_0x2dc4d4[_0xd229('0x61')][_0xd229('0x47')];_0x4cb92c++){var _0x8f9061=_0x2dc4d4[_0xd229('0x61')][_0x4cb92c];var _0x58cbfe='i';var _0x51c6ba=_[_0xd229('0x62')](_0x461298,['name',_0x8f9061['field']]);if(!_0x51c6ba){switch(_0x8f9061[_0xd229('0x4c')]){case'unreadMessages':if(_0x8f9061[_0xd229('0x63')]==0x1){_0x5e4aa8[_0xd229('0x64')]('`'+_0x8f9061[_0xd229('0x4c')]+_0xd229('0x65'));}else{_0x5e4aa8['having']('`'+_0x8f9061['field']+_0xd229('0x66'));}break;case _0xd229('0x67'):if(_0x8f9061['operator']==='$substring'){if(_0x8f9061[_0xd229('0x63')][_0xd229('0x31')]('\x20')[_0xd229('0x47')]>0x1){_0x55d4e6[_0x41dd31](_0xd229('0x68'),qs['getFullTextValue'](_0x8f9061[_0xd229('0x63')]),null);}else{var _0x4bd690='%'+_0x8f9061[_0xd229('0x63')]+'%';_0x55d4e6[_0x41dd31](_0xd229('0x69'),_0x4bd690,_0x4bd690,_0x4bd690);}}else{_0x51c6ba=_['find'](_0x461298,[_0xd229('0x2b'),'ContactId']);_0x8f9061[_0xd229('0x4c')]=_0xd229('0x6a');_0x3985a1=as[_0xd229('0x6b')](_0x58cbfe,_0x51c6ba[_0xd229('0x3f')],_0x8f9061);_0x55d4e6[_0x41dd31](_0x3985a1[_0xd229('0x6c')],_0x3985a1[_0xd229('0x63')]['start'],_0x3985a1[_0xd229('0x63')][_0xd229('0x1e')]);}break;case _0xd229('0x6d'):var _0x3570d8=_0x8f9061[_0xd229('0x63')][_0xd229('0x31')](',')['map'](function(_0x35c598){return Number(_0x35c598);});_0x3570d8[_0xd229('0x32')](function(_0x30202c){_0x5f30ee['or'](_0xd229('0x6e'),'%,'+_0x30202c+',%');});_0x44f526=_[_0xd229('0x6f')](_0x44f526,_0x3570d8);break;case _0xd229('0x70'):if(_0x8f9061[_0xd229('0x71')]===_0xd229('0x72')){_0x55d4e6[_0x41dd31](_0xd229('0x73'),'%'+_0x8f9061[_0xd229('0x63')]+'%',null);}else{_0x51c6ba=_['find'](_0x461298,[_0xd229('0x2b'),_0xd229('0x39')]);_0x8f9061['field']=_0xd229('0x39');_0x3985a1=as[_0xd229('0x6b')](_0x58cbfe,_0x51c6ba['type'],_0x8f9061);_0x55d4e6[_0x41dd31](_0x3985a1[_0xd229('0x6c')],_0x3985a1[_0xd229('0x63')][_0xd229('0x74')],_0x3985a1[_0xd229('0x63')][_0xd229('0x1e')]);}break;case _0xd229('0x75'):_0x3985a1=as[_0xd229('0x6b')]('me',null,_0x8f9061);_0x55d4e6[_0x41dd31](_0x3985a1[_0xd229('0x6c')],_0x3985a1[_0xd229('0x63')][_0xd229('0x74')],_0x3985a1[_0xd229('0x63')]['end']);break;}}else{var _0x3985a1=as[_0xd229('0x6b')](_0x58cbfe,_0x51c6ba[_0xd229('0x3f')],_0x8f9061);_0x55d4e6[_0x41dd31](_0x3985a1[_0xd229('0x6c')],_0x3985a1[_0xd229('0x63')][_0xd229('0x74')],_0x3985a1['value'][_0xd229('0x1e')]);}}}else{var _0x4312a2=_(_0x169d8a[_0xd229('0x41')])['keys']()[_0xd229('0x2d')](function(_0x314420){return _[_0xd229('0x76')](_0x461298,['name',_0x314420])?_0x314420:undefined;})[_0xd229('0x77')]()[_0xd229('0x63')]();if(!_['isEmpty'](_0x4312a2)){_0x4312a2[_0xd229('0x32')](function(_0x184ef6){if(_0x184ef6===_0xd229('0x78')){_0x5e4aa8[_0xd229('0x79')](_0xd229('0x7a'),[][_0xd229('0x7b')](_0x169d8a['query'][_0x184ef6]));}else if(_0x184ef6===_0xd229('0x7c')){var _0x21eb6d=JSON[_0xd229('0x7d')](_0x169d8a[_0xd229('0x41')][_0x184ef6])[_0xd229('0x7e')];var _0x2abe25=JSON[_0xd229('0x7d')](_0x169d8a[_0xd229('0x41')][_0x184ef6])[_0xd229('0x7f')];_0x5e4aa8[_0xd229('0x79')](_0xd229('0x80'),_0x21eb6d,_0x2abe25);}else{if(_0x169d8a['query'][_0x184ef6]===_0xd229('0x81')){_0x5e4aa8[_0xd229('0x79')]('i.'+_0x184ef6+_0xd229('0x82'));}else{_0x5e4aa8['where']('i.'+_0x184ef6+_0xd229('0x83'),_0x169d8a[_0xd229('0x41')][_0x184ef6]);}}});}if(_0x169d8a['query'][_0xd229('0x84')]){if(_0x169d8a[_0xd229('0x41')][_0xd229('0x84')]==0x1){_0x5e4aa8[_0xd229('0x64')](_0xd229('0x85'));}else{_0x5e4aa8[_0xd229('0x64')](_0xd229('0x86'));}}if(_0x169d8a[_0xd229('0x41')][_0xd229('0x87')]){_0x44f526=_[_0xd229('0x88')](_0x169d8a[_0xd229('0x41')][_0xd229('0x87')])?_0x169d8a[_0xd229('0x41')]['tag']:new Array(_0x169d8a[_0xd229('0x41')][_0xd229('0x87')]);_0x44f526[_0xd229('0x32')](function(_0x4a4747){_0x5f30ee['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4a4747+',%');});}if(_0x169d8a[_0xd229('0x41')][_0xd229('0x89')]){var _0x2f1989=_0x169d8a['query'][_0xd229('0x89')][_0xd229('0x8a')]('\x5c','\x5c\x5c')[_0xd229('0x8a')](/'/g,'\x27\x27');if(qs[_0xd229('0x8b')](_0x2f1989)){_0x55d4e6['or']('i.id\x20LIKE\x20?',_0x2f1989+'%')['or'](_0xd229('0x8c'),_0x2f1989+'%');}_0x55d4e6['or'](_0xd229('0x8d'),_0x2f1989+'%');}}_0x5e4aa8[_0xd229('0x79')](_0x55d4e6);_0x5e4aa8[_0xd229('0x8e')]('i.id');var _0x382857={'type':db['Sequelize'][_0xd229('0x8f')][_0xd229('0x90')],'raw':!![]};var _0x207368=_0x5e4aa8[_0xd229('0x91')]();_0x207368['field'](_0xd229('0x92'));_0x207368['field'](_0xd229('0x93'),'unreadMessages');if(_0x2c63a6[_0xd229('0x4a')]){_0x2c63a6[_0xd229('0x4a')]['forEach'](function(_0x48ab55){var _0x16e46e=_0x48ab55[0x0]==='contactName'?_0x48ab55[0x0]:'i.'+_0x48ab55[0x0];_0x5e4aa8[_0xd229('0x4a')](_0x16e46e,_0x48ab55[0x1]===_0xd229('0x94')?![]:!![]);});}if(!_['isEmpty'](_0x44f526)){_0x5e4aa8[_0xd229('0x64')](_0x5f30ee);_0x207368[_0xd229('0x79')]('t.id\x20IN\x20?',_0x44f526);}BPromise[_0xd229('0x95')]()[_0xd229('0x29')](function(){if(!_0x2dc4d4){if(_0x169d8a[_0xd229('0x41')][_0xd229('0x78')])return;_0x207368[_0xd229('0x79')](_0xd229('0x96'));_0x5e4aa8[_0xd229('0x79')](_0xd229('0x96'));return;}if(_0x169d8a[_0xd229('0x97')][_0xd229('0x98')]!==_0xd229('0x99'))return;return _0x169d8a[_0xd229('0x97')][_0xd229('0x9a')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2bab31){if(_['isEmpty'](_0x2bab31)){_0x207368[_0xd229('0x79')]('i.FaxAccountId\x20IS\x20NULL');_0x5e4aa8['where'](_0xd229('0x9b'));}else{_0x207368[_0xd229('0x79')](_0xd229('0x7a'),_[_0xd229('0x2d')](_0x2bab31,'id'));_0x5e4aa8[_0xd229('0x79')](_0xd229('0x7a'),_[_0xd229('0x2d')](_0x2bab31,'id'));}});})['then'](function(){if(_0x169d8a['user']['role']===_0xd229('0x99')&&!_0x2dc4d4&&!_0x169d8a[_0xd229('0x41')]['FaxAccountId'])return[];return db[_0xd229('0x9c')][_0xd229('0x41')](_0x207368[_0xd229('0x9d')](),_0x382857);})[_0xd229('0x29')](function(_0x586d5a){_0x394ab2[_0xd229('0x22')]=_0x586d5a['length'];if(_0x394ab2[_0xd229('0x22')]===0x0)return[];return db[_0xd229('0x9c')][_0xd229('0x41')](_0x138cc3['toString'](),_0x382857)[_0xd229('0x29')](function(_0x2884ef){_0x2d9076=_[_0xd229('0x9e')](_0x2884ef,'id');_0x382857=_[_0xd229('0x9f')](_0x382857,{'model':db[_0xd229('0xa0')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x169d8a[_0xd229('0x41')][_0xd229('0x46')]){_0x2c63a6['attributes'][_0xd229('0x32')](function(_0x347e1f){_0x5e4aa8[_0xd229('0x4c')]('i.'+_0x347e1f);});}else{_0x5e4aa8[_0xd229('0x4c')](_0xd229('0x93'),'unreadMessages');_0x5e4aa8[_0xd229('0x4c')]('a.key',_0xd229('0xa1'));_0x5e4aa8[_0xd229('0x4c')](_0xd229('0xa2'),_0xd229('0xa3'));_0x5e4aa8[_0xd229('0x4c')](_0xd229('0xa4'),_0xd229('0xa5'));_0x5e4aa8[_0xd229('0x4c')](_0xd229('0xa6'));_0x5e4aa8[_0xd229('0x4c')](_0xd229('0xa7'),_0xd229('0xa8'));_0x5e4aa8[_0xd229('0x4c')](_0xd229('0xa9'),_0xd229('0xaa'));_0x5e4aa8[_0xd229('0x4c')]('c.email',_0xd229('0xab'));_0x5e4aa8['field'](_0xd229('0xac'),'Contact.phone');_0x5e4aa8[_0xd229('0x4c')]('c.mobile',_0xd229('0xad'));_0x5e4aa8['field'](_0xd229('0xae'),_0xd229('0xaf'));_0x5e4aa8[_0xd229('0x4c')](_0xd229('0xb0'),_0xd229('0xb1'));_0x5e4aa8[_0xd229('0x4c')]('o.internal',_0xd229('0xb2'));_0x5e4aa8[_0xd229('0x4c')](_0xd229('0xb3'),_0xd229('0x2f'));}if(_0x2c63a6[_0xd229('0x21')])_0x5e4aa8[_0xd229('0x21')](_0x2c63a6[_0xd229('0x21')]);if(_0x2c63a6[_0xd229('0x23')])_0x5e4aa8[_0xd229('0x23')](_0x2c63a6[_0xd229('0x23')]);return db['sequelize'][_0xd229('0x41')](_0x5e4aa8[_0xd229('0x9d')](),_0x382857);})[_0xd229('0x29')](function(_0x2272f8){if(_0x2272f8[_0xd229('0x47')]>0x0)_0x5b8942[_0xd229('0x79')](_0xd229('0xb4'),_['map'](_0x2272f8,'id'));return db['sequelize'][_0xd229('0x41')](_0x5b8942['toString'](),_0x382857)[_0xd229('0x29')](function(_0xd87a76){var _0x25e1a6=_[_0xd229('0xb5')](_0xd87a76,_0xd229('0xb6'));var _0x5caec0=[];_0x2272f8['forEach'](function(_0x4cc1d7){_0x5caec0['push'](updateFaxInteraction(_0x4cc1d7,_0x2d9076,_0x25e1a6));});return BPromise['all'](_0x5caec0);});});})[_0xd229('0x29')](function(_0x5c4a2b){_0x394ab2[_0xd229('0xb7')]=_0x5c4a2b;return _0x394ab2;})[_0xd229('0x29')](respondWithFilteredResult(_0x4fcbfa,_0x2c63a6))[_0xd229('0x34')](handleError(_0x4fcbfa,null));};exports[_0xd229('0xb8')]=function(_0x2d1d7e,_0xb56d61){var _0x13d071={'raw':![],'where':{'id':_0x2d1d7e['params']['id']}},_0x1bc562={};_0x1bc562[_0xd229('0x45')]=_[_0xd229('0xb9')](db[_0xd229('0xa0')][_0xd229('0x3d')]);_0x1bc562[_0xd229('0x41')]=_[_0xd229('0xb9')](_0x2d1d7e['query']);_0x1bc562[_0xd229('0x42')]=_['intersection'](_0x1bc562['model'],_0x1bc562[_0xd229('0x41')]);_0x13d071['attributes']=_[_0xd229('0x43')](_0x1bc562[_0xd229('0x45')],qs[_0xd229('0x46')](_0x2d1d7e['query'][_0xd229('0x46')]));_0x13d071[_0xd229('0x44')]=_0x13d071[_0xd229('0x44')][_0xd229('0x47')]?_0x13d071[_0xd229('0x44')]:_0x1bc562['model'];if(_0x2d1d7e['query'][_0xd229('0xba')]){_0x13d071[_0xd229('0xbb')]=[{'all':!![]}];}_0x13d071=_[_0xd229('0x9f')]({},_0x13d071,_0x2d1d7e[_0xd229('0xbc')]);return db[_0xd229('0xa0')][_0xd229('0x62')](_0x13d071)[_0xd229('0x29')](handleEntityNotFound(_0xb56d61,null))[_0xd229('0x29')](respondWithResult(_0xb56d61,null))[_0xd229('0x34')](handleError(_0xb56d61,null));};exports[_0xd229('0xbd')]=function(_0x14b7a8,_0x59ef50){return db[_0xd229('0xa0')][_0xd229('0xbd')](_0x14b7a8[_0xd229('0x75')],{})[_0xd229('0x29')](respondWithResult(_0x59ef50,0xc9))[_0xd229('0x34')](handleError(_0x59ef50,null));};exports[_0xd229('0x27')]=function(_0x3cc6ad,_0x4c23e2){if(_0x3cc6ad[_0xd229('0x75')]['id']){delete _0x3cc6ad['body']['id'];}return db[_0xd229('0xa0')][_0xd229('0x62')]({'where':{'id':_0x3cc6ad[_0xd229('0xbe')]['id']}})['then'](handleEntityNotFound(_0x4c23e2,null))['then'](saveUpdates(_0x3cc6ad[_0xd229('0x75')],null))[_0xd229('0x29')](respondWithResult(_0x4c23e2,null))[_0xd229('0x34')](handleError(_0x4c23e2,null));};exports[_0xd229('0x28')]=function(_0x4d7d4e,_0x45056a){return db[_0xd229('0xa0')][_0xd229('0x62')]({'where':{'id':_0x4d7d4e[_0xd229('0xbe')]['id']}})['then'](handleEntityNotFound(_0x45056a,null))['then'](removeEntity(_0x45056a,null))[_0xd229('0x34')](handleError(_0x45056a,null));};exports[_0xd229('0xbf')]=function(_0x2bc7c7,_0x51ba07){return db[_0xd229('0xa0')][_0xd229('0xbf')]()[_0xd229('0x29')](respondWithResult(_0x51ba07,null))[_0xd229('0x34')](handleError(_0x51ba07,null));};exports[_0xd229('0xc0')]=function(_0x21a958,_0x5df7a8,_0x1be3bd){return db[_0xd229('0xc1')][_0xd229('0x62')]({'where':{'id':_0x21a958[_0xd229('0xbe')]['id']}})[_0xd229('0x29')](handleEntityNotFound(_0x5df7a8,null))[_0xd229('0x29')](function(_0x12502d){if(_0x12502d){return _0x12502d[_0xd229('0xc0')](_0x21a958[_0xd229('0x75')][_0xd229('0xc2')],_[_0xd229('0xc3')](_0x21a958[_0xd229('0x75')],[_0xd229('0xc2'),'id'])||{});}})[_0xd229('0x29')](respondWithResult(_0x5df7a8,null))['catch'](handleError(_0x5df7a8,null));};exports[_0xd229('0xc4')]=function(_0x28d29d,_0x4ae2bb,_0x1426a4){var _0x382435={'raw':![],'where':{}};var _0x4591f2={};var _0x50b4a3={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xd229('0xc5')]({'where':{'id':_0x28d29d[_0xd229('0xbe')]['id']}})[_0xd229('0x29')](handleEntityNotFound(_0x4ae2bb,null))[_0xd229('0x29')](function(_0x5c3ae8){if(_0x5c3ae8){_0x4591f2[_0xd229('0x45')]=_[_0xd229('0xb9')](db[_0xd229('0xc1')][_0xd229('0x3d')]);_0x4591f2[_0xd229('0x41')]=_[_0xd229('0xb9')](_0x28d29d[_0xd229('0x41')]);_0x4591f2[_0xd229('0x42')]=_['intersection'](_0x4591f2['model'],_0x4591f2['query']);_0x382435[_0xd229('0x44')]=_[_0xd229('0x43')](_0x4591f2[_0xd229('0x45')],qs[_0xd229('0x46')](_0x28d29d[_0xd229('0x41')][_0xd229('0x46')]));_0x382435['attributes']=_0x382435[_0xd229('0x44')][_0xd229('0x47')]?_0x382435[_0xd229('0x44')]:_0x4591f2['model'];if(!_0x28d29d[_0xd229('0x41')]['hasOwnProperty'](_0xd229('0x49'))){_0x382435['limit']=qs[_0xd229('0x21')](_0x28d29d['query'][_0xd229('0x21')]);_0x382435[_0xd229('0x23')]=qs['offset'](_0x28d29d[_0xd229('0x41')][_0xd229('0x23')]);}_0x382435[_0xd229('0x4a')]=qs[_0xd229('0x4b')](_0x28d29d[_0xd229('0x41')]['sort']);_0x382435[_0xd229('0x79')]=qs['filters'](_[_0xd229('0xc6')](_0x28d29d[_0xd229('0x41')],_0x4591f2[_0xd229('0x42')]));_0x382435[_0xd229('0x79')][_0xd229('0xb6')]=_0x5c3ae8['id'];if(_0x28d29d['query']['filter']){_0x382435['where']=_[_0xd229('0x9f')](_0x382435[_0xd229('0x79')],{'$or':_[_0xd229('0x2d')](_0x382435[_0xd229('0x44')],function(_0x5d6974){var _0x9f9127={};_0x9f9127[_0x5d6974]={'$like':'%'+_0x28d29d['query'][_0xd229('0x89')]+'%'};return _0x9f9127;})});}if(_0x28d29d[_0xd229('0x41')][_0xd229('0x7e')]){var _0x49fdf8=_0x28d29d[_0xd229('0x41')][_0xd229('0x7e')]['split'](',');var _0x5ba0f8={};_0x5ba0f8[_0x49fdf8[0x0]]={'$gte':moment(_0x49fdf8[0x1])[_0xd229('0xc7')](_0xd229('0xc8'))};_0x382435[_0xd229('0x79')]=_[_0xd229('0x9f')](_0x382435[_0xd229('0x79')],_0x5ba0f8);}_0x382435=_['merge']({},_0x382435,_0x28d29d['options']);return db['FaxMessage'][_0xd229('0x22')]({'where':_0x382435[_0xd229('0x79')]})[_0xd229('0x29')](function(_0x4708c2){_0x50b4a3[_0xd229('0x22')]=_0x4708c2;if(_0x28d29d[_0xd229('0x41')][_0xd229('0xba')]){_0x382435['include']=[{'all':!![]}];}return db[_0xd229('0xc1')]['findAll'](_0x382435);})['then'](function(_0x39bb65){_0x50b4a3[_0xd229('0xb7')]=_0x39bb65;return _0x50b4a3;});}})[_0xd229('0x29')](respondWithFilteredResult(_0x4ae2bb,_0x382435))[_0xd229('0x34')](handleError(_0x4ae2bb,null));};exports[_0xd229('0xc9')]=function(_0x589995,_0x4fa7af,_0x5852bd){return db['FaxInteraction'][_0xd229('0x62')]({'where':{'id':_0x589995[_0xd229('0xbe')]['id']}})[_0xd229('0x29')](handleEntityNotFound(_0x4fa7af,null))[_0xd229('0x29')](function(_0x4840ab){if(_0x4840ab){return _0x4840ab[_0xd229('0xca')](_0x589995['body'][_0xd229('0xc2')],_[_0xd229('0xc3')](_0x589995[_0xd229('0x75')],['ids','id'])||{})['spread'](function(){return db[_0xd229('0x6d')][_0xd229('0xcb')]({'attributes':['id',_0xd229('0x2b'),'color'],'where':{'id':_0x589995[_0xd229('0x75')][_0xd229('0xc2')]}});})[_0xd229('0x29')](function(_0x22f37a){socket[_0xd229('0xcc')]('faxInteractionTags:save',{'id':Number(_0x589995[_0xd229('0xbe')]['id']),'tags':_0x22f37a||[]});return{'id':Number(_0x589995[_0xd229('0xbe')]['id']),'tags':_0x22f37a||[]};});}})[_0xd229('0x29')](respondWithResult(_0x4fa7af,null))[_0xd229('0x34')](handleError(_0x4fa7af,null));};exports[_0xd229('0xcd')]=function(_0x23b099,_0x199a7c,_0x4e032c){return db[_0xd229('0xa0')][_0xd229('0x62')]({'where':{'id':_0x23b099['params']['id']}})[_0xd229('0x29')](handleEntityNotFound(_0x199a7c,null))['then'](function(_0x4dff82){if(_0x4dff82){return _0x4dff82['removeTags'](_0x23b099['query'][_0xd229('0xc2')]);}})[_0xd229('0x29')](respondWithStatusCode(_0x199a7c,null))[_0xd229('0x34')](handleError(_0x199a7c,null));};exports[_0xd229('0xce')]=function(_0x42345f,_0x20283c){var _0x3c7b35=moment()['unix']()[_0xd229('0x9d')]();var _0x402e9d=path[_0xd229('0xcf')](config[_0xd229('0xd0')],_0xd229('0xd1'),_0xd229('0xd2'),'tmp');var _0x54cd8d=path[_0xd229('0xcf')](config[_0xd229('0xd0')],_0xd229('0xd1'),_0xd229('0xd2'),_0xd229('0xd3'));var _0xf20f3e=path[_0xd229('0xcf')](_0x402e9d,_0x3c7b35);var _0xbe58eb=util[_0xd229('0xc7')](_0xd229('0xd4'),_0x42345f[_0xd229('0xbe')]['id'],_0x3c7b35);var _0x1460ff=path['join'](_0x402e9d,_0xbe58eb);var _0x41aed8=[];_0x41aed8[_0xd229('0x33')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});var _0x7d4ce3=[{'model':db[_0xd229('0xc1')],'as':_0xd229('0xd5'),'attributes':['id',_0xd229('0x75'),_0xd229('0x7c')],'include':_0x41aed8}];return db[_0xd229('0xa0')]['find']({'where':{'id':_0x42345f['params']['id']},'include':_0x7d4ce3})['then'](handleEntityNotFound(_0x20283c,null))['then'](function(_0x3828b9){if(_0x3828b9&&_0x3828b9[_0xd229('0xd5')]){var _0x151218=_0x3828b9[_0xd229('0xd6')]({'plain':!![]});fs[_0xd229('0xd7')](_0xf20f3e);for(var _0x53efa9=0x0;_0x53efa9<_0x151218[_0xd229('0xd5')][_0xd229('0x47')];_0x53efa9++){var _0xa4a031=_0x151218['Messages'][_0x53efa9][_0xd229('0xd8')];if(_0xa4a031){var _0x503df6=path['join'](_0x54cd8d,_0xa4a031[_0xd229('0xd9')]);if(fs[_0xd229('0xda')](_0x503df6)){fs[_0xd229('0xdb')](_0x503df6)[_0xd229('0xdc')](fs['createWriteStream'](path[_0xd229('0xcf')](_0xf20f3e,_0xa4a031[_0xd229('0xd9')])));}}}return BPromise[_0xd229('0x95')]()[_0xd229('0x29')](function(){return new BPromise(function(_0x200f86,_0x572d0d){zipdir(_0xf20f3e,{'saveTo':_0x1460ff},function(_0x345ce8,_0x2373a2){if(_0x345ce8)return _0x572d0d(_0x345ce8);return _0x200f86(_0x2373a2);});})[_0xd229('0x29')](function(){return new BPromise(function(_0x3475f8,_0x181d34){rimraf(_0xf20f3e,function(_0x537b0c){if(_0x537b0c)_0x181d34(_0x537b0c);return _0x3475f8();});});})[_0xd229('0x29')](function(){return _0x20283c[_0xd229('0xce')](_0x1460ff,_0xbe58eb,function(_0x5c3def){if(_0x5c3def){console[_0xd229('0xdd')](_0xd229('0xde'),_0x5c3def);}else{fs[_0xd229('0xdf')](_0x1460ff);}});});});}else{return _0x20283c[_0xd229('0x1d')](0xc8);}})[_0xd229('0x34')](handleError(_0x20283c,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index c42905b..09304a2 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 _0xabcc=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','emit','catch'];(function(_0x47aaf2,_0x52a40a){var _0x566bcf=function(_0x99811c){while(--_0x99811c){_0x47aaf2['push'](_0x47aaf2['shift']());}};_0x566bcf(++_0x52a40a);}(_0xabcc,0x7a));var _0xcabc=function(_0x5c2cfc,_0x225457){_0x5c2cfc=_0x5c2cfc-0x0;var _0x39ef01=_0xabcc[_0x5c2cfc];return _0x39ef01;};'use strict';var EventEmitter=require(_0xcabc('0x0'));var FaxInteraction=require(_0xcabc('0x1'))['db'][_0xcabc('0x2')];var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcabc('0x3'),'afterUpdate':_0xcabc('0x4'),'afterDestroy':_0xcabc('0x5')};function emitEvent(_0x8eebaa){return function(_0x2ac993,_0x1f1c1e,_0x207cb8){_0x2ac993[_0xcabc('0x6')]({'attributes':['id'],'raw':!![]})[_0xcabc('0x7')](function(_0x517cc1){_0x2ac993[_0xcabc('0x8')](_0xcabc('0x9'),_0x517cc1[_0xcabc('0xa')](function(_0x3cdc9a){return{'id':_0x3cdc9a['id']};}));return FaxMessage[_0xcabc('0xb')]({'where':{'FaxInteractionId':_0x2ac993['id'],'direction':'in','read':![]},'raw':!![]});})[_0xcabc('0x7')](function(_0x5eb19a){_0x2ac993[_0xcabc('0x8')]('unreadMessages',_0x5eb19a['length']);FaxInteractionEvents[_0xcabc('0xc')](_0x8eebaa+':'+_0x2ac993['id'],_0x2ac993);FaxInteractionEvents[_0xcabc('0xc')](_0x8eebaa,_0x2ac993);_0x207cb8(null);})[_0xcabc('0xd')](_0x207cb8(null));};}for(var e in events){if(events[_0xcabc('0xe')](e)){var event=events[e];FaxInteraction[_0xcabc('0xf')](e,emitEvent(event));}}module[_0xcabc('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0x5b6f=['setDataValue','Users','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then'];(function(_0x2b11c2,_0x51b438){var _0x113274=function(_0x2ec34b){while(--_0x2ec34b){_0x2b11c2['push'](_0x2b11c2['shift']());}};_0x113274(++_0x51b438);}(_0x5b6f,0x185));var _0xf5b6=function(_0x52a941,_0x33ab69){_0x52a941=_0x52a941-0x0;var _0x54bd86=_0x5b6f[_0x52a941];return _0x54bd86;};'use strict';var EventEmitter=require(_0xf5b6('0x0'));var FaxInteraction=require(_0xf5b6('0x1'))['db'][_0xf5b6('0x2')];var FaxMessage=require(_0xf5b6('0x1'))['db'][_0xf5b6('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xf5b6('0x4')](0x0);var events={'afterCreate':_0xf5b6('0x5'),'afterUpdate':_0xf5b6('0x6'),'afterDestroy':_0xf5b6('0x7')};function emitEvent(_0x44b27c){return function(_0x5041cb,_0x12f025,_0x2c3813){_0x5041cb[_0xf5b6('0x8')]({'attributes':['id'],'raw':!![]})[_0xf5b6('0x9')](function(_0x44a5eb){_0x5041cb[_0xf5b6('0xa')](_0xf5b6('0xb'),_0x44a5eb['map'](function(_0x23d020){return{'id':_0x23d020['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x5041cb['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf5b6('0x9')](function(_0x1c1910){_0x5041cb[_0xf5b6('0xa')](_0xf5b6('0xc'),_0x1c1910[_0xf5b6('0xd')]);FaxInteractionEvents[_0xf5b6('0xe')](_0x44b27c+':'+_0x5041cb['id'],_0x5041cb);FaxInteractionEvents['emit'](_0x44b27c,_0x5041cb);_0x2c3813(null);})[_0xf5b6('0xf')](_0x2c3813(null));};}for(var e in events){if(events[_0xf5b6('0x10')](e)){var event=events[e];FaxInteraction[_0xf5b6('0x11')](e,emitEvent(event));}}module[_0xf5b6('0x12')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 8fe8764..6ace037 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 _0x1bf3=['rimraf','../../config/environment','./faxInteraction.attributes','define','FaxInteraction','fax_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x1bf3,0x16f));var _0x31bf=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1bf3[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x31bf('0x0'));var util=require(_0x31bf('0x1'));var logger=require('../../config/logger')(_0x31bf('0x2'));var moment=require(_0x31bf('0x3'));var BPromise=require(_0x31bf('0x4'));var rp=require(_0x31bf('0x5'));var fs=require('fs');var path=require(_0x31bf('0x6'));var rimraf=require(_0x31bf('0x7'));var config=require(_0x31bf('0x8'));var attributes=require(_0x31bf('0x9'));module['exports']=function(_0x557d5c,_0x24b931){return _0x557d5c[_0x31bf('0xa')](_0x31bf('0xb'),attributes,{'tableName':_0x31bf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1998b5,_0x3f9dfc,_0x331095){if(_0x1998b5[_0x31bf('0xd')](_0x31bf('0xe'))){_0x1998b5[_0x31bf('0xf')]=moment()['format'](_0x31bf('0x10'));}_0x331095(null,_0x1998b5);}}});}; \ No newline at end of file +var _0xe30c=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt','format'];(function(_0x1bfb5e,_0x272a42){var _0x4f4fcc=function(_0x2c1dae){while(--_0x2c1dae){_0x1bfb5e['push'](_0x1bfb5e['shift']());}};_0x4f4fcc(++_0x272a42);}(_0xe30c,0xc9));var _0xce30=function(_0x679afb,_0x8ca354){_0x679afb=_0x679afb-0x0;var _0x1c391c=_0xe30c[_0x679afb];return _0x1c391c;};'use strict';var _=require(_0xce30('0x0'));var util=require(_0xce30('0x1'));var logger=require(_0xce30('0x2'))(_0xce30('0x3'));var moment=require(_0xce30('0x4'));var BPromise=require(_0xce30('0x5'));var rp=require(_0xce30('0x6'));var fs=require('fs');var path=require(_0xce30('0x7'));var rimraf=require(_0xce30('0x8'));var config=require(_0xce30('0x9'));var attributes=require(_0xce30('0xa'));module[_0xce30('0xb')]=function(_0x35eb58,_0x2f656b){return _0x35eb58[_0xce30('0xc')](_0xce30('0xd'),attributes,{'tableName':_0xce30('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3829b6,_0x29cc90,_0x17bc77){if(_0x3829b6[_0xce30('0xf')](_0xce30('0x10'))){_0x3829b6[_0xce30('0x11')]=moment()[_0xce30('0x12')](_0xce30('0x13'));}_0x17bc77(null,_0x3829b6);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 7414048..1932c9f 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 _0x75a6=['then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','FaxInteraction','update','options','raw','where','attributes','UpdateFaxInteraction','AddTagsToFaxInteraction','find','addTags','body','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register'];(function(_0x239c58,_0xc6cc17){var _0x5afee3=function(_0x3b59a2){while(--_0x3b59a2){_0x239c58['push'](_0x239c58['shift']());}};_0x5afee3(++_0xc6cc17);}(_0x75a6,0xeb));var _0x675a=function(_0x33e0b6,_0x5b249c){_0x33e0b6=_0x33e0b6-0x0;var _0x5d7fa0=_0x75a6[_0x33e0b6];return _0x5d7fa0;};'use strict';var _=require(_0x675a('0x0'));var util=require('util');var moment=require(_0x675a('0x1'));var BPromise=require(_0x675a('0x2'));var rs=require(_0x675a('0x3'));var fs=require('fs');var Redis=require(_0x675a('0x4'));var db=require(_0x675a('0x5'))['db'];var utils=require(_0x675a('0x6'));var logger=require(_0x675a('0x7'))(_0x675a('0x8'));var config=require('../../config/environment');var jayson=require(_0x675a('0x9'));var client=jayson['client'][_0x675a('0xa')]({'port':0x232a});config['redis']=_[_0x675a('0xb')](config[_0x675a('0xc')],{'host':_0x675a('0xd'),'port':0x18eb});var socket=require(_0x675a('0xe'))(new Redis(config[_0x675a('0xc')]));require(_0x675a('0xf'))[_0x675a('0x10')](socket);function respondWithRpcPromise(_0x24c0f2,_0x3c1aaa,_0x2989c1){return new BPromise(function(_0x328c95,_0x4d4fe0){return client['request'](_0x24c0f2,_0x2989c1)[_0x675a('0x11')](function(_0x3277cb){logger[_0x675a('0x12')](_0x675a('0x13'),_0x3c1aaa,_0x675a('0x14'));logger[_0x675a('0x15')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x3c1aaa,_0x675a('0x14'),JSON[_0x675a('0x16')](_0x3277cb));if(_0x3277cb[_0x675a('0x17')]){if(_0x3277cb[_0x675a('0x17')][_0x675a('0x18')]===0x1f4){logger[_0x675a('0x17')](_0x675a('0x13'),_0x3c1aaa,_0x3277cb[_0x675a('0x17')][_0x675a('0x19')]);return _0x4d4fe0(_0x3277cb[_0x675a('0x17')]['message']);}logger[_0x675a('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x3c1aaa,_0x3277cb[_0x675a('0x17')]['message']);return _0x328c95(_0x3277cb[_0x675a('0x17')][_0x675a('0x19')]);}else{logger[_0x675a('0x12')](_0x675a('0x13'),_0x3c1aaa,_0x675a('0x14'));_0x328c95(_0x3277cb[_0x675a('0x1a')][_0x675a('0x19')]);}})[_0x675a('0x1b')](function(_0x383f6f){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x3c1aaa,_0x383f6f);_0x4d4fe0(_0x383f6f);});});}exports['UpdateFaxInteraction']=function(_0x5a628d){var _0xc37705=this;return new Promise(function(_0x32846c,_0x180b9a){return db[_0x675a('0x1c')][_0x675a('0x1d')](_0x5a628d['body'],{'raw':_0x5a628d[_0x675a('0x1e')]?_0x5a628d[_0x675a('0x1e')][_0x675a('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a628d[_0x675a('0x1e')]?_0x5a628d[_0x675a('0x1e')][_0x675a('0x20')]||null:null,'attributes':_0x5a628d[_0x675a('0x1e')]?_0x5a628d['options'][_0x675a('0x21')]||null:null,'limit':_0x5a628d['options']?_0x5a628d[_0x675a('0x1e')]['limit']||null:null})[_0x675a('0x11')](function(_0xc0dca5){logger[_0x675a('0x12')](_0x675a('0x22'),_0x5a628d);logger[_0x675a('0x15')](_0x675a('0x22'),_0x5a628d,JSON[_0x675a('0x16')](_0xc0dca5));_0x32846c(_0xc0dca5);})[_0x675a('0x1b')](function(_0x24066c){logger[_0x675a('0x17')]('UpdateFaxInteraction',_0x24066c[_0x675a('0x19')],_0x5a628d);_0x180b9a(_0xc37705[_0x675a('0x17')](0x1f4,_0x24066c['message']));});});};exports[_0x675a('0x23')]=function(_0x4b5d21){return new Promise(function(_0x5150a6,_0x55edb8){return db[_0x675a('0x1c')][_0x675a('0x24')]({'where':_0x4b5d21[_0x675a('0x1e')]?_0x4b5d21[_0x675a('0x1e')][_0x675a('0x20')]||null:null})[_0x675a('0x11')](function(_0x548f7a){if(_0x548f7a){return _0x548f7a[_0x675a('0x25')](_0x4b5d21[_0x675a('0x26')][_0x675a('0x27')],_['omit'](_0x4b5d21[_0x675a('0x26')],[_0x675a('0x27'),'id'])||{});}})[_0x675a('0x28')](function(_0x140ccc){logger[_0x675a('0x12')](_0x675a('0x29'),_0x4b5d21);logger['debug'](_0x675a('0x29'),_0x4b5d21,JSON[_0x675a('0x16')](_0x140ccc));_0x5150a6(_0x140ccc);})['catch'](function(_0x4da4b9){logger[_0x675a('0x17')](_0x675a('0x29'),_0x4da4b9[_0x675a('0x19')],_0x4b5d21);_0x55edb8(_this[_0x675a('0x17')](0x1f4,_0x4da4b9['message']));});});}; \ No newline at end of file +var _0x01ac=['register','request','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','update','body','options','attributes','limit','then','UpdateFaxInteraction','AddTagsToFaxInteraction','FaxInteraction','find','where','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x17d58c,_0x133177){var _0x2f37ae=function(_0x24d00e){while(--_0x24d00e){_0x17d58c['push'](_0x17d58c['shift']());}};_0x2f37ae(++_0x133177);}(_0x01ac,0x71));var _0xc01a=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x01ac[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xc01a('0x0'));var util=require(_0xc01a('0x1'));var moment=require(_0xc01a('0x2'));var BPromise=require(_0xc01a('0x3'));var rs=require(_0xc01a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc01a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc01a('0x6'))(_0xc01a('0x7'));var config=require(_0xc01a('0x8'));var jayson=require(_0xc01a('0x9'));var client=jayson[_0xc01a('0xa')][_0xc01a('0xb')]({'port':0x232a});config[_0xc01a('0xc')]=_[_0xc01a('0xd')](config[_0xc01a('0xc')],{'host':_0xc01a('0xe'),'port':0x18eb});var socket=require(_0xc01a('0xf'))(new Redis(config['redis']));require('./faxInteraction.socket')[_0xc01a('0x10')](socket);function respondWithRpcPromise(_0x408dd3,_0x88d809,_0x3d8975){return new BPromise(function(_0x3755df,_0x13870e){return client[_0xc01a('0x11')](_0x408dd3,_0x3d8975)['then'](function(_0x4b5ef2){logger['info'](_0xc01a('0x12'),_0x88d809,_0xc01a('0x13'));logger[_0xc01a('0x14')](_0xc01a('0x15'),_0x88d809,_0xc01a('0x13'),JSON[_0xc01a('0x16')](_0x4b5ef2));if(_0x4b5ef2[_0xc01a('0x17')]){if(_0x4b5ef2['error'][_0xc01a('0x18')]===0x1f4){logger[_0xc01a('0x17')](_0xc01a('0x12'),_0x88d809,_0x4b5ef2[_0xc01a('0x17')][_0xc01a('0x19')]);return _0x13870e(_0x4b5ef2[_0xc01a('0x17')]['message']);}logger[_0xc01a('0x17')](_0xc01a('0x12'),_0x88d809,_0x4b5ef2[_0xc01a('0x17')][_0xc01a('0x19')]);return _0x3755df(_0x4b5ef2['error'][_0xc01a('0x19')]);}else{logger[_0xc01a('0x1a')]('FaxInteraction,\x20%s,\x20%s',_0x88d809,_0xc01a('0x13'));_0x3755df(_0x4b5ef2[_0xc01a('0x1b')][_0xc01a('0x19')]);}})[_0xc01a('0x1c')](function(_0x16d5c2){logger[_0xc01a('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x88d809,_0x16d5c2);_0x13870e(_0x16d5c2);});});}exports['UpdateFaxInteraction']=function(_0x56e665){var _0x1a7d8d=this;return new Promise(function(_0x8ed303,_0x2314ce){return db['FaxInteraction'][_0xc01a('0x1d')](_0x56e665[_0xc01a('0x1e')],{'raw':_0x56e665['options']?_0x56e665[_0xc01a('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56e665[_0xc01a('0x1f')]?_0x56e665[_0xc01a('0x1f')]['where']||null:null,'attributes':_0x56e665['options']?_0x56e665['options'][_0xc01a('0x20')]||null:null,'limit':_0x56e665[_0xc01a('0x1f')]?_0x56e665[_0xc01a('0x1f')][_0xc01a('0x21')]||null:null})[_0xc01a('0x22')](function(_0x1c382b){logger['info'](_0xc01a('0x23'),_0x56e665);logger[_0xc01a('0x14')](_0xc01a('0x23'),_0x56e665,JSON[_0xc01a('0x16')](_0x1c382b));_0x8ed303(_0x1c382b);})[_0xc01a('0x1c')](function(_0x530e3d){logger[_0xc01a('0x17')](_0xc01a('0x23'),_0x530e3d[_0xc01a('0x19')],_0x56e665);_0x2314ce(_0x1a7d8d['error'](0x1f4,_0x530e3d[_0xc01a('0x19')]));});});};exports[_0xc01a('0x24')]=function(_0x590559){return new Promise(function(_0x476dfc,_0x11e93f){return db[_0xc01a('0x25')][_0xc01a('0x26')]({'where':_0x590559[_0xc01a('0x1f')]?_0x590559['options'][_0xc01a('0x27')]||null:null})['then'](function(_0xb1c69e){if(_0xb1c69e){return _0xb1c69e['addTags'](_0x590559[_0xc01a('0x1e')][_0xc01a('0x28')],_['omit'](_0x590559['body'],[_0xc01a('0x28'),'id'])||{});}})[_0xc01a('0x29')](function(_0x4d9f05){logger[_0xc01a('0x1a')](_0xc01a('0x2a'),_0x590559);logger[_0xc01a('0x14')](_0xc01a('0x2a'),_0x590559,JSON[_0xc01a('0x16')](_0x4d9f05));_0x476dfc(_0x4d9f05);})['catch'](function(_0x31f2eb){logger[_0xc01a('0x17')](_0xc01a('0x2a'),_0x31f2eb['message'],_0x590559);_0x11e93f(_this[_0xc01a('0x17')](0x1f4,_0x31f2eb[_0xc01a('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 503cb8e..b666a83 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 _0xf26a=['update','emit','register','length','faxInteraction:','save','remove'];(function(_0x2e5a03,_0x17228b){var _0x867589=function(_0x4a5a6f){while(--_0x4a5a6f){_0x2e5a03['push'](_0x2e5a03['shift']());}};_0x867589(++_0x17228b);}(_0xf26a,0xc9));var _0xaf26=function(_0x4dc7a7,_0x3ec983){_0x4dc7a7=_0x4dc7a7-0x0;var _0x47c4bd=_0xf26a[_0x4dc7a7];return _0x47c4bd;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0xaf26('0x0'),_0xaf26('0x1'),_0xaf26('0x2')];function createListener(_0x206cdf,_0x4fc4cb){return function(_0x4b2334){_0x4fc4cb[_0xaf26('0x3')](_0x206cdf,_0x4b2334);};}function removeListener(_0x515366,_0x268c0a){return function(){FaxInteractionEvents['removeListener'](_0x515366,_0x268c0a);};}exports[_0xaf26('0x4')]=function(_0x13c3a6){for(var _0x1bcb93=0x0,_0x408985=events[_0xaf26('0x5')];_0x1bcb93<_0x408985;_0x1bcb93++){var _0x2afa01=events[_0x1bcb93];var _0x22d5b7=createListener(_0xaf26('0x6')+_0x2afa01,_0x13c3a6);FaxInteractionEvents['on'](_0x2afa01,_0x22d5b7);}}; \ No newline at end of file +var _0x7937=['emit','removeListener','length','faxInteraction:','./faxInteraction.events','save','remove'];(function(_0xcd39c8,_0x2ad166){var _0x463dfc=function(_0x224b09){while(--_0x224b09){_0xcd39c8['push'](_0xcd39c8['shift']());}};_0x463dfc(++_0x2ad166);}(_0x7937,0x177));var _0x7793=function(_0x1f239e,_0x367b43){_0x1f239e=_0x1f239e-0x0;var _0x826971=_0x7937[_0x1f239e];return _0x826971;};'use strict';var FaxInteractionEvents=require(_0x7793('0x0'));var events=[_0x7793('0x1'),_0x7793('0x2'),'update'];function createListener(_0x4544b4,_0x5958ea){return function(_0x5576cd){_0x5958ea[_0x7793('0x3')](_0x4544b4,_0x5576cd);};}function removeListener(_0x59e8c6,_0x2f43f6){return function(){FaxInteractionEvents[_0x7793('0x4')](_0x59e8c6,_0x2f43f6);};}exports['register']=function(_0x416909){for(var _0x2fee65=0x0,_0x53202b=events[_0x7793('0x5')];_0x2fee65<_0x53202b;_0x2fee65++){var _0x2f6037=events[_0x2fee65];var _0x44dbf7=createListener(_0x7793('0x6')+_0x2f6037,_0x416909);FaxInteractionEvents['on'](_0x2f6037,_0x44dbf7);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 7a910c3..2b793a7 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 _0x619f=['get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','post','create','addMessage','/:id/tags','tracked','put','faxinteraction:update','update','fax','delete','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller'];(function(_0x133ee2,_0x1365ff){var _0x28e86f=function(_0x162938){while(--_0x162938){_0x133ee2['push'](_0x133ee2['shift']());}};_0x28e86f(++_0x1365ff);}(_0x619f,0x14a));var _0xf619=function(_0x5151b4,_0x92bca5){_0x5151b4=_0x5151b4-0x0;var _0xe06c99=_0x619f[_0x5151b4];return _0xe06c99;};'use strict';var multer=require(_0xf619('0x0'));var util=require(_0xf619('0x1'));var path=require(_0xf619('0x2'));var timeout=require('connect-timeout');var express=require(_0xf619('0x3'));var router=express['Router']();var fs_extra=require(_0xf619('0x4'));var auth=require(_0xf619('0x5'));var interaction=require(_0xf619('0x6'));var config=require('../../config/environment');var controller=require(_0xf619('0x7'));router[_0xf619('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf619('0x8')](_0xf619('0x9'),auth[_0xf619('0xa')](),controller[_0xf619('0xb')]);router[_0xf619('0x8')](_0xf619('0xc'),auth[_0xf619('0xa')](),controller[_0xf619('0xd')]);router['get'](_0xf619('0xe'),auth[_0xf619('0xa')](),controller['getMessages']);router[_0xf619('0x8')](_0xf619('0xf'),auth['isAuthenticated'](),controller['download']);router[_0xf619('0x10')]('/',auth[_0xf619('0xa')](),controller[_0xf619('0x11')]);router['post'](_0xf619('0xe'),auth[_0xf619('0xa')](),controller[_0xf619('0x12')]);router[_0xf619('0x10')](_0xf619('0x13'),auth['isAuthenticated'](),interaction[_0xf619('0x14')]('fax','faxinteraction:addtags'),controller['addTags']);router[_0xf619('0x15')](_0xf619('0xc'),auth[_0xf619('0xa')](),interaction['tracked']('fax',_0xf619('0x16')),controller[_0xf619('0x17')]);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0xf619('0x14')](_0xf619('0x18'),'faxinteraction:destroy'),controller['destroy']);router[_0xf619('0x19')]('/:id/tags',auth[_0xf619('0xa')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x7d9f=['isAuthenticated','describe','/:id','show','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','index','get'];(function(_0x3e509f,_0x1177c6){var _0x2aa60c=function(_0x589b95){while(--_0x589b95){_0x3e509f['push'](_0x3e509f['shift']());}};_0x2aa60c(++_0x1177c6);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x2440fe,_0x281a11){_0x2440fe=_0x2440fe-0x0;var _0x5cf734=_0x7d9f[_0x2440fe];return _0x5cf734;};'use strict';var multer=require(_0xf7d9('0x0'));var util=require(_0xf7d9('0x1'));var path=require(_0xf7d9('0x2'));var timeout=require(_0xf7d9('0x3'));var express=require(_0xf7d9('0x4'));var router=express['Router']();var fs_extra=require(_0xf7d9('0x5'));var auth=require(_0xf7d9('0x6'));var interaction=require(_0xf7d9('0x7'));var config=require(_0xf7d9('0x8'));var controller=require(_0xf7d9('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xf7d9('0xa')]);router[_0xf7d9('0xb')]('/describe',auth[_0xf7d9('0xc')](),controller[_0xf7d9('0xd')]);router['get'](_0xf7d9('0xe'),auth['isAuthenticated'](),controller[_0xf7d9('0xf')]);router[_0xf7d9('0xb')]('/:id/messages',auth['isAuthenticated'](),controller[_0xf7d9('0x10')]);router[_0xf7d9('0xb')](_0xf7d9('0x11'),auth['isAuthenticated'](),controller['download']);router[_0xf7d9('0x12')]('/',auth[_0xf7d9('0xc')](),controller[_0xf7d9('0x13')]);router[_0xf7d9('0x12')]('/:id/messages',auth[_0xf7d9('0xc')](),controller[_0xf7d9('0x14')]);router[_0xf7d9('0x12')](_0xf7d9('0x15'),auth['isAuthenticated'](),interaction[_0xf7d9('0x16')](_0xf7d9('0x17'),_0xf7d9('0x18')),controller[_0xf7d9('0x19')]);router['put'](_0xf7d9('0xe'),auth[_0xf7d9('0xc')](),interaction[_0xf7d9('0x16')]('fax','faxinteraction:update'),controller[_0xf7d9('0x1a')]);router[_0xf7d9('0x1b')](_0xf7d9('0xe'),auth['isAuthenticated'](),interaction[_0xf7d9('0x16')](_0xf7d9('0x17'),'faxinteraction:destroy'),controller[_0xf7d9('0x1c')]);router['delete'](_0xf7d9('0x15'),auth[_0xf7d9('0xc')](),controller['removeTags']);module[_0xf7d9('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 227f166..92617cf 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 _0x1b73=['DATE','exports','TEXT','medium','BOOLEAN','out'];(function(_0xbfc9a6,_0x478fc3){var _0x1af88c=function(_0x21e0ca){while(--_0x21e0ca){_0xbfc9a6['push'](_0xbfc9a6['shift']());}};_0x1af88c(++_0x478fc3);}(_0x1b73,0x1d5));var _0x31b7=function(_0x3046fa,_0x28321f){_0x3046fa=_0x3046fa-0x0;var _0x147319=_0x1b73[_0x3046fa];return _0x147319;};'use strict';var Sequelize=require('sequelize');module[_0x31b7('0x0')]={'body':{'type':Sequelize[_0x31b7('0x1')](_0x31b7('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x31b7('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x31b7('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x31b7('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x31b7('0x5')]}}; \ No newline at end of file +var _0x00bb=['TEXT','BOOLEAN','out','DATE','sequelize','exports'];(function(_0x2d398e,_0x8d3945){var _0x4e05fa=function(_0x36ec9c){while(--_0x36ec9c){_0x2d398e['push'](_0x2d398e['shift']());}};_0x4e05fa(++_0x8d3945);}(_0x00bb,0x1d8));var _0xb00b=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x00bb[_0x2bf141];return _0x48277b;};'use strict';var Sequelize=require(_0xb00b('0x0'));module[_0xb00b('0x1')]={'body':{'type':Sequelize[_0xb00b('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xb00b('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xb00b('0x4')),'defaultValue':_0xb00b('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xb00b('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 6017741..fb7f81e 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 _0x77f8=['[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','motionChannel','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','download','join','server','files','attachments','basename','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxMessage.socket','register','http','client','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','info','catch','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','update','destroy','name','send','index','map','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','FaxMessage','findAll','rows','params','rawAttributes','options','find','body','describe','fax-interactions','accept','read','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','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','SIP/%s','channel','event','EventManager','acceptmessage','../../config/logger','fax'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x77f8,0x1b7));var _0x877f=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x77f8[_0x279d37];return _0x530173;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x877f('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x877f('0x1'));var moment=require(_0x877f('0x2'));var BPromise=require(_0x877f('0x3'));var Mustache=require(_0x877f('0x4'));var util=require(_0x877f('0x5'));var path=require(_0x877f('0x6'));var sox=require(_0x877f('0x7'));var csv=require(_0x877f('0x8'));var ejs=require(_0x877f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x877f('0xa'));var squel=require(_0x877f('0xb'));var crypto=require(_0x877f('0xc'));var jsforce=require(_0x877f('0xd'));var deskjs=require(_0x877f('0xe'));var toCsv=require(_0x877f('0x8'));var querystring=require('querystring');var Papa=require(_0x877f('0xf'));var Redis=require('ioredis');var authService=require(_0x877f('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x877f('0x11'));var logger=require('../../config/logger')(_0x877f('0x12'));var utils=require(_0x877f('0x13'));var config=require(_0x877f('0x14'));var licenseUtil=require(_0x877f('0x15'));var db=require(_0x877f('0x16'))['db'];config[_0x877f('0x17')]=_['defaults'](config[_0x877f('0x17')],{'host':_0x877f('0x18'),'port':0x18eb});var socket=require(_0x877f('0x19'))(new Redis(config[_0x877f('0x17')]));require(_0x877f('0x1a'))[_0x877f('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x877f('0x1c')]({'port':0x232c});var client9002=jayson[_0x877f('0x1d')][_0x877f('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x19d936,_0x178425,_0x1ba9af,_0x4668e8){return new BPromise(function(_0x2e6550,_0x3d14ae){var _0x5a8fb2=_0x4668e8||client;return _0x5a8fb2[_0x877f('0x1e')](_0x19d936,_0x1ba9af)[_0x877f('0x1f')](function(_0x5a72d6){logger['info'](_0x877f('0x20'),_0x178425,_0x877f('0x21'));logger['debug'](_0x877f('0x22'),_0x178425,_0x877f('0x21'),JSON['stringify'](_0x5a72d6));if(_0x5a72d6['error']){if(_0x5a72d6[_0x877f('0x23')]['code']===0x1f4){logger[_0x877f('0x23')](_0x877f('0x20'),_0x178425,_0x5a72d6[_0x877f('0x23')][_0x877f('0x24')]);return _0x3d14ae(_0x5a72d6[_0x877f('0x23')][_0x877f('0x24')]);}logger['error'](_0x877f('0x20'),_0x178425,_0x5a72d6['error']['message']);return _0x2e6550(_0x5a72d6[_0x877f('0x23')][_0x877f('0x24')]);}else{logger[_0x877f('0x25')]('FaxMessage,\x20%s,\x20%s',_0x178425,_0x877f('0x21'));_0x2e6550(_0x5a72d6['result']['message']);}})[_0x877f('0x26')](function(_0x19d624){logger[_0x877f('0x23')](_0x877f('0x20'),_0x178425,_0x19d624);_0x3d14ae(_0x19d624);});});}function respondWithStatusCode(_0x1d182e,_0x87bf5){_0x87bf5=_0x87bf5||0xcc;return function(_0x3302dd){if(_0x3302dd){return _0x1d182e[_0x877f('0x27')](_0x87bf5);}return _0x1d182e[_0x877f('0x28')](_0x87bf5)[_0x877f('0x29')]();};}function respondWithResult(_0x3d024d,_0x312e29){_0x312e29=_0x312e29||0xc8;return function(_0x4378f3){if(_0x4378f3){return _0x3d024d[_0x877f('0x28')](_0x312e29)['json'](_0x4378f3);}};}function respondWithFilteredResult(_0x55b47e,_0x149816){return function(_0x5f30b1){if(_0x5f30b1){var _0x8acdc1=typeof _0x149816[_0x877f('0x2a')]===_0x877f('0x2b')&&typeof _0x149816[_0x877f('0x2c')]===_0x877f('0x2b');var _0x2f006b=_0x5f30b1['count'];var _0x8d1002=_0x8acdc1?0x0:_0x149816[_0x877f('0x2a')];var _0x11a24a=_0x8acdc1?_0x5f30b1[_0x877f('0x2d')]:_0x149816[_0x877f('0x2a')]+_0x149816[_0x877f('0x2c')];var _0x2578a3;if(_0x11a24a>=_0x2f006b){_0x11a24a=_0x2f006b;_0x2578a3=0xc8;}else{_0x2578a3=0xce;}_0x55b47e[_0x877f('0x28')](_0x2578a3);return _0x55b47e['set']('Content-Range',_0x8d1002+'-'+_0x11a24a+'/'+_0x2f006b)[_0x877f('0x2e')](_0x5f30b1);}return null;};}function patchUpdates(_0x405907){return function(_0x13efa2){try{jsonpatch[_0x877f('0x2f')](_0x13efa2,_0x405907,!![]);}catch(_0x4ff5e2){return BPromise[_0x877f('0x30')](_0x4ff5e2);}return _0x13efa2[_0x877f('0x31')]();};}function saveUpdates(_0x222309,_0x417981){return function(_0x109284){if(_0x109284){return _0x109284[_0x877f('0x32')](_0x222309)[_0x877f('0x1f')](function(_0xcf0ef3){return _0xcf0ef3;});}return null;};}function removeEntity(_0x2bd3ca,_0x36f83b){return function(_0x3182ae){if(_0x3182ae){return _0x3182ae[_0x877f('0x33')]()['then'](function(){_0x2bd3ca[_0x877f('0x28')](0xcc)[_0x877f('0x29')]();});}};}function handleEntityNotFound(_0x51afb6,_0x2047ea){return function(_0x780de0){if(!_0x780de0){_0x51afb6['sendStatus'](0x194);}return _0x780de0;};}function handleError(_0x2d7330,_0x16e502){_0x16e502=_0x16e502||0x1f4;return function(_0x217eda){logger[_0x877f('0x23')](_0x217eda['stack']);if(_0x217eda['name']){delete _0x217eda[_0x877f('0x34')];}_0x2d7330[_0x877f('0x28')](_0x16e502)[_0x877f('0x35')](_0x217eda);};}exports[_0x877f('0x36')]=function(_0x7006a2,_0x4a52e6){var _0x379e33={},_0x43f423={},_0x691b83={'count':0x0,'rows':[]};var _0x37deb8=_[_0x877f('0x37')](db['FaxMessage']['rawAttributes'],function(_0x2cf8f1){return{'name':_0x2cf8f1[_0x877f('0x38')],'type':_0x2cf8f1[_0x877f('0x39')]['key']};});_0x43f423['model']=_[_0x877f('0x37')](_0x37deb8,_0x877f('0x34'));_0x43f423[_0x877f('0x3a')]=_[_0x877f('0x3b')](_0x7006a2[_0x877f('0x3a')]);_0x43f423[_0x877f('0x3c')]=_[_0x877f('0x3d')](_0x43f423[_0x877f('0x3e')],_0x43f423[_0x877f('0x3a')]);_0x379e33[_0x877f('0x3f')]=_['intersection'](_0x43f423['model'],qs['fields'](_0x7006a2[_0x877f('0x3a')][_0x877f('0x40')]));_0x379e33[_0x877f('0x3f')]=_0x379e33['attributes'][_0x877f('0x41')]?_0x379e33[_0x877f('0x3f')]:_0x43f423['model'];if(!_0x7006a2[_0x877f('0x3a')][_0x877f('0x42')]('nolimit')){_0x379e33[_0x877f('0x2c')]=qs['limit'](_0x7006a2[_0x877f('0x3a')][_0x877f('0x2c')]);_0x379e33[_0x877f('0x2a')]=qs[_0x877f('0x2a')](_0x7006a2[_0x877f('0x3a')][_0x877f('0x2a')]);}_0x379e33[_0x877f('0x43')]=qs[_0x877f('0x44')](_0x7006a2[_0x877f('0x3a')][_0x877f('0x44')]);_0x379e33[_0x877f('0x45')]=qs['filters'](_[_0x877f('0x46')](_0x7006a2[_0x877f('0x3a')],_0x43f423[_0x877f('0x3c')]),_0x37deb8);if(_0x7006a2['query'][_0x877f('0x47')]){_0x379e33[_0x877f('0x45')]=_['merge'](_0x379e33['where'],{'$or':_[_0x877f('0x37')](_0x37deb8,function(_0x317897){if(_0x317897[_0x877f('0x39')]!==_0x877f('0x48')){var _0x29bff6={};_0x29bff6[_0x317897[_0x877f('0x34')]]={'$like':'%'+_0x7006a2[_0x877f('0x3a')][_0x877f('0x47')]+'%'};return _0x29bff6;}})});}_0x379e33=_[_0x877f('0x49')]({},_0x379e33,_0x7006a2['options']);var _0x54ec16={'where':_0x379e33[_0x877f('0x45')]};return db['FaxMessage'][_0x877f('0x2d')](_0x54ec16)[_0x877f('0x1f')](function(_0x229db0){_0x691b83[_0x877f('0x2d')]=_0x229db0;if(_0x7006a2['query'][_0x877f('0x4a')]){_0x379e33[_0x877f('0x4b')]=[{'all':!![]}];}return db[_0x877f('0x4c')][_0x877f('0x4d')](_0x379e33);})['then'](function(_0x2a1685){_0x691b83[_0x877f('0x4e')]=_0x2a1685;return _0x691b83;})['then'](respondWithFilteredResult(_0x4a52e6,_0x379e33))[_0x877f('0x26')](handleError(_0x4a52e6,null));};exports['show']=function(_0x4d2e1c,_0x5a1259){var _0x16d492={'raw':!![],'where':{'id':_0x4d2e1c[_0x877f('0x4f')]['id']}},_0x3f3ccf={};_0x3f3ccf[_0x877f('0x3e')]=_[_0x877f('0x3b')](db[_0x877f('0x4c')][_0x877f('0x50')]);_0x3f3ccf['query']=_['keys'](_0x4d2e1c[_0x877f('0x3a')]);_0x3f3ccf[_0x877f('0x3c')]=_[_0x877f('0x3d')](_0x3f3ccf[_0x877f('0x3e')],_0x3f3ccf[_0x877f('0x3a')]);_0x16d492[_0x877f('0x3f')]=_[_0x877f('0x3d')](_0x3f3ccf[_0x877f('0x3e')],qs[_0x877f('0x40')](_0x4d2e1c['query'][_0x877f('0x40')]));_0x16d492[_0x877f('0x3f')]=_0x16d492[_0x877f('0x3f')]['length']?_0x16d492[_0x877f('0x3f')]:_0x3f3ccf[_0x877f('0x3e')];if(_0x4d2e1c['query']['includeAll']){_0x16d492[_0x877f('0x4b')]=[{'all':!![]}];}_0x16d492=_[_0x877f('0x49')]({},_0x16d492,_0x4d2e1c[_0x877f('0x51')]);return db[_0x877f('0x4c')][_0x877f('0x52')](_0x16d492)[_0x877f('0x1f')](handleEntityNotFound(_0x5a1259,null))[_0x877f('0x1f')](respondWithResult(_0x5a1259,null))[_0x877f('0x26')](handleError(_0x5a1259,null));};exports[_0x877f('0x32')]=function(_0x585c0b,_0x74ecfb){if(_0x585c0b[_0x877f('0x53')]['id']){delete _0x585c0b['body']['id'];}return db[_0x877f('0x4c')][_0x877f('0x52')]({'where':{'id':_0x585c0b[_0x877f('0x4f')]['id']}})[_0x877f('0x1f')](handleEntityNotFound(_0x74ecfb,null))['then'](saveUpdates(_0x585c0b['body'],null))[_0x877f('0x1f')](respondWithResult(_0x74ecfb,null))['catch'](handleError(_0x74ecfb,null));};exports[_0x877f('0x33')]=function(_0xc38c8c,_0x54d4e7){return db[_0x877f('0x4c')]['find']({'where':{'id':_0xc38c8c[_0x877f('0x4f')]['id']}})[_0x877f('0x1f')](handleEntityNotFound(_0x54d4e7,null))['then'](removeEntity(_0x54d4e7,null))[_0x877f('0x26')](handleError(_0x54d4e7,null));};exports[_0x877f('0x54')]=function(_0x458cff,_0x16cd7d){return db[_0x877f('0x4c')][_0x877f('0x54')]()[_0x877f('0x1f')](respondWithResult(_0x16cd7d,null))[_0x877f('0x26')](handleError(_0x16cd7d,null));};var interaction_log=require('../../config/logger')(_0x877f('0x55'));exports[_0x877f('0x56')]=function(_0xb9c6d7,_0x592995,_0x21c1df){var _0x5838eb={'agent':{},'channel':'fax'};if(_0xb9c6d7[_0x877f('0x53')]['id']){delete _0xb9c6d7['body']['id'];}_0xb9c6d7[_0x877f('0x53')][_0x877f('0x57')]=!![];_0xb9c6d7[_0x877f('0x53')][_0x877f('0x58')]=moment()[_0x877f('0x59')](_0x877f('0x5a'));_0xb9c6d7[_0x877f('0x53')][_0x877f('0x5b')]=_0xb9c6d7[_0x877f('0x53')]['UserId']||_0xb9c6d7[_0x877f('0x5c')]['id'];_0x5838eb[_0x877f('0x5d')]['id']=_0xb9c6d7[_0x877f('0x53')][_0x877f('0x5b')];return db['FaxMessage'][_0x877f('0x52')]({'where':{'id':_0xb9c6d7[_0x877f('0x4f')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x592995,null))[_0x877f('0x1f')](saveUpdates(_0xb9c6d7[_0x877f('0x53')],null))['then'](function(_0x364d59){if(_0x364d59){_0x5838eb['message']=_0x364d59[_0x877f('0x5e')]({'plain':!![]});return db[_0x877f('0x5f')][_0x877f('0x52')]({'where':{'id':_0x364d59[_0x877f('0x60')]}});}return null;})[_0x877f('0x1f')](handleEntityNotFound(_0x592995,null))[_0x877f('0x1f')](function(_0x3c9653){if(_0x3c9653){return _0x3c9653[_0x877f('0x32')]({'UserId':_0xb9c6d7[_0x877f('0x53')]['UserId'],'read1stAt':_[_0x877f('0x61')](_0x3c9653[_0x877f('0x62')])?moment()[_0x877f('0x59')](_0x877f('0x5a')):undefined});}return null;})[_0x877f('0x1f')](function(_0x44d34c){if(_0x44d34c){_0x5838eb[_0x877f('0x63')]=_0x44d34c['get']({'plain':!![]});interaction_log['info'](_0x877f('0x64'),_0xb9c6d7[_0x877f('0x5c')]['id'],_0xb9c6d7['user'][_0x877f('0x34')],_0xb9c6d7[_0x877f('0x5c')][_0x877f('0x65')],_0x5838eb[_0x877f('0x63')]['id'],_0xb9c6d7[_0x877f('0x53')]?JSON['stringify'](_0xb9c6d7[_0x877f('0x53')]):'null');return respondWithRpcPromise(_0x877f('0x66'),_0x877f('0x67'),_0x5838eb);}return null;})['then'](function(_0x3efb30){var _0x2d6c3c=_0x877f('0x68')+_0x3efb30['message'][_0x877f('0x69')];return db[_0x877f('0x6a')]['query'](_0x2d6c3c,{'type':db[_0x877f('0x6b')][_0x877f('0x6c')][_0x877f('0x6d')],'raw':!![]})['then'](function(_0x540ffb){return _0x540ffb;});})['then'](function(_0x354c15){if(_0x354c15){_0x5838eb[_0x877f('0x24')]['contact']=_0x354c15[0x0];if(!_0xb9c6d7[_0x877f('0x53')][_0x877f('0x5b')])return;return db[_0x877f('0x6e')][_0x877f('0x52')]({'where':{'id':_0xb9c6d7[_0x877f('0x53')][_0x877f('0x5b')],'role':'agent'},'attributes':['id',_0x877f('0x34'),_0x877f('0x6f'),_0x877f('0x70'),_0x877f('0x71')],'raw':!![]});}return null;})['then'](function(_0x466d0d){if(!_0x466d0d)return null;_0x5838eb[_0x877f('0x24')]['agent']=_0x466d0d;return _0x5838eb;})[_0x877f('0x1f')](function(_0x1d41ac){if(_0x1d41ac){if(_0xb9c6d7[_0x877f('0x53')]['manual']){_0x5838eb[_0x877f('0x24')]['interface']=util['format'](_0x877f('0x72'),_0xb9c6d7[_0x877f('0x5c')]['name']);_0x5838eb[_0x877f('0x24')]['channel']=_0x5838eb[_0x877f('0x73')];_0x5838eb[_0x877f('0x24')]['motionChannel']=_0x5838eb[_0x877f('0x73')];_0x5838eb['message'][_0x877f('0x74')]='accept';return respondWithRpcPromise(_0x877f('0x75'),'EventManager',{'event':_0x877f('0x76'),'message':_0x5838eb['message']},client9002)[_0x877f('0x1f')](function(){return _0x5838eb;});}return _0x5838eb;}return null;})[_0x877f('0x1f')](respondWithResult(_0x592995,null))[_0x877f('0x26')](handleError(_0x592995,null));};var interaction_log=require(_0x877f('0x77'))('fax-interactions');exports[_0x877f('0x30')]=function(_0x497fa8,_0x53b23c,_0x1c38f3){var _0x4202b9={'agent':{},'channel':_0x877f('0x78')};if(_0x497fa8[_0x877f('0x53')]['id']){delete _0x497fa8[_0x877f('0x53')]['id'];}_0x497fa8[_0x877f('0x53')][_0x877f('0x5b')]=_0x497fa8[_0x877f('0x53')][_0x877f('0x5b')]||_0x497fa8[_0x877f('0x5c')]['id'];_0x4202b9[_0x877f('0x5d')]['id']=_0x497fa8['body'][_0x877f('0x5b')];return db['FaxMessage'][_0x877f('0x52')]({'where':{'id':_0x497fa8['params']['id'],'UserId':null}})[_0x877f('0x1f')](handleEntityNotFound(_0x53b23c,null))['then'](function(_0x58ab6f){if(_0x58ab6f){_0x4202b9[_0x877f('0x24')]=_0x58ab6f[_0x877f('0x5e')]({'plain':!![]});return db['FaxInteraction'][_0x877f('0x52')]({'where':{'id':_0x58ab6f[_0x877f('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x53b23c,null))[_0x877f('0x1f')](function(_0x1e02a8){if(_0x1e02a8){_0x4202b9[_0x877f('0x63')]=_0x1e02a8[_0x877f('0x5e')]({'plain':!![]});interaction_log['info'](_0x877f('0x79'),_0x497fa8[_0x877f('0x5c')]['id'],_0x497fa8['user'][_0x877f('0x34')],_0x497fa8[_0x877f('0x5c')][_0x877f('0x65')],_0x4202b9[_0x877f('0x63')]['id'],_0x497fa8[_0x877f('0x53')]?JSON['stringify'](_0x497fa8[_0x877f('0x53')]):_0x877f('0x7a'));return respondWithRpcPromise(_0x877f('0x7b'),_0x877f('0x7c'),_0x4202b9);}return null;})[_0x877f('0x1f')](function(_0x24fbbe){var _0x292d3d=_0x877f('0x68')+_0x24fbbe[_0x877f('0x24')]['ContactId'];return db[_0x877f('0x6a')][_0x877f('0x3a')](_0x292d3d,{'type':db[_0x877f('0x6b')][_0x877f('0x6c')][_0x877f('0x6d')],'raw':!![]})['then'](function(_0x58f651){return _0x58f651;});})[_0x877f('0x1f')](function(_0x45858b){if(_0x45858b){_0x4202b9[_0x877f('0x24')]['contact']=_0x45858b[0x0];if(!_0x497fa8[_0x877f('0x53')][_0x877f('0x5b')])return;return db['User'][_0x877f('0x52')]({'where':{'id':_0x497fa8[_0x877f('0x53')][_0x877f('0x5b')],'role':_0x877f('0x5d')},'attributes':['id','name','fullname','email',_0x877f('0x71')],'raw':!![]});}return null;})[_0x877f('0x1f')](function(_0x50cad7){if(!_0x50cad7)return null;_0x4202b9[_0x877f('0x24')][_0x877f('0x5d')]=_0x50cad7;return _0x4202b9;})['then'](function(_0x41994a){if(_0x41994a){_0x41994a[_0x877f('0x24')]['interface']=util[_0x877f('0x59')](_0x877f('0x72'),_0x497fa8['user']['name']);_0x41994a[_0x877f('0x24')][_0x877f('0x73')]=_0x4202b9[_0x877f('0x73')];_0x41994a[_0x877f('0x24')][_0x877f('0x7d')]=_0x4202b9[_0x877f('0x73')];_0x41994a[_0x877f('0x24')][_0x877f('0x74')]=_0x877f('0x30');respondWithRpcPromise('EventManager',_0x877f('0x75'),{'event':_0x877f('0x7e'),'message':_0x41994a[_0x877f('0x24')]},client9002);return _0x4202b9;}return null;})[_0x877f('0x1f')](respondWithResult(_0x53b23c,null))[_0x877f('0x26')](handleError(_0x53b23c,null));};exports[_0x877f('0x7f')]=function(_0x402770,_0x3e605e){var _0x41bf16;return db[_0x877f('0x4c')][_0x877f('0x7f')](_0x402770[_0x877f('0x53')],{})[_0x877f('0x1f')](function(_0xbf2391){_0x41bf16=_0xbf2391;return db[_0x877f('0x80')][_0x877f('0x81')]({'where':{'id':_0x41bf16[_0x877f('0x69')]}});})[_0x877f('0x1f')](function(_0xbc46d1){if(_[_0x877f('0x61')](_0xbc46d1)){return;}else{_0x41bf16['fax']=_0xbc46d1['fax'];return db[_0x877f('0x82')][_0x877f('0x81')]({'where':{'id':_0x41bf16[_0x877f('0x83')]}});}})['then'](function(_0x5d0342){return respondWithRpcPromise(_0x877f('0x84'),_0x877f('0x84'),{'FaxAccountId':_[_0x877f('0x61')](_0x402770[_0x877f('0x53')])?undefined:_0x402770[_0x877f('0x53')][_0x877f('0x85')],'path':_['isNil'](_0x5d0342)?undefined:util['format']('/var/opt/motion2/server/files/attachments/%s',_0x5d0342['basename']),'fax':_['isNil'](_0x41bf16[_0x877f('0x78')])?undefined:_0x41bf16[_0x877f('0x78')],'AttachmentId':_0x41bf16['AttachmentId']},client9002);})[_0x877f('0x1f')](respondWithResult(_0x3e605e,0xc9))[_0x877f('0x26')](handleError(_0x3e605e,null));};exports[_0x877f('0x86')]=function(_0x3c4e57,_0x97c41c){var _0x5e6191=path[_0x877f('0x87')](config['root'],_0x877f('0x88'),_0x877f('0x89'),_0x877f('0x8a'));return db[_0x877f('0x4c')][_0x877f('0x52')]({'where':{'id':_0x3c4e57[_0x877f('0x4f')]['id']},'include':[{'model':db[_0x877f('0x82')],'as':'Attachment'}]})[_0x877f('0x1f')](handleEntityNotFound(_0x97c41c,null))[_0x877f('0x1f')](function(_0x28f399){if(_0x28f399){return _0x97c41c[_0x877f('0x86')](path['join'](_0x5e6191,_0x28f399[_0x877f('0x82')][_0x877f('0x8b')]));}})[_0x877f('0x26')](handleError(_0x97c41c,null));}; \ No newline at end of file +var _0x1dde=['../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','name','index','FaxMessage','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','VIRTUAL','options','includeAll','findAll','rows','show','include','merge','find','body','params','describe','fax-interactions','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','contact','User','fullname','internal','manual','interface','SIP/%s','channel','event','accept','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','rejectMessage','QueryTypes','SELECT','email','motionChannel','EventManager','rejectmessage','create','CmContact','findOne','Attachment','SendFax','FaxAccountId','basename','join','root','server','files','attachments','download','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x4fc5d0,_0x20445a){var _0xb9cdcb=function(_0xefafa4){while(--_0xefafa4){_0x4fc5d0['push'](_0x4fc5d0['shift']());}};_0xb9cdcb(++_0x20445a);}(_0x1dde,0x1aa));var _0xe1dd=function(_0x1f9bb9,_0x405d65){_0x1f9bb9=_0x1f9bb9-0x0;var _0x33333d=_0x1dde[_0x1f9bb9];return _0x33333d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe1dd('0x0'));var jsonpatch=require(_0xe1dd('0x1'));var rp=require(_0xe1dd('0x2'));var moment=require('moment');var BPromise=require(_0xe1dd('0x3'));var Mustache=require(_0xe1dd('0x4'));var util=require(_0xe1dd('0x5'));var path=require(_0xe1dd('0x6'));var sox=require(_0xe1dd('0x7'));var csv=require(_0xe1dd('0x8'));var ejs=require(_0xe1dd('0x9'));var fs=require('fs');var fs_extra=require(_0xe1dd('0xa'));var _=require(_0xe1dd('0xb'));var squel=require(_0xe1dd('0xc'));var crypto=require(_0xe1dd('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe1dd('0xe'));var Papa=require(_0xe1dd('0xf'));var Redis=require(_0xe1dd('0x10'));var authService=require(_0xe1dd('0x11'));var qs=require(_0xe1dd('0x12'));var as=require(_0xe1dd('0x13'));var hardwareService=require(_0xe1dd('0x14'));var logger=require(_0xe1dd('0x15'))(_0xe1dd('0x16'));var utils=require('../../config/utils');var config=require(_0xe1dd('0x17'));var licenseUtil=require(_0xe1dd('0x18'));var db=require(_0xe1dd('0x19'))['db'];config[_0xe1dd('0x1a')]=_[_0xe1dd('0x1b')](config[_0xe1dd('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xe1dd('0x1c'))(new Redis(config[_0xe1dd('0x1a')]));require(_0xe1dd('0x1d'))[_0xe1dd('0x1e')](socket);var jayson=require(_0xe1dd('0x1f'));var client=jayson[_0xe1dd('0x20')][_0xe1dd('0x21')]({'port':0x232c});var client9002=jayson[_0xe1dd('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11d83f,_0xd4b88e,_0x18c87c,_0x5a465f){return new BPromise(function(_0xe7ff7,_0x16e77b){var _0x273452=_0x5a465f||client;return _0x273452[_0xe1dd('0x22')](_0x11d83f,_0x18c87c)[_0xe1dd('0x23')](function(_0x3d15a0){logger[_0xe1dd('0x24')](_0xe1dd('0x25'),_0xd4b88e,_0xe1dd('0x26'));logger[_0xe1dd('0x27')](_0xe1dd('0x28'),_0xd4b88e,'request\x20sent',JSON['stringify'](_0x3d15a0));if(_0x3d15a0[_0xe1dd('0x29')]){if(_0x3d15a0['error'][_0xe1dd('0x2a')]===0x1f4){logger[_0xe1dd('0x29')](_0xe1dd('0x25'),_0xd4b88e,_0x3d15a0[_0xe1dd('0x29')][_0xe1dd('0x2b')]);return _0x16e77b(_0x3d15a0['error']['message']);}logger['error'](_0xe1dd('0x25'),_0xd4b88e,_0x3d15a0[_0xe1dd('0x29')][_0xe1dd('0x2b')]);return _0xe7ff7(_0x3d15a0[_0xe1dd('0x29')][_0xe1dd('0x2b')]);}else{logger[_0xe1dd('0x24')](_0xe1dd('0x25'),_0xd4b88e,_0xe1dd('0x26'));_0xe7ff7(_0x3d15a0[_0xe1dd('0x2c')]['message']);}})[_0xe1dd('0x2d')](function(_0x478ddb){logger[_0xe1dd('0x29')](_0xe1dd('0x25'),_0xd4b88e,_0x478ddb);_0x16e77b(_0x478ddb);});});}function respondWithStatusCode(_0x40c047,_0x57faba){_0x57faba=_0x57faba||0xcc;return function(_0x2f9e53){if(_0x2f9e53){return _0x40c047[_0xe1dd('0x2e')](_0x57faba);}return _0x40c047[_0xe1dd('0x2f')](_0x57faba)[_0xe1dd('0x30')]();};}function respondWithResult(_0x47eed1,_0x5f291b){_0x5f291b=_0x5f291b||0xc8;return function(_0x429bc3){if(_0x429bc3){return _0x47eed1[_0xe1dd('0x2f')](_0x5f291b)[_0xe1dd('0x31')](_0x429bc3);}};}function respondWithFilteredResult(_0x1374f7,_0xd50c39){return function(_0x43576f){if(_0x43576f){var _0x8db77a=typeof _0xd50c39[_0xe1dd('0x32')]===_0xe1dd('0x33')&&typeof _0xd50c39[_0xe1dd('0x34')]===_0xe1dd('0x33');var _0x4c6f2d=_0x43576f[_0xe1dd('0x35')];var _0x436c3a=_0x8db77a?0x0:_0xd50c39[_0xe1dd('0x32')];var _0xd31df9=_0x8db77a?_0x43576f['count']:_0xd50c39[_0xe1dd('0x32')]+_0xd50c39[_0xe1dd('0x34')];var _0x26db59;if(_0xd31df9>=_0x4c6f2d){_0xd31df9=_0x4c6f2d;_0x26db59=0xc8;}else{_0x26db59=0xce;}_0x1374f7[_0xe1dd('0x2f')](_0x26db59);return _0x1374f7[_0xe1dd('0x36')]('Content-Range',_0x436c3a+'-'+_0xd31df9+'/'+_0x4c6f2d)[_0xe1dd('0x31')](_0x43576f);}return null;};}function patchUpdates(_0x1a9726){return function(_0x416732){try{jsonpatch[_0xe1dd('0x37')](_0x416732,_0x1a9726,!![]);}catch(_0x350948){return BPromise[_0xe1dd('0x38')](_0x350948);}return _0x416732[_0xe1dd('0x39')]();};}function saveUpdates(_0x93550d,_0x2dd1da){return function(_0x5df14b){if(_0x5df14b){return _0x5df14b[_0xe1dd('0x3a')](_0x93550d)[_0xe1dd('0x23')](function(_0x415db0){return _0x415db0;});}return null;};}function removeEntity(_0x411dd6,_0x5cec34){return function(_0x25baeb){if(_0x25baeb){return _0x25baeb[_0xe1dd('0x3b')]()['then'](function(){_0x411dd6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x260eb3,_0x292ef9){return function(_0x12bbb5){if(!_0x12bbb5){_0x260eb3[_0xe1dd('0x2e')](0x194);}return _0x12bbb5;};}function handleError(_0x357074,_0x4bbc36){_0x4bbc36=_0x4bbc36||0x1f4;return function(_0x42587e){logger[_0xe1dd('0x29')](_0x42587e['stack']);if(_0x42587e[_0xe1dd('0x3c')]){delete _0x42587e[_0xe1dd('0x3c')];}_0x357074[_0xe1dd('0x2f')](_0x4bbc36)['send'](_0x42587e);};}exports[_0xe1dd('0x3d')]=function(_0x5c87ad,_0x344138){var _0xd51757={},_0xd45755={},_0x2256b2={'count':0x0,'rows':[]};var _0x300bad=_['map'](db[_0xe1dd('0x3e')][_0xe1dd('0x3f')],function(_0x1ee088){return{'name':_0x1ee088[_0xe1dd('0x40')],'type':_0x1ee088[_0xe1dd('0x41')][_0xe1dd('0x42')]};});_0xd45755[_0xe1dd('0x43')]=_[_0xe1dd('0x44')](_0x300bad,_0xe1dd('0x3c'));_0xd45755[_0xe1dd('0x45')]=_[_0xe1dd('0x46')](_0x5c87ad[_0xe1dd('0x45')]);_0xd45755['filters']=_['intersection'](_0xd45755['model'],_0xd45755[_0xe1dd('0x45')]);_0xd51757[_0xe1dd('0x47')]=_[_0xe1dd('0x48')](_0xd45755['model'],qs['fields'](_0x5c87ad[_0xe1dd('0x45')][_0xe1dd('0x49')]));_0xd51757[_0xe1dd('0x47')]=_0xd51757[_0xe1dd('0x47')][_0xe1dd('0x4a')]?_0xd51757['attributes']:_0xd45755[_0xe1dd('0x43')];if(!_0x5c87ad[_0xe1dd('0x45')][_0xe1dd('0x4b')](_0xe1dd('0x4c'))){_0xd51757[_0xe1dd('0x34')]=qs[_0xe1dd('0x34')](_0x5c87ad['query'][_0xe1dd('0x34')]);_0xd51757['offset']=qs[_0xe1dd('0x32')](_0x5c87ad[_0xe1dd('0x45')][_0xe1dd('0x32')]);}_0xd51757['order']=qs['sort'](_0x5c87ad[_0xe1dd('0x45')][_0xe1dd('0x4d')]);_0xd51757[_0xe1dd('0x4e')]=qs[_0xe1dd('0x4f')](_['pick'](_0x5c87ad[_0xe1dd('0x45')],_0xd45755[_0xe1dd('0x4f')]),_0x300bad);if(_0x5c87ad[_0xe1dd('0x45')][_0xe1dd('0x50')]){_0xd51757[_0xe1dd('0x4e')]=_['merge'](_0xd51757['where'],{'$or':_['map'](_0x300bad,function(_0x55dfe0){if(_0x55dfe0[_0xe1dd('0x41')]!==_0xe1dd('0x51')){var _0x3fa79b={};_0x3fa79b[_0x55dfe0[_0xe1dd('0x3c')]]={'$like':'%'+_0x5c87ad[_0xe1dd('0x45')][_0xe1dd('0x50')]+'%'};return _0x3fa79b;}})});}_0xd51757=_['merge']({},_0xd51757,_0x5c87ad[_0xe1dd('0x52')]);var _0x37f028={'where':_0xd51757[_0xe1dd('0x4e')]};return db['FaxMessage'][_0xe1dd('0x35')](_0x37f028)[_0xe1dd('0x23')](function(_0x2b0577){_0x2256b2[_0xe1dd('0x35')]=_0x2b0577;if(_0x5c87ad[_0xe1dd('0x45')][_0xe1dd('0x53')]){_0xd51757['include']=[{'all':!![]}];}return db[_0xe1dd('0x3e')][_0xe1dd('0x54')](_0xd51757);})[_0xe1dd('0x23')](function(_0x20b284){_0x2256b2[_0xe1dd('0x55')]=_0x20b284;return _0x2256b2;})[_0xe1dd('0x23')](respondWithFilteredResult(_0x344138,_0xd51757))[_0xe1dd('0x2d')](handleError(_0x344138,null));};exports[_0xe1dd('0x56')]=function(_0x3b63b7,_0x223295){var _0x5a4831={'raw':!![],'where':{'id':_0x3b63b7['params']['id']}},_0x4773ba={};_0x4773ba[_0xe1dd('0x43')]=_['keys'](db[_0xe1dd('0x3e')][_0xe1dd('0x3f')]);_0x4773ba['query']=_[_0xe1dd('0x46')](_0x3b63b7[_0xe1dd('0x45')]);_0x4773ba['filters']=_['intersection'](_0x4773ba['model'],_0x4773ba[_0xe1dd('0x45')]);_0x5a4831[_0xe1dd('0x47')]=_[_0xe1dd('0x48')](_0x4773ba[_0xe1dd('0x43')],qs['fields'](_0x3b63b7[_0xe1dd('0x45')][_0xe1dd('0x49')]));_0x5a4831[_0xe1dd('0x47')]=_0x5a4831[_0xe1dd('0x47')][_0xe1dd('0x4a')]?_0x5a4831[_0xe1dd('0x47')]:_0x4773ba[_0xe1dd('0x43')];if(_0x3b63b7[_0xe1dd('0x45')][_0xe1dd('0x53')]){_0x5a4831[_0xe1dd('0x57')]=[{'all':!![]}];}_0x5a4831=_[_0xe1dd('0x58')]({},_0x5a4831,_0x3b63b7[_0xe1dd('0x52')]);return db['FaxMessage'][_0xe1dd('0x59')](_0x5a4831)['then'](handleEntityNotFound(_0x223295,null))[_0xe1dd('0x23')](respondWithResult(_0x223295,null))['catch'](handleError(_0x223295,null));};exports[_0xe1dd('0x3a')]=function(_0x5473b1,_0x21157a){if(_0x5473b1[_0xe1dd('0x5a')]['id']){delete _0x5473b1[_0xe1dd('0x5a')]['id'];}return db['FaxMessage'][_0xe1dd('0x59')]({'where':{'id':_0x5473b1['params']['id']}})[_0xe1dd('0x23')](handleEntityNotFound(_0x21157a,null))['then'](saveUpdates(_0x5473b1[_0xe1dd('0x5a')],null))[_0xe1dd('0x23')](respondWithResult(_0x21157a,null))['catch'](handleError(_0x21157a,null));};exports['destroy']=function(_0x1936ea,_0x1cb34e){return db['FaxMessage'][_0xe1dd('0x59')]({'where':{'id':_0x1936ea[_0xe1dd('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1cb34e,null))[_0xe1dd('0x23')](removeEntity(_0x1cb34e,null))[_0xe1dd('0x2d')](handleError(_0x1cb34e,null));};exports[_0xe1dd('0x5c')]=function(_0x4e1926,_0x21fcb5){return db['FaxMessage'][_0xe1dd('0x5c')]()[_0xe1dd('0x23')](respondWithResult(_0x21fcb5,null))[_0xe1dd('0x2d')](handleError(_0x21fcb5,null));};var interaction_log=require(_0xe1dd('0x15'))(_0xe1dd('0x5d'));exports['accept']=function(_0x1b454b,_0x3ab9bf,_0xccbfda){var _0x31c3c3={'agent':{},'channel':_0xe1dd('0x5e')};if(_0x1b454b[_0xe1dd('0x5a')]['id']){delete _0x1b454b[_0xe1dd('0x5a')]['id'];}_0x1b454b['body'][_0xe1dd('0x5f')]=!![];_0x1b454b[_0xe1dd('0x5a')][_0xe1dd('0x60')]=moment()[_0xe1dd('0x61')](_0xe1dd('0x62'));_0x1b454b[_0xe1dd('0x5a')][_0xe1dd('0x63')]=_0x1b454b[_0xe1dd('0x5a')][_0xe1dd('0x63')]||_0x1b454b['user']['id'];_0x31c3c3[_0xe1dd('0x64')]['id']=_0x1b454b[_0xe1dd('0x5a')]['UserId'];return db[_0xe1dd('0x3e')][_0xe1dd('0x59')]({'where':{'id':_0x1b454b[_0xe1dd('0x5b')]['id'],'UserId':null}})[_0xe1dd('0x23')](handleEntityNotFound(_0x3ab9bf,null))['then'](saveUpdates(_0x1b454b['body'],null))[_0xe1dd('0x23')](function(_0x4142e9){if(_0x4142e9){_0x31c3c3['message']=_0x4142e9[_0xe1dd('0x65')]({'plain':!![]});return db[_0xe1dd('0x66')][_0xe1dd('0x59')]({'where':{'id':_0x4142e9[_0xe1dd('0x67')]}});}return null;})[_0xe1dd('0x23')](handleEntityNotFound(_0x3ab9bf,null))[_0xe1dd('0x23')](function(_0x5539d2){if(_0x5539d2){return _0x5539d2['update']({'UserId':_0x1b454b[_0xe1dd('0x5a')][_0xe1dd('0x63')],'read1stAt':_[_0xe1dd('0x68')](_0x5539d2[_0xe1dd('0x69')])?moment()['format'](_0xe1dd('0x62')):undefined});}return null;})['then'](function(_0x27aa16){if(_0x27aa16){_0x31c3c3[_0xe1dd('0x6a')]=_0x27aa16[_0xe1dd('0x65')]({'plain':!![]});interaction_log['info'](_0xe1dd('0x6b'),_0x1b454b[_0xe1dd('0x6c')]['id'],_0x1b454b[_0xe1dd('0x6c')][_0xe1dd('0x3c')],_0x1b454b['user'][_0xe1dd('0x6d')],_0x31c3c3[_0xe1dd('0x6a')]['id'],_0x1b454b[_0xe1dd('0x5a')]?JSON['stringify'](_0x1b454b[_0xe1dd('0x5a')]):_0xe1dd('0x6e'));return respondWithRpcPromise('AcceptMessage',_0xe1dd('0x6f'),_0x31c3c3);}return null;})[_0xe1dd('0x23')](function(_0x203642){var _0x40c75e=_0xe1dd('0x70')+_0x203642[_0xe1dd('0x2b')][_0xe1dd('0x71')];return db[_0xe1dd('0x72')][_0xe1dd('0x45')](_0x40c75e,{'type':db[_0xe1dd('0x73')]['QueryTypes']['SELECT'],'raw':!![]})[_0xe1dd('0x23')](function(_0xec1d1e){return _0xec1d1e;});})[_0xe1dd('0x23')](function(_0x58aa99){if(_0x58aa99){_0x31c3c3['message'][_0xe1dd('0x74')]=_0x58aa99[0x0];if(!_0x1b454b['body']['UserId'])return;return db[_0xe1dd('0x75')]['find']({'where':{'id':_0x1b454b[_0xe1dd('0x5a')][_0xe1dd('0x63')],'role':_0xe1dd('0x64')},'attributes':['id',_0xe1dd('0x3c'),_0xe1dd('0x76'),'email',_0xe1dd('0x77')],'raw':!![]});}return null;})[_0xe1dd('0x23')](function(_0x380e75){if(!_0x380e75)return null;_0x31c3c3[_0xe1dd('0x2b')][_0xe1dd('0x64')]=_0x380e75;return _0x31c3c3;})[_0xe1dd('0x23')](function(_0x3a8d13){if(_0x3a8d13){if(_0x1b454b[_0xe1dd('0x5a')][_0xe1dd('0x78')]){_0x31c3c3[_0xe1dd('0x2b')][_0xe1dd('0x79')]=util[_0xe1dd('0x61')](_0xe1dd('0x7a'),_0x1b454b['user']['name']);_0x31c3c3[_0xe1dd('0x2b')][_0xe1dd('0x7b')]=_0x31c3c3[_0xe1dd('0x7b')];_0x31c3c3[_0xe1dd('0x2b')]['motionChannel']=_0x31c3c3['channel'];_0x31c3c3[_0xe1dd('0x2b')][_0xe1dd('0x7c')]=_0xe1dd('0x7d');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x31c3c3[_0xe1dd('0x2b')]},client9002)[_0xe1dd('0x23')](function(){return _0x31c3c3;});}return _0x31c3c3;}return null;})[_0xe1dd('0x23')](respondWithResult(_0x3ab9bf,null))[_0xe1dd('0x2d')](handleError(_0x3ab9bf,null));};var interaction_log=require(_0xe1dd('0x15'))(_0xe1dd('0x5d'));exports[_0xe1dd('0x38')]=function(_0x2c5cc9,_0x2785c1,_0x399703){var _0x37a7b5={'agent':{},'channel':_0xe1dd('0x5e')};if(_0x2c5cc9[_0xe1dd('0x5a')]['id']){delete _0x2c5cc9[_0xe1dd('0x5a')]['id'];}_0x2c5cc9[_0xe1dd('0x5a')]['UserId']=_0x2c5cc9[_0xe1dd('0x5a')][_0xe1dd('0x63')]||_0x2c5cc9[_0xe1dd('0x6c')]['id'];_0x37a7b5['agent']['id']=_0x2c5cc9[_0xe1dd('0x5a')][_0xe1dd('0x63')];return db[_0xe1dd('0x3e')]['find']({'where':{'id':_0x2c5cc9[_0xe1dd('0x5b')]['id'],'UserId':null}})[_0xe1dd('0x23')](handleEntityNotFound(_0x2785c1,null))[_0xe1dd('0x23')](function(_0x305dc7){if(_0x305dc7){_0x37a7b5[_0xe1dd('0x2b')]=_0x305dc7[_0xe1dd('0x65')]({'plain':!![]});return db[_0xe1dd('0x66')]['find']({'where':{'id':_0x305dc7[_0xe1dd('0x67')]}});}return null;})[_0xe1dd('0x23')](handleEntityNotFound(_0x2785c1,null))['then'](function(_0x360a5f){if(_0x360a5f){_0x37a7b5['interaction']=_0x360a5f[_0xe1dd('0x65')]({'plain':!![]});interaction_log['info'](_0xe1dd('0x7e'),_0x2c5cc9['user']['id'],_0x2c5cc9['user'][_0xe1dd('0x3c')],_0x2c5cc9['user']['role'],_0x37a7b5['interaction']['id'],_0x2c5cc9[_0xe1dd('0x5a')]?JSON[_0xe1dd('0x7f')](_0x2c5cc9[_0xe1dd('0x5a')]):_0xe1dd('0x6e'));return respondWithRpcPromise(_0xe1dd('0x80'),_0xe1dd('0x81'),_0x37a7b5);}return null;})[_0xe1dd('0x23')](function(_0x1862dc){var _0x89d559=_0xe1dd('0x70')+_0x1862dc['message'][_0xe1dd('0x71')];return db['sequelize'][_0xe1dd('0x45')](_0x89d559,{'type':db[_0xe1dd('0x73')][_0xe1dd('0x82')][_0xe1dd('0x83')],'raw':!![]})['then'](function(_0x47135c){return _0x47135c;});})[_0xe1dd('0x23')](function(_0x21f738){if(_0x21f738){_0x37a7b5[_0xe1dd('0x2b')][_0xe1dd('0x74')]=_0x21f738[0x0];if(!_0x2c5cc9[_0xe1dd('0x5a')]['UserId'])return;return db[_0xe1dd('0x75')][_0xe1dd('0x59')]({'where':{'id':_0x2c5cc9[_0xe1dd('0x5a')][_0xe1dd('0x63')],'role':_0xe1dd('0x64')},'attributes':['id',_0xe1dd('0x3c'),_0xe1dd('0x76'),_0xe1dd('0x84'),_0xe1dd('0x77')],'raw':!![]});}return null;})[_0xe1dd('0x23')](function(_0xc6986b){if(!_0xc6986b)return null;_0x37a7b5[_0xe1dd('0x2b')]['agent']=_0xc6986b;return _0x37a7b5;})[_0xe1dd('0x23')](function(_0x4c8700){if(_0x4c8700){_0x4c8700[_0xe1dd('0x2b')][_0xe1dd('0x79')]=util[_0xe1dd('0x61')](_0xe1dd('0x7a'),_0x2c5cc9['user'][_0xe1dd('0x3c')]);_0x4c8700[_0xe1dd('0x2b')][_0xe1dd('0x7b')]=_0x37a7b5[_0xe1dd('0x7b')];_0x4c8700[_0xe1dd('0x2b')][_0xe1dd('0x85')]=_0x37a7b5[_0xe1dd('0x7b')];_0x4c8700['message'][_0xe1dd('0x7c')]=_0xe1dd('0x38');respondWithRpcPromise(_0xe1dd('0x86'),_0xe1dd('0x86'),{'event':_0xe1dd('0x87'),'message':_0x4c8700[_0xe1dd('0x2b')]},client9002);return _0x37a7b5;}return null;})[_0xe1dd('0x23')](respondWithResult(_0x2785c1,null))[_0xe1dd('0x2d')](handleError(_0x2785c1,null));};exports[_0xe1dd('0x88')]=function(_0x5dce96,_0x2cf66){var _0x389671;return db[_0xe1dd('0x3e')][_0xe1dd('0x88')](_0x5dce96[_0xe1dd('0x5a')],{})[_0xe1dd('0x23')](function(_0x5f3b32){_0x389671=_0x5f3b32;return db[_0xe1dd('0x89')][_0xe1dd('0x8a')]({'where':{'id':_0x389671['ContactId']}});})[_0xe1dd('0x23')](function(_0x47ee2d){if(_[_0xe1dd('0x68')](_0x47ee2d)){return;}else{_0x389671[_0xe1dd('0x5e')]=_0x47ee2d[_0xe1dd('0x5e')];return db[_0xe1dd('0x8b')][_0xe1dd('0x8a')]({'where':{'id':_0x389671['AttachmentId']}});}})[_0xe1dd('0x23')](function(_0x2b4327){return respondWithRpcPromise(_0xe1dd('0x8c'),_0xe1dd('0x8c'),{'FaxAccountId':_[_0xe1dd('0x68')](_0x5dce96[_0xe1dd('0x5a')])?undefined:_0x5dce96[_0xe1dd('0x5a')][_0xe1dd('0x8d')],'path':_['isNil'](_0x2b4327)?undefined:util[_0xe1dd('0x61')]('/var/opt/motion2/server/files/attachments/%s',_0x2b4327[_0xe1dd('0x8e')]),'fax':_[_0xe1dd('0x68')](_0x389671['fax'])?undefined:_0x389671[_0xe1dd('0x5e')],'AttachmentId':_0x389671['AttachmentId']},client9002);})[_0xe1dd('0x23')](respondWithResult(_0x2cf66,0xc9))[_0xe1dd('0x2d')](handleError(_0x2cf66,null));};exports['download']=function(_0x426d15,_0x597c90){var _0x61b76e=path[_0xe1dd('0x8f')](config[_0xe1dd('0x90')],_0xe1dd('0x91'),_0xe1dd('0x92'),_0xe1dd('0x93'));return db[_0xe1dd('0x3e')][_0xe1dd('0x59')]({'where':{'id':_0x426d15['params']['id']},'include':[{'model':db['Attachment'],'as':_0xe1dd('0x8b')}]})['then'](handleEntityNotFound(_0x597c90,null))[_0xe1dd('0x23')](function(_0x18bc19){if(_0x18bc19){return _0x597c90[_0xe1dd('0x94')](path[_0xe1dd('0x8f')](_0x61b76e,_0x18bc19[_0xe1dd('0x8b')][_0xe1dd('0x8e')]));}})[_0xe1dd('0x2d')](handleError(_0x597c90,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 4ea778c..63d9116 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 _0x084b=['hasOwnProperty','hook','exports','events','save','update','emit'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x084b,0xd5));var _0xb084=function(_0x225b40,_0xc6d52a){_0x225b40=_0x225b40-0x0;var _0x5a31bc=_0x084b[_0x225b40];return _0x5a31bc;};'use strict';var EventEmitter=require(_0xb084('0x0'));var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb084('0x1'),'afterUpdate':_0xb084('0x2'),'afterDestroy':'remove'};function emitEvent(_0x6d9ca7){return function(_0x1be44c,_0x45422d,_0x5dabbb){FaxMessageEvents[_0xb084('0x3')](_0x6d9ca7+':'+_0x1be44c['id'],_0x1be44c);FaxMessageEvents['emit'](_0x6d9ca7,_0x1be44c);_0x5dabbb(null);};}for(var e in events){if(events[_0xb084('0x4')](e)){var event=events[e];FaxMessage[_0xb084('0x5')](e,emitEvent(event));}}module[_0xb084('0x6')]=FaxMessageEvents; \ No newline at end of file +var _0x07d7=['exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2349f5,_0x2a8ea2){var _0x227de2=function(_0x422c02){while(--_0x422c02){_0x2349f5['push'](_0x2349f5['shift']());}};_0x227de2(++_0x2a8ea2);}(_0x07d7,0x85));var _0x707d=function(_0x550e29,_0x4047f){_0x550e29=_0x550e29-0x0;var _0x3515b6=_0x07d7[_0x550e29];return _0x3515b6;};'use strict';var EventEmitter=require(_0x707d('0x0'));var FaxMessage=require(_0x707d('0x1'))['db'][_0x707d('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x707d('0x3')](0x0);var events={'afterCreate':_0x707d('0x4'),'afterUpdate':_0x707d('0x5'),'afterDestroy':_0x707d('0x6')};function emitEvent(_0x3d6fed){return function(_0x38c520,_0x2a5ddd,_0x3b44c7){FaxMessageEvents[_0x707d('0x7')](_0x3d6fed+':'+_0x38c520['id'],_0x38c520);FaxMessageEvents[_0x707d('0x7')](_0x3d6fed,_0x38c520);_0x3b44c7(null);};}for(var e in events){if(events[_0x707d('0x8')](e)){var event=events[e];FaxMessage[_0x707d('0x9')](e,emitEvent(event));}}module[_0x707d('0xa')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index e6fdb58..f776e8a 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 _0x0abf=['./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','catch','error','utf8mb4','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x0abf,0xf0));var _0xf0ab=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x0abf[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xf0ab('0x0'));var util=require(_0xf0ab('0x1'));var logger=require('../../config/logger')(_0xf0ab('0x2'));var moment=require(_0xf0ab('0x3'));var BPromise=require('bluebird');var rp=require(_0xf0ab('0x4'));var fs=require('fs');var path=require(_0xf0ab('0x5'));var rimraf=require(_0xf0ab('0x6'));var config=require(_0xf0ab('0x7'));var attributes=require(_0xf0ab('0x8'));module[_0xf0ab('0x9')]=function(_0x4cf109,_0x2c9391){return _0x4cf109[_0xf0ab('0xa')](_0xf0ab('0xb'),attributes,{'tableName':_0xf0ab('0xc'),'paranoid':![],'indexes':[{'name':_0xf0ab('0xd'),'fields':['body'],'type':_0xf0ab('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3e4792,_0x426c16,_0x451a6f){var _0x293386=_0x4cf109[_0xf0ab('0xf')];var _0x3e1985=_0x3e4792[_0xf0ab('0x10')]({'plain':!![]});if(_0x3e1985['direction'][_0xf0ab('0x11')]()==='in'||_0x3e1985[_0xf0ab('0x12')][_0xf0ab('0x11')]()===_0xf0ab('0x13')&&!_0x3e1985[_0xf0ab('0x14')]&&!_[_0xf0ab('0x15')](_0x3e1985[_0xf0ab('0x16')])){_0x293386[_0xf0ab('0x17')][_0xf0ab('0x18')]({'where':{'id':_0x3e1985[_0xf0ab('0x19')]}})[_0xf0ab('0x1a')](function(_0x375708){if(_0x375708){_0x375708[_0xf0ab('0x1b')]({'lastMsgAt':_0x3e1985['createdAt'],'lastMsgDirection':_0x3e1985[_0xf0ab('0x12')][_0xf0ab('0x11')]()});}})[_0xf0ab('0x1c')](function(_0x2c003c){console[_0xf0ab('0x1d')](_0x2c003c);});}_0x451a6f();}},'charset':_0xf0ab('0x1e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x717a=['lodash','util','api','bluebird','path','./faxMessage.attributes','define','fax_messages','FULLTEXT','get','direction','toLowerCase','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','catch','error'];(function(_0x563a53,_0x3d6563){var _0x4206ed=function(_0xd87722){while(--_0xd87722){_0x563a53['push'](_0x563a53['shift']());}};_0x4206ed(++_0x3d6563);}(_0x717a,0x11e));var _0xa717=function(_0x504df1,_0x289598){_0x504df1=_0x504df1-0x0;var _0x1063b5=_0x717a[_0x504df1];return _0x1063b5;};'use strict';var _=require(_0xa717('0x0'));var util=require(_0xa717('0x1'));var logger=require('../../config/logger')(_0xa717('0x2'));var moment=require('moment');var BPromise=require(_0xa717('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa717('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa717('0x5'));module['exports']=function(_0x113649,_0x1f7d7b){return _0x113649[_0xa717('0x6')]('FaxMessage',attributes,{'tableName':_0xa717('0x7'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':_0xa717('0x8')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x23ef05,_0x3be518,_0x21802f){var _0x417e21=_0x113649['models'];var _0x375933=_0x23ef05[_0xa717('0x9')]({'plain':!![]});if(_0x375933[_0xa717('0xa')]['toLowerCase']()==='in'||_0x375933[_0xa717('0xa')][_0xa717('0xb')]()==='out'&&!_0x375933[_0xa717('0xc')]&&!_[_0xa717('0xd')](_0x375933[_0xa717('0xe')])){_0x417e21[_0xa717('0xf')][_0xa717('0x10')]({'where':{'id':_0x375933[_0xa717('0x11')]}})[_0xa717('0x12')](function(_0x3cc158){if(_0x3cc158){_0x3cc158[_0xa717('0x13')]({'lastMsgAt':_0x375933['createdAt'],'lastMsgDirection':_0x375933['direction'][_0xa717('0xb')]()});}})[_0xa717('0x14')](function(_0x30905d){console[_0xa717('0x15')](_0x30905d);});}_0x21802f();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 98cd4e6..072f56f 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 _0x9c44=['code','message','info','catch','FaxMessage','create','body','options','CreateFaxMessage','stringify','UpdateFaxMessage','update','raw','where','attributes','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0x9c44,0x178));var _0x49c4=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9c44[_0x543084];return _0x306a57;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});config[_0x49c4('0x9')]=_[_0x49c4('0xa')](config[_0x49c4('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x49c4('0xb'))(new Redis(config[_0x49c4('0x9')]));require(_0x49c4('0xc'))[_0x49c4('0xd')](socket);function respondWithRpcPromise(_0x4c7d3a,_0x5ab4a3,_0x451ea6){return new BPromise(function(_0x313e73,_0x58cad7){return client[_0x49c4('0xe')](_0x4c7d3a,_0x451ea6)[_0x49c4('0xf')](function(_0x4adb3c){logger['info'](_0x49c4('0x10'),_0x5ab4a3,_0x49c4('0x11'));logger['debug'](_0x49c4('0x12'),_0x5ab4a3,_0x49c4('0x11'),JSON['stringify'](_0x4adb3c));if(_0x4adb3c[_0x49c4('0x13')]){if(_0x4adb3c[_0x49c4('0x13')][_0x49c4('0x14')]===0x1f4){logger[_0x49c4('0x13')](_0x49c4('0x10'),_0x5ab4a3,_0x4adb3c[_0x49c4('0x13')][_0x49c4('0x15')]);return _0x58cad7(_0x4adb3c[_0x49c4('0x13')]['message']);}logger[_0x49c4('0x13')](_0x49c4('0x10'),_0x5ab4a3,_0x4adb3c[_0x49c4('0x13')][_0x49c4('0x15')]);return _0x313e73(_0x4adb3c[_0x49c4('0x13')]['message']);}else{logger[_0x49c4('0x16')](_0x49c4('0x10'),_0x5ab4a3,'request\x20sent');_0x313e73(_0x4adb3c['result'][_0x49c4('0x15')]);}})[_0x49c4('0x17')](function(_0x3addb2){logger['error'](_0x49c4('0x10'),_0x5ab4a3,_0x3addb2);_0x58cad7(_0x3addb2);});});}exports['CreateFaxMessage']=function(_0x2cbd50){var _0x1806c2=this;return new Promise(function(_0xe31fcc,_0x291526){return db[_0x49c4('0x18')][_0x49c4('0x19')](_0x2cbd50[_0x49c4('0x1a')],{'raw':_0x2cbd50[_0x49c4('0x1b')]?_0x2cbd50[_0x49c4('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x57f502){logger[_0x49c4('0x16')]('CreateFaxMessage',_0x2cbd50);logger['debug'](_0x49c4('0x1c'),_0x2cbd50,JSON[_0x49c4('0x1d')](_0x57f502));_0xe31fcc(_0x57f502);})[_0x49c4('0x17')](function(_0xd335e4){logger['error']('CreateFaxMessage',_0xd335e4[_0x49c4('0x15')],_0x2cbd50);_0x291526(_0x1806c2[_0x49c4('0x13')](0x1f4,_0xd335e4['message']));});});};exports[_0x49c4('0x1e')]=function(_0x43e014){var _0x210159=this;return new Promise(function(_0xa7a826,_0x531d92){return db['FaxMessage'][_0x49c4('0x1f')](_0x43e014['body'],{'raw':_0x43e014[_0x49c4('0x1b')]?_0x43e014[_0x49c4('0x1b')][_0x49c4('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43e014[_0x49c4('0x1b')]?_0x43e014['options'][_0x49c4('0x21')]||null:null,'attributes':_0x43e014[_0x49c4('0x1b')]?_0x43e014[_0x49c4('0x1b')][_0x49c4('0x22')]||null:null,'limit':_0x43e014[_0x49c4('0x1b')]?_0x43e014[_0x49c4('0x1b')][_0x49c4('0x23')]||null:null})[_0x49c4('0xf')](function(_0x17b50f){logger[_0x49c4('0x16')](_0x49c4('0x1e'),_0x43e014);logger['debug']('UpdateFaxMessage',_0x43e014,JSON['stringify'](_0x17b50f));_0xa7a826(_0x17b50f);})[_0x49c4('0x17')](function(_0x7ee704){logger[_0x49c4('0x13')](_0x49c4('0x1e'),_0x7ee704[_0x49c4('0x15')],_0x43e014);_0x531d92(_0x210159['error'](0x1f4,_0x7ee704[_0x49c4('0x15')]));});});}; \ No newline at end of file +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(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xa8a8,0xec));var _0x8a8a=function(_0x400e76,_0x337acd){_0x400e76=_0x400e76-0x0;var _0x3c969c=_0xa8a8[_0x400e76];return _0x3c969c;};'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 diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index c943d70..bb18970 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 _0x18ba=['update','emit','removeListener','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x18ba,0x143));var _0xa18b=function(_0x3c6535,_0x2656f6){_0x3c6535=_0x3c6535-0x0;var _0x2a49fa=_0x18ba[_0x3c6535];return _0x2a49fa;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0xa18b('0x0'),_0xa18b('0x1'),_0xa18b('0x2')];function createListener(_0x2de925,_0x125750){return function(_0x365ba4){_0x125750[_0xa18b('0x3')](_0x2de925,_0x365ba4);};}function removeListener(_0x8cad1e,_0xce185d){return function(){FaxMessageEvents[_0xa18b('0x4')](_0x8cad1e,_0xce185d);};}exports['register']=function(_0x342be4){for(var _0x4e33a1=0x0,_0x187059=events['length'];_0x4e33a1<_0x187059;_0x4e33a1++){var _0x246c4e=events[_0x4e33a1];var _0x33e6cc=createListener('faxMessage:'+_0x246c4e,_0x342be4);FaxMessageEvents['on'](_0x246c4e,_0x33e6cc);}}; \ No newline at end of file +var _0x5df8=['remove','update','removeListener','register','length','faxMessage:','save'];(function(_0x5efe63,_0x1a6f74){var _0x3397b3=function(_0x2d322d){while(--_0x2d322d){_0x5efe63['push'](_0x5efe63['shift']());}};_0x3397b3(++_0x1a6f74);}(_0x5df8,0x172));var _0x85df=function(_0x28c6f1,_0x5b0cd9){_0x28c6f1=_0x28c6f1-0x0;var _0x45d430=_0x5df8[_0x28c6f1];return _0x45d430;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x85df('0x0'),_0x85df('0x1'),_0x85df('0x2')];function createListener(_0x3031be,_0x571827){return function(_0x33490d){_0x571827['emit'](_0x3031be,_0x33490d);};}function removeListener(_0x54377e,_0x1e8b4c){return function(){FaxMessageEvents[_0x85df('0x3')](_0x54377e,_0x1e8b4c);};}exports[_0x85df('0x4')]=function(_0x960546){for(var _0x2fd8ea=0x0,_0xaa4357=events[_0x85df('0x5')];_0x2fd8ea<_0xaa4357;_0x2fd8ea++){var _0x445f45=events[_0x2fd8ea];var _0x45a1dd=createListener(_0x85df('0x6')+_0x445f45,_0x960546);FaxMessageEvents['on'](_0x445f45,_0x45a1dd);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index dfb115c..ba81446 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 _0xb43b=['update','/:id/reject','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','index','/describe','isAuthenticated','describe','get','/:id','show','download','post','tracked','fax','create','put'];(function(_0x34b495,_0x1083b2){var _0xb3b03c=function(_0x4e2c17){while(--_0x4e2c17){_0x34b495['push'](_0x34b495['shift']());}};_0xb3b03c(++_0x1083b2);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5f660e,_0x406848){_0x5f660e=_0x5f660e-0x0;var _0x5ca5f0=_0xb43b[_0x5f660e];return _0x5ca5f0;};'use strict';var multer=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var path=require('path');var timeout=require(_0xbb43('0x2'));var express=require(_0xbb43('0x3'));var router=express[_0xbb43('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbb43('0x5'));var interaction=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var controller=require(_0xbb43('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xbb43('0x9')]);router['get'](_0xbb43('0xa'),auth[_0xbb43('0xb')](),controller[_0xbb43('0xc')]);router[_0xbb43('0xd')](_0xbb43('0xe'),auth['isAuthenticated'](),controller[_0xbb43('0xf')]);router[_0xbb43('0xd')]('/:id/download',auth[_0xbb43('0xb')](),controller[_0xbb43('0x10')]);router[_0xbb43('0x11')]('/',auth[_0xbb43('0xb')](),interaction[_0xbb43('0x12')](_0xbb43('0x13'),'faxmessage:create'),controller[_0xbb43('0x14')]);router[_0xbb43('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xbb43('0x16')]);router['put']('/:id/accept',auth[_0xbb43('0xb')](),controller['accept']);router[_0xbb43('0x15')](_0xbb43('0x17'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0xbb43('0xe'),auth[_0xbb43('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb7e7=['get','/describe','describe','/:id','isAuthenticated','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','update','/:id/reject','reject','delete','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./faxMessage.controller','index'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb7e7,0x121));var _0x7b7e=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xb7e7[_0x39096d];return _0x13da4f;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x8')](_0x7b7e('0xb'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0x8')](_0x7b7e('0xe'),auth['isAuthenticated'](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x10')]('/',auth[_0x7b7e('0xc')](),interaction[_0x7b7e('0x11')](_0x7b7e('0x12'),_0x7b7e('0x13')),controller[_0x7b7e('0x14')]);router[_0x7b7e('0x15')](_0x7b7e('0xb'),auth['isAuthenticated'](),controller[_0x7b7e('0x16')]);router[_0x7b7e('0x15')]('/:id/accept',auth[_0x7b7e('0xc')](),controller['accept']);router['put'](_0x7b7e('0x17'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x18')]);router[_0x7b7e('0x19')](_0x7b7e('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x7b7e('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 2baf32c..6902021 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 _0x86da=['exports','STRING','INTEGER','rrmemory','beepall','roundrobin','sequelize'];(function(_0x5e05ff,_0x716c06){var _0x2b7dd2=function(_0x24ad11){while(--_0x24ad11){_0x5e05ff['push'](_0x5e05ff['shift']());}};_0x2b7dd2(++_0x716c06);}(_0x86da,0xfb));var _0xa86d=function(_0x32738a,_0x2f4dcd){_0x32738a=_0x32738a-0x0;var _0x404c12=_0x86da[_0x32738a];return _0x404c12;};'use strict';var Sequelize=require(_0xa86d('0x0'));module[_0xa86d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa86d('0x2')]},'timeout':{'type':Sequelize[_0xa86d('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xa86d('0x4'),_0xa86d('0x5'),_0xa86d('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xa86d('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2385=['beepall','roundrobin','sequelize','name','INTEGER','ENUM'];(function(_0x3a4e77,_0x3349ba){var _0x35a151=function(_0x3fb70b){while(--_0x3fb70b){_0x3a4e77['push'](_0x3a4e77['shift']());}};_0x35a151(++_0x3349ba);}(_0x2385,0x164));var _0x5238=function(_0x31a8a0,_0x179e60){_0x31a8a0=_0x31a8a0-0x0;var _0x351c18=_0x2385[_0x31a8a0];return _0x351c18;};'use strict';var Sequelize=require(_0x5238('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x5238('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x5238('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5238('0x3')]('rrmemory',_0x5238('0x4'),_0x5238('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'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 fceb031..4ee6068 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 _0x2d03=['flatMap','sequelize','each','forEach','emit','userFaxQueue:save','removeTeams','select','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','TeamId','compact','value','transaction','addAgents','omit','removeAgents','userFaxQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then','destroy','UserProfileResource','error','stack','name','send','map','FaxQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','intersection','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','FaxQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','UserFaxQueue','FaxQueueId','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','%s/%s','SIP','findOne','Team','getTeams','addTeams','ids','User','Agents','online','voicePause','interface'];(function(_0x89e873,_0x29457e){var _0x2e3c11=function(_0x3610de){while(--_0x3610de){_0x89e873['push'](_0x89e873['shift']());}};_0x2e3c11(++_0x29457e);}(_0x2d03,0x1c2));var _0x32d0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2d03[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x32d0('0x0'));var rimraf=require(_0x32d0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x32d0('0x2'));var rp=require(_0x32d0('0x3'));var moment=require(_0x32d0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x32d0('0x5'));var util=require(_0x32d0('0x6'));var path=require(_0x32d0('0x7'));var sox=require(_0x32d0('0x8'));var csv=require(_0x32d0('0x9'));var ejs=require(_0x32d0('0xa'));var fs=require('fs');var fs_extra=require(_0x32d0('0xb'));var _=require(_0x32d0('0xc'));var squel=require('squel');var crypto=require(_0x32d0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x32d0('0xe'));var toCsv=require(_0x32d0('0x9'));var querystring=require('querystring');var Papa=require(_0x32d0('0xf'));var Redis=require(_0x32d0('0x10'));var authService=require(_0x32d0('0x11'));var qs=require(_0x32d0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32d0('0x13'));var logger=require(_0x32d0('0x14'))(_0x32d0('0x15'));var utils=require(_0x32d0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32d0('0x17'));var db=require(_0x32d0('0x18'))['db'];config['redis']=_[_0x32d0('0x19')](config[_0x32d0('0x1a')],{'host':_0x32d0('0x1b'),'port':0x18eb});var socket=require(_0x32d0('0x1c'))(new Redis(config[_0x32d0('0x1a')]));require('./faxQueue.socket')[_0x32d0('0x1d')](socket);function respondWithStatusCode(_0x5e4211,_0xf9d25c){_0xf9d25c=_0xf9d25c||0xcc;return function(_0x101fa6){if(_0x101fa6){return _0x5e4211[_0x32d0('0x1e')](_0xf9d25c);}return _0x5e4211['status'](_0xf9d25c)[_0x32d0('0x1f')]();};}function respondWithResult(_0x18721f,_0x27e3af){_0x27e3af=_0x27e3af||0xc8;return function(_0x195ad0){if(_0x195ad0){return _0x18721f[_0x32d0('0x20')](_0x27e3af)['json'](_0x195ad0);}};}function respondWithFilteredResult(_0x868f29,_0x19f578){return function(_0x16cd79){if(_0x16cd79){var _0x4eb2de=typeof _0x19f578[_0x32d0('0x21')]===_0x32d0('0x22')&&typeof _0x19f578['limit']===_0x32d0('0x22');var _0x34a91=_0x16cd79[_0x32d0('0x23')];var _0x3d2e81=_0x4eb2de?0x0:_0x19f578[_0x32d0('0x21')];var _0x5060c2=_0x4eb2de?_0x16cd79[_0x32d0('0x23')]:_0x19f578[_0x32d0('0x21')]+_0x19f578[_0x32d0('0x24')];var _0x1acc10;if(_0x5060c2>=_0x34a91){_0x5060c2=_0x34a91;_0x1acc10=0xc8;}else{_0x1acc10=0xce;}_0x868f29[_0x32d0('0x20')](_0x1acc10);return _0x868f29[_0x32d0('0x25')](_0x32d0('0x26'),_0x3d2e81+'-'+_0x5060c2+'/'+_0x34a91)[_0x32d0('0x27')](_0x16cd79);}return null;};}function patchUpdates(_0x530ed2){return function(_0xecc56f){try{jsonpatch[_0x32d0('0x28')](_0xecc56f,_0x530ed2,!![]);}catch(_0x523cc3){return BPromise[_0x32d0('0x29')](_0x523cc3);}return _0xecc56f['save']();};}function saveUpdates(_0x4a6e7a,_0x40c62b){return function(_0x2d8aae){if(_0x2d8aae){return _0x2d8aae[_0x32d0('0x2a')](_0x4a6e7a)[_0x32d0('0x2b')](function(_0xb55abb){return _0xb55abb;});}return null;};}function removeEntity(_0x214877,_0x39563a){return function(_0x2a3625){if(_0x2a3625){return _0x2a3625[_0x32d0('0x2c')]()['then'](function(){var _0x3328f5=_0x2a3625['get']({'plain':!![]});var _0x3cd123='FaxQueues';return db[_0x32d0('0x2d')][_0x32d0('0x2c')]({'where':{'type':_0x3cd123,'resourceId':_0x3328f5['id']}})[_0x32d0('0x2b')](function(){return _0x2a3625;});})[_0x32d0('0x2b')](function(){_0x214877[_0x32d0('0x20')](0xcc)[_0x32d0('0x1f')]();});}};}function handleEntityNotFound(_0x4ff0a3,_0x1bca7c){return function(_0x513441){if(!_0x513441){_0x4ff0a3[_0x32d0('0x1e')](0x194);}return _0x513441;};}function handleError(_0x3835e9,_0x39a21a){_0x39a21a=_0x39a21a||0x1f4;return function(_0x21f85a){logger[_0x32d0('0x2e')](_0x21f85a[_0x32d0('0x2f')]);if(_0x21f85a[_0x32d0('0x30')]){delete _0x21f85a[_0x32d0('0x30')];}_0x3835e9[_0x32d0('0x20')](_0x39a21a)[_0x32d0('0x31')](_0x21f85a);};}exports['index']=function(_0xec61fb,_0x58ae8d){var _0x23ba20={},_0xcbe8a6={},_0x446641={'count':0x0,'rows':[]};var _0x7590e2=_[_0x32d0('0x32')](db[_0x32d0('0x33')][_0x32d0('0x34')],function(_0x579fc0){return{'name':_0x579fc0[_0x32d0('0x35')],'type':_0x579fc0[_0x32d0('0x36')][_0x32d0('0x37')]};});_0xcbe8a6[_0x32d0('0x38')]=_[_0x32d0('0x32')](_0x7590e2,_0x32d0('0x30'));_0xcbe8a6[_0x32d0('0x39')]=_[_0x32d0('0x3a')](_0xec61fb[_0x32d0('0x39')]);_0xcbe8a6[_0x32d0('0x3b')]=_['intersection'](_0xcbe8a6[_0x32d0('0x38')],_0xcbe8a6[_0x32d0('0x39')]);_0x23ba20[_0x32d0('0x3c')]=_['intersection'](_0xcbe8a6[_0x32d0('0x38')],qs[_0x32d0('0x3d')](_0xec61fb['query'][_0x32d0('0x3d')]));_0x23ba20[_0x32d0('0x3c')]=_0x23ba20[_0x32d0('0x3c')][_0x32d0('0x3e')]?_0x23ba20[_0x32d0('0x3c')]:_0xcbe8a6['model'];if(!_0xec61fb[_0x32d0('0x39')][_0x32d0('0x3f')](_0x32d0('0x40'))){_0x23ba20[_0x32d0('0x24')]=qs[_0x32d0('0x24')](_0xec61fb['query'][_0x32d0('0x24')]);_0x23ba20[_0x32d0('0x21')]=qs['offset'](_0xec61fb[_0x32d0('0x39')][_0x32d0('0x21')]);}_0x23ba20[_0x32d0('0x41')]=qs[_0x32d0('0x42')](_0xec61fb[_0x32d0('0x39')]['sort']);_0x23ba20['where']=qs[_0x32d0('0x3b')](_[_0x32d0('0x43')](_0xec61fb[_0x32d0('0x39')],_0xcbe8a6[_0x32d0('0x3b')]),_0x7590e2);if(_0xec61fb[_0x32d0('0x39')][_0x32d0('0x44')]){_0x23ba20[_0x32d0('0x45')]=_[_0x32d0('0x46')](_0x23ba20[_0x32d0('0x45')],{'$or':_[_0x32d0('0x32')](_0x7590e2,function(_0x165bdb){if(_0x165bdb[_0x32d0('0x36')]!==_0x32d0('0x47')){var _0x102a7d={};_0x102a7d[_0x165bdb['name']]={'$like':'%'+_0xec61fb[_0x32d0('0x39')][_0x32d0('0x44')]+'%'};return _0x102a7d;}})});}_0x23ba20=_['merge']({},_0x23ba20,_0xec61fb[_0x32d0('0x48')]);var _0x1238a2={'where':_0x23ba20['where']};return db[_0x32d0('0x33')][_0x32d0('0x23')](_0x1238a2)[_0x32d0('0x2b')](function(_0x1658c7){_0x446641[_0x32d0('0x23')]=_0x1658c7;if(_0xec61fb['query'][_0x32d0('0x49')]){_0x23ba20[_0x32d0('0x4a')]=[{'all':!![]}];}return db[_0x32d0('0x33')][_0x32d0('0x4b')](_0x23ba20);})[_0x32d0('0x2b')](function(_0x2ed7a4){_0x446641[_0x32d0('0x4c')]=_0x2ed7a4;return _0x446641;})[_0x32d0('0x2b')](respondWithFilteredResult(_0x58ae8d,_0x23ba20))[_0x32d0('0x4d')](handleError(_0x58ae8d,null));};exports[_0x32d0('0x4e')]=function(_0x2bf3dc,_0x224607){var _0x1f89be={'raw':!![],'where':{'id':_0x2bf3dc['params']['id']}},_0x180259={};_0x180259[_0x32d0('0x38')]=_[_0x32d0('0x3a')](db['FaxQueue'][_0x32d0('0x34')]);_0x180259[_0x32d0('0x39')]=_[_0x32d0('0x3a')](_0x2bf3dc[_0x32d0('0x39')]);_0x180259[_0x32d0('0x3b')]=_[_0x32d0('0x4f')](_0x180259['model'],_0x180259[_0x32d0('0x39')]);_0x1f89be[_0x32d0('0x3c')]=_[_0x32d0('0x4f')](_0x180259[_0x32d0('0x38')],qs[_0x32d0('0x3d')](_0x2bf3dc[_0x32d0('0x39')][_0x32d0('0x3d')]));_0x1f89be[_0x32d0('0x3c')]=_0x1f89be['attributes'][_0x32d0('0x3e')]?_0x1f89be[_0x32d0('0x3c')]:_0x180259[_0x32d0('0x38')];if(_0x2bf3dc['query'][_0x32d0('0x49')]){_0x1f89be[_0x32d0('0x4a')]=[{'all':!![]}];}_0x1f89be=_[_0x32d0('0x46')]({},_0x1f89be,_0x2bf3dc[_0x32d0('0x48')]);return db[_0x32d0('0x33')][_0x32d0('0x50')](_0x1f89be)[_0x32d0('0x2b')](handleEntityNotFound(_0x224607,null))[_0x32d0('0x2b')](respondWithResult(_0x224607,null))['catch'](handleError(_0x224607,null));};exports['create']=function(_0x576a24,_0x1b45ef){return db[_0x32d0('0x33')][_0x32d0('0x51')](_0x576a24[_0x32d0('0x52')],{})[_0x32d0('0x2b')](function(_0x62e556){var _0x4dbe36=_0x576a24[_0x32d0('0x53')][_0x32d0('0x54')]({'plain':!![]});if(!_0x4dbe36)throw new Error(_0x32d0('0x55'));if(_0x4dbe36['role']===_0x32d0('0x53')){var _0xef1847=_0x62e556[_0x32d0('0x54')]({'plain':!![]});var _0x5c9d65=_0x32d0('0x56');return db[_0x32d0('0x57')][_0x32d0('0x50')]({'where':{'name':_0x5c9d65,'userProfileId':_0x4dbe36[_0x32d0('0x58')]},'raw':!![]})['then'](function(_0x1cbc5e){if(_0x1cbc5e&&_0x1cbc5e[_0x32d0('0x59')]===0x0){return db[_0x32d0('0x2d')][_0x32d0('0x51')]({'name':_0xef1847['name'],'resourceId':_0xef1847['id'],'type':_0x1cbc5e['name'],'sectionId':_0x1cbc5e['id']},{})[_0x32d0('0x2b')](function(){return _0x62e556;});}else{return _0x62e556;}})[_0x32d0('0x4d')](function(_0x321d64){logger[_0x32d0('0x2e')](_0x32d0('0x5a'),_0x321d64);throw _0x321d64;});}return _0x62e556;})[_0x32d0('0x2b')](respondWithResult(_0x1b45ef,0xc9))[_0x32d0('0x4d')](handleError(_0x1b45ef,null));};exports[_0x32d0('0x2a')]=function(_0x328e19,_0x156468){if(_0x328e19[_0x32d0('0x52')]['id']){delete _0x328e19[_0x32d0('0x52')]['id'];}return db[_0x32d0('0x33')]['find']({'where':{'id':_0x328e19['params']['id']}})[_0x32d0('0x2b')](handleEntityNotFound(_0x156468,null))[_0x32d0('0x2b')](saveUpdates(_0x328e19[_0x32d0('0x52')],null))[_0x32d0('0x2b')](respondWithResult(_0x156468,null))['catch'](handleError(_0x156468,null));};exports[_0x32d0('0x2c')]=function(_0x37cd38,_0x3ce82b){return db['FaxQueue'][_0x32d0('0x50')]({'where':{'id':_0x37cd38[_0x32d0('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3ce82b,null))[_0x32d0('0x2b')](removeEntity(_0x3ce82b,null))['catch'](handleError(_0x3ce82b,null));};exports[_0x32d0('0x5c')]=function(_0x28799d,_0x4ac9bb){return db[_0x32d0('0x33')][_0x32d0('0x5c')]()[_0x32d0('0x2b')](respondWithResult(_0x4ac9bb,null))['catch'](handleError(_0x4ac9bb,null));};exports[_0x32d0('0x5d')]=function(_0x4336e9,_0x577076,_0x554548){var _0x1db821={'raw':!![],'where':{}},_0x493b56={},_0xab17e6;return db['FaxQueue']['findOne']({'where':{'id':_0x4336e9[_0x32d0('0x5b')]['id']}})[_0x32d0('0x2b')](handleEntityNotFound(_0x577076,null))['then'](function(_0x5cb8c7){if(_0x5cb8c7){_0xab17e6=_0x5cb8c7[_0x32d0('0x54')]({'plain':!![]});_0x493b56[_0x32d0('0x38')]=_[_0x32d0('0x3a')](db[_0x32d0('0x5e')]['rawAttributes']);_0x493b56[_0x32d0('0x39')]=_['keys'](_0x4336e9['query']);_0x493b56[_0x32d0('0x3b')]=_['intersection'](_0x493b56[_0x32d0('0x38')],_0x493b56[_0x32d0('0x39')]);_0x1db821[_0x32d0('0x3c')]=_[_0x32d0('0x4f')](_0x493b56['model'],qs[_0x32d0('0x3d')](_0x4336e9[_0x32d0('0x39')][_0x32d0('0x3d')]));_0x1db821['attributes']=_0x1db821[_0x32d0('0x3c')][_0x32d0('0x3e')]?_0x1db821[_0x32d0('0x3c')]:_0x493b56[_0x32d0('0x38')];if(!_0x4336e9[_0x32d0('0x39')][_0x32d0('0x3f')](_0x32d0('0x40'))){_0x1db821[_0x32d0('0x24')]=qs[_0x32d0('0x24')](_0x4336e9['query'][_0x32d0('0x24')]);_0x1db821[_0x32d0('0x21')]=qs[_0x32d0('0x21')](_0x4336e9[_0x32d0('0x39')][_0x32d0('0x21')]);}_0x1db821['order']=qs[_0x32d0('0x42')](_0x4336e9[_0x32d0('0x39')][_0x32d0('0x42')]);_0x1db821[_0x32d0('0x45')]=qs[_0x32d0('0x3b')](_[_0x32d0('0x43')](_0x4336e9[_0x32d0('0x39')],_0x493b56['filters']));_0x1db821['where'][_0x32d0('0x5f')]=_0x5cb8c7['id'];if(_0x4336e9['query'][_0x32d0('0x44')]){_0x1db821['where']=_[_0x32d0('0x46')](_0x1db821['where'],{'$or':_[_0x32d0('0x32')](_0x1db821[_0x32d0('0x3c')],function(_0xdf071b){var _0x136ac4={};_0x136ac4[_0xdf071b]={'$like':'%'+_0x4336e9[_0x32d0('0x39')][_0x32d0('0x44')]+'%'};return _0x136ac4;})});}_0x1db821=_[_0x32d0('0x46')]({},_0x1db821,_0x4336e9['options']);return db[_0x32d0('0x5e')][_0x32d0('0x4b')](_0x1db821);}})['then'](function(_0x127cea){if(_0x127cea){return db['User'][_0x32d0('0x60')]({'where':{'id':_[_0x32d0('0x32')](_0x127cea,_0x32d0('0x61')),'role':_0x32d0('0x62')},'attributes':['id',_0x32d0('0x30'),_0x32d0('0x63'),_0x32d0('0x64'),_0x32d0('0x65')]});}})[_0x32d0('0x2b')](function(_0x165288){if(_0x165288){return{'count':_0x165288['count'],'rows':_[_0x32d0('0x32')](_0x165288[_0x32d0('0x4c')],function(_0x3b300e){return{'membername':_0x3b300e[_0x32d0('0x30')],'UserId':_0x3b300e['id'],'queue_name':_0xab17e6['name'],'FaxQueueId':_0xab17e6['id'],'interface':util['format'](_0x32d0('0x66'),_0x32d0('0x67'),_0x3b300e[_0x32d0('0x30')]),'penalty':0x0,'paused':_0x3b300e[_0x32d0('0x63')],'createdAt':_0x3b300e[_0x32d0('0x65')],'updatedAt':_0x3b300e['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x32d0('0x2b')](respondWithFilteredResult(_0x577076,_0x1db821))['catch'](handleError(_0x577076,null));};exports['getTeams']=function(_0xd5d105,_0x57b4d6,_0x42ce7e){var _0x20cb87={};var _0x1ef56d={};var _0x515592;var _0x4d56e5;return db[_0x32d0('0x33')][_0x32d0('0x68')]({'where':{'id':_0xd5d105[_0x32d0('0x5b')]['id']}})['then'](handleEntityNotFound(_0x57b4d6,null))[_0x32d0('0x2b')](function(_0x39d9e0){if(_0x39d9e0){_0x515592=_0x39d9e0;_0x1ef56d[_0x32d0('0x38')]=_[_0x32d0('0x3a')](db[_0x32d0('0x69')][_0x32d0('0x34')]);_0x1ef56d['query']=_[_0x32d0('0x3a')](_0xd5d105[_0x32d0('0x39')]);_0x1ef56d[_0x32d0('0x3b')]=_[_0x32d0('0x4f')](_0x1ef56d[_0x32d0('0x38')],_0x1ef56d[_0x32d0('0x39')]);_0x20cb87[_0x32d0('0x3c')]=_[_0x32d0('0x4f')](_0x1ef56d['model'],qs[_0x32d0('0x3d')](_0xd5d105['query'][_0x32d0('0x3d')]));_0x20cb87[_0x32d0('0x3c')]=_0x20cb87[_0x32d0('0x3c')][_0x32d0('0x3e')]?_0x20cb87['attributes']:_0x1ef56d[_0x32d0('0x38')];_0x20cb87[_0x32d0('0x41')]=qs['sort'](_0xd5d105[_0x32d0('0x39')][_0x32d0('0x42')]);_0x20cb87[_0x32d0('0x45')]=qs['filters'](_['pick'](_0xd5d105[_0x32d0('0x39')],_0x1ef56d['filters']));if(_0xd5d105['query'][_0x32d0('0x44')]){_0x20cb87['where']=_['merge'](_0x20cb87[_0x32d0('0x45')],{'$or':_['map'](_0x20cb87[_0x32d0('0x3c')],function(_0x10d6fb){var _0x1741c5={};_0x1741c5[_0x10d6fb]={'$like':'%'+_0xd5d105['query']['filter']+'%'};return _0x1741c5;})});}_0x20cb87=_[_0x32d0('0x46')]({},_0x20cb87,_0xd5d105[_0x32d0('0x48')]);return _0x515592[_0x32d0('0x6a')](_0x20cb87);}})[_0x32d0('0x2b')](function(_0x16473a){if(_0x16473a){_0x4d56e5=_0x16473a[_0x32d0('0x3e')];if(!_0xd5d105['query'][_0x32d0('0x3f')](_0x32d0('0x40'))){_0x20cb87[_0x32d0('0x24')]=qs[_0x32d0('0x24')](_0xd5d105['query'][_0x32d0('0x24')]);_0x20cb87['offset']=qs[_0x32d0('0x21')](_0xd5d105[_0x32d0('0x39')][_0x32d0('0x21')]);}return _0x515592[_0x32d0('0x6a')](_0x20cb87);}})[_0x32d0('0x2b')](function(_0x41aac5){if(_0x41aac5){return _0x41aac5?{'count':_0x4d56e5,'rows':_0x41aac5}:null;}})['then'](respondWithResult(_0x57b4d6,null))['catch'](handleError(_0x57b4d6,null));};exports[_0x32d0('0x6b')]=function(_0x38e367,_0x329de6,_0x367b58){var _0xc6cca4=_0x38e367[_0x32d0('0x52')][_0x32d0('0x6c')];return db[_0x32d0('0x69')]['findAll']({'where':{'id':_0xc6cca4},'attributes':['id'],'include':[{'model':db[_0x32d0('0x6d')],'as':_0x32d0('0x6e'),'attributes':['id',_0x32d0('0x30'),_0x32d0('0x6f'),_0x32d0('0x70'),_0x32d0('0x71')],'raw':!![]}]})[_0x32d0('0x2b')](function(_0x2e5204){if(_0x2e5204){var _0x2a0a5c=_[_0x32d0('0x72')](_0x2e5204,function(_0x36a51e){var _0x299985=_0x36a51e['get']({'plain':!![]});return _0x299985[_0x32d0('0x6e')];});return db[_0x32d0('0x33')][_0x32d0('0x50')]({'where':{'id':_0x38e367['params']['id']}})[_0x32d0('0x2b')](function(_0x4ea0d1){return db[_0x32d0('0x73')]['transaction'](function(_0x30edf9){return _0x4ea0d1[_0x32d0('0x6b')](_0xc6cca4,{'transaction':_0x30edf9})['then'](function(){return BPromise[_0x32d0('0x74')](_0x2a0a5c,function(_0x987d0e){return db[_0x32d0('0x5e')]['findOrCreate']({'where':{'UserId':_0x987d0e['id'],'FaxQueueId':_0x38e367[_0x32d0('0x5b')]['id']},'transaction':_0x30edf9});});})['then'](function(){_0x2a0a5c[_0x32d0('0x75')](function(_0x1abbda){socket[_0x32d0('0x76')](_0x32d0('0x77'),{'UserId':_0x1abbda['id'],'FaxQueueId':_0x4ea0d1['id']});});});});});}})[_0x32d0('0x2b')](respondWithStatusCode(_0x329de6,null))[_0x32d0('0x4d')](handleError(_0x329de6,null));};exports[_0x32d0('0x78')]=function(_0x3d47b9,_0x5b4ce5,_0x17b068){return db[_0x32d0('0x69')][_0x32d0('0x4b')]({'where':{'id':_0x3d47b9[_0x32d0('0x39')][_0x32d0('0x6c')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x32d0('0x2b')](handleEntityNotFound(_0x5b4ce5,null))[_0x32d0('0x2b')](function(_0x2158cf){var _0x389524=_[_0x32d0('0x32')](_0x2158cf,'id');var _0xad8798=[];var _0x500e82=[];var _0x4055f7=squel[_0x32d0('0x79')]();_0x4055f7['field']('tq.TeamId')[_0x32d0('0x7a')](_0x32d0('0x7b'),'tq')['join'](_0x32d0('0x7c'),'ut',_0x32d0('0x7d'))['where'](_0x32d0('0x7e'),_0x3d47b9['params']['id']);for(var _0x58d433=0x0;_0x58d433<_0x2158cf[_0x32d0('0x3e')];_0x58d433+=0x1){let _0x972f03=_0x2158cf[_0x58d433];for(var _0x15028e=0x0;_0x15028e<_0x972f03[_0x32d0('0x6e')][_0x32d0('0x3e')];_0x15028e+=0x1){let _0x4c4ac8=_0x972f03[_0x32d0('0x6e')][_0x15028e];var _0x1f3c94=_0x4055f7[_0x32d0('0x7f')]();_0x1f3c94[_0x32d0('0x45')](_0x32d0('0x80'),_0x4c4ac8['id']);_0x500e82[_0x32d0('0x81')](db[_0x32d0('0x73')][_0x32d0('0x39')](_0x1f3c94[_0x32d0('0x82')](),{'type':db[_0x32d0('0x73')]['QueryTypes'][_0x32d0('0x83')]})['then'](function(_0x5bb69d){if(_0x5bb69d[_0x32d0('0x3e')]===0x1){return _0x4c4ac8['id'];}else{var _0x458937=_['every'](_[_0x32d0('0x32')](_0x5bb69d,_0x32d0('0x84')),function(_0x3ac2c1){return _['includes'](_0x389524,_0x3ac2c1);});if(_0x458937){return _0x4c4ac8['id'];}}}));}}return BPromise['all'](_0x500e82)[_0x32d0('0x2b')](function(_0x5a735c){_0xad8798=_(_0xad8798)['union'](_0x5a735c)[_0x32d0('0x85')]()[_0x32d0('0x86')]();return db[_0x32d0('0x33')][_0x32d0('0x50')]({'where':{'id':_0x3d47b9[_0x32d0('0x5b')]['id']}})[_0x32d0('0x2b')](function(_0x5984e5){return db['sequelize'][_0x32d0('0x87')](function(_0x422438){return _0x5984e5[_0x32d0('0x78')](_0x3d47b9[_0x32d0('0x39')][_0x32d0('0x6c')],{'transaction':_0x422438})[_0x32d0('0x2b')](function(){if(!_['isEmpty'](_0xad8798)){return _0x5984e5['removeAgents'](_0xad8798,{'transaction':_0x422438});}})[_0x32d0('0x2b')](function(){_0xad8798[_0x32d0('0x75')](function(_0x233260){socket[_0x32d0('0x76')]('userFaxQueue:remove',{'UserId':_0x233260,'FaxQueueId':_0x5984e5['id']});});});});});});})['then'](respondWithStatusCode(_0x5b4ce5,null))['catch'](handleError(_0x5b4ce5,null));};exports[_0x32d0('0x88')]=function(_0x26e627,_0x269a77,_0x539236){return db[_0x32d0('0x33')][_0x32d0('0x50')]({'where':{'id':_0x26e627[_0x32d0('0x5b')]['id']}})['then'](handleEntityNotFound(_0x269a77,null))['then'](function(_0x5012fa){if(_0x5012fa){return _0x5012fa[_0x32d0('0x88')](_0x26e627[_0x32d0('0x52')][_0x32d0('0x6c')],_[_0x32d0('0x89')](_0x26e627[_0x32d0('0x52')],[_0x32d0('0x6c'),'id'])||{})['spread'](function(_0x235cff){for(var _0x47dcef=0x0;_0x47dcef<_0x26e627['body']['ids'][_0x32d0('0x3e')];_0x47dcef+=0x1){socket[_0x32d0('0x76')](_0x32d0('0x77'),{'UserId':Number(_0x26e627[_0x32d0('0x52')][_0x32d0('0x6c')][_0x47dcef]),'FaxQueueId':Number(_0x26e627['params']['id'])});}return _0x235cff;});}})[_0x32d0('0x2b')](respondWithResult(_0x269a77,null))[_0x32d0('0x4d')](handleError(_0x269a77,null));};exports[_0x32d0('0x8a')]=function(_0x276f90,_0x39cbae,_0x286d84){return db[_0x32d0('0x33')][_0x32d0('0x50')]({'where':{'id':_0x276f90[_0x32d0('0x5b')]['id']}})[_0x32d0('0x2b')](handleEntityNotFound(_0x39cbae,null))[_0x32d0('0x2b')](function(_0x4f5a0b){if(_0x4f5a0b){return _0x4f5a0b[_0x32d0('0x8a')](_0x276f90[_0x32d0('0x39')][_0x32d0('0x6c')])[_0x32d0('0x2b')](function(){if(_['isArray'](_0x276f90[_0x32d0('0x39')][_0x32d0('0x6c')])){for(var _0x5dee6f=0x0;_0x5dee6f<_0x276f90[_0x32d0('0x39')][_0x32d0('0x6c')]['length'];_0x5dee6f+=0x1){socket[_0x32d0('0x76')](_0x32d0('0x8b'),{'UserId':Number(_0x276f90['query'][_0x32d0('0x6c')][_0x5dee6f]),'FaxQueueId':Number(_0x276f90[_0x32d0('0x5b')]['id'])});}}else{socket[_0x32d0('0x76')](_0x32d0('0x8b'),{'UserId':Number(_0x276f90[_0x32d0('0x39')]['ids']),'FaxQueueId':Number(_0x276f90[_0x32d0('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x39cbae,null))[_0x32d0('0x4d')](handleError(_0x39cbae,null));};exports[_0x32d0('0x8c')]=function(_0x2550a9,_0x18ca47,_0x403622){var _0x332f45={};var _0x5e4bd1={};var _0x1a1064;var _0x16bef1;return db[_0x32d0('0x33')][_0x32d0('0x68')]({'where':{'id':_0x2550a9[_0x32d0('0x5b')]['id']}})[_0x32d0('0x2b')](handleEntityNotFound(_0x18ca47,null))[_0x32d0('0x2b')](function(_0x72fc53){if(_0x72fc53){_0x1a1064=_0x72fc53;_0x5e4bd1['model']=_['keys'](db[_0x32d0('0x6d')]['rawAttributes']);_0x5e4bd1[_0x32d0('0x39')]=_[_0x32d0('0x3a')](_0x2550a9['query']);_0x5e4bd1[_0x32d0('0x3b')]=_[_0x32d0('0x4f')](_0x5e4bd1['model'],_0x5e4bd1['query']);_0x332f45[_0x32d0('0x3c')]=_['intersection'](_0x5e4bd1[_0x32d0('0x38')],qs['fields'](_0x2550a9[_0x32d0('0x39')][_0x32d0('0x3d')]));_0x332f45[_0x32d0('0x3c')]=_0x332f45[_0x32d0('0x3c')][_0x32d0('0x3e')]?_0x332f45[_0x32d0('0x3c')]:_0x5e4bd1[_0x32d0('0x38')];_0x332f45[_0x32d0('0x41')]=qs['sort'](_0x2550a9[_0x32d0('0x39')][_0x32d0('0x42')]);_0x332f45[_0x32d0('0x45')]=qs[_0x32d0('0x3b')](_['pick'](_0x2550a9[_0x32d0('0x39')],_0x5e4bd1['filters']));if(_0x2550a9[_0x32d0('0x39')][_0x32d0('0x44')]){_0x332f45['where']=_['merge'](_0x332f45[_0x32d0('0x45')],{'$or':_['map'](_0x332f45[_0x32d0('0x3c')],function(_0x487942){var _0xa01fb8={};_0xa01fb8[_0x487942]={'$like':'%'+_0x2550a9['query']['filter']+'%'};return _0xa01fb8;})});}_0x332f45=_[_0x32d0('0x46')]({},_0x332f45,_0x2550a9[_0x32d0('0x48')]);return _0x1a1064['getAgents'](_0x332f45);}})[_0x32d0('0x2b')](function(_0x2d0d82){if(_0x2d0d82){_0x16bef1=_0x2d0d82[_0x32d0('0x3e')];if(!_0x2550a9['query']['hasOwnProperty'](_0x32d0('0x40'))){_0x332f45[_0x32d0('0x24')]=qs[_0x32d0('0x24')](_0x2550a9['query'][_0x32d0('0x24')]);_0x332f45['offset']=qs[_0x32d0('0x21')](_0x2550a9[_0x32d0('0x39')][_0x32d0('0x21')]);}return _0x1a1064[_0x32d0('0x8c')](_0x332f45);}})[_0x32d0('0x2b')](function(_0x13cf4b){if(_0x13cf4b){return _0x13cf4b?{'count':_0x16bef1,'rows':_0x13cf4b}:null;}})[_0x32d0('0x2b')](respondWithResult(_0x18ca47,null))[_0x32d0('0x4d')](handleError(_0x18ca47,null));}; \ No newline at end of file +var _0x2d97=['addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','emit','userFaxQueue:save','select','field','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','FaxQueue','findAll','rows','catch','show','params','length','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserFaxQueue','FaxQueueId','User','UserId','faxPause','updatedAt','createdAt','format','getTeams','Team'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x2d97,0x1d2));var _0x72d9=function(_0x40db6a,_0x3a0df8){_0x40db6a=_0x40db6a-0x0;var _0x51e5a5=_0x2d97[_0x40db6a];return _0x51e5a5;};'use strict';var emlformat=require(_0x72d9('0x0'));var rimraf=require(_0x72d9('0x1'));var zipdir=require(_0x72d9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x72d9('0x3'));var moment=require(_0x72d9('0x4'));var BPromise=require(_0x72d9('0x5'));var Mustache=require(_0x72d9('0x6'));var util=require(_0x72d9('0x7'));var path=require(_0x72d9('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x72d9('0x9'));var fs=require('fs');var fs_extra=require(_0x72d9('0xa'));var _=require(_0x72d9('0xb'));var squel=require(_0x72d9('0xc'));var crypto=require(_0x72d9('0xd'));var jsforce=require(_0x72d9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x72d9('0xf'));var querystring=require(_0x72d9('0x10'));var Papa=require(_0x72d9('0x11'));var Redis=require('ioredis');var authService=require(_0x72d9('0x12'));var qs=require(_0x72d9('0x13'));var as=require(_0x72d9('0x14'));var hardwareService=require(_0x72d9('0x15'));var logger=require(_0x72d9('0x16'))(_0x72d9('0x17'));var utils=require(_0x72d9('0x18'));var config=require(_0x72d9('0x19'));var licenseUtil=require(_0x72d9('0x1a'));var db=require('../../mysqldb')['db'];config[_0x72d9('0x1b')]=_[_0x72d9('0x1c')](config[_0x72d9('0x1b')],{'host':_0x72d9('0x1d'),'port':0x18eb});var socket=require(_0x72d9('0x1e'))(new Redis(config[_0x72d9('0x1b')]));require('./faxQueue.socket')['register'](socket);function respondWithStatusCode(_0x1362c8,_0x31de1c){_0x31de1c=_0x31de1c||0xcc;return function(_0x2d109e){if(_0x2d109e){return _0x1362c8[_0x72d9('0x1f')](_0x31de1c);}return _0x1362c8[_0x72d9('0x20')](_0x31de1c)[_0x72d9('0x21')]();};}function respondWithResult(_0x591478,_0x1331a0){_0x1331a0=_0x1331a0||0xc8;return function(_0x12e32f){if(_0x12e32f){return _0x591478['status'](_0x1331a0)[_0x72d9('0x22')](_0x12e32f);}};}function respondWithFilteredResult(_0x84e8e6,_0x283284){return function(_0x562720){if(_0x562720){var _0x5a3db3=typeof _0x283284[_0x72d9('0x23')]===_0x72d9('0x24')&&typeof _0x283284[_0x72d9('0x25')]===_0x72d9('0x24');var _0xb18bfd=_0x562720[_0x72d9('0x26')];var _0x139ee7=_0x5a3db3?0x0:_0x283284[_0x72d9('0x23')];var _0x48123a=_0x5a3db3?_0x562720[_0x72d9('0x26')]:_0x283284[_0x72d9('0x23')]+_0x283284['limit'];var _0x45abfd;if(_0x48123a>=_0xb18bfd){_0x48123a=_0xb18bfd;_0x45abfd=0xc8;}else{_0x45abfd=0xce;}_0x84e8e6[_0x72d9('0x20')](_0x45abfd);return _0x84e8e6['set'](_0x72d9('0x27'),_0x139ee7+'-'+_0x48123a+'/'+_0xb18bfd)[_0x72d9('0x22')](_0x562720);}return null;};}function patchUpdates(_0x5b43e8){return function(_0x21bddf){try{jsonpatch[_0x72d9('0x28')](_0x21bddf,_0x5b43e8,!![]);}catch(_0x1e67a6){return BPromise['reject'](_0x1e67a6);}return _0x21bddf[_0x72d9('0x29')]();};}function saveUpdates(_0x3764f3,_0x513a63){return function(_0x4087d2){if(_0x4087d2){return _0x4087d2[_0x72d9('0x2a')](_0x3764f3)[_0x72d9('0x2b')](function(_0x10e83d){return _0x10e83d;});}return null;};}function removeEntity(_0xc2458c,_0x168fd7){return function(_0x1ea03d){if(_0x1ea03d){return _0x1ea03d[_0x72d9('0x2c')]()[_0x72d9('0x2b')](function(){var _0x29efb1=_0x1ea03d[_0x72d9('0x2d')]({'plain':!![]});var _0x1595cf='FaxQueues';return db[_0x72d9('0x2e')]['destroy']({'where':{'type':_0x1595cf,'resourceId':_0x29efb1['id']}})[_0x72d9('0x2b')](function(){return _0x1ea03d;});})[_0x72d9('0x2b')](function(){_0xc2458c[_0x72d9('0x20')](0xcc)[_0x72d9('0x21')]();});}};}function handleEntityNotFound(_0x4f95a2,_0x282c19){return function(_0x55be5a){if(!_0x55be5a){_0x4f95a2[_0x72d9('0x1f')](0x194);}return _0x55be5a;};}function handleError(_0xea4d78,_0x1d3062){_0x1d3062=_0x1d3062||0x1f4;return function(_0xbf69c3){logger[_0x72d9('0x2f')](_0xbf69c3[_0x72d9('0x30')]);if(_0xbf69c3['name']){delete _0xbf69c3['name'];}_0xea4d78['status'](_0x1d3062)[_0x72d9('0x31')](_0xbf69c3);};}exports[_0x72d9('0x32')]=function(_0x2c12a7,_0x54794b){var _0x49b7a2={},_0x43e007={},_0x40d8d5={'count':0x0,'rows':[]};var _0x329a33=_[_0x72d9('0x33')](db['FaxQueue'][_0x72d9('0x34')],function(_0x429ee4){return{'name':_0x429ee4[_0x72d9('0x35')],'type':_0x429ee4[_0x72d9('0x36')][_0x72d9('0x37')]};});_0x43e007[_0x72d9('0x38')]=_[_0x72d9('0x33')](_0x329a33,_0x72d9('0x39'));_0x43e007['query']=_[_0x72d9('0x3a')](_0x2c12a7[_0x72d9('0x3b')]);_0x43e007[_0x72d9('0x3c')]=_[_0x72d9('0x3d')](_0x43e007[_0x72d9('0x38')],_0x43e007['query']);_0x49b7a2['attributes']=_[_0x72d9('0x3d')](_0x43e007['model'],qs[_0x72d9('0x3e')](_0x2c12a7[_0x72d9('0x3b')]['fields']));_0x49b7a2['attributes']=_0x49b7a2['attributes']['length']?_0x49b7a2[_0x72d9('0x3f')]:_0x43e007[_0x72d9('0x38')];if(!_0x2c12a7[_0x72d9('0x3b')][_0x72d9('0x40')](_0x72d9('0x41'))){_0x49b7a2[_0x72d9('0x25')]=qs[_0x72d9('0x25')](_0x2c12a7[_0x72d9('0x3b')][_0x72d9('0x25')]);_0x49b7a2[_0x72d9('0x23')]=qs['offset'](_0x2c12a7[_0x72d9('0x3b')][_0x72d9('0x23')]);}_0x49b7a2[_0x72d9('0x42')]=qs[_0x72d9('0x43')](_0x2c12a7[_0x72d9('0x3b')][_0x72d9('0x43')]);_0x49b7a2[_0x72d9('0x44')]=qs['filters'](_[_0x72d9('0x45')](_0x2c12a7[_0x72d9('0x3b')],_0x43e007[_0x72d9('0x3c')]),_0x329a33);if(_0x2c12a7[_0x72d9('0x3b')][_0x72d9('0x46')]){_0x49b7a2[_0x72d9('0x44')]=_[_0x72d9('0x47')](_0x49b7a2[_0x72d9('0x44')],{'$or':_['map'](_0x329a33,function(_0x37a9bc){if(_0x37a9bc[_0x72d9('0x36')]!==_0x72d9('0x48')){var _0x5e3d2e={};_0x5e3d2e[_0x37a9bc[_0x72d9('0x39')]]={'$like':'%'+_0x2c12a7[_0x72d9('0x3b')]['filter']+'%'};return _0x5e3d2e;}})});}_0x49b7a2=_['merge']({},_0x49b7a2,_0x2c12a7['options']);var _0x54f04d={'where':_0x49b7a2[_0x72d9('0x44')]};return db['FaxQueue'][_0x72d9('0x26')](_0x54f04d)[_0x72d9('0x2b')](function(_0x147805){_0x40d8d5[_0x72d9('0x26')]=_0x147805;if(_0x2c12a7['query'][_0x72d9('0x49')]){_0x49b7a2[_0x72d9('0x4a')]=[{'all':!![]}];}return db[_0x72d9('0x4b')][_0x72d9('0x4c')](_0x49b7a2);})[_0x72d9('0x2b')](function(_0x4cb7f4){_0x40d8d5[_0x72d9('0x4d')]=_0x4cb7f4;return _0x40d8d5;})[_0x72d9('0x2b')](respondWithFilteredResult(_0x54794b,_0x49b7a2))[_0x72d9('0x4e')](handleError(_0x54794b,null));};exports[_0x72d9('0x4f')]=function(_0x18b7db,_0x23efad){var _0x437046={'raw':!![],'where':{'id':_0x18b7db[_0x72d9('0x50')]['id']}},_0x2792a8={};_0x2792a8[_0x72d9('0x38')]=_[_0x72d9('0x3a')](db[_0x72d9('0x4b')][_0x72d9('0x34')]);_0x2792a8[_0x72d9('0x3b')]=_[_0x72d9('0x3a')](_0x18b7db[_0x72d9('0x3b')]);_0x2792a8[_0x72d9('0x3c')]=_[_0x72d9('0x3d')](_0x2792a8[_0x72d9('0x38')],_0x2792a8[_0x72d9('0x3b')]);_0x437046[_0x72d9('0x3f')]=_['intersection'](_0x2792a8['model'],qs[_0x72d9('0x3e')](_0x18b7db[_0x72d9('0x3b')][_0x72d9('0x3e')]));_0x437046[_0x72d9('0x3f')]=_0x437046[_0x72d9('0x3f')][_0x72d9('0x51')]?_0x437046[_0x72d9('0x3f')]:_0x2792a8[_0x72d9('0x38')];if(_0x18b7db[_0x72d9('0x3b')][_0x72d9('0x49')]){_0x437046[_0x72d9('0x4a')]=[{'all':!![]}];}_0x437046=_[_0x72d9('0x47')]({},_0x437046,_0x18b7db[_0x72d9('0x52')]);return db[_0x72d9('0x4b')]['find'](_0x437046)['then'](handleEntityNotFound(_0x23efad,null))['then'](respondWithResult(_0x23efad,null))['catch'](handleError(_0x23efad,null));};exports[_0x72d9('0x53')]=function(_0x23e32a,_0x2253f3){return db[_0x72d9('0x4b')]['create'](_0x23e32a['body'],{})[_0x72d9('0x2b')](function(_0x31a07c){var _0x53a12b=_0x23e32a[_0x72d9('0x54')]['get']({'plain':!![]});if(!_0x53a12b)throw new Error(_0x72d9('0x55'));if(_0x53a12b[_0x72d9('0x56')]===_0x72d9('0x54')){var _0x1ba0b9=_0x31a07c[_0x72d9('0x2d')]({'plain':!![]});var _0x2c4e35=_0x72d9('0x57');return db[_0x72d9('0x58')][_0x72d9('0x59')]({'where':{'name':_0x2c4e35,'userProfileId':_0x53a12b[_0x72d9('0x5a')]},'raw':!![]})[_0x72d9('0x2b')](function(_0x16b814){if(_0x16b814&&_0x16b814['autoAssociation']===0x0){return db[_0x72d9('0x2e')]['create']({'name':_0x1ba0b9[_0x72d9('0x39')],'resourceId':_0x1ba0b9['id'],'type':_0x16b814[_0x72d9('0x39')],'sectionId':_0x16b814['id']},{})[_0x72d9('0x2b')](function(){return _0x31a07c;});}else{return _0x31a07c;}})[_0x72d9('0x4e')](function(_0x131f3a){logger[_0x72d9('0x2f')](_0x72d9('0x5b'),_0x131f3a);throw _0x131f3a;});}return _0x31a07c;})['then'](respondWithResult(_0x2253f3,0xc9))['catch'](handleError(_0x2253f3,null));};exports['update']=function(_0x5cd618,_0x4cf353){if(_0x5cd618['body']['id']){delete _0x5cd618[_0x72d9('0x5c')]['id'];}return db[_0x72d9('0x4b')][_0x72d9('0x59')]({'where':{'id':_0x5cd618[_0x72d9('0x50')]['id']}})[_0x72d9('0x2b')](handleEntityNotFound(_0x4cf353,null))[_0x72d9('0x2b')](saveUpdates(_0x5cd618[_0x72d9('0x5c')],null))[_0x72d9('0x2b')](respondWithResult(_0x4cf353,null))['catch'](handleError(_0x4cf353,null));};exports[_0x72d9('0x2c')]=function(_0x240a94,_0x387b20){return db[_0x72d9('0x4b')][_0x72d9('0x59')]({'where':{'id':_0x240a94[_0x72d9('0x50')]['id']}})[_0x72d9('0x2b')](handleEntityNotFound(_0x387b20,null))[_0x72d9('0x2b')](removeEntity(_0x387b20,null))[_0x72d9('0x4e')](handleError(_0x387b20,null));};exports['describe']=function(_0x23b523,_0x516027){return db[_0x72d9('0x4b')][_0x72d9('0x5d')]()['then'](respondWithResult(_0x516027,null))[_0x72d9('0x4e')](handleError(_0x516027,null));};exports[_0x72d9('0x5e')]=function(_0x543b61,_0x28fc20,_0x2ebf43){var _0x2e25de={'raw':!![],'where':{}},_0x1b93e1={},_0x3e5281;return db['FaxQueue'][_0x72d9('0x5f')]({'where':{'id':_0x543b61['params']['id']}})[_0x72d9('0x2b')](handleEntityNotFound(_0x28fc20,null))['then'](function(_0x1c814a){if(_0x1c814a){_0x3e5281=_0x1c814a[_0x72d9('0x2d')]({'plain':!![]});_0x1b93e1[_0x72d9('0x38')]=_[_0x72d9('0x3a')](db[_0x72d9('0x60')][_0x72d9('0x34')]);_0x1b93e1[_0x72d9('0x3b')]=_[_0x72d9('0x3a')](_0x543b61[_0x72d9('0x3b')]);_0x1b93e1[_0x72d9('0x3c')]=_[_0x72d9('0x3d')](_0x1b93e1['model'],_0x1b93e1[_0x72d9('0x3b')]);_0x2e25de[_0x72d9('0x3f')]=_[_0x72d9('0x3d')](_0x1b93e1['model'],qs[_0x72d9('0x3e')](_0x543b61[_0x72d9('0x3b')][_0x72d9('0x3e')]));_0x2e25de[_0x72d9('0x3f')]=_0x2e25de[_0x72d9('0x3f')][_0x72d9('0x51')]?_0x2e25de['attributes']:_0x1b93e1['model'];if(!_0x543b61[_0x72d9('0x3b')][_0x72d9('0x40')]('nolimit')){_0x2e25de[_0x72d9('0x25')]=qs[_0x72d9('0x25')](_0x543b61[_0x72d9('0x3b')][_0x72d9('0x25')]);_0x2e25de[_0x72d9('0x23')]=qs[_0x72d9('0x23')](_0x543b61[_0x72d9('0x3b')]['offset']);}_0x2e25de['order']=qs['sort'](_0x543b61[_0x72d9('0x3b')][_0x72d9('0x43')]);_0x2e25de['where']=qs[_0x72d9('0x3c')](_[_0x72d9('0x45')](_0x543b61[_0x72d9('0x3b')],_0x1b93e1[_0x72d9('0x3c')]));_0x2e25de['where'][_0x72d9('0x61')]=_0x1c814a['id'];if(_0x543b61[_0x72d9('0x3b')][_0x72d9('0x46')]){_0x2e25de[_0x72d9('0x44')]=_['merge'](_0x2e25de[_0x72d9('0x44')],{'$or':_[_0x72d9('0x33')](_0x2e25de[_0x72d9('0x3f')],function(_0x1678fc){var _0x15f372={};_0x15f372[_0x1678fc]={'$like':'%'+_0x543b61[_0x72d9('0x3b')][_0x72d9('0x46')]+'%'};return _0x15f372;})});}_0x2e25de=_[_0x72d9('0x47')]({},_0x2e25de,_0x543b61['options']);return db['UserFaxQueue'][_0x72d9('0x4c')](_0x2e25de);}})['then'](function(_0x1c2c65){if(_0x1c2c65){return db[_0x72d9('0x62')]['findAndCountAll']({'where':{'id':_[_0x72d9('0x33')](_0x1c2c65,_0x72d9('0x63')),'role':'agent'},'attributes':['id','name',_0x72d9('0x64'),_0x72d9('0x65'),_0x72d9('0x66')]});}})[_0x72d9('0x2b')](function(_0x4b0c6a){if(_0x4b0c6a){return{'count':_0x4b0c6a[_0x72d9('0x26')],'rows':_[_0x72d9('0x33')](_0x4b0c6a[_0x72d9('0x4d')],function(_0x4cb00b){return{'membername':_0x4cb00b[_0x72d9('0x39')],'UserId':_0x4cb00b['id'],'queue_name':_0x3e5281[_0x72d9('0x39')],'FaxQueueId':_0x3e5281['id'],'interface':util[_0x72d9('0x67')]('%s/%s','SIP',_0x4cb00b[_0x72d9('0x39')]),'penalty':0x0,'paused':_0x4cb00b['faxPause'],'createdAt':_0x4cb00b['createdAt'],'updatedAt':_0x4cb00b[_0x72d9('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x72d9('0x2b')](respondWithFilteredResult(_0x28fc20,_0x2e25de))['catch'](handleError(_0x28fc20,null));};exports[_0x72d9('0x68')]=function(_0x4838ad,_0x39eb41,_0x156361){var _0x42cb78={};var _0x10ace7={};var _0x2e821d;var _0x27d5e9;return db[_0x72d9('0x4b')][_0x72d9('0x5f')]({'where':{'id':_0x4838ad[_0x72d9('0x50')]['id']}})['then'](handleEntityNotFound(_0x39eb41,null))[_0x72d9('0x2b')](function(_0x5f5843){if(_0x5f5843){_0x2e821d=_0x5f5843;_0x10ace7[_0x72d9('0x38')]=_[_0x72d9('0x3a')](db[_0x72d9('0x69')][_0x72d9('0x34')]);_0x10ace7['query']=_[_0x72d9('0x3a')](_0x4838ad['query']);_0x10ace7['filters']=_[_0x72d9('0x3d')](_0x10ace7['model'],_0x10ace7[_0x72d9('0x3b')]);_0x42cb78[_0x72d9('0x3f')]=_['intersection'](_0x10ace7[_0x72d9('0x38')],qs['fields'](_0x4838ad[_0x72d9('0x3b')]['fields']));_0x42cb78[_0x72d9('0x3f')]=_0x42cb78[_0x72d9('0x3f')]['length']?_0x42cb78['attributes']:_0x10ace7['model'];_0x42cb78[_0x72d9('0x42')]=qs[_0x72d9('0x43')](_0x4838ad[_0x72d9('0x3b')][_0x72d9('0x43')]);_0x42cb78[_0x72d9('0x44')]=qs[_0x72d9('0x3c')](_['pick'](_0x4838ad['query'],_0x10ace7[_0x72d9('0x3c')]));if(_0x4838ad[_0x72d9('0x3b')][_0x72d9('0x46')]){_0x42cb78['where']=_['merge'](_0x42cb78[_0x72d9('0x44')],{'$or':_[_0x72d9('0x33')](_0x42cb78[_0x72d9('0x3f')],function(_0x52d778){var _0x314140={};_0x314140[_0x52d778]={'$like':'%'+_0x4838ad[_0x72d9('0x3b')][_0x72d9('0x46')]+'%'};return _0x314140;})});}_0x42cb78=_[_0x72d9('0x47')]({},_0x42cb78,_0x4838ad['options']);return _0x2e821d[_0x72d9('0x68')](_0x42cb78);}})[_0x72d9('0x2b')](function(_0x2f885b){if(_0x2f885b){_0x27d5e9=_0x2f885b['length'];if(!_0x4838ad[_0x72d9('0x3b')][_0x72d9('0x40')](_0x72d9('0x41'))){_0x42cb78[_0x72d9('0x25')]=qs[_0x72d9('0x25')](_0x4838ad[_0x72d9('0x3b')][_0x72d9('0x25')]);_0x42cb78['offset']=qs[_0x72d9('0x23')](_0x4838ad[_0x72d9('0x3b')][_0x72d9('0x23')]);}return _0x2e821d['getTeams'](_0x42cb78);}})[_0x72d9('0x2b')](function(_0x51650c){if(_0x51650c){return _0x51650c?{'count':_0x27d5e9,'rows':_0x51650c}:null;}})[_0x72d9('0x2b')](respondWithResult(_0x39eb41,null))['catch'](handleError(_0x39eb41,null));};exports[_0x72d9('0x6a')]=function(_0x5dbfcf,_0x6930b8,_0x2cf119){var _0x4ec60d=_0x5dbfcf[_0x72d9('0x5c')][_0x72d9('0x6b')];return db[_0x72d9('0x69')]['findAll']({'where':{'id':_0x4ec60d},'attributes':['id'],'include':[{'model':db[_0x72d9('0x62')],'as':_0x72d9('0x6c'),'attributes':['id','name',_0x72d9('0x6d'),_0x72d9('0x6e'),_0x72d9('0x6f')],'raw':!![]}]})['then'](function(_0x96fb4c){if(_0x96fb4c){var _0x251a1c=_[_0x72d9('0x70')](_0x96fb4c,function(_0x1bdc19){var _0x5a0cc0=_0x1bdc19[_0x72d9('0x2d')]({'plain':!![]});return _0x5a0cc0[_0x72d9('0x6c')];});return db['FaxQueue'][_0x72d9('0x59')]({'where':{'id':_0x5dbfcf[_0x72d9('0x50')]['id']}})[_0x72d9('0x2b')](function(_0x3d12fd){return db[_0x72d9('0x71')][_0x72d9('0x72')](function(_0x4a469d){return _0x3d12fd['addTeams'](_0x4ec60d,{'transaction':_0x4a469d})[_0x72d9('0x2b')](function(){return BPromise[_0x72d9('0x73')](_0x251a1c,function(_0x3bfbed){return db[_0x72d9('0x60')]['findOrCreate']({'where':{'UserId':_0x3bfbed['id'],'FaxQueueId':_0x5dbfcf[_0x72d9('0x50')]['id']},'transaction':_0x4a469d});});})[_0x72d9('0x2b')](function(){_0x251a1c[_0x72d9('0x74')](function(_0x592ea3){socket[_0x72d9('0x75')](_0x72d9('0x76'),{'UserId':_0x592ea3['id'],'FaxQueueId':_0x3d12fd['id']});});});});});}})['then'](respondWithStatusCode(_0x6930b8,null))[_0x72d9('0x4e')](handleError(_0x6930b8,null));};exports['removeTeams']=function(_0x39951a,_0x237e74,_0x2cf7a7){return db[_0x72d9('0x69')]['findAll']({'where':{'id':_0x39951a[_0x72d9('0x3b')][_0x72d9('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x72d9('0x62')],'as':_0x72d9('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x72d9('0x2b')](handleEntityNotFound(_0x237e74,null))[_0x72d9('0x2b')](function(_0x56233b){var _0x296fde=_['map'](_0x56233b,'id');var _0x43c3b5=[];var _0x53749a=[];var _0x4d7b6e=squel[_0x72d9('0x77')]();_0x4d7b6e[_0x72d9('0x78')]('tq.TeamId')[_0x72d9('0x79')](_0x72d9('0x7a'),'tq')[_0x72d9('0x7b')]('user_has_teams','ut',_0x72d9('0x7c'))['where'](_0x72d9('0x7d'),_0x39951a[_0x72d9('0x50')]['id']);for(var _0x2622ac=0x0;_0x2622ac<_0x56233b[_0x72d9('0x51')];_0x2622ac+=0x1){let _0x571700=_0x56233b[_0x2622ac];for(var _0x5ed2d8=0x0;_0x5ed2d8<_0x571700[_0x72d9('0x6c')]['length'];_0x5ed2d8+=0x1){let _0x3e8a16=_0x571700[_0x72d9('0x6c')][_0x5ed2d8];var _0x8c5859=_0x4d7b6e[_0x72d9('0x7e')]();_0x8c5859[_0x72d9('0x44')](_0x72d9('0x7f'),_0x3e8a16['id']);_0x53749a['push'](db[_0x72d9('0x71')][_0x72d9('0x3b')](_0x8c5859[_0x72d9('0x80')](),{'type':db['sequelize'][_0x72d9('0x81')][_0x72d9('0x82')]})['then'](function(_0x264654){if(_0x264654[_0x72d9('0x51')]===0x1){return _0x3e8a16['id'];}else{var _0x4b20f3=_[_0x72d9('0x83')](_[_0x72d9('0x33')](_0x264654,_0x72d9('0x84')),function(_0x4f755f){return _[_0x72d9('0x85')](_0x296fde,_0x4f755f);});if(_0x4b20f3){return _0x3e8a16['id'];}}}));}}return BPromise['all'](_0x53749a)[_0x72d9('0x2b')](function(_0x294344){_0x43c3b5=_(_0x43c3b5)['union'](_0x294344)['compact']()[_0x72d9('0x86')]();return db[_0x72d9('0x4b')][_0x72d9('0x59')]({'where':{'id':_0x39951a[_0x72d9('0x50')]['id']}})[_0x72d9('0x2b')](function(_0x4b64e0){return db[_0x72d9('0x71')][_0x72d9('0x72')](function(_0x17d0d7){return _0x4b64e0['removeTeams'](_0x39951a[_0x72d9('0x3b')]['ids'],{'transaction':_0x17d0d7})[_0x72d9('0x2b')](function(){if(!_[_0x72d9('0x87')](_0x43c3b5)){return _0x4b64e0[_0x72d9('0x88')](_0x43c3b5,{'transaction':_0x17d0d7});}})[_0x72d9('0x2b')](function(){_0x43c3b5['forEach'](function(_0x50585c){socket[_0x72d9('0x75')](_0x72d9('0x89'),{'UserId':_0x50585c,'FaxQueueId':_0x4b64e0['id']});});});});});});})[_0x72d9('0x2b')](respondWithStatusCode(_0x237e74,null))[_0x72d9('0x4e')](handleError(_0x237e74,null));};exports['addAgents']=function(_0x107924,_0x4c8351,_0x179b85){return db[_0x72d9('0x4b')]['find']({'where':{'id':_0x107924[_0x72d9('0x50')]['id']}})['then'](handleEntityNotFound(_0x4c8351,null))[_0x72d9('0x2b')](function(_0x1b383e){if(_0x1b383e){return _0x1b383e[_0x72d9('0x8a')](_0x107924['body'][_0x72d9('0x6b')],_[_0x72d9('0x8b')](_0x107924[_0x72d9('0x5c')],[_0x72d9('0x6b'),'id'])||{})[_0x72d9('0x8c')](function(_0x207a05){for(var _0x3cb34c=0x0;_0x3cb34c<_0x107924['body'][_0x72d9('0x6b')][_0x72d9('0x51')];_0x3cb34c+=0x1){socket[_0x72d9('0x75')]('userFaxQueue:save',{'UserId':Number(_0x107924[_0x72d9('0x5c')][_0x72d9('0x6b')][_0x3cb34c]),'FaxQueueId':Number(_0x107924[_0x72d9('0x50')]['id'])});}return _0x207a05;});}})[_0x72d9('0x2b')](respondWithResult(_0x4c8351,null))[_0x72d9('0x4e')](handleError(_0x4c8351,null));};exports[_0x72d9('0x88')]=function(_0x2bc63d,_0x12a297,_0x139b53){return db[_0x72d9('0x4b')][_0x72d9('0x59')]({'where':{'id':_0x2bc63d[_0x72d9('0x50')]['id']}})[_0x72d9('0x2b')](handleEntityNotFound(_0x12a297,null))['then'](function(_0x66ff31){if(_0x66ff31){return _0x66ff31[_0x72d9('0x88')](_0x2bc63d[_0x72d9('0x3b')][_0x72d9('0x6b')])['then'](function(){if(_[_0x72d9('0x8d')](_0x2bc63d['query']['ids'])){for(var _0x3cdb11=0x0;_0x3cdb11<_0x2bc63d['query'][_0x72d9('0x6b')][_0x72d9('0x51')];_0x3cdb11+=0x1){socket[_0x72d9('0x75')]('userFaxQueue:remove',{'UserId':Number(_0x2bc63d['query'][_0x72d9('0x6b')][_0x3cdb11]),'FaxQueueId':Number(_0x2bc63d['params']['id'])});}}else{socket['emit'](_0x72d9('0x89'),{'UserId':Number(_0x2bc63d[_0x72d9('0x3b')][_0x72d9('0x6b')]),'FaxQueueId':Number(_0x2bc63d['params']['id'])});}});}})['then'](respondWithStatusCode(_0x12a297,null))[_0x72d9('0x4e')](handleError(_0x12a297,null));};exports[_0x72d9('0x8e')]=function(_0xffb377,_0x59e842,_0x5b768c){var _0x3ecfe9={};var _0xc18c50={};var _0x18081a;var _0x399226;return db['FaxQueue'][_0x72d9('0x5f')]({'where':{'id':_0xffb377[_0x72d9('0x50')]['id']}})[_0x72d9('0x2b')](handleEntityNotFound(_0x59e842,null))['then'](function(_0x564bd6){if(_0x564bd6){_0x18081a=_0x564bd6;_0xc18c50[_0x72d9('0x38')]=_[_0x72d9('0x3a')](db[_0x72d9('0x62')][_0x72d9('0x34')]);_0xc18c50[_0x72d9('0x3b')]=_[_0x72d9('0x3a')](_0xffb377[_0x72d9('0x3b')]);_0xc18c50[_0x72d9('0x3c')]=_[_0x72d9('0x3d')](_0xc18c50['model'],_0xc18c50['query']);_0x3ecfe9[_0x72d9('0x3f')]=_[_0x72d9('0x3d')](_0xc18c50[_0x72d9('0x38')],qs['fields'](_0xffb377['query'][_0x72d9('0x3e')]));_0x3ecfe9[_0x72d9('0x3f')]=_0x3ecfe9[_0x72d9('0x3f')]['length']?_0x3ecfe9[_0x72d9('0x3f')]:_0xc18c50[_0x72d9('0x38')];_0x3ecfe9[_0x72d9('0x42')]=qs[_0x72d9('0x43')](_0xffb377[_0x72d9('0x3b')][_0x72d9('0x43')]);_0x3ecfe9[_0x72d9('0x44')]=qs[_0x72d9('0x3c')](_['pick'](_0xffb377[_0x72d9('0x3b')],_0xc18c50['filters']));if(_0xffb377['query'][_0x72d9('0x46')]){_0x3ecfe9[_0x72d9('0x44')]=_[_0x72d9('0x47')](_0x3ecfe9[_0x72d9('0x44')],{'$or':_[_0x72d9('0x33')](_0x3ecfe9[_0x72d9('0x3f')],function(_0x69bd63){var _0xf8a012={};_0xf8a012[_0x69bd63]={'$like':'%'+_0xffb377[_0x72d9('0x3b')]['filter']+'%'};return _0xf8a012;})});}_0x3ecfe9=_[_0x72d9('0x47')]({},_0x3ecfe9,_0xffb377['options']);return _0x18081a[_0x72d9('0x8e')](_0x3ecfe9);}})[_0x72d9('0x2b')](function(_0x2ad827){if(_0x2ad827){_0x399226=_0x2ad827[_0x72d9('0x51')];if(!_0xffb377['query'][_0x72d9('0x40')](_0x72d9('0x41'))){_0x3ecfe9[_0x72d9('0x25')]=qs[_0x72d9('0x25')](_0xffb377[_0x72d9('0x3b')]['limit']);_0x3ecfe9['offset']=qs[_0x72d9('0x23')](_0xffb377[_0x72d9('0x3b')]['offset']);}return _0x18081a['getAgents'](_0x3ecfe9);}})[_0x72d9('0x2b')](function(_0xe3a74b){if(_0xe3a74b){return _0xe3a74b?{'count':_0x399226,'rows':_0xe3a74b}:null;}})[_0x72d9('0x2b')](respondWithResult(_0x59e842,null))[_0x72d9('0x4e')](handleError(_0x59e842,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index cc8fbb7..5a82c6f 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 _0x026c=['hasOwnProperty','hook','../../mysqldb','FaxQueue','setMaxListeners','remove','emit'];(function(_0x3ef933,_0x363dfd){var _0x58f21f=function(_0x35104e){while(--_0x35104e){_0x3ef933['push'](_0x3ef933['shift']());}};_0x58f21f(++_0x363dfd);}(_0x026c,0x1d7));var _0xc026=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0x026c[_0x556927];return _0x5f1235;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0xc026('0x0'))['db'][_0xc026('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xc026('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xc026('0x3')};function emitEvent(_0x429427){return function(_0x1d0c99,_0x48709a,_0x226d70){FaxQueueEvents[_0xc026('0x4')](_0x429427+':'+_0x1d0c99['id'],_0x1d0c99);FaxQueueEvents[_0xc026('0x4')](_0x429427,_0x1d0c99);_0x226d70(null);};}for(var e in events){if(events[_0xc026('0x5')](e)){var event=events[e];FaxQueue[_0xc026('0x6')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x737d=['emit','hasOwnProperty','hook','../../mysqldb','FaxQueue','setMaxListeners','save','update'];(function(_0x485d99,_0x2a6383){var _0x323b39=function(_0x2005aa){while(--_0x2005aa){_0x485d99['push'](_0x485d99['shift']());}};_0x323b39(++_0x2a6383);}(_0x737d,0x12b));var _0xd737=function(_0x592760,_0x34dbf5){_0x592760=_0x592760-0x0;var _0x3a1052=_0x737d[_0x592760];return _0x3a1052;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0xd737('0x0'))['db'][_0xd737('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xd737('0x2')](0x0);var events={'afterCreate':_0xd737('0x3'),'afterUpdate':_0xd737('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4212cc){return function(_0x415a00,_0x55d893,_0x8ad17f){FaxQueueEvents[_0xd737('0x5')](_0x4212cc+':'+_0x415a00['id'],_0x415a00);FaxQueueEvents[_0xd737('0x5')](_0x4212cc,_0x415a00);_0x8ad17f(null);};}for(var e in events){if(events[_0xd737('0x6')](e)){var event=events[e];FaxQueue[_0xd737('0x7')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 34fb4a9..6dd49e7 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 _0x7a0a=['lodash','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x8c7ccf,_0xe3f870){var _0x54f922=function(_0xc0aaba){while(--_0xc0aaba){_0x8c7ccf['push'](_0x8c7ccf['shift']());}};_0x54f922(++_0xe3f870);}(_0x7a0a,0xd8));var _0xa7a0=function(_0x388e28,_0x1a14a5){_0x388e28=_0x388e28-0x0;var _0x16f494=_0x7a0a[_0x388e28];return _0x16f494;};'use strict';var _=require(_0xa7a0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa7a0('0x1'));var moment=require(_0xa7a0('0x2'));var BPromise=require(_0xa7a0('0x3'));var rp=require(_0xa7a0('0x4'));var fs=require('fs');var path=require(_0xa7a0('0x5'));var rimraf=require('rimraf');var config=require(_0xa7a0('0x6'));var attributes=require('./faxQueue.attributes');module[_0xa7a0('0x7')]=function(_0x5c75f2,_0x10db6b){return _0x5c75f2[_0xa7a0('0x8')]('FaxQueue',attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa932=['path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xa932,0x1d9));var _0x2a93=function(_0x154cbb,_0x43c57f){_0x154cbb=_0x154cbb-0x0;var _0x494584=_0xa932[_0x154cbb];return _0x494584;};'use strict';var _=require(_0x2a93('0x0'));var util=require(_0x2a93('0x1'));var logger=require(_0x2a93('0x2'))(_0x2a93('0x3'));var moment=require(_0x2a93('0x4'));var BPromise=require(_0x2a93('0x5'));var rp=require(_0x2a93('0x6'));var fs=require('fs');var path=require(_0x2a93('0x7'));var rimraf=require(_0x2a93('0x8'));var config=require(_0x2a93('0x9'));var attributes=require(_0x2a93('0xa'));module[_0x2a93('0xb')]=function(_0x2fbeb1,_0x3ab7c2){return _0x2fbeb1[_0x2a93('0xc')](_0x2a93('0xd'),attributes,{'tableName':_0x2a93('0xe'),'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 3bb62b2..49a227b 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 _0x512d=['findAll','options','raw','where','limit','include','map','attributes','model','ShowFaxQueue','FaxQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x512d,0x87));var _0xd512=function(_0x350d00,_0x3fc641){_0x350d00=_0x350d00-0x0;var _0x244dd9=_0x512d[_0x350d00];return _0x244dd9;};'use strict';var _=require(_0xd512('0x0'));var util=require(_0xd512('0x1'));var moment=require(_0xd512('0x2'));var BPromise=require(_0xd512('0x3'));var rs=require(_0xd512('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd512('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd512('0x6'))(_0xd512('0x7'));var config=require('../../config/environment');var jayson=require(_0xd512('0x8'));var client=jayson[_0xd512('0x9')][_0xd512('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xd512('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xd512('0xc'))(new Redis(config[_0xd512('0xb')]));require(_0xd512('0xd'))[_0xd512('0xe')](socket);function respondWithRpcPromise(_0x6b59d5,_0x97bfc7,_0x2810c9){return new BPromise(function(_0x2fbd26,_0x5dc8e3){return client[_0xd512('0xf')](_0x6b59d5,_0x2810c9)[_0xd512('0x10')](function(_0x2eab0f){logger[_0xd512('0x11')](_0xd512('0x12'),_0x97bfc7,_0xd512('0x13'));logger[_0xd512('0x14')](_0xd512('0x15'),_0x97bfc7,_0xd512('0x13'),JSON[_0xd512('0x16')](_0x2eab0f));if(_0x2eab0f[_0xd512('0x17')]){if(_0x2eab0f['error'][_0xd512('0x18')]===0x1f4){logger[_0xd512('0x17')](_0xd512('0x12'),_0x97bfc7,_0x2eab0f[_0xd512('0x17')][_0xd512('0x19')]);return _0x5dc8e3(_0x2eab0f[_0xd512('0x17')]['message']);}logger['error'](_0xd512('0x12'),_0x97bfc7,_0x2eab0f[_0xd512('0x17')]['message']);return _0x2fbd26(_0x2eab0f[_0xd512('0x17')]['message']);}else{logger[_0xd512('0x11')](_0xd512('0x12'),_0x97bfc7,_0xd512('0x13'));_0x2fbd26(_0x2eab0f[_0xd512('0x1a')][_0xd512('0x19')]);}})[_0xd512('0x1b')](function(_0x3de81d){logger['error'](_0xd512('0x12'),_0x97bfc7,_0x3de81d);_0x5dc8e3(_0x3de81d);});});}exports[_0xd512('0x1c')]=function(_0x143255){var _0x3c1eb8=this;return new Promise(function(_0x3f0611,_0x2e0fc8){return db['FaxQueue'][_0xd512('0x1d')]({'raw':_0x143255[_0xd512('0x1e')]?_0x143255[_0xd512('0x1e')][_0xd512('0x1f')]===undefined?!![]:![]:!![],'where':_0x143255[_0xd512('0x1e')]?_0x143255['options'][_0xd512('0x20')]||null:null,'attributes':_0x143255['options']?_0x143255[_0xd512('0x1e')]['attributes']||null:null,'limit':_0x143255[_0xd512('0x1e')]?_0x143255[_0xd512('0x1e')][_0xd512('0x21')]||null:null,'include':_0x143255[_0xd512('0x1e')]?_0x143255['options'][_0xd512('0x22')]?_[_0xd512('0x23')](_0x143255[_0xd512('0x1e')][_0xd512('0x22')],function(_0x3d4ffc){return{'model':db[_0x3d4ffc['model']],'as':_0x3d4ffc['as'],'attributes':_0x3d4ffc[_0xd512('0x24')],'include':_0x3d4ffc['include']?_['map'](_0x3d4ffc[_0xd512('0x22')],function(_0x48acd7){return{'model':db[_0x48acd7[_0xd512('0x25')]],'as':_0x48acd7['as'],'attributes':_0x48acd7[_0xd512('0x24')],'include':_0x48acd7['include']?_[_0xd512('0x23')](_0x48acd7[_0xd512('0x22')],function(_0x480565){return{'model':db[_0x480565[_0xd512('0x25')]],'as':_0x480565['as'],'attributes':_0x480565['attributes']};}):[]};}):[]};}):[]:[]})[_0xd512('0x10')](function(_0x47fdd5){logger['info'](_0xd512('0x1c'),_0x143255);logger[_0xd512('0x14')](_0xd512('0x1c'),_0x143255,JSON['stringify'](_0x47fdd5));_0x3f0611(_0x47fdd5);})[_0xd512('0x1b')](function(_0x286295){logger[_0xd512('0x17')](_0xd512('0x1c'),_0x286295[_0xd512('0x19')],_0x143255);_0x2e0fc8(_0x3c1eb8[_0xd512('0x17')](0x1f4,_0x286295[_0xd512('0x19')]));});});};exports[_0xd512('0x26')]=function(_0x551cd0){var _0x5f4868=this;return new Promise(function(_0x1d7714,_0x4f2612){return db[_0xd512('0x27')][_0xd512('0x28')]({'raw':_0x551cd0[_0xd512('0x1e')]?_0x551cd0[_0xd512('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x551cd0[_0xd512('0x1e')]?_0x551cd0[_0xd512('0x1e')][_0xd512('0x20')]||null:null,'attributes':_0x551cd0['options']?_0x551cd0[_0xd512('0x1e')][_0xd512('0x24')]||null:null,'include':_0x551cd0[_0xd512('0x1e')]?_0x551cd0[_0xd512('0x1e')][_0xd512('0x22')]?_[_0xd512('0x23')](_0x551cd0['options'][_0xd512('0x22')],function(_0x51d6bc){return{'model':db[_0x51d6bc[_0xd512('0x25')]],'as':_0x51d6bc['as'],'attributes':_0x51d6bc['attributes'],'include':_0x51d6bc[_0xd512('0x22')]?_[_0xd512('0x23')](_0x51d6bc[_0xd512('0x22')],function(_0xb619d2){return{'model':db[_0xb619d2[_0xd512('0x25')]],'as':_0xb619d2['as'],'attributes':_0xb619d2[_0xd512('0x24')],'include':_0xb619d2[_0xd512('0x22')]?_[_0xd512('0x23')](_0xb619d2[_0xd512('0x22')],function(_0x2d3ce9){return{'model':db[_0x2d3ce9[_0xd512('0x25')]],'as':_0x2d3ce9['as'],'attributes':_0x2d3ce9[_0xd512('0x24')]};}):[]};}):[]};}):[]:[]})[_0xd512('0x10')](function(_0x4ebdb7){logger['info'](_0xd512('0x26'),_0x551cd0);logger[_0xd512('0x14')](_0xd512('0x26'),_0x551cd0,JSON['stringify'](_0x4ebdb7));_0x1d7714(_0x4ebdb7);})['catch'](function(_0x11d447){logger[_0xd512('0x17')](_0xd512('0x26'),_0x11d447[_0xd512('0x19')],_0x551cd0);_0x4f2612(_0x5f4868[_0xd512('0x17')](0x1f4,_0x11d447[_0xd512('0x19')]));});});}; \ No newline at end of file +var _0x3b4b=['ShowFaxQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','map','include','model','catch'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x3b4b,0x136));var _0xb3b4=function(_0x284c96,_0x3e1bec){_0x284c96=_0x284c96-0x0;var _0xbdbb1e=_0x3b4b[_0x284c96];return _0xbdbb1e;};'use strict';var _=require('lodash');var util=require(_0xb3b4('0x0'));var moment=require(_0xb3b4('0x1'));var BPromise=require(_0xb3b4('0x2'));var rs=require(_0xb3b4('0x3'));var fs=require('fs');var Redis=require(_0xb3b4('0x4'));var db=require(_0xb3b4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb3b4('0x6'))(_0xb3b4('0x7'));var config=require(_0xb3b4('0x8'));var jayson=require(_0xb3b4('0x9'));var client=jayson[_0xb3b4('0xa')][_0xb3b4('0xb')]({'port':0x232a});config['redis']=_[_0xb3b4('0xc')](config[_0xb3b4('0xd')],{'host':_0xb3b4('0xe'),'port':0x18eb});var socket=require(_0xb3b4('0xf'))(new Redis(config[_0xb3b4('0xd')]));require(_0xb3b4('0x10'))[_0xb3b4('0x11')](socket);function respondWithRpcPromise(_0x5a51ad,_0x5a2ffa,_0x9aecbd){return new BPromise(function(_0x5aec31,_0x1bb47e){return client[_0xb3b4('0x12')](_0x5a51ad,_0x9aecbd)[_0xb3b4('0x13')](function(_0x40b319){logger[_0xb3b4('0x14')](_0xb3b4('0x15'),_0x5a2ffa,'request\x20sent');logger[_0xb3b4('0x16')](_0xb3b4('0x17'),_0x5a2ffa,_0xb3b4('0x18'),JSON[_0xb3b4('0x19')](_0x40b319));if(_0x40b319[_0xb3b4('0x1a')]){if(_0x40b319[_0xb3b4('0x1a')][_0xb3b4('0x1b')]===0x1f4){logger[_0xb3b4('0x1a')](_0xb3b4('0x15'),_0x5a2ffa,_0x40b319[_0xb3b4('0x1a')][_0xb3b4('0x1c')]);return _0x1bb47e(_0x40b319[_0xb3b4('0x1a')][_0xb3b4('0x1c')]);}logger[_0xb3b4('0x1a')](_0xb3b4('0x15'),_0x5a2ffa,_0x40b319['error'][_0xb3b4('0x1c')]);return _0x5aec31(_0x40b319[_0xb3b4('0x1a')]['message']);}else{logger[_0xb3b4('0x14')](_0xb3b4('0x15'),_0x5a2ffa,_0xb3b4('0x18'));_0x5aec31(_0x40b319[_0xb3b4('0x1d')][_0xb3b4('0x1c')]);}})['catch'](function(_0x57d6fa){logger[_0xb3b4('0x1a')](_0xb3b4('0x15'),_0x5a2ffa,_0x57d6fa);_0x1bb47e(_0x57d6fa);});});}exports[_0xb3b4('0x1e')]=function(_0x4a5910){var _0x1537a9=this;return new Promise(function(_0x70c155,_0x41b970){return db[_0xb3b4('0x1f')][_0xb3b4('0x20')]({'raw':_0x4a5910[_0xb3b4('0x21')]?_0x4a5910[_0xb3b4('0x21')][_0xb3b4('0x22')]===undefined?!![]:![]:!![],'where':_0x4a5910['options']?_0x4a5910['options'][_0xb3b4('0x23')]||null:null,'attributes':_0x4a5910['options']?_0x4a5910[_0xb3b4('0x21')][_0xb3b4('0x24')]||null:null,'limit':_0x4a5910[_0xb3b4('0x21')]?_0x4a5910[_0xb3b4('0x21')][_0xb3b4('0x25')]||null:null,'include':_0x4a5910[_0xb3b4('0x21')]?_0x4a5910[_0xb3b4('0x21')]['include']?_[_0xb3b4('0x26')](_0x4a5910[_0xb3b4('0x21')][_0xb3b4('0x27')],function(_0x1e4da5){return{'model':db[_0x1e4da5[_0xb3b4('0x28')]],'as':_0x1e4da5['as'],'attributes':_0x1e4da5['attributes'],'include':_0x1e4da5[_0xb3b4('0x27')]?_[_0xb3b4('0x26')](_0x1e4da5[_0xb3b4('0x27')],function(_0x9cb58d){return{'model':db[_0x9cb58d[_0xb3b4('0x28')]],'as':_0x9cb58d['as'],'attributes':_0x9cb58d[_0xb3b4('0x24')],'include':_0x9cb58d[_0xb3b4('0x27')]?_[_0xb3b4('0x26')](_0x9cb58d[_0xb3b4('0x27')],function(_0x9cd010){return{'model':db[_0x9cd010[_0xb3b4('0x28')]],'as':_0x9cd010['as'],'attributes':_0x9cd010[_0xb3b4('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x494782){logger['info'](_0xb3b4('0x1e'),_0x4a5910);logger[_0xb3b4('0x16')](_0xb3b4('0x1e'),_0x4a5910,JSON['stringify'](_0x494782));_0x70c155(_0x494782);})[_0xb3b4('0x29')](function(_0x1552d0){logger[_0xb3b4('0x1a')](_0xb3b4('0x1e'),_0x1552d0['message'],_0x4a5910);_0x41b970(_0x1537a9[_0xb3b4('0x1a')](0x1f4,_0x1552d0[_0xb3b4('0x1c')]));});});};exports[_0xb3b4('0x2a')]=function(_0x54606b){var _0x210eba=this;return new Promise(function(_0x23c27a,_0x188bbe){return db[_0xb3b4('0x1f')][_0xb3b4('0x2b')]({'raw':_0x54606b[_0xb3b4('0x21')]?_0x54606b['options'][_0xb3b4('0x22')]===undefined?!![]:![]:!![],'where':_0x54606b[_0xb3b4('0x21')]?_0x54606b['options'][_0xb3b4('0x23')]||null:null,'attributes':_0x54606b['options']?_0x54606b[_0xb3b4('0x21')][_0xb3b4('0x24')]||null:null,'include':_0x54606b[_0xb3b4('0x21')]?_0x54606b[_0xb3b4('0x21')]['include']?_[_0xb3b4('0x26')](_0x54606b['options'][_0xb3b4('0x27')],function(_0x2fa109){return{'model':db[_0x2fa109['model']],'as':_0x2fa109['as'],'attributes':_0x2fa109[_0xb3b4('0x24')],'include':_0x2fa109[_0xb3b4('0x27')]?_[_0xb3b4('0x26')](_0x2fa109[_0xb3b4('0x27')],function(_0x48a3e8){return{'model':db[_0x48a3e8['model']],'as':_0x48a3e8['as'],'attributes':_0x48a3e8[_0xb3b4('0x24')],'include':_0x48a3e8[_0xb3b4('0x27')]?_[_0xb3b4('0x26')](_0x48a3e8['include'],function(_0x47ed2d){return{'model':db[_0x47ed2d[_0xb3b4('0x28')]],'as':_0x47ed2d['as'],'attributes':_0x47ed2d[_0xb3b4('0x24')]};}):[]};}):[]};}):[]:[]})[_0xb3b4('0x13')](function(_0x44a1e5){logger[_0xb3b4('0x14')](_0xb3b4('0x2a'),_0x54606b);logger[_0xb3b4('0x16')]('ShowFaxQueue',_0x54606b,JSON[_0xb3b4('0x19')](_0x44a1e5));_0x23c27a(_0x44a1e5);})['catch'](function(_0x17e5dc){logger['error'](_0xb3b4('0x2a'),_0x17e5dc[_0xb3b4('0x1c')],_0x54606b);_0x188bbe(_0x210eba['error'](0x1f4,_0x17e5dc[_0xb3b4('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 83036a8..b54b498 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 _0x6a33=['faxQueue:','remove','update','emit','removeListener','register','length'];(function(_0x2cbd1b,_0x195a15){var _0x359335=function(_0x1a4bb3){while(--_0x1a4bb3){_0x2cbd1b['push'](_0x2cbd1b['shift']());}};_0x359335(++_0x195a15);}(_0x6a33,0x9b));var _0x36a3=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x6a33[_0x13d07a];return _0x5ee0ee;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=['save',_0x36a3('0x0'),_0x36a3('0x1')];function createListener(_0x415caa,_0x1347d3){return function(_0x2a3766){_0x1347d3[_0x36a3('0x2')](_0x415caa,_0x2a3766);};}function removeListener(_0x3c14af,_0x99f59b){return function(){FaxQueueEvents[_0x36a3('0x3')](_0x3c14af,_0x99f59b);};}exports[_0x36a3('0x4')]=function(_0x13ffee){for(var _0x3f536a=0x0,_0x33752f=events[_0x36a3('0x5')];_0x3f536a<_0x33752f;_0x3f536a++){var _0x5f30ba=events[_0x3f536a];var _0x24f209=createListener(_0x36a3('0x6')+_0x5f30ba,_0x13ffee);FaxQueueEvents['on'](_0x5f30ba,_0x24f209);}}; \ No newline at end of file +var _0x7a55=['./faxQueue.events','remove','update','emit','removeListener','faxQueue:'];(function(_0x1d3af6,_0x77f8b5){var _0x3ca03f=function(_0x143558){while(--_0x143558){_0x1d3af6['push'](_0x1d3af6['shift']());}};_0x3ca03f(++_0x77f8b5);}(_0x7a55,0xea));var _0x57a5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7a55[_0x321bb2];return _0x9c12ed;};'use strict';var FaxQueueEvents=require(_0x57a5('0x0'));var events=['save',_0x57a5('0x1'),_0x57a5('0x2')];function createListener(_0x4a0d21,_0x1b2d91){return function(_0x519c9d){_0x1b2d91[_0x57a5('0x3')](_0x4a0d21,_0x519c9d);};}function removeListener(_0x4aba27,_0x4aedfc){return function(){FaxQueueEvents[_0x57a5('0x4')](_0x4aba27,_0x4aedfc);};}exports['register']=function(_0x4c85c1){for(var _0x2e962d=0x0,_0x38ffbf=events['length'];_0x2e962d<_0x38ffbf;_0x2e962d++){var _0x1bc58e=events[_0x2e962d];var _0x1d4db1=createListener(_0x57a5('0x5')+_0x1bc58e,_0x4c85c1);FaxQueueEvents['on'](_0x1bc58e,_0x1d4db1);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 03d1ba9..b046133 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 _0x41d0=['addTeams','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','getTeams','/:id/users','getAgents','post','create','/:id/teams'];(function(_0x4ad0cd,_0x4b0ae3){var _0x452af8=function(_0x4ab00c){while(--_0x4ab00c){_0x4ad0cd['push'](_0x4ad0cd['shift']());}};_0x452af8(++_0x4b0ae3);}(_0x41d0,0x1c6));var _0x041d=function(_0x251f27,_0x1237bc){_0x251f27=_0x251f27-0x0;var _0x452654=_0x41d0[_0x251f27];return _0x452654;};'use strict';var multer=require(_0x041d('0x0'));var util=require(_0x041d('0x1'));var path=require(_0x041d('0x2'));var timeout=require(_0x041d('0x3'));var express=require('express');var router=express[_0x041d('0x4')]();var fs_extra=require(_0x041d('0x5'));var auth=require(_0x041d('0x6'));var interaction=require(_0x041d('0x7'));var config=require(_0x041d('0x8'));var controller=require(_0x041d('0x9'));router[_0x041d('0xa')]('/',auth[_0x041d('0xb')](),controller[_0x041d('0xc')]);router['get'](_0x041d('0xd'),auth['isAuthenticated'](),controller[_0x041d('0xe')]);router['get'](_0x041d('0xf'),auth[_0x041d('0xb')](),controller['show']);router['get']('/:id/members',auth[_0x041d('0xb')](),controller['getMembers']);router[_0x041d('0xa')]('/:id/teams',auth[_0x041d('0xb')](),controller[_0x041d('0x10')]);router[_0x041d('0xa')](_0x041d('0x11'),auth[_0x041d('0xb')](),controller[_0x041d('0x12')]);router[_0x041d('0x13')]('/',auth[_0x041d('0xb')](),controller[_0x041d('0x14')]);router['post'](_0x041d('0x15'),auth[_0x041d('0xb')](),controller[_0x041d('0x16')]);router[_0x041d('0x13')](_0x041d('0x11'),auth[_0x041d('0xb')](),controller['addAgents']);router[_0x041d('0x17')](_0x041d('0xf'),auth[_0x041d('0xb')](),controller[_0x041d('0x18')]);router[_0x041d('0x19')](_0x041d('0xf'),auth['isAuthenticated'](),controller['destroy']);router[_0x041d('0x19')](_0x041d('0x15'),auth['isAuthenticated'](),controller[_0x041d('0x1a')]);router['delete'](_0x041d('0x11'),auth[_0x041d('0xb')](),controller[_0x041d('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x0e4b=['delete','destroy','removeAgents','exports','multer','util','path','express','../../config/environment','./faxQueue.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','addTeams','post','put','update'];(function(_0xa1cd6a,_0x25a64f){var _0xa6629a=function(_0x16c921){while(--_0x16c921){_0xa1cd6a['push'](_0xa1cd6a['shift']());}};_0xa6629a(++_0x25a64f);}(_0x0e4b,0xdc));var _0xb0e4=function(_0xe4f94b,_0x3d3fd9){_0xe4f94b=_0xe4f94b-0x0;var _0x386865=_0x0e4b[_0xe4f94b];return _0x386865;};'use strict';var multer=require(_0xb0e4('0x0'));var util=require(_0xb0e4('0x1'));var path=require(_0xb0e4('0x2'));var timeout=require('connect-timeout');var express=require(_0xb0e4('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(_0xb0e4('0x4'));var controller=require(_0xb0e4('0x5'));router['get']('/',auth[_0xb0e4('0x6')](),controller[_0xb0e4('0x7')]);router[_0xb0e4('0x8')](_0xb0e4('0x9'),auth[_0xb0e4('0x6')](),controller['describe']);router['get'](_0xb0e4('0xa'),auth[_0xb0e4('0x6')](),controller[_0xb0e4('0xb')]);router[_0xb0e4('0x8')](_0xb0e4('0xc'),auth[_0xb0e4('0x6')](),controller[_0xb0e4('0xd')]);router[_0xb0e4('0x8')](_0xb0e4('0xe'),auth[_0xb0e4('0x6')](),controller[_0xb0e4('0xf')]);router[_0xb0e4('0x8')](_0xb0e4('0x10'),auth[_0xb0e4('0x6')](),controller[_0xb0e4('0x11')]);router['post']('/',auth[_0xb0e4('0x6')](),controller[_0xb0e4('0x12')]);router['post'](_0xb0e4('0xe'),auth[_0xb0e4('0x6')](),controller[_0xb0e4('0x13')]);router[_0xb0e4('0x14')](_0xb0e4('0x10'),auth['isAuthenticated'](),controller['addAgents']);router[_0xb0e4('0x15')](_0xb0e4('0xa'),auth['isAuthenticated'](),controller[_0xb0e4('0x16')]);router[_0xb0e4('0x17')](_0xb0e4('0xa'),auth[_0xb0e4('0x6')](),controller[_0xb0e4('0x18')]);router[_0xb0e4('0x17')]('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router[_0xb0e4('0x17')](_0xb0e4('0x10'),auth[_0xb0e4('0x6')](),controller[_0xb0e4('0x19')]);module[_0xb0e4('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 7034d39..224efe8 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 _0xc497=['STRING','DATE','moment','exports'];(function(_0x1b8607,_0x4fc7d6){var _0x34fbc5=function(_0x345fde){while(--_0x345fde){_0x1b8607['push'](_0x1b8607['shift']());}};_0x34fbc5(++_0x4fc7d6);}(_0xc497,0x7a));var _0x7c49=function(_0x2701d7,_0x2917e3){_0x2701d7=_0x2701d7-0x0;var _0x1a9cfe=_0xc497[_0x2701d7];return _0x1a9cfe;};'use strict';var moment=require(_0x7c49('0x0'));var Sequelize=require('sequelize');module[_0x7c49('0x1')]={'uniqueid':{'type':Sequelize[_0x7c49('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7c49('0x2')]},'joinAt':{'type':Sequelize[_0x7c49('0x3')]},'leaveAt':{'type':Sequelize[_0x7c49('0x3')]},'acceptAt':{'type':Sequelize[_0x7c49('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5ce6=['exports','STRING','DATE','moment','sequelize'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x5ce6,0x1cf));var _0x65ce=function(_0x5e6eac,_0x7d6b04){_0x5e6eac=_0x5e6eac-0x0;var _0x27afd9=_0x5ce6[_0x5e6eac];return _0x27afd9;};'use strict';var moment=require(_0x65ce('0x0'));var Sequelize=require(_0x65ce('0x1'));module[_0x65ce('0x2')]={'uniqueid':{'type':Sequelize[_0x65ce('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x65ce('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x65ce('0x4')]},'reason':{'type':Sequelize[_0x65ce('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index cd7f1b4..11ef6cf 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 _0x44a3=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','FaxQueueReport','rawAttributes','model','map','keys','query','filters','intersection','attributes','length','nolimit','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','fields','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x5c2d9e,_0x4d9364){var _0x43ea71=function(_0x18c8a4){while(--_0x18c8a4){_0x5c2d9e['push'](_0x5c2d9e['shift']());}};_0x43ea71(++_0x4d9364);}(_0x44a3,0x1a9));var _0x344a=function(_0x3a0585,_0x12062b){_0x3a0585=_0x3a0585-0x0;var _0xbdc3fc=_0x44a3[_0x3a0585];return _0xbdc3fc;};'use strict';var emlformat=require(_0x344a('0x0'));var rimraf=require(_0x344a('0x1'));var zipdir=require(_0x344a('0x2'));var jsonpatch=require(_0x344a('0x3'));var rp=require(_0x344a('0x4'));var moment=require(_0x344a('0x5'));var BPromise=require(_0x344a('0x6'));var Mustache=require(_0x344a('0x7'));var util=require('util');var path=require(_0x344a('0x8'));var sox=require(_0x344a('0x9'));var csv=require(_0x344a('0xa'));var ejs=require(_0x344a('0xb'));var fs=require('fs');var fs_extra=require(_0x344a('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x344a('0xd'));var toCsv=require(_0x344a('0xa'));var querystring=require(_0x344a('0xe'));var Papa=require(_0x344a('0xf'));var Redis=require(_0x344a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x344a('0x11'));var as=require(_0x344a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x344a('0x13'))('api');var utils=require(_0x344a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x344a('0x15'));var db=require(_0x344a('0x16'))['db'];function respondWithStatusCode(_0x57e42e,_0x4a69ea){_0x4a69ea=_0x4a69ea||0xcc;return function(_0x304b70){if(_0x304b70){return _0x57e42e[_0x344a('0x17')](_0x4a69ea);}return _0x57e42e[_0x344a('0x18')](_0x4a69ea)[_0x344a('0x19')]();};}function respondWithResult(_0x5a0df6,_0x133ad4){_0x133ad4=_0x133ad4||0xc8;return function(_0x4ee562){if(_0x4ee562){return _0x5a0df6[_0x344a('0x18')](_0x133ad4)[_0x344a('0x1a')](_0x4ee562);}};}function respondWithFilteredResult(_0xce0f65,_0x6e1639){return function(_0x58c8cd){if(_0x58c8cd){var _0x54a643=typeof _0x6e1639[_0x344a('0x1b')]===_0x344a('0x1c')&&typeof _0x6e1639[_0x344a('0x1d')]===_0x344a('0x1c');var _0x48b3ab=_0x58c8cd[_0x344a('0x1e')];var _0x277c06=_0x54a643?0x0:_0x6e1639['offset'];var _0x9fe854=_0x54a643?_0x58c8cd[_0x344a('0x1e')]:_0x6e1639[_0x344a('0x1b')]+_0x6e1639[_0x344a('0x1d')];var _0x13b382;if(_0x9fe854>=_0x48b3ab){_0x9fe854=_0x48b3ab;_0x13b382=0xc8;}else{_0x13b382=0xce;}_0xce0f65[_0x344a('0x18')](_0x13b382);return _0xce0f65[_0x344a('0x1f')](_0x344a('0x20'),_0x277c06+'-'+_0x9fe854+'/'+_0x48b3ab)[_0x344a('0x1a')](_0x58c8cd);}return null;};}function patchUpdates(_0x450922){return function(_0x4b3552){try{jsonpatch[_0x344a('0x21')](_0x4b3552,_0x450922,!![]);}catch(_0x4232eb){return BPromise[_0x344a('0x22')](_0x4232eb);}return _0x4b3552[_0x344a('0x23')]();};}function saveUpdates(_0x240be3,_0x80ae12){return function(_0x185303){if(_0x185303){return _0x185303[_0x344a('0x24')](_0x240be3)[_0x344a('0x25')](function(_0x27f527){return _0x27f527;});}return null;};}function removeEntity(_0x90070c,_0x3b2ab9){return function(_0x5ce9da){if(_0x5ce9da){return _0x5ce9da[_0x344a('0x26')]()['then'](function(){_0x90070c[_0x344a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a5e49,_0x484f97){return function(_0x36c920){if(!_0x36c920){_0x2a5e49[_0x344a('0x17')](0x194);}return _0x36c920;};}function handleError(_0x2ebae9,_0x16d404){_0x16d404=_0x16d404||0x1f4;return function(_0x26f059){logger[_0x344a('0x27')](_0x26f059[_0x344a('0x28')]);if(_0x26f059[_0x344a('0x29')]){delete _0x26f059['name'];}_0x2ebae9[_0x344a('0x18')](_0x16d404)[_0x344a('0x2a')](_0x26f059);};}exports[_0x344a('0x2b')]=function(_0xc02d6,_0x14bd54){var _0x2d72c9={},_0x5b877d={},_0x3d25fe={'count':0x0,'rows':[]};var _0x49bbf8=_['map'](db[_0x344a('0x2c')][_0x344a('0x2d')],function(_0x5a36bb){return{'name':_0x5a36bb['fieldName'],'type':_0x5a36bb['type']['key']};});_0x5b877d[_0x344a('0x2e')]=_[_0x344a('0x2f')](_0x49bbf8,_0x344a('0x29'));_0x5b877d['query']=_[_0x344a('0x30')](_0xc02d6[_0x344a('0x31')]);_0x5b877d[_0x344a('0x32')]=_[_0x344a('0x33')](_0x5b877d[_0x344a('0x2e')],_0x5b877d[_0x344a('0x31')]);_0x2d72c9[_0x344a('0x34')]=_['intersection'](_0x5b877d[_0x344a('0x2e')],qs['fields'](_0xc02d6['query']['fields']));_0x2d72c9[_0x344a('0x34')]=_0x2d72c9[_0x344a('0x34')][_0x344a('0x35')]?_0x2d72c9[_0x344a('0x34')]:_0x5b877d[_0x344a('0x2e')];if(!_0xc02d6[_0x344a('0x31')]['hasOwnProperty'](_0x344a('0x36'))){_0x2d72c9[_0x344a('0x1d')]=qs[_0x344a('0x1d')](_0xc02d6['query'][_0x344a('0x1d')]);_0x2d72c9[_0x344a('0x1b')]=qs[_0x344a('0x1b')](_0xc02d6[_0x344a('0x31')][_0x344a('0x1b')]);}_0x2d72c9['order']=qs[_0x344a('0x37')](_0xc02d6[_0x344a('0x31')][_0x344a('0x37')]);_0x2d72c9[_0x344a('0x38')]=qs[_0x344a('0x32')](_['pick'](_0xc02d6[_0x344a('0x31')],_0x5b877d[_0x344a('0x32')]),_0x49bbf8);if(_0xc02d6[_0x344a('0x31')][_0x344a('0x39')]){_0x2d72c9[_0x344a('0x38')]=_['merge'](_0x2d72c9[_0x344a('0x38')],{'$or':_[_0x344a('0x2f')](_0x49bbf8,function(_0x1f52dc){if(_0x1f52dc[_0x344a('0x3a')]!==_0x344a('0x3b')){var _0x27d2d5={};_0x27d2d5[_0x1f52dc[_0x344a('0x29')]]={'$like':'%'+_0xc02d6[_0x344a('0x31')]['filter']+'%'};return _0x27d2d5;}})});}_0x2d72c9=_[_0x344a('0x3c')]({},_0x2d72c9,_0xc02d6[_0x344a('0x3d')]);var _0x3d34c3={'where':_0x2d72c9[_0x344a('0x38')]};return db[_0x344a('0x2c')]['count'](_0x3d34c3)[_0x344a('0x25')](function(_0x2736e9){_0x3d25fe[_0x344a('0x1e')]=_0x2736e9;if(_0xc02d6[_0x344a('0x31')][_0x344a('0x3e')]){_0x2d72c9[_0x344a('0x3f')]=[{'all':!![]}];}return db[_0x344a('0x2c')][_0x344a('0x40')](_0x2d72c9);})[_0x344a('0x25')](function(_0x4b1bac){_0x3d25fe[_0x344a('0x41')]=_0x4b1bac;return _0x3d25fe;})[_0x344a('0x25')](respondWithFilteredResult(_0x14bd54,_0x2d72c9))[_0x344a('0x42')](handleError(_0x14bd54,null));};exports[_0x344a('0x43')]=function(_0x4f9dc2,_0x32bfa6){var _0x3069ca={'raw':!![],'where':{'id':_0x4f9dc2[_0x344a('0x44')]['id']}},_0x2b0ee9={};_0x2b0ee9[_0x344a('0x2e')]=_[_0x344a('0x30')](db[_0x344a('0x2c')][_0x344a('0x2d')]);_0x2b0ee9[_0x344a('0x31')]=_[_0x344a('0x30')](_0x4f9dc2[_0x344a('0x31')]);_0x2b0ee9['filters']=_[_0x344a('0x33')](_0x2b0ee9[_0x344a('0x2e')],_0x2b0ee9['query']);_0x3069ca[_0x344a('0x34')]=_[_0x344a('0x33')](_0x2b0ee9['model'],qs[_0x344a('0x45')](_0x4f9dc2[_0x344a('0x31')]['fields']));_0x3069ca[_0x344a('0x34')]=_0x3069ca[_0x344a('0x34')][_0x344a('0x35')]?_0x3069ca['attributes']:_0x2b0ee9[_0x344a('0x2e')];if(_0x4f9dc2['query'][_0x344a('0x3e')]){_0x3069ca[_0x344a('0x3f')]=[{'all':!![]}];}_0x3069ca=_[_0x344a('0x3c')]({},_0x3069ca,_0x4f9dc2[_0x344a('0x3d')]);return db['FaxQueueReport']['find'](_0x3069ca)[_0x344a('0x25')](handleEntityNotFound(_0x32bfa6,null))[_0x344a('0x25')](respondWithResult(_0x32bfa6,null))[_0x344a('0x42')](handleError(_0x32bfa6,null));};exports[_0x344a('0x46')]=function(_0x300c9f,_0xa3c8f0){return db[_0x344a('0x2c')][_0x344a('0x46')](_0x300c9f[_0x344a('0x47')],{})[_0x344a('0x25')](respondWithResult(_0xa3c8f0,0xc9))['catch'](handleError(_0xa3c8f0,null));};exports[_0x344a('0x24')]=function(_0x2d9858,_0x6fad37){if(_0x2d9858[_0x344a('0x47')]['id']){delete _0x2d9858['body']['id'];}return db[_0x344a('0x2c')]['find']({'where':{'id':_0x2d9858['params']['id']}})[_0x344a('0x25')](handleEntityNotFound(_0x6fad37,null))[_0x344a('0x25')](saveUpdates(_0x2d9858['body'],null))[_0x344a('0x25')](respondWithResult(_0x6fad37,null))[_0x344a('0x42')](handleError(_0x6fad37,null));};exports[_0x344a('0x26')]=function(_0x226f41,_0x51e411){return db[_0x344a('0x2c')][_0x344a('0x48')]({'where':{'id':_0x226f41[_0x344a('0x44')]['id']}})[_0x344a('0x25')](handleEntityNotFound(_0x51e411,null))[_0x344a('0x25')](removeEntity(_0x51e411,null))[_0x344a('0x42')](handleError(_0x51e411,null));};exports[_0x344a('0x49')]=function(_0xe9fc2b,_0x292357){return db[_0x344a('0x2c')]['describe']()[_0x344a('0x25')](respondWithResult(_0x292357,null))['catch'](handleError(_0x292357,null));}; \ No newline at end of file +var _0x028d=['nolimit','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','FaxQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty'];(function(_0x2d6c4,_0x316156){var _0x267e30=function(_0x32e241){while(--_0x32e241){_0x2d6c4['push'](_0x2d6c4['shift']());}};_0x267e30(++_0x316156);}(_0x028d,0xff));var _0xd028=function(_0x35181b,_0x3c9c14){_0x35181b=_0x35181b-0x0;var _0x20ebe9=_0x028d[_0x35181b];return _0x20ebe9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd028('0x0'));var zipdir=require(_0xd028('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd028('0x2'));var moment=require(_0xd028('0x3'));var BPromise=require(_0xd028('0x4'));var Mustache=require(_0xd028('0x5'));var util=require(_0xd028('0x6'));var path=require(_0xd028('0x7'));var sox=require('sox');var csv=require(_0xd028('0x8'));var ejs=require(_0xd028('0x9'));var fs=require('fs');var fs_extra=require(_0xd028('0xa'));var _=require(_0xd028('0xb'));var squel=require(_0xd028('0xc'));var crypto=require(_0xd028('0xd'));var jsforce=require(_0xd028('0xe'));var deskjs=require(_0xd028('0xf'));var toCsv=require(_0xd028('0x8'));var querystring=require(_0xd028('0x10'));var Papa=require(_0xd028('0x11'));var Redis=require(_0xd028('0x12'));var authService=require(_0xd028('0x13'));var qs=require(_0xd028('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd028('0x15'));var logger=require(_0xd028('0x16'))(_0xd028('0x17'));var utils=require(_0xd028('0x18'));var config=require(_0xd028('0x19'));var licenseUtil=require(_0xd028('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34b5fa,_0x144696){_0x144696=_0x144696||0xcc;return function(_0x4817a4){if(_0x4817a4){return _0x34b5fa[_0xd028('0x1b')](_0x144696);}return _0x34b5fa[_0xd028('0x1c')](_0x144696)[_0xd028('0x1d')]();};}function respondWithResult(_0x17b112,_0x1667bf){_0x1667bf=_0x1667bf||0xc8;return function(_0x5ec067){if(_0x5ec067){return _0x17b112[_0xd028('0x1c')](_0x1667bf)[_0xd028('0x1e')](_0x5ec067);}};}function respondWithFilteredResult(_0x3937b4,_0x3bac54){return function(_0x12450d){if(_0x12450d){var _0x463d38=typeof _0x3bac54['offset']===_0xd028('0x1f')&&typeof _0x3bac54['limit']===_0xd028('0x1f');var _0x2f4af6=_0x12450d[_0xd028('0x20')];var _0x4df54f=_0x463d38?0x0:_0x3bac54[_0xd028('0x21')];var _0x5a47a6=_0x463d38?_0x12450d[_0xd028('0x20')]:_0x3bac54['offset']+_0x3bac54[_0xd028('0x22')];var _0x415d6c;if(_0x5a47a6>=_0x2f4af6){_0x5a47a6=_0x2f4af6;_0x415d6c=0xc8;}else{_0x415d6c=0xce;}_0x3937b4[_0xd028('0x1c')](_0x415d6c);return _0x3937b4['set'](_0xd028('0x23'),_0x4df54f+'-'+_0x5a47a6+'/'+_0x2f4af6)[_0xd028('0x1e')](_0x12450d);}return null;};}function patchUpdates(_0x1a2767){return function(_0x1648a7){try{jsonpatch[_0xd028('0x24')](_0x1648a7,_0x1a2767,!![]);}catch(_0x4830a4){return BPromise[_0xd028('0x25')](_0x4830a4);}return _0x1648a7[_0xd028('0x26')]();};}function saveUpdates(_0x8a964d,_0x75657f){return function(_0x3203f9){if(_0x3203f9){return _0x3203f9[_0xd028('0x27')](_0x8a964d)[_0xd028('0x28')](function(_0x54beee){return _0x54beee;});}return null;};}function removeEntity(_0x115fef,_0x10d629){return function(_0x13e5f4){if(_0x13e5f4){return _0x13e5f4[_0xd028('0x29')]()['then'](function(){_0x115fef[_0xd028('0x1c')](0xcc)[_0xd028('0x1d')]();});}};}function handleEntityNotFound(_0x26eb4e,_0x3249ea){return function(_0x5b9f3d){if(!_0x5b9f3d){_0x26eb4e[_0xd028('0x1b')](0x194);}return _0x5b9f3d;};}function handleError(_0x128c63,_0x115004){_0x115004=_0x115004||0x1f4;return function(_0x3481be){logger[_0xd028('0x2a')](_0x3481be[_0xd028('0x2b')]);if(_0x3481be[_0xd028('0x2c')]){delete _0x3481be[_0xd028('0x2c')];}_0x128c63[_0xd028('0x1c')](_0x115004)[_0xd028('0x2d')](_0x3481be);};}exports[_0xd028('0x2e')]=function(_0x3112e8,_0x112578){var _0x17594f={},_0x23d9dd={},_0x3b46bb={'count':0x0,'rows':[]};var _0x5d6f95=_['map'](db[_0xd028('0x2f')][_0xd028('0x30')],function(_0x2caf5d){return{'name':_0x2caf5d[_0xd028('0x31')],'type':_0x2caf5d[_0xd028('0x32')][_0xd028('0x33')]};});_0x23d9dd['model']=_['map'](_0x5d6f95,_0xd028('0x2c'));_0x23d9dd[_0xd028('0x34')]=_[_0xd028('0x35')](_0x3112e8[_0xd028('0x34')]);_0x23d9dd[_0xd028('0x36')]=_[_0xd028('0x37')](_0x23d9dd[_0xd028('0x38')],_0x23d9dd['query']);_0x17594f['attributes']=_[_0xd028('0x37')](_0x23d9dd[_0xd028('0x38')],qs['fields'](_0x3112e8['query'][_0xd028('0x39')]));_0x17594f[_0xd028('0x3a')]=_0x17594f[_0xd028('0x3a')][_0xd028('0x3b')]?_0x17594f[_0xd028('0x3a')]:_0x23d9dd[_0xd028('0x38')];if(!_0x3112e8[_0xd028('0x34')][_0xd028('0x3c')](_0xd028('0x3d'))){_0x17594f[_0xd028('0x22')]=qs[_0xd028('0x22')](_0x3112e8['query']['limit']);_0x17594f['offset']=qs['offset'](_0x3112e8['query'][_0xd028('0x21')]);}_0x17594f['order']=qs['sort'](_0x3112e8['query'][_0xd028('0x3e')]);_0x17594f['where']=qs[_0xd028('0x36')](_['pick'](_0x3112e8['query'],_0x23d9dd[_0xd028('0x36')]),_0x5d6f95);if(_0x3112e8[_0xd028('0x34')]['filter']){_0x17594f[_0xd028('0x3f')]=_['merge'](_0x17594f['where'],{'$or':_['map'](_0x5d6f95,function(_0x5941ed){if(_0x5941ed['type']!==_0xd028('0x40')){var _0x24ba63={};_0x24ba63[_0x5941ed['name']]={'$like':'%'+_0x3112e8[_0xd028('0x34')][_0xd028('0x41')]+'%'};return _0x24ba63;}})});}_0x17594f=_[_0xd028('0x42')]({},_0x17594f,_0x3112e8[_0xd028('0x43')]);var _0xc79c76={'where':_0x17594f[_0xd028('0x3f')]};return db['FaxQueueReport'][_0xd028('0x20')](_0xc79c76)[_0xd028('0x28')](function(_0x2d5fab){_0x3b46bb['count']=_0x2d5fab;if(_0x3112e8[_0xd028('0x34')][_0xd028('0x44')]){_0x17594f[_0xd028('0x45')]=[{'all':!![]}];}return db['FaxQueueReport'][_0xd028('0x46')](_0x17594f);})['then'](function(_0x26e51c){_0x3b46bb[_0xd028('0x47')]=_0x26e51c;return _0x3b46bb;})[_0xd028('0x28')](respondWithFilteredResult(_0x112578,_0x17594f))[_0xd028('0x48')](handleError(_0x112578,null));};exports[_0xd028('0x49')]=function(_0x3f86ed,_0x1de847){var _0x42a3fc={'raw':!![],'where':{'id':_0x3f86ed['params']['id']}},_0x3065f2={};_0x3065f2[_0xd028('0x38')]=_[_0xd028('0x35')](db[_0xd028('0x2f')][_0xd028('0x30')]);_0x3065f2['query']=_[_0xd028('0x35')](_0x3f86ed[_0xd028('0x34')]);_0x3065f2[_0xd028('0x36')]=_['intersection'](_0x3065f2[_0xd028('0x38')],_0x3065f2[_0xd028('0x34')]);_0x42a3fc['attributes']=_[_0xd028('0x37')](_0x3065f2[_0xd028('0x38')],qs[_0xd028('0x39')](_0x3f86ed[_0xd028('0x34')][_0xd028('0x39')]));_0x42a3fc[_0xd028('0x3a')]=_0x42a3fc[_0xd028('0x3a')][_0xd028('0x3b')]?_0x42a3fc[_0xd028('0x3a')]:_0x3065f2[_0xd028('0x38')];if(_0x3f86ed['query'][_0xd028('0x44')]){_0x42a3fc[_0xd028('0x45')]=[{'all':!![]}];}_0x42a3fc=_[_0xd028('0x42')]({},_0x42a3fc,_0x3f86ed[_0xd028('0x43')]);return db[_0xd028('0x2f')][_0xd028('0x4a')](_0x42a3fc)['then'](handleEntityNotFound(_0x1de847,null))[_0xd028('0x28')](respondWithResult(_0x1de847,null))[_0xd028('0x48')](handleError(_0x1de847,null));};exports[_0xd028('0x4b')]=function(_0xf0bd53,_0x30d7b6){return db['FaxQueueReport']['create'](_0xf0bd53['body'],{})['then'](respondWithResult(_0x30d7b6,0xc9))[_0xd028('0x48')](handleError(_0x30d7b6,null));};exports[_0xd028('0x27')]=function(_0x2ca45d,_0x3db4b8){if(_0x2ca45d[_0xd028('0x4c')]['id']){delete _0x2ca45d[_0xd028('0x4c')]['id'];}return db[_0xd028('0x2f')][_0xd028('0x4a')]({'where':{'id':_0x2ca45d[_0xd028('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3db4b8,null))[_0xd028('0x28')](saveUpdates(_0x2ca45d[_0xd028('0x4c')],null))[_0xd028('0x28')](respondWithResult(_0x3db4b8,null))[_0xd028('0x48')](handleError(_0x3db4b8,null));};exports[_0xd028('0x29')]=function(_0x13b619,_0x4a2c39){return db['FaxQueueReport'][_0xd028('0x4a')]({'where':{'id':_0x13b619[_0xd028('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4a2c39,null))[_0xd028('0x28')](removeEntity(_0x4a2c39,null))[_0xd028('0x48')](handleError(_0x4a2c39,null));};exports[_0xd028('0x4e')]=function(_0x1d337d,_0x29d5d2){return db[_0xd028('0x2f')][_0xd028('0x4e')]()[_0xd028('0x28')](respondWithResult(_0x29d5d2,null))[_0xd028('0x48')](handleError(_0x29d5d2,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index c2d504d..53d8a68 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 _0x0295=['rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash','api','request-promise','path'];(function(_0x2d9084,_0xc34874){var _0x443e90=function(_0x38d0a1){while(--_0x38d0a1){_0x2d9084['push'](_0x2d9084['shift']());}};_0x443e90(++_0xc34874);}(_0x0295,0x1f0));var _0x5029=function(_0x4335bc,_0x480e11){_0x4335bc=_0x4335bc-0x0;var _0x4f804c=_0x0295[_0x4335bc];return _0x4f804c;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5029('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5029('0x2'));var fs=require('fs');var path=require(_0x5029('0x3'));var rimraf=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var attributes=require(_0x5029('0x6'));module[_0x5029('0x7')]=function(_0x200217,_0x215955){return _0x200217[_0x5029('0x8')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5029('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['api','moment','bluebird','request-promise','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger'];(function(_0xfe3349,_0x5b6ec0){var _0x4471af=function(_0x21b88a){while(--_0x21b88a){_0xfe3349['push'](_0xfe3349['shift']());}};_0x4471af(++_0x5b6ec0);}(_0x7217,0x19e));var _0x7721=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x7217[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[{'name':_0x7721('0xc'),'fields':[_0x7721('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 0c9b9c2..5d440ed 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 _0x0090=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','CreateFaxQueueReport','FaxQueueReport','body','options','raw','stringify','UpdateFaxQueueReport','update','attributes','lodash'];(function(_0x5c2748,_0x564960){var _0x59761d=function(_0x1ccb1a){while(--_0x1ccb1a){_0x5c2748['push'](_0x5c2748['shift']());}};_0x59761d(++_0x564960);}(_0x0090,0x95));var _0x0009=function(_0x4657ec,_0x1822dd){_0x4657ec=_0x4657ec-0x0;var _0x317ba4=_0x0090[_0x4657ec];return _0x317ba4;};'use strict';var _=require(_0x0009('0x0'));var util=require(_0x0009('0x1'));var moment=require('moment');var BPromise=require(_0x0009('0x2'));var rs=require(_0x0009('0x3'));var fs=require('fs');var Redis=require(_0x0009('0x4'));var db=require(_0x0009('0x5'))['db'];var utils=require(_0x0009('0x6'));var logger=require(_0x0009('0x7'))(_0x0009('0x8'));var config=require(_0x0009('0x9'));var jayson=require(_0x0009('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3dea46,_0x4316ac,_0x9ce951){return new BPromise(function(_0x90a8df,_0x271891){return client[_0x0009('0xb')](_0x3dea46,_0x9ce951)[_0x0009('0xc')](function(_0x8c37c4){logger[_0x0009('0xd')](_0x0009('0xe'),_0x4316ac,'request\x20sent');logger[_0x0009('0xf')](_0x0009('0x10'),_0x4316ac,_0x0009('0x11'),JSON['stringify'](_0x8c37c4));if(_0x8c37c4[_0x0009('0x12')]){if(_0x8c37c4['error']['code']===0x1f4){logger[_0x0009('0x12')](_0x0009('0xe'),_0x4316ac,_0x8c37c4[_0x0009('0x12')]['message']);return _0x271891(_0x8c37c4[_0x0009('0x12')][_0x0009('0x13')]);}logger[_0x0009('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x4316ac,_0x8c37c4['error'][_0x0009('0x13')]);return _0x90a8df(_0x8c37c4[_0x0009('0x12')][_0x0009('0x13')]);}else{logger[_0x0009('0xd')](_0x0009('0xe'),_0x4316ac,_0x0009('0x11'));_0x90a8df(_0x8c37c4['result'][_0x0009('0x13')]);}})[_0x0009('0x14')](function(_0x1a5018){logger[_0x0009('0x12')](_0x0009('0xe'),_0x4316ac,_0x1a5018);_0x271891(_0x1a5018);});});}exports[_0x0009('0x15')]=function(_0x4b0c9){var _0x4d81e1=this;return new Promise(function(_0x1daeca,_0x47a92e){return db[_0x0009('0x16')]['create'](_0x4b0c9[_0x0009('0x17')],{'raw':_0x4b0c9['options']?_0x4b0c9[_0x0009('0x18')][_0x0009('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x5befbb){logger[_0x0009('0xd')]('CreateFaxQueueReport',_0x4b0c9);logger[_0x0009('0xf')]('CreateFaxQueueReport',_0x4b0c9,JSON[_0x0009('0x1a')](_0x5befbb));_0x1daeca(_0x5befbb);})[_0x0009('0x14')](function(_0x2e2b5e){logger[_0x0009('0x12')](_0x0009('0x15'),_0x2e2b5e[_0x0009('0x13')],_0x4b0c9);_0x47a92e(_0x4d81e1[_0x0009('0x12')](0x1f4,_0x2e2b5e[_0x0009('0x13')]));});});};exports[_0x0009('0x1b')]=function(_0x7ca7ab){var _0x13b942=this;return new Promise(function(_0x513ff8,_0x114fee){return db[_0x0009('0x16')][_0x0009('0x1c')](_0x7ca7ab['body'],{'raw':_0x7ca7ab[_0x0009('0x18')]?_0x7ca7ab[_0x0009('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7ca7ab[_0x0009('0x18')]?_0x7ca7ab['options']['where']||null:null,'attributes':_0x7ca7ab[_0x0009('0x18')]?_0x7ca7ab['options'][_0x0009('0x1d')]||null:null,'limit':_0x7ca7ab[_0x0009('0x18')]?_0x7ca7ab[_0x0009('0x18')]['limit']||null:null})[_0x0009('0xc')](function(_0x19919b){logger[_0x0009('0xd')](_0x0009('0x1b'),_0x7ca7ab);logger[_0x0009('0xf')]('UpdateFaxQueueReport',_0x7ca7ab,JSON[_0x0009('0x1a')](_0x19919b));_0x513ff8(_0x19919b);})[_0x0009('0x14')](function(_0x557dc8){logger[_0x0009('0x12')]('UpdateFaxQueueReport',_0x557dc8[_0x0009('0x13')],_0x7ca7ab);_0x114fee(_0x13b942[_0x0009('0x12')](0x1f4,_0x557dc8[_0x0009('0x13')]));});});}; \ No newline at end of file +var _0xce90=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','CreateFaxQueueReport','FaxQueueReport','body','options','UpdateFaxQueueReport','update','raw','where','attributes','limit','lodash','util','moment','bluebird'];(function(_0x2cb975,_0x3179a7){var _0x51218a=function(_0x18618d){while(--_0x18618d){_0x2cb975['push'](_0x2cb975['shift']());}};_0x51218a(++_0x3179a7);}(_0xce90,0x17d));var _0x0ce9=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xce90[_0x42bdad];return _0x122626;};'use strict';var _=require(_0x0ce9('0x0'));var util=require(_0x0ce9('0x1'));var moment=require(_0x0ce9('0x2'));var BPromise=require(_0x0ce9('0x3'));var rs=require(_0x0ce9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0ce9('0x5'))['db'];var utils=require(_0x0ce9('0x6'));var logger=require(_0x0ce9('0x7'))(_0x0ce9('0x8'));var config=require(_0x0ce9('0x9'));var jayson=require(_0x0ce9('0xa'));var client=jayson['client'][_0x0ce9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38af23,_0x1d72be,_0x4478e9){return new BPromise(function(_0x2123e8,_0x5ac019){return client[_0x0ce9('0xc')](_0x38af23,_0x4478e9)[_0x0ce9('0xd')](function(_0x40e313){logger[_0x0ce9('0xe')](_0x0ce9('0xf'),_0x1d72be,'request\x20sent');logger[_0x0ce9('0x10')](_0x0ce9('0x11'),_0x1d72be,'request\x20sent',JSON[_0x0ce9('0x12')](_0x40e313));if(_0x40e313[_0x0ce9('0x13')]){if(_0x40e313[_0x0ce9('0x13')][_0x0ce9('0x14')]===0x1f4){logger[_0x0ce9('0x13')](_0x0ce9('0xf'),_0x1d72be,_0x40e313[_0x0ce9('0x13')][_0x0ce9('0x15')]);return _0x5ac019(_0x40e313['error'][_0x0ce9('0x15')]);}logger[_0x0ce9('0x13')](_0x0ce9('0xf'),_0x1d72be,_0x40e313[_0x0ce9('0x13')][_0x0ce9('0x15')]);return _0x2123e8(_0x40e313['error'][_0x0ce9('0x15')]);}else{logger[_0x0ce9('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x1d72be,_0x0ce9('0x16'));_0x2123e8(_0x40e313[_0x0ce9('0x17')][_0x0ce9('0x15')]);}})[_0x0ce9('0x18')](function(_0x491c52){logger['error'](_0x0ce9('0xf'),_0x1d72be,_0x491c52);_0x5ac019(_0x491c52);});});}exports[_0x0ce9('0x19')]=function(_0x5c0dae){var _0x42c7d1=this;return new Promise(function(_0x3cc8f2,_0x249490){return db[_0x0ce9('0x1a')]['create'](_0x5c0dae[_0x0ce9('0x1b')],{'raw':_0x5c0dae['options']?_0x5c0dae[_0x0ce9('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x0ce9('0xd')](function(_0x316da){logger[_0x0ce9('0xe')](_0x0ce9('0x19'),_0x5c0dae);logger[_0x0ce9('0x10')]('CreateFaxQueueReport',_0x5c0dae,JSON[_0x0ce9('0x12')](_0x316da));_0x3cc8f2(_0x316da);})[_0x0ce9('0x18')](function(_0x3fbf32){logger['error']('CreateFaxQueueReport',_0x3fbf32[_0x0ce9('0x15')],_0x5c0dae);_0x249490(_0x42c7d1[_0x0ce9('0x13')](0x1f4,_0x3fbf32[_0x0ce9('0x15')]));});});};exports[_0x0ce9('0x1d')]=function(_0x3fb49b){var _0x83861c=this;return new Promise(function(_0x41287a,_0x1720cc){return db['FaxQueueReport'][_0x0ce9('0x1e')](_0x3fb49b[_0x0ce9('0x1b')],{'raw':_0x3fb49b[_0x0ce9('0x1c')]?_0x3fb49b[_0x0ce9('0x1c')][_0x0ce9('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fb49b[_0x0ce9('0x1c')]?_0x3fb49b['options'][_0x0ce9('0x20')]||null:null,'attributes':_0x3fb49b[_0x0ce9('0x1c')]?_0x3fb49b[_0x0ce9('0x1c')][_0x0ce9('0x21')]||null:null,'limit':_0x3fb49b[_0x0ce9('0x1c')]?_0x3fb49b[_0x0ce9('0x1c')][_0x0ce9('0x22')]||null:null})['then'](function(_0x2a9030){logger[_0x0ce9('0xe')](_0x0ce9('0x1d'),_0x3fb49b);logger['debug']('UpdateFaxQueueReport',_0x3fb49b,JSON[_0x0ce9('0x12')](_0x2a9030));_0x41287a(_0x2a9030);})['catch'](function(_0x5d5bee){logger[_0x0ce9('0x13')](_0x0ce9('0x1d'),_0x5d5bee['message'],_0x3fb49b);_0x1720cc(_0x83861c['error'](0x1f4,_0x5d5bee[_0x0ce9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index fcd04b7..b01f99d 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 _0xfffb=['put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','./faxQueueReport.controller','/describe','describe','get','/:id','isAuthenticated','show'];(function(_0xef0722,_0x20f765){var _0x1930d4=function(_0x19f38b){while(--_0x19f38b){_0xef0722['push'](_0xef0722['shift']());}};_0x1930d4(++_0x20f765);}(_0xfffb,0xb0));var _0xbfff=function(_0x32f16f,_0x549b02){_0x32f16f=_0x32f16f-0x0;var _0x21c567=_0xfffb[_0x32f16f];return _0x21c567;};'use strict';var multer=require(_0xbfff('0x0'));var util=require(_0xbfff('0x1'));var path=require(_0xbfff('0x2'));var timeout=require('connect-timeout');var express=require(_0xbfff('0x3'));var router=express[_0xbfff('0x4')]();var fs_extra=require(_0xbfff('0x5'));var auth=require(_0xbfff('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbfff('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xbfff('0x8'),auth['isAuthenticated'](),controller[_0xbfff('0x9')]);router[_0xbfff('0xa')](_0xbfff('0xb'),auth[_0xbfff('0xc')](),controller[_0xbfff('0xd')]);router['post']('/',auth[_0xbfff('0xc')](),controller['create']);router[_0xbfff('0xe')](_0xbfff('0xb'),auth[_0xbfff('0xc')](),controller[_0xbfff('0xf')]);router[_0xbfff('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xbfff('0x11')]);module[_0xbfff('0x12')]=router; \ No newline at end of file +var _0xafea=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x33ca22,_0xbcc94){var _0x1790c3=function(_0x448b06){while(--_0x448b06){_0x33ca22['push'](_0x33ca22['shift']());}};_0x1790c3(++_0xbcc94);}(_0xafea,0x90));var _0xaafe=function(_0x34fb0f,_0x1ca4bb){_0x34fb0f=_0x34fb0f-0x0;var _0x55b497=_0xafea[_0x34fb0f];return _0x55b497;};'use strict';var multer=require('multer');var util=require(_0xaafe('0x0'));var path=require(_0xaafe('0x1'));var timeout=require(_0xaafe('0x2'));var express=require(_0xaafe('0x3'));var router=express[_0xaafe('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaafe('0x5'));var config=require(_0xaafe('0x6'));var controller=require('./faxQueueReport.controller');router[_0xaafe('0x7')]('/',auth[_0xaafe('0x8')](),controller['index']);router[_0xaafe('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xaafe('0x9')]);router[_0xaafe('0x7')](_0xaafe('0xa'),auth[_0xaafe('0x8')](),controller[_0xaafe('0xb')]);router[_0xaafe('0xc')]('/',auth[_0xaafe('0x8')](),controller[_0xaafe('0xd')]);router['put'](_0xaafe('0xa'),auth[_0xaafe('0x8')](),controller[_0xaafe('0xe')]);router[_0xaafe('0xf')](_0xaafe('0xa'),auth[_0xaafe('0x8')](),controller[_0xaafe('0x10')]);module[_0xaafe('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 599cfe1..e1a53bd 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x2fd853,_0x1fdece){var _0x555b09=function(_0x4c7e5f){while(--_0x4c7e5f){_0x2fd853['push'](_0x2fd853['shift']());}};_0x555b09(++_0x1fdece);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x354164,_0x4c30de){_0x354164=_0x354164-0x0;var _0x5db9a8=_0xcb91[_0x354164];return _0x5db9a8;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x249d84,_0xf4dbe7){var _0x3fcd7b=function(_0x411369){while(--_0x411369){_0x249d84['push'](_0x249d84['shift']());}};_0x3fcd7b(++_0xf4dbe7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index f6981c9..3a487bb 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 _0xfc21=['body','destroy','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','end','stack','name','send','map','FaxTransferReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create'];(function(_0x4b4ba1,_0x38eb6e){var _0x5d1939=function(_0x34a49a){while(--_0x34a49a){_0x4b4ba1['push'](_0x4b4ba1['shift']());}};_0x5d1939(++_0x38eb6e);}(_0xfc21,0x180));var _0x1fc2=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfc21[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x1fc2('0x0'));var rimraf=require(_0x1fc2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1fc2('0x2'));var rp=require(_0x1fc2('0x3'));var moment=require(_0x1fc2('0x4'));var BPromise=require(_0x1fc2('0x5'));var Mustache=require(_0x1fc2('0x6'));var util=require(_0x1fc2('0x7'));var path=require(_0x1fc2('0x8'));var sox=require(_0x1fc2('0x9'));var csv=require(_0x1fc2('0xa'));var ejs=require(_0x1fc2('0xb'));var fs=require('fs');var fs_extra=require(_0x1fc2('0xc'));var _=require(_0x1fc2('0xd'));var squel=require(_0x1fc2('0xe'));var crypto=require(_0x1fc2('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x1fc2('0x10'));var toCsv=require(_0x1fc2('0xa'));var querystring=require(_0x1fc2('0x11'));var Papa=require(_0x1fc2('0x12'));var Redis=require('ioredis');var authService=require(_0x1fc2('0x13'));var qs=require(_0x1fc2('0x14'));var as=require(_0x1fc2('0x15'));var hardwareService=require(_0x1fc2('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x1fc2('0x17'));var licenseUtil=require(_0x1fc2('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d586d,_0x383538){_0x383538=_0x383538||0xcc;return function(_0x1a473b){if(_0x1a473b){return _0x4d586d[_0x1fc2('0x19')](_0x383538);}return _0x4d586d[_0x1fc2('0x1a')](_0x383538)['end']();};}function respondWithResult(_0x3f3c2b,_0x2f692b){_0x2f692b=_0x2f692b||0xc8;return function(_0x3799a6){if(_0x3799a6){return _0x3f3c2b['status'](_0x2f692b)[_0x1fc2('0x1b')](_0x3799a6);}};}function respondWithFilteredResult(_0x566529,_0x5cfb55){return function(_0x481a90){if(_0x481a90){var _0x40b57a=typeof _0x5cfb55[_0x1fc2('0x1c')]===_0x1fc2('0x1d')&&typeof _0x5cfb55[_0x1fc2('0x1e')]===_0x1fc2('0x1d');var _0x2f3e52=_0x481a90['count'];var _0xe1b673=_0x40b57a?0x0:_0x5cfb55['offset'];var _0x25420b=_0x40b57a?_0x481a90[_0x1fc2('0x1f')]:_0x5cfb55[_0x1fc2('0x1c')]+_0x5cfb55[_0x1fc2('0x1e')];var _0x37838a;if(_0x25420b>=_0x2f3e52){_0x25420b=_0x2f3e52;_0x37838a=0xc8;}else{_0x37838a=0xce;}_0x566529[_0x1fc2('0x1a')](_0x37838a);return _0x566529[_0x1fc2('0x20')](_0x1fc2('0x21'),_0xe1b673+'-'+_0x25420b+'/'+_0x2f3e52)['json'](_0x481a90);}return null;};}function patchUpdates(_0x1ac891){return function(_0x54a8a6){try{jsonpatch[_0x1fc2('0x22')](_0x54a8a6,_0x1ac891,!![]);}catch(_0x26560e){return BPromise[_0x1fc2('0x23')](_0x26560e);}return _0x54a8a6['save']();};}function saveUpdates(_0x51fe58,_0x382b3f){return function(_0x83fdde){if(_0x83fdde){return _0x83fdde[_0x1fc2('0x24')](_0x51fe58)[_0x1fc2('0x25')](function(_0x2cc1c7){return _0x2cc1c7;});}return null;};}function removeEntity(_0x394803,_0x210466){return function(_0xb97a21){if(_0xb97a21){return _0xb97a21['destroy']()[_0x1fc2('0x25')](function(){_0x394803['status'](0xcc)[_0x1fc2('0x26')]();});}};}function handleEntityNotFound(_0x204c2,_0x2ae0b1){return function(_0x25197e){if(!_0x25197e){_0x204c2[_0x1fc2('0x19')](0x194);}return _0x25197e;};}function handleError(_0x236b0d,_0x347772){_0x347772=_0x347772||0x1f4;return function(_0x24b3f6){logger['error'](_0x24b3f6[_0x1fc2('0x27')]);if(_0x24b3f6[_0x1fc2('0x28')]){delete _0x24b3f6[_0x1fc2('0x28')];}_0x236b0d[_0x1fc2('0x1a')](_0x347772)[_0x1fc2('0x29')](_0x24b3f6);};}exports['index']=function(_0x9908ff,_0x3b7c54){var _0x28ec01={},_0x295223={},_0x524f9c={'count':0x0,'rows':[]};var _0x586677=_[_0x1fc2('0x2a')](db[_0x1fc2('0x2b')][_0x1fc2('0x2c')],function(_0x2afb2f){return{'name':_0x2afb2f[_0x1fc2('0x2d')],'type':_0x2afb2f['type'][_0x1fc2('0x2e')]};});_0x295223['model']=_[_0x1fc2('0x2a')](_0x586677,_0x1fc2('0x28'));_0x295223[_0x1fc2('0x2f')]=_[_0x1fc2('0x30')](_0x9908ff['query']);_0x295223[_0x1fc2('0x31')]=_[_0x1fc2('0x32')](_0x295223[_0x1fc2('0x33')],_0x295223[_0x1fc2('0x2f')]);_0x28ec01[_0x1fc2('0x34')]=_[_0x1fc2('0x32')](_0x295223[_0x1fc2('0x33')],qs[_0x1fc2('0x35')](_0x9908ff[_0x1fc2('0x2f')][_0x1fc2('0x35')]));_0x28ec01[_0x1fc2('0x34')]=_0x28ec01[_0x1fc2('0x34')][_0x1fc2('0x36')]?_0x28ec01[_0x1fc2('0x34')]:_0x295223[_0x1fc2('0x33')];if(!_0x9908ff['query'][_0x1fc2('0x37')]('nolimit')){_0x28ec01[_0x1fc2('0x1e')]=qs[_0x1fc2('0x1e')](_0x9908ff['query'][_0x1fc2('0x1e')]);_0x28ec01[_0x1fc2('0x1c')]=qs[_0x1fc2('0x1c')](_0x9908ff['query'][_0x1fc2('0x1c')]);}_0x28ec01[_0x1fc2('0x38')]=qs[_0x1fc2('0x39')](_0x9908ff[_0x1fc2('0x2f')]['sort']);_0x28ec01[_0x1fc2('0x3a')]=qs[_0x1fc2('0x31')](_[_0x1fc2('0x3b')](_0x9908ff['query'],_0x295223['filters']),_0x586677);if(_0x9908ff[_0x1fc2('0x2f')][_0x1fc2('0x3c')]){_0x28ec01['where']=_[_0x1fc2('0x3d')](_0x28ec01[_0x1fc2('0x3a')],{'$or':_[_0x1fc2('0x2a')](_0x586677,function(_0x62e9b8){if(_0x62e9b8[_0x1fc2('0x3e')]!==_0x1fc2('0x3f')){var _0xd5d5e9={};_0xd5d5e9[_0x62e9b8[_0x1fc2('0x28')]]={'$like':'%'+_0x9908ff[_0x1fc2('0x2f')][_0x1fc2('0x3c')]+'%'};return _0xd5d5e9;}})});}_0x28ec01=_[_0x1fc2('0x3d')]({},_0x28ec01,_0x9908ff[_0x1fc2('0x40')]);var _0xa1d794={'where':_0x28ec01['where']};return db[_0x1fc2('0x2b')][_0x1fc2('0x1f')](_0xa1d794)[_0x1fc2('0x25')](function(_0x210b80){_0x524f9c[_0x1fc2('0x1f')]=_0x210b80;if(_0x9908ff[_0x1fc2('0x2f')][_0x1fc2('0x41')]){_0x28ec01[_0x1fc2('0x42')]=[{'all':!![]}];}return db[_0x1fc2('0x2b')][_0x1fc2('0x43')](_0x28ec01);})[_0x1fc2('0x25')](function(_0x18ffc9){_0x524f9c[_0x1fc2('0x44')]=_0x18ffc9;return _0x524f9c;})[_0x1fc2('0x25')](respondWithFilteredResult(_0x3b7c54,_0x28ec01))[_0x1fc2('0x45')](handleError(_0x3b7c54,null));};exports['show']=function(_0x19f2aa,_0x52ec9c){var _0x4151ee={'raw':!![],'where':{'id':_0x19f2aa['params']['id']}},_0x4cdb5d={};_0x4cdb5d[_0x1fc2('0x33')]=_[_0x1fc2('0x30')](db[_0x1fc2('0x2b')][_0x1fc2('0x2c')]);_0x4cdb5d[_0x1fc2('0x2f')]=_[_0x1fc2('0x30')](_0x19f2aa[_0x1fc2('0x2f')]);_0x4cdb5d[_0x1fc2('0x31')]=_[_0x1fc2('0x32')](_0x4cdb5d[_0x1fc2('0x33')],_0x4cdb5d[_0x1fc2('0x2f')]);_0x4151ee[_0x1fc2('0x34')]=_['intersection'](_0x4cdb5d[_0x1fc2('0x33')],qs[_0x1fc2('0x35')](_0x19f2aa[_0x1fc2('0x2f')]['fields']));_0x4151ee[_0x1fc2('0x34')]=_0x4151ee[_0x1fc2('0x34')][_0x1fc2('0x36')]?_0x4151ee['attributes']:_0x4cdb5d[_0x1fc2('0x33')];if(_0x19f2aa[_0x1fc2('0x2f')]['includeAll']){_0x4151ee[_0x1fc2('0x42')]=[{'all':!![]}];}_0x4151ee=_[_0x1fc2('0x3d')]({},_0x4151ee,_0x19f2aa['options']);return db[_0x1fc2('0x2b')][_0x1fc2('0x46')](_0x4151ee)[_0x1fc2('0x25')](handleEntityNotFound(_0x52ec9c,null))[_0x1fc2('0x25')](respondWithResult(_0x52ec9c,null))['catch'](handleError(_0x52ec9c,null));};exports[_0x1fc2('0x47')]=function(_0x75849,_0x15c0aa){return db['FaxTransferReport']['create'](_0x75849['body'],{})[_0x1fc2('0x25')](respondWithResult(_0x15c0aa,0xc9))[_0x1fc2('0x45')](handleError(_0x15c0aa,null));};exports[_0x1fc2('0x24')]=function(_0x5273d4,_0x364498){if(_0x5273d4['body']['id']){delete _0x5273d4['body']['id'];}return db[_0x1fc2('0x2b')][_0x1fc2('0x46')]({'where':{'id':_0x5273d4['params']['id']}})['then'](handleEntityNotFound(_0x364498,null))[_0x1fc2('0x25')](saveUpdates(_0x5273d4[_0x1fc2('0x48')],null))['then'](respondWithResult(_0x364498,null))['catch'](handleError(_0x364498,null));};exports[_0x1fc2('0x49')]=function(_0x1f950b,_0x105240){return db[_0x1fc2('0x2b')][_0x1fc2('0x46')]({'where':{'id':_0x1f950b[_0x1fc2('0x4a')]['id']}})['then'](handleEntityNotFound(_0x105240,null))['then'](removeEntity(_0x105240,null))[_0x1fc2('0x45')](handleError(_0x105240,null));};exports[_0x1fc2('0x4b')]=function(_0x425a84,_0x3e381b){return db['FaxTransferReport'][_0x1fc2('0x4b')]()[_0x1fc2('0x25')](respondWithResult(_0x3e381b,null))[_0x1fc2('0x45')](handleError(_0x3e381b,null));}; \ No newline at end of file +var _0x2758=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','limit','count','offset','set','apply','save','update','then','destroy','end','stack','name','index','FaxTransferReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','params','rawAttributes','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x2758,0x173));var _0x8275=function(_0x76549c,_0x3f9b5f){_0x76549c=_0x76549c-0x0;var _0x1436d1=_0x2758[_0x76549c];return _0x1436d1;};'use strict';var emlformat=require(_0x8275('0x0'));var rimraf=require(_0x8275('0x1'));var zipdir=require(_0x8275('0x2'));var jsonpatch=require(_0x8275('0x3'));var rp=require('request-promise');var moment=require(_0x8275('0x4'));var BPromise=require(_0x8275('0x5'));var Mustache=require('mustache');var util=require(_0x8275('0x6'));var path=require(_0x8275('0x7'));var sox=require(_0x8275('0x8'));var csv=require(_0x8275('0x9'));var ejs=require(_0x8275('0xa'));var fs=require('fs');var fs_extra=require(_0x8275('0xb'));var _=require(_0x8275('0xc'));var squel=require('squel');var crypto=require(_0x8275('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8275('0xe'));var toCsv=require(_0x8275('0x9'));var querystring=require(_0x8275('0xf'));var Papa=require(_0x8275('0x10'));var Redis=require(_0x8275('0x11'));var authService=require(_0x8275('0x12'));var qs=require(_0x8275('0x13'));var as=require(_0x8275('0x14'));var hardwareService=require(_0x8275('0x15'));var logger=require(_0x8275('0x16'))(_0x8275('0x17'));var utils=require(_0x8275('0x18'));var config=require(_0x8275('0x19'));var licenseUtil=require(_0x8275('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7a7218,_0x262190){_0x262190=_0x262190||0xcc;return function(_0x2cfbd3){if(_0x2cfbd3){return _0x7a7218[_0x8275('0x1b')](_0x262190);}return _0x7a7218[_0x8275('0x1c')](_0x262190)['end']();};}function respondWithResult(_0xd00474,_0x14244f){_0x14244f=_0x14244f||0xc8;return function(_0x3993b6){if(_0x3993b6){return _0xd00474[_0x8275('0x1c')](_0x14244f)[_0x8275('0x1d')](_0x3993b6);}};}function respondWithFilteredResult(_0xfcef23,_0x551175){return function(_0x29dc15){if(_0x29dc15){var _0x949379=typeof _0x551175['offset']==='undefined'&&typeof _0x551175[_0x8275('0x1e')]==='undefined';var _0x41b2dd=_0x29dc15[_0x8275('0x1f')];var _0x4846f1=_0x949379?0x0:_0x551175['offset'];var _0x526cc2=_0x949379?_0x29dc15[_0x8275('0x1f')]:_0x551175[_0x8275('0x20')]+_0x551175[_0x8275('0x1e')];var _0xd32218;if(_0x526cc2>=_0x41b2dd){_0x526cc2=_0x41b2dd;_0xd32218=0xc8;}else{_0xd32218=0xce;}_0xfcef23[_0x8275('0x1c')](_0xd32218);return _0xfcef23[_0x8275('0x21')]('Content-Range',_0x4846f1+'-'+_0x526cc2+'/'+_0x41b2dd)[_0x8275('0x1d')](_0x29dc15);}return null;};}function patchUpdates(_0x49048a){return function(_0x3f06a6){try{jsonpatch[_0x8275('0x22')](_0x3f06a6,_0x49048a,!![]);}catch(_0x2cec0f){return BPromise['reject'](_0x2cec0f);}return _0x3f06a6[_0x8275('0x23')]();};}function saveUpdates(_0x330a09,_0x3995a1){return function(_0x4d83d2){if(_0x4d83d2){return _0x4d83d2[_0x8275('0x24')](_0x330a09)[_0x8275('0x25')](function(_0x1d7e5b){return _0x1d7e5b;});}return null;};}function removeEntity(_0x535e29,_0x445417){return function(_0x2cc932){if(_0x2cc932){return _0x2cc932[_0x8275('0x26')]()['then'](function(){_0x535e29[_0x8275('0x1c')](0xcc)[_0x8275('0x27')]();});}};}function handleEntityNotFound(_0x3226bf,_0xe87298){return function(_0x4306dd){if(!_0x4306dd){_0x3226bf['sendStatus'](0x194);}return _0x4306dd;};}function handleError(_0x22ab8a,_0x296ed5){_0x296ed5=_0x296ed5||0x1f4;return function(_0x479ced){logger['error'](_0x479ced[_0x8275('0x28')]);if(_0x479ced[_0x8275('0x29')]){delete _0x479ced[_0x8275('0x29')];}_0x22ab8a['status'](_0x296ed5)['send'](_0x479ced);};}exports[_0x8275('0x2a')]=function(_0x2fa63f,_0x516abc){var _0x40103f={},_0x27ba7c={},_0x459cad={'count':0x0,'rows':[]};var _0x27c100=_['map'](db[_0x8275('0x2b')]['rawAttributes'],function(_0x2b3e57){return{'name':_0x2b3e57[_0x8275('0x2c')],'type':_0x2b3e57[_0x8275('0x2d')][_0x8275('0x2e')]};});_0x27ba7c[_0x8275('0x2f')]=_[_0x8275('0x30')](_0x27c100,_0x8275('0x29'));_0x27ba7c[_0x8275('0x31')]=_[_0x8275('0x32')](_0x2fa63f[_0x8275('0x31')]);_0x27ba7c[_0x8275('0x33')]=_[_0x8275('0x34')](_0x27ba7c[_0x8275('0x2f')],_0x27ba7c[_0x8275('0x31')]);_0x40103f[_0x8275('0x35')]=_[_0x8275('0x34')](_0x27ba7c[_0x8275('0x2f')],qs[_0x8275('0x36')](_0x2fa63f[_0x8275('0x31')][_0x8275('0x36')]));_0x40103f['attributes']=_0x40103f[_0x8275('0x35')][_0x8275('0x37')]?_0x40103f[_0x8275('0x35')]:_0x27ba7c[_0x8275('0x2f')];if(!_0x2fa63f[_0x8275('0x31')][_0x8275('0x38')](_0x8275('0x39'))){_0x40103f[_0x8275('0x1e')]=qs[_0x8275('0x1e')](_0x2fa63f[_0x8275('0x31')]['limit']);_0x40103f[_0x8275('0x20')]=qs[_0x8275('0x20')](_0x2fa63f['query'][_0x8275('0x20')]);}_0x40103f[_0x8275('0x3a')]=qs[_0x8275('0x3b')](_0x2fa63f[_0x8275('0x31')][_0x8275('0x3b')]);_0x40103f['where']=qs['filters'](_[_0x8275('0x3c')](_0x2fa63f[_0x8275('0x31')],_0x27ba7c[_0x8275('0x33')]),_0x27c100);if(_0x2fa63f[_0x8275('0x31')][_0x8275('0x3d')]){_0x40103f[_0x8275('0x3e')]=_[_0x8275('0x3f')](_0x40103f[_0x8275('0x3e')],{'$or':_[_0x8275('0x30')](_0x27c100,function(_0x5870ef){if(_0x5870ef[_0x8275('0x2d')]!==_0x8275('0x40')){var _0xceefc7={};_0xceefc7[_0x5870ef['name']]={'$like':'%'+_0x2fa63f[_0x8275('0x31')][_0x8275('0x3d')]+'%'};return _0xceefc7;}})});}_0x40103f=_[_0x8275('0x3f')]({},_0x40103f,_0x2fa63f[_0x8275('0x41')]);var _0x5b644e={'where':_0x40103f[_0x8275('0x3e')]};return db['FaxTransferReport'][_0x8275('0x1f')](_0x5b644e)[_0x8275('0x25')](function(_0x293d44){_0x459cad['count']=_0x293d44;if(_0x2fa63f[_0x8275('0x31')]['includeAll']){_0x40103f[_0x8275('0x42')]=[{'all':!![]}];}return db[_0x8275('0x2b')][_0x8275('0x43')](_0x40103f);})['then'](function(_0x2ee1ad){_0x459cad[_0x8275('0x44')]=_0x2ee1ad;return _0x459cad;})[_0x8275('0x25')](respondWithFilteredResult(_0x516abc,_0x40103f))[_0x8275('0x45')](handleError(_0x516abc,null));};exports['show']=function(_0x54d6f8,_0x257d87){var _0x1c8c5c={'raw':!![],'where':{'id':_0x54d6f8[_0x8275('0x46')]['id']}},_0x42a37e={};_0x42a37e[_0x8275('0x2f')]=_[_0x8275('0x32')](db[_0x8275('0x2b')][_0x8275('0x47')]);_0x42a37e['query']=_['keys'](_0x54d6f8[_0x8275('0x31')]);_0x42a37e['filters']=_[_0x8275('0x34')](_0x42a37e[_0x8275('0x2f')],_0x42a37e[_0x8275('0x31')]);_0x1c8c5c[_0x8275('0x35')]=_['intersection'](_0x42a37e[_0x8275('0x2f')],qs[_0x8275('0x36')](_0x54d6f8[_0x8275('0x31')][_0x8275('0x36')]));_0x1c8c5c[_0x8275('0x35')]=_0x1c8c5c[_0x8275('0x35')][_0x8275('0x37')]?_0x1c8c5c[_0x8275('0x35')]:_0x42a37e[_0x8275('0x2f')];if(_0x54d6f8[_0x8275('0x31')][_0x8275('0x48')]){_0x1c8c5c[_0x8275('0x42')]=[{'all':!![]}];}_0x1c8c5c=_[_0x8275('0x3f')]({},_0x1c8c5c,_0x54d6f8[_0x8275('0x41')]);return db[_0x8275('0x2b')][_0x8275('0x49')](_0x1c8c5c)[_0x8275('0x25')](handleEntityNotFound(_0x257d87,null))[_0x8275('0x25')](respondWithResult(_0x257d87,null))[_0x8275('0x45')](handleError(_0x257d87,null));};exports[_0x8275('0x4a')]=function(_0x166187,_0x2cd796){return db[_0x8275('0x2b')][_0x8275('0x4a')](_0x166187[_0x8275('0x4b')],{})['then'](respondWithResult(_0x2cd796,0xc9))[_0x8275('0x45')](handleError(_0x2cd796,null));};exports['update']=function(_0x51ee5d,_0x24cd3e){if(_0x51ee5d['body']['id']){delete _0x51ee5d[_0x8275('0x4b')]['id'];}return db[_0x8275('0x2b')][_0x8275('0x49')]({'where':{'id':_0x51ee5d[_0x8275('0x46')]['id']}})[_0x8275('0x25')](handleEntityNotFound(_0x24cd3e,null))[_0x8275('0x25')](saveUpdates(_0x51ee5d[_0x8275('0x4b')],null))[_0x8275('0x25')](respondWithResult(_0x24cd3e,null))[_0x8275('0x45')](handleError(_0x24cd3e,null));};exports[_0x8275('0x26')]=function(_0x118905,_0x52dfe1){return db[_0x8275('0x2b')]['find']({'where':{'id':_0x118905[_0x8275('0x46')]['id']}})['then'](handleEntityNotFound(_0x52dfe1,null))[_0x8275('0x25')](removeEntity(_0x52dfe1,null))[_0x8275('0x45')](handleError(_0x52dfe1,null));};exports[_0x8275('0x4c')]=function(_0x129459,_0x4a28f5){return db[_0x8275('0x2b')][_0x8275('0x4c')]()['then'](respondWithResult(_0x4a28f5,null))[_0x8275('0x45')](handleError(_0x4a28f5,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index f5d648f..c554b2d 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 _0x20cc=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','uniqueid'];(function(_0x5dd3cf,_0x1bda77){var _0x5d271e=function(_0x367855){while(--_0x367855){_0x5dd3cf['push'](_0x5dd3cf['shift']());}};_0x5d271e(++_0x1bda77);}(_0x20cc,0x196));var _0xc20c=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x20cc[_0x3b5250];return _0xc844a1;};'use strict';var _=require(_0xc20c('0x0'));var util=require(_0xc20c('0x1'));var logger=require(_0xc20c('0x2'))('api');var moment=require(_0xc20c('0x3'));var BPromise=require(_0xc20c('0x4'));var rp=require(_0xc20c('0x5'));var fs=require('fs');var path=require(_0xc20c('0x6'));var rimraf=require(_0xc20c('0x7'));var config=require(_0xc20c('0x8'));var attributes=require(_0xc20c('0x9'));module[_0xc20c('0xa')]=function(_0xaa5fce,_0x34f9ac){return _0xaa5fce[_0xc20c('0xb')](_0xc20c('0xc'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xc20c('0xd'),'fields':[_0xc20c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2426=['FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define'];(function(_0x2731df,_0x51e6b6){var _0x39e16a=function(_0x44855e){while(--_0x44855e){_0x2731df['push'](_0x2731df['shift']());}};_0x39e16a(++_0x51e6b6);}(_0x2426,0x155));var _0x6242=function(_0x5da43f,_0x305553){_0x5da43f=_0x5da43f-0x0;var _0x3cb77e=_0x2426[_0x5da43f];return _0x3cb77e;};'use strict';var _=require(_0x6242('0x0'));var util=require(_0x6242('0x1'));var logger=require(_0x6242('0x2'))(_0x6242('0x3'));var moment=require(_0x6242('0x4'));var BPromise=require(_0x6242('0x5'));var rp=require(_0x6242('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6242('0x7'));var config=require(_0x6242('0x8'));var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x2a05f2,_0x1cbef7){return _0x2a05f2[_0x6242('0x9')](_0x6242('0xa'),attributes,{'tableName':_0x6242('0xb'),'paranoid':![],'indexes':[{'name':_0x6242('0xc'),'fields':[_0x6242('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index c795077..7c3afcb 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 _0xc333=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','http','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x7a1589,_0x58e8d2){var _0x570127=function(_0x4e588c){while(--_0x4e588c){_0x7a1589['push'](_0x7a1589['shift']());}};_0x570127(++_0x58e8d2);}(_0xc333,0x1aa));var _0x3c33=function(_0x435662,_0x5519f0){_0x435662=_0x435662-0x0;var _0x2b0218=_0xc333[_0x435662];return _0x2b0218;};'use strict';var _=require(_0x3c33('0x0'));var util=require(_0x3c33('0x1'));var moment=require(_0x3c33('0x2'));var BPromise=require(_0x3c33('0x3'));var rs=require(_0x3c33('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c33('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3c33('0x6'))(_0x3c33('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3c33('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39da65,_0x54d201,_0x2e6ad6){return new BPromise(function(_0x467ff6,_0x404170){return client['request'](_0x39da65,_0x2e6ad6)[_0x3c33('0x9')](function(_0x32bb30){logger[_0x3c33('0xa')](_0x3c33('0xb'),_0x54d201,_0x3c33('0xc'));logger[_0x3c33('0xd')](_0x3c33('0xe'),_0x54d201,_0x3c33('0xc'),JSON[_0x3c33('0xf')](_0x32bb30));if(_0x32bb30[_0x3c33('0x10')]){if(_0x32bb30['error'][_0x3c33('0x11')]===0x1f4){logger[_0x3c33('0x10')](_0x3c33('0xb'),_0x54d201,_0x32bb30[_0x3c33('0x10')]['message']);return _0x404170(_0x32bb30[_0x3c33('0x10')]['message']);}logger['error'](_0x3c33('0xb'),_0x54d201,_0x32bb30[_0x3c33('0x10')][_0x3c33('0x12')]);return _0x467ff6(_0x32bb30[_0x3c33('0x10')][_0x3c33('0x12')]);}else{logger[_0x3c33('0xa')](_0x3c33('0xb'),_0x54d201,_0x3c33('0xc'));_0x467ff6(_0x32bb30[_0x3c33('0x13')][_0x3c33('0x12')]);}})[_0x3c33('0x14')](function(_0x10130e){logger[_0x3c33('0x10')](_0x3c33('0xb'),_0x54d201,_0x10130e);_0x404170(_0x10130e);});});} \ No newline at end of file +var _0x8966=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','FaxTransferReport,\x20%s,\x20%s','request\x20sent','error','message','info','catch','lodash','util','moment','bluebird'];(function(_0x3d01c1,_0x327a9e){var _0x140ff5=function(_0x31bc2f){while(--_0x31bc2f){_0x3d01c1['push'](_0x3d01c1['shift']());}};_0x140ff5(++_0x327a9e);}(_0x8966,0x12c));var _0x6896=function(_0x42bf0e,_0xbecc93){_0x42bf0e=_0x42bf0e-0x0;var _0x5cefe3=_0x8966[_0x42bf0e];return _0x5cefe3;};'use strict';var _=require(_0x6896('0x0'));var util=require(_0x6896('0x1'));var moment=require(_0x6896('0x2'));var BPromise=require(_0x6896('0x3'));var rs=require(_0x6896('0x4'));var fs=require('fs');var Redis=require(_0x6896('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6896('0x6'));var logger=require(_0x6896('0x7'))(_0x6896('0x8'));var config=require(_0x6896('0x9'));var jayson=require(_0x6896('0xa'));var client=jayson['client'][_0x6896('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4953df,_0x309568,_0x14ec20){return new BPromise(function(_0x579b4f,_0x147acf){return client[_0x6896('0xc')](_0x4953df,_0x14ec20)['then'](function(_0x31e58f){logger['info'](_0x6896('0xd'),_0x309568,_0x6896('0xe'));logger['debug']('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x309568,'request\x20sent',JSON['stringify'](_0x31e58f));if(_0x31e58f[_0x6896('0xf')]){if(_0x31e58f[_0x6896('0xf')]['code']===0x1f4){logger[_0x6896('0xf')](_0x6896('0xd'),_0x309568,_0x31e58f['error']['message']);return _0x147acf(_0x31e58f[_0x6896('0xf')][_0x6896('0x10')]);}logger[_0x6896('0xf')](_0x6896('0xd'),_0x309568,_0x31e58f[_0x6896('0xf')][_0x6896('0x10')]);return _0x579b4f(_0x31e58f['error'][_0x6896('0x10')]);}else{logger[_0x6896('0x11')](_0x6896('0xd'),_0x309568,_0x6896('0xe'));_0x579b4f(_0x31e58f['result']['message']);}})[_0x6896('0x12')](function(_0x17545b){logger[_0x6896('0xf')](_0x6896('0xd'),_0x309568,_0x17545b);_0x147acf(_0x17545b);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 7901057..064a091 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 _0x8866=['show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id'];(function(_0x184825,_0x53773d){var _0x4c2a0c=function(_0x5dae7b){while(--_0x5dae7b){_0x184825['push'](_0x184825['shift']());}};_0x4c2a0c(++_0x53773d);}(_0x8866,0x197));var _0x6886=function(_0x4bd64f,_0x46a077){_0x4bd64f=_0x4bd64f-0x0;var _0x287719=_0x8866[_0x4bd64f];return _0x287719;};'use strict';var multer=require(_0x6886('0x0'));var util=require(_0x6886('0x1'));var path=require('path');var timeout=require(_0x6886('0x2'));var express=require(_0x6886('0x3'));var router=express[_0x6886('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6886('0x5'));var interaction=require(_0x6886('0x6'));var config=require(_0x6886('0x7'));var controller=require('./faxTransferReport.controller');router[_0x6886('0x8')]('/',auth[_0x6886('0x9')](),controller[_0x6886('0xa')]);router['get'](_0x6886('0xb'),auth[_0x6886('0x9')](),controller['describe']);router[_0x6886('0x8')](_0x6886('0xc'),auth[_0x6886('0x9')](),controller[_0x6886('0xd')]);router[_0x6886('0xe')]('/',auth[_0x6886('0x9')](),controller[_0x6886('0xf')]);router[_0x6886('0x10')](_0x6886('0xc'),auth[_0x6886('0x9')](),controller[_0x6886('0x11')]);router[_0x6886('0x12')](_0x6886('0xc'),auth['isAuthenticated'](),controller[_0x6886('0x13')]);module['exports']=router; \ No newline at end of file +var _0x40d2=['express','Router','fs-extra','../../components/auth/service','./faxTransferReport.controller','get','isAuthenticated','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x20a39a,_0x8ab05d){var _0x3f4ece=function(_0x31f341){while(--_0x31f341){_0x20a39a['push'](_0x20a39a['shift']());}};_0x3f4ece(++_0x8ab05d);}(_0x40d2,0x129));var _0x240d=function(_0x176cf8,_0x1638c8){_0x176cf8=_0x176cf8-0x0;var _0x1ea73d=_0x40d2[_0x176cf8];return _0x1ea73d;};'use strict';var multer=require(_0x240d('0x0'));var util=require(_0x240d('0x1'));var path=require('path');var timeout=require(_0x240d('0x2'));var express=require(_0x240d('0x3'));var router=express[_0x240d('0x4')]();var fs_extra=require(_0x240d('0x5'));var auth=require(_0x240d('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x240d('0x7'));router[_0x240d('0x8')]('/',auth[_0x240d('0x9')](),controller['index']);router['get'](_0x240d('0xa'),auth[_0x240d('0x9')](),controller['describe']);router[_0x240d('0x8')](_0x240d('0xb'),auth[_0x240d('0x9')](),controller[_0x240d('0xc')]);router[_0x240d('0xd')]('/',auth['isAuthenticated'](),controller[_0x240d('0xe')]);router[_0x240d('0xf')](_0x240d('0xb'),auth[_0x240d('0x9')](),controller[_0x240d('0x10')]);router[_0x240d('0x11')](_0x240d('0xb'),auth['isAuthenticated'](),controller[_0x240d('0x12')]);module[_0x240d('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index f82e07d..e642533 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 _0xd29b=['express','Router','../../components/interaction/service','../../config/environment','index','get','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','create','post','addConfiguration','put','/:id','delete','destroy','exports','path'];(function(_0x9861ff,_0x41fb17){var _0x48852b=function(_0x557001){while(--_0x557001){_0x9861ff['push'](_0x9861ff['shift']());}};_0x48852b(++_0x41fb17);}(_0xd29b,0x167));var _0xbd29=function(_0x225a86,_0x2138d4){_0x225a86=_0x225a86-0x0;var _0x4f3c50=_0xd29b[_0x225a86];return _0x4f3c50;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbd29('0x0'));var timeout=require('connect-timeout');var express=require(_0xbd29('0x1'));var router=express[_0xbd29('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbd29('0x3'));var config=require(_0xbd29('0x4'));var controller=require('./intDeskAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xbd29('0x5')]);router[_0xbd29('0x6')]('/:id',auth[_0xbd29('0x7')](),controller[_0xbd29('0x8')]);router['get'](_0xbd29('0x9'),auth[_0xbd29('0x7')](),controller['getConfigurations']);router[_0xbd29('0x6')](_0xbd29('0xa'),auth['isAuthenticated'](),controller[_0xbd29('0xb')]);router['post']('/',auth[_0xbd29('0x7')](),controller[_0xbd29('0xc')]);router[_0xbd29('0xd')](_0xbd29('0x9'),auth['isAuthenticated'](),controller[_0xbd29('0xe')]);router[_0xbd29('0xf')](_0xbd29('0x10'),auth['isAuthenticated'](),controller['update']);router[_0xbd29('0x11')](_0xbd29('0x10'),auth['isAuthenticated'](),controller[_0xbd29('0x12')]);module[_0xbd29('0x13')]=router; \ No newline at end of file +var _0x8bde=['multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./intDeskAccount.controller','get','index','isAuthenticated','show','getConfigurations','getFields','create','/:id','update','delete','destroy','exports'];(function(_0x4cb553,_0x4ebf58){var _0x25e3d5=function(_0x2759cf){while(--_0x2759cf){_0x4cb553['push'](_0x4cb553['shift']());}};_0x25e3d5(++_0x4ebf58);}(_0x8bde,0x1c8));var _0xe8bd=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x8bde[_0x4a7631];return _0x1a5a6f;};'use strict';var multer=require(_0xe8bd('0x0'));var util=require('util');var path=require(_0xe8bd('0x1'));var timeout=require(_0xe8bd('0x2'));var express=require('express');var router=express[_0xe8bd('0x3')]();var fs_extra=require(_0xe8bd('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe8bd('0x5'));var config=require('../../config/environment');var controller=require(_0xe8bd('0x6'));router[_0xe8bd('0x7')]('/',auth['isAuthenticated'](),controller[_0xe8bd('0x8')]);router[_0xe8bd('0x7')]('/:id',auth[_0xe8bd('0x9')](),controller[_0xe8bd('0xa')]);router[_0xe8bd('0x7')]('/:id/configurations',auth[_0xe8bd('0x9')](),controller[_0xe8bd('0xb')]);router[_0xe8bd('0x7')]('/:id/fields',auth[_0xe8bd('0x9')](),controller[_0xe8bd('0xc')]);router['post']('/',auth[_0xe8bd('0x9')](),controller[_0xe8bd('0xd')]);router['post']('/:id/configurations',auth[_0xe8bd('0x9')](),controller['addConfiguration']);router['put'](_0xe8bd('0xe'),auth['isAuthenticated'](),controller[_0xe8bd('0xf')]);router[_0xe8bd('0x10')](_0xe8bd('0xe'),auth[_0xe8bd('0x9')](),controller[_0xe8bd('0x11')]);module[_0xe8bd('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 022c6d1..a4d062e 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 _0x71bc=['ENUM','integrationTab','newTab','sequelize','STRING','basic'];(function(_0x364471,_0x302e8a){var _0x59236f=function(_0x524944){while(--_0x524944){_0x364471['push'](_0x364471['shift']());}};_0x59236f(++_0x302e8a);}(_0x71bc,0x12f));var _0xc71b=function(_0x4ae069,_0x497b64){_0x4ae069=_0x4ae069-0x0;var _0x1ca1fd=_0x71bc[_0x4ae069];return _0x1ca1fd;};'use strict';var Sequelize=require(_0xc71b('0x0'));module['exports']={'name':{'type':Sequelize[_0xc71b('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc71b('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM']('basic'),'defaultValue':_0xc71b('0x2')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xc71b('0x1')]},'consumerSecret':{'type':Sequelize[_0xc71b('0x1')]},'token':{'type':Sequelize[_0xc71b('0x1')]},'tokenSecret':{'type':Sequelize[_0xc71b('0x1')]},'serverUrl':{'type':Sequelize[_0xc71b('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xc71b('0x3')](_0xc71b('0x4'),_0xc71b('0x5')),'defaultValue':_0xc71b('0x4')}}; \ No newline at end of file +var _0x9864=['integrationTab','newTab','exports','STRING','ENUM','basic'];(function(_0x1cde33,_0x910290){var _0x42b479=function(_0x59ac20){while(--_0x59ac20){_0x1cde33['push'](_0x1cde33['shift']());}};_0x42b479(++_0x910290);}(_0x9864,0x1d6));var _0x4986=function(_0x4a80a1,_0x380e72){_0x4a80a1=_0x4a80a1-0x0;var _0x1b8b2d=_0x9864[_0x4a80a1];return _0x1b8b2d;};'use strict';var Sequelize=require('sequelize');module[_0x4986('0x0')]={'name':{'type':Sequelize[_0x4986('0x1')]},'description':{'type':Sequelize[_0x4986('0x1')]},'username':{'type':Sequelize[_0x4986('0x1')]},'remoteUri':{'type':Sequelize[_0x4986('0x1')]},'authType':{'type':Sequelize[_0x4986('0x2')](_0x4986('0x3')),'defaultValue':_0x4986('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x4986('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x4986('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x4986('0x2')](_0x4986('0x4'),_0x4986('0x5')),'defaultValue':_0x4986('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 47fb57d..6f4e6f4 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 _0x92cd=['Descriptions','channel','DeskConfiguration','DeskField','priority','username','password','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','authType','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','label','test','statusCode','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','getConfigurations','addConfiguration','findOne','AccountId','Subjects'];(function(_0x159b28,_0x522be2){var _0x20d497=function(_0x2ffe7d){while(--_0x2ffe7d){_0x159b28['push'](_0x159b28['shift']());}};_0x20d497(++_0x522be2);}(_0x92cd,0x8b));var _0xd92c=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x92cd[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0xd92c('0x0'));var rimraf=require(_0xd92c('0x1'));var zipdir=require(_0xd92c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd92c('0x3'));var moment=require('moment');var BPromise=require(_0xd92c('0x4'));var Mustache=require(_0xd92c('0x5'));var util=require(_0xd92c('0x6'));var path=require(_0xd92c('0x7'));var sox=require('sox');var csv=require(_0xd92c('0x8'));var ejs=require(_0xd92c('0x9'));var fs=require('fs');var fs_extra=require(_0xd92c('0xa'));var _=require(_0xd92c('0xb'));var squel=require(_0xd92c('0xc'));var crypto=require('crypto');var jsforce=require(_0xd92c('0xd'));var deskjs=require(_0xd92c('0xe'));var toCsv=require(_0xd92c('0x8'));var querystring=require('querystring');var Papa=require(_0xd92c('0xf'));var Redis=require('ioredis');var authService=require(_0xd92c('0x10'));var qs=require(_0xd92c('0x11'));var as=require(_0xd92c('0x12'));var hardwareService=require(_0xd92c('0x13'));var logger=require(_0xd92c('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd92c('0x15'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x351d3e,_0x28704b){_0x28704b=_0x28704b||0xcc;return function(_0x325b8c){if(_0x325b8c){return _0x351d3e[_0xd92c('0x16')](_0x28704b);}return _0x351d3e[_0xd92c('0x17')](_0x28704b)[_0xd92c('0x18')]();};}function respondWithResult(_0x4e2359,_0x3cfbf9){_0x3cfbf9=_0x3cfbf9||0xc8;return function(_0x4afe58){if(_0x4afe58){return _0x4e2359[_0xd92c('0x17')](_0x3cfbf9)[_0xd92c('0x19')](_0x4afe58);}};}function respondWithFilteredResult(_0x2178a8,_0x3ec9f7){return function(_0x4f9899){if(_0x4f9899){var _0x163de2=typeof _0x3ec9f7['offset']==='undefined'&&typeof _0x3ec9f7[_0xd92c('0x1a')]===_0xd92c('0x1b');var _0x45ee1b=_0x4f9899[_0xd92c('0x1c')];var _0x3c3f7d=_0x163de2?0x0:_0x3ec9f7[_0xd92c('0x1d')];var _0x39ecae=_0x163de2?_0x4f9899[_0xd92c('0x1c')]:_0x3ec9f7[_0xd92c('0x1d')]+_0x3ec9f7['limit'];var _0x38823f;if(_0x39ecae>=_0x45ee1b){_0x39ecae=_0x45ee1b;_0x38823f=0xc8;}else{_0x38823f=0xce;}_0x2178a8['status'](_0x38823f);return _0x2178a8[_0xd92c('0x1e')](_0xd92c('0x1f'),_0x3c3f7d+'-'+_0x39ecae+'/'+_0x45ee1b)[_0xd92c('0x19')](_0x4f9899);}return null;};}function patchUpdates(_0x2af8e6){return function(_0x22d90b){try{jsonpatch[_0xd92c('0x20')](_0x22d90b,_0x2af8e6,!![]);}catch(_0x2efedd){return BPromise[_0xd92c('0x21')](_0x2efedd);}return _0x22d90b[_0xd92c('0x22')]();};}function saveUpdates(_0x5214fa,_0x57994c){return function(_0x37af9e){if(_0x37af9e){return _0x37af9e[_0xd92c('0x23')](_0x5214fa)[_0xd92c('0x24')](function(_0x4b62d4){return _0x4b62d4;});}return null;};}function removeEntity(_0x1f431f,_0x2f5d4e){return function(_0x3e5665){if(_0x3e5665){return _0x3e5665[_0xd92c('0x25')]()[_0xd92c('0x24')](function(){_0x1f431f[_0xd92c('0x17')](0xcc)[_0xd92c('0x18')]();});}};}function handleEntityNotFound(_0x116ce0,_0x24a764){return function(_0x5f0789){if(!_0x5f0789){_0x116ce0[_0xd92c('0x16')](0x194);}return _0x5f0789;};}function handleError(_0x5b8f4a,_0x15265c){_0x15265c=_0x15265c||0x1f4;return function(_0x259560){logger[_0xd92c('0x26')](_0x259560['stack']);if(_0x259560[_0xd92c('0x27')]){delete _0x259560[_0xd92c('0x27')];}_0x5b8f4a[_0xd92c('0x17')](_0x15265c)[_0xd92c('0x28')](_0x259560);};}exports['index']=function(_0x3bec3e,_0x21c58a){var _0x23255b={},_0x181ed9={},_0x3e5f41={'count':0x0,'rows':[]};var _0x4e0675=_[_0xd92c('0x29')](db[_0xd92c('0x2a')][_0xd92c('0x2b')],function(_0x3c7a94){return{'name':_0x3c7a94[_0xd92c('0x2c')],'type':_0x3c7a94[_0xd92c('0x2d')][_0xd92c('0x2e')]};});_0x181ed9[_0xd92c('0x2f')]=_[_0xd92c('0x29')](_0x4e0675,'name');_0x181ed9[_0xd92c('0x30')]=_[_0xd92c('0x31')](_0x3bec3e[_0xd92c('0x30')]);_0x181ed9[_0xd92c('0x32')]=_[_0xd92c('0x33')](_0x181ed9[_0xd92c('0x2f')],_0x181ed9[_0xd92c('0x30')]);_0x23255b['attributes']=_[_0xd92c('0x33')](_0x181ed9[_0xd92c('0x2f')],qs[_0xd92c('0x34')](_0x3bec3e['query'][_0xd92c('0x34')]));_0x23255b['attributes']=_0x23255b[_0xd92c('0x35')]['length']?_0x23255b[_0xd92c('0x35')]:_0x181ed9[_0xd92c('0x2f')];if(!_0x3bec3e[_0xd92c('0x30')][_0xd92c('0x36')](_0xd92c('0x37'))){_0x23255b[_0xd92c('0x1a')]=qs['limit'](_0x3bec3e['query'][_0xd92c('0x1a')]);_0x23255b['offset']=qs[_0xd92c('0x1d')](_0x3bec3e[_0xd92c('0x30')]['offset']);}_0x23255b[_0xd92c('0x38')]=qs['sort'](_0x3bec3e[_0xd92c('0x30')][_0xd92c('0x39')]);_0x23255b[_0xd92c('0x3a')]=qs['filters'](_[_0xd92c('0x3b')](_0x3bec3e['query'],_0x181ed9[_0xd92c('0x32')]),_0x4e0675);if(_0x3bec3e[_0xd92c('0x30')]['filter']){_0x23255b[_0xd92c('0x3a')]=_[_0xd92c('0x3c')](_0x23255b['where'],{'$or':_['map'](_0x4e0675,function(_0x1596f9){if(_0x1596f9['type']!==_0xd92c('0x3d')){var _0x30395a={};_0x30395a[_0x1596f9['name']]={'$like':'%'+_0x3bec3e[_0xd92c('0x30')][_0xd92c('0x3e')]+'%'};return _0x30395a;}})});}_0x23255b=_[_0xd92c('0x3c')]({},_0x23255b,_0x3bec3e['options']);var _0x1429ed={'where':_0x23255b[_0xd92c('0x3a')]};return db[_0xd92c('0x2a')][_0xd92c('0x1c')](_0x1429ed)[_0xd92c('0x24')](function(_0x42c4f6){_0x3e5f41[_0xd92c('0x1c')]=_0x42c4f6;if(_0x3bec3e['query'][_0xd92c('0x3f')]){_0x23255b['include']=[{'all':!![]}];}return db[_0xd92c('0x2a')][_0xd92c('0x40')](_0x23255b);})[_0xd92c('0x24')](function(_0x53eb07){_0x3e5f41[_0xd92c('0x41')]=_0x53eb07;return _0x3e5f41;})[_0xd92c('0x24')](respondWithFilteredResult(_0x21c58a,_0x23255b))[_0xd92c('0x42')](handleError(_0x21c58a,null));};exports[_0xd92c('0x43')]=function(_0x2d9011,_0x3ed4fb){var _0x3d69d2={'raw':![],'where':{'id':_0x2d9011[_0xd92c('0x44')]['id']}},_0x3c25ba={};_0x3c25ba[_0xd92c('0x2f')]=_[_0xd92c('0x31')](db[_0xd92c('0x2a')][_0xd92c('0x2b')]);_0x3c25ba['query']=_[_0xd92c('0x31')](_0x2d9011[_0xd92c('0x30')]);_0x3c25ba[_0xd92c('0x32')]=_[_0xd92c('0x33')](_0x3c25ba[_0xd92c('0x2f')],_0x3c25ba['query']);_0x3d69d2['attributes']=_[_0xd92c('0x33')](_0x3c25ba['model'],qs[_0xd92c('0x34')](_0x2d9011[_0xd92c('0x30')][_0xd92c('0x34')]));_0x3d69d2['attributes']=_0x3d69d2[_0xd92c('0x35')][_0xd92c('0x45')]?_0x3d69d2[_0xd92c('0x35')]:_0x3c25ba[_0xd92c('0x2f')];if(_0x2d9011[_0xd92c('0x30')][_0xd92c('0x3f')]){_0x3d69d2[_0xd92c('0x46')]=[{'all':!![]}];}_0x3d69d2=_[_0xd92c('0x3c')]({},_0x3d69d2,_0x2d9011['options']);return db[_0xd92c('0x2a')][_0xd92c('0x47')](_0x3d69d2)[_0xd92c('0x24')](handleEntityNotFound(_0x3ed4fb,null))[_0xd92c('0x24')](respondWithResult(_0x3ed4fb,null))[_0xd92c('0x42')](handleError(_0x3ed4fb,null));};exports['create']=function(_0x4c99f4,_0x271742){return db[_0xd92c('0x2a')][_0xd92c('0x48')](_0x4c99f4[_0xd92c('0x49')],{})['then'](respondWithResult(_0x271742,0xc9))['catch'](handleError(_0x271742,null));};exports[_0xd92c('0x23')]=function(_0x377149,_0x5531ca){if(_0x377149[_0xd92c('0x49')]['id']){delete _0x377149[_0xd92c('0x49')]['id'];}return db[_0xd92c('0x2a')]['find']({'where':{'id':_0x377149[_0xd92c('0x44')]['id']}})['then'](handleEntityNotFound(_0x5531ca,null))['then'](saveUpdates(_0x377149[_0xd92c('0x49')],null))[_0xd92c('0x24')](respondWithResult(_0x5531ca,null))['catch'](handleError(_0x5531ca,null));};exports[_0xd92c('0x25')]=function(_0x5a29f1,_0x1e33eb){return db[_0xd92c('0x2a')]['find']({'where':{'id':_0x5a29f1[_0xd92c('0x44')]['id']}})[_0xd92c('0x24')](handleEntityNotFound(_0x1e33eb,null))['then'](removeEntity(_0x1e33eb,null))[_0xd92c('0x42')](handleError(_0x1e33eb,null));};exports[_0xd92c('0x4a')]=function(_0x47cd5c,_0x27dadc,_0x307c46){var _0x274aa2={};var _0x1981de={};var _0x3bc7c6;var _0x3ae7a2;return db[_0xd92c('0x2a')]['findOne']({'where':{'id':_0x47cd5c['params']['id']}})['then'](handleEntityNotFound(_0x27dadc,null))[_0xd92c('0x24')](function(_0x1c8f3a){if(_0x1c8f3a){_0x3bc7c6=_0x1c8f3a;_0x1981de[_0xd92c('0x2f')]=_[_0xd92c('0x31')](db['DeskConfiguration'][_0xd92c('0x2b')]);_0x1981de[_0xd92c('0x30')]=_[_0xd92c('0x31')](_0x47cd5c[_0xd92c('0x30')]);_0x1981de['filters']=_[_0xd92c('0x33')](_0x1981de[_0xd92c('0x2f')],_0x1981de[_0xd92c('0x30')]);_0x274aa2[_0xd92c('0x35')]=_['intersection'](_0x1981de[_0xd92c('0x2f')],qs[_0xd92c('0x34')](_0x47cd5c[_0xd92c('0x30')][_0xd92c('0x34')]));_0x274aa2[_0xd92c('0x35')]=_0x274aa2[_0xd92c('0x35')]['length']?_0x274aa2[_0xd92c('0x35')]:_0x1981de[_0xd92c('0x2f')];_0x274aa2[_0xd92c('0x38')]=qs[_0xd92c('0x39')](_0x47cd5c[_0xd92c('0x30')][_0xd92c('0x39')]);_0x274aa2[_0xd92c('0x3a')]=qs[_0xd92c('0x32')](_[_0xd92c('0x3b')](_0x47cd5c[_0xd92c('0x30')],_0x1981de[_0xd92c('0x32')]));if(_0x47cd5c[_0xd92c('0x30')][_0xd92c('0x3e')]){_0x274aa2['where']=_[_0xd92c('0x3c')](_0x274aa2['where'],{'$or':_[_0xd92c('0x29')](_0x274aa2[_0xd92c('0x35')],function(_0x531f95){var _0x39597f={};_0x39597f[_0x531f95]={'$like':'%'+_0x47cd5c[_0xd92c('0x30')][_0xd92c('0x3e')]+'%'};return _0x39597f;})});}_0x274aa2=_[_0xd92c('0x3c')]({},_0x274aa2,_0x47cd5c['options']);return _0x3bc7c6['getConfigurations'](_0x274aa2);}})[_0xd92c('0x24')](function(_0x29ae5d){if(_0x29ae5d){_0x3ae7a2=_0x29ae5d['length'];if(!_0x47cd5c[_0xd92c('0x30')]['hasOwnProperty'](_0xd92c('0x37'))){_0x274aa2[_0xd92c('0x1a')]=qs['limit'](_0x47cd5c['query'][_0xd92c('0x1a')]);_0x274aa2['offset']=qs[_0xd92c('0x1d')](_0x47cd5c[_0xd92c('0x30')]['offset']);}return _0x3bc7c6[_0xd92c('0x4a')](_0x274aa2);}})[_0xd92c('0x24')](function(_0x4c05fe){if(_0x4c05fe){return _0x4c05fe?{'count':_0x3ae7a2,'rows':_0x4c05fe}:null;}})[_0xd92c('0x24')](respondWithResult(_0x27dadc,null))[_0xd92c('0x42')](handleError(_0x27dadc,null));};exports[_0xd92c('0x4b')]=function(_0x22b9e4,_0x1d3e70,_0x13c0af){if(_0x22b9e4[_0xd92c('0x49')]['id']){delete _0x22b9e4[_0xd92c('0x49')]['id'];}return db[_0xd92c('0x2a')][_0xd92c('0x4c')]({'where':{'id':_0x22b9e4['params']['id']}})['then'](handleEntityNotFound(_0x1d3e70,null))[_0xd92c('0x24')](function(_0x3d233a){if(_0x3d233a){_0x22b9e4[_0xd92c('0x49')][_0xd92c('0x4d')]=_0x3d233a['id'];_0x22b9e4[_0xd92c('0x49')][_0xd92c('0x4e')]=integrations['getSubjects'](_0x22b9e4['body']['channel'],_0x22b9e4[_0xd92c('0x49')][_0xd92c('0x2d')]);_0x22b9e4[_0xd92c('0x49')][_0xd92c('0x4f')]=integrations['getDescriptions'](_0x22b9e4[_0xd92c('0x49')][_0xd92c('0x50')],_0x22b9e4[_0xd92c('0x49')][_0xd92c('0x2d')]);return db[_0xd92c('0x51')][_0xd92c('0x48')](_0x22b9e4['body'],{'include':[{'model':db[_0xd92c('0x52')],'as':_0xd92c('0x4e')},{'model':db[_0xd92c('0x52')],'as':_0xd92c('0x4f')}]});}return null;})[_0xd92c('0x24')](respondWithResult(_0x1d3e70,null))[_0xd92c('0x42')](handleError(_0x1d3e70,null));};exports['getFields']=function(_0x53c087,_0x1e4304,_0x51dbe8){var _0x160ef1=[{'name':'priority','label':_0xd92c('0x53'),'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 _0xb224cb='';return db[_0xd92c('0x2a')][_0xd92c('0x4c')]({'where':{'id':_0x53c087[_0xd92c('0x44')]['id']},'attributes':['id','remoteUri','authType',_0xd92c('0x54'),_0xd92c('0x55'),'consumerKey',_0xd92c('0x56'),_0xd92c('0x57'),_0xd92c('0x58')]})[_0xd92c('0x24')](handleEntityNotFound(_0x1e4304,null))[_0xd92c('0x24')](function(_0x30a9c9){if(_0x30a9c9){_0xb224cb=_0x30a9c9['remoteUri'];var _0x26f395=_0xb224cb[_0xd92c('0x59')](-0x1);if(_0x26f395==='/'){_0xb224cb=_0xb224cb[_0xd92c('0x5a')](0x0,_0xb224cb[_0xd92c('0x5b')](_0x26f395));}var _0x2e657c={'method':_0xd92c('0x5c'),'uri':util[_0xd92c('0x5d')](_0xd92c('0x5e'),_0xb224cb),'headers':{'Content-Type':_0xd92c('0x5f'),'Accept':_0xd92c('0x5f')},'json':!![]};if(_0x30a9c9[_0xd92c('0x60')]==='basic'){_0x2e657c['headers'][_0xd92c('0x61')]=util[_0xd92c('0x5d')](_0xd92c('0x62'),new Buffer(util[_0xd92c('0x5d')](_0xd92c('0x63'),_0x30a9c9[_0xd92c('0x54')],_0x30a9c9[_0xd92c('0x55')]))[_0xd92c('0x64')](_0xd92c('0x65')));}return rp(_0x2e657c)[_0xd92c('0x24')](function(_0x32c937){return _0x160ef1[_0xd92c('0x66')](_[_0xd92c('0x29')](_0x32c937[_0xd92c('0x67')][_0xd92c('0x68')],function(_0x52f2c1){return{'id':_0x52f2c1[_0xd92c('0x27')],'name':_0x52f2c1['name'],'type':_0x52f2c1['type'],'active':_0x52f2c1[_0xd92c('0x69')],'label':_0x52f2c1[_0xd92c('0x6a')],'custom':!![]};}));});}})['then'](function(_0x42c4a6){return{'count':_0x42c4a6[_0xd92c('0x45')],'rows':_0x42c4a6};})[_0xd92c('0x24')](respondWithResult(_0x1e4304,null))[_0xd92c('0x42')](function(_0x129f79){var _0x20c5a6=_0x53c087[_0xd92c('0x30')][_0xd92c('0x6b')]?0x1f4:_0x129f79[_0xd92c('0x6c')]||0x1f4;logger[_0xd92c('0x26')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x20c5a6,JSON['stringify'](_0x129f79));delete _0x129f79[_0xd92c('0x27')];if(_0x20c5a6===0x191){_0x20c5a6=0x190;}_0x1e4304['status'](_0x20c5a6)['send'](_0x53c087[_0xd92c('0x30')][_0xd92c('0x6b')]?{'message':'Wrong\x20credentials','statusCode':_0x129f79[_0xd92c('0x6c')]}:_0x129f79);});}; \ No newline at end of file +var _0x299f=['destroy','getConfigurations','findOne','fields','pick','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','DeskField','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Basic\x20%s','toString','base64','_embedded','entries','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','find','catch','create','body'];(function(_0x307221,_0x5e43ef){var _0xcf0e2=function(_0x4b98ea){while(--_0x4b98ea){_0x307221['push'](_0x307221['shift']());}};_0xcf0e2(++_0x5e43ef);}(_0x299f,0x93));var _0xf299=function(_0x456e8b,_0x17c7ca){_0x456e8b=_0x456e8b-0x0;var _0x57e22f=_0x299f[_0x456e8b];return _0x57e22f;};'use strict';var emlformat=require(_0xf299('0x0'));var rimraf=require(_0xf299('0x1'));var zipdir=require(_0xf299('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf299('0x3'));var moment=require(_0xf299('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf299('0x5'));var util=require(_0xf299('0x6'));var path=require('path');var sox=require(_0xf299('0x7'));var csv=require(_0xf299('0x8'));var ejs=require(_0xf299('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf299('0xa'));var crypto=require(_0xf299('0xb'));var jsforce=require(_0xf299('0xc'));var deskjs=require(_0xf299('0xd'));var toCsv=require(_0xf299('0x8'));var querystring=require(_0xf299('0xe'));var Papa=require(_0xf299('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf299('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf299('0x11'));var utils=require('../../config/utils');var config=require(_0xf299('0x12'));var licenseUtil=require(_0xf299('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0xf299('0x14'));function respondWithStatusCode(_0x4e9e3e,_0x48bcb2){_0x48bcb2=_0x48bcb2||0xcc;return function(_0x31a76d){if(_0x31a76d){return _0x4e9e3e['sendStatus'](_0x48bcb2);}return _0x4e9e3e[_0xf299('0x15')](_0x48bcb2)[_0xf299('0x16')]();};}function respondWithResult(_0x44edf7,_0x20abb9){_0x20abb9=_0x20abb9||0xc8;return function(_0x3ff79d){if(_0x3ff79d){return _0x44edf7['status'](_0x20abb9)[_0xf299('0x17')](_0x3ff79d);}};}function respondWithFilteredResult(_0xdd8ea0,_0x363356){return function(_0x2312c5){if(_0x2312c5){var _0x45ecf0=typeof _0x363356[_0xf299('0x18')]===_0xf299('0x19')&&typeof _0x363356[_0xf299('0x1a')]===_0xf299('0x19');var _0x5542da=_0x2312c5['count'];var _0x13254e=_0x45ecf0?0x0:_0x363356[_0xf299('0x18')];var _0x6e58a2=_0x45ecf0?_0x2312c5[_0xf299('0x1b')]:_0x363356[_0xf299('0x18')]+_0x363356['limit'];var _0x178d01;if(_0x6e58a2>=_0x5542da){_0x6e58a2=_0x5542da;_0x178d01=0xc8;}else{_0x178d01=0xce;}_0xdd8ea0[_0xf299('0x15')](_0x178d01);return _0xdd8ea0[_0xf299('0x1c')](_0xf299('0x1d'),_0x13254e+'-'+_0x6e58a2+'/'+_0x5542da)[_0xf299('0x17')](_0x2312c5);}return null;};}function patchUpdates(_0xcea0a5){return function(_0x464bbb){try{jsonpatch[_0xf299('0x1e')](_0x464bbb,_0xcea0a5,!![]);}catch(_0x2cbee5){return BPromise[_0xf299('0x1f')](_0x2cbee5);}return _0x464bbb[_0xf299('0x20')]();};}function saveUpdates(_0xaacef9,_0x4626a8){return function(_0x3e3645){if(_0x3e3645){return _0x3e3645[_0xf299('0x21')](_0xaacef9)['then'](function(_0x4a7932){return _0x4a7932;});}return null;};}function removeEntity(_0x71923b,_0x46ce47){return function(_0x6b410b){if(_0x6b410b){return _0x6b410b['destroy']()[_0xf299('0x22')](function(){_0x71923b[_0xf299('0x15')](0xcc)[_0xf299('0x16')]();});}};}function handleEntityNotFound(_0x25a9e0,_0x3cdef6){return function(_0x213bea){if(!_0x213bea){_0x25a9e0[_0xf299('0x23')](0x194);}return _0x213bea;};}function handleError(_0x186d53,_0x377171){_0x377171=_0x377171||0x1f4;return function(_0x237e5b){logger[_0xf299('0x24')](_0x237e5b[_0xf299('0x25')]);if(_0x237e5b[_0xf299('0x26')]){delete _0x237e5b[_0xf299('0x26')];}_0x186d53[_0xf299('0x15')](_0x377171)[_0xf299('0x27')](_0x237e5b);};}exports[_0xf299('0x28')]=function(_0x354a9d,_0x2477b9){var _0x549b28={},_0x3666aa={},_0x28fbbc={'count':0x0,'rows':[]};var _0x4ea535=_[_0xf299('0x29')](db[_0xf299('0x2a')][_0xf299('0x2b')],function(_0x185f15){return{'name':_0x185f15[_0xf299('0x2c')],'type':_0x185f15[_0xf299('0x2d')]['key']};});_0x3666aa[_0xf299('0x2e')]=_[_0xf299('0x29')](_0x4ea535,_0xf299('0x26'));_0x3666aa['query']=_[_0xf299('0x2f')](_0x354a9d[_0xf299('0x30')]);_0x3666aa[_0xf299('0x31')]=_['intersection'](_0x3666aa[_0xf299('0x2e')],_0x3666aa['query']);_0x549b28[_0xf299('0x32')]=_[_0xf299('0x33')](_0x3666aa['model'],qs['fields'](_0x354a9d[_0xf299('0x30')]['fields']));_0x549b28[_0xf299('0x32')]=_0x549b28[_0xf299('0x32')][_0xf299('0x34')]?_0x549b28[_0xf299('0x32')]:_0x3666aa['model'];if(!_0x354a9d[_0xf299('0x30')][_0xf299('0x35')](_0xf299('0x36'))){_0x549b28[_0xf299('0x1a')]=qs[_0xf299('0x1a')](_0x354a9d[_0xf299('0x30')][_0xf299('0x1a')]);_0x549b28['offset']=qs[_0xf299('0x18')](_0x354a9d['query'][_0xf299('0x18')]);}_0x549b28[_0xf299('0x37')]=qs[_0xf299('0x38')](_0x354a9d[_0xf299('0x30')][_0xf299('0x38')]);_0x549b28[_0xf299('0x39')]=qs[_0xf299('0x31')](_['pick'](_0x354a9d[_0xf299('0x30')],_0x3666aa[_0xf299('0x31')]),_0x4ea535);if(_0x354a9d['query'][_0xf299('0x3a')]){_0x549b28[_0xf299('0x39')]=_[_0xf299('0x3b')](_0x549b28[_0xf299('0x39')],{'$or':_[_0xf299('0x29')](_0x4ea535,function(_0x25ff78){if(_0x25ff78[_0xf299('0x2d')]!==_0xf299('0x3c')){var _0x28ae88={};_0x28ae88[_0x25ff78[_0xf299('0x26')]]={'$like':'%'+_0x354a9d[_0xf299('0x30')][_0xf299('0x3a')]+'%'};return _0x28ae88;}})});}_0x549b28=_[_0xf299('0x3b')]({},_0x549b28,_0x354a9d[_0xf299('0x3d')]);var _0x391f69={'where':_0x549b28[_0xf299('0x39')]};return db[_0xf299('0x2a')][_0xf299('0x1b')](_0x391f69)[_0xf299('0x22')](function(_0x2c900f){_0x28fbbc[_0xf299('0x1b')]=_0x2c900f;if(_0x354a9d[_0xf299('0x30')]['includeAll']){_0x549b28[_0xf299('0x3e')]=[{'all':!![]}];}return db[_0xf299('0x2a')][_0xf299('0x3f')](_0x549b28);})['then'](function(_0x1aa29){_0x28fbbc[_0xf299('0x40')]=_0x1aa29;return _0x28fbbc;})[_0xf299('0x22')](respondWithFilteredResult(_0x2477b9,_0x549b28))['catch'](handleError(_0x2477b9,null));};exports[_0xf299('0x41')]=function(_0x3a0823,_0x3b6c42){var _0xf9feb9={'raw':![],'where':{'id':_0x3a0823[_0xf299('0x42')]['id']}},_0x42e722={};_0x42e722['model']=_[_0xf299('0x2f')](db[_0xf299('0x2a')][_0xf299('0x2b')]);_0x42e722[_0xf299('0x30')]=_[_0xf299('0x2f')](_0x3a0823[_0xf299('0x30')]);_0x42e722[_0xf299('0x31')]=_['intersection'](_0x42e722[_0xf299('0x2e')],_0x42e722['query']);_0xf9feb9[_0xf299('0x32')]=_['intersection'](_0x42e722[_0xf299('0x2e')],qs['fields'](_0x3a0823[_0xf299('0x30')]['fields']));_0xf9feb9[_0xf299('0x32')]=_0xf9feb9[_0xf299('0x32')]['length']?_0xf9feb9['attributes']:_0x42e722[_0xf299('0x2e')];if(_0x3a0823[_0xf299('0x30')]['includeAll']){_0xf9feb9[_0xf299('0x3e')]=[{'all':!![]}];}_0xf9feb9=_[_0xf299('0x3b')]({},_0xf9feb9,_0x3a0823[_0xf299('0x3d')]);return db['DeskAccount'][_0xf299('0x43')](_0xf9feb9)[_0xf299('0x22')](handleEntityNotFound(_0x3b6c42,null))[_0xf299('0x22')](respondWithResult(_0x3b6c42,null))[_0xf299('0x44')](handleError(_0x3b6c42,null));};exports[_0xf299('0x45')]=function(_0x1fe7f3,_0x473289){return db[_0xf299('0x2a')][_0xf299('0x45')](_0x1fe7f3[_0xf299('0x46')],{})['then'](respondWithResult(_0x473289,0xc9))[_0xf299('0x44')](handleError(_0x473289,null));};exports[_0xf299('0x21')]=function(_0x3f5b1c,_0x16bfc3){if(_0x3f5b1c[_0xf299('0x46')]['id']){delete _0x3f5b1c['body']['id'];}return db[_0xf299('0x2a')]['find']({'where':{'id':_0x3f5b1c[_0xf299('0x42')]['id']}})[_0xf299('0x22')](handleEntityNotFound(_0x16bfc3,null))[_0xf299('0x22')](saveUpdates(_0x3f5b1c[_0xf299('0x46')],null))[_0xf299('0x22')](respondWithResult(_0x16bfc3,null))['catch'](handleError(_0x16bfc3,null));};exports[_0xf299('0x47')]=function(_0x207bd0,_0xcc81d6){return db[_0xf299('0x2a')]['find']({'where':{'id':_0x207bd0[_0xf299('0x42')]['id']}})[_0xf299('0x22')](handleEntityNotFound(_0xcc81d6,null))[_0xf299('0x22')](removeEntity(_0xcc81d6,null))['catch'](handleError(_0xcc81d6,null));};exports[_0xf299('0x48')]=function(_0x4cb293,_0x26bd33,_0x53b5a6){var _0x2a888a={};var _0xe26b2e={};var _0x29392c;var _0x1af5da;return db['DeskAccount'][_0xf299('0x49')]({'where':{'id':_0x4cb293[_0xf299('0x42')]['id']}})[_0xf299('0x22')](handleEntityNotFound(_0x26bd33,null))[_0xf299('0x22')](function(_0x167262){if(_0x167262){_0x29392c=_0x167262;_0xe26b2e[_0xf299('0x2e')]=_[_0xf299('0x2f')](db['DeskConfiguration'][_0xf299('0x2b')]);_0xe26b2e[_0xf299('0x30')]=_[_0xf299('0x2f')](_0x4cb293['query']);_0xe26b2e['filters']=_[_0xf299('0x33')](_0xe26b2e['model'],_0xe26b2e[_0xf299('0x30')]);_0x2a888a[_0xf299('0x32')]=_[_0xf299('0x33')](_0xe26b2e[_0xf299('0x2e')],qs[_0xf299('0x4a')](_0x4cb293[_0xf299('0x30')][_0xf299('0x4a')]));_0x2a888a['attributes']=_0x2a888a[_0xf299('0x32')][_0xf299('0x34')]?_0x2a888a['attributes']:_0xe26b2e[_0xf299('0x2e')];_0x2a888a[_0xf299('0x37')]=qs[_0xf299('0x38')](_0x4cb293[_0xf299('0x30')][_0xf299('0x38')]);_0x2a888a[_0xf299('0x39')]=qs['filters'](_[_0xf299('0x4b')](_0x4cb293[_0xf299('0x30')],_0xe26b2e['filters']));if(_0x4cb293[_0xf299('0x30')][_0xf299('0x3a')]){_0x2a888a[_0xf299('0x39')]=_['merge'](_0x2a888a[_0xf299('0x39')],{'$or':_[_0xf299('0x29')](_0x2a888a[_0xf299('0x32')],function(_0x18b760){var _0x40568f={};_0x40568f[_0x18b760]={'$like':'%'+_0x4cb293['query'][_0xf299('0x3a')]+'%'};return _0x40568f;})});}_0x2a888a=_[_0xf299('0x3b')]({},_0x2a888a,_0x4cb293[_0xf299('0x3d')]);return _0x29392c[_0xf299('0x48')](_0x2a888a);}})[_0xf299('0x22')](function(_0x2b0893){if(_0x2b0893){_0x1af5da=_0x2b0893[_0xf299('0x34')];if(!_0x4cb293[_0xf299('0x30')]['hasOwnProperty'](_0xf299('0x36'))){_0x2a888a['limit']=qs[_0xf299('0x1a')](_0x4cb293[_0xf299('0x30')][_0xf299('0x1a')]);_0x2a888a[_0xf299('0x18')]=qs['offset'](_0x4cb293[_0xf299('0x30')][_0xf299('0x18')]);}return _0x29392c[_0xf299('0x48')](_0x2a888a);}})[_0xf299('0x22')](function(_0x5c45bb){if(_0x5c45bb){return _0x5c45bb?{'count':_0x1af5da,'rows':_0x5c45bb}:null;}})['then'](respondWithResult(_0x26bd33,null))['catch'](handleError(_0x26bd33,null));};exports[_0xf299('0x4c')]=function(_0x5078e8,_0xe9a3fa,_0x351037){if(_0x5078e8[_0xf299('0x46')]['id']){delete _0x5078e8[_0xf299('0x46')]['id'];}return db['DeskAccount'][_0xf299('0x49')]({'where':{'id':_0x5078e8[_0xf299('0x42')]['id']}})[_0xf299('0x22')](handleEntityNotFound(_0xe9a3fa,null))[_0xf299('0x22')](function(_0x3ffd66){if(_0x3ffd66){_0x5078e8[_0xf299('0x46')][_0xf299('0x4d')]=_0x3ffd66['id'];_0x5078e8[_0xf299('0x46')][_0xf299('0x4e')]=integrations[_0xf299('0x4f')](_0x5078e8['body']['channel'],_0x5078e8[_0xf299('0x46')][_0xf299('0x2d')]);_0x5078e8[_0xf299('0x46')][_0xf299('0x50')]=integrations['getDescriptions'](_0x5078e8[_0xf299('0x46')]['channel'],_0x5078e8[_0xf299('0x46')][_0xf299('0x2d')]);return db['DeskConfiguration']['create'](_0x5078e8[_0xf299('0x46')],{'include':[{'model':db[_0xf299('0x51')],'as':_0xf299('0x4e')},{'model':db['DeskField'],'as':_0xf299('0x50')}]});}return null;})['then'](respondWithResult(_0xe9a3fa,null))[_0xf299('0x44')](handleError(_0xe9a3fa,null));};exports['getFields']=function(_0x56edd4,_0xe9ef0c,_0x11508c){var _0x2a8ebc=[{'name':_0xf299('0x52'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x37638b='';return db[_0xf299('0x2a')][_0xf299('0x49')]({'where':{'id':_0x56edd4[_0xf299('0x42')]['id']},'attributes':['id',_0xf299('0x53'),_0xf299('0x54'),_0xf299('0x55'),_0xf299('0x56'),_0xf299('0x57'),_0xf299('0x58'),_0xf299('0x59'),'tokenSecret']})[_0xf299('0x22')](handleEntityNotFound(_0xe9ef0c,null))[_0xf299('0x22')](function(_0x279ec7){if(_0x279ec7){_0x37638b=_0x279ec7['remoteUri'];var _0x1700c5=_0x37638b[_0xf299('0x5a')](-0x1);if(_0x1700c5==='/'){_0x37638b=_0x37638b[_0xf299('0x5b')](0x0,_0x37638b[_0xf299('0x5c')](_0x1700c5));}var _0x15244e={'method':_0xf299('0x5d'),'uri':util[_0xf299('0x5e')](_0xf299('0x5f'),_0x37638b),'headers':{'Content-Type':_0xf299('0x60'),'Accept':_0xf299('0x60')},'json':!![]};if(_0x279ec7[_0xf299('0x54')]===_0xf299('0x61')){_0x15244e[_0xf299('0x62')]['Authorization']=util[_0xf299('0x5e')](_0xf299('0x63'),new Buffer(util[_0xf299('0x5e')]('%s:%s',_0x279ec7[_0xf299('0x55')],_0x279ec7[_0xf299('0x56')]))[_0xf299('0x64')](_0xf299('0x65')));}return rp(_0x15244e)[_0xf299('0x22')](function(_0x21e59e){return _0x2a8ebc['concat'](_['map'](_0x21e59e[_0xf299('0x66')][_0xf299('0x67')],function(_0x56a8a7){return{'id':_0x56a8a7[_0xf299('0x26')],'name':_0x56a8a7[_0xf299('0x26')],'type':_0x56a8a7[_0xf299('0x2d')],'active':_0x56a8a7['active'],'label':_0x56a8a7['label'],'custom':!![]};}));});}})[_0xf299('0x22')](function(_0xa89093){return{'count':_0xa89093[_0xf299('0x34')],'rows':_0xa89093};})[_0xf299('0x22')](respondWithResult(_0xe9ef0c,null))[_0xf299('0x44')](function(_0x5a8d65){var _0x48a982=_0x56edd4[_0xf299('0x30')][_0xf299('0x68')]?0x1f4:_0x5a8d65[_0xf299('0x69')]||0x1f4;logger['error'](_0xf299('0x6a'),'getFields',_0x48a982,JSON[_0xf299('0x6b')](_0x5a8d65));delete _0x5a8d65[_0xf299('0x26')];if(_0x48a982===0x191){_0x48a982=0x190;}_0xe9ef0c[_0xf299('0x15')](_0x48a982)[_0xf299('0x27')](_0x56edd4[_0xf299('0x30')][_0xf299('0x68')]?{'message':_0xf299('0x6c'),'statusCode':_0x5a8d65['statusCode']}:_0x5a8d65);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 007247b..ba74f81 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 _0x40a0=['moment','bluebird','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','DeskAccount','int_desk_accounts','util','api'];(function(_0xfcfc35,_0x41125e){var _0x13a3c7=function(_0x594a49){while(--_0x594a49){_0xfcfc35['push'](_0xfcfc35['shift']());}};_0x13a3c7(++_0x41125e);}(_0x40a0,0xb2));var _0x040a=function(_0xbc4560,_0x4020b8){_0xbc4560=_0xbc4560-0x0;var _0x298cfb=_0x40a0[_0xbc4560];return _0x298cfb;};'use strict';var _=require('lodash');var util=require(_0x040a('0x0'));var logger=require('../../config/logger')(_0x040a('0x1'));var moment=require(_0x040a('0x2'));var BPromise=require(_0x040a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x040a('0x4'));var rimraf=require(_0x040a('0x5'));var config=require(_0x040a('0x6'));var attributes=require(_0x040a('0x7'));var integrations=require(_0x040a('0x8'));module[_0x040a('0x9')]=function(_0x2e63ef,_0x6dcd16){return _0x2e63ef['define'](_0x040a('0xa'),attributes,{'tableName':_0x040a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb82e=['path','./intDeskAccount.attributes','../../components/integrations/configuration','define','int_desk_accounts','lodash','util','../../config/logger','request-promise'];(function(_0x21f842,_0x3755e2){var _0x401fc1=function(_0x59330f){while(--_0x59330f){_0x21f842['push'](_0x21f842['shift']());}};_0x401fc1(++_0x3755e2);}(_0xb82e,0x7a));var _0xeb82=function(_0x4a0d58,_0x12cc1b){_0x4a0d58=_0x4a0d58-0x0;var _0x99327d=_0xb82e[_0x4a0d58];return _0x99327d;};'use strict';var _=require(_0xeb82('0x0'));var util=require(_0xeb82('0x1'));var logger=require(_0xeb82('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xeb82('0x3'));var fs=require('fs');var path=require(_0xeb82('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xeb82('0x5'));var integrations=require(_0xeb82('0x6'));module['exports']=function(_0xa276a9,_0x2a3ca1){return _0xa276a9[_0xeb82('0x7')]('DeskAccount',attributes,{'tableName':_0xeb82('0x8'),'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 8690d99..852f491 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 _0xc3f7=['where','attributes','limit','include','map','model','catch','ShowDeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetDeskAccount','findAll','options','raw'];(function(_0x28c5a9,_0x5b5919){var _0x391a64=function(_0x82ebb2){while(--_0x82ebb2){_0x28c5a9['push'](_0x28c5a9['shift']());}};_0x391a64(++_0x5b5919);}(_0xc3f7,0x1a0));var _0x7c3f=function(_0x4688f3,_0x1d5a1a){_0x4688f3=_0x4688f3-0x0;var _0x470c84=_0xc3f7[_0x4688f3];return _0x470c84;};'use strict';var _=require(_0x7c3f('0x0'));var util=require(_0x7c3f('0x1'));var moment=require(_0x7c3f('0x2'));var BPromise=require(_0x7c3f('0x3'));var rs=require(_0x7c3f('0x4'));var fs=require('fs');var Redis=require(_0x7c3f('0x5'));var db=require(_0x7c3f('0x6'))['db'];var utils=require(_0x7c3f('0x7'));var logger=require('../../config/logger')(_0x7c3f('0x8'));var config=require(_0x7c3f('0x9'));var jayson=require(_0x7c3f('0xa'));var client=jayson[_0x7c3f('0xb')][_0x7c3f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4a3bc5,_0x13569d,_0x2a554a){return new BPromise(function(_0x377e17,_0x1d4d9c){return client[_0x7c3f('0xd')](_0x4a3bc5,_0x2a554a)[_0x7c3f('0xe')](function(_0x1db224){logger[_0x7c3f('0xf')](_0x7c3f('0x10'),_0x13569d,_0x7c3f('0x11'));logger[_0x7c3f('0x12')](_0x7c3f('0x13'),_0x13569d,'request\x20sent',JSON[_0x7c3f('0x14')](_0x1db224));if(_0x1db224['error']){if(_0x1db224[_0x7c3f('0x15')]['code']===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x13569d,_0x1db224['error'][_0x7c3f('0x16')]);return _0x1d4d9c(_0x1db224[_0x7c3f('0x15')][_0x7c3f('0x16')]);}logger['error'](_0x7c3f('0x10'),_0x13569d,_0x1db224['error'][_0x7c3f('0x16')]);return _0x377e17(_0x1db224['error'][_0x7c3f('0x16')]);}else{logger['info'](_0x7c3f('0x10'),_0x13569d,_0x7c3f('0x11'));_0x377e17(_0x1db224[_0x7c3f('0x17')][_0x7c3f('0x16')]);}})['catch'](function(_0x5f3eea){logger[_0x7c3f('0x15')](_0x7c3f('0x10'),_0x13569d,_0x5f3eea);_0x1d4d9c(_0x5f3eea);});});}exports[_0x7c3f('0x18')]=function(_0x2487d7){var _0x41454c=this;return new Promise(function(_0xdbe67c,_0x14f332){return db['DeskAccount'][_0x7c3f('0x19')]({'raw':_0x2487d7[_0x7c3f('0x1a')]?_0x2487d7[_0x7c3f('0x1a')][_0x7c3f('0x1b')]===undefined?!![]:![]:!![],'where':_0x2487d7[_0x7c3f('0x1a')]?_0x2487d7[_0x7c3f('0x1a')][_0x7c3f('0x1c')]||null:null,'attributes':_0x2487d7[_0x7c3f('0x1a')]?_0x2487d7[_0x7c3f('0x1a')][_0x7c3f('0x1d')]||null:null,'limit':_0x2487d7[_0x7c3f('0x1a')]?_0x2487d7[_0x7c3f('0x1a')][_0x7c3f('0x1e')]||null:null,'include':_0x2487d7[_0x7c3f('0x1a')]?_0x2487d7[_0x7c3f('0x1a')][_0x7c3f('0x1f')]?_[_0x7c3f('0x20')](_0x2487d7[_0x7c3f('0x1a')]['include'],function(_0x1a91e7){return{'model':db[_0x1a91e7[_0x7c3f('0x21')]],'as':_0x1a91e7['as'],'attributes':_0x1a91e7[_0x7c3f('0x1d')],'include':_0x1a91e7[_0x7c3f('0x1f')]?_[_0x7c3f('0x20')](_0x1a91e7[_0x7c3f('0x1f')],function(_0x3b387d){return{'model':db[_0x3b387d[_0x7c3f('0x21')]],'as':_0x3b387d['as'],'attributes':_0x3b387d['attributes'],'include':_0x3b387d['include']?_['map'](_0x3b387d[_0x7c3f('0x1f')],function(_0x3d0deb){return{'model':db[_0x3d0deb[_0x7c3f('0x21')]],'as':_0x3d0deb['as'],'attributes':_0x3d0deb['attributes']};}):[]};}):[]};}):[]:[]})[_0x7c3f('0xe')](function(_0x462ab5){logger[_0x7c3f('0xf')](_0x7c3f('0x18'),_0x2487d7);logger[_0x7c3f('0x12')]('GetDeskAccount',_0x2487d7,JSON[_0x7c3f('0x14')](_0x462ab5));_0xdbe67c(_0x462ab5);})[_0x7c3f('0x22')](function(_0xa364df){logger['error'](_0x7c3f('0x18'),_0xa364df[_0x7c3f('0x16')],_0x2487d7);_0x14f332(_0x41454c[_0x7c3f('0x15')](0x1f4,_0xa364df[_0x7c3f('0x16')]));});});};exports[_0x7c3f('0x23')]=function(_0x2da78b){var _0x1202d1=this;return new Promise(function(_0x432903,_0x11cfb7){return db['DeskAccount'][_0x7c3f('0x24')]({'raw':_0x2da78b['options']?_0x2da78b[_0x7c3f('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2da78b[_0x7c3f('0x1a')]?_0x2da78b[_0x7c3f('0x1a')][_0x7c3f('0x1c')]||null:null,'attributes':_0x2da78b['options']?_0x2da78b[_0x7c3f('0x1a')]['attributes']||null:null,'include':_0x2da78b[_0x7c3f('0x1a')]?_0x2da78b['options'][_0x7c3f('0x1f')]?_[_0x7c3f('0x20')](_0x2da78b['options'][_0x7c3f('0x1f')],function(_0x545f5f){return{'model':db[_0x545f5f[_0x7c3f('0x21')]],'as':_0x545f5f['as'],'attributes':_0x545f5f[_0x7c3f('0x1d')],'include':_0x545f5f[_0x7c3f('0x1f')]?_[_0x7c3f('0x20')](_0x545f5f[_0x7c3f('0x1f')],function(_0x5149e4){return{'model':db[_0x5149e4[_0x7c3f('0x21')]],'as':_0x5149e4['as'],'attributes':_0x5149e4[_0x7c3f('0x1d')],'include':_0x5149e4[_0x7c3f('0x1f')]?_[_0x7c3f('0x20')](_0x5149e4['include'],function(_0x107fea){return{'model':db[_0x107fea['model']],'as':_0x107fea['as'],'attributes':_0x107fea['attributes']};}):[]};}):[]};}):[]:[]})[_0x7c3f('0xe')](function(_0x38c48a){logger['info'](_0x7c3f('0x23'),_0x2da78b);logger[_0x7c3f('0x12')](_0x7c3f('0x23'),_0x2da78b,JSON[_0x7c3f('0x14')](_0x38c48a));_0x432903(_0x38c48a);})['catch'](function(_0x4c2994){logger['error'](_0x7c3f('0x23'),_0x4c2994[_0x7c3f('0x16')],_0x2da78b);_0x11cfb7(_0x1202d1[_0x7c3f('0x15')](0x1f4,_0x4c2994[_0x7c3f('0x16')]));});});}; \ No newline at end of file +var _0xfb05=['info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','DeskAccount','findAll','options','raw','attributes','limit','include','map','model','GetDeskAccount','find','where','ShowDeskAccount','lodash','util','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0x537a91,_0x298194){var _0x590daa=function(_0x31a571){while(--_0x31a571){_0x537a91['push'](_0x537a91['shift']());}};_0x590daa(++_0x298194);}(_0xfb05,0x1b7));var _0x5fb0=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xfb05[_0x1deb03];return _0x189fe7;};'use strict';var _=require(_0x5fb0('0x0'));var util=require(_0x5fb0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5fb0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5fb0('0x3'));var logger=require(_0x5fb0('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5fb0('0x5'));var client=jayson[_0x5fb0('0x6')][_0x5fb0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x110623,_0x5dc7b8,_0x657b80){return new BPromise(function(_0x43670c,_0x2d6758){return client[_0x5fb0('0x8')](_0x110623,_0x657b80)['then'](function(_0x57e6f8){logger[_0x5fb0('0x9')](_0x5fb0('0xa'),_0x5dc7b8,_0x5fb0('0xb'));logger[_0x5fb0('0xc')](_0x5fb0('0xd'),_0x5dc7b8,_0x5fb0('0xb'),JSON[_0x5fb0('0xe')](_0x57e6f8));if(_0x57e6f8[_0x5fb0('0xf')]){if(_0x57e6f8[_0x5fb0('0xf')][_0x5fb0('0x10')]===0x1f4){logger[_0x5fb0('0xf')]('DeskAccount,\x20%s,\x20%s',_0x5dc7b8,_0x57e6f8[_0x5fb0('0xf')][_0x5fb0('0x11')]);return _0x2d6758(_0x57e6f8[_0x5fb0('0xf')]['message']);}logger[_0x5fb0('0xf')](_0x5fb0('0xa'),_0x5dc7b8,_0x57e6f8['error'][_0x5fb0('0x11')]);return _0x43670c(_0x57e6f8['error'][_0x5fb0('0x11')]);}else{logger[_0x5fb0('0x9')](_0x5fb0('0xa'),_0x5dc7b8,_0x5fb0('0xb'));_0x43670c(_0x57e6f8['result']['message']);}})[_0x5fb0('0x12')](function(_0x4f4c33){logger[_0x5fb0('0xf')](_0x5fb0('0xa'),_0x5dc7b8,_0x4f4c33);_0x2d6758(_0x4f4c33);});});}exports['GetDeskAccount']=function(_0x32e117){var _0x45c6cc=this;return new Promise(function(_0x5bd4de,_0x2e1fb5){return db[_0x5fb0('0x13')][_0x5fb0('0x14')]({'raw':_0x32e117[_0x5fb0('0x15')]?_0x32e117[_0x5fb0('0x15')][_0x5fb0('0x16')]===undefined?!![]:![]:!![],'where':_0x32e117[_0x5fb0('0x15')]?_0x32e117[_0x5fb0('0x15')]['where']||null:null,'attributes':_0x32e117[_0x5fb0('0x15')]?_0x32e117[_0x5fb0('0x15')][_0x5fb0('0x17')]||null:null,'limit':_0x32e117[_0x5fb0('0x15')]?_0x32e117[_0x5fb0('0x15')][_0x5fb0('0x18')]||null:null,'include':_0x32e117[_0x5fb0('0x15')]?_0x32e117[_0x5fb0('0x15')][_0x5fb0('0x19')]?_[_0x5fb0('0x1a')](_0x32e117[_0x5fb0('0x15')][_0x5fb0('0x19')],function(_0x317aa6){return{'model':db[_0x317aa6['model']],'as':_0x317aa6['as'],'attributes':_0x317aa6[_0x5fb0('0x17')],'include':_0x317aa6[_0x5fb0('0x19')]?_[_0x5fb0('0x1a')](_0x317aa6[_0x5fb0('0x19')],function(_0x928706){return{'model':db[_0x928706[_0x5fb0('0x1b')]],'as':_0x928706['as'],'attributes':_0x928706[_0x5fb0('0x17')],'include':_0x928706['include']?_[_0x5fb0('0x1a')](_0x928706[_0x5fb0('0x19')],function(_0x3386f2){return{'model':db[_0x3386f2[_0x5fb0('0x1b')]],'as':_0x3386f2['as'],'attributes':_0x3386f2[_0x5fb0('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x486870){logger['info']('GetDeskAccount',_0x32e117);logger[_0x5fb0('0xc')]('GetDeskAccount',_0x32e117,JSON['stringify'](_0x486870));_0x5bd4de(_0x486870);})['catch'](function(_0x4d3f09){logger[_0x5fb0('0xf')](_0x5fb0('0x1c'),_0x4d3f09['message'],_0x32e117);_0x2e1fb5(_0x45c6cc['error'](0x1f4,_0x4d3f09[_0x5fb0('0x11')]));});});};exports['ShowDeskAccount']=function(_0x3380ca){var _0x175e81=this;return new Promise(function(_0x351b5c,_0x28bf15){return db['DeskAccount'][_0x5fb0('0x1d')]({'raw':_0x3380ca[_0x5fb0('0x15')]?_0x3380ca['options'][_0x5fb0('0x16')]===undefined?!![]:![]:!![],'where':_0x3380ca[_0x5fb0('0x15')]?_0x3380ca['options'][_0x5fb0('0x1e')]||null:null,'attributes':_0x3380ca[_0x5fb0('0x15')]?_0x3380ca[_0x5fb0('0x15')]['attributes']||null:null,'include':_0x3380ca[_0x5fb0('0x15')]?_0x3380ca[_0x5fb0('0x15')][_0x5fb0('0x19')]?_[_0x5fb0('0x1a')](_0x3380ca[_0x5fb0('0x15')][_0x5fb0('0x19')],function(_0x519215){return{'model':db[_0x519215['model']],'as':_0x519215['as'],'attributes':_0x519215[_0x5fb0('0x17')],'include':_0x519215[_0x5fb0('0x19')]?_[_0x5fb0('0x1a')](_0x519215[_0x5fb0('0x19')],function(_0x4a9b8a){return{'model':db[_0x4a9b8a['model']],'as':_0x4a9b8a['as'],'attributes':_0x4a9b8a[_0x5fb0('0x17')],'include':_0x4a9b8a[_0x5fb0('0x19')]?_[_0x5fb0('0x1a')](_0x4a9b8a[_0x5fb0('0x19')],function(_0x2325c5){return{'model':db[_0x2325c5['model']],'as':_0x2325c5['as'],'attributes':_0x2325c5[_0x5fb0('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ce6f1){logger['info'](_0x5fb0('0x1f'),_0x3380ca);logger[_0x5fb0('0xc')](_0x5fb0('0x1f'),_0x3380ca,JSON[_0x5fb0('0xe')](_0x2ce6f1));_0x351b5c(_0x2ce6f1);})['catch'](function(_0x1e9a5a){logger[_0x5fb0('0xf')](_0x5fb0('0x1f'),_0x1e9a5a[_0x5fb0('0x11')],_0x3380ca);_0x28bf15(_0x175e81[_0x5fb0('0xf')](0x1f4,_0x1e9a5a[_0x5fb0('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index bd051be..1cd7a6d 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(_0x248be0,_0x189220){var _0x2cafb0=function(_0x4a3e98){while(--_0x4a3e98){_0x248be0['push'](_0x248be0['shift']());}};_0x2cafb0(++_0x189220);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'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(_0x4990d5,_0xe2c486){var _0x275e25=function(_0x4de73e){while(--_0x4de73e){_0x4990d5['push'](_0x4990d5['shift']());}};_0x275e25(++_0xe2c486);}(_0x55ca,0x126));var _0xa55c=function(_0x186222,_0x3bdfb0){_0x186222=_0x186222-0x0;var _0x226a38=_0x55ca[_0x186222];return _0x226a38;};'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 7e9ce0c..458f81f 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 _0x447b=['sequelize','STRING'];(function(_0x14f896,_0x212ab7){var _0xac9258=function(_0x41c69c){while(--_0x41c69c){_0x14f896['push'](_0x14f896['shift']());}};_0xac9258(++_0x212ab7);}(_0x447b,0x68));var _0xb447=function(_0x7a9beb,_0x4fc7a4){_0x7a9beb=_0x7a9beb-0x0;var _0x43533e=_0x447b[_0x7a9beb];return _0x43533e;};'use strict';var Sequelize=require(_0xb447('0x0'));module['exports']={'name':{'type':Sequelize[_0xb447('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3878=['sequelize','STRING'];(function(_0xff3357,_0x3b4152){var _0x16d529=function(_0x38d7f7){while(--_0x38d7f7){_0xff3357['push'](_0xff3357['shift']());}};_0x16d529(++_0x3b4152);}(_0x3878,0x12c));var _0x8387=function(_0x1850ba,_0x55e013){_0x1850ba=_0x1850ba-0x0;var _0x2045e8=_0x3878[_0x1850ba];return _0x2045e8;};'use strict';var Sequelize=require(_0x8387('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8387('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index e96c799..06643d5 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 _0x7f16=['DeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','catch','show','params','create','body','find','getFields','DeskField','pick','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index'];(function(_0x5972ff,_0x223644){var _0x585095=function(_0x3f12e0){while(--_0x3f12e0){_0x5972ff['push'](_0x5972ff['shift']());}};_0x585095(++_0x223644);}(_0x7f16,0xcf));var _0x67f1=function(_0x4368c4,_0x2b8702){_0x4368c4=_0x4368c4-0x0;var _0x1e6c6f=_0x7f16[_0x4368c4];return _0x1e6c6f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x67f1('0x0'));var zipdir=require(_0x67f1('0x1'));var jsonpatch=require(_0x67f1('0x2'));var rp=require('request-promise');var moment=require(_0x67f1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x67f1('0x4'));var util=require(_0x67f1('0x5'));var path=require(_0x67f1('0x6'));var sox=require(_0x67f1('0x7'));var csv=require(_0x67f1('0x8'));var ejs=require(_0x67f1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x67f1('0xa'));var crypto=require(_0x67f1('0xb'));var jsforce=require(_0x67f1('0xc'));var deskjs=require(_0x67f1('0xd'));var toCsv=require(_0x67f1('0x8'));var querystring=require('querystring');var Papa=require(_0x67f1('0xe'));var Redis=require(_0x67f1('0xf'));var authService=require(_0x67f1('0x10'));var qs=require(_0x67f1('0x11'));var as=require(_0x67f1('0x12'));var hardwareService=require(_0x67f1('0x13'));var logger=require(_0x67f1('0x14'))(_0x67f1('0x15'));var utils=require(_0x67f1('0x16'));var config=require(_0x67f1('0x17'));var licenseUtil=require(_0x67f1('0x18'));var db=require(_0x67f1('0x19'))['db'];function respondWithStatusCode(_0x3a18e9,_0x2239d3){_0x2239d3=_0x2239d3||0xcc;return function(_0x18f702){if(_0x18f702){return _0x3a18e9[_0x67f1('0x1a')](_0x2239d3);}return _0x3a18e9[_0x67f1('0x1b')](_0x2239d3)[_0x67f1('0x1c')]();};}function respondWithResult(_0x4a2d1c,_0x2fe022){_0x2fe022=_0x2fe022||0xc8;return function(_0x17d9f4){if(_0x17d9f4){return _0x4a2d1c[_0x67f1('0x1b')](_0x2fe022)[_0x67f1('0x1d')](_0x17d9f4);}};}function respondWithFilteredResult(_0x1bb206,_0x234ecb){return function(_0x6dd76b){if(_0x6dd76b){var _0x1ec0da=typeof _0x234ecb[_0x67f1('0x1e')]===_0x67f1('0x1f')&&typeof _0x234ecb[_0x67f1('0x20')]===_0x67f1('0x1f');var _0x39aa8d=_0x6dd76b[_0x67f1('0x21')];var _0x1e7b43=_0x1ec0da?0x0:_0x234ecb[_0x67f1('0x1e')];var _0xe82668=_0x1ec0da?_0x6dd76b[_0x67f1('0x21')]:_0x234ecb['offset']+_0x234ecb[_0x67f1('0x20')];var _0xf35dd9;if(_0xe82668>=_0x39aa8d){_0xe82668=_0x39aa8d;_0xf35dd9=0xc8;}else{_0xf35dd9=0xce;}_0x1bb206[_0x67f1('0x1b')](_0xf35dd9);return _0x1bb206[_0x67f1('0x22')](_0x67f1('0x23'),_0x1e7b43+'-'+_0xe82668+'/'+_0x39aa8d)[_0x67f1('0x1d')](_0x6dd76b);}return null;};}function patchUpdates(_0x437f14){return function(_0x2bacb6){try{jsonpatch[_0x67f1('0x24')](_0x2bacb6,_0x437f14,!![]);}catch(_0x44e4d5){return BPromise[_0x67f1('0x25')](_0x44e4d5);}return _0x2bacb6['save']();};}function saveUpdates(_0xa440e2,_0x152330){return function(_0x3ac83b){if(_0x3ac83b){return _0x3ac83b[_0x67f1('0x26')](_0xa440e2)[_0x67f1('0x27')](function(_0x9f039e){return _0x9f039e;});}return null;};}function removeEntity(_0x1d847d,_0x3f45ea){return function(_0x5aa13a){if(_0x5aa13a){return _0x5aa13a[_0x67f1('0x28')]()[_0x67f1('0x27')](function(){_0x1d847d['status'](0xcc)[_0x67f1('0x1c')]();});}};}function handleEntityNotFound(_0x293cc6,_0x12792e){return function(_0x1280e5){if(!_0x1280e5){_0x293cc6[_0x67f1('0x1a')](0x194);}return _0x1280e5;};}function handleError(_0x4cbd36,_0x26e6a8){_0x26e6a8=_0x26e6a8||0x1f4;return function(_0x58fbd2){logger['error'](_0x58fbd2[_0x67f1('0x29')]);if(_0x58fbd2[_0x67f1('0x2a')]){delete _0x58fbd2['name'];}_0x4cbd36[_0x67f1('0x1b')](_0x26e6a8)[_0x67f1('0x2b')](_0x58fbd2);};}exports[_0x67f1('0x2c')]=function(_0x51dc7c,_0x1d3289){var _0x173d38={},_0x5a6532={},_0x4e0d48={'count':0x0,'rows':[]};var _0x162ef0=_['map'](db[_0x67f1('0x2d')][_0x67f1('0x2e')],function(_0x4a724a){return{'name':_0x4a724a[_0x67f1('0x2f')],'type':_0x4a724a[_0x67f1('0x30')][_0x67f1('0x31')]};});_0x5a6532[_0x67f1('0x32')]=_[_0x67f1('0x33')](_0x162ef0,_0x67f1('0x2a'));_0x5a6532[_0x67f1('0x34')]=_[_0x67f1('0x35')](_0x51dc7c['query']);_0x5a6532[_0x67f1('0x36')]=_[_0x67f1('0x37')](_0x5a6532[_0x67f1('0x32')],_0x5a6532['query']);_0x173d38['attributes']=_[_0x67f1('0x37')](_0x5a6532[_0x67f1('0x32')],qs[_0x67f1('0x38')](_0x51dc7c[_0x67f1('0x34')]['fields']));_0x173d38['attributes']=_0x173d38[_0x67f1('0x39')][_0x67f1('0x3a')]?_0x173d38[_0x67f1('0x39')]:_0x5a6532[_0x67f1('0x32')];if(!_0x51dc7c[_0x67f1('0x34')][_0x67f1('0x3b')](_0x67f1('0x3c'))){_0x173d38['limit']=qs[_0x67f1('0x20')](_0x51dc7c[_0x67f1('0x34')][_0x67f1('0x20')]);_0x173d38['offset']=qs[_0x67f1('0x1e')](_0x51dc7c[_0x67f1('0x34')][_0x67f1('0x1e')]);}_0x173d38[_0x67f1('0x3d')]=qs[_0x67f1('0x3e')](_0x51dc7c[_0x67f1('0x34')][_0x67f1('0x3e')]);_0x173d38[_0x67f1('0x3f')]=qs[_0x67f1('0x36')](_['pick'](_0x51dc7c[_0x67f1('0x34')],_0x5a6532[_0x67f1('0x36')]),_0x162ef0);if(_0x51dc7c[_0x67f1('0x34')]['filter']){_0x173d38[_0x67f1('0x3f')]=_[_0x67f1('0x40')](_0x173d38['where'],{'$or':_['map'](_0x162ef0,function(_0x65f3cc){if(_0x65f3cc['type']!==_0x67f1('0x41')){var _0x1deae8={};_0x1deae8[_0x65f3cc[_0x67f1('0x2a')]]={'$like':'%'+_0x51dc7c['query'][_0x67f1('0x42')]+'%'};return _0x1deae8;}})});}_0x173d38=_[_0x67f1('0x40')]({},_0x173d38,_0x51dc7c[_0x67f1('0x43')]);var _0x218f10={'where':_0x173d38['where']};return db[_0x67f1('0x2d')][_0x67f1('0x21')](_0x218f10)[_0x67f1('0x27')](function(_0x1eef5c){_0x4e0d48[_0x67f1('0x21')]=_0x1eef5c;if(_0x51dc7c[_0x67f1('0x34')][_0x67f1('0x44')]){_0x173d38['include']=[{'all':!![]}];}return db[_0x67f1('0x2d')]['findAll'](_0x173d38);})['then'](function(_0x4926e2){_0x4e0d48['rows']=_0x4926e2;return _0x4e0d48;})['then'](respondWithFilteredResult(_0x1d3289,_0x173d38))[_0x67f1('0x45')](handleError(_0x1d3289,null));};exports[_0x67f1('0x46')]=function(_0x1b0981,_0x1d60d7){var _0x426753={'raw':![],'where':{'id':_0x1b0981[_0x67f1('0x47')]['id']}},_0x3fa2af={};_0x3fa2af[_0x67f1('0x32')]=_[_0x67f1('0x35')](db[_0x67f1('0x2d')][_0x67f1('0x2e')]);_0x3fa2af['query']=_[_0x67f1('0x35')](_0x1b0981[_0x67f1('0x34')]);_0x3fa2af[_0x67f1('0x36')]=_[_0x67f1('0x37')](_0x3fa2af[_0x67f1('0x32')],_0x3fa2af[_0x67f1('0x34')]);_0x426753[_0x67f1('0x39')]=_['intersection'](_0x3fa2af['model'],qs[_0x67f1('0x38')](_0x1b0981['query'][_0x67f1('0x38')]));_0x426753[_0x67f1('0x39')]=_0x426753[_0x67f1('0x39')][_0x67f1('0x3a')]?_0x426753[_0x67f1('0x39')]:_0x3fa2af[_0x67f1('0x32')];if(_0x1b0981[_0x67f1('0x34')][_0x67f1('0x44')]){_0x426753['include']=[{'all':!![]}];}_0x426753=_['merge']({},_0x426753,_0x1b0981['options']);return db[_0x67f1('0x2d')]['find'](_0x426753)[_0x67f1('0x27')](handleEntityNotFound(_0x1d60d7,null))[_0x67f1('0x27')](respondWithResult(_0x1d60d7,null))[_0x67f1('0x45')](handleError(_0x1d60d7,null));};exports[_0x67f1('0x48')]=function(_0x4b204a,_0x51e36a){return db['DeskConfiguration'][_0x67f1('0x48')](_0x4b204a['body'],{})['then'](respondWithResult(_0x51e36a,0xc9))[_0x67f1('0x45')](handleError(_0x51e36a,null));};exports[_0x67f1('0x26')]=function(_0x437da3,_0x128015){if(_0x437da3['body']['id']){delete _0x437da3['body']['id'];}return db[_0x67f1('0x2d')]['find']({'where':{'id':_0x437da3[_0x67f1('0x47')]['id']}})[_0x67f1('0x27')](handleEntityNotFound(_0x128015,null))[_0x67f1('0x27')](saveUpdates(_0x437da3[_0x67f1('0x49')],null))[_0x67f1('0x27')](respondWithResult(_0x128015,null))[_0x67f1('0x45')](handleError(_0x128015,null));};exports[_0x67f1('0x28')]=function(_0x1ab721,_0x2a0c5c){return db[_0x67f1('0x2d')][_0x67f1('0x4a')]({'where':{'id':_0x1ab721['params']['id']}})[_0x67f1('0x27')](handleEntityNotFound(_0x2a0c5c,null))[_0x67f1('0x27')](removeEntity(_0x2a0c5c,null))['catch'](handleError(_0x2a0c5c,null));};exports[_0x67f1('0x4b')]=function(_0xc21251,_0x523f0c,_0x3578f6){var _0x3d2ca8={};var _0x3451f7={};var _0x3a0a03;var _0x4a1aa2;return db[_0x67f1('0x2d')]['findOne']({'where':{'id':_0xc21251[_0x67f1('0x47')]['id']}})['then'](handleEntityNotFound(_0x523f0c,null))['then'](function(_0x5d0be2){if(_0x5d0be2){_0x3a0a03=_0x5d0be2;_0x3451f7['model']=_[_0x67f1('0x35')](db[_0x67f1('0x4c')][_0x67f1('0x2e')]);_0x3451f7[_0x67f1('0x34')]=_[_0x67f1('0x35')](_0xc21251[_0x67f1('0x34')]);_0x3451f7[_0x67f1('0x36')]=_[_0x67f1('0x37')](_0x3451f7[_0x67f1('0x32')],_0x3451f7[_0x67f1('0x34')]);_0x3d2ca8[_0x67f1('0x39')]=_[_0x67f1('0x37')](_0x3451f7[_0x67f1('0x32')],qs['fields'](_0xc21251[_0x67f1('0x34')][_0x67f1('0x38')]));_0x3d2ca8[_0x67f1('0x39')]=_0x3d2ca8[_0x67f1('0x39')][_0x67f1('0x3a')]?_0x3d2ca8[_0x67f1('0x39')]:_0x3451f7[_0x67f1('0x32')];_0x3d2ca8['order']=qs['sort'](_0xc21251[_0x67f1('0x34')]['sort']);_0x3d2ca8[_0x67f1('0x3f')]=qs[_0x67f1('0x36')](_[_0x67f1('0x4d')](_0xc21251[_0x67f1('0x34')],_0x3451f7['filters']));if(_0xc21251[_0x67f1('0x34')][_0x67f1('0x42')]){_0x3d2ca8[_0x67f1('0x3f')]=_[_0x67f1('0x40')](_0x3d2ca8['where'],{'$or':_[_0x67f1('0x33')](_0x3d2ca8[_0x67f1('0x39')],function(_0x42e07e){var _0x458aa8={};_0x458aa8[_0x42e07e]={'$like':'%'+_0xc21251[_0x67f1('0x34')]['filter']+'%'};return _0x458aa8;})});}_0x3d2ca8=_[_0x67f1('0x40')]({},_0x3d2ca8,_0xc21251[_0x67f1('0x43')]);return _0x3a0a03[_0x67f1('0x4b')](_0x3d2ca8);}})[_0x67f1('0x27')](function(_0x2806db){if(_0x2806db){_0x4a1aa2=_0x2806db['length'];if(!_0xc21251[_0x67f1('0x34')][_0x67f1('0x3b')]('nolimit')){_0x3d2ca8[_0x67f1('0x20')]=qs['limit'](_0xc21251[_0x67f1('0x34')][_0x67f1('0x20')]);_0x3d2ca8[_0x67f1('0x1e')]=qs['offset'](_0xc21251['query'][_0x67f1('0x1e')]);}return _0x3a0a03[_0x67f1('0x4b')](_0x3d2ca8);}})[_0x67f1('0x27')](function(_0x30146d){if(_0x30146d){return _0x30146d?{'count':_0x4a1aa2,'rows':_0x30146d}:null;}})['then'](respondWithResult(_0x523f0c,null))[_0x67f1('0x45')](handleError(_0x523f0c,null));};exports[_0x67f1('0x4e')]=function(_0x1bfcd3,_0x346fc3,_0x28166c){var _0x4141b9={};var _0x28e11={};var _0x3b93ff;var _0x4b3cfc;return db['DeskConfiguration']['findOne']({'where':{'id':_0x1bfcd3[_0x67f1('0x47')]['id']}})[_0x67f1('0x27')](handleEntityNotFound(_0x346fc3,null))['then'](function(_0x2a05e0){if(_0x2a05e0){_0x3b93ff=_0x2a05e0;_0x28e11[_0x67f1('0x32')]=_[_0x67f1('0x35')](db[_0x67f1('0x4c')]['rawAttributes']);_0x28e11['query']=_[_0x67f1('0x35')](_0x1bfcd3['query']);_0x28e11[_0x67f1('0x36')]=_['intersection'](_0x28e11[_0x67f1('0x32')],_0x28e11[_0x67f1('0x34')]);_0x4141b9[_0x67f1('0x39')]=_[_0x67f1('0x37')](_0x28e11[_0x67f1('0x32')],qs[_0x67f1('0x38')](_0x1bfcd3['query'][_0x67f1('0x38')]));_0x4141b9['attributes']=_0x4141b9[_0x67f1('0x39')]['length']?_0x4141b9[_0x67f1('0x39')]:_0x28e11[_0x67f1('0x32')];_0x4141b9[_0x67f1('0x3d')]=qs[_0x67f1('0x3e')](_0x1bfcd3['query']['sort']);_0x4141b9[_0x67f1('0x3f')]=qs[_0x67f1('0x36')](_['pick'](_0x1bfcd3[_0x67f1('0x34')],_0x28e11['filters']));if(_0x1bfcd3[_0x67f1('0x34')]['filter']){_0x4141b9['where']=_['merge'](_0x4141b9[_0x67f1('0x3f')],{'$or':_['map'](_0x4141b9[_0x67f1('0x39')],function(_0x545ed7){var _0x1d796f={};_0x1d796f[_0x545ed7]={'$like':'%'+_0x1bfcd3[_0x67f1('0x34')]['filter']+'%'};return _0x1d796f;})});}_0x4141b9=_[_0x67f1('0x40')]({},_0x4141b9,_0x1bfcd3[_0x67f1('0x43')]);return _0x3b93ff[_0x67f1('0x4e')](_0x4141b9);}})[_0x67f1('0x27')](function(_0x465199){if(_0x465199){_0x4b3cfc=_0x465199[_0x67f1('0x3a')];if(!_0x1bfcd3['query']['hasOwnProperty'](_0x67f1('0x3c'))){_0x4141b9[_0x67f1('0x20')]=qs[_0x67f1('0x20')](_0x1bfcd3[_0x67f1('0x34')][_0x67f1('0x20')]);_0x4141b9[_0x67f1('0x1e')]=qs[_0x67f1('0x1e')](_0x1bfcd3[_0x67f1('0x34')][_0x67f1('0x1e')]);}return _0x3b93ff[_0x67f1('0x4e')](_0x4141b9);}})[_0x67f1('0x27')](function(_0x45c112){if(_0x45c112){return _0x45c112?{'count':_0x4b3cfc,'rows':_0x45c112}:null;}})[_0x67f1('0x27')](respondWithResult(_0x346fc3,null))['catch'](handleError(_0x346fc3,null));};exports['getDescriptions']=function(_0x2bd5ed,_0x59615b,_0x10b226){var _0x14f8a9={};var _0x1bc8a2={};var _0x31b26c;var _0x491af8;return db[_0x67f1('0x2d')][_0x67f1('0x4f')]({'where':{'id':_0x2bd5ed['params']['id']}})['then'](handleEntityNotFound(_0x59615b,null))[_0x67f1('0x27')](function(_0x3bac3f){if(_0x3bac3f){_0x31b26c=_0x3bac3f;_0x1bc8a2['model']=_[_0x67f1('0x35')](db[_0x67f1('0x4c')][_0x67f1('0x2e')]);_0x1bc8a2['query']=_[_0x67f1('0x35')](_0x2bd5ed[_0x67f1('0x34')]);_0x1bc8a2[_0x67f1('0x36')]=_[_0x67f1('0x37')](_0x1bc8a2['model'],_0x1bc8a2[_0x67f1('0x34')]);_0x14f8a9['attributes']=_[_0x67f1('0x37')](_0x1bc8a2[_0x67f1('0x32')],qs[_0x67f1('0x38')](_0x2bd5ed['query'][_0x67f1('0x38')]));_0x14f8a9['attributes']=_0x14f8a9[_0x67f1('0x39')]['length']?_0x14f8a9[_0x67f1('0x39')]:_0x1bc8a2[_0x67f1('0x32')];_0x14f8a9[_0x67f1('0x3d')]=qs[_0x67f1('0x3e')](_0x2bd5ed[_0x67f1('0x34')][_0x67f1('0x3e')]);_0x14f8a9['where']=qs[_0x67f1('0x36')](_[_0x67f1('0x4d')](_0x2bd5ed[_0x67f1('0x34')],_0x1bc8a2['filters']));if(_0x2bd5ed[_0x67f1('0x34')]['filter']){_0x14f8a9['where']=_[_0x67f1('0x40')](_0x14f8a9[_0x67f1('0x3f')],{'$or':_[_0x67f1('0x33')](_0x14f8a9['attributes'],function(_0xfbc57d){var _0x1de71e={};_0x1de71e[_0xfbc57d]={'$like':'%'+_0x2bd5ed[_0x67f1('0x34')][_0x67f1('0x42')]+'%'};return _0x1de71e;})});}_0x14f8a9=_['merge']({},_0x14f8a9,_0x2bd5ed[_0x67f1('0x43')]);return _0x31b26c['getDescriptions'](_0x14f8a9);}})[_0x67f1('0x27')](function(_0x79f669){if(_0x79f669){_0x491af8=_0x79f669[_0x67f1('0x3a')];if(!_0x2bd5ed[_0x67f1('0x34')][_0x67f1('0x3b')](_0x67f1('0x3c'))){_0x14f8a9['limit']=qs['limit'](_0x2bd5ed['query'][_0x67f1('0x20')]);_0x14f8a9[_0x67f1('0x1e')]=qs[_0x67f1('0x1e')](_0x2bd5ed[_0x67f1('0x34')][_0x67f1('0x1e')]);}return _0x31b26c[_0x67f1('0x50')](_0x14f8a9);}})[_0x67f1('0x27')](function(_0x22a99e){if(_0x22a99e){return _0x22a99e?{'count':_0x491af8,'rows':_0x22a99e}:null;}})['then'](respondWithResult(_0x59615b,null))[_0x67f1('0x45')](handleError(_0x59615b,null));};exports[_0x67f1('0x51')]=function(_0x3bf8e7,_0x5712e6,_0x3438ce){var _0x48a8b5={};var _0x4c7bd5={};var _0x3687ee;var _0x2bce04;return db[_0x67f1('0x2d')][_0x67f1('0x4f')]({'where':{'id':_0x3bf8e7[_0x67f1('0x47')]['id']}})[_0x67f1('0x27')](handleEntityNotFound(_0x5712e6,null))[_0x67f1('0x27')](function(_0x4d5ef5){if(_0x4d5ef5){_0x3687ee=_0x4d5ef5;_0x4c7bd5[_0x67f1('0x32')]=_[_0x67f1('0x35')](db[_0x67f1('0x52')][_0x67f1('0x2e')]);_0x4c7bd5[_0x67f1('0x34')]=_[_0x67f1('0x35')](_0x3bf8e7[_0x67f1('0x34')]);_0x4c7bd5['filters']=_[_0x67f1('0x37')](_0x4c7bd5['model'],_0x4c7bd5[_0x67f1('0x34')]);_0x48a8b5[_0x67f1('0x39')]=_[_0x67f1('0x37')](_0x4c7bd5[_0x67f1('0x32')],qs[_0x67f1('0x38')](_0x3bf8e7[_0x67f1('0x34')][_0x67f1('0x38')]));_0x48a8b5[_0x67f1('0x39')]=_0x48a8b5['attributes']['length']?_0x48a8b5['attributes']:_0x4c7bd5[_0x67f1('0x32')];_0x48a8b5['order']=qs[_0x67f1('0x3e')](_0x3bf8e7['query'][_0x67f1('0x3e')]);_0x48a8b5['where']=qs[_0x67f1('0x36')](_[_0x67f1('0x4d')](_0x3bf8e7[_0x67f1('0x34')],_0x4c7bd5[_0x67f1('0x36')]));if(_0x3bf8e7['query'][_0x67f1('0x42')]){_0x48a8b5[_0x67f1('0x3f')]=_[_0x67f1('0x40')](_0x48a8b5['where'],{'$or':_[_0x67f1('0x33')](_0x48a8b5['attributes'],function(_0x8d4cf6){var _0x23cede={};_0x23cede[_0x8d4cf6]={'$like':'%'+_0x3bf8e7[_0x67f1('0x34')][_0x67f1('0x42')]+'%'};return _0x23cede;})});}_0x48a8b5=_['merge']({},_0x48a8b5,_0x3bf8e7[_0x67f1('0x43')]);return _0x3687ee[_0x67f1('0x51')](_0x48a8b5);}})[_0x67f1('0x27')](function(_0x177560){if(_0x177560){_0x2bce04=_0x177560[_0x67f1('0x3a')];if(!_0x3bf8e7[_0x67f1('0x34')][_0x67f1('0x3b')](_0x67f1('0x3c'))){_0x48a8b5[_0x67f1('0x20')]=qs['limit'](_0x3bf8e7['query'][_0x67f1('0x20')]);_0x48a8b5['offset']=qs[_0x67f1('0x1e')](_0x3bf8e7[_0x67f1('0x34')]['offset']);}return _0x3687ee['getTags'](_0x48a8b5);}})[_0x67f1('0x27')](function(_0x3fccf1){if(_0x3fccf1){return _0x3fccf1?{'count':_0x2bce04,'rows':_0x3fccf1}:null;}})[_0x67f1('0x27')](respondWithResult(_0x5712e6,null))[_0x67f1('0x45')](handleError(_0x5712e6,null));};exports[_0x67f1('0x53')]=function(_0x29411f,_0x16ca79,_0x5b3ae0){if(_0x29411f[_0x67f1('0x49')]['id']){delete _0x29411f[_0x67f1('0x49')]['id'];}return db[_0x67f1('0x2d')][_0x67f1('0x4f')]({'where':{'id':_0x29411f[_0x67f1('0x47')]['id']}})[_0x67f1('0x27')](handleEntityNotFound(_0x16ca79,null))[_0x67f1('0x27')](function(_0x900bcc){if(_0x900bcc){return _0x900bcc[_0x67f1('0x53')](_0x29411f[_0x67f1('0x49')]['ids']||[]);}return null;})[_0x67f1('0x27')](respondWithResult(_0x16ca79,null))[_0x67f1('0x45')](handleError(_0x16ca79,null));}; \ No newline at end of file +var _0x8e39=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','DeskConfiguration','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','include','findAll','rows','show','params','rawAttributes','includeAll','options','find','catch','create','body','getFields','findOne','DeskField','pick','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','fast-json-patch'];(function(_0x17ceef,_0x2851fc){var _0x51cbfe=function(_0x1d4c47){while(--_0x1d4c47){_0x17ceef['push'](_0x17ceef['shift']());}};_0x51cbfe(++_0x2851fc);}(_0x8e39,0x15d));var _0x98e3=function(_0x532c55,_0x4dab9a){_0x532c55=_0x532c55-0x0;var _0x1eefe9=_0x8e39[_0x532c55];return _0x1eefe9;};'use strict';var emlformat=require(_0x98e3('0x0'));var rimraf=require(_0x98e3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x98e3('0x2'));var rp=require(_0x98e3('0x3'));var moment=require(_0x98e3('0x4'));var BPromise=require(_0x98e3('0x5'));var Mustache=require(_0x98e3('0x6'));var util=require(_0x98e3('0x7'));var path=require(_0x98e3('0x8'));var sox=require(_0x98e3('0x9'));var csv=require(_0x98e3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x98e3('0xb'));var _=require(_0x98e3('0xc'));var squel=require(_0x98e3('0xd'));var crypto=require(_0x98e3('0xe'));var jsforce=require(_0x98e3('0xf'));var deskjs=require(_0x98e3('0x10'));var toCsv=require(_0x98e3('0xa'));var querystring=require(_0x98e3('0x11'));var Papa=require(_0x98e3('0x12'));var Redis=require(_0x98e3('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x98e3('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98e3('0x15'));var logger=require(_0x98e3('0x16'))(_0x98e3('0x17'));var utils=require(_0x98e3('0x18'));var config=require(_0x98e3('0x19'));var licenseUtil=require(_0x98e3('0x1a'));var db=require(_0x98e3('0x1b'))['db'];function respondWithStatusCode(_0x46e842,_0x33eaf9){_0x33eaf9=_0x33eaf9||0xcc;return function(_0x5570b3){if(_0x5570b3){return _0x46e842[_0x98e3('0x1c')](_0x33eaf9);}return _0x46e842[_0x98e3('0x1d')](_0x33eaf9)['end']();};}function respondWithResult(_0x2d8dcb,_0x296687){_0x296687=_0x296687||0xc8;return function(_0x1c35e7){if(_0x1c35e7){return _0x2d8dcb[_0x98e3('0x1d')](_0x296687)[_0x98e3('0x1e')](_0x1c35e7);}};}function respondWithFilteredResult(_0x3e1f8f,_0x4d8313){return function(_0x49e00e){if(_0x49e00e){var _0x167211=typeof _0x4d8313['offset']==='undefined'&&typeof _0x4d8313[_0x98e3('0x1f')]==='undefined';var _0x4b49ec=_0x49e00e[_0x98e3('0x20')];var _0x2d952d=_0x167211?0x0:_0x4d8313[_0x98e3('0x21')];var _0x40ae34=_0x167211?_0x49e00e[_0x98e3('0x20')]:_0x4d8313['offset']+_0x4d8313['limit'];var _0x24fabe;if(_0x40ae34>=_0x4b49ec){_0x40ae34=_0x4b49ec;_0x24fabe=0xc8;}else{_0x24fabe=0xce;}_0x3e1f8f[_0x98e3('0x1d')](_0x24fabe);return _0x3e1f8f[_0x98e3('0x22')](_0x98e3('0x23'),_0x2d952d+'-'+_0x40ae34+'/'+_0x4b49ec)['json'](_0x49e00e);}return null;};}function patchUpdates(_0x36ed1e){return function(_0x3479d0){try{jsonpatch[_0x98e3('0x24')](_0x3479d0,_0x36ed1e,!![]);}catch(_0x107670){return BPromise[_0x98e3('0x25')](_0x107670);}return _0x3479d0[_0x98e3('0x26')]();};}function saveUpdates(_0x8dcdcc,_0x3c9595){return function(_0x165b60){if(_0x165b60){return _0x165b60[_0x98e3('0x27')](_0x8dcdcc)[_0x98e3('0x28')](function(_0x8f5e50){return _0x8f5e50;});}return null;};}function removeEntity(_0x16386e,_0x752c90){return function(_0x1fc1dc){if(_0x1fc1dc){return _0x1fc1dc[_0x98e3('0x29')]()['then'](function(){_0x16386e[_0x98e3('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5da0ad,_0x99b41b){return function(_0x459f77){if(!_0x459f77){_0x5da0ad['sendStatus'](0x194);}return _0x459f77;};}function handleError(_0x2595ee,_0x2392d7){_0x2392d7=_0x2392d7||0x1f4;return function(_0x5f020c){logger[_0x98e3('0x2a')](_0x5f020c[_0x98e3('0x2b')]);if(_0x5f020c['name']){delete _0x5f020c[_0x98e3('0x2c')];}_0x2595ee[_0x98e3('0x1d')](_0x2392d7)['send'](_0x5f020c);};}exports[_0x98e3('0x2d')]=function(_0x52e3c2,_0x4cd613){var _0x13225b={},_0x2218c5={},_0x19bb4b={'count':0x0,'rows':[]};var _0x22be5b=_[_0x98e3('0x2e')](db[_0x98e3('0x2f')]['rawAttributes'],function(_0x295a63){return{'name':_0x295a63['fieldName'],'type':_0x295a63[_0x98e3('0x30')][_0x98e3('0x31')]};});_0x2218c5['model']=_['map'](_0x22be5b,'name');_0x2218c5[_0x98e3('0x32')]=_[_0x98e3('0x33')](_0x52e3c2[_0x98e3('0x32')]);_0x2218c5['filters']=_[_0x98e3('0x34')](_0x2218c5[_0x98e3('0x35')],_0x2218c5['query']);_0x13225b[_0x98e3('0x36')]=_['intersection'](_0x2218c5[_0x98e3('0x35')],qs[_0x98e3('0x37')](_0x52e3c2[_0x98e3('0x32')][_0x98e3('0x37')]));_0x13225b[_0x98e3('0x36')]=_0x13225b[_0x98e3('0x36')][_0x98e3('0x38')]?_0x13225b['attributes']:_0x2218c5[_0x98e3('0x35')];if(!_0x52e3c2['query'][_0x98e3('0x39')](_0x98e3('0x3a'))){_0x13225b[_0x98e3('0x1f')]=qs[_0x98e3('0x1f')](_0x52e3c2[_0x98e3('0x32')]['limit']);_0x13225b[_0x98e3('0x21')]=qs[_0x98e3('0x21')](_0x52e3c2['query'][_0x98e3('0x21')]);}_0x13225b[_0x98e3('0x3b')]=qs['sort'](_0x52e3c2[_0x98e3('0x32')][_0x98e3('0x3c')]);_0x13225b['where']=qs[_0x98e3('0x3d')](_['pick'](_0x52e3c2[_0x98e3('0x32')],_0x2218c5['filters']),_0x22be5b);if(_0x52e3c2[_0x98e3('0x32')][_0x98e3('0x3e')]){_0x13225b[_0x98e3('0x3f')]=_['merge'](_0x13225b[_0x98e3('0x3f')],{'$or':_[_0x98e3('0x2e')](_0x22be5b,function(_0x290495){if(_0x290495['type']!==_0x98e3('0x40')){var _0x1ce285={};_0x1ce285[_0x290495[_0x98e3('0x2c')]]={'$like':'%'+_0x52e3c2[_0x98e3('0x32')][_0x98e3('0x3e')]+'%'};return _0x1ce285;}})});}_0x13225b=_[_0x98e3('0x41')]({},_0x13225b,_0x52e3c2['options']);var _0x51dcf3={'where':_0x13225b[_0x98e3('0x3f')]};return db['DeskConfiguration']['count'](_0x51dcf3)[_0x98e3('0x28')](function(_0x4758fa){_0x19bb4b[_0x98e3('0x20')]=_0x4758fa;if(_0x52e3c2[_0x98e3('0x32')]['includeAll']){_0x13225b[_0x98e3('0x42')]=[{'all':!![]}];}return db[_0x98e3('0x2f')][_0x98e3('0x43')](_0x13225b);})[_0x98e3('0x28')](function(_0x5c992d){_0x19bb4b[_0x98e3('0x44')]=_0x5c992d;return _0x19bb4b;})[_0x98e3('0x28')](respondWithFilteredResult(_0x4cd613,_0x13225b))['catch'](handleError(_0x4cd613,null));};exports[_0x98e3('0x45')]=function(_0xdf05fb,_0x478f1c){var _0x4cda8f={'raw':![],'where':{'id':_0xdf05fb[_0x98e3('0x46')]['id']}},_0x580aa8={};_0x580aa8[_0x98e3('0x35')]=_[_0x98e3('0x33')](db['DeskConfiguration'][_0x98e3('0x47')]);_0x580aa8[_0x98e3('0x32')]=_[_0x98e3('0x33')](_0xdf05fb[_0x98e3('0x32')]);_0x580aa8[_0x98e3('0x3d')]=_[_0x98e3('0x34')](_0x580aa8[_0x98e3('0x35')],_0x580aa8[_0x98e3('0x32')]);_0x4cda8f[_0x98e3('0x36')]=_[_0x98e3('0x34')](_0x580aa8[_0x98e3('0x35')],qs[_0x98e3('0x37')](_0xdf05fb['query'][_0x98e3('0x37')]));_0x4cda8f['attributes']=_0x4cda8f['attributes']['length']?_0x4cda8f[_0x98e3('0x36')]:_0x580aa8['model'];if(_0xdf05fb[_0x98e3('0x32')][_0x98e3('0x48')]){_0x4cda8f['include']=[{'all':!![]}];}_0x4cda8f=_['merge']({},_0x4cda8f,_0xdf05fb[_0x98e3('0x49')]);return db['DeskConfiguration'][_0x98e3('0x4a')](_0x4cda8f)[_0x98e3('0x28')](handleEntityNotFound(_0x478f1c,null))[_0x98e3('0x28')](respondWithResult(_0x478f1c,null))[_0x98e3('0x4b')](handleError(_0x478f1c,null));};exports[_0x98e3('0x4c')]=function(_0xfc3a62,_0x1c6e2b){return db['DeskConfiguration'][_0x98e3('0x4c')](_0xfc3a62['body'],{})[_0x98e3('0x28')](respondWithResult(_0x1c6e2b,0xc9))[_0x98e3('0x4b')](handleError(_0x1c6e2b,null));};exports['update']=function(_0x53816e,_0x593143){if(_0x53816e[_0x98e3('0x4d')]['id']){delete _0x53816e[_0x98e3('0x4d')]['id'];}return db[_0x98e3('0x2f')]['find']({'where':{'id':_0x53816e[_0x98e3('0x46')]['id']}})[_0x98e3('0x28')](handleEntityNotFound(_0x593143,null))[_0x98e3('0x28')](saveUpdates(_0x53816e[_0x98e3('0x4d')],null))[_0x98e3('0x28')](respondWithResult(_0x593143,null))[_0x98e3('0x4b')](handleError(_0x593143,null));};exports[_0x98e3('0x29')]=function(_0x4fcb67,_0x76f1f4){return db['DeskConfiguration']['find']({'where':{'id':_0x4fcb67[_0x98e3('0x46')]['id']}})[_0x98e3('0x28')](handleEntityNotFound(_0x76f1f4,null))['then'](removeEntity(_0x76f1f4,null))['catch'](handleError(_0x76f1f4,null));};exports[_0x98e3('0x4e')]=function(_0x141c7d,_0x171c9a,_0x1c8e53){var _0x3d6a80={};var _0x4d2351={};var _0x26e7a5;var _0x1990ce;return db[_0x98e3('0x2f')][_0x98e3('0x4f')]({'where':{'id':_0x141c7d[_0x98e3('0x46')]['id']}})['then'](handleEntityNotFound(_0x171c9a,null))[_0x98e3('0x28')](function(_0x570146){if(_0x570146){_0x26e7a5=_0x570146;_0x4d2351['model']=_[_0x98e3('0x33')](db[_0x98e3('0x50')][_0x98e3('0x47')]);_0x4d2351['query']=_[_0x98e3('0x33')](_0x141c7d[_0x98e3('0x32')]);_0x4d2351[_0x98e3('0x3d')]=_[_0x98e3('0x34')](_0x4d2351['model'],_0x4d2351[_0x98e3('0x32')]);_0x3d6a80['attributes']=_[_0x98e3('0x34')](_0x4d2351[_0x98e3('0x35')],qs[_0x98e3('0x37')](_0x141c7d[_0x98e3('0x32')][_0x98e3('0x37')]));_0x3d6a80[_0x98e3('0x36')]=_0x3d6a80[_0x98e3('0x36')]['length']?_0x3d6a80['attributes']:_0x4d2351[_0x98e3('0x35')];_0x3d6a80[_0x98e3('0x3b')]=qs[_0x98e3('0x3c')](_0x141c7d[_0x98e3('0x32')]['sort']);_0x3d6a80[_0x98e3('0x3f')]=qs[_0x98e3('0x3d')](_[_0x98e3('0x51')](_0x141c7d['query'],_0x4d2351[_0x98e3('0x3d')]));if(_0x141c7d[_0x98e3('0x32')][_0x98e3('0x3e')]){_0x3d6a80[_0x98e3('0x3f')]=_['merge'](_0x3d6a80[_0x98e3('0x3f')],{'$or':_['map'](_0x3d6a80[_0x98e3('0x36')],function(_0x5b3653){var _0x593e1e={};_0x593e1e[_0x5b3653]={'$like':'%'+_0x141c7d[_0x98e3('0x32')][_0x98e3('0x3e')]+'%'};return _0x593e1e;})});}_0x3d6a80=_['merge']({},_0x3d6a80,_0x141c7d['options']);return _0x26e7a5[_0x98e3('0x4e')](_0x3d6a80);}})[_0x98e3('0x28')](function(_0x488832){if(_0x488832){_0x1990ce=_0x488832[_0x98e3('0x38')];if(!_0x141c7d[_0x98e3('0x32')]['hasOwnProperty']('nolimit')){_0x3d6a80[_0x98e3('0x1f')]=qs[_0x98e3('0x1f')](_0x141c7d[_0x98e3('0x32')][_0x98e3('0x1f')]);_0x3d6a80[_0x98e3('0x21')]=qs['offset'](_0x141c7d[_0x98e3('0x32')][_0x98e3('0x21')]);}return _0x26e7a5[_0x98e3('0x4e')](_0x3d6a80);}})['then'](function(_0x5539bf){if(_0x5539bf){return _0x5539bf?{'count':_0x1990ce,'rows':_0x5539bf}:null;}})[_0x98e3('0x28')](respondWithResult(_0x171c9a,null))[_0x98e3('0x4b')](handleError(_0x171c9a,null));};exports[_0x98e3('0x52')]=function(_0x173dc5,_0x3835bb,_0x146e80){var _0x4892f7={};var _0x259665={};var _0x22991a;var _0x14b177;return db[_0x98e3('0x2f')]['findOne']({'where':{'id':_0x173dc5[_0x98e3('0x46')]['id']}})[_0x98e3('0x28')](handleEntityNotFound(_0x3835bb,null))[_0x98e3('0x28')](function(_0x93dd73){if(_0x93dd73){_0x22991a=_0x93dd73;_0x259665[_0x98e3('0x35')]=_['keys'](db[_0x98e3('0x50')][_0x98e3('0x47')]);_0x259665[_0x98e3('0x32')]=_[_0x98e3('0x33')](_0x173dc5[_0x98e3('0x32')]);_0x259665[_0x98e3('0x3d')]=_[_0x98e3('0x34')](_0x259665[_0x98e3('0x35')],_0x259665['query']);_0x4892f7[_0x98e3('0x36')]=_[_0x98e3('0x34')](_0x259665[_0x98e3('0x35')],qs[_0x98e3('0x37')](_0x173dc5[_0x98e3('0x32')][_0x98e3('0x37')]));_0x4892f7[_0x98e3('0x36')]=_0x4892f7['attributes'][_0x98e3('0x38')]?_0x4892f7[_0x98e3('0x36')]:_0x259665[_0x98e3('0x35')];_0x4892f7[_0x98e3('0x3b')]=qs[_0x98e3('0x3c')](_0x173dc5['query']['sort']);_0x4892f7[_0x98e3('0x3f')]=qs[_0x98e3('0x3d')](_['pick'](_0x173dc5[_0x98e3('0x32')],_0x259665['filters']));if(_0x173dc5[_0x98e3('0x32')][_0x98e3('0x3e')]){_0x4892f7[_0x98e3('0x3f')]=_['merge'](_0x4892f7[_0x98e3('0x3f')],{'$or':_[_0x98e3('0x2e')](_0x4892f7['attributes'],function(_0x213ee0){var _0xbdbaac={};_0xbdbaac[_0x213ee0]={'$like':'%'+_0x173dc5[_0x98e3('0x32')]['filter']+'%'};return _0xbdbaac;})});}_0x4892f7=_[_0x98e3('0x41')]({},_0x4892f7,_0x173dc5[_0x98e3('0x49')]);return _0x22991a['getSubjects'](_0x4892f7);}})['then'](function(_0x1fdfa0){if(_0x1fdfa0){_0x14b177=_0x1fdfa0[_0x98e3('0x38')];if(!_0x173dc5['query'][_0x98e3('0x39')](_0x98e3('0x3a'))){_0x4892f7[_0x98e3('0x1f')]=qs[_0x98e3('0x1f')](_0x173dc5[_0x98e3('0x32')][_0x98e3('0x1f')]);_0x4892f7['offset']=qs['offset'](_0x173dc5[_0x98e3('0x32')][_0x98e3('0x21')]);}return _0x22991a[_0x98e3('0x52')](_0x4892f7);}})['then'](function(_0x53da3f){if(_0x53da3f){return _0x53da3f?{'count':_0x14b177,'rows':_0x53da3f}:null;}})[_0x98e3('0x28')](respondWithResult(_0x3835bb,null))[_0x98e3('0x4b')](handleError(_0x3835bb,null));};exports[_0x98e3('0x53')]=function(_0x547022,_0x2999f4,_0x1c401c){var _0x911ad2={};var _0x163e4c={};var _0x2699c4;var _0x4de115;return db[_0x98e3('0x2f')][_0x98e3('0x4f')]({'where':{'id':_0x547022['params']['id']}})[_0x98e3('0x28')](handleEntityNotFound(_0x2999f4,null))['then'](function(_0x3026c5){if(_0x3026c5){_0x2699c4=_0x3026c5;_0x163e4c[_0x98e3('0x35')]=_['keys'](db['DeskField']['rawAttributes']);_0x163e4c['query']=_[_0x98e3('0x33')](_0x547022[_0x98e3('0x32')]);_0x163e4c['filters']=_[_0x98e3('0x34')](_0x163e4c[_0x98e3('0x35')],_0x163e4c[_0x98e3('0x32')]);_0x911ad2['attributes']=_[_0x98e3('0x34')](_0x163e4c[_0x98e3('0x35')],qs[_0x98e3('0x37')](_0x547022[_0x98e3('0x32')][_0x98e3('0x37')]));_0x911ad2[_0x98e3('0x36')]=_0x911ad2[_0x98e3('0x36')][_0x98e3('0x38')]?_0x911ad2['attributes']:_0x163e4c['model'];_0x911ad2['order']=qs['sort'](_0x547022['query'][_0x98e3('0x3c')]);_0x911ad2[_0x98e3('0x3f')]=qs[_0x98e3('0x3d')](_[_0x98e3('0x51')](_0x547022['query'],_0x163e4c[_0x98e3('0x3d')]));if(_0x547022[_0x98e3('0x32')]['filter']){_0x911ad2[_0x98e3('0x3f')]=_[_0x98e3('0x41')](_0x911ad2[_0x98e3('0x3f')],{'$or':_[_0x98e3('0x2e')](_0x911ad2[_0x98e3('0x36')],function(_0x115058){var _0x4ce173={};_0x4ce173[_0x115058]={'$like':'%'+_0x547022[_0x98e3('0x32')][_0x98e3('0x3e')]+'%'};return _0x4ce173;})});}_0x911ad2=_[_0x98e3('0x41')]({},_0x911ad2,_0x547022[_0x98e3('0x49')]);return _0x2699c4[_0x98e3('0x53')](_0x911ad2);}})['then'](function(_0x5ba2ca){if(_0x5ba2ca){_0x4de115=_0x5ba2ca[_0x98e3('0x38')];if(!_0x547022[_0x98e3('0x32')]['hasOwnProperty'](_0x98e3('0x3a'))){_0x911ad2[_0x98e3('0x1f')]=qs[_0x98e3('0x1f')](_0x547022[_0x98e3('0x32')][_0x98e3('0x1f')]);_0x911ad2[_0x98e3('0x21')]=qs[_0x98e3('0x21')](_0x547022[_0x98e3('0x32')][_0x98e3('0x21')]);}return _0x2699c4['getDescriptions'](_0x911ad2);}})[_0x98e3('0x28')](function(_0x3748f0){if(_0x3748f0){return _0x3748f0?{'count':_0x4de115,'rows':_0x3748f0}:null;}})[_0x98e3('0x28')](respondWithResult(_0x2999f4,null))[_0x98e3('0x4b')](handleError(_0x2999f4,null));};exports['getTags']=function(_0x3121c6,_0x4581dc,_0xbab056){var _0x35188f={};var _0x5bc7fb={};var _0x5a4a73;var _0x29c029;return db[_0x98e3('0x2f')][_0x98e3('0x4f')]({'where':{'id':_0x3121c6['params']['id']}})[_0x98e3('0x28')](handleEntityNotFound(_0x4581dc,null))['then'](function(_0x52e1d0){if(_0x52e1d0){_0x5a4a73=_0x52e1d0;_0x5bc7fb[_0x98e3('0x35')]=_[_0x98e3('0x33')](db[_0x98e3('0x54')][_0x98e3('0x47')]);_0x5bc7fb[_0x98e3('0x32')]=_['keys'](_0x3121c6[_0x98e3('0x32')]);_0x5bc7fb[_0x98e3('0x3d')]=_['intersection'](_0x5bc7fb['model'],_0x5bc7fb[_0x98e3('0x32')]);_0x35188f[_0x98e3('0x36')]=_[_0x98e3('0x34')](_0x5bc7fb[_0x98e3('0x35')],qs['fields'](_0x3121c6[_0x98e3('0x32')]['fields']));_0x35188f['attributes']=_0x35188f[_0x98e3('0x36')]['length']?_0x35188f['attributes']:_0x5bc7fb[_0x98e3('0x35')];_0x35188f[_0x98e3('0x3b')]=qs[_0x98e3('0x3c')](_0x3121c6['query'][_0x98e3('0x3c')]);_0x35188f[_0x98e3('0x3f')]=qs['filters'](_[_0x98e3('0x51')](_0x3121c6['query'],_0x5bc7fb[_0x98e3('0x3d')]));if(_0x3121c6[_0x98e3('0x32')][_0x98e3('0x3e')]){_0x35188f[_0x98e3('0x3f')]=_[_0x98e3('0x41')](_0x35188f[_0x98e3('0x3f')],{'$or':_['map'](_0x35188f['attributes'],function(_0x27fcb5){var _0x25f9c2={};_0x25f9c2[_0x27fcb5]={'$like':'%'+_0x3121c6[_0x98e3('0x32')]['filter']+'%'};return _0x25f9c2;})});}_0x35188f=_[_0x98e3('0x41')]({},_0x35188f,_0x3121c6['options']);return _0x5a4a73[_0x98e3('0x55')](_0x35188f);}})[_0x98e3('0x28')](function(_0x5c4b26){if(_0x5c4b26){_0x29c029=_0x5c4b26[_0x98e3('0x38')];if(!_0x3121c6[_0x98e3('0x32')][_0x98e3('0x39')](_0x98e3('0x3a'))){_0x35188f[_0x98e3('0x1f')]=qs[_0x98e3('0x1f')](_0x3121c6['query'][_0x98e3('0x1f')]);_0x35188f['offset']=qs['offset'](_0x3121c6['query']['offset']);}return _0x5a4a73['getTags'](_0x35188f);}})[_0x98e3('0x28')](function(_0x2cea40){if(_0x2cea40){return _0x2cea40?{'count':_0x29c029,'rows':_0x2cea40}:null;}})[_0x98e3('0x28')](respondWithResult(_0x4581dc,null))[_0x98e3('0x4b')](handleError(_0x4581dc,null));};exports[_0x98e3('0x56')]=function(_0x5326ae,_0x3e8a7b,_0x3a9819){if(_0x5326ae[_0x98e3('0x4d')]['id']){delete _0x5326ae[_0x98e3('0x4d')]['id'];}return db[_0x98e3('0x2f')][_0x98e3('0x4f')]({'where':{'id':_0x5326ae[_0x98e3('0x46')]['id']}})[_0x98e3('0x28')](handleEntityNotFound(_0x3e8a7b,null))[_0x98e3('0x28')](function(_0x18f4a7){if(_0x18f4a7){return _0x18f4a7[_0x98e3('0x56')](_0x5326ae[_0x98e3('0x4d')][_0x98e3('0x57')]||[]);}return null;})[_0x98e3('0x28')](respondWithResult(_0x3e8a7b,null))['catch'](handleError(_0x3e8a7b,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 6bb0e99..44d4fed 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 _0x66dd=['../../config/logger','bluebird','request-promise','path','../../config/environment','define','int_desk_configurations'];(function(_0x112c6a,_0xc35da1){var _0x44e9e4=function(_0x1c3f12){while(--_0x1c3f12){_0x112c6a['push'](_0x112c6a['shift']());}};_0x44e9e4(++_0xc35da1);}(_0x66dd,0x181));var _0xd66d=function(_0x5e4f54,_0x259274){_0x5e4f54=_0x5e4f54-0x0;var _0x29ae64=_0x66dd[_0x5e4f54];return _0x29ae64;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd66d('0x0'))('api');var moment=require('moment');var BPromise=require(_0xd66d('0x1'));var rp=require(_0xd66d('0x2'));var fs=require('fs');var path=require(_0xd66d('0x3'));var rimraf=require('rimraf');var config=require(_0xd66d('0x4'));var attributes=require('./intDeskConfiguration.attributes');module['exports']=function(_0x1387bf,_0x4402b6){return _0x1387bf[_0xd66d('0x5')]('DeskConfiguration',attributes,{'tableName':_0xd66d('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe9fa=['DeskConfiguration','int_desk_configurations','lodash','util','api','moment','path','rimraf','exports','define'];(function(_0x5df37d,_0x2adcf9){var _0x52e755=function(_0x377914){while(--_0x377914){_0x5df37d['push'](_0x5df37d['shift']());}};_0x52e755(++_0x2adcf9);}(_0xe9fa,0xfc));var _0xae9f=function(_0xa21234,_0x200bc7){_0xa21234=_0xa21234-0x0;var _0x294866=_0xe9fa[_0xa21234];return _0x294866;};'use strict';var _=require(_0xae9f('0x0'));var util=require(_0xae9f('0x1'));var logger=require('../../config/logger')(_0xae9f('0x2'));var moment=require(_0xae9f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xae9f('0x4'));var rimraf=require(_0xae9f('0x5'));var config=require('../../config/environment');var attributes=require('./intDeskConfiguration.attributes');module[_0xae9f('0x6')]=function(_0x39c705,_0x4e61dc){return _0x39c705[_0xae9f('0x7')](_0xae9f('0x8'),attributes,{'tableName':_0xae9f('0x9'),'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 931f5c0..3b66c24 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 _0xdf94=['error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x5532c1,_0x2c9788){var _0x30f7a5=function(_0x45d9fc){while(--_0x45d9fc){_0x5532c1['push'](_0x5532c1['shift']());}};_0x30f7a5(++_0x2c9788);}(_0xdf94,0xad));var _0x4df9=function(_0x30736f,_0x147e47){_0x30736f=_0x30736f-0x0;var _0x275fae=_0xdf94[_0x30736f];return _0x275fae;};'use strict';var _=require('lodash');var util=require(_0x4df9('0x0'));var moment=require(_0x4df9('0x1'));var BPromise=require(_0x4df9('0x2'));var rs=require(_0x4df9('0x3'));var fs=require('fs');var Redis=require(_0x4df9('0x4'));var db=require(_0x4df9('0x5'))['db'];var utils=require(_0x4df9('0x6'));var logger=require(_0x4df9('0x7'))(_0x4df9('0x8'));var config=require(_0x4df9('0x9'));var jayson=require(_0x4df9('0xa'));var client=jayson[_0x4df9('0xb')][_0x4df9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2f46e3,_0x34faba,_0x2fac37){return new BPromise(function(_0x39ebc3,_0xf808f0){return client['request'](_0x2f46e3,_0x2fac37)[_0x4df9('0xd')](function(_0x3eaca1){logger[_0x4df9('0xe')](_0x4df9('0xf'),_0x34faba,_0x4df9('0x10'));logger[_0x4df9('0x11')](_0x4df9('0x12'),_0x34faba,'request\x20sent',JSON['stringify'](_0x3eaca1));if(_0x3eaca1[_0x4df9('0x13')]){if(_0x3eaca1['error'][_0x4df9('0x14')]===0x1f4){logger[_0x4df9('0x13')](_0x4df9('0xf'),_0x34faba,_0x3eaca1[_0x4df9('0x13')]['message']);return _0xf808f0(_0x3eaca1[_0x4df9('0x13')][_0x4df9('0x15')]);}logger[_0x4df9('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0x34faba,_0x3eaca1[_0x4df9('0x13')][_0x4df9('0x15')]);return _0x39ebc3(_0x3eaca1[_0x4df9('0x13')]['message']);}else{logger[_0x4df9('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x34faba,_0x4df9('0x10'));_0x39ebc3(_0x3eaca1[_0x4df9('0x16')][_0x4df9('0x15')]);}})[_0x4df9('0x17')](function(_0x5d2910){logger[_0x4df9('0x13')](_0x4df9('0xf'),_0x34faba,_0x5d2910);_0xf808f0(_0x5d2910);});});} \ No newline at end of file +var _0x4a41=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','DeskConfiguration,\x20%s,\x20%s','result','catch'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x4a41,0x1b8));var _0x14a4=function(_0x43f8cc,_0x592b95){_0x43f8cc=_0x43f8cc-0x0;var _0x1c8808=_0x4a41[_0x43f8cc];return _0x1c8808;};'use strict';var _=require(_0x14a4('0x0'));var util=require(_0x14a4('0x1'));var moment=require(_0x14a4('0x2'));var BPromise=require(_0x14a4('0x3'));var rs=require(_0x14a4('0x4'));var fs=require('fs');var Redis=require(_0x14a4('0x5'));var db=require(_0x14a4('0x6'))['db'];var utils=require(_0x14a4('0x7'));var logger=require(_0x14a4('0x8'))(_0x14a4('0x9'));var config=require('../../config/environment');var jayson=require(_0x14a4('0xa'));var client=jayson['client'][_0x14a4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3aa79b,_0x5e5e33,_0x339b8a){return new BPromise(function(_0x23f6b6,_0x4c3eb2){return client['request'](_0x3aa79b,_0x339b8a)[_0x14a4('0xc')](function(_0x145e68){logger[_0x14a4('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x5e5e33,_0x14a4('0xe'));logger['debug'](_0x14a4('0xf'),_0x5e5e33,_0x14a4('0xe'),JSON['stringify'](_0x145e68));if(_0x145e68['error']){if(_0x145e68[_0x14a4('0x10')][_0x14a4('0x11')]===0x1f4){logger[_0x14a4('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x5e5e33,_0x145e68[_0x14a4('0x10')][_0x14a4('0x12')]);return _0x4c3eb2(_0x145e68[_0x14a4('0x10')][_0x14a4('0x12')]);}logger[_0x14a4('0x10')](_0x14a4('0x13'),_0x5e5e33,_0x145e68['error'][_0x14a4('0x12')]);return _0x23f6b6(_0x145e68[_0x14a4('0x10')][_0x14a4('0x12')]);}else{logger[_0x14a4('0xd')](_0x14a4('0x13'),_0x5e5e33,_0x14a4('0xe'));_0x23f6b6(_0x145e68[_0x14a4('0x14')][_0x14a4('0x12')]);}})[_0x14a4('0x15')](function(_0x194af9){logger[_0x14a4('0x10')](_0x14a4('0x13'),_0x5e5e33,_0x194af9);_0x4c3eb2(_0x194af9);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index e10b5fa..f0b48d9 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 _0xb1fa=['./intDeskField.controller','get','isAuthenticated','show','/:id','update','delete','destroy','path','express'];(function(_0x4b3e9d,_0x117cbd){var _0x4aeff7=function(_0x3dd1dd){while(--_0x3dd1dd){_0x4b3e9d['push'](_0x4b3e9d['shift']());}};_0x4aeff7(++_0x117cbd);}(_0xb1fa,0x9e));var _0xab1f=function(_0x1a8ac3,_0x403168){_0x1a8ac3=_0x1a8ac3-0x0;var _0x3353a7=_0xb1fa[_0x1a8ac3];return _0x3353a7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xab1f('0x0'));var timeout=require('connect-timeout');var express=require(_0xab1f('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xab1f('0x2'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xab1f('0x3')]('/:id',auth[_0xab1f('0x4')](),controller[_0xab1f('0x5')]);router['post']('/',auth[_0xab1f('0x4')](),controller['create']);router['put'](_0xab1f('0x6'),auth[_0xab1f('0x4')](),controller[_0xab1f('0x7')]);router[_0xab1f('0x8')](_0xab1f('0x6'),auth['isAuthenticated'](),controller[_0xab1f('0x9')]);module['exports']=router; \ No newline at end of file +var _0xa73a=['post','put','delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id'];(function(_0xa92014,_0x5847b2){var _0x3bc139=function(_0x318362){while(--_0x318362){_0xa92014['push'](_0xa92014['shift']());}};_0x3bc139(++_0x5847b2);}(_0xa73a,0xe5));var _0xaa73=function(_0x33ca22,_0xbcc94){_0x33ca22=_0x33ca22-0x0;var _0x1790c3=_0xa73a[_0x33ca22];return _0x1790c3;};'use strict';var multer=require('multer');var util=require(_0xaa73('0x0'));var path=require('path');var timeout=require(_0xaa73('0x1'));var express=require(_0xaa73('0x2'));var router=express[_0xaa73('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xaa73('0x4'));var interaction=require(_0xaa73('0x5'));var config=require(_0xaa73('0x6'));var controller=require('./intDeskField.controller');router['get']('/',auth[_0xaa73('0x7')](),controller[_0xaa73('0x8')]);router[_0xaa73('0x9')](_0xaa73('0xa'),auth[_0xaa73('0x7')](),controller['show']);router[_0xaa73('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xaa73('0xc')](_0xaa73('0xa'),auth[_0xaa73('0x7')](),controller['update']);router[_0xaa73('0xd')](_0xaa73('0xa'),auth[_0xaa73('0x7')](),controller['destroy']);module[_0xaa73('0xe')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 8a4a08f..dade013 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 _0x1ac5=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x5be46a,_0x2fb035){var _0x1ce3b8=function(_0x213d1f){while(--_0x213d1f){_0x5be46a['push'](_0x5be46a['shift']());}};_0x1ce3b8(++_0x2fb035);}(_0x1ac5,0xa7));var _0x51ac=function(_0xd58823,_0x15c483){_0xd58823=_0xd58823-0x0;var _0x249c0a=_0x1ac5[_0xd58823];return _0x249c0a;};'use strict';var Sequelize=require(_0x51ac('0x0'));module[_0x51ac('0x1')]={'type':{'type':Sequelize[_0x51ac('0x2')](_0x51ac('0x3'),_0x51ac('0x4'),_0x51ac('0x5'),_0x51ac('0x6'),_0x51ac('0x7')),'defaultValue':_0x51ac('0x3')},'content':{'type':Sequelize[_0x51ac('0x8')]},'key':{'type':Sequelize[_0x51ac('0x8')]},'keyType':{'type':Sequelize[_0x51ac('0x2')](_0x51ac('0x3'),_0x51ac('0x4'),_0x51ac('0x5'))},'keyContent':{'type':Sequelize[_0x51ac('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x51ac('0x8')]},'customField':{'type':Sequelize[_0x51ac('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfbaf=['customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x2a0d88,_0x8a0589){var _0xfc8a05=function(_0x28fbf8){while(--_0x28fbf8){_0x2a0d88['push'](_0x2a0d88['shift']());}};_0xfc8a05(++_0x8a0589);}(_0xfbaf,0xaf));var _0xffba=function(_0x4d6faa,_0x56a467){_0x4d6faa=_0x4d6faa-0x0;var _0x10d344=_0xfbaf[_0x4d6faa];return _0x10d344;};'use strict';var Sequelize=require(_0xffba('0x0'));module[_0xffba('0x1')]={'type':{'type':Sequelize[_0xffba('0x2')](_0xffba('0x3'),_0xffba('0x4'),_0xffba('0x5'),_0xffba('0x6'),'picklist'),'defaultValue':_0xffba('0x3')},'content':{'type':Sequelize[_0xffba('0x7')]},'key':{'type':Sequelize[_0xffba('0x7')]},'keyType':{'type':Sequelize[_0xffba('0x2')](_0xffba('0x3'),_0xffba('0x4'),_0xffba('0x5'))},'keyContent':{'type':Sequelize[_0xffba('0x7')]},'idField':{'type':Sequelize[_0xffba('0x7')]},'nameField':{'type':Sequelize[_0xffba('0x7')]},'customField':{'type':Sequelize[_0xffba('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xffba('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 3346fad..630f33a 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 _0x8149=['keys','fields','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','DeskField','type','key','map','query','filters','intersection','attributes','model','length','nolimit','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes'];(function(_0x47e897,_0x2b0ca2){var _0x5600a3=function(_0x5d7fa9){while(--_0x5d7fa9){_0x47e897['push'](_0x47e897['shift']());}};_0x5600a3(++_0x2b0ca2);}(_0x8149,0x1a3));var _0x9814=function(_0x59e081,_0x11b24a){_0x59e081=_0x59e081-0x0;var _0x35cf0f=_0x8149[_0x59e081];return _0x35cf0f;};'use strict';var emlformat=require(_0x9814('0x0'));var rimraf=require(_0x9814('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9814('0x2'));var rp=require(_0x9814('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9814('0x4'));var path=require(_0x9814('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9814('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9814('0x7'));var crypto=require(_0x9814('0x8'));var jsforce=require(_0x9814('0x9'));var deskjs=require(_0x9814('0xa'));var toCsv=require(_0x9814('0xb'));var querystring=require('querystring');var Papa=require(_0x9814('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9814('0xd'));var as=require(_0x9814('0xe'));var hardwareService=require(_0x9814('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x9814('0x10'));var config=require(_0x9814('0x11'));var licenseUtil=require(_0x9814('0x12'));var db=require(_0x9814('0x13'))['db'];function respondWithStatusCode(_0x4b9ef9,_0x20c6e8){_0x20c6e8=_0x20c6e8||0xcc;return function(_0x3c721c){if(_0x3c721c){return _0x4b9ef9[_0x9814('0x14')](_0x20c6e8);}return _0x4b9ef9[_0x9814('0x15')](_0x20c6e8)[_0x9814('0x16')]();};}function respondWithResult(_0x3e2527,_0x2fe1eb){_0x2fe1eb=_0x2fe1eb||0xc8;return function(_0x465838){if(_0x465838){return _0x3e2527['status'](_0x2fe1eb)[_0x9814('0x17')](_0x465838);}};}function respondWithFilteredResult(_0x46392f,_0xb37df9){return function(_0x4e61a1){if(_0x4e61a1){var _0x102b24=typeof _0xb37df9['offset']===_0x9814('0x18')&&typeof _0xb37df9['limit']===_0x9814('0x18');var _0x4db57c=_0x4e61a1[_0x9814('0x19')];var _0xf9b543=_0x102b24?0x0:_0xb37df9[_0x9814('0x1a')];var _0x305f74=_0x102b24?_0x4e61a1['count']:_0xb37df9[_0x9814('0x1a')]+_0xb37df9[_0x9814('0x1b')];var _0x498479;if(_0x305f74>=_0x4db57c){_0x305f74=_0x4db57c;_0x498479=0xc8;}else{_0x498479=0xce;}_0x46392f[_0x9814('0x15')](_0x498479);return _0x46392f[_0x9814('0x1c')](_0x9814('0x1d'),_0xf9b543+'-'+_0x305f74+'/'+_0x4db57c)[_0x9814('0x17')](_0x4e61a1);}return null;};}function patchUpdates(_0x59f1e2){return function(_0x551c5d){try{jsonpatch['apply'](_0x551c5d,_0x59f1e2,!![]);}catch(_0x50fbcc){return BPromise[_0x9814('0x1e')](_0x50fbcc);}return _0x551c5d[_0x9814('0x1f')]();};}function saveUpdates(_0x4c956a,_0xe099d8){return function(_0x581f5f){if(_0x581f5f){return _0x581f5f[_0x9814('0x20')](_0x4c956a)[_0x9814('0x21')](function(_0x10f2ab){return _0x10f2ab;});}return null;};}function removeEntity(_0x158ca1,_0x4e3e06){return function(_0x4eef7d){if(_0x4eef7d){return _0x4eef7d[_0x9814('0x22')]()[_0x9814('0x21')](function(){_0x158ca1['status'](0xcc)[_0x9814('0x16')]();});}};}function handleEntityNotFound(_0x1bcd62,_0x2f3c5e){return function(_0x29cd5f){if(!_0x29cd5f){_0x1bcd62['sendStatus'](0x194);}return _0x29cd5f;};}function handleError(_0x176d57,_0x31b2da){_0x31b2da=_0x31b2da||0x1f4;return function(_0x1e1576){logger[_0x9814('0x23')](_0x1e1576[_0x9814('0x24')]);if(_0x1e1576['name']){delete _0x1e1576[_0x9814('0x25')];}_0x176d57[_0x9814('0x15')](_0x31b2da)[_0x9814('0x26')](_0x1e1576);};}exports[_0x9814('0x27')]=function(_0x3011eb,_0x5ec465){var _0x4bdb1c={},_0x208c5c={},_0x24f813={'count':0x0,'rows':[]};var _0x2252c0=_['map'](db[_0x9814('0x28')]['rawAttributes'],function(_0x3890f1){return{'name':_0x3890f1['fieldName'],'type':_0x3890f1[_0x9814('0x29')][_0x9814('0x2a')]};});_0x208c5c['model']=_[_0x9814('0x2b')](_0x2252c0,_0x9814('0x25'));_0x208c5c[_0x9814('0x2c')]=_['keys'](_0x3011eb[_0x9814('0x2c')]);_0x208c5c[_0x9814('0x2d')]=_[_0x9814('0x2e')](_0x208c5c['model'],_0x208c5c[_0x9814('0x2c')]);_0x4bdb1c[_0x9814('0x2f')]=_[_0x9814('0x2e')](_0x208c5c[_0x9814('0x30')],qs['fields'](_0x3011eb[_0x9814('0x2c')]['fields']));_0x4bdb1c['attributes']=_0x4bdb1c[_0x9814('0x2f')][_0x9814('0x31')]?_0x4bdb1c[_0x9814('0x2f')]:_0x208c5c[_0x9814('0x30')];if(!_0x3011eb['query']['hasOwnProperty'](_0x9814('0x32'))){_0x4bdb1c[_0x9814('0x1b')]=qs['limit'](_0x3011eb[_0x9814('0x2c')][_0x9814('0x1b')]);_0x4bdb1c['offset']=qs[_0x9814('0x1a')](_0x3011eb[_0x9814('0x2c')][_0x9814('0x1a')]);}_0x4bdb1c['order']=qs['sort'](_0x3011eb[_0x9814('0x2c')]['sort']);_0x4bdb1c[_0x9814('0x33')]=qs[_0x9814('0x2d')](_[_0x9814('0x34')](_0x3011eb[_0x9814('0x2c')],_0x208c5c[_0x9814('0x2d')]),_0x2252c0);if(_0x3011eb[_0x9814('0x2c')][_0x9814('0x35')]){_0x4bdb1c[_0x9814('0x33')]=_[_0x9814('0x36')](_0x4bdb1c[_0x9814('0x33')],{'$or':_[_0x9814('0x2b')](_0x2252c0,function(_0x3ed774){if(_0x3ed774[_0x9814('0x29')]!==_0x9814('0x37')){var _0x5264cc={};_0x5264cc[_0x3ed774[_0x9814('0x25')]]={'$like':'%'+_0x3011eb[_0x9814('0x2c')]['filter']+'%'};return _0x5264cc;}})});}_0x4bdb1c=_[_0x9814('0x36')]({},_0x4bdb1c,_0x3011eb[_0x9814('0x38')]);var _0x57ab3e={'where':_0x4bdb1c[_0x9814('0x33')]};return db['DeskField'][_0x9814('0x19')](_0x57ab3e)[_0x9814('0x21')](function(_0x8f1292){_0x24f813[_0x9814('0x19')]=_0x8f1292;if(_0x3011eb[_0x9814('0x2c')][_0x9814('0x39')]){_0x4bdb1c[_0x9814('0x3a')]=[{'all':!![]}];}return db['DeskField'][_0x9814('0x3b')](_0x4bdb1c);})[_0x9814('0x21')](function(_0x1b01ac){_0x24f813['rows']=_0x1b01ac;return _0x24f813;})[_0x9814('0x21')](respondWithFilteredResult(_0x5ec465,_0x4bdb1c))[_0x9814('0x3c')](handleError(_0x5ec465,null));};exports[_0x9814('0x3d')]=function(_0x1b405b,_0x5857ee){var _0x59c2ad={'raw':!![],'where':{'id':_0x1b405b[_0x9814('0x3e')]['id']}},_0x1c6b92={};_0x1c6b92[_0x9814('0x30')]=_['keys'](db[_0x9814('0x28')][_0x9814('0x3f')]);_0x1c6b92[_0x9814('0x2c')]=_[_0x9814('0x40')](_0x1b405b[_0x9814('0x2c')]);_0x1c6b92[_0x9814('0x2d')]=_[_0x9814('0x2e')](_0x1c6b92[_0x9814('0x30')],_0x1c6b92[_0x9814('0x2c')]);_0x59c2ad['attributes']=_['intersection'](_0x1c6b92[_0x9814('0x30')],qs[_0x9814('0x41')](_0x1b405b[_0x9814('0x2c')][_0x9814('0x41')]));_0x59c2ad[_0x9814('0x2f')]=_0x59c2ad[_0x9814('0x2f')][_0x9814('0x31')]?_0x59c2ad[_0x9814('0x2f')]:_0x1c6b92['model'];if(_0x1b405b[_0x9814('0x2c')][_0x9814('0x39')]){_0x59c2ad[_0x9814('0x3a')]=[{'all':!![]}];}_0x59c2ad=_['merge']({},_0x59c2ad,_0x1b405b[_0x9814('0x38')]);return db[_0x9814('0x28')][_0x9814('0x42')](_0x59c2ad)[_0x9814('0x21')](handleEntityNotFound(_0x5857ee,null))[_0x9814('0x21')](respondWithResult(_0x5857ee,null))[_0x9814('0x3c')](handleError(_0x5857ee,null));};exports[_0x9814('0x43')]=function(_0x290f8,_0x32acaf){return db['DeskField'][_0x9814('0x43')](_0x290f8['body'],{})[_0x9814('0x21')](respondWithResult(_0x32acaf,0xc9))['catch'](handleError(_0x32acaf,null));};exports[_0x9814('0x20')]=function(_0x3a7635,_0xc0b647){if(_0x3a7635[_0x9814('0x44')]['id']){delete _0x3a7635[_0x9814('0x44')]['id'];}return db[_0x9814('0x28')][_0x9814('0x42')]({'where':{'id':_0x3a7635[_0x9814('0x3e')]['id']}})['then'](handleEntityNotFound(_0xc0b647,null))[_0x9814('0x21')](saveUpdates(_0x3a7635[_0x9814('0x44')],null))[_0x9814('0x21')](respondWithResult(_0xc0b647,null))[_0x9814('0x3c')](handleError(_0xc0b647,null));};exports[_0x9814('0x22')]=function(_0x50e797,_0x392704){return db['DeskField'][_0x9814('0x42')]({'where':{'id':_0x50e797[_0x9814('0x3e')]['id']}})[_0x9814('0x21')](handleEntityNotFound(_0x392704,null))[_0x9814('0x21')](removeEntity(_0x392704,null))[_0x9814('0x3c')](handleError(_0x392704,null));}; \ No newline at end of file +var _0xfe01=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','json','offset','limit','undefined','count','status','Content-Range','apply','save','then','sendStatus','send','index','map','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','where','VIRTUAL','merge','options','DeskField','includeAll','include','findAll','rows','catch','show','find','create','body','update','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x234485,_0x19d936){var _0x587939=function(_0x5c8cef){while(--_0x5c8cef){_0x234485['push'](_0x234485['shift']());}};_0x587939(++_0x19d936);}(_0xfe01,0x126));var _0x1fe0=function(_0x2d0613,_0x2bb113){_0x2d0613=_0x2d0613-0x0;var _0x49fe6e=_0xfe01[_0x2d0613];return _0x49fe6e;};'use strict';var emlformat=require(_0x1fe0('0x0'));var rimraf=require(_0x1fe0('0x1'));var zipdir=require(_0x1fe0('0x2'));var jsonpatch=require(_0x1fe0('0x3'));var rp=require(_0x1fe0('0x4'));var moment=require(_0x1fe0('0x5'));var BPromise=require(_0x1fe0('0x6'));var Mustache=require(_0x1fe0('0x7'));var util=require(_0x1fe0('0x8'));var path=require(_0x1fe0('0x9'));var sox=require(_0x1fe0('0xa'));var csv=require(_0x1fe0('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1fe0('0xc'));var _=require(_0x1fe0('0xd'));var squel=require(_0x1fe0('0xe'));var crypto=require(_0x1fe0('0xf'));var jsforce=require(_0x1fe0('0x10'));var deskjs=require(_0x1fe0('0x11'));var toCsv=require('to-csv');var querystring=require(_0x1fe0('0x12'));var Papa=require(_0x1fe0('0x13'));var Redis=require('ioredis');var authService=require(_0x1fe0('0x14'));var qs=require(_0x1fe0('0x15'));var as=require(_0x1fe0('0x16'));var hardwareService=require(_0x1fe0('0x17'));var logger=require(_0x1fe0('0x18'))(_0x1fe0('0x19'));var utils=require(_0x1fe0('0x1a'));var config=require(_0x1fe0('0x1b'));var licenseUtil=require(_0x1fe0('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e66ad,_0x5392fb){_0x5392fb=_0x5392fb||0xcc;return function(_0x1b7841){if(_0x1b7841){return _0x3e66ad['sendStatus'](_0x5392fb);}return _0x3e66ad['status'](_0x5392fb)[_0x1fe0('0x1d')]();};}function respondWithResult(_0x2fb250,_0x570d48){_0x570d48=_0x570d48||0xc8;return function(_0x1ff41c){if(_0x1ff41c){return _0x2fb250['status'](_0x570d48)[_0x1fe0('0x1e')](_0x1ff41c);}};}function respondWithFilteredResult(_0x326116,_0x555f6f){return function(_0x53b49a){if(_0x53b49a){var _0x19e526=typeof _0x555f6f[_0x1fe0('0x1f')]==='undefined'&&typeof _0x555f6f[_0x1fe0('0x20')]===_0x1fe0('0x21');var _0x45fa44=_0x53b49a[_0x1fe0('0x22')];var _0x55cbd4=_0x19e526?0x0:_0x555f6f[_0x1fe0('0x1f')];var _0x259aa2=_0x19e526?_0x53b49a['count']:_0x555f6f[_0x1fe0('0x1f')]+_0x555f6f[_0x1fe0('0x20')];var _0x31395f;if(_0x259aa2>=_0x45fa44){_0x259aa2=_0x45fa44;_0x31395f=0xc8;}else{_0x31395f=0xce;}_0x326116[_0x1fe0('0x23')](_0x31395f);return _0x326116['set'](_0x1fe0('0x24'),_0x55cbd4+'-'+_0x259aa2+'/'+_0x45fa44)[_0x1fe0('0x1e')](_0x53b49a);}return null;};}function patchUpdates(_0x538170){return function(_0x5af2d0){try{jsonpatch[_0x1fe0('0x25')](_0x5af2d0,_0x538170,!![]);}catch(_0x31c9b4){return BPromise['reject'](_0x31c9b4);}return _0x5af2d0[_0x1fe0('0x26')]();};}function saveUpdates(_0x38480e,_0x5def90){return function(_0xcd6bb7){if(_0xcd6bb7){return _0xcd6bb7['update'](_0x38480e)[_0x1fe0('0x27')](function(_0x2edb45){return _0x2edb45;});}return null;};}function removeEntity(_0x1be601,_0x1b6d9b){return function(_0x4d990e){if(_0x4d990e){return _0x4d990e['destroy']()[_0x1fe0('0x27')](function(){_0x1be601[_0x1fe0('0x23')](0xcc)[_0x1fe0('0x1d')]();});}};}function handleEntityNotFound(_0x11810d,_0x595b6c){return function(_0xb00cb0){if(!_0xb00cb0){_0x11810d[_0x1fe0('0x28')](0x194);}return _0xb00cb0;};}function handleError(_0x360b1b,_0x3e00dc){_0x3e00dc=_0x3e00dc||0x1f4;return function(_0x25bf05){logger['error'](_0x25bf05['stack']);if(_0x25bf05['name']){delete _0x25bf05['name'];}_0x360b1b['status'](_0x3e00dc)[_0x1fe0('0x29')](_0x25bf05);};}exports[_0x1fe0('0x2a')]=function(_0x141721,_0x1a60f3){var _0x12ef0d={},_0x543fc9={},_0x20030b={'count':0x0,'rows':[]};var _0x4de5c4=_[_0x1fe0('0x2b')](db['DeskField'][_0x1fe0('0x2c')],function(_0x2b248c){return{'name':_0x2b248c[_0x1fe0('0x2d')],'type':_0x2b248c[_0x1fe0('0x2e')][_0x1fe0('0x2f')]};});_0x543fc9['model']=_[_0x1fe0('0x2b')](_0x4de5c4,_0x1fe0('0x30'));_0x543fc9[_0x1fe0('0x31')]=_[_0x1fe0('0x32')](_0x141721['query']);_0x543fc9[_0x1fe0('0x33')]=_[_0x1fe0('0x34')](_0x543fc9[_0x1fe0('0x35')],_0x543fc9[_0x1fe0('0x31')]);_0x12ef0d['attributes']=_[_0x1fe0('0x34')](_0x543fc9[_0x1fe0('0x35')],qs[_0x1fe0('0x36')](_0x141721[_0x1fe0('0x31')][_0x1fe0('0x36')]));_0x12ef0d[_0x1fe0('0x37')]=_0x12ef0d[_0x1fe0('0x37')][_0x1fe0('0x38')]?_0x12ef0d[_0x1fe0('0x37')]:_0x543fc9[_0x1fe0('0x35')];if(!_0x141721[_0x1fe0('0x31')][_0x1fe0('0x39')]('nolimit')){_0x12ef0d[_0x1fe0('0x20')]=qs[_0x1fe0('0x20')](_0x141721['query'][_0x1fe0('0x20')]);_0x12ef0d['offset']=qs[_0x1fe0('0x1f')](_0x141721[_0x1fe0('0x31')][_0x1fe0('0x1f')]);}_0x12ef0d[_0x1fe0('0x3a')]=qs[_0x1fe0('0x3b')](_0x141721[_0x1fe0('0x31')]['sort']);_0x12ef0d['where']=qs[_0x1fe0('0x33')](_[_0x1fe0('0x3c')](_0x141721[_0x1fe0('0x31')],_0x543fc9[_0x1fe0('0x33')]),_0x4de5c4);if(_0x141721['query']['filter']){_0x12ef0d[_0x1fe0('0x3d')]=_['merge'](_0x12ef0d[_0x1fe0('0x3d')],{'$or':_[_0x1fe0('0x2b')](_0x4de5c4,function(_0x431314){if(_0x431314[_0x1fe0('0x2e')]!==_0x1fe0('0x3e')){var _0x4392b0={};_0x4392b0[_0x431314[_0x1fe0('0x30')]]={'$like':'%'+_0x141721[_0x1fe0('0x31')]['filter']+'%'};return _0x4392b0;}})});}_0x12ef0d=_[_0x1fe0('0x3f')]({},_0x12ef0d,_0x141721[_0x1fe0('0x40')]);var _0x253f7d={'where':_0x12ef0d['where']};return db[_0x1fe0('0x41')]['count'](_0x253f7d)[_0x1fe0('0x27')](function(_0x538910){_0x20030b[_0x1fe0('0x22')]=_0x538910;if(_0x141721[_0x1fe0('0x31')][_0x1fe0('0x42')]){_0x12ef0d[_0x1fe0('0x43')]=[{'all':!![]}];}return db[_0x1fe0('0x41')][_0x1fe0('0x44')](_0x12ef0d);})[_0x1fe0('0x27')](function(_0x218ddc){_0x20030b[_0x1fe0('0x45')]=_0x218ddc;return _0x20030b;})['then'](respondWithFilteredResult(_0x1a60f3,_0x12ef0d))[_0x1fe0('0x46')](handleError(_0x1a60f3,null));};exports[_0x1fe0('0x47')]=function(_0x410c41,_0x41025f){var _0x5a627a={'raw':!![],'where':{'id':_0x410c41['params']['id']}},_0x3bd69f={};_0x3bd69f[_0x1fe0('0x35')]=_[_0x1fe0('0x32')](db['DeskField']['rawAttributes']);_0x3bd69f['query']=_[_0x1fe0('0x32')](_0x410c41[_0x1fe0('0x31')]);_0x3bd69f[_0x1fe0('0x33')]=_['intersection'](_0x3bd69f['model'],_0x3bd69f[_0x1fe0('0x31')]);_0x5a627a['attributes']=_[_0x1fe0('0x34')](_0x3bd69f['model'],qs[_0x1fe0('0x36')](_0x410c41[_0x1fe0('0x31')][_0x1fe0('0x36')]));_0x5a627a[_0x1fe0('0x37')]=_0x5a627a['attributes'][_0x1fe0('0x38')]?_0x5a627a[_0x1fe0('0x37')]:_0x3bd69f[_0x1fe0('0x35')];if(_0x410c41[_0x1fe0('0x31')][_0x1fe0('0x42')]){_0x5a627a[_0x1fe0('0x43')]=[{'all':!![]}];}_0x5a627a=_[_0x1fe0('0x3f')]({},_0x5a627a,_0x410c41['options']);return db[_0x1fe0('0x41')][_0x1fe0('0x48')](_0x5a627a)[_0x1fe0('0x27')](handleEntityNotFound(_0x41025f,null))[_0x1fe0('0x27')](respondWithResult(_0x41025f,null))[_0x1fe0('0x46')](handleError(_0x41025f,null));};exports['create']=function(_0x5003e7,_0x3ca130){return db['DeskField'][_0x1fe0('0x49')](_0x5003e7[_0x1fe0('0x4a')],{})['then'](respondWithResult(_0x3ca130,0xc9))[_0x1fe0('0x46')](handleError(_0x3ca130,null));};exports[_0x1fe0('0x4b')]=function(_0x12218c,_0x2b4f23){if(_0x12218c[_0x1fe0('0x4a')]['id']){delete _0x12218c[_0x1fe0('0x4a')]['id'];}return db[_0x1fe0('0x41')][_0x1fe0('0x48')]({'where':{'id':_0x12218c[_0x1fe0('0x4c')]['id']}})[_0x1fe0('0x27')](handleEntityNotFound(_0x2b4f23,null))[_0x1fe0('0x27')](saveUpdates(_0x12218c[_0x1fe0('0x4a')],null))['then'](respondWithResult(_0x2b4f23,null))[_0x1fe0('0x46')](handleError(_0x2b4f23,null));};exports[_0x1fe0('0x4d')]=function(_0x19b4f9,_0x9e3c4c){return db[_0x1fe0('0x41')][_0x1fe0('0x48')]({'where':{'id':_0x19b4f9[_0x1fe0('0x4c')]['id']}})[_0x1fe0('0x27')](handleEntityNotFound(_0x9e3c4c,null))[_0x1fe0('0x27')](removeEntity(_0x9e3c4c,null))['catch'](handleError(_0x9e3c4c,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 48649e3..d09a9e4 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 _0xde68=['./intDeskField.attributes','exports','define','DeskField','desk_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xde68,0x117));var _0x8de6=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xde68[_0xa148b7];return _0x51efd3;};'use strict';var _=require('lodash');var util=require(_0x8de6('0x0'));var logger=require(_0x8de6('0x1'))(_0x8de6('0x2'));var moment=require(_0x8de6('0x3'));var BPromise=require(_0x8de6('0x4'));var rp=require(_0x8de6('0x5'));var fs=require('fs');var path=require(_0x8de6('0x6'));var rimraf=require(_0x8de6('0x7'));var config=require(_0x8de6('0x8'));var attributes=require(_0x8de6('0x9'));module[_0x8de6('0xa')]=function(_0x44ec68,_0x37d6ee){return _0x44ec68[_0x8de6('0xb')](_0x8de6('0xc'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x8de6('0xd'),'fields':[_0x8de6('0xe'),_0x8de6('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0a18=['idField','FieldId','lodash','moment','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index'];(function(_0x55d140,_0x5d70e4){var _0x1e20d6=function(_0x5c7a63){while(--_0x5c7a63){_0x55d140['push'](_0x55d140['shift']());}};_0x1e20d6(++_0x5d70e4);}(_0x0a18,0x152));var _0x80a1=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0x0a18[_0x2f45ea];return _0x485a84;};'use strict';var _=require(_0x80a1('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x80a1('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x80a1('0x2'));var config=require(_0x80a1('0x3'));var attributes=require(_0x80a1('0x4'));module[_0x80a1('0x5')]=function(_0x206be9,_0x22c2aa){return _0x206be9[_0x80a1('0x6')](_0x80a1('0x7'),attributes,{'tableName':_0x80a1('0x8'),'paranoid':![],'indexes':[{'name':_0x80a1('0x9'),'fields':[_0x80a1('0xa'),_0x80a1('0xb')],'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 7965b69..3c63c91 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 _0xc191=['jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0xaeed5a,_0x127687){var _0x3d424e=function(_0xebb8af){while(--_0xebb8af){_0xaeed5a['push'](_0xaeed5a['shift']());}};_0x3d424e(++_0x127687);}(_0xc191,0xad));var _0x1c19=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xc191[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0x1c19('0x0'));var util=require('util');var moment=require(_0x1c19('0x1'));var BPromise=require(_0x1c19('0x2'));var rs=require(_0x1c19('0x3'));var fs=require('fs');var Redis=require(_0x1c19('0x4'));var db=require(_0x1c19('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1c19('0x6'));var config=require('../../config/environment');var jayson=require(_0x1c19('0x7'));var client=jayson[_0x1c19('0x8')][_0x1c19('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x368057,_0x314a90,_0x43b974){return new BPromise(function(_0x4dcd77,_0x507eb9){return client[_0x1c19('0xa')](_0x368057,_0x43b974)[_0x1c19('0xb')](function(_0x35503b){logger[_0x1c19('0xc')](_0x1c19('0xd'),_0x314a90,'request\x20sent');logger['debug'](_0x1c19('0xe'),_0x314a90,_0x1c19('0xf'),JSON[_0x1c19('0x10')](_0x35503b));if(_0x35503b[_0x1c19('0x11')]){if(_0x35503b[_0x1c19('0x11')]['code']===0x1f4){logger[_0x1c19('0x11')](_0x1c19('0xd'),_0x314a90,_0x35503b[_0x1c19('0x11')][_0x1c19('0x12')]);return _0x507eb9(_0x35503b['error'][_0x1c19('0x12')]);}logger[_0x1c19('0x11')]('DeskField,\x20%s,\x20%s',_0x314a90,_0x35503b[_0x1c19('0x11')][_0x1c19('0x12')]);return _0x4dcd77(_0x35503b[_0x1c19('0x11')]['message']);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x314a90,_0x1c19('0xf'));_0x4dcd77(_0x35503b[_0x1c19('0x13')]['message']);}})['catch'](function(_0x34fafc){logger[_0x1c19('0x11')](_0x1c19('0xd'),_0x314a90,_0x34fafc);_0x507eb9(_0x34fafc);});});} \ No newline at end of file +var _0xfdf2=['client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x590851,_0x496bee){var _0x3b0115=function(_0x5140cc){while(--_0x5140cc){_0x590851['push'](_0x590851['shift']());}};_0x3b0115(++_0x496bee);}(_0xfdf2,0x11d));var _0x2fdf=function(_0x2a7135,_0x468748){_0x2a7135=_0x2a7135-0x0;var _0x337581=_0xfdf2[_0x2a7135];return _0x337581;};'use strict';var _=require(_0x2fdf('0x0'));var util=require(_0x2fdf('0x1'));var moment=require(_0x2fdf('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2fdf('0x3'));var db=require(_0x2fdf('0x4'))['db'];var utils=require(_0x2fdf('0x5'));var logger=require(_0x2fdf('0x6'))(_0x2fdf('0x7'));var config=require(_0x2fdf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2fdf('0x9')][_0x2fdf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x92977c,_0x4d32ee,_0x3969ae){return new BPromise(function(_0x6d1235,_0x429b67){return client[_0x2fdf('0xb')](_0x92977c,_0x3969ae)[_0x2fdf('0xc')](function(_0x430407){logger[_0x2fdf('0xd')](_0x2fdf('0xe'),_0x4d32ee,_0x2fdf('0xf'));logger[_0x2fdf('0x10')](_0x2fdf('0x11'),_0x4d32ee,'request\x20sent',JSON['stringify'](_0x430407));if(_0x430407['error']){if(_0x430407['error']['code']===0x1f4){logger[_0x2fdf('0x12')]('DeskField,\x20%s,\x20%s',_0x4d32ee,_0x430407[_0x2fdf('0x12')]['message']);return _0x429b67(_0x430407[_0x2fdf('0x12')][_0x2fdf('0x13')]);}logger[_0x2fdf('0x12')]('DeskField,\x20%s,\x20%s',_0x4d32ee,_0x430407[_0x2fdf('0x12')][_0x2fdf('0x13')]);return _0x6d1235(_0x430407['error'][_0x2fdf('0x13')]);}else{logger[_0x2fdf('0xd')](_0x2fdf('0xe'),_0x4d32ee,_0x2fdf('0xf'));_0x6d1235(_0x430407['result'][_0x2fdf('0x13')]);}})[_0x2fdf('0x14')](function(_0x3261a2){logger[_0x2fdf('0x12')](_0x2fdf('0xe'),_0x4d32ee,_0x3261a2);_0x429b67(_0x3261a2);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index d848f6a..e57b9be 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 _0xf0fc=['get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','update','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller'];(function(_0x14f16a,_0x2b4dc9){var _0x469b44=function(_0x44516b){while(--_0x44516b){_0x14f16a['push'](_0x14f16a['shift']());}};_0x469b44(++_0x2b4dc9);}(_0xf0fc,0x1b0));var _0xcf0f=function(_0x136618,_0x5dccb7){_0x136618=_0x136618-0x0;var _0x4b379c=_0xf0fc[_0x136618];return _0x4b379c;};'use strict';var multer=require(_0xcf0f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcf0f('0x1'));var express=require(_0xcf0f('0x2'));var router=express[_0xcf0f('0x3')]();var fs_extra=require(_0xcf0f('0x4'));var auth=require(_0xcf0f('0x5'));var interaction=require(_0xcf0f('0x6'));var config=require('../../config/environment');var controller=require(_0xcf0f('0x7'));router[_0xcf0f('0x8')]('/',auth[_0xcf0f('0x9')](),controller[_0xcf0f('0xa')]);router[_0xcf0f('0x8')](_0xcf0f('0xb'),auth['isAuthenticated'](),controller[_0xcf0f('0xc')]);router[_0xcf0f('0x8')](_0xcf0f('0xd'),auth[_0xcf0f('0x9')](),controller[_0xcf0f('0xe')]);router[_0xcf0f('0x8')]('/:id/fields',auth[_0xcf0f('0x9')](),controller[_0xcf0f('0xf')]);router[_0xcf0f('0x10')]('/',auth[_0xcf0f('0x9')](),controller[_0xcf0f('0x11')]);router[_0xcf0f('0x10')](_0xcf0f('0xd'),auth[_0xcf0f('0x9')](),controller[_0xcf0f('0x12')]);router['put'](_0xcf0f('0xb'),auth[_0xcf0f('0x9')](),controller[_0xcf0f('0x13')]);router['delete'](_0xcf0f('0xb'),auth[_0xcf0f('0x9')](),controller[_0xcf0f('0x14')]);module[_0xcf0f('0x15')]=router; \ No newline at end of file +var _0xa335=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','show','/:id/configurations','getFields','post','addConfiguration','put','delete','destroy'];(function(_0x314b3f,_0x50fb0c){var _0x1d955d=function(_0x5eb3bf){while(--_0x5eb3bf){_0x314b3f['push'](_0x314b3f['shift']());}};_0x1d955d(++_0x50fb0c);}(_0xa335,0x155));var _0x5a33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa335[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x5a33('0x0'));var util=require(_0x5a33('0x1'));var path=require(_0x5a33('0x2'));var timeout=require(_0x5a33('0x3'));var express=require('express');var router=express[_0x5a33('0x4')]();var fs_extra=require(_0x5a33('0x5'));var auth=require(_0x5a33('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5a33('0x7'));var controller=require('./intDynamics365Account.controller');router[_0x5a33('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5a33('0x8')](_0x5a33('0x9'),auth[_0x5a33('0xa')](),controller[_0x5a33('0xb')]);router[_0x5a33('0x8')](_0x5a33('0xc'),auth[_0x5a33('0xa')](),controller['getConfigurations']);router[_0x5a33('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x5a33('0xd')]);router[_0x5a33('0xe')]('/',auth[_0x5a33('0xa')](),controller['create']);router['post'](_0x5a33('0xc'),auth[_0x5a33('0xa')](),controller[_0x5a33('0xf')]);router[_0x5a33('0x10')](_0x5a33('0x9'),auth[_0x5a33('0xa')](),controller['update']);router[_0x5a33('0x11')](_0x5a33('0x9'),auth[_0x5a33('0xa')](),controller[_0x5a33('0x12')]);module[_0x5a33('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index bb2c79a..f08ea7e 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 _0x92e0=['BOOLEAN','sequelize','STRING'];(function(_0x21f381,_0x5294d7){var _0x18eb95=function(_0x211c95){while(--_0x211c95){_0x21f381['push'](_0x21f381['shift']());}};_0x18eb95(++_0x5294d7);}(_0x92e0,0x154));var _0x092e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x92e0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x092e('0x0'));module['exports']={'name':{'type':Sequelize[_0x092e('0x1')]},'username':{'type':Sequelize[_0x092e('0x1')]},'password':{'type':Sequelize[_0x092e('0x1')]},'remoteUri':{'type':Sequelize[_0x092e('0x1')]},'tenantId':{'type':Sequelize[_0x092e('0x1')]},'clientId':{'type':Sequelize[_0x092e('0x1')]},'clientSecret':{'type':Sequelize[_0x092e('0x1')]},'serverUrl':{'type':Sequelize[_0x092e('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x092e('0x1')]},'modernAuthentication':{'type':Sequelize[_0x092e('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x64f5=['BOOLEAN','sequelize','STRING'];(function(_0x1fe9dd,_0x56413a){var _0x3c3ea4=function(_0x1b8adc){while(--_0x1b8adc){_0x1fe9dd['push'](_0x1fe9dd['shift']());}};_0x3c3ea4(++_0x56413a);}(_0x64f5,0x17e));var _0x564f=function(_0x562a3e,_0x1555a9){_0x562a3e=_0x562a3e-0x0;var _0x36f672=_0x64f5[_0x562a3e];return _0x36f672;};'use strict';var Sequelize=require(_0x564f('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x564f('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x564f('0x1')]},'clientId':{'type':Sequelize[_0x564f('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x564f('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x564f('0x1')]},'modernAuthentication':{'type':Sequelize[_0x564f('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 49366d8..ef96d23 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 _0x68cc=[')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','DisplayName','request-promise','util','../../components/parsers/qs','api','status','json','offset','undefined','limit','count','set','then','destroy','end','sendStatus','error','stack','name','index','rawAttributes','model','map','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','Dynamics365Account','findAll','rows','catch','params','keys','options','find','create','body','update','Dynamics365Configuration','order','getConfigurations','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','Subjects','slice','substring','lastIndexOf','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','title','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyyominame','numberofchildincidents','onholdtime','owneridtype','primarycontactidname','prioritycodename','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','concat','username','password','tenantId','clientId','modernAuthentication','CloudProvider','data7','remoteUri','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','MetadataId','EntityDefinitions(','4.0','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','send','test'];(function(_0x9c02e8,_0x51b776){var _0x4cfc38=function(_0x4a2276){while(--_0x4a2276){_0x9c02e8['push'](_0x9c02e8['shift']());}};_0x4cfc38(++_0x51b776);}(_0x68cc,0xc1));var _0xc68c=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x68cc[_0x138adb];return _0x1b27f2;};'use strict';var rp=require(_0xc68c('0x0'));var util=require(_0xc68c('0x1'));var _=require('lodash');var qs=require(_0xc68c('0x2'));var logger=require('../../config/logger')(_0xc68c('0x3'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x5f2532,_0x132ce0){_0x132ce0=_0x132ce0||0xc8;return function(_0x3fca3d){if(_0x3fca3d){return _0x5f2532[_0xc68c('0x4')](_0x132ce0)[_0xc68c('0x5')](_0x3fca3d);}};}function respondWithFilteredResult(_0x38bb05,_0x1f10b7){return function(_0x43cdff){if(_0x43cdff){var _0x3c3cb6=typeof _0x1f10b7[_0xc68c('0x6')]===_0xc68c('0x7')&&typeof _0x1f10b7[_0xc68c('0x8')]===_0xc68c('0x7');var _0xefbd8b=_0x43cdff[_0xc68c('0x9')];var _0x225e0e=_0x3c3cb6?0x0:_0x1f10b7[_0xc68c('0x6')];var _0x4b22d3=_0x3c3cb6?_0x43cdff[_0xc68c('0x9')]:_0x1f10b7[_0xc68c('0x6')]+_0x1f10b7[_0xc68c('0x8')];var _0xb0c791;if(_0x4b22d3>=_0xefbd8b){_0x4b22d3=_0xefbd8b;_0xb0c791=0xc8;}else{_0xb0c791=0xce;}_0x38bb05[_0xc68c('0x4')](_0xb0c791);return _0x38bb05[_0xc68c('0xa')]('Content-Range',_0x225e0e+'-'+_0x4b22d3+'/'+_0xefbd8b)[_0xc68c('0x5')](_0x43cdff);}return null;};}function saveUpdates(_0x5561da){return function(_0x4e98f7){if(_0x4e98f7){return _0x4e98f7['update'](_0x5561da)[_0xc68c('0xb')](function(_0x3d7bc4){return _0x3d7bc4;});}return null;};}function removeEntity(_0x79fafd){return function(_0x1cba1c){if(_0x1cba1c){return _0x1cba1c[_0xc68c('0xc')]()[_0xc68c('0xb')](function(){_0x79fafd[_0xc68c('0x4')](0xcc)[_0xc68c('0xd')]();});}};}function handleEntityNotFound(_0x4d0488){return function(_0x500c3a){if(!_0x500c3a){_0x4d0488[_0xc68c('0xe')](0x194);}return _0x500c3a;};}function handleError(_0x30dc15,_0x3aab3){_0x3aab3=_0x3aab3||0x1f4;return function(_0x133c50){logger[_0xc68c('0xf')](_0x133c50[_0xc68c('0x10')]);if(_0x133c50['name']){delete _0x133c50[_0xc68c('0x11')];}_0x30dc15[_0xc68c('0x4')](_0x3aab3)['send'](_0x133c50);};}exports[_0xc68c('0x12')]=function(_0x4bf102,_0x4f192c){var _0x31f50a={},_0x353a18={},_0x13acce={'count':0x0,'rows':[]};var _0x601a9e=_['map'](db['Dynamics365Account'][_0xc68c('0x13')],function(_0x1c747e){return{'name':_0x1c747e['fieldName'],'type':_0x1c747e['type']['key']};});_0x353a18[_0xc68c('0x14')]=_[_0xc68c('0x15')](_0x601a9e,'name');_0x353a18[_0xc68c('0x16')]=_['keys'](_0x4bf102['query']);_0x353a18['filters']=_['intersection'](_0x353a18['model'],_0x353a18['query']);_0x31f50a[_0xc68c('0x17')]=_[_0xc68c('0x18')](_0x353a18['model'],qs[_0xc68c('0x19')](_0x4bf102[_0xc68c('0x16')][_0xc68c('0x19')]));_0x31f50a['attributes']=_0x31f50a[_0xc68c('0x17')][_0xc68c('0x1a')]?_0x31f50a['attributes']:_0x353a18[_0xc68c('0x14')];if(!_0x4bf102['query'][_0xc68c('0x1b')](_0xc68c('0x1c'))){_0x31f50a[_0xc68c('0x8')]=qs['limit'](_0x4bf102[_0xc68c('0x16')][_0xc68c('0x8')]);_0x31f50a['offset']=qs['offset'](_0x4bf102[_0xc68c('0x16')][_0xc68c('0x6')]);}_0x31f50a['order']=qs[_0xc68c('0x1d')](_0x4bf102['query'][_0xc68c('0x1d')]);_0x31f50a[_0xc68c('0x1e')]=qs[_0xc68c('0x1f')](_[_0xc68c('0x20')](_0x4bf102[_0xc68c('0x16')],_0x353a18[_0xc68c('0x1f')]),_0x601a9e);if(_0x4bf102[_0xc68c('0x16')][_0xc68c('0x21')]){_0x31f50a['where']=_[_0xc68c('0x22')](_0x31f50a[_0xc68c('0x1e')],{'$or':_[_0xc68c('0x15')](_0x601a9e,function(_0x1215ed){if(_0x1215ed[_0xc68c('0x23')]!==_0xc68c('0x24')){var _0x411b5e={};_0x411b5e[_0x1215ed[_0xc68c('0x11')]]={'$like':'%'+_0x4bf102[_0xc68c('0x16')][_0xc68c('0x21')]+'%'};return _0x411b5e;}})});}_0x31f50a=_[_0xc68c('0x22')]({},_0x31f50a,_0x4bf102['options']);var _0x693aa8={'where':_0x31f50a[_0xc68c('0x1e')]};return db['Dynamics365Account'][_0xc68c('0x9')](_0x693aa8)['then'](function(_0x31ba5c){_0x13acce[_0xc68c('0x9')]=_0x31ba5c;if(_0x4bf102['query'][_0xc68c('0x25')]){_0x31f50a[_0xc68c('0x26')]=[{'all':!![]}];}return db[_0xc68c('0x27')][_0xc68c('0x28')](_0x31f50a);})[_0xc68c('0xb')](function(_0x19e913){_0x13acce[_0xc68c('0x29')]=_0x19e913;return _0x13acce;})[_0xc68c('0xb')](respondWithFilteredResult(_0x4f192c,_0x31f50a))[_0xc68c('0x2a')](handleError(_0x4f192c,null));};exports['show']=function(_0xd6006c,_0x5b9132){var _0x33c29f={'raw':![],'where':{'id':_0xd6006c[_0xc68c('0x2b')]['id']}},_0x4d5c1f={};_0x4d5c1f[_0xc68c('0x14')]=_[_0xc68c('0x2c')](db[_0xc68c('0x27')][_0xc68c('0x13')]);_0x4d5c1f['query']=_[_0xc68c('0x2c')](_0xd6006c[_0xc68c('0x16')]);_0x4d5c1f[_0xc68c('0x1f')]=_[_0xc68c('0x18')](_0x4d5c1f[_0xc68c('0x14')],_0x4d5c1f['query']);_0x33c29f['attributes']=_[_0xc68c('0x18')](_0x4d5c1f[_0xc68c('0x14')],qs['fields'](_0xd6006c[_0xc68c('0x16')]['fields']));_0x33c29f[_0xc68c('0x17')]=_0x33c29f['attributes']['length']?_0x33c29f[_0xc68c('0x17')]:_0x4d5c1f[_0xc68c('0x14')];if(_0xd6006c['query'][_0xc68c('0x25')]){_0x33c29f[_0xc68c('0x26')]=[{'all':!![]}];}_0x33c29f=_[_0xc68c('0x22')]({},_0x33c29f,_0xd6006c[_0xc68c('0x2d')]);return db['Dynamics365Account'][_0xc68c('0x2e')](_0x33c29f)[_0xc68c('0xb')](handleEntityNotFound(_0x5b9132,null))[_0xc68c('0xb')](respondWithResult(_0x5b9132,null))['catch'](handleError(_0x5b9132,null));};exports[_0xc68c('0x2f')]=function(_0x26bad6,_0x2cfe6a){return db[_0xc68c('0x27')][_0xc68c('0x2f')](_0x26bad6[_0xc68c('0x30')],{})['then'](respondWithResult(_0x2cfe6a,0xc9))[_0xc68c('0x2a')](handleError(_0x2cfe6a,null));};exports[_0xc68c('0x31')]=function(_0x2dfac4,_0x1ca704){if(_0x2dfac4[_0xc68c('0x30')]['id']){delete _0x2dfac4['body']['id'];}return db[_0xc68c('0x27')][_0xc68c('0x2e')]({'where':{'id':_0x2dfac4[_0xc68c('0x2b')]['id']}})[_0xc68c('0xb')](handleEntityNotFound(_0x1ca704,null))[_0xc68c('0xb')](saveUpdates(_0x2dfac4['body'],null))['then'](respondWithResult(_0x1ca704,null))[_0xc68c('0x2a')](handleError(_0x1ca704,null));};exports[_0xc68c('0xc')]=function(_0x1b5872,_0x38e6ef){return db[_0xc68c('0x27')]['find']({'where':{'id':_0x1b5872[_0xc68c('0x2b')]['id']}})[_0xc68c('0xb')](handleEntityNotFound(_0x38e6ef,null))[_0xc68c('0xb')](removeEntity(_0x38e6ef,null))[_0xc68c('0x2a')](handleError(_0x38e6ef,null));};exports['getConfigurations']=function(_0x17cf46,_0x22c4dd){var _0x5d8dba={};var _0x3814c5={};var _0x336d5f;var _0x32efdb;return db['Dynamics365Account']['findOne']({'where':{'id':_0x17cf46[_0xc68c('0x2b')]['id']}})[_0xc68c('0xb')](handleEntityNotFound(_0x22c4dd,null))[_0xc68c('0xb')](function(_0xc6cd1){if(_0xc6cd1){_0x336d5f=_0xc6cd1;_0x3814c5['model']=_[_0xc68c('0x2c')](db[_0xc68c('0x32')][_0xc68c('0x13')]);_0x3814c5['query']=_['keys'](_0x17cf46[_0xc68c('0x16')]);_0x3814c5[_0xc68c('0x1f')]=_[_0xc68c('0x18')](_0x3814c5[_0xc68c('0x14')],_0x3814c5[_0xc68c('0x16')]);_0x5d8dba[_0xc68c('0x17')]=_[_0xc68c('0x18')](_0x3814c5[_0xc68c('0x14')],qs[_0xc68c('0x19')](_0x17cf46['query'][_0xc68c('0x19')]));_0x5d8dba[_0xc68c('0x17')]=_0x5d8dba[_0xc68c('0x17')][_0xc68c('0x1a')]?_0x5d8dba[_0xc68c('0x17')]:_0x3814c5[_0xc68c('0x14')];_0x5d8dba[_0xc68c('0x33')]=qs[_0xc68c('0x1d')](_0x17cf46[_0xc68c('0x16')][_0xc68c('0x1d')]);_0x5d8dba[_0xc68c('0x1e')]=qs[_0xc68c('0x1f')](_[_0xc68c('0x20')](_0x17cf46['query'],_0x3814c5[_0xc68c('0x1f')]));if(_0x17cf46[_0xc68c('0x16')][_0xc68c('0x21')]){_0x5d8dba[_0xc68c('0x1e')]=_[_0xc68c('0x22')](_0x5d8dba[_0xc68c('0x1e')],{'$or':_[_0xc68c('0x15')](_0x5d8dba[_0xc68c('0x17')],function(_0x20771f){var _0x304a90={};_0x304a90[_0x20771f]={'$like':'%'+_0x17cf46[_0xc68c('0x16')][_0xc68c('0x21')]+'%'};return _0x304a90;})});}_0x5d8dba=_[_0xc68c('0x22')]({},_0x5d8dba,_0x17cf46[_0xc68c('0x2d')]);return _0x336d5f[_0xc68c('0x34')](_0x5d8dba);}})[_0xc68c('0xb')](function(_0x2a0bf2){if(_0x2a0bf2){_0x32efdb=_0x2a0bf2[_0xc68c('0x1a')];if(!_0x17cf46[_0xc68c('0x16')][_0xc68c('0x1b')](_0xc68c('0x1c'))){_0x5d8dba[_0xc68c('0x8')]=qs[_0xc68c('0x8')](_0x17cf46[_0xc68c('0x16')]['limit']);_0x5d8dba[_0xc68c('0x6')]=qs[_0xc68c('0x6')](_0x17cf46[_0xc68c('0x16')][_0xc68c('0x6')]);}return _0x336d5f[_0xc68c('0x34')](_0x5d8dba);}})['then'](function(_0x3a7c78){if(_0x3a7c78){return _0x3a7c78?{'count':_0x32efdb,'rows':_0x3a7c78}:null;}})[_0xc68c('0xb')](respondWithResult(_0x22c4dd,null))['catch'](handleError(_0x22c4dd,null));};exports['addConfiguration']=function(_0x17410a,_0x3fe778){if(_0x17410a[_0xc68c('0x30')]['id']){delete _0x17410a[_0xc68c('0x30')]['id'];}return db['Dynamics365Account'][_0xc68c('0x35')]({'where':{'id':_0x17410a['params']['id']}})['then'](handleEntityNotFound(_0x3fe778,null))[_0xc68c('0xb')](function(_0x219f69){if(_0x219f69){_0x17410a['body'][_0xc68c('0x36')]=_0x219f69['id'];_0x17410a[_0xc68c('0x30')]['Subjects']=integrations[_0xc68c('0x37')](_0x17410a[_0xc68c('0x30')][_0xc68c('0x38')],_0x17410a[_0xc68c('0x30')]['type']);_0x17410a[_0xc68c('0x30')][_0xc68c('0x39')]=integrations[_0xc68c('0x3a')](_0x17410a[_0xc68c('0x30')][_0xc68c('0x38')],_0x17410a['body'][_0xc68c('0x23')]);return db[_0xc68c('0x32')]['create'](_0x17410a['body'],{'include':[{'model':db['Dynamics365Field'],'as':_0xc68c('0x3b')},{'model':db['Dynamics365Field'],'as':_0xc68c('0x39')}]});}return null;})['then'](respondWithResult(_0x3fe778,null))['catch'](handleError(_0x3fe778,null));};function sanitizeRemoteUri(_0x5a2214){var _0x589610=_0x5a2214[_0xc68c('0x3c')](-0x1);if(_0x589610==='/')return _0x5a2214[_0xc68c('0x3d')](0x0,_0x5a2214[_0xc68c('0x3e')](_0x589610));return _0x5a2214;}function getWebApiUrl(_0x49aa95){return util['format'](_0xc68c('0x3f'),_0x49aa95);}exports[_0xc68c('0x40')]=function(_0x409a95,_0x386107){var _0x110155=_0x409a95['query'][_0xc68c('0x41')];var _0x5a232a=_0x110155===_0xc68c('0x42')?_0xc68c('0x43'):'PhoneCall';var _0x5c9d5a='';var _0x39501f='';var _0x3066a5='';var _0xd78b3f='';var _0x44a66e='';var _0x387558='';var _0xc70642='';var _0x3f3725='';var _0x4f5db5=[_0xc68c('0x44'),_0xc68c('0x45'),_0xc68c('0x46'),_0xc68c('0x47'),_0xc68c('0x48'),'subject',_0xc68c('0x49'),_0xc68c('0x4a'),_0xc68c('0x4b'),'phonecall_activity_parties'];var _0xde6a4a=[_0xc68c('0x4c'),_0xc68c('0x4d'),_0xc68c('0x4e'),_0xc68c('0x4f'),_0xc68c('0x50'),_0xc68c('0x51'),_0xc68c('0x52'),_0xc68c('0x53'),'createdbyexternalpartyname',_0xc68c('0x54'),_0xc68c('0x55'),_0xc68c('0x56'),_0xc68c('0x57'),_0xc68c('0x58'),_0xc68c('0x59'),_0xc68c('0x5a'),_0xc68c('0x5b'),_0xc68c('0x5c'),_0xc68c('0x5d'),_0xc68c('0x5e'),_0xc68c('0x5f'),_0xc68c('0x60'),_0xc68c('0x61'),_0xc68c('0x62'),_0xc68c('0x63'),_0xc68c('0x64'),_0xc68c('0x65'),'influencescore',_0xc68c('0x66'),_0xc68c('0x67'),_0xc68c('0x68'),'modifiedbyexternalpartyname','modifiedbyexternalpartyyominame',_0xc68c('0x69'),_0xc68c('0x6a'),'modifiedon','modifiedonbehalfbyname',_0xc68c('0x6b'),'msdyn_incidenttypename','msdyn_iotalertname',_0xc68c('0x6c'),_0xc68c('0x6d'),'overriddencreatedon','owneridname',_0xc68c('0x6e'),'owneridyominame','parentcaseidname',_0xc68c('0x6f'),'primarycontactidyominame',_0xc68c('0x70'),'productidname','productserialnumber',_0xc68c('0x71'),_0xc68c('0x72'),_0xc68c('0x73'),_0xc68c('0x74'),'responsiblecontactidyominame','sentimentvalue',_0xc68c('0x75'),_0xc68c('0x76'),_0xc68c('0x77'),_0xc68c('0x78'),_0xc68c('0x79'),'subjectidname',_0xc68c('0x7a'),_0xc68c('0x7b'),'transactioncurrencyidname',_0xc68c('0x7c'),_0xc68c('0x7d'),'versionnumber'];var _0x59d53d=_0x4f5db5[_0xc68c('0x7e')](_0xde6a4a);return db[_0xc68c('0x27')][_0xc68c('0x35')]({'where':{'id':_0x409a95[_0xc68c('0x2b')]['id']},'attributes':['id',_0xc68c('0x7f'),_0xc68c('0x80'),'remoteUri',_0xc68c('0x81'),_0xc68c('0x82'),'clientSecret',_0xc68c('0x83')],'include':[{'model':db['CloudProvider'],'as':_0xc68c('0x84'),'attributes':['id','data5','data7']}]})['then'](handleEntityNotFound(_0x386107,null))['then'](function(_0x5f1fa8){if(_0x5f1fa8){if(_0x5f1fa8[_0xc68c('0x83')]){_0x5f1fa8['access_token']=_0x5f1fa8[_0xc68c('0x84')]['data5'];_0x3f3725=sanitizeRemoteUri(_0x5f1fa8[_0xc68c('0x84')][_0xc68c('0x85')]);_0xc70642=getWebApiUrl(_0x3f3725);return _0x5f1fa8;}_0x3f3725=sanitizeRemoteUri(_0x5f1fa8[_0xc68c('0x86')]);_0xc70642=getWebApiUrl(_0x3f3725);var _0x582f6e={'method':_0xc68c('0x87'),'uri':_0xc68c('0x88')+_0x5f1fa8[_0xc68c('0x81')]+_0xc68c('0x89'),'form':{'client_id':_0x5f1fa8[_0xc68c('0x82')],'resource':_0x3f3725,'username':_0x5f1fa8['username'],'password':_0x5f1fa8[_0xc68c('0x80')],'grant_type':'password','client_secret':_0x5f1fa8['clientSecret']},'json':!![]};return rp(_0x582f6e);}})['then'](function(_0x6c7a6b){_0x387558=_0x6c7a6b[_0xc68c('0x8a')];var _0x35c734={'method':_0xc68c('0x8b'),'uri':encodeURI(_0xc70642+_0xc68c('0x8c')+_0x5a232a+'\x27'),'headers':{'Authorization':_0xc68c('0x8d')+_0x387558,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x35c734);})['then'](function(_0x21baee){var _0x2abf17=_0x21baee['value'][0x0];var _0x58fbf9=_0x2abf17[_0xc68c('0x8e')];var _0x48c601={'method':_0xc68c('0x8b'),'uri':_0xc70642+_0xc68c('0x8f')+_0x58fbf9+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x387558,'If-None-Match':null,'OData-Version':_0xc68c('0x90')},'json':!![]};return rp(_0x48c601);})[_0xc68c('0xb')](function(_0x3583f2){_0x5c9d5a=_0x3583f2;_0x39501f=_0x5c9d5a['Attributes'];_0x39501f=_['remove'](_0x39501f,function(_0x184e0c){return!_0x59d53d[_0xc68c('0x91')](_0x184e0c[_0xc68c('0x92')]);});var _0x321a5f=[];var _0x516a5e=[];_0x39501f[_0xc68c('0x93')](function(_0x254e52){if(_0x254e52[_0xc68c('0x94')]){var _0x3dae22=_0x254e52['@odata.type']['substring'](_0x254e52[_0xc68c('0x94')]['lastIndexOf']('.')+0x1);if(_0x3dae22===_0xc68c('0x95')){_0x321a5f[_0xc68c('0x96')](getSelectList(_0xc70642,_0x110155,_0x516a5e,_0x5c9d5a[_0xc68c('0x8e')],_0x254e52['MetadataId'],_0x387558));}}});return Promise[_0xc68c('0x97')](_0x321a5f);})[_0xc68c('0xb')](function(_0x9d88bd){_0x3066a5=_0x9d88bd[0x0];var _0x126dfd=[];var _0x3e792c=[];_0x39501f['forEach'](function(_0x3e1860){if(!_[_0xc68c('0x98')](_0x3e1860['@odata.type'])){var _0x90c196=_0x3e1860['@odata.type']['substring'](_0x3e1860[_0xc68c('0x94')][_0xc68c('0x3e')]('.')+0x1);if(_0x90c196===_0xc68c('0x99')){_0x126dfd[_0xc68c('0x96')](getBooleanList(_0xc70642,_0x110155,_0x3e792c,_0x5c9d5a[_0xc68c('0x8e')],_0x3e1860['MetadataId'],_0x387558));}}});return Promise[_0xc68c('0x97')](_0x126dfd);})[_0xc68c('0xb')](function(_0x8148d7){_0xd78b3f=_0x8148d7[0x0];var _0x3611ae=[];var _0x577d42=[];_0x39501f[_0xc68c('0x93')](function(_0xa673d3){if(_0xa673d3[_0xc68c('0x94')]){var _0x3e9493=_0xa673d3[_0xc68c('0x94')]['substring'](_0xa673d3[_0xc68c('0x94')]['lastIndexOf']('.')+0x1);if(_0x3e9493===_0xc68c('0x9a')||_0x3e9493===_0xc68c('0x9b')||_0x3e9493===_0xc68c('0x9c')||_0x3e9493==='IntegerAttributeMetadata'||_0x3e9493===_0xc68c('0x9d')||_0x3e9493==='DateTimeAttributeMetadata'||_0x3e9493===_0xc68c('0x9e')||_0x3e9493===_0xc68c('0x9f')||_0x3e9493===_0xc68c('0xa0')||_0x3e9493===_0xc68c('0xa1')){_0x3611ae['push'](getInputList(_0xc70642,_0x110155,_0x3e9493,_0x577d42,_0x5c9d5a[_0xc68c('0x8e')],_0xa673d3[_0xc68c('0x8e')],_0x387558));}}});return Promise[_0xc68c('0x97')](_0x3611ae);})[_0xc68c('0xb')](function(_0x12e475){_0x44a66e=_0x12e475[0x0];var _0x133fda=_0x3066a5[_0xc68c('0x7e')](_0xd78b3f)[_0xc68c('0x7e')](_0x44a66e);var _0x5cdf4c={'count':_0x133fda[_0xc68c('0x1a')],'rows':_0x133fda};return _0x5cdf4c;})[_0xc68c('0xb')](respondWithResult(_0x386107,null))[_0xc68c('0x2a')](function(_0x4b4132){var _0x426fb5=_0x409a95[_0xc68c('0x16')]['test']?0x1f4:_0x4b4132[_0xc68c('0xa2')]||0x1f4;logger[_0xc68c('0xf')](_0x4b4132[_0xc68c('0x10')]);delete _0x4b4132[_0xc68c('0x11')];if(_0x426fb5===0x191){_0x426fb5=0x190;}_0x386107[_0xc68c('0x4')](_0x426fb5)[_0xc68c('0xa3')](_0x409a95[_0xc68c('0x16')][_0xc68c('0xa4')]?{'message':'Wrong\x20credentials','statusCode':_0x4b4132[_0xc68c('0xa2')]}:_0x4b4132);});};function getSelectList(_0x3997d3,_0x5618b1,_0x443438,_0x1720c3,_0x2d31ec,_0x117a25){var _0x46018c={'method':_0xc68c('0x8b'),'uri':_0x3997d3+_0xc68c('0x8f')+_0x1720c3+_0xc68c('0xa5')+_0x2d31ec+_0xc68c('0xa6')+_0xc68c('0xa7'),'headers':{'Authorization':_0xc68c('0x8d')+_0x117a25,'If-None-Match':null,'OData-Version':_0xc68c('0x90')},'json':!![]};return rp(_0x46018c)[_0xc68c('0xb')](function(_0x4c5310){var _0x22cd09=[];var _0x528473=_0x4c5310[_0xc68c('0xa8')][_0xc68c('0xa9')];_0x528473[_0xc68c('0x93')](function(_0x3b8233){_0x22cd09[_0xc68c('0x96')]({'name':_0x3b8233[_0xc68c('0xaa')][_0xc68c('0xab')][_0xc68c('0xaa')],'value':String(_0x3b8233[_0xc68c('0xac')])});});var _0x458fa2={'id':_0x5618b1+'_'+_0x4c5310[_0xc68c('0x92')],'name':_0x4c5310['DisplayName'][_0xc68c('0xab')][_0xc68c('0xaa')],'custom':![],'options':_0x22cd09};_0x443438[_0xc68c('0x96')](_0x458fa2);return _0x443438;});}function getBooleanList(_0x5a7ce9,_0xd30fe7,_0x352e34,_0x3c2400,_0x2dd17e,_0x2e6e44){var _0x5c2dd8={'method':_0xc68c('0x8b'),'uri':_0x5a7ce9+_0xc68c('0x8f')+_0x3c2400+_0xc68c('0xa5')+_0x2dd17e+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xc68c('0x8d')+_0x2e6e44,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5c2dd8)[_0xc68c('0xb')](function(_0xf5ee53){var _0x427f56=[];_0x427f56[_0xc68c('0x96')]({'name':_0xf5ee53[_0xc68c('0xa8')][_0xc68c('0xad')]['Label'][_0xc68c('0xab')][_0xc68c('0xaa')],'value':_0xc68c('0xae')},{'name':_0xf5ee53[_0xc68c('0xa8')][_0xc68c('0xaf')]['Label'][_0xc68c('0xab')][_0xc68c('0xaa')],'value':_0xc68c('0xb0')});var _0xee1088={'id':_0xd30fe7+'_'+_0xf5ee53[_0xc68c('0x92')],'name':_0xf5ee53['DisplayName'][_0xc68c('0xab')][_0xc68c('0xaa')],'custom':![],'options':_0x427f56};_0x352e34['push'](_0xee1088);return _0x352e34;});}function getInputList(_0x20c4c5,_0x1f90c8,_0x74413e,_0x35e34e,_0x45f665,_0x1472c2,_0x234172){var _0x50b2c1={'method':_0xc68c('0x8b'),'uri':_0x20c4c5+_0xc68c('0x8f')+_0x45f665+_0xc68c('0xa5')+_0x1472c2+_0xc68c('0xb1')+_0x74413e+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xc68c('0x8d')+_0x234172,'If-None-Match':null,'OData-Version':_0xc68c('0x90')},'json':!![]};return rp(_0x50b2c1)[_0xc68c('0xb')](function(_0x474ead){var _0x4bbb9a={'id':_0x1f90c8+'_'+_0x474ead['LogicalName'],'name':_0x474ead[_0xc68c('0xb2')]['UserLocalizedLabel']?_0x474ead[_0xc68c('0xb2')][_0xc68c('0xab')]['Label']:_0x474ead['LogicalName'],'custom':![],'options':[]};_0x35e34e[_0xc68c('0x96')](_0x4bbb9a);return _0x35e34e;});} \ No newline at end of file +var _0x1794=['BooleanAttributeMetadata','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','push','concat','statusCode','send','test','Wrong\x20credentials','GET',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName','TrueOption','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','update','then','end','sendStatus','error','stack','name','index','Dynamics365Account','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','include','rows','catch','length','includeAll','options','create','find','params','destroy','getConfigurations','findOne','Dynamics365Configuration','order','addConfiguration','body','getSubjects','channel','Descriptions','Dynamics365Field','Subjects','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','Incident','PhoneCall','title','description','ownerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','socialprofileidname','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','access_token','data7','/oauth2/token','username','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata'];(function(_0x425f0a,_0xfdfaf3){var _0xf52814=function(_0x309533){while(--_0x309533){_0x425f0a['push'](_0x425f0a['shift']());}};_0xf52814(++_0xfdfaf3);}(_0x1794,0x19d));var _0x4179=function(_0x551fde,_0x273edd){_0x551fde=_0x551fde-0x0;var _0x4be2eb=_0x1794[_0x551fde];return _0x4be2eb;};'use strict';var rp=require('request-promise');var util=require('util');var _=require(_0x4179('0x0'));var qs=require(_0x4179('0x1'));var logger=require(_0x4179('0x2'))(_0x4179('0x3'));var db=require(_0x4179('0x4'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x5c14ac,_0x338291){_0x338291=_0x338291||0xc8;return function(_0x144830){if(_0x144830){return _0x5c14ac[_0x4179('0x5')](_0x338291)[_0x4179('0x6')](_0x144830);}};}function respondWithFilteredResult(_0x37d5f7,_0x840dda){return function(_0xcfdd0b){if(_0xcfdd0b){var _0x24f3ff=typeof _0x840dda[_0x4179('0x7')]===_0x4179('0x8')&&typeof _0x840dda['limit']===_0x4179('0x8');var _0x1e52a6=_0xcfdd0b[_0x4179('0x9')];var _0x5ed1c6=_0x24f3ff?0x0:_0x840dda[_0x4179('0x7')];var _0x591de5=_0x24f3ff?_0xcfdd0b[_0x4179('0x9')]:_0x840dda['offset']+_0x840dda[_0x4179('0xa')];var _0x5ad5e7;if(_0x591de5>=_0x1e52a6){_0x591de5=_0x1e52a6;_0x5ad5e7=0xc8;}else{_0x5ad5e7=0xce;}_0x37d5f7[_0x4179('0x5')](_0x5ad5e7);return _0x37d5f7[_0x4179('0xb')](_0x4179('0xc'),_0x5ed1c6+'-'+_0x591de5+'/'+_0x1e52a6)['json'](_0xcfdd0b);}return null;};}function saveUpdates(_0x2b26f1){return function(_0x5f49e1){if(_0x5f49e1){return _0x5f49e1[_0x4179('0xd')](_0x2b26f1)[_0x4179('0xe')](function(_0x4aaaf8){return _0x4aaaf8;});}return null;};}function removeEntity(_0x20d964){return function(_0x2f6cbc){if(_0x2f6cbc){return _0x2f6cbc['destroy']()[_0x4179('0xe')](function(){_0x20d964[_0x4179('0x5')](0xcc)[_0x4179('0xf')]();});}};}function handleEntityNotFound(_0x1c6ea4){return function(_0x1b0d10){if(!_0x1b0d10){_0x1c6ea4[_0x4179('0x10')](0x194);}return _0x1b0d10;};}function handleError(_0x8b2442,_0x2d638a){_0x2d638a=_0x2d638a||0x1f4;return function(_0x2b82d0){logger[_0x4179('0x11')](_0x2b82d0[_0x4179('0x12')]);if(_0x2b82d0[_0x4179('0x13')]){delete _0x2b82d0[_0x4179('0x13')];}_0x8b2442[_0x4179('0x5')](_0x2d638a)['send'](_0x2b82d0);};}exports[_0x4179('0x14')]=function(_0x508074,_0x3e8864){var _0x5d496b={},_0x4b158d={},_0x2cdea0={'count':0x0,'rows':[]};var _0x55b04f=_['map'](db[_0x4179('0x15')][_0x4179('0x16')],function(_0x2b2b99){return{'name':_0x2b2b99[_0x4179('0x17')],'type':_0x2b2b99[_0x4179('0x18')][_0x4179('0x19')]};});_0x4b158d[_0x4179('0x1a')]=_[_0x4179('0x1b')](_0x55b04f,_0x4179('0x13'));_0x4b158d[_0x4179('0x1c')]=_[_0x4179('0x1d')](_0x508074['query']);_0x4b158d['filters']=_[_0x4179('0x1e')](_0x4b158d[_0x4179('0x1a')],_0x4b158d[_0x4179('0x1c')]);_0x5d496b[_0x4179('0x1f')]=_[_0x4179('0x1e')](_0x4b158d[_0x4179('0x1a')],qs['fields'](_0x508074[_0x4179('0x1c')][_0x4179('0x20')]));_0x5d496b[_0x4179('0x1f')]=_0x5d496b[_0x4179('0x1f')]['length']?_0x5d496b[_0x4179('0x1f')]:_0x4b158d[_0x4179('0x1a')];if(!_0x508074[_0x4179('0x1c')][_0x4179('0x21')](_0x4179('0x22'))){_0x5d496b[_0x4179('0xa')]=qs[_0x4179('0xa')](_0x508074['query']['limit']);_0x5d496b[_0x4179('0x7')]=qs[_0x4179('0x7')](_0x508074['query'][_0x4179('0x7')]);}_0x5d496b['order']=qs['sort'](_0x508074[_0x4179('0x1c')][_0x4179('0x23')]);_0x5d496b[_0x4179('0x24')]=qs[_0x4179('0x25')](_[_0x4179('0x26')](_0x508074['query'],_0x4b158d['filters']),_0x55b04f);if(_0x508074[_0x4179('0x1c')]['filter']){_0x5d496b['where']=_[_0x4179('0x27')](_0x5d496b[_0x4179('0x24')],{'$or':_[_0x4179('0x1b')](_0x55b04f,function(_0x49bf5d){if(_0x49bf5d[_0x4179('0x18')]!==_0x4179('0x28')){var _0x59b453={};_0x59b453[_0x49bf5d[_0x4179('0x13')]]={'$like':'%'+_0x508074['query'][_0x4179('0x29')]+'%'};return _0x59b453;}})});}_0x5d496b=_[_0x4179('0x27')]({},_0x5d496b,_0x508074['options']);var _0x20da17={'where':_0x5d496b[_0x4179('0x24')]};return db[_0x4179('0x15')][_0x4179('0x9')](_0x20da17)[_0x4179('0xe')](function(_0xb859d){_0x2cdea0[_0x4179('0x9')]=_0xb859d;if(_0x508074['query']['includeAll']){_0x5d496b[_0x4179('0x2a')]=[{'all':!![]}];}return db[_0x4179('0x15')]['findAll'](_0x5d496b);})[_0x4179('0xe')](function(_0x34687a){_0x2cdea0[_0x4179('0x2b')]=_0x34687a;return _0x2cdea0;})[_0x4179('0xe')](respondWithFilteredResult(_0x3e8864,_0x5d496b))[_0x4179('0x2c')](handleError(_0x3e8864,null));};exports['show']=function(_0x380f05,_0x40856d){var _0x384747={'raw':![],'where':{'id':_0x380f05['params']['id']}},_0x5c4999={};_0x5c4999[_0x4179('0x1a')]=_[_0x4179('0x1d')](db[_0x4179('0x15')][_0x4179('0x16')]);_0x5c4999[_0x4179('0x1c')]=_['keys'](_0x380f05['query']);_0x5c4999[_0x4179('0x25')]=_[_0x4179('0x1e')](_0x5c4999[_0x4179('0x1a')],_0x5c4999[_0x4179('0x1c')]);_0x384747['attributes']=_[_0x4179('0x1e')](_0x5c4999['model'],qs[_0x4179('0x20')](_0x380f05['query']['fields']));_0x384747['attributes']=_0x384747[_0x4179('0x1f')][_0x4179('0x2d')]?_0x384747[_0x4179('0x1f')]:_0x5c4999[_0x4179('0x1a')];if(_0x380f05['query'][_0x4179('0x2e')]){_0x384747[_0x4179('0x2a')]=[{'all':!![]}];}_0x384747=_[_0x4179('0x27')]({},_0x384747,_0x380f05[_0x4179('0x2f')]);return db[_0x4179('0x15')]['find'](_0x384747)[_0x4179('0xe')](handleEntityNotFound(_0x40856d,null))[_0x4179('0xe')](respondWithResult(_0x40856d,null))['catch'](handleError(_0x40856d,null));};exports[_0x4179('0x30')]=function(_0x472146,_0x55b50c){return db[_0x4179('0x15')][_0x4179('0x30')](_0x472146['body'],{})[_0x4179('0xe')](respondWithResult(_0x55b50c,0xc9))['catch'](handleError(_0x55b50c,null));};exports['update']=function(_0x5dbc94,_0x3aa75d){if(_0x5dbc94['body']['id']){delete _0x5dbc94['body']['id'];}return db[_0x4179('0x15')][_0x4179('0x31')]({'where':{'id':_0x5dbc94[_0x4179('0x32')]['id']}})['then'](handleEntityNotFound(_0x3aa75d,null))['then'](saveUpdates(_0x5dbc94['body'],null))[_0x4179('0xe')](respondWithResult(_0x3aa75d,null))['catch'](handleError(_0x3aa75d,null));};exports[_0x4179('0x33')]=function(_0x54aa47,_0x9c19a2){return db[_0x4179('0x15')][_0x4179('0x31')]({'where':{'id':_0x54aa47[_0x4179('0x32')]['id']}})[_0x4179('0xe')](handleEntityNotFound(_0x9c19a2,null))[_0x4179('0xe')](removeEntity(_0x9c19a2,null))['catch'](handleError(_0x9c19a2,null));};exports[_0x4179('0x34')]=function(_0x20e1ec,_0x283eee){var _0x4753cd={};var _0x241560={};var _0x4ecc66;var _0x495cf5;return db['Dynamics365Account'][_0x4179('0x35')]({'where':{'id':_0x20e1ec[_0x4179('0x32')]['id']}})[_0x4179('0xe')](handleEntityNotFound(_0x283eee,null))[_0x4179('0xe')](function(_0xa7a8b2){if(_0xa7a8b2){_0x4ecc66=_0xa7a8b2;_0x241560[_0x4179('0x1a')]=_[_0x4179('0x1d')](db[_0x4179('0x36')][_0x4179('0x16')]);_0x241560['query']=_[_0x4179('0x1d')](_0x20e1ec[_0x4179('0x1c')]);_0x241560[_0x4179('0x25')]=_['intersection'](_0x241560[_0x4179('0x1a')],_0x241560['query']);_0x4753cd[_0x4179('0x1f')]=_[_0x4179('0x1e')](_0x241560['model'],qs[_0x4179('0x20')](_0x20e1ec[_0x4179('0x1c')][_0x4179('0x20')]));_0x4753cd[_0x4179('0x1f')]=_0x4753cd[_0x4179('0x1f')][_0x4179('0x2d')]?_0x4753cd[_0x4179('0x1f')]:_0x241560[_0x4179('0x1a')];_0x4753cd[_0x4179('0x37')]=qs[_0x4179('0x23')](_0x20e1ec['query'][_0x4179('0x23')]);_0x4753cd[_0x4179('0x24')]=qs[_0x4179('0x25')](_[_0x4179('0x26')](_0x20e1ec[_0x4179('0x1c')],_0x241560[_0x4179('0x25')]));if(_0x20e1ec['query'][_0x4179('0x29')]){_0x4753cd[_0x4179('0x24')]=_[_0x4179('0x27')](_0x4753cd['where'],{'$or':_['map'](_0x4753cd['attributes'],function(_0x893621){var _0xe4ffcb={};_0xe4ffcb[_0x893621]={'$like':'%'+_0x20e1ec[_0x4179('0x1c')]['filter']+'%'};return _0xe4ffcb;})});}_0x4753cd=_[_0x4179('0x27')]({},_0x4753cd,_0x20e1ec[_0x4179('0x2f')]);return _0x4ecc66[_0x4179('0x34')](_0x4753cd);}})[_0x4179('0xe')](function(_0x3f3b7d){if(_0x3f3b7d){_0x495cf5=_0x3f3b7d['length'];if(!_0x20e1ec['query']['hasOwnProperty']('nolimit')){_0x4753cd[_0x4179('0xa')]=qs[_0x4179('0xa')](_0x20e1ec[_0x4179('0x1c')][_0x4179('0xa')]);_0x4753cd['offset']=qs[_0x4179('0x7')](_0x20e1ec[_0x4179('0x1c')][_0x4179('0x7')]);}return _0x4ecc66[_0x4179('0x34')](_0x4753cd);}})[_0x4179('0xe')](function(_0x466b7d){if(_0x466b7d){return _0x466b7d?{'count':_0x495cf5,'rows':_0x466b7d}:null;}})['then'](respondWithResult(_0x283eee,null))['catch'](handleError(_0x283eee,null));};exports[_0x4179('0x38')]=function(_0x2816c1,_0x3f2082){if(_0x2816c1[_0x4179('0x39')]['id']){delete _0x2816c1[_0x4179('0x39')]['id'];}return db[_0x4179('0x15')][_0x4179('0x35')]({'where':{'id':_0x2816c1['params']['id']}})[_0x4179('0xe')](handleEntityNotFound(_0x3f2082,null))[_0x4179('0xe')](function(_0x3902cd){if(_0x3902cd){_0x2816c1[_0x4179('0x39')]['AccountId']=_0x3902cd['id'];_0x2816c1[_0x4179('0x39')]['Subjects']=integrations[_0x4179('0x3a')](_0x2816c1[_0x4179('0x39')][_0x4179('0x3b')],_0x2816c1[_0x4179('0x39')][_0x4179('0x18')]);_0x2816c1[_0x4179('0x39')][_0x4179('0x3c')]=integrations['getDescriptions'](_0x2816c1[_0x4179('0x39')][_0x4179('0x3b')],_0x2816c1[_0x4179('0x39')][_0x4179('0x18')]);return db[_0x4179('0x36')]['create'](_0x2816c1[_0x4179('0x39')],{'include':[{'model':db[_0x4179('0x3d')],'as':_0x4179('0x3e')},{'model':db[_0x4179('0x3d')],'as':_0x4179('0x3c')}]});}return null;})[_0x4179('0xe')](respondWithResult(_0x3f2082,null))[_0x4179('0x2c')](handleError(_0x3f2082,null));};function sanitizeRemoteUri(_0x4eb13f){var _0x1b93fb=_0x4eb13f[_0x4179('0x3f')](-0x1);if(_0x1b93fb==='/')return _0x4eb13f[_0x4179('0x40')](0x0,_0x4eb13f[_0x4179('0x41')](_0x1b93fb));return _0x4eb13f;}function getWebApiUrl(_0x1df92f){return util[_0x4179('0x42')](_0x4179('0x43'),_0x1df92f);}exports[_0x4179('0x44')]=function(_0x5a3bde,_0x1a8a10){var _0x4efc05=_0x5a3bde[_0x4179('0x1c')]['ticketType'];var _0x1fc56d=_0x4efc05==='incident'?_0x4179('0x45'):_0x4179('0x46');var _0x4ab990='';var _0x1b7313='';var _0x378aba='';var _0x18b484='';var _0x2f8a2b='';var _0x58e010='';var _0x50c1b3='';var _0x44a664='';var _0x33a38c=[_0x4179('0x47'),_0x4179('0x48'),'customerid',_0x4179('0x49'),'caseorigincode',_0x4179('0x4a'),_0x4179('0x4b'),_0x4179('0x4c'),_0x4179('0x4d'),_0x4179('0x4e')];var _0x56b253=[_0x4179('0x4f'),_0x4179('0x50'),_0x4179('0x51'),_0x4179('0x52'),_0x4179('0x53'),_0x4179('0x54'),_0x4179('0x55'),'contractidname',_0x4179('0x56'),_0x4179('0x57'),_0x4179('0x58'),_0x4179('0x59'),_0x4179('0x5a'),_0x4179('0x5b'),_0x4179('0x5c'),_0x4179('0x5d'),_0x4179('0x5e'),_0x4179('0x5f'),'emailaddress',_0x4179('0x60'),_0x4179('0x61'),_0x4179('0x62'),_0x4179('0x63'),_0x4179('0x64'),_0x4179('0x65'),_0x4179('0x66'),_0x4179('0x67'),_0x4179('0x68'),_0x4179('0x69'),'lastonholdtime',_0x4179('0x6a'),_0x4179('0x6b'),'modifiedbyexternalpartyyominame',_0x4179('0x6c'),'modifiedbyyominame',_0x4179('0x6d'),_0x4179('0x6e'),'modifiedonbehalfbyyominame',_0x4179('0x6f'),'msdyn_iotalertname',_0x4179('0x70'),_0x4179('0x71'),_0x4179('0x72'),_0x4179('0x73'),_0x4179('0x74'),_0x4179('0x75'),_0x4179('0x76'),_0x4179('0x77'),_0x4179('0x78'),_0x4179('0x79'),_0x4179('0x7a'),_0x4179('0x7b'),_0x4179('0x7c'),_0x4179('0x7d'),_0x4179('0x7e'),_0x4179('0x7f'),'responsiblecontactidyominame',_0x4179('0x80'),_0x4179('0x81'),_0x4179('0x82'),_0x4179('0x83'),'statecode','statuscode','subjectidname',_0x4179('0x84'),'timezoneruleversionnumber',_0x4179('0x85'),_0x4179('0x86'),_0x4179('0x87'),_0x4179('0x88')];var _0x572874=_0x33a38c['concat'](_0x56b253);return db[_0x4179('0x15')][_0x4179('0x35')]({'where':{'id':_0x5a3bde[_0x4179('0x32')]['id']},'attributes':['id','username',_0x4179('0x89'),_0x4179('0x8a'),_0x4179('0x8b'),_0x4179('0x8c'),_0x4179('0x8d'),_0x4179('0x8e')],'include':[{'model':db[_0x4179('0x8f')],'as':'CloudProvider','attributes':['id',_0x4179('0x90'),'data7']}]})['then'](handleEntityNotFound(_0x1a8a10,null))['then'](function(_0x29c684){if(_0x29c684){if(_0x29c684[_0x4179('0x8e')]){_0x29c684[_0x4179('0x91')]=_0x29c684[_0x4179('0x8f')][_0x4179('0x90')];_0x44a664=sanitizeRemoteUri(_0x29c684['CloudProvider'][_0x4179('0x92')]);_0x50c1b3=getWebApiUrl(_0x44a664);return _0x29c684;}_0x44a664=sanitizeRemoteUri(_0x29c684[_0x4179('0x8a')]);_0x50c1b3=getWebApiUrl(_0x44a664);var _0x51be83={'method':'POST','uri':'https://login.microsoftonline.com/'+_0x29c684['tenantId']+_0x4179('0x93'),'form':{'client_id':_0x29c684[_0x4179('0x8c')],'resource':_0x44a664,'username':_0x29c684[_0x4179('0x94')],'password':_0x29c684[_0x4179('0x89')],'grant_type':_0x4179('0x89'),'client_secret':_0x29c684[_0x4179('0x8d')]},'json':!![]};return rp(_0x51be83);}})[_0x4179('0xe')](function(_0x505f5c){_0x58e010=_0x505f5c['access_token'];var _0x5e8786={'method':'GET','uri':encodeURI(_0x50c1b3+_0x4179('0x95')+_0x1fc56d+'\x27'),'headers':{'Authorization':_0x4179('0x96')+_0x58e010,'If-None-Match':null,'OData-Version':_0x4179('0x97')},'json':!![]};return rp(_0x5e8786);})[_0x4179('0xe')](function(_0xbb5f2d){var _0x44ab51=_0xbb5f2d[_0x4179('0x98')][0x0];var _0x3702e8=_0x44ab51[_0x4179('0x99')];var _0x4ee9a8={'method':'GET','uri':_0x50c1b3+_0x4179('0x9a')+_0x3702e8+_0x4179('0x9b'),'headers':{'Authorization':_0x4179('0x96')+_0x58e010,'If-None-Match':null,'OData-Version':_0x4179('0x97')},'json':!![]};return rp(_0x4ee9a8);})['then'](function(_0x2239a1){_0x4ab990=_0x2239a1;_0x1b7313=_0x4ab990[_0x4179('0x9c')];_0x1b7313=_[_0x4179('0x9d')](_0x1b7313,function(_0x186e4d){return!_0x572874[_0x4179('0x9e')](_0x186e4d[_0x4179('0x9f')]);});var _0x2300eb=[];var _0x55bb50=[];_0x1b7313[_0x4179('0xa0')](function(_0x2dbda3){if(_0x2dbda3[_0x4179('0xa1')]){var _0x2063fa=_0x2dbda3['@odata.type'][_0x4179('0x40')](_0x2dbda3['@odata.type'][_0x4179('0x41')]('.')+0x1);if(_0x2063fa===_0x4179('0xa2')){_0x2300eb['push'](getSelectList(_0x50c1b3,_0x4efc05,_0x55bb50,_0x4ab990[_0x4179('0x99')],_0x2dbda3[_0x4179('0x99')],_0x58e010));}}});return Promise['all'](_0x2300eb);})['then'](function(_0x14bf06){_0x378aba=_0x14bf06[0x0];var _0x4ef28f=[];var _0x26cfa9=[];_0x1b7313[_0x4179('0xa0')](function(_0x2936df){if(!_['isNil'](_0x2936df['@odata.type'])){var _0x3c10df=_0x2936df[_0x4179('0xa1')][_0x4179('0x40')](_0x2936df[_0x4179('0xa1')][_0x4179('0x41')]('.')+0x1);if(_0x3c10df===_0x4179('0xa3')){_0x4ef28f['push'](getBooleanList(_0x50c1b3,_0x4efc05,_0x26cfa9,_0x4ab990[_0x4179('0x99')],_0x2936df[_0x4179('0x99')],_0x58e010));}}});return Promise[_0x4179('0xa4')](_0x4ef28f);})[_0x4179('0xe')](function(_0x52ce92){_0x18b484=_0x52ce92[0x0];var _0x51509b=[];var _0x5d7aed=[];_0x1b7313[_0x4179('0xa0')](function(_0x54ace1){if(_0x54ace1['@odata.type']){var _0xbecd41=_0x54ace1[_0x4179('0xa1')][_0x4179('0x40')](_0x54ace1[_0x4179('0xa1')][_0x4179('0x41')]('.')+0x1);if(_0xbecd41===_0x4179('0xa5')||_0xbecd41===_0x4179('0xa6')||_0xbecd41===_0x4179('0xa7')||_0xbecd41===_0x4179('0xa8')||_0xbecd41==='MemoAttributeMetadata'||_0xbecd41==='DateTimeAttributeMetadata'||_0xbecd41==='StatusAttributeMetadata'||_0xbecd41===_0x4179('0xa9')||_0xbecd41===_0x4179('0xaa')||_0xbecd41===_0x4179('0xab')){_0x51509b[_0x4179('0xac')](getInputList(_0x50c1b3,_0x4efc05,_0xbecd41,_0x5d7aed,_0x4ab990['MetadataId'],_0x54ace1['MetadataId'],_0x58e010));}}});return Promise[_0x4179('0xa4')](_0x51509b);})['then'](function(_0x590a80){_0x2f8a2b=_0x590a80[0x0];var _0x79dd85=_0x378aba[_0x4179('0xad')](_0x18b484)[_0x4179('0xad')](_0x2f8a2b);var _0x1388a1={'count':_0x79dd85[_0x4179('0x2d')],'rows':_0x79dd85};return _0x1388a1;})[_0x4179('0xe')](respondWithResult(_0x1a8a10,null))[_0x4179('0x2c')](function(_0x54533f){var _0x1f5557=_0x5a3bde[_0x4179('0x1c')]['test']?0x1f4:_0x54533f[_0x4179('0xae')]||0x1f4;logger[_0x4179('0x11')](_0x54533f['stack']);delete _0x54533f[_0x4179('0x13')];if(_0x1f5557===0x191){_0x1f5557=0x190;}_0x1a8a10[_0x4179('0x5')](_0x1f5557)[_0x4179('0xaf')](_0x5a3bde['query'][_0x4179('0xb0')]?{'message':_0x4179('0xb1'),'statusCode':_0x54533f['statusCode']}:_0x54533f);});};function getSelectList(_0x26eae7,_0x4d59a3,_0x22e61d,_0x484cb1,_0xccb748,_0x22f868){var _0x36d014={'method':_0x4179('0xb2'),'uri':_0x26eae7+'EntityDefinitions('+_0x484cb1+_0x4179('0xb3')+_0xccb748+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x4179('0xb4'),'headers':{'Authorization':_0x4179('0x96')+_0x22f868,'If-None-Match':null,'OData-Version':_0x4179('0x97')},'json':!![]};return rp(_0x36d014)[_0x4179('0xe')](function(_0x3a036e){var _0x1a746a=[];var _0x7dd3a9=_0x3a036e[_0x4179('0xb5')][_0x4179('0xb6')];_0x7dd3a9[_0x4179('0xa0')](function(_0x5cb021){_0x1a746a['push']({'name':_0x5cb021[_0x4179('0xb7')][_0x4179('0xb8')]['Label'],'value':String(_0x5cb021[_0x4179('0xb9')])});});var _0x313a35={'id':_0x4d59a3+'_'+_0x3a036e['LogicalName'],'name':_0x3a036e[_0x4179('0xba')][_0x4179('0xb8')][_0x4179('0xb7')],'custom':![],'options':_0x1a746a};_0x22e61d['push'](_0x313a35);return _0x22e61d;});}function getBooleanList(_0x3cdc8e,_0x597b77,_0x283d5c,_0x3fc8b8,_0x32ff0f,_0x21442b){var _0x48612e={'method':'GET','uri':_0x3cdc8e+_0x4179('0x9a')+_0x3fc8b8+_0x4179('0xb3')+_0x32ff0f+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x4179('0x96')+_0x21442b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x48612e)[_0x4179('0xe')](function(_0x256c56){var _0x27af5c=[];_0x27af5c['push']({'name':_0x256c56['OptionSet'][_0x4179('0xbb')][_0x4179('0xb7')][_0x4179('0xb8')]['Label'],'value':'true'},{'name':_0x256c56[_0x4179('0xb5')][_0x4179('0xbc')][_0x4179('0xb7')]['UserLocalizedLabel']['Label'],'value':_0x4179('0xbd')});var _0x378d42={'id':_0x597b77+'_'+_0x256c56[_0x4179('0x9f')],'name':_0x256c56[_0x4179('0xba')][_0x4179('0xb8')][_0x4179('0xb7')],'custom':![],'options':_0x27af5c};_0x283d5c['push'](_0x378d42);return _0x283d5c;});}function getInputList(_0x366165,_0x3bbb1a,_0x46623c,_0x5727f4,_0x4a4c1b,_0x53d530,_0x4446a4){var _0x5490c3={'method':'GET','uri':_0x366165+_0x4179('0x9a')+_0x4a4c1b+')/Attributes('+_0x53d530+_0x4179('0xbe')+_0x46623c+_0x4179('0xbf'),'headers':{'Authorization':'Bearer\x20'+_0x4446a4,'If-None-Match':null,'OData-Version':_0x4179('0x97')},'json':!![]};return rp(_0x5490c3)[_0x4179('0xe')](function(_0x19e120){var _0x1c565f={'id':_0x3bbb1a+'_'+_0x19e120[_0x4179('0x9f')],'name':_0x19e120['DisplayName'][_0x4179('0xb8')]?_0x19e120[_0x4179('0xba')][_0x4179('0xb8')][_0x4179('0xb7')]:_0x19e120[_0x4179('0x9f')],'custom':![],'options':[]};_0x5727f4['push'](_0x1c565f);return _0x5727f4;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 0dbe0d6..6403924 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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0xea6215,_0x2b0944){var _0x447413=function(_0x250ef5){while(--_0x250ef5){_0xea6215['push'](_0xea6215['shift']());}};_0x447413(++_0x2b0944);}(_0xe706,0xa3));var _0x6e70=function(_0x31d849,_0x3db9bc){_0x31d849=_0x31d849-0x0;var _0x1c55b3=_0xe706[_0x31d849];return _0x1c55b3;};'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'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x5f4f01,_0x27aa6e){var _0x42a261=function(_0x184e0a){while(--_0x184e0a){_0x5f4f01['push'](_0x5f4f01['shift']());}};_0x42a261(++_0x27aa6e);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 91cb096..56388b6 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 _0xd60b=['model','debug','ShowDynamics365Account','find','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','attributes','limit','include','map'];(function(_0x1fa30b,_0x33ea0e){var _0x510ef6=function(_0x4fb7c1){while(--_0x4fb7c1){_0x1fa30b['push'](_0x1fa30b['shift']());}};_0x510ef6(++_0x33ea0e);}(_0xd60b,0x137));var _0xbd60=function(_0x2596e9,_0x1ae32e){_0x2596e9=_0x2596e9-0x0;var _0x1b67c9=_0xd60b[_0x2596e9];return _0x1b67c9;};'use strict';var _=require('lodash');var util=require(_0xbd60('0x0'));var moment=require(_0xbd60('0x1'));var BPromise=require('bluebird');var rs=require(_0xbd60('0x2'));var fs=require('fs');var Redis=require(_0xbd60('0x3'));var db=require(_0xbd60('0x4'))['db'];var utils=require(_0xbd60('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xbd60('0x6'));var jayson=require(_0xbd60('0x7'));var client=jayson[_0xbd60('0x8')][_0xbd60('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d4895,_0x23b897,_0x3ff052){return new BPromise(function(_0x49c748,_0x1cab7f){return client['request'](_0x2d4895,_0x3ff052)[_0xbd60('0xa')](function(_0x4b036d){logger[_0xbd60('0xb')](_0xbd60('0xc'),_0x23b897,_0xbd60('0xd'));logger['debug'](_0xbd60('0xe'),_0x23b897,'request\x20sent',JSON['stringify'](_0x4b036d));if(_0x4b036d[_0xbd60('0xf')]){if(_0x4b036d['error'][_0xbd60('0x10')]===0x1f4){logger[_0xbd60('0xf')](_0xbd60('0xc'),_0x23b897,_0x4b036d[_0xbd60('0xf')][_0xbd60('0x11')]);return _0x1cab7f(_0x4b036d[_0xbd60('0xf')][_0xbd60('0x11')]);}logger[_0xbd60('0xf')](_0xbd60('0xc'),_0x23b897,_0x4b036d['error'][_0xbd60('0x11')]);return _0x49c748(_0x4b036d[_0xbd60('0xf')][_0xbd60('0x11')]);}else{logger[_0xbd60('0xb')](_0xbd60('0xc'),_0x23b897,_0xbd60('0xd'));_0x49c748(_0x4b036d[_0xbd60('0x12')][_0xbd60('0x11')]);}})[_0xbd60('0x13')](function(_0x13e2d5){logger[_0xbd60('0xf')](_0xbd60('0xc'),_0x23b897,_0x13e2d5);_0x1cab7f(_0x13e2d5);});});}exports[_0xbd60('0x14')]=function(_0x2e2947){var _0x307ebd=this;return new Promise(function(_0x30e634,_0x250bfa){return db[_0xbd60('0x15')][_0xbd60('0x16')]({'raw':_0x2e2947[_0xbd60('0x17')]?_0x2e2947[_0xbd60('0x17')][_0xbd60('0x18')]===undefined?!![]:![]:!![],'where':_0x2e2947[_0xbd60('0x17')]?_0x2e2947['options']['where']||null:null,'attributes':_0x2e2947[_0xbd60('0x17')]?_0x2e2947[_0xbd60('0x17')][_0xbd60('0x19')]||null:null,'limit':_0x2e2947[_0xbd60('0x17')]?_0x2e2947[_0xbd60('0x17')][_0xbd60('0x1a')]||null:null,'include':_0x2e2947[_0xbd60('0x17')]?_0x2e2947[_0xbd60('0x17')][_0xbd60('0x1b')]?_[_0xbd60('0x1c')](_0x2e2947['options'][_0xbd60('0x1b')],function(_0x173e22){return{'model':db[_0x173e22[_0xbd60('0x1d')]],'as':_0x173e22['as'],'attributes':_0x173e22[_0xbd60('0x19')],'include':_0x173e22[_0xbd60('0x1b')]?_['map'](_0x173e22[_0xbd60('0x1b')],function(_0x2b0664){return{'model':db[_0x2b0664[_0xbd60('0x1d')]],'as':_0x2b0664['as'],'attributes':_0x2b0664[_0xbd60('0x19')],'include':_0x2b0664[_0xbd60('0x1b')]?_[_0xbd60('0x1c')](_0x2b0664['include'],function(_0x220fcb){return{'model':db[_0x220fcb[_0xbd60('0x1d')]],'as':_0x220fcb['as'],'attributes':_0x220fcb[_0xbd60('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbd60('0xa')](function(_0x379951){logger[_0xbd60('0xb')]('GetDynamics365Account',_0x2e2947);logger[_0xbd60('0x1e')](_0xbd60('0x14'),_0x2e2947,JSON['stringify'](_0x379951));_0x30e634(_0x379951);})[_0xbd60('0x13')](function(_0x4a510f){logger['error'](_0xbd60('0x14'),_0x4a510f[_0xbd60('0x11')],_0x2e2947);_0x250bfa(_0x307ebd[_0xbd60('0xf')](0x1f4,_0x4a510f[_0xbd60('0x11')]));});});};exports[_0xbd60('0x1f')]=function(_0x2eb407){var _0x55b658=this;return new Promise(function(_0x218b9d,_0x4fcb8b){return db[_0xbd60('0x15')][_0xbd60('0x20')]({'raw':_0x2eb407['options']?_0x2eb407['options'][_0xbd60('0x18')]===undefined?!![]:![]:!![],'where':_0x2eb407[_0xbd60('0x17')]?_0x2eb407[_0xbd60('0x17')]['where']||null:null,'attributes':_0x2eb407[_0xbd60('0x17')]?_0x2eb407[_0xbd60('0x17')][_0xbd60('0x19')]||null:null,'include':_0x2eb407[_0xbd60('0x17')]?_0x2eb407[_0xbd60('0x17')][_0xbd60('0x1b')]?_[_0xbd60('0x1c')](_0x2eb407[_0xbd60('0x17')]['include'],function(_0x17763a){return{'model':db[_0x17763a[_0xbd60('0x1d')]],'as':_0x17763a['as'],'attributes':_0x17763a['attributes'],'include':_0x17763a['include']?_[_0xbd60('0x1c')](_0x17763a[_0xbd60('0x1b')],function(_0x3964bc){return{'model':db[_0x3964bc['model']],'as':_0x3964bc['as'],'attributes':_0x3964bc[_0xbd60('0x19')],'include':_0x3964bc[_0xbd60('0x1b')]?_[_0xbd60('0x1c')](_0x3964bc[_0xbd60('0x1b')],function(_0x3c68a4){return{'model':db[_0x3c68a4[_0xbd60('0x1d')]],'as':_0x3c68a4['as'],'attributes':_0x3c68a4[_0xbd60('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbd60('0xa')](function(_0x901930){logger['info'](_0xbd60('0x1f'),_0x2eb407);logger['debug'](_0xbd60('0x1f'),_0x2eb407,JSON[_0xbd60('0x21')](_0x901930));_0x218b9d(_0x901930);})[_0xbd60('0x13')](function(_0x97eba){logger['error']('ShowDynamics365Account',_0x97eba[_0xbd60('0x11')],_0x2eb407);_0x4fcb8b(_0x55b658[_0xbd60('0xf')](0x1f4,_0x97eba[_0xbd60('0x11')]));});});}; \ No newline at end of file +var _0xdd1d=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','message','Dynamics365Account,\x20%s,\x20%s','info','result','catch','Dynamics365Account','findAll','options','raw','where','include','map','model','attributes','GetDynamics365Account','find','ShowDynamics365Account','moment','bluebird','randomstring','ioredis'];(function(_0x276098,_0x3bb8b3){var _0x3e7506=function(_0x5b474d){while(--_0x5b474d){_0x276098['push'](_0x276098['shift']());}};_0x3e7506(++_0x3bb8b3);}(_0xdd1d,0x88));var _0xddd1=function(_0x395be8,_0x285479){_0x395be8=_0x395be8-0x0;var _0x5ceb20=_0xdd1d[_0x395be8];return _0x5ceb20;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xddd1('0x0'));var BPromise=require(_0xddd1('0x1'));var rs=require(_0xddd1('0x2'));var fs=require('fs');var Redis=require(_0xddd1('0x3'));var db=require(_0xddd1('0x4'))['db'];var utils=require(_0xddd1('0x5'));var logger=require(_0xddd1('0x6'))('rpc');var config=require(_0xddd1('0x7'));var jayson=require(_0xddd1('0x8'));var client=jayson[_0xddd1('0x9')][_0xddd1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35dbe0,_0x2b69f3,_0x37d6b3){return new BPromise(function(_0x340410,_0x19a588){return client[_0xddd1('0xb')](_0x35dbe0,_0x37d6b3)[_0xddd1('0xc')](function(_0x14e180){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x2b69f3,_0xddd1('0xd'));logger[_0xddd1('0xe')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x2b69f3,_0xddd1('0xd'),JSON[_0xddd1('0xf')](_0x14e180));if(_0x14e180[_0xddd1('0x10')]){if(_0x14e180['error'][_0xddd1('0x11')]===0x1f4){logger[_0xddd1('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x2b69f3,_0x14e180[_0xddd1('0x10')][_0xddd1('0x12')]);return _0x19a588(_0x14e180[_0xddd1('0x10')][_0xddd1('0x12')]);}logger['error'](_0xddd1('0x13'),_0x2b69f3,_0x14e180[_0xddd1('0x10')]['message']);return _0x340410(_0x14e180[_0xddd1('0x10')]['message']);}else{logger[_0xddd1('0x14')](_0xddd1('0x13'),_0x2b69f3,_0xddd1('0xd'));_0x340410(_0x14e180[_0xddd1('0x15')][_0xddd1('0x12')]);}})[_0xddd1('0x16')](function(_0x2c0603){logger['error'](_0xddd1('0x13'),_0x2b69f3,_0x2c0603);_0x19a588(_0x2c0603);});});}exports['GetDynamics365Account']=function(_0x31ed07){var _0x4f6bee=this;return new Promise(function(_0x2bb7db,_0x33ee07){return db[_0xddd1('0x17')][_0xddd1('0x18')]({'raw':_0x31ed07[_0xddd1('0x19')]?_0x31ed07[_0xddd1('0x19')][_0xddd1('0x1a')]===undefined?!![]:![]:!![],'where':_0x31ed07[_0xddd1('0x19')]?_0x31ed07[_0xddd1('0x19')][_0xddd1('0x1b')]||null:null,'attributes':_0x31ed07[_0xddd1('0x19')]?_0x31ed07[_0xddd1('0x19')]['attributes']||null:null,'limit':_0x31ed07[_0xddd1('0x19')]?_0x31ed07[_0xddd1('0x19')]['limit']||null:null,'include':_0x31ed07[_0xddd1('0x19')]?_0x31ed07[_0xddd1('0x19')][_0xddd1('0x1c')]?_[_0xddd1('0x1d')](_0x31ed07[_0xddd1('0x19')][_0xddd1('0x1c')],function(_0x4693b1){return{'model':db[_0x4693b1[_0xddd1('0x1e')]],'as':_0x4693b1['as'],'attributes':_0x4693b1[_0xddd1('0x1f')],'include':_0x4693b1[_0xddd1('0x1c')]?_[_0xddd1('0x1d')](_0x4693b1['include'],function(_0xabd5a7){return{'model':db[_0xabd5a7['model']],'as':_0xabd5a7['as'],'attributes':_0xabd5a7[_0xddd1('0x1f')],'include':_0xabd5a7[_0xddd1('0x1c')]?_[_0xddd1('0x1d')](_0xabd5a7['include'],function(_0x2ff45f){return{'model':db[_0x2ff45f['model']],'as':_0x2ff45f['as'],'attributes':_0x2ff45f[_0xddd1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xddd1('0xc')](function(_0x2c611c){logger[_0xddd1('0x14')](_0xddd1('0x20'),_0x31ed07);logger[_0xddd1('0xe')]('GetDynamics365Account',_0x31ed07,JSON['stringify'](_0x2c611c));_0x2bb7db(_0x2c611c);})['catch'](function(_0x4601d2){logger['error'](_0xddd1('0x20'),_0x4601d2[_0xddd1('0x12')],_0x31ed07);_0x33ee07(_0x4f6bee['error'](0x1f4,_0x4601d2[_0xddd1('0x12')]));});});};exports['ShowDynamics365Account']=function(_0x16cc1d){var _0x4580f1=this;return new Promise(function(_0x5b55bd,_0x7062f3){return db['Dynamics365Account'][_0xddd1('0x21')]({'raw':_0x16cc1d[_0xddd1('0x19')]?_0x16cc1d[_0xddd1('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x16cc1d['options']?_0x16cc1d[_0xddd1('0x19')][_0xddd1('0x1b')]||null:null,'attributes':_0x16cc1d[_0xddd1('0x19')]?_0x16cc1d[_0xddd1('0x19')][_0xddd1('0x1f')]||null:null,'include':_0x16cc1d[_0xddd1('0x19')]?_0x16cc1d[_0xddd1('0x19')]['include']?_['map'](_0x16cc1d['options'][_0xddd1('0x1c')],function(_0x1343bd){return{'model':db[_0x1343bd['model']],'as':_0x1343bd['as'],'attributes':_0x1343bd[_0xddd1('0x1f')],'include':_0x1343bd[_0xddd1('0x1c')]?_[_0xddd1('0x1d')](_0x1343bd[_0xddd1('0x1c')],function(_0x5cf275){return{'model':db[_0x5cf275[_0xddd1('0x1e')]],'as':_0x5cf275['as'],'attributes':_0x5cf275['attributes'],'include':_0x5cf275[_0xddd1('0x1c')]?_[_0xddd1('0x1d')](_0x5cf275[_0xddd1('0x1c')],function(_0x126e00){return{'model':db[_0x126e00[_0xddd1('0x1e')]],'as':_0x126e00['as'],'attributes':_0x126e00[_0xddd1('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d4b28){logger[_0xddd1('0x14')](_0xddd1('0x22'),_0x16cc1d);logger[_0xddd1('0xe')](_0xddd1('0x22'),_0x16cc1d,JSON[_0xddd1('0xf')](_0x1d4b28));_0x5b55bd(_0x1d4b28);})[_0xddd1('0x16')](function(_0x1ece60){logger[_0xddd1('0x10')]('ShowDynamics365Account',_0x1ece60[_0xddd1('0x12')],_0x16cc1d);_0x7062f3(_0x4580f1[_0xddd1('0x10')](0x1f4,_0x1ece60[_0xddd1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 3a8001b..46761e7 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 _0xf777=['index','/:id','show','/:id/fields','isAuthenticated','getFields','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller','get'];(function(_0x296f0e,_0x303536){var _0x43981c=function(_0x566eec){while(--_0x566eec){_0x296f0e['push'](_0x296f0e['shift']());}};_0x43981c(++_0x303536);}(_0xf777,0x1e9));var _0x7f77=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf777[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7f77('0x0'));var util=require(_0x7f77('0x1'));var path=require(_0x7f77('0x2'));var timeout=require(_0x7f77('0x3'));var express=require(_0x7f77('0x4'));var router=express[_0x7f77('0x5')]();var fs_extra=require(_0x7f77('0x6'));var auth=require(_0x7f77('0x7'));var interaction=require(_0x7f77('0x8'));var config=require('../../config/environment');var controller=require(_0x7f77('0x9'));router[_0x7f77('0xa')]('/',auth['isAuthenticated'](),controller[_0x7f77('0xb')]);router['get'](_0x7f77('0xc'),auth['isAuthenticated'](),controller[_0x7f77('0xd')]);router[_0x7f77('0xa')](_0x7f77('0xe'),auth[_0x7f77('0xf')](),controller[_0x7f77('0x10')]);router['get']('/:id/subjects',auth[_0x7f77('0xf')](),controller[_0x7f77('0x11')]);router[_0x7f77('0xa')](_0x7f77('0x12'),auth[_0x7f77('0xf')](),controller['getDescriptions']);router[_0x7f77('0x13')]('/',auth[_0x7f77('0xf')](),controller[_0x7f77('0x14')]);router[_0x7f77('0x15')](_0x7f77('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x7f77('0x16')](_0x7f77('0xc'),auth[_0x7f77('0xf')](),controller[_0x7f77('0x17')]);module[_0x7f77('0x18')]=router; \ No newline at end of file +var _0x241c=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','destroy','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x241c,0xd8));var _0xc241=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x241c[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xc241('0x0'));var util=require(_0xc241('0x1'));var path=require(_0xc241('0x2'));var timeout=require(_0xc241('0x3'));var express=require(_0xc241('0x4'));var router=express['Router']();var fs_extra=require(_0xc241('0x5'));var auth=require(_0xc241('0x6'));var interaction=require(_0xc241('0x7'));var config=require(_0xc241('0x8'));var controller=require(_0xc241('0x9'));router[_0xc241('0xa')]('/',auth[_0xc241('0xb')](),controller['index']);router['get'](_0xc241('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0xc241('0xd'),auth[_0xc241('0xb')](),controller[_0xc241('0xe')]);router['get'](_0xc241('0xf'),auth['isAuthenticated'](),controller[_0xc241('0x10')]);router[_0xc241('0xa')](_0xc241('0x11'),auth[_0xc241('0xb')](),controller[_0xc241('0x12')]);router[_0xc241('0x13')]('/',auth['isAuthenticated'](),controller[_0xc241('0x14')]);router['put'](_0xc241('0xc'),auth[_0xc241('0xb')](),controller[_0xc241('0x15')]);router['delete'](_0xc241('0xc'),auth[_0xc241('0xb')](),controller[_0xc241('0x16')]);module[_0xc241('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 68a974a..1ff1190 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 _0x0a74=['ENUM','incident','phonecall','contact','sequelize','exports','STRING'];(function(_0x2142c8,_0x3001eb){var _0x4286e9=function(_0x43d768){while(--_0x43d768){_0x2142c8['push'](_0x2142c8['shift']());}};_0x4286e9(++_0x3001eb);}(_0x0a74,0x14d));var _0x40a7=function(_0x3daf35,_0x46a1f5){_0x3daf35=_0x3daf35-0x0;var _0x495660=_0x0a74[_0x3daf35];return _0x495660;};'use strict';var Sequelize=require(_0x40a7('0x0'));module[_0x40a7('0x1')]={'name':{'type':Sequelize[_0x40a7('0x2')]},'description':{'type':Sequelize[_0x40a7('0x2')]},'ticketType':{'type':Sequelize[_0x40a7('0x3')](_0x40a7('0x4'),_0x40a7('0x5')),'defaultValue':_0x40a7('0x4')},'moduleCreate':{'type':Sequelize[_0x40a7('0x3')](_0x40a7('0x6'),'nothing'),'defaultValue':_0x40a7('0x6'),'allowNull':![]}}; \ No newline at end of file +var _0x5cab=['STRING','ENUM','incident','phonecall','nothing','contact','sequelize','exports'];(function(_0x2b30fe,_0xe92c0a){var _0x2d1e4e=function(_0x43366d){while(--_0x43366d){_0x2b30fe['push'](_0x2b30fe['shift']());}};_0x2d1e4e(++_0xe92c0a);}(_0x5cab,0x10e));var _0xb5ca=function(_0x2744a8,_0x279f13){_0x2744a8=_0x2744a8-0x0;var _0x31d7a5=_0x5cab[_0x2744a8];return _0x31d7a5;};'use strict';var Sequelize=require(_0xb5ca('0x0'));module[_0xb5ca('0x1')]={'name':{'type':Sequelize[_0xb5ca('0x2')]},'description':{'type':Sequelize[_0xb5ca('0x2')]},'ticketType':{'type':Sequelize[_0xb5ca('0x3')](_0xb5ca('0x4'),_0xb5ca('0x5')),'defaultValue':_0xb5ca('0x4')},'moduleCreate':{'type':Sequelize['ENUM']('contact',_0xb5ca('0x6')),'defaultValue':_0xb5ca('0x7'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index c31dd65..37f9276 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 _0xe351=['body','getFields','Dynamics365Field','pick','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','fieldName','type','key','map','query','keys','model','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','Dynamics365Configuration','includeAll','include','findAll','show','params','rawAttributes','fields','length','find','catch','create'];(function(_0x1029da,_0x456eaf){var _0x3b00f1=function(_0x3ad66e){while(--_0x3ad66e){_0x1029da['push'](_0x1029da['shift']());}};_0x3b00f1(++_0x456eaf);}(_0xe351,0x103));var _0x1e35=function(_0xe99028,_0x3d5b3a){_0xe99028=_0xe99028-0x0;var _0x5ddd52=_0xe351[_0xe99028];return _0x5ddd52;};'use strict';var emlformat=require(_0x1e35('0x0'));var rimraf=require(_0x1e35('0x1'));var zipdir=require(_0x1e35('0x2'));var jsonpatch=require(_0x1e35('0x3'));var rp=require(_0x1e35('0x4'));var moment=require(_0x1e35('0x5'));var BPromise=require(_0x1e35('0x6'));var Mustache=require('mustache');var util=require(_0x1e35('0x7'));var path=require(_0x1e35('0x8'));var sox=require(_0x1e35('0x9'));var csv=require(_0x1e35('0xa'));var ejs=require(_0x1e35('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1e35('0xc'));var squel=require(_0x1e35('0xd'));var crypto=require('crypto');var jsforce=require(_0x1e35('0xe'));var deskjs=require(_0x1e35('0xf'));var toCsv=require(_0x1e35('0xa'));var querystring=require(_0x1e35('0x10'));var Papa=require(_0x1e35('0x11'));var Redis=require(_0x1e35('0x12'));var authService=require(_0x1e35('0x13'));var qs=require(_0x1e35('0x14'));var as=require(_0x1e35('0x15'));var hardwareService=require(_0x1e35('0x16'));var logger=require(_0x1e35('0x17'))('api');var utils=require(_0x1e35('0x18'));var config=require(_0x1e35('0x19'));var licenseUtil=require(_0x1e35('0x1a'));var db=require(_0x1e35('0x1b'))['db'];function respondWithStatusCode(_0x53ef30,_0x23c9c2){_0x23c9c2=_0x23c9c2||0xcc;return function(_0x12ab58){if(_0x12ab58){return _0x53ef30[_0x1e35('0x1c')](_0x23c9c2);}return _0x53ef30[_0x1e35('0x1d')](_0x23c9c2)[_0x1e35('0x1e')]();};}function respondWithResult(_0x3df62e,_0x3ee810){_0x3ee810=_0x3ee810||0xc8;return function(_0x32e9b1){if(_0x32e9b1){return _0x3df62e[_0x1e35('0x1d')](_0x3ee810)[_0x1e35('0x1f')](_0x32e9b1);}};}function respondWithFilteredResult(_0x2d3f49,_0x2ea8bb){return function(_0x2bed0a){if(_0x2bed0a){var _0x169e57=typeof _0x2ea8bb['offset']===_0x1e35('0x20')&&typeof _0x2ea8bb[_0x1e35('0x21')]===_0x1e35('0x20');var _0x1877f4=_0x2bed0a['count'];var _0x1f6d67=_0x169e57?0x0:_0x2ea8bb[_0x1e35('0x22')];var _0x42915e=_0x169e57?_0x2bed0a[_0x1e35('0x23')]:_0x2ea8bb[_0x1e35('0x22')]+_0x2ea8bb[_0x1e35('0x21')];var _0x559b22;if(_0x42915e>=_0x1877f4){_0x42915e=_0x1877f4;_0x559b22=0xc8;}else{_0x559b22=0xce;}_0x2d3f49['status'](_0x559b22);return _0x2d3f49[_0x1e35('0x24')](_0x1e35('0x25'),_0x1f6d67+'-'+_0x42915e+'/'+_0x1877f4)[_0x1e35('0x1f')](_0x2bed0a);}return null;};}function patchUpdates(_0x415e23){return function(_0x2a72f9){try{jsonpatch[_0x1e35('0x26')](_0x2a72f9,_0x415e23,!![]);}catch(_0x50d067){return BPromise[_0x1e35('0x27')](_0x50d067);}return _0x2a72f9[_0x1e35('0x28')]();};}function saveUpdates(_0x47a15a,_0x4bd52b){return function(_0x5539b4){if(_0x5539b4){return _0x5539b4['update'](_0x47a15a)[_0x1e35('0x29')](function(_0x49824a){return _0x49824a;});}return null;};}function removeEntity(_0x40bd75,_0x59b178){return function(_0x14597a){if(_0x14597a){return _0x14597a[_0x1e35('0x2a')]()['then'](function(){_0x40bd75[_0x1e35('0x1d')](0xcc)[_0x1e35('0x1e')]();});}};}function handleEntityNotFound(_0x3ef9ce,_0x4ddad3){return function(_0x236c6f){if(!_0x236c6f){_0x3ef9ce[_0x1e35('0x1c')](0x194);}return _0x236c6f;};}function handleError(_0x262bac,_0x5b8148){_0x5b8148=_0x5b8148||0x1f4;return function(_0x45bd60){logger['error'](_0x45bd60[_0x1e35('0x2b')]);if(_0x45bd60[_0x1e35('0x2c')]){delete _0x45bd60[_0x1e35('0x2c')];}_0x262bac[_0x1e35('0x1d')](_0x5b8148)[_0x1e35('0x2d')](_0x45bd60);};}exports['index']=function(_0x1c9d4e,_0x20657c){var _0x31533a={},_0x55f225={},_0x26e237={'count':0x0,'rows':[]};var _0x6544ff=_['map'](db['Dynamics365Configuration']['rawAttributes'],function(_0x597132){return{'name':_0x597132[_0x1e35('0x2e')],'type':_0x597132[_0x1e35('0x2f')][_0x1e35('0x30')]};});_0x55f225['model']=_[_0x1e35('0x31')](_0x6544ff,'name');_0x55f225[_0x1e35('0x32')]=_[_0x1e35('0x33')](_0x1c9d4e['query']);_0x55f225['filters']=_['intersection'](_0x55f225[_0x1e35('0x34')],_0x55f225['query']);_0x31533a[_0x1e35('0x35')]=_[_0x1e35('0x36')](_0x55f225[_0x1e35('0x34')],qs['fields'](_0x1c9d4e[_0x1e35('0x32')]['fields']));_0x31533a[_0x1e35('0x35')]=_0x31533a[_0x1e35('0x35')]['length']?_0x31533a[_0x1e35('0x35')]:_0x55f225[_0x1e35('0x34')];if(!_0x1c9d4e[_0x1e35('0x32')][_0x1e35('0x37')](_0x1e35('0x38'))){_0x31533a[_0x1e35('0x21')]=qs[_0x1e35('0x21')](_0x1c9d4e[_0x1e35('0x32')]['limit']);_0x31533a[_0x1e35('0x22')]=qs[_0x1e35('0x22')](_0x1c9d4e[_0x1e35('0x32')]['offset']);}_0x31533a[_0x1e35('0x39')]=qs[_0x1e35('0x3a')](_0x1c9d4e[_0x1e35('0x32')][_0x1e35('0x3a')]);_0x31533a[_0x1e35('0x3b')]=qs['filters'](_['pick'](_0x1c9d4e[_0x1e35('0x32')],_0x55f225[_0x1e35('0x3c')]),_0x6544ff);if(_0x1c9d4e[_0x1e35('0x32')][_0x1e35('0x3d')]){_0x31533a[_0x1e35('0x3b')]=_[_0x1e35('0x3e')](_0x31533a['where'],{'$or':_['map'](_0x6544ff,function(_0x5baa3b){if(_0x5baa3b['type']!==_0x1e35('0x3f')){var _0x6d242a={};_0x6d242a[_0x5baa3b[_0x1e35('0x2c')]]={'$like':'%'+_0x1c9d4e[_0x1e35('0x32')][_0x1e35('0x3d')]+'%'};return _0x6d242a;}})});}_0x31533a=_[_0x1e35('0x3e')]({},_0x31533a,_0x1c9d4e[_0x1e35('0x40')]);var _0x46feda={'where':_0x31533a[_0x1e35('0x3b')]};return db[_0x1e35('0x41')][_0x1e35('0x23')](_0x46feda)[_0x1e35('0x29')](function(_0x1c4c66){_0x26e237[_0x1e35('0x23')]=_0x1c4c66;if(_0x1c9d4e['query'][_0x1e35('0x42')]){_0x31533a[_0x1e35('0x43')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x1e35('0x44')](_0x31533a);})[_0x1e35('0x29')](function(_0x5a9792){_0x26e237['rows']=_0x5a9792;return _0x26e237;})[_0x1e35('0x29')](respondWithFilteredResult(_0x20657c,_0x31533a))['catch'](handleError(_0x20657c,null));};exports[_0x1e35('0x45')]=function(_0x55583b,_0x44a30d){var _0x3694be={'raw':![],'where':{'id':_0x55583b[_0x1e35('0x46')]['id']}},_0x5067e5={};_0x5067e5[_0x1e35('0x34')]=_[_0x1e35('0x33')](db['Dynamics365Configuration'][_0x1e35('0x47')]);_0x5067e5[_0x1e35('0x32')]=_[_0x1e35('0x33')](_0x55583b[_0x1e35('0x32')]);_0x5067e5[_0x1e35('0x3c')]=_[_0x1e35('0x36')](_0x5067e5['model'],_0x5067e5[_0x1e35('0x32')]);_0x3694be[_0x1e35('0x35')]=_[_0x1e35('0x36')](_0x5067e5[_0x1e35('0x34')],qs[_0x1e35('0x48')](_0x55583b[_0x1e35('0x32')][_0x1e35('0x48')]));_0x3694be['attributes']=_0x3694be[_0x1e35('0x35')][_0x1e35('0x49')]?_0x3694be[_0x1e35('0x35')]:_0x5067e5[_0x1e35('0x34')];if(_0x55583b[_0x1e35('0x32')][_0x1e35('0x42')]){_0x3694be[_0x1e35('0x43')]=[{'all':!![]}];}_0x3694be=_[_0x1e35('0x3e')]({},_0x3694be,_0x55583b['options']);return db[_0x1e35('0x41')][_0x1e35('0x4a')](_0x3694be)['then'](handleEntityNotFound(_0x44a30d,null))[_0x1e35('0x29')](respondWithResult(_0x44a30d,null))[_0x1e35('0x4b')](handleError(_0x44a30d,null));};exports[_0x1e35('0x4c')]=function(_0x2725f4,_0x2594c1){return db[_0x1e35('0x41')][_0x1e35('0x4c')](_0x2725f4[_0x1e35('0x4d')],{})[_0x1e35('0x29')](respondWithResult(_0x2594c1,0xc9))['catch'](handleError(_0x2594c1,null));};exports['update']=function(_0x3b7dcb,_0x503be7){if(_0x3b7dcb[_0x1e35('0x4d')]['id']){delete _0x3b7dcb[_0x1e35('0x4d')]['id'];}return db[_0x1e35('0x41')][_0x1e35('0x4a')]({'where':{'id':_0x3b7dcb['params']['id']}})['then'](handleEntityNotFound(_0x503be7,null))[_0x1e35('0x29')](saveUpdates(_0x3b7dcb['body'],null))['then'](respondWithResult(_0x503be7,null))['catch'](handleError(_0x503be7,null));};exports['destroy']=function(_0x4de806,_0x417678){return db['Dynamics365Configuration'][_0x1e35('0x4a')]({'where':{'id':_0x4de806['params']['id']}})[_0x1e35('0x29')](handleEntityNotFound(_0x417678,null))[_0x1e35('0x29')](removeEntity(_0x417678,null))[_0x1e35('0x4b')](handleError(_0x417678,null));};exports[_0x1e35('0x4e')]=function(_0x8d421a,_0x4407ef,_0x3949e6){var _0x52a35d={};var _0x4df9c6={};var _0x59f23d;var _0x5c6530;return db[_0x1e35('0x41')]['findOne']({'where':{'id':_0x8d421a['params']['id']}})['then'](handleEntityNotFound(_0x4407ef,null))[_0x1e35('0x29')](function(_0x3234c2){if(_0x3234c2){_0x59f23d=_0x3234c2;_0x4df9c6[_0x1e35('0x34')]=_[_0x1e35('0x33')](db[_0x1e35('0x4f')][_0x1e35('0x47')]);_0x4df9c6['query']=_[_0x1e35('0x33')](_0x8d421a[_0x1e35('0x32')]);_0x4df9c6[_0x1e35('0x3c')]=_[_0x1e35('0x36')](_0x4df9c6[_0x1e35('0x34')],_0x4df9c6['query']);_0x52a35d[_0x1e35('0x35')]=_['intersection'](_0x4df9c6['model'],qs[_0x1e35('0x48')](_0x8d421a[_0x1e35('0x32')][_0x1e35('0x48')]));_0x52a35d[_0x1e35('0x35')]=_0x52a35d[_0x1e35('0x35')]['length']?_0x52a35d[_0x1e35('0x35')]:_0x4df9c6[_0x1e35('0x34')];_0x52a35d[_0x1e35('0x39')]=qs[_0x1e35('0x3a')](_0x8d421a['query'][_0x1e35('0x3a')]);_0x52a35d[_0x1e35('0x3b')]=qs[_0x1e35('0x3c')](_[_0x1e35('0x50')](_0x8d421a[_0x1e35('0x32')],_0x4df9c6[_0x1e35('0x3c')]));if(_0x8d421a[_0x1e35('0x32')][_0x1e35('0x3d')]){_0x52a35d[_0x1e35('0x3b')]=_['merge'](_0x52a35d[_0x1e35('0x3b')],{'$or':_[_0x1e35('0x31')](_0x52a35d[_0x1e35('0x35')],function(_0x4236ca){var _0x5328ca={};_0x5328ca[_0x4236ca]={'$like':'%'+_0x8d421a[_0x1e35('0x32')][_0x1e35('0x3d')]+'%'};return _0x5328ca;})});}_0x52a35d=_[_0x1e35('0x3e')]({},_0x52a35d,_0x8d421a['options']);return _0x59f23d[_0x1e35('0x4e')](_0x52a35d);}})[_0x1e35('0x29')](function(_0x440b79){if(_0x440b79){_0x5c6530=_0x440b79[_0x1e35('0x49')];if(!_0x8d421a[_0x1e35('0x32')][_0x1e35('0x37')](_0x1e35('0x38'))){_0x52a35d[_0x1e35('0x21')]=qs[_0x1e35('0x21')](_0x8d421a[_0x1e35('0x32')]['limit']);_0x52a35d[_0x1e35('0x22')]=qs[_0x1e35('0x22')](_0x8d421a[_0x1e35('0x32')][_0x1e35('0x22')]);}return _0x59f23d['getFields'](_0x52a35d);}})[_0x1e35('0x29')](function(_0x5ef012){if(_0x5ef012){return _0x5ef012?{'count':_0x5c6530,'rows':_0x5ef012}:null;}})[_0x1e35('0x29')](respondWithResult(_0x4407ef,null))[_0x1e35('0x4b')](handleError(_0x4407ef,null));};exports[_0x1e35('0x51')]=function(_0x503af8,_0x3bf632,_0x5e6946){var _0x662874={};var _0x148610={};var _0x3f73b8;var _0x3c5568;return db[_0x1e35('0x41')][_0x1e35('0x52')]({'where':{'id':_0x503af8[_0x1e35('0x46')]['id']}})[_0x1e35('0x29')](handleEntityNotFound(_0x3bf632,null))[_0x1e35('0x29')](function(_0x44a396){if(_0x44a396){_0x3f73b8=_0x44a396;_0x148610[_0x1e35('0x34')]=_['keys'](db[_0x1e35('0x4f')][_0x1e35('0x47')]);_0x148610[_0x1e35('0x32')]=_['keys'](_0x503af8[_0x1e35('0x32')]);_0x148610[_0x1e35('0x3c')]=_[_0x1e35('0x36')](_0x148610[_0x1e35('0x34')],_0x148610['query']);_0x662874['attributes']=_[_0x1e35('0x36')](_0x148610[_0x1e35('0x34')],qs['fields'](_0x503af8[_0x1e35('0x32')][_0x1e35('0x48')]));_0x662874['attributes']=_0x662874[_0x1e35('0x35')][_0x1e35('0x49')]?_0x662874[_0x1e35('0x35')]:_0x148610[_0x1e35('0x34')];_0x662874[_0x1e35('0x39')]=qs['sort'](_0x503af8[_0x1e35('0x32')]['sort']);_0x662874[_0x1e35('0x3b')]=qs[_0x1e35('0x3c')](_['pick'](_0x503af8[_0x1e35('0x32')],_0x148610[_0x1e35('0x3c')]));if(_0x503af8[_0x1e35('0x32')][_0x1e35('0x3d')]){_0x662874[_0x1e35('0x3b')]=_['merge'](_0x662874[_0x1e35('0x3b')],{'$or':_[_0x1e35('0x31')](_0x662874[_0x1e35('0x35')],function(_0x2f6a05){var _0x5a9012={};_0x5a9012[_0x2f6a05]={'$like':'%'+_0x503af8[_0x1e35('0x32')][_0x1e35('0x3d')]+'%'};return _0x5a9012;})});}_0x662874=_[_0x1e35('0x3e')]({},_0x662874,_0x503af8[_0x1e35('0x40')]);return _0x3f73b8[_0x1e35('0x51')](_0x662874);}})[_0x1e35('0x29')](function(_0x5915eb){if(_0x5915eb){_0x3c5568=_0x5915eb['length'];if(!_0x503af8['query']['hasOwnProperty'](_0x1e35('0x38'))){_0x662874[_0x1e35('0x21')]=qs[_0x1e35('0x21')](_0x503af8[_0x1e35('0x32')]['limit']);_0x662874[_0x1e35('0x22')]=qs['offset'](_0x503af8['query']['offset']);}return _0x3f73b8[_0x1e35('0x51')](_0x662874);}})[_0x1e35('0x29')](function(_0x549191){if(_0x549191){return _0x549191?{'count':_0x3c5568,'rows':_0x549191}:null;}})[_0x1e35('0x29')](respondWithResult(_0x3bf632,null))['catch'](handleError(_0x3bf632,null));};exports['getDescriptions']=function(_0x35beb7,_0x54c8a4,_0x52c217){var _0x29e96c={};var _0x23d6b6={};var _0x2d36ee;var _0xba3618;return db[_0x1e35('0x41')][_0x1e35('0x52')]({'where':{'id':_0x35beb7[_0x1e35('0x46')]['id']}})[_0x1e35('0x29')](handleEntityNotFound(_0x54c8a4,null))['then'](function(_0x29692a){if(_0x29692a){_0x2d36ee=_0x29692a;_0x23d6b6[_0x1e35('0x34')]=_[_0x1e35('0x33')](db['Dynamics365Field'][_0x1e35('0x47')]);_0x23d6b6[_0x1e35('0x32')]=_[_0x1e35('0x33')](_0x35beb7[_0x1e35('0x32')]);_0x23d6b6[_0x1e35('0x3c')]=_[_0x1e35('0x36')](_0x23d6b6[_0x1e35('0x34')],_0x23d6b6[_0x1e35('0x32')]);_0x29e96c[_0x1e35('0x35')]=_[_0x1e35('0x36')](_0x23d6b6[_0x1e35('0x34')],qs[_0x1e35('0x48')](_0x35beb7['query'][_0x1e35('0x48')]));_0x29e96c['attributes']=_0x29e96c[_0x1e35('0x35')][_0x1e35('0x49')]?_0x29e96c[_0x1e35('0x35')]:_0x23d6b6[_0x1e35('0x34')];_0x29e96c[_0x1e35('0x39')]=qs[_0x1e35('0x3a')](_0x35beb7[_0x1e35('0x32')][_0x1e35('0x3a')]);_0x29e96c['where']=qs[_0x1e35('0x3c')](_['pick'](_0x35beb7[_0x1e35('0x32')],_0x23d6b6['filters']));if(_0x35beb7['query']['filter']){_0x29e96c['where']=_[_0x1e35('0x3e')](_0x29e96c[_0x1e35('0x3b')],{'$or':_['map'](_0x29e96c[_0x1e35('0x35')],function(_0x1cac13){var _0x5335f0={};_0x5335f0[_0x1cac13]={'$like':'%'+_0x35beb7[_0x1e35('0x32')][_0x1e35('0x3d')]+'%'};return _0x5335f0;})});}_0x29e96c=_[_0x1e35('0x3e')]({},_0x29e96c,_0x35beb7[_0x1e35('0x40')]);return _0x2d36ee['getDescriptions'](_0x29e96c);}})[_0x1e35('0x29')](function(_0x353f77){if(_0x353f77){_0xba3618=_0x353f77[_0x1e35('0x49')];if(!_0x35beb7['query'][_0x1e35('0x37')](_0x1e35('0x38'))){_0x29e96c['limit']=qs['limit'](_0x35beb7['query']['limit']);_0x29e96c[_0x1e35('0x22')]=qs[_0x1e35('0x22')](_0x35beb7[_0x1e35('0x32')]['offset']);}return _0x2d36ee[_0x1e35('0x53')](_0x29e96c);}})[_0x1e35('0x29')](function(_0x798cb3){if(_0x798cb3){return _0x798cb3?{'count':_0xba3618,'rows':_0x798cb3}:null;}})[_0x1e35('0x29')](respondWithResult(_0x54c8a4,null))[_0x1e35('0x4b')](handleError(_0x54c8a4,null));}; \ No newline at end of file +var _0x5677=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','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/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','getFields','Dynamics365Field','order','getSubjects','findOne','getDescriptions'];(function(_0x3330b8,_0x19b32a){var _0x191799=function(_0xb95e53){while(--_0xb95e53){_0x3330b8['push'](_0x3330b8['shift']());}};_0x191799(++_0x19b32a);}(_0x5677,0xf0));var _0x7567=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x5677[_0x2064e5];return _0x21a233;};'use strict';var emlformat=require(_0x7567('0x0'));var rimraf=require(_0x7567('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7567('0x2'));var rp=require(_0x7567('0x3'));var moment=require(_0x7567('0x4'));var BPromise=require(_0x7567('0x5'));var Mustache=require(_0x7567('0x6'));var util=require(_0x7567('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7567('0x8'));var ejs=require(_0x7567('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7567('0xa'));var squel=require(_0x7567('0xb'));var crypto=require(_0x7567('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7567('0xd'));var toCsv=require(_0x7567('0x8'));var querystring=require(_0x7567('0xe'));var Papa=require(_0x7567('0xf'));var Redis=require(_0x7567('0x10'));var authService=require(_0x7567('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7567('0x12'));var hardwareService=require(_0x7567('0x13'));var logger=require(_0x7567('0x14'))(_0x7567('0x15'));var utils=require(_0x7567('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7567('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f7fc9,_0x384715){_0x384715=_0x384715||0xcc;return function(_0x1c3bc7){if(_0x1c3bc7){return _0x3f7fc9[_0x7567('0x18')](_0x384715);}return _0x3f7fc9[_0x7567('0x19')](_0x384715)[_0x7567('0x1a')]();};}function respondWithResult(_0x1ff2e4,_0x73e9ed){_0x73e9ed=_0x73e9ed||0xc8;return function(_0x127c3e){if(_0x127c3e){return _0x1ff2e4[_0x7567('0x19')](_0x73e9ed)[_0x7567('0x1b')](_0x127c3e);}};}function respondWithFilteredResult(_0x21e165,_0x35b64a){return function(_0x57e623){if(_0x57e623){var _0x137396=typeof _0x35b64a[_0x7567('0x1c')]===_0x7567('0x1d')&&typeof _0x35b64a[_0x7567('0x1e')]===_0x7567('0x1d');var _0x32c03e=_0x57e623[_0x7567('0x1f')];var _0x10f46a=_0x137396?0x0:_0x35b64a[_0x7567('0x1c')];var _0x871203=_0x137396?_0x57e623[_0x7567('0x1f')]:_0x35b64a[_0x7567('0x1c')]+_0x35b64a['limit'];var _0x272d7;if(_0x871203>=_0x32c03e){_0x871203=_0x32c03e;_0x272d7=0xc8;}else{_0x272d7=0xce;}_0x21e165['status'](_0x272d7);return _0x21e165['set'](_0x7567('0x20'),_0x10f46a+'-'+_0x871203+'/'+_0x32c03e)[_0x7567('0x1b')](_0x57e623);}return null;};}function patchUpdates(_0x3f87bb){return function(_0x3d89ea){try{jsonpatch[_0x7567('0x21')](_0x3d89ea,_0x3f87bb,!![]);}catch(_0x266e7d){return BPromise[_0x7567('0x22')](_0x266e7d);}return _0x3d89ea[_0x7567('0x23')]();};}function saveUpdates(_0x10c940,_0x589a60){return function(_0x22b070){if(_0x22b070){return _0x22b070[_0x7567('0x24')](_0x10c940)[_0x7567('0x25')](function(_0x4896d1){return _0x4896d1;});}return null;};}function removeEntity(_0x4f5552,_0x4b1f92){return function(_0x29a352){if(_0x29a352){return _0x29a352['destroy']()['then'](function(){_0x4f5552[_0x7567('0x19')](0xcc)[_0x7567('0x1a')]();});}};}function handleEntityNotFound(_0x2f98ed,_0x531eb8){return function(_0x17e90d){if(!_0x17e90d){_0x2f98ed[_0x7567('0x18')](0x194);}return _0x17e90d;};}function handleError(_0x384673,_0x26eaa7){_0x26eaa7=_0x26eaa7||0x1f4;return function(_0x5ae3c9){logger[_0x7567('0x26')](_0x5ae3c9['stack']);if(_0x5ae3c9[_0x7567('0x27')]){delete _0x5ae3c9[_0x7567('0x27')];}_0x384673[_0x7567('0x19')](_0x26eaa7)[_0x7567('0x28')](_0x5ae3c9);};}exports[_0x7567('0x29')]=function(_0x8a2349,_0x3876ba){var _0x4fa42b={},_0xdeb3c7={},_0x3b3a15={'count':0x0,'rows':[]};var _0x5c7c5a=_[_0x7567('0x2a')](db[_0x7567('0x2b')][_0x7567('0x2c')],function(_0x325786){return{'name':_0x325786[_0x7567('0x2d')],'type':_0x325786[_0x7567('0x2e')]['key']};});_0xdeb3c7[_0x7567('0x2f')]=_[_0x7567('0x2a')](_0x5c7c5a,_0x7567('0x27'));_0xdeb3c7[_0x7567('0x30')]=_['keys'](_0x8a2349[_0x7567('0x30')]);_0xdeb3c7[_0x7567('0x31')]=_['intersection'](_0xdeb3c7[_0x7567('0x2f')],_0xdeb3c7[_0x7567('0x30')]);_0x4fa42b[_0x7567('0x32')]=_[_0x7567('0x33')](_0xdeb3c7[_0x7567('0x2f')],qs[_0x7567('0x34')](_0x8a2349[_0x7567('0x30')][_0x7567('0x34')]));_0x4fa42b[_0x7567('0x32')]=_0x4fa42b[_0x7567('0x32')][_0x7567('0x35')]?_0x4fa42b[_0x7567('0x32')]:_0xdeb3c7[_0x7567('0x2f')];if(!_0x8a2349[_0x7567('0x30')][_0x7567('0x36')](_0x7567('0x37'))){_0x4fa42b[_0x7567('0x1e')]=qs[_0x7567('0x1e')](_0x8a2349[_0x7567('0x30')]['limit']);_0x4fa42b[_0x7567('0x1c')]=qs[_0x7567('0x1c')](_0x8a2349[_0x7567('0x30')][_0x7567('0x1c')]);}_0x4fa42b['order']=qs[_0x7567('0x38')](_0x8a2349[_0x7567('0x30')]['sort']);_0x4fa42b[_0x7567('0x39')]=qs[_0x7567('0x31')](_[_0x7567('0x3a')](_0x8a2349['query'],_0xdeb3c7[_0x7567('0x31')]),_0x5c7c5a);if(_0x8a2349[_0x7567('0x30')][_0x7567('0x3b')]){_0x4fa42b[_0x7567('0x39')]=_[_0x7567('0x3c')](_0x4fa42b['where'],{'$or':_[_0x7567('0x2a')](_0x5c7c5a,function(_0x2e3444){if(_0x2e3444[_0x7567('0x2e')]!==_0x7567('0x3d')){var _0x4a1d03={};_0x4a1d03[_0x2e3444[_0x7567('0x27')]]={'$like':'%'+_0x8a2349[_0x7567('0x30')][_0x7567('0x3b')]+'%'};return _0x4a1d03;}})});}_0x4fa42b=_[_0x7567('0x3c')]({},_0x4fa42b,_0x8a2349[_0x7567('0x3e')]);var _0x299513={'where':_0x4fa42b[_0x7567('0x39')]};return db[_0x7567('0x2b')][_0x7567('0x1f')](_0x299513)[_0x7567('0x25')](function(_0x3ae96d){_0x3b3a15[_0x7567('0x1f')]=_0x3ae96d;if(_0x8a2349[_0x7567('0x30')][_0x7567('0x3f')]){_0x4fa42b[_0x7567('0x40')]=[{'all':!![]}];}return db[_0x7567('0x2b')][_0x7567('0x41')](_0x4fa42b);})[_0x7567('0x25')](function(_0x45de58){_0x3b3a15[_0x7567('0x42')]=_0x45de58;return _0x3b3a15;})['then'](respondWithFilteredResult(_0x3876ba,_0x4fa42b))[_0x7567('0x43')](handleError(_0x3876ba,null));};exports[_0x7567('0x44')]=function(_0x2c3367,_0x4fffaf){var _0x33c759={'raw':![],'where':{'id':_0x2c3367[_0x7567('0x45')]['id']}},_0x3d0bcf={};_0x3d0bcf[_0x7567('0x2f')]=_[_0x7567('0x46')](db['Dynamics365Configuration'][_0x7567('0x2c')]);_0x3d0bcf['query']=_[_0x7567('0x46')](_0x2c3367[_0x7567('0x30')]);_0x3d0bcf[_0x7567('0x31')]=_[_0x7567('0x33')](_0x3d0bcf['model'],_0x3d0bcf[_0x7567('0x30')]);_0x33c759[_0x7567('0x32')]=_[_0x7567('0x33')](_0x3d0bcf[_0x7567('0x2f')],qs[_0x7567('0x34')](_0x2c3367['query'][_0x7567('0x34')]));_0x33c759[_0x7567('0x32')]=_0x33c759[_0x7567('0x32')]['length']?_0x33c759[_0x7567('0x32')]:_0x3d0bcf[_0x7567('0x2f')];if(_0x2c3367[_0x7567('0x30')][_0x7567('0x3f')]){_0x33c759[_0x7567('0x40')]=[{'all':!![]}];}_0x33c759=_['merge']({},_0x33c759,_0x2c3367[_0x7567('0x3e')]);return db[_0x7567('0x2b')]['find'](_0x33c759)[_0x7567('0x25')](handleEntityNotFound(_0x4fffaf,null))['then'](respondWithResult(_0x4fffaf,null))[_0x7567('0x43')](handleError(_0x4fffaf,null));};exports['create']=function(_0x9a8f44,_0x10ec24){return db['Dynamics365Configuration'][_0x7567('0x47')](_0x9a8f44[_0x7567('0x48')],{})[_0x7567('0x25')](respondWithResult(_0x10ec24,0xc9))[_0x7567('0x43')](handleError(_0x10ec24,null));};exports[_0x7567('0x24')]=function(_0x37b2de,_0x1d7594){if(_0x37b2de['body']['id']){delete _0x37b2de[_0x7567('0x48')]['id'];}return db['Dynamics365Configuration'][_0x7567('0x49')]({'where':{'id':_0x37b2de[_0x7567('0x45')]['id']}})[_0x7567('0x25')](handleEntityNotFound(_0x1d7594,null))[_0x7567('0x25')](saveUpdates(_0x37b2de[_0x7567('0x48')],null))[_0x7567('0x25')](respondWithResult(_0x1d7594,null))[_0x7567('0x43')](handleError(_0x1d7594,null));};exports['destroy']=function(_0x3e5f70,_0x3744fe){return db[_0x7567('0x2b')][_0x7567('0x49')]({'where':{'id':_0x3e5f70[_0x7567('0x45')]['id']}})['then'](handleEntityNotFound(_0x3744fe,null))[_0x7567('0x25')](removeEntity(_0x3744fe,null))[_0x7567('0x43')](handleError(_0x3744fe,null));};exports[_0x7567('0x4a')]=function(_0x12694a,_0x457096,_0x32fe48){var _0x525bd9={};var _0x2d3bf2={};var _0x2a9ba8;var _0x511056;return db[_0x7567('0x2b')]['findOne']({'where':{'id':_0x12694a['params']['id']}})[_0x7567('0x25')](handleEntityNotFound(_0x457096,null))[_0x7567('0x25')](function(_0x50de8b){if(_0x50de8b){_0x2a9ba8=_0x50de8b;_0x2d3bf2['model']=_[_0x7567('0x46')](db[_0x7567('0x4b')]['rawAttributes']);_0x2d3bf2['query']=_[_0x7567('0x46')](_0x12694a[_0x7567('0x30')]);_0x2d3bf2[_0x7567('0x31')]=_[_0x7567('0x33')](_0x2d3bf2[_0x7567('0x2f')],_0x2d3bf2[_0x7567('0x30')]);_0x525bd9['attributes']=_[_0x7567('0x33')](_0x2d3bf2[_0x7567('0x2f')],qs[_0x7567('0x34')](_0x12694a[_0x7567('0x30')][_0x7567('0x34')]));_0x525bd9[_0x7567('0x32')]=_0x525bd9[_0x7567('0x32')][_0x7567('0x35')]?_0x525bd9[_0x7567('0x32')]:_0x2d3bf2[_0x7567('0x2f')];_0x525bd9[_0x7567('0x4c')]=qs[_0x7567('0x38')](_0x12694a[_0x7567('0x30')][_0x7567('0x38')]);_0x525bd9[_0x7567('0x39')]=qs[_0x7567('0x31')](_[_0x7567('0x3a')](_0x12694a[_0x7567('0x30')],_0x2d3bf2[_0x7567('0x31')]));if(_0x12694a[_0x7567('0x30')][_0x7567('0x3b')]){_0x525bd9[_0x7567('0x39')]=_['merge'](_0x525bd9[_0x7567('0x39')],{'$or':_[_0x7567('0x2a')](_0x525bd9[_0x7567('0x32')],function(_0x568f7a){var _0x5aef55={};_0x5aef55[_0x568f7a]={'$like':'%'+_0x12694a['query'][_0x7567('0x3b')]+'%'};return _0x5aef55;})});}_0x525bd9=_[_0x7567('0x3c')]({},_0x525bd9,_0x12694a[_0x7567('0x3e')]);return _0x2a9ba8[_0x7567('0x4a')](_0x525bd9);}})[_0x7567('0x25')](function(_0x474d78){if(_0x474d78){_0x511056=_0x474d78[_0x7567('0x35')];if(!_0x12694a[_0x7567('0x30')][_0x7567('0x36')](_0x7567('0x37'))){_0x525bd9[_0x7567('0x1e')]=qs[_0x7567('0x1e')](_0x12694a[_0x7567('0x30')][_0x7567('0x1e')]);_0x525bd9[_0x7567('0x1c')]=qs[_0x7567('0x1c')](_0x12694a[_0x7567('0x30')]['offset']);}return _0x2a9ba8[_0x7567('0x4a')](_0x525bd9);}})['then'](function(_0x291c25){if(_0x291c25){return _0x291c25?{'count':_0x511056,'rows':_0x291c25}:null;}})[_0x7567('0x25')](respondWithResult(_0x457096,null))['catch'](handleError(_0x457096,null));};exports[_0x7567('0x4d')]=function(_0x1bfeb8,_0x12d476,_0x5c25a8){var _0x503d32={};var _0x29d8b2={};var _0x5276a8;var _0x786571;return db[_0x7567('0x2b')]['findOne']({'where':{'id':_0x1bfeb8[_0x7567('0x45')]['id']}})[_0x7567('0x25')](handleEntityNotFound(_0x12d476,null))['then'](function(_0x132b53){if(_0x132b53){_0x5276a8=_0x132b53;_0x29d8b2[_0x7567('0x2f')]=_[_0x7567('0x46')](db[_0x7567('0x4b')]['rawAttributes']);_0x29d8b2[_0x7567('0x30')]=_['keys'](_0x1bfeb8['query']);_0x29d8b2[_0x7567('0x31')]=_[_0x7567('0x33')](_0x29d8b2['model'],_0x29d8b2[_0x7567('0x30')]);_0x503d32[_0x7567('0x32')]=_[_0x7567('0x33')](_0x29d8b2[_0x7567('0x2f')],qs[_0x7567('0x34')](_0x1bfeb8[_0x7567('0x30')][_0x7567('0x34')]));_0x503d32[_0x7567('0x32')]=_0x503d32['attributes'][_0x7567('0x35')]?_0x503d32[_0x7567('0x32')]:_0x29d8b2[_0x7567('0x2f')];_0x503d32[_0x7567('0x4c')]=qs[_0x7567('0x38')](_0x1bfeb8[_0x7567('0x30')][_0x7567('0x38')]);_0x503d32[_0x7567('0x39')]=qs['filters'](_[_0x7567('0x3a')](_0x1bfeb8[_0x7567('0x30')],_0x29d8b2[_0x7567('0x31')]));if(_0x1bfeb8[_0x7567('0x30')][_0x7567('0x3b')]){_0x503d32[_0x7567('0x39')]=_[_0x7567('0x3c')](_0x503d32[_0x7567('0x39')],{'$or':_['map'](_0x503d32[_0x7567('0x32')],function(_0x6238a7){var _0x44bf88={};_0x44bf88[_0x6238a7]={'$like':'%'+_0x1bfeb8['query'][_0x7567('0x3b')]+'%'};return _0x44bf88;})});}_0x503d32=_[_0x7567('0x3c')]({},_0x503d32,_0x1bfeb8['options']);return _0x5276a8['getSubjects'](_0x503d32);}})[_0x7567('0x25')](function(_0x15a286){if(_0x15a286){_0x786571=_0x15a286[_0x7567('0x35')];if(!_0x1bfeb8['query'][_0x7567('0x36')](_0x7567('0x37'))){_0x503d32[_0x7567('0x1e')]=qs[_0x7567('0x1e')](_0x1bfeb8[_0x7567('0x30')][_0x7567('0x1e')]);_0x503d32[_0x7567('0x1c')]=qs[_0x7567('0x1c')](_0x1bfeb8['query']['offset']);}return _0x5276a8[_0x7567('0x4d')](_0x503d32);}})[_0x7567('0x25')](function(_0xbeff65){if(_0xbeff65){return _0xbeff65?{'count':_0x786571,'rows':_0xbeff65}:null;}})[_0x7567('0x25')](respondWithResult(_0x12d476,null))['catch'](handleError(_0x12d476,null));};exports['getDescriptions']=function(_0x44dee2,_0x4b3dce,_0x28cf48){var _0x43df9f={};var _0x1dc798={};var _0x393b42;var _0x4acec2;return db['Dynamics365Configuration'][_0x7567('0x4e')]({'where':{'id':_0x44dee2[_0x7567('0x45')]['id']}})[_0x7567('0x25')](handleEntityNotFound(_0x4b3dce,null))['then'](function(_0x2a6424){if(_0x2a6424){_0x393b42=_0x2a6424;_0x1dc798[_0x7567('0x2f')]=_['keys'](db[_0x7567('0x4b')][_0x7567('0x2c')]);_0x1dc798[_0x7567('0x30')]=_[_0x7567('0x46')](_0x44dee2[_0x7567('0x30')]);_0x1dc798[_0x7567('0x31')]=_[_0x7567('0x33')](_0x1dc798[_0x7567('0x2f')],_0x1dc798['query']);_0x43df9f[_0x7567('0x32')]=_[_0x7567('0x33')](_0x1dc798[_0x7567('0x2f')],qs[_0x7567('0x34')](_0x44dee2[_0x7567('0x30')][_0x7567('0x34')]));_0x43df9f['attributes']=_0x43df9f['attributes'][_0x7567('0x35')]?_0x43df9f['attributes']:_0x1dc798['model'];_0x43df9f['order']=qs[_0x7567('0x38')](_0x44dee2[_0x7567('0x30')]['sort']);_0x43df9f[_0x7567('0x39')]=qs['filters'](_[_0x7567('0x3a')](_0x44dee2[_0x7567('0x30')],_0x1dc798[_0x7567('0x31')]));if(_0x44dee2[_0x7567('0x30')][_0x7567('0x3b')]){_0x43df9f[_0x7567('0x39')]=_['merge'](_0x43df9f[_0x7567('0x39')],{'$or':_[_0x7567('0x2a')](_0x43df9f[_0x7567('0x32')],function(_0x1af40f){var _0x52b754={};_0x52b754[_0x1af40f]={'$like':'%'+_0x44dee2['query']['filter']+'%'};return _0x52b754;})});}_0x43df9f=_[_0x7567('0x3c')]({},_0x43df9f,_0x44dee2['options']);return _0x393b42[_0x7567('0x4f')](_0x43df9f);}})[_0x7567('0x25')](function(_0x3e4009){if(_0x3e4009){_0x4acec2=_0x3e4009[_0x7567('0x35')];if(!_0x44dee2['query'][_0x7567('0x36')](_0x7567('0x37'))){_0x43df9f[_0x7567('0x1e')]=qs[_0x7567('0x1e')](_0x44dee2['query']['limit']);_0x43df9f[_0x7567('0x1c')]=qs['offset'](_0x44dee2[_0x7567('0x30')][_0x7567('0x1c')]);}return _0x393b42['getDescriptions'](_0x43df9f);}})[_0x7567('0x25')](function(_0x4b4daa){if(_0x4b4daa){return _0x4b4daa?{'count':_0x4acec2,'rows':_0x4b4daa}:null;}})[_0x7567('0x25')](respondWithResult(_0x4b3dce,null))[_0x7567('0x43')](handleError(_0x4b3dce,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index fb41758..004815e 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6d6=['path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x399864,_0x14dc0f){var _0x473145=function(_0xe1878c){while(--_0xe1878c){_0x399864['push'](_0x399864['shift']());}};_0x473145(++_0x14dc0f);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x2ab5c1,_0xf07e70){_0x2ab5c1=_0x2ab5c1-0x0;var _0x2af203=_0xd6d6[_0x2ab5c1];return _0x2af203;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var logger=require(_0x6d6d('0x2'))(_0x6d6d('0x3'));var moment=require('moment');var BPromise=require(_0x6d6d('0x4'));var rp=require(_0x6d6d('0x5'));var fs=require('fs');var path=require(_0x6d6d('0x6'));var rimraf=require(_0x6d6d('0x7'));var config=require(_0x6d6d('0x8'));var attributes=require(_0x6d6d('0x9'));module[_0x6d6d('0xa')]=function(_0x5702dc,_0x210ff7){return _0x5702dc[_0x6d6d('0xb')](_0x6d6d('0xc'),attributes,{'tableName':_0x6d6d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports'];(function(_0x2697d9,_0x26806a){var _0x25e6ae=function(_0x4ff250){while(--_0x4ff250){_0x2697d9['push'](_0x2697d9['shift']());}};_0x25e6ae(++_0x26806a);}(_0x008c,0x188));var _0xc008=function(_0x258fb0,_0x5362dc){_0x258fb0=_0x258fb0-0x0;var _0x4d1afe=_0x008c[_0x258fb0];return _0x4d1afe;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Dynamics365Configuration',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 01a306b..434d5e0 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 _0x9f48=['Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info'];(function(_0x11cd98,_0x316193){var _0x171478=function(_0x2e93a6){while(--_0x2e93a6){_0x11cd98['push'](_0x11cd98['shift']());}};_0x171478(++_0x316193);}(_0x9f48,0x197));var _0x89f4=function(_0x197043,_0x3ebf47){_0x197043=_0x197043-0x0;var _0x233e33=_0x9f48[_0x197043];return _0x233e33;};'use strict';var _=require(_0x89f4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x89f4('0x1'));var rs=require(_0x89f4('0x2'));var fs=require('fs');var Redis=require(_0x89f4('0x3'));var db=require(_0x89f4('0x4'))['db'];var utils=require(_0x89f4('0x5'));var logger=require(_0x89f4('0x6'))(_0x89f4('0x7'));var config=require(_0x89f4('0x8'));var jayson=require(_0x89f4('0x9'));var client=jayson[_0x89f4('0xa')][_0x89f4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51890f,_0x33648f,_0x1e0c40){return new BPromise(function(_0xaf12c7,_0x4ff36c){return client['request'](_0x51890f,_0x1e0c40)['then'](function(_0x4d0082){logger[_0x89f4('0xc')](_0x89f4('0xd'),_0x33648f,_0x89f4('0xe'));logger[_0x89f4('0xf')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x33648f,'request\x20sent',JSON[_0x89f4('0x10')](_0x4d0082));if(_0x4d0082[_0x89f4('0x11')]){if(_0x4d0082[_0x89f4('0x11')][_0x89f4('0x12')]===0x1f4){logger[_0x89f4('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x33648f,_0x4d0082[_0x89f4('0x11')][_0x89f4('0x13')]);return _0x4ff36c(_0x4d0082['error'][_0x89f4('0x13')]);}logger[_0x89f4('0x11')](_0x89f4('0xd'),_0x33648f,_0x4d0082[_0x89f4('0x11')][_0x89f4('0x13')]);return _0xaf12c7(_0x4d0082[_0x89f4('0x11')][_0x89f4('0x13')]);}else{logger[_0x89f4('0xc')](_0x89f4('0xd'),_0x33648f,_0x89f4('0xe'));_0xaf12c7(_0x4d0082['result'][_0x89f4('0x13')]);}})[_0x89f4('0x14')](function(_0x28c13f){logger[_0x89f4('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x33648f,_0x28c13f);_0x4ff36c(_0x28c13f);});});} \ No newline at end of file +var _0xffeb=['rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','Dynamics365Configuration,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x50bf5a,_0x807bba){var _0x4ddc1d=function(_0x349a61){while(--_0x349a61){_0x50bf5a['push'](_0x50bf5a['shift']());}};_0x4ddc1d(++_0x807bba);}(_0xffeb,0xb8));var _0xbffe=function(_0x4ea6ae,_0x2644d0){_0x4ea6ae=_0x4ea6ae-0x0;var _0x17704b=_0xffeb[_0x4ea6ae];return _0x17704b;};'use strict';var _=require(_0xbffe('0x0'));var util=require('util');var moment=require(_0xbffe('0x1'));var BPromise=require(_0xbffe('0x2'));var rs=require(_0xbffe('0x3'));var fs=require('fs');var Redis=require(_0xbffe('0x4'));var db=require(_0xbffe('0x5'))['db'];var utils=require(_0xbffe('0x6'));var logger=require(_0xbffe('0x7'))(_0xbffe('0x8'));var config=require(_0xbffe('0x9'));var jayson=require(_0xbffe('0xa'));var client=jayson[_0xbffe('0xb')][_0xbffe('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5d95e5,_0x5391f5,_0x4baea6){return new BPromise(function(_0x8e6a79,_0x331ece){return client['request'](_0x5d95e5,_0x4baea6)[_0xbffe('0xd')](function(_0x55ba29){logger[_0xbffe('0xe')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5391f5,_0xbffe('0xf'));logger[_0xbffe('0x10')](_0xbffe('0x11'),_0x5391f5,'request\x20sent',JSON['stringify'](_0x55ba29));if(_0x55ba29['error']){if(_0x55ba29[_0xbffe('0x12')][_0xbffe('0x13')]===0x1f4){logger[_0xbffe('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5391f5,_0x55ba29[_0xbffe('0x12')][_0xbffe('0x14')]);return _0x331ece(_0x55ba29[_0xbffe('0x12')][_0xbffe('0x14')]);}logger[_0xbffe('0x12')](_0xbffe('0x15'),_0x5391f5,_0x55ba29[_0xbffe('0x12')][_0xbffe('0x14')]);return _0x8e6a79(_0x55ba29[_0xbffe('0x12')][_0xbffe('0x14')]);}else{logger['info'](_0xbffe('0x15'),_0x5391f5,'request\x20sent');_0x8e6a79(_0x55ba29[_0xbffe('0x16')]['message']);}})[_0xbffe('0x17')](function(_0x2db44b){logger[_0xbffe('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5391f5,_0x2db44b);_0x331ece(_0x2db44b);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index baa792a..4bc9321 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 _0x32c2=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDynamics365Field.controller','get','/:id','isAuthenticated','create','put','update'];(function(_0x3d2580,_0x5bcf59){var _0x1bed34=function(_0x4838e5){while(--_0x4838e5){_0x3d2580['push'](_0x3d2580['shift']());}};_0x1bed34(++_0x5bcf59);}(_0x32c2,0xb7));var _0x232c=function(_0x545013,_0xff7081){_0x545013=_0x545013-0x0;var _0x5a0d73=_0x32c2[_0x545013];return _0x5a0d73;};'use strict';var multer=require(_0x232c('0x0'));var util=require(_0x232c('0x1'));var path=require(_0x232c('0x2'));var timeout=require(_0x232c('0x3'));var express=require(_0x232c('0x4'));var router=express[_0x232c('0x5')]();var fs_extra=require(_0x232c('0x6'));var auth=require(_0x232c('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x232c('0x8'));router[_0x232c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x232c('0x9')](_0x232c('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x232c('0xb')](),controller[_0x232c('0xc')]);router[_0x232c('0xd')](_0x232c('0xa'),auth[_0x232c('0xb')](),controller[_0x232c('0xe')]);router[_0x232c('0xf')](_0x232c('0xa'),auth[_0x232c('0xb')](),controller[_0x232c('0x10')]);module[_0x232c('0x11')]=router; \ No newline at end of file +var _0x70f6=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','isAuthenticated','index','get','show','put','/:id'];(function(_0x45d5ef,_0x10c29b){var _0x474d19=function(_0xc182bf){while(--_0xc182bf){_0x45d5ef['push'](_0x45d5ef['shift']());}};_0x474d19(++_0x10c29b);}(_0x70f6,0x13f));var _0x670f=function(_0x3fcfb6,_0x515024){_0x3fcfb6=_0x3fcfb6-0x0;var _0x3b99a7=_0x70f6[_0x3fcfb6];return _0x3b99a7;};'use strict';var multer=require(_0x670f('0x0'));var util=require(_0x670f('0x1'));var path=require(_0x670f('0x2'));var timeout=require(_0x670f('0x3'));var express=require(_0x670f('0x4'));var router=express[_0x670f('0x5')]();var fs_extra=require(_0x670f('0x6'));var auth=require(_0x670f('0x7'));var interaction=require(_0x670f('0x8'));var config=require(_0x670f('0x9'));var controller=require(_0x670f('0xa'));router['get']('/',auth[_0x670f('0xb')](),controller[_0x670f('0xc')]);router[_0x670f('0xd')]('/:id',auth[_0x670f('0xb')](),controller[_0x670f('0xe')]);router['post']('/',auth[_0x670f('0xb')](),controller['create']);router[_0x670f('0xf')](_0x670f('0x10'),auth['isAuthenticated'](),controller[_0x670f('0x11')]);router[_0x670f('0x12')](_0x670f('0x10'),auth[_0x670f('0xb')](),controller[_0x670f('0x13')]);module[_0x670f('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index f80e765..a6ff375 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 _0x7454=['picklist','STRING','variable','BOOLEAN','sequelize','exports','string','customVariable','keyValue'];(function(_0x57cc54,_0x6862b1){var _0xa93acc=function(_0x350992){while(--_0x350992){_0x57cc54['push'](_0x57cc54['shift']());}};_0xa93acc(++_0x6862b1);}(_0x7454,0x100));var _0x4745=function(_0x34cc52,_0x5f0c7e){_0x34cc52=_0x34cc52-0x0;var _0x296404=_0x7454[_0x34cc52];return _0x296404;};'use strict';var Sequelize=require(_0x4745('0x0'));module[_0x4745('0x1')]={'type':{'type':Sequelize['ENUM'](_0x4745('0x2'),'variable',_0x4745('0x3'),_0x4745('0x4'),_0x4745('0x5')),'defaultValue':_0x4745('0x2')},'content':{'type':Sequelize[_0x4745('0x6')]},'key':{'type':Sequelize[_0x4745('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x4745('0x2'),_0x4745('0x7'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4745('0x6')]},'customField':{'type':Sequelize[_0x4745('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4745('0x6')]}}; \ No newline at end of file +var _0x4c6e=['ENUM','variable','keyValue','picklist','STRING','customVariable','exports'];(function(_0x5070d7,_0x4af3c2){var _0x526fe6=function(_0xc4aba){while(--_0xc4aba){_0x5070d7['push'](_0x5070d7['shift']());}};_0x526fe6(++_0x4af3c2);}(_0x4c6e,0xbc));var _0xe4c6=function(_0x13d065,_0x26daca){_0x13d065=_0x13d065-0x0;var _0x167328=_0x4c6e[_0x13d065];return _0x167328;};'use strict';var Sequelize=require('sequelize');module[_0xe4c6('0x0')]={'type':{'type':Sequelize[_0xe4c6('0x1')]('string',_0xe4c6('0x2'),'customVariable',_0xe4c6('0x3'),_0xe4c6('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xe4c6('0x5')]},'key':{'type':Sequelize[_0xe4c6('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0xe4c6('0x2'),_0xe4c6('0x6'))},'keyContent':{'type':Sequelize[_0xe4c6('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xe4c6('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe4c6('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index f6a48b7..f881680 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 _0x5a61=['update','then','destroy','end','error','stack','name','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','include','find','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','json','undefined','count','offset','limit','status','set','Content-Range','apply','save'];(function(_0x5756c6,_0x58290a){var _0x4b5806=function(_0x193246){while(--_0x193246){_0x5756c6['push'](_0x5756c6['shift']());}};_0x4b5806(++_0x58290a);}(_0x5a61,0x74));var _0x15a6=function(_0x3b52da,_0x26eb0f){_0x3b52da=_0x3b52da-0x0;var _0x199a61=_0x5a61[_0x3b52da];return _0x199a61;};'use strict';var emlformat=require(_0x15a6('0x0'));var rimraf=require(_0x15a6('0x1'));var zipdir=require(_0x15a6('0x2'));var jsonpatch=require(_0x15a6('0x3'));var rp=require(_0x15a6('0x4'));var moment=require(_0x15a6('0x5'));var BPromise=require(_0x15a6('0x6'));var Mustache=require(_0x15a6('0x7'));var util=require(_0x15a6('0x8'));var path=require(_0x15a6('0x9'));var sox=require(_0x15a6('0xa'));var csv=require(_0x15a6('0xb'));var ejs=require(_0x15a6('0xc'));var fs=require('fs');var fs_extra=require(_0x15a6('0xd'));var _=require(_0x15a6('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x15a6('0xf'));var deskjs=require(_0x15a6('0x10'));var toCsv=require(_0x15a6('0xb'));var querystring=require(_0x15a6('0x11'));var Papa=require(_0x15a6('0x12'));var Redis=require('ioredis');var authService=require(_0x15a6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x15a6('0x14'));var hardwareService=require(_0x15a6('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x15a6('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x15a6('0x17'));var db=require(_0x15a6('0x18'))['db'];function respondWithStatusCode(_0x292c5e,_0x839e){_0x839e=_0x839e||0xcc;return function(_0x4b7e87){if(_0x4b7e87){return _0x292c5e[_0x15a6('0x19')](_0x839e);}return _0x292c5e['status'](_0x839e)['end']();};}function respondWithResult(_0x348923,_0x608162){_0x608162=_0x608162||0xc8;return function(_0x3644b3){if(_0x3644b3){return _0x348923['status'](_0x608162)[_0x15a6('0x1a')](_0x3644b3);}};}function respondWithFilteredResult(_0x409fd1,_0x2e2708){return function(_0x3d9536){if(_0x3d9536){var _0x389259=typeof _0x2e2708['offset']===_0x15a6('0x1b')&&typeof _0x2e2708['limit']===_0x15a6('0x1b');var _0x105177=_0x3d9536[_0x15a6('0x1c')];var _0x11f526=_0x389259?0x0:_0x2e2708[_0x15a6('0x1d')];var _0x3b3f24=_0x389259?_0x3d9536[_0x15a6('0x1c')]:_0x2e2708[_0x15a6('0x1d')]+_0x2e2708[_0x15a6('0x1e')];var _0x396eee;if(_0x3b3f24>=_0x105177){_0x3b3f24=_0x105177;_0x396eee=0xc8;}else{_0x396eee=0xce;}_0x409fd1[_0x15a6('0x1f')](_0x396eee);return _0x409fd1[_0x15a6('0x20')](_0x15a6('0x21'),_0x11f526+'-'+_0x3b3f24+'/'+_0x105177)['json'](_0x3d9536);}return null;};}function patchUpdates(_0x4397d6){return function(_0x4ad278){try{jsonpatch[_0x15a6('0x22')](_0x4ad278,_0x4397d6,!![]);}catch(_0x202450){return BPromise['reject'](_0x202450);}return _0x4ad278[_0x15a6('0x23')]();};}function saveUpdates(_0xfdef8e,_0x37b60e){return function(_0x1376b3){if(_0x1376b3){return _0x1376b3[_0x15a6('0x24')](_0xfdef8e)[_0x15a6('0x25')](function(_0xc2cec9){return _0xc2cec9;});}return null;};}function removeEntity(_0x3321ea,_0x22a2c9){return function(_0x408b7f){if(_0x408b7f){return _0x408b7f[_0x15a6('0x26')]()[_0x15a6('0x25')](function(){_0x3321ea[_0x15a6('0x1f')](0xcc)[_0x15a6('0x27')]();});}};}function handleEntityNotFound(_0x75c94b,_0x4bd615){return function(_0x526037){if(!_0x526037){_0x75c94b['sendStatus'](0x194);}return _0x526037;};}function handleError(_0x576a92,_0xb3b5fe){_0xb3b5fe=_0xb3b5fe||0x1f4;return function(_0x35fbc4){logger[_0x15a6('0x28')](_0x35fbc4[_0x15a6('0x29')]);if(_0x35fbc4[_0x15a6('0x2a')]){delete _0x35fbc4[_0x15a6('0x2a')];}_0x576a92[_0x15a6('0x1f')](_0xb3b5fe)['send'](_0x35fbc4);};}exports[_0x15a6('0x2b')]=function(_0x4ee10f,_0x5512fb){var _0x45111e={},_0x495bb5={},_0x4dd2c1={'count':0x0,'rows':[]};var _0xad1f16=_[_0x15a6('0x2c')](db[_0x15a6('0x2d')][_0x15a6('0x2e')],function(_0x5d7b4d){return{'name':_0x5d7b4d[_0x15a6('0x2f')],'type':_0x5d7b4d[_0x15a6('0x30')][_0x15a6('0x31')]};});_0x495bb5[_0x15a6('0x32')]=_[_0x15a6('0x2c')](_0xad1f16,_0x15a6('0x2a'));_0x495bb5[_0x15a6('0x33')]=_['keys'](_0x4ee10f['query']);_0x495bb5[_0x15a6('0x34')]=_[_0x15a6('0x35')](_0x495bb5['model'],_0x495bb5[_0x15a6('0x33')]);_0x45111e[_0x15a6('0x36')]=_['intersection'](_0x495bb5['model'],qs[_0x15a6('0x37')](_0x4ee10f[_0x15a6('0x33')][_0x15a6('0x37')]));_0x45111e[_0x15a6('0x36')]=_0x45111e[_0x15a6('0x36')][_0x15a6('0x38')]?_0x45111e['attributes']:_0x495bb5[_0x15a6('0x32')];if(!_0x4ee10f[_0x15a6('0x33')][_0x15a6('0x39')](_0x15a6('0x3a'))){_0x45111e['limit']=qs[_0x15a6('0x1e')](_0x4ee10f[_0x15a6('0x33')][_0x15a6('0x1e')]);_0x45111e[_0x15a6('0x1d')]=qs[_0x15a6('0x1d')](_0x4ee10f['query'][_0x15a6('0x1d')]);}_0x45111e[_0x15a6('0x3b')]=qs['sort'](_0x4ee10f[_0x15a6('0x33')][_0x15a6('0x3c')]);_0x45111e[_0x15a6('0x3d')]=qs['filters'](_[_0x15a6('0x3e')](_0x4ee10f[_0x15a6('0x33')],_0x495bb5[_0x15a6('0x34')]),_0xad1f16);if(_0x4ee10f[_0x15a6('0x33')][_0x15a6('0x3f')]){_0x45111e[_0x15a6('0x3d')]=_[_0x15a6('0x40')](_0x45111e[_0x15a6('0x3d')],{'$or':_[_0x15a6('0x2c')](_0xad1f16,function(_0x9a9e6c){if(_0x9a9e6c[_0x15a6('0x30')]!==_0x15a6('0x41')){var _0x251a5d={};_0x251a5d[_0x9a9e6c['name']]={'$like':'%'+_0x4ee10f['query'][_0x15a6('0x3f')]+'%'};return _0x251a5d;}})});}_0x45111e=_[_0x15a6('0x40')]({},_0x45111e,_0x4ee10f[_0x15a6('0x42')]);var _0x234084={'where':_0x45111e['where']};return db['Dynamics365Field']['count'](_0x234084)[_0x15a6('0x25')](function(_0x3ac213){_0x4dd2c1[_0x15a6('0x1c')]=_0x3ac213;if(_0x4ee10f[_0x15a6('0x33')][_0x15a6('0x43')]){_0x45111e['include']=[{'all':!![]}];}return db[_0x15a6('0x2d')][_0x15a6('0x44')](_0x45111e);})[_0x15a6('0x25')](function(_0x4e7c2e){_0x4dd2c1[_0x15a6('0x45')]=_0x4e7c2e;return _0x4dd2c1;})[_0x15a6('0x25')](respondWithFilteredResult(_0x5512fb,_0x45111e))[_0x15a6('0x46')](handleError(_0x5512fb,null));};exports['show']=function(_0x1351a3,_0x1843ed){var _0x12fe19={'raw':!![],'where':{'id':_0x1351a3[_0x15a6('0x47')]['id']}},_0x1b9d0a={};_0x1b9d0a[_0x15a6('0x32')]=_[_0x15a6('0x48')](db[_0x15a6('0x2d')][_0x15a6('0x2e')]);_0x1b9d0a[_0x15a6('0x33')]=_[_0x15a6('0x48')](_0x1351a3[_0x15a6('0x33')]);_0x1b9d0a[_0x15a6('0x34')]=_[_0x15a6('0x35')](_0x1b9d0a['model'],_0x1b9d0a[_0x15a6('0x33')]);_0x12fe19[_0x15a6('0x36')]=_[_0x15a6('0x35')](_0x1b9d0a[_0x15a6('0x32')],qs[_0x15a6('0x37')](_0x1351a3[_0x15a6('0x33')][_0x15a6('0x37')]));_0x12fe19[_0x15a6('0x36')]=_0x12fe19[_0x15a6('0x36')][_0x15a6('0x38')]?_0x12fe19[_0x15a6('0x36')]:_0x1b9d0a[_0x15a6('0x32')];if(_0x1351a3[_0x15a6('0x33')][_0x15a6('0x43')]){_0x12fe19[_0x15a6('0x49')]=[{'all':!![]}];}_0x12fe19=_['merge']({},_0x12fe19,_0x1351a3[_0x15a6('0x42')]);return db['Dynamics365Field'][_0x15a6('0x4a')](_0x12fe19)[_0x15a6('0x25')](handleEntityNotFound(_0x1843ed,null))[_0x15a6('0x25')](respondWithResult(_0x1843ed,null))['catch'](handleError(_0x1843ed,null));};exports['create']=function(_0x2ef29a,_0x2a9a28){return db[_0x15a6('0x2d')]['create'](_0x2ef29a[_0x15a6('0x4b')],{})['then'](respondWithResult(_0x2a9a28,0xc9))['catch'](handleError(_0x2a9a28,null));};exports['update']=function(_0x328974,_0x5b533a){if(_0x328974[_0x15a6('0x4b')]['id']){delete _0x328974[_0x15a6('0x4b')]['id'];}return db[_0x15a6('0x2d')][_0x15a6('0x4a')]({'where':{'id':_0x328974[_0x15a6('0x47')]['id']}})[_0x15a6('0x25')](handleEntityNotFound(_0x5b533a,null))[_0x15a6('0x25')](saveUpdates(_0x328974[_0x15a6('0x4b')],null))[_0x15a6('0x25')](respondWithResult(_0x5b533a,null))[_0x15a6('0x46')](handleError(_0x5b533a,null));};exports['destroy']=function(_0x13a6a1,_0x329986){return db[_0x15a6('0x2d')]['find']({'where':{'id':_0x13a6a1[_0x15a6('0x47')]['id']}})[_0x15a6('0x25')](handleEntityNotFound(_0x329986,null))[_0x15a6('0x25')](removeEntity(_0x329986,null))[_0x15a6('0x46')](handleError(_0x329986,null));}; \ No newline at end of file +var _0xf665=['squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','end','json','offset','undefined','limit','set','apply','update','destroy','sendStatus','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','then','includeAll','include','findAll','rows','show','fields','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra'];(function(_0x579baf,_0x4aaafa){var _0x4c601a=function(_0x462b53){while(--_0x462b53){_0x579baf['push'](_0x579baf['shift']());}};_0x4c601a(++_0x4aaafa);}(_0xf665,0xd0));var _0x5f66=function(_0x2f0496,_0x1b9148){_0x2f0496=_0x2f0496-0x0;var _0x4969df=_0xf665[_0x2f0496];return _0x4969df;};'use strict';var emlformat=require(_0x5f66('0x0'));var rimraf=require(_0x5f66('0x1'));var zipdir=require(_0x5f66('0x2'));var jsonpatch=require(_0x5f66('0x3'));var rp=require(_0x5f66('0x4'));var moment=require(_0x5f66('0x5'));var BPromise=require(_0x5f66('0x6'));var Mustache=require('mustache');var util=require(_0x5f66('0x7'));var path=require(_0x5f66('0x8'));var sox=require(_0x5f66('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5f66('0xa'));var _=require('lodash');var squel=require(_0x5f66('0xb'));var crypto=require(_0x5f66('0xc'));var jsforce=require(_0x5f66('0xd'));var deskjs=require(_0x5f66('0xe'));var toCsv=require(_0x5f66('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5f66('0x10'));var authService=require(_0x5f66('0x11'));var qs=require(_0x5f66('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5f66('0x13'));var logger=require(_0x5f66('0x14'))(_0x5f66('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5f66('0x16'))['db'];function respondWithStatusCode(_0x537fa8,_0x419205){_0x419205=_0x419205||0xcc;return function(_0x56f3da){if(_0x56f3da){return _0x537fa8['sendStatus'](_0x419205);}return _0x537fa8[_0x5f66('0x17')](_0x419205)[_0x5f66('0x18')]();};}function respondWithResult(_0x257edc,_0x184bfa){_0x184bfa=_0x184bfa||0xc8;return function(_0x315351){if(_0x315351){return _0x257edc[_0x5f66('0x17')](_0x184bfa)[_0x5f66('0x19')](_0x315351);}};}function respondWithFilteredResult(_0x5e5979,_0x2e11df){return function(_0x4c786d){if(_0x4c786d){var _0x4ad6ef=typeof _0x2e11df[_0x5f66('0x1a')]===_0x5f66('0x1b')&&typeof _0x2e11df[_0x5f66('0x1c')]===_0x5f66('0x1b');var _0x53c800=_0x4c786d['count'];var _0x4e5194=_0x4ad6ef?0x0:_0x2e11df[_0x5f66('0x1a')];var _0x4acff9=_0x4ad6ef?_0x4c786d['count']:_0x2e11df[_0x5f66('0x1a')]+_0x2e11df[_0x5f66('0x1c')];var _0x57d8c1;if(_0x4acff9>=_0x53c800){_0x4acff9=_0x53c800;_0x57d8c1=0xc8;}else{_0x57d8c1=0xce;}_0x5e5979['status'](_0x57d8c1);return _0x5e5979[_0x5f66('0x1d')]('Content-Range',_0x4e5194+'-'+_0x4acff9+'/'+_0x53c800)[_0x5f66('0x19')](_0x4c786d);}return null;};}function patchUpdates(_0x3d9d6b){return function(_0x25dd26){try{jsonpatch[_0x5f66('0x1e')](_0x25dd26,_0x3d9d6b,!![]);}catch(_0x1dcd74){return BPromise['reject'](_0x1dcd74);}return _0x25dd26['save']();};}function saveUpdates(_0x38e27e,_0x3bd0dc){return function(_0x146fdf){if(_0x146fdf){return _0x146fdf[_0x5f66('0x1f')](_0x38e27e)['then'](function(_0x594d9d){return _0x594d9d;});}return null;};}function removeEntity(_0x107079,_0x370b84){return function(_0x11131e){if(_0x11131e){return _0x11131e[_0x5f66('0x20')]()['then'](function(){_0x107079[_0x5f66('0x17')](0xcc)[_0x5f66('0x18')]();});}};}function handleEntityNotFound(_0xdefdb,_0x37601f){return function(_0x502109){if(!_0x502109){_0xdefdb[_0x5f66('0x21')](0x194);}return _0x502109;};}function handleError(_0x3d7947,_0x5ef217){_0x5ef217=_0x5ef217||0x1f4;return function(_0xe82d9){logger[_0x5f66('0x22')](_0xe82d9[_0x5f66('0x23')]);if(_0xe82d9[_0x5f66('0x24')]){delete _0xe82d9['name'];}_0x3d7947[_0x5f66('0x17')](_0x5ef217)[_0x5f66('0x25')](_0xe82d9);};}exports[_0x5f66('0x26')]=function(_0x1b6e98,_0x110b96){var _0xceff8c={},_0x322651={},_0x5a6241={'count':0x0,'rows':[]};var _0x1b41b6=_[_0x5f66('0x27')](db[_0x5f66('0x28')][_0x5f66('0x29')],function(_0x2cf712){return{'name':_0x2cf712[_0x5f66('0x2a')],'type':_0x2cf712['type'][_0x5f66('0x2b')]};});_0x322651[_0x5f66('0x2c')]=_[_0x5f66('0x27')](_0x1b41b6,_0x5f66('0x24'));_0x322651[_0x5f66('0x2d')]=_[_0x5f66('0x2e')](_0x1b6e98[_0x5f66('0x2d')]);_0x322651[_0x5f66('0x2f')]=_['intersection'](_0x322651[_0x5f66('0x2c')],_0x322651[_0x5f66('0x2d')]);_0xceff8c[_0x5f66('0x30')]=_[_0x5f66('0x31')](_0x322651[_0x5f66('0x2c')],qs['fields'](_0x1b6e98['query']['fields']));_0xceff8c[_0x5f66('0x30')]=_0xceff8c[_0x5f66('0x30')][_0x5f66('0x32')]?_0xceff8c['attributes']:_0x322651[_0x5f66('0x2c')];if(!_0x1b6e98[_0x5f66('0x2d')][_0x5f66('0x33')](_0x5f66('0x34'))){_0xceff8c[_0x5f66('0x1c')]=qs[_0x5f66('0x1c')](_0x1b6e98['query']['limit']);_0xceff8c[_0x5f66('0x1a')]=qs[_0x5f66('0x1a')](_0x1b6e98['query']['offset']);}_0xceff8c[_0x5f66('0x35')]=qs[_0x5f66('0x36')](_0x1b6e98[_0x5f66('0x2d')]['sort']);_0xceff8c[_0x5f66('0x37')]=qs[_0x5f66('0x2f')](_[_0x5f66('0x38')](_0x1b6e98['query'],_0x322651['filters']),_0x1b41b6);if(_0x1b6e98['query'][_0x5f66('0x39')]){_0xceff8c[_0x5f66('0x37')]=_[_0x5f66('0x3a')](_0xceff8c[_0x5f66('0x37')],{'$or':_['map'](_0x1b41b6,function(_0x4e78a3){if(_0x4e78a3[_0x5f66('0x3b')]!==_0x5f66('0x3c')){var _0x3688df={};_0x3688df[_0x4e78a3[_0x5f66('0x24')]]={'$like':'%'+_0x1b6e98[_0x5f66('0x2d')]['filter']+'%'};return _0x3688df;}})});}_0xceff8c=_[_0x5f66('0x3a')]({},_0xceff8c,_0x1b6e98['options']);var _0x1b9f5e={'where':_0xceff8c[_0x5f66('0x37')]};return db['Dynamics365Field']['count'](_0x1b9f5e)[_0x5f66('0x3d')](function(_0x209378){_0x5a6241['count']=_0x209378;if(_0x1b6e98['query'][_0x5f66('0x3e')]){_0xceff8c[_0x5f66('0x3f')]=[{'all':!![]}];}return db[_0x5f66('0x28')][_0x5f66('0x40')](_0xceff8c);})[_0x5f66('0x3d')](function(_0x24aa64){_0x5a6241[_0x5f66('0x41')]=_0x24aa64;return _0x5a6241;})[_0x5f66('0x3d')](respondWithFilteredResult(_0x110b96,_0xceff8c))['catch'](handleError(_0x110b96,null));};exports[_0x5f66('0x42')]=function(_0x30b6ab,_0xdbe9e4){var _0x550284={'raw':!![],'where':{'id':_0x30b6ab['params']['id']}},_0x249a96={};_0x249a96['model']=_[_0x5f66('0x2e')](db[_0x5f66('0x28')][_0x5f66('0x29')]);_0x249a96['query']=_[_0x5f66('0x2e')](_0x30b6ab['query']);_0x249a96[_0x5f66('0x2f')]=_['intersection'](_0x249a96[_0x5f66('0x2c')],_0x249a96[_0x5f66('0x2d')]);_0x550284[_0x5f66('0x30')]=_['intersection'](_0x249a96[_0x5f66('0x2c')],qs[_0x5f66('0x43')](_0x30b6ab[_0x5f66('0x2d')][_0x5f66('0x43')]));_0x550284[_0x5f66('0x30')]=_0x550284[_0x5f66('0x30')][_0x5f66('0x32')]?_0x550284[_0x5f66('0x30')]:_0x249a96[_0x5f66('0x2c')];if(_0x30b6ab[_0x5f66('0x2d')][_0x5f66('0x3e')]){_0x550284[_0x5f66('0x3f')]=[{'all':!![]}];}_0x550284=_[_0x5f66('0x3a')]({},_0x550284,_0x30b6ab[_0x5f66('0x44')]);return db[_0x5f66('0x28')][_0x5f66('0x45')](_0x550284)[_0x5f66('0x3d')](handleEntityNotFound(_0xdbe9e4,null))['then'](respondWithResult(_0xdbe9e4,null))[_0x5f66('0x46')](handleError(_0xdbe9e4,null));};exports['create']=function(_0x4ce156,_0x22e4eb){return db[_0x5f66('0x28')][_0x5f66('0x47')](_0x4ce156[_0x5f66('0x48')],{})[_0x5f66('0x3d')](respondWithResult(_0x22e4eb,0xc9))[_0x5f66('0x46')](handleError(_0x22e4eb,null));};exports[_0x5f66('0x1f')]=function(_0x561987,_0x278c08){if(_0x561987['body']['id']){delete _0x561987['body']['id'];}return db[_0x5f66('0x28')][_0x5f66('0x45')]({'where':{'id':_0x561987['params']['id']}})[_0x5f66('0x3d')](handleEntityNotFound(_0x278c08,null))[_0x5f66('0x3d')](saveUpdates(_0x561987[_0x5f66('0x48')],null))['then'](respondWithResult(_0x278c08,null))[_0x5f66('0x46')](handleError(_0x278c08,null));};exports[_0x5f66('0x20')]=function(_0x40123d,_0x280c2f){return db[_0x5f66('0x28')][_0x5f66('0x45')]({'where':{'id':_0x40123d['params']['id']}})[_0x5f66('0x3d')](handleEntityNotFound(_0x280c2f,null))['then'](removeEntity(_0x280c2f,null))[_0x5f66('0x46')](handleError(_0x280c2f,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 88ac099..1425740 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 _0xced0=['idField','FieldId','util','api','request-promise','path','int_dynamics365_fields','dynamics365_unique_index'];(function(_0x8d13fa,_0x2a7e7b){var _0x3d207b=function(_0x161c98){while(--_0x161c98){_0x8d13fa['push'](_0x8d13fa['shift']());}};_0x3d207b(++_0x2a7e7b);}(_0xced0,0xd2));var _0x0ced=function(_0x4ed481,_0x1aad66){_0x4ed481=_0x4ed481-0x0;var _0x553d22=_0xced0[_0x4ed481];return _0x553d22;};'use strict';var _=require('lodash');var util=require(_0x0ced('0x0'));var logger=require('../../config/logger')(_0x0ced('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0ced('0x2'));var fs=require('fs');var path=require(_0x0ced('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module['exports']=function(_0x23d8b6,_0x1881bb){return _0x23d8b6['define']('Dynamics365Field',attributes,{'tableName':_0x0ced('0x4'),'paranoid':![],'indexes':[{'name':_0x0ced('0x5'),'fields':[_0x0ced('0x6'),_0x0ced('0x7')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x414f=['request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','define','Dynamics365Field','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x428774,_0x383962){var _0x53a01c=function(_0x2d62da){while(--_0x2d62da){_0x428774['push'](_0x428774['shift']());}};_0x53a01c(++_0x383962);}(_0x414f,0x1f2));var _0xf414=function(_0x16b667,_0xadec02){_0x16b667=_0x16b667-0x0;var _0x58620e=_0x414f[_0x16b667];return _0x58620e;};'use strict';var _=require(_0xf414('0x0'));var util=require(_0xf414('0x1'));var logger=require(_0xf414('0x2'))(_0xf414('0x3'));var moment=require(_0xf414('0x4'));var BPromise=require(_0xf414('0x5'));var rp=require(_0xf414('0x6'));var fs=require('fs');var path=require(_0xf414('0x7'));var rimraf=require(_0xf414('0x8'));var config=require(_0xf414('0x9'));var attributes=require(_0xf414('0xa'));module['exports']=function(_0x221909,_0x53658a){return _0x221909[_0xf414('0xb')](_0xf414('0xc'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':['idField',_0xf414('0xd')],'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 4d8c343..a29d2d2 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 _0x0b80=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','error'];(function(_0x2ef171,_0x49b34a){var _0x23386b=function(_0x201b22){while(--_0x201b22){_0x2ef171['push'](_0x2ef171['shift']());}};_0x23386b(++_0x49b34a);}(_0x0b80,0x1e4));var _0x00b8=function(_0x28ef40,_0x3e4dc7){_0x28ef40=_0x28ef40-0x0;var _0x513392=_0x0b80[_0x28ef40];return _0x513392;};'use strict';var _=require(_0x00b8('0x0'));var util=require(_0x00b8('0x1'));var moment=require(_0x00b8('0x2'));var BPromise=require(_0x00b8('0x3'));var rs=require(_0x00b8('0x4'));var fs=require('fs');var Redis=require(_0x00b8('0x5'));var db=require(_0x00b8('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x00b8('0x7'));var jayson=require(_0x00b8('0x8'));var client=jayson[_0x00b8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x372ce8,_0x3836ff,_0x483fa4){return new BPromise(function(_0x24082d,_0x124c9c){return client[_0x00b8('0xa')](_0x372ce8,_0x483fa4)[_0x00b8('0xb')](function(_0x5a2a09){logger[_0x00b8('0xc')](_0x00b8('0xd'),_0x3836ff,_0x00b8('0xe'));logger['debug']('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x3836ff,_0x00b8('0xe'),JSON['stringify'](_0x5a2a09));if(_0x5a2a09['error']){if(_0x5a2a09[_0x00b8('0xf')][_0x00b8('0x10')]===0x1f4){logger[_0x00b8('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x3836ff,_0x5a2a09[_0x00b8('0xf')][_0x00b8('0x11')]);return _0x124c9c(_0x5a2a09[_0x00b8('0xf')][_0x00b8('0x11')]);}logger[_0x00b8('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x3836ff,_0x5a2a09[_0x00b8('0xf')][_0x00b8('0x11')]);return _0x24082d(_0x5a2a09[_0x00b8('0xf')]['message']);}else{logger['info'](_0x00b8('0xd'),_0x3836ff,'request\x20sent');_0x24082d(_0x5a2a09[_0x00b8('0x12')][_0x00b8('0x11')]);}})[_0x00b8('0x13')](function(_0x13c314){logger['error'](_0x00b8('0xd'),_0x3836ff,_0x13c314);_0x124c9c(_0x13c314);});});} \ No newline at end of file +var _0xf481=['request','request\x20sent','debug','error','Dynamics365Field,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x38185f,_0x41f629){var _0x5cc213=function(_0x177ab8){while(--_0x177ab8){_0x38185f['push'](_0x38185f['shift']());}};_0x5cc213(++_0x41f629);}(_0xf481,0xa3));var _0x1f48=function(_0x30bd66,_0x36a93d){_0x30bd66=_0x30bd66-0x0;var _0x74c9dd=_0xf481[_0x30bd66];return _0x74c9dd;};'use strict';var _=require(_0x1f48('0x0'));var util=require(_0x1f48('0x1'));var moment=require(_0x1f48('0x2'));var BPromise=require(_0x1f48('0x3'));var rs=require(_0x1f48('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f48('0x5'))['db'];var utils=require(_0x1f48('0x6'));var logger=require(_0x1f48('0x7'))(_0x1f48('0x8'));var config=require(_0x1f48('0x9'));var jayson=require(_0x1f48('0xa'));var client=jayson[_0x1f48('0xb')][_0x1f48('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1071f5,_0x433325,_0x29e518){return new BPromise(function(_0x2ae83f,_0xb55ce7){return client[_0x1f48('0xd')](_0x1071f5,_0x29e518)['then'](function(_0x36a1f9){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x433325,_0x1f48('0xe'));logger[_0x1f48('0xf')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x433325,_0x1f48('0xe'),JSON['stringify'](_0x36a1f9));if(_0x36a1f9[_0x1f48('0x10')]){if(_0x36a1f9[_0x1f48('0x10')]['code']===0x1f4){logger[_0x1f48('0x10')](_0x1f48('0x11'),_0x433325,_0x36a1f9['error']['message']);return _0xb55ce7(_0x36a1f9['error'][_0x1f48('0x12')]);}logger[_0x1f48('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x433325,_0x36a1f9[_0x1f48('0x10')][_0x1f48('0x12')]);return _0x2ae83f(_0x36a1f9[_0x1f48('0x10')][_0x1f48('0x12')]);}else{logger[_0x1f48('0x13')](_0x1f48('0x11'),_0x433325,_0x1f48('0xe'));_0x2ae83f(_0x36a1f9[_0x1f48('0x14')][_0x1f48('0x12')]);}})[_0x1f48('0x15')](function(_0x2dbf21){logger[_0x1f48('0x10')](_0x1f48('0x11'),_0x433325,_0x2dbf21);_0xb55ce7(_0x2dbf21);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 2d0d518..cc98da3 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 _0xeb27=['post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','index','/:id','show','get','/:id/configurations','/:id/fields','isAuthenticated','getFields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb27,0x1c2));var _0x7eb2=function(_0x4f1c7b,_0x46d1fd){_0x4f1c7b=_0x4f1c7b-0x0;var _0x2ee349=_0xeb27[_0x4f1c7b];return _0x2ee349;};'use strict';var multer=require(_0x7eb2('0x0'));var util=require(_0x7eb2('0x1'));var path=require(_0x7eb2('0x2'));var timeout=require('connect-timeout');var express=require(_0x7eb2('0x3'));var router=express[_0x7eb2('0x4')]();var fs_extra=require(_0x7eb2('0x5'));var auth=require(_0x7eb2('0x6'));var interaction=require(_0x7eb2('0x7'));var config=require(_0x7eb2('0x8'));var controller=require(_0x7eb2('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x7eb2('0xa')]);router['get'](_0x7eb2('0xb'),auth['isAuthenticated'](),controller[_0x7eb2('0xc')]);router[_0x7eb2('0xd')](_0x7eb2('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x7eb2('0xd')](_0x7eb2('0xf'),auth[_0x7eb2('0x10')](),controller[_0x7eb2('0x11')]);router[_0x7eb2('0x12')]('/',auth['isAuthenticated'](),controller[_0x7eb2('0x13')]);router[_0x7eb2('0x12')](_0x7eb2('0xe'),auth[_0x7eb2('0x10')](),controller[_0x7eb2('0x14')]);router[_0x7eb2('0x15')](_0x7eb2('0xb'),auth['isAuthenticated'](),controller[_0x7eb2('0x16')]);router[_0x7eb2('0x17')](_0x7eb2('0xb'),auth[_0x7eb2('0x10')](),controller[_0x7eb2('0x18')]);module[_0x7eb2('0x19')]=router; \ No newline at end of file +var _0xce14=['Router','fs-extra','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','post','/:id/configurations','addConfiguration','put','update','destroy','exports','multer','util','connect-timeout','express'];(function(_0x272638,_0x42b993){var _0x19d027=function(_0x27ac44){while(--_0x27ac44){_0x272638['push'](_0x272638['shift']());}};_0x19d027(++_0x42b993);}(_0xce14,0x19e));var _0x4ce1=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xce14[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x4ce1('0x0'));var util=require(_0x4ce1('0x1'));var path=require('path');var timeout=require(_0x4ce1('0x2'));var express=require(_0x4ce1('0x3'));var router=express[_0x4ce1('0x4')]();var fs_extra=require(_0x4ce1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4ce1('0x6'));var config=require('../../config/environment');var controller=require(_0x4ce1('0x7'));router[_0x4ce1('0x8')]('/',auth[_0x4ce1('0x9')](),controller[_0x4ce1('0xa')]);router['get'](_0x4ce1('0xb'),auth[_0x4ce1('0x9')](),controller[_0x4ce1('0xc')]);router[_0x4ce1('0x8')]('/:id/configurations',auth[_0x4ce1('0x9')](),controller[_0x4ce1('0xd')]);router[_0x4ce1('0x8')](_0x4ce1('0xe'),auth[_0x4ce1('0x9')](),controller['getFields']);router[_0x4ce1('0xf')]('/',auth[_0x4ce1('0x9')](),controller['create']);router[_0x4ce1('0xf')](_0x4ce1('0x10'),auth['isAuthenticated'](),controller[_0x4ce1('0x11')]);router[_0x4ce1('0x12')](_0x4ce1('0xb'),auth['isAuthenticated'](),controller[_0x4ce1('0x13')]);router['delete'](_0x4ce1('0xb'),auth[_0x4ce1('0x9')](),controller[_0x4ce1('0x14')]);module[_0x4ce1('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index e609b3c..084c7be 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 _0xd943=['exports','STRING','username','remoteUri','sequelize'];(function(_0x586e27,_0x49b591){var _0x2bb60b=function(_0x5293f9){while(--_0x5293f9){_0x586e27['push'](_0x586e27['shift']());}};_0x2bb60b(++_0x49b591);}(_0xd943,0x15d));var _0x3d94=function(_0x15cd05,_0x15f164){_0x15cd05=_0x15cd05-0x0;var _0x1614b1=_0xd943[_0x15cd05];return _0x1614b1;};'use strict';var Sequelize=require(_0x3d94('0x0'));module[_0x3d94('0x1')]={'name':{'type':Sequelize[_0x3d94('0x2')]},'description':{'type':Sequelize[_0x3d94('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x3d94('0x3')},'apiKey':{'type':Sequelize[_0x3d94('0x2')]},'remoteUri':{'type':Sequelize[_0x3d94('0x2')],'unique':_0x3d94('0x4')},'serverUrl':{'type':Sequelize[_0x3d94('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x1a37=['sequelize','exports','STRING','username','remoteUri'];(function(_0x152405,_0x5e8952){var _0x46647a=function(_0x4608b5){while(--_0x4608b5){_0x152405['push'](_0x152405['shift']());}};_0x46647a(++_0x5e8952);}(_0x1a37,0xb4));var _0x71a3=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0x1a37[_0x256b72];return _0x2183e3;};'use strict';var Sequelize=require(_0x71a3('0x0'));module[_0x71a3('0x1')]={'name':{'type':Sequelize[_0x71a3('0x2')]},'description':{'type':Sequelize[_0x71a3('0x2')]},'username':{'type':Sequelize[_0x71a3('0x2')],'unique':_0x71a3('0x3')},'apiKey':{'type':Sequelize[_0x71a3('0x2')]},'remoteUri':{'type':Sequelize[_0x71a3('0x2')],'unique':_0x71a3('0x4')},'serverUrl':{'type':Sequelize[_0x71a3('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 1fa764f..d6ed695 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 _0x422f=['GET','format','%s/%s','api/v2/ticket_fields','%s:X','base64','subject','agent','description','priority','source','ticket_type','group','custom_text','custom_dropdown','label','default','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','json','reject','then','destroy','error','stack','name','index','map','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filter','merge','where','type','VIRTUAL','options','FreshdeskAccount','include','findAll','rows','catch','params','length','includeAll','find','create','body','update','findOne','rawAttributes','pick','getConfigurations','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','FreshdeskField','remoteUri','apiKey','lastIndexOf'];(function(_0x26d9e5,_0x13594a){var _0x18dbfa=function(_0x2534f2){while(--_0x2534f2){_0x26d9e5['push'](_0x26d9e5['shift']());}};_0x18dbfa(++_0x13594a);}(_0x422f,0x1c7));var _0xf422=function(_0x50a8ec,_0x25eb4b){_0x50a8ec=_0x50a8ec-0x0;var _0xcaa7af=_0x422f[_0x50a8ec];return _0xcaa7af;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf422('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf422('0x1'));var rp=require(_0xf422('0x2'));var moment=require('moment');var BPromise=require(_0xf422('0x3'));var Mustache=require(_0xf422('0x4'));var util=require(_0xf422('0x5'));var path=require(_0xf422('0x6'));var sox=require(_0xf422('0x7'));var csv=require(_0xf422('0x8'));var ejs=require(_0xf422('0x9'));var fs=require('fs');var fs_extra=require(_0xf422('0xa'));var _=require(_0xf422('0xb'));var squel=require('squel');var crypto=require(_0xf422('0xc'));var jsforce=require(_0xf422('0xd'));var deskjs=require(_0xf422('0xe'));var toCsv=require(_0xf422('0x8'));var querystring=require(_0xf422('0xf'));var Papa=require('papaparse');var Redis=require(_0xf422('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf422('0x11'));var hardwareService=require(_0xf422('0x12'));var logger=require(_0xf422('0x13'))(_0xf422('0x14'));var utils=require(_0xf422('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf422('0x16'));var db=require(_0xf422('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x133a6a,_0x8aa9cc){_0x8aa9cc=_0x8aa9cc||0xcc;return function(_0x1ea998){if(_0x1ea998){return _0x133a6a[_0xf422('0x18')](_0x8aa9cc);}return _0x133a6a[_0xf422('0x19')](_0x8aa9cc)[_0xf422('0x1a')]();};}function respondWithResult(_0x223b21,_0x272430){_0x272430=_0x272430||0xc8;return function(_0x2e6d81){if(_0x2e6d81){return _0x223b21['status'](_0x272430)['json'](_0x2e6d81);}};}function respondWithFilteredResult(_0x52f96b,_0x1c81e1){return function(_0x30b70a){if(_0x30b70a){var _0x21a35d=typeof _0x1c81e1[_0xf422('0x1b')]==='undefined'&&typeof _0x1c81e1[_0xf422('0x1c')]===_0xf422('0x1d');var _0x76e4b1=_0x30b70a[_0xf422('0x1e')];var _0x43de64=_0x21a35d?0x0:_0x1c81e1[_0xf422('0x1b')];var _0x4fefd0=_0x21a35d?_0x30b70a['count']:_0x1c81e1[_0xf422('0x1b')]+_0x1c81e1[_0xf422('0x1c')];var _0x215287;if(_0x4fefd0>=_0x76e4b1){_0x4fefd0=_0x76e4b1;_0x215287=0xc8;}else{_0x215287=0xce;}_0x52f96b['status'](_0x215287);return _0x52f96b[_0xf422('0x1f')]('Content-Range',_0x43de64+'-'+_0x4fefd0+'/'+_0x76e4b1)[_0xf422('0x20')](_0x30b70a);}return null;};}function patchUpdates(_0x15833b){return function(_0x36b7e7){try{jsonpatch['apply'](_0x36b7e7,_0x15833b,!![]);}catch(_0xf2d06b){return BPromise[_0xf422('0x21')](_0xf2d06b);}return _0x36b7e7['save']();};}function saveUpdates(_0x4b80a0,_0x268575){return function(_0x3cb26b){if(_0x3cb26b){return _0x3cb26b['update'](_0x4b80a0)[_0xf422('0x22')](function(_0x570ea2){return _0x570ea2;});}return null;};}function removeEntity(_0x3b21a5,_0x32ceee){return function(_0x31a518){if(_0x31a518){return _0x31a518[_0xf422('0x23')]()[_0xf422('0x22')](function(){_0x3b21a5[_0xf422('0x19')](0xcc)[_0xf422('0x1a')]();});}};}function handleEntityNotFound(_0x11d10b,_0x5dcab4){return function(_0x1125ce){if(!_0x1125ce){_0x11d10b['sendStatus'](0x194);}return _0x1125ce;};}function handleError(_0x2f0f9f,_0x7d36e7){_0x7d36e7=_0x7d36e7||0x1f4;return function(_0x29e62f){logger[_0xf422('0x24')](_0x29e62f[_0xf422('0x25')]);if(_0x29e62f[_0xf422('0x26')]){delete _0x29e62f[_0xf422('0x26')];}_0x2f0f9f['status'](_0x7d36e7)['send'](_0x29e62f);};}exports[_0xf422('0x27')]=function(_0x10d51b,_0x266fb8){var _0x33ef63={},_0xefb99e={},_0x48e0c7={'count':0x0,'rows':[]};var _0x6d22f1=_[_0xf422('0x28')](db['FreshdeskAccount']['rawAttributes'],function(_0x3f86fc){return{'name':_0x3f86fc['fieldName'],'type':_0x3f86fc['type'][_0xf422('0x29')]};});_0xefb99e[_0xf422('0x2a')]=_['map'](_0x6d22f1,_0xf422('0x26'));_0xefb99e[_0xf422('0x2b')]=_[_0xf422('0x2c')](_0x10d51b[_0xf422('0x2b')]);_0xefb99e[_0xf422('0x2d')]=_['intersection'](_0xefb99e[_0xf422('0x2a')],_0xefb99e['query']);_0x33ef63[_0xf422('0x2e')]=_[_0xf422('0x2f')](_0xefb99e[_0xf422('0x2a')],qs[_0xf422('0x30')](_0x10d51b[_0xf422('0x2b')][_0xf422('0x30')]));_0x33ef63[_0xf422('0x2e')]=_0x33ef63['attributes']['length']?_0x33ef63[_0xf422('0x2e')]:_0xefb99e[_0xf422('0x2a')];if(!_0x10d51b['query'][_0xf422('0x31')](_0xf422('0x32'))){_0x33ef63[_0xf422('0x1c')]=qs[_0xf422('0x1c')](_0x10d51b[_0xf422('0x2b')][_0xf422('0x1c')]);_0x33ef63[_0xf422('0x1b')]=qs[_0xf422('0x1b')](_0x10d51b[_0xf422('0x2b')][_0xf422('0x1b')]);}_0x33ef63[_0xf422('0x33')]=qs[_0xf422('0x34')](_0x10d51b[_0xf422('0x2b')][_0xf422('0x34')]);_0x33ef63['where']=qs['filters'](_['pick'](_0x10d51b[_0xf422('0x2b')],_0xefb99e[_0xf422('0x2d')]),_0x6d22f1);if(_0x10d51b['query'][_0xf422('0x35')]){_0x33ef63['where']=_[_0xf422('0x36')](_0x33ef63[_0xf422('0x37')],{'$or':_['map'](_0x6d22f1,function(_0x42dc4d){if(_0x42dc4d[_0xf422('0x38')]!==_0xf422('0x39')){var _0x511fc7={};_0x511fc7[_0x42dc4d[_0xf422('0x26')]]={'$like':'%'+_0x10d51b['query']['filter']+'%'};return _0x511fc7;}})});}_0x33ef63=_['merge']({},_0x33ef63,_0x10d51b[_0xf422('0x3a')]);var _0x293497={'where':_0x33ef63[_0xf422('0x37')]};return db[_0xf422('0x3b')][_0xf422('0x1e')](_0x293497)[_0xf422('0x22')](function(_0x42923d){_0x48e0c7[_0xf422('0x1e')]=_0x42923d;if(_0x10d51b['query']['includeAll']){_0x33ef63[_0xf422('0x3c')]=[{'all':!![]}];}return db[_0xf422('0x3b')][_0xf422('0x3d')](_0x33ef63);})[_0xf422('0x22')](function(_0xc7423f){_0x48e0c7[_0xf422('0x3e')]=_0xc7423f;return _0x48e0c7;})['then'](respondWithFilteredResult(_0x266fb8,_0x33ef63))[_0xf422('0x3f')](handleError(_0x266fb8,null));};exports['show']=function(_0x17c1f2,_0x391e3c){var _0x564041={'raw':![],'where':{'id':_0x17c1f2[_0xf422('0x40')]['id']}},_0x3c9b0d={};_0x3c9b0d[_0xf422('0x2a')]=_[_0xf422('0x2c')](db[_0xf422('0x3b')]['rawAttributes']);_0x3c9b0d[_0xf422('0x2b')]=_[_0xf422('0x2c')](_0x17c1f2[_0xf422('0x2b')]);_0x3c9b0d[_0xf422('0x2d')]=_[_0xf422('0x2f')](_0x3c9b0d['model'],_0x3c9b0d[_0xf422('0x2b')]);_0x564041[_0xf422('0x2e')]=_['intersection'](_0x3c9b0d[_0xf422('0x2a')],qs['fields'](_0x17c1f2[_0xf422('0x2b')][_0xf422('0x30')]));_0x564041[_0xf422('0x2e')]=_0x564041[_0xf422('0x2e')][_0xf422('0x41')]?_0x564041[_0xf422('0x2e')]:_0x3c9b0d[_0xf422('0x2a')];if(_0x17c1f2[_0xf422('0x2b')][_0xf422('0x42')]){_0x564041[_0xf422('0x3c')]=[{'all':!![]}];}_0x564041=_[_0xf422('0x36')]({},_0x564041,_0x17c1f2[_0xf422('0x3a')]);return db[_0xf422('0x3b')][_0xf422('0x43')](_0x564041)[_0xf422('0x22')](handleEntityNotFound(_0x391e3c,null))['then'](respondWithResult(_0x391e3c,null))['catch'](handleError(_0x391e3c,null));};exports[_0xf422('0x44')]=function(_0x2c2ce9,_0x3452a8){return db['FreshdeskAccount'][_0xf422('0x44')](_0x2c2ce9[_0xf422('0x45')],{})[_0xf422('0x22')](respondWithResult(_0x3452a8,0xc9))[_0xf422('0x3f')](handleError(_0x3452a8,null));};exports[_0xf422('0x46')]=function(_0x259e24,_0x3dffe0){if(_0x259e24['body']['id']){delete _0x259e24[_0xf422('0x45')]['id'];}return db['FreshdeskAccount'][_0xf422('0x43')]({'where':{'id':_0x259e24[_0xf422('0x40')]['id']}})['then'](handleEntityNotFound(_0x3dffe0,null))[_0xf422('0x22')](saveUpdates(_0x259e24[_0xf422('0x45')],null))[_0xf422('0x22')](respondWithResult(_0x3dffe0,null))[_0xf422('0x3f')](handleError(_0x3dffe0,null));};exports[_0xf422('0x23')]=function(_0x5c3cb8,_0x5261df){return db[_0xf422('0x3b')]['find']({'where':{'id':_0x5c3cb8[_0xf422('0x40')]['id']}})[_0xf422('0x22')](handleEntityNotFound(_0x5261df,null))[_0xf422('0x22')](removeEntity(_0x5261df,null))[_0xf422('0x3f')](handleError(_0x5261df,null));};exports['getConfigurations']=function(_0x4b8b1f,_0x44448c,_0xe333b8){var _0x46a200={};var _0xddcd6c={};var _0x2b640a;var _0x350af2;return db['FreshdeskAccount'][_0xf422('0x47')]({'where':{'id':_0x4b8b1f['params']['id']}})[_0xf422('0x22')](handleEntityNotFound(_0x44448c,null))[_0xf422('0x22')](function(_0x2369e7){if(_0x2369e7){_0x2b640a=_0x2369e7;_0xddcd6c[_0xf422('0x2a')]=_['keys'](db['FreshdeskConfiguration'][_0xf422('0x48')]);_0xddcd6c[_0xf422('0x2b')]=_[_0xf422('0x2c')](_0x4b8b1f[_0xf422('0x2b')]);_0xddcd6c[_0xf422('0x2d')]=_[_0xf422('0x2f')](_0xddcd6c[_0xf422('0x2a')],_0xddcd6c['query']);_0x46a200[_0xf422('0x2e')]=_[_0xf422('0x2f')](_0xddcd6c[_0xf422('0x2a')],qs[_0xf422('0x30')](_0x4b8b1f[_0xf422('0x2b')][_0xf422('0x30')]));_0x46a200[_0xf422('0x2e')]=_0x46a200[_0xf422('0x2e')][_0xf422('0x41')]?_0x46a200[_0xf422('0x2e')]:_0xddcd6c['model'];_0x46a200[_0xf422('0x33')]=qs[_0xf422('0x34')](_0x4b8b1f[_0xf422('0x2b')][_0xf422('0x34')]);_0x46a200[_0xf422('0x37')]=qs['filters'](_[_0xf422('0x49')](_0x4b8b1f[_0xf422('0x2b')],_0xddcd6c['filters']));if(_0x4b8b1f[_0xf422('0x2b')][_0xf422('0x35')]){_0x46a200[_0xf422('0x37')]=_[_0xf422('0x36')](_0x46a200[_0xf422('0x37')],{'$or':_[_0xf422('0x28')](_0x46a200[_0xf422('0x2e')],function(_0x5997bc){var _0x2c2316={};_0x2c2316[_0x5997bc]={'$like':'%'+_0x4b8b1f[_0xf422('0x2b')][_0xf422('0x35')]+'%'};return _0x2c2316;})});}_0x46a200=_['merge']({},_0x46a200,_0x4b8b1f[_0xf422('0x3a')]);return _0x2b640a[_0xf422('0x4a')](_0x46a200);}})[_0xf422('0x22')](function(_0x144494){if(_0x144494){_0x350af2=_0x144494[_0xf422('0x41')];if(!_0x4b8b1f[_0xf422('0x2b')][_0xf422('0x31')](_0xf422('0x32'))){_0x46a200[_0xf422('0x1c')]=qs[_0xf422('0x1c')](_0x4b8b1f[_0xf422('0x2b')][_0xf422('0x1c')]);_0x46a200[_0xf422('0x1b')]=qs[_0xf422('0x1b')](_0x4b8b1f[_0xf422('0x2b')][_0xf422('0x1b')]);}return _0x2b640a[_0xf422('0x4a')](_0x46a200);}})[_0xf422('0x22')](function(_0x366019){if(_0x366019){return _0x366019?{'count':_0x350af2,'rows':_0x366019}:null;}})['then'](respondWithResult(_0x44448c,null))['catch'](handleError(_0x44448c,null));};exports[_0xf422('0x4b')]=function(_0x5ec3a5,_0xd9e138,_0x3345dd){if(_0x5ec3a5[_0xf422('0x45')]['id']){delete _0x5ec3a5[_0xf422('0x45')]['id'];}return db['FreshdeskAccount'][_0xf422('0x47')]({'where':{'id':_0x5ec3a5[_0xf422('0x40')]['id']}})[_0xf422('0x22')](handleEntityNotFound(_0xd9e138,null))['then'](function(_0x5b5dfa){if(_0x5b5dfa){_0x5ec3a5[_0xf422('0x45')][_0xf422('0x4c')]=_0x5b5dfa['id'];_0x5ec3a5[_0xf422('0x45')][_0xf422('0x4d')]=integrations['getSubjects'](_0x5ec3a5['body']['channel'],_0x5ec3a5[_0xf422('0x45')][_0xf422('0x38')]);_0x5ec3a5[_0xf422('0x45')][_0xf422('0x4e')]=integrations[_0xf422('0x4f')](_0x5ec3a5[_0xf422('0x45')][_0xf422('0x50')],_0x5ec3a5['body']['type']);return db['FreshdeskConfiguration'][_0xf422('0x44')](_0x5ec3a5['body'],{'include':[{'model':db[_0xf422('0x51')],'as':_0xf422('0x4d')},{'model':db['FreshdeskField'],'as':_0xf422('0x4e')}]});}return null;})[_0xf422('0x22')](respondWithResult(_0xd9e138,null))[_0xf422('0x3f')](handleError(_0xd9e138,null));};exports['getFields']=function(_0x2435af,_0x24adb6,_0x5b1760){var _0x20d6aa='';return db[_0xf422('0x3b')][_0xf422('0x47')]({'where':{'id':_0x2435af[_0xf422('0x40')]['id']},'attributes':['id',_0xf422('0x52'),_0xf422('0x53')]})[_0xf422('0x22')](handleEntityNotFound(_0x24adb6,null))['then'](function(_0x1d2ca8){if(_0x1d2ca8){_0x20d6aa=_0x1d2ca8[_0xf422('0x52')];var _0x33c2df=_0x20d6aa['slice'](-0x1);if(_0x33c2df==='/'){_0x20d6aa=_0x20d6aa['substring'](0x0,_0x20d6aa[_0xf422('0x54')](_0x33c2df));}return rp({'method':_0xf422('0x55'),'uri':util[_0xf422('0x56')](_0xf422('0x57'),_0x20d6aa,_0xf422('0x58')),'headers':{'Authorization':util[_0xf422('0x56')]('Basic\x20%s',new Buffer(util[_0xf422('0x56')](_0xf422('0x59'),_0x1d2ca8[_0xf422('0x53')]))['toString'](_0xf422('0x5a')))},'json':!![]});}})['then'](function(_0x4dedde){if(_0x4dedde){var _0x47aa00=['requester',_0xf422('0x5b'),_0xf422('0x5c'),_0xf422('0x5d'),_0xf422('0x19'),_0xf422('0x5e'),'group',_0xf422('0x5f'),_0xf422('0x60'),_0xf422('0x61'),'company'];_['remove'](_0x4dedde,function(_0x3bc35a){return _0x47aa00['includes'](_0x3bc35a[_0xf422('0x26')])||!_0x3bc35a['default']&&_0x3bc35a[_0xf422('0x38')]!==_0xf422('0x62')&&_0x3bc35a['type']!==_0xf422('0x63');});return{'count':_0x4dedde[_0xf422('0x41')],'rows':_['map'](_0x4dedde,function(_0x35d33c){return{'id':_0x35d33c[_0xf422('0x26')],'name':_0x35d33c[_0xf422('0x64')],'custom':!_0x35d33c[_0xf422('0x65')],'options':_0x35d33c['choices']?_[_0xf422('0x28')](_0x35d33c['choices'],function(_0x175b19){return{'name':_[_0xf422('0x66')](_0x175b19),'value':_0x175b19};}):[]};})};}})[_0xf422('0x22')](respondWithResult(_0x24adb6,null))['catch'](function(_0x4e032d){var _0x853ef4=_0x2435af[_0xf422('0x2b')]['test']?0x1f4:_0x4e032d[_0xf422('0x67')]||0x1f4;logger['error'](_0xf422('0x68'),'getFields',_0x853ef4,JSON['stringify'](_0x4e032d));delete _0x4e032d[_0xf422('0x26')];if(_0x853ef4===0x191){_0x853ef4=0x190;}_0x24adb6[_0xf422('0x19')](_0x853ef4)[_0xf422('0x69')](_0x2435af[_0xf422('0x2b')][_0xf422('0x6a')]?{'message':_0xf422('0x6b'),'statusCode':_0x4e032d[_0xf422('0x67')]}:_0x4e032d);});}; \ No newline at end of file +var _0xd820=['channel','Descriptions','getDescriptions','type','create','Subjects','FreshdeskField','getFields','apiKey','remoteUri','GET','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','%s:X','base64','requester','subject','priority','group','source','ticket_type','remove','includes','default','custom_dropdown','label','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','destroy','error','stack','name','index','map','FreshdeskAccount','rawAttributes','fieldName','key','model','keys','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','show','length','merge','find','catch','body','params','getConfigurations','findOne','FreshdeskConfiguration','intersection','addConfiguration','AccountId','getSubjects'];(function(_0x221a70,_0x364013){var _0x1070b4=function(_0x32b9f3){while(--_0x32b9f3){_0x221a70['push'](_0x221a70['shift']());}};_0x1070b4(++_0x364013);}(_0xd820,0x16f));var _0x0d82=function(_0x2f5544,_0x134b17){_0x2f5544=_0x2f5544-0x0;var _0x186801=_0xd820[_0x2f5544];return _0x186801;};'use strict';var emlformat=require(_0x0d82('0x0'));var rimraf=require(_0x0d82('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0d82('0x2'));var rp=require(_0x0d82('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0d82('0x4'));var util=require(_0x0d82('0x5'));var path=require(_0x0d82('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d82('0x7'));var fs=require('fs');var fs_extra=require(_0x0d82('0x8'));var _=require(_0x0d82('0x9'));var squel=require(_0x0d82('0xa'));var crypto=require('crypto');var jsforce=require(_0x0d82('0xb'));var deskjs=require(_0x0d82('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0d82('0xd'));var Redis=require(_0x0d82('0xe'));var authService=require(_0x0d82('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d82('0x10'));var logger=require(_0x0d82('0x11'))(_0x0d82('0x12'));var utils=require(_0x0d82('0x13'));var config=require(_0x0d82('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x0d82('0x15'));function respondWithStatusCode(_0x7fdd7a,_0x103e1d){_0x103e1d=_0x103e1d||0xcc;return function(_0x4ddcf0){if(_0x4ddcf0){return _0x7fdd7a[_0x0d82('0x16')](_0x103e1d);}return _0x7fdd7a[_0x0d82('0x17')](_0x103e1d)[_0x0d82('0x18')]();};}function respondWithResult(_0x3ad9dd,_0x288020){_0x288020=_0x288020||0xc8;return function(_0x11e218){if(_0x11e218){return _0x3ad9dd[_0x0d82('0x17')](_0x288020)[_0x0d82('0x19')](_0x11e218);}};}function respondWithFilteredResult(_0x2b2d47,_0x55415f){return function(_0x1e9024){if(_0x1e9024){var _0x507c9e=typeof _0x55415f[_0x0d82('0x1a')]==='undefined'&&typeof _0x55415f[_0x0d82('0x1b')]===_0x0d82('0x1c');var _0x16c858=_0x1e9024[_0x0d82('0x1d')];var _0x2bb0da=_0x507c9e?0x0:_0x55415f[_0x0d82('0x1a')];var _0x24c091=_0x507c9e?_0x1e9024[_0x0d82('0x1d')]:_0x55415f[_0x0d82('0x1a')]+_0x55415f[_0x0d82('0x1b')];var _0x219abc;if(_0x24c091>=_0x16c858){_0x24c091=_0x16c858;_0x219abc=0xc8;}else{_0x219abc=0xce;}_0x2b2d47[_0x0d82('0x17')](_0x219abc);return _0x2b2d47[_0x0d82('0x1e')](_0x0d82('0x1f'),_0x2bb0da+'-'+_0x24c091+'/'+_0x16c858)['json'](_0x1e9024);}return null;};}function patchUpdates(_0x517997){return function(_0x3874a7){try{jsonpatch[_0x0d82('0x20')](_0x3874a7,_0x517997,!![]);}catch(_0x18d869){return BPromise['reject'](_0x18d869);}return _0x3874a7['save']();};}function saveUpdates(_0x2e332d,_0x20d5eb){return function(_0xd3dc36){if(_0xd3dc36){return _0xd3dc36[_0x0d82('0x21')](_0x2e332d)[_0x0d82('0x22')](function(_0x18c248){return _0x18c248;});}return null;};}function removeEntity(_0x4a2d4d,_0xb04794){return function(_0x22a85a){if(_0x22a85a){return _0x22a85a[_0x0d82('0x23')]()['then'](function(){_0x4a2d4d[_0x0d82('0x17')](0xcc)[_0x0d82('0x18')]();});}};}function handleEntityNotFound(_0x35a614,_0x51b5a1){return function(_0x26a9ca){if(!_0x26a9ca){_0x35a614[_0x0d82('0x16')](0x194);}return _0x26a9ca;};}function handleError(_0xa636f0,_0x5b3307){_0x5b3307=_0x5b3307||0x1f4;return function(_0x3258cf){logger[_0x0d82('0x24')](_0x3258cf[_0x0d82('0x25')]);if(_0x3258cf[_0x0d82('0x26')]){delete _0x3258cf[_0x0d82('0x26')];}_0xa636f0[_0x0d82('0x17')](_0x5b3307)['send'](_0x3258cf);};}exports[_0x0d82('0x27')]=function(_0x15bc2b,_0x43f679){var _0xf08815={},_0x548f33={},_0x465cd6={'count':0x0,'rows':[]};var _0x293276=_[_0x0d82('0x28')](db[_0x0d82('0x29')][_0x0d82('0x2a')],function(_0x730ed9){return{'name':_0x730ed9[_0x0d82('0x2b')],'type':_0x730ed9['type'][_0x0d82('0x2c')]};});_0x548f33[_0x0d82('0x2d')]=_['map'](_0x293276,_0x0d82('0x26'));_0x548f33['query']=_[_0x0d82('0x2e')](_0x15bc2b[_0x0d82('0x2f')]);_0x548f33[_0x0d82('0x30')]=_['intersection'](_0x548f33[_0x0d82('0x2d')],_0x548f33[_0x0d82('0x2f')]);_0xf08815[_0x0d82('0x31')]=_['intersection'](_0x548f33[_0x0d82('0x2d')],qs[_0x0d82('0x32')](_0x15bc2b[_0x0d82('0x2f')]['fields']));_0xf08815[_0x0d82('0x31')]=_0xf08815[_0x0d82('0x31')]['length']?_0xf08815[_0x0d82('0x31')]:_0x548f33['model'];if(!_0x15bc2b[_0x0d82('0x2f')][_0x0d82('0x33')](_0x0d82('0x34'))){_0xf08815[_0x0d82('0x1b')]=qs[_0x0d82('0x1b')](_0x15bc2b[_0x0d82('0x2f')][_0x0d82('0x1b')]);_0xf08815[_0x0d82('0x1a')]=qs[_0x0d82('0x1a')](_0x15bc2b[_0x0d82('0x2f')][_0x0d82('0x1a')]);}_0xf08815[_0x0d82('0x35')]=qs[_0x0d82('0x36')](_0x15bc2b[_0x0d82('0x2f')][_0x0d82('0x36')]);_0xf08815[_0x0d82('0x37')]=qs[_0x0d82('0x30')](_[_0x0d82('0x38')](_0x15bc2b[_0x0d82('0x2f')],_0x548f33[_0x0d82('0x30')]),_0x293276);if(_0x15bc2b[_0x0d82('0x2f')]['filter']){_0xf08815[_0x0d82('0x37')]=_['merge'](_0xf08815[_0x0d82('0x37')],{'$or':_[_0x0d82('0x28')](_0x293276,function(_0x237ed8){if(_0x237ed8['type']!=='VIRTUAL'){var _0x1d9e7f={};_0x1d9e7f[_0x237ed8[_0x0d82('0x26')]]={'$like':'%'+_0x15bc2b[_0x0d82('0x2f')][_0x0d82('0x39')]+'%'};return _0x1d9e7f;}})});}_0xf08815=_['merge']({},_0xf08815,_0x15bc2b[_0x0d82('0x3a')]);var _0x532c72={'where':_0xf08815[_0x0d82('0x37')]};return db[_0x0d82('0x29')][_0x0d82('0x1d')](_0x532c72)['then'](function(_0x3d1675){_0x465cd6[_0x0d82('0x1d')]=_0x3d1675;if(_0x15bc2b[_0x0d82('0x2f')][_0x0d82('0x3b')]){_0xf08815[_0x0d82('0x3c')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x0d82('0x3d')](_0xf08815);})[_0x0d82('0x22')](function(_0x2d2cd9){_0x465cd6[_0x0d82('0x3e')]=_0x2d2cd9;return _0x465cd6;})['then'](respondWithFilteredResult(_0x43f679,_0xf08815))['catch'](handleError(_0x43f679,null));};exports[_0x0d82('0x3f')]=function(_0x11a462,_0x5d4b63){var _0x45e109={'raw':![],'where':{'id':_0x11a462['params']['id']}},_0xc77e1e={};_0xc77e1e[_0x0d82('0x2d')]=_[_0x0d82('0x2e')](db['FreshdeskAccount'][_0x0d82('0x2a')]);_0xc77e1e[_0x0d82('0x2f')]=_[_0x0d82('0x2e')](_0x11a462[_0x0d82('0x2f')]);_0xc77e1e['filters']=_['intersection'](_0xc77e1e['model'],_0xc77e1e[_0x0d82('0x2f')]);_0x45e109[_0x0d82('0x31')]=_['intersection'](_0xc77e1e['model'],qs[_0x0d82('0x32')](_0x11a462['query'][_0x0d82('0x32')]));_0x45e109['attributes']=_0x45e109[_0x0d82('0x31')][_0x0d82('0x40')]?_0x45e109[_0x0d82('0x31')]:_0xc77e1e['model'];if(_0x11a462[_0x0d82('0x2f')][_0x0d82('0x3b')]){_0x45e109[_0x0d82('0x3c')]=[{'all':!![]}];}_0x45e109=_[_0x0d82('0x41')]({},_0x45e109,_0x11a462['options']);return db[_0x0d82('0x29')][_0x0d82('0x42')](_0x45e109)[_0x0d82('0x22')](handleEntityNotFound(_0x5d4b63,null))[_0x0d82('0x22')](respondWithResult(_0x5d4b63,null))[_0x0d82('0x43')](handleError(_0x5d4b63,null));};exports['create']=function(_0x3978f5,_0x217fc6){return db[_0x0d82('0x29')]['create'](_0x3978f5[_0x0d82('0x44')],{})[_0x0d82('0x22')](respondWithResult(_0x217fc6,0xc9))[_0x0d82('0x43')](handleError(_0x217fc6,null));};exports[_0x0d82('0x21')]=function(_0x55461e,_0x20180a){if(_0x55461e['body']['id']){delete _0x55461e[_0x0d82('0x44')]['id'];}return db['FreshdeskAccount'][_0x0d82('0x42')]({'where':{'id':_0x55461e[_0x0d82('0x45')]['id']}})['then'](handleEntityNotFound(_0x20180a,null))['then'](saveUpdates(_0x55461e['body'],null))[_0x0d82('0x22')](respondWithResult(_0x20180a,null))['catch'](handleError(_0x20180a,null));};exports[_0x0d82('0x23')]=function(_0x2370d8,_0x22d539){return db['FreshdeskAccount'][_0x0d82('0x42')]({'where':{'id':_0x2370d8['params']['id']}})[_0x0d82('0x22')](handleEntityNotFound(_0x22d539,null))[_0x0d82('0x22')](removeEntity(_0x22d539,null))[_0x0d82('0x43')](handleError(_0x22d539,null));};exports[_0x0d82('0x46')]=function(_0xc4d1bc,_0xb82bd8,_0x5e342d){var _0x4dc82d={};var _0x4cfec5={};var _0x66387f;var _0x2e32d0;return db[_0x0d82('0x29')][_0x0d82('0x47')]({'where':{'id':_0xc4d1bc[_0x0d82('0x45')]['id']}})[_0x0d82('0x22')](handleEntityNotFound(_0xb82bd8,null))[_0x0d82('0x22')](function(_0x7cbaf6){if(_0x7cbaf6){_0x66387f=_0x7cbaf6;_0x4cfec5[_0x0d82('0x2d')]=_[_0x0d82('0x2e')](db[_0x0d82('0x48')][_0x0d82('0x2a')]);_0x4cfec5[_0x0d82('0x2f')]=_[_0x0d82('0x2e')](_0xc4d1bc[_0x0d82('0x2f')]);_0x4cfec5[_0x0d82('0x30')]=_['intersection'](_0x4cfec5[_0x0d82('0x2d')],_0x4cfec5[_0x0d82('0x2f')]);_0x4dc82d[_0x0d82('0x31')]=_[_0x0d82('0x49')](_0x4cfec5[_0x0d82('0x2d')],qs[_0x0d82('0x32')](_0xc4d1bc['query'][_0x0d82('0x32')]));_0x4dc82d[_0x0d82('0x31')]=_0x4dc82d[_0x0d82('0x31')][_0x0d82('0x40')]?_0x4dc82d[_0x0d82('0x31')]:_0x4cfec5['model'];_0x4dc82d[_0x0d82('0x35')]=qs[_0x0d82('0x36')](_0xc4d1bc['query']['sort']);_0x4dc82d[_0x0d82('0x37')]=qs[_0x0d82('0x30')](_[_0x0d82('0x38')](_0xc4d1bc[_0x0d82('0x2f')],_0x4cfec5[_0x0d82('0x30')]));if(_0xc4d1bc[_0x0d82('0x2f')][_0x0d82('0x39')]){_0x4dc82d[_0x0d82('0x37')]=_['merge'](_0x4dc82d[_0x0d82('0x37')],{'$or':_['map'](_0x4dc82d[_0x0d82('0x31')],function(_0x10488b){var _0x1ce056={};_0x1ce056[_0x10488b]={'$like':'%'+_0xc4d1bc[_0x0d82('0x2f')][_0x0d82('0x39')]+'%'};return _0x1ce056;})});}_0x4dc82d=_['merge']({},_0x4dc82d,_0xc4d1bc[_0x0d82('0x3a')]);return _0x66387f['getConfigurations'](_0x4dc82d);}})[_0x0d82('0x22')](function(_0x32ec72){if(_0x32ec72){_0x2e32d0=_0x32ec72[_0x0d82('0x40')];if(!_0xc4d1bc[_0x0d82('0x2f')][_0x0d82('0x33')](_0x0d82('0x34'))){_0x4dc82d['limit']=qs[_0x0d82('0x1b')](_0xc4d1bc[_0x0d82('0x2f')][_0x0d82('0x1b')]);_0x4dc82d[_0x0d82('0x1a')]=qs[_0x0d82('0x1a')](_0xc4d1bc[_0x0d82('0x2f')]['offset']);}return _0x66387f[_0x0d82('0x46')](_0x4dc82d);}})[_0x0d82('0x22')](function(_0x5557c2){if(_0x5557c2){return _0x5557c2?{'count':_0x2e32d0,'rows':_0x5557c2}:null;}})[_0x0d82('0x22')](respondWithResult(_0xb82bd8,null))[_0x0d82('0x43')](handleError(_0xb82bd8,null));};exports[_0x0d82('0x4a')]=function(_0x343a65,_0x402c87,_0x47d49f){if(_0x343a65[_0x0d82('0x44')]['id']){delete _0x343a65[_0x0d82('0x44')]['id'];}return db['FreshdeskAccount'][_0x0d82('0x47')]({'where':{'id':_0x343a65['params']['id']}})[_0x0d82('0x22')](handleEntityNotFound(_0x402c87,null))[_0x0d82('0x22')](function(_0x2cbbb8){if(_0x2cbbb8){_0x343a65[_0x0d82('0x44')][_0x0d82('0x4b')]=_0x2cbbb8['id'];_0x343a65[_0x0d82('0x44')]['Subjects']=integrations[_0x0d82('0x4c')](_0x343a65['body'][_0x0d82('0x4d')],_0x343a65[_0x0d82('0x44')]['type']);_0x343a65[_0x0d82('0x44')][_0x0d82('0x4e')]=integrations[_0x0d82('0x4f')](_0x343a65[_0x0d82('0x44')][_0x0d82('0x4d')],_0x343a65[_0x0d82('0x44')][_0x0d82('0x50')]);return db[_0x0d82('0x48')][_0x0d82('0x51')](_0x343a65['body'],{'include':[{'model':db['FreshdeskField'],'as':_0x0d82('0x52')},{'model':db[_0x0d82('0x53')],'as':'Descriptions'}]});}return null;})[_0x0d82('0x22')](respondWithResult(_0x402c87,null))[_0x0d82('0x43')](handleError(_0x402c87,null));};exports[_0x0d82('0x54')]=function(_0x413ee2,_0x49c893,_0x4c1072){var _0x425a88='';return db[_0x0d82('0x29')][_0x0d82('0x47')]({'where':{'id':_0x413ee2['params']['id']},'attributes':['id','remoteUri',_0x0d82('0x55')]})[_0x0d82('0x22')](handleEntityNotFound(_0x49c893,null))[_0x0d82('0x22')](function(_0x48ab7b){if(_0x48ab7b){_0x425a88=_0x48ab7b[_0x0d82('0x56')];var _0x413f1c=_0x425a88['slice'](-0x1);if(_0x413f1c==='/'){_0x425a88=_0x425a88['substring'](0x0,_0x425a88['lastIndexOf'](_0x413f1c));}return rp({'method':_0x0d82('0x57'),'uri':util['format'](_0x0d82('0x58'),_0x425a88,_0x0d82('0x59')),'headers':{'Authorization':util[_0x0d82('0x5a')](_0x0d82('0x5b'),new Buffer(util[_0x0d82('0x5a')](_0x0d82('0x5c'),_0x48ab7b[_0x0d82('0x55')]))['toString'](_0x0d82('0x5d')))},'json':!![]});}})[_0x0d82('0x22')](function(_0x4b49a9){if(_0x4b49a9){var _0x58b214=[_0x0d82('0x5e'),_0x0d82('0x5f'),'agent','description',_0x0d82('0x17'),_0x0d82('0x60'),_0x0d82('0x61'),_0x0d82('0x62'),_0x0d82('0x63'),'group','company'];_[_0x0d82('0x64')](_0x4b49a9,function(_0x3b5bf1){return _0x58b214[_0x0d82('0x65')](_0x3b5bf1[_0x0d82('0x26')])||!_0x3b5bf1[_0x0d82('0x66')]&&_0x3b5bf1[_0x0d82('0x50')]!=='custom_text'&&_0x3b5bf1[_0x0d82('0x50')]!==_0x0d82('0x67');});return{'count':_0x4b49a9[_0x0d82('0x40')],'rows':_[_0x0d82('0x28')](_0x4b49a9,function(_0x1999d6){return{'id':_0x1999d6[_0x0d82('0x26')],'name':_0x1999d6[_0x0d82('0x68')],'custom':!_0x1999d6[_0x0d82('0x66')],'options':_0x1999d6['choices']?_[_0x0d82('0x28')](_0x1999d6[_0x0d82('0x69')],function(_0x30eec7){return{'name':_['capitalize'](_0x30eec7),'value':_0x30eec7};}):[]};})};}})[_0x0d82('0x22')](respondWithResult(_0x49c893,null))[_0x0d82('0x43')](function(_0x5dc83c){var _0x2865e6=_0x413ee2['query'][_0x0d82('0x6a')]?0x1f4:_0x5dc83c[_0x0d82('0x6b')]||0x1f4;logger['error'](_0x0d82('0x6c'),'getFields',_0x2865e6,JSON[_0x0d82('0x6d')](_0x5dc83c));delete _0x5dc83c[_0x0d82('0x26')];if(_0x2865e6===0x191){_0x2865e6=0x190;}_0x49c893[_0x0d82('0x17')](_0x2865e6)['send'](_0x413ee2['query'][_0x0d82('0x6a')]?{'message':_0x0d82('0x6e'),'statusCode':_0x5dc83c[_0x0d82('0x6b')]}:_0x5dc83c);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index d6fe73f..1f9ebe9 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 _0x1d6a=['define','FreshdeskAccount','int_freshdesk_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x2dfba0,_0x24454a){var _0x5097a0=function(_0xae04d){while(--_0xae04d){_0x2dfba0['push'](_0x2dfba0['shift']());}};_0x5097a0(++_0x24454a);}(_0x1d6a,0x153));var _0xa1d6=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x1d6a[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0xa1d6('0x0'));var util=require('util');var logger=require(_0xa1d6('0x1'))(_0xa1d6('0x2'));var moment=require(_0xa1d6('0x3'));var BPromise=require(_0xa1d6('0x4'));var rp=require(_0xa1d6('0x5'));var fs=require('fs');var path=require(_0xa1d6('0x6'));var rimraf=require(_0xa1d6('0x7'));var config=require('../../config/environment');var attributes=require(_0xa1d6('0x8'));var integrations=require(_0xa1d6('0x9'));module[_0xa1d6('0xa')]=function(_0x474fd5,_0x5cf621){return _0x474fd5[_0xa1d6('0xb')](_0xa1d6('0xc'),attributes,{'tableName':_0xa1d6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa568=['define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x8f2718,_0x5ef438){var _0x48c7e9=function(_0x4ea748){while(--_0x4ea748){_0x8f2718['push'](_0x8f2718['shift']());}};_0x48c7e9(++_0x5ef438);}(_0xa568,0xb9));var _0x8a56=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa568[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x8a56('0x0'));var util=require(_0x8a56('0x1'));var logger=require(_0x8a56('0x2'))('api');var moment=require(_0x8a56('0x3'));var BPromise=require('bluebird');var rp=require(_0x8a56('0x4'));var fs=require('fs');var path=require(_0x8a56('0x5'));var rimraf=require('rimraf');var config=require(_0x8a56('0x6'));var attributes=require(_0x8a56('0x7'));var integrations=require(_0x8a56('0x8'));module[_0x8a56('0x9')]=function(_0xf1ac01,_0x2e2c20){return _0xf1ac01[_0x8a56('0xa')](_0x8a56('0xb'),attributes,{'tableName':_0x8a56('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 1d3babd..5289d4a 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 _0xa861=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','GetFreshdeskAccount','options','raw','where','attributes','limit','include','map','model','ShowFreshdeskAccount','FreshdeskAccount','find','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1fea3c,_0x48ba9a){var _0x30ff9c=function(_0x51740e){while(--_0x51740e){_0x1fea3c['push'](_0x1fea3c['shift']());}};_0x30ff9c(++_0x48ba9a);}(_0xa861,0x192));var _0x1a86=function(_0x3e21f4,_0x43d310){_0x3e21f4=_0x3e21f4-0x0;var _0x40fc49=_0xa861[_0x3e21f4];return _0x40fc49;};'use strict';var _=require(_0x1a86('0x0'));var util=require(_0x1a86('0x1'));var moment=require('moment');var BPromise=require(_0x1a86('0x2'));var rs=require(_0x1a86('0x3'));var fs=require('fs');var Redis=require(_0x1a86('0x4'));var db=require(_0x1a86('0x5'))['db'];var utils=require(_0x1a86('0x6'));var logger=require(_0x1a86('0x7'))(_0x1a86('0x8'));var config=require('../../config/environment');var jayson=require(_0x1a86('0x9'));var client=jayson[_0x1a86('0xa')][_0x1a86('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50525b,_0x3312cd,_0x1cf90b){return new BPromise(function(_0x2ff473,_0x1cc7fb){return client['request'](_0x50525b,_0x1cf90b)[_0x1a86('0xc')](function(_0x3af3c5){logger[_0x1a86('0xd')](_0x1a86('0xe'),_0x3312cd,_0x1a86('0xf'));logger[_0x1a86('0x10')](_0x1a86('0x11'),_0x3312cd,_0x1a86('0xf'),JSON[_0x1a86('0x12')](_0x3af3c5));if(_0x3af3c5[_0x1a86('0x13')]){if(_0x3af3c5[_0x1a86('0x13')]['code']===0x1f4){logger[_0x1a86('0x13')](_0x1a86('0xe'),_0x3312cd,_0x3af3c5[_0x1a86('0x13')][_0x1a86('0x14')]);return _0x1cc7fb(_0x3af3c5[_0x1a86('0x13')]['message']);}logger[_0x1a86('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x3312cd,_0x3af3c5[_0x1a86('0x13')][_0x1a86('0x14')]);return _0x2ff473(_0x3af3c5['error'][_0x1a86('0x14')]);}else{logger['info'](_0x1a86('0xe'),_0x3312cd,_0x1a86('0xf'));_0x2ff473(_0x3af3c5['result'][_0x1a86('0x14')]);}})['catch'](function(_0x5eca8a){logger[_0x1a86('0x13')](_0x1a86('0xe'),_0x3312cd,_0x5eca8a);_0x1cc7fb(_0x5eca8a);});});}exports[_0x1a86('0x15')]=function(_0x3e768){var _0x588ccf=this;return new Promise(function(_0x157da5,_0x50d07b){return db['FreshdeskAccount']['findAll']({'raw':_0x3e768[_0x1a86('0x16')]?_0x3e768[_0x1a86('0x16')][_0x1a86('0x17')]===undefined?!![]:![]:!![],'where':_0x3e768[_0x1a86('0x16')]?_0x3e768[_0x1a86('0x16')][_0x1a86('0x18')]||null:null,'attributes':_0x3e768[_0x1a86('0x16')]?_0x3e768[_0x1a86('0x16')][_0x1a86('0x19')]||null:null,'limit':_0x3e768[_0x1a86('0x16')]?_0x3e768['options'][_0x1a86('0x1a')]||null:null,'include':_0x3e768[_0x1a86('0x16')]?_0x3e768[_0x1a86('0x16')][_0x1a86('0x1b')]?_[_0x1a86('0x1c')](_0x3e768[_0x1a86('0x16')][_0x1a86('0x1b')],function(_0x202820){return{'model':db[_0x202820[_0x1a86('0x1d')]],'as':_0x202820['as'],'attributes':_0x202820[_0x1a86('0x19')],'include':_0x202820['include']?_['map'](_0x202820['include'],function(_0x39b64d){return{'model':db[_0x39b64d[_0x1a86('0x1d')]],'as':_0x39b64d['as'],'attributes':_0x39b64d['attributes'],'include':_0x39b64d[_0x1a86('0x1b')]?_['map'](_0x39b64d[_0x1a86('0x1b')],function(_0xaf192e){return{'model':db[_0xaf192e['model']],'as':_0xaf192e['as'],'attributes':_0xaf192e[_0x1a86('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3256d2){logger[_0x1a86('0xd')](_0x1a86('0x15'),_0x3e768);logger[_0x1a86('0x10')](_0x1a86('0x15'),_0x3e768,JSON[_0x1a86('0x12')](_0x3256d2));_0x157da5(_0x3256d2);})['catch'](function(_0x39a76c){logger[_0x1a86('0x13')](_0x1a86('0x15'),_0x39a76c[_0x1a86('0x14')],_0x3e768);_0x50d07b(_0x588ccf[_0x1a86('0x13')](0x1f4,_0x39a76c[_0x1a86('0x14')]));});});};exports[_0x1a86('0x1e')]=function(_0xeee9d8){var _0x229802=this;return new Promise(function(_0x4c347d,_0x36f180){return db[_0x1a86('0x1f')][_0x1a86('0x20')]({'raw':_0xeee9d8['options']?_0xeee9d8['options'][_0x1a86('0x17')]===undefined?!![]:![]:!![],'where':_0xeee9d8['options']?_0xeee9d8[_0x1a86('0x16')][_0x1a86('0x18')]||null:null,'attributes':_0xeee9d8[_0x1a86('0x16')]?_0xeee9d8[_0x1a86('0x16')]['attributes']||null:null,'include':_0xeee9d8[_0x1a86('0x16')]?_0xeee9d8[_0x1a86('0x16')]['include']?_['map'](_0xeee9d8[_0x1a86('0x16')][_0x1a86('0x1b')],function(_0x3adcd9){return{'model':db[_0x3adcd9[_0x1a86('0x1d')]],'as':_0x3adcd9['as'],'attributes':_0x3adcd9[_0x1a86('0x19')],'include':_0x3adcd9[_0x1a86('0x1b')]?_[_0x1a86('0x1c')](_0x3adcd9[_0x1a86('0x1b')],function(_0x51dcc2){return{'model':db[_0x51dcc2[_0x1a86('0x1d')]],'as':_0x51dcc2['as'],'attributes':_0x51dcc2[_0x1a86('0x19')],'include':_0x51dcc2[_0x1a86('0x1b')]?_['map'](_0x51dcc2['include'],function(_0x340705){return{'model':db[_0x340705[_0x1a86('0x1d')]],'as':_0x340705['as'],'attributes':_0x340705['attributes']};}):[]};}):[]};}):[]:[]})[_0x1a86('0xc')](function(_0x4d4732){logger[_0x1a86('0xd')](_0x1a86('0x1e'),_0xeee9d8);logger[_0x1a86('0x10')](_0x1a86('0x1e'),_0xeee9d8,JSON[_0x1a86('0x12')](_0x4d4732));_0x4c347d(_0x4d4732);})[_0x1a86('0x21')](function(_0x1bee96){logger[_0x1a86('0x13')](_0x1a86('0x1e'),_0x1bee96[_0x1a86('0x14')],_0xeee9d8);_0x36f180(_0x229802[_0x1a86('0x13')](0x1f4,_0x1bee96[_0x1a86('0x14')]));});});}; \ No newline at end of file +var _0xadb8=['limit','include','map','attributes','model','then','debug','ShowFreshdeskAccount','find','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where'];(function(_0x15b380,_0x1a3c5f){var _0x232c5c=function(_0x12f8e0){while(--_0x12f8e0){_0x15b380['push'](_0x15b380['shift']());}};_0x232c5c(++_0x1a3c5f);}(_0xadb8,0x1d0));var _0x8adb=function(_0x441db3,_0x10f359){_0x441db3=_0x441db3-0x0;var _0x16c05d=_0xadb8[_0x441db3];return _0x16c05d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8adb('0x0'));var BPromise=require('bluebird');var rs=require(_0x8adb('0x1'));var fs=require('fs');var Redis=require(_0x8adb('0x2'));var db=require(_0x8adb('0x3'))['db'];var utils=require(_0x8adb('0x4'));var logger=require(_0x8adb('0x5'))(_0x8adb('0x6'));var config=require(_0x8adb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8adb('0x8')][_0x8adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9f435,_0x2bebfe,_0x271bed){return new BPromise(function(_0x16b932,_0x27d994){return client['request'](_0x9f435,_0x271bed)['then'](function(_0x58ad1a){logger[_0x8adb('0xa')]('FreshdeskAccount,\x20%s,\x20%s',_0x2bebfe,'request\x20sent');logger['debug'](_0x8adb('0xb'),_0x2bebfe,_0x8adb('0xc'),JSON[_0x8adb('0xd')](_0x58ad1a));if(_0x58ad1a[_0x8adb('0xe')]){if(_0x58ad1a[_0x8adb('0xe')][_0x8adb('0xf')]===0x1f4){logger[_0x8adb('0xe')](_0x8adb('0x10'),_0x2bebfe,_0x58ad1a[_0x8adb('0xe')][_0x8adb('0x11')]);return _0x27d994(_0x58ad1a['error']['message']);}logger['error'](_0x8adb('0x10'),_0x2bebfe,_0x58ad1a['error'][_0x8adb('0x11')]);return _0x16b932(_0x58ad1a[_0x8adb('0xe')][_0x8adb('0x11')]);}else{logger['info'](_0x8adb('0x10'),_0x2bebfe,_0x8adb('0xc'));_0x16b932(_0x58ad1a[_0x8adb('0x12')][_0x8adb('0x11')]);}})[_0x8adb('0x13')](function(_0x13659c){logger['error'](_0x8adb('0x10'),_0x2bebfe,_0x13659c);_0x27d994(_0x13659c);});});}exports[_0x8adb('0x14')]=function(_0x4ba298){var _0x5a0e22=this;return new Promise(function(_0x18897e,_0x30ef5a){return db[_0x8adb('0x15')][_0x8adb('0x16')]({'raw':_0x4ba298[_0x8adb('0x17')]?_0x4ba298[_0x8adb('0x17')][_0x8adb('0x18')]===undefined?!![]:![]:!![],'where':_0x4ba298[_0x8adb('0x17')]?_0x4ba298[_0x8adb('0x17')][_0x8adb('0x19')]||null:null,'attributes':_0x4ba298[_0x8adb('0x17')]?_0x4ba298[_0x8adb('0x17')]['attributes']||null:null,'limit':_0x4ba298['options']?_0x4ba298[_0x8adb('0x17')][_0x8adb('0x1a')]||null:null,'include':_0x4ba298['options']?_0x4ba298[_0x8adb('0x17')][_0x8adb('0x1b')]?_[_0x8adb('0x1c')](_0x4ba298[_0x8adb('0x17')][_0x8adb('0x1b')],function(_0x28d5cd){return{'model':db[_0x28d5cd['model']],'as':_0x28d5cd['as'],'attributes':_0x28d5cd[_0x8adb('0x1d')],'include':_0x28d5cd[_0x8adb('0x1b')]?_[_0x8adb('0x1c')](_0x28d5cd['include'],function(_0x5c8c18){return{'model':db[_0x5c8c18[_0x8adb('0x1e')]],'as':_0x5c8c18['as'],'attributes':_0x5c8c18[_0x8adb('0x1d')],'include':_0x5c8c18[_0x8adb('0x1b')]?_[_0x8adb('0x1c')](_0x5c8c18[_0x8adb('0x1b')],function(_0x486cdb){return{'model':db[_0x486cdb[_0x8adb('0x1e')]],'as':_0x486cdb['as'],'attributes':_0x486cdb[_0x8adb('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8adb('0x1f')](function(_0x44f242){logger[_0x8adb('0xa')](_0x8adb('0x14'),_0x4ba298);logger[_0x8adb('0x20')]('GetFreshdeskAccount',_0x4ba298,JSON[_0x8adb('0xd')](_0x44f242));_0x18897e(_0x44f242);})[_0x8adb('0x13')](function(_0x3e0ccf){logger[_0x8adb('0xe')]('GetFreshdeskAccount',_0x3e0ccf[_0x8adb('0x11')],_0x4ba298);_0x30ef5a(_0x5a0e22['error'](0x1f4,_0x3e0ccf[_0x8adb('0x11')]));});});};exports[_0x8adb('0x21')]=function(_0x12f552){var _0x13a887=this;return new Promise(function(_0x56f8a4,_0x279cd8){return db['FreshdeskAccount'][_0x8adb('0x22')]({'raw':_0x12f552['options']?_0x12f552[_0x8adb('0x17')][_0x8adb('0x18')]===undefined?!![]:![]:!![],'where':_0x12f552[_0x8adb('0x17')]?_0x12f552[_0x8adb('0x17')][_0x8adb('0x19')]||null:null,'attributes':_0x12f552[_0x8adb('0x17')]?_0x12f552['options']['attributes']||null:null,'include':_0x12f552[_0x8adb('0x17')]?_0x12f552[_0x8adb('0x17')][_0x8adb('0x1b')]?_[_0x8adb('0x1c')](_0x12f552[_0x8adb('0x17')][_0x8adb('0x1b')],function(_0x28f2a3){return{'model':db[_0x28f2a3[_0x8adb('0x1e')]],'as':_0x28f2a3['as'],'attributes':_0x28f2a3[_0x8adb('0x1d')],'include':_0x28f2a3[_0x8adb('0x1b')]?_[_0x8adb('0x1c')](_0x28f2a3[_0x8adb('0x1b')],function(_0xc2bd61){return{'model':db[_0xc2bd61['model']],'as':_0xc2bd61['as'],'attributes':_0xc2bd61[_0x8adb('0x1d')],'include':_0xc2bd61[_0x8adb('0x1b')]?_['map'](_0xc2bd61[_0x8adb('0x1b')],function(_0x51bc44){return{'model':db[_0x51bc44[_0x8adb('0x1e')]],'as':_0x51bc44['as'],'attributes':_0x51bc44[_0x8adb('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8adb('0x1f')](function(_0x108a80){logger[_0x8adb('0xa')]('ShowFreshdeskAccount',_0x12f552);logger[_0x8adb('0x20')]('ShowFreshdeskAccount',_0x12f552,JSON[_0x8adb('0xd')](_0x108a80));_0x56f8a4(_0x108a80);})[_0x8adb('0x13')](function(_0x4a1693){logger[_0x8adb('0xe')]('ShowFreshdeskAccount',_0x4a1693[_0x8adb('0x11')],_0x12f552);_0x279cd8(_0x13a887['error'](0x1f4,_0x4a1693[_0x8adb('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 755cc6d..b319d8f 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 _0x2725=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','put','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x13c09c,_0x58f67c){var _0x41d0ab=function(_0x2fd59b){while(--_0x2fd59b){_0x13c09c['push'](_0x13c09c['shift']());}};_0x41d0ab(++_0x58f67c);}(_0x2725,0x1a3));var _0x5272=function(_0x3d8ca8,_0x1a9764){_0x3d8ca8=_0x3d8ca8-0x0;var _0x517e45=_0x2725[_0x3d8ca8];return _0x517e45;};'use strict';var multer=require('multer');var util=require(_0x5272('0x0'));var path=require('path');var timeout=require(_0x5272('0x1'));var express=require('express');var router=express[_0x5272('0x2')]();var fs_extra=require(_0x5272('0x3'));var auth=require(_0x5272('0x4'));var interaction=require(_0x5272('0x5'));var config=require('../../config/environment');var controller=require(_0x5272('0x6'));router[_0x5272('0x7')]('/',auth[_0x5272('0x8')](),controller[_0x5272('0x9')]);router[_0x5272('0x7')](_0x5272('0xa'),auth[_0x5272('0x8')](),controller[_0x5272('0xb')]);router[_0x5272('0x7')]('/:id/fields',auth[_0x5272('0x8')](),controller[_0x5272('0xc')]);router[_0x5272('0x7')](_0x5272('0xd'),auth[_0x5272('0x8')](),controller[_0x5272('0xe')]);router[_0x5272('0x7')](_0x5272('0xf'),auth[_0x5272('0x8')](),controller[_0x5272('0x10')]);router[_0x5272('0x7')](_0x5272('0x11'),auth[_0x5272('0x8')](),controller[_0x5272('0x12')]);router[_0x5272('0x13')]('/',auth[_0x5272('0x8')](),controller['create']);router['post'](_0x5272('0x11'),auth['isAuthenticated'](),controller['setTags']);router[_0x5272('0x14')](_0x5272('0xa'),auth[_0x5272('0x8')](),controller['update']);router[_0x5272('0x15')](_0x5272('0xa'),auth[_0x5272('0x8')](),controller[_0x5272('0x16')]);module[_0x5272('0x17')]=router; \ No newline at end of file +var _0x0cd9=['/:id/tags','setTags','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/subjects','getSubjects','getDescriptions','getTags','post','create'];(function(_0xcd23ab,_0x2647d9){var _0xc26359=function(_0x5e3005){while(--_0x5e3005){_0xcd23ab['push'](_0xcd23ab['shift']());}};_0xc26359(++_0x2647d9);}(_0x0cd9,0x158));var _0x90cd=function(_0x5e475d,_0x57b7dc){_0x5e475d=_0x5e475d-0x0;var _0x22f64a=_0x0cd9[_0x5e475d];return _0x22f64a;};'use strict';var multer=require(_0x90cd('0x0'));var util=require(_0x90cd('0x1'));var path=require('path');var timeout=require(_0x90cd('0x2'));var express=require(_0x90cd('0x3'));var router=express[_0x90cd('0x4')]();var fs_extra=require(_0x90cd('0x5'));var auth=require(_0x90cd('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x90cd('0x7'));var controller=require(_0x90cd('0x8'));router['get']('/',auth[_0x90cd('0x9')](),controller[_0x90cd('0xa')]);router[_0x90cd('0xb')](_0x90cd('0xc'),auth[_0x90cd('0x9')](),controller[_0x90cd('0xd')]);router[_0x90cd('0xb')]('/:id/fields',auth[_0x90cd('0x9')](),controller['getFields']);router[_0x90cd('0xb')](_0x90cd('0xe'),auth[_0x90cd('0x9')](),controller[_0x90cd('0xf')]);router['get']('/:id/descriptions',auth[_0x90cd('0x9')](),controller[_0x90cd('0x10')]);router['get']('/:id/tags',auth[_0x90cd('0x9')](),controller[_0x90cd('0x11')]);router[_0x90cd('0x12')]('/',auth[_0x90cd('0x9')](),controller[_0x90cd('0x13')]);router['post'](_0x90cd('0x14'),auth['isAuthenticated'](),controller[_0x90cd('0x15')]);router[_0x90cd('0x16')]('/:id',auth[_0x90cd('0x9')](),controller['update']);router[_0x90cd('0x17')](_0x90cd('0xc'),auth['isAuthenticated'](),controller[_0x90cd('0x18')]);module[_0x90cd('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index afa154e..517bb94 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 _0x6d05=['STRING','sequelize','exports'];(function(_0x56825b,_0x172b8d){var _0x69ce77=function(_0x348a1c){while(--_0x348a1c){_0x56825b['push'](_0x56825b['shift']());}};_0x69ce77(++_0x172b8d);}(_0x6d05,0x121));var _0x56d0=function(_0x521e30,_0x5326aa){_0x521e30=_0x521e30-0x0;var _0x3b9ce1=_0x6d05[_0x521e30];return _0x3b9ce1;};'use strict';var Sequelize=require(_0x56d0('0x0'));module[_0x56d0('0x1')]={'name':{'type':Sequelize[_0x56d0('0x2')]},'description':{'type':Sequelize[_0x56d0('0x2')]}}; \ No newline at end of file +var _0xf99f=['sequelize','exports'];(function(_0x2c024b,_0x474a32){var _0x19882b=function(_0x3f91e4){while(--_0x3f91e4){_0x2c024b['push'](_0x2c024b['shift']());}};_0x19882b(++_0x474a32);}(_0xf99f,0x102));var _0xff99=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf99f[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xff99('0x0'));module[_0xff99('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index f214406..4b9817b 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 _0x3017=['length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','rows','catch','show','params','include','create','body','find','findOne','FreshdeskField','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','then','error','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields'];(function(_0x58944f,_0x12fa00){var _0x54de9c=function(_0xa011a1){while(--_0xa011a1){_0x58944f['push'](_0x58944f['shift']());}};_0x54de9c(++_0x12fa00);}(_0x3017,0x6f));var _0x7301=function(_0x3a40c7,_0x3b5303){_0x3a40c7=_0x3a40c7-0x0;var _0x527d6d=_0x3017[_0x3a40c7];return _0x527d6d;};'use strict';var emlformat=require(_0x7301('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7301('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7301('0x2'));var util=require(_0x7301('0x3'));var path=require(_0x7301('0x4'));var sox=require(_0x7301('0x5'));var csv=require(_0x7301('0x6'));var ejs=require(_0x7301('0x7'));var fs=require('fs');var fs_extra=require(_0x7301('0x8'));var _=require(_0x7301('0x9'));var squel=require(_0x7301('0xa'));var crypto=require(_0x7301('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7301('0xc'));var Papa=require(_0x7301('0xd'));var Redis=require('ioredis');var authService=require(_0x7301('0xe'));var qs=require(_0x7301('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7301('0x10'));var logger=require(_0x7301('0x11'))(_0x7301('0x12'));var utils=require('../../config/utils');var config=require(_0x7301('0x13'));var licenseUtil=require(_0x7301('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2551fd,_0x363c56){_0x363c56=_0x363c56||0xcc;return function(_0x4e3fa1){if(_0x4e3fa1){return _0x2551fd[_0x7301('0x15')](_0x363c56);}return _0x2551fd['status'](_0x363c56)[_0x7301('0x16')]();};}function respondWithResult(_0x6c40cd,_0x121803){_0x121803=_0x121803||0xc8;return function(_0x111e97){if(_0x111e97){return _0x6c40cd[_0x7301('0x17')](_0x121803)[_0x7301('0x18')](_0x111e97);}};}function respondWithFilteredResult(_0x2fafcb,_0x22f040){return function(_0x4c8f47){if(_0x4c8f47){var _0x2806c4=typeof _0x22f040[_0x7301('0x19')]==='undefined'&&typeof _0x22f040['limit']===_0x7301('0x1a');var _0x537cad=_0x4c8f47[_0x7301('0x1b')];var _0x15ac31=_0x2806c4?0x0:_0x22f040[_0x7301('0x19')];var _0x19ff6b=_0x2806c4?_0x4c8f47[_0x7301('0x1b')]:_0x22f040[_0x7301('0x19')]+_0x22f040[_0x7301('0x1c')];var _0x28d313;if(_0x19ff6b>=_0x537cad){_0x19ff6b=_0x537cad;_0x28d313=0xc8;}else{_0x28d313=0xce;}_0x2fafcb['status'](_0x28d313);return _0x2fafcb[_0x7301('0x1d')](_0x7301('0x1e'),_0x15ac31+'-'+_0x19ff6b+'/'+_0x537cad)['json'](_0x4c8f47);}return null;};}function patchUpdates(_0x3925b6){return function(_0x30a444){try{jsonpatch['apply'](_0x30a444,_0x3925b6,!![]);}catch(_0x6c6145){return BPromise[_0x7301('0x1f')](_0x6c6145);}return _0x30a444[_0x7301('0x20')]();};}function saveUpdates(_0x4e1cb3,_0x3cd64f){return function(_0x6b1c6e){if(_0x6b1c6e){return _0x6b1c6e[_0x7301('0x21')](_0x4e1cb3)['then'](function(_0x89b3c3){return _0x89b3c3;});}return null;};}function removeEntity(_0x37992c,_0x395b11){return function(_0x17a09e){if(_0x17a09e){return _0x17a09e[_0x7301('0x22')]()[_0x7301('0x23')](function(){_0x37992c[_0x7301('0x17')](0xcc)[_0x7301('0x16')]();});}};}function handleEntityNotFound(_0x3bcc2d,_0x50b625){return function(_0x3081f9){if(!_0x3081f9){_0x3bcc2d[_0x7301('0x15')](0x194);}return _0x3081f9;};}function handleError(_0x3bc36e,_0x3dc2d9){_0x3dc2d9=_0x3dc2d9||0x1f4;return function(_0x537ae9){logger[_0x7301('0x24')](_0x537ae9['stack']);if(_0x537ae9['name']){delete _0x537ae9[_0x7301('0x25')];}_0x3bc36e[_0x7301('0x17')](_0x3dc2d9)[_0x7301('0x26')](_0x537ae9);};}exports['index']=function(_0x272199,_0x4fff5d){var _0x332af1={},_0x4a518f={},_0xa4a42c={'count':0x0,'rows':[]};var _0xbc3c88=_[_0x7301('0x27')](db[_0x7301('0x28')][_0x7301('0x29')],function(_0x2a17ed){return{'name':_0x2a17ed[_0x7301('0x2a')],'type':_0x2a17ed[_0x7301('0x2b')][_0x7301('0x2c')]};});_0x4a518f[_0x7301('0x2d')]=_[_0x7301('0x27')](_0xbc3c88,_0x7301('0x25'));_0x4a518f[_0x7301('0x2e')]=_[_0x7301('0x2f')](_0x272199['query']);_0x4a518f['filters']=_['intersection'](_0x4a518f['model'],_0x4a518f[_0x7301('0x2e')]);_0x332af1[_0x7301('0x30')]=_[_0x7301('0x31')](_0x4a518f['model'],qs[_0x7301('0x32')](_0x272199[_0x7301('0x2e')][_0x7301('0x32')]));_0x332af1[_0x7301('0x30')]=_0x332af1['attributes'][_0x7301('0x33')]?_0x332af1[_0x7301('0x30')]:_0x4a518f['model'];if(!_0x272199[_0x7301('0x2e')][_0x7301('0x34')](_0x7301('0x35'))){_0x332af1['limit']=qs[_0x7301('0x1c')](_0x272199[_0x7301('0x2e')]['limit']);_0x332af1[_0x7301('0x19')]=qs[_0x7301('0x19')](_0x272199[_0x7301('0x2e')]['offset']);}_0x332af1[_0x7301('0x36')]=qs['sort'](_0x272199['query'][_0x7301('0x37')]);_0x332af1['where']=qs[_0x7301('0x38')](_[_0x7301('0x39')](_0x272199[_0x7301('0x2e')],_0x4a518f['filters']),_0xbc3c88);if(_0x272199[_0x7301('0x2e')][_0x7301('0x3a')]){_0x332af1['where']=_[_0x7301('0x3b')](_0x332af1[_0x7301('0x3c')],{'$or':_['map'](_0xbc3c88,function(_0x3d3424){if(_0x3d3424[_0x7301('0x2b')]!==_0x7301('0x3d')){var _0x2bbaa8={};_0x2bbaa8[_0x3d3424[_0x7301('0x25')]]={'$like':'%'+_0x272199[_0x7301('0x2e')][_0x7301('0x3a')]+'%'};return _0x2bbaa8;}})});}_0x332af1=_['merge']({},_0x332af1,_0x272199[_0x7301('0x3e')]);var _0x4798ea={'where':_0x332af1['where']};return db[_0x7301('0x28')][_0x7301('0x1b')](_0x4798ea)[_0x7301('0x23')](function(_0x41a135){_0xa4a42c[_0x7301('0x1b')]=_0x41a135;if(_0x272199[_0x7301('0x2e')][_0x7301('0x3f')]){_0x332af1['include']=[{'all':!![]}];}return db[_0x7301('0x28')]['findAll'](_0x332af1);})['then'](function(_0x1f7225){_0xa4a42c[_0x7301('0x40')]=_0x1f7225;return _0xa4a42c;})[_0x7301('0x23')](respondWithFilteredResult(_0x4fff5d,_0x332af1))[_0x7301('0x41')](handleError(_0x4fff5d,null));};exports[_0x7301('0x42')]=function(_0x157b14,_0x173db1){var _0x236d76={'raw':![],'where':{'id':_0x157b14[_0x7301('0x43')]['id']}},_0xdb1eac={};_0xdb1eac['model']=_[_0x7301('0x2f')](db[_0x7301('0x28')][_0x7301('0x29')]);_0xdb1eac['query']=_[_0x7301('0x2f')](_0x157b14[_0x7301('0x2e')]);_0xdb1eac[_0x7301('0x38')]=_[_0x7301('0x31')](_0xdb1eac[_0x7301('0x2d')],_0xdb1eac[_0x7301('0x2e')]);_0x236d76['attributes']=_['intersection'](_0xdb1eac[_0x7301('0x2d')],qs[_0x7301('0x32')](_0x157b14[_0x7301('0x2e')][_0x7301('0x32')]));_0x236d76[_0x7301('0x30')]=_0x236d76['attributes'][_0x7301('0x33')]?_0x236d76['attributes']:_0xdb1eac[_0x7301('0x2d')];if(_0x157b14['query']['includeAll']){_0x236d76[_0x7301('0x44')]=[{'all':!![]}];}_0x236d76=_[_0x7301('0x3b')]({},_0x236d76,_0x157b14[_0x7301('0x3e')]);return db['FreshdeskConfiguration']['find'](_0x236d76)['then'](handleEntityNotFound(_0x173db1,null))['then'](respondWithResult(_0x173db1,null))[_0x7301('0x41')](handleError(_0x173db1,null));};exports[_0x7301('0x45')]=function(_0x156468,_0x4942e4){return db['FreshdeskConfiguration'][_0x7301('0x45')](_0x156468['body'],{})[_0x7301('0x23')](respondWithResult(_0x4942e4,0xc9))[_0x7301('0x41')](handleError(_0x4942e4,null));};exports[_0x7301('0x21')]=function(_0x276c84,_0x3a088d){if(_0x276c84[_0x7301('0x46')]['id']){delete _0x276c84['body']['id'];}return db[_0x7301('0x28')]['find']({'where':{'id':_0x276c84['params']['id']}})['then'](handleEntityNotFound(_0x3a088d,null))[_0x7301('0x23')](saveUpdates(_0x276c84[_0x7301('0x46')],null))[_0x7301('0x23')](respondWithResult(_0x3a088d,null))[_0x7301('0x41')](handleError(_0x3a088d,null));};exports[_0x7301('0x22')]=function(_0x542167,_0x3d5f91){return db[_0x7301('0x28')][_0x7301('0x47')]({'where':{'id':_0x542167['params']['id']}})[_0x7301('0x23')](handleEntityNotFound(_0x3d5f91,null))[_0x7301('0x23')](removeEntity(_0x3d5f91,null))['catch'](handleError(_0x3d5f91,null));};exports['getFields']=function(_0x27128c,_0x35bd2f,_0x4337fc){var _0x1f30b9={};var _0x12c7bd={};var _0x3826d1;var _0x20bdfa;return db[_0x7301('0x28')][_0x7301('0x48')]({'where':{'id':_0x27128c[_0x7301('0x43')]['id']}})['then'](handleEntityNotFound(_0x35bd2f,null))[_0x7301('0x23')](function(_0xaa0f70){if(_0xaa0f70){_0x3826d1=_0xaa0f70;_0x12c7bd[_0x7301('0x2d')]=_[_0x7301('0x2f')](db[_0x7301('0x49')][_0x7301('0x29')]);_0x12c7bd[_0x7301('0x2e')]=_['keys'](_0x27128c['query']);_0x12c7bd[_0x7301('0x38')]=_[_0x7301('0x31')](_0x12c7bd[_0x7301('0x2d')],_0x12c7bd['query']);_0x1f30b9['attributes']=_[_0x7301('0x31')](_0x12c7bd[_0x7301('0x2d')],qs[_0x7301('0x32')](_0x27128c[_0x7301('0x2e')]['fields']));_0x1f30b9[_0x7301('0x30')]=_0x1f30b9[_0x7301('0x30')][_0x7301('0x33')]?_0x1f30b9[_0x7301('0x30')]:_0x12c7bd[_0x7301('0x2d')];_0x1f30b9[_0x7301('0x36')]=qs[_0x7301('0x37')](_0x27128c['query']['sort']);_0x1f30b9[_0x7301('0x3c')]=qs[_0x7301('0x38')](_[_0x7301('0x39')](_0x27128c[_0x7301('0x2e')],_0x12c7bd['filters']));if(_0x27128c[_0x7301('0x2e')]['filter']){_0x1f30b9[_0x7301('0x3c')]=_[_0x7301('0x3b')](_0x1f30b9[_0x7301('0x3c')],{'$or':_['map'](_0x1f30b9[_0x7301('0x30')],function(_0x47c490){var _0x38c40e={};_0x38c40e[_0x47c490]={'$like':'%'+_0x27128c['query']['filter']+'%'};return _0x38c40e;})});}_0x1f30b9=_[_0x7301('0x3b')]({},_0x1f30b9,_0x27128c['options']);return _0x3826d1[_0x7301('0x4a')](_0x1f30b9);}})[_0x7301('0x23')](function(_0xcdec79){if(_0xcdec79){_0x20bdfa=_0xcdec79[_0x7301('0x33')];if(!_0x27128c['query'][_0x7301('0x34')](_0x7301('0x35'))){_0x1f30b9[_0x7301('0x1c')]=qs[_0x7301('0x1c')](_0x27128c[_0x7301('0x2e')][_0x7301('0x1c')]);_0x1f30b9[_0x7301('0x19')]=qs['offset'](_0x27128c['query'][_0x7301('0x19')]);}return _0x3826d1['getFields'](_0x1f30b9);}})[_0x7301('0x23')](function(_0x13c4ce){if(_0x13c4ce){return _0x13c4ce?{'count':_0x20bdfa,'rows':_0x13c4ce}:null;}})['then'](respondWithResult(_0x35bd2f,null))['catch'](handleError(_0x35bd2f,null));};exports[_0x7301('0x4b')]=function(_0x38d8d6,_0x4f43ba,_0x53d7fe){var _0x378481={};var _0x470e5e={};var _0x567684;var _0x150723;return db[_0x7301('0x28')][_0x7301('0x48')]({'where':{'id':_0x38d8d6[_0x7301('0x43')]['id']}})['then'](handleEntityNotFound(_0x4f43ba,null))['then'](function(_0x25f36f){if(_0x25f36f){_0x567684=_0x25f36f;_0x470e5e[_0x7301('0x2d')]=_[_0x7301('0x2f')](db[_0x7301('0x49')]['rawAttributes']);_0x470e5e[_0x7301('0x2e')]=_[_0x7301('0x2f')](_0x38d8d6[_0x7301('0x2e')]);_0x470e5e[_0x7301('0x38')]=_[_0x7301('0x31')](_0x470e5e[_0x7301('0x2d')],_0x470e5e[_0x7301('0x2e')]);_0x378481[_0x7301('0x30')]=_[_0x7301('0x31')](_0x470e5e[_0x7301('0x2d')],qs[_0x7301('0x32')](_0x38d8d6[_0x7301('0x2e')][_0x7301('0x32')]));_0x378481[_0x7301('0x30')]=_0x378481[_0x7301('0x30')][_0x7301('0x33')]?_0x378481[_0x7301('0x30')]:_0x470e5e[_0x7301('0x2d')];_0x378481[_0x7301('0x36')]=qs[_0x7301('0x37')](_0x38d8d6['query']['sort']);_0x378481[_0x7301('0x3c')]=qs['filters'](_[_0x7301('0x39')](_0x38d8d6[_0x7301('0x2e')],_0x470e5e['filters']));if(_0x38d8d6['query'][_0x7301('0x3a')]){_0x378481['where']=_['merge'](_0x378481[_0x7301('0x3c')],{'$or':_[_0x7301('0x27')](_0x378481[_0x7301('0x30')],function(_0x1ab71c){var _0x363d8c={};_0x363d8c[_0x1ab71c]={'$like':'%'+_0x38d8d6[_0x7301('0x2e')][_0x7301('0x3a')]+'%'};return _0x363d8c;})});}_0x378481=_[_0x7301('0x3b')]({},_0x378481,_0x38d8d6[_0x7301('0x3e')]);return _0x567684['getSubjects'](_0x378481);}})[_0x7301('0x23')](function(_0xbc0453){if(_0xbc0453){_0x150723=_0xbc0453['length'];if(!_0x38d8d6[_0x7301('0x2e')][_0x7301('0x34')]('nolimit')){_0x378481[_0x7301('0x1c')]=qs[_0x7301('0x1c')](_0x38d8d6[_0x7301('0x2e')][_0x7301('0x1c')]);_0x378481[_0x7301('0x19')]=qs[_0x7301('0x19')](_0x38d8d6[_0x7301('0x2e')]['offset']);}return _0x567684[_0x7301('0x4b')](_0x378481);}})['then'](function(_0x386556){if(_0x386556){return _0x386556?{'count':_0x150723,'rows':_0x386556}:null;}})[_0x7301('0x23')](respondWithResult(_0x4f43ba,null))['catch'](handleError(_0x4f43ba,null));};exports[_0x7301('0x4c')]=function(_0x4e873a,_0x5e4cf9,_0x36837e){var _0x161659={};var _0x12b0f3={};var _0x4d15f7;var _0x517bf0;return db[_0x7301('0x28')][_0x7301('0x48')]({'where':{'id':_0x4e873a[_0x7301('0x43')]['id']}})['then'](handleEntityNotFound(_0x5e4cf9,null))[_0x7301('0x23')](function(_0x18f56a){if(_0x18f56a){_0x4d15f7=_0x18f56a;_0x12b0f3['model']=_[_0x7301('0x2f')](db[_0x7301('0x49')]['rawAttributes']);_0x12b0f3['query']=_['keys'](_0x4e873a[_0x7301('0x2e')]);_0x12b0f3[_0x7301('0x38')]=_['intersection'](_0x12b0f3[_0x7301('0x2d')],_0x12b0f3[_0x7301('0x2e')]);_0x161659['attributes']=_[_0x7301('0x31')](_0x12b0f3[_0x7301('0x2d')],qs['fields'](_0x4e873a[_0x7301('0x2e')][_0x7301('0x32')]));_0x161659[_0x7301('0x30')]=_0x161659[_0x7301('0x30')]['length']?_0x161659[_0x7301('0x30')]:_0x12b0f3[_0x7301('0x2d')];_0x161659[_0x7301('0x36')]=qs[_0x7301('0x37')](_0x4e873a[_0x7301('0x2e')][_0x7301('0x37')]);_0x161659[_0x7301('0x3c')]=qs[_0x7301('0x38')](_[_0x7301('0x39')](_0x4e873a[_0x7301('0x2e')],_0x12b0f3[_0x7301('0x38')]));if(_0x4e873a[_0x7301('0x2e')][_0x7301('0x3a')]){_0x161659[_0x7301('0x3c')]=_[_0x7301('0x3b')](_0x161659['where'],{'$or':_[_0x7301('0x27')](_0x161659[_0x7301('0x30')],function(_0xd6f389){var _0x1a6d9d={};_0x1a6d9d[_0xd6f389]={'$like':'%'+_0x4e873a[_0x7301('0x2e')][_0x7301('0x3a')]+'%'};return _0x1a6d9d;})});}_0x161659=_[_0x7301('0x3b')]({},_0x161659,_0x4e873a[_0x7301('0x3e')]);return _0x4d15f7[_0x7301('0x4c')](_0x161659);}})[_0x7301('0x23')](function(_0x4a0a79){if(_0x4a0a79){_0x517bf0=_0x4a0a79[_0x7301('0x33')];if(!_0x4e873a[_0x7301('0x2e')][_0x7301('0x34')](_0x7301('0x35'))){_0x161659['limit']=qs[_0x7301('0x1c')](_0x4e873a[_0x7301('0x2e')][_0x7301('0x1c')]);_0x161659[_0x7301('0x19')]=qs[_0x7301('0x19')](_0x4e873a[_0x7301('0x2e')]['offset']);}return _0x4d15f7['getDescriptions'](_0x161659);}})[_0x7301('0x23')](function(_0x2f7547){if(_0x2f7547){return _0x2f7547?{'count':_0x517bf0,'rows':_0x2f7547}:null;}})['then'](respondWithResult(_0x5e4cf9,null))['catch'](handleError(_0x5e4cf9,null));};exports[_0x7301('0x4d')]=function(_0x335c44,_0x10842b,_0x428607){var _0x53e09c={};var _0x16c554={};var _0xa8e9df;var _0x34783c;return db[_0x7301('0x28')][_0x7301('0x48')]({'where':{'id':_0x335c44[_0x7301('0x43')]['id']}})[_0x7301('0x23')](handleEntityNotFound(_0x10842b,null))[_0x7301('0x23')](function(_0x420cdf){if(_0x420cdf){_0xa8e9df=_0x420cdf;_0x16c554[_0x7301('0x2d')]=_[_0x7301('0x2f')](db[_0x7301('0x4e')][_0x7301('0x29')]);_0x16c554[_0x7301('0x2e')]=_[_0x7301('0x2f')](_0x335c44[_0x7301('0x2e')]);_0x16c554[_0x7301('0x38')]=_['intersection'](_0x16c554['model'],_0x16c554[_0x7301('0x2e')]);_0x53e09c['attributes']=_['intersection'](_0x16c554[_0x7301('0x2d')],qs[_0x7301('0x32')](_0x335c44['query'][_0x7301('0x32')]));_0x53e09c[_0x7301('0x30')]=_0x53e09c[_0x7301('0x30')][_0x7301('0x33')]?_0x53e09c[_0x7301('0x30')]:_0x16c554[_0x7301('0x2d')];_0x53e09c[_0x7301('0x36')]=qs[_0x7301('0x37')](_0x335c44[_0x7301('0x2e')]['sort']);_0x53e09c['where']=qs[_0x7301('0x38')](_['pick'](_0x335c44[_0x7301('0x2e')],_0x16c554['filters']));if(_0x335c44[_0x7301('0x2e')][_0x7301('0x3a')]){_0x53e09c['where']=_[_0x7301('0x3b')](_0x53e09c[_0x7301('0x3c')],{'$or':_[_0x7301('0x27')](_0x53e09c[_0x7301('0x30')],function(_0x1eca7a){var _0x370ee1={};_0x370ee1[_0x1eca7a]={'$like':'%'+_0x335c44[_0x7301('0x2e')][_0x7301('0x3a')]+'%'};return _0x370ee1;})});}_0x53e09c=_[_0x7301('0x3b')]({},_0x53e09c,_0x335c44[_0x7301('0x3e')]);return _0xa8e9df[_0x7301('0x4d')](_0x53e09c);}})[_0x7301('0x23')](function(_0x29c643){if(_0x29c643){_0x34783c=_0x29c643[_0x7301('0x33')];if(!_0x335c44[_0x7301('0x2e')][_0x7301('0x34')](_0x7301('0x35'))){_0x53e09c[_0x7301('0x1c')]=qs[_0x7301('0x1c')](_0x335c44[_0x7301('0x2e')][_0x7301('0x1c')]);_0x53e09c['offset']=qs[_0x7301('0x19')](_0x335c44['query'][_0x7301('0x19')]);}return _0xa8e9df[_0x7301('0x4d')](_0x53e09c);}})[_0x7301('0x23')](function(_0x411f2f){if(_0x411f2f){return _0x411f2f?{'count':_0x34783c,'rows':_0x411f2f}:null;}})[_0x7301('0x23')](respondWithResult(_0x10842b,null))[_0x7301('0x41')](handleError(_0x10842b,null));};exports[_0x7301('0x4f')]=function(_0xe3f6e0,_0x16299c,_0x463471){if(_0xe3f6e0[_0x7301('0x46')]['id']){delete _0xe3f6e0[_0x7301('0x46')]['id'];}return db[_0x7301('0x28')][_0x7301('0x48')]({'where':{'id':_0xe3f6e0[_0x7301('0x43')]['id']}})['then'](handleEntityNotFound(_0x16299c,null))[_0x7301('0x23')](function(_0x2ecbe9){if(_0x2ecbe9){return _0x2ecbe9['setTags'](_0xe3f6e0['body'][_0x7301('0x50')]||[]);}return null;})[_0x7301('0x23')](respondWithResult(_0x16299c,null))[_0x7301('0x41')](handleError(_0x16299c,null));}; \ No newline at end of file +var _0xf6dd=['map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','FreshdeskConfiguration','findAll','rows','catch','show','rawAttributes','include','find','create','body','update','params','getFields','findOne','getSubjects','getDescriptions','FreshdeskField','Tag','getTags','setTags','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','then','destroy','stack','name','index'];(function(_0xf34b0a,_0x11e116){var _0x5021e1=function(_0x4eff67){while(--_0x4eff67){_0xf34b0a['push'](_0xf34b0a['shift']());}};_0x5021e1(++_0x11e116);}(_0xf6dd,0x7e));var _0xdf6d=function(_0xe6ff1c,_0x48fcbd){_0xe6ff1c=_0xe6ff1c-0x0;var _0x15e8c1=_0xf6dd[_0xe6ff1c];return _0x15e8c1;};'use strict';var emlformat=require(_0xdf6d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdf6d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdf6d('0x2'));var moment=require('moment');var BPromise=require(_0xdf6d('0x3'));var Mustache=require(_0xdf6d('0x4'));var util=require(_0xdf6d('0x5'));var path=require(_0xdf6d('0x6'));var sox=require(_0xdf6d('0x7'));var csv=require('to-csv');var ejs=require(_0xdf6d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xdf6d('0x9'));var jsforce=require(_0xdf6d('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xdf6d('0xb'));var querystring=require(_0xdf6d('0xc'));var Papa=require(_0xdf6d('0xd'));var Redis=require(_0xdf6d('0xe'));var authService=require(_0xdf6d('0xf'));var qs=require(_0xdf6d('0x10'));var as=require(_0xdf6d('0x11'));var hardwareService=require(_0xdf6d('0x12'));var logger=require(_0xdf6d('0x13'))(_0xdf6d('0x14'));var utils=require(_0xdf6d('0x15'));var config=require(_0xdf6d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xdf6d('0x17'))['db'];function respondWithStatusCode(_0x7bdeef,_0x2ca6dd){_0x2ca6dd=_0x2ca6dd||0xcc;return function(_0xb7c218){if(_0xb7c218){return _0x7bdeef[_0xdf6d('0x18')](_0x2ca6dd);}return _0x7bdeef[_0xdf6d('0x19')](_0x2ca6dd)[_0xdf6d('0x1a')]();};}function respondWithResult(_0x3d0bd5,_0xe04edf){_0xe04edf=_0xe04edf||0xc8;return function(_0x1e160f){if(_0x1e160f){return _0x3d0bd5['status'](_0xe04edf)[_0xdf6d('0x1b')](_0x1e160f);}};}function respondWithFilteredResult(_0x1599fc,_0x1f2e3e){return function(_0xa0e264){if(_0xa0e264){var _0x5032f8=typeof _0x1f2e3e[_0xdf6d('0x1c')]===_0xdf6d('0x1d')&&typeof _0x1f2e3e['limit']===_0xdf6d('0x1d');var _0xe43923=_0xa0e264['count'];var _0x4f8c06=_0x5032f8?0x0:_0x1f2e3e[_0xdf6d('0x1c')];var _0x13997c=_0x5032f8?_0xa0e264[_0xdf6d('0x1e')]:_0x1f2e3e[_0xdf6d('0x1c')]+_0x1f2e3e['limit'];var _0x10b9ff;if(_0x13997c>=_0xe43923){_0x13997c=_0xe43923;_0x10b9ff=0xc8;}else{_0x10b9ff=0xce;}_0x1599fc[_0xdf6d('0x19')](_0x10b9ff);return _0x1599fc['set'](_0xdf6d('0x1f'),_0x4f8c06+'-'+_0x13997c+'/'+_0xe43923)[_0xdf6d('0x1b')](_0xa0e264);}return null;};}function patchUpdates(_0xd0d7c9){return function(_0x517ff6){try{jsonpatch[_0xdf6d('0x20')](_0x517ff6,_0xd0d7c9,!![]);}catch(_0x5ad949){return BPromise[_0xdf6d('0x21')](_0x5ad949);}return _0x517ff6[_0xdf6d('0x22')]();};}function saveUpdates(_0x295b0d,_0x2db867){return function(_0x32526d){if(_0x32526d){return _0x32526d['update'](_0x295b0d)[_0xdf6d('0x23')](function(_0x4d87bc){return _0x4d87bc;});}return null;};}function removeEntity(_0xc89222,_0x350123){return function(_0x1d4fed){if(_0x1d4fed){return _0x1d4fed[_0xdf6d('0x24')]()[_0xdf6d('0x23')](function(){_0xc89222[_0xdf6d('0x19')](0xcc)[_0xdf6d('0x1a')]();});}};}function handleEntityNotFound(_0xbcb660,_0x7d8d4f){return function(_0x2d31d3){if(!_0x2d31d3){_0xbcb660[_0xdf6d('0x18')](0x194);}return _0x2d31d3;};}function handleError(_0x3dbc7b,_0x32e295){_0x32e295=_0x32e295||0x1f4;return function(_0x1249a7){logger['error'](_0x1249a7[_0xdf6d('0x25')]);if(_0x1249a7[_0xdf6d('0x26')]){delete _0x1249a7['name'];}_0x3dbc7b[_0xdf6d('0x19')](_0x32e295)['send'](_0x1249a7);};}exports[_0xdf6d('0x27')]=function(_0x3c3691,_0x1d988a){var _0x3c325e={},_0x613f94={},_0x42316f={'count':0x0,'rows':[]};var _0x1e5af0=_[_0xdf6d('0x28')](db['FreshdeskConfiguration']['rawAttributes'],function(_0x56ffff){return{'name':_0x56ffff[_0xdf6d('0x29')],'type':_0x56ffff[_0xdf6d('0x2a')][_0xdf6d('0x2b')]};});_0x613f94[_0xdf6d('0x2c')]=_[_0xdf6d('0x28')](_0x1e5af0,_0xdf6d('0x26'));_0x613f94[_0xdf6d('0x2d')]=_[_0xdf6d('0x2e')](_0x3c3691[_0xdf6d('0x2d')]);_0x613f94[_0xdf6d('0x2f')]=_[_0xdf6d('0x30')](_0x613f94[_0xdf6d('0x2c')],_0x613f94['query']);_0x3c325e[_0xdf6d('0x31')]=_[_0xdf6d('0x30')](_0x613f94['model'],qs[_0xdf6d('0x32')](_0x3c3691['query']['fields']));_0x3c325e[_0xdf6d('0x31')]=_0x3c325e[_0xdf6d('0x31')][_0xdf6d('0x33')]?_0x3c325e['attributes']:_0x613f94[_0xdf6d('0x2c')];if(!_0x3c3691[_0xdf6d('0x2d')][_0xdf6d('0x34')](_0xdf6d('0x35'))){_0x3c325e[_0xdf6d('0x36')]=qs[_0xdf6d('0x36')](_0x3c3691[_0xdf6d('0x2d')][_0xdf6d('0x36')]);_0x3c325e[_0xdf6d('0x1c')]=qs[_0xdf6d('0x1c')](_0x3c3691[_0xdf6d('0x2d')][_0xdf6d('0x1c')]);}_0x3c325e[_0xdf6d('0x37')]=qs['sort'](_0x3c3691['query'][_0xdf6d('0x38')]);_0x3c325e[_0xdf6d('0x39')]=qs[_0xdf6d('0x2f')](_[_0xdf6d('0x3a')](_0x3c3691[_0xdf6d('0x2d')],_0x613f94['filters']),_0x1e5af0);if(_0x3c3691[_0xdf6d('0x2d')]['filter']){_0x3c325e['where']=_[_0xdf6d('0x3b')](_0x3c325e[_0xdf6d('0x39')],{'$or':_[_0xdf6d('0x28')](_0x1e5af0,function(_0x42eb76){if(_0x42eb76[_0xdf6d('0x2a')]!==_0xdf6d('0x3c')){var _0x24615b={};_0x24615b[_0x42eb76[_0xdf6d('0x26')]]={'$like':'%'+_0x3c3691['query'][_0xdf6d('0x3d')]+'%'};return _0x24615b;}})});}_0x3c325e=_['merge']({},_0x3c325e,_0x3c3691[_0xdf6d('0x3e')]);var _0x58be7a={'where':_0x3c325e[_0xdf6d('0x39')]};return db[_0xdf6d('0x3f')][_0xdf6d('0x1e')](_0x58be7a)[_0xdf6d('0x23')](function(_0x3cc6db){_0x42316f['count']=_0x3cc6db;if(_0x3c3691[_0xdf6d('0x2d')]['includeAll']){_0x3c325e['include']=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xdf6d('0x40')](_0x3c325e);})['then'](function(_0x332ce6){_0x42316f[_0xdf6d('0x41')]=_0x332ce6;return _0x42316f;})['then'](respondWithFilteredResult(_0x1d988a,_0x3c325e))[_0xdf6d('0x42')](handleError(_0x1d988a,null));};exports[_0xdf6d('0x43')]=function(_0x3fc720,_0x4c163c){var _0x50bfd={'raw':![],'where':{'id':_0x3fc720['params']['id']}},_0x7eafa9={};_0x7eafa9['model']=_[_0xdf6d('0x2e')](db[_0xdf6d('0x3f')][_0xdf6d('0x44')]);_0x7eafa9['query']=_['keys'](_0x3fc720['query']);_0x7eafa9[_0xdf6d('0x2f')]=_[_0xdf6d('0x30')](_0x7eafa9[_0xdf6d('0x2c')],_0x7eafa9[_0xdf6d('0x2d')]);_0x50bfd['attributes']=_[_0xdf6d('0x30')](_0x7eafa9[_0xdf6d('0x2c')],qs[_0xdf6d('0x32')](_0x3fc720[_0xdf6d('0x2d')][_0xdf6d('0x32')]));_0x50bfd[_0xdf6d('0x31')]=_0x50bfd[_0xdf6d('0x31')]['length']?_0x50bfd[_0xdf6d('0x31')]:_0x7eafa9[_0xdf6d('0x2c')];if(_0x3fc720['query']['includeAll']){_0x50bfd[_0xdf6d('0x45')]=[{'all':!![]}];}_0x50bfd=_[_0xdf6d('0x3b')]({},_0x50bfd,_0x3fc720[_0xdf6d('0x3e')]);return db[_0xdf6d('0x3f')][_0xdf6d('0x46')](_0x50bfd)[_0xdf6d('0x23')](handleEntityNotFound(_0x4c163c,null))[_0xdf6d('0x23')](respondWithResult(_0x4c163c,null))['catch'](handleError(_0x4c163c,null));};exports[_0xdf6d('0x47')]=function(_0x4a5873,_0x122e48){return db[_0xdf6d('0x3f')][_0xdf6d('0x47')](_0x4a5873[_0xdf6d('0x48')],{})['then'](respondWithResult(_0x122e48,0xc9))[_0xdf6d('0x42')](handleError(_0x122e48,null));};exports[_0xdf6d('0x49')]=function(_0x1155fd,_0x278bc3){if(_0x1155fd['body']['id']){delete _0x1155fd['body']['id'];}return db[_0xdf6d('0x3f')]['find']({'where':{'id':_0x1155fd[_0xdf6d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x278bc3,null))[_0xdf6d('0x23')](saveUpdates(_0x1155fd[_0xdf6d('0x48')],null))[_0xdf6d('0x23')](respondWithResult(_0x278bc3,null))[_0xdf6d('0x42')](handleError(_0x278bc3,null));};exports['destroy']=function(_0x5449f6,_0x431ae6){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x5449f6[_0xdf6d('0x4a')]['id']}})[_0xdf6d('0x23')](handleEntityNotFound(_0x431ae6,null))[_0xdf6d('0x23')](removeEntity(_0x431ae6,null))['catch'](handleError(_0x431ae6,null));};exports[_0xdf6d('0x4b')]=function(_0x5bc1ff,_0x2a89a4,_0x166160){var _0x16a9d5={};var _0x3e86fb={};var _0x5dd46d;var _0x58665f;return db[_0xdf6d('0x3f')][_0xdf6d('0x4c')]({'where':{'id':_0x5bc1ff[_0xdf6d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2a89a4,null))['then'](function(_0x3cc053){if(_0x3cc053){_0x5dd46d=_0x3cc053;_0x3e86fb['model']=_[_0xdf6d('0x2e')](db['FreshdeskField']['rawAttributes']);_0x3e86fb[_0xdf6d('0x2d')]=_[_0xdf6d('0x2e')](_0x5bc1ff[_0xdf6d('0x2d')]);_0x3e86fb[_0xdf6d('0x2f')]=_[_0xdf6d('0x30')](_0x3e86fb[_0xdf6d('0x2c')],_0x3e86fb[_0xdf6d('0x2d')]);_0x16a9d5[_0xdf6d('0x31')]=_[_0xdf6d('0x30')](_0x3e86fb[_0xdf6d('0x2c')],qs['fields'](_0x5bc1ff[_0xdf6d('0x2d')][_0xdf6d('0x32')]));_0x16a9d5[_0xdf6d('0x31')]=_0x16a9d5[_0xdf6d('0x31')]['length']?_0x16a9d5[_0xdf6d('0x31')]:_0x3e86fb['model'];_0x16a9d5[_0xdf6d('0x37')]=qs[_0xdf6d('0x38')](_0x5bc1ff[_0xdf6d('0x2d')][_0xdf6d('0x38')]);_0x16a9d5[_0xdf6d('0x39')]=qs[_0xdf6d('0x2f')](_['pick'](_0x5bc1ff[_0xdf6d('0x2d')],_0x3e86fb[_0xdf6d('0x2f')]));if(_0x5bc1ff['query'][_0xdf6d('0x3d')]){_0x16a9d5[_0xdf6d('0x39')]=_[_0xdf6d('0x3b')](_0x16a9d5[_0xdf6d('0x39')],{'$or':_[_0xdf6d('0x28')](_0x16a9d5[_0xdf6d('0x31')],function(_0x311b7d){var _0x8463bd={};_0x8463bd[_0x311b7d]={'$like':'%'+_0x5bc1ff[_0xdf6d('0x2d')][_0xdf6d('0x3d')]+'%'};return _0x8463bd;})});}_0x16a9d5=_[_0xdf6d('0x3b')]({},_0x16a9d5,_0x5bc1ff[_0xdf6d('0x3e')]);return _0x5dd46d[_0xdf6d('0x4b')](_0x16a9d5);}})[_0xdf6d('0x23')](function(_0x513b04){if(_0x513b04){_0x58665f=_0x513b04[_0xdf6d('0x33')];if(!_0x5bc1ff['query'][_0xdf6d('0x34')](_0xdf6d('0x35'))){_0x16a9d5[_0xdf6d('0x36')]=qs['limit'](_0x5bc1ff['query']['limit']);_0x16a9d5['offset']=qs['offset'](_0x5bc1ff[_0xdf6d('0x2d')][_0xdf6d('0x1c')]);}return _0x5dd46d[_0xdf6d('0x4b')](_0x16a9d5);}})['then'](function(_0x461c58){if(_0x461c58){return _0x461c58?{'count':_0x58665f,'rows':_0x461c58}:null;}})['then'](respondWithResult(_0x2a89a4,null))[_0xdf6d('0x42')](handleError(_0x2a89a4,null));};exports[_0xdf6d('0x4d')]=function(_0x37dae5,_0x5acaf4,_0x2b94fc){var _0x110359={};var _0x13bae4={};var _0x3c817d;var _0x4bc02f;return db[_0xdf6d('0x3f')]['findOne']({'where':{'id':_0x37dae5[_0xdf6d('0x4a')]['id']}})[_0xdf6d('0x23')](handleEntityNotFound(_0x5acaf4,null))[_0xdf6d('0x23')](function(_0x597925){if(_0x597925){_0x3c817d=_0x597925;_0x13bae4['model']=_['keys'](db['FreshdeskField']['rawAttributes']);_0x13bae4['query']=_[_0xdf6d('0x2e')](_0x37dae5[_0xdf6d('0x2d')]);_0x13bae4[_0xdf6d('0x2f')]=_['intersection'](_0x13bae4['model'],_0x13bae4['query']);_0x110359['attributes']=_[_0xdf6d('0x30')](_0x13bae4[_0xdf6d('0x2c')],qs[_0xdf6d('0x32')](_0x37dae5[_0xdf6d('0x2d')][_0xdf6d('0x32')]));_0x110359['attributes']=_0x110359[_0xdf6d('0x31')][_0xdf6d('0x33')]?_0x110359[_0xdf6d('0x31')]:_0x13bae4[_0xdf6d('0x2c')];_0x110359[_0xdf6d('0x37')]=qs[_0xdf6d('0x38')](_0x37dae5[_0xdf6d('0x2d')]['sort']);_0x110359[_0xdf6d('0x39')]=qs['filters'](_[_0xdf6d('0x3a')](_0x37dae5['query'],_0x13bae4['filters']));if(_0x37dae5[_0xdf6d('0x2d')][_0xdf6d('0x3d')]){_0x110359[_0xdf6d('0x39')]=_[_0xdf6d('0x3b')](_0x110359[_0xdf6d('0x39')],{'$or':_[_0xdf6d('0x28')](_0x110359[_0xdf6d('0x31')],function(_0x4f2ee6){var _0x41d70b={};_0x41d70b[_0x4f2ee6]={'$like':'%'+_0x37dae5[_0xdf6d('0x2d')]['filter']+'%'};return _0x41d70b;})});}_0x110359=_[_0xdf6d('0x3b')]({},_0x110359,_0x37dae5[_0xdf6d('0x3e')]);return _0x3c817d[_0xdf6d('0x4d')](_0x110359);}})[_0xdf6d('0x23')](function(_0x25e18d){if(_0x25e18d){_0x4bc02f=_0x25e18d['length'];if(!_0x37dae5[_0xdf6d('0x2d')][_0xdf6d('0x34')](_0xdf6d('0x35'))){_0x110359[_0xdf6d('0x36')]=qs[_0xdf6d('0x36')](_0x37dae5[_0xdf6d('0x2d')][_0xdf6d('0x36')]);_0x110359[_0xdf6d('0x1c')]=qs[_0xdf6d('0x1c')](_0x37dae5[_0xdf6d('0x2d')][_0xdf6d('0x1c')]);}return _0x3c817d[_0xdf6d('0x4d')](_0x110359);}})[_0xdf6d('0x23')](function(_0x3a5244){if(_0x3a5244){return _0x3a5244?{'count':_0x4bc02f,'rows':_0x3a5244}:null;}})[_0xdf6d('0x23')](respondWithResult(_0x5acaf4,null))[_0xdf6d('0x42')](handleError(_0x5acaf4,null));};exports[_0xdf6d('0x4e')]=function(_0x2bcf4a,_0xd07079,_0xb1ebd){var _0xa147ad={};var _0x3000f2={};var _0x429c10;var _0x1f1773;return db[_0xdf6d('0x3f')][_0xdf6d('0x4c')]({'where':{'id':_0x2bcf4a[_0xdf6d('0x4a')]['id']}})[_0xdf6d('0x23')](handleEntityNotFound(_0xd07079,null))[_0xdf6d('0x23')](function(_0x37453c){if(_0x37453c){_0x429c10=_0x37453c;_0x3000f2['model']=_[_0xdf6d('0x2e')](db[_0xdf6d('0x4f')]['rawAttributes']);_0x3000f2[_0xdf6d('0x2d')]=_[_0xdf6d('0x2e')](_0x2bcf4a[_0xdf6d('0x2d')]);_0x3000f2[_0xdf6d('0x2f')]=_['intersection'](_0x3000f2[_0xdf6d('0x2c')],_0x3000f2['query']);_0xa147ad[_0xdf6d('0x31')]=_[_0xdf6d('0x30')](_0x3000f2['model'],qs[_0xdf6d('0x32')](_0x2bcf4a[_0xdf6d('0x2d')][_0xdf6d('0x32')]));_0xa147ad[_0xdf6d('0x31')]=_0xa147ad[_0xdf6d('0x31')][_0xdf6d('0x33')]?_0xa147ad['attributes']:_0x3000f2[_0xdf6d('0x2c')];_0xa147ad[_0xdf6d('0x37')]=qs[_0xdf6d('0x38')](_0x2bcf4a[_0xdf6d('0x2d')][_0xdf6d('0x38')]);_0xa147ad[_0xdf6d('0x39')]=qs[_0xdf6d('0x2f')](_[_0xdf6d('0x3a')](_0x2bcf4a[_0xdf6d('0x2d')],_0x3000f2[_0xdf6d('0x2f')]));if(_0x2bcf4a[_0xdf6d('0x2d')][_0xdf6d('0x3d')]){_0xa147ad[_0xdf6d('0x39')]=_[_0xdf6d('0x3b')](_0xa147ad[_0xdf6d('0x39')],{'$or':_[_0xdf6d('0x28')](_0xa147ad[_0xdf6d('0x31')],function(_0x2484d4){var _0x4252f7={};_0x4252f7[_0x2484d4]={'$like':'%'+_0x2bcf4a[_0xdf6d('0x2d')]['filter']+'%'};return _0x4252f7;})});}_0xa147ad=_['merge']({},_0xa147ad,_0x2bcf4a['options']);return _0x429c10['getDescriptions'](_0xa147ad);}})[_0xdf6d('0x23')](function(_0x40fc27){if(_0x40fc27){_0x1f1773=_0x40fc27['length'];if(!_0x2bcf4a[_0xdf6d('0x2d')][_0xdf6d('0x34')](_0xdf6d('0x35'))){_0xa147ad['limit']=qs[_0xdf6d('0x36')](_0x2bcf4a['query']['limit']);_0xa147ad[_0xdf6d('0x1c')]=qs[_0xdf6d('0x1c')](_0x2bcf4a[_0xdf6d('0x2d')]['offset']);}return _0x429c10[_0xdf6d('0x4e')](_0xa147ad);}})[_0xdf6d('0x23')](function(_0x55345a){if(_0x55345a){return _0x55345a?{'count':_0x1f1773,'rows':_0x55345a}:null;}})['then'](respondWithResult(_0xd07079,null))['catch'](handleError(_0xd07079,null));};exports['getTags']=function(_0x5003ff,_0x2e79da,_0x14d003){var _0x494e8e={};var _0x5beec9={};var _0x475f58;var _0x573359;return db[_0xdf6d('0x3f')][_0xdf6d('0x4c')]({'where':{'id':_0x5003ff[_0xdf6d('0x4a')]['id']}})[_0xdf6d('0x23')](handleEntityNotFound(_0x2e79da,null))[_0xdf6d('0x23')](function(_0x2f3181){if(_0x2f3181){_0x475f58=_0x2f3181;_0x5beec9[_0xdf6d('0x2c')]=_['keys'](db[_0xdf6d('0x50')][_0xdf6d('0x44')]);_0x5beec9[_0xdf6d('0x2d')]=_[_0xdf6d('0x2e')](_0x5003ff['query']);_0x5beec9[_0xdf6d('0x2f')]=_[_0xdf6d('0x30')](_0x5beec9[_0xdf6d('0x2c')],_0x5beec9[_0xdf6d('0x2d')]);_0x494e8e[_0xdf6d('0x31')]=_[_0xdf6d('0x30')](_0x5beec9[_0xdf6d('0x2c')],qs[_0xdf6d('0x32')](_0x5003ff[_0xdf6d('0x2d')][_0xdf6d('0x32')]));_0x494e8e[_0xdf6d('0x31')]=_0x494e8e['attributes'][_0xdf6d('0x33')]?_0x494e8e[_0xdf6d('0x31')]:_0x5beec9['model'];_0x494e8e['order']=qs[_0xdf6d('0x38')](_0x5003ff[_0xdf6d('0x2d')][_0xdf6d('0x38')]);_0x494e8e[_0xdf6d('0x39')]=qs[_0xdf6d('0x2f')](_[_0xdf6d('0x3a')](_0x5003ff['query'],_0x5beec9[_0xdf6d('0x2f')]));if(_0x5003ff[_0xdf6d('0x2d')]['filter']){_0x494e8e['where']=_[_0xdf6d('0x3b')](_0x494e8e[_0xdf6d('0x39')],{'$or':_['map'](_0x494e8e[_0xdf6d('0x31')],function(_0x3d916e){var _0x28f8a9={};_0x28f8a9[_0x3d916e]={'$like':'%'+_0x5003ff[_0xdf6d('0x2d')][_0xdf6d('0x3d')]+'%'};return _0x28f8a9;})});}_0x494e8e=_[_0xdf6d('0x3b')]({},_0x494e8e,_0x5003ff[_0xdf6d('0x3e')]);return _0x475f58[_0xdf6d('0x51')](_0x494e8e);}})[_0xdf6d('0x23')](function(_0x2243a1){if(_0x2243a1){_0x573359=_0x2243a1[_0xdf6d('0x33')];if(!_0x5003ff[_0xdf6d('0x2d')][_0xdf6d('0x34')](_0xdf6d('0x35'))){_0x494e8e[_0xdf6d('0x36')]=qs[_0xdf6d('0x36')](_0x5003ff['query']['limit']);_0x494e8e[_0xdf6d('0x1c')]=qs['offset'](_0x5003ff[_0xdf6d('0x2d')][_0xdf6d('0x1c')]);}return _0x475f58[_0xdf6d('0x51')](_0x494e8e);}})[_0xdf6d('0x23')](function(_0x3622c1){if(_0x3622c1){return _0x3622c1?{'count':_0x573359,'rows':_0x3622c1}:null;}})['then'](respondWithResult(_0x2e79da,null))[_0xdf6d('0x42')](handleError(_0x2e79da,null));};exports['setTags']=function(_0x3f1172,_0x3e0fe3,_0x5a9411){if(_0x3f1172['body']['id']){delete _0x3f1172[_0xdf6d('0x48')]['id'];}return db[_0xdf6d('0x3f')][_0xdf6d('0x4c')]({'where':{'id':_0x3f1172['params']['id']}})[_0xdf6d('0x23')](handleEntityNotFound(_0x3e0fe3,null))[_0xdf6d('0x23')](function(_0x5004df){if(_0x5004df){return _0x5004df[_0xdf6d('0x52')](_0x3f1172[_0xdf6d('0x48')]['ids']||[]);}return null;})['then'](respondWithResult(_0x3e0fe3,null))[_0xdf6d('0x42')](handleError(_0x3e0fe3,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 969de5a..dadd0cc 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 _0xde23=['./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','../../config/logger','bluebird','request-promise','path','../../config/environment'];(function(_0x34e9da,_0xd22403){var _0x343289=function(_0x3c30c8){while(--_0x3c30c8){_0x34e9da['push'](_0x34e9da['shift']());}};_0x343289(++_0xd22403);}(_0xde23,0x1a2));var _0x3de2=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xde23[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3de2('0x0'))('api');var moment=require('moment');var BPromise=require(_0x3de2('0x1'));var rp=require(_0x3de2('0x2'));var fs=require('fs');var path=require(_0x3de2('0x3'));var rimraf=require('rimraf');var config=require(_0x3de2('0x4'));var attributes=require(_0x3de2('0x5'));module['exports']=function(_0x8eb523,_0x365761){return _0x8eb523[_0x3de2('0x6')](_0x3de2('0x7'),attributes,{'tableName':_0x3de2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cf4=['../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x2ba659,_0x109426){var _0x1696d8=function(_0x30f0f0){while(--_0x30f0f0){_0x2ba659['push'](_0x2ba659['shift']());}};_0x1696d8(++_0x109426);}(_0x1cf4,0x131));var _0x41cf=function(_0x4231ab,_0x10bac5){_0x4231ab=_0x4231ab-0x0;var _0x589d6e=_0x1cf4[_0x4231ab];return _0x589d6e;};'use strict';var _=require(_0x41cf('0x0'));var util=require('util');var logger=require(_0x41cf('0x1'))(_0x41cf('0x2'));var moment=require(_0x41cf('0x3'));var BPromise=require(_0x41cf('0x4'));var rp=require(_0x41cf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x41cf('0x6'));var config=require(_0x41cf('0x7'));var attributes=require(_0x41cf('0x8'));module[_0x41cf('0x9')]=function(_0x44ff54,_0x5a2a27){return _0x44ff54[_0x41cf('0xa')](_0x41cf('0xb'),attributes,{'tableName':_0x41cf('0xc'),'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 e6f4c65..f98a828 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 _0x8dad=['catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0xcd38d3,_0x3731b4){var _0x42d5b1=function(_0x480260){while(--_0x480260){_0xcd38d3['push'](_0xcd38d3['shift']());}};_0x42d5b1(++_0x3731b4);}(_0x8dad,0x1cf));var _0xd8da=function(_0x6bcdf8,_0x31346c){_0x6bcdf8=_0x6bcdf8-0x0;var _0x2665ab=_0x8dad[_0x6bcdf8];return _0x2665ab;};'use strict';var _=require('lodash');var util=require(_0xd8da('0x0'));var moment=require(_0xd8da('0x1'));var BPromise=require('bluebird');var rs=require(_0xd8da('0x2'));var fs=require('fs');var Redis=require(_0xd8da('0x3'));var db=require(_0xd8da('0x4'))['db'];var utils=require(_0xd8da('0x5'));var logger=require(_0xd8da('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd8da('0x7'));var client=jayson[_0xd8da('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30cdd3,_0x53c9f9,_0x25b5bf){return new BPromise(function(_0x383818,_0x2bf155){return client['request'](_0x30cdd3,_0x25b5bf)[_0xd8da('0x9')](function(_0x502bf5){logger[_0xd8da('0xa')](_0xd8da('0xb'),_0x53c9f9,_0xd8da('0xc'));logger[_0xd8da('0xd')](_0xd8da('0xe'),_0x53c9f9,_0xd8da('0xc'),JSON[_0xd8da('0xf')](_0x502bf5));if(_0x502bf5[_0xd8da('0x10')]){if(_0x502bf5[_0xd8da('0x10')][_0xd8da('0x11')]===0x1f4){logger[_0xd8da('0x10')](_0xd8da('0xb'),_0x53c9f9,_0x502bf5[_0xd8da('0x10')]['message']);return _0x2bf155(_0x502bf5[_0xd8da('0x10')][_0xd8da('0x12')]);}logger[_0xd8da('0x10')](_0xd8da('0xb'),_0x53c9f9,_0x502bf5['error'][_0xd8da('0x12')]);return _0x383818(_0x502bf5[_0xd8da('0x10')][_0xd8da('0x12')]);}else{logger[_0xd8da('0xa')](_0xd8da('0xb'),_0x53c9f9,'request\x20sent');_0x383818(_0x502bf5[_0xd8da('0x13')][_0xd8da('0x12')]);}})[_0xd8da('0x14')](function(_0x41d46e){logger[_0xd8da('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x53c9f9,_0x41d46e);_0x2bf155(_0x41d46e);});});} \ No newline at end of file +var _0x6761=['request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s'];(function(_0x1bfb48,_0x2de37a){var _0x1f432a=function(_0x5d4b71){while(--_0x5d4b71){_0x1bfb48['push'](_0x1bfb48['shift']());}};_0x1f432a(++_0x2de37a);}(_0x6761,0x133));var _0x1676=function(_0x521144,_0x1bd7b0){_0x521144=_0x521144-0x0;var _0x3cac86=_0x6761[_0x521144];return _0x3cac86;};'use strict';var _=require(_0x1676('0x0'));var util=require('util');var moment=require(_0x1676('0x1'));var BPromise=require(_0x1676('0x2'));var rs=require(_0x1676('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1676('0x4'))(_0x1676('0x5'));var config=require(_0x1676('0x6'));var jayson=require(_0x1676('0x7'));var client=jayson[_0x1676('0x8')][_0x1676('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39995f,_0x4e1b23,_0x58b6c5){return new BPromise(function(_0x30ab6c,_0x1448cc){return client[_0x1676('0xa')](_0x39995f,_0x58b6c5)[_0x1676('0xb')](function(_0x1f4ab3){logger['info'](_0x1676('0xc'),_0x4e1b23,_0x1676('0xd'));logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4e1b23,_0x1676('0xd'),JSON[_0x1676('0xe')](_0x1f4ab3));if(_0x1f4ab3[_0x1676('0xf')]){if(_0x1f4ab3[_0x1676('0xf')][_0x1676('0x10')]===0x1f4){logger[_0x1676('0xf')](_0x1676('0xc'),_0x4e1b23,_0x1f4ab3[_0x1676('0xf')][_0x1676('0x11')]);return _0x1448cc(_0x1f4ab3[_0x1676('0xf')]['message']);}logger[_0x1676('0xf')](_0x1676('0xc'),_0x4e1b23,_0x1f4ab3['error'][_0x1676('0x11')]);return _0x30ab6c(_0x1f4ab3[_0x1676('0xf')][_0x1676('0x11')]);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x4e1b23,_0x1676('0xd'));_0x30ab6c(_0x1f4ab3[_0x1676('0x12')][_0x1676('0x11')]);}})[_0x1676('0x13')](function(_0x3b8e92){logger[_0x1676('0xf')](_0x1676('0xc'),_0x4e1b23,_0x3b8e92);_0x1448cc(_0x3b8e92);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 4be019a..369df02 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 _0x65f4=['./intFreshdeskField.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x65f4,0x182));var _0x465f=function(_0x5c6906,_0x2a4c47){_0x5c6906=_0x5c6906-0x0;var _0x534797=_0x65f4[_0x5c6906];return _0x534797;};'use strict';var multer=require(_0x465f('0x0'));var util=require(_0x465f('0x1'));var path=require(_0x465f('0x2'));var timeout=require(_0x465f('0x3'));var express=require(_0x465f('0x4'));var router=express[_0x465f('0x5')]();var fs_extra=require(_0x465f('0x6'));var auth=require(_0x465f('0x7'));var interaction=require(_0x465f('0x8'));var config=require(_0x465f('0x9'));var controller=require(_0x465f('0xa'));router[_0x465f('0xb')]('/',auth[_0x465f('0xc')](),controller['index']);router['get']('/:id',auth[_0x465f('0xc')](),controller[_0x465f('0xd')]);router[_0x465f('0xe')]('/',auth[_0x465f('0xc')](),controller[_0x465f('0xf')]);router[_0x465f('0x10')](_0x465f('0x11'),auth[_0x465f('0xc')](),controller[_0x465f('0x12')]);router[_0x465f('0x13')](_0x465f('0x11'),auth[_0x465f('0xc')](),controller[_0x465f('0x14')]);module[_0x465f('0x15')]=router; \ No newline at end of file +var _0x1f3a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x58f42a,_0x582f5c){var _0x249e18=function(_0x456bbe){while(--_0x456bbe){_0x58f42a['push'](_0x58f42a['shift']());}};_0x249e18(++_0x582f5c);}(_0x1f3a,0x1a1));var _0xa1f3=function(_0x3c10a5,_0x511c5b){_0x3c10a5=_0x3c10a5-0x0;var _0x403669=_0x1f3a[_0x3c10a5];return _0x403669;};'use strict';var multer=require(_0xa1f3('0x0'));var util=require(_0xa1f3('0x1'));var path=require(_0xa1f3('0x2'));var timeout=require(_0xa1f3('0x3'));var express=require(_0xa1f3('0x4'));var router=express[_0xa1f3('0x5')]();var fs_extra=require(_0xa1f3('0x6'));var auth=require(_0xa1f3('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xa1f3('0x8'));var controller=require(_0xa1f3('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xa1f3('0xa')]);router['get'](_0xa1f3('0xb'),auth[_0xa1f3('0xc')](),controller[_0xa1f3('0xd')]);router[_0xa1f3('0xe')]('/',auth[_0xa1f3('0xc')](),controller[_0xa1f3('0xf')]);router[_0xa1f3('0x10')]('/:id',auth[_0xa1f3('0xc')](),controller[_0xa1f3('0x11')]);router[_0xa1f3('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xa1f3('0x13')]);module[_0xa1f3('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 3e61270..f2a37bb 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 _0x60b2=['variable','keyValue','STRING','customVariable','sequelize','exports','ENUM','string'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x60b2,0x1a4));var _0x260b=function(_0x53d9a7,_0x44c4a3){_0x53d9a7=_0x53d9a7-0x0;var _0x1c8958=_0x60b2[_0x53d9a7];return _0x1c8958;};'use strict';var Sequelize=require(_0x260b('0x0'));module[_0x260b('0x1')]={'type':{'type':Sequelize[_0x260b('0x2')](_0x260b('0x3'),_0x260b('0x4'),'customVariable',_0x260b('0x5'),'picklist'),'defaultValue':_0x260b('0x3')},'content':{'type':Sequelize[_0x260b('0x6')]},'key':{'type':Sequelize[_0x260b('0x6')]},'keyType':{'type':Sequelize[_0x260b('0x2')](_0x260b('0x3'),_0x260b('0x4'),_0x260b('0x7'))},'keyContent':{'type':Sequelize[_0x260b('0x6')]},'idField':{'type':Sequelize[_0x260b('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9b39=['BOOLEAN','ENUM','variable','customVariable','keyValue','string','STRING'];(function(_0x535f24,_0x11b58b){var _0x402e13=function(_0x2ebef2){while(--_0x2ebef2){_0x535f24['push'](_0x535f24['shift']());}};_0x402e13(++_0x11b58b);}(_0x9b39,0x120));var _0x99b3=function(_0x490dca,_0x5c745e){_0x490dca=_0x490dca-0x0;var _0x31ee2=_0x9b39[_0x490dca];return _0x31ee2;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x99b3('0x0')]('string',_0x99b3('0x1'),_0x99b3('0x2'),_0x99b3('0x3'),'picklist'),'defaultValue':_0x99b3('0x4')},'content':{'type':Sequelize[_0x99b3('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x99b3('0x0')](_0x99b3('0x4'),_0x99b3('0x1'),_0x99b3('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x99b3('0x5')]},'nameField':{'type':Sequelize[_0x99b3('0x5')]},'customField':{'type':Sequelize[_0x99b3('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 57edd63..e85759c 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 _0x4746=['util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','map','FreshdeskField','rawAttributes','fieldName','type','key','query','keys','model','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','findAll','catch','intersection','find','create','body','update','params','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x4746,0xc6));var _0x6474=function(_0x102fe5,_0x3e8dbe){_0x102fe5=_0x102fe5-0x0;var _0x1906f6=_0x4746[_0x102fe5];return _0x1906f6;};'use strict';var emlformat=require(_0x6474('0x0'));var rimraf=require(_0x6474('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6474('0x2'));var rp=require('request-promise');var moment=require(_0x6474('0x3'));var BPromise=require(_0x6474('0x4'));var Mustache=require(_0x6474('0x5'));var util=require(_0x6474('0x6'));var path=require(_0x6474('0x7'));var sox=require('sox');var csv=require(_0x6474('0x8'));var ejs=require(_0x6474('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6474('0xa'));var squel=require(_0x6474('0xb'));var crypto=require(_0x6474('0xc'));var jsforce=require(_0x6474('0xd'));var deskjs=require(_0x6474('0xe'));var toCsv=require(_0x6474('0x8'));var querystring=require('querystring');var Papa=require(_0x6474('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6474('0x10'));var as=require(_0x6474('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6474('0x12'))('api');var utils=require(_0x6474('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6474('0x14'));var db=require(_0x6474('0x15'))['db'];function respondWithStatusCode(_0x5509d2,_0x4936c2){_0x4936c2=_0x4936c2||0xcc;return function(_0x5cf0de){if(_0x5cf0de){return _0x5509d2[_0x6474('0x16')](_0x4936c2);}return _0x5509d2[_0x6474('0x17')](_0x4936c2)[_0x6474('0x18')]();};}function respondWithResult(_0xad1ebe,_0x113aba){_0x113aba=_0x113aba||0xc8;return function(_0x37fe08){if(_0x37fe08){return _0xad1ebe[_0x6474('0x17')](_0x113aba)[_0x6474('0x19')](_0x37fe08);}};}function respondWithFilteredResult(_0x29b935,_0x5cf8fa){return function(_0x5ee279){if(_0x5ee279){var _0x583afa=typeof _0x5cf8fa[_0x6474('0x1a')]===_0x6474('0x1b')&&typeof _0x5cf8fa[_0x6474('0x1c')]===_0x6474('0x1b');var _0x195465=_0x5ee279['count'];var _0x1505fc=_0x583afa?0x0:_0x5cf8fa[_0x6474('0x1a')];var _0xb6ecb6=_0x583afa?_0x5ee279[_0x6474('0x1d')]:_0x5cf8fa[_0x6474('0x1a')]+_0x5cf8fa[_0x6474('0x1c')];var _0x2e33f0;if(_0xb6ecb6>=_0x195465){_0xb6ecb6=_0x195465;_0x2e33f0=0xc8;}else{_0x2e33f0=0xce;}_0x29b935[_0x6474('0x17')](_0x2e33f0);return _0x29b935['set'](_0x6474('0x1e'),_0x1505fc+'-'+_0xb6ecb6+'/'+_0x195465)['json'](_0x5ee279);}return null;};}function patchUpdates(_0xd23b18){return function(_0x1df53c){try{jsonpatch[_0x6474('0x1f')](_0x1df53c,_0xd23b18,!![]);}catch(_0x185760){return BPromise[_0x6474('0x20')](_0x185760);}return _0x1df53c[_0x6474('0x21')]();};}function saveUpdates(_0x382ebf,_0x5d0e5c){return function(_0xf3cd65){if(_0xf3cd65){return _0xf3cd65['update'](_0x382ebf)[_0x6474('0x22')](function(_0x4dc277){return _0x4dc277;});}return null;};}function removeEntity(_0x4ba645,_0x58e024){return function(_0xb67896){if(_0xb67896){return _0xb67896[_0x6474('0x23')]()[_0x6474('0x22')](function(){_0x4ba645[_0x6474('0x17')](0xcc)[_0x6474('0x18')]();});}};}function handleEntityNotFound(_0x4a9cb6,_0x7020fb){return function(_0x388d2d){if(!_0x388d2d){_0x4a9cb6[_0x6474('0x16')](0x194);}return _0x388d2d;};}function handleError(_0x698040,_0x559b33){_0x559b33=_0x559b33||0x1f4;return function(_0x587b7a){logger[_0x6474('0x24')](_0x587b7a[_0x6474('0x25')]);if(_0x587b7a[_0x6474('0x26')]){delete _0x587b7a[_0x6474('0x26')];}_0x698040['status'](_0x559b33)['send'](_0x587b7a);};}exports['index']=function(_0x4b81f3,_0x3333a8){var _0x28d445={},_0x1751bc={},_0x2387e9={'count':0x0,'rows':[]};var _0x52e64b=_[_0x6474('0x27')](db[_0x6474('0x28')][_0x6474('0x29')],function(_0x2e01fa){return{'name':_0x2e01fa[_0x6474('0x2a')],'type':_0x2e01fa[_0x6474('0x2b')][_0x6474('0x2c')]};});_0x1751bc['model']=_[_0x6474('0x27')](_0x52e64b,_0x6474('0x26'));_0x1751bc[_0x6474('0x2d')]=_[_0x6474('0x2e')](_0x4b81f3['query']);_0x1751bc['filters']=_['intersection'](_0x1751bc[_0x6474('0x2f')],_0x1751bc[_0x6474('0x2d')]);_0x28d445[_0x6474('0x30')]=_['intersection'](_0x1751bc[_0x6474('0x2f')],qs[_0x6474('0x31')](_0x4b81f3[_0x6474('0x2d')]['fields']));_0x28d445[_0x6474('0x30')]=_0x28d445[_0x6474('0x30')][_0x6474('0x32')]?_0x28d445['attributes']:_0x1751bc[_0x6474('0x2f')];if(!_0x4b81f3[_0x6474('0x2d')]['hasOwnProperty'](_0x6474('0x33'))){_0x28d445[_0x6474('0x1c')]=qs[_0x6474('0x1c')](_0x4b81f3[_0x6474('0x2d')][_0x6474('0x1c')]);_0x28d445['offset']=qs[_0x6474('0x1a')](_0x4b81f3[_0x6474('0x2d')]['offset']);}_0x28d445['order']=qs[_0x6474('0x34')](_0x4b81f3['query'][_0x6474('0x34')]);_0x28d445[_0x6474('0x35')]=qs[_0x6474('0x36')](_[_0x6474('0x37')](_0x4b81f3[_0x6474('0x2d')],_0x1751bc['filters']),_0x52e64b);if(_0x4b81f3['query'][_0x6474('0x38')]){_0x28d445[_0x6474('0x35')]=_[_0x6474('0x39')](_0x28d445['where'],{'$or':_[_0x6474('0x27')](_0x52e64b,function(_0x4d9ad7){if(_0x4d9ad7[_0x6474('0x2b')]!=='VIRTUAL'){var _0x4c486d={};_0x4c486d[_0x4d9ad7['name']]={'$like':'%'+_0x4b81f3[_0x6474('0x2d')][_0x6474('0x38')]+'%'};return _0x4c486d;}})});}_0x28d445=_[_0x6474('0x39')]({},_0x28d445,_0x4b81f3[_0x6474('0x3a')]);var _0x455069={'where':_0x28d445[_0x6474('0x35')]};return db['FreshdeskField'][_0x6474('0x1d')](_0x455069)[_0x6474('0x22')](function(_0x4c9487){_0x2387e9[_0x6474('0x1d')]=_0x4c9487;if(_0x4b81f3[_0x6474('0x2d')][_0x6474('0x3b')]){_0x28d445['include']=[{'all':!![]}];}return db[_0x6474('0x28')][_0x6474('0x3c')](_0x28d445);})[_0x6474('0x22')](function(_0x47fa33){_0x2387e9['rows']=_0x47fa33;return _0x2387e9;})[_0x6474('0x22')](respondWithFilteredResult(_0x3333a8,_0x28d445))[_0x6474('0x3d')](handleError(_0x3333a8,null));};exports['show']=function(_0x22835c,_0x44ed73){var _0x9bdba5={'raw':!![],'where':{'id':_0x22835c['params']['id']}},_0x1a4bde={};_0x1a4bde['model']=_[_0x6474('0x2e')](db['FreshdeskField'][_0x6474('0x29')]);_0x1a4bde[_0x6474('0x2d')]=_[_0x6474('0x2e')](_0x22835c['query']);_0x1a4bde[_0x6474('0x36')]=_[_0x6474('0x3e')](_0x1a4bde['model'],_0x1a4bde[_0x6474('0x2d')]);_0x9bdba5[_0x6474('0x30')]=_[_0x6474('0x3e')](_0x1a4bde[_0x6474('0x2f')],qs[_0x6474('0x31')](_0x22835c[_0x6474('0x2d')][_0x6474('0x31')]));_0x9bdba5['attributes']=_0x9bdba5[_0x6474('0x30')][_0x6474('0x32')]?_0x9bdba5['attributes']:_0x1a4bde[_0x6474('0x2f')];if(_0x22835c[_0x6474('0x2d')]['includeAll']){_0x9bdba5['include']=[{'all':!![]}];}_0x9bdba5=_['merge']({},_0x9bdba5,_0x22835c['options']);return db[_0x6474('0x28')][_0x6474('0x3f')](_0x9bdba5)[_0x6474('0x22')](handleEntityNotFound(_0x44ed73,null))[_0x6474('0x22')](respondWithResult(_0x44ed73,null))['catch'](handleError(_0x44ed73,null));};exports[_0x6474('0x40')]=function(_0x2d8504,_0x1c411e){return db[_0x6474('0x28')][_0x6474('0x40')](_0x2d8504[_0x6474('0x41')],{})['then'](respondWithResult(_0x1c411e,0xc9))[_0x6474('0x3d')](handleError(_0x1c411e,null));};exports[_0x6474('0x42')]=function(_0x394ff9,_0x495666){if(_0x394ff9[_0x6474('0x41')]['id']){delete _0x394ff9[_0x6474('0x41')]['id'];}return db['FreshdeskField'][_0x6474('0x3f')]({'where':{'id':_0x394ff9[_0x6474('0x43')]['id']}})[_0x6474('0x22')](handleEntityNotFound(_0x495666,null))[_0x6474('0x22')](saveUpdates(_0x394ff9[_0x6474('0x41')],null))[_0x6474('0x22')](respondWithResult(_0x495666,null))[_0x6474('0x3d')](handleError(_0x495666,null));};exports['destroy']=function(_0x27ebf9,_0x3697a0){return db[_0x6474('0x28')]['find']({'where':{'id':_0x27ebf9[_0x6474('0x43')]['id']}})[_0x6474('0x22')](handleEntityNotFound(_0x3697a0,null))[_0x6474('0x22')](removeEntity(_0x3697a0,null))['catch'](handleError(_0x3697a0,null));}; \ No newline at end of file +var _0x87ae=['../../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','status','error','name','send','FreshdeskField','fieldName','type','key','model','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','filter','merge','options','include','findAll','catch','params','length','includeAll','find','create','body','zip-dir','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0xadd855,_0x313dd0){var _0x16a09f=function(_0x29693f){while(--_0x29693f){_0xadd855['push'](_0xadd855['shift']());}};_0x16a09f(++_0x313dd0);}(_0x87ae,0xf5));var _0xe87a=function(_0x3aaf0a,_0x450970){_0x3aaf0a=_0x3aaf0a-0x0;var _0x33e6bc=_0x87ae[_0x3aaf0a];return _0x33e6bc;};'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(){_0x46731f[_0xe87a('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1108d0,_0x59dc1a){return function(_0x19f21e){if(!_0x19f21e){_0x1108d0[_0xe87a('0x15')](0x194);}return _0x19f21e;};}function handleError(_0x13e0a8,_0x16ee69){_0x16ee69=_0x16ee69||0x1f4;return function(_0x294d8b){logger[_0xe87a('0x23')](_0x294d8b['stack']);if(_0x294d8b[_0xe87a('0x24')]){delete _0x294d8b['name'];}_0x13e0a8['status'](_0x16ee69)[_0xe87a('0x25')](_0x294d8b);};}exports['index']=function(_0x537b52,_0x58a2b8){var _0x17c895={},_0x6feaf6={},_0x36d4cc={'count':0x0,'rows':[]};var _0x4eae3f=_['map'](db[_0xe87a('0x26')]['rawAttributes'],function(_0x4f61f7){return{'name':_0x4f61f7[_0xe87a('0x27')],'type':_0x4f61f7[_0xe87a('0x28')][_0xe87a('0x29')]};});_0x6feaf6[_0xe87a('0x2a')]=_[_0xe87a('0x2b')](_0x4eae3f,'name');_0x6feaf6[_0xe87a('0x2c')]=_['keys'](_0x537b52[_0xe87a('0x2c')]);_0x6feaf6['filters']=_[_0xe87a('0x2d')](_0x6feaf6[_0xe87a('0x2a')],_0x6feaf6[_0xe87a('0x2c')]);_0x17c895[_0xe87a('0x2e')]=_[_0xe87a('0x2d')](_0x6feaf6[_0xe87a('0x2a')],qs[_0xe87a('0x2f')](_0x537b52[_0xe87a('0x2c')][_0xe87a('0x2f')]));_0x17c895[_0xe87a('0x2e')]=_0x17c895['attributes']['length']?_0x17c895['attributes']:_0x6feaf6[_0xe87a('0x2a')];if(!_0x537b52['query'][_0xe87a('0x30')](_0xe87a('0x31'))){_0x17c895['limit']=qs[_0xe87a('0x18')](_0x537b52['query']['limit']);_0x17c895[_0xe87a('0x17')]=qs[_0xe87a('0x17')](_0x537b52[_0xe87a('0x2c')][_0xe87a('0x17')]);}_0x17c895['order']=qs[_0xe87a('0x32')](_0x537b52[_0xe87a('0x2c')]['sort']);_0x17c895[_0xe87a('0x33')]=qs[_0xe87a('0x34')](_['pick'](_0x537b52[_0xe87a('0x2c')],_0x6feaf6[_0xe87a('0x34')]),_0x4eae3f);if(_0x537b52[_0xe87a('0x2c')][_0xe87a('0x35')]){_0x17c895[_0xe87a('0x33')]=_['merge'](_0x17c895[_0xe87a('0x33')],{'$or':_['map'](_0x4eae3f,function(_0x28ed95){if(_0x28ed95['type']!=='VIRTUAL'){var _0x4315f5={};_0x4315f5[_0x28ed95[_0xe87a('0x24')]]={'$like':'%'+_0x537b52[_0xe87a('0x2c')][_0xe87a('0x35')]+'%'};return _0x4315f5;}})});}_0x17c895=_[_0xe87a('0x36')]({},_0x17c895,_0x537b52[_0xe87a('0x37')]);var _0x8423ba={'where':_0x17c895[_0xe87a('0x33')]};return db[_0xe87a('0x26')][_0xe87a('0x1a')](_0x8423ba)[_0xe87a('0x21')](function(_0x211a3e){_0x36d4cc[_0xe87a('0x1a')]=_0x211a3e;if(_0x537b52[_0xe87a('0x2c')]['includeAll']){_0x17c895[_0xe87a('0x38')]=[{'all':!![]}];}return db[_0xe87a('0x26')][_0xe87a('0x39')](_0x17c895);})[_0xe87a('0x21')](function(_0x5eb4e1){_0x36d4cc['rows']=_0x5eb4e1;return _0x36d4cc;})['then'](respondWithFilteredResult(_0x58a2b8,_0x17c895))[_0xe87a('0x3a')](handleError(_0x58a2b8,null));};exports['show']=function(_0x5400ff,_0x3bcee7){var _0x5eb62e={'raw':!![],'where':{'id':_0x5400ff[_0xe87a('0x3b')]['id']}},_0x5b1f55={};_0x5b1f55[_0xe87a('0x2a')]=_['keys'](db[_0xe87a('0x26')]['rawAttributes']);_0x5b1f55['query']=_['keys'](_0x5400ff[_0xe87a('0x2c')]);_0x5b1f55[_0xe87a('0x34')]=_['intersection'](_0x5b1f55[_0xe87a('0x2a')],_0x5b1f55[_0xe87a('0x2c')]);_0x5eb62e[_0xe87a('0x2e')]=_['intersection'](_0x5b1f55['model'],qs['fields'](_0x5400ff['query'][_0xe87a('0x2f')]));_0x5eb62e['attributes']=_0x5eb62e[_0xe87a('0x2e')][_0xe87a('0x3c')]?_0x5eb62e[_0xe87a('0x2e')]:_0x5b1f55[_0xe87a('0x2a')];if(_0x5400ff['query'][_0xe87a('0x3d')]){_0x5eb62e[_0xe87a('0x38')]=[{'all':!![]}];}_0x5eb62e=_['merge']({},_0x5eb62e,_0x5400ff[_0xe87a('0x37')]);return db[_0xe87a('0x26')][_0xe87a('0x3e')](_0x5eb62e)[_0xe87a('0x21')](handleEntityNotFound(_0x3bcee7,null))[_0xe87a('0x21')](respondWithResult(_0x3bcee7,null))[_0xe87a('0x3a')](handleError(_0x3bcee7,null));};exports[_0xe87a('0x3f')]=function(_0x4595be,_0x2aa508){return db['FreshdeskField'][_0xe87a('0x3f')](_0x4595be[_0xe87a('0x40')],{})[_0xe87a('0x21')](respondWithResult(_0x2aa508,0xc9))[_0xe87a('0x3a')](handleError(_0x2aa508,null));};exports['update']=function(_0x6ddec4,_0x28c00b){if(_0x6ddec4[_0xe87a('0x40')]['id']){delete _0x6ddec4[_0xe87a('0x40')]['id'];}return db[_0xe87a('0x26')][_0xe87a('0x3e')]({'where':{'id':_0x6ddec4[_0xe87a('0x3b')]['id']}})[_0xe87a('0x21')](handleEntityNotFound(_0x28c00b,null))['then'](saveUpdates(_0x6ddec4[_0xe87a('0x40')],null))[_0xe87a('0x21')](respondWithResult(_0x28c00b,null))[_0xe87a('0x3a')](handleError(_0x28c00b,null));};exports['destroy']=function(_0x19d380,_0xc43c4a){return db[_0xe87a('0x26')][_0xe87a('0x3e')]({'where':{'id':_0x19d380[_0xe87a('0x3b')]['id']}})[_0xe87a('0x21')](handleEntityNotFound(_0xc43c4a,null))[_0xe87a('0x21')](removeEntity(_0xc43c4a,null))[_0xe87a('0x3a')](handleError(_0xc43c4a,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 18b47ed..ff9c40e 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 _0x6263=['rimraf','../../config/environment','exports','define','int_freshdesk_fields','freshdesk_unique_index','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x3ee5fe,_0x48ff3b){var _0x1ce097=function(_0x54d3f9){while(--_0x54d3f9){_0x3ee5fe['push'](_0x3ee5fe['shift']());}};_0x1ce097(++_0x48ff3b);}(_0x6263,0x19d));var _0x3626=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x6263[_0x3fba9f];return _0x192cf1;};'use strict';var _=require(_0x3626('0x0'));var util=require(_0x3626('0x1'));var logger=require(_0x3626('0x2'))(_0x3626('0x3'));var moment=require(_0x3626('0x4'));var BPromise=require('bluebird');var rp=require(_0x3626('0x5'));var fs=require('fs');var path=require(_0x3626('0x6'));var rimraf=require(_0x3626('0x7'));var config=require(_0x3626('0x8'));var attributes=require('./intFreshdeskField.attributes');module[_0x3626('0x9')]=function(_0x55a44a,_0x3866ca){return _0x55a44a[_0x3626('0xa')]('FreshdeskField',attributes,{'tableName':_0x3626('0xb'),'paranoid':![],'indexes':[{'name':_0x3626('0xc'),'fields':['idField',_0x3626('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf9ec=['moment','bluebird','request-promise','path','../../config/environment','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','FieldId','lodash','util','../../config/logger','api'];(function(_0x151317,_0x3e6c29){var _0x50b025=function(_0x48c4cb){while(--_0x48c4cb){_0x151317['push'](_0x151317['shift']());}};_0x50b025(++_0x3e6c29);}(_0xf9ec,0x128));var _0xcf9e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf9ec[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xcf9e('0x0'));var util=require(_0xcf9e('0x1'));var logger=require(_0xcf9e('0x2'))(_0xcf9e('0x3'));var moment=require(_0xcf9e('0x4'));var BPromise=require(_0xcf9e('0x5'));var rp=require(_0xcf9e('0x6'));var fs=require('fs');var path=require(_0xcf9e('0x7'));var rimraf=require('rimraf');var config=require(_0xcf9e('0x8'));var attributes=require('./intFreshdeskField.attributes');module[_0xcf9e('0x9')]=function(_0x4c628a,_0x33ed48){return _0x4c628a[_0xcf9e('0xa')](_0xcf9e('0xb'),attributes,{'tableName':_0xcf9e('0xc'),'paranoid':![],'indexes':[{'name':_0xcf9e('0xd'),'fields':['idField',_0xcf9e('0xe')],'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 fc7c0eb..feb6c54 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 _0x6092=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','then','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','FreshdeskField,\x20%s,\x20%s','message','info','result'];(function(_0x34412f,_0x116bea){var _0x4b4b5a=function(_0x56fc5b){while(--_0x56fc5b){_0x34412f['push'](_0x34412f['shift']());}};_0x4b4b5a(++_0x116bea);}(_0x6092,0xc6));var _0x2609=function(_0x5a6fd5,_0x2a215c){_0x5a6fd5=_0x5a6fd5-0x0;var _0x3e0697=_0x6092[_0x5a6fd5];return _0x3e0697;};'use strict';var _=require(_0x2609('0x0'));var util=require(_0x2609('0x1'));var moment=require(_0x2609('0x2'));var BPromise=require(_0x2609('0x3'));var rs=require(_0x2609('0x4'));var fs=require('fs');var Redis=require(_0x2609('0x5'));var db=require(_0x2609('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2609('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2609('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d394d,_0x179e2e,_0x1cbe78){return new BPromise(function(_0x58710c,_0x3ea2dc){return client['request'](_0x1d394d,_0x1cbe78)[_0x2609('0x9')](function(_0x167b8f){logger['info']('FreshdeskField,\x20%s,\x20%s',_0x179e2e,_0x2609('0xa'));logger['debug'](_0x2609('0xb'),_0x179e2e,'request\x20sent',JSON['stringify'](_0x167b8f));if(_0x167b8f[_0x2609('0xc')]){if(_0x167b8f[_0x2609('0xc')][_0x2609('0xd')]===0x1f4){logger[_0x2609('0xc')](_0x2609('0xe'),_0x179e2e,_0x167b8f[_0x2609('0xc')][_0x2609('0xf')]);return _0x3ea2dc(_0x167b8f[_0x2609('0xc')][_0x2609('0xf')]);}logger[_0x2609('0xc')](_0x2609('0xe'),_0x179e2e,_0x167b8f[_0x2609('0xc')][_0x2609('0xf')]);return _0x58710c(_0x167b8f[_0x2609('0xc')][_0x2609('0xf')]);}else{logger[_0x2609('0x10')](_0x2609('0xe'),_0x179e2e,_0x2609('0xa'));_0x58710c(_0x167b8f[_0x2609('0x11')][_0x2609('0xf')]);}})['catch'](function(_0x38f477){logger[_0x2609('0xc')](_0x2609('0xe'),_0x179e2e,_0x38f477);_0x3ea2dc(_0x38f477);});});} \ No newline at end of file +var _0xe329=['error','code','FreshdeskField,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2bf5f2,_0x36b1cb){var _0x24335a=function(_0x157c5f){while(--_0x157c5f){_0x2bf5f2['push'](_0x2bf5f2['shift']());}};_0x24335a(++_0x36b1cb);}(_0xe329,0x194));var _0x9e32=function(_0x20c0b1,_0x1b2a59){_0x20c0b1=_0x20c0b1-0x0;var _0x2f8f0c=_0xe329[_0x20c0b1];return _0x2f8f0c;};'use strict';var _=require(_0x9e32('0x0'));var util=require(_0x9e32('0x1'));var moment=require(_0x9e32('0x2'));var BPromise=require(_0x9e32('0x3'));var rs=require(_0x9e32('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9e32('0x5'))['db'];var utils=require(_0x9e32('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x9e32('0x7'));var jayson=require(_0x9e32('0x8'));var client=jayson[_0x9e32('0x9')][_0x9e32('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d16f9,_0x23827d,_0x507231){return new BPromise(function(_0x15223b,_0xb165fd){return client['request'](_0x5d16f9,_0x507231)[_0x9e32('0xb')](function(_0x291448){logger[_0x9e32('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x23827d,'request\x20sent');logger['debug'](_0x9e32('0xd'),_0x23827d,_0x9e32('0xe'),JSON[_0x9e32('0xf')](_0x291448));if(_0x291448['error']){if(_0x291448[_0x9e32('0x10')][_0x9e32('0x11')]===0x1f4){logger[_0x9e32('0x10')](_0x9e32('0x12'),_0x23827d,_0x291448['error'][_0x9e32('0x13')]);return _0xb165fd(_0x291448['error'][_0x9e32('0x13')]);}logger['error'](_0x9e32('0x12'),_0x23827d,_0x291448['error']['message']);return _0x15223b(_0x291448[_0x9e32('0x10')][_0x9e32('0x13')]);}else{logger[_0x9e32('0xc')](_0x9e32('0x12'),_0x23827d,_0x9e32('0xe'));_0x15223b(_0x291448[_0x9e32('0x14')][_0x9e32('0x13')]);}})['catch'](function(_0x3af404){logger[_0x9e32('0x10')](_0x9e32('0x12'),_0x23827d,_0x3af404);_0xb165fd(_0x3af404);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 0ad409d..2d548c0 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 _0x282b=['../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields','post','create','/:id/configurations','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x34b87f,_0x28aef2){var _0x449805=function(_0x3735b7){while(--_0x3735b7){_0x34b87f['push'](_0x34b87f['shift']());}};_0x449805(++_0x28aef2);}(_0x282b,0xec));var _0xb282=function(_0x461ca5,_0x42954b){_0x461ca5=_0x461ca5-0x0;var _0xd9b668=_0x282b[_0x461ca5];return _0xd9b668;};'use strict';var multer=require(_0xb282('0x0'));var util=require(_0xb282('0x1'));var path=require(_0xb282('0x2'));var timeout=require(_0xb282('0x3'));var express=require(_0xb282('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb282('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb282('0x6'));var controller=require(_0xb282('0x7'));router[_0xb282('0x8')]('/',auth[_0xb282('0x9')](),controller[_0xb282('0xa')]);router[_0xb282('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xb282('0xb')]);router[_0xb282('0x8')]('/:id/configurations',auth[_0xb282('0x9')](),controller[_0xb282('0xc')]);router[_0xb282('0x8')](_0xb282('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0xb282('0xe')]('/',auth[_0xb282('0x9')](),controller[_0xb282('0xf')]);router[_0xb282('0xe')](_0xb282('0x10'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xb282('0x11')](_0xb282('0x12'),auth[_0xb282('0x9')](),controller[_0xb282('0x13')]);router[_0xb282('0x14')]('/:id',auth[_0xb282('0x9')](),controller['destroy']);module[_0xb282('0x15')]=router; \ No newline at end of file +var _0x5423=['create','post','addConfiguration','put','update','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','getFields'];(function(_0x20451e,_0x3484aa){var _0x11959b=function(_0x20c4f0){while(--_0x20c4f0){_0x20451e['push'](_0x20451e['shift']());}};_0x11959b(++_0x3484aa);}(_0x5423,0xe3));var _0x3542=function(_0x59d2a3,_0x4e8480){_0x59d2a3=_0x59d2a3-0x0;var _0x3aa0de=_0x5423[_0x59d2a3];return _0x3aa0de;};'use strict';var multer=require(_0x3542('0x0'));var util=require(_0x3542('0x1'));var path=require('path');var timeout=require(_0x3542('0x2'));var express=require(_0x3542('0x3'));var router=express['Router']();var fs_extra=require(_0x3542('0x4'));var auth=require(_0x3542('0x5'));var interaction=require(_0x3542('0x6'));var config=require(_0x3542('0x7'));var controller=require('./intFreshsalesAccount.controller');router[_0x3542('0x8')]('/',auth[_0x3542('0x9')](),controller[_0x3542('0xa')]);router[_0x3542('0x8')](_0x3542('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x3542('0x8')](_0x3542('0xc'),auth['isAuthenticated'](),controller[_0x3542('0xd')]);router[_0x3542('0x8')]('/:id/fields',auth[_0x3542('0x9')](),controller[_0x3542('0xe')]);router['post']('/',auth[_0x3542('0x9')](),controller[_0x3542('0xf')]);router[_0x3542('0x10')](_0x3542('0xc'),auth[_0x3542('0x9')](),controller[_0x3542('0x11')]);router[_0x3542('0x12')](_0x3542('0xb'),auth[_0x3542('0x9')](),controller[_0x3542('0x13')]);router[_0x3542('0x14')](_0x3542('0xb'),auth[_0x3542('0x9')](),controller['destroy']);module[_0x3542('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index d6ff2b6..5f281bf 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 _0x02ce=['sequelize','exports','STRING','remoteUri'];(function(_0x202d48,_0x2f55fa){var _0x265d5b=function(_0x523a6a){while(--_0x523a6a){_0x202d48['push'](_0x202d48['shift']());}};_0x265d5b(++_0x2f55fa);}(_0x02ce,0x1ac));var _0xe02c=function(_0x54728a,_0x27675b){_0x54728a=_0x54728a-0x0;var _0x498eb3=_0x02ce[_0x54728a];return _0x498eb3;};'use strict';var Sequelize=require(_0xe02c('0x0'));module[_0xe02c('0x1')]={'name':{'type':Sequelize[_0xe02c('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe02c('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xe02c('0x2')]},'remoteUri':{'type':Sequelize[_0xe02c('0x2')],'unique':_0xe02c('0x3')},'serverUrl':{'type':Sequelize[_0xe02c('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5c3c=['remoteUri','sequelize','exports','STRING','username'];(function(_0x3a1522,_0x51684f){var _0x2c7785=function(_0xa99654){while(--_0xa99654){_0x3a1522['push'](_0x3a1522['shift']());}};_0x2c7785(++_0x51684f);}(_0x5c3c,0x132));var _0xc5c3=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x5c3c[_0x5c9307];return _0x373e29;};'use strict';var Sequelize=require(_0xc5c3('0x0'));module[_0xc5c3('0x1')]={'name':{'type':Sequelize[_0xc5c3('0x2')]},'description':{'type':Sequelize[_0xc5c3('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xc5c3('0x3')},'apiKey':{'type':Sequelize[_0xc5c3('0x2')]},'remoteUri':{'type':Sequelize[_0xc5c3('0x2')],'unique':_0xc5c3('0x4')},'serverUrl':{'type':Sequelize[_0xc5c3('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index a97c8cc..4a5ae2e 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 _0xac9f=['getFields','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','send','map','FreshsalesAccount','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','body','getConfigurations','where','nolimit','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesConfiguration','remoteUri','slice','substring','lastIndexOf','GET','Token\x20token=','apiKey','users','email','test','error','getFields,\x20%s,\x20%s,\x20%s'];(function(_0x1900bd,_0x48a6b6){var _0x5c162e=function(_0x17240c){while(--_0x17240c){_0x1900bd['push'](_0x1900bd['shift']());}};_0x5c162e(++_0x48a6b6);}(_0xac9f,0xc4));var _0xfac9=function(_0x4be155,_0x909814){_0x4be155=_0x4be155-0x0;var _0x4ad8c2=_0xac9f[_0x4be155];return _0x4ad8c2;};'use strict';var emlformat=require(_0xfac9('0x0'));var rimraf=require(_0xfac9('0x1'));var zipdir=require(_0xfac9('0x2'));var jsonpatch=require(_0xfac9('0x3'));var rp=require(_0xfac9('0x4'));var moment=require(_0xfac9('0x5'));var BPromise=require(_0xfac9('0x6'));var Mustache=require('mustache');var util=require(_0xfac9('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfac9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfac9('0x9'));var squel=require(_0xfac9('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfac9('0xb'));var toCsv=require('to-csv');var querystring=require(_0xfac9('0xc'));var Papa=require('papaparse');var Redis=require(_0xfac9('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xfac9('0xe'));var as=require(_0xfac9('0xf'));var hardwareService=require(_0xfac9('0x10'));var logger=require('../../config/logger')(_0xfac9('0x11'));var utils=require(_0xfac9('0x12'));var config=require(_0xfac9('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xfac9('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5a0589,_0x2d7212){_0x2d7212=_0x2d7212||0xcc;return function(_0x37a828){if(_0x37a828){return _0x5a0589['sendStatus'](_0x2d7212);}return _0x5a0589['status'](_0x2d7212)[_0xfac9('0x15')]();};}function respondWithResult(_0x509843,_0x15d586){_0x15d586=_0x15d586||0xc8;return function(_0x40e3f4){if(_0x40e3f4){return _0x509843[_0xfac9('0x16')](_0x15d586)[_0xfac9('0x17')](_0x40e3f4);}};}function respondWithFilteredResult(_0x317681,_0x195927){return function(_0x5be756){if(_0x5be756){var _0x27f7b7=typeof _0x195927['offset']===_0xfac9('0x18')&&typeof _0x195927[_0xfac9('0x19')]==='undefined';var _0x5e9394=_0x5be756[_0xfac9('0x1a')];var _0x4803dc=_0x27f7b7?0x0:_0x195927[_0xfac9('0x1b')];var _0x3062c4=_0x27f7b7?_0x5be756[_0xfac9('0x1a')]:_0x195927['offset']+_0x195927[_0xfac9('0x19')];var _0x368a5e;if(_0x3062c4>=_0x5e9394){_0x3062c4=_0x5e9394;_0x368a5e=0xc8;}else{_0x368a5e=0xce;}_0x317681[_0xfac9('0x16')](_0x368a5e);return _0x317681[_0xfac9('0x1c')](_0xfac9('0x1d'),_0x4803dc+'-'+_0x3062c4+'/'+_0x5e9394)[_0xfac9('0x17')](_0x5be756);}return null;};}function patchUpdates(_0x2967e0){return function(_0x371d1d){try{jsonpatch[_0xfac9('0x1e')](_0x371d1d,_0x2967e0,!![]);}catch(_0x453de1){return BPromise[_0xfac9('0x1f')](_0x453de1);}return _0x371d1d['save']();};}function saveUpdates(_0x141a2e,_0x217ee1){return function(_0x39fc60){if(_0x39fc60){return _0x39fc60[_0xfac9('0x20')](_0x141a2e)[_0xfac9('0x21')](function(_0x40a892){return _0x40a892;});}return null;};}function removeEntity(_0xdf2bca,_0x5a77e1){return function(_0x17ecf7){if(_0x17ecf7){return _0x17ecf7[_0xfac9('0x22')]()[_0xfac9('0x21')](function(){_0xdf2bca[_0xfac9('0x16')](0xcc)[_0xfac9('0x15')]();});}};}function handleEntityNotFound(_0x3f89b4,_0x51f7e2){return function(_0x5c212a){if(!_0x5c212a){_0x3f89b4[_0xfac9('0x23')](0x194);}return _0x5c212a;};}function handleError(_0x3892dc,_0x3be94e){_0x3be94e=_0x3be94e||0x1f4;return function(_0x47007d){logger['error'](_0x47007d[_0xfac9('0x24')]);if(_0x47007d[_0xfac9('0x25')]){delete _0x47007d[_0xfac9('0x25')];}_0x3892dc['status'](_0x3be94e)[_0xfac9('0x26')](_0x47007d);};}exports['index']=function(_0x4fe104,_0x272029){var _0x4289bb={},_0x5d478c={},_0x485355={'count':0x0,'rows':[]};var _0x932eaf=_[_0xfac9('0x27')](db[_0xfac9('0x28')]['rawAttributes'],function(_0x5e58db){return{'name':_0x5e58db['fieldName'],'type':_0x5e58db[_0xfac9('0x29')][_0xfac9('0x2a')]};});_0x5d478c[_0xfac9('0x2b')]=_[_0xfac9('0x27')](_0x932eaf,_0xfac9('0x25'));_0x5d478c[_0xfac9('0x2c')]=_[_0xfac9('0x2d')](_0x4fe104[_0xfac9('0x2c')]);_0x5d478c[_0xfac9('0x2e')]=_[_0xfac9('0x2f')](_0x5d478c[_0xfac9('0x2b')],_0x5d478c[_0xfac9('0x2c')]);_0x4289bb[_0xfac9('0x30')]=_[_0xfac9('0x2f')](_0x5d478c[_0xfac9('0x2b')],qs[_0xfac9('0x31')](_0x4fe104[_0xfac9('0x2c')][_0xfac9('0x31')]));_0x4289bb[_0xfac9('0x30')]=_0x4289bb[_0xfac9('0x30')][_0xfac9('0x32')]?_0x4289bb['attributes']:_0x5d478c['model'];if(!_0x4fe104[_0xfac9('0x2c')][_0xfac9('0x33')]('nolimit')){_0x4289bb[_0xfac9('0x19')]=qs[_0xfac9('0x19')](_0x4fe104[_0xfac9('0x2c')][_0xfac9('0x19')]);_0x4289bb[_0xfac9('0x1b')]=qs[_0xfac9('0x1b')](_0x4fe104[_0xfac9('0x2c')][_0xfac9('0x1b')]);}_0x4289bb[_0xfac9('0x34')]=qs[_0xfac9('0x35')](_0x4fe104[_0xfac9('0x2c')][_0xfac9('0x35')]);_0x4289bb['where']=qs['filters'](_[_0xfac9('0x36')](_0x4fe104[_0xfac9('0x2c')],_0x5d478c[_0xfac9('0x2e')]),_0x932eaf);if(_0x4fe104[_0xfac9('0x2c')][_0xfac9('0x37')]){_0x4289bb['where']=_['merge'](_0x4289bb['where'],{'$or':_[_0xfac9('0x27')](_0x932eaf,function(_0x13d825){if(_0x13d825[_0xfac9('0x29')]!==_0xfac9('0x38')){var _0x468dab={};_0x468dab[_0x13d825[_0xfac9('0x25')]]={'$like':'%'+_0x4fe104[_0xfac9('0x2c')][_0xfac9('0x37')]+'%'};return _0x468dab;}})});}_0x4289bb=_[_0xfac9('0x39')]({},_0x4289bb,_0x4fe104[_0xfac9('0x3a')]);var _0x42f386={'where':_0x4289bb['where']};return db[_0xfac9('0x28')]['count'](_0x42f386)[_0xfac9('0x21')](function(_0x361ede){_0x485355[_0xfac9('0x1a')]=_0x361ede;if(_0x4fe104[_0xfac9('0x2c')]['includeAll']){_0x4289bb[_0xfac9('0x3b')]=[{'all':!![]}];}return db[_0xfac9('0x28')][_0xfac9('0x3c')](_0x4289bb);})[_0xfac9('0x21')](function(_0xc02324){_0x485355[_0xfac9('0x3d')]=_0xc02324;return _0x485355;})[_0xfac9('0x21')](respondWithFilteredResult(_0x272029,_0x4289bb))['catch'](handleError(_0x272029,null));};exports[_0xfac9('0x3e')]=function(_0x2b3474,_0x49c736){var _0x19d085={'raw':![],'where':{'id':_0x2b3474[_0xfac9('0x3f')]['id']}},_0x15d6e8={};_0x15d6e8[_0xfac9('0x2b')]=_[_0xfac9('0x2d')](db['FreshsalesAccount'][_0xfac9('0x40')]);_0x15d6e8[_0xfac9('0x2c')]=_[_0xfac9('0x2d')](_0x2b3474[_0xfac9('0x2c')]);_0x15d6e8['filters']=_['intersection'](_0x15d6e8[_0xfac9('0x2b')],_0x15d6e8[_0xfac9('0x2c')]);_0x19d085[_0xfac9('0x30')]=_[_0xfac9('0x2f')](_0x15d6e8[_0xfac9('0x2b')],qs[_0xfac9('0x31')](_0x2b3474[_0xfac9('0x2c')]['fields']));_0x19d085[_0xfac9('0x30')]=_0x19d085['attributes']['length']?_0x19d085[_0xfac9('0x30')]:_0x15d6e8[_0xfac9('0x2b')];if(_0x2b3474[_0xfac9('0x2c')][_0xfac9('0x41')]){_0x19d085[_0xfac9('0x3b')]=[{'all':!![]}];}_0x19d085=_[_0xfac9('0x39')]({},_0x19d085,_0x2b3474[_0xfac9('0x3a')]);return db[_0xfac9('0x28')][_0xfac9('0x42')](_0x19d085)['then'](handleEntityNotFound(_0x49c736,null))['then'](respondWithResult(_0x49c736,null))[_0xfac9('0x43')](handleError(_0x49c736,null));};exports[_0xfac9('0x44')]=function(_0x4fb12f,_0xdb7414){return db[_0xfac9('0x28')][_0xfac9('0x44')](_0x4fb12f['body'],{})[_0xfac9('0x21')](respondWithResult(_0xdb7414,0xc9))[_0xfac9('0x43')](handleError(_0xdb7414,null));};exports[_0xfac9('0x20')]=function(_0x16d27a,_0x127f93){if(_0x16d27a[_0xfac9('0x45')]['id']){delete _0x16d27a[_0xfac9('0x45')]['id'];}return db[_0xfac9('0x28')][_0xfac9('0x42')]({'where':{'id':_0x16d27a['params']['id']}})[_0xfac9('0x21')](handleEntityNotFound(_0x127f93,null))[_0xfac9('0x21')](saveUpdates(_0x16d27a[_0xfac9('0x45')],null))[_0xfac9('0x21')](respondWithResult(_0x127f93,null))[_0xfac9('0x43')](handleError(_0x127f93,null));};exports[_0xfac9('0x22')]=function(_0x2773fe,_0x36804e){return db[_0xfac9('0x28')][_0xfac9('0x42')]({'where':{'id':_0x2773fe[_0xfac9('0x3f')]['id']}})[_0xfac9('0x21')](handleEntityNotFound(_0x36804e,null))['then'](removeEntity(_0x36804e,null))[_0xfac9('0x43')](handleError(_0x36804e,null));};exports[_0xfac9('0x46')]=function(_0x67e9e5,_0xf383c0,_0x3774e3){var _0x4cf0e1={};var _0x2dab5a={};var _0x5dee35;var _0x219cfb;return db[_0xfac9('0x28')]['findOne']({'where':{'id':_0x67e9e5[_0xfac9('0x3f')]['id']}})[_0xfac9('0x21')](handleEntityNotFound(_0xf383c0,null))[_0xfac9('0x21')](function(_0x72f168){if(_0x72f168){_0x5dee35=_0x72f168;_0x2dab5a[_0xfac9('0x2b')]=_[_0xfac9('0x2d')](db['FreshsalesConfiguration'][_0xfac9('0x40')]);_0x2dab5a[_0xfac9('0x2c')]=_[_0xfac9('0x2d')](_0x67e9e5[_0xfac9('0x2c')]);_0x2dab5a[_0xfac9('0x2e')]=_['intersection'](_0x2dab5a['model'],_0x2dab5a[_0xfac9('0x2c')]);_0x4cf0e1[_0xfac9('0x30')]=_[_0xfac9('0x2f')](_0x2dab5a[_0xfac9('0x2b')],qs['fields'](_0x67e9e5['query']['fields']));_0x4cf0e1[_0xfac9('0x30')]=_0x4cf0e1[_0xfac9('0x30')][_0xfac9('0x32')]?_0x4cf0e1['attributes']:_0x2dab5a['model'];_0x4cf0e1[_0xfac9('0x34')]=qs[_0xfac9('0x35')](_0x67e9e5[_0xfac9('0x2c')][_0xfac9('0x35')]);_0x4cf0e1[_0xfac9('0x47')]=qs['filters'](_[_0xfac9('0x36')](_0x67e9e5[_0xfac9('0x2c')],_0x2dab5a['filters']));if(_0x67e9e5[_0xfac9('0x2c')][_0xfac9('0x37')]){_0x4cf0e1[_0xfac9('0x47')]=_[_0xfac9('0x39')](_0x4cf0e1[_0xfac9('0x47')],{'$or':_['map'](_0x4cf0e1[_0xfac9('0x30')],function(_0xe87973){var _0x45dc4b={};_0x45dc4b[_0xe87973]={'$like':'%'+_0x67e9e5[_0xfac9('0x2c')][_0xfac9('0x37')]+'%'};return _0x45dc4b;})});}_0x4cf0e1=_[_0xfac9('0x39')]({},_0x4cf0e1,_0x67e9e5[_0xfac9('0x3a')]);return _0x5dee35[_0xfac9('0x46')](_0x4cf0e1);}})[_0xfac9('0x21')](function(_0xa169c0){if(_0xa169c0){_0x219cfb=_0xa169c0['length'];if(!_0x67e9e5[_0xfac9('0x2c')][_0xfac9('0x33')](_0xfac9('0x48'))){_0x4cf0e1[_0xfac9('0x19')]=qs['limit'](_0x67e9e5['query'][_0xfac9('0x19')]);_0x4cf0e1[_0xfac9('0x1b')]=qs['offset'](_0x67e9e5[_0xfac9('0x2c')][_0xfac9('0x1b')]);}return _0x5dee35['getConfigurations'](_0x4cf0e1);}})['then'](function(_0x3e63bb){if(_0x3e63bb){return _0x3e63bb?{'count':_0x219cfb,'rows':_0x3e63bb}:null;}})[_0xfac9('0x21')](respondWithResult(_0xf383c0,null))[_0xfac9('0x43')](handleError(_0xf383c0,null));};exports['addConfiguration']=function(_0x365e87,_0x5319d5,_0x43c988){if(_0x365e87[_0xfac9('0x45')]['id']){delete _0x365e87[_0xfac9('0x45')]['id'];}return db[_0xfac9('0x28')][_0xfac9('0x49')]({'where':{'id':_0x365e87[_0xfac9('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5319d5,null))['then'](function(_0x22582e){if(_0x22582e){_0x365e87[_0xfac9('0x45')]['AccountId']=_0x22582e['id'];_0x365e87['body'][_0xfac9('0x4a')]=integrations[_0xfac9('0x4b')](_0x365e87['body'][_0xfac9('0x4c')],_0x365e87[_0xfac9('0x45')][_0xfac9('0x29')]);_0x365e87[_0xfac9('0x45')][_0xfac9('0x4d')]=integrations[_0xfac9('0x4e')](_0x365e87[_0xfac9('0x45')][_0xfac9('0x4c')],_0x365e87[_0xfac9('0x45')][_0xfac9('0x29')]);return db[_0xfac9('0x4f')]['create'](_0x365e87[_0xfac9('0x45')],{'include':[{'model':db['FreshsalesField'],'as':'Subjects'},{'model':db['FreshsalesField'],'as':_0xfac9('0x4d')}]});}return null;})[_0xfac9('0x21')](respondWithResult(_0x5319d5,null))[_0xfac9('0x43')](handleError(_0x5319d5,null));};exports['getFields']=function(_0x1b7358,_0x45c554,_0x1305f0){var _0x533d9a='';var _0x46953d='';return db[_0xfac9('0x28')][_0xfac9('0x49')]({'where':{'id':_0x1b7358['params']['id']},'attributes':['id','username','remoteUri','apiKey']})[_0xfac9('0x21')](handleEntityNotFound(_0x45c554,null))[_0xfac9('0x21')](function(_0x4f6b0d){if(_0x4f6b0d){_0x46953d=_0x4f6b0d['username'];_0x533d9a=_0x4f6b0d[_0xfac9('0x50')];var _0x573fc9=_0x4f6b0d[_0xfac9('0x50')][_0xfac9('0x51')](-0x1);if(_0x573fc9==='/'){_0x533d9a=_0x533d9a[_0xfac9('0x52')](0x0,_0x533d9a[_0xfac9('0x53')](_0x573fc9));}return rp({'method':_0xfac9('0x54'),'uri':util['format']('%s%s',_0x533d9a,'/api/selector/owners'),'headers':{'Authorization':_0xfac9('0x55')+_0x4f6b0d[_0xfac9('0x56')]},'json':!![]});}})[_0xfac9('0x21')](function(_0x1dcb58){if(_0x1dcb58){var _0x2fce52=_0x1dcb58[_0xfac9('0x57')];var _0x49dd8c=![];var _0x455a76=null;for(_0x455a76=0x0;_0x455a76<_0x2fce52[_0xfac9('0x32')];_0x455a76++){if(_0x2fce52[_0x455a76][_0xfac9('0x58')]===_0x46953d){_0x49dd8c=!![];}}if(_0x49dd8c){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x45c554,null))[_0xfac9('0x43')](function(_0x51fef0){var _0x3fec91=_0x1b7358[_0xfac9('0x2c')][_0xfac9('0x59')]?0x1f4:_0x51fef0['statusCode']||0x1f4;logger[_0xfac9('0x5a')](_0xfac9('0x5b'),_0xfac9('0x5c'),_0x3fec91,JSON[_0xfac9('0x5d')](_0x51fef0));delete _0x51fef0['name'];if(_0x3fec91===0x191){_0x3fec91=0x190;}_0x45c554[_0xfac9('0x16')](_0x3fec91)[_0xfac9('0x26')](_0x1b7358[_0xfac9('0x2c')][_0xfac9('0x59')]?{'message':_0xfac9('0x5e'),'statusCode':_0x51fef0[_0xfac9('0x5f')]}:_0x51fef0);});}; \ No newline at end of file +var _0x9c55=['bluebird','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','FreshsalesAccount','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','FreshsalesConfiguration','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshsalesField','getFields','username','apiKey','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x5c7544,_0x2abd3d){var _0x550226=function(_0x3bf17a){while(--_0x3bf17a){_0x5c7544['push'](_0x5c7544['shift']());}};_0x550226(++_0x2abd3d);}(_0x9c55,0x130));var _0x59c5=function(_0x4f34d8,_0x40f022){_0x4f34d8=_0x4f34d8-0x0;var _0xc97536=_0x9c55[_0x4f34d8];return _0xc97536;};'use strict';var emlformat=require(_0x59c5('0x0'));var rimraf=require(_0x59c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x59c5('0x2'));var rp=require(_0x59c5('0x3'));var moment=require(_0x59c5('0x4'));var BPromise=require(_0x59c5('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x59c5('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x59c5('0x7'));var fs=require('fs');var fs_extra=require(_0x59c5('0x8'));var _=require(_0x59c5('0x9'));var squel=require(_0x59c5('0xa'));var crypto=require(_0x59c5('0xb'));var jsforce=require(_0x59c5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x59c5('0xd'));var querystring=require('querystring');var Papa=require(_0x59c5('0xe'));var Redis=require(_0x59c5('0xf'));var authService=require(_0x59c5('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x59c5('0x11'));var logger=require('../../config/logger')(_0x59c5('0x12'));var utils=require(_0x59c5('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x59c5('0x14'))['db'];var integrations=require(_0x59c5('0x15'));function respondWithStatusCode(_0x4ed694,_0x22da7a){_0x22da7a=_0x22da7a||0xcc;return function(_0x16d4fd){if(_0x16d4fd){return _0x4ed694['sendStatus'](_0x22da7a);}return _0x4ed694[_0x59c5('0x16')](_0x22da7a)['end']();};}function respondWithResult(_0x6690c4,_0x908c83){_0x908c83=_0x908c83||0xc8;return function(_0x20d20a){if(_0x20d20a){return _0x6690c4[_0x59c5('0x16')](_0x908c83)[_0x59c5('0x17')](_0x20d20a);}};}function respondWithFilteredResult(_0x517792,_0x15a94e){return function(_0x49ae78){if(_0x49ae78){var _0x5c27b8=typeof _0x15a94e[_0x59c5('0x18')]==='undefined'&&typeof _0x15a94e['limit']===_0x59c5('0x19');var _0x4e7067=_0x49ae78[_0x59c5('0x1a')];var _0x20a617=_0x5c27b8?0x0:_0x15a94e[_0x59c5('0x18')];var _0x4f9897=_0x5c27b8?_0x49ae78[_0x59c5('0x1a')]:_0x15a94e[_0x59c5('0x18')]+_0x15a94e[_0x59c5('0x1b')];var _0x53ef7e;if(_0x4f9897>=_0x4e7067){_0x4f9897=_0x4e7067;_0x53ef7e=0xc8;}else{_0x53ef7e=0xce;}_0x517792[_0x59c5('0x16')](_0x53ef7e);return _0x517792[_0x59c5('0x1c')](_0x59c5('0x1d'),_0x20a617+'-'+_0x4f9897+'/'+_0x4e7067)[_0x59c5('0x17')](_0x49ae78);}return null;};}function patchUpdates(_0xe82fdc){return function(_0x3b5331){try{jsonpatch[_0x59c5('0x1e')](_0x3b5331,_0xe82fdc,!![]);}catch(_0x5cf20b){return BPromise[_0x59c5('0x1f')](_0x5cf20b);}return _0x3b5331[_0x59c5('0x20')]();};}function saveUpdates(_0x15f0cf,_0x2df3a9){return function(_0x1205c3){if(_0x1205c3){return _0x1205c3['update'](_0x15f0cf)[_0x59c5('0x21')](function(_0x4c5b2a){return _0x4c5b2a;});}return null;};}function removeEntity(_0x135e74,_0x1e82ab){return function(_0x5c9e83){if(_0x5c9e83){return _0x5c9e83[_0x59c5('0x22')]()[_0x59c5('0x21')](function(){_0x135e74[_0x59c5('0x16')](0xcc)[_0x59c5('0x23')]();});}};}function handleEntityNotFound(_0x247545,_0x191704){return function(_0x1ca3b7){if(!_0x1ca3b7){_0x247545[_0x59c5('0x24')](0x194);}return _0x1ca3b7;};}function handleError(_0x22e335,_0xcee941){_0xcee941=_0xcee941||0x1f4;return function(_0x77140f){logger[_0x59c5('0x25')](_0x77140f[_0x59c5('0x26')]);if(_0x77140f[_0x59c5('0x27')]){delete _0x77140f[_0x59c5('0x27')];}_0x22e335['status'](_0xcee941)['send'](_0x77140f);};}exports['index']=function(_0x11f057,_0x4a12f2){var _0x1802b9={},_0x5a34a4={},_0x1748fe={'count':0x0,'rows':[]};var _0x5d1205=_['map'](db[_0x59c5('0x28')][_0x59c5('0x29')],function(_0x1957c0){return{'name':_0x1957c0[_0x59c5('0x2a')],'type':_0x1957c0[_0x59c5('0x2b')][_0x59c5('0x2c')]};});_0x5a34a4['model']=_[_0x59c5('0x2d')](_0x5d1205,_0x59c5('0x27'));_0x5a34a4[_0x59c5('0x2e')]=_[_0x59c5('0x2f')](_0x11f057[_0x59c5('0x2e')]);_0x5a34a4[_0x59c5('0x30')]=_['intersection'](_0x5a34a4[_0x59c5('0x31')],_0x5a34a4[_0x59c5('0x2e')]);_0x1802b9[_0x59c5('0x32')]=_[_0x59c5('0x33')](_0x5a34a4[_0x59c5('0x31')],qs[_0x59c5('0x34')](_0x11f057[_0x59c5('0x2e')][_0x59c5('0x34')]));_0x1802b9[_0x59c5('0x32')]=_0x1802b9[_0x59c5('0x32')]['length']?_0x1802b9[_0x59c5('0x32')]:_0x5a34a4[_0x59c5('0x31')];if(!_0x11f057[_0x59c5('0x2e')][_0x59c5('0x35')](_0x59c5('0x36'))){_0x1802b9['limit']=qs[_0x59c5('0x1b')](_0x11f057[_0x59c5('0x2e')]['limit']);_0x1802b9['offset']=qs['offset'](_0x11f057[_0x59c5('0x2e')][_0x59c5('0x18')]);}_0x1802b9[_0x59c5('0x37')]=qs[_0x59c5('0x38')](_0x11f057[_0x59c5('0x2e')]['sort']);_0x1802b9[_0x59c5('0x39')]=qs[_0x59c5('0x30')](_[_0x59c5('0x3a')](_0x11f057['query'],_0x5a34a4[_0x59c5('0x30')]),_0x5d1205);if(_0x11f057[_0x59c5('0x2e')][_0x59c5('0x3b')]){_0x1802b9[_0x59c5('0x39')]=_[_0x59c5('0x3c')](_0x1802b9[_0x59c5('0x39')],{'$or':_['map'](_0x5d1205,function(_0x1f0f14){if(_0x1f0f14[_0x59c5('0x2b')]!==_0x59c5('0x3d')){var _0x4a39ad={};_0x4a39ad[_0x1f0f14[_0x59c5('0x27')]]={'$like':'%'+_0x11f057['query'][_0x59c5('0x3b')]+'%'};return _0x4a39ad;}})});}_0x1802b9=_['merge']({},_0x1802b9,_0x11f057[_0x59c5('0x3e')]);var _0x286476={'where':_0x1802b9[_0x59c5('0x39')]};return db['FreshsalesAccount'][_0x59c5('0x1a')](_0x286476)[_0x59c5('0x21')](function(_0x189468){_0x1748fe[_0x59c5('0x1a')]=_0x189468;if(_0x11f057[_0x59c5('0x2e')][_0x59c5('0x3f')]){_0x1802b9[_0x59c5('0x40')]=[{'all':!![]}];}return db[_0x59c5('0x28')][_0x59c5('0x41')](_0x1802b9);})[_0x59c5('0x21')](function(_0x208986){_0x1748fe[_0x59c5('0x42')]=_0x208986;return _0x1748fe;})[_0x59c5('0x21')](respondWithFilteredResult(_0x4a12f2,_0x1802b9))[_0x59c5('0x43')](handleError(_0x4a12f2,null));};exports[_0x59c5('0x44')]=function(_0x54ff7d,_0x452606){var _0x1f2cb7={'raw':![],'where':{'id':_0x54ff7d[_0x59c5('0x45')]['id']}},_0x11779e={};_0x11779e[_0x59c5('0x31')]=_[_0x59c5('0x2f')](db['FreshsalesAccount']['rawAttributes']);_0x11779e[_0x59c5('0x2e')]=_[_0x59c5('0x2f')](_0x54ff7d[_0x59c5('0x2e')]);_0x11779e[_0x59c5('0x30')]=_[_0x59c5('0x33')](_0x11779e[_0x59c5('0x31')],_0x11779e[_0x59c5('0x2e')]);_0x1f2cb7[_0x59c5('0x32')]=_[_0x59c5('0x33')](_0x11779e[_0x59c5('0x31')],qs['fields'](_0x54ff7d['query'][_0x59c5('0x34')]));_0x1f2cb7[_0x59c5('0x32')]=_0x1f2cb7['attributes'][_0x59c5('0x46')]?_0x1f2cb7[_0x59c5('0x32')]:_0x11779e[_0x59c5('0x31')];if(_0x54ff7d['query'][_0x59c5('0x3f')]){_0x1f2cb7[_0x59c5('0x40')]=[{'all':!![]}];}_0x1f2cb7=_[_0x59c5('0x3c')]({},_0x1f2cb7,_0x54ff7d[_0x59c5('0x3e')]);return db[_0x59c5('0x28')][_0x59c5('0x47')](_0x1f2cb7)[_0x59c5('0x21')](handleEntityNotFound(_0x452606,null))[_0x59c5('0x21')](respondWithResult(_0x452606,null))[_0x59c5('0x43')](handleError(_0x452606,null));};exports[_0x59c5('0x48')]=function(_0xe06a31,_0x50b13b){return db['FreshsalesAccount'][_0x59c5('0x48')](_0xe06a31[_0x59c5('0x49')],{})[_0x59c5('0x21')](respondWithResult(_0x50b13b,0xc9))['catch'](handleError(_0x50b13b,null));};exports[_0x59c5('0x4a')]=function(_0x576762,_0x4b2dc1){if(_0x576762['body']['id']){delete _0x576762[_0x59c5('0x49')]['id'];}return db['FreshsalesAccount'][_0x59c5('0x47')]({'where':{'id':_0x576762[_0x59c5('0x45')]['id']}})[_0x59c5('0x21')](handleEntityNotFound(_0x4b2dc1,null))[_0x59c5('0x21')](saveUpdates(_0x576762[_0x59c5('0x49')],null))[_0x59c5('0x21')](respondWithResult(_0x4b2dc1,null))['catch'](handleError(_0x4b2dc1,null));};exports['destroy']=function(_0x15a7c0,_0x3b73e3){return db[_0x59c5('0x28')][_0x59c5('0x47')]({'where':{'id':_0x15a7c0['params']['id']}})[_0x59c5('0x21')](handleEntityNotFound(_0x3b73e3,null))['then'](removeEntity(_0x3b73e3,null))['catch'](handleError(_0x3b73e3,null));};exports['getConfigurations']=function(_0x2a7b82,_0xe9bbe,_0x418fb0){var _0x2ed53a={};var _0x4086fc={};var _0x247b8b;var _0x310c24;return db['FreshsalesAccount']['findOne']({'where':{'id':_0x2a7b82['params']['id']}})[_0x59c5('0x21')](handleEntityNotFound(_0xe9bbe,null))[_0x59c5('0x21')](function(_0x133b95){if(_0x133b95){_0x247b8b=_0x133b95;_0x4086fc[_0x59c5('0x31')]=_[_0x59c5('0x2f')](db[_0x59c5('0x4b')][_0x59c5('0x29')]);_0x4086fc['query']=_[_0x59c5('0x2f')](_0x2a7b82[_0x59c5('0x2e')]);_0x4086fc['filters']=_['intersection'](_0x4086fc[_0x59c5('0x31')],_0x4086fc[_0x59c5('0x2e')]);_0x2ed53a[_0x59c5('0x32')]=_[_0x59c5('0x33')](_0x4086fc['model'],qs['fields'](_0x2a7b82['query']['fields']));_0x2ed53a['attributes']=_0x2ed53a[_0x59c5('0x32')]['length']?_0x2ed53a[_0x59c5('0x32')]:_0x4086fc[_0x59c5('0x31')];_0x2ed53a[_0x59c5('0x37')]=qs[_0x59c5('0x38')](_0x2a7b82[_0x59c5('0x2e')]['sort']);_0x2ed53a[_0x59c5('0x39')]=qs[_0x59c5('0x30')](_[_0x59c5('0x3a')](_0x2a7b82[_0x59c5('0x2e')],_0x4086fc[_0x59c5('0x30')]));if(_0x2a7b82[_0x59c5('0x2e')][_0x59c5('0x3b')]){_0x2ed53a['where']=_[_0x59c5('0x3c')](_0x2ed53a['where'],{'$or':_['map'](_0x2ed53a[_0x59c5('0x32')],function(_0x1450c8){var _0x3e6fa0={};_0x3e6fa0[_0x1450c8]={'$like':'%'+_0x2a7b82['query']['filter']+'%'};return _0x3e6fa0;})});}_0x2ed53a=_['merge']({},_0x2ed53a,_0x2a7b82['options']);return _0x247b8b[_0x59c5('0x4c')](_0x2ed53a);}})[_0x59c5('0x21')](function(_0x153844){if(_0x153844){_0x310c24=_0x153844[_0x59c5('0x46')];if(!_0x2a7b82['query'][_0x59c5('0x35')](_0x59c5('0x36'))){_0x2ed53a[_0x59c5('0x1b')]=qs[_0x59c5('0x1b')](_0x2a7b82[_0x59c5('0x2e')]['limit']);_0x2ed53a['offset']=qs[_0x59c5('0x18')](_0x2a7b82[_0x59c5('0x2e')][_0x59c5('0x18')]);}return _0x247b8b[_0x59c5('0x4c')](_0x2ed53a);}})['then'](function(_0x3c7b35){if(_0x3c7b35){return _0x3c7b35?{'count':_0x310c24,'rows':_0x3c7b35}:null;}})['then'](respondWithResult(_0xe9bbe,null))[_0x59c5('0x43')](handleError(_0xe9bbe,null));};exports[_0x59c5('0x4d')]=function(_0x227865,_0x554283,_0x52c5c6){if(_0x227865[_0x59c5('0x49')]['id']){delete _0x227865[_0x59c5('0x49')]['id'];}return db[_0x59c5('0x28')][_0x59c5('0x4e')]({'where':{'id':_0x227865[_0x59c5('0x45')]['id']}})['then'](handleEntityNotFound(_0x554283,null))['then'](function(_0x443284){if(_0x443284){_0x227865['body'][_0x59c5('0x4f')]=_0x443284['id'];_0x227865['body'][_0x59c5('0x50')]=integrations[_0x59c5('0x51')](_0x227865[_0x59c5('0x49')]['channel'],_0x227865[_0x59c5('0x49')][_0x59c5('0x2b')]);_0x227865['body'][_0x59c5('0x52')]=integrations[_0x59c5('0x53')](_0x227865['body'][_0x59c5('0x54')],_0x227865[_0x59c5('0x49')][_0x59c5('0x2b')]);return db[_0x59c5('0x4b')][_0x59c5('0x48')](_0x227865['body'],{'include':[{'model':db[_0x59c5('0x55')],'as':_0x59c5('0x50')},{'model':db[_0x59c5('0x55')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x554283,null))[_0x59c5('0x43')](handleError(_0x554283,null));};exports[_0x59c5('0x56')]=function(_0x2fc4f1,_0x237a12,_0x51baba){var _0x121389='';var _0x2c017e='';return db['FreshsalesAccount']['findOne']({'where':{'id':_0x2fc4f1[_0x59c5('0x45')]['id']},'attributes':['id',_0x59c5('0x57'),'remoteUri',_0x59c5('0x58')]})[_0x59c5('0x21')](handleEntityNotFound(_0x237a12,null))[_0x59c5('0x21')](function(_0x33eb33){if(_0x33eb33){_0x2c017e=_0x33eb33['username'];_0x121389=_0x33eb33['remoteUri'];var _0x1281de=_0x33eb33[_0x59c5('0x59')][_0x59c5('0x5a')](-0x1);if(_0x1281de==='/'){_0x121389=_0x121389[_0x59c5('0x5b')](0x0,_0x121389[_0x59c5('0x5c')](_0x1281de));}return rp({'method':_0x59c5('0x5d'),'uri':util[_0x59c5('0x5e')](_0x59c5('0x5f'),_0x121389,_0x59c5('0x60')),'headers':{'Authorization':_0x59c5('0x61')+_0x33eb33[_0x59c5('0x58')]},'json':!![]});}})[_0x59c5('0x21')](function(_0x664743){if(_0x664743){var _0x195d04=_0x664743['users'];var _0x58edc8=![];var _0x50a308=null;for(_0x50a308=0x0;_0x50a308<_0x195d04[_0x59c5('0x46')];_0x50a308++){if(_0x195d04[_0x50a308]['email']===_0x2c017e){_0x58edc8=!![];}}if(_0x58edc8){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x59c5('0x62')});}}})[_0x59c5('0x21')](respondWithResult(_0x237a12,null))[_0x59c5('0x43')](function(_0x30cd64){var _0x3746ef=_0x2fc4f1[_0x59c5('0x2e')]['test']?0x1f4:_0x30cd64[_0x59c5('0x63')]||0x1f4;logger[_0x59c5('0x25')](_0x59c5('0x64'),'getFields',_0x3746ef,JSON['stringify'](_0x30cd64));delete _0x30cd64[_0x59c5('0x27')];if(_0x3746ef===0x191){_0x3746ef=0x190;}_0x237a12[_0x59c5('0x16')](_0x3746ef)[_0x59c5('0x65')](_0x2fc4f1[_0x59c5('0x2e')]['test']?{'message':_0x59c5('0x66'),'statusCode':_0x30cd64[_0x59c5('0x63')]}:_0x30cd64);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index b6d4bcc..7d5e188 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 _0x77d4=['../../components/integrations/configuration','exports','int_freshsales_accounts','util','api','bluebird','request-promise','../../config/environment','./intFreshsalesAccount.attributes'];(function(_0x1a6cfb,_0x4971e6){var _0xc8cefb=function(_0x2a583f){while(--_0x2a583f){_0x1a6cfb['push'](_0x1a6cfb['shift']());}};_0xc8cefb(++_0x4971e6);}(_0x77d4,0x108));var _0x477d=function(_0x478e2f,_0xcc2041){_0x478e2f=_0x478e2f-0x0;var _0x4b088d=_0x77d4[_0x478e2f];return _0x4b088d;};'use strict';var _=require('lodash');var util=require(_0x477d('0x0'));var logger=require('../../config/logger')(_0x477d('0x1'));var moment=require('moment');var BPromise=require(_0x477d('0x2'));var rp=require(_0x477d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x477d('0x4'));var attributes=require(_0x477d('0x5'));var integrations=require(_0x477d('0x6'));module[_0x477d('0x7')]=function(_0x2545e5,_0x45ca2d){return _0x2545e5['define']('FreshsalesAccount',attributes,{'tableName':_0x477d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','lodash','util','../../config/logger','api','moment'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xc4aa[_0x45d55e];return _0x29812a;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));var integrations=require(_0xac4a('0x8'));module[_0xac4a('0x9')]=function(_0x96be2b,_0x15cd34){return _0x96be2b[_0xac4a('0xa')](_0xac4a('0xb'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index e810982..38899ff 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 _0x5fab=['map','model','info','ShowFreshsalesAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesAccount,\x20%s,\x20%s','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','include','attributes'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x5fab,0x177));var _0xb5fa=function(_0x5f0864,_0x413e01){_0x5f0864=_0x5f0864-0x0;var _0x5700dc=_0x5fab[_0x5f0864];return _0x5700dc;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});}exports[_0xb5fa('0x18')]=function(_0x32e9e5){var _0x46eef0=this;return new Promise(function(_0x324ba5,_0x13e82b){return db[_0xb5fa('0x19')][_0xb5fa('0x1a')]({'raw':_0x32e9e5[_0xb5fa('0x1b')]?_0x32e9e5[_0xb5fa('0x1b')][_0xb5fa('0x1c')]===undefined?!![]:![]:!![],'where':_0x32e9e5[_0xb5fa('0x1b')]?_0x32e9e5['options'][_0xb5fa('0x1d')]||null:null,'attributes':_0x32e9e5['options']?_0x32e9e5[_0xb5fa('0x1b')]['attributes']||null:null,'limit':_0x32e9e5[_0xb5fa('0x1b')]?_0x32e9e5[_0xb5fa('0x1b')]['limit']||null:null,'include':_0x32e9e5[_0xb5fa('0x1b')]?_0x32e9e5[_0xb5fa('0x1b')][_0xb5fa('0x1e')]?_['map'](_0x32e9e5[_0xb5fa('0x1b')][_0xb5fa('0x1e')],function(_0x444237){return{'model':db[_0x444237['model']],'as':_0x444237['as'],'attributes':_0x444237[_0xb5fa('0x1f')],'include':_0x444237['include']?_[_0xb5fa('0x20')](_0x444237[_0xb5fa('0x1e')],function(_0x11053a){return{'model':db[_0x11053a[_0xb5fa('0x21')]],'as':_0x11053a['as'],'attributes':_0x11053a[_0xb5fa('0x1f')],'include':_0x11053a[_0xb5fa('0x1e')]?_[_0xb5fa('0x20')](_0x11053a[_0xb5fa('0x1e')],function(_0x568870){return{'model':db[_0x568870['model']],'as':_0x568870['as'],'attributes':_0x568870['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x28a350){logger[_0xb5fa('0x22')](_0xb5fa('0x18'),_0x32e9e5);logger[_0xb5fa('0xf')](_0xb5fa('0x18'),_0x32e9e5,JSON[_0xb5fa('0x11')](_0x28a350));_0x324ba5(_0x28a350);})[_0xb5fa('0x17')](function(_0x353314){logger[_0xb5fa('0x12')](_0xb5fa('0x18'),_0x353314[_0xb5fa('0x14')],_0x32e9e5);_0x13e82b(_0x46eef0[_0xb5fa('0x12')](0x1f4,_0x353314[_0xb5fa('0x14')]));});});};exports[_0xb5fa('0x23')]=function(_0xed02e){var _0x116773=this;return new Promise(function(_0x5a0152,_0x3fd1fb){return db[_0xb5fa('0x19')][_0xb5fa('0x24')]({'raw':_0xed02e[_0xb5fa('0x1b')]?_0xed02e[_0xb5fa('0x1b')][_0xb5fa('0x1c')]===undefined?!![]:![]:!![],'where':_0xed02e[_0xb5fa('0x1b')]?_0xed02e['options'][_0xb5fa('0x1d')]||null:null,'attributes':_0xed02e['options']?_0xed02e['options']['attributes']||null:null,'include':_0xed02e[_0xb5fa('0x1b')]?_0xed02e['options'][_0xb5fa('0x1e')]?_['map'](_0xed02e['options'][_0xb5fa('0x1e')],function(_0x934b49){return{'model':db[_0x934b49['model']],'as':_0x934b49['as'],'attributes':_0x934b49['attributes'],'include':_0x934b49[_0xb5fa('0x1e')]?_[_0xb5fa('0x20')](_0x934b49[_0xb5fa('0x1e')],function(_0x560b53){return{'model':db[_0x560b53[_0xb5fa('0x21')]],'as':_0x560b53['as'],'attributes':_0x560b53[_0xb5fa('0x1f')],'include':_0x560b53['include']?_[_0xb5fa('0x20')](_0x560b53[_0xb5fa('0x1e')],function(_0x204d6b){return{'model':db[_0x204d6b['model']],'as':_0x204d6b['as'],'attributes':_0x204d6b[_0xb5fa('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb5fa('0xd')](function(_0x24ef11){logger['info'](_0xb5fa('0x23'),_0xed02e);logger[_0xb5fa('0xf')](_0xb5fa('0x23'),_0xed02e,JSON[_0xb5fa('0x11')](_0x24ef11));_0x5a0152(_0x24ef11);})['catch'](function(_0x4bba91){logger['error']('ShowFreshsalesAccount',_0x4bba91['message'],_0xed02e);_0x3fd1fb(_0x116773['error'](0x1f4,_0x4bba91[_0xb5fa('0x14')]));});});}; \ No newline at end of file +var _0x6455=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','findAll','raw','options','attributes','limit','include','map','model','GetFreshsalesAccount','debug','catch','FreshsalesAccount','find','where','ShowFreshsalesAccount','lodash'];(function(_0x17f9e8,_0x1e4f9f){var _0xafa2e0=function(_0x17e1b9){while(--_0x17e1b9){_0x17f9e8['push'](_0x17f9e8['shift']());}};_0xafa2e0(++_0x1e4f9f);}(_0x6455,0x97));var _0x5645=function(_0x1f3fba,_0x4f2401){_0x1f3fba=_0x1f3fba-0x0;var _0x37a740=_0x6455[_0x1f3fba];return _0x37a740;};'use strict';var _=require(_0x5645('0x0'));var util=require('util');var moment=require(_0x5645('0x1'));var BPromise=require(_0x5645('0x2'));var rs=require(_0x5645('0x3'));var fs=require('fs');var Redis=require(_0x5645('0x4'));var db=require(_0x5645('0x5'))['db'];var utils=require(_0x5645('0x6'));var logger=require('../../config/logger')(_0x5645('0x7'));var config=require(_0x5645('0x8'));var jayson=require(_0x5645('0x9'));var client=jayson[_0x5645('0xa')][_0x5645('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37d672,_0xa14a06,_0x278d86){return new BPromise(function(_0x518a28,_0x5f4037){return client[_0x5645('0xc')](_0x37d672,_0x278d86)[_0x5645('0xd')](function(_0x38c07a){logger[_0x5645('0xe')](_0x5645('0xf'),_0xa14a06,_0x5645('0x10'));logger['debug'](_0x5645('0x11'),_0xa14a06,_0x5645('0x10'),JSON[_0x5645('0x12')](_0x38c07a));if(_0x38c07a[_0x5645('0x13')]){if(_0x38c07a['error'][_0x5645('0x14')]===0x1f4){logger['error'](_0x5645('0xf'),_0xa14a06,_0x38c07a[_0x5645('0x13')][_0x5645('0x15')]);return _0x5f4037(_0x38c07a[_0x5645('0x13')][_0x5645('0x15')]);}logger[_0x5645('0x13')](_0x5645('0xf'),_0xa14a06,_0x38c07a[_0x5645('0x13')]['message']);return _0x518a28(_0x38c07a[_0x5645('0x13')][_0x5645('0x15')]);}else{logger[_0x5645('0xe')]('FreshsalesAccount,\x20%s,\x20%s',_0xa14a06,'request\x20sent');_0x518a28(_0x38c07a[_0x5645('0x16')][_0x5645('0x15')]);}})['catch'](function(_0x35e0c7){logger[_0x5645('0x13')](_0x5645('0xf'),_0xa14a06,_0x35e0c7);_0x5f4037(_0x35e0c7);});});}exports['GetFreshsalesAccount']=function(_0x35bc6f){var _0x1d519d=this;return new Promise(function(_0x22a6cf,_0x102c19){return db['FreshsalesAccount'][_0x5645('0x17')]({'raw':_0x35bc6f['options']?_0x35bc6f['options'][_0x5645('0x18')]===undefined?!![]:![]:!![],'where':_0x35bc6f[_0x5645('0x19')]?_0x35bc6f[_0x5645('0x19')]['where']||null:null,'attributes':_0x35bc6f[_0x5645('0x19')]?_0x35bc6f['options'][_0x5645('0x1a')]||null:null,'limit':_0x35bc6f['options']?_0x35bc6f['options'][_0x5645('0x1b')]||null:null,'include':_0x35bc6f['options']?_0x35bc6f[_0x5645('0x19')][_0x5645('0x1c')]?_['map'](_0x35bc6f[_0x5645('0x19')][_0x5645('0x1c')],function(_0xe83ed7){return{'model':db[_0xe83ed7['model']],'as':_0xe83ed7['as'],'attributes':_0xe83ed7[_0x5645('0x1a')],'include':_0xe83ed7[_0x5645('0x1c')]?_[_0x5645('0x1d')](_0xe83ed7[_0x5645('0x1c')],function(_0x568fd6){return{'model':db[_0x568fd6['model']],'as':_0x568fd6['as'],'attributes':_0x568fd6['attributes'],'include':_0x568fd6['include']?_[_0x5645('0x1d')](_0x568fd6['include'],function(_0x47d097){return{'model':db[_0x47d097[_0x5645('0x1e')]],'as':_0x47d097['as'],'attributes':_0x47d097[_0x5645('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5645('0xd')](function(_0x308991){logger[_0x5645('0xe')](_0x5645('0x1f'),_0x35bc6f);logger[_0x5645('0x20')](_0x5645('0x1f'),_0x35bc6f,JSON[_0x5645('0x12')](_0x308991));_0x22a6cf(_0x308991);})[_0x5645('0x21')](function(_0x1c0aa2){logger[_0x5645('0x13')](_0x5645('0x1f'),_0x1c0aa2[_0x5645('0x15')],_0x35bc6f);_0x102c19(_0x1d519d['error'](0x1f4,_0x1c0aa2[_0x5645('0x15')]));});});};exports['ShowFreshsalesAccount']=function(_0x12aea2){var _0x31c31b=this;return new Promise(function(_0x40f716,_0x43d514){return db[_0x5645('0x22')][_0x5645('0x23')]({'raw':_0x12aea2['options']?_0x12aea2['options'][_0x5645('0x18')]===undefined?!![]:![]:!![],'where':_0x12aea2[_0x5645('0x19')]?_0x12aea2[_0x5645('0x19')][_0x5645('0x24')]||null:null,'attributes':_0x12aea2[_0x5645('0x19')]?_0x12aea2[_0x5645('0x19')][_0x5645('0x1a')]||null:null,'include':_0x12aea2[_0x5645('0x19')]?_0x12aea2[_0x5645('0x19')][_0x5645('0x1c')]?_[_0x5645('0x1d')](_0x12aea2['options']['include'],function(_0xe01db0){return{'model':db[_0xe01db0['model']],'as':_0xe01db0['as'],'attributes':_0xe01db0[_0x5645('0x1a')],'include':_0xe01db0['include']?_[_0x5645('0x1d')](_0xe01db0['include'],function(_0x2e3dfb){return{'model':db[_0x2e3dfb[_0x5645('0x1e')]],'as':_0x2e3dfb['as'],'attributes':_0x2e3dfb[_0x5645('0x1a')],'include':_0x2e3dfb[_0x5645('0x1c')]?_[_0x5645('0x1d')](_0x2e3dfb[_0x5645('0x1c')],function(_0x57fe61){return{'model':db[_0x57fe61[_0x5645('0x1e')]],'as':_0x57fe61['as'],'attributes':_0x57fe61[_0x5645('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5645('0xd')](function(_0x1f6c2f){logger[_0x5645('0xe')](_0x5645('0x25'),_0x12aea2);logger[_0x5645('0x20')](_0x5645('0x25'),_0x12aea2,JSON['stringify'](_0x1f6c2f));_0x40f716(_0x1f6c2f);})[_0x5645('0x21')](function(_0x48844f){logger[_0x5645('0x13')](_0x5645('0x25'),_0x48844f[_0x5645('0x15')],_0x12aea2);_0x43d514(_0x31c31b[_0x5645('0x13')](0x1f4,_0x48844f[_0x5645('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 911f94c..d207c27 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 _0xaf60=['getFields','post','put','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','/:id','show','/:id/subjects','getSubjects'];(function(_0x4af563,_0x2b2308){var _0x7deac1=function(_0x20deca){while(--_0x20deca){_0x4af563['push'](_0x4af563['shift']());}};_0x7deac1(++_0x2b2308);}(_0xaf60,0xc2));var _0x0af6=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xaf60[_0xd1d19a];return _0x52a79d;};'use strict';var multer=require(_0x0af6('0x0'));var util=require(_0x0af6('0x1'));var path=require('path');var timeout=require(_0x0af6('0x2'));var express=require(_0x0af6('0x3'));var router=express[_0x0af6('0x4')]();var fs_extra=require(_0x0af6('0x5'));var auth=require(_0x0af6('0x6'));var interaction=require(_0x0af6('0x7'));var config=require(_0x0af6('0x8'));var controller=require(_0x0af6('0x9'));router[_0x0af6('0xa')]('/',auth[_0x0af6('0xb')](),controller['index']);router['get'](_0x0af6('0xc'),auth[_0x0af6('0xb')](),controller[_0x0af6('0xd')]);router[_0x0af6('0xa')](_0x0af6('0xe'),auth[_0x0af6('0xb')](),controller[_0x0af6('0xf')]);router[_0x0af6('0xa')]('/:id/descriptions',auth[_0x0af6('0xb')](),controller['getDescriptions']);router[_0x0af6('0xa')]('/:id/fields',auth[_0x0af6('0xb')](),controller[_0x0af6('0x10')]);router[_0x0af6('0x11')]('/',auth[_0x0af6('0xb')](),controller['create']);router[_0x0af6('0x12')](_0x0af6('0xc'),auth[_0x0af6('0xb')](),controller[_0x0af6('0x13')]);router['delete']('/:id',auth[_0x0af6('0xb')](),controller['destroy']);module[_0x0af6('0x14')]=router; \ No newline at end of file +var _0x3214=['show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated'];(function(_0x251332,_0x2d61df){var _0x50a8b6=function(_0x5481ce){while(--_0x5481ce){_0x251332['push'](_0x251332['shift']());}};_0x50a8b6(++_0x2d61df);}(_0x3214,0x113));var _0x4321=function(_0xa8d84f,_0x512e08){_0xa8d84f=_0xa8d84f-0x0;var _0x220939=_0x3214[_0xa8d84f];return _0x220939;};'use strict';var multer=require(_0x4321('0x0'));var util=require(_0x4321('0x1'));var path=require('path');var timeout=require(_0x4321('0x2'));var express=require('express');var router=express[_0x4321('0x3')]();var fs_extra=require(_0x4321('0x4'));var auth=require(_0x4321('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4321('0x6'));var controller=require('./intFreshsalesConfiguration.controller');router[_0x4321('0x7')]('/',auth['isAuthenticated'](),controller[_0x4321('0x8')]);router[_0x4321('0x7')](_0x4321('0x9'),auth[_0x4321('0xa')](),controller[_0x4321('0xb')]);router[_0x4321('0x7')](_0x4321('0xc'),auth[_0x4321('0xa')](),controller[_0x4321('0xd')]);router[_0x4321('0x7')](_0x4321('0xe'),auth[_0x4321('0xa')](),controller[_0x4321('0xf')]);router['get'](_0x4321('0x10'),auth[_0x4321('0xa')](),controller[_0x4321('0x11')]);router[_0x4321('0x12')]('/',auth[_0x4321('0xa')](),controller[_0x4321('0x13')]);router[_0x4321('0x14')](_0x4321('0x9'),auth[_0x4321('0xa')](),controller['update']);router['delete'](_0x4321('0x9'),auth[_0x4321('0xa')](),controller['destroy']);module[_0x4321('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index ae92046..9636932 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 _0x6e35=['STRING','sequelize','exports'];(function(_0x3ac8e2,_0x396cf4){var _0x37a5f4=function(_0x5bff0e){while(--_0x5bff0e){_0x3ac8e2['push'](_0x3ac8e2['shift']());}};_0x37a5f4(++_0x396cf4);}(_0x6e35,0x79));var _0x56e3=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x6e35[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0x56e3('0x0'));module[_0x56e3('0x1')]={'name':{'type':Sequelize[_0x56e3('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6792=['exports','STRING','sequelize'];(function(_0x52a23f,_0x467b97){var _0x14c953=function(_0x53eba4){while(--_0x53eba4){_0x52a23f['push'](_0x52a23f['shift']());}};_0x14c953(++_0x467b97);}(_0x6792,0x74));var _0x2679=function(_0x1b18dc,_0x1e1b6b){_0x1b18dc=_0x1b18dc-0x0;var _0x5c9416=_0x6792[_0x1b18dc];return _0x5c9416;};'use strict';var Sequelize=require(_0x2679('0x0'));module[_0x2679('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2679('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index b5682b8..ed9c259 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 _0x3bf5=['stack','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','length','catch','create','body','find','destroy','getSubjects','findOne','FreshsalesField','getDescriptions','getFields','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','error'];(function(_0x46b1c9,_0x169f87){var _0x17569c=function(_0x4b7c45){while(--_0x4b7c45){_0x46b1c9['push'](_0x46b1c9['shift']());}};_0x17569c(++_0x169f87);}(_0x3bf5,0x1d4));var _0x53bf=function(_0x124298,_0x542004){_0x124298=_0x124298-0x0;var _0x35ac24=_0x3bf5[_0x124298];return _0x35ac24;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x53bf('0x0'));var zipdir=require(_0x53bf('0x1'));var jsonpatch=require(_0x53bf('0x2'));var rp=require('request-promise');var moment=require(_0x53bf('0x3'));var BPromise=require(_0x53bf('0x4'));var Mustache=require(_0x53bf('0x5'));var util=require(_0x53bf('0x6'));var path=require(_0x53bf('0x7'));var sox=require(_0x53bf('0x8'));var csv=require('to-csv');var ejs=require(_0x53bf('0x9'));var fs=require('fs');var fs_extra=require(_0x53bf('0xa'));var _=require(_0x53bf('0xb'));var squel=require(_0x53bf('0xc'));var crypto=require(_0x53bf('0xd'));var jsforce=require(_0x53bf('0xe'));var deskjs=require(_0x53bf('0xf'));var toCsv=require(_0x53bf('0x10'));var querystring=require(_0x53bf('0x11'));var Papa=require('papaparse');var Redis=require(_0x53bf('0x12'));var authService=require(_0x53bf('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x53bf('0x14'));var hardwareService=require(_0x53bf('0x15'));var logger=require(_0x53bf('0x16'))(_0x53bf('0x17'));var utils=require('../../config/utils');var config=require(_0x53bf('0x18'));var licenseUtil=require(_0x53bf('0x19'));var db=require(_0x53bf('0x1a'))['db'];function respondWithStatusCode(_0x30a775,_0x3cf51c){_0x3cf51c=_0x3cf51c||0xcc;return function(_0x281ffb){if(_0x281ffb){return _0x30a775[_0x53bf('0x1b')](_0x3cf51c);}return _0x30a775['status'](_0x3cf51c)[_0x53bf('0x1c')]();};}function respondWithResult(_0x386320,_0x7fc5df){_0x7fc5df=_0x7fc5df||0xc8;return function(_0x308b5c){if(_0x308b5c){return _0x386320[_0x53bf('0x1d')](_0x7fc5df)[_0x53bf('0x1e')](_0x308b5c);}};}function respondWithFilteredResult(_0x2603ed,_0x55a63b){return function(_0x1dfda2){if(_0x1dfda2){var _0x5e7d03=typeof _0x55a63b[_0x53bf('0x1f')]===_0x53bf('0x20')&&typeof _0x55a63b['limit']===_0x53bf('0x20');var _0x1aae6c=_0x1dfda2[_0x53bf('0x21')];var _0x2b682e=_0x5e7d03?0x0:_0x55a63b['offset'];var _0x59412b=_0x5e7d03?_0x1dfda2['count']:_0x55a63b[_0x53bf('0x1f')]+_0x55a63b[_0x53bf('0x22')];var _0x4c8ee2;if(_0x59412b>=_0x1aae6c){_0x59412b=_0x1aae6c;_0x4c8ee2=0xc8;}else{_0x4c8ee2=0xce;}_0x2603ed[_0x53bf('0x1d')](_0x4c8ee2);return _0x2603ed[_0x53bf('0x23')](_0x53bf('0x24'),_0x2b682e+'-'+_0x59412b+'/'+_0x1aae6c)[_0x53bf('0x1e')](_0x1dfda2);}return null;};}function patchUpdates(_0x52f8d1){return function(_0x41bed5){try{jsonpatch['apply'](_0x41bed5,_0x52f8d1,!![]);}catch(_0x3dc422){return BPromise[_0x53bf('0x25')](_0x3dc422);}return _0x41bed5[_0x53bf('0x26')]();};}function saveUpdates(_0x59da03,_0x411056){return function(_0x59ab96){if(_0x59ab96){return _0x59ab96[_0x53bf('0x27')](_0x59da03)[_0x53bf('0x28')](function(_0x3ee41a){return _0x3ee41a;});}return null;};}function removeEntity(_0x3ecc14,_0x574404){return function(_0x5552dc){if(_0x5552dc){return _0x5552dc['destroy']()[_0x53bf('0x28')](function(){_0x3ecc14[_0x53bf('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31a70d,_0x1cb54a){return function(_0x15e4e3){if(!_0x15e4e3){_0x31a70d['sendStatus'](0x194);}return _0x15e4e3;};}function handleError(_0x32c919,_0x1479d4){_0x1479d4=_0x1479d4||0x1f4;return function(_0x428316){logger[_0x53bf('0x29')](_0x428316[_0x53bf('0x2a')]);if(_0x428316['name']){delete _0x428316['name'];}_0x32c919[_0x53bf('0x1d')](_0x1479d4)[_0x53bf('0x2b')](_0x428316);};}exports[_0x53bf('0x2c')]=function(_0x4628db,_0x267d67){var _0x15471a={},_0x4a0857={},_0x4b666f={'count':0x0,'rows':[]};var _0x54d709=_[_0x53bf('0x2d')](db[_0x53bf('0x2e')][_0x53bf('0x2f')],function(_0x1e4a56){return{'name':_0x1e4a56[_0x53bf('0x30')],'type':_0x1e4a56['type'][_0x53bf('0x31')]};});_0x4a0857[_0x53bf('0x32')]=_['map'](_0x54d709,_0x53bf('0x33'));_0x4a0857[_0x53bf('0x34')]=_[_0x53bf('0x35')](_0x4628db[_0x53bf('0x34')]);_0x4a0857[_0x53bf('0x36')]=_[_0x53bf('0x37')](_0x4a0857['model'],_0x4a0857[_0x53bf('0x34')]);_0x15471a[_0x53bf('0x38')]=_[_0x53bf('0x37')](_0x4a0857['model'],qs['fields'](_0x4628db[_0x53bf('0x34')][_0x53bf('0x39')]));_0x15471a[_0x53bf('0x38')]=_0x15471a[_0x53bf('0x38')]['length']?_0x15471a[_0x53bf('0x38')]:_0x4a0857[_0x53bf('0x32')];if(!_0x4628db['query'][_0x53bf('0x3a')](_0x53bf('0x3b'))){_0x15471a[_0x53bf('0x22')]=qs['limit'](_0x4628db[_0x53bf('0x34')]['limit']);_0x15471a[_0x53bf('0x1f')]=qs['offset'](_0x4628db[_0x53bf('0x34')]['offset']);}_0x15471a[_0x53bf('0x3c')]=qs[_0x53bf('0x3d')](_0x4628db[_0x53bf('0x34')][_0x53bf('0x3d')]);_0x15471a['where']=qs[_0x53bf('0x36')](_[_0x53bf('0x3e')](_0x4628db['query'],_0x4a0857[_0x53bf('0x36')]),_0x54d709);if(_0x4628db[_0x53bf('0x34')][_0x53bf('0x3f')]){_0x15471a[_0x53bf('0x40')]=_[_0x53bf('0x41')](_0x15471a[_0x53bf('0x40')],{'$or':_[_0x53bf('0x2d')](_0x54d709,function(_0x469a02){if(_0x469a02[_0x53bf('0x42')]!==_0x53bf('0x43')){var _0x3f0f2f={};_0x3f0f2f[_0x469a02['name']]={'$like':'%'+_0x4628db[_0x53bf('0x34')][_0x53bf('0x3f')]+'%'};return _0x3f0f2f;}})});}_0x15471a=_[_0x53bf('0x41')]({},_0x15471a,_0x4628db[_0x53bf('0x44')]);var _0x3fe56c={'where':_0x15471a[_0x53bf('0x40')]};return db[_0x53bf('0x2e')][_0x53bf('0x21')](_0x3fe56c)[_0x53bf('0x28')](function(_0x59d348){_0x4b666f[_0x53bf('0x21')]=_0x59d348;if(_0x4628db[_0x53bf('0x34')][_0x53bf('0x45')]){_0x15471a['include']=[{'all':!![]}];}return db[_0x53bf('0x2e')][_0x53bf('0x46')](_0x15471a);})['then'](function(_0x42514d){_0x4b666f[_0x53bf('0x47')]=_0x42514d;return _0x4b666f;})[_0x53bf('0x28')](respondWithFilteredResult(_0x267d67,_0x15471a))['catch'](handleError(_0x267d67,null));};exports[_0x53bf('0x48')]=function(_0x4d3dcf,_0x284187){var _0x885062={'raw':![],'where':{'id':_0x4d3dcf[_0x53bf('0x49')]['id']}},_0x422d5d={};_0x422d5d[_0x53bf('0x32')]=_['keys'](db[_0x53bf('0x2e')][_0x53bf('0x2f')]);_0x422d5d['query']=_[_0x53bf('0x35')](_0x4d3dcf[_0x53bf('0x34')]);_0x422d5d[_0x53bf('0x36')]=_[_0x53bf('0x37')](_0x422d5d[_0x53bf('0x32')],_0x422d5d['query']);_0x885062[_0x53bf('0x38')]=_['intersection'](_0x422d5d[_0x53bf('0x32')],qs[_0x53bf('0x39')](_0x4d3dcf[_0x53bf('0x34')][_0x53bf('0x39')]));_0x885062[_0x53bf('0x38')]=_0x885062[_0x53bf('0x38')][_0x53bf('0x4a')]?_0x885062[_0x53bf('0x38')]:_0x422d5d[_0x53bf('0x32')];if(_0x4d3dcf[_0x53bf('0x34')][_0x53bf('0x45')]){_0x885062['include']=[{'all':!![]}];}_0x885062=_[_0x53bf('0x41')]({},_0x885062,_0x4d3dcf['options']);return db[_0x53bf('0x2e')]['find'](_0x885062)[_0x53bf('0x28')](handleEntityNotFound(_0x284187,null))[_0x53bf('0x28')](respondWithResult(_0x284187,null))[_0x53bf('0x4b')](handleError(_0x284187,null));};exports[_0x53bf('0x4c')]=function(_0x5eebd5,_0x97283c){return db[_0x53bf('0x2e')][_0x53bf('0x4c')](_0x5eebd5[_0x53bf('0x4d')],{})[_0x53bf('0x28')](respondWithResult(_0x97283c,0xc9))[_0x53bf('0x4b')](handleError(_0x97283c,null));};exports[_0x53bf('0x27')]=function(_0x138e04,_0x1dba85){if(_0x138e04[_0x53bf('0x4d')]['id']){delete _0x138e04[_0x53bf('0x4d')]['id'];}return db['FreshsalesConfiguration'][_0x53bf('0x4e')]({'where':{'id':_0x138e04[_0x53bf('0x49')]['id']}})[_0x53bf('0x28')](handleEntityNotFound(_0x1dba85,null))[_0x53bf('0x28')](saveUpdates(_0x138e04[_0x53bf('0x4d')],null))[_0x53bf('0x28')](respondWithResult(_0x1dba85,null))[_0x53bf('0x4b')](handleError(_0x1dba85,null));};exports[_0x53bf('0x4f')]=function(_0x276836,_0x156300){return db['FreshsalesConfiguration'][_0x53bf('0x4e')]({'where':{'id':_0x276836[_0x53bf('0x49')]['id']}})['then'](handleEntityNotFound(_0x156300,null))['then'](removeEntity(_0x156300,null))['catch'](handleError(_0x156300,null));};exports[_0x53bf('0x50')]=function(_0x4d603d,_0x55117b,_0x42bcc6){var _0x325e2a={};var _0xefa6f4={};var _0x474ba2;var _0x4c8ecf;return db[_0x53bf('0x2e')][_0x53bf('0x51')]({'where':{'id':_0x4d603d[_0x53bf('0x49')]['id']}})[_0x53bf('0x28')](handleEntityNotFound(_0x55117b,null))[_0x53bf('0x28')](function(_0x385bae){if(_0x385bae){_0x474ba2=_0x385bae;_0xefa6f4[_0x53bf('0x32')]=_[_0x53bf('0x35')](db[_0x53bf('0x52')]['rawAttributes']);_0xefa6f4[_0x53bf('0x34')]=_[_0x53bf('0x35')](_0x4d603d[_0x53bf('0x34')]);_0xefa6f4[_0x53bf('0x36')]=_[_0x53bf('0x37')](_0xefa6f4[_0x53bf('0x32')],_0xefa6f4[_0x53bf('0x34')]);_0x325e2a['attributes']=_[_0x53bf('0x37')](_0xefa6f4[_0x53bf('0x32')],qs['fields'](_0x4d603d[_0x53bf('0x34')][_0x53bf('0x39')]));_0x325e2a[_0x53bf('0x38')]=_0x325e2a[_0x53bf('0x38')][_0x53bf('0x4a')]?_0x325e2a[_0x53bf('0x38')]:_0xefa6f4[_0x53bf('0x32')];_0x325e2a[_0x53bf('0x3c')]=qs[_0x53bf('0x3d')](_0x4d603d[_0x53bf('0x34')][_0x53bf('0x3d')]);_0x325e2a[_0x53bf('0x40')]=qs['filters'](_[_0x53bf('0x3e')](_0x4d603d[_0x53bf('0x34')],_0xefa6f4['filters']));if(_0x4d603d[_0x53bf('0x34')][_0x53bf('0x3f')]){_0x325e2a['where']=_['merge'](_0x325e2a[_0x53bf('0x40')],{'$or':_[_0x53bf('0x2d')](_0x325e2a[_0x53bf('0x38')],function(_0x2efb99){var _0x2585b9={};_0x2585b9[_0x2efb99]={'$like':'%'+_0x4d603d['query']['filter']+'%'};return _0x2585b9;})});}_0x325e2a=_[_0x53bf('0x41')]({},_0x325e2a,_0x4d603d[_0x53bf('0x44')]);return _0x474ba2[_0x53bf('0x50')](_0x325e2a);}})['then'](function(_0x3c6140){if(_0x3c6140){_0x4c8ecf=_0x3c6140[_0x53bf('0x4a')];if(!_0x4d603d[_0x53bf('0x34')][_0x53bf('0x3a')](_0x53bf('0x3b'))){_0x325e2a[_0x53bf('0x22')]=qs[_0x53bf('0x22')](_0x4d603d[_0x53bf('0x34')][_0x53bf('0x22')]);_0x325e2a[_0x53bf('0x1f')]=qs['offset'](_0x4d603d[_0x53bf('0x34')][_0x53bf('0x1f')]);}return _0x474ba2[_0x53bf('0x50')](_0x325e2a);}})['then'](function(_0x56c57b){if(_0x56c57b){return _0x56c57b?{'count':_0x4c8ecf,'rows':_0x56c57b}:null;}})[_0x53bf('0x28')](respondWithResult(_0x55117b,null))[_0x53bf('0x4b')](handleError(_0x55117b,null));};exports['getDescriptions']=function(_0xaa41f2,_0x7bea48,_0x5cc75e){var _0x3a10cc={};var _0x2cc68a={};var _0x6d655b;var _0x239ecb;return db[_0x53bf('0x2e')][_0x53bf('0x51')]({'where':{'id':_0xaa41f2[_0x53bf('0x49')]['id']}})[_0x53bf('0x28')](handleEntityNotFound(_0x7bea48,null))['then'](function(_0x37c01f){if(_0x37c01f){_0x6d655b=_0x37c01f;_0x2cc68a[_0x53bf('0x32')]=_[_0x53bf('0x35')](db[_0x53bf('0x52')][_0x53bf('0x2f')]);_0x2cc68a[_0x53bf('0x34')]=_[_0x53bf('0x35')](_0xaa41f2[_0x53bf('0x34')]);_0x2cc68a['filters']=_[_0x53bf('0x37')](_0x2cc68a[_0x53bf('0x32')],_0x2cc68a[_0x53bf('0x34')]);_0x3a10cc[_0x53bf('0x38')]=_[_0x53bf('0x37')](_0x2cc68a[_0x53bf('0x32')],qs['fields'](_0xaa41f2[_0x53bf('0x34')]['fields']));_0x3a10cc['attributes']=_0x3a10cc[_0x53bf('0x38')]['length']?_0x3a10cc[_0x53bf('0x38')]:_0x2cc68a['model'];_0x3a10cc[_0x53bf('0x3c')]=qs[_0x53bf('0x3d')](_0xaa41f2[_0x53bf('0x34')][_0x53bf('0x3d')]);_0x3a10cc[_0x53bf('0x40')]=qs['filters'](_[_0x53bf('0x3e')](_0xaa41f2['query'],_0x2cc68a['filters']));if(_0xaa41f2[_0x53bf('0x34')]['filter']){_0x3a10cc['where']=_[_0x53bf('0x41')](_0x3a10cc[_0x53bf('0x40')],{'$or':_[_0x53bf('0x2d')](_0x3a10cc[_0x53bf('0x38')],function(_0x22d945){var _0x3c042c={};_0x3c042c[_0x22d945]={'$like':'%'+_0xaa41f2[_0x53bf('0x34')]['filter']+'%'};return _0x3c042c;})});}_0x3a10cc=_[_0x53bf('0x41')]({},_0x3a10cc,_0xaa41f2[_0x53bf('0x44')]);return _0x6d655b[_0x53bf('0x53')](_0x3a10cc);}})[_0x53bf('0x28')](function(_0x2a98c3){if(_0x2a98c3){_0x239ecb=_0x2a98c3[_0x53bf('0x4a')];if(!_0xaa41f2['query'][_0x53bf('0x3a')](_0x53bf('0x3b'))){_0x3a10cc[_0x53bf('0x22')]=qs[_0x53bf('0x22')](_0xaa41f2[_0x53bf('0x34')][_0x53bf('0x22')]);_0x3a10cc['offset']=qs['offset'](_0xaa41f2[_0x53bf('0x34')][_0x53bf('0x1f')]);}return _0x6d655b[_0x53bf('0x53')](_0x3a10cc);}})[_0x53bf('0x28')](function(_0x518987){if(_0x518987){return _0x518987?{'count':_0x239ecb,'rows':_0x518987}:null;}})[_0x53bf('0x28')](respondWithResult(_0x7bea48,null))['catch'](handleError(_0x7bea48,null));};exports['getFields']=function(_0x56ab0e,_0x16b25b,_0x58657d){var _0x3853d7={};var _0x5e430c={};var _0x562165;var _0x495f16;return db[_0x53bf('0x2e')][_0x53bf('0x51')]({'where':{'id':_0x56ab0e['params']['id']}})[_0x53bf('0x28')](handleEntityNotFound(_0x16b25b,null))[_0x53bf('0x28')](function(_0x25eabb){if(_0x25eabb){_0x562165=_0x25eabb;_0x5e430c['model']=_[_0x53bf('0x35')](db['FreshsalesField']['rawAttributes']);_0x5e430c[_0x53bf('0x34')]=_[_0x53bf('0x35')](_0x56ab0e[_0x53bf('0x34')]);_0x5e430c[_0x53bf('0x36')]=_[_0x53bf('0x37')](_0x5e430c[_0x53bf('0x32')],_0x5e430c[_0x53bf('0x34')]);_0x3853d7[_0x53bf('0x38')]=_[_0x53bf('0x37')](_0x5e430c[_0x53bf('0x32')],qs['fields'](_0x56ab0e[_0x53bf('0x34')]['fields']));_0x3853d7[_0x53bf('0x38')]=_0x3853d7[_0x53bf('0x38')]['length']?_0x3853d7[_0x53bf('0x38')]:_0x5e430c[_0x53bf('0x32')];_0x3853d7[_0x53bf('0x3c')]=qs[_0x53bf('0x3d')](_0x56ab0e[_0x53bf('0x34')][_0x53bf('0x3d')]);_0x3853d7['where']=qs[_0x53bf('0x36')](_[_0x53bf('0x3e')](_0x56ab0e['query'],_0x5e430c[_0x53bf('0x36')]));if(_0x56ab0e[_0x53bf('0x34')][_0x53bf('0x3f')]){_0x3853d7[_0x53bf('0x40')]=_['merge'](_0x3853d7[_0x53bf('0x40')],{'$or':_['map'](_0x3853d7[_0x53bf('0x38')],function(_0x440224){var _0xf3f023={};_0xf3f023[_0x440224]={'$like':'%'+_0x56ab0e[_0x53bf('0x34')]['filter']+'%'};return _0xf3f023;})});}_0x3853d7=_[_0x53bf('0x41')]({},_0x3853d7,_0x56ab0e['options']);return _0x562165[_0x53bf('0x54')](_0x3853d7);}})[_0x53bf('0x28')](function(_0x442ecd){if(_0x442ecd){_0x495f16=_0x442ecd['length'];if(!_0x56ab0e[_0x53bf('0x34')][_0x53bf('0x3a')](_0x53bf('0x3b'))){_0x3853d7['limit']=qs[_0x53bf('0x22')](_0x56ab0e[_0x53bf('0x34')]['limit']);_0x3853d7[_0x53bf('0x1f')]=qs[_0x53bf('0x1f')](_0x56ab0e['query'][_0x53bf('0x1f')]);}return _0x562165[_0x53bf('0x54')](_0x3853d7);}})[_0x53bf('0x28')](function(_0x568573){if(_0x568573){return _0x568573?{'count':_0x495f16,'rows':_0x568573}:null;}})[_0x53bf('0x28')](respondWithResult(_0x16b25b,null))[_0x53bf('0x4b')](handleError(_0x16b25b,null));}; \ No newline at end of file +var _0xb60d=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','save','update','then','end','error','stack','name','send','index','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','includeAll','FreshsalesConfiguration','findAll','rows','show','params','rawAttributes','options','find','create','body','catch','destroy','getSubjects','findOne','length','pick','nolimit','getDescriptions','FreshsalesField','getFields','rimraf','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs'];(function(_0x92724b,_0x18e7d6){var _0x12e4f5=function(_0x406734){while(--_0x406734){_0x92724b['push'](_0x92724b['shift']());}};_0x12e4f5(++_0x18e7d6);}(_0xb60d,0x8c));var _0xdb60=function(_0x4e91c3,_0x52ed66){_0x4e91c3=_0x4e91c3-0x0;var _0x2a7515=_0xb60d[_0x4e91c3];return _0x2a7515;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdb60('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdb60('0x1'));var moment=require(_0xdb60('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xdb60('0x3'));var util=require(_0xdb60('0x4'));var path=require(_0xdb60('0x5'));var sox=require(_0xdb60('0x6'));var csv=require('to-csv');var ejs=require(_0xdb60('0x7'));var fs=require('fs');var fs_extra=require(_0xdb60('0x8'));var _=require('lodash');var squel=require(_0xdb60('0x9'));var crypto=require(_0xdb60('0xa'));var jsforce=require(_0xdb60('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xdb60('0xc'));var querystring=require(_0xdb60('0xd'));var Papa=require('papaparse');var Redis=require(_0xdb60('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xdb60('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdb60('0x10'));var logger=require(_0xdb60('0x11'))(_0xdb60('0x12'));var utils=require(_0xdb60('0x13'));var config=require(_0xdb60('0x14'));var licenseUtil=require(_0xdb60('0x15'));var db=require(_0xdb60('0x16'))['db'];function respondWithStatusCode(_0x58ca,_0x202e1c){_0x202e1c=_0x202e1c||0xcc;return function(_0x2ae4d7){if(_0x2ae4d7){return _0x58ca[_0xdb60('0x17')](_0x202e1c);}return _0x58ca[_0xdb60('0x18')](_0x202e1c)['end']();};}function respondWithResult(_0x286ce0,_0x609cff){_0x609cff=_0x609cff||0xc8;return function(_0x38ccfe){if(_0x38ccfe){return _0x286ce0[_0xdb60('0x18')](_0x609cff)[_0xdb60('0x19')](_0x38ccfe);}};}function respondWithFilteredResult(_0x1c58d6,_0x3b0a6b){return function(_0x5cfbb0){if(_0x5cfbb0){var _0x533957=typeof _0x3b0a6b[_0xdb60('0x1a')]===_0xdb60('0x1b')&&typeof _0x3b0a6b[_0xdb60('0x1c')]===_0xdb60('0x1b');var _0x1aec70=_0x5cfbb0[_0xdb60('0x1d')];var _0x10c22e=_0x533957?0x0:_0x3b0a6b[_0xdb60('0x1a')];var _0x178691=_0x533957?_0x5cfbb0['count']:_0x3b0a6b[_0xdb60('0x1a')]+_0x3b0a6b[_0xdb60('0x1c')];var _0xa85aa3;if(_0x178691>=_0x1aec70){_0x178691=_0x1aec70;_0xa85aa3=0xc8;}else{_0xa85aa3=0xce;}_0x1c58d6[_0xdb60('0x18')](_0xa85aa3);return _0x1c58d6['set']('Content-Range',_0x10c22e+'-'+_0x178691+'/'+_0x1aec70)[_0xdb60('0x19')](_0x5cfbb0);}return null;};}function patchUpdates(_0x3c7daa){return function(_0x2baa5d){try{jsonpatch[_0xdb60('0x1e')](_0x2baa5d,_0x3c7daa,!![]);}catch(_0x1b1ed8){return BPromise['reject'](_0x1b1ed8);}return _0x2baa5d[_0xdb60('0x1f')]();};}function saveUpdates(_0x291b07,_0x5c6eb1){return function(_0x385068){if(_0x385068){return _0x385068[_0xdb60('0x20')](_0x291b07)[_0xdb60('0x21')](function(_0x10655a){return _0x10655a;});}return null;};}function removeEntity(_0x497a74,_0x5892c5){return function(_0x380bc5){if(_0x380bc5){return _0x380bc5['destroy']()[_0xdb60('0x21')](function(){_0x497a74[_0xdb60('0x18')](0xcc)[_0xdb60('0x22')]();});}};}function handleEntityNotFound(_0x39ac71,_0xc4d1d6){return function(_0x5b4dfe){if(!_0x5b4dfe){_0x39ac71[_0xdb60('0x17')](0x194);}return _0x5b4dfe;};}function handleError(_0x252bd6,_0x2d589c){_0x2d589c=_0x2d589c||0x1f4;return function(_0x1230f8){logger[_0xdb60('0x23')](_0x1230f8[_0xdb60('0x24')]);if(_0x1230f8[_0xdb60('0x25')]){delete _0x1230f8['name'];}_0x252bd6[_0xdb60('0x18')](_0x2d589c)[_0xdb60('0x26')](_0x1230f8);};}exports[_0xdb60('0x27')]=function(_0x2ef1b0,_0x46722c){var _0x3dabe2={},_0x4a1e19={},_0x406538={'count':0x0,'rows':[]};var _0x29f4d3=_[_0xdb60('0x28')](db['FreshsalesConfiguration']['rawAttributes'],function(_0x83969d){return{'name':_0x83969d[_0xdb60('0x29')],'type':_0x83969d[_0xdb60('0x2a')]['key']};});_0x4a1e19[_0xdb60('0x2b')]=_['map'](_0x29f4d3,'name');_0x4a1e19[_0xdb60('0x2c')]=_[_0xdb60('0x2d')](_0x2ef1b0['query']);_0x4a1e19[_0xdb60('0x2e')]=_[_0xdb60('0x2f')](_0x4a1e19['model'],_0x4a1e19[_0xdb60('0x2c')]);_0x3dabe2[_0xdb60('0x30')]=_['intersection'](_0x4a1e19[_0xdb60('0x2b')],qs[_0xdb60('0x31')](_0x2ef1b0[_0xdb60('0x2c')][_0xdb60('0x31')]));_0x3dabe2[_0xdb60('0x30')]=_0x3dabe2[_0xdb60('0x30')]['length']?_0x3dabe2['attributes']:_0x4a1e19[_0xdb60('0x2b')];if(!_0x2ef1b0[_0xdb60('0x2c')][_0xdb60('0x32')]('nolimit')){_0x3dabe2['limit']=qs['limit'](_0x2ef1b0[_0xdb60('0x2c')][_0xdb60('0x1c')]);_0x3dabe2[_0xdb60('0x1a')]=qs[_0xdb60('0x1a')](_0x2ef1b0['query'][_0xdb60('0x1a')]);}_0x3dabe2[_0xdb60('0x33')]=qs[_0xdb60('0x34')](_0x2ef1b0[_0xdb60('0x2c')][_0xdb60('0x34')]);_0x3dabe2[_0xdb60('0x35')]=qs[_0xdb60('0x2e')](_['pick'](_0x2ef1b0[_0xdb60('0x2c')],_0x4a1e19['filters']),_0x29f4d3);if(_0x2ef1b0[_0xdb60('0x2c')][_0xdb60('0x36')]){_0x3dabe2[_0xdb60('0x35')]=_[_0xdb60('0x37')](_0x3dabe2[_0xdb60('0x35')],{'$or':_[_0xdb60('0x28')](_0x29f4d3,function(_0x536c1b){if(_0x536c1b[_0xdb60('0x2a')]!==_0xdb60('0x38')){var _0x4a9ba2={};_0x4a9ba2[_0x536c1b[_0xdb60('0x25')]]={'$like':'%'+_0x2ef1b0[_0xdb60('0x2c')][_0xdb60('0x36')]+'%'};return _0x4a9ba2;}})});}_0x3dabe2=_[_0xdb60('0x37')]({},_0x3dabe2,_0x2ef1b0['options']);var _0x2e100b={'where':_0x3dabe2[_0xdb60('0x35')]};return db['FreshsalesConfiguration'][_0xdb60('0x1d')](_0x2e100b)['then'](function(_0x1bd8b9){_0x406538[_0xdb60('0x1d')]=_0x1bd8b9;if(_0x2ef1b0['query'][_0xdb60('0x39')]){_0x3dabe2['include']=[{'all':!![]}];}return db[_0xdb60('0x3a')][_0xdb60('0x3b')](_0x3dabe2);})['then'](function(_0x5720f1){_0x406538[_0xdb60('0x3c')]=_0x5720f1;return _0x406538;})[_0xdb60('0x21')](respondWithFilteredResult(_0x46722c,_0x3dabe2))['catch'](handleError(_0x46722c,null));};exports[_0xdb60('0x3d')]=function(_0x16c266,_0x43f091){var _0xac7b5f={'raw':![],'where':{'id':_0x16c266[_0xdb60('0x3e')]['id']}},_0x66277d={};_0x66277d[_0xdb60('0x2b')]=_[_0xdb60('0x2d')](db['FreshsalesConfiguration'][_0xdb60('0x3f')]);_0x66277d[_0xdb60('0x2c')]=_[_0xdb60('0x2d')](_0x16c266[_0xdb60('0x2c')]);_0x66277d['filters']=_['intersection'](_0x66277d[_0xdb60('0x2b')],_0x66277d[_0xdb60('0x2c')]);_0xac7b5f['attributes']=_[_0xdb60('0x2f')](_0x66277d['model'],qs[_0xdb60('0x31')](_0x16c266[_0xdb60('0x2c')][_0xdb60('0x31')]));_0xac7b5f[_0xdb60('0x30')]=_0xac7b5f[_0xdb60('0x30')]['length']?_0xac7b5f[_0xdb60('0x30')]:_0x66277d[_0xdb60('0x2b')];if(_0x16c266[_0xdb60('0x2c')]['includeAll']){_0xac7b5f['include']=[{'all':!![]}];}_0xac7b5f=_[_0xdb60('0x37')]({},_0xac7b5f,_0x16c266[_0xdb60('0x40')]);return db[_0xdb60('0x3a')][_0xdb60('0x41')](_0xac7b5f)['then'](handleEntityNotFound(_0x43f091,null))[_0xdb60('0x21')](respondWithResult(_0x43f091,null))['catch'](handleError(_0x43f091,null));};exports[_0xdb60('0x42')]=function(_0x284d20,_0x2efbca){return db[_0xdb60('0x3a')][_0xdb60('0x42')](_0x284d20[_0xdb60('0x43')],{})[_0xdb60('0x21')](respondWithResult(_0x2efbca,0xc9))[_0xdb60('0x44')](handleError(_0x2efbca,null));};exports['update']=function(_0xa15196,_0x3176b1){if(_0xa15196[_0xdb60('0x43')]['id']){delete _0xa15196['body']['id'];}return db[_0xdb60('0x3a')][_0xdb60('0x41')]({'where':{'id':_0xa15196[_0xdb60('0x3e')]['id']}})[_0xdb60('0x21')](handleEntityNotFound(_0x3176b1,null))[_0xdb60('0x21')](saveUpdates(_0xa15196[_0xdb60('0x43')],null))[_0xdb60('0x21')](respondWithResult(_0x3176b1,null))[_0xdb60('0x44')](handleError(_0x3176b1,null));};exports[_0xdb60('0x45')]=function(_0x42e2c7,_0x5d1775){return db[_0xdb60('0x3a')][_0xdb60('0x41')]({'where':{'id':_0x42e2c7['params']['id']}})[_0xdb60('0x21')](handleEntityNotFound(_0x5d1775,null))['then'](removeEntity(_0x5d1775,null))[_0xdb60('0x44')](handleError(_0x5d1775,null));};exports[_0xdb60('0x46')]=function(_0x265c2b,_0x3d4a0a,_0x3ae276){var _0x306100={};var _0x2281d2={};var _0x13337d;var _0x560b16;return db[_0xdb60('0x3a')][_0xdb60('0x47')]({'where':{'id':_0x265c2b['params']['id']}})[_0xdb60('0x21')](handleEntityNotFound(_0x3d4a0a,null))['then'](function(_0x3bafbd){if(_0x3bafbd){_0x13337d=_0x3bafbd;_0x2281d2['model']=_['keys'](db['FreshsalesField'][_0xdb60('0x3f')]);_0x2281d2[_0xdb60('0x2c')]=_['keys'](_0x265c2b[_0xdb60('0x2c')]);_0x2281d2['filters']=_[_0xdb60('0x2f')](_0x2281d2[_0xdb60('0x2b')],_0x2281d2[_0xdb60('0x2c')]);_0x306100[_0xdb60('0x30')]=_[_0xdb60('0x2f')](_0x2281d2['model'],qs['fields'](_0x265c2b[_0xdb60('0x2c')][_0xdb60('0x31')]));_0x306100[_0xdb60('0x30')]=_0x306100[_0xdb60('0x30')][_0xdb60('0x48')]?_0x306100['attributes']:_0x2281d2[_0xdb60('0x2b')];_0x306100[_0xdb60('0x33')]=qs[_0xdb60('0x34')](_0x265c2b[_0xdb60('0x2c')][_0xdb60('0x34')]);_0x306100[_0xdb60('0x35')]=qs[_0xdb60('0x2e')](_[_0xdb60('0x49')](_0x265c2b[_0xdb60('0x2c')],_0x2281d2[_0xdb60('0x2e')]));if(_0x265c2b[_0xdb60('0x2c')][_0xdb60('0x36')]){_0x306100[_0xdb60('0x35')]=_[_0xdb60('0x37')](_0x306100['where'],{'$or':_[_0xdb60('0x28')](_0x306100[_0xdb60('0x30')],function(_0x883f7b){var _0x1a34a7={};_0x1a34a7[_0x883f7b]={'$like':'%'+_0x265c2b[_0xdb60('0x2c')]['filter']+'%'};return _0x1a34a7;})});}_0x306100=_[_0xdb60('0x37')]({},_0x306100,_0x265c2b[_0xdb60('0x40')]);return _0x13337d['getSubjects'](_0x306100);}})[_0xdb60('0x21')](function(_0xc4a648){if(_0xc4a648){_0x560b16=_0xc4a648['length'];if(!_0x265c2b[_0xdb60('0x2c')]['hasOwnProperty'](_0xdb60('0x4a'))){_0x306100[_0xdb60('0x1c')]=qs[_0xdb60('0x1c')](_0x265c2b['query'][_0xdb60('0x1c')]);_0x306100[_0xdb60('0x1a')]=qs[_0xdb60('0x1a')](_0x265c2b['query'][_0xdb60('0x1a')]);}return _0x13337d[_0xdb60('0x46')](_0x306100);}})['then'](function(_0x5066d4){if(_0x5066d4){return _0x5066d4?{'count':_0x560b16,'rows':_0x5066d4}:null;}})[_0xdb60('0x21')](respondWithResult(_0x3d4a0a,null))[_0xdb60('0x44')](handleError(_0x3d4a0a,null));};exports[_0xdb60('0x4b')]=function(_0x2bfa1b,_0x41d526,_0x64dccc){var _0x39d1e9={};var _0x19e0ff={};var _0x4f6f07;var _0x4b8ae6;return db[_0xdb60('0x3a')][_0xdb60('0x47')]({'where':{'id':_0x2bfa1b[_0xdb60('0x3e')]['id']}})[_0xdb60('0x21')](handleEntityNotFound(_0x41d526,null))[_0xdb60('0x21')](function(_0x36028e){if(_0x36028e){_0x4f6f07=_0x36028e;_0x19e0ff[_0xdb60('0x2b')]=_['keys'](db[_0xdb60('0x4c')][_0xdb60('0x3f')]);_0x19e0ff[_0xdb60('0x2c')]=_[_0xdb60('0x2d')](_0x2bfa1b['query']);_0x19e0ff[_0xdb60('0x2e')]=_[_0xdb60('0x2f')](_0x19e0ff[_0xdb60('0x2b')],_0x19e0ff[_0xdb60('0x2c')]);_0x39d1e9[_0xdb60('0x30')]=_[_0xdb60('0x2f')](_0x19e0ff[_0xdb60('0x2b')],qs[_0xdb60('0x31')](_0x2bfa1b['query'][_0xdb60('0x31')]));_0x39d1e9['attributes']=_0x39d1e9['attributes']['length']?_0x39d1e9[_0xdb60('0x30')]:_0x19e0ff[_0xdb60('0x2b')];_0x39d1e9[_0xdb60('0x33')]=qs[_0xdb60('0x34')](_0x2bfa1b[_0xdb60('0x2c')][_0xdb60('0x34')]);_0x39d1e9[_0xdb60('0x35')]=qs['filters'](_[_0xdb60('0x49')](_0x2bfa1b['query'],_0x19e0ff[_0xdb60('0x2e')]));if(_0x2bfa1b[_0xdb60('0x2c')]['filter']){_0x39d1e9[_0xdb60('0x35')]=_[_0xdb60('0x37')](_0x39d1e9[_0xdb60('0x35')],{'$or':_[_0xdb60('0x28')](_0x39d1e9[_0xdb60('0x30')],function(_0x11aaeb){var _0x341ef={};_0x341ef[_0x11aaeb]={'$like':'%'+_0x2bfa1b['query'][_0xdb60('0x36')]+'%'};return _0x341ef;})});}_0x39d1e9=_[_0xdb60('0x37')]({},_0x39d1e9,_0x2bfa1b['options']);return _0x4f6f07['getDescriptions'](_0x39d1e9);}})[_0xdb60('0x21')](function(_0xaecaf8){if(_0xaecaf8){_0x4b8ae6=_0xaecaf8['length'];if(!_0x2bfa1b['query'][_0xdb60('0x32')]('nolimit')){_0x39d1e9['limit']=qs[_0xdb60('0x1c')](_0x2bfa1b['query'][_0xdb60('0x1c')]);_0x39d1e9[_0xdb60('0x1a')]=qs['offset'](_0x2bfa1b[_0xdb60('0x2c')][_0xdb60('0x1a')]);}return _0x4f6f07[_0xdb60('0x4b')](_0x39d1e9);}})[_0xdb60('0x21')](function(_0x2b604b){if(_0x2b604b){return _0x2b604b?{'count':_0x4b8ae6,'rows':_0x2b604b}:null;}})[_0xdb60('0x21')](respondWithResult(_0x41d526,null))[_0xdb60('0x44')](handleError(_0x41d526,null));};exports[_0xdb60('0x4d')]=function(_0x37016b,_0x1c290e,_0x4facad){var _0x3fb307={};var _0x54cda2={};var _0x13a441;var _0x4d1952;return db[_0xdb60('0x3a')][_0xdb60('0x47')]({'where':{'id':_0x37016b['params']['id']}})[_0xdb60('0x21')](handleEntityNotFound(_0x1c290e,null))[_0xdb60('0x21')](function(_0x4a65a7){if(_0x4a65a7){_0x13a441=_0x4a65a7;_0x54cda2['model']=_[_0xdb60('0x2d')](db['FreshsalesField']['rawAttributes']);_0x54cda2[_0xdb60('0x2c')]=_['keys'](_0x37016b[_0xdb60('0x2c')]);_0x54cda2[_0xdb60('0x2e')]=_[_0xdb60('0x2f')](_0x54cda2[_0xdb60('0x2b')],_0x54cda2[_0xdb60('0x2c')]);_0x3fb307['attributes']=_[_0xdb60('0x2f')](_0x54cda2[_0xdb60('0x2b')],qs[_0xdb60('0x31')](_0x37016b[_0xdb60('0x2c')][_0xdb60('0x31')]));_0x3fb307['attributes']=_0x3fb307[_0xdb60('0x30')][_0xdb60('0x48')]?_0x3fb307['attributes']:_0x54cda2[_0xdb60('0x2b')];_0x3fb307['order']=qs[_0xdb60('0x34')](_0x37016b['query'][_0xdb60('0x34')]);_0x3fb307['where']=qs[_0xdb60('0x2e')](_[_0xdb60('0x49')](_0x37016b[_0xdb60('0x2c')],_0x54cda2[_0xdb60('0x2e')]));if(_0x37016b['query']['filter']){_0x3fb307[_0xdb60('0x35')]=_[_0xdb60('0x37')](_0x3fb307[_0xdb60('0x35')],{'$or':_[_0xdb60('0x28')](_0x3fb307[_0xdb60('0x30')],function(_0x54e07b){var _0x5a8f28={};_0x5a8f28[_0x54e07b]={'$like':'%'+_0x37016b['query']['filter']+'%'};return _0x5a8f28;})});}_0x3fb307=_[_0xdb60('0x37')]({},_0x3fb307,_0x37016b[_0xdb60('0x40')]);return _0x13a441[_0xdb60('0x4d')](_0x3fb307);}})[_0xdb60('0x21')](function(_0x5b350f){if(_0x5b350f){_0x4d1952=_0x5b350f[_0xdb60('0x48')];if(!_0x37016b['query'][_0xdb60('0x32')](_0xdb60('0x4a'))){_0x3fb307[_0xdb60('0x1c')]=qs[_0xdb60('0x1c')](_0x37016b[_0xdb60('0x2c')][_0xdb60('0x1c')]);_0x3fb307[_0xdb60('0x1a')]=qs[_0xdb60('0x1a')](_0x37016b[_0xdb60('0x2c')][_0xdb60('0x1a')]);}return _0x13a441[_0xdb60('0x4d')](_0x3fb307);}})[_0xdb60('0x21')](function(_0x19e8f){if(_0x19e8f){return _0x19e8f?{'count':_0x4d1952,'rows':_0x19e8f}:null;}})[_0xdb60('0x21')](respondWithResult(_0x1c290e,null))[_0xdb60('0x44')](handleError(_0x1c290e,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 17e096e..76c4194 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 _0x7501=['./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x24702f,_0x381535){var _0x252a0c=function(_0x48fa2f){while(--_0x48fa2f){_0x24702f['push'](_0x24702f['shift']());}};_0x252a0c(++_0x381535);}(_0x7501,0x94));var _0x1750=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x7501[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0x1750('0x0'));var util=require(_0x1750('0x1'));var logger=require('../../config/logger')(_0x1750('0x2'));var moment=require(_0x1750('0x3'));var BPromise=require('bluebird');var rp=require(_0x1750('0x4'));var fs=require('fs');var path=require(_0x1750('0x5'));var rimraf=require(_0x1750('0x6'));var config=require(_0x1750('0x7'));var attributes=require(_0x1750('0x8'));module[_0x1750('0x9')]=function(_0x147de4,_0x1bbbfd){return _0x147de4[_0x1750('0xa')](_0x1750('0xb'),attributes,{'tableName':_0x1750('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x13e7=['../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','path'];(function(_0x37302b,_0x594a4e){var _0x13fee1=function(_0x40d113){while(--_0x40d113){_0x37302b['push'](_0x37302b['shift']());}};_0x13fee1(++_0x594a4e);}(_0x13e7,0x170));var _0x713e=function(_0x35007a,_0x58a0d4){_0x35007a=_0x35007a-0x0;var _0x574f68=_0x13e7[_0x35007a];return _0x574f68;};'use strict';var _=require(_0x713e('0x0'));var util=require(_0x713e('0x1'));var logger=require(_0x713e('0x2'))(_0x713e('0x3'));var moment=require(_0x713e('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x713e('0x5'));var rimraf=require('rimraf');var config=require(_0x713e('0x6'));var attributes=require(_0x713e('0x7'));module[_0x713e('0x8')]=function(_0x395151,_0x2956c8){return _0x395151[_0x713e('0x9')]('FreshsalesConfiguration',attributes,{'tableName':_0x713e('0xa'),'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 507c667..36247c1 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 _0x21d6=['client','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1d20e5,_0x3d4f74){var _0x14c8d3=function(_0x368a35){while(--_0x368a35){_0x1d20e5['push'](_0x1d20e5['shift']());}};_0x14c8d3(++_0x3d4f74);}(_0x21d6,0x1d8));var _0x621d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x21d6[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x621d('0x0'));var BPromise=require(_0x621d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x621d('0x2'));var db=require(_0x621d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x621d('0x4'))(_0x621d('0x5'));var config=require(_0x621d('0x6'));var jayson=require(_0x621d('0x7'));var client=jayson[_0x621d('0x8')][_0x621d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3adf0e,_0x3e5a50,_0x1b1257){return new BPromise(function(_0x1d4fb1,_0x1f7731){return client['request'](_0x3adf0e,_0x1b1257)[_0x621d('0xa')](function(_0x37da3c){logger[_0x621d('0xb')](_0x621d('0xc'),_0x3e5a50,_0x621d('0xd'));logger['debug'](_0x621d('0xe'),_0x3e5a50,_0x621d('0xd'),JSON[_0x621d('0xf')](_0x37da3c));if(_0x37da3c[_0x621d('0x10')]){if(_0x37da3c['error'][_0x621d('0x11')]===0x1f4){logger[_0x621d('0x10')](_0x621d('0xc'),_0x3e5a50,_0x37da3c[_0x621d('0x10')][_0x621d('0x12')]);return _0x1f7731(_0x37da3c[_0x621d('0x10')]['message']);}logger['error'](_0x621d('0xc'),_0x3e5a50,_0x37da3c[_0x621d('0x10')]['message']);return _0x1d4fb1(_0x37da3c[_0x621d('0x10')][_0x621d('0x12')]);}else{logger[_0x621d('0xb')](_0x621d('0xc'),_0x3e5a50,_0x621d('0xd'));_0x1d4fb1(_0x37da3c[_0x621d('0x13')][_0x621d('0x12')]);}})['catch'](function(_0x148415){logger['error'](_0x621d('0xc'),_0x3e5a50,_0x148415);_0x1f7731(_0x148415);});});} \ No newline at end of file +var _0x49c6=['client','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x57db3a,_0x32dc3f){var _0x18dc71=function(_0x426649){while(--_0x426649){_0x57db3a['push'](_0x57db3a['shift']());}};_0x18dc71(++_0x32dc3f);}(_0x49c6,0x172));var _0x649c=function(_0xdab40b,_0x353ba3){_0xdab40b=_0xdab40b-0x0;var _0x22e57a=_0x49c6[_0xdab40b];return _0x22e57a;};'use strict';var _=require(_0x649c('0x0'));var util=require(_0x649c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x649c('0x2'));var fs=require('fs');var Redis=require(_0x649c('0x3'));var db=require(_0x649c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x649c('0x5'))('rpc');var config=require(_0x649c('0x6'));var jayson=require(_0x649c('0x7'));var client=jayson[_0x649c('0x8')][_0x649c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2208ac,_0x45ec88,_0x451c1b){return new BPromise(function(_0x598252,_0xdcdd8){return client[_0x649c('0xa')](_0x2208ac,_0x451c1b)['then'](function(_0x21d566){logger[_0x649c('0xb')](_0x649c('0xc'),_0x45ec88,'request\x20sent');logger[_0x649c('0xd')](_0x649c('0xe'),_0x45ec88,_0x649c('0xf'),JSON[_0x649c('0x10')](_0x21d566));if(_0x21d566[_0x649c('0x11')]){if(_0x21d566[_0x649c('0x11')]['code']===0x1f4){logger['error'](_0x649c('0xc'),_0x45ec88,_0x21d566[_0x649c('0x11')][_0x649c('0x12')]);return _0xdcdd8(_0x21d566[_0x649c('0x11')]['message']);}logger[_0x649c('0x11')](_0x649c('0xc'),_0x45ec88,_0x21d566['error'][_0x649c('0x12')]);return _0x598252(_0x21d566[_0x649c('0x11')][_0x649c('0x12')]);}else{logger[_0x649c('0xb')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x45ec88,'request\x20sent');_0x598252(_0x21d566[_0x649c('0x13')][_0x649c('0x12')]);}})[_0x649c('0x14')](function(_0xe5d948){logger[_0x649c('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x45ec88,_0xe5d948);_0xdcdd8(_0xe5d948);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 38780b0..24eea5d 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 _0xb821=['put','update','delete','destroy','exports','util','path','Router','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x170793,_0x435c83){var _0x105880=function(_0x60dbfd){while(--_0x60dbfd){_0x170793['push'](_0x170793['shift']());}};_0x105880(++_0x435c83);}(_0xb821,0xa7));var _0x1b82=function(_0x1ab6f0,_0x350159){_0x1ab6f0=_0x1ab6f0-0x0;var _0x4747c3=_0xb821[_0x1ab6f0];return _0x4747c3;};'use strict';var multer=require('multer');var util=require(_0x1b82('0x0'));var path=require(_0x1b82('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1b82('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var controller=require(_0x1b82('0x5'));router[_0x1b82('0x6')]('/',auth['isAuthenticated'](),controller[_0x1b82('0x7')]);router[_0x1b82('0x6')](_0x1b82('0x8'),auth[_0x1b82('0x9')](),controller[_0x1b82('0xa')]);router[_0x1b82('0xb')]('/',auth[_0x1b82('0x9')](),controller[_0x1b82('0xc')]);router[_0x1b82('0xd')]('/:id',auth[_0x1b82('0x9')](),controller[_0x1b82('0xe')]);router[_0x1b82('0xf')](_0x1b82('0x8'),auth[_0x1b82('0x9')](),controller[_0x1b82('0x10')]);module[_0x1b82('0x11')]=router; \ No newline at end of file +var _0x7341=['update','delete','destroy','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x43f8ae,_0x3df6ec){var _0x4d72b0=function(_0x3c449a){while(--_0x3c449a){_0x43f8ae['push'](_0x43f8ae['shift']());}};_0x4d72b0(++_0x3df6ec);}(_0x7341,0xe4));var _0x1734=function(_0x188b99,_0x57c51c){_0x188b99=_0x188b99-0x0;var _0x1bc000=_0x7341[_0x188b99];return _0x1bc000;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1734('0x0'));var timeout=require('connect-timeout');var express=require(_0x1734('0x1'));var router=express[_0x1734('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x1734('0x3'));var interaction=require(_0x1734('0x4'));var config=require(_0x1734('0x5'));var controller=require(_0x1734('0x6'));router[_0x1734('0x7')]('/',auth[_0x1734('0x8')](),controller[_0x1734('0x9')]);router['get'](_0x1734('0xa'),auth[_0x1734('0x8')](),controller[_0x1734('0xb')]);router['post']('/',auth[_0x1734('0x8')](),controller['create']);router['put'](_0x1734('0xa'),auth[_0x1734('0x8')](),controller[_0x1734('0xc')]);router[_0x1734('0xd')](_0x1734('0xa'),auth[_0x1734('0x8')](),controller[_0x1734('0xe')]);module[_0x1734('0xf')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 6dd48b4..aa0d65c 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 _0xc970=['variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x2bd2cd,_0x463407){var _0x544621=function(_0x86fd5d){while(--_0x86fd5d){_0x2bd2cd['push'](_0x2bd2cd['shift']());}};_0x544621(++_0x463407);}(_0xc970,0xcf));var _0x0c97=function(_0x2c2d24,_0x2a1216){_0x2c2d24=_0x2c2d24-0x0;var _0x1db104=_0xc970[_0x2c2d24];return _0x1db104;};'use strict';var Sequelize=require(_0x0c97('0x0'));module[_0x0c97('0x1')]={'type':{'type':Sequelize[_0x0c97('0x2')]('string',_0x0c97('0x3'),_0x0c97('0x4'),_0x0c97('0x5'),_0x0c97('0x6')),'defaultValue':_0x0c97('0x7')},'content':{'type':Sequelize[_0x0c97('0x8')]},'key':{'type':Sequelize[_0x0c97('0x8')]},'keyType':{'type':Sequelize['ENUM']('string','variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x0c97('0x8')]},'nameField':{'type':Sequelize[_0x0c97('0x8')]},'customField':{'type':Sequelize[_0x0c97('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x59ea=['sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING'];(function(_0x45fbc5,_0x49c52f){var _0x31d5f9=function(_0xd073ec){while(--_0xd073ec){_0x45fbc5['push'](_0x45fbc5['shift']());}};_0x31d5f9(++_0x49c52f);}(_0x59ea,0xea));var _0xa59e=function(_0x56e1b3,_0xca670d){_0x56e1b3=_0x56e1b3-0x0;var _0xaccef4=_0x59ea[_0x56e1b3];return _0xaccef4;};'use strict';var Sequelize=require(_0xa59e('0x0'));module[_0xa59e('0x1')]={'type':{'type':Sequelize[_0xa59e('0x2')]('string',_0xa59e('0x3'),_0xa59e('0x4'),_0xa59e('0x5'),_0xa59e('0x6')),'defaultValue':_0xa59e('0x7')},'content':{'type':Sequelize[_0xa59e('0x8')]},'key':{'type':Sequelize[_0xa59e('0x8')]},'keyType':{'type':Sequelize[_0xa59e('0x2')](_0xa59e('0x7'),_0xa59e('0x3'),_0xa59e('0x4'))},'keyContent':{'type':Sequelize[_0xa59e('0x8')]},'idField':{'type':Sequelize[_0xa59e('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa59e('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index c0184dc..0055e1c 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 _0xee5d=['where','merge','map','VIRTUAL','options','findAll','rows','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','stack','name','send','index','FreshsalesField','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter'];(function(_0x2e0ffa,_0x451f12){var _0x24d627=function(_0x4d0f09){while(--_0x4d0f09){_0x2e0ffa['push'](_0x2e0ffa['shift']());}};_0x24d627(++_0x451f12);}(_0xee5d,0x131));var _0xdee5=function(_0x2e3ada,_0x16f2ac){_0x2e3ada=_0x2e3ada-0x0;var _0x10d41f=_0xee5d[_0x2e3ada];return _0x10d41f;};'use strict';var emlformat=require(_0xdee5('0x0'));var rimraf=require(_0xdee5('0x1'));var zipdir=require(_0xdee5('0x2'));var jsonpatch=require(_0xdee5('0x3'));var rp=require(_0xdee5('0x4'));var moment=require('moment');var BPromise=require(_0xdee5('0x5'));var Mustache=require(_0xdee5('0x6'));var util=require(_0xdee5('0x7'));var path=require('path');var sox=require(_0xdee5('0x8'));var csv=require(_0xdee5('0x9'));var ejs=require(_0xdee5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdee5('0xb'));var squel=require(_0xdee5('0xc'));var crypto=require('crypto');var jsforce=require(_0xdee5('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdee5('0xe'));var Redis=require(_0xdee5('0xf'));var authService=require(_0xdee5('0x10'));var qs=require(_0xdee5('0x11'));var as=require(_0xdee5('0x12'));var hardwareService=require(_0xdee5('0x13'));var logger=require(_0xdee5('0x14'))(_0xdee5('0x15'));var utils=require(_0xdee5('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdee5('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x139f02,_0x8ea456){_0x8ea456=_0x8ea456||0xcc;return function(_0xe69e16){if(_0xe69e16){return _0x139f02[_0xdee5('0x18')](_0x8ea456);}return _0x139f02[_0xdee5('0x19')](_0x8ea456)[_0xdee5('0x1a')]();};}function respondWithResult(_0x3639fc,_0x46cc87){_0x46cc87=_0x46cc87||0xc8;return function(_0x53acc6){if(_0x53acc6){return _0x3639fc[_0xdee5('0x19')](_0x46cc87)[_0xdee5('0x1b')](_0x53acc6);}};}function respondWithFilteredResult(_0x314175,_0x132f0e){return function(_0x472948){if(_0x472948){var _0x84a4d2=typeof _0x132f0e[_0xdee5('0x1c')]===_0xdee5('0x1d')&&typeof _0x132f0e[_0xdee5('0x1e')]===_0xdee5('0x1d');var _0x2b73e1=_0x472948[_0xdee5('0x1f')];var _0x44372e=_0x84a4d2?0x0:_0x132f0e[_0xdee5('0x1c')];var _0x18fcdf=_0x84a4d2?_0x472948['count']:_0x132f0e[_0xdee5('0x1c')]+_0x132f0e['limit'];var _0x4d006c;if(_0x18fcdf>=_0x2b73e1){_0x18fcdf=_0x2b73e1;_0x4d006c=0xc8;}else{_0x4d006c=0xce;}_0x314175[_0xdee5('0x19')](_0x4d006c);return _0x314175['set'](_0xdee5('0x20'),_0x44372e+'-'+_0x18fcdf+'/'+_0x2b73e1)[_0xdee5('0x1b')](_0x472948);}return null;};}function patchUpdates(_0x4cebc4){return function(_0x507004){try{jsonpatch['apply'](_0x507004,_0x4cebc4,!![]);}catch(_0x4e363a){return BPromise[_0xdee5('0x21')](_0x4e363a);}return _0x507004[_0xdee5('0x22')]();};}function saveUpdates(_0xdff0cf,_0x12a53b){return function(_0x544b2f){if(_0x544b2f){return _0x544b2f[_0xdee5('0x23')](_0xdff0cf)[_0xdee5('0x24')](function(_0x33db55){return _0x33db55;});}return null;};}function removeEntity(_0x142c9e,_0x10b8b4){return function(_0xb12c2b){if(_0xb12c2b){return _0xb12c2b[_0xdee5('0x25')]()[_0xdee5('0x24')](function(){_0x142c9e[_0xdee5('0x19')](0xcc)[_0xdee5('0x1a')]();});}};}function handleEntityNotFound(_0xb0839a,_0x24cd8a){return function(_0x5c455d){if(!_0x5c455d){_0xb0839a[_0xdee5('0x18')](0x194);}return _0x5c455d;};}function handleError(_0x50f455,_0x4c8b7c){_0x4c8b7c=_0x4c8b7c||0x1f4;return function(_0x1f5532){logger['error'](_0x1f5532[_0xdee5('0x26')]);if(_0x1f5532[_0xdee5('0x27')]){delete _0x1f5532[_0xdee5('0x27')];}_0x50f455[_0xdee5('0x19')](_0x4c8b7c)[_0xdee5('0x28')](_0x1f5532);};}exports[_0xdee5('0x29')]=function(_0x1f5749,_0x4c009a){var _0x185bf5={},_0x90256b={},_0x2a4026={'count':0x0,'rows':[]};var _0x513d9d=_['map'](db[_0xdee5('0x2a')][_0xdee5('0x2b')],function(_0x16a1a3){return{'name':_0x16a1a3[_0xdee5('0x2c')],'type':_0x16a1a3[_0xdee5('0x2d')][_0xdee5('0x2e')]};});_0x90256b['model']=_['map'](_0x513d9d,_0xdee5('0x27'));_0x90256b['query']=_[_0xdee5('0x2f')](_0x1f5749[_0xdee5('0x30')]);_0x90256b[_0xdee5('0x31')]=_[_0xdee5('0x32')](_0x90256b[_0xdee5('0x33')],_0x90256b['query']);_0x185bf5[_0xdee5('0x34')]=_[_0xdee5('0x32')](_0x90256b[_0xdee5('0x33')],qs[_0xdee5('0x35')](_0x1f5749[_0xdee5('0x30')][_0xdee5('0x35')]));_0x185bf5['attributes']=_0x185bf5[_0xdee5('0x34')][_0xdee5('0x36')]?_0x185bf5[_0xdee5('0x34')]:_0x90256b['model'];if(!_0x1f5749[_0xdee5('0x30')][_0xdee5('0x37')]('nolimit')){_0x185bf5[_0xdee5('0x1e')]=qs[_0xdee5('0x1e')](_0x1f5749[_0xdee5('0x30')][_0xdee5('0x1e')]);_0x185bf5[_0xdee5('0x1c')]=qs[_0xdee5('0x1c')](_0x1f5749[_0xdee5('0x30')][_0xdee5('0x1c')]);}_0x185bf5[_0xdee5('0x38')]=qs[_0xdee5('0x39')](_0x1f5749['query'][_0xdee5('0x39')]);_0x185bf5['where']=qs[_0xdee5('0x31')](_[_0xdee5('0x3a')](_0x1f5749['query'],_0x90256b[_0xdee5('0x31')]),_0x513d9d);if(_0x1f5749['query'][_0xdee5('0x3b')]){_0x185bf5[_0xdee5('0x3c')]=_[_0xdee5('0x3d')](_0x185bf5[_0xdee5('0x3c')],{'$or':_[_0xdee5('0x3e')](_0x513d9d,function(_0x3e097d){if(_0x3e097d['type']!==_0xdee5('0x3f')){var _0xddb2d4={};_0xddb2d4[_0x3e097d['name']]={'$like':'%'+_0x1f5749[_0xdee5('0x30')][_0xdee5('0x3b')]+'%'};return _0xddb2d4;}})});}_0x185bf5=_[_0xdee5('0x3d')]({},_0x185bf5,_0x1f5749[_0xdee5('0x40')]);var _0x176ea4={'where':_0x185bf5['where']};return db['FreshsalesField']['count'](_0x176ea4)['then'](function(_0x5d3075){_0x2a4026[_0xdee5('0x1f')]=_0x5d3075;if(_0x1f5749['query']['includeAll']){_0x185bf5['include']=[{'all':!![]}];}return db[_0xdee5('0x2a')][_0xdee5('0x41')](_0x185bf5);})[_0xdee5('0x24')](function(_0x486c20){_0x2a4026[_0xdee5('0x42')]=_0x486c20;return _0x2a4026;})[_0xdee5('0x24')](respondWithFilteredResult(_0x4c009a,_0x185bf5))[_0xdee5('0x43')](handleError(_0x4c009a,null));};exports[_0xdee5('0x44')]=function(_0xb883fe,_0xe8e437){var _0x5b3d3c={'raw':!![],'where':{'id':_0xb883fe[_0xdee5('0x45')]['id']}},_0x1a10fb={};_0x1a10fb[_0xdee5('0x33')]=_['keys'](db[_0xdee5('0x2a')]['rawAttributes']);_0x1a10fb[_0xdee5('0x30')]=_[_0xdee5('0x2f')](_0xb883fe[_0xdee5('0x30')]);_0x1a10fb[_0xdee5('0x31')]=_['intersection'](_0x1a10fb[_0xdee5('0x33')],_0x1a10fb[_0xdee5('0x30')]);_0x5b3d3c[_0xdee5('0x34')]=_[_0xdee5('0x32')](_0x1a10fb[_0xdee5('0x33')],qs[_0xdee5('0x35')](_0xb883fe[_0xdee5('0x30')][_0xdee5('0x35')]));_0x5b3d3c[_0xdee5('0x34')]=_0x5b3d3c[_0xdee5('0x34')][_0xdee5('0x36')]?_0x5b3d3c['attributes']:_0x1a10fb['model'];if(_0xb883fe[_0xdee5('0x30')]['includeAll']){_0x5b3d3c['include']=[{'all':!![]}];}_0x5b3d3c=_['merge']({},_0x5b3d3c,_0xb883fe[_0xdee5('0x40')]);return db['FreshsalesField']['find'](_0x5b3d3c)[_0xdee5('0x24')](handleEntityNotFound(_0xe8e437,null))[_0xdee5('0x24')](respondWithResult(_0xe8e437,null))[_0xdee5('0x43')](handleError(_0xe8e437,null));};exports[_0xdee5('0x46')]=function(_0x8f3e35,_0x50707b){return db[_0xdee5('0x2a')]['create'](_0x8f3e35[_0xdee5('0x47')],{})[_0xdee5('0x24')](respondWithResult(_0x50707b,0xc9))['catch'](handleError(_0x50707b,null));};exports[_0xdee5('0x23')]=function(_0x2ff621,_0x347d56){if(_0x2ff621[_0xdee5('0x47')]['id']){delete _0x2ff621[_0xdee5('0x47')]['id'];}return db['FreshsalesField'][_0xdee5('0x48')]({'where':{'id':_0x2ff621[_0xdee5('0x45')]['id']}})[_0xdee5('0x24')](handleEntityNotFound(_0x347d56,null))[_0xdee5('0x24')](saveUpdates(_0x2ff621['body'],null))[_0xdee5('0x24')](respondWithResult(_0x347d56,null))[_0xdee5('0x43')](handleError(_0x347d56,null));};exports[_0xdee5('0x25')]=function(_0x1ae985,_0x32f622){return db[_0xdee5('0x2a')][_0xdee5('0x48')]({'where':{'id':_0x1ae985[_0xdee5('0x45')]['id']}})[_0xdee5('0x24')](handleEntityNotFound(_0x32f622,null))[_0xdee5('0x24')](removeEntity(_0x32f622,null))[_0xdee5('0x43')](handleError(_0x32f622,null));}; \ No newline at end of file +var _0x414c=['include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','FreshsalesField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll'];(function(_0x5b9874,_0x327bd2){var _0x3c38ff=function(_0x44dd30){while(--_0x44dd30){_0x5b9874['push'](_0x5b9874['shift']());}};_0x3c38ff(++_0x327bd2);}(_0x414c,0xea));var _0xc414=function(_0x3dfcd8,_0x1eb1ab){_0x3dfcd8=_0x3dfcd8-0x0;var _0x1c35ac=_0x414c[_0x3dfcd8];return _0x1c35ac;};'use strict';var emlformat=require(_0xc414('0x0'));var rimraf=require(_0xc414('0x1'));var zipdir=require(_0xc414('0x2'));var jsonpatch=require(_0xc414('0x3'));var rp=require('request-promise');var moment=require(_0xc414('0x4'));var BPromise=require(_0xc414('0x5'));var Mustache=require('mustache');var util=require(_0xc414('0x6'));var path=require('path');var sox=require(_0xc414('0x7'));var csv=require(_0xc414('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc414('0x9'));var _=require(_0xc414('0xa'));var squel=require(_0xc414('0xb'));var crypto=require(_0xc414('0xc'));var jsforce=require(_0xc414('0xd'));var deskjs=require(_0xc414('0xe'));var toCsv=require(_0xc414('0x8'));var querystring=require('querystring');var Papa=require(_0xc414('0xf'));var Redis=require(_0xc414('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc414('0x11'));var as=require(_0xc414('0x12'));var hardwareService=require(_0xc414('0x13'));var logger=require(_0xc414('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xc414('0x15'));var licenseUtil=require(_0xc414('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29f738,_0xe186b3){_0xe186b3=_0xe186b3||0xcc;return function(_0x293538){if(_0x293538){return _0x29f738[_0xc414('0x17')](_0xe186b3);}return _0x29f738[_0xc414('0x18')](_0xe186b3)[_0xc414('0x19')]();};}function respondWithResult(_0x43e01c,_0x5894f6){_0x5894f6=_0x5894f6||0xc8;return function(_0x2c234a){if(_0x2c234a){return _0x43e01c[_0xc414('0x18')](_0x5894f6)[_0xc414('0x1a')](_0x2c234a);}};}function respondWithFilteredResult(_0x1a98af,_0x7e4d06){return function(_0x44cba2){if(_0x44cba2){var _0x2581ac=typeof _0x7e4d06['offset']===_0xc414('0x1b')&&typeof _0x7e4d06[_0xc414('0x1c')]===_0xc414('0x1b');var _0x5eccd1=_0x44cba2[_0xc414('0x1d')];var _0x41c0bc=_0x2581ac?0x0:_0x7e4d06[_0xc414('0x1e')];var _0x5d7a2d=_0x2581ac?_0x44cba2[_0xc414('0x1d')]:_0x7e4d06[_0xc414('0x1e')]+_0x7e4d06['limit'];var _0x1165f5;if(_0x5d7a2d>=_0x5eccd1){_0x5d7a2d=_0x5eccd1;_0x1165f5=0xc8;}else{_0x1165f5=0xce;}_0x1a98af[_0xc414('0x18')](_0x1165f5);return _0x1a98af['set'](_0xc414('0x1f'),_0x41c0bc+'-'+_0x5d7a2d+'/'+_0x5eccd1)[_0xc414('0x1a')](_0x44cba2);}return null;};}function patchUpdates(_0x4e8dff){return function(_0x59ef37){try{jsonpatch[_0xc414('0x20')](_0x59ef37,_0x4e8dff,!![]);}catch(_0x5ab909){return BPromise[_0xc414('0x21')](_0x5ab909);}return _0x59ef37[_0xc414('0x22')]();};}function saveUpdates(_0x43b693,_0x3523e7){return function(_0xccc059){if(_0xccc059){return _0xccc059[_0xc414('0x23')](_0x43b693)[_0xc414('0x24')](function(_0x4db0d0){return _0x4db0d0;});}return null;};}function removeEntity(_0x20f002,_0x54560a){return function(_0x58973b){if(_0x58973b){return _0x58973b[_0xc414('0x25')]()['then'](function(){_0x20f002['status'](0xcc)[_0xc414('0x19')]();});}};}function handleEntityNotFound(_0x10ae74,_0x5bcd2e){return function(_0x178e0e){if(!_0x178e0e){_0x10ae74['sendStatus'](0x194);}return _0x178e0e;};}function handleError(_0x47fa13,_0x15a2a1){_0x15a2a1=_0x15a2a1||0x1f4;return function(_0xe9b03a){logger[_0xc414('0x26')](_0xe9b03a[_0xc414('0x27')]);if(_0xe9b03a[_0xc414('0x28')]){delete _0xe9b03a['name'];}_0x47fa13['status'](_0x15a2a1)[_0xc414('0x29')](_0xe9b03a);};}exports['index']=function(_0x322467,_0x5297a1){var _0xf2797b={},_0x10de46={},_0x466a0e={'count':0x0,'rows':[]};var _0x2fb141=_[_0xc414('0x2a')](db[_0xc414('0x2b')][_0xc414('0x2c')],function(_0x42392e){return{'name':_0x42392e[_0xc414('0x2d')],'type':_0x42392e[_0xc414('0x2e')][_0xc414('0x2f')]};});_0x10de46['model']=_[_0xc414('0x2a')](_0x2fb141,_0xc414('0x28'));_0x10de46[_0xc414('0x30')]=_[_0xc414('0x31')](_0x322467['query']);_0x10de46[_0xc414('0x32')]=_[_0xc414('0x33')](_0x10de46[_0xc414('0x34')],_0x10de46['query']);_0xf2797b[_0xc414('0x35')]=_[_0xc414('0x33')](_0x10de46[_0xc414('0x34')],qs['fields'](_0x322467[_0xc414('0x30')][_0xc414('0x36')]));_0xf2797b[_0xc414('0x35')]=_0xf2797b[_0xc414('0x35')][_0xc414('0x37')]?_0xf2797b[_0xc414('0x35')]:_0x10de46['model'];if(!_0x322467[_0xc414('0x30')][_0xc414('0x38')](_0xc414('0x39'))){_0xf2797b['limit']=qs[_0xc414('0x1c')](_0x322467[_0xc414('0x30')][_0xc414('0x1c')]);_0xf2797b[_0xc414('0x1e')]=qs['offset'](_0x322467[_0xc414('0x30')][_0xc414('0x1e')]);}_0xf2797b[_0xc414('0x3a')]=qs[_0xc414('0x3b')](_0x322467['query']['sort']);_0xf2797b['where']=qs[_0xc414('0x32')](_[_0xc414('0x3c')](_0x322467[_0xc414('0x30')],_0x10de46[_0xc414('0x32')]),_0x2fb141);if(_0x322467['query'][_0xc414('0x3d')]){_0xf2797b[_0xc414('0x3e')]=_[_0xc414('0x3f')](_0xf2797b[_0xc414('0x3e')],{'$or':_[_0xc414('0x2a')](_0x2fb141,function(_0x1cd221){if(_0x1cd221[_0xc414('0x2e')]!=='VIRTUAL'){var _0x3b05b3={};_0x3b05b3[_0x1cd221[_0xc414('0x28')]]={'$like':'%'+_0x322467[_0xc414('0x30')][_0xc414('0x3d')]+'%'};return _0x3b05b3;}})});}_0xf2797b=_[_0xc414('0x3f')]({},_0xf2797b,_0x322467[_0xc414('0x40')]);var _0x68f616={'where':_0xf2797b[_0xc414('0x3e')]};return db[_0xc414('0x2b')][_0xc414('0x1d')](_0x68f616)[_0xc414('0x24')](function(_0x5e8954){_0x466a0e[_0xc414('0x1d')]=_0x5e8954;if(_0x322467[_0xc414('0x30')][_0xc414('0x41')]){_0xf2797b[_0xc414('0x42')]=[{'all':!![]}];}return db[_0xc414('0x2b')][_0xc414('0x43')](_0xf2797b);})[_0xc414('0x24')](function(_0x2f4c8d){_0x466a0e[_0xc414('0x44')]=_0x2f4c8d;return _0x466a0e;})[_0xc414('0x24')](respondWithFilteredResult(_0x5297a1,_0xf2797b))[_0xc414('0x45')](handleError(_0x5297a1,null));};exports[_0xc414('0x46')]=function(_0x1b43d7,_0x33c4ce){var _0x60d659={'raw':!![],'where':{'id':_0x1b43d7[_0xc414('0x47')]['id']}},_0x5b7171={};_0x5b7171[_0xc414('0x34')]=_[_0xc414('0x31')](db['FreshsalesField']['rawAttributes']);_0x5b7171[_0xc414('0x30')]=_[_0xc414('0x31')](_0x1b43d7[_0xc414('0x30')]);_0x5b7171[_0xc414('0x32')]=_['intersection'](_0x5b7171[_0xc414('0x34')],_0x5b7171[_0xc414('0x30')]);_0x60d659[_0xc414('0x35')]=_[_0xc414('0x33')](_0x5b7171[_0xc414('0x34')],qs[_0xc414('0x36')](_0x1b43d7['query']['fields']));_0x60d659['attributes']=_0x60d659['attributes'][_0xc414('0x37')]?_0x60d659[_0xc414('0x35')]:_0x5b7171[_0xc414('0x34')];if(_0x1b43d7[_0xc414('0x30')][_0xc414('0x41')]){_0x60d659[_0xc414('0x42')]=[{'all':!![]}];}_0x60d659=_['merge']({},_0x60d659,_0x1b43d7['options']);return db[_0xc414('0x2b')][_0xc414('0x48')](_0x60d659)[_0xc414('0x24')](handleEntityNotFound(_0x33c4ce,null))[_0xc414('0x24')](respondWithResult(_0x33c4ce,null))[_0xc414('0x45')](handleError(_0x33c4ce,null));};exports[_0xc414('0x49')]=function(_0x2825ed,_0x264572){return db[_0xc414('0x2b')][_0xc414('0x49')](_0x2825ed['body'],{})['then'](respondWithResult(_0x264572,0xc9))[_0xc414('0x45')](handleError(_0x264572,null));};exports['update']=function(_0x3ea255,_0x1affb7){if(_0x3ea255[_0xc414('0x4a')]['id']){delete _0x3ea255[_0xc414('0x4a')]['id'];}return db[_0xc414('0x2b')][_0xc414('0x48')]({'where':{'id':_0x3ea255['params']['id']}})[_0xc414('0x24')](handleEntityNotFound(_0x1affb7,null))[_0xc414('0x24')](saveUpdates(_0x3ea255[_0xc414('0x4a')],null))[_0xc414('0x24')](respondWithResult(_0x1affb7,null))['catch'](handleError(_0x1affb7,null));};exports['destroy']=function(_0x689b1a,_0x26010d){return db[_0xc414('0x2b')]['find']({'where':{'id':_0x689b1a[_0xc414('0x47')]['id']}})['then'](handleEntityNotFound(_0x26010d,null))[_0xc414('0x24')](removeEntity(_0x26010d,null))[_0xc414('0x45')](handleError(_0x26010d,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 33e5d9f..ae196e1 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 _0x4dcb=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId'];(function(_0x42c7bb,_0x5ad639){var _0x56c70f=function(_0x1ae0e6){while(--_0x1ae0e6){_0x42c7bb['push'](_0x42c7bb['shift']());}};_0x56c70f(++_0x5ad639);}(_0x4dcb,0x186));var _0xb4dc=function(_0x5c87bf,_0x38e2c9){_0x5c87bf=_0x5c87bf-0x0;var _0x411aaa=_0x4dcb[_0x5c87bf];return _0x411aaa;};'use strict';var _=require('lodash');var util=require(_0xb4dc('0x0'));var logger=require(_0xb4dc('0x1'))(_0xb4dc('0x2'));var moment=require(_0xb4dc('0x3'));var BPromise=require(_0xb4dc('0x4'));var rp=require(_0xb4dc('0x5'));var fs=require('fs');var path=require(_0xb4dc('0x6'));var rimraf=require(_0xb4dc('0x7'));var config=require(_0xb4dc('0x8'));var attributes=require('./intFreshsalesField.attributes');module['exports']=function(_0x244be0,_0x5be4d1){return _0x244be0[_0xb4dc('0x9')](_0xb4dc('0xa'),attributes,{'tableName':_0xb4dc('0xb'),'paranoid':![],'indexes':[{'name':_0xb4dc('0xc'),'fields':[_0xb4dc('0xd'),_0xb4dc('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6343=['../../config/logger','api','rimraf','../../config/environment','exports','define','FreshsalesField','idField','FieldId'];(function(_0x144114,_0x5f0b0d){var _0x2d84f5=function(_0x2a71c8){while(--_0x2a71c8){_0x144114['push'](_0x144114['shift']());}};_0x2d84f5(++_0x5f0b0d);}(_0x6343,0x168));var _0x3634=function(_0x251b79,_0x256a24){_0x251b79=_0x251b79-0x0;var _0x23a1dc=_0x6343[_0x251b79];return _0x23a1dc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3634('0x0'))(_0x3634('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3634('0x2'));var config=require(_0x3634('0x3'));var attributes=require('./intFreshsalesField.attributes');module[_0x3634('0x4')]=function(_0x388c18,_0x4bb496){return _0x388c18[_0x3634('0x5')](_0x3634('0x6'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x3634('0x7'),_0x3634('0x8')],'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 eb3e595..390483d 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.rpc.js +++ b/server/api/intFreshsalesField/intFreshsalesField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafc4=['error','code','message','request\x20sent','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x296452,_0xe82241){var _0x25de68=function(_0x158422){while(--_0x158422){_0x296452['push'](_0x296452['shift']());}};_0x25de68(++_0xe82241);}(_0xafc4,0x69));var _0x4afc=function(_0x400135,_0x565175){_0x400135=_0x400135-0x0;var _0x24aadb=_0xafc4[_0x400135];return _0x24aadb;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var moment=require(_0x4afc('0x1'));var BPromise=require('bluebird');var rs=require(_0x4afc('0x2'));var fs=require('fs');var Redis=require(_0x4afc('0x3'));var db=require(_0x4afc('0x4'))['db'];var utils=require(_0x4afc('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4afc('0x6'));var client=jayson[_0x4afc('0x7')][_0x4afc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1bb281,_0xc828d9,_0xaf053d){return new BPromise(function(_0x5e1e29,_0x31e165){return client[_0x4afc('0x9')](_0x1bb281,_0xaf053d)[_0x4afc('0xa')](function(_0x1e6bf5){logger[_0x4afc('0xb')](_0x4afc('0xc'),_0xc828d9,'request\x20sent');logger['debug'](_0x4afc('0xd'),_0xc828d9,'request\x20sent',JSON[_0x4afc('0xe')](_0x1e6bf5));if(_0x1e6bf5[_0x4afc('0xf')]){if(_0x1e6bf5['error'][_0x4afc('0x10')]===0x1f4){logger[_0x4afc('0xf')](_0x4afc('0xc'),_0xc828d9,_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);return _0x31e165(_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);}logger[_0x4afc('0xf')]('FreshsalesField,\x20%s,\x20%s',_0xc828d9,_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);return _0x5e1e29(_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0xc828d9,_0x4afc('0x12'));_0x5e1e29(_0x1e6bf5['result'][_0x4afc('0x11')]);}})[_0x4afc('0x13')](function(_0x2b928b){logger[_0x4afc('0xf')](_0x4afc('0xc'),_0xc828d9,_0x2b928b);_0x31e165(_0x2b928b);});});} \ No newline at end of file +var _0x2eb2=['request','then','info','request\x20sent','error','FreshsalesField,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http'];(function(_0x4893e6,_0x4f8f52){var _0x2f40d=function(_0x3df551){while(--_0x3df551){_0x4893e6['push'](_0x4893e6['shift']());}};_0x2f40d(++_0x4f8f52);}(_0x2eb2,0x19f));var _0x22eb=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x2eb2[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var moment=require(_0x22eb('0x1'));var BPromise=require(_0x22eb('0x2'));var rs=require(_0x22eb('0x3'));var fs=require('fs');var Redis=require(_0x22eb('0x4'));var db=require(_0x22eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x22eb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x22eb('0x7'));var client=jayson[_0x22eb('0x8')][_0x22eb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a9850,_0x4539d0,_0x396806){return new BPromise(function(_0x33ddef,_0x3375d6){return client[_0x22eb('0xa')](_0x2a9850,_0x396806)[_0x22eb('0xb')](function(_0xb9c8a4){logger[_0x22eb('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x4539d0,_0x22eb('0xd'));logger['debug']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x4539d0,_0x22eb('0xd'),JSON['stringify'](_0xb9c8a4));if(_0xb9c8a4[_0x22eb('0xe')]){if(_0xb9c8a4[_0x22eb('0xe')]['code']===0x1f4){logger['error'](_0x22eb('0xf'),_0x4539d0,_0xb9c8a4[_0x22eb('0xe')][_0x22eb('0x10')]);return _0x3375d6(_0xb9c8a4[_0x22eb('0xe')][_0x22eb('0x10')]);}logger['error'](_0x22eb('0xf'),_0x4539d0,_0xb9c8a4['error'][_0x22eb('0x10')]);return _0x33ddef(_0xb9c8a4['error'][_0x22eb('0x10')]);}else{logger[_0x22eb('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x4539d0,'request\x20sent');_0x33ddef(_0xb9c8a4['result'][_0x22eb('0x10')]);}})['catch'](function(_0x50176d){logger[_0x22eb('0xe')]('FreshsalesField,\x20%s,\x20%s',_0x4539d0,_0x50176d);_0x3375d6(_0x50176d);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 3b4115e..13c7dee 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(_0x44ef27,_0x1603a9){var _0x151c3e=function(_0x38ed07){while(--_0x38ed07){_0x44ef27['push'](_0x44ef27['shift']());}};_0x151c3e(++_0x1603a9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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(_0xece158,_0x56b838){var _0x513ad8=function(_0x500974){while(--_0x500974){_0xece158['push'](_0xece158['shift']());}};_0x513ad8(++_0x56b838);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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 98ba8b5..e8764db 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 _0xa7b5=['username','ENUM','integrationTab','newTab','sequelize','STRING'];(function(_0x2bf43b,_0x3f5828){var _0x498745=function(_0x1c54b5){while(--_0x1c54b5){_0x2bf43b['push'](_0x2bf43b['shift']());}};_0x498745(++_0x3f5828);}(_0xa7b5,0x15a));var _0x5a7b=function(_0xe50194,_0x3646f0){_0xe50194=_0xe50194-0x0;var _0x349bbf=_0xa7b5[_0xe50194];return _0x349bbf;};'use strict';var Sequelize=require(_0x5a7b('0x0'));module['exports']={'name':{'type':Sequelize[_0x5a7b('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x5a7b('0x1')],'unique':_0x5a7b('0x2')},'remoteUri':{'type':Sequelize[_0x5a7b('0x1')]},'password':{'type':Sequelize[_0x5a7b('0x1')]},'clientId':{'type':Sequelize[_0x5a7b('0x1')]},'clientSecret':{'type':Sequelize[_0x5a7b('0x1')]},'securityToken':{'type':Sequelize[_0x5a7b('0x1')]},'serverUrl':{'type':Sequelize[_0x5a7b('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5a7b('0x3')](_0x5a7b('0x4'),_0x5a7b('0x5')),'defaultValue':_0x5a7b('0x4')}}; \ No newline at end of file +var _0xc4af=['username','ENUM','integrationTab','newTab','sequelize','STRING'];(function(_0x5d145c,_0x4ba451){var _0x1d1d58=function(_0x12664a){while(--_0x12664a){_0x5d145c['push'](_0x5d145c['shift']());}};_0x1d1d58(++_0x4ba451);}(_0xc4af,0x88));var _0xfc4a=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xc4af[_0x491a7f];return _0x3d8f44;};'use strict';var Sequelize=require(_0xfc4a('0x0'));module['exports']={'name':{'type':Sequelize[_0xfc4a('0x1')]},'description':{'type':Sequelize[_0xfc4a('0x1')]},'username':{'type':Sequelize[_0xfc4a('0x1')],'unique':_0xfc4a('0x2')},'remoteUri':{'type':Sequelize[_0xfc4a('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xfc4a('0x1')]},'clientSecret':{'type':Sequelize[_0xfc4a('0x1')]},'securityToken':{'type':Sequelize[_0xfc4a('0x1')]},'serverUrl':{'type':Sequelize[_0xfc4a('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xfc4a('0x3')](_0xfc4a('0x4'),_0xfc4a('0x5')),'defaultValue':_0xfc4a('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 07c4040..7ec805c 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 _0xcc3a=['show','keys','rawAttributes','include','find','create','body','update','params','getConfigurations','findOne','AccountId','Subjects','getSubjects','getDescriptions','channel','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','password','securityToken','slice','lastIndexOf','Connection','username','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','string','int','boolean','email','textarea','remove','includes','custom','picklistValues','label','True','true','test','statusCode','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','SalesforceAccount','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','catch'];(function(_0x49b528,_0x191943){var _0x5b2f27=function(_0x27c4c0){while(--_0x27c4c0){_0x49b528['push'](_0x49b528['shift']());}};_0x5b2f27(++_0x191943);}(_0xcc3a,0x1a8));var _0xacc3=function(_0x2a5099,_0x329e92){_0x2a5099=_0x2a5099-0x0;var _0x2802f1=_0xcc3a[_0x2a5099];return _0x2802f1;};'use strict';var emlformat=require(_0xacc3('0x0'));var rimraf=require(_0xacc3('0x1'));var zipdir=require(_0xacc3('0x2'));var jsonpatch=require(_0xacc3('0x3'));var rp=require(_0xacc3('0x4'));var moment=require(_0xacc3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xacc3('0x6'));var util=require(_0xacc3('0x7'));var path=require(_0xacc3('0x8'));var sox=require(_0xacc3('0x9'));var csv=require(_0xacc3('0xa'));var ejs=require(_0xacc3('0xb'));var fs=require('fs');var fs_extra=require(_0xacc3('0xc'));var _=require('lodash');var squel=require(_0xacc3('0xd'));var crypto=require(_0xacc3('0xe'));var jsforce=require(_0xacc3('0xf'));var deskjs=require(_0xacc3('0x10'));var toCsv=require(_0xacc3('0xa'));var querystring=require('querystring');var Papa=require(_0xacc3('0x11'));var Redis=require(_0xacc3('0x12'));var authService=require(_0xacc3('0x13'));var qs=require(_0xacc3('0x14'));var as=require(_0xacc3('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xacc3('0x16'))(_0xacc3('0x17'));var utils=require(_0xacc3('0x18'));var config=require(_0xacc3('0x19'));var licenseUtil=require(_0xacc3('0x1a'));var db=require(_0xacc3('0x1b'))['db'];var integrations=require(_0xacc3('0x1c'));function respondWithStatusCode(_0x1f41aa,_0x579354){_0x579354=_0x579354||0xcc;return function(_0x415ceb){if(_0x415ceb){return _0x1f41aa[_0xacc3('0x1d')](_0x579354);}return _0x1f41aa['status'](_0x579354)[_0xacc3('0x1e')]();};}function respondWithResult(_0x37ab1,_0xa59c9d){_0xa59c9d=_0xa59c9d||0xc8;return function(_0x4b50cc){if(_0x4b50cc){return _0x37ab1['status'](_0xa59c9d)[_0xacc3('0x1f')](_0x4b50cc);}};}function respondWithFilteredResult(_0x3cb73d,_0x28658a){return function(_0x18a72c){if(_0x18a72c){var _0x1f6ac6=typeof _0x28658a[_0xacc3('0x20')]===_0xacc3('0x21')&&typeof _0x28658a[_0xacc3('0x22')]==='undefined';var _0x3463f5=_0x18a72c[_0xacc3('0x23')];var _0x20456c=_0x1f6ac6?0x0:_0x28658a['offset'];var _0x56fe21=_0x1f6ac6?_0x18a72c[_0xacc3('0x23')]:_0x28658a[_0xacc3('0x20')]+_0x28658a['limit'];var _0x13e43a;if(_0x56fe21>=_0x3463f5){_0x56fe21=_0x3463f5;_0x13e43a=0xc8;}else{_0x13e43a=0xce;}_0x3cb73d[_0xacc3('0x24')](_0x13e43a);return _0x3cb73d[_0xacc3('0x25')](_0xacc3('0x26'),_0x20456c+'-'+_0x56fe21+'/'+_0x3463f5)['json'](_0x18a72c);}return null;};}function patchUpdates(_0xee7b71){return function(_0x18af72){try{jsonpatch['apply'](_0x18af72,_0xee7b71,!![]);}catch(_0x31e4a5){return BPromise[_0xacc3('0x27')](_0x31e4a5);}return _0x18af72[_0xacc3('0x28')]();};}function saveUpdates(_0x7dde2b,_0x55857e){return function(_0x3984d0){if(_0x3984d0){return _0x3984d0['update'](_0x7dde2b)[_0xacc3('0x29')](function(_0x274c84){return _0x274c84;});}return null;};}function removeEntity(_0x22b97e,_0x3f3356){return function(_0x33a7bd){if(_0x33a7bd){return _0x33a7bd[_0xacc3('0x2a')]()[_0xacc3('0x29')](function(){_0x22b97e[_0xacc3('0x24')](0xcc)[_0xacc3('0x1e')]();});}};}function handleEntityNotFound(_0x1e62f3,_0x4bbcb7){return function(_0x3dd42e){if(!_0x3dd42e){_0x1e62f3[_0xacc3('0x1d')](0x194);}return _0x3dd42e;};}function handleError(_0xef935c,_0x45a5fd){_0x45a5fd=_0x45a5fd||0x1f4;return function(_0x506ee7){logger[_0xacc3('0x2b')](_0x506ee7[_0xacc3('0x2c')]);if(_0x506ee7['name']){delete _0x506ee7[_0xacc3('0x2d')];}_0xef935c['status'](_0x45a5fd)[_0xacc3('0x2e')](_0x506ee7);};}exports[_0xacc3('0x2f')]=function(_0x2b2762,_0x5953ba){var _0xd1f5c0={},_0x1f481d={},_0x3b9926={'count':0x0,'rows':[]};var _0x2e6f58=_[_0xacc3('0x30')](db[_0xacc3('0x31')]['rawAttributes'],function(_0x400bd7){return{'name':_0x400bd7[_0xacc3('0x32')],'type':_0x400bd7[_0xacc3('0x33')][_0xacc3('0x34')]};});_0x1f481d[_0xacc3('0x35')]=_['map'](_0x2e6f58,_0xacc3('0x2d'));_0x1f481d[_0xacc3('0x36')]=_['keys'](_0x2b2762[_0xacc3('0x36')]);_0x1f481d['filters']=_[_0xacc3('0x37')](_0x1f481d[_0xacc3('0x35')],_0x1f481d['query']);_0xd1f5c0[_0xacc3('0x38')]=_[_0xacc3('0x37')](_0x1f481d[_0xacc3('0x35')],qs[_0xacc3('0x39')](_0x2b2762[_0xacc3('0x36')]['fields']));_0xd1f5c0[_0xacc3('0x38')]=_0xd1f5c0[_0xacc3('0x38')][_0xacc3('0x3a')]?_0xd1f5c0['attributes']:_0x1f481d[_0xacc3('0x35')];if(!_0x2b2762[_0xacc3('0x36')][_0xacc3('0x3b')](_0xacc3('0x3c'))){_0xd1f5c0[_0xacc3('0x22')]=qs[_0xacc3('0x22')](_0x2b2762[_0xacc3('0x36')][_0xacc3('0x22')]);_0xd1f5c0['offset']=qs[_0xacc3('0x20')](_0x2b2762[_0xacc3('0x36')][_0xacc3('0x20')]);}_0xd1f5c0[_0xacc3('0x3d')]=qs[_0xacc3('0x3e')](_0x2b2762['query'][_0xacc3('0x3e')]);_0xd1f5c0[_0xacc3('0x3f')]=qs[_0xacc3('0x40')](_[_0xacc3('0x41')](_0x2b2762[_0xacc3('0x36')],_0x1f481d['filters']),_0x2e6f58);if(_0x2b2762['query'][_0xacc3('0x42')]){_0xd1f5c0['where']=_[_0xacc3('0x43')](_0xd1f5c0['where'],{'$or':_[_0xacc3('0x30')](_0x2e6f58,function(_0x41e0ce){if(_0x41e0ce[_0xacc3('0x33')]!==_0xacc3('0x44')){var _0x1fa46e={};_0x1fa46e[_0x41e0ce[_0xacc3('0x2d')]]={'$like':'%'+_0x2b2762[_0xacc3('0x36')][_0xacc3('0x42')]+'%'};return _0x1fa46e;}})});}_0xd1f5c0=_[_0xacc3('0x43')]({},_0xd1f5c0,_0x2b2762[_0xacc3('0x45')]);var _0x27f53c={'where':_0xd1f5c0[_0xacc3('0x3f')]};return db[_0xacc3('0x31')][_0xacc3('0x23')](_0x27f53c)[_0xacc3('0x29')](function(_0x1becfa){_0x3b9926['count']=_0x1becfa;if(_0x2b2762[_0xacc3('0x36')][_0xacc3('0x46')]){_0xd1f5c0['include']=[{'all':!![]}];}return db[_0xacc3('0x31')]['findAll'](_0xd1f5c0);})['then'](function(_0x4a33c4){_0x3b9926['rows']=_0x4a33c4;return _0x3b9926;})[_0xacc3('0x29')](respondWithFilteredResult(_0x5953ba,_0xd1f5c0))[_0xacc3('0x47')](handleError(_0x5953ba,null));};exports[_0xacc3('0x48')]=function(_0x135f44,_0x19aabd){var _0x4ca8f8={'raw':![],'where':{'id':_0x135f44['params']['id']}},_0x4b3824={};_0x4b3824[_0xacc3('0x35')]=_[_0xacc3('0x49')](db['SalesforceAccount'][_0xacc3('0x4a')]);_0x4b3824[_0xacc3('0x36')]=_[_0xacc3('0x49')](_0x135f44['query']);_0x4b3824[_0xacc3('0x40')]=_[_0xacc3('0x37')](_0x4b3824[_0xacc3('0x35')],_0x4b3824[_0xacc3('0x36')]);_0x4ca8f8[_0xacc3('0x38')]=_[_0xacc3('0x37')](_0x4b3824['model'],qs[_0xacc3('0x39')](_0x135f44[_0xacc3('0x36')][_0xacc3('0x39')]));_0x4ca8f8[_0xacc3('0x38')]=_0x4ca8f8['attributes'][_0xacc3('0x3a')]?_0x4ca8f8[_0xacc3('0x38')]:_0x4b3824[_0xacc3('0x35')];if(_0x135f44['query'][_0xacc3('0x46')]){_0x4ca8f8[_0xacc3('0x4b')]=[{'all':!![]}];}_0x4ca8f8=_[_0xacc3('0x43')]({},_0x4ca8f8,_0x135f44[_0xacc3('0x45')]);return db[_0xacc3('0x31')][_0xacc3('0x4c')](_0x4ca8f8)['then'](handleEntityNotFound(_0x19aabd,null))['then'](respondWithResult(_0x19aabd,null))['catch'](handleError(_0x19aabd,null));};exports[_0xacc3('0x4d')]=function(_0x13edf9,_0x371106){return db['SalesforceAccount'][_0xacc3('0x4d')](_0x13edf9[_0xacc3('0x4e')],{})[_0xacc3('0x29')](respondWithResult(_0x371106,0xc9))[_0xacc3('0x47')](handleError(_0x371106,null));};exports[_0xacc3('0x4f')]=function(_0x139309,_0x22bf18){if(_0x139309['body']['id']){delete _0x139309[_0xacc3('0x4e')]['id'];}return db[_0xacc3('0x31')][_0xacc3('0x4c')]({'where':{'id':_0x139309[_0xacc3('0x50')]['id']}})[_0xacc3('0x29')](handleEntityNotFound(_0x22bf18,null))['then'](saveUpdates(_0x139309['body'],null))[_0xacc3('0x29')](respondWithResult(_0x22bf18,null))[_0xacc3('0x47')](handleError(_0x22bf18,null));};exports[_0xacc3('0x2a')]=function(_0x1f3da1,_0x2dcd92){return db['SalesforceAccount']['find']({'where':{'id':_0x1f3da1[_0xacc3('0x50')]['id']}})[_0xacc3('0x29')](handleEntityNotFound(_0x2dcd92,null))[_0xacc3('0x29')](removeEntity(_0x2dcd92,null))[_0xacc3('0x47')](handleError(_0x2dcd92,null));};exports[_0xacc3('0x51')]=function(_0x516ed4,_0x5840cc,_0x28f10f){var _0x22d6f1={};var _0x3c450a={};var _0xc5321c;var _0x25b331;return db[_0xacc3('0x31')]['findOne']({'where':{'id':_0x516ed4[_0xacc3('0x50')]['id']}})[_0xacc3('0x29')](handleEntityNotFound(_0x5840cc,null))['then'](function(_0x12518b){if(_0x12518b){_0xc5321c=_0x12518b;_0x3c450a[_0xacc3('0x35')]=_[_0xacc3('0x49')](db['SalesforceConfiguration'][_0xacc3('0x4a')]);_0x3c450a[_0xacc3('0x36')]=_[_0xacc3('0x49')](_0x516ed4[_0xacc3('0x36')]);_0x3c450a['filters']=_[_0xacc3('0x37')](_0x3c450a[_0xacc3('0x35')],_0x3c450a['query']);_0x22d6f1[_0xacc3('0x38')]=_[_0xacc3('0x37')](_0x3c450a['model'],qs[_0xacc3('0x39')](_0x516ed4['query']['fields']));_0x22d6f1[_0xacc3('0x38')]=_0x22d6f1[_0xacc3('0x38')][_0xacc3('0x3a')]?_0x22d6f1[_0xacc3('0x38')]:_0x3c450a[_0xacc3('0x35')];_0x22d6f1[_0xacc3('0x3d')]=qs['sort'](_0x516ed4['query'][_0xacc3('0x3e')]);_0x22d6f1[_0xacc3('0x3f')]=qs[_0xacc3('0x40')](_[_0xacc3('0x41')](_0x516ed4[_0xacc3('0x36')],_0x3c450a[_0xacc3('0x40')]));if(_0x516ed4[_0xacc3('0x36')][_0xacc3('0x42')]){_0x22d6f1[_0xacc3('0x3f')]=_[_0xacc3('0x43')](_0x22d6f1[_0xacc3('0x3f')],{'$or':_[_0xacc3('0x30')](_0x22d6f1[_0xacc3('0x38')],function(_0x515aee){var _0x509d5e={};_0x509d5e[_0x515aee]={'$like':'%'+_0x516ed4[_0xacc3('0x36')][_0xacc3('0x42')]+'%'};return _0x509d5e;})});}_0x22d6f1=_['merge']({},_0x22d6f1,_0x516ed4['options']);return _0xc5321c[_0xacc3('0x51')](_0x22d6f1);}})[_0xacc3('0x29')](function(_0x1c867c){if(_0x1c867c){_0x25b331=_0x1c867c[_0xacc3('0x3a')];if(!_0x516ed4[_0xacc3('0x36')][_0xacc3('0x3b')]('nolimit')){_0x22d6f1['limit']=qs[_0xacc3('0x22')](_0x516ed4[_0xacc3('0x36')][_0xacc3('0x22')]);_0x22d6f1[_0xacc3('0x20')]=qs['offset'](_0x516ed4['query']['offset']);}return _0xc5321c[_0xacc3('0x51')](_0x22d6f1);}})[_0xacc3('0x29')](function(_0x4ec6e5){if(_0x4ec6e5){return _0x4ec6e5?{'count':_0x25b331,'rows':_0x4ec6e5}:null;}})['then'](respondWithResult(_0x5840cc,null))[_0xacc3('0x47')](handleError(_0x5840cc,null));};exports['addConfiguration']=function(_0x4af63a,_0x23d47f,_0x30470b){if(_0x4af63a[_0xacc3('0x4e')]['id']){delete _0x4af63a['body']['id'];}return db['SalesforceAccount'][_0xacc3('0x52')]({'where':{'id':_0x4af63a[_0xacc3('0x50')]['id']}})['then'](handleEntityNotFound(_0x23d47f,null))[_0xacc3('0x29')](function(_0x558ebb){if(_0x558ebb){_0x4af63a[_0xacc3('0x4e')][_0xacc3('0x53')]=_0x558ebb['id'];_0x4af63a[_0xacc3('0x4e')][_0xacc3('0x54')]=integrations[_0xacc3('0x55')](_0x4af63a[_0xacc3('0x4e')]['channel'],_0x4af63a['body'][_0xacc3('0x33')]);_0x4af63a[_0xacc3('0x4e')]['Descriptions']=integrations[_0xacc3('0x56')](_0x4af63a[_0xacc3('0x4e')][_0xacc3('0x57')],_0x4af63a[_0xacc3('0x4e')]['type']);return db['SalesforceConfiguration'][_0xacc3('0x4d')](_0x4af63a[_0xacc3('0x4e')],{'include':[{'model':db[_0xacc3('0x58')],'as':_0xacc3('0x54')},{'model':db['SalesforceField'],'as':'Descriptions'}]});}return null;})[_0xacc3('0x29')](respondWithResult(_0x23d47f,null))[_0xacc3('0x47')](handleError(_0x23d47f,null));};exports[_0xacc3('0x59')]=function(_0x3e714f,_0x8db913,_0xfaa11a){var _0x208168;var _0x36bc04='';var _0x3ffacf=_0xacc3('0x5a');return db['SalesforceAccount'][_0xacc3('0x52')]({'where':{'id':_0x3e714f[_0xacc3('0x50')]['id']},'attributes':['id',_0xacc3('0x5b'),_0xacc3('0x5c'),_0xacc3('0x5d'),'username',_0xacc3('0x5e'),_0xacc3('0x5f')]})[_0xacc3('0x29')](handleEntityNotFound(_0x8db913,null))[_0xacc3('0x29')](function(_0x4e18fe){if(_0x4e18fe){_0x36bc04=_0x4e18fe[_0xacc3('0x5b')];var _0x38cc4e=_0x36bc04[_0xacc3('0x60')](-0x1);if(_0x38cc4e==='/'){_0x36bc04=_0x36bc04['substring'](0x0,_0x36bc04[_0xacc3('0x61')](_0x38cc4e));}_0x208168=new jsforce[(_0xacc3('0x62'))]({'oauth2':{'loginUrl':_0x36bc04,'clientId':_0x4e18fe[_0xacc3('0x5c')],'clientSecret':_0x4e18fe[_0xacc3('0x5d')]}});return _0x208168['login'](_0x4e18fe[_0xacc3('0x63')],_0x4e18fe['password'][_0xacc3('0x64')](_0x4e18fe['securityToken']));}})[_0xacc3('0x29')](function(_0x33838a){if(_0x33838a){if(!_[_0xacc3('0x65')](_0x3e714f[_0xacc3('0x36')][_0xacc3('0x66')])){_0x3ffacf=_0x3e714f['query'][_0xacc3('0x66')];}return _0x208168[_0xacc3('0x67')](_0x3ffacf)[_0xacc3('0x68')]();}})['then'](function(_0x4de798){var _0x43edd6=[_0xacc3('0x69'),_0xacc3('0x6a'),_0xacc3('0x6b'),_0xacc3('0x6c'),'Subject','Description'];var _0x766ea2=[_0xacc3('0x6d'),_0xacc3('0x6e'),'picklist',_0xacc3('0x6f'),_0xacc3('0x70'),_0xacc3('0x71'),'phone'];if(_0x4de798){_[_0xacc3('0x72')](_0x4de798[_0xacc3('0x39')],function(_0x514fd4){return _0x43edd6[_0xacc3('0x73')](_0x514fd4[_0xacc3('0x2d')])||!_0x766ea2['includes'](_0x514fd4[_0xacc3('0x33')]);});return{'count':_0x4de798[_0xacc3('0x39')][_0xacc3('0x3a')],'rows':_['map'](_0x4de798[_0xacc3('0x39')],function(_0x5086e6){return{'id':_0x5086e6[_0xacc3('0x2d')],'name':_0x5086e6['label'],'custom':_0x5086e6[_0xacc3('0x74')],'options':_0x5086e6['picklistValues'][_0xacc3('0x3a')]>0x0?_[_0xacc3('0x30')](_0x5086e6[_0xacc3('0x75')],function(_0x59cc5c){return{'name':_0x59cc5c[_0xacc3('0x76')],'value':_0x59cc5c['value']};}):_0x5086e6[_0xacc3('0x33')]=='boolean'?[{'name':_0xacc3('0x77'),'value':_0xacc3('0x78')},{'name':'False','value':'false'}]:[]};})};}})['then'](respondWithResult(_0x8db913,null))[_0xacc3('0x47')](function(_0x563072){var _0x386ebc=_0x3e714f[_0xacc3('0x36')][_0xacc3('0x79')]?0x1f4:_0x563072[_0xacc3('0x7a')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xacc3('0x59'),_0x386ebc,JSON[_0xacc3('0x7b')](_0x563072));delete _0x563072[_0xacc3('0x2d')];if(_0x386ebc===0x191){_0x386ebc=0x190;}_0x8db913['status'](_0x386ebc)[_0xacc3('0x2e')](_0x3e714f[_0xacc3('0x36')][_0xacc3('0x79')]?{'message':'Wrong\x20credentials','statusCode':_0x563072[_0xacc3('0x7a')]}:_0x563072);});}; \ No newline at end of file +var _0x4966=['../../config/license/hardware','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','name','send','index','SalesforceAccount','rawAttributes','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','catch','create','body','find','getConfigurations','findOne','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','SalesforceConfiguration','SalesforceField','Task','remoteUri','clientId','username','password','securityToken','slice','substring','lastIndexOf','Connection','clientSecret','login','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','int','email','remove','includes','label','custom','picklistValues','value','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service'];(function(_0x164fc9,_0x1cd4be){var _0x101ac3=function(_0xdcf39b){while(--_0xdcf39b){_0x164fc9['push'](_0x164fc9['shift']());}};_0x101ac3(++_0x1cd4be);}(_0x4966,0x1cd));var _0x6496=function(_0x3a4c07,_0x18440c){_0x3a4c07=_0x3a4c07-0x0;var _0x5a4943=_0x4966[_0x3a4c07];return _0x5a4943;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6496('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6496('0x1'));var moment=require(_0x6496('0x2'));var BPromise=require(_0x6496('0x3'));var Mustache=require(_0x6496('0x4'));var util=require(_0x6496('0x5'));var path=require('path');var sox=require(_0x6496('0x6'));var csv=require(_0x6496('0x7'));var ejs=require(_0x6496('0x8'));var fs=require('fs');var fs_extra=require(_0x6496('0x9'));var _=require('lodash');var squel=require(_0x6496('0xa'));var crypto=require(_0x6496('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6496('0x7'));var querystring=require(_0x6496('0xc'));var Papa=require('papaparse');var Redis=require(_0x6496('0xd'));var authService=require(_0x6496('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6496('0xf'));var logger=require('../../config/logger')(_0x6496('0x10'));var utils=require('../../config/utils');var config=require(_0x6496('0x11'));var licenseUtil=require(_0x6496('0x12'));var db=require('../../mysqldb')['db'];var integrations=require(_0x6496('0x13'));function respondWithStatusCode(_0x335e3c,_0x2cc64d){_0x2cc64d=_0x2cc64d||0xcc;return function(_0x4b0d3b){if(_0x4b0d3b){return _0x335e3c[_0x6496('0x14')](_0x2cc64d);}return _0x335e3c[_0x6496('0x15')](_0x2cc64d)[_0x6496('0x16')]();};}function respondWithResult(_0x598d6d,_0x53b7c8){_0x53b7c8=_0x53b7c8||0xc8;return function(_0x3e451d){if(_0x3e451d){return _0x598d6d[_0x6496('0x15')](_0x53b7c8)[_0x6496('0x17')](_0x3e451d);}};}function respondWithFilteredResult(_0x2a6737,_0x439b6c){return function(_0x9a31d1){if(_0x9a31d1){var _0x1b6427=typeof _0x439b6c[_0x6496('0x18')]===_0x6496('0x19')&&typeof _0x439b6c[_0x6496('0x1a')]===_0x6496('0x19');var _0x664d0a=_0x9a31d1[_0x6496('0x1b')];var _0x5cf598=_0x1b6427?0x0:_0x439b6c[_0x6496('0x18')];var _0x5e5f32=_0x1b6427?_0x9a31d1[_0x6496('0x1b')]:_0x439b6c[_0x6496('0x18')]+_0x439b6c[_0x6496('0x1a')];var _0x25456e;if(_0x5e5f32>=_0x664d0a){_0x5e5f32=_0x664d0a;_0x25456e=0xc8;}else{_0x25456e=0xce;}_0x2a6737['status'](_0x25456e);return _0x2a6737['set'](_0x6496('0x1c'),_0x5cf598+'-'+_0x5e5f32+'/'+_0x664d0a)[_0x6496('0x17')](_0x9a31d1);}return null;};}function patchUpdates(_0xf95d7e){return function(_0x27b9fd){try{jsonpatch[_0x6496('0x1d')](_0x27b9fd,_0xf95d7e,!![]);}catch(_0x8fd333){return BPromise['reject'](_0x8fd333);}return _0x27b9fd[_0x6496('0x1e')]();};}function saveUpdates(_0x4d5387,_0x190b34){return function(_0xde026b){if(_0xde026b){return _0xde026b[_0x6496('0x1f')](_0x4d5387)[_0x6496('0x20')](function(_0x1f78eb){return _0x1f78eb;});}return null;};}function removeEntity(_0x390c76,_0x1cbfbb){return function(_0xba88c5){if(_0xba88c5){return _0xba88c5[_0x6496('0x21')]()[_0x6496('0x20')](function(){_0x390c76['status'](0xcc)[_0x6496('0x16')]();});}};}function handleEntityNotFound(_0x4fb9cc,_0x5ab458){return function(_0x2590bf){if(!_0x2590bf){_0x4fb9cc['sendStatus'](0x194);}return _0x2590bf;};}function handleError(_0x335317,_0x280183){_0x280183=_0x280183||0x1f4;return function(_0x54e43e){logger[_0x6496('0x22')](_0x54e43e['stack']);if(_0x54e43e[_0x6496('0x23')]){delete _0x54e43e[_0x6496('0x23')];}_0x335317[_0x6496('0x15')](_0x280183)[_0x6496('0x24')](_0x54e43e);};}exports[_0x6496('0x25')]=function(_0x2824eb,_0x3defae){var _0x1c2d9b={},_0x3cc44e={},_0x832c29={'count':0x0,'rows':[]};var _0x1e0277=_['map'](db[_0x6496('0x26')][_0x6496('0x27')],function(_0x43748d){return{'name':_0x43748d['fieldName'],'type':_0x43748d[_0x6496('0x28')][_0x6496('0x29')]};});_0x3cc44e['model']=_[_0x6496('0x2a')](_0x1e0277,'name');_0x3cc44e['query']=_[_0x6496('0x2b')](_0x2824eb[_0x6496('0x2c')]);_0x3cc44e[_0x6496('0x2d')]=_[_0x6496('0x2e')](_0x3cc44e[_0x6496('0x2f')],_0x3cc44e['query']);_0x1c2d9b[_0x6496('0x30')]=_[_0x6496('0x2e')](_0x3cc44e[_0x6496('0x2f')],qs[_0x6496('0x31')](_0x2824eb[_0x6496('0x2c')][_0x6496('0x31')]));_0x1c2d9b[_0x6496('0x30')]=_0x1c2d9b[_0x6496('0x30')][_0x6496('0x32')]?_0x1c2d9b[_0x6496('0x30')]:_0x3cc44e['model'];if(!_0x2824eb['query'][_0x6496('0x33')](_0x6496('0x34'))){_0x1c2d9b[_0x6496('0x1a')]=qs[_0x6496('0x1a')](_0x2824eb[_0x6496('0x2c')][_0x6496('0x1a')]);_0x1c2d9b[_0x6496('0x18')]=qs[_0x6496('0x18')](_0x2824eb[_0x6496('0x2c')][_0x6496('0x18')]);}_0x1c2d9b[_0x6496('0x35')]=qs[_0x6496('0x36')](_0x2824eb[_0x6496('0x2c')]['sort']);_0x1c2d9b[_0x6496('0x37')]=qs[_0x6496('0x2d')](_[_0x6496('0x38')](_0x2824eb[_0x6496('0x2c')],_0x3cc44e[_0x6496('0x2d')]),_0x1e0277);if(_0x2824eb[_0x6496('0x2c')][_0x6496('0x39')]){_0x1c2d9b[_0x6496('0x37')]=_[_0x6496('0x3a')](_0x1c2d9b[_0x6496('0x37')],{'$or':_[_0x6496('0x2a')](_0x1e0277,function(_0x515149){if(_0x515149['type']!=='VIRTUAL'){var _0x2cb983={};_0x2cb983[_0x515149['name']]={'$like':'%'+_0x2824eb[_0x6496('0x2c')]['filter']+'%'};return _0x2cb983;}})});}_0x1c2d9b=_['merge']({},_0x1c2d9b,_0x2824eb[_0x6496('0x3b')]);var _0x388ed5={'where':_0x1c2d9b[_0x6496('0x37')]};return db[_0x6496('0x26')][_0x6496('0x1b')](_0x388ed5)['then'](function(_0xe9140e){_0x832c29[_0x6496('0x1b')]=_0xe9140e;if(_0x2824eb[_0x6496('0x2c')][_0x6496('0x3c')]){_0x1c2d9b[_0x6496('0x3d')]=[{'all':!![]}];}return db[_0x6496('0x26')]['findAll'](_0x1c2d9b);})['then'](function(_0x320805){_0x832c29[_0x6496('0x3e')]=_0x320805;return _0x832c29;})[_0x6496('0x20')](respondWithFilteredResult(_0x3defae,_0x1c2d9b))['catch'](handleError(_0x3defae,null));};exports[_0x6496('0x3f')]=function(_0x14aa76,_0x569d9f){var _0x1b3fd9={'raw':![],'where':{'id':_0x14aa76[_0x6496('0x40')]['id']}},_0xe60c03={};_0xe60c03[_0x6496('0x2f')]=_[_0x6496('0x2b')](db['SalesforceAccount'][_0x6496('0x27')]);_0xe60c03['query']=_['keys'](_0x14aa76[_0x6496('0x2c')]);_0xe60c03[_0x6496('0x2d')]=_['intersection'](_0xe60c03['model'],_0xe60c03[_0x6496('0x2c')]);_0x1b3fd9[_0x6496('0x30')]=_[_0x6496('0x2e')](_0xe60c03['model'],qs['fields'](_0x14aa76[_0x6496('0x2c')][_0x6496('0x31')]));_0x1b3fd9['attributes']=_0x1b3fd9[_0x6496('0x30')][_0x6496('0x32')]?_0x1b3fd9['attributes']:_0xe60c03['model'];if(_0x14aa76[_0x6496('0x2c')][_0x6496('0x3c')]){_0x1b3fd9[_0x6496('0x3d')]=[{'all':!![]}];}_0x1b3fd9=_['merge']({},_0x1b3fd9,_0x14aa76[_0x6496('0x3b')]);return db[_0x6496('0x26')]['find'](_0x1b3fd9)[_0x6496('0x20')](handleEntityNotFound(_0x569d9f,null))[_0x6496('0x20')](respondWithResult(_0x569d9f,null))[_0x6496('0x41')](handleError(_0x569d9f,null));};exports[_0x6496('0x42')]=function(_0x358d66,_0x36a214){return db[_0x6496('0x26')]['create'](_0x358d66[_0x6496('0x43')],{})[_0x6496('0x20')](respondWithResult(_0x36a214,0xc9))[_0x6496('0x41')](handleError(_0x36a214,null));};exports['update']=function(_0xa23281,_0x34c617){if(_0xa23281[_0x6496('0x43')]['id']){delete _0xa23281[_0x6496('0x43')]['id'];}return db['SalesforceAccount'][_0x6496('0x44')]({'where':{'id':_0xa23281[_0x6496('0x40')]['id']}})['then'](handleEntityNotFound(_0x34c617,null))['then'](saveUpdates(_0xa23281['body'],null))[_0x6496('0x20')](respondWithResult(_0x34c617,null))[_0x6496('0x41')](handleError(_0x34c617,null));};exports[_0x6496('0x21')]=function(_0x145232,_0x32ef32){return db[_0x6496('0x26')]['find']({'where':{'id':_0x145232[_0x6496('0x40')]['id']}})[_0x6496('0x20')](handleEntityNotFound(_0x32ef32,null))[_0x6496('0x20')](removeEntity(_0x32ef32,null))[_0x6496('0x41')](handleError(_0x32ef32,null));};exports[_0x6496('0x45')]=function(_0x4072e4,_0x12b242,_0x1ca3ae){var _0x2e2eab={};var _0xcf1932={};var _0x2975e7;var _0x4c62d0;return db[_0x6496('0x26')][_0x6496('0x46')]({'where':{'id':_0x4072e4[_0x6496('0x40')]['id']}})[_0x6496('0x20')](handleEntityNotFound(_0x12b242,null))[_0x6496('0x20')](function(_0x722324){if(_0x722324){_0x2975e7=_0x722324;_0xcf1932[_0x6496('0x2f')]=_[_0x6496('0x2b')](db['SalesforceConfiguration'][_0x6496('0x27')]);_0xcf1932[_0x6496('0x2c')]=_['keys'](_0x4072e4[_0x6496('0x2c')]);_0xcf1932[_0x6496('0x2d')]=_['intersection'](_0xcf1932[_0x6496('0x2f')],_0xcf1932[_0x6496('0x2c')]);_0x2e2eab['attributes']=_[_0x6496('0x2e')](_0xcf1932[_0x6496('0x2f')],qs['fields'](_0x4072e4[_0x6496('0x2c')][_0x6496('0x31')]));_0x2e2eab[_0x6496('0x30')]=_0x2e2eab['attributes']['length']?_0x2e2eab[_0x6496('0x30')]:_0xcf1932['model'];_0x2e2eab[_0x6496('0x35')]=qs[_0x6496('0x36')](_0x4072e4[_0x6496('0x2c')][_0x6496('0x36')]);_0x2e2eab[_0x6496('0x37')]=qs[_0x6496('0x2d')](_['pick'](_0x4072e4[_0x6496('0x2c')],_0xcf1932[_0x6496('0x2d')]));if(_0x4072e4['query'][_0x6496('0x39')]){_0x2e2eab['where']=_[_0x6496('0x3a')](_0x2e2eab['where'],{'$or':_['map'](_0x2e2eab['attributes'],function(_0x33b8ce){var _0x34a0bd={};_0x34a0bd[_0x33b8ce]={'$like':'%'+_0x4072e4[_0x6496('0x2c')][_0x6496('0x39')]+'%'};return _0x34a0bd;})});}_0x2e2eab=_['merge']({},_0x2e2eab,_0x4072e4['options']);return _0x2975e7[_0x6496('0x45')](_0x2e2eab);}})[_0x6496('0x20')](function(_0x55b4cd){if(_0x55b4cd){_0x4c62d0=_0x55b4cd['length'];if(!_0x4072e4[_0x6496('0x2c')]['hasOwnProperty'](_0x6496('0x34'))){_0x2e2eab['limit']=qs[_0x6496('0x1a')](_0x4072e4['query'][_0x6496('0x1a')]);_0x2e2eab[_0x6496('0x18')]=qs['offset'](_0x4072e4[_0x6496('0x2c')][_0x6496('0x18')]);}return _0x2975e7['getConfigurations'](_0x2e2eab);}})['then'](function(_0x2981d2){if(_0x2981d2){return _0x2981d2?{'count':_0x4c62d0,'rows':_0x2981d2}:null;}})[_0x6496('0x20')](respondWithResult(_0x12b242,null))[_0x6496('0x41')](handleError(_0x12b242,null));};exports[_0x6496('0x47')]=function(_0x5cc288,_0x3f11b0,_0xa0496a){if(_0x5cc288['body']['id']){delete _0x5cc288[_0x6496('0x43')]['id'];}return db['SalesforceAccount']['findOne']({'where':{'id':_0x5cc288[_0x6496('0x40')]['id']}})['then'](handleEntityNotFound(_0x3f11b0,null))[_0x6496('0x20')](function(_0x48ce0f){if(_0x48ce0f){_0x5cc288[_0x6496('0x43')][_0x6496('0x48')]=_0x48ce0f['id'];_0x5cc288['body'][_0x6496('0x49')]=integrations['getSubjects'](_0x5cc288['body']['channel'],_0x5cc288[_0x6496('0x43')]['type']);_0x5cc288[_0x6496('0x43')][_0x6496('0x4a')]=integrations[_0x6496('0x4b')](_0x5cc288[_0x6496('0x43')][_0x6496('0x4c')],_0x5cc288['body']['type']);return db[_0x6496('0x4d')][_0x6496('0x42')](_0x5cc288[_0x6496('0x43')],{'include':[{'model':db[_0x6496('0x4e')],'as':_0x6496('0x49')},{'model':db[_0x6496('0x4e')],'as':_0x6496('0x4a')}]});}return null;})[_0x6496('0x20')](respondWithResult(_0x3f11b0,null))[_0x6496('0x41')](handleError(_0x3f11b0,null));};exports['getFields']=function(_0x1326dd,_0x234bcb,_0x3800cf){var _0x1611fe;var _0x19b27a='';var _0x3f2c20=_0x6496('0x4f');return db[_0x6496('0x26')][_0x6496('0x46')]({'where':{'id':_0x1326dd[_0x6496('0x40')]['id']},'attributes':['id',_0x6496('0x50'),_0x6496('0x51'),'clientSecret',_0x6496('0x52'),_0x6496('0x53'),_0x6496('0x54')]})[_0x6496('0x20')](handleEntityNotFound(_0x234bcb,null))[_0x6496('0x20')](function(_0x1c0064){if(_0x1c0064){_0x19b27a=_0x1c0064[_0x6496('0x50')];var _0x45e965=_0x19b27a[_0x6496('0x55')](-0x1);if(_0x45e965==='/'){_0x19b27a=_0x19b27a[_0x6496('0x56')](0x0,_0x19b27a[_0x6496('0x57')](_0x45e965));}_0x1611fe=new jsforce[(_0x6496('0x58'))]({'oauth2':{'loginUrl':_0x19b27a,'clientId':_0x1c0064['clientId'],'clientSecret':_0x1c0064[_0x6496('0x59')]}});return _0x1611fe[_0x6496('0x5a')](_0x1c0064[_0x6496('0x52')],_0x1c0064[_0x6496('0x53')][_0x6496('0x5b')](_0x1c0064[_0x6496('0x54')]));}})[_0x6496('0x20')](function(_0x4b1c0f){if(_0x4b1c0f){if(!_[_0x6496('0x5c')](_0x1326dd[_0x6496('0x2c')][_0x6496('0x5d')])){_0x3f2c20=_0x1326dd['query'][_0x6496('0x5d')];}return _0x1611fe[_0x6496('0x5e')](_0x3f2c20)[_0x6496('0x5f')]();}})['then'](function(_0x51024c){var _0x4562af=[_0x6496('0x60'),_0x6496('0x61'),_0x6496('0x62'),_0x6496('0x63'),_0x6496('0x64'),_0x6496('0x65')];var _0x9e0a2=['string',_0x6496('0x66'),'picklist','boolean',_0x6496('0x67'),'textarea','phone'];if(_0x51024c){_[_0x6496('0x68')](_0x51024c[_0x6496('0x31')],function(_0xde19c6){return _0x4562af[_0x6496('0x69')](_0xde19c6[_0x6496('0x23')])||!_0x9e0a2[_0x6496('0x69')](_0xde19c6['type']);});return{'count':_0x51024c[_0x6496('0x31')]['length'],'rows':_[_0x6496('0x2a')](_0x51024c[_0x6496('0x31')],function(_0x898996){return{'id':_0x898996[_0x6496('0x23')],'name':_0x898996[_0x6496('0x6a')],'custom':_0x898996[_0x6496('0x6b')],'options':_0x898996[_0x6496('0x6c')]['length']>0x0?_['map'](_0x898996['picklistValues'],function(_0x64c53d){return{'name':_0x64c53d[_0x6496('0x6a')],'value':_0x64c53d[_0x6496('0x6d')]};}):_0x898996[_0x6496('0x28')]=='boolean'?[{'name':_0x6496('0x6e'),'value':_0x6496('0x6f')},{'name':_0x6496('0x70'),'value':_0x6496('0x71')}]:[]};})};}})[_0x6496('0x20')](respondWithResult(_0x234bcb,null))[_0x6496('0x41')](function(_0x36933a){var _0x187648=_0x1326dd[_0x6496('0x2c')][_0x6496('0x72')]?0x1f4:_0x36933a[_0x6496('0x73')]||0x1f4;logger[_0x6496('0x22')](_0x6496('0x74'),'getFields',_0x187648,JSON[_0x6496('0x75')](_0x36933a));delete _0x36933a[_0x6496('0x23')];if(_0x187648===0x191){_0x187648=0x190;}_0x234bcb[_0x6496('0x15')](_0x187648)[_0x6496('0x24')](_0x1326dd[_0x6496('0x2c')][_0x6496('0x72')]?{'message':_0x6496('0x76'),'statusCode':_0x36933a[_0x6496('0x73')]}:_0x36933a);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index b646c12..15cdbc2 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 _0x6aa9=['rimraf','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','api','moment','bluebird','request-promise'];(function(_0x4d3742,_0xc381d9){var _0x43614e=function(_0x48b082){while(--_0x48b082){_0x4d3742['push'](_0x4d3742['shift']());}};_0x43614e(++_0xc381d9);}(_0x6aa9,0xd7));var _0x96aa=function(_0x892f5b,_0x47dc57){_0x892f5b=_0x892f5b-0x0;var _0x33b9c1=_0x6aa9[_0x892f5b];return _0x33b9c1;};'use strict';var _=require(_0x96aa('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x96aa('0x1'));var moment=require(_0x96aa('0x2'));var BPromise=require(_0x96aa('0x3'));var rp=require(_0x96aa('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x96aa('0x5'));var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x96aa('0x6')]=function(_0x56aeb7,_0x1b7534){return _0x56aeb7[_0x96aa('0x7')](_0x96aa('0x8'),attributes,{'tableName':_0x96aa('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xecf0=['exports','define','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration'];(function(_0x2b85c1,_0x5c82ed){var _0x230287=function(_0x211c98){while(--_0x211c98){_0x2b85c1['push'](_0x2b85c1['shift']());}};_0x230287(++_0x5c82ed);}(_0xecf0,0x84));var _0x0ecf=function(_0x1a7020,_0x123a57){_0x1a7020=_0x1a7020-0x0;var _0x427588=_0xecf0[_0x1a7020];return _0x427588;};'use strict';var _=require(_0x0ecf('0x0'));var util=require(_0x0ecf('0x1'));var logger=require(_0x0ecf('0x2'))(_0x0ecf('0x3'));var moment=require('moment');var BPromise=require(_0x0ecf('0x4'));var rp=require(_0x0ecf('0x5'));var fs=require('fs');var path=require(_0x0ecf('0x6'));var rimraf=require(_0x0ecf('0x7'));var config=require(_0x0ecf('0x8'));var attributes=require(_0x0ecf('0x9'));var integrations=require(_0x0ecf('0xa'));module[_0x0ecf('0xb')]=function(_0x561c21,_0x25bc58){return _0x561c21[_0x0ecf('0xc')]('SalesforceAccount',attributes,{'tableName':'int_salesforce_accounts','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 0bc5698..5a27932 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 _0xeaa0=['../../config/environment','jayson/promise','client','http','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetSalesforceAccount','findAll','options','where','limit','include','model','map','attributes','ShowSalesforceAccount','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x4d4385,_0x34f7f9){var _0x347163=function(_0x16d03c){while(--_0x16d03c){_0x4d4385['push'](_0x4d4385['shift']());}};_0x347163(++_0x34f7f9);}(_0xeaa0,0x16e));var _0x0eaa=function(_0x37ff64,_0x37ebd9){_0x37ff64=_0x37ff64-0x0;var _0x1b4173=_0xeaa0[_0x37ff64];return _0x1b4173;};'use strict';var _=require(_0x0eaa('0x0'));var util=require(_0x0eaa('0x1'));var moment=require(_0x0eaa('0x2'));var BPromise=require(_0x0eaa('0x3'));var rs=require(_0x0eaa('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0eaa('0x5'))['db'];var utils=require(_0x0eaa('0x6'));var logger=require('../../config/logger')(_0x0eaa('0x7'));var config=require(_0x0eaa('0x8'));var jayson=require(_0x0eaa('0x9'));var client=jayson[_0x0eaa('0xa')][_0x0eaa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4bbbc5,_0x41d4d7,_0x9fdc9a){return new BPromise(function(_0x3493b7,_0x1c0aaa){return client['request'](_0x4bbbc5,_0x9fdc9a)[_0x0eaa('0xc')](function(_0x14431a){logger[_0x0eaa('0xd')](_0x0eaa('0xe'),_0x41d4d7,'request\x20sent');logger[_0x0eaa('0xf')](_0x0eaa('0x10'),_0x41d4d7,_0x0eaa('0x11'),JSON['stringify'](_0x14431a));if(_0x14431a[_0x0eaa('0x12')]){if(_0x14431a['error'][_0x0eaa('0x13')]===0x1f4){logger[_0x0eaa('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x41d4d7,_0x14431a[_0x0eaa('0x12')][_0x0eaa('0x14')]);return _0x1c0aaa(_0x14431a[_0x0eaa('0x12')]['message']);}logger[_0x0eaa('0x12')](_0x0eaa('0xe'),_0x41d4d7,_0x14431a[_0x0eaa('0x12')][_0x0eaa('0x14')]);return _0x3493b7(_0x14431a[_0x0eaa('0x12')][_0x0eaa('0x14')]);}else{logger[_0x0eaa('0xd')](_0x0eaa('0xe'),_0x41d4d7,_0x0eaa('0x11'));_0x3493b7(_0x14431a[_0x0eaa('0x15')][_0x0eaa('0x14')]);}})[_0x0eaa('0x16')](function(_0x289166){logger[_0x0eaa('0x12')](_0x0eaa('0xe'),_0x41d4d7,_0x289166);_0x1c0aaa(_0x289166);});});}exports[_0x0eaa('0x17')]=function(_0x37d583){var _0x349b5a=this;return new Promise(function(_0xc72475,_0xfd90e1){return db['SalesforceAccount'][_0x0eaa('0x18')]({'raw':_0x37d583[_0x0eaa('0x19')]?_0x37d583[_0x0eaa('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x37d583[_0x0eaa('0x19')]?_0x37d583[_0x0eaa('0x19')][_0x0eaa('0x1a')]||null:null,'attributes':_0x37d583['options']?_0x37d583[_0x0eaa('0x19')]['attributes']||null:null,'limit':_0x37d583[_0x0eaa('0x19')]?_0x37d583[_0x0eaa('0x19')][_0x0eaa('0x1b')]||null:null,'include':_0x37d583[_0x0eaa('0x19')]?_0x37d583[_0x0eaa('0x19')][_0x0eaa('0x1c')]?_['map'](_0x37d583['options'][_0x0eaa('0x1c')],function(_0x29f3a8){return{'model':db[_0x29f3a8[_0x0eaa('0x1d')]],'as':_0x29f3a8['as'],'attributes':_0x29f3a8['attributes'],'include':_0x29f3a8[_0x0eaa('0x1c')]?_[_0x0eaa('0x1e')](_0x29f3a8[_0x0eaa('0x1c')],function(_0x466781){return{'model':db[_0x466781[_0x0eaa('0x1d')]],'as':_0x466781['as'],'attributes':_0x466781[_0x0eaa('0x1f')],'include':_0x466781['include']?_[_0x0eaa('0x1e')](_0x466781['include'],function(_0xf2ad9e){return{'model':db[_0xf2ad9e[_0x0eaa('0x1d')]],'as':_0xf2ad9e['as'],'attributes':_0xf2ad9e[_0x0eaa('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x21d7e7){logger[_0x0eaa('0xd')](_0x0eaa('0x17'),_0x37d583);logger[_0x0eaa('0xf')](_0x0eaa('0x17'),_0x37d583,JSON['stringify'](_0x21d7e7));_0xc72475(_0x21d7e7);})[_0x0eaa('0x16')](function(_0x1ea242){logger['error']('GetSalesforceAccount',_0x1ea242[_0x0eaa('0x14')],_0x37d583);_0xfd90e1(_0x349b5a[_0x0eaa('0x12')](0x1f4,_0x1ea242[_0x0eaa('0x14')]));});});};exports['ShowSalesforceAccount']=function(_0x49a18b){var _0x5cf6d5=this;return new Promise(function(_0x2ab268,_0x321fcf){return db['SalesforceAccount']['find']({'raw':_0x49a18b[_0x0eaa('0x19')]?_0x49a18b[_0x0eaa('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x49a18b['options']?_0x49a18b[_0x0eaa('0x19')][_0x0eaa('0x1a')]||null:null,'attributes':_0x49a18b[_0x0eaa('0x19')]?_0x49a18b['options'][_0x0eaa('0x1f')]||null:null,'include':_0x49a18b[_0x0eaa('0x19')]?_0x49a18b['options'][_0x0eaa('0x1c')]?_[_0x0eaa('0x1e')](_0x49a18b[_0x0eaa('0x19')]['include'],function(_0x3202e5){return{'model':db[_0x3202e5[_0x0eaa('0x1d')]],'as':_0x3202e5['as'],'attributes':_0x3202e5[_0x0eaa('0x1f')],'include':_0x3202e5[_0x0eaa('0x1c')]?_[_0x0eaa('0x1e')](_0x3202e5[_0x0eaa('0x1c')],function(_0xc2ac06){return{'model':db[_0xc2ac06[_0x0eaa('0x1d')]],'as':_0xc2ac06['as'],'attributes':_0xc2ac06[_0x0eaa('0x1f')],'include':_0xc2ac06[_0x0eaa('0x1c')]?_[_0x0eaa('0x1e')](_0xc2ac06[_0x0eaa('0x1c')],function(_0x21ab8f){return{'model':db[_0x21ab8f[_0x0eaa('0x1d')]],'as':_0x21ab8f['as'],'attributes':_0x21ab8f[_0x0eaa('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0eaa('0xc')](function(_0x5e686e){logger[_0x0eaa('0xd')](_0x0eaa('0x20'),_0x49a18b);logger[_0x0eaa('0xf')]('ShowSalesforceAccount',_0x49a18b,JSON[_0x0eaa('0x21')](_0x5e686e));_0x2ab268(_0x5e686e);})[_0x0eaa('0x16')](function(_0x2fd80e){logger['error'](_0x0eaa('0x20'),_0x2fd80e['message'],_0x49a18b);_0x321fcf(_0x5cf6d5[_0x0eaa('0x12')](0x1f4,_0x2fd80e[_0x0eaa('0x14')]));});});}; \ No newline at end of file +var _0xb8c4=['model','ShowSalesforceAccount','where','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','GetSalesforceAccount','SalesforceAccount','options','raw','attributes','map','include'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xb8c4,0x7f));var _0x4b8c=function(_0x5dc8c3,_0x22eee9){_0x5dc8c3=_0x5dc8c3-0x0;var _0x456a93=_0xb8c4[_0x5dc8c3];return _0x456a93;};'use strict';var _=require(_0x4b8c('0x0'));var util=require(_0x4b8c('0x1'));var moment=require('moment');var BPromise=require(_0x4b8c('0x2'));var rs=require(_0x4b8c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b8c('0x4'))['db'];var utils=require(_0x4b8c('0x5'));var logger=require(_0x4b8c('0x6'))(_0x4b8c('0x7'));var config=require(_0x4b8c('0x8'));var jayson=require(_0x4b8c('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x392808,_0x2d3ba3,_0x3806bf){return new BPromise(function(_0x188742,_0x4e9a96){return client['request'](_0x392808,_0x3806bf)[_0x4b8c('0xa')](function(_0x5d3e8b){logger[_0x4b8c('0xb')](_0x4b8c('0xc'),_0x2d3ba3,_0x4b8c('0xd'));logger[_0x4b8c('0xe')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x2d3ba3,_0x4b8c('0xd'),JSON[_0x4b8c('0xf')](_0x5d3e8b));if(_0x5d3e8b['error']){if(_0x5d3e8b['error'][_0x4b8c('0x10')]===0x1f4){logger[_0x4b8c('0x11')](_0x4b8c('0xc'),_0x2d3ba3,_0x5d3e8b['error'][_0x4b8c('0x12')]);return _0x4e9a96(_0x5d3e8b[_0x4b8c('0x11')][_0x4b8c('0x12')]);}logger[_0x4b8c('0x11')](_0x4b8c('0xc'),_0x2d3ba3,_0x5d3e8b[_0x4b8c('0x11')][_0x4b8c('0x12')]);return _0x188742(_0x5d3e8b[_0x4b8c('0x11')][_0x4b8c('0x12')]);}else{logger[_0x4b8c('0xb')](_0x4b8c('0xc'),_0x2d3ba3,_0x4b8c('0xd'));_0x188742(_0x5d3e8b[_0x4b8c('0x13')][_0x4b8c('0x12')]);}})[_0x4b8c('0x14')](function(_0x2f567f){logger['error'](_0x4b8c('0xc'),_0x2d3ba3,_0x2f567f);_0x4e9a96(_0x2f567f);});});}exports[_0x4b8c('0x15')]=function(_0x2544c9){var _0x342f71=this;return new Promise(function(_0x115759,_0x5ea503){return db[_0x4b8c('0x16')]['findAll']({'raw':_0x2544c9[_0x4b8c('0x17')]?_0x2544c9[_0x4b8c('0x17')][_0x4b8c('0x18')]===undefined?!![]:![]:!![],'where':_0x2544c9['options']?_0x2544c9[_0x4b8c('0x17')]['where']||null:null,'attributes':_0x2544c9[_0x4b8c('0x17')]?_0x2544c9[_0x4b8c('0x17')][_0x4b8c('0x19')]||null:null,'limit':_0x2544c9[_0x4b8c('0x17')]?_0x2544c9['options']['limit']||null:null,'include':_0x2544c9[_0x4b8c('0x17')]?_0x2544c9[_0x4b8c('0x17')]['include']?_[_0x4b8c('0x1a')](_0x2544c9[_0x4b8c('0x17')][_0x4b8c('0x1b')],function(_0x2dbc56){return{'model':db[_0x2dbc56[_0x4b8c('0x1c')]],'as':_0x2dbc56['as'],'attributes':_0x2dbc56[_0x4b8c('0x19')],'include':_0x2dbc56[_0x4b8c('0x1b')]?_['map'](_0x2dbc56[_0x4b8c('0x1b')],function(_0x2659a6){return{'model':db[_0x2659a6['model']],'as':_0x2659a6['as'],'attributes':_0x2659a6[_0x4b8c('0x19')],'include':_0x2659a6[_0x4b8c('0x1b')]?_[_0x4b8c('0x1a')](_0x2659a6[_0x4b8c('0x1b')],function(_0x21f5e9){return{'model':db[_0x21f5e9[_0x4b8c('0x1c')]],'as':_0x21f5e9['as'],'attributes':_0x21f5e9[_0x4b8c('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4b8c('0xa')](function(_0x313639){logger[_0x4b8c('0xb')](_0x4b8c('0x15'),_0x2544c9);logger[_0x4b8c('0xe')](_0x4b8c('0x15'),_0x2544c9,JSON[_0x4b8c('0xf')](_0x313639));_0x115759(_0x313639);})[_0x4b8c('0x14')](function(_0x1ceab5){logger[_0x4b8c('0x11')](_0x4b8c('0x15'),_0x1ceab5['message'],_0x2544c9);_0x5ea503(_0x342f71['error'](0x1f4,_0x1ceab5[_0x4b8c('0x12')]));});});};exports[_0x4b8c('0x1d')]=function(_0x5a7924){var _0x364b55=this;return new Promise(function(_0x198e7b,_0x1f37f2){return db['SalesforceAccount']['find']({'raw':_0x5a7924['options']?_0x5a7924['options'][_0x4b8c('0x18')]===undefined?!![]:![]:!![],'where':_0x5a7924[_0x4b8c('0x17')]?_0x5a7924[_0x4b8c('0x17')][_0x4b8c('0x1e')]||null:null,'attributes':_0x5a7924[_0x4b8c('0x17')]?_0x5a7924[_0x4b8c('0x17')][_0x4b8c('0x19')]||null:null,'include':_0x5a7924['options']?_0x5a7924[_0x4b8c('0x17')][_0x4b8c('0x1b')]?_[_0x4b8c('0x1a')](_0x5a7924[_0x4b8c('0x17')]['include'],function(_0x9d4c4b){return{'model':db[_0x9d4c4b[_0x4b8c('0x1c')]],'as':_0x9d4c4b['as'],'attributes':_0x9d4c4b[_0x4b8c('0x19')],'include':_0x9d4c4b[_0x4b8c('0x1b')]?_[_0x4b8c('0x1a')](_0x9d4c4b[_0x4b8c('0x1b')],function(_0x4133b5){return{'model':db[_0x4133b5[_0x4b8c('0x1c')]],'as':_0x4133b5['as'],'attributes':_0x4133b5[_0x4b8c('0x19')],'include':_0x4133b5[_0x4b8c('0x1b')]?_['map'](_0x4133b5[_0x4b8c('0x1b')],function(_0x4eed38){return{'model':db[_0x4eed38[_0x4b8c('0x1c')]],'as':_0x4eed38['as'],'attributes':_0x4eed38[_0x4b8c('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41a421){logger['info'](_0x4b8c('0x1d'),_0x5a7924);logger['debug'](_0x4b8c('0x1d'),_0x5a7924,JSON[_0x4b8c('0xf')](_0x41a421));_0x198e7b(_0x41a421);})['catch'](function(_0x539822){logger[_0x4b8c('0x11')](_0x4b8c('0x1d'),_0x539822[_0x4b8c('0x12')],_0x5a7924);_0x1f37f2(_0x364b55[_0x4b8c('0x11')](0x1f4,_0x539822[_0x4b8c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index cf8f69d..a99cc3f 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 _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x1e193e,_0xf83827){var _0x56c482=function(_0x496419){while(--_0x496419){_0x1e193e['push'](_0x1e193e['shift']());}};_0x56c482(++_0xf83827);}(_0xadb5,0xad));var _0x5adb=function(_0x4071c6,_0xbb38be){_0x4071c6=_0x4071c6-0x0;var _0x311ff1=_0xadb5[_0x4071c6];return _0x311ff1;};'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('./intSalesforceConfiguration.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('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file +var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xdb28,0x106));var _0x8db2=function(_0x2f3164,_0x30bf7b){_0x2f3164=_0x2f3164-0x0;var _0x16f2a7=_0xdb28[_0x2f3164];return _0x16f2a7;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 0233e22..bcf7806 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 _0x6349=['Task','contact_lead','contact','lead','account_contact_lead','account','nothing','sequelize','exports','STRING','ENUM','Case'];(function(_0x1e2072,_0xe3cc90){var _0x22956b=function(_0x118dcf){while(--_0x118dcf){_0x1e2072['push'](_0x1e2072['shift']());}};_0x22956b(++_0xe3cc90);}(_0x6349,0x193));var _0x9634=function(_0x5fe4fc,_0x112de9){_0x5fe4fc=_0x5fe4fc-0x0;var _0x25a83f=_0x6349[_0x5fe4fc];return _0x25a83f;};'use strict';var Sequelize=require(_0x9634('0x0'));module[_0x9634('0x1')]={'name':{'type':Sequelize[_0x9634('0x2')]},'description':{'type':Sequelize[_0x9634('0x2')]},'ticketType':{'type':Sequelize[_0x9634('0x3')]('Task',_0x9634('0x4')),'defaultValue':_0x9634('0x5')},'moduleSearch':{'type':Sequelize['ENUM'](_0x9634('0x6'),_0x9634('0x7'),_0x9634('0x8'),_0x9634('0x9'),_0x9634('0xa')),'defaultValue':_0x9634('0x6')},'moduleCreate':{'type':Sequelize[_0x9634('0x3')](_0x9634('0xb'),_0x9634('0x7'),_0x9634('0x8'),_0x9634('0xa')),'defaultValue':_0x9634('0x8')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x9634('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x237d=['sequelize','exports','STRING','Task','Case','ENUM','contact_lead','contact','account_contact_lead','account','lead'];(function(_0x1f0714,_0xde0530){var _0x33669d=function(_0x38cb83){while(--_0x38cb83){_0x1f0714['push'](_0x1f0714['shift']());}};_0x33669d(++_0xde0530);}(_0x237d,0x1d9));var _0xd237=function(_0x205755,_0xaa2476){_0x205755=_0x205755-0x0;var _0x14c3d8=_0x237d[_0x205755];return _0x14c3d8;};'use strict';var Sequelize=require(_0xd237('0x0'));module[_0xd237('0x1')]={'name':{'type':Sequelize[_0xd237('0x2')]},'description':{'type':Sequelize[_0xd237('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0xd237('0x3'),_0xd237('0x4')),'defaultValue':_0xd237('0x3')},'moduleSearch':{'type':Sequelize[_0xd237('0x5')](_0xd237('0x6'),_0xd237('0x7'),'lead',_0xd237('0x8'),_0xd237('0x9')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize['ENUM']('nothing',_0xd237('0x7'),'lead',_0xd237('0x9')),'defaultValue':_0xd237('0xa')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0xd237('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xd237('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xd237('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index f43df1d..34ce828 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 _0xc076=['end','json','undefined','limit','count','offset','set','apply','reject','destroy','then','error','stack','name','send','map','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','SalesforceConfiguration','rows','catch','params','rawAttributes','includeAll','find','body','getFields','findOne','getSubjects','SalesforceField','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x3f0190,_0xad3921){var _0x78cfc9=function(_0x331aba){while(--_0x331aba){_0x3f0190['push'](_0x3f0190['shift']());}};_0x78cfc9(++_0xad3921);}(_0xc076,0x84));var _0x6c07=function(_0x3232e4,_0x17b719){_0x3232e4=_0x3232e4-0x0;var _0x30c491=_0xc076[_0x3232e4];return _0x30c491;};'use strict';var emlformat=require(_0x6c07('0x0'));var rimraf=require(_0x6c07('0x1'));var zipdir=require(_0x6c07('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c07('0x3'));var moment=require(_0x6c07('0x4'));var BPromise=require(_0x6c07('0x5'));var Mustache=require(_0x6c07('0x6'));var util=require(_0x6c07('0x7'));var path=require(_0x6c07('0x8'));var sox=require(_0x6c07('0x9'));var csv=require('to-csv');var ejs=require(_0x6c07('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6c07('0xb'));var squel=require(_0x6c07('0xc'));var crypto=require(_0x6c07('0xd'));var jsforce=require(_0x6c07('0xe'));var deskjs=require(_0x6c07('0xf'));var toCsv=require(_0x6c07('0x10'));var querystring=require(_0x6c07('0x11'));var Papa=require(_0x6c07('0x12'));var Redis=require(_0x6c07('0x13'));var authService=require(_0x6c07('0x14'));var qs=require(_0x6c07('0x15'));var as=require(_0x6c07('0x16'));var hardwareService=require(_0x6c07('0x17'));var logger=require(_0x6c07('0x18'))(_0x6c07('0x19'));var utils=require(_0x6c07('0x1a'));var config=require(_0x6c07('0x1b'));var licenseUtil=require(_0x6c07('0x1c'));var db=require(_0x6c07('0x1d'))['db'];function respondWithStatusCode(_0x2ae7ca,_0x3352a5){_0x3352a5=_0x3352a5||0xcc;return function(_0x52682d){if(_0x52682d){return _0x2ae7ca[_0x6c07('0x1e')](_0x3352a5);}return _0x2ae7ca[_0x6c07('0x1f')](_0x3352a5)[_0x6c07('0x20')]();};}function respondWithResult(_0x7f8df6,_0x4232d2){_0x4232d2=_0x4232d2||0xc8;return function(_0x1b1e1d){if(_0x1b1e1d){return _0x7f8df6[_0x6c07('0x1f')](_0x4232d2)[_0x6c07('0x21')](_0x1b1e1d);}};}function respondWithFilteredResult(_0x383a41,_0x395a7b){return function(_0x1d1b6b){if(_0x1d1b6b){var _0x51eb50=typeof _0x395a7b['offset']===_0x6c07('0x22')&&typeof _0x395a7b[_0x6c07('0x23')]==='undefined';var _0x38315b=_0x1d1b6b[_0x6c07('0x24')];var _0x3d0273=_0x51eb50?0x0:_0x395a7b[_0x6c07('0x25')];var _0x3f5936=_0x51eb50?_0x1d1b6b[_0x6c07('0x24')]:_0x395a7b['offset']+_0x395a7b['limit'];var _0x3e6ff1;if(_0x3f5936>=_0x38315b){_0x3f5936=_0x38315b;_0x3e6ff1=0xc8;}else{_0x3e6ff1=0xce;}_0x383a41[_0x6c07('0x1f')](_0x3e6ff1);return _0x383a41[_0x6c07('0x26')]('Content-Range',_0x3d0273+'-'+_0x3f5936+'/'+_0x38315b)['json'](_0x1d1b6b);}return null;};}function patchUpdates(_0x4d9d96){return function(_0x55b4d3){try{jsonpatch[_0x6c07('0x27')](_0x55b4d3,_0x4d9d96,!![]);}catch(_0x564252){return BPromise[_0x6c07('0x28')](_0x564252);}return _0x55b4d3['save']();};}function saveUpdates(_0x426f33,_0x308bde){return function(_0x27ffb3){if(_0x27ffb3){return _0x27ffb3['update'](_0x426f33)['then'](function(_0x444af7){return _0x444af7;});}return null;};}function removeEntity(_0x487298,_0x10ee07){return function(_0x42b5de){if(_0x42b5de){return _0x42b5de[_0x6c07('0x29')]()[_0x6c07('0x2a')](function(){_0x487298[_0x6c07('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3da4d2,_0x458c29){return function(_0x1a9114){if(!_0x1a9114){_0x3da4d2[_0x6c07('0x1e')](0x194);}return _0x1a9114;};}function handleError(_0x5ec724,_0x25f6ea){_0x25f6ea=_0x25f6ea||0x1f4;return function(_0x16e1d4){logger[_0x6c07('0x2b')](_0x16e1d4[_0x6c07('0x2c')]);if(_0x16e1d4[_0x6c07('0x2d')]){delete _0x16e1d4['name'];}_0x5ec724[_0x6c07('0x1f')](_0x25f6ea)[_0x6c07('0x2e')](_0x16e1d4);};}exports['index']=function(_0x2df729,_0x2cf944){var _0x196f5e={},_0x164ce4={},_0xa7c3eb={'count':0x0,'rows':[]};var _0x3f4f07=_[_0x6c07('0x2f')](db['SalesforceConfiguration']['rawAttributes'],function(_0x3a8ed7){return{'name':_0x3a8ed7[_0x6c07('0x30')],'type':_0x3a8ed7['type'][_0x6c07('0x31')]};});_0x164ce4['model']=_[_0x6c07('0x2f')](_0x3f4f07,'name');_0x164ce4[_0x6c07('0x32')]=_[_0x6c07('0x33')](_0x2df729[_0x6c07('0x32')]);_0x164ce4[_0x6c07('0x34')]=_['intersection'](_0x164ce4[_0x6c07('0x35')],_0x164ce4[_0x6c07('0x32')]);_0x196f5e[_0x6c07('0x36')]=_[_0x6c07('0x37')](_0x164ce4[_0x6c07('0x35')],qs[_0x6c07('0x38')](_0x2df729[_0x6c07('0x32')]['fields']));_0x196f5e[_0x6c07('0x36')]=_0x196f5e[_0x6c07('0x36')][_0x6c07('0x39')]?_0x196f5e[_0x6c07('0x36')]:_0x164ce4[_0x6c07('0x35')];if(!_0x2df729[_0x6c07('0x32')][_0x6c07('0x3a')](_0x6c07('0x3b'))){_0x196f5e[_0x6c07('0x23')]=qs[_0x6c07('0x23')](_0x2df729['query']['limit']);_0x196f5e['offset']=qs[_0x6c07('0x25')](_0x2df729['query'][_0x6c07('0x25')]);}_0x196f5e[_0x6c07('0x3c')]=qs['sort'](_0x2df729[_0x6c07('0x32')][_0x6c07('0x3d')]);_0x196f5e['where']=qs[_0x6c07('0x34')](_[_0x6c07('0x3e')](_0x2df729[_0x6c07('0x32')],_0x164ce4['filters']),_0x3f4f07);if(_0x2df729[_0x6c07('0x32')][_0x6c07('0x3f')]){_0x196f5e[_0x6c07('0x40')]=_[_0x6c07('0x41')](_0x196f5e[_0x6c07('0x40')],{'$or':_[_0x6c07('0x2f')](_0x3f4f07,function(_0x4693d6){if(_0x4693d6[_0x6c07('0x42')]!==_0x6c07('0x43')){var _0x14e300={};_0x14e300[_0x4693d6[_0x6c07('0x2d')]]={'$like':'%'+_0x2df729[_0x6c07('0x32')][_0x6c07('0x3f')]+'%'};return _0x14e300;}})});}_0x196f5e=_['merge']({},_0x196f5e,_0x2df729[_0x6c07('0x44')]);var _0x4bd0c2={'where':_0x196f5e['where']};return db[_0x6c07('0x45')][_0x6c07('0x24')](_0x4bd0c2)[_0x6c07('0x2a')](function(_0x954746){_0xa7c3eb['count']=_0x954746;if(_0x2df729[_0x6c07('0x32')]['includeAll']){_0x196f5e['include']=[{'all':!![]}];}return db[_0x6c07('0x45')]['findAll'](_0x196f5e);})[_0x6c07('0x2a')](function(_0x2b47bd){_0xa7c3eb[_0x6c07('0x46')]=_0x2b47bd;return _0xa7c3eb;})[_0x6c07('0x2a')](respondWithFilteredResult(_0x2cf944,_0x196f5e))[_0x6c07('0x47')](handleError(_0x2cf944,null));};exports['show']=function(_0x4331b2,_0x262be0){var _0x2ad864={'raw':![],'where':{'id':_0x4331b2[_0x6c07('0x48')]['id']}},_0x6f85e5={};_0x6f85e5[_0x6c07('0x35')]=_[_0x6c07('0x33')](db[_0x6c07('0x45')][_0x6c07('0x49')]);_0x6f85e5['query']=_[_0x6c07('0x33')](_0x4331b2['query']);_0x6f85e5[_0x6c07('0x34')]=_[_0x6c07('0x37')](_0x6f85e5[_0x6c07('0x35')],_0x6f85e5['query']);_0x2ad864['attributes']=_[_0x6c07('0x37')](_0x6f85e5[_0x6c07('0x35')],qs[_0x6c07('0x38')](_0x4331b2[_0x6c07('0x32')]['fields']));_0x2ad864[_0x6c07('0x36')]=_0x2ad864[_0x6c07('0x36')][_0x6c07('0x39')]?_0x2ad864[_0x6c07('0x36')]:_0x6f85e5[_0x6c07('0x35')];if(_0x4331b2[_0x6c07('0x32')][_0x6c07('0x4a')]){_0x2ad864['include']=[{'all':!![]}];}_0x2ad864=_[_0x6c07('0x41')]({},_0x2ad864,_0x4331b2[_0x6c07('0x44')]);return db[_0x6c07('0x45')][_0x6c07('0x4b')](_0x2ad864)[_0x6c07('0x2a')](handleEntityNotFound(_0x262be0,null))[_0x6c07('0x2a')](respondWithResult(_0x262be0,null))['catch'](handleError(_0x262be0,null));};exports['create']=function(_0x24781a,_0x501091){return db[_0x6c07('0x45')]['create'](_0x24781a[_0x6c07('0x4c')],{})[_0x6c07('0x2a')](respondWithResult(_0x501091,0xc9))['catch'](handleError(_0x501091,null));};exports['update']=function(_0x4c35b2,_0x4dec5c){if(_0x4c35b2['body']['id']){delete _0x4c35b2[_0x6c07('0x4c')]['id'];}return db[_0x6c07('0x45')][_0x6c07('0x4b')]({'where':{'id':_0x4c35b2['params']['id']}})[_0x6c07('0x2a')](handleEntityNotFound(_0x4dec5c,null))['then'](saveUpdates(_0x4c35b2[_0x6c07('0x4c')],null))[_0x6c07('0x2a')](respondWithResult(_0x4dec5c,null))['catch'](handleError(_0x4dec5c,null));};exports[_0x6c07('0x29')]=function(_0x2fa5d8,_0x215002){return db[_0x6c07('0x45')][_0x6c07('0x4b')]({'where':{'id':_0x2fa5d8['params']['id']}})['then'](handleEntityNotFound(_0x215002,null))[_0x6c07('0x2a')](removeEntity(_0x215002,null))[_0x6c07('0x47')](handleError(_0x215002,null));};exports[_0x6c07('0x4d')]=function(_0x1bd7c6,_0x1997d0,_0x3747ef){var _0x4834a6={};var _0x4f1212={};var _0x224c0e;var _0x59b951;return db['SalesforceConfiguration'][_0x6c07('0x4e')]({'where':{'id':_0x1bd7c6[_0x6c07('0x48')]['id']}})[_0x6c07('0x2a')](handleEntityNotFound(_0x1997d0,null))[_0x6c07('0x2a')](function(_0x4c05c5){if(_0x4c05c5){_0x224c0e=_0x4c05c5;_0x4f1212[_0x6c07('0x35')]=_[_0x6c07('0x33')](db['SalesforceField'][_0x6c07('0x49')]);_0x4f1212[_0x6c07('0x32')]=_[_0x6c07('0x33')](_0x1bd7c6[_0x6c07('0x32')]);_0x4f1212[_0x6c07('0x34')]=_[_0x6c07('0x37')](_0x4f1212['model'],_0x4f1212['query']);_0x4834a6['attributes']=_['intersection'](_0x4f1212['model'],qs['fields'](_0x1bd7c6['query'][_0x6c07('0x38')]));_0x4834a6[_0x6c07('0x36')]=_0x4834a6['attributes']['length']?_0x4834a6[_0x6c07('0x36')]:_0x4f1212[_0x6c07('0x35')];_0x4834a6['order']=qs['sort'](_0x1bd7c6[_0x6c07('0x32')][_0x6c07('0x3d')]);_0x4834a6[_0x6c07('0x40')]=qs[_0x6c07('0x34')](_['pick'](_0x1bd7c6[_0x6c07('0x32')],_0x4f1212[_0x6c07('0x34')]));if(_0x1bd7c6['query'][_0x6c07('0x3f')]){_0x4834a6[_0x6c07('0x40')]=_[_0x6c07('0x41')](_0x4834a6[_0x6c07('0x40')],{'$or':_['map'](_0x4834a6[_0x6c07('0x36')],function(_0x3c19ae){var _0x2e9f9f={};_0x2e9f9f[_0x3c19ae]={'$like':'%'+_0x1bd7c6['query'][_0x6c07('0x3f')]+'%'};return _0x2e9f9f;})});}_0x4834a6=_[_0x6c07('0x41')]({},_0x4834a6,_0x1bd7c6[_0x6c07('0x44')]);return _0x224c0e['getFields'](_0x4834a6);}})[_0x6c07('0x2a')](function(_0x135178){if(_0x135178){_0x59b951=_0x135178[_0x6c07('0x39')];if(!_0x1bd7c6[_0x6c07('0x32')][_0x6c07('0x3a')]('nolimit')){_0x4834a6['limit']=qs[_0x6c07('0x23')](_0x1bd7c6[_0x6c07('0x32')][_0x6c07('0x23')]);_0x4834a6['offset']=qs[_0x6c07('0x25')](_0x1bd7c6[_0x6c07('0x32')][_0x6c07('0x25')]);}return _0x224c0e[_0x6c07('0x4d')](_0x4834a6);}})[_0x6c07('0x2a')](function(_0x2c89f7){if(_0x2c89f7){return _0x2c89f7?{'count':_0x59b951,'rows':_0x2c89f7}:null;}})[_0x6c07('0x2a')](respondWithResult(_0x1997d0,null))[_0x6c07('0x47')](handleError(_0x1997d0,null));};exports[_0x6c07('0x4f')]=function(_0x2056e0,_0x14af0e,_0x2a7582){var _0x2b763d={};var _0x33b574={};var _0x371093;var _0x22da2c;return db[_0x6c07('0x45')][_0x6c07('0x4e')]({'where':{'id':_0x2056e0[_0x6c07('0x48')]['id']}})[_0x6c07('0x2a')](handleEntityNotFound(_0x14af0e,null))['then'](function(_0x1e2497){if(_0x1e2497){_0x371093=_0x1e2497;_0x33b574[_0x6c07('0x35')]=_[_0x6c07('0x33')](db[_0x6c07('0x50')]['rawAttributes']);_0x33b574[_0x6c07('0x32')]=_[_0x6c07('0x33')](_0x2056e0[_0x6c07('0x32')]);_0x33b574[_0x6c07('0x34')]=_[_0x6c07('0x37')](_0x33b574[_0x6c07('0x35')],_0x33b574['query']);_0x2b763d[_0x6c07('0x36')]=_[_0x6c07('0x37')](_0x33b574[_0x6c07('0x35')],qs[_0x6c07('0x38')](_0x2056e0['query'][_0x6c07('0x38')]));_0x2b763d['attributes']=_0x2b763d[_0x6c07('0x36')][_0x6c07('0x39')]?_0x2b763d[_0x6c07('0x36')]:_0x33b574['model'];_0x2b763d[_0x6c07('0x3c')]=qs['sort'](_0x2056e0['query']['sort']);_0x2b763d[_0x6c07('0x40')]=qs[_0x6c07('0x34')](_[_0x6c07('0x3e')](_0x2056e0['query'],_0x33b574[_0x6c07('0x34')]));if(_0x2056e0['query'][_0x6c07('0x3f')]){_0x2b763d['where']=_[_0x6c07('0x41')](_0x2b763d[_0x6c07('0x40')],{'$or':_[_0x6c07('0x2f')](_0x2b763d[_0x6c07('0x36')],function(_0x248efc){var _0x18fd1b={};_0x18fd1b[_0x248efc]={'$like':'%'+_0x2056e0[_0x6c07('0x32')][_0x6c07('0x3f')]+'%'};return _0x18fd1b;})});}_0x2b763d=_[_0x6c07('0x41')]({},_0x2b763d,_0x2056e0[_0x6c07('0x44')]);return _0x371093['getSubjects'](_0x2b763d);}})[_0x6c07('0x2a')](function(_0x79d541){if(_0x79d541){_0x22da2c=_0x79d541[_0x6c07('0x39')];if(!_0x2056e0[_0x6c07('0x32')]['hasOwnProperty'](_0x6c07('0x3b'))){_0x2b763d[_0x6c07('0x23')]=qs[_0x6c07('0x23')](_0x2056e0[_0x6c07('0x32')][_0x6c07('0x23')]);_0x2b763d[_0x6c07('0x25')]=qs[_0x6c07('0x25')](_0x2056e0[_0x6c07('0x32')]['offset']);}return _0x371093[_0x6c07('0x4f')](_0x2b763d);}})['then'](function(_0x3a61f3){if(_0x3a61f3){return _0x3a61f3?{'count':_0x22da2c,'rows':_0x3a61f3}:null;}})[_0x6c07('0x2a')](respondWithResult(_0x14af0e,null))[_0x6c07('0x47')](handleError(_0x14af0e,null));};exports['getDescriptions']=function(_0x36e26e,_0x4cb7f0,_0x3fd61a){var _0x1dd162={};var _0x2d49e1={};var _0x19b184;var _0x2e085f;return db[_0x6c07('0x45')]['findOne']({'where':{'id':_0x36e26e[_0x6c07('0x48')]['id']}})['then'](handleEntityNotFound(_0x4cb7f0,null))[_0x6c07('0x2a')](function(_0x65a838){if(_0x65a838){_0x19b184=_0x65a838;_0x2d49e1[_0x6c07('0x35')]=_[_0x6c07('0x33')](db[_0x6c07('0x50')]['rawAttributes']);_0x2d49e1['query']=_[_0x6c07('0x33')](_0x36e26e[_0x6c07('0x32')]);_0x2d49e1[_0x6c07('0x34')]=_[_0x6c07('0x37')](_0x2d49e1[_0x6c07('0x35')],_0x2d49e1[_0x6c07('0x32')]);_0x1dd162['attributes']=_[_0x6c07('0x37')](_0x2d49e1[_0x6c07('0x35')],qs[_0x6c07('0x38')](_0x36e26e[_0x6c07('0x32')]['fields']));_0x1dd162[_0x6c07('0x36')]=_0x1dd162[_0x6c07('0x36')][_0x6c07('0x39')]?_0x1dd162[_0x6c07('0x36')]:_0x2d49e1[_0x6c07('0x35')];_0x1dd162[_0x6c07('0x3c')]=qs[_0x6c07('0x3d')](_0x36e26e[_0x6c07('0x32')][_0x6c07('0x3d')]);_0x1dd162['where']=qs[_0x6c07('0x34')](_[_0x6c07('0x3e')](_0x36e26e[_0x6c07('0x32')],_0x2d49e1[_0x6c07('0x34')]));if(_0x36e26e['query']['filter']){_0x1dd162[_0x6c07('0x40')]=_['merge'](_0x1dd162['where'],{'$or':_['map'](_0x1dd162['attributes'],function(_0xab3244){var _0x4ac414={};_0x4ac414[_0xab3244]={'$like':'%'+_0x36e26e[_0x6c07('0x32')][_0x6c07('0x3f')]+'%'};return _0x4ac414;})});}_0x1dd162=_[_0x6c07('0x41')]({},_0x1dd162,_0x36e26e[_0x6c07('0x44')]);return _0x19b184['getDescriptions'](_0x1dd162);}})[_0x6c07('0x2a')](function(_0x2dd08f){if(_0x2dd08f){_0x2e085f=_0x2dd08f[_0x6c07('0x39')];if(!_0x36e26e[_0x6c07('0x32')]['hasOwnProperty']('nolimit')){_0x1dd162[_0x6c07('0x23')]=qs[_0x6c07('0x23')](_0x36e26e['query']['limit']);_0x1dd162[_0x6c07('0x25')]=qs[_0x6c07('0x25')](_0x36e26e[_0x6c07('0x32')][_0x6c07('0x25')]);}return _0x19b184[_0x6c07('0x51')](_0x1dd162);}})[_0x6c07('0x2a')](function(_0x433e1a){if(_0x433e1a){return _0x433e1a?{'count':_0x2e085f,'rows':_0x433e1a}:null;}})[_0x6c07('0x2a')](respondWithResult(_0x4cb7f0,null))[_0x6c07('0x47')](handleError(_0x4cb7f0,null));}; \ No newline at end of file +var _0x5183=['params','rawAttributes','includeAll','catch','create','body','update','find','getFields','SalesforceField','getSubjects','findOne','hasOwnProperty','getDescriptions','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','SalesforceConfiguration','type','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','findAll','rows','show'];(function(_0x2f303d,_0x56ea91){var _0x2c9ff6=function(_0x138ad9){while(--_0x138ad9){_0x2f303d['push'](_0x2f303d['shift']());}};_0x2c9ff6(++_0x56ea91);}(_0x5183,0x13e));var _0x3518=function(_0x54e586,_0x3a0f21){_0x54e586=_0x54e586-0x0;var _0x58a107=_0x5183[_0x54e586];return _0x58a107;};'use strict';var emlformat=require(_0x3518('0x0'));var rimraf=require(_0x3518('0x1'));var zipdir=require(_0x3518('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3518('0x3'));var BPromise=require(_0x3518('0x4'));var Mustache=require(_0x3518('0x5'));var util=require(_0x3518('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x3518('0x7'));var ejs=require(_0x3518('0x8'));var fs=require('fs');var fs_extra=require(_0x3518('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3518('0xa'));var deskjs=require(_0x3518('0xb'));var toCsv=require(_0x3518('0x7'));var querystring=require('querystring');var Papa=require(_0x3518('0xc'));var Redis=require('ioredis');var authService=require(_0x3518('0xd'));var qs=require(_0x3518('0xe'));var as=require(_0x3518('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3518('0x10'))(_0x3518('0x11'));var utils=require('../../config/utils');var config=require(_0x3518('0x12'));var licenseUtil=require(_0x3518('0x13'));var db=require(_0x3518('0x14'))['db'];function respondWithStatusCode(_0x410b8f,_0x4913bb){_0x4913bb=_0x4913bb||0xcc;return function(_0x4ec528){if(_0x4ec528){return _0x410b8f[_0x3518('0x15')](_0x4913bb);}return _0x410b8f[_0x3518('0x16')](_0x4913bb)[_0x3518('0x17')]();};}function respondWithResult(_0x47e192,_0x563507){_0x563507=_0x563507||0xc8;return function(_0x4593cd){if(_0x4593cd){return _0x47e192[_0x3518('0x16')](_0x563507)[_0x3518('0x18')](_0x4593cd);}};}function respondWithFilteredResult(_0x488364,_0xcd8688){return function(_0x4ed175){if(_0x4ed175){var _0x1faa77=typeof _0xcd8688[_0x3518('0x19')]==='undefined'&&typeof _0xcd8688[_0x3518('0x1a')]==='undefined';var _0xd24f36=_0x4ed175['count'];var _0x3f67b6=_0x1faa77?0x0:_0xcd8688[_0x3518('0x19')];var _0x4b9a06=_0x1faa77?_0x4ed175[_0x3518('0x1b')]:_0xcd8688[_0x3518('0x19')]+_0xcd8688[_0x3518('0x1a')];var _0x8092d6;if(_0x4b9a06>=_0xd24f36){_0x4b9a06=_0xd24f36;_0x8092d6=0xc8;}else{_0x8092d6=0xce;}_0x488364[_0x3518('0x16')](_0x8092d6);return _0x488364['set'](_0x3518('0x1c'),_0x3f67b6+'-'+_0x4b9a06+'/'+_0xd24f36)['json'](_0x4ed175);}return null;};}function patchUpdates(_0x29e696){return function(_0x3af458){try{jsonpatch[_0x3518('0x1d')](_0x3af458,_0x29e696,!![]);}catch(_0x507047){return BPromise[_0x3518('0x1e')](_0x507047);}return _0x3af458[_0x3518('0x1f')]();};}function saveUpdates(_0x2a3b9a,_0x1e25a9){return function(_0x1d76fe){if(_0x1d76fe){return _0x1d76fe['update'](_0x2a3b9a)[_0x3518('0x20')](function(_0x606576){return _0x606576;});}return null;};}function removeEntity(_0x421c2e,_0x3082a7){return function(_0x253f98){if(_0x253f98){return _0x253f98[_0x3518('0x21')]()[_0x3518('0x20')](function(){_0x421c2e[_0x3518('0x16')](0xcc)[_0x3518('0x17')]();});}};}function handleEntityNotFound(_0x440920,_0x19577c){return function(_0x369a36){if(!_0x369a36){_0x440920[_0x3518('0x15')](0x194);}return _0x369a36;};}function handleError(_0x77f693,_0x319d89){_0x319d89=_0x319d89||0x1f4;return function(_0x428b25){logger[_0x3518('0x22')](_0x428b25[_0x3518('0x23')]);if(_0x428b25[_0x3518('0x24')]){delete _0x428b25[_0x3518('0x24')];}_0x77f693[_0x3518('0x16')](_0x319d89)[_0x3518('0x25')](_0x428b25);};}exports[_0x3518('0x26')]=function(_0x369d58,_0x4cfaa7){var _0x5009e3={},_0x3f8b72={},_0x1d1d76={'count':0x0,'rows':[]};var _0x4c16d6=_[_0x3518('0x27')](db[_0x3518('0x28')]['rawAttributes'],function(_0x99b607){return{'name':_0x99b607['fieldName'],'type':_0x99b607[_0x3518('0x29')]['key']};});_0x3f8b72[_0x3518('0x2a')]=_[_0x3518('0x27')](_0x4c16d6,_0x3518('0x24'));_0x3f8b72[_0x3518('0x2b')]=_[_0x3518('0x2c')](_0x369d58[_0x3518('0x2b')]);_0x3f8b72['filters']=_[_0x3518('0x2d')](_0x3f8b72['model'],_0x3f8b72[_0x3518('0x2b')]);_0x5009e3[_0x3518('0x2e')]=_[_0x3518('0x2d')](_0x3f8b72[_0x3518('0x2a')],qs[_0x3518('0x2f')](_0x369d58[_0x3518('0x2b')][_0x3518('0x2f')]));_0x5009e3[_0x3518('0x2e')]=_0x5009e3[_0x3518('0x2e')][_0x3518('0x30')]?_0x5009e3[_0x3518('0x2e')]:_0x3f8b72[_0x3518('0x2a')];if(!_0x369d58[_0x3518('0x2b')]['hasOwnProperty'](_0x3518('0x31'))){_0x5009e3[_0x3518('0x1a')]=qs[_0x3518('0x1a')](_0x369d58[_0x3518('0x2b')][_0x3518('0x1a')]);_0x5009e3[_0x3518('0x19')]=qs[_0x3518('0x19')](_0x369d58['query'][_0x3518('0x19')]);}_0x5009e3[_0x3518('0x32')]=qs[_0x3518('0x33')](_0x369d58[_0x3518('0x2b')]['sort']);_0x5009e3['where']=qs[_0x3518('0x34')](_[_0x3518('0x35')](_0x369d58[_0x3518('0x2b')],_0x3f8b72[_0x3518('0x34')]),_0x4c16d6);if(_0x369d58['query'][_0x3518('0x36')]){_0x5009e3[_0x3518('0x37')]=_[_0x3518('0x38')](_0x5009e3[_0x3518('0x37')],{'$or':_[_0x3518('0x27')](_0x4c16d6,function(_0x52be8b){if(_0x52be8b[_0x3518('0x29')]!==_0x3518('0x39')){var _0x231d65={};_0x231d65[_0x52be8b[_0x3518('0x24')]]={'$like':'%'+_0x369d58[_0x3518('0x2b')][_0x3518('0x36')]+'%'};return _0x231d65;}})});}_0x5009e3=_[_0x3518('0x38')]({},_0x5009e3,_0x369d58[_0x3518('0x3a')]);var _0x52e77={'where':_0x5009e3['where']};return db[_0x3518('0x28')][_0x3518('0x1b')](_0x52e77)[_0x3518('0x20')](function(_0x48d1f8){_0x1d1d76[_0x3518('0x1b')]=_0x48d1f8;if(_0x369d58[_0x3518('0x2b')]['includeAll']){_0x5009e3['include']=[{'all':!![]}];}return db[_0x3518('0x28')][_0x3518('0x3b')](_0x5009e3);})[_0x3518('0x20')](function(_0x2d9f87){_0x1d1d76[_0x3518('0x3c')]=_0x2d9f87;return _0x1d1d76;})[_0x3518('0x20')](respondWithFilteredResult(_0x4cfaa7,_0x5009e3))['catch'](handleError(_0x4cfaa7,null));};exports[_0x3518('0x3d')]=function(_0x14fe1b,_0x1ede58){var _0x3c5eba={'raw':![],'where':{'id':_0x14fe1b[_0x3518('0x3e')]['id']}},_0x56ab5e={};_0x56ab5e[_0x3518('0x2a')]=_[_0x3518('0x2c')](db[_0x3518('0x28')][_0x3518('0x3f')]);_0x56ab5e[_0x3518('0x2b')]=_[_0x3518('0x2c')](_0x14fe1b[_0x3518('0x2b')]);_0x56ab5e[_0x3518('0x34')]=_[_0x3518('0x2d')](_0x56ab5e[_0x3518('0x2a')],_0x56ab5e[_0x3518('0x2b')]);_0x3c5eba['attributes']=_['intersection'](_0x56ab5e[_0x3518('0x2a')],qs['fields'](_0x14fe1b['query']['fields']));_0x3c5eba[_0x3518('0x2e')]=_0x3c5eba[_0x3518('0x2e')][_0x3518('0x30')]?_0x3c5eba[_0x3518('0x2e')]:_0x56ab5e[_0x3518('0x2a')];if(_0x14fe1b['query'][_0x3518('0x40')]){_0x3c5eba['include']=[{'all':!![]}];}_0x3c5eba=_[_0x3518('0x38')]({},_0x3c5eba,_0x14fe1b[_0x3518('0x3a')]);return db['SalesforceConfiguration']['find'](_0x3c5eba)[_0x3518('0x20')](handleEntityNotFound(_0x1ede58,null))[_0x3518('0x20')](respondWithResult(_0x1ede58,null))[_0x3518('0x41')](handleError(_0x1ede58,null));};exports[_0x3518('0x42')]=function(_0x482c6e,_0x760d9b){return db[_0x3518('0x28')]['create'](_0x482c6e[_0x3518('0x43')],{})['then'](respondWithResult(_0x760d9b,0xc9))[_0x3518('0x41')](handleError(_0x760d9b,null));};exports[_0x3518('0x44')]=function(_0x5efb90,_0x1c2506){if(_0x5efb90[_0x3518('0x43')]['id']){delete _0x5efb90['body']['id'];}return db['SalesforceConfiguration'][_0x3518('0x45')]({'where':{'id':_0x5efb90[_0x3518('0x3e')]['id']}})[_0x3518('0x20')](handleEntityNotFound(_0x1c2506,null))[_0x3518('0x20')](saveUpdates(_0x5efb90['body'],null))[_0x3518('0x20')](respondWithResult(_0x1c2506,null))[_0x3518('0x41')](handleError(_0x1c2506,null));};exports[_0x3518('0x21')]=function(_0x3e44b9,_0x25f4f0){return db[_0x3518('0x28')][_0x3518('0x45')]({'where':{'id':_0x3e44b9['params']['id']}})[_0x3518('0x20')](handleEntityNotFound(_0x25f4f0,null))[_0x3518('0x20')](removeEntity(_0x25f4f0,null))['catch'](handleError(_0x25f4f0,null));};exports[_0x3518('0x46')]=function(_0x3b2869,_0x1dda68,_0x58cfa7){var _0x44fdac={};var _0xae2751={};var _0x4f8cb6;var _0x50b998;return db[_0x3518('0x28')]['findOne']({'where':{'id':_0x3b2869[_0x3518('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1dda68,null))[_0x3518('0x20')](function(_0x210b81){if(_0x210b81){_0x4f8cb6=_0x210b81;_0xae2751[_0x3518('0x2a')]=_['keys'](db[_0x3518('0x47')]['rawAttributes']);_0xae2751[_0x3518('0x2b')]=_['keys'](_0x3b2869[_0x3518('0x2b')]);_0xae2751['filters']=_[_0x3518('0x2d')](_0xae2751[_0x3518('0x2a')],_0xae2751[_0x3518('0x2b')]);_0x44fdac[_0x3518('0x2e')]=_[_0x3518('0x2d')](_0xae2751[_0x3518('0x2a')],qs[_0x3518('0x2f')](_0x3b2869[_0x3518('0x2b')][_0x3518('0x2f')]));_0x44fdac[_0x3518('0x2e')]=_0x44fdac[_0x3518('0x2e')][_0x3518('0x30')]?_0x44fdac[_0x3518('0x2e')]:_0xae2751[_0x3518('0x2a')];_0x44fdac[_0x3518('0x32')]=qs['sort'](_0x3b2869[_0x3518('0x2b')]['sort']);_0x44fdac[_0x3518('0x37')]=qs[_0x3518('0x34')](_[_0x3518('0x35')](_0x3b2869[_0x3518('0x2b')],_0xae2751[_0x3518('0x34')]));if(_0x3b2869[_0x3518('0x2b')]['filter']){_0x44fdac[_0x3518('0x37')]=_[_0x3518('0x38')](_0x44fdac[_0x3518('0x37')],{'$or':_[_0x3518('0x27')](_0x44fdac['attributes'],function(_0x994b33){var _0x5ca93d={};_0x5ca93d[_0x994b33]={'$like':'%'+_0x3b2869[_0x3518('0x2b')][_0x3518('0x36')]+'%'};return _0x5ca93d;})});}_0x44fdac=_[_0x3518('0x38')]({},_0x44fdac,_0x3b2869[_0x3518('0x3a')]);return _0x4f8cb6[_0x3518('0x46')](_0x44fdac);}})[_0x3518('0x20')](function(_0x234ac6){if(_0x234ac6){_0x50b998=_0x234ac6[_0x3518('0x30')];if(!_0x3b2869[_0x3518('0x2b')]['hasOwnProperty']('nolimit')){_0x44fdac[_0x3518('0x1a')]=qs[_0x3518('0x1a')](_0x3b2869[_0x3518('0x2b')][_0x3518('0x1a')]);_0x44fdac[_0x3518('0x19')]=qs[_0x3518('0x19')](_0x3b2869[_0x3518('0x2b')][_0x3518('0x19')]);}return _0x4f8cb6[_0x3518('0x46')](_0x44fdac);}})['then'](function(_0x199cb1){if(_0x199cb1){return _0x199cb1?{'count':_0x50b998,'rows':_0x199cb1}:null;}})[_0x3518('0x20')](respondWithResult(_0x1dda68,null))[_0x3518('0x41')](handleError(_0x1dda68,null));};exports[_0x3518('0x48')]=function(_0x1a6121,_0x36c635,_0x4dcd28){var _0x1453a2={};var _0x4b2c28={};var _0x2c18c3;var _0x3d0ecb;return db[_0x3518('0x28')][_0x3518('0x49')]({'where':{'id':_0x1a6121['params']['id']}})[_0x3518('0x20')](handleEntityNotFound(_0x36c635,null))['then'](function(_0x5d49b9){if(_0x5d49b9){_0x2c18c3=_0x5d49b9;_0x4b2c28[_0x3518('0x2a')]=_[_0x3518('0x2c')](db[_0x3518('0x47')][_0x3518('0x3f')]);_0x4b2c28[_0x3518('0x2b')]=_[_0x3518('0x2c')](_0x1a6121[_0x3518('0x2b')]);_0x4b2c28[_0x3518('0x34')]=_[_0x3518('0x2d')](_0x4b2c28[_0x3518('0x2a')],_0x4b2c28[_0x3518('0x2b')]);_0x1453a2['attributes']=_[_0x3518('0x2d')](_0x4b2c28[_0x3518('0x2a')],qs[_0x3518('0x2f')](_0x1a6121['query'][_0x3518('0x2f')]));_0x1453a2['attributes']=_0x1453a2['attributes'][_0x3518('0x30')]?_0x1453a2[_0x3518('0x2e')]:_0x4b2c28[_0x3518('0x2a')];_0x1453a2['order']=qs[_0x3518('0x33')](_0x1a6121[_0x3518('0x2b')][_0x3518('0x33')]);_0x1453a2[_0x3518('0x37')]=qs['filters'](_['pick'](_0x1a6121[_0x3518('0x2b')],_0x4b2c28[_0x3518('0x34')]));if(_0x1a6121[_0x3518('0x2b')]['filter']){_0x1453a2[_0x3518('0x37')]=_['merge'](_0x1453a2[_0x3518('0x37')],{'$or':_[_0x3518('0x27')](_0x1453a2[_0x3518('0x2e')],function(_0x568b7c){var _0x1e1f9a={};_0x1e1f9a[_0x568b7c]={'$like':'%'+_0x1a6121[_0x3518('0x2b')][_0x3518('0x36')]+'%'};return _0x1e1f9a;})});}_0x1453a2=_['merge']({},_0x1453a2,_0x1a6121[_0x3518('0x3a')]);return _0x2c18c3[_0x3518('0x48')](_0x1453a2);}})['then'](function(_0x5f3d92){if(_0x5f3d92){_0x3d0ecb=_0x5f3d92['length'];if(!_0x1a6121[_0x3518('0x2b')][_0x3518('0x4a')]('nolimit')){_0x1453a2[_0x3518('0x1a')]=qs['limit'](_0x1a6121[_0x3518('0x2b')][_0x3518('0x1a')]);_0x1453a2[_0x3518('0x19')]=qs['offset'](_0x1a6121[_0x3518('0x2b')][_0x3518('0x19')]);}return _0x2c18c3[_0x3518('0x48')](_0x1453a2);}})[_0x3518('0x20')](function(_0x40544a){if(_0x40544a){return _0x40544a?{'count':_0x3d0ecb,'rows':_0x40544a}:null;}})[_0x3518('0x20')](respondWithResult(_0x36c635,null))[_0x3518('0x41')](handleError(_0x36c635,null));};exports[_0x3518('0x4b')]=function(_0x4c93ca,_0x5aaca9,_0x346d33){var _0x345203={};var _0x5891c9={};var _0x10e150;var _0x1feef9;return db[_0x3518('0x28')][_0x3518('0x49')]({'where':{'id':_0x4c93ca[_0x3518('0x3e')]['id']}})[_0x3518('0x20')](handleEntityNotFound(_0x5aaca9,null))[_0x3518('0x20')](function(_0x2ce26d){if(_0x2ce26d){_0x10e150=_0x2ce26d;_0x5891c9[_0x3518('0x2a')]=_[_0x3518('0x2c')](db[_0x3518('0x47')][_0x3518('0x3f')]);_0x5891c9[_0x3518('0x2b')]=_[_0x3518('0x2c')](_0x4c93ca[_0x3518('0x2b')]);_0x5891c9[_0x3518('0x34')]=_[_0x3518('0x2d')](_0x5891c9[_0x3518('0x2a')],_0x5891c9[_0x3518('0x2b')]);_0x345203[_0x3518('0x2e')]=_[_0x3518('0x2d')](_0x5891c9['model'],qs[_0x3518('0x2f')](_0x4c93ca[_0x3518('0x2b')][_0x3518('0x2f')]));_0x345203[_0x3518('0x2e')]=_0x345203[_0x3518('0x2e')][_0x3518('0x30')]?_0x345203[_0x3518('0x2e')]:_0x5891c9[_0x3518('0x2a')];_0x345203[_0x3518('0x32')]=qs[_0x3518('0x33')](_0x4c93ca[_0x3518('0x2b')][_0x3518('0x33')]);_0x345203[_0x3518('0x37')]=qs[_0x3518('0x34')](_[_0x3518('0x35')](_0x4c93ca['query'],_0x5891c9[_0x3518('0x34')]));if(_0x4c93ca[_0x3518('0x2b')][_0x3518('0x36')]){_0x345203[_0x3518('0x37')]=_[_0x3518('0x38')](_0x345203['where'],{'$or':_[_0x3518('0x27')](_0x345203[_0x3518('0x2e')],function(_0x1ae3c4){var _0x3264e0={};_0x3264e0[_0x1ae3c4]={'$like':'%'+_0x4c93ca[_0x3518('0x2b')][_0x3518('0x36')]+'%'};return _0x3264e0;})});}_0x345203=_[_0x3518('0x38')]({},_0x345203,_0x4c93ca[_0x3518('0x3a')]);return _0x10e150[_0x3518('0x4b')](_0x345203);}})['then'](function(_0x9cf2c1){if(_0x9cf2c1){_0x1feef9=_0x9cf2c1[_0x3518('0x30')];if(!_0x4c93ca[_0x3518('0x2b')][_0x3518('0x4a')](_0x3518('0x31'))){_0x345203[_0x3518('0x1a')]=qs[_0x3518('0x1a')](_0x4c93ca['query'][_0x3518('0x1a')]);_0x345203['offset']=qs[_0x3518('0x19')](_0x4c93ca[_0x3518('0x2b')][_0x3518('0x19')]);}return _0x10e150['getDescriptions'](_0x345203);}})[_0x3518('0x20')](function(_0xa617f){if(_0xa617f){return _0xa617f?{'count':_0x1feef9,'rows':_0xa617f}:null;}})[_0x3518('0x20')](respondWithResult(_0x5aaca9,null))[_0x3518('0x41')](handleError(_0x5aaca9,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 9c21b16..fde0bb1 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 _0x0a3a=['./intSalesforceConfiguration.attributes','define','SalesforceConfiguration','int_salesforce_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x27668d,_0x572fb1){var _0x475891=function(_0x4c79d3){while(--_0x4c79d3){_0x27668d['push'](_0x27668d['shift']());}};_0x475891(++_0x572fb1);}(_0x0a3a,0x148));var _0xa0a3=function(_0x5ab20a,_0x9677a0){_0x5ab20a=_0x5ab20a-0x0;var _0x2414c4=_0x0a3a[_0x5ab20a];return _0x2414c4;};'use strict';var _=require(_0xa0a3('0x0'));var util=require('util');var logger=require(_0xa0a3('0x1'))(_0xa0a3('0x2'));var moment=require(_0xa0a3('0x3'));var BPromise=require(_0xa0a3('0x4'));var rp=require(_0xa0a3('0x5'));var fs=require('fs');var path=require(_0xa0a3('0x6'));var rimraf=require(_0xa0a3('0x7'));var config=require('../../config/environment');var attributes=require(_0xa0a3('0x8'));module['exports']=function(_0x330ddf,_0x416fef){return _0x330ddf[_0xa0a3('0x9')](_0xa0a3('0xa'),attributes,{'tableName':_0xa0a3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x04e8=['bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','lodash','util','../../config/logger','api','moment'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x04e8,0x159));var _0x804e=function(_0x3fcbae,_0x42bf3b){_0x3fcbae=_0x3fcbae-0x0;var _0x298aa1=_0x04e8[_0x3fcbae];return _0x298aa1;};'use strict';var _=require(_0x804e('0x0'));var util=require(_0x804e('0x1'));var logger=require(_0x804e('0x2'))(_0x804e('0x3'));var moment=require(_0x804e('0x4'));var BPromise=require(_0x804e('0x5'));var rp=require(_0x804e('0x6'));var fs=require('fs');var path=require(_0x804e('0x7'));var rimraf=require(_0x804e('0x8'));var config=require(_0x804e('0x9'));var attributes=require(_0x804e('0xa'));module[_0x804e('0xb')]=function(_0x413df4,_0x11f8a8){return _0x413df4[_0x804e('0xc')](_0x804e('0xd'),attributes,{'tableName':'int_salesforce_configurations','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 4b3f3d6..37d0513 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 _0x26d6=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','lodash','util','moment'];(function(_0x2c8931,_0xae979e){var _0x26f09c=function(_0x59ea10){while(--_0x59ea10){_0x2c8931['push'](_0x2c8931['shift']());}};_0x26f09c(++_0xae979e);}(_0x26d6,0xcc));var _0x626d=function(_0x3c0e33,_0x4e9903){_0x3c0e33=_0x3c0e33-0x0;var _0x48d10c=_0x26d6[_0x3c0e33];return _0x48d10c;};'use strict';var _=require(_0x626d('0x0'));var util=require(_0x626d('0x1'));var moment=require(_0x626d('0x2'));var BPromise=require(_0x626d('0x3'));var rs=require(_0x626d('0x4'));var fs=require('fs');var Redis=require(_0x626d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x626d('0x6'));var logger=require(_0x626d('0x7'))('rpc');var config=require(_0x626d('0x8'));var jayson=require(_0x626d('0x9'));var client=jayson[_0x626d('0xa')][_0x626d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24f3e2,_0x3bb2a1,_0x28f256){return new BPromise(function(_0x119c73,_0x107b4b){return client[_0x626d('0xc')](_0x24f3e2,_0x28f256)[_0x626d('0xd')](function(_0x31d409){logger[_0x626d('0xe')](_0x626d('0xf'),_0x3bb2a1,'request\x20sent');logger[_0x626d('0x10')](_0x626d('0x11'),_0x3bb2a1,'request\x20sent',JSON['stringify'](_0x31d409));if(_0x31d409[_0x626d('0x12')]){if(_0x31d409[_0x626d('0x12')][_0x626d('0x13')]===0x1f4){logger[_0x626d('0x12')](_0x626d('0xf'),_0x3bb2a1,_0x31d409[_0x626d('0x12')][_0x626d('0x14')]);return _0x107b4b(_0x31d409['error'][_0x626d('0x14')]);}logger[_0x626d('0x12')](_0x626d('0xf'),_0x3bb2a1,_0x31d409['error']['message']);return _0x119c73(_0x31d409['error'][_0x626d('0x14')]);}else{logger[_0x626d('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3bb2a1,_0x626d('0x15'));_0x119c73(_0x31d409['result'][_0x626d('0x14')]);}})[_0x626d('0x16')](function(_0x74631d){logger[_0x626d('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3bb2a1,_0x74631d);_0x107b4b(_0x74631d);});});} \ No newline at end of file +var _0x17b3=['result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','SalesforceConfiguration,\x20%s,\x20%s'];(function(_0x31a938,_0x4daec6){var _0x1bf341=function(_0x514261){while(--_0x514261){_0x31a938['push'](_0x31a938['shift']());}};_0x1bf341(++_0x4daec6);}(_0x17b3,0x162));var _0x317b=function(_0x41521b,_0x2d7451){_0x41521b=_0x41521b-0x0;var _0x28c340=_0x17b3[_0x41521b];return _0x28c340;};'use strict';var _=require(_0x317b('0x0'));var util=require(_0x317b('0x1'));var moment=require(_0x317b('0x2'));var BPromise=require(_0x317b('0x3'));var rs=require(_0x317b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x317b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x317b('0x6'))(_0x317b('0x7'));var config=require(_0x317b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x317b('0x9')][_0x317b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf8b641,_0x53c875,_0x2fd6ff){return new BPromise(function(_0x502b4c,_0x5a33a8){return client[_0x317b('0xb')](_0xf8b641,_0x2fd6ff)[_0x317b('0xc')](function(_0x538d77){logger[_0x317b('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x53c875,'request\x20sent');logger['debug'](_0x317b('0xe'),_0x53c875,_0x317b('0xf'),JSON['stringify'](_0x538d77));if(_0x538d77['error']){if(_0x538d77[_0x317b('0x10')][_0x317b('0x11')]===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x53c875,_0x538d77['error'][_0x317b('0x12')]);return _0x5a33a8(_0x538d77['error']['message']);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x53c875,_0x538d77[_0x317b('0x10')]['message']);return _0x502b4c(_0x538d77['error'][_0x317b('0x12')]);}else{logger['info'](_0x317b('0x13'),_0x53c875,'request\x20sent');_0x502b4c(_0x538d77[_0x317b('0x14')]['message']);}})[_0x317b('0x15')](function(_0x213af7){logger[_0x317b('0x10')](_0x317b('0x13'),_0x53c875,_0x213af7);_0x5a33a8(_0x213af7);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index a93f900..281fbcb 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 _0x28b8=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','exports','multer'];(function(_0x4d63be,_0x1a3d83){var _0x56c40e=function(_0x35e03b){while(--_0x35e03b){_0x4d63be['push'](_0x4d63be['shift']());}};_0x56c40e(++_0x1a3d83);}(_0x28b8,0x1a3));var _0x828b=function(_0x798ff3,_0x48ccf4){_0x798ff3=_0x798ff3-0x0;var _0x3d51cc=_0x28b8[_0x798ff3];return _0x3d51cc;};'use strict';var multer=require(_0x828b('0x0'));var util=require(_0x828b('0x1'));var path=require(_0x828b('0x2'));var timeout=require(_0x828b('0x3'));var express=require(_0x828b('0x4'));var router=express[_0x828b('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x828b('0x6'));var config=require(_0x828b('0x7'));var controller=require(_0x828b('0x8'));router[_0x828b('0x9')]('/',auth[_0x828b('0xa')](),controller[_0x828b('0xb')]);router[_0x828b('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x828b('0xc')]);router[_0x828b('0xd')]('/',auth[_0x828b('0xa')](),controller[_0x828b('0xe')]);router[_0x828b('0xf')](_0x828b('0x10'),auth['isAuthenticated'](),controller[_0x828b('0x11')]);router[_0x828b('0x12')]('/:id',auth[_0x828b('0xa')](),controller['destroy']);module[_0x828b('0x13')]=router; \ No newline at end of file +var _0x94fb=['update','destroy','multer','util','path','express','Router','fs-extra','./intSalesforceField.controller','get','isAuthenticated','/:id','post','create','put'];(function(_0x1034ee,_0x12998c){var _0x2922af=function(_0x13715a){while(--_0x13715a){_0x1034ee['push'](_0x1034ee['shift']());}};_0x2922af(++_0x12998c);}(_0x94fb,0xb6));var _0xb94f=function(_0x5a1a51,_0x144c79){_0x5a1a51=_0x5a1a51-0x0;var _0x47edd7=_0x94fb[_0x5a1a51];return _0x47edd7;};'use strict';var multer=require(_0xb94f('0x0'));var util=require(_0xb94f('0x1'));var path=require(_0xb94f('0x2'));var timeout=require('connect-timeout');var express=require(_0xb94f('0x3'));var router=express[_0xb94f('0x4')]();var fs_extra=require(_0xb94f('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb94f('0x6'));router[_0xb94f('0x7')]('/',auth[_0xb94f('0x8')](),controller['index']);router[_0xb94f('0x7')](_0xb94f('0x9'),auth[_0xb94f('0x8')](),controller['show']);router[_0xb94f('0xa')]('/',auth[_0xb94f('0x8')](),controller[_0xb94f('0xb')]);router[_0xb94f('0xc')](_0xb94f('0x9'),auth['isAuthenticated'](),controller[_0xb94f('0xd')]);router['delete'](_0xb94f('0x9'),auth[_0xb94f('0x8')](),controller[_0xb94f('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index eb08ecf..2b1173d 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 _0x5532=['STRING','ENUM','variable','customVariable','keyValue','string'];(function(_0x18d5d7,_0x19074b){var _0x30a9ea=function(_0x514f3f){while(--_0x514f3f){_0x18d5d7['push'](_0x18d5d7['shift']());}};_0x30a9ea(++_0x19074b);}(_0x5532,0x6d));var _0x2553=function(_0x2b1a99,_0x47bede){_0x2b1a99=_0x2b1a99-0x0;var _0x28166e=_0x5532[_0x2b1a99];return _0x28166e;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x2553('0x0')]('string',_0x2553('0x1'),_0x2553('0x2'),_0x2553('0x3'),'picklist'),'defaultValue':_0x2553('0x4')},'content':{'type':Sequelize[_0x2553('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2553('0x0')](_0x2553('0x4'),_0x2553('0x1'),'customVariable')},'keyContent':{'type':Sequelize[_0x2553('0x5')]},'idField':{'type':Sequelize[_0x2553('0x5')]},'variableName':{'type':Sequelize[_0x2553('0x5')]}}; \ No newline at end of file +var _0x50d1=['customVariable','picklist','STRING','sequelize','ENUM','string','variable'];(function(_0x49b636,_0x1e5bcc){var _0x3b227c=function(_0x504e44){while(--_0x504e44){_0x49b636['push'](_0x49b636['shift']());}};_0x3b227c(++_0x1e5bcc);}(_0x50d1,0x13e));var _0x150d=function(_0x3d3316,_0x52f548){_0x3d3316=_0x3d3316-0x0;var _0x4da79d=_0x50d1[_0x3d3316];return _0x4da79d;};'use strict';var Sequelize=require(_0x150d('0x0'));module['exports']={'type':{'type':Sequelize[_0x150d('0x1')](_0x150d('0x2'),_0x150d('0x3'),_0x150d('0x4'),'keyValue',_0x150d('0x5')),'defaultValue':_0x150d('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x150d('0x6')]},'keyType':{'type':Sequelize[_0x150d('0x1')](_0x150d('0x2'),_0x150d('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x150d('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 27c9622..d1d0421 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 _0xc193=['set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','SalesforceField','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','filter','where','merge','map','VIRTUAL','options','include','findAll','rows','show','params','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count'];(function(_0x22868f,_0x450f48){var _0x97bc75=function(_0x447cb4){while(--_0x447cb4){_0x22868f['push'](_0x22868f['shift']());}};_0x97bc75(++_0x450f48);}(_0xc193,0x10a));var _0x3c19=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc193[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0x3c19('0x0'));var rimraf=require(_0x3c19('0x1'));var zipdir=require(_0x3c19('0x2'));var jsonpatch=require(_0x3c19('0x3'));var rp=require(_0x3c19('0x4'));var moment=require('moment');var BPromise=require(_0x3c19('0x5'));var Mustache=require(_0x3c19('0x6'));var util=require(_0x3c19('0x7'));var path=require(_0x3c19('0x8'));var sox=require(_0x3c19('0x9'));var csv=require(_0x3c19('0xa'));var ejs=require(_0x3c19('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3c19('0xc'));var crypto=require(_0x3c19('0xd'));var jsforce=require(_0x3c19('0xe'));var deskjs=require(_0x3c19('0xf'));var toCsv=require(_0x3c19('0xa'));var querystring=require(_0x3c19('0x10'));var Papa=require(_0x3c19('0x11'));var Redis=require(_0x3c19('0x12'));var authService=require(_0x3c19('0x13'));var qs=require(_0x3c19('0x14'));var as=require(_0x3c19('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c19('0x16'))(_0x3c19('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3c19('0x18'));var db=require(_0x3c19('0x19'))['db'];function respondWithStatusCode(_0x1842df,_0x54abea){_0x54abea=_0x54abea||0xcc;return function(_0x27f29a){if(_0x27f29a){return _0x1842df[_0x3c19('0x1a')](_0x54abea);}return _0x1842df['status'](_0x54abea)[_0x3c19('0x1b')]();};}function respondWithResult(_0x2f9f48,_0x1c7a79){_0x1c7a79=_0x1c7a79||0xc8;return function(_0x5d54a2){if(_0x5d54a2){return _0x2f9f48[_0x3c19('0x1c')](_0x1c7a79)[_0x3c19('0x1d')](_0x5d54a2);}};}function respondWithFilteredResult(_0x47c331,_0x1f0ce4){return function(_0x36d419){if(_0x36d419){var _0x4dd0ac=typeof _0x1f0ce4[_0x3c19('0x1e')]===_0x3c19('0x1f')&&typeof _0x1f0ce4[_0x3c19('0x20')]===_0x3c19('0x1f');var _0x427e92=_0x36d419[_0x3c19('0x21')];var _0xa9b04a=_0x4dd0ac?0x0:_0x1f0ce4[_0x3c19('0x1e')];var _0x39e63f=_0x4dd0ac?_0x36d419['count']:_0x1f0ce4[_0x3c19('0x1e')]+_0x1f0ce4[_0x3c19('0x20')];var _0x3e8dab;if(_0x39e63f>=_0x427e92){_0x39e63f=_0x427e92;_0x3e8dab=0xc8;}else{_0x3e8dab=0xce;}_0x47c331[_0x3c19('0x1c')](_0x3e8dab);return _0x47c331[_0x3c19('0x22')](_0x3c19('0x23'),_0xa9b04a+'-'+_0x39e63f+'/'+_0x427e92)[_0x3c19('0x1d')](_0x36d419);}return null;};}function patchUpdates(_0xa81c14){return function(_0x5a93d9){try{jsonpatch[_0x3c19('0x24')](_0x5a93d9,_0xa81c14,!![]);}catch(_0x660855){return BPromise[_0x3c19('0x25')](_0x660855);}return _0x5a93d9['save']();};}function saveUpdates(_0x367185,_0x2e05e4){return function(_0x35c849){if(_0x35c849){return _0x35c849[_0x3c19('0x26')](_0x367185)[_0x3c19('0x27')](function(_0x55e84a){return _0x55e84a;});}return null;};}function removeEntity(_0x21fdb0,_0x292113){return function(_0xfa669b){if(_0xfa669b){return _0xfa669b[_0x3c19('0x28')]()[_0x3c19('0x27')](function(){_0x21fdb0[_0x3c19('0x1c')](0xcc)[_0x3c19('0x1b')]();});}};}function handleEntityNotFound(_0xa23cc5,_0x4b97a3){return function(_0x4913cf){if(!_0x4913cf){_0xa23cc5['sendStatus'](0x194);}return _0x4913cf;};}function handleError(_0x5a4745,_0x38e014){_0x38e014=_0x38e014||0x1f4;return function(_0xe5c4bd){logger[_0x3c19('0x29')](_0xe5c4bd[_0x3c19('0x2a')]);if(_0xe5c4bd[_0x3c19('0x2b')]){delete _0xe5c4bd['name'];}_0x5a4745[_0x3c19('0x1c')](_0x38e014)[_0x3c19('0x2c')](_0xe5c4bd);};}exports[_0x3c19('0x2d')]=function(_0x211d69,_0x3515e8){var _0x269ad2={},_0x31530d={},_0x4b44d7={'count':0x0,'rows':[]};var _0x136e9d=_['map'](db[_0x3c19('0x2e')][_0x3c19('0x2f')],function(_0x3294a8){return{'name':_0x3294a8['fieldName'],'type':_0x3294a8[_0x3c19('0x30')][_0x3c19('0x31')]};});_0x31530d['model']=_['map'](_0x136e9d,_0x3c19('0x2b'));_0x31530d[_0x3c19('0x32')]=_[_0x3c19('0x33')](_0x211d69[_0x3c19('0x32')]);_0x31530d[_0x3c19('0x34')]=_[_0x3c19('0x35')](_0x31530d[_0x3c19('0x36')],_0x31530d[_0x3c19('0x32')]);_0x269ad2[_0x3c19('0x37')]=_[_0x3c19('0x35')](_0x31530d['model'],qs[_0x3c19('0x38')](_0x211d69['query']['fields']));_0x269ad2[_0x3c19('0x37')]=_0x269ad2['attributes'][_0x3c19('0x39')]?_0x269ad2[_0x3c19('0x37')]:_0x31530d['model'];if(!_0x211d69[_0x3c19('0x32')][_0x3c19('0x3a')](_0x3c19('0x3b'))){_0x269ad2[_0x3c19('0x20')]=qs[_0x3c19('0x20')](_0x211d69[_0x3c19('0x32')][_0x3c19('0x20')]);_0x269ad2[_0x3c19('0x1e')]=qs[_0x3c19('0x1e')](_0x211d69[_0x3c19('0x32')][_0x3c19('0x1e')]);}_0x269ad2['order']=qs['sort'](_0x211d69[_0x3c19('0x32')]['sort']);_0x269ad2['where']=qs['filters'](_['pick'](_0x211d69['query'],_0x31530d['filters']),_0x136e9d);if(_0x211d69[_0x3c19('0x32')][_0x3c19('0x3c')]){_0x269ad2[_0x3c19('0x3d')]=_[_0x3c19('0x3e')](_0x269ad2[_0x3c19('0x3d')],{'$or':_[_0x3c19('0x3f')](_0x136e9d,function(_0x2f4d02){if(_0x2f4d02[_0x3c19('0x30')]!==_0x3c19('0x40')){var _0x52c9a8={};_0x52c9a8[_0x2f4d02[_0x3c19('0x2b')]]={'$like':'%'+_0x211d69[_0x3c19('0x32')][_0x3c19('0x3c')]+'%'};return _0x52c9a8;}})});}_0x269ad2=_[_0x3c19('0x3e')]({},_0x269ad2,_0x211d69[_0x3c19('0x41')]);var _0x1725a1={'where':_0x269ad2[_0x3c19('0x3d')]};return db[_0x3c19('0x2e')][_0x3c19('0x21')](_0x1725a1)['then'](function(_0x537dba){_0x4b44d7[_0x3c19('0x21')]=_0x537dba;if(_0x211d69[_0x3c19('0x32')]['includeAll']){_0x269ad2[_0x3c19('0x42')]=[{'all':!![]}];}return db[_0x3c19('0x2e')][_0x3c19('0x43')](_0x269ad2);})[_0x3c19('0x27')](function(_0xaa84b4){_0x4b44d7[_0x3c19('0x44')]=_0xaa84b4;return _0x4b44d7;})[_0x3c19('0x27')](respondWithFilteredResult(_0x3515e8,_0x269ad2))['catch'](handleError(_0x3515e8,null));};exports[_0x3c19('0x45')]=function(_0x3c4a2c,_0x2d57bf){var _0x4a490d={'raw':!![],'where':{'id':_0x3c4a2c[_0x3c19('0x46')]['id']}},_0x332cba={};_0x332cba['model']=_[_0x3c19('0x33')](db[_0x3c19('0x2e')][_0x3c19('0x2f')]);_0x332cba[_0x3c19('0x32')]=_['keys'](_0x3c4a2c[_0x3c19('0x32')]);_0x332cba[_0x3c19('0x34')]=_[_0x3c19('0x35')](_0x332cba['model'],_0x332cba['query']);_0x4a490d[_0x3c19('0x37')]=_[_0x3c19('0x35')](_0x332cba['model'],qs['fields'](_0x3c4a2c['query'][_0x3c19('0x38')]));_0x4a490d[_0x3c19('0x37')]=_0x4a490d[_0x3c19('0x37')][_0x3c19('0x39')]?_0x4a490d['attributes']:_0x332cba['model'];if(_0x3c4a2c[_0x3c19('0x32')]['includeAll']){_0x4a490d[_0x3c19('0x42')]=[{'all':!![]}];}_0x4a490d=_[_0x3c19('0x3e')]({},_0x4a490d,_0x3c4a2c[_0x3c19('0x41')]);return db['SalesforceField']['find'](_0x4a490d)[_0x3c19('0x27')](handleEntityNotFound(_0x2d57bf,null))[_0x3c19('0x27')](respondWithResult(_0x2d57bf,null))[_0x3c19('0x47')](handleError(_0x2d57bf,null));};exports[_0x3c19('0x48')]=function(_0x312add,_0xb1d54f){return db['SalesforceField']['create'](_0x312add[_0x3c19('0x49')],{})['then'](respondWithResult(_0xb1d54f,0xc9))[_0x3c19('0x47')](handleError(_0xb1d54f,null));};exports[_0x3c19('0x26')]=function(_0x43f6df,_0x471e9f){if(_0x43f6df[_0x3c19('0x49')]['id']){delete _0x43f6df['body']['id'];}return db[_0x3c19('0x2e')][_0x3c19('0x4a')]({'where':{'id':_0x43f6df[_0x3c19('0x46')]['id']}})[_0x3c19('0x27')](handleEntityNotFound(_0x471e9f,null))['then'](saveUpdates(_0x43f6df['body'],null))[_0x3c19('0x27')](respondWithResult(_0x471e9f,null))['catch'](handleError(_0x471e9f,null));};exports[_0x3c19('0x28')]=function(_0x26b672,_0x1594a8){return db[_0x3c19('0x2e')][_0x3c19('0x4a')]({'where':{'id':_0x26b672[_0x3c19('0x46')]['id']}})[_0x3c19('0x27')](handleEntityNotFound(_0x1594a8,null))[_0x3c19('0x27')](removeEntity(_0x1594a8,null))[_0x3c19('0x47')](handleError(_0x1594a8,null));}; \ No newline at end of file +var _0xa805=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','end','stack','name','index','SalesforceField','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','includeAll','include','rows','catch','show','keys','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis'];(function(_0x5150c1,_0x575437){var _0x1fa217=function(_0x316361){while(--_0x316361){_0x5150c1['push'](_0x5150c1['shift']());}};_0x1fa217(++_0x575437);}(_0xa805,0x167));var _0x5a80=function(_0x347a31,_0x2bf054){_0x347a31=_0x347a31-0x0;var _0x4c36ff=_0xa805[_0x347a31];return _0x4c36ff;};'use strict';var emlformat=require(_0x5a80('0x0'));var rimraf=require(_0x5a80('0x1'));var zipdir=require(_0x5a80('0x2'));var jsonpatch=require(_0x5a80('0x3'));var rp=require(_0x5a80('0x4'));var moment=require(_0x5a80('0x5'));var BPromise=require(_0x5a80('0x6'));var Mustache=require(_0x5a80('0x7'));var util=require(_0x5a80('0x8'));var path=require(_0x5a80('0x9'));var sox=require(_0x5a80('0xa'));var csv=require('to-csv');var ejs=require(_0x5a80('0xb'));var fs=require('fs');var fs_extra=require(_0x5a80('0xc'));var _=require(_0x5a80('0xd'));var squel=require(_0x5a80('0xe'));var crypto=require(_0x5a80('0xf'));var jsforce=require(_0x5a80('0x10'));var deskjs=require(_0x5a80('0x11'));var toCsv=require(_0x5a80('0x12'));var querystring=require(_0x5a80('0x13'));var Papa=require('papaparse');var Redis=require(_0x5a80('0x14'));var authService=require(_0x5a80('0x15'));var qs=require(_0x5a80('0x16'));var as=require(_0x5a80('0x17'));var hardwareService=require(_0x5a80('0x18'));var logger=require(_0x5a80('0x19'))(_0x5a80('0x1a'));var utils=require(_0x5a80('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0x5a80('0x1c'));var db=require(_0x5a80('0x1d'))['db'];function respondWithStatusCode(_0x5de3e5,_0x51f3c2){_0x51f3c2=_0x51f3c2||0xcc;return function(_0x8baede){if(_0x8baede){return _0x5de3e5['sendStatus'](_0x51f3c2);}return _0x5de3e5[_0x5a80('0x1e')](_0x51f3c2)['end']();};}function respondWithResult(_0x3ddaae,_0x280173){_0x280173=_0x280173||0xc8;return function(_0x3b9444){if(_0x3b9444){return _0x3ddaae[_0x5a80('0x1e')](_0x280173)['json'](_0x3b9444);}};}function respondWithFilteredResult(_0xaf8765,_0x19f1d1){return function(_0x3e947b){if(_0x3e947b){var _0x4559e8=typeof _0x19f1d1['offset']===_0x5a80('0x1f')&&typeof _0x19f1d1[_0x5a80('0x20')]===_0x5a80('0x1f');var _0x2ac8f1=_0x3e947b[_0x5a80('0x21')];var _0x4c61db=_0x4559e8?0x0:_0x19f1d1[_0x5a80('0x22')];var _0xc8979f=_0x4559e8?_0x3e947b[_0x5a80('0x21')]:_0x19f1d1['offset']+_0x19f1d1[_0x5a80('0x20')];var _0x286ed5;if(_0xc8979f>=_0x2ac8f1){_0xc8979f=_0x2ac8f1;_0x286ed5=0xc8;}else{_0x286ed5=0xce;}_0xaf8765[_0x5a80('0x1e')](_0x286ed5);return _0xaf8765[_0x5a80('0x23')](_0x5a80('0x24'),_0x4c61db+'-'+_0xc8979f+'/'+_0x2ac8f1)['json'](_0x3e947b);}return null;};}function patchUpdates(_0x5cd030){return function(_0x2731b7){try{jsonpatch[_0x5a80('0x25')](_0x2731b7,_0x5cd030,!![]);}catch(_0x543d9b){return BPromise[_0x5a80('0x26')](_0x543d9b);}return _0x2731b7['save']();};}function saveUpdates(_0x372780,_0x1c8e22){return function(_0xb4d9d7){if(_0xb4d9d7){return _0xb4d9d7[_0x5a80('0x27')](_0x372780)[_0x5a80('0x28')](function(_0xd21555){return _0xd21555;});}return null;};}function removeEntity(_0x43f805,_0x3df989){return function(_0x170292){if(_0x170292){return _0x170292[_0x5a80('0x29')]()[_0x5a80('0x28')](function(){_0x43f805[_0x5a80('0x1e')](0xcc)[_0x5a80('0x2a')]();});}};}function handleEntityNotFound(_0x305da4,_0x5a0c60){return function(_0xd4c611){if(!_0xd4c611){_0x305da4['sendStatus'](0x194);}return _0xd4c611;};}function handleError(_0x41b6de,_0xdd72e6){_0xdd72e6=_0xdd72e6||0x1f4;return function(_0x1837ad){logger['error'](_0x1837ad[_0x5a80('0x2b')]);if(_0x1837ad['name']){delete _0x1837ad[_0x5a80('0x2c')];}_0x41b6de[_0x5a80('0x1e')](_0xdd72e6)['send'](_0x1837ad);};}exports[_0x5a80('0x2d')]=function(_0x478349,_0x3e4ec3){var _0x3628e7={},_0x2f9511={},_0x5ca91c={'count':0x0,'rows':[]};var _0x4cc7c4=_['map'](db[_0x5a80('0x2e')][_0x5a80('0x2f')],function(_0x4c76f3){return{'name':_0x4c76f3[_0x5a80('0x30')],'type':_0x4c76f3[_0x5a80('0x31')]['key']};});_0x2f9511[_0x5a80('0x32')]=_[_0x5a80('0x33')](_0x4cc7c4,'name');_0x2f9511[_0x5a80('0x34')]=_['keys'](_0x478349[_0x5a80('0x34')]);_0x2f9511[_0x5a80('0x35')]=_[_0x5a80('0x36')](_0x2f9511['model'],_0x2f9511[_0x5a80('0x34')]);_0x3628e7[_0x5a80('0x37')]=_[_0x5a80('0x36')](_0x2f9511['model'],qs[_0x5a80('0x38')](_0x478349['query'][_0x5a80('0x38')]));_0x3628e7[_0x5a80('0x37')]=_0x3628e7[_0x5a80('0x37')][_0x5a80('0x39')]?_0x3628e7[_0x5a80('0x37')]:_0x2f9511[_0x5a80('0x32')];if(!_0x478349[_0x5a80('0x34')][_0x5a80('0x3a')](_0x5a80('0x3b'))){_0x3628e7[_0x5a80('0x20')]=qs[_0x5a80('0x20')](_0x478349[_0x5a80('0x34')][_0x5a80('0x20')]);_0x3628e7['offset']=qs['offset'](_0x478349[_0x5a80('0x34')][_0x5a80('0x22')]);}_0x3628e7['order']=qs[_0x5a80('0x3c')](_0x478349['query'][_0x5a80('0x3c')]);_0x3628e7[_0x5a80('0x3d')]=qs[_0x5a80('0x35')](_['pick'](_0x478349[_0x5a80('0x34')],_0x2f9511[_0x5a80('0x35')]),_0x4cc7c4);if(_0x478349[_0x5a80('0x34')][_0x5a80('0x3e')]){_0x3628e7[_0x5a80('0x3d')]=_['merge'](_0x3628e7[_0x5a80('0x3d')],{'$or':_[_0x5a80('0x33')](_0x4cc7c4,function(_0x1c95c8){if(_0x1c95c8[_0x5a80('0x31')]!==_0x5a80('0x3f')){var _0x523c50={};_0x523c50[_0x1c95c8[_0x5a80('0x2c')]]={'$like':'%'+_0x478349[_0x5a80('0x34')][_0x5a80('0x3e')]+'%'};return _0x523c50;}})});}_0x3628e7=_[_0x5a80('0x40')]({},_0x3628e7,_0x478349['options']);var _0x1ab31c={'where':_0x3628e7[_0x5a80('0x3d')]};return db['SalesforceField'][_0x5a80('0x21')](_0x1ab31c)[_0x5a80('0x28')](function(_0x4ff2c1){_0x5ca91c[_0x5a80('0x21')]=_0x4ff2c1;if(_0x478349[_0x5a80('0x34')][_0x5a80('0x41')]){_0x3628e7[_0x5a80('0x42')]=[{'all':!![]}];}return db['SalesforceField']['findAll'](_0x3628e7);})[_0x5a80('0x28')](function(_0x5d2f4a){_0x5ca91c[_0x5a80('0x43')]=_0x5d2f4a;return _0x5ca91c;})['then'](respondWithFilteredResult(_0x3e4ec3,_0x3628e7))[_0x5a80('0x44')](handleError(_0x3e4ec3,null));};exports[_0x5a80('0x45')]=function(_0x1108aa,_0x370ffa){var _0x5595d0={'raw':!![],'where':{'id':_0x1108aa['params']['id']}},_0x1a31e4={};_0x1a31e4[_0x5a80('0x32')]=_['keys'](db[_0x5a80('0x2e')][_0x5a80('0x2f')]);_0x1a31e4[_0x5a80('0x34')]=_[_0x5a80('0x46')](_0x1108aa[_0x5a80('0x34')]);_0x1a31e4[_0x5a80('0x35')]=_[_0x5a80('0x36')](_0x1a31e4[_0x5a80('0x32')],_0x1a31e4[_0x5a80('0x34')]);_0x5595d0['attributes']=_[_0x5a80('0x36')](_0x1a31e4['model'],qs[_0x5a80('0x38')](_0x1108aa[_0x5a80('0x34')][_0x5a80('0x38')]));_0x5595d0['attributes']=_0x5595d0['attributes'][_0x5a80('0x39')]?_0x5595d0[_0x5a80('0x37')]:_0x1a31e4[_0x5a80('0x32')];if(_0x1108aa[_0x5a80('0x34')]['includeAll']){_0x5595d0[_0x5a80('0x42')]=[{'all':!![]}];}_0x5595d0=_[_0x5a80('0x40')]({},_0x5595d0,_0x1108aa[_0x5a80('0x47')]);return db['SalesforceField'][_0x5a80('0x48')](_0x5595d0)['then'](handleEntityNotFound(_0x370ffa,null))[_0x5a80('0x28')](respondWithResult(_0x370ffa,null))[_0x5a80('0x44')](handleError(_0x370ffa,null));};exports[_0x5a80('0x49')]=function(_0x580950,_0x1df452){return db['SalesforceField']['create'](_0x580950[_0x5a80('0x4a')],{})[_0x5a80('0x28')](respondWithResult(_0x1df452,0xc9))[_0x5a80('0x44')](handleError(_0x1df452,null));};exports[_0x5a80('0x27')]=function(_0x4b11e4,_0x324ccb){if(_0x4b11e4[_0x5a80('0x4a')]['id']){delete _0x4b11e4[_0x5a80('0x4a')]['id'];}return db[_0x5a80('0x2e')][_0x5a80('0x48')]({'where':{'id':_0x4b11e4[_0x5a80('0x4b')]['id']}})[_0x5a80('0x28')](handleEntityNotFound(_0x324ccb,null))[_0x5a80('0x28')](saveUpdates(_0x4b11e4[_0x5a80('0x4a')],null))[_0x5a80('0x28')](respondWithResult(_0x324ccb,null))[_0x5a80('0x44')](handleError(_0x324ccb,null));};exports[_0x5a80('0x29')]=function(_0x4c2c9c,_0x157b63){return db['SalesforceField'][_0x5a80('0x48')]({'where':{'id':_0x4c2c9c['params']['id']}})['then'](handleEntityNotFound(_0x157b63,null))['then'](removeEntity(_0x157b63,null))['catch'](handleError(_0x157b63,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 2ff947f..6c287ff 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 _0xfb66=['define','SalesforceField','salesforce_unique_index','idField','FieldId','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports'];(function(_0x404458,_0x320912){var _0x5313c9=function(_0x495af9){while(--_0x495af9){_0x404458['push'](_0x404458['shift']());}};_0x5313c9(++_0x320912);}(_0xfb66,0x7d));var _0x6fb6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xfb66[_0x432682];return _0x463d05;};'use strict';var _=require(_0x6fb6('0x0'));var util=require(_0x6fb6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6fb6('0x2'));var BPromise=require(_0x6fb6('0x3'));var rp=require(_0x6fb6('0x4'));var fs=require('fs');var path=require(_0x6fb6('0x5'));var rimraf=require(_0x6fb6('0x6'));var config=require(_0x6fb6('0x7'));var attributes=require(_0x6fb6('0x8'));module[_0x6fb6('0x9')]=function(_0x6af67b,_0x121e2d){return _0x6af67b[_0x6fb6('0xa')](_0x6fb6('0xb'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x6fb6('0xc'),'fields':[_0x6fb6('0xd'),_0x6fb6('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaee4=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intSalesforceField.attributes','exports','define','salesforce_unique_index','idField','FieldId','lodash'];(function(_0x3e7578,_0x2b75ed){var _0x25cd57=function(_0x1e0687){while(--_0x1e0687){_0x3e7578['push'](_0x3e7578['shift']());}};_0x25cd57(++_0x2b75ed);}(_0xaee4,0x19f));var _0x4aee=function(_0x59b1b0,_0x40fbfd){_0x59b1b0=_0x59b1b0-0x0;var _0x52af76=_0xaee4[_0x59b1b0];return _0x52af76;};'use strict';var _=require(_0x4aee('0x0'));var util=require('util');var logger=require(_0x4aee('0x1'))(_0x4aee('0x2'));var moment=require('moment');var BPromise=require(_0x4aee('0x3'));var rp=require(_0x4aee('0x4'));var fs=require('fs');var path=require(_0x4aee('0x5'));var rimraf=require('rimraf');var config=require(_0x4aee('0x6'));var attributes=require(_0x4aee('0x7'));module[_0x4aee('0x8')]=function(_0x563980,_0x3f5e6a){return _0x563980[_0x4aee('0x9')]('SalesforceField',attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x4aee('0xa'),'fields':[_0x4aee('0xb'),_0x4aee('0xc')],'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 cb95a22..24b21bf 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 _0xeaae=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','util','moment','bluebird','ioredis'];(function(_0x285cd3,_0xb5dc59){var _0x21cc67=function(_0x51c5a7){while(--_0x51c5a7){_0x285cd3['push'](_0x285cd3['shift']());}};_0x21cc67(++_0xb5dc59);}(_0xeaae,0x1ca));var _0xeeaa=function(_0x955d9d,_0x49006c){_0x955d9d=_0x955d9d-0x0;var _0x3053a4=_0xeaae[_0x955d9d];return _0x3053a4;};'use strict';var _=require('lodash');var util=require(_0xeeaa('0x0'));var moment=require(_0xeeaa('0x1'));var BPromise=require(_0xeeaa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeeaa('0x3'));var db=require(_0xeeaa('0x4'))['db'];var utils=require(_0xeeaa('0x5'));var logger=require('../../config/logger')(_0xeeaa('0x6'));var config=require(_0xeeaa('0x7'));var jayson=require(_0xeeaa('0x8'));var client=jayson[_0xeeaa('0x9')][_0xeeaa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3141ed,_0x57f9fa,_0x30e3e2){return new BPromise(function(_0x1e48b7,_0x18941e){return client[_0xeeaa('0xb')](_0x3141ed,_0x30e3e2)[_0xeeaa('0xc')](function(_0x3a2e0a){logger[_0xeeaa('0xd')](_0xeeaa('0xe'),_0x57f9fa,_0xeeaa('0xf'));logger[_0xeeaa('0x10')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x57f9fa,_0xeeaa('0xf'),JSON[_0xeeaa('0x11')](_0x3a2e0a));if(_0x3a2e0a[_0xeeaa('0x12')]){if(_0x3a2e0a[_0xeeaa('0x12')][_0xeeaa('0x13')]===0x1f4){logger['error'](_0xeeaa('0xe'),_0x57f9fa,_0x3a2e0a[_0xeeaa('0x12')][_0xeeaa('0x14')]);return _0x18941e(_0x3a2e0a[_0xeeaa('0x12')][_0xeeaa('0x14')]);}logger[_0xeeaa('0x12')]('SalesforceField,\x20%s,\x20%s',_0x57f9fa,_0x3a2e0a[_0xeeaa('0x12')][_0xeeaa('0x14')]);return _0x1e48b7(_0x3a2e0a[_0xeeaa('0x12')][_0xeeaa('0x14')]);}else{logger[_0xeeaa('0xd')](_0xeeaa('0xe'),_0x57f9fa,_0xeeaa('0xf'));_0x1e48b7(_0x3a2e0a['result'][_0xeeaa('0x14')]);}})['catch'](function(_0x28a094){logger[_0xeeaa('0x12')]('SalesforceField,\x20%s,\x20%s',_0x57f9fa,_0x28a094);_0x18941e(_0x28a094);});});} \ No newline at end of file +var _0xdd51=['jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','code','message','error','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x2eb05c,_0x2b8da1){var _0x51fb8e=function(_0x3b242b){while(--_0x3b242b){_0x2eb05c['push'](_0x2eb05c['shift']());}};_0x51fb8e(++_0x2b8da1);}(_0xdd51,0x12b));var _0x1dd5=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xdd51[_0x33032e];return _0x13316b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1dd5('0x0'));var BPromise=require(_0x1dd5('0x1'));var rs=require(_0x1dd5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1dd5('0x3'))['db'];var utils=require(_0x1dd5('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x1dd5('0x5'));var client=jayson[_0x1dd5('0x6')][_0x1dd5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x50bc84,_0x14eaf7,_0x53ce6e){return new BPromise(function(_0x590cfe,_0x5584a5){return client[_0x1dd5('0x8')](_0x50bc84,_0x53ce6e)[_0x1dd5('0x9')](function(_0x4743ab){logger[_0x1dd5('0xa')](_0x1dd5('0xb'),_0x14eaf7,_0x1dd5('0xc'));logger[_0x1dd5('0xd')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x14eaf7,_0x1dd5('0xc'),JSON[_0x1dd5('0xe')](_0x4743ab));if(_0x4743ab['error']){if(_0x4743ab['error'][_0x1dd5('0xf')]===0x1f4){logger['error'](_0x1dd5('0xb'),_0x14eaf7,_0x4743ab['error'][_0x1dd5('0x10')]);return _0x5584a5(_0x4743ab['error'][_0x1dd5('0x10')]);}logger[_0x1dd5('0x11')](_0x1dd5('0xb'),_0x14eaf7,_0x4743ab['error'][_0x1dd5('0x10')]);return _0x590cfe(_0x4743ab[_0x1dd5('0x11')]['message']);}else{logger[_0x1dd5('0xa')](_0x1dd5('0xb'),_0x14eaf7,_0x1dd5('0xc'));_0x590cfe(_0x4743ab['result'][_0x1dd5('0x10')]);}})[_0x1dd5('0x12')](function(_0x4dcacc){logger[_0x1dd5('0x11')](_0x1dd5('0xb'),_0x14eaf7,_0x4dcacc);_0x5584a5(_0x4dcacc);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index ff1261a..ddda2df 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 _0x5dad=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','delete','destroy','multer','util','path','express'];(function(_0x4124b3,_0x3bab0e){var _0xc7f28d=function(_0x269efc){while(--_0x269efc){_0x4124b3['push'](_0x4124b3['shift']());}};_0xc7f28d(++_0x3bab0e);}(_0x5dad,0x128));var _0xd5da=function(_0x3b4cee,_0x379c6f){_0x3b4cee=_0x3b4cee-0x0;var _0x10e111=_0x5dad[_0x3b4cee];return _0x10e111;};'use strict';var multer=require(_0xd5da('0x0'));var util=require(_0xd5da('0x1'));var path=require(_0xd5da('0x2'));var timeout=require('connect-timeout');var express=require(_0xd5da('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd5da('0x4'));var interaction=require(_0xd5da('0x5'));var config=require('../../config/environment');var controller=require('./intServicenowAccount.controller');router[_0xd5da('0x6')]('/',auth[_0xd5da('0x7')](),controller[_0xd5da('0x8')]);router[_0xd5da('0x6')](_0xd5da('0x9'),auth[_0xd5da('0x7')](),controller[_0xd5da('0xa')]);router['get'](_0xd5da('0xb'),auth['isAuthenticated'](),controller[_0xd5da('0xc')]);router[_0xd5da('0x6')](_0xd5da('0xd'),auth[_0xd5da('0x7')](),controller['getFields']);router[_0xd5da('0xe')]('/',auth[_0xd5da('0x7')](),controller[_0xd5da('0xf')]);router['post'](_0xd5da('0xb'),auth[_0xd5da('0x7')](),controller[_0xd5da('0x10')]);router[_0xd5da('0x11')](_0xd5da('0x9'),auth[_0xd5da('0x7')](),controller['update']);router[_0xd5da('0x12')]('/:id',auth[_0xd5da('0x7')](),controller[_0xd5da('0x13')]);module['exports']=router; \ No newline at end of file +var _0x41c8=['./intServicenowAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','getFields','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x32270a,_0x10429b){var _0x1c41b8=function(_0x30c4e4){while(--_0x30c4e4){_0x32270a['push'](_0x32270a['shift']());}};_0x1c41b8(++_0x10429b);}(_0x41c8,0x98));var _0x841c=function(_0x2a9a04,_0x4ccd38){_0x2a9a04=_0x2a9a04-0x0;var _0x45337d=_0x41c8[_0x2a9a04];return _0x45337d;};'use strict';var multer=require(_0x841c('0x0'));var util=require(_0x841c('0x1'));var path=require('path');var timeout=require(_0x841c('0x2'));var express=require(_0x841c('0x3'));var router=express[_0x841c('0x4')]();var fs_extra=require(_0x841c('0x5'));var auth=require(_0x841c('0x6'));var interaction=require(_0x841c('0x7'));var config=require(_0x841c('0x8'));var controller=require(_0x841c('0x9'));router[_0x841c('0xa')]('/',auth[_0x841c('0xb')](),controller[_0x841c('0xc')]);router[_0x841c('0xa')](_0x841c('0xd'),auth[_0x841c('0xb')](),controller['show']);router[_0x841c('0xa')](_0x841c('0xe'),auth[_0x841c('0xb')](),controller[_0x841c('0xf')]);router[_0x841c('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0x841c('0x10')]);router[_0x841c('0x11')]('/',auth['isAuthenticated'](),controller[_0x841c('0x12')]);router[_0x841c('0x11')](_0x841c('0xe'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0x841c('0xd'),auth[_0x841c('0xb')](),controller[_0x841c('0x13')]);router[_0x841c('0x14')]('/:id',auth[_0x841c('0xb')](),controller[_0x841c('0x15')]);module[_0x841c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 7b9db10..43f1dc5 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 _0x05a3=['username','remoteUri','sequelize','exports','STRING'];(function(_0xa315f3,_0x426318){var _0x5a5c2f=function(_0x17bac9){while(--_0x17bac9){_0xa315f3['push'](_0xa315f3['shift']());}};_0x5a5c2f(++_0x426318);}(_0x05a3,0xc5));var _0x305a=function(_0x158485,_0x1fd476){_0x158485=_0x158485-0x0;var _0x3ec2ef=_0x05a3[_0x158485];return _0x3ec2ef;};'use strict';var Sequelize=require(_0x305a('0x0'));module[_0x305a('0x1')]={'name':{'type':Sequelize[_0x305a('0x2')]},'description':{'type':Sequelize[_0x305a('0x2')]},'username':{'type':Sequelize[_0x305a('0x2')],'unique':_0x305a('0x3')},'password':{'type':Sequelize[_0x305a('0x2')]},'email':{'type':Sequelize[_0x305a('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x305a('0x4')},'serverUrl':{'type':Sequelize[_0x305a('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x849e=['username','remoteUri','exports','STRING'];(function(_0x37bde2,_0x2939b0){var _0x1f3b00=function(_0x39759e){while(--_0x39759e){_0x37bde2['push'](_0x37bde2['shift']());}};_0x1f3b00(++_0x2939b0);}(_0x849e,0x66));var _0xe849=function(_0x5a9d15,_0x23d58f){_0x5a9d15=_0x5a9d15-0x0;var _0x15cb4d=_0x849e[_0x5a9d15];return _0x15cb4d;};'use strict';var Sequelize=require('sequelize');module[_0xe849('0x0')]={'name':{'type':Sequelize[_0xe849('0x1')]},'description':{'type':Sequelize[_0xe849('0x1')]},'username':{'type':Sequelize[_0xe849('0x1')],'unique':_0xe849('0x2')},'password':{'type':Sequelize[_0xe849('0x1')]},'email':{'type':Sequelize[_0xe849('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xe849('0x3')},'serverUrl':{'type':Sequelize[_0xe849('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 55772dc..c7074e8 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 _0x7c4d=['fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','getConfigurations','findOne','ServicenowConfiguration','order','length','addConfiguration','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','ServicenowField','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','closed_at','cmdb_ci','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','company','reassignment_count','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','reopen_count','sys_tags','escalation','correlation_id','location','category','username','password','email','remoteUri','slice','substring','format','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','remove','internalType','label','push','all','log','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','forEach','inactive','value','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ServicenowAccount','rawAttributes'];(function(_0x58f710,_0x347046){var _0x1aaa57=function(_0x16e6ca){while(--_0x16e6ca){_0x58f710['push'](_0x58f710['shift']());}};_0x1aaa57(++_0x347046);}(_0x7c4d,0x90));var _0xd7c4=function(_0x431be3,_0x2baa88){_0x431be3=_0x431be3-0x0;var _0x4ea2a9=_0x7c4d[_0x431be3];return _0x4ea2a9;};'use strict';var emlformat=require(_0xd7c4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd7c4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd7c4('0x2'));var BPromise=require(_0xd7c4('0x3'));var Mustache=require(_0xd7c4('0x4'));var util=require(_0xd7c4('0x5'));var path=require(_0xd7c4('0x6'));var sox=require(_0xd7c4('0x7'));var csv=require(_0xd7c4('0x8'));var ejs=require(_0xd7c4('0x9'));var fs=require('fs');var fs_extra=require(_0xd7c4('0xa'));var _=require(_0xd7c4('0xb'));var squel=require(_0xd7c4('0xc'));var crypto=require(_0xd7c4('0xd'));var jsforce=require(_0xd7c4('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd7c4('0xf'));var Papa=require(_0xd7c4('0x10'));var Redis=require(_0xd7c4('0x11'));var authService=require(_0xd7c4('0x12'));var qs=require(_0xd7c4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd7c4('0x14'))(_0xd7c4('0x15'));var utils=require(_0xd7c4('0x16'));var config=require(_0xd7c4('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd7c4('0x18'))['db'];var integrations=require(_0xd7c4('0x19'));function respondWithStatusCode(_0x649b70,_0x2fce0a){_0x2fce0a=_0x2fce0a||0xcc;return function(_0x5313ce){if(_0x5313ce){return _0x649b70['sendStatus'](_0x2fce0a);}return _0x649b70[_0xd7c4('0x1a')](_0x2fce0a)[_0xd7c4('0x1b')]();};}function respondWithResult(_0x19d066,_0x43bd0c){_0x43bd0c=_0x43bd0c||0xc8;return function(_0x53ed47){if(_0x53ed47){return _0x19d066[_0xd7c4('0x1a')](_0x43bd0c)['json'](_0x53ed47);}};}function respondWithFilteredResult(_0x53c306,_0x3d6839){return function(_0x24fa33){if(_0x24fa33){var _0x2550ab=typeof _0x3d6839[_0xd7c4('0x1c')]===_0xd7c4('0x1d')&&typeof _0x3d6839[_0xd7c4('0x1e')]===_0xd7c4('0x1d');var _0x1e80d7=_0x24fa33[_0xd7c4('0x1f')];var _0x4d5582=_0x2550ab?0x0:_0x3d6839[_0xd7c4('0x1c')];var _0xcc2d6c=_0x2550ab?_0x24fa33[_0xd7c4('0x1f')]:_0x3d6839[_0xd7c4('0x1c')]+_0x3d6839[_0xd7c4('0x1e')];var _0x534d64;if(_0xcc2d6c>=_0x1e80d7){_0xcc2d6c=_0x1e80d7;_0x534d64=0xc8;}else{_0x534d64=0xce;}_0x53c306[_0xd7c4('0x1a')](_0x534d64);return _0x53c306[_0xd7c4('0x20')](_0xd7c4('0x21'),_0x4d5582+'-'+_0xcc2d6c+'/'+_0x1e80d7)[_0xd7c4('0x22')](_0x24fa33);}return null;};}function patchUpdates(_0x46b428){return function(_0x29c147){try{jsonpatch[_0xd7c4('0x23')](_0x29c147,_0x46b428,!![]);}catch(_0x2c25ad){return BPromise[_0xd7c4('0x24')](_0x2c25ad);}return _0x29c147[_0xd7c4('0x25')]();};}function saveUpdates(_0x5b7963,_0x47984d){return function(_0x45f554){if(_0x45f554){return _0x45f554[_0xd7c4('0x26')](_0x5b7963)[_0xd7c4('0x27')](function(_0x38dadb){return _0x38dadb;});}return null;};}function removeEntity(_0x1bb315,_0x42781a){return function(_0x1c4180){if(_0x1c4180){return _0x1c4180[_0xd7c4('0x28')]()['then'](function(){_0x1bb315[_0xd7c4('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44f993,_0x30fafd){return function(_0x114f27){if(!_0x114f27){_0x44f993[_0xd7c4('0x29')](0x194);}return _0x114f27;};}function handleError(_0x5b128c,_0x131af8){_0x131af8=_0x131af8||0x1f4;return function(_0x2be09b){logger[_0xd7c4('0x2a')](_0x2be09b[_0xd7c4('0x2b')]);if(_0x2be09b[_0xd7c4('0x2c')]){delete _0x2be09b['name'];}_0x5b128c[_0xd7c4('0x1a')](_0x131af8)[_0xd7c4('0x2d')](_0x2be09b);};}exports[_0xd7c4('0x2e')]=function(_0x1c58ac,_0xee6f56){var _0x24d2ba={},_0x38864c={},_0x2bdbe9={'count':0x0,'rows':[]};var _0x9cd552=_[_0xd7c4('0x2f')](db[_0xd7c4('0x30')][_0xd7c4('0x31')],function(_0x522701){return{'name':_0x522701[_0xd7c4('0x32')],'type':_0x522701['type'][_0xd7c4('0x33')]};});_0x38864c['model']=_[_0xd7c4('0x2f')](_0x9cd552,_0xd7c4('0x2c'));_0x38864c[_0xd7c4('0x34')]=_[_0xd7c4('0x35')](_0x1c58ac[_0xd7c4('0x34')]);_0x38864c[_0xd7c4('0x36')]=_[_0xd7c4('0x37')](_0x38864c[_0xd7c4('0x38')],_0x38864c[_0xd7c4('0x34')]);_0x24d2ba[_0xd7c4('0x39')]=_[_0xd7c4('0x37')](_0x38864c['model'],qs[_0xd7c4('0x3a')](_0x1c58ac[_0xd7c4('0x34')][_0xd7c4('0x3a')]));_0x24d2ba[_0xd7c4('0x39')]=_0x24d2ba[_0xd7c4('0x39')]['length']?_0x24d2ba['attributes']:_0x38864c[_0xd7c4('0x38')];if(!_0x1c58ac[_0xd7c4('0x34')][_0xd7c4('0x3b')](_0xd7c4('0x3c'))){_0x24d2ba[_0xd7c4('0x1e')]=qs[_0xd7c4('0x1e')](_0x1c58ac[_0xd7c4('0x34')]['limit']);_0x24d2ba[_0xd7c4('0x1c')]=qs[_0xd7c4('0x1c')](_0x1c58ac[_0xd7c4('0x34')][_0xd7c4('0x1c')]);}_0x24d2ba['order']=qs[_0xd7c4('0x3d')](_0x1c58ac[_0xd7c4('0x34')][_0xd7c4('0x3d')]);_0x24d2ba[_0xd7c4('0x3e')]=qs[_0xd7c4('0x36')](_[_0xd7c4('0x3f')](_0x1c58ac['query'],_0x38864c['filters']),_0x9cd552);if(_0x1c58ac[_0xd7c4('0x34')][_0xd7c4('0x40')]){_0x24d2ba[_0xd7c4('0x3e')]=_[_0xd7c4('0x41')](_0x24d2ba['where'],{'$or':_[_0xd7c4('0x2f')](_0x9cd552,function(_0x457465){if(_0x457465['type']!==_0xd7c4('0x42')){var _0x5b085b={};_0x5b085b[_0x457465[_0xd7c4('0x2c')]]={'$like':'%'+_0x1c58ac[_0xd7c4('0x34')][_0xd7c4('0x40')]+'%'};return _0x5b085b;}})});}_0x24d2ba=_['merge']({},_0x24d2ba,_0x1c58ac[_0xd7c4('0x43')]);var _0x52edbe={'where':_0x24d2ba[_0xd7c4('0x3e')]};return db[_0xd7c4('0x30')][_0xd7c4('0x1f')](_0x52edbe)['then'](function(_0x538ad5){_0x2bdbe9['count']=_0x538ad5;if(_0x1c58ac[_0xd7c4('0x34')][_0xd7c4('0x44')]){_0x24d2ba[_0xd7c4('0x45')]=[{'all':!![]}];}return db[_0xd7c4('0x30')][_0xd7c4('0x46')](_0x24d2ba);})['then'](function(_0x2da055){_0x2bdbe9[_0xd7c4('0x47')]=_0x2da055;return _0x2bdbe9;})[_0xd7c4('0x27')](respondWithFilteredResult(_0xee6f56,_0x24d2ba))[_0xd7c4('0x48')](handleError(_0xee6f56,null));};exports[_0xd7c4('0x49')]=function(_0x33bcf9,_0xd9a9c1){var _0x4652fa={'raw':![],'where':{'id':_0x33bcf9['params']['id']}},_0xffe21e={};_0xffe21e[_0xd7c4('0x38')]=_[_0xd7c4('0x35')](db['ServicenowAccount'][_0xd7c4('0x31')]);_0xffe21e[_0xd7c4('0x34')]=_[_0xd7c4('0x35')](_0x33bcf9[_0xd7c4('0x34')]);_0xffe21e['filters']=_['intersection'](_0xffe21e[_0xd7c4('0x38')],_0xffe21e['query']);_0x4652fa[_0xd7c4('0x39')]=_[_0xd7c4('0x37')](_0xffe21e[_0xd7c4('0x38')],qs[_0xd7c4('0x3a')](_0x33bcf9[_0xd7c4('0x34')]['fields']));_0x4652fa[_0xd7c4('0x39')]=_0x4652fa[_0xd7c4('0x39')]['length']?_0x4652fa[_0xd7c4('0x39')]:_0xffe21e['model'];if(_0x33bcf9[_0xd7c4('0x34')][_0xd7c4('0x44')]){_0x4652fa[_0xd7c4('0x45')]=[{'all':!![]}];}_0x4652fa=_[_0xd7c4('0x41')]({},_0x4652fa,_0x33bcf9[_0xd7c4('0x43')]);return db[_0xd7c4('0x30')][_0xd7c4('0x4a')](_0x4652fa)[_0xd7c4('0x27')](handleEntityNotFound(_0xd9a9c1,null))[_0xd7c4('0x27')](respondWithResult(_0xd9a9c1,null))['catch'](handleError(_0xd9a9c1,null));};exports[_0xd7c4('0x4b')]=function(_0x264079,_0x499cb4){return db[_0xd7c4('0x30')][_0xd7c4('0x4b')](_0x264079[_0xd7c4('0x4c')],{})[_0xd7c4('0x27')](respondWithResult(_0x499cb4,0xc9))['catch'](handleError(_0x499cb4,null));};exports[_0xd7c4('0x26')]=function(_0x22c3b7,_0x2d3cff){if(_0x22c3b7[_0xd7c4('0x4c')]['id']){delete _0x22c3b7[_0xd7c4('0x4c')]['id'];}return db['ServicenowAccount'][_0xd7c4('0x4a')]({'where':{'id':_0x22c3b7[_0xd7c4('0x4d')]['id']}})[_0xd7c4('0x27')](handleEntityNotFound(_0x2d3cff,null))['then'](saveUpdates(_0x22c3b7[_0xd7c4('0x4c')],null))[_0xd7c4('0x27')](respondWithResult(_0x2d3cff,null))['catch'](handleError(_0x2d3cff,null));};exports[_0xd7c4('0x28')]=function(_0x140595,_0x4a9bfb){return db[_0xd7c4('0x30')][_0xd7c4('0x4a')]({'where':{'id':_0x140595[_0xd7c4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4a9bfb,null))[_0xd7c4('0x27')](removeEntity(_0x4a9bfb,null))['catch'](handleError(_0x4a9bfb,null));};exports[_0xd7c4('0x4e')]=function(_0x1cb722,_0x1494e5,_0x1e3f8b){var _0x145efa={};var _0x342051={};var _0x438095;var _0x76d7ac;return db[_0xd7c4('0x30')][_0xd7c4('0x4f')]({'where':{'id':_0x1cb722[_0xd7c4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1494e5,null))[_0xd7c4('0x27')](function(_0x3e1346){if(_0x3e1346){_0x438095=_0x3e1346;_0x342051[_0xd7c4('0x38')]=_['keys'](db[_0xd7c4('0x50')]['rawAttributes']);_0x342051[_0xd7c4('0x34')]=_[_0xd7c4('0x35')](_0x1cb722[_0xd7c4('0x34')]);_0x342051[_0xd7c4('0x36')]=_[_0xd7c4('0x37')](_0x342051[_0xd7c4('0x38')],_0x342051['query']);_0x145efa[_0xd7c4('0x39')]=_[_0xd7c4('0x37')](_0x342051[_0xd7c4('0x38')],qs['fields'](_0x1cb722['query'][_0xd7c4('0x3a')]));_0x145efa['attributes']=_0x145efa['attributes']['length']?_0x145efa[_0xd7c4('0x39')]:_0x342051['model'];_0x145efa[_0xd7c4('0x51')]=qs[_0xd7c4('0x3d')](_0x1cb722[_0xd7c4('0x34')][_0xd7c4('0x3d')]);_0x145efa[_0xd7c4('0x3e')]=qs[_0xd7c4('0x36')](_[_0xd7c4('0x3f')](_0x1cb722[_0xd7c4('0x34')],_0x342051[_0xd7c4('0x36')]));if(_0x1cb722[_0xd7c4('0x34')][_0xd7c4('0x40')]){_0x145efa[_0xd7c4('0x3e')]=_[_0xd7c4('0x41')](_0x145efa['where'],{'$or':_[_0xd7c4('0x2f')](_0x145efa[_0xd7c4('0x39')],function(_0x10323f){var _0x5b3fb2={};_0x5b3fb2[_0x10323f]={'$like':'%'+_0x1cb722[_0xd7c4('0x34')][_0xd7c4('0x40')]+'%'};return _0x5b3fb2;})});}_0x145efa=_[_0xd7c4('0x41')]({},_0x145efa,_0x1cb722['options']);return _0x438095[_0xd7c4('0x4e')](_0x145efa);}})[_0xd7c4('0x27')](function(_0x1a1b64){if(_0x1a1b64){_0x76d7ac=_0x1a1b64[_0xd7c4('0x52')];if(!_0x1cb722['query']['hasOwnProperty']('nolimit')){_0x145efa['limit']=qs[_0xd7c4('0x1e')](_0x1cb722[_0xd7c4('0x34')][_0xd7c4('0x1e')]);_0x145efa[_0xd7c4('0x1c')]=qs[_0xd7c4('0x1c')](_0x1cb722[_0xd7c4('0x34')][_0xd7c4('0x1c')]);}return _0x438095[_0xd7c4('0x4e')](_0x145efa);}})[_0xd7c4('0x27')](function(_0x1604b3){if(_0x1604b3){return _0x1604b3?{'count':_0x76d7ac,'rows':_0x1604b3}:null;}})[_0xd7c4('0x27')](respondWithResult(_0x1494e5,null))[_0xd7c4('0x48')](handleError(_0x1494e5,null));};exports[_0xd7c4('0x53')]=function(_0x352bcb,_0x40f532,_0x30952f){if(_0x352bcb[_0xd7c4('0x4c')]['id']){delete _0x352bcb[_0xd7c4('0x4c')]['id'];}return db[_0xd7c4('0x30')][_0xd7c4('0x4f')]({'where':{'id':_0x352bcb[_0xd7c4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x40f532,null))['then'](function(_0x239b70){if(_0x239b70){_0x352bcb[_0xd7c4('0x4c')]['AccountId']=_0x239b70['id'];_0x352bcb[_0xd7c4('0x4c')][_0xd7c4('0x54')]=integrations[_0xd7c4('0x55')](_0x352bcb[_0xd7c4('0x4c')][_0xd7c4('0x56')],_0x352bcb[_0xd7c4('0x4c')][_0xd7c4('0x57')]);_0x352bcb[_0xd7c4('0x4c')][_0xd7c4('0x58')]=integrations[_0xd7c4('0x59')](_0x352bcb[_0xd7c4('0x4c')][_0xd7c4('0x56')],_0x352bcb['body'][_0xd7c4('0x57')]);return db['ServicenowConfiguration'][_0xd7c4('0x4b')](_0x352bcb[_0xd7c4('0x4c')],{'include':[{'model':db['ServicenowField'],'as':_0xd7c4('0x54')},{'model':db[_0xd7c4('0x5a')],'as':_0xd7c4('0x58')}]});}return null;})[_0xd7c4('0x27')](respondWithResult(_0x40f532,null))['catch'](handleError(_0x40f532,null));};exports['getFields']=function(_0x248ac5,_0x378541,_0x5f3173){var _0x448bd1=[_0xd7c4('0x5b'),_0xd7c4('0x5c'),_0xd7c4('0x5d'),_0xd7c4('0x5e'),_0xd7c4('0x5f'),_0xd7c4('0x60'),_0xd7c4('0x61'),_0xd7c4('0x62'),'category'];var _0x263481=[_0xd7c4('0x63'),_0xd7c4('0x5b'),_0xd7c4('0x64'),_0xd7c4('0x65'),_0xd7c4('0x66'),_0xd7c4('0x67'),_0xd7c4('0x68'),_0xd7c4('0x5c'),_0xd7c4('0x69'),_0xd7c4('0x6a'),'resolved_by',_0xd7c4('0x6b'),_0xd7c4('0x6c'),_0xd7c4('0x6d'),_0xd7c4('0x6e'),_0xd7c4('0x6f'),_0xd7c4('0x70'),_0xd7c4('0x71'),_0xd7c4('0x5d'),_0xd7c4('0x51'),'calendar_stc',_0xd7c4('0x72'),_0xd7c4('0x73'),'delivery_plan','impact',_0xd7c4('0x74'),_0xd7c4('0x75'),_0xd7c4('0x76'),_0xd7c4('0x77'),_0xd7c4('0x78'),_0xd7c4('0x79'),_0xd7c4('0x7a'),'expected_start',_0xd7c4('0x7b'),_0xd7c4('0x7c'),_0xd7c4('0x7d'),_0xd7c4('0x7e'),_0xd7c4('0x7f'),_0xd7c4('0x80'),_0xd7c4('0x81'),_0xd7c4('0x82'),_0xd7c4('0x5e'),_0xd7c4('0x83'),_0xd7c4('0x84'),'close_code',_0xd7c4('0x85'),'delivery_task','work_start',_0xd7c4('0x86'),_0xd7c4('0x87'),_0xd7c4('0x88'),_0xd7c4('0x89'),_0xd7c4('0x8a'),_0xd7c4('0x60'),_0xd7c4('0x8b'),_0xd7c4('0x8c'),_0xd7c4('0x8d'),_0xd7c4('0x8e'),_0xd7c4('0x8f'),_0xd7c4('0x90'),_0xd7c4('0x91'),_0xd7c4('0x92'),_0xd7c4('0x61'),_0xd7c4('0x93'),'problem_id',_0xd7c4('0x94'),_0xd7c4('0x95'),'activity_due',_0xd7c4('0x96'),_0xd7c4('0x62'),_0xd7c4('0x97'),_0xd7c4('0x98'),_0xd7c4('0x99'),_0xd7c4('0x9a'),_0xd7c4('0x9b'),'sys_mod_count',_0xd7c4('0x9c'),_0xd7c4('0x9d'),_0xd7c4('0x9e'),'upon_approval',_0xd7c4('0x9f'),_0xd7c4('0xa0'),_0xd7c4('0xa1')];var _0x5eeaf0='';var _0x116d2f='';var _0x41391a=[];var _0x1ec7cd='';var _0x1d3812='';var _0x36f32a=[];var _0x2606f9='';var _0x1210c0='';var _0x4e766c={};var _0x457fa1='';return db[_0xd7c4('0x30')]['findOne']({'where':{'id':_0x248ac5['params']['id']},'attributes':['id',_0xd7c4('0xa2'),_0xd7c4('0xa3'),_0xd7c4('0xa4'),_0xd7c4('0xa5'),'serverUrl']})[_0xd7c4('0x27')](handleEntityNotFound(_0x378541,null))['then'](function(_0x58729b){if(_0x58729b){_0x457fa1=_0x58729b[_0xd7c4('0xa5')];var _0x3e94d3=_0x457fa1[_0xd7c4('0xa6')](-0x1);if(_0x3e94d3==='/'){_0x457fa1=_0x457fa1[_0xd7c4('0xa7')](0x0,_0x457fa1['lastIndexOf'](_0x3e94d3));}_0x1210c0=util[_0xd7c4('0xa8')](_0xd7c4('0xa9'),_0x457fa1);_0x2606f9=util['format']('%s/api/now/table/',_0x457fa1);_0x4e766c={'user':_0x58729b[_0xd7c4('0xa2')],'pass':_0x58729b['password']};var _0x37f012={'method':_0xd7c4('0xaa'),'uri':_0x1210c0+_0xd7c4('0xab'),'auth':_0x4e766c,'json':!![]};return rp(_0x37f012);}})[_0xd7c4('0x27')](function(_0x418948){if(_0x418948[_0xd7c4('0xac')][_0xd7c4('0x52')]>0x0){_0x5eeaf0=_0x418948[_0xd7c4('0xac')];}console['log'](_0xd7c4('0xad'),_0x5eeaf0);_0x36f32a=[];_0x116d2f=Object[_0xd7c4('0xae')]([],_0x5eeaf0);_[_0xd7c4('0xaf')](_0x116d2f,function(_0x5e2173){return!_0x448bd1['includes'](_0x5e2173['name']);});_0x116d2f['forEach'](function(_0x389ad6){var _0x4f76f9=createFieldObject(_0x2606f9,_0x4e766c,_0x389ad6[_0xd7c4('0xb0')],_0x389ad6[_0xd7c4('0x2c')],_0x389ad6[_0xd7c4('0xb1')],![]);_0x36f32a[_0xd7c4('0xb2')](_0x4f76f9);});return Promise[_0xd7c4('0xb3')](_0x36f32a);})[_0xd7c4('0x27')](function(_0x1f41f){_0x41391a=_0x1f41f;_0x1ec7cd=Object['assign']([],_0x5eeaf0);console[_0xd7c4('0xb4')](_0xd7c4('0xb5'),_0x5eeaf0);_[_0xd7c4('0xaf')](_0x1ec7cd,function(_0x4aa939){return _0x263481['includes'](_0x4aa939[_0xd7c4('0x2c')]);});console[_0xd7c4('0xb4')](_0xd7c4('0xb6'),_0x1ec7cd);_0x36f32a=[];_0x1ec7cd['forEach'](function(_0x4f9f5e){var _0x5e650d=createFieldObject(_0x2606f9,_0x4e766c,_0x4f9f5e[_0xd7c4('0xb0')],_0x4f9f5e['name'],_0x4f9f5e['label'],!![]);_0x36f32a[_0xd7c4('0xb2')](_0x5e650d);});return Promise['all'](_0x36f32a);})['then'](function(_0x14b8fc){_0x1d3812=_0x14b8fc;var _0xd06ecf=_0x41391a[_0xd7c4('0xb7')](_0x1d3812);return{'count':_0xd06ecf[_0xd7c4('0x52')],'rows':_0xd06ecf};})[_0xd7c4('0x27')](respondWithResult(_0x378541,null))[_0xd7c4('0x48')](function(_0x53b030){console[_0xd7c4('0xb4')]('ServiceNow\x20error:\x20'+_0x53b030);var _0x441f1e=_0x248ac5[_0xd7c4('0x34')]['test']?0x1f4:_0x53b030['statusCode']||0x1f4;logger[_0xd7c4('0x2a')](_0x53b030[_0xd7c4('0x2b')]);delete _0x53b030[_0xd7c4('0x2c')];if(_0x441f1e===0x191){_0x441f1e=0x190;}_0x378541[_0xd7c4('0x1a')](_0x441f1e)[_0xd7c4('0x2d')](_0x248ac5[_0xd7c4('0x34')]['test']?{'message':_0xd7c4('0xb8'),'statusCode':_0x53b030['statusCode']}:_0x53b030);});};function createFieldObject(_0x2f93c5,_0x393dfd,_0x1bdf44,_0x4aea0f,_0x3f0210,_0xef0276){return new Promise(function(_0x4ede70,_0x1fa7a5){var _0x2f4df1={'id':_0x4aea0f,'name':_0x3f0210,'custom':_0xef0276};if(_0x1bdf44===_0xd7c4('0xb9')){_0x2f4df1[_0xd7c4('0x43')]=[{'name':_0xd7c4('0xba'),'value':_0xd7c4('0xbb')},{'name':_0xd7c4('0xbc'),'value':_0xd7c4('0xbd')}];_0x4ede70(_0x2f4df1);}else{var _0x2f9819={'method':_0xd7c4('0xaa'),'uri':_0x2f93c5+_0xd7c4('0xbe')+_0x4aea0f,'auth':_0x393dfd,'json':!![]};return rp(_0x2f9819)[_0xd7c4('0x27')](function(_0x2ff17b){var _0x1c2d03=[];if(_0x2ff17b['result'][_0xd7c4('0x52')]>0x0){_0x2ff17b['result'][_0xd7c4('0xbf')](function(_0x39e850){if(_0x39e850[_0xd7c4('0xc0')]===_0xd7c4('0xbd')){var _0x2bdee2={'name':_0x39e850[_0xd7c4('0xb1')],'value':_0x39e850[_0xd7c4('0xc1')]};_0x1c2d03[_0xd7c4('0xb2')](_0x2bdee2);}});}_0x2f4df1['options']=_0x1c2d03;if(_0x2f4df1[_0xd7c4('0x43')][_0xd7c4('0x52')]>0x0){_0x4ede70(_0x2f4df1);}else{if(_0xef0276==![]){_0x4ede70();}else{_0x4ede70(_0x2f4df1);}}});}});} \ No newline at end of file +var _0x018e=['limit','sort','where','pick','merge','map','type','VIRTUAL','filter','options','include','findAll','show','params','keys','includeAll','find','catch','create','body','getConfigurations','findOne','ServicenowConfiguration','order','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','notify','incident_state','severity','category','child_incidents','approval_history','resolved_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','delivery_plan','impact','active','business_service','priority','sys_domain_path','rfc','opened_at','group_list','work_end','reopened_time','resolved_at','caller_id','short_description','close_code','correlation_display','delivery_task','work_start','business_stc','additional_assignee_list','description','calendar_duration','close_notes','closed_by','parent_incident','sys_id','contact_type','reopened_by','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','ServiceNow\x20error:\x20','statusCode','send','Wrong\x20credentials','boolean','True','true','false','sys_choice?sysparm_query=name=incident^element=','inactive','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','apply','save','update','then','destroy','error','stack','name','index','ServicenowAccount','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x1b79dc,_0x2290a1){var _0x346ce7=function(_0x476461){while(--_0x476461){_0x1b79dc['push'](_0x1b79dc['shift']());}};_0x346ce7(++_0x2290a1);}(_0x018e,0x13d));var _0xe018=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x018e[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0xe018('0x0'));var rimraf=require(_0xe018('0x1'));var zipdir=require(_0xe018('0x2'));var jsonpatch=require(_0xe018('0x3'));var rp=require(_0xe018('0x4'));var moment=require(_0xe018('0x5'));var BPromise=require(_0xe018('0x6'));var Mustache=require('mustache');var util=require(_0xe018('0x7'));var path=require(_0xe018('0x8'));var sox=require(_0xe018('0x9'));var csv=require('to-csv');var ejs=require(_0xe018('0xa'));var fs=require('fs');var fs_extra=require(_0xe018('0xb'));var _=require(_0xe018('0xc'));var squel=require(_0xe018('0xd'));var crypto=require(_0xe018('0xe'));var jsforce=require(_0xe018('0xf'));var deskjs=require(_0xe018('0x10'));var toCsv=require(_0xe018('0x11'));var querystring=require(_0xe018('0x12'));var Papa=require(_0xe018('0x13'));var Redis=require(_0xe018('0x14'));var authService=require(_0xe018('0x15'));var qs=require(_0xe018('0x16'));var as=require(_0xe018('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe018('0x18'))(_0xe018('0x19'));var utils=require(_0xe018('0x1a'));var config=require(_0xe018('0x1b'));var licenseUtil=require(_0xe018('0x1c'));var db=require(_0xe018('0x1d'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x52fa46,_0x5d0d58){_0x5d0d58=_0x5d0d58||0xcc;return function(_0x1c1e48){if(_0x1c1e48){return _0x52fa46[_0xe018('0x1e')](_0x5d0d58);}return _0x52fa46[_0xe018('0x1f')](_0x5d0d58)[_0xe018('0x20')]();};}function respondWithResult(_0x2f8bfc,_0x1bd4b0){_0x1bd4b0=_0x1bd4b0||0xc8;return function(_0x4fdeba){if(_0x4fdeba){return _0x2f8bfc['status'](_0x1bd4b0)['json'](_0x4fdeba);}};}function respondWithFilteredResult(_0xcc9c09,_0x3f8a82){return function(_0x5d051f){if(_0x5d051f){var _0x2ff4b3=typeof _0x3f8a82[_0xe018('0x21')]===_0xe018('0x22')&&typeof _0x3f8a82['limit']===_0xe018('0x22');var _0xfd0265=_0x5d051f['count'];var _0x4e6bef=_0x2ff4b3?0x0:_0x3f8a82[_0xe018('0x21')];var _0x88aa0c=_0x2ff4b3?_0x5d051f[_0xe018('0x23')]:_0x3f8a82[_0xe018('0x21')]+_0x3f8a82['limit'];var _0x70cad6;if(_0x88aa0c>=_0xfd0265){_0x88aa0c=_0xfd0265;_0x70cad6=0xc8;}else{_0x70cad6=0xce;}_0xcc9c09[_0xe018('0x1f')](_0x70cad6);return _0xcc9c09[_0xe018('0x24')]('Content-Range',_0x4e6bef+'-'+_0x88aa0c+'/'+_0xfd0265)['json'](_0x5d051f);}return null;};}function patchUpdates(_0x19b5c9){return function(_0x4cda48){try{jsonpatch[_0xe018('0x25')](_0x4cda48,_0x19b5c9,!![]);}catch(_0x482caa){return BPromise['reject'](_0x482caa);}return _0x4cda48[_0xe018('0x26')]();};}function saveUpdates(_0x2dec4a,_0x4c40e8){return function(_0x1aa1c5){if(_0x1aa1c5){return _0x1aa1c5[_0xe018('0x27')](_0x2dec4a)[_0xe018('0x28')](function(_0xbc62d5){return _0xbc62d5;});}return null;};}function removeEntity(_0x262f1a,_0x16a5bd){return function(_0x14f981){if(_0x14f981){return _0x14f981[_0xe018('0x29')]()['then'](function(){_0x262f1a[_0xe018('0x1f')](0xcc)[_0xe018('0x20')]();});}};}function handleEntityNotFound(_0x3da8ca,_0x5c20aa){return function(_0x546416){if(!_0x546416){_0x3da8ca[_0xe018('0x1e')](0x194);}return _0x546416;};}function handleError(_0x5332e1,_0xb277a4){_0xb277a4=_0xb277a4||0x1f4;return function(_0x5ef70a){logger[_0xe018('0x2a')](_0x5ef70a[_0xe018('0x2b')]);if(_0x5ef70a[_0xe018('0x2c')]){delete _0x5ef70a[_0xe018('0x2c')];}_0x5332e1['status'](_0xb277a4)['send'](_0x5ef70a);};}exports[_0xe018('0x2d')]=function(_0x2bb581,_0x5174ee){var _0x531379={},_0x2c6a18={},_0x2958b1={'count':0x0,'rows':[]};var _0x489de3=_['map'](db[_0xe018('0x2e')][_0xe018('0x2f')],function(_0x1c05c8){return{'name':_0x1c05c8[_0xe018('0x30')],'type':_0x1c05c8['type'][_0xe018('0x31')]};});_0x2c6a18[_0xe018('0x32')]=_['map'](_0x489de3,'name');_0x2c6a18['query']=_['keys'](_0x2bb581[_0xe018('0x33')]);_0x2c6a18[_0xe018('0x34')]=_[_0xe018('0x35')](_0x2c6a18[_0xe018('0x32')],_0x2c6a18[_0xe018('0x33')]);_0x531379['attributes']=_['intersection'](_0x2c6a18['model'],qs[_0xe018('0x36')](_0x2bb581[_0xe018('0x33')][_0xe018('0x36')]));_0x531379[_0xe018('0x37')]=_0x531379[_0xe018('0x37')][_0xe018('0x38')]?_0x531379[_0xe018('0x37')]:_0x2c6a18[_0xe018('0x32')];if(!_0x2bb581['query'][_0xe018('0x39')](_0xe018('0x3a'))){_0x531379[_0xe018('0x3b')]=qs[_0xe018('0x3b')](_0x2bb581['query'][_0xe018('0x3b')]);_0x531379[_0xe018('0x21')]=qs[_0xe018('0x21')](_0x2bb581[_0xe018('0x33')][_0xe018('0x21')]);}_0x531379['order']=qs[_0xe018('0x3c')](_0x2bb581[_0xe018('0x33')][_0xe018('0x3c')]);_0x531379[_0xe018('0x3d')]=qs[_0xe018('0x34')](_[_0xe018('0x3e')](_0x2bb581[_0xe018('0x33')],_0x2c6a18['filters']),_0x489de3);if(_0x2bb581[_0xe018('0x33')]['filter']){_0x531379[_0xe018('0x3d')]=_[_0xe018('0x3f')](_0x531379[_0xe018('0x3d')],{'$or':_[_0xe018('0x40')](_0x489de3,function(_0x1de640){if(_0x1de640[_0xe018('0x41')]!==_0xe018('0x42')){var _0x3e186b={};_0x3e186b[_0x1de640[_0xe018('0x2c')]]={'$like':'%'+_0x2bb581[_0xe018('0x33')][_0xe018('0x43')]+'%'};return _0x3e186b;}})});}_0x531379=_[_0xe018('0x3f')]({},_0x531379,_0x2bb581[_0xe018('0x44')]);var _0x4e9ea5={'where':_0x531379['where']};return db[_0xe018('0x2e')][_0xe018('0x23')](_0x4e9ea5)[_0xe018('0x28')](function(_0x58a501){_0x2958b1['count']=_0x58a501;if(_0x2bb581[_0xe018('0x33')]['includeAll']){_0x531379[_0xe018('0x45')]=[{'all':!![]}];}return db[_0xe018('0x2e')][_0xe018('0x46')](_0x531379);})[_0xe018('0x28')](function(_0x12fcc5){_0x2958b1['rows']=_0x12fcc5;return _0x2958b1;})[_0xe018('0x28')](respondWithFilteredResult(_0x5174ee,_0x531379))['catch'](handleError(_0x5174ee,null));};exports[_0xe018('0x47')]=function(_0x1030f0,_0x4fe51c){var _0x359c07={'raw':![],'where':{'id':_0x1030f0[_0xe018('0x48')]['id']}},_0x42bfb4={};_0x42bfb4[_0xe018('0x32')]=_[_0xe018('0x49')](db[_0xe018('0x2e')][_0xe018('0x2f')]);_0x42bfb4[_0xe018('0x33')]=_[_0xe018('0x49')](_0x1030f0['query']);_0x42bfb4[_0xe018('0x34')]=_['intersection'](_0x42bfb4[_0xe018('0x32')],_0x42bfb4['query']);_0x359c07[_0xe018('0x37')]=_[_0xe018('0x35')](_0x42bfb4[_0xe018('0x32')],qs[_0xe018('0x36')](_0x1030f0['query'][_0xe018('0x36')]));_0x359c07['attributes']=_0x359c07[_0xe018('0x37')][_0xe018('0x38')]?_0x359c07[_0xe018('0x37')]:_0x42bfb4[_0xe018('0x32')];if(_0x1030f0[_0xe018('0x33')][_0xe018('0x4a')]){_0x359c07['include']=[{'all':!![]}];}_0x359c07=_[_0xe018('0x3f')]({},_0x359c07,_0x1030f0[_0xe018('0x44')]);return db[_0xe018('0x2e')][_0xe018('0x4b')](_0x359c07)[_0xe018('0x28')](handleEntityNotFound(_0x4fe51c,null))['then'](respondWithResult(_0x4fe51c,null))[_0xe018('0x4c')](handleError(_0x4fe51c,null));};exports[_0xe018('0x4d')]=function(_0x3053ec,_0x2c9329){return db['ServicenowAccount'][_0xe018('0x4d')](_0x3053ec[_0xe018('0x4e')],{})[_0xe018('0x28')](respondWithResult(_0x2c9329,0xc9))[_0xe018('0x4c')](handleError(_0x2c9329,null));};exports[_0xe018('0x27')]=function(_0x484e15,_0x3e1164){if(_0x484e15[_0xe018('0x4e')]['id']){delete _0x484e15[_0xe018('0x4e')]['id'];}return db[_0xe018('0x2e')][_0xe018('0x4b')]({'where':{'id':_0x484e15[_0xe018('0x48')]['id']}})[_0xe018('0x28')](handleEntityNotFound(_0x3e1164,null))['then'](saveUpdates(_0x484e15['body'],null))[_0xe018('0x28')](respondWithResult(_0x3e1164,null))['catch'](handleError(_0x3e1164,null));};exports['destroy']=function(_0x6afca2,_0xbac610){return db[_0xe018('0x2e')][_0xe018('0x4b')]({'where':{'id':_0x6afca2[_0xe018('0x48')]['id']}})[_0xe018('0x28')](handleEntityNotFound(_0xbac610,null))[_0xe018('0x28')](removeEntity(_0xbac610,null))[_0xe018('0x4c')](handleError(_0xbac610,null));};exports[_0xe018('0x4f')]=function(_0x8d1d3b,_0x487328,_0x11d5e8){var _0x3fe31f={};var _0xb98ac9={};var _0x459e7e;var _0x219ad1;return db[_0xe018('0x2e')][_0xe018('0x50')]({'where':{'id':_0x8d1d3b[_0xe018('0x48')]['id']}})[_0xe018('0x28')](handleEntityNotFound(_0x487328,null))[_0xe018('0x28')](function(_0x3b276b){if(_0x3b276b){_0x459e7e=_0x3b276b;_0xb98ac9['model']=_[_0xe018('0x49')](db[_0xe018('0x51')]['rawAttributes']);_0xb98ac9[_0xe018('0x33')]=_[_0xe018('0x49')](_0x8d1d3b[_0xe018('0x33')]);_0xb98ac9[_0xe018('0x34')]=_[_0xe018('0x35')](_0xb98ac9[_0xe018('0x32')],_0xb98ac9[_0xe018('0x33')]);_0x3fe31f['attributes']=_['intersection'](_0xb98ac9[_0xe018('0x32')],qs[_0xe018('0x36')](_0x8d1d3b['query'][_0xe018('0x36')]));_0x3fe31f[_0xe018('0x37')]=_0x3fe31f[_0xe018('0x37')][_0xe018('0x38')]?_0x3fe31f[_0xe018('0x37')]:_0xb98ac9['model'];_0x3fe31f[_0xe018('0x52')]=qs['sort'](_0x8d1d3b[_0xe018('0x33')][_0xe018('0x3c')]);_0x3fe31f[_0xe018('0x3d')]=qs[_0xe018('0x34')](_[_0xe018('0x3e')](_0x8d1d3b[_0xe018('0x33')],_0xb98ac9[_0xe018('0x34')]));if(_0x8d1d3b[_0xe018('0x33')]['filter']){_0x3fe31f[_0xe018('0x3d')]=_['merge'](_0x3fe31f['where'],{'$or':_[_0xe018('0x40')](_0x3fe31f[_0xe018('0x37')],function(_0x3e1ad0){var _0x301d54={};_0x301d54[_0x3e1ad0]={'$like':'%'+_0x8d1d3b['query'][_0xe018('0x43')]+'%'};return _0x301d54;})});}_0x3fe31f=_['merge']({},_0x3fe31f,_0x8d1d3b[_0xe018('0x44')]);return _0x459e7e[_0xe018('0x4f')](_0x3fe31f);}})[_0xe018('0x28')](function(_0x17a10d){if(_0x17a10d){_0x219ad1=_0x17a10d[_0xe018('0x38')];if(!_0x8d1d3b['query']['hasOwnProperty'](_0xe018('0x3a'))){_0x3fe31f[_0xe018('0x3b')]=qs[_0xe018('0x3b')](_0x8d1d3b[_0xe018('0x33')]['limit']);_0x3fe31f[_0xe018('0x21')]=qs[_0xe018('0x21')](_0x8d1d3b['query'][_0xe018('0x21')]);}return _0x459e7e['getConfigurations'](_0x3fe31f);}})[_0xe018('0x28')](function(_0x24efe3){if(_0x24efe3){return _0x24efe3?{'count':_0x219ad1,'rows':_0x24efe3}:null;}})['then'](respondWithResult(_0x487328,null))['catch'](handleError(_0x487328,null));};exports[_0xe018('0x53')]=function(_0x2b4249,_0x59214f,_0x36bad5){if(_0x2b4249[_0xe018('0x4e')]['id']){delete _0x2b4249[_0xe018('0x4e')]['id'];}return db['ServicenowAccount'][_0xe018('0x50')]({'where':{'id':_0x2b4249[_0xe018('0x48')]['id']}})[_0xe018('0x28')](handleEntityNotFound(_0x59214f,null))[_0xe018('0x28')](function(_0x22fe09){if(_0x22fe09){_0x2b4249[_0xe018('0x4e')][_0xe018('0x54')]=_0x22fe09['id'];_0x2b4249[_0xe018('0x4e')][_0xe018('0x55')]=integrations[_0xe018('0x56')](_0x2b4249[_0xe018('0x4e')]['channel'],_0x2b4249[_0xe018('0x4e')][_0xe018('0x41')]);_0x2b4249['body'][_0xe018('0x57')]=integrations[_0xe018('0x58')](_0x2b4249[_0xe018('0x4e')][_0xe018('0x59')],_0x2b4249[_0xe018('0x4e')]['type']);return db[_0xe018('0x51')][_0xe018('0x4d')](_0x2b4249['body'],{'include':[{'model':db['ServicenowField'],'as':_0xe018('0x55')},{'model':db[_0xe018('0x5a')],'as':_0xe018('0x57')}]});}return null;})[_0xe018('0x28')](respondWithResult(_0x59214f,null))[_0xe018('0x4c')](handleError(_0x59214f,null));};exports[_0xe018('0x5b')]=function(_0x3d1d41,_0x237508,_0x121818){var _0x3fb4ea=[_0xe018('0x5c'),_0xe018('0x5d'),_0xe018('0x5e'),_0xe018('0x5f'),'close_code',_0xe018('0x60'),_0xe018('0x61'),_0xe018('0x62'),_0xe018('0x63')];var _0x24bac5=['parent',_0xe018('0x5c'),'caused_by','watch_list','upon_reject','sys_updated_on',_0xe018('0x64'),'hold_reason',_0xe018('0x65'),'number',_0xe018('0x66'),'sys_updated_by','opened_by',_0xe018('0x67'),_0xe018('0x68'),_0xe018('0x69'),_0xe018('0x6a'),_0xe018('0x6b'),_0xe018('0x5e'),'order',_0xe018('0x6c'),_0xe018('0x6d'),'cmdb_ci',_0xe018('0x6e'),_0xe018('0x6f'),_0xe018('0x70'),'work_notes_list',_0xe018('0x71'),_0xe018('0x72'),_0xe018('0x73'),_0xe018('0x74'),'time_worked','expected_start',_0xe018('0x75'),'business_duration',_0xe018('0x76'),_0xe018('0x77'),_0xe018('0x78'),_0xe018('0x79'),_0xe018('0x7a'),'approval_set',_0xe018('0x5f'),'work_notes',_0xe018('0x7b'),_0xe018('0x7c'),_0xe018('0x7d'),_0xe018('0x7e'),_0xe018('0x7f'),'assignment_group',_0xe018('0x80'),_0xe018('0x81'),_0xe018('0x82'),_0xe018('0x83'),_0xe018('0x60'),'sys_class_name',_0xe018('0x84'),_0xe018('0x85'),'follow_up',_0xe018('0x86'),_0xe018('0x87'),_0xe018('0x88'),_0xe018('0x89'),_0xe018('0x61'),'urgency',_0xe018('0x8a'),_0xe018('0x8b'),_0xe018('0x8c'),_0xe018('0x8d'),_0xe018('0x8e'),'severity',_0xe018('0x8f'),_0xe018('0x90'),_0xe018('0x91'),_0xe018('0x92'),_0xe018('0x93'),_0xe018('0x94'),_0xe018('0x95'),'sys_tags',_0xe018('0x96'),_0xe018('0x97'),_0xe018('0x98'),'location',_0xe018('0x63')];var _0x3f4905='';var _0x48486f='';var _0x2b270b=[];var _0x410363='';var _0xad7472='';var _0x1942a1=[];var _0x1be898='';var _0x437824='';var _0x22883b={};var _0x71b3fe='';return db[_0xe018('0x2e')][_0xe018('0x50')]({'where':{'id':_0x3d1d41['params']['id']},'attributes':['id',_0xe018('0x99'),_0xe018('0x9a'),_0xe018('0x9b'),_0xe018('0x9c'),_0xe018('0x9d')]})[_0xe018('0x28')](handleEntityNotFound(_0x237508,null))[_0xe018('0x28')](function(_0x3b41be){if(_0x3b41be){_0x71b3fe=_0x3b41be[_0xe018('0x9c')];var _0x3dc7c0=_0x71b3fe[_0xe018('0x9e')](-0x1);if(_0x3dc7c0==='/'){_0x71b3fe=_0x71b3fe[_0xe018('0x9f')](0x0,_0x71b3fe[_0xe018('0xa0')](_0x3dc7c0));}_0x437824=util[_0xe018('0xa1')](_0xe018('0xa2'),_0x71b3fe);_0x1be898=util[_0xe018('0xa1')](_0xe018('0xa3'),_0x71b3fe);_0x22883b={'user':_0x3b41be[_0xe018('0x99')],'pass':_0x3b41be['password']};var _0xa3c2e1={'method':_0xe018('0xa4'),'uri':_0x437824+_0xe018('0xa5'),'auth':_0x22883b,'json':!![]};return rp(_0xa3c2e1);}})['then'](function(_0x14c2bf){if(_0x14c2bf[_0xe018('0xa6')][_0xe018('0x38')]>0x0){_0x3f4905=_0x14c2bf['result'];}console[_0xe018('0xa7')]('incident\x20table\x20objects',_0x3f4905);_0x1942a1=[];_0x48486f=Object[_0xe018('0xa8')]([],_0x3f4905);_[_0xe018('0xa9')](_0x48486f,function(_0x4c2539){return!_0x3fb4ea[_0xe018('0xaa')](_0x4c2539[_0xe018('0x2c')]);});_0x48486f[_0xe018('0xab')](function(_0x36596d){var _0x3085bc=createFieldObject(_0x1be898,_0x22883b,_0x36596d[_0xe018('0xac')],_0x36596d['name'],_0x36596d[_0xe018('0xad')],![]);_0x1942a1[_0xe018('0xae')](_0x3085bc);});return Promise[_0xe018('0xaf')](_0x1942a1);})[_0xe018('0x28')](function(_0x2612bb){_0x2b270b=_0x2612bb;_0x410363=Object[_0xe018('0xa8')]([],_0x3f4905);console['log'](_0xe018('0xb0'),_0x3f4905);_['remove'](_0x410363,function(_0x570ebd){return _0x24bac5[_0xe018('0xaa')](_0x570ebd[_0xe018('0x2c')]);});console[_0xe018('0xa7')](_0xe018('0xb1'),_0x410363);_0x1942a1=[];_0x410363[_0xe018('0xab')](function(_0x23e97a){var _0x189b1e=createFieldObject(_0x1be898,_0x22883b,_0x23e97a[_0xe018('0xac')],_0x23e97a[_0xe018('0x2c')],_0x23e97a[_0xe018('0xad')],!![]);_0x1942a1[_0xe018('0xae')](_0x189b1e);});return Promise[_0xe018('0xaf')](_0x1942a1);})['then'](function(_0x153202){_0xad7472=_0x153202;var _0x24ab2d=_0x2b270b['concat'](_0xad7472);return{'count':_0x24ab2d[_0xe018('0x38')],'rows':_0x24ab2d};})[_0xe018('0x28')](respondWithResult(_0x237508,null))['catch'](function(_0x3aa256){console[_0xe018('0xa7')](_0xe018('0xb2')+_0x3aa256);var _0x1ef8a7=_0x3d1d41[_0xe018('0x33')]['test']?0x1f4:_0x3aa256[_0xe018('0xb3')]||0x1f4;logger['error'](_0x3aa256['stack']);delete _0x3aa256['name'];if(_0x1ef8a7===0x191){_0x1ef8a7=0x190;}_0x237508[_0xe018('0x1f')](_0x1ef8a7)[_0xe018('0xb4')](_0x3d1d41[_0xe018('0x33')]['test']?{'message':_0xe018('0xb5'),'statusCode':_0x3aa256['statusCode']}:_0x3aa256);});};function createFieldObject(_0x41fa9c,_0x3efe8e,_0x448b33,_0x1d1687,_0x2759a3,_0x391915){return new Promise(function(_0xb4f733,_0xf1bb68){var _0x497ca2={'id':_0x1d1687,'name':_0x2759a3,'custom':_0x391915};if(_0x448b33===_0xe018('0xb6')){_0x497ca2[_0xe018('0x44')]=[{'name':_0xe018('0xb7'),'value':_0xe018('0xb8')},{'name':'False','value':_0xe018('0xb9')}];_0xb4f733(_0x497ca2);}else{var _0x5c2a17={'method':_0xe018('0xa4'),'uri':_0x41fa9c+_0xe018('0xba')+_0x1d1687,'auth':_0x3efe8e,'json':!![]};return rp(_0x5c2a17)[_0xe018('0x28')](function(_0x10822a){var _0x485b1f=[];if(_0x10822a[_0xe018('0xa6')][_0xe018('0x38')]>0x0){_0x10822a['result']['forEach'](function(_0x1546c3){if(_0x1546c3[_0xe018('0xbb')]==='false'){var _0xdd88a2={'name':_0x1546c3[_0xe018('0xad')],'value':_0x1546c3['value']};_0x485b1f[_0xe018('0xae')](_0xdd88a2);}});}_0x497ca2[_0xe018('0x44')]=_0x485b1f;if(_0x497ca2[_0xe018('0x44')][_0xe018('0x38')]>0x0){_0xb4f733(_0x497ca2);}else{if(_0x391915==![]){_0xb4f733();}else{_0xb4f733(_0x497ca2);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 9e1d213..3f8087e 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 _0x7da7=['../../config/environment','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7da7,0x10d));var _0x77da=function(_0x79cd47,_0x16102d){_0x79cd47=_0x79cd47-0x0;var _0x3b9484=_0x7da7[_0x79cd47];return _0x3b9484;};'use strict';var _=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var logger=require(_0x77da('0x2'))('api');var moment=require('moment');var BPromise=require(_0x77da('0x3'));var rp=require(_0x77da('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x77da('0x5'));var config=require(_0x77da('0x6'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x77da('0x7'));module[_0x77da('0x8')]=function(_0x47da81,_0x30afe0){return _0x47da81['define'](_0x77da('0x9'),attributes,{'tableName':_0x77da('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1883=['../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xaaa4fd,_0x9c5f4b){var _0xd428ce=function(_0x1b930c){while(--_0x1b930c){_0xaaa4fd['push'](_0xaaa4fd['shift']());}};_0xd428ce(++_0x9c5f4b);}(_0x1883,0xab));var _0x3188=function(_0x415317,_0x49eec6){_0x415317=_0x415317-0x0;var _0x218c36=_0x1883[_0x415317];return _0x218c36;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var logger=require(_0x3188('0x2'))(_0x3188('0x3'));var moment=require(_0x3188('0x4'));var BPromise=require(_0x3188('0x5'));var rp=require(_0x3188('0x6'));var fs=require('fs');var path=require(_0x3188('0x7'));var rimraf=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var attributes=require(_0x3188('0xa'));var integrations=require(_0x3188('0xb'));module[_0x3188('0xc')]=function(_0x33b62d,_0x24f2f1){return _0x33b62d[_0x3188('0xd')](_0x3188('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 1b660fc..4f2aa4b 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 _0xaba8=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','catch','GetServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowServicenowAccount','ServicenowAccount','debug','lodash','bluebird','randomstring'];(function(_0x846ae8,_0x33a70b){var _0x356b00=function(_0xa96f69){while(--_0xa96f69){_0x846ae8['push'](_0x846ae8['shift']());}};_0x356b00(++_0x33a70b);}(_0xaba8,0x12f));var _0x8aba=function(_0x3472f6,_0x446bf0){_0x3472f6=_0x3472f6-0x0;var _0x3598e0=_0xaba8[_0x3472f6];return _0x3598e0;};'use strict';var _=require(_0x8aba('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8aba('0x1'));var rs=require(_0x8aba('0x2'));var fs=require('fs');var Redis=require(_0x8aba('0x3'));var db=require(_0x8aba('0x4'))['db'];var utils=require(_0x8aba('0x5'));var logger=require(_0x8aba('0x6'))(_0x8aba('0x7'));var config=require(_0x8aba('0x8'));var jayson=require(_0x8aba('0x9'));var client=jayson[_0x8aba('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2917d0,_0x7cdf9a,_0x1f6503){return new BPromise(function(_0x4762ab,_0xa74ffe){return client['request'](_0x2917d0,_0x1f6503)['then'](function(_0x58fa90){logger[_0x8aba('0xb')]('ServicenowAccount,\x20%s,\x20%s',_0x7cdf9a,'request\x20sent');logger['debug'](_0x8aba('0xc'),_0x7cdf9a,_0x8aba('0xd'),JSON[_0x8aba('0xe')](_0x58fa90));if(_0x58fa90['error']){if(_0x58fa90[_0x8aba('0xf')][_0x8aba('0x10')]===0x1f4){logger['error'](_0x8aba('0x11'),_0x7cdf9a,_0x58fa90['error'][_0x8aba('0x12')]);return _0xa74ffe(_0x58fa90['error'][_0x8aba('0x12')]);}logger['error'](_0x8aba('0x11'),_0x7cdf9a,_0x58fa90[_0x8aba('0xf')][_0x8aba('0x12')]);return _0x4762ab(_0x58fa90[_0x8aba('0xf')][_0x8aba('0x12')]);}else{logger[_0x8aba('0xb')]('ServicenowAccount,\x20%s,\x20%s',_0x7cdf9a,_0x8aba('0xd'));_0x4762ab(_0x58fa90['result'][_0x8aba('0x12')]);}})[_0x8aba('0x13')](function(_0x1ffb11){logger[_0x8aba('0xf')](_0x8aba('0x11'),_0x7cdf9a,_0x1ffb11);_0xa74ffe(_0x1ffb11);});});}exports[_0x8aba('0x14')]=function(_0x365cf1){var _0x39c4a5=this;return new Promise(function(_0x2522c3,_0x264ec6){return db['ServicenowAccount'][_0x8aba('0x15')]({'raw':_0x365cf1[_0x8aba('0x16')]?_0x365cf1[_0x8aba('0x16')][_0x8aba('0x17')]===undefined?!![]:![]:!![],'where':_0x365cf1[_0x8aba('0x16')]?_0x365cf1[_0x8aba('0x16')][_0x8aba('0x18')]||null:null,'attributes':_0x365cf1[_0x8aba('0x16')]?_0x365cf1[_0x8aba('0x16')][_0x8aba('0x19')]||null:null,'limit':_0x365cf1['options']?_0x365cf1[_0x8aba('0x16')][_0x8aba('0x1a')]||null:null,'include':_0x365cf1[_0x8aba('0x16')]?_0x365cf1[_0x8aba('0x16')][_0x8aba('0x1b')]?_[_0x8aba('0x1c')](_0x365cf1[_0x8aba('0x16')]['include'],function(_0x7143bb){return{'model':db[_0x7143bb['model']],'as':_0x7143bb['as'],'attributes':_0x7143bb[_0x8aba('0x19')],'include':_0x7143bb[_0x8aba('0x1b')]?_['map'](_0x7143bb['include'],function(_0x7a2c94){return{'model':db[_0x7a2c94['model']],'as':_0x7a2c94['as'],'attributes':_0x7a2c94[_0x8aba('0x19')],'include':_0x7a2c94[_0x8aba('0x1b')]?_[_0x8aba('0x1c')](_0x7a2c94[_0x8aba('0x1b')],function(_0x2e6481){return{'model':db[_0x2e6481[_0x8aba('0x1d')]],'as':_0x2e6481['as'],'attributes':_0x2e6481[_0x8aba('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8aba('0x1e')](function(_0x42ebd8){logger[_0x8aba('0xb')](_0x8aba('0x14'),_0x365cf1);logger['debug']('GetServicenowAccount',_0x365cf1,JSON[_0x8aba('0xe')](_0x42ebd8));_0x2522c3(_0x42ebd8);})['catch'](function(_0x41ee2e){logger[_0x8aba('0xf')](_0x8aba('0x14'),_0x41ee2e[_0x8aba('0x12')],_0x365cf1);_0x264ec6(_0x39c4a5[_0x8aba('0xf')](0x1f4,_0x41ee2e[_0x8aba('0x12')]));});});};exports[_0x8aba('0x1f')]=function(_0x47125f){var _0x1d8fd2=this;return new Promise(function(_0x33f272,_0x4f0d73){return db[_0x8aba('0x20')]['find']({'raw':_0x47125f['options']?_0x47125f[_0x8aba('0x16')][_0x8aba('0x17')]===undefined?!![]:![]:!![],'where':_0x47125f['options']?_0x47125f[_0x8aba('0x16')][_0x8aba('0x18')]||null:null,'attributes':_0x47125f[_0x8aba('0x16')]?_0x47125f[_0x8aba('0x16')][_0x8aba('0x19')]||null:null,'include':_0x47125f['options']?_0x47125f[_0x8aba('0x16')][_0x8aba('0x1b')]?_[_0x8aba('0x1c')](_0x47125f['options']['include'],function(_0x279d81){return{'model':db[_0x279d81[_0x8aba('0x1d')]],'as':_0x279d81['as'],'attributes':_0x279d81[_0x8aba('0x19')],'include':_0x279d81[_0x8aba('0x1b')]?_['map'](_0x279d81['include'],function(_0x561665){return{'model':db[_0x561665[_0x8aba('0x1d')]],'as':_0x561665['as'],'attributes':_0x561665['attributes'],'include':_0x561665[_0x8aba('0x1b')]?_[_0x8aba('0x1c')](_0x561665[_0x8aba('0x1b')],function(_0x18825b){return{'model':db[_0x18825b[_0x8aba('0x1d')]],'as':_0x18825b['as'],'attributes':_0x18825b[_0x8aba('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8aba('0x1e')](function(_0x1079d2){logger[_0x8aba('0xb')](_0x8aba('0x1f'),_0x47125f);logger[_0x8aba('0x21')](_0x8aba('0x1f'),_0x47125f,JSON[_0x8aba('0xe')](_0x1079d2));_0x33f272(_0x1079d2);})[_0x8aba('0x13')](function(_0x110b7d){logger[_0x8aba('0xf')](_0x8aba('0x1f'),_0x110b7d[_0x8aba('0x12')],_0x47125f);_0x4f0d73(_0x1d8fd2[_0x8aba('0xf')](0x1f4,_0x110b7d[_0x8aba('0x12')]));});});}; \ No newline at end of file +var _0x7433=['map','model','GetServicenowAccount','debug','ShowServicenowAccount','ServicenowAccount','find','where','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','ServicenowAccount,\x20%s,\x20%s','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','findAll','options','raw','attributes','limit','include'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x7433,0x17e));var _0x3743=function(_0x311fd4,_0x2fc056){_0x311fd4=_0x311fd4-0x0;var _0x2a7835=_0x7433[_0x311fd4];return _0x2a7835;};'use strict';var _=require(_0x3743('0x0'));var util=require(_0x3743('0x1'));var moment=require('moment');var BPromise=require(_0x3743('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3743('0x3'));var db=require(_0x3743('0x4'))['db'];var utils=require(_0x3743('0x5'));var logger=require(_0x3743('0x6'))('rpc');var config=require(_0x3743('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3743('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x22dda1,_0xa2ead0,_0x5ba6ab){return new BPromise(function(_0x24e52e,_0x396333){return client[_0x3743('0x9')](_0x22dda1,_0x5ba6ab)[_0x3743('0xa')](function(_0x23f2c6){logger['info'](_0x3743('0xb'),_0xa2ead0,'request\x20sent');logger['debug'](_0x3743('0xc'),_0xa2ead0,_0x3743('0xd'),JSON[_0x3743('0xe')](_0x23f2c6));if(_0x23f2c6[_0x3743('0xf')]){if(_0x23f2c6[_0x3743('0xf')][_0x3743('0x10')]===0x1f4){logger[_0x3743('0xf')](_0x3743('0xb'),_0xa2ead0,_0x23f2c6['error'][_0x3743('0x11')]);return _0x396333(_0x23f2c6['error'][_0x3743('0x11')]);}logger['error'](_0x3743('0xb'),_0xa2ead0,_0x23f2c6['error']['message']);return _0x24e52e(_0x23f2c6[_0x3743('0xf')][_0x3743('0x11')]);}else{logger[_0x3743('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0xa2ead0,'request\x20sent');_0x24e52e(_0x23f2c6['result']['message']);}})[_0x3743('0x13')](function(_0x12f8ae){logger[_0x3743('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0xa2ead0,_0x12f8ae);_0x396333(_0x12f8ae);});});}exports['GetServicenowAccount']=function(_0xf2d08b){var _0x37e860=this;return new Promise(function(_0x2ea130,_0xbae52b){return db['ServicenowAccount'][_0x3743('0x14')]({'raw':_0xf2d08b[_0x3743('0x15')]?_0xf2d08b[_0x3743('0x15')][_0x3743('0x16')]===undefined?!![]:![]:!![],'where':_0xf2d08b['options']?_0xf2d08b[_0x3743('0x15')]['where']||null:null,'attributes':_0xf2d08b[_0x3743('0x15')]?_0xf2d08b[_0x3743('0x15')][_0x3743('0x17')]||null:null,'limit':_0xf2d08b['options']?_0xf2d08b[_0x3743('0x15')][_0x3743('0x18')]||null:null,'include':_0xf2d08b[_0x3743('0x15')]?_0xf2d08b[_0x3743('0x15')][_0x3743('0x19')]?_[_0x3743('0x1a')](_0xf2d08b[_0x3743('0x15')][_0x3743('0x19')],function(_0xb845ef){return{'model':db[_0xb845ef[_0x3743('0x1b')]],'as':_0xb845ef['as'],'attributes':_0xb845ef['attributes'],'include':_0xb845ef[_0x3743('0x19')]?_[_0x3743('0x1a')](_0xb845ef[_0x3743('0x19')],function(_0x51f36a){return{'model':db[_0x51f36a['model']],'as':_0x51f36a['as'],'attributes':_0x51f36a[_0x3743('0x17')],'include':_0x51f36a[_0x3743('0x19')]?_[_0x3743('0x1a')](_0x51f36a[_0x3743('0x19')],function(_0x2704f6){return{'model':db[_0x2704f6[_0x3743('0x1b')]],'as':_0x2704f6['as'],'attributes':_0x2704f6[_0x3743('0x17')]};}):[]};}):[]};}):[]:[]})[_0x3743('0xa')](function(_0x500483){logger['info'](_0x3743('0x1c'),_0xf2d08b);logger[_0x3743('0x1d')](_0x3743('0x1c'),_0xf2d08b,JSON[_0x3743('0xe')](_0x500483));_0x2ea130(_0x500483);})['catch'](function(_0x1d33ae){logger['error'](_0x3743('0x1c'),_0x1d33ae[_0x3743('0x11')],_0xf2d08b);_0xbae52b(_0x37e860[_0x3743('0xf')](0x1f4,_0x1d33ae[_0x3743('0x11')]));});});};exports[_0x3743('0x1e')]=function(_0x43d656){var _0x4c5166=this;return new Promise(function(_0x26f7f,_0x29f6f5){return db[_0x3743('0x1f')][_0x3743('0x20')]({'raw':_0x43d656[_0x3743('0x15')]?_0x43d656['options'][_0x3743('0x16')]===undefined?!![]:![]:!![],'where':_0x43d656[_0x3743('0x15')]?_0x43d656['options'][_0x3743('0x21')]||null:null,'attributes':_0x43d656[_0x3743('0x15')]?_0x43d656['options'][_0x3743('0x17')]||null:null,'include':_0x43d656[_0x3743('0x15')]?_0x43d656[_0x3743('0x15')][_0x3743('0x19')]?_[_0x3743('0x1a')](_0x43d656[_0x3743('0x15')][_0x3743('0x19')],function(_0xb78c8b){return{'model':db[_0xb78c8b[_0x3743('0x1b')]],'as':_0xb78c8b['as'],'attributes':_0xb78c8b[_0x3743('0x17')],'include':_0xb78c8b[_0x3743('0x19')]?_['map'](_0xb78c8b[_0x3743('0x19')],function(_0x3db2c5){return{'model':db[_0x3db2c5[_0x3743('0x1b')]],'as':_0x3db2c5['as'],'attributes':_0x3db2c5[_0x3743('0x17')],'include':_0x3db2c5[_0x3743('0x19')]?_[_0x3743('0x1a')](_0x3db2c5[_0x3743('0x19')],function(_0x23d6a7){return{'model':db[_0x23d6a7[_0x3743('0x1b')]],'as':_0x23d6a7['as'],'attributes':_0x23d6a7['attributes']};}):[]};}):[]};}):[]:[]})[_0x3743('0xa')](function(_0x15afc3){logger[_0x3743('0x12')]('ShowServicenowAccount',_0x43d656);logger[_0x3743('0x1d')](_0x3743('0x1e'),_0x43d656,JSON[_0x3743('0xe')](_0x15afc3));_0x26f7f(_0x15afc3);})[_0x3743('0x13')](function(_0x2f79a8){logger['error'](_0x3743('0x1e'),_0x2f79a8[_0x3743('0x11')],_0x43d656);_0x29f6f5(_0x4c5166['error'](0x1f4,_0x2f79a8[_0x3743('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 2509967..32bbbef 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 _0x447c=['get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','put','update','delete','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller'];(function(_0x4575e1,_0x1aaf7e){var _0x15eddf=function(_0x5ebd46){while(--_0x5ebd46){_0x4575e1['push'](_0x4575e1['shift']());}};_0x15eddf(++_0x1aaf7e);}(_0x447c,0x1dc));var _0xc447=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x447c[_0x21a9d9];return _0x46adce;};'use strict';var multer=require('multer');var util=require(_0xc447('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc447('0x1'));var router=express[_0xc447('0x2')]();var fs_extra=require(_0xc447('0x3'));var auth=require(_0xc447('0x4'));var interaction=require(_0xc447('0x5'));var config=require(_0xc447('0x6'));var controller=require(_0xc447('0x7'));router[_0xc447('0x8')]('/',auth[_0xc447('0x9')](),controller[_0xc447('0xa')]);router['get'](_0xc447('0xb'),auth[_0xc447('0x9')](),controller[_0xc447('0xc')]);router['get'](_0xc447('0xd'),auth[_0xc447('0x9')](),controller[_0xc447('0xe')]);router[_0xc447('0x8')](_0xc447('0xf'),auth['isAuthenticated'](),controller[_0xc447('0x10')]);router['get'](_0xc447('0x11'),auth[_0xc447('0x9')](),controller['getDescriptions']);router[_0xc447('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc447('0x13')]('/:id',auth[_0xc447('0x9')](),controller[_0xc447('0x14')]);router[_0xc447('0x15')](_0xc447('0xb'),auth[_0xc447('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x78be=['/:id/descriptions','post','create','put','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects'];(function(_0x1f19fb,_0x200586){var _0x1e3d86=function(_0x34d0bb){while(--_0x34d0bb){_0x1f19fb['push'](_0x1f19fb['shift']());}};_0x1e3d86(++_0x200586);}(_0x78be,0x1ea));var _0xe78b=function(_0x2d490b,_0x4aae04){_0x2d490b=_0x2d490b-0x0;var _0x1749f1=_0x78be[_0x2d490b];return _0x1749f1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe78b('0x0'));var timeout=require('connect-timeout');var express=require(_0xe78b('0x1'));var router=express[_0xe78b('0x2')]();var fs_extra=require(_0xe78b('0x3'));var auth=require(_0xe78b('0x4'));var interaction=require(_0xe78b('0x5'));var config=require('../../config/environment');var controller=require(_0xe78b('0x6'));router[_0xe78b('0x7')]('/',auth[_0xe78b('0x8')](),controller[_0xe78b('0x9')]);router['get'](_0xe78b('0xa'),auth[_0xe78b('0x8')](),controller['show']);router[_0xe78b('0x7')](_0xe78b('0xb'),auth['isAuthenticated'](),controller[_0xe78b('0xc')]);router[_0xe78b('0x7')]('/:id/subjects',auth[_0xe78b('0x8')](),controller[_0xe78b('0xd')]);router[_0xe78b('0x7')](_0xe78b('0xe'),auth[_0xe78b('0x8')](),controller['getDescriptions']);router[_0xe78b('0xf')]('/',auth[_0xe78b('0x8')](),controller[_0xe78b('0x10')]);router[_0xe78b('0x11')](_0xe78b('0xa'),auth[_0xe78b('0x8')](),controller['update']);router[_0xe78b('0x12')](_0xe78b('0xa'),auth[_0xe78b('0x8')](),controller[_0xe78b('0x13')]);module[_0xe78b('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 30d7a39..f6528d8 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 _0xec45=['STRING','sequelize','exports'];(function(_0x1aaf05,_0x48a923){var _0x25513c=function(_0x2c291e){while(--_0x2c291e){_0x1aaf05['push'](_0x1aaf05['shift']());}};_0x25513c(++_0x48a923);}(_0xec45,0x10c));var _0x5ec4=function(_0x1baf34,_0x37af16){_0x1baf34=_0x1baf34-0x0;var _0x7d6115=_0xec45[_0x1baf34];return _0x7d6115;};'use strict';var Sequelize=require(_0x5ec4('0x0'));module[_0x5ec4('0x1')]={'name':{'type':Sequelize[_0x5ec4('0x2')]},'description':{'type':Sequelize[_0x5ec4('0x2')]}}; \ No newline at end of file +var _0xbce7=['STRING','exports'];(function(_0x420503,_0x4da9b5){var _0x271c29=function(_0xb7aaff){while(--_0xb7aaff){_0x420503['push'](_0x420503['shift']());}};_0x271c29(++_0x4da9b5);}(_0xbce7,0x105));var _0x7bce=function(_0x4bf7b3,_0x53783e){_0x4bf7b3=_0x4bf7b3-0x0;var _0x55296f=_0xbce7[_0x4bf7b3];return _0x55296f;};'use strict';var Sequelize=require('sequelize');module[_0x7bce('0x0')]={'name':{'type':Sequelize[_0x7bce('0x1')]},'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 d7ff48d..1ae9150 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 _0x2de8=['hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','ServicenowConfiguration','includeAll','include','findAll','rows','catch','params','find','create','body','getFields','findOne','ServicenowField','order','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','end','error','name','send','index','rawAttributes','key','map','query','keys','filters','intersection','model','attributes','fields','length'];(function(_0xa78bb5,_0x273e0f){var _0x3a300f=function(_0x5ba159){while(--_0x5ba159){_0xa78bb5['push'](_0xa78bb5['shift']());}};_0x3a300f(++_0x273e0f);}(_0x2de8,0x10d));var _0x82de=function(_0x29bfbe,_0x37060a){_0x29bfbe=_0x29bfbe-0x0;var _0x230663=_0x2de8[_0x29bfbe];return _0x230663;};'use strict';var emlformat=require(_0x82de('0x0'));var rimraf=require(_0x82de('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x82de('0x2'));var rp=require('request-promise');var moment=require(_0x82de('0x3'));var BPromise=require(_0x82de('0x4'));var Mustache=require(_0x82de('0x5'));var util=require(_0x82de('0x6'));var path=require(_0x82de('0x7'));var sox=require(_0x82de('0x8'));var csv=require('to-csv');var ejs=require(_0x82de('0x9'));var fs=require('fs');var fs_extra=require(_0x82de('0xa'));var _=require(_0x82de('0xb'));var squel=require(_0x82de('0xc'));var crypto=require(_0x82de('0xd'));var jsforce=require(_0x82de('0xe'));var deskjs=require(_0x82de('0xf'));var toCsv=require(_0x82de('0x10'));var querystring=require(_0x82de('0x11'));var Papa=require(_0x82de('0x12'));var Redis=require(_0x82de('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x82de('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x82de('0x15'))('api');var utils=require(_0x82de('0x16'));var config=require(_0x82de('0x17'));var licenseUtil=require(_0x82de('0x18'));var db=require(_0x82de('0x19'))['db'];function respondWithStatusCode(_0x77ef1f,_0x4d0db4){_0x4d0db4=_0x4d0db4||0xcc;return function(_0x4263ab){if(_0x4263ab){return _0x77ef1f[_0x82de('0x1a')](_0x4d0db4);}return _0x77ef1f[_0x82de('0x1b')](_0x4d0db4)['end']();};}function respondWithResult(_0x3d974f,_0x210276){_0x210276=_0x210276||0xc8;return function(_0x3d26f){if(_0x3d26f){return _0x3d974f[_0x82de('0x1b')](_0x210276)[_0x82de('0x1c')](_0x3d26f);}};}function respondWithFilteredResult(_0x18f89a,_0x1a1d15){return function(_0xa73e43){if(_0xa73e43){var _0xa2f1fd=typeof _0x1a1d15[_0x82de('0x1d')]===_0x82de('0x1e')&&typeof _0x1a1d15[_0x82de('0x1f')]==='undefined';var _0x257c8c=_0xa73e43[_0x82de('0x20')];var _0x98cbaf=_0xa2f1fd?0x0:_0x1a1d15[_0x82de('0x1d')];var _0x2e8a90=_0xa2f1fd?_0xa73e43[_0x82de('0x20')]:_0x1a1d15[_0x82de('0x1d')]+_0x1a1d15['limit'];var _0x25d17a;if(_0x2e8a90>=_0x257c8c){_0x2e8a90=_0x257c8c;_0x25d17a=0xc8;}else{_0x25d17a=0xce;}_0x18f89a['status'](_0x25d17a);return _0x18f89a['set'](_0x82de('0x21'),_0x98cbaf+'-'+_0x2e8a90+'/'+_0x257c8c)[_0x82de('0x1c')](_0xa73e43);}return null;};}function patchUpdates(_0x347c64){return function(_0xf0cc5b){try{jsonpatch[_0x82de('0x22')](_0xf0cc5b,_0x347c64,!![]);}catch(_0x13fc11){return BPromise[_0x82de('0x23')](_0x13fc11);}return _0xf0cc5b['save']();};}function saveUpdates(_0x5e4f86,_0x1483ad){return function(_0x5beed8){if(_0x5beed8){return _0x5beed8[_0x82de('0x24')](_0x5e4f86)['then'](function(_0x51faf2){return _0x51faf2;});}return null;};}function removeEntity(_0x33b02d,_0x289400){return function(_0x46ff9a){if(_0x46ff9a){return _0x46ff9a[_0x82de('0x25')]()[_0x82de('0x26')](function(){_0x33b02d[_0x82de('0x1b')](0xcc)[_0x82de('0x27')]();});}};}function handleEntityNotFound(_0x4b9c6a,_0x5d9abc){return function(_0xc0d5ce){if(!_0xc0d5ce){_0x4b9c6a['sendStatus'](0x194);}return _0xc0d5ce;};}function handleError(_0x145867,_0x22d619){_0x22d619=_0x22d619||0x1f4;return function(_0x5f08eb){logger[_0x82de('0x28')](_0x5f08eb['stack']);if(_0x5f08eb[_0x82de('0x29')]){delete _0x5f08eb[_0x82de('0x29')];}_0x145867[_0x82de('0x1b')](_0x22d619)[_0x82de('0x2a')](_0x5f08eb);};}exports[_0x82de('0x2b')]=function(_0xc035c,_0x36c256){var _0x517b3a={},_0xcb5fc9={},_0x455d31={'count':0x0,'rows':[]};var _0x50cf8e=_['map'](db['ServicenowConfiguration'][_0x82de('0x2c')],function(_0xc05d44){return{'name':_0xc05d44['fieldName'],'type':_0xc05d44['type'][_0x82de('0x2d')]};});_0xcb5fc9['model']=_[_0x82de('0x2e')](_0x50cf8e,_0x82de('0x29'));_0xcb5fc9[_0x82de('0x2f')]=_[_0x82de('0x30')](_0xc035c[_0x82de('0x2f')]);_0xcb5fc9[_0x82de('0x31')]=_[_0x82de('0x32')](_0xcb5fc9[_0x82de('0x33')],_0xcb5fc9['query']);_0x517b3a[_0x82de('0x34')]=_['intersection'](_0xcb5fc9[_0x82de('0x33')],qs[_0x82de('0x35')](_0xc035c[_0x82de('0x2f')][_0x82de('0x35')]));_0x517b3a[_0x82de('0x34')]=_0x517b3a[_0x82de('0x34')][_0x82de('0x36')]?_0x517b3a['attributes']:_0xcb5fc9[_0x82de('0x33')];if(!_0xc035c['query'][_0x82de('0x37')](_0x82de('0x38'))){_0x517b3a[_0x82de('0x1f')]=qs['limit'](_0xc035c[_0x82de('0x2f')][_0x82de('0x1f')]);_0x517b3a[_0x82de('0x1d')]=qs[_0x82de('0x1d')](_0xc035c[_0x82de('0x2f')][_0x82de('0x1d')]);}_0x517b3a['order']=qs['sort'](_0xc035c[_0x82de('0x2f')][_0x82de('0x39')]);_0x517b3a[_0x82de('0x3a')]=qs[_0x82de('0x31')](_[_0x82de('0x3b')](_0xc035c[_0x82de('0x2f')],_0xcb5fc9[_0x82de('0x31')]),_0x50cf8e);if(_0xc035c[_0x82de('0x2f')]['filter']){_0x517b3a[_0x82de('0x3a')]=_[_0x82de('0x3c')](_0x517b3a[_0x82de('0x3a')],{'$or':_[_0x82de('0x2e')](_0x50cf8e,function(_0x8afe73){if(_0x8afe73[_0x82de('0x3d')]!==_0x82de('0x3e')){var _0x101966={};_0x101966[_0x8afe73[_0x82de('0x29')]]={'$like':'%'+_0xc035c[_0x82de('0x2f')][_0x82de('0x3f')]+'%'};return _0x101966;}})});}_0x517b3a=_['merge']({},_0x517b3a,_0xc035c[_0x82de('0x40')]);var _0x1cb706={'where':_0x517b3a[_0x82de('0x3a')]};return db[_0x82de('0x41')][_0x82de('0x20')](_0x1cb706)[_0x82de('0x26')](function(_0x40095f){_0x455d31[_0x82de('0x20')]=_0x40095f;if(_0xc035c['query'][_0x82de('0x42')]){_0x517b3a[_0x82de('0x43')]=[{'all':!![]}];}return db[_0x82de('0x41')][_0x82de('0x44')](_0x517b3a);})[_0x82de('0x26')](function(_0x12f388){_0x455d31[_0x82de('0x45')]=_0x12f388;return _0x455d31;})[_0x82de('0x26')](respondWithFilteredResult(_0x36c256,_0x517b3a))[_0x82de('0x46')](handleError(_0x36c256,null));};exports['show']=function(_0x1c3ce3,_0x960b80){var _0x431d31={'raw':![],'where':{'id':_0x1c3ce3[_0x82de('0x47')]['id']}},_0xb11a9b={};_0xb11a9b['model']=_[_0x82de('0x30')](db[_0x82de('0x41')]['rawAttributes']);_0xb11a9b[_0x82de('0x2f')]=_[_0x82de('0x30')](_0x1c3ce3[_0x82de('0x2f')]);_0xb11a9b['filters']=_['intersection'](_0xb11a9b[_0x82de('0x33')],_0xb11a9b['query']);_0x431d31[_0x82de('0x34')]=_[_0x82de('0x32')](_0xb11a9b[_0x82de('0x33')],qs[_0x82de('0x35')](_0x1c3ce3[_0x82de('0x2f')][_0x82de('0x35')]));_0x431d31[_0x82de('0x34')]=_0x431d31['attributes']['length']?_0x431d31['attributes']:_0xb11a9b['model'];if(_0x1c3ce3[_0x82de('0x2f')]['includeAll']){_0x431d31[_0x82de('0x43')]=[{'all':!![]}];}_0x431d31=_[_0x82de('0x3c')]({},_0x431d31,_0x1c3ce3['options']);return db[_0x82de('0x41')][_0x82de('0x48')](_0x431d31)[_0x82de('0x26')](handleEntityNotFound(_0x960b80,null))[_0x82de('0x26')](respondWithResult(_0x960b80,null))[_0x82de('0x46')](handleError(_0x960b80,null));};exports[_0x82de('0x49')]=function(_0x42f92c,_0x39c53c){return db[_0x82de('0x41')][_0x82de('0x49')](_0x42f92c[_0x82de('0x4a')],{})[_0x82de('0x26')](respondWithResult(_0x39c53c,0xc9))[_0x82de('0x46')](handleError(_0x39c53c,null));};exports[_0x82de('0x24')]=function(_0x2ad899,_0x4dd8e6){if(_0x2ad899[_0x82de('0x4a')]['id']){delete _0x2ad899['body']['id'];}return db[_0x82de('0x41')][_0x82de('0x48')]({'where':{'id':_0x2ad899[_0x82de('0x47')]['id']}})['then'](handleEntityNotFound(_0x4dd8e6,null))[_0x82de('0x26')](saveUpdates(_0x2ad899[_0x82de('0x4a')],null))[_0x82de('0x26')](respondWithResult(_0x4dd8e6,null))[_0x82de('0x46')](handleError(_0x4dd8e6,null));};exports[_0x82de('0x25')]=function(_0x2d059c,_0x40f7dd){return db[_0x82de('0x41')][_0x82de('0x48')]({'where':{'id':_0x2d059c[_0x82de('0x47')]['id']}})['then'](handleEntityNotFound(_0x40f7dd,null))[_0x82de('0x26')](removeEntity(_0x40f7dd,null))[_0x82de('0x46')](handleError(_0x40f7dd,null));};exports[_0x82de('0x4b')]=function(_0xc1484d,_0x531473,_0x1b3227){var _0x292811={};var _0x11fe65={};var _0x1c910b;var _0x2315f2;return db[_0x82de('0x41')][_0x82de('0x4c')]({'where':{'id':_0xc1484d[_0x82de('0x47')]['id']}})[_0x82de('0x26')](handleEntityNotFound(_0x531473,null))[_0x82de('0x26')](function(_0x36e2dd){if(_0x36e2dd){_0x1c910b=_0x36e2dd;_0x11fe65[_0x82de('0x33')]=_[_0x82de('0x30')](db[_0x82de('0x4d')][_0x82de('0x2c')]);_0x11fe65[_0x82de('0x2f')]=_[_0x82de('0x30')](_0xc1484d['query']);_0x11fe65[_0x82de('0x31')]=_[_0x82de('0x32')](_0x11fe65[_0x82de('0x33')],_0x11fe65[_0x82de('0x2f')]);_0x292811[_0x82de('0x34')]=_[_0x82de('0x32')](_0x11fe65[_0x82de('0x33')],qs[_0x82de('0x35')](_0xc1484d['query'][_0x82de('0x35')]));_0x292811[_0x82de('0x34')]=_0x292811[_0x82de('0x34')][_0x82de('0x36')]?_0x292811[_0x82de('0x34')]:_0x11fe65[_0x82de('0x33')];_0x292811[_0x82de('0x4e')]=qs[_0x82de('0x39')](_0xc1484d[_0x82de('0x2f')]['sort']);_0x292811[_0x82de('0x3a')]=qs['filters'](_[_0x82de('0x3b')](_0xc1484d[_0x82de('0x2f')],_0x11fe65[_0x82de('0x31')]));if(_0xc1484d[_0x82de('0x2f')][_0x82de('0x3f')]){_0x292811[_0x82de('0x3a')]=_[_0x82de('0x3c')](_0x292811['where'],{'$or':_[_0x82de('0x2e')](_0x292811[_0x82de('0x34')],function(_0x4b52e5){var _0x5a6802={};_0x5a6802[_0x4b52e5]={'$like':'%'+_0xc1484d['query'][_0x82de('0x3f')]+'%'};return _0x5a6802;})});}_0x292811=_['merge']({},_0x292811,_0xc1484d[_0x82de('0x40')]);return _0x1c910b[_0x82de('0x4b')](_0x292811);}})[_0x82de('0x26')](function(_0x105bd0){if(_0x105bd0){_0x2315f2=_0x105bd0[_0x82de('0x36')];if(!_0xc1484d['query'][_0x82de('0x37')](_0x82de('0x38'))){_0x292811['limit']=qs[_0x82de('0x1f')](_0xc1484d[_0x82de('0x2f')]['limit']);_0x292811[_0x82de('0x1d')]=qs[_0x82de('0x1d')](_0xc1484d['query'][_0x82de('0x1d')]);}return _0x1c910b['getFields'](_0x292811);}})[_0x82de('0x26')](function(_0x5997d8){if(_0x5997d8){return _0x5997d8?{'count':_0x2315f2,'rows':_0x5997d8}:null;}})[_0x82de('0x26')](respondWithResult(_0x531473,null))[_0x82de('0x46')](handleError(_0x531473,null));};exports[_0x82de('0x4f')]=function(_0x267eaf,_0x2e3f27,_0x350bed){var _0x339475={};var _0x5cb97f={};var _0x5d9bcb;var _0x4dd1df;return db['ServicenowConfiguration'][_0x82de('0x4c')]({'where':{'id':_0x267eaf[_0x82de('0x47')]['id']}})['then'](handleEntityNotFound(_0x2e3f27,null))[_0x82de('0x26')](function(_0x41e96e){if(_0x41e96e){_0x5d9bcb=_0x41e96e;_0x5cb97f[_0x82de('0x33')]=_[_0x82de('0x30')](db[_0x82de('0x4d')][_0x82de('0x2c')]);_0x5cb97f[_0x82de('0x2f')]=_[_0x82de('0x30')](_0x267eaf['query']);_0x5cb97f[_0x82de('0x31')]=_[_0x82de('0x32')](_0x5cb97f[_0x82de('0x33')],_0x5cb97f['query']);_0x339475['attributes']=_['intersection'](_0x5cb97f[_0x82de('0x33')],qs[_0x82de('0x35')](_0x267eaf[_0x82de('0x2f')][_0x82de('0x35')]));_0x339475[_0x82de('0x34')]=_0x339475[_0x82de('0x34')][_0x82de('0x36')]?_0x339475['attributes']:_0x5cb97f[_0x82de('0x33')];_0x339475[_0x82de('0x4e')]=qs[_0x82de('0x39')](_0x267eaf[_0x82de('0x2f')][_0x82de('0x39')]);_0x339475['where']=qs[_0x82de('0x31')](_['pick'](_0x267eaf[_0x82de('0x2f')],_0x5cb97f[_0x82de('0x31')]));if(_0x267eaf[_0x82de('0x2f')][_0x82de('0x3f')]){_0x339475[_0x82de('0x3a')]=_[_0x82de('0x3c')](_0x339475[_0x82de('0x3a')],{'$or':_[_0x82de('0x2e')](_0x339475[_0x82de('0x34')],function(_0xf2f6ae){var _0x475d96={};_0x475d96[_0xf2f6ae]={'$like':'%'+_0x267eaf[_0x82de('0x2f')][_0x82de('0x3f')]+'%'};return _0x475d96;})});}_0x339475=_[_0x82de('0x3c')]({},_0x339475,_0x267eaf[_0x82de('0x40')]);return _0x5d9bcb[_0x82de('0x4f')](_0x339475);}})['then'](function(_0x4a6007){if(_0x4a6007){_0x4dd1df=_0x4a6007['length'];if(!_0x267eaf['query']['hasOwnProperty'](_0x82de('0x38'))){_0x339475['limit']=qs[_0x82de('0x1f')](_0x267eaf['query'][_0x82de('0x1f')]);_0x339475['offset']=qs[_0x82de('0x1d')](_0x267eaf[_0x82de('0x2f')][_0x82de('0x1d')]);}return _0x5d9bcb[_0x82de('0x4f')](_0x339475);}})[_0x82de('0x26')](function(_0x4c79d5){if(_0x4c79d5){return _0x4c79d5?{'count':_0x4dd1df,'rows':_0x4c79d5}:null;}})[_0x82de('0x26')](respondWithResult(_0x2e3f27,null))[_0x82de('0x46')](handleError(_0x2e3f27,null));};exports['getDescriptions']=function(_0x396576,_0x1dac12,_0x43fbad){var _0x1cfbe1={};var _0x4b046b={};var _0x281d58;var _0x49e3d0;return db[_0x82de('0x41')]['findOne']({'where':{'id':_0x396576[_0x82de('0x47')]['id']}})[_0x82de('0x26')](handleEntityNotFound(_0x1dac12,null))[_0x82de('0x26')](function(_0x33e6fe){if(_0x33e6fe){_0x281d58=_0x33e6fe;_0x4b046b['model']=_[_0x82de('0x30')](db[_0x82de('0x4d')]['rawAttributes']);_0x4b046b['query']=_[_0x82de('0x30')](_0x396576['query']);_0x4b046b[_0x82de('0x31')]=_[_0x82de('0x32')](_0x4b046b['model'],_0x4b046b[_0x82de('0x2f')]);_0x1cfbe1[_0x82de('0x34')]=_['intersection'](_0x4b046b[_0x82de('0x33')],qs['fields'](_0x396576[_0x82de('0x2f')][_0x82de('0x35')]));_0x1cfbe1[_0x82de('0x34')]=_0x1cfbe1[_0x82de('0x34')]['length']?_0x1cfbe1[_0x82de('0x34')]:_0x4b046b[_0x82de('0x33')];_0x1cfbe1[_0x82de('0x4e')]=qs['sort'](_0x396576['query'][_0x82de('0x39')]);_0x1cfbe1[_0x82de('0x3a')]=qs[_0x82de('0x31')](_[_0x82de('0x3b')](_0x396576['query'],_0x4b046b[_0x82de('0x31')]));if(_0x396576[_0x82de('0x2f')][_0x82de('0x3f')]){_0x1cfbe1[_0x82de('0x3a')]=_['merge'](_0x1cfbe1[_0x82de('0x3a')],{'$or':_[_0x82de('0x2e')](_0x1cfbe1['attributes'],function(_0x497f36){var _0x2d3452={};_0x2d3452[_0x497f36]={'$like':'%'+_0x396576[_0x82de('0x2f')][_0x82de('0x3f')]+'%'};return _0x2d3452;})});}_0x1cfbe1=_['merge']({},_0x1cfbe1,_0x396576[_0x82de('0x40')]);return _0x281d58['getDescriptions'](_0x1cfbe1);}})[_0x82de('0x26')](function(_0x547bc4){if(_0x547bc4){_0x49e3d0=_0x547bc4[_0x82de('0x36')];if(!_0x396576['query'][_0x82de('0x37')](_0x82de('0x38'))){_0x1cfbe1[_0x82de('0x1f')]=qs[_0x82de('0x1f')](_0x396576['query'][_0x82de('0x1f')]);_0x1cfbe1[_0x82de('0x1d')]=qs[_0x82de('0x1d')](_0x396576[_0x82de('0x2f')][_0x82de('0x1d')]);}return _0x281d58[_0x82de('0x50')](_0x1cfbe1);}})[_0x82de('0x26')](function(_0x129b37){if(_0x129b37){return _0x129b37?{'count':_0x49e3d0,'rows':_0x129b37}:null;}})[_0x82de('0x26')](respondWithResult(_0x1dac12,null))['catch'](handleError(_0x1dac12,null));}; \ No newline at end of file +var _0x177a=['filter','merge','VIRTUAL','options','ServicenowConfiguration','includeAll','rows','catch','show','params','length','include','find','create','body','getFields','findOne','ServicenowField','rawAttributes','pick','getSubjects','order','getDescriptions','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','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','fieldName','type','model','keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','sort','where'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x177a,0x16b));var _0xa177=function(_0x248a4b,_0x29d263){_0x248a4b=_0x248a4b-0x0;var _0x2de3d0=_0x177a[_0x248a4b];return _0x2de3d0;};'use strict';var emlformat=require(_0xa177('0x0'));var rimraf=require(_0xa177('0x1'));var zipdir=require(_0xa177('0x2'));var jsonpatch=require(_0xa177('0x3'));var rp=require(_0xa177('0x4'));var moment=require(_0xa177('0x5'));var BPromise=require(_0xa177('0x6'));var Mustache=require(_0xa177('0x7'));var util=require(_0xa177('0x8'));var path=require('path');var sox=require(_0xa177('0x9'));var csv=require(_0xa177('0xa'));var ejs=require(_0xa177('0xb'));var fs=require('fs');var fs_extra=require(_0xa177('0xc'));var _=require(_0xa177('0xd'));var squel=require(_0xa177('0xe'));var crypto=require(_0xa177('0xf'));var jsforce=require(_0xa177('0x10'));var deskjs=require(_0xa177('0x11'));var toCsv=require(_0xa177('0xa'));var querystring=require('querystring');var Papa=require(_0xa177('0x12'));var Redis=require('ioredis');var authService=require(_0xa177('0x13'));var qs=require(_0xa177('0x14'));var as=require(_0xa177('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa177('0x16'))(_0xa177('0x17'));var utils=require(_0xa177('0x18'));var config=require(_0xa177('0x19'));var licenseUtil=require(_0xa177('0x1a'));var db=require(_0xa177('0x1b'))['db'];function respondWithStatusCode(_0x4cebdd,_0x8b9133){_0x8b9133=_0x8b9133||0xcc;return function(_0x5aced6){if(_0x5aced6){return _0x4cebdd[_0xa177('0x1c')](_0x8b9133);}return _0x4cebdd[_0xa177('0x1d')](_0x8b9133)['end']();};}function respondWithResult(_0x5ddcd3,_0x2308ca){_0x2308ca=_0x2308ca||0xc8;return function(_0x3ac76c){if(_0x3ac76c){return _0x5ddcd3['status'](_0x2308ca)['json'](_0x3ac76c);}};}function respondWithFilteredResult(_0x17065e,_0x4f73fb){return function(_0x388bb6){if(_0x388bb6){var _0x171fef=typeof _0x4f73fb[_0xa177('0x1e')]===_0xa177('0x1f')&&typeof _0x4f73fb[_0xa177('0x20')]===_0xa177('0x1f');var _0x45bca2=_0x388bb6[_0xa177('0x21')];var _0xef8855=_0x171fef?0x0:_0x4f73fb[_0xa177('0x1e')];var _0x3e39d7=_0x171fef?_0x388bb6[_0xa177('0x21')]:_0x4f73fb[_0xa177('0x1e')]+_0x4f73fb['limit'];var _0x25ae83;if(_0x3e39d7>=_0x45bca2){_0x3e39d7=_0x45bca2;_0x25ae83=0xc8;}else{_0x25ae83=0xce;}_0x17065e['status'](_0x25ae83);return _0x17065e['set'](_0xa177('0x22'),_0xef8855+'-'+_0x3e39d7+'/'+_0x45bca2)[_0xa177('0x23')](_0x388bb6);}return null;};}function patchUpdates(_0x38b08a){return function(_0x1e725a){try{jsonpatch[_0xa177('0x24')](_0x1e725a,_0x38b08a,!![]);}catch(_0x2dca34){return BPromise[_0xa177('0x25')](_0x2dca34);}return _0x1e725a[_0xa177('0x26')]();};}function saveUpdates(_0x2ab8ae,_0x17b526){return function(_0x269567){if(_0x269567){return _0x269567[_0xa177('0x27')](_0x2ab8ae)['then'](function(_0x5341b9){return _0x5341b9;});}return null;};}function removeEntity(_0x38fa78,_0x22ce27){return function(_0x239825){if(_0x239825){return _0x239825[_0xa177('0x28')]()[_0xa177('0x29')](function(){_0x38fa78[_0xa177('0x1d')](0xcc)[_0xa177('0x2a')]();});}};}function handleEntityNotFound(_0x1c290f,_0x197cc1){return function(_0x21742b){if(!_0x21742b){_0x1c290f[_0xa177('0x1c')](0x194);}return _0x21742b;};}function handleError(_0x416313,_0x26fe0e){_0x26fe0e=_0x26fe0e||0x1f4;return function(_0x115cdd){logger[_0xa177('0x2b')](_0x115cdd[_0xa177('0x2c')]);if(_0x115cdd[_0xa177('0x2d')]){delete _0x115cdd['name'];}_0x416313[_0xa177('0x1d')](_0x26fe0e)[_0xa177('0x2e')](_0x115cdd);};}exports[_0xa177('0x2f')]=function(_0x3e60ac,_0x5538b8){var _0x101192={},_0x3eeee0={},_0x4ac2cc={'count':0x0,'rows':[]};var _0x346be1=_[_0xa177('0x30')](db['ServicenowConfiguration']['rawAttributes'],function(_0x416e3c){return{'name':_0x416e3c[_0xa177('0x31')],'type':_0x416e3c[_0xa177('0x32')]['key']};});_0x3eeee0[_0xa177('0x33')]=_[_0xa177('0x30')](_0x346be1,_0xa177('0x2d'));_0x3eeee0['query']=_[_0xa177('0x34')](_0x3e60ac['query']);_0x3eeee0[_0xa177('0x35')]=_[_0xa177('0x36')](_0x3eeee0[_0xa177('0x33')],_0x3eeee0[_0xa177('0x37')]);_0x101192['attributes']=_[_0xa177('0x36')](_0x3eeee0['model'],qs['fields'](_0x3e60ac[_0xa177('0x37')][_0xa177('0x38')]));_0x101192['attributes']=_0x101192[_0xa177('0x39')]['length']?_0x101192[_0xa177('0x39')]:_0x3eeee0[_0xa177('0x33')];if(!_0x3e60ac[_0xa177('0x37')][_0xa177('0x3a')](_0xa177('0x3b'))){_0x101192['limit']=qs['limit'](_0x3e60ac[_0xa177('0x37')][_0xa177('0x20')]);_0x101192[_0xa177('0x1e')]=qs['offset'](_0x3e60ac[_0xa177('0x37')][_0xa177('0x1e')]);}_0x101192['order']=qs[_0xa177('0x3c')](_0x3e60ac['query'][_0xa177('0x3c')]);_0x101192[_0xa177('0x3d')]=qs['filters'](_['pick'](_0x3e60ac[_0xa177('0x37')],_0x3eeee0[_0xa177('0x35')]),_0x346be1);if(_0x3e60ac[_0xa177('0x37')][_0xa177('0x3e')]){_0x101192[_0xa177('0x3d')]=_[_0xa177('0x3f')](_0x101192[_0xa177('0x3d')],{'$or':_[_0xa177('0x30')](_0x346be1,function(_0x45ce83){if(_0x45ce83[_0xa177('0x32')]!==_0xa177('0x40')){var _0x891812={};_0x891812[_0x45ce83['name']]={'$like':'%'+_0x3e60ac['query']['filter']+'%'};return _0x891812;}})});}_0x101192=_[_0xa177('0x3f')]({},_0x101192,_0x3e60ac[_0xa177('0x41')]);var _0x2a092a={'where':_0x101192[_0xa177('0x3d')]};return db[_0xa177('0x42')][_0xa177('0x21')](_0x2a092a)[_0xa177('0x29')](function(_0x4cca8c){_0x4ac2cc['count']=_0x4cca8c;if(_0x3e60ac[_0xa177('0x37')][_0xa177('0x43')]){_0x101192['include']=[{'all':!![]}];}return db[_0xa177('0x42')]['findAll'](_0x101192);})[_0xa177('0x29')](function(_0x176a5b){_0x4ac2cc[_0xa177('0x44')]=_0x176a5b;return _0x4ac2cc;})[_0xa177('0x29')](respondWithFilteredResult(_0x5538b8,_0x101192))[_0xa177('0x45')](handleError(_0x5538b8,null));};exports[_0xa177('0x46')]=function(_0x5ab7be,_0x4f30cb){var _0x195e96={'raw':![],'where':{'id':_0x5ab7be[_0xa177('0x47')]['id']}},_0x419f80={};_0x419f80[_0xa177('0x33')]=_[_0xa177('0x34')](db[_0xa177('0x42')]['rawAttributes']);_0x419f80[_0xa177('0x37')]=_['keys'](_0x5ab7be[_0xa177('0x37')]);_0x419f80[_0xa177('0x35')]=_[_0xa177('0x36')](_0x419f80[_0xa177('0x33')],_0x419f80['query']);_0x195e96[_0xa177('0x39')]=_['intersection'](_0x419f80[_0xa177('0x33')],qs[_0xa177('0x38')](_0x5ab7be[_0xa177('0x37')][_0xa177('0x38')]));_0x195e96[_0xa177('0x39')]=_0x195e96['attributes'][_0xa177('0x48')]?_0x195e96[_0xa177('0x39')]:_0x419f80[_0xa177('0x33')];if(_0x5ab7be[_0xa177('0x37')]['includeAll']){_0x195e96[_0xa177('0x49')]=[{'all':!![]}];}_0x195e96=_[_0xa177('0x3f')]({},_0x195e96,_0x5ab7be[_0xa177('0x41')]);return db[_0xa177('0x42')][_0xa177('0x4a')](_0x195e96)[_0xa177('0x29')](handleEntityNotFound(_0x4f30cb,null))[_0xa177('0x29')](respondWithResult(_0x4f30cb,null))['catch'](handleError(_0x4f30cb,null));};exports[_0xa177('0x4b')]=function(_0xfffaf3,_0x3b469b){return db[_0xa177('0x42')]['create'](_0xfffaf3[_0xa177('0x4c')],{})[_0xa177('0x29')](respondWithResult(_0x3b469b,0xc9))[_0xa177('0x45')](handleError(_0x3b469b,null));};exports[_0xa177('0x27')]=function(_0x4acf24,_0xe48afc){if(_0x4acf24['body']['id']){delete _0x4acf24[_0xa177('0x4c')]['id'];}return db[_0xa177('0x42')][_0xa177('0x4a')]({'where':{'id':_0x4acf24[_0xa177('0x47')]['id']}})[_0xa177('0x29')](handleEntityNotFound(_0xe48afc,null))[_0xa177('0x29')](saveUpdates(_0x4acf24[_0xa177('0x4c')],null))[_0xa177('0x29')](respondWithResult(_0xe48afc,null))[_0xa177('0x45')](handleError(_0xe48afc,null));};exports[_0xa177('0x28')]=function(_0x9e97c4,_0x2984c2){return db['ServicenowConfiguration']['find']({'where':{'id':_0x9e97c4[_0xa177('0x47')]['id']}})[_0xa177('0x29')](handleEntityNotFound(_0x2984c2,null))[_0xa177('0x29')](removeEntity(_0x2984c2,null))['catch'](handleError(_0x2984c2,null));};exports[_0xa177('0x4d')]=function(_0x557e7f,_0x41454a,_0x29fd06){var _0x2821c9={};var _0x15f76b={};var _0x3fbfaa;var _0x20370c;return db[_0xa177('0x42')][_0xa177('0x4e')]({'where':{'id':_0x557e7f['params']['id']}})[_0xa177('0x29')](handleEntityNotFound(_0x41454a,null))['then'](function(_0x194d44){if(_0x194d44){_0x3fbfaa=_0x194d44;_0x15f76b[_0xa177('0x33')]=_['keys'](db[_0xa177('0x4f')][_0xa177('0x50')]);_0x15f76b[_0xa177('0x37')]=_['keys'](_0x557e7f['query']);_0x15f76b[_0xa177('0x35')]=_[_0xa177('0x36')](_0x15f76b['model'],_0x15f76b[_0xa177('0x37')]);_0x2821c9['attributes']=_['intersection'](_0x15f76b[_0xa177('0x33')],qs[_0xa177('0x38')](_0x557e7f[_0xa177('0x37')][_0xa177('0x38')]));_0x2821c9[_0xa177('0x39')]=_0x2821c9[_0xa177('0x39')]['length']?_0x2821c9[_0xa177('0x39')]:_0x15f76b['model'];_0x2821c9['order']=qs['sort'](_0x557e7f['query'][_0xa177('0x3c')]);_0x2821c9[_0xa177('0x3d')]=qs[_0xa177('0x35')](_[_0xa177('0x51')](_0x557e7f['query'],_0x15f76b[_0xa177('0x35')]));if(_0x557e7f['query'][_0xa177('0x3e')]){_0x2821c9['where']=_[_0xa177('0x3f')](_0x2821c9['where'],{'$or':_[_0xa177('0x30')](_0x2821c9[_0xa177('0x39')],function(_0x13f249){var _0x1d8785={};_0x1d8785[_0x13f249]={'$like':'%'+_0x557e7f[_0xa177('0x37')][_0xa177('0x3e')]+'%'};return _0x1d8785;})});}_0x2821c9=_['merge']({},_0x2821c9,_0x557e7f[_0xa177('0x41')]);return _0x3fbfaa[_0xa177('0x4d')](_0x2821c9);}})[_0xa177('0x29')](function(_0x541abe){if(_0x541abe){_0x20370c=_0x541abe[_0xa177('0x48')];if(!_0x557e7f['query'][_0xa177('0x3a')](_0xa177('0x3b'))){_0x2821c9['limit']=qs[_0xa177('0x20')](_0x557e7f[_0xa177('0x37')][_0xa177('0x20')]);_0x2821c9[_0xa177('0x1e')]=qs['offset'](_0x557e7f[_0xa177('0x37')][_0xa177('0x1e')]);}return _0x3fbfaa[_0xa177('0x4d')](_0x2821c9);}})[_0xa177('0x29')](function(_0x39a932){if(_0x39a932){return _0x39a932?{'count':_0x20370c,'rows':_0x39a932}:null;}})[_0xa177('0x29')](respondWithResult(_0x41454a,null))[_0xa177('0x45')](handleError(_0x41454a,null));};exports[_0xa177('0x52')]=function(_0x3a0153,_0xacba78,_0x4d20d0){var _0x10ffeb={};var _0x223787={};var _0x33a567;var _0xc2070f;return db[_0xa177('0x42')][_0xa177('0x4e')]({'where':{'id':_0x3a0153[_0xa177('0x47')]['id']}})['then'](handleEntityNotFound(_0xacba78,null))[_0xa177('0x29')](function(_0x3ddd50){if(_0x3ddd50){_0x33a567=_0x3ddd50;_0x223787[_0xa177('0x33')]=_[_0xa177('0x34')](db['ServicenowField'][_0xa177('0x50')]);_0x223787[_0xa177('0x37')]=_[_0xa177('0x34')](_0x3a0153['query']);_0x223787['filters']=_[_0xa177('0x36')](_0x223787[_0xa177('0x33')],_0x223787[_0xa177('0x37')]);_0x10ffeb[_0xa177('0x39')]=_[_0xa177('0x36')](_0x223787[_0xa177('0x33')],qs['fields'](_0x3a0153[_0xa177('0x37')][_0xa177('0x38')]));_0x10ffeb[_0xa177('0x39')]=_0x10ffeb[_0xa177('0x39')][_0xa177('0x48')]?_0x10ffeb[_0xa177('0x39')]:_0x223787[_0xa177('0x33')];_0x10ffeb[_0xa177('0x53')]=qs[_0xa177('0x3c')](_0x3a0153[_0xa177('0x37')]['sort']);_0x10ffeb[_0xa177('0x3d')]=qs['filters'](_['pick'](_0x3a0153[_0xa177('0x37')],_0x223787['filters']));if(_0x3a0153['query'][_0xa177('0x3e')]){_0x10ffeb[_0xa177('0x3d')]=_['merge'](_0x10ffeb['where'],{'$or':_[_0xa177('0x30')](_0x10ffeb[_0xa177('0x39')],function(_0x4e0117){var _0x287e72={};_0x287e72[_0x4e0117]={'$like':'%'+_0x3a0153['query'][_0xa177('0x3e')]+'%'};return _0x287e72;})});}_0x10ffeb=_[_0xa177('0x3f')]({},_0x10ffeb,_0x3a0153[_0xa177('0x41')]);return _0x33a567[_0xa177('0x52')](_0x10ffeb);}})[_0xa177('0x29')](function(_0x56fc7a){if(_0x56fc7a){_0xc2070f=_0x56fc7a['length'];if(!_0x3a0153[_0xa177('0x37')][_0xa177('0x3a')](_0xa177('0x3b'))){_0x10ffeb['limit']=qs['limit'](_0x3a0153[_0xa177('0x37')][_0xa177('0x20')]);_0x10ffeb[_0xa177('0x1e')]=qs['offset'](_0x3a0153[_0xa177('0x37')][_0xa177('0x1e')]);}return _0x33a567[_0xa177('0x52')](_0x10ffeb);}})[_0xa177('0x29')](function(_0x5473c7){if(_0x5473c7){return _0x5473c7?{'count':_0xc2070f,'rows':_0x5473c7}:null;}})[_0xa177('0x29')](respondWithResult(_0xacba78,null))['catch'](handleError(_0xacba78,null));};exports[_0xa177('0x54')]=function(_0x374bc6,_0xf3a9d1,_0x25f08c){var _0x31a2dd={};var _0x5db69a={};var _0x3f6c98;var _0x4d1348;return db['ServicenowConfiguration'][_0xa177('0x4e')]({'where':{'id':_0x374bc6[_0xa177('0x47')]['id']}})['then'](handleEntityNotFound(_0xf3a9d1,null))[_0xa177('0x29')](function(_0x574e2f){if(_0x574e2f){_0x3f6c98=_0x574e2f;_0x5db69a['model']=_[_0xa177('0x34')](db[_0xa177('0x4f')]['rawAttributes']);_0x5db69a[_0xa177('0x37')]=_['keys'](_0x374bc6['query']);_0x5db69a[_0xa177('0x35')]=_[_0xa177('0x36')](_0x5db69a[_0xa177('0x33')],_0x5db69a[_0xa177('0x37')]);_0x31a2dd['attributes']=_[_0xa177('0x36')](_0x5db69a[_0xa177('0x33')],qs[_0xa177('0x38')](_0x374bc6[_0xa177('0x37')][_0xa177('0x38')]));_0x31a2dd[_0xa177('0x39')]=_0x31a2dd[_0xa177('0x39')]['length']?_0x31a2dd[_0xa177('0x39')]:_0x5db69a[_0xa177('0x33')];_0x31a2dd[_0xa177('0x53')]=qs[_0xa177('0x3c')](_0x374bc6[_0xa177('0x37')][_0xa177('0x3c')]);_0x31a2dd[_0xa177('0x3d')]=qs['filters'](_[_0xa177('0x51')](_0x374bc6[_0xa177('0x37')],_0x5db69a[_0xa177('0x35')]));if(_0x374bc6[_0xa177('0x37')]['filter']){_0x31a2dd[_0xa177('0x3d')]=_[_0xa177('0x3f')](_0x31a2dd[_0xa177('0x3d')],{'$or':_[_0xa177('0x30')](_0x31a2dd['attributes'],function(_0x1dd650){var _0x4abd3a={};_0x4abd3a[_0x1dd650]={'$like':'%'+_0x374bc6[_0xa177('0x37')]['filter']+'%'};return _0x4abd3a;})});}_0x31a2dd=_[_0xa177('0x3f')]({},_0x31a2dd,_0x374bc6[_0xa177('0x41')]);return _0x3f6c98[_0xa177('0x54')](_0x31a2dd);}})['then'](function(_0x596227){if(_0x596227){_0x4d1348=_0x596227[_0xa177('0x48')];if(!_0x374bc6[_0xa177('0x37')][_0xa177('0x3a')](_0xa177('0x3b'))){_0x31a2dd['limit']=qs[_0xa177('0x20')](_0x374bc6[_0xa177('0x37')][_0xa177('0x20')]);_0x31a2dd['offset']=qs['offset'](_0x374bc6[_0xa177('0x37')]['offset']);}return _0x3f6c98['getDescriptions'](_0x31a2dd);}})[_0xa177('0x29')](function(_0x446f19){if(_0x446f19){return _0x446f19?{'count':_0x4d1348,'rows':_0x446f19}:null;}})['then'](respondWithResult(_0xf3a9d1,null))['catch'](handleError(_0xf3a9d1,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 794aea0..c3d2e5a 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 _0xcbde=['moment','bluebird','request-promise','../../config/environment','./intServicenowConfiguration.attributes','int_servicenow_configurations','lodash','../../config/logger','api'];(function(_0x34a140,_0x441843){var _0x88aaee=function(_0x3f2871){while(--_0x3f2871){_0x34a140['push'](_0x34a140['shift']());}};_0x88aaee(++_0x441843);}(_0xcbde,0x141));var _0xecbd=function(_0x1caeef,_0x5e1dcb){_0x1caeef=_0x1caeef-0x0;var _0x14929a=_0xcbde[_0x1caeef];return _0x14929a;};'use strict';var _=require(_0xecbd('0x0'));var util=require('util');var logger=require(_0xecbd('0x1'))(_0xecbd('0x2'));var moment=require(_0xecbd('0x3'));var BPromise=require(_0xecbd('0x4'));var rp=require(_0xecbd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xecbd('0x6'));var attributes=require(_0xecbd('0x7'));module['exports']=function(_0x25b899,_0x27a04d){return _0x25b899['define']('ServicenowConfiguration',attributes,{'tableName':_0xecbd('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb71=['define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports'];(function(_0x3a83bb,_0x3da90a){var _0x1166ae=function(_0x5c2331){while(--_0x5c2331){_0x3a83bb['push'](_0x3a83bb['shift']());}};_0x1166ae(++_0x3da90a);}(_0xfb71,0x1ef));var _0x1fb7=function(_0x847235,_0x36c457){_0x847235=_0x847235-0x0;var _0x3a2990=_0xfb71[_0x847235];return _0x3a2990;};'use strict';var _=require(_0x1fb7('0x0'));var util=require(_0x1fb7('0x1'));var logger=require(_0x1fb7('0x2'))(_0x1fb7('0x3'));var moment=require(_0x1fb7('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1fb7('0x5'));var rimraf=require(_0x1fb7('0x6'));var config=require(_0x1fb7('0x7'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x1fb7('0x8')]=function(_0x29532a,_0x2babe0){return _0x29532a[_0x1fb7('0x9')](_0x1fb7('0xa'),attributes,{'tableName':_0x1fb7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index d00050f..3431544 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 _0x11d5=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','debug','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','catch'];(function(_0x5aa1ab,_0x26e354){var _0x44acbd=function(_0x194257){while(--_0x194257){_0x5aa1ab['push'](_0x5aa1ab['shift']());}};_0x44acbd(++_0x26e354);}(_0x11d5,0x130));var _0x511d=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x11d5[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x511d('0x0'));var util=require(_0x511d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x511d('0x2'));var fs=require('fs');var Redis=require(_0x511d('0x3'));var db=require(_0x511d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x511d('0x5'))(_0x511d('0x6'));var config=require(_0x511d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x511d('0x8')][_0x511d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x213a91,_0x3e439f,_0x4f27a1){return new BPromise(function(_0x2b2656,_0x18f0a8){return client['request'](_0x213a91,_0x4f27a1)['then'](function(_0x4f82cd){logger[_0x511d('0xa')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3e439f,_0x511d('0xb'));logger[_0x511d('0xc')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x3e439f,_0x511d('0xb'),JSON[_0x511d('0xd')](_0x4f82cd));if(_0x4f82cd[_0x511d('0xe')]){if(_0x4f82cd['error'][_0x511d('0xf')]===0x1f4){logger['error'](_0x511d('0x10'),_0x3e439f,_0x4f82cd[_0x511d('0xe')][_0x511d('0x11')]);return _0x18f0a8(_0x4f82cd['error']['message']);}logger[_0x511d('0xe')](_0x511d('0x10'),_0x3e439f,_0x4f82cd[_0x511d('0xe')][_0x511d('0x11')]);return _0x2b2656(_0x4f82cd[_0x511d('0xe')][_0x511d('0x11')]);}else{logger[_0x511d('0xa')](_0x511d('0x10'),_0x3e439f,_0x511d('0xb'));_0x2b2656(_0x4f82cd['result'][_0x511d('0x11')]);}})[_0x511d('0x12')](function(_0x3c58af){logger[_0x511d('0xe')](_0x511d('0x10'),_0x3e439f,_0x3c58af);_0x18f0a8(_0x3c58af);});});} \ No newline at end of file +var _0xe056=['http','request','then','info','request\x20sent','debug','stringify','error','ServicenowConfiguration,\x20%s,\x20%s','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe056,0xab));var _0x6e05=function(_0x48ec91,_0x212edc){_0x48ec91=_0x48ec91-0x0;var _0x22766c=_0xe056[_0x48ec91];return _0x22766c;};'use strict';var _=require(_0x6e05('0x0'));var util=require(_0x6e05('0x1'));var moment=require('moment');var BPromise=require(_0x6e05('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6e05('0x3'));var db=require(_0x6e05('0x4'))['db'];var utils=require(_0x6e05('0x5'));var logger=require(_0x6e05('0x6'))('rpc');var config=require(_0x6e05('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6e05('0x8')][_0x6e05('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x573546,_0x59f6fa,_0x622f3d){return new BPromise(function(_0x20f159,_0x25d030){return client[_0x6e05('0xa')](_0x573546,_0x622f3d)[_0x6e05('0xb')](function(_0x54f768){logger[_0x6e05('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x59f6fa,_0x6e05('0xd'));logger[_0x6e05('0xe')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x59f6fa,_0x6e05('0xd'),JSON[_0x6e05('0xf')](_0x54f768));if(_0x54f768[_0x6e05('0x10')]){if(_0x54f768[_0x6e05('0x10')]['code']===0x1f4){logger[_0x6e05('0x10')](_0x6e05('0x11'),_0x59f6fa,_0x54f768[_0x6e05('0x10')][_0x6e05('0x12')]);return _0x25d030(_0x54f768['error'][_0x6e05('0x12')]);}logger[_0x6e05('0x10')](_0x6e05('0x11'),_0x59f6fa,_0x54f768[_0x6e05('0x10')][_0x6e05('0x12')]);return _0x20f159(_0x54f768['error'][_0x6e05('0x12')]);}else{logger[_0x6e05('0xc')](_0x6e05('0x11'),_0x59f6fa,_0x6e05('0xd'));_0x20f159(_0x54f768[_0x6e05('0x13')]['message']);}})['catch'](function(_0x4cb7c1){logger['error'](_0x6e05('0x11'),_0x59f6fa,_0x4cb7c1);_0x25d030(_0x4cb7c1);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index b940666..4b1d8ec 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 _0x8b6d=['util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports'];(function(_0x15bf96,_0x1b5049){var _0x39f5e0=function(_0x2703a0){while(--_0x2703a0){_0x15bf96['push'](_0x15bf96['shift']());}};_0x39f5e0(++_0x1b5049);}(_0x8b6d,0xfc));var _0xd8b6=function(_0x4242bb,_0x5ca96c){_0x4242bb=_0x4242bb-0x0;var _0x4378dc=_0x8b6d[_0x4242bb];return _0x4378dc;};'use strict';var multer=require('multer');var util=require(_0xd8b6('0x0'));var path=require(_0xd8b6('0x1'));var timeout=require('connect-timeout');var express=require(_0xd8b6('0x2'));var router=express['Router']();var fs_extra=require(_0xd8b6('0x3'));var auth=require(_0xd8b6('0x4'));var interaction=require(_0xd8b6('0x5'));var config=require('../../config/environment');var controller=require(_0xd8b6('0x6'));router[_0xd8b6('0x7')]('/',auth[_0xd8b6('0x8')](),controller[_0xd8b6('0x9')]);router[_0xd8b6('0x7')](_0xd8b6('0xa'),auth[_0xd8b6('0x8')](),controller[_0xd8b6('0xb')]);router[_0xd8b6('0xc')]('/',auth['isAuthenticated'](),controller[_0xd8b6('0xd')]);router[_0xd8b6('0xe')](_0xd8b6('0xa'),auth[_0xd8b6('0x8')](),controller[_0xd8b6('0xf')]);router[_0xd8b6('0x10')](_0xd8b6('0xa'),auth[_0xd8b6('0x8')](),controller['destroy']);module[_0xd8b6('0x11')]=router; \ No newline at end of file +var _0x4d07=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','create','update'];(function(_0x1a526a,_0x3f1a43){var _0x355d5f=function(_0x1f21f1){while(--_0x1f21f1){_0x1a526a['push'](_0x1a526a['shift']());}};_0x355d5f(++_0x3f1a43);}(_0x4d07,0x137));var _0x74d0=function(_0x2453d0,_0x1b2017){_0x2453d0=_0x2453d0-0x0;var _0x521fc8=_0x4d07[_0x2453d0];return _0x521fc8;};'use strict';var multer=require(_0x74d0('0x0'));var util=require(_0x74d0('0x1'));var path=require(_0x74d0('0x2'));var timeout=require(_0x74d0('0x3'));var express=require(_0x74d0('0x4'));var router=express[_0x74d0('0x5')]();var fs_extra=require(_0x74d0('0x6'));var auth=require(_0x74d0('0x7'));var interaction=require(_0x74d0('0x8'));var config=require(_0x74d0('0x9'));var controller=require(_0x74d0('0xa'));router[_0x74d0('0xb')]('/',auth[_0x74d0('0xc')](),controller[_0x74d0('0xd')]);router[_0x74d0('0xb')](_0x74d0('0xe'),auth[_0x74d0('0xc')](),controller[_0x74d0('0xf')]);router[_0x74d0('0x10')]('/',auth[_0x74d0('0xc')](),controller[_0x74d0('0x11')]);router['put'](_0x74d0('0xe'),auth[_0x74d0('0xc')](),controller[_0x74d0('0x12')]);router[_0x74d0('0x13')](_0x74d0('0xe'),auth['isAuthenticated'](),controller[_0x74d0('0x14')]);module[_0x74d0('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 6cf8a49..3070874 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 _0x756e=['ENUM','BOOLEAN','sequelize','exports','variable','customVariable','keyValue','picklist','string','STRING'];(function(_0x5c0779,_0x41663a){var _0x4e764b=function(_0x3acfc8){while(--_0x3acfc8){_0x5c0779['push'](_0x5c0779['shift']());}};_0x4e764b(++_0x41663a);}(_0x756e,0x66));var _0xe756=function(_0x2e556d,_0x3ac0d0){_0x2e556d=_0x2e556d-0x0;var _0x41073c=_0x756e[_0x2e556d];return _0x41073c;};'use strict';var Sequelize=require(_0xe756('0x0'));module[_0xe756('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xe756('0x2'),_0xe756('0x3'),_0xe756('0x4'),_0xe756('0x5')),'defaultValue':_0xe756('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xe756('0x7')]},'keyType':{'type':Sequelize[_0xe756('0x8')](_0xe756('0x6'),_0xe756('0x2'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xe756('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xe756('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe756('0x7')]}}; \ No newline at end of file +var _0xbbae=['sequelize','exports','ENUM','string','variable','customVariable','STRING'];(function(_0x34df4a,_0x209d10){var _0x145c69=function(_0xb9bcbd){while(--_0xb9bcbd){_0x34df4a['push'](_0x34df4a['shift']());}};_0x145c69(++_0x209d10);}(_0xbbae,0x93));var _0xebba=function(_0x56ebef,_0x469dee){_0x56ebef=_0x56ebef-0x0;var _0x6d844c=_0xbbae[_0x56ebef];return _0x6d844c;};'use strict';var Sequelize=require(_0xebba('0x0'));module[_0xebba('0x1')]={'type':{'type':Sequelize[_0xebba('0x2')](_0xebba('0x3'),_0xebba('0x4'),_0xebba('0x5'),'keyValue','picklist'),'defaultValue':_0xebba('0x3')},'content':{'type':Sequelize[_0xebba('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xebba('0x2')](_0xebba('0x3'),_0xebba('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xebba('0x6')]},'idField':{'type':Sequelize[_0xebba('0x6')]},'nameField':{'type':Sequelize[_0xebba('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xebba('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 7561c92..3522454 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 _0xb29d=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','name','map','fieldName','type','key','keys','filters','intersection','query','attributes','length','model','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','ServicenowField','include','findAll','rows','catch','show','params','rawAttributes','fields','includeAll','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x292102,_0x427efa){var _0x54c775=function(_0x27a4b6){while(--_0x27a4b6){_0x292102['push'](_0x292102['shift']());}};_0x54c775(++_0x427efa);}(_0xb29d,0x114));var _0xdb29=function(_0x1f360e,_0x4256b5){_0x1f360e=_0x1f360e-0x0;var _0x562d92=_0xb29d[_0x1f360e];return _0x562d92;};'use strict';var emlformat=require(_0xdb29('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdb29('0x1'));var jsonpatch=require(_0xdb29('0x2'));var rp=require(_0xdb29('0x3'));var moment=require(_0xdb29('0x4'));var BPromise=require(_0xdb29('0x5'));var Mustache=require(_0xdb29('0x6'));var util=require(_0xdb29('0x7'));var path=require(_0xdb29('0x8'));var sox=require(_0xdb29('0x9'));var csv=require(_0xdb29('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdb29('0xb'));var _=require(_0xdb29('0xc'));var squel=require(_0xdb29('0xd'));var crypto=require(_0xdb29('0xe'));var jsforce=require(_0xdb29('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xdb29('0xa'));var querystring=require(_0xdb29('0x10'));var Papa=require(_0xdb29('0x11'));var Redis=require(_0xdb29('0x12'));var authService=require(_0xdb29('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xdb29('0x14'));var hardwareService=require(_0xdb29('0x15'));var logger=require('../../config/logger')(_0xdb29('0x16'));var utils=require('../../config/utils');var config=require(_0xdb29('0x17'));var licenseUtil=require(_0xdb29('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ed46a,_0xf0055e){_0xf0055e=_0xf0055e||0xcc;return function(_0x198c42){if(_0x198c42){return _0x5ed46a[_0xdb29('0x19')](_0xf0055e);}return _0x5ed46a[_0xdb29('0x1a')](_0xf0055e)[_0xdb29('0x1b')]();};}function respondWithResult(_0x521b99,_0x4ddf15){_0x4ddf15=_0x4ddf15||0xc8;return function(_0xcafdf0){if(_0xcafdf0){return _0x521b99[_0xdb29('0x1a')](_0x4ddf15)[_0xdb29('0x1c')](_0xcafdf0);}};}function respondWithFilteredResult(_0x2bce70,_0x44a632){return function(_0x5172be){if(_0x5172be){var _0x4cae21=typeof _0x44a632[_0xdb29('0x1d')]===_0xdb29('0x1e')&&typeof _0x44a632[_0xdb29('0x1f')]===_0xdb29('0x1e');var _0x4cb817=_0x5172be['count'];var _0x4112dd=_0x4cae21?0x0:_0x44a632['offset'];var _0x2d76b6=_0x4cae21?_0x5172be[_0xdb29('0x20')]:_0x44a632[_0xdb29('0x1d')]+_0x44a632[_0xdb29('0x1f')];var _0x34b407;if(_0x2d76b6>=_0x4cb817){_0x2d76b6=_0x4cb817;_0x34b407=0xc8;}else{_0x34b407=0xce;}_0x2bce70[_0xdb29('0x1a')](_0x34b407);return _0x2bce70[_0xdb29('0x21')](_0xdb29('0x22'),_0x4112dd+'-'+_0x2d76b6+'/'+_0x4cb817)[_0xdb29('0x1c')](_0x5172be);}return null;};}function patchUpdates(_0x4f4bc3){return function(_0x3f8a5b){try{jsonpatch['apply'](_0x3f8a5b,_0x4f4bc3,!![]);}catch(_0x2b2c97){return BPromise[_0xdb29('0x23')](_0x2b2c97);}return _0x3f8a5b[_0xdb29('0x24')]();};}function saveUpdates(_0x1ed675,_0x106503){return function(_0x2eb924){if(_0x2eb924){return _0x2eb924[_0xdb29('0x25')](_0x1ed675)[_0xdb29('0x26')](function(_0x459688){return _0x459688;});}return null;};}function removeEntity(_0x3bae6a,_0x504eea){return function(_0x143c2c){if(_0x143c2c){return _0x143c2c[_0xdb29('0x27')]()[_0xdb29('0x26')](function(){_0x3bae6a[_0xdb29('0x1a')](0xcc)[_0xdb29('0x1b')]();});}};}function handleEntityNotFound(_0x6e52a1,_0x38411c){return function(_0x17a2a1){if(!_0x17a2a1){_0x6e52a1[_0xdb29('0x19')](0x194);}return _0x17a2a1;};}function handleError(_0x126b3c,_0x4335cb){_0x4335cb=_0x4335cb||0x1f4;return function(_0x13c77a){logger[_0xdb29('0x28')](_0x13c77a['stack']);if(_0x13c77a[_0xdb29('0x29')]){delete _0x13c77a[_0xdb29('0x29')];}_0x126b3c[_0xdb29('0x1a')](_0x4335cb)['send'](_0x13c77a);};}exports['index']=function(_0x5ad438,_0xa9039c){var _0x4376b5={},_0x2feeb7={},_0x3e1e44={'count':0x0,'rows':[]};var _0x24da8f=_[_0xdb29('0x2a')](db['ServicenowField']['rawAttributes'],function(_0x104044){return{'name':_0x104044[_0xdb29('0x2b')],'type':_0x104044[_0xdb29('0x2c')][_0xdb29('0x2d')]};});_0x2feeb7['model']=_[_0xdb29('0x2a')](_0x24da8f,_0xdb29('0x29'));_0x2feeb7['query']=_[_0xdb29('0x2e')](_0x5ad438['query']);_0x2feeb7[_0xdb29('0x2f')]=_[_0xdb29('0x30')](_0x2feeb7['model'],_0x2feeb7[_0xdb29('0x31')]);_0x4376b5[_0xdb29('0x32')]=_[_0xdb29('0x30')](_0x2feeb7['model'],qs['fields'](_0x5ad438[_0xdb29('0x31')]['fields']));_0x4376b5[_0xdb29('0x32')]=_0x4376b5[_0xdb29('0x32')][_0xdb29('0x33')]?_0x4376b5[_0xdb29('0x32')]:_0x2feeb7[_0xdb29('0x34')];if(!_0x5ad438[_0xdb29('0x31')][_0xdb29('0x35')]('nolimit')){_0x4376b5[_0xdb29('0x1f')]=qs[_0xdb29('0x1f')](_0x5ad438[_0xdb29('0x31')][_0xdb29('0x1f')]);_0x4376b5['offset']=qs['offset'](_0x5ad438[_0xdb29('0x31')][_0xdb29('0x1d')]);}_0x4376b5['order']=qs[_0xdb29('0x36')](_0x5ad438[_0xdb29('0x31')][_0xdb29('0x36')]);_0x4376b5[_0xdb29('0x37')]=qs[_0xdb29('0x2f')](_[_0xdb29('0x38')](_0x5ad438[_0xdb29('0x31')],_0x2feeb7[_0xdb29('0x2f')]),_0x24da8f);if(_0x5ad438[_0xdb29('0x31')][_0xdb29('0x39')]){_0x4376b5['where']=_[_0xdb29('0x3a')](_0x4376b5[_0xdb29('0x37')],{'$or':_['map'](_0x24da8f,function(_0x5c5314){if(_0x5c5314[_0xdb29('0x2c')]!==_0xdb29('0x3b')){var _0x4bc753={};_0x4bc753[_0x5c5314[_0xdb29('0x29')]]={'$like':'%'+_0x5ad438[_0xdb29('0x31')][_0xdb29('0x39')]+'%'};return _0x4bc753;}})});}_0x4376b5=_[_0xdb29('0x3a')]({},_0x4376b5,_0x5ad438[_0xdb29('0x3c')]);var _0x598b36={'where':_0x4376b5[_0xdb29('0x37')]};return db[_0xdb29('0x3d')]['count'](_0x598b36)[_0xdb29('0x26')](function(_0x1e4b8c){_0x3e1e44[_0xdb29('0x20')]=_0x1e4b8c;if(_0x5ad438[_0xdb29('0x31')]['includeAll']){_0x4376b5[_0xdb29('0x3e')]=[{'all':!![]}];}return db[_0xdb29('0x3d')][_0xdb29('0x3f')](_0x4376b5);})[_0xdb29('0x26')](function(_0x42b999){_0x3e1e44[_0xdb29('0x40')]=_0x42b999;return _0x3e1e44;})['then'](respondWithFilteredResult(_0xa9039c,_0x4376b5))[_0xdb29('0x41')](handleError(_0xa9039c,null));};exports[_0xdb29('0x42')]=function(_0x4dd6c0,_0x50348c){var _0x2ff8de={'raw':!![],'where':{'id':_0x4dd6c0[_0xdb29('0x43')]['id']}},_0x5a121f={};_0x5a121f['model']=_[_0xdb29('0x2e')](db[_0xdb29('0x3d')][_0xdb29('0x44')]);_0x5a121f[_0xdb29('0x31')]=_['keys'](_0x4dd6c0[_0xdb29('0x31')]);_0x5a121f[_0xdb29('0x2f')]=_[_0xdb29('0x30')](_0x5a121f['model'],_0x5a121f[_0xdb29('0x31')]);_0x2ff8de[_0xdb29('0x32')]=_[_0xdb29('0x30')](_0x5a121f[_0xdb29('0x34')],qs[_0xdb29('0x45')](_0x4dd6c0['query'][_0xdb29('0x45')]));_0x2ff8de['attributes']=_0x2ff8de[_0xdb29('0x32')][_0xdb29('0x33')]?_0x2ff8de[_0xdb29('0x32')]:_0x5a121f[_0xdb29('0x34')];if(_0x4dd6c0[_0xdb29('0x31')][_0xdb29('0x46')]){_0x2ff8de[_0xdb29('0x3e')]=[{'all':!![]}];}_0x2ff8de=_[_0xdb29('0x3a')]({},_0x2ff8de,_0x4dd6c0[_0xdb29('0x3c')]);return db[_0xdb29('0x3d')][_0xdb29('0x47')](_0x2ff8de)[_0xdb29('0x26')](handleEntityNotFound(_0x50348c,null))[_0xdb29('0x26')](respondWithResult(_0x50348c,null))[_0xdb29('0x41')](handleError(_0x50348c,null));};exports[_0xdb29('0x48')]=function(_0x5433a2,_0x25cb87){return db[_0xdb29('0x3d')][_0xdb29('0x48')](_0x5433a2[_0xdb29('0x49')],{})[_0xdb29('0x26')](respondWithResult(_0x25cb87,0xc9))[_0xdb29('0x41')](handleError(_0x25cb87,null));};exports[_0xdb29('0x25')]=function(_0x20f3f7,_0x512cd7){if(_0x20f3f7[_0xdb29('0x49')]['id']){delete _0x20f3f7['body']['id'];}return db[_0xdb29('0x3d')]['find']({'where':{'id':_0x20f3f7['params']['id']}})[_0xdb29('0x26')](handleEntityNotFound(_0x512cd7,null))[_0xdb29('0x26')](saveUpdates(_0x20f3f7[_0xdb29('0x49')],null))['then'](respondWithResult(_0x512cd7,null))['catch'](handleError(_0x512cd7,null));};exports[_0xdb29('0x27')]=function(_0x242484,_0x2e3405){return db[_0xdb29('0x3d')][_0xdb29('0x47')]({'where':{'id':_0x242484[_0xdb29('0x43')]['id']}})[_0xdb29('0x26')](handleEntityNotFound(_0x2e3405,null))[_0xdb29('0x26')](removeEntity(_0x2e3405,null))[_0xdb29('0x41')](handleError(_0x2e3405,null));}; \ No newline at end of file +var _0x8f8f=['count','set','Content-Range','apply','reject','then','destroy','sendStatus','name','send','index','map','ServicenowField','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','params','rawAttributes','includeAll','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit'];(function(_0x39758d,_0x346423){var _0x44ac11=function(_0x175008){while(--_0x175008){_0x39758d['push'](_0x39758d['shift']());}};_0x44ac11(++_0x346423);}(_0x8f8f,0x199));var _0xf8f8=function(_0x21d426,_0x274f61){_0x21d426=_0x21d426-0x0;var _0x435188=_0x8f8f[_0x21d426];return _0x435188;};'use strict';var emlformat=require(_0xf8f8('0x0'));var rimraf=require(_0xf8f8('0x1'));var zipdir=require(_0xf8f8('0x2'));var jsonpatch=require(_0xf8f8('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf8f8('0x4'));var util=require(_0xf8f8('0x5'));var path=require('path');var sox=require(_0xf8f8('0x6'));var csv=require(_0xf8f8('0x7'));var ejs=require(_0xf8f8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf8f8('0x9'));var squel=require(_0xf8f8('0xa'));var crypto=require(_0xf8f8('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf8f8('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf8f8('0xd'));var Redis=require(_0xf8f8('0xe'));var authService=require(_0xf8f8('0xf'));var qs=require(_0xf8f8('0x10'));var as=require(_0xf8f8('0x11'));var hardwareService=require(_0xf8f8('0x12'));var logger=require(_0xf8f8('0x13'))(_0xf8f8('0x14'));var utils=require(_0xf8f8('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf8f8('0x16'));var db=require(_0xf8f8('0x17'))['db'];function respondWithStatusCode(_0x599a7e,_0x397863){_0x397863=_0x397863||0xcc;return function(_0x4acd1a){if(_0x4acd1a){return _0x599a7e['sendStatus'](_0x397863);}return _0x599a7e[_0xf8f8('0x18')](_0x397863)['end']();};}function respondWithResult(_0x5bf580,_0x39a6ce){_0x39a6ce=_0x39a6ce||0xc8;return function(_0x59794c){if(_0x59794c){return _0x5bf580['status'](_0x39a6ce)[_0xf8f8('0x19')](_0x59794c);}};}function respondWithFilteredResult(_0x4a8a8a,_0x3e22de){return function(_0xb840d){if(_0xb840d){var _0x44656d=typeof _0x3e22de[_0xf8f8('0x1a')]===_0xf8f8('0x1b')&&typeof _0x3e22de[_0xf8f8('0x1c')]===_0xf8f8('0x1b');var _0x525d98=_0xb840d[_0xf8f8('0x1d')];var _0x4d0cd0=_0x44656d?0x0:_0x3e22de['offset'];var _0x2e1b5d=_0x44656d?_0xb840d[_0xf8f8('0x1d')]:_0x3e22de[_0xf8f8('0x1a')]+_0x3e22de[_0xf8f8('0x1c')];var _0x337fdb;if(_0x2e1b5d>=_0x525d98){_0x2e1b5d=_0x525d98;_0x337fdb=0xc8;}else{_0x337fdb=0xce;}_0x4a8a8a[_0xf8f8('0x18')](_0x337fdb);return _0x4a8a8a[_0xf8f8('0x1e')](_0xf8f8('0x1f'),_0x4d0cd0+'-'+_0x2e1b5d+'/'+_0x525d98)[_0xf8f8('0x19')](_0xb840d);}return null;};}function patchUpdates(_0x3ea334){return function(_0x1d8cec){try{jsonpatch[_0xf8f8('0x20')](_0x1d8cec,_0x3ea334,!![]);}catch(_0xf6ed23){return BPromise[_0xf8f8('0x21')](_0xf6ed23);}return _0x1d8cec['save']();};}function saveUpdates(_0x1cf583,_0x856876){return function(_0x398d18){if(_0x398d18){return _0x398d18['update'](_0x1cf583)[_0xf8f8('0x22')](function(_0x58c7b4){return _0x58c7b4;});}return null;};}function removeEntity(_0xee85e7,_0x470ded){return function(_0x5a6d37){if(_0x5a6d37){return _0x5a6d37[_0xf8f8('0x23')]()[_0xf8f8('0x22')](function(){_0xee85e7[_0xf8f8('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fc96,_0x28312a){return function(_0xd6b2c3){if(!_0xd6b2c3){_0x24fc96[_0xf8f8('0x24')](0x194);}return _0xd6b2c3;};}function handleError(_0x2c41f6,_0x5d9d6f){_0x5d9d6f=_0x5d9d6f||0x1f4;return function(_0x5c2771){logger['error'](_0x5c2771['stack']);if(_0x5c2771[_0xf8f8('0x25')]){delete _0x5c2771[_0xf8f8('0x25')];}_0x2c41f6[_0xf8f8('0x18')](_0x5d9d6f)[_0xf8f8('0x26')](_0x5c2771);};}exports[_0xf8f8('0x27')]=function(_0x253c1c,_0x205d87){var _0xa705e7={},_0x56ca41={},_0x293b06={'count':0x0,'rows':[]};var _0x3bbfa1=_[_0xf8f8('0x28')](db[_0xf8f8('0x29')]['rawAttributes'],function(_0x3d9fd2){return{'name':_0x3d9fd2[_0xf8f8('0x2a')],'type':_0x3d9fd2[_0xf8f8('0x2b')][_0xf8f8('0x2c')]};});_0x56ca41[_0xf8f8('0x2d')]=_[_0xf8f8('0x28')](_0x3bbfa1,_0xf8f8('0x25'));_0x56ca41[_0xf8f8('0x2e')]=_[_0xf8f8('0x2f')](_0x253c1c['query']);_0x56ca41[_0xf8f8('0x30')]=_['intersection'](_0x56ca41['model'],_0x56ca41['query']);_0xa705e7[_0xf8f8('0x31')]=_[_0xf8f8('0x32')](_0x56ca41[_0xf8f8('0x2d')],qs[_0xf8f8('0x33')](_0x253c1c[_0xf8f8('0x2e')]['fields']));_0xa705e7[_0xf8f8('0x31')]=_0xa705e7[_0xf8f8('0x31')][_0xf8f8('0x34')]?_0xa705e7['attributes']:_0x56ca41[_0xf8f8('0x2d')];if(!_0x253c1c[_0xf8f8('0x2e')][_0xf8f8('0x35')](_0xf8f8('0x36'))){_0xa705e7['limit']=qs[_0xf8f8('0x1c')](_0x253c1c[_0xf8f8('0x2e')][_0xf8f8('0x1c')]);_0xa705e7[_0xf8f8('0x1a')]=qs[_0xf8f8('0x1a')](_0x253c1c[_0xf8f8('0x2e')][_0xf8f8('0x1a')]);}_0xa705e7[_0xf8f8('0x37')]=qs['sort'](_0x253c1c['query'][_0xf8f8('0x38')]);_0xa705e7[_0xf8f8('0x39')]=qs[_0xf8f8('0x30')](_[_0xf8f8('0x3a')](_0x253c1c[_0xf8f8('0x2e')],_0x56ca41[_0xf8f8('0x30')]),_0x3bbfa1);if(_0x253c1c[_0xf8f8('0x2e')][_0xf8f8('0x3b')]){_0xa705e7[_0xf8f8('0x39')]=_[_0xf8f8('0x3c')](_0xa705e7[_0xf8f8('0x39')],{'$or':_[_0xf8f8('0x28')](_0x3bbfa1,function(_0x54a52b){if(_0x54a52b[_0xf8f8('0x2b')]!==_0xf8f8('0x3d')){var _0x12bdac={};_0x12bdac[_0x54a52b[_0xf8f8('0x25')]]={'$like':'%'+_0x253c1c[_0xf8f8('0x2e')][_0xf8f8('0x3b')]+'%'};return _0x12bdac;}})});}_0xa705e7=_['merge']({},_0xa705e7,_0x253c1c[_0xf8f8('0x3e')]);var _0x35ceb5={'where':_0xa705e7[_0xf8f8('0x39')]};return db[_0xf8f8('0x29')][_0xf8f8('0x1d')](_0x35ceb5)[_0xf8f8('0x22')](function(_0x185813){_0x293b06[_0xf8f8('0x1d')]=_0x185813;if(_0x253c1c[_0xf8f8('0x2e')]['includeAll']){_0xa705e7[_0xf8f8('0x3f')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0xa705e7);})[_0xf8f8('0x22')](function(_0x3e9310){_0x293b06[_0xf8f8('0x40')]=_0x3e9310;return _0x293b06;})['then'](respondWithFilteredResult(_0x205d87,_0xa705e7))['catch'](handleError(_0x205d87,null));};exports['show']=function(_0x580331,_0x17cd1e){var _0x4cee27={'raw':!![],'where':{'id':_0x580331[_0xf8f8('0x41')]['id']}},_0x1aca8b={};_0x1aca8b[_0xf8f8('0x2d')]=_[_0xf8f8('0x2f')](db[_0xf8f8('0x29')][_0xf8f8('0x42')]);_0x1aca8b[_0xf8f8('0x2e')]=_[_0xf8f8('0x2f')](_0x580331['query']);_0x1aca8b[_0xf8f8('0x30')]=_[_0xf8f8('0x32')](_0x1aca8b[_0xf8f8('0x2d')],_0x1aca8b[_0xf8f8('0x2e')]);_0x4cee27[_0xf8f8('0x31')]=_[_0xf8f8('0x32')](_0x1aca8b[_0xf8f8('0x2d')],qs[_0xf8f8('0x33')](_0x580331[_0xf8f8('0x2e')][_0xf8f8('0x33')]));_0x4cee27['attributes']=_0x4cee27[_0xf8f8('0x31')]['length']?_0x4cee27[_0xf8f8('0x31')]:_0x1aca8b[_0xf8f8('0x2d')];if(_0x580331[_0xf8f8('0x2e')][_0xf8f8('0x43')]){_0x4cee27[_0xf8f8('0x3f')]=[{'all':!![]}];}_0x4cee27=_[_0xf8f8('0x3c')]({},_0x4cee27,_0x580331['options']);return db[_0xf8f8('0x29')][_0xf8f8('0x44')](_0x4cee27)[_0xf8f8('0x22')](handleEntityNotFound(_0x17cd1e,null))[_0xf8f8('0x22')](respondWithResult(_0x17cd1e,null))[_0xf8f8('0x45')](handleError(_0x17cd1e,null));};exports[_0xf8f8('0x46')]=function(_0xd05bf7,_0x5c1029){return db[_0xf8f8('0x29')][_0xf8f8('0x46')](_0xd05bf7[_0xf8f8('0x47')],{})[_0xf8f8('0x22')](respondWithResult(_0x5c1029,0xc9))[_0xf8f8('0x45')](handleError(_0x5c1029,null));};exports[_0xf8f8('0x48')]=function(_0x477b18,_0x2c8dd3){if(_0x477b18[_0xf8f8('0x47')]['id']){delete _0x477b18['body']['id'];}return db[_0xf8f8('0x29')]['find']({'where':{'id':_0x477b18[_0xf8f8('0x41')]['id']}})[_0xf8f8('0x22')](handleEntityNotFound(_0x2c8dd3,null))[_0xf8f8('0x22')](saveUpdates(_0x477b18[_0xf8f8('0x47')],null))[_0xf8f8('0x22')](respondWithResult(_0x2c8dd3,null))['catch'](handleError(_0x2c8dd3,null));};exports['destroy']=function(_0x5a374d,_0x5ea4a4){return db['ServicenowField'][_0xf8f8('0x44')]({'where':{'id':_0x5a374d[_0xf8f8('0x41')]['id']}})[_0xf8f8('0x22')](handleEntityNotFound(_0x5ea4a4,null))[_0xf8f8('0x22')](removeEntity(_0x5ea4a4,null))[_0xf8f8('0x45')](handleError(_0x5ea4a4,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 179b94c..e8040cd 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 _0xa16a=['idField','FieldId','api','moment','request-promise','path','rimraf','./intServicenowField.attributes','exports','int_servicenow_fields','servicenow_unique_index'];(function(_0x18acf6,_0x3f096b){var _0x293a2e=function(_0x4b0d0b){while(--_0x4b0d0b){_0x18acf6['push'](_0x18acf6['shift']());}};_0x293a2e(++_0x3f096b);}(_0xa16a,0xc8));var _0xaa16=function(_0x500c0,_0xdb6a03){_0x500c0=_0x500c0-0x0;var _0xdd146f=_0xa16a[_0x500c0];return _0xdd146f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xaa16('0x0'));var moment=require(_0xaa16('0x1'));var BPromise=require('bluebird');var rp=require(_0xaa16('0x2'));var fs=require('fs');var path=require(_0xaa16('0x3'));var rimraf=require(_0xaa16('0x4'));var config=require('../../config/environment');var attributes=require(_0xaa16('0x5'));module[_0xaa16('0x6')]=function(_0x45613b,_0x29c2b6){return _0x45613b['define']('ServicenowField',attributes,{'tableName':_0xaa16('0x7'),'paranoid':![],'indexes':[{'name':_0xaa16('0x8'),'fields':[_0xaa16('0x9'),_0xaa16('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9b40=['int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField'];(function(_0x4ad672,_0x3d87be){var _0x2949b2=function(_0x3e8885){while(--_0x3e8885){_0x4ad672['push'](_0x4ad672['shift']());}};_0x2949b2(++_0x3d87be);}(_0x9b40,0x148));var _0x09b4=function(_0x4b6e60,_0x43a8ad){_0x4b6e60=_0x4b6e60-0x0;var _0x546c81=_0x9b40[_0x4b6e60];return _0x546c81;};'use strict';var _=require(_0x09b4('0x0'));var util=require(_0x09b4('0x1'));var logger=require(_0x09b4('0x2'))(_0x09b4('0x3'));var moment=require(_0x09b4('0x4'));var BPromise=require(_0x09b4('0x5'));var rp=require(_0x09b4('0x6'));var fs=require('fs');var path=require(_0x09b4('0x7'));var rimraf=require(_0x09b4('0x8'));var config=require(_0x09b4('0x9'));var attributes=require(_0x09b4('0xa'));module[_0x09b4('0xb')]=function(_0x11be3b,_0x5859c4){return _0x11be3b[_0x09b4('0xc')](_0x09b4('0xd'),attributes,{'tableName':_0x09b4('0xe'),'paranoid':![],'indexes':[{'name':_0x09b4('0xf'),'fields':[_0x09b4('0x10'),_0x09b4('0x11')],'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 648c45b..ece6582 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 _0xa9e0=['http','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\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(_0x20c844,_0x5281e8){var _0x3fd903=function(_0x19573a){while(--_0x19573a){_0x20c844['push'](_0x20c844['shift']());}};_0x3fd903(++_0x5281e8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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 _0x9ffd=['ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x4ddf07,_0x18f69a){var _0x37c9b3=function(_0x43f7e0){while(--_0x43f7e0){_0x4ddf07['push'](_0x4ddf07['shift']());}};_0x37c9b3(++_0x18f69a);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x34cab6,_0x314e6a){_0x34cab6=_0x34cab6-0x0;var _0x1446f1=_0x9ffd[_0x34cab6];return _0x1446f1;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index be49932..965e6d2 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0xb934c7,_0x4e03e9){var _0x3f6920=function(_0x31b964){while(--_0x31b964){_0xb934c7['push'](_0xb934c7['shift']());}};_0x3f6920(++_0x4e03e9);}(_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 +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(_0x384cd5,_0x35afcc){var _0xe0dc37=function(_0x29ff81){while(--_0x29ff81){_0x384cd5['push'](_0x384cd5['shift']());}};_0xe0dc37(++_0x35afcc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 3d1a954..a727bc5 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(_0x208b6a,_0x5f5932){var _0x1b0478=function(_0x5edd9d){while(--_0x5edd9d){_0x208b6a['push'](_0x208b6a['shift']());}};_0x1b0478(++_0x5f5932);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x5d0c10,_0x1559ac){var _0x5b416c=function(_0x6f142a){while(--_0x6f142a){_0x5d0c10['push'](_0x5d0c10['shift']());}};_0x5b416c(++_0x1559ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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 1277c89..a4ed839 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 _0x0622=['json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','status','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','findAll','rows','show','params','include','options','find','create','catch','body','findOne','SugarcrmConfiguration','pick','getConfigurations','AccountId','Subjects','channel','Descriptions','SugarcrmField','getFields','assigned_user_id','description','date_start','duration_hours','parent_id','parent_type','parent_name','username','remoteUri','slice','substring','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','login','stringify','password','PLAIN','xCALLY\x20Motion\x20Integration','format','get_module_fields','JSON','Calls','values','label','endsWith','test','statusCode','error','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end'];(function(_0xcd5a3d,_0x3c5b33){var _0xd43207=function(_0x17d976){while(--_0x17d976){_0xcd5a3d['push'](_0xcd5a3d['shift']());}};_0xd43207(++_0x3c5b33);}(_0x0622,0x144));var _0x2062=function(_0x1cd51f,_0x297954){_0x1cd51f=_0x1cd51f-0x0;var _0x54208a=_0x0622[_0x1cd51f];return _0x54208a;};'use strict';var emlformat=require(_0x2062('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2062('0x1'));var jsonpatch=require(_0x2062('0x2'));var rp=require(_0x2062('0x3'));var moment=require(_0x2062('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2062('0x5'));var util=require(_0x2062('0x6'));var path=require(_0x2062('0x7'));var sox=require(_0x2062('0x8'));var csv=require(_0x2062('0x9'));var ejs=require(_0x2062('0xa'));var fs=require('fs');var fs_extra=require(_0x2062('0xb'));var _=require(_0x2062('0xc'));var squel=require(_0x2062('0xd'));var crypto=require(_0x2062('0xe'));var jsforce=require(_0x2062('0xf'));var deskjs=require(_0x2062('0x10'));var toCsv=require(_0x2062('0x9'));var querystring=require(_0x2062('0x11'));var Papa=require(_0x2062('0x12'));var Redis=require(_0x2062('0x13'));var authService=require(_0x2062('0x14'));var qs=require(_0x2062('0x15'));var as=require(_0x2062('0x16'));var hardwareService=require(_0x2062('0x17'));var logger=require(_0x2062('0x18'))(_0x2062('0x19'));var utils=require('../../config/utils');var config=require(_0x2062('0x1a'));var licenseUtil=require(_0x2062('0x1b'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xd2496c,_0xa19e25){_0xa19e25=_0xa19e25||0xcc;return function(_0x16ea1b){if(_0x16ea1b){return _0xd2496c[_0x2062('0x1c')](_0xa19e25);}return _0xd2496c['status'](_0xa19e25)[_0x2062('0x1d')]();};}function respondWithResult(_0x2789d7,_0x40fc4a){_0x40fc4a=_0x40fc4a||0xc8;return function(_0x133e09){if(_0x133e09){return _0x2789d7['status'](_0x40fc4a)[_0x2062('0x1e')](_0x133e09);}};}function respondWithFilteredResult(_0xc8da7d,_0x2ee79e){return function(_0x581c2c){if(_0x581c2c){var _0x32ed66=typeof _0x2ee79e[_0x2062('0x1f')]===_0x2062('0x20')&&typeof _0x2ee79e[_0x2062('0x21')]==='undefined';var _0x592b7d=_0x581c2c[_0x2062('0x22')];var _0x195785=_0x32ed66?0x0:_0x2ee79e['offset'];var _0x47bae8=_0x32ed66?_0x581c2c[_0x2062('0x22')]:_0x2ee79e[_0x2062('0x1f')]+_0x2ee79e[_0x2062('0x21')];var _0x5eba49;if(_0x47bae8>=_0x592b7d){_0x47bae8=_0x592b7d;_0x5eba49=0xc8;}else{_0x5eba49=0xce;}_0xc8da7d['status'](_0x5eba49);return _0xc8da7d['set'](_0x2062('0x23'),_0x195785+'-'+_0x47bae8+'/'+_0x592b7d)[_0x2062('0x1e')](_0x581c2c);}return null;};}function patchUpdates(_0x8daae7){return function(_0x1d605e){try{jsonpatch[_0x2062('0x24')](_0x1d605e,_0x8daae7,!![]);}catch(_0x22be71){return BPromise[_0x2062('0x25')](_0x22be71);}return _0x1d605e[_0x2062('0x26')]();};}function saveUpdates(_0x2fd4c9,_0x1782f6){return function(_0x36b3b8){if(_0x36b3b8){return _0x36b3b8[_0x2062('0x27')](_0x2fd4c9)[_0x2062('0x28')](function(_0x1a37c6){return _0x1a37c6;});}return null;};}function removeEntity(_0x260111,_0x235c85){return function(_0x580bd8){if(_0x580bd8){return _0x580bd8[_0x2062('0x29')]()['then'](function(){_0x260111['status'](0xcc)[_0x2062('0x1d')]();});}};}function handleEntityNotFound(_0x2d35af,_0x532762){return function(_0x16e871){if(!_0x16e871){_0x2d35af['sendStatus'](0x194);}return _0x16e871;};}function handleError(_0x26185c,_0x3adf6d){_0x3adf6d=_0x3adf6d||0x1f4;return function(_0xacef5b){logger['error'](_0xacef5b[_0x2062('0x2a')]);if(_0xacef5b[_0x2062('0x2b')]){delete _0xacef5b[_0x2062('0x2b')];}_0x26185c[_0x2062('0x2c')](_0x3adf6d)[_0x2062('0x2d')](_0xacef5b);};}exports[_0x2062('0x2e')]=function(_0x3fb7de,_0x46b29c){var _0x57702d={},_0x1e15bd={},_0x3507df={'count':0x0,'rows':[]};var _0x2c4b2c=_[_0x2062('0x2f')](db[_0x2062('0x30')][_0x2062('0x31')],function(_0xb21163){return{'name':_0xb21163[_0x2062('0x32')],'type':_0xb21163[_0x2062('0x33')]['key']};});_0x1e15bd[_0x2062('0x34')]=_[_0x2062('0x2f')](_0x2c4b2c,_0x2062('0x2b'));_0x1e15bd[_0x2062('0x35')]=_[_0x2062('0x36')](_0x3fb7de[_0x2062('0x35')]);_0x1e15bd[_0x2062('0x37')]=_['intersection'](_0x1e15bd['model'],_0x1e15bd['query']);_0x57702d[_0x2062('0x38')]=_[_0x2062('0x39')](_0x1e15bd[_0x2062('0x34')],qs[_0x2062('0x3a')](_0x3fb7de['query']['fields']));_0x57702d[_0x2062('0x38')]=_0x57702d['attributes'][_0x2062('0x3b')]?_0x57702d[_0x2062('0x38')]:_0x1e15bd[_0x2062('0x34')];if(!_0x3fb7de[_0x2062('0x35')]['hasOwnProperty'](_0x2062('0x3c'))){_0x57702d[_0x2062('0x21')]=qs[_0x2062('0x21')](_0x3fb7de[_0x2062('0x35')][_0x2062('0x21')]);_0x57702d[_0x2062('0x1f')]=qs[_0x2062('0x1f')](_0x3fb7de[_0x2062('0x35')][_0x2062('0x1f')]);}_0x57702d[_0x2062('0x3d')]=qs[_0x2062('0x3e')](_0x3fb7de['query'][_0x2062('0x3e')]);_0x57702d[_0x2062('0x3f')]=qs[_0x2062('0x37')](_['pick'](_0x3fb7de['query'],_0x1e15bd[_0x2062('0x37')]),_0x2c4b2c);if(_0x3fb7de[_0x2062('0x35')][_0x2062('0x40')]){_0x57702d[_0x2062('0x3f')]=_[_0x2062('0x41')](_0x57702d[_0x2062('0x3f')],{'$or':_[_0x2062('0x2f')](_0x2c4b2c,function(_0x37f80d){if(_0x37f80d[_0x2062('0x33')]!==_0x2062('0x42')){var _0x2979a3={};_0x2979a3[_0x37f80d[_0x2062('0x2b')]]={'$like':'%'+_0x3fb7de[_0x2062('0x35')][_0x2062('0x40')]+'%'};return _0x2979a3;}})});}_0x57702d=_[_0x2062('0x41')]({},_0x57702d,_0x3fb7de['options']);var _0x3af455={'where':_0x57702d[_0x2062('0x3f')]};return db['SugarcrmAccount']['count'](_0x3af455)[_0x2062('0x28')](function(_0x263c20){_0x3507df['count']=_0x263c20;if(_0x3fb7de[_0x2062('0x35')]['includeAll']){_0x57702d['include']=[{'all':!![]}];}return db['SugarcrmAccount'][_0x2062('0x43')](_0x57702d);})[_0x2062('0x28')](function(_0x35d2d8){_0x3507df[_0x2062('0x44')]=_0x35d2d8;return _0x3507df;})[_0x2062('0x28')](respondWithFilteredResult(_0x46b29c,_0x57702d))['catch'](handleError(_0x46b29c,null));};exports[_0x2062('0x45')]=function(_0xdc8391,_0x4a70d4){var _0x1acdf7={'raw':![],'where':{'id':_0xdc8391[_0x2062('0x46')]['id']}},_0x5dafbe={};_0x5dafbe[_0x2062('0x34')]=_['keys'](db['SugarcrmAccount']['rawAttributes']);_0x5dafbe[_0x2062('0x35')]=_['keys'](_0xdc8391[_0x2062('0x35')]);_0x5dafbe[_0x2062('0x37')]=_[_0x2062('0x39')](_0x5dafbe['model'],_0x5dafbe['query']);_0x1acdf7[_0x2062('0x38')]=_[_0x2062('0x39')](_0x5dafbe['model'],qs['fields'](_0xdc8391['query'][_0x2062('0x3a')]));_0x1acdf7['attributes']=_0x1acdf7['attributes'][_0x2062('0x3b')]?_0x1acdf7['attributes']:_0x5dafbe[_0x2062('0x34')];if(_0xdc8391[_0x2062('0x35')]['includeAll']){_0x1acdf7[_0x2062('0x47')]=[{'all':!![]}];}_0x1acdf7=_[_0x2062('0x41')]({},_0x1acdf7,_0xdc8391[_0x2062('0x48')]);return db[_0x2062('0x30')][_0x2062('0x49')](_0x1acdf7)[_0x2062('0x28')](handleEntityNotFound(_0x4a70d4,null))['then'](respondWithResult(_0x4a70d4,null))['catch'](handleError(_0x4a70d4,null));};exports['create']=function(_0x4a6d3b,_0x2ac7ed){return db['SugarcrmAccount'][_0x2062('0x4a')](_0x4a6d3b['body'],{})[_0x2062('0x28')](respondWithResult(_0x2ac7ed,0xc9))[_0x2062('0x4b')](handleError(_0x2ac7ed,null));};exports[_0x2062('0x27')]=function(_0xe6e871,_0x3d6dd3){if(_0xe6e871[_0x2062('0x4c')]['id']){delete _0xe6e871[_0x2062('0x4c')]['id'];}return db[_0x2062('0x30')]['find']({'where':{'id':_0xe6e871['params']['id']}})[_0x2062('0x28')](handleEntityNotFound(_0x3d6dd3,null))['then'](saveUpdates(_0xe6e871[_0x2062('0x4c')],null))['then'](respondWithResult(_0x3d6dd3,null))['catch'](handleError(_0x3d6dd3,null));};exports[_0x2062('0x29')]=function(_0x581165,_0xdb2b71){return db['SugarcrmAccount'][_0x2062('0x49')]({'where':{'id':_0x581165[_0x2062('0x46')]['id']}})[_0x2062('0x28')](handleEntityNotFound(_0xdb2b71,null))[_0x2062('0x28')](removeEntity(_0xdb2b71,null))[_0x2062('0x4b')](handleError(_0xdb2b71,null));};exports['getConfigurations']=function(_0x5d8fd9,_0x363b4f,_0x4b184d){var _0x2e39d4={};var _0x1cecdd={};var _0x23d592;var _0x17e101;return db[_0x2062('0x30')][_0x2062('0x4d')]({'where':{'id':_0x5d8fd9['params']['id']}})[_0x2062('0x28')](handleEntityNotFound(_0x363b4f,null))[_0x2062('0x28')](function(_0x50cffc){if(_0x50cffc){_0x23d592=_0x50cffc;_0x1cecdd[_0x2062('0x34')]=_[_0x2062('0x36')](db[_0x2062('0x4e')][_0x2062('0x31')]);_0x1cecdd[_0x2062('0x35')]=_[_0x2062('0x36')](_0x5d8fd9[_0x2062('0x35')]);_0x1cecdd['filters']=_[_0x2062('0x39')](_0x1cecdd[_0x2062('0x34')],_0x1cecdd[_0x2062('0x35')]);_0x2e39d4[_0x2062('0x38')]=_['intersection'](_0x1cecdd[_0x2062('0x34')],qs[_0x2062('0x3a')](_0x5d8fd9[_0x2062('0x35')][_0x2062('0x3a')]));_0x2e39d4[_0x2062('0x38')]=_0x2e39d4['attributes']['length']?_0x2e39d4[_0x2062('0x38')]:_0x1cecdd[_0x2062('0x34')];_0x2e39d4[_0x2062('0x3d')]=qs['sort'](_0x5d8fd9[_0x2062('0x35')][_0x2062('0x3e')]);_0x2e39d4[_0x2062('0x3f')]=qs[_0x2062('0x37')](_[_0x2062('0x4f')](_0x5d8fd9[_0x2062('0x35')],_0x1cecdd[_0x2062('0x37')]));if(_0x5d8fd9[_0x2062('0x35')][_0x2062('0x40')]){_0x2e39d4[_0x2062('0x3f')]=_['merge'](_0x2e39d4[_0x2062('0x3f')],{'$or':_[_0x2062('0x2f')](_0x2e39d4[_0x2062('0x38')],function(_0x504361){var _0x50811e={};_0x50811e[_0x504361]={'$like':'%'+_0x5d8fd9['query'][_0x2062('0x40')]+'%'};return _0x50811e;})});}_0x2e39d4=_['merge']({},_0x2e39d4,_0x5d8fd9[_0x2062('0x48')]);return _0x23d592['getConfigurations'](_0x2e39d4);}})['then'](function(_0x2482ad){if(_0x2482ad){_0x17e101=_0x2482ad[_0x2062('0x3b')];if(!_0x5d8fd9['query']['hasOwnProperty']('nolimit')){_0x2e39d4[_0x2062('0x21')]=qs['limit'](_0x5d8fd9['query'][_0x2062('0x21')]);_0x2e39d4[_0x2062('0x1f')]=qs['offset'](_0x5d8fd9[_0x2062('0x35')]['offset']);}return _0x23d592[_0x2062('0x50')](_0x2e39d4);}})[_0x2062('0x28')](function(_0x3b55ac){if(_0x3b55ac){return _0x3b55ac?{'count':_0x17e101,'rows':_0x3b55ac}:null;}})[_0x2062('0x28')](respondWithResult(_0x363b4f,null))[_0x2062('0x4b')](handleError(_0x363b4f,null));};exports['addConfiguration']=function(_0x40dbdc,_0x1da04d,_0x3f997f){if(_0x40dbdc[_0x2062('0x4c')]['id']){delete _0x40dbdc[_0x2062('0x4c')]['id'];}return db[_0x2062('0x30')]['findOne']({'where':{'id':_0x40dbdc[_0x2062('0x46')]['id']}})[_0x2062('0x28')](handleEntityNotFound(_0x1da04d,null))[_0x2062('0x28')](function(_0x1c8fd6){if(_0x1c8fd6){_0x40dbdc[_0x2062('0x4c')][_0x2062('0x51')]=_0x1c8fd6['id'];_0x40dbdc['body'][_0x2062('0x52')]=integrations['getSubjects'](_0x40dbdc['body'][_0x2062('0x53')],_0x40dbdc[_0x2062('0x4c')][_0x2062('0x33')]);_0x40dbdc[_0x2062('0x4c')][_0x2062('0x54')]=integrations['getDescriptions'](_0x40dbdc[_0x2062('0x4c')]['channel'],_0x40dbdc[_0x2062('0x4c')][_0x2062('0x33')]);return db[_0x2062('0x4e')]['create'](_0x40dbdc[_0x2062('0x4c')],{'include':[{'model':db[_0x2062('0x55')],'as':_0x2062('0x52')},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})[_0x2062('0x28')](respondWithResult(_0x1da04d,null))[_0x2062('0x4b')](handleError(_0x1da04d,null));};exports[_0x2062('0x56')]=function(_0x2b001a,_0x3fe27e,_0x3ce608){var _0x260d0f='';var _0x1369dd=['id','name',_0x2062('0x57'),'created_by',_0x2062('0x58'),_0x2062('0x59'),_0x2062('0x5a'),'duration_minutes',_0x2062('0x5b'),_0x2062('0x5c'),_0x2062('0x5d'),'direction'];return db[_0x2062('0x30')][_0x2062('0x4d')]({'where':{'id':_0x2b001a[_0x2062('0x46')]['id']},'attributes':['id',_0x2062('0x5e'),'password',_0x2062('0x5f')]})[_0x2062('0x28')](handleEntityNotFound(_0x3fe27e,null))[_0x2062('0x28')](function(_0x18b712){if(_0x18b712){_0x260d0f=_0x18b712['remoteUri'];var _0x21d841=_0x260d0f[_0x2062('0x60')](-0x1);if(_0x21d841==='/'){_0x260d0f=_0x260d0f[_0x2062('0x61')](0x0,_0x260d0f[_0x2062('0x62')](_0x21d841));}return rp({'method':_0x2062('0x63'),'uri':util['format'](_0x2062('0x64'),_0x260d0f,_0x2062('0x65')),'json':!![],'form':{'method':_0x2062('0x66'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x2062('0x67')]({'user_auth':{'user_name':_0x18b712['username'],'password':_0x18b712[_0x2062('0x68')],'encryption':_0x2062('0x69')},'application':_0x2062('0x6a')})}});}})[_0x2062('0x28')](function(_0x956e74){if(_0x956e74&&_0x956e74[_0x2062('0x2b')]!=='Invalid\x20Login'&&_0x956e74[_0x2062('0x2b')]!=='Password\x20Expired'){return rp({'method':_0x2062('0x63'),'uri':util[_0x2062('0x6b')]('%s%s',_0x260d0f,_0x2062('0x65')),'json':!![],'form':{'method':_0x2062('0x6c'),'input_type':_0x2062('0x6d'),'response_type':_0x2062('0x6d'),'rest_data':JSON['stringify']({'session':_0x956e74['id'],'module_name':_0x2062('0x6e')})}})[_0x2062('0x28')](function(_0x1f488c){if(_0x1f488c){var _0x5713e6=_[_0x2062('0x6f')](_0x1f488c['module_fields']);_['remove'](_0x5713e6,function(_0x22e8ef){return _0x1369dd['includes'](_0x22e8ef[_0x2062('0x2b')]);});return{'count':_0x5713e6['length'],'rows':_[_0x2062('0x2f')](_0x5713e6,function(_0x36747b){return{'id':_0x36747b[_0x2062('0x2b')],'name':_0x36747b[_0x2062('0x70')],'custom':_[_0x2062('0x71')](_0x36747b['name'],'_c')?!![]:![],'options':_0x36747b[_0x2062('0x48')]?_[_0x2062('0x2f')](_[_0x2062('0x6f')](_0x36747b[_0x2062('0x48')]),function(_0x4a15c9){return{'name':_0x4a15c9['value'],'value':_0x4a15c9[_0x2062('0x2b')]};}):[]};})};}})[_0x2062('0x28')](respondWithResult(_0x3fe27e,null))[_0x2062('0x4b')](function(_0x5c1b45){var _0x5237d5=_0x2b001a[_0x2062('0x35')][_0x2062('0x72')]?0x1f4:_0x5c1b45[_0x2062('0x73')]||0x1f4;logger[_0x2062('0x74')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x5237d5,JSON['stringify'](_0x5c1b45));delete _0x5c1b45['name'];if(_0x5237d5===0x191){_0x5237d5=0x190;}_0x3fe27e['status'](_0x5237d5)['send'](_0x2b001a[_0x2062('0x35')][_0x2062('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x5c1b45['statusCode']}:_0x5c1b45);});}else{var _0xd24431=0x1f4;_0x3fe27e[_0x2062('0x2c')](_0xd24431)[_0x2062('0x2d')]({'message':_0x2062('0x75'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x3642=['remove','label','endsWith','value','statusCode','test','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','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','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','end','error','name','send','index','map','SugarcrmAccount','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','includeAll','include','findAll','rows','show','options','find','catch','create','body','params','destroy','SugarcrmConfiguration','getConfigurations','getSubjects','Descriptions','getDescriptions','channel','Subjects','SugarcrmField','getFields','assigned_user_id','description','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','findOne','password','remoteUri','slice','substring','lastIndexOf','format','%s%s','/service/v4_1/rest.php','login','JSON','username','PLAIN','xCALLY\x20Motion\x20Integration','POST','stringify','values','module_fields'];(function(_0x48371e,_0x5b3033){var _0x3671ba=function(_0x4b15cf){while(--_0x4b15cf){_0x48371e['push'](_0x48371e['shift']());}};_0x3671ba(++_0x5b3033);}(_0x3642,0x166));var _0x2364=function(_0x1fa841,_0x37a70c){_0x1fa841=_0x1fa841-0x0;var _0x384b67=_0x3642[_0x1fa841];return _0x384b67;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2364('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2364('0x1'));var rp=require(_0x2364('0x2'));var moment=require('moment');var BPromise=require(_0x2364('0x3'));var Mustache=require(_0x2364('0x4'));var util=require(_0x2364('0x5'));var path=require(_0x2364('0x6'));var sox=require(_0x2364('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2364('0x8'));var _=require(_0x2364('0x9'));var squel=require(_0x2364('0xa'));var crypto=require(_0x2364('0xb'));var jsforce=require(_0x2364('0xc'));var deskjs=require(_0x2364('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2364('0xe'));var Redis=require(_0x2364('0xf'));var authService=require(_0x2364('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2364('0x11'));var hardwareService=require(_0x2364('0x12'));var logger=require(_0x2364('0x13'))(_0x2364('0x14'));var utils=require('../../config/utils');var config=require(_0x2364('0x15'));var licenseUtil=require(_0x2364('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x2364('0x17'));function respondWithStatusCode(_0x6623b,_0x5b97b9){_0x5b97b9=_0x5b97b9||0xcc;return function(_0x25070b){if(_0x25070b){return _0x6623b[_0x2364('0x18')](_0x5b97b9);}return _0x6623b[_0x2364('0x19')](_0x5b97b9)['end']();};}function respondWithResult(_0x5b884c,_0x3bd932){_0x3bd932=_0x3bd932||0xc8;return function(_0x9bc3eb){if(_0x9bc3eb){return _0x5b884c[_0x2364('0x19')](_0x3bd932)['json'](_0x9bc3eb);}};}function respondWithFilteredResult(_0x149630,_0x360cc3){return function(_0x19598b){if(_0x19598b){var _0x4808f1=typeof _0x360cc3[_0x2364('0x1a')]==='undefined'&&typeof _0x360cc3[_0x2364('0x1b')]===_0x2364('0x1c');var _0x392bd0=_0x19598b[_0x2364('0x1d')];var _0x5412be=_0x4808f1?0x0:_0x360cc3[_0x2364('0x1a')];var _0xcf0bf9=_0x4808f1?_0x19598b[_0x2364('0x1d')]:_0x360cc3[_0x2364('0x1a')]+_0x360cc3[_0x2364('0x1b')];var _0x21cf36;if(_0xcf0bf9>=_0x392bd0){_0xcf0bf9=_0x392bd0;_0x21cf36=0xc8;}else{_0x21cf36=0xce;}_0x149630[_0x2364('0x19')](_0x21cf36);return _0x149630[_0x2364('0x1e')](_0x2364('0x1f'),_0x5412be+'-'+_0xcf0bf9+'/'+_0x392bd0)['json'](_0x19598b);}return null;};}function patchUpdates(_0x163cc4){return function(_0x4f7c1d){try{jsonpatch[_0x2364('0x20')](_0x4f7c1d,_0x163cc4,!![]);}catch(_0x1e7e88){return BPromise['reject'](_0x1e7e88);}return _0x4f7c1d[_0x2364('0x21')]();};}function saveUpdates(_0x43cb6f,_0x3238de){return function(_0x2e3176){if(_0x2e3176){return _0x2e3176[_0x2364('0x22')](_0x43cb6f)[_0x2364('0x23')](function(_0x4969c7){return _0x4969c7;});}return null;};}function removeEntity(_0x59f2d3,_0x4dfa9b){return function(_0x3fb9d3){if(_0x3fb9d3){return _0x3fb9d3['destroy']()[_0x2364('0x23')](function(){_0x59f2d3['status'](0xcc)[_0x2364('0x24')]();});}};}function handleEntityNotFound(_0x481ac4,_0x149b38){return function(_0x13bd65){if(!_0x13bd65){_0x481ac4[_0x2364('0x18')](0x194);}return _0x13bd65;};}function handleError(_0x309ae2,_0x46131c){_0x46131c=_0x46131c||0x1f4;return function(_0x30e991){logger[_0x2364('0x25')](_0x30e991['stack']);if(_0x30e991[_0x2364('0x26')]){delete _0x30e991[_0x2364('0x26')];}_0x309ae2[_0x2364('0x19')](_0x46131c)[_0x2364('0x27')](_0x30e991);};}exports[_0x2364('0x28')]=function(_0x56c33e,_0xf3c425){var _0x51f4bb={},_0x7e0538={},_0x3dffae={'count':0x0,'rows':[]};var _0x49e568=_[_0x2364('0x29')](db[_0x2364('0x2a')][_0x2364('0x2b')],function(_0x5a285e){return{'name':_0x5a285e['fieldName'],'type':_0x5a285e['type'][_0x2364('0x2c')]};});_0x7e0538[_0x2364('0x2d')]=_['map'](_0x49e568,_0x2364('0x26'));_0x7e0538[_0x2364('0x2e')]=_[_0x2364('0x2f')](_0x56c33e[_0x2364('0x2e')]);_0x7e0538[_0x2364('0x30')]=_[_0x2364('0x31')](_0x7e0538[_0x2364('0x2d')],_0x7e0538[_0x2364('0x2e')]);_0x51f4bb[_0x2364('0x32')]=_[_0x2364('0x31')](_0x7e0538[_0x2364('0x2d')],qs[_0x2364('0x33')](_0x56c33e['query'][_0x2364('0x33')]));_0x51f4bb['attributes']=_0x51f4bb[_0x2364('0x32')][_0x2364('0x34')]?_0x51f4bb[_0x2364('0x32')]:_0x7e0538['model'];if(!_0x56c33e[_0x2364('0x2e')][_0x2364('0x35')](_0x2364('0x36'))){_0x51f4bb[_0x2364('0x1b')]=qs['limit'](_0x56c33e[_0x2364('0x2e')][_0x2364('0x1b')]);_0x51f4bb[_0x2364('0x1a')]=qs[_0x2364('0x1a')](_0x56c33e['query'][_0x2364('0x1a')]);}_0x51f4bb[_0x2364('0x37')]=qs[_0x2364('0x38')](_0x56c33e[_0x2364('0x2e')][_0x2364('0x38')]);_0x51f4bb[_0x2364('0x39')]=qs[_0x2364('0x30')](_[_0x2364('0x3a')](_0x56c33e['query'],_0x7e0538[_0x2364('0x30')]),_0x49e568);if(_0x56c33e[_0x2364('0x2e')]['filter']){_0x51f4bb[_0x2364('0x39')]=_['merge'](_0x51f4bb[_0x2364('0x39')],{'$or':_['map'](_0x49e568,function(_0xc337f3){if(_0xc337f3[_0x2364('0x3b')]!==_0x2364('0x3c')){var _0x596551={};_0x596551[_0xc337f3[_0x2364('0x26')]]={'$like':'%'+_0x56c33e[_0x2364('0x2e')][_0x2364('0x3d')]+'%'};return _0x596551;}})});}_0x51f4bb=_[_0x2364('0x3e')]({},_0x51f4bb,_0x56c33e['options']);var _0x48672c={'where':_0x51f4bb[_0x2364('0x39')]};return db[_0x2364('0x2a')][_0x2364('0x1d')](_0x48672c)['then'](function(_0x117dfd){_0x3dffae[_0x2364('0x1d')]=_0x117dfd;if(_0x56c33e[_0x2364('0x2e')][_0x2364('0x3f')]){_0x51f4bb[_0x2364('0x40')]=[{'all':!![]}];}return db[_0x2364('0x2a')][_0x2364('0x41')](_0x51f4bb);})[_0x2364('0x23')](function(_0x10e0b0){_0x3dffae[_0x2364('0x42')]=_0x10e0b0;return _0x3dffae;})[_0x2364('0x23')](respondWithFilteredResult(_0xf3c425,_0x51f4bb))['catch'](handleError(_0xf3c425,null));};exports[_0x2364('0x43')]=function(_0x35dfeb,_0x5d7833){var _0x2462c1={'raw':![],'where':{'id':_0x35dfeb['params']['id']}},_0x4c56bc={};_0x4c56bc['model']=_[_0x2364('0x2f')](db[_0x2364('0x2a')][_0x2364('0x2b')]);_0x4c56bc[_0x2364('0x2e')]=_[_0x2364('0x2f')](_0x35dfeb[_0x2364('0x2e')]);_0x4c56bc[_0x2364('0x30')]=_['intersection'](_0x4c56bc[_0x2364('0x2d')],_0x4c56bc[_0x2364('0x2e')]);_0x2462c1[_0x2364('0x32')]=_[_0x2364('0x31')](_0x4c56bc[_0x2364('0x2d')],qs[_0x2364('0x33')](_0x35dfeb['query']['fields']));_0x2462c1[_0x2364('0x32')]=_0x2462c1[_0x2364('0x32')][_0x2364('0x34')]?_0x2462c1[_0x2364('0x32')]:_0x4c56bc[_0x2364('0x2d')];if(_0x35dfeb['query']['includeAll']){_0x2462c1['include']=[{'all':!![]}];}_0x2462c1=_['merge']({},_0x2462c1,_0x35dfeb[_0x2364('0x44')]);return db[_0x2364('0x2a')][_0x2364('0x45')](_0x2462c1)[_0x2364('0x23')](handleEntityNotFound(_0x5d7833,null))[_0x2364('0x23')](respondWithResult(_0x5d7833,null))[_0x2364('0x46')](handleError(_0x5d7833,null));};exports[_0x2364('0x47')]=function(_0x480260,_0x5de268){return db[_0x2364('0x2a')]['create'](_0x480260[_0x2364('0x48')],{})['then'](respondWithResult(_0x5de268,0xc9))[_0x2364('0x46')](handleError(_0x5de268,null));};exports[_0x2364('0x22')]=function(_0x4eb13c,_0x342af7){if(_0x4eb13c[_0x2364('0x48')]['id']){delete _0x4eb13c[_0x2364('0x48')]['id'];}return db['SugarcrmAccount'][_0x2364('0x45')]({'where':{'id':_0x4eb13c[_0x2364('0x49')]['id']}})['then'](handleEntityNotFound(_0x342af7,null))['then'](saveUpdates(_0x4eb13c[_0x2364('0x48')],null))[_0x2364('0x23')](respondWithResult(_0x342af7,null))[_0x2364('0x46')](handleError(_0x342af7,null));};exports[_0x2364('0x4a')]=function(_0x3223c1,_0x3359c6){return db['SugarcrmAccount'][_0x2364('0x45')]({'where':{'id':_0x3223c1[_0x2364('0x49')]['id']}})[_0x2364('0x23')](handleEntityNotFound(_0x3359c6,null))['then'](removeEntity(_0x3359c6,null))[_0x2364('0x46')](handleError(_0x3359c6,null));};exports['getConfigurations']=function(_0x5b1e65,_0x3f8b4a,_0x393162){var _0x20dbf3={};var _0x129826={};var _0x32d709;var _0x2ed875;return db[_0x2364('0x2a')]['findOne']({'where':{'id':_0x5b1e65['params']['id']}})[_0x2364('0x23')](handleEntityNotFound(_0x3f8b4a,null))[_0x2364('0x23')](function(_0x45df11){if(_0x45df11){_0x32d709=_0x45df11;_0x129826[_0x2364('0x2d')]=_['keys'](db[_0x2364('0x4b')][_0x2364('0x2b')]);_0x129826[_0x2364('0x2e')]=_[_0x2364('0x2f')](_0x5b1e65[_0x2364('0x2e')]);_0x129826[_0x2364('0x30')]=_[_0x2364('0x31')](_0x129826[_0x2364('0x2d')],_0x129826[_0x2364('0x2e')]);_0x20dbf3['attributes']=_[_0x2364('0x31')](_0x129826[_0x2364('0x2d')],qs['fields'](_0x5b1e65[_0x2364('0x2e')]['fields']));_0x20dbf3['attributes']=_0x20dbf3['attributes'][_0x2364('0x34')]?_0x20dbf3[_0x2364('0x32')]:_0x129826['model'];_0x20dbf3[_0x2364('0x37')]=qs['sort'](_0x5b1e65[_0x2364('0x2e')][_0x2364('0x38')]);_0x20dbf3['where']=qs[_0x2364('0x30')](_[_0x2364('0x3a')](_0x5b1e65[_0x2364('0x2e')],_0x129826[_0x2364('0x30')]));if(_0x5b1e65[_0x2364('0x2e')][_0x2364('0x3d')]){_0x20dbf3[_0x2364('0x39')]=_[_0x2364('0x3e')](_0x20dbf3['where'],{'$or':_['map'](_0x20dbf3[_0x2364('0x32')],function(_0x5730c9){var _0x433c5a={};_0x433c5a[_0x5730c9]={'$like':'%'+_0x5b1e65[_0x2364('0x2e')][_0x2364('0x3d')]+'%'};return _0x433c5a;})});}_0x20dbf3=_[_0x2364('0x3e')]({},_0x20dbf3,_0x5b1e65[_0x2364('0x44')]);return _0x32d709[_0x2364('0x4c')](_0x20dbf3);}})['then'](function(_0x49d6cf){if(_0x49d6cf){_0x2ed875=_0x49d6cf[_0x2364('0x34')];if(!_0x5b1e65[_0x2364('0x2e')][_0x2364('0x35')](_0x2364('0x36'))){_0x20dbf3[_0x2364('0x1b')]=qs[_0x2364('0x1b')](_0x5b1e65[_0x2364('0x2e')][_0x2364('0x1b')]);_0x20dbf3['offset']=qs[_0x2364('0x1a')](_0x5b1e65[_0x2364('0x2e')][_0x2364('0x1a')]);}return _0x32d709[_0x2364('0x4c')](_0x20dbf3);}})[_0x2364('0x23')](function(_0x3dc0fd){if(_0x3dc0fd){return _0x3dc0fd?{'count':_0x2ed875,'rows':_0x3dc0fd}:null;}})['then'](respondWithResult(_0x3f8b4a,null))[_0x2364('0x46')](handleError(_0x3f8b4a,null));};exports['addConfiguration']=function(_0x52034e,_0xfa0545,_0x1db25c){if(_0x52034e[_0x2364('0x48')]['id']){delete _0x52034e[_0x2364('0x48')]['id'];}return db[_0x2364('0x2a')]['findOne']({'where':{'id':_0x52034e['params']['id']}})[_0x2364('0x23')](handleEntityNotFound(_0xfa0545,null))[_0x2364('0x23')](function(_0x40b41c){if(_0x40b41c){_0x52034e['body']['AccountId']=_0x40b41c['id'];_0x52034e[_0x2364('0x48')]['Subjects']=integrations[_0x2364('0x4d')](_0x52034e[_0x2364('0x48')]['channel'],_0x52034e[_0x2364('0x48')][_0x2364('0x3b')]);_0x52034e['body'][_0x2364('0x4e')]=integrations[_0x2364('0x4f')](_0x52034e['body'][_0x2364('0x50')],_0x52034e[_0x2364('0x48')][_0x2364('0x3b')]);return db[_0x2364('0x4b')][_0x2364('0x47')](_0x52034e[_0x2364('0x48')],{'include':[{'model':db['SugarcrmField'],'as':_0x2364('0x51')},{'model':db[_0x2364('0x52')],'as':'Descriptions'}]});}return null;})[_0x2364('0x23')](respondWithResult(_0xfa0545,null))[_0x2364('0x46')](handleError(_0xfa0545,null));};exports[_0x2364('0x53')]=function(_0x18022a,_0x45ad78,_0x481a34){var _0x2d3917='';var _0x430a40=['id',_0x2364('0x26'),_0x2364('0x54'),'created_by',_0x2364('0x55'),'date_start',_0x2364('0x56'),_0x2364('0x57'),_0x2364('0x58'),_0x2364('0x59'),_0x2364('0x5a'),_0x2364('0x5b')];return db[_0x2364('0x2a')][_0x2364('0x5c')]({'where':{'id':_0x18022a[_0x2364('0x49')]['id']},'attributes':['id','username',_0x2364('0x5d'),_0x2364('0x5e')]})['then'](handleEntityNotFound(_0x45ad78,null))['then'](function(_0x5735ff){if(_0x5735ff){_0x2d3917=_0x5735ff[_0x2364('0x5e')];var _0x1b46dd=_0x2d3917[_0x2364('0x5f')](-0x1);if(_0x1b46dd==='/'){_0x2d3917=_0x2d3917[_0x2364('0x60')](0x0,_0x2d3917[_0x2364('0x61')](_0x1b46dd));}return rp({'method':'POST','uri':util[_0x2364('0x62')](_0x2364('0x63'),_0x2d3917,_0x2364('0x64')),'json':!![],'form':{'method':_0x2364('0x65'),'input_type':_0x2364('0x66'),'response_type':_0x2364('0x66'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x5735ff[_0x2364('0x67')],'password':_0x5735ff[_0x2364('0x5d')],'encryption':_0x2364('0x68')},'application':_0x2364('0x69')})}});}})[_0x2364('0x23')](function(_0x3e3f16){if(_0x3e3f16&&_0x3e3f16[_0x2364('0x26')]!=='Invalid\x20Login'&&_0x3e3f16[_0x2364('0x26')]!=='Password\x20Expired'){return rp({'method':_0x2364('0x6a'),'uri':util[_0x2364('0x62')](_0x2364('0x63'),_0x2d3917,_0x2364('0x64')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x2364('0x66'),'response_type':_0x2364('0x66'),'rest_data':JSON[_0x2364('0x6b')]({'session':_0x3e3f16['id'],'module_name':'Calls'})}})['then'](function(_0x2948d8){if(_0x2948d8){var _0x3fab4b=_[_0x2364('0x6c')](_0x2948d8[_0x2364('0x6d')]);_[_0x2364('0x6e')](_0x3fab4b,function(_0x3ab9b8){return _0x430a40['includes'](_0x3ab9b8['name']);});return{'count':_0x3fab4b['length'],'rows':_[_0x2364('0x29')](_0x3fab4b,function(_0x1be97a){return{'id':_0x1be97a[_0x2364('0x26')],'name':_0x1be97a[_0x2364('0x6f')],'custom':_[_0x2364('0x70')](_0x1be97a[_0x2364('0x26')],'_c')?!![]:![],'options':_0x1be97a[_0x2364('0x44')]?_[_0x2364('0x29')](_['values'](_0x1be97a['options']),function(_0x4bae61){return{'name':_0x4bae61[_0x2364('0x71')],'value':_0x4bae61[_0x2364('0x26')]};}):[]};})};}})[_0x2364('0x23')](respondWithResult(_0x45ad78,null))['catch'](function(_0x2ee06b){var _0x1d6b8c=_0x18022a['query']['test']?0x1f4:_0x2ee06b[_0x2364('0x72')]||0x1f4;logger[_0x2364('0x25')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x1d6b8c,JSON[_0x2364('0x6b')](_0x2ee06b));delete _0x2ee06b[_0x2364('0x26')];if(_0x1d6b8c===0x191){_0x1d6b8c=0x190;}_0x45ad78[_0x2364('0x19')](_0x1d6b8c)['send'](_0x18022a[_0x2364('0x2e')][_0x2364('0x73')]?{'message':_0x2364('0x74'),'statusCode':_0x2ee06b[_0x2364('0x72')]}:_0x2ee06b);});}else{var _0x34aba2=0x1f4;_0x45ad78[_0x2364('0x19')](_0x34aba2)[_0x2364('0x27')]({'message':_0x2364('0x74'),'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 fe23cba..094c9c2 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 _0x2eba=['../../config/logger','api','moment','path','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','SugarcrmAccount','util'];(function(_0x4a921a,_0x25d79b){var _0x5fea42=function(_0x2aef02){while(--_0x2aef02){_0x4a921a['push'](_0x4a921a['shift']());}};_0x5fea42(++_0x25d79b);}(_0x2eba,0xc7));var _0xa2eb=function(_0x5deb65,_0x51aff1){_0x5deb65=_0x5deb65-0x0;var _0x16e015=_0x2eba[_0x5deb65];return _0x16e015;};'use strict';var _=require('lodash');var util=require(_0xa2eb('0x0'));var logger=require(_0xa2eb('0x1'))(_0xa2eb('0x2'));var moment=require(_0xa2eb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2eb('0x4'));var rimraf=require('rimraf');var config=require(_0xa2eb('0x5'));var attributes=require(_0xa2eb('0x6'));var integrations=require(_0xa2eb('0x7'));module[_0xa2eb('0x8')]=function(_0x575a5c,_0x545db3){return _0x575a5c['define'](_0xa2eb('0x9'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc9d7=['rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xc9d7,0x149));var _0x7c9d=function(_0x58381c,_0x3b9374){_0x58381c=_0x58381c-0x0;var _0x1a7440=_0xc9d7[_0x58381c];return _0x1a7440;};'use strict';var _=require(_0x7c9d('0x0'));var util=require(_0x7c9d('0x1'));var logger=require(_0x7c9d('0x2'))(_0x7c9d('0x3'));var moment=require(_0x7c9d('0x4'));var BPromise=require(_0x7c9d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c9d('0x6'));var rimraf=require(_0x7c9d('0x7'));var config=require(_0x7c9d('0x8'));var attributes=require(_0x7c9d('0x9'));var integrations=require(_0x7c9d('0xa'));module[_0x7c9d('0xb')]=function(_0x18b838,_0x3ed3d0){return _0x18b838['define'](_0x7c9d('0xc'),attributes,{'tableName':_0x7c9d('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 7bf6a60..1a4ce62 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 _0x7035=['SugarcrmAccount,\x20%s,\x20%s','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','options','raw','where','attributes','limit','include','model','map','stringify','find','ShowSugarcrmAccount','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7035,0x14c));var _0x5703=function(_0x47e916,_0x32ec4c){_0x47e916=_0x47e916-0x0;var _0xcaa33f=_0x7035[_0x47e916];return _0xcaa33f;};'use strict';var _=require(_0x5703('0x0'));var util=require('util');var moment=require(_0x5703('0x1'));var BPromise=require(_0x5703('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5703('0x3'));var db=require(_0x5703('0x4'))['db'];var utils=require(_0x5703('0x5'));var logger=require(_0x5703('0x6'))(_0x5703('0x7'));var config=require(_0x5703('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5703('0x9')][_0x5703('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45e934,_0x48cd61,_0x2539a0){return new BPromise(function(_0x552746,_0xf22763){return client[_0x5703('0xb')](_0x45e934,_0x2539a0)[_0x5703('0xc')](function(_0x86b2fe){logger[_0x5703('0xd')]('SugarcrmAccount,\x20%s,\x20%s',_0x48cd61,_0x5703('0xe'));logger[_0x5703('0xf')](_0x5703('0x10'),_0x48cd61,_0x5703('0xe'),JSON['stringify'](_0x86b2fe));if(_0x86b2fe[_0x5703('0x11')]){if(_0x86b2fe[_0x5703('0x11')]['code']===0x1f4){logger[_0x5703('0x11')](_0x5703('0x12'),_0x48cd61,_0x86b2fe[_0x5703('0x11')][_0x5703('0x13')]);return _0xf22763(_0x86b2fe[_0x5703('0x11')][_0x5703('0x13')]);}logger['error'](_0x5703('0x12'),_0x48cd61,_0x86b2fe[_0x5703('0x11')][_0x5703('0x13')]);return _0x552746(_0x86b2fe['error'][_0x5703('0x13')]);}else{logger[_0x5703('0xd')]('SugarcrmAccount,\x20%s,\x20%s',_0x48cd61,'request\x20sent');_0x552746(_0x86b2fe[_0x5703('0x14')]['message']);}})[_0x5703('0x15')](function(_0x15f9a7){logger[_0x5703('0x11')](_0x5703('0x12'),_0x48cd61,_0x15f9a7);_0xf22763(_0x15f9a7);});});}exports[_0x5703('0x16')]=function(_0x231148){var _0x163340=this;return new Promise(function(_0x306efb,_0xb189b8){return db[_0x5703('0x17')]['findAll']({'raw':_0x231148['options']?_0x231148[_0x5703('0x18')][_0x5703('0x19')]===undefined?!![]:![]:!![],'where':_0x231148[_0x5703('0x18')]?_0x231148[_0x5703('0x18')][_0x5703('0x1a')]||null:null,'attributes':_0x231148[_0x5703('0x18')]?_0x231148[_0x5703('0x18')][_0x5703('0x1b')]||null:null,'limit':_0x231148[_0x5703('0x18')]?_0x231148[_0x5703('0x18')][_0x5703('0x1c')]||null:null,'include':_0x231148[_0x5703('0x18')]?_0x231148['options'][_0x5703('0x1d')]?_['map'](_0x231148[_0x5703('0x18')][_0x5703('0x1d')],function(_0xf28ee3){return{'model':db[_0xf28ee3[_0x5703('0x1e')]],'as':_0xf28ee3['as'],'attributes':_0xf28ee3['attributes'],'include':_0xf28ee3[_0x5703('0x1d')]?_[_0x5703('0x1f')](_0xf28ee3[_0x5703('0x1d')],function(_0x2cd353){return{'model':db[_0x2cd353['model']],'as':_0x2cd353['as'],'attributes':_0x2cd353[_0x5703('0x1b')],'include':_0x2cd353[_0x5703('0x1d')]?_[_0x5703('0x1f')](_0x2cd353[_0x5703('0x1d')],function(_0x1d4c33){return{'model':db[_0x1d4c33[_0x5703('0x1e')]],'as':_0x1d4c33['as'],'attributes':_0x1d4c33[_0x5703('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b3c3a){logger[_0x5703('0xd')]('GetSugarcrmAccount',_0x231148);logger['debug']('GetSugarcrmAccount',_0x231148,JSON[_0x5703('0x20')](_0x1b3c3a));_0x306efb(_0x1b3c3a);})[_0x5703('0x15')](function(_0x334761){logger[_0x5703('0x11')]('GetSugarcrmAccount',_0x334761[_0x5703('0x13')],_0x231148);_0xb189b8(_0x163340['error'](0x1f4,_0x334761[_0x5703('0x13')]));});});};exports['ShowSugarcrmAccount']=function(_0x33a896){var _0x4c38f5=this;return new Promise(function(_0x1dd6f6,_0x34bf75){return db['SugarcrmAccount'][_0x5703('0x21')]({'raw':_0x33a896['options']?_0x33a896['options']['raw']===undefined?!![]:![]:!![],'where':_0x33a896['options']?_0x33a896[_0x5703('0x18')][_0x5703('0x1a')]||null:null,'attributes':_0x33a896[_0x5703('0x18')]?_0x33a896['options'][_0x5703('0x1b')]||null:null,'include':_0x33a896[_0x5703('0x18')]?_0x33a896['options'][_0x5703('0x1d')]?_[_0x5703('0x1f')](_0x33a896['options'][_0x5703('0x1d')],function(_0x49095e){return{'model':db[_0x49095e[_0x5703('0x1e')]],'as':_0x49095e['as'],'attributes':_0x49095e['attributes'],'include':_0x49095e[_0x5703('0x1d')]?_['map'](_0x49095e[_0x5703('0x1d')],function(_0x1fb5e6){return{'model':db[_0x1fb5e6[_0x5703('0x1e')]],'as':_0x1fb5e6['as'],'attributes':_0x1fb5e6[_0x5703('0x1b')],'include':_0x1fb5e6[_0x5703('0x1d')]?_[_0x5703('0x1f')](_0x1fb5e6[_0x5703('0x1d')],function(_0x4fd404){return{'model':db[_0x4fd404[_0x5703('0x1e')]],'as':_0x4fd404['as'],'attributes':_0x4fd404[_0x5703('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5703('0xc')](function(_0x412201){logger[_0x5703('0xd')](_0x5703('0x22'),_0x33a896);logger[_0x5703('0xf')](_0x5703('0x22'),_0x33a896,JSON[_0x5703('0x20')](_0x412201));_0x1dd6f6(_0x412201);})[_0x5703('0x15')](function(_0x5ed2d8){logger[_0x5703('0x11')](_0x5703('0x22'),_0x5ed2d8['message'],_0x33a896);_0x34bf75(_0x4c38f5['error'](0x1f4,_0x5ed2d8[_0x5703('0x13')]));});});}; \ No newline at end of file +var _0x236e=['limit','include','model','map','ShowSugarcrmAccount','find','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes'];(function(_0x20cc29,_0x30a46d){var _0x28d513=function(_0x179b06){while(--_0x179b06){_0x20cc29['push'](_0x20cc29['shift']());}};_0x28d513(++_0x30a46d);}(_0x236e,0x15b));var _0xe236=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x236e[_0xbb091];return _0x467a04;};'use strict';var _=require('lodash');var util=require(_0xe236('0x0'));var moment=require('moment');var BPromise=require(_0xe236('0x1'));var rs=require(_0xe236('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe236('0x3'))['db'];var utils=require(_0xe236('0x4'));var logger=require(_0xe236('0x5'))('rpc');var config=require(_0xe236('0x6'));var jayson=require(_0xe236('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4d5b3e,_0x2dad3e,_0xcc3869){return new BPromise(function(_0x3262ad,_0xcd5541){return client[_0xe236('0x8')](_0x4d5b3e,_0xcc3869)[_0xe236('0x9')](function(_0x545cd5){logger[_0xe236('0xa')](_0xe236('0xb'),_0x2dad3e,_0xe236('0xc'));logger[_0xe236('0xd')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x2dad3e,'request\x20sent',JSON[_0xe236('0xe')](_0x545cd5));if(_0x545cd5[_0xe236('0xf')]){if(_0x545cd5[_0xe236('0xf')]['code']===0x1f4){logger[_0xe236('0xf')](_0xe236('0xb'),_0x2dad3e,_0x545cd5['error'][_0xe236('0x10')]);return _0xcd5541(_0x545cd5['error']['message']);}logger[_0xe236('0xf')](_0xe236('0xb'),_0x2dad3e,_0x545cd5['error'][_0xe236('0x10')]);return _0x3262ad(_0x545cd5[_0xe236('0xf')][_0xe236('0x10')]);}else{logger['info'](_0xe236('0xb'),_0x2dad3e,_0xe236('0xc'));_0x3262ad(_0x545cd5['result'][_0xe236('0x10')]);}})[_0xe236('0x11')](function(_0x3218ab){logger[_0xe236('0xf')](_0xe236('0xb'),_0x2dad3e,_0x3218ab);_0xcd5541(_0x3218ab);});});}exports[_0xe236('0x12')]=function(_0x210998){var _0x3b2304=this;return new Promise(function(_0x2a97e4,_0x4d1204){return db[_0xe236('0x13')][_0xe236('0x14')]({'raw':_0x210998[_0xe236('0x15')]?_0x210998[_0xe236('0x15')][_0xe236('0x16')]===undefined?!![]:![]:!![],'where':_0x210998[_0xe236('0x15')]?_0x210998[_0xe236('0x15')][_0xe236('0x17')]||null:null,'attributes':_0x210998[_0xe236('0x15')]?_0x210998[_0xe236('0x15')][_0xe236('0x18')]||null:null,'limit':_0x210998['options']?_0x210998[_0xe236('0x15')][_0xe236('0x19')]||null:null,'include':_0x210998[_0xe236('0x15')]?_0x210998['options'][_0xe236('0x1a')]?_['map'](_0x210998[_0xe236('0x15')][_0xe236('0x1a')],function(_0x505354){return{'model':db[_0x505354[_0xe236('0x1b')]],'as':_0x505354['as'],'attributes':_0x505354['attributes'],'include':_0x505354['include']?_[_0xe236('0x1c')](_0x505354['include'],function(_0x3c03b8){return{'model':db[_0x3c03b8[_0xe236('0x1b')]],'as':_0x3c03b8['as'],'attributes':_0x3c03b8[_0xe236('0x18')],'include':_0x3c03b8['include']?_[_0xe236('0x1c')](_0x3c03b8[_0xe236('0x1a')],function(_0x571770){return{'model':db[_0x571770[_0xe236('0x1b')]],'as':_0x571770['as'],'attributes':_0x571770[_0xe236('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a43f1){logger[_0xe236('0xa')](_0xe236('0x12'),_0x210998);logger['debug'](_0xe236('0x12'),_0x210998,JSON[_0xe236('0xe')](_0x2a43f1));_0x2a97e4(_0x2a43f1);})[_0xe236('0x11')](function(_0x5c091e){logger[_0xe236('0xf')](_0xe236('0x12'),_0x5c091e['message'],_0x210998);_0x4d1204(_0x3b2304[_0xe236('0xf')](0x1f4,_0x5c091e[_0xe236('0x10')]));});});};exports[_0xe236('0x1d')]=function(_0x1b0854){var _0x5522a1=this;return new Promise(function(_0x476e80,_0x34f025){return db[_0xe236('0x13')][_0xe236('0x1e')]({'raw':_0x1b0854['options']?_0x1b0854[_0xe236('0x15')][_0xe236('0x16')]===undefined?!![]:![]:!![],'where':_0x1b0854[_0xe236('0x15')]?_0x1b0854['options']['where']||null:null,'attributes':_0x1b0854[_0xe236('0x15')]?_0x1b0854[_0xe236('0x15')][_0xe236('0x18')]||null:null,'include':_0x1b0854['options']?_0x1b0854[_0xe236('0x15')][_0xe236('0x1a')]?_[_0xe236('0x1c')](_0x1b0854[_0xe236('0x15')][_0xe236('0x1a')],function(_0x108b2b){return{'model':db[_0x108b2b[_0xe236('0x1b')]],'as':_0x108b2b['as'],'attributes':_0x108b2b['attributes'],'include':_0x108b2b[_0xe236('0x1a')]?_[_0xe236('0x1c')](_0x108b2b[_0xe236('0x1a')],function(_0x313ee3){return{'model':db[_0x313ee3['model']],'as':_0x313ee3['as'],'attributes':_0x313ee3[_0xe236('0x18')],'include':_0x313ee3['include']?_['map'](_0x313ee3['include'],function(_0x41c391){return{'model':db[_0x41c391[_0xe236('0x1b')]],'as':_0x41c391['as'],'attributes':_0x41c391[_0xe236('0x18')]};}):[]};}):[]};}):[]:[]})[_0xe236('0x9')](function(_0xc71371){logger[_0xe236('0xa')](_0xe236('0x1d'),_0x1b0854);logger[_0xe236('0xd')](_0xe236('0x1d'),_0x1b0854,JSON[_0xe236('0xe')](_0xc71371));_0x476e80(_0xc71371);})[_0xe236('0x11')](function(_0x1754e8){logger['error'](_0xe236('0x1d'),_0x1754e8[_0xe236('0x10')],_0x1b0854);_0x34f025(_0x5522a1[_0xe236('0xf')](0x1f4,_0x1754e8['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index e16e19f..a914ea4 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 _0x9e6d=['./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x378212,_0x15cfa8){var _0x301f71=function(_0x487e4c){while(--_0x487e4c){_0x378212['push'](_0x378212['shift']());}};_0x301f71(++_0x15cfa8);}(_0x9e6d,0xc6));var _0xd9e6=function(_0x5c6ed6,_0x2f137d){_0x5c6ed6=_0x5c6ed6-0x0;var _0x3b3701=_0x9e6d[_0x5c6ed6];return _0x3b3701;};'use strict';var multer=require(_0xd9e6('0x0'));var util=require(_0xd9e6('0x1'));var path=require(_0xd9e6('0x2'));var timeout=require(_0xd9e6('0x3'));var express=require(_0xd9e6('0x4'));var router=express[_0xd9e6('0x5')]();var fs_extra=require(_0xd9e6('0x6'));var auth=require(_0xd9e6('0x7'));var interaction=require(_0xd9e6('0x8'));var config=require(_0xd9e6('0x9'));var controller=require(_0xd9e6('0xa'));router[_0xd9e6('0xb')]('/',auth[_0xd9e6('0xc')](),controller[_0xd9e6('0xd')]);router[_0xd9e6('0xb')](_0xd9e6('0xe'),auth[_0xd9e6('0xc')](),controller['show']);router['get'](_0xd9e6('0xf'),auth[_0xd9e6('0xc')](),controller[_0xd9e6('0x10')]);router['get'](_0xd9e6('0x11'),auth[_0xd9e6('0xc')](),controller[_0xd9e6('0x12')]);router[_0xd9e6('0xb')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xd9e6('0x13')]);router[_0xd9e6('0x14')]('/',auth[_0xd9e6('0xc')](),controller[_0xd9e6('0x15')]);router['put'](_0xd9e6('0xe'),auth[_0xd9e6('0xc')](),controller[_0xd9e6('0x16')]);router[_0xd9e6('0x17')](_0xd9e6('0xe'),auth[_0xd9e6('0xc')](),controller[_0xd9e6('0x18')]);module[_0xd9e6('0x19')]=router; \ No newline at end of file +var _0x1e3f=['./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getDescriptions','create','put','update','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x501c30,_0x3c8685){var _0x433867=function(_0x2a66c2){while(--_0x2a66c2){_0x501c30['push'](_0x501c30['shift']());}};_0x433867(++_0x3c8685);}(_0x1e3f,0x1dc));var _0xf1e3=function(_0x2ffee8,_0x126cdd){_0x2ffee8=_0x2ffee8-0x0;var _0x432ebf=_0x1e3f[_0x2ffee8];return _0x432ebf;};'use strict';var multer=require(_0xf1e3('0x0'));var util=require(_0xf1e3('0x1'));var path=require(_0xf1e3('0x2'));var timeout=require(_0xf1e3('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf1e3('0x4'));var interaction=require(_0xf1e3('0x5'));var config=require(_0xf1e3('0x6'));var controller=require(_0xf1e3('0x7'));router[_0xf1e3('0x8')]('/',auth[_0xf1e3('0x9')](),controller[_0xf1e3('0xa')]);router[_0xf1e3('0x8')](_0xf1e3('0xb'),auth[_0xf1e3('0x9')](),controller[_0xf1e3('0xc')]);router[_0xf1e3('0x8')](_0xf1e3('0xd'),auth[_0xf1e3('0x9')](),controller[_0xf1e3('0xe')]);router[_0xf1e3('0x8')](_0xf1e3('0xf'),auth[_0xf1e3('0x9')](),controller['getSubjects']);router[_0xf1e3('0x8')]('/:id/descriptions',auth[_0xf1e3('0x9')](),controller[_0xf1e3('0x10')]);router['post']('/',auth[_0xf1e3('0x9')](),controller[_0xf1e3('0x11')]);router[_0xf1e3('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xf1e3('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xf1e3('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 97afc80..b1cceb6 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 _0xb37e=['sequelize','STRING'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0xb37e,0x1e8));var _0xeb37=function(_0x5efbd7,_0x46d64c){_0x5efbd7=_0x5efbd7-0x0;var _0x4b5865=_0xb37e[_0x5efbd7];return _0x4b5865;};'use strict';var Sequelize=require(_0xeb37('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xeb37('0x1')]}}; \ No newline at end of file +var _0xe8ab=['sequelize','STRING'];(function(_0x44d9ab,_0x76bc69){var _0x31485e=function(_0x1e44ce){while(--_0x1e44ce){_0x44d9ab['push'](_0x44d9ab['shift']());}};_0x31485e(++_0x76bc69);}(_0xe8ab,0x1bc));var _0xbe8a=function(_0x52da20,_0x262bd7){_0x52da20=_0x52da20-0x0;var _0x4781f5=_0xe8ab[_0x52da20];return _0x4781f5;};'use strict';var Sequelize=require(_0xbe8a('0x0'));module['exports']={'name':{'type':Sequelize[_0xbe8a('0x1')]},'description':{'type':Sequelize[_0xbe8a('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 9434c87..7effbe4 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 _0xb276=['Content-Range','json','apply','reject','save','update','then','error','stack','name','send','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','map','intersection','query','fields','attributes','length','nolimit','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows','catch','show','params','keys','filters','options','find','create','body','destroy','findOne','SugarcrmField','getFields','getSubjects','getDescriptions','hasOwnProperty','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set'];(function(_0x454711,_0x2296e2){var _0x1488e0=function(_0x29199a){while(--_0x29199a){_0x454711['push'](_0x454711['shift']());}};_0x1488e0(++_0x2296e2);}(_0xb276,0x12e));var _0x6b27=function(_0x5ef905,_0x564b87){_0x5ef905=_0x5ef905-0x0;var _0x367808=_0xb276[_0x5ef905];return _0x367808;};'use strict';var emlformat=require(_0x6b27('0x0'));var rimraf=require(_0x6b27('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6b27('0x2'));var rp=require(_0x6b27('0x3'));var moment=require('moment');var BPromise=require(_0x6b27('0x4'));var Mustache=require(_0x6b27('0x5'));var util=require(_0x6b27('0x6'));var path=require(_0x6b27('0x7'));var sox=require(_0x6b27('0x8'));var csv=require(_0x6b27('0x9'));var ejs=require(_0x6b27('0xa'));var fs=require('fs');var fs_extra=require(_0x6b27('0xb'));var _=require(_0x6b27('0xc'));var squel=require(_0x6b27('0xd'));var crypto=require(_0x6b27('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x6b27('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6b27('0x10'));var Papa=require('papaparse');var Redis=require(_0x6b27('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6b27('0x12'));var as=require(_0x6b27('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b27('0x14'))(_0x6b27('0x15'));var utils=require(_0x6b27('0x16'));var config=require(_0x6b27('0x17'));var licenseUtil=require(_0x6b27('0x18'));var db=require(_0x6b27('0x19'))['db'];function respondWithStatusCode(_0x23c482,_0x1ad853){_0x1ad853=_0x1ad853||0xcc;return function(_0x298f58){if(_0x298f58){return _0x23c482[_0x6b27('0x1a')](_0x1ad853);}return _0x23c482[_0x6b27('0x1b')](_0x1ad853)[_0x6b27('0x1c')]();};}function respondWithResult(_0x208271,_0xbb94a){_0xbb94a=_0xbb94a||0xc8;return function(_0x363579){if(_0x363579){return _0x208271[_0x6b27('0x1b')](_0xbb94a)['json'](_0x363579);}};}function respondWithFilteredResult(_0x51a5fa,_0x4a7964){return function(_0x318bcd){if(_0x318bcd){var _0x578aef=typeof _0x4a7964[_0x6b27('0x1d')]==='undefined'&&typeof _0x4a7964[_0x6b27('0x1e')]===_0x6b27('0x1f');var _0x3dc56f=_0x318bcd['count'];var _0x29d529=_0x578aef?0x0:_0x4a7964['offset'];var _0x1f75c1=_0x578aef?_0x318bcd[_0x6b27('0x20')]:_0x4a7964[_0x6b27('0x1d')]+_0x4a7964[_0x6b27('0x1e')];var _0x296785;if(_0x1f75c1>=_0x3dc56f){_0x1f75c1=_0x3dc56f;_0x296785=0xc8;}else{_0x296785=0xce;}_0x51a5fa['status'](_0x296785);return _0x51a5fa[_0x6b27('0x21')](_0x6b27('0x22'),_0x29d529+'-'+_0x1f75c1+'/'+_0x3dc56f)[_0x6b27('0x23')](_0x318bcd);}return null;};}function patchUpdates(_0x467555){return function(_0x149ebe){try{jsonpatch[_0x6b27('0x24')](_0x149ebe,_0x467555,!![]);}catch(_0x48baae){return BPromise[_0x6b27('0x25')](_0x48baae);}return _0x149ebe[_0x6b27('0x26')]();};}function saveUpdates(_0x13412c,_0x2b7583){return function(_0x37dcb2){if(_0x37dcb2){return _0x37dcb2[_0x6b27('0x27')](_0x13412c)[_0x6b27('0x28')](function(_0x24c625){return _0x24c625;});}return null;};}function removeEntity(_0x47188e,_0x236ac2){return function(_0x30141c){if(_0x30141c){return _0x30141c['destroy']()[_0x6b27('0x28')](function(){_0x47188e[_0x6b27('0x1b')](0xcc)[_0x6b27('0x1c')]();});}};}function handleEntityNotFound(_0x469903,_0x2cbf42){return function(_0x4bbf60){if(!_0x4bbf60){_0x469903['sendStatus'](0x194);}return _0x4bbf60;};}function handleError(_0x316dc5,_0x2bb403){_0x2bb403=_0x2bb403||0x1f4;return function(_0x4cbad1){logger[_0x6b27('0x29')](_0x4cbad1[_0x6b27('0x2a')]);if(_0x4cbad1[_0x6b27('0x2b')]){delete _0x4cbad1[_0x6b27('0x2b')];}_0x316dc5[_0x6b27('0x1b')](_0x2bb403)[_0x6b27('0x2c')](_0x4cbad1);};}exports['index']=function(_0x47302f,_0x2dc011){var _0x48fe9c={},_0x59b527={},_0xfb9d3={'count':0x0,'rows':[]};var _0x11a109=_['map'](db[_0x6b27('0x2d')][_0x6b27('0x2e')],function(_0x3cde1c){return{'name':_0x3cde1c[_0x6b27('0x2f')],'type':_0x3cde1c[_0x6b27('0x30')][_0x6b27('0x31')]};});_0x59b527[_0x6b27('0x32')]=_[_0x6b27('0x33')](_0x11a109,_0x6b27('0x2b'));_0x59b527['query']=_['keys'](_0x47302f['query']);_0x59b527['filters']=_[_0x6b27('0x34')](_0x59b527['model'],_0x59b527[_0x6b27('0x35')]);_0x48fe9c['attributes']=_[_0x6b27('0x34')](_0x59b527[_0x6b27('0x32')],qs[_0x6b27('0x36')](_0x47302f[_0x6b27('0x35')][_0x6b27('0x36')]));_0x48fe9c[_0x6b27('0x37')]=_0x48fe9c[_0x6b27('0x37')][_0x6b27('0x38')]?_0x48fe9c[_0x6b27('0x37')]:_0x59b527[_0x6b27('0x32')];if(!_0x47302f[_0x6b27('0x35')]['hasOwnProperty'](_0x6b27('0x39'))){_0x48fe9c['limit']=qs[_0x6b27('0x1e')](_0x47302f['query'][_0x6b27('0x1e')]);_0x48fe9c['offset']=qs[_0x6b27('0x1d')](_0x47302f[_0x6b27('0x35')][_0x6b27('0x1d')]);}_0x48fe9c[_0x6b27('0x3a')]=qs[_0x6b27('0x3b')](_0x47302f[_0x6b27('0x35')][_0x6b27('0x3b')]);_0x48fe9c[_0x6b27('0x3c')]=qs['filters'](_[_0x6b27('0x3d')](_0x47302f[_0x6b27('0x35')],_0x59b527['filters']),_0x11a109);if(_0x47302f[_0x6b27('0x35')]['filter']){_0x48fe9c[_0x6b27('0x3c')]=_[_0x6b27('0x3e')](_0x48fe9c[_0x6b27('0x3c')],{'$or':_['map'](_0x11a109,function(_0x3ba1a0){if(_0x3ba1a0[_0x6b27('0x30')]!=='VIRTUAL'){var _0x3ee57d={};_0x3ee57d[_0x3ba1a0[_0x6b27('0x2b')]]={'$like':'%'+_0x47302f['query'][_0x6b27('0x3f')]+'%'};return _0x3ee57d;}})});}_0x48fe9c=_[_0x6b27('0x3e')]({},_0x48fe9c,_0x47302f['options']);var _0x3e2b58={'where':_0x48fe9c[_0x6b27('0x3c')]};return db[_0x6b27('0x2d')][_0x6b27('0x20')](_0x3e2b58)['then'](function(_0x374acf){_0xfb9d3[_0x6b27('0x20')]=_0x374acf;if(_0x47302f['query'][_0x6b27('0x40')]){_0x48fe9c[_0x6b27('0x41')]=[{'all':!![]}];}return db[_0x6b27('0x2d')][_0x6b27('0x42')](_0x48fe9c);})[_0x6b27('0x28')](function(_0x451572){_0xfb9d3[_0x6b27('0x43')]=_0x451572;return _0xfb9d3;})[_0x6b27('0x28')](respondWithFilteredResult(_0x2dc011,_0x48fe9c))[_0x6b27('0x44')](handleError(_0x2dc011,null));};exports[_0x6b27('0x45')]=function(_0x2bec10,_0xc67b55){var _0x252e28={'raw':![],'where':{'id':_0x2bec10[_0x6b27('0x46')]['id']}},_0x38da1b={};_0x38da1b[_0x6b27('0x32')]=_['keys'](db[_0x6b27('0x2d')][_0x6b27('0x2e')]);_0x38da1b[_0x6b27('0x35')]=_[_0x6b27('0x47')](_0x2bec10[_0x6b27('0x35')]);_0x38da1b[_0x6b27('0x48')]=_[_0x6b27('0x34')](_0x38da1b[_0x6b27('0x32')],_0x38da1b[_0x6b27('0x35')]);_0x252e28[_0x6b27('0x37')]=_[_0x6b27('0x34')](_0x38da1b[_0x6b27('0x32')],qs['fields'](_0x2bec10[_0x6b27('0x35')]['fields']));_0x252e28[_0x6b27('0x37')]=_0x252e28[_0x6b27('0x37')][_0x6b27('0x38')]?_0x252e28['attributes']:_0x38da1b[_0x6b27('0x32')];if(_0x2bec10[_0x6b27('0x35')][_0x6b27('0x40')]){_0x252e28[_0x6b27('0x41')]=[{'all':!![]}];}_0x252e28=_[_0x6b27('0x3e')]({},_0x252e28,_0x2bec10[_0x6b27('0x49')]);return db['SugarcrmConfiguration'][_0x6b27('0x4a')](_0x252e28)[_0x6b27('0x28')](handleEntityNotFound(_0xc67b55,null))['then'](respondWithResult(_0xc67b55,null))['catch'](handleError(_0xc67b55,null));};exports[_0x6b27('0x4b')]=function(_0x13344d,_0x2bf524){return db[_0x6b27('0x2d')][_0x6b27('0x4b')](_0x13344d['body'],{})[_0x6b27('0x28')](respondWithResult(_0x2bf524,0xc9))[_0x6b27('0x44')](handleError(_0x2bf524,null));};exports[_0x6b27('0x27')]=function(_0x1ad2cd,_0x527d9){if(_0x1ad2cd[_0x6b27('0x4c')]['id']){delete _0x1ad2cd[_0x6b27('0x4c')]['id'];}return db[_0x6b27('0x2d')]['find']({'where':{'id':_0x1ad2cd[_0x6b27('0x46')]['id']}})[_0x6b27('0x28')](handleEntityNotFound(_0x527d9,null))[_0x6b27('0x28')](saveUpdates(_0x1ad2cd[_0x6b27('0x4c')],null))[_0x6b27('0x28')](respondWithResult(_0x527d9,null))['catch'](handleError(_0x527d9,null));};exports[_0x6b27('0x4d')]=function(_0x4b4d86,_0x12f583){return db[_0x6b27('0x2d')][_0x6b27('0x4a')]({'where':{'id':_0x4b4d86['params']['id']}})['then'](handleEntityNotFound(_0x12f583,null))['then'](removeEntity(_0x12f583,null))[_0x6b27('0x44')](handleError(_0x12f583,null));};exports['getFields']=function(_0x3f43ce,_0x5c0c6b,_0x14118a){var _0x549150={};var _0x1e72ad={};var _0x5d6ae8;var _0x360e86;return db[_0x6b27('0x2d')][_0x6b27('0x4e')]({'where':{'id':_0x3f43ce[_0x6b27('0x46')]['id']}})['then'](handleEntityNotFound(_0x5c0c6b,null))[_0x6b27('0x28')](function(_0x1dc043){if(_0x1dc043){_0x5d6ae8=_0x1dc043;_0x1e72ad['model']=_[_0x6b27('0x47')](db[_0x6b27('0x4f')][_0x6b27('0x2e')]);_0x1e72ad[_0x6b27('0x35')]=_['keys'](_0x3f43ce[_0x6b27('0x35')]);_0x1e72ad[_0x6b27('0x48')]=_[_0x6b27('0x34')](_0x1e72ad['model'],_0x1e72ad[_0x6b27('0x35')]);_0x549150['attributes']=_[_0x6b27('0x34')](_0x1e72ad[_0x6b27('0x32')],qs[_0x6b27('0x36')](_0x3f43ce['query'][_0x6b27('0x36')]));_0x549150[_0x6b27('0x37')]=_0x549150['attributes'][_0x6b27('0x38')]?_0x549150[_0x6b27('0x37')]:_0x1e72ad[_0x6b27('0x32')];_0x549150[_0x6b27('0x3a')]=qs['sort'](_0x3f43ce[_0x6b27('0x35')][_0x6b27('0x3b')]);_0x549150[_0x6b27('0x3c')]=qs[_0x6b27('0x48')](_[_0x6b27('0x3d')](_0x3f43ce[_0x6b27('0x35')],_0x1e72ad[_0x6b27('0x48')]));if(_0x3f43ce[_0x6b27('0x35')][_0x6b27('0x3f')]){_0x549150[_0x6b27('0x3c')]=_['merge'](_0x549150[_0x6b27('0x3c')],{'$or':_[_0x6b27('0x33')](_0x549150[_0x6b27('0x37')],function(_0x4c43a2){var _0x54e759={};_0x54e759[_0x4c43a2]={'$like':'%'+_0x3f43ce['query']['filter']+'%'};return _0x54e759;})});}_0x549150=_[_0x6b27('0x3e')]({},_0x549150,_0x3f43ce['options']);return _0x5d6ae8[_0x6b27('0x50')](_0x549150);}})[_0x6b27('0x28')](function(_0x47b0c6){if(_0x47b0c6){_0x360e86=_0x47b0c6[_0x6b27('0x38')];if(!_0x3f43ce[_0x6b27('0x35')]['hasOwnProperty'](_0x6b27('0x39'))){_0x549150[_0x6b27('0x1e')]=qs[_0x6b27('0x1e')](_0x3f43ce[_0x6b27('0x35')]['limit']);_0x549150[_0x6b27('0x1d')]=qs['offset'](_0x3f43ce[_0x6b27('0x35')]['offset']);}return _0x5d6ae8[_0x6b27('0x50')](_0x549150);}})[_0x6b27('0x28')](function(_0xf04b3f){if(_0xf04b3f){return _0xf04b3f?{'count':_0x360e86,'rows':_0xf04b3f}:null;}})[_0x6b27('0x28')](respondWithResult(_0x5c0c6b,null))['catch'](handleError(_0x5c0c6b,null));};exports[_0x6b27('0x51')]=function(_0x396265,_0x3579d2,_0xf5d0ed){var _0x1013bb={};var _0x2d5c6c={};var _0x2a0333;var _0x128c74;return db[_0x6b27('0x2d')]['findOne']({'where':{'id':_0x396265[_0x6b27('0x46')]['id']}})[_0x6b27('0x28')](handleEntityNotFound(_0x3579d2,null))[_0x6b27('0x28')](function(_0xdd99f6){if(_0xdd99f6){_0x2a0333=_0xdd99f6;_0x2d5c6c[_0x6b27('0x32')]=_[_0x6b27('0x47')](db[_0x6b27('0x4f')][_0x6b27('0x2e')]);_0x2d5c6c[_0x6b27('0x35')]=_[_0x6b27('0x47')](_0x396265[_0x6b27('0x35')]);_0x2d5c6c[_0x6b27('0x48')]=_[_0x6b27('0x34')](_0x2d5c6c['model'],_0x2d5c6c['query']);_0x1013bb[_0x6b27('0x37')]=_[_0x6b27('0x34')](_0x2d5c6c[_0x6b27('0x32')],qs['fields'](_0x396265[_0x6b27('0x35')][_0x6b27('0x36')]));_0x1013bb[_0x6b27('0x37')]=_0x1013bb[_0x6b27('0x37')]['length']?_0x1013bb[_0x6b27('0x37')]:_0x2d5c6c[_0x6b27('0x32')];_0x1013bb[_0x6b27('0x3a')]=qs[_0x6b27('0x3b')](_0x396265[_0x6b27('0x35')]['sort']);_0x1013bb[_0x6b27('0x3c')]=qs['filters'](_[_0x6b27('0x3d')](_0x396265[_0x6b27('0x35')],_0x2d5c6c['filters']));if(_0x396265['query']['filter']){_0x1013bb[_0x6b27('0x3c')]=_['merge'](_0x1013bb['where'],{'$or':_[_0x6b27('0x33')](_0x1013bb[_0x6b27('0x37')],function(_0x234173){var _0x179114={};_0x179114[_0x234173]={'$like':'%'+_0x396265[_0x6b27('0x35')][_0x6b27('0x3f')]+'%'};return _0x179114;})});}_0x1013bb=_[_0x6b27('0x3e')]({},_0x1013bb,_0x396265[_0x6b27('0x49')]);return _0x2a0333[_0x6b27('0x51')](_0x1013bb);}})[_0x6b27('0x28')](function(_0x1a0dfa){if(_0x1a0dfa){_0x128c74=_0x1a0dfa[_0x6b27('0x38')];if(!_0x396265[_0x6b27('0x35')]['hasOwnProperty'](_0x6b27('0x39'))){_0x1013bb[_0x6b27('0x1e')]=qs[_0x6b27('0x1e')](_0x396265[_0x6b27('0x35')]['limit']);_0x1013bb[_0x6b27('0x1d')]=qs['offset'](_0x396265['query'][_0x6b27('0x1d')]);}return _0x2a0333[_0x6b27('0x51')](_0x1013bb);}})[_0x6b27('0x28')](function(_0x1e15b5){if(_0x1e15b5){return _0x1e15b5?{'count':_0x128c74,'rows':_0x1e15b5}:null;}})['then'](respondWithResult(_0x3579d2,null))['catch'](handleError(_0x3579d2,null));};exports[_0x6b27('0x52')]=function(_0x3e50ad,_0x5b05b6,_0x54d61f){var _0x12522b={};var _0x420495={};var _0x226354;var _0x5de921;return db[_0x6b27('0x2d')][_0x6b27('0x4e')]({'where':{'id':_0x3e50ad[_0x6b27('0x46')]['id']}})['then'](handleEntityNotFound(_0x5b05b6,null))[_0x6b27('0x28')](function(_0x1d1f41){if(_0x1d1f41){_0x226354=_0x1d1f41;_0x420495[_0x6b27('0x32')]=_['keys'](db[_0x6b27('0x4f')][_0x6b27('0x2e')]);_0x420495[_0x6b27('0x35')]=_[_0x6b27('0x47')](_0x3e50ad[_0x6b27('0x35')]);_0x420495[_0x6b27('0x48')]=_['intersection'](_0x420495[_0x6b27('0x32')],_0x420495['query']);_0x12522b[_0x6b27('0x37')]=_[_0x6b27('0x34')](_0x420495[_0x6b27('0x32')],qs[_0x6b27('0x36')](_0x3e50ad[_0x6b27('0x35')][_0x6b27('0x36')]));_0x12522b['attributes']=_0x12522b[_0x6b27('0x37')][_0x6b27('0x38')]?_0x12522b[_0x6b27('0x37')]:_0x420495[_0x6b27('0x32')];_0x12522b[_0x6b27('0x3a')]=qs[_0x6b27('0x3b')](_0x3e50ad[_0x6b27('0x35')]['sort']);_0x12522b[_0x6b27('0x3c')]=qs[_0x6b27('0x48')](_[_0x6b27('0x3d')](_0x3e50ad['query'],_0x420495[_0x6b27('0x48')]));if(_0x3e50ad['query']['filter']){_0x12522b['where']=_[_0x6b27('0x3e')](_0x12522b[_0x6b27('0x3c')],{'$or':_['map'](_0x12522b[_0x6b27('0x37')],function(_0x3cd451){var _0x501159={};_0x501159[_0x3cd451]={'$like':'%'+_0x3e50ad[_0x6b27('0x35')][_0x6b27('0x3f')]+'%'};return _0x501159;})});}_0x12522b=_[_0x6b27('0x3e')]({},_0x12522b,_0x3e50ad[_0x6b27('0x49')]);return _0x226354['getDescriptions'](_0x12522b);}})[_0x6b27('0x28')](function(_0x212257){if(_0x212257){_0x5de921=_0x212257[_0x6b27('0x38')];if(!_0x3e50ad['query'][_0x6b27('0x53')](_0x6b27('0x39'))){_0x12522b[_0x6b27('0x1e')]=qs[_0x6b27('0x1e')](_0x3e50ad[_0x6b27('0x35')][_0x6b27('0x1e')]);_0x12522b[_0x6b27('0x1d')]=qs[_0x6b27('0x1d')](_0x3e50ad[_0x6b27('0x35')][_0x6b27('0x1d')]);}return _0x226354['getDescriptions'](_0x12522b);}})[_0x6b27('0x28')](function(_0xbda66d){if(_0xbda66d){return _0xbda66d?{'count':_0x5de921,'rows':_0xbda66d}:null;}})[_0x6b27('0x28')](respondWithResult(_0x5b05b6,null))[_0x6b27('0x44')](handleError(_0x5b05b6,null));}; \ No newline at end of file +var _0x6910=['attributes','length','nolimit','order','where','pick','filter','merge','map','options','SugarcrmConfiguration','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','getFields','findOne','SugarcrmField','rawAttributes','sort','getSubjects','hasOwnProperty','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','destroy','then','stack','name','index','fieldName','type','key','model','query','filters','intersection','fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6910,0x6c));var _0x0691=function(_0xf89181,_0x2b1f87){_0xf89181=_0xf89181-0x0;var _0x4803f3=_0x6910[_0xf89181];return _0x4803f3;};'use strict';var emlformat=require(_0x0691('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0691('0x1'));var jsonpatch=require(_0x0691('0x2'));var rp=require('request-promise');var moment=require(_0x0691('0x3'));var BPromise=require(_0x0691('0x4'));var Mustache=require(_0x0691('0x5'));var util=require(_0x0691('0x6'));var path=require(_0x0691('0x7'));var sox=require(_0x0691('0x8'));var csv=require('to-csv');var ejs=require(_0x0691('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0691('0xa'));var crypto=require(_0x0691('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0691('0xc'));var toCsv=require(_0x0691('0xd'));var querystring=require(_0x0691('0xe'));var Papa=require(_0x0691('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0691('0x10'));var as=require(_0x0691('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0691('0x12'))('api');var utils=require(_0x0691('0x13'));var config=require(_0x0691('0x14'));var licenseUtil=require(_0x0691('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44eaa0,_0x571e31){_0x571e31=_0x571e31||0xcc;return function(_0x3ca1a7){if(_0x3ca1a7){return _0x44eaa0[_0x0691('0x16')](_0x571e31);}return _0x44eaa0[_0x0691('0x17')](_0x571e31)[_0x0691('0x18')]();};}function respondWithResult(_0x2e561b,_0x545c57){_0x545c57=_0x545c57||0xc8;return function(_0x5ef9a4){if(_0x5ef9a4){return _0x2e561b[_0x0691('0x17')](_0x545c57)[_0x0691('0x19')](_0x5ef9a4);}};}function respondWithFilteredResult(_0x22b9ed,_0x20ce69){return function(_0x947049){if(_0x947049){var _0x54e599=typeof _0x20ce69[_0x0691('0x1a')]==='undefined'&&typeof _0x20ce69[_0x0691('0x1b')]===_0x0691('0x1c');var _0x49d2c0=_0x947049[_0x0691('0x1d')];var _0x541a09=_0x54e599?0x0:_0x20ce69[_0x0691('0x1a')];var _0x11ce2a=_0x54e599?_0x947049[_0x0691('0x1d')]:_0x20ce69[_0x0691('0x1a')]+_0x20ce69[_0x0691('0x1b')];var _0x15ef10;if(_0x11ce2a>=_0x49d2c0){_0x11ce2a=_0x49d2c0;_0x15ef10=0xc8;}else{_0x15ef10=0xce;}_0x22b9ed[_0x0691('0x17')](_0x15ef10);return _0x22b9ed[_0x0691('0x1e')](_0x0691('0x1f'),_0x541a09+'-'+_0x11ce2a+'/'+_0x49d2c0)[_0x0691('0x19')](_0x947049);}return null;};}function patchUpdates(_0x2f1077){return function(_0x41c1de){try{jsonpatch['apply'](_0x41c1de,_0x2f1077,!![]);}catch(_0x229137){return BPromise['reject'](_0x229137);}return _0x41c1de[_0x0691('0x20')]();};}function saveUpdates(_0x4aca6d,_0x210b89){return function(_0x58cb90){if(_0x58cb90){return _0x58cb90['update'](_0x4aca6d)['then'](function(_0x346301){return _0x346301;});}return null;};}function removeEntity(_0x1f85ef,_0x2e2bea){return function(_0x438c3f){if(_0x438c3f){return _0x438c3f[_0x0691('0x21')]()[_0x0691('0x22')](function(){_0x1f85ef[_0x0691('0x17')](0xcc)[_0x0691('0x18')]();});}};}function handleEntityNotFound(_0x9779a3,_0x40c854){return function(_0x4cc168){if(!_0x4cc168){_0x9779a3[_0x0691('0x16')](0x194);}return _0x4cc168;};}function handleError(_0x55578c,_0x506cf2){_0x506cf2=_0x506cf2||0x1f4;return function(_0x394180){logger['error'](_0x394180[_0x0691('0x23')]);if(_0x394180[_0x0691('0x24')]){delete _0x394180[_0x0691('0x24')];}_0x55578c[_0x0691('0x17')](_0x506cf2)['send'](_0x394180);};}exports[_0x0691('0x25')]=function(_0x5f6b62,_0x2132be){var _0x3f227b={},_0x35fad7={},_0x223813={'count':0x0,'rows':[]};var _0x1bbf30=_['map'](db['SugarcrmConfiguration']['rawAttributes'],function(_0x581a0f){return{'name':_0x581a0f[_0x0691('0x26')],'type':_0x581a0f[_0x0691('0x27')][_0x0691('0x28')]};});_0x35fad7[_0x0691('0x29')]=_['map'](_0x1bbf30,_0x0691('0x24'));_0x35fad7[_0x0691('0x2a')]=_['keys'](_0x5f6b62['query']);_0x35fad7[_0x0691('0x2b')]=_[_0x0691('0x2c')](_0x35fad7[_0x0691('0x29')],_0x35fad7['query']);_0x3f227b['attributes']=_[_0x0691('0x2c')](_0x35fad7[_0x0691('0x29')],qs[_0x0691('0x2d')](_0x5f6b62[_0x0691('0x2a')]['fields']));_0x3f227b[_0x0691('0x2e')]=_0x3f227b['attributes'][_0x0691('0x2f')]?_0x3f227b[_0x0691('0x2e')]:_0x35fad7[_0x0691('0x29')];if(!_0x5f6b62[_0x0691('0x2a')]['hasOwnProperty'](_0x0691('0x30'))){_0x3f227b[_0x0691('0x1b')]=qs[_0x0691('0x1b')](_0x5f6b62['query'][_0x0691('0x1b')]);_0x3f227b[_0x0691('0x1a')]=qs[_0x0691('0x1a')](_0x5f6b62[_0x0691('0x2a')][_0x0691('0x1a')]);}_0x3f227b[_0x0691('0x31')]=qs['sort'](_0x5f6b62[_0x0691('0x2a')]['sort']);_0x3f227b[_0x0691('0x32')]=qs['filters'](_[_0x0691('0x33')](_0x5f6b62[_0x0691('0x2a')],_0x35fad7[_0x0691('0x2b')]),_0x1bbf30);if(_0x5f6b62[_0x0691('0x2a')][_0x0691('0x34')]){_0x3f227b['where']=_[_0x0691('0x35')](_0x3f227b['where'],{'$or':_[_0x0691('0x36')](_0x1bbf30,function(_0x5703b5){if(_0x5703b5[_0x0691('0x27')]!=='VIRTUAL'){var _0x4af6ce={};_0x4af6ce[_0x5703b5[_0x0691('0x24')]]={'$like':'%'+_0x5f6b62['query'][_0x0691('0x34')]+'%'};return _0x4af6ce;}})});}_0x3f227b=_[_0x0691('0x35')]({},_0x3f227b,_0x5f6b62[_0x0691('0x37')]);var _0x57b578={'where':_0x3f227b['where']};return db[_0x0691('0x38')]['count'](_0x57b578)[_0x0691('0x22')](function(_0x36e3db){_0x223813['count']=_0x36e3db;if(_0x5f6b62[_0x0691('0x2a')][_0x0691('0x39')]){_0x3f227b[_0x0691('0x3a')]=[{'all':!![]}];}return db[_0x0691('0x38')][_0x0691('0x3b')](_0x3f227b);})[_0x0691('0x22')](function(_0x13cd4e){_0x223813[_0x0691('0x3c')]=_0x13cd4e;return _0x223813;})['then'](respondWithFilteredResult(_0x2132be,_0x3f227b))[_0x0691('0x3d')](handleError(_0x2132be,null));};exports[_0x0691('0x3e')]=function(_0x26ae91,_0x39d252){var _0x4132f1={'raw':![],'where':{'id':_0x26ae91[_0x0691('0x3f')]['id']}},_0x200093={};_0x200093[_0x0691('0x29')]=_[_0x0691('0x40')](db['SugarcrmConfiguration']['rawAttributes']);_0x200093[_0x0691('0x2a')]=_['keys'](_0x26ae91['query']);_0x200093[_0x0691('0x2b')]=_[_0x0691('0x2c')](_0x200093['model'],_0x200093['query']);_0x4132f1[_0x0691('0x2e')]=_[_0x0691('0x2c')](_0x200093[_0x0691('0x29')],qs['fields'](_0x26ae91[_0x0691('0x2a')][_0x0691('0x2d')]));_0x4132f1[_0x0691('0x2e')]=_0x4132f1['attributes'][_0x0691('0x2f')]?_0x4132f1[_0x0691('0x2e')]:_0x200093[_0x0691('0x29')];if(_0x26ae91[_0x0691('0x2a')][_0x0691('0x39')]){_0x4132f1['include']=[{'all':!![]}];}_0x4132f1=_[_0x0691('0x35')]({},_0x4132f1,_0x26ae91[_0x0691('0x37')]);return db[_0x0691('0x38')][_0x0691('0x41')](_0x4132f1)[_0x0691('0x22')](handleEntityNotFound(_0x39d252,null))[_0x0691('0x22')](respondWithResult(_0x39d252,null))[_0x0691('0x3d')](handleError(_0x39d252,null));};exports[_0x0691('0x42')]=function(_0x2065c5,_0x8b144c){return db[_0x0691('0x38')][_0x0691('0x42')](_0x2065c5[_0x0691('0x43')],{})[_0x0691('0x22')](respondWithResult(_0x8b144c,0xc9))[_0x0691('0x3d')](handleError(_0x8b144c,null));};exports[_0x0691('0x44')]=function(_0x10f927,_0x453f58){if(_0x10f927[_0x0691('0x43')]['id']){delete _0x10f927[_0x0691('0x43')]['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x10f927[_0x0691('0x3f')]['id']}})[_0x0691('0x22')](handleEntityNotFound(_0x453f58,null))[_0x0691('0x22')](saveUpdates(_0x10f927['body'],null))[_0x0691('0x22')](respondWithResult(_0x453f58,null))[_0x0691('0x3d')](handleError(_0x453f58,null));};exports['destroy']=function(_0x5772cc,_0xb7f836){return db[_0x0691('0x38')]['find']({'where':{'id':_0x5772cc[_0x0691('0x3f')]['id']}})['then'](handleEntityNotFound(_0xb7f836,null))[_0x0691('0x22')](removeEntity(_0xb7f836,null))[_0x0691('0x3d')](handleError(_0xb7f836,null));};exports[_0x0691('0x45')]=function(_0x1b4212,_0x4a5346,_0x4cc228){var _0x4f7678={};var _0x4564f2={};var _0x39c59d;var _0x4e3f29;return db[_0x0691('0x38')][_0x0691('0x46')]({'where':{'id':_0x1b4212[_0x0691('0x3f')]['id']}})[_0x0691('0x22')](handleEntityNotFound(_0x4a5346,null))[_0x0691('0x22')](function(_0x5c8f42){if(_0x5c8f42){_0x39c59d=_0x5c8f42;_0x4564f2['model']=_[_0x0691('0x40')](db[_0x0691('0x47')][_0x0691('0x48')]);_0x4564f2[_0x0691('0x2a')]=_[_0x0691('0x40')](_0x1b4212[_0x0691('0x2a')]);_0x4564f2[_0x0691('0x2b')]=_[_0x0691('0x2c')](_0x4564f2[_0x0691('0x29')],_0x4564f2[_0x0691('0x2a')]);_0x4f7678['attributes']=_[_0x0691('0x2c')](_0x4564f2['model'],qs[_0x0691('0x2d')](_0x1b4212[_0x0691('0x2a')]['fields']));_0x4f7678['attributes']=_0x4f7678[_0x0691('0x2e')][_0x0691('0x2f')]?_0x4f7678[_0x0691('0x2e')]:_0x4564f2[_0x0691('0x29')];_0x4f7678[_0x0691('0x31')]=qs['sort'](_0x1b4212[_0x0691('0x2a')][_0x0691('0x49')]);_0x4f7678[_0x0691('0x32')]=qs[_0x0691('0x2b')](_[_0x0691('0x33')](_0x1b4212[_0x0691('0x2a')],_0x4564f2[_0x0691('0x2b')]));if(_0x1b4212[_0x0691('0x2a')]['filter']){_0x4f7678['where']=_['merge'](_0x4f7678[_0x0691('0x32')],{'$or':_['map'](_0x4f7678[_0x0691('0x2e')],function(_0x2156ee){var _0x4ab1ff={};_0x4ab1ff[_0x2156ee]={'$like':'%'+_0x1b4212[_0x0691('0x2a')][_0x0691('0x34')]+'%'};return _0x4ab1ff;})});}_0x4f7678=_[_0x0691('0x35')]({},_0x4f7678,_0x1b4212[_0x0691('0x37')]);return _0x39c59d[_0x0691('0x45')](_0x4f7678);}})[_0x0691('0x22')](function(_0x3cf2ad){if(_0x3cf2ad){_0x4e3f29=_0x3cf2ad[_0x0691('0x2f')];if(!_0x1b4212[_0x0691('0x2a')]['hasOwnProperty'](_0x0691('0x30'))){_0x4f7678[_0x0691('0x1b')]=qs[_0x0691('0x1b')](_0x1b4212[_0x0691('0x2a')][_0x0691('0x1b')]);_0x4f7678['offset']=qs[_0x0691('0x1a')](_0x1b4212['query'][_0x0691('0x1a')]);}return _0x39c59d[_0x0691('0x45')](_0x4f7678);}})[_0x0691('0x22')](function(_0x3288a9){if(_0x3288a9){return _0x3288a9?{'count':_0x4e3f29,'rows':_0x3288a9}:null;}})['then'](respondWithResult(_0x4a5346,null))[_0x0691('0x3d')](handleError(_0x4a5346,null));};exports[_0x0691('0x4a')]=function(_0x2c6db8,_0x35f105,_0x16a4ed){var _0x20f403={};var _0x2dad10={};var _0x2d74fa;var _0x3028b3;return db[_0x0691('0x38')][_0x0691('0x46')]({'where':{'id':_0x2c6db8[_0x0691('0x3f')]['id']}})[_0x0691('0x22')](handleEntityNotFound(_0x35f105,null))[_0x0691('0x22')](function(_0x1a258b){if(_0x1a258b){_0x2d74fa=_0x1a258b;_0x2dad10[_0x0691('0x29')]=_[_0x0691('0x40')](db[_0x0691('0x47')][_0x0691('0x48')]);_0x2dad10[_0x0691('0x2a')]=_[_0x0691('0x40')](_0x2c6db8[_0x0691('0x2a')]);_0x2dad10['filters']=_[_0x0691('0x2c')](_0x2dad10['model'],_0x2dad10[_0x0691('0x2a')]);_0x20f403[_0x0691('0x2e')]=_['intersection'](_0x2dad10[_0x0691('0x29')],qs[_0x0691('0x2d')](_0x2c6db8['query'][_0x0691('0x2d')]));_0x20f403[_0x0691('0x2e')]=_0x20f403[_0x0691('0x2e')][_0x0691('0x2f')]?_0x20f403['attributes']:_0x2dad10[_0x0691('0x29')];_0x20f403[_0x0691('0x31')]=qs[_0x0691('0x49')](_0x2c6db8[_0x0691('0x2a')][_0x0691('0x49')]);_0x20f403[_0x0691('0x32')]=qs[_0x0691('0x2b')](_['pick'](_0x2c6db8[_0x0691('0x2a')],_0x2dad10[_0x0691('0x2b')]));if(_0x2c6db8[_0x0691('0x2a')]['filter']){_0x20f403['where']=_['merge'](_0x20f403[_0x0691('0x32')],{'$or':_[_0x0691('0x36')](_0x20f403[_0x0691('0x2e')],function(_0x3ab8ec){var _0x27dda8={};_0x27dda8[_0x3ab8ec]={'$like':'%'+_0x2c6db8['query'][_0x0691('0x34')]+'%'};return _0x27dda8;})});}_0x20f403=_['merge']({},_0x20f403,_0x2c6db8[_0x0691('0x37')]);return _0x2d74fa['getSubjects'](_0x20f403);}})[_0x0691('0x22')](function(_0x4ca170){if(_0x4ca170){_0x3028b3=_0x4ca170[_0x0691('0x2f')];if(!_0x2c6db8[_0x0691('0x2a')][_0x0691('0x4b')](_0x0691('0x30'))){_0x20f403[_0x0691('0x1b')]=qs['limit'](_0x2c6db8[_0x0691('0x2a')][_0x0691('0x1b')]);_0x20f403[_0x0691('0x1a')]=qs[_0x0691('0x1a')](_0x2c6db8['query']['offset']);}return _0x2d74fa[_0x0691('0x4a')](_0x20f403);}})[_0x0691('0x22')](function(_0x3ecfd5){if(_0x3ecfd5){return _0x3ecfd5?{'count':_0x3028b3,'rows':_0x3ecfd5}:null;}})[_0x0691('0x22')](respondWithResult(_0x35f105,null))[_0x0691('0x3d')](handleError(_0x35f105,null));};exports[_0x0691('0x4c')]=function(_0x39f9cc,_0x29409e,_0x400865){var _0x5afe3f={};var _0x4b586f={};var _0x21dee5;var _0x5755bc;return db[_0x0691('0x38')][_0x0691('0x46')]({'where':{'id':_0x39f9cc[_0x0691('0x3f')]['id']}})[_0x0691('0x22')](handleEntityNotFound(_0x29409e,null))['then'](function(_0x5926ce){if(_0x5926ce){_0x21dee5=_0x5926ce;_0x4b586f[_0x0691('0x29')]=_[_0x0691('0x40')](db[_0x0691('0x47')][_0x0691('0x48')]);_0x4b586f[_0x0691('0x2a')]=_['keys'](_0x39f9cc[_0x0691('0x2a')]);_0x4b586f[_0x0691('0x2b')]=_[_0x0691('0x2c')](_0x4b586f[_0x0691('0x29')],_0x4b586f[_0x0691('0x2a')]);_0x5afe3f['attributes']=_[_0x0691('0x2c')](_0x4b586f[_0x0691('0x29')],qs[_0x0691('0x2d')](_0x39f9cc[_0x0691('0x2a')][_0x0691('0x2d')]));_0x5afe3f[_0x0691('0x2e')]=_0x5afe3f[_0x0691('0x2e')][_0x0691('0x2f')]?_0x5afe3f[_0x0691('0x2e')]:_0x4b586f[_0x0691('0x29')];_0x5afe3f[_0x0691('0x31')]=qs[_0x0691('0x49')](_0x39f9cc['query'][_0x0691('0x49')]);_0x5afe3f[_0x0691('0x32')]=qs[_0x0691('0x2b')](_[_0x0691('0x33')](_0x39f9cc['query'],_0x4b586f['filters']));if(_0x39f9cc[_0x0691('0x2a')][_0x0691('0x34')]){_0x5afe3f[_0x0691('0x32')]=_[_0x0691('0x35')](_0x5afe3f[_0x0691('0x32')],{'$or':_[_0x0691('0x36')](_0x5afe3f[_0x0691('0x2e')],function(_0x25ce64){var _0x519751={};_0x519751[_0x25ce64]={'$like':'%'+_0x39f9cc[_0x0691('0x2a')][_0x0691('0x34')]+'%'};return _0x519751;})});}_0x5afe3f=_[_0x0691('0x35')]({},_0x5afe3f,_0x39f9cc['options']);return _0x21dee5[_0x0691('0x4c')](_0x5afe3f);}})['then'](function(_0x757f28){if(_0x757f28){_0x5755bc=_0x757f28[_0x0691('0x2f')];if(!_0x39f9cc[_0x0691('0x2a')]['hasOwnProperty'](_0x0691('0x30'))){_0x5afe3f[_0x0691('0x1b')]=qs['limit'](_0x39f9cc['query'][_0x0691('0x1b')]);_0x5afe3f['offset']=qs['offset'](_0x39f9cc[_0x0691('0x2a')][_0x0691('0x1a')]);}return _0x21dee5[_0x0691('0x4c')](_0x5afe3f);}})[_0x0691('0x22')](function(_0x3b9346){if(_0x3b9346){return _0x3b9346?{'count':_0x5755bc,'rows':_0x3b9346}:null;}})[_0x0691('0x22')](respondWithResult(_0x29409e,null))['catch'](handleError(_0x29409e,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 4d8404e..49e0357 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 _0x979b=['moment','bluebird','request-promise','path','../../config/environment','exports','define','int_sugarcrm_configurations','lodash','util','api'];(function(_0x6020f7,_0x486841){var _0x5e00d9=function(_0x4f082f){while(--_0x4f082f){_0x6020f7['push'](_0x6020f7['shift']());}};_0x5e00d9(++_0x486841);}(_0x979b,0x1d6));var _0xb979=function(_0x2e6c19,_0x131233){_0x2e6c19=_0x2e6c19-0x0;var _0x52885d=_0x979b[_0x2e6c19];return _0x52885d;};'use strict';var _=require(_0xb979('0x0'));var util=require(_0xb979('0x1'));var logger=require('../../config/logger')(_0xb979('0x2'));var moment=require(_0xb979('0x3'));var BPromise=require(_0xb979('0x4'));var rp=require(_0xb979('0x5'));var fs=require('fs');var path=require(_0xb979('0x6'));var rimraf=require('rimraf');var config=require(_0xb979('0x7'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0xb979('0x8')]=function(_0x4b768a,_0x3a33de){return _0x4b768a[_0xb979('0x9')]('SugarcrmConfiguration',attributes,{'tableName':_0xb979('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9310=['request-promise','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','api','moment','bluebird'];(function(_0x3ec9ee,_0x16bd92){var _0x2160e2=function(_0x1fd8d2){while(--_0x1fd8d2){_0x3ec9ee['push'](_0x3ec9ee['shift']());}};_0x2160e2(++_0x16bd92);}(_0x9310,0x181));var _0x0931=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x9310[_0x29d94e];return _0x106237;};'use strict';var _=require(_0x0931('0x0'));var util=require(_0x0931('0x1'));var logger=require('../../config/logger')(_0x0931('0x2'));var moment=require(_0x0931('0x3'));var BPromise=require(_0x0931('0x4'));var rp=require(_0x0931('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0931('0x6'));var config=require(_0x0931('0x7'));var attributes=require(_0x0931('0x8'));module[_0x0931('0x9')]=function(_0x40d4bb,_0x501d70){return _0x40d4bb[_0x0931('0xa')](_0x0931('0xb'),attributes,{'tableName':_0x0931('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 65622f9..9f0ac0a 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 _0x685b=['request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x685b,0x1d4));var _0xb685=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x685b[_0x4b7895];return _0x264180;};'use strict';var _=require(_0xb685('0x0'));var util=require(_0xb685('0x1'));var moment=require(_0xb685('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb685('0x3'));var db=require(_0xb685('0x4'))['db'];var utils=require(_0xb685('0x5'));var logger=require(_0xb685('0x6'))(_0xb685('0x7'));var config=require(_0xb685('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb685('0x9')][_0xb685('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bc5db,_0x1fd76e,_0x25d50f){return new BPromise(function(_0x296a07,_0x384aa6){return client[_0xb685('0xb')](_0x2bc5db,_0x25d50f)[_0xb685('0xc')](function(_0x2a641e){logger[_0xb685('0xd')](_0xb685('0xe'),_0x1fd76e,_0xb685('0xf'));logger[_0xb685('0x10')](_0xb685('0x11'),_0x1fd76e,_0xb685('0xf'),JSON['stringify'](_0x2a641e));if(_0x2a641e[_0xb685('0x12')]){if(_0x2a641e[_0xb685('0x12')][_0xb685('0x13')]===0x1f4){logger[_0xb685('0x12')](_0xb685('0xe'),_0x1fd76e,_0x2a641e[_0xb685('0x12')][_0xb685('0x14')]);return _0x384aa6(_0x2a641e[_0xb685('0x12')][_0xb685('0x14')]);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x1fd76e,_0x2a641e['error'][_0xb685('0x14')]);return _0x296a07(_0x2a641e['error'][_0xb685('0x14')]);}else{logger[_0xb685('0xd')](_0xb685('0xe'),_0x1fd76e,'request\x20sent');_0x296a07(_0x2a641e[_0xb685('0x15')][_0xb685('0x14')]);}})[_0xb685('0x16')](function(_0x43ad90){logger[_0xb685('0x12')](_0xb685('0xe'),_0x1fd76e,_0x43ad90);_0x384aa6(_0x43ad90);});});} \ No newline at end of file +var _0x1eec=['info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x1eec,0x181));var _0xc1ee=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x1eec[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xc1ee('0x0'));var util=require(_0xc1ee('0x1'));var moment=require(_0xc1ee('0x2'));var BPromise=require(_0xc1ee('0x3'));var rs=require(_0xc1ee('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc1ee('0x5'));var logger=require(_0xc1ee('0x6'))('rpc');var config=require(_0xc1ee('0x7'));var jayson=require(_0xc1ee('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2a815d,_0x3bece2,_0x2680c4){return new BPromise(function(_0x363074,_0x39c19b){return client[_0xc1ee('0x9')](_0x2a815d,_0x2680c4)[_0xc1ee('0xa')](function(_0x7c882b){logger[_0xc1ee('0xb')](_0xc1ee('0xc'),_0x3bece2,_0xc1ee('0xd'));logger[_0xc1ee('0xe')](_0xc1ee('0xf'),_0x3bece2,_0xc1ee('0xd'),JSON[_0xc1ee('0x10')](_0x7c882b));if(_0x7c882b[_0xc1ee('0x11')]){if(_0x7c882b[_0xc1ee('0x11')][_0xc1ee('0x12')]===0x1f4){logger[_0xc1ee('0x11')](_0xc1ee('0xc'),_0x3bece2,_0x7c882b[_0xc1ee('0x11')]['message']);return _0x39c19b(_0x7c882b[_0xc1ee('0x11')]['message']);}logger[_0xc1ee('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3bece2,_0x7c882b['error'][_0xc1ee('0x13')]);return _0x363074(_0x7c882b['error'][_0xc1ee('0x13')]);}else{logger['info'](_0xc1ee('0xc'),_0x3bece2,_0xc1ee('0xd'));_0x363074(_0x7c882b[_0xc1ee('0x14')][_0xc1ee('0x13')]);}})[_0xc1ee('0x15')](function(_0x42fdd8){logger[_0xc1ee('0x11')](_0xc1ee('0xc'),_0x3bece2,_0x42fdd8);_0x39c19b(_0x42fdd8);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index a9fa792..e0ecb78 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 _0x8e81=['post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id'];(function(_0x48c10c,_0x2cd4a2){var _0x2a3540=function(_0x3dcfb6){while(--_0x3dcfb6){_0x48c10c['push'](_0x48c10c['shift']());}};_0x2a3540(++_0x2cd4a2);}(_0x8e81,0x6a));var _0x18e8=function(_0x3e6f67,_0x4b63e1){_0x3e6f67=_0x3e6f67-0x0;var _0x30febf=_0x8e81[_0x3e6f67];return _0x30febf;};'use strict';var multer=require(_0x18e8('0x0'));var util=require(_0x18e8('0x1'));var path=require(_0x18e8('0x2'));var timeout=require(_0x18e8('0x3'));var express=require(_0x18e8('0x4'));var router=express[_0x18e8('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x18e8('0x6'));var interaction=require(_0x18e8('0x7'));var config=require(_0x18e8('0x8'));var controller=require(_0x18e8('0x9'));router[_0x18e8('0xa')]('/',auth[_0x18e8('0xb')](),controller[_0x18e8('0xc')]);router['get'](_0x18e8('0xd'),auth[_0x18e8('0xb')](),controller['show']);router[_0x18e8('0xe')]('/',auth['isAuthenticated'](),controller[_0x18e8('0xf')]);router['put'](_0x18e8('0xd'),auth[_0x18e8('0xb')](),controller[_0x18e8('0x10')]);router[_0x18e8('0x11')](_0x18e8('0xd'),auth['isAuthenticated'](),controller[_0x18e8('0x12')]);module[_0x18e8('0x13')]=router; \ No newline at end of file +var _0x79f0=['util','path','express','fs-extra','../../config/environment','./intSugarcrmField.controller','get','index','/:id','post','isAuthenticated','create','put','update','delete','exports','multer'];(function(_0x554ae4,_0x127ecb){var _0x1a5085=function(_0x2ffdc5){while(--_0x2ffdc5){_0x554ae4['push'](_0x554ae4['shift']());}};_0x1a5085(++_0x127ecb);}(_0x79f0,0x164));var _0x079f=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x79f0[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x079f('0x0'));var util=require(_0x079f('0x1'));var path=require(_0x079f('0x2'));var timeout=require('connect-timeout');var express=require(_0x079f('0x3'));var router=express['Router']();var fs_extra=require(_0x079f('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x079f('0x5'));var controller=require(_0x079f('0x6'));router[_0x079f('0x7')]('/',auth['isAuthenticated'](),controller[_0x079f('0x8')]);router[_0x079f('0x7')](_0x079f('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x079f('0xa')]('/',auth[_0x079f('0xb')](),controller[_0x079f('0xc')]);router[_0x079f('0xd')](_0x079f('0x9'),auth['isAuthenticated'](),controller[_0x079f('0xe')]);router[_0x079f('0xf')](_0x079f('0x9'),auth[_0x079f('0xb')](),controller['destroy']);module[_0x079f('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index ffbe5c9..e96b48c 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 _0xedb5=['string','variable','customVariable','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x1a31ea,_0x60234e){var _0x4554d6=function(_0x4dd4f5){while(--_0x4dd4f5){_0x1a31ea['push'](_0x1a31ea['shift']());}};_0x4554d6(++_0x60234e);}(_0xedb5,0xec));var _0x5edb=function(_0x5d5a60,_0x1f7ac5){_0x5d5a60=_0x5d5a60-0x0;var _0xa17b1f=_0xedb5[_0x5d5a60];return _0xa17b1f;};'use strict';var Sequelize=require(_0x5edb('0x0'));module['exports']={'type':{'type':Sequelize[_0x5edb('0x1')](_0x5edb('0x2'),_0x5edb('0x3'),_0x5edb('0x4'),'keyValue','picklist'),'defaultValue':_0x5edb('0x2')},'content':{'type':Sequelize[_0x5edb('0x5')]},'key':{'type':Sequelize[_0x5edb('0x5')]},'keyType':{'type':Sequelize[_0x5edb('0x1')](_0x5edb('0x2'),_0x5edb('0x3'),_0x5edb('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x5edb('0x5')]},'customField':{'type':Sequelize[_0x5edb('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2a4a=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x4f9055,_0x2219d9){var _0x4684d0=function(_0x1bdd6b){while(--_0x1bdd6b){_0x4f9055['push'](_0x4f9055['shift']());}};_0x4684d0(++_0x2219d9);}(_0x2a4a,0x1ef));var _0xa2a4=function(_0x48e66a,_0x2be549){_0x48e66a=_0x48e66a-0x0;var _0x3c9d9f=_0x2a4a[_0x48e66a];return _0x3c9d9f;};'use strict';var Sequelize=require(_0xa2a4('0x0'));module[_0xa2a4('0x1')]={'type':{'type':Sequelize[_0xa2a4('0x2')](_0xa2a4('0x3'),_0xa2a4('0x4'),_0xa2a4('0x5'),_0xa2a4('0x6'),_0xa2a4('0x7')),'defaultValue':_0xa2a4('0x3')},'content':{'type':Sequelize[_0xa2a4('0x8')]},'key':{'type':Sequelize[_0xa2a4('0x8')]},'keyType':{'type':Sequelize[_0xa2a4('0x2')]('string','variable',_0xa2a4('0x5'))},'keyContent':{'type':Sequelize[_0xa2a4('0x8')]},'idField':{'type':Sequelize[_0xa2a4('0x8')]},'nameField':{'type':Sequelize[_0xa2a4('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa2a4('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index ec97b5c..2592e1b 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 _0x3a20=['path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','name','index','fieldName','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','type','merge','options','includeAll','SugarcrmField','findAll','catch','show','params','rawAttributes','include','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x5cee5d,_0x3ff6d2){var _0x4dd0f4=function(_0x4dc006){while(--_0x4dc006){_0x5cee5d['push'](_0x5cee5d['shift']());}};_0x4dd0f4(++_0x3ff6d2);}(_0x3a20,0x124));var _0x03a2=function(_0x14e505,_0x219425){_0x14e505=_0x14e505-0x0;var _0x22fdc2=_0x3a20[_0x14e505];return _0x22fdc2;};'use strict';var emlformat=require(_0x03a2('0x0'));var rimraf=require(_0x03a2('0x1'));var zipdir=require(_0x03a2('0x2'));var jsonpatch=require(_0x03a2('0x3'));var rp=require(_0x03a2('0x4'));var moment=require(_0x03a2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x03a2('0x6'));var util=require(_0x03a2('0x7'));var path=require(_0x03a2('0x8'));var sox=require(_0x03a2('0x9'));var csv=require(_0x03a2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x03a2('0xb'));var _=require(_0x03a2('0xc'));var squel=require(_0x03a2('0xd'));var crypto=require(_0x03a2('0xe'));var jsforce=require(_0x03a2('0xf'));var deskjs=require(_0x03a2('0x10'));var toCsv=require(_0x03a2('0xa'));var querystring=require(_0x03a2('0x11'));var Papa=require('papaparse');var Redis=require(_0x03a2('0x12'));var authService=require(_0x03a2('0x13'));var qs=require(_0x03a2('0x14'));var as=require(_0x03a2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x03a2('0x16'));var config=require(_0x03a2('0x17'));var licenseUtil=require(_0x03a2('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23e8ef,_0x238539){_0x238539=_0x238539||0xcc;return function(_0x2c9fc6){if(_0x2c9fc6){return _0x23e8ef[_0x03a2('0x19')](_0x238539);}return _0x23e8ef['status'](_0x238539)[_0x03a2('0x1a')]();};}function respondWithResult(_0x19fb8e,_0x154d3d){_0x154d3d=_0x154d3d||0xc8;return function(_0xcaa022){if(_0xcaa022){return _0x19fb8e[_0x03a2('0x1b')](_0x154d3d)[_0x03a2('0x1c')](_0xcaa022);}};}function respondWithFilteredResult(_0x5caf07,_0x1d2fd2){return function(_0x1491af){if(_0x1491af){var _0x47946f=typeof _0x1d2fd2[_0x03a2('0x1d')]===_0x03a2('0x1e')&&typeof _0x1d2fd2[_0x03a2('0x1f')]===_0x03a2('0x1e');var _0x4ec86c=_0x1491af[_0x03a2('0x20')];var _0x4102a9=_0x47946f?0x0:_0x1d2fd2[_0x03a2('0x1d')];var _0x505882=_0x47946f?_0x1491af['count']:_0x1d2fd2[_0x03a2('0x1d')]+_0x1d2fd2[_0x03a2('0x1f')];var _0x1c928e;if(_0x505882>=_0x4ec86c){_0x505882=_0x4ec86c;_0x1c928e=0xc8;}else{_0x1c928e=0xce;}_0x5caf07[_0x03a2('0x1b')](_0x1c928e);return _0x5caf07[_0x03a2('0x21')](_0x03a2('0x22'),_0x4102a9+'-'+_0x505882+'/'+_0x4ec86c)['json'](_0x1491af);}return null;};}function patchUpdates(_0x192b77){return function(_0x35f869){try{jsonpatch[_0x03a2('0x23')](_0x35f869,_0x192b77,!![]);}catch(_0x25658f){return BPromise['reject'](_0x25658f);}return _0x35f869[_0x03a2('0x24')]();};}function saveUpdates(_0x5c8342,_0x342e85){return function(_0x5406e8){if(_0x5406e8){return _0x5406e8['update'](_0x5c8342)[_0x03a2('0x25')](function(_0x11b4a6){return _0x11b4a6;});}return null;};}function removeEntity(_0x4b4cf8,_0x115c02){return function(_0x431684){if(_0x431684){return _0x431684[_0x03a2('0x26')]()[_0x03a2('0x25')](function(){_0x4b4cf8[_0x03a2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x373774,_0x3b1f19){return function(_0x487c0f){if(!_0x487c0f){_0x373774[_0x03a2('0x19')](0x194);}return _0x487c0f;};}function handleError(_0x128b4d,_0x16f04c){_0x16f04c=_0x16f04c||0x1f4;return function(_0x5ea80d){logger[_0x03a2('0x27')](_0x5ea80d['stack']);if(_0x5ea80d[_0x03a2('0x28')]){delete _0x5ea80d[_0x03a2('0x28')];}_0x128b4d[_0x03a2('0x1b')](_0x16f04c)['send'](_0x5ea80d);};}exports[_0x03a2('0x29')]=function(_0x1338f6,_0x46c8da){var _0x14f8a6={},_0x28c642={},_0x19a2da={'count':0x0,'rows':[]};var _0x2ab798=_['map'](db['SugarcrmField']['rawAttributes'],function(_0x25bcdf){return{'name':_0x25bcdf[_0x03a2('0x2a')],'type':_0x25bcdf['type'][_0x03a2('0x2b')]};});_0x28c642['model']=_[_0x03a2('0x2c')](_0x2ab798,_0x03a2('0x28'));_0x28c642[_0x03a2('0x2d')]=_[_0x03a2('0x2e')](_0x1338f6['query']);_0x28c642['filters']=_[_0x03a2('0x2f')](_0x28c642[_0x03a2('0x30')],_0x28c642[_0x03a2('0x2d')]);_0x14f8a6[_0x03a2('0x31')]=_['intersection'](_0x28c642[_0x03a2('0x30')],qs['fields'](_0x1338f6[_0x03a2('0x2d')][_0x03a2('0x32')]));_0x14f8a6['attributes']=_0x14f8a6[_0x03a2('0x31')][_0x03a2('0x33')]?_0x14f8a6[_0x03a2('0x31')]:_0x28c642[_0x03a2('0x30')];if(!_0x1338f6[_0x03a2('0x2d')][_0x03a2('0x34')](_0x03a2('0x35'))){_0x14f8a6[_0x03a2('0x1f')]=qs[_0x03a2('0x1f')](_0x1338f6['query'][_0x03a2('0x1f')]);_0x14f8a6[_0x03a2('0x1d')]=qs[_0x03a2('0x1d')](_0x1338f6[_0x03a2('0x2d')]['offset']);}_0x14f8a6[_0x03a2('0x36')]=qs[_0x03a2('0x37')](_0x1338f6[_0x03a2('0x2d')][_0x03a2('0x37')]);_0x14f8a6['where']=qs[_0x03a2('0x38')](_[_0x03a2('0x39')](_0x1338f6['query'],_0x28c642['filters']),_0x2ab798);if(_0x1338f6[_0x03a2('0x2d')][_0x03a2('0x3a')]){_0x14f8a6[_0x03a2('0x3b')]=_['merge'](_0x14f8a6[_0x03a2('0x3b')],{'$or':_[_0x03a2('0x2c')](_0x2ab798,function(_0x7de6ac){if(_0x7de6ac[_0x03a2('0x3c')]!=='VIRTUAL'){var _0xdfa03b={};_0xdfa03b[_0x7de6ac[_0x03a2('0x28')]]={'$like':'%'+_0x1338f6[_0x03a2('0x2d')][_0x03a2('0x3a')]+'%'};return _0xdfa03b;}})});}_0x14f8a6=_[_0x03a2('0x3d')]({},_0x14f8a6,_0x1338f6[_0x03a2('0x3e')]);var _0x3ebea5={'where':_0x14f8a6[_0x03a2('0x3b')]};return db['SugarcrmField'][_0x03a2('0x20')](_0x3ebea5)[_0x03a2('0x25')](function(_0x8aeed3){_0x19a2da[_0x03a2('0x20')]=_0x8aeed3;if(_0x1338f6[_0x03a2('0x2d')][_0x03a2('0x3f')]){_0x14f8a6['include']=[{'all':!![]}];}return db[_0x03a2('0x40')][_0x03a2('0x41')](_0x14f8a6);})[_0x03a2('0x25')](function(_0x493843){_0x19a2da['rows']=_0x493843;return _0x19a2da;})[_0x03a2('0x25')](respondWithFilteredResult(_0x46c8da,_0x14f8a6))[_0x03a2('0x42')](handleError(_0x46c8da,null));};exports[_0x03a2('0x43')]=function(_0x4409fc,_0x913265){var _0x40d6e4={'raw':!![],'where':{'id':_0x4409fc[_0x03a2('0x44')]['id']}},_0x501e6a={};_0x501e6a[_0x03a2('0x30')]=_[_0x03a2('0x2e')](db[_0x03a2('0x40')][_0x03a2('0x45')]);_0x501e6a['query']=_['keys'](_0x4409fc['query']);_0x501e6a['filters']=_[_0x03a2('0x2f')](_0x501e6a['model'],_0x501e6a[_0x03a2('0x2d')]);_0x40d6e4[_0x03a2('0x31')]=_[_0x03a2('0x2f')](_0x501e6a[_0x03a2('0x30')],qs['fields'](_0x4409fc['query'][_0x03a2('0x32')]));_0x40d6e4[_0x03a2('0x31')]=_0x40d6e4['attributes'][_0x03a2('0x33')]?_0x40d6e4['attributes']:_0x501e6a[_0x03a2('0x30')];if(_0x4409fc[_0x03a2('0x2d')][_0x03a2('0x3f')]){_0x40d6e4[_0x03a2('0x46')]=[{'all':!![]}];}_0x40d6e4=_[_0x03a2('0x3d')]({},_0x40d6e4,_0x4409fc['options']);return db[_0x03a2('0x40')][_0x03a2('0x47')](_0x40d6e4)[_0x03a2('0x25')](handleEntityNotFound(_0x913265,null))[_0x03a2('0x25')](respondWithResult(_0x913265,null))[_0x03a2('0x42')](handleError(_0x913265,null));};exports[_0x03a2('0x48')]=function(_0x2e0263,_0x1b560e){return db[_0x03a2('0x40')][_0x03a2('0x48')](_0x2e0263[_0x03a2('0x49')],{})[_0x03a2('0x25')](respondWithResult(_0x1b560e,0xc9))[_0x03a2('0x42')](handleError(_0x1b560e,null));};exports[_0x03a2('0x4a')]=function(_0x2137d6,_0x4a3afd){if(_0x2137d6[_0x03a2('0x49')]['id']){delete _0x2137d6[_0x03a2('0x49')]['id'];}return db[_0x03a2('0x40')]['find']({'where':{'id':_0x2137d6[_0x03a2('0x44')]['id']}})['then'](handleEntityNotFound(_0x4a3afd,null))['then'](saveUpdates(_0x2137d6[_0x03a2('0x49')],null))['then'](respondWithResult(_0x4a3afd,null))[_0x03a2('0x42')](handleError(_0x4a3afd,null));};exports[_0x03a2('0x26')]=function(_0x171293,_0x38f8c9){return db[_0x03a2('0x40')][_0x03a2('0x47')]({'where':{'id':_0x171293[_0x03a2('0x44')]['id']}})[_0x03a2('0x25')](handleEntityNotFound(_0x38f8c9,null))['then'](removeEntity(_0x38f8c9,null))[_0x03a2('0x42')](handleError(_0x38f8c9,null));}; \ No newline at end of file +var _0xc4c5=['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','status','end','json','limit','undefined','offset','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','SugarcrmField','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','map','options','count','includeAll','include','findAll','rows','catch','show','params','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs'];(function(_0x59b2a1,_0x1f631f){var _0x4908d1=function(_0x14c9b8){while(--_0x14c9b8){_0x59b2a1['push'](_0x59b2a1['shift']());}};_0x4908d1(++_0x1f631f);}(_0xc4c5,0x12a));var _0x5c4c=function(_0x34f17c,_0x2301e9){_0x34f17c=_0x34f17c-0x0;var _0xf4f6d6=_0xc4c5[_0x34f17c];return _0xf4f6d6;};'use strict';var emlformat=require(_0x5c4c('0x0'));var rimraf=require(_0x5c4c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5c4c('0x2'));var rp=require(_0x5c4c('0x3'));var moment=require(_0x5c4c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5c4c('0x5'));var util=require(_0x5c4c('0x6'));var path=require('path');var sox=require(_0x5c4c('0x7'));var csv=require(_0x5c4c('0x8'));var ejs=require(_0x5c4c('0x9'));var fs=require('fs');var fs_extra=require(_0x5c4c('0xa'));var _=require(_0x5c4c('0xb'));var squel=require(_0x5c4c('0xc'));var crypto=require(_0x5c4c('0xd'));var jsforce=require(_0x5c4c('0xe'));var deskjs=require(_0x5c4c('0xf'));var toCsv=require(_0x5c4c('0x8'));var querystring=require(_0x5c4c('0x10'));var Papa=require('papaparse');var Redis=require(_0x5c4c('0x11'));var authService=require(_0x5c4c('0x12'));var qs=require(_0x5c4c('0x13'));var as=require(_0x5c4c('0x14'));var hardwareService=require(_0x5c4c('0x15'));var logger=require(_0x5c4c('0x16'))(_0x5c4c('0x17'));var utils=require(_0x5c4c('0x18'));var config=require(_0x5c4c('0x19'));var licenseUtil=require(_0x5c4c('0x1a'));var db=require(_0x5c4c('0x1b'))['db'];function respondWithStatusCode(_0x4af14b,_0x260580){_0x260580=_0x260580||0xcc;return function(_0x1fff50){if(_0x1fff50){return _0x4af14b['sendStatus'](_0x260580);}return _0x4af14b[_0x5c4c('0x1c')](_0x260580)[_0x5c4c('0x1d')]();};}function respondWithResult(_0x1a6f10,_0x1e7c73){_0x1e7c73=_0x1e7c73||0xc8;return function(_0x6350b3){if(_0x6350b3){return _0x1a6f10[_0x5c4c('0x1c')](_0x1e7c73)[_0x5c4c('0x1e')](_0x6350b3);}};}function respondWithFilteredResult(_0xe28f40,_0x3a874f){return function(_0x2175ec){if(_0x2175ec){var _0x2c84c0=typeof _0x3a874f['offset']==='undefined'&&typeof _0x3a874f[_0x5c4c('0x1f')]===_0x5c4c('0x20');var _0x4e6316=_0x2175ec['count'];var _0x3c88b4=_0x2c84c0?0x0:_0x3a874f[_0x5c4c('0x21')];var _0x4c2f76=_0x2c84c0?_0x2175ec['count']:_0x3a874f[_0x5c4c('0x21')]+_0x3a874f[_0x5c4c('0x1f')];var _0x2e86f9;if(_0x4c2f76>=_0x4e6316){_0x4c2f76=_0x4e6316;_0x2e86f9=0xc8;}else{_0x2e86f9=0xce;}_0xe28f40[_0x5c4c('0x1c')](_0x2e86f9);return _0xe28f40[_0x5c4c('0x22')](_0x5c4c('0x23'),_0x3c88b4+'-'+_0x4c2f76+'/'+_0x4e6316)[_0x5c4c('0x1e')](_0x2175ec);}return null;};}function patchUpdates(_0x5cb447){return function(_0x4854fb){try{jsonpatch['apply'](_0x4854fb,_0x5cb447,!![]);}catch(_0x1fdda2){return BPromise[_0x5c4c('0x24')](_0x1fdda2);}return _0x4854fb[_0x5c4c('0x25')]();};}function saveUpdates(_0x400a46,_0x276c54){return function(_0xf63b49){if(_0xf63b49){return _0xf63b49[_0x5c4c('0x26')](_0x400a46)[_0x5c4c('0x27')](function(_0x298f54){return _0x298f54;});}return null;};}function removeEntity(_0x56b782,_0x213ea8){return function(_0x3462ef){if(_0x3462ef){return _0x3462ef[_0x5c4c('0x28')]()[_0x5c4c('0x27')](function(){_0x56b782['status'](0xcc)[_0x5c4c('0x1d')]();});}};}function handleEntityNotFound(_0x16492b,_0x1b71bc){return function(_0x5a9863){if(!_0x5a9863){_0x16492b[_0x5c4c('0x29')](0x194);}return _0x5a9863;};}function handleError(_0x356ce2,_0x2849cc){_0x2849cc=_0x2849cc||0x1f4;return function(_0x5d24de){logger[_0x5c4c('0x2a')](_0x5d24de[_0x5c4c('0x2b')]);if(_0x5d24de[_0x5c4c('0x2c')]){delete _0x5d24de['name'];}_0x356ce2[_0x5c4c('0x1c')](_0x2849cc)[_0x5c4c('0x2d')](_0x5d24de);};}exports['index']=function(_0x27e9c5,_0x43f1c3){var _0x3f7ca9={},_0x5d794e={},_0x544388={'count':0x0,'rows':[]};var _0x37de53=_['map'](db[_0x5c4c('0x2e')][_0x5c4c('0x2f')],function(_0x3ccad6){return{'name':_0x3ccad6['fieldName'],'type':_0x3ccad6[_0x5c4c('0x30')][_0x5c4c('0x31')]};});_0x5d794e[_0x5c4c('0x32')]=_['map'](_0x37de53,_0x5c4c('0x2c'));_0x5d794e['query']=_[_0x5c4c('0x33')](_0x27e9c5[_0x5c4c('0x34')]);_0x5d794e[_0x5c4c('0x35')]=_[_0x5c4c('0x36')](_0x5d794e['model'],_0x5d794e[_0x5c4c('0x34')]);_0x3f7ca9[_0x5c4c('0x37')]=_['intersection'](_0x5d794e[_0x5c4c('0x32')],qs[_0x5c4c('0x38')](_0x27e9c5[_0x5c4c('0x34')]['fields']));_0x3f7ca9[_0x5c4c('0x37')]=_0x3f7ca9[_0x5c4c('0x37')][_0x5c4c('0x39')]?_0x3f7ca9[_0x5c4c('0x37')]:_0x5d794e[_0x5c4c('0x32')];if(!_0x27e9c5['query'][_0x5c4c('0x3a')](_0x5c4c('0x3b'))){_0x3f7ca9[_0x5c4c('0x1f')]=qs[_0x5c4c('0x1f')](_0x27e9c5[_0x5c4c('0x34')][_0x5c4c('0x1f')]);_0x3f7ca9[_0x5c4c('0x21')]=qs[_0x5c4c('0x21')](_0x27e9c5[_0x5c4c('0x34')][_0x5c4c('0x21')]);}_0x3f7ca9[_0x5c4c('0x3c')]=qs['sort'](_0x27e9c5[_0x5c4c('0x34')][_0x5c4c('0x3d')]);_0x3f7ca9[_0x5c4c('0x3e')]=qs['filters'](_['pick'](_0x27e9c5[_0x5c4c('0x34')],_0x5d794e[_0x5c4c('0x35')]),_0x37de53);if(_0x27e9c5[_0x5c4c('0x34')]['filter']){_0x3f7ca9[_0x5c4c('0x3e')]=_[_0x5c4c('0x3f')](_0x3f7ca9[_0x5c4c('0x3e')],{'$or':_[_0x5c4c('0x40')](_0x37de53,function(_0x40e94c){if(_0x40e94c['type']!=='VIRTUAL'){var _0x4fb5b2={};_0x4fb5b2[_0x40e94c[_0x5c4c('0x2c')]]={'$like':'%'+_0x27e9c5[_0x5c4c('0x34')]['filter']+'%'};return _0x4fb5b2;}})});}_0x3f7ca9=_[_0x5c4c('0x3f')]({},_0x3f7ca9,_0x27e9c5[_0x5c4c('0x41')]);var _0x3ff87b={'where':_0x3f7ca9[_0x5c4c('0x3e')]};return db[_0x5c4c('0x2e')][_0x5c4c('0x42')](_0x3ff87b)[_0x5c4c('0x27')](function(_0x23c133){_0x544388['count']=_0x23c133;if(_0x27e9c5[_0x5c4c('0x34')][_0x5c4c('0x43')]){_0x3f7ca9[_0x5c4c('0x44')]=[{'all':!![]}];}return db[_0x5c4c('0x2e')][_0x5c4c('0x45')](_0x3f7ca9);})[_0x5c4c('0x27')](function(_0x4639ea){_0x544388[_0x5c4c('0x46')]=_0x4639ea;return _0x544388;})['then'](respondWithFilteredResult(_0x43f1c3,_0x3f7ca9))[_0x5c4c('0x47')](handleError(_0x43f1c3,null));};exports[_0x5c4c('0x48')]=function(_0x2d05f8,_0x170e4a){var _0x3110b8={'raw':!![],'where':{'id':_0x2d05f8[_0x5c4c('0x49')]['id']}},_0x5879f3={};_0x5879f3['model']=_[_0x5c4c('0x33')](db['SugarcrmField']['rawAttributes']);_0x5879f3[_0x5c4c('0x34')]=_[_0x5c4c('0x33')](_0x2d05f8[_0x5c4c('0x34')]);_0x5879f3[_0x5c4c('0x35')]=_[_0x5c4c('0x36')](_0x5879f3[_0x5c4c('0x32')],_0x5879f3[_0x5c4c('0x34')]);_0x3110b8[_0x5c4c('0x37')]=_[_0x5c4c('0x36')](_0x5879f3[_0x5c4c('0x32')],qs[_0x5c4c('0x38')](_0x2d05f8['query'][_0x5c4c('0x38')]));_0x3110b8[_0x5c4c('0x37')]=_0x3110b8['attributes'][_0x5c4c('0x39')]?_0x3110b8[_0x5c4c('0x37')]:_0x5879f3[_0x5c4c('0x32')];if(_0x2d05f8['query'][_0x5c4c('0x43')]){_0x3110b8[_0x5c4c('0x44')]=[{'all':!![]}];}_0x3110b8=_[_0x5c4c('0x3f')]({},_0x3110b8,_0x2d05f8['options']);return db[_0x5c4c('0x2e')]['find'](_0x3110b8)[_0x5c4c('0x27')](handleEntityNotFound(_0x170e4a,null))[_0x5c4c('0x27')](respondWithResult(_0x170e4a,null))[_0x5c4c('0x47')](handleError(_0x170e4a,null));};exports[_0x5c4c('0x4a')]=function(_0x252a8f,_0x2f6225){return db[_0x5c4c('0x2e')]['create'](_0x252a8f[_0x5c4c('0x4b')],{})[_0x5c4c('0x27')](respondWithResult(_0x2f6225,0xc9))[_0x5c4c('0x47')](handleError(_0x2f6225,null));};exports[_0x5c4c('0x26')]=function(_0x493a79,_0x560b06){if(_0x493a79[_0x5c4c('0x4b')]['id']){delete _0x493a79[_0x5c4c('0x4b')]['id'];}return db[_0x5c4c('0x2e')]['find']({'where':{'id':_0x493a79[_0x5c4c('0x49')]['id']}})[_0x5c4c('0x27')](handleEntityNotFound(_0x560b06,null))[_0x5c4c('0x27')](saveUpdates(_0x493a79[_0x5c4c('0x4b')],null))[_0x5c4c('0x27')](respondWithResult(_0x560b06,null))['catch'](handleError(_0x560b06,null));};exports[_0x5c4c('0x28')]=function(_0x2988b1,_0x4c0113){return db[_0x5c4c('0x2e')][_0x5c4c('0x4c')]({'where':{'id':_0x2988b1['params']['id']}})[_0x5c4c('0x27')](handleEntityNotFound(_0x4c0113,null))[_0x5c4c('0x27')](removeEntity(_0x4c0113,null))[_0x5c4c('0x47')](handleError(_0x4c0113,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index ed9418c..2b1e530 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 _0x8dbd=['rimraf','../../config/environment','exports','SugarcrmField','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1825bb,_0x2b87d9){var _0xc07034=function(_0x20f8bc){while(--_0x20f8bc){_0x1825bb['push'](_0x1825bb['shift']());}};_0xc07034(++_0x2b87d9);}(_0x8dbd,0x124));var _0xd8db=function(_0x4b7d76,_0x483887){_0x4b7d76=_0x4b7d76-0x0;var _0x4b2964=_0x8dbd[_0x4b7d76];return _0x4b2964;};'use strict';var _=require('lodash');var util=require(_0xd8db('0x0'));var logger=require(_0xd8db('0x1'))(_0xd8db('0x2'));var moment=require(_0xd8db('0x3'));var BPromise=require(_0xd8db('0x4'));var rp=require(_0xd8db('0x5'));var fs=require('fs');var path=require(_0xd8db('0x6'));var rimraf=require(_0xd8db('0x7'));var config=require(_0xd8db('0x8'));var attributes=require('./intSugarcrmField.attributes');module[_0xd8db('0x9')]=function(_0x229d61,_0x1c1809){return _0x229d61['define'](_0xd8db('0xa'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xd8db('0xb'),_0xd8db('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x11b3=['exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','lodash','util','api','request-promise','./intSugarcrmField.attributes'];(function(_0x4b4467,_0x44dade){var _0x29d364=function(_0x46704d){while(--_0x46704d){_0x4b4467['push'](_0x4b4467['shift']());}};_0x29d364(++_0x44dade);}(_0x11b3,0xa0));var _0x311b=function(_0x1999fe,_0xc888cf){_0x1999fe=_0x1999fe-0x0;var _0xabf9b3=_0x11b3[_0x1999fe];return _0xabf9b3;};'use strict';var _=require(_0x311b('0x0'));var util=require(_0x311b('0x1'));var logger=require('../../config/logger')(_0x311b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x311b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x311b('0x4'));module[_0x311b('0x5')]=function(_0x825db0,_0x4adda1){return _0x825db0[_0x311b('0x6')](_0x311b('0x7'),attributes,{'tableName':_0x311b('0x8'),'paranoid':![],'indexes':[{'name':_0x311b('0x9'),'fields':['idField',_0x311b('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 7b4e8a5..101213f 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 _0xbd1c=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent'];(function(_0x342b3b,_0x5d2a5e){var _0x1e5d10=function(_0x382b36){while(--_0x382b36){_0x342b3b['push'](_0x342b3b['shift']());}};_0x1e5d10(++_0x5d2a5e);}(_0xbd1c,0x124));var _0xcbd1=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xbd1c[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xcbd1('0x0'));var util=require('util');var moment=require(_0xcbd1('0x1'));var BPromise=require(_0xcbd1('0x2'));var rs=require(_0xcbd1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcbd1('0x4'))['db'];var utils=require(_0xcbd1('0x5'));var logger=require(_0xcbd1('0x6'))(_0xcbd1('0x7'));var config=require(_0xcbd1('0x8'));var jayson=require(_0xcbd1('0x9'));var client=jayson['client'][_0xcbd1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14fc1e,_0x3df874,_0x521ba6){return new BPromise(function(_0x2fd0b8,_0x3ecb08){return client[_0xcbd1('0xb')](_0x14fc1e,_0x521ba6)[_0xcbd1('0xc')](function(_0x361a83){logger[_0xcbd1('0xd')](_0xcbd1('0xe'),_0x3df874,'request\x20sent');logger['debug']('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x3df874,_0xcbd1('0xf'),JSON[_0xcbd1('0x10')](_0x361a83));if(_0x361a83[_0xcbd1('0x11')]){if(_0x361a83[_0xcbd1('0x11')][_0xcbd1('0x12')]===0x1f4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x3df874,_0x361a83[_0xcbd1('0x11')][_0xcbd1('0x13')]);return _0x3ecb08(_0x361a83['error']['message']);}logger[_0xcbd1('0x11')](_0xcbd1('0xe'),_0x3df874,_0x361a83[_0xcbd1('0x11')]['message']);return _0x2fd0b8(_0x361a83[_0xcbd1('0x11')][_0xcbd1('0x13')]);}else{logger[_0xcbd1('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x3df874,_0xcbd1('0xf'));_0x2fd0b8(_0x361a83[_0xcbd1('0x14')]['message']);}})[_0xcbd1('0x15')](function(_0x47c4b1){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x3df874,_0x47c4b1);_0x3ecb08(_0x47c4b1);});});} \ No newline at end of file +var _0x9ec9=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x5cabc0,_0x53e4bc){var _0x58300d=function(_0xfbc57d){while(--_0xfbc57d){_0x5cabc0['push'](_0x5cabc0['shift']());}};_0x58300d(++_0x53e4bc);}(_0x9ec9,0x13d));var _0x99ec=function(_0x44c340,_0x575719){_0x44c340=_0x44c340-0x0;var _0x2cd080=_0x9ec9[_0x44c340];return _0x2cd080;};'use strict';var _=require(_0x99ec('0x0'));var util=require(_0x99ec('0x1'));var moment=require(_0x99ec('0x2'));var BPromise=require(_0x99ec('0x3'));var rs=require(_0x99ec('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x99ec('0x5'));var logger=require(_0x99ec('0x6'))(_0x99ec('0x7'));var config=require(_0x99ec('0x8'));var jayson=require(_0x99ec('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4fcfcc,_0x5232d4,_0x2d4307){return new BPromise(function(_0x234884,_0x44539d){return client[_0x99ec('0xa')](_0x4fcfcc,_0x2d4307)[_0x99ec('0xb')](function(_0x3a8f23){logger['info'](_0x99ec('0xc'),_0x5232d4,'request\x20sent');logger[_0x99ec('0xd')](_0x99ec('0xe'),_0x5232d4,'request\x20sent',JSON[_0x99ec('0xf')](_0x3a8f23));if(_0x3a8f23['error']){if(_0x3a8f23['error'][_0x99ec('0x10')]===0x1f4){logger[_0x99ec('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x5232d4,_0x3a8f23[_0x99ec('0x11')][_0x99ec('0x12')]);return _0x44539d(_0x3a8f23[_0x99ec('0x11')][_0x99ec('0x12')]);}logger[_0x99ec('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x5232d4,_0x3a8f23['error'][_0x99ec('0x12')]);return _0x234884(_0x3a8f23[_0x99ec('0x11')][_0x99ec('0x12')]);}else{logger[_0x99ec('0x13')](_0x99ec('0xc'),_0x5232d4,_0x99ec('0x14'));_0x234884(_0x3a8f23[_0x99ec('0x15')][_0x99ec('0x12')]);}})[_0x99ec('0x16')](function(_0x4c3b1e){logger[_0x99ec('0x11')](_0x99ec('0xc'),_0x5232d4,_0x4c3b1e);_0x44539d(_0x4c3b1e);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 49063db..d77d90b 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 _0x3b75=['post','addConfiguration','/:id','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intVtigerAccount.controller','get','isAuthenticated','index','show','/:id/configurations','/:id/fields','getFields'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x3b75,0x144));var _0x53b7=function(_0x2a8c21,_0x163576){_0x2a8c21=_0x2a8c21-0x0;var _0x5f3061=_0x3b75[_0x2a8c21];return _0x5f3061;};'use strict';var multer=require(_0x53b7('0x0'));var util=require(_0x53b7('0x1'));var path=require(_0x53b7('0x2'));var timeout=require(_0x53b7('0x3'));var express=require(_0x53b7('0x4'));var router=express[_0x53b7('0x5')]();var fs_extra=require(_0x53b7('0x6'));var auth=require(_0x53b7('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x53b7('0x8'));router[_0x53b7('0x9')]('/',auth[_0x53b7('0xa')](),controller[_0x53b7('0xb')]);router['get']('/:id',auth[_0x53b7('0xa')](),controller[_0x53b7('0xc')]);router[_0x53b7('0x9')](_0x53b7('0xd'),auth[_0x53b7('0xa')](),controller['getConfigurations']);router[_0x53b7('0x9')](_0x53b7('0xe'),auth[_0x53b7('0xa')](),controller[_0x53b7('0xf')]);router[_0x53b7('0x10')]('/',auth[_0x53b7('0xa')](),controller['create']);router['post'](_0x53b7('0xd'),auth['isAuthenticated'](),controller[_0x53b7('0x11')]);router['put'](_0x53b7('0x12'),auth[_0x53b7('0xa')](),controller[_0x53b7('0x13')]);router['delete'](_0x53b7('0x12'),auth[_0x53b7('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8323=['/:id','show','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x872b02,_0x4f4458){var _0x1a6b24=function(_0x1dfb4e){while(--_0x1dfb4e){_0x872b02['push'](_0x872b02['shift']());}};_0x1a6b24(++_0x4f4458);}(_0x8323,0x8f));var _0x3832=function(_0x1e6c4a,_0x4efafb){_0x1e6c4a=_0x1e6c4a-0x0;var _0x44f739=_0x8323[_0x1e6c4a];return _0x44f739;};'use strict';var multer=require(_0x3832('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3832('0x1'));var router=express['Router']();var fs_extra=require(_0x3832('0x2'));var auth=require(_0x3832('0x3'));var interaction=require(_0x3832('0x4'));var config=require(_0x3832('0x5'));var controller=require('./intVtigerAccount.controller');router[_0x3832('0x6')]('/',auth[_0x3832('0x7')](),controller[_0x3832('0x8')]);router[_0x3832('0x6')](_0x3832('0x9'),auth[_0x3832('0x7')](),controller[_0x3832('0xa')]);router[_0x3832('0x6')]('/:id/configurations',auth[_0x3832('0x7')](),controller['getConfigurations']);router[_0x3832('0x6')]('/:id/fields',auth[_0x3832('0x7')](),controller[_0x3832('0xb')]);router[_0x3832('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3832('0xc')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x3832('0xd')]);router[_0x3832('0xe')](_0x3832('0x9'),auth[_0x3832('0x7')](),controller[_0x3832('0xf')]);router[_0x3832('0x10')](_0x3832('0x9'),auth['isAuthenticated'](),controller[_0x3832('0x11')]);module[_0x3832('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 1c40b0b..ab864a5 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 _0xdb6e=['HelpDesk','STRING'];(function(_0x60b1ec,_0x36a99c){var _0x96ddf0=function(_0x46eaad){while(--_0x46eaad){_0x60b1ec['push'](_0x60b1ec['shift']());}};_0x96ddf0(++_0x36a99c);}(_0xdb6e,0x1ad));var _0xedb6=function(_0x3c4cf2,_0x11a4c5){_0x3c4cf2=_0x3c4cf2-0x0;var _0x57f90d=_0xdb6e[_0x3c4cf2];return _0x57f90d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xedb6('0x0')]},'username':{'type':Sequelize[_0xedb6('0x0')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xedb6('0x0')],'allowNull':![],'defaultValue':_0xedb6('0x1')},'remoteUri':{'type':Sequelize[_0xedb6('0x0')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xedb6('0x0')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xedb6('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0xb5ca=['sequelize','STRING','HelpDesk'];(function(_0x3d2e4b,_0x1f6653){var _0x509e78=function(_0x307037){while(--_0x307037){_0x3d2e4b['push'](_0x3d2e4b['shift']());}};_0x509e78(++_0x1f6653);}(_0xb5ca,0x13b));var _0xab5c=function(_0x3a2f8a,_0x251c3f){_0x3a2f8a=_0x3a2f8a-0x0;var _0x2dc062=_0xb5ca[_0x3a2f8a];return _0x2dc062;};'use strict';var Sequelize=require(_0xab5c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xab5c('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xab5c('0x1')],'allowNull':![],'defaultValue':_0xab5c('0x2')},'remoteUri':{'type':Sequelize[_0xab5c('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xab5c('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xab5c('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index d9f1b23..f79095b 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 _0x1624=['cf_','picklistValues','value','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','name','send','index','VtigerAccount','type','key','model','map','query','keys','intersection','fields','attributes','length','sort','where','pick','filters','filter','merge','VIRTUAL','include','rows','catch','show','rawAttributes','includeAll','options','find','create','body','params','getConfigurations','findOne','VtigerConfiguration','order','hasOwnProperty','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions','VtigerField','Subjects','md5','username','description','moduleName','serverUrl','accessKey','remoteUri','slice','lastIndexOf','format','%s/webservice.php','GET','getchallenge','result','token','success','describe','autogenerated','reference','remove','editable','false','label','startsWith'];(function(_0x390b40,_0x32a62e){var _0x11a416=function(_0x985f68){while(--_0x985f68){_0x390b40['push'](_0x390b40['shift']());}};_0x11a416(++_0x32a62e);}(_0x1624,0x82));var _0x4162=function(_0x299b05,_0x2b9006){_0x299b05=_0x299b05-0x0;var _0x573592=_0x1624[_0x299b05];return _0x573592;};'use strict';var emlformat=require(_0x4162('0x0'));var rimraf=require(_0x4162('0x1'));var zipdir=require(_0x4162('0x2'));var jsonpatch=require(_0x4162('0x3'));var rp=require(_0x4162('0x4'));var moment=require(_0x4162('0x5'));var BPromise=require(_0x4162('0x6'));var Mustache=require(_0x4162('0x7'));var util=require(_0x4162('0x8'));var path=require(_0x4162('0x9'));var sox=require(_0x4162('0xa'));var csv=require(_0x4162('0xb'));var ejs=require(_0x4162('0xc'));var fs=require('fs');var fs_extra=require(_0x4162('0xd'));var _=require(_0x4162('0xe'));var squel=require(_0x4162('0xf'));var crypto=require(_0x4162('0x10'));var jsforce=require(_0x4162('0x11'));var deskjs=require(_0x4162('0x12'));var toCsv=require(_0x4162('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4162('0x13'));var authService=require(_0x4162('0x14'));var qs=require(_0x4162('0x15'));var as=require(_0x4162('0x16'));var hardwareService=require(_0x4162('0x17'));var logger=require(_0x4162('0x18'))('api');var utils=require(_0x4162('0x19'));var config=require(_0x4162('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x4162('0x1b'));function respondWithStatusCode(_0x500597,_0x47b1df){_0x47b1df=_0x47b1df||0xcc;return function(_0x5c8707){if(_0x5c8707){return _0x500597[_0x4162('0x1c')](_0x47b1df);}return _0x500597[_0x4162('0x1d')](_0x47b1df)[_0x4162('0x1e')]();};}function respondWithResult(_0x533b5e,_0x50ce01){_0x50ce01=_0x50ce01||0xc8;return function(_0x1966eb){if(_0x1966eb){return _0x533b5e[_0x4162('0x1d')](_0x50ce01)[_0x4162('0x1f')](_0x1966eb);}};}function respondWithFilteredResult(_0x2f0e71,_0x242e0e){return function(_0x33ec27){if(_0x33ec27){var _0x43ba11=typeof _0x242e0e[_0x4162('0x20')]===_0x4162('0x21')&&typeof _0x242e0e[_0x4162('0x22')]===_0x4162('0x21');var _0x429044=_0x33ec27[_0x4162('0x23')];var _0x37aa71=_0x43ba11?0x0:_0x242e0e['offset'];var _0x5d56db=_0x43ba11?_0x33ec27['count']:_0x242e0e[_0x4162('0x20')]+_0x242e0e[_0x4162('0x22')];var _0x538528;if(_0x5d56db>=_0x429044){_0x5d56db=_0x429044;_0x538528=0xc8;}else{_0x538528=0xce;}_0x2f0e71['status'](_0x538528);return _0x2f0e71[_0x4162('0x24')]('Content-Range',_0x37aa71+'-'+_0x5d56db+'/'+_0x429044)[_0x4162('0x1f')](_0x33ec27);}return null;};}function patchUpdates(_0x34f284){return function(_0x16912f){try{jsonpatch[_0x4162('0x25')](_0x16912f,_0x34f284,!![]);}catch(_0x53fb2e){return BPromise['reject'](_0x53fb2e);}return _0x16912f[_0x4162('0x26')]();};}function saveUpdates(_0x1211f6,_0x3fbc3d){return function(_0x199df0){if(_0x199df0){return _0x199df0[_0x4162('0x27')](_0x1211f6)[_0x4162('0x28')](function(_0x5bdbc6){return _0x5bdbc6;});}return null;};}function removeEntity(_0x5b133d,_0x1e034e){return function(_0x3db880){if(_0x3db880){return _0x3db880[_0x4162('0x29')]()[_0x4162('0x28')](function(){_0x5b133d[_0x4162('0x1d')](0xcc)[_0x4162('0x1e')]();});}};}function handleEntityNotFound(_0x622efa,_0x5d1cf1){return function(_0x4a7091){if(!_0x4a7091){_0x622efa[_0x4162('0x1c')](0x194);}return _0x4a7091;};}function handleError(_0x1f061e,_0x24e7fc){_0x24e7fc=_0x24e7fc||0x1f4;return function(_0x174e25){logger[_0x4162('0x2a')](_0x174e25['stack']);if(_0x174e25[_0x4162('0x2b')]){delete _0x174e25['name'];}_0x1f061e['status'](_0x24e7fc)[_0x4162('0x2c')](_0x174e25);};}exports[_0x4162('0x2d')]=function(_0x54536a,_0x1a87c1){var _0x672a1={},_0x26280a={},_0x3150e8={'count':0x0,'rows':[]};var _0x564c5f=_['map'](db[_0x4162('0x2e')]['rawAttributes'],function(_0x1f408d){return{'name':_0x1f408d['fieldName'],'type':_0x1f408d[_0x4162('0x2f')][_0x4162('0x30')]};});_0x26280a[_0x4162('0x31')]=_[_0x4162('0x32')](_0x564c5f,_0x4162('0x2b'));_0x26280a[_0x4162('0x33')]=_[_0x4162('0x34')](_0x54536a[_0x4162('0x33')]);_0x26280a['filters']=_[_0x4162('0x35')](_0x26280a[_0x4162('0x31')],_0x26280a[_0x4162('0x33')]);_0x672a1['attributes']=_['intersection'](_0x26280a[_0x4162('0x31')],qs[_0x4162('0x36')](_0x54536a[_0x4162('0x33')][_0x4162('0x36')]));_0x672a1[_0x4162('0x37')]=_0x672a1[_0x4162('0x37')][_0x4162('0x38')]?_0x672a1['attributes']:_0x26280a[_0x4162('0x31')];if(!_0x54536a[_0x4162('0x33')]['hasOwnProperty']('nolimit')){_0x672a1[_0x4162('0x22')]=qs[_0x4162('0x22')](_0x54536a[_0x4162('0x33')][_0x4162('0x22')]);_0x672a1[_0x4162('0x20')]=qs[_0x4162('0x20')](_0x54536a[_0x4162('0x33')]['offset']);}_0x672a1['order']=qs[_0x4162('0x39')](_0x54536a['query'][_0x4162('0x39')]);_0x672a1[_0x4162('0x3a')]=qs['filters'](_[_0x4162('0x3b')](_0x54536a[_0x4162('0x33')],_0x26280a[_0x4162('0x3c')]),_0x564c5f);if(_0x54536a[_0x4162('0x33')][_0x4162('0x3d')]){_0x672a1[_0x4162('0x3a')]=_[_0x4162('0x3e')](_0x672a1['where'],{'$or':_['map'](_0x564c5f,function(_0x32e65a){if(_0x32e65a[_0x4162('0x2f')]!==_0x4162('0x3f')){var _0x2e2831={};_0x2e2831[_0x32e65a['name']]={'$like':'%'+_0x54536a[_0x4162('0x33')][_0x4162('0x3d')]+'%'};return _0x2e2831;}})});}_0x672a1=_[_0x4162('0x3e')]({},_0x672a1,_0x54536a['options']);var _0x3a1c02={'where':_0x672a1[_0x4162('0x3a')]};return db[_0x4162('0x2e')]['count'](_0x3a1c02)[_0x4162('0x28')](function(_0x56a9d9){_0x3150e8[_0x4162('0x23')]=_0x56a9d9;if(_0x54536a['query']['includeAll']){_0x672a1[_0x4162('0x40')]=[{'all':!![]}];}return db[_0x4162('0x2e')]['findAll'](_0x672a1);})['then'](function(_0x3a57cf){_0x3150e8[_0x4162('0x41')]=_0x3a57cf;return _0x3150e8;})[_0x4162('0x28')](respondWithFilteredResult(_0x1a87c1,_0x672a1))[_0x4162('0x42')](handleError(_0x1a87c1,null));};exports[_0x4162('0x43')]=function(_0x5e7d6b,_0x5cfe2f){var _0x5c15b7={'raw':![],'where':{'id':_0x5e7d6b['params']['id']}},_0x417087={};_0x417087[_0x4162('0x31')]=_[_0x4162('0x34')](db[_0x4162('0x2e')][_0x4162('0x44')]);_0x417087[_0x4162('0x33')]=_[_0x4162('0x34')](_0x5e7d6b['query']);_0x417087['filters']=_[_0x4162('0x35')](_0x417087['model'],_0x417087[_0x4162('0x33')]);_0x5c15b7[_0x4162('0x37')]=_[_0x4162('0x35')](_0x417087['model'],qs[_0x4162('0x36')](_0x5e7d6b[_0x4162('0x33')][_0x4162('0x36')]));_0x5c15b7[_0x4162('0x37')]=_0x5c15b7[_0x4162('0x37')][_0x4162('0x38')]?_0x5c15b7['attributes']:_0x417087['model'];if(_0x5e7d6b['query'][_0x4162('0x45')]){_0x5c15b7[_0x4162('0x40')]=[{'all':!![]}];}_0x5c15b7=_[_0x4162('0x3e')]({},_0x5c15b7,_0x5e7d6b[_0x4162('0x46')]);return db[_0x4162('0x2e')][_0x4162('0x47')](_0x5c15b7)[_0x4162('0x28')](handleEntityNotFound(_0x5cfe2f,null))[_0x4162('0x28')](respondWithResult(_0x5cfe2f,null))['catch'](handleError(_0x5cfe2f,null));};exports[_0x4162('0x48')]=function(_0x3d2fb7,_0x45270c){return db[_0x4162('0x2e')][_0x4162('0x48')](_0x3d2fb7[_0x4162('0x49')],{})[_0x4162('0x28')](respondWithResult(_0x45270c,0xc9))[_0x4162('0x42')](handleError(_0x45270c,null));};exports['update']=function(_0x5db0e6,_0x2b2125){if(_0x5db0e6[_0x4162('0x49')]['id']){delete _0x5db0e6[_0x4162('0x49')]['id'];}return db[_0x4162('0x2e')][_0x4162('0x47')]({'where':{'id':_0x5db0e6[_0x4162('0x4a')]['id']}})[_0x4162('0x28')](handleEntityNotFound(_0x2b2125,null))[_0x4162('0x28')](saveUpdates(_0x5db0e6['body'],null))[_0x4162('0x28')](respondWithResult(_0x2b2125,null))[_0x4162('0x42')](handleError(_0x2b2125,null));};exports[_0x4162('0x29')]=function(_0x1bff61,_0x557337){return db[_0x4162('0x2e')]['find']({'where':{'id':_0x1bff61[_0x4162('0x4a')]['id']}})[_0x4162('0x28')](handleEntityNotFound(_0x557337,null))['then'](removeEntity(_0x557337,null))[_0x4162('0x42')](handleError(_0x557337,null));};exports[_0x4162('0x4b')]=function(_0x2e4e93,_0x53415f,_0x4b3a3a){var _0x3d747a={};var _0x116903={};var _0x54c43b;var _0x371dc1;return db[_0x4162('0x2e')][_0x4162('0x4c')]({'where':{'id':_0x2e4e93[_0x4162('0x4a')]['id']}})[_0x4162('0x28')](handleEntityNotFound(_0x53415f,null))[_0x4162('0x28')](function(_0x3c7a5e){if(_0x3c7a5e){_0x54c43b=_0x3c7a5e;_0x116903[_0x4162('0x31')]=_[_0x4162('0x34')](db[_0x4162('0x4d')]['rawAttributes']);_0x116903['query']=_[_0x4162('0x34')](_0x2e4e93[_0x4162('0x33')]);_0x116903[_0x4162('0x3c')]=_[_0x4162('0x35')](_0x116903[_0x4162('0x31')],_0x116903[_0x4162('0x33')]);_0x3d747a['attributes']=_[_0x4162('0x35')](_0x116903[_0x4162('0x31')],qs['fields'](_0x2e4e93[_0x4162('0x33')]['fields']));_0x3d747a[_0x4162('0x37')]=_0x3d747a[_0x4162('0x37')][_0x4162('0x38')]?_0x3d747a[_0x4162('0x37')]:_0x116903[_0x4162('0x31')];_0x3d747a[_0x4162('0x4e')]=qs[_0x4162('0x39')](_0x2e4e93['query'][_0x4162('0x39')]);_0x3d747a[_0x4162('0x3a')]=qs[_0x4162('0x3c')](_[_0x4162('0x3b')](_0x2e4e93['query'],_0x116903[_0x4162('0x3c')]));if(_0x2e4e93[_0x4162('0x33')][_0x4162('0x3d')]){_0x3d747a[_0x4162('0x3a')]=_['merge'](_0x3d747a[_0x4162('0x3a')],{'$or':_[_0x4162('0x32')](_0x3d747a[_0x4162('0x37')],function(_0x16f9f9){var _0x465ef7={};_0x465ef7[_0x16f9f9]={'$like':'%'+_0x2e4e93[_0x4162('0x33')][_0x4162('0x3d')]+'%'};return _0x465ef7;})});}_0x3d747a=_[_0x4162('0x3e')]({},_0x3d747a,_0x2e4e93[_0x4162('0x46')]);return _0x54c43b['getConfigurations'](_0x3d747a);}})[_0x4162('0x28')](function(_0x2a0397){if(_0x2a0397){_0x371dc1=_0x2a0397[_0x4162('0x38')];if(!_0x2e4e93['query'][_0x4162('0x4f')](_0x4162('0x50'))){_0x3d747a[_0x4162('0x22')]=qs[_0x4162('0x22')](_0x2e4e93['query']['limit']);_0x3d747a[_0x4162('0x20')]=qs[_0x4162('0x20')](_0x2e4e93[_0x4162('0x33')][_0x4162('0x20')]);}return _0x54c43b[_0x4162('0x4b')](_0x3d747a);}})['then'](function(_0x50c81e){if(_0x50c81e){return _0x50c81e?{'count':_0x371dc1,'rows':_0x50c81e}:null;}})['then'](respondWithResult(_0x53415f,null))[_0x4162('0x42')](handleError(_0x53415f,null));};exports[_0x4162('0x51')]=function(_0x4c19f2,_0x48f1b6,_0x2a45c1){if(_0x4c19f2[_0x4162('0x49')]['id']){delete _0x4c19f2[_0x4162('0x49')]['id'];}return db[_0x4162('0x2e')][_0x4162('0x4c')]({'where':{'id':_0x4c19f2[_0x4162('0x4a')]['id']}})[_0x4162('0x28')](handleEntityNotFound(_0x48f1b6,null))[_0x4162('0x28')](function(_0x1ceaf2){if(_0x1ceaf2){_0x4c19f2[_0x4162('0x49')][_0x4162('0x52')]=_0x1ceaf2['id'];_0x4c19f2['body']['Subjects']=integrations[_0x4162('0x53')](_0x4c19f2['body'][_0x4162('0x54')],_0x4c19f2['body'][_0x4162('0x2f')]);_0x4c19f2['body'][_0x4162('0x55')]=integrations['getDescriptions'](_0x4c19f2[_0x4162('0x49')]['channel'],_0x4c19f2['body'][_0x4162('0x2f')]);return db[_0x4162('0x4d')][_0x4162('0x48')](_0x4c19f2['body'],{'include':[{'model':db[_0x4162('0x56')],'as':_0x4162('0x57')},{'model':db[_0x4162('0x56')],'as':_0x4162('0x55')}]});}return null;})[_0x4162('0x28')](respondWithResult(_0x48f1b6,null))[_0x4162('0x42')](handleError(_0x48f1b6,null));};var md5=require(_0x4162('0x58'));exports['getFields']=function(_0x1aabea,_0x4a5f61,_0x445688){var _0x4e24af=null;var _0x3dc4c4=null;var _0x3d749e=null;var _0x235e18=null;var _0x49195f='';return db[_0x4162('0x2e')][_0x4162('0x4c')]({'where':{'id':_0x1aabea[_0x4162('0x4a')]['id']},'attributes':['id','name',_0x4162('0x59'),_0x4162('0x5a'),_0x4162('0x5b'),'remoteUri',_0x4162('0x5c'),_0x4162('0x5d')]})[_0x4162('0x28')](handleEntityNotFound(_0x4a5f61,null))[_0x4162('0x28')](function(_0x2f58c0){if(_0x2f58c0){_0x4e24af=_0x2f58c0['username'];_0x3dc4c4=_0x2f58c0[_0x4162('0x5d')];_0x3d749e=_0x2f58c0[_0x4162('0x5b')];_0x49195f=_0x2f58c0[_0x4162('0x5e')];var _0x1d697a=_0x49195f[_0x4162('0x5f')](-0x1);if(_0x1d697a==='/'){_0x49195f=_0x49195f['substring'](0x0,_0x49195f[_0x4162('0x60')](_0x1d697a));}_0x235e18=util[_0x4162('0x61')](_0x4162('0x62'),_0x49195f);var _0x385066={'method':_0x4162('0x63'),'uri':_0x235e18,'qs':{'operation':_0x4162('0x64'),'username':_0x2f58c0['username']},'json':!![]};return rp(_0x385066);}})[_0x4162('0x28')](function(_0x56ae4d){if(_0x56ae4d['success']){var _0xcc8092={'method':'POST','uri':_0x235e18,'form':{'operation':'login','username':_0x4e24af,'accessKey':md5(_0x56ae4d[_0x4162('0x65')][_0x4162('0x66')]+_0x3dc4c4)},'json':!![]};return rp(_0xcc8092);}})['then'](function(_0x2dd326){if(_0x2dd326[_0x4162('0x67')]){var _0xcc4128={'method':_0x4162('0x63'),'uri':_0x235e18,'qs':{'operation':_0x4162('0x68'),'username':_0x4e24af,'sessionName':_0x2dd326[_0x4162('0x65')]['sessionName'],'elementType':_0x3d749e},'json':!![]};return rp(_0xcc4128);}})[_0x4162('0x28')](function(_0x42229d){if(_0x42229d['success']){var _0x5a14da=[_0x4162('0x69'),_0x4162('0x6a'),'owner'];_[_0x4162('0x6b')](_0x42229d[_0x4162('0x65')][_0x4162('0x36')],function(_0x2ecb66){return _0x5a14da['includes'](_0x2ecb66[_0x4162('0x2f')][_0x4162('0x2b')]);});_[_0x4162('0x6b')](_0x42229d[_0x4162('0x65')][_0x4162('0x36')],function(_0x522406){return _0x522406[_0x4162('0x6c')]===_0x4162('0x6d');});return{'count':_0x42229d['result'][_0x4162('0x36')][_0x4162('0x38')],'rows':_['map'](_0x42229d['result'][_0x4162('0x36')],function(_0x2f4352){return{'id':_0x2f4352['name'],'name':_0x2f4352[_0x4162('0x6e')],'custom':_[_0x4162('0x6f')](_0x2f4352[_0x4162('0x2b')],_0x4162('0x70'))?!![]:![],'options':_0x2f4352[_0x4162('0x2f')][_0x4162('0x2b')]==='picklist'&&_0x2f4352['type'][_0x4162('0x71')][_0x4162('0x38')]>0x0?_['map'](_0x2f4352[_0x4162('0x2f')][_0x4162('0x71')],function(_0x5c1b5f){return{'name':_0x5c1b5f[_0x4162('0x6e')],'value':_0x5c1b5f[_0x4162('0x72')]};}):[]};})};}})[_0x4162('0x28')](respondWithResult(_0x4a5f61,null))[_0x4162('0x42')](function(_0x2f81b0){console['log'](_0x4162('0x73')+_0x2f81b0);var _0x5b600=_0x1aabea['query']['test']?0x1f4:_0x2f81b0[_0x4162('0x74')]||0x1f4;logger[_0x4162('0x2a')](_0x4162('0x75'),_0x4162('0x76'),_0x5b600,JSON[_0x4162('0x77')](_0x2f81b0));delete _0x2f81b0[_0x4162('0x2b')];if(_0x5b600===0x191){_0x5b600=0x190;}_0x4a5f61['status'](_0x5b600)[_0x4162('0x2c')](_0x1aabea[_0x4162('0x33')][_0x4162('0x78')]?{'message':'Wrong\x20credentials','statusCode':_0x2f81b0['statusCode']}:_0x2f81b0);});}; \ No newline at end of file +var _0xbccb=['md5','getFields','username','description','remoteUri','serverUrl','accessKey','moduleName','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','login','result','describe','sessionName','autogenerated','reference','remove','includes','cf_','picklist','picklistValues','label','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','count','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','rows','catch','show','params','find','create','body','getConfigurations','pick','addConfiguration','findOne','AccountId','Subjects','getSubjects','getDescriptions','VtigerConfiguration','VtigerField','Descriptions'];(function(_0x12bcf7,_0xc11103){var _0x2825a=function(_0x4452ba){while(--_0x4452ba){_0x12bcf7['push'](_0x12bcf7['shift']());}};_0x2825a(++_0xc11103);}(_0xbccb,0x8f));var _0xbbcc=function(_0x56740a,_0x568894){_0x56740a=_0x56740a-0x0;var _0x257144=_0xbccb[_0x56740a];return _0x257144;};'use strict';var emlformat=require(_0xbbcc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbbcc('0x1'));var jsonpatch=require(_0xbbcc('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbbcc('0x3'));var Mustache=require('mustache');var util=require(_0xbbcc('0x4'));var path=require('path');var sox=require(_0xbbcc('0x5'));var csv=require(_0xbbcc('0x6'));var ejs=require(_0xbbcc('0x7'));var fs=require('fs');var fs_extra=require(_0xbbcc('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xbbcc('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xbbcc('0xa'));var toCsv=require('to-csv');var querystring=require(_0xbbcc('0xb'));var Papa=require(_0xbbcc('0xc'));var Redis=require(_0xbbcc('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xbbcc('0xe'));var as=require(_0xbbcc('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbbcc('0x10'))(_0xbbcc('0x11'));var utils=require('../../config/utils');var config=require(_0xbbcc('0x12'));var licenseUtil=require(_0xbbcc('0x13'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4d994d,_0x5eeef7){_0x5eeef7=_0x5eeef7||0xcc;return function(_0x4b3932){if(_0x4b3932){return _0x4d994d[_0xbbcc('0x14')](_0x5eeef7);}return _0x4d994d[_0xbbcc('0x15')](_0x5eeef7)[_0xbbcc('0x16')]();};}function respondWithResult(_0x47fb50,_0x58a76a){_0x58a76a=_0x58a76a||0xc8;return function(_0x23cdcd){if(_0x23cdcd){return _0x47fb50[_0xbbcc('0x15')](_0x58a76a)['json'](_0x23cdcd);}};}function respondWithFilteredResult(_0x359c61,_0x1f9bd1){return function(_0x265aff){if(_0x265aff){var _0x9b1237=typeof _0x1f9bd1[_0xbbcc('0x17')]==='undefined'&&typeof _0x1f9bd1[_0xbbcc('0x18')]==='undefined';var _0x20df3e=_0x265aff['count'];var _0x10173c=_0x9b1237?0x0:_0x1f9bd1['offset'];var _0x34103c=_0x9b1237?_0x265aff[_0xbbcc('0x19')]:_0x1f9bd1[_0xbbcc('0x17')]+_0x1f9bd1[_0xbbcc('0x18')];var _0x30f166;if(_0x34103c>=_0x20df3e){_0x34103c=_0x20df3e;_0x30f166=0xc8;}else{_0x30f166=0xce;}_0x359c61[_0xbbcc('0x15')](_0x30f166);return _0x359c61[_0xbbcc('0x1a')]('Content-Range',_0x10173c+'-'+_0x34103c+'/'+_0x20df3e)['json'](_0x265aff);}return null;};}function patchUpdates(_0x138f5e){return function(_0x13b43d){try{jsonpatch[_0xbbcc('0x1b')](_0x13b43d,_0x138f5e,!![]);}catch(_0x45d381){return BPromise[_0xbbcc('0x1c')](_0x45d381);}return _0x13b43d[_0xbbcc('0x1d')]();};}function saveUpdates(_0x148841,_0x516539){return function(_0x3a99fa){if(_0x3a99fa){return _0x3a99fa['update'](_0x148841)[_0xbbcc('0x1e')](function(_0xc962df){return _0xc962df;});}return null;};}function removeEntity(_0x42918d,_0x4b5935){return function(_0x4e73dd){if(_0x4e73dd){return _0x4e73dd[_0xbbcc('0x1f')]()['then'](function(){_0x42918d[_0xbbcc('0x15')](0xcc)[_0xbbcc('0x16')]();});}};}function handleEntityNotFound(_0x5d57f3,_0x4a1358){return function(_0x3680a3){if(!_0x3680a3){_0x5d57f3[_0xbbcc('0x14')](0x194);}return _0x3680a3;};}function handleError(_0x3202ad,_0x419e76){_0x419e76=_0x419e76||0x1f4;return function(_0x598eb4){logger[_0xbbcc('0x20')](_0x598eb4[_0xbbcc('0x21')]);if(_0x598eb4[_0xbbcc('0x22')]){delete _0x598eb4[_0xbbcc('0x22')];}_0x3202ad[_0xbbcc('0x15')](_0x419e76)[_0xbbcc('0x23')](_0x598eb4);};}exports[_0xbbcc('0x24')]=function(_0x2bb13c,_0x3fd0c3){var _0x55df58={},_0x3086dc={},_0x548e37={'count':0x0,'rows':[]};var _0x131b5b=_[_0xbbcc('0x25')](db[_0xbbcc('0x26')][_0xbbcc('0x27')],function(_0x55d3cc){return{'name':_0x55d3cc[_0xbbcc('0x28')],'type':_0x55d3cc[_0xbbcc('0x29')][_0xbbcc('0x2a')]};});_0x3086dc[_0xbbcc('0x2b')]=_[_0xbbcc('0x25')](_0x131b5b,_0xbbcc('0x22'));_0x3086dc[_0xbbcc('0x2c')]=_[_0xbbcc('0x2d')](_0x2bb13c[_0xbbcc('0x2c')]);_0x3086dc[_0xbbcc('0x2e')]=_['intersection'](_0x3086dc[_0xbbcc('0x2b')],_0x3086dc['query']);_0x55df58[_0xbbcc('0x2f')]=_[_0xbbcc('0x30')](_0x3086dc[_0xbbcc('0x2b')],qs[_0xbbcc('0x31')](_0x2bb13c[_0xbbcc('0x2c')][_0xbbcc('0x31')]));_0x55df58[_0xbbcc('0x2f')]=_0x55df58[_0xbbcc('0x2f')][_0xbbcc('0x32')]?_0x55df58[_0xbbcc('0x2f')]:_0x3086dc[_0xbbcc('0x2b')];if(!_0x2bb13c[_0xbbcc('0x2c')][_0xbbcc('0x33')](_0xbbcc('0x34'))){_0x55df58[_0xbbcc('0x18')]=qs[_0xbbcc('0x18')](_0x2bb13c[_0xbbcc('0x2c')][_0xbbcc('0x18')]);_0x55df58[_0xbbcc('0x17')]=qs[_0xbbcc('0x17')](_0x2bb13c[_0xbbcc('0x2c')][_0xbbcc('0x17')]);}_0x55df58[_0xbbcc('0x35')]=qs[_0xbbcc('0x36')](_0x2bb13c[_0xbbcc('0x2c')][_0xbbcc('0x36')]);_0x55df58[_0xbbcc('0x37')]=qs[_0xbbcc('0x2e')](_['pick'](_0x2bb13c[_0xbbcc('0x2c')],_0x3086dc[_0xbbcc('0x2e')]),_0x131b5b);if(_0x2bb13c[_0xbbcc('0x2c')][_0xbbcc('0x38')]){_0x55df58[_0xbbcc('0x37')]=_[_0xbbcc('0x39')](_0x55df58[_0xbbcc('0x37')],{'$or':_[_0xbbcc('0x25')](_0x131b5b,function(_0x81ef2d){if(_0x81ef2d[_0xbbcc('0x29')]!==_0xbbcc('0x3a')){var _0x8afddb={};_0x8afddb[_0x81ef2d[_0xbbcc('0x22')]]={'$like':'%'+_0x2bb13c[_0xbbcc('0x2c')]['filter']+'%'};return _0x8afddb;}})});}_0x55df58=_[_0xbbcc('0x39')]({},_0x55df58,_0x2bb13c[_0xbbcc('0x3b')]);var _0x332a21={'where':_0x55df58[_0xbbcc('0x37')]};return db[_0xbbcc('0x26')][_0xbbcc('0x19')](_0x332a21)[_0xbbcc('0x1e')](function(_0x14f5ca){_0x548e37[_0xbbcc('0x19')]=_0x14f5ca;if(_0x2bb13c['query']['includeAll']){_0x55df58[_0xbbcc('0x3c')]=[{'all':!![]}];}return db[_0xbbcc('0x26')]['findAll'](_0x55df58);})[_0xbbcc('0x1e')](function(_0x2119a3){_0x548e37[_0xbbcc('0x3d')]=_0x2119a3;return _0x548e37;})[_0xbbcc('0x1e')](respondWithFilteredResult(_0x3fd0c3,_0x55df58))[_0xbbcc('0x3e')](handleError(_0x3fd0c3,null));};exports[_0xbbcc('0x3f')]=function(_0x47bfda,_0x1486e0){var _0x1e6bbe={'raw':![],'where':{'id':_0x47bfda[_0xbbcc('0x40')]['id']}},_0xa1a076={};_0xa1a076[_0xbbcc('0x2b')]=_[_0xbbcc('0x2d')](db['VtigerAccount'][_0xbbcc('0x27')]);_0xa1a076[_0xbbcc('0x2c')]=_[_0xbbcc('0x2d')](_0x47bfda[_0xbbcc('0x2c')]);_0xa1a076[_0xbbcc('0x2e')]=_['intersection'](_0xa1a076[_0xbbcc('0x2b')],_0xa1a076[_0xbbcc('0x2c')]);_0x1e6bbe[_0xbbcc('0x2f')]=_[_0xbbcc('0x30')](_0xa1a076[_0xbbcc('0x2b')],qs[_0xbbcc('0x31')](_0x47bfda['query'][_0xbbcc('0x31')]));_0x1e6bbe[_0xbbcc('0x2f')]=_0x1e6bbe[_0xbbcc('0x2f')][_0xbbcc('0x32')]?_0x1e6bbe[_0xbbcc('0x2f')]:_0xa1a076[_0xbbcc('0x2b')];if(_0x47bfda[_0xbbcc('0x2c')]['includeAll']){_0x1e6bbe['include']=[{'all':!![]}];}_0x1e6bbe=_[_0xbbcc('0x39')]({},_0x1e6bbe,_0x47bfda[_0xbbcc('0x3b')]);return db[_0xbbcc('0x26')][_0xbbcc('0x41')](_0x1e6bbe)[_0xbbcc('0x1e')](handleEntityNotFound(_0x1486e0,null))[_0xbbcc('0x1e')](respondWithResult(_0x1486e0,null))[_0xbbcc('0x3e')](handleError(_0x1486e0,null));};exports['create']=function(_0x9d8345,_0x4712de){return db[_0xbbcc('0x26')][_0xbbcc('0x42')](_0x9d8345[_0xbbcc('0x43')],{})[_0xbbcc('0x1e')](respondWithResult(_0x4712de,0xc9))['catch'](handleError(_0x4712de,null));};exports['update']=function(_0x2ca726,_0x28a363){if(_0x2ca726[_0xbbcc('0x43')]['id']){delete _0x2ca726['body']['id'];}return db[_0xbbcc('0x26')][_0xbbcc('0x41')]({'where':{'id':_0x2ca726[_0xbbcc('0x40')]['id']}})['then'](handleEntityNotFound(_0x28a363,null))[_0xbbcc('0x1e')](saveUpdates(_0x2ca726['body'],null))[_0xbbcc('0x1e')](respondWithResult(_0x28a363,null))[_0xbbcc('0x3e')](handleError(_0x28a363,null));};exports[_0xbbcc('0x1f')]=function(_0x3cfdda,_0x4f3065){return db[_0xbbcc('0x26')]['find']({'where':{'id':_0x3cfdda[_0xbbcc('0x40')]['id']}})[_0xbbcc('0x1e')](handleEntityNotFound(_0x4f3065,null))['then'](removeEntity(_0x4f3065,null))['catch'](handleError(_0x4f3065,null));};exports[_0xbbcc('0x44')]=function(_0x5a5774,_0x32fd41,_0x42489f){var _0x2f9566={};var _0x23bfa8={};var _0x1f8c15;var _0x14df39;return db[_0xbbcc('0x26')]['findOne']({'where':{'id':_0x5a5774[_0xbbcc('0x40')]['id']}})[_0xbbcc('0x1e')](handleEntityNotFound(_0x32fd41,null))['then'](function(_0x1d6e98){if(_0x1d6e98){_0x1f8c15=_0x1d6e98;_0x23bfa8[_0xbbcc('0x2b')]=_['keys'](db['VtigerConfiguration'][_0xbbcc('0x27')]);_0x23bfa8[_0xbbcc('0x2c')]=_[_0xbbcc('0x2d')](_0x5a5774[_0xbbcc('0x2c')]);_0x23bfa8['filters']=_['intersection'](_0x23bfa8[_0xbbcc('0x2b')],_0x23bfa8[_0xbbcc('0x2c')]);_0x2f9566[_0xbbcc('0x2f')]=_[_0xbbcc('0x30')](_0x23bfa8['model'],qs[_0xbbcc('0x31')](_0x5a5774[_0xbbcc('0x2c')][_0xbbcc('0x31')]));_0x2f9566[_0xbbcc('0x2f')]=_0x2f9566[_0xbbcc('0x2f')][_0xbbcc('0x32')]?_0x2f9566[_0xbbcc('0x2f')]:_0x23bfa8['model'];_0x2f9566[_0xbbcc('0x35')]=qs[_0xbbcc('0x36')](_0x5a5774[_0xbbcc('0x2c')][_0xbbcc('0x36')]);_0x2f9566[_0xbbcc('0x37')]=qs[_0xbbcc('0x2e')](_[_0xbbcc('0x45')](_0x5a5774[_0xbbcc('0x2c')],_0x23bfa8[_0xbbcc('0x2e')]));if(_0x5a5774[_0xbbcc('0x2c')]['filter']){_0x2f9566[_0xbbcc('0x37')]=_[_0xbbcc('0x39')](_0x2f9566[_0xbbcc('0x37')],{'$or':_['map'](_0x2f9566[_0xbbcc('0x2f')],function(_0x1e0f9f){var _0x1ad3ea={};_0x1ad3ea[_0x1e0f9f]={'$like':'%'+_0x5a5774[_0xbbcc('0x2c')][_0xbbcc('0x38')]+'%'};return _0x1ad3ea;})});}_0x2f9566=_[_0xbbcc('0x39')]({},_0x2f9566,_0x5a5774['options']);return _0x1f8c15[_0xbbcc('0x44')](_0x2f9566);}})[_0xbbcc('0x1e')](function(_0xe5fc37){if(_0xe5fc37){_0x14df39=_0xe5fc37[_0xbbcc('0x32')];if(!_0x5a5774[_0xbbcc('0x2c')][_0xbbcc('0x33')](_0xbbcc('0x34'))){_0x2f9566[_0xbbcc('0x18')]=qs[_0xbbcc('0x18')](_0x5a5774['query'][_0xbbcc('0x18')]);_0x2f9566[_0xbbcc('0x17')]=qs[_0xbbcc('0x17')](_0x5a5774[_0xbbcc('0x2c')]['offset']);}return _0x1f8c15[_0xbbcc('0x44')](_0x2f9566);}})[_0xbbcc('0x1e')](function(_0x2465fe){if(_0x2465fe){return _0x2465fe?{'count':_0x14df39,'rows':_0x2465fe}:null;}})['then'](respondWithResult(_0x32fd41,null))[_0xbbcc('0x3e')](handleError(_0x32fd41,null));};exports[_0xbbcc('0x46')]=function(_0x4f395a,_0x3206af,_0x31940f){if(_0x4f395a[_0xbbcc('0x43')]['id']){delete _0x4f395a[_0xbbcc('0x43')]['id'];}return db[_0xbbcc('0x26')][_0xbbcc('0x47')]({'where':{'id':_0x4f395a[_0xbbcc('0x40')]['id']}})[_0xbbcc('0x1e')](handleEntityNotFound(_0x3206af,null))[_0xbbcc('0x1e')](function(_0x269d4e){if(_0x269d4e){_0x4f395a[_0xbbcc('0x43')][_0xbbcc('0x48')]=_0x269d4e['id'];_0x4f395a[_0xbbcc('0x43')][_0xbbcc('0x49')]=integrations[_0xbbcc('0x4a')](_0x4f395a[_0xbbcc('0x43')]['channel'],_0x4f395a[_0xbbcc('0x43')][_0xbbcc('0x29')]);_0x4f395a[_0xbbcc('0x43')]['Descriptions']=integrations[_0xbbcc('0x4b')](_0x4f395a[_0xbbcc('0x43')]['channel'],_0x4f395a[_0xbbcc('0x43')][_0xbbcc('0x29')]);return db[_0xbbcc('0x4c')][_0xbbcc('0x42')](_0x4f395a[_0xbbcc('0x43')],{'include':[{'model':db[_0xbbcc('0x4d')],'as':_0xbbcc('0x49')},{'model':db[_0xbbcc('0x4d')],'as':_0xbbcc('0x4e')}]});}return null;})[_0xbbcc('0x1e')](respondWithResult(_0x3206af,null))[_0xbbcc('0x3e')](handleError(_0x3206af,null));};var md5=require(_0xbbcc('0x4f'));exports[_0xbbcc('0x50')]=function(_0x375871,_0x667e2e,_0x2bbdb2){var _0x246157=null;var _0x2ace7b=null;var _0x43e357=null;var _0x15dd05=null;var _0x7a9d3c='';return db[_0xbbcc('0x26')][_0xbbcc('0x47')]({'where':{'id':_0x375871[_0xbbcc('0x40')]['id']},'attributes':['id','name',_0xbbcc('0x51'),_0xbbcc('0x52'),'moduleName',_0xbbcc('0x53'),_0xbbcc('0x54'),_0xbbcc('0x55')]})['then'](handleEntityNotFound(_0x667e2e,null))[_0xbbcc('0x1e')](function(_0x5aab5f){if(_0x5aab5f){_0x246157=_0x5aab5f['username'];_0x2ace7b=_0x5aab5f[_0xbbcc('0x55')];_0x43e357=_0x5aab5f[_0xbbcc('0x56')];_0x7a9d3c=_0x5aab5f[_0xbbcc('0x53')];var _0x3ae41f=_0x7a9d3c['slice'](-0x1);if(_0x3ae41f==='/'){_0x7a9d3c=_0x7a9d3c['substring'](0x0,_0x7a9d3c[_0xbbcc('0x57')](_0x3ae41f));}_0x15dd05=util[_0xbbcc('0x58')](_0xbbcc('0x59'),_0x7a9d3c);var _0x4c6a5d={'method':_0xbbcc('0x5a'),'uri':_0x15dd05,'qs':{'operation':_0xbbcc('0x5b'),'username':_0x5aab5f[_0xbbcc('0x51')]},'json':!![]};return rp(_0x4c6a5d);}})['then'](function(_0xec96d9){if(_0xec96d9[_0xbbcc('0x5c')]){var _0x437142={'method':'POST','uri':_0x15dd05,'form':{'operation':_0xbbcc('0x5d'),'username':_0x246157,'accessKey':md5(_0xec96d9[_0xbbcc('0x5e')]['token']+_0x2ace7b)},'json':!![]};return rp(_0x437142);}})[_0xbbcc('0x1e')](function(_0x698814){if(_0x698814[_0xbbcc('0x5c')]){var _0x398899={'method':_0xbbcc('0x5a'),'uri':_0x15dd05,'qs':{'operation':_0xbbcc('0x5f'),'username':_0x246157,'sessionName':_0x698814[_0xbbcc('0x5e')][_0xbbcc('0x60')],'elementType':_0x43e357},'json':!![]};return rp(_0x398899);}})[_0xbbcc('0x1e')](function(_0x5d7e1f){if(_0x5d7e1f[_0xbbcc('0x5c')]){var _0x55ace7=[_0xbbcc('0x61'),_0xbbcc('0x62'),'owner'];_[_0xbbcc('0x63')](_0x5d7e1f[_0xbbcc('0x5e')][_0xbbcc('0x31')],function(_0x739511){return _0x55ace7[_0xbbcc('0x64')](_0x739511[_0xbbcc('0x29')][_0xbbcc('0x22')]);});_[_0xbbcc('0x63')](_0x5d7e1f[_0xbbcc('0x5e')][_0xbbcc('0x31')],function(_0x5293b2){return _0x5293b2['editable']==='false';});return{'count':_0x5d7e1f[_0xbbcc('0x5e')]['fields'][_0xbbcc('0x32')],'rows':_[_0xbbcc('0x25')](_0x5d7e1f[_0xbbcc('0x5e')][_0xbbcc('0x31')],function(_0x592d98){return{'id':_0x592d98[_0xbbcc('0x22')],'name':_0x592d98['label'],'custom':_['startsWith'](_0x592d98[_0xbbcc('0x22')],_0xbbcc('0x65'))?!![]:![],'options':_0x592d98[_0xbbcc('0x29')]['name']===_0xbbcc('0x66')&&_0x592d98['type'][_0xbbcc('0x67')][_0xbbcc('0x32')]>0x0?_['map'](_0x592d98['type'][_0xbbcc('0x67')],function(_0x567b9b){return{'name':_0x567b9b[_0xbbcc('0x68')],'value':_0x567b9b[_0xbbcc('0x69')]};}):[]};})};}})[_0xbbcc('0x1e')](respondWithResult(_0x667e2e,null))['catch'](function(_0x59723c){console['log']('vTiger\x20error:\x20'+_0x59723c);var _0x38b3d8=_0x375871[_0xbbcc('0x2c')][_0xbbcc('0x6a')]?0x1f4:_0x59723c[_0xbbcc('0x6b')]||0x1f4;logger['error'](_0xbbcc('0x6c'),_0xbbcc('0x50'),_0x38b3d8,JSON[_0xbbcc('0x6d')](_0x59723c));delete _0x59723c[_0xbbcc('0x22')];if(_0x38b3d8===0x191){_0x38b3d8=0x190;}_0x667e2e[_0xbbcc('0x15')](_0x38b3d8)[_0xbbcc('0x23')](_0x375871['query'][_0xbbcc('0x6a')]?{'message':_0xbbcc('0x6e'),'statusCode':_0x59723c['statusCode']}:_0x59723c);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 3308bde..23cc162 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 _0x52d1=['VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../components/integrations/configuration','exports','define'];(function(_0x2f93d7,_0xc79a48){var _0x2925e9=function(_0x371c6c){while(--_0x371c6c){_0x2f93d7['push'](_0x2f93d7['shift']());}};_0x2925e9(++_0xc79a48);}(_0x52d1,0xc5));var _0x152d=function(_0x1318de,_0x466201){_0x1318de=_0x1318de-0x0;var _0xf2f1df=_0x52d1[_0x1318de];return _0xf2f1df;};'use strict';var _=require(_0x152d('0x0'));var util=require(_0x152d('0x1'));var logger=require(_0x152d('0x2'))(_0x152d('0x3'));var moment=require('moment');var BPromise=require(_0x152d('0x4'));var rp=require(_0x152d('0x5'));var fs=require('fs');var path=require(_0x152d('0x6'));var rimraf=require(_0x152d('0x7'));var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x152d('0x8'));module[_0x152d('0x9')]=function(_0x241cb5,_0x4b7e43){return _0x241cb5[_0x152d('0xa')](_0x152d('0xb'),attributes,{'tableName':_0x152d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd088=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intVtigerAccount.attributes','../../components/integrations/configuration','int_vtiger_accounts','lodash'];(function(_0x96a9f9,_0x5a43fb){var _0x3f587c=function(_0x2d8b20){while(--_0x2d8b20){_0x96a9f9['push'](_0x96a9f9['shift']());}};_0x3f587c(++_0x5a43fb);}(_0xd088,0x6b));var _0x8d08=function(_0x3bec4c,_0xc1e66e){_0x3bec4c=_0x3bec4c-0x0;var _0x2a053f=_0xd088[_0x3bec4c];return _0x2a053f;};'use strict';var _=require(_0x8d08('0x0'));var util=require(_0x8d08('0x1'));var logger=require(_0x8d08('0x2'))(_0x8d08('0x3'));var moment=require(_0x8d08('0x4'));var BPromise=require(_0x8d08('0x5'));var rp=require(_0x8d08('0x6'));var fs=require('fs');var path=require(_0x8d08('0x7'));var rimraf=require(_0x8d08('0x8'));var config=require('../../config/environment');var attributes=require(_0x8d08('0x9'));var integrations=require(_0x8d08('0xa'));module['exports']=function(_0x5b6b2e,_0x56910a){return _0x5b6b2e['define']('VtigerAccount',attributes,{'tableName':_0x8d08('0xb'),'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 44b2972..eff4726 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 _0x80ed=['then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','where','limit','include','map','model','attributes','GetVtigerAccount','VtigerAccount','find','raw','debug','ShowVtigerAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x80ed,0x11c));var _0xd80e=function(_0x1210af,_0x497f42){_0x1210af=_0x1210af-0x0;var _0x2b524e=_0x80ed[_0x1210af];return _0x2b524e;};'use strict';var _=require(_0xd80e('0x0'));var util=require('util');var moment=require(_0xd80e('0x1'));var BPromise=require(_0xd80e('0x2'));var rs=require(_0xd80e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd80e('0x4'))['db'];var utils=require(_0xd80e('0x5'));var logger=require(_0xd80e('0x6'))(_0xd80e('0x7'));var config=require('../../config/environment');var jayson=require(_0xd80e('0x8'));var client=jayson[_0xd80e('0x9')][_0xd80e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51c361,_0x411b3a,_0x438f7d){return new BPromise(function(_0x3b4f35,_0x1bacd3){return client[_0xd80e('0xb')](_0x51c361,_0x438f7d)[_0xd80e('0xc')](function(_0x3063ff){logger[_0xd80e('0xd')](_0xd80e('0xe'),_0x411b3a,_0xd80e('0xf'));logger['debug'](_0xd80e('0x10'),_0x411b3a,_0xd80e('0xf'),JSON[_0xd80e('0x11')](_0x3063ff));if(_0x3063ff[_0xd80e('0x12')]){if(_0x3063ff[_0xd80e('0x12')][_0xd80e('0x13')]===0x1f4){logger[_0xd80e('0x12')](_0xd80e('0xe'),_0x411b3a,_0x3063ff[_0xd80e('0x12')]['message']);return _0x1bacd3(_0x3063ff['error']['message']);}logger['error'](_0xd80e('0xe'),_0x411b3a,_0x3063ff[_0xd80e('0x12')][_0xd80e('0x14')]);return _0x3b4f35(_0x3063ff[_0xd80e('0x12')][_0xd80e('0x14')]);}else{logger['info'](_0xd80e('0xe'),_0x411b3a,_0xd80e('0xf'));_0x3b4f35(_0x3063ff[_0xd80e('0x15')][_0xd80e('0x14')]);}})[_0xd80e('0x16')](function(_0xc25d82){logger[_0xd80e('0x12')](_0xd80e('0xe'),_0x411b3a,_0xc25d82);_0x1bacd3(_0xc25d82);});});}exports['GetVtigerAccount']=function(_0x21ceec){var _0x1cc576=this;return new Promise(function(_0x3b543d,_0x34e239){return db['VtigerAccount'][_0xd80e('0x17')]({'raw':_0x21ceec[_0xd80e('0x18')]?_0x21ceec[_0xd80e('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x21ceec[_0xd80e('0x18')]?_0x21ceec[_0xd80e('0x18')][_0xd80e('0x19')]||null:null,'attributes':_0x21ceec[_0xd80e('0x18')]?_0x21ceec[_0xd80e('0x18')]['attributes']||null:null,'limit':_0x21ceec['options']?_0x21ceec[_0xd80e('0x18')][_0xd80e('0x1a')]||null:null,'include':_0x21ceec[_0xd80e('0x18')]?_0x21ceec[_0xd80e('0x18')][_0xd80e('0x1b')]?_[_0xd80e('0x1c')](_0x21ceec[_0xd80e('0x18')]['include'],function(_0x1fbf8a){return{'model':db[_0x1fbf8a[_0xd80e('0x1d')]],'as':_0x1fbf8a['as'],'attributes':_0x1fbf8a[_0xd80e('0x1e')],'include':_0x1fbf8a['include']?_[_0xd80e('0x1c')](_0x1fbf8a[_0xd80e('0x1b')],function(_0xe9bb59){return{'model':db[_0xe9bb59['model']],'as':_0xe9bb59['as'],'attributes':_0xe9bb59['attributes'],'include':_0xe9bb59['include']?_[_0xd80e('0x1c')](_0xe9bb59['include'],function(_0x9f9287){return{'model':db[_0x9f9287[_0xd80e('0x1d')]],'as':_0x9f9287['as'],'attributes':_0x9f9287['attributes']};}):[]};}):[]};}):[]:[]})[_0xd80e('0xc')](function(_0xe1c04a){logger[_0xd80e('0xd')](_0xd80e('0x1f'),_0x21ceec);logger['debug'](_0xd80e('0x1f'),_0x21ceec,JSON[_0xd80e('0x11')](_0xe1c04a));_0x3b543d(_0xe1c04a);})[_0xd80e('0x16')](function(_0x39088b){logger[_0xd80e('0x12')](_0xd80e('0x1f'),_0x39088b[_0xd80e('0x14')],_0x21ceec);_0x34e239(_0x1cc576[_0xd80e('0x12')](0x1f4,_0x39088b['message']));});});};exports['ShowVtigerAccount']=function(_0x30f9bd){var _0x1303eb=this;return new Promise(function(_0x400220,_0x32360c){return db[_0xd80e('0x20')][_0xd80e('0x21')]({'raw':_0x30f9bd['options']?_0x30f9bd['options'][_0xd80e('0x22')]===undefined?!![]:![]:!![],'where':_0x30f9bd[_0xd80e('0x18')]?_0x30f9bd[_0xd80e('0x18')][_0xd80e('0x19')]||null:null,'attributes':_0x30f9bd[_0xd80e('0x18')]?_0x30f9bd[_0xd80e('0x18')][_0xd80e('0x1e')]||null:null,'include':_0x30f9bd[_0xd80e('0x18')]?_0x30f9bd['options']['include']?_[_0xd80e('0x1c')](_0x30f9bd[_0xd80e('0x18')][_0xd80e('0x1b')],function(_0x12d113){return{'model':db[_0x12d113[_0xd80e('0x1d')]],'as':_0x12d113['as'],'attributes':_0x12d113[_0xd80e('0x1e')],'include':_0x12d113[_0xd80e('0x1b')]?_[_0xd80e('0x1c')](_0x12d113[_0xd80e('0x1b')],function(_0x192c08){return{'model':db[_0x192c08['model']],'as':_0x192c08['as'],'attributes':_0x192c08[_0xd80e('0x1e')],'include':_0x192c08['include']?_[_0xd80e('0x1c')](_0x192c08[_0xd80e('0x1b')],function(_0x366b80){return{'model':db[_0x366b80[_0xd80e('0x1d')]],'as':_0x366b80['as'],'attributes':_0x366b80['attributes']};}):[]};}):[]};}):[]:[]})[_0xd80e('0xc')](function(_0x54a969){logger[_0xd80e('0xd')]('ShowVtigerAccount',_0x30f9bd);logger[_0xd80e('0x23')](_0xd80e('0x24'),_0x30f9bd,JSON['stringify'](_0x54a969));_0x400220(_0x54a969);})[_0xd80e('0x16')](function(_0x41ac0d){logger[_0xd80e('0x12')]('ShowVtigerAccount',_0x41ac0d[_0xd80e('0x14')],_0x30f9bd);_0x32360c(_0x1303eb[_0xd80e('0x12')](0x1f4,_0x41ac0d[_0xd80e('0x14')]));});});}; \ No newline at end of file +var _0x6b20=['../../config/environment','jayson/promise','client','http','request','VtigerAccount,\x20%s,\x20%s','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','limit','map','attributes','include','model','then','debug','stringify','catch','ShowVtigerAccount','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0x6b20,0xd1));var _0x06b2=function(_0x3b1a8f,_0x2968ed){_0x3b1a8f=_0x3b1a8f-0x0;var _0x3f0ee4=_0x6b20[_0x3b1a8f];return _0x3f0ee4;};'use strict';var _=require(_0x06b2('0x0'));var util=require(_0x06b2('0x1'));var moment=require('moment');var BPromise=require(_0x06b2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x06b2('0x3'));var db=require(_0x06b2('0x4'))['db'];var utils=require(_0x06b2('0x5'));var logger=require('../../config/logger')(_0x06b2('0x6'));var config=require(_0x06b2('0x7'));var jayson=require(_0x06b2('0x8'));var client=jayson[_0x06b2('0x9')][_0x06b2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37b825,_0x26a325,_0x4e6d3b){return new BPromise(function(_0x21cd31,_0x1828e4){return client[_0x06b2('0xb')](_0x37b825,_0x4e6d3b)['then'](function(_0x37ace0){logger['info'](_0x06b2('0xc'),_0x26a325,'request\x20sent');logger['debug'](_0x06b2('0xd'),_0x26a325,_0x06b2('0xe'),JSON['stringify'](_0x37ace0));if(_0x37ace0[_0x06b2('0xf')]){if(_0x37ace0[_0x06b2('0xf')][_0x06b2('0x10')]===0x1f4){logger[_0x06b2('0xf')](_0x06b2('0xc'),_0x26a325,_0x37ace0[_0x06b2('0xf')][_0x06b2('0x11')]);return _0x1828e4(_0x37ace0[_0x06b2('0xf')][_0x06b2('0x11')]);}logger[_0x06b2('0xf')](_0x06b2('0xc'),_0x26a325,_0x37ace0[_0x06b2('0xf')][_0x06b2('0x11')]);return _0x21cd31(_0x37ace0['error'][_0x06b2('0x11')]);}else{logger[_0x06b2('0x12')](_0x06b2('0xc'),_0x26a325,_0x06b2('0xe'));_0x21cd31(_0x37ace0[_0x06b2('0x13')][_0x06b2('0x11')]);}})['catch'](function(_0x17e69b){logger[_0x06b2('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x26a325,_0x17e69b);_0x1828e4(_0x17e69b);});});}exports[_0x06b2('0x14')]=function(_0x594b48){var _0x4c9cae=this;return new Promise(function(_0x192270,_0x1b4ab0){return db[_0x06b2('0x15')][_0x06b2('0x16')]({'raw':_0x594b48['options']?_0x594b48[_0x06b2('0x17')][_0x06b2('0x18')]===undefined?!![]:![]:!![],'where':_0x594b48[_0x06b2('0x17')]?_0x594b48[_0x06b2('0x17')][_0x06b2('0x19')]||null:null,'attributes':_0x594b48[_0x06b2('0x17')]?_0x594b48[_0x06b2('0x17')]['attributes']||null:null,'limit':_0x594b48[_0x06b2('0x17')]?_0x594b48[_0x06b2('0x17')][_0x06b2('0x1a')]||null:null,'include':_0x594b48[_0x06b2('0x17')]?_0x594b48['options']['include']?_[_0x06b2('0x1b')](_0x594b48[_0x06b2('0x17')]['include'],function(_0x39659f){return{'model':db[_0x39659f['model']],'as':_0x39659f['as'],'attributes':_0x39659f[_0x06b2('0x1c')],'include':_0x39659f[_0x06b2('0x1d')]?_[_0x06b2('0x1b')](_0x39659f['include'],function(_0x4382ce){return{'model':db[_0x4382ce[_0x06b2('0x1e')]],'as':_0x4382ce['as'],'attributes':_0x4382ce[_0x06b2('0x1c')],'include':_0x4382ce[_0x06b2('0x1d')]?_[_0x06b2('0x1b')](_0x4382ce['include'],function(_0xbb00ea){return{'model':db[_0xbb00ea[_0x06b2('0x1e')]],'as':_0xbb00ea['as'],'attributes':_0xbb00ea[_0x06b2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x06b2('0x1f')](function(_0x1976ac){logger[_0x06b2('0x12')]('GetVtigerAccount',_0x594b48);logger[_0x06b2('0x20')](_0x06b2('0x14'),_0x594b48,JSON[_0x06b2('0x21')](_0x1976ac));_0x192270(_0x1976ac);})[_0x06b2('0x22')](function(_0x1f02d8){logger[_0x06b2('0xf')](_0x06b2('0x14'),_0x1f02d8['message'],_0x594b48);_0x1b4ab0(_0x4c9cae[_0x06b2('0xf')](0x1f4,_0x1f02d8[_0x06b2('0x11')]));});});};exports[_0x06b2('0x23')]=function(_0x15a78b){var _0x1cc725=this;return new Promise(function(_0x37d391,_0x401551){return db[_0x06b2('0x15')]['find']({'raw':_0x15a78b[_0x06b2('0x17')]?_0x15a78b[_0x06b2('0x17')][_0x06b2('0x18')]===undefined?!![]:![]:!![],'where':_0x15a78b[_0x06b2('0x17')]?_0x15a78b[_0x06b2('0x17')][_0x06b2('0x19')]||null:null,'attributes':_0x15a78b[_0x06b2('0x17')]?_0x15a78b['options']['attributes']||null:null,'include':_0x15a78b[_0x06b2('0x17')]?_0x15a78b[_0x06b2('0x17')][_0x06b2('0x1d')]?_['map'](_0x15a78b[_0x06b2('0x17')][_0x06b2('0x1d')],function(_0x37bfb5){return{'model':db[_0x37bfb5[_0x06b2('0x1e')]],'as':_0x37bfb5['as'],'attributes':_0x37bfb5[_0x06b2('0x1c')],'include':_0x37bfb5[_0x06b2('0x1d')]?_['map'](_0x37bfb5[_0x06b2('0x1d')],function(_0x1e66f1){return{'model':db[_0x1e66f1[_0x06b2('0x1e')]],'as':_0x1e66f1['as'],'attributes':_0x1e66f1['attributes'],'include':_0x1e66f1[_0x06b2('0x1d')]?_[_0x06b2('0x1b')](_0x1e66f1['include'],function(_0x45ea67){return{'model':db[_0x45ea67[_0x06b2('0x1e')]],'as':_0x45ea67['as'],'attributes':_0x45ea67[_0x06b2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x06b2('0x1f')](function(_0x2e49df){logger[_0x06b2('0x12')](_0x06b2('0x23'),_0x15a78b);logger[_0x06b2('0x20')](_0x06b2('0x23'),_0x15a78b,JSON[_0x06b2('0x21')](_0x2e49df));_0x37d391(_0x2e49df);})[_0x06b2('0x22')](function(_0x1cc7b6){logger['error'](_0x06b2('0x23'),_0x1cc7b6['message'],_0x15a78b);_0x401551(_0x1cc725['error'](0x1f4,_0x1cc7b6[_0x06b2('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 461e02d..abe0dac 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 _0x6e90=['express','Router','fs-extra','../../components/interaction/service','./intVtigerConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x6e90,0x9e));var _0x06e9=function(_0x589d35,_0x51f145){_0x589d35=_0x589d35-0x0;var _0x39d5be=_0x6e90[_0x589d35];return _0x39d5be;};'use strict';var multer=require(_0x06e9('0x0'));var util=require(_0x06e9('0x1'));var path=require(_0x06e9('0x2'));var timeout=require(_0x06e9('0x3'));var express=require(_0x06e9('0x4'));var router=express[_0x06e9('0x5')]();var fs_extra=require(_0x06e9('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x06e9('0x7'));var config=require('../../config/environment');var controller=require(_0x06e9('0x8'));router[_0x06e9('0x9')]('/',auth['isAuthenticated'](),controller[_0x06e9('0xa')]);router[_0x06e9('0x9')](_0x06e9('0xb'),auth[_0x06e9('0xc')](),controller[_0x06e9('0xd')]);router['get'](_0x06e9('0xe'),auth['isAuthenticated'](),controller[_0x06e9('0xf')]);router[_0x06e9('0x9')](_0x06e9('0x10'),auth['isAuthenticated'](),controller[_0x06e9('0x11')]);router[_0x06e9('0x9')](_0x06e9('0x12'),auth[_0x06e9('0xc')](),controller[_0x06e9('0x13')]);router[_0x06e9('0x14')]('/',auth['isAuthenticated'](),controller[_0x06e9('0x15')]);router[_0x06e9('0x16')](_0x06e9('0xb'),auth[_0x06e9('0xc')](),controller[_0x06e9('0x17')]);router[_0x06e9('0x18')](_0x06e9('0xb'),auth['isAuthenticated'](),controller[_0x06e9('0x19')]);module[_0x06e9('0x1a')]=router; \ No newline at end of file +var _0x620f=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','create','update','multer','util'];(function(_0x53f342,_0x5ecabe){var _0x262be0=function(_0x3cb8c8){while(--_0x3cb8c8){_0x53f342['push'](_0x53f342['shift']());}};_0x262be0(++_0x5ecabe);}(_0x620f,0x129));var _0xf620=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x620f[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0xf620('0x0'));var util=require(_0xf620('0x1'));var path=require(_0xf620('0x2'));var timeout=require(_0xf620('0x3'));var express=require(_0xf620('0x4'));var router=express[_0xf620('0x5')]();var fs_extra=require(_0xf620('0x6'));var auth=require(_0xf620('0x7'));var interaction=require(_0xf620('0x8'));var config=require(_0xf620('0x9'));var controller=require(_0xf620('0xa'));router[_0xf620('0xb')]('/',auth[_0xf620('0xc')](),controller[_0xf620('0xd')]);router[_0xf620('0xb')](_0xf620('0xe'),auth[_0xf620('0xc')](),controller[_0xf620('0xf')]);router[_0xf620('0xb')](_0xf620('0x10'),auth[_0xf620('0xc')](),controller[_0xf620('0x11')]);router[_0xf620('0xb')](_0xf620('0x12'),auth[_0xf620('0xc')](),controller[_0xf620('0x13')]);router[_0xf620('0xb')](_0xf620('0x14'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0xf620('0xc')](),controller[_0xf620('0x15')]);router['put'](_0xf620('0xe'),auth[_0xf620('0xc')](),controller[_0xf620('0x16')]);router['delete'](_0xf620('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index f2f34e3..249cfec 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 _0xc9f1=['sequelize','exports','STRING'];(function(_0x324a4e,_0x313dce){var _0x4f8caf=function(_0x12f763){while(--_0x12f763){_0x324a4e['push'](_0x324a4e['shift']());}};_0x4f8caf(++_0x313dce);}(_0xc9f1,0xc3));var _0x1c9f=function(_0x55008c,_0x1846d2){_0x55008c=_0x55008c-0x0;var _0x4a3ea0=_0xc9f1[_0x55008c];return _0x4a3ea0;};'use strict';var Sequelize=require(_0x1c9f('0x0'));module[_0x1c9f('0x1')]={'name':{'type':Sequelize[_0x1c9f('0x2')]},'description':{'type':Sequelize[_0x1c9f('0x2')]}}; \ No newline at end of file +var _0xf109=['STRING','exports'];(function(_0x4b52e0,_0x15f121){var _0x162ea8=function(_0x11119f){while(--_0x11119f){_0x4b52e0['push'](_0x4b52e0['shift']());}};_0x162ea8(++_0x15f121);}(_0xf109,0x193));var _0x9f10=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0xf109[_0x5a3cf0];return _0x5a64ee;};'use strict';var Sequelize=require('sequelize');module[_0x9f10('0x0')]={'name':{'type':Sequelize[_0x9f10('0x1')]},'description':{'type':Sequelize[_0x9f10('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 4f28171..42221ac 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 _0x1374=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','stack','name','index','map','VtigerConfiguration','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','getFields','findOne','VtigerField','order','getSubjects','getDescriptions'];(function(_0x2c0f30,_0x3cc5bc){var _0x3c4a97=function(_0x34c329){while(--_0x34c329){_0x2c0f30['push'](_0x2c0f30['shift']());}};_0x3c4a97(++_0x3cc5bc);}(_0x1374,0x1e0));var _0x4137=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x1374[_0x27af45];return _0x18df21;};'use strict';var emlformat=require(_0x4137('0x0'));var rimraf=require(_0x4137('0x1'));var zipdir=require(_0x4137('0x2'));var jsonpatch=require(_0x4137('0x3'));var rp=require(_0x4137('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4137('0x5'));var path=require(_0x4137('0x6'));var sox=require(_0x4137('0x7'));var csv=require('to-csv');var ejs=require(_0x4137('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4137('0x9'));var squel=require(_0x4137('0xa'));var crypto=require(_0x4137('0xb'));var jsforce=require(_0x4137('0xc'));var deskjs=require(_0x4137('0xd'));var toCsv=require(_0x4137('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4137('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4137('0x10'));var as=require(_0x4137('0x11'));var hardwareService=require(_0x4137('0x12'));var logger=require(_0x4137('0x13'))(_0x4137('0x14'));var utils=require(_0x4137('0x15'));var config=require(_0x4137('0x16'));var licenseUtil=require(_0x4137('0x17'));var db=require(_0x4137('0x18'))['db'];function respondWithStatusCode(_0x58106a,_0xa0e91c){_0xa0e91c=_0xa0e91c||0xcc;return function(_0x12488c){if(_0x12488c){return _0x58106a[_0x4137('0x19')](_0xa0e91c);}return _0x58106a[_0x4137('0x1a')](_0xa0e91c)['end']();};}function respondWithResult(_0x5f3c69,_0x130a35){_0x130a35=_0x130a35||0xc8;return function(_0x17fcb5){if(_0x17fcb5){return _0x5f3c69['status'](_0x130a35)[_0x4137('0x1b')](_0x17fcb5);}};}function respondWithFilteredResult(_0x5a15f1,_0x4fc335){return function(_0x225681){if(_0x225681){var _0xfbd4c6=typeof _0x4fc335[_0x4137('0x1c')]===_0x4137('0x1d')&&typeof _0x4fc335['limit']===_0x4137('0x1d');var _0xd9cec5=_0x225681[_0x4137('0x1e')];var _0x3249ee=_0xfbd4c6?0x0:_0x4fc335[_0x4137('0x1c')];var _0x32e7f3=_0xfbd4c6?_0x225681['count']:_0x4fc335[_0x4137('0x1c')]+_0x4fc335[_0x4137('0x1f')];var _0x274663;if(_0x32e7f3>=_0xd9cec5){_0x32e7f3=_0xd9cec5;_0x274663=0xc8;}else{_0x274663=0xce;}_0x5a15f1[_0x4137('0x1a')](_0x274663);return _0x5a15f1[_0x4137('0x20')](_0x4137('0x21'),_0x3249ee+'-'+_0x32e7f3+'/'+_0xd9cec5)['json'](_0x225681);}return null;};}function patchUpdates(_0x442596){return function(_0x3be082){try{jsonpatch[_0x4137('0x22')](_0x3be082,_0x442596,!![]);}catch(_0x568ecc){return BPromise['reject'](_0x568ecc);}return _0x3be082['save']();};}function saveUpdates(_0x390aea,_0x492744){return function(_0x51836b){if(_0x51836b){return _0x51836b[_0x4137('0x23')](_0x390aea)[_0x4137('0x24')](function(_0x1c0d8b){return _0x1c0d8b;});}return null;};}function removeEntity(_0x51551a,_0x409e5c){return function(_0x1b41a3){if(_0x1b41a3){return _0x1b41a3[_0x4137('0x25')]()[_0x4137('0x24')](function(){_0x51551a[_0x4137('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f8eab,_0x1f70a1){return function(_0x4d63ce){if(!_0x4d63ce){_0x3f8eab[_0x4137('0x19')](0x194);}return _0x4d63ce;};}function handleError(_0x7aa30e,_0x335f81){_0x335f81=_0x335f81||0x1f4;return function(_0x23b943){logger['error'](_0x23b943[_0x4137('0x26')]);if(_0x23b943[_0x4137('0x27')]){delete _0x23b943[_0x4137('0x27')];}_0x7aa30e[_0x4137('0x1a')](_0x335f81)['send'](_0x23b943);};}exports[_0x4137('0x28')]=function(_0x24edf2,_0x390bcf){var _0xd36475={},_0xb82084={},_0x56f248={'count':0x0,'rows':[]};var _0x5b8cec=_[_0x4137('0x29')](db[_0x4137('0x2a')][_0x4137('0x2b')],function(_0x13512f){return{'name':_0x13512f[_0x4137('0x2c')],'type':_0x13512f['type'][_0x4137('0x2d')]};});_0xb82084[_0x4137('0x2e')]=_[_0x4137('0x29')](_0x5b8cec,'name');_0xb82084[_0x4137('0x2f')]=_['keys'](_0x24edf2['query']);_0xb82084[_0x4137('0x30')]=_['intersection'](_0xb82084[_0x4137('0x2e')],_0xb82084[_0x4137('0x2f')]);_0xd36475[_0x4137('0x31')]=_[_0x4137('0x32')](_0xb82084[_0x4137('0x2e')],qs['fields'](_0x24edf2[_0x4137('0x2f')][_0x4137('0x33')]));_0xd36475[_0x4137('0x31')]=_0xd36475[_0x4137('0x31')]['length']?_0xd36475['attributes']:_0xb82084['model'];if(!_0x24edf2['query'][_0x4137('0x34')](_0x4137('0x35'))){_0xd36475['limit']=qs['limit'](_0x24edf2[_0x4137('0x2f')][_0x4137('0x1f')]);_0xd36475[_0x4137('0x1c')]=qs['offset'](_0x24edf2['query']['offset']);}_0xd36475['order']=qs[_0x4137('0x36')](_0x24edf2[_0x4137('0x2f')][_0x4137('0x36')]);_0xd36475['where']=qs['filters'](_[_0x4137('0x37')](_0x24edf2[_0x4137('0x2f')],_0xb82084[_0x4137('0x30')]),_0x5b8cec);if(_0x24edf2[_0x4137('0x2f')][_0x4137('0x38')]){_0xd36475[_0x4137('0x39')]=_[_0x4137('0x3a')](_0xd36475['where'],{'$or':_[_0x4137('0x29')](_0x5b8cec,function(_0x37dc99){if(_0x37dc99[_0x4137('0x3b')]!==_0x4137('0x3c')){var _0x2948b4={};_0x2948b4[_0x37dc99[_0x4137('0x27')]]={'$like':'%'+_0x24edf2[_0x4137('0x2f')][_0x4137('0x38')]+'%'};return _0x2948b4;}})});}_0xd36475=_[_0x4137('0x3a')]({},_0xd36475,_0x24edf2[_0x4137('0x3d')]);var _0x321c7a={'where':_0xd36475['where']};return db[_0x4137('0x2a')]['count'](_0x321c7a)[_0x4137('0x24')](function(_0x24773b){_0x56f248[_0x4137('0x1e')]=_0x24773b;if(_0x24edf2[_0x4137('0x2f')][_0x4137('0x3e')]){_0xd36475[_0x4137('0x3f')]=[{'all':!![]}];}return db[_0x4137('0x2a')][_0x4137('0x40')](_0xd36475);})['then'](function(_0x4645cc){_0x56f248[_0x4137('0x41')]=_0x4645cc;return _0x56f248;})[_0x4137('0x24')](respondWithFilteredResult(_0x390bcf,_0xd36475))[_0x4137('0x42')](handleError(_0x390bcf,null));};exports[_0x4137('0x43')]=function(_0x4372ae,_0x188392){var _0x634f0b={'raw':![],'where':{'id':_0x4372ae[_0x4137('0x44')]['id']}},_0x2c6d46={};_0x2c6d46['model']=_[_0x4137('0x45')](db['VtigerConfiguration']['rawAttributes']);_0x2c6d46[_0x4137('0x2f')]=_['keys'](_0x4372ae['query']);_0x2c6d46[_0x4137('0x30')]=_[_0x4137('0x32')](_0x2c6d46['model'],_0x2c6d46[_0x4137('0x2f')]);_0x634f0b[_0x4137('0x31')]=_[_0x4137('0x32')](_0x2c6d46['model'],qs[_0x4137('0x33')](_0x4372ae[_0x4137('0x2f')]['fields']));_0x634f0b[_0x4137('0x31')]=_0x634f0b[_0x4137('0x31')][_0x4137('0x46')]?_0x634f0b[_0x4137('0x31')]:_0x2c6d46[_0x4137('0x2e')];if(_0x4372ae[_0x4137('0x2f')][_0x4137('0x3e')]){_0x634f0b[_0x4137('0x3f')]=[{'all':!![]}];}_0x634f0b=_['merge']({},_0x634f0b,_0x4372ae[_0x4137('0x3d')]);return db[_0x4137('0x2a')][_0x4137('0x47')](_0x634f0b)[_0x4137('0x24')](handleEntityNotFound(_0x188392,null))[_0x4137('0x24')](respondWithResult(_0x188392,null))[_0x4137('0x42')](handleError(_0x188392,null));};exports[_0x4137('0x48')]=function(_0x49bcfd,_0x1295a1){return db[_0x4137('0x2a')][_0x4137('0x48')](_0x49bcfd[_0x4137('0x49')],{})[_0x4137('0x24')](respondWithResult(_0x1295a1,0xc9))[_0x4137('0x42')](handleError(_0x1295a1,null));};exports[_0x4137('0x23')]=function(_0x384b42,_0x3fc04a){if(_0x384b42['body']['id']){delete _0x384b42[_0x4137('0x49')]['id'];}return db[_0x4137('0x2a')][_0x4137('0x47')]({'where':{'id':_0x384b42[_0x4137('0x44')]['id']}})[_0x4137('0x24')](handleEntityNotFound(_0x3fc04a,null))[_0x4137('0x24')](saveUpdates(_0x384b42[_0x4137('0x49')],null))[_0x4137('0x24')](respondWithResult(_0x3fc04a,null))[_0x4137('0x42')](handleError(_0x3fc04a,null));};exports[_0x4137('0x25')]=function(_0x3f72fd,_0x30fc74){return db[_0x4137('0x2a')][_0x4137('0x47')]({'where':{'id':_0x3f72fd[_0x4137('0x44')]['id']}})['then'](handleEntityNotFound(_0x30fc74,null))['then'](removeEntity(_0x30fc74,null))[_0x4137('0x42')](handleError(_0x30fc74,null));};exports[_0x4137('0x4a')]=function(_0x50c79b,_0x542abd,_0x356496){var _0x714ee7={};var _0x49ec2b={};var _0x10524b;var _0x3dd83e;return db[_0x4137('0x2a')][_0x4137('0x4b')]({'where':{'id':_0x50c79b[_0x4137('0x44')]['id']}})[_0x4137('0x24')](handleEntityNotFound(_0x542abd,null))['then'](function(_0x45cc51){if(_0x45cc51){_0x10524b=_0x45cc51;_0x49ec2b[_0x4137('0x2e')]=_[_0x4137('0x45')](db[_0x4137('0x4c')][_0x4137('0x2b')]);_0x49ec2b['query']=_[_0x4137('0x45')](_0x50c79b['query']);_0x49ec2b[_0x4137('0x30')]=_[_0x4137('0x32')](_0x49ec2b['model'],_0x49ec2b['query']);_0x714ee7['attributes']=_[_0x4137('0x32')](_0x49ec2b[_0x4137('0x2e')],qs[_0x4137('0x33')](_0x50c79b[_0x4137('0x2f')][_0x4137('0x33')]));_0x714ee7['attributes']=_0x714ee7[_0x4137('0x31')]['length']?_0x714ee7['attributes']:_0x49ec2b[_0x4137('0x2e')];_0x714ee7[_0x4137('0x4d')]=qs[_0x4137('0x36')](_0x50c79b[_0x4137('0x2f')][_0x4137('0x36')]);_0x714ee7[_0x4137('0x39')]=qs['filters'](_[_0x4137('0x37')](_0x50c79b[_0x4137('0x2f')],_0x49ec2b[_0x4137('0x30')]));if(_0x50c79b[_0x4137('0x2f')]['filter']){_0x714ee7[_0x4137('0x39')]=_[_0x4137('0x3a')](_0x714ee7['where'],{'$or':_[_0x4137('0x29')](_0x714ee7['attributes'],function(_0x42b915){var _0x1e1a5e={};_0x1e1a5e[_0x42b915]={'$like':'%'+_0x50c79b[_0x4137('0x2f')][_0x4137('0x38')]+'%'};return _0x1e1a5e;})});}_0x714ee7=_['merge']({},_0x714ee7,_0x50c79b[_0x4137('0x3d')]);return _0x10524b[_0x4137('0x4a')](_0x714ee7);}})[_0x4137('0x24')](function(_0x406050){if(_0x406050){_0x3dd83e=_0x406050[_0x4137('0x46')];if(!_0x50c79b[_0x4137('0x2f')][_0x4137('0x34')]('nolimit')){_0x714ee7[_0x4137('0x1f')]=qs[_0x4137('0x1f')](_0x50c79b['query'][_0x4137('0x1f')]);_0x714ee7[_0x4137('0x1c')]=qs[_0x4137('0x1c')](_0x50c79b[_0x4137('0x2f')]['offset']);}return _0x10524b[_0x4137('0x4a')](_0x714ee7);}})[_0x4137('0x24')](function(_0x4a6d63){if(_0x4a6d63){return _0x4a6d63?{'count':_0x3dd83e,'rows':_0x4a6d63}:null;}})['then'](respondWithResult(_0x542abd,null))[_0x4137('0x42')](handleError(_0x542abd,null));};exports[_0x4137('0x4e')]=function(_0x12096c,_0x1479b2,_0xa75d21){var _0x1499eb={};var _0xe249a5={};var _0x4acf65;var _0x3e6d13;return db[_0x4137('0x2a')][_0x4137('0x4b')]({'where':{'id':_0x12096c[_0x4137('0x44')]['id']}})[_0x4137('0x24')](handleEntityNotFound(_0x1479b2,null))[_0x4137('0x24')](function(_0x40599b){if(_0x40599b){_0x4acf65=_0x40599b;_0xe249a5['model']=_[_0x4137('0x45')](db[_0x4137('0x4c')][_0x4137('0x2b')]);_0xe249a5['query']=_[_0x4137('0x45')](_0x12096c[_0x4137('0x2f')]);_0xe249a5['filters']=_[_0x4137('0x32')](_0xe249a5[_0x4137('0x2e')],_0xe249a5['query']);_0x1499eb[_0x4137('0x31')]=_[_0x4137('0x32')](_0xe249a5['model'],qs[_0x4137('0x33')](_0x12096c[_0x4137('0x2f')][_0x4137('0x33')]));_0x1499eb[_0x4137('0x31')]=_0x1499eb[_0x4137('0x31')][_0x4137('0x46')]?_0x1499eb['attributes']:_0xe249a5['model'];_0x1499eb[_0x4137('0x4d')]=qs[_0x4137('0x36')](_0x12096c[_0x4137('0x2f')][_0x4137('0x36')]);_0x1499eb[_0x4137('0x39')]=qs[_0x4137('0x30')](_[_0x4137('0x37')](_0x12096c[_0x4137('0x2f')],_0xe249a5['filters']));if(_0x12096c['query']['filter']){_0x1499eb[_0x4137('0x39')]=_[_0x4137('0x3a')](_0x1499eb[_0x4137('0x39')],{'$or':_[_0x4137('0x29')](_0x1499eb[_0x4137('0x31')],function(_0x177b4c){var _0x27ad33={};_0x27ad33[_0x177b4c]={'$like':'%'+_0x12096c[_0x4137('0x2f')][_0x4137('0x38')]+'%'};return _0x27ad33;})});}_0x1499eb=_[_0x4137('0x3a')]({},_0x1499eb,_0x12096c[_0x4137('0x3d')]);return _0x4acf65[_0x4137('0x4e')](_0x1499eb);}})[_0x4137('0x24')](function(_0x32d82a){if(_0x32d82a){_0x3e6d13=_0x32d82a[_0x4137('0x46')];if(!_0x12096c[_0x4137('0x2f')][_0x4137('0x34')](_0x4137('0x35'))){_0x1499eb[_0x4137('0x1f')]=qs[_0x4137('0x1f')](_0x12096c[_0x4137('0x2f')]['limit']);_0x1499eb['offset']=qs[_0x4137('0x1c')](_0x12096c[_0x4137('0x2f')][_0x4137('0x1c')]);}return _0x4acf65['getSubjects'](_0x1499eb);}})['then'](function(_0x27545a){if(_0x27545a){return _0x27545a?{'count':_0x3e6d13,'rows':_0x27545a}:null;}})[_0x4137('0x24')](respondWithResult(_0x1479b2,null))['catch'](handleError(_0x1479b2,null));};exports[_0x4137('0x4f')]=function(_0x1e6147,_0x4c81c9,_0x1586fc){var _0x172a7c={};var _0x5612dc={};var _0x53c0c0;var _0x1c7d46;return db[_0x4137('0x2a')][_0x4137('0x4b')]({'where':{'id':_0x1e6147[_0x4137('0x44')]['id']}})[_0x4137('0x24')](handleEntityNotFound(_0x4c81c9,null))[_0x4137('0x24')](function(_0x5672d1){if(_0x5672d1){_0x53c0c0=_0x5672d1;_0x5612dc['model']=_[_0x4137('0x45')](db[_0x4137('0x4c')][_0x4137('0x2b')]);_0x5612dc[_0x4137('0x2f')]=_['keys'](_0x1e6147['query']);_0x5612dc[_0x4137('0x30')]=_[_0x4137('0x32')](_0x5612dc[_0x4137('0x2e')],_0x5612dc['query']);_0x172a7c['attributes']=_[_0x4137('0x32')](_0x5612dc['model'],qs['fields'](_0x1e6147[_0x4137('0x2f')][_0x4137('0x33')]));_0x172a7c[_0x4137('0x31')]=_0x172a7c[_0x4137('0x31')][_0x4137('0x46')]?_0x172a7c['attributes']:_0x5612dc['model'];_0x172a7c['order']=qs[_0x4137('0x36')](_0x1e6147['query'][_0x4137('0x36')]);_0x172a7c[_0x4137('0x39')]=qs[_0x4137('0x30')](_[_0x4137('0x37')](_0x1e6147[_0x4137('0x2f')],_0x5612dc['filters']));if(_0x1e6147[_0x4137('0x2f')][_0x4137('0x38')]){_0x172a7c[_0x4137('0x39')]=_['merge'](_0x172a7c[_0x4137('0x39')],{'$or':_[_0x4137('0x29')](_0x172a7c['attributes'],function(_0x191322){var _0x3b5e91={};_0x3b5e91[_0x191322]={'$like':'%'+_0x1e6147[_0x4137('0x2f')][_0x4137('0x38')]+'%'};return _0x3b5e91;})});}_0x172a7c=_[_0x4137('0x3a')]({},_0x172a7c,_0x1e6147[_0x4137('0x3d')]);return _0x53c0c0['getDescriptions'](_0x172a7c);}})[_0x4137('0x24')](function(_0x314adf){if(_0x314adf){_0x1c7d46=_0x314adf['length'];if(!_0x1e6147[_0x4137('0x2f')]['hasOwnProperty'](_0x4137('0x35'))){_0x172a7c[_0x4137('0x1f')]=qs[_0x4137('0x1f')](_0x1e6147[_0x4137('0x2f')][_0x4137('0x1f')]);_0x172a7c[_0x4137('0x1c')]=qs[_0x4137('0x1c')](_0x1e6147['query'][_0x4137('0x1c')]);}return _0x53c0c0[_0x4137('0x4f')](_0x172a7c);}})[_0x4137('0x24')](function(_0x31d347){if(_0x31d347){return _0x31d347?{'count':_0x1c7d46,'rows':_0x31d347}:null;}})['then'](respondWithResult(_0x4c81c9,null))[_0x4137('0x42')](handleError(_0x4c81c9,null));}; \ No newline at end of file +var _0x688a=['../../config/environment','status','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','filter','merge','options','count','include','findAll','rows','show','params','length','includeAll','find','catch','create','body','VtigerField','order','getFields','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x4309ea,_0x3c4eaa){var _0x25074c=function(_0x5ace1b){while(--_0x5ace1b){_0x4309ea['push'](_0x4309ea['shift']());}};_0x25074c(++_0x3c4eaa);}(_0x688a,0x124));var _0xa688=function(_0x281d76,_0x4e3dfa){_0x281d76=_0x281d76-0x0;var _0x5ec5c3=_0x688a[_0x281d76];return _0x5ec5c3;};'use strict';var emlformat=require(_0xa688('0x0'));var rimraf=require(_0xa688('0x1'));var zipdir=require(_0xa688('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa688('0x3'));var moment=require('moment');var BPromise=require(_0xa688('0x4'));var Mustache=require(_0xa688('0x5'));var util=require('util');var path=require(_0xa688('0x6'));var sox=require(_0xa688('0x7'));var csv=require(_0xa688('0x8'));var ejs=require(_0xa688('0x9'));var fs=require('fs');var fs_extra=require(_0xa688('0xa'));var _=require(_0xa688('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa688('0xc'));var deskjs=require(_0xa688('0xd'));var toCsv=require(_0xa688('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa688('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa688('0xf'));var hardwareService=require(_0xa688('0x10'));var logger=require(_0xa688('0x11'))(_0xa688('0x12'));var utils=require(_0xa688('0x13'));var config=require(_0xa688('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50f101,_0x1dc3d3){_0x1dc3d3=_0x1dc3d3||0xcc;return function(_0x33eed4){if(_0x33eed4){return _0x50f101['sendStatus'](_0x1dc3d3);}return _0x50f101[_0xa688('0x15')](_0x1dc3d3)['end']();};}function respondWithResult(_0x10c371,_0x43159e){_0x43159e=_0x43159e||0xc8;return function(_0x506fca){if(_0x506fca){return _0x10c371['status'](_0x43159e)[_0xa688('0x16')](_0x506fca);}};}function respondWithFilteredResult(_0x4c7442,_0x1a55c2){return function(_0x5b8b1f){if(_0x5b8b1f){var _0xe776d6=typeof _0x1a55c2[_0xa688('0x17')]===_0xa688('0x18')&&typeof _0x1a55c2[_0xa688('0x19')]===_0xa688('0x18');var _0x10fc2d=_0x5b8b1f['count'];var _0x59e392=_0xe776d6?0x0:_0x1a55c2[_0xa688('0x17')];var _0x1330d5=_0xe776d6?_0x5b8b1f['count']:_0x1a55c2['offset']+_0x1a55c2[_0xa688('0x19')];var _0x2085bf;if(_0x1330d5>=_0x10fc2d){_0x1330d5=_0x10fc2d;_0x2085bf=0xc8;}else{_0x2085bf=0xce;}_0x4c7442['status'](_0x2085bf);return _0x4c7442[_0xa688('0x1a')]('Content-Range',_0x59e392+'-'+_0x1330d5+'/'+_0x10fc2d)['json'](_0x5b8b1f);}return null;};}function patchUpdates(_0x152cfe){return function(_0x466ae3){try{jsonpatch[_0xa688('0x1b')](_0x466ae3,_0x152cfe,!![]);}catch(_0x27f12e){return BPromise[_0xa688('0x1c')](_0x27f12e);}return _0x466ae3[_0xa688('0x1d')]();};}function saveUpdates(_0x7d9036,_0x203214){return function(_0x2a9f67){if(_0x2a9f67){return _0x2a9f67[_0xa688('0x1e')](_0x7d9036)[_0xa688('0x1f')](function(_0x301560){return _0x301560;});}return null;};}function removeEntity(_0x42643,_0x11133b){return function(_0x48cb17){if(_0x48cb17){return _0x48cb17[_0xa688('0x20')]()[_0xa688('0x1f')](function(){_0x42643['status'](0xcc)[_0xa688('0x21')]();});}};}function handleEntityNotFound(_0x1e3106,_0x53eec6){return function(_0x2898cb){if(!_0x2898cb){_0x1e3106[_0xa688('0x22')](0x194);}return _0x2898cb;};}function handleError(_0x1bc1c2,_0x25d1fa){_0x25d1fa=_0x25d1fa||0x1f4;return function(_0x153a86){logger[_0xa688('0x23')](_0x153a86[_0xa688('0x24')]);if(_0x153a86[_0xa688('0x25')]){delete _0x153a86[_0xa688('0x25')];}_0x1bc1c2[_0xa688('0x15')](_0x25d1fa)[_0xa688('0x26')](_0x153a86);};}exports[_0xa688('0x27')]=function(_0x3c7245,_0x12a35a){var _0x1d4cfa={},_0x5d1657={},_0x217a35={'count':0x0,'rows':[]};var _0x1bdd8e=_[_0xa688('0x28')](db[_0xa688('0x29')][_0xa688('0x2a')],function(_0x10fbce){return{'name':_0x10fbce['fieldName'],'type':_0x10fbce['type']['key']};});_0x5d1657[_0xa688('0x2b')]=_['map'](_0x1bdd8e,_0xa688('0x25'));_0x5d1657[_0xa688('0x2c')]=_[_0xa688('0x2d')](_0x3c7245[_0xa688('0x2c')]);_0x5d1657[_0xa688('0x2e')]=_[_0xa688('0x2f')](_0x5d1657[_0xa688('0x2b')],_0x5d1657['query']);_0x1d4cfa['attributes']=_['intersection'](_0x5d1657['model'],qs[_0xa688('0x30')](_0x3c7245[_0xa688('0x2c')][_0xa688('0x30')]));_0x1d4cfa['attributes']=_0x1d4cfa[_0xa688('0x31')]['length']?_0x1d4cfa['attributes']:_0x5d1657['model'];if(!_0x3c7245[_0xa688('0x2c')][_0xa688('0x32')](_0xa688('0x33'))){_0x1d4cfa['limit']=qs['limit'](_0x3c7245[_0xa688('0x2c')][_0xa688('0x19')]);_0x1d4cfa[_0xa688('0x17')]=qs[_0xa688('0x17')](_0x3c7245[_0xa688('0x2c')]['offset']);}_0x1d4cfa['order']=qs[_0xa688('0x34')](_0x3c7245['query'][_0xa688('0x34')]);_0x1d4cfa[_0xa688('0x35')]=qs[_0xa688('0x2e')](_[_0xa688('0x36')](_0x3c7245['query'],_0x5d1657[_0xa688('0x2e')]),_0x1bdd8e);if(_0x3c7245['query']['filter']){_0x1d4cfa[_0xa688('0x35')]=_['merge'](_0x1d4cfa[_0xa688('0x35')],{'$or':_['map'](_0x1bdd8e,function(_0x1f00a0){if(_0x1f00a0[_0xa688('0x37')]!==_0xa688('0x38')){var _0x573540={};_0x573540[_0x1f00a0[_0xa688('0x25')]]={'$like':'%'+_0x3c7245[_0xa688('0x2c')][_0xa688('0x39')]+'%'};return _0x573540;}})});}_0x1d4cfa=_[_0xa688('0x3a')]({},_0x1d4cfa,_0x3c7245[_0xa688('0x3b')]);var _0x20c815={'where':_0x1d4cfa[_0xa688('0x35')]};return db[_0xa688('0x29')][_0xa688('0x3c')](_0x20c815)[_0xa688('0x1f')](function(_0x220c90){_0x217a35['count']=_0x220c90;if(_0x3c7245[_0xa688('0x2c')]['includeAll']){_0x1d4cfa[_0xa688('0x3d')]=[{'all':!![]}];}return db[_0xa688('0x29')][_0xa688('0x3e')](_0x1d4cfa);})[_0xa688('0x1f')](function(_0x56a5e5){_0x217a35[_0xa688('0x3f')]=_0x56a5e5;return _0x217a35;})[_0xa688('0x1f')](respondWithFilteredResult(_0x12a35a,_0x1d4cfa))['catch'](handleError(_0x12a35a,null));};exports[_0xa688('0x40')]=function(_0x1a7081,_0x1a300d){var _0xdb6ce7={'raw':![],'where':{'id':_0x1a7081[_0xa688('0x41')]['id']}},_0x3205d4={};_0x3205d4[_0xa688('0x2b')]=_[_0xa688('0x2d')](db[_0xa688('0x29')]['rawAttributes']);_0x3205d4[_0xa688('0x2c')]=_[_0xa688('0x2d')](_0x1a7081[_0xa688('0x2c')]);_0x3205d4[_0xa688('0x2e')]=_[_0xa688('0x2f')](_0x3205d4[_0xa688('0x2b')],_0x3205d4[_0xa688('0x2c')]);_0xdb6ce7[_0xa688('0x31')]=_['intersection'](_0x3205d4[_0xa688('0x2b')],qs[_0xa688('0x30')](_0x1a7081[_0xa688('0x2c')][_0xa688('0x30')]));_0xdb6ce7['attributes']=_0xdb6ce7[_0xa688('0x31')][_0xa688('0x42')]?_0xdb6ce7['attributes']:_0x3205d4[_0xa688('0x2b')];if(_0x1a7081[_0xa688('0x2c')][_0xa688('0x43')]){_0xdb6ce7[_0xa688('0x3d')]=[{'all':!![]}];}_0xdb6ce7=_[_0xa688('0x3a')]({},_0xdb6ce7,_0x1a7081[_0xa688('0x3b')]);return db['VtigerConfiguration'][_0xa688('0x44')](_0xdb6ce7)[_0xa688('0x1f')](handleEntityNotFound(_0x1a300d,null))[_0xa688('0x1f')](respondWithResult(_0x1a300d,null))[_0xa688('0x45')](handleError(_0x1a300d,null));};exports[_0xa688('0x46')]=function(_0x56cb08,_0x49b3e0){return db[_0xa688('0x29')][_0xa688('0x46')](_0x56cb08[_0xa688('0x47')],{})[_0xa688('0x1f')](respondWithResult(_0x49b3e0,0xc9))[_0xa688('0x45')](handleError(_0x49b3e0,null));};exports['update']=function(_0x128191,_0x3c858c){if(_0x128191[_0xa688('0x47')]['id']){delete _0x128191[_0xa688('0x47')]['id'];}return db[_0xa688('0x29')][_0xa688('0x44')]({'where':{'id':_0x128191[_0xa688('0x41')]['id']}})['then'](handleEntityNotFound(_0x3c858c,null))[_0xa688('0x1f')](saveUpdates(_0x128191[_0xa688('0x47')],null))[_0xa688('0x1f')](respondWithResult(_0x3c858c,null))[_0xa688('0x45')](handleError(_0x3c858c,null));};exports['destroy']=function(_0x2904fd,_0x44a090){return db[_0xa688('0x29')][_0xa688('0x44')]({'where':{'id':_0x2904fd[_0xa688('0x41')]['id']}})[_0xa688('0x1f')](handleEntityNotFound(_0x44a090,null))['then'](removeEntity(_0x44a090,null))[_0xa688('0x45')](handleError(_0x44a090,null));};exports['getFields']=function(_0x132615,_0x58753e,_0x5e1235){var _0x44b8f5={};var _0x12d9c4={};var _0x8fa54e;var _0x5df54b;return db[_0xa688('0x29')]['findOne']({'where':{'id':_0x132615['params']['id']}})['then'](handleEntityNotFound(_0x58753e,null))['then'](function(_0x5aee72){if(_0x5aee72){_0x8fa54e=_0x5aee72;_0x12d9c4[_0xa688('0x2b')]=_[_0xa688('0x2d')](db[_0xa688('0x48')]['rawAttributes']);_0x12d9c4[_0xa688('0x2c')]=_['keys'](_0x132615[_0xa688('0x2c')]);_0x12d9c4[_0xa688('0x2e')]=_[_0xa688('0x2f')](_0x12d9c4[_0xa688('0x2b')],_0x12d9c4[_0xa688('0x2c')]);_0x44b8f5[_0xa688('0x31')]=_[_0xa688('0x2f')](_0x12d9c4[_0xa688('0x2b')],qs[_0xa688('0x30')](_0x132615[_0xa688('0x2c')]['fields']));_0x44b8f5['attributes']=_0x44b8f5['attributes'][_0xa688('0x42')]?_0x44b8f5[_0xa688('0x31')]:_0x12d9c4[_0xa688('0x2b')];_0x44b8f5[_0xa688('0x49')]=qs[_0xa688('0x34')](_0x132615[_0xa688('0x2c')][_0xa688('0x34')]);_0x44b8f5[_0xa688('0x35')]=qs[_0xa688('0x2e')](_[_0xa688('0x36')](_0x132615[_0xa688('0x2c')],_0x12d9c4[_0xa688('0x2e')]));if(_0x132615[_0xa688('0x2c')][_0xa688('0x39')]){_0x44b8f5[_0xa688('0x35')]=_['merge'](_0x44b8f5['where'],{'$or':_[_0xa688('0x28')](_0x44b8f5['attributes'],function(_0x5290fd){var _0x10bd5f={};_0x10bd5f[_0x5290fd]={'$like':'%'+_0x132615[_0xa688('0x2c')]['filter']+'%'};return _0x10bd5f;})});}_0x44b8f5=_[_0xa688('0x3a')]({},_0x44b8f5,_0x132615['options']);return _0x8fa54e[_0xa688('0x4a')](_0x44b8f5);}})['then'](function(_0xdbf7d8){if(_0xdbf7d8){_0x5df54b=_0xdbf7d8['length'];if(!_0x132615[_0xa688('0x2c')][_0xa688('0x32')](_0xa688('0x33'))){_0x44b8f5[_0xa688('0x19')]=qs['limit'](_0x132615[_0xa688('0x2c')][_0xa688('0x19')]);_0x44b8f5[_0xa688('0x17')]=qs[_0xa688('0x17')](_0x132615['query'][_0xa688('0x17')]);}return _0x8fa54e[_0xa688('0x4a')](_0x44b8f5);}})['then'](function(_0x50510b){if(_0x50510b){return _0x50510b?{'count':_0x5df54b,'rows':_0x50510b}:null;}})[_0xa688('0x1f')](respondWithResult(_0x58753e,null))[_0xa688('0x45')](handleError(_0x58753e,null));};exports[_0xa688('0x4b')]=function(_0x3871dc,_0x2e82e0,_0x9d35e5){var _0x120c64={};var _0x20a8dc={};var _0x56b3e3;var _0x2dc956;return db[_0xa688('0x29')][_0xa688('0x4c')]({'where':{'id':_0x3871dc['params']['id']}})[_0xa688('0x1f')](handleEntityNotFound(_0x2e82e0,null))[_0xa688('0x1f')](function(_0x29910a){if(_0x29910a){_0x56b3e3=_0x29910a;_0x20a8dc[_0xa688('0x2b')]=_[_0xa688('0x2d')](db[_0xa688('0x48')]['rawAttributes']);_0x20a8dc[_0xa688('0x2c')]=_['keys'](_0x3871dc[_0xa688('0x2c')]);_0x20a8dc[_0xa688('0x2e')]=_[_0xa688('0x2f')](_0x20a8dc[_0xa688('0x2b')],_0x20a8dc['query']);_0x120c64[_0xa688('0x31')]=_[_0xa688('0x2f')](_0x20a8dc[_0xa688('0x2b')],qs['fields'](_0x3871dc[_0xa688('0x2c')]['fields']));_0x120c64[_0xa688('0x31')]=_0x120c64[_0xa688('0x31')][_0xa688('0x42')]?_0x120c64['attributes']:_0x20a8dc[_0xa688('0x2b')];_0x120c64[_0xa688('0x49')]=qs[_0xa688('0x34')](_0x3871dc[_0xa688('0x2c')][_0xa688('0x34')]);_0x120c64[_0xa688('0x35')]=qs[_0xa688('0x2e')](_['pick'](_0x3871dc['query'],_0x20a8dc['filters']));if(_0x3871dc[_0xa688('0x2c')]['filter']){_0x120c64[_0xa688('0x35')]=_['merge'](_0x120c64[_0xa688('0x35')],{'$or':_[_0xa688('0x28')](_0x120c64[_0xa688('0x31')],function(_0x111e92){var _0x3cc031={};_0x3cc031[_0x111e92]={'$like':'%'+_0x3871dc[_0xa688('0x2c')][_0xa688('0x39')]+'%'};return _0x3cc031;})});}_0x120c64=_[_0xa688('0x3a')]({},_0x120c64,_0x3871dc[_0xa688('0x3b')]);return _0x56b3e3['getSubjects'](_0x120c64);}})[_0xa688('0x1f')](function(_0x162434){if(_0x162434){_0x2dc956=_0x162434['length'];if(!_0x3871dc['query'][_0xa688('0x32')](_0xa688('0x33'))){_0x120c64['limit']=qs[_0xa688('0x19')](_0x3871dc[_0xa688('0x2c')][_0xa688('0x19')]);_0x120c64['offset']=qs['offset'](_0x3871dc[_0xa688('0x2c')][_0xa688('0x17')]);}return _0x56b3e3[_0xa688('0x4b')](_0x120c64);}})[_0xa688('0x1f')](function(_0x1d35ec){if(_0x1d35ec){return _0x1d35ec?{'count':_0x2dc956,'rows':_0x1d35ec}:null;}})[_0xa688('0x1f')](respondWithResult(_0x2e82e0,null))[_0xa688('0x45')](handleError(_0x2e82e0,null));};exports['getDescriptions']=function(_0x50dc18,_0x252967,_0x483f55){var _0x18bf56={};var _0x574e8d={};var _0x2d777d;var _0x16ef7d;return db[_0xa688('0x29')]['findOne']({'where':{'id':_0x50dc18[_0xa688('0x41')]['id']}})[_0xa688('0x1f')](handleEntityNotFound(_0x252967,null))[_0xa688('0x1f')](function(_0x2ff186){if(_0x2ff186){_0x2d777d=_0x2ff186;_0x574e8d[_0xa688('0x2b')]=_['keys'](db[_0xa688('0x48')][_0xa688('0x2a')]);_0x574e8d[_0xa688('0x2c')]=_[_0xa688('0x2d')](_0x50dc18['query']);_0x574e8d[_0xa688('0x2e')]=_[_0xa688('0x2f')](_0x574e8d[_0xa688('0x2b')],_0x574e8d[_0xa688('0x2c')]);_0x18bf56[_0xa688('0x31')]=_[_0xa688('0x2f')](_0x574e8d[_0xa688('0x2b')],qs[_0xa688('0x30')](_0x50dc18[_0xa688('0x2c')][_0xa688('0x30')]));_0x18bf56[_0xa688('0x31')]=_0x18bf56[_0xa688('0x31')]['length']?_0x18bf56[_0xa688('0x31')]:_0x574e8d[_0xa688('0x2b')];_0x18bf56[_0xa688('0x49')]=qs[_0xa688('0x34')](_0x50dc18[_0xa688('0x2c')]['sort']);_0x18bf56[_0xa688('0x35')]=qs[_0xa688('0x2e')](_[_0xa688('0x36')](_0x50dc18[_0xa688('0x2c')],_0x574e8d[_0xa688('0x2e')]));if(_0x50dc18['query'][_0xa688('0x39')]){_0x18bf56['where']=_['merge'](_0x18bf56[_0xa688('0x35')],{'$or':_[_0xa688('0x28')](_0x18bf56[_0xa688('0x31')],function(_0x356882){var _0x5a1f54={};_0x5a1f54[_0x356882]={'$like':'%'+_0x50dc18[_0xa688('0x2c')]['filter']+'%'};return _0x5a1f54;})});}_0x18bf56=_[_0xa688('0x3a')]({},_0x18bf56,_0x50dc18[_0xa688('0x3b')]);return _0x2d777d[_0xa688('0x4d')](_0x18bf56);}})[_0xa688('0x1f')](function(_0x5dfdac){if(_0x5dfdac){_0x16ef7d=_0x5dfdac[_0xa688('0x42')];if(!_0x50dc18['query'][_0xa688('0x32')](_0xa688('0x33'))){_0x18bf56[_0xa688('0x19')]=qs[_0xa688('0x19')](_0x50dc18[_0xa688('0x2c')][_0xa688('0x19')]);_0x18bf56[_0xa688('0x17')]=qs['offset'](_0x50dc18[_0xa688('0x2c')][_0xa688('0x17')]);}return _0x2d777d['getDescriptions'](_0x18bf56);}})['then'](function(_0x1b518a){if(_0x1b518a){return _0x1b518a?{'count':_0x16ef7d,'rows':_0x1b518a}:null;}})[_0xa688('0x1f')](respondWithResult(_0x252967,null))['catch'](handleError(_0x252967,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 9931c8b..33bc5cc 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 _0x162d=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations'];(function(_0x1f7ca6,_0x2b0385){var _0x349e9d=function(_0x343af1){while(--_0x343af1){_0x1f7ca6['push'](_0x1f7ca6['shift']());}};_0x349e9d(++_0x2b0385);}(_0x162d,0xc0));var _0xd162=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x162d[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var util=require(_0xd162('0x0'));var logger=require(_0xd162('0x1'))(_0xd162('0x2'));var moment=require('moment');var BPromise=require(_0xd162('0x3'));var rp=require(_0xd162('0x4'));var fs=require('fs');var path=require(_0xd162('0x5'));var rimraf=require(_0xd162('0x6'));var config=require(_0xd162('0x7'));var attributes=require(_0xd162('0x8'));module['exports']=function(_0x1de263,_0x1f1a71){return _0x1de263[_0xd162('0x9')](_0xd162('0xa'),attributes,{'tableName':_0xd162('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ede=['moment','bluebird','request-promise','path','../../config/environment','exports','define','VtigerConfiguration','lodash','../../config/logger','api'];(function(_0x3ab8d2,_0x521178){var _0x4dda59=function(_0x11b0ce){while(--_0x11b0ce){_0x3ab8d2['push'](_0x3ab8d2['shift']());}};_0x4dda59(++_0x521178);}(_0x9ede,0x194));var _0xe9ed=function(_0x3297ad,_0x2007b8){_0x3297ad=_0x3297ad-0x0;var _0x4e6c80=_0x9ede[_0x3297ad];return _0x4e6c80;};'use strict';var _=require(_0xe9ed('0x0'));var util=require('util');var logger=require(_0xe9ed('0x1'))(_0xe9ed('0x2'));var moment=require(_0xe9ed('0x3'));var BPromise=require(_0xe9ed('0x4'));var rp=require(_0xe9ed('0x5'));var fs=require('fs');var path=require(_0xe9ed('0x6'));var rimraf=require('rimraf');var config=require(_0xe9ed('0x7'));var attributes=require('./intVtigerConfiguration.attributes');module[_0xe9ed('0x8')]=function(_0x3baf9d,_0x4f808b){return _0x3baf9d[_0xe9ed('0x9')](_0xe9ed('0xa'),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 40c9053..4f699df 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 _0x17bf=['moment','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','info','result','catch','util'];(function(_0x377b59,_0x1f167d){var _0x2cae54=function(_0x292df1){while(--_0x292df1){_0x377b59['push'](_0x377b59['shift']());}};_0x2cae54(++_0x1f167d);}(_0x17bf,0xa7));var _0xf17b=function(_0x311f3a,_0x30b255){_0x311f3a=_0x311f3a-0x0;var _0x2db88b=_0x17bf[_0x311f3a];return _0x2db88b;};'use strict';var _=require('lodash');var util=require(_0xf17b('0x0'));var moment=require(_0xf17b('0x1'));var BPromise=require('bluebird');var rs=require(_0xf17b('0x2'));var fs=require('fs');var Redis=require(_0xf17b('0x3'));var db=require(_0xf17b('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf17b('0x5'));var config=require('../../config/environment');var jayson=require(_0xf17b('0x6'));var client=jayson[_0xf17b('0x7')][_0xf17b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e9c7b,_0x28947d,_0x1805bb){return new BPromise(function(_0x2f9560,_0x48c661){return client[_0xf17b('0x9')](_0x1e9c7b,_0x1805bb)[_0xf17b('0xa')](function(_0x4b9e32){logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x28947d,_0xf17b('0xb'));logger[_0xf17b('0xc')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x28947d,_0xf17b('0xb'),JSON[_0xf17b('0xd')](_0x4b9e32));if(_0x4b9e32[_0xf17b('0xe')]){if(_0x4b9e32[_0xf17b('0xe')][_0xf17b('0xf')]===0x1f4){logger[_0xf17b('0xe')](_0xf17b('0x10'),_0x28947d,_0x4b9e32[_0xf17b('0xe')][_0xf17b('0x11')]);return _0x48c661(_0x4b9e32[_0xf17b('0xe')][_0xf17b('0x11')]);}logger[_0xf17b('0xe')](_0xf17b('0x10'),_0x28947d,_0x4b9e32[_0xf17b('0xe')][_0xf17b('0x11')]);return _0x2f9560(_0x4b9e32[_0xf17b('0xe')][_0xf17b('0x11')]);}else{logger[_0xf17b('0x12')](_0xf17b('0x10'),_0x28947d,'request\x20sent');_0x2f9560(_0x4b9e32[_0xf17b('0x13')][_0xf17b('0x11')]);}})[_0xf17b('0x14')](function(_0x53cc52){logger[_0xf17b('0xe')](_0xf17b('0x10'),_0x28947d,_0x53cc52);_0x48c661(_0x53cc52);});});} \ No newline at end of file +var _0x5e9a=['error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3e3813,_0x425196){var _0x581909=function(_0x4a1051){while(--_0x4a1051){_0x3e3813['push'](_0x3e3813['shift']());}};_0x581909(++_0x425196);}(_0x5e9a,0x96));var _0xa5e9=function(_0x233a9b,_0x26e3ff){_0x233a9b=_0x233a9b-0x0;var _0x4dd9c8=_0x5e9a[_0x233a9b];return _0x4dd9c8;};'use strict';var _=require(_0xa5e9('0x0'));var util=require(_0xa5e9('0x1'));var moment=require(_0xa5e9('0x2'));var BPromise=require(_0xa5e9('0x3'));var rs=require(_0xa5e9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa5e9('0x5'))['db'];var utils=require(_0xa5e9('0x6'));var logger=require(_0xa5e9('0x7'))(_0xa5e9('0x8'));var config=require(_0xa5e9('0x9'));var jayson=require(_0xa5e9('0xa'));var client=jayson[_0xa5e9('0xb')][_0xa5e9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4486e0,_0x497882,_0x49b1fa){return new BPromise(function(_0x171d1,_0x24ae0f){return client[_0xa5e9('0xd')](_0x4486e0,_0x49b1fa)['then'](function(_0x2df6fc){logger[_0xa5e9('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x497882,_0xa5e9('0xf'));logger['debug'](_0xa5e9('0x10'),_0x497882,_0xa5e9('0xf'),JSON[_0xa5e9('0x11')](_0x2df6fc));if(_0x2df6fc[_0xa5e9('0x12')]){if(_0x2df6fc[_0xa5e9('0x12')][_0xa5e9('0x13')]===0x1f4){logger[_0xa5e9('0x12')](_0xa5e9('0x14'),_0x497882,_0x2df6fc[_0xa5e9('0x12')][_0xa5e9('0x15')]);return _0x24ae0f(_0x2df6fc['error'][_0xa5e9('0x15')]);}logger[_0xa5e9('0x12')](_0xa5e9('0x14'),_0x497882,_0x2df6fc['error']['message']);return _0x171d1(_0x2df6fc['error'][_0xa5e9('0x15')]);}else{logger['info'](_0xa5e9('0x14'),_0x497882,'request\x20sent');_0x171d1(_0x2df6fc[_0xa5e9('0x16')][_0xa5e9('0x15')]);}})[_0xa5e9('0x17')](function(_0x26d443){logger['error'](_0xa5e9('0x14'),_0x497882,_0x26d443);_0x24ae0f(_0x26d443);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index d9d5f47..03d269a 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 _0x04b2=['isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get'];(function(_0x470f08,_0x16841a){var _0x6fafc4=function(_0x1d7ec8){while(--_0x1d7ec8){_0x470f08['push'](_0x470f08['shift']());}};_0x6fafc4(++_0x16841a);}(_0x04b2,0x172));var _0x204b=function(_0x4484e6,_0x5243fd){_0x4484e6=_0x4484e6-0x0;var _0x1f78dd=_0x04b2[_0x4484e6];return _0x1f78dd;};'use strict';var multer=require(_0x204b('0x0'));var util=require(_0x204b('0x1'));var path=require(_0x204b('0x2'));var timeout=require(_0x204b('0x3'));var express=require('express');var router=express[_0x204b('0x4')]();var fs_extra=require(_0x204b('0x5'));var auth=require(_0x204b('0x6'));var interaction=require(_0x204b('0x7'));var config=require('../../config/environment');var controller=require(_0x204b('0x8'));router[_0x204b('0x9')]('/',auth[_0x204b('0xa')](),controller[_0x204b('0xb')]);router[_0x204b('0x9')](_0x204b('0xc'),auth[_0x204b('0xa')](),controller[_0x204b('0xd')]);router[_0x204b('0xe')]('/',auth[_0x204b('0xa')](),controller[_0x204b('0xf')]);router[_0x204b('0x10')](_0x204b('0xc'),auth[_0x204b('0xa')](),controller['update']);router[_0x204b('0x11')](_0x204b('0xc'),auth[_0x204b('0xa')](),controller[_0x204b('0x12')]);module[_0x204b('0x13')]=router; \ No newline at end of file +var _0x9e7d=['index','show','post','create','delete','/:id','destroy','exports','path','express','Router','fs-extra','../../config/environment','get','isAuthenticated'];(function(_0xe95af,_0x4b849b){var _0x16effb=function(_0x454cd0){while(--_0x454cd0){_0xe95af['push'](_0xe95af['shift']());}};_0x16effb(++_0x4b849b);}(_0x9e7d,0x161));var _0xd9e7=function(_0x5e54ea,_0x27a035){_0x5e54ea=_0x5e54ea-0x0;var _0x5ebbfb=_0x9e7d[_0x5e54ea];return _0x5ebbfb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd9e7('0x0'));var timeout=require('connect-timeout');var express=require(_0xd9e7('0x1'));var router=express[_0xd9e7('0x2')]();var fs_extra=require(_0xd9e7('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd9e7('0x4'));var controller=require('./intVtigerField.controller');router[_0xd9e7('0x5')]('/',auth[_0xd9e7('0x6')](),controller[_0xd9e7('0x7')]);router[_0xd9e7('0x5')]('/:id',auth[_0xd9e7('0x6')](),controller[_0xd9e7('0x8')]);router[_0xd9e7('0x9')]('/',auth['isAuthenticated'](),controller[_0xd9e7('0xa')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd9e7('0xb')](_0xd9e7('0xc'),auth['isAuthenticated'](),controller[_0xd9e7('0xd')]);module[_0xd9e7('0xe')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index d895be1..5bb1832 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 _0x60b8=['customVariable','BOOLEAN','sequelize','ENUM','string','variable','keyValue','picklist','STRING'];(function(_0x2a209e,_0x4321c9){var _0x4bd08b=function(_0x47e841){while(--_0x47e841){_0x2a209e['push'](_0x2a209e['shift']());}};_0x4bd08b(++_0x4321c9);}(_0x60b8,0x1e8));var _0x860b=function(_0x5644e1,_0xc7e691){_0x5644e1=_0x5644e1-0x0;var _0x2896b3=_0x60b8[_0x5644e1];return _0x2896b3;};'use strict';var Sequelize=require(_0x860b('0x0'));module['exports']={'type':{'type':Sequelize[_0x860b('0x1')](_0x860b('0x2'),_0x860b('0x3'),'customVariable',_0x860b('0x4'),_0x860b('0x5')),'defaultValue':_0x860b('0x2')},'content':{'type':Sequelize[_0x860b('0x6')]},'key':{'type':Sequelize[_0x860b('0x6')]},'keyType':{'type':Sequelize[_0x860b('0x1')](_0x860b('0x2'),_0x860b('0x3'),_0x860b('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x860b('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x860b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x860b('0x6')]}}; \ No newline at end of file +var _0x4185=['picklist','STRING','ENUM','BOOLEAN','sequelize','exports','string','customVariable','keyValue'];(function(_0x229262,_0x268c68){var _0x54431b=function(_0x2843b0){while(--_0x2843b0){_0x229262['push'](_0x229262['shift']());}};_0x54431b(++_0x268c68);}(_0x4185,0x17e));var _0x5418=function(_0x2437ea,_0x22d2fb){_0x2437ea=_0x2437ea-0x0;var _0x280245=_0x4185[_0x2437ea];return _0x280245;};'use strict';var Sequelize=require(_0x5418('0x0'));module[_0x5418('0x1')]={'type':{'type':Sequelize['ENUM'](_0x5418('0x2'),'variable',_0x5418('0x3'),_0x5418('0x4'),_0x5418('0x5')),'defaultValue':_0x5418('0x2')},'content':{'type':Sequelize[_0x5418('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5418('0x7')](_0x5418('0x2'),'variable',_0x5418('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5418('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5418('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index e2c39b1..b4d71c3 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 _0x0066=['where','filters','pick','merge','type','VIRTUAL','filter','options','VtigerField','includeAll','include','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x7cff6f,_0x570cea){var _0x589637=function(_0x393578){while(--_0x393578){_0x7cff6f['push'](_0x7cff6f['shift']());}};_0x589637(++_0x570cea);}(_0x0066,0xb4));var _0x6006=function(_0x7ea23,_0x1d0b20){_0x7ea23=_0x7ea23-0x0;var _0x398546=_0x0066[_0x7ea23];return _0x398546;};'use strict';var emlformat=require(_0x6006('0x0'));var rimraf=require(_0x6006('0x1'));var zipdir=require(_0x6006('0x2'));var jsonpatch=require(_0x6006('0x3'));var rp=require(_0x6006('0x4'));var moment=require(_0x6006('0x5'));var BPromise=require(_0x6006('0x6'));var Mustache=require(_0x6006('0x7'));var util=require(_0x6006('0x8'));var path=require(_0x6006('0x9'));var sox=require(_0x6006('0xa'));var csv=require(_0x6006('0xb'));var ejs=require(_0x6006('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6006('0xd'));var squel=require(_0x6006('0xe'));var crypto=require(_0x6006('0xf'));var jsforce=require(_0x6006('0x10'));var deskjs=require(_0x6006('0x11'));var toCsv=require(_0x6006('0xb'));var querystring=require(_0x6006('0x12'));var Papa=require(_0x6006('0x13'));var Redis=require(_0x6006('0x14'));var authService=require(_0x6006('0x15'));var qs=require(_0x6006('0x16'));var as=require(_0x6006('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6006('0x18'))(_0x6006('0x19'));var utils=require('../../config/utils');var config=require(_0x6006('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x6006('0x1b'))['db'];function respondWithStatusCode(_0x4a7cb1,_0x19d5de){_0x19d5de=_0x19d5de||0xcc;return function(_0x3be9de){if(_0x3be9de){return _0x4a7cb1[_0x6006('0x1c')](_0x19d5de);}return _0x4a7cb1[_0x6006('0x1d')](_0x19d5de)['end']();};}function respondWithResult(_0x3c8f09,_0xbd4eae){_0xbd4eae=_0xbd4eae||0xc8;return function(_0x5a464f){if(_0x5a464f){return _0x3c8f09['status'](_0xbd4eae)[_0x6006('0x1e')](_0x5a464f);}};}function respondWithFilteredResult(_0x4b64f2,_0x2c43df){return function(_0x373229){if(_0x373229){var _0x1330b2=typeof _0x2c43df[_0x6006('0x1f')]===_0x6006('0x20')&&typeof _0x2c43df[_0x6006('0x21')]===_0x6006('0x20');var _0x3b7cc5=_0x373229[_0x6006('0x22')];var _0x453544=_0x1330b2?0x0:_0x2c43df[_0x6006('0x1f')];var _0x13930b=_0x1330b2?_0x373229[_0x6006('0x22')]:_0x2c43df[_0x6006('0x1f')]+_0x2c43df['limit'];var _0x1b71ea;if(_0x13930b>=_0x3b7cc5){_0x13930b=_0x3b7cc5;_0x1b71ea=0xc8;}else{_0x1b71ea=0xce;}_0x4b64f2[_0x6006('0x1d')](_0x1b71ea);return _0x4b64f2[_0x6006('0x23')](_0x6006('0x24'),_0x453544+'-'+_0x13930b+'/'+_0x3b7cc5)[_0x6006('0x1e')](_0x373229);}return null;};}function patchUpdates(_0x30d3c2){return function(_0x4c85a8){try{jsonpatch[_0x6006('0x25')](_0x4c85a8,_0x30d3c2,!![]);}catch(_0x6fb553){return BPromise[_0x6006('0x26')](_0x6fb553);}return _0x4c85a8[_0x6006('0x27')]();};}function saveUpdates(_0x2d6888,_0xe8cbdc){return function(_0x2bac11){if(_0x2bac11){return _0x2bac11[_0x6006('0x28')](_0x2d6888)[_0x6006('0x29')](function(_0x5b7128){return _0x5b7128;});}return null;};}function removeEntity(_0x36bc00,_0x478268){return function(_0x14bde0){if(_0x14bde0){return _0x14bde0[_0x6006('0x2a')]()['then'](function(){_0x36bc00[_0x6006('0x1d')](0xcc)[_0x6006('0x2b')]();});}};}function handleEntityNotFound(_0xaeb484,_0x5825d1){return function(_0x25bdd){if(!_0x25bdd){_0xaeb484[_0x6006('0x1c')](0x194);}return _0x25bdd;};}function handleError(_0xb0943a,_0x122111){_0x122111=_0x122111||0x1f4;return function(_0x55cf11){logger[_0x6006('0x2c')](_0x55cf11[_0x6006('0x2d')]);if(_0x55cf11[_0x6006('0x2e')]){delete _0x55cf11[_0x6006('0x2e')];}_0xb0943a['status'](_0x122111)[_0x6006('0x2f')](_0x55cf11);};}exports[_0x6006('0x30')]=function(_0x1ba42a,_0x5d3074){var _0x11a0cd={},_0x4b53be={},_0x2f179d={'count':0x0,'rows':[]};var _0xf76b77=_[_0x6006('0x31')](db['VtigerField'][_0x6006('0x32')],function(_0x32015b){return{'name':_0x32015b[_0x6006('0x33')],'type':_0x32015b['type'][_0x6006('0x34')]};});_0x4b53be['model']=_['map'](_0xf76b77,_0x6006('0x2e'));_0x4b53be[_0x6006('0x35')]=_[_0x6006('0x36')](_0x1ba42a[_0x6006('0x35')]);_0x4b53be['filters']=_[_0x6006('0x37')](_0x4b53be[_0x6006('0x38')],_0x4b53be[_0x6006('0x35')]);_0x11a0cd[_0x6006('0x39')]=_['intersection'](_0x4b53be[_0x6006('0x38')],qs['fields'](_0x1ba42a[_0x6006('0x35')][_0x6006('0x3a')]));_0x11a0cd['attributes']=_0x11a0cd[_0x6006('0x39')][_0x6006('0x3b')]?_0x11a0cd['attributes']:_0x4b53be[_0x6006('0x38')];if(!_0x1ba42a[_0x6006('0x35')][_0x6006('0x3c')]('nolimit')){_0x11a0cd[_0x6006('0x21')]=qs['limit'](_0x1ba42a[_0x6006('0x35')][_0x6006('0x21')]);_0x11a0cd['offset']=qs[_0x6006('0x1f')](_0x1ba42a[_0x6006('0x35')][_0x6006('0x1f')]);}_0x11a0cd[_0x6006('0x3d')]=qs[_0x6006('0x3e')](_0x1ba42a['query']['sort']);_0x11a0cd[_0x6006('0x3f')]=qs[_0x6006('0x40')](_[_0x6006('0x41')](_0x1ba42a['query'],_0x4b53be[_0x6006('0x40')]),_0xf76b77);if(_0x1ba42a[_0x6006('0x35')]['filter']){_0x11a0cd[_0x6006('0x3f')]=_[_0x6006('0x42')](_0x11a0cd['where'],{'$or':_['map'](_0xf76b77,function(_0x5aa18d){if(_0x5aa18d[_0x6006('0x43')]!==_0x6006('0x44')){var _0x146908={};_0x146908[_0x5aa18d[_0x6006('0x2e')]]={'$like':'%'+_0x1ba42a[_0x6006('0x35')][_0x6006('0x45')]+'%'};return _0x146908;}})});}_0x11a0cd=_[_0x6006('0x42')]({},_0x11a0cd,_0x1ba42a[_0x6006('0x46')]);var _0x13a28a={'where':_0x11a0cd[_0x6006('0x3f')]};return db[_0x6006('0x47')][_0x6006('0x22')](_0x13a28a)[_0x6006('0x29')](function(_0x50b3f6){_0x2f179d['count']=_0x50b3f6;if(_0x1ba42a[_0x6006('0x35')][_0x6006('0x48')]){_0x11a0cd[_0x6006('0x49')]=[{'all':!![]}];}return db[_0x6006('0x47')]['findAll'](_0x11a0cd);})[_0x6006('0x29')](function(_0x1fb268){_0x2f179d[_0x6006('0x4a')]=_0x1fb268;return _0x2f179d;})[_0x6006('0x29')](respondWithFilteredResult(_0x5d3074,_0x11a0cd))[_0x6006('0x4b')](handleError(_0x5d3074,null));};exports[_0x6006('0x4c')]=function(_0x5de675,_0x534a67){var _0x576f55={'raw':!![],'where':{'id':_0x5de675[_0x6006('0x4d')]['id']}},_0x22ebde={};_0x22ebde[_0x6006('0x38')]=_[_0x6006('0x36')](db[_0x6006('0x47')]['rawAttributes']);_0x22ebde[_0x6006('0x35')]=_[_0x6006('0x36')](_0x5de675[_0x6006('0x35')]);_0x22ebde['filters']=_[_0x6006('0x37')](_0x22ebde[_0x6006('0x38')],_0x22ebde[_0x6006('0x35')]);_0x576f55[_0x6006('0x39')]=_[_0x6006('0x37')](_0x22ebde[_0x6006('0x38')],qs[_0x6006('0x3a')](_0x5de675[_0x6006('0x35')][_0x6006('0x3a')]));_0x576f55[_0x6006('0x39')]=_0x576f55[_0x6006('0x39')]['length']?_0x576f55[_0x6006('0x39')]:_0x22ebde['model'];if(_0x5de675[_0x6006('0x35')][_0x6006('0x48')]){_0x576f55['include']=[{'all':!![]}];}_0x576f55=_['merge']({},_0x576f55,_0x5de675[_0x6006('0x46')]);return db[_0x6006('0x47')][_0x6006('0x4e')](_0x576f55)[_0x6006('0x29')](handleEntityNotFound(_0x534a67,null))[_0x6006('0x29')](respondWithResult(_0x534a67,null))['catch'](handleError(_0x534a67,null));};exports[_0x6006('0x4f')]=function(_0x277264,_0x2c7e78){return db[_0x6006('0x47')][_0x6006('0x4f')](_0x277264[_0x6006('0x50')],{})['then'](respondWithResult(_0x2c7e78,0xc9))[_0x6006('0x4b')](handleError(_0x2c7e78,null));};exports[_0x6006('0x28')]=function(_0x5f038,_0x171420){if(_0x5f038[_0x6006('0x50')]['id']){delete _0x5f038['body']['id'];}return db[_0x6006('0x47')]['find']({'where':{'id':_0x5f038[_0x6006('0x4d')]['id']}})[_0x6006('0x29')](handleEntityNotFound(_0x171420,null))[_0x6006('0x29')](saveUpdates(_0x5f038['body'],null))[_0x6006('0x29')](respondWithResult(_0x171420,null))[_0x6006('0x4b')](handleError(_0x171420,null));};exports[_0x6006('0x2a')]=function(_0x26a5a6,_0x3be188){return db[_0x6006('0x47')][_0x6006('0x4e')]({'where':{'id':_0x26a5a6['params']['id']}})[_0x6006('0x29')](handleEntityNotFound(_0x3be188,null))[_0x6006('0x29')](removeEntity(_0x3be188,null))[_0x6006('0x4b')](handleError(_0x3be188,null));}; \ No newline at end of file +var _0xcc8f=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','VtigerField','count','includeAll','include','findAll','catch','show','intersection','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x489f09,_0x3f3db2){var _0x4f09b0=function(_0x4646c2){while(--_0x4646c2){_0x489f09['push'](_0x489f09['shift']());}};_0x4f09b0(++_0x3f3db2);}(_0xcc8f,0x1f1));var _0xfcc8=function(_0x20f773,_0x2cc1ae){_0x20f773=_0x20f773-0x0;var _0x3b48d9=_0xcc8f[_0x20f773];return _0x3b48d9;};'use strict';var emlformat=require(_0xfcc8('0x0'));var rimraf=require(_0xfcc8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfcc8('0x2'));var rp=require(_0xfcc8('0x3'));var moment=require(_0xfcc8('0x4'));var BPromise=require(_0xfcc8('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfcc8('0x6'));var sox=require(_0xfcc8('0x7'));var csv=require(_0xfcc8('0x8'));var ejs=require(_0xfcc8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfcc8('0xa'));var squel=require(_0xfcc8('0xb'));var crypto=require('crypto');var jsforce=require(_0xfcc8('0xc'));var deskjs=require(_0xfcc8('0xd'));var toCsv=require(_0xfcc8('0x8'));var querystring=require('querystring');var Papa=require(_0xfcc8('0xe'));var Redis=require(_0xfcc8('0xf'));var authService=require(_0xfcc8('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xfcc8('0x11'));var hardwareService=require(_0xfcc8('0x12'));var logger=require(_0xfcc8('0x13'))(_0xfcc8('0x14'));var utils=require(_0xfcc8('0x15'));var config=require(_0xfcc8('0x16'));var licenseUtil=require(_0xfcc8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x209430,_0x5ac478){_0x5ac478=_0x5ac478||0xcc;return function(_0x18afa7){if(_0x18afa7){return _0x209430[_0xfcc8('0x18')](_0x5ac478);}return _0x209430[_0xfcc8('0x19')](_0x5ac478)[_0xfcc8('0x1a')]();};}function respondWithResult(_0x592f61,_0x17a5f5){_0x17a5f5=_0x17a5f5||0xc8;return function(_0x387c77){if(_0x387c77){return _0x592f61[_0xfcc8('0x19')](_0x17a5f5)[_0xfcc8('0x1b')](_0x387c77);}};}function respondWithFilteredResult(_0xfb2ee4,_0x4f3b66){return function(_0x3b70a1){if(_0x3b70a1){var _0xc7dc0e=typeof _0x4f3b66[_0xfcc8('0x1c')]===_0xfcc8('0x1d')&&typeof _0x4f3b66['limit']==='undefined';var _0x188760=_0x3b70a1['count'];var _0x188c88=_0xc7dc0e?0x0:_0x4f3b66[_0xfcc8('0x1c')];var _0x29af7f=_0xc7dc0e?_0x3b70a1['count']:_0x4f3b66['offset']+_0x4f3b66[_0xfcc8('0x1e')];var _0x2352a4;if(_0x29af7f>=_0x188760){_0x29af7f=_0x188760;_0x2352a4=0xc8;}else{_0x2352a4=0xce;}_0xfb2ee4[_0xfcc8('0x19')](_0x2352a4);return _0xfb2ee4['set'](_0xfcc8('0x1f'),_0x188c88+'-'+_0x29af7f+'/'+_0x188760)[_0xfcc8('0x1b')](_0x3b70a1);}return null;};}function patchUpdates(_0x408cad){return function(_0x15ecdb){try{jsonpatch[_0xfcc8('0x20')](_0x15ecdb,_0x408cad,!![]);}catch(_0x19295e){return BPromise[_0xfcc8('0x21')](_0x19295e);}return _0x15ecdb[_0xfcc8('0x22')]();};}function saveUpdates(_0xf83eb2,_0x268174){return function(_0x2fce2f){if(_0x2fce2f){return _0x2fce2f[_0xfcc8('0x23')](_0xf83eb2)[_0xfcc8('0x24')](function(_0xab0128){return _0xab0128;});}return null;};}function removeEntity(_0x5b05e9,_0x28c182){return function(_0x416f1d){if(_0x416f1d){return _0x416f1d[_0xfcc8('0x25')]()[_0xfcc8('0x24')](function(){_0x5b05e9[_0xfcc8('0x19')](0xcc)[_0xfcc8('0x1a')]();});}};}function handleEntityNotFound(_0x545621,_0x251754){return function(_0x501914){if(!_0x501914){_0x545621[_0xfcc8('0x18')](0x194);}return _0x501914;};}function handleError(_0x1e91d9,_0x2b8d3d){_0x2b8d3d=_0x2b8d3d||0x1f4;return function(_0x134528){logger[_0xfcc8('0x26')](_0x134528[_0xfcc8('0x27')]);if(_0x134528[_0xfcc8('0x28')]){delete _0x134528['name'];}_0x1e91d9[_0xfcc8('0x19')](_0x2b8d3d)[_0xfcc8('0x29')](_0x134528);};}exports[_0xfcc8('0x2a')]=function(_0xe81f30,_0x5db590){var _0x17c8d1={},_0x28d287={},_0x25694b={'count':0x0,'rows':[]};var _0x214e5d=_[_0xfcc8('0x2b')](db['VtigerField']['rawAttributes'],function(_0x1a152e){return{'name':_0x1a152e[_0xfcc8('0x2c')],'type':_0x1a152e[_0xfcc8('0x2d')][_0xfcc8('0x2e')]};});_0x28d287[_0xfcc8('0x2f')]=_[_0xfcc8('0x2b')](_0x214e5d,_0xfcc8('0x28'));_0x28d287[_0xfcc8('0x30')]=_[_0xfcc8('0x31')](_0xe81f30['query']);_0x28d287[_0xfcc8('0x32')]=_['intersection'](_0x28d287[_0xfcc8('0x2f')],_0x28d287[_0xfcc8('0x30')]);_0x17c8d1['attributes']=_['intersection'](_0x28d287[_0xfcc8('0x2f')],qs['fields'](_0xe81f30['query']['fields']));_0x17c8d1[_0xfcc8('0x33')]=_0x17c8d1[_0xfcc8('0x33')][_0xfcc8('0x34')]?_0x17c8d1[_0xfcc8('0x33')]:_0x28d287[_0xfcc8('0x2f')];if(!_0xe81f30['query'][_0xfcc8('0x35')](_0xfcc8('0x36'))){_0x17c8d1['limit']=qs[_0xfcc8('0x1e')](_0xe81f30[_0xfcc8('0x30')]['limit']);_0x17c8d1[_0xfcc8('0x1c')]=qs['offset'](_0xe81f30['query'][_0xfcc8('0x1c')]);}_0x17c8d1[_0xfcc8('0x37')]=qs[_0xfcc8('0x38')](_0xe81f30[_0xfcc8('0x30')][_0xfcc8('0x38')]);_0x17c8d1['where']=qs[_0xfcc8('0x32')](_['pick'](_0xe81f30[_0xfcc8('0x30')],_0x28d287[_0xfcc8('0x32')]),_0x214e5d);if(_0xe81f30['query'][_0xfcc8('0x39')]){_0x17c8d1[_0xfcc8('0x3a')]=_['merge'](_0x17c8d1[_0xfcc8('0x3a')],{'$or':_['map'](_0x214e5d,function(_0x2412ca){if(_0x2412ca[_0xfcc8('0x2d')]!==_0xfcc8('0x3b')){var _0x49baca={};_0x49baca[_0x2412ca[_0xfcc8('0x28')]]={'$like':'%'+_0xe81f30[_0xfcc8('0x30')]['filter']+'%'};return _0x49baca;}})});}_0x17c8d1=_[_0xfcc8('0x3c')]({},_0x17c8d1,_0xe81f30[_0xfcc8('0x3d')]);var _0x4efa05={'where':_0x17c8d1['where']};return db[_0xfcc8('0x3e')][_0xfcc8('0x3f')](_0x4efa05)[_0xfcc8('0x24')](function(_0x1ecaad){_0x25694b['count']=_0x1ecaad;if(_0xe81f30[_0xfcc8('0x30')][_0xfcc8('0x40')]){_0x17c8d1[_0xfcc8('0x41')]=[{'all':!![]}];}return db[_0xfcc8('0x3e')][_0xfcc8('0x42')](_0x17c8d1);})['then'](function(_0x1f2a81){_0x25694b['rows']=_0x1f2a81;return _0x25694b;})[_0xfcc8('0x24')](respondWithFilteredResult(_0x5db590,_0x17c8d1))[_0xfcc8('0x43')](handleError(_0x5db590,null));};exports[_0xfcc8('0x44')]=function(_0x4d5279,_0x46de63){var _0x230c75={'raw':!![],'where':{'id':_0x4d5279['params']['id']}},_0x21ccdb={};_0x21ccdb[_0xfcc8('0x2f')]=_[_0xfcc8('0x31')](db[_0xfcc8('0x3e')]['rawAttributes']);_0x21ccdb['query']=_[_0xfcc8('0x31')](_0x4d5279[_0xfcc8('0x30')]);_0x21ccdb[_0xfcc8('0x32')]=_[_0xfcc8('0x45')](_0x21ccdb[_0xfcc8('0x2f')],_0x21ccdb[_0xfcc8('0x30')]);_0x230c75['attributes']=_['intersection'](_0x21ccdb[_0xfcc8('0x2f')],qs['fields'](_0x4d5279[_0xfcc8('0x30')]['fields']));_0x230c75[_0xfcc8('0x33')]=_0x230c75[_0xfcc8('0x33')][_0xfcc8('0x34')]?_0x230c75['attributes']:_0x21ccdb[_0xfcc8('0x2f')];if(_0x4d5279['query']['includeAll']){_0x230c75['include']=[{'all':!![]}];}_0x230c75=_[_0xfcc8('0x3c')]({},_0x230c75,_0x4d5279[_0xfcc8('0x3d')]);return db[_0xfcc8('0x3e')][_0xfcc8('0x46')](_0x230c75)[_0xfcc8('0x24')](handleEntityNotFound(_0x46de63,null))[_0xfcc8('0x24')](respondWithResult(_0x46de63,null))['catch'](handleError(_0x46de63,null));};exports[_0xfcc8('0x47')]=function(_0x569cbc,_0x16e0ca){return db[_0xfcc8('0x3e')][_0xfcc8('0x47')](_0x569cbc[_0xfcc8('0x48')],{})['then'](respondWithResult(_0x16e0ca,0xc9))[_0xfcc8('0x43')](handleError(_0x16e0ca,null));};exports['update']=function(_0x17f793,_0x48e47c){if(_0x17f793[_0xfcc8('0x48')]['id']){delete _0x17f793['body']['id'];}return db[_0xfcc8('0x3e')][_0xfcc8('0x46')]({'where':{'id':_0x17f793['params']['id']}})[_0xfcc8('0x24')](handleEntityNotFound(_0x48e47c,null))['then'](saveUpdates(_0x17f793[_0xfcc8('0x48')],null))[_0xfcc8('0x24')](respondWithResult(_0x48e47c,null))[_0xfcc8('0x43')](handleError(_0x48e47c,null));};exports['destroy']=function(_0x272d5c,_0x4f8706){return db[_0xfcc8('0x3e')][_0xfcc8('0x46')]({'where':{'id':_0x272d5c[_0xfcc8('0x49')]['id']}})[_0xfcc8('0x24')](handleEntityNotFound(_0x4f8706,null))['then'](removeEntity(_0x4f8706,null))[_0xfcc8('0x43')](handleError(_0x4f8706,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 70b92ab..224a441 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 _0x36ef=['vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intVtigerField.attributes','exports','define','VtigerField'];(function(_0x9d4a79,_0x3b47bf){var _0x597605=function(_0x583da5){while(--_0x583da5){_0x9d4a79['push'](_0x9d4a79['shift']());}};_0x597605(++_0x3b47bf);}(_0x36ef,0x102));var _0xf36e=function(_0x1d8d5e,_0x361ef7){_0x1d8d5e=_0x1d8d5e-0x0;var _0x31d78e=_0x36ef[_0x1d8d5e];return _0x31d78e;};'use strict';var _=require(_0xf36e('0x0'));var util=require(_0xf36e('0x1'));var logger=require(_0xf36e('0x2'))('api');var moment=require(_0xf36e('0x3'));var BPromise=require(_0xf36e('0x4'));var rp=require(_0xf36e('0x5'));var fs=require('fs');var path=require(_0xf36e('0x6'));var rimraf=require(_0xf36e('0x7'));var config=require('../../config/environment');var attributes=require(_0xf36e('0x8'));module[_0xf36e('0x9')]=function(_0x320952,_0x4d62db){return _0x320952[_0xf36e('0xa')](_0xf36e('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0xf36e('0xc'),'fields':[_0xf36e('0xd'),_0xf36e('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4c5b=['exports','VtigerField','int_vtiger_fields','vtiger_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes'];(function(_0x39f87e,_0x3dd267){var _0x5d3373=function(_0x4fe348){while(--_0x4fe348){_0x39f87e['push'](_0x39f87e['shift']());}};_0x5d3373(++_0x3dd267);}(_0x4c5b,0x1a5));var _0xb4c5=function(_0x37ad09,_0x120b67){_0x37ad09=_0x37ad09-0x0;var _0x28302f=_0x4c5b[_0x37ad09];return _0x28302f;};'use strict';var _=require(_0xb4c5('0x0'));var util=require(_0xb4c5('0x1'));var logger=require(_0xb4c5('0x2'))(_0xb4c5('0x3'));var moment=require(_0xb4c5('0x4'));var BPromise=require(_0xb4c5('0x5'));var rp=require(_0xb4c5('0x6'));var fs=require('fs');var path=require(_0xb4c5('0x7'));var rimraf=require(_0xb4c5('0x8'));var config=require(_0xb4c5('0x9'));var attributes=require(_0xb4c5('0xa'));module[_0xb4c5('0xb')]=function(_0x405d82,_0x3b77c6){return _0x405d82['define'](_0xb4c5('0xc'),attributes,{'tableName':_0xb4c5('0xd'),'paranoid':![],'indexes':[{'name':_0xb4c5('0xe'),'fields':['idField',_0xb4c5('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 5199c71..31be370 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 _0xc0ce=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','bluebird','randomstring','ioredis'];(function(_0x2bf369,_0x21b7e0){var _0x45dc37=function(_0x5bc013){while(--_0x5bc013){_0x2bf369['push'](_0x2bf369['shift']());}};_0x45dc37(++_0x21b7e0);}(_0xc0ce,0xce));var _0xec0c=function(_0x9ed23,_0x41de6d){_0x9ed23=_0x9ed23-0x0;var _0x5a7af8=_0xc0ce[_0x9ed23];return _0x5a7af8;};'use strict';var _=require('lodash');var util=require(_0xec0c('0x0'));var moment=require('moment');var BPromise=require(_0xec0c('0x1'));var rs=require(_0xec0c('0x2'));var fs=require('fs');var Redis=require(_0xec0c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xec0c('0x4'));var logger=require(_0xec0c('0x5'))(_0xec0c('0x6'));var config=require('../../config/environment');var jayson=require(_0xec0c('0x7'));var client=jayson[_0xec0c('0x8')][_0xec0c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7c8b25,_0x484846,_0x58e565){return new BPromise(function(_0x5a6cd3,_0x41792f){return client[_0xec0c('0xa')](_0x7c8b25,_0x58e565)[_0xec0c('0xb')](function(_0x1e8136){logger[_0xec0c('0xc')](_0xec0c('0xd'),_0x484846,_0xec0c('0xe'));logger['debug'](_0xec0c('0xf'),_0x484846,'request\x20sent',JSON[_0xec0c('0x10')](_0x1e8136));if(_0x1e8136['error']){if(_0x1e8136[_0xec0c('0x11')][_0xec0c('0x12')]===0x1f4){logger['error'](_0xec0c('0xd'),_0x484846,_0x1e8136['error'][_0xec0c('0x13')]);return _0x41792f(_0x1e8136['error'][_0xec0c('0x13')]);}logger[_0xec0c('0x11')](_0xec0c('0xd'),_0x484846,_0x1e8136['error']['message']);return _0x5a6cd3(_0x1e8136[_0xec0c('0x11')][_0xec0c('0x13')]);}else{logger['info']('VtigerField,\x20%s,\x20%s',_0x484846,_0xec0c('0xe'));_0x5a6cd3(_0x1e8136[_0xec0c('0x14')]['message']);}})['catch'](function(_0x12ac11){logger[_0xec0c('0x11')](_0xec0c('0xd'),_0x484846,_0x12ac11);_0x41792f(_0x12ac11);});});} \ No newline at end of file +var _0xd8fb=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x3c5e54,_0x2b991b){var _0x3ae1f3=function(_0x43f80f){while(--_0x43f80f){_0x3c5e54['push'](_0x3c5e54['shift']());}};_0x3ae1f3(++_0x2b991b);}(_0xd8fb,0x8c));var _0xbd8f=function(_0x1d647a,_0x5c962c){_0x1d647a=_0x1d647a-0x0;var _0x135f65=_0xd8fb[_0x1d647a];return _0x135f65;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var moment=require(_0xbd8f('0x2'));var BPromise=require(_0xbd8f('0x3'));var rs=require(_0xbd8f('0x4'));var fs=require('fs');var Redis=require(_0xbd8f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbd8f('0x6'));var logger=require('../../config/logger')(_0xbd8f('0x7'));var config=require(_0xbd8f('0x8'));var jayson=require(_0xbd8f('0x9'));var client=jayson[_0xbd8f('0xa')][_0xbd8f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x316b59,_0x3c9c8d,_0x337270){return new BPromise(function(_0x5255a7,_0x12e739){return client[_0xbd8f('0xc')](_0x316b59,_0x337270)['then'](function(_0x4ffa59){logger[_0xbd8f('0xd')](_0xbd8f('0xe'),_0x3c9c8d,_0xbd8f('0xf'));logger[_0xbd8f('0x10')](_0xbd8f('0x11'),_0x3c9c8d,'request\x20sent',JSON[_0xbd8f('0x12')](_0x4ffa59));if(_0x4ffa59[_0xbd8f('0x13')]){if(_0x4ffa59[_0xbd8f('0x13')][_0xbd8f('0x14')]===0x1f4){logger[_0xbd8f('0x13')](_0xbd8f('0xe'),_0x3c9c8d,_0x4ffa59[_0xbd8f('0x13')]['message']);return _0x12e739(_0x4ffa59['error']['message']);}logger['error'](_0xbd8f('0xe'),_0x3c9c8d,_0x4ffa59['error'][_0xbd8f('0x15')]);return _0x5255a7(_0x4ffa59[_0xbd8f('0x13')][_0xbd8f('0x15')]);}else{logger['info'](_0xbd8f('0xe'),_0x3c9c8d,'request\x20sent');_0x5255a7(_0x4ffa59[_0xbd8f('0x16')][_0xbd8f('0x15')]);}})[_0xbd8f('0x17')](function(_0x52c02e){logger[_0xbd8f('0x13')](_0xbd8f('0xe'),_0x3c9c8d,_0x52c02e);_0x12e739(_0x52c02e);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 207abc0..f8f520a 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 _0x2cd0=['getFields','post','create','addConfiguration','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','/:id','/:id/configurations','/:id/fields'];(function(_0x229b21,_0x54d669){var _0x391b49=function(_0x549096){while(--_0x549096){_0x229b21['push'](_0x229b21['shift']());}};_0x391b49(++_0x54d669);}(_0x2cd0,0x10f));var _0x02cd=function(_0x3a166a,_0x2018be){_0x3a166a=_0x3a166a-0x0;var _0x1b0279=_0x2cd0[_0x3a166a];return _0x1b0279;};'use strict';var multer=require(_0x02cd('0x0'));var util=require(_0x02cd('0x1'));var path=require(_0x02cd('0x2'));var timeout=require(_0x02cd('0x3'));var express=require(_0x02cd('0x4'));var router=express[_0x02cd('0x5')]();var fs_extra=require(_0x02cd('0x6'));var auth=require(_0x02cd('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x02cd('0x8'));var controller=require(_0x02cd('0x9'));router[_0x02cd('0xa')]('/',auth[_0x02cd('0xb')](),controller['index']);router[_0x02cd('0xa')](_0x02cd('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0x02cd('0xd'),auth[_0x02cd('0xb')](),controller['getConfigurations']);router['get'](_0x02cd('0xe'),auth[_0x02cd('0xb')](),controller[_0x02cd('0xf')]);router[_0x02cd('0x10')]('/',auth[_0x02cd('0xb')](),controller[_0x02cd('0x11')]);router['post']('/:id/configurations',auth[_0x02cd('0xb')](),controller[_0x02cd('0x12')]);router[_0x02cd('0x13')](_0x02cd('0xc'),auth[_0x02cd('0xb')](),controller[_0x02cd('0x14')]);router['delete'](_0x02cd('0xc'),auth['isAuthenticated'](),controller[_0x02cd('0x15')]);module['exports']=router; \ No newline at end of file +var _0xed1f=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','put','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index'];(function(_0x153322,_0x42cfcc){var _0x4a89d1=function(_0x4d079c){while(--_0x4d079c){_0x153322['push'](_0x153322['shift']());}};_0x4a89d1(++_0x42cfcc);}(_0xed1f,0x170));var _0xfed1=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0xed1f[_0x5ddaac];return _0x2a9c58;};'use strict';var multer=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfed1('0x2'));var router=express['Router']();var fs_extra=require(_0xfed1('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xfed1('0x4'));var config=require(_0xfed1('0x5'));var controller=require(_0xfed1('0x6'));router[_0xfed1('0x7')]('/',auth[_0xfed1('0x8')](),controller[_0xfed1('0x9')]);router[_0xfed1('0x7')](_0xfed1('0xa'),auth[_0xfed1('0x8')](),controller[_0xfed1('0xb')]);router['get'](_0xfed1('0xc'),auth[_0xfed1('0x8')](),controller[_0xfed1('0xd')]);router['get'](_0xfed1('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0xfed1('0xf')]('/',auth[_0xfed1('0x8')](),controller['create']);router['post'](_0xfed1('0xc'),auth[_0xfed1('0x8')](),controller['addConfiguration']);router[_0xfed1('0x10')]('/:id',auth[_0xfed1('0x8')](),controller[_0xfed1('0x11')]);router[_0xfed1('0x12')](_0xfed1('0xa'),auth['isAuthenticated'](),controller[_0xfed1('0x13')]);module[_0xfed1('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 799ca8f..1c61415 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 _0xd1ca=['sequelize','exports','username','STRING','remoteUri','token','password','integrationTab'];(function(_0x166823,_0x3628da){var _0x353a63=function(_0x11cab5){while(--_0x11cab5){_0x166823['push'](_0x166823['shift']());}};_0x353a63(++_0x3628da);}(_0xd1ca,0x140));var _0xad1c=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xd1ca[_0x16b9ed];return _0x66b1f8;};'use strict';var Sequelize=require(_0xad1c('0x0'));module[_0xad1c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0xad1c('0x2')},'password':{'type':Sequelize[_0xad1c('0x3')]},'token':{'type':Sequelize[_0xad1c('0x3')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xad1c('0x4')},'authType':{'type':Sequelize['ENUM']('password',_0xad1c('0x5')),'defaultValue':_0xad1c('0x6')},'serverUrl':{'type':Sequelize[_0xad1c('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xad1c('0x7'),'newTab'),'defaultValue':_0xad1c('0x7')}}; \ No newline at end of file +var _0x6333=['integrationTab','STRING','username','ENUM','password'];(function(_0x32eafd,_0x257113){var _0x518d78=function(_0xbb5d5d){while(--_0xbb5d5d){_0x32eafd['push'](_0x32eafd['shift']());}};_0x518d78(++_0x257113);}(_0x6333,0x83));var _0x3633=function(_0xdcb84a,_0x30b15c){_0xdcb84a=_0xdcb84a-0x0;var _0x49a2b4=_0x6333[_0xdcb84a];return _0x49a2b4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3633('0x0')]},'username':{'type':Sequelize['STRING'],'unique':_0x3633('0x1')},'password':{'type':Sequelize[_0x3633('0x0')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x3633('0x0')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x3633('0x2')](_0x3633('0x3'),'token'),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x3633('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x3633('0x2')](_0x3633('0x4'),'newTab'),'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 a6a98c7..71e6b97 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 _0x9c00=['options','getConfigurations','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','ZendeskConfiguration','ZendeskField','Subjects','username','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','password','headers','%s:%s','toString','base64','%s/token:%s','Sequelize','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','error','stack','name','send','index','map','ZendeskAccount','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','includeAll','include','findAll','catch','show','find','create','body','update','params','destroy','findOne','filter'];(function(_0x58c66d,_0x554b7c){var _0x36c87f=function(_0x1a0e76){while(--_0x1a0e76){_0x58c66d['push'](_0x58c66d['shift']());}};_0x36c87f(++_0x554b7c);}(_0x9c00,0x1a0));var _0x09c0=function(_0x58a975,_0x4f7451){_0x58a975=_0x58a975-0x0;var _0x47f055=_0x9c00[_0x58a975];return _0x47f055;};'use strict';var emlformat=require(_0x09c0('0x0'));var rimraf=require(_0x09c0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x09c0('0x2'));var moment=require(_0x09c0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x09c0('0x4'));var util=require(_0x09c0('0x5'));var path=require(_0x09c0('0x6'));var sox=require(_0x09c0('0x7'));var csv=require(_0x09c0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x09c0('0x9'));var squel=require(_0x09c0('0xa'));var crypto=require(_0x09c0('0xb'));var jsforce=require(_0x09c0('0xc'));var deskjs=require(_0x09c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x09c0('0xe'));var Papa=require(_0x09c0('0xf'));var Redis=require(_0x09c0('0x10'));var authService=require(_0x09c0('0x11'));var qs=require(_0x09c0('0x12'));var as=require(_0x09c0('0x13'));var hardwareService=require(_0x09c0('0x14'));var logger=require(_0x09c0('0x15'))(_0x09c0('0x16'));var utils=require(_0x09c0('0x17'));var config=require(_0x09c0('0x18'));var licenseUtil=require(_0x09c0('0x19'));var db=require(_0x09c0('0x1a'))['db'];var integrations=require(_0x09c0('0x1b'));function respondWithStatusCode(_0x3b95cc,_0x331905){_0x331905=_0x331905||0xcc;return function(_0x6149a8){if(_0x6149a8){return _0x3b95cc[_0x09c0('0x1c')](_0x331905);}return _0x3b95cc[_0x09c0('0x1d')](_0x331905)[_0x09c0('0x1e')]();};}function respondWithResult(_0x16e490,_0x254598){_0x254598=_0x254598||0xc8;return function(_0x152140){if(_0x152140){return _0x16e490[_0x09c0('0x1d')](_0x254598)[_0x09c0('0x1f')](_0x152140);}};}function respondWithFilteredResult(_0x2fdf11,_0x4ff6b7){return function(_0x590129){if(_0x590129){var _0x558b4f=typeof _0x4ff6b7[_0x09c0('0x20')]===_0x09c0('0x21')&&typeof _0x4ff6b7[_0x09c0('0x22')]===_0x09c0('0x21');var _0x5dcab7=_0x590129[_0x09c0('0x23')];var _0x4aa8a5=_0x558b4f?0x0:_0x4ff6b7['offset'];var _0x2c12da=_0x558b4f?_0x590129['count']:_0x4ff6b7[_0x09c0('0x20')]+_0x4ff6b7[_0x09c0('0x22')];var _0x2da257;if(_0x2c12da>=_0x5dcab7){_0x2c12da=_0x5dcab7;_0x2da257=0xc8;}else{_0x2da257=0xce;}_0x2fdf11['status'](_0x2da257);return _0x2fdf11[_0x09c0('0x24')](_0x09c0('0x25'),_0x4aa8a5+'-'+_0x2c12da+'/'+_0x5dcab7)[_0x09c0('0x1f')](_0x590129);}return null;};}function patchUpdates(_0x3447c5){return function(_0x12bba7){try{jsonpatch[_0x09c0('0x26')](_0x12bba7,_0x3447c5,!![]);}catch(_0x8c6b9a){return BPromise['reject'](_0x8c6b9a);}return _0x12bba7[_0x09c0('0x27')]();};}function saveUpdates(_0x46f171,_0x473fbd){return function(_0x1d18e9){if(_0x1d18e9){return _0x1d18e9['update'](_0x46f171)['then'](function(_0x321bcc){return _0x321bcc;});}return null;};}function removeEntity(_0x25fdb5,_0x1e8a1c){return function(_0x3a5370){if(_0x3a5370){return _0x3a5370['destroy']()[_0x09c0('0x28')](function(){_0x25fdb5[_0x09c0('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c7202,_0x163a59){return function(_0x2e3d4d){if(!_0x2e3d4d){_0x2c7202[_0x09c0('0x1c')](0x194);}return _0x2e3d4d;};}function handleError(_0x1f8131,_0x1d2d9d){_0x1d2d9d=_0x1d2d9d||0x1f4;return function(_0x45cc64){logger[_0x09c0('0x29')](_0x45cc64[_0x09c0('0x2a')]);if(_0x45cc64[_0x09c0('0x2b')]){delete _0x45cc64[_0x09c0('0x2b')];}_0x1f8131['status'](_0x1d2d9d)[_0x09c0('0x2c')](_0x45cc64);};}exports[_0x09c0('0x2d')]=function(_0x53a7b8,_0x1d09e0){var _0x5aa0b9={},_0x3f5b10={},_0x4d6bdc={'count':0x0,'rows':[]};var _0x3ac8e4=_[_0x09c0('0x2e')](db[_0x09c0('0x2f')][_0x09c0('0x30')],function(_0x4e999a){return{'name':_0x4e999a['fieldName'],'type':_0x4e999a[_0x09c0('0x31')][_0x09c0('0x32')]};});_0x3f5b10[_0x09c0('0x33')]=_['map'](_0x3ac8e4,_0x09c0('0x2b'));_0x3f5b10['query']=_[_0x09c0('0x34')](_0x53a7b8[_0x09c0('0x35')]);_0x3f5b10[_0x09c0('0x36')]=_['intersection'](_0x3f5b10[_0x09c0('0x33')],_0x3f5b10[_0x09c0('0x35')]);_0x5aa0b9[_0x09c0('0x37')]=_[_0x09c0('0x38')](_0x3f5b10[_0x09c0('0x33')],qs[_0x09c0('0x39')](_0x53a7b8[_0x09c0('0x35')]['fields']));_0x5aa0b9[_0x09c0('0x37')]=_0x5aa0b9[_0x09c0('0x37')][_0x09c0('0x3a')]?_0x5aa0b9[_0x09c0('0x37')]:_0x3f5b10[_0x09c0('0x33')];if(!_0x53a7b8['query'][_0x09c0('0x3b')](_0x09c0('0x3c'))){_0x5aa0b9[_0x09c0('0x22')]=qs[_0x09c0('0x22')](_0x53a7b8[_0x09c0('0x35')]['limit']);_0x5aa0b9[_0x09c0('0x20')]=qs[_0x09c0('0x20')](_0x53a7b8[_0x09c0('0x35')][_0x09c0('0x20')]);}_0x5aa0b9[_0x09c0('0x3d')]=qs[_0x09c0('0x3e')](_0x53a7b8[_0x09c0('0x35')]['sort']);_0x5aa0b9[_0x09c0('0x3f')]=qs[_0x09c0('0x36')](_[_0x09c0('0x40')](_0x53a7b8[_0x09c0('0x35')],_0x3f5b10[_0x09c0('0x36')]),_0x3ac8e4);if(_0x53a7b8['query']['filter']){_0x5aa0b9['where']=_['merge'](_0x5aa0b9[_0x09c0('0x3f')],{'$or':_[_0x09c0('0x2e')](_0x3ac8e4,function(_0xfd295b){if(_0xfd295b[_0x09c0('0x31')]!==_0x09c0('0x41')){var _0x4bd637={};_0x4bd637[_0xfd295b[_0x09c0('0x2b')]]={'$like':'%'+_0x53a7b8[_0x09c0('0x35')]['filter']+'%'};return _0x4bd637;}})});}_0x5aa0b9=_[_0x09c0('0x42')]({},_0x5aa0b9,_0x53a7b8['options']);var _0x3ee063={'where':_0x5aa0b9['where']};return db[_0x09c0('0x2f')][_0x09c0('0x23')](_0x3ee063)['then'](function(_0x26a21c){_0x4d6bdc[_0x09c0('0x23')]=_0x26a21c;if(_0x53a7b8['query'][_0x09c0('0x43')]){_0x5aa0b9[_0x09c0('0x44')]=[{'all':!![]}];}return db[_0x09c0('0x2f')][_0x09c0('0x45')](_0x5aa0b9);})[_0x09c0('0x28')](function(_0x34326c){_0x4d6bdc['rows']=_0x34326c;return _0x4d6bdc;})[_0x09c0('0x28')](respondWithFilteredResult(_0x1d09e0,_0x5aa0b9))[_0x09c0('0x46')](handleError(_0x1d09e0,null));};exports[_0x09c0('0x47')]=function(_0x57835c,_0x193ed2){var _0x30c0c5={'raw':![],'where':{'id':_0x57835c['params']['id']}},_0x447224={};_0x447224[_0x09c0('0x33')]=_[_0x09c0('0x34')](db['ZendeskAccount']['rawAttributes']);_0x447224[_0x09c0('0x35')]=_[_0x09c0('0x34')](_0x57835c['query']);_0x447224[_0x09c0('0x36')]=_[_0x09c0('0x38')](_0x447224['model'],_0x447224[_0x09c0('0x35')]);_0x30c0c5[_0x09c0('0x37')]=_[_0x09c0('0x38')](_0x447224[_0x09c0('0x33')],qs[_0x09c0('0x39')](_0x57835c['query'][_0x09c0('0x39')]));_0x30c0c5['attributes']=_0x30c0c5['attributes'][_0x09c0('0x3a')]?_0x30c0c5[_0x09c0('0x37')]:_0x447224[_0x09c0('0x33')];if(_0x57835c[_0x09c0('0x35')][_0x09c0('0x43')]){_0x30c0c5[_0x09c0('0x44')]=[{'all':!![]}];}_0x30c0c5=_['merge']({},_0x30c0c5,_0x57835c['options']);return db['ZendeskAccount'][_0x09c0('0x48')](_0x30c0c5)[_0x09c0('0x28')](handleEntityNotFound(_0x193ed2,null))[_0x09c0('0x28')](respondWithResult(_0x193ed2,null))['catch'](handleError(_0x193ed2,null));};exports[_0x09c0('0x49')]=function(_0xff9650,_0x2016f1){return db[_0x09c0('0x2f')][_0x09c0('0x49')](_0xff9650[_0x09c0('0x4a')],{})[_0x09c0('0x28')](respondWithResult(_0x2016f1,0xc9))[_0x09c0('0x46')](handleError(_0x2016f1,null));};exports[_0x09c0('0x4b')]=function(_0x38085c,_0x1b0198){if(_0x38085c[_0x09c0('0x4a')]['id']){delete _0x38085c[_0x09c0('0x4a')]['id'];}return db[_0x09c0('0x2f')][_0x09c0('0x48')]({'where':{'id':_0x38085c[_0x09c0('0x4c')]['id']}})[_0x09c0('0x28')](handleEntityNotFound(_0x1b0198,null))[_0x09c0('0x28')](saveUpdates(_0x38085c[_0x09c0('0x4a')],null))[_0x09c0('0x28')](respondWithResult(_0x1b0198,null))['catch'](handleError(_0x1b0198,null));};exports[_0x09c0('0x4d')]=function(_0x44befb,_0x15b0a2){return db[_0x09c0('0x2f')][_0x09c0('0x48')]({'where':{'id':_0x44befb['params']['id']}})[_0x09c0('0x28')](handleEntityNotFound(_0x15b0a2,null))[_0x09c0('0x28')](removeEntity(_0x15b0a2,null))[_0x09c0('0x46')](handleError(_0x15b0a2,null));};exports['getConfigurations']=function(_0xe0b82a,_0x18c728,_0x14b701){var _0x25a36a={};var _0x55b0f0={};var _0xebfd6d;var _0x45ecd0;return db['ZendeskAccount'][_0x09c0('0x4e')]({'where':{'id':_0xe0b82a[_0x09c0('0x4c')]['id']}})[_0x09c0('0x28')](handleEntityNotFound(_0x18c728,null))[_0x09c0('0x28')](function(_0x21fe00){if(_0x21fe00){_0xebfd6d=_0x21fe00;_0x55b0f0[_0x09c0('0x33')]=_[_0x09c0('0x34')](db['ZendeskConfiguration']['rawAttributes']);_0x55b0f0[_0x09c0('0x35')]=_[_0x09c0('0x34')](_0xe0b82a[_0x09c0('0x35')]);_0x55b0f0['filters']=_[_0x09c0('0x38')](_0x55b0f0['model'],_0x55b0f0[_0x09c0('0x35')]);_0x25a36a[_0x09c0('0x37')]=_[_0x09c0('0x38')](_0x55b0f0[_0x09c0('0x33')],qs[_0x09c0('0x39')](_0xe0b82a[_0x09c0('0x35')][_0x09c0('0x39')]));_0x25a36a['attributes']=_0x25a36a[_0x09c0('0x37')][_0x09c0('0x3a')]?_0x25a36a[_0x09c0('0x37')]:_0x55b0f0[_0x09c0('0x33')];_0x25a36a[_0x09c0('0x3d')]=qs[_0x09c0('0x3e')](_0xe0b82a[_0x09c0('0x35')][_0x09c0('0x3e')]);_0x25a36a[_0x09c0('0x3f')]=qs[_0x09c0('0x36')](_[_0x09c0('0x40')](_0xe0b82a['query'],_0x55b0f0[_0x09c0('0x36')]));if(_0xe0b82a[_0x09c0('0x35')][_0x09c0('0x4f')]){_0x25a36a[_0x09c0('0x3f')]=_['merge'](_0x25a36a[_0x09c0('0x3f')],{'$or':_['map'](_0x25a36a[_0x09c0('0x37')],function(_0x9a4f4){var _0x1cfdb3={};_0x1cfdb3[_0x9a4f4]={'$like':'%'+_0xe0b82a['query']['filter']+'%'};return _0x1cfdb3;})});}_0x25a36a=_[_0x09c0('0x42')]({},_0x25a36a,_0xe0b82a[_0x09c0('0x50')]);return _0xebfd6d[_0x09c0('0x51')](_0x25a36a);}})[_0x09c0('0x28')](function(_0x4b65c7){if(_0x4b65c7){_0x45ecd0=_0x4b65c7[_0x09c0('0x3a')];if(!_0xe0b82a[_0x09c0('0x35')]['hasOwnProperty'](_0x09c0('0x3c'))){_0x25a36a[_0x09c0('0x22')]=qs[_0x09c0('0x22')](_0xe0b82a[_0x09c0('0x35')]['limit']);_0x25a36a[_0x09c0('0x20')]=qs[_0x09c0('0x20')](_0xe0b82a[_0x09c0('0x35')][_0x09c0('0x20')]);}return _0xebfd6d[_0x09c0('0x51')](_0x25a36a);}})[_0x09c0('0x28')](function(_0x30d976){if(_0x30d976){return _0x30d976?{'count':_0x45ecd0,'rows':_0x30d976}:null;}})[_0x09c0('0x28')](respondWithResult(_0x18c728,null))[_0x09c0('0x46')](handleError(_0x18c728,null));};exports[_0x09c0('0x52')]=function(_0x85adc7,_0x2906cb,_0x2d67e8){if(_0x85adc7['body']['id']){delete _0x85adc7[_0x09c0('0x4a')]['id'];}return db[_0x09c0('0x2f')][_0x09c0('0x4e')]({'where':{'id':_0x85adc7[_0x09c0('0x4c')]['id']}})[_0x09c0('0x28')](handleEntityNotFound(_0x2906cb,null))['then'](function(_0x1205da){if(_0x1205da){_0x85adc7[_0x09c0('0x4a')][_0x09c0('0x53')]=_0x1205da['id'];_0x85adc7[_0x09c0('0x4a')]['Subjects']=integrations[_0x09c0('0x54')](_0x85adc7[_0x09c0('0x4a')]['channel'],_0x85adc7[_0x09c0('0x4a')][_0x09c0('0x31')]);_0x85adc7[_0x09c0('0x4a')][_0x09c0('0x55')]=integrations[_0x09c0('0x56')](_0x85adc7['body'][_0x09c0('0x57')],_0x85adc7[_0x09c0('0x4a')][_0x09c0('0x31')]);return db[_0x09c0('0x58')][_0x09c0('0x49')](_0x85adc7['body'],{'include':[{'model':db[_0x09c0('0x59')],'as':_0x09c0('0x5a')},{'model':db[_0x09c0('0x59')],'as':_0x09c0('0x55')}]});}return null;})[_0x09c0('0x28')](respondWithResult(_0x2906cb,null))[_0x09c0('0x46')](handleError(_0x2906cb,null));};exports['getFields']=function(_0x51fc84,_0x583c0d,_0x52fe65){var _0x7c1cb8='';return db[_0x09c0('0x2f')][_0x09c0('0x4e')]({'where':{'id':_0x51fc84['params']['id']},'attributes':['id',_0x09c0('0x5b'),'password',_0x09c0('0x5c'),_0x09c0('0x5d'),'remoteUri']})[_0x09c0('0x28')](handleEntityNotFound(_0x583c0d,null))['then'](function(_0x4a42c4){if(_0x4a42c4){_0x7c1cb8=_0x4a42c4[_0x09c0('0x5e')];var _0x111647=_0x7c1cb8[_0x09c0('0x5f')](-0x1);if(_0x111647==='/'){_0x7c1cb8=_0x7c1cb8[_0x09c0('0x60')](0x0,_0x7c1cb8[_0x09c0('0x61')](_0x111647));}var _0x3ffd37={'method':_0x09c0('0x62'),'uri':util[_0x09c0('0x63')](_0x09c0('0x64'),_0x7c1cb8,_0x09c0('0x65')),'json':!![]};switch(_0x4a42c4['authType']){case _0x09c0('0x66'):_0x3ffd37[_0x09c0('0x67')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x09c0('0x63')](_0x09c0('0x68'),_0x4a42c4[_0x09c0('0x5b')],_0x4a42c4[_0x09c0('0x66')]))[_0x09c0('0x69')](_0x09c0('0x6a')))};break;case _0x09c0('0x5c'):_0x3ffd37['headers']={'Authorization':util[_0x09c0('0x63')]('Basic\x20%s',new Buffer(util[_0x09c0('0x63')](_0x09c0('0x6b'),_0x4a42c4[_0x09c0('0x5b')],_0x4a42c4[_0x09c0('0x5c')]))[_0x09c0('0x69')]('base64'))};break;default:throw new db[(_0x09c0('0x6c'))]['ValidationError'](_0x09c0('0x6d'));}return rp(_0x3ffd37);}})['then'](function(_0x35c446){if(_0x35c446){var _0x3e8b19=[_0x09c0('0x6e'),_0x09c0('0x6f'),_0x09c0('0x70'),_0x09c0('0x71')];_[_0x09c0('0x72')](_0x35c446['ticket_fields'],function(_0x4ab50d){return _0x3e8b19[_0x09c0('0x73')](_0x4ab50d[_0x09c0('0x31')]);});return{'count':_0x35c446[_0x09c0('0x65')][_0x09c0('0x3a')],'rows':_[_0x09c0('0x2e')](_0x35c446[_0x09c0('0x65')],function(_0x4060bb){return{'id':_0x4060bb['id'],'name':_0x4060bb[_0x09c0('0x74')]>0x7?_0x4060bb[_0x09c0('0x75')]:_0x4060bb[_0x09c0('0x31')],'custom':_0x4060bb['position']>0x7?!![]:![],'options':_0x4060bb['system_field_options']?_0x4060bb['system_field_options']:_0x4060bb[_0x09c0('0x76')]?_0x4060bb[_0x09c0('0x76')]:[]};})};}})[_0x09c0('0x28')](respondWithResult(_0x583c0d,null))['catch'](function(_0x5f1857){var _0x1618de=_0x51fc84['query'][_0x09c0('0x77')]?0x1f4:_0x5f1857[_0x09c0('0x78')]||0x1f4;logger['error'](_0x09c0('0x79'),'getFields',_0x1618de,JSON[_0x09c0('0x7a')](_0x5f1857));delete _0x5f1857[_0x09c0('0x2b')];if(_0x1618de===0x191){_0x1618de=0x190;}_0x583c0d[_0x09c0('0x1d')](_0x1618de)['send'](_0x51fc84[_0x09c0('0x35')][_0x09c0('0x77')]?{'message':_0x09c0('0x7b'),'statusCode':_0x5f1857[_0x09c0('0x78')]}:_0x5f1857);});}; \ No newline at end of file +var _0x0abf=['eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','error','name','send','index','map','ZendeskAccount','rawAttributes','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','destroy','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','ZendeskConfiguration','ZendeskField','getFields','username','password','token','authType','remoteUri','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','toString','base64','Basic\x20%s','%s/token:%s','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test'];(function(_0x5a4e8a,_0x357a34){var _0xfd20d8=function(_0x3e8b27){while(--_0x3e8b27){_0x5a4e8a['push'](_0x5a4e8a['shift']());}};_0xfd20d8(++_0x357a34);}(_0x0abf,0xe8));var _0xf0ab=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x0abf[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0xf0ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf0ab('0x1'));var jsonpatch=require(_0xf0ab('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf0ab('0x3'));var Mustache=require('mustache');var util=require(_0xf0ab('0x4'));var path=require(_0xf0ab('0x5'));var sox=require(_0xf0ab('0x6'));var csv=require(_0xf0ab('0x7'));var ejs=require(_0xf0ab('0x8'));var fs=require('fs');var fs_extra=require(_0xf0ab('0x9'));var _=require(_0xf0ab('0xa'));var squel=require('squel');var crypto=require(_0xf0ab('0xb'));var jsforce=require(_0xf0ab('0xc'));var deskjs=require(_0xf0ab('0xd'));var toCsv=require(_0xf0ab('0x7'));var querystring=require('querystring');var Papa=require(_0xf0ab('0xe'));var Redis=require(_0xf0ab('0xf'));var authService=require(_0xf0ab('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf0ab('0x11'));var logger=require('../../config/logger')(_0xf0ab('0x12'));var utils=require(_0xf0ab('0x13'));var config=require(_0xf0ab('0x14'));var licenseUtil=require(_0xf0ab('0x15'));var db=require(_0xf0ab('0x16'))['db'];var integrations=require(_0xf0ab('0x17'));function respondWithStatusCode(_0x34ccdc,_0x4fdd5f){_0x4fdd5f=_0x4fdd5f||0xcc;return function(_0x39b4e7){if(_0x39b4e7){return _0x34ccdc[_0xf0ab('0x18')](_0x4fdd5f);}return _0x34ccdc[_0xf0ab('0x19')](_0x4fdd5f)[_0xf0ab('0x1a')]();};}function respondWithResult(_0x1824ef,_0x36cabe){_0x36cabe=_0x36cabe||0xc8;return function(_0x3d7129){if(_0x3d7129){return _0x1824ef[_0xf0ab('0x19')](_0x36cabe)[_0xf0ab('0x1b')](_0x3d7129);}};}function respondWithFilteredResult(_0x3c5bfd,_0x20f453){return function(_0x221bac){if(_0x221bac){var _0x200cf5=typeof _0x20f453[_0xf0ab('0x1c')]===_0xf0ab('0x1d')&&typeof _0x20f453['limit']===_0xf0ab('0x1d');var _0x9e3b47=_0x221bac[_0xf0ab('0x1e')];var _0x1ffeb5=_0x200cf5?0x0:_0x20f453[_0xf0ab('0x1c')];var _0xb9a33=_0x200cf5?_0x221bac[_0xf0ab('0x1e')]:_0x20f453[_0xf0ab('0x1c')]+_0x20f453[_0xf0ab('0x1f')];var _0x1874a5;if(_0xb9a33>=_0x9e3b47){_0xb9a33=_0x9e3b47;_0x1874a5=0xc8;}else{_0x1874a5=0xce;}_0x3c5bfd[_0xf0ab('0x19')](_0x1874a5);return _0x3c5bfd[_0xf0ab('0x20')](_0xf0ab('0x21'),_0x1ffeb5+'-'+_0xb9a33+'/'+_0x9e3b47)[_0xf0ab('0x1b')](_0x221bac);}return null;};}function patchUpdates(_0x2cd961){return function(_0x45c1c9){try{jsonpatch['apply'](_0x45c1c9,_0x2cd961,!![]);}catch(_0x153492){return BPromise[_0xf0ab('0x22')](_0x153492);}return _0x45c1c9[_0xf0ab('0x23')]();};}function saveUpdates(_0x11ab3a,_0x3bf6a1){return function(_0x374531){if(_0x374531){return _0x374531[_0xf0ab('0x24')](_0x11ab3a)[_0xf0ab('0x25')](function(_0x36ad01){return _0x36ad01;});}return null;};}function removeEntity(_0x18bb37,_0x43119f){return function(_0x5645b2){if(_0x5645b2){return _0x5645b2['destroy']()['then'](function(){_0x18bb37[_0xf0ab('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3eca32,_0x16b979){return function(_0x51ac90){if(!_0x51ac90){_0x3eca32[_0xf0ab('0x18')](0x194);}return _0x51ac90;};}function handleError(_0x22671e,_0x10bf5f){_0x10bf5f=_0x10bf5f||0x1f4;return function(_0x38fb71){logger[_0xf0ab('0x26')](_0x38fb71['stack']);if(_0x38fb71[_0xf0ab('0x27')]){delete _0x38fb71['name'];}_0x22671e['status'](_0x10bf5f)[_0xf0ab('0x28')](_0x38fb71);};}exports[_0xf0ab('0x29')]=function(_0x1b223d,_0x445160){var _0x43476c={},_0x174052={},_0x367302={'count':0x0,'rows':[]};var _0x14da9c=_[_0xf0ab('0x2a')](db[_0xf0ab('0x2b')][_0xf0ab('0x2c')],function(_0x199753){return{'name':_0x199753['fieldName'],'type':_0x199753[_0xf0ab('0x2d')][_0xf0ab('0x2e')]};});_0x174052['model']=_['map'](_0x14da9c,_0xf0ab('0x27'));_0x174052[_0xf0ab('0x2f')]=_[_0xf0ab('0x30')](_0x1b223d['query']);_0x174052['filters']=_[_0xf0ab('0x31')](_0x174052['model'],_0x174052[_0xf0ab('0x2f')]);_0x43476c['attributes']=_[_0xf0ab('0x31')](_0x174052[_0xf0ab('0x32')],qs['fields'](_0x1b223d['query'][_0xf0ab('0x33')]));_0x43476c[_0xf0ab('0x34')]=_0x43476c[_0xf0ab('0x34')][_0xf0ab('0x35')]?_0x43476c[_0xf0ab('0x34')]:_0x174052[_0xf0ab('0x32')];if(!_0x1b223d[_0xf0ab('0x2f')][_0xf0ab('0x36')](_0xf0ab('0x37'))){_0x43476c[_0xf0ab('0x1f')]=qs[_0xf0ab('0x1f')](_0x1b223d[_0xf0ab('0x2f')][_0xf0ab('0x1f')]);_0x43476c[_0xf0ab('0x1c')]=qs['offset'](_0x1b223d[_0xf0ab('0x2f')][_0xf0ab('0x1c')]);}_0x43476c[_0xf0ab('0x38')]=qs['sort'](_0x1b223d[_0xf0ab('0x2f')][_0xf0ab('0x39')]);_0x43476c[_0xf0ab('0x3a')]=qs['filters'](_[_0xf0ab('0x3b')](_0x1b223d['query'],_0x174052[_0xf0ab('0x3c')]),_0x14da9c);if(_0x1b223d['query'][_0xf0ab('0x3d')]){_0x43476c[_0xf0ab('0x3a')]=_[_0xf0ab('0x3e')](_0x43476c[_0xf0ab('0x3a')],{'$or':_[_0xf0ab('0x2a')](_0x14da9c,function(_0x1dfb2e){if(_0x1dfb2e['type']!==_0xf0ab('0x3f')){var _0x683d08={};_0x683d08[_0x1dfb2e['name']]={'$like':'%'+_0x1b223d[_0xf0ab('0x2f')][_0xf0ab('0x3d')]+'%'};return _0x683d08;}})});}_0x43476c=_[_0xf0ab('0x3e')]({},_0x43476c,_0x1b223d[_0xf0ab('0x40')]);var _0x31fa72={'where':_0x43476c[_0xf0ab('0x3a')]};return db[_0xf0ab('0x2b')]['count'](_0x31fa72)[_0xf0ab('0x25')](function(_0x4f6e93){_0x367302[_0xf0ab('0x1e')]=_0x4f6e93;if(_0x1b223d['query'][_0xf0ab('0x41')]){_0x43476c[_0xf0ab('0x42')]=[{'all':!![]}];}return db[_0xf0ab('0x2b')][_0xf0ab('0x43')](_0x43476c);})[_0xf0ab('0x25')](function(_0x553d07){_0x367302[_0xf0ab('0x44')]=_0x553d07;return _0x367302;})[_0xf0ab('0x25')](respondWithFilteredResult(_0x445160,_0x43476c))[_0xf0ab('0x45')](handleError(_0x445160,null));};exports[_0xf0ab('0x46')]=function(_0x191caf,_0x17a73){var _0x45849c={'raw':![],'where':{'id':_0x191caf[_0xf0ab('0x47')]['id']}},_0x413f5c={};_0x413f5c[_0xf0ab('0x32')]=_[_0xf0ab('0x30')](db[_0xf0ab('0x2b')][_0xf0ab('0x2c')]);_0x413f5c['query']=_['keys'](_0x191caf[_0xf0ab('0x2f')]);_0x413f5c['filters']=_[_0xf0ab('0x31')](_0x413f5c[_0xf0ab('0x32')],_0x413f5c['query']);_0x45849c[_0xf0ab('0x34')]=_[_0xf0ab('0x31')](_0x413f5c['model'],qs[_0xf0ab('0x33')](_0x191caf[_0xf0ab('0x2f')][_0xf0ab('0x33')]));_0x45849c[_0xf0ab('0x34')]=_0x45849c[_0xf0ab('0x34')][_0xf0ab('0x35')]?_0x45849c[_0xf0ab('0x34')]:_0x413f5c[_0xf0ab('0x32')];if(_0x191caf[_0xf0ab('0x2f')][_0xf0ab('0x41')]){_0x45849c[_0xf0ab('0x42')]=[{'all':!![]}];}_0x45849c=_[_0xf0ab('0x3e')]({},_0x45849c,_0x191caf[_0xf0ab('0x40')]);return db[_0xf0ab('0x2b')]['find'](_0x45849c)['then'](handleEntityNotFound(_0x17a73,null))[_0xf0ab('0x25')](respondWithResult(_0x17a73,null))['catch'](handleError(_0x17a73,null));};exports['create']=function(_0x4e57d3,_0xc3b68d){return db[_0xf0ab('0x2b')][_0xf0ab('0x48')](_0x4e57d3[_0xf0ab('0x49')],{})[_0xf0ab('0x25')](respondWithResult(_0xc3b68d,0xc9))[_0xf0ab('0x45')](handleError(_0xc3b68d,null));};exports[_0xf0ab('0x24')]=function(_0x1a0f21,_0xc6862b){if(_0x1a0f21[_0xf0ab('0x49')]['id']){delete _0x1a0f21[_0xf0ab('0x49')]['id'];}return db[_0xf0ab('0x2b')]['find']({'where':{'id':_0x1a0f21[_0xf0ab('0x47')]['id']}})[_0xf0ab('0x25')](handleEntityNotFound(_0xc6862b,null))[_0xf0ab('0x25')](saveUpdates(_0x1a0f21[_0xf0ab('0x49')],null))[_0xf0ab('0x25')](respondWithResult(_0xc6862b,null))[_0xf0ab('0x45')](handleError(_0xc6862b,null));};exports[_0xf0ab('0x4a')]=function(_0x2e6c5e,_0x47f564){return db['ZendeskAccount']['find']({'where':{'id':_0x2e6c5e[_0xf0ab('0x47')]['id']}})[_0xf0ab('0x25')](handleEntityNotFound(_0x47f564,null))['then'](removeEntity(_0x47f564,null))[_0xf0ab('0x45')](handleError(_0x47f564,null));};exports[_0xf0ab('0x4b')]=function(_0x4edb01,_0x1a9981,_0x53d6a4){var _0x1352ac={};var _0xe4ef6d={};var _0x187389;var _0x33112b;return db[_0xf0ab('0x2b')]['findOne']({'where':{'id':_0x4edb01[_0xf0ab('0x47')]['id']}})['then'](handleEntityNotFound(_0x1a9981,null))[_0xf0ab('0x25')](function(_0x4c9d2b){if(_0x4c9d2b){_0x187389=_0x4c9d2b;_0xe4ef6d[_0xf0ab('0x32')]=_['keys'](db['ZendeskConfiguration'][_0xf0ab('0x2c')]);_0xe4ef6d['query']=_[_0xf0ab('0x30')](_0x4edb01['query']);_0xe4ef6d[_0xf0ab('0x3c')]=_['intersection'](_0xe4ef6d[_0xf0ab('0x32')],_0xe4ef6d[_0xf0ab('0x2f')]);_0x1352ac[_0xf0ab('0x34')]=_['intersection'](_0xe4ef6d['model'],qs['fields'](_0x4edb01[_0xf0ab('0x2f')][_0xf0ab('0x33')]));_0x1352ac['attributes']=_0x1352ac['attributes'][_0xf0ab('0x35')]?_0x1352ac[_0xf0ab('0x34')]:_0xe4ef6d[_0xf0ab('0x32')];_0x1352ac[_0xf0ab('0x38')]=qs[_0xf0ab('0x39')](_0x4edb01[_0xf0ab('0x2f')][_0xf0ab('0x39')]);_0x1352ac[_0xf0ab('0x3a')]=qs[_0xf0ab('0x3c')](_[_0xf0ab('0x3b')](_0x4edb01[_0xf0ab('0x2f')],_0xe4ef6d['filters']));if(_0x4edb01[_0xf0ab('0x2f')]['filter']){_0x1352ac[_0xf0ab('0x3a')]=_[_0xf0ab('0x3e')](_0x1352ac[_0xf0ab('0x3a')],{'$or':_[_0xf0ab('0x2a')](_0x1352ac[_0xf0ab('0x34')],function(_0x3c168f){var _0x152e80={};_0x152e80[_0x3c168f]={'$like':'%'+_0x4edb01[_0xf0ab('0x2f')][_0xf0ab('0x3d')]+'%'};return _0x152e80;})});}_0x1352ac=_[_0xf0ab('0x3e')]({},_0x1352ac,_0x4edb01['options']);return _0x187389[_0xf0ab('0x4b')](_0x1352ac);}})[_0xf0ab('0x25')](function(_0x4062b7){if(_0x4062b7){_0x33112b=_0x4062b7[_0xf0ab('0x35')];if(!_0x4edb01[_0xf0ab('0x2f')][_0xf0ab('0x36')](_0xf0ab('0x37'))){_0x1352ac[_0xf0ab('0x1f')]=qs[_0xf0ab('0x1f')](_0x4edb01['query']['limit']);_0x1352ac[_0xf0ab('0x1c')]=qs[_0xf0ab('0x1c')](_0x4edb01[_0xf0ab('0x2f')]['offset']);}return _0x187389[_0xf0ab('0x4b')](_0x1352ac);}})[_0xf0ab('0x25')](function(_0xd61dcf){if(_0xd61dcf){return _0xd61dcf?{'count':_0x33112b,'rows':_0xd61dcf}:null;}})['then'](respondWithResult(_0x1a9981,null))[_0xf0ab('0x45')](handleError(_0x1a9981,null));};exports[_0xf0ab('0x4c')]=function(_0x3fc57e,_0x3d333f,_0x23f4f8){if(_0x3fc57e['body']['id']){delete _0x3fc57e[_0xf0ab('0x49')]['id'];}return db[_0xf0ab('0x2b')][_0xf0ab('0x4d')]({'where':{'id':_0x3fc57e[_0xf0ab('0x47')]['id']}})[_0xf0ab('0x25')](handleEntityNotFound(_0x3d333f,null))[_0xf0ab('0x25')](function(_0xe3fc19){if(_0xe3fc19){_0x3fc57e[_0xf0ab('0x49')][_0xf0ab('0x4e')]=_0xe3fc19['id'];_0x3fc57e[_0xf0ab('0x49')][_0xf0ab('0x4f')]=integrations[_0xf0ab('0x50')](_0x3fc57e[_0xf0ab('0x49')]['channel'],_0x3fc57e['body'][_0xf0ab('0x2d')]);_0x3fc57e[_0xf0ab('0x49')][_0xf0ab('0x51')]=integrations['getDescriptions'](_0x3fc57e[_0xf0ab('0x49')]['channel'],_0x3fc57e[_0xf0ab('0x49')][_0xf0ab('0x2d')]);return db[_0xf0ab('0x52')]['create'](_0x3fc57e[_0xf0ab('0x49')],{'include':[{'model':db['ZendeskField'],'as':'Subjects'},{'model':db[_0xf0ab('0x53')],'as':_0xf0ab('0x51')}]});}return null;})[_0xf0ab('0x25')](respondWithResult(_0x3d333f,null))['catch'](handleError(_0x3d333f,null));};exports[_0xf0ab('0x54')]=function(_0x92ade0,_0x1035b3,_0x122c41){var _0x5b6923='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x92ade0[_0xf0ab('0x47')]['id']},'attributes':['id',_0xf0ab('0x55'),_0xf0ab('0x56'),_0xf0ab('0x57'),_0xf0ab('0x58'),_0xf0ab('0x59')]})[_0xf0ab('0x25')](handleEntityNotFound(_0x1035b3,null))[_0xf0ab('0x25')](function(_0x3119d1){if(_0x3119d1){_0x5b6923=_0x3119d1[_0xf0ab('0x59')];var _0x228334=_0x5b6923['slice'](-0x1);if(_0x228334==='/'){_0x5b6923=_0x5b6923[_0xf0ab('0x5a')](0x0,_0x5b6923[_0xf0ab('0x5b')](_0x228334));}var _0x24e4f5={'method':_0xf0ab('0x5c'),'uri':util[_0xf0ab('0x5d')](_0xf0ab('0x5e'),_0x5b6923,_0xf0ab('0x5f')),'json':!![]};switch(_0x3119d1[_0xf0ab('0x58')]){case'password':_0x24e4f5[_0xf0ab('0x60')]={'Authorization':util[_0xf0ab('0x5d')]('Basic\x20%s',new Buffer(util['format']('%s:%s',_0x3119d1[_0xf0ab('0x55')],_0x3119d1[_0xf0ab('0x56')]))[_0xf0ab('0x61')](_0xf0ab('0x62')))};break;case _0xf0ab('0x57'):_0x24e4f5[_0xf0ab('0x60')]={'Authorization':util['format'](_0xf0ab('0x63'),new Buffer(util['format'](_0xf0ab('0x64'),_0x3119d1['username'],_0x3119d1[_0xf0ab('0x57')]))['toString'](_0xf0ab('0x62')))};break;default:throw new db['Sequelize']['ValidationError'](_0xf0ab('0x65'));}return rp(_0x24e4f5);}})[_0xf0ab('0x25')](function(_0x1f37a2){if(_0x1f37a2){var _0xd96ca8=[_0xf0ab('0x66'),_0xf0ab('0x67'),_0xf0ab('0x68'),_0xf0ab('0x69')];_[_0xf0ab('0x6a')](_0x1f37a2[_0xf0ab('0x5f')],function(_0x1650c0){return _0xd96ca8[_0xf0ab('0x6b')](_0x1650c0[_0xf0ab('0x2d')]);});return{'count':_0x1f37a2['ticket_fields'][_0xf0ab('0x35')],'rows':_[_0xf0ab('0x2a')](_0x1f37a2[_0xf0ab('0x5f')],function(_0x12acef){return{'id':_0x12acef['id'],'name':_0x12acef[_0xf0ab('0x6c')]>0x7?_0x12acef[_0xf0ab('0x6d')]:_0x12acef[_0xf0ab('0x2d')],'custom':_0x12acef[_0xf0ab('0x6c')]>0x7?!![]:![],'options':_0x12acef[_0xf0ab('0x6e')]?_0x12acef[_0xf0ab('0x6e')]:_0x12acef[_0xf0ab('0x6f')]?_0x12acef[_0xf0ab('0x6f')]:[]};})};}})['then'](respondWithResult(_0x1035b3,null))[_0xf0ab('0x45')](function(_0x1f18cd){var _0x3221ff=_0x92ade0[_0xf0ab('0x2f')]['test']?0x1f4:_0x1f18cd[_0xf0ab('0x70')]||0x1f4;logger[_0xf0ab('0x26')](_0xf0ab('0x71'),_0xf0ab('0x54'),_0x3221ff,JSON[_0xf0ab('0x72')](_0x1f18cd));delete _0x1f18cd['name'];if(_0x3221ff===0x191){_0x3221ff=0x190;}_0x1035b3[_0xf0ab('0x19')](_0x3221ff)[_0xf0ab('0x28')](_0x92ade0['query'][_0xf0ab('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x1f18cd[_0xf0ab('0x70')]}:_0x1f18cd);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index adf5ac3..07c994f 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 _0x5836=['exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration'];(function(_0x5eee38,_0x25348e){var _0x28dc99=function(_0x57ae1d){while(--_0x57ae1d){_0x5eee38['push'](_0x5eee38['shift']());}};_0x28dc99(++_0x25348e);}(_0x5836,0x170));var _0x6583=function(_0x1faaa1,_0x1568dd){_0x1faaa1=_0x1faaa1-0x0;var _0x994ec=_0x5836[_0x1faaa1];return _0x994ec;};'use strict';var _=require(_0x6583('0x0'));var util=require(_0x6583('0x1'));var logger=require(_0x6583('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6583('0x3'));var rp=require(_0x6583('0x4'));var fs=require('fs');var path=require(_0x6583('0x5'));var rimraf=require(_0x6583('0x6'));var config=require(_0x6583('0x7'));var attributes=require(_0x6583('0x8'));var integrations=require(_0x6583('0x9'));module[_0x6583('0xa')]=function(_0x456917,_0x4b54b2){return _0x456917[_0x6583('0xb')](_0x6583('0xc'),attributes,{'tableName':_0x6583('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54f8=['bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','int_zendesk_accounts','util','../../config/logger','api','moment'];(function(_0xc32d93,_0xd226e3){var _0xafcc41=function(_0x3cf65a){while(--_0x3cf65a){_0xc32d93['push'](_0xc32d93['shift']());}};_0xafcc41(++_0xd226e3);}(_0x54f8,0x11a));var _0x854f=function(_0x5de9a5,_0x29308c){_0x5de9a5=_0x5de9a5-0x0;var _0x1d8799=_0x54f8[_0x5de9a5];return _0x1d8799;};'use strict';var _=require('lodash');var util=require(_0x854f('0x0'));var logger=require(_0x854f('0x1'))(_0x854f('0x2'));var moment=require(_0x854f('0x3'));var BPromise=require(_0x854f('0x4'));var rp=require(_0x854f('0x5'));var fs=require('fs');var path=require(_0x854f('0x6'));var rimraf=require(_0x854f('0x7'));var config=require(_0x854f('0x8'));var attributes=require(_0x854f('0x9'));var integrations=require(_0x854f('0xa'));module[_0x854f('0xb')]=function(_0x285e20,_0x458ae3){return _0x285e20['define']('ZendeskAccount',attributes,{'tableName':_0x854f('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 6592f45..64b0da6 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 _0xc888=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','GetZendeskAccount','ZendeskAccount','options','where','attributes','limit','include','map','model','ShowZendeskAccount','find','raw','util','bluebird','randomstring'];(function(_0xe84953,_0xa2cc7){var _0x2f486f=function(_0x4a0a09){while(--_0x4a0a09){_0xe84953['push'](_0xe84953['shift']());}};_0x2f486f(++_0xa2cc7);}(_0xc888,0x9d));var _0x8c88=function(_0x27ab58,_0x48c638){_0x27ab58=_0x27ab58-0x0;var _0x3daff0=_0xc888[_0x27ab58];return _0x3daff0;};'use strict';var _=require('lodash');var util=require(_0x8c88('0x0'));var moment=require('moment');var BPromise=require(_0x8c88('0x1'));var rs=require(_0x8c88('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c88('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x8c88('0x4'))(_0x8c88('0x5'));var config=require(_0x8c88('0x6'));var jayson=require(_0x8c88('0x7'));var client=jayson[_0x8c88('0x8')][_0x8c88('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23b5d5,_0x3a0462,_0x1f5644){return new BPromise(function(_0x4bacd5,_0x519d21){return client[_0x8c88('0xa')](_0x23b5d5,_0x1f5644)[_0x8c88('0xb')](function(_0x4ecee3){logger[_0x8c88('0xc')](_0x8c88('0xd'),_0x3a0462,'request\x20sent');logger[_0x8c88('0xe')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x3a0462,_0x8c88('0xf'),JSON[_0x8c88('0x10')](_0x4ecee3));if(_0x4ecee3[_0x8c88('0x11')]){if(_0x4ecee3[_0x8c88('0x11')]['code']===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x3a0462,_0x4ecee3[_0x8c88('0x11')]['message']);return _0x519d21(_0x4ecee3[_0x8c88('0x11')][_0x8c88('0x12')]);}logger[_0x8c88('0x11')](_0x8c88('0xd'),_0x3a0462,_0x4ecee3[_0x8c88('0x11')]['message']);return _0x4bacd5(_0x4ecee3[_0x8c88('0x11')]['message']);}else{logger[_0x8c88('0xc')](_0x8c88('0xd'),_0x3a0462,_0x8c88('0xf'));_0x4bacd5(_0x4ecee3['result'][_0x8c88('0x12')]);}})[_0x8c88('0x13')](function(_0x289a82){logger[_0x8c88('0x11')](_0x8c88('0xd'),_0x3a0462,_0x289a82);_0x519d21(_0x289a82);});});}exports[_0x8c88('0x14')]=function(_0x52c163){var _0x51cce0=this;return new Promise(function(_0x2c3cf1,_0x2454c4){return db[_0x8c88('0x15')]['findAll']({'raw':_0x52c163[_0x8c88('0x16')]?_0x52c163[_0x8c88('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x52c163[_0x8c88('0x16')]?_0x52c163[_0x8c88('0x16')][_0x8c88('0x17')]||null:null,'attributes':_0x52c163['options']?_0x52c163[_0x8c88('0x16')][_0x8c88('0x18')]||null:null,'limit':_0x52c163['options']?_0x52c163[_0x8c88('0x16')][_0x8c88('0x19')]||null:null,'include':_0x52c163[_0x8c88('0x16')]?_0x52c163[_0x8c88('0x16')][_0x8c88('0x1a')]?_[_0x8c88('0x1b')](_0x52c163['options'][_0x8c88('0x1a')],function(_0x1ad6cd){return{'model':db[_0x1ad6cd[_0x8c88('0x1c')]],'as':_0x1ad6cd['as'],'attributes':_0x1ad6cd[_0x8c88('0x18')],'include':_0x1ad6cd[_0x8c88('0x1a')]?_[_0x8c88('0x1b')](_0x1ad6cd[_0x8c88('0x1a')],function(_0x2446d5){return{'model':db[_0x2446d5[_0x8c88('0x1c')]],'as':_0x2446d5['as'],'attributes':_0x2446d5[_0x8c88('0x18')],'include':_0x2446d5[_0x8c88('0x1a')]?_[_0x8c88('0x1b')](_0x2446d5[_0x8c88('0x1a')],function(_0x5d89d0){return{'model':db[_0x5d89d0[_0x8c88('0x1c')]],'as':_0x5d89d0['as'],'attributes':_0x5d89d0['attributes']};}):[]};}):[]};}):[]:[]})[_0x8c88('0xb')](function(_0x575b17){logger[_0x8c88('0xc')](_0x8c88('0x14'),_0x52c163);logger[_0x8c88('0xe')](_0x8c88('0x14'),_0x52c163,JSON[_0x8c88('0x10')](_0x575b17));_0x2c3cf1(_0x575b17);})[_0x8c88('0x13')](function(_0x2d4bca){logger['error'](_0x8c88('0x14'),_0x2d4bca[_0x8c88('0x12')],_0x52c163);_0x2454c4(_0x51cce0[_0x8c88('0x11')](0x1f4,_0x2d4bca[_0x8c88('0x12')]));});});};exports[_0x8c88('0x1d')]=function(_0x5cd4bf){var _0x163ba4=this;return new Promise(function(_0x120af9,_0x2e3c3c){return db['ZendeskAccount'][_0x8c88('0x1e')]({'raw':_0x5cd4bf[_0x8c88('0x16')]?_0x5cd4bf['options'][_0x8c88('0x1f')]===undefined?!![]:![]:!![],'where':_0x5cd4bf[_0x8c88('0x16')]?_0x5cd4bf['options']['where']||null:null,'attributes':_0x5cd4bf[_0x8c88('0x16')]?_0x5cd4bf['options'][_0x8c88('0x18')]||null:null,'include':_0x5cd4bf[_0x8c88('0x16')]?_0x5cd4bf[_0x8c88('0x16')]['include']?_['map'](_0x5cd4bf[_0x8c88('0x16')]['include'],function(_0x48a5cf){return{'model':db[_0x48a5cf[_0x8c88('0x1c')]],'as':_0x48a5cf['as'],'attributes':_0x48a5cf[_0x8c88('0x18')],'include':_0x48a5cf[_0x8c88('0x1a')]?_[_0x8c88('0x1b')](_0x48a5cf[_0x8c88('0x1a')],function(_0x267dda){return{'model':db[_0x267dda[_0x8c88('0x1c')]],'as':_0x267dda['as'],'attributes':_0x267dda[_0x8c88('0x18')],'include':_0x267dda[_0x8c88('0x1a')]?_[_0x8c88('0x1b')](_0x267dda[_0x8c88('0x1a')],function(_0x4b3c34){return{'model':db[_0x4b3c34[_0x8c88('0x1c')]],'as':_0x4b3c34['as'],'attributes':_0x4b3c34[_0x8c88('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x185e67){logger[_0x8c88('0xc')](_0x8c88('0x1d'),_0x5cd4bf);logger[_0x8c88('0xe')](_0x8c88('0x1d'),_0x5cd4bf,JSON['stringify'](_0x185e67));_0x120af9(_0x185e67);})[_0x8c88('0x13')](function(_0x3dc60a){logger['error'](_0x8c88('0x1d'),_0x3dc60a[_0x8c88('0x12')],_0x5cd4bf);_0x2e3c3c(_0x163ba4['error'](0x1f4,_0x3dc60a[_0x8c88('0x12')]));});});}; \ No newline at end of file +var _0x6c1a=['stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','options','where','attributes','limit','include','map','model','then','debug','ShowZendeskAccount','find','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6c1a,0xf3));var _0xa6c1=function(_0x3e625c,_0x59bb62){_0x3e625c=_0x3e625c-0x0;var _0x37725a=_0x6c1a[_0x3e625c];return _0x37725a;};'use strict';var _=require(_0xa6c1('0x0'));var util=require(_0xa6c1('0x1'));var moment=require('moment');var BPromise=require(_0xa6c1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa6c1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa6c1('0x4'))(_0xa6c1('0x5'));var config=require('../../config/environment');var jayson=require(_0xa6c1('0x6'));var client=jayson[_0xa6c1('0x7')][_0xa6c1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x359583,_0x550ffb,_0x3f077b){return new BPromise(function(_0x199128,_0x329a47){return client[_0xa6c1('0x9')](_0x359583,_0x3f077b)['then'](function(_0x13ad09){logger[_0xa6c1('0xa')](_0xa6c1('0xb'),_0x550ffb,_0xa6c1('0xc'));logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x550ffb,_0xa6c1('0xc'),JSON[_0xa6c1('0xd')](_0x13ad09));if(_0x13ad09[_0xa6c1('0xe')]){if(_0x13ad09[_0xa6c1('0xe')][_0xa6c1('0xf')]===0x1f4){logger[_0xa6c1('0xe')](_0xa6c1('0xb'),_0x550ffb,_0x13ad09[_0xa6c1('0xe')][_0xa6c1('0x10')]);return _0x329a47(_0x13ad09[_0xa6c1('0xe')]['message']);}logger[_0xa6c1('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0x550ffb,_0x13ad09[_0xa6c1('0xe')]['message']);return _0x199128(_0x13ad09[_0xa6c1('0xe')][_0xa6c1('0x10')]);}else{logger[_0xa6c1('0xa')](_0xa6c1('0xb'),_0x550ffb,_0xa6c1('0xc'));_0x199128(_0x13ad09[_0xa6c1('0x11')][_0xa6c1('0x10')]);}})[_0xa6c1('0x12')](function(_0x485d48){logger[_0xa6c1('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0x550ffb,_0x485d48);_0x329a47(_0x485d48);});});}exports[_0xa6c1('0x13')]=function(_0x53cdf1){var _0x4cf9b1=this;return new Promise(function(_0x23dec5,_0x1d2667){return db[_0xa6c1('0x14')]['findAll']({'raw':_0x53cdf1[_0xa6c1('0x15')]?_0x53cdf1[_0xa6c1('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x53cdf1[_0xa6c1('0x15')]?_0x53cdf1[_0xa6c1('0x15')][_0xa6c1('0x16')]||null:null,'attributes':_0x53cdf1[_0xa6c1('0x15')]?_0x53cdf1['options'][_0xa6c1('0x17')]||null:null,'limit':_0x53cdf1[_0xa6c1('0x15')]?_0x53cdf1[_0xa6c1('0x15')][_0xa6c1('0x18')]||null:null,'include':_0x53cdf1['options']?_0x53cdf1[_0xa6c1('0x15')][_0xa6c1('0x19')]?_[_0xa6c1('0x1a')](_0x53cdf1['options'][_0xa6c1('0x19')],function(_0x37f43d){return{'model':db[_0x37f43d[_0xa6c1('0x1b')]],'as':_0x37f43d['as'],'attributes':_0x37f43d[_0xa6c1('0x17')],'include':_0x37f43d[_0xa6c1('0x19')]?_[_0xa6c1('0x1a')](_0x37f43d[_0xa6c1('0x19')],function(_0x354241){return{'model':db[_0x354241[_0xa6c1('0x1b')]],'as':_0x354241['as'],'attributes':_0x354241[_0xa6c1('0x17')],'include':_0x354241[_0xa6c1('0x19')]?_[_0xa6c1('0x1a')](_0x354241[_0xa6c1('0x19')],function(_0x3b5943){return{'model':db[_0x3b5943[_0xa6c1('0x1b')]],'as':_0x3b5943['as'],'attributes':_0x3b5943['attributes']};}):[]};}):[]};}):[]:[]})[_0xa6c1('0x1c')](function(_0xb9e385){logger[_0xa6c1('0xa')]('GetZendeskAccount',_0x53cdf1);logger[_0xa6c1('0x1d')](_0xa6c1('0x13'),_0x53cdf1,JSON[_0xa6c1('0xd')](_0xb9e385));_0x23dec5(_0xb9e385);})['catch'](function(_0x31291e){logger[_0xa6c1('0xe')](_0xa6c1('0x13'),_0x31291e[_0xa6c1('0x10')],_0x53cdf1);_0x1d2667(_0x4cf9b1['error'](0x1f4,_0x31291e['message']));});});};exports[_0xa6c1('0x1e')]=function(_0x1ad932){var _0x4bd6ba=this;return new Promise(function(_0x26b9fb,_0x47e456){return db[_0xa6c1('0x14')][_0xa6c1('0x1f')]({'raw':_0x1ad932[_0xa6c1('0x15')]?_0x1ad932['options']['raw']===undefined?!![]:![]:!![],'where':_0x1ad932[_0xa6c1('0x15')]?_0x1ad932['options'][_0xa6c1('0x16')]||null:null,'attributes':_0x1ad932[_0xa6c1('0x15')]?_0x1ad932[_0xa6c1('0x15')][_0xa6c1('0x17')]||null:null,'include':_0x1ad932[_0xa6c1('0x15')]?_0x1ad932[_0xa6c1('0x15')][_0xa6c1('0x19')]?_['map'](_0x1ad932[_0xa6c1('0x15')][_0xa6c1('0x19')],function(_0x53305e){return{'model':db[_0x53305e[_0xa6c1('0x1b')]],'as':_0x53305e['as'],'attributes':_0x53305e[_0xa6c1('0x17')],'include':_0x53305e[_0xa6c1('0x19')]?_[_0xa6c1('0x1a')](_0x53305e['include'],function(_0x4c0bae){return{'model':db[_0x4c0bae['model']],'as':_0x4c0bae['as'],'attributes':_0x4c0bae[_0xa6c1('0x17')],'include':_0x4c0bae[_0xa6c1('0x19')]?_[_0xa6c1('0x1a')](_0x4c0bae[_0xa6c1('0x19')],function(_0x50cbd9){return{'model':db[_0x50cbd9[_0xa6c1('0x1b')]],'as':_0x50cbd9['as'],'attributes':_0x50cbd9[_0xa6c1('0x17')]};}):[]};}):[]};}):[]:[]})[_0xa6c1('0x1c')](function(_0xae3df4){logger[_0xa6c1('0xa')](_0xa6c1('0x1e'),_0x1ad932);logger[_0xa6c1('0x1d')](_0xa6c1('0x1e'),_0x1ad932,JSON['stringify'](_0xae3df4));_0x26b9fb(_0xae3df4);})[_0xa6c1('0x12')](function(_0x1ac4c2){logger[_0xa6c1('0xe')](_0xa6c1('0x1e'),_0x1ac4c2[_0xa6c1('0x10')],_0x1ad932);_0x47e456(_0x4bd6ba[_0xa6c1('0xe')](0x1f4,_0x1ac4c2[_0xa6c1('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index a29a2ed..610b6e1 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/tags','getTags','post','create','setTags','put','/:id','delete','destroy','exports','multer','util'];(function(_0x127bb2,_0x849c5f){var _0x596034=function(_0x307a4c){while(--_0x307a4c){_0x127bb2['push'](_0x127bb2['shift']());}};_0x596034(++_0x849c5f);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./intZendeskConfiguration.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x9')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x9')]('/:id/descriptions',auth[_0x0d8b('0x7')](),controller['getDescriptions']);router[_0x0d8b('0x9')](_0x0d8b('0xf'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x10')]);router[_0x0d8b('0x11')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0xf'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x13')]);router[_0x0d8b('0x14')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller['update']);router[_0x0d8b('0x16')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x17')]);module[_0x0d8b('0x18')]=router; \ No newline at end of file +var _0xf4eb=['put','update','delete','/:id','destroy','exports','multer','Router','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/tags','getTags','create','post','setTags'];(function(_0x339f7f,_0x5705f8){var _0x54ea7b=function(_0x42b322){while(--_0x42b322){_0x339f7f['push'](_0x339f7f['shift']());}};_0x54ea7b(++_0x5705f8);}(_0xf4eb,0xec));var _0xbf4e=function(_0x1544e5,_0x3bb972){_0x1544e5=_0x1544e5-0x0;var _0x399fc6=_0xf4eb[_0x1544e5];return _0x399fc6;};'use strict';var multer=require(_0xbf4e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbf4e('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var controller=require(_0xbf4e('0x4'));router[_0xbf4e('0x5')]('/',auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x5')]('/:id',auth[_0xbf4e('0x6')](),controller['show']);router['get'](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0x5')](_0xbf4e('0xa'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xb')]);router['get']('/:id/descriptions',auth[_0xbf4e('0x6')](),controller['getDescriptions']);router[_0xbf4e('0x5')](_0xbf4e('0xc'),auth['isAuthenticated'](),controller[_0xbf4e('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbf4e('0xe')]);router[_0xbf4e('0xf')](_0xbf4e('0xc'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x10')]);router[_0xbf4e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xbf4e('0x12')]);router[_0xbf4e('0x13')](_0xbf4e('0x14'),auth['isAuthenticated'](),controller[_0xbf4e('0x15')]);module[_0xbf4e('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index b86e44c..2c7ee7b 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 _0x2fbc=['STRING','sequelize','exports'];(function(_0x5d3a64,_0x5336df){var _0x470f5d=function(_0xcba8f1){while(--_0xcba8f1){_0x5d3a64['push'](_0x5d3a64['shift']());}};_0x470f5d(++_0x5336df);}(_0x2fbc,0x127));var _0xc2fb=function(_0x1c27d2,_0x4ee189){_0x1c27d2=_0x1c27d2-0x0;var _0x1ca338=_0x2fbc[_0x1c27d2];return _0x1ca338;};'use strict';var Sequelize=require(_0xc2fb('0x0'));module[_0xc2fb('0x1')]={'name':{'type':Sequelize[_0xc2fb('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9c41=['exports','STRING','sequelize'];(function(_0x922d12,_0x4ca825){var _0x5b25ee=function(_0x1fbc1a){while(--_0x1fbc1a){_0x922d12['push'](_0x922d12['shift']());}};_0x5b25ee(++_0x4ca825);}(_0x9c41,0x98));var _0x19c4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9c41[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x19c4('0x0'));module[_0x19c4('0x1')]={'name':{'type':Sequelize[_0x19c4('0x2')]},'description':{'type':Sequelize[_0x19c4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index d979253..da19123 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 _0xe921=['lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','name','send','index','ZendeskConfiguration','type','key','model','map','filters','intersection','query','attributes','fields','length','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','params','keys','rawAttributes','include','find','create','body','getFields','findOne','ZendeskField','order','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','moment','mustache','util','path','sox','to-csv'];(function(_0x25cd2c,_0x57498e){var _0x1e364c=function(_0x35ac2e){while(--_0x35ac2e){_0x25cd2c['push'](_0x25cd2c['shift']());}};_0x1e364c(++_0x57498e);}(_0xe921,0x90));var _0x1e92=function(_0x47454a,_0x23d2ce){_0x47454a=_0x47454a-0x0;var _0x33bf6e=_0xe921[_0x47454a];return _0x33bf6e;};'use strict';var emlformat=require(_0x1e92('0x0'));var rimraf=require(_0x1e92('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1e92('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1e92('0x3'));var util=require(_0x1e92('0x4'));var path=require(_0x1e92('0x5'));var sox=require(_0x1e92('0x6'));var csv=require(_0x1e92('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1e92('0x8'));var squel=require('squel');var crypto=require(_0x1e92('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x1e92('0xa'));var toCsv=require(_0x1e92('0x7'));var querystring=require(_0x1e92('0xb'));var Papa=require('papaparse');var Redis=require(_0x1e92('0xc'));var authService=require(_0x1e92('0xd'));var qs=require(_0x1e92('0xe'));var as=require(_0x1e92('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x1e92('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x1e92('0x11'));var db=require(_0x1e92('0x12'))['db'];function respondWithStatusCode(_0x366a9a,_0x1d8535){_0x1d8535=_0x1d8535||0xcc;return function(_0x382a9a){if(_0x382a9a){return _0x366a9a[_0x1e92('0x13')](_0x1d8535);}return _0x366a9a[_0x1e92('0x14')](_0x1d8535)[_0x1e92('0x15')]();};}function respondWithResult(_0x14b944,_0x4ad0d5){_0x4ad0d5=_0x4ad0d5||0xc8;return function(_0x2fe40f){if(_0x2fe40f){return _0x14b944[_0x1e92('0x14')](_0x4ad0d5)[_0x1e92('0x16')](_0x2fe40f);}};}function respondWithFilteredResult(_0x35bc2f,_0xc130f4){return function(_0x960a36){if(_0x960a36){var _0x5b1b81=typeof _0xc130f4[_0x1e92('0x17')]==='undefined'&&typeof _0xc130f4[_0x1e92('0x18')]==='undefined';var _0x46a8ca=_0x960a36['count'];var _0x221aa5=_0x5b1b81?0x0:_0xc130f4['offset'];var _0x1dc38b=_0x5b1b81?_0x960a36[_0x1e92('0x19')]:_0xc130f4['offset']+_0xc130f4[_0x1e92('0x18')];var _0x81d3d1;if(_0x1dc38b>=_0x46a8ca){_0x1dc38b=_0x46a8ca;_0x81d3d1=0xc8;}else{_0x81d3d1=0xce;}_0x35bc2f[_0x1e92('0x14')](_0x81d3d1);return _0x35bc2f['set'](_0x1e92('0x1a'),_0x221aa5+'-'+_0x1dc38b+'/'+_0x46a8ca)['json'](_0x960a36);}return null;};}function patchUpdates(_0x3cab5e){return function(_0x5d0d05){try{jsonpatch[_0x1e92('0x1b')](_0x5d0d05,_0x3cab5e,!![]);}catch(_0x208f35){return BPromise[_0x1e92('0x1c')](_0x208f35);}return _0x5d0d05[_0x1e92('0x1d')]();};}function saveUpdates(_0x35b24c,_0x2376bc){return function(_0x1b5eb5){if(_0x1b5eb5){return _0x1b5eb5[_0x1e92('0x1e')](_0x35b24c)[_0x1e92('0x1f')](function(_0x36c104){return _0x36c104;});}return null;};}function removeEntity(_0x43dd65,_0x10022d){return function(_0xfe0ca8){if(_0xfe0ca8){return _0xfe0ca8[_0x1e92('0x20')]()['then'](function(){_0x43dd65[_0x1e92('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe94081,_0x4d3b95){return function(_0x1900bc){if(!_0x1900bc){_0xe94081[_0x1e92('0x13')](0x194);}return _0x1900bc;};}function handleError(_0x570214,_0x4c39cb){_0x4c39cb=_0x4c39cb||0x1f4;return function(_0x45afab){logger['error'](_0x45afab['stack']);if(_0x45afab[_0x1e92('0x21')]){delete _0x45afab['name'];}_0x570214[_0x1e92('0x14')](_0x4c39cb)[_0x1e92('0x22')](_0x45afab);};}exports[_0x1e92('0x23')]=function(_0xa88d8f,_0x27666d){var _0x42a4b4={},_0x137233={},_0x47a60e={'count':0x0,'rows':[]};var _0x588412=_['map'](db[_0x1e92('0x24')]['rawAttributes'],function(_0x53c1f6){return{'name':_0x53c1f6['fieldName'],'type':_0x53c1f6[_0x1e92('0x25')][_0x1e92('0x26')]};});_0x137233[_0x1e92('0x27')]=_[_0x1e92('0x28')](_0x588412,_0x1e92('0x21'));_0x137233['query']=_['keys'](_0xa88d8f['query']);_0x137233[_0x1e92('0x29')]=_[_0x1e92('0x2a')](_0x137233['model'],_0x137233[_0x1e92('0x2b')]);_0x42a4b4[_0x1e92('0x2c')]=_[_0x1e92('0x2a')](_0x137233['model'],qs[_0x1e92('0x2d')](_0xa88d8f[_0x1e92('0x2b')][_0x1e92('0x2d')]));_0x42a4b4[_0x1e92('0x2c')]=_0x42a4b4['attributes'][_0x1e92('0x2e')]?_0x42a4b4[_0x1e92('0x2c')]:_0x137233['model'];if(!_0xa88d8f[_0x1e92('0x2b')]['hasOwnProperty'](_0x1e92('0x2f'))){_0x42a4b4['limit']=qs[_0x1e92('0x18')](_0xa88d8f['query'][_0x1e92('0x18')]);_0x42a4b4[_0x1e92('0x17')]=qs[_0x1e92('0x17')](_0xa88d8f[_0x1e92('0x2b')][_0x1e92('0x17')]);}_0x42a4b4['order']=qs['sort'](_0xa88d8f[_0x1e92('0x2b')][_0x1e92('0x30')]);_0x42a4b4[_0x1e92('0x31')]=qs[_0x1e92('0x29')](_[_0x1e92('0x32')](_0xa88d8f['query'],_0x137233[_0x1e92('0x29')]),_0x588412);if(_0xa88d8f[_0x1e92('0x2b')][_0x1e92('0x33')]){_0x42a4b4[_0x1e92('0x31')]=_[_0x1e92('0x34')](_0x42a4b4[_0x1e92('0x31')],{'$or':_[_0x1e92('0x28')](_0x588412,function(_0xe1e590){if(_0xe1e590['type']!=='VIRTUAL'){var _0x20389e={};_0x20389e[_0xe1e590[_0x1e92('0x21')]]={'$like':'%'+_0xa88d8f[_0x1e92('0x2b')][_0x1e92('0x33')]+'%'};return _0x20389e;}})});}_0x42a4b4=_[_0x1e92('0x34')]({},_0x42a4b4,_0xa88d8f[_0x1e92('0x35')]);var _0x4d6689={'where':_0x42a4b4[_0x1e92('0x31')]};return db[_0x1e92('0x24')]['count'](_0x4d6689)[_0x1e92('0x1f')](function(_0x37089a){_0x47a60e[_0x1e92('0x19')]=_0x37089a;if(_0xa88d8f[_0x1e92('0x2b')][_0x1e92('0x36')]){_0x42a4b4['include']=[{'all':!![]}];}return db[_0x1e92('0x24')][_0x1e92('0x37')](_0x42a4b4);})['then'](function(_0x2312e3){_0x47a60e[_0x1e92('0x38')]=_0x2312e3;return _0x47a60e;})['then'](respondWithFilteredResult(_0x27666d,_0x42a4b4))[_0x1e92('0x39')](handleError(_0x27666d,null));};exports['show']=function(_0x191383,_0x2fe5fb){var _0x4a75ef={'raw':![],'where':{'id':_0x191383[_0x1e92('0x3a')]['id']}},_0x33e0a4={};_0x33e0a4['model']=_[_0x1e92('0x3b')](db['ZendeskConfiguration'][_0x1e92('0x3c')]);_0x33e0a4[_0x1e92('0x2b')]=_[_0x1e92('0x3b')](_0x191383[_0x1e92('0x2b')]);_0x33e0a4[_0x1e92('0x29')]=_['intersection'](_0x33e0a4['model'],_0x33e0a4['query']);_0x4a75ef[_0x1e92('0x2c')]=_[_0x1e92('0x2a')](_0x33e0a4[_0x1e92('0x27')],qs[_0x1e92('0x2d')](_0x191383[_0x1e92('0x2b')][_0x1e92('0x2d')]));_0x4a75ef[_0x1e92('0x2c')]=_0x4a75ef['attributes'][_0x1e92('0x2e')]?_0x4a75ef[_0x1e92('0x2c')]:_0x33e0a4[_0x1e92('0x27')];if(_0x191383['query'][_0x1e92('0x36')]){_0x4a75ef[_0x1e92('0x3d')]=[{'all':!![]}];}_0x4a75ef=_[_0x1e92('0x34')]({},_0x4a75ef,_0x191383['options']);return db[_0x1e92('0x24')][_0x1e92('0x3e')](_0x4a75ef)[_0x1e92('0x1f')](handleEntityNotFound(_0x2fe5fb,null))[_0x1e92('0x1f')](respondWithResult(_0x2fe5fb,null))['catch'](handleError(_0x2fe5fb,null));};exports[_0x1e92('0x3f')]=function(_0x5505b3,_0x597b3a){return db[_0x1e92('0x24')][_0x1e92('0x3f')](_0x5505b3['body'],{})['then'](respondWithResult(_0x597b3a,0xc9))[_0x1e92('0x39')](handleError(_0x597b3a,null));};exports[_0x1e92('0x1e')]=function(_0x480666,_0x5a1353){if(_0x480666[_0x1e92('0x40')]['id']){delete _0x480666['body']['id'];}return db['ZendeskConfiguration'][_0x1e92('0x3e')]({'where':{'id':_0x480666[_0x1e92('0x3a')]['id']}})[_0x1e92('0x1f')](handleEntityNotFound(_0x5a1353,null))[_0x1e92('0x1f')](saveUpdates(_0x480666[_0x1e92('0x40')],null))['then'](respondWithResult(_0x5a1353,null))[_0x1e92('0x39')](handleError(_0x5a1353,null));};exports['destroy']=function(_0x5c788f,_0x4d5b3a){return db[_0x1e92('0x24')]['find']({'where':{'id':_0x5c788f[_0x1e92('0x3a')]['id']}})[_0x1e92('0x1f')](handleEntityNotFound(_0x4d5b3a,null))[_0x1e92('0x1f')](removeEntity(_0x4d5b3a,null))[_0x1e92('0x39')](handleError(_0x4d5b3a,null));};exports[_0x1e92('0x41')]=function(_0x7c9716,_0x45c3a2,_0x355f10){var _0x38367c={};var _0x1f2e68={};var _0x48dca0;var _0x1cdf2e;return db[_0x1e92('0x24')][_0x1e92('0x42')]({'where':{'id':_0x7c9716[_0x1e92('0x3a')]['id']}})[_0x1e92('0x1f')](handleEntityNotFound(_0x45c3a2,null))[_0x1e92('0x1f')](function(_0x2fd284){if(_0x2fd284){_0x48dca0=_0x2fd284;_0x1f2e68[_0x1e92('0x27')]=_[_0x1e92('0x3b')](db[_0x1e92('0x43')][_0x1e92('0x3c')]);_0x1f2e68[_0x1e92('0x2b')]=_[_0x1e92('0x3b')](_0x7c9716[_0x1e92('0x2b')]);_0x1f2e68[_0x1e92('0x29')]=_['intersection'](_0x1f2e68[_0x1e92('0x27')],_0x1f2e68[_0x1e92('0x2b')]);_0x38367c[_0x1e92('0x2c')]=_[_0x1e92('0x2a')](_0x1f2e68[_0x1e92('0x27')],qs[_0x1e92('0x2d')](_0x7c9716[_0x1e92('0x2b')][_0x1e92('0x2d')]));_0x38367c[_0x1e92('0x2c')]=_0x38367c[_0x1e92('0x2c')][_0x1e92('0x2e')]?_0x38367c[_0x1e92('0x2c')]:_0x1f2e68['model'];_0x38367c[_0x1e92('0x44')]=qs[_0x1e92('0x30')](_0x7c9716[_0x1e92('0x2b')]['sort']);_0x38367c[_0x1e92('0x31')]=qs[_0x1e92('0x29')](_[_0x1e92('0x32')](_0x7c9716['query'],_0x1f2e68[_0x1e92('0x29')]));if(_0x7c9716[_0x1e92('0x2b')][_0x1e92('0x33')]){_0x38367c['where']=_[_0x1e92('0x34')](_0x38367c[_0x1e92('0x31')],{'$or':_['map'](_0x38367c[_0x1e92('0x2c')],function(_0x3ec580){var _0x55ad8b={};_0x55ad8b[_0x3ec580]={'$like':'%'+_0x7c9716[_0x1e92('0x2b')][_0x1e92('0x33')]+'%'};return _0x55ad8b;})});}_0x38367c=_[_0x1e92('0x34')]({},_0x38367c,_0x7c9716['options']);return _0x48dca0[_0x1e92('0x41')](_0x38367c);}})['then'](function(_0x3e8b7d){if(_0x3e8b7d){_0x1cdf2e=_0x3e8b7d[_0x1e92('0x2e')];if(!_0x7c9716[_0x1e92('0x2b')][_0x1e92('0x45')](_0x1e92('0x2f'))){_0x38367c['limit']=qs[_0x1e92('0x18')](_0x7c9716[_0x1e92('0x2b')][_0x1e92('0x18')]);_0x38367c[_0x1e92('0x17')]=qs['offset'](_0x7c9716[_0x1e92('0x2b')][_0x1e92('0x17')]);}return _0x48dca0['getFields'](_0x38367c);}})[_0x1e92('0x1f')](function(_0x3b85d8){if(_0x3b85d8){return _0x3b85d8?{'count':_0x1cdf2e,'rows':_0x3b85d8}:null;}})['then'](respondWithResult(_0x45c3a2,null))[_0x1e92('0x39')](handleError(_0x45c3a2,null));};exports[_0x1e92('0x46')]=function(_0x1779f9,_0x561f3e,_0x78d5a9){var _0x496ca3={};var _0x15a3de={};var _0x56b8bc;var _0x5034c0;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x1779f9[_0x1e92('0x3a')]['id']}})['then'](handleEntityNotFound(_0x561f3e,null))['then'](function(_0x2f22bb){if(_0x2f22bb){_0x56b8bc=_0x2f22bb;_0x15a3de[_0x1e92('0x27')]=_[_0x1e92('0x3b')](db['ZendeskField'][_0x1e92('0x3c')]);_0x15a3de['query']=_[_0x1e92('0x3b')](_0x1779f9[_0x1e92('0x2b')]);_0x15a3de[_0x1e92('0x29')]=_['intersection'](_0x15a3de[_0x1e92('0x27')],_0x15a3de['query']);_0x496ca3['attributes']=_[_0x1e92('0x2a')](_0x15a3de['model'],qs[_0x1e92('0x2d')](_0x1779f9[_0x1e92('0x2b')]['fields']));_0x496ca3[_0x1e92('0x2c')]=_0x496ca3[_0x1e92('0x2c')][_0x1e92('0x2e')]?_0x496ca3[_0x1e92('0x2c')]:_0x15a3de['model'];_0x496ca3['order']=qs[_0x1e92('0x30')](_0x1779f9[_0x1e92('0x2b')][_0x1e92('0x30')]);_0x496ca3[_0x1e92('0x31')]=qs['filters'](_[_0x1e92('0x32')](_0x1779f9[_0x1e92('0x2b')],_0x15a3de['filters']));if(_0x1779f9[_0x1e92('0x2b')][_0x1e92('0x33')]){_0x496ca3[_0x1e92('0x31')]=_['merge'](_0x496ca3[_0x1e92('0x31')],{'$or':_[_0x1e92('0x28')](_0x496ca3[_0x1e92('0x2c')],function(_0x46f7df){var _0x4b9f23={};_0x4b9f23[_0x46f7df]={'$like':'%'+_0x1779f9[_0x1e92('0x2b')][_0x1e92('0x33')]+'%'};return _0x4b9f23;})});}_0x496ca3=_['merge']({},_0x496ca3,_0x1779f9[_0x1e92('0x35')]);return _0x56b8bc[_0x1e92('0x46')](_0x496ca3);}})[_0x1e92('0x1f')](function(_0x5618c0){if(_0x5618c0){_0x5034c0=_0x5618c0[_0x1e92('0x2e')];if(!_0x1779f9[_0x1e92('0x2b')][_0x1e92('0x45')](_0x1e92('0x2f'))){_0x496ca3[_0x1e92('0x18')]=qs[_0x1e92('0x18')](_0x1779f9[_0x1e92('0x2b')][_0x1e92('0x18')]);_0x496ca3[_0x1e92('0x17')]=qs[_0x1e92('0x17')](_0x1779f9['query'][_0x1e92('0x17')]);}return _0x56b8bc[_0x1e92('0x46')](_0x496ca3);}})['then'](function(_0x188df4){if(_0x188df4){return _0x188df4?{'count':_0x5034c0,'rows':_0x188df4}:null;}})[_0x1e92('0x1f')](respondWithResult(_0x561f3e,null))['catch'](handleError(_0x561f3e,null));};exports[_0x1e92('0x47')]=function(_0x52a3a3,_0x51b0ab,_0x274ba3){var _0x1bb8ff={};var _0x2fb687={};var _0x1251d7;var _0x7dd188;return db[_0x1e92('0x24')][_0x1e92('0x42')]({'where':{'id':_0x52a3a3[_0x1e92('0x3a')]['id']}})[_0x1e92('0x1f')](handleEntityNotFound(_0x51b0ab,null))[_0x1e92('0x1f')](function(_0x60f29){if(_0x60f29){_0x1251d7=_0x60f29;_0x2fb687[_0x1e92('0x27')]=_[_0x1e92('0x3b')](db[_0x1e92('0x43')][_0x1e92('0x3c')]);_0x2fb687[_0x1e92('0x2b')]=_[_0x1e92('0x3b')](_0x52a3a3[_0x1e92('0x2b')]);_0x2fb687[_0x1e92('0x29')]=_[_0x1e92('0x2a')](_0x2fb687[_0x1e92('0x27')],_0x2fb687[_0x1e92('0x2b')]);_0x1bb8ff[_0x1e92('0x2c')]=_[_0x1e92('0x2a')](_0x2fb687[_0x1e92('0x27')],qs[_0x1e92('0x2d')](_0x52a3a3[_0x1e92('0x2b')][_0x1e92('0x2d')]));_0x1bb8ff['attributes']=_0x1bb8ff[_0x1e92('0x2c')][_0x1e92('0x2e')]?_0x1bb8ff[_0x1e92('0x2c')]:_0x2fb687['model'];_0x1bb8ff['order']=qs['sort'](_0x52a3a3[_0x1e92('0x2b')][_0x1e92('0x30')]);_0x1bb8ff[_0x1e92('0x31')]=qs['filters'](_[_0x1e92('0x32')](_0x52a3a3[_0x1e92('0x2b')],_0x2fb687[_0x1e92('0x29')]));if(_0x52a3a3[_0x1e92('0x2b')][_0x1e92('0x33')]){_0x1bb8ff[_0x1e92('0x31')]=_[_0x1e92('0x34')](_0x1bb8ff[_0x1e92('0x31')],{'$or':_[_0x1e92('0x28')](_0x1bb8ff[_0x1e92('0x2c')],function(_0x16b921){var _0x5dece1={};_0x5dece1[_0x16b921]={'$like':'%'+_0x52a3a3[_0x1e92('0x2b')][_0x1e92('0x33')]+'%'};return _0x5dece1;})});}_0x1bb8ff=_[_0x1e92('0x34')]({},_0x1bb8ff,_0x52a3a3['options']);return _0x1251d7[_0x1e92('0x47')](_0x1bb8ff);}})[_0x1e92('0x1f')](function(_0x3eadb4){if(_0x3eadb4){_0x7dd188=_0x3eadb4[_0x1e92('0x2e')];if(!_0x52a3a3[_0x1e92('0x2b')]['hasOwnProperty'](_0x1e92('0x2f'))){_0x1bb8ff['limit']=qs[_0x1e92('0x18')](_0x52a3a3[_0x1e92('0x2b')]['limit']);_0x1bb8ff[_0x1e92('0x17')]=qs[_0x1e92('0x17')](_0x52a3a3[_0x1e92('0x2b')][_0x1e92('0x17')]);}return _0x1251d7['getDescriptions'](_0x1bb8ff);}})[_0x1e92('0x1f')](function(_0x28bdb1){if(_0x28bdb1){return _0x28bdb1?{'count':_0x7dd188,'rows':_0x28bdb1}:null;}})[_0x1e92('0x1f')](respondWithResult(_0x51b0ab,null))[_0x1e92('0x39')](handleError(_0x51b0ab,null));};exports[_0x1e92('0x48')]=function(_0xb3ec4f,_0x11760b,_0x463cab){var _0x2119f8={};var _0x5411a0={};var _0x7db254;var _0x2a7a7b;return db[_0x1e92('0x24')]['findOne']({'where':{'id':_0xb3ec4f[_0x1e92('0x3a')]['id']}})['then'](handleEntityNotFound(_0x11760b,null))[_0x1e92('0x1f')](function(_0x5b1cba){if(_0x5b1cba){_0x7db254=_0x5b1cba;_0x5411a0[_0x1e92('0x27')]=_[_0x1e92('0x3b')](db[_0x1e92('0x49')][_0x1e92('0x3c')]);_0x5411a0[_0x1e92('0x2b')]=_[_0x1e92('0x3b')](_0xb3ec4f[_0x1e92('0x2b')]);_0x5411a0[_0x1e92('0x29')]=_['intersection'](_0x5411a0['model'],_0x5411a0[_0x1e92('0x2b')]);_0x2119f8[_0x1e92('0x2c')]=_[_0x1e92('0x2a')](_0x5411a0[_0x1e92('0x27')],qs[_0x1e92('0x2d')](_0xb3ec4f[_0x1e92('0x2b')][_0x1e92('0x2d')]));_0x2119f8[_0x1e92('0x2c')]=_0x2119f8[_0x1e92('0x2c')][_0x1e92('0x2e')]?_0x2119f8['attributes']:_0x5411a0[_0x1e92('0x27')];_0x2119f8[_0x1e92('0x44')]=qs['sort'](_0xb3ec4f[_0x1e92('0x2b')][_0x1e92('0x30')]);_0x2119f8['where']=qs[_0x1e92('0x29')](_['pick'](_0xb3ec4f[_0x1e92('0x2b')],_0x5411a0[_0x1e92('0x29')]));if(_0xb3ec4f[_0x1e92('0x2b')]['filter']){_0x2119f8[_0x1e92('0x31')]=_[_0x1e92('0x34')](_0x2119f8[_0x1e92('0x31')],{'$or':_[_0x1e92('0x28')](_0x2119f8['attributes'],function(_0x2108de){var _0x171480={};_0x171480[_0x2108de]={'$like':'%'+_0xb3ec4f['query'][_0x1e92('0x33')]+'%'};return _0x171480;})});}_0x2119f8=_[_0x1e92('0x34')]({},_0x2119f8,_0xb3ec4f[_0x1e92('0x35')]);return _0x7db254[_0x1e92('0x48')](_0x2119f8);}})[_0x1e92('0x1f')](function(_0x1bd5ea){if(_0x1bd5ea){_0x2a7a7b=_0x1bd5ea[_0x1e92('0x2e')];if(!_0xb3ec4f['query'][_0x1e92('0x45')](_0x1e92('0x2f'))){_0x2119f8[_0x1e92('0x18')]=qs[_0x1e92('0x18')](_0xb3ec4f[_0x1e92('0x2b')]['limit']);_0x2119f8[_0x1e92('0x17')]=qs[_0x1e92('0x17')](_0xb3ec4f[_0x1e92('0x2b')][_0x1e92('0x17')]);}return _0x7db254[_0x1e92('0x48')](_0x2119f8);}})['then'](function(_0x4aab65){if(_0x4aab65){return _0x4aab65?{'count':_0x2a7a7b,'rows':_0x4aab65}:null;}})['then'](respondWithResult(_0x11760b,null))[_0x1e92('0x39')](handleError(_0x11760b,null));};exports[_0x1e92('0x4a')]=function(_0x24089a,_0x42b5d5,_0x3a9428){if(_0x24089a[_0x1e92('0x40')]['id']){delete _0x24089a[_0x1e92('0x40')]['id'];}return db[_0x1e92('0x24')][_0x1e92('0x42')]({'where':{'id':_0x24089a[_0x1e92('0x3a')]['id']}})['then'](handleEntityNotFound(_0x42b5d5,null))['then'](function(_0x4550f5){if(_0x4550f5){return _0x4550f5[_0x1e92('0x4a')](_0x24089a['body'][_0x1e92('0x4b')]||[]);}return null;})[_0x1e92('0x1f')](respondWithResult(_0x42b5d5,null))[_0x1e92('0x39')](handleError(_0x42b5d5,null));}; \ No newline at end of file +var _0x5073=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','catch','body','getFields','findOne','ZendeskField','hasOwnProperty','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','squel','crypto','jsforce','desk.js'];(function(_0x531d15,_0x599af5){var _0x271a18=function(_0x31284d){while(--_0x31284d){_0x531d15['push'](_0x531d15['shift']());}};_0x271a18(++_0x599af5);}(_0x5073,0x14d));var _0x3507=function(_0x34ac64,_0x23f246){_0x34ac64=_0x34ac64-0x0;var _0xae8ae9=_0x5073[_0x34ac64];return _0xae8ae9;};'use strict';var emlformat=require(_0x3507('0x0'));var rimraf=require(_0x3507('0x1'));var zipdir=require(_0x3507('0x2'));var jsonpatch=require(_0x3507('0x3'));var rp=require(_0x3507('0x4'));var moment=require(_0x3507('0x5'));var BPromise=require(_0x3507('0x6'));var Mustache=require(_0x3507('0x7'));var util=require(_0x3507('0x8'));var path=require(_0x3507('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3507('0xa'));var _=require('lodash');var squel=require(_0x3507('0xb'));var crypto=require(_0x3507('0xc'));var jsforce=require(_0x3507('0xd'));var deskjs=require(_0x3507('0xe'));var toCsv=require(_0x3507('0xf'));var querystring=require(_0x3507('0x10'));var Papa=require(_0x3507('0x11'));var Redis=require(_0x3507('0x12'));var authService=require(_0x3507('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3507('0x14'));var hardwareService=require(_0x3507('0x15'));var logger=require(_0x3507('0x16'))(_0x3507('0x17'));var utils=require(_0x3507('0x18'));var config=require(_0x3507('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x3507('0x1a'))['db'];function respondWithStatusCode(_0x15b44e,_0x5977b0){_0x5977b0=_0x5977b0||0xcc;return function(_0x158654){if(_0x158654){return _0x15b44e[_0x3507('0x1b')](_0x5977b0);}return _0x15b44e['status'](_0x5977b0)[_0x3507('0x1c')]();};}function respondWithResult(_0x145320,_0x3cdabb){_0x3cdabb=_0x3cdabb||0xc8;return function(_0x451309){if(_0x451309){return _0x145320['status'](_0x3cdabb)[_0x3507('0x1d')](_0x451309);}};}function respondWithFilteredResult(_0x3ec2d6,_0x1ed623){return function(_0x317e77){if(_0x317e77){var _0x4aec88=typeof _0x1ed623[_0x3507('0x1e')]===_0x3507('0x1f')&&typeof _0x1ed623[_0x3507('0x20')]===_0x3507('0x1f');var _0x43f5f8=_0x317e77[_0x3507('0x21')];var _0x2480af=_0x4aec88?0x0:_0x1ed623['offset'];var _0x42d889=_0x4aec88?_0x317e77[_0x3507('0x21')]:_0x1ed623[_0x3507('0x1e')]+_0x1ed623[_0x3507('0x20')];var _0x446177;if(_0x42d889>=_0x43f5f8){_0x42d889=_0x43f5f8;_0x446177=0xc8;}else{_0x446177=0xce;}_0x3ec2d6[_0x3507('0x22')](_0x446177);return _0x3ec2d6['set'](_0x3507('0x23'),_0x2480af+'-'+_0x42d889+'/'+_0x43f5f8)[_0x3507('0x1d')](_0x317e77);}return null;};}function patchUpdates(_0x46fc12){return function(_0x1c2645){try{jsonpatch[_0x3507('0x24')](_0x1c2645,_0x46fc12,!![]);}catch(_0x528e68){return BPromise[_0x3507('0x25')](_0x528e68);}return _0x1c2645[_0x3507('0x26')]();};}function saveUpdates(_0x206ebd,_0x456986){return function(_0x2f0f89){if(_0x2f0f89){return _0x2f0f89[_0x3507('0x27')](_0x206ebd)[_0x3507('0x28')](function(_0x52d9d2){return _0x52d9d2;});}return null;};}function removeEntity(_0x27775b,_0x5ff96){return function(_0x25ebf8){if(_0x25ebf8){return _0x25ebf8[_0x3507('0x29')]()['then'](function(){_0x27775b[_0x3507('0x22')](0xcc)[_0x3507('0x1c')]();});}};}function handleEntityNotFound(_0x536c21,_0x71e242){return function(_0x19eaf9){if(!_0x19eaf9){_0x536c21[_0x3507('0x1b')](0x194);}return _0x19eaf9;};}function handleError(_0x283d56,_0x1ed0d3){_0x1ed0d3=_0x1ed0d3||0x1f4;return function(_0x14502f){logger['error'](_0x14502f[_0x3507('0x2a')]);if(_0x14502f[_0x3507('0x2b')]){delete _0x14502f[_0x3507('0x2b')];}_0x283d56[_0x3507('0x22')](_0x1ed0d3)[_0x3507('0x2c')](_0x14502f);};}exports['index']=function(_0x2b07ac,_0x53c809){var _0x457b05={},_0x4d0e7d={},_0x509129={'count':0x0,'rows':[]};var _0x3c1e10=_[_0x3507('0x2d')](db[_0x3507('0x2e')][_0x3507('0x2f')],function(_0x37a8f3){return{'name':_0x37a8f3[_0x3507('0x30')],'type':_0x37a8f3[_0x3507('0x31')][_0x3507('0x32')]};});_0x4d0e7d[_0x3507('0x33')]=_[_0x3507('0x2d')](_0x3c1e10,_0x3507('0x2b'));_0x4d0e7d['query']=_[_0x3507('0x34')](_0x2b07ac[_0x3507('0x35')]);_0x4d0e7d[_0x3507('0x36')]=_[_0x3507('0x37')](_0x4d0e7d[_0x3507('0x33')],_0x4d0e7d['query']);_0x457b05[_0x3507('0x38')]=_[_0x3507('0x37')](_0x4d0e7d['model'],qs[_0x3507('0x39')](_0x2b07ac[_0x3507('0x35')][_0x3507('0x39')]));_0x457b05['attributes']=_0x457b05[_0x3507('0x38')][_0x3507('0x3a')]?_0x457b05[_0x3507('0x38')]:_0x4d0e7d['model'];if(!_0x2b07ac[_0x3507('0x35')]['hasOwnProperty']('nolimit')){_0x457b05[_0x3507('0x20')]=qs[_0x3507('0x20')](_0x2b07ac['query'][_0x3507('0x20')]);_0x457b05['offset']=qs[_0x3507('0x1e')](_0x2b07ac['query'][_0x3507('0x1e')]);}_0x457b05[_0x3507('0x3b')]=qs['sort'](_0x2b07ac[_0x3507('0x35')][_0x3507('0x3c')]);_0x457b05[_0x3507('0x3d')]=qs[_0x3507('0x36')](_[_0x3507('0x3e')](_0x2b07ac[_0x3507('0x35')],_0x4d0e7d[_0x3507('0x36')]),_0x3c1e10);if(_0x2b07ac['query'][_0x3507('0x3f')]){_0x457b05[_0x3507('0x3d')]=_[_0x3507('0x40')](_0x457b05[_0x3507('0x3d')],{'$or':_[_0x3507('0x2d')](_0x3c1e10,function(_0x3fbbe3){if(_0x3fbbe3[_0x3507('0x31')]!==_0x3507('0x41')){var _0x3f5683={};_0x3f5683[_0x3fbbe3[_0x3507('0x2b')]]={'$like':'%'+_0x2b07ac['query'][_0x3507('0x3f')]+'%'};return _0x3f5683;}})});}_0x457b05=_[_0x3507('0x40')]({},_0x457b05,_0x2b07ac[_0x3507('0x42')]);var _0x177732={'where':_0x457b05[_0x3507('0x3d')]};return db['ZendeskConfiguration']['count'](_0x177732)['then'](function(_0x4d2c58){_0x509129[_0x3507('0x21')]=_0x4d2c58;if(_0x2b07ac[_0x3507('0x35')]['includeAll']){_0x457b05[_0x3507('0x43')]=[{'all':!![]}];}return db[_0x3507('0x2e')][_0x3507('0x44')](_0x457b05);})[_0x3507('0x28')](function(_0x386efc){_0x509129[_0x3507('0x45')]=_0x386efc;return _0x509129;})[_0x3507('0x28')](respondWithFilteredResult(_0x53c809,_0x457b05))['catch'](handleError(_0x53c809,null));};exports[_0x3507('0x46')]=function(_0x31d712,_0x53b472){var _0x1d0ac3={'raw':![],'where':{'id':_0x31d712[_0x3507('0x47')]['id']}},_0x3db1b5={};_0x3db1b5[_0x3507('0x33')]=_['keys'](db['ZendeskConfiguration']['rawAttributes']);_0x3db1b5[_0x3507('0x35')]=_[_0x3507('0x34')](_0x31d712[_0x3507('0x35')]);_0x3db1b5[_0x3507('0x36')]=_[_0x3507('0x37')](_0x3db1b5['model'],_0x3db1b5[_0x3507('0x35')]);_0x1d0ac3[_0x3507('0x38')]=_[_0x3507('0x37')](_0x3db1b5['model'],qs[_0x3507('0x39')](_0x31d712[_0x3507('0x35')][_0x3507('0x39')]));_0x1d0ac3[_0x3507('0x38')]=_0x1d0ac3['attributes'][_0x3507('0x3a')]?_0x1d0ac3['attributes']:_0x3db1b5['model'];if(_0x31d712['query'][_0x3507('0x48')]){_0x1d0ac3[_0x3507('0x43')]=[{'all':!![]}];}_0x1d0ac3=_['merge']({},_0x1d0ac3,_0x31d712[_0x3507('0x42')]);return db[_0x3507('0x2e')][_0x3507('0x49')](_0x1d0ac3)['then'](handleEntityNotFound(_0x53b472,null))[_0x3507('0x28')](respondWithResult(_0x53b472,null))[_0x3507('0x4a')](handleError(_0x53b472,null));};exports['create']=function(_0x1fc4ee,_0x681a35){return db[_0x3507('0x2e')]['create'](_0x1fc4ee['body'],{})[_0x3507('0x28')](respondWithResult(_0x681a35,0xc9))['catch'](handleError(_0x681a35,null));};exports[_0x3507('0x27')]=function(_0x32d571,_0x10eada){if(_0x32d571[_0x3507('0x4b')]['id']){delete _0x32d571['body']['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x32d571[_0x3507('0x47')]['id']}})[_0x3507('0x28')](handleEntityNotFound(_0x10eada,null))[_0x3507('0x28')](saveUpdates(_0x32d571[_0x3507('0x4b')],null))[_0x3507('0x28')](respondWithResult(_0x10eada,null))['catch'](handleError(_0x10eada,null));};exports['destroy']=function(_0x3dda00,_0x1e468f){return db[_0x3507('0x2e')][_0x3507('0x49')]({'where':{'id':_0x3dda00[_0x3507('0x47')]['id']}})['then'](handleEntityNotFound(_0x1e468f,null))[_0x3507('0x28')](removeEntity(_0x1e468f,null))[_0x3507('0x4a')](handleError(_0x1e468f,null));};exports[_0x3507('0x4c')]=function(_0x3cbbb1,_0x4ee59f,_0x5e842e){var _0x516eb8={};var _0x5f1412={};var _0x4b33ab;var _0x2a6c34;return db['ZendeskConfiguration'][_0x3507('0x4d')]({'where':{'id':_0x3cbbb1[_0x3507('0x47')]['id']}})[_0x3507('0x28')](handleEntityNotFound(_0x4ee59f,null))[_0x3507('0x28')](function(_0x59b6f7){if(_0x59b6f7){_0x4b33ab=_0x59b6f7;_0x5f1412[_0x3507('0x33')]=_[_0x3507('0x34')](db[_0x3507('0x4e')][_0x3507('0x2f')]);_0x5f1412['query']=_[_0x3507('0x34')](_0x3cbbb1[_0x3507('0x35')]);_0x5f1412[_0x3507('0x36')]=_[_0x3507('0x37')](_0x5f1412['model'],_0x5f1412[_0x3507('0x35')]);_0x516eb8[_0x3507('0x38')]=_[_0x3507('0x37')](_0x5f1412[_0x3507('0x33')],qs[_0x3507('0x39')](_0x3cbbb1['query'][_0x3507('0x39')]));_0x516eb8[_0x3507('0x38')]=_0x516eb8['attributes'][_0x3507('0x3a')]?_0x516eb8['attributes']:_0x5f1412[_0x3507('0x33')];_0x516eb8[_0x3507('0x3b')]=qs[_0x3507('0x3c')](_0x3cbbb1[_0x3507('0x35')][_0x3507('0x3c')]);_0x516eb8[_0x3507('0x3d')]=qs[_0x3507('0x36')](_[_0x3507('0x3e')](_0x3cbbb1[_0x3507('0x35')],_0x5f1412['filters']));if(_0x3cbbb1[_0x3507('0x35')][_0x3507('0x3f')]){_0x516eb8[_0x3507('0x3d')]=_[_0x3507('0x40')](_0x516eb8[_0x3507('0x3d')],{'$or':_['map'](_0x516eb8[_0x3507('0x38')],function(_0x328667){var _0x3c263d={};_0x3c263d[_0x328667]={'$like':'%'+_0x3cbbb1[_0x3507('0x35')]['filter']+'%'};return _0x3c263d;})});}_0x516eb8=_[_0x3507('0x40')]({},_0x516eb8,_0x3cbbb1['options']);return _0x4b33ab[_0x3507('0x4c')](_0x516eb8);}})[_0x3507('0x28')](function(_0x4b0de2){if(_0x4b0de2){_0x2a6c34=_0x4b0de2[_0x3507('0x3a')];if(!_0x3cbbb1[_0x3507('0x35')][_0x3507('0x4f')](_0x3507('0x50'))){_0x516eb8[_0x3507('0x20')]=qs[_0x3507('0x20')](_0x3cbbb1[_0x3507('0x35')][_0x3507('0x20')]);_0x516eb8[_0x3507('0x1e')]=qs[_0x3507('0x1e')](_0x3cbbb1['query'][_0x3507('0x1e')]);}return _0x4b33ab[_0x3507('0x4c')](_0x516eb8);}})[_0x3507('0x28')](function(_0x510bd3){if(_0x510bd3){return _0x510bd3?{'count':_0x2a6c34,'rows':_0x510bd3}:null;}})['then'](respondWithResult(_0x4ee59f,null))[_0x3507('0x4a')](handleError(_0x4ee59f,null));};exports[_0x3507('0x51')]=function(_0x5af02b,_0x3f9bb9,_0x23a060){var _0x43a27f={};var _0x3269f1={};var _0x42d767;var _0x5671e1;return db['ZendeskConfiguration'][_0x3507('0x4d')]({'where':{'id':_0x5af02b[_0x3507('0x47')]['id']}})[_0x3507('0x28')](handleEntityNotFound(_0x3f9bb9,null))[_0x3507('0x28')](function(_0xc808bf){if(_0xc808bf){_0x42d767=_0xc808bf;_0x3269f1[_0x3507('0x33')]=_[_0x3507('0x34')](db[_0x3507('0x4e')][_0x3507('0x2f')]);_0x3269f1[_0x3507('0x35')]=_[_0x3507('0x34')](_0x5af02b[_0x3507('0x35')]);_0x3269f1[_0x3507('0x36')]=_['intersection'](_0x3269f1[_0x3507('0x33')],_0x3269f1['query']);_0x43a27f[_0x3507('0x38')]=_[_0x3507('0x37')](_0x3269f1['model'],qs[_0x3507('0x39')](_0x5af02b[_0x3507('0x35')][_0x3507('0x39')]));_0x43a27f['attributes']=_0x43a27f['attributes'][_0x3507('0x3a')]?_0x43a27f['attributes']:_0x3269f1['model'];_0x43a27f[_0x3507('0x3b')]=qs[_0x3507('0x3c')](_0x5af02b[_0x3507('0x35')]['sort']);_0x43a27f['where']=qs[_0x3507('0x36')](_[_0x3507('0x3e')](_0x5af02b['query'],_0x3269f1[_0x3507('0x36')]));if(_0x5af02b[_0x3507('0x35')][_0x3507('0x3f')]){_0x43a27f['where']=_['merge'](_0x43a27f[_0x3507('0x3d')],{'$or':_[_0x3507('0x2d')](_0x43a27f['attributes'],function(_0xee4559){var _0x57e1e9={};_0x57e1e9[_0xee4559]={'$like':'%'+_0x5af02b[_0x3507('0x35')][_0x3507('0x3f')]+'%'};return _0x57e1e9;})});}_0x43a27f=_[_0x3507('0x40')]({},_0x43a27f,_0x5af02b[_0x3507('0x42')]);return _0x42d767['getSubjects'](_0x43a27f);}})[_0x3507('0x28')](function(_0x29e415){if(_0x29e415){_0x5671e1=_0x29e415['length'];if(!_0x5af02b[_0x3507('0x35')][_0x3507('0x4f')](_0x3507('0x50'))){_0x43a27f[_0x3507('0x20')]=qs[_0x3507('0x20')](_0x5af02b['query']['limit']);_0x43a27f[_0x3507('0x1e')]=qs['offset'](_0x5af02b[_0x3507('0x35')][_0x3507('0x1e')]);}return _0x42d767[_0x3507('0x51')](_0x43a27f);}})[_0x3507('0x28')](function(_0x1a07ff){if(_0x1a07ff){return _0x1a07ff?{'count':_0x5671e1,'rows':_0x1a07ff}:null;}})[_0x3507('0x28')](respondWithResult(_0x3f9bb9,null))[_0x3507('0x4a')](handleError(_0x3f9bb9,null));};exports[_0x3507('0x52')]=function(_0x45e185,_0x223b8d,_0x1b6c6c){var _0x3aa8c0={};var _0x3575bf={};var _0x5518a6;var _0x55cebc;return db[_0x3507('0x2e')]['findOne']({'where':{'id':_0x45e185[_0x3507('0x47')]['id']}})[_0x3507('0x28')](handleEntityNotFound(_0x223b8d,null))[_0x3507('0x28')](function(_0x360eef){if(_0x360eef){_0x5518a6=_0x360eef;_0x3575bf['model']=_[_0x3507('0x34')](db[_0x3507('0x4e')][_0x3507('0x2f')]);_0x3575bf['query']=_['keys'](_0x45e185[_0x3507('0x35')]);_0x3575bf['filters']=_[_0x3507('0x37')](_0x3575bf[_0x3507('0x33')],_0x3575bf['query']);_0x3aa8c0[_0x3507('0x38')]=_[_0x3507('0x37')](_0x3575bf['model'],qs[_0x3507('0x39')](_0x45e185[_0x3507('0x35')]['fields']));_0x3aa8c0[_0x3507('0x38')]=_0x3aa8c0[_0x3507('0x38')][_0x3507('0x3a')]?_0x3aa8c0[_0x3507('0x38')]:_0x3575bf[_0x3507('0x33')];_0x3aa8c0[_0x3507('0x3b')]=qs[_0x3507('0x3c')](_0x45e185[_0x3507('0x35')][_0x3507('0x3c')]);_0x3aa8c0[_0x3507('0x3d')]=qs[_0x3507('0x36')](_[_0x3507('0x3e')](_0x45e185[_0x3507('0x35')],_0x3575bf[_0x3507('0x36')]));if(_0x45e185[_0x3507('0x35')][_0x3507('0x3f')]){_0x3aa8c0[_0x3507('0x3d')]=_[_0x3507('0x40')](_0x3aa8c0[_0x3507('0x3d')],{'$or':_[_0x3507('0x2d')](_0x3aa8c0['attributes'],function(_0x379075){var _0x3677b8={};_0x3677b8[_0x379075]={'$like':'%'+_0x45e185[_0x3507('0x35')][_0x3507('0x3f')]+'%'};return _0x3677b8;})});}_0x3aa8c0=_[_0x3507('0x40')]({},_0x3aa8c0,_0x45e185['options']);return _0x5518a6['getDescriptions'](_0x3aa8c0);}})['then'](function(_0x54d89c){if(_0x54d89c){_0x55cebc=_0x54d89c[_0x3507('0x3a')];if(!_0x45e185[_0x3507('0x35')][_0x3507('0x4f')](_0x3507('0x50'))){_0x3aa8c0[_0x3507('0x20')]=qs[_0x3507('0x20')](_0x45e185[_0x3507('0x35')][_0x3507('0x20')]);_0x3aa8c0[_0x3507('0x1e')]=qs[_0x3507('0x1e')](_0x45e185[_0x3507('0x35')]['offset']);}return _0x5518a6[_0x3507('0x52')](_0x3aa8c0);}})[_0x3507('0x28')](function(_0x516a22){if(_0x516a22){return _0x516a22?{'count':_0x55cebc,'rows':_0x516a22}:null;}})[_0x3507('0x28')](respondWithResult(_0x223b8d,null))[_0x3507('0x4a')](handleError(_0x223b8d,null));};exports[_0x3507('0x53')]=function(_0x3f5adb,_0x9f420,_0x1e5046){var _0x36bcad={};var _0x39b55c={};var _0x5eb562;var _0xc9ac42;return db[_0x3507('0x2e')][_0x3507('0x4d')]({'where':{'id':_0x3f5adb['params']['id']}})[_0x3507('0x28')](handleEntityNotFound(_0x9f420,null))[_0x3507('0x28')](function(_0x1aca91){if(_0x1aca91){_0x5eb562=_0x1aca91;_0x39b55c[_0x3507('0x33')]=_['keys'](db[_0x3507('0x54')]['rawAttributes']);_0x39b55c[_0x3507('0x35')]=_['keys'](_0x3f5adb['query']);_0x39b55c['filters']=_[_0x3507('0x37')](_0x39b55c['model'],_0x39b55c[_0x3507('0x35')]);_0x36bcad[_0x3507('0x38')]=_['intersection'](_0x39b55c['model'],qs[_0x3507('0x39')](_0x3f5adb[_0x3507('0x35')][_0x3507('0x39')]));_0x36bcad[_0x3507('0x38')]=_0x36bcad[_0x3507('0x38')]['length']?_0x36bcad[_0x3507('0x38')]:_0x39b55c[_0x3507('0x33')];_0x36bcad[_0x3507('0x3b')]=qs['sort'](_0x3f5adb[_0x3507('0x35')]['sort']);_0x36bcad['where']=qs['filters'](_[_0x3507('0x3e')](_0x3f5adb[_0x3507('0x35')],_0x39b55c[_0x3507('0x36')]));if(_0x3f5adb[_0x3507('0x35')][_0x3507('0x3f')]){_0x36bcad['where']=_[_0x3507('0x40')](_0x36bcad[_0x3507('0x3d')],{'$or':_['map'](_0x36bcad['attributes'],function(_0x126959){var _0x58c488={};_0x58c488[_0x126959]={'$like':'%'+_0x3f5adb[_0x3507('0x35')][_0x3507('0x3f')]+'%'};return _0x58c488;})});}_0x36bcad=_[_0x3507('0x40')]({},_0x36bcad,_0x3f5adb[_0x3507('0x42')]);return _0x5eb562[_0x3507('0x53')](_0x36bcad);}})[_0x3507('0x28')](function(_0x27538e){if(_0x27538e){_0xc9ac42=_0x27538e['length'];if(!_0x3f5adb[_0x3507('0x35')][_0x3507('0x4f')](_0x3507('0x50'))){_0x36bcad['limit']=qs['limit'](_0x3f5adb['query']['limit']);_0x36bcad[_0x3507('0x1e')]=qs[_0x3507('0x1e')](_0x3f5adb[_0x3507('0x35')][_0x3507('0x1e')]);}return _0x5eb562[_0x3507('0x53')](_0x36bcad);}})[_0x3507('0x28')](function(_0x32d165){if(_0x32d165){return _0x32d165?{'count':_0xc9ac42,'rows':_0x32d165}:null;}})[_0x3507('0x28')](respondWithResult(_0x9f420,null))[_0x3507('0x4a')](handleError(_0x9f420,null));};exports['setTags']=function(_0x4f5289,_0x285f19,_0x1f27ef){if(_0x4f5289[_0x3507('0x4b')]['id']){delete _0x4f5289[_0x3507('0x4b')]['id'];}return db[_0x3507('0x2e')][_0x3507('0x4d')]({'where':{'id':_0x4f5289[_0x3507('0x47')]['id']}})[_0x3507('0x28')](handleEntityNotFound(_0x285f19,null))[_0x3507('0x28')](function(_0x2ad98e){if(_0x2ad98e){return _0x2ad98e[_0x3507('0x55')](_0x4f5289[_0x3507('0x4b')][_0x3507('0x56')]||[]);}return null;})[_0x3507('0x28')](respondWithResult(_0x285f19,null))[_0x3507('0x4a')](handleError(_0x285f19,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 32ae642..aeede31 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 _0x0102=['api','moment','./intZendeskConfiguration.attributes','exports','ZendeskConfiguration','util','../../config/logger'];(function(_0x3181cc,_0x28447f){var _0x547a4a=function(_0x3ede80){while(--_0x3ede80){_0x3181cc['push'](_0x3181cc['shift']());}};_0x547a4a(++_0x28447f);}(_0x0102,0x186));var _0x2010=function(_0x3efc92,_0x28a1f4){_0x3efc92=_0x3efc92-0x0;var _0x465bfb=_0x0102[_0x3efc92];return _0x465bfb;};'use strict';var _=require('lodash');var util=require(_0x2010('0x0'));var logger=require(_0x2010('0x1'))(_0x2010('0x2'));var moment=require(_0x2010('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2010('0x4'));module[_0x2010('0x5')]=function(_0x130725,_0x304264){return _0x130725['define'](_0x2010('0x6'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3de3=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./intZendeskConfiguration.attributes','exports','ZendeskConfiguration','int_zendesk_configurations'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x3de3,0x1ce));var _0x33de=function(_0x56a9d1,_0xaed741){_0x56a9d1=_0x56a9d1-0x0;var _0x329d2a=_0x3de3[_0x56a9d1];return _0x329d2a;};'use strict';var _=require(_0x33de('0x0'));var util=require('util');var logger=require(_0x33de('0x1'))(_0x33de('0x2'));var moment=require('moment');var BPromise=require(_0x33de('0x3'));var rp=require(_0x33de('0x4'));var fs=require('fs');var path=require(_0x33de('0x5'));var rimraf=require(_0x33de('0x6'));var config=require('../../config/environment');var attributes=require(_0x33de('0x7'));module[_0x33de('0x8')]=function(_0x558f98,_0x142716){return _0x558f98['define'](_0x33de('0x9'),attributes,{'tableName':_0x33de('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index b7e7fff..7b453ff 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 _0x6d43=['code','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x225838,_0x29b914){var _0x1da96b=function(_0x3e54b3){while(--_0x3e54b3){_0x225838['push'](_0x225838['shift']());}};_0x1da96b(++_0x29b914);}(_0x6d43,0x1a3));var _0x36d4=function(_0x6a0d31,_0xf59fef){_0x6a0d31=_0x6a0d31-0x0;var _0x2e99a1=_0x6d43[_0x6a0d31];return _0x2e99a1;};'use strict';var _=require(_0x36d4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x36d4('0x1'));var rs=require(_0x36d4('0x2'));var fs=require('fs');var Redis=require(_0x36d4('0x3'));var db=require(_0x36d4('0x4'))['db'];var utils=require(_0x36d4('0x5'));var logger=require(_0x36d4('0x6'))('rpc');var config=require(_0x36d4('0x7'));var jayson=require(_0x36d4('0x8'));var client=jayson[_0x36d4('0x9')][_0x36d4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x68df19,_0x5b728c,_0x1a8a1f){return new BPromise(function(_0x14799b,_0x41e7c3){return client[_0x36d4('0xb')](_0x68df19,_0x1a8a1f)['then'](function(_0x332ee2){logger['info'](_0x36d4('0xc'),_0x5b728c,_0x36d4('0xd'));logger[_0x36d4('0xe')](_0x36d4('0xf'),_0x5b728c,'request\x20sent',JSON[_0x36d4('0x10')](_0x332ee2));if(_0x332ee2[_0x36d4('0x11')]){if(_0x332ee2['error'][_0x36d4('0x12')]===0x1f4){logger['error'](_0x36d4('0xc'),_0x5b728c,_0x332ee2[_0x36d4('0x11')][_0x36d4('0x13')]);return _0x41e7c3(_0x332ee2[_0x36d4('0x11')]['message']);}logger[_0x36d4('0x11')](_0x36d4('0xc'),_0x5b728c,_0x332ee2[_0x36d4('0x11')][_0x36d4('0x13')]);return _0x14799b(_0x332ee2['error'][_0x36d4('0x13')]);}else{logger[_0x36d4('0x14')]('ZendeskConfiguration,\x20%s,\x20%s',_0x5b728c,'request\x20sent');_0x14799b(_0x332ee2[_0x36d4('0x15')]['message']);}})[_0x36d4('0x16')](function(_0x595133){logger[_0x36d4('0x11')](_0x36d4('0xc'),_0x5b728c,_0x595133);_0x41e7c3(_0x595133);});});} \ No newline at end of file +var _0x49cd=['result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0xd3c204,_0xe1398c){var _0x128998=function(_0x281ec2){while(--_0x281ec2){_0xd3c204['push'](_0xd3c204['shift']());}};_0x128998(++_0xe1398c);}(_0x49cd,0x1a4));var _0xd49c=function(_0x25c326,_0x250137){_0x25c326=_0x25c326-0x0;var _0x762452=_0x49cd[_0x25c326];return _0x762452;};'use strict';var _=require(_0xd49c('0x0'));var util=require(_0xd49c('0x1'));var moment=require(_0xd49c('0x2'));var BPromise=require(_0xd49c('0x3'));var rs=require(_0xd49c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd49c('0x5'))['db'];var utils=require(_0xd49c('0x6'));var logger=require(_0xd49c('0x7'))(_0xd49c('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd49c('0x9')][_0xd49c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b5b24,_0x486218,_0x1c4dcf){return new BPromise(function(_0x3391db,_0x3c71b3){return client[_0xd49c('0xb')](_0x5b5b24,_0x1c4dcf)['then'](function(_0x3369a2){logger[_0xd49c('0xc')](_0xd49c('0xd'),_0x486218,_0xd49c('0xe'));logger[_0xd49c('0xf')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x486218,_0xd49c('0xe'),JSON[_0xd49c('0x10')](_0x3369a2));if(_0x3369a2[_0xd49c('0x11')]){if(_0x3369a2[_0xd49c('0x11')][_0xd49c('0x12')]===0x1f4){logger[_0xd49c('0x11')](_0xd49c('0xd'),_0x486218,_0x3369a2[_0xd49c('0x11')][_0xd49c('0x13')]);return _0x3c71b3(_0x3369a2[_0xd49c('0x11')][_0xd49c('0x13')]);}logger[_0xd49c('0x11')](_0xd49c('0xd'),_0x486218,_0x3369a2['error'][_0xd49c('0x13')]);return _0x3391db(_0x3369a2['error']['message']);}else{logger[_0xd49c('0xc')](_0xd49c('0xd'),_0x486218,_0xd49c('0xe'));_0x3391db(_0x3369a2[_0xd49c('0x14')][_0xd49c('0x13')]);}})[_0xd49c('0x15')](function(_0x58ed5c){logger[_0xd49c('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x486218,_0x58ed5c);_0x3c71b3(_0x58ed5c);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 8957c60..2b41d74 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 _0x1298=['update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','create','put'];(function(_0x53d7fb,_0xc39581){var _0x2e5203=function(_0x175128){while(--_0x175128){_0x53d7fb['push'](_0x53d7fb['shift']());}};_0x2e5203(++_0xc39581);}(_0x1298,0x18f));var _0x8129=function(_0x2d7fca,_0x151dca){_0x2d7fca=_0x2d7fca-0x0;var _0xdb8e8e=_0x1298[_0x2d7fca];return _0xdb8e8e;};'use strict';var multer=require('multer');var util=require(_0x8129('0x0'));var path=require(_0x8129('0x1'));var timeout=require(_0x8129('0x2'));var express=require('express');var router=express[_0x8129('0x3')]();var fs_extra=require(_0x8129('0x4'));var auth=require(_0x8129('0x5'));var interaction=require(_0x8129('0x6'));var config=require(_0x8129('0x7'));var controller=require('./intZendeskField.controller');router[_0x8129('0x8')]('/',auth['isAuthenticated'](),controller[_0x8129('0x9')]);router[_0x8129('0x8')](_0x8129('0xa'),auth[_0x8129('0xb')](),controller[_0x8129('0xc')]);router['post']('/',auth[_0x8129('0xb')](),controller[_0x8129('0xd')]);router[_0x8129('0xe')](_0x8129('0xa'),auth['isAuthenticated'](),controller[_0x8129('0xf')]);router['delete'](_0x8129('0xa'),auth[_0x8129('0xb')](),controller[_0x8129('0x10')]);module[_0x8129('0x11')]=router; \ No newline at end of file +var _0x665b=['delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','isAuthenticated','index','get','post','create','put','/:id','update'];(function(_0x9a3d47,_0x1953a0){var _0xf60b78=function(_0x31575d){while(--_0x31575d){_0x9a3d47['push'](_0x9a3d47['shift']());}};_0xf60b78(++_0x1953a0);}(_0x665b,0x168));var _0xb665=function(_0x183c34,_0x3ddc05){_0x183c34=_0x183c34-0x0;var _0x58e4a7=_0x665b[_0x183c34];return _0x58e4a7;};'use strict';var multer=require(_0xb665('0x0'));var util=require(_0xb665('0x1'));var path=require(_0xb665('0x2'));var timeout=require(_0xb665('0x3'));var express=require('express');var router=express[_0xb665('0x4')]();var fs_extra=require(_0xb665('0x5'));var auth=require(_0xb665('0x6'));var interaction=require(_0xb665('0x7'));var config=require(_0xb665('0x8'));var controller=require(_0xb665('0x9'));router['get']('/',auth[_0xb665('0xa')](),controller[_0xb665('0xb')]);router[_0xb665('0xc')]('/:id',auth[_0xb665('0xa')](),controller['show']);router[_0xb665('0xd')]('/',auth[_0xb665('0xa')](),controller[_0xb665('0xe')]);router[_0xb665('0xf')](_0xb665('0x10'),auth['isAuthenticated'](),controller[_0xb665('0x11')]);router[_0xb665('0x12')](_0xb665('0x10'),auth[_0xb665('0xa')](),controller[_0xb665('0x13')]);module[_0xb665('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 8940048..c1438b8 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 _0x5b05=['BOOLEAN','exports','ENUM','variable','customVariable','picklist','STRING','string'];(function(_0x1d9ec8,_0x3c431d){var _0x461539=function(_0x2391bf){while(--_0x2391bf){_0x1d9ec8['push'](_0x1d9ec8['shift']());}};_0x461539(++_0x3c431d);}(_0x5b05,0x191));var _0x55b0=function(_0x26edda,_0x5b997a){_0x26edda=_0x26edda-0x0;var _0x1c49a8=_0x5b05[_0x26edda];return _0x1c49a8;};'use strict';var Sequelize=require('sequelize');module[_0x55b0('0x0')]={'type':{'type':Sequelize[_0x55b0('0x1')]('string',_0x55b0('0x2'),_0x55b0('0x3'),'keyValue',_0x55b0('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x55b0('0x5')]},'key':{'type':Sequelize[_0x55b0('0x5')]},'keyType':{'type':Sequelize[_0x55b0('0x1')](_0x55b0('0x6'),_0x55b0('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x55b0('0x5')]},'idField':{'type':Sequelize[_0x55b0('0x5')]},'nameField':{'type':Sequelize[_0x55b0('0x5')]},'customField':{'type':Sequelize[_0x55b0('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x55b0('0x5')]}}; \ No newline at end of file +var _0xc309=['STRING','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xc309,0xad));var _0x9c30=function(_0x45ae40,_0x459ae5){_0x45ae40=_0x45ae40-0x0;var _0x1c53db=_0xc309[_0x45ae40];return _0x1c53db;};'use strict';var Sequelize=require(_0x9c30('0x0'));module[_0x9c30('0x1')]={'type':{'type':Sequelize['ENUM'](_0x9c30('0x2'),_0x9c30('0x3'),_0x9c30('0x4'),_0x9c30('0x5'),_0x9c30('0x6')),'defaultValue':_0x9c30('0x2')},'content':{'type':Sequelize[_0x9c30('0x7')]},'key':{'type':Sequelize[_0x9c30('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x9c30('0x2'),_0x9c30('0x3'),_0x9c30('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9c30('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9c30('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9c30('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 6e2c4b6..14cbab6 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 _0xb9fd=['length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','send','index','map','ZendeskField','fieldName','type','key','model','name','query','keys','intersection','fields','attributes'];(function(_0x2e1907,_0x229a70){var _0x401555=function(_0x487ac2){while(--_0x487ac2){_0x2e1907['push'](_0x2e1907['shift']());}};_0x401555(++_0x229a70);}(_0xb9fd,0x149));var _0xdb9f=function(_0x305b20,_0x5e57e9){_0x305b20=_0x305b20-0x0;var _0x26d64a=_0xb9fd[_0x305b20];return _0x26d64a;};'use strict';var emlformat=require(_0xdb9f('0x0'));var rimraf=require(_0xdb9f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdb9f('0x2'));var rp=require(_0xdb9f('0x3'));var moment=require(_0xdb9f('0x4'));var BPromise=require(_0xdb9f('0x5'));var Mustache=require(_0xdb9f('0x6'));var util=require(_0xdb9f('0x7'));var path=require(_0xdb9f('0x8'));var sox=require(_0xdb9f('0x9'));var csv=require(_0xdb9f('0xa'));var ejs=require(_0xdb9f('0xb'));var fs=require('fs');var fs_extra=require(_0xdb9f('0xc'));var _=require(_0xdb9f('0xd'));var squel=require(_0xdb9f('0xe'));var crypto=require('crypto');var jsforce=require(_0xdb9f('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdb9f('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xdb9f('0x11'));var as=require(_0xdb9f('0x12'));var hardwareService=require(_0xdb9f('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xdb9f('0x14'));var config=require(_0xdb9f('0x15'));var licenseUtil=require(_0xdb9f('0x16'));var db=require(_0xdb9f('0x17'))['db'];function respondWithStatusCode(_0x1ad376,_0x13b999){_0x13b999=_0x13b999||0xcc;return function(_0x52cbd4){if(_0x52cbd4){return _0x1ad376[_0xdb9f('0x18')](_0x13b999);}return _0x1ad376[_0xdb9f('0x19')](_0x13b999)[_0xdb9f('0x1a')]();};}function respondWithResult(_0x5023ca,_0xcb2708){_0xcb2708=_0xcb2708||0xc8;return function(_0x329e80){if(_0x329e80){return _0x5023ca[_0xdb9f('0x19')](_0xcb2708)[_0xdb9f('0x1b')](_0x329e80);}};}function respondWithFilteredResult(_0x4fe3ca,_0x1c90fe){return function(_0x41bd58){if(_0x41bd58){var _0x138822=typeof _0x1c90fe[_0xdb9f('0x1c')]===_0xdb9f('0x1d')&&typeof _0x1c90fe['limit']===_0xdb9f('0x1d');var _0x163b59=_0x41bd58['count'];var _0x1efeb9=_0x138822?0x0:_0x1c90fe[_0xdb9f('0x1c')];var _0x4fb035=_0x138822?_0x41bd58[_0xdb9f('0x1e')]:_0x1c90fe['offset']+_0x1c90fe[_0xdb9f('0x1f')];var _0x54fcd2;if(_0x4fb035>=_0x163b59){_0x4fb035=_0x163b59;_0x54fcd2=0xc8;}else{_0x54fcd2=0xce;}_0x4fe3ca[_0xdb9f('0x19')](_0x54fcd2);return _0x4fe3ca[_0xdb9f('0x20')](_0xdb9f('0x21'),_0x1efeb9+'-'+_0x4fb035+'/'+_0x163b59)['json'](_0x41bd58);}return null;};}function patchUpdates(_0x51f1f5){return function(_0x3a03d8){try{jsonpatch[_0xdb9f('0x22')](_0x3a03d8,_0x51f1f5,!![]);}catch(_0x504a4e){return BPromise[_0xdb9f('0x23')](_0x504a4e);}return _0x3a03d8[_0xdb9f('0x24')]();};}function saveUpdates(_0x17a0b0,_0x50bc5c){return function(_0x2b4ea4){if(_0x2b4ea4){return _0x2b4ea4[_0xdb9f('0x25')](_0x17a0b0)['then'](function(_0x11e0ac){return _0x11e0ac;});}return null;};}function removeEntity(_0x260f71,_0x2e60ff){return function(_0x536385){if(_0x536385){return _0x536385[_0xdb9f('0x26')]()[_0xdb9f('0x27')](function(){_0x260f71[_0xdb9f('0x19')](0xcc)[_0xdb9f('0x1a')]();});}};}function handleEntityNotFound(_0x3b0423,_0x1a41d1){return function(_0x3b5f32){if(!_0x3b5f32){_0x3b0423['sendStatus'](0x194);}return _0x3b5f32;};}function handleError(_0x2007eb,_0x2590d3){_0x2590d3=_0x2590d3||0x1f4;return function(_0x1a9996){logger[_0xdb9f('0x28')](_0x1a9996[_0xdb9f('0x29')]);if(_0x1a9996['name']){delete _0x1a9996['name'];}_0x2007eb[_0xdb9f('0x19')](_0x2590d3)[_0xdb9f('0x2a')](_0x1a9996);};}exports[_0xdb9f('0x2b')]=function(_0x3f177c,_0x29b424){var _0x4f14e6={},_0x3be6b={},_0x2e9b4b={'count':0x0,'rows':[]};var _0x161bea=_[_0xdb9f('0x2c')](db[_0xdb9f('0x2d')]['rawAttributes'],function(_0x429d6e){return{'name':_0x429d6e[_0xdb9f('0x2e')],'type':_0x429d6e[_0xdb9f('0x2f')][_0xdb9f('0x30')]};});_0x3be6b[_0xdb9f('0x31')]=_[_0xdb9f('0x2c')](_0x161bea,_0xdb9f('0x32'));_0x3be6b[_0xdb9f('0x33')]=_[_0xdb9f('0x34')](_0x3f177c[_0xdb9f('0x33')]);_0x3be6b['filters']=_[_0xdb9f('0x35')](_0x3be6b[_0xdb9f('0x31')],_0x3be6b[_0xdb9f('0x33')]);_0x4f14e6['attributes']=_[_0xdb9f('0x35')](_0x3be6b[_0xdb9f('0x31')],qs['fields'](_0x3f177c[_0xdb9f('0x33')][_0xdb9f('0x36')]));_0x4f14e6[_0xdb9f('0x37')]=_0x4f14e6[_0xdb9f('0x37')][_0xdb9f('0x38')]?_0x4f14e6[_0xdb9f('0x37')]:_0x3be6b[_0xdb9f('0x31')];if(!_0x3f177c[_0xdb9f('0x33')][_0xdb9f('0x39')](_0xdb9f('0x3a'))){_0x4f14e6[_0xdb9f('0x1f')]=qs[_0xdb9f('0x1f')](_0x3f177c[_0xdb9f('0x33')][_0xdb9f('0x1f')]);_0x4f14e6[_0xdb9f('0x1c')]=qs[_0xdb9f('0x1c')](_0x3f177c[_0xdb9f('0x33')][_0xdb9f('0x1c')]);}_0x4f14e6['order']=qs[_0xdb9f('0x3b')](_0x3f177c['query'][_0xdb9f('0x3b')]);_0x4f14e6[_0xdb9f('0x3c')]=qs[_0xdb9f('0x3d')](_[_0xdb9f('0x3e')](_0x3f177c['query'],_0x3be6b[_0xdb9f('0x3d')]),_0x161bea);if(_0x3f177c['query'][_0xdb9f('0x3f')]){_0x4f14e6[_0xdb9f('0x3c')]=_[_0xdb9f('0x40')](_0x4f14e6['where'],{'$or':_[_0xdb9f('0x2c')](_0x161bea,function(_0x170e52){if(_0x170e52[_0xdb9f('0x2f')]!=='VIRTUAL'){var _0x15226f={};_0x15226f[_0x170e52[_0xdb9f('0x32')]]={'$like':'%'+_0x3f177c['query'][_0xdb9f('0x3f')]+'%'};return _0x15226f;}})});}_0x4f14e6=_[_0xdb9f('0x40')]({},_0x4f14e6,_0x3f177c[_0xdb9f('0x41')]);var _0x3feb64={'where':_0x4f14e6[_0xdb9f('0x3c')]};return db[_0xdb9f('0x2d')][_0xdb9f('0x1e')](_0x3feb64)['then'](function(_0x27923d){_0x2e9b4b[_0xdb9f('0x1e')]=_0x27923d;if(_0x3f177c[_0xdb9f('0x33')]['includeAll']){_0x4f14e6[_0xdb9f('0x42')]=[{'all':!![]}];}return db[_0xdb9f('0x2d')][_0xdb9f('0x43')](_0x4f14e6);})['then'](function(_0x244c4b){_0x2e9b4b[_0xdb9f('0x44')]=_0x244c4b;return _0x2e9b4b;})[_0xdb9f('0x27')](respondWithFilteredResult(_0x29b424,_0x4f14e6))[_0xdb9f('0x45')](handleError(_0x29b424,null));};exports[_0xdb9f('0x46')]=function(_0x2b5c31,_0x551c8a){var _0x2b5ca={'raw':!![],'where':{'id':_0x2b5c31[_0xdb9f('0x47')]['id']}},_0x31c431={};_0x31c431[_0xdb9f('0x31')]=_[_0xdb9f('0x34')](db[_0xdb9f('0x2d')][_0xdb9f('0x48')]);_0x31c431[_0xdb9f('0x33')]=_[_0xdb9f('0x34')](_0x2b5c31[_0xdb9f('0x33')]);_0x31c431[_0xdb9f('0x3d')]=_[_0xdb9f('0x35')](_0x31c431[_0xdb9f('0x31')],_0x31c431[_0xdb9f('0x33')]);_0x2b5ca[_0xdb9f('0x37')]=_['intersection'](_0x31c431['model'],qs[_0xdb9f('0x36')](_0x2b5c31[_0xdb9f('0x33')]['fields']));_0x2b5ca['attributes']=_0x2b5ca[_0xdb9f('0x37')][_0xdb9f('0x38')]?_0x2b5ca[_0xdb9f('0x37')]:_0x31c431[_0xdb9f('0x31')];if(_0x2b5c31[_0xdb9f('0x33')][_0xdb9f('0x49')]){_0x2b5ca['include']=[{'all':!![]}];}_0x2b5ca=_[_0xdb9f('0x40')]({},_0x2b5ca,_0x2b5c31[_0xdb9f('0x41')]);return db[_0xdb9f('0x2d')][_0xdb9f('0x4a')](_0x2b5ca)[_0xdb9f('0x27')](handleEntityNotFound(_0x551c8a,null))['then'](respondWithResult(_0x551c8a,null))[_0xdb9f('0x45')](handleError(_0x551c8a,null));};exports[_0xdb9f('0x4b')]=function(_0x2f6b0b,_0x22b61d){return db[_0xdb9f('0x2d')][_0xdb9f('0x4b')](_0x2f6b0b[_0xdb9f('0x4c')],{})[_0xdb9f('0x27')](respondWithResult(_0x22b61d,0xc9))[_0xdb9f('0x45')](handleError(_0x22b61d,null));};exports[_0xdb9f('0x25')]=function(_0x18cb1b,_0x1d1bc0){if(_0x18cb1b[_0xdb9f('0x4c')]['id']){delete _0x18cb1b[_0xdb9f('0x4c')]['id'];}return db[_0xdb9f('0x2d')][_0xdb9f('0x4a')]({'where':{'id':_0x18cb1b[_0xdb9f('0x47')]['id']}})[_0xdb9f('0x27')](handleEntityNotFound(_0x1d1bc0,null))['then'](saveUpdates(_0x18cb1b[_0xdb9f('0x4c')],null))[_0xdb9f('0x27')](respondWithResult(_0x1d1bc0,null))[_0xdb9f('0x45')](handleError(_0x1d1bc0,null));};exports[_0xdb9f('0x26')]=function(_0x5dcd54,_0x5dace9){return db[_0xdb9f('0x2d')]['find']({'where':{'id':_0x5dcd54['params']['id']}})[_0xdb9f('0x27')](handleEntityNotFound(_0x5dace9,null))[_0xdb9f('0x27')](removeEntity(_0x5dace9,null))[_0xdb9f('0x45')](handleError(_0x5dace9,null));}; \ No newline at end of file +var _0x0234=['undefined','limit','count','offset','set','json','apply','save','update','destroy','then','sendStatus','error','name','send','index','map','ZendeskField','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','include','findAll','rows','catch','show','includeAll','find','create','body','params','rimraf','zip-dir','moment','util','sox','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','status','end'];(function(_0x555b2f,_0x43b622){var _0x81c0a6=function(_0x4629e6){while(--_0x4629e6){_0x555b2f['push'](_0x555b2f['shift']());}};_0x81c0a6(++_0x43b622);}(_0x0234,0xfd));var _0x4023=function(_0x1f88b3,_0x3560e0){_0x1f88b3=_0x1f88b3-0x0;var _0x5e0463=_0x0234[_0x1f88b3];return _0x5e0463;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4023('0x0'));var zipdir=require(_0x4023('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4023('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4023('0x3'));var path=require('path');var sox=require(_0x4023('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4023('0x5'));var squel=require(_0x4023('0x6'));var crypto=require(_0x4023('0x7'));var jsforce=require(_0x4023('0x8'));var deskjs=require(_0x4023('0x9'));var toCsv=require('to-csv');var querystring=require(_0x4023('0xa'));var Papa=require('papaparse');var Redis=require(_0x4023('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x4023('0xc'));var as=require(_0x4023('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x4023('0xe'));var config=require(_0x4023('0xf'));var licenseUtil=require(_0x4023('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1834eb,_0x2bc3a5){_0x2bc3a5=_0x2bc3a5||0xcc;return function(_0x49dbff){if(_0x49dbff){return _0x1834eb['sendStatus'](_0x2bc3a5);}return _0x1834eb[_0x4023('0x11')](_0x2bc3a5)[_0x4023('0x12')]();};}function respondWithResult(_0x219ae9,_0x4a0a8c){_0x4a0a8c=_0x4a0a8c||0xc8;return function(_0x2efa98){if(_0x2efa98){return _0x219ae9['status'](_0x4a0a8c)['json'](_0x2efa98);}};}function respondWithFilteredResult(_0x442bc5,_0x38bc9e){return function(_0x455e79){if(_0x455e79){var _0x5680e4=typeof _0x38bc9e['offset']===_0x4023('0x13')&&typeof _0x38bc9e[_0x4023('0x14')]==='undefined';var _0x44134b=_0x455e79[_0x4023('0x15')];var _0x320e12=_0x5680e4?0x0:_0x38bc9e[_0x4023('0x16')];var _0x59cdcc=_0x5680e4?_0x455e79[_0x4023('0x15')]:_0x38bc9e[_0x4023('0x16')]+_0x38bc9e['limit'];var _0xdd4a2d;if(_0x59cdcc>=_0x44134b){_0x59cdcc=_0x44134b;_0xdd4a2d=0xc8;}else{_0xdd4a2d=0xce;}_0x442bc5['status'](_0xdd4a2d);return _0x442bc5[_0x4023('0x17')]('Content-Range',_0x320e12+'-'+_0x59cdcc+'/'+_0x44134b)[_0x4023('0x18')](_0x455e79);}return null;};}function patchUpdates(_0x76f6d5){return function(_0x415246){try{jsonpatch[_0x4023('0x19')](_0x415246,_0x76f6d5,!![]);}catch(_0x4b2862){return BPromise['reject'](_0x4b2862);}return _0x415246[_0x4023('0x1a')]();};}function saveUpdates(_0x232f22,_0x484952){return function(_0x46d59d){if(_0x46d59d){return _0x46d59d[_0x4023('0x1b')](_0x232f22)['then'](function(_0x447e1c){return _0x447e1c;});}return null;};}function removeEntity(_0x46588e,_0x34d0ed){return function(_0xcd6aa8){if(_0xcd6aa8){return _0xcd6aa8[_0x4023('0x1c')]()[_0x4023('0x1d')](function(){_0x46588e[_0x4023('0x11')](0xcc)[_0x4023('0x12')]();});}};}function handleEntityNotFound(_0xd565bf,_0x44c9c5){return function(_0x3ff498){if(!_0x3ff498){_0xd565bf[_0x4023('0x1e')](0x194);}return _0x3ff498;};}function handleError(_0x4efda3,_0x278b9f){_0x278b9f=_0x278b9f||0x1f4;return function(_0x5a27cd){logger[_0x4023('0x1f')](_0x5a27cd['stack']);if(_0x5a27cd[_0x4023('0x20')]){delete _0x5a27cd['name'];}_0x4efda3[_0x4023('0x11')](_0x278b9f)[_0x4023('0x21')](_0x5a27cd);};}exports[_0x4023('0x22')]=function(_0x17f052,_0x545f8c){var _0x30f7e4={},_0xb41e1f={},_0x1ae872={'count':0x0,'rows':[]};var _0x56e431=_[_0x4023('0x23')](db[_0x4023('0x24')][_0x4023('0x25')],function(_0x301755){return{'name':_0x301755['fieldName'],'type':_0x301755['type'][_0x4023('0x26')]};});_0xb41e1f[_0x4023('0x27')]=_[_0x4023('0x23')](_0x56e431,_0x4023('0x20'));_0xb41e1f[_0x4023('0x28')]=_[_0x4023('0x29')](_0x17f052[_0x4023('0x28')]);_0xb41e1f[_0x4023('0x2a')]=_[_0x4023('0x2b')](_0xb41e1f[_0x4023('0x27')],_0xb41e1f[_0x4023('0x28')]);_0x30f7e4[_0x4023('0x2c')]=_['intersection'](_0xb41e1f[_0x4023('0x27')],qs[_0x4023('0x2d')](_0x17f052['query']['fields']));_0x30f7e4[_0x4023('0x2c')]=_0x30f7e4[_0x4023('0x2c')][_0x4023('0x2e')]?_0x30f7e4[_0x4023('0x2c')]:_0xb41e1f[_0x4023('0x27')];if(!_0x17f052[_0x4023('0x28')][_0x4023('0x2f')](_0x4023('0x30'))){_0x30f7e4[_0x4023('0x14')]=qs[_0x4023('0x14')](_0x17f052[_0x4023('0x28')][_0x4023('0x14')]);_0x30f7e4[_0x4023('0x16')]=qs['offset'](_0x17f052[_0x4023('0x28')]['offset']);}_0x30f7e4[_0x4023('0x31')]=qs[_0x4023('0x32')](_0x17f052[_0x4023('0x28')][_0x4023('0x32')]);_0x30f7e4[_0x4023('0x33')]=qs[_0x4023('0x2a')](_[_0x4023('0x34')](_0x17f052[_0x4023('0x28')],_0xb41e1f[_0x4023('0x2a')]),_0x56e431);if(_0x17f052[_0x4023('0x28')]['filter']){_0x30f7e4[_0x4023('0x33')]=_[_0x4023('0x35')](_0x30f7e4[_0x4023('0x33')],{'$or':_[_0x4023('0x23')](_0x56e431,function(_0x19d49f){if(_0x19d49f[_0x4023('0x36')]!==_0x4023('0x37')){var _0xd86d3e={};_0xd86d3e[_0x19d49f[_0x4023('0x20')]]={'$like':'%'+_0x17f052[_0x4023('0x28')][_0x4023('0x38')]+'%'};return _0xd86d3e;}})});}_0x30f7e4=_['merge']({},_0x30f7e4,_0x17f052[_0x4023('0x39')]);var _0x21baf9={'where':_0x30f7e4[_0x4023('0x33')]};return db['ZendeskField']['count'](_0x21baf9)[_0x4023('0x1d')](function(_0x2c6e75){_0x1ae872[_0x4023('0x15')]=_0x2c6e75;if(_0x17f052[_0x4023('0x28')]['includeAll']){_0x30f7e4[_0x4023('0x3a')]=[{'all':!![]}];}return db[_0x4023('0x24')][_0x4023('0x3b')](_0x30f7e4);})['then'](function(_0x23c1c7){_0x1ae872[_0x4023('0x3c')]=_0x23c1c7;return _0x1ae872;})[_0x4023('0x1d')](respondWithFilteredResult(_0x545f8c,_0x30f7e4))[_0x4023('0x3d')](handleError(_0x545f8c,null));};exports[_0x4023('0x3e')]=function(_0x12b8ca,_0xe8c364){var _0x3d951b={'raw':!![],'where':{'id':_0x12b8ca['params']['id']}},_0x4ed39f={};_0x4ed39f['model']=_[_0x4023('0x29')](db[_0x4023('0x24')][_0x4023('0x25')]);_0x4ed39f[_0x4023('0x28')]=_[_0x4023('0x29')](_0x12b8ca[_0x4023('0x28')]);_0x4ed39f['filters']=_[_0x4023('0x2b')](_0x4ed39f[_0x4023('0x27')],_0x4ed39f['query']);_0x3d951b[_0x4023('0x2c')]=_[_0x4023('0x2b')](_0x4ed39f[_0x4023('0x27')],qs[_0x4023('0x2d')](_0x12b8ca['query'][_0x4023('0x2d')]));_0x3d951b[_0x4023('0x2c')]=_0x3d951b[_0x4023('0x2c')][_0x4023('0x2e')]?_0x3d951b[_0x4023('0x2c')]:_0x4ed39f[_0x4023('0x27')];if(_0x12b8ca[_0x4023('0x28')][_0x4023('0x3f')]){_0x3d951b[_0x4023('0x3a')]=[{'all':!![]}];}_0x3d951b=_[_0x4023('0x35')]({},_0x3d951b,_0x12b8ca[_0x4023('0x39')]);return db['ZendeskField'][_0x4023('0x40')](_0x3d951b)[_0x4023('0x1d')](handleEntityNotFound(_0xe8c364,null))[_0x4023('0x1d')](respondWithResult(_0xe8c364,null))[_0x4023('0x3d')](handleError(_0xe8c364,null));};exports[_0x4023('0x41')]=function(_0x176fbb,_0x2249d4){return db[_0x4023('0x24')][_0x4023('0x41')](_0x176fbb[_0x4023('0x42')],{})[_0x4023('0x1d')](respondWithResult(_0x2249d4,0xc9))[_0x4023('0x3d')](handleError(_0x2249d4,null));};exports['update']=function(_0x1d77f4,_0x2c83b5){if(_0x1d77f4[_0x4023('0x42')]['id']){delete _0x1d77f4[_0x4023('0x42')]['id'];}return db[_0x4023('0x24')][_0x4023('0x40')]({'where':{'id':_0x1d77f4['params']['id']}})[_0x4023('0x1d')](handleEntityNotFound(_0x2c83b5,null))['then'](saveUpdates(_0x1d77f4[_0x4023('0x42')],null))[_0x4023('0x1d')](respondWithResult(_0x2c83b5,null))[_0x4023('0x3d')](handleError(_0x2c83b5,null));};exports['destroy']=function(_0x58360f,_0x2d1841){return db['ZendeskField'][_0x4023('0x40')]({'where':{'id':_0x58360f[_0x4023('0x43')]['id']}})[_0x4023('0x1d')](handleEntityNotFound(_0x2d1841,null))[_0x4023('0x1d')](removeEntity(_0x2d1841,null))['catch'](handleError(_0x2d1841,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 1ce51ab..a219b88 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 _0xd1b1=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId'];(function(_0x344ed0,_0x5124cc){var _0x5959ed=function(_0x4b9518){while(--_0x4b9518){_0x344ed0['push'](_0x344ed0['shift']());}};_0x5959ed(++_0x5124cc);}(_0xd1b1,0xb4));var _0x1d1b=function(_0xa3df61,_0x13bf88){_0xa3df61=_0xa3df61-0x0;var _0x53f916=_0xd1b1[_0xa3df61];return _0x53f916;};'use strict';var _=require(_0x1d1b('0x0'));var util=require(_0x1d1b('0x1'));var logger=require(_0x1d1b('0x2'))(_0x1d1b('0x3'));var moment=require(_0x1d1b('0x4'));var BPromise=require(_0x1d1b('0x5'));var rp=require(_0x1d1b('0x6'));var fs=require('fs');var path=require(_0x1d1b('0x7'));var rimraf=require(_0x1d1b('0x8'));var config=require(_0x1d1b('0x9'));var attributes=require(_0x1d1b('0xa'));module[_0x1d1b('0xb')]=function(_0x14da02,_0x25fc99){return _0x14da02[_0x1d1b('0xc')](_0x1d1b('0xd'),attributes,{'tableName':_0x1d1b('0xe'),'paranoid':![],'indexes':[{'name':_0x1d1b('0xf'),'fields':[_0x1d1b('0x10'),_0x1d1b('0x11')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfe3a=['zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields'];(function(_0x35c5a8,_0x8ecb48){var _0x34782c=function(_0x1b23ec){while(--_0x1b23ec){_0x35c5a8['push'](_0x35c5a8['shift']());}};_0x34782c(++_0x8ecb48);}(_0xfe3a,0x1a3));var _0xafe3=function(_0x20d9ff,_0x39e219){_0x20d9ff=_0x20d9ff-0x0;var _0x4678db=_0xfe3a[_0x20d9ff];return _0x4678db;};'use strict';var _=require(_0xafe3('0x0'));var util=require(_0xafe3('0x1'));var logger=require(_0xafe3('0x2'))(_0xafe3('0x3'));var moment=require('moment');var BPromise=require(_0xafe3('0x4'));var rp=require(_0xafe3('0x5'));var fs=require('fs');var path=require(_0xafe3('0x6'));var rimraf=require('rimraf');var config=require(_0xafe3('0x7'));var attributes=require(_0xafe3('0x8'));module[_0xafe3('0x9')]=function(_0x3fa4e9,_0x5174ba){return _0x3fa4e9[_0xafe3('0xa')](_0xafe3('0xb'),attributes,{'tableName':_0xafe3('0xc'),'paranoid':![],'indexes':[{'name':_0xafe3('0xd'),'fields':[_0xafe3('0xe'),_0xafe3('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 6436760..ac56d6a 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 _0x247a=['ZendeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x164580,_0x3c81f9){var _0xed7154=function(_0x3b7929){while(--_0x3b7929){_0x164580['push'](_0x164580['shift']());}};_0xed7154(++_0x3c81f9);}(_0x247a,0x189));var _0xa247=function(_0x38b2d9,_0x19fd42){_0x38b2d9=_0x38b2d9-0x0;var _0x23a3e1=_0x247a[_0x38b2d9];return _0x23a3e1;};'use strict';var _=require(_0xa247('0x0'));var util=require(_0xa247('0x1'));var moment=require(_0xa247('0x2'));var BPromise=require(_0xa247('0x3'));var rs=require(_0xa247('0x4'));var fs=require('fs');var Redis=require(_0xa247('0x5'));var db=require(_0xa247('0x6'))['db'];var utils=require(_0xa247('0x7'));var logger=require('../../config/logger')(_0xa247('0x8'));var config=require(_0xa247('0x9'));var jayson=require(_0xa247('0xa'));var client=jayson['client'][_0xa247('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x126c27,_0x4e899f,_0xaefa71){return new BPromise(function(_0x4f1ad1,_0x1e64d1){return client[_0xa247('0xc')](_0x126c27,_0xaefa71)[_0xa247('0xd')](function(_0x227873){logger[_0xa247('0xe')](_0xa247('0xf'),_0x4e899f,'request\x20sent');logger[_0xa247('0x10')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x4e899f,'request\x20sent',JSON[_0xa247('0x11')](_0x227873));if(_0x227873[_0xa247('0x12')]){if(_0x227873[_0xa247('0x12')][_0xa247('0x13')]===0x1f4){logger[_0xa247('0x12')](_0xa247('0xf'),_0x4e899f,_0x227873['error'][_0xa247('0x14')]);return _0x1e64d1(_0x227873[_0xa247('0x12')]['message']);}logger['error'](_0xa247('0xf'),_0x4e899f,_0x227873[_0xa247('0x12')][_0xa247('0x14')]);return _0x4f1ad1(_0x227873[_0xa247('0x12')][_0xa247('0x14')]);}else{logger[_0xa247('0xe')](_0xa247('0xf'),_0x4e899f,_0xa247('0x15'));_0x4f1ad1(_0x227873[_0xa247('0x16')][_0xa247('0x14')]);}})[_0xa247('0x17')](function(_0x2281b9){logger[_0xa247('0x12')]('ZendeskField,\x20%s,\x20%s',_0x4e899f,_0x2281b9);_0x1e64d1(_0x2281b9);});});} \ No newline at end of file +var _0xd392=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskField,\x20%s,\x20%s','message','catch'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xd392,0x120));var _0x2d39=function(_0x868bf1,_0x11945f){_0x868bf1=_0x868bf1-0x0;var _0x23702a=_0xd392[_0x868bf1];return _0x23702a;};'use strict';var _=require(_0x2d39('0x0'));var util=require(_0x2d39('0x1'));var moment=require(_0x2d39('0x2'));var BPromise=require(_0x2d39('0x3'));var rs=require(_0x2d39('0x4'));var fs=require('fs');var Redis=require(_0x2d39('0x5'));var db=require(_0x2d39('0x6'))['db'];var utils=require(_0x2d39('0x7'));var logger=require('../../config/logger')(_0x2d39('0x8'));var config=require(_0x2d39('0x9'));var jayson=require(_0x2d39('0xa'));var client=jayson[_0x2d39('0xb')][_0x2d39('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x28beb6,_0x11626d,_0x407db1){return new BPromise(function(_0x3b3ce4,_0x1a12d0){return client['request'](_0x28beb6,_0x407db1)[_0x2d39('0xd')](function(_0x16a134){logger[_0x2d39('0xe')]('ZendeskField,\x20%s,\x20%s',_0x11626d,_0x2d39('0xf'));logger[_0x2d39('0x10')](_0x2d39('0x11'),_0x11626d,_0x2d39('0xf'),JSON[_0x2d39('0x12')](_0x16a134));if(_0x16a134[_0x2d39('0x13')]){if(_0x16a134['error'][_0x2d39('0x14')]===0x1f4){logger[_0x2d39('0x13')](_0x2d39('0x15'),_0x11626d,_0x16a134[_0x2d39('0x13')][_0x2d39('0x16')]);return _0x1a12d0(_0x16a134[_0x2d39('0x13')][_0x2d39('0x16')]);}logger[_0x2d39('0x13')](_0x2d39('0x15'),_0x11626d,_0x16a134['error']['message']);return _0x3b3ce4(_0x16a134['error'][_0x2d39('0x16')]);}else{logger[_0x2d39('0xe')](_0x2d39('0x15'),_0x11626d,'request\x20sent');_0x3b3ce4(_0x16a134['result'][_0x2d39('0x16')]);}})[_0x2d39('0x17')](function(_0x55eb1d){logger[_0x2d39('0x13')](_0x2d39('0x15'),_0x11626d,_0x55eb1d);_0x1a12d0(_0x55eb1d);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 2f83171..5fabb80 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 _0x9554=['../../components/auth/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra'];(function(_0x4d1722,_0x1b02b9){var _0x1d0855=function(_0x4c7c0a){while(--_0x4c7c0a){_0x4d1722['push'](_0x4d1722['shift']());}};_0x1d0855(++_0x1b02b9);}(_0x9554,0x14b));var _0x4955=function(_0x95838f,_0x59800a){_0x95838f=_0x95838f-0x0;var _0x1e5a94=_0x9554[_0x95838f];return _0x1e5a94;};'use strict';var multer=require(_0x4955('0x0'));var util=require(_0x4955('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4955('0x2'));var router=express[_0x4955('0x3')]();var fs_extra=require(_0x4955('0x4'));var auth=require(_0x4955('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4955('0x6'));var controller=require(_0x4955('0x7'));router[_0x4955('0x8')]('/',auth[_0x4955('0x9')](),controller[_0x4955('0xa')]);router[_0x4955('0x8')](_0x4955('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x4955('0x8')](_0x4955('0xc'),auth[_0x4955('0x9')](),controller[_0x4955('0xd')]);router[_0x4955('0x8')](_0x4955('0xe'),auth[_0x4955('0x9')](),controller[_0x4955('0xf')]);router['post']('/',auth[_0x4955('0x9')](),controller['create']);router['post'](_0x4955('0xc'),auth[_0x4955('0x9')](),controller['addConfiguration']);router[_0x4955('0x10')](_0x4955('0xb'),auth['isAuthenticated'](),controller[_0x4955('0x11')]);router[_0x4955('0x12')](_0x4955('0xb'),auth['isAuthenticated'](),controller[_0x4955('0x13')]);module[_0x4955('0x14')]=router; \ No newline at end of file +var _0xf8f7=['exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put'];(function(_0x45f1df,_0x16da99){var _0x1938d7=function(_0xf396){while(--_0xf396){_0x45f1df['push'](_0x45f1df['shift']());}};_0x1938d7(++_0x16da99);}(_0xf8f7,0x91));var _0x7f8f=function(_0x1cc8d4,_0x4cb224){_0x1cc8d4=_0x1cc8d4-0x0;var _0x2a2d60=_0xf8f7[_0x1cc8d4];return _0x2a2d60;};'use strict';var multer=require('multer');var util=require(_0x7f8f('0x0'));var path=require('path');var timeout=require(_0x7f8f('0x1'));var express=require('express');var router=express[_0x7f8f('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x7f8f('0x3'));var interaction=require(_0x7f8f('0x4'));var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router[_0x7f8f('0x5')]('/',auth[_0x7f8f('0x6')](),controller[_0x7f8f('0x7')]);router[_0x7f8f('0x5')](_0x7f8f('0x8'),auth[_0x7f8f('0x6')](),controller[_0x7f8f('0x9')]);router[_0x7f8f('0x5')](_0x7f8f('0xa'),auth[_0x7f8f('0x6')](),controller['getConfigurations']);router[_0x7f8f('0x5')](_0x7f8f('0xb'),auth[_0x7f8f('0x6')](),controller[_0x7f8f('0xc')]);router[_0x7f8f('0xd')]('/',auth[_0x7f8f('0x6')](),controller[_0x7f8f('0xe')]);router[_0x7f8f('0xd')](_0x7f8f('0xa'),auth[_0x7f8f('0x6')](),controller[_0x7f8f('0xf')]);router[_0x7f8f('0x10')]('/:id',auth[_0x7f8f('0x6')](),controller['update']);router['delete'](_0x7f8f('0x8'),auth[_0x7f8f('0x6')](),controller['destroy']);module[_0x7f8f('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 6c802bf..bb8802f 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 _0xdace=['STRING','sequelize'];(function(_0xbed732,_0x1dda9d){var _0x5d95bd=function(_0x3ffb63){while(--_0x3ffb63){_0xbed732['push'](_0xbed732['shift']());}};_0x5d95bd(++_0x1dda9d);}(_0xdace,0xc5));var _0xedac=function(_0x3e3bee,_0x4f91fe){_0x3e3bee=_0x3e3bee-0x0;var _0x3ae14c=_0xdace[_0x3e3bee];return _0x3ae14c;};'use strict';var Sequelize=require(_0xedac('0x0'));module['exports']={'name':{'type':Sequelize[_0xedac('0x1')]},'description':{'type':Sequelize[_0xedac('0x1')]},'host':{'type':Sequelize[_0xedac('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xedac('0x1')]},'clientSecret':{'type':Sequelize[_0xedac('0x1')]},'serverUrl':{'type':Sequelize[_0xedac('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xedac('0x1')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5b02=['exports','STRING','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5b02,0xe9));var _0x25b0=function(_0x5c3431,_0x9e51b0){_0x5c3431=_0x5c3431-0x0;var _0x42d565=_0x5b02[_0x5c3431];return _0x42d565;};'use strict';var Sequelize=require(_0x25b0('0x0'));module[_0x25b0('0x1')]={'name':{'type':Sequelize[_0x25b0('0x2')]},'description':{'type':Sequelize[_0x25b0('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x25b0('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x25b0('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x25b0('0x2')]},'refreshToken':{'type':Sequelize[_0x25b0('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 21236cf..03159ac 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 _0x6cc9=['../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','destroy','name','send','map','ZohoAccount','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','then','rows','show','rawAttributes','find','catch','create','body','params','getConfigurations','sort','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','ZohoConfiguration','ZohoField','Subjects','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientId','serverUrl','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','Calls','response','error','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x34365b,_0x418c5a){var _0x12d73a=function(_0x242ded){while(--_0x242ded){_0x34365b['push'](_0x34365b['shift']());}};_0x12d73a(++_0x418c5a);}(_0x6cc9,0xf3));var _0x96cc=function(_0x4bbcb0,_0x49c4e2){_0x4bbcb0=_0x4bbcb0-0x0;var _0x5ac1ad=_0x6cc9[_0x4bbcb0];return _0x5ac1ad;};'use strict';var emlformat=require(_0x96cc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x96cc('0x1'));var jsonpatch=require(_0x96cc('0x2'));var rp=require(_0x96cc('0x3'));var moment=require(_0x96cc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x96cc('0x5'));var util=require(_0x96cc('0x6'));var path=require('path');var sox=require(_0x96cc('0x7'));var csv=require('to-csv');var ejs=require(_0x96cc('0x8'));var fs=require('fs');var fs_extra=require(_0x96cc('0x9'));var _=require(_0x96cc('0xa'));var squel=require(_0x96cc('0xb'));var crypto=require(_0x96cc('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x96cc('0xd'));var querystring=require(_0x96cc('0xe'));var Papa=require(_0x96cc('0xf'));var Redis=require(_0x96cc('0x10'));var authService=require(_0x96cc('0x11'));var qs=require(_0x96cc('0x12'));var as=require(_0x96cc('0x13'));var hardwareService=require(_0x96cc('0x14'));var logger=require(_0x96cc('0x15'))(_0x96cc('0x16'));var utils=require(_0x96cc('0x17'));var config=require(_0x96cc('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x96cc('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x34d1dd,_0x9607fa){_0x9607fa=_0x9607fa||0xcc;return function(_0x1ac09b){if(_0x1ac09b){return _0x34d1dd[_0x96cc('0x1a')](_0x9607fa);}return _0x34d1dd[_0x96cc('0x1b')](_0x9607fa)[_0x96cc('0x1c')]();};}function respondWithResult(_0x46c1b5,_0x38e32e){_0x38e32e=_0x38e32e||0xc8;return function(_0xec2756){if(_0xec2756){return _0x46c1b5[_0x96cc('0x1b')](_0x38e32e)[_0x96cc('0x1d')](_0xec2756);}};}function respondWithFilteredResult(_0x3abce4,_0x53b021){return function(_0xa19bc6){if(_0xa19bc6){var _0x297b3b=typeof _0x53b021['offset']==='undefined'&&typeof _0x53b021[_0x96cc('0x1e')]===_0x96cc('0x1f');var _0x488b17=_0xa19bc6[_0x96cc('0x20')];var _0x5de922=_0x297b3b?0x0:_0x53b021[_0x96cc('0x21')];var _0x5d551a=_0x297b3b?_0xa19bc6['count']:_0x53b021[_0x96cc('0x21')]+_0x53b021[_0x96cc('0x1e')];var _0x24c6b8;if(_0x5d551a>=_0x488b17){_0x5d551a=_0x488b17;_0x24c6b8=0xc8;}else{_0x24c6b8=0xce;}_0x3abce4['status'](_0x24c6b8);return _0x3abce4[_0x96cc('0x22')](_0x96cc('0x23'),_0x5de922+'-'+_0x5d551a+'/'+_0x488b17)[_0x96cc('0x1d')](_0xa19bc6);}return null;};}function patchUpdates(_0x27f103){return function(_0x159b76){try{jsonpatch[_0x96cc('0x24')](_0x159b76,_0x27f103,!![]);}catch(_0x4f9412){return BPromise[_0x96cc('0x25')](_0x4f9412);}return _0x159b76[_0x96cc('0x26')]();};}function saveUpdates(_0x2c3ca4,_0x293b5c){return function(_0x2a63d5){if(_0x2a63d5){return _0x2a63d5['update'](_0x2c3ca4)['then'](function(_0x17f2b1){return _0x17f2b1;});}return null;};}function removeEntity(_0x19cbbb,_0x421ddd){return function(_0x2bbe6e){if(_0x2bbe6e){return _0x2bbe6e[_0x96cc('0x27')]()['then'](function(){_0x19cbbb[_0x96cc('0x1b')](0xcc)[_0x96cc('0x1c')]();});}};}function handleEntityNotFound(_0x47b1ac,_0x4dde4c){return function(_0x36a5f6){if(!_0x36a5f6){_0x47b1ac['sendStatus'](0x194);}return _0x36a5f6;};}function handleError(_0x5a9882,_0x1f8e66){_0x1f8e66=_0x1f8e66||0x1f4;return function(_0x7ba61d){logger['error'](_0x7ba61d['stack']);if(_0x7ba61d[_0x96cc('0x28')]){delete _0x7ba61d['name'];}_0x5a9882[_0x96cc('0x1b')](_0x1f8e66)[_0x96cc('0x29')](_0x7ba61d);};}exports['index']=function(_0x10df8a,_0x3bc79e){var _0x40499c={},_0x2a6fd6={},_0x4071f3={'count':0x0,'rows':[]};var _0x2319df=_[_0x96cc('0x2a')](db[_0x96cc('0x2b')]['rawAttributes'],function(_0x4b137b){return{'name':_0x4b137b[_0x96cc('0x2c')],'type':_0x4b137b[_0x96cc('0x2d')][_0x96cc('0x2e')]};});_0x2a6fd6[_0x96cc('0x2f')]=_[_0x96cc('0x2a')](_0x2319df,'name');_0x2a6fd6[_0x96cc('0x30')]=_[_0x96cc('0x31')](_0x10df8a['query']);_0x2a6fd6[_0x96cc('0x32')]=_['intersection'](_0x2a6fd6[_0x96cc('0x2f')],_0x2a6fd6[_0x96cc('0x30')]);_0x40499c['attributes']=_[_0x96cc('0x33')](_0x2a6fd6[_0x96cc('0x2f')],qs[_0x96cc('0x34')](_0x10df8a[_0x96cc('0x30')]['fields']));_0x40499c['attributes']=_0x40499c[_0x96cc('0x35')][_0x96cc('0x36')]?_0x40499c['attributes']:_0x2a6fd6[_0x96cc('0x2f')];if(!_0x10df8a['query'][_0x96cc('0x37')](_0x96cc('0x38'))){_0x40499c[_0x96cc('0x1e')]=qs[_0x96cc('0x1e')](_0x10df8a[_0x96cc('0x30')][_0x96cc('0x1e')]);_0x40499c['offset']=qs[_0x96cc('0x21')](_0x10df8a[_0x96cc('0x30')][_0x96cc('0x21')]);}_0x40499c[_0x96cc('0x39')]=qs['sort'](_0x10df8a[_0x96cc('0x30')]['sort']);_0x40499c[_0x96cc('0x3a')]=qs['filters'](_[_0x96cc('0x3b')](_0x10df8a[_0x96cc('0x30')],_0x2a6fd6[_0x96cc('0x32')]),_0x2319df);if(_0x10df8a[_0x96cc('0x30')][_0x96cc('0x3c')]){_0x40499c[_0x96cc('0x3a')]=_[_0x96cc('0x3d')](_0x40499c[_0x96cc('0x3a')],{'$or':_[_0x96cc('0x2a')](_0x2319df,function(_0xa5be75){if(_0xa5be75[_0x96cc('0x2d')]!==_0x96cc('0x3e')){var _0x41fcab={};_0x41fcab[_0xa5be75['name']]={'$like':'%'+_0x10df8a[_0x96cc('0x30')][_0x96cc('0x3c')]+'%'};return _0x41fcab;}})});}_0x40499c=_[_0x96cc('0x3d')]({},_0x40499c,_0x10df8a[_0x96cc('0x3f')]);var _0x577f5a={'where':_0x40499c[_0x96cc('0x3a')]};return db[_0x96cc('0x2b')][_0x96cc('0x20')](_0x577f5a)['then'](function(_0x20ab3e){_0x4071f3[_0x96cc('0x20')]=_0x20ab3e;if(_0x10df8a['query'][_0x96cc('0x40')]){_0x40499c[_0x96cc('0x41')]=[{'all':!![]}];}return db[_0x96cc('0x2b')]['findAll'](_0x40499c);})[_0x96cc('0x42')](function(_0x59a9f2){_0x4071f3[_0x96cc('0x43')]=_0x59a9f2;return _0x4071f3;})[_0x96cc('0x42')](respondWithFilteredResult(_0x3bc79e,_0x40499c))['catch'](handleError(_0x3bc79e,null));};exports[_0x96cc('0x44')]=function(_0x28142e,_0x27f7a9){var _0x3a0e6d={'raw':![],'where':{'id':_0x28142e['params']['id']}},_0x5f2e2d={};_0x5f2e2d[_0x96cc('0x2f')]=_[_0x96cc('0x31')](db['ZohoAccount'][_0x96cc('0x45')]);_0x5f2e2d['query']=_[_0x96cc('0x31')](_0x28142e[_0x96cc('0x30')]);_0x5f2e2d['filters']=_['intersection'](_0x5f2e2d['model'],_0x5f2e2d[_0x96cc('0x30')]);_0x3a0e6d[_0x96cc('0x35')]=_[_0x96cc('0x33')](_0x5f2e2d[_0x96cc('0x2f')],qs['fields'](_0x28142e[_0x96cc('0x30')][_0x96cc('0x34')]));_0x3a0e6d[_0x96cc('0x35')]=_0x3a0e6d[_0x96cc('0x35')][_0x96cc('0x36')]?_0x3a0e6d[_0x96cc('0x35')]:_0x5f2e2d['model'];if(_0x28142e['query'][_0x96cc('0x40')]){_0x3a0e6d[_0x96cc('0x41')]=[{'all':!![]}];}_0x3a0e6d=_[_0x96cc('0x3d')]({},_0x3a0e6d,_0x28142e[_0x96cc('0x3f')]);return db[_0x96cc('0x2b')][_0x96cc('0x46')](_0x3a0e6d)[_0x96cc('0x42')](handleEntityNotFound(_0x27f7a9,null))['then'](respondWithResult(_0x27f7a9,null))[_0x96cc('0x47')](handleError(_0x27f7a9,null));};exports[_0x96cc('0x48')]=function(_0x38111b,_0xe446c1){return db[_0x96cc('0x2b')]['create'](_0x38111b[_0x96cc('0x49')],{})[_0x96cc('0x42')](respondWithResult(_0xe446c1,0xc9))[_0x96cc('0x47')](handleError(_0xe446c1,null));};exports['update']=function(_0x14a46d,_0x110a5b){if(_0x14a46d[_0x96cc('0x49')]['id']){delete _0x14a46d['body']['id'];}return db[_0x96cc('0x2b')][_0x96cc('0x46')]({'where':{'id':_0x14a46d[_0x96cc('0x4a')]['id']}})['then'](handleEntityNotFound(_0x110a5b,null))[_0x96cc('0x42')](saveUpdates(_0x14a46d[_0x96cc('0x49')],null))['then'](respondWithResult(_0x110a5b,null))[_0x96cc('0x47')](handleError(_0x110a5b,null));};exports[_0x96cc('0x27')]=function(_0x1981a3,_0xb0eaac){return db[_0x96cc('0x2b')][_0x96cc('0x46')]({'where':{'id':_0x1981a3[_0x96cc('0x4a')]['id']}})['then'](handleEntityNotFound(_0xb0eaac,null))[_0x96cc('0x42')](removeEntity(_0xb0eaac,null))[_0x96cc('0x47')](handleError(_0xb0eaac,null));};exports[_0x96cc('0x4b')]=function(_0x21636f,_0x40f8cd,_0x97efe){var _0x71f67c={};var _0x26fa3c={};var _0x676eb2;var _0x134999;return db[_0x96cc('0x2b')]['findOne']({'where':{'id':_0x21636f[_0x96cc('0x4a')]['id']}})[_0x96cc('0x42')](handleEntityNotFound(_0x40f8cd,null))[_0x96cc('0x42')](function(_0x22e725){if(_0x22e725){_0x676eb2=_0x22e725;_0x26fa3c[_0x96cc('0x2f')]=_['keys'](db['ZohoConfiguration'][_0x96cc('0x45')]);_0x26fa3c[_0x96cc('0x30')]=_[_0x96cc('0x31')](_0x21636f[_0x96cc('0x30')]);_0x26fa3c[_0x96cc('0x32')]=_[_0x96cc('0x33')](_0x26fa3c['model'],_0x26fa3c[_0x96cc('0x30')]);_0x71f67c[_0x96cc('0x35')]=_['intersection'](_0x26fa3c[_0x96cc('0x2f')],qs[_0x96cc('0x34')](_0x21636f[_0x96cc('0x30')][_0x96cc('0x34')]));_0x71f67c['attributes']=_0x71f67c[_0x96cc('0x35')][_0x96cc('0x36')]?_0x71f67c[_0x96cc('0x35')]:_0x26fa3c[_0x96cc('0x2f')];_0x71f67c[_0x96cc('0x39')]=qs[_0x96cc('0x4c')](_0x21636f[_0x96cc('0x30')][_0x96cc('0x4c')]);_0x71f67c[_0x96cc('0x3a')]=qs['filters'](_[_0x96cc('0x3b')](_0x21636f[_0x96cc('0x30')],_0x26fa3c[_0x96cc('0x32')]));if(_0x21636f[_0x96cc('0x30')]['filter']){_0x71f67c['where']=_['merge'](_0x71f67c[_0x96cc('0x3a')],{'$or':_[_0x96cc('0x2a')](_0x71f67c[_0x96cc('0x35')],function(_0x42d233){var _0x443d7c={};_0x443d7c[_0x42d233]={'$like':'%'+_0x21636f[_0x96cc('0x30')]['filter']+'%'};return _0x443d7c;})});}_0x71f67c=_[_0x96cc('0x3d')]({},_0x71f67c,_0x21636f['options']);return _0x676eb2['getConfigurations'](_0x71f67c);}})[_0x96cc('0x42')](function(_0x183870){if(_0x183870){_0x134999=_0x183870[_0x96cc('0x36')];if(!_0x21636f[_0x96cc('0x30')][_0x96cc('0x37')](_0x96cc('0x38'))){_0x71f67c[_0x96cc('0x1e')]=qs[_0x96cc('0x1e')](_0x21636f[_0x96cc('0x30')][_0x96cc('0x1e')]);_0x71f67c['offset']=qs[_0x96cc('0x21')](_0x21636f[_0x96cc('0x30')]['offset']);}return _0x676eb2['getConfigurations'](_0x71f67c);}})['then'](function(_0x133dc9){if(_0x133dc9){return _0x133dc9?{'count':_0x134999,'rows':_0x133dc9}:null;}})[_0x96cc('0x42')](respondWithResult(_0x40f8cd,null))['catch'](handleError(_0x40f8cd,null));};exports[_0x96cc('0x4d')]=function(_0xc43750,_0x401196,_0x5ec04a){if(_0xc43750[_0x96cc('0x49')]['id']){delete _0xc43750[_0x96cc('0x49')]['id'];}return db[_0x96cc('0x2b')][_0x96cc('0x4e')]({'where':{'id':_0xc43750[_0x96cc('0x4a')]['id']}})[_0x96cc('0x42')](handleEntityNotFound(_0x401196,null))[_0x96cc('0x42')](function(_0xe69741){if(_0xe69741){_0xc43750[_0x96cc('0x49')][_0x96cc('0x4f')]=_0xe69741['id'];_0xc43750[_0x96cc('0x49')]['Subjects']=integrations[_0x96cc('0x50')](_0xc43750['body'][_0x96cc('0x51')],_0xc43750[_0x96cc('0x49')]['type']);_0xc43750[_0x96cc('0x49')][_0x96cc('0x52')]=integrations[_0x96cc('0x53')](_0xc43750[_0x96cc('0x49')][_0x96cc('0x51')],_0xc43750[_0x96cc('0x49')]['type']);return db[_0x96cc('0x54')]['create'](_0xc43750[_0x96cc('0x49')],{'include':[{'model':db[_0x96cc('0x55')],'as':_0x96cc('0x56')},{'model':db[_0x96cc('0x55')],'as':'Descriptions'}]});}return null;})[_0x96cc('0x42')](respondWithResult(_0x401196,null))['catch'](handleError(_0x401196,null));};function getAccessToken(_0x353325){return new Promise(function(_0xe740d9,_0x3b8447){var _0x7db03b;switch(_0x353325[_0x96cc('0x57')]){case'US':_0x7db03b=_0x96cc('0x58');break;case'AU':_0x7db03b='https://accounts.zoho.com.au';break;case'EU':_0x7db03b=_0x96cc('0x59');break;case'IN':_0x7db03b='https://accounts.zoho.in';break;case'CN':_0x7db03b=_0x96cc('0x5a');break;default:_0x7db03b=_0x96cc('0x59');break;}var _0x2d39f2={'method':_0x96cc('0x5b'),'uri':_0x7db03b+_0x96cc('0x5c'),'qs':{'refresh_token':_0x353325[_0x96cc('0x5d')],'client_id':_0x353325['clientId'],'client_secret':_0x353325[_0x96cc('0x5e')],'grant_type':_0x96cc('0x5f')},'json':!![]};return rp(_0x2d39f2)[_0x96cc('0x42')](function(_0x130daf){if(_0x130daf[_0x96cc('0x60')]){_0xe740d9(_0x130daf[_0x96cc('0x60')]);}else{_0x3b8447(_0x96cc('0x61'));}})[_0x96cc('0x47')](function(_0x1bc653){_0x3b8447(_0x1bc653);});});}exports[_0x96cc('0x62')]=function(_0x1c2cc4,_0x572017,_0x4a8aea){var _0x40c3c9,_0x2a710f,_0x18d5de,_0x32e11b,_0x153b26;return db['ZohoAccount'][_0x96cc('0x4e')]({'where':{'id':_0x1c2cc4[_0x96cc('0x4a')]['id']},'attributes':['id',_0x96cc('0x63'),_0x96cc('0x57'),_0x96cc('0x64'),_0x96cc('0x5e'),_0x96cc('0x65'),'code',_0x96cc('0x5d')]})[_0x96cc('0x42')](handleEntityNotFound(_0x572017,null))['then'](function(_0x1c3efe){_0x153b26=_0x1c3efe;_0x40c3c9=_0x153b26[_0x96cc('0x63')];_0x2a710f=_0x40c3c9===_0x96cc('0x66')?'eu':_0x96cc('0x67');_0x18d5de=_0x153b26['serverUrl'];var _0x4b8d05=_0x18d5de[_0x96cc('0x68')](-0x1);if(_0x4b8d05==='/'||_0x4b8d05==='\x5c'||_0x4b8d05===':'){_0x18d5de=_0x18d5de[_0x96cc('0x69')](0x0,_0x18d5de[_0x96cc('0x6a')](_0x4b8d05));}if(!_0x153b26[_0x96cc('0x5d')]){throw new Error(_0x96cc('0x6b'));}return getAccessToken(_0x153b26);})['then'](function(_0x5bccd6){if(_0x5bccd6){return rp({'method':'GET','uri':util[_0x96cc('0x6c')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x2a710f),'qs':{'module':_0x96cc('0x6d')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5bccd6},'json':!![]});}})['then'](function(_0x23f62a){if(_0x23f62a){if(_0x23f62a[_0x96cc('0x6e')]&&_0x23f62a[_0x96cc('0x6e')]['error']){throw new Error(_0x23f62a[_0x96cc('0x6e')][_0x96cc('0x6f')]['message']);}var _0x289cb2=[];var _0x1a25fd=[];var _0x17011b=[_0x96cc('0x70'),_0x96cc('0x71'),_0x96cc('0x72'),_0x96cc('0x73'),_0x96cc('0x74'),_0x96cc('0x75'),_0x96cc('0x76'),_0x96cc('0x77')];_0x1a25fd=_[_0x96cc('0x78')](_0x23f62a[_0x96cc('0x34')],function(_0x25bebf){return _0x17011b[_0x96cc('0x79')](_0x25bebf[_0x96cc('0x7a')]);});for(var _0x693b1=0x0;_0x693b1<_0x1a25fd[_0x96cc('0x36')];_0x693b1++){if(_0x1a25fd[_0x693b1][_0x96cc('0x7b')]===![]){_0x289cb2[_0x96cc('0x7c')]({'id':_0x1a25fd[_0x693b1]['id'],'name':_0x1a25fd[_0x693b1][_0x96cc('0x7d')],'custom':_0x1a25fd[_0x693b1][_0x96cc('0x7e')],'options':_0x1a25fd[_0x693b1][_0x96cc('0x7f')]==='picklist'&&_0x1a25fd[_0x693b1][_0x96cc('0x80')]['length']>-0x1?_[_0x96cc('0x2a')](_0x1a25fd[_0x693b1][_0x96cc('0x80')],function(_0x463f4f){return{'name':_0x463f4f,'value':_0x463f4f};}):[]});}}return{'count':_0x289cb2[_0x96cc('0x36')],'rows':_0x289cb2};}else{return{'count':0x0,'rows':[]};}})[_0x96cc('0x42')](respondWithResult(_0x572017,null))[_0x96cc('0x47')](function(_0x1c2524){var _0x307f59=_0x1c2cc4[_0x96cc('0x30')][_0x96cc('0x81')]?0x1f4:_0x1c2524[_0x96cc('0x82')]||0x1f4;logger[_0x96cc('0x6f')](_0x96cc('0x83'),'getFields',_0x307f59,JSON[_0x96cc('0x84')](_0x1c2524));delete _0x1c2524[_0x96cc('0x28')];if(_0x307f59===0x191){_0x307f59=0x190;}_0x572017[_0x96cc('0x1b')](_0x307f59)[_0x96cc('0x29')](_0x1c2cc4[_0x96cc('0x30')][_0x96cc('0x81')]?{'message':_0x96cc('0x85'),'statusCode':_0x1c2524['statusCode']}:_0x1c2524);});}; \ No newline at end of file +var _0x670d=['save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','merge','options','include','findAll','rows','catch','show','params','fields','length','create','body','find','order','filter','getConfigurations','addConfiguration','findOne','Subjects','Descriptions','getDescriptions','channel','ZohoConfiguration','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','host','zone','serverUrl','zoho.eu','com','slice','substring','lastIndexOf','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','Call_Result','Call_Start_Time','Call_Type','remove','includes','system_mandatory','push','display_label','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','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','../../mysqldb','../../components/integrations/configuration','status','end','offset','undefined','limit','count','set','Content-Range','reject'];(function(_0xe6a380,_0x4b3c38){var _0x4b5ecc=function(_0x32467c){while(--_0x32467c){_0xe6a380['push'](_0xe6a380['shift']());}};_0x4b5ecc(++_0x4b3c38);}(_0x670d,0x166));var _0xd670=function(_0x8d8ed0,_0x402c19){_0x8d8ed0=_0x8d8ed0-0x0;var _0x28c4fe=_0x670d[_0x8d8ed0];return _0x28c4fe;};'use strict';var emlformat=require(_0xd670('0x0'));var rimraf=require(_0xd670('0x1'));var zipdir=require(_0xd670('0x2'));var jsonpatch=require(_0xd670('0x3'));var rp=require(_0xd670('0x4'));var moment=require(_0xd670('0x5'));var BPromise=require(_0xd670('0x6'));var Mustache=require(_0xd670('0x7'));var util=require(_0xd670('0x8'));var path=require(_0xd670('0x9'));var sox=require(_0xd670('0xa'));var csv=require('to-csv');var ejs=require(_0xd670('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd670('0xc'));var squel=require('squel');var crypto=require(_0xd670('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd670('0xe'));var toCsv=require(_0xd670('0xf'));var querystring=require(_0xd670('0x10'));var Papa=require(_0xd670('0x11'));var Redis=require(_0xd670('0x12'));var authService=require(_0xd670('0x13'));var qs=require(_0xd670('0x14'));var as=require(_0xd670('0x15'));var hardwareService=require(_0xd670('0x16'));var logger=require(_0xd670('0x17'))(_0xd670('0x18'));var utils=require(_0xd670('0x19'));var config=require(_0xd670('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xd670('0x1b'))['db'];var integrations=require(_0xd670('0x1c'));function respondWithStatusCode(_0x5ce7c2,_0x590a6b){_0x590a6b=_0x590a6b||0xcc;return function(_0x5079df){if(_0x5079df){return _0x5ce7c2['sendStatus'](_0x590a6b);}return _0x5ce7c2[_0xd670('0x1d')](_0x590a6b)[_0xd670('0x1e')]();};}function respondWithResult(_0x1c5204,_0xe87ede){_0xe87ede=_0xe87ede||0xc8;return function(_0x2cfc66){if(_0x2cfc66){return _0x1c5204[_0xd670('0x1d')](_0xe87ede)['json'](_0x2cfc66);}};}function respondWithFilteredResult(_0x46d622,_0x341397){return function(_0x76fd64){if(_0x76fd64){var _0x3d8117=typeof _0x341397[_0xd670('0x1f')]===_0xd670('0x20')&&typeof _0x341397[_0xd670('0x21')]===_0xd670('0x20');var _0x39bf0d=_0x76fd64[_0xd670('0x22')];var _0x2249dc=_0x3d8117?0x0:_0x341397['offset'];var _0x407cd9=_0x3d8117?_0x76fd64[_0xd670('0x22')]:_0x341397[_0xd670('0x1f')]+_0x341397[_0xd670('0x21')];var _0x2aab4c;if(_0x407cd9>=_0x39bf0d){_0x407cd9=_0x39bf0d;_0x2aab4c=0xc8;}else{_0x2aab4c=0xce;}_0x46d622['status'](_0x2aab4c);return _0x46d622[_0xd670('0x23')](_0xd670('0x24'),_0x2249dc+'-'+_0x407cd9+'/'+_0x39bf0d)['json'](_0x76fd64);}return null;};}function patchUpdates(_0x2f069e){return function(_0x46d156){try{jsonpatch['apply'](_0x46d156,_0x2f069e,!![]);}catch(_0x211631){return BPromise[_0xd670('0x25')](_0x211631);}return _0x46d156[_0xd670('0x26')]();};}function saveUpdates(_0x55fefc,_0x30cfe9){return function(_0x558b65){if(_0x558b65){return _0x558b65[_0xd670('0x27')](_0x55fefc)[_0xd670('0x28')](function(_0xf1d474){return _0xf1d474;});}return null;};}function removeEntity(_0xa4664d,_0x13c720){return function(_0x114011){if(_0x114011){return _0x114011[_0xd670('0x29')]()[_0xd670('0x28')](function(){_0xa4664d[_0xd670('0x1d')](0xcc)[_0xd670('0x1e')]();});}};}function handleEntityNotFound(_0x401a71,_0x2a7bf5){return function(_0x25b1f1){if(!_0x25b1f1){_0x401a71[_0xd670('0x2a')](0x194);}return _0x25b1f1;};}function handleError(_0x3454f1,_0x22d655){_0x22d655=_0x22d655||0x1f4;return function(_0xe16f6e){logger[_0xd670('0x2b')](_0xe16f6e[_0xd670('0x2c')]);if(_0xe16f6e[_0xd670('0x2d')]){delete _0xe16f6e[_0xd670('0x2d')];}_0x3454f1[_0xd670('0x1d')](_0x22d655)[_0xd670('0x2e')](_0xe16f6e);};}exports[_0xd670('0x2f')]=function(_0x2a4f2b,_0x39e684){var _0x107055={},_0x4bca2d={},_0x17f075={'count':0x0,'rows':[]};var _0x3ff91b=_[_0xd670('0x30')](db[_0xd670('0x31')][_0xd670('0x32')],function(_0x54f53e){return{'name':_0x54f53e[_0xd670('0x33')],'type':_0x54f53e[_0xd670('0x34')]['key']};});_0x4bca2d[_0xd670('0x35')]=_['map'](_0x3ff91b,_0xd670('0x2d'));_0x4bca2d[_0xd670('0x36')]=_[_0xd670('0x37')](_0x2a4f2b[_0xd670('0x36')]);_0x4bca2d[_0xd670('0x38')]=_[_0xd670('0x39')](_0x4bca2d['model'],_0x4bca2d[_0xd670('0x36')]);_0x107055[_0xd670('0x3a')]=_[_0xd670('0x39')](_0x4bca2d['model'],qs['fields'](_0x2a4f2b['query']['fields']));_0x107055[_0xd670('0x3a')]=_0x107055[_0xd670('0x3a')]['length']?_0x107055[_0xd670('0x3a')]:_0x4bca2d['model'];if(!_0x2a4f2b[_0xd670('0x36')][_0xd670('0x3b')](_0xd670('0x3c'))){_0x107055['limit']=qs[_0xd670('0x21')](_0x2a4f2b[_0xd670('0x36')][_0xd670('0x21')]);_0x107055[_0xd670('0x1f')]=qs[_0xd670('0x1f')](_0x2a4f2b[_0xd670('0x36')][_0xd670('0x1f')]);}_0x107055['order']=qs[_0xd670('0x3d')](_0x2a4f2b[_0xd670('0x36')][_0xd670('0x3d')]);_0x107055[_0xd670('0x3e')]=qs[_0xd670('0x38')](_['pick'](_0x2a4f2b['query'],_0x4bca2d[_0xd670('0x38')]),_0x3ff91b);if(_0x2a4f2b[_0xd670('0x36')]['filter']){_0x107055[_0xd670('0x3e')]=_[_0xd670('0x3f')](_0x107055[_0xd670('0x3e')],{'$or':_[_0xd670('0x30')](_0x3ff91b,function(_0x5c10c0){if(_0x5c10c0[_0xd670('0x34')]!=='VIRTUAL'){var _0x5cbb3c={};_0x5cbb3c[_0x5c10c0['name']]={'$like':'%'+_0x2a4f2b[_0xd670('0x36')]['filter']+'%'};return _0x5cbb3c;}})});}_0x107055=_['merge']({},_0x107055,_0x2a4f2b[_0xd670('0x40')]);var _0x37228c={'where':_0x107055[_0xd670('0x3e')]};return db[_0xd670('0x31')][_0xd670('0x22')](_0x37228c)[_0xd670('0x28')](function(_0x2b4677){_0x17f075[_0xd670('0x22')]=_0x2b4677;if(_0x2a4f2b[_0xd670('0x36')]['includeAll']){_0x107055[_0xd670('0x41')]=[{'all':!![]}];}return db['ZohoAccount'][_0xd670('0x42')](_0x107055);})[_0xd670('0x28')](function(_0x3b1cd2){_0x17f075[_0xd670('0x43')]=_0x3b1cd2;return _0x17f075;})['then'](respondWithFilteredResult(_0x39e684,_0x107055))[_0xd670('0x44')](handleError(_0x39e684,null));};exports[_0xd670('0x45')]=function(_0xc9aecc,_0x29203c){var _0x2a5f61={'raw':![],'where':{'id':_0xc9aecc[_0xd670('0x46')]['id']}},_0x161dec={};_0x161dec[_0xd670('0x35')]=_['keys'](db[_0xd670('0x31')][_0xd670('0x32')]);_0x161dec[_0xd670('0x36')]=_[_0xd670('0x37')](_0xc9aecc[_0xd670('0x36')]);_0x161dec[_0xd670('0x38')]=_['intersection'](_0x161dec[_0xd670('0x35')],_0x161dec[_0xd670('0x36')]);_0x2a5f61[_0xd670('0x3a')]=_[_0xd670('0x39')](_0x161dec[_0xd670('0x35')],qs[_0xd670('0x47')](_0xc9aecc[_0xd670('0x36')][_0xd670('0x47')]));_0x2a5f61['attributes']=_0x2a5f61[_0xd670('0x3a')][_0xd670('0x48')]?_0x2a5f61[_0xd670('0x3a')]:_0x161dec['model'];if(_0xc9aecc['query']['includeAll']){_0x2a5f61[_0xd670('0x41')]=[{'all':!![]}];}_0x2a5f61=_[_0xd670('0x3f')]({},_0x2a5f61,_0xc9aecc[_0xd670('0x40')]);return db[_0xd670('0x31')]['find'](_0x2a5f61)[_0xd670('0x28')](handleEntityNotFound(_0x29203c,null))[_0xd670('0x28')](respondWithResult(_0x29203c,null))[_0xd670('0x44')](handleError(_0x29203c,null));};exports['create']=function(_0x2185ba,_0x1afee8){return db['ZohoAccount'][_0xd670('0x49')](_0x2185ba[_0xd670('0x4a')],{})[_0xd670('0x28')](respondWithResult(_0x1afee8,0xc9))[_0xd670('0x44')](handleError(_0x1afee8,null));};exports[_0xd670('0x27')]=function(_0x791fb5,_0x501a80){if(_0x791fb5[_0xd670('0x4a')]['id']){delete _0x791fb5[_0xd670('0x4a')]['id'];}return db[_0xd670('0x31')]['find']({'where':{'id':_0x791fb5['params']['id']}})[_0xd670('0x28')](handleEntityNotFound(_0x501a80,null))['then'](saveUpdates(_0x791fb5[_0xd670('0x4a')],null))['then'](respondWithResult(_0x501a80,null))[_0xd670('0x44')](handleError(_0x501a80,null));};exports[_0xd670('0x29')]=function(_0x592d5c,_0x928429){return db['ZohoAccount'][_0xd670('0x4b')]({'where':{'id':_0x592d5c['params']['id']}})[_0xd670('0x28')](handleEntityNotFound(_0x928429,null))['then'](removeEntity(_0x928429,null))[_0xd670('0x44')](handleError(_0x928429,null));};exports['getConfigurations']=function(_0xbe54a6,_0x46d6b8,_0x20a4e7){var _0x13ff6a={};var _0x3efc43={};var _0x320462;var _0x3592b0;return db['ZohoAccount']['findOne']({'where':{'id':_0xbe54a6[_0xd670('0x46')]['id']}})[_0xd670('0x28')](handleEntityNotFound(_0x46d6b8,null))['then'](function(_0x2265b4){if(_0x2265b4){_0x320462=_0x2265b4;_0x3efc43[_0xd670('0x35')]=_['keys'](db['ZohoConfiguration']['rawAttributes']);_0x3efc43[_0xd670('0x36')]=_['keys'](_0xbe54a6[_0xd670('0x36')]);_0x3efc43['filters']=_[_0xd670('0x39')](_0x3efc43[_0xd670('0x35')],_0x3efc43[_0xd670('0x36')]);_0x13ff6a[_0xd670('0x3a')]=_['intersection'](_0x3efc43[_0xd670('0x35')],qs[_0xd670('0x47')](_0xbe54a6[_0xd670('0x36')][_0xd670('0x47')]));_0x13ff6a[_0xd670('0x3a')]=_0x13ff6a[_0xd670('0x3a')][_0xd670('0x48')]?_0x13ff6a[_0xd670('0x3a')]:_0x3efc43[_0xd670('0x35')];_0x13ff6a[_0xd670('0x4c')]=qs[_0xd670('0x3d')](_0xbe54a6[_0xd670('0x36')][_0xd670('0x3d')]);_0x13ff6a[_0xd670('0x3e')]=qs[_0xd670('0x38')](_['pick'](_0xbe54a6[_0xd670('0x36')],_0x3efc43['filters']));if(_0xbe54a6[_0xd670('0x36')][_0xd670('0x4d')]){_0x13ff6a[_0xd670('0x3e')]=_[_0xd670('0x3f')](_0x13ff6a[_0xd670('0x3e')],{'$or':_[_0xd670('0x30')](_0x13ff6a[_0xd670('0x3a')],function(_0x339998){var _0x2667a5={};_0x2667a5[_0x339998]={'$like':'%'+_0xbe54a6[_0xd670('0x36')][_0xd670('0x4d')]+'%'};return _0x2667a5;})});}_0x13ff6a=_[_0xd670('0x3f')]({},_0x13ff6a,_0xbe54a6[_0xd670('0x40')]);return _0x320462[_0xd670('0x4e')](_0x13ff6a);}})['then'](function(_0x34c270){if(_0x34c270){_0x3592b0=_0x34c270[_0xd670('0x48')];if(!_0xbe54a6[_0xd670('0x36')][_0xd670('0x3b')](_0xd670('0x3c'))){_0x13ff6a[_0xd670('0x21')]=qs[_0xd670('0x21')](_0xbe54a6[_0xd670('0x36')][_0xd670('0x21')]);_0x13ff6a['offset']=qs[_0xd670('0x1f')](_0xbe54a6[_0xd670('0x36')][_0xd670('0x1f')]);}return _0x320462[_0xd670('0x4e')](_0x13ff6a);}})['then'](function(_0x1df361){if(_0x1df361){return _0x1df361?{'count':_0x3592b0,'rows':_0x1df361}:null;}})['then'](respondWithResult(_0x46d6b8,null))[_0xd670('0x44')](handleError(_0x46d6b8,null));};exports[_0xd670('0x4f')]=function(_0x4e04b0,_0x369a27,_0x1c90a2){if(_0x4e04b0[_0xd670('0x4a')]['id']){delete _0x4e04b0['body']['id'];}return db['ZohoAccount'][_0xd670('0x50')]({'where':{'id':_0x4e04b0[_0xd670('0x46')]['id']}})[_0xd670('0x28')](handleEntityNotFound(_0x369a27,null))[_0xd670('0x28')](function(_0x55c1df){if(_0x55c1df){_0x4e04b0['body']['AccountId']=_0x55c1df['id'];_0x4e04b0[_0xd670('0x4a')][_0xd670('0x51')]=integrations['getSubjects'](_0x4e04b0['body']['channel'],_0x4e04b0[_0xd670('0x4a')]['type']);_0x4e04b0[_0xd670('0x4a')][_0xd670('0x52')]=integrations[_0xd670('0x53')](_0x4e04b0['body'][_0xd670('0x54')],_0x4e04b0[_0xd670('0x4a')][_0xd670('0x34')]);return db[_0xd670('0x55')][_0xd670('0x49')](_0x4e04b0[_0xd670('0x4a')],{'include':[{'model':db[_0xd670('0x56')],'as':_0xd670('0x51')},{'model':db[_0xd670('0x56')],'as':_0xd670('0x52')}]});}return null;})['then'](respondWithResult(_0x369a27,null))['catch'](handleError(_0x369a27,null));};function getAccessToken(_0x1ce113){return new Promise(function(_0x3cb69b,_0x5e0d6b){var _0x2f749e;switch(_0x1ce113['zone']){case'US':_0x2f749e=_0xd670('0x57');break;case'AU':_0x2f749e=_0xd670('0x58');break;case'EU':_0x2f749e=_0xd670('0x59');break;case'IN':_0x2f749e=_0xd670('0x5a');break;case'CN':_0x2f749e=_0xd670('0x5b');break;default:_0x2f749e='https://accounts.zoho.eu';break;}var _0x4b735f={'method':'POST','uri':_0x2f749e+_0xd670('0x5c'),'qs':{'refresh_token':_0x1ce113[_0xd670('0x5d')],'client_id':_0x1ce113[_0xd670('0x5e')],'client_secret':_0x1ce113[_0xd670('0x5f')],'grant_type':_0xd670('0x60')},'json':!![]};return rp(_0x4b735f)[_0xd670('0x28')](function(_0x3ae029){if(_0x3ae029['access_token']){_0x3cb69b(_0x3ae029[_0xd670('0x61')]);}else{_0x5e0d6b('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xd670('0x44')](function(_0x533dbf){_0x5e0d6b(_0x533dbf);});});}exports[_0xd670('0x62')]=function(_0x5f7952,_0x9c25cc,_0x505697){var _0x5cd56f,_0x2e1c18,_0x4da8d1,_0x35803d,_0x12eb69;return db[_0xd670('0x31')]['findOne']({'where':{'id':_0x5f7952[_0xd670('0x46')]['id']},'attributes':['id',_0xd670('0x63'),_0xd670('0x64'),_0xd670('0x5e'),_0xd670('0x5f'),_0xd670('0x65'),'code',_0xd670('0x5d')]})[_0xd670('0x28')](handleEntityNotFound(_0x9c25cc,null))[_0xd670('0x28')](function(_0x14dbe6){_0x12eb69=_0x14dbe6;_0x5cd56f=_0x12eb69[_0xd670('0x63')];_0x2e1c18=_0x5cd56f===_0xd670('0x66')?'eu':_0xd670('0x67');_0x4da8d1=_0x12eb69[_0xd670('0x65')];var _0x9cd081=_0x4da8d1[_0xd670('0x68')](-0x1);if(_0x9cd081==='/'||_0x9cd081==='\x5c'||_0x9cd081===':'){_0x4da8d1=_0x4da8d1[_0xd670('0x69')](0x0,_0x4da8d1[_0xd670('0x6a')](_0x9cd081));}if(!_0x12eb69[_0xd670('0x5d')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x12eb69);})[_0xd670('0x28')](function(_0x589056){if(_0x589056){return rp({'method':_0xd670('0x6b'),'uri':util[_0xd670('0x6c')](_0xd670('0x6d'),_0x2e1c18),'qs':{'module':'Calls'},'headers':{'Authorization':_0xd670('0x6e')+_0x589056},'json':!![]});}})[_0xd670('0x28')](function(_0x33bf5c){if(_0x33bf5c){if(_0x33bf5c[_0xd670('0x6f')]&&_0x33bf5c[_0xd670('0x6f')][_0xd670('0x2b')]){throw new Error(_0x33bf5c[_0xd670('0x6f')][_0xd670('0x2b')][_0xd670('0x70')]);}var _0x3cc7ef=[];var _0x5bbe6a=[];var _0x2ac129=[_0xd670('0x71'),_0xd670('0x72'),_0xd670('0x73'),'WhoId','Call_Duration',_0xd670('0x74'),_0xd670('0x75'),_0xd670('0x76')];_0x5bbe6a=_[_0xd670('0x77')](_0x33bf5c[_0xd670('0x47')],function(_0x41635e){return _0x2ac129[_0xd670('0x78')](_0x41635e['api_name']);});for(var _0xbadc6a=0x0;_0xbadc6a<_0x5bbe6a[_0xd670('0x48')];_0xbadc6a++){if(_0x5bbe6a[_0xbadc6a][_0xd670('0x79')]===![]){_0x3cc7ef[_0xd670('0x7a')]({'id':_0x5bbe6a[_0xbadc6a]['id'],'name':_0x5bbe6a[_0xbadc6a][_0xd670('0x7b')],'custom':_0x5bbe6a[_0xbadc6a]['custom_field'],'options':_0x5bbe6a[_0xbadc6a][_0xd670('0x7c')]===_0xd670('0x7d')&&_0x5bbe6a[_0xbadc6a]['pick_list_values']['length']>-0x1?_['map'](_0x5bbe6a[_0xbadc6a][_0xd670('0x7e')],function(_0x471538){return{'name':_0x471538,'value':_0x471538};}):[]});}}return{'count':_0x3cc7ef[_0xd670('0x48')],'rows':_0x3cc7ef};}else{return{'count':0x0,'rows':[]};}})[_0xd670('0x28')](respondWithResult(_0x9c25cc,null))['catch'](function(_0x5819a2){var _0x10fe6e=_0x5f7952[_0xd670('0x36')][_0xd670('0x7f')]?0x1f4:_0x5819a2[_0xd670('0x80')]||0x1f4;logger['error'](_0xd670('0x81'),_0xd670('0x62'),_0x10fe6e,JSON[_0xd670('0x82')](_0x5819a2));delete _0x5819a2[_0xd670('0x2d')];if(_0x10fe6e===0x191){_0x10fe6e=0x190;}_0x9c25cc[_0xd670('0x1d')](_0x10fe6e)['send'](_0x5f7952[_0xd670('0x36')]['test']?{'message':_0xd670('0x83'),'statusCode':_0x5819a2[_0xd670('0x80')]}:_0x5819a2);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 6bc283b..cf91192 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 _0x5f44=['request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','define','int_zoho_accounts','changed','zone','clientId','clientSecret','code','host','serverUrl','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','refresh_token','refreshToken','format','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','parse','info','lodash','util','../../config/logger','moment','bluebird'];(function(_0x4c2b2c,_0x2dec1c){var _0x48edba=function(_0x366446){while(--_0x366446){_0x4c2b2c['push'](_0x4c2b2c['shift']());}};_0x48edba(++_0x2dec1c);}(_0x5f44,0x1e7));var _0x45f4=function(_0x22abf5,_0x3ec4c5){_0x22abf5=_0x22abf5-0x0;var _0x5f078a=_0x5f44[_0x22abf5];return _0x5f078a;};'use strict';var _=require(_0x45f4('0x0'));var util=require(_0x45f4('0x1'));var logger=require(_0x45f4('0x2'))('api');var moment=require(_0x45f4('0x3'));var BPromise=require(_0x45f4('0x4'));var rp=require(_0x45f4('0x5'));var fs=require('fs');var path=require(_0x45f4('0x6'));var rimraf=require(_0x45f4('0x7'));var config=require(_0x45f4('0x8'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x45f4('0x9'));module['exports']=function(_0x3e9672,_0x257f78){return _0x3e9672[_0x45f4('0xa')]('ZohoAccount',attributes,{'tableName':_0x45f4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1231ee,_0x50fe21,_0x517b9b){if(_0x1231ee[_0x45f4('0xc')](_0x45f4('0xd'))||_0x1231ee[_0x45f4('0xc')]('serverUrl')||_0x1231ee[_0x45f4('0xc')](_0x45f4('0xe'))||_0x1231ee[_0x45f4('0xc')](_0x45f4('0xf'))||_0x1231ee[_0x45f4('0xc')](_0x45f4('0x10'))||_0x1231ee[_0x45f4('0xc')](_0x45f4('0x11'))){var _0x4c6026,_0x4eb8d1;_0x4c6026=_0x1231ee[_0x45f4('0x12')];var _0xfb7da2=_0x4c6026[_0x45f4('0x13')](-0x1);if(_0xfb7da2==='/'||_0xfb7da2==='\x5c'||_0xfb7da2===':'){_0x4c6026=_0x4c6026[_0x45f4('0x14')](0x0,_0x4c6026[_0x45f4('0x15')](_0xfb7da2));}switch(_0x1231ee[_0x45f4('0xd')]){case'US':_0x4eb8d1=_0x45f4('0x16');break;case'AU':_0x4eb8d1=_0x45f4('0x17');break;case'IN':_0x4eb8d1=_0x45f4('0x18');break;case'CN':_0x4eb8d1=_0x45f4('0x19');break;default:_0x4eb8d1='https://accounts.zoho.eu';break;}var _0x1da297={'method':_0x45f4('0x1a'),'uri':_0x4eb8d1+_0x45f4('0x1b'),'form':{'grant_type':_0x45f4('0x1c'),'client_id':_0x1231ee['clientId'],'client_secret':_0x1231ee[_0x45f4('0xf')],'redirect_uri':_0x1231ee[_0x45f4('0x12')],'code':_0x1231ee[_0x45f4('0x10')]},'headers':{'Content-Type':_0x45f4('0x1d')}};return rp(_0x1da297)[_0x45f4('0x1e')](function(_0x1809eb){var _0x636b14=JSON['parse'](_0x1809eb);if(_0x636b14[_0x45f4('0x1f')]){_0x1231ee[_0x45f4('0x20')]=_0x636b14[_0x45f4('0x1f')];logger['info'](util[_0x45f4('0x21')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1231ee['name'],_0x1231ee['id']));}else{logger[_0x45f4('0x22')](util[_0x45f4('0x21')](_0x45f4('0x23'),_0x1231ee[_0x45f4('0x24')],_0x1231ee['id']),util[_0x45f4('0x25')](_0x636b14,{'showHidden':![],'depth':null}));}return _0x517b9b(null,_0x50fe21);})[_0x45f4('0x26')](function(_0x48ae7b){logger[_0x45f4('0x22')](util[_0x45f4('0x21')](_0x45f4('0x23'),_0x1231ee['name'],_0x1231ee['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x517b9b(_0x48ae7b);});}else{return _0x517b9b(null,_0x50fe21);}},'beforeUpdate':function(_0x213b7b,_0x1c60bc,_0x45629b){if(_0x213b7b['changed']('zone')||_0x213b7b[_0x45f4('0xc')](_0x45f4('0x12'))||_0x213b7b[_0x45f4('0xc')]('clientId')||_0x213b7b[_0x45f4('0xc')]('clientSecret')||_0x213b7b[_0x45f4('0xc')](_0x45f4('0x10'))||_0x213b7b[_0x45f4('0xc')](_0x45f4('0x11'))){var _0x4966ae,_0x41c19b;_0x4966ae=_0x213b7b[_0x45f4('0x12')];var _0x17094b=_0x4966ae[_0x45f4('0x13')](-0x1);if(_0x17094b==='/'||_0x17094b==='\x5c'||_0x17094b===':'){_0x4966ae=_0x4966ae[_0x45f4('0x14')](0x0,_0x4966ae['lastIndexOf'](_0x17094b));}switch(_0x213b7b['zone']){case'US':_0x41c19b=_0x45f4('0x16');break;case'AU':_0x41c19b=_0x45f4('0x17');break;case'IN':_0x41c19b=_0x45f4('0x18');break;case'CN':_0x41c19b=_0x45f4('0x19');break;default:_0x41c19b='https://accounts.zoho.eu';break;}var _0x587515={'method':_0x45f4('0x1a'),'uri':_0x41c19b+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x213b7b[_0x45f4('0xe')],'client_secret':_0x213b7b[_0x45f4('0xf')],'redirect_uri':_0x213b7b[_0x45f4('0x12')],'code':_0x213b7b['code']},'headers':{'Content-Type':_0x45f4('0x1d')}};return rp(_0x587515)[_0x45f4('0x1e')](function(_0x5b9ed1){var _0x32215c=JSON[_0x45f4('0x27')](_0x5b9ed1);if(_0x32215c[_0x45f4('0x1f')]){_0x213b7b[_0x45f4('0x20')]=_0x32215c['refresh_token'];logger[_0x45f4('0x28')](util[_0x45f4('0x21')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x213b7b[_0x45f4('0x24')],_0x213b7b['id']));}else{logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x213b7b[_0x45f4('0x24')],_0x213b7b['id']),util['inspect'](_0x32215c,{'showHidden':![],'depth':null}));}return _0x45629b(null,_0x1c60bc);})['catch'](function(_0x1ceadb){logger[_0x45f4('0x22')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x213b7b[_0x45f4('0x24')],_0x213b7b['id']),util[_0x45f4('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x45629b(_0x1ceadb);});}else{return _0x45629b(null,_0x1c60bc);}}}});}; \ No newline at end of file +var _0x422a=['POST','/oauth/v2/token','application/x-www-form-urlencoded','then','parse','refresh_token','name','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','host','https://accounts.zoho.eu','authorization_code','clientId','code','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientSecret','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn'];(function(_0x212b5d,_0x318113){var _0xd29835=function(_0x39dc22){while(--_0x39dc22){_0x212b5d['push'](_0x212b5d['shift']());}};_0xd29835(++_0x318113);}(_0x422a,0x174));var _0xa422=function(_0x462549,_0x2be674){_0x462549=_0x462549-0x0;var _0x150a6e=_0x422a[_0x462549];return _0x150a6e;};'use strict';var _=require(_0xa422('0x0'));var util=require('util');var logger=require(_0xa422('0x1'))('api');var moment=require(_0xa422('0x2'));var BPromise=require('bluebird');var rp=require(_0xa422('0x3'));var fs=require('fs');var path=require(_0xa422('0x4'));var rimraf=require(_0xa422('0x5'));var config=require(_0xa422('0x6'));var attributes=require(_0xa422('0x7'));var integrations=require(_0xa422('0x8'));module[_0xa422('0x9')]=function(_0x62e5c3,_0x4b668c){return _0x62e5c3[_0xa422('0xa')](_0xa422('0xb'),attributes,{'tableName':_0xa422('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4057fd,_0x3275dc,_0x276ce6){if(_0x4057fd[_0xa422('0xd')](_0xa422('0xe'))||_0x4057fd[_0xa422('0xd')](_0xa422('0xf'))||_0x4057fd[_0xa422('0xd')]('clientId')||_0x4057fd[_0xa422('0xd')](_0xa422('0x10'))||_0x4057fd[_0xa422('0xd')]('code')||_0x4057fd['changed']('host')){var _0x12b9e0,_0x26934a;_0x12b9e0=_0x4057fd[_0xa422('0xf')];var _0x281762=_0x12b9e0[_0xa422('0x11')](-0x1);if(_0x281762==='/'||_0x281762==='\x5c'||_0x281762===':'){_0x12b9e0=_0x12b9e0[_0xa422('0x12')](0x0,_0x12b9e0[_0xa422('0x13')](_0x281762));}switch(_0x4057fd[_0xa422('0xe')]){case'US':_0x26934a=_0xa422('0x14');break;case'AU':_0x26934a=_0xa422('0x15');break;case'IN':_0x26934a=_0xa422('0x16');break;case'CN':_0x26934a=_0xa422('0x17');break;default:_0x26934a='https://accounts.zoho.eu';break;}var _0x1cc134={'method':_0xa422('0x18'),'uri':_0x26934a+_0xa422('0x19'),'form':{'grant_type':'authorization_code','client_id':_0x4057fd['clientId'],'client_secret':_0x4057fd['clientSecret'],'redirect_uri':_0x4057fd[_0xa422('0xf')],'code':_0x4057fd['code']},'headers':{'Content-Type':_0xa422('0x1a')}};return rp(_0x1cc134)[_0xa422('0x1b')](function(_0x5bf6b5){var _0x1835ce=JSON[_0xa422('0x1c')](_0x5bf6b5);if(_0x1835ce[_0xa422('0x1d')]){_0x4057fd['refreshToken']=_0x1835ce['refresh_token'];logger['info'](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4057fd[_0xa422('0x1e')],_0x4057fd['id']));}else{logger['error'](util[_0xa422('0x1f')](_0xa422('0x20'),_0x4057fd[_0xa422('0x1e')],_0x4057fd['id']),util[_0xa422('0x21')](_0x1835ce,{'showHidden':![],'depth':null}));}return _0x276ce6(null,_0x3275dc);})[_0xa422('0x22')](function(_0x58b3de){logger['error'](util[_0xa422('0x1f')](_0xa422('0x20'),_0x4057fd['name'],_0x4057fd['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x276ce6(_0x58b3de);});}else{return _0x276ce6(null,_0x3275dc);}},'beforeUpdate':function(_0x3c1190,_0x241eea,_0x12636c){if(_0x3c1190[_0xa422('0xd')]('zone')||_0x3c1190[_0xa422('0xd')](_0xa422('0xf'))||_0x3c1190['changed']('clientId')||_0x3c1190[_0xa422('0xd')](_0xa422('0x10'))||_0x3c1190['changed']('code')||_0x3c1190['changed'](_0xa422('0x23'))){var _0x363b9a,_0x3f0821;_0x363b9a=_0x3c1190[_0xa422('0xf')];var _0x1c0ddd=_0x363b9a[_0xa422('0x11')](-0x1);if(_0x1c0ddd==='/'||_0x1c0ddd==='\x5c'||_0x1c0ddd===':'){_0x363b9a=_0x363b9a[_0xa422('0x12')](0x0,_0x363b9a[_0xa422('0x13')](_0x1c0ddd));}switch(_0x3c1190['zone']){case'US':_0x3f0821=_0xa422('0x14');break;case'AU':_0x3f0821='https://accounts.zoho.com.au';break;case'IN':_0x3f0821=_0xa422('0x16');break;case'CN':_0x3f0821=_0xa422('0x17');break;default:_0x3f0821=_0xa422('0x24');break;}var _0x314d78={'method':_0xa422('0x18'),'uri':_0x3f0821+'/oauth/v2/token','form':{'grant_type':_0xa422('0x25'),'client_id':_0x3c1190[_0xa422('0x26')],'client_secret':_0x3c1190['clientSecret'],'redirect_uri':_0x3c1190[_0xa422('0xf')],'code':_0x3c1190[_0xa422('0x27')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x314d78)[_0xa422('0x1b')](function(_0x441ef4){var _0x29622f=JSON[_0xa422('0x1c')](_0x441ef4);if(_0x29622f[_0xa422('0x1d')]){_0x3c1190[_0xa422('0x28')]=_0x29622f['refresh_token'];logger[_0xa422('0x29')](util['format'](_0xa422('0x2a'),_0x3c1190[_0xa422('0x1e')],_0x3c1190['id']));}else{logger['error'](util[_0xa422('0x1f')](_0xa422('0x20'),_0x3c1190[_0xa422('0x1e')],_0x3c1190['id']),util['inspect'](_0x29622f,{'showHidden':![],'depth':null}));}return _0x12636c(null,_0x241eea);})[_0xa422('0x22')](function(_0x1d18e1){logger[_0xa422('0x2b')](util[_0xa422('0x1f')](_0xa422('0x20'),_0x3c1190[_0xa422('0x1e')],_0x3c1190['id']),util[_0xa422('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x12636c(_0x1d18e1);});}else{return _0x12636c(null,_0x241eea);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 98d41fc..d743f1c 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 _0x806d=['util','moment','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','ZohoAccount,\x20%s,\x20%s','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','where','limit','include','model','attributes','debug','ShowZohoAccount','raw','map','stringify','lodash'];(function(_0x1558d8,_0x5ee33f){var _0x364b86=function(_0x51206e){while(--_0x51206e){_0x1558d8['push'](_0x1558d8['shift']());}};_0x364b86(++_0x5ee33f);}(_0x806d,0x131));var _0xd806=function(_0x3a9e1f,_0x4e2f93){_0x3a9e1f=_0x3a9e1f-0x0;var _0x57d6a3=_0x806d[_0x3a9e1f];return _0x57d6a3;};'use strict';var _=require(_0xd806('0x0'));var util=require(_0xd806('0x1'));var moment=require(_0xd806('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd806('0x3'))['db'];var utils=require(_0xd806('0x4'));var logger=require('../../config/logger')(_0xd806('0x5'));var config=require('../../config/environment');var jayson=require(_0xd806('0x6'));var client=jayson[_0xd806('0x7')][_0xd806('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x26135a,_0x3a3446,_0x3873bf){return new BPromise(function(_0x1c1932,_0x4c8dea){return client[_0xd806('0x9')](_0x26135a,_0x3873bf)[_0xd806('0xa')](function(_0x902695){logger[_0xd806('0xb')]('ZohoAccount,\x20%s,\x20%s',_0x3a3446,_0xd806('0xc'));logger['debug'](_0xd806('0xd'),_0x3a3446,_0xd806('0xc'),JSON['stringify'](_0x902695));if(_0x902695[_0xd806('0xe')]){if(_0x902695[_0xd806('0xe')][_0xd806('0xf')]===0x1f4){logger[_0xd806('0xe')](_0xd806('0x10'),_0x3a3446,_0x902695[_0xd806('0xe')][_0xd806('0x11')]);return _0x4c8dea(_0x902695[_0xd806('0xe')][_0xd806('0x11')]);}logger[_0xd806('0xe')](_0xd806('0x10'),_0x3a3446,_0x902695['error'][_0xd806('0x11')]);return _0x1c1932(_0x902695[_0xd806('0xe')][_0xd806('0x11')]);}else{logger['info'](_0xd806('0x10'),_0x3a3446,'request\x20sent');_0x1c1932(_0x902695[_0xd806('0x12')][_0xd806('0x11')]);}})[_0xd806('0x13')](function(_0x138725){logger[_0xd806('0xe')](_0xd806('0x10'),_0x3a3446,_0x138725);_0x4c8dea(_0x138725);});});}exports[_0xd806('0x14')]=function(_0x332eec){var _0x1c9ce4=this;return new Promise(function(_0x5bd7a1,_0x38c659){return db[_0xd806('0x15')][_0xd806('0x16')]({'raw':_0x332eec['options']?_0x332eec[_0xd806('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x332eec[_0xd806('0x17')]?_0x332eec[_0xd806('0x17')][_0xd806('0x18')]||null:null,'attributes':_0x332eec[_0xd806('0x17')]?_0x332eec[_0xd806('0x17')]['attributes']||null:null,'limit':_0x332eec['options']?_0x332eec[_0xd806('0x17')][_0xd806('0x19')]||null:null,'include':_0x332eec[_0xd806('0x17')]?_0x332eec[_0xd806('0x17')][_0xd806('0x1a')]?_['map'](_0x332eec['options'][_0xd806('0x1a')],function(_0x1335c9){return{'model':db[_0x1335c9[_0xd806('0x1b')]],'as':_0x1335c9['as'],'attributes':_0x1335c9[_0xd806('0x1c')],'include':_0x1335c9[_0xd806('0x1a')]?_['map'](_0x1335c9[_0xd806('0x1a')],function(_0xf8df1e){return{'model':db[_0xf8df1e['model']],'as':_0xf8df1e['as'],'attributes':_0xf8df1e['attributes'],'include':_0xf8df1e[_0xd806('0x1a')]?_['map'](_0xf8df1e[_0xd806('0x1a')],function(_0xe9664e){return{'model':db[_0xe9664e[_0xd806('0x1b')]],'as':_0xe9664e['as'],'attributes':_0xe9664e[_0xd806('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd806('0xa')](function(_0x59b43d){logger['info'](_0xd806('0x14'),_0x332eec);logger[_0xd806('0x1d')](_0xd806('0x14'),_0x332eec,JSON['stringify'](_0x59b43d));_0x5bd7a1(_0x59b43d);})[_0xd806('0x13')](function(_0x25a2f0){logger[_0xd806('0xe')]('GetZohoAccount',_0x25a2f0[_0xd806('0x11')],_0x332eec);_0x38c659(_0x1c9ce4[_0xd806('0xe')](0x1f4,_0x25a2f0[_0xd806('0x11')]));});});};exports[_0xd806('0x1e')]=function(_0x34d45f){var _0x183d67=this;return new Promise(function(_0x49103a,_0x5845b4){return db['ZohoAccount']['find']({'raw':_0x34d45f[_0xd806('0x17')]?_0x34d45f[_0xd806('0x17')][_0xd806('0x1f')]===undefined?!![]:![]:!![],'where':_0x34d45f[_0xd806('0x17')]?_0x34d45f[_0xd806('0x17')][_0xd806('0x18')]||null:null,'attributes':_0x34d45f[_0xd806('0x17')]?_0x34d45f[_0xd806('0x17')][_0xd806('0x1c')]||null:null,'include':_0x34d45f['options']?_0x34d45f[_0xd806('0x17')][_0xd806('0x1a')]?_[_0xd806('0x20')](_0x34d45f[_0xd806('0x17')]['include'],function(_0x454e28){return{'model':db[_0x454e28['model']],'as':_0x454e28['as'],'attributes':_0x454e28[_0xd806('0x1c')],'include':_0x454e28['include']?_['map'](_0x454e28[_0xd806('0x1a')],function(_0x159c1e){return{'model':db[_0x159c1e['model']],'as':_0x159c1e['as'],'attributes':_0x159c1e[_0xd806('0x1c')],'include':_0x159c1e[_0xd806('0x1a')]?_['map'](_0x159c1e[_0xd806('0x1a')],function(_0x2a94a3){return{'model':db[_0x2a94a3['model']],'as':_0x2a94a3['as'],'attributes':_0x2a94a3[_0xd806('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd806('0xa')](function(_0x51a417){logger['info'](_0xd806('0x1e'),_0x34d45f);logger[_0xd806('0x1d')]('ShowZohoAccount',_0x34d45f,JSON[_0xd806('0x21')](_0x51a417));_0x49103a(_0x51a417);})[_0xd806('0x13')](function(_0x5ed466){logger['error']('ShowZohoAccount',_0x5ed466[_0xd806('0x11')],_0x34d45f);_0x5845b4(_0x183d67[_0xd806('0xe')](0x1f4,_0x5ed466[_0xd806('0x11')]));});});}; \ No newline at end of file +var _0x9536=['code','message','info','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowZohoAccount','find','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9536,0x179));var _0x6953=function(_0x5b3950,_0x4e5556){_0x5b3950=_0x5b3950-0x0;var _0x41e436=_0x9536[_0x5b3950];return _0x41e436;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var moment=require(_0x6953('0x2'));var BPromise=require(_0x6953('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6953('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6953('0x5'));var logger=require(_0x6953('0x6'))(_0x6953('0x7'));var config=require(_0x6953('0x8'));var jayson=require(_0x6953('0x9'));var client=jayson['client'][_0x6953('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bb026,_0x385f2d,_0x3e1aff){return new BPromise(function(_0x1c8225,_0x58ac30){return client[_0x6953('0xb')](_0x2bb026,_0x3e1aff)[_0x6953('0xc')](function(_0x449acb){logger['info'](_0x6953('0xd'),_0x385f2d,_0x6953('0xe'));logger[_0x6953('0xf')](_0x6953('0x10'),_0x385f2d,_0x6953('0xe'),JSON[_0x6953('0x11')](_0x449acb));if(_0x449acb[_0x6953('0x12')]){if(_0x449acb[_0x6953('0x12')][_0x6953('0x13')]===0x1f4){logger['error'](_0x6953('0xd'),_0x385f2d,_0x449acb['error'][_0x6953('0x14')]);return _0x58ac30(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}logger[_0x6953('0x12')](_0x6953('0xd'),_0x385f2d,_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);return _0x1c8225(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}else{logger[_0x6953('0x15')](_0x6953('0xd'),_0x385f2d,'request\x20sent');_0x1c8225(_0x449acb['result'][_0x6953('0x14')]);}})[_0x6953('0x16')](function(_0x16b79b){logger[_0x6953('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x385f2d,_0x16b79b);_0x58ac30(_0x16b79b);});});}exports[_0x6953('0x17')]=function(_0x2da771){var _0x4b43ae=this;return new Promise(function(_0x10858a,_0x3207dd){return db[_0x6953('0x18')][_0x6953('0x19')]({'raw':_0x2da771[_0x6953('0x1a')]?_0x2da771['options'][_0x6953('0x1b')]===undefined?!![]:![]:!![],'where':_0x2da771[_0x6953('0x1a')]?_0x2da771[_0x6953('0x1a')][_0x6953('0x1c')]||null:null,'attributes':_0x2da771[_0x6953('0x1a')]?_0x2da771['options'][_0x6953('0x1d')]||null:null,'limit':_0x2da771[_0x6953('0x1a')]?_0x2da771['options'][_0x6953('0x1e')]||null:null,'include':_0x2da771[_0x6953('0x1a')]?_0x2da771[_0x6953('0x1a')][_0x6953('0x1f')]?_['map'](_0x2da771[_0x6953('0x1a')][_0x6953('0x1f')],function(_0x2a7f6a){return{'model':db[_0x2a7f6a['model']],'as':_0x2a7f6a['as'],'attributes':_0x2a7f6a['attributes'],'include':_0x2a7f6a['include']?_[_0x6953('0x20')](_0x2a7f6a[_0x6953('0x1f')],function(_0x550be4){return{'model':db[_0x550be4[_0x6953('0x21')]],'as':_0x550be4['as'],'attributes':_0x550be4['attributes'],'include':_0x550be4[_0x6953('0x1f')]?_[_0x6953('0x20')](_0x550be4[_0x6953('0x1f')],function(_0x2cc01e){return{'model':db[_0x2cc01e[_0x6953('0x21')]],'as':_0x2cc01e['as'],'attributes':_0x2cc01e[_0x6953('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dd890){logger[_0x6953('0x15')]('GetZohoAccount',_0x2da771);logger[_0x6953('0xf')]('GetZohoAccount',_0x2da771,JSON[_0x6953('0x11')](_0x3dd890));_0x10858a(_0x3dd890);})[_0x6953('0x16')](function(_0x426c7c){logger['error'](_0x6953('0x17'),_0x426c7c[_0x6953('0x14')],_0x2da771);_0x3207dd(_0x4b43ae[_0x6953('0x12')](0x1f4,_0x426c7c['message']));});});};exports[_0x6953('0x22')]=function(_0x132a71){var _0x481c6a=this;return new Promise(function(_0x4d856d,_0xd80e42){return db[_0x6953('0x18')][_0x6953('0x23')]({'raw':_0x132a71[_0x6953('0x1a')]?_0x132a71[_0x6953('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x132a71[_0x6953('0x1a')]?_0x132a71['options'][_0x6953('0x1c')]||null:null,'attributes':_0x132a71[_0x6953('0x1a')]?_0x132a71['options']['attributes']||null:null,'include':_0x132a71[_0x6953('0x1a')]?_0x132a71[_0x6953('0x1a')][_0x6953('0x1f')]?_['map'](_0x132a71[_0x6953('0x1a')]['include'],function(_0x4e95f1){return{'model':db[_0x4e95f1['model']],'as':_0x4e95f1['as'],'attributes':_0x4e95f1['attributes'],'include':_0x4e95f1[_0x6953('0x1f')]?_[_0x6953('0x20')](_0x4e95f1[_0x6953('0x1f')],function(_0x11f316){return{'model':db[_0x11f316[_0x6953('0x21')]],'as':_0x11f316['as'],'attributes':_0x11f316[_0x6953('0x1d')],'include':_0x11f316['include']?_[_0x6953('0x20')](_0x11f316['include'],function(_0x199c67){return{'model':db[_0x199c67['model']],'as':_0x199c67['as'],'attributes':_0x199c67[_0x6953('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6953('0xc')](function(_0xd81149){logger[_0x6953('0x15')]('ShowZohoAccount',_0x132a71);logger[_0x6953('0xf')](_0x6953('0x22'),_0x132a71,JSON[_0x6953('0x11')](_0xd81149));_0x4d856d(_0xd81149);})[_0x6953('0x16')](function(_0x40b6ea){logger[_0x6953('0x12')](_0x6953('0x22'),_0x40b6ea[_0x6953('0x14')],_0x132a71);_0xd80e42(_0x481c6a[_0x6953('0x12')](0x1f4,_0x40b6ea[_0x6953('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 4139917..a234ab5 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 _0x7cfb=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','./intZohoConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','/:id/descriptions','getDescriptions','create','update','delete','destroy','exports','multer','util'];(function(_0x1fdb40,_0x51351c){var _0x281f93=function(_0x35eebe){while(--_0x35eebe){_0x1fdb40['push'](_0x1fdb40['shift']());}};_0x281f93(++_0x51351c);}(_0x7cfb,0x91));var _0xb7cf=function(_0xafe600,_0x292e0f){_0xafe600=_0xafe600-0x0;var _0x571003=_0x7cfb[_0xafe600];return _0x571003;};'use strict';var multer=require(_0xb7cf('0x0'));var util=require(_0xb7cf('0x1'));var path=require(_0xb7cf('0x2'));var timeout=require(_0xb7cf('0x3'));var express=require('express');var router=express[_0xb7cf('0x4')]();var fs_extra=require(_0xb7cf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb7cf('0x6'));var config=require('../../config/environment');var controller=require(_0xb7cf('0x7'));router[_0xb7cf('0x8')]('/',auth['isAuthenticated'](),controller[_0xb7cf('0x9')]);router['get'](_0xb7cf('0xa'),auth[_0xb7cf('0xb')](),controller['show']);router['get'](_0xb7cf('0xc'),auth['isAuthenticated'](),controller[_0xb7cf('0xd')]);router[_0xb7cf('0x8')]('/:id/subjects',auth[_0xb7cf('0xb')](),controller['getSubjects']);router[_0xb7cf('0x8')](_0xb7cf('0xe'),auth['isAuthenticated'](),controller[_0xb7cf('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb7cf('0x10')]);router['put'](_0xb7cf('0xa'),auth[_0xb7cf('0xb')](),controller[_0xb7cf('0x11')]);router[_0xb7cf('0x12')](_0xb7cf('0xa'),auth[_0xb7cf('0xb')](),controller[_0xb7cf('0x13')]);module[_0xb7cf('0x14')]=router; \ No newline at end of file +var _0x2f3d=['/:id/descriptions','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','show','getFields','/:id/subjects','getSubjects'];(function(_0x4a571a,_0x166ebf){var _0x5453ce=function(_0x3247fa){while(--_0x3247fa){_0x4a571a['push'](_0x4a571a['shift']());}};_0x5453ce(++_0x166ebf);}(_0x2f3d,0x110));var _0xd2f3=function(_0x38ffbc,_0x233236){_0x38ffbc=_0x38ffbc-0x0;var _0x46e278=_0x2f3d[_0x38ffbc];return _0x46e278;};'use strict';var multer=require(_0xd2f3('0x0'));var util=require(_0xd2f3('0x1'));var path=require(_0xd2f3('0x2'));var timeout=require(_0xd2f3('0x3'));var express=require(_0xd2f3('0x4'));var router=express[_0xd2f3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd2f3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd2f3('0x7'));var controller=require(_0xd2f3('0x8'));router[_0xd2f3('0x9')]('/',auth[_0xd2f3('0xa')](),controller[_0xd2f3('0xb')]);router[_0xd2f3('0x9')]('/:id',auth[_0xd2f3('0xa')](),controller[_0xd2f3('0xc')]);router[_0xd2f3('0x9')]('/:id/fields',auth[_0xd2f3('0xa')](),controller[_0xd2f3('0xd')]);router[_0xd2f3('0x9')](_0xd2f3('0xe'),auth[_0xd2f3('0xa')](),controller[_0xd2f3('0xf')]);router[_0xd2f3('0x9')](_0xd2f3('0x10'),auth[_0xd2f3('0xa')](),controller['getDescriptions']);router[_0xd2f3('0x11')]('/',auth[_0xd2f3('0xa')](),controller['create']);router[_0xd2f3('0x12')](_0xd2f3('0x13'),auth[_0xd2f3('0xa')](),controller[_0xd2f3('0x14')]);router[_0xd2f3('0x15')](_0xd2f3('0x13'),auth[_0xd2f3('0xa')](),controller[_0xd2f3('0x16')]);module[_0xd2f3('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index eb14699..07fc585 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 _0x6cad=['STRING','ENUM','lead','contact','nothing','contact_lead','sequelize'];(function(_0x2dfd4d,_0x764ef8){var _0xf03e86=function(_0x31cd00){while(--_0x31cd00){_0x2dfd4d['push'](_0x2dfd4d['shift']());}};_0xf03e86(++_0x764ef8);}(_0x6cad,0x13a));var _0xd6ca=function(_0x4b5c48,_0x149eba){_0x4b5c48=_0x4b5c48-0x0;var _0x126bea=_0x6cad[_0x4b5c48];return _0x126bea;};'use strict';var Sequelize=require(_0xd6ca('0x0'));module['exports']={'name':{'type':Sequelize[_0xd6ca('0x1')]},'moduleCreate':{'type':Sequelize[_0xd6ca('0x2')](_0xd6ca('0x3'),_0xd6ca('0x4'),_0xd6ca('0x5')),'defaultValue':_0xd6ca('0x3')},'moduleSearch':{'type':Sequelize[_0xd6ca('0x2')]('contact_lead','contact',_0xd6ca('0x3')),'defaultValue':_0xd6ca('0x6')},'description':{'type':Sequelize[_0xd6ca('0x1')]}}; \ No newline at end of file +var _0xf377=['ENUM','lead','nothing','contact_lead','STRING','exports'];(function(_0x4c0155,_0x5b20db){var _0x1276db=function(_0x3ff813){while(--_0x3ff813){_0x4c0155['push'](_0x4c0155['shift']());}};_0x1276db(++_0x5b20db);}(_0xf377,0x89));var _0x7f37=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xf377[_0x4e9628];return _0x27bc8c;};'use strict';var Sequelize=require('sequelize');module[_0x7f37('0x0')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x7f37('0x1')](_0x7f37('0x2'),'contact',_0x7f37('0x3')),'defaultValue':_0x7f37('0x2')},'moduleSearch':{'type':Sequelize[_0x7f37('0x1')](_0x7f37('0x4'),'contact','lead'),'defaultValue':_0x7f37('0x4')},'description':{'type':Sequelize[_0x7f37('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 6c9a03e..2f70917 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 _0x39db=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','key','model','map','keys','query','filters','intersection','attributes','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','ZohoConfiguration','include','findAll','rows','show','params','fields','includeAll','find','create','body','catch','destroy','getFields','findOne','nolimit','ZohoField','rawAttributes','length','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv'];(function(_0x385ec9,_0x32f910){var _0x106cf6=function(_0x21ed26){while(--_0x21ed26){_0x385ec9['push'](_0x385ec9['shift']());}};_0x106cf6(++_0x32f910);}(_0x39db,0x97));var _0xb39d=function(_0x442a76,_0x2ad2ff){_0x442a76=_0x442a76-0x0;var _0x474fab=_0x39db[_0x442a76];return _0x474fab;};'use strict';var emlformat=require(_0xb39d('0x0'));var rimraf=require(_0xb39d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb39d('0x2'));var rp=require(_0xb39d('0x3'));var moment=require('moment');var BPromise=require(_0xb39d('0x4'));var Mustache=require(_0xb39d('0x5'));var util=require(_0xb39d('0x6'));var path=require('path');var sox=require(_0xb39d('0x7'));var csv=require(_0xb39d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb39d('0x9'));var crypto=require(_0xb39d('0xa'));var jsforce=require(_0xb39d('0xb'));var deskjs=require(_0xb39d('0xc'));var toCsv=require(_0xb39d('0x8'));var querystring=require(_0xb39d('0xd'));var Papa=require(_0xb39d('0xe'));var Redis=require(_0xb39d('0xf'));var authService=require(_0xb39d('0x10'));var qs=require(_0xb39d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb39d('0x12'))(_0xb39d('0x13'));var utils=require(_0xb39d('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb39d('0x15'));var db=require(_0xb39d('0x16'))['db'];function respondWithStatusCode(_0x4ceffb,_0x240043){_0x240043=_0x240043||0xcc;return function(_0x337ec7){if(_0x337ec7){return _0x4ceffb[_0xb39d('0x17')](_0x240043);}return _0x4ceffb[_0xb39d('0x18')](_0x240043)[_0xb39d('0x19')]();};}function respondWithResult(_0x5a5c81,_0x777275){_0x777275=_0x777275||0xc8;return function(_0x1320c4){if(_0x1320c4){return _0x5a5c81[_0xb39d('0x18')](_0x777275)[_0xb39d('0x1a')](_0x1320c4);}};}function respondWithFilteredResult(_0x16f83c,_0x246f72){return function(_0x16d8d6){if(_0x16d8d6){var _0x584e90=typeof _0x246f72['offset']==='undefined'&&typeof _0x246f72[_0xb39d('0x1b')]===_0xb39d('0x1c');var _0x478955=_0x16d8d6['count'];var _0x3f216a=_0x584e90?0x0:_0x246f72[_0xb39d('0x1d')];var _0x4377de=_0x584e90?_0x16d8d6[_0xb39d('0x1e')]:_0x246f72[_0xb39d('0x1d')]+_0x246f72[_0xb39d('0x1b')];var _0x3b2350;if(_0x4377de>=_0x478955){_0x4377de=_0x478955;_0x3b2350=0xc8;}else{_0x3b2350=0xce;}_0x16f83c['status'](_0x3b2350);return _0x16f83c['set'](_0xb39d('0x1f'),_0x3f216a+'-'+_0x4377de+'/'+_0x478955)[_0xb39d('0x1a')](_0x16d8d6);}return null;};}function patchUpdates(_0x1beaaa){return function(_0x538f8c){try{jsonpatch[_0xb39d('0x20')](_0x538f8c,_0x1beaaa,!![]);}catch(_0x3bc4cf){return BPromise[_0xb39d('0x21')](_0x3bc4cf);}return _0x538f8c[_0xb39d('0x22')]();};}function saveUpdates(_0x47def4,_0x4c14bd){return function(_0xbcdf69){if(_0xbcdf69){return _0xbcdf69[_0xb39d('0x23')](_0x47def4)[_0xb39d('0x24')](function(_0x1a96bd){return _0x1a96bd;});}return null;};}function removeEntity(_0x4d8507,_0x413f73){return function(_0x2bf10c){if(_0x2bf10c){return _0x2bf10c['destroy']()['then'](function(){_0x4d8507['status'](0xcc)[_0xb39d('0x19')]();});}};}function handleEntityNotFound(_0x4d1179,_0x4e185a){return function(_0x55aac8){if(!_0x55aac8){_0x4d1179[_0xb39d('0x17')](0x194);}return _0x55aac8;};}function handleError(_0x3298bc,_0xa6296e){_0xa6296e=_0xa6296e||0x1f4;return function(_0x23098c){logger[_0xb39d('0x25')](_0x23098c[_0xb39d('0x26')]);if(_0x23098c[_0xb39d('0x27')]){delete _0x23098c['name'];}_0x3298bc[_0xb39d('0x18')](_0xa6296e)[_0xb39d('0x28')](_0x23098c);};}exports[_0xb39d('0x29')]=function(_0xcc60fb,_0x15795b){var _0x141a2c={},_0x6adb75={},_0x30995a={'count':0x0,'rows':[]};var _0x4577e9=_['map'](db['ZohoConfiguration']['rawAttributes'],function(_0x48a2ce){return{'name':_0x48a2ce['fieldName'],'type':_0x48a2ce['type'][_0xb39d('0x2a')]};});_0x6adb75[_0xb39d('0x2b')]=_[_0xb39d('0x2c')](_0x4577e9,_0xb39d('0x27'));_0x6adb75['query']=_[_0xb39d('0x2d')](_0xcc60fb[_0xb39d('0x2e')]);_0x6adb75[_0xb39d('0x2f')]=_[_0xb39d('0x30')](_0x6adb75['model'],_0x6adb75['query']);_0x141a2c[_0xb39d('0x31')]=_[_0xb39d('0x30')](_0x6adb75['model'],qs['fields'](_0xcc60fb[_0xb39d('0x2e')]['fields']));_0x141a2c[_0xb39d('0x31')]=_0x141a2c[_0xb39d('0x31')]['length']?_0x141a2c[_0xb39d('0x31')]:_0x6adb75[_0xb39d('0x2b')];if(!_0xcc60fb[_0xb39d('0x2e')][_0xb39d('0x32')]('nolimit')){_0x141a2c[_0xb39d('0x1b')]=qs[_0xb39d('0x1b')](_0xcc60fb['query'][_0xb39d('0x1b')]);_0x141a2c[_0xb39d('0x1d')]=qs[_0xb39d('0x1d')](_0xcc60fb[_0xb39d('0x2e')][_0xb39d('0x1d')]);}_0x141a2c[_0xb39d('0x33')]=qs[_0xb39d('0x34')](_0xcc60fb[_0xb39d('0x2e')][_0xb39d('0x34')]);_0x141a2c[_0xb39d('0x35')]=qs[_0xb39d('0x2f')](_['pick'](_0xcc60fb[_0xb39d('0x2e')],_0x6adb75[_0xb39d('0x2f')]),_0x4577e9);if(_0xcc60fb['query'][_0xb39d('0x36')]){_0x141a2c[_0xb39d('0x35')]=_[_0xb39d('0x37')](_0x141a2c['where'],{'$or':_[_0xb39d('0x2c')](_0x4577e9,function(_0x14373f){if(_0x14373f[_0xb39d('0x38')]!==_0xb39d('0x39')){var _0x36a28f={};_0x36a28f[_0x14373f[_0xb39d('0x27')]]={'$like':'%'+_0xcc60fb[_0xb39d('0x2e')]['filter']+'%'};return _0x36a28f;}})});}_0x141a2c=_[_0xb39d('0x37')]({},_0x141a2c,_0xcc60fb[_0xb39d('0x3a')]);var _0x593351={'where':_0x141a2c[_0xb39d('0x35')]};return db[_0xb39d('0x3b')][_0xb39d('0x1e')](_0x593351)[_0xb39d('0x24')](function(_0x39f6b9){_0x30995a[_0xb39d('0x1e')]=_0x39f6b9;if(_0xcc60fb[_0xb39d('0x2e')]['includeAll']){_0x141a2c[_0xb39d('0x3c')]=[{'all':!![]}];}return db[_0xb39d('0x3b')][_0xb39d('0x3d')](_0x141a2c);})[_0xb39d('0x24')](function(_0x36c357){_0x30995a[_0xb39d('0x3e')]=_0x36c357;return _0x30995a;})[_0xb39d('0x24')](respondWithFilteredResult(_0x15795b,_0x141a2c))['catch'](handleError(_0x15795b,null));};exports[_0xb39d('0x3f')]=function(_0x2936f4,_0x7178c){var _0x541e5d={'raw':![],'where':{'id':_0x2936f4[_0xb39d('0x40')]['id']}},_0x4ab4ff={};_0x4ab4ff[_0xb39d('0x2b')]=_[_0xb39d('0x2d')](db[_0xb39d('0x3b')]['rawAttributes']);_0x4ab4ff[_0xb39d('0x2e')]=_['keys'](_0x2936f4['query']);_0x4ab4ff[_0xb39d('0x2f')]=_[_0xb39d('0x30')](_0x4ab4ff[_0xb39d('0x2b')],_0x4ab4ff[_0xb39d('0x2e')]);_0x541e5d[_0xb39d('0x31')]=_['intersection'](_0x4ab4ff[_0xb39d('0x2b')],qs[_0xb39d('0x41')](_0x2936f4[_0xb39d('0x2e')][_0xb39d('0x41')]));_0x541e5d[_0xb39d('0x31')]=_0x541e5d['attributes']['length']?_0x541e5d['attributes']:_0x4ab4ff[_0xb39d('0x2b')];if(_0x2936f4[_0xb39d('0x2e')][_0xb39d('0x42')]){_0x541e5d[_0xb39d('0x3c')]=[{'all':!![]}];}_0x541e5d=_['merge']({},_0x541e5d,_0x2936f4[_0xb39d('0x3a')]);return db[_0xb39d('0x3b')][_0xb39d('0x43')](_0x541e5d)[_0xb39d('0x24')](handleEntityNotFound(_0x7178c,null))[_0xb39d('0x24')](respondWithResult(_0x7178c,null))['catch'](handleError(_0x7178c,null));};exports[_0xb39d('0x44')]=function(_0x32dfc2,_0xcd7571){return db[_0xb39d('0x3b')][_0xb39d('0x44')](_0x32dfc2[_0xb39d('0x45')],{})[_0xb39d('0x24')](respondWithResult(_0xcd7571,0xc9))[_0xb39d('0x46')](handleError(_0xcd7571,null));};exports[_0xb39d('0x23')]=function(_0x1af16d,_0x1cb589){if(_0x1af16d['body']['id']){delete _0x1af16d[_0xb39d('0x45')]['id'];}return db['ZohoConfiguration']['find']({'where':{'id':_0x1af16d['params']['id']}})[_0xb39d('0x24')](handleEntityNotFound(_0x1cb589,null))[_0xb39d('0x24')](saveUpdates(_0x1af16d[_0xb39d('0x45')],null))['then'](respondWithResult(_0x1cb589,null))[_0xb39d('0x46')](handleError(_0x1cb589,null));};exports[_0xb39d('0x47')]=function(_0x30b49a,_0x4f18b1){return db[_0xb39d('0x3b')][_0xb39d('0x43')]({'where':{'id':_0x30b49a[_0xb39d('0x40')]['id']}})[_0xb39d('0x24')](handleEntityNotFound(_0x4f18b1,null))[_0xb39d('0x24')](removeEntity(_0x4f18b1,null))[_0xb39d('0x46')](handleError(_0x4f18b1,null));};exports[_0xb39d('0x48')]=function(_0x2f2db7,_0x55b2da,_0x48c344){var _0x241e42={};var _0x3f1310={};var _0x4101a9;var _0x1ec8cb;return db[_0xb39d('0x3b')][_0xb39d('0x49')]({'where':{'id':_0x2f2db7[_0xb39d('0x40')]['id']}})[_0xb39d('0x24')](handleEntityNotFound(_0x55b2da,null))[_0xb39d('0x24')](function(_0x5a6216){if(_0x5a6216){_0x4101a9=_0x5a6216;_0x3f1310['model']=_['keys'](db['ZohoField']['rawAttributes']);_0x3f1310[_0xb39d('0x2e')]=_[_0xb39d('0x2d')](_0x2f2db7[_0xb39d('0x2e')]);_0x3f1310['filters']=_['intersection'](_0x3f1310[_0xb39d('0x2b')],_0x3f1310[_0xb39d('0x2e')]);_0x241e42[_0xb39d('0x31')]=_[_0xb39d('0x30')](_0x3f1310[_0xb39d('0x2b')],qs[_0xb39d('0x41')](_0x2f2db7[_0xb39d('0x2e')][_0xb39d('0x41')]));_0x241e42['attributes']=_0x241e42[_0xb39d('0x31')]['length']?_0x241e42[_0xb39d('0x31')]:_0x3f1310['model'];_0x241e42[_0xb39d('0x33')]=qs[_0xb39d('0x34')](_0x2f2db7['query'][_0xb39d('0x34')]);_0x241e42[_0xb39d('0x35')]=qs[_0xb39d('0x2f')](_['pick'](_0x2f2db7[_0xb39d('0x2e')],_0x3f1310[_0xb39d('0x2f')]));if(_0x2f2db7[_0xb39d('0x2e')][_0xb39d('0x36')]){_0x241e42[_0xb39d('0x35')]=_[_0xb39d('0x37')](_0x241e42[_0xb39d('0x35')],{'$or':_[_0xb39d('0x2c')](_0x241e42[_0xb39d('0x31')],function(_0x573a41){var _0x24e119={};_0x24e119[_0x573a41]={'$like':'%'+_0x2f2db7[_0xb39d('0x2e')]['filter']+'%'};return _0x24e119;})});}_0x241e42=_[_0xb39d('0x37')]({},_0x241e42,_0x2f2db7[_0xb39d('0x3a')]);return _0x4101a9['getFields'](_0x241e42);}})[_0xb39d('0x24')](function(_0x452c61){if(_0x452c61){_0x1ec8cb=_0x452c61['length'];if(!_0x2f2db7['query']['hasOwnProperty'](_0xb39d('0x4a'))){_0x241e42[_0xb39d('0x1b')]=qs['limit'](_0x2f2db7['query'][_0xb39d('0x1b')]);_0x241e42[_0xb39d('0x1d')]=qs[_0xb39d('0x1d')](_0x2f2db7[_0xb39d('0x2e')]['offset']);}return _0x4101a9[_0xb39d('0x48')](_0x241e42);}})[_0xb39d('0x24')](function(_0x5ed718){if(_0x5ed718){return _0x5ed718?{'count':_0x1ec8cb,'rows':_0x5ed718}:null;}})['then'](respondWithResult(_0x55b2da,null))[_0xb39d('0x46')](handleError(_0x55b2da,null));};exports['getSubjects']=function(_0x14f3a0,_0xb9c007,_0x273983){var _0x9f6ac5={};var _0x2b9a11={};var _0x65035a;var _0xc0baa8;return db[_0xb39d('0x3b')][_0xb39d('0x49')]({'where':{'id':_0x14f3a0[_0xb39d('0x40')]['id']}})[_0xb39d('0x24')](handleEntityNotFound(_0xb9c007,null))['then'](function(_0xc3127a){if(_0xc3127a){_0x65035a=_0xc3127a;_0x2b9a11[_0xb39d('0x2b')]=_[_0xb39d('0x2d')](db[_0xb39d('0x4b')][_0xb39d('0x4c')]);_0x2b9a11[_0xb39d('0x2e')]=_[_0xb39d('0x2d')](_0x14f3a0['query']);_0x2b9a11[_0xb39d('0x2f')]=_[_0xb39d('0x30')](_0x2b9a11['model'],_0x2b9a11[_0xb39d('0x2e')]);_0x9f6ac5['attributes']=_[_0xb39d('0x30')](_0x2b9a11[_0xb39d('0x2b')],qs[_0xb39d('0x41')](_0x14f3a0[_0xb39d('0x2e')][_0xb39d('0x41')]));_0x9f6ac5['attributes']=_0x9f6ac5[_0xb39d('0x31')][_0xb39d('0x4d')]?_0x9f6ac5[_0xb39d('0x31')]:_0x2b9a11['model'];_0x9f6ac5[_0xb39d('0x33')]=qs[_0xb39d('0x34')](_0x14f3a0[_0xb39d('0x2e')][_0xb39d('0x34')]);_0x9f6ac5[_0xb39d('0x35')]=qs[_0xb39d('0x2f')](_['pick'](_0x14f3a0['query'],_0x2b9a11['filters']));if(_0x14f3a0['query'][_0xb39d('0x36')]){_0x9f6ac5[_0xb39d('0x35')]=_['merge'](_0x9f6ac5[_0xb39d('0x35')],{'$or':_[_0xb39d('0x2c')](_0x9f6ac5[_0xb39d('0x31')],function(_0x139a62){var _0x4a51a3={};_0x4a51a3[_0x139a62]={'$like':'%'+_0x14f3a0[_0xb39d('0x2e')][_0xb39d('0x36')]+'%'};return _0x4a51a3;})});}_0x9f6ac5=_['merge']({},_0x9f6ac5,_0x14f3a0[_0xb39d('0x3a')]);return _0x65035a[_0xb39d('0x4e')](_0x9f6ac5);}})['then'](function(_0x4e00c8){if(_0x4e00c8){_0xc0baa8=_0x4e00c8[_0xb39d('0x4d')];if(!_0x14f3a0[_0xb39d('0x2e')][_0xb39d('0x32')]('nolimit')){_0x9f6ac5[_0xb39d('0x1b')]=qs[_0xb39d('0x1b')](_0x14f3a0[_0xb39d('0x2e')][_0xb39d('0x1b')]);_0x9f6ac5[_0xb39d('0x1d')]=qs[_0xb39d('0x1d')](_0x14f3a0[_0xb39d('0x2e')][_0xb39d('0x1d')]);}return _0x65035a[_0xb39d('0x4e')](_0x9f6ac5);}})[_0xb39d('0x24')](function(_0xe3f079){if(_0xe3f079){return _0xe3f079?{'count':_0xc0baa8,'rows':_0xe3f079}:null;}})['then'](respondWithResult(_0xb9c007,null))[_0xb39d('0x46')](handleError(_0xb9c007,null));};exports[_0xb39d('0x4f')]=function(_0x95736a,_0x1d4224,_0x71661f){var _0x45c309={};var _0x2e1353={};var _0x5c1e8b;var _0x2e4a19;return db[_0xb39d('0x3b')][_0xb39d('0x49')]({'where':{'id':_0x95736a[_0xb39d('0x40')]['id']}})[_0xb39d('0x24')](handleEntityNotFound(_0x1d4224,null))['then'](function(_0x4c83b9){if(_0x4c83b9){_0x5c1e8b=_0x4c83b9;_0x2e1353[_0xb39d('0x2b')]=_[_0xb39d('0x2d')](db[_0xb39d('0x4b')][_0xb39d('0x4c')]);_0x2e1353['query']=_[_0xb39d('0x2d')](_0x95736a[_0xb39d('0x2e')]);_0x2e1353[_0xb39d('0x2f')]=_[_0xb39d('0x30')](_0x2e1353['model'],_0x2e1353[_0xb39d('0x2e')]);_0x45c309[_0xb39d('0x31')]=_[_0xb39d('0x30')](_0x2e1353['model'],qs[_0xb39d('0x41')](_0x95736a['query'][_0xb39d('0x41')]));_0x45c309[_0xb39d('0x31')]=_0x45c309[_0xb39d('0x31')][_0xb39d('0x4d')]?_0x45c309[_0xb39d('0x31')]:_0x2e1353[_0xb39d('0x2b')];_0x45c309[_0xb39d('0x33')]=qs[_0xb39d('0x34')](_0x95736a['query'][_0xb39d('0x34')]);_0x45c309['where']=qs[_0xb39d('0x2f')](_['pick'](_0x95736a[_0xb39d('0x2e')],_0x2e1353['filters']));if(_0x95736a[_0xb39d('0x2e')]['filter']){_0x45c309['where']=_[_0xb39d('0x37')](_0x45c309['where'],{'$or':_[_0xb39d('0x2c')](_0x45c309[_0xb39d('0x31')],function(_0x238cff){var _0x421165={};_0x421165[_0x238cff]={'$like':'%'+_0x95736a['query'][_0xb39d('0x36')]+'%'};return _0x421165;})});}_0x45c309=_[_0xb39d('0x37')]({},_0x45c309,_0x95736a[_0xb39d('0x3a')]);return _0x5c1e8b[_0xb39d('0x4f')](_0x45c309);}})[_0xb39d('0x24')](function(_0x2a1844){if(_0x2a1844){_0x2e4a19=_0x2a1844[_0xb39d('0x4d')];if(!_0x95736a['query'][_0xb39d('0x32')](_0xb39d('0x4a'))){_0x45c309[_0xb39d('0x1b')]=qs['limit'](_0x95736a['query'][_0xb39d('0x1b')]);_0x45c309[_0xb39d('0x1d')]=qs['offset'](_0x95736a['query'][_0xb39d('0x1d')]);}return _0x5c1e8b[_0xb39d('0x4f')](_0x45c309);}})[_0xb39d('0x24')](function(_0xe57841){if(_0xe57841){return _0xe57841?{'count':_0x2e4a19,'rows':_0xe57841}:null;}})['then'](respondWithResult(_0x1d4224,null))[_0xb39d('0x46')](handleError(_0x1d4224,null));}; \ No newline at end of file +var _0x9da7=['stack','name','send','map','ZohoConfiguration','rawAttributes','fieldName','type','key','query','filters','model','fields','attributes','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','show','keys','intersection','includeAll','include','find','create','body','update','params','findOne','ZohoField','getFields','hasOwnProperty','getSubjects','length','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','end','status','undefined','limit','count','offset','json','apply','reject','then','destroy','error'];(function(_0x44db34,_0x285c77){var _0x24cc6b=function(_0x4ba8f3){while(--_0x4ba8f3){_0x44db34['push'](_0x44db34['shift']());}};_0x24cc6b(++_0x285c77);}(_0x9da7,0x112));var _0x79da=function(_0x360739,_0x2ec1b2){_0x360739=_0x360739-0x0;var _0x3e23a1=_0x9da7[_0x360739];return _0x3e23a1;};'use strict';var emlformat=require(_0x79da('0x0'));var rimraf=require(_0x79da('0x1'));var zipdir=require(_0x79da('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x79da('0x3'));var moment=require(_0x79da('0x4'));var BPromise=require(_0x79da('0x5'));var Mustache=require('mustache');var util=require(_0x79da('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x79da('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x79da('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x79da('0x9'));var jsforce=require(_0x79da('0xa'));var deskjs=require(_0x79da('0xb'));var toCsv=require(_0x79da('0x7'));var querystring=require(_0x79da('0xc'));var Papa=require(_0x79da('0xd'));var Redis=require(_0x79da('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x79da('0xf'));var as=require(_0x79da('0x10'));var hardwareService=require(_0x79da('0x11'));var logger=require(_0x79da('0x12'))(_0x79da('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x79da('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x343222,_0x6c00a3){_0x6c00a3=_0x6c00a3||0xcc;return function(_0x3f5235){if(_0x3f5235){return _0x343222[_0x79da('0x15')](_0x6c00a3);}return _0x343222['status'](_0x6c00a3)[_0x79da('0x16')]();};}function respondWithResult(_0x54ac22,_0xf6cbef){_0xf6cbef=_0xf6cbef||0xc8;return function(_0xc585f8){if(_0xc585f8){return _0x54ac22[_0x79da('0x17')](_0xf6cbef)['json'](_0xc585f8);}};}function respondWithFilteredResult(_0x57818f,_0x41906b){return function(_0xd7981c){if(_0xd7981c){var _0x272341=typeof _0x41906b['offset']===_0x79da('0x18')&&typeof _0x41906b[_0x79da('0x19')]===_0x79da('0x18');var _0x281e4d=_0xd7981c[_0x79da('0x1a')];var _0x492289=_0x272341?0x0:_0x41906b[_0x79da('0x1b')];var _0x45081a=_0x272341?_0xd7981c[_0x79da('0x1a')]:_0x41906b['offset']+_0x41906b['limit'];var _0x3d6f6d;if(_0x45081a>=_0x281e4d){_0x45081a=_0x281e4d;_0x3d6f6d=0xc8;}else{_0x3d6f6d=0xce;}_0x57818f['status'](_0x3d6f6d);return _0x57818f['set']('Content-Range',_0x492289+'-'+_0x45081a+'/'+_0x281e4d)[_0x79da('0x1c')](_0xd7981c);}return null;};}function patchUpdates(_0x167eb6){return function(_0x4c210c){try{jsonpatch[_0x79da('0x1d')](_0x4c210c,_0x167eb6,!![]);}catch(_0x177bbc){return BPromise[_0x79da('0x1e')](_0x177bbc);}return _0x4c210c['save']();};}function saveUpdates(_0x458338,_0x4249c2){return function(_0x29f0d0){if(_0x29f0d0){return _0x29f0d0['update'](_0x458338)[_0x79da('0x1f')](function(_0xa2957c){return _0xa2957c;});}return null;};}function removeEntity(_0x450eb0,_0x5d651e){return function(_0x1d83e3){if(_0x1d83e3){return _0x1d83e3[_0x79da('0x20')]()[_0x79da('0x1f')](function(){_0x450eb0[_0x79da('0x17')](0xcc)[_0x79da('0x16')]();});}};}function handleEntityNotFound(_0xa15c4b,_0x1de427){return function(_0x49bfad){if(!_0x49bfad){_0xa15c4b['sendStatus'](0x194);}return _0x49bfad;};}function handleError(_0xd098bd,_0x47d7d8){_0x47d7d8=_0x47d7d8||0x1f4;return function(_0x1d0145){logger[_0x79da('0x21')](_0x1d0145[_0x79da('0x22')]);if(_0x1d0145[_0x79da('0x23')]){delete _0x1d0145[_0x79da('0x23')];}_0xd098bd[_0x79da('0x17')](_0x47d7d8)[_0x79da('0x24')](_0x1d0145);};}exports['index']=function(_0x11d561,_0x5dd013){var _0x4bfdef={},_0x549ba6={},_0x23bf67={'count':0x0,'rows':[]};var _0x401666=_[_0x79da('0x25')](db[_0x79da('0x26')][_0x79da('0x27')],function(_0x39bb94){return{'name':_0x39bb94[_0x79da('0x28')],'type':_0x39bb94[_0x79da('0x29')][_0x79da('0x2a')]};});_0x549ba6['model']=_[_0x79da('0x25')](_0x401666,'name');_0x549ba6[_0x79da('0x2b')]=_['keys'](_0x11d561[_0x79da('0x2b')]);_0x549ba6[_0x79da('0x2c')]=_['intersection'](_0x549ba6['model'],_0x549ba6['query']);_0x4bfdef['attributes']=_['intersection'](_0x549ba6[_0x79da('0x2d')],qs[_0x79da('0x2e')](_0x11d561[_0x79da('0x2b')][_0x79da('0x2e')]));_0x4bfdef[_0x79da('0x2f')]=_0x4bfdef[_0x79da('0x2f')]['length']?_0x4bfdef[_0x79da('0x2f')]:_0x549ba6[_0x79da('0x2d')];if(!_0x11d561[_0x79da('0x2b')]['hasOwnProperty'](_0x79da('0x30'))){_0x4bfdef[_0x79da('0x19')]=qs[_0x79da('0x19')](_0x11d561[_0x79da('0x2b')]['limit']);_0x4bfdef[_0x79da('0x1b')]=qs[_0x79da('0x1b')](_0x11d561['query']['offset']);}_0x4bfdef[_0x79da('0x31')]=qs[_0x79da('0x32')](_0x11d561['query'][_0x79da('0x32')]);_0x4bfdef[_0x79da('0x33')]=qs['filters'](_[_0x79da('0x34')](_0x11d561[_0x79da('0x2b')],_0x549ba6[_0x79da('0x2c')]),_0x401666);if(_0x11d561[_0x79da('0x2b')][_0x79da('0x35')]){_0x4bfdef['where']=_['merge'](_0x4bfdef['where'],{'$or':_['map'](_0x401666,function(_0x10d40c){if(_0x10d40c[_0x79da('0x29')]!==_0x79da('0x36')){var _0x3dc166={};_0x3dc166[_0x10d40c[_0x79da('0x23')]]={'$like':'%'+_0x11d561[_0x79da('0x2b')][_0x79da('0x35')]+'%'};return _0x3dc166;}})});}_0x4bfdef=_[_0x79da('0x37')]({},_0x4bfdef,_0x11d561[_0x79da('0x38')]);var _0x545019={'where':_0x4bfdef[_0x79da('0x33')]};return db[_0x79da('0x26')]['count'](_0x545019)[_0x79da('0x1f')](function(_0x565cec){_0x23bf67[_0x79da('0x1a')]=_0x565cec;if(_0x11d561['query']['includeAll']){_0x4bfdef['include']=[{'all':!![]}];}return db[_0x79da('0x26')][_0x79da('0x39')](_0x4bfdef);})[_0x79da('0x1f')](function(_0x2e274f){_0x23bf67[_0x79da('0x3a')]=_0x2e274f;return _0x23bf67;})[_0x79da('0x1f')](respondWithFilteredResult(_0x5dd013,_0x4bfdef))[_0x79da('0x3b')](handleError(_0x5dd013,null));};exports[_0x79da('0x3c')]=function(_0x4c2e19,_0x28b7dd){var _0x19dd5b={'raw':![],'where':{'id':_0x4c2e19['params']['id']}},_0x1b251b={};_0x1b251b[_0x79da('0x2d')]=_[_0x79da('0x3d')](db[_0x79da('0x26')][_0x79da('0x27')]);_0x1b251b['query']=_[_0x79da('0x3d')](_0x4c2e19[_0x79da('0x2b')]);_0x1b251b['filters']=_[_0x79da('0x3e')](_0x1b251b[_0x79da('0x2d')],_0x1b251b[_0x79da('0x2b')]);_0x19dd5b[_0x79da('0x2f')]=_[_0x79da('0x3e')](_0x1b251b['model'],qs[_0x79da('0x2e')](_0x4c2e19[_0x79da('0x2b')][_0x79da('0x2e')]));_0x19dd5b[_0x79da('0x2f')]=_0x19dd5b['attributes']['length']?_0x19dd5b[_0x79da('0x2f')]:_0x1b251b[_0x79da('0x2d')];if(_0x4c2e19[_0x79da('0x2b')][_0x79da('0x3f')]){_0x19dd5b[_0x79da('0x40')]=[{'all':!![]}];}_0x19dd5b=_['merge']({},_0x19dd5b,_0x4c2e19['options']);return db['ZohoConfiguration'][_0x79da('0x41')](_0x19dd5b)[_0x79da('0x1f')](handleEntityNotFound(_0x28b7dd,null))['then'](respondWithResult(_0x28b7dd,null))['catch'](handleError(_0x28b7dd,null));};exports[_0x79da('0x42')]=function(_0x502399,_0x49ccbf){return db[_0x79da('0x26')][_0x79da('0x42')](_0x502399[_0x79da('0x43')],{})[_0x79da('0x1f')](respondWithResult(_0x49ccbf,0xc9))[_0x79da('0x3b')](handleError(_0x49ccbf,null));};exports[_0x79da('0x44')]=function(_0x25db43,_0x1ee904){if(_0x25db43[_0x79da('0x43')]['id']){delete _0x25db43[_0x79da('0x43')]['id'];}return db['ZohoConfiguration'][_0x79da('0x41')]({'where':{'id':_0x25db43[_0x79da('0x45')]['id']}})[_0x79da('0x1f')](handleEntityNotFound(_0x1ee904,null))[_0x79da('0x1f')](saveUpdates(_0x25db43[_0x79da('0x43')],null))[_0x79da('0x1f')](respondWithResult(_0x1ee904,null))['catch'](handleError(_0x1ee904,null));};exports[_0x79da('0x20')]=function(_0x570ab2,_0x1e0788){return db['ZohoConfiguration'][_0x79da('0x41')]({'where':{'id':_0x570ab2[_0x79da('0x45')]['id']}})[_0x79da('0x1f')](handleEntityNotFound(_0x1e0788,null))['then'](removeEntity(_0x1e0788,null))[_0x79da('0x3b')](handleError(_0x1e0788,null));};exports['getFields']=function(_0x60574e,_0x3ad22c,_0x1873f0){var _0xe7daac={};var _0x10fee6={};var _0x5277e3;var _0xda7631;return db[_0x79da('0x26')][_0x79da('0x46')]({'where':{'id':_0x60574e['params']['id']}})[_0x79da('0x1f')](handleEntityNotFound(_0x3ad22c,null))[_0x79da('0x1f')](function(_0x2de9ed){if(_0x2de9ed){_0x5277e3=_0x2de9ed;_0x10fee6['model']=_[_0x79da('0x3d')](db[_0x79da('0x47')]['rawAttributes']);_0x10fee6[_0x79da('0x2b')]=_[_0x79da('0x3d')](_0x60574e[_0x79da('0x2b')]);_0x10fee6['filters']=_[_0x79da('0x3e')](_0x10fee6['model'],_0x10fee6[_0x79da('0x2b')]);_0xe7daac['attributes']=_[_0x79da('0x3e')](_0x10fee6[_0x79da('0x2d')],qs['fields'](_0x60574e[_0x79da('0x2b')][_0x79da('0x2e')]));_0xe7daac[_0x79da('0x2f')]=_0xe7daac[_0x79da('0x2f')]['length']?_0xe7daac[_0x79da('0x2f')]:_0x10fee6[_0x79da('0x2d')];_0xe7daac[_0x79da('0x31')]=qs[_0x79da('0x32')](_0x60574e['query'][_0x79da('0x32')]);_0xe7daac[_0x79da('0x33')]=qs['filters'](_[_0x79da('0x34')](_0x60574e[_0x79da('0x2b')],_0x10fee6[_0x79da('0x2c')]));if(_0x60574e[_0x79da('0x2b')][_0x79da('0x35')]){_0xe7daac[_0x79da('0x33')]=_[_0x79da('0x37')](_0xe7daac['where'],{'$or':_[_0x79da('0x25')](_0xe7daac['attributes'],function(_0x57742e){var _0x156077={};_0x156077[_0x57742e]={'$like':'%'+_0x60574e[_0x79da('0x2b')][_0x79da('0x35')]+'%'};return _0x156077;})});}_0xe7daac=_['merge']({},_0xe7daac,_0x60574e[_0x79da('0x38')]);return _0x5277e3[_0x79da('0x48')](_0xe7daac);}})[_0x79da('0x1f')](function(_0x671a64){if(_0x671a64){_0xda7631=_0x671a64['length'];if(!_0x60574e[_0x79da('0x2b')][_0x79da('0x49')](_0x79da('0x30'))){_0xe7daac[_0x79da('0x19')]=qs[_0x79da('0x19')](_0x60574e[_0x79da('0x2b')][_0x79da('0x19')]);_0xe7daac[_0x79da('0x1b')]=qs['offset'](_0x60574e[_0x79da('0x2b')][_0x79da('0x1b')]);}return _0x5277e3[_0x79da('0x48')](_0xe7daac);}})['then'](function(_0x29557d){if(_0x29557d){return _0x29557d?{'count':_0xda7631,'rows':_0x29557d}:null;}})['then'](respondWithResult(_0x3ad22c,null))[_0x79da('0x3b')](handleError(_0x3ad22c,null));};exports[_0x79da('0x4a')]=function(_0x424f2e,_0x2e4005,_0x1ac2b0){var _0x8d02ee={};var _0x31f008={};var _0x13a55a;var _0x22e7c0;return db[_0x79da('0x26')]['findOne']({'where':{'id':_0x424f2e['params']['id']}})[_0x79da('0x1f')](handleEntityNotFound(_0x2e4005,null))[_0x79da('0x1f')](function(_0x46b5dc){if(_0x46b5dc){_0x13a55a=_0x46b5dc;_0x31f008['model']=_['keys'](db[_0x79da('0x47')]['rawAttributes']);_0x31f008[_0x79da('0x2b')]=_[_0x79da('0x3d')](_0x424f2e[_0x79da('0x2b')]);_0x31f008[_0x79da('0x2c')]=_[_0x79da('0x3e')](_0x31f008['model'],_0x31f008['query']);_0x8d02ee[_0x79da('0x2f')]=_[_0x79da('0x3e')](_0x31f008[_0x79da('0x2d')],qs[_0x79da('0x2e')](_0x424f2e[_0x79da('0x2b')][_0x79da('0x2e')]));_0x8d02ee[_0x79da('0x2f')]=_0x8d02ee[_0x79da('0x2f')][_0x79da('0x4b')]?_0x8d02ee[_0x79da('0x2f')]:_0x31f008['model'];_0x8d02ee[_0x79da('0x31')]=qs['sort'](_0x424f2e[_0x79da('0x2b')][_0x79da('0x32')]);_0x8d02ee[_0x79da('0x33')]=qs[_0x79da('0x2c')](_[_0x79da('0x34')](_0x424f2e[_0x79da('0x2b')],_0x31f008['filters']));if(_0x424f2e['query'][_0x79da('0x35')]){_0x8d02ee[_0x79da('0x33')]=_[_0x79da('0x37')](_0x8d02ee[_0x79da('0x33')],{'$or':_['map'](_0x8d02ee['attributes'],function(_0x2cde86){var _0x14d838={};_0x14d838[_0x2cde86]={'$like':'%'+_0x424f2e[_0x79da('0x2b')][_0x79da('0x35')]+'%'};return _0x14d838;})});}_0x8d02ee=_[_0x79da('0x37')]({},_0x8d02ee,_0x424f2e['options']);return _0x13a55a[_0x79da('0x4a')](_0x8d02ee);}})[_0x79da('0x1f')](function(_0x300c32){if(_0x300c32){_0x22e7c0=_0x300c32[_0x79da('0x4b')];if(!_0x424f2e['query'][_0x79da('0x49')](_0x79da('0x30'))){_0x8d02ee[_0x79da('0x19')]=qs[_0x79da('0x19')](_0x424f2e[_0x79da('0x2b')][_0x79da('0x19')]);_0x8d02ee[_0x79da('0x1b')]=qs[_0x79da('0x1b')](_0x424f2e[_0x79da('0x2b')][_0x79da('0x1b')]);}return _0x13a55a['getSubjects'](_0x8d02ee);}})[_0x79da('0x1f')](function(_0x213817){if(_0x213817){return _0x213817?{'count':_0x22e7c0,'rows':_0x213817}:null;}})[_0x79da('0x1f')](respondWithResult(_0x2e4005,null))['catch'](handleError(_0x2e4005,null));};exports[_0x79da('0x4c')]=function(_0x3cbac8,_0x3c099d,_0x5372f0){var _0x26a6d3={};var _0x1b9d00={};var _0x516dce;var _0x2072e4;return db[_0x79da('0x26')][_0x79da('0x46')]({'where':{'id':_0x3cbac8[_0x79da('0x45')]['id']}})[_0x79da('0x1f')](handleEntityNotFound(_0x3c099d,null))[_0x79da('0x1f')](function(_0x5445d9){if(_0x5445d9){_0x516dce=_0x5445d9;_0x1b9d00[_0x79da('0x2d')]=_['keys'](db[_0x79da('0x47')][_0x79da('0x27')]);_0x1b9d00['query']=_[_0x79da('0x3d')](_0x3cbac8[_0x79da('0x2b')]);_0x1b9d00[_0x79da('0x2c')]=_[_0x79da('0x3e')](_0x1b9d00[_0x79da('0x2d')],_0x1b9d00[_0x79da('0x2b')]);_0x26a6d3[_0x79da('0x2f')]=_[_0x79da('0x3e')](_0x1b9d00['model'],qs['fields'](_0x3cbac8['query'][_0x79da('0x2e')]));_0x26a6d3[_0x79da('0x2f')]=_0x26a6d3[_0x79da('0x2f')]['length']?_0x26a6d3[_0x79da('0x2f')]:_0x1b9d00[_0x79da('0x2d')];_0x26a6d3[_0x79da('0x31')]=qs['sort'](_0x3cbac8[_0x79da('0x2b')][_0x79da('0x32')]);_0x26a6d3[_0x79da('0x33')]=qs[_0x79da('0x2c')](_[_0x79da('0x34')](_0x3cbac8[_0x79da('0x2b')],_0x1b9d00['filters']));if(_0x3cbac8[_0x79da('0x2b')][_0x79da('0x35')]){_0x26a6d3[_0x79da('0x33')]=_['merge'](_0x26a6d3[_0x79da('0x33')],{'$or':_[_0x79da('0x25')](_0x26a6d3[_0x79da('0x2f')],function(_0x2aa7c5){var _0x4b714f={};_0x4b714f[_0x2aa7c5]={'$like':'%'+_0x3cbac8[_0x79da('0x2b')][_0x79da('0x35')]+'%'};return _0x4b714f;})});}_0x26a6d3=_[_0x79da('0x37')]({},_0x26a6d3,_0x3cbac8[_0x79da('0x38')]);return _0x516dce['getDescriptions'](_0x26a6d3);}})[_0x79da('0x1f')](function(_0x40d1d8){if(_0x40d1d8){_0x2072e4=_0x40d1d8[_0x79da('0x4b')];if(!_0x3cbac8[_0x79da('0x2b')]['hasOwnProperty'](_0x79da('0x30'))){_0x26a6d3['limit']=qs[_0x79da('0x19')](_0x3cbac8[_0x79da('0x2b')][_0x79da('0x19')]);_0x26a6d3[_0x79da('0x1b')]=qs[_0x79da('0x1b')](_0x3cbac8[_0x79da('0x2b')][_0x79da('0x1b')]);}return _0x516dce[_0x79da('0x4c')](_0x26a6d3);}})['then'](function(_0xbf7a87){if(_0xbf7a87){return _0xbf7a87?{'count':_0x2072e4,'rows':_0xbf7a87}:null;}})[_0x79da('0x1f')](respondWithResult(_0x3c099d,null))[_0x79da('0x3b')](handleError(_0x3c099d,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index b290933..564d60d 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 _0xfd5d=['ZohoConfiguration','int_zoho_configurations','api','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x3a9bde,_0x5886ae){var _0x58efa2=function(_0x5845c3){while(--_0x5845c3){_0x3a9bde['push'](_0x3a9bde['shift']());}};_0x58efa2(++_0x5886ae);}(_0xfd5d,0xb6));var _0xdfd5=function(_0x280421,_0x238fa1){_0x280421=_0x280421-0x0;var _0x328d92=_0xfd5d[_0x280421];return _0x328d92;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xdfd5('0x0'));var moment=require(_0xdfd5('0x1'));var BPromise=require(_0xdfd5('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdfd5('0x3'));var rimraf=require(_0xdfd5('0x4'));var config=require(_0xdfd5('0x5'));var attributes=require('./intZohoConfiguration.attributes');module[_0xdfd5('0x6')]=function(_0x2bc8b8,_0x31a07c){return _0x2bc8b8[_0xdfd5('0x7')](_0xdfd5('0x8'),attributes,{'tableName':_0xdfd5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f77=['request-promise','path','rimraf','../../config/environment','define','ZohoConfiguration','int_zoho_configurations','util','../../config/logger','api','moment','bluebird'];(function(_0x17c49b,_0x383575){var _0x3c872e=function(_0x2ebf9d){while(--_0x2ebf9d){_0x17c49b['push'](_0x17c49b['shift']());}};_0x3c872e(++_0x383575);}(_0x8f77,0x13f));var _0x78f7=function(_0x1ae283,_0x25d017){_0x1ae283=_0x1ae283-0x0;var _0xf8240b=_0x8f77[_0x1ae283];return _0xf8240b;};'use strict';var _=require('lodash');var util=require(_0x78f7('0x0'));var logger=require(_0x78f7('0x1'))(_0x78f7('0x2'));var moment=require(_0x78f7('0x3'));var BPromise=require(_0x78f7('0x4'));var rp=require(_0x78f7('0x5'));var fs=require('fs');var path=require(_0x78f7('0x6'));var rimraf=require(_0x78f7('0x7'));var config=require(_0x78f7('0x8'));var attributes=require('./intZohoConfiguration.attributes');module['exports']=function(_0x45a0ef,_0x2cbcd1){return _0x45a0ef[_0x78f7('0x9')](_0x78f7('0xa'),attributes,{'tableName':_0x78f7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 23d1fbd..0d5e7f0 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 _0x6cb3=['error','code','message','catch','lodash','moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x3ad130,_0x492039){var _0x351432=function(_0x563f84){while(--_0x563f84){_0x3ad130['push'](_0x3ad130['shift']());}};_0x351432(++_0x492039);}(_0x6cb3,0x1cc));var _0x36cb=function(_0x4931a8,_0x163556){_0x4931a8=_0x4931a8-0x0;var _0x1bf642=_0x6cb3[_0x4931a8];return _0x1bf642;};'use strict';var _=require(_0x36cb('0x0'));var util=require('util');var moment=require(_0x36cb('0x1'));var BPromise=require('bluebird');var rs=require(_0x36cb('0x2'));var fs=require('fs');var Redis=require(_0x36cb('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x36cb('0x4'));var config=require(_0x36cb('0x5'));var jayson=require(_0x36cb('0x6'));var client=jayson[_0x36cb('0x7')][_0x36cb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33299f,_0x39ba86,_0x3641e9){return new BPromise(function(_0x1572c5,_0x45d8d4){return client[_0x36cb('0x9')](_0x33299f,_0x3641e9)['then'](function(_0x165931){logger[_0x36cb('0xa')](_0x36cb('0xb'),_0x39ba86,_0x36cb('0xc'));logger[_0x36cb('0xd')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x39ba86,'request\x20sent',JSON[_0x36cb('0xe')](_0x165931));if(_0x165931[_0x36cb('0xf')]){if(_0x165931['error'][_0x36cb('0x10')]===0x1f4){logger[_0x36cb('0xf')](_0x36cb('0xb'),_0x39ba86,_0x165931['error'][_0x36cb('0x11')]);return _0x45d8d4(_0x165931[_0x36cb('0xf')][_0x36cb('0x11')]);}logger[_0x36cb('0xf')](_0x36cb('0xb'),_0x39ba86,_0x165931['error']['message']);return _0x1572c5(_0x165931[_0x36cb('0xf')]['message']);}else{logger[_0x36cb('0xa')](_0x36cb('0xb'),_0x39ba86,_0x36cb('0xc'));_0x1572c5(_0x165931['result']['message']);}})[_0x36cb('0x12')](function(_0x203750){logger['error'](_0x36cb('0xb'),_0x39ba86,_0x203750);_0x45d8d4(_0x203750);});});} \ No newline at end of file +var _0x9ff6=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','util'];(function(_0x4c99c8,_0x30f9cd){var _0x57e607=function(_0x248ce8){while(--_0x248ce8){_0x4c99c8['push'](_0x4c99c8['shift']());}};_0x57e607(++_0x30f9cd);}(_0x9ff6,0x8b));var _0x69ff=function(_0x28d396,_0x50bd20){_0x28d396=_0x28d396-0x0;var _0x3bdb1d=_0x9ff6[_0x28d396];return _0x3bdb1d;};'use strict';var _=require('lodash');var util=require(_0x69ff('0x0'));var moment=require(_0x69ff('0x1'));var BPromise=require(_0x69ff('0x2'));var rs=require(_0x69ff('0x3'));var fs=require('fs');var Redis=require(_0x69ff('0x4'));var db=require(_0x69ff('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x69ff('0x6'))(_0x69ff('0x7'));var config=require('../../config/environment');var jayson=require(_0x69ff('0x8'));var client=jayson[_0x69ff('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38a378,_0x2d6e40,_0x168235){return new BPromise(function(_0x4854f1,_0x2f1a97){return client[_0x69ff('0xa')](_0x38a378,_0x168235)[_0x69ff('0xb')](function(_0x221216){logger[_0x69ff('0xc')](_0x69ff('0xd'),_0x2d6e40,'request\x20sent');logger[_0x69ff('0xe')](_0x69ff('0xf'),_0x2d6e40,'request\x20sent',JSON['stringify'](_0x221216));if(_0x221216['error']){if(_0x221216[_0x69ff('0x10')][_0x69ff('0x11')]===0x1f4){logger[_0x69ff('0x10')](_0x69ff('0xd'),_0x2d6e40,_0x221216[_0x69ff('0x10')][_0x69ff('0x12')]);return _0x2f1a97(_0x221216[_0x69ff('0x10')]['message']);}logger[_0x69ff('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x2d6e40,_0x221216['error'][_0x69ff('0x12')]);return _0x4854f1(_0x221216[_0x69ff('0x10')][_0x69ff('0x12')]);}else{logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x2d6e40,'request\x20sent');_0x4854f1(_0x221216['result'][_0x69ff('0x12')]);}})[_0x69ff('0x13')](function(_0x2b9a60){logger[_0x69ff('0x10')](_0x69ff('0xd'),_0x2d6e40,_0x2b9a60);_0x2f1a97(_0x2b9a60);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 9eee2d8..622cae6 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 _0x0b3c=['exports','multer','util','path','express','Router','../../components/auth/service','./intZohoField.controller','get','isAuthenticated','index','/:id','show','put','delete','destroy'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0b3c,0x1c1));var _0xc0b3=function(_0x3c6741,_0x24c6f0){_0x3c6741=_0x3c6741-0x0;var _0x5d3310=_0x0b3c[_0x3c6741];return _0x5d3310;};'use strict';var multer=require(_0xc0b3('0x0'));var util=require(_0xc0b3('0x1'));var path=require(_0xc0b3('0x2'));var timeout=require('connect-timeout');var express=require(_0xc0b3('0x3'));var router=express[_0xc0b3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc0b3('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc0b3('0x6'));router[_0xc0b3('0x7')]('/',auth[_0xc0b3('0x8')](),controller[_0xc0b3('0x9')]);router[_0xc0b3('0x7')](_0xc0b3('0xa'),auth[_0xc0b3('0x8')](),controller[_0xc0b3('0xb')]);router['post']('/',auth[_0xc0b3('0x8')](),controller['create']);router[_0xc0b3('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xc0b3('0xd')](_0xc0b3('0xa'),auth['isAuthenticated'](),controller[_0xc0b3('0xe')]);module[_0xc0b3('0xf')]=router; \ No newline at end of file +var _0x678b=['/:id','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','get','isAuthenticated','index','post','create'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x678b,0x6b));var _0xb678=function(_0x10bf5d,_0x10a3a9){_0x10bf5d=_0x10bf5d-0x0;var _0x27f511=_0x678b[_0x10bf5d];return _0x27f511;};'use strict';var multer=require('multer');var util=require(_0xb678('0x0'));var path=require('path');var timeout=require(_0xb678('0x1'));var express=require('express');var router=express[_0xb678('0x2')]();var fs_extra=require(_0xb678('0x3'));var auth=require(_0xb678('0x4'));var interaction=require(_0xb678('0x5'));var config=require('../../config/environment');var controller=require(_0xb678('0x6'));router[_0xb678('0x7')]('/',auth[_0xb678('0x8')](),controller[_0xb678('0x9')]);router[_0xb678('0x7')]('/:id',auth[_0xb678('0x8')](),controller['show']);router[_0xb678('0xa')]('/',auth[_0xb678('0x8')](),controller[_0xb678('0xb')]);router['put'](_0xb678('0xc'),auth[_0xb678('0x8')](),controller[_0xb678('0xd')]);router[_0xb678('0xe')](_0xb678('0xc'),auth[_0xb678('0x8')](),controller[_0xb678('0xf')]);module[_0xb678('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 8c727c8..2b48a31 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 _0xda3c=['ENUM','BOOLEAN','sequelize','variable','customVariable','keyValue','picklist','string','STRING'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xda3c,0x80));var _0xcda3=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xda3c[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0xcda3('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0xcda3('0x1'),_0xcda3('0x2'),_0xcda3('0x3'),_0xcda3('0x4')),'defaultValue':_0xcda3('0x5')},'content':{'type':Sequelize[_0xcda3('0x6')]},'key':{'type':Sequelize[_0xcda3('0x6')]},'keyType':{'type':Sequelize[_0xcda3('0x7')]('string','variable',_0xcda3('0x2'))},'keyContent':{'type':Sequelize[_0xcda3('0x6')]},'idField':{'type':Sequelize[_0xcda3('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xcda3('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3650=['STRING','BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x20966b,_0x256499){var _0x4aeb04=function(_0x258b35){while(--_0x258b35){_0x20966b['push'](_0x20966b['shift']());}};_0x4aeb04(++_0x256499);}(_0x3650,0x197));var _0x0365=function(_0x1d2ada,_0x59dfd1){_0x1d2ada=_0x1d2ada-0x0;var _0x2c2dab=_0x3650[_0x1d2ada];return _0x2c2dab;};'use strict';var Sequelize=require('sequelize');module[_0x0365('0x0')]={'type':{'type':Sequelize[_0x0365('0x1')](_0x0365('0x2'),_0x0365('0x3'),_0x0365('0x4'),_0x0365('0x5'),_0x0365('0x6')),'defaultValue':_0x0365('0x2')},'content':{'type':Sequelize[_0x0365('0x7')]},'key':{'type':Sequelize[_0x0365('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x0365('0x2'),_0x0365('0x3'),_0x0365('0x4'))},'keyContent':{'type':Sequelize[_0x0365('0x7')]},'idField':{'type':Sequelize[_0x0365('0x7')]},'nameField':{'type':Sequelize[_0x0365('0x7')]},'customField':{'type':Sequelize[_0x0365('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index edb00dd..c73cc1a 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 _0xe5ff=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','sendStatus','json','undefined','offset','count','limit','status','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','ZohoField','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','rows','catch','show','params','options','create','find','eml-format'];(function(_0x1798e5,_0x4ad964){var _0x16ea67=function(_0x499fd5){while(--_0x499fd5){_0x1798e5['push'](_0x1798e5['shift']());}};_0x16ea67(++_0x4ad964);}(_0xe5ff,0x197));var _0xfe5f=function(_0x32f205,_0xa45d99){_0x32f205=_0x32f205-0x0;var _0x4f2f69=_0xe5ff[_0x32f205];return _0x4f2f69;};'use strict';var emlformat=require(_0xfe5f('0x0'));var rimraf=require(_0xfe5f('0x1'));var zipdir=require(_0xfe5f('0x2'));var jsonpatch=require(_0xfe5f('0x3'));var rp=require(_0xfe5f('0x4'));var moment=require(_0xfe5f('0x5'));var BPromise=require(_0xfe5f('0x6'));var Mustache=require(_0xfe5f('0x7'));var util=require(_0xfe5f('0x8'));var path=require(_0xfe5f('0x9'));var sox=require('sox');var csv=require(_0xfe5f('0xa'));var ejs=require(_0xfe5f('0xb'));var fs=require('fs');var fs_extra=require(_0xfe5f('0xc'));var _=require('lodash');var squel=require(_0xfe5f('0xd'));var crypto=require('crypto');var jsforce=require(_0xfe5f('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfe5f('0xf'));var authService=require(_0xfe5f('0x10'));var qs=require(_0xfe5f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfe5f('0x12'));var utils=require(_0xfe5f('0x13'));var config=require(_0xfe5f('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4185aa,_0x3f3c3c){_0x3f3c3c=_0x3f3c3c||0xcc;return function(_0x489553){if(_0x489553){return _0x4185aa[_0xfe5f('0x15')](_0x3f3c3c);}return _0x4185aa['status'](_0x3f3c3c)['end']();};}function respondWithResult(_0x3872fc,_0x4f3dac){_0x4f3dac=_0x4f3dac||0xc8;return function(_0x2b6d97){if(_0x2b6d97){return _0x3872fc['status'](_0x4f3dac)[_0xfe5f('0x16')](_0x2b6d97);}};}function respondWithFilteredResult(_0x40b447,_0x562b39){return function(_0x3ec316){if(_0x3ec316){var _0x53ef4e=typeof _0x562b39['offset']==='undefined'&&typeof _0x562b39['limit']===_0xfe5f('0x17');var _0x5481ec=_0x3ec316['count'];var _0x4918cb=_0x53ef4e?0x0:_0x562b39[_0xfe5f('0x18')];var _0x58f5a1=_0x53ef4e?_0x3ec316[_0xfe5f('0x19')]:_0x562b39[_0xfe5f('0x18')]+_0x562b39[_0xfe5f('0x1a')];var _0x32414d;if(_0x58f5a1>=_0x5481ec){_0x58f5a1=_0x5481ec;_0x32414d=0xc8;}else{_0x32414d=0xce;}_0x40b447[_0xfe5f('0x1b')](_0x32414d);return _0x40b447[_0xfe5f('0x1c')]('Content-Range',_0x4918cb+'-'+_0x58f5a1+'/'+_0x5481ec)['json'](_0x3ec316);}return null;};}function patchUpdates(_0x19a5ce){return function(_0x3a39e8){try{jsonpatch[_0xfe5f('0x1d')](_0x3a39e8,_0x19a5ce,!![]);}catch(_0x3ebef9){return BPromise[_0xfe5f('0x1e')](_0x3ebef9);}return _0x3a39e8[_0xfe5f('0x1f')]();};}function saveUpdates(_0x28c520,_0x283abb){return function(_0x310ad2){if(_0x310ad2){return _0x310ad2[_0xfe5f('0x20')](_0x28c520)[_0xfe5f('0x21')](function(_0x23ad0f){return _0x23ad0f;});}return null;};}function removeEntity(_0x5daf3b,_0x1c29f6){return function(_0xb58f3e){if(_0xb58f3e){return _0xb58f3e[_0xfe5f('0x22')]()['then'](function(){_0x5daf3b[_0xfe5f('0x1b')](0xcc)[_0xfe5f('0x23')]();});}};}function handleEntityNotFound(_0x55312c,_0x4f3b54){return function(_0x6452e6){if(!_0x6452e6){_0x55312c['sendStatus'](0x194);}return _0x6452e6;};}function handleError(_0x46eee9,_0x14a89e){_0x14a89e=_0x14a89e||0x1f4;return function(_0x219e31){logger[_0xfe5f('0x24')](_0x219e31[_0xfe5f('0x25')]);if(_0x219e31[_0xfe5f('0x26')]){delete _0x219e31[_0xfe5f('0x26')];}_0x46eee9[_0xfe5f('0x1b')](_0x14a89e)[_0xfe5f('0x27')](_0x219e31);};}exports[_0xfe5f('0x28')]=function(_0x4293bc,_0x3c9b57){var _0x28dbc0={},_0x229345={},_0x4033c4={'count':0x0,'rows':[]};var _0x18d55a=_[_0xfe5f('0x29')](db[_0xfe5f('0x2a')]['rawAttributes'],function(_0x31a246){return{'name':_0x31a246[_0xfe5f('0x2b')],'type':_0x31a246[_0xfe5f('0x2c')]['key']};});_0x229345['model']=_['map'](_0x18d55a,'name');_0x229345[_0xfe5f('0x2d')]=_[_0xfe5f('0x2e')](_0x4293bc[_0xfe5f('0x2d')]);_0x229345[_0xfe5f('0x2f')]=_[_0xfe5f('0x30')](_0x229345[_0xfe5f('0x31')],_0x229345[_0xfe5f('0x2d')]);_0x28dbc0[_0xfe5f('0x32')]=_[_0xfe5f('0x30')](_0x229345[_0xfe5f('0x31')],qs[_0xfe5f('0x33')](_0x4293bc[_0xfe5f('0x2d')][_0xfe5f('0x33')]));_0x28dbc0[_0xfe5f('0x32')]=_0x28dbc0[_0xfe5f('0x32')][_0xfe5f('0x34')]?_0x28dbc0['attributes']:_0x229345[_0xfe5f('0x31')];if(!_0x4293bc[_0xfe5f('0x2d')][_0xfe5f('0x35')](_0xfe5f('0x36'))){_0x28dbc0[_0xfe5f('0x1a')]=qs[_0xfe5f('0x1a')](_0x4293bc[_0xfe5f('0x2d')][_0xfe5f('0x1a')]);_0x28dbc0[_0xfe5f('0x18')]=qs[_0xfe5f('0x18')](_0x4293bc[_0xfe5f('0x2d')][_0xfe5f('0x18')]);}_0x28dbc0[_0xfe5f('0x37')]=qs[_0xfe5f('0x38')](_0x4293bc[_0xfe5f('0x2d')]['sort']);_0x28dbc0[_0xfe5f('0x39')]=qs[_0xfe5f('0x2f')](_['pick'](_0x4293bc[_0xfe5f('0x2d')],_0x229345[_0xfe5f('0x2f')]),_0x18d55a);if(_0x4293bc[_0xfe5f('0x2d')][_0xfe5f('0x3a')]){_0x28dbc0[_0xfe5f('0x39')]=_['merge'](_0x28dbc0[_0xfe5f('0x39')],{'$or':_[_0xfe5f('0x29')](_0x18d55a,function(_0x592a2d){if(_0x592a2d[_0xfe5f('0x2c')]!=='VIRTUAL'){var _0x4a1577={};_0x4a1577[_0x592a2d['name']]={'$like':'%'+_0x4293bc[_0xfe5f('0x2d')]['filter']+'%'};return _0x4a1577;}})});}_0x28dbc0=_[_0xfe5f('0x3b')]({},_0x28dbc0,_0x4293bc['options']);var _0x55fae8={'where':_0x28dbc0[_0xfe5f('0x39')]};return db[_0xfe5f('0x2a')][_0xfe5f('0x19')](_0x55fae8)[_0xfe5f('0x21')](function(_0x328fd2){_0x4033c4[_0xfe5f('0x19')]=_0x328fd2;if(_0x4293bc[_0xfe5f('0x2d')][_0xfe5f('0x3c')]){_0x28dbc0['include']=[{'all':!![]}];}return db[_0xfe5f('0x2a')]['findAll'](_0x28dbc0);})[_0xfe5f('0x21')](function(_0x2060d7){_0x4033c4[_0xfe5f('0x3d')]=_0x2060d7;return _0x4033c4;})[_0xfe5f('0x21')](respondWithFilteredResult(_0x3c9b57,_0x28dbc0))[_0xfe5f('0x3e')](handleError(_0x3c9b57,null));};exports[_0xfe5f('0x3f')]=function(_0x539e44,_0x376194){var _0x122fb0={'raw':!![],'where':{'id':_0x539e44[_0xfe5f('0x40')]['id']}},_0x43c1e5={};_0x43c1e5[_0xfe5f('0x31')]=_[_0xfe5f('0x2e')](db['ZohoField']['rawAttributes']);_0x43c1e5[_0xfe5f('0x2d')]=_['keys'](_0x539e44[_0xfe5f('0x2d')]);_0x43c1e5[_0xfe5f('0x2f')]=_[_0xfe5f('0x30')](_0x43c1e5[_0xfe5f('0x31')],_0x43c1e5['query']);_0x122fb0[_0xfe5f('0x32')]=_['intersection'](_0x43c1e5[_0xfe5f('0x31')],qs[_0xfe5f('0x33')](_0x539e44[_0xfe5f('0x2d')][_0xfe5f('0x33')]));_0x122fb0[_0xfe5f('0x32')]=_0x122fb0[_0xfe5f('0x32')][_0xfe5f('0x34')]?_0x122fb0[_0xfe5f('0x32')]:_0x43c1e5[_0xfe5f('0x31')];if(_0x539e44[_0xfe5f('0x2d')][_0xfe5f('0x3c')]){_0x122fb0['include']=[{'all':!![]}];}_0x122fb0=_[_0xfe5f('0x3b')]({},_0x122fb0,_0x539e44[_0xfe5f('0x41')]);return db[_0xfe5f('0x2a')]['find'](_0x122fb0)[_0xfe5f('0x21')](handleEntityNotFound(_0x376194,null))['then'](respondWithResult(_0x376194,null))[_0xfe5f('0x3e')](handleError(_0x376194,null));};exports[_0xfe5f('0x42')]=function(_0x126ed0,_0x24b827){return db[_0xfe5f('0x2a')][_0xfe5f('0x42')](_0x126ed0['body'],{})[_0xfe5f('0x21')](respondWithResult(_0x24b827,0xc9))[_0xfe5f('0x3e')](handleError(_0x24b827,null));};exports[_0xfe5f('0x20')]=function(_0x537652,_0x341630){if(_0x537652['body']['id']){delete _0x537652['body']['id'];}return db['ZohoField'][_0xfe5f('0x43')]({'where':{'id':_0x537652[_0xfe5f('0x40')]['id']}})['then'](handleEntityNotFound(_0x341630,null))[_0xfe5f('0x21')](saveUpdates(_0x537652['body'],null))[_0xfe5f('0x21')](respondWithResult(_0x341630,null))[_0xfe5f('0x3e')](handleError(_0x341630,null));};exports[_0xfe5f('0x22')]=function(_0xc78e51,_0x1007a8){return db['ZohoField'][_0xfe5f('0x43')]({'where':{'id':_0xc78e51[_0xfe5f('0x40')]['id']}})[_0xfe5f('0x21')](handleEntityNotFound(_0x1007a8,null))[_0xfe5f('0x21')](removeEntity(_0x1007a8,null))[_0xfe5f('0x3e')](handleError(_0x1007a8,null));}; \ No newline at end of file +var _0x88be=['then','end','sendStatus','error','stack','name','send','index','map','ZohoField','fieldName','type','key','intersection','query','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','rows','show','params','keys','rawAttributes','include','options','catch','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy'];(function(_0x19e166,_0x4cc641){var _0x5e6bed=function(_0xb7fce7){while(--_0xb7fce7){_0x19e166['push'](_0x19e166['shift']());}};_0x5e6bed(++_0x4cc641);}(_0x88be,0xcb));var _0xe88b=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x88be[_0x1ddedd];return _0xa3e1ac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe88b('0x0'));var zipdir=require(_0xe88b('0x1'));var jsonpatch=require(_0xe88b('0x2'));var rp=require(_0xe88b('0x3'));var moment=require(_0xe88b('0x4'));var BPromise=require(_0xe88b('0x5'));var Mustache=require(_0xe88b('0x6'));var util=require('util');var path=require(_0xe88b('0x7'));var sox=require(_0xe88b('0x8'));var csv=require('to-csv');var ejs=require(_0xe88b('0x9'));var fs=require('fs');var fs_extra=require(_0xe88b('0xa'));var _=require(_0xe88b('0xb'));var squel=require(_0xe88b('0xc'));var crypto=require(_0xe88b('0xd'));var jsforce=require(_0xe88b('0xe'));var deskjs=require(_0xe88b('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe88b('0x10'));var Papa=require('papaparse');var Redis=require(_0xe88b('0x11'));var authService=require(_0xe88b('0x12'));var qs=require(_0xe88b('0x13'));var as=require(_0xe88b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe88b('0x15'))(_0xe88b('0x16'));var utils=require(_0xe88b('0x17'));var config=require(_0xe88b('0x18'));var licenseUtil=require(_0xe88b('0x19'));var db=require(_0xe88b('0x1a'))['db'];function respondWithStatusCode(_0x439012,_0x386004){_0x386004=_0x386004||0xcc;return function(_0x1fd07d){if(_0x1fd07d){return _0x439012['sendStatus'](_0x386004);}return _0x439012[_0xe88b('0x1b')](_0x386004)['end']();};}function respondWithResult(_0x3dbdc1,_0xb1f62b){_0xb1f62b=_0xb1f62b||0xc8;return function(_0x43543d){if(_0x43543d){return _0x3dbdc1[_0xe88b('0x1b')](_0xb1f62b)['json'](_0x43543d);}};}function respondWithFilteredResult(_0x285767,_0x5315dd){return function(_0x158f84){if(_0x158f84){var _0x146adc=typeof _0x5315dd['offset']==='undefined'&&typeof _0x5315dd['limit']===_0xe88b('0x1c');var _0x3922d7=_0x158f84['count'];var _0xf2bf08=_0x146adc?0x0:_0x5315dd['offset'];var _0xa575f7=_0x146adc?_0x158f84[_0xe88b('0x1d')]:_0x5315dd[_0xe88b('0x1e')]+_0x5315dd[_0xe88b('0x1f')];var _0x17b193;if(_0xa575f7>=_0x3922d7){_0xa575f7=_0x3922d7;_0x17b193=0xc8;}else{_0x17b193=0xce;}_0x285767[_0xe88b('0x1b')](_0x17b193);return _0x285767[_0xe88b('0x20')](_0xe88b('0x21'),_0xf2bf08+'-'+_0xa575f7+'/'+_0x3922d7)[_0xe88b('0x22')](_0x158f84);}return null;};}function patchUpdates(_0x1142a0){return function(_0x8581b5){try{jsonpatch[_0xe88b('0x23')](_0x8581b5,_0x1142a0,!![]);}catch(_0x3f4e63){return BPromise[_0xe88b('0x24')](_0x3f4e63);}return _0x8581b5[_0xe88b('0x25')]();};}function saveUpdates(_0xe522bd,_0x17d6ac){return function(_0x358d16){if(_0x358d16){return _0x358d16[_0xe88b('0x26')](_0xe522bd)['then'](function(_0x376240){return _0x376240;});}return null;};}function removeEntity(_0x2f71c5,_0x11fc60){return function(_0x30ceee){if(_0x30ceee){return _0x30ceee[_0xe88b('0x27')]()[_0xe88b('0x28')](function(){_0x2f71c5[_0xe88b('0x1b')](0xcc)[_0xe88b('0x29')]();});}};}function handleEntityNotFound(_0x241dae,_0x40dca){return function(_0x535b3e){if(!_0x535b3e){_0x241dae[_0xe88b('0x2a')](0x194);}return _0x535b3e;};}function handleError(_0xa6166a,_0x41bf4b){_0x41bf4b=_0x41bf4b||0x1f4;return function(_0x27bf94){logger[_0xe88b('0x2b')](_0x27bf94[_0xe88b('0x2c')]);if(_0x27bf94[_0xe88b('0x2d')]){delete _0x27bf94[_0xe88b('0x2d')];}_0xa6166a['status'](_0x41bf4b)[_0xe88b('0x2e')](_0x27bf94);};}exports[_0xe88b('0x2f')]=function(_0x2a965a,_0x2039ae){var _0x2f9c59={},_0x40c599={},_0x40d690={'count':0x0,'rows':[]};var _0xb9deed=_[_0xe88b('0x30')](db[_0xe88b('0x31')]['rawAttributes'],function(_0x48b971){return{'name':_0x48b971[_0xe88b('0x32')],'type':_0x48b971[_0xe88b('0x33')][_0xe88b('0x34')]};});_0x40c599['model']=_[_0xe88b('0x30')](_0xb9deed,'name');_0x40c599['query']=_['keys'](_0x2a965a['query']);_0x40c599['filters']=_[_0xe88b('0x35')](_0x40c599['model'],_0x40c599[_0xe88b('0x36')]);_0x2f9c59[_0xe88b('0x37')]=_[_0xe88b('0x35')](_0x40c599[_0xe88b('0x38')],qs[_0xe88b('0x39')](_0x2a965a['query'][_0xe88b('0x39')]));_0x2f9c59[_0xe88b('0x37')]=_0x2f9c59[_0xe88b('0x37')][_0xe88b('0x3a')]?_0x2f9c59['attributes']:_0x40c599[_0xe88b('0x38')];if(!_0x2a965a[_0xe88b('0x36')][_0xe88b('0x3b')](_0xe88b('0x3c'))){_0x2f9c59[_0xe88b('0x1f')]=qs['limit'](_0x2a965a['query'][_0xe88b('0x1f')]);_0x2f9c59[_0xe88b('0x1e')]=qs[_0xe88b('0x1e')](_0x2a965a[_0xe88b('0x36')][_0xe88b('0x1e')]);}_0x2f9c59[_0xe88b('0x3d')]=qs['sort'](_0x2a965a[_0xe88b('0x36')][_0xe88b('0x3e')]);_0x2f9c59[_0xe88b('0x3f')]=qs[_0xe88b('0x40')](_[_0xe88b('0x41')](_0x2a965a['query'],_0x40c599['filters']),_0xb9deed);if(_0x2a965a[_0xe88b('0x36')][_0xe88b('0x42')]){_0x2f9c59[_0xe88b('0x3f')]=_[_0xe88b('0x43')](_0x2f9c59['where'],{'$or':_['map'](_0xb9deed,function(_0x2fb8be){if(_0x2fb8be[_0xe88b('0x33')]!==_0xe88b('0x44')){var _0x33e335={};_0x33e335[_0x2fb8be['name']]={'$like':'%'+_0x2a965a[_0xe88b('0x36')][_0xe88b('0x42')]+'%'};return _0x33e335;}})});}_0x2f9c59=_[_0xe88b('0x43')]({},_0x2f9c59,_0x2a965a['options']);var _0x376273={'where':_0x2f9c59['where']};return db[_0xe88b('0x31')][_0xe88b('0x1d')](_0x376273)['then'](function(_0x76020){_0x40d690[_0xe88b('0x1d')]=_0x76020;if(_0x2a965a[_0xe88b('0x36')][_0xe88b('0x45')]){_0x2f9c59['include']=[{'all':!![]}];}return db['ZohoField']['findAll'](_0x2f9c59);})[_0xe88b('0x28')](function(_0x55fbaa){_0x40d690[_0xe88b('0x46')]=_0x55fbaa;return _0x40d690;})['then'](respondWithFilteredResult(_0x2039ae,_0x2f9c59))['catch'](handleError(_0x2039ae,null));};exports[_0xe88b('0x47')]=function(_0x14587c,_0x1b8b40){var _0x1dcadb={'raw':!![],'where':{'id':_0x14587c[_0xe88b('0x48')]['id']}},_0x1c98ef={};_0x1c98ef[_0xe88b('0x38')]=_[_0xe88b('0x49')](db['ZohoField'][_0xe88b('0x4a')]);_0x1c98ef[_0xe88b('0x36')]=_[_0xe88b('0x49')](_0x14587c[_0xe88b('0x36')]);_0x1c98ef[_0xe88b('0x40')]=_['intersection'](_0x1c98ef[_0xe88b('0x38')],_0x1c98ef['query']);_0x1dcadb[_0xe88b('0x37')]=_[_0xe88b('0x35')](_0x1c98ef[_0xe88b('0x38')],qs[_0xe88b('0x39')](_0x14587c[_0xe88b('0x36')][_0xe88b('0x39')]));_0x1dcadb['attributes']=_0x1dcadb[_0xe88b('0x37')][_0xe88b('0x3a')]?_0x1dcadb[_0xe88b('0x37')]:_0x1c98ef[_0xe88b('0x38')];if(_0x14587c['query'][_0xe88b('0x45')]){_0x1dcadb[_0xe88b('0x4b')]=[{'all':!![]}];}_0x1dcadb=_[_0xe88b('0x43')]({},_0x1dcadb,_0x14587c[_0xe88b('0x4c')]);return db[_0xe88b('0x31')]['find'](_0x1dcadb)[_0xe88b('0x28')](handleEntityNotFound(_0x1b8b40,null))['then'](respondWithResult(_0x1b8b40,null))[_0xe88b('0x4d')](handleError(_0x1b8b40,null));};exports['create']=function(_0x265a2e,_0x466f0b){return db['ZohoField'][_0xe88b('0x4e')](_0x265a2e['body'],{})['then'](respondWithResult(_0x466f0b,0xc9))[_0xe88b('0x4d')](handleError(_0x466f0b,null));};exports['update']=function(_0x1b4445,_0x34d6bf){if(_0x1b4445[_0xe88b('0x4f')]['id']){delete _0x1b4445[_0xe88b('0x4f')]['id'];}return db[_0xe88b('0x31')][_0xe88b('0x50')]({'where':{'id':_0x1b4445['params']['id']}})[_0xe88b('0x28')](handleEntityNotFound(_0x34d6bf,null))[_0xe88b('0x28')](saveUpdates(_0x1b4445['body'],null))[_0xe88b('0x28')](respondWithResult(_0x34d6bf,null))[_0xe88b('0x4d')](handleError(_0x34d6bf,null));};exports[_0xe88b('0x27')]=function(_0x38f174,_0x304e95){return db[_0xe88b('0x31')]['find']({'where':{'id':_0x38f174[_0xe88b('0x48')]['id']}})['then'](handleEntityNotFound(_0x304e95,null))[_0xe88b('0x28')](removeEntity(_0x304e95,null))[_0xe88b('0x4d')](handleError(_0x304e95,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 3da47bc..635c379 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 _0x9536=['zoho_unique_index','FieldId','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x9536,0x179));var _0x6953=function(_0x400b43,_0x55da4e){_0x400b43=_0x400b43-0x0;var _0x3c330f=_0x9536[_0x400b43];return _0x3c330f;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var logger=require(_0x6953('0x2'))(_0x6953('0x3'));var moment=require('moment');var BPromise=require(_0x6953('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6953('0x5'));var rimraf=require(_0x6953('0x6'));var config=require(_0x6953('0x7'));var attributes=require(_0x6953('0x8'));module[_0x6953('0x9')]=function(_0x494ac2,_0x2b273e){return _0x494ac2[_0x6953('0xa')](_0x6953('0xb'),attributes,{'tableName':_0x6953('0xc'),'paranoid':![],'indexes':[{'name':_0x6953('0xd'),'fields':['idField',_0x6953('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7278=['idField','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index'];(function(_0x1b8408,_0x845524){var _0x2d595e=function(_0x434401){while(--_0x434401){_0x1b8408['push'](_0x1b8408['shift']());}};_0x2d595e(++_0x845524);}(_0x7278,0x161));var _0x8727=function(_0x483c14,_0x54a605){_0x483c14=_0x483c14-0x0;var _0x34ab60=_0x7278[_0x483c14];return _0x34ab60;};'use strict';var _=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var logger=require(_0x8727('0x2'))(_0x8727('0x3'));var moment=require(_0x8727('0x4'));var BPromise=require('bluebird');var rp=require(_0x8727('0x5'));var fs=require('fs');var path=require(_0x8727('0x6'));var rimraf=require(_0x8727('0x7'));var config=require(_0x8727('0x8'));var attributes=require(_0x8727('0x9'));module[_0x8727('0xa')]=function(_0x180b71,_0x5549d5){return _0x180b71[_0x8727('0xb')](_0x8727('0xc'),attributes,{'tableName':_0x8727('0xd'),'paranoid':![],'indexes':[{'name':_0x8727('0xe'),'fields':[_0x8727('0xf'),'FieldId'],'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 d640adc..de499c3 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 _0xe4f2=['debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','info','ZohoField,\x20%s,\x20%s'];(function(_0x27a651,_0x11a283){var _0xa5d93a=function(_0x219194){while(--_0x219194){_0x27a651['push'](_0x27a651['shift']());}};_0xa5d93a(++_0x11a283);}(_0xe4f2,0x71));var _0x2e4f=function(_0x4252bf,_0xc977d7){_0x4252bf=_0x4252bf-0x0;var _0x32a218=_0xe4f2[_0x4252bf];return _0x32a218;};'use strict';var _=require(_0x2e4f('0x0'));var util=require(_0x2e4f('0x1'));var moment=require(_0x2e4f('0x2'));var BPromise=require(_0x2e4f('0x3'));var rs=require(_0x2e4f('0x4'));var fs=require('fs');var Redis=require(_0x2e4f('0x5'));var db=require(_0x2e4f('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2e4f('0x7'));var jayson=require(_0x2e4f('0x8'));var client=jayson[_0x2e4f('0x9')][_0x2e4f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x82b78b,_0x5043b3,_0x497d84){return new BPromise(function(_0x57c0c4,_0x76271a){return client['request'](_0x82b78b,_0x497d84)['then'](function(_0x4c5ca5){logger[_0x2e4f('0xb')](_0x2e4f('0xc'),_0x5043b3,'request\x20sent');logger[_0x2e4f('0xd')](_0x2e4f('0xe'),_0x5043b3,_0x2e4f('0xf'),JSON[_0x2e4f('0x10')](_0x4c5ca5));if(_0x4c5ca5[_0x2e4f('0x11')]){if(_0x4c5ca5[_0x2e4f('0x11')][_0x2e4f('0x12')]===0x1f4){logger[_0x2e4f('0x11')](_0x2e4f('0xc'),_0x5043b3,_0x4c5ca5['error'][_0x2e4f('0x13')]);return _0x76271a(_0x4c5ca5[_0x2e4f('0x11')][_0x2e4f('0x13')]);}logger[_0x2e4f('0x11')]('ZohoField,\x20%s,\x20%s',_0x5043b3,_0x4c5ca5[_0x2e4f('0x11')]['message']);return _0x57c0c4(_0x4c5ca5[_0x2e4f('0x11')][_0x2e4f('0x13')]);}else{logger[_0x2e4f('0xb')](_0x2e4f('0xc'),_0x5043b3,_0x2e4f('0xf'));_0x57c0c4(_0x4c5ca5['result'][_0x2e4f('0x13')]);}})[_0x2e4f('0x14')](function(_0x563ed5){logger[_0x2e4f('0x11')](_0x2e4f('0xc'),_0x5043b3,_0x563ed5);_0x76271a(_0x563ed5);});});} \ No newline at end of file +var _0x3683=['request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x144e28,_0x4f2d55){var _0x5b9fdc=function(_0x3ee351){while(--_0x3ee351){_0x144e28['push'](_0x144e28['shift']());}};_0x5b9fdc(++_0x4f2d55);}(_0x3683,0x95));var _0x3368=function(_0x4267e6,_0x1c8002){_0x4267e6=_0x4267e6-0x0;var _0x4e0159=_0x3683[_0x4267e6];return _0x4e0159;};'use strict';var _=require(_0x3368('0x0'));var util=require(_0x3368('0x1'));var moment=require(_0x3368('0x2'));var BPromise=require(_0x3368('0x3'));var rs=require(_0x3368('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3368('0x5'))['db'];var utils=require(_0x3368('0x6'));var logger=require(_0x3368('0x7'))(_0x3368('0x8'));var config=require(_0x3368('0x9'));var jayson=require(_0x3368('0xa'));var client=jayson['client'][_0x3368('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36fd53,_0x39b33d,_0xf7d142){return new BPromise(function(_0x3e107b,_0x4f7fe6){return client[_0x3368('0xc')](_0x36fd53,_0xf7d142)[_0x3368('0xd')](function(_0x57ecf1){logger[_0x3368('0xe')](_0x3368('0xf'),_0x39b33d,_0x3368('0x10'));logger['debug'](_0x3368('0x11'),_0x39b33d,_0x3368('0x10'),JSON['stringify'](_0x57ecf1));if(_0x57ecf1['error']){if(_0x57ecf1[_0x3368('0x12')][_0x3368('0x13')]===0x1f4){logger[_0x3368('0x12')](_0x3368('0xf'),_0x39b33d,_0x57ecf1['error'][_0x3368('0x14')]);return _0x4f7fe6(_0x57ecf1[_0x3368('0x12')][_0x3368('0x14')]);}logger[_0x3368('0x12')](_0x3368('0xf'),_0x39b33d,_0x57ecf1['error'][_0x3368('0x14')]);return _0x3e107b(_0x57ecf1[_0x3368('0x12')]['message']);}else{logger[_0x3368('0xe')](_0x3368('0xf'),_0x39b33d,_0x3368('0x10'));_0x3e107b(_0x57ecf1[_0x3368('0x15')]['message']);}})[_0x3368('0x16')](function(_0x26c93b){logger[_0x3368('0x12')]('ZohoField,\x20%s,\x20%s',_0x39b33d,_0x26c93b);_0x4f7fe6(_0x26c93b);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 5514267..9222cea 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x24474c,_0x9d0904){var _0x19329a=function(_0xa37ceb){while(--_0xa37ceb){_0x24474c['push'](_0x24474c['shift']());}};_0x19329a(++_0x9d0904);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x5072ee,_0x119257){var _0x4d6a17=function(_0x48ac1c){while(--_0x48ac1c){_0x5072ee['push'](_0x5072ee['shift']());}};_0x4d6a17(++_0x119257);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xcb91[_0x36c5b0];return _0xf19333;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 94c7a90..a891446 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 _0x0df9=['INTEGER','BOOLEAN','sequelize','STRING','unique_name_and_version','app.js'];(function(_0x4fd138,_0x2a5be7){var _0x42ca6b=function(_0x10a095){while(--_0x10a095){_0x4fd138['push'](_0x4fd138['shift']());}};_0x42ca6b(++_0x2a5be7);}(_0x0df9,0x170));var _0x90df=function(_0x2e789c,_0x35f459){_0x2e789c=_0x2e789c-0x0;var _0x35c631=_0x0df9[_0x2e789c];return _0x35c631;};'use strict';var Sequelize=require(_0x90df('0x0'));module['exports']={'name':{'type':Sequelize[_0x90df('0x1')],'allowNull':![],'unique':_0x90df('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x90df('0x2')},'main':{'type':Sequelize[_0x90df('0x1')],'defaultValue':_0x90df('0x3')},'filename':{'type':Sequelize[_0x90df('0x1')]},'path':{'type':Sequelize[_0x90df('0x1')]},'type':{'type':Sequelize[_0x90df('0x1')]},'size':{'type':Sequelize[_0x90df('0x4')]},'active':{'type':Sequelize[_0x90df('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x90df('0x1')]},'logo':{'type':Sequelize[_0x90df('0x1')]},'state':{'type':Sequelize['STRING'],'unique':'state'},'description':{'type':Sequelize[_0x90df('0x1')]},'title':{'type':Sequelize[_0x90df('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x90df('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x274e=['unique_name_and_version','INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x2ab3c5,_0x35a3ef){var _0x2733aa=function(_0x338802){while(--_0x338802){_0x2ab3c5['push'](_0x2ab3c5['shift']());}};_0x2733aa(++_0x35a3ef);}(_0x274e,0x1d1));var _0xe274=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x274e[_0x13b02f];return _0x12e9a6;};'use strict';var Sequelize=require(_0xe274('0x0'));module[_0xe274('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xe274('0x2')],'allowNull':![],'unique':_0xe274('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0xe274('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0xe274('0x4')]},'active':{'type':Sequelize[_0xe274('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xe274('0x2')]},'state':{'type':Sequelize[_0xe274('0x2')],'unique':'state'},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xe274('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 03b3b0d..99b39a2 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 _0xba34=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','Integration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x373419,_0x44e096){var _0x199f1c=function(_0x555586){while(--_0x555586){_0x373419['push'](_0x373419['shift']());}};_0x199f1c(++_0x44e096);}(_0xba34,0x119));var _0x4ba3=function(_0x5266db,_0x14c21a){_0x5266db=_0x5266db-0x0;var _0x75870c=_0xba34[_0x5266db];return _0x75870c;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1073d4,_0x52f55c){_0x52f55c=_0x52f55c||0xcc;return function(_0x256f02){if(_0x256f02){return _0x1073d4[_0x4ba3('0x19')](_0x52f55c);}return _0x1073d4[_0x4ba3('0x1a')](_0x52f55c)[_0x4ba3('0x1b')]();};}function respondWithResult(_0x2bc796,_0x3d2ace){_0x3d2ace=_0x3d2ace||0xc8;return function(_0x3a74f7){if(_0x3a74f7){return _0x2bc796[_0x4ba3('0x1a')](_0x3d2ace)[_0x4ba3('0x1c')](_0x3a74f7);}};}function respondWithFilteredResult(_0x401366,_0x36638b){return function(_0x301359){if(_0x301359){var _0x29a9d1=typeof _0x36638b[_0x4ba3('0x1d')]===_0x4ba3('0x1e')&&typeof _0x36638b[_0x4ba3('0x1f')]==='undefined';var _0x382fd0=_0x301359[_0x4ba3('0x20')];var _0x5ff7ce=_0x29a9d1?0x0:_0x36638b[_0x4ba3('0x1d')];var _0x556290=_0x29a9d1?_0x301359[_0x4ba3('0x20')]:_0x36638b[_0x4ba3('0x1d')]+_0x36638b[_0x4ba3('0x1f')];var _0x1e2ce5;if(_0x556290>=_0x382fd0){_0x556290=_0x382fd0;_0x1e2ce5=0xc8;}else{_0x1e2ce5=0xce;}_0x401366[_0x4ba3('0x1a')](_0x1e2ce5);return _0x401366[_0x4ba3('0x21')]('Content-Range',_0x5ff7ce+'-'+_0x556290+'/'+_0x382fd0)['json'](_0x301359);}return null;};}function patchUpdates(_0x2278b0){return function(_0x579d9f){try{jsonpatch[_0x4ba3('0x22')](_0x579d9f,_0x2278b0,!![]);}catch(_0x163967){return BPromise[_0x4ba3('0x23')](_0x163967);}return _0x579d9f[_0x4ba3('0x24')]();};}function saveUpdates(_0x46f1f5,_0x278a23){return function(_0x4a0823){if(_0x4a0823){return _0x4a0823[_0x4ba3('0x25')](_0x46f1f5)[_0x4ba3('0x26')](function(_0x5c28f9){return _0x5c28f9;});}return null;};}function removeEntity(_0x28bb3d,_0x4ffe39){return function(_0x1ae4de){if(_0x1ae4de){return _0x1ae4de[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){_0x28bb3d[_0x4ba3('0x1a')](0xcc)[_0x4ba3('0x1b')]();});}};}function handleEntityNotFound(_0xe29a49,_0x159596){return function(_0xe1f7d2){if(!_0xe1f7d2){_0xe29a49[_0x4ba3('0x19')](0x194);}return _0xe1f7d2;};}function handleError(_0x2e67a0,_0x50c729){_0x50c729=_0x50c729||0x1f4;return function(_0x252f37){logger[_0x4ba3('0x28')](_0x252f37[_0x4ba3('0x29')]);if(_0x252f37['name']){delete _0x252f37[_0x4ba3('0x2a')];}_0x2e67a0[_0x4ba3('0x1a')](_0x50c729)[_0x4ba3('0x2b')](_0x252f37);};}exports['index']=function(_0x10cae6,_0x843276){var _0x34ecb4={},_0x22394d={},_0x4a339e={'count':0x0,'rows':[]};var _0x590108=_[_0x4ba3('0x2c')](db[_0x4ba3('0x2d')][_0x4ba3('0x2e')],function(_0x19f039){return{'name':_0x19f039[_0x4ba3('0x2f')],'type':_0x19f039[_0x4ba3('0x30')]['key']};});_0x22394d[_0x4ba3('0x31')]=_[_0x4ba3('0x2c')](_0x590108,_0x4ba3('0x2a'));_0x22394d[_0x4ba3('0x32')]=_[_0x4ba3('0x33')](_0x10cae6[_0x4ba3('0x32')]);_0x22394d[_0x4ba3('0x34')]=_[_0x4ba3('0x35')](_0x22394d[_0x4ba3('0x31')],_0x22394d[_0x4ba3('0x32')]);_0x34ecb4['attributes']=_['intersection'](_0x22394d['model'],qs[_0x4ba3('0x36')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x36')]));_0x34ecb4[_0x4ba3('0x37')]=_0x34ecb4[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x34ecb4[_0x4ba3('0x37')]:_0x22394d[_0x4ba3('0x31')];if(!_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x39')](_0x4ba3('0x3a'))){_0x34ecb4[_0x4ba3('0x1f')]=qs['limit'](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x1f')]);_0x34ecb4[_0x4ba3('0x1d')]=qs['offset'](_0x10cae6[_0x4ba3('0x32')]['offset']);}_0x34ecb4[_0x4ba3('0x3b')]=qs[_0x4ba3('0x3c')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x3c')]);_0x34ecb4[_0x4ba3('0x3d')]=qs[_0x4ba3('0x34')](_['pick'](_0x10cae6[_0x4ba3('0x32')],_0x22394d[_0x4ba3('0x34')]),_0x590108);if(_0x10cae6[_0x4ba3('0x32')]['filter']){_0x34ecb4[_0x4ba3('0x3d')]=_[_0x4ba3('0x3e')](_0x34ecb4['where'],{'$or':_[_0x4ba3('0x2c')](_0x590108,function(_0x503777){if(_0x503777['type']!==_0x4ba3('0x3f')){var _0x1acc74={};_0x1acc74[_0x503777[_0x4ba3('0x2a')]]={'$like':'%'+_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x40')]+'%'};return _0x1acc74;}})});}_0x34ecb4=_['merge']({},_0x34ecb4,_0x10cae6[_0x4ba3('0x41')]);var _0x10e4b5={'where':_0x34ecb4[_0x4ba3('0x3d')]};return db[_0x4ba3('0x2d')][_0x4ba3('0x20')](_0x10e4b5)[_0x4ba3('0x26')](function(_0x349af4){_0x4a339e[_0x4ba3('0x20')]=_0x349af4;if(_0x10cae6['query'][_0x4ba3('0x42')]){_0x34ecb4[_0x4ba3('0x43')]=[{'all':!![]}];}return db[_0x4ba3('0x2d')][_0x4ba3('0x44')](_0x34ecb4);})[_0x4ba3('0x26')](function(_0x25b2c9){_0x4a339e[_0x4ba3('0x45')]=_0x25b2c9;return _0x4a339e;})[_0x4ba3('0x26')](respondWithFilteredResult(_0x843276,_0x34ecb4))[_0x4ba3('0x46')](handleError(_0x843276,null));};exports[_0x4ba3('0x47')]=function(_0x3b9a0a,_0x1c58d2){var _0x1d031b={'raw':![],'where':{'id':_0x3b9a0a['params']['id']}},_0x28b649={};_0x28b649['model']=_['keys'](db['Integration']['rawAttributes']);_0x28b649[_0x4ba3('0x32')]=_['keys'](_0x3b9a0a[_0x4ba3('0x32')]);_0x28b649['filters']=_[_0x4ba3('0x35')](_0x28b649[_0x4ba3('0x31')],_0x28b649[_0x4ba3('0x32')]);_0x1d031b[_0x4ba3('0x37')]=_[_0x4ba3('0x35')](_0x28b649['model'],qs[_0x4ba3('0x36')](_0x3b9a0a['query'][_0x4ba3('0x36')]));_0x1d031b['attributes']=_0x1d031b[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x1d031b[_0x4ba3('0x37')]:_0x28b649[_0x4ba3('0x31')];if(_0x3b9a0a[_0x4ba3('0x32')][_0x4ba3('0x42')]){_0x1d031b[_0x4ba3('0x43')]=[{'all':!![]}];}_0x1d031b=_['merge']({},_0x1d031b,_0x3b9a0a[_0x4ba3('0x41')]);return db[_0x4ba3('0x2d')][_0x4ba3('0x48')](_0x1d031b)[_0x4ba3('0x26')](handleEntityNotFound(_0x1c58d2,null))[_0x4ba3('0x26')](respondWithResult(_0x1c58d2,null))['catch'](handleError(_0x1c58d2,null));};exports['create']=function(_0xa4bbb2,_0x1fe115){return db[_0x4ba3('0x2d')]['create'](_0xa4bbb2[_0x4ba3('0x49')],{})[_0x4ba3('0x26')](respondWithResult(_0x1fe115,0xc9))[_0x4ba3('0x46')](handleError(_0x1fe115,null));};exports['update']=function(_0x47f588,_0x34dc04){if(_0x47f588['body']['id']){delete _0x47f588[_0x4ba3('0x49')]['id'];}return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'id':_0x47f588[_0x4ba3('0x4a')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x34dc04,null))[_0x4ba3('0x26')](saveUpdates(_0x47f588['body'],null))[_0x4ba3('0x26')](respondWithResult(_0x34dc04,null))[_0x4ba3('0x46')](handleError(_0x34dc04,null));};exports['destroy']=function(_0x325475,_0x12ae6f){return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'id':_0x325475[_0x4ba3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12ae6f,null))[_0x4ba3('0x26')](removeEntity(_0x12ae6f,null))[_0x4ba3('0x46')](handleError(_0x12ae6f,null));}; \ No newline at end of file +var _0xfdbd=['findAll','rows','show','length','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','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','end','json','offset','undefined','count','limit','set','reject','save','update','destroy','then','error','stack','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include'];(function(_0x20b001,_0x4036d4){var _0xc144c3=function(_0x844418){while(--_0x844418){_0x20b001['push'](_0x20b001['shift']());}};_0xc144c3(++_0x4036d4);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x31520d,_0x50046a){_0x31520d=_0x31520d-0x0;var _0x4d0d26=_0xfdbd[_0x31520d];return _0x4d0d26;};'use strict';var emlformat=require(_0xdfdb('0x0'));var rimraf=require(_0xdfdb('0x1'));var zipdir=require(_0xdfdb('0x2'));var jsonpatch=require(_0xdfdb('0x3'));var rp=require(_0xdfdb('0x4'));var moment=require(_0xdfdb('0x5'));var BPromise=require(_0xdfdb('0x6'));var Mustache=require(_0xdfdb('0x7'));var util=require(_0xdfdb('0x8'));var path=require('path');var sox=require(_0xdfdb('0x9'));var csv=require('to-csv');var ejs=require(_0xdfdb('0xa'));var fs=require('fs');var fs_extra=require(_0xdfdb('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdfdb('0xc'));var deskjs=require(_0xdfdb('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdfdb('0xe'));var Papa=require(_0xdfdb('0xf'));var Redis=require(_0xdfdb('0x10'));var authService=require(_0xdfdb('0x11'));var qs=require(_0xdfdb('0x12'));var as=require(_0xdfdb('0x13'));var hardwareService=require(_0xdfdb('0x14'));var logger=require('../../config/logger')(_0xdfdb('0x15'));var utils=require(_0xdfdb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdfdb('0x17'));var db=require(_0xdfdb('0x18'))['db'];function respondWithStatusCode(_0x2bee3b,_0x1918c1){_0x1918c1=_0x1918c1||0xcc;return function(_0x2a95f1){if(_0x2a95f1){return _0x2bee3b[_0xdfdb('0x19')](_0x1918c1);}return _0x2bee3b[_0xdfdb('0x1a')](_0x1918c1)[_0xdfdb('0x1b')]();};}function respondWithResult(_0x51162f,_0x48a66a){_0x48a66a=_0x48a66a||0xc8;return function(_0x2c44dc){if(_0x2c44dc){return _0x51162f['status'](_0x48a66a)[_0xdfdb('0x1c')](_0x2c44dc);}};}function respondWithFilteredResult(_0x9f3039,_0x11a56a){return function(_0x40bc8a){if(_0x40bc8a){var _0x3bfd81=typeof _0x11a56a[_0xdfdb('0x1d')]==='undefined'&&typeof _0x11a56a['limit']===_0xdfdb('0x1e');var _0x8b9193=_0x40bc8a[_0xdfdb('0x1f')];var _0x55ab5a=_0x3bfd81?0x0:_0x11a56a[_0xdfdb('0x1d')];var _0xb677b1=_0x3bfd81?_0x40bc8a[_0xdfdb('0x1f')]:_0x11a56a[_0xdfdb('0x1d')]+_0x11a56a[_0xdfdb('0x20')];var _0x2294de;if(_0xb677b1>=_0x8b9193){_0xb677b1=_0x8b9193;_0x2294de=0xc8;}else{_0x2294de=0xce;}_0x9f3039[_0xdfdb('0x1a')](_0x2294de);return _0x9f3039[_0xdfdb('0x21')]('Content-Range',_0x55ab5a+'-'+_0xb677b1+'/'+_0x8b9193)[_0xdfdb('0x1c')](_0x40bc8a);}return null;};}function patchUpdates(_0xb7417c){return function(_0x172c63){try{jsonpatch['apply'](_0x172c63,_0xb7417c,!![]);}catch(_0x377112){return BPromise[_0xdfdb('0x22')](_0x377112);}return _0x172c63[_0xdfdb('0x23')]();};}function saveUpdates(_0x4d55e5,_0x280e53){return function(_0x789bd2){if(_0x789bd2){return _0x789bd2[_0xdfdb('0x24')](_0x4d55e5)['then'](function(_0x2a80c1){return _0x2a80c1;});}return null;};}function removeEntity(_0x526057,_0x2db1c1){return function(_0x145350){if(_0x145350){return _0x145350[_0xdfdb('0x25')]()[_0xdfdb('0x26')](function(){_0x526057['status'](0xcc)[_0xdfdb('0x1b')]();});}};}function handleEntityNotFound(_0x4363d8,_0x956843){return function(_0x400663){if(!_0x400663){_0x4363d8[_0xdfdb('0x19')](0x194);}return _0x400663;};}function handleError(_0x305954,_0x57d24f){_0x57d24f=_0x57d24f||0x1f4;return function(_0xec4d22){logger[_0xdfdb('0x27')](_0xec4d22[_0xdfdb('0x28')]);if(_0xec4d22['name']){delete _0xec4d22[_0xdfdb('0x29')];}_0x305954['status'](_0x57d24f)[_0xdfdb('0x2a')](_0xec4d22);};}exports[_0xdfdb('0x2b')]=function(_0x19c36f,_0x513fa0){var _0x5bc174={},_0x1c8ca8={},_0xc56435={'count':0x0,'rows':[]};var _0xedbb91=_[_0xdfdb('0x2c')](db[_0xdfdb('0x2d')][_0xdfdb('0x2e')],function(_0x5a9fc4){return{'name':_0x5a9fc4[_0xdfdb('0x2f')],'type':_0x5a9fc4[_0xdfdb('0x30')][_0xdfdb('0x31')]};});_0x1c8ca8[_0xdfdb('0x32')]=_[_0xdfdb('0x2c')](_0xedbb91,_0xdfdb('0x29'));_0x1c8ca8[_0xdfdb('0x33')]=_[_0xdfdb('0x34')](_0x19c36f[_0xdfdb('0x33')]);_0x1c8ca8[_0xdfdb('0x35')]=_[_0xdfdb('0x36')](_0x1c8ca8['model'],_0x1c8ca8['query']);_0x5bc174[_0xdfdb('0x37')]=_['intersection'](_0x1c8ca8[_0xdfdb('0x32')],qs[_0xdfdb('0x38')](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x38')]));_0x5bc174['attributes']=_0x5bc174[_0xdfdb('0x37')]['length']?_0x5bc174[_0xdfdb('0x37')]:_0x1c8ca8[_0xdfdb('0x32')];if(!_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x39')](_0xdfdb('0x3a'))){_0x5bc174[_0xdfdb('0x20')]=qs['limit'](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x20')]);_0x5bc174['offset']=qs[_0xdfdb('0x1d')](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x1d')]);}_0x5bc174[_0xdfdb('0x3b')]=qs[_0xdfdb('0x3c')](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x3c')]);_0x5bc174[_0xdfdb('0x3d')]=qs[_0xdfdb('0x35')](_[_0xdfdb('0x3e')](_0x19c36f[_0xdfdb('0x33')],_0x1c8ca8['filters']),_0xedbb91);if(_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x3f')]){_0x5bc174[_0xdfdb('0x3d')]=_[_0xdfdb('0x40')](_0x5bc174[_0xdfdb('0x3d')],{'$or':_[_0xdfdb('0x2c')](_0xedbb91,function(_0x3ec73a){if(_0x3ec73a[_0xdfdb('0x30')]!=='VIRTUAL'){var _0x55d707={};_0x55d707[_0x3ec73a[_0xdfdb('0x29')]]={'$like':'%'+_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x3f')]+'%'};return _0x55d707;}})});}_0x5bc174=_[_0xdfdb('0x40')]({},_0x5bc174,_0x19c36f[_0xdfdb('0x41')]);var _0x300884={'where':_0x5bc174[_0xdfdb('0x3d')]};return db[_0xdfdb('0x2d')][_0xdfdb('0x1f')](_0x300884)['then'](function(_0x175f57){_0xc56435[_0xdfdb('0x1f')]=_0x175f57;if(_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x42')]){_0x5bc174[_0xdfdb('0x43')]=[{'all':!![]}];}return db['Integration'][_0xdfdb('0x44')](_0x5bc174);})[_0xdfdb('0x26')](function(_0x3e9f88){_0xc56435[_0xdfdb('0x45')]=_0x3e9f88;return _0xc56435;})[_0xdfdb('0x26')](respondWithFilteredResult(_0x513fa0,_0x5bc174))['catch'](handleError(_0x513fa0,null));};exports[_0xdfdb('0x46')]=function(_0xd2f8bd,_0xf0482a){var _0x5b4381={'raw':![],'where':{'id':_0xd2f8bd['params']['id']}},_0x2b5139={};_0x2b5139[_0xdfdb('0x32')]=_['keys'](db[_0xdfdb('0x2d')][_0xdfdb('0x2e')]);_0x2b5139['query']=_[_0xdfdb('0x34')](_0xd2f8bd['query']);_0x2b5139[_0xdfdb('0x35')]=_[_0xdfdb('0x36')](_0x2b5139[_0xdfdb('0x32')],_0x2b5139[_0xdfdb('0x33')]);_0x5b4381[_0xdfdb('0x37')]=_['intersection'](_0x2b5139['model'],qs[_0xdfdb('0x38')](_0xd2f8bd[_0xdfdb('0x33')]['fields']));_0x5b4381[_0xdfdb('0x37')]=_0x5b4381['attributes'][_0xdfdb('0x47')]?_0x5b4381[_0xdfdb('0x37')]:_0x2b5139[_0xdfdb('0x32')];if(_0xd2f8bd[_0xdfdb('0x33')][_0xdfdb('0x42')]){_0x5b4381[_0xdfdb('0x43')]=[{'all':!![]}];}_0x5b4381=_[_0xdfdb('0x40')]({},_0x5b4381,_0xd2f8bd[_0xdfdb('0x41')]);return db[_0xdfdb('0x2d')][_0xdfdb('0x48')](_0x5b4381)[_0xdfdb('0x26')](handleEntityNotFound(_0xf0482a,null))[_0xdfdb('0x26')](respondWithResult(_0xf0482a,null))[_0xdfdb('0x49')](handleError(_0xf0482a,null));};exports[_0xdfdb('0x4a')]=function(_0x1c08fb,_0x273477){return db['Integration']['create'](_0x1c08fb[_0xdfdb('0x4b')],{})[_0xdfdb('0x26')](respondWithResult(_0x273477,0xc9))[_0xdfdb('0x49')](handleError(_0x273477,null));};exports['update']=function(_0x36149e,_0x4d4c90){if(_0x36149e[_0xdfdb('0x4b')]['id']){delete _0x36149e[_0xdfdb('0x4b')]['id'];}return db['Integration'][_0xdfdb('0x48')]({'where':{'id':_0x36149e[_0xdfdb('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4d4c90,null))[_0xdfdb('0x26')](saveUpdates(_0x36149e[_0xdfdb('0x4b')],null))[_0xdfdb('0x26')](respondWithResult(_0x4d4c90,null))[_0xdfdb('0x49')](handleError(_0x4d4c90,null));};exports[_0xdfdb('0x25')]=function(_0x10b490,_0x17dfdb){return db[_0xdfdb('0x2d')][_0xdfdb('0x48')]({'where':{'id':_0x10b490['params']['id']}})[_0xdfdb('0x26')](handleEntityNotFound(_0x17dfdb,null))['then'](removeEntity(_0x17dfdb,null))[_0xdfdb('0x49')](handleError(_0x17dfdb,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 894f7fa..aab2580 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 _0x2f3a=['util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations'];(function(_0x340181,_0x461dc9){var _0x59950e=function(_0x536c91){while(--_0x536c91){_0x340181['push'](_0x340181['shift']());}};_0x59950e(++_0x461dc9);}(_0x2f3a,0xbb));var _0xa2f3=function(_0x4dc0c4,_0x3ed069){_0x4dc0c4=_0x4dc0c4-0x0;var _0x3669f3=_0x2f3a[_0x4dc0c4];return _0x3669f3;};'use strict';var _=require('lodash');var util=require(_0xa2f3('0x0'));var logger=require(_0xa2f3('0x1'))('api');var moment=require(_0xa2f3('0x2'));var BPromise=require(_0xa2f3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa2f3('0x4'));var config=require(_0xa2f3('0x5'));var attributes=require(_0xa2f3('0x6'));module[_0xa2f3('0x7')]=function(_0x566945,_0x3028b4){return _0x566945[_0xa2f3('0x8')](_0xa2f3('0x9'),attributes,{'tableName':_0xa2f3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6935=['./integration.attributes','define','Integration','integrations','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x5a745e,_0x104e57){var _0x2d1b02=function(_0x2ba147){while(--_0x2ba147){_0x5a745e['push'](_0x5a745e['shift']());}};_0x2d1b02(++_0x104e57);}(_0x6935,0x190));var _0x5693=function(_0x4c18f2,_0x4b43ed){_0x4c18f2=_0x4c18f2-0x0;var _0x5f2fea=_0x6935[_0x4c18f2];return _0x5f2fea;};'use strict';var _=require(_0x5693('0x0'));var util=require(_0x5693('0x1'));var logger=require(_0x5693('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5693('0x3'));var rp=require(_0x5693('0x4'));var fs=require('fs');var path=require(_0x5693('0x5'));var rimraf=require(_0x5693('0x6'));var config=require('../../config/environment');var attributes=require(_0x5693('0x7'));module['exports']=function(_0x144a2f,_0x3b4473){return _0x144a2f[_0x5693('0x8')](_0x5693('0x9'),attributes,{'tableName':_0x5693('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 7837114..e211700 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 _0x1967=['then','info','Integration,\x20%s,\x20%s','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0x1967,0x173));var _0x7196=function(_0x22f55d,_0x24ab21){_0x22f55d=_0x22f55d-0x0;var _0x39211b=_0x1967[_0x22f55d];return _0x39211b;};'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);});});} \ No newline at end of file +var _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x2c7b86,_0x59ef3c){var _0x256735=function(_0x352e33){while(--_0x352e33){_0x2c7b86['push'](_0x2c7b86['shift']());}};_0x256735(++_0x59ef3c);}(_0x524e,0x15e));var _0xe524=function(_0x44c009,_0x39488b){_0x44c009=_0x44c009-0x0;var _0x4c36c8=_0x524e[_0x44c009];return _0x4c36c8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('Integration,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('Integration,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('Integration,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index d2ceb1a..bcca827 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 _0xe2fe=['describe','/:id','post','update','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x4d45c1,_0x2beda1){var _0x244478=function(_0x11304c){while(--_0x11304c){_0x4d45c1['push'](_0x4d45c1['shift']());}};_0x244478(++_0x2beda1);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./integrationReport.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0xc')]('/',auth[_0xee2f('0x8')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xe')]);module[_0xee2f('0xf')]=router; \ No newline at end of file +var _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x2d4da9,_0x270d1f){var _0x430ecb=function(_0x2d14dd){while(--_0x2d14dd){_0x2d4da9['push'](_0x2d4da9['shift']());}};_0x430ecb(++_0x270d1f);}(_0x4975,0x86));var _0x5497=function(_0x2860d2,_0x59b52f){_0x2860d2=_0x2860d2-0x0;var _0x142dea=_0x4975[_0x2860d2];return _0x142dea;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xf'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 7814b03..d03098a 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 _0x6163=['INTEGER','BOOLEAN','ENUM','SENT','SENDING','RECEIVED','sequelize','exports','STRING','DATE'];(function(_0x309d93,_0x157662){var _0x2dd61d=function(_0x25ff34){while(--_0x25ff34){_0x309d93['push'](_0x309d93['shift']());}};_0x2dd61d(++_0x157662);}(_0x6163,0x1a0));var _0x3616=function(_0x2283f3,_0x44d219){_0x2283f3=_0x2283f3-0x0;var _0x149a96=_0x6163[_0x2283f3];return _0x149a96;};'use strict';var Sequelize=require(_0x3616('0x0'));module[_0x3616('0x1')]={'integration':{'type':Sequelize[_0x3616('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x3616('0x2')]},'ticketId':{'type':Sequelize[_0x3616('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x3616('0x2')]},'calleridnum':{'type':Sequelize[_0x3616('0x2')]},'calleridname':{'type':Sequelize[_0x3616('0x2')]},'queue':{'type':Sequelize[_0x3616('0x2')]},'interface':{'type':Sequelize[_0x3616('0x2')]},'membername':{'type':Sequelize[_0x3616('0x2')]},'agentcalledAt':{'type':Sequelize[_0x3616('0x3')]},'agentconnectAt':{'type':Sequelize[_0x3616('0x3')]},'holdtime':{'type':Sequelize[_0x3616('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x3616('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x3616('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x3616('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x3616('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x3616('0x3')]},'agentdump':{'type':Sequelize[_0x3616('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x3616('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x3616('0x4')]},'channelstatedesc':{'type':Sequelize[_0x3616('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x3616('0x2')]},'language':{'type':Sequelize[_0x3616('0x2')]},'accountcode':{'type':Sequelize[_0x3616('0x2')]},'context':{'type':Sequelize[_0x3616('0x2')]},'exten':{'type':Sequelize[_0x3616('0x2')]},'priority':{'type':Sequelize[_0x3616('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x3616('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x3616('0x2')]},'destcalleridnum':{'type':Sequelize[_0x3616('0x2')]},'destcalleridname':{'type':Sequelize[_0x3616('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x3616('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x3616('0x2')]},'destlanguage':{'type':Sequelize[_0x3616('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x3616('0x2')]},'destexten':{'type':Sequelize[_0x3616('0x2')]},'destpriority':{'type':Sequelize[_0x3616('0x2')]},'destuniqueid':{'type':Sequelize[_0x3616('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x3616('0x2')]},'from':{'type':Sequelize[_0x3616('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x3616('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x3616('0x6')](_0x3616('0x7'),_0x3616('0x8'),_0x3616('0x9'),'FAILED')},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x3616('0x2')]},'projectId':{'type':Sequelize[_0x3616('0x4')]}}; \ No newline at end of file +var _0xccc5=['SENDING','FAILED','sequelize','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM'];(function(_0x429cb8,_0x6e41b9){var _0x39b110=function(_0x51f85f){while(--_0x51f85f){_0x429cb8['push'](_0x429cb8['shift']());}};_0x39b110(++_0x6e41b9);}(_0xccc5,0x1bb));var _0x5ccc=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xccc5[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require(_0x5ccc('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x5ccc('0x1')]},'exitStatus':{'type':Sequelize[_0x5ccc('0x1')]},'ticketId':{'type':Sequelize[_0x5ccc('0x1')]},'integrationId':{'type':Sequelize[_0x5ccc('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5ccc('0x1')]},'queue':{'type':Sequelize[_0x5ccc('0x1')]},'interface':{'type':Sequelize[_0x5ccc('0x1')]},'membername':{'type':Sequelize[_0x5ccc('0x1')]},'agentcalledAt':{'type':Sequelize[_0x5ccc('0x3')]},'agentconnectAt':{'type':Sequelize[_0x5ccc('0x3')]},'holdtime':{'type':Sequelize[_0x5ccc('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x5ccc('0x3')]},'talktime':{'type':Sequelize[_0x5ccc('0x2')]},'agentacw':{'type':Sequelize[_0x5ccc('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x5ccc('0x2')]},'reason':{'type':Sequelize[_0x5ccc('0x1')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x5ccc('0x3')]},'agentdump':{'type':Sequelize[_0x5ccc('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x5ccc('0x3')]},'lastevent':{'type':Sequelize[_0x5ccc('0x1')]},'channel':{'type':Sequelize[_0x5ccc('0x1')]},'channelstate':{'type':Sequelize[_0x5ccc('0x2')]},'channelstatedesc':{'type':Sequelize[_0x5ccc('0x1')]},'connectedlinenum':{'type':Sequelize[_0x5ccc('0x1')]},'connectedlinename':{'type':Sequelize[_0x5ccc('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x5ccc('0x1')]},'context':{'type':Sequelize[_0x5ccc('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5ccc('0x1')]},'destchannel':{'type':Sequelize[_0x5ccc('0x1')]},'destchannelstate':{'type':Sequelize[_0x5ccc('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x5ccc('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x5ccc('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x5ccc('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x5ccc('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x5ccc('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x5ccc('0x1')]},'destuniqueid':{'type':Sequelize[_0x5ccc('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x5ccc('0x1')]},'subject':{'type':Sequelize[_0x5ccc('0x1')]},'from':{'type':Sequelize[_0x5ccc('0x1')]},'to':{'type':Sequelize[_0x5ccc('0x1')]},'cc':{'type':Sequelize[_0x5ccc('0x1')]},'attachment':{'type':Sequelize[_0x5ccc('0x5')]},'html':{'type':Sequelize[_0x5ccc('0x5')]},'text':{'type':Sequelize[_0x5ccc('0x5')]},'status':{'type':Sequelize[_0x5ccc('0x6')]('SENT',_0x5ccc('0x7'),'RECEIVED',_0x5ccc('0x8'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x5ccc('0x1')]},'appdata':{'type':Sequelize[_0x5ccc('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 03b017b..ba229d8 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 _0xe01f=['sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','end','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0xe01f,0x1e0));var _0xfe01=function(_0x5b1779,_0x8aec73){_0x5b1779=_0x5b1779-0x0;var _0x162240=_0xe01f[_0x5b1779];return _0x162240;};'use strict';var emlformat=require(_0xfe01('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfe01('0x1'));var jsonpatch=require(_0xfe01('0x2'));var rp=require(_0xfe01('0x3'));var moment=require(_0xfe01('0x4'));var BPromise=require(_0xfe01('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(_0xfe01('0x6'));var fs=require('fs');var fs_extra=require(_0xfe01('0x7'));var _=require(_0xfe01('0x8'));var squel=require(_0xfe01('0x9'));var crypto=require(_0xfe01('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xfe01('0xb'));var toCsv=require(_0xfe01('0xc'));var querystring=require(_0xfe01('0xd'));var Papa=require(_0xfe01('0xe'));var Redis=require(_0xfe01('0xf'));var authService=require(_0xfe01('0x10'));var qs=require(_0xfe01('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfe01('0x12'))(_0xfe01('0x13'));var utils=require(_0xfe01('0x14'));var config=require(_0xfe01('0x15'));var licenseUtil=require(_0xfe01('0x16'));var db=require(_0xfe01('0x17'))['db'];function respondWithStatusCode(_0x2982ec,_0xfe4b88){_0xfe4b88=_0xfe4b88||0xcc;return function(_0x1b7615){if(_0x1b7615){return _0x2982ec[_0xfe01('0x18')](_0xfe4b88);}return _0x2982ec['status'](_0xfe4b88)['end']();};}function respondWithResult(_0x5c7c3f,_0x3df16f){_0x3df16f=_0x3df16f||0xc8;return function(_0x47f8ce){if(_0x47f8ce){return _0x5c7c3f[_0xfe01('0x19')](_0x3df16f)['json'](_0x47f8ce);}};}function respondWithFilteredResult(_0x10e0c6,_0x25dddd){return function(_0x1a2c9e){if(_0x1a2c9e){var _0x54021b=typeof _0x25dddd[_0xfe01('0x1a')]===_0xfe01('0x1b')&&typeof _0x25dddd[_0xfe01('0x1c')]===_0xfe01('0x1b');var _0x5aa8f6=_0x1a2c9e[_0xfe01('0x1d')];var _0x9cac16=_0x54021b?0x0:_0x25dddd['offset'];var _0x2d2579=_0x54021b?_0x1a2c9e[_0xfe01('0x1d')]:_0x25dddd[_0xfe01('0x1a')]+_0x25dddd[_0xfe01('0x1c')];var _0x16ed46;if(_0x2d2579>=_0x5aa8f6){_0x2d2579=_0x5aa8f6;_0x16ed46=0xc8;}else{_0x16ed46=0xce;}_0x10e0c6[_0xfe01('0x19')](_0x16ed46);return _0x10e0c6[_0xfe01('0x1e')](_0xfe01('0x1f'),_0x9cac16+'-'+_0x2d2579+'/'+_0x5aa8f6)[_0xfe01('0x20')](_0x1a2c9e);}return null;};}function patchUpdates(_0x28807d){return function(_0x454e37){try{jsonpatch[_0xfe01('0x21')](_0x454e37,_0x28807d,!![]);}catch(_0x192067){return BPromise[_0xfe01('0x22')](_0x192067);}return _0x454e37['save']();};}function saveUpdates(_0x47ac45,_0x43f571){return function(_0x1eea6b){if(_0x1eea6b){return _0x1eea6b[_0xfe01('0x23')](_0x47ac45)[_0xfe01('0x24')](function(_0x35b696){return _0x35b696;});}return null;};}function removeEntity(_0x45abdd,_0x2cc67e){return function(_0x5dd799){if(_0x5dd799){return _0x5dd799['destroy']()[_0xfe01('0x24')](function(){_0x45abdd['status'](0xcc)[_0xfe01('0x25')]();});}};}function handleEntityNotFound(_0x3ed3cb,_0x1a849a){return function(_0x43ad88){if(!_0x43ad88){_0x3ed3cb[_0xfe01('0x18')](0x194);}return _0x43ad88;};}function handleError(_0x1bb081,_0x3c016e){_0x3c016e=_0x3c016e||0x1f4;return function(_0x35f984){logger['error'](_0x35f984[_0xfe01('0x26')]);if(_0x35f984[_0xfe01('0x27')]){delete _0x35f984[_0xfe01('0x27')];}_0x1bb081['status'](_0x3c016e)[_0xfe01('0x28')](_0x35f984);};}exports[_0xfe01('0x29')]=function(_0x41d057,_0x555860){var _0x131128={},_0x14ab95={},_0x14f521={'count':0x0,'rows':[]};var _0x51f6b5=_[_0xfe01('0x2a')](db[_0xfe01('0x2b')][_0xfe01('0x2c')],function(_0x14d527){return{'name':_0x14d527[_0xfe01('0x2d')],'type':_0x14d527[_0xfe01('0x2e')][_0xfe01('0x2f')]};});_0x14ab95[_0xfe01('0x30')]=_[_0xfe01('0x2a')](_0x51f6b5,_0xfe01('0x27'));_0x14ab95[_0xfe01('0x31')]=_[_0xfe01('0x32')](_0x41d057[_0xfe01('0x31')]);_0x14ab95[_0xfe01('0x33')]=_['intersection'](_0x14ab95[_0xfe01('0x30')],_0x14ab95[_0xfe01('0x31')]);_0x131128[_0xfe01('0x34')]=_[_0xfe01('0x35')](_0x14ab95['model'],qs[_0xfe01('0x36')](_0x41d057[_0xfe01('0x31')][_0xfe01('0x36')]));_0x131128[_0xfe01('0x34')]=_0x131128[_0xfe01('0x34')][_0xfe01('0x37')]?_0x131128[_0xfe01('0x34')]:_0x14ab95['model'];if(!_0x41d057[_0xfe01('0x31')][_0xfe01('0x38')](_0xfe01('0x39'))){_0x131128['limit']=qs[_0xfe01('0x1c')](_0x41d057['query'][_0xfe01('0x1c')]);_0x131128['offset']=qs[_0xfe01('0x1a')](_0x41d057[_0xfe01('0x31')]['offset']);}_0x131128[_0xfe01('0x3a')]=qs[_0xfe01('0x3b')](_0x41d057[_0xfe01('0x31')][_0xfe01('0x3b')]);_0x131128[_0xfe01('0x3c')]=qs[_0xfe01('0x33')](_[_0xfe01('0x3d')](_0x41d057[_0xfe01('0x31')],_0x14ab95[_0xfe01('0x33')]),_0x51f6b5);if(_0x41d057['query'][_0xfe01('0x3e')]){_0x131128['where']=_[_0xfe01('0x3f')](_0x131128[_0xfe01('0x3c')],{'$or':_[_0xfe01('0x2a')](_0x51f6b5,function(_0x3ee4ad){if(_0x3ee4ad[_0xfe01('0x2e')]!==_0xfe01('0x40')){var _0x4de369={};_0x4de369[_0x3ee4ad[_0xfe01('0x27')]]={'$like':'%'+_0x41d057[_0xfe01('0x31')][_0xfe01('0x3e')]+'%'};return _0x4de369;}})});}_0x131128=_[_0xfe01('0x3f')]({},_0x131128,_0x41d057[_0xfe01('0x41')]);var _0x39dd58={'where':_0x131128[_0xfe01('0x3c')]};return db[_0xfe01('0x2b')][_0xfe01('0x1d')](_0x39dd58)['then'](function(_0x523e1d){_0x14f521[_0xfe01('0x1d')]=_0x523e1d;if(_0x41d057[_0xfe01('0x31')][_0xfe01('0x42')]){_0x131128[_0xfe01('0x43')]=[{'all':!![]}];}return db['IntegrationReport'][_0xfe01('0x44')](_0x131128);})[_0xfe01('0x24')](function(_0x839bd5){_0x14f521[_0xfe01('0x45')]=_0x839bd5;return _0x14f521;})[_0xfe01('0x24')](respondWithFilteredResult(_0x555860,_0x131128))[_0xfe01('0x46')](handleError(_0x555860,null));};exports[_0xfe01('0x47')]=function(_0x5c23a3,_0x19c529){var _0x3715ef={'raw':![],'where':{'id':_0x5c23a3[_0xfe01('0x48')]['id']}},_0x3f0feb={};_0x3f0feb[_0xfe01('0x30')]=_[_0xfe01('0x32')](db[_0xfe01('0x2b')][_0xfe01('0x2c')]);_0x3f0feb[_0xfe01('0x31')]=_[_0xfe01('0x32')](_0x5c23a3['query']);_0x3f0feb['filters']=_[_0xfe01('0x35')](_0x3f0feb['model'],_0x3f0feb[_0xfe01('0x31')]);_0x3715ef[_0xfe01('0x34')]=_[_0xfe01('0x35')](_0x3f0feb[_0xfe01('0x30')],qs[_0xfe01('0x36')](_0x5c23a3[_0xfe01('0x31')][_0xfe01('0x36')]));_0x3715ef[_0xfe01('0x34')]=_0x3715ef['attributes'][_0xfe01('0x37')]?_0x3715ef[_0xfe01('0x34')]:_0x3f0feb[_0xfe01('0x30')];if(_0x5c23a3[_0xfe01('0x31')][_0xfe01('0x42')]){_0x3715ef[_0xfe01('0x43')]=[{'all':!![]}];}_0x3715ef=_[_0xfe01('0x3f')]({},_0x3715ef,_0x5c23a3[_0xfe01('0x41')]);return db[_0xfe01('0x2b')][_0xfe01('0x49')](_0x3715ef)[_0xfe01('0x24')](handleEntityNotFound(_0x19c529,null))[_0xfe01('0x24')](respondWithResult(_0x19c529,null))['catch'](handleError(_0x19c529,null));};exports['create']=function(_0x49de76,_0x250895){return db[_0xfe01('0x2b')]['create'](_0x49de76[_0xfe01('0x4a')],{})['then'](respondWithResult(_0x250895,0xc9))['catch'](handleError(_0x250895,null));};exports[_0xfe01('0x23')]=function(_0x5b508e,_0x4422bc){if(_0x5b508e[_0xfe01('0x4a')]['id']){delete _0x5b508e[_0xfe01('0x4a')]['id'];}return db[_0xfe01('0x2b')]['find']({'where':{'id':_0x5b508e[_0xfe01('0x48')]['id']}})[_0xfe01('0x24')](handleEntityNotFound(_0x4422bc,null))[_0xfe01('0x24')](saveUpdates(_0x5b508e[_0xfe01('0x4a')],null))[_0xfe01('0x24')](respondWithResult(_0x4422bc,null))[_0xfe01('0x46')](handleError(_0x4422bc,null));};exports[_0xfe01('0x4b')]=function(_0x3524f5,_0x32dfb1){return db[_0xfe01('0x2b')][_0xfe01('0x49')]({'where':{'id':_0x3524f5[_0xfe01('0x48')]['id']}})['then'](handleEntityNotFound(_0x32dfb1,null))[_0xfe01('0x24')](removeEntity(_0x32dfb1,null))['catch'](handleError(_0x32dfb1,null));};exports[_0xfe01('0x4c')]=function(_0x3a4b59,_0x44840a){return db[_0xfe01('0x2b')][_0xfe01('0x4c')]()[_0xfe01('0x24')](respondWithResult(_0x44840a,null))['catch'](handleError(_0x44840a,null));}; \ No newline at end of file +var _0x267e=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','then','error','stack','name','index','map','IntegrationReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','rows','show','params','include','find','catch','create','body','describe','eml-format','rimraf','zip-dir'];(function(_0x53b53e,_0x498437){var _0xbb6179=function(_0x3975eb){while(--_0x3975eb){_0x53b53e['push'](_0x53b53e['shift']());}};_0xbb6179(++_0x498437);}(_0x267e,0x1ee));var _0xe267=function(_0x1a13e8,_0x4472ef){_0x1a13e8=_0x1a13e8-0x0;var _0x4c1848=_0x267e[_0x1a13e8];return _0x4c1848;};'use strict';var emlformat=require(_0xe267('0x0'));var rimraf=require(_0xe267('0x1'));var zipdir=require(_0xe267('0x2'));var jsonpatch=require(_0xe267('0x3'));var rp=require(_0xe267('0x4'));var moment=require(_0xe267('0x5'));var BPromise=require(_0xe267('0x6'));var Mustache=require(_0xe267('0x7'));var util=require(_0xe267('0x8'));var path=require(_0xe267('0x9'));var sox=require(_0xe267('0xa'));var csv=require(_0xe267('0xb'));var ejs=require(_0xe267('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe267('0xd'));var crypto=require('crypto');var jsforce=require(_0xe267('0xe'));var deskjs=require(_0xe267('0xf'));var toCsv=require(_0xe267('0xb'));var querystring=require(_0xe267('0x10'));var Papa=require(_0xe267('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe267('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe267('0x13'))(_0xe267('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe267('0x15'))['db'];function respondWithStatusCode(_0x16ba1a,_0x5e942a){_0x5e942a=_0x5e942a||0xcc;return function(_0x56e6f2){if(_0x56e6f2){return _0x16ba1a[_0xe267('0x16')](_0x5e942a);}return _0x16ba1a['status'](_0x5e942a)[_0xe267('0x17')]();};}function respondWithResult(_0x582d3f,_0xcbaabd){_0xcbaabd=_0xcbaabd||0xc8;return function(_0x5772ca){if(_0x5772ca){return _0x582d3f[_0xe267('0x18')](_0xcbaabd)['json'](_0x5772ca);}};}function respondWithFilteredResult(_0x1e1f93,_0x4c5a83){return function(_0x563f96){if(_0x563f96){var _0x7fc092=typeof _0x4c5a83[_0xe267('0x19')]===_0xe267('0x1a')&&typeof _0x4c5a83[_0xe267('0x1b')]==='undefined';var _0x59ab21=_0x563f96[_0xe267('0x1c')];var _0x3eac7c=_0x7fc092?0x0:_0x4c5a83['offset'];var _0x1b6c6b=_0x7fc092?_0x563f96['count']:_0x4c5a83[_0xe267('0x19')]+_0x4c5a83[_0xe267('0x1b')];var _0x151912;if(_0x1b6c6b>=_0x59ab21){_0x1b6c6b=_0x59ab21;_0x151912=0xc8;}else{_0x151912=0xce;}_0x1e1f93[_0xe267('0x18')](_0x151912);return _0x1e1f93[_0xe267('0x1d')](_0xe267('0x1e'),_0x3eac7c+'-'+_0x1b6c6b+'/'+_0x59ab21)[_0xe267('0x1f')](_0x563f96);}return null;};}function patchUpdates(_0x34c573){return function(_0x136b18){try{jsonpatch[_0xe267('0x20')](_0x136b18,_0x34c573,!![]);}catch(_0x384c39){return BPromise['reject'](_0x384c39);}return _0x136b18[_0xe267('0x21')]();};}function saveUpdates(_0x328a05,_0x4f545e){return function(_0x15c667){if(_0x15c667){return _0x15c667[_0xe267('0x22')](_0x328a05)['then'](function(_0x8f090d){return _0x8f090d;});}return null;};}function removeEntity(_0x5adc7b,_0x2ddc94){return function(_0x287662){if(_0x287662){return _0x287662[_0xe267('0x23')]()[_0xe267('0x24')](function(){_0x5adc7b['status'](0xcc)[_0xe267('0x17')]();});}};}function handleEntityNotFound(_0x18e3c4,_0x59e5fd){return function(_0x217b2b){if(!_0x217b2b){_0x18e3c4[_0xe267('0x16')](0x194);}return _0x217b2b;};}function handleError(_0x5437ed,_0x1ec8a4){_0x1ec8a4=_0x1ec8a4||0x1f4;return function(_0x3e199b){logger[_0xe267('0x25')](_0x3e199b[_0xe267('0x26')]);if(_0x3e199b[_0xe267('0x27')]){delete _0x3e199b[_0xe267('0x27')];}_0x5437ed[_0xe267('0x18')](_0x1ec8a4)['send'](_0x3e199b);};}exports[_0xe267('0x28')]=function(_0x220f0e,_0x2e181b){var _0x32ff95={},_0x151357={},_0x32d66f={'count':0x0,'rows':[]};var _0x54ead7=_[_0xe267('0x29')](db[_0xe267('0x2a')][_0xe267('0x2b')],function(_0x274a32){return{'name':_0x274a32[_0xe267('0x2c')],'type':_0x274a32[_0xe267('0x2d')]['key']};});_0x151357[_0xe267('0x2e')]=_['map'](_0x54ead7,_0xe267('0x27'));_0x151357[_0xe267('0x2f')]=_[_0xe267('0x30')](_0x220f0e['query']);_0x151357[_0xe267('0x31')]=_[_0xe267('0x32')](_0x151357[_0xe267('0x2e')],_0x151357[_0xe267('0x2f')]);_0x32ff95[_0xe267('0x33')]=_[_0xe267('0x32')](_0x151357['model'],qs[_0xe267('0x34')](_0x220f0e[_0xe267('0x2f')][_0xe267('0x34')]));_0x32ff95['attributes']=_0x32ff95[_0xe267('0x33')][_0xe267('0x35')]?_0x32ff95[_0xe267('0x33')]:_0x151357[_0xe267('0x2e')];if(!_0x220f0e[_0xe267('0x2f')][_0xe267('0x36')](_0xe267('0x37'))){_0x32ff95[_0xe267('0x1b')]=qs[_0xe267('0x1b')](_0x220f0e['query'][_0xe267('0x1b')]);_0x32ff95[_0xe267('0x19')]=qs[_0xe267('0x19')](_0x220f0e[_0xe267('0x2f')][_0xe267('0x19')]);}_0x32ff95['order']=qs[_0xe267('0x38')](_0x220f0e[_0xe267('0x2f')][_0xe267('0x38')]);_0x32ff95[_0xe267('0x39')]=qs['filters'](_[_0xe267('0x3a')](_0x220f0e[_0xe267('0x2f')],_0x151357['filters']),_0x54ead7);if(_0x220f0e[_0xe267('0x2f')][_0xe267('0x3b')]){_0x32ff95['where']=_[_0xe267('0x3c')](_0x32ff95[_0xe267('0x39')],{'$or':_[_0xe267('0x29')](_0x54ead7,function(_0x348f25){if(_0x348f25['type']!=='VIRTUAL'){var _0x5d4c83={};_0x5d4c83[_0x348f25[_0xe267('0x27')]]={'$like':'%'+_0x220f0e[_0xe267('0x2f')]['filter']+'%'};return _0x5d4c83;}})});}_0x32ff95=_['merge']({},_0x32ff95,_0x220f0e['options']);var _0x5a216c={'where':_0x32ff95[_0xe267('0x39')]};return db[_0xe267('0x2a')]['count'](_0x5a216c)[_0xe267('0x24')](function(_0x1d7d2b){_0x32d66f[_0xe267('0x1c')]=_0x1d7d2b;if(_0x220f0e[_0xe267('0x2f')][_0xe267('0x3d')]){_0x32ff95['include']=[{'all':!![]}];}return db[_0xe267('0x2a')]['findAll'](_0x32ff95);})[_0xe267('0x24')](function(_0x2bcf02){_0x32d66f[_0xe267('0x3e')]=_0x2bcf02;return _0x32d66f;})[_0xe267('0x24')](respondWithFilteredResult(_0x2e181b,_0x32ff95))['catch'](handleError(_0x2e181b,null));};exports[_0xe267('0x3f')]=function(_0x2e2f15,_0x19cc6b){var _0x40e19a={'raw':![],'where':{'id':_0x2e2f15[_0xe267('0x40')]['id']}},_0x350db9={};_0x350db9[_0xe267('0x2e')]=_[_0xe267('0x30')](db[_0xe267('0x2a')][_0xe267('0x2b')]);_0x350db9[_0xe267('0x2f')]=_[_0xe267('0x30')](_0x2e2f15[_0xe267('0x2f')]);_0x350db9[_0xe267('0x31')]=_[_0xe267('0x32')](_0x350db9[_0xe267('0x2e')],_0x350db9[_0xe267('0x2f')]);_0x40e19a[_0xe267('0x33')]=_[_0xe267('0x32')](_0x350db9[_0xe267('0x2e')],qs['fields'](_0x2e2f15[_0xe267('0x2f')]['fields']));_0x40e19a['attributes']=_0x40e19a['attributes']['length']?_0x40e19a[_0xe267('0x33')]:_0x350db9[_0xe267('0x2e')];if(_0x2e2f15[_0xe267('0x2f')][_0xe267('0x3d')]){_0x40e19a[_0xe267('0x41')]=[{'all':!![]}];}_0x40e19a=_[_0xe267('0x3c')]({},_0x40e19a,_0x2e2f15['options']);return db[_0xe267('0x2a')][_0xe267('0x42')](_0x40e19a)[_0xe267('0x24')](handleEntityNotFound(_0x19cc6b,null))[_0xe267('0x24')](respondWithResult(_0x19cc6b,null))[_0xe267('0x43')](handleError(_0x19cc6b,null));};exports[_0xe267('0x44')]=function(_0x4d9ca5,_0x479894){return db['IntegrationReport'][_0xe267('0x44')](_0x4d9ca5['body'],{})['then'](respondWithResult(_0x479894,0xc9))[_0xe267('0x43')](handleError(_0x479894,null));};exports[_0xe267('0x22')]=function(_0x26784b,_0x494ef1){if(_0x26784b[_0xe267('0x45')]['id']){delete _0x26784b[_0xe267('0x45')]['id'];}return db[_0xe267('0x2a')]['find']({'where':{'id':_0x26784b[_0xe267('0x40')]['id']}})[_0xe267('0x24')](handleEntityNotFound(_0x494ef1,null))['then'](saveUpdates(_0x26784b['body'],null))[_0xe267('0x24')](respondWithResult(_0x494ef1,null))[_0xe267('0x43')](handleError(_0x494ef1,null));};exports['destroy']=function(_0x3a23a3,_0x13f4f7){return db[_0xe267('0x2a')][_0xe267('0x42')]({'where':{'id':_0x3a23a3[_0xe267('0x40')]['id']}})['then'](handleEntityNotFound(_0x13f4f7,null))[_0xe267('0x24')](removeEntity(_0x13f4f7,null))['catch'](handleError(_0x13f4f7,null));};exports[_0xe267('0x46')]=function(_0x5745b7,_0x110bc2){return db[_0xe267('0x2a')]['describe']()[_0xe267('0x24')](respondWithResult(_0x110bc2,null))['catch'](handleError(_0x110bc2,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 0c10998..5b33ba0 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 _0xe9fd=['../../config/environment','exports','define','report_integration','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xe9fd,0x67));var _0xde9f=function(_0x210a8a,_0x21d798){_0x210a8a=_0x210a8a-0x0;var _0x1281aa=_0xe9fd[_0x210a8a];return _0x1281aa;};'use strict';var _=require(_0xde9f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xde9f('0x1'));var moment=require(_0xde9f('0x2'));var BPromise=require(_0xde9f('0x3'));var rp=require(_0xde9f('0x4'));var fs=require('fs');var path=require(_0xde9f('0x5'));var rimraf=require(_0xde9f('0x6'));var config=require(_0xde9f('0x7'));var attributes=require('./integrationReport.attributes');module[_0xde9f('0x8')]=function(_0x3085ae,_0x1bd085){return _0x3085ae[_0xde9f('0x9')]('IntegrationReport',attributes,{'tableName':_0xde9f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2464=['report_integration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','IntegrationReport'];(function(_0xf279b,_0x32c37c){var _0x5c7a7a=function(_0x5b8baa){while(--_0x5b8baa){_0xf279b['push'](_0xf279b['shift']());}};_0x5c7a7a(++_0x32c37c);}(_0x2464,0x6d));var _0x4246=function(_0x5e62bc,_0x341468){_0x5e62bc=_0x5e62bc-0x0;var _0x2066f4=_0x2464[_0x5e62bc];return _0x2066f4;};'use strict';var _=require(_0x4246('0x0'));var util=require(_0x4246('0x1'));var logger=require(_0x4246('0x2'))(_0x4246('0x3'));var moment=require(_0x4246('0x4'));var BPromise=require(_0x4246('0x5'));var rp=require(_0x4246('0x6'));var fs=require('fs');var path=require(_0x4246('0x7'));var rimraf=require('rimraf');var config=require(_0x4246('0x8'));var attributes=require('./integrationReport.attributes');module[_0x4246('0x9')]=function(_0x49dae8,_0x42bbdc){return _0x49dae8['define'](_0x4246('0xa'),attributes,{'tableName':_0x4246('0xb'),'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 9eaa945..a9aa40e 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x27e38e,_0x25d5ec){var _0x209d39=function(_0x33d75f){while(--_0x33d75f){_0x27e38e['push'](_0x27e38e['shift']());}};_0x209d39(++_0x25d5ec);}(_0xdb28,0x106));var _0x8db2=function(_0x5f17e8,_0x309012){_0x5f17e8=_0x5f17e8-0x0;var _0x5589ed=_0xdb28[_0x5f17e8];return _0x5589ed;};'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')]('IntegrationReport,\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);});});} \ No newline at end of file +var _0x0295=['client','http','then','info','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','IntegrationReport,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4461fc,_0x262e8e){var _0x4045b2=function(_0x36285d){while(--_0x36285d){_0x4461fc['push'](_0x4461fc['shift']());}};_0x4045b2(++_0x262e8e);}(_0x0295,0x1f0));var _0x5029=function(_0x59f6be,_0x472a09){_0x59f6be=_0x59f6be-0x0;var _0x2aef59=_0x0295[_0x59f6be];return _0x2aef59;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('IntegrationReport,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 9e98c77..798f331 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 _0x7278=['create','/:id/sub_intervals','addInterval','addIntervals','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','/:id','show','post'];(function(_0x498444,_0x3669dd){var _0x4b9b3f=function(_0x3ff6aa){while(--_0x3ff6aa){_0x498444['push'](_0x498444['shift']());}};_0x4b9b3f(++_0x3669dd);}(_0x7278,0x161));var _0x8727=function(_0x384a5e,_0x40de88){_0x384a5e=_0x384a5e-0x0;var _0x55b7ba=_0x7278[_0x384a5e];return _0x55b7ba;};'use strict';var multer=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var path=require(_0x8727('0x2'));var timeout=require(_0x8727('0x3'));var express=require(_0x8727('0x4'));var router=express['Router']();var fs_extra=require(_0x8727('0x5'));var auth=require(_0x8727('0x6'));var interaction=require(_0x8727('0x7'));var config=require(_0x8727('0x8'));var controller=require(_0x8727('0x9'));router[_0x8727('0xa')]('/',auth[_0x8727('0xb')](),controller['index']);router[_0x8727('0xa')](_0x8727('0xc'),auth[_0x8727('0xb')](),controller[_0x8727('0xd')]);router[_0x8727('0xa')]('/:id/sub_intervals',auth['isAuthenticated'](),controller['getIntervals']);router[_0x8727('0xe')]('/',auth[_0x8727('0xb')](),controller[_0x8727('0xf')]);router[_0x8727('0xe')](_0x8727('0x10'),auth[_0x8727('0xb')](),controller[_0x8727('0x11')]);router[_0x8727('0xe')]('/:id/sub_intervals/create_many',auth[_0x8727('0xb')](),controller[_0x8727('0x12')]);router[_0x8727('0x13')]('/:id',auth[_0x8727('0xb')](),controller[_0x8727('0x14')]);router['delete'](_0x8727('0xc'),auth[_0x8727('0xb')](),controller[_0x8727('0x15')]);module[_0x8727('0x16')]=router; \ No newline at end of file +var _0x241e=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','/:id/sub_intervals','post','create','/:id/sub_intervals/create_many','update','delete','destroy','path'];(function(_0x453644,_0x231ea5){var _0x3ba20b=function(_0xc25b9b){while(--_0xc25b9b){_0x453644['push'](_0x453644['shift']());}};_0x3ba20b(++_0x231ea5);}(_0x241e,0x1b4));var _0xe241=function(_0xd0d1e7,_0x42a32b){_0xd0d1e7=_0xd0d1e7-0x0;var _0x39b46b=_0x241e[_0xd0d1e7];return _0x39b46b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe241('0x0'));var timeout=require(_0xe241('0x1'));var express=require('express');var router=express[_0xe241('0x2')]();var fs_extra=require(_0xe241('0x3'));var auth=require(_0xe241('0x4'));var interaction=require(_0xe241('0x5'));var config=require(_0xe241('0x6'));var controller=require(_0xe241('0x7'));router[_0xe241('0x8')]('/',auth[_0xe241('0x9')](),controller[_0xe241('0xa')]);router[_0xe241('0x8')](_0xe241('0xb'),auth[_0xe241('0x9')](),controller['show']);router[_0xe241('0x8')](_0xe241('0xc'),auth[_0xe241('0x9')](),controller['getIntervals']);router[_0xe241('0xd')]('/',auth[_0xe241('0x9')](),controller[_0xe241('0xe')]);router[_0xe241('0xd')](_0xe241('0xc'),auth[_0xe241('0x9')](),controller['addInterval']);router[_0xe241('0xd')](_0xe241('0xf'),auth[_0xe241('0x9')](),controller['addIntervals']);router['put'](_0xe241('0xb'),auth[_0xe241('0x9')](),controller[_0xe241('0x10')]);router[_0xe241('0x11')](_0xe241('0xb'),auth[_0xe241('0x9')](),controller[_0xe241('0x12')]);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 6f3f146..30dc28d 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 _0x9eef=['sequelize','exports','STRING'];(function(_0x4c345f,_0x27459c){var _0x4537c7=function(_0x36eef6){while(--_0x36eef6){_0x4c345f['push'](_0x4c345f['shift']());}};_0x4537c7(++_0x27459c);}(_0x9eef,0x189));var _0xf9ee=function(_0x5bba11,_0xe514ce){_0x5bba11=_0x5bba11-0x0;var _0xfb4bb1=_0x9eef[_0x5bba11];return _0xfb4bb1;};'use strict';var Sequelize=require(_0xf9ee('0x0'));module[_0xf9ee('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf9ee('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x58e1=['exports','STRING','sequelize'];(function(_0x4dc7c2,_0x1baf4b){var _0x132754=function(_0x4a04f7){while(--_0x4a04f7){_0x4dc7c2['push'](_0x4dc7c2['shift']());}};_0x132754(++_0x1baf4b);}(_0x58e1,0x16a));var _0x158e=function(_0x2318bd,_0x47341a){_0x2318bd=_0x2318bd-0x0;var _0x1ee068=_0x58e1[_0x2318bd];return _0x1ee068;};'use strict';var Sequelize=require(_0x158e('0x0'));module[_0x158e('0x1')]={'name':{'type':Sequelize[_0x158e('0x2')]},'description':{'type':Sequelize[_0x158e('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 0b3d2f6..d89e7ab 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 _0x916f=['set','Content-Range','apply','reject','save','update','destroy','then','get','Intervals','end','sendStatus','error','name','send','index','map','Interval','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addInterval','IntervalId','getIntervals','findOne','length','pick','addIntervals','transaction','bulkCreate','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','json','offset','undefined','limit','count'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x916f,0x1c0));var _0xf916=function(_0x5f4192,_0xf0bfe3){_0x5f4192=_0x5f4192-0x0;var _0xcc63aa=_0x916f[_0x5f4192];return _0xcc63aa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf916('0x0'));var zipdir=require(_0xf916('0x1'));var jsonpatch=require(_0xf916('0x2'));var rp=require(_0xf916('0x3'));var moment=require(_0xf916('0x4'));var BPromise=require(_0xf916('0x5'));var Mustache=require(_0xf916('0x6'));var util=require(_0xf916('0x7'));var path=require('path');var sox=require(_0xf916('0x8'));var csv=require(_0xf916('0x9'));var ejs=require(_0xf916('0xa'));var fs=require('fs');var fs_extra=require(_0xf916('0xb'));var _=require(_0xf916('0xc'));var squel=require(_0xf916('0xd'));var crypto=require('crypto');var jsforce=require(_0xf916('0xe'));var deskjs=require(_0xf916('0xf'));var toCsv=require(_0xf916('0x9'));var querystring=require('querystring');var Papa=require(_0xf916('0x10'));var Redis=require(_0xf916('0x11'));var authService=require(_0xf916('0x12'));var qs=require(_0xf916('0x13'));var as=require(_0xf916('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf916('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xf916('0x16'));var licenseUtil=require(_0xf916('0x17'));var db=require(_0xf916('0x18'))['db'];var extensions=require(_0xf916('0x19'));function respondWithStatusCode(_0xa8c5a9,_0x3bc3f0){_0x3bc3f0=_0x3bc3f0||0xcc;return function(_0xe2d368){if(_0xe2d368){return _0xa8c5a9['sendStatus'](_0x3bc3f0);}return _0xa8c5a9[_0xf916('0x1a')](_0x3bc3f0)['end']();};}function respondWithResult(_0xa865c5,_0x53c9e0){_0x53c9e0=_0x53c9e0||0xc8;return function(_0x125246){if(_0x125246){return _0xa865c5[_0xf916('0x1a')](_0x53c9e0)[_0xf916('0x1b')](_0x125246);}};}function respondWithFilteredResult(_0x5b29f2,_0x51f01c){return function(_0x1db16d){if(_0x1db16d){var _0x234e07=typeof _0x51f01c[_0xf916('0x1c')]===_0xf916('0x1d')&&typeof _0x51f01c[_0xf916('0x1e')]===_0xf916('0x1d');var _0x1086f2=_0x1db16d[_0xf916('0x1f')];var _0x58f496=_0x234e07?0x0:_0x51f01c[_0xf916('0x1c')];var _0x299f47=_0x234e07?_0x1db16d[_0xf916('0x1f')]:_0x51f01c[_0xf916('0x1c')]+_0x51f01c[_0xf916('0x1e')];var _0x14b326;if(_0x299f47>=_0x1086f2){_0x299f47=_0x1086f2;_0x14b326=0xc8;}else{_0x14b326=0xce;}_0x5b29f2[_0xf916('0x1a')](_0x14b326);return _0x5b29f2[_0xf916('0x20')](_0xf916('0x21'),_0x58f496+'-'+_0x299f47+'/'+_0x1086f2)['json'](_0x1db16d);}return null;};}function patchUpdates(_0x1de521){return function(_0x257c72){try{jsonpatch[_0xf916('0x22')](_0x257c72,_0x1de521,!![]);}catch(_0x2c5493){return BPromise[_0xf916('0x23')](_0x2c5493);}return _0x257c72[_0xf916('0x24')]();};}function saveUpdates(_0x4e7d69,_0x26c981){return function(_0x1d8268){if(_0x1d8268){return _0x1d8268[_0xf916('0x25')](_0x4e7d69)['then'](function(_0x8822a9){return _0x8822a9;});}return null;};}function removeEntity(_0x1d2f46,_0x2b7ef7){return function(_0x43eb6c){if(_0x43eb6c){return _0x43eb6c[_0xf916('0x26')]()[_0xf916('0x27')](function(){var _0x3f6ede=_0x43eb6c[_0xf916('0x28')]({'plain':!![]});var _0x3411ec=_0xf916('0x29');return db['UserProfileResource'][_0xf916('0x26')]({'where':{'type':_0x3411ec,'resourceId':_0x3f6ede['id']}})['then'](function(){return _0x43eb6c;});})[_0xf916('0x27')](function(){_0x1d2f46[_0xf916('0x1a')](0xcc)[_0xf916('0x2a')]();});}};}function handleEntityNotFound(_0x30c531,_0x14681b){return function(_0x702c56){if(!_0x702c56){_0x30c531[_0xf916('0x2b')](0x194);}return _0x702c56;};}function handleError(_0x49a713,_0x202fc1){_0x202fc1=_0x202fc1||0x1f4;return function(_0x278265){logger[_0xf916('0x2c')](_0x278265['stack']);if(_0x278265['name']){delete _0x278265[_0xf916('0x2d')];}_0x49a713[_0xf916('0x1a')](_0x202fc1)[_0xf916('0x2e')](_0x278265);};}exports[_0xf916('0x2f')]=function(_0x4bf14a,_0x42d8b7){var _0x39d75d={},_0x3f3c65={},_0x10cbf6={'count':0x0,'rows':[]};var _0xff8b3b=_[_0xf916('0x30')](db[_0xf916('0x31')]['rawAttributes'],function(_0x34ecb9){return{'name':_0x34ecb9[_0xf916('0x32')],'type':_0x34ecb9[_0xf916('0x33')][_0xf916('0x34')]};});_0x3f3c65[_0xf916('0x35')]=_[_0xf916('0x30')](_0xff8b3b,_0xf916('0x2d'));_0x3f3c65[_0xf916('0x36')]=_[_0xf916('0x37')](_0x4bf14a[_0xf916('0x36')]);_0x3f3c65[_0xf916('0x38')]=_[_0xf916('0x39')](_0x3f3c65[_0xf916('0x35')],_0x3f3c65['query']);_0x39d75d[_0xf916('0x3a')]=_[_0xf916('0x39')](_0x3f3c65['model'],qs[_0xf916('0x3b')](_0x4bf14a[_0xf916('0x36')][_0xf916('0x3b')]));_0x39d75d[_0xf916('0x3a')]=_0x39d75d[_0xf916('0x3a')]['length']?_0x39d75d[_0xf916('0x3a')]:_0x3f3c65['model'];if(!_0x4bf14a['query'][_0xf916('0x3c')](_0xf916('0x3d'))){_0x39d75d[_0xf916('0x1e')]=qs[_0xf916('0x1e')](_0x4bf14a['query'][_0xf916('0x1e')]);_0x39d75d[_0xf916('0x1c')]=qs[_0xf916('0x1c')](_0x4bf14a[_0xf916('0x36')]['offset']);}_0x39d75d[_0xf916('0x3e')]=qs['sort'](_0x4bf14a[_0xf916('0x36')][_0xf916('0x3f')]);_0x39d75d[_0xf916('0x40')]=qs[_0xf916('0x38')](_['pick'](_0x4bf14a[_0xf916('0x36')],_0x3f3c65[_0xf916('0x38')]),_0xff8b3b);if(_0x4bf14a[_0xf916('0x36')][_0xf916('0x41')]){_0x39d75d[_0xf916('0x40')]=_['merge'](_0x39d75d[_0xf916('0x40')],{'$or':_['map'](_0xff8b3b,function(_0x2b6862){if(_0x2b6862[_0xf916('0x33')]!==_0xf916('0x42')){var _0x1a37fd={};_0x1a37fd[_0x2b6862[_0xf916('0x2d')]]={'$like':'%'+_0x4bf14a['query'][_0xf916('0x41')]+'%'};return _0x1a37fd;}})});}_0x39d75d=_[_0xf916('0x43')]({},_0x39d75d,_0x4bf14a[_0xf916('0x44')]);var _0x4ca328={'where':_0x39d75d[_0xf916('0x40')]};return db['Interval'][_0xf916('0x1f')](_0x4ca328)[_0xf916('0x27')](function(_0x129926){_0x10cbf6['count']=_0x129926;if(_0x4bf14a[_0xf916('0x36')][_0xf916('0x45')]){_0x39d75d[_0xf916('0x46')]=[{'all':!![]}];}return db['Interval'][_0xf916('0x47')](_0x39d75d);})[_0xf916('0x27')](function(_0x4b1c58){_0x10cbf6[_0xf916('0x48')]=_0x4b1c58;return _0x10cbf6;})[_0xf916('0x27')](respondWithFilteredResult(_0x42d8b7,_0x39d75d))[_0xf916('0x49')](handleError(_0x42d8b7,null));};exports[_0xf916('0x4a')]=function(_0x49639c,_0x2fb6c0){var _0x3a39b8={'raw':!![],'where':{'id':_0x49639c['params']['id']}},_0x2cdd68={};_0x2cdd68[_0xf916('0x35')]=_[_0xf916('0x37')](db[_0xf916('0x31')][_0xf916('0x4b')]);_0x2cdd68[_0xf916('0x36')]=_['keys'](_0x49639c[_0xf916('0x36')]);_0x2cdd68[_0xf916('0x38')]=_['intersection'](_0x2cdd68[_0xf916('0x35')],_0x2cdd68[_0xf916('0x36')]);_0x3a39b8[_0xf916('0x3a')]=_[_0xf916('0x39')](_0x2cdd68[_0xf916('0x35')],qs['fields'](_0x49639c[_0xf916('0x36')][_0xf916('0x3b')]));_0x3a39b8[_0xf916('0x3a')]=_0x3a39b8[_0xf916('0x3a')]['length']?_0x3a39b8[_0xf916('0x3a')]:_0x2cdd68[_0xf916('0x35')];if(_0x49639c[_0xf916('0x36')][_0xf916('0x45')]){_0x3a39b8[_0xf916('0x46')]=[{'all':!![]}];}_0x3a39b8=_[_0xf916('0x43')]({},_0x3a39b8,_0x49639c[_0xf916('0x44')]);return db[_0xf916('0x31')][_0xf916('0x4c')](_0x3a39b8)['then'](handleEntityNotFound(_0x2fb6c0,null))['then'](respondWithResult(_0x2fb6c0,null))[_0xf916('0x49')](handleError(_0x2fb6c0,null));};exports[_0xf916('0x4d')]=function(_0x25c359,_0x1bcb74){return db[_0xf916('0x31')]['create'](_0x25c359[_0xf916('0x4e')],{})[_0xf916('0x27')](function(_0x347091){var _0x1ac2d5=_0x25c359[_0xf916('0x4f')][_0xf916('0x28')]({'plain':!![]});if(!_0x1ac2d5)throw new Error(_0xf916('0x50'));if(_0x1ac2d5[_0xf916('0x51')]===_0xf916('0x4f')){var _0x168523=_0x347091[_0xf916('0x28')]({'plain':!![]});var _0x3b2a44='Intervals';return db[_0xf916('0x52')][_0xf916('0x4c')]({'where':{'name':_0x3b2a44,'userProfileId':_0x1ac2d5['userProfileId']},'raw':!![]})['then'](function(_0x80dacf){if(_0x80dacf&&_0x80dacf[_0xf916('0x53')]===0x0){return db[_0xf916('0x54')][_0xf916('0x4d')]({'name':_0x168523[_0xf916('0x2d')],'resourceId':_0x168523['id'],'type':_0x80dacf[_0xf916('0x2d')],'sectionId':_0x80dacf['id']},{})[_0xf916('0x27')](function(){return _0x347091;});}else{return _0x347091;}})['catch'](function(_0x18107a){logger['error'](_0xf916('0x55'),_0x18107a);throw _0x18107a;});}return _0x347091;})[_0xf916('0x27')](respondWithResult(_0x1bcb74,0xc9))[_0xf916('0x49')](handleError(_0x1bcb74,null));};exports['update']=function(_0x3ff64b,_0x30187b){if(_0x3ff64b[_0xf916('0x4e')]['id']){delete _0x3ff64b[_0xf916('0x4e')]['id'];}return db[_0xf916('0x31')][_0xf916('0x4c')]({'where':{'id':_0x3ff64b[_0xf916('0x56')]['id']}})[_0xf916('0x27')](handleEntityNotFound(_0x30187b,null))['then'](saveUpdates(_0x3ff64b[_0xf916('0x4e')],null))[_0xf916('0x27')](respondWithResult(_0x30187b,null))[_0xf916('0x49')](handleError(_0x30187b,null));};exports[_0xf916('0x26')]=function(_0x5b08f9,_0x1ec6d3){return db['Interval'][_0xf916('0x4c')]({'where':{'id':_0x5b08f9[_0xf916('0x56')]['id']}})[_0xf916('0x27')](handleEntityNotFound(_0x1ec6d3,null))[_0xf916('0x27')](removeEntity(_0x1ec6d3,null))['catch'](handleError(_0x1ec6d3,null));};exports[_0xf916('0x57')]=function(_0x509de8,_0x243bcf,_0xf3e84a){if(_0x509de8[_0xf916('0x4e')]['id']){delete _0x509de8[_0xf916('0x4e')]['id'];}return db[_0xf916('0x31')]['find']({'where':{'id':_0x509de8['params']['id']}})['then'](handleEntityNotFound(_0x243bcf,null))[_0xf916('0x27')](function(_0x2dea63){if(_0x2dea63){_0x509de8[_0xf916('0x4e')][_0xf916('0x58')]=_0x2dea63['id'];return db[_0xf916('0x31')][_0xf916('0x4d')](_0x509de8[_0xf916('0x4e')]);}})[_0xf916('0x27')](respondWithResult(_0x243bcf,null))['catch'](handleError(_0x243bcf,null));};exports[_0xf916('0x59')]=function(_0x57eea1,_0x3484ec,_0x1dd7d1){var _0xdb0c09={};var _0x286a6d={};var _0x53f7d0;var _0x3ddb43;return db[_0xf916('0x31')][_0xf916('0x5a')]({'where':{'id':_0x57eea1[_0xf916('0x56')]['id']}})[_0xf916('0x27')](handleEntityNotFound(_0x3484ec,null))['then'](function(_0x84120d){if(_0x84120d){_0x53f7d0=_0x84120d;_0x286a6d[_0xf916('0x35')]=_[_0xf916('0x37')](db[_0xf916('0x31')]['rawAttributes']);_0x286a6d[_0xf916('0x36')]=_['keys'](_0x57eea1[_0xf916('0x36')]);_0x286a6d['filters']=_[_0xf916('0x39')](_0x286a6d[_0xf916('0x35')],_0x286a6d[_0xf916('0x36')]);_0xdb0c09[_0xf916('0x3a')]=_[_0xf916('0x39')](_0x286a6d[_0xf916('0x35')],qs[_0xf916('0x3b')](_0x57eea1[_0xf916('0x36')][_0xf916('0x3b')]));_0xdb0c09[_0xf916('0x3a')]=_0xdb0c09['attributes'][_0xf916('0x5b')]?_0xdb0c09[_0xf916('0x3a')]:_0x286a6d[_0xf916('0x35')];_0xdb0c09[_0xf916('0x3e')]=qs[_0xf916('0x3f')](_0x57eea1[_0xf916('0x36')][_0xf916('0x3f')]);_0xdb0c09[_0xf916('0x40')]=qs['filters'](_[_0xf916('0x5c')](_0x57eea1[_0xf916('0x36')],_0x286a6d[_0xf916('0x38')]));if(_0x57eea1['query'][_0xf916('0x41')]){_0xdb0c09[_0xf916('0x40')]=_['merge'](_0xdb0c09['where'],{'$or':_['map'](_0xdb0c09['attributes'],function(_0xd02a2b){var _0x5d3d5c={};_0x5d3d5c[_0xd02a2b]={'$like':'%'+_0x57eea1[_0xf916('0x36')]['filter']+'%'};return _0x5d3d5c;})});}_0xdb0c09=_[_0xf916('0x43')]({},_0xdb0c09,_0x57eea1[_0xf916('0x44')]);return _0x53f7d0['getIntervals'](_0xdb0c09);}})[_0xf916('0x27')](function(_0x5ea7fb){if(_0x5ea7fb){_0x3ddb43=_0x5ea7fb[_0xf916('0x5b')];if(!_0x57eea1[_0xf916('0x36')]['hasOwnProperty'](_0xf916('0x3d'))){_0xdb0c09['limit']=qs[_0xf916('0x1e')](_0x57eea1[_0xf916('0x36')][_0xf916('0x1e')]);_0xdb0c09[_0xf916('0x1c')]=qs[_0xf916('0x1c')](_0x57eea1['query'][_0xf916('0x1c')]);}return _0x53f7d0[_0xf916('0x59')](_0xdb0c09);}})[_0xf916('0x27')](function(_0x536714){if(_0x536714){return _0x536714?{'count':_0x3ddb43,'rows':_0x536714}:null;}})[_0xf916('0x27')](respondWithResult(_0x3484ec,null))['catch'](handleError(_0x3484ec,null));};exports[_0xf916('0x5d')]=function(_0x592177,_0x333830,_0x13662e){return db[_0xf916('0x31')][_0xf916('0x5a')]({'where':{'id':_0x592177[_0xf916('0x56')]['id']}})[_0xf916('0x27')](handleEntityNotFound(_0x333830,null))[_0xf916('0x27')](function(_0x5c19b1){if(_0x5c19b1){return db['sequelize'][_0xf916('0x5e')](function(_0x195406){return db[_0xf916('0x31')][_0xf916('0x26')]({'where':{'IntervalId':_0x592177[_0xf916('0x56')]['id']},'transaction':_0x195406})[_0xf916('0x27')](function(_0x55cf38){var _0x12f98a=_['map'](_0x592177['body'],function(_0x952f06){delete _0x952f06['id'];_0x952f06['IntervalId']=_0x592177['params']['id'];return _0x952f06;});return db[_0xf916('0x31')][_0xf916('0x5f')](_0x12f98a,{'transaction':_0x195406});});})['then'](function(){return db[_0xf916('0x31')][_0xf916('0x47')]({'where':{'IntervalId':_0x592177['params']['id']}});});}})[_0xf916('0x27')](respondWithResult(_0x333830,null))[_0xf916('0x49')](handleError(_0x333830,null));}; \ No newline at end of file +var _0xf65a=['sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../components/extensions/rewrite','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Intervals','UserProfileResource','error','stack','name','index','map','Interval','fieldName','type','key','model','keys','query','filters','intersection','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','fields','length','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','hasOwnProperty','addIntervals','findOne'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0xf65a,0xbd));var _0xaf65=function(_0xdd64db,_0x31b5e4){_0xdd64db=_0xdd64db-0x0;var _0x19b989=_0xf65a[_0xdd64db];return _0x19b989;};'use strict';var emlformat=require(_0xaf65('0x0'));var rimraf=require(_0xaf65('0x1'));var zipdir=require(_0xaf65('0x2'));var jsonpatch=require(_0xaf65('0x3'));var rp=require(_0xaf65('0x4'));var moment=require(_0xaf65('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaf65('0x6'));var path=require(_0xaf65('0x7'));var sox=require('sox');var csv=require(_0xaf65('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaf65('0x9'));var _=require('lodash');var squel=require(_0xaf65('0xa'));var crypto=require(_0xaf65('0xb'));var jsforce=require(_0xaf65('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaf65('0xd'));var Papa=require(_0xaf65('0xe'));var Redis=require(_0xaf65('0xf'));var authService=require(_0xaf65('0x10'));var qs=require(_0xaf65('0x11'));var as=require(_0xaf65('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf65('0x13'))(_0xaf65('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xaf65('0x15'));var db=require('../../mysqldb')['db'];var extensions=require(_0xaf65('0x16'));function respondWithStatusCode(_0x3429bd,_0x5f50c2){_0x5f50c2=_0x5f50c2||0xcc;return function(_0x1061ad){if(_0x1061ad){return _0x3429bd['sendStatus'](_0x5f50c2);}return _0x3429bd[_0xaf65('0x17')](_0x5f50c2)[_0xaf65('0x18')]();};}function respondWithResult(_0x1db7d0,_0x5ec1a4){_0x5ec1a4=_0x5ec1a4||0xc8;return function(_0x450286){if(_0x450286){return _0x1db7d0[_0xaf65('0x17')](_0x5ec1a4)[_0xaf65('0x19')](_0x450286);}};}function respondWithFilteredResult(_0x354535,_0x5e3d29){return function(_0x8d90c3){if(_0x8d90c3){var _0x578750=typeof _0x5e3d29[_0xaf65('0x1a')]==='undefined'&&typeof _0x5e3d29[_0xaf65('0x1b')]===_0xaf65('0x1c');var _0x447291=_0x8d90c3[_0xaf65('0x1d')];var _0x202443=_0x578750?0x0:_0x5e3d29[_0xaf65('0x1a')];var _0x4ae67f=_0x578750?_0x8d90c3['count']:_0x5e3d29[_0xaf65('0x1a')]+_0x5e3d29[_0xaf65('0x1b')];var _0xe19bec;if(_0x4ae67f>=_0x447291){_0x4ae67f=_0x447291;_0xe19bec=0xc8;}else{_0xe19bec=0xce;}_0x354535['status'](_0xe19bec);return _0x354535[_0xaf65('0x1e')](_0xaf65('0x1f'),_0x202443+'-'+_0x4ae67f+'/'+_0x447291)[_0xaf65('0x19')](_0x8d90c3);}return null;};}function patchUpdates(_0x505e88){return function(_0x29789f){try{jsonpatch[_0xaf65('0x20')](_0x29789f,_0x505e88,!![]);}catch(_0x484c29){return BPromise[_0xaf65('0x21')](_0x484c29);}return _0x29789f[_0xaf65('0x22')]();};}function saveUpdates(_0x21f8d7,_0x29b673){return function(_0x285c3f){if(_0x285c3f){return _0x285c3f[_0xaf65('0x23')](_0x21f8d7)[_0xaf65('0x24')](function(_0x54dbf6){return _0x54dbf6;});}return null;};}function removeEntity(_0x26d626,_0x6165ba){return function(_0x340916){if(_0x340916){return _0x340916[_0xaf65('0x25')]()[_0xaf65('0x24')](function(){var _0xeebed9=_0x340916[_0xaf65('0x26')]({'plain':!![]});var _0x186b20=_0xaf65('0x27');return db[_0xaf65('0x28')][_0xaf65('0x25')]({'where':{'type':_0x186b20,'resourceId':_0xeebed9['id']}})[_0xaf65('0x24')](function(){return _0x340916;});})['then'](function(){_0x26d626['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x39937e,_0x9d9267){return function(_0x59740f){if(!_0x59740f){_0x39937e['sendStatus'](0x194);}return _0x59740f;};}function handleError(_0x39231b,_0x54fafd){_0x54fafd=_0x54fafd||0x1f4;return function(_0x2cc150){logger[_0xaf65('0x29')](_0x2cc150[_0xaf65('0x2a')]);if(_0x2cc150[_0xaf65('0x2b')]){delete _0x2cc150[_0xaf65('0x2b')];}_0x39231b[_0xaf65('0x17')](_0x54fafd)['send'](_0x2cc150);};}exports[_0xaf65('0x2c')]=function(_0x208fdb,_0x1fc14b){var _0x453017={},_0x72c4d9={},_0xd36d09={'count':0x0,'rows':[]};var _0x12d54a=_[_0xaf65('0x2d')](db[_0xaf65('0x2e')]['rawAttributes'],function(_0xeff788){return{'name':_0xeff788[_0xaf65('0x2f')],'type':_0xeff788[_0xaf65('0x30')][_0xaf65('0x31')]};});_0x72c4d9[_0xaf65('0x32')]=_[_0xaf65('0x2d')](_0x12d54a,_0xaf65('0x2b'));_0x72c4d9['query']=_[_0xaf65('0x33')](_0x208fdb[_0xaf65('0x34')]);_0x72c4d9[_0xaf65('0x35')]=_[_0xaf65('0x36')](_0x72c4d9['model'],_0x72c4d9[_0xaf65('0x34')]);_0x453017[_0xaf65('0x37')]=_[_0xaf65('0x36')](_0x72c4d9[_0xaf65('0x32')],qs['fields'](_0x208fdb['query']['fields']));_0x453017['attributes']=_0x453017[_0xaf65('0x37')]['length']?_0x453017[_0xaf65('0x37')]:_0x72c4d9[_0xaf65('0x32')];if(!_0x208fdb['query']['hasOwnProperty'](_0xaf65('0x38'))){_0x453017[_0xaf65('0x1b')]=qs['limit'](_0x208fdb['query'][_0xaf65('0x1b')]);_0x453017['offset']=qs['offset'](_0x208fdb[_0xaf65('0x34')][_0xaf65('0x1a')]);}_0x453017[_0xaf65('0x39')]=qs[_0xaf65('0x3a')](_0x208fdb[_0xaf65('0x34')][_0xaf65('0x3a')]);_0x453017[_0xaf65('0x3b')]=qs[_0xaf65('0x35')](_[_0xaf65('0x3c')](_0x208fdb['query'],_0x72c4d9[_0xaf65('0x35')]),_0x12d54a);if(_0x208fdb['query'][_0xaf65('0x3d')]){_0x453017[_0xaf65('0x3b')]=_[_0xaf65('0x3e')](_0x453017[_0xaf65('0x3b')],{'$or':_[_0xaf65('0x2d')](_0x12d54a,function(_0x383d3d){if(_0x383d3d[_0xaf65('0x30')]!==_0xaf65('0x3f')){var _0x21b0fc={};_0x21b0fc[_0x383d3d[_0xaf65('0x2b')]]={'$like':'%'+_0x208fdb[_0xaf65('0x34')][_0xaf65('0x3d')]+'%'};return _0x21b0fc;}})});}_0x453017=_['merge']({},_0x453017,_0x208fdb[_0xaf65('0x40')]);var _0x24347c={'where':_0x453017[_0xaf65('0x3b')]};return db['Interval'][_0xaf65('0x1d')](_0x24347c)['then'](function(_0x1dbb9c){_0xd36d09[_0xaf65('0x1d')]=_0x1dbb9c;if(_0x208fdb[_0xaf65('0x34')]['includeAll']){_0x453017[_0xaf65('0x41')]=[{'all':!![]}];}return db['Interval'][_0xaf65('0x42')](_0x453017);})[_0xaf65('0x24')](function(_0x447124){_0xd36d09[_0xaf65('0x43')]=_0x447124;return _0xd36d09;})['then'](respondWithFilteredResult(_0x1fc14b,_0x453017))[_0xaf65('0x44')](handleError(_0x1fc14b,null));};exports[_0xaf65('0x45')]=function(_0x5304df,_0x5d4cb6){var _0x4bf510={'raw':!![],'where':{'id':_0x5304df[_0xaf65('0x46')]['id']}},_0x3912ac={};_0x3912ac[_0xaf65('0x32')]=_[_0xaf65('0x33')](db[_0xaf65('0x2e')][_0xaf65('0x47')]);_0x3912ac[_0xaf65('0x34')]=_[_0xaf65('0x33')](_0x5304df[_0xaf65('0x34')]);_0x3912ac[_0xaf65('0x35')]=_['intersection'](_0x3912ac['model'],_0x3912ac['query']);_0x4bf510[_0xaf65('0x37')]=_[_0xaf65('0x36')](_0x3912ac[_0xaf65('0x32')],qs[_0xaf65('0x48')](_0x5304df[_0xaf65('0x34')]['fields']));_0x4bf510['attributes']=_0x4bf510['attributes'][_0xaf65('0x49')]?_0x4bf510[_0xaf65('0x37')]:_0x3912ac[_0xaf65('0x32')];if(_0x5304df[_0xaf65('0x34')][_0xaf65('0x4a')]){_0x4bf510[_0xaf65('0x41')]=[{'all':!![]}];}_0x4bf510=_['merge']({},_0x4bf510,_0x5304df[_0xaf65('0x40')]);return db[_0xaf65('0x2e')][_0xaf65('0x4b')](_0x4bf510)['then'](handleEntityNotFound(_0x5d4cb6,null))['then'](respondWithResult(_0x5d4cb6,null))['catch'](handleError(_0x5d4cb6,null));};exports[_0xaf65('0x4c')]=function(_0x576d81,_0x15ba8b){return db[_0xaf65('0x2e')][_0xaf65('0x4c')](_0x576d81[_0xaf65('0x4d')],{})['then'](function(_0x102707){var _0x4a5f9c=_0x576d81['user'][_0xaf65('0x26')]({'plain':!![]});if(!_0x4a5f9c)throw new Error(_0xaf65('0x4e'));if(_0x4a5f9c[_0xaf65('0x4f')]===_0xaf65('0x50')){var _0x48a97a=_0x102707[_0xaf65('0x26')]({'plain':!![]});var _0xe2e4ac=_0xaf65('0x27');return db['UserProfileSection'][_0xaf65('0x4b')]({'where':{'name':_0xe2e4ac,'userProfileId':_0x4a5f9c[_0xaf65('0x51')]},'raw':!![]})[_0xaf65('0x24')](function(_0x1fad29){if(_0x1fad29&&_0x1fad29[_0xaf65('0x52')]===0x0){return db[_0xaf65('0x28')][_0xaf65('0x4c')]({'name':_0x48a97a[_0xaf65('0x2b')],'resourceId':_0x48a97a['id'],'type':_0x1fad29['name'],'sectionId':_0x1fad29['id']},{})[_0xaf65('0x24')](function(){return _0x102707;});}else{return _0x102707;}})[_0xaf65('0x44')](function(_0x4fb85d){logger[_0xaf65('0x29')](_0xaf65('0x53'),_0x4fb85d);throw _0x4fb85d;});}return _0x102707;})[_0xaf65('0x24')](respondWithResult(_0x15ba8b,0xc9))[_0xaf65('0x44')](handleError(_0x15ba8b,null));};exports[_0xaf65('0x23')]=function(_0x1b61b9,_0x273374){if(_0x1b61b9[_0xaf65('0x4d')]['id']){delete _0x1b61b9[_0xaf65('0x4d')]['id'];}return db[_0xaf65('0x2e')]['find']({'where':{'id':_0x1b61b9[_0xaf65('0x46')]['id']}})[_0xaf65('0x24')](handleEntityNotFound(_0x273374,null))['then'](saveUpdates(_0x1b61b9[_0xaf65('0x4d')],null))[_0xaf65('0x24')](respondWithResult(_0x273374,null))[_0xaf65('0x44')](handleError(_0x273374,null));};exports[_0xaf65('0x25')]=function(_0x1408e1,_0x3721ca){return db[_0xaf65('0x2e')][_0xaf65('0x4b')]({'where':{'id':_0x1408e1['params']['id']}})['then'](handleEntityNotFound(_0x3721ca,null))[_0xaf65('0x24')](removeEntity(_0x3721ca,null))['catch'](handleError(_0x3721ca,null));};exports[_0xaf65('0x54')]=function(_0x309245,_0x1cd39a,_0x1a4c12){if(_0x309245['body']['id']){delete _0x309245[_0xaf65('0x4d')]['id'];}return db['Interval'][_0xaf65('0x4b')]({'where':{'id':_0x309245[_0xaf65('0x46')]['id']}})[_0xaf65('0x24')](handleEntityNotFound(_0x1cd39a,null))['then'](function(_0xa3957b){if(_0xa3957b){_0x309245[_0xaf65('0x4d')][_0xaf65('0x55')]=_0xa3957b['id'];return db[_0xaf65('0x2e')][_0xaf65('0x4c')](_0x309245[_0xaf65('0x4d')]);}})[_0xaf65('0x24')](respondWithResult(_0x1cd39a,null))[_0xaf65('0x44')](handleError(_0x1cd39a,null));};exports[_0xaf65('0x56')]=function(_0x58092c,_0x5741ee,_0x39b080){var _0x52250a={};var _0x976363={};var _0x38dba3;var _0x2a8394;return db[_0xaf65('0x2e')]['findOne']({'where':{'id':_0x58092c[_0xaf65('0x46')]['id']}})[_0xaf65('0x24')](handleEntityNotFound(_0x5741ee,null))[_0xaf65('0x24')](function(_0x254f3f){if(_0x254f3f){_0x38dba3=_0x254f3f;_0x976363['model']=_['keys'](db['Interval']['rawAttributes']);_0x976363[_0xaf65('0x34')]=_[_0xaf65('0x33')](_0x58092c[_0xaf65('0x34')]);_0x976363[_0xaf65('0x35')]=_[_0xaf65('0x36')](_0x976363[_0xaf65('0x32')],_0x976363[_0xaf65('0x34')]);_0x52250a[_0xaf65('0x37')]=_[_0xaf65('0x36')](_0x976363[_0xaf65('0x32')],qs[_0xaf65('0x48')](_0x58092c[_0xaf65('0x34')]['fields']));_0x52250a['attributes']=_0x52250a['attributes'][_0xaf65('0x49')]?_0x52250a[_0xaf65('0x37')]:_0x976363['model'];_0x52250a[_0xaf65('0x39')]=qs['sort'](_0x58092c[_0xaf65('0x34')][_0xaf65('0x3a')]);_0x52250a['where']=qs[_0xaf65('0x35')](_[_0xaf65('0x3c')](_0x58092c['query'],_0x976363['filters']));if(_0x58092c[_0xaf65('0x34')][_0xaf65('0x3d')]){_0x52250a[_0xaf65('0x3b')]=_['merge'](_0x52250a[_0xaf65('0x3b')],{'$or':_['map'](_0x52250a[_0xaf65('0x37')],function(_0x5c481e){var _0x549dbe={};_0x549dbe[_0x5c481e]={'$like':'%'+_0x58092c[_0xaf65('0x34')][_0xaf65('0x3d')]+'%'};return _0x549dbe;})});}_0x52250a=_['merge']({},_0x52250a,_0x58092c['options']);return _0x38dba3['getIntervals'](_0x52250a);}})[_0xaf65('0x24')](function(_0x50a771){if(_0x50a771){_0x2a8394=_0x50a771[_0xaf65('0x49')];if(!_0x58092c['query'][_0xaf65('0x57')](_0xaf65('0x38'))){_0x52250a['limit']=qs[_0xaf65('0x1b')](_0x58092c[_0xaf65('0x34')][_0xaf65('0x1b')]);_0x52250a[_0xaf65('0x1a')]=qs[_0xaf65('0x1a')](_0x58092c['query'][_0xaf65('0x1a')]);}return _0x38dba3[_0xaf65('0x56')](_0x52250a);}})[_0xaf65('0x24')](function(_0x402bb0){if(_0x402bb0){return _0x402bb0?{'count':_0x2a8394,'rows':_0x402bb0}:null;}})[_0xaf65('0x24')](respondWithResult(_0x5741ee,null))[_0xaf65('0x44')](handleError(_0x5741ee,null));};exports[_0xaf65('0x58')]=function(_0x4a7677,_0xbd9b6b,_0x11f867){return db[_0xaf65('0x2e')][_0xaf65('0x59')]({'where':{'id':_0x4a7677[_0xaf65('0x46')]['id']}})[_0xaf65('0x24')](handleEntityNotFound(_0xbd9b6b,null))[_0xaf65('0x24')](function(_0xdb421){if(_0xdb421){return db[_0xaf65('0x5a')][_0xaf65('0x5b')](function(_0x4565ff){return db[_0xaf65('0x2e')][_0xaf65('0x25')]({'where':{'IntervalId':_0x4a7677[_0xaf65('0x46')]['id']},'transaction':_0x4565ff})['then'](function(_0x2c8c3a){var _0x1becc9=_[_0xaf65('0x2d')](_0x4a7677[_0xaf65('0x4d')],function(_0x83de0){delete _0x83de0['id'];_0x83de0[_0xaf65('0x55')]=_0x4a7677[_0xaf65('0x46')]['id'];return _0x83de0;});return db['Interval'][_0xaf65('0x5c')](_0x1becc9,{'transaction':_0x4565ff});});})[_0xaf65('0x24')](function(){return db[_0xaf65('0x2e')][_0xaf65('0x42')]({'where':{'IntervalId':_0x4a7677[_0xaf65('0x46')]['id']}});});}})[_0xaf65('0x24')](respondWithResult(_0xbd9b6b,null))[_0xaf65('0x44')](handleError(_0xbd9b6b,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 0d42ba3..882feaf 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 _0x3823=['../../config/environment','./interval.attributes','exports','define','Interval','tools_intervals','rewrite','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x3e967d,_0x2f8a27){var _0x3d20d2=function(_0x484e52){while(--_0x484e52){_0x3e967d['push'](_0x3e967d['shift']());}};_0x3d20d2(++_0x2f8a27);}(_0x3823,0xb0));var _0x3382=function(_0x3b5cf7,_0x38b9d5){_0x3b5cf7=_0x3b5cf7-0x0;var _0x23f94b=_0x3823[_0x3b5cf7];return _0x23f94b;};'use strict';var _=require('lodash');var util=require(_0x3382('0x0'));var logger=require(_0x3382('0x1'))(_0x3382('0x2'));var moment=require('moment');var BPromise=require(_0x3382('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3382('0x4'));var rimraf=require(_0x3382('0x5'));var config=require(_0x3382('0x6'));var attributes=require(_0x3382('0x7'));var extensions=require('../../components/extensions/rewrite');module[_0x3382('0x8')]=function(_0x462e7d,_0x22edec){return _0x462e7d[_0x3382('0x9')](_0x3382('0xa'),attributes,{'tableName':_0x3382('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3dd5bb,_0x1d5269){extensions[_0x3382('0xc')](_0x462e7d,_0x3dd5bb);},'afterBulkCreate':function(_0xba6fb3,_0x784ea3,_0x3da958){_0x3da958();extensions[_0x3382('0xc')](_0x462e7d,_0xba6fb3[0x0]);},'afterUpdate':function(_0x33f519,_0x29751b){extensions[_0x3382('0xc')](_0x462e7d,_0x33f519);},'afterDestroy':function(_0x52abd6,_0x5ef7c7){extensions[_0x3382('0xc')](_0x462e7d,_0x52abd6);}}});}; \ No newline at end of file +var _0xd4a2=['api','bluebird','path','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','lodash'];(function(_0x15faa8,_0x450802){var _0x48668d=function(_0x3c7622){while(--_0x3c7622){_0x15faa8['push'](_0x15faa8['shift']());}};_0x48668d(++_0x450802);}(_0xd4a2,0x173));var _0x2d4a=function(_0x525a26,_0x3b0e3c){_0x525a26=_0x525a26-0x0;var _0xc221c7=_0xd4a2[_0x525a26];return _0xc221c7;};'use strict';var _=require(_0x2d4a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2d4a('0x1'));var moment=require('moment');var BPromise=require(_0x2d4a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d4a('0x3'));var rimraf=require('rimraf');var config=require(_0x2d4a('0x4'));var attributes=require(_0x2d4a('0x5'));var extensions=require(_0x2d4a('0x6'));module[_0x2d4a('0x7')]=function(_0x1ca10b,_0x57058f){return _0x1ca10b[_0x2d4a('0x8')](_0x2d4a('0x9'),attributes,{'tableName':_0x2d4a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x29597e,_0x3b8d7b){extensions[_0x2d4a('0xb')](_0x1ca10b,_0x29597e);},'afterBulkCreate':function(_0xb9f016,_0x113839,_0x33b786){_0x33b786();extensions[_0x2d4a('0xb')](_0x1ca10b,_0xb9f016[0x0]);},'afterUpdate':function(_0x3abbbd,_0xce6af6){extensions['rewrite'](_0x1ca10b,_0x3abbbd);},'afterDestroy':function(_0x5f3c52,_0x4002de){extensions['rewrite'](_0x1ca10b,_0x5f3c52);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 4d7a756..e9806b6 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(_0x1d1219,_0x23fc71){var _0x5b5b89=function(_0x3d85e5){while(--_0x3d85e5){_0x1d1219['push'](_0x1d1219['shift']());}};_0x5b5b89(++_0x23fc71);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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(_0x1f7201,_0x141b79){var _0x289fd2=function(_0x20ce23){while(--_0x20ce23){_0x1f7201['push'](_0x1f7201['shift']());}};_0x289fd2(++_0x141b79);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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 fb51943..566030b 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 _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5f66[_0x4243a3];return _0x1b2a33;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file +var _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x5edd0c,_0x4ae180){var _0x6da9fc=function(_0x3be5f2){while(--_0x3be5f2){_0x5edd0c['push'](_0x5edd0c['shift']());}};_0x6da9fc(++_0x4ae180);}(_0xdb28,0x106));var _0x8db2=function(_0x28921f,_0x436e03){_0x28921f=_0x28921f-0x0;var _0x309659=_0xdb28[_0x28921f];return _0x309659;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 251e351..7570ece 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 _0x4739=['Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','send','body','headers','connection','socket','remoteAddress','bluebird','https','api','support','key','MOTGUI','summary','Report','description','stringify','issuetype','Bug','customfield_11500','fields','customfield_11501','customfield_11502','newToken','name','customfield_11504','track.xcallymotion.com','/rest/api/2/issue','POST','Basic\x20','base64','request','setEncoding','utf8','end','json','status'];(function(_0xbe1bbe,_0x4a2af0){var _0x572a11=function(_0x3716f1){while(--_0x3716f1){_0xbe1bbe['push'](_0xbe1bbe['shift']());}};_0x572a11(++_0x4a2af0);}(_0x4739,0xcc));var _0x9473=function(_0x59e4f5,_0x3fd4ab){_0x59e4f5=_0x59e4f5-0x0;var _0x4ced86=_0x4739[_0x59e4f5];return _0x4ced86;};'use strict';var BPromise=require(_0x9473('0x0'));var https=require(_0x9473('0x1'));var logger=require('../../config/logger')(_0x9473('0x2'));var USERNAME=_0x9473('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x2696ae,_0x675985){var _0x1add42={'fields':{'project':{'key':_0x2696ae[_0x9473('0x4')]||_0x9473('0x5')},'summary':(_0x2696ae[_0x9473('0x6')]||_0x9473('0x7'))+'\x20from\x20'+_0x2696ae['ip'],'description':_0x2696ae[_0x9473('0x8')]||JSON[_0x9473('0x9')](_0x2696ae),'issuetype':{'name':_0x2696ae[_0x9473('0xa')]||_0x9473('0xb')}}};_0x1add42['fields'][_0x9473('0xc')]=_0x2696ae['email'];_0x1add42[_0x9473('0xd')][_0x9473('0xe')]=_0x2696ae['oldToken'];_0x1add42[_0x9473('0xd')][_0x9473('0xf')]=_0x2696ae[_0x9473('0x10')];_0x1add42[_0x9473('0xd')]['customfield_11503']=_0x2696ae[_0x9473('0x11')];_0x1add42['fields'][_0x9473('0x12')]=_0x2696ae['reason'];_0x1add42['fields']['customfield_10102']=_0x2696ae['ip'];var _0x4ef64={'host':_0x9473('0x13'),'port':0x1bb,'path':_0x9473('0x14'),'method':_0x9473('0x15'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x9473('0x16')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x9473('0x17'))}};var _0x50f66a=JSON[_0x9473('0x9')](_0x1add42);var _0xb816f9=https[_0x9473('0x18')](_0x4ef64,function(_0x2b7bb9){_0x2b7bb9[_0x9473('0x19')](_0x9473('0x1a'));var _0x4e4297='';_0x2b7bb9['on']('data',function(_0x5cbf38){_0x4e4297+=_0x5cbf38;});_0x2b7bb9['on'](_0x9473('0x1b'),function(){if(_0x675985){return _0x675985['status'](_0x2b7bb9['statusCode'])[_0x9473('0x1c')](JSON['parse'](_0x4e4297));}});});_0xb816f9['on']('error',function(_0x3c3157){if(_0x675985){return _0x675985[_0x9473('0x1d')](0x1f4)[_0x9473('0x1c')]({'errors':[{'message':_0x9473('0x1e'),'type':_0x9473('0x1f')}]});}});_0xb816f9[_0x9473('0x20')](_0x50f66a);_0xb816f9[_0x9473('0x1b')]();}exports['openIssue']=openIssue;exports[_0x9473('0x21')]=function(_0x1feaaa,_0x46e8cd){_0x1feaaa[_0x9473('0x22')]['ip']=_0x1feaaa[_0x9473('0x23')]['x-forwarded-for']||_0x1feaaa[_0x9473('0x24')]['remoteAddress']||_0x1feaaa[_0x9473('0x25')][_0x9473('0x26')]||_0x1feaaa['connection'][_0x9473('0x25')]['remoteAddress'];return openIssue(_0x1feaaa[_0x9473('0x22')],_0x46e8cd);}; \ No newline at end of file +var _0x7300=['https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','description','stringify','issuetype','customfield_11500','fields','customfield_11502','newToken','name','customfield_11504','track.xcallymotion.com','POST','application/json','base64','request','setEncoding','end','status','statusCode','json','api.jira','write','send','body','x-forwarded-for','socket','remoteAddress','connection','bluebird'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x7300,0x127));var _0x0730=function(_0x266220,_0x416787){_0x266220=_0x266220-0x0;var _0x5a4932=_0x7300[_0x266220];return _0x5a4932;};'use strict';var BPromise=require(_0x0730('0x0'));var https=require(_0x0730('0x1'));var logger=require(_0x0730('0x2'))(_0x0730('0x3'));var USERNAME=_0x0730('0x4');var PASSWORD=_0x0730('0x5');function openIssue(_0x2ac09f,_0x51757d){var _0x6a549e={'fields':{'project':{'key':_0x2ac09f[_0x0730('0x6')]||_0x0730('0x7')},'summary':(_0x2ac09f[_0x0730('0x8')]||_0x0730('0x9'))+'\x20from\x20'+_0x2ac09f['ip'],'description':_0x2ac09f[_0x0730('0xa')]||JSON[_0x0730('0xb')](_0x2ac09f),'issuetype':{'name':_0x2ac09f[_0x0730('0xc')]||'Bug'}}};_0x6a549e['fields'][_0x0730('0xd')]=_0x2ac09f['email'];_0x6a549e[_0x0730('0xe')]['customfield_11501']=_0x2ac09f['oldToken'];_0x6a549e[_0x0730('0xe')][_0x0730('0xf')]=_0x2ac09f[_0x0730('0x10')];_0x6a549e[_0x0730('0xe')]['customfield_11503']=_0x2ac09f[_0x0730('0x11')];_0x6a549e['fields'][_0x0730('0x12')]=_0x2ac09f['reason'];_0x6a549e[_0x0730('0xe')]['customfield_10102']=_0x2ac09f['ip'];var _0x5efe6f={'host':_0x0730('0x13'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x0730('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0x0730('0x15'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x0730('0x16'))}};var _0x3a3c65=JSON[_0x0730('0xb')](_0x6a549e);var _0x55a872=https[_0x0730('0x17')](_0x5efe6f,function(_0x448a81){_0x448a81[_0x0730('0x18')]('utf8');var _0x4279a6='';_0x448a81['on']('data',function(_0x4e74d9){_0x4279a6+=_0x4e74d9;});_0x448a81['on'](_0x0730('0x19'),function(){if(_0x51757d){return _0x51757d[_0x0730('0x1a')](_0x448a81[_0x0730('0x1b')])[_0x0730('0x1c')](JSON['parse'](_0x4279a6));}});});_0x55a872['on']('error',function(_0xfe9951){if(_0x51757d){return _0x51757d[_0x0730('0x1a')](0x1f4)[_0x0730('0x1c')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x0730('0x1d')}]});}});_0x55a872[_0x0730('0x1e')](_0x3a3c65);_0x55a872[_0x0730('0x19')]();}exports['openIssue']=openIssue;exports[_0x0730('0x1f')]=function(_0x4f9ce2,_0x9fa823){_0x4f9ce2[_0x0730('0x20')]['ip']=_0x4f9ce2['headers'][_0x0730('0x21')]||_0x4f9ce2['connection']['remoteAddress']||_0x4f9ce2[_0x0730('0x22')][_0x0730('0x23')]||_0x4f9ce2[_0x0730('0x24')]['socket'][_0x0730('0x23')];return openIssue(_0x4f9ce2['body'],_0x9fa823);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 66b1f64..40a0c89 100644 --- a/server/api/jscriptyAnswerReport/index.js +++ b/server/api/jscriptyAnswerReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdb7=['fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','index','get','describe','show','post','isAuthenticated','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x31d6ee,_0x3d2dac){var _0x2436ed=function(_0x32cb87){while(--_0x32cb87){_0x31d6ee['push'](_0x31d6ee['shift']());}};_0x2436ed(++_0x3d2dac);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x5b080b,_0xe34631){_0x5b080b=_0x5b080b-0x0;var _0x3d724c=_0xbdb7[_0x5b080b];return _0x3d724c;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var fs_extra=require(_0x7bdb('0x6'));var auth=require(_0x7bdb('0x7'));var interaction=require(_0x7bdb('0x8'));var config=require('../../config/environment');var controller=require(_0x7bdb('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x7bdb('0xa')]);router[_0x7bdb('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x7bdb('0xc')]);router[_0x7bdb('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7bdb('0xd')]);router[_0x7bdb('0xe')]('/',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x10')]);router[_0x7bdb('0x11')](_0x7bdb('0x12'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x7bdb('0x14')]);module[_0x7bdb('0x15')]=router; \ No newline at end of file +var _0xec56=['put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create'];(function(_0x479143,_0x242f77){var _0x5301f9=function(_0x23a593){while(--_0x23a593){_0x479143['push'](_0x479143['shift']());}};_0x5301f9(++_0x242f77);}(_0xec56,0x1bd));var _0x6ec5=function(_0x52fc9b,_0x31c4d6){_0x52fc9b=_0x52fc9b-0x0;var _0x44adcf=_0xec56[_0x52fc9b];return _0x44adcf;};'use strict';var multer=require(_0x6ec5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6ec5('0x1'));var express=require(_0x6ec5('0x2'));var router=express[_0x6ec5('0x3')]();var fs_extra=require(_0x6ec5('0x4'));var auth=require(_0x6ec5('0x5'));var interaction=require(_0x6ec5('0x6'));var config=require(_0x6ec5('0x7'));var controller=require(_0x6ec5('0x8'));router[_0x6ec5('0x9')]('/',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xb')]);router[_0x6ec5('0x9')](_0x6ec5('0xc'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xd')]);router[_0x6ec5('0x9')](_0x6ec5('0xe'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xf')]);router['post']('/',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x10')]);router[_0x6ec5('0x11')](_0x6ec5('0xe'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x12')]);router[_0x6ec5('0x13')]('/:id',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x14')]);module[_0x6ec5('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 4295d33..4602a0d 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(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x7a54,0x106));var _0x47a5=function(_0x5abc7e,_0x1a0d0f){_0x5abc7e=_0x5abc7e-0x0;var _0x41e81b=_0x7a54[_0x5abc7e];return _0x41e81b;};'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(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x7a54,0x106));var _0x47a5=function(_0x1c048c,_0x2d1885){_0x1c048c=_0x1c048c-0x0;var _0x3099ac=_0x7a54[_0x1c048c];return _0x3099ac;};'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 077c559..6cf3a34 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 _0x4006=['findAll','catch','show','keys','include','find','create','body','update','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','then','destroy','end','error','stack','name','index','JscriptyAnswerReport','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll'];(function(_0x5054b8,_0x50b0bc){var _0x2c2330=function(_0x385b78){while(--_0x385b78){_0x5054b8['push'](_0x5054b8['shift']());}};_0x2c2330(++_0x50b0bc);}(_0x4006,0x1c7));var _0x6400=function(_0x11fa98,_0x7d7c22){_0x11fa98=_0x11fa98-0x0;var _0xf189d4=_0x4006[_0x11fa98];return _0xf189d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6400('0x0'));var zipdir=require(_0x6400('0x1'));var jsonpatch=require(_0x6400('0x2'));var rp=require(_0x6400('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6400('0x4'));var util=require('util');var path=require(_0x6400('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6400('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6400('0x7'));var squel=require(_0x6400('0x8'));var crypto=require(_0x6400('0x9'));var jsforce=require(_0x6400('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x6400('0xb'));var querystring=require(_0x6400('0xc'));var Papa=require(_0x6400('0xd'));var Redis=require(_0x6400('0xe'));var authService=require(_0x6400('0xf'));var qs=require(_0x6400('0x10'));var as=require(_0x6400('0x11'));var hardwareService=require(_0x6400('0x12'));var logger=require(_0x6400('0x13'))(_0x6400('0x14'));var utils=require(_0x6400('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6400('0x16'));var db=require(_0x6400('0x17'))['db'];function respondWithStatusCode(_0x230c94,_0x36bf00){_0x36bf00=_0x36bf00||0xcc;return function(_0x5a6d31){if(_0x5a6d31){return _0x230c94[_0x6400('0x18')](_0x36bf00);}return _0x230c94[_0x6400('0x19')](_0x36bf00)['end']();};}function respondWithResult(_0x4f8133,_0x559312){_0x559312=_0x559312||0xc8;return function(_0x268f93){if(_0x268f93){return _0x4f8133[_0x6400('0x19')](_0x559312)['json'](_0x268f93);}};}function respondWithFilteredResult(_0x191696,_0x4ae3ea){return function(_0x28eb67){if(_0x28eb67){var _0x5a0c1c=typeof _0x4ae3ea[_0x6400('0x1a')]===_0x6400('0x1b')&&typeof _0x4ae3ea[_0x6400('0x1c')]===_0x6400('0x1b');var _0x49d412=_0x28eb67[_0x6400('0x1d')];var _0x14c036=_0x5a0c1c?0x0:_0x4ae3ea[_0x6400('0x1a')];var _0x50524f=_0x5a0c1c?_0x28eb67[_0x6400('0x1d')]:_0x4ae3ea[_0x6400('0x1a')]+_0x4ae3ea['limit'];var _0x36a8f5;if(_0x50524f>=_0x49d412){_0x50524f=_0x49d412;_0x36a8f5=0xc8;}else{_0x36a8f5=0xce;}_0x191696[_0x6400('0x19')](_0x36a8f5);return _0x191696[_0x6400('0x1e')]('Content-Range',_0x14c036+'-'+_0x50524f+'/'+_0x49d412)[_0x6400('0x1f')](_0x28eb67);}return null;};}function patchUpdates(_0x23c1cd){return function(_0x325bde){try{jsonpatch[_0x6400('0x20')](_0x325bde,_0x23c1cd,!![]);}catch(_0x1c8b72){return BPromise[_0x6400('0x21')](_0x1c8b72);}return _0x325bde[_0x6400('0x22')]();};}function saveUpdates(_0x171e39,_0x22eb63){return function(_0x212f0f){if(_0x212f0f){return _0x212f0f['update'](_0x171e39)[_0x6400('0x23')](function(_0x50c29e){return _0x50c29e;});}return null;};}function removeEntity(_0x589b7c,_0x257d80){return function(_0xb79c62){if(_0xb79c62){return _0xb79c62[_0x6400('0x24')]()[_0x6400('0x23')](function(){_0x589b7c['status'](0xcc)[_0x6400('0x25')]();});}};}function handleEntityNotFound(_0x56d9e6,_0x1acff2){return function(_0x506732){if(!_0x506732){_0x56d9e6[_0x6400('0x18')](0x194);}return _0x506732;};}function handleError(_0x246433,_0x577156){_0x577156=_0x577156||0x1f4;return function(_0x434550){logger[_0x6400('0x26')](_0x434550[_0x6400('0x27')]);if(_0x434550['name']){delete _0x434550[_0x6400('0x28')];}_0x246433['status'](_0x577156)['send'](_0x434550);};}exports[_0x6400('0x29')]=function(_0x4bb214,_0x234670){var _0x197b9d={},_0x50f5e9={},_0x452a2c={'count':0x0,'rows':[]};var _0x52eba1=_['map'](db[_0x6400('0x2a')][_0x6400('0x2b')],function(_0x10005a){return{'name':_0x10005a[_0x6400('0x2c')],'type':_0x10005a[_0x6400('0x2d')]['key']};});_0x50f5e9[_0x6400('0x2e')]=_[_0x6400('0x2f')](_0x52eba1,_0x6400('0x28'));_0x50f5e9[_0x6400('0x30')]=_['keys'](_0x4bb214[_0x6400('0x30')]);_0x50f5e9[_0x6400('0x31')]=_[_0x6400('0x32')](_0x50f5e9['model'],_0x50f5e9[_0x6400('0x30')]);_0x197b9d[_0x6400('0x33')]=_[_0x6400('0x32')](_0x50f5e9[_0x6400('0x2e')],qs['fields'](_0x4bb214[_0x6400('0x30')][_0x6400('0x34')]));_0x197b9d['attributes']=_0x197b9d[_0x6400('0x33')][_0x6400('0x35')]?_0x197b9d['attributes']:_0x50f5e9['model'];if(!_0x4bb214[_0x6400('0x30')][_0x6400('0x36')](_0x6400('0x37'))){_0x197b9d['limit']=qs['limit'](_0x4bb214['query'][_0x6400('0x1c')]);_0x197b9d[_0x6400('0x1a')]=qs[_0x6400('0x1a')](_0x4bb214[_0x6400('0x30')][_0x6400('0x1a')]);}_0x197b9d['order']=qs[_0x6400('0x38')](_0x4bb214[_0x6400('0x30')]['sort']);_0x197b9d['where']=qs[_0x6400('0x31')](_[_0x6400('0x39')](_0x4bb214[_0x6400('0x30')],_0x50f5e9['filters']),_0x52eba1);if(_0x4bb214[_0x6400('0x30')][_0x6400('0x3a')]){_0x197b9d[_0x6400('0x3b')]=_['merge'](_0x197b9d[_0x6400('0x3b')],{'$or':_[_0x6400('0x2f')](_0x52eba1,function(_0xd824bf){if(_0xd824bf['type']!=='VIRTUAL'){var _0x5a0973={};_0x5a0973[_0xd824bf[_0x6400('0x28')]]={'$like':'%'+_0x4bb214['query']['filter']+'%'};return _0x5a0973;}})});}_0x197b9d=_[_0x6400('0x3c')]({},_0x197b9d,_0x4bb214[_0x6400('0x3d')]);var _0x565942={'where':_0x197b9d[_0x6400('0x3b')]};return db[_0x6400('0x2a')][_0x6400('0x1d')](_0x565942)['then'](function(_0x9536e5){_0x452a2c[_0x6400('0x1d')]=_0x9536e5;if(_0x4bb214[_0x6400('0x30')][_0x6400('0x3e')]){_0x197b9d['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x6400('0x3f')](_0x197b9d);})[_0x6400('0x23')](function(_0x1bf820){_0x452a2c['rows']=_0x1bf820;return _0x452a2c;})[_0x6400('0x23')](respondWithFilteredResult(_0x234670,_0x197b9d))[_0x6400('0x40')](handleError(_0x234670,null));};exports[_0x6400('0x41')]=function(_0xe50c96,_0x3069f0){var _0x557133={'raw':!![],'where':{'id':_0xe50c96['params']['id']}},_0x24d0c7={};_0x24d0c7[_0x6400('0x2e')]=_[_0x6400('0x42')](db[_0x6400('0x2a')][_0x6400('0x2b')]);_0x24d0c7['query']=_[_0x6400('0x42')](_0xe50c96[_0x6400('0x30')]);_0x24d0c7[_0x6400('0x31')]=_[_0x6400('0x32')](_0x24d0c7['model'],_0x24d0c7[_0x6400('0x30')]);_0x557133['attributes']=_[_0x6400('0x32')](_0x24d0c7['model'],qs[_0x6400('0x34')](_0xe50c96[_0x6400('0x30')][_0x6400('0x34')]));_0x557133['attributes']=_0x557133[_0x6400('0x33')]['length']?_0x557133[_0x6400('0x33')]:_0x24d0c7[_0x6400('0x2e')];if(_0xe50c96[_0x6400('0x30')][_0x6400('0x3e')]){_0x557133[_0x6400('0x43')]=[{'all':!![]}];}_0x557133=_[_0x6400('0x3c')]({},_0x557133,_0xe50c96[_0x6400('0x3d')]);return db[_0x6400('0x2a')][_0x6400('0x44')](_0x557133)[_0x6400('0x23')](handleEntityNotFound(_0x3069f0,null))[_0x6400('0x23')](respondWithResult(_0x3069f0,null))['catch'](handleError(_0x3069f0,null));};exports[_0x6400('0x45')]=function(_0x3340c7,_0x59a8f2){return db['JscriptyAnswerReport'][_0x6400('0x45')](_0x3340c7[_0x6400('0x46')],{})[_0x6400('0x23')](respondWithResult(_0x59a8f2,0xc9))['catch'](handleError(_0x59a8f2,null));};exports[_0x6400('0x47')]=function(_0x54cbfb,_0x518ee4){if(_0x54cbfb['body']['id']){delete _0x54cbfb[_0x6400('0x46')]['id'];}return db[_0x6400('0x2a')]['find']({'where':{'id':_0x54cbfb[_0x6400('0x48')]['id']}})[_0x6400('0x23')](handleEntityNotFound(_0x518ee4,null))['then'](saveUpdates(_0x54cbfb['body'],null))[_0x6400('0x23')](respondWithResult(_0x518ee4,null))[_0x6400('0x40')](handleError(_0x518ee4,null));};exports['destroy']=function(_0x3421b5,_0x205233){return db[_0x6400('0x2a')][_0x6400('0x44')]({'where':{'id':_0x3421b5[_0x6400('0x48')]['id']}})[_0x6400('0x23')](handleEntityNotFound(_0x205233,null))[_0x6400('0x23')](removeEntity(_0x205233,null))['catch'](handleError(_0x205233,null));};exports[_0x6400('0x49')]=function(_0x801179,_0x6905bb){return db[_0x6400('0x2a')][_0x6400('0x49')]()[_0x6400('0x23')](respondWithResult(_0x6905bb,null))[_0x6400('0x40')](handleError(_0x6905bb,null));}; \ No newline at end of file +var _0xba18=['filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','keys','include','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick'];(function(_0x469348,_0x39af3d){var _0x5a13a1=function(_0x48324a){while(--_0x48324a){_0x469348['push'](_0x469348['shift']());}};_0x5a13a1(++_0x39af3d);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x8ba1('0x0'));var rimraf=require(_0x8ba1('0x1'));var zipdir=require(_0x8ba1('0x2'));var jsonpatch=require(_0x8ba1('0x3'));var rp=require(_0x8ba1('0x4'));var moment=require(_0x8ba1('0x5'));var BPromise=require(_0x8ba1('0x6'));var Mustache=require(_0x8ba1('0x7'));var util=require('util');var path=require(_0x8ba1('0x8'));var sox=require(_0x8ba1('0x9'));var csv=require(_0x8ba1('0xa'));var ejs=require(_0x8ba1('0xb'));var fs=require('fs');var fs_extra=require(_0x8ba1('0xc'));var _=require(_0x8ba1('0xd'));var squel=require('squel');var crypto=require(_0x8ba1('0xe'));var jsforce=require(_0x8ba1('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8ba1('0x10'));var Redis=require(_0x8ba1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8ba1('0x12'));var as=require(_0x8ba1('0x13'));var hardwareService=require(_0x8ba1('0x14'));var logger=require(_0x8ba1('0x15'))(_0x8ba1('0x16'));var utils=require('../../config/utils');var config=require(_0x8ba1('0x17'));var licenseUtil=require(_0x8ba1('0x18'));var db=require(_0x8ba1('0x19'))['db'];function respondWithStatusCode(_0x1fcfd7,_0x29adbb){_0x29adbb=_0x29adbb||0xcc;return function(_0x229748){if(_0x229748){return _0x1fcfd7['sendStatus'](_0x29adbb);}return _0x1fcfd7[_0x8ba1('0x1a')](_0x29adbb)[_0x8ba1('0x1b')]();};}function respondWithResult(_0x2e81d1,_0xca53c4){_0xca53c4=_0xca53c4||0xc8;return function(_0x4c8d5c){if(_0x4c8d5c){return _0x2e81d1['status'](_0xca53c4)['json'](_0x4c8d5c);}};}function respondWithFilteredResult(_0x3058ac,_0x398f40){return function(_0x5a3a8a){if(_0x5a3a8a){var _0x1b885b=typeof _0x398f40[_0x8ba1('0x1c')]===_0x8ba1('0x1d')&&typeof _0x398f40[_0x8ba1('0x1e')]===_0x8ba1('0x1d');var _0x19ade9=_0x5a3a8a[_0x8ba1('0x1f')];var _0x4d75fa=_0x1b885b?0x0:_0x398f40['offset'];var _0x1a48fa=_0x1b885b?_0x5a3a8a[_0x8ba1('0x1f')]:_0x398f40['offset']+_0x398f40[_0x8ba1('0x1e')];var _0x2e5fba;if(_0x1a48fa>=_0x19ade9){_0x1a48fa=_0x19ade9;_0x2e5fba=0xc8;}else{_0x2e5fba=0xce;}_0x3058ac[_0x8ba1('0x1a')](_0x2e5fba);return _0x3058ac[_0x8ba1('0x20')](_0x8ba1('0x21'),_0x4d75fa+'-'+_0x1a48fa+'/'+_0x19ade9)[_0x8ba1('0x22')](_0x5a3a8a);}return null;};}function patchUpdates(_0x5ddcf8){return function(_0x489662){try{jsonpatch['apply'](_0x489662,_0x5ddcf8,!![]);}catch(_0xd78e53){return BPromise[_0x8ba1('0x23')](_0xd78e53);}return _0x489662[_0x8ba1('0x24')]();};}function saveUpdates(_0x3dd1d8,_0x4e66e1){return function(_0x1d619c){if(_0x1d619c){return _0x1d619c[_0x8ba1('0x25')](_0x3dd1d8)[_0x8ba1('0x26')](function(_0x38a2de){return _0x38a2de;});}return null;};}function removeEntity(_0x2d4ad6,_0x3b70ea){return function(_0x845108){if(_0x845108){return _0x845108[_0x8ba1('0x27')]()[_0x8ba1('0x26')](function(){_0x2d4ad6[_0x8ba1('0x1a')](0xcc)[_0x8ba1('0x1b')]();});}};}function handleEntityNotFound(_0x550d33,_0x5c924e){return function(_0x41c2bb){if(!_0x41c2bb){_0x550d33[_0x8ba1('0x28')](0x194);}return _0x41c2bb;};}function handleError(_0x56aef2,_0x2baa80){_0x2baa80=_0x2baa80||0x1f4;return function(_0xef508d){logger[_0x8ba1('0x29')](_0xef508d[_0x8ba1('0x2a')]);if(_0xef508d[_0x8ba1('0x2b')]){delete _0xef508d[_0x8ba1('0x2b')];}_0x56aef2[_0x8ba1('0x1a')](_0x2baa80)[_0x8ba1('0x2c')](_0xef508d);};}exports[_0x8ba1('0x2d')]=function(_0x3f1b37,_0x3e8e6d){var _0x136eef={},_0x32782a={},_0x229e16={'count':0x0,'rows':[]};var _0x5e28b7=_[_0x8ba1('0x2e')](db[_0x8ba1('0x2f')][_0x8ba1('0x30')],function(_0x3c37fd){return{'name':_0x3c37fd[_0x8ba1('0x31')],'type':_0x3c37fd[_0x8ba1('0x32')]['key']};});_0x32782a[_0x8ba1('0x33')]=_[_0x8ba1('0x2e')](_0x5e28b7,'name');_0x32782a[_0x8ba1('0x34')]=_['keys'](_0x3f1b37[_0x8ba1('0x34')]);_0x32782a[_0x8ba1('0x35')]=_['intersection'](_0x32782a[_0x8ba1('0x33')],_0x32782a[_0x8ba1('0x34')]);_0x136eef[_0x8ba1('0x36')]=_[_0x8ba1('0x37')](_0x32782a[_0x8ba1('0x33')],qs['fields'](_0x3f1b37[_0x8ba1('0x34')][_0x8ba1('0x38')]));_0x136eef[_0x8ba1('0x36')]=_0x136eef[_0x8ba1('0x36')][_0x8ba1('0x39')]?_0x136eef[_0x8ba1('0x36')]:_0x32782a[_0x8ba1('0x33')];if(!_0x3f1b37[_0x8ba1('0x34')]['hasOwnProperty'](_0x8ba1('0x3a'))){_0x136eef[_0x8ba1('0x1e')]=qs[_0x8ba1('0x1e')](_0x3f1b37[_0x8ba1('0x34')][_0x8ba1('0x1e')]);_0x136eef[_0x8ba1('0x1c')]=qs[_0x8ba1('0x1c')](_0x3f1b37[_0x8ba1('0x34')][_0x8ba1('0x1c')]);}_0x136eef[_0x8ba1('0x3b')]=qs['sort'](_0x3f1b37[_0x8ba1('0x34')][_0x8ba1('0x3c')]);_0x136eef[_0x8ba1('0x3d')]=qs[_0x8ba1('0x35')](_[_0x8ba1('0x3e')](_0x3f1b37[_0x8ba1('0x34')],_0x32782a[_0x8ba1('0x35')]),_0x5e28b7);if(_0x3f1b37[_0x8ba1('0x34')][_0x8ba1('0x3f')]){_0x136eef[_0x8ba1('0x3d')]=_['merge'](_0x136eef['where'],{'$or':_[_0x8ba1('0x2e')](_0x5e28b7,function(_0x3b02a6){if(_0x3b02a6[_0x8ba1('0x32')]!==_0x8ba1('0x40')){var _0x467a82={};_0x467a82[_0x3b02a6[_0x8ba1('0x2b')]]={'$like':'%'+_0x3f1b37[_0x8ba1('0x34')][_0x8ba1('0x3f')]+'%'};return _0x467a82;}})});}_0x136eef=_[_0x8ba1('0x41')]({},_0x136eef,_0x3f1b37[_0x8ba1('0x42')]);var _0x2f4ac4={'where':_0x136eef[_0x8ba1('0x3d')]};return db[_0x8ba1('0x2f')][_0x8ba1('0x1f')](_0x2f4ac4)['then'](function(_0xf8c3b){_0x229e16[_0x8ba1('0x1f')]=_0xf8c3b;if(_0x3f1b37[_0x8ba1('0x34')][_0x8ba1('0x43')]){_0x136eef['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x8ba1('0x44')](_0x136eef);})[_0x8ba1('0x26')](function(_0x1d1ffd){_0x229e16[_0x8ba1('0x45')]=_0x1d1ffd;return _0x229e16;})[_0x8ba1('0x26')](respondWithFilteredResult(_0x3e8e6d,_0x136eef))['catch'](handleError(_0x3e8e6d,null));};exports[_0x8ba1('0x46')]=function(_0x171054,_0x16bdb1){var _0x5b02d8={'raw':!![],'where':{'id':_0x171054[_0x8ba1('0x47')]['id']}},_0x1e5376={};_0x1e5376[_0x8ba1('0x33')]=_[_0x8ba1('0x48')](db[_0x8ba1('0x2f')][_0x8ba1('0x30')]);_0x1e5376['query']=_[_0x8ba1('0x48')](_0x171054['query']);_0x1e5376[_0x8ba1('0x35')]=_[_0x8ba1('0x37')](_0x1e5376[_0x8ba1('0x33')],_0x1e5376[_0x8ba1('0x34')]);_0x5b02d8[_0x8ba1('0x36')]=_[_0x8ba1('0x37')](_0x1e5376['model'],qs[_0x8ba1('0x38')](_0x171054[_0x8ba1('0x34')]['fields']));_0x5b02d8['attributes']=_0x5b02d8[_0x8ba1('0x36')][_0x8ba1('0x39')]?_0x5b02d8[_0x8ba1('0x36')]:_0x1e5376[_0x8ba1('0x33')];if(_0x171054[_0x8ba1('0x34')][_0x8ba1('0x43')]){_0x5b02d8[_0x8ba1('0x49')]=[{'all':!![]}];}_0x5b02d8=_[_0x8ba1('0x41')]({},_0x5b02d8,_0x171054[_0x8ba1('0x42')]);return db[_0x8ba1('0x2f')][_0x8ba1('0x4a')](_0x5b02d8)[_0x8ba1('0x26')](handleEntityNotFound(_0x16bdb1,null))[_0x8ba1('0x26')](respondWithResult(_0x16bdb1,null))['catch'](handleError(_0x16bdb1,null));};exports[_0x8ba1('0x4b')]=function(_0x3bb667,_0x1405a2){return db[_0x8ba1('0x2f')][_0x8ba1('0x4b')](_0x3bb667[_0x8ba1('0x4c')],{})[_0x8ba1('0x26')](respondWithResult(_0x1405a2,0xc9))[_0x8ba1('0x4d')](handleError(_0x1405a2,null));};exports[_0x8ba1('0x25')]=function(_0xd1ec48,_0xae04af){if(_0xd1ec48[_0x8ba1('0x4c')]['id']){delete _0xd1ec48[_0x8ba1('0x4c')]['id'];}return db[_0x8ba1('0x2f')]['find']({'where':{'id':_0xd1ec48[_0x8ba1('0x47')]['id']}})[_0x8ba1('0x26')](handleEntityNotFound(_0xae04af,null))['then'](saveUpdates(_0xd1ec48[_0x8ba1('0x4c')],null))[_0x8ba1('0x26')](respondWithResult(_0xae04af,null))[_0x8ba1('0x4d')](handleError(_0xae04af,null));};exports[_0x8ba1('0x27')]=function(_0x10fc3c,_0x5304c4){return db['JscriptyAnswerReport'][_0x8ba1('0x4a')]({'where':{'id':_0x10fc3c[_0x8ba1('0x47')]['id']}})['then'](handleEntityNotFound(_0x5304c4,null))[_0x8ba1('0x26')](removeEntity(_0x5304c4,null))[_0x8ba1('0x4d')](handleError(_0x5304c4,null));};exports[_0x8ba1('0x4e')]=function(_0x4d93b2,_0x3b9bb4){return db[_0x8ba1('0x2f')][_0x8ba1('0x4e')]()['then'](respondWithResult(_0x3b9bb4,null))[_0x8ba1('0x4d')](handleError(_0x3b9bb4,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 449a77c..f01172e 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 _0xdc3f=['define','JscriptyAnswerReport','report_jscripty_answers','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1d7300,_0x17f109){var _0x46ee98=function(_0x5ee16a){while(--_0x5ee16a){_0x1d7300['push'](_0x1d7300['shift']());}};_0x46ee98(++_0x17f109);}(_0xdc3f,0x183));var _0xfdc3=function(_0x483de2,_0x2774f9){_0x483de2=_0x483de2-0x0;var _0x523147=_0xdc3f[_0x483de2];return _0x523147;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xfdc3('0x0'));var rp=require(_0xfdc3('0x1'));var fs=require('fs');var path=require(_0xfdc3('0x2'));var rimraf=require(_0xfdc3('0x3'));var config=require(_0xfdc3('0x4'));var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x2742ca,_0x4fd111){return _0x2742ca[_0xfdc3('0x5')](_0xfdc3('0x6'),attributes,{'tableName':_0xfdc3('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcdfa=['request-promise','path','rimraf','../../config/environment','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x52b8d6,_0x35f487){var _0x25fa6d=function(_0x4258d6){while(--_0x4258d6){_0x52b8d6['push'](_0x52b8d6['shift']());}};_0x25fa6d(++_0x35f487);}(_0xcdfa,0x1e4));var _0xacdf=function(_0x33d41e,_0x1ae3ae){_0x33d41e=_0x33d41e-0x0;var _0x5f1eeb=_0xcdfa[_0x33d41e];return _0x5f1eeb;};'use strict';var _=require(_0xacdf('0x0'));var util=require(_0xacdf('0x1'));var logger=require(_0xacdf('0x2'))(_0xacdf('0x3'));var moment=require(_0xacdf('0x4'));var BPromise=require(_0xacdf('0x5'));var rp=require(_0xacdf('0x6'));var fs=require('fs');var path=require(_0xacdf('0x7'));var rimraf=require(_0xacdf('0x8'));var config=require(_0xacdf('0x9'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0xacdf('0xa')]=function(_0xcc2ee4,_0x15e4ce){return _0xcc2ee4[_0xacdf('0xb')](_0xacdf('0xc'),attributes,{'tableName':_0xacdf('0xd'),'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 c4a4c5d..3f677a2 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 _0x9b33=['result','catch','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x9b33,0x14c));var _0x39b3=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x9b33[_0x298ed3];return _0x5aad28;};'use strict';var _=require('lodash');var util=require(_0x39b3('0x0'));var moment=require(_0x39b3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x39b3('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x39b3('0x3'))(_0x39b3('0x4'));var config=require(_0x39b3('0x5'));var jayson=require(_0x39b3('0x6'));var client=jayson[_0x39b3('0x7')][_0x39b3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x617fac,_0x8863ff,_0x9cb955){return new BPromise(function(_0x41173d,_0x146ad7){return client[_0x39b3('0x9')](_0x617fac,_0x9cb955)[_0x39b3('0xa')](function(_0x105eb3){logger['info'](_0x39b3('0xb'),_0x8863ff,_0x39b3('0xc'));logger[_0x39b3('0xd')](_0x39b3('0xe'),_0x8863ff,'request\x20sent',JSON[_0x39b3('0xf')](_0x105eb3));if(_0x105eb3[_0x39b3('0x10')]){if(_0x105eb3['error'][_0x39b3('0x11')]===0x1f4){logger[_0x39b3('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x8863ff,_0x105eb3[_0x39b3('0x10')][_0x39b3('0x12')]);return _0x146ad7(_0x105eb3[_0x39b3('0x10')][_0x39b3('0x12')]);}logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x8863ff,_0x105eb3[_0x39b3('0x10')][_0x39b3('0x12')]);return _0x41173d(_0x105eb3[_0x39b3('0x10')][_0x39b3('0x12')]);}else{logger[_0x39b3('0x13')](_0x39b3('0xb'),_0x8863ff,_0x39b3('0xc'));_0x41173d(_0x105eb3[_0x39b3('0x14')][_0x39b3('0x12')]);}})[_0x39b3('0x15')](function(_0x123cf1){logger[_0x39b3('0x10')](_0x39b3('0xb'),_0x8863ff,_0x123cf1);_0x146ad7(_0x123cf1);});});} \ No newline at end of file +var _0x959d=['message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','JscriptyAnswerReport,\x20%s,\x20%s'];(function(_0x3a0f09,_0x4f981b){var _0x46c463=function(_0x478914){while(--_0x478914){_0x3a0f09['push'](_0x3a0f09['shift']());}};_0x46c463(++_0x4f981b);}(_0x959d,0x71));var _0xd959=function(_0x52e363,_0x48062a){_0x52e363=_0x52e363-0x0;var _0x3fc2b5=_0x959d[_0x52e363];return _0x3fc2b5;};'use strict';var _=require(_0xd959('0x0'));var util=require(_0xd959('0x1'));var moment=require(_0xd959('0x2'));var BPromise=require(_0xd959('0x3'));var rs=require(_0xd959('0x4'));var fs=require('fs');var Redis=require(_0xd959('0x5'));var db=require(_0xd959('0x6'))['db'];var utils=require(_0xd959('0x7'));var logger=require('../../config/logger')(_0xd959('0x8'));var config=require(_0xd959('0x9'));var jayson=require(_0xd959('0xa'));var client=jayson[_0xd959('0xb')][_0xd959('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5aa2df,_0x555eec,_0x450a64){return new BPromise(function(_0x354b9b,_0x2a3238){return client['request'](_0x5aa2df,_0x450a64)['then'](function(_0x2c5049){logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x555eec,_0xd959('0xd'));logger[_0xd959('0xe')](_0xd959('0xf'),_0x555eec,_0xd959('0xd'),JSON[_0xd959('0x10')](_0x2c5049));if(_0x2c5049[_0xd959('0x11')]){if(_0x2c5049['error']['code']===0x1f4){logger[_0xd959('0x11')](_0xd959('0x12'),_0x555eec,_0x2c5049[_0xd959('0x11')][_0xd959('0x13')]);return _0x2a3238(_0x2c5049[_0xd959('0x11')][_0xd959('0x13')]);}logger[_0xd959('0x11')](_0xd959('0x12'),_0x555eec,_0x2c5049['error'][_0xd959('0x13')]);return _0x354b9b(_0x2c5049[_0xd959('0x11')]['message']);}else{logger[_0xd959('0x14')](_0xd959('0x12'),_0x555eec,'request\x20sent');_0x354b9b(_0x2c5049['result']['message']);}})[_0xd959('0x15')](function(_0x277d4a){logger[_0xd959('0x11')](_0xd959('0x12'),_0x555eec,_0x277d4a);_0x2a3238(_0x277d4a);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index a056645..6ed5346 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 _0x5aea=['get','isAuthenticated','/:id','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','create','post','put','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller'];(function(_0x4542d8,_0x303ad4){var _0x148f86=function(_0x4e340b){while(--_0x4e340b){_0x4542d8['push'](_0x4542d8['shift']());}};_0x148f86(++_0x303ad4);}(_0x5aea,0xa0));var _0xa5ae=function(_0x42b11f,_0x19fe27){_0x42b11f=_0x42b11f-0x0;var _0x72ee76=_0x5aea[_0x42b11f];return _0x72ee76;};'use strict';var multer=require(_0xa5ae('0x0'));var util=require(_0xa5ae('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa5ae('0x2'));var router=express[_0xa5ae('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa5ae('0x4'));var interaction=require(_0xa5ae('0x5'));var config=require(_0xa5ae('0x6'));var controller=require(_0xa5ae('0x7'));router[_0xa5ae('0x8')]('/',auth[_0xa5ae('0x9')](),controller['index']);router[_0xa5ae('0x8')](_0xa5ae('0xa'),auth[_0xa5ae('0x9')](),controller['show']);router[_0xa5ae('0x8')](_0xa5ae('0xb'),auth[_0xa5ae('0x9')](),controller[_0xa5ae('0xc')]);router[_0xa5ae('0x8')](_0xa5ae('0xd'),auth[_0xa5ae('0x9')](),controller[_0xa5ae('0xe')]);router[_0xa5ae('0x8')](_0xa5ae('0xf'),auth[_0xa5ae('0x9')](),timeout(_0xa5ae('0x10')),controller[_0xa5ae('0x11')]);router['post']('/',auth[_0xa5ae('0x9')](),controller[_0xa5ae('0x12')]);router[_0xa5ae('0x13')]('/:id/clone',auth[_0xa5ae('0x9')](),controller['clone']);router[_0xa5ae('0x14')]('/:id',auth[_0xa5ae('0x9')](),controller['update']);router[_0xa5ae('0x15')](_0xa5ae('0xa'),auth[_0xa5ae('0x9')](),controller[_0xa5ae('0x16')]);module[_0xa5ae('0x17')]=router; \ No newline at end of file +var _0xb24a=['./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','/:id/answers','getAnswers','getSummary','post','/:id/clone','clone','put','update','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xe248ce,_0x47c462){var _0x195be0=function(_0x45f68c){while(--_0x45f68c){_0xe248ce['push'](_0xe248ce['shift']());}};_0x195be0(++_0x47c462);}(_0xb24a,0x148));var _0xab24=function(_0x1b3a5c,_0x2f9d5f){_0x1b3a5c=_0x1b3a5c-0x0;var _0x2ae8cb=_0xb24a[_0x1b3a5c];return _0x2ae8cb;};'use strict';var multer=require(_0xab24('0x0'));var util=require('util');var path=require(_0xab24('0x1'));var timeout=require('connect-timeout');var express=require(_0xab24('0x2'));var router=express[_0xab24('0x3')]();var fs_extra=require(_0xab24('0x4'));var auth=require(_0xab24('0x5'));var interaction=require(_0xab24('0x6'));var config=require(_0xab24('0x7'));var controller=require(_0xab24('0x8'));router[_0xab24('0x9')]('/',auth[_0xab24('0xa')](),controller[_0xab24('0xb')]);router[_0xab24('0x9')](_0xab24('0xc'),auth['isAuthenticated'](),controller[_0xab24('0xd')]);router[_0xab24('0x9')](_0xab24('0xe'),auth[_0xab24('0xa')](),controller['getSessions']);router['get'](_0xab24('0xf'),auth[_0xab24('0xa')](),controller[_0xab24('0x10')]);router[_0xab24('0x9')]('/:id/summary',auth[_0xab24('0xa')](),timeout('30s'),controller[_0xab24('0x11')]);router[_0xab24('0x12')]('/',auth[_0xab24('0xa')](),controller['create']);router['post'](_0xab24('0x13'),auth[_0xab24('0xa')](),controller[_0xab24('0x14')]);router[_0xab24('0x15')](_0xab24('0xc'),auth[_0xab24('0xa')](),controller[_0xab24('0x16')]);router['delete'](_0xab24('0xc'),auth[_0xab24('0xa')](),controller[_0xab24('0x17')]);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 d4fa593..ff5fe2a 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 _0x3c0a=['setDataValue','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','name','TEXT','long','isObjectLike'];(function(_0x41bdd4,_0x3d5c76){var _0x5c03a6=function(_0x59634a){while(--_0x59634a){_0x41bdd4['push'](_0x41bdd4['shift']());}};_0x5c03a6(++_0x3d5c76);}(_0x3c0a,0x1f1));var _0xa3c0=function(_0x24a9bd,_0x45fd2b){_0x24a9bd=_0x24a9bd-0x0;var _0x596c28=_0x3c0a[_0x24a9bd];return _0x596c28;};'use strict';var Sequelize=require(_0xa3c0('0x0'));var _=require(_0xa3c0('0x1'));var util=require(_0xa3c0('0x2'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xa3c0('0x3')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xa3c0('0x4')](_0xa3c0('0x5')),'set':function(_0x59ebff){if(_[_0xa3c0('0x6')](_0x59ebff)){this[_0xa3c0('0x7')](_0xa3c0('0x8'),JSON['stringify'](_0x59ebff));}else if(_['isString'](_0x59ebff)){this[_0xa3c0('0x7')]('formData',_0x59ebff);}else{this['setDataValue'](_0xa3c0('0x8'),util[_0xa3c0('0x9')](_0xa3c0('0xa'),this[_0xa3c0('0xb')](_0xa3c0('0x3'))||'',this[_0xa3c0('0xb')](_0xa3c0('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xa3c0('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xa3c0('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0x384f=['description','BOOLEAN','sequelize','exports','long','isObjectLike','setDataValue','formData','stringify','format','getDataValue','name'];(function(_0x4e0fb0,_0x260bf8){var _0x24a2a7=function(_0x1e81b2){while(--_0x1e81b2){_0x4e0fb0['push'](_0x4e0fb0['shift']());}};_0x24a2a7(++_0x260bf8);}(_0x384f,0xb6));var _0xf384=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x384f[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xf384('0x0'));var _=require('lodash');var util=require('util');module[_0xf384('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0xf384('0x2')),'set':function(_0x1c3dc8){if(_[_0xf384('0x3')](_0x1c3dc8)){this[_0xf384('0x4')](_0xf384('0x5'),JSON[_0xf384('0x6')](_0x1c3dc8));}else if(_['isString'](_0x1c3dc8)){this[_0xf384('0x4')](_0xf384('0x5'),_0x1c3dc8);}else{this['setDataValue'](_0xf384('0x5'),util[_0xf384('0x7')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xf384('0x8')](_0xf384('0x9'))||'',this[_0xf384('0x8')](_0xf384('0xa'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xf384('0xb')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xf384('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 3cd3c48..b4b6043 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 _0x1dcc=['request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','destroy','then','get','Projects','error','stack','index','map','JscriptyProject','fieldName','key','name','query','intersection','model','fields','length','attributes','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','UserProfileSection','getSessions','findOne','keys','JscriptySessionReport','nolimit','ProjectId','getAnswers','JscriptyAnswerReport','hasOwnProperty','fromCharCode','toString','indexOf','replace','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','fast-json-patch'];(function(_0x2aa4ad,_0x2fadb4){var _0x27dc9c=function(_0x21f12f){while(--_0x21f12f){_0x2aa4ad['push'](_0x2aa4ad['shift']());}};_0x27dc9c(++_0x2fadb4);}(_0x1dcc,0x77));var _0xc1dc=function(_0x29e186,_0x18f121){_0x29e186=_0x29e186-0x0;var _0x2cbc2e=_0x1dcc[_0x29e186];return _0x2cbc2e;};'use strict';var emlformat=require(_0xc1dc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc1dc('0x1'));var rp=require(_0xc1dc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc1dc('0x3'));var util=require(_0xc1dc('0x4'));var path=require(_0xc1dc('0x5'));var sox=require(_0xc1dc('0x6'));var csv=require(_0xc1dc('0x7'));var ejs=require(_0xc1dc('0x8'));var fs=require('fs');var fs_extra=require(_0xc1dc('0x9'));var _=require('lodash');var squel=require(_0xc1dc('0xa'));var crypto=require(_0xc1dc('0xb'));var jsforce=require(_0xc1dc('0xc'));var deskjs=require(_0xc1dc('0xd'));var toCsv=require(_0xc1dc('0x7'));var querystring=require(_0xc1dc('0xe'));var Papa=require(_0xc1dc('0xf'));var Redis=require(_0xc1dc('0x10'));var authService=require(_0xc1dc('0x11'));var qs=require(_0xc1dc('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc1dc('0x13'));var logger=require(_0xc1dc('0x14'))('api');var utils=require(_0xc1dc('0x15'));var config=require(_0xc1dc('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1dc('0x17'))['db'];function respondWithStatusCode(_0x2545e8,_0x31cd63){_0x31cd63=_0x31cd63||0xcc;return function(_0x2d407c){if(_0x2d407c){return _0x2545e8[_0xc1dc('0x18')](_0x31cd63);}return _0x2545e8[_0xc1dc('0x19')](_0x31cd63)[_0xc1dc('0x1a')]();};}function respondWithResult(_0x4d9d5e,_0x48abc3){_0x48abc3=_0x48abc3||0xc8;return function(_0x140b0b){if(_0x140b0b){return _0x4d9d5e[_0xc1dc('0x19')](_0x48abc3)[_0xc1dc('0x1b')](_0x140b0b);}};}function respondWithFilteredResult(_0xdfbe60,_0x31191a){return function(_0x209355){if(_0x209355){var _0x1edb66=typeof _0x31191a['offset']==='undefined'&&typeof _0x31191a['limit']==='undefined';var _0x2e2d8e=_0x209355[_0xc1dc('0x1c')];var _0x12510a=_0x1edb66?0x0:_0x31191a[_0xc1dc('0x1d')];var _0x6d7e23=_0x1edb66?_0x209355[_0xc1dc('0x1c')]:_0x31191a['offset']+_0x31191a[_0xc1dc('0x1e')];var _0xcac31f;if(_0x6d7e23>=_0x2e2d8e){_0x6d7e23=_0x2e2d8e;_0xcac31f=0xc8;}else{_0xcac31f=0xce;}_0xdfbe60[_0xc1dc('0x19')](_0xcac31f);return _0xdfbe60['set'](_0xc1dc('0x1f'),_0x12510a+'-'+_0x6d7e23+'/'+_0x2e2d8e)['json'](_0x209355);}return null;};}function patchUpdates(_0xabf65a){return function(_0x214ce3){try{jsonpatch[_0xc1dc('0x20')](_0x214ce3,_0xabf65a,!![]);}catch(_0x3939af){return BPromise[_0xc1dc('0x21')](_0x3939af);}return _0x214ce3['save']();};}function saveUpdates(_0x3d7a8f,_0x1a92f6){return function(_0x3ce279){if(_0x3ce279){return _0x3ce279[_0xc1dc('0x22')](_0x3d7a8f)['then'](function(_0x31f5eb){return _0x31f5eb;});}return null;};}function removeEntity(_0x2c5e5a,_0x57582b){return function(_0x71bf72){if(_0x71bf72){return _0x71bf72[_0xc1dc('0x23')]()[_0xc1dc('0x24')](function(){var _0x21a887=_0x71bf72[_0xc1dc('0x25')]({'plain':!![]});var _0x454ed2=_0xc1dc('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x454ed2,'resourceId':_0x21a887['id']}})[_0xc1dc('0x24')](function(){return _0x71bf72;});})['then'](function(){_0x2c5e5a[_0xc1dc('0x19')](0xcc)[_0xc1dc('0x1a')]();});}};}function handleEntityNotFound(_0x413bc7,_0x4dc1ae){return function(_0x580ffc){if(!_0x580ffc){_0x413bc7[_0xc1dc('0x18')](0x194);}return _0x580ffc;};}function handleError(_0x418072,_0x3a8b7f){_0x3a8b7f=_0x3a8b7f||0x1f4;return function(_0x1dc7bc){logger[_0xc1dc('0x27')](_0x1dc7bc[_0xc1dc('0x28')]);if(_0x1dc7bc['name']){delete _0x1dc7bc['name'];}_0x418072[_0xc1dc('0x19')](_0x3a8b7f)['send'](_0x1dc7bc);};}exports[_0xc1dc('0x29')]=function(_0x577fe5,_0x51f940){var _0x10e03f={},_0xc1e849={},_0xfeab2a={'count':0x0,'rows':[]};var _0x2aface=_[_0xc1dc('0x2a')](db[_0xc1dc('0x2b')]['rawAttributes'],function(_0x453412){return{'name':_0x453412[_0xc1dc('0x2c')],'type':_0x453412['type'][_0xc1dc('0x2d')]};});_0xc1e849['model']=_[_0xc1dc('0x2a')](_0x2aface,_0xc1dc('0x2e'));_0xc1e849[_0xc1dc('0x2f')]=_['keys'](_0x577fe5[_0xc1dc('0x2f')]);_0xc1e849['filters']=_[_0xc1dc('0x30')](_0xc1e849[_0xc1dc('0x31')],_0xc1e849[_0xc1dc('0x2f')]);_0x10e03f['attributes']=_[_0xc1dc('0x30')](_0xc1e849[_0xc1dc('0x31')],qs[_0xc1dc('0x32')](_0x577fe5[_0xc1dc('0x2f')]['fields']));_0x10e03f['attributes']=_0x10e03f['attributes'][_0xc1dc('0x33')]?_0x10e03f[_0xc1dc('0x34')]:_0xc1e849[_0xc1dc('0x31')];if(!_0x577fe5[_0xc1dc('0x2f')]['hasOwnProperty']('nolimit')){_0x10e03f['limit']=qs[_0xc1dc('0x1e')](_0x577fe5[_0xc1dc('0x2f')][_0xc1dc('0x1e')]);_0x10e03f['offset']=qs[_0xc1dc('0x1d')](_0x577fe5[_0xc1dc('0x2f')][_0xc1dc('0x1d')]);}_0x10e03f[_0xc1dc('0x35')]=qs['sort'](_0x577fe5['query'][_0xc1dc('0x36')]);_0x10e03f['where']=qs[_0xc1dc('0x37')](_[_0xc1dc('0x38')](_0x577fe5[_0xc1dc('0x2f')],_0xc1e849[_0xc1dc('0x37')]),_0x2aface);if(_0x577fe5[_0xc1dc('0x2f')][_0xc1dc('0x39')]){_0x10e03f[_0xc1dc('0x3a')]=_[_0xc1dc('0x3b')](_0x10e03f[_0xc1dc('0x3a')],{'$or':_[_0xc1dc('0x2a')](_0x2aface,function(_0x422f37){if(_0x422f37[_0xc1dc('0x3c')]!==_0xc1dc('0x3d')){var _0x248311={};_0x248311[_0x422f37['name']]={'$like':'%'+_0x577fe5[_0xc1dc('0x2f')][_0xc1dc('0x39')]+'%'};return _0x248311;}})});}_0x10e03f=_[_0xc1dc('0x3b')]({},_0x10e03f,_0x577fe5[_0xc1dc('0x3e')]);var _0x141f2e={'where':_0x10e03f['where']};return db[_0xc1dc('0x2b')][_0xc1dc('0x1c')](_0x141f2e)[_0xc1dc('0x24')](function(_0x322368){_0xfeab2a[_0xc1dc('0x1c')]=_0x322368;if(_0x577fe5[_0xc1dc('0x2f')][_0xc1dc('0x3f')]){_0x10e03f[_0xc1dc('0x40')]=[{'all':!![]}];}return db[_0xc1dc('0x2b')][_0xc1dc('0x41')](_0x10e03f);})['then'](function(_0x24d976){_0xfeab2a[_0xc1dc('0x42')]=_0x24d976;return _0xfeab2a;})['then'](respondWithFilteredResult(_0x51f940,_0x10e03f))[_0xc1dc('0x43')](handleError(_0x51f940,null));};exports['show']=function(_0x376fe2,_0x457d3a){var _0x7e535={'raw':![],'where':{'id':_0x376fe2[_0xc1dc('0x44')]['id']}},_0x1193b4={};_0x1193b4[_0xc1dc('0x31')]=_['keys'](db[_0xc1dc('0x2b')][_0xc1dc('0x45')]);_0x1193b4[_0xc1dc('0x2f')]=_['keys'](_0x376fe2[_0xc1dc('0x2f')]);_0x1193b4[_0xc1dc('0x37')]=_['intersection'](_0x1193b4['model'],_0x1193b4['query']);_0x7e535[_0xc1dc('0x34')]=_[_0xc1dc('0x30')](_0x1193b4[_0xc1dc('0x31')],qs[_0xc1dc('0x32')](_0x376fe2['query'][_0xc1dc('0x32')]));_0x7e535[_0xc1dc('0x34')]=_0x7e535['attributes'][_0xc1dc('0x33')]?_0x7e535[_0xc1dc('0x34')]:_0x1193b4[_0xc1dc('0x31')];if(_0x376fe2['query']['includeAll']){_0x7e535[_0xc1dc('0x40')]=[{'all':!![]}];}_0x7e535=_[_0xc1dc('0x3b')]({},_0x7e535,_0x376fe2[_0xc1dc('0x3e')]);return db[_0xc1dc('0x2b')][_0xc1dc('0x46')](_0x7e535)[_0xc1dc('0x24')](handleEntityNotFound(_0x457d3a,null))[_0xc1dc('0x24')](respondWithResult(_0x457d3a,null))[_0xc1dc('0x43')](handleError(_0x457d3a,null));};exports[_0xc1dc('0x47')]=function(_0x51b970,_0x74756){return db['JscriptyProject'][_0xc1dc('0x47')](_0x51b970[_0xc1dc('0x48')],{})[_0xc1dc('0x24')](function(_0x46f7c4){var _0x8e6a96=_0x51b970[_0xc1dc('0x49')][_0xc1dc('0x25')]({'plain':!![]});if(!_0x8e6a96)throw new Error(_0xc1dc('0x4a'));if(_0x8e6a96[_0xc1dc('0x4b')]===_0xc1dc('0x49')){var _0xcc3f55=_0x46f7c4[_0xc1dc('0x25')]({'plain':!![]});var _0x203b8e=_0xc1dc('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x203b8e,'userProfileId':_0x8e6a96[_0xc1dc('0x4c')]},'raw':!![]})[_0xc1dc('0x24')](function(_0x4de388){if(_0x4de388&&_0x4de388[_0xc1dc('0x4d')]===0x0){return db[_0xc1dc('0x4e')]['create']({'name':_0xcc3f55[_0xc1dc('0x2e')],'resourceId':_0xcc3f55['id'],'type':_0x4de388['name'],'sectionId':_0x4de388['id']},{})[_0xc1dc('0x24')](function(){return _0x46f7c4;});}else{return _0x46f7c4;}})[_0xc1dc('0x43')](function(_0x3c6b1d){logger[_0xc1dc('0x27')](_0xc1dc('0x4f'),_0x3c6b1d);throw _0x3c6b1d;});}return _0x46f7c4;})[_0xc1dc('0x24')](respondWithResult(_0x74756,0xc9))[_0xc1dc('0x43')](handleError(_0x74756,null));};exports[_0xc1dc('0x50')]=function(_0x22c10e,_0x42be97){var _0x50ae51={'where':{'id':_0x22c10e[_0xc1dc('0x44')]['id']}},_0x4f97c0={};_0x4f97c0[_0xc1dc('0x31')]=_['keys'](db['JscriptyProject'][_0xc1dc('0x45')]);_0x50ae51[_0xc1dc('0x34')]=_[_0xc1dc('0x30')](_0x4f97c0[_0xc1dc('0x31')],qs[_0xc1dc('0x32')](_0x22c10e[_0xc1dc('0x2f')][_0xc1dc('0x32')]));_0x50ae51[_0xc1dc('0x34')]=_0x50ae51[_0xc1dc('0x34')]['length']?_0x50ae51[_0xc1dc('0x34')]:_0x4f97c0['model'];if(_0x22c10e[_0xc1dc('0x2f')][_0xc1dc('0x3f')]){_0x50ae51[_0xc1dc('0x40')]=[{'all':!![]}];}_0x50ae51=_[_0xc1dc('0x3b')]({},_0x50ae51,_0x22c10e[_0xc1dc('0x3e')]);return db['JscriptyProject'][_0xc1dc('0x46')](_0x50ae51)[_0xc1dc('0x24')](handleEntityNotFound(_0x42be97,null))[_0xc1dc('0x24')](function(_0x5b1fd6){if(_0x5b1fd6){var _0x3b5b1d=_0x5b1fd6[_0xc1dc('0x25')]({'plain':!![]});_0x3b5b1d=qs[_0xc1dc('0x51')](_0x3b5b1d,['id',_0xc1dc('0x52'),_0xc1dc('0x53')]);_0x22c10e[_0xc1dc('0x48')]=_[_0xc1dc('0x51')](_0x22c10e['body'],['id','createdAt','updatedAt']);return db[_0xc1dc('0x2b')][_0xc1dc('0x47')](_[_0xc1dc('0x3b')](_0x3b5b1d,_0x22c10e['body']),{'include':_0x22c10e[_0xc1dc('0x2f')][_0xc1dc('0x3f')]?[{'all':!![]}]:undefined})[_0xc1dc('0x24')](function(_0x41091d){var _0x17d5e7=_0x22c10e['user']['get']({'plain':!![]});if(!_0x17d5e7)throw new Error(_0xc1dc('0x4a'));if(_0x17d5e7['role']===_0xc1dc('0x49')){var _0x382ba1=_0x41091d['get']({'plain':!![]});var _0x4d26a8=_0xc1dc('0x26');return db[_0xc1dc('0x54')]['find']({'where':{'name':_0x4d26a8,'userProfileId':_0x17d5e7[_0xc1dc('0x4c')]},'raw':!![]})[_0xc1dc('0x24')](function(_0x19ea11){if(_0x19ea11&&_0x19ea11[_0xc1dc('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x382ba1['name'],'resourceId':_0x382ba1['id'],'type':_0x19ea11['name'],'sectionId':_0x19ea11['id']},{})['then'](function(){return _0x41091d;});}else{return _0x41091d;}})['catch'](function(_0x3055f8){logger['error'](_0xc1dc('0x4f'),_0x3055f8);throw _0x3055f8;});}return _0x41091d;});}})['then'](respondWithResult(_0x42be97,0xc9))[_0xc1dc('0x43')](handleError(_0x42be97,null));};exports['update']=function(_0x157d03,_0x37e90f){if(_0x157d03[_0xc1dc('0x48')]['id']){delete _0x157d03[_0xc1dc('0x48')]['id'];}return db[_0xc1dc('0x2b')][_0xc1dc('0x46')]({'where':{'id':_0x157d03[_0xc1dc('0x44')]['id']}})[_0xc1dc('0x24')](handleEntityNotFound(_0x37e90f,null))[_0xc1dc('0x24')](saveUpdates(_0x157d03['body'],null))['then'](respondWithResult(_0x37e90f,null))[_0xc1dc('0x43')](handleError(_0x37e90f,null));};exports[_0xc1dc('0x23')]=function(_0x444095,_0x382990){return db[_0xc1dc('0x2b')][_0xc1dc('0x46')]({'where':{'id':_0x444095['params']['id']}})[_0xc1dc('0x24')](handleEntityNotFound(_0x382990,null))[_0xc1dc('0x24')](removeEntity(_0x382990,null))[_0xc1dc('0x43')](handleError(_0x382990,null));};exports[_0xc1dc('0x55')]=function(_0x588be8,_0xe3cce7,_0x78bf5f){var _0x2df251={'raw':!![],'where':{}};var _0x48768a={};var _0x4599f6={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xc1dc('0x56')]({'where':{'id':_0x588be8[_0xc1dc('0x44')]['id']}})[_0xc1dc('0x24')](handleEntityNotFound(_0xe3cce7,null))[_0xc1dc('0x24')](function(_0x36e903){if(_0x36e903){_0x48768a['model']=_[_0xc1dc('0x57')](db[_0xc1dc('0x58')][_0xc1dc('0x45')]);_0x48768a['query']=_['keys'](_0x588be8['query']);_0x48768a[_0xc1dc('0x37')]=_['intersection'](_0x48768a[_0xc1dc('0x31')],_0x48768a['query']);_0x2df251[_0xc1dc('0x34')]=_[_0xc1dc('0x30')](_0x48768a['model'],qs[_0xc1dc('0x32')](_0x588be8[_0xc1dc('0x2f')][_0xc1dc('0x32')]));_0x2df251[_0xc1dc('0x34')]=_0x2df251[_0xc1dc('0x34')]['length']?_0x2df251[_0xc1dc('0x34')]:_0x48768a[_0xc1dc('0x31')];if(!_0x588be8['query']['hasOwnProperty'](_0xc1dc('0x59'))){_0x2df251[_0xc1dc('0x1e')]=qs['limit'](_0x588be8[_0xc1dc('0x2f')][_0xc1dc('0x1e')]);_0x2df251['offset']=qs[_0xc1dc('0x1d')](_0x588be8['query']['offset']);}_0x2df251[_0xc1dc('0x35')]=qs[_0xc1dc('0x36')](_0x588be8['query'][_0xc1dc('0x36')]);_0x2df251[_0xc1dc('0x3a')]=qs['filters'](_['pick'](_0x588be8[_0xc1dc('0x2f')],_0x48768a[_0xc1dc('0x37')]));_0x2df251[_0xc1dc('0x3a')][_0xc1dc('0x5a')]=_0x36e903['id'];if(_0x588be8[_0xc1dc('0x2f')][_0xc1dc('0x39')]){_0x2df251['where']=_[_0xc1dc('0x3b')](_0x2df251[_0xc1dc('0x3a')],{'$or':_['map'](_0x2df251[_0xc1dc('0x34')],function(_0x1cfb1c){var _0x1fabb1={};_0x1fabb1[_0x1cfb1c]={'$like':'%'+_0x588be8[_0xc1dc('0x2f')][_0xc1dc('0x39')]+'%'};return _0x1fabb1;})});}_0x2df251=_[_0xc1dc('0x3b')]({},_0x2df251,_0x588be8['options']);return db[_0xc1dc('0x58')][_0xc1dc('0x1c')]({'where':_0x2df251[_0xc1dc('0x3a')]})['then'](function(_0x2cc1e2){_0x4599f6[_0xc1dc('0x1c')]=_0x2cc1e2;if(_0x588be8[_0xc1dc('0x2f')][_0xc1dc('0x3f')]){_0x2df251[_0xc1dc('0x40')]=[{'all':!![]}];}return db[_0xc1dc('0x58')][_0xc1dc('0x41')](_0x2df251);})[_0xc1dc('0x24')](function(_0x2c6c1d){_0x4599f6[_0xc1dc('0x42')]=_0x2c6c1d;return _0x4599f6;});}})['then'](respondWithFilteredResult(_0xe3cce7,_0x2df251))['catch'](handleError(_0xe3cce7,null));};exports[_0xc1dc('0x5b')]=function(_0x5f10e8,_0x116e90,_0x327993){var _0x27529f={'raw':!![],'where':{}};var _0x6dbca3={};var _0x2d60ac={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xc1dc('0x56')]({'where':{'id':_0x5f10e8[_0xc1dc('0x44')]['id']}})[_0xc1dc('0x24')](handleEntityNotFound(_0x116e90,null))['then'](function(_0xc4c708){if(_0xc4c708){_0x6dbca3[_0xc1dc('0x31')]=_[_0xc1dc('0x57')](db[_0xc1dc('0x5c')][_0xc1dc('0x45')]);_0x6dbca3[_0xc1dc('0x2f')]=_[_0xc1dc('0x57')](_0x5f10e8[_0xc1dc('0x2f')]);_0x6dbca3[_0xc1dc('0x37')]=_[_0xc1dc('0x30')](_0x6dbca3[_0xc1dc('0x31')],_0x6dbca3['query']);_0x27529f['attributes']=_[_0xc1dc('0x30')](_0x6dbca3['model'],qs[_0xc1dc('0x32')](_0x5f10e8['query'][_0xc1dc('0x32')]));_0x27529f['attributes']=_0x27529f[_0xc1dc('0x34')][_0xc1dc('0x33')]?_0x27529f[_0xc1dc('0x34')]:_0x6dbca3['model'];if(!_0x5f10e8[_0xc1dc('0x2f')][_0xc1dc('0x5d')]('nolimit')){_0x27529f['limit']=qs[_0xc1dc('0x1e')](_0x5f10e8['query'][_0xc1dc('0x1e')]);_0x27529f['offset']=qs[_0xc1dc('0x1d')](_0x5f10e8[_0xc1dc('0x2f')][_0xc1dc('0x1d')]);}_0x27529f[_0xc1dc('0x35')]=qs['sort'](_0x5f10e8[_0xc1dc('0x2f')][_0xc1dc('0x36')]);_0x27529f[_0xc1dc('0x3a')]=qs[_0xc1dc('0x37')](_[_0xc1dc('0x38')](_0x5f10e8[_0xc1dc('0x2f')],_0x6dbca3['filters']));_0x27529f['where'][_0xc1dc('0x5a')]=_0xc4c708['id'];if(_0x5f10e8[_0xc1dc('0x2f')][_0xc1dc('0x39')]){_0x27529f[_0xc1dc('0x3a')]=_[_0xc1dc('0x3b')](_0x27529f[_0xc1dc('0x3a')],{'$or':_['map'](_0x27529f['attributes'],function(_0x22c2de){var _0x3231c1={};_0x3231c1[_0x22c2de]={'$like':'%'+_0x5f10e8[_0xc1dc('0x2f')][_0xc1dc('0x39')]+'%'};return _0x3231c1;})});}_0x27529f=_['merge']({},_0x27529f,_0x5f10e8[_0xc1dc('0x3e')]);return db[_0xc1dc('0x5c')][_0xc1dc('0x1c')]({'where':_0x27529f[_0xc1dc('0x3a')]})[_0xc1dc('0x24')](function(_0x457643){_0x2d60ac[_0xc1dc('0x1c')]=_0x457643;if(_0x5f10e8[_0xc1dc('0x2f')][_0xc1dc('0x3f')]){_0x27529f[_0xc1dc('0x40')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xc1dc('0x41')](_0x27529f);})[_0xc1dc('0x24')](function(_0x2a762a){_0x2d60ac['rows']=_0x2a762a;return _0x2d60ac;});}})[_0xc1dc('0x24')](respondWithFilteredResult(_0x116e90,_0x27529f))[_0xc1dc('0x43')](handleError(_0x116e90,null));};function char(_0x36b712){return'number'===typeof _0x36b712?String[_0xc1dc('0x5e')][_0xc1dc('0x20')](null,arguments):_0x36b712;}function needsEncapsulation(_0x1918b4){return!!_0x1918b4&&(_0x1918b4[_0xc1dc('0x5f')]()[_0xc1dc('0x60')](char(0xd))>=0x0||_0x1918b4[_0xc1dc('0x5f')]()[_0xc1dc('0x60')](char(0xa))>=0x0||_0x1918b4[_0xc1dc('0x5f')]()[_0xc1dc('0x60')](char(0x2c))>=0x0||_0x1918b4[_0xc1dc('0x5f')]()[_0xc1dc('0x60')](char(0x22))>=0x0);}function encapsulate(_0x721f51){var _0x1a6bca=char(0x22),_0x41d99c='\x5c'+char(0x22),_0x175706=_0x721f51[_0xc1dc('0x5f')]()[_0xc1dc('0x61')](new RegExp(_0x1a6bca,'g'),_0x41d99c);return _0x1a6bca+_0x175706+_0x1a6bca;}exports[_0xc1dc('0x62')]=function(_0xa8a711,_0x1a8ebf,_0x621756){var _0x58e6f1,_0x45e11b;var _0x15ab26={'where':{'ProjectId':_0xa8a711[_0xc1dc('0x44')]['id']}};if(_0xa8a711['query'][_0xc1dc('0x63')]){_0x15ab26[_0xc1dc('0x3a')]['starttime']=JSON[_0xc1dc('0x64')](_0xa8a711[_0xc1dc('0x2f')][_0xc1dc('0x63')]);}return db[_0xc1dc('0x58')][_0xc1dc('0x41')](_0x15ab26)[_0xc1dc('0x24')](handleEntityNotFound(_0x1a8ebf,null))[_0xc1dc('0x24')](function(_0x3f1358){if(_0x3f1358){_0x58e6f1=_0x3f1358;return db[_0xc1dc('0x65')][_0xc1dc('0x41')]({'where':{'SessionId':{'$in':_[_0xc1dc('0x2a')](_0x58e6f1,'id')},'ProjectId':_0xa8a711[_0xc1dc('0x44')]['id']},'order':_0xc1dc('0x66')});}})['then'](handleEntityNotFound(_0x1a8ebf,null))[_0xc1dc('0x24')](function(_0x4a8ca1){if(_0x4a8ca1){_0x45e11b=_0x4a8ca1;var _0x509873={};for(var _0x5bd3ea=0x0,_0x7bb24e=_0x45e11b[_0xc1dc('0x33')];_0x5bd3ea<_0x7bb24e;_0x5bd3ea++){if(!_0x509873[_0xc1dc('0x5d')](_0x45e11b[_0x5bd3ea][_0xc1dc('0x67')])){_0x509873[_0x45e11b[_0x5bd3ea]['questionId']]=needsEncapsulation(_0x45e11b[_0x5bd3ea][_0xc1dc('0x68')])?encapsulate(_0x45e11b[_0x5bd3ea][_0xc1dc('0x68')]):_0x45e11b[_0x5bd3ea]['question'];}}var _0x3cb914=[],_0x4c4db2={};for(var _0x1a704f=0x0,_0x28e6bf=_0x58e6f1['length'];_0x1a704f<_0x28e6bf;_0x1a704f++){_0x4c4db2={'ProjectId':_0xa8a711[_0xc1dc('0x44')]['id'],'SessionId':_0x58e6f1[_0x1a704f]['id'],'StartTime':moment(_0x58e6f1[_0x1a704f][_0xc1dc('0x69')])[_0xc1dc('0x6a')](_0xc1dc('0x6b'))};for(var _0x485b53=0x0,_0x4c860e=_0x45e11b[_0xc1dc('0x33')];_0x485b53<_0x4c860e;_0x485b53++){if(_0x45e11b[_0x485b53][_0xc1dc('0x6c')]==_0x58e6f1[_0x1a704f]['id']&&_0x509873[_0xc1dc('0x5d')](_0x45e11b[_0x485b53][_0xc1dc('0x67')])){_0x4c4db2[_0x509873[_0x45e11b[_0x485b53][_0xc1dc('0x67')]]]=_0x45e11b[_0x485b53][_0xc1dc('0x6d')];}}for(var _0x4d1c45 in _0x509873){if(!_0x4c4db2[_0xc1dc('0x5d')](_0x509873[_0x4d1c45])){_0x4c4db2[_0x509873[_0x4d1c45]]=null;}}_0x3cb914[_0xc1dc('0x6e')](_0x4c4db2);}return _0x3cb914;}})[_0xc1dc('0x24')](function(_0x3a9170){if(!_[_0xc1dc('0x6f')](_0x3a9170)){var _0xcd2261=toCsv(_0x3a9170);var _0x700725=Date[_0xc1dc('0x70')]();fs[_0xc1dc('0x71')](util[_0xc1dc('0x6a')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0xa8a711['params']['id'],_0x700725),_0xcd2261);_0x1a8ebf[_0xc1dc('0x72')]('Content-disposition',_0xc1dc('0x73')+util[_0xc1dc('0x6a')](_0xc1dc('0x74'),_0xa8a711['params']['id'],_0x700725));_0x1a8ebf[_0xc1dc('0x72')](_0xc1dc('0x75'),_0xc1dc('0x76'));return _0x1a8ebf[_0xc1dc('0x77')](util[_0xc1dc('0x6a')](_0xc1dc('0x78'),_0xa8a711['params']['id'],_0x700725));}else{return _0x1a8ebf[_0xc1dc('0x18')](0xcc);}})['catch'](handleError(_0x1a8ebf,null));}; \ No newline at end of file +var _0xf5c4=['stack','name','send','index','map','JscriptyProject','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','merge','VIRTUAL','filter','options','include','rows','catch','params','rawAttributes','includeAll','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','create','role','getSessions','findOne','JscriptySessionReport','order','pick','ProjectId','findAll','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','now','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','setHeader','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','update','then','destroy','get','Projects','UserProfileResource','end','error'];(function(_0x349ffc,_0x5c270d){var _0x17baa8=function(_0x146f93){while(--_0x146f93){_0x349ffc['push'](_0x349ffc['shift']());}};_0x17baa8(++_0x5c270d);}(_0xf5c4,0x1ae));var _0x4f5c=function(_0x405d4a,_0x2b774e){_0x405d4a=_0x405d4a-0x0;var _0x33b57d=_0xf5c4[_0x405d4a];return _0x33b57d;};'use strict';var emlformat=require(_0x4f5c('0x0'));var rimraf=require(_0x4f5c('0x1'));var zipdir=require(_0x4f5c('0x2'));var jsonpatch=require(_0x4f5c('0x3'));var rp=require(_0x4f5c('0x4'));var moment=require(_0x4f5c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4f5c('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4f5c('0x7'));var csv=require(_0x4f5c('0x8'));var ejs=require(_0x4f5c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4f5c('0xa'));var squel=require(_0x4f5c('0xb'));var crypto=require('crypto');var jsforce=require(_0x4f5c('0xc'));var deskjs=require(_0x4f5c('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4f5c('0xe'));var Redis=require(_0x4f5c('0xf'));var authService=require(_0x4f5c('0x10'));var qs=require(_0x4f5c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f5c('0x12'));var logger=require('../../config/logger')(_0x4f5c('0x13'));var utils=require(_0x4f5c('0x14'));var config=require(_0x4f5c('0x15'));var licenseUtil=require(_0x4f5c('0x16'));var db=require(_0x4f5c('0x17'))['db'];function respondWithStatusCode(_0x4ec410,_0x46e319){_0x46e319=_0x46e319||0xcc;return function(_0x554382){if(_0x554382){return _0x4ec410[_0x4f5c('0x18')](_0x46e319);}return _0x4ec410[_0x4f5c('0x19')](_0x46e319)['end']();};}function respondWithResult(_0x4a37d8,_0x1a160a){_0x1a160a=_0x1a160a||0xc8;return function(_0xfe0e5){if(_0xfe0e5){return _0x4a37d8[_0x4f5c('0x19')](_0x1a160a)['json'](_0xfe0e5);}};}function respondWithFilteredResult(_0x2ae5f6,_0x796709){return function(_0x4bb4b3){if(_0x4bb4b3){var _0x3ea3dd=typeof _0x796709[_0x4f5c('0x1a')]===_0x4f5c('0x1b')&&typeof _0x796709[_0x4f5c('0x1c')]===_0x4f5c('0x1b');var _0x55ccb6=_0x4bb4b3[_0x4f5c('0x1d')];var _0x2b1fad=_0x3ea3dd?0x0:_0x796709[_0x4f5c('0x1a')];var _0x47739d=_0x3ea3dd?_0x4bb4b3['count']:_0x796709[_0x4f5c('0x1a')]+_0x796709[_0x4f5c('0x1c')];var _0x5db75b;if(_0x47739d>=_0x55ccb6){_0x47739d=_0x55ccb6;_0x5db75b=0xc8;}else{_0x5db75b=0xce;}_0x2ae5f6[_0x4f5c('0x19')](_0x5db75b);return _0x2ae5f6[_0x4f5c('0x1e')]('Content-Range',_0x2b1fad+'-'+_0x47739d+'/'+_0x55ccb6)[_0x4f5c('0x1f')](_0x4bb4b3);}return null;};}function patchUpdates(_0x300410){return function(_0x25fca0){try{jsonpatch[_0x4f5c('0x20')](_0x25fca0,_0x300410,!![]);}catch(_0x1f942f){return BPromise[_0x4f5c('0x21')](_0x1f942f);}return _0x25fca0['save']();};}function saveUpdates(_0x56e3bb,_0x3843de){return function(_0xa7b7df){if(_0xa7b7df){return _0xa7b7df[_0x4f5c('0x22')](_0x56e3bb)[_0x4f5c('0x23')](function(_0xe6871){return _0xe6871;});}return null;};}function removeEntity(_0x1af746,_0x1691e5){return function(_0x1b0829){if(_0x1b0829){return _0x1b0829[_0x4f5c('0x24')]()['then'](function(){var _0x36bbf7=_0x1b0829[_0x4f5c('0x25')]({'plain':!![]});var _0x555b88=_0x4f5c('0x26');return db[_0x4f5c('0x27')][_0x4f5c('0x24')]({'where':{'type':_0x555b88,'resourceId':_0x36bbf7['id']}})[_0x4f5c('0x23')](function(){return _0x1b0829;});})[_0x4f5c('0x23')](function(){_0x1af746[_0x4f5c('0x19')](0xcc)[_0x4f5c('0x28')]();});}};}function handleEntityNotFound(_0xf4910b,_0x2ec563){return function(_0x356e45){if(!_0x356e45){_0xf4910b[_0x4f5c('0x18')](0x194);}return _0x356e45;};}function handleError(_0x5dd2ee,_0xf3012d){_0xf3012d=_0xf3012d||0x1f4;return function(_0x208695){logger[_0x4f5c('0x29')](_0x208695[_0x4f5c('0x2a')]);if(_0x208695[_0x4f5c('0x2b')]){delete _0x208695[_0x4f5c('0x2b')];}_0x5dd2ee['status'](_0xf3012d)[_0x4f5c('0x2c')](_0x208695);};}exports[_0x4f5c('0x2d')]=function(_0x1f9e73,_0x578393){var _0x8a0412={},_0x5ea0b6={},_0x4b8a98={'count':0x0,'rows':[]};var _0x1d8f8b=_[_0x4f5c('0x2e')](db[_0x4f5c('0x2f')]['rawAttributes'],function(_0x4224b8){return{'name':_0x4224b8['fieldName'],'type':_0x4224b8[_0x4f5c('0x30')][_0x4f5c('0x31')]};});_0x5ea0b6[_0x4f5c('0x32')]=_[_0x4f5c('0x2e')](_0x1d8f8b,_0x4f5c('0x2b'));_0x5ea0b6[_0x4f5c('0x33')]=_[_0x4f5c('0x34')](_0x1f9e73[_0x4f5c('0x33')]);_0x5ea0b6['filters']=_[_0x4f5c('0x35')](_0x5ea0b6[_0x4f5c('0x32')],_0x5ea0b6[_0x4f5c('0x33')]);_0x8a0412[_0x4f5c('0x36')]=_['intersection'](_0x5ea0b6[_0x4f5c('0x32')],qs[_0x4f5c('0x37')](_0x1f9e73[_0x4f5c('0x33')][_0x4f5c('0x37')]));_0x8a0412[_0x4f5c('0x36')]=_0x8a0412[_0x4f5c('0x36')][_0x4f5c('0x38')]?_0x8a0412[_0x4f5c('0x36')]:_0x5ea0b6[_0x4f5c('0x32')];if(!_0x1f9e73['query'][_0x4f5c('0x39')](_0x4f5c('0x3a'))){_0x8a0412[_0x4f5c('0x1c')]=qs[_0x4f5c('0x1c')](_0x1f9e73['query'][_0x4f5c('0x1c')]);_0x8a0412[_0x4f5c('0x1a')]=qs[_0x4f5c('0x1a')](_0x1f9e73[_0x4f5c('0x33')]['offset']);}_0x8a0412['order']=qs[_0x4f5c('0x3b')](_0x1f9e73[_0x4f5c('0x33')][_0x4f5c('0x3b')]);_0x8a0412[_0x4f5c('0x3c')]=qs[_0x4f5c('0x3d')](_['pick'](_0x1f9e73['query'],_0x5ea0b6[_0x4f5c('0x3d')]),_0x1d8f8b);if(_0x1f9e73[_0x4f5c('0x33')]['filter']){_0x8a0412[_0x4f5c('0x3c')]=_[_0x4f5c('0x3e')](_0x8a0412[_0x4f5c('0x3c')],{'$or':_[_0x4f5c('0x2e')](_0x1d8f8b,function(_0xdca9c3){if(_0xdca9c3[_0x4f5c('0x30')]!==_0x4f5c('0x3f')){var _0x46094d={};_0x46094d[_0xdca9c3['name']]={'$like':'%'+_0x1f9e73[_0x4f5c('0x33')][_0x4f5c('0x40')]+'%'};return _0x46094d;}})});}_0x8a0412=_[_0x4f5c('0x3e')]({},_0x8a0412,_0x1f9e73[_0x4f5c('0x41')]);var _0x21eb2a={'where':_0x8a0412[_0x4f5c('0x3c')]};return db[_0x4f5c('0x2f')]['count'](_0x21eb2a)[_0x4f5c('0x23')](function(_0x545262){_0x4b8a98[_0x4f5c('0x1d')]=_0x545262;if(_0x1f9e73[_0x4f5c('0x33')]['includeAll']){_0x8a0412[_0x4f5c('0x42')]=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0x8a0412);})[_0x4f5c('0x23')](function(_0x1dc368){_0x4b8a98[_0x4f5c('0x43')]=_0x1dc368;return _0x4b8a98;})[_0x4f5c('0x23')](respondWithFilteredResult(_0x578393,_0x8a0412))[_0x4f5c('0x44')](handleError(_0x578393,null));};exports['show']=function(_0x372143,_0x45b1f0){var _0x32d09c={'raw':![],'where':{'id':_0x372143[_0x4f5c('0x45')]['id']}},_0x33e734={};_0x33e734[_0x4f5c('0x32')]=_[_0x4f5c('0x34')](db[_0x4f5c('0x2f')][_0x4f5c('0x46')]);_0x33e734[_0x4f5c('0x33')]=_[_0x4f5c('0x34')](_0x372143[_0x4f5c('0x33')]);_0x33e734['filters']=_[_0x4f5c('0x35')](_0x33e734[_0x4f5c('0x32')],_0x33e734['query']);_0x32d09c[_0x4f5c('0x36')]=_[_0x4f5c('0x35')](_0x33e734['model'],qs[_0x4f5c('0x37')](_0x372143[_0x4f5c('0x33')][_0x4f5c('0x37')]));_0x32d09c[_0x4f5c('0x36')]=_0x32d09c[_0x4f5c('0x36')]['length']?_0x32d09c[_0x4f5c('0x36')]:_0x33e734[_0x4f5c('0x32')];if(_0x372143[_0x4f5c('0x33')][_0x4f5c('0x47')]){_0x32d09c['include']=[{'all':!![]}];}_0x32d09c=_[_0x4f5c('0x3e')]({},_0x32d09c,_0x372143[_0x4f5c('0x41')]);return db[_0x4f5c('0x2f')][_0x4f5c('0x48')](_0x32d09c)[_0x4f5c('0x23')](handleEntityNotFound(_0x45b1f0,null))[_0x4f5c('0x23')](respondWithResult(_0x45b1f0,null))[_0x4f5c('0x44')](handleError(_0x45b1f0,null));};exports['create']=function(_0x493159,_0x30793e){return db[_0x4f5c('0x2f')]['create'](_0x493159[_0x4f5c('0x49')],{})['then'](function(_0x17a30a){var _0x3241c5=_0x493159['user'][_0x4f5c('0x25')]({'plain':!![]});if(!_0x3241c5)throw new Error(_0x4f5c('0x4a'));if(_0x3241c5['role']===_0x4f5c('0x4b')){var _0x128ac0=_0x17a30a[_0x4f5c('0x25')]({'plain':!![]});var _0x279904=_0x4f5c('0x26');return db[_0x4f5c('0x4c')][_0x4f5c('0x48')]({'where':{'name':_0x279904,'userProfileId':_0x3241c5[_0x4f5c('0x4d')]},'raw':!![]})[_0x4f5c('0x23')](function(_0xbc03dd){if(_0xbc03dd&&_0xbc03dd[_0x4f5c('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x128ac0[_0x4f5c('0x2b')],'resourceId':_0x128ac0['id'],'type':_0xbc03dd[_0x4f5c('0x2b')],'sectionId':_0xbc03dd['id']},{})[_0x4f5c('0x23')](function(){return _0x17a30a;});}else{return _0x17a30a;}})['catch'](function(_0x34eba5){logger[_0x4f5c('0x29')](_0x4f5c('0x4f'),_0x34eba5);throw _0x34eba5;});}return _0x17a30a;})['then'](respondWithResult(_0x30793e,0xc9))[_0x4f5c('0x44')](handleError(_0x30793e,null));};exports[_0x4f5c('0x50')]=function(_0x34b57e,_0x54e8e8){var _0x1df03b={'where':{'id':_0x34b57e[_0x4f5c('0x45')]['id']}},_0xb5adf={};_0xb5adf[_0x4f5c('0x32')]=_['keys'](db[_0x4f5c('0x2f')][_0x4f5c('0x46')]);_0x1df03b[_0x4f5c('0x36')]=_['intersection'](_0xb5adf[_0x4f5c('0x32')],qs[_0x4f5c('0x37')](_0x34b57e[_0x4f5c('0x33')][_0x4f5c('0x37')]));_0x1df03b[_0x4f5c('0x36')]=_0x1df03b[_0x4f5c('0x36')]['length']?_0x1df03b[_0x4f5c('0x36')]:_0xb5adf[_0x4f5c('0x32')];if(_0x34b57e[_0x4f5c('0x33')]['includeAll']){_0x1df03b[_0x4f5c('0x42')]=[{'all':!![]}];}_0x1df03b=_['merge']({},_0x1df03b,_0x34b57e[_0x4f5c('0x41')]);return db[_0x4f5c('0x2f')][_0x4f5c('0x48')](_0x1df03b)[_0x4f5c('0x23')](handleEntityNotFound(_0x54e8e8,null))['then'](function(_0x35cd37){if(_0x35cd37){var _0xe3f3b2=_0x35cd37[_0x4f5c('0x25')]({'plain':!![]});_0xe3f3b2=qs[_0x4f5c('0x51')](_0xe3f3b2,['id','createdAt',_0x4f5c('0x52')]);_0x34b57e[_0x4f5c('0x49')]=_[_0x4f5c('0x51')](_0x34b57e['body'],['id','createdAt',_0x4f5c('0x52')]);return db['JscriptyProject'][_0x4f5c('0x53')](_[_0x4f5c('0x3e')](_0xe3f3b2,_0x34b57e[_0x4f5c('0x49')]),{'include':_0x34b57e[_0x4f5c('0x33')][_0x4f5c('0x47')]?[{'all':!![]}]:undefined})[_0x4f5c('0x23')](function(_0x597c60){var _0x5ba483=_0x34b57e[_0x4f5c('0x4b')][_0x4f5c('0x25')]({'plain':!![]});if(!_0x5ba483)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ba483[_0x4f5c('0x54')]===_0x4f5c('0x4b')){var _0x4c1df8=_0x597c60[_0x4f5c('0x25')]({'plain':!![]});var _0x3e7dd6=_0x4f5c('0x26');return db[_0x4f5c('0x4c')]['find']({'where':{'name':_0x3e7dd6,'userProfileId':_0x5ba483[_0x4f5c('0x4d')]},'raw':!![]})[_0x4f5c('0x23')](function(_0x2fa47c){if(_0x2fa47c&&_0x2fa47c['autoAssociation']===0x0){return db[_0x4f5c('0x27')]['create']({'name':_0x4c1df8[_0x4f5c('0x2b')],'resourceId':_0x4c1df8['id'],'type':_0x2fa47c[_0x4f5c('0x2b')],'sectionId':_0x2fa47c['id']},{})[_0x4f5c('0x23')](function(){return _0x597c60;});}else{return _0x597c60;}})[_0x4f5c('0x44')](function(_0x454590){logger[_0x4f5c('0x29')](_0x4f5c('0x4f'),_0x454590);throw _0x454590;});}return _0x597c60;});}})[_0x4f5c('0x23')](respondWithResult(_0x54e8e8,0xc9))['catch'](handleError(_0x54e8e8,null));};exports[_0x4f5c('0x22')]=function(_0x225c9d,_0x44ced8){if(_0x225c9d[_0x4f5c('0x49')]['id']){delete _0x225c9d[_0x4f5c('0x49')]['id'];}return db[_0x4f5c('0x2f')][_0x4f5c('0x48')]({'where':{'id':_0x225c9d['params']['id']}})[_0x4f5c('0x23')](handleEntityNotFound(_0x44ced8,null))['then'](saveUpdates(_0x225c9d[_0x4f5c('0x49')],null))['then'](respondWithResult(_0x44ced8,null))[_0x4f5c('0x44')](handleError(_0x44ced8,null));};exports[_0x4f5c('0x24')]=function(_0x411600,_0x1ee0a3){return db[_0x4f5c('0x2f')]['find']({'where':{'id':_0x411600['params']['id']}})[_0x4f5c('0x23')](handleEntityNotFound(_0x1ee0a3,null))['then'](removeEntity(_0x1ee0a3,null))[_0x4f5c('0x44')](handleError(_0x1ee0a3,null));};exports[_0x4f5c('0x55')]=function(_0x5c8f9d,_0x5786fb,_0x2efbda){var _0x170e5c={'raw':!![],'where':{}};var _0x4aa602={};var _0x29edd7={'count':0x0,'rows':[]};return db[_0x4f5c('0x2f')][_0x4f5c('0x56')]({'where':{'id':_0x5c8f9d[_0x4f5c('0x45')]['id']}})[_0x4f5c('0x23')](handleEntityNotFound(_0x5786fb,null))['then'](function(_0x7287d2){if(_0x7287d2){_0x4aa602[_0x4f5c('0x32')]=_[_0x4f5c('0x34')](db[_0x4f5c('0x57')][_0x4f5c('0x46')]);_0x4aa602[_0x4f5c('0x33')]=_[_0x4f5c('0x34')](_0x5c8f9d[_0x4f5c('0x33')]);_0x4aa602[_0x4f5c('0x3d')]=_[_0x4f5c('0x35')](_0x4aa602[_0x4f5c('0x32')],_0x4aa602[_0x4f5c('0x33')]);_0x170e5c[_0x4f5c('0x36')]=_['intersection'](_0x4aa602[_0x4f5c('0x32')],qs['fields'](_0x5c8f9d[_0x4f5c('0x33')][_0x4f5c('0x37')]));_0x170e5c[_0x4f5c('0x36')]=_0x170e5c[_0x4f5c('0x36')][_0x4f5c('0x38')]?_0x170e5c[_0x4f5c('0x36')]:_0x4aa602[_0x4f5c('0x32')];if(!_0x5c8f9d[_0x4f5c('0x33')][_0x4f5c('0x39')]('nolimit')){_0x170e5c['limit']=qs[_0x4f5c('0x1c')](_0x5c8f9d[_0x4f5c('0x33')][_0x4f5c('0x1c')]);_0x170e5c['offset']=qs['offset'](_0x5c8f9d[_0x4f5c('0x33')][_0x4f5c('0x1a')]);}_0x170e5c[_0x4f5c('0x58')]=qs['sort'](_0x5c8f9d[_0x4f5c('0x33')]['sort']);_0x170e5c[_0x4f5c('0x3c')]=qs['filters'](_[_0x4f5c('0x59')](_0x5c8f9d[_0x4f5c('0x33')],_0x4aa602[_0x4f5c('0x3d')]));_0x170e5c[_0x4f5c('0x3c')][_0x4f5c('0x5a')]=_0x7287d2['id'];if(_0x5c8f9d[_0x4f5c('0x33')][_0x4f5c('0x40')]){_0x170e5c[_0x4f5c('0x3c')]=_[_0x4f5c('0x3e')](_0x170e5c[_0x4f5c('0x3c')],{'$or':_[_0x4f5c('0x2e')](_0x170e5c['attributes'],function(_0x37fe9c){var _0x437100={};_0x437100[_0x37fe9c]={'$like':'%'+_0x5c8f9d['query'][_0x4f5c('0x40')]+'%'};return _0x437100;})});}_0x170e5c=_[_0x4f5c('0x3e')]({},_0x170e5c,_0x5c8f9d[_0x4f5c('0x41')]);return db[_0x4f5c('0x57')][_0x4f5c('0x1d')]({'where':_0x170e5c[_0x4f5c('0x3c')]})[_0x4f5c('0x23')](function(_0x31224f){_0x29edd7[_0x4f5c('0x1d')]=_0x31224f;if(_0x5c8f9d[_0x4f5c('0x33')][_0x4f5c('0x47')]){_0x170e5c['include']=[{'all':!![]}];}return db[_0x4f5c('0x57')][_0x4f5c('0x5b')](_0x170e5c);})['then'](function(_0x26ae22){_0x29edd7[_0x4f5c('0x43')]=_0x26ae22;return _0x29edd7;});}})[_0x4f5c('0x23')](respondWithFilteredResult(_0x5786fb,_0x170e5c))[_0x4f5c('0x44')](handleError(_0x5786fb,null));};exports['getAnswers']=function(_0x19ef6a,_0x25f4da,_0x4213f2){var _0x47357f={'raw':!![],'where':{}};var _0x583ed3={};var _0x5dc23a={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x19ef6a['params']['id']}})[_0x4f5c('0x23')](handleEntityNotFound(_0x25f4da,null))[_0x4f5c('0x23')](function(_0xf0b83e){if(_0xf0b83e){_0x583ed3[_0x4f5c('0x32')]=_[_0x4f5c('0x34')](db[_0x4f5c('0x5c')]['rawAttributes']);_0x583ed3['query']=_[_0x4f5c('0x34')](_0x19ef6a[_0x4f5c('0x33')]);_0x583ed3['filters']=_[_0x4f5c('0x35')](_0x583ed3[_0x4f5c('0x32')],_0x583ed3[_0x4f5c('0x33')]);_0x47357f['attributes']=_[_0x4f5c('0x35')](_0x583ed3[_0x4f5c('0x32')],qs[_0x4f5c('0x37')](_0x19ef6a[_0x4f5c('0x33')][_0x4f5c('0x37')]));_0x47357f[_0x4f5c('0x36')]=_0x47357f[_0x4f5c('0x36')][_0x4f5c('0x38')]?_0x47357f[_0x4f5c('0x36')]:_0x583ed3['model'];if(!_0x19ef6a[_0x4f5c('0x33')][_0x4f5c('0x39')](_0x4f5c('0x3a'))){_0x47357f[_0x4f5c('0x1c')]=qs[_0x4f5c('0x1c')](_0x19ef6a['query']['limit']);_0x47357f[_0x4f5c('0x1a')]=qs['offset'](_0x19ef6a[_0x4f5c('0x33')][_0x4f5c('0x1a')]);}_0x47357f[_0x4f5c('0x58')]=qs[_0x4f5c('0x3b')](_0x19ef6a[_0x4f5c('0x33')]['sort']);_0x47357f['where']=qs[_0x4f5c('0x3d')](_[_0x4f5c('0x59')](_0x19ef6a[_0x4f5c('0x33')],_0x583ed3[_0x4f5c('0x3d')]));_0x47357f['where']['ProjectId']=_0xf0b83e['id'];if(_0x19ef6a[_0x4f5c('0x33')][_0x4f5c('0x40')]){_0x47357f[_0x4f5c('0x3c')]=_['merge'](_0x47357f['where'],{'$or':_[_0x4f5c('0x2e')](_0x47357f[_0x4f5c('0x36')],function(_0x3910bf){var _0x3bb8d5={};_0x3bb8d5[_0x3910bf]={'$like':'%'+_0x19ef6a[_0x4f5c('0x33')][_0x4f5c('0x40')]+'%'};return _0x3bb8d5;})});}_0x47357f=_[_0x4f5c('0x3e')]({},_0x47357f,_0x19ef6a[_0x4f5c('0x41')]);return db['JscriptyAnswerReport'][_0x4f5c('0x1d')]({'where':_0x47357f[_0x4f5c('0x3c')]})[_0x4f5c('0x23')](function(_0x3676ed){_0x5dc23a[_0x4f5c('0x1d')]=_0x3676ed;if(_0x19ef6a[_0x4f5c('0x33')]['includeAll']){_0x47357f[_0x4f5c('0x42')]=[{'all':!![]}];}return db[_0x4f5c('0x5c')]['findAll'](_0x47357f);})['then'](function(_0x1eafd0){_0x5dc23a[_0x4f5c('0x43')]=_0x1eafd0;return _0x5dc23a;});}})['then'](respondWithFilteredResult(_0x25f4da,_0x47357f))[_0x4f5c('0x44')](handleError(_0x25f4da,null));};function char(_0xfb23af){return _0x4f5c('0x5d')===typeof _0xfb23af?String[_0x4f5c('0x5e')][_0x4f5c('0x20')](null,arguments):_0xfb23af;}function needsEncapsulation(_0x41708b){return!!_0x41708b&&(_0x41708b[_0x4f5c('0x5f')]()[_0x4f5c('0x60')](char(0xd))>=0x0||_0x41708b[_0x4f5c('0x5f')]()[_0x4f5c('0x60')](char(0xa))>=0x0||_0x41708b['toString']()[_0x4f5c('0x60')](char(0x2c))>=0x0||_0x41708b[_0x4f5c('0x5f')]()[_0x4f5c('0x60')](char(0x22))>=0x0);}function encapsulate(_0x3f46f6){var _0x3a82bf=char(0x22),_0x4b3e2b='\x5c'+char(0x22),_0x45a0d8=_0x3f46f6[_0x4f5c('0x5f')]()['replace'](new RegExp(_0x3a82bf,'g'),_0x4b3e2b);return _0x3a82bf+_0x45a0d8+_0x3a82bf;}exports[_0x4f5c('0x61')]=function(_0x22062c,_0x3bbace,_0x42950b){var _0x1425d7,_0x29a84b;var _0x320579={'where':{'ProjectId':_0x22062c[_0x4f5c('0x45')]['id']}};if(_0x22062c[_0x4f5c('0x33')][_0x4f5c('0x62')]){_0x320579[_0x4f5c('0x3c')][_0x4f5c('0x63')]=JSON[_0x4f5c('0x64')](_0x22062c['query'][_0x4f5c('0x62')]);}return db[_0x4f5c('0x57')][_0x4f5c('0x5b')](_0x320579)[_0x4f5c('0x23')](handleEntityNotFound(_0x3bbace,null))['then'](function(_0x2cb4d8){if(_0x2cb4d8){_0x1425d7=_0x2cb4d8;return db[_0x4f5c('0x65')][_0x4f5c('0x5b')]({'where':{'SessionId':{'$in':_[_0x4f5c('0x2e')](_0x1425d7,'id')},'ProjectId':_0x22062c[_0x4f5c('0x45')]['id']},'order':_0x4f5c('0x66')});}})[_0x4f5c('0x23')](handleEntityNotFound(_0x3bbace,null))[_0x4f5c('0x23')](function(_0x335d24){if(_0x335d24){_0x29a84b=_0x335d24;var _0x3c7cf5={};for(var _0x56f1a3=0x0,_0x41cdae=_0x29a84b[_0x4f5c('0x38')];_0x56f1a3<_0x41cdae;_0x56f1a3++){if(!_0x3c7cf5[_0x4f5c('0x39')](_0x29a84b[_0x56f1a3][_0x4f5c('0x67')])){_0x3c7cf5[_0x29a84b[_0x56f1a3][_0x4f5c('0x67')]]=needsEncapsulation(_0x29a84b[_0x56f1a3][_0x4f5c('0x68')])?encapsulate(_0x29a84b[_0x56f1a3][_0x4f5c('0x68')]):_0x29a84b[_0x56f1a3][_0x4f5c('0x68')];}}var _0x2fe642=[],_0x532cf6={};for(var _0x56d7a9=0x0,_0x41b44f=_0x1425d7['length'];_0x56d7a9<_0x41b44f;_0x56d7a9++){_0x532cf6={'ProjectId':_0x22062c[_0x4f5c('0x45')]['id'],'SessionId':_0x1425d7[_0x56d7a9]['id'],'StartTime':moment(_0x1425d7[_0x56d7a9][_0x4f5c('0x63')])['format'](_0x4f5c('0x69'))};for(var _0x14537c=0x0,_0x43f22d=_0x29a84b[_0x4f5c('0x38')];_0x14537c<_0x43f22d;_0x14537c++){if(_0x29a84b[_0x14537c][_0x4f5c('0x6a')]==_0x1425d7[_0x56d7a9]['id']&&_0x3c7cf5[_0x4f5c('0x39')](_0x29a84b[_0x14537c]['questionId'])){_0x532cf6[_0x3c7cf5[_0x29a84b[_0x14537c][_0x4f5c('0x67')]]]=_0x29a84b[_0x14537c][_0x4f5c('0x6b')];}}for(var _0x49ecf2 in _0x3c7cf5){if(!_0x532cf6[_0x4f5c('0x39')](_0x3c7cf5[_0x49ecf2])){_0x532cf6[_0x3c7cf5[_0x49ecf2]]=null;}}_0x2fe642[_0x4f5c('0x6c')](_0x532cf6);}return _0x2fe642;}})[_0x4f5c('0x23')](function(_0x3333c6){if(!_['isEmpty'](_0x3333c6)){var _0x3e6093=toCsv(_0x3333c6);var _0x2ff3f9=Date[_0x4f5c('0x6d')]();fs['writeFileSync'](util[_0x4f5c('0x6e')](_0x4f5c('0x6f'),_0x22062c[_0x4f5c('0x45')]['id'],_0x2ff3f9),_0x3e6093);_0x3bbace['setHeader'](_0x4f5c('0x70'),_0x4f5c('0x71')+util[_0x4f5c('0x6e')]('Jscripty_Project_%d_Summary_%s.csv',_0x22062c[_0x4f5c('0x45')]['id'],_0x2ff3f9));_0x3bbace[_0x4f5c('0x72')](_0x4f5c('0x73'),_0x4f5c('0x74'));return _0x3bbace[_0x4f5c('0x75')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x22062c[_0x4f5c('0x45')]['id'],_0x2ff3f9));}else{return _0x3bbace[_0x4f5c('0x18')](0xcc);}})['catch'](handleError(_0x3bbace,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index ee781e9..ad58c33 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 _0x0dec=['bluebird','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api'];(function(_0x5de5db,_0x463a74){var _0x45bb28=function(_0x5cae08){while(--_0x5cae08){_0x5de5db['push'](_0x5de5db['shift']());}};_0x45bb28(++_0x463a74);}(_0x0dec,0x11c));var _0xc0de=function(_0x1b2540,_0x197222){_0x1b2540=_0x1b2540-0x0;var _0x35dc3f=_0x0dec[_0x1b2540];return _0x35dc3f;};'use strict';var _=require(_0xc0de('0x0'));var util=require(_0xc0de('0x1'));var logger=require(_0xc0de('0x2'))(_0xc0de('0x3'));var moment=require('moment');var BPromise=require(_0xc0de('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc0de('0x5'));var config=require(_0xc0de('0x6'));var attributes=require(_0xc0de('0x7'));module[_0xc0de('0x8')]=function(_0xae49db,_0x194937){return _0xae49db[_0xc0de('0x9')](_0xc0de('0xa'),attributes,{'tableName':_0xc0de('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea03=['define','jscripty_projects','lodash','../../config/logger','api','moment','bluebird','request-promise','./jscriptyProject.attributes','exports'];(function(_0x2f1be4,_0x4e74a1){var _0x279872=function(_0x328e7a){while(--_0x328e7a){_0x2f1be4['push'](_0x2f1be4['shift']());}};_0x279872(++_0x4e74a1);}(_0xea03,0x1ba));var _0x3ea0=function(_0x1e1f17,_0x4bd574){_0x1e1f17=_0x1e1f17-0x0;var _0x465b52=_0xea03[_0x1e1f17];return _0x465b52;};'use strict';var _=require(_0x3ea0('0x0'));var util=require('util');var logger=require(_0x3ea0('0x1'))(_0x3ea0('0x2'));var moment=require(_0x3ea0('0x3'));var BPromise=require(_0x3ea0('0x4'));var rp=require(_0x3ea0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3ea0('0x6'));module[_0x3ea0('0x7')]=function(_0x266966,_0xed8a4b){return _0x266966[_0x3ea0('0x8')]('JscriptyProject',attributes,{'tableName':_0x3ea0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 3a52742..4cbc017 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 _0xda3f=['rpc','jayson/promise','client','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x48c2ae,_0x4cea90){var _0x8f7531=function(_0x126458){while(--_0x126458){_0x48c2ae['push'](_0x48c2ae['shift']());}};_0x8f7531(++_0x4cea90);}(_0xda3f,0xec));var _0xfda3=function(_0x86d4f,_0x162d39){_0x86d4f=_0x86d4f-0x0;var _0x519ea3=_0xda3f[_0x86d4f];return _0x519ea3;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file +var _0xf4eb=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1786a6,_0x134d37){var _0x560522=function(_0x3bae23){while(--_0x3bae23){_0x1786a6['push'](_0x1786a6['shift']());}};_0x560522(++_0x134d37);}(_0xf4eb,0xec));var _0xbf4e=function(_0x51138f,_0xade054){_0x51138f=_0x51138f-0x0;var _0x4fed43=_0xf4eb[_0x51138f];return _0x4fed43;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 9a9eb95..77bc3a0 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 _0x2274=['post','put','update','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x3aea55,_0x307b32){var _0x223dc1=function(_0x5a006f){while(--_0x5a006f){_0x3aea55['push'](_0x3aea55['shift']());}};_0x223dc1(++_0x307b32);}(_0x2274,0x15b));var _0x4227=function(_0x4847de,_0x183488){_0x4847de=_0x4847de-0x0;var _0x1fca70=_0x2274[_0x4847de];return _0x1fca70;};'use strict';var multer=require('multer');var util=require(_0x4227('0x0'));var path=require('path');var timeout=require(_0x4227('0x1'));var express=require(_0x4227('0x2'));var router=express[_0x4227('0x3')]();var fs_extra=require(_0x4227('0x4'));var auth=require(_0x4227('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4227('0x6'));var controller=require(_0x4227('0x7'));router[_0x4227('0x8')]('/',auth[_0x4227('0x9')](),controller[_0x4227('0xa')]);router[_0x4227('0x8')](_0x4227('0xb'),auth[_0x4227('0x9')](),controller[_0x4227('0xc')]);router[_0x4227('0x8')](_0x4227('0xd'),auth[_0x4227('0x9')](),controller['show']);router[_0x4227('0xe')]('/',auth[_0x4227('0x9')](),controller['create']);router[_0x4227('0xf')](_0x4227('0xd'),auth[_0x4227('0x9')](),controller[_0x4227('0x10')]);router[_0x4227('0x11')]('/:id',auth[_0x4227('0x9')](),controller['destroy']);module[_0x4227('0x12')]=router; \ No newline at end of file +var _0x93fa=['Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','/describe','show','create','put','/:id','update','delete','exports','multer','util','connect-timeout','express'];(function(_0x254825,_0x548cb5){var _0x45998e=function(_0x6f1b8c){while(--_0x6f1b8c){_0x254825['push'](_0x254825['shift']());}};_0x45998e(++_0x548cb5);}(_0x93fa,0x12c));var _0xa93f=function(_0x263cfa,_0x443531){_0x263cfa=_0x263cfa-0x0;var _0x14b8ec=_0x93fa[_0x263cfa];return _0x14b8ec;};'use strict';var multer=require(_0xa93f('0x0'));var util=require(_0xa93f('0x1'));var path=require('path');var timeout=require(_0xa93f('0x2'));var express=require(_0xa93f('0x3'));var router=express[_0xa93f('0x4')]();var fs_extra=require(_0xa93f('0x5'));var auth=require(_0xa93f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa93f('0x7'));var controller=require(_0xa93f('0x8'));router[_0xa93f('0x9')]('/',auth[_0xa93f('0xa')](),controller['index']);router[_0xa93f('0x9')](_0xa93f('0xb'),auth[_0xa93f('0xa')](),controller['describe']);router[_0xa93f('0x9')]('/:id',auth[_0xa93f('0xa')](),controller[_0xa93f('0xc')]);router['post']('/',auth[_0xa93f('0xa')](),controller[_0xa93f('0xd')]);router[_0xa93f('0xe')](_0xa93f('0xf'),auth['isAuthenticated'](),controller[_0xa93f('0x10')]);router[_0xa93f('0x11')](_0xa93f('0xf'),auth[_0xa93f('0xa')](),controller['destroy']);module[_0xa93f('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 268d691..d5650e4 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(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x7a54,0x106));var _0x47a5=function(_0x5ee00b,_0x5dfd5a){_0x5ee00b=_0x5ee00b-0x0;var _0x5b8803=_0x7a54[_0x5ee00b];return _0x5b8803;};'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(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x7a54,0x106));var _0x47a5=function(_0x1e7b4f,_0x488c7e){_0x1e7b4f=_0x1e7b4f-0x0;var _0x1ca608=_0x7a54[_0x1e7b4f];return _0x1ca608;};'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 be4c834..c8f676b 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 _0x0b0e=['merge','where','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','include','find','create','body','params','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter'];(function(_0x224dc0,_0x1af23b){var _0x44f86e=function(_0x52cb97){while(--_0x52cb97){_0x224dc0['push'](_0x224dc0['shift']());}};_0x44f86e(++_0x1af23b);}(_0x0b0e,0x187));var _0xe0b0=function(_0xc82d1a,_0x145c50){_0xc82d1a=_0xc82d1a-0x0;var _0x32fad2=_0x0b0e[_0xc82d1a];return _0x32fad2;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['JscriptyQuestionReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'all':!![]}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x41')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x402a0e){_0x36d137[_0xe0b0('0x42')]=_0x402a0e;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))[_0xe0b0('0x43')](handleError(_0x5b7a64,null));};exports[_0xe0b0('0x44')]=function(_0x52ffe4,_0x2aad80){var _0x309bbf={'raw':!![],'where':{'id':_0x52ffe4['params']['id']}},_0x528818={};_0x528818[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db['JscriptyQuestionReport'][_0xe0b0('0x2b')]);_0x528818[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x52ffe4[_0xe0b0('0x2e')]);_0x528818[_0xe0b0('0x39')]=_['intersection'](_0x528818['model'],_0x528818['query']);_0x309bbf[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x528818['model'],qs[_0xe0b0('0x33')](_0x52ffe4[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x309bbf[_0xe0b0('0x32')]=_0x309bbf[_0xe0b0('0x32')]['length']?_0x309bbf['attributes']:_0x528818[_0xe0b0('0x31')];if(_0x52ffe4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x309bbf[_0xe0b0('0x45')]=[{'all':!![]}];}_0x309bbf=_[_0xe0b0('0x3b')]({},_0x309bbf,_0x52ffe4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x46')](_0x309bbf)['then'](handleEntityNotFound(_0x2aad80,null))['then'](respondWithResult(_0x2aad80,null))['catch'](handleError(_0x2aad80,null));};exports[_0xe0b0('0x47')]=function(_0x2184d3,_0x2419ce){return db[_0xe0b0('0x2a')]['create'](_0x2184d3[_0xe0b0('0x48')],{})[_0xe0b0('0x23')](respondWithResult(_0x2419ce,0xc9))['catch'](handleError(_0x2419ce,null));};exports['update']=function(_0x2365be,_0x1bc6e0){if(_0x2365be['body']['id']){delete _0x2365be[_0xe0b0('0x48')]['id'];}return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x2365be['params']['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x1bc6e0,null))['then'](saveUpdates(_0x2365be[_0xe0b0('0x48')],null))[_0xe0b0('0x23')](respondWithResult(_0x1bc6e0,null))[_0xe0b0('0x43')](handleError(_0x1bc6e0,null));};exports[_0xe0b0('0x24')]=function(_0x19ee71,_0xf9e694){return db['JscriptyQuestionReport']['find']({'where':{'id':_0x19ee71[_0xe0b0('0x49')]['id']}})['then'](handleEntityNotFound(_0xf9e694,null))['then'](removeEntity(_0xf9e694,null))[_0xe0b0('0x43')](handleError(_0xf9e694,null));};exports[_0xe0b0('0x4a')]=function(_0x54cf7b,_0x4b65d1){return db[_0xe0b0('0x2a')][_0xe0b0('0x4a')]()[_0xe0b0('0x23')](respondWithResult(_0x4b65d1,null))[_0xe0b0('0x43')](handleError(_0x4b65d1,null));}; \ No newline at end of file +var _0x5843=['offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','include','create','body','find','catch','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count'];(function(_0x491eb2,_0x2bb130){var _0x4a1d09=function(_0x1aaf3f){while(--_0x1aaf3f){_0x491eb2['push'](_0x491eb2['shift']());}};_0x4a1d09(++_0x2bb130);}(_0x5843,0x107));var _0x3584=function(_0x336326,_0x390423){_0x336326=_0x336326-0x0;var _0x4a0853=_0x5843[_0x336326];return _0x4a0853;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3584('0x0'));var zipdir=require(_0x3584('0x1'));var jsonpatch=require(_0x3584('0x2'));var rp=require(_0x3584('0x3'));var moment=require(_0x3584('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3584('0x5'));var util=require(_0x3584('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x3584('0x7'));var ejs=require(_0x3584('0x8'));var fs=require('fs');var fs_extra=require(_0x3584('0x9'));var _=require(_0x3584('0xa'));var squel=require(_0x3584('0xb'));var crypto=require(_0x3584('0xc'));var jsforce=require(_0x3584('0xd'));var deskjs=require(_0x3584('0xe'));var toCsv=require(_0x3584('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3584('0xf'));var qs=require(_0x3584('0x10'));var as=require(_0x3584('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3584('0x12'))(_0x3584('0x13'));var utils=require('../../config/utils');var config=require(_0x3584('0x14'));var licenseUtil=require(_0x3584('0x15'));var db=require(_0x3584('0x16'))['db'];function respondWithStatusCode(_0x4464ac,_0x12d790){_0x12d790=_0x12d790||0xcc;return function(_0x23800f){if(_0x23800f){return _0x4464ac[_0x3584('0x17')](_0x12d790);}return _0x4464ac[_0x3584('0x18')](_0x12d790)[_0x3584('0x19')]();};}function respondWithResult(_0x2a66d9,_0x43a583){_0x43a583=_0x43a583||0xc8;return function(_0x4ece81){if(_0x4ece81){return _0x2a66d9[_0x3584('0x18')](_0x43a583)['json'](_0x4ece81);}};}function respondWithFilteredResult(_0x19d5a3,_0x135247){return function(_0x335f1e){if(_0x335f1e){var _0xdfc0a8=typeof _0x135247['offset']===_0x3584('0x1a')&&typeof _0x135247[_0x3584('0x1b')]===_0x3584('0x1a');var _0x2ed386=_0x335f1e[_0x3584('0x1c')];var _0x3438b6=_0xdfc0a8?0x0:_0x135247[_0x3584('0x1d')];var _0x23462f=_0xdfc0a8?_0x335f1e[_0x3584('0x1c')]:_0x135247[_0x3584('0x1d')]+_0x135247['limit'];var _0xa9d39e;if(_0x23462f>=_0x2ed386){_0x23462f=_0x2ed386;_0xa9d39e=0xc8;}else{_0xa9d39e=0xce;}_0x19d5a3[_0x3584('0x18')](_0xa9d39e);return _0x19d5a3[_0x3584('0x1e')]('Content-Range',_0x3438b6+'-'+_0x23462f+'/'+_0x2ed386)['json'](_0x335f1e);}return null;};}function patchUpdates(_0x1bc6e2){return function(_0x5b038e){try{jsonpatch[_0x3584('0x1f')](_0x5b038e,_0x1bc6e2,!![]);}catch(_0x166a31){return BPromise[_0x3584('0x20')](_0x166a31);}return _0x5b038e[_0x3584('0x21')]();};}function saveUpdates(_0xc3fede,_0x3cf3a8){return function(_0x25eff5){if(_0x25eff5){return _0x25eff5[_0x3584('0x22')](_0xc3fede)[_0x3584('0x23')](function(_0x29c997){return _0x29c997;});}return null;};}function removeEntity(_0x123911,_0x33b6af){return function(_0x54d42d){if(_0x54d42d){return _0x54d42d[_0x3584('0x24')]()[_0x3584('0x23')](function(){_0x123911[_0x3584('0x18')](0xcc)[_0x3584('0x19')]();});}};}function handleEntityNotFound(_0x414b57,_0x113d40){return function(_0x2bffd8){if(!_0x2bffd8){_0x414b57[_0x3584('0x17')](0x194);}return _0x2bffd8;};}function handleError(_0x403939,_0x24255f){_0x24255f=_0x24255f||0x1f4;return function(_0x48b9e4){logger[_0x3584('0x25')](_0x48b9e4[_0x3584('0x26')]);if(_0x48b9e4[_0x3584('0x27')]){delete _0x48b9e4[_0x3584('0x27')];}_0x403939[_0x3584('0x18')](_0x24255f)[_0x3584('0x28')](_0x48b9e4);};}exports[_0x3584('0x29')]=function(_0x3ab41e,_0x9dabe9){var _0x2a1158={},_0x39b557={},_0x50fd71={'count':0x0,'rows':[]};var _0x4e3acb=_[_0x3584('0x2a')](db[_0x3584('0x2b')][_0x3584('0x2c')],function(_0x1e8442){return{'name':_0x1e8442['fieldName'],'type':_0x1e8442[_0x3584('0x2d')]['key']};});_0x39b557[_0x3584('0x2e')]=_[_0x3584('0x2a')](_0x4e3acb,'name');_0x39b557['query']=_[_0x3584('0x2f')](_0x3ab41e[_0x3584('0x30')]);_0x39b557['filters']=_[_0x3584('0x31')](_0x39b557[_0x3584('0x2e')],_0x39b557['query']);_0x2a1158[_0x3584('0x32')]=_[_0x3584('0x31')](_0x39b557[_0x3584('0x2e')],qs['fields'](_0x3ab41e[_0x3584('0x30')][_0x3584('0x33')]));_0x2a1158[_0x3584('0x32')]=_0x2a1158[_0x3584('0x32')][_0x3584('0x34')]?_0x2a1158[_0x3584('0x32')]:_0x39b557[_0x3584('0x2e')];if(!_0x3ab41e[_0x3584('0x30')][_0x3584('0x35')](_0x3584('0x36'))){_0x2a1158[_0x3584('0x1b')]=qs['limit'](_0x3ab41e[_0x3584('0x30')]['limit']);_0x2a1158[_0x3584('0x1d')]=qs[_0x3584('0x1d')](_0x3ab41e[_0x3584('0x30')][_0x3584('0x1d')]);}_0x2a1158['order']=qs[_0x3584('0x37')](_0x3ab41e['query']['sort']);_0x2a1158[_0x3584('0x38')]=qs[_0x3584('0x39')](_['pick'](_0x3ab41e[_0x3584('0x30')],_0x39b557['filters']),_0x4e3acb);if(_0x3ab41e[_0x3584('0x30')]['filter']){_0x2a1158[_0x3584('0x38')]=_[_0x3584('0x3a')](_0x2a1158['where'],{'$or':_[_0x3584('0x2a')](_0x4e3acb,function(_0x1c1078){if(_0x1c1078[_0x3584('0x2d')]!==_0x3584('0x3b')){var _0xae262c={};_0xae262c[_0x1c1078[_0x3584('0x27')]]={'$like':'%'+_0x3ab41e[_0x3584('0x30')][_0x3584('0x3c')]+'%'};return _0xae262c;}})});}_0x2a1158=_[_0x3584('0x3a')]({},_0x2a1158,_0x3ab41e[_0x3584('0x3d')]);var _0x5cbe7f={'where':_0x2a1158['where']};return db[_0x3584('0x2b')][_0x3584('0x1c')](_0x5cbe7f)['then'](function(_0x9ec448){_0x50fd71['count']=_0x9ec448;if(_0x3ab41e[_0x3584('0x30')][_0x3584('0x3e')]){_0x2a1158['include']=[{'all':!![]}];}return db[_0x3584('0x2b')][_0x3584('0x3f')](_0x2a1158);})[_0x3584('0x23')](function(_0x37183b){_0x50fd71[_0x3584('0x40')]=_0x37183b;return _0x50fd71;})[_0x3584('0x23')](respondWithFilteredResult(_0x9dabe9,_0x2a1158))['catch'](handleError(_0x9dabe9,null));};exports[_0x3584('0x41')]=function(_0x47fd99,_0x4f588c){var _0x3b0249={'raw':!![],'where':{'id':_0x47fd99[_0x3584('0x42')]['id']}},_0x433da0={};_0x433da0[_0x3584('0x2e')]=_[_0x3584('0x2f')](db['JscriptyQuestionReport']['rawAttributes']);_0x433da0[_0x3584('0x30')]=_[_0x3584('0x2f')](_0x47fd99[_0x3584('0x30')]);_0x433da0[_0x3584('0x39')]=_[_0x3584('0x31')](_0x433da0[_0x3584('0x2e')],_0x433da0['query']);_0x3b0249['attributes']=_[_0x3584('0x31')](_0x433da0[_0x3584('0x2e')],qs[_0x3584('0x33')](_0x47fd99[_0x3584('0x30')][_0x3584('0x33')]));_0x3b0249[_0x3584('0x32')]=_0x3b0249[_0x3584('0x32')][_0x3584('0x34')]?_0x3b0249[_0x3584('0x32')]:_0x433da0[_0x3584('0x2e')];if(_0x47fd99[_0x3584('0x30')][_0x3584('0x3e')]){_0x3b0249[_0x3584('0x43')]=[{'all':!![]}];}_0x3b0249=_[_0x3584('0x3a')]({},_0x3b0249,_0x47fd99['options']);return db[_0x3584('0x2b')]['find'](_0x3b0249)[_0x3584('0x23')](handleEntityNotFound(_0x4f588c,null))[_0x3584('0x23')](respondWithResult(_0x4f588c,null))['catch'](handleError(_0x4f588c,null));};exports['create']=function(_0x260e44,_0xba1f35){return db[_0x3584('0x2b')][_0x3584('0x44')](_0x260e44['body'],{})[_0x3584('0x23')](respondWithResult(_0xba1f35,0xc9))['catch'](handleError(_0xba1f35,null));};exports['update']=function(_0x1b775b,_0x4dc9c0){if(_0x1b775b['body']['id']){delete _0x1b775b[_0x3584('0x45')]['id'];}return db[_0x3584('0x2b')][_0x3584('0x46')]({'where':{'id':_0x1b775b[_0x3584('0x42')]['id']}})[_0x3584('0x23')](handleEntityNotFound(_0x4dc9c0,null))[_0x3584('0x23')](saveUpdates(_0x1b775b[_0x3584('0x45')],null))[_0x3584('0x23')](respondWithResult(_0x4dc9c0,null))[_0x3584('0x47')](handleError(_0x4dc9c0,null));};exports['destroy']=function(_0x424ab2,_0x5b8d2e){return db[_0x3584('0x2b')][_0x3584('0x46')]({'where':{'id':_0x424ab2[_0x3584('0x42')]['id']}})[_0x3584('0x23')](handleEntityNotFound(_0x5b8d2e,null))[_0x3584('0x23')](removeEntity(_0x5b8d2e,null))[_0x3584('0x47')](handleError(_0x5b8d2e,null));};exports[_0x3584('0x48')]=function(_0x4da280,_0x42ff2f){return db[_0x3584('0x2b')]['describe']()[_0x3584('0x23')](respondWithResult(_0x42ff2f,null))[_0x3584('0x47')](handleError(_0x42ff2f,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 8390f1d..006c0a9 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 _0x0985=['define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports'];(function(_0x59eefb,_0x2151ce){var _0x1a49e8=function(_0x5a758c){while(--_0x5a758c){_0x59eefb['push'](_0x59eefb['shift']());}};_0x1a49e8(++_0x2151ce);}(_0x0985,0x120));var _0x5098=function(_0x26108f,_0x14ff83){_0x26108f=_0x26108f-0x0;var _0x2de669=_0x0985[_0x26108f];return _0x2de669;};'use strict';var _=require(_0x5098('0x0'));var util=require(_0x5098('0x1'));var logger=require(_0x5098('0x2'))(_0x5098('0x3'));var moment=require(_0x5098('0x4'));var BPromise=require(_0x5098('0x5'));var rp=require(_0x5098('0x6'));var fs=require('fs');var path=require(_0x5098('0x7'));var rimraf=require(_0x5098('0x8'));var config=require(_0x5098('0x9'));var attributes=require(_0x5098('0xa'));module[_0x5098('0xb')]=function(_0x259154,_0x574cb6){return _0x259154[_0x5098('0xc')](_0x5098('0xd'),attributes,{'tableName':_0x5098('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x86d6=['define','JscriptyQuestionReport','report_jscripty_questions','util','../../config/logger','api','moment','path','../../config/environment','./jscriptyQuestionReport.attributes'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x86d6,0x7b));var _0x686d=function(_0x506eab,_0x2f6b63){_0x506eab=_0x506eab-0x0;var _0x479baa=_0x86d6[_0x506eab];return _0x479baa;};'use strict';var _=require('lodash');var util=require(_0x686d('0x0'));var logger=require(_0x686d('0x1'))(_0x686d('0x2'));var moment=require(_0x686d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x686d('0x4'));var rimraf=require('rimraf');var config=require(_0x686d('0x5'));var attributes=require(_0x686d('0x6'));module['exports']=function(_0x5d2bd4,_0x459c7e){return _0x5d2bd4[_0x686d('0x7')](_0x686d('0x8'),attributes,{'tableName':_0x686d('0x9'),'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 cf1119f..fd3229e 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 _0x1a29=['JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x2f3459,_0x5d65f){var _0x1f1c02=function(_0x39021d){while(--_0x39021d){_0x2f3459['push'](_0x2f3459['shift']());}};_0x1f1c02(++_0x5d65f);}(_0x1a29,0x12e));var _0x91a2=function(_0x5bede6,_0x46282e){_0x5bede6=_0x5bede6-0x0;var _0x266103=_0x1a29[_0x5bede6];return _0x266103;};'use strict';var _=require(_0x91a2('0x0'));var util=require('util');var moment=require(_0x91a2('0x1'));var BPromise=require(_0x91a2('0x2'));var rs=require(_0x91a2('0x3'));var fs=require('fs');var Redis=require(_0x91a2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x91a2('0x5'))(_0x91a2('0x6'));var config=require('../../config/environment');var jayson=require(_0x91a2('0x7'));var client=jayson[_0x91a2('0x8')][_0x91a2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19407b,_0x34d93a,_0x339ee1){return new BPromise(function(_0x452c6c,_0x9f9117){return client[_0x91a2('0xa')](_0x19407b,_0x339ee1)[_0x91a2('0xb')](function(_0xd91e45){logger[_0x91a2('0xc')](_0x91a2('0xd'),_0x34d93a,_0x91a2('0xe'));logger['debug'](_0x91a2('0xf'),_0x34d93a,_0x91a2('0xe'),JSON[_0x91a2('0x10')](_0xd91e45));if(_0xd91e45[_0x91a2('0x11')]){if(_0xd91e45[_0x91a2('0x11')][_0x91a2('0x12')]===0x1f4){logger[_0x91a2('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x34d93a,_0xd91e45['error'][_0x91a2('0x13')]);return _0x9f9117(_0xd91e45[_0x91a2('0x11')]['message']);}logger[_0x91a2('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x34d93a,_0xd91e45[_0x91a2('0x11')]['message']);return _0x452c6c(_0xd91e45[_0x91a2('0x11')][_0x91a2('0x13')]);}else{logger[_0x91a2('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x34d93a,'request\x20sent');_0x452c6c(_0xd91e45[_0x91a2('0x14')]['message']);}})['catch'](function(_0x2f808e){logger[_0x91a2('0x11')](_0x91a2('0xd'),_0x34d93a,_0x2f808e);_0x9f9117(_0x2f808e);});});} \ No newline at end of file +var _0x0759=['debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent'];(function(_0x18c297,_0x2aa97f){var _0x2360b0=function(_0x53507c){while(--_0x53507c){_0x18c297['push'](_0x18c297['shift']());}};_0x2360b0(++_0x2aa97f);}(_0x0759,0x193));var _0x9075=function(_0x3ff3a7,_0x4fbee8){_0x3ff3a7=_0x3ff3a7-0x0;var _0x3c8937=_0x0759[_0x3ff3a7];return _0x3c8937;};'use strict';var _=require(_0x9075('0x0'));var util=require('util');var moment=require(_0x9075('0x1'));var BPromise=require(_0x9075('0x2'));var rs=require(_0x9075('0x3'));var fs=require('fs');var Redis=require(_0x9075('0x4'));var db=require(_0x9075('0x5'))['db'];var utils=require(_0x9075('0x6'));var logger=require(_0x9075('0x7'))(_0x9075('0x8'));var config=require(_0x9075('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9075('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x499a8c,_0x5888b1,_0x3a322c){return new BPromise(function(_0x1f0ae1,_0x3429b7){return client[_0x9075('0xb')](_0x499a8c,_0x3a322c)[_0x9075('0xc')](function(_0x2613dc){logger['info'](_0x9075('0xd'),_0x5888b1,_0x9075('0xe'));logger[_0x9075('0xf')](_0x9075('0x10'),_0x5888b1,_0x9075('0xe'),JSON[_0x9075('0x11')](_0x2613dc));if(_0x2613dc[_0x9075('0x12')]){if(_0x2613dc[_0x9075('0x12')]['code']===0x1f4){logger[_0x9075('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5888b1,_0x2613dc[_0x9075('0x12')][_0x9075('0x13')]);return _0x3429b7(_0x2613dc[_0x9075('0x12')]['message']);}logger['error'](_0x9075('0xd'),_0x5888b1,_0x2613dc[_0x9075('0x12')][_0x9075('0x13')]);return _0x1f0ae1(_0x2613dc['error']['message']);}else{logger[_0x9075('0x14')](_0x9075('0xd'),_0x5888b1,_0x9075('0xe'));_0x1f0ae1(_0x2613dc[_0x9075('0x15')][_0x9075('0x13')]);}})['catch'](function(_0x30051e){logger[_0x9075('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5888b1,_0x30051e);_0x3429b7(_0x30051e);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 5b24ffd..5d955c4 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 _0x312e=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','/describe','isAuthenticated','/:id','/:id/questions','getQuestions','post','create','update','destroy','exports','multer','util','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x312e,0x10e));var _0xe312=function(_0x47762e,_0x38ae71){_0x47762e=_0x47762e-0x0;var _0x5c783c=_0x312e[_0x47762e];return _0x5c783c;};'use strict';var multer=require(_0xe312('0x0'));var util=require(_0xe312('0x1'));var path=require(_0xe312('0x2'));var timeout=require(_0xe312('0x3'));var express=require('express');var router=express[_0xe312('0x4')]();var fs_extra=require(_0xe312('0x5'));var auth=require(_0xe312('0x6'));var interaction=require(_0xe312('0x7'));var config=require(_0xe312('0x8'));var controller=require(_0xe312('0x9'));router[_0xe312('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe312('0xa')](_0xe312('0xb'),auth[_0xe312('0xc')](),controller['describe']);router[_0xe312('0xa')](_0xe312('0xd'),auth[_0xe312('0xc')](),controller['show']);router[_0xe312('0xa')](_0xe312('0xe'),auth[_0xe312('0xc')](),controller[_0xe312('0xf')]);router[_0xe312('0x10')]('/',auth['isAuthenticated'](),controller[_0xe312('0x11')]);router['put'](_0xe312('0xd'),auth[_0xe312('0xc')](),controller[_0xe312('0x12')]);router['delete'](_0xe312('0xd'),auth[_0xe312('0xc')](),controller[_0xe312('0x13')]);module[_0xe312('0x14')]=router; \ No newline at end of file +var _0x2cd6=['put','update','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/questions','getQuestions','post','create'];(function(_0x27a526,_0x3f0efb){var _0x23afbb=function(_0x1f8281){while(--_0x1f8281){_0x27a526['push'](_0x27a526['shift']());}};_0x23afbb(++_0x3f0efb);}(_0x2cd6,0x9d));var _0x62cd=function(_0x491a44,_0x2273cb){_0x491a44=_0x491a44-0x0;var _0x862a99=_0x2cd6[_0x491a44];return _0x862a99;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x62cd('0x0'));var express=require(_0x62cd('0x1'));var router=express[_0x62cd('0x2')]();var fs_extra=require(_0x62cd('0x3'));var auth=require(_0x62cd('0x4'));var interaction=require(_0x62cd('0x5'));var config=require(_0x62cd('0x6'));var controller=require(_0x62cd('0x7'));router[_0x62cd('0x8')]('/',auth['isAuthenticated'](),controller[_0x62cd('0x9')]);router[_0x62cd('0x8')](_0x62cd('0xa'),auth[_0x62cd('0xb')](),controller[_0x62cd('0xc')]);router[_0x62cd('0x8')](_0x62cd('0xd'),auth[_0x62cd('0xb')](),controller[_0x62cd('0xe')]);router[_0x62cd('0x8')](_0x62cd('0xf'),auth['isAuthenticated'](),controller[_0x62cd('0x10')]);router[_0x62cd('0x11')]('/',auth[_0x62cd('0xb')](),controller[_0x62cd('0x12')]);router[_0x62cd('0x13')](_0x62cd('0xd'),auth[_0x62cd('0xb')](),controller[_0x62cd('0x14')]);router['delete'](_0x62cd('0xd'),auth[_0x62cd('0xb')](),controller['destroy']);module[_0x62cd('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 8e9dc1e..b84f744 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 _0xad52=['moment','sequelize','exports','DATE','starttime','setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN'];(function(_0x18527e,_0x4a0e19){var _0x18119e=function(_0x112076){while(--_0x112076){_0x18527e['push'](_0x18527e['shift']());}};_0x18119e(++_0x4a0e19);}(_0xad52,0x1e4));var _0x2ad5=function(_0x1bc70b,_0x1ff32f){_0x1bc70b=_0x1bc70b-0x0;var _0x21e350=_0xad52[_0x1bc70b];return _0x21e350;};'use strict';var moment=require(_0x2ad5('0x0'));var Sequelize=require(_0x2ad5('0x1'));module[_0x2ad5('0x2')]={'starttime':{'type':Sequelize[_0x2ad5('0x3')],'set':function(_0x5833dc){this['setDataValue'](_0x2ad5('0x4'),_0x5833dc);this[_0x2ad5('0x5')](_0x2ad5('0x6'),moment()[_0x2ad5('0x7')](_0x2ad5('0x8')));}},'endtime':{'type':Sequelize[_0x2ad5('0x3')]},'membername':{'type':Sequelize[_0x2ad5('0x9')]},'projectname':{'type':Sequelize[_0x2ad5('0x9')]},'queue':{'type':Sequelize[_0x2ad5('0x9')]},'uniqueid':{'type':Sequelize[_0x2ad5('0x9')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x2ad5('0xa')],'defaultValue':![]}}; \ No newline at end of file +var _0xd7be=['format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue','endtime'];(function(_0x3c4a7c,_0x2f4e3c){var _0xf13d1e=function(_0x24cb78){while(--_0x24cb78){_0x3c4a7c['push'](_0x3c4a7c['shift']());}};_0xf13d1e(++_0x2f4e3c);}(_0xd7be,0x68));var _0xed7b=function(_0x5b8cf9,_0x40d8cc){_0x5b8cf9=_0x5b8cf9-0x0;var _0x55fc6d=_0xd7be[_0x5b8cf9];return _0x55fc6d;};'use strict';var moment=require(_0xed7b('0x0'));var Sequelize=require(_0xed7b('0x1'));module[_0xed7b('0x2')]={'starttime':{'type':Sequelize[_0xed7b('0x3')],'set':function(_0x238d1a){this[_0xed7b('0x4')]('starttime',_0x238d1a);this[_0xed7b('0x4')](_0xed7b('0x5'),moment()[_0xed7b('0x6')](_0xed7b('0x7')));}},'endtime':{'type':Sequelize[_0xed7b('0x3')]},'membername':{'type':Sequelize[_0xed7b('0x8')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xed7b('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xed7b('0x8')]},'calleridnum':{'type':Sequelize[_0xed7b('0x8')]},'completed':{'type':Sequelize[_0xed7b('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 9200a9f..095b011 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 _0x9b06=['end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','map','JscriptySessionReport','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','options','find','catch','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x5648e9,_0x3e9e97){var _0x456cfe=function(_0x54bc5b){while(--_0x54bc5b){_0x5648e9['push'](_0x5648e9['shift']());}};_0x456cfe(++_0x3e9e97);}(_0x9b06,0xd6));var _0x69b0=function(_0x1899a2,_0x58aabf){_0x1899a2=_0x1899a2-0x0;var _0x528f1f=_0x9b06[_0x1899a2];return _0x528f1f;};'use strict';var emlformat=require(_0x69b0('0x0'));var rimraf=require(_0x69b0('0x1'));var zipdir=require(_0x69b0('0x2'));var jsonpatch=require(_0x69b0('0x3'));var rp=require('request-promise');var moment=require(_0x69b0('0x4'));var BPromise=require(_0x69b0('0x5'));var Mustache=require(_0x69b0('0x6'));var util=require('util');var path=require(_0x69b0('0x7'));var sox=require(_0x69b0('0x8'));var csv=require('to-csv');var ejs=require(_0x69b0('0x9'));var fs=require('fs');var fs_extra=require(_0x69b0('0xa'));var _=require(_0x69b0('0xb'));var squel=require(_0x69b0('0xc'));var crypto=require(_0x69b0('0xd'));var jsforce=require(_0x69b0('0xe'));var deskjs=require(_0x69b0('0xf'));var toCsv=require(_0x69b0('0x10'));var querystring=require(_0x69b0('0x11'));var Papa=require(_0x69b0('0x12'));var Redis=require(_0x69b0('0x13'));var authService=require(_0x69b0('0x14'));var qs=require(_0x69b0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x69b0('0x16'));var logger=require(_0x69b0('0x17'))('api');var utils=require(_0x69b0('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x69b0('0x19'));var db=require(_0x69b0('0x1a'))['db'];function respondWithStatusCode(_0x1f20bf,_0x18ea1c){_0x18ea1c=_0x18ea1c||0xcc;return function(_0x1f35ba){if(_0x1f35ba){return _0x1f20bf[_0x69b0('0x1b')](_0x18ea1c);}return _0x1f20bf[_0x69b0('0x1c')](_0x18ea1c)[_0x69b0('0x1d')]();};}function respondWithResult(_0x639773,_0x294541){_0x294541=_0x294541||0xc8;return function(_0x5cb117){if(_0x5cb117){return _0x639773['status'](_0x294541)[_0x69b0('0x1e')](_0x5cb117);}};}function respondWithFilteredResult(_0x463432,_0xbbddd0){return function(_0x11c723){if(_0x11c723){var _0x30cff2=typeof _0xbbddd0[_0x69b0('0x1f')]===_0x69b0('0x20')&&typeof _0xbbddd0[_0x69b0('0x21')]===_0x69b0('0x20');var _0x3b5568=_0x11c723[_0x69b0('0x22')];var _0x250e39=_0x30cff2?0x0:_0xbbddd0[_0x69b0('0x1f')];var _0x252831=_0x30cff2?_0x11c723[_0x69b0('0x22')]:_0xbbddd0['offset']+_0xbbddd0['limit'];var _0x641f3b;if(_0x252831>=_0x3b5568){_0x252831=_0x3b5568;_0x641f3b=0xc8;}else{_0x641f3b=0xce;}_0x463432[_0x69b0('0x1c')](_0x641f3b);return _0x463432[_0x69b0('0x23')](_0x69b0('0x24'),_0x250e39+'-'+_0x252831+'/'+_0x3b5568)[_0x69b0('0x1e')](_0x11c723);}return null;};}function patchUpdates(_0x3332be){return function(_0x373b7e){try{jsonpatch[_0x69b0('0x25')](_0x373b7e,_0x3332be,!![]);}catch(_0x31138f){return BPromise['reject'](_0x31138f);}return _0x373b7e['save']();};}function saveUpdates(_0x2561e4,_0x1abc39){return function(_0x64ce32){if(_0x64ce32){return _0x64ce32[_0x69b0('0x26')](_0x2561e4)[_0x69b0('0x27')](function(_0x3eb622){return _0x3eb622;});}return null;};}function removeEntity(_0x292f4d,_0x5c07bd){return function(_0x5a41f0){if(_0x5a41f0){return _0x5a41f0[_0x69b0('0x28')]()['then'](function(){_0x292f4d['status'](0xcc)[_0x69b0('0x1d')]();});}};}function handleEntityNotFound(_0x4f4659,_0x48fc16){return function(_0x148030){if(!_0x148030){_0x4f4659[_0x69b0('0x1b')](0x194);}return _0x148030;};}function handleError(_0x2cd106,_0x276ede){_0x276ede=_0x276ede||0x1f4;return function(_0x4c16ff){logger[_0x69b0('0x29')](_0x4c16ff[_0x69b0('0x2a')]);if(_0x4c16ff[_0x69b0('0x2b')]){delete _0x4c16ff[_0x69b0('0x2b')];}_0x2cd106[_0x69b0('0x1c')](_0x276ede)[_0x69b0('0x2c')](_0x4c16ff);};}exports['index']=function(_0x505337,_0x5c43ea){var _0x42cdcd={},_0x206f2d={},_0x39c0a5={'count':0x0,'rows':[]};var _0x234a78=_[_0x69b0('0x2d')](db[_0x69b0('0x2e')][_0x69b0('0x2f')],function(_0x549337){return{'name':_0x549337['fieldName'],'type':_0x549337[_0x69b0('0x30')][_0x69b0('0x31')]};});_0x206f2d[_0x69b0('0x32')]=_[_0x69b0('0x2d')](_0x234a78,'name');_0x206f2d[_0x69b0('0x33')]=_[_0x69b0('0x34')](_0x505337[_0x69b0('0x33')]);_0x206f2d['filters']=_[_0x69b0('0x35')](_0x206f2d[_0x69b0('0x32')],_0x206f2d[_0x69b0('0x33')]);_0x42cdcd[_0x69b0('0x36')]=_[_0x69b0('0x35')](_0x206f2d[_0x69b0('0x32')],qs[_0x69b0('0x37')](_0x505337[_0x69b0('0x33')][_0x69b0('0x37')]));_0x42cdcd[_0x69b0('0x36')]=_0x42cdcd[_0x69b0('0x36')][_0x69b0('0x38')]?_0x42cdcd[_0x69b0('0x36')]:_0x206f2d[_0x69b0('0x32')];if(!_0x505337[_0x69b0('0x33')][_0x69b0('0x39')](_0x69b0('0x3a'))){_0x42cdcd[_0x69b0('0x21')]=qs[_0x69b0('0x21')](_0x505337['query']['limit']);_0x42cdcd[_0x69b0('0x1f')]=qs[_0x69b0('0x1f')](_0x505337[_0x69b0('0x33')][_0x69b0('0x1f')]);}_0x42cdcd[_0x69b0('0x3b')]=qs[_0x69b0('0x3c')](_0x505337[_0x69b0('0x33')][_0x69b0('0x3c')]);_0x42cdcd[_0x69b0('0x3d')]=qs[_0x69b0('0x3e')](_[_0x69b0('0x3f')](_0x505337[_0x69b0('0x33')],_0x206f2d[_0x69b0('0x3e')]),_0x234a78);if(_0x505337[_0x69b0('0x33')][_0x69b0('0x40')]){_0x42cdcd['where']=_[_0x69b0('0x41')](_0x42cdcd[_0x69b0('0x3d')],{'$or':_['map'](_0x234a78,function(_0x553c7e){if(_0x553c7e['type']!==_0x69b0('0x42')){var _0x1bd276={};_0x1bd276[_0x553c7e['name']]={'$like':'%'+_0x505337[_0x69b0('0x33')][_0x69b0('0x40')]+'%'};return _0x1bd276;}})});}_0x42cdcd=_['merge']({},_0x42cdcd,_0x505337['options']);var _0xf94cf9={'where':_0x42cdcd[_0x69b0('0x3d')]};return db[_0x69b0('0x2e')]['count'](_0xf94cf9)[_0x69b0('0x27')](function(_0x2ca07a){_0x39c0a5['count']=_0x2ca07a;if(_0x505337[_0x69b0('0x33')][_0x69b0('0x43')]){_0x42cdcd[_0x69b0('0x44')]=[{'all':!![]}];}return db[_0x69b0('0x2e')][_0x69b0('0x45')](_0x42cdcd);})[_0x69b0('0x27')](function(_0x46614a){_0x39c0a5[_0x69b0('0x46')]=_0x46614a;return _0x39c0a5;})[_0x69b0('0x27')](respondWithFilteredResult(_0x5c43ea,_0x42cdcd))['catch'](handleError(_0x5c43ea,null));};exports['show']=function(_0x43e8f3,_0x521e25){var _0xd241b9={'raw':!![],'where':{'id':_0x43e8f3[_0x69b0('0x47')]['id']}},_0x5c12e3={};_0x5c12e3[_0x69b0('0x32')]=_['keys'](db['JscriptySessionReport'][_0x69b0('0x2f')]);_0x5c12e3[_0x69b0('0x33')]=_[_0x69b0('0x34')](_0x43e8f3[_0x69b0('0x33')]);_0x5c12e3[_0x69b0('0x3e')]=_[_0x69b0('0x35')](_0x5c12e3[_0x69b0('0x32')],_0x5c12e3[_0x69b0('0x33')]);_0xd241b9['attributes']=_[_0x69b0('0x35')](_0x5c12e3[_0x69b0('0x32')],qs['fields'](_0x43e8f3[_0x69b0('0x33')][_0x69b0('0x37')]));_0xd241b9[_0x69b0('0x36')]=_0xd241b9['attributes'][_0x69b0('0x38')]?_0xd241b9['attributes']:_0x5c12e3[_0x69b0('0x32')];if(_0x43e8f3['query'][_0x69b0('0x43')]){_0xd241b9[_0x69b0('0x44')]=[{'all':!![]}];}_0xd241b9=_[_0x69b0('0x41')]({},_0xd241b9,_0x43e8f3[_0x69b0('0x48')]);return db[_0x69b0('0x2e')][_0x69b0('0x49')](_0xd241b9)[_0x69b0('0x27')](handleEntityNotFound(_0x521e25,null))[_0x69b0('0x27')](respondWithResult(_0x521e25,null))[_0x69b0('0x4a')](handleError(_0x521e25,null));};exports['create']=function(_0x3f2994,_0x5bb2b0){return db[_0x69b0('0x2e')][_0x69b0('0x4b')](_0x3f2994[_0x69b0('0x4c')],{})[_0x69b0('0x27')](respondWithResult(_0x5bb2b0,0xc9))[_0x69b0('0x4a')](handleError(_0x5bb2b0,null));};exports['update']=function(_0x4257e7,_0x174ea9){if(_0x4257e7[_0x69b0('0x4c')]['id']){delete _0x4257e7[_0x69b0('0x4c')]['id'];}return db[_0x69b0('0x2e')][_0x69b0('0x49')]({'where':{'id':_0x4257e7[_0x69b0('0x47')]['id']}})[_0x69b0('0x27')](handleEntityNotFound(_0x174ea9,null))[_0x69b0('0x27')](saveUpdates(_0x4257e7[_0x69b0('0x4c')],null))[_0x69b0('0x27')](respondWithResult(_0x174ea9,null))[_0x69b0('0x4a')](handleError(_0x174ea9,null));};exports['destroy']=function(_0x1e765d,_0x4618a2){return db[_0x69b0('0x2e')][_0x69b0('0x49')]({'where':{'id':_0x1e765d[_0x69b0('0x47')]['id']}})[_0x69b0('0x27')](handleEntityNotFound(_0x4618a2,null))[_0x69b0('0x27')](removeEntity(_0x4618a2,null))[_0x69b0('0x4a')](handleError(_0x4618a2,null));};exports[_0x69b0('0x4d')]=function(_0x2366e5,_0x14cd99){return db['JscriptySessionReport'][_0x69b0('0x4d')]()[_0x69b0('0x27')](respondWithResult(_0x14cd99,null))[_0x69b0('0x4a')](handleError(_0x14cd99,null));};exports[_0x69b0('0x4e')]=function(_0x5d7b68,_0x4a4db1,_0x167b9c){var _0x22c5c5={'raw':!![],'where':{}};var _0xaeca0e={};var _0x9c5149={'count':0x0,'rows':[]};return db[_0x69b0('0x2e')][_0x69b0('0x4f')]({'where':{'id':_0x5d7b68[_0x69b0('0x47')]['id']}})[_0x69b0('0x27')](handleEntityNotFound(_0x4a4db1,null))[_0x69b0('0x27')](function(_0x3b5f6b){if(_0x3b5f6b){_0xaeca0e[_0x69b0('0x32')]=_['keys'](db[_0x69b0('0x50')][_0x69b0('0x2f')]);_0xaeca0e['query']=_[_0x69b0('0x34')](_0x5d7b68[_0x69b0('0x33')]);_0xaeca0e[_0x69b0('0x3e')]=_[_0x69b0('0x35')](_0xaeca0e[_0x69b0('0x32')],_0xaeca0e[_0x69b0('0x33')]);_0x22c5c5[_0x69b0('0x36')]=_[_0x69b0('0x35')](_0xaeca0e[_0x69b0('0x32')],qs[_0x69b0('0x37')](_0x5d7b68[_0x69b0('0x33')][_0x69b0('0x37')]));_0x22c5c5[_0x69b0('0x36')]=_0x22c5c5[_0x69b0('0x36')][_0x69b0('0x38')]?_0x22c5c5[_0x69b0('0x36')]:_0xaeca0e[_0x69b0('0x32')];if(!_0x5d7b68[_0x69b0('0x33')][_0x69b0('0x39')](_0x69b0('0x3a'))){_0x22c5c5[_0x69b0('0x21')]=qs[_0x69b0('0x21')](_0x5d7b68[_0x69b0('0x33')][_0x69b0('0x21')]);_0x22c5c5[_0x69b0('0x1f')]=qs[_0x69b0('0x1f')](_0x5d7b68[_0x69b0('0x33')][_0x69b0('0x1f')]);}_0x22c5c5['order']=qs[_0x69b0('0x3c')](_0x5d7b68[_0x69b0('0x33')][_0x69b0('0x3c')]);_0x22c5c5[_0x69b0('0x3d')]=qs['filters'](_[_0x69b0('0x3f')](_0x5d7b68[_0x69b0('0x33')],_0xaeca0e['filters']));_0x22c5c5[_0x69b0('0x3d')]['SessionId']=_0x3b5f6b['id'];if(_0x5d7b68[_0x69b0('0x33')][_0x69b0('0x40')]){_0x22c5c5[_0x69b0('0x3d')]=_[_0x69b0('0x41')](_0x22c5c5['where'],{'$or':_[_0x69b0('0x2d')](_0x22c5c5[_0x69b0('0x36')],function(_0x1df642){var _0x4b388f={};_0x4b388f[_0x1df642]={'$like':'%'+_0x5d7b68[_0x69b0('0x33')][_0x69b0('0x40')]+'%'};return _0x4b388f;})});}_0x22c5c5=_[_0x69b0('0x41')]({},_0x22c5c5,_0x5d7b68['options']);return db[_0x69b0('0x50')][_0x69b0('0x22')]({'where':_0x22c5c5[_0x69b0('0x3d')]})['then'](function(_0x4dabf7){_0x9c5149[_0x69b0('0x22')]=_0x4dabf7;if(_0x5d7b68[_0x69b0('0x33')][_0x69b0('0x43')]){_0x22c5c5['include']=[{'all':!![]}];}return db[_0x69b0('0x50')][_0x69b0('0x45')](_0x22c5c5);})[_0x69b0('0x27')](function(_0x14696d){_0x9c5149['rows']=_0x14696d;return _0x9c5149;});}})[_0x69b0('0x27')](respondWithFilteredResult(_0x4a4db1,_0x22c5c5))[_0x69b0('0x4a')](handleError(_0x4a4db1,null));}; \ No newline at end of file +var _0x6a73=['options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','describe','getQuestions','params','JscriptyQuestionReport','rawAttributes','length','hasOwnProperty','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','json','offset','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','JscriptySessionReport','fieldName','type','key','model','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x54d879,_0x35c691){var _0xf1c912=function(_0xde4d86){while(--_0xde4d86){_0x54d879['push'](_0x54d879['shift']());}};_0xf1c912(++_0x35c691);}(_0x6a73,0xb6));var _0x36a7=function(_0x59342a,_0x16827b){_0x59342a=_0x59342a-0x0;var _0x17abc9=_0x6a73[_0x59342a];return _0x17abc9;};'use strict';var emlformat=require(_0x36a7('0x0'));var rimraf=require(_0x36a7('0x1'));var zipdir=require(_0x36a7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x36a7('0x3'));var moment=require(_0x36a7('0x4'));var BPromise=require(_0x36a7('0x5'));var Mustache=require(_0x36a7('0x6'));var util=require(_0x36a7('0x7'));var path=require(_0x36a7('0x8'));var sox=require(_0x36a7('0x9'));var csv=require(_0x36a7('0xa'));var ejs=require(_0x36a7('0xb'));var fs=require('fs');var fs_extra=require(_0x36a7('0xc'));var _=require('lodash');var squel=require(_0x36a7('0xd'));var crypto=require(_0x36a7('0xe'));var jsforce=require(_0x36a7('0xf'));var deskjs=require(_0x36a7('0x10'));var toCsv=require(_0x36a7('0xa'));var querystring=require(_0x36a7('0x11'));var Papa=require(_0x36a7('0x12'));var Redis=require(_0x36a7('0x13'));var authService=require(_0x36a7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x36a7('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x36a7('0x16'))(_0x36a7('0x17'));var utils=require(_0x36a7('0x18'));var config=require(_0x36a7('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x258024,_0xa8be81){_0xa8be81=_0xa8be81||0xcc;return function(_0x4e9afc){if(_0x4e9afc){return _0x258024[_0x36a7('0x1a')](_0xa8be81);}return _0x258024['status'](_0xa8be81)[_0x36a7('0x1b')]();};}function respondWithResult(_0x422380,_0x27be1c){_0x27be1c=_0x27be1c||0xc8;return function(_0x253d0c){if(_0x253d0c){return _0x422380['status'](_0x27be1c)[_0x36a7('0x1c')](_0x253d0c);}};}function respondWithFilteredResult(_0x2d5023,_0x3ee563){return function(_0x406bcc){if(_0x406bcc){var _0x382fe9=typeof _0x3ee563[_0x36a7('0x1d')]==='undefined'&&typeof _0x3ee563[_0x36a7('0x1e')]==='undefined';var _0x592daf=_0x406bcc[_0x36a7('0x1f')];var _0x653626=_0x382fe9?0x0:_0x3ee563['offset'];var _0x494f0a=_0x382fe9?_0x406bcc[_0x36a7('0x1f')]:_0x3ee563['offset']+_0x3ee563['limit'];var _0xafc4b9;if(_0x494f0a>=_0x592daf){_0x494f0a=_0x592daf;_0xafc4b9=0xc8;}else{_0xafc4b9=0xce;}_0x2d5023[_0x36a7('0x20')](_0xafc4b9);return _0x2d5023[_0x36a7('0x21')](_0x36a7('0x22'),_0x653626+'-'+_0x494f0a+'/'+_0x592daf)[_0x36a7('0x1c')](_0x406bcc);}return null;};}function patchUpdates(_0x5e6db2){return function(_0x4994bd){try{jsonpatch[_0x36a7('0x23')](_0x4994bd,_0x5e6db2,!![]);}catch(_0x42ead4){return BPromise[_0x36a7('0x24')](_0x42ead4);}return _0x4994bd[_0x36a7('0x25')]();};}function saveUpdates(_0x1f84ee,_0xbbd495){return function(_0x185308){if(_0x185308){return _0x185308[_0x36a7('0x26')](_0x1f84ee)[_0x36a7('0x27')](function(_0x14b7fc){return _0x14b7fc;});}return null;};}function removeEntity(_0x4605f9,_0x49aa49){return function(_0x849944){if(_0x849944){return _0x849944[_0x36a7('0x28')]()[_0x36a7('0x27')](function(){_0x4605f9[_0x36a7('0x20')](0xcc)[_0x36a7('0x1b')]();});}};}function handleEntityNotFound(_0x169347,_0x49d2d8){return function(_0x50d62c){if(!_0x50d62c){_0x169347['sendStatus'](0x194);}return _0x50d62c;};}function handleError(_0x101c49,_0x4c00ac){_0x4c00ac=_0x4c00ac||0x1f4;return function(_0x4db368){logger[_0x36a7('0x29')](_0x4db368[_0x36a7('0x2a')]);if(_0x4db368[_0x36a7('0x2b')]){delete _0x4db368[_0x36a7('0x2b')];}_0x101c49[_0x36a7('0x20')](_0x4c00ac)['send'](_0x4db368);};}exports[_0x36a7('0x2c')]=function(_0x390694,_0x271955){var _0x479e98={},_0x221852={},_0x1594dc={'count':0x0,'rows':[]};var _0x16d32c=_[_0x36a7('0x2d')](db[_0x36a7('0x2e')]['rawAttributes'],function(_0x2d3ce8){return{'name':_0x2d3ce8[_0x36a7('0x2f')],'type':_0x2d3ce8[_0x36a7('0x30')][_0x36a7('0x31')]};});_0x221852[_0x36a7('0x32')]=_[_0x36a7('0x2d')](_0x16d32c,'name');_0x221852[_0x36a7('0x33')]=_['keys'](_0x390694[_0x36a7('0x33')]);_0x221852[_0x36a7('0x34')]=_[_0x36a7('0x35')](_0x221852['model'],_0x221852[_0x36a7('0x33')]);_0x479e98['attributes']=_['intersection'](_0x221852[_0x36a7('0x32')],qs[_0x36a7('0x36')](_0x390694[_0x36a7('0x33')][_0x36a7('0x36')]));_0x479e98['attributes']=_0x479e98[_0x36a7('0x37')]['length']?_0x479e98[_0x36a7('0x37')]:_0x221852[_0x36a7('0x32')];if(!_0x390694['query']['hasOwnProperty'](_0x36a7('0x38'))){_0x479e98[_0x36a7('0x1e')]=qs['limit'](_0x390694['query'][_0x36a7('0x1e')]);_0x479e98[_0x36a7('0x1d')]=qs[_0x36a7('0x1d')](_0x390694[_0x36a7('0x33')][_0x36a7('0x1d')]);}_0x479e98[_0x36a7('0x39')]=qs[_0x36a7('0x3a')](_0x390694[_0x36a7('0x33')][_0x36a7('0x3a')]);_0x479e98[_0x36a7('0x3b')]=qs[_0x36a7('0x34')](_[_0x36a7('0x3c')](_0x390694[_0x36a7('0x33')],_0x221852[_0x36a7('0x34')]),_0x16d32c);if(_0x390694['query'][_0x36a7('0x3d')]){_0x479e98['where']=_[_0x36a7('0x3e')](_0x479e98[_0x36a7('0x3b')],{'$or':_[_0x36a7('0x2d')](_0x16d32c,function(_0x20bec9){if(_0x20bec9['type']!==_0x36a7('0x3f')){var _0x18bb17={};_0x18bb17[_0x20bec9[_0x36a7('0x2b')]]={'$like':'%'+_0x390694['query'][_0x36a7('0x3d')]+'%'};return _0x18bb17;}})});}_0x479e98=_['merge']({},_0x479e98,_0x390694[_0x36a7('0x40')]);var _0x317c24={'where':_0x479e98[_0x36a7('0x3b')]};return db[_0x36a7('0x2e')][_0x36a7('0x1f')](_0x317c24)['then'](function(_0x21970d){_0x1594dc[_0x36a7('0x1f')]=_0x21970d;if(_0x390694[_0x36a7('0x33')][_0x36a7('0x41')]){_0x479e98[_0x36a7('0x42')]=[{'all':!![]}];}return db[_0x36a7('0x2e')][_0x36a7('0x43')](_0x479e98);})['then'](function(_0x36bdf9){_0x1594dc[_0x36a7('0x44')]=_0x36bdf9;return _0x1594dc;})[_0x36a7('0x27')](respondWithFilteredResult(_0x271955,_0x479e98))[_0x36a7('0x45')](handleError(_0x271955,null));};exports[_0x36a7('0x46')]=function(_0x367d72,_0x433e38){var _0x4eba64={'raw':!![],'where':{'id':_0x367d72['params']['id']}},_0x18acf0={};_0x18acf0[_0x36a7('0x32')]=_[_0x36a7('0x47')](db[_0x36a7('0x2e')]['rawAttributes']);_0x18acf0[_0x36a7('0x33')]=_[_0x36a7('0x47')](_0x367d72[_0x36a7('0x33')]);_0x18acf0[_0x36a7('0x34')]=_[_0x36a7('0x35')](_0x18acf0[_0x36a7('0x32')],_0x18acf0[_0x36a7('0x33')]);_0x4eba64[_0x36a7('0x37')]=_[_0x36a7('0x35')](_0x18acf0['model'],qs[_0x36a7('0x36')](_0x367d72[_0x36a7('0x33')]['fields']));_0x4eba64[_0x36a7('0x37')]=_0x4eba64[_0x36a7('0x37')]['length']?_0x4eba64[_0x36a7('0x37')]:_0x18acf0[_0x36a7('0x32')];if(_0x367d72['query'][_0x36a7('0x41')]){_0x4eba64[_0x36a7('0x42')]=[{'all':!![]}];}_0x4eba64=_[_0x36a7('0x3e')]({},_0x4eba64,_0x367d72[_0x36a7('0x40')]);return db[_0x36a7('0x2e')][_0x36a7('0x48')](_0x4eba64)[_0x36a7('0x27')](handleEntityNotFound(_0x433e38,null))[_0x36a7('0x27')](respondWithResult(_0x433e38,null))[_0x36a7('0x45')](handleError(_0x433e38,null));};exports[_0x36a7('0x49')]=function(_0x28517e,_0x2ae847){return db['JscriptySessionReport']['create'](_0x28517e[_0x36a7('0x4a')],{})[_0x36a7('0x27')](respondWithResult(_0x2ae847,0xc9))['catch'](handleError(_0x2ae847,null));};exports[_0x36a7('0x26')]=function(_0x123567,_0x2c53f0){if(_0x123567['body']['id']){delete _0x123567['body']['id'];}return db[_0x36a7('0x2e')]['find']({'where':{'id':_0x123567['params']['id']}})[_0x36a7('0x27')](handleEntityNotFound(_0x2c53f0,null))[_0x36a7('0x27')](saveUpdates(_0x123567['body'],null))[_0x36a7('0x27')](respondWithResult(_0x2c53f0,null))['catch'](handleError(_0x2c53f0,null));};exports[_0x36a7('0x28')]=function(_0x5e08f1,_0xfbbd95){return db['JscriptySessionReport'][_0x36a7('0x48')]({'where':{'id':_0x5e08f1['params']['id']}})[_0x36a7('0x27')](handleEntityNotFound(_0xfbbd95,null))[_0x36a7('0x27')](removeEntity(_0xfbbd95,null))[_0x36a7('0x45')](handleError(_0xfbbd95,null));};exports[_0x36a7('0x4b')]=function(_0x550222,_0x45f6d0){return db['JscriptySessionReport'][_0x36a7('0x4b')]()[_0x36a7('0x27')](respondWithResult(_0x45f6d0,null))[_0x36a7('0x45')](handleError(_0x45f6d0,null));};exports[_0x36a7('0x4c')]=function(_0x53d477,_0x3ef034,_0x27d640){var _0x231363={'raw':!![],'where':{}};var _0x52fd3a={};var _0x22d650={'count':0x0,'rows':[]};return db['JscriptySessionReport']['findOne']({'where':{'id':_0x53d477[_0x36a7('0x4d')]['id']}})[_0x36a7('0x27')](handleEntityNotFound(_0x3ef034,null))[_0x36a7('0x27')](function(_0x5d2115){if(_0x5d2115){_0x52fd3a[_0x36a7('0x32')]=_[_0x36a7('0x47')](db[_0x36a7('0x4e')][_0x36a7('0x4f')]);_0x52fd3a[_0x36a7('0x33')]=_[_0x36a7('0x47')](_0x53d477[_0x36a7('0x33')]);_0x52fd3a[_0x36a7('0x34')]=_['intersection'](_0x52fd3a[_0x36a7('0x32')],_0x52fd3a[_0x36a7('0x33')]);_0x231363['attributes']=_['intersection'](_0x52fd3a[_0x36a7('0x32')],qs[_0x36a7('0x36')](_0x53d477[_0x36a7('0x33')][_0x36a7('0x36')]));_0x231363[_0x36a7('0x37')]=_0x231363[_0x36a7('0x37')][_0x36a7('0x50')]?_0x231363['attributes']:_0x52fd3a[_0x36a7('0x32')];if(!_0x53d477['query'][_0x36a7('0x51')](_0x36a7('0x38'))){_0x231363[_0x36a7('0x1e')]=qs['limit'](_0x53d477[_0x36a7('0x33')][_0x36a7('0x1e')]);_0x231363[_0x36a7('0x1d')]=qs['offset'](_0x53d477['query'][_0x36a7('0x1d')]);}_0x231363['order']=qs[_0x36a7('0x3a')](_0x53d477[_0x36a7('0x33')][_0x36a7('0x3a')]);_0x231363[_0x36a7('0x3b')]=qs[_0x36a7('0x34')](_[_0x36a7('0x3c')](_0x53d477[_0x36a7('0x33')],_0x52fd3a['filters']));_0x231363[_0x36a7('0x3b')]['SessionId']=_0x5d2115['id'];if(_0x53d477[_0x36a7('0x33')][_0x36a7('0x3d')]){_0x231363[_0x36a7('0x3b')]=_[_0x36a7('0x3e')](_0x231363[_0x36a7('0x3b')],{'$or':_[_0x36a7('0x2d')](_0x231363[_0x36a7('0x37')],function(_0x3448bd){var _0x1aee1c={};_0x1aee1c[_0x3448bd]={'$like':'%'+_0x53d477[_0x36a7('0x33')][_0x36a7('0x3d')]+'%'};return _0x1aee1c;})});}_0x231363=_['merge']({},_0x231363,_0x53d477[_0x36a7('0x40')]);return db[_0x36a7('0x4e')][_0x36a7('0x1f')]({'where':_0x231363['where']})[_0x36a7('0x27')](function(_0x260835){_0x22d650[_0x36a7('0x1f')]=_0x260835;if(_0x53d477[_0x36a7('0x33')][_0x36a7('0x41')]){_0x231363[_0x36a7('0x42')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x231363);})[_0x36a7('0x27')](function(_0x12987c){_0x22d650[_0x36a7('0x44')]=_0x12987c;return _0x22d650;});}})[_0x36a7('0x27')](respondWithFilteredResult(_0x3ef034,_0x231363))[_0x36a7('0x45')](handleError(_0x3ef034,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 508af68..98f2247 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 _0x687b=['rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x44d9ab,_0x76bc69){var _0x31485e=function(_0x1e44ce){while(--_0x1e44ce){_0x44d9ab['push'](_0x44d9ab['shift']());}};_0x31485e(++_0x76bc69);}(_0x687b,0x14a));var _0xb687=function(_0x3260eb,_0x284ae0){_0x3260eb=_0x3260eb-0x0;var _0x4c28d9=_0x687b[_0x3260eb];return _0x4c28d9;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require(_0xb687('0x2'))(_0xb687('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));module[_0xb687('0x9')]=function(_0x16ccf3,_0xf43a1f){return _0x16ccf3[_0xb687('0xa')](_0xb687('0xb'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafc4=['path','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xafc4,0x69));var _0x4afc=function(_0x410d7e,_0x404b31){_0x410d7e=_0x410d7e-0x0;var _0x3b133f=_0xafc4[_0x410d7e];return _0x3b133f;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var logger=require(_0x4afc('0x1'))('api');var moment=require(_0x4afc('0x2'));var BPromise=require(_0x4afc('0x3'));var rp=require(_0x4afc('0x4'));var fs=require('fs');var path=require(_0x4afc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x4afc('0x6')]=function(_0x471d45,_0x16953b){return _0x471d45[_0x4afc('0x7')](_0x4afc('0x8'),attributes,{'tableName':_0x4afc('0x9'),'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 1c8c0f1..20bc17b 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 _0xacf4=['message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xacf4,0xe7));var _0x4acf=function(_0x24618a,_0x2cd0f4){_0x24618a=_0x24618a-0x0;var _0x2e3d64=_0xacf4[_0x24618a];return _0x2e3d64;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4acf('0x0'));var BPromise=require(_0x4acf('0x1'));var rs=require(_0x4acf('0x2'));var fs=require('fs');var Redis=require(_0x4acf('0x3'));var db=require(_0x4acf('0x4'))['db'];var utils=require(_0x4acf('0x5'));var logger=require(_0x4acf('0x6'))('rpc');var config=require(_0x4acf('0x7'));var jayson=require(_0x4acf('0x8'));var client=jayson['client'][_0x4acf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ba08a,_0x649ad2,_0x45a5a4){return new BPromise(function(_0x25d345,_0x50f5f4){return client['request'](_0x2ba08a,_0x45a5a4)[_0x4acf('0xa')](function(_0x59f559){logger[_0x4acf('0xb')](_0x4acf('0xc'),_0x649ad2,_0x4acf('0xd'));logger['debug'](_0x4acf('0xe'),_0x649ad2,_0x4acf('0xd'),JSON['stringify'](_0x59f559));if(_0x59f559['error']){if(_0x59f559[_0x4acf('0xf')]['code']===0x1f4){logger['error'](_0x4acf('0xc'),_0x649ad2,_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);return _0x50f5f4(_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);}logger[_0x4acf('0xf')](_0x4acf('0xc'),_0x649ad2,_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);return _0x25d345(_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);}else{logger['info'](_0x4acf('0xc'),_0x649ad2,'request\x20sent');_0x25d345(_0x59f559[_0x4acf('0x11')][_0x4acf('0x10')]);}})[_0x4acf('0x12')](function(_0x5d934a){logger['error'](_0x4acf('0xc'),_0x649ad2,_0x5d934a);_0x50f5f4(_0x5d934a);});});} \ No newline at end of file +var _0xa6b0=['client','http','request','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x55c5eb,_0x210f2a){var _0xd40852=function(_0x2b6246){while(--_0x2b6246){_0x55c5eb['push'](_0x55c5eb['shift']());}};_0xd40852(++_0x210f2a);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x4c93a1,_0xfb54a8){_0x4c93a1=_0x4c93a1-0x0;var _0x484df2=_0xa6b0[_0x4c93a1];return _0x484df2;};'use strict';var _=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0a6b('0x2'));var fs=require('fs');var Redis=require(_0x0a6b('0x3'));var db=require(_0x0a6b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a6b('0x5'))(_0x0a6b('0x6'));var config=require(_0x0a6b('0x7'));var jayson=require(_0x0a6b('0x8'));var client=jayson[_0x0a6b('0x9')][_0x0a6b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b5fb5,_0xa908dd,_0x26f761){return new BPromise(function(_0x340a33,_0x8e89f){return client[_0x0a6b('0xb')](_0x1b5fb5,_0x26f761)['then'](function(_0x493948){logger[_0x0a6b('0xc')](_0x0a6b('0xd'),_0xa908dd,_0x0a6b('0xe'));logger[_0x0a6b('0xf')](_0x0a6b('0x10'),_0xa908dd,_0x0a6b('0xe'),JSON[_0x0a6b('0x11')](_0x493948));if(_0x493948[_0x0a6b('0x12')]){if(_0x493948[_0x0a6b('0x12')][_0x0a6b('0x13')]===0x1f4){logger[_0x0a6b('0x12')](_0x0a6b('0xd'),_0xa908dd,_0x493948[_0x0a6b('0x12')][_0x0a6b('0x14')]);return _0x8e89f(_0x493948['error']['message']);}logger[_0x0a6b('0x12')](_0x0a6b('0xd'),_0xa908dd,_0x493948[_0x0a6b('0x12')][_0x0a6b('0x14')]);return _0x340a33(_0x493948[_0x0a6b('0x12')][_0x0a6b('0x14')]);}else{logger[_0x0a6b('0xc')](_0x0a6b('0xd'),_0xa908dd,_0x0a6b('0xe'));_0x340a33(_0x493948[_0x0a6b('0x15')]['message']);}})[_0x0a6b('0x16')](function(_0x1538f4){logger['error'](_0x0a6b('0xd'),_0xa908dd,_0x1538f4);_0x8e89f(_0x1538f4);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 9fe037c..605d502 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 _0xc630=['get','put','update','/download_log_file','isAuthenticated','downloadLogFile','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc630,0x7f));var _0x0c63=function(_0x31ec29,_0x58915c){_0x31ec29=_0x31ec29-0x0;var _0x3275fc=_0xc630[_0x31ec29];return _0x3275fc;};'use strict';var multer=require(_0x0c63('0x0'));var util=require(_0x0c63('0x1'));var path=require('path');var timeout=require(_0x0c63('0x2'));var express=require('express');var router=express[_0x0c63('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0c63('0x4'));var interaction=require(_0x0c63('0x5'));var config=require(_0x0c63('0x6'));var controller=require(_0x0c63('0x7'));router[_0x0c63('0x8')]('/',controller['index']);router[_0x0c63('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x0c63('0xa')]);router[_0x0c63('0x8')](_0x0c63('0xb'),auth[_0x0c63('0xc')](),controller[_0x0c63('0xd')]);module[_0x0c63('0xe')]=router; \ No newline at end of file +var _0x0d19=['index','put','/:id','isAuthenticated','update','get','/download_log_file','downloadLogFile','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller'];(function(_0x3b03ee,_0x1dabfd){var _0x441a22=function(_0x3e78b5){while(--_0x3e78b5){_0x3b03ee['push'](_0x3b03ee['shift']());}};_0x441a22(++_0x1dabfd);}(_0x0d19,0x105));var _0x90d1=function(_0x222a4b,_0x1dc16c){_0x222a4b=_0x222a4b-0x0;var _0x59355f=_0x0d19[_0x222a4b];return _0x59355f;};'use strict';var multer=require(_0x90d1('0x0'));var util=require(_0x90d1('0x1'));var path=require(_0x90d1('0x2'));var timeout=require(_0x90d1('0x3'));var express=require(_0x90d1('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x90d1('0x5'));var interaction=require(_0x90d1('0x6'));var config=require(_0x90d1('0x7'));var controller=require(_0x90d1('0x8'));router['get']('/',controller[_0x90d1('0x9')]);router[_0x90d1('0xa')](_0x90d1('0xb'),auth[_0x90d1('0xc')](),controller[_0x90d1('0xd')]);router[_0x90d1('0xe')](_0x90d1('0xf'),auth[_0x90d1('0xc')](),controller[_0x90d1('0x10')]);module[_0x90d1('0x11')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 38a22a1..51a1b32 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 _0xc06c=['exports','TEXT','STRING','sequelize'];(function(_0x20da99,_0x160928){var _0x4a3f1e=function(_0x5bd56c){while(--_0x5bd56c){_0x20da99['push'](_0x20da99['shift']());}};_0x4a3f1e(++_0x160928);}(_0xc06c,0x117));var _0xcc06=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xc06c[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0xcc06('0x0'));module[_0xcc06('0x1')]={'license':{'type':Sequelize[_0xcc06('0x2')]},'data1':{'type':Sequelize[_0xcc06('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xab3a=['TEXT','STRING','sequelize','exports'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xab3a,0x1f2));var _0xaab3=function(_0x3dd0b9,_0x1d6c92){_0x3dd0b9=_0x3dd0b9-0x0;var _0x4c0351=_0xab3a[_0x3dd0b9];return _0x4c0351;};'use strict';var Sequelize=require(_0xaab3('0x0'));module[_0xaab3('0x1')]={'license':{'type':Sequelize[_0xaab3('0x2')]},'data1':{'type':Sequelize[_0xaab3('0x3')]},'data2':{'type':Sequelize[_0xaab3('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'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 7db244d..af1c375 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 _0x52b4=['License','rawAttributes','query','keys','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','update','body','find','get','checkLicense','downloadLogFile','license-info.log','join','/var','log','xcally','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','end','sendStatus','name','send','index','model'];(function(_0xb08412,_0x57c27a){var _0x66a75=function(_0x128db3){while(--_0x128db3){_0xb08412['push'](_0xb08412['shift']());}};_0x66a75(++_0x57c27a);}(_0x52b4,0xfe));var _0x452b=function(_0x4a6438,_0x2459c1){_0x4a6438=_0x4a6438-0x0;var _0x46c151=_0x52b4[_0x4a6438];return _0x46c151;};'use strict';var emlformat=require(_0x452b('0x0'));var rimraf=require(_0x452b('0x1'));var zipdir=require(_0x452b('0x2'));var jsonpatch=require(_0x452b('0x3'));var rp=require(_0x452b('0x4'));var moment=require(_0x452b('0x5'));var BPromise=require(_0x452b('0x6'));var Mustache=require(_0x452b('0x7'));var util=require(_0x452b('0x8'));var path=require(_0x452b('0x9'));var sox=require('sox');var csv=require(_0x452b('0xa'));var ejs=require(_0x452b('0xb'));var fs=require('fs');var fs_extra=require(_0x452b('0xc'));var _=require(_0x452b('0xd'));var squel=require(_0x452b('0xe'));var crypto=require(_0x452b('0xf'));var jsforce=require(_0x452b('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x452b('0xa'));var querystring=require('querystring');var Papa=require(_0x452b('0x11'));var Redis=require('ioredis');var authService=require(_0x452b('0x12'));var qs=require(_0x452b('0x13'));var as=require(_0x452b('0x14'));var hardwareService=require(_0x452b('0x15'));var logger=require(_0x452b('0x16'))(_0x452b('0x17'));var utils=require(_0x452b('0x18'));var config=require(_0x452b('0x19'));var licenseUtil=require(_0x452b('0x1a'));var db=require(_0x452b('0x1b'))['db'];function respondWithStatusCode(_0xbc9118,_0x2a9975){_0x2a9975=_0x2a9975||0xcc;return function(_0x127850){if(_0x127850){return _0xbc9118['sendStatus'](_0x2a9975);}return _0xbc9118[_0x452b('0x1c')](_0x2a9975)['end']();};}function respondWithResult(_0x3a6a8f,_0x3c3587){_0x3c3587=_0x3c3587||0xc8;return function(_0x22fbc0){if(_0x22fbc0){return _0x3a6a8f[_0x452b('0x1c')](_0x3c3587)[_0x452b('0x1d')](_0x22fbc0);}};}function respondWithFilteredResult(_0x3868c9,_0x5ac2d2){return function(_0x5adce0){if(_0x5adce0){var _0x296041=typeof _0x5ac2d2[_0x452b('0x1e')]===_0x452b('0x1f')&&typeof _0x5ac2d2[_0x452b('0x20')]===_0x452b('0x1f');var _0x31e87c=_0x5adce0['count'];var _0x33fbac=_0x296041?0x0:_0x5ac2d2[_0x452b('0x1e')];var _0x106af2=_0x296041?_0x5adce0[_0x452b('0x21')]:_0x5ac2d2[_0x452b('0x1e')]+_0x5ac2d2[_0x452b('0x20')];var _0x470683;if(_0x106af2>=_0x31e87c){_0x106af2=_0x31e87c;_0x470683=0xc8;}else{_0x470683=0xce;}_0x3868c9['status'](_0x470683);return _0x3868c9[_0x452b('0x22')]('Content-Range',_0x33fbac+'-'+_0x106af2+'/'+_0x31e87c)[_0x452b('0x1d')](_0x5adce0);}return null;};}function patchUpdates(_0x2b1b67){return function(_0x493edd){try{jsonpatch[_0x452b('0x23')](_0x493edd,_0x2b1b67,!![]);}catch(_0x9e4317){return BPromise[_0x452b('0x24')](_0x9e4317);}return _0x493edd[_0x452b('0x25')]();};}function saveUpdates(_0x1ec279,_0x4148ad){return function(_0x5991d0){if(_0x5991d0){return _0x5991d0['update'](_0x1ec279)[_0x452b('0x26')](function(_0x300590){return _0x300590;});}return null;};}function removeEntity(_0x458c68,_0x1124aa){return function(_0x56cf5f){if(_0x56cf5f){return _0x56cf5f[_0x452b('0x27')]()[_0x452b('0x26')](function(){_0x458c68[_0x452b('0x1c')](0xcc)[_0x452b('0x28')]();});}};}function handleEntityNotFound(_0xd5259a,_0x8cdc6d){return function(_0x3f6191){if(!_0x3f6191){_0xd5259a[_0x452b('0x29')](0x194);}return _0x3f6191;};}function handleError(_0x10421f,_0x159e33){_0x159e33=_0x159e33||0x1f4;return function(_0x4bb88e){logger['error'](_0x4bb88e['stack']);if(_0x4bb88e['name']){delete _0x4bb88e[_0x452b('0x2a')];}_0x10421f['status'](_0x159e33)[_0x452b('0x2b')](_0x4bb88e);};}var utilLicense=require(_0x452b('0x1a'));exports[_0x452b('0x2c')]=function(_0x2e1f05,_0x16f8c5){var _0x4ad83a={'raw':!![],'where':{'id':0x1}},_0x24b9a1={};_0x24b9a1[_0x452b('0x2d')]=_['keys'](db[_0x452b('0x2e')][_0x452b('0x2f')]);_0x24b9a1[_0x452b('0x30')]=_[_0x452b('0x31')](_0x2e1f05[_0x452b('0x30')]);_0x24b9a1[_0x452b('0x32')]=_[_0x452b('0x33')](_0x24b9a1[_0x452b('0x2d')],_0x24b9a1['query']);_0x4ad83a[_0x452b('0x34')]=_[_0x452b('0x33')](_0x24b9a1[_0x452b('0x2d')],qs['fields'](_0x2e1f05['query'][_0x452b('0x35')]));_0x4ad83a[_0x452b('0x34')]=_0x4ad83a[_0x452b('0x34')][_0x452b('0x36')]?_0x4ad83a[_0x452b('0x34')]:_0x24b9a1[_0x452b('0x2d')];_0x4ad83a=_[_0x452b('0x37')]({},_0x4ad83a,_0x2e1f05[_0x452b('0x38')]);return utilLicense[_0x452b('0x39')](_0x4ad83a)['then'](respondWithResult(_0x16f8c5,null))[_0x452b('0x3a')](handleError(_0x16f8c5,null));};exports[_0x452b('0x3b')]=function(_0x34fd2a,_0x40fe5c){if(_0x34fd2a[_0x452b('0x3c')]['id']){delete _0x34fd2a[_0x452b('0x3c')]['id'];}return db[_0x452b('0x2e')][_0x452b('0x3d')]({'where':{'id':_0x34fd2a['params']['id']}})[_0x452b('0x26')](handleEntityNotFound(_0x40fe5c,null))[_0x452b('0x26')](function(_0x1bf870){var _0x548e3f=_0x1bf870[_0x452b('0x3e')]({'plain':!![]});return utilLicense[_0x452b('0x3f')](_0x548e3f,_0x34fd2a[_0x452b('0x3c')]['key']);})[_0x452b('0x26')](function(_0x144a67){if(!_0x144a67['demo']){return saveUpdates(_0x34fd2a[_0x452b('0x3c')],null);}return _0x144a67;})[_0x452b('0x26')](respondWithResult(_0x40fe5c,null))[_0x452b('0x3a')](handleError(_0x40fe5c,null));};exports[_0x452b('0x40')]=function(_0x10b67f,_0x52666b){var _0x36c47c=_0x452b('0x41');var _0x2c6f55=path[_0x452b('0x42')](_0x452b('0x43'),_0x452b('0x44'),_0x452b('0x45'),_0x36c47c);_0x52666b['setHeader'](_0x452b('0x46'),_0x452b('0x47')+_0x36c47c);_0x52666b[_0x452b('0x22')](_0x452b('0x48'),_0x452b('0x49'));_0x52666b[_0x452b('0x4a')](_0x2c6f55);}; \ No newline at end of file +var _0x1c6a=['desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','name','index','model','keys','query','filters','intersection','fields','attributes','length','merge','getLicense','catch','License','find','get','checkLicense','body','key','demo','join','/var','xcally','Content-disposition','attachment;\x20filename=','Content-Type','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x3266bd,_0x441192){var _0xf8c685=function(_0x4c9604){while(--_0x4c9604){_0x3266bd['push'](_0x3266bd['shift']());}};_0xf8c685(++_0x441192);}(_0x1c6a,0xb9));var _0xa1c6=function(_0x537563,_0x1eab9e){_0x537563=_0x537563-0x0;var _0x3d3f2=_0x1c6a[_0x537563];return _0x3d3f2;};'use strict';var emlformat=require(_0xa1c6('0x0'));var rimraf=require(_0xa1c6('0x1'));var zipdir=require(_0xa1c6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa1c6('0x3'));var moment=require('moment');var BPromise=require(_0xa1c6('0x4'));var Mustache=require(_0xa1c6('0x5'));var util=require(_0xa1c6('0x6'));var path=require(_0xa1c6('0x7'));var sox=require(_0xa1c6('0x8'));var csv=require(_0xa1c6('0x9'));var ejs=require(_0xa1c6('0xa'));var fs=require('fs');var fs_extra=require(_0xa1c6('0xb'));var _=require(_0xa1c6('0xc'));var squel=require(_0xa1c6('0xd'));var crypto=require(_0xa1c6('0xe'));var jsforce=require(_0xa1c6('0xf'));var deskjs=require(_0xa1c6('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa1c6('0x11'));var Redis=require(_0xa1c6('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa1c6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa1c6('0x14'));var logger=require(_0xa1c6('0x15'))(_0xa1c6('0x16'));var utils=require(_0xa1c6('0x17'));var config=require(_0xa1c6('0x18'));var licenseUtil=require(_0xa1c6('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c6582,_0x2ce3f0){_0x2ce3f0=_0x2ce3f0||0xcc;return function(_0x22e409){if(_0x22e409){return _0x4c6582[_0xa1c6('0x1a')](_0x2ce3f0);}return _0x4c6582[_0xa1c6('0x1b')](_0x2ce3f0)[_0xa1c6('0x1c')]();};}function respondWithResult(_0xc4005b,_0x11ceed){_0x11ceed=_0x11ceed||0xc8;return function(_0x5594e7){if(_0x5594e7){return _0xc4005b['status'](_0x11ceed)['json'](_0x5594e7);}};}function respondWithFilteredResult(_0x4bdb67,_0x55cc8e){return function(_0x4defdc){if(_0x4defdc){var _0xb1f48b=typeof _0x55cc8e[_0xa1c6('0x1d')]===_0xa1c6('0x1e')&&typeof _0x55cc8e[_0xa1c6('0x1f')]===_0xa1c6('0x1e');var _0x3d1a7d=_0x4defdc[_0xa1c6('0x20')];var _0xd7e518=_0xb1f48b?0x0:_0x55cc8e[_0xa1c6('0x1d')];var _0x129923=_0xb1f48b?_0x4defdc[_0xa1c6('0x20')]:_0x55cc8e['offset']+_0x55cc8e[_0xa1c6('0x1f')];var _0x579dca;if(_0x129923>=_0x3d1a7d){_0x129923=_0x3d1a7d;_0x579dca=0xc8;}else{_0x579dca=0xce;}_0x4bdb67[_0xa1c6('0x1b')](_0x579dca);return _0x4bdb67[_0xa1c6('0x21')](_0xa1c6('0x22'),_0xd7e518+'-'+_0x129923+'/'+_0x3d1a7d)['json'](_0x4defdc);}return null;};}function patchUpdates(_0xf86511){return function(_0x261b70){try{jsonpatch[_0xa1c6('0x23')](_0x261b70,_0xf86511,!![]);}catch(_0x33273c){return BPromise['reject'](_0x33273c);}return _0x261b70[_0xa1c6('0x24')]();};}function saveUpdates(_0x41a5c4,_0x410cc8){return function(_0x2d7acd){if(_0x2d7acd){return _0x2d7acd[_0xa1c6('0x25')](_0x41a5c4)[_0xa1c6('0x26')](function(_0x56a89f){return _0x56a89f;});}return null;};}function removeEntity(_0x1ef13b,_0x2f6a1a){return function(_0x324343){if(_0x324343){return _0x324343[_0xa1c6('0x27')]()[_0xa1c6('0x26')](function(){_0x1ef13b[_0xa1c6('0x1b')](0xcc)[_0xa1c6('0x1c')]();});}};}function handleEntityNotFound(_0x11c692,_0xe86662){return function(_0x4af53a){if(!_0x4af53a){_0x11c692[_0xa1c6('0x1a')](0x194);}return _0x4af53a;};}function handleError(_0x1576d9,_0x5a5884){_0x5a5884=_0x5a5884||0x1f4;return function(_0x32cd8e){logger[_0xa1c6('0x28')](_0x32cd8e['stack']);if(_0x32cd8e['name']){delete _0x32cd8e[_0xa1c6('0x29')];}_0x1576d9[_0xa1c6('0x1b')](_0x5a5884)['send'](_0x32cd8e);};}var utilLicense=require(_0xa1c6('0x19'));exports[_0xa1c6('0x2a')]=function(_0x57781b,_0x237d0e){var _0x130b67={'raw':!![],'where':{'id':0x1}},_0x55e3ba={};_0x55e3ba[_0xa1c6('0x2b')]=_[_0xa1c6('0x2c')](db['License']['rawAttributes']);_0x55e3ba[_0xa1c6('0x2d')]=_['keys'](_0x57781b[_0xa1c6('0x2d')]);_0x55e3ba[_0xa1c6('0x2e')]=_[_0xa1c6('0x2f')](_0x55e3ba[_0xa1c6('0x2b')],_0x55e3ba[_0xa1c6('0x2d')]);_0x130b67['attributes']=_[_0xa1c6('0x2f')](_0x55e3ba[_0xa1c6('0x2b')],qs[_0xa1c6('0x30')](_0x57781b[_0xa1c6('0x2d')][_0xa1c6('0x30')]));_0x130b67[_0xa1c6('0x31')]=_0x130b67[_0xa1c6('0x31')][_0xa1c6('0x32')]?_0x130b67['attributes']:_0x55e3ba[_0xa1c6('0x2b')];_0x130b67=_[_0xa1c6('0x33')]({},_0x130b67,_0x57781b['options']);return utilLicense[_0xa1c6('0x34')](_0x130b67)[_0xa1c6('0x26')](respondWithResult(_0x237d0e,null))[_0xa1c6('0x35')](handleError(_0x237d0e,null));};exports[_0xa1c6('0x25')]=function(_0x50a9ae,_0x445536){if(_0x50a9ae['body']['id']){delete _0x50a9ae['body']['id'];}return db[_0xa1c6('0x36')][_0xa1c6('0x37')]({'where':{'id':_0x50a9ae['params']['id']}})[_0xa1c6('0x26')](handleEntityNotFound(_0x445536,null))[_0xa1c6('0x26')](function(_0x4fd79f){var _0x15882f=_0x4fd79f[_0xa1c6('0x38')]({'plain':!![]});return utilLicense[_0xa1c6('0x39')](_0x15882f,_0x50a9ae[_0xa1c6('0x3a')][_0xa1c6('0x3b')]);})[_0xa1c6('0x26')](function(_0xbb3bd0){if(!_0xbb3bd0[_0xa1c6('0x3c')]){return saveUpdates(_0x50a9ae[_0xa1c6('0x3a')],null);}return _0xbb3bd0;})[_0xa1c6('0x26')](respondWithResult(_0x445536,null))['catch'](handleError(_0x445536,null));};exports['downloadLogFile']=function(_0x34a126,_0x4ec9ef){var _0x20c757='license-info.log';var _0x35d4f3=path[_0xa1c6('0x3d')](_0xa1c6('0x3e'),'log',_0xa1c6('0x3f'),_0x20c757);_0x4ec9ef['setHeader'](_0xa1c6('0x40'),_0xa1c6('0x41')+_0x20c757);_0x4ec9ef[_0xa1c6('0x21')](_0xa1c6('0x42'),'text/plain');_0x4ec9ef['download'](_0x35d4f3);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 4c05fa9..5bee65d 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 _0x981c=['license','lodash','util','../../config/logger','api','moment','bluebird','request-promise','exports','define','License'];(function(_0xfbac0b,_0x20b38b){var _0x14e054=function(_0x5ef004){while(--_0x5ef004){_0xfbac0b['push'](_0xfbac0b['shift']());}};_0x14e054(++_0x20b38b);}(_0x981c,0x11f));var _0xc981=function(_0x18ccc6,_0x51131d){_0x18ccc6=_0x18ccc6-0x0;var _0x50ce07=_0x981c[_0x18ccc6];return _0x50ce07;};'use strict';var _=require(_0xc981('0x0'));var util=require(_0xc981('0x1'));var logger=require(_0xc981('0x2'))(_0xc981('0x3'));var moment=require(_0xc981('0x4'));var BPromise=require(_0xc981('0x5'));var rp=require(_0xc981('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./license.attributes');module[_0xc981('0x7')]=function(_0x232979,_0xed2094){return _0x232979[_0xc981('0x8')](_0xc981('0x9'),attributes,{'tableName':_0xc981('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xead0=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define','License','license'];(function(_0x8ae98b,_0x155f88){var _0xc30bd4=function(_0x5ca462){while(--_0x5ca462){_0x8ae98b['push'](_0x8ae98b['shift']());}};_0xc30bd4(++_0x155f88);}(_0xead0,0x193));var _0x0ead=function(_0x127783,_0x258715){_0x127783=_0x127783-0x0;var _0x14f298=_0xead0[_0x127783];return _0x14f298;};'use strict';var _=require(_0x0ead('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0ead('0x1'));var moment=require(_0x0ead('0x2'));var BPromise=require(_0x0ead('0x3'));var rp=require(_0x0ead('0x4'));var fs=require('fs');var path=require(_0x0ead('0x5'));var rimraf=require(_0x0ead('0x6'));var config=require(_0x0ead('0x7'));var attributes=require(_0x0ead('0x8'));module[_0x0ead('0x9')]=function(_0xfde443,_0x5a3a65){return _0xfde443[_0x0ead('0xa')](_0x0ead('0xb'),attributes,{'tableName':_0x0ead('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 f15c91e..a8e995f 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 _0x7c1f=['jayson/promise','client','http','request','then','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3328b4,_0x22de76){var _0x2452bc=function(_0x474348){while(--_0x474348){_0x3328b4['push'](_0x3328b4['shift']());}};_0x2452bc(++_0x22de76);}(_0x7c1f,0x13b));var _0xf7c1=function(_0x214d23,_0x4b32d4){_0x214d23=_0x214d23-0x0;var _0x149d2b=_0x7c1f[_0x214d23];return _0x149d2b;};'use strict';var _=require(_0xf7c1('0x0'));var util=require('util');var moment=require(_0xf7c1('0x1'));var BPromise=require(_0xf7c1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf7c1('0x3'));var db=require(_0xf7c1('0x4'))['db'];var utils=require(_0xf7c1('0x5'));var logger=require(_0xf7c1('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf7c1('0x7'));var client=jayson[_0xf7c1('0x8')][_0xf7c1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x54f0d1,_0x3f942d,_0x2e2129){return new BPromise(function(_0x271099,_0x8194e0){return client[_0xf7c1('0xa')](_0x54f0d1,_0x2e2129)[_0xf7c1('0xb')](function(_0x2fbf0f){logger['info'](_0xf7c1('0xc'),_0x3f942d,'request\x20sent');logger[_0xf7c1('0xd')](_0xf7c1('0xe'),_0x3f942d,'request\x20sent',JSON[_0xf7c1('0xf')](_0x2fbf0f));if(_0x2fbf0f[_0xf7c1('0x10')]){if(_0x2fbf0f[_0xf7c1('0x10')][_0xf7c1('0x11')]===0x1f4){logger[_0xf7c1('0x10')](_0xf7c1('0xc'),_0x3f942d,_0x2fbf0f[_0xf7c1('0x10')][_0xf7c1('0x12')]);return _0x8194e0(_0x2fbf0f[_0xf7c1('0x10')]['message']);}logger[_0xf7c1('0x10')](_0xf7c1('0xc'),_0x3f942d,_0x2fbf0f['error']['message']);return _0x271099(_0x2fbf0f['error'][_0xf7c1('0x12')]);}else{logger[_0xf7c1('0x13')](_0xf7c1('0xc'),_0x3f942d,_0xf7c1('0x14'));_0x271099(_0x2fbf0f[_0xf7c1('0x15')][_0xf7c1('0x12')]);}})[_0xf7c1('0x16')](function(_0x15cce9){logger[_0xf7c1('0x10')](_0xf7c1('0xc'),_0x3f942d,_0x15cce9);_0x8194e0(_0x15cce9);});});} \ No newline at end of file +var _0x9163=['request','then','info','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x19712f,_0x1b63a3){var _0x1c795e=function(_0x3cd834){while(--_0x3cd834){_0x19712f['push'](_0x19712f['shift']());}};_0x1c795e(++_0x1b63a3);}(_0x9163,0x1af));var _0x3916=function(_0x4a59d7,_0x33d394){_0x4a59d7=_0x4a59d7-0x0;var _0x3248ef=_0x9163[_0x4a59d7];return _0x3248ef;};'use strict';var _=require(_0x3916('0x0'));var util=require(_0x3916('0x1'));var moment=require(_0x3916('0x2'));var BPromise=require(_0x3916('0x3'));var rs=require(_0x3916('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3916('0x5'));var logger=require(_0x3916('0x6'))('rpc');var config=require(_0x3916('0x7'));var jayson=require(_0x3916('0x8'));var client=jayson[_0x3916('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x580696,_0x161c31,_0x290706){return new BPromise(function(_0x47de2a,_0x4eeb80){return client[_0x3916('0xa')](_0x580696,_0x290706)[_0x3916('0xb')](function(_0x10a63c){logger[_0x3916('0xc')](_0x3916('0xd'),_0x161c31,'request\x20sent');logger[_0x3916('0xe')](_0x3916('0xf'),_0x161c31,_0x3916('0x10'),JSON[_0x3916('0x11')](_0x10a63c));if(_0x10a63c[_0x3916('0x12')]){if(_0x10a63c['error']['code']===0x1f4){logger['error']('License,\x20%s,\x20%s',_0x161c31,_0x10a63c['error'][_0x3916('0x13')]);return _0x4eeb80(_0x10a63c[_0x3916('0x12')][_0x3916('0x13')]);}logger[_0x3916('0x12')](_0x3916('0xd'),_0x161c31,_0x10a63c[_0x3916('0x12')][_0x3916('0x13')]);return _0x47de2a(_0x10a63c[_0x3916('0x12')][_0x3916('0x13')]);}else{logger[_0x3916('0xc')]('License,\x20%s,\x20%s',_0x161c31,'request\x20sent');_0x47de2a(_0x10a63c[_0x3916('0x14')][_0x3916('0x13')]);}})['catch'](function(_0x23e018){logger[_0x3916('0x12')](_0x3916('0xd'),_0x161c31,_0x23e018);_0x4eeb80(_0x23e018);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index d081c79..56ad4c2 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 _0x0dd6=['/describe','/:id','show','/:id/canned_answers','getAnswers','getImap','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/verify','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addAnswer','create','/:id/in_servers','addImap','/:id/out_servers','addSmtp','/:id/interactions','addInteraction','/:id/send','send','addAgents','put','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index'];(function(_0x5f2aa1,_0x563107){var _0xc0a0fc=function(_0x5e6902){while(--_0x5e6902){_0x5f2aa1['push'](_0x5f2aa1['shift']());}};_0xc0a0fc(++_0x563107);}(_0x0dd6,0x114));var _0x60dd=function(_0x23aa30,_0x2fe60a){_0x23aa30=_0x23aa30-0x0;var _0x17ce73=_0x0dd6[_0x23aa30];return _0x17ce73;};'use strict';var multer=require(_0x60dd('0x0'));var util=require(_0x60dd('0x1'));var path=require(_0x60dd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x60dd('0x3')]();var fs_extra=require(_0x60dd('0x4'));var auth=require(_0x60dd('0x5'));var interaction=require(_0x60dd('0x6'));var config=require(_0x60dd('0x7'));var controller=require(_0x60dd('0x8'));router[_0x60dd('0x9')]('/',auth[_0x60dd('0xa')](),controller[_0x60dd('0xb')]);router['get'](_0x60dd('0xc'),auth[_0x60dd('0xa')](),controller['describe']);router[_0x60dd('0x9')](_0x60dd('0xd'),auth[_0x60dd('0xa')](),controller[_0x60dd('0xe')]);router[_0x60dd('0x9')]('/:id/dispositions',auth[_0x60dd('0xa')](),controller['getDispositions']);router[_0x60dd('0x9')](_0x60dd('0xf'),auth[_0x60dd('0xa')](),controller[_0x60dd('0x10')]);router[_0x60dd('0x9')]('/:id/in_servers',auth[_0x60dd('0xa')](),controller[_0x60dd('0x11')]);router[_0x60dd('0x9')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0x60dd('0x12')]);router[_0x60dd('0x9')]('/:id/interactions',auth[_0x60dd('0xa')](),controller[_0x60dd('0x13')]);router[_0x60dd('0x9')](_0x60dd('0x14'),auth[_0x60dd('0xa')](),controller[_0x60dd('0x15')]);router[_0x60dd('0x9')](_0x60dd('0x16'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0x60dd('0x17'),auth[_0x60dd('0xa')](),controller['verifySmtp']);router['get'](_0x60dd('0x18'),auth['isAuthenticated'](),controller[_0x60dd('0x19')]);router[_0x60dd('0x1a')](_0x60dd('0x1b'),auth[_0x60dd('0xa')](),controller[_0x60dd('0x1c')]);router[_0x60dd('0x1a')](_0x60dd('0xf'),auth[_0x60dd('0xa')](),controller[_0x60dd('0x1d')]);router[_0x60dd('0x1a')]('/',auth[_0x60dd('0xa')](),controller[_0x60dd('0x1e')]);router['post'](_0x60dd('0x1f'),auth[_0x60dd('0xa')](),controller[_0x60dd('0x20')]);router[_0x60dd('0x1a')](_0x60dd('0x21'),auth[_0x60dd('0xa')](),controller[_0x60dd('0x22')]);router[_0x60dd('0x1a')](_0x60dd('0x23'),auth['isAuthenticated'](),controller[_0x60dd('0x24')]);router[_0x60dd('0x1a')](_0x60dd('0x14'),auth[_0x60dd('0xa')](),controller['addApplications']);router[_0x60dd('0x1a')](_0x60dd('0x25'),auth[_0x60dd('0xa')](),controller[_0x60dd('0x26')]);router[_0x60dd('0x1a')](_0x60dd('0x18'),auth[_0x60dd('0xa')](),controller[_0x60dd('0x27')]);router[_0x60dd('0x28')](_0x60dd('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x60dd('0x29')](_0x60dd('0x1b'),auth[_0x60dd('0xa')](),controller[_0x60dd('0x2a')]);router[_0x60dd('0x29')]('/:id/canned_answers',auth[_0x60dd('0xa')](),controller[_0x60dd('0x2b')]);router[_0x60dd('0x29')]('/:id/in_servers',auth[_0x60dd('0xa')](),controller[_0x60dd('0x2c')]);router[_0x60dd('0x29')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0x60dd('0x2d')]);router[_0x60dd('0x29')](_0x60dd('0xd'),auth[_0x60dd('0xa')](),controller[_0x60dd('0x2e')]);router['delete'](_0x60dd('0x18'),auth[_0x60dd('0xa')](),controller['removeAgents']);module[_0x60dd('0x2f')]=router; \ No newline at end of file +var _0xa2c9=['index','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','getApplications','/:id/messages','/:id/verify','/:id/users','getAgents','post','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','/:id/send','addAgents','put','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get'];(function(_0x4b7b25,_0xde08c4){var _0x15fada=function(_0x51da18){while(--_0x51da18){_0x4b7b25['push'](_0x4b7b25['shift']());}};_0x15fada(++_0xde08c4);}(_0xa2c9,0x1af));var _0x9a2c=function(_0x4fd912,_0x4a11f0){_0x4fd912=_0x4fd912-0x0;var _0xecf807=_0xa2c9[_0x4fd912];return _0xecf807;};'use strict';var multer=require('multer');var util=require(_0x9a2c('0x0'));var path=require(_0x9a2c('0x1'));var timeout=require(_0x9a2c('0x2'));var express=require(_0x9a2c('0x3'));var router=express[_0x9a2c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9a2c('0x5'));var interaction=require(_0x9a2c('0x6'));var config=require(_0x9a2c('0x7'));var controller=require(_0x9a2c('0x8'));router[_0x9a2c('0x9')]('/',auth['isAuthenticated'](),controller[_0x9a2c('0xa')]);router['get'](_0x9a2c('0xb'),auth[_0x9a2c('0xc')](),controller['describe']);router[_0x9a2c('0x9')](_0x9a2c('0xd'),auth['isAuthenticated'](),controller[_0x9a2c('0xe')]);router['get'](_0x9a2c('0xf'),auth[_0x9a2c('0xc')](),controller[_0x9a2c('0x10')]);router[_0x9a2c('0x9')](_0x9a2c('0x11'),auth['isAuthenticated'](),controller[_0x9a2c('0x12')]);router[_0x9a2c('0x9')](_0x9a2c('0x13'),auth[_0x9a2c('0xc')](),controller[_0x9a2c('0x14')]);router[_0x9a2c('0x9')](_0x9a2c('0x15'),auth[_0x9a2c('0xc')](),controller[_0x9a2c('0x16')]);router['get'](_0x9a2c('0x17'),auth[_0x9a2c('0xc')](),controller['getInteractions']);router['get'](_0x9a2c('0x18'),auth['isAuthenticated'](),controller[_0x9a2c('0x19')]);router['get'](_0x9a2c('0x1a'),auth[_0x9a2c('0xc')](),controller['getMessages']);router['get'](_0x9a2c('0x1b'),auth[_0x9a2c('0xc')](),controller['verifySmtp']);router['get'](_0x9a2c('0x1c'),auth[_0x9a2c('0xc')](),controller[_0x9a2c('0x1d')]);router[_0x9a2c('0x1e')](_0x9a2c('0xf'),auth[_0x9a2c('0xc')](),controller[_0x9a2c('0x1f')]);router[_0x9a2c('0x1e')](_0x9a2c('0x11'),auth[_0x9a2c('0xc')](),controller[_0x9a2c('0x20')]);router[_0x9a2c('0x1e')]('/',auth['isAuthenticated'](),controller[_0x9a2c('0x21')]);router['post']('/:id/in_servers',auth[_0x9a2c('0xc')](),controller[_0x9a2c('0x22')]);router['post'](_0x9a2c('0x15'),auth[_0x9a2c('0xc')](),controller[_0x9a2c('0x23')]);router[_0x9a2c('0x1e')](_0x9a2c('0x17'),auth[_0x9a2c('0xc')](),controller[_0x9a2c('0x24')]);router['post'](_0x9a2c('0x18'),auth[_0x9a2c('0xc')](),controller[_0x9a2c('0x25')]);router[_0x9a2c('0x1e')](_0x9a2c('0x26'),auth[_0x9a2c('0xc')](),controller['send']);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x9a2c('0x27')]);router[_0x9a2c('0x28')](_0x9a2c('0xd'),auth[_0x9a2c('0xc')](),controller['update']);router[_0x9a2c('0x29')](_0x9a2c('0xf'),auth['isAuthenticated'](),controller[_0x9a2c('0x2a')]);router[_0x9a2c('0x29')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x9a2c('0x2b')]);router[_0x9a2c('0x29')](_0x9a2c('0x13'),auth[_0x9a2c('0xc')](),controller[_0x9a2c('0x2c')]);router[_0x9a2c('0x29')](_0x9a2c('0x15'),auth[_0x9a2c('0xc')](),controller[_0x9a2c('0x2d')]);router['delete'](_0x9a2c('0xd'),auth[_0x9a2c('0xc')](),controller[_0x9a2c('0x2e')]);router[_0x9a2c('0x29')](_0x9a2c('0x1c'),auth[_0x9a2c('0xc')](),controller[_0x9a2c('0x2f')]);module[_0x9a2c('0x30')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 7a9558d..cb85f7b 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 _0x237e=['INTEGER','TEXT','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','ENUM','gmail','hotmail','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif'];(function(_0xb4e2df,_0x1cbb7c){var _0x5e95ba=function(_0x79d317){while(--_0x79d317){_0xb4e2df['push'](_0xb4e2df['shift']());}};_0x5e95ba(++_0x1cbb7c);}(_0x237e,0x193));var _0xe237=function(_0x567073,_0x1ab9ab){_0x567073=_0x567073-0x0;var _0x222618=_0x237e[_0x567073];return _0x222618;};'use strict';var Sequelize=require(_0xe237('0x0'));module[_0xe237('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xe237('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xe237('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xe237('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xe237('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe237('0x4')},'fontSize':{'type':Sequelize[_0xe237('0x5')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xe237('0x6')],'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[_0xe237('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe237('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe237('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe237('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe237('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe237('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0xe237('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xe237('0x3')],'defaultValue':![],'comment':_0xe237('0x8'),'set':function(_0x3f201e){if(!_0x3f201e)this[_0xe237('0x9')]('mandatoryDispositionPauseId',null);this[_0xe237('0x9')]('mandatoryDisposition',_0x3f201e);}},'provider':{'type':Sequelize[_0xe237('0xa')](_0xe237('0xb'),_0xe237('0xc'),'yahoo',_0xe237('0xd')),'defaultValue':null,'get':function(){if(!this[_0xe237('0xe')]('provider'))return'custom';return this['getDataValue'](_0xe237('0xf'));},'set':function(_0x2f4815){if(_0x2f4815===_0xe237('0x10'))_0x2f4815=null;return this[_0xe237('0x9')](_0xe237('0xf'),_0x2f4815);}}}; \ No newline at end of file +var _0xadd3=['provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','ENUM','gmail','hotmail','yahoo','getDataValue'];(function(_0xf7b24f,_0x1bd51f){var _0x2b8d84=function(_0x2c06d0){while(--_0x2c06d0){_0xf7b24f['push'](_0xf7b24f['shift']());}};_0x2b8d84(++_0x1bd51f);}(_0xadd3,0x92));var _0x3add=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xadd3[_0x346737];return _0x1ade2e;};'use strict';var Sequelize=require(_0x3add('0x0'));module[_0x3add('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x3add('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x3add('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x3add('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x3add('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x3add('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x3add('0x4')]},'markAsUnread':{'type':Sequelize[_0x3add('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3add('0x5')},'fontSize':{'type':Sequelize[_0x3add('0x6')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x3add('0x4')],'defaultValue':function(){return _0x3add('0x7');}},'notificationSound':{'type':Sequelize[_0x3add('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3add('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3add('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3add('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3add('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3add('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3add('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x3add('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x90b229){if(!_0x90b229)this[_0x3add('0x9')](_0x3add('0xa'),null);this[_0x3add('0x9')]('mandatoryDisposition',_0x90b229);}},'provider':{'type':Sequelize[_0x3add('0xb')](_0x3add('0xc'),_0x3add('0xd'),_0x3add('0xe'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0x3add('0xf')](_0x3add('0x10')))return _0x3add('0x11');return this['getDataValue'](_0x3add('0x10'));},'set':function(_0x29db57){if(_0x29db57===_0x3add('0x11'))_0x29db57=null;return this[_0x3add('0x9')](_0x3add('0x10'),_0x29db57);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index e0bcc69..a007334 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 _0xe37a=['finally','getApplications','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','MailMessage','true','List','updatedAt','DESC','from','format','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','sendMail','Contacts','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','verifySmtp','CloudProvider','data5','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','destroy','get','MailAccounts','stack','name','send','index','MailServerIn','MailServerOut','Smtp','MailAccount','rawAttributes','fieldName','key','map','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','rows','catch','show','params','Imap','Pause','mandatoryDispositionPause','keys','includeAll','include','update','body','modernAuthentication','CloudProviderId','find','describe','MailAccountId','Disposition','create','getDispositions','findOne','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','provider','custom','email','ListId','isNil','active','description','user','username','pass','password','service','host','port','authentication','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','color','tag','addApplications','transaction','sequelize','Transaction','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll'];(function(_0x301837,_0x1acbc9){var _0x344a9a=function(_0x2c0c1a){while(--_0x2c0c1a){_0x301837['push'](_0x301837['shift']());}};_0x344a9a(++_0x1acbc9);}(_0xe37a,0x1b2));var _0xae37=function(_0x162773,_0x1689d2){_0x162773=_0x162773-0x0;var _0x127863=_0xe37a[_0x162773];return _0x127863;};'use strict';var moment=require(_0xae37('0x0'));var BPromise=require(_0xae37('0x1'));var util=require(_0xae37('0x2'));var path=require(_0xae37('0x3'));var _=require(_0xae37('0x4'));var juice=require(_0xae37('0x5'));var Redis=require(_0xae37('0x6'));var qs=require(_0xae37('0x7'));var logger=require(_0xae37('0x8'))(_0xae37('0x9'));var config=require(_0xae37('0xa'));var db=require(_0xae37('0xb'))['db'];config['redis']=_[_0xae37('0xc')](config['redis'],{'host':_0xae37('0xd'),'port':0x18eb});var socket=require(_0xae37('0xe'))(new Redis(config[_0xae37('0xf')]));require('./mailAccount.socket')[_0xae37('0x10')](socket);var jayson=require(_0xae37('0x11'));var client=jayson[_0xae37('0x12')][_0xae37('0x13')]({'port':0x232b});function respondWithRpcPromise(_0x2f77e0,_0x276752,_0x34772a,_0x22944a){return new BPromise(function(_0x90550c,_0x28f66d){var _0x5d7254=_0x22944a||client;return _0x5d7254[_0xae37('0x14')](_0x2f77e0,_0x34772a)[_0xae37('0x15')](function(_0xd9571d){logger[_0xae37('0x16')](_0xae37('0x17'),_0x276752,_0xae37('0x18'));logger[_0xae37('0x19')](_0xae37('0x1a'),_0x276752,_0xae37('0x18'),JSON[_0xae37('0x1b')](_0xd9571d));if(_0xd9571d['error']){if(_0xd9571d['error'][_0xae37('0x1c')]===0x1f4){logger[_0xae37('0x1d')](_0xae37('0x17'),_0x276752,_0xd9571d['error'][_0xae37('0x1e')]);return _0x28f66d(_0xd9571d[_0xae37('0x1d')][_0xae37('0x1e')]);}logger[_0xae37('0x1d')](_0xae37('0x17'),_0x276752,_0xd9571d[_0xae37('0x1d')]['message']);return _0x90550c(_0xd9571d['error'][_0xae37('0x1e')]);}else{logger[_0xae37('0x16')](_0xae37('0x17'),_0x276752,_0xae37('0x18'));_0x90550c(_0xd9571d['result'][_0xae37('0x1e')]);}})['catch'](function(_0x415a9c){logger[_0xae37('0x1d')]('MailAccount,\x20%s,\x20%s',_0x276752,_0x415a9c);_0x28f66d(_0x415a9c);});});}function respondWithStatusCode(_0xa1c124,_0x50c429){_0x50c429=_0x50c429||0xcc;return function(_0x546a6b){if(_0x546a6b){return _0xa1c124[_0xae37('0x1f')](_0x50c429);}return _0xa1c124[_0xae37('0x20')](_0x50c429)['end']();};}function respondWithResult(_0x35a2f3,_0x4d0dfe){_0x4d0dfe=_0x4d0dfe||0xc8;return function(_0x48e2ff){if(_0x48e2ff){return _0x35a2f3[_0xae37('0x20')](_0x4d0dfe)[_0xae37('0x21')](_0x48e2ff);}};}function respondWithFilteredResult(_0x3b73b7,_0x1d4266){return function(_0x52a9b8){if(_0x52a9b8){var _0x59c6e8=typeof _0x1d4266[_0xae37('0x22')]===_0xae37('0x23')&&typeof _0x1d4266[_0xae37('0x24')]===_0xae37('0x23');var _0x1641c3=_0x52a9b8['count'];var _0x5cee3d=_0x59c6e8?0x0:_0x1d4266[_0xae37('0x22')];var _0x17999f=_0x59c6e8?_0x52a9b8[_0xae37('0x25')]:_0x1d4266['offset']+_0x1d4266['limit'];var _0x34ddcf;if(_0x17999f>=_0x1641c3){_0x17999f=_0x1641c3;_0x34ddcf=0xc8;}else{_0x34ddcf=0xce;}_0x3b73b7[_0xae37('0x20')](_0x34ddcf);return _0x3b73b7[_0xae37('0x26')](_0xae37('0x27'),_0x5cee3d+'-'+_0x17999f+'/'+_0x1641c3)[_0xae37('0x21')](_0x52a9b8);}return null;};}function saveUpdates(_0x497c85){return function(_0x4b4ba7){if(_0x4b4ba7){return _0x4b4ba7['update'](_0x497c85)[_0xae37('0x15')](function(_0xa3ffe3){return _0xa3ffe3;});}return null;};}function removeEntity(_0x289b2a){return function(_0x6659bb){if(_0x6659bb){return _0x6659bb[_0xae37('0x28')]()[_0xae37('0x15')](function(){var _0x593f15=_0x6659bb[_0xae37('0x29')]({'plain':!![]});var _0x21e86d=_0xae37('0x2a');return db['UserProfileResource'][_0xae37('0x28')]({'where':{'type':_0x21e86d,'resourceId':_0x593f15['id']}})[_0xae37('0x15')](function(){return _0x6659bb;});})[_0xae37('0x15')](function(){_0x289b2a[_0xae37('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x603b2d){return function(_0x3552df){if(!_0x3552df){_0x603b2d['sendStatus'](0x194);}return _0x3552df;};}function handleError(_0x45f57b,_0xa58997){_0xa58997=_0xa58997||0x1f4;return function(_0x4a024d){logger[_0xae37('0x1d')](_0x4a024d[_0xae37('0x2b')]);if(_0x4a024d[_0xae37('0x2c')]){delete _0x4a024d[_0xae37('0x2c')];}_0x45f57b[_0xae37('0x20')](_0xa58997)[_0xae37('0x2d')](_0x4a024d);};}exports[_0xae37('0x2e')]=function(_0x2669ea,_0x553854){var _0x2803ec={'include':[{'model':db[_0xae37('0x2f')],'as':'Imap'},{'model':db[_0xae37('0x30')],'as':_0xae37('0x31')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2021bd={},_0x88d6f2={'count':0x0,'rows':[]};var _0x48a40a=_['map'](db[_0xae37('0x32')][_0xae37('0x33')],function(_0x425429){return{'name':_0x425429[_0xae37('0x34')],'type':_0x425429['type'][_0xae37('0x35')]};});_0x2021bd['model']=_[_0xae37('0x36')](_0x48a40a,_0xae37('0x2c'));_0x2021bd[_0xae37('0x37')]=_['keys'](_0x2669ea['query']);_0x2021bd[_0xae37('0x38')]=_['intersection'](_0x2021bd[_0xae37('0x39')],_0x2021bd[_0xae37('0x37')]);_0x2803ec[_0xae37('0x3a')]=_[_0xae37('0x3b')](_0x2021bd['model'],qs['fields'](_0x2669ea[_0xae37('0x37')][_0xae37('0x3c')]));_0x2803ec[_0xae37('0x3a')]=_0x2803ec[_0xae37('0x3a')][_0xae37('0x3d')]?_0x2803ec[_0xae37('0x3a')]:_0x2021bd[_0xae37('0x39')];if(!_0x2669ea['query'][_0xae37('0x3e')](_0xae37('0x3f'))){_0x2803ec[_0xae37('0x24')]=qs[_0xae37('0x24')](_0x2669ea[_0xae37('0x37')][_0xae37('0x24')]);_0x2803ec[_0xae37('0x22')]=qs[_0xae37('0x22')](_0x2669ea[_0xae37('0x37')]['offset']);}_0x2803ec[_0xae37('0x40')]=qs[_0xae37('0x41')](_0x2669ea[_0xae37('0x37')][_0xae37('0x41')]);_0x2803ec[_0xae37('0x42')]=qs[_0xae37('0x38')](_[_0xae37('0x43')](_0x2669ea[_0xae37('0x37')],_0x2021bd[_0xae37('0x38')]),_0x48a40a);if(_0x2669ea['query'][_0xae37('0x44')]){_0x2803ec['where']=_[_0xae37('0x45')](_0x2803ec[_0xae37('0x42')],{'$or':_['map'](_0x48a40a,function(_0x4d1e0a){if(_0x4d1e0a[_0xae37('0x46')]!==_0xae37('0x47')){var _0x3a0756={};_0x3a0756[_0x4d1e0a[_0xae37('0x2c')]]={'$like':'%'+_0x2669ea[_0xae37('0x37')][_0xae37('0x44')]+'%'};return _0x3a0756;}})});}_0x2803ec=_[_0xae37('0x45')]({},_0x2803ec,_0x2669ea[_0xae37('0x48')]);var _0x5b5f7e={'where':_0x2803ec[_0xae37('0x42')]};return db[_0xae37('0x32')][_0xae37('0x25')](_0x5b5f7e)[_0xae37('0x15')](function(_0x49faea){_0x88d6f2[_0xae37('0x25')]=_0x49faea;if(_0x2669ea[_0xae37('0x37')]['includeAll']){_0x2803ec['include']=[{'all':!![]}];}return db[_0xae37('0x32')][_0xae37('0x49')](_0x2803ec);})[_0xae37('0x15')](function(_0xa8e78f){_0x88d6f2[_0xae37('0x4a')]=_0xa8e78f;return _0x88d6f2;})[_0xae37('0x15')](respondWithFilteredResult(_0x553854,_0x2803ec))[_0xae37('0x4b')](handleError(_0x553854,null));};exports[_0xae37('0x4c')]=function(_0x1a053d,_0x744cc8){var _0x30ca91={'raw':![],'where':{'id':_0x1a053d[_0xae37('0x4d')]['id']},'include':[{'model':db[_0xae37('0x2f')],'as':_0xae37('0x4e')},{'model':db[_0xae37('0x30')],'as':'Smtp'},{'model':db[_0xae37('0x4f')],'as':_0xae37('0x50')}]},_0x37b9a2={};_0x37b9a2[_0xae37('0x39')]=_[_0xae37('0x51')](db['MailAccount'][_0xae37('0x33')]);_0x37b9a2['query']=_[_0xae37('0x51')](_0x1a053d[_0xae37('0x37')]);_0x37b9a2[_0xae37('0x38')]=_['intersection'](_0x37b9a2[_0xae37('0x39')],_0x37b9a2[_0xae37('0x37')]);_0x30ca91[_0xae37('0x3a')]=_[_0xae37('0x3b')](_0x37b9a2[_0xae37('0x39')],qs[_0xae37('0x3c')](_0x1a053d[_0xae37('0x37')][_0xae37('0x3c')]));_0x30ca91[_0xae37('0x3a')]=_0x30ca91[_0xae37('0x3a')][_0xae37('0x3d')]?_0x30ca91[_0xae37('0x3a')]:_0x37b9a2[_0xae37('0x39')];if(_0x1a053d[_0xae37('0x37')][_0xae37('0x52')]){_0x30ca91[_0xae37('0x53')]=[{'all':!![]}];}_0x30ca91=_['merge']({},_0x30ca91,_0x1a053d[_0xae37('0x48')]);return db[_0xae37('0x32')]['find'](_0x30ca91)[_0xae37('0x15')](handleEntityNotFound(_0x744cc8,null))[_0xae37('0x15')](respondWithResult(_0x744cc8,null))['catch'](handleError(_0x744cc8,null));};exports[_0xae37('0x54')]=function(_0x2418a9,_0x3ba07a){if(_0x2418a9[_0xae37('0x55')]['id']){delete _0x2418a9[_0xae37('0x55')]['id'];}if(_0x2418a9['body'][_0xae37('0x4e')]){if(!_0x2418a9[_0xae37('0x55')]['Imap'][_0xae37('0x56')]){_0x2418a9['body']['Imap'][_0xae37('0x57')]=null;}}if(_0x2418a9[_0xae37('0x55')][_0xae37('0x31')]){if(!_0x2418a9[_0xae37('0x55')]['Smtp'][_0xae37('0x56')]){_0x2418a9['body'][_0xae37('0x31')]['CloudProviderId']=null;}}return db[_0xae37('0x32')][_0xae37('0x58')]({'where':{'id':_0x2418a9['params']['id']},'include':[{'model':db[_0xae37('0x2f')],'as':'Imap'},{'model':db[_0xae37('0x30')],'as':_0xae37('0x31')},{'model':db[_0xae37('0x4f')],'as':_0xae37('0x50')}]})[_0xae37('0x15')](handleEntityNotFound(_0x3ba07a,null))[_0xae37('0x15')](saveUpdates(_0x2418a9['body'],null))[_0xae37('0x15')](function(_0xc45791){if(_0xc45791&&_0x2418a9[_0xae37('0x55')][_0xae37('0x4e')]){return db[_0xae37('0x2f')][_0xae37('0x54')](_0x2418a9[_0xae37('0x55')][_0xae37('0x4e')],{'where':{'MailAccountId':_0xc45791['id']}})['then'](function(){return _0xc45791;});}return _0xc45791;})[_0xae37('0x15')](function(_0x205110){if(_0x205110&&_0x2418a9[_0xae37('0x55')][_0xae37('0x31')]){return db['MailServerOut'][_0xae37('0x54')](_0x2418a9['body'][_0xae37('0x31')],{'where':{'MailAccountId':_0x205110['id']}})[_0xae37('0x15')](function(){return _0x205110;});}return _0x205110;})[_0xae37('0x15')](respondWithResult(_0x3ba07a,null))[_0xae37('0x4b')](handleError(_0x3ba07a,null));};exports['describe']=function(_0x2135be,_0x13310a){return db[_0xae37('0x32')][_0xae37('0x59')]()['then'](respondWithResult(_0x13310a,null))[_0xae37('0x4b')](handleError(_0x13310a,null));};exports['addDisposition']=function(_0x5487f9,_0xcc344d){if(_0x5487f9['body']['id']){delete _0x5487f9[_0xae37('0x55')]['id'];}return db[_0xae37('0x32')][_0xae37('0x58')]({'where':{'id':_0x5487f9[_0xae37('0x4d')]['id']}})['then'](handleEntityNotFound(_0xcc344d,null))[_0xae37('0x15')](function(_0x3c7e8f){if(_0x3c7e8f){_0x5487f9[_0xae37('0x55')][_0xae37('0x5a')]=_0x3c7e8f['id'];return db[_0xae37('0x5b')][_0xae37('0x5c')](_0x5487f9[_0xae37('0x55')]);}})[_0xae37('0x15')](respondWithResult(_0xcc344d,null))[_0xae37('0x4b')](handleError(_0xcc344d,null));};exports[_0xae37('0x5d')]=function(_0x302e5d,_0x6ced7f){var _0xdcc1c1={'raw':![],'where':{}};var _0x45e389={};var _0x461b56={'count':0x0,'rows':[]};return db['MailAccount'][_0xae37('0x5e')]({'where':{'id':_0x302e5d['params']['id']}})[_0xae37('0x15')](handleEntityNotFound(_0x6ced7f,null))[_0xae37('0x15')](function(_0x5b163d){if(_0x5b163d){_0x45e389[_0xae37('0x39')]=_[_0xae37('0x51')](db['Disposition'][_0xae37('0x33')]);_0x45e389['query']=_[_0xae37('0x51')](_0x302e5d['query']);_0x45e389[_0xae37('0x38')]=_[_0xae37('0x3b')](_0x45e389[_0xae37('0x39')],_0x45e389[_0xae37('0x37')]);_0xdcc1c1['attributes']=_[_0xae37('0x3b')](_0x45e389[_0xae37('0x39')],qs['fields'](_0x302e5d[_0xae37('0x37')][_0xae37('0x3c')]));_0xdcc1c1[_0xae37('0x3a')]=_0xdcc1c1[_0xae37('0x3a')][_0xae37('0x3d')]?_0xdcc1c1[_0xae37('0x3a')]:_0x45e389['model'];if(!_0x302e5d[_0xae37('0x37')][_0xae37('0x3e')](_0xae37('0x3f'))){_0xdcc1c1[_0xae37('0x24')]=qs[_0xae37('0x24')](_0x302e5d[_0xae37('0x37')][_0xae37('0x24')]);_0xdcc1c1['offset']=qs[_0xae37('0x22')](_0x302e5d['query'][_0xae37('0x22')]);}_0xdcc1c1['order']=qs[_0xae37('0x41')](_0x302e5d[_0xae37('0x37')][_0xae37('0x41')]);_0xdcc1c1['where']=qs['filters'](_['pick'](_0x302e5d[_0xae37('0x37')],_0x45e389['filters']));_0xdcc1c1[_0xae37('0x42')][_0xae37('0x5a')]=_0x5b163d['id'];if(_0x302e5d[_0xae37('0x37')][_0xae37('0x44')]){_0xdcc1c1[_0xae37('0x42')]=_[_0xae37('0x45')](_0xdcc1c1[_0xae37('0x42')],{'$or':_[_0xae37('0x36')](_0xdcc1c1[_0xae37('0x3a')],function(_0x457f8f){var _0x50341c={};_0x50341c[_0x457f8f]={'$like':'%'+_0x302e5d[_0xae37('0x37')]['filter']+'%'};return _0x50341c;})});}_0xdcc1c1=_[_0xae37('0x45')]({},_0xdcc1c1,_0x302e5d['options']);return db[_0xae37('0x5b')]['count']({'where':_0xdcc1c1['where']})[_0xae37('0x15')](function(_0x597ae6){_0x461b56[_0xae37('0x25')]=_0x597ae6;if(_0x302e5d[_0xae37('0x37')][_0xae37('0x52')]){_0xdcc1c1[_0xae37('0x53')]=[{'all':!![]}];}return db[_0xae37('0x5b')]['findAll'](_0xdcc1c1);})['then'](function(_0x206326){_0x461b56[_0xae37('0x4a')]=_0x206326;return _0x461b56;});}})[_0xae37('0x15')](respondWithFilteredResult(_0x6ced7f,_0xdcc1c1))['catch'](handleError(_0x6ced7f,null));};exports['removeDispositions']=function(_0x1c6501,_0x4e2083){return db[_0xae37('0x32')][_0xae37('0x58')]({'where':{'id':_0x1c6501[_0xae37('0x4d')]['id']}})[_0xae37('0x15')](handleEntityNotFound(_0x4e2083,null))['then'](function(_0x22bcca){if(_0x22bcca){return _0x22bcca[_0xae37('0x5f')](_0x1c6501['query'][_0xae37('0x60')]);}})[_0xae37('0x15')](respondWithStatusCode(_0x4e2083,null))[_0xae37('0x4b')](handleError(_0x4e2083,null));};exports[_0xae37('0x61')]=function(_0x417aa8,_0x435124){if(_0x417aa8['body']['id']){delete _0x417aa8[_0xae37('0x55')]['id'];}return db[_0xae37('0x32')][_0xae37('0x58')]({'where':{'id':_0x417aa8['params']['id']}})['then'](handleEntityNotFound(_0x435124,null))['then'](function(_0x4767eb){if(_0x4767eb){_0x417aa8[_0xae37('0x55')][_0xae37('0x5a')]=_0x4767eb['id'];return db['CannedAnswer'][_0xae37('0x5c')](_0x417aa8[_0xae37('0x55')]);}})[_0xae37('0x15')](respondWithResult(_0x435124,null))[_0xae37('0x4b')](handleError(_0x435124,null));};exports[_0xae37('0x62')]=function(_0x58ee4c,_0x389f37){var _0x164bed={'raw':![],'where':{}};var _0x5c9de0={};var _0x577159={'count':0x0,'rows':[]};return db[_0xae37('0x32')][_0xae37('0x5e')]({'where':{'id':_0x58ee4c[_0xae37('0x4d')]['id']}})[_0xae37('0x15')](handleEntityNotFound(_0x389f37,null))[_0xae37('0x15')](function(_0x46b569){if(_0x46b569){_0x5c9de0[_0xae37('0x39')]=_[_0xae37('0x51')](db['CannedAnswer'][_0xae37('0x33')]);_0x5c9de0[_0xae37('0x37')]=_[_0xae37('0x51')](_0x58ee4c['query']);_0x5c9de0[_0xae37('0x38')]=_[_0xae37('0x3b')](_0x5c9de0['model'],_0x5c9de0[_0xae37('0x37')]);_0x164bed['attributes']=_[_0xae37('0x3b')](_0x5c9de0[_0xae37('0x39')],qs[_0xae37('0x3c')](_0x58ee4c[_0xae37('0x37')][_0xae37('0x3c')]));_0x164bed[_0xae37('0x3a')]=_0x164bed['attributes'][_0xae37('0x3d')]?_0x164bed[_0xae37('0x3a')]:_0x5c9de0[_0xae37('0x39')];if(!_0x58ee4c[_0xae37('0x37')][_0xae37('0x3e')](_0xae37('0x3f'))){_0x164bed[_0xae37('0x24')]=qs[_0xae37('0x24')](_0x58ee4c[_0xae37('0x37')][_0xae37('0x24')]);_0x164bed['offset']=qs['offset'](_0x58ee4c[_0xae37('0x37')]['offset']);}_0x164bed[_0xae37('0x40')]=qs['sort'](_0x58ee4c[_0xae37('0x37')][_0xae37('0x41')]);_0x164bed['where']=qs[_0xae37('0x38')](_[_0xae37('0x43')](_0x58ee4c['query'],_0x5c9de0['filters']));_0x164bed[_0xae37('0x42')][_0xae37('0x5a')]=_0x46b569['id'];if(_0x58ee4c[_0xae37('0x37')][_0xae37('0x44')]){_0x164bed[_0xae37('0x42')]=_[_0xae37('0x45')](_0x164bed[_0xae37('0x42')],{'$or':_[_0xae37('0x36')](_0x164bed[_0xae37('0x3a')],function(_0x3c1c0d){var _0x1f4dfb={};_0x1f4dfb[_0x3c1c0d]={'$like':'%'+_0x58ee4c['query'][_0xae37('0x44')]+'%'};return _0x1f4dfb;})});}_0x164bed=_['merge']({},_0x164bed,_0x58ee4c[_0xae37('0x48')]);return db[_0xae37('0x63')][_0xae37('0x25')]({'where':_0x164bed[_0xae37('0x42')]})[_0xae37('0x15')](function(_0x1d010a){_0x577159['count']=_0x1d010a;if(_0x58ee4c['query'][_0xae37('0x52')]){_0x164bed[_0xae37('0x53')]=[{'all':!![]}];}return db[_0xae37('0x63')][_0xae37('0x49')](_0x164bed);})[_0xae37('0x15')](function(_0x49a492){_0x577159[_0xae37('0x4a')]=_0x49a492;return _0x577159;});}})[_0xae37('0x15')](respondWithFilteredResult(_0x389f37,_0x164bed))[_0xae37('0x4b')](handleError(_0x389f37,null));};exports['removeAnswers']=function(_0x2cd1e0,_0x2e9b8f){return db['MailAccount'][_0xae37('0x58')]({'where':{'id':_0x2cd1e0['params']['id']}})[_0xae37('0x15')](handleEntityNotFound(_0x2e9b8f,null))[_0xae37('0x15')](function(_0x2c8357){if(_0x2c8357){return _0x2c8357[_0xae37('0x64')](_0x2cd1e0[_0xae37('0x37')]['ids']);}})[_0xae37('0x15')](respondWithStatusCode(_0x2e9b8f,null))[_0xae37('0x4b')](handleError(_0x2e9b8f,null));};exports['create']=function(_0x2ab031,_0x36f99f){var _0x47a284={'name':_0x2ab031['body'][_0xae37('0x2c')],'key':_0x2ab031['body']['key'],'provider':_0x2ab031[_0xae37('0x55')][_0xae37('0x65')]===_0xae37('0x66')?null:_0x2ab031[_0xae37('0x55')][_0xae37('0x65')],'email':_0x2ab031[_0xae37('0x55')][_0xae37('0x67')],'ListId':_0x2ab031[_0xae37('0x55')][_0xae37('0x68')],'active':!_[_0xae37('0x69')](_0x2ab031[_0xae37('0x55')]['active'])?_0x2ab031['body'][_0xae37('0x6a')]:!![],'description':_0x2ab031[_0xae37('0x55')][_0xae37('0x6b')]||null,'Imap':{},'Smtp':{}};if(_0x47a284[_0xae37('0x65')]){_0x47a284['Imap'][_0xae37('0x6c')]=_0x47a284[_0xae37('0x31')][_0xae37('0x6c')]=_0x2ab031['body'][_0xae37('0x6d')];_0x47a284[_0xae37('0x4e')]['password']=_0x47a284['Smtp'][_0xae37('0x6e')]=_0x2ab031['body'][_0xae37('0x6f')];if(_0x2ab031[_0xae37('0x55')]['modernAuthentication']){_0x47a284[_0xae37('0x4e')]['modernAuthentication']=_0x47a284[_0xae37('0x31')][_0xae37('0x56')]=!![];_0x47a284[_0xae37('0x4e')][_0xae37('0x57')]=_0x47a284['Smtp'][_0xae37('0x57')]=_0x2ab031[_0xae37('0x55')][_0xae37('0x57')];_0x47a284[_0xae37('0x4e')][_0xae37('0x6f')]=_0x47a284[_0xae37('0x31')]['pass']=null;}else{_0x47a284[_0xae37('0x4e')][_0xae37('0x57')]=_0x47a284[_0xae37('0x31')][_0xae37('0x57')]=null;}_0x47a284[_0xae37('0x4e')][_0xae37('0x70')]=_0x47a284[_0xae37('0x31')][_0xae37('0x70')]=null;_0x47a284['Imap'][_0xae37('0x71')]=_0x47a284['Smtp'][_0xae37('0x71')]=null;_0x47a284[_0xae37('0x4e')][_0xae37('0x72')]=_0x47a284[_0xae37('0x31')][_0xae37('0x72')]=null;}else{if(_0x2ab031[_0xae37('0x55')][_0xae37('0x73')]){_0x47a284['Imap'][_0xae37('0x6c')]=_0x47a284[_0xae37('0x31')][_0xae37('0x6c')]=_0x2ab031['body'][_0xae37('0x6d')];_0x47a284[_0xae37('0x4e')]['password']=_0x47a284['Smtp'][_0xae37('0x6e')]=_0x2ab031[_0xae37('0x55')][_0xae37('0x6f')];}else{_0x47a284[_0xae37('0x4e')][_0xae37('0x73')]=_0x47a284[_0xae37('0x31')]['authentication']=![];_0x47a284['Imap']['user']=_0x47a284['Smtp']['user']=null;_0x47a284[_0xae37('0x4e')]['password']=_0x47a284[_0xae37('0x31')][_0xae37('0x6e')]=null;}_0x47a284[_0xae37('0x4e')][_0xae37('0x71')]=_0x2ab031[_0xae37('0x55')]['Imap'][_0xae37('0x71')];_0x47a284[_0xae37('0x4e')][_0xae37('0x72')]=_0x2ab031[_0xae37('0x55')][_0xae37('0x4e')]['port'];_0x47a284['Smtp'][_0xae37('0x71')]=_0x2ab031['body'][_0xae37('0x31')][_0xae37('0x71')];_0x47a284['Smtp']['port']=_0x2ab031['body'][_0xae37('0x31')][_0xae37('0x72')];}return db[_0xae37('0x32')][_0xae37('0x5c')](_0x47a284,{'include':[{'model':db[_0xae37('0x30')],'as':_0xae37('0x31')},{'model':db[_0xae37('0x2f')],'as':_0xae37('0x4e')}]})[_0xae37('0x15')](function(_0x5f40fa){var _0x25b13d=_0x2ab031[_0xae37('0x6c')][_0xae37('0x29')]({'plain':!![]});if(!_0x25b13d)throw new Error(_0xae37('0x74'));if(_0x25b13d[_0xae37('0x75')]===_0xae37('0x6c')){var _0x301216=_0x5f40fa[_0xae37('0x29')]({'plain':!![]});return db[_0xae37('0x76')][_0xae37('0x58')]({'where':{'name':_0xae37('0x2a'),'userProfileId':_0x25b13d[_0xae37('0x77')]},'raw':!![]})[_0xae37('0x15')](function(_0x437b56){if(_0x437b56&&_0x437b56['autoAssociation']===0x0){return db[_0xae37('0x78')][_0xae37('0x5c')]({'name':_0x301216[_0xae37('0x2c')],'resourceId':_0x301216['id'],'type':_0x437b56[_0xae37('0x2c')],'sectionId':_0x437b56['id']},{})[_0xae37('0x15')](function(){return _0x5f40fa;});}else{return _0x5f40fa;}})[_0xae37('0x4b')](function(_0x4e3311){logger['error'](_0xae37('0x79'),_0x4e3311);throw _0x4e3311;});}return _0x5f40fa;})[_0xae37('0x15')](respondWithResult(_0x36f99f,0xc9))[_0xae37('0x4b')](handleError(_0x36f99f,null));};exports[_0xae37('0x7a')]=function(_0x1c0922,_0x2d6055){return db[_0xae37('0x32')][_0xae37('0x5e')]({'where':{'id':_0x1c0922[_0xae37('0x4d')]['id']}})[_0xae37('0x15')](handleEntityNotFound(_0x2d6055,null))[_0xae37('0x15')](function(_0xf3f57d){if(_0xf3f57d){return _0xf3f57d['getImap']();}return null;})[_0xae37('0x15')](respondWithResult(_0x2d6055,null))[_0xae37('0x4b')](handleError(_0x2d6055,null));};exports[_0xae37('0x7b')]=function(_0x2f4379,_0xde52bf){if(_0x2f4379[_0xae37('0x55')]['id']){delete _0x2f4379[_0xae37('0x55')]['id'];}return db[_0xae37('0x32')][_0xae37('0x58')]({'where':{'id':_0x2f4379[_0xae37('0x4d')]['id']}})[_0xae37('0x15')](handleEntityNotFound(_0xde52bf,null))['then'](function(_0x29d59d){if(_0x29d59d){_0x2f4379[_0xae37('0x55')][_0xae37('0x5a')]=_0x29d59d['id'];return db[_0xae37('0x2f')]['create'](_0x2f4379['body']);}})[_0xae37('0x15')](respondWithResult(_0xde52bf,null))[_0xae37('0x4b')](handleError(_0xde52bf,null));};exports['removeImap']=function(_0x1e23f7,_0x3a2a8a){return db[_0xae37('0x32')][_0xae37('0x5e')]({'where':{'id':_0x1e23f7[_0xae37('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3a2a8a,null))[_0xae37('0x15')](function(_0x214b37){if(_0x214b37){return _0x214b37[_0xae37('0x7c')](null);}return null;})[_0xae37('0x15')](respondWithStatusCode(_0x3a2a8a,null))[_0xae37('0x4b')](handleError(_0x3a2a8a,null));};exports[_0xae37('0x7d')]=function(_0x333d76,_0x2399c6){return db[_0xae37('0x32')][_0xae37('0x5e')]({'where':{'id':_0x333d76[_0xae37('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2399c6,null))[_0xae37('0x15')](function(_0x40608d){if(_0x40608d){return _0x40608d['getSmtp']();}return null;})['then'](respondWithResult(_0x2399c6,null))[_0xae37('0x4b')](handleError(_0x2399c6,null));};exports['addSmtp']=function(_0x4f7e97,_0x1b2112){if(_0x4f7e97[_0xae37('0x55')]['id']){delete _0x4f7e97['body']['id'];}return db[_0xae37('0x32')]['find']({'where':{'id':_0x4f7e97[_0xae37('0x4d')]['id']}})[_0xae37('0x15')](handleEntityNotFound(_0x1b2112,null))[_0xae37('0x15')](function(_0x22ec14){if(_0x22ec14){_0x4f7e97[_0xae37('0x55')][_0xae37('0x5a')]=_0x22ec14['id'];return db[_0xae37('0x30')]['create'](_0x4f7e97['body']);}})['then'](respondWithResult(_0x1b2112,null))[_0xae37('0x4b')](handleError(_0x1b2112,null));};exports[_0xae37('0x7e')]=function(_0x3669cd,_0x2f1dd4){return db['MailAccount'][_0xae37('0x5e')]({'where':{'id':_0x3669cd[_0xae37('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2f1dd4,null))['then'](function(_0x4dc780){if(_0x4dc780){return _0x4dc780[_0xae37('0x7f')](null);}return null;})['then'](respondWithStatusCode(_0x2f1dd4,null))[_0xae37('0x4b')](handleError(_0x2f1dd4,null));};exports[_0xae37('0x80')]=function(_0x5ebcb4,_0x110d16){return db[_0xae37('0x81')][_0xae37('0x58')]({'where':{'id':_0x5ebcb4[_0xae37('0x4d')]['id']}})[_0xae37('0x15')](handleEntityNotFound(_0x110d16,null))[_0xae37('0x15')](function(_0x45bf0d){if(_0x45bf0d){return _0x45bf0d[_0xae37('0x80')](_0x5ebcb4[_0xae37('0x55')][_0xae37('0x60')],_['omit'](_0x5ebcb4[_0xae37('0x55')],[_0xae37('0x60'),'id'])||{});}})[_0xae37('0x15')](respondWithResult(_0x110d16,null))[_0xae37('0x4b')](handleError(_0x110d16,null));};exports[_0xae37('0x82')]=function(_0x16b401,_0xd68ea8){var _0x25e57e={'raw':![],'where':{}};var _0x4e2d07={};var _0x14b2f9={'count':0x0,'rows':[]};return db[_0xae37('0x32')]['findOne']({'where':{'id':_0x16b401[_0xae37('0x4d')]['id']}})[_0xae37('0x15')](handleEntityNotFound(_0xd68ea8,null))[_0xae37('0x15')](function(_0x1284bf){if(_0x1284bf){_0x4e2d07[_0xae37('0x39')]=_['keys'](db[_0xae37('0x81')][_0xae37('0x33')]);_0x4e2d07['query']=_['keys'](_0x16b401['query']);_0x4e2d07[_0xae37('0x38')]=_['intersection'](_0x4e2d07[_0xae37('0x39')],_0x4e2d07['query']);_0x25e57e[_0xae37('0x3a')]=_[_0xae37('0x3b')](_0x4e2d07[_0xae37('0x39')],qs['fields'](_0x16b401['query']['fields']));_0x25e57e[_0xae37('0x3a')]=_0x25e57e[_0xae37('0x3a')][_0xae37('0x3d')]?_0x25e57e['attributes']:_0x4e2d07['model'];if(!_0x16b401[_0xae37('0x37')][_0xae37('0x3e')]('nolimit')){_0x25e57e[_0xae37('0x24')]=qs[_0xae37('0x24')](_0x16b401['query']['limit']);_0x25e57e[_0xae37('0x22')]=qs[_0xae37('0x22')](_0x16b401[_0xae37('0x37')][_0xae37('0x22')]);}_0x25e57e[_0xae37('0x40')]=qs[_0xae37('0x41')](_0x16b401['query']['sort']);_0x25e57e[_0xae37('0x42')]=qs['filters'](_[_0xae37('0x43')](_0x16b401[_0xae37('0x37')],_0x4e2d07['filters']));_0x25e57e['where'][_0xae37('0x5a')]=_0x1284bf['id'];if(_0x16b401[_0xae37('0x37')][_0xae37('0x44')]){_0x25e57e[_0xae37('0x42')]=_[_0xae37('0x45')](_0x25e57e['where'],{'$or':_['map'](_0x25e57e[_0xae37('0x3a')],function(_0x29b15d){var _0xd2da48={};_0xd2da48[_0x29b15d]={'$like':'%'+_0x16b401['query']['filter']+'%'};return _0xd2da48;})});}_0x25e57e=_[_0xae37('0x45')]({},_0x25e57e,_0x16b401[_0xae37('0x48')]);return db[_0xae37('0x81')][_0xae37('0x25')]({'where':_0x25e57e[_0xae37('0x42')]})[_0xae37('0x15')](function(_0x514a5e){_0x14b2f9[_0xae37('0x25')]=_0x514a5e;if(_0x16b401['query']['includeAll']){_0x25e57e[_0xae37('0x53')]=[{'model':db[_0xae37('0x83')],'as':_0xae37('0x84'),'required':![]},{'model':db[_0xae37('0x85')],'as':_0xae37('0x86'),'attributes':[_0xae37('0x2c'),_0xae37('0x87'),_0xae37('0x88')],'required':![]},{'model':db[_0xae37('0x89')],'as':'Tags','attributes':['id','name',_0xae37('0x8a')],'where':_0x16b401[_0xae37('0x37')]['tag']?{'id':_0x16b401[_0xae37('0x37')]['tag']}:undefined,'required':_0x16b401['query'][_0xae37('0x8b')]?!![]:![]}];}return db[_0xae37('0x81')][_0xae37('0x49')](_0x25e57e);})[_0xae37('0x15')](function(_0x471509){_0x14b2f9[_0xae37('0x4a')]=_0x471509;return _0x14b2f9;});}})[_0xae37('0x15')](respondWithFilteredResult(_0xd68ea8,_0x25e57e))[_0xae37('0x4b')](handleError(_0xd68ea8,null));};exports[_0xae37('0x8c')]=function addApplications(_0x5e890f,_0x1772d9){var _0x4a852f=_0x5e890f['params']['id'];var _0x3fe97d=_0x5e890f[_0xae37('0x55')];var _0x2f1cc5=0xc8;var _0x5c26ce=null;return db['sequelize'][_0xae37('0x8d')]({'isolationLevel':db[_0xae37('0x8e')][_0xae37('0x8f')]['ISOLATION_LEVELS'][_0xae37('0x90')]},function(_0x57acfa){return db[_0xae37('0x32')]['findOne']({'where':{'id':_0x4a852f},'transaction':_0x57acfa})[_0xae37('0x15')](function(_0x22d1c4){if(_0x22d1c4){return db[_0xae37('0x91')][_0xae37('0x28')]({'where':{'MailAccountId':_0x4a852f},'transaction':_0x57acfa})['then'](function(){var _0x3d9263=_[_0xae37('0x36')](_0x3fe97d,function(_0x306afc){_0x306afc[_0xae37('0x5a')]=_0x4a852f;return _0x306afc;});return db[_0xae37('0x91')][_0xae37('0x92')](_0x3d9263,{'transaction':_0x57acfa});});}else{_0x2f1cc5=0x194;_0x5c26ce=[];}});})[_0xae37('0x15')](function(){if(_0x2f1cc5!==0x194){return db['MailApplication'][_0xae37('0x93')]({'where':{'MailAccountId':_0x4a852f},'order':'priority'})[_0xae37('0x15')](function(_0x258d2f){_0x5c26ce=_0x258d2f;});}})[_0xae37('0x4b')](function(_0x290394){_0x2f1cc5=0x1f4;logger[_0xae37('0x1d')](_0x290394['stack']);if(_0x290394['name']){delete _0x290394[_0xae37('0x2c')];}_0x5c26ce=_0x290394;})[_0xae37('0x94')](function(){if(_0x5c26ce===null){_0x1772d9[_0xae37('0x1f')](_0x2f1cc5);}else{if(_0x2f1cc5===0x1f4){_0x1772d9[_0xae37('0x20')](_0x2f1cc5)[_0xae37('0x2d')](_0x5c26ce);}else{_0x1772d9[_0xae37('0x20')](_0x2f1cc5)[_0xae37('0x21')](_0x5c26ce);}}});};exports[_0xae37('0x95')]=function(_0x4e5547,_0x4a214e){var _0x195d6c={};var _0x191478={};var _0x4e20b9;var _0xf505eb;return db[_0xae37('0x32')]['findOne']({'where':{'id':_0x4e5547[_0xae37('0x4d')]['id']}})[_0xae37('0x15')](handleEntityNotFound(_0x4a214e,null))['then'](function(_0x51bda5){if(_0x51bda5){_0x4e20b9=_0x51bda5;_0x191478['model']=_[_0xae37('0x51')](db[_0xae37('0x91')]['rawAttributes']);_0x191478['query']=_[_0xae37('0x51')](_0x4e5547[_0xae37('0x37')]);_0x191478[_0xae37('0x38')]=_['intersection'](_0x191478['model'],_0x191478['query']);_0x195d6c[_0xae37('0x3a')]=_[_0xae37('0x3b')](_0x191478[_0xae37('0x39')],qs['fields'](_0x4e5547['query'][_0xae37('0x3c')]));_0x195d6c['attributes']=_0x195d6c[_0xae37('0x3a')][_0xae37('0x3d')]?_0x195d6c['attributes']:_0x191478[_0xae37('0x39')];_0x195d6c[_0xae37('0x40')]=qs[_0xae37('0x41')](_0x4e5547[_0xae37('0x37')][_0xae37('0x41')]);_0x195d6c[_0xae37('0x42')]=qs[_0xae37('0x38')](_['pick'](_0x4e5547[_0xae37('0x37')],_0x191478[_0xae37('0x38')]));if(_0x4e5547[_0xae37('0x37')]['filter']){_0x195d6c[_0xae37('0x42')]=_['merge'](_0x195d6c['where'],{'$or':_[_0xae37('0x36')](_0x195d6c[_0xae37('0x3a')],function(_0x4fdf11){var _0x4b0b7c={};_0x4b0b7c[_0x4fdf11]={'$like':'%'+_0x4e5547[_0xae37('0x37')][_0xae37('0x44')]+'%'};return _0x4b0b7c;})});}_0x195d6c=_[_0xae37('0x45')]({},_0x195d6c,_0x4e5547[_0xae37('0x48')]);return _0x4e20b9['getApplications'](_0x195d6c);}})['then'](function(_0xaf11b5){if(_0xaf11b5){_0xf505eb=_0xaf11b5['length'];if(!_0x4e5547[_0xae37('0x37')][_0xae37('0x3e')]('nolimit')){_0x195d6c['limit']=qs['limit'](_0x4e5547[_0xae37('0x37')][_0xae37('0x24')]);_0x195d6c[_0xae37('0x22')]=qs[_0xae37('0x22')](_0x4e5547[_0xae37('0x37')][_0xae37('0x22')]);}return _0x4e20b9['getApplications'](_0x195d6c);}})[_0xae37('0x15')](function(_0x32ccd9){if(_0x32ccd9){return _0x32ccd9?{'count':_0xf505eb,'rows':_0x32ccd9}:null;}})[_0xae37('0x15')](respondWithResult(_0x4a214e,null))[_0xae37('0x4b')](handleError(_0x4a214e,null));};exports[_0xae37('0x96')]=function(_0x2f8181,_0x3ddc16){var _0x160eb0={'raw':!![],'where':{}};var _0x2ef3eb={};var _0xff0ca={'count':0x0,'rows':[]};return db[_0xae37('0x32')][_0xae37('0x5e')]({'where':{'id':_0x2f8181[_0xae37('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3ddc16,null))[_0xae37('0x15')](function(_0x3a22cf){if(_0x3a22cf){_0x2ef3eb['model']=_['keys'](db['MailMessage']['rawAttributes']);_0x2ef3eb[_0xae37('0x37')]=_[_0xae37('0x51')](_0x2f8181[_0xae37('0x37')]);_0x2ef3eb[_0xae37('0x38')]=_[_0xae37('0x3b')](_0x2ef3eb[_0xae37('0x39')],_0x2ef3eb['query']);_0x160eb0[_0xae37('0x3a')]=_['intersection'](_0x2ef3eb['model'],qs[_0xae37('0x3c')](_0x2f8181[_0xae37('0x37')][_0xae37('0x3c')]));_0x160eb0[_0xae37('0x3a')]=_0x160eb0[_0xae37('0x3a')][_0xae37('0x3d')]?_0x160eb0[_0xae37('0x3a')]:_0x2ef3eb[_0xae37('0x39')];if(!_0x2f8181[_0xae37('0x37')][_0xae37('0x3e')](_0xae37('0x3f'))){_0x160eb0[_0xae37('0x24')]=qs['limit'](_0x2f8181[_0xae37('0x37')][_0xae37('0x24')]);_0x160eb0[_0xae37('0x22')]=qs[_0xae37('0x22')](_0x2f8181[_0xae37('0x37')][_0xae37('0x22')]);}_0x160eb0[_0xae37('0x40')]=qs[_0xae37('0x41')](_0x2f8181[_0xae37('0x37')]['sort']);_0x160eb0['where']=qs[_0xae37('0x38')](_['pick'](_0x2f8181['query'],_0x2ef3eb[_0xae37('0x38')]));_0x160eb0['where']['MailAccountId']=_0x3a22cf['id'];if(_0x2f8181[_0xae37('0x37')][_0xae37('0x44')]){_0x160eb0['where']=_[_0xae37('0x45')](_0x160eb0[_0xae37('0x42')],{'$or':_[_0xae37('0x36')](_0x160eb0[_0xae37('0x3a')],function(_0x38a8ee){var _0x1e5e56={};_0x1e5e56[_0x38a8ee]={'$like':'%'+_0x2f8181['query'][_0xae37('0x44')]+'%'};return _0x1e5e56;})});}if(_0x2f8181[_0xae37('0x37')][_0xae37('0x97')]){var _0x24e962=_0x2f8181[_0xae37('0x37')][_0xae37('0x97')][_0xae37('0x98')](',');var _0x2b7d6d={};_0x2b7d6d[_0x24e962[0x0]]={'$gte':moment(_0x24e962[0x1])['format'](_0xae37('0x99'))};_0x160eb0[_0xae37('0x42')]=_[_0xae37('0x45')](_0x160eb0[_0xae37('0x42')],_0x2b7d6d);}_0x160eb0=_[_0xae37('0x45')]({},_0x160eb0,_0x2f8181[_0xae37('0x48')]);return db['MailMessage'][_0xae37('0x25')]({'where':_0x160eb0['where']})[_0xae37('0x15')](function(_0x19626d){_0xff0ca[_0xae37('0x25')]=_0x19626d;if(_0x2f8181[_0xae37('0x37')][_0xae37('0x52')]){_0x160eb0['include']=[{'all':!![]}];}return db[_0xae37('0x9a')][_0xae37('0x49')](_0x160eb0);})[_0xae37('0x15')](function(_0x36a030){if(_0x2f8181['query']['inlineCss']===_0xae37('0x9b')){for(var _0x4e20ae=0x0;_0x4e20ae<_0x36a030['length'];_0x4e20ae++){_0x36a030[_0x4e20ae][_0xae37('0x55')]=juice(_0x36a030[_0x4e20ae][_0xae37('0x55')]);}}_0xff0ca['rows']=_0x36a030;return _0xff0ca;});}})[_0xae37('0x15')](respondWithFilteredResult(_0x3ddc16,_0x160eb0))[_0xae37('0x4b')](handleError(_0x3ddc16,null));};exports[_0xae37('0x2d')]=function(_0x3941ab,_0x35be72){var _0x567cc1,_0x42d962={},_0x186bb7;if(_0x3941ab[_0xae37('0x55')]['to']){_0x186bb7=_0x3941ab[_0xae37('0x55')]['to'][_0xae37('0x98')](',')[0x0];}return db[_0xae37('0x32')][_0xae37('0x58')]({'where':{'id':_0x3941ab[_0xae37('0x4d')]['id']},'include':[{'model':db['CmList'],'as':_0xae37('0x9c'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x186bb7},'limit':0x1,'order':[[_0xae37('0x9d'),_0xae37('0x9e')]]}]},{'model':db['MailServerOut'],'as':_0xae37('0x31'),'raw':!![]}]})[_0xae37('0x15')](handleEntityNotFound(_0x35be72,null))[_0xae37('0x15')](function(_0x2a0ade){if(_0x2a0ade){_0x567cc1=_0x2a0ade;if(_0x2a0ade[_0xae37('0x31')]){if(_[_0xae37('0x69')](_0x3941ab['body'][_0xae37('0x9f')])){_0x3941ab[_0xae37('0x55')]['from']=util[_0xae37('0xa0')](_0xae37('0xa1'),_0x2a0ade[_0xae37('0x2c')],_0x2a0ade[_0xae37('0x67')]||_0x2a0ade[_0xae37('0x31')][_0xae37('0x6c')]);}if(_0x3941ab[_0xae37('0x55')][_0xae37('0xa2')]&&_0x3941ab['body'][_0xae37('0xa2')][_0xae37('0x3d')]){for(var _0x1bd6b0=0x0;_0x1bd6b0<_0x3941ab[_0xae37('0x55')][_0xae37('0xa2')][_0xae37('0x3d')];_0x1bd6b0+=0x1){_0x3941ab[_0xae37('0x55')][_0xae37('0xa2')][_0x1bd6b0]={'filename':_0x3941ab[_0xae37('0x55')][_0xae37('0xa2')][_0x1bd6b0][_0xae37('0x2c')],'path':path[_0xae37('0xa3')](config[_0xae37('0xa4')],_0xae37('0xa5'),_0x3941ab[_0xae37('0x55')][_0xae37('0xa2')][_0x1bd6b0][_0xae37('0xa6')])};}}var _0x3bfa71={'tls':{'rejectUnauthorized':![]}};if(_[_0xae37('0x69')](_0x2a0ade['Smtp']['service'])){if(_0x2a0ade['Smtp'][_0xae37('0x73')]){_0x3bfa71[_0xae37('0xa7')]={'user':_0x2a0ade[_0xae37('0x31')][_0xae37('0x6c')],'pass':_0x2a0ade[_0xae37('0x31')][_0xae37('0x6e')]};}_0x3bfa71[_0xae37('0x71')]=_0x2a0ade[_0xae37('0x31')][_0xae37('0x71')];_0x3bfa71['port']=_0x2a0ade[_0xae37('0x31')][_0xae37('0x72')];_0x3bfa71[_0xae37('0xa8')]=_0x2a0ade[_0xae37('0x31')][_0xae37('0xa8')];}else{_0x3bfa71[_0xae37('0x70')]=_0x2a0ade[_0xae37('0x31')]['service'];_0x3bfa71[_0xae37('0xa7')]={'user':_0x2a0ade[_0xae37('0x31')][_0xae37('0x6c')],'pass':_0x2a0ade[_0xae37('0x31')][_0xae37('0x6e')]};}return respondWithRpcPromise(_0xae37('0xa9'),_0xae37('0xaa'),{'account':_0x3bfa71,'message':_0x3941ab[_0xae37('0x55')]});}else{throw new Error('List\x20not\x20found');}}})[_0xae37('0x15')](function(_0x3cf057){if(_0x3cf057){_0x42d962=_0x3cf057;if(_0x567cc1[_0xae37('0x9c')]){if(_0x567cc1[_0xae37('0x9c')][_0xae37('0xab')][_0xae37('0x3d')]){return _0x567cc1[_0xae37('0x9c')][_0xae37('0xab')][0x0];}else{return db[_0xae37('0x83')][_0xae37('0x5c')](_[_0xae37('0xc')](_0x3941ab[_0xae37('0x55')],{'firstName':_0x3941ab[_0xae37('0x55')]['to'],'email':_0x3941ab[_0xae37('0x55')]['to'],'phone':_0x3941ab['body']['to'],'ListId':_0x567cc1[_0xae37('0x68')]}));}}else{throw new Error(_0xae37('0xac'));}}})[_0xae37('0x15')](function(_0x572e1a){if(_0x572e1a){var _0x38e231={'UserId':_0x3941ab['user']['id'],'ContactId':_0x572e1a['id'],'MailAccountId':_0x567cc1['id'],'inReplyTo':_0x42d962[_0xae37('0xad')],'to':_0x3941ab['body']['from'],'cc':_0x3941ab[_0xae37('0x55')]['cc'],'subject':_0x3941ab[_0xae37('0x55')][_0xae37('0xae')],'attach':_0x3941ab['body'][_0xae37('0xaf')],'firstMsgDirection':'out','lastMsgAt':moment()[_0xae37('0xa0')](_0xae37('0x99')),'lastMsgDirection':_0xae37('0xb0'),'Messages':[_['merge'](_0x3941ab[_0xae37('0x55')],{'messageId':_0x42d962[_0xae37('0xad')],'sentAt':moment()[_0xae37('0xa0')](_0xae37('0x99')),'read':!![],'MailAccountId':_0x567cc1['id'],'UserId':_0x3941ab[_0xae37('0x6c')]['id'],'ContactId':_0x572e1a['id']})]};if(_0x3941ab[_0xae37('0x55')][_0xae37('0xb1')]){_0x38e231=_[_0xae37('0x45')](_0x38e231,_0x3941ab['body']['Interaction']);}return db[_0xae37('0x81')]['create'](_0x38e231,{'include':[{'model':db['MailMessage'],'as':_0xae37('0xb2')}]});}})[_0xae37('0x15')](respondWithResult(_0x35be72,null))[_0xae37('0x4b')](handleError(_0x35be72,null));};exports[_0xae37('0xb3')]=function(_0x206034,_0x4fd05b){return db[_0xae37('0x32')]['find']({'where':{'id':_0x206034[_0xae37('0x4d')]['id']},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0xae37('0xb4')],'as':_0xae37('0xb4'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x4fd05b,null))[_0xae37('0x15')](function(_0x2d7799){if(!_0x2d7799[_0xae37('0x31')])return;var _0x158f4f={'id':_0x2d7799['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2d7799[_0xae37('0x65')]!==_0xae37('0x66')){_0x158f4f[_0xae37('0x70')]=_0x2d7799[_0xae37('0x65')];}else{_0x158f4f[_0xae37('0x71')]=_0x2d7799['Smtp'][_0xae37('0x71')];_0x158f4f[_0xae37('0x72')]=_0x2d7799[_0xae37('0x31')][_0xae37('0x72')];_0x158f4f[_0xae37('0xa8')]=_0x2d7799[_0xae37('0x31')][_0xae37('0xa8')];}if(_0x2d7799[_0xae37('0x31')][_0xae37('0x73')]){if(_0x2d7799[_0xae37('0x31')][_0xae37('0x56')]){_0x158f4f[_0xae37('0xa7')]={'type':'OAuth2','user':_0x2d7799[_0xae37('0x31')][_0xae37('0x6c')],'accessToken':_0x2d7799['Smtp'][_0xae37('0xb4')][_0xae37('0xb5')]};}else{_0x158f4f[_0xae37('0xa7')]={'user':_0x2d7799['Smtp'][_0xae37('0x6c')],'pass':_0x2d7799[_0xae37('0x31')][_0xae37('0x6e')]};}}return respondWithRpcPromise(_0xae37('0xb6'),_0xae37('0xb3'),{'account':_0x158f4f});})[_0xae37('0x15')](respondWithResult(_0x4fd05b,null))[_0xae37('0x4b')](handleError(_0x4fd05b,null));};exports['destroy']=function(_0x1d0dd3,_0x3ca4ce){return db[_0xae37('0x32')][_0xae37('0x58')]({'where':{'id':_0x1d0dd3[_0xae37('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3ca4ce,null))[_0xae37('0x15')](function(_0x1a7a8c){if(_0x1a7a8c&&_0x1a7a8c[_0xae37('0x70')]){throw new db[(_0xae37('0xb7'))][(_0xae37('0xb8'))](_0xae37('0xb9'));}return _0x1a7a8c;})[_0xae37('0x15')](removeEntity(_0x3ca4ce,null))['catch'](handleError(_0x3ca4ce,null));};exports[_0xae37('0xba')]=function(_0x488f97,_0x29e799){return db[_0xae37('0x32')][_0xae37('0x58')]({'where':{'id':_0x488f97['params']['id']}})[_0xae37('0x15')](handleEntityNotFound(_0x29e799,null))['then'](function(_0x2d7f2b){if(_0x2d7f2b){return _0x2d7f2b['addAgents'](_0x488f97[_0xae37('0x55')][_0xae37('0x60')],_['omit'](_0x488f97[_0xae37('0x55')],['ids','id'])||{})[_0xae37('0xbb')](function(_0x4a46ce){for(var _0xbc3289=0x0;_0xbc3289<_0x488f97['body']['ids']['length'];_0xbc3289+=0x1){socket[_0xae37('0xbc')](_0xae37('0xbd'),{'UserId':Number(_0x488f97[_0xae37('0x55')][_0xae37('0x60')][_0xbc3289]),'MailAccountId':Number(_0x488f97['params']['id'])});}return _0x4a46ce;});}})[_0xae37('0x15')](respondWithResult(_0x29e799,null))[_0xae37('0x4b')](handleError(_0x29e799,null));};exports[_0xae37('0xbe')]=function(_0x2a8e5e,_0x54edf4){return db[_0xae37('0x32')][_0xae37('0x58')]({'where':{'id':_0x2a8e5e[_0xae37('0x4d')]['id']}})['then'](handleEntityNotFound(_0x54edf4,null))['then'](function(_0x3530a3){if(_0x3530a3){return _0x3530a3[_0xae37('0xbe')](_0x2a8e5e[_0xae37('0x37')][_0xae37('0x60')])[_0xae37('0x15')](function(){if(_[_0xae37('0xbf')](_0x2a8e5e[_0xae37('0x37')][_0xae37('0x60')])){for(var _0x1dc0fc=0x0;_0x1dc0fc<_0x2a8e5e['query'][_0xae37('0x60')]['length'];_0x1dc0fc+=0x1){socket[_0xae37('0xbc')](_0xae37('0xc0'),{'UserId':Number(_0x2a8e5e['query']['ids'][_0x1dc0fc]),'MailAccountId':Number(_0x2a8e5e[_0xae37('0x4d')]['id'])});}}else{socket['emit'](_0xae37('0xc0'),{'UserId':Number(_0x2a8e5e[_0xae37('0x37')][_0xae37('0x60')]),'MailAccountId':Number(_0x2a8e5e[_0xae37('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x54edf4,null))[_0xae37('0x4b')](handleError(_0x54edf4,null));};exports['getAgents']=function(_0xf7af93,_0x2b2048){var _0x2e1eb6={};var _0x52232a={};var _0x4b6af8;var _0x1bbf39;return db[_0xae37('0x32')][_0xae37('0x5e')]({'where':{'id':_0xf7af93[_0xae37('0x4d')]['id']}})[_0xae37('0x15')](handleEntityNotFound(_0x2b2048,null))['then'](function(_0x483636){if(_0x483636){_0x4b6af8=_0x483636;_0x52232a[_0xae37('0x39')]=_[_0xae37('0x51')](db[_0xae37('0x85')][_0xae37('0x33')]);_0x52232a[_0xae37('0x37')]=_[_0xae37('0x51')](_0xf7af93[_0xae37('0x37')]);_0x52232a[_0xae37('0x38')]=_[_0xae37('0x3b')](_0x52232a['model'],_0x52232a['query']);_0x2e1eb6[_0xae37('0x3a')]=_[_0xae37('0x3b')](_0x52232a[_0xae37('0x39')],qs[_0xae37('0x3c')](_0xf7af93[_0xae37('0x37')]['fields']));_0x2e1eb6['attributes']=_0x2e1eb6[_0xae37('0x3a')][_0xae37('0x3d')]?_0x2e1eb6[_0xae37('0x3a')]:_0x52232a['model'];_0x2e1eb6[_0xae37('0x40')]=qs[_0xae37('0x41')](_0xf7af93[_0xae37('0x37')][_0xae37('0x41')]);_0x2e1eb6['where']=qs[_0xae37('0x38')](_['pick'](_0xf7af93[_0xae37('0x37')],_0x52232a['filters']));if(_0xf7af93[_0xae37('0x37')][_0xae37('0x44')]){_0x2e1eb6[_0xae37('0x42')]=_[_0xae37('0x45')](_0x2e1eb6['where'],{'$or':_['map'](_0x2e1eb6[_0xae37('0x3a')],function(_0x488fdd){var _0x5ce456={};_0x5ce456[_0x488fdd]={'$like':'%'+_0xf7af93[_0xae37('0x37')][_0xae37('0x44')]+'%'};return _0x5ce456;})});}_0x2e1eb6=_[_0xae37('0x45')]({},_0x2e1eb6,_0xf7af93[_0xae37('0x48')]);return _0x4b6af8[_0xae37('0xc1')](_0x2e1eb6);}})[_0xae37('0x15')](function(_0x4aa431){if(_0x4aa431){_0x1bbf39=_0x4aa431[_0xae37('0x3d')];if(!_0xf7af93[_0xae37('0x37')][_0xae37('0x3e')](_0xae37('0x3f'))){_0x2e1eb6['limit']=qs[_0xae37('0x24')](_0xf7af93[_0xae37('0x37')][_0xae37('0x24')]);_0x2e1eb6[_0xae37('0x22')]=qs[_0xae37('0x22')](_0xf7af93['query'][_0xae37('0x22')]);}return _0x4b6af8[_0xae37('0xc1')](_0x2e1eb6);}})[_0xae37('0x15')](function(_0x548cee){if(_0x548cee){return _0x548cee?{'count':_0x1bbf39,'rows':_0x548cee}:null;}})['then'](respondWithResult(_0x2b2048,null))['catch'](handleError(_0x2b2048,null));}; \ No newline at end of file +var _0xee02=['params','Disposition','create','getDispositions','findOne','hasOwnProperty','nolimit','pick','MailAccountId','filter','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','provider','description','user','username','pass','password','service','host','port','authentication','get','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','getImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','priority','stack','finally','send','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','Contacts','updatedAt','DESC','from','email','attachments','root','server/files/attachments','isNil','auth','secure','sendMail','List','defaults','ListId','List\x20not\x20found','messageId','subject','out','Interaction','Messages','verifySmtp','CloudProvider','data5','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','util','path','juice','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','client','http','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','update','destroy','MailAccounts','name','MailServerIn','Smtp','map','MailAccount','fieldName','key','model','query','filters','intersection','attributes','fields','limit','order','sort','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','Imap','MailServerOut','Pause','keys','rawAttributes','length','find','body','CloudProviderId','modernAuthentication','mandatoryDispositionPause','describe','addDisposition'];(function(_0x4efff4,_0x11f821){var _0x19fbb3=function(_0x20202d){while(--_0x20202d){_0x4efff4['push'](_0x4efff4['shift']());}};_0x19fbb3(++_0x11f821);}(_0xee02,0x123));var _0x2ee0=function(_0x31b5a5,_0x44376a){_0x31b5a5=_0x31b5a5-0x0;var _0x364cc9=_0xee02[_0x31b5a5];return _0x364cc9;};'use strict';var moment=require(_0x2ee0('0x0'));var BPromise=require('bluebird');var util=require(_0x2ee0('0x1'));var path=require(_0x2ee0('0x2'));var _=require('lodash');var juice=require(_0x2ee0('0x3'));var Redis=require('ioredis');var qs=require(_0x2ee0('0x4'));var logger=require('../../config/logger')(_0x2ee0('0x5'));var config=require(_0x2ee0('0x6'));var db=require(_0x2ee0('0x7'))['db'];config[_0x2ee0('0x8')]=_['defaults'](config[_0x2ee0('0x8')],{'host':_0x2ee0('0x9'),'port':0x18eb});var socket=require(_0x2ee0('0xa'))(new Redis(config[_0x2ee0('0x8')]));require(_0x2ee0('0xb'))['register'](socket);var jayson=require(_0x2ee0('0xc'));var client=jayson[_0x2ee0('0xd')][_0x2ee0('0xe')]({'port':0x232b});function respondWithRpcPromise(_0x290c6a,_0x16cb9a,_0x59927b,_0x3d8753){return new BPromise(function(_0x52ef67,_0x395da3){var _0x150d47=_0x3d8753||client;return _0x150d47['request'](_0x290c6a,_0x59927b)[_0x2ee0('0xf')](function(_0x5d15da){logger['info'](_0x2ee0('0x10'),_0x16cb9a,_0x2ee0('0x11'));logger[_0x2ee0('0x12')](_0x2ee0('0x13'),_0x16cb9a,_0x2ee0('0x11'),JSON[_0x2ee0('0x14')](_0x5d15da));if(_0x5d15da[_0x2ee0('0x15')]){if(_0x5d15da['error'][_0x2ee0('0x16')]===0x1f4){logger['error'](_0x2ee0('0x10'),_0x16cb9a,_0x5d15da['error'][_0x2ee0('0x17')]);return _0x395da3(_0x5d15da[_0x2ee0('0x15')][_0x2ee0('0x17')]);}logger[_0x2ee0('0x15')](_0x2ee0('0x10'),_0x16cb9a,_0x5d15da[_0x2ee0('0x15')][_0x2ee0('0x17')]);return _0x52ef67(_0x5d15da[_0x2ee0('0x15')][_0x2ee0('0x17')]);}else{logger[_0x2ee0('0x18')](_0x2ee0('0x10'),_0x16cb9a,_0x2ee0('0x11'));_0x52ef67(_0x5d15da[_0x2ee0('0x19')]['message']);}})[_0x2ee0('0x1a')](function(_0x3ac6ba){logger['error'](_0x2ee0('0x10'),_0x16cb9a,_0x3ac6ba);_0x395da3(_0x3ac6ba);});});}function respondWithStatusCode(_0x26f11c,_0x53557a){_0x53557a=_0x53557a||0xcc;return function(_0x415be7){if(_0x415be7){return _0x26f11c[_0x2ee0('0x1b')](_0x53557a);}return _0x26f11c[_0x2ee0('0x1c')](_0x53557a)[_0x2ee0('0x1d')]();};}function respondWithResult(_0x3edbe7,_0x249a81){_0x249a81=_0x249a81||0xc8;return function(_0x5ecc45){if(_0x5ecc45){return _0x3edbe7[_0x2ee0('0x1c')](_0x249a81)[_0x2ee0('0x1e')](_0x5ecc45);}};}function respondWithFilteredResult(_0x203af6,_0x5f4c07){return function(_0x3f86cd){if(_0x3f86cd){var _0x5e106c=typeof _0x5f4c07['offset']===_0x2ee0('0x1f')&&typeof _0x5f4c07['limit']===_0x2ee0('0x1f');var _0x50c289=_0x3f86cd[_0x2ee0('0x20')];var _0x314651=_0x5e106c?0x0:_0x5f4c07[_0x2ee0('0x21')];var _0x238e52=_0x5e106c?_0x3f86cd['count']:_0x5f4c07[_0x2ee0('0x21')]+_0x5f4c07['limit'];var _0x8e337b;if(_0x238e52>=_0x50c289){_0x238e52=_0x50c289;_0x8e337b=0xc8;}else{_0x8e337b=0xce;}_0x203af6[_0x2ee0('0x1c')](_0x8e337b);return _0x203af6[_0x2ee0('0x22')](_0x2ee0('0x23'),_0x314651+'-'+_0x238e52+'/'+_0x50c289)[_0x2ee0('0x1e')](_0x3f86cd);}return null;};}function saveUpdates(_0xe297c1){return function(_0x124103){if(_0x124103){return _0x124103[_0x2ee0('0x24')](_0xe297c1)[_0x2ee0('0xf')](function(_0x33ce6a){return _0x33ce6a;});}return null;};}function removeEntity(_0x5ced36){return function(_0x436b45){if(_0x436b45){return _0x436b45[_0x2ee0('0x25')]()[_0x2ee0('0xf')](function(){var _0x504eb2=_0x436b45['get']({'plain':!![]});var _0x59edcf=_0x2ee0('0x26');return db['UserProfileResource'][_0x2ee0('0x25')]({'where':{'type':_0x59edcf,'resourceId':_0x504eb2['id']}})['then'](function(){return _0x436b45;});})[_0x2ee0('0xf')](function(){_0x5ced36[_0x2ee0('0x1c')](0xcc)[_0x2ee0('0x1d')]();});}};}function handleEntityNotFound(_0x44019e){return function(_0x81ae22){if(!_0x81ae22){_0x44019e['sendStatus'](0x194);}return _0x81ae22;};}function handleError(_0x25af63,_0x3ecab0){_0x3ecab0=_0x3ecab0||0x1f4;return function(_0x485397){logger[_0x2ee0('0x15')](_0x485397['stack']);if(_0x485397[_0x2ee0('0x27')]){delete _0x485397[_0x2ee0('0x27')];}_0x25af63[_0x2ee0('0x1c')](_0x3ecab0)['send'](_0x485397);};}exports['index']=function(_0x46da5f,_0x2b8335){var _0x26d070={'include':[{'model':db[_0x2ee0('0x28')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x2ee0('0x29')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x435808={},_0x32244f={'count':0x0,'rows':[]};var _0x30f66b=_[_0x2ee0('0x2a')](db[_0x2ee0('0x2b')]['rawAttributes'],function(_0x3231d2){return{'name':_0x3231d2[_0x2ee0('0x2c')],'type':_0x3231d2['type'][_0x2ee0('0x2d')]};});_0x435808[_0x2ee0('0x2e')]=_[_0x2ee0('0x2a')](_0x30f66b,'name');_0x435808['query']=_['keys'](_0x46da5f[_0x2ee0('0x2f')]);_0x435808[_0x2ee0('0x30')]=_[_0x2ee0('0x31')](_0x435808['model'],_0x435808[_0x2ee0('0x2f')]);_0x26d070[_0x2ee0('0x32')]=_[_0x2ee0('0x31')](_0x435808['model'],qs[_0x2ee0('0x33')](_0x46da5f[_0x2ee0('0x2f')][_0x2ee0('0x33')]));_0x26d070[_0x2ee0('0x32')]=_0x26d070[_0x2ee0('0x32')]['length']?_0x26d070['attributes']:_0x435808['model'];if(!_0x46da5f[_0x2ee0('0x2f')]['hasOwnProperty']('nolimit')){_0x26d070[_0x2ee0('0x34')]=qs['limit'](_0x46da5f[_0x2ee0('0x2f')][_0x2ee0('0x34')]);_0x26d070[_0x2ee0('0x21')]=qs[_0x2ee0('0x21')](_0x46da5f[_0x2ee0('0x2f')][_0x2ee0('0x21')]);}_0x26d070[_0x2ee0('0x35')]=qs[_0x2ee0('0x36')](_0x46da5f['query'][_0x2ee0('0x36')]);_0x26d070[_0x2ee0('0x37')]=qs[_0x2ee0('0x30')](_['pick'](_0x46da5f['query'],_0x435808[_0x2ee0('0x30')]),_0x30f66b);if(_0x46da5f[_0x2ee0('0x2f')]['filter']){_0x26d070[_0x2ee0('0x37')]=_['merge'](_0x26d070[_0x2ee0('0x37')],{'$or':_[_0x2ee0('0x2a')](_0x30f66b,function(_0x19e77f){if(_0x19e77f[_0x2ee0('0x38')]!==_0x2ee0('0x39')){var _0x184ce2={};_0x184ce2[_0x19e77f[_0x2ee0('0x27')]]={'$like':'%'+_0x46da5f[_0x2ee0('0x2f')]['filter']+'%'};return _0x184ce2;}})});}_0x26d070=_[_0x2ee0('0x3a')]({},_0x26d070,_0x46da5f[_0x2ee0('0x3b')]);var _0x54ad8c={'where':_0x26d070['where']};return db[_0x2ee0('0x2b')][_0x2ee0('0x20')](_0x54ad8c)['then'](function(_0x3920c2){_0x32244f[_0x2ee0('0x20')]=_0x3920c2;if(_0x46da5f[_0x2ee0('0x2f')][_0x2ee0('0x3c')]){_0x26d070[_0x2ee0('0x3d')]=[{'all':!![]}];}return db[_0x2ee0('0x2b')][_0x2ee0('0x3e')](_0x26d070);})['then'](function(_0x2feac0){_0x32244f[_0x2ee0('0x3f')]=_0x2feac0;return _0x32244f;})[_0x2ee0('0xf')](respondWithFilteredResult(_0x2b8335,_0x26d070))[_0x2ee0('0x1a')](handleError(_0x2b8335,null));};exports['show']=function(_0x1b9901,_0x3cd6de){var _0x16db07={'raw':![],'where':{'id':_0x1b9901['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x2ee0('0x40')},{'model':db[_0x2ee0('0x41')],'as':_0x2ee0('0x29')},{'model':db[_0x2ee0('0x42')],'as':'mandatoryDispositionPause'}]},_0xd78938={};_0xd78938['model']=_[_0x2ee0('0x43')](db[_0x2ee0('0x2b')][_0x2ee0('0x44')]);_0xd78938[_0x2ee0('0x2f')]=_[_0x2ee0('0x43')](_0x1b9901[_0x2ee0('0x2f')]);_0xd78938['filters']=_['intersection'](_0xd78938[_0x2ee0('0x2e')],_0xd78938[_0x2ee0('0x2f')]);_0x16db07['attributes']=_[_0x2ee0('0x31')](_0xd78938[_0x2ee0('0x2e')],qs[_0x2ee0('0x33')](_0x1b9901[_0x2ee0('0x2f')][_0x2ee0('0x33')]));_0x16db07['attributes']=_0x16db07['attributes'][_0x2ee0('0x45')]?_0x16db07[_0x2ee0('0x32')]:_0xd78938[_0x2ee0('0x2e')];if(_0x1b9901['query'][_0x2ee0('0x3c')]){_0x16db07[_0x2ee0('0x3d')]=[{'all':!![]}];}_0x16db07=_['merge']({},_0x16db07,_0x1b9901[_0x2ee0('0x3b')]);return db[_0x2ee0('0x2b')][_0x2ee0('0x46')](_0x16db07)[_0x2ee0('0xf')](handleEntityNotFound(_0x3cd6de,null))[_0x2ee0('0xf')](respondWithResult(_0x3cd6de,null))['catch'](handleError(_0x3cd6de,null));};exports[_0x2ee0('0x24')]=function(_0x5dcf8d,_0x210290){if(_0x5dcf8d['body']['id']){delete _0x5dcf8d[_0x2ee0('0x47')]['id'];}if(_0x5dcf8d[_0x2ee0('0x47')]['Imap']){if(!_0x5dcf8d[_0x2ee0('0x47')][_0x2ee0('0x40')]['modernAuthentication']){_0x5dcf8d[_0x2ee0('0x47')][_0x2ee0('0x40')][_0x2ee0('0x48')]=null;}}if(_0x5dcf8d[_0x2ee0('0x47')][_0x2ee0('0x29')]){if(!_0x5dcf8d[_0x2ee0('0x47')]['Smtp'][_0x2ee0('0x49')]){_0x5dcf8d[_0x2ee0('0x47')]['Smtp']['CloudProviderId']=null;}}return db[_0x2ee0('0x2b')][_0x2ee0('0x46')]({'where':{'id':_0x5dcf8d['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x2ee0('0x40')},{'model':db[_0x2ee0('0x41')],'as':_0x2ee0('0x29')},{'model':db[_0x2ee0('0x42')],'as':_0x2ee0('0x4a')}]})[_0x2ee0('0xf')](handleEntityNotFound(_0x210290,null))['then'](saveUpdates(_0x5dcf8d[_0x2ee0('0x47')],null))[_0x2ee0('0xf')](function(_0x406e76){if(_0x406e76&&_0x5dcf8d['body'][_0x2ee0('0x40')]){return db[_0x2ee0('0x28')][_0x2ee0('0x24')](_0x5dcf8d[_0x2ee0('0x47')]['Imap'],{'where':{'MailAccountId':_0x406e76['id']}})['then'](function(){return _0x406e76;});}return _0x406e76;})[_0x2ee0('0xf')](function(_0x58991a){if(_0x58991a&&_0x5dcf8d[_0x2ee0('0x47')][_0x2ee0('0x29')]){return db[_0x2ee0('0x41')]['update'](_0x5dcf8d[_0x2ee0('0x47')][_0x2ee0('0x29')],{'where':{'MailAccountId':_0x58991a['id']}})[_0x2ee0('0xf')](function(){return _0x58991a;});}return _0x58991a;})[_0x2ee0('0xf')](respondWithResult(_0x210290,null))['catch'](handleError(_0x210290,null));};exports[_0x2ee0('0x4b')]=function(_0x9066d0,_0x102189){return db[_0x2ee0('0x2b')]['describe']()[_0x2ee0('0xf')](respondWithResult(_0x102189,null))[_0x2ee0('0x1a')](handleError(_0x102189,null));};exports[_0x2ee0('0x4c')]=function(_0x2ef751,_0x51ca7e){if(_0x2ef751[_0x2ee0('0x47')]['id']){delete _0x2ef751[_0x2ee0('0x47')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x2ef751[_0x2ee0('0x4d')]['id']}})['then'](handleEntityNotFound(_0x51ca7e,null))['then'](function(_0x268331){if(_0x268331){_0x2ef751['body']['MailAccountId']=_0x268331['id'];return db[_0x2ee0('0x4e')][_0x2ee0('0x4f')](_0x2ef751[_0x2ee0('0x47')]);}})['then'](respondWithResult(_0x51ca7e,null))[_0x2ee0('0x1a')](handleError(_0x51ca7e,null));};exports[_0x2ee0('0x50')]=function(_0x417e0c,_0x3558c1){var _0x306a7e={'raw':![],'where':{}};var _0x566449={};var _0x1947e4={'count':0x0,'rows':[]};return db[_0x2ee0('0x2b')][_0x2ee0('0x51')]({'where':{'id':_0x417e0c[_0x2ee0('0x4d')]['id']}})[_0x2ee0('0xf')](handleEntityNotFound(_0x3558c1,null))[_0x2ee0('0xf')](function(_0x7d0853){if(_0x7d0853){_0x566449['model']=_[_0x2ee0('0x43')](db[_0x2ee0('0x4e')]['rawAttributes']);_0x566449[_0x2ee0('0x2f')]=_[_0x2ee0('0x43')](_0x417e0c[_0x2ee0('0x2f')]);_0x566449[_0x2ee0('0x30')]=_[_0x2ee0('0x31')](_0x566449[_0x2ee0('0x2e')],_0x566449[_0x2ee0('0x2f')]);_0x306a7e[_0x2ee0('0x32')]=_[_0x2ee0('0x31')](_0x566449[_0x2ee0('0x2e')],qs[_0x2ee0('0x33')](_0x417e0c[_0x2ee0('0x2f')][_0x2ee0('0x33')]));_0x306a7e[_0x2ee0('0x32')]=_0x306a7e['attributes'][_0x2ee0('0x45')]?_0x306a7e[_0x2ee0('0x32')]:_0x566449[_0x2ee0('0x2e')];if(!_0x417e0c[_0x2ee0('0x2f')][_0x2ee0('0x52')](_0x2ee0('0x53'))){_0x306a7e[_0x2ee0('0x34')]=qs['limit'](_0x417e0c[_0x2ee0('0x2f')][_0x2ee0('0x34')]);_0x306a7e[_0x2ee0('0x21')]=qs[_0x2ee0('0x21')](_0x417e0c[_0x2ee0('0x2f')][_0x2ee0('0x21')]);}_0x306a7e['order']=qs[_0x2ee0('0x36')](_0x417e0c[_0x2ee0('0x2f')][_0x2ee0('0x36')]);_0x306a7e[_0x2ee0('0x37')]=qs[_0x2ee0('0x30')](_[_0x2ee0('0x54')](_0x417e0c[_0x2ee0('0x2f')],_0x566449[_0x2ee0('0x30')]));_0x306a7e[_0x2ee0('0x37')][_0x2ee0('0x55')]=_0x7d0853['id'];if(_0x417e0c[_0x2ee0('0x2f')]['filter']){_0x306a7e['where']=_[_0x2ee0('0x3a')](_0x306a7e[_0x2ee0('0x37')],{'$or':_[_0x2ee0('0x2a')](_0x306a7e[_0x2ee0('0x32')],function(_0x513025){var _0x780c3c={};_0x780c3c[_0x513025]={'$like':'%'+_0x417e0c['query'][_0x2ee0('0x56')]+'%'};return _0x780c3c;})});}_0x306a7e=_[_0x2ee0('0x3a')]({},_0x306a7e,_0x417e0c[_0x2ee0('0x3b')]);return db[_0x2ee0('0x4e')][_0x2ee0('0x20')]({'where':_0x306a7e[_0x2ee0('0x37')]})['then'](function(_0x38d445){_0x1947e4[_0x2ee0('0x20')]=_0x38d445;if(_0x417e0c[_0x2ee0('0x2f')][_0x2ee0('0x3c')]){_0x306a7e['include']=[{'all':!![]}];}return db[_0x2ee0('0x4e')][_0x2ee0('0x3e')](_0x306a7e);})['then'](function(_0x282182){_0x1947e4[_0x2ee0('0x3f')]=_0x282182;return _0x1947e4;});}})[_0x2ee0('0xf')](respondWithFilteredResult(_0x3558c1,_0x306a7e))[_0x2ee0('0x1a')](handleError(_0x3558c1,null));};exports[_0x2ee0('0x57')]=function(_0x142c59,_0x40fc13){return db[_0x2ee0('0x2b')][_0x2ee0('0x46')]({'where':{'id':_0x142c59['params']['id']}})[_0x2ee0('0xf')](handleEntityNotFound(_0x40fc13,null))[_0x2ee0('0xf')](function(_0x457c1a){if(_0x457c1a){return _0x457c1a[_0x2ee0('0x57')](_0x142c59[_0x2ee0('0x2f')][_0x2ee0('0x58')]);}})[_0x2ee0('0xf')](respondWithStatusCode(_0x40fc13,null))[_0x2ee0('0x1a')](handleError(_0x40fc13,null));};exports[_0x2ee0('0x59')]=function(_0xbb3686,_0x1de253){if(_0xbb3686[_0x2ee0('0x47')]['id']){delete _0xbb3686[_0x2ee0('0x47')]['id'];}return db['MailAccount'][_0x2ee0('0x46')]({'where':{'id':_0xbb3686['params']['id']}})[_0x2ee0('0xf')](handleEntityNotFound(_0x1de253,null))[_0x2ee0('0xf')](function(_0x21fb16){if(_0x21fb16){_0xbb3686[_0x2ee0('0x47')][_0x2ee0('0x55')]=_0x21fb16['id'];return db[_0x2ee0('0x5a')][_0x2ee0('0x4f')](_0xbb3686['body']);}})[_0x2ee0('0xf')](respondWithResult(_0x1de253,null))[_0x2ee0('0x1a')](handleError(_0x1de253,null));};exports[_0x2ee0('0x5b')]=function(_0x1a43a6,_0x143670){var _0x8fa7e8={'raw':![],'where':{}};var _0x2b9262={};var _0x506230={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x1a43a6[_0x2ee0('0x4d')]['id']}})[_0x2ee0('0xf')](handleEntityNotFound(_0x143670,null))[_0x2ee0('0xf')](function(_0x1d535e){if(_0x1d535e){_0x2b9262[_0x2ee0('0x2e')]=_[_0x2ee0('0x43')](db['CannedAnswer'][_0x2ee0('0x44')]);_0x2b9262['query']=_[_0x2ee0('0x43')](_0x1a43a6['query']);_0x2b9262[_0x2ee0('0x30')]=_['intersection'](_0x2b9262[_0x2ee0('0x2e')],_0x2b9262[_0x2ee0('0x2f')]);_0x8fa7e8[_0x2ee0('0x32')]=_[_0x2ee0('0x31')](_0x2b9262[_0x2ee0('0x2e')],qs[_0x2ee0('0x33')](_0x1a43a6[_0x2ee0('0x2f')][_0x2ee0('0x33')]));_0x8fa7e8[_0x2ee0('0x32')]=_0x8fa7e8[_0x2ee0('0x32')][_0x2ee0('0x45')]?_0x8fa7e8['attributes']:_0x2b9262[_0x2ee0('0x2e')];if(!_0x1a43a6['query'][_0x2ee0('0x52')](_0x2ee0('0x53'))){_0x8fa7e8[_0x2ee0('0x34')]=qs[_0x2ee0('0x34')](_0x1a43a6[_0x2ee0('0x2f')][_0x2ee0('0x34')]);_0x8fa7e8[_0x2ee0('0x21')]=qs[_0x2ee0('0x21')](_0x1a43a6['query'][_0x2ee0('0x21')]);}_0x8fa7e8['order']=qs['sort'](_0x1a43a6[_0x2ee0('0x2f')][_0x2ee0('0x36')]);_0x8fa7e8[_0x2ee0('0x37')]=qs[_0x2ee0('0x30')](_[_0x2ee0('0x54')](_0x1a43a6['query'],_0x2b9262['filters']));_0x8fa7e8[_0x2ee0('0x37')][_0x2ee0('0x55')]=_0x1d535e['id'];if(_0x1a43a6[_0x2ee0('0x2f')][_0x2ee0('0x56')]){_0x8fa7e8[_0x2ee0('0x37')]=_[_0x2ee0('0x3a')](_0x8fa7e8[_0x2ee0('0x37')],{'$or':_[_0x2ee0('0x2a')](_0x8fa7e8[_0x2ee0('0x32')],function(_0x1bbc0d){var _0x235a52={};_0x235a52[_0x1bbc0d]={'$like':'%'+_0x1a43a6[_0x2ee0('0x2f')][_0x2ee0('0x56')]+'%'};return _0x235a52;})});}_0x8fa7e8=_[_0x2ee0('0x3a')]({},_0x8fa7e8,_0x1a43a6[_0x2ee0('0x3b')]);return db['CannedAnswer']['count']({'where':_0x8fa7e8[_0x2ee0('0x37')]})[_0x2ee0('0xf')](function(_0x2b6083){_0x506230['count']=_0x2b6083;if(_0x1a43a6[_0x2ee0('0x2f')][_0x2ee0('0x3c')]){_0x8fa7e8[_0x2ee0('0x3d')]=[{'all':!![]}];}return db[_0x2ee0('0x5a')][_0x2ee0('0x3e')](_0x8fa7e8);})[_0x2ee0('0xf')](function(_0x41d579){_0x506230[_0x2ee0('0x3f')]=_0x41d579;return _0x506230;});}})[_0x2ee0('0xf')](respondWithFilteredResult(_0x143670,_0x8fa7e8))[_0x2ee0('0x1a')](handleError(_0x143670,null));};exports[_0x2ee0('0x5c')]=function(_0x598c6a,_0x591226){return db[_0x2ee0('0x2b')][_0x2ee0('0x46')]({'where':{'id':_0x598c6a['params']['id']}})[_0x2ee0('0xf')](handleEntityNotFound(_0x591226,null))[_0x2ee0('0xf')](function(_0x49b384){if(_0x49b384){return _0x49b384['removeAnswers'](_0x598c6a['query'][_0x2ee0('0x58')]);}})['then'](respondWithStatusCode(_0x591226,null))['catch'](handleError(_0x591226,null));};exports[_0x2ee0('0x4f')]=function(_0x40fc77,_0x88b4f5){var _0x1efbe9={'name':_0x40fc77[_0x2ee0('0x47')]['name'],'key':_0x40fc77[_0x2ee0('0x47')][_0x2ee0('0x2d')],'provider':_0x40fc77[_0x2ee0('0x47')][_0x2ee0('0x5d')]==='custom'?null:_0x40fc77['body'][_0x2ee0('0x5d')],'email':_0x40fc77['body']['email'],'ListId':_0x40fc77['body']['ListId'],'active':!_['isNil'](_0x40fc77[_0x2ee0('0x47')]['active'])?_0x40fc77[_0x2ee0('0x47')]['active']:!![],'description':_0x40fc77['body'][_0x2ee0('0x5e')]||null,'Imap':{},'Smtp':{}};if(_0x1efbe9[_0x2ee0('0x5d')]){_0x1efbe9[_0x2ee0('0x40')][_0x2ee0('0x5f')]=_0x1efbe9[_0x2ee0('0x29')][_0x2ee0('0x5f')]=_0x40fc77['body'][_0x2ee0('0x60')];_0x1efbe9[_0x2ee0('0x40')]['password']=_0x1efbe9[_0x2ee0('0x29')][_0x2ee0('0x61')]=_0x40fc77['body'][_0x2ee0('0x62')];if(_0x40fc77[_0x2ee0('0x47')]['modernAuthentication']){_0x1efbe9[_0x2ee0('0x40')]['modernAuthentication']=_0x1efbe9[_0x2ee0('0x29')]['modernAuthentication']=!![];_0x1efbe9['Imap'][_0x2ee0('0x48')]=_0x1efbe9['Smtp'][_0x2ee0('0x48')]=_0x40fc77[_0x2ee0('0x47')][_0x2ee0('0x48')];_0x1efbe9[_0x2ee0('0x40')][_0x2ee0('0x62')]=_0x1efbe9[_0x2ee0('0x29')][_0x2ee0('0x61')]=null;}else{_0x1efbe9[_0x2ee0('0x40')][_0x2ee0('0x48')]=_0x1efbe9[_0x2ee0('0x29')]['CloudProviderId']=null;}_0x1efbe9[_0x2ee0('0x40')][_0x2ee0('0x63')]=_0x1efbe9[_0x2ee0('0x29')][_0x2ee0('0x63')]=null;_0x1efbe9[_0x2ee0('0x40')][_0x2ee0('0x64')]=_0x1efbe9[_0x2ee0('0x29')][_0x2ee0('0x64')]=null;_0x1efbe9[_0x2ee0('0x40')][_0x2ee0('0x65')]=_0x1efbe9[_0x2ee0('0x29')][_0x2ee0('0x65')]=null;}else{if(_0x40fc77[_0x2ee0('0x47')][_0x2ee0('0x66')]){_0x1efbe9['Imap'][_0x2ee0('0x5f')]=_0x1efbe9[_0x2ee0('0x29')][_0x2ee0('0x5f')]=_0x40fc77[_0x2ee0('0x47')]['username'];_0x1efbe9[_0x2ee0('0x40')][_0x2ee0('0x62')]=_0x1efbe9[_0x2ee0('0x29')]['pass']=_0x40fc77[_0x2ee0('0x47')][_0x2ee0('0x62')];}else{_0x1efbe9[_0x2ee0('0x40')][_0x2ee0('0x66')]=_0x1efbe9['Smtp'][_0x2ee0('0x66')]=![];_0x1efbe9[_0x2ee0('0x40')]['user']=_0x1efbe9['Smtp'][_0x2ee0('0x5f')]=null;_0x1efbe9[_0x2ee0('0x40')][_0x2ee0('0x62')]=_0x1efbe9['Smtp'][_0x2ee0('0x61')]=null;}_0x1efbe9['Imap']['host']=_0x40fc77[_0x2ee0('0x47')][_0x2ee0('0x40')]['host'];_0x1efbe9[_0x2ee0('0x40')][_0x2ee0('0x65')]=_0x40fc77['body'][_0x2ee0('0x40')][_0x2ee0('0x65')];_0x1efbe9[_0x2ee0('0x29')][_0x2ee0('0x64')]=_0x40fc77[_0x2ee0('0x47')]['Smtp']['host'];_0x1efbe9[_0x2ee0('0x29')]['port']=_0x40fc77[_0x2ee0('0x47')][_0x2ee0('0x29')]['port'];}return db[_0x2ee0('0x2b')]['create'](_0x1efbe9,{'include':[{'model':db['MailServerOut'],'as':_0x2ee0('0x29')},{'model':db[_0x2ee0('0x28')],'as':_0x2ee0('0x40')}]})[_0x2ee0('0xf')](function(_0x7a014e){var _0x1eff6f=_0x40fc77[_0x2ee0('0x5f')][_0x2ee0('0x67')]({'plain':!![]});if(!_0x1eff6f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1eff6f[_0x2ee0('0x68')]===_0x2ee0('0x5f')){var _0x4d045c=_0x7a014e[_0x2ee0('0x67')]({'plain':!![]});return db[_0x2ee0('0x69')]['find']({'where':{'name':_0x2ee0('0x26'),'userProfileId':_0x1eff6f[_0x2ee0('0x6a')]},'raw':!![]})[_0x2ee0('0xf')](function(_0x3133dd){if(_0x3133dd&&_0x3133dd[_0x2ee0('0x6b')]===0x0){return db[_0x2ee0('0x6c')]['create']({'name':_0x4d045c[_0x2ee0('0x27')],'resourceId':_0x4d045c['id'],'type':_0x3133dd[_0x2ee0('0x27')],'sectionId':_0x3133dd['id']},{})[_0x2ee0('0xf')](function(){return _0x7a014e;});}else{return _0x7a014e;}})['catch'](function(_0x573593){logger[_0x2ee0('0x15')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x573593);throw _0x573593;});}return _0x7a014e;})[_0x2ee0('0xf')](respondWithResult(_0x88b4f5,0xc9))[_0x2ee0('0x1a')](handleError(_0x88b4f5,null));};exports[_0x2ee0('0x6d')]=function(_0x573ecf,_0x1345b6){return db[_0x2ee0('0x2b')][_0x2ee0('0x51')]({'where':{'id':_0x573ecf[_0x2ee0('0x4d')]['id']}})[_0x2ee0('0xf')](handleEntityNotFound(_0x1345b6,null))['then'](function(_0x520bf9){if(_0x520bf9){return _0x520bf9[_0x2ee0('0x6d')]();}return null;})[_0x2ee0('0xf')](respondWithResult(_0x1345b6,null))[_0x2ee0('0x1a')](handleError(_0x1345b6,null));};exports['addImap']=function(_0x1ceb94,_0x13b6dc){if(_0x1ceb94[_0x2ee0('0x47')]['id']){delete _0x1ceb94[_0x2ee0('0x47')]['id'];}return db[_0x2ee0('0x2b')]['find']({'where':{'id':_0x1ceb94[_0x2ee0('0x4d')]['id']}})[_0x2ee0('0xf')](handleEntityNotFound(_0x13b6dc,null))['then'](function(_0x238e21){if(_0x238e21){_0x1ceb94[_0x2ee0('0x47')][_0x2ee0('0x55')]=_0x238e21['id'];return db[_0x2ee0('0x28')][_0x2ee0('0x4f')](_0x1ceb94[_0x2ee0('0x47')]);}})[_0x2ee0('0xf')](respondWithResult(_0x13b6dc,null))['catch'](handleError(_0x13b6dc,null));};exports['removeImap']=function(_0x528a92,_0x1aaac3){return db[_0x2ee0('0x2b')][_0x2ee0('0x51')]({'where':{'id':_0x528a92[_0x2ee0('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1aaac3,null))[_0x2ee0('0xf')](function(_0x561dd3){if(_0x561dd3){return _0x561dd3[_0x2ee0('0x6e')](null);}return null;})[_0x2ee0('0xf')](respondWithStatusCode(_0x1aaac3,null))[_0x2ee0('0x1a')](handleError(_0x1aaac3,null));};exports[_0x2ee0('0x6f')]=function(_0x38db00,_0x1c9d08){return db['MailAccount'][_0x2ee0('0x51')]({'where':{'id':_0x38db00[_0x2ee0('0x4d')]['id']}})[_0x2ee0('0xf')](handleEntityNotFound(_0x1c9d08,null))[_0x2ee0('0xf')](function(_0xbc8f74){if(_0xbc8f74){return _0xbc8f74[_0x2ee0('0x6f')]();}return null;})['then'](respondWithResult(_0x1c9d08,null))[_0x2ee0('0x1a')](handleError(_0x1c9d08,null));};exports[_0x2ee0('0x70')]=function(_0x212014,_0x130ee2){if(_0x212014[_0x2ee0('0x47')]['id']){delete _0x212014[_0x2ee0('0x47')]['id'];}return db[_0x2ee0('0x2b')][_0x2ee0('0x46')]({'where':{'id':_0x212014['params']['id']}})[_0x2ee0('0xf')](handleEntityNotFound(_0x130ee2,null))[_0x2ee0('0xf')](function(_0x3b0250){if(_0x3b0250){_0x212014[_0x2ee0('0x47')][_0x2ee0('0x55')]=_0x3b0250['id'];return db[_0x2ee0('0x41')][_0x2ee0('0x4f')](_0x212014[_0x2ee0('0x47')]);}})[_0x2ee0('0xf')](respondWithResult(_0x130ee2,null))[_0x2ee0('0x1a')](handleError(_0x130ee2,null));};exports['removeSmtp']=function(_0x18e1e4,_0x121217){return db['MailAccount'][_0x2ee0('0x51')]({'where':{'id':_0x18e1e4[_0x2ee0('0x4d')]['id']}})[_0x2ee0('0xf')](handleEntityNotFound(_0x121217,null))['then'](function(_0xa13366){if(_0xa13366){return _0xa13366[_0x2ee0('0x71')](null);}return null;})[_0x2ee0('0xf')](respondWithStatusCode(_0x121217,null))[_0x2ee0('0x1a')](handleError(_0x121217,null));};exports[_0x2ee0('0x72')]=function(_0x5caa98,_0x58fe8e){return db[_0x2ee0('0x73')][_0x2ee0('0x46')]({'where':{'id':_0x5caa98['params']['id']}})[_0x2ee0('0xf')](handleEntityNotFound(_0x58fe8e,null))['then'](function(_0x2c225a){if(_0x2c225a){return _0x2c225a[_0x2ee0('0x72')](_0x5caa98['body'][_0x2ee0('0x58')],_['omit'](_0x5caa98[_0x2ee0('0x47')],[_0x2ee0('0x58'),'id'])||{});}})[_0x2ee0('0xf')](respondWithResult(_0x58fe8e,null))[_0x2ee0('0x1a')](handleError(_0x58fe8e,null));};exports[_0x2ee0('0x74')]=function(_0xd2b37e,_0xb35e11){var _0x2ba6f1={'raw':![],'where':{}};var _0x290872={};var _0x39f3ba={'count':0x0,'rows':[]};return db['MailAccount'][_0x2ee0('0x51')]({'where':{'id':_0xd2b37e['params']['id']}})[_0x2ee0('0xf')](handleEntityNotFound(_0xb35e11,null))[_0x2ee0('0xf')](function(_0x446bf8){if(_0x446bf8){_0x290872[_0x2ee0('0x2e')]=_[_0x2ee0('0x43')](db[_0x2ee0('0x73')]['rawAttributes']);_0x290872['query']=_['keys'](_0xd2b37e[_0x2ee0('0x2f')]);_0x290872['filters']=_['intersection'](_0x290872[_0x2ee0('0x2e')],_0x290872[_0x2ee0('0x2f')]);_0x2ba6f1[_0x2ee0('0x32')]=_[_0x2ee0('0x31')](_0x290872[_0x2ee0('0x2e')],qs[_0x2ee0('0x33')](_0xd2b37e[_0x2ee0('0x2f')][_0x2ee0('0x33')]));_0x2ba6f1[_0x2ee0('0x32')]=_0x2ba6f1[_0x2ee0('0x32')]['length']?_0x2ba6f1['attributes']:_0x290872[_0x2ee0('0x2e')];if(!_0xd2b37e[_0x2ee0('0x2f')][_0x2ee0('0x52')]('nolimit')){_0x2ba6f1[_0x2ee0('0x34')]=qs[_0x2ee0('0x34')](_0xd2b37e[_0x2ee0('0x2f')]['limit']);_0x2ba6f1[_0x2ee0('0x21')]=qs[_0x2ee0('0x21')](_0xd2b37e[_0x2ee0('0x2f')][_0x2ee0('0x21')]);}_0x2ba6f1[_0x2ee0('0x35')]=qs[_0x2ee0('0x36')](_0xd2b37e[_0x2ee0('0x2f')][_0x2ee0('0x36')]);_0x2ba6f1[_0x2ee0('0x37')]=qs[_0x2ee0('0x30')](_['pick'](_0xd2b37e[_0x2ee0('0x2f')],_0x290872['filters']));_0x2ba6f1[_0x2ee0('0x37')]['MailAccountId']=_0x446bf8['id'];if(_0xd2b37e[_0x2ee0('0x2f')][_0x2ee0('0x56')]){_0x2ba6f1[_0x2ee0('0x37')]=_['merge'](_0x2ba6f1[_0x2ee0('0x37')],{'$or':_['map'](_0x2ba6f1['attributes'],function(_0x109378){var _0x38d1fe={};_0x38d1fe[_0x109378]={'$like':'%'+_0xd2b37e[_0x2ee0('0x2f')][_0x2ee0('0x56')]+'%'};return _0x38d1fe;})});}_0x2ba6f1=_[_0x2ee0('0x3a')]({},_0x2ba6f1,_0xd2b37e[_0x2ee0('0x3b')]);return db['MailInteraction']['count']({'where':_0x2ba6f1['where']})[_0x2ee0('0xf')](function(_0x30d6bc){_0x39f3ba[_0x2ee0('0x20')]=_0x30d6bc;if(_0xd2b37e[_0x2ee0('0x2f')][_0x2ee0('0x3c')]){_0x2ba6f1[_0x2ee0('0x3d')]=[{'model':db[_0x2ee0('0x75')],'as':_0x2ee0('0x76'),'required':![]},{'model':db[_0x2ee0('0x77')],'as':_0x2ee0('0x78'),'attributes':[_0x2ee0('0x27'),_0x2ee0('0x79'),_0x2ee0('0x7a')],'required':![]},{'model':db[_0x2ee0('0x7b')],'as':_0x2ee0('0x7c'),'attributes':['id',_0x2ee0('0x27'),_0x2ee0('0x7d')],'where':_0xd2b37e[_0x2ee0('0x2f')][_0x2ee0('0x7e')]?{'id':_0xd2b37e[_0x2ee0('0x2f')][_0x2ee0('0x7e')]}:undefined,'required':_0xd2b37e[_0x2ee0('0x2f')][_0x2ee0('0x7e')]?!![]:![]}];}return db['MailInteraction']['findAll'](_0x2ba6f1);})['then'](function(_0x4b36a6){_0x39f3ba[_0x2ee0('0x3f')]=_0x4b36a6;return _0x39f3ba;});}})[_0x2ee0('0xf')](respondWithFilteredResult(_0xb35e11,_0x2ba6f1))[_0x2ee0('0x1a')](handleError(_0xb35e11,null));};exports[_0x2ee0('0x7f')]=function addApplications(_0x1488e6,_0x219c6b){var _0x31e598=_0x1488e6[_0x2ee0('0x4d')]['id'];var _0x758954=_0x1488e6['body'];var _0x13e1f8=0xc8;var _0x356a1a=null;return db[_0x2ee0('0x80')][_0x2ee0('0x81')]({'isolationLevel':db[_0x2ee0('0x80')][_0x2ee0('0x82')][_0x2ee0('0x83')][_0x2ee0('0x84')]},function(_0x44b357){return db[_0x2ee0('0x2b')][_0x2ee0('0x51')]({'where':{'id':_0x31e598},'transaction':_0x44b357})[_0x2ee0('0xf')](function(_0x35f80d){if(_0x35f80d){return db[_0x2ee0('0x85')][_0x2ee0('0x25')]({'where':{'MailAccountId':_0x31e598},'transaction':_0x44b357})[_0x2ee0('0xf')](function(){var _0x4b5033=_[_0x2ee0('0x2a')](_0x758954,function(_0x112dad){_0x112dad[_0x2ee0('0x55')]=_0x31e598;return _0x112dad;});return db[_0x2ee0('0x85')][_0x2ee0('0x86')](_0x4b5033,{'transaction':_0x44b357});});}else{_0x13e1f8=0x194;_0x356a1a=[];}});})[_0x2ee0('0xf')](function(){if(_0x13e1f8!==0x194){return db[_0x2ee0('0x85')]['findAndCountAll']({'where':{'MailAccountId':_0x31e598},'order':_0x2ee0('0x87')})[_0x2ee0('0xf')](function(_0x3a4503){_0x356a1a=_0x3a4503;});}})[_0x2ee0('0x1a')](function(_0x4b40fa){_0x13e1f8=0x1f4;logger[_0x2ee0('0x15')](_0x4b40fa[_0x2ee0('0x88')]);if(_0x4b40fa[_0x2ee0('0x27')]){delete _0x4b40fa[_0x2ee0('0x27')];}_0x356a1a=_0x4b40fa;})[_0x2ee0('0x89')](function(){if(_0x356a1a===null){_0x219c6b[_0x2ee0('0x1b')](_0x13e1f8);}else{if(_0x13e1f8===0x1f4){_0x219c6b[_0x2ee0('0x1c')](_0x13e1f8)[_0x2ee0('0x8a')](_0x356a1a);}else{_0x219c6b[_0x2ee0('0x1c')](_0x13e1f8)[_0x2ee0('0x1e')](_0x356a1a);}}});};exports[_0x2ee0('0x8b')]=function(_0x245667,_0x483221){var _0x24a945={};var _0xd3f36d={};var _0x4a0ab4;var _0x116254;return db[_0x2ee0('0x2b')][_0x2ee0('0x51')]({'where':{'id':_0x245667[_0x2ee0('0x4d')]['id']}})[_0x2ee0('0xf')](handleEntityNotFound(_0x483221,null))[_0x2ee0('0xf')](function(_0x1df0e9){if(_0x1df0e9){_0x4a0ab4=_0x1df0e9;_0xd3f36d[_0x2ee0('0x2e')]=_[_0x2ee0('0x43')](db[_0x2ee0('0x85')]['rawAttributes']);_0xd3f36d['query']=_[_0x2ee0('0x43')](_0x245667[_0x2ee0('0x2f')]);_0xd3f36d[_0x2ee0('0x30')]=_[_0x2ee0('0x31')](_0xd3f36d[_0x2ee0('0x2e')],_0xd3f36d[_0x2ee0('0x2f')]);_0x24a945[_0x2ee0('0x32')]=_[_0x2ee0('0x31')](_0xd3f36d['model'],qs[_0x2ee0('0x33')](_0x245667['query'][_0x2ee0('0x33')]));_0x24a945['attributes']=_0x24a945[_0x2ee0('0x32')][_0x2ee0('0x45')]?_0x24a945[_0x2ee0('0x32')]:_0xd3f36d[_0x2ee0('0x2e')];_0x24a945['order']=qs['sort'](_0x245667['query']['sort']);_0x24a945['where']=qs[_0x2ee0('0x30')](_[_0x2ee0('0x54')](_0x245667['query'],_0xd3f36d[_0x2ee0('0x30')]));if(_0x245667['query'][_0x2ee0('0x56')]){_0x24a945[_0x2ee0('0x37')]=_['merge'](_0x24a945[_0x2ee0('0x37')],{'$or':_[_0x2ee0('0x2a')](_0x24a945[_0x2ee0('0x32')],function(_0x38a7da){var _0xa9ed8={};_0xa9ed8[_0x38a7da]={'$like':'%'+_0x245667[_0x2ee0('0x2f')][_0x2ee0('0x56')]+'%'};return _0xa9ed8;})});}_0x24a945=_[_0x2ee0('0x3a')]({},_0x24a945,_0x245667[_0x2ee0('0x3b')]);return _0x4a0ab4[_0x2ee0('0x8b')](_0x24a945);}})[_0x2ee0('0xf')](function(_0xe8faae){if(_0xe8faae){_0x116254=_0xe8faae['length'];if(!_0x245667['query'][_0x2ee0('0x52')](_0x2ee0('0x53'))){_0x24a945['limit']=qs[_0x2ee0('0x34')](_0x245667[_0x2ee0('0x2f')]['limit']);_0x24a945[_0x2ee0('0x21')]=qs[_0x2ee0('0x21')](_0x245667[_0x2ee0('0x2f')][_0x2ee0('0x21')]);}return _0x4a0ab4['getApplications'](_0x24a945);}})['then'](function(_0x4a0c83){if(_0x4a0c83){return _0x4a0c83?{'count':_0x116254,'rows':_0x4a0c83}:null;}})[_0x2ee0('0xf')](respondWithResult(_0x483221,null))[_0x2ee0('0x1a')](handleError(_0x483221,null));};exports[_0x2ee0('0x8c')]=function(_0x4cd387,_0x670c71){var _0x570200={'raw':!![],'where':{}};var _0x2b8bba={};var _0x4c3fd2={'count':0x0,'rows':[]};return db[_0x2ee0('0x2b')]['findOne']({'where':{'id':_0x4cd387['params']['id']}})[_0x2ee0('0xf')](handleEntityNotFound(_0x670c71,null))[_0x2ee0('0xf')](function(_0x578f23){if(_0x578f23){_0x2b8bba[_0x2ee0('0x2e')]=_[_0x2ee0('0x43')](db['MailMessage'][_0x2ee0('0x44')]);_0x2b8bba['query']=_[_0x2ee0('0x43')](_0x4cd387[_0x2ee0('0x2f')]);_0x2b8bba[_0x2ee0('0x30')]=_[_0x2ee0('0x31')](_0x2b8bba[_0x2ee0('0x2e')],_0x2b8bba[_0x2ee0('0x2f')]);_0x570200[_0x2ee0('0x32')]=_[_0x2ee0('0x31')](_0x2b8bba[_0x2ee0('0x2e')],qs[_0x2ee0('0x33')](_0x4cd387[_0x2ee0('0x2f')][_0x2ee0('0x33')]));_0x570200[_0x2ee0('0x32')]=_0x570200[_0x2ee0('0x32')][_0x2ee0('0x45')]?_0x570200[_0x2ee0('0x32')]:_0x2b8bba[_0x2ee0('0x2e')];if(!_0x4cd387['query'][_0x2ee0('0x52')](_0x2ee0('0x53'))){_0x570200[_0x2ee0('0x34')]=qs[_0x2ee0('0x34')](_0x4cd387['query'][_0x2ee0('0x34')]);_0x570200[_0x2ee0('0x21')]=qs[_0x2ee0('0x21')](_0x4cd387[_0x2ee0('0x2f')]['offset']);}_0x570200['order']=qs['sort'](_0x4cd387[_0x2ee0('0x2f')]['sort']);_0x570200['where']=qs['filters'](_['pick'](_0x4cd387[_0x2ee0('0x2f')],_0x2b8bba['filters']));_0x570200[_0x2ee0('0x37')][_0x2ee0('0x55')]=_0x578f23['id'];if(_0x4cd387[_0x2ee0('0x2f')][_0x2ee0('0x56')]){_0x570200[_0x2ee0('0x37')]=_['merge'](_0x570200[_0x2ee0('0x37')],{'$or':_[_0x2ee0('0x2a')](_0x570200[_0x2ee0('0x32')],function(_0x44a934){var _0x590c7a={};_0x590c7a[_0x44a934]={'$like':'%'+_0x4cd387[_0x2ee0('0x2f')][_0x2ee0('0x56')]+'%'};return _0x590c7a;})});}if(_0x4cd387[_0x2ee0('0x2f')][_0x2ee0('0x8d')]){var _0xda3f23=_0x4cd387[_0x2ee0('0x2f')][_0x2ee0('0x8d')][_0x2ee0('0x8e')](',');var _0x5c831a={};_0x5c831a[_0xda3f23[0x0]]={'$gte':moment(_0xda3f23[0x1])[_0x2ee0('0x8f')](_0x2ee0('0x90'))};_0x570200[_0x2ee0('0x37')]=_[_0x2ee0('0x3a')](_0x570200[_0x2ee0('0x37')],_0x5c831a);}_0x570200=_['merge']({},_0x570200,_0x4cd387[_0x2ee0('0x3b')]);return db['MailMessage'][_0x2ee0('0x20')]({'where':_0x570200['where']})[_0x2ee0('0xf')](function(_0x2b9e59){_0x4c3fd2[_0x2ee0('0x20')]=_0x2b9e59;if(_0x4cd387[_0x2ee0('0x2f')]['includeAll']){_0x570200[_0x2ee0('0x3d')]=[{'all':!![]}];}return db[_0x2ee0('0x91')][_0x2ee0('0x3e')](_0x570200);})[_0x2ee0('0xf')](function(_0x326724){if(_0x4cd387['query'][_0x2ee0('0x92')]===_0x2ee0('0x93')){for(var _0x21557e=0x0;_0x21557e<_0x326724[_0x2ee0('0x45')];_0x21557e++){_0x326724[_0x21557e][_0x2ee0('0x47')]=juice(_0x326724[_0x21557e][_0x2ee0('0x47')]);}}_0x4c3fd2[_0x2ee0('0x3f')]=_0x326724;return _0x4c3fd2;});}})[_0x2ee0('0xf')](respondWithFilteredResult(_0x670c71,_0x570200))[_0x2ee0('0x1a')](handleError(_0x670c71,null));};exports['send']=function(_0x398ce9,_0x46d596){var _0x1571e7,_0x4d0721={},_0x1b3514;if(_0x398ce9[_0x2ee0('0x47')]['to']){_0x1b3514=_0x398ce9[_0x2ee0('0x47')]['to'][_0x2ee0('0x8e')](',')[0x0];}return db[_0x2ee0('0x2b')][_0x2ee0('0x46')]({'where':{'id':_0x398ce9['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x2ee0('0x75')],'as':_0x2ee0('0x94'),'where':{'email':_0x1b3514},'limit':0x1,'order':[[_0x2ee0('0x95'),_0x2ee0('0x96')]]}]},{'model':db[_0x2ee0('0x41')],'as':_0x2ee0('0x29'),'raw':!![]}]})[_0x2ee0('0xf')](handleEntityNotFound(_0x46d596,null))['then'](function(_0x1572bc){if(_0x1572bc){_0x1571e7=_0x1572bc;if(_0x1572bc['Smtp']){if(_['isNil'](_0x398ce9[_0x2ee0('0x47')]['from'])){_0x398ce9['body'][_0x2ee0('0x97')]=util[_0x2ee0('0x8f')]('%s\x20<%s>',_0x1572bc[_0x2ee0('0x27')],_0x1572bc[_0x2ee0('0x98')]||_0x1572bc[_0x2ee0('0x29')][_0x2ee0('0x5f')]);}if(_0x398ce9[_0x2ee0('0x47')][_0x2ee0('0x99')]&&_0x398ce9['body']['attachments'][_0x2ee0('0x45')]){for(var _0xe17e1a=0x0;_0xe17e1a<_0x398ce9['body'][_0x2ee0('0x99')][_0x2ee0('0x45')];_0xe17e1a+=0x1){_0x398ce9[_0x2ee0('0x47')][_0x2ee0('0x99')][_0xe17e1a]={'filename':_0x398ce9[_0x2ee0('0x47')][_0x2ee0('0x99')][_0xe17e1a][_0x2ee0('0x27')],'path':path['join'](config[_0x2ee0('0x9a')],_0x2ee0('0x9b'),_0x398ce9[_0x2ee0('0x47')][_0x2ee0('0x99')][_0xe17e1a]['basename'])};}}var _0xf79187={'tls':{'rejectUnauthorized':![]}};if(_[_0x2ee0('0x9c')](_0x1572bc['Smtp'][_0x2ee0('0x63')])){if(_0x1572bc['Smtp'][_0x2ee0('0x66')]){_0xf79187[_0x2ee0('0x9d')]={'user':_0x1572bc[_0x2ee0('0x29')][_0x2ee0('0x5f')],'pass':_0x1572bc[_0x2ee0('0x29')][_0x2ee0('0x61')]};}_0xf79187['host']=_0x1572bc['Smtp'][_0x2ee0('0x64')];_0xf79187[_0x2ee0('0x65')]=_0x1572bc[_0x2ee0('0x29')][_0x2ee0('0x65')];_0xf79187['secure']=_0x1572bc[_0x2ee0('0x29')][_0x2ee0('0x9e')];}else{_0xf79187[_0x2ee0('0x63')]=_0x1572bc[_0x2ee0('0x29')][_0x2ee0('0x63')];_0xf79187['auth']={'user':_0x1572bc['Smtp'][_0x2ee0('0x5f')],'pass':_0x1572bc['Smtp'][_0x2ee0('0x61')]};}return respondWithRpcPromise('SendMail',_0x2ee0('0x9f'),{'account':_0xf79187,'message':_0x398ce9['body']});}else{throw new Error('List\x20not\x20found');}}})[_0x2ee0('0xf')](function(_0x100302){if(_0x100302){_0x4d0721=_0x100302;if(_0x1571e7[_0x2ee0('0xa0')]){if(_0x1571e7['List'][_0x2ee0('0x94')][_0x2ee0('0x45')]){return _0x1571e7[_0x2ee0('0xa0')][_0x2ee0('0x94')][0x0];}else{return db[_0x2ee0('0x75')][_0x2ee0('0x4f')](_[_0x2ee0('0xa1')](_0x398ce9[_0x2ee0('0x47')],{'firstName':_0x398ce9[_0x2ee0('0x47')]['to'],'email':_0x398ce9[_0x2ee0('0x47')]['to'],'phone':_0x398ce9[_0x2ee0('0x47')]['to'],'ListId':_0x1571e7[_0x2ee0('0xa2')]}));}}else{throw new Error(_0x2ee0('0xa3'));}}})[_0x2ee0('0xf')](function(_0x33ed74){if(_0x33ed74){var _0x3ef6bd={'UserId':_0x398ce9[_0x2ee0('0x5f')]['id'],'ContactId':_0x33ed74['id'],'MailAccountId':_0x1571e7['id'],'inReplyTo':_0x4d0721[_0x2ee0('0xa4')],'to':_0x398ce9['body'][_0x2ee0('0x97')],'cc':_0x398ce9[_0x2ee0('0x47')]['cc'],'subject':_0x398ce9[_0x2ee0('0x47')][_0x2ee0('0xa5')],'attach':_0x398ce9[_0x2ee0('0x47')]['attach'],'firstMsgDirection':_0x2ee0('0xa6'),'lastMsgAt':moment()['format'](_0x2ee0('0x90')),'lastMsgDirection':_0x2ee0('0xa6'),'Messages':[_[_0x2ee0('0x3a')](_0x398ce9['body'],{'messageId':_0x4d0721['messageId'],'sentAt':moment()[_0x2ee0('0x8f')](_0x2ee0('0x90')),'read':!![],'MailAccountId':_0x1571e7['id'],'UserId':_0x398ce9['user']['id'],'ContactId':_0x33ed74['id']})]};if(_0x398ce9[_0x2ee0('0x47')][_0x2ee0('0xa7')]){_0x3ef6bd=_[_0x2ee0('0x3a')](_0x3ef6bd,_0x398ce9[_0x2ee0('0x47')][_0x2ee0('0xa7')]);}return db[_0x2ee0('0x73')]['create'](_0x3ef6bd,{'include':[{'model':db[_0x2ee0('0x91')],'as':_0x2ee0('0xa8')}]});}})['then'](respondWithResult(_0x46d596,null))[_0x2ee0('0x1a')](handleError(_0x46d596,null));};exports[_0x2ee0('0xa9')]=function(_0x1b8401,_0x30b66e){return db[_0x2ee0('0x2b')][_0x2ee0('0x46')]({'where':{'id':_0x1b8401[_0x2ee0('0x4d')]['id']},'include':[{'model':db[_0x2ee0('0x41')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x2ee0('0xaa'),'raw':!![]}]}]})[_0x2ee0('0xf')](handleEntityNotFound(_0x30b66e,null))[_0x2ee0('0xf')](function(_0x439d0b){if(!_0x439d0b[_0x2ee0('0x29')])return;var _0x4f82be={'id':_0x439d0b['id'],'tls':{'rejectUnauthorized':![]}};if(_0x439d0b['provider']!=='custom'){_0x4f82be[_0x2ee0('0x63')]=_0x439d0b[_0x2ee0('0x5d')];}else{_0x4f82be[_0x2ee0('0x64')]=_0x439d0b[_0x2ee0('0x29')]['host'];_0x4f82be[_0x2ee0('0x65')]=_0x439d0b[_0x2ee0('0x29')][_0x2ee0('0x65')];_0x4f82be[_0x2ee0('0x9e')]=_0x439d0b[_0x2ee0('0x29')][_0x2ee0('0x9e')];}if(_0x439d0b[_0x2ee0('0x29')][_0x2ee0('0x66')]){if(_0x439d0b['Smtp']['modernAuthentication']){_0x4f82be[_0x2ee0('0x9d')]={'type':'OAuth2','user':_0x439d0b[_0x2ee0('0x29')][_0x2ee0('0x5f')],'accessToken':_0x439d0b['Smtp'][_0x2ee0('0xaa')][_0x2ee0('0xab')]};}else{_0x4f82be['auth']={'user':_0x439d0b[_0x2ee0('0x29')][_0x2ee0('0x5f')],'pass':_0x439d0b[_0x2ee0('0x29')][_0x2ee0('0x61')]};}}return respondWithRpcPromise('VerifySmtp','verifySmtp',{'account':_0x4f82be});})[_0x2ee0('0xf')](respondWithResult(_0x30b66e,null))[_0x2ee0('0x1a')](handleError(_0x30b66e,null));};exports['destroy']=function(_0x353c76,_0x4f60ae){return db['MailAccount'][_0x2ee0('0x46')]({'where':{'id':_0x353c76['params']['id']}})[_0x2ee0('0xf')](handleEntityNotFound(_0x4f60ae,null))[_0x2ee0('0xf')](function(_0x51da59){if(_0x51da59&&_0x51da59[_0x2ee0('0x63')]){throw new db[(_0x2ee0('0xac'))][(_0x2ee0('0xad'))](_0x2ee0('0xae'));}return _0x51da59;})['then'](removeEntity(_0x4f60ae,null))[_0x2ee0('0x1a')](handleError(_0x4f60ae,null));};exports['addAgents']=function(_0x20f64e,_0x209163){return db[_0x2ee0('0x2b')][_0x2ee0('0x46')]({'where':{'id':_0x20f64e[_0x2ee0('0x4d')]['id']}})['then'](handleEntityNotFound(_0x209163,null))['then'](function(_0x399712){if(_0x399712){return _0x399712[_0x2ee0('0xaf')](_0x20f64e[_0x2ee0('0x47')][_0x2ee0('0x58')],_[_0x2ee0('0xb0')](_0x20f64e[_0x2ee0('0x47')],[_0x2ee0('0x58'),'id'])||{})[_0x2ee0('0xb1')](function(_0x167ed9){for(var _0xe1b88b=0x0;_0xe1b88b<_0x20f64e[_0x2ee0('0x47')][_0x2ee0('0x58')]['length'];_0xe1b88b+=0x1){socket[_0x2ee0('0xb2')](_0x2ee0('0xb3'),{'UserId':Number(_0x20f64e[_0x2ee0('0x47')][_0x2ee0('0x58')][_0xe1b88b]),'MailAccountId':Number(_0x20f64e[_0x2ee0('0x4d')]['id'])});}return _0x167ed9;});}})[_0x2ee0('0xf')](respondWithResult(_0x209163,null))[_0x2ee0('0x1a')](handleError(_0x209163,null));};exports[_0x2ee0('0xb4')]=function(_0x5d7762,_0x4e39b3){return db[_0x2ee0('0x2b')][_0x2ee0('0x46')]({'where':{'id':_0x5d7762[_0x2ee0('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4e39b3,null))[_0x2ee0('0xf')](function(_0xab8919){if(_0xab8919){return _0xab8919[_0x2ee0('0xb4')](_0x5d7762[_0x2ee0('0x2f')][_0x2ee0('0x58')])[_0x2ee0('0xf')](function(){if(_[_0x2ee0('0xb5')](_0x5d7762['query'][_0x2ee0('0x58')])){for(var _0x3d1fa9=0x0;_0x3d1fa9<_0x5d7762[_0x2ee0('0x2f')][_0x2ee0('0x58')]['length'];_0x3d1fa9+=0x1){socket[_0x2ee0('0xb2')](_0x2ee0('0xb6'),{'UserId':Number(_0x5d7762[_0x2ee0('0x2f')][_0x2ee0('0x58')][_0x3d1fa9]),'MailAccountId':Number(_0x5d7762[_0x2ee0('0x4d')]['id'])});}}else{socket['emit'](_0x2ee0('0xb6'),{'UserId':Number(_0x5d7762[_0x2ee0('0x2f')][_0x2ee0('0x58')]),'MailAccountId':Number(_0x5d7762[_0x2ee0('0x4d')]['id'])});}});}})[_0x2ee0('0xf')](respondWithStatusCode(_0x4e39b3,null))[_0x2ee0('0x1a')](handleError(_0x4e39b3,null));};exports[_0x2ee0('0xb7')]=function(_0x3c0771,_0x202e62){var _0x3f8b2a={};var _0x22c853={};var _0x3debb3;var _0x30cf8d;return db[_0x2ee0('0x2b')]['findOne']({'where':{'id':_0x3c0771[_0x2ee0('0x4d')]['id']}})[_0x2ee0('0xf')](handleEntityNotFound(_0x202e62,null))[_0x2ee0('0xf')](function(_0x3e4a36){if(_0x3e4a36){_0x3debb3=_0x3e4a36;_0x22c853[_0x2ee0('0x2e')]=_[_0x2ee0('0x43')](db[_0x2ee0('0x77')][_0x2ee0('0x44')]);_0x22c853[_0x2ee0('0x2f')]=_[_0x2ee0('0x43')](_0x3c0771['query']);_0x22c853[_0x2ee0('0x30')]=_[_0x2ee0('0x31')](_0x22c853['model'],_0x22c853[_0x2ee0('0x2f')]);_0x3f8b2a[_0x2ee0('0x32')]=_[_0x2ee0('0x31')](_0x22c853[_0x2ee0('0x2e')],qs[_0x2ee0('0x33')](_0x3c0771[_0x2ee0('0x2f')]['fields']));_0x3f8b2a['attributes']=_0x3f8b2a[_0x2ee0('0x32')][_0x2ee0('0x45')]?_0x3f8b2a[_0x2ee0('0x32')]:_0x22c853[_0x2ee0('0x2e')];_0x3f8b2a[_0x2ee0('0x35')]=qs[_0x2ee0('0x36')](_0x3c0771['query']['sort']);_0x3f8b2a[_0x2ee0('0x37')]=qs[_0x2ee0('0x30')](_[_0x2ee0('0x54')](_0x3c0771[_0x2ee0('0x2f')],_0x22c853[_0x2ee0('0x30')]));if(_0x3c0771[_0x2ee0('0x2f')][_0x2ee0('0x56')]){_0x3f8b2a[_0x2ee0('0x37')]=_[_0x2ee0('0x3a')](_0x3f8b2a[_0x2ee0('0x37')],{'$or':_[_0x2ee0('0x2a')](_0x3f8b2a[_0x2ee0('0x32')],function(_0x36b4f2){var _0x38fea7={};_0x38fea7[_0x36b4f2]={'$like':'%'+_0x3c0771[_0x2ee0('0x2f')][_0x2ee0('0x56')]+'%'};return _0x38fea7;})});}_0x3f8b2a=_[_0x2ee0('0x3a')]({},_0x3f8b2a,_0x3c0771[_0x2ee0('0x3b')]);return _0x3debb3[_0x2ee0('0xb7')](_0x3f8b2a);}})[_0x2ee0('0xf')](function(_0x307c67){if(_0x307c67){_0x30cf8d=_0x307c67[_0x2ee0('0x45')];if(!_0x3c0771['query']['hasOwnProperty'](_0x2ee0('0x53'))){_0x3f8b2a[_0x2ee0('0x34')]=qs['limit'](_0x3c0771[_0x2ee0('0x2f')][_0x2ee0('0x34')]);_0x3f8b2a[_0x2ee0('0x21')]=qs[_0x2ee0('0x21')](_0x3c0771[_0x2ee0('0x2f')][_0x2ee0('0x21')]);}return _0x3debb3[_0x2ee0('0xb7')](_0x3f8b2a);}})[_0x2ee0('0xf')](function(_0x4fae26){if(_0x4fae26){return _0x4fae26?{'count':_0x30cf8d,'rows':_0x4fae26}:null;}})[_0x2ee0('0xf')](respondWithResult(_0x202e62,null))[_0x2ee0('0x1a')](handleError(_0x202e62,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index db6f683..4269539 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 _0x9b97=['setMaxListeners','save','update','remove','emit','hook','exports','events','MailAccount'];(function(_0x29aefc,_0x4dcf53){var _0x11be36=function(_0x3d472a){while(--_0x3d472a){_0x29aefc['push'](_0x29aefc['shift']());}};_0x11be36(++_0x4dcf53);}(_0x9b97,0x11e));var _0x79b9=function(_0x3082bf,_0x48cbf6){_0x3082bf=_0x3082bf-0x0;var _0x23f33a=_0x9b97[_0x3082bf];return _0x23f33a;};'use strict';var EventEmitter=require(_0x79b9('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x79b9('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x79b9('0x2')](0x0);var events={'afterCreate':_0x79b9('0x3'),'afterUpdate':_0x79b9('0x4'),'afterDestroy':_0x79b9('0x5')};function emitEvent(_0x10c823){return function(_0x4edfcf,_0x5194ab,_0x1e0ed2){MailAccountEvents[_0x79b9('0x6')](_0x10c823+':'+_0x4edfcf['id'],_0x4edfcf);MailAccountEvents[_0x79b9('0x6')](_0x10c823,_0x4edfcf);_0x1e0ed2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x79b9('0x7')](e,emitEvent(event));}}module[_0x79b9('0x8')]=MailAccountEvents; \ No newline at end of file +var _0xff4c=['../../mysqldb','setMaxListeners','update','remove','emit','hook','exports','events'];(function(_0x1ca82a,_0x5dd115){var _0x304c10=function(_0x2e01b3){while(--_0x2e01b3){_0x1ca82a['push'](_0x1ca82a['shift']());}};_0x304c10(++_0x5dd115);}(_0xff4c,0x167));var _0xcff4=function(_0x13594e,_0x6f0ed0){_0x13594e=_0x13594e-0x0;var _0x1a4f42=_0xff4c[_0x13594e];return _0x1a4f42;};'use strict';var EventEmitter=require(_0xcff4('0x0'));var MailAccount=require(_0xcff4('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xcff4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcff4('0x3'),'afterDestroy':_0xcff4('0x4')};function emitEvent(_0x5a87ec){return function(_0x1a70b4,_0x3d0d10,_0x2edb30){MailAccountEvents[_0xcff4('0x5')](_0x5a87ec+':'+_0x1a70b4['id'],_0x1a70b4);MailAccountEvents[_0xcff4('0x5')](_0x5a87ec,_0x1a70b4);_0x2edb30(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0xcff4('0x6')](e,emitEvent(event));}}module[_0xcff4('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index e37c8f5..ffdd0eb 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 _0x3ed9=['moment','bluebird','request-promise','rimraf','../../config/environment','./mailAccount.attributes','exports','MailAccount','mail_accounts','../../config/logger','api'];(function(_0x4ce096,_0x5e98b1){var _0x3ef6b2=function(_0x5297ab){while(--_0x5297ab){_0x4ce096['push'](_0x4ce096['shift']());}};_0x3ef6b2(++_0x5e98b1);}(_0x3ed9,0x13d));var _0x93ed=function(_0x406e46,_0x5799cb){_0x406e46=_0x406e46-0x0;var _0x4a3742=_0x3ed9[_0x406e46];return _0x4a3742;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x93ed('0x0'))(_0x93ed('0x1'));var moment=require(_0x93ed('0x2'));var BPromise=require(_0x93ed('0x3'));var rp=require(_0x93ed('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x93ed('0x5'));var config=require(_0x93ed('0x6'));var attributes=require(_0x93ed('0x7'));module[_0x93ed('0x8')]=function(_0x55dde9,_0x150dbc){return _0x55dde9['define'](_0x93ed('0x9'),attributes,{'tableName':_0x93ed('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe759=['../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./mailAccount.attributes','define','lodash','util'];(function(_0x5c406d,_0x109e15){var _0x14a6c0=function(_0xc5cbf4){while(--_0xc5cbf4){_0x5c406d['push'](_0x5c406d['shift']());}};_0x14a6c0(++_0x109e15);}(_0xe759,0x7c));var _0x9e75=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xe759[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x9e75('0x0'));var util=require(_0x9e75('0x1'));var logger=require(_0x9e75('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9e75('0x3'));var rp=require(_0x9e75('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9e75('0x5'));var config=require(_0x9e75('0x6'));var attributes=require(_0x9e75('0x7'));module['exports']=function(_0xd03872,_0x480384){return _0xd03872[_0x9e75('0x8')]('MailAccount',attributes,{'tableName':'mail_accounts','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 4abbe2c..ba1c574 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 _0x463f=['findAll','options','raw','where','attributes','limit','include','map','model','ShowMailAccount','MailAccount','find','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','ListId','isNil','from','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','MailServerOut','get','omit','applications','list','orderBy','priority','autoclose','push','*,*,*,*','length','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','attachments','originTo','ChatWebsiteId','originChannel','Email','Attachment','interaction','name','UserId','agent','Start','startRouting','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount'];(function(_0x114c53,_0x2249c6){var _0x4e0c14=function(_0x1fe406){while(--_0x1fe406){_0x114c53['push'](_0x114c53['shift']());}};_0x4e0c14(++_0x2249c6);}(_0x463f,0x1e9));var _0xf463=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x463f[_0x5d6456];return _0x4d66c1;};'use strict';var _=require('lodash');var util=require(_0xf463('0x0'));var moment=require(_0xf463('0x1'));var BPromise=require(_0xf463('0x2'));var rs=require(_0xf463('0x3'));var fs=require('fs');var Redis=require(_0xf463('0x4'));var db=require(_0xf463('0x5'))['db'];var utils=require(_0xf463('0x6'));var logger=require(_0xf463('0x7'))(_0xf463('0x8'));var config=require(_0xf463('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf463('0xa')][_0xf463('0xb')]({'port':0x232c});config[_0xf463('0xc')]=_[_0xf463('0xd')](config[_0xf463('0xc')],{'host':_0xf463('0xe'),'port':0x18eb});var socket=require(_0xf463('0xf'))(new Redis(config['redis']));require('./mailAccount.socket')[_0xf463('0x10')](socket);function respondWithRpcPromise(_0x3d6eb9,_0x13cb22,_0x205c25){return new BPromise(function(_0x4a0bde,_0x2ce490){return client[_0xf463('0x11')](_0x3d6eb9,_0x205c25)[_0xf463('0x12')](function(_0x2d180e){logger[_0xf463('0x13')](_0xf463('0x14'),_0x13cb22,_0xf463('0x15'));logger[_0xf463('0x16')](_0xf463('0x17'),_0x13cb22,_0xf463('0x15'),JSON[_0xf463('0x18')](_0x2d180e));if(_0x2d180e[_0xf463('0x19')]){if(_0x2d180e[_0xf463('0x19')][_0xf463('0x1a')]===0x1f4){logger[_0xf463('0x19')](_0xf463('0x14'),_0x13cb22,_0x2d180e[_0xf463('0x19')][_0xf463('0x1b')]);return _0x2ce490(_0x2d180e[_0xf463('0x19')][_0xf463('0x1b')]);}logger[_0xf463('0x19')](_0xf463('0x14'),_0x13cb22,_0x2d180e[_0xf463('0x19')][_0xf463('0x1b')]);return _0x4a0bde(_0x2d180e[_0xf463('0x19')][_0xf463('0x1b')]);}else{logger[_0xf463('0x13')]('MailAccount,\x20%s,\x20%s',_0x13cb22,_0xf463('0x15'));_0x4a0bde(_0x2d180e[_0xf463('0x1c')][_0xf463('0x1b')]);}})[_0xf463('0x1d')](function(_0x77b45a){logger[_0xf463('0x19')](_0xf463('0x14'),_0x13cb22,_0x77b45a);_0x2ce490(_0x77b45a);});});}exports[_0xf463('0x1e')]=function(_0x15519a){var _0x257761=this;return new Promise(function(_0x212b6e,_0x25b2c8){return db['MailAccount'][_0xf463('0x1f')]({'raw':_0x15519a[_0xf463('0x20')]?_0x15519a[_0xf463('0x20')][_0xf463('0x21')]===undefined?!![]:![]:!![],'where':_0x15519a['options']?_0x15519a[_0xf463('0x20')][_0xf463('0x22')]||null:null,'attributes':_0x15519a[_0xf463('0x20')]?_0x15519a[_0xf463('0x20')][_0xf463('0x23')]||null:null,'limit':_0x15519a[_0xf463('0x20')]?_0x15519a[_0xf463('0x20')][_0xf463('0x24')]||null:null,'include':_0x15519a[_0xf463('0x20')]?_0x15519a[_0xf463('0x20')][_0xf463('0x25')]?_[_0xf463('0x26')](_0x15519a[_0xf463('0x20')][_0xf463('0x25')],function(_0x497504){return{'model':db[_0x497504[_0xf463('0x27')]],'as':_0x497504['as'],'attributes':_0x497504[_0xf463('0x23')],'include':_0x497504[_0xf463('0x25')]?_['map'](_0x497504[_0xf463('0x25')],function(_0x58b77f){return{'model':db[_0x58b77f[_0xf463('0x27')]],'as':_0x58b77f['as'],'attributes':_0x58b77f['attributes'],'include':_0x58b77f[_0xf463('0x25')]?_['map'](_0x58b77f[_0xf463('0x25')],function(_0x26fa8f){return{'model':db[_0x26fa8f[_0xf463('0x27')]],'as':_0x26fa8f['as'],'attributes':_0x26fa8f[_0xf463('0x23')]};}):[]};}):[]};}):[]:[]})[_0xf463('0x12')](function(_0x1bfa2e){logger[_0xf463('0x13')]('GetMailAccount',_0x15519a);logger[_0xf463('0x16')](_0xf463('0x1e'),_0x15519a,JSON[_0xf463('0x18')](_0x1bfa2e));_0x212b6e(_0x1bfa2e);})['catch'](function(_0x460743){logger[_0xf463('0x19')]('GetMailAccount',_0x460743[_0xf463('0x1b')],_0x15519a);_0x25b2c8(_0x257761[_0xf463('0x19')](0x1f4,_0x460743['message']));});});};exports[_0xf463('0x28')]=function(_0x4fc737){var _0x19ab67=this;return new Promise(function(_0xcbe520,_0x2480da){return db[_0xf463('0x29')][_0xf463('0x2a')]({'raw':_0x4fc737[_0xf463('0x20')]?_0x4fc737[_0xf463('0x20')][_0xf463('0x21')]===undefined?!![]:![]:!![],'where':_0x4fc737['options']?_0x4fc737[_0xf463('0x20')]['where']||null:null,'attributes':_0x4fc737['options']?_0x4fc737['options'][_0xf463('0x23')]||null:null,'include':_0x4fc737[_0xf463('0x20')]?_0x4fc737[_0xf463('0x20')][_0xf463('0x25')]?_['map'](_0x4fc737[_0xf463('0x20')]['include'],function(_0x5357bb){return{'model':db[_0x5357bb['model']],'as':_0x5357bb['as'],'attributes':_0x5357bb[_0xf463('0x23')],'include':_0x5357bb[_0xf463('0x25')]?_['map'](_0x5357bb[_0xf463('0x25')],function(_0x1a63a7){return{'model':db[_0x1a63a7[_0xf463('0x27')]],'as':_0x1a63a7['as'],'attributes':_0x1a63a7[_0xf463('0x23')],'include':_0x1a63a7[_0xf463('0x25')]?_['map'](_0x1a63a7[_0xf463('0x25')],function(_0xd94be8){return{'model':db[_0xd94be8[_0xf463('0x27')]],'as':_0xd94be8['as'],'attributes':_0xd94be8[_0xf463('0x23')]};}):[]};}):[]};}):[]:[]})[_0xf463('0x12')](function(_0x2a1dd7){logger['info'](_0xf463('0x28'),_0x4fc737);logger[_0xf463('0x16')]('ShowMailAccount',_0x4fc737,JSON[_0xf463('0x18')](_0x2a1dd7));_0xcbe520(_0x2a1dd7);})[_0xf463('0x1d')](function(_0xd1af3){logger['error'](_0xf463('0x28'),_0xd1af3[_0xf463('0x1b')],_0x4fc737);_0x2480da(_0x19ab67[_0xf463('0x19')](0x1f4,_0xd1af3[_0xf463('0x1b')]));});});};exports[_0xf463('0x2b')]=function(_0x35f1ad){var _0x5c9fe=this;return new Promise(function(_0xde94d3,_0x391004){var _0x340eda={'body':_0x35f1ad[_0xf463('0x2c')],'channel':_0xf463('0x2d')};var _0x120df4=_[_0xf463('0x2e')](_[_0xf463('0x2f')](db[_0xf463('0x30')][_0xf463('0x31')]),[_0xf463('0x32'),_0xf463('0x33'),'CompanyId',_0xf463('0x34')]);var _0x5bf2af=![];if(_0x35f1ad[_0xf463('0x2c')]['id']){delete _0x35f1ad[_0xf463('0x2c')]['id'];}if(_[_0xf463('0x35')](_0x35f1ad[_0xf463('0x2c')][_0xf463('0x36')])){return _0x391004(_0x5c9fe['error'](0x1f4,'from\x20is\x20mandatory'));}if(_['isNil'](_0x35f1ad[_0xf463('0x2c')][_0xf463('0x2c')])||_0x35f1ad[_0xf463('0x2c')][_0xf463('0x2c')]===''){return _0x391004(_0x5c9fe['error'](0x1f4,_0xf463('0x37')));}if(_['isNil'](_0x35f1ad['body'][_0xf463('0x38')])){return _0x391004(_0x5c9fe[_0xf463('0x19')](0x1f4,_0xf463('0x39')+_0x120df4));}if(!_['includes'](_0x120df4,_0x35f1ad[_0xf463('0x2c')][_0xf463('0x38')])){return _0x391004(_0x5c9fe[_0xf463('0x19')](0x1f4,_0xf463('0x3a')+_0x120df4));}var _0x6ceb34={};_0x6ceb34[_0x35f1ad[_0xf463('0x2c')]['mapKey']]=_0x35f1ad[_0xf463('0x2c')]['from'];return db['MailAccount'][_0xf463('0x2a')]({'where':{'id':_0x35f1ad[_0xf463('0x3b')]['id']},'include':[{'model':db[_0xf463('0x3c')],'as':_0xf463('0x3d'),'include':[{'model':db[_0xf463('0x30')],'as':_0xf463('0x3e'),'where':_0x6ceb34,'limit':0x1,'order':[[_0xf463('0x33'),_0xf463('0x3f')]]}]},{'model':db[_0xf463('0x40')],'as':_0xf463('0x41')},{'model':db[_0xf463('0x42')],'as':'Smtp'}]})[_0xf463('0x12')](function(_0x572480){if(_0x572480&&_0x572480['List']){var _0x891a1a=_0x572480[_0xf463('0x43')]({'plain':!![]});_0x340eda['account']=_[_0xf463('0x44')](_0x891a1a,[_0xf463('0x41'),_0xf463('0x3d')]);_0x340eda[_0xf463('0x45')]=_0x891a1a['Applications'];_0x340eda[_0xf463('0x46')]=_0x891a1a[_0xf463('0x3d')];_0x340eda[_0xf463('0x45')]=_[_0xf463('0x47')](_0x340eda[_0xf463('0x45')],[_0xf463('0x48')],['asc']);if(_0x340eda[_0xf463('0x3b')]&&_0x340eda['account'][_0xf463('0x49')]){_0x340eda[_0xf463('0x45')][_0xf463('0x4a')]({'id':0x0,'priority':_0x340eda['applications']['length']+0x1,'app':'close','appdata':'autoclose','interval':_0xf463('0x4b')});}if(_0x340eda[_0xf463('0x3b')]['Applications']){delete _0x340eda[_0xf463('0x3b')]['Applications'];}if(_0x340eda[_0xf463('0x3b')][_0xf463('0x3d')]){delete _0x340eda[_0xf463('0x3b')][_0xf463('0x3d')];}if(_0x891a1a[_0xf463('0x3d')][_0xf463('0x3e')][_0xf463('0x4c')]){return _0x891a1a[_0xf463('0x3d')][_0xf463('0x3e')][0x0];}var _0x5bfe47=_[_0xf463('0xd')](_0x35f1ad[_0xf463('0x2c')],{'firstName':_0x35f1ad[_0xf463('0x2c')][_0xf463('0x36')],'ListId':_0x891a1a['ListId']});_0x5bfe47[_0x35f1ad[_0xf463('0x2c')][_0xf463('0x38')]]=_0x35f1ad[_0xf463('0x2c')][_0xf463('0x36')];return db[_0xf463('0x30')][_0xf463('0x4d')](_0x5bfe47);}else{throw new Error(_0xf463('0x4e'));}})[_0xf463('0x12')](function(_0xc388b1){_0x340eda[_0xf463('0x4f')]=_0xc388b1;if(_0xc388b1){if(!_0x35f1ad['body'][_0xf463('0x1b')][_0xf463('0x50')]){_0x35f1ad[_0xf463('0x2c')][_0xf463('0x1b')][_0xf463('0x50')]=rs[_0xf463('0x51')]()+'\x20'+_0x35f1ad[_0xf463('0x2c')]['message'][_0xf463('0x36')];}var _0x4e41bf={'ContactId':_0xc388b1['id'],'MailAccountId':_0x35f1ad[_0xf463('0x3b')]['id'],'inReplyTo':_0x35f1ad[_0xf463('0x2c')]['message'][_0xf463('0x50')],'to':_0x35f1ad[_0xf463('0x2c')][_0xf463('0x1b')]['from'],'cc':_0x35f1ad['body'][_0xf463('0x1b')]['cc'],'subject':_0x35f1ad[_0xf463('0x2c')]['message'][_0xf463('0x52')],'attach':_0x35f1ad[_0xf463('0x2c')][_0xf463('0x1b')][_0xf463('0x53')],'lastMsgAt':moment()[_0xf463('0x54')](_0xf463('0x55')),'lastMsgDirection':'in'};return db[_0xf463('0x56')][_0xf463('0x2a')]({'where':{'closed':![],'MailAccountId':_0x35f1ad[_0xf463('0x3b')]['id']},'include':[{'model':db[_0xf463('0x57')],'as':_0xf463('0x58'),'attributes':[_0xf463('0x50')],'where':{'messageId':_0x35f1ad[_0xf463('0x2c')]['message'][_0xf463('0x59')]}}]})[_0xf463('0x12')](function(_0x5436e2){if(_0x5436e2){return[_0x5436e2,![]];}return db[_0xf463('0x56')][_0xf463('0x4d')](_0x4e41bf)['then'](function(_0x84ef7a){return[_0x84ef7a,!![]];});});}else{throw new Error(_0xf463('0x5a'));}})[_0xf463('0x5b')](function(_0x352640,_0x155ae7){if(_0x352640){_0x5bf2af=_0x155ae7;if(!_0x155ae7){return _0x352640['update']({'inReplyTo':_0x35f1ad[_0xf463('0x2c')][_0xf463('0x1b')][_0xf463('0x50')],'to':_0x35f1ad[_0xf463('0x2c')]['message'][_0xf463('0x36')],'cc':_0x35f1ad[_0xf463('0x2c')][_0xf463('0x1b')]['cc'],'subject':_0x35f1ad['body'][_0xf463('0x1b')][_0xf463('0x52')],'attach':_0x352640[_0xf463('0x53')]?_0x352640['attach']:_0x35f1ad['body'][_0xf463('0x1b')]['attach'],'substatus':null,'substatusAt':moment()[_0xf463('0x54')](_0xf463('0x55')),'lastMsgAt':moment()[_0xf463('0x54')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x352640;}}})[_0xf463('0x12')](function(_0x43e1ed){_0x340eda['interaction']=_0x43e1ed['get']({'plain':!![]});_0x340eda['interaction']['created']=_0x5bf2af;return db[_0xf463('0x57')][_0xf463('0x4d')]({'body':_0x35f1ad[_0xf463('0x2c')][_0xf463('0x2c')],'MailAccountId':_0x35f1ad[_0xf463('0x3b')]['id'],'MailInteractionId':_0x43e1ed['id'],'direction':'in','ContactId':_0x340eda[_0xf463('0x4f')]['id'],'messageId':_0x35f1ad[_0xf463('0x2c')][_0xf463('0x1b')][_0xf463('0x50')],'from':_0x35f1ad[_0xf463('0x2c')][_0xf463('0x1b')][_0xf463('0x36')],'to':_0x35f1ad[_0xf463('0x2c')][_0xf463('0x1b')]['to'],'cc':_0x35f1ad['body'][_0xf463('0x1b')]['cc'],'subject':_0x35f1ad[_0xf463('0x2c')][_0xf463('0x1b')][_0xf463('0x52')],'attach':_0x35f1ad[_0xf463('0x2c')][_0xf463('0x1b')]['attach'],'Attachments':_0x35f1ad[_0xf463('0x2c')][_0xf463('0x1b')][_0xf463('0x5c')],'originTo':_0x35f1ad['body'][_0xf463('0x1b')][_0xf463('0x5d')],'originCc':_0x35f1ad[_0xf463('0x2c')][_0xf463('0x1b')]['originCc'],'bcc':_0x35f1ad['body'][_0xf463('0x1b')]['bcc'],'ChatWebsiteId':_0x35f1ad[_0xf463('0x2c')][_0xf463('0x1b')][_0xf463('0x5e')]||null,'originChannel':_0x35f1ad[_0xf463('0x2c')][_0xf463('0x1b')][_0xf463('0x5f')]||_0xf463('0x60'),'ChatOfflineMessageId':_0x35f1ad[_0xf463('0x2c')][_0xf463('0x1b')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0xf463('0x61')],'as':'Attachments'}]});})[_0xf463('0x12')](function(_0x510c0d){_0x340eda[_0xf463('0x1b')]=_0x510c0d;if(_0x340eda[_0xf463('0x62')]['UserId']){return db['User'][_0xf463('0x2a')]({'attributes':['id',_0xf463('0x63')],'where':{'id':_0x340eda[_0xf463('0x62')][_0xf463('0x64')]}})['then'](function(_0x17f935){if(_0x17f935){_0x340eda['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xf463('0x65'),'appdata':_0x17f935[_0xf463('0x63')]+','+(_0x340eda[_0xf463('0x3b')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xf463('0x66'),_0xf463('0x67'),_0x340eda);});}return respondWithRpcPromise(_0xf463('0x66'),'startRouting',_0x340eda);})[_0xf463('0x12')](function(_0x14da5b){_0xde94d3(_0x14da5b);})['catch'](function(_0x14ef81){_0x391004(_0x5c9fe[_0xf463('0x19')](0x1f4,_0x14ef81[_0xf463('0x1b')]));});});}; \ No newline at end of file +var _0xc726=['Applications','MailServerOut','Smtp','List','get','omit','list','applications','orderBy','asc','autoclose','push','length','*,*,*,*','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','inReplyTo','create','spread','interaction','created','originTo','originCc','bcc','ChatWebsiteId','originChannel','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','MailAccount,\x20%s,\x20%s','message','info','result','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','catch','ShowMailAccount','find','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','from','account','Contacts','DESC','MailApplication'];(function(_0xa4de6c,_0x2c2f47){var _0x1c4616=function(_0x2cf990){while(--_0x2cf990){_0xa4de6c['push'](_0xa4de6c['shift']());}};_0x1c4616(++_0x2c2f47);}(_0xc726,0x1dd));var _0x6c72=function(_0x39752f,_0x4496ea){_0x39752f=_0x39752f-0x0;var _0x506330=_0xc726[_0x39752f];return _0x506330;};'use strict';var _=require(_0x6c72('0x0'));var util=require(_0x6c72('0x1'));var moment=require('moment');var BPromise=require(_0x6c72('0x2'));var rs=require(_0x6c72('0x3'));var fs=require('fs');var Redis=require(_0x6c72('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6c72('0x5'));var logger=require(_0x6c72('0x6'))(_0x6c72('0x7'));var config=require(_0x6c72('0x8'));var jayson=require(_0x6c72('0x9'));var client=jayson['client'][_0x6c72('0xa')]({'port':0x232c});config[_0x6c72('0xb')]=_[_0x6c72('0xc')](config[_0x6c72('0xb')],{'host':_0x6c72('0xd'),'port':0x18eb});var socket=require(_0x6c72('0xe'))(new Redis(config[_0x6c72('0xb')]));require(_0x6c72('0xf'))[_0x6c72('0x10')](socket);function respondWithRpcPromise(_0x2c632f,_0xd6fd45,_0x7c7992){return new BPromise(function(_0x13c293,_0x3921ea){return client[_0x6c72('0x11')](_0x2c632f,_0x7c7992)[_0x6c72('0x12')](function(_0x581921){logger['info']('MailAccount,\x20%s,\x20%s',_0xd6fd45,_0x6c72('0x13'));logger['debug'](_0x6c72('0x14'),_0xd6fd45,'request\x20sent',JSON[_0x6c72('0x15')](_0x581921));if(_0x581921[_0x6c72('0x16')]){if(_0x581921[_0x6c72('0x16')]['code']===0x1f4){logger[_0x6c72('0x16')](_0x6c72('0x17'),_0xd6fd45,_0x581921[_0x6c72('0x16')][_0x6c72('0x18')]);return _0x3921ea(_0x581921[_0x6c72('0x16')][_0x6c72('0x18')]);}logger[_0x6c72('0x16')](_0x6c72('0x17'),_0xd6fd45,_0x581921[_0x6c72('0x16')][_0x6c72('0x18')]);return _0x13c293(_0x581921[_0x6c72('0x16')][_0x6c72('0x18')]);}else{logger[_0x6c72('0x19')](_0x6c72('0x17'),_0xd6fd45,_0x6c72('0x13'));_0x13c293(_0x581921[_0x6c72('0x1a')][_0x6c72('0x18')]);}})['catch'](function(_0xec676){logger[_0x6c72('0x16')](_0x6c72('0x17'),_0xd6fd45,_0xec676);_0x3921ea(_0xec676);});});}exports[_0x6c72('0x1b')]=function(_0xce3a68){var _0x1e42ea=this;return new Promise(function(_0x99cbbf,_0x30650d){return db[_0x6c72('0x1c')][_0x6c72('0x1d')]({'raw':_0xce3a68[_0x6c72('0x1e')]?_0xce3a68[_0x6c72('0x1e')][_0x6c72('0x1f')]===undefined?!![]:![]:!![],'where':_0xce3a68['options']?_0xce3a68[_0x6c72('0x1e')][_0x6c72('0x20')]||null:null,'attributes':_0xce3a68[_0x6c72('0x1e')]?_0xce3a68[_0x6c72('0x1e')][_0x6c72('0x21')]||null:null,'limit':_0xce3a68[_0x6c72('0x1e')]?_0xce3a68['options'][_0x6c72('0x22')]||null:null,'include':_0xce3a68[_0x6c72('0x1e')]?_0xce3a68[_0x6c72('0x1e')][_0x6c72('0x23')]?_[_0x6c72('0x24')](_0xce3a68[_0x6c72('0x1e')]['include'],function(_0x15ca97){return{'model':db[_0x15ca97['model']],'as':_0x15ca97['as'],'attributes':_0x15ca97[_0x6c72('0x21')],'include':_0x15ca97['include']?_['map'](_0x15ca97[_0x6c72('0x23')],function(_0xde360e){return{'model':db[_0xde360e[_0x6c72('0x25')]],'as':_0xde360e['as'],'attributes':_0xde360e[_0x6c72('0x21')],'include':_0xde360e[_0x6c72('0x23')]?_[_0x6c72('0x24')](_0xde360e[_0x6c72('0x23')],function(_0x54144a){return{'model':db[_0x54144a[_0x6c72('0x25')]],'as':_0x54144a['as'],'attributes':_0x54144a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x34833e){logger[_0x6c72('0x19')]('GetMailAccount',_0xce3a68);logger[_0x6c72('0x26')](_0x6c72('0x1b'),_0xce3a68,JSON['stringify'](_0x34833e));_0x99cbbf(_0x34833e);})[_0x6c72('0x27')](function(_0x1e0aa7){logger[_0x6c72('0x16')](_0x6c72('0x1b'),_0x1e0aa7[_0x6c72('0x18')],_0xce3a68);_0x30650d(_0x1e42ea[_0x6c72('0x16')](0x1f4,_0x1e0aa7[_0x6c72('0x18')]));});});};exports[_0x6c72('0x28')]=function(_0x570978){var _0x27a61b=this;return new Promise(function(_0x42ae05,_0x2564b9){return db[_0x6c72('0x1c')][_0x6c72('0x29')]({'raw':_0x570978[_0x6c72('0x1e')]?_0x570978[_0x6c72('0x1e')][_0x6c72('0x1f')]===undefined?!![]:![]:!![],'where':_0x570978[_0x6c72('0x1e')]?_0x570978[_0x6c72('0x1e')][_0x6c72('0x20')]||null:null,'attributes':_0x570978['options']?_0x570978['options'][_0x6c72('0x21')]||null:null,'include':_0x570978[_0x6c72('0x1e')]?_0x570978[_0x6c72('0x1e')][_0x6c72('0x23')]?_[_0x6c72('0x24')](_0x570978[_0x6c72('0x1e')][_0x6c72('0x23')],function(_0x495841){return{'model':db[_0x495841['model']],'as':_0x495841['as'],'attributes':_0x495841['attributes'],'include':_0x495841['include']?_[_0x6c72('0x24')](_0x495841['include'],function(_0x4ac66f){return{'model':db[_0x4ac66f['model']],'as':_0x4ac66f['as'],'attributes':_0x4ac66f[_0x6c72('0x21')],'include':_0x4ac66f[_0x6c72('0x23')]?_[_0x6c72('0x24')](_0x4ac66f['include'],function(_0x32df08){return{'model':db[_0x32df08[_0x6c72('0x25')]],'as':_0x32df08['as'],'attributes':_0x32df08['attributes']};}):[]};}):[]};}):[]:[]})[_0x6c72('0x12')](function(_0x598081){logger[_0x6c72('0x19')]('ShowMailAccount',_0x570978);logger['debug'](_0x6c72('0x28'),_0x570978,JSON[_0x6c72('0x15')](_0x598081));_0x42ae05(_0x598081);})[_0x6c72('0x27')](function(_0x2cfdf5){logger[_0x6c72('0x16')](_0x6c72('0x28'),_0x2cfdf5[_0x6c72('0x18')],_0x570978);_0x2564b9(_0x27a61b[_0x6c72('0x16')](0x1f4,_0x2cfdf5['message']));});});};exports[_0x6c72('0x2a')]=function(_0x35427c){var _0x1a2b74=this;return new Promise(function(_0x419516,_0xd278a2){var _0x4504ce={'body':_0x35427c[_0x6c72('0x2b')],'channel':_0x6c72('0x2c')};var _0x3eab50=_[_0x6c72('0x2d')](_[_0x6c72('0x2e')](db[_0x6c72('0x2f')][_0x6c72('0x30')]),['createdAt',_0x6c72('0x31'),_0x6c72('0x32'),_0x6c72('0x33')]);var _0x107933=![];if(_0x35427c['body']['id']){delete _0x35427c[_0x6c72('0x2b')]['id'];}if(_[_0x6c72('0x34')](_0x35427c[_0x6c72('0x2b')]['from'])){return _0xd278a2(_0x1a2b74[_0x6c72('0x16')](0x1f4,_0x6c72('0x35')));}if(_[_0x6c72('0x34')](_0x35427c[_0x6c72('0x2b')][_0x6c72('0x2b')])||_0x35427c[_0x6c72('0x2b')][_0x6c72('0x2b')]===''){return _0xd278a2(_0x1a2b74[_0x6c72('0x16')](0x1f4,_0x6c72('0x36')));}if(_[_0x6c72('0x34')](_0x35427c[_0x6c72('0x2b')]['mapKey'])){return _0xd278a2(_0x1a2b74[_0x6c72('0x16')](0x1f4,_0x6c72('0x37')+_0x3eab50));}if(!_[_0x6c72('0x38')](_0x3eab50,_0x35427c[_0x6c72('0x2b')][_0x6c72('0x39')])){return _0xd278a2(_0x1a2b74[_0x6c72('0x16')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3eab50));}var _0x303ec8={};_0x303ec8[_0x35427c[_0x6c72('0x2b')][_0x6c72('0x39')]]=_0x35427c[_0x6c72('0x2b')][_0x6c72('0x3a')];return db[_0x6c72('0x1c')]['find']({'where':{'id':_0x35427c[_0x6c72('0x3b')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x6c72('0x2f')],'as':_0x6c72('0x3c'),'where':_0x303ec8,'limit':0x1,'order':[['updatedAt',_0x6c72('0x3d')]]}]},{'model':db[_0x6c72('0x3e')],'as':_0x6c72('0x3f')},{'model':db[_0x6c72('0x40')],'as':_0x6c72('0x41')}]})['then'](function(_0x50d9bf){if(_0x50d9bf&&_0x50d9bf[_0x6c72('0x42')]){var _0x2c3c7a=_0x50d9bf[_0x6c72('0x43')]({'plain':!![]});_0x4504ce[_0x6c72('0x3b')]=_[_0x6c72('0x44')](_0x2c3c7a,[_0x6c72('0x3f'),_0x6c72('0x42')]);_0x4504ce['applications']=_0x2c3c7a[_0x6c72('0x3f')];_0x4504ce[_0x6c72('0x45')]=_0x2c3c7a['List'];_0x4504ce[_0x6c72('0x46')]=_[_0x6c72('0x47')](_0x4504ce['applications'],['priority'],[_0x6c72('0x48')]);if(_0x4504ce[_0x6c72('0x3b')]&&_0x4504ce['account'][_0x6c72('0x49')]){_0x4504ce[_0x6c72('0x46')][_0x6c72('0x4a')]({'id':0x0,'priority':_0x4504ce[_0x6c72('0x46')][_0x6c72('0x4b')]+0x1,'app':'close','appdata':_0x6c72('0x49'),'interval':_0x6c72('0x4c')});}if(_0x4504ce['account']['Applications']){delete _0x4504ce[_0x6c72('0x3b')]['Applications'];}if(_0x4504ce[_0x6c72('0x3b')][_0x6c72('0x42')]){delete _0x4504ce['account'][_0x6c72('0x42')];}if(_0x2c3c7a[_0x6c72('0x42')][_0x6c72('0x3c')][_0x6c72('0x4b')]){return _0x2c3c7a[_0x6c72('0x42')][_0x6c72('0x3c')][0x0];}var _0x38170c=_[_0x6c72('0xc')](_0x35427c[_0x6c72('0x2b')],{'firstName':_0x35427c[_0x6c72('0x2b')][_0x6c72('0x3a')],'ListId':_0x2c3c7a[_0x6c72('0x33')]});_0x38170c[_0x35427c[_0x6c72('0x2b')][_0x6c72('0x39')]]=_0x35427c[_0x6c72('0x2b')][_0x6c72('0x3a')];return db['CmContact']['create'](_0x38170c);}else{throw new Error(_0x6c72('0x4d'));}})[_0x6c72('0x12')](function(_0x1a9564){_0x4504ce[_0x6c72('0x4e')]=_0x1a9564;if(_0x1a9564){if(!_0x35427c[_0x6c72('0x2b')][_0x6c72('0x18')][_0x6c72('0x4f')]){_0x35427c[_0x6c72('0x2b')][_0x6c72('0x18')][_0x6c72('0x4f')]=rs[_0x6c72('0x50')]()+'\x20'+_0x35427c[_0x6c72('0x2b')][_0x6c72('0x18')][_0x6c72('0x3a')];}var _0x87b8bb={'ContactId':_0x1a9564['id'],'MailAccountId':_0x35427c[_0x6c72('0x3b')]['id'],'inReplyTo':_0x35427c['body'][_0x6c72('0x18')][_0x6c72('0x4f')],'to':_0x35427c['body']['message'][_0x6c72('0x3a')],'cc':_0x35427c['body'][_0x6c72('0x18')]['cc'],'subject':_0x35427c[_0x6c72('0x2b')][_0x6c72('0x18')][_0x6c72('0x51')],'attach':_0x35427c[_0x6c72('0x2b')][_0x6c72('0x18')][_0x6c72('0x52')],'lastMsgAt':moment()[_0x6c72('0x53')](_0x6c72('0x54')),'lastMsgDirection':'in'};return db[_0x6c72('0x55')]['find']({'where':{'closed':![],'MailAccountId':_0x35427c['account']['id']},'include':[{'model':db[_0x6c72('0x56')],'as':'Messages','attributes':[_0x6c72('0x4f')],'where':{'messageId':_0x35427c[_0x6c72('0x2b')][_0x6c72('0x18')][_0x6c72('0x57')]}}]})['then'](function(_0x3dcd1a){if(_0x3dcd1a){return[_0x3dcd1a,![]];}return db[_0x6c72('0x55')][_0x6c72('0x58')](_0x87b8bb)[_0x6c72('0x12')](function(_0x120866){return[_0x120866,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x6c72('0x59')](function(_0x5c5e06,_0x337af2){if(_0x5c5e06){_0x107933=_0x337af2;if(!_0x337af2){return _0x5c5e06['update']({'inReplyTo':_0x35427c[_0x6c72('0x2b')]['message'][_0x6c72('0x4f')],'to':_0x35427c[_0x6c72('0x2b')][_0x6c72('0x18')][_0x6c72('0x3a')],'cc':_0x35427c[_0x6c72('0x2b')][_0x6c72('0x18')]['cc'],'subject':_0x35427c[_0x6c72('0x2b')]['message'][_0x6c72('0x51')],'attach':_0x5c5e06[_0x6c72('0x52')]?_0x5c5e06[_0x6c72('0x52')]:_0x35427c[_0x6c72('0x2b')][_0x6c72('0x18')]['attach'],'substatus':null,'substatusAt':moment()[_0x6c72('0x53')](_0x6c72('0x54')),'lastMsgAt':moment()[_0x6c72('0x53')](_0x6c72('0x54')),'lastMsgDirection':'in'});}else{return _0x5c5e06;}}})[_0x6c72('0x12')](function(_0x2f45a2){_0x4504ce[_0x6c72('0x5a')]=_0x2f45a2[_0x6c72('0x43')]({'plain':!![]});_0x4504ce[_0x6c72('0x5a')][_0x6c72('0x5b')]=_0x107933;return db['MailMessage'][_0x6c72('0x58')]({'body':_0x35427c[_0x6c72('0x2b')][_0x6c72('0x2b')],'MailAccountId':_0x35427c[_0x6c72('0x3b')]['id'],'MailInteractionId':_0x2f45a2['id'],'direction':'in','ContactId':_0x4504ce[_0x6c72('0x4e')]['id'],'messageId':_0x35427c[_0x6c72('0x2b')][_0x6c72('0x18')]['messageId'],'from':_0x35427c['body'][_0x6c72('0x18')]['from'],'to':_0x35427c['body'][_0x6c72('0x18')]['to'],'cc':_0x35427c['body'][_0x6c72('0x18')]['cc'],'subject':_0x35427c['body'][_0x6c72('0x18')][_0x6c72('0x51')],'attach':_0x35427c['body'][_0x6c72('0x18')][_0x6c72('0x52')],'Attachments':_0x35427c['body']['message']['attachments'],'originTo':_0x35427c[_0x6c72('0x2b')][_0x6c72('0x18')][_0x6c72('0x5c')],'originCc':_0x35427c[_0x6c72('0x2b')][_0x6c72('0x18')][_0x6c72('0x5d')],'bcc':_0x35427c[_0x6c72('0x2b')]['message'][_0x6c72('0x5e')],'ChatWebsiteId':_0x35427c[_0x6c72('0x2b')][_0x6c72('0x18')][_0x6c72('0x5f')]||null,'originChannel':_0x35427c[_0x6c72('0x2b')][_0x6c72('0x18')][_0x6c72('0x60')]||'Email','ChatOfflineMessageId':_0x35427c[_0x6c72('0x2b')][_0x6c72('0x18')][_0x6c72('0x61')]||null},{'include':[{'model':db[_0x6c72('0x62')],'as':_0x6c72('0x63')}]});})['then'](function(_0x15f15a){_0x4504ce[_0x6c72('0x18')]=_0x15f15a;if(_0x4504ce[_0x6c72('0x5a')][_0x6c72('0x64')]){return db[_0x6c72('0x65')][_0x6c72('0x29')]({'attributes':['id',_0x6c72('0x66')],'where':{'id':_0x4504ce[_0x6c72('0x5a')][_0x6c72('0x64')]}})[_0x6c72('0x12')](function(_0x10e5ba){if(_0x10e5ba){_0x4504ce[_0x6c72('0x46')][_0x6c72('0x67')]({'id':0x0,'priority':0x0,'app':_0x6c72('0x68'),'appdata':_0x10e5ba[_0x6c72('0x66')]+','+(_0x4504ce[_0x6c72('0x3b')][_0x6c72('0x69')]||0xa),'interval':_0x6c72('0x4c')});}return respondWithRpcPromise(_0x6c72('0x6a'),_0x6c72('0x6b'),_0x4504ce);});}return respondWithRpcPromise(_0x6c72('0x6a'),_0x6c72('0x6b'),_0x4504ce);})[_0x6c72('0x12')](function(_0x30e029){_0x419516(_0x30e029);})['catch'](function(_0x406c29){_0xd278a2(_0x1a2b74[_0x6c72('0x16')](0x1f4,_0x406c29[_0x6c72('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 2ae5c2d..a2360cd 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 _0xa227=['mailAccount:','save','remove','update','removeListener','register'];(function(_0x508685,_0x9f94af){var _0x976a76=function(_0x1bcb05){while(--_0x1bcb05){_0x508685['push'](_0x508685['shift']());}};_0x976a76(++_0x9f94af);}(_0xa227,0x16f));var _0x7a22=function(_0x535784,_0x386967){_0x535784=_0x535784-0x0;var _0x16fe3c=_0xa227[_0x535784];return _0x16fe3c;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x7a22('0x0'),_0x7a22('0x1'),_0x7a22('0x2')];function createListener(_0x342d2b,_0x2010f4){return function(_0x5d45e8){_0x2010f4['emit'](_0x342d2b,_0x5d45e8);};}function removeListener(_0x4db6d6,_0x4b922d){return function(){MailAccountEvents[_0x7a22('0x3')](_0x4db6d6,_0x4b922d);};}exports[_0x7a22('0x4')]=function(_0x13f20c){for(var _0x14a526=0x0,_0x1704fa=events['length'];_0x14a526<_0x1704fa;_0x14a526++){var _0x4bdca6=events[_0x14a526];var _0xb92917=createListener(_0x7a22('0x5')+_0x4bdca6,_0x13f20c);MailAccountEvents['on'](_0x4bdca6,_0xb92917);}}; \ No newline at end of file +var _0x553d=['update','emit','register','length','mailAccount:','./mailAccount.events','save'];(function(_0x5c82c5,_0x3dc858){var _0x1739c1=function(_0x18f80c){while(--_0x18f80c){_0x5c82c5['push'](_0x5c82c5['shift']());}};_0x1739c1(++_0x3dc858);}(_0x553d,0x1a2));var _0xd553=function(_0x3091dc,_0x2897a6){_0x3091dc=_0x3091dc-0x0;var _0x12ac34=_0x553d[_0x3091dc];return _0x12ac34;};'use strict';var MailAccountEvents=require(_0xd553('0x0'));var events=[_0xd553('0x1'),'remove',_0xd553('0x2')];function createListener(_0x29501f,_0x5f4c3c){return function(_0x1e2874){_0x5f4c3c[_0xd553('0x3')](_0x29501f,_0x1e2874);};}function removeListener(_0xeab272,_0x24867d){return function(){MailAccountEvents['removeListener'](_0xeab272,_0x24867d);};}exports[_0xd553('0x4')]=function(_0x225a95){for(var _0x4a7b2c=0x0,_0x8e6d17=events[_0xd553('0x5')];_0x4a7b2c<_0x8e6d17;_0x4a7b2c++){var _0x3fede6=events[_0x4a7b2c];var _0x3d3533=createListener(_0xd553('0x6')+_0x3fede6,_0x225a95);MailAccountEvents['on'](_0x3fede6,_0x3d3533);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 07f7fce..c0c1234 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 _0xe4db=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x18aaaf,_0x385db6){var _0x52d892=function(_0x1ac6da){while(--_0x1ac6da){_0x18aaaf['push'](_0x18aaaf['shift']());}};_0x52d892(++_0x385db6);}(_0xe4db,0x1e1));var _0xbe4d=function(_0x580816,_0x53c93e){_0x580816=_0x580816-0x0;var _0x55ce9f=_0xe4db[_0x580816];return _0x55ce9f;};'use strict';var multer=require('multer');var util=require(_0xbe4d('0x0'));var path=require(_0xbe4d('0x1'));var timeout=require(_0xbe4d('0x2'));var express=require(_0xbe4d('0x3'));var router=express[_0xbe4d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbe4d('0x5'));var interaction=require(_0xbe4d('0x6'));var config=require(_0xbe4d('0x7'));var controller=require(_0xbe4d('0x8'));router[_0xbe4d('0x9')](_0xbe4d('0xa'),auth[_0xbe4d('0xb')](),controller[_0xbe4d('0xc')]);router[_0xbe4d('0xd')](_0xbe4d('0xa'),auth[_0xbe4d('0xb')](),controller[_0xbe4d('0xe')]);router[_0xbe4d('0xf')](_0xbe4d('0xa'),auth[_0xbe4d('0xb')](),controller[_0xbe4d('0x10')]);module[_0xbe4d('0x11')]=router; \ No newline at end of file +var _0xc55b=['connect-timeout','Router','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','put','delete','destroy','exports','multer','util','path'];(function(_0xc08904,_0x27afc8){var _0x2a0570=function(_0x45381b){while(--_0x45381b){_0xc08904['push'](_0xc08904['shift']());}};_0x2a0570(++_0x27afc8);}(_0xc55b,0xa2));var _0xbc55=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xc55b[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0xbc55('0x0'));var util=require(_0xbc55('0x1'));var path=require(_0xbc55('0x2'));var timeout=require(_0xbc55('0x3'));var express=require('express');var router=express[_0xbc55('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbc55('0x5'));var config=require(_0xbc55('0x6'));var controller=require('./mailApplication.controller');router[_0xbc55('0x7')](_0xbc55('0x8'),auth[_0xbc55('0x9')](),controller[_0xbc55('0xa')]);router[_0xbc55('0xb')]('/:id',auth[_0xbc55('0x9')](),controller['update']);router[_0xbc55('0xc')](_0xbc55('0x8'),auth[_0xbc55('0x9')](),controller[_0xbc55('0xd')]);module[_0xbc55('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 1e3232b..21d313d 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 _0x2a76=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x2a76,0x1da));var _0x62a7=function(_0x481694,_0x4dfe22){_0x481694=_0x481694-0x0;var _0x269e6e=_0x2a76[_0x481694];return _0x269e6e;};'use strict';var Sequelize=require('sequelize');module[_0x62a7('0x0')]={'priority':{'type':Sequelize[_0x62a7('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x62a7('0x2')],'allowNull':![],'defaultValue':_0x62a7('0x3')},'appdata':{'type':Sequelize[_0x62a7('0x4')]()},'description':{'type':Sequelize[_0x62a7('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x62a7('0x5')}}; \ No newline at end of file +var _0x670f=['*,*,*,*','sequelize','exports','INTEGER','STRING','TEXT'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x670f,0xcd));var _0xf670=function(_0x2f02af,_0x5c6fee){_0x2f02af=_0x2f02af-0x0;var _0x38c95c=_0x670f[_0x2f02af];return _0x38c95c;};'use strict';var Sequelize=require(_0xf670('0x0'));module[_0xf670('0x1')]={'priority':{'type':Sequelize[_0xf670('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf670('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xf670('0x4')]()},'description':{'type':Sequelize[_0xf670('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xf670('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 231cea6..697a826 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 _0xac4a=['Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x4b9446,_0x180a06){var _0x1826de=function(_0x507373){while(--_0x507373){_0x4b9446['push'](_0x4b9446['shift']());}};_0x1826de(++_0x180a06);}(_0xac4a,0x13f));var _0xaac4=function(_0x5eb6da,_0x9a9267){_0x5eb6da=_0x5eb6da-0x0;var _0x3945d1=_0xac4a[_0x5eb6da];return _0x3945d1;};'use strict';var emlformat=require(_0xaac4('0x0'));var rimraf=require(_0xaac4('0x1'));var zipdir=require(_0xaac4('0x2'));var jsonpatch=require(_0xaac4('0x3'));var rp=require(_0xaac4('0x4'));var moment=require(_0xaac4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaac4('0x6'));var path=require(_0xaac4('0x7'));var sox=require(_0xaac4('0x8'));var csv=require('to-csv');var ejs=require(_0xaac4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaac4('0xa'));var squel=require('squel');var crypto=require(_0xaac4('0xb'));var jsforce=require(_0xaac4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaac4('0xd'));var Papa=require('papaparse');var Redis=require(_0xaac4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaac4('0xf'));var hardwareService=require(_0xaac4('0x10'));var logger=require(_0xaac4('0x11'))(_0xaac4('0x12'));var utils=require(_0xaac4('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaac4('0x14'))['db'];function respondWithStatusCode(_0x2e2d02,_0x45e512){_0x45e512=_0x45e512||0xcc;return function(_0x5a4801){if(_0x5a4801){return _0x2e2d02[_0xaac4('0x15')](_0x45e512);}return _0x2e2d02[_0xaac4('0x16')](_0x45e512)['end']();};}function respondWithResult(_0xf06b1d,_0x2b20d0){_0x2b20d0=_0x2b20d0||0xc8;return function(_0x46698d){if(_0x46698d){return _0xf06b1d[_0xaac4('0x16')](_0x2b20d0)[_0xaac4('0x17')](_0x46698d);}};}function respondWithFilteredResult(_0x2fbeb7,_0x31b7e5){return function(_0x1df9ae){if(_0x1df9ae){var _0x233278=typeof _0x31b7e5[_0xaac4('0x18')]===_0xaac4('0x19')&&typeof _0x31b7e5[_0xaac4('0x1a')]===_0xaac4('0x19');var _0x52686a=_0x1df9ae[_0xaac4('0x1b')];var _0x52085a=_0x233278?0x0:_0x31b7e5[_0xaac4('0x18')];var _0x5b6fd6=_0x233278?_0x1df9ae[_0xaac4('0x1b')]:_0x31b7e5[_0xaac4('0x18')]+_0x31b7e5[_0xaac4('0x1a')];var _0x271bcb;if(_0x5b6fd6>=_0x52686a){_0x5b6fd6=_0x52686a;_0x271bcb=0xc8;}else{_0x271bcb=0xce;}_0x2fbeb7[_0xaac4('0x16')](_0x271bcb);return _0x2fbeb7[_0xaac4('0x1c')](_0xaac4('0x1d'),_0x52085a+'-'+_0x5b6fd6+'/'+_0x52686a)[_0xaac4('0x17')](_0x1df9ae);}return null;};}function patchUpdates(_0x4166ee){return function(_0x480fb0){try{jsonpatch[_0xaac4('0x1e')](_0x480fb0,_0x4166ee,!![]);}catch(_0x4e1e89){return BPromise[_0xaac4('0x1f')](_0x4e1e89);}return _0x480fb0[_0xaac4('0x20')]();};}function saveUpdates(_0x43625c,_0x477b77){return function(_0x17140f){if(_0x17140f){return _0x17140f[_0xaac4('0x21')](_0x43625c)['then'](function(_0x43ccdc){return _0x43ccdc;});}return null;};}function removeEntity(_0x27a84d,_0x174860){return function(_0x4f10ec){if(_0x4f10ec){return _0x4f10ec[_0xaac4('0x22')]()[_0xaac4('0x23')](function(){_0x27a84d[_0xaac4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24186b,_0x4f1b65){return function(_0x54203b){if(!_0x54203b){_0x24186b['sendStatus'](0x194);}return _0x54203b;};}function handleError(_0x5a0bb3,_0x22d5a6){_0x22d5a6=_0x22d5a6||0x1f4;return function(_0x17d25f){logger[_0xaac4('0x24')](_0x17d25f[_0xaac4('0x25')]);if(_0x17d25f[_0xaac4('0x26')]){delete _0x17d25f[_0xaac4('0x26')];}_0x5a0bb3[_0xaac4('0x16')](_0x22d5a6)[_0xaac4('0x27')](_0x17d25f);};}exports[_0xaac4('0x28')]=function(_0x386c9b,_0x4d0f5f){var _0x316445={'raw':!![],'where':{'id':_0x386c9b[_0xaac4('0x29')]['id']}},_0x16b33c={};_0x16b33c[_0xaac4('0x2a')]=_[_0xaac4('0x2b')](db[_0xaac4('0x2c')]['rawAttributes']);_0x16b33c[_0xaac4('0x2d')]=_['keys'](_0x386c9b[_0xaac4('0x2d')]);_0x16b33c[_0xaac4('0x2e')]=_[_0xaac4('0x2f')](_0x16b33c[_0xaac4('0x2a')],_0x16b33c['query']);_0x316445['attributes']=_['intersection'](_0x16b33c[_0xaac4('0x2a')],qs[_0xaac4('0x30')](_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x30')]));_0x316445[_0xaac4('0x31')]=_0x316445[_0xaac4('0x31')][_0xaac4('0x32')]?_0x316445[_0xaac4('0x31')]:_0x16b33c[_0xaac4('0x2a')];if(_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x33')]){_0x316445[_0xaac4('0x34')]=[{'all':!![]}];}_0x316445=_[_0xaac4('0x35')]({},_0x316445,_0x386c9b[_0xaac4('0x36')]);return db[_0xaac4('0x2c')]['find'](_0x316445)['then'](handleEntityNotFound(_0x4d0f5f,null))[_0xaac4('0x23')](respondWithResult(_0x4d0f5f,null))[_0xaac4('0x37')](handleError(_0x4d0f5f,null));};exports[_0xaac4('0x21')]=function(_0x5e6080,_0x191d0f){if(_0x5e6080[_0xaac4('0x38')]['id']){delete _0x5e6080[_0xaac4('0x38')]['id'];}return db[_0xaac4('0x2c')][_0xaac4('0x39')]({'where':{'id':_0x5e6080[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x191d0f,null))['then'](saveUpdates(_0x5e6080[_0xaac4('0x38')],null))[_0xaac4('0x23')](respondWithResult(_0x191d0f,null))[_0xaac4('0x37')](handleError(_0x191d0f,null));};exports['destroy']=function(_0x36d84a,_0x497e7b){return db['MailApplication'][_0xaac4('0x39')]({'where':{'id':_0x36d84a[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x497e7b,null))['then'](removeEntity(_0x497e7b,null))['catch'](handleError(_0x497e7b,null));}; \ No newline at end of file +var _0x9bde=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','name','send','show','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','params','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x11963b,_0x5d2da7){var _0x5d451e=function(_0x41e9e5){while(--_0x41e9e5){_0x11963b['push'](_0x11963b['shift']());}};_0x5d451e(++_0x5d2da7);}(_0x9bde,0xe1));var _0xe9bd=function(_0x5e1cd3,_0x41df34){_0x5e1cd3=_0x5e1cd3-0x0;var _0x157e5e=_0x9bde[_0x5e1cd3];return _0x157e5e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x5e022a,_0x2c1d98){_0x2c1d98=_0x2c1d98||0xcc;return function(_0x4ac319){if(_0x4ac319){return _0x5e022a[_0xe9bd('0x19')](_0x2c1d98);}return _0x5e022a[_0xe9bd('0x1a')](_0x2c1d98)[_0xe9bd('0x1b')]();};}function respondWithResult(_0x51109f,_0x47ba5e){_0x47ba5e=_0x47ba5e||0xc8;return function(_0x46a95e){if(_0x46a95e){return _0x51109f[_0xe9bd('0x1a')](_0x47ba5e)[_0xe9bd('0x1c')](_0x46a95e);}};}function respondWithFilteredResult(_0x46a59b,_0x3360bd){return function(_0x389e7b){if(_0x389e7b){var _0x45a9f2=typeof _0x3360bd['offset']===_0xe9bd('0x1d')&&typeof _0x3360bd[_0xe9bd('0x1e')]===_0xe9bd('0x1d');var _0x494b27=_0x389e7b[_0xe9bd('0x1f')];var _0x3bae08=_0x45a9f2?0x0:_0x3360bd[_0xe9bd('0x20')];var _0x330733=_0x45a9f2?_0x389e7b['count']:_0x3360bd[_0xe9bd('0x20')]+_0x3360bd['limit'];var _0xc6b661;if(_0x330733>=_0x494b27){_0x330733=_0x494b27;_0xc6b661=0xc8;}else{_0xc6b661=0xce;}_0x46a59b['status'](_0xc6b661);return _0x46a59b[_0xe9bd('0x21')](_0xe9bd('0x22'),_0x3bae08+'-'+_0x330733+'/'+_0x494b27)[_0xe9bd('0x1c')](_0x389e7b);}return null;};}function patchUpdates(_0x3dda13){return function(_0x1acb82){try{jsonpatch[_0xe9bd('0x23')](_0x1acb82,_0x3dda13,!![]);}catch(_0x6593ce){return BPromise['reject'](_0x6593ce);}return _0x1acb82[_0xe9bd('0x24')]();};}function saveUpdates(_0x28cd17,_0x4ecaf5){return function(_0x37aec1){if(_0x37aec1){return _0x37aec1['update'](_0x28cd17)[_0xe9bd('0x25')](function(_0x1b9cc9){return _0x1b9cc9;});}return null;};}function removeEntity(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(_0x5bc4bf){return _0x5bc4bf[_0xe9bd('0x26')]()[_0xe9bd('0x25')](function(){_0x36f8c0[_0xe9bd('0x1a')](0xcc)[_0xe9bd('0x1b')]();});}};}function handleEntityNotFound(_0x2641be,_0xb52d45){return function(_0x399f3c){if(!_0x399f3c){_0x2641be[_0xe9bd('0x19')](0x194);}return _0x399f3c;};}function handleError(_0x1ae889,_0x5987af){_0x5987af=_0x5987af||0x1f4;return function(_0x3c211a){logger[_0xe9bd('0x27')](_0x3c211a['stack']);if(_0x3c211a[_0xe9bd('0x28')]){delete _0x3c211a[_0xe9bd('0x28')];}_0x1ae889[_0xe9bd('0x1a')](_0x5987af)[_0xe9bd('0x29')](_0x3c211a);};}exports[_0xe9bd('0x2a')]=function(_0x183601,_0x519f48){var _0x5b7f1d={'raw':!![],'where':{'id':_0x183601['params']['id']}},_0x1de54c={};_0x1de54c[_0xe9bd('0x2b')]=_[_0xe9bd('0x2c')](db[_0xe9bd('0x2d')][_0xe9bd('0x2e')]);_0x1de54c[_0xe9bd('0x2f')]=_['keys'](_0x183601['query']);_0x1de54c[_0xe9bd('0x30')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],_0x1de54c[_0xe9bd('0x2f')]);_0x5b7f1d[_0xe9bd('0x32')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],qs[_0xe9bd('0x33')](_0x183601[_0xe9bd('0x2f')]['fields']));_0x5b7f1d[_0xe9bd('0x32')]=_0x5b7f1d[_0xe9bd('0x32')][_0xe9bd('0x34')]?_0x5b7f1d['attributes']:_0x1de54c['model'];if(_0x183601[_0xe9bd('0x2f')][_0xe9bd('0x35')]){_0x5b7f1d[_0xe9bd('0x36')]=[{'all':!![]}];}_0x5b7f1d=_[_0xe9bd('0x37')]({},_0x5b7f1d,_0x183601[_0xe9bd('0x38')]);return db[_0xe9bd('0x2d')][_0xe9bd('0x39')](_0x5b7f1d)[_0xe9bd('0x25')](handleEntityNotFound(_0x519f48,null))[_0xe9bd('0x25')](respondWithResult(_0x519f48,null))[_0xe9bd('0x3a')](handleError(_0x519f48,null));};exports[_0xe9bd('0x3b')]=function(_0x549dd1,_0x2ad46e){if(_0x549dd1[_0xe9bd('0x3c')]['id']){delete _0x549dd1[_0xe9bd('0x3c')]['id'];}return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x549dd1[_0xe9bd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2ad46e,null))[_0xe9bd('0x25')](saveUpdates(_0x549dd1[_0xe9bd('0x3c')],null))['then'](respondWithResult(_0x2ad46e,null))[_0xe9bd('0x3a')](handleError(_0x2ad46e,null));};exports[_0xe9bd('0x26')]=function(_0x4c7d47,_0x4b1da0){return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x4c7d47['params']['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x4b1da0,null))[_0xe9bd('0x25')](removeEntity(_0x4b1da0,null))[_0xe9bd('0x3a')](handleError(_0x4b1da0,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index caa5cf2..5ee85b2 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 _0xcc52=['define','mail_applications','utf8mb4','utf8mb4_unicode_ci','util','moment','bluebird','path','../../config/environment','./mailApplication.attributes'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xcc52,0x11c));var _0x2cc5=function(_0x56ccf3,_0x340efc){_0x56ccf3=_0x56ccf3-0x0;var _0x4fdffa=_0xcc52[_0x56ccf3];return _0x4fdffa;};'use strict';var _=require('lodash');var util=require(_0x2cc5('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x2cc5('0x1'));var BPromise=require(_0x2cc5('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2cc5('0x3'));var rimraf=require('rimraf');var config=require(_0x2cc5('0x4'));var attributes=require(_0x2cc5('0x5'));module['exports']=function(_0x11bce8,_0x54e360){return _0x11bce8[_0x2cc5('0x6')]('MailApplication',attributes,{'tableName':_0x2cc5('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2cc5('0x8'),'collate':_0x2cc5('0x9')});}; \ No newline at end of file +var _0x2392=['api','path','rimraf','../../config/environment','./mailApplication.attributes','exports','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2392,0xf4));var _0x2239=function(_0x2cfca6,_0x2cb909){_0x2cfca6=_0x2cfca6-0x0;var _0x4f86fb=_0x2392[_0x2cfca6];return _0x4f86fb;};'use strict';var _=require(_0x2239('0x0'));var util=require(_0x2239('0x1'));var logger=require(_0x2239('0x2'))(_0x2239('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2239('0x4'));var rimraf=require(_0x2239('0x5'));var config=require(_0x2239('0x6'));var attributes=require(_0x2239('0x7'));module[_0x2239('0x8')]=function(_0x8e162,_0x4c5d50){return _0x8e162['define'](_0x2239('0x9'),attributes,{'tableName':_0x2239('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2239('0xb'),'collate':_0x2239('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index f95a654..7647ce7 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 _0xd3d2=['raw','attributes','limit','debug','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','MailApplication,\x20%s,\x20%s','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','body','options'];(function(_0x5c8628,_0x2fc5f5){var _0xcbd50e=function(_0x4e8bf1){while(--_0x4e8bf1){_0x5c8628['push'](_0x5c8628['shift']());}};_0xcbd50e(++_0x2fc5f5);}(_0xd3d2,0xec));var _0x2d3d=function(_0x1e29b2,_0x10699c){_0x1e29b2=_0x1e29b2-0x0;var _0x188c43=_0xd3d2[_0x1e29b2];return _0x188c43;};'use strict';var _=require(_0x2d3d('0x0'));var util=require('util');var moment=require(_0x2d3d('0x1'));var BPromise=require(_0x2d3d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2d3d('0x3'))['db'];var utils=require(_0x2d3d('0x4'));var logger=require(_0x2d3d('0x5'))(_0x2d3d('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2d3d('0x7')][_0x2d3d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x49a97b,_0x9f1895,_0x18a050){return new BPromise(function(_0xa93ccf,_0x298ca7){return client['request'](_0x49a97b,_0x18a050)[_0x2d3d('0x9')](function(_0x16198f){logger[_0x2d3d('0xa')](_0x2d3d('0xb'),_0x9f1895,'request\x20sent');logger['debug'](_0x2d3d('0xc'),_0x9f1895,_0x2d3d('0xd'),JSON[_0x2d3d('0xe')](_0x16198f));if(_0x16198f[_0x2d3d('0xf')]){if(_0x16198f[_0x2d3d('0xf')][_0x2d3d('0x10')]===0x1f4){logger['error'](_0x2d3d('0xb'),_0x9f1895,_0x16198f[_0x2d3d('0xf')][_0x2d3d('0x11')]);return _0x298ca7(_0x16198f[_0x2d3d('0xf')]['message']);}logger[_0x2d3d('0xf')]('MailApplication,\x20%s,\x20%s',_0x9f1895,_0x16198f[_0x2d3d('0xf')][_0x2d3d('0x11')]);return _0xa93ccf(_0x16198f[_0x2d3d('0xf')][_0x2d3d('0x11')]);}else{logger[_0x2d3d('0xa')](_0x2d3d('0xb'),_0x9f1895,_0x2d3d('0xd'));_0xa93ccf(_0x16198f[_0x2d3d('0x12')][_0x2d3d('0x11')]);}})[_0x2d3d('0x13')](function(_0x53440c){logger[_0x2d3d('0xf')](_0x2d3d('0xb'),_0x9f1895,_0x53440c);_0x298ca7(_0x53440c);});});}exports[_0x2d3d('0x14')]=function(_0x1aab31){var _0x3c4ade=this;return new Promise(function(_0x59c017,_0x5ca688){return db[_0x2d3d('0x15')][_0x2d3d('0x16')](_0x1aab31[_0x2d3d('0x17')],{'raw':_0x1aab31[_0x2d3d('0x18')]?_0x1aab31[_0x2d3d('0x18')][_0x2d3d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1aab31[_0x2d3d('0x18')]?_0x1aab31[_0x2d3d('0x18')]['where']||null:null,'attributes':_0x1aab31[_0x2d3d('0x18')]?_0x1aab31[_0x2d3d('0x18')][_0x2d3d('0x1a')]||null:null,'limit':_0x1aab31[_0x2d3d('0x18')]?_0x1aab31[_0x2d3d('0x18')][_0x2d3d('0x1b')]||null:null})[_0x2d3d('0x9')](function(_0x18a7ce){logger[_0x2d3d('0xa')](_0x2d3d('0x14'),_0x1aab31);logger[_0x2d3d('0x1c')](_0x2d3d('0x14'),_0x1aab31,JSON[_0x2d3d('0xe')](_0x18a7ce));_0x59c017(_0x18a7ce);})[_0x2d3d('0x13')](function(_0x315a94){logger[_0x2d3d('0xf')](_0x2d3d('0x14'),_0x315a94[_0x2d3d('0x11')],_0x1aab31);_0x5ca688(_0x3c4ade['error'](0x1f4,_0x315a94[_0x2d3d('0x11')]));});});}; \ No newline at end of file +var _0x9650=['then','stringify','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','error','MailApplication,\x20%s,\x20%s','message','result','UpdateMailApplication','MailApplication','update','body','options','attributes','limit'];(function(_0x1486de,_0x1db8c9){var _0x72c5cb=function(_0x39e3ed){while(--_0x39e3ed){_0x1486de['push'](_0x1486de['shift']());}};_0x72c5cb(++_0x1db8c9);}(_0x9650,0x1a7));var _0x0965=function(_0x51a164,_0x1e9155){_0x51a164=_0x51a164-0x0;var _0x5f53de=_0x9650[_0x51a164];return _0x5f53de;};'use strict';var _=require('lodash');var util=require(_0x0965('0x0'));var moment=require(_0x0965('0x1'));var BPromise=require(_0x0965('0x2'));var rs=require(_0x0965('0x3'));var fs=require('fs');var Redis=require(_0x0965('0x4'));var db=require(_0x0965('0x5'))['db'];var utils=require(_0x0965('0x6'));var logger=require('../../config/logger')(_0x0965('0x7'));var config=require(_0x0965('0x8'));var jayson=require(_0x0965('0x9'));var client=jayson[_0x0965('0xa')][_0x0965('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e24c5,_0x257d50,_0x5f2711){return new BPromise(function(_0x150a28,_0x12897e){return client[_0x0965('0xc')](_0x5e24c5,_0x5f2711)['then'](function(_0x59e9f1){logger[_0x0965('0xd')]('MailApplication,\x20%s,\x20%s',_0x257d50,_0x0965('0xe'));logger[_0x0965('0xf')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x257d50,_0x0965('0xe'),JSON['stringify'](_0x59e9f1));if(_0x59e9f1[_0x0965('0x10')]){if(_0x59e9f1['error']['code']===0x1f4){logger[_0x0965('0x10')](_0x0965('0x11'),_0x257d50,_0x59e9f1['error'][_0x0965('0x12')]);return _0x12897e(_0x59e9f1['error']['message']);}logger[_0x0965('0x10')](_0x0965('0x11'),_0x257d50,_0x59e9f1['error']['message']);return _0x150a28(_0x59e9f1['error'][_0x0965('0x12')]);}else{logger[_0x0965('0xd')](_0x0965('0x11'),_0x257d50,_0x0965('0xe'));_0x150a28(_0x59e9f1[_0x0965('0x13')][_0x0965('0x12')]);}})['catch'](function(_0x5047e6){logger[_0x0965('0x10')](_0x0965('0x11'),_0x257d50,_0x5047e6);_0x12897e(_0x5047e6);});});}exports[_0x0965('0x14')]=function(_0x393692){var _0x173d25=this;return new Promise(function(_0x1d38ed,_0x1c9ca5){return db[_0x0965('0x15')][_0x0965('0x16')](_0x393692[_0x0965('0x17')],{'raw':_0x393692['options']?_0x393692[_0x0965('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x393692['options']?_0x393692[_0x0965('0x18')]['where']||null:null,'attributes':_0x393692[_0x0965('0x18')]?_0x393692[_0x0965('0x18')][_0x0965('0x19')]||null:null,'limit':_0x393692[_0x0965('0x18')]?_0x393692['options'][_0x0965('0x1a')]||null:null})[_0x0965('0x1b')](function(_0x273d3a){logger['info'](_0x0965('0x14'),_0x393692);logger['debug'](_0x0965('0x14'),_0x393692,JSON[_0x0965('0x1c')](_0x273d3a));_0x1d38ed(_0x273d3a);})[_0x0965('0x1d')](function(_0x549d4a){logger[_0x0965('0x10')]('UpdateMailApplication',_0x549d4a[_0x0965('0x12')],_0x393692);_0x1c9ca5(_0x173d25[_0x0965('0x10')](0x1f4,_0x549d4a[_0x0965('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 7c11e00..c2ca278 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 _0x4545=['index','/describe','isAuthenticated','show','getMessages','/:id/download','download','create','post','/:id/tags','mailinteraction:addtags','addTags','put','/:id','tracked','mail','mailinteraction:update','update','delete','mailinteraction:destroy','exports','../../components/auth/service','../../components/interaction/service','get'];(function(_0x162cb1,_0x3b1000){var _0x2fd8a3=function(_0x5bc31d){while(--_0x5bc31d){_0x162cb1['push'](_0x162cb1['shift']());}};_0x2fd8a3(++_0x3b1000);}(_0x4545,0x17d));var _0x5454=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4545[_0x17d9e3];return _0x14192d;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x5454('0x0'));var interaction=require(_0x5454('0x1'));var controller=require('./mailInteraction.controller');router[_0x5454('0x2')]('/',auth['isAuthenticated'](),controller[_0x5454('0x3')]);router[_0x5454('0x2')](_0x5454('0x4'),auth[_0x5454('0x5')](),controller['describe']);router[_0x5454('0x2')]('/:id',auth[_0x5454('0x5')](),controller[_0x5454('0x6')]);router[_0x5454('0x2')]('/:id/messages',auth[_0x5454('0x5')](),controller[_0x5454('0x7')]);router[_0x5454('0x2')](_0x5454('0x8'),auth[_0x5454('0x5')](),controller[_0x5454('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5454('0xa')]);router['post']('/:id/messages',auth[_0x5454('0x5')](),controller['addMessage']);router[_0x5454('0xb')](_0x5454('0xc'),auth[_0x5454('0x5')](),interaction['tracked']('mail',_0x5454('0xd')),controller[_0x5454('0xe')]);router[_0x5454('0xf')](_0x5454('0x10'),auth['isAuthenticated'](),interaction[_0x5454('0x11')](_0x5454('0x12'),_0x5454('0x13')),controller[_0x5454('0x14')]);router[_0x5454('0x15')](_0x5454('0x10'),auth[_0x5454('0x5')](),interaction[_0x5454('0x11')]('mail',_0x5454('0x16')),controller['destroy']);router[_0x5454('0x15')]('/:id/tags',auth[_0x5454('0x5')](),controller['removeTags']);module[_0x5454('0x17')]=router; \ No newline at end of file +var _0x92cf=['describe','/:id','show','getMessages','/:id/download','create','post','/:id/tags','mailinteraction:addtags','addTags','tracked','mailinteraction:update','update','delete','destroy','removeTags','exports','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x92cf,0x10b));var _0xf92c=function(_0x4cf2ad,_0x286351){_0x4cf2ad=_0x4cf2ad-0x0;var _0x5048c6=_0x92cf[_0x4cf2ad];return _0x5048c6;};'use strict';var express=require('express');var router=express[_0xf92c('0x0')]();var auth=require(_0xf92c('0x1'));var interaction=require(_0xf92c('0x2'));var controller=require(_0xf92c('0x3'));router[_0xf92c('0x4')]('/',auth[_0xf92c('0x5')](),controller[_0xf92c('0x6')]);router[_0xf92c('0x4')](_0xf92c('0x7'),auth['isAuthenticated'](),controller[_0xf92c('0x8')]);router['get'](_0xf92c('0x9'),auth[_0xf92c('0x5')](),controller[_0xf92c('0xa')]);router[_0xf92c('0x4')]('/:id/messages',auth['isAuthenticated'](),controller[_0xf92c('0xb')]);router[_0xf92c('0x4')](_0xf92c('0xc'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0xf92c('0xd')]);router[_0xf92c('0xe')]('/:id/messages',auth[_0xf92c('0x5')](),controller['addMessage']);router['post'](_0xf92c('0xf'),auth[_0xf92c('0x5')](),interaction['tracked']('mail',_0xf92c('0x10')),controller[_0xf92c('0x11')]);router['put'](_0xf92c('0x9'),auth[_0xf92c('0x5')](),interaction[_0xf92c('0x12')]('mail',_0xf92c('0x13')),controller[_0xf92c('0x14')]);router[_0xf92c('0x15')](_0xf92c('0x9'),auth[_0xf92c('0x5')](),interaction['tracked']('mail','mailinteraction:destroy'),controller[_0xf92c('0x16')]);router[_0xf92c('0x15')](_0xf92c('0xf'),auth[_0xf92c('0x5')](),controller[_0xf92c('0x17')]);module[_0xf92c('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 3748b9f..7fca82d 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 _0xcd9e=['sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM','out'];(function(_0x536ae0,_0x5535b9){var _0xec617=function(_0x30f4f5){while(--_0x30f4f5){_0x536ae0['push'](_0x536ae0['shift']());}};_0xec617(++_0x5535b9);}(_0xcd9e,0x6e));var _0xecd9=function(_0x2f4f58,_0x5671b5){_0x2f4f58=_0x2f4f58-0x0;var _0x29daf3=_0xcd9e[_0x2f4f58];return _0x29daf3;};'use strict';var Sequelize=require(_0xecd9('0x0'));var iconv=require(_0xecd9('0x1'));module[_0xecd9('0x2')]={'closed':{'type':Sequelize[_0xecd9('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xecd9('0x4')]},'disposition':{'type':Sequelize[_0xecd9('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xecd9('0x5')]},'note':{'type':Sequelize[_0xecd9('0x5')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0xecd9('0x5')]},'cc':{'type':Sequelize[_0xecd9('0x6')](_0xecd9('0x7'))},'subject':{'type':Sequelize[_0xecd9('0x6')]()},'attach':{'type':Sequelize[_0xecd9('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xecd9('0x4')]},'substatus':{'type':Sequelize[_0xecd9('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0xecd9('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xecd9('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xecd9('0x8')]('in',_0xecd9('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xecd9('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xa97a=['BOOLEAN','STRING','TEXT','long','DATE','ENUM','out','sequelize','iconv'];(function(_0x58513f,_0x59219e){var _0x5301f4=function(_0x82b51b){while(--_0x82b51b){_0x58513f['push'](_0x58513f['shift']());}};_0x5301f4(++_0x59219e);}(_0xa97a,0x166));var _0xaa97=function(_0x7f1d9c,_0x567f59){_0x7f1d9c=_0x7f1d9c-0x0;var _0x2a27de=_0xa97a[_0x7f1d9c];return _0x2a27de;};'use strict';var Sequelize=require(_0xaa97('0x0'));var iconv=require(_0xaa97('0x1'));module['exports']={'closed':{'type':Sequelize[_0xaa97('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xaa97('0x3')]},'thirdDisposition':{'type':Sequelize[_0xaa97('0x3')]},'note':{'type':Sequelize[_0xaa97('0x3')]},'inReplyTo':{'type':Sequelize[_0xaa97('0x3')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xaa97('0x4')](_0xaa97('0x5'))},'subject':{'type':Sequelize[_0xaa97('0x4')]()},'attach':{'type':Sequelize[_0xaa97('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xaa97('0x6')]},'substatus':{'type':Sequelize[_0xaa97('0x3')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xaa97('0x7')]('in',_0xaa97('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xaa97('0x7')]('in',_0xaa97('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xaa97('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 cf4ccec..f830fe7 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 _0xce22=['rimraf','zip-dir','moment','bluebird','path','squel','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','html-entities','redis','defaults','localhost','./mailInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','error','name','send','map','fullname','Tags','split','forEach','push','TagIds','MailMessage','findOne','out','plainBody','-id','trimStart','catch','waiting','talking','answered','unmanaged','total','closed','UserId','index','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','tools_tags','u.fullname','ui.MailInteractionId','from','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','clone','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','MailInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.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.createdAt','i.updatedAt','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','Contact.lastName','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','MailInteractionId','Setting','enableEmailPreview','rows','show','includeAll','include','create','body','destroy','params','describe','addMessage','ids','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','inlineCss','true','addTags','omit','spread','mailInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','subject','get','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','readFileSync','writeFileSync','eml-format'];(function(_0xc97eb3,_0x244cc8){var _0x15277c=function(_0x391fbe){while(--_0x391fbe){_0xc97eb3['push'](_0xc97eb3['shift']());}};_0x15277c(++_0x244cc8);}(_0xce22,0xea));var _0x2ce2=function(_0x2384e8,_0x52e349){_0x2384e8=_0x2384e8-0x0;var _0x170059=_0xce22[_0x2384e8];return _0x170059;};'use strict';var emlformat=require(_0x2ce2('0x0'));var rimraf=require(_0x2ce2('0x1'));var zipdir=require(_0x2ce2('0x2'));var moment=require(_0x2ce2('0x3'));var BPromise=require(_0x2ce2('0x4'));var util=require('util');var path=require(_0x2ce2('0x5'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2ce2('0x6'));var juice=require(_0x2ce2('0x7'));var Redis=require(_0x2ce2('0x8'));var qs=require(_0x2ce2('0x9'));var as=require(_0x2ce2('0xa'));var logger=require(_0x2ce2('0xb'))(_0x2ce2('0xc'));var config=require('../../config/environment');var db=require(_0x2ce2('0xd'))['db'];var htmlEntities=require(_0x2ce2('0xe'));config[_0x2ce2('0xf')]=_[_0x2ce2('0x10')](config[_0x2ce2('0xf')],{'host':_0x2ce2('0x11'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2ce2('0xf')]));require(_0x2ce2('0x12'))['register'](socket);function respondWithStatusCode(_0x26218a,_0x3c9b36){_0x3c9b36=_0x3c9b36||0xcc;return function(_0x524303){if(_0x524303){return _0x26218a[_0x2ce2('0x13')](_0x3c9b36);}return _0x26218a[_0x2ce2('0x14')](_0x3c9b36)[_0x2ce2('0x15')]();};}function respondWithResult(_0x3dbbbe,_0x4b2407){_0x4b2407=_0x4b2407||0xc8;return function(_0x1b4a4f){if(_0x1b4a4f){return _0x3dbbbe[_0x2ce2('0x14')](_0x4b2407)[_0x2ce2('0x16')](_0x1b4a4f);}};}function respondWithFilteredResult(_0x5efaa1,_0x2a45ea){return function(_0x4d3490){if(_0x4d3490){var _0x4874a5=typeof _0x2a45ea[_0x2ce2('0x17')]===_0x2ce2('0x18')&&typeof _0x2a45ea[_0x2ce2('0x19')]===_0x2ce2('0x18');var _0x1ac6e9=_0x4d3490[_0x2ce2('0x1a')];var _0x313e91=_0x4874a5?0x0:_0x2a45ea['offset'];var _0x4d0a0f=_0x4874a5?_0x4d3490['count']:_0x2a45ea[_0x2ce2('0x17')]+_0x2a45ea[_0x2ce2('0x19')];var _0x2493b0;if(_0x4d0a0f>=_0x1ac6e9){_0x4d0a0f=_0x1ac6e9;_0x2493b0=0xc8;}else{_0x2493b0=0xce;}_0x5efaa1[_0x2ce2('0x14')](_0x2493b0);return _0x5efaa1[_0x2ce2('0x1b')]('Content-Range',_0x313e91+'-'+_0x4d0a0f+'/'+_0x1ac6e9)[_0x2ce2('0x16')](_0x4d3490);}return null;};}function saveUpdates(_0x52d535){return function(_0x280e3d){if(_0x280e3d){return _0x280e3d[_0x2ce2('0x1c')](_0x52d535)[_0x2ce2('0x1d')](function(_0x21e948){return _0x21e948;});}return null;};}function removeEntity(_0x291a17){return function(_0x301874){if(_0x301874){return _0x301874['destroy']()['then'](function(){_0x291a17[_0x2ce2('0x14')](0xcc)[_0x2ce2('0x15')]();});}};}function handleEntityNotFound(_0x3328ad){return function(_0x8f6615){if(!_0x8f6615){_0x3328ad['sendStatus'](0x194);}return _0x8f6615;};}function handleError(_0x5b2b79,_0x5b0eb3){_0x5b0eb3=_0x5b0eb3||0x1f4;return function(_0x17d3b2){logger[_0x2ce2('0x1e')](_0x17d3b2['stack']);if(_0x17d3b2[_0x2ce2('0x1f')]){delete _0x17d3b2[_0x2ce2('0x1f')];}_0x5b2b79[_0x2ce2('0x14')](_0x5b0eb3)[_0x2ce2('0x20')](_0x17d3b2);};}function getInteractionUsers(_0x3cd92f,_0xcba5ca){return new BPromise(function(_0x3f3927,_0x5c748f){try{if(_0xcba5ca[_0x3cd92f['id']]){_0x3cd92f['Users']=_[_0x2ce2('0x21')](_0xcba5ca[_0x3cd92f['id']],function(_0x5741f8){return{'id':_0x5741f8['id'],'fullname':_0x5741f8[_0x2ce2('0x22')]};});}}catch(_0x2e3296){_0x5c748f(_0x2e3296);}_0x3f3927(_0x3cd92f);});}function getInteractionTags(_0x3a701e,_0x44018f){return new BPromise(function(_0x17be99,_0x5a79da){try{if(_0x3a701e['TagIds']){_0x3a701e[_0x2ce2('0x23')]=[];_0x3a701e['TagIds'][_0x2ce2('0x24')](',')[_0x2ce2('0x25')](function(_0x15a245){_0x3a701e[_0x2ce2('0x23')][_0x2ce2('0x26')](_0x44018f[_0x15a245]);});}delete _0x3a701e[_0x2ce2('0x27')];}catch(_0x4b201e){_0x5a79da(_0x4b201e);}_0x17be99(_0x3a701e);});}function getLastMessageText(_0x2f63a7){return new BPromise(function(_0x1d813d,_0xd35aee){return db[_0x2ce2('0x28')][_0x2ce2('0x29')]({'where':{'$and':[{'MailInteractionId':_0x2f63a7['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x2ce2('0x2a')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x2ce2('0x2b')],'order':_0x2ce2('0x2c'),'raw':!![]})['then'](function(_0xddabc0){if(_0xddabc0&&_0xddabc0['plainBody']){_0x2f63a7['lastMsgText']=_[_0x2ce2('0x2d')](_0xddabc0[_0x2ce2('0x2b')]);}_0x1d813d(_0x2f63a7);})['catch'](function(_0x36474b){_0xd35aee(_0x36474b);});});}function updateMailInteraction(_0x471f3d,_0x3c13bc,_0x46b46d,_0x3cdcb2){return new BPromise(function(_0xda0756,_0x56f6e0){return getInteractionUsers(_0x471f3d,_0x46b46d)[_0x2ce2('0x1d')](function(_0x1d01cb){return getInteractionTags(_0x1d01cb,_0x3c13bc);})[_0x2ce2('0x1d')](function(_0x3da6e6){return getStateInteraction(_0x3da6e6);})['then'](function(_0x46fab3){if(_0x3cdcb2){_0xda0756(getLastMessageText(_0x46fab3));}else{_0xda0756(_0x46fab3);}})[_0x2ce2('0x2e')](function(_0x247f6f){_0x56f6e0(_0x247f6f);});});}function getStateInteraction(_0x417923){return new BPromise(function(_0x339263){_0x417923[_0x2ce2('0x2f')]=0x0;_0x417923[_0x2ce2('0x30')]=0x0;_0x417923[_0x2ce2('0x31')]=0x0;_0x417923[_0x2ce2('0x32')]=0x0;_0x417923[_0x2ce2('0x33')]=0x0;if(!_0x417923[_0x2ce2('0x34')]&&!_0x417923['UserId']){_0x417923[_0x2ce2('0x2f')]+=0x1;}if(!_0x417923[_0x2ce2('0x34')]&&_0x417923[_0x2ce2('0x35')]){_0x417923[_0x2ce2('0x30')]+=0x1;if(_0x417923[_0x2ce2('0x2f')]){_0x417923[_0x2ce2('0x2f')]-=0x1;}}if(_0x417923[_0x2ce2('0x34')]&&_0x417923[_0x2ce2('0x35')]){_0x417923[_0x2ce2('0x31')]+=0x1;if(_0x417923[_0x2ce2('0x30')]){_0x417923[_0x2ce2('0x30')]-=0x1;}}if(_0x417923[_0x2ce2('0x34')]&&!_0x417923['UserId']){_0x417923[_0x2ce2('0x32')]+=0x1;if(_0x417923[_0x2ce2('0x2f')]){_0x417923['waiting']-=0x1;}}_0x417923[_0x2ce2('0x33')]+=0x1;_0x339263(_0x417923);});}exports[_0x2ce2('0x36')]=function(_0x3b5f23,_0xe3f498){var _0x33d95f={},_0x5b8454={},_0x4629f5={'count':0x0,'rows':[]};var _0x2b07fc=_[_0x2ce2('0x21')](db['MailInteraction'][_0x2ce2('0x37')],function(_0x1705a8){return{'name':_0x1705a8[_0x2ce2('0x38')],'type':_0x1705a8[_0x2ce2('0x39')][_0x2ce2('0x3a')]};});_0x5b8454[_0x2ce2('0x3b')]=_[_0x2ce2('0x21')](_0x2b07fc,'name');_0x5b8454['query']=_[_0x2ce2('0x3c')](_0x3b5f23[_0x2ce2('0x3d')]);_0x5b8454[_0x2ce2('0x3e')]=_[_0x2ce2('0x3f')](_0x5b8454[_0x2ce2('0x3b')],_0x5b8454[_0x2ce2('0x3d')]);_0x33d95f['attributes']=_[_0x2ce2('0x3f')](_0x5b8454[_0x2ce2('0x3b')],qs[_0x2ce2('0x40')](_0x3b5f23[_0x2ce2('0x3d')]['fields']));_0x33d95f['attributes']=_0x33d95f[_0x2ce2('0x41')][_0x2ce2('0x42')]?_0x33d95f[_0x2ce2('0x41')]:_0x5b8454['model'];if(!_0x3b5f23[_0x2ce2('0x3d')][_0x2ce2('0x43')](_0x2ce2('0x44'))){_0x33d95f[_0x2ce2('0x19')]=qs[_0x2ce2('0x19')](_0x3b5f23['query']['limit']);_0x33d95f[_0x2ce2('0x17')]=qs[_0x2ce2('0x17')](_0x3b5f23[_0x2ce2('0x3d')][_0x2ce2('0x17')]);}_0x33d95f[_0x2ce2('0x45')]=qs[_0x2ce2('0x46')](_0x3b5f23['query']['sort']);_0x33d95f[_0x2ce2('0x47')]=qs[_0x2ce2('0x3e')](_[_0x2ce2('0x48')](_0x3b5f23[_0x2ce2('0x3d')],_0x5b8454[_0x2ce2('0x3e')]),_0x2b07fc);var _0xf8d9d=[];var _0x59fe0c=squel[_0x2ce2('0x49')]()[_0x2ce2('0x4a')]('id')['field'](_0x2ce2('0x1f'))[_0x2ce2('0x4a')](_0x2ce2('0x4b'))['from'](_0x2ce2('0x4c'));var _0x39cfd8=squel[_0x2ce2('0x49')]()['field']('u.id')[_0x2ce2('0x4a')](_0x2ce2('0x4d'))[_0x2ce2('0x4a')](_0x2ce2('0x4e'))[_0x2ce2('0x4f')]('user_has_mail_interactions','ui')[_0x2ce2('0x50')](_0x2ce2('0x51'),'u',_0x2ce2('0x52'));var _0x14d34c=squel[_0x2ce2('0x49')]()[_0x2ce2('0x4f')]('mail_interactions','i')['left_join'](_0x2ce2('0x53'),'c',_0x2ce2('0x54'))[_0x2ce2('0x50')](_0x2ce2('0x51'),'o',_0x2ce2('0x55'))[_0x2ce2('0x50')](_0x2ce2('0x56'),'a','a.id\x20=\x20i.MailAccountId')['left_join']('mail_messages','me',_0x2ce2('0x57'))[_0x2ce2('0x50')](_0x2ce2('0x58'),'it',_0x2ce2('0x59'))[_0x2ce2('0x50')](_0x2ce2('0x4c'),'t',_0x2ce2('0x5a'));var _0x1c8b64=squel['expr']();var _0x454d12=[];var _0x9dd1ba=squel[_0x2ce2('0x5b')]();var _0x2e6f01;if(_0x3b5f23[_0x2ce2('0x3d')][_0x2ce2('0x5c')]){_0x2e6f01=as[_0x2ce2('0x5d')](_0x3b5f23[_0x2ce2('0x3d')][_0x2ce2('0x5c')]);var _0x267e23=_0x2e6f01[_0x2ce2('0x5e')];for(var _0x2fd01f=0x0;_0x2fd01f<_0x2e6f01[_0x2ce2('0x5f')]['length'];_0x2fd01f++){var _0x38a5da=_0x2e6f01[_0x2ce2('0x5f')][_0x2fd01f];var _0x2d52b4='i';var _0x59fbd0=_[_0x2ce2('0x60')](_0x2b07fc,['name',_0x38a5da[_0x2ce2('0x4a')]]);if(!_0x59fbd0){switch(_0x38a5da[_0x2ce2('0x4a')]){case _0x2ce2('0x61'):if(_0x38a5da[_0x2ce2('0x62')]==0x1){_0x14d34c[_0x2ce2('0x63')]('`'+_0x38a5da[_0x2ce2('0x4a')]+_0x2ce2('0x64'));}else{_0x14d34c[_0x2ce2('0x63')]('`'+_0x38a5da[_0x2ce2('0x4a')]+'`\x20>\x200');}break;case _0x2ce2('0x65'):if(_0x38a5da[_0x2ce2('0x66')]==='$substring'){if(_0x38a5da[_0x2ce2('0x62')][_0x2ce2('0x24')]('\x20')[_0x2ce2('0x42')]>0x1){_0x1c8b64[_0x267e23](_0x2ce2('0x67'),qs[_0x2ce2('0x68')](_0x38a5da[_0x2ce2('0x62')]),null);}else{var _0x4e3d16='%'+_0x38a5da[_0x2ce2('0x62')]+'%';_0x1c8b64[_0x267e23](_0x2ce2('0x69'),_0x4e3d16,_0x4e3d16,_0x4e3d16);}}else{_0x59fbd0=_[_0x2ce2('0x60')](_0x2b07fc,[_0x2ce2('0x1f'),_0x2ce2('0x6a')]);_0x38a5da['field']=_0x2ce2('0x6a');_0x2e796e=as[_0x2ce2('0x6b')](_0x2d52b4,_0x59fbd0[_0x2ce2('0x39')],_0x38a5da);_0x1c8b64[_0x267e23](_0x2e796e['text'],_0x2e796e[_0x2ce2('0x62')][_0x2ce2('0x6c')],_0x2e796e[_0x2ce2('0x62')][_0x2ce2('0x15')]);}break;case'Tag':var _0x4ef75f=_0x38a5da['value'][_0x2ce2('0x24')](',')['map'](function(_0x3649af){return Number(_0x3649af);});_0x4ef75f[_0x2ce2('0x25')](function(_0x3b7687){_0x9dd1ba['or'](_0x2ce2('0x6d'),'%,'+_0x3b7687+',%');});_0x454d12=_[_0x2ce2('0x6e')](_0x454d12,_0x4ef75f);break;case'User':if(_0x38a5da[_0x2ce2('0x66')]==='$substring'){_0x1c8b64[_0x267e23](_0x2ce2('0x6f'),'%'+_0x38a5da[_0x2ce2('0x62')]+'%',null);}else{_0x59fbd0=_[_0x2ce2('0x60')](_0x2b07fc,[_0x2ce2('0x1f'),_0x2ce2('0x35')]);_0x38a5da['field']='UserId';_0x2e796e=as['buildExpression'](_0x2d52b4,_0x59fbd0['type'],_0x38a5da);_0x1c8b64[_0x267e23](_0x2e796e[_0x2ce2('0x70')],_0x2e796e[_0x2ce2('0x62')][_0x2ce2('0x6c')],_0x2e796e[_0x2ce2('0x62')][_0x2ce2('0x15')]);}break;case'plainBody':_0x2e796e=as[_0x2ce2('0x6b')]('me',null,_0x38a5da);_0x1c8b64[_0x267e23](_0x2e796e['text'],_0x2e796e[_0x2ce2('0x62')][_0x2ce2('0x6c')],_0x2e796e[_0x2ce2('0x62')][_0x2ce2('0x15')]);break;}}else{var _0x2e796e=as[_0x2ce2('0x6b')](_0x2d52b4,_0x59fbd0['type'],_0x38a5da);_0x1c8b64[_0x267e23](_0x2e796e[_0x2ce2('0x70')],_0x2e796e[_0x2ce2('0x62')][_0x2ce2('0x6c')],_0x2e796e['value'][_0x2ce2('0x15')]);}}}else{var _0x18ca8e=_(_0x3b5f23[_0x2ce2('0x3d')])['keys']()[_0x2ce2('0x21')](function(_0x457378){return _[_0x2ce2('0x71')](_0x2b07fc,[_0x2ce2('0x1f'),_0x457378])?_0x457378:undefined;})[_0x2ce2('0x72')]()['value']();if(!_[_0x2ce2('0x73')](_0x18ca8e)){_0x18ca8e['forEach'](function(_0x5e09c0){if(_0x5e09c0===_0x2ce2('0x74')){_0x14d34c['where'](_0x2ce2('0x75'),[][_0x2ce2('0x76')](_0x3b5f23[_0x2ce2('0x3d')][_0x5e09c0]));}else if(_0x5e09c0===_0x2ce2('0x77')){var _0x5a3848=JSON[_0x2ce2('0x78')](_0x3b5f23[_0x2ce2('0x3d')][_0x5e09c0])['$gte'];var _0x19a269=JSON[_0x2ce2('0x78')](_0x3b5f23['query'][_0x5e09c0])[_0x2ce2('0x79')];_0x14d34c[_0x2ce2('0x47')](_0x2ce2('0x7a'),_0x5a3848,_0x19a269);}else{if(_0x3b5f23[_0x2ce2('0x3d')][_0x5e09c0]===_0x2ce2('0x7b')){_0x14d34c[_0x2ce2('0x47')]('i.'+_0x5e09c0+_0x2ce2('0x7c'));}else{_0x14d34c['where']('i.'+_0x5e09c0+_0x2ce2('0x7d'),_0x3b5f23[_0x2ce2('0x3d')][_0x5e09c0]);}}});}if(_0x3b5f23[_0x2ce2('0x3d')][_0x2ce2('0x7e')]){if(_0x3b5f23[_0x2ce2('0x3d')][_0x2ce2('0x7e')]==0x1){_0x14d34c[_0x2ce2('0x63')](_0x2ce2('0x7f'));}else{_0x14d34c[_0x2ce2('0x63')](_0x2ce2('0x80'));}}if(_0x3b5f23['query'][_0x2ce2('0x81')]){_0x454d12=_[_0x2ce2('0x82')](_0x3b5f23[_0x2ce2('0x3d')][_0x2ce2('0x81')])?_0x3b5f23[_0x2ce2('0x3d')][_0x2ce2('0x81')]:new Array(_0x3b5f23[_0x2ce2('0x3d')][_0x2ce2('0x81')]);_0x454d12[_0x2ce2('0x25')](function(_0x597fa1){_0x9dd1ba['or'](_0x2ce2('0x6d'),'%,'+_0x597fa1+',%');});}if(_0x3b5f23[_0x2ce2('0x3d')][_0x2ce2('0x83')]){var _0x25ef37=_0x3b5f23['query'][_0x2ce2('0x83')][_0x2ce2('0x84')]('\x5c','\x5c\x5c')[_0x2ce2('0x84')](/'/g,'\x27\x27');if(qs[_0x2ce2('0x85')](_0x25ef37)){_0x1c8b64['or'](_0x2ce2('0x86'),_0x25ef37+'%');}else if(qs['isEmail'](_0x25ef37)){_0x1c8b64['or'](_0x2ce2('0x87'),_0x25ef37+'%');}else{_0x1c8b64['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2ce2('0x68')](_0x25ef37))['or'](_0x2ce2('0x88'),qs[_0x2ce2('0x68')](_0x25ef37));}}}_0x14d34c[_0x2ce2('0x47')](_0x1c8b64);_0x14d34c[_0x2ce2('0x89')](_0x2ce2('0x8a'));var _0xad0b2c={'type':db[_0x2ce2('0x8b')]['QueryTypes']['SELECT'],'raw':!![]};var _0x15d38b=_0x14d34c[_0x2ce2('0x8c')]();_0x15d38b[_0x2ce2('0x4a')]('i.id');_0x15d38b[_0x2ce2('0x4a')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x33d95f['order']){_0x33d95f[_0x2ce2('0x45')]['forEach'](function(_0x350cda){var _0x4a54bd=_0x350cda[0x0]==='contactName'?_0x350cda[0x0]:'i.'+_0x350cda[0x0];_0x14d34c[_0x2ce2('0x45')](_0x4a54bd,_0x350cda[0x1]===_0x2ce2('0x8d')?![]:!![]);});}if(!_[_0x2ce2('0x73')](_0x454d12)){_0x14d34c['having'](_0x9dd1ba);_0x15d38b[_0x2ce2('0x47')](_0x2ce2('0x8e'),_0x454d12);}BPromise[_0x2ce2('0x8f')]()[_0x2ce2('0x1d')](function(){if(!_0x2e6f01){if(_0x3b5f23['query'][_0x2ce2('0x74')])return;_0x15d38b[_0x2ce2('0x47')](_0x2ce2('0x90'));_0x14d34c[_0x2ce2('0x47')](_0x2ce2('0x90'));return;}if(_0x3b5f23[_0x2ce2('0x91')][_0x2ce2('0x92')]!==_0x2ce2('0x93'))return;return _0x3b5f23[_0x2ce2('0x91')][_0x2ce2('0x94')]({'attributes':['id'],'raw':!![]})[_0x2ce2('0x1d')](function(_0x521fb3){if(_[_0x2ce2('0x73')](_0x521fb3)){_0x15d38b['where']('i.MailAccountId\x20IS\x20NULL');_0x14d34c[_0x2ce2('0x47')](_0x2ce2('0x95'));}else{_0x15d38b[_0x2ce2('0x47')](_0x2ce2('0x75'),_[_0x2ce2('0x21')](_0x521fb3,'id'));_0x14d34c[_0x2ce2('0x47')]('i.MailAccountId\x20IN\x20?',_[_0x2ce2('0x21')](_0x521fb3,'id'));}});})[_0x2ce2('0x1d')](function(){if(_0x3b5f23[_0x2ce2('0x91')][_0x2ce2('0x92')]==='agent'&&!_0x2e6f01&&!_0x3b5f23['query']['MailAccountId'])return[];return db['sequelize']['query'](_0x15d38b[_0x2ce2('0x96')](),_0xad0b2c);})['then'](function(_0x52b271){_0x4629f5[_0x2ce2('0x1a')]=_0x52b271[_0x2ce2('0x42')];if(_0x4629f5['count']===0x0)return[];return db[_0x2ce2('0x97')][_0x2ce2('0x3d')](_0x59fe0c['toString'](),_0xad0b2c)[_0x2ce2('0x1d')](function(_0x1246e3){_0xf8d9d=_[_0x2ce2('0x98')](_0x1246e3,'id');_0xad0b2c=_[_0x2ce2('0x99')](_0xad0b2c,{'model':db[_0x2ce2('0x9a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3b5f23[_0x2ce2('0x3d')]['fields']){_0x33d95f[_0x2ce2('0x41')]['forEach'](function(_0x2c5df3){_0x14d34c[_0x2ce2('0x4a')]('i.'+_0x2c5df3);});}else{_0x14d34c[_0x2ce2('0x4a')](_0x2ce2('0x9b'),'unreadMessages');_0x14d34c[_0x2ce2('0x4a')](_0x2ce2('0x9c'),_0x2ce2('0x9d'));_0x14d34c[_0x2ce2('0x4a')](_0x2ce2('0x9e'),'Account.mandatoryDisposition');_0x14d34c[_0x2ce2('0x4a')](_0x2ce2('0x9f'),'contactName');_0x14d34c['field'](_0x2ce2('0x8a'));_0x14d34c[_0x2ce2('0x4a')](_0x2ce2('0xa0'));_0x14d34c[_0x2ce2('0x4a')](_0x2ce2('0xa1'));_0x14d34c[_0x2ce2('0x4a')]('i.closed');_0x14d34c[_0x2ce2('0x4a')](_0x2ce2('0xa2'));_0x14d34c[_0x2ce2('0x4a')](_0x2ce2('0xa3'));_0x14d34c['field'](_0x2ce2('0xa4'));_0x14d34c[_0x2ce2('0x4a')]('i.lastMsgDirection');_0x14d34c[_0x2ce2('0x4a')](_0x2ce2('0xa5'));_0x14d34c[_0x2ce2('0x4a')](_0x2ce2('0xa6'));_0x14d34c[_0x2ce2('0x4a')](_0x2ce2('0xa7'));_0x14d34c[_0x2ce2('0x4a')](_0x2ce2('0xa8'));_0x14d34c[_0x2ce2('0x4a')](_0x2ce2('0xa9'));_0x14d34c['field'](_0x2ce2('0xaa'));_0x14d34c['field'](_0x2ce2('0xab'));_0x14d34c[_0x2ce2('0x4a')](_0x2ce2('0xac'));_0x14d34c['field'](_0x2ce2('0xad'));_0x14d34c[_0x2ce2('0x4a')](_0x2ce2('0xae'),_0x2ce2('0xaf'));_0x14d34c['field']('c.lastName',_0x2ce2('0xb0'));_0x14d34c[_0x2ce2('0x4a')]('c.email','Contact.email');_0x14d34c['field']('c.phone','Contact.phone');_0x14d34c['field']('c.mobile',_0x2ce2('0xb1'));_0x14d34c[_0x2ce2('0x4a')](_0x2ce2('0xb2'),_0x2ce2('0xb3'));_0x14d34c[_0x2ce2('0x4a')]('o.fullname','Owner.fullname');_0x14d34c[_0x2ce2('0x4a')](_0x2ce2('0xb4'),_0x2ce2('0xb5'));_0x14d34c['field'](_0x2ce2('0xb6'),'TagIds');}if(_0x33d95f['limit'])_0x14d34c[_0x2ce2('0x19')](_0x33d95f[_0x2ce2('0x19')]);if(_0x33d95f[_0x2ce2('0x17')])_0x14d34c['offset'](_0x33d95f[_0x2ce2('0x17')]);return db[_0x2ce2('0x97')][_0x2ce2('0x3d')](_0x14d34c['toString'](),_0xad0b2c);})[_0x2ce2('0x1d')](function(_0x30b17e){if(_0x30b17e[_0x2ce2('0x42')]>0x0)_0x39cfd8[_0x2ce2('0x47')](_0x2ce2('0xb7'),_['map'](_0x30b17e,'id'));return db['sequelize'][_0x2ce2('0x3d')](_0x39cfd8['toString'](),_0xad0b2c)['then'](function(_0x24a297){var _0x22226a=_['groupBy'](_0x24a297,_0x2ce2('0xb8'));var _0x10b85b=[];return db[_0x2ce2('0xb9')][_0x2ce2('0x29')]({'attributes':[_0x2ce2('0xba')],'raw':!![]})[_0x2ce2('0x1d')](function(_0x4bfb7a){var _0x27304c=_0x4bfb7a['enableEmailPreview'];_0x30b17e[_0x2ce2('0x25')](function(_0x495f09){_0x10b85b[_0x2ce2('0x26')](updateMailInteraction(_0x495f09,_0xf8d9d,_0x22226a,_0x27304c));});return BPromise['all'](_0x10b85b);});});});})['then'](function(_0x2f0208){_0x4629f5[_0x2ce2('0xbb')]=_0x2f0208;return _0x4629f5;})[_0x2ce2('0x1d')](respondWithFilteredResult(_0xe3f498,_0x33d95f))[_0x2ce2('0x2e')](handleError(_0xe3f498,null));};exports[_0x2ce2('0xbc')]=function(_0x367a3d,_0x33d1a3){var _0x4157bc={'raw':![],'where':{'id':_0x367a3d['params']['id']}},_0x16c1ef={};_0x16c1ef[_0x2ce2('0x3b')]=_[_0x2ce2('0x3c')](db['MailInteraction'][_0x2ce2('0x37')]);_0x16c1ef['query']=_[_0x2ce2('0x3c')](_0x367a3d[_0x2ce2('0x3d')]);_0x16c1ef['filters']=_[_0x2ce2('0x3f')](_0x16c1ef[_0x2ce2('0x3b')],_0x16c1ef[_0x2ce2('0x3d')]);_0x4157bc[_0x2ce2('0x41')]=_[_0x2ce2('0x3f')](_0x16c1ef[_0x2ce2('0x3b')],qs[_0x2ce2('0x40')](_0x367a3d[_0x2ce2('0x3d')][_0x2ce2('0x40')]));_0x4157bc['attributes']=_0x4157bc[_0x2ce2('0x41')][_0x2ce2('0x42')]?_0x4157bc[_0x2ce2('0x41')]:_0x16c1ef[_0x2ce2('0x3b')];if(_0x367a3d[_0x2ce2('0x3d')][_0x2ce2('0xbd')]){_0x4157bc[_0x2ce2('0xbe')]=[{'all':!![]}];}_0x4157bc=_[_0x2ce2('0x99')]({},_0x4157bc,_0x367a3d['options']);return db[_0x2ce2('0x9a')][_0x2ce2('0x60')](_0x4157bc)[_0x2ce2('0x1d')](handleEntityNotFound(_0x33d1a3,null))[_0x2ce2('0x1d')](respondWithResult(_0x33d1a3,null))[_0x2ce2('0x2e')](handleError(_0x33d1a3,null));};exports[_0x2ce2('0xbf')]=function(_0x3ba86b,_0x54ccc4){return db['MailInteraction']['create'](_0x3ba86b['body'],{})['then'](respondWithResult(_0x54ccc4,0xc9))[_0x2ce2('0x2e')](handleError(_0x54ccc4,null));};exports[_0x2ce2('0x1c')]=function(_0x3e3eb8,_0x2e3342){if(_0x3e3eb8[_0x2ce2('0xc0')]['id']){delete _0x3e3eb8[_0x2ce2('0xc0')]['id'];}return db[_0x2ce2('0x9a')][_0x2ce2('0x60')]({'where':{'id':_0x3e3eb8['params']['id']}})[_0x2ce2('0x1d')](handleEntityNotFound(_0x2e3342,null))[_0x2ce2('0x1d')](saveUpdates(_0x3e3eb8[_0x2ce2('0xc0')],null))[_0x2ce2('0x1d')](respondWithResult(_0x2e3342,null))[_0x2ce2('0x2e')](handleError(_0x2e3342,null));};exports[_0x2ce2('0xc1')]=function(_0x3bb119,_0x5f5500){return db[_0x2ce2('0x9a')][_0x2ce2('0x60')]({'where':{'id':_0x3bb119[_0x2ce2('0xc2')]['id']}})['then'](handleEntityNotFound(_0x5f5500,null))[_0x2ce2('0x1d')](removeEntity(_0x5f5500,null))[_0x2ce2('0x2e')](handleError(_0x5f5500,null));};exports[_0x2ce2('0xc3')]=function(_0x51938c,_0x35293d){return db[_0x2ce2('0x9a')]['describe']()[_0x2ce2('0x1d')](respondWithResult(_0x35293d,null))[_0x2ce2('0x2e')](handleError(_0x35293d,null));};exports['addMessage']=function(_0xebc603,_0x108b7b){return db[_0x2ce2('0x28')][_0x2ce2('0x60')]({'where':{'id':_0xebc603[_0x2ce2('0xc2')]['id']}})[_0x2ce2('0x1d')](handleEntityNotFound(_0x108b7b,null))[_0x2ce2('0x1d')](function(_0x5941c6){if(_0x5941c6){return _0x5941c6[_0x2ce2('0xc4')](_0xebc603['body'][_0x2ce2('0xc5')],_['omit'](_0xebc603[_0x2ce2('0xc0')],[_0x2ce2('0xc5'),'id'])||{});}})[_0x2ce2('0x1d')](respondWithResult(_0x108b7b,null))[_0x2ce2('0x2e')](handleError(_0x108b7b,null));};exports[_0x2ce2('0xc6')]=function(_0x5ab13f,_0x309201){var _0x4b3f88={'raw':![],'where':{}};var _0xa0beb={};var _0x31c731={'count':0x0,'rows':[]};return db[_0x2ce2('0x9a')]['findOne']({'where':{'id':_0x5ab13f[_0x2ce2('0xc2')]['id']}})[_0x2ce2('0x1d')](handleEntityNotFound(_0x309201,null))[_0x2ce2('0x1d')](function(_0x15d1da){if(_0x15d1da){_0xa0beb['model']=_[_0x2ce2('0x3c')](db[_0x2ce2('0x28')][_0x2ce2('0x37')]);_0xa0beb['query']=_[_0x2ce2('0x3c')](_0x5ab13f[_0x2ce2('0x3d')]);_0xa0beb[_0x2ce2('0x3e')]=_['intersection'](_0xa0beb[_0x2ce2('0x3b')],_0xa0beb[_0x2ce2('0x3d')]);_0x4b3f88[_0x2ce2('0x41')]=_[_0x2ce2('0x3f')](_0xa0beb[_0x2ce2('0x3b')],qs['fields'](_0x5ab13f[_0x2ce2('0x3d')][_0x2ce2('0x40')]));_0x4b3f88[_0x2ce2('0x41')]=_0x4b3f88[_0x2ce2('0x41')][_0x2ce2('0x42')]?_0x4b3f88[_0x2ce2('0x41')]:_0xa0beb[_0x2ce2('0x3b')];if(!_0x5ab13f[_0x2ce2('0x3d')][_0x2ce2('0x43')](_0x2ce2('0x44'))){_0x4b3f88[_0x2ce2('0x19')]=qs[_0x2ce2('0x19')](_0x5ab13f['query'][_0x2ce2('0x19')]);_0x4b3f88[_0x2ce2('0x17')]=qs[_0x2ce2('0x17')](_0x5ab13f[_0x2ce2('0x3d')][_0x2ce2('0x17')]);}_0x4b3f88[_0x2ce2('0x45')]=qs[_0x2ce2('0x46')](_0x5ab13f['query']['sort']);_0x4b3f88[_0x2ce2('0x47')]=qs['filters'](_[_0x2ce2('0x48')](_0x5ab13f[_0x2ce2('0x3d')],_0xa0beb['filters']));_0x4b3f88['where'][_0x2ce2('0xb8')]=_0x15d1da['id'];if(_0x5ab13f[_0x2ce2('0x3d')]['filter']){_0x4b3f88['where']=_[_0x2ce2('0x99')](_0x4b3f88['where'],{'$or':_['map'](_0x4b3f88[_0x2ce2('0x41')],function(_0x444f6c){var _0xe2e4f5={};_0xe2e4f5[_0x444f6c]={'$like':'%'+_0x5ab13f[_0x2ce2('0x3d')][_0x2ce2('0x83')]+'%'};return _0xe2e4f5;})});}if(_0x5ab13f['query']['$gte']){var _0x1102ef=_0x5ab13f['query'][_0x2ce2('0xc7')][_0x2ce2('0x24')](',');var _0x4da776={};_0x4da776[_0x1102ef[0x0]]={'$gte':moment(_0x1102ef[0x1])[_0x2ce2('0xc8')](_0x2ce2('0xc9'))};_0x4b3f88['where']=_['merge'](_0x4b3f88[_0x2ce2('0x47')],_0x4da776);}_0x4b3f88=_['merge']({},_0x4b3f88,_0x5ab13f[_0x2ce2('0xca')]);return db[_0x2ce2('0x28')][_0x2ce2('0x1a')]({'where':_0x4b3f88[_0x2ce2('0x47')]})[_0x2ce2('0x1d')](function(_0x4be666){_0x31c731[_0x2ce2('0x1a')]=_0x4be666;if(_0x5ab13f[_0x2ce2('0x3d')][_0x2ce2('0xbd')]){_0x4b3f88[_0x2ce2('0xbe')]=[{'all':!![]}];}return db[_0x2ce2('0x28')][_0x2ce2('0xcb')](_0x4b3f88);})[_0x2ce2('0x1d')](function(_0x467a73){if(_0x5ab13f[_0x2ce2('0x3d')][_0x2ce2('0xcc')]===_0x2ce2('0xcd')){for(var _0x2683a1=0x0;_0x2683a1<_0x467a73[_0x2ce2('0x42')];_0x2683a1++){_0x467a73[_0x2683a1][_0x2ce2('0xc0')]=juice(_0x467a73[_0x2683a1][_0x2ce2('0xc0')]);}}_0x31c731[_0x2ce2('0xbb')]=_0x467a73;return _0x31c731;});}})[_0x2ce2('0x1d')](respondWithFilteredResult(_0x309201,_0x4b3f88))[_0x2ce2('0x2e')](handleError(_0x309201,null));};exports[_0x2ce2('0xce')]=function(_0x5e1ad3,_0x24481f){return db[_0x2ce2('0x9a')][_0x2ce2('0x60')]({'where':{'id':_0x5e1ad3[_0x2ce2('0xc2')]['id']}})[_0x2ce2('0x1d')](handleEntityNotFound(_0x24481f,null))['then'](function(_0x41a514){if(_0x41a514){return _0x41a514['setTags'](_0x5e1ad3['body'][_0x2ce2('0xc5')],_[_0x2ce2('0xcf')](_0x5e1ad3[_0x2ce2('0xc0')],[_0x2ce2('0xc5'),'id'])||{})[_0x2ce2('0xd0')](function(){return db['Tag'][_0x2ce2('0xcb')]({'attributes':['id',_0x2ce2('0x1f'),_0x2ce2('0x4b')],'where':{'id':_0x5e1ad3[_0x2ce2('0xc0')]['ids']}});})[_0x2ce2('0x1d')](function(_0x919a6d){socket['emit'](_0x2ce2('0xd1'),{'id':Number(_0x5e1ad3[_0x2ce2('0xc2')]['id']),'tags':_0x919a6d||[]});return{'id':Number(_0x5e1ad3[_0x2ce2('0xc2')]['id']),'tags':_0x919a6d||[]};});}})[_0x2ce2('0x1d')](respondWithResult(_0x24481f,null))['catch'](handleError(_0x24481f,null));};exports[_0x2ce2('0xd2')]=function(_0x320c4b,_0x493e12){return db[_0x2ce2('0x9a')][_0x2ce2('0x60')]({'where':{'id':_0x320c4b[_0x2ce2('0xc2')]['id']}})[_0x2ce2('0x1d')](handleEntityNotFound(_0x493e12,null))[_0x2ce2('0x1d')](function(_0x194d9d){if(_0x194d9d){return _0x194d9d[_0x2ce2('0xd2')](_0x320c4b[_0x2ce2('0x3d')][_0x2ce2('0xc5')]);}})[_0x2ce2('0x1d')](respondWithStatusCode(_0x493e12,null))[_0x2ce2('0x2e')](handleError(_0x493e12,null));};exports[_0x2ce2('0xd3')]=function(_0x1eaf48,_0x18e8df){var _0x8bc7b2=moment()[_0x2ce2('0xd4')]()['toString']();var _0xdd7759=path[_0x2ce2('0xd5')](config[_0x2ce2('0xd6')],_0x2ce2('0xd7'),_0x2ce2('0xd8'),_0x2ce2('0xd9'));var _0x48e5c2=path[_0x2ce2('0xd5')](config['root'],_0x2ce2('0xd7'),'files',_0x2ce2('0xda'));var _0x5c4e86=path[_0x2ce2('0xd5')](_0xdd7759,_0x8bc7b2);var _0xaa29a0=util[_0x2ce2('0xc8')](_0x2ce2('0xdb'),_0x1eaf48[_0x2ce2('0xc2')]['id'],_0x8bc7b2);var _0x3ece4f=path[_0x2ce2('0xd5')](_0xdd7759,_0xaa29a0);var _0x21f922=[];if(_0x1eaf48[_0x2ce2('0x3d')][_0x2ce2('0xda')]){_0x21f922['push']({'model':db[_0x2ce2('0xdc')],'as':_0x2ce2('0xdd'),'raw':!![]});}var _0x35f744=[{'model':db['MailMessage'],'as':_0x2ce2('0xde'),'attributes':['id',_0x2ce2('0xc0'),_0x2ce2('0x4f'),'to','cc',_0x2ce2('0xdf'),_0x2ce2('0xe0'),'createdAt'],'where':{'secret':![]},'order':qs[_0x2ce2('0x46')]('id'),'include':_0x21f922}];return db[_0x2ce2('0x9a')][_0x2ce2('0x60')]({'where':{'id':_0x1eaf48[_0x2ce2('0xc2')]['id']},'include':_0x35f744})[_0x2ce2('0x1d')](handleEntityNotFound(_0x18e8df,null))['then'](function(_0x241231){if(_0x241231&&_0x241231[_0x2ce2('0xde')]){var _0x3a1a7a=_0x241231[_0x2ce2('0xe1')]({'plain':!![]});fs[_0x2ce2('0xe2')](_0x5c4e86);return BPromise[_0x2ce2('0xe3')](_0x3a1a7a[_0x2ce2('0xde')],function(_0x445bbe,_0xc70d3c){var _0x3d79ca={'from':_0x445bbe[_0x2ce2('0x4f')],'to':_0x445bbe['to'],'subject':_0x445bbe[_0x2ce2('0xe0')],'html':htmlEntities[_0x2ce2('0xe4')](_0x445bbe[_0x2ce2('0xc0')]),'headers':{'Date':moment(_0x445bbe[_0x2ce2('0x77')])[_0x2ce2('0xc8')](_0x2ce2('0xe5'))},'attachments':[]};if(_0x445bbe['cc']){_0x3d79ca[_0x2ce2('0xe6')]['Cc']=_0x445bbe['cc'];}if(_0x445bbe['bcc']){_0x3d79ca['headers']['Bcc']=_0x445bbe['bcc'];}return new BPromise(function(_0x1ef164,_0x171549){if(_0x445bbe[_0x2ce2('0xdd')]){for(var _0x433136=0x0;_0x433136<_0x445bbe['Attachments'][_0x2ce2('0x42')];_0x433136++){var _0x2d565a=_0x445bbe[_0x2ce2('0xdd')][_0x433136];var _0x3e4eff=path[_0x2ce2('0xd5')](_0x48e5c2,_0x2d565a[_0x2ce2('0xe7')]);if(fs[_0x2ce2('0xe8')](_0x3e4eff)){_0x3d79ca[_0x2ce2('0xda')][_0x2ce2('0x26')]({'name':_0x2d565a[_0x2ce2('0x1f')],'contentType':_0x2d565a[_0x2ce2('0x39')],'data':fs[_0x2ce2('0xe9')](_0x3e4eff)});}}}emlformat['build'](_0x3d79ca,function(_0x362644,_0x1260eb){if(_0x362644)return _0x171549(_0x362644);fs[_0x2ce2('0xea')](path[_0x2ce2('0xd5')](_0x5c4e86,util[_0x2ce2('0xc8')]('message%d.eml',_0xc70d3c)),_0x1260eb);return _0x1ef164(_0x1260eb);});});})['then'](function(){return new BPromise(function(_0x3657a2,_0x5d6987){zipdir(_0x5c4e86,{'saveTo':_0x3ece4f},function(_0x54ed43,_0x37fd25){if(_0x54ed43)return _0x5d6987(_0x54ed43);return _0x3657a2(_0x37fd25);});})[_0x2ce2('0x1d')](function(){return new BPromise(function(_0x5e8d1b,_0x54a4f2){rimraf(_0x5c4e86,function(_0x4163ff){if(_0x4163ff)_0x54a4f2(_0x4163ff);return _0x5e8d1b();});});})[_0x2ce2('0x1d')](function(){return _0x18e8df[_0x2ce2('0xd3')](_0x3ece4f,_0xaa29a0,function(_0x24eb33){if(!_0x24eb33)fs['unlinkSync'](_0x3ece4f);});});});}else{return _0x18e8df['sendStatus'](0xc8);}})[_0x2ce2('0x2e')](handleError(_0x18e8df,null));}; \ No newline at end of file +var _0x1224=['addMessage','ids','omit','nolimit','pick','format','includeAll','findAll','inlineCss','true','addTags','spread','Tag','emit','mailInteractionTags:save','removeTags','unix','join','root','server','files','tmp','transcript-%d-%s.zip','attachments','Messages','bcc','subject','createdAt','get','mkdirSync','each','decode','headers','Attachments','basename','existsSync','readFileSync','build','writeFileSync','eml-format','rimraf','zip-dir','moment','bluebird','util','lodash','squel','juice','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','then','destroy','error','stack','name','map','fullname','TagIds','Tags','split','forEach','push','MailMessage','findOne','out','plainBody','-id','trimStart','talking','unmanaged','total','closed','waiting','UserId','MailInteraction','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','where','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','mail_interactions','cm_contacts','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','type','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','filter','isEmail','group','i.id','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','role','user','getMailAccounts','agent','sequelize','toString','keyBy','merge','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.createdAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','MailInteractionId','Setting','enableEmailPreview','all','rows','catch','include','options','create','body','update','params','describe'];(function(_0xa66ae1,_0x38b956){var _0x403d03=function(_0x4d5b8e){while(--_0x4d5b8e){_0xa66ae1['push'](_0xa66ae1['shift']());}};_0x403d03(++_0x38b956);}(_0x1224,0x10d));var _0x4122=function(_0x159424,_0x401a52){_0x159424=_0x159424-0x0;var _0x1eabe4=_0x1224[_0x159424];return _0x1eabe4;};'use strict';var emlformat=require(_0x4122('0x0'));var rimraf=require(_0x4122('0x1'));var zipdir=require(_0x4122('0x2'));var moment=require(_0x4122('0x3'));var BPromise=require(_0x4122('0x4'));var util=require(_0x4122('0x5'));var path=require('path');var fs=require('fs');var _=require(_0x4122('0x6'));var squel=require(_0x4122('0x7'));var juice=require(_0x4122('0x8'));var Redis=require('ioredis');var qs=require(_0x4122('0x9'));var as=require(_0x4122('0xa'));var logger=require(_0x4122('0xb'))(_0x4122('0xc'));var config=require(_0x4122('0xd'));var db=require(_0x4122('0xe'))['db'];var htmlEntities=require(_0x4122('0xf'));config[_0x4122('0x10')]=_[_0x4122('0x11')](config[_0x4122('0x10')],{'host':_0x4122('0x12'),'port':0x18eb});var socket=require(_0x4122('0x13'))(new Redis(config[_0x4122('0x10')]));require(_0x4122('0x14'))[_0x4122('0x15')](socket);function respondWithStatusCode(_0x201538,_0x1c22f7){_0x1c22f7=_0x1c22f7||0xcc;return function(_0x2d3fa6){if(_0x2d3fa6){return _0x201538[_0x4122('0x16')](_0x1c22f7);}return _0x201538[_0x4122('0x17')](_0x1c22f7)[_0x4122('0x18')]();};}function respondWithResult(_0x7d2fcb,_0x440ff0){_0x440ff0=_0x440ff0||0xc8;return function(_0x8d4876){if(_0x8d4876){return _0x7d2fcb[_0x4122('0x17')](_0x440ff0)[_0x4122('0x19')](_0x8d4876);}};}function respondWithFilteredResult(_0x401abb,_0x33278f){return function(_0x421ee3){if(_0x421ee3){var _0x1a701e=typeof _0x33278f[_0x4122('0x1a')]==='undefined'&&typeof _0x33278f[_0x4122('0x1b')]===_0x4122('0x1c');var _0x192e77=_0x421ee3[_0x4122('0x1d')];var _0x520300=_0x1a701e?0x0:_0x33278f[_0x4122('0x1a')];var _0x19684e=_0x1a701e?_0x421ee3['count']:_0x33278f[_0x4122('0x1a')]+_0x33278f[_0x4122('0x1b')];var _0x399003;if(_0x19684e>=_0x192e77){_0x19684e=_0x192e77;_0x399003=0xc8;}else{_0x399003=0xce;}_0x401abb[_0x4122('0x17')](_0x399003);return _0x401abb[_0x4122('0x1e')](_0x4122('0x1f'),_0x520300+'-'+_0x19684e+'/'+_0x192e77)[_0x4122('0x19')](_0x421ee3);}return null;};}function saveUpdates(_0x5a4fe6){return function(_0x482116){if(_0x482116){return _0x482116['update'](_0x5a4fe6)[_0x4122('0x20')](function(_0x2d95e8){return _0x2d95e8;});}return null;};}function removeEntity(_0x23033a){return function(_0x1dde85){if(_0x1dde85){return _0x1dde85[_0x4122('0x21')]()[_0x4122('0x20')](function(){_0x23033a[_0x4122('0x17')](0xcc)[_0x4122('0x18')]();});}};}function handleEntityNotFound(_0x58a78f){return function(_0x315ef6){if(!_0x315ef6){_0x58a78f['sendStatus'](0x194);}return _0x315ef6;};}function handleError(_0x4f949a,_0x508cd7){_0x508cd7=_0x508cd7||0x1f4;return function(_0x36d8d9){logger[_0x4122('0x22')](_0x36d8d9[_0x4122('0x23')]);if(_0x36d8d9['name']){delete _0x36d8d9[_0x4122('0x24')];}_0x4f949a[_0x4122('0x17')](_0x508cd7)['send'](_0x36d8d9);};}function getInteractionUsers(_0x4a5711,_0x1b7848){return new BPromise(function(_0x5ba3c1,_0x4db23e){try{if(_0x1b7848[_0x4a5711['id']]){_0x4a5711['Users']=_[_0x4122('0x25')](_0x1b7848[_0x4a5711['id']],function(_0x2e71f4){return{'id':_0x2e71f4['id'],'fullname':_0x2e71f4[_0x4122('0x26')]};});}}catch(_0x1bb51b){_0x4db23e(_0x1bb51b);}_0x5ba3c1(_0x4a5711);});}function getInteractionTags(_0x31568f,_0x58a9ba){return new BPromise(function(_0x26768b,_0x7fe50d){try{if(_0x31568f[_0x4122('0x27')]){_0x31568f[_0x4122('0x28')]=[];_0x31568f[_0x4122('0x27')][_0x4122('0x29')](',')[_0x4122('0x2a')](function(_0x5f32c5){_0x31568f[_0x4122('0x28')][_0x4122('0x2b')](_0x58a9ba[_0x5f32c5]);});}delete _0x31568f[_0x4122('0x27')];}catch(_0x31f141){_0x7fe50d(_0x31f141);}_0x26768b(_0x31568f);});}function getLastMessageText(_0x4d7ef3){return new BPromise(function(_0x115caa,_0x47e8bc){return db[_0x4122('0x2c')][_0x4122('0x2d')]({'where':{'$and':[{'MailInteractionId':_0x4d7ef3['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x4122('0x2e')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x4122('0x2f')],'order':_0x4122('0x30'),'raw':!![]})[_0x4122('0x20')](function(_0xb98ce8){if(_0xb98ce8&&_0xb98ce8[_0x4122('0x2f')]){_0x4d7ef3['lastMsgText']=_[_0x4122('0x31')](_0xb98ce8[_0x4122('0x2f')]);}_0x115caa(_0x4d7ef3);})['catch'](function(_0x13048f){_0x47e8bc(_0x13048f);});});}function updateMailInteraction(_0x23974e,_0x384787,_0x1876f8,_0x5af51c){return new BPromise(function(_0x223fe6,_0x9e43bd){return getInteractionUsers(_0x23974e,_0x1876f8)['then'](function(_0x568cd0){return getInteractionTags(_0x568cd0,_0x384787);})[_0x4122('0x20')](function(_0x591ea8){return getStateInteraction(_0x591ea8);})[_0x4122('0x20')](function(_0x1081e3){if(_0x5af51c){_0x223fe6(getLastMessageText(_0x1081e3));}else{_0x223fe6(_0x1081e3);}})['catch'](function(_0x45a51a){_0x9e43bd(_0x45a51a);});});}function getStateInteraction(_0x4457fb){return new BPromise(function(_0x31ba4b){_0x4457fb['waiting']=0x0;_0x4457fb[_0x4122('0x32')]=0x0;_0x4457fb['answered']=0x0;_0x4457fb[_0x4122('0x33')]=0x0;_0x4457fb[_0x4122('0x34')]=0x0;if(!_0x4457fb[_0x4122('0x35')]&&!_0x4457fb['UserId']){_0x4457fb[_0x4122('0x36')]+=0x1;}if(!_0x4457fb['closed']&&_0x4457fb[_0x4122('0x37')]){_0x4457fb[_0x4122('0x32')]+=0x1;if(_0x4457fb['waiting']){_0x4457fb['waiting']-=0x1;}}if(_0x4457fb['closed']&&_0x4457fb[_0x4122('0x37')]){_0x4457fb['answered']+=0x1;if(_0x4457fb[_0x4122('0x32')]){_0x4457fb[_0x4122('0x32')]-=0x1;}}if(_0x4457fb[_0x4122('0x35')]&&!_0x4457fb[_0x4122('0x37')]){_0x4457fb[_0x4122('0x33')]+=0x1;if(_0x4457fb['waiting']){_0x4457fb['waiting']-=0x1;}}_0x4457fb[_0x4122('0x34')]+=0x1;_0x31ba4b(_0x4457fb);});}exports['index']=function(_0xf4ab54,_0x526a5c){var _0x1e5ce4={},_0x29bcee={},_0x4fbcd5={'count':0x0,'rows':[]};var _0x1b33e6=_[_0x4122('0x25')](db[_0x4122('0x38')][_0x4122('0x39')],function(_0x6ce0aa){return{'name':_0x6ce0aa[_0x4122('0x3a')],'type':_0x6ce0aa['type'][_0x4122('0x3b')]};});_0x29bcee['model']=_[_0x4122('0x25')](_0x1b33e6,'name');_0x29bcee[_0x4122('0x3c')]=_[_0x4122('0x3d')](_0xf4ab54[_0x4122('0x3c')]);_0x29bcee[_0x4122('0x3e')]=_[_0x4122('0x3f')](_0x29bcee['model'],_0x29bcee[_0x4122('0x3c')]);_0x1e5ce4[_0x4122('0x40')]=_['intersection'](_0x29bcee['model'],qs['fields'](_0xf4ab54[_0x4122('0x3c')][_0x4122('0x41')]));_0x1e5ce4[_0x4122('0x40')]=_0x1e5ce4[_0x4122('0x40')][_0x4122('0x42')]?_0x1e5ce4[_0x4122('0x40')]:_0x29bcee[_0x4122('0x43')];if(!_0xf4ab54[_0x4122('0x3c')][_0x4122('0x44')]('nolimit')){_0x1e5ce4[_0x4122('0x1b')]=qs['limit'](_0xf4ab54['query'][_0x4122('0x1b')]);_0x1e5ce4[_0x4122('0x1a')]=qs[_0x4122('0x1a')](_0xf4ab54['query'][_0x4122('0x1a')]);}_0x1e5ce4[_0x4122('0x45')]=qs['sort'](_0xf4ab54[_0x4122('0x3c')][_0x4122('0x46')]);_0x1e5ce4[_0x4122('0x47')]=qs[_0x4122('0x3e')](_['pick'](_0xf4ab54[_0x4122('0x3c')],_0x29bcee[_0x4122('0x3e')]),_0x1b33e6);var _0xc45587=[];var _0x2f45d7=squel[_0x4122('0x48')]()['field']('id')['field'](_0x4122('0x24'))[_0x4122('0x49')](_0x4122('0x4a'))[_0x4122('0x4b')](_0x4122('0x4c'));var _0x53dc0a=squel[_0x4122('0x48')]()[_0x4122('0x49')](_0x4122('0x4d'))['field'](_0x4122('0x4e'))['field'](_0x4122('0x4f'))[_0x4122('0x4b')](_0x4122('0x50'),'ui')[_0x4122('0x51')]('users','u','u.id\x20=\x20ui.UserId');var _0x113e6f=squel[_0x4122('0x48')]()[_0x4122('0x4b')](_0x4122('0x52'),'i')['left_join'](_0x4122('0x53'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x4122('0x51')]('users','o',_0x4122('0x54'))[_0x4122('0x51')](_0x4122('0x55'),'a',_0x4122('0x56'))[_0x4122('0x51')](_0x4122('0x57'),'me','me.MailInteractionId\x20=\x20i.id')[_0x4122('0x51')]('mail_interaction_has_tags','it',_0x4122('0x58'))[_0x4122('0x51')](_0x4122('0x4c'),'t',_0x4122('0x59'));var _0x117a4a=squel['expr']();var _0x3e28cb=[];var _0x290e5a=squel[_0x4122('0x5a')]();var _0x2cdb41;if(_0xf4ab54['query'][_0x4122('0x5b')]){_0x2cdb41=as['parseSearch'](_0xf4ab54[_0x4122('0x3c')][_0x4122('0x5b')]);var _0x186c51=_0x2cdb41[_0x4122('0x5c')];for(var _0x33fd1f=0x0;_0x33fd1f<_0x2cdb41[_0x4122('0x5d')][_0x4122('0x42')];_0x33fd1f++){var _0x45f112=_0x2cdb41[_0x4122('0x5d')][_0x33fd1f];var _0x5a6411='i';var _0xc33a41=_[_0x4122('0x5e')](_0x1b33e6,[_0x4122('0x24'),_0x45f112['field']]);if(!_0xc33a41){switch(_0x45f112['field']){case'unreadMessages':if(_0x45f112[_0x4122('0x5f')]==0x1){_0x113e6f[_0x4122('0x60')]('`'+_0x45f112[_0x4122('0x49')]+'`\x20=\x200');}else{_0x113e6f[_0x4122('0x60')]('`'+_0x45f112[_0x4122('0x49')]+_0x4122('0x61'));}break;case _0x4122('0x62'):if(_0x45f112[_0x4122('0x63')]===_0x4122('0x64')){if(_0x45f112[_0x4122('0x5f')][_0x4122('0x29')]('\x20')[_0x4122('0x42')]>0x1){_0x117a4a[_0x186c51](_0x4122('0x65'),qs[_0x4122('0x66')](_0x45f112[_0x4122('0x5f')]),null);}else{var _0x59c904='%'+_0x45f112[_0x4122('0x5f')]+'%';_0x117a4a[_0x186c51]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x59c904,_0x59c904,_0x59c904);}}else{_0xc33a41=_[_0x4122('0x5e')](_0x1b33e6,[_0x4122('0x24'),_0x4122('0x67')]);_0x45f112[_0x4122('0x49')]=_0x4122('0x67');_0x55ee9b=as[_0x4122('0x68')](_0x5a6411,_0xc33a41['type'],_0x45f112);_0x117a4a[_0x186c51](_0x55ee9b[_0x4122('0x69')],_0x55ee9b['value'][_0x4122('0x6a')],_0x55ee9b[_0x4122('0x5f')][_0x4122('0x18')]);}break;case'Tag':var _0xfc543b=_0x45f112[_0x4122('0x5f')]['split'](',')[_0x4122('0x25')](function(_0x2ef1c9){return Number(_0x2ef1c9);});_0xfc543b['forEach'](function(_0x35f46f){_0x290e5a['or'](_0x4122('0x6b'),'%,'+_0x35f46f+',%');});_0x3e28cb=_[_0x4122('0x6c')](_0x3e28cb,_0xfc543b);break;case _0x4122('0x6d'):if(_0x45f112[_0x4122('0x63')]===_0x4122('0x64')){_0x117a4a[_0x186c51](_0x4122('0x6e'),'%'+_0x45f112[_0x4122('0x5f')]+'%',null);}else{_0xc33a41=_[_0x4122('0x5e')](_0x1b33e6,[_0x4122('0x24'),'UserId']);_0x45f112[_0x4122('0x49')]=_0x4122('0x37');_0x55ee9b=as[_0x4122('0x68')](_0x5a6411,_0xc33a41[_0x4122('0x6f')],_0x45f112);_0x117a4a[_0x186c51](_0x55ee9b['text'],_0x55ee9b[_0x4122('0x5f')][_0x4122('0x6a')],_0x55ee9b['value']['end']);}break;case _0x4122('0x2f'):_0x55ee9b=as[_0x4122('0x68')]('me',null,_0x45f112);_0x117a4a[_0x186c51](_0x55ee9b[_0x4122('0x69')],_0x55ee9b['value']['start'],_0x55ee9b['value'][_0x4122('0x18')]);break;}}else{var _0x55ee9b=as['buildExpression'](_0x5a6411,_0xc33a41[_0x4122('0x6f')],_0x45f112);_0x117a4a[_0x186c51](_0x55ee9b[_0x4122('0x69')],_0x55ee9b[_0x4122('0x5f')]['start'],_0x55ee9b[_0x4122('0x5f')][_0x4122('0x18')]);}}}else{var _0xfb7f12=_(_0xf4ab54[_0x4122('0x3c')])[_0x4122('0x3d')]()[_0x4122('0x25')](function(_0xc6fe20){return _[_0x4122('0x70')](_0x1b33e6,[_0x4122('0x24'),_0xc6fe20])?_0xc6fe20:undefined;})[_0x4122('0x71')]()[_0x4122('0x5f')]();if(!_[_0x4122('0x72')](_0xfb7f12)){_0xfb7f12['forEach'](function(_0x55c060){if(_0x55c060===_0x4122('0x73')){_0x113e6f[_0x4122('0x47')](_0x4122('0x74'),[]['concat'](_0xf4ab54[_0x4122('0x3c')][_0x55c060]));}else if(_0x55c060==='createdAt'){var _0x3f3b3e=JSON[_0x4122('0x75')](_0xf4ab54[_0x4122('0x3c')][_0x55c060])[_0x4122('0x76')];var _0x126d3d=JSON['parse'](_0xf4ab54[_0x4122('0x3c')][_0x55c060])[_0x4122('0x77')];_0x113e6f[_0x4122('0x47')](_0x4122('0x78'),_0x3f3b3e,_0x126d3d);}else{if(_0xf4ab54[_0x4122('0x3c')][_0x55c060]===_0x4122('0x79')){_0x113e6f['where']('i.'+_0x55c060+_0x4122('0x7a'));}else{_0x113e6f[_0x4122('0x47')]('i.'+_0x55c060+_0x4122('0x7b'),_0xf4ab54['query'][_0x55c060]);}}});}if(_0xf4ab54[_0x4122('0x3c')][_0x4122('0x7c')]){if(_0xf4ab54[_0x4122('0x3c')][_0x4122('0x7c')]==0x1){_0x113e6f[_0x4122('0x60')]('`unreadMessages`\x20=\x200');}else{_0x113e6f[_0x4122('0x60')](_0x4122('0x7d'));}}if(_0xf4ab54[_0x4122('0x3c')]['tag']){_0x3e28cb=_[_0x4122('0x7e')](_0xf4ab54[_0x4122('0x3c')]['tag'])?_0xf4ab54[_0x4122('0x3c')]['tag']:new Array(_0xf4ab54[_0x4122('0x3c')][_0x4122('0x7f')]);_0x3e28cb[_0x4122('0x2a')](function(_0x112561){_0x290e5a['or'](_0x4122('0x6b'),'%,'+_0x112561+',%');});}if(_0xf4ab54['query']['filter']){var _0x3ea124=_0xf4ab54['query'][_0x4122('0x80')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x3ea124)){_0x117a4a['or']('i.id\x20LIKE\x20?',_0x3ea124+'%');}else if(qs[_0x4122('0x81')](_0x3ea124)){_0x117a4a['or']('c.email\x20LIKE\x20?',_0x3ea124+'%');}else{_0x117a4a['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4122('0x66')](_0x3ea124))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4122('0x66')](_0x3ea124));}}}_0x113e6f['where'](_0x117a4a);_0x113e6f[_0x4122('0x82')](_0x4122('0x83'));var _0xcb0184={'type':db['Sequelize'][_0x4122('0x84')]['SELECT'],'raw':!![]};var _0x268c91=_0x113e6f[_0x4122('0x85')]();_0x268c91['field'](_0x4122('0x83'));_0x268c91[_0x4122('0x49')](_0x4122('0x86'),_0x4122('0x87'));if(_0x1e5ce4[_0x4122('0x45')]){_0x1e5ce4[_0x4122('0x45')]['forEach'](function(_0x48a975){var _0x285fdb=_0x48a975[0x0]===_0x4122('0x88')?_0x48a975[0x0]:'i.'+_0x48a975[0x0];_0x113e6f['order'](_0x285fdb,_0x48a975[0x1]==='DESC'?![]:!![]);});}if(!_[_0x4122('0x72')](_0x3e28cb)){_0x113e6f[_0x4122('0x60')](_0x290e5a);_0x268c91[_0x4122('0x47')](_0x4122('0x89'),_0x3e28cb);}BPromise[_0x4122('0x8a')]()[_0x4122('0x20')](function(){if(!_0x2cdb41){if(_0xf4ab54['query'][_0x4122('0x73')])return;_0x268c91['where'](_0x4122('0x8b'));_0x113e6f['where'](_0x4122('0x8b'));return;}if(_0xf4ab54['user'][_0x4122('0x8c')]!=='agent')return;return _0xf4ab54[_0x4122('0x8d')][_0x4122('0x8e')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4ca1bc){if(_[_0x4122('0x72')](_0x4ca1bc)){_0x268c91['where']('i.MailAccountId\x20IS\x20NULL');_0x113e6f['where']('i.MailAccountId\x20IS\x20NULL');}else{_0x268c91[_0x4122('0x47')]('i.MailAccountId\x20IN\x20?',_[_0x4122('0x25')](_0x4ca1bc,'id'));_0x113e6f[_0x4122('0x47')]('i.MailAccountId\x20IN\x20?',_[_0x4122('0x25')](_0x4ca1bc,'id'));}});})[_0x4122('0x20')](function(){if(_0xf4ab54['user'][_0x4122('0x8c')]===_0x4122('0x8f')&&!_0x2cdb41&&!_0xf4ab54['query']['MailAccountId'])return[];return db[_0x4122('0x90')]['query'](_0x268c91[_0x4122('0x91')](),_0xcb0184);})[_0x4122('0x20')](function(_0x270762){_0x4fbcd5['count']=_0x270762['length'];if(_0x4fbcd5[_0x4122('0x1d')]===0x0)return[];return db[_0x4122('0x90')][_0x4122('0x3c')](_0x2f45d7[_0x4122('0x91')](),_0xcb0184)['then'](function(_0x358744){_0xc45587=_[_0x4122('0x92')](_0x358744,'id');_0xcb0184=_[_0x4122('0x93')](_0xcb0184,{'model':db[_0x4122('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xf4ab54['query']['fields']){_0x1e5ce4['attributes']['forEach'](function(_0x193199){_0x113e6f[_0x4122('0x49')]('i.'+_0x193199);});}else{_0x113e6f[_0x4122('0x49')](_0x4122('0x86'),_0x4122('0x87'));_0x113e6f[_0x4122('0x49')]('a.key',_0x4122('0x94'));_0x113e6f[_0x4122('0x49')]('a.mandatoryDisposition',_0x4122('0x95'));_0x113e6f[_0x4122('0x49')](_0x4122('0x96'),'contactName');_0x113e6f['field'](_0x4122('0x83'));_0x113e6f[_0x4122('0x49')](_0x4122('0x97'));_0x113e6f[_0x4122('0x49')]('i.updatedAt');_0x113e6f[_0x4122('0x49')](_0x4122('0x98'));_0x113e6f[_0x4122('0x49')](_0x4122('0x99'));_0x113e6f[_0x4122('0x49')](_0x4122('0x9a'));_0x113e6f['field'](_0x4122('0x9b'));_0x113e6f[_0x4122('0x49')](_0x4122('0x9c'));_0x113e6f[_0x4122('0x49')]('i.subject');_0x113e6f[_0x4122('0x49')](_0x4122('0x9d'));_0x113e6f[_0x4122('0x49')](_0x4122('0x9e'));_0x113e6f[_0x4122('0x49')](_0x4122('0x9f'));_0x113e6f[_0x4122('0x49')](_0x4122('0xa0'));_0x113e6f['field'](_0x4122('0xa1'));_0x113e6f[_0x4122('0x49')](_0x4122('0xa2'));_0x113e6f[_0x4122('0x49')](_0x4122('0xa3'));_0x113e6f[_0x4122('0x49')]('i.UserId');_0x113e6f[_0x4122('0x49')](_0x4122('0xa4'),_0x4122('0xa5'));_0x113e6f[_0x4122('0x49')](_0x4122('0xa6'),_0x4122('0xa7'));_0x113e6f['field'](_0x4122('0xa8'),_0x4122('0xa9'));_0x113e6f[_0x4122('0x49')](_0x4122('0xaa'),_0x4122('0xab'));_0x113e6f[_0x4122('0x49')]('c.mobile',_0x4122('0xac'));_0x113e6f[_0x4122('0x49')]('c.fax',_0x4122('0xad'));_0x113e6f[_0x4122('0x49')](_0x4122('0xae'),'Owner.fullname');_0x113e6f[_0x4122('0x49')](_0x4122('0xaf'),_0x4122('0xb0'));_0x113e6f[_0x4122('0x49')](_0x4122('0xb1'),'TagIds');}if(_0x1e5ce4[_0x4122('0x1b')])_0x113e6f[_0x4122('0x1b')](_0x1e5ce4[_0x4122('0x1b')]);if(_0x1e5ce4[_0x4122('0x1a')])_0x113e6f['offset'](_0x1e5ce4[_0x4122('0x1a')]);return db[_0x4122('0x90')]['query'](_0x113e6f[_0x4122('0x91')](),_0xcb0184);})[_0x4122('0x20')](function(_0x5d68c7){if(_0x5d68c7['length']>0x0)_0x53dc0a['where']('ui.MailInteractionId\x20IN\x20?',_[_0x4122('0x25')](_0x5d68c7,'id'));return db[_0x4122('0x90')]['query'](_0x53dc0a[_0x4122('0x91')](),_0xcb0184)[_0x4122('0x20')](function(_0x133b33){var _0x3f923f=_['groupBy'](_0x133b33,_0x4122('0xb2'));var _0x3a24a1=[];return db[_0x4122('0xb3')][_0x4122('0x2d')]({'attributes':[_0x4122('0xb4')],'raw':!![]})['then'](function(_0x5e67ce){var _0x61e2a1=_0x5e67ce[_0x4122('0xb4')];_0x5d68c7[_0x4122('0x2a')](function(_0x215436){_0x3a24a1[_0x4122('0x2b')](updateMailInteraction(_0x215436,_0xc45587,_0x3f923f,_0x61e2a1));});return BPromise[_0x4122('0xb5')](_0x3a24a1);});});});})['then'](function(_0x58c2d6){_0x4fbcd5[_0x4122('0xb6')]=_0x58c2d6;return _0x4fbcd5;})[_0x4122('0x20')](respondWithFilteredResult(_0x526a5c,_0x1e5ce4))[_0x4122('0xb7')](handleError(_0x526a5c,null));};exports['show']=function(_0x2f169b,_0x59192e){var _0xdbee82={'raw':![],'where':{'id':_0x2f169b['params']['id']}},_0x15ec83={};_0x15ec83['model']=_['keys'](db[_0x4122('0x38')]['rawAttributes']);_0x15ec83[_0x4122('0x3c')]=_[_0x4122('0x3d')](_0x2f169b[_0x4122('0x3c')]);_0x15ec83[_0x4122('0x3e')]=_['intersection'](_0x15ec83['model'],_0x15ec83[_0x4122('0x3c')]);_0xdbee82[_0x4122('0x40')]=_[_0x4122('0x3f')](_0x15ec83[_0x4122('0x43')],qs[_0x4122('0x41')](_0x2f169b[_0x4122('0x3c')][_0x4122('0x41')]));_0xdbee82[_0x4122('0x40')]=_0xdbee82['attributes'][_0x4122('0x42')]?_0xdbee82['attributes']:_0x15ec83[_0x4122('0x43')];if(_0x2f169b[_0x4122('0x3c')]['includeAll']){_0xdbee82[_0x4122('0xb8')]=[{'all':!![]}];}_0xdbee82=_[_0x4122('0x93')]({},_0xdbee82,_0x2f169b[_0x4122('0xb9')]);return db[_0x4122('0x38')][_0x4122('0x5e')](_0xdbee82)[_0x4122('0x20')](handleEntityNotFound(_0x59192e,null))['then'](respondWithResult(_0x59192e,null))['catch'](handleError(_0x59192e,null));};exports[_0x4122('0xba')]=function(_0x3c0f60,_0x8fc314){return db[_0x4122('0x38')][_0x4122('0xba')](_0x3c0f60[_0x4122('0xbb')],{})[_0x4122('0x20')](respondWithResult(_0x8fc314,0xc9))[_0x4122('0xb7')](handleError(_0x8fc314,null));};exports[_0x4122('0xbc')]=function(_0x2e600b,_0xf57600){if(_0x2e600b[_0x4122('0xbb')]['id']){delete _0x2e600b['body']['id'];}return db['MailInteraction'][_0x4122('0x5e')]({'where':{'id':_0x2e600b['params']['id']}})[_0x4122('0x20')](handleEntityNotFound(_0xf57600,null))[_0x4122('0x20')](saveUpdates(_0x2e600b[_0x4122('0xbb')],null))[_0x4122('0x20')](respondWithResult(_0xf57600,null))['catch'](handleError(_0xf57600,null));};exports[_0x4122('0x21')]=function(_0x3a392a,_0x2d44a6){return db['MailInteraction'][_0x4122('0x5e')]({'where':{'id':_0x3a392a[_0x4122('0xbd')]['id']}})[_0x4122('0x20')](handleEntityNotFound(_0x2d44a6,null))[_0x4122('0x20')](removeEntity(_0x2d44a6,null))[_0x4122('0xb7')](handleError(_0x2d44a6,null));};exports['describe']=function(_0x242c6a,_0x4a7cca){return db[_0x4122('0x38')][_0x4122('0xbe')]()[_0x4122('0x20')](respondWithResult(_0x4a7cca,null))[_0x4122('0xb7')](handleError(_0x4a7cca,null));};exports[_0x4122('0xbf')]=function(_0x2df661,_0x48fe70){return db[_0x4122('0x2c')][_0x4122('0x5e')]({'where':{'id':_0x2df661[_0x4122('0xbd')]['id']}})[_0x4122('0x20')](handleEntityNotFound(_0x48fe70,null))[_0x4122('0x20')](function(_0x24d3eb){if(_0x24d3eb){return _0x24d3eb['addMessage'](_0x2df661[_0x4122('0xbb')][_0x4122('0xc0')],_[_0x4122('0xc1')](_0x2df661[_0x4122('0xbb')],['ids','id'])||{});}})['then'](respondWithResult(_0x48fe70,null))['catch'](handleError(_0x48fe70,null));};exports['getMessages']=function(_0x541925,_0x49c92c){var _0x2bb496={'raw':![],'where':{}};var _0x15c853={};var _0x3d549b={'count':0x0,'rows':[]};return db['MailInteraction'][_0x4122('0x2d')]({'where':{'id':_0x541925[_0x4122('0xbd')]['id']}})['then'](handleEntityNotFound(_0x49c92c,null))['then'](function(_0x52d12b){if(_0x52d12b){_0x15c853[_0x4122('0x43')]=_[_0x4122('0x3d')](db[_0x4122('0x2c')][_0x4122('0x39')]);_0x15c853[_0x4122('0x3c')]=_[_0x4122('0x3d')](_0x541925[_0x4122('0x3c')]);_0x15c853[_0x4122('0x3e')]=_[_0x4122('0x3f')](_0x15c853[_0x4122('0x43')],_0x15c853[_0x4122('0x3c')]);_0x2bb496['attributes']=_[_0x4122('0x3f')](_0x15c853[_0x4122('0x43')],qs['fields'](_0x541925[_0x4122('0x3c')]['fields']));_0x2bb496[_0x4122('0x40')]=_0x2bb496['attributes'][_0x4122('0x42')]?_0x2bb496[_0x4122('0x40')]:_0x15c853[_0x4122('0x43')];if(!_0x541925[_0x4122('0x3c')][_0x4122('0x44')](_0x4122('0xc2'))){_0x2bb496['limit']=qs[_0x4122('0x1b')](_0x541925[_0x4122('0x3c')][_0x4122('0x1b')]);_0x2bb496[_0x4122('0x1a')]=qs[_0x4122('0x1a')](_0x541925['query'][_0x4122('0x1a')]);}_0x2bb496[_0x4122('0x45')]=qs['sort'](_0x541925[_0x4122('0x3c')][_0x4122('0x46')]);_0x2bb496[_0x4122('0x47')]=qs['filters'](_[_0x4122('0xc3')](_0x541925['query'],_0x15c853[_0x4122('0x3e')]));_0x2bb496[_0x4122('0x47')]['MailInteractionId']=_0x52d12b['id'];if(_0x541925[_0x4122('0x3c')][_0x4122('0x80')]){_0x2bb496[_0x4122('0x47')]=_['merge'](_0x2bb496[_0x4122('0x47')],{'$or':_[_0x4122('0x25')](_0x2bb496[_0x4122('0x40')],function(_0x5c636a){var _0x3ffa9d={};_0x3ffa9d[_0x5c636a]={'$like':'%'+_0x541925[_0x4122('0x3c')][_0x4122('0x80')]+'%'};return _0x3ffa9d;})});}if(_0x541925['query'][_0x4122('0x76')]){var _0x504019=_0x541925[_0x4122('0x3c')]['$gte'][_0x4122('0x29')](',');var _0xdfeee1={};_0xdfeee1[_0x504019[0x0]]={'$gte':moment(_0x504019[0x1])[_0x4122('0xc4')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2bb496[_0x4122('0x47')]=_[_0x4122('0x93')](_0x2bb496[_0x4122('0x47')],_0xdfeee1);}_0x2bb496=_[_0x4122('0x93')]({},_0x2bb496,_0x541925[_0x4122('0xb9')]);return db[_0x4122('0x2c')]['count']({'where':_0x2bb496[_0x4122('0x47')]})['then'](function(_0x3e4ff4){_0x3d549b['count']=_0x3e4ff4;if(_0x541925[_0x4122('0x3c')][_0x4122('0xc5')]){_0x2bb496[_0x4122('0xb8')]=[{'all':!![]}];}return db['MailMessage'][_0x4122('0xc6')](_0x2bb496);})['then'](function(_0x4789b5){if(_0x541925['query'][_0x4122('0xc7')]===_0x4122('0xc8')){for(var _0x3497a2=0x0;_0x3497a2<_0x4789b5[_0x4122('0x42')];_0x3497a2++){_0x4789b5[_0x3497a2]['body']=juice(_0x4789b5[_0x3497a2][_0x4122('0xbb')]);}}_0x3d549b[_0x4122('0xb6')]=_0x4789b5;return _0x3d549b;});}})[_0x4122('0x20')](respondWithFilteredResult(_0x49c92c,_0x2bb496))[_0x4122('0xb7')](handleError(_0x49c92c,null));};exports[_0x4122('0xc9')]=function(_0x584523,_0x14ad25){return db[_0x4122('0x38')][_0x4122('0x5e')]({'where':{'id':_0x584523[_0x4122('0xbd')]['id']}})[_0x4122('0x20')](handleEntityNotFound(_0x14ad25,null))[_0x4122('0x20')](function(_0x49f615){if(_0x49f615){return _0x49f615['setTags'](_0x584523[_0x4122('0xbb')][_0x4122('0xc0')],_[_0x4122('0xc1')](_0x584523['body'],['ids','id'])||{})[_0x4122('0xca')](function(){return db[_0x4122('0xcb')][_0x4122('0xc6')]({'attributes':['id','name',_0x4122('0x4a')],'where':{'id':_0x584523[_0x4122('0xbb')][_0x4122('0xc0')]}});})[_0x4122('0x20')](function(_0x279e64){socket[_0x4122('0xcc')](_0x4122('0xcd'),{'id':Number(_0x584523[_0x4122('0xbd')]['id']),'tags':_0x279e64||[]});return{'id':Number(_0x584523[_0x4122('0xbd')]['id']),'tags':_0x279e64||[]};});}})[_0x4122('0x20')](respondWithResult(_0x14ad25,null))[_0x4122('0xb7')](handleError(_0x14ad25,null));};exports[_0x4122('0xce')]=function(_0x467492,_0xc6f0f5){return db['MailInteraction'][_0x4122('0x5e')]({'where':{'id':_0x467492[_0x4122('0xbd')]['id']}})[_0x4122('0x20')](handleEntityNotFound(_0xc6f0f5,null))[_0x4122('0x20')](function(_0x50ce19){if(_0x50ce19){return _0x50ce19[_0x4122('0xce')](_0x467492[_0x4122('0x3c')][_0x4122('0xc0')]);}})[_0x4122('0x20')](respondWithStatusCode(_0xc6f0f5,null))[_0x4122('0xb7')](handleError(_0xc6f0f5,null));};exports['download']=function(_0x2080cf,_0x505444){var _0x4dad21=moment()[_0x4122('0xcf')]()[_0x4122('0x91')]();var _0x23a826=path[_0x4122('0xd0')](config[_0x4122('0xd1')],_0x4122('0xd2'),_0x4122('0xd3'),_0x4122('0xd4'));var _0x1462f5=path['join'](config[_0x4122('0xd1')],'server',_0x4122('0xd3'),'attachments');var _0x327f30=path['join'](_0x23a826,_0x4dad21);var _0xe1522e=util[_0x4122('0xc4')](_0x4122('0xd5'),_0x2080cf[_0x4122('0xbd')]['id'],_0x4dad21);var _0x5f1a41=path[_0x4122('0xd0')](_0x23a826,_0xe1522e);var _0x1bfcd3=[];if(_0x2080cf[_0x4122('0x3c')][_0x4122('0xd6')]){_0x1bfcd3['push']({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0x55c81a=[{'model':db[_0x4122('0x2c')],'as':_0x4122('0xd7'),'attributes':['id',_0x4122('0xbb'),_0x4122('0x4b'),'to','cc',_0x4122('0xd8'),_0x4122('0xd9'),_0x4122('0xda')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x1bfcd3}];return db['MailInteraction'][_0x4122('0x5e')]({'where':{'id':_0x2080cf[_0x4122('0xbd')]['id']},'include':_0x55c81a})['then'](handleEntityNotFound(_0x505444,null))[_0x4122('0x20')](function(_0x17eaae){if(_0x17eaae&&_0x17eaae[_0x4122('0xd7')]){var _0x62381b=_0x17eaae[_0x4122('0xdb')]({'plain':!![]});fs[_0x4122('0xdc')](_0x327f30);return BPromise[_0x4122('0xdd')](_0x62381b[_0x4122('0xd7')],function(_0x1dd6ed,_0x1a43c0){var _0x1b5adf={'from':_0x1dd6ed[_0x4122('0x4b')],'to':_0x1dd6ed['to'],'subject':_0x1dd6ed[_0x4122('0xd9')],'html':htmlEntities[_0x4122('0xde')](_0x1dd6ed[_0x4122('0xbb')]),'headers':{'Date':moment(_0x1dd6ed[_0x4122('0xda')])[_0x4122('0xc4')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1dd6ed['cc']){_0x1b5adf[_0x4122('0xdf')]['Cc']=_0x1dd6ed['cc'];}if(_0x1dd6ed['bcc']){_0x1b5adf[_0x4122('0xdf')]['Bcc']=_0x1dd6ed[_0x4122('0xd8')];}return new BPromise(function(_0x47c452,_0x552f46){if(_0x1dd6ed[_0x4122('0xe0')]){for(var _0x5199a1=0x0;_0x5199a1<_0x1dd6ed[_0x4122('0xe0')][_0x4122('0x42')];_0x5199a1++){var _0x4ea584=_0x1dd6ed[_0x4122('0xe0')][_0x5199a1];var _0x59eb92=path[_0x4122('0xd0')](_0x1462f5,_0x4ea584[_0x4122('0xe1')]);if(fs[_0x4122('0xe2')](_0x59eb92)){_0x1b5adf[_0x4122('0xd6')]['push']({'name':_0x4ea584[_0x4122('0x24')],'contentType':_0x4ea584['type'],'data':fs[_0x4122('0xe3')](_0x59eb92)});}}}emlformat[_0x4122('0xe4')](_0x1b5adf,function(_0x4fc708,_0x3d6b1a){if(_0x4fc708)return _0x552f46(_0x4fc708);fs[_0x4122('0xe5')](path[_0x4122('0xd0')](_0x327f30,util[_0x4122('0xc4')]('message%d.eml',_0x1a43c0)),_0x3d6b1a);return _0x47c452(_0x3d6b1a);});});})[_0x4122('0x20')](function(){return new BPromise(function(_0x4c3e90,_0xe0d69d){zipdir(_0x327f30,{'saveTo':_0x5f1a41},function(_0x280506,_0xb68fae){if(_0x280506)return _0xe0d69d(_0x280506);return _0x4c3e90(_0xb68fae);});})[_0x4122('0x20')](function(){return new BPromise(function(_0x1835e1,_0x32d671){rimraf(_0x327f30,function(_0x23619b){if(_0x23619b)_0x32d671(_0x23619b);return _0x1835e1();});});})[_0x4122('0x20')](function(){return _0x505444['download'](_0x5f1a41,_0xe1522e,function(_0x5b6814){if(!_0x5b6814)fs['unlinkSync'](_0x5f1a41);});});});}else{return _0x505444[_0x4122('0x16')](0xc8);}})[_0x4122('0xb7')](handleError(_0x505444,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index d7b4a01..d24b63e 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 _0x74ae=['hook','exports','events','../../mysqldb','MailInteraction','getUsers','then','setDataValue','Users','unreadMessages','emit','catch','hasOwnProperty'];(function(_0x5df4a4,_0x4500d2){var _0x4a71e1=function(_0x3415d1){while(--_0x3415d1){_0x5df4a4['push'](_0x5df4a4['shift']());}};_0x4a71e1(++_0x4500d2);}(_0x74ae,0xec));var _0xe74a=function(_0xd2a568,_0x4e8606){_0xd2a568=_0xd2a568-0x0;var _0x4cf0ba=_0x74ae[_0xd2a568];return _0x4cf0ba;};'use strict';var EventEmitter=require(_0xe74a('0x0'));var MailInteraction=require(_0xe74a('0x1'))['db'][_0xe74a('0x2')];var MailMessage=require(_0xe74a('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1edba0){return function(_0x16989b,_0x1885e6,_0x1a3553){_0x16989b[_0xe74a('0x3')]({'attributes':['id'],'raw':!![]})[_0xe74a('0x4')](function(_0x4529e6){_0x16989b[_0xe74a('0x5')](_0xe74a('0x6'),_0x4529e6['map'](function(_0x3fe0d0){return{'id':_0x3fe0d0['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x16989b['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe74a('0x4')](function(_0x480ee3){_0x16989b[_0xe74a('0x5')](_0xe74a('0x7'),_0x480ee3['length']);MailInteractionEvents[_0xe74a('0x8')](_0x1edba0+':'+_0x16989b['id'],_0x16989b);MailInteractionEvents['emit'](_0x1edba0,_0x16989b);_0x1a3553(null);})[_0xe74a('0x9')](_0x1a3553(null));};}for(var e in events){if(events[_0xe74a('0xa')](e)){var event=events[e];MailInteraction[_0xe74a('0xb')](e,emitEvent(event));}}module[_0xe74a('0xc')]=MailInteractionEvents; \ No newline at end of file +var _0x8793=['MailMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','map','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x8793,0x1eb));var _0x3879=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0x8793[_0x25d386];return _0x857f4a;};'use strict';var EventEmitter=require(_0x3879('0x0'));var MailInteraction=require(_0x3879('0x1'))['db'][_0x3879('0x2')];var MailMessage=require(_0x3879('0x1'))['db'][_0x3879('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x3879('0x4')](0x0);var events={'afterCreate':_0x3879('0x5'),'afterUpdate':_0x3879('0x6'),'afterDestroy':_0x3879('0x7')};function emitEvent(_0x58c826){return function(_0x3d823e,_0x49c31f,_0x2a9255){_0x3d823e[_0x3879('0x8')]({'attributes':['id'],'raw':!![]})[_0x3879('0x9')](function(_0xb40133){_0x3d823e[_0x3879('0xa')]('Users',_0xb40133[_0x3879('0xb')](function(_0x26c99b){return{'id':_0x26c99b['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x3d823e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3879('0x9')](function(_0x4991f5){_0x3d823e['setDataValue'](_0x3879('0xc'),_0x4991f5[_0x3879('0xd')]);MailInteractionEvents['emit'](_0x58c826+':'+_0x3d823e['id'],_0x3d823e);MailInteractionEvents[_0x3879('0xe')](_0x58c826,_0x3d823e);_0x2a9255(null);})[_0x3879('0xf')](_0x2a9255(null));};}for(var e in events){if(events[_0x3879('0x10')](e)){var event=events[e];MailInteraction[_0x3879('0x11')](e,emitEvent(event));}}module[_0x3879('0x12')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 1198a1e..18afb9d 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 _0x596a=['mail_interactions','subject','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','update','then','catch','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','MailInteraction'];(function(_0x1f16e9,_0x361b6a){var _0x3ed828=function(_0xda15ac){while(--_0xda15ac){_0x1f16e9['push'](_0x1f16e9['shift']());}};_0x3ed828(++_0x361b6a);}(_0x596a,0x9e));var _0xa596=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x596a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa596('0x0'));var util=require(_0xa596('0x1'));var logger=require(_0xa596('0x2'))(_0xa596('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa596('0x4'));var fs=require('fs');var path=require(_0xa596('0x5'));var rimraf=require(_0xa596('0x6'));var config=require(_0xa596('0x7'));var attributes=require('./mailInteraction.attributes');module[_0xa596('0x8')]=function(_0x37298b,_0x1482c3){return _0x37298b['define'](_0xa596('0x9'),attributes,{'tableName':_0xa596('0xa'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xa596('0xb'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4b7048,_0x4a7705,_0x3f3771){if(_0x4b7048[_0xa596('0xc')]){_0x4b7048[_0xa596('0xd')]=moment()['format'](_0xa596('0xe'));}if(_0x4b7048[_0xa596('0xf')]){_0x4b7048[_0xa596('0x10')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x3f3771(null,_0x4a7705);},'beforeUpdate':function(_0x5db2d2,_0x2df9d1,_0x470b01){if(_0x5db2d2['changed']('substatus')){_0x5db2d2[_0xa596('0xd')]=_0x5db2d2[_0xa596('0xc')]?moment()['format'](_0xa596('0xe')):null;}if(_0x5db2d2[_0xa596('0x11')](_0xa596('0xf'))){_0x5db2d2[_0xa596('0x10')]=moment()['format'](_0xa596('0xe'));_0x5db2d2[_0xa596('0xc')]=null;_0x5db2d2['substatusAt']=null;}_0x470b01(null,_0x5db2d2);},'afterUpdate':function(_0x426e10,_0x456771,_0x105632){var _0x5d1a1d=_0x37298b[_0xa596('0x12')];var _0x52d1e4=_0x426e10[_0xa596('0x13')]({'plain':!![]});if(_0x52d1e4[_0xa596('0xf')]){return _0x5d1a1d['MailMessage'][_0xa596('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x52d1e4['id']}})[_0xa596('0x15')](function(){_0x105632();})[_0xa596('0x16')](function(_0x3d093f){_0x105632(_0x3d093f);});}else{_0x105632();}}},'charset':'utf8mb4','collate':_0xa596('0x17')});}; \ No newline at end of file +var _0x1854=['request-promise','rimraf','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','FULLTEXT','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','substatusAt','closedAt','models','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5c4356,_0xb004d9){var _0x43a404=function(_0x1159f7){while(--_0x1159f7){_0x5c4356['push'](_0x5c4356['shift']());}};_0x43a404(++_0xb004d9);}(_0x1854,0x139));var _0x4185=function(_0x34620e,_0x582015){_0x34620e=_0x34620e-0x0;var _0x3d33cd=_0x1854[_0x34620e];return _0x3d33cd;};'use strict';var _=require(_0x4185('0x0'));var util=require(_0x4185('0x1'));var logger=require(_0x4185('0x2'))(_0x4185('0x3'));var moment=require(_0x4185('0x4'));var BPromise=require(_0x4185('0x5'));var rp=require(_0x4185('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4185('0x7'));var config=require('../../config/environment');var attributes=require('./mailInteraction.attributes');module[_0x4185('0x8')]=function(_0x41a0ce,_0x90fb95){return _0x41a0ce[_0x4185('0x9')](_0x4185('0xa'),attributes,{'tableName':_0x4185('0xb'),'paranoid':![],'indexes':[{'name':_0x4185('0xc'),'fields':['subject','to'],'type':_0x4185('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2cd038,_0x372fb0,_0x4e0d17){if(_0x2cd038[_0x4185('0xe')]){_0x2cd038['substatusAt']=moment()[_0x4185('0xf')](_0x4185('0x10'));}if(_0x2cd038[_0x4185('0x11')]){_0x2cd038['closedAt']=moment()[_0x4185('0xf')](_0x4185('0x10'));}_0x4e0d17(null,_0x372fb0);},'beforeUpdate':function(_0xbfc2cd,_0x19d4fc,_0x400c44){if(_0xbfc2cd[_0x4185('0x12')](_0x4185('0xe'))){_0xbfc2cd[_0x4185('0x13')]=_0xbfc2cd[_0x4185('0xe')]?moment()['format'](_0x4185('0x10')):null;}if(_0xbfc2cd[_0x4185('0x12')](_0x4185('0x11'))){_0xbfc2cd[_0x4185('0x14')]=moment()['format'](_0x4185('0x10'));_0xbfc2cd[_0x4185('0xe')]=null;_0xbfc2cd[_0x4185('0x13')]=null;}_0x400c44(null,_0xbfc2cd);},'afterUpdate':function(_0x4a7ad0,_0x500c59,_0x27527b){var _0x288969=_0x41a0ce[_0x4185('0x15')];var _0x35036d=_0x4a7ad0[_0x4185('0x16')]({'plain':!![]});if(_0x35036d[_0x4185('0x11')]){return _0x288969[_0x4185('0x17')][_0x4185('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x35036d['id']}})[_0x4185('0x19')](function(){_0x27527b();})[_0x4185('0x1a')](function(_0x3948ac){_0x27527b(_0x3948ac);});}else{_0x27527b();}}},'charset':_0x4185('0x1b'),'collate':_0x4185('0x1c')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 3702979..fd473c2 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 _0x9826=['request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','MailInteraction','update','body','options','raw','where','attributes','limit','UpdateMailInteraction','AddTagsToMailInteraction','find','addTags','omit','ids','spread','AddTags','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','then','info','MailInteraction,\x20%s,\x20%s'];(function(_0x56146b,_0x543ede){var _0x4ebe0a=function(_0x2a24f0){while(--_0x2a24f0){_0x56146b['push'](_0x56146b['shift']());}};_0x4ebe0a(++_0x543ede);}(_0x9826,0x1c7));var _0x6982=function(_0x1429d5,_0x4e753d){_0x1429d5=_0x1429d5-0x0;var _0xe20bc2=_0x9826[_0x1429d5];return _0xe20bc2;};'use strict';var _=require(_0x6982('0x0'));var util=require('util');var moment=require(_0x6982('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6982('0x2'));var db=require(_0x6982('0x3'))['db'];var utils=require(_0x6982('0x4'));var logger=require('../../config/logger')(_0x6982('0x5'));var config=require(_0x6982('0x6'));var jayson=require(_0x6982('0x7'));var client=jayson[_0x6982('0x8')][_0x6982('0x9')]({'port':0x232a});config[_0x6982('0xa')]=_[_0x6982('0xb')](config[_0x6982('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x6982('0xc'))(new Redis(config[_0x6982('0xa')]));require(_0x6982('0xd'))[_0x6982('0xe')](socket);function respondWithRpcPromise(_0x7d42f6,_0x399a81,_0x3a1bb8){return new BPromise(function(_0x4ab14c,_0x324406){return client['request'](_0x7d42f6,_0x3a1bb8)[_0x6982('0xf')](function(_0x1918d9){logger[_0x6982('0x10')](_0x6982('0x11'),_0x399a81,_0x6982('0x12'));logger[_0x6982('0x13')](_0x6982('0x14'),_0x399a81,_0x6982('0x12'),JSON[_0x6982('0x15')](_0x1918d9));if(_0x1918d9[_0x6982('0x16')]){if(_0x1918d9['error'][_0x6982('0x17')]===0x1f4){logger[_0x6982('0x16')](_0x6982('0x11'),_0x399a81,_0x1918d9[_0x6982('0x16')][_0x6982('0x18')]);return _0x324406(_0x1918d9[_0x6982('0x16')][_0x6982('0x18')]);}logger[_0x6982('0x16')]('MailInteraction,\x20%s,\x20%s',_0x399a81,_0x1918d9[_0x6982('0x16')]['message']);return _0x4ab14c(_0x1918d9['error'][_0x6982('0x18')]);}else{logger['info'](_0x6982('0x11'),_0x399a81,_0x6982('0x12'));_0x4ab14c(_0x1918d9[_0x6982('0x19')][_0x6982('0x18')]);}})['catch'](function(_0x3e6403){logger[_0x6982('0x16')]('MailInteraction,\x20%s,\x20%s',_0x399a81,_0x3e6403);_0x324406(_0x3e6403);});});}exports['UpdateMailInteraction']=function(_0x1e68de){var _0x3af138=this;return new Promise(function(_0x215291,_0x3a41a0){return db[_0x6982('0x1a')][_0x6982('0x1b')](_0x1e68de[_0x6982('0x1c')],{'raw':_0x1e68de[_0x6982('0x1d')]?_0x1e68de[_0x6982('0x1d')][_0x6982('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e68de[_0x6982('0x1d')]?_0x1e68de[_0x6982('0x1d')][_0x6982('0x1f')]||null:null,'attributes':_0x1e68de[_0x6982('0x1d')]?_0x1e68de[_0x6982('0x1d')][_0x6982('0x20')]||null:null,'limit':_0x1e68de['options']?_0x1e68de[_0x6982('0x1d')][_0x6982('0x21')]||null:null})['then'](function(_0x4c21bd){logger[_0x6982('0x10')](_0x6982('0x22'),_0x1e68de);logger['debug'](_0x6982('0x22'),_0x1e68de,JSON[_0x6982('0x15')](_0x4c21bd));_0x215291(_0x4c21bd);})['catch'](function(_0x38e9fa){logger[_0x6982('0x16')](_0x6982('0x22'),_0x38e9fa[_0x6982('0x18')],_0x1e68de);_0x3a41a0(_0x3af138[_0x6982('0x16')](0x1f4,_0x38e9fa[_0x6982('0x18')]));});});};exports[_0x6982('0x23')]=function(_0x423493){return new Promise(function(_0xcd785c,_0x352350){return db[_0x6982('0x1a')][_0x6982('0x24')]({'where':_0x423493[_0x6982('0x1d')]?_0x423493[_0x6982('0x1d')][_0x6982('0x1f')]||null:null})[_0x6982('0xf')](function(_0x50d417){if(_0x50d417){return _0x50d417[_0x6982('0x25')](_0x423493[_0x6982('0x1c')]['ids'],_[_0x6982('0x26')](_0x423493[_0x6982('0x1c')],[_0x6982('0x27'),'id'])||{});}})[_0x6982('0x28')](function(_0x58caa6){logger[_0x6982('0x10')](_0x6982('0x29'),_0x423493);logger[_0x6982('0x13')](_0x6982('0x29'),_0x423493,JSON['stringify'](_0x58caa6));_0xcd785c(_0x58caa6);})[_0x6982('0x2a')](function(_0x58ac47){logger[_0x6982('0x16')](_0x6982('0x29'),_0x58ac47[_0x6982('0x18')],_0x423493);_0x352350(_this[_0x6982('0x16')](0x1f4,_0x58ac47[_0x6982('0x18')]));});});}; \ No newline at end of file +var _0x2168=['MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateMailInteraction','MailInteraction','update','options','raw','where','attributes','limit','then','catch','AddTagsToMailInteraction','find','addTags','body','ids','omit','spread','AddTags','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','register','request','info','MailInteraction,\x20%s,\x20%s','debug'];(function(_0x2f0f90,_0x411945){var _0x3da03a=function(_0xf37754){while(--_0xf37754){_0x2f0f90['push'](_0x2f0f90['shift']());}};_0x3da03a(++_0x411945);}(_0x2168,0x6a));var _0x8216=function(_0x23b746,_0x26147b){_0x23b746=_0x23b746-0x0;var _0x20e630=_0x2168[_0x23b746];return _0x20e630;};'use strict';var _=require('lodash');var util=require(_0x8216('0x0'));var moment=require(_0x8216('0x1'));var BPromise=require(_0x8216('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8216('0x3'))['db'];var utils=require(_0x8216('0x4'));var logger=require('../../config/logger')(_0x8216('0x5'));var config=require(_0x8216('0x6'));var jayson=require(_0x8216('0x7'));var client=jayson['client'][_0x8216('0x8')]({'port':0x232a});config['redis']=_[_0x8216('0x9')](config[_0x8216('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x8216('0xb'))(new Redis(config[_0x8216('0xa')]));require('./mailInteraction.socket')[_0x8216('0xc')](socket);function respondWithRpcPromise(_0x8b647a,_0x351cfe,_0x584b62){return new BPromise(function(_0x3af318,_0x1bab8a){return client[_0x8216('0xd')](_0x8b647a,_0x584b62)['then'](function(_0x74b7c4){logger[_0x8216('0xe')](_0x8216('0xf'),_0x351cfe,'request\x20sent');logger[_0x8216('0x10')](_0x8216('0x11'),_0x351cfe,'request\x20sent',JSON[_0x8216('0x12')](_0x74b7c4));if(_0x74b7c4[_0x8216('0x13')]){if(_0x74b7c4[_0x8216('0x13')][_0x8216('0x14')]===0x1f4){logger[_0x8216('0x13')]('MailInteraction,\x20%s,\x20%s',_0x351cfe,_0x74b7c4[_0x8216('0x13')]['message']);return _0x1bab8a(_0x74b7c4['error'][_0x8216('0x15')]);}logger[_0x8216('0x13')](_0x8216('0xf'),_0x351cfe,_0x74b7c4['error'][_0x8216('0x15')]);return _0x3af318(_0x74b7c4['error'][_0x8216('0x15')]);}else{logger[_0x8216('0xe')]('MailInteraction,\x20%s,\x20%s',_0x351cfe,'request\x20sent');_0x3af318(_0x74b7c4[_0x8216('0x16')][_0x8216('0x15')]);}})['catch'](function(_0x3f9af5){logger['error'](_0x8216('0xf'),_0x351cfe,_0x3f9af5);_0x1bab8a(_0x3f9af5);});});}exports[_0x8216('0x17')]=function(_0x534591){var _0x29dcca=this;return new Promise(function(_0x21ee43,_0x557416){return db[_0x8216('0x18')][_0x8216('0x19')](_0x534591['body'],{'raw':_0x534591[_0x8216('0x1a')]?_0x534591['options'][_0x8216('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x534591[_0x8216('0x1a')]?_0x534591[_0x8216('0x1a')][_0x8216('0x1c')]||null:null,'attributes':_0x534591[_0x8216('0x1a')]?_0x534591['options'][_0x8216('0x1d')]||null:null,'limit':_0x534591[_0x8216('0x1a')]?_0x534591[_0x8216('0x1a')][_0x8216('0x1e')]||null:null})[_0x8216('0x1f')](function(_0x50856e){logger['info'](_0x8216('0x17'),_0x534591);logger[_0x8216('0x10')](_0x8216('0x17'),_0x534591,JSON[_0x8216('0x12')](_0x50856e));_0x21ee43(_0x50856e);})[_0x8216('0x20')](function(_0x4b9810){logger[_0x8216('0x13')](_0x8216('0x17'),_0x4b9810['message'],_0x534591);_0x557416(_0x29dcca[_0x8216('0x13')](0x1f4,_0x4b9810[_0x8216('0x15')]));});});};exports[_0x8216('0x21')]=function(_0xf78cce){return new Promise(function(_0x1394d6,_0x5d8325){return db['MailInteraction'][_0x8216('0x22')]({'where':_0xf78cce[_0x8216('0x1a')]?_0xf78cce['options']['where']||null:null})[_0x8216('0x1f')](function(_0x191359){if(_0x191359){return _0x191359[_0x8216('0x23')](_0xf78cce[_0x8216('0x24')][_0x8216('0x25')],_[_0x8216('0x26')](_0xf78cce[_0x8216('0x24')],['ids','id'])||{});}})[_0x8216('0x27')](function(_0x20179b){logger['info'](_0x8216('0x28'),_0xf78cce);logger[_0x8216('0x10')](_0x8216('0x28'),_0xf78cce,JSON[_0x8216('0x12')](_0x20179b));_0x1394d6(_0x20179b);})[_0x8216('0x20')](function(_0x2fb416){logger[_0x8216('0x13')]('AddTags',_0x2fb416[_0x8216('0x15')],_0xf78cce);_0x5d8325(_this[_0x8216('0x13')](0x1f4,_0x2fb416[_0x8216('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 74c68aa..b57bea4 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 _0x86aa=['register','length','./mailInteraction.events','save','remove','removeListener'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x86aa,0x182));var _0xa86a=function(_0xbc2b2f,_0x25eb03){_0xbc2b2f=_0xbc2b2f-0x0;var _0xd3884a=_0x86aa[_0xbc2b2f];return _0xd3884a;};'use strict';var MailInteractionEvents=require(_0xa86a('0x0'));var events=[_0xa86a('0x1'),_0xa86a('0x2'),'update'];function createListener(_0x108a85,_0x723c44){return function(_0x19675e){_0x723c44['emit'](_0x108a85,_0x19675e);};}function removeListener(_0x4b3e72,_0x4423b0){return function(){MailInteractionEvents[_0xa86a('0x3')](_0x4b3e72,_0x4423b0);};}exports[_0xa86a('0x4')]=function(_0x4a2939){for(var _0x29d67a=0x0,_0x6db691=events[_0xa86a('0x5')];_0x29d67a<_0x6db691;_0x29d67a++){var _0x42cd26=events[_0x29d67a];var _0x81abb8=createListener('mailInteraction:'+_0x42cd26,_0x4a2939);MailInteractionEvents['on'](_0x42cd26,_0x81abb8);}}; \ No newline at end of file +var _0x24d5=['removeListener','register','mailInteraction:','./mailInteraction.events','save','remove','update','emit'];(function(_0x52bff8,_0x2ee493){var _0x36ff13=function(_0x14fb83){while(--_0x14fb83){_0x52bff8['push'](_0x52bff8['shift']());}};_0x36ff13(++_0x2ee493);}(_0x24d5,0x183));var _0x524d=function(_0x2925c2,_0x166bea){_0x2925c2=_0x2925c2-0x0;var _0x1b11f3=_0x24d5[_0x2925c2];return _0x1b11f3;};'use strict';var MailInteractionEvents=require(_0x524d('0x0'));var events=[_0x524d('0x1'),_0x524d('0x2'),_0x524d('0x3')];function createListener(_0x355cc9,_0x2d4932){return function(_0x5838d5){_0x2d4932[_0x524d('0x4')](_0x355cc9,_0x5838d5);};}function removeListener(_0x14bcb5,_0x2855db){return function(){MailInteractionEvents[_0x524d('0x5')](_0x14bcb5,_0x2855db);};}exports[_0x524d('0x6')]=function(_0x2c4a53){for(var _0x1b7bc7=0x0,_0x3d6c0d=events['length'];_0x1b7bc7<_0x3d6c0d;_0x1b7bc7++){var _0x1c854e=events[_0x1b7bc7];var _0x31421d=createListener(_0x524d('0x7')+_0x1c854e,_0x2c4a53);MailInteractionEvents['on'](_0x1c854e,_0x31421d);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 9c0fea2..1354678 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 _0x2572=['tracked','mail','mailmessage:create','put','update','/:id/accept','accept','/:id/reject','delete','/:id','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download','download'];(function(_0x12bc69,_0x1934aa){var _0x3bc1e1=function(_0x3d25ef){while(--_0x3d25ef){_0x12bc69['push'](_0x12bc69['shift']());}};_0x3bc1e1(++_0x1934aa);}(_0x2572,0x110));var _0x2257=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x2572[_0xc6be3a];return _0x56a310;};'use strict';var multer=require(_0x2257('0x0'));var util=require(_0x2257('0x1'));var path=require(_0x2257('0x2'));var timeout=require(_0x2257('0x3'));var express=require(_0x2257('0x4'));var router=express[_0x2257('0x5')]();var fs_extra=require(_0x2257('0x6'));var auth=require(_0x2257('0x7'));var interaction=require(_0x2257('0x8'));var config=require('../../config/environment');var controller=require(_0x2257('0x9'));router[_0x2257('0xa')]('/',auth[_0x2257('0xb')](),controller[_0x2257('0xc')]);router[_0x2257('0xa')](_0x2257('0xd'),auth[_0x2257('0xb')](),controller[_0x2257('0xe')]);router[_0x2257('0xa')]('/:id',auth[_0x2257('0xb')](),controller[_0x2257('0xf')]);router['get'](_0x2257('0x10'),auth[_0x2257('0xb')](),controller[_0x2257('0x11')]);router['post']('/',auth[_0x2257('0xb')](),interaction[_0x2257('0x12')](_0x2257('0x13'),_0x2257('0x14')),controller['create']);router[_0x2257('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x2257('0x16')]);router[_0x2257('0x15')](_0x2257('0x17'),auth[_0x2257('0xb')](),controller[_0x2257('0x18')]);router[_0x2257('0x15')](_0x2257('0x19'),auth['isAuthenticated'](),controller['reject']);router[_0x2257('0x1a')](_0x2257('0x1b'),auth[_0x2257('0xb')](),controller[_0x2257('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x296f=['put','/:id/accept','accept','reject','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','index','get','isAuthenticated','describe','/:id','show','/:id/download','download','post','mail','mailmessage:create','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x296f,0xf0));var _0xf296=function(_0x3de873,_0x174b5f){_0x3de873=_0x3de873-0x0;var _0x380b8c=_0x296f[_0x3de873];return _0x380b8c;};'use strict';var multer=require(_0xf296('0x0'));var util=require(_0xf296('0x1'));var path=require(_0xf296('0x2'));var timeout=require(_0xf296('0x3'));var express=require(_0xf296('0x4'));var router=express[_0xf296('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf296('0x6'));var config=require(_0xf296('0x7'));var controller=require('./mailMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xf296('0x8')]);router[_0xf296('0x9')]('/describe',auth[_0xf296('0xa')](),controller[_0xf296('0xb')]);router['get'](_0xf296('0xc'),auth['isAuthenticated'](),controller[_0xf296('0xd')]);router[_0xf296('0x9')](_0xf296('0xe'),auth['isAuthenticated'](),controller[_0xf296('0xf')]);router[_0xf296('0x10')]('/',auth[_0xf296('0xa')](),interaction['tracked'](_0xf296('0x11'),_0xf296('0x12')),controller[_0xf296('0x13')]);router[_0xf296('0x14')](_0xf296('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf296('0x14')](_0xf296('0x15'),auth['isAuthenticated'](),controller[_0xf296('0x16')]);router[_0xf296('0x14')]('/:id/reject',auth[_0xf296('0xa')](),controller[_0xf296('0x17')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xf296('0x18')]);module[_0xf296('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 1721efa..bfe7dc5 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 _0xa67b=['TEXT','ENUM','out','STRING','long','DATE','INTEGER','BOOLEAN','Email','Chat','sequelize','lodash','exports'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xa67b,0x1c4));var _0xba67=function(_0x138615,_0x5e6f92){_0x138615=_0x138615-0x0;var _0x244cc0=_0xa67b[_0x138615];return _0x244cc0;};'use strict';var Sequelize=require(_0xba67('0x0'));var _=require(_0xba67('0x1'));module[_0xba67('0x2')]={'body':{'type':Sequelize[_0xba67('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xba67('0x3')]('medium')},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xba67('0x4')]('in','out'),'defaultValue':_0xba67('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0xba67('0x6')]},'to':{'type':Sequelize[_0xba67('0x3')](_0xba67('0x7'))},'cc':{'type':Sequelize[_0xba67('0x3')]('long')},'bcc':{'type':Sequelize['TEXT'](_0xba67('0x7'))},'subject':{'type':Sequelize[_0xba67('0x3')]},'sentAt':{'type':Sequelize[_0xba67('0x8')]},'attach':{'type':Sequelize[_0xba67('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xba67('0xa')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xba67('0x8')]},'originTo':{'type':Sequelize[_0xba67('0x3')](_0xba67('0x7'))},'originCc':{'type':Sequelize[_0xba67('0x3')]('long')},'originChannel':{'type':Sequelize[_0xba67('0x4')](_0xba67('0xb'),_0xba67('0xc')),'defaultValue':_0xba67('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x3aa0=['exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING','DATE','Email','Chat','sequelize','lodash'];(function(_0x15aad3,_0x5594e5){var _0x4dfda5=function(_0xe7e0f2){while(--_0xe7e0f2){_0x15aad3['push'](_0x15aad3['shift']());}};_0x4dfda5(++_0x5594e5);}(_0x3aa0,0x1ec));var _0x03aa=function(_0x543e9b,_0x5ec759){_0x543e9b=_0x543e9b-0x0;var _0x55418f=_0x3aa0[_0x543e9b];return _0x55418f;};'use strict';var Sequelize=require(_0x03aa('0x0'));var _=require(_0x03aa('0x1'));module[_0x03aa('0x2')]={'body':{'type':Sequelize[_0x03aa('0x3')](_0x03aa('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x03aa('0x3')](_0x03aa('0x5'))},'read':{'type':Sequelize[_0x03aa('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x03aa('0x7')]('in',_0x03aa('0x8')),'defaultValue':_0x03aa('0x8'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x03aa('0x9')]},'to':{'type':Sequelize[_0x03aa('0x3')]('long')},'cc':{'type':Sequelize[_0x03aa('0x3')](_0x03aa('0x4'))},'bcc':{'type':Sequelize[_0x03aa('0x3')](_0x03aa('0x4'))},'subject':{'type':Sequelize[_0x03aa('0x3')]},'sentAt':{'type':Sequelize[_0x03aa('0xa')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x03aa('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x03aa('0xa')]},'originTo':{'type':Sequelize[_0x03aa('0x3')]('long')},'originCc':{'type':Sequelize[_0x03aa('0x3')](_0x03aa('0x4'))},'originChannel':{'type':Sequelize[_0x03aa('0x7')](_0x03aa('0xb'),_0x03aa('0xc')),'defaultValue':_0x03aa('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 72155d0..f57a077 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 _0x55ac=['http','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','json','offset','undefined','limit','count','status','set','update','then','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','params','include','find','body','destroy','describe','create','direction','split','MailAccount','findOne','MailAccountId','CmList','CmContact','updatedAt','MailServerOut','Smtp','service','host','port','secure','pass','auth','user','attachments','join','server/files/attachments','basename','List','Contacts','ListId','List\x20not\x20found','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','UserId','agent','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','User','fullname','email','internal','manual','interface','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT','contact','SIP/%s','rejectmessage','download','unix','toString','root','files','server','from','bcc','createdAt','Attachment','Attachments','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','moment','util','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','jayson/promise','client'];(function(_0x7f94c3,_0x42ee25){var _0x5a8466=function(_0x35da49){while(--_0x35da49){_0x7f94c3['push'](_0x7f94c3['shift']());}};_0x5a8466(++_0x42ee25);}(_0x55ac,0x8f));var _0xc55a=function(_0x467ad7,_0x33b726){_0x467ad7=_0x467ad7-0x0;var _0x3959f7=_0x55ac[_0x467ad7];return _0x3959f7;};'use strict';var emlformat=require('eml-format');var moment=require(_0xc55a('0x0'));var BPromise=require('bluebird');var util=require(_0xc55a('0x1'));var path=require('path');var fs=require('fs');var _=require(_0xc55a('0x2'));var Redis=require(_0xc55a('0x3'));var htmlToText=require(_0xc55a('0x4'));var qs=require(_0xc55a('0x5'));var logger=require(_0xc55a('0x6'))(_0xc55a('0x7'));var interaction_log=require(_0xc55a('0x6'))(_0xc55a('0x8'));var config=require('../../config/environment');var db=require(_0xc55a('0x9'))['db'];config[_0xc55a('0xa')]=_[_0xc55a('0xb')](config[_0xc55a('0xa')],{'host':_0xc55a('0xc'),'port':0x18eb});var socket=require(_0xc55a('0xd'))(new Redis(config[_0xc55a('0xa')]));var htmlEntities=require(_0xc55a('0xe'));require(_0xc55a('0xf'))['register'](socket);var jayson=require(_0xc55a('0x10'));var client=jayson[_0xc55a('0x11')][_0xc55a('0x12')]({'port':0x232c});var client9003=jayson[_0xc55a('0x11')][_0xc55a('0x12')]({'port':0x232b});var client9002=jayson['client'][_0xc55a('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x8740bd,_0x32ef5c,_0x5de962,_0x5ec0ba){return new BPromise(function(_0x27e07e,_0x258812){var _0x5a486c=_0x5ec0ba||client;return _0x5a486c['request'](_0x8740bd,_0x5de962)['then'](function(_0x401bab){logger[_0xc55a('0x13')](_0xc55a('0x14'),_0x32ef5c,_0xc55a('0x15'));logger['debug'](_0xc55a('0x16'),_0x32ef5c,'request\x20sent',JSON['stringify'](_0x401bab));if(_0x401bab[_0xc55a('0x17')]){if(_0x401bab[_0xc55a('0x17')][_0xc55a('0x18')]===0x1f4){logger[_0xc55a('0x17')](_0xc55a('0x14'),_0x32ef5c,_0x401bab['error'][_0xc55a('0x19')]);return _0x258812(_0x401bab[_0xc55a('0x17')][_0xc55a('0x19')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x32ef5c,_0x401bab[_0xc55a('0x17')][_0xc55a('0x19')]);return _0x27e07e(_0x401bab[_0xc55a('0x17')]['message']);}else{logger['info'](_0xc55a('0x14'),_0x32ef5c,'request\x20sent');_0x27e07e(_0x401bab['result'][_0xc55a('0x19')]);}})[_0xc55a('0x1a')](function(_0x550c05){logger[_0xc55a('0x17')](_0xc55a('0x14'),_0x32ef5c,_0x550c05);_0x258812(_0x550c05);});});}function respondWithResult(_0x523971,_0x105188){_0x105188=_0x105188||0xc8;return function(_0x47baa5){if(_0x47baa5){return _0x523971['status'](_0x105188)[_0xc55a('0x1b')](_0x47baa5);}};}function respondWithFilteredResult(_0x24b144,_0x56c422){return function(_0x410ffd){if(_0x410ffd){var _0x52b36b=typeof _0x56c422[_0xc55a('0x1c')]===_0xc55a('0x1d')&&typeof _0x56c422[_0xc55a('0x1e')]===_0xc55a('0x1d');var _0x5f331c=_0x410ffd['count'];var _0x57a5d6=_0x52b36b?0x0:_0x56c422['offset'];var _0x41d299=_0x52b36b?_0x410ffd[_0xc55a('0x1f')]:_0x56c422[_0xc55a('0x1c')]+_0x56c422[_0xc55a('0x1e')];var _0x899081;if(_0x41d299>=_0x5f331c){_0x41d299=_0x5f331c;_0x899081=0xc8;}else{_0x899081=0xce;}_0x24b144[_0xc55a('0x20')](_0x899081);return _0x24b144[_0xc55a('0x21')]('Content-Range',_0x57a5d6+'-'+_0x41d299+'/'+_0x5f331c)[_0xc55a('0x1b')](_0x410ffd);}return null;};}function saveUpdates(_0x1d54f3){return function(_0x448b57){if(_0x448b57){return _0x448b57[_0xc55a('0x22')](_0x1d54f3)[_0xc55a('0x23')](function(_0xf2b00b){return _0xf2b00b;});}return null;};}function removeEntity(_0x405d6a){return function(_0x66dd11){if(_0x66dd11){return _0x66dd11['destroy']()['then'](function(){_0x405d6a[_0xc55a('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x461aa){return function(_0x25050d){if(!_0x25050d){_0x461aa['sendStatus'](0x194);}return _0x25050d;};}function handleError(_0x37d81f,_0x507f8c){_0x507f8c=_0x507f8c||0x1f4;return function(_0x9d7f2a){logger[_0xc55a('0x17')](_0x9d7f2a['stack']);if(_0x9d7f2a[_0xc55a('0x24')]){delete _0x9d7f2a[_0xc55a('0x24')];}_0x37d81f[_0xc55a('0x20')](_0x507f8c)[_0xc55a('0x25')](_0x9d7f2a);};}exports[_0xc55a('0x26')]=function(_0xaf9e78,_0x186071){var _0x15f556={},_0x3cc7b4={},_0x22d8c5={'count':0x0,'rows':[]};var _0x4bf9c1=_[_0xc55a('0x27')](db[_0xc55a('0x28')][_0xc55a('0x29')],function(_0x1013b2){return{'name':_0x1013b2[_0xc55a('0x2a')],'type':_0x1013b2[_0xc55a('0x2b')][_0xc55a('0x2c')]};});_0x3cc7b4['model']=_[_0xc55a('0x27')](_0x4bf9c1,_0xc55a('0x24'));_0x3cc7b4[_0xc55a('0x2d')]=_['keys'](_0xaf9e78['query']);_0x3cc7b4[_0xc55a('0x2e')]=_[_0xc55a('0x2f')](_0x3cc7b4[_0xc55a('0x30')],_0x3cc7b4[_0xc55a('0x2d')]);_0x15f556[_0xc55a('0x31')]=_[_0xc55a('0x2f')](_0x3cc7b4[_0xc55a('0x30')],qs[_0xc55a('0x32')](_0xaf9e78[_0xc55a('0x2d')]['fields']));_0x15f556[_0xc55a('0x31')]=_0x15f556[_0xc55a('0x31')][_0xc55a('0x33')]?_0x15f556['attributes']:_0x3cc7b4[_0xc55a('0x30')];if(!_0xaf9e78[_0xc55a('0x2d')][_0xc55a('0x34')](_0xc55a('0x35'))){_0x15f556[_0xc55a('0x1e')]=qs[_0xc55a('0x1e')](_0xaf9e78[_0xc55a('0x2d')][_0xc55a('0x1e')]);_0x15f556[_0xc55a('0x1c')]=qs['offset'](_0xaf9e78[_0xc55a('0x2d')][_0xc55a('0x1c')]);}_0x15f556[_0xc55a('0x36')]=qs[_0xc55a('0x37')](_0xaf9e78[_0xc55a('0x2d')][_0xc55a('0x37')]);_0x15f556[_0xc55a('0x38')]=qs[_0xc55a('0x2e')](_[_0xc55a('0x39')](_0xaf9e78['query'],_0x3cc7b4[_0xc55a('0x2e')]),_0x4bf9c1);if(_0xaf9e78['query'][_0xc55a('0x3a')]){_0x15f556[_0xc55a('0x38')]=_[_0xc55a('0x3b')](_0x15f556[_0xc55a('0x38')],{'$or':_['map'](_0x4bf9c1,function(_0x2b703f){if(_0x2b703f[_0xc55a('0x2b')]!==_0xc55a('0x3c')){var _0x15d01b={};_0x15d01b[_0x2b703f[_0xc55a('0x24')]]={'$like':'%'+_0xaf9e78['query']['filter']+'%'};return _0x15d01b;}})});}_0x15f556=_[_0xc55a('0x3b')]({},_0x15f556,_0xaf9e78[_0xc55a('0x3d')]);var _0x2d8d53={'where':_0x15f556[_0xc55a('0x38')]};return db['MailMessage'][_0xc55a('0x1f')](_0x2d8d53)[_0xc55a('0x23')](function(_0x166e37){_0x22d8c5['count']=_0x166e37;if(_0xaf9e78[_0xc55a('0x2d')][_0xc55a('0x3e')]){_0x15f556['include']=[{'all':!![]}];}return db[_0xc55a('0x28')]['findAll'](_0x15f556);})[_0xc55a('0x23')](function(_0xfc6d57){_0x22d8c5[_0xc55a('0x3f')]=_0xfc6d57;return _0x22d8c5;})[_0xc55a('0x23')](respondWithFilteredResult(_0x186071,_0x15f556))['catch'](handleError(_0x186071,null));};exports['show']=function(_0x58409c,_0x613a42){var _0x254699={'raw':!![],'where':{'id':_0x58409c[_0xc55a('0x40')]['id']}},_0x4014ba={};_0x4014ba[_0xc55a('0x30')]=_['keys'](db[_0xc55a('0x28')][_0xc55a('0x29')]);_0x4014ba['query']=_['keys'](_0x58409c[_0xc55a('0x2d')]);_0x4014ba[_0xc55a('0x2e')]=_['intersection'](_0x4014ba[_0xc55a('0x30')],_0x4014ba['query']);_0x254699[_0xc55a('0x31')]=_[_0xc55a('0x2f')](_0x4014ba['model'],qs[_0xc55a('0x32')](_0x58409c[_0xc55a('0x2d')]['fields']));_0x254699[_0xc55a('0x31')]=_0x254699['attributes'][_0xc55a('0x33')]?_0x254699[_0xc55a('0x31')]:_0x4014ba[_0xc55a('0x30')];if(_0x58409c[_0xc55a('0x2d')]['includeAll']){_0x254699[_0xc55a('0x41')]=[{'all':!![]}];}_0x254699=_[_0xc55a('0x3b')]({},_0x254699,_0x58409c[_0xc55a('0x3d')]);return db['MailMessage'][_0xc55a('0x42')](_0x254699)[_0xc55a('0x23')](handleEntityNotFound(_0x613a42,null))[_0xc55a('0x23')](respondWithResult(_0x613a42,null))[_0xc55a('0x1a')](handleError(_0x613a42,null));};exports[_0xc55a('0x22')]=function(_0x3b14c1,_0xf70b47){if(_0x3b14c1[_0xc55a('0x43')]['id']){delete _0x3b14c1[_0xc55a('0x43')]['id'];}return db[_0xc55a('0x28')][_0xc55a('0x42')]({'where':{'id':_0x3b14c1[_0xc55a('0x40')]['id']}})[_0xc55a('0x23')](handleEntityNotFound(_0xf70b47,null))[_0xc55a('0x23')](saveUpdates(_0x3b14c1[_0xc55a('0x43')],null))[_0xc55a('0x23')](respondWithResult(_0xf70b47,null))[_0xc55a('0x1a')](handleError(_0xf70b47,null));};exports[_0xc55a('0x44')]=function(_0x463122,_0x242080){return db['MailMessage'][_0xc55a('0x42')]({'where':{'id':_0x463122[_0xc55a('0x40')]['id']}})[_0xc55a('0x23')](handleEntityNotFound(_0x242080,null))[_0xc55a('0x23')](removeEntity(_0x242080,null))[_0xc55a('0x1a')](handleError(_0x242080,null));};exports[_0xc55a('0x45')]=function(_0x1210d8,_0x151e0c){return db[_0xc55a('0x28')][_0xc55a('0x45')]()['then'](respondWithResult(_0x151e0c,null))['catch'](handleError(_0x151e0c,null));};exports[_0xc55a('0x46')]=function(_0x18ba73,_0x3de374){return db['MailMessage'][_0xc55a('0x46')](_0x18ba73[_0xc55a('0x43')])[_0xc55a('0x23')](function(_0x341ecc){if(_0x341ecc){if(_0x341ecc[_0xc55a('0x47')]==='out'&&!_0x341ecc['secret']){var _0x42fe8c,_0x8a65a1,_0x300ea4;if(_0x18ba73[_0xc55a('0x43')]['to']){_0x8a65a1=_0x18ba73[_0xc55a('0x43')]['to'][_0xc55a('0x48')](',')[0x0];}return db[_0xc55a('0x49')][_0xc55a('0x4a')]({'where':{'id':_0x341ecc[_0xc55a('0x4b')]},'include':[{'model':db[_0xc55a('0x4c')],'as':'List','include':[{'model':db[_0xc55a('0x4d')],'as':'Contacts','where':{'email':_0x8a65a1},'limit':0x1,'order':[[_0xc55a('0x4e'),'DESC']]}]},{'model':db[_0xc55a('0x4f')],'as':'Smtp','raw':!![]}]})[_0xc55a('0x23')](function(_0x1272e3){_0x42fe8c=_0x1272e3;if(_0x42fe8c&&_0x42fe8c[_0xc55a('0x50')]){var _0x544d14={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x42fe8c[_0xc55a('0x50')][_0xc55a('0x51')])){_0x544d14[_0xc55a('0x52')]=_0x42fe8c[_0xc55a('0x50')][_0xc55a('0x52')];_0x544d14[_0xc55a('0x53')]=_0x42fe8c[_0xc55a('0x50')][_0xc55a('0x53')];_0x544d14[_0xc55a('0x54')]=_0x42fe8c[_0xc55a('0x50')][_0xc55a('0x54')];if(_0x42fe8c[_0xc55a('0x50')]['authentication']){_0x544d14['auth']={'user':_0x42fe8c[_0xc55a('0x50')]['user'],'pass':_0x42fe8c[_0xc55a('0x50')][_0xc55a('0x55')]};}}else{_0x544d14['service']=_0x42fe8c[_0xc55a('0x50')][_0xc55a('0x51')];_0x544d14[_0xc55a('0x56')]={'user':_0x42fe8c['Smtp'][_0xc55a('0x57')],'pass':_0x42fe8c[_0xc55a('0x50')][_0xc55a('0x55')]};_0x544d14[_0xc55a('0x54')]=_0x42fe8c['Smtp'][_0xc55a('0x54')];}if(_0x18ba73['body'][_0xc55a('0x58')]&&_0x18ba73[_0xc55a('0x43')][_0xc55a('0x58')]['length']){for(var _0x497ee9=0x0;_0x497ee9<_0x18ba73['body'][_0xc55a('0x58')]['length'];_0x497ee9+=0x1){_0x18ba73['body'][_0xc55a('0x58')][_0x497ee9]={'filename':_0x18ba73[_0xc55a('0x43')]['attachments'][_0x497ee9][_0xc55a('0x24')],'path':path[_0xc55a('0x59')](config['root'],_0xc55a('0x5a'),_0x18ba73[_0xc55a('0x43')]['attachments'][_0x497ee9][_0xc55a('0x5b')])};}}_0x300ea4={'account':_0x544d14,'message':_0x18ba73[_0xc55a('0x43')]};return;}})[_0xc55a('0x23')](function(){if(_0x42fe8c[_0xc55a('0x5c')]){if(_0x42fe8c[_0xc55a('0x5c')]['Contacts'][_0xc55a('0x33')]){return _0x42fe8c['List'][_0xc55a('0x5d')][0x0];}else{return db[_0xc55a('0x4d')][_0xc55a('0x46')](_[_0xc55a('0xb')](_0x18ba73[_0xc55a('0x43')],{'firstName':_0x18ba73[_0xc55a('0x43')]['to'],'email':_0x18ba73[_0xc55a('0x43')]['to'],'phone':_0x18ba73[_0xc55a('0x43')]['to'],'ListId':_0x42fe8c[_0xc55a('0x5e')]}));}}else{throw new Error(_0xc55a('0x5f'));}})[_0xc55a('0x23')](function(){if(_0x300ea4){return respondWithRpcPromise('SendMail',_0xc55a('0x60'),_0x300ea4,client9003)[_0xc55a('0x23')](function(_0x917d3b){return _0x341ecc[_0xc55a('0x22')]({'read':!![],'messageId':_0x917d3b['messageId'],'sentAt':moment()[_0xc55a('0x61')](_0xc55a('0x62'))});})[_0xc55a('0x1a')](function(_0x432125){logger[_0xc55a('0x17')]('%s',JSON['stringify'](_0x432125));return _0x341ecc;});}return _0x341ecc;});}return _0x341ecc;}})[_0xc55a('0x23')](respondWithResult(_0x3de374,0xc9))[_0xc55a('0x1a')](handleError(_0x3de374,null));};exports[_0xc55a('0x63')]=function(_0x200fe9,_0x3aaaf7){var _0x253717={'agent':{},'channel':_0xc55a('0x64')};if(_0x200fe9[_0xc55a('0x43')]['id']){delete _0x200fe9[_0xc55a('0x43')]['id'];}_0x200fe9[_0xc55a('0x43')][_0xc55a('0x65')]=!![];_0x200fe9['body']['readAt']=moment()[_0xc55a('0x61')](_0xc55a('0x62'));_0x200fe9[_0xc55a('0x43')]['UserId']=_0x200fe9[_0xc55a('0x43')][_0xc55a('0x66')]||_0x200fe9['user']['id'];_0x253717[_0xc55a('0x67')]['id']=_0x200fe9[_0xc55a('0x43')][_0xc55a('0x66')];return db[_0xc55a('0x28')][_0xc55a('0x42')]({'where':{'id':_0x200fe9[_0xc55a('0x40')]['id'],'UserId':null}})[_0xc55a('0x23')](handleEntityNotFound(_0x3aaaf7,null))['then'](saveUpdates(_0x200fe9[_0xc55a('0x43')],null))[_0xc55a('0x23')](function(_0x1d9392){if(_0x1d9392){_0x253717[_0xc55a('0x19')]=_0x1d9392[_0xc55a('0x68')]({'plain':!![]});return db[_0xc55a('0x69')]['find']({'where':{'id':_0x1d9392[_0xc55a('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x3aaaf7,null))[_0xc55a('0x23')](function(_0x3b5634){if(_0x3b5634){return _0x3b5634[_0xc55a('0x22')]({'UserId':_0x200fe9['body']['UserId'],'read1stAt':_['isNil'](_0x3b5634[_0xc55a('0x6b')])?moment()[_0xc55a('0x61')](_0xc55a('0x62')):undefined});}return null;})['then'](function(_0x4e8dff){if(_0x4e8dff){_0x253717[_0xc55a('0x6c')]=_0x4e8dff['get']({'plain':!![]});interaction_log[_0xc55a('0x13')](_0xc55a('0x6d'),_0x200fe9[_0xc55a('0x57')]['id'],_0x200fe9[_0xc55a('0x57')][_0xc55a('0x24')],_0x200fe9[_0xc55a('0x57')][_0xc55a('0x6e')],_0x253717[_0xc55a('0x6c')]['id'],_0x200fe9[_0xc55a('0x43')]?JSON[_0xc55a('0x6f')](_0x200fe9[_0xc55a('0x43')]):_0xc55a('0x70'));return respondWithRpcPromise(_0xc55a('0x71'),_0xc55a('0x72'),_0x253717);}return null;})['then'](function(_0x5d0524){var _0x1a212c=_0xc55a('0x73')+_0x5d0524[_0xc55a('0x19')][_0xc55a('0x74')];return db[_0xc55a('0x75')]['query'](_0x1a212c,{'type':db[_0xc55a('0x76')][_0xc55a('0x77')]['SELECT'],'raw':!![]})[_0xc55a('0x23')](function(_0x33eef2){return _0x33eef2;});})['then'](function(_0xc3a822){if(_0xc3a822){_0x253717[_0xc55a('0x19')]['contact']=_0xc3a822[0x0];if(!_0x200fe9['body'][_0xc55a('0x66')])return;return db[_0xc55a('0x78')][_0xc55a('0x42')]({'where':{'id':_0x200fe9['body'][_0xc55a('0x66')],'role':_0xc55a('0x67')},'attributes':['id',_0xc55a('0x24'),_0xc55a('0x79'),_0xc55a('0x7a'),_0xc55a('0x7b')],'raw':!![]});}return null;})[_0xc55a('0x23')](function(_0x194496){if(!_0x194496)return null;_0x253717['message'][_0xc55a('0x67')]=_0x194496;return _0x253717;})[_0xc55a('0x23')](function(_0x73ddf1){if(_0x73ddf1){if(_0x200fe9[_0xc55a('0x43')][_0xc55a('0x7c')]){_0x253717['message'][_0xc55a('0x7d')]=util[_0xc55a('0x61')]('SIP/%s',_0x200fe9[_0xc55a('0x57')][_0xc55a('0x24')]);_0x253717[_0xc55a('0x19')][_0xc55a('0x7e')]=_0x253717[_0xc55a('0x7e')];_0x253717[_0xc55a('0x19')][_0xc55a('0x7f')]=_0x253717[_0xc55a('0x7e')];_0x253717['message'][_0xc55a('0x80')]=_0xc55a('0x63');_0x253717[_0xc55a('0x19')][_0xc55a('0x43')]=htmlToText[_0xc55a('0x81')](_0x253717[_0xc55a('0x19')]['body']);return respondWithRpcPromise(_0xc55a('0x82'),_0xc55a('0x82'),{'event':_0xc55a('0x83'),'message':_0x253717[_0xc55a('0x19')]},client9002)[_0xc55a('0x23')](function(){return _0x253717;});}return _0x253717;}return null;})[_0xc55a('0x23')](respondWithResult(_0x3aaaf7,null))[_0xc55a('0x1a')](handleError(_0x3aaaf7,null));};exports[_0xc55a('0x84')]=function(_0xb7db26,_0x52eddd){var _0x4f4afd={'agent':{},'channel':_0xc55a('0x64')};if(_0xb7db26['body']['id']){delete _0xb7db26[_0xc55a('0x43')]['id'];}_0xb7db26[_0xc55a('0x43')][_0xc55a('0x66')]=_0xb7db26[_0xc55a('0x43')]['UserId']||_0xb7db26[_0xc55a('0x57')]['id'];_0x4f4afd[_0xc55a('0x67')]['id']=_0xb7db26[_0xc55a('0x43')][_0xc55a('0x66')];return db[_0xc55a('0x28')][_0xc55a('0x42')]({'where':{'id':_0xb7db26[_0xc55a('0x40')]['id'],'UserId':null}})[_0xc55a('0x23')](handleEntityNotFound(_0x52eddd,null))['then'](function(_0x3e707d){if(_0x3e707d){_0x4f4afd['message']=_0x3e707d[_0xc55a('0x68')]({'plain':!![]});return db[_0xc55a('0x69')][_0xc55a('0x42')]({'where':{'id':_0x3e707d[_0xc55a('0x6a')]}});}return null;})[_0xc55a('0x23')](handleEntityNotFound(_0x52eddd,null))[_0xc55a('0x23')](function(_0xeac3d0){if(_0xeac3d0){_0x4f4afd[_0xc55a('0x6c')]=_0xeac3d0[_0xc55a('0x68')]({'plain':!![]});interaction_log[_0xc55a('0x13')](_0xc55a('0x85'),_0xb7db26['user']['id'],_0xb7db26['user'][_0xc55a('0x24')],_0xb7db26['user'][_0xc55a('0x6e')],_0x4f4afd[_0xc55a('0x6c')]['id'],_0xb7db26[_0xc55a('0x43')]?JSON[_0xc55a('0x6f')](_0xb7db26['body']):'null');return respondWithRpcPromise(_0xc55a('0x86'),'rejectMessage',_0x4f4afd);}return null;})[_0xc55a('0x23')](function(_0x4ae250){var _0x2229d6='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4ae250[_0xc55a('0x19')][_0xc55a('0x74')];return db['sequelize']['query'](_0x2229d6,{'type':db[_0xc55a('0x76')][_0xc55a('0x77')][_0xc55a('0x87')],'raw':!![]})['then'](function(_0x11e336){return _0x11e336;});})[_0xc55a('0x23')](function(_0x4b4fec){if(_0x4b4fec){_0x4f4afd[_0xc55a('0x19')][_0xc55a('0x88')]=_0x4b4fec[0x0];if(!_0xb7db26[_0xc55a('0x43')]['UserId'])return;return db['User'][_0xc55a('0x42')]({'where':{'id':_0xb7db26[_0xc55a('0x43')][_0xc55a('0x66')],'role':_0xc55a('0x67')},'attributes':['id',_0xc55a('0x24'),_0xc55a('0x79'),_0xc55a('0x7a'),_0xc55a('0x7b')],'raw':!![]});}return null;})[_0xc55a('0x23')](function(_0x2902fb){if(!_0x2902fb)return null;_0x4f4afd[_0xc55a('0x19')][_0xc55a('0x67')]=_0x2902fb;return _0x4f4afd;})[_0xc55a('0x23')](function(_0x3b5262){if(_0x3b5262){_0x3b5262[_0xc55a('0x19')][_0xc55a('0x7d')]=util[_0xc55a('0x61')](_0xc55a('0x89'),_0xb7db26['user'][_0xc55a('0x24')]);_0x3b5262[_0xc55a('0x19')][_0xc55a('0x7e')]=_0x4f4afd[_0xc55a('0x7e')];_0x3b5262[_0xc55a('0x19')][_0xc55a('0x7f')]=_0x4f4afd[_0xc55a('0x7e')];_0x3b5262['message'][_0xc55a('0x80')]=_0xc55a('0x84');_0x3b5262[_0xc55a('0x19')][_0xc55a('0x43')]=htmlToText[_0xc55a('0x81')](_0x4f4afd[_0xc55a('0x19')][_0xc55a('0x43')]);respondWithRpcPromise(_0xc55a('0x82'),_0xc55a('0x82'),{'event':_0xc55a('0x8a'),'message':_0x3b5262['message']},client9002);return _0x4f4afd;}return null;})[_0xc55a('0x23')](respondWithResult(_0x52eddd,null))['catch'](handleError(_0x52eddd,null));};exports[_0xc55a('0x8b')]=function(_0x522be6,_0x3ea64a){var _0x21a234=moment()[_0xc55a('0x8c')]()[_0xc55a('0x8d')]();var _0x64f930=path[_0xc55a('0x59')](config[_0xc55a('0x8e')],'server',_0xc55a('0x8f'),'tmp');var _0x2f291e=path['join'](config[_0xc55a('0x8e')],_0xc55a('0x90'),_0xc55a('0x8f'),'attachments');var _0x3f1859=util[_0xc55a('0x61')]('message-%s.eml',_0x21a234);return db[_0xc55a('0x28')][_0xc55a('0x42')]({'where':{'id':_0x522be6['params']['id']},'attributes':['id',_0xc55a('0x43'),_0xc55a('0x91'),'to','cc',_0xc55a('0x92'),'subject',_0xc55a('0x93')],'include':_0x522be6[_0xc55a('0x2d')]['attachments']?[{'model':db[_0xc55a('0x94')],'as':_0xc55a('0x95')}]:undefined})['then'](handleEntityNotFound(_0x3ea64a,null))[_0xc55a('0x23')](function(_0x5b9cdb){if(_0x5b9cdb){var _0x3652dd=_0x5b9cdb;var _0x53c4e8={'from':_0x3652dd[_0xc55a('0x91')],'to':_0x3652dd['to'],'subject':_0x3652dd[_0xc55a('0x96')],'html':htmlEntities[_0xc55a('0x97')](_0x3652dd[_0xc55a('0x43')]),'headers':{'Date':moment(_0x3652dd[_0xc55a('0x93')])[_0xc55a('0x61')](_0xc55a('0x98'))},'attachments':[]};if(_0x5b9cdb['cc']){_0x53c4e8['headers']['Cc']=_0x5b9cdb['cc'];}if(_0x5b9cdb['bcc']){_0x53c4e8[_0xc55a('0x99')][_0xc55a('0x9a')]=_0x5b9cdb[_0xc55a('0x92')];}return new BPromise(function(_0x367dd0,_0x371348){if(_0x5b9cdb[_0xc55a('0x95')]){for(var _0xa883d9=0x0;_0xa883d9<_0x5b9cdb[_0xc55a('0x95')][_0xc55a('0x33')];_0xa883d9++){var _0x2e7529=_0x5b9cdb[_0xc55a('0x95')][_0xa883d9];var _0x2ff5ed=path[_0xc55a('0x59')](_0x2f291e,_0x2e7529[_0xc55a('0x5b')]);if(fs[_0xc55a('0x9b')](_0x2ff5ed)){_0x53c4e8[_0xc55a('0x58')][_0xc55a('0x9c')]({'name':_0x2e7529[_0xc55a('0x24')],'contentType':_0x2e7529['type'],'data':fs[_0xc55a('0x9d')](_0x2ff5ed)});}}}emlformat[_0xc55a('0x9e')](_0x53c4e8,function(_0x3176cb,_0x1a4149){if(_0x3176cb)return _0x371348(_0x3176cb);fs[_0xc55a('0x9f')](path[_0xc55a('0x59')](_0x64f930,_0x3f1859),_0x1a4149);return _0x367dd0(_0x1a4149);});});}})[_0xc55a('0x23')](function(_0x6fde5d){if(_0x6fde5d){return _0x3ea64a[_0xc55a('0x8b')](path[_0xc55a('0x59')](_0x64f930,_0x3f1859),_0x3f1859,function(_0x17b314){if(!_0x17b314)fs[_0xc55a('0xa0')](path[_0xc55a('0x59')](_0x64f930,_0x3f1859));});}})['catch'](handleError(_0x3ea64a,null));}; \ No newline at end of file +var _0x0457=['internal','manual','SIP/%s','channel','EventManager','acceptmessage','reject','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','fullname','interface','motionChannel','fromString','rejectmessage','unix','toString','root','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','push','build','writeFileSync','download','unlinkSync','moment','util','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','jayson/promise','http','client','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','json','offset','undefined','limit','set','update','status','end','sendStatus','name','send','index','map','MailMessage','rawAttributes','fieldName','type','query','intersection','attributes','model','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','options','count','include','rows','show','params','keys','fields','includeAll','find','body','destroy','describe','create','direction','out','secret','split','MailAccount','MailAccountId','CmList','List','Contacts','updatedAt','DESC','Smtp','service','host','port','secure','authentication','auth','user','pass','attachments','join','server/files/attachments','basename','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','read','readAt','agent','get','MailInteraction','read1stAt','interaction','role','null','acceptMessage','sequelize','Sequelize','QueryTypes','SELECT','contact','UserId','User','email'];(function(_0x21e8df,_0x123cb3){var _0x405173=function(_0x2d0f6e){while(--_0x2d0f6e){_0x21e8df['push'](_0x21e8df['shift']());}};_0x405173(++_0x123cb3);}(_0x0457,0x167));var _0x7045=function(_0x290c78,_0x406c3d){_0x290c78=_0x290c78-0x0;var _0x5d5bf5=_0x0457[_0x290c78];return _0x5d5bf5;};'use strict';var emlformat=require('eml-format');var moment=require(_0x7045('0x0'));var BPromise=require('bluebird');var util=require(_0x7045('0x1'));var path=require('path');var fs=require('fs');var _=require(_0x7045('0x2'));var Redis=require(_0x7045('0x3'));var htmlToText=require(_0x7045('0x4'));var qs=require(_0x7045('0x5'));var logger=require(_0x7045('0x6'))(_0x7045('0x7'));var interaction_log=require(_0x7045('0x6'))('mail-interactions');var config=require(_0x7045('0x8'));var db=require(_0x7045('0x9'))['db'];config[_0x7045('0xa')]=_[_0x7045('0xb')](config[_0x7045('0xa')],{'host':_0x7045('0xc'),'port':0x18eb});var socket=require(_0x7045('0xd'))(new Redis(config[_0x7045('0xa')]));var htmlEntities=require(_0x7045('0xe'));require(_0x7045('0xf'))['register'](socket);var jayson=require(_0x7045('0x10'));var client=jayson['client'][_0x7045('0x11')]({'port':0x232c});var client9003=jayson[_0x7045('0x12')]['http']({'port':0x232b});var client9002=jayson[_0x7045('0x12')][_0x7045('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x2a86db,_0x3a6cfa,_0x2c6768,_0x2ff814){return new BPromise(function(_0x5133f2,_0x34166b){var _0x5d355b=_0x2ff814||client;return _0x5d355b['request'](_0x2a86db,_0x2c6768)[_0x7045('0x13')](function(_0x203da2){logger[_0x7045('0x14')](_0x7045('0x15'),_0x3a6cfa,_0x7045('0x16'));logger[_0x7045('0x17')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x3a6cfa,_0x7045('0x16'),JSON['stringify'](_0x203da2));if(_0x203da2[_0x7045('0x18')]){if(_0x203da2[_0x7045('0x18')][_0x7045('0x19')]===0x1f4){logger[_0x7045('0x18')](_0x7045('0x15'),_0x3a6cfa,_0x203da2[_0x7045('0x18')]['message']);return _0x34166b(_0x203da2[_0x7045('0x18')][_0x7045('0x1a')]);}logger[_0x7045('0x18')](_0x7045('0x15'),_0x3a6cfa,_0x203da2[_0x7045('0x18')]['message']);return _0x5133f2(_0x203da2[_0x7045('0x18')]['message']);}else{logger['info'](_0x7045('0x15'),_0x3a6cfa,_0x7045('0x16'));_0x5133f2(_0x203da2[_0x7045('0x1b')][_0x7045('0x1a')]);}})[_0x7045('0x1c')](function(_0x3c98ae){logger['error']('MailMessage,\x20%s,\x20%s',_0x3a6cfa,_0x3c98ae);_0x34166b(_0x3c98ae);});});}function respondWithResult(_0x1f21c3,_0x17bd68){_0x17bd68=_0x17bd68||0xc8;return function(_0x4e6442){if(_0x4e6442){return _0x1f21c3['status'](_0x17bd68)[_0x7045('0x1d')](_0x4e6442);}};}function respondWithFilteredResult(_0x520994,_0x1a269d){return function(_0x463565){if(_0x463565){var _0x1d9baa=typeof _0x1a269d[_0x7045('0x1e')]===_0x7045('0x1f')&&typeof _0x1a269d[_0x7045('0x20')]===_0x7045('0x1f');var _0x15fcc5=_0x463565['count'];var _0x411790=_0x1d9baa?0x0:_0x1a269d[_0x7045('0x1e')];var _0x5dd585=_0x1d9baa?_0x463565['count']:_0x1a269d['offset']+_0x1a269d[_0x7045('0x20')];var _0x2802ca;if(_0x5dd585>=_0x15fcc5){_0x5dd585=_0x15fcc5;_0x2802ca=0xc8;}else{_0x2802ca=0xce;}_0x520994['status'](_0x2802ca);return _0x520994[_0x7045('0x21')]('Content-Range',_0x411790+'-'+_0x5dd585+'/'+_0x15fcc5)[_0x7045('0x1d')](_0x463565);}return null;};}function saveUpdates(_0x2f6d8d){return function(_0x4881f3){if(_0x4881f3){return _0x4881f3[_0x7045('0x22')](_0x2f6d8d)[_0x7045('0x13')](function(_0xbf02a8){return _0xbf02a8;});}return null;};}function removeEntity(_0x108504){return function(_0x43a7fe){if(_0x43a7fe){return _0x43a7fe['destroy']()['then'](function(){_0x108504[_0x7045('0x23')](0xcc)[_0x7045('0x24')]();});}};}function handleEntityNotFound(_0x5556d8){return function(_0x682e12){if(!_0x682e12){_0x5556d8[_0x7045('0x25')](0x194);}return _0x682e12;};}function handleError(_0x57038c,_0x119c9c){_0x119c9c=_0x119c9c||0x1f4;return function(_0x14025f){logger[_0x7045('0x18')](_0x14025f['stack']);if(_0x14025f[_0x7045('0x26')]){delete _0x14025f['name'];}_0x57038c[_0x7045('0x23')](_0x119c9c)[_0x7045('0x27')](_0x14025f);};}exports[_0x7045('0x28')]=function(_0x1d3783,_0x3be766){var _0x491b41={},_0x18ed5d={},_0x51e723={'count':0x0,'rows':[]};var _0x1aa416=_[_0x7045('0x29')](db[_0x7045('0x2a')][_0x7045('0x2b')],function(_0x743e0f){return{'name':_0x743e0f[_0x7045('0x2c')],'type':_0x743e0f[_0x7045('0x2d')]['key']};});_0x18ed5d['model']=_[_0x7045('0x29')](_0x1aa416,_0x7045('0x26'));_0x18ed5d[_0x7045('0x2e')]=_['keys'](_0x1d3783['query']);_0x18ed5d['filters']=_[_0x7045('0x2f')](_0x18ed5d['model'],_0x18ed5d['query']);_0x491b41[_0x7045('0x30')]=_[_0x7045('0x2f')](_0x18ed5d[_0x7045('0x31')],qs['fields'](_0x1d3783[_0x7045('0x2e')]['fields']));_0x491b41['attributes']=_0x491b41[_0x7045('0x30')][_0x7045('0x32')]?_0x491b41[_0x7045('0x30')]:_0x18ed5d[_0x7045('0x31')];if(!_0x1d3783[_0x7045('0x2e')][_0x7045('0x33')](_0x7045('0x34'))){_0x491b41[_0x7045('0x20')]=qs[_0x7045('0x20')](_0x1d3783[_0x7045('0x2e')]['limit']);_0x491b41[_0x7045('0x1e')]=qs[_0x7045('0x1e')](_0x1d3783[_0x7045('0x2e')][_0x7045('0x1e')]);}_0x491b41[_0x7045('0x35')]=qs[_0x7045('0x36')](_0x1d3783[_0x7045('0x2e')]['sort']);_0x491b41[_0x7045('0x37')]=qs[_0x7045('0x38')](_['pick'](_0x1d3783[_0x7045('0x2e')],_0x18ed5d[_0x7045('0x38')]),_0x1aa416);if(_0x1d3783['query']['filter']){_0x491b41[_0x7045('0x37')]=_[_0x7045('0x39')](_0x491b41[_0x7045('0x37')],{'$or':_['map'](_0x1aa416,function(_0x2820c4){if(_0x2820c4['type']!=='VIRTUAL'){var _0x2d6546={};_0x2d6546[_0x2820c4[_0x7045('0x26')]]={'$like':'%'+_0x1d3783[_0x7045('0x2e')]['filter']+'%'};return _0x2d6546;}})});}_0x491b41=_['merge']({},_0x491b41,_0x1d3783[_0x7045('0x3a')]);var _0x4e9946={'where':_0x491b41[_0x7045('0x37')]};return db['MailMessage'][_0x7045('0x3b')](_0x4e9946)[_0x7045('0x13')](function(_0x53bb01){_0x51e723['count']=_0x53bb01;if(_0x1d3783[_0x7045('0x2e')]['includeAll']){_0x491b41[_0x7045('0x3c')]=[{'all':!![]}];}return db[_0x7045('0x2a')]['findAll'](_0x491b41);})[_0x7045('0x13')](function(_0x2b87ce){_0x51e723[_0x7045('0x3d')]=_0x2b87ce;return _0x51e723;})[_0x7045('0x13')](respondWithFilteredResult(_0x3be766,_0x491b41))[_0x7045('0x1c')](handleError(_0x3be766,null));};exports[_0x7045('0x3e')]=function(_0x29d6c5,_0x35cdc2){var _0x4854ba={'raw':!![],'where':{'id':_0x29d6c5[_0x7045('0x3f')]['id']}},_0xe2732={};_0xe2732['model']=_['keys'](db[_0x7045('0x2a')][_0x7045('0x2b')]);_0xe2732[_0x7045('0x2e')]=_[_0x7045('0x40')](_0x29d6c5['query']);_0xe2732[_0x7045('0x38')]=_['intersection'](_0xe2732[_0x7045('0x31')],_0xe2732['query']);_0x4854ba[_0x7045('0x30')]=_['intersection'](_0xe2732['model'],qs['fields'](_0x29d6c5[_0x7045('0x2e')][_0x7045('0x41')]));_0x4854ba[_0x7045('0x30')]=_0x4854ba[_0x7045('0x30')][_0x7045('0x32')]?_0x4854ba[_0x7045('0x30')]:_0xe2732[_0x7045('0x31')];if(_0x29d6c5['query'][_0x7045('0x42')]){_0x4854ba[_0x7045('0x3c')]=[{'all':!![]}];}_0x4854ba=_['merge']({},_0x4854ba,_0x29d6c5[_0x7045('0x3a')]);return db[_0x7045('0x2a')][_0x7045('0x43')](_0x4854ba)['then'](handleEntityNotFound(_0x35cdc2,null))['then'](respondWithResult(_0x35cdc2,null))[_0x7045('0x1c')](handleError(_0x35cdc2,null));};exports[_0x7045('0x22')]=function(_0x1612f9,_0xccb330){if(_0x1612f9[_0x7045('0x44')]['id']){delete _0x1612f9[_0x7045('0x44')]['id'];}return db[_0x7045('0x2a')]['find']({'where':{'id':_0x1612f9[_0x7045('0x3f')]['id']}})[_0x7045('0x13')](handleEntityNotFound(_0xccb330,null))['then'](saveUpdates(_0x1612f9['body'],null))[_0x7045('0x13')](respondWithResult(_0xccb330,null))['catch'](handleError(_0xccb330,null));};exports[_0x7045('0x45')]=function(_0x3506e7,_0x615c26){return db[_0x7045('0x2a')][_0x7045('0x43')]({'where':{'id':_0x3506e7['params']['id']}})['then'](handleEntityNotFound(_0x615c26,null))['then'](removeEntity(_0x615c26,null))[_0x7045('0x1c')](handleError(_0x615c26,null));};exports[_0x7045('0x46')]=function(_0x268aac,_0x131270){return db['MailMessage'][_0x7045('0x46')]()[_0x7045('0x13')](respondWithResult(_0x131270,null))[_0x7045('0x1c')](handleError(_0x131270,null));};exports[_0x7045('0x47')]=function(_0xdc767f,_0x4f92d5){return db[_0x7045('0x2a')][_0x7045('0x47')](_0xdc767f[_0x7045('0x44')])['then'](function(_0x4d6a4a){if(_0x4d6a4a){if(_0x4d6a4a[_0x7045('0x48')]===_0x7045('0x49')&&!_0x4d6a4a[_0x7045('0x4a')]){var _0x3a2c3a,_0xec13b6,_0x30232c;if(_0xdc767f[_0x7045('0x44')]['to']){_0xec13b6=_0xdc767f['body']['to'][_0x7045('0x4b')](',')[0x0];}return db[_0x7045('0x4c')]['findOne']({'where':{'id':_0x4d6a4a[_0x7045('0x4d')]},'include':[{'model':db[_0x7045('0x4e')],'as':_0x7045('0x4f'),'include':[{'model':db['CmContact'],'as':_0x7045('0x50'),'where':{'email':_0xec13b6},'limit':0x1,'order':[[_0x7045('0x51'),_0x7045('0x52')]]}]},{'model':db['MailServerOut'],'as':_0x7045('0x53'),'raw':!![]}]})[_0x7045('0x13')](function(_0x536695){_0x3a2c3a=_0x536695;if(_0x3a2c3a&&_0x3a2c3a[_0x7045('0x53')]){var _0x47d512={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x3a2c3a[_0x7045('0x53')][_0x7045('0x54')])){_0x47d512[_0x7045('0x55')]=_0x3a2c3a[_0x7045('0x53')]['host'];_0x47d512[_0x7045('0x56')]=_0x3a2c3a[_0x7045('0x53')][_0x7045('0x56')];_0x47d512[_0x7045('0x57')]=_0x3a2c3a[_0x7045('0x53')]['secure'];if(_0x3a2c3a['Smtp'][_0x7045('0x58')]){_0x47d512[_0x7045('0x59')]={'user':_0x3a2c3a[_0x7045('0x53')][_0x7045('0x5a')],'pass':_0x3a2c3a[_0x7045('0x53')][_0x7045('0x5b')]};}}else{_0x47d512[_0x7045('0x54')]=_0x3a2c3a['Smtp'][_0x7045('0x54')];_0x47d512[_0x7045('0x59')]={'user':_0x3a2c3a[_0x7045('0x53')][_0x7045('0x5a')],'pass':_0x3a2c3a[_0x7045('0x53')][_0x7045('0x5b')]};_0x47d512[_0x7045('0x57')]=_0x3a2c3a[_0x7045('0x53')][_0x7045('0x57')];}if(_0xdc767f['body'][_0x7045('0x5c')]&&_0xdc767f[_0x7045('0x44')][_0x7045('0x5c')][_0x7045('0x32')]){for(var _0x38eb1c=0x0;_0x38eb1c<_0xdc767f[_0x7045('0x44')][_0x7045('0x5c')][_0x7045('0x32')];_0x38eb1c+=0x1){_0xdc767f[_0x7045('0x44')][_0x7045('0x5c')][_0x38eb1c]={'filename':_0xdc767f[_0x7045('0x44')][_0x7045('0x5c')][_0x38eb1c][_0x7045('0x26')],'path':path[_0x7045('0x5d')](config['root'],_0x7045('0x5e'),_0xdc767f['body'][_0x7045('0x5c')][_0x38eb1c][_0x7045('0x5f')])};}}_0x30232c={'account':_0x47d512,'message':_0xdc767f[_0x7045('0x44')]};return;}})[_0x7045('0x13')](function(){if(_0x3a2c3a['List']){if(_0x3a2c3a[_0x7045('0x4f')][_0x7045('0x50')][_0x7045('0x32')]){return _0x3a2c3a['List'][_0x7045('0x50')][0x0];}else{return db['CmContact'][_0x7045('0x47')](_[_0x7045('0xb')](_0xdc767f[_0x7045('0x44')],{'firstName':_0xdc767f['body']['to'],'email':_0xdc767f[_0x7045('0x44')]['to'],'phone':_0xdc767f[_0x7045('0x44')]['to'],'ListId':_0x3a2c3a[_0x7045('0x60')]}));}}else{throw new Error(_0x7045('0x61'));}})[_0x7045('0x13')](function(){if(_0x30232c){return respondWithRpcPromise(_0x7045('0x62'),_0x7045('0x63'),_0x30232c,client9003)[_0x7045('0x13')](function(_0x426e4a){return _0x4d6a4a['update']({'read':!![],'messageId':_0x426e4a[_0x7045('0x64')],'sentAt':moment()[_0x7045('0x65')](_0x7045('0x66'))});})[_0x7045('0x1c')](function(_0x3abe54){logger[_0x7045('0x18')]('%s',JSON[_0x7045('0x67')](_0x3abe54));return _0x4d6a4a;});}return _0x4d6a4a;});}return _0x4d6a4a;}})[_0x7045('0x13')](respondWithResult(_0x4f92d5,0xc9))[_0x7045('0x1c')](handleError(_0x4f92d5,null));};exports[_0x7045('0x68')]=function(_0x410840,_0x141fda){var _0x41376d={'agent':{},'channel':_0x7045('0x69')};if(_0x410840[_0x7045('0x44')]['id']){delete _0x410840[_0x7045('0x44')]['id'];}_0x410840[_0x7045('0x44')][_0x7045('0x6a')]=!![];_0x410840[_0x7045('0x44')][_0x7045('0x6b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x410840[_0x7045('0x44')]['UserId']=_0x410840[_0x7045('0x44')]['UserId']||_0x410840[_0x7045('0x5a')]['id'];_0x41376d[_0x7045('0x6c')]['id']=_0x410840[_0x7045('0x44')]['UserId'];return db[_0x7045('0x2a')]['find']({'where':{'id':_0x410840[_0x7045('0x3f')]['id'],'UserId':null}})[_0x7045('0x13')](handleEntityNotFound(_0x141fda,null))[_0x7045('0x13')](saveUpdates(_0x410840[_0x7045('0x44')],null))[_0x7045('0x13')](function(_0x40ea97){if(_0x40ea97){_0x41376d[_0x7045('0x1a')]=_0x40ea97[_0x7045('0x6d')]({'plain':!![]});return db[_0x7045('0x6e')][_0x7045('0x43')]({'where':{'id':_0x40ea97['MailInteractionId']}});}return null;})[_0x7045('0x13')](handleEntityNotFound(_0x141fda,null))[_0x7045('0x13')](function(_0xcec81e){if(_0xcec81e){return _0xcec81e[_0x7045('0x22')]({'UserId':_0x410840['body']['UserId'],'read1stAt':_['isNil'](_0xcec81e[_0x7045('0x6f')])?moment()[_0x7045('0x65')](_0x7045('0x66')):undefined});}return null;})[_0x7045('0x13')](function(_0x4eeb5a){if(_0x4eeb5a){_0x41376d[_0x7045('0x70')]=_0x4eeb5a[_0x7045('0x6d')]({'plain':!![]});interaction_log[_0x7045('0x14')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x410840['user']['id'],_0x410840[_0x7045('0x5a')][_0x7045('0x26')],_0x410840['user'][_0x7045('0x71')],_0x41376d[_0x7045('0x70')]['id'],_0x410840[_0x7045('0x44')]?JSON['stringify'](_0x410840['body']):_0x7045('0x72'));return respondWithRpcPromise('AcceptMessage',_0x7045('0x73'),_0x41376d);}return null;})[_0x7045('0x13')](function(_0x1d388a){var _0x3787f1='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1d388a[_0x7045('0x1a')]['ContactId'];return db[_0x7045('0x74')][_0x7045('0x2e')](_0x3787f1,{'type':db[_0x7045('0x75')][_0x7045('0x76')][_0x7045('0x77')],'raw':!![]})[_0x7045('0x13')](function(_0x3cf815){return _0x3cf815;});})['then'](function(_0x465337){if(_0x465337){_0x41376d[_0x7045('0x1a')][_0x7045('0x78')]=_0x465337[0x0];if(!_0x410840[_0x7045('0x44')][_0x7045('0x79')])return;return db[_0x7045('0x7a')][_0x7045('0x43')]({'where':{'id':_0x410840[_0x7045('0x44')][_0x7045('0x79')],'role':_0x7045('0x6c')},'attributes':['id','name','fullname',_0x7045('0x7b'),_0x7045('0x7c')],'raw':!![]});}return null;})[_0x7045('0x13')](function(_0x2ac662){if(!_0x2ac662)return null;_0x41376d[_0x7045('0x1a')][_0x7045('0x6c')]=_0x2ac662;return _0x41376d;})[_0x7045('0x13')](function(_0x1b30fb){if(_0x1b30fb){if(_0x410840[_0x7045('0x44')][_0x7045('0x7d')]){_0x41376d['message']['interface']=util[_0x7045('0x65')](_0x7045('0x7e'),_0x410840['user']['name']);_0x41376d['message'][_0x7045('0x7f')]=_0x41376d[_0x7045('0x7f')];_0x41376d[_0x7045('0x1a')]['motionChannel']=_0x41376d[_0x7045('0x7f')];_0x41376d[_0x7045('0x1a')]['event']='accept';_0x41376d[_0x7045('0x1a')][_0x7045('0x44')]=htmlToText['fromString'](_0x41376d[_0x7045('0x1a')][_0x7045('0x44')]);return respondWithRpcPromise('EventManager',_0x7045('0x80'),{'event':_0x7045('0x81'),'message':_0x41376d['message']},client9002)[_0x7045('0x13')](function(){return _0x41376d;});}return _0x41376d;}return null;})[_0x7045('0x13')](respondWithResult(_0x141fda,null))[_0x7045('0x1c')](handleError(_0x141fda,null));};exports[_0x7045('0x82')]=function(_0x2b8500,_0x4522e6){var _0x10b113={'agent':{},'channel':_0x7045('0x69')};if(_0x2b8500[_0x7045('0x44')]['id']){delete _0x2b8500[_0x7045('0x44')]['id'];}_0x2b8500[_0x7045('0x44')][_0x7045('0x79')]=_0x2b8500[_0x7045('0x44')][_0x7045('0x79')]||_0x2b8500[_0x7045('0x5a')]['id'];_0x10b113[_0x7045('0x6c')]['id']=_0x2b8500[_0x7045('0x44')]['UserId'];return db[_0x7045('0x2a')][_0x7045('0x43')]({'where':{'id':_0x2b8500[_0x7045('0x3f')]['id'],'UserId':null}})[_0x7045('0x13')](handleEntityNotFound(_0x4522e6,null))[_0x7045('0x13')](function(_0x360848){if(_0x360848){_0x10b113[_0x7045('0x1a')]=_0x360848[_0x7045('0x6d')]({'plain':!![]});return db[_0x7045('0x6e')][_0x7045('0x43')]({'where':{'id':_0x360848[_0x7045('0x83')]}});}return null;})[_0x7045('0x13')](handleEntityNotFound(_0x4522e6,null))['then'](function(_0xe65bc6){if(_0xe65bc6){_0x10b113[_0x7045('0x70')]=_0xe65bc6['get']({'plain':!![]});interaction_log[_0x7045('0x14')](_0x7045('0x84'),_0x2b8500[_0x7045('0x5a')]['id'],_0x2b8500[_0x7045('0x5a')]['name'],_0x2b8500[_0x7045('0x5a')][_0x7045('0x71')],_0x10b113['interaction']['id'],_0x2b8500[_0x7045('0x44')]?JSON[_0x7045('0x67')](_0x2b8500[_0x7045('0x44')]):'null');return respondWithRpcPromise(_0x7045('0x85'),'rejectMessage',_0x10b113);}return null;})[_0x7045('0x13')](function(_0x5634c4){var _0x7fd530=_0x7045('0x86')+_0x5634c4[_0x7045('0x1a')][_0x7045('0x87')];return db[_0x7045('0x74')]['query'](_0x7fd530,{'type':db[_0x7045('0x75')][_0x7045('0x76')][_0x7045('0x77')],'raw':!![]})['then'](function(_0x2d49d3){return _0x2d49d3;});})['then'](function(_0x4ec12b){if(_0x4ec12b){_0x10b113['message'][_0x7045('0x78')]=_0x4ec12b[0x0];if(!_0x2b8500['body']['UserId'])return;return db['User'][_0x7045('0x43')]({'where':{'id':_0x2b8500['body'][_0x7045('0x79')],'role':_0x7045('0x6c')},'attributes':['id',_0x7045('0x26'),_0x7045('0x88'),_0x7045('0x7b'),'internal'],'raw':!![]});}return null;})[_0x7045('0x13')](function(_0x18cb0e){if(!_0x18cb0e)return null;_0x10b113['message'][_0x7045('0x6c')]=_0x18cb0e;return _0x10b113;})['then'](function(_0x2a8dbf){if(_0x2a8dbf){_0x2a8dbf[_0x7045('0x1a')][_0x7045('0x89')]=util[_0x7045('0x65')]('SIP/%s',_0x2b8500[_0x7045('0x5a')][_0x7045('0x26')]);_0x2a8dbf['message']['channel']=_0x10b113['channel'];_0x2a8dbf[_0x7045('0x1a')][_0x7045('0x8a')]=_0x10b113[_0x7045('0x7f')];_0x2a8dbf[_0x7045('0x1a')]['event']='reject';_0x2a8dbf[_0x7045('0x1a')][_0x7045('0x44')]=htmlToText[_0x7045('0x8b')](_0x10b113[_0x7045('0x1a')][_0x7045('0x44')]);respondWithRpcPromise(_0x7045('0x80'),'EventManager',{'event':_0x7045('0x8c'),'message':_0x2a8dbf[_0x7045('0x1a')]},client9002);return _0x10b113;}return null;})[_0x7045('0x13')](respondWithResult(_0x4522e6,null))[_0x7045('0x1c')](handleError(_0x4522e6,null));};exports['download']=function(_0x51802c,_0x8b312c){var _0x494b8f=moment()[_0x7045('0x8d')]()[_0x7045('0x8e')]();var _0x45d9a8=path[_0x7045('0x5d')](config[_0x7045('0x8f')],_0x7045('0x90'),_0x7045('0x91'),_0x7045('0x92'));var _0x50bba8=path['join'](config[_0x7045('0x8f')],_0x7045('0x90'),_0x7045('0x91'),_0x7045('0x5c'));var _0x5f1dab=util[_0x7045('0x65')](_0x7045('0x93'),_0x494b8f);return db[_0x7045('0x2a')]['find']({'where':{'id':_0x51802c['params']['id']},'attributes':['id',_0x7045('0x44'),_0x7045('0x94'),'to','cc',_0x7045('0x95'),_0x7045('0x96'),_0x7045('0x97')],'include':_0x51802c[_0x7045('0x2e')][_0x7045('0x5c')]?[{'model':db['Attachment'],'as':_0x7045('0x98')}]:undefined})[_0x7045('0x13')](handleEntityNotFound(_0x8b312c,null))[_0x7045('0x13')](function(_0x3833f2){if(_0x3833f2){var _0x8987a8=_0x3833f2;var _0x4e26c2={'from':_0x8987a8['from'],'to':_0x8987a8['to'],'subject':_0x8987a8[_0x7045('0x96')],'html':htmlEntities['decode'](_0x8987a8[_0x7045('0x44')]),'headers':{'Date':moment(_0x8987a8['createdAt'])[_0x7045('0x65')](_0x7045('0x99'))},'attachments':[]};if(_0x3833f2['cc']){_0x4e26c2[_0x7045('0x9a')]['Cc']=_0x3833f2['cc'];}if(_0x3833f2['bcc']){_0x4e26c2[_0x7045('0x9a')]['Bcc']=_0x3833f2[_0x7045('0x95')];}return new BPromise(function(_0x4addf8,_0x7fdd05){if(_0x3833f2[_0x7045('0x98')]){for(var _0x34a436=0x0;_0x34a436<_0x3833f2[_0x7045('0x98')]['length'];_0x34a436++){var _0x3b6b1b=_0x3833f2['Attachments'][_0x34a436];var _0x4d2e6d=path['join'](_0x50bba8,_0x3b6b1b[_0x7045('0x5f')]);if(fs[_0x7045('0x9b')](_0x4d2e6d)){_0x4e26c2[_0x7045('0x5c')][_0x7045('0x9c')]({'name':_0x3b6b1b['name'],'contentType':_0x3b6b1b[_0x7045('0x2d')],'data':fs['readFileSync'](_0x4d2e6d)});}}}emlformat[_0x7045('0x9d')](_0x4e26c2,function(_0xf424ca,_0xf42c63){if(_0xf424ca)return _0x7fdd05(_0xf424ca);fs[_0x7045('0x9e')](path['join'](_0x45d9a8,_0x5f1dab),_0xf42c63);return _0x4addf8(_0xf42c63);});});}})['then'](function(_0x284061){if(_0x284061){return _0x8b312c[_0x7045('0x9f')](path[_0x7045('0x5d')](_0x45d9a8,_0x5f1dab),_0x5f1dab,function(_0x3896b8){if(!_0x3896b8)fs[_0x7045('0xa0')](path[_0x7045('0x5d')](_0x45d9a8,_0x5f1dab));});}})['catch'](handleError(_0x8b312c,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 9941d94..6bdfe6f 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 _0x9d0d=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage'];(function(_0x10aebb,_0x2fd10a){var _0x1b1b8f=function(_0x1161be){while(--_0x1161be){_0x10aebb['push'](_0x10aebb['shift']());}};_0x1b1b8f(++_0x2fd10a);}(_0x9d0d,0xd9));var _0xd9d0=function(_0x3fa11d,_0x28151e){_0x3fa11d=_0x3fa11d-0x0;var _0x3ea488=_0x9d0d[_0x3fa11d];return _0x3ea488;};'use strict';var EventEmitter=require(_0xd9d0('0x0'));var MailMessage=require(_0xd9d0('0x1'))['db'][_0xd9d0('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xd9d0('0x3')](0x0);var events={'afterCreate':_0xd9d0('0x4'),'afterUpdate':_0xd9d0('0x5'),'afterDestroy':_0xd9d0('0x6')};function emitEvent(_0xd12ae6){return function(_0x2c0d54,_0x2e8dc7,_0x27b44a){MailMessageEvents[_0xd9d0('0x7')](_0xd12ae6+':'+_0x2c0d54['id'],_0x2c0d54);MailMessageEvents['emit'](_0xd12ae6,_0x2c0d54);_0x27b44a(null);};}for(var e in events){if(events[_0xd9d0('0x8')](e)){var event=events[e];MailMessage[_0xd9d0('0x9')](e,emitEvent(event));}}module[_0xd9d0('0xa')]=MailMessageEvents; \ No newline at end of file +var _0xd5d1=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x45616c,_0x21b432){var _0x3ae416=function(_0x1b4973){while(--_0x1b4973){_0x45616c['push'](_0x45616c['shift']());}};_0x3ae416(++_0x21b432);}(_0xd5d1,0x7e));var _0x1d5d=function(_0x29d8fc,_0x4c4887){_0x29d8fc=_0x29d8fc-0x0;var _0x352a07=_0xd5d1[_0x29d8fc];return _0x352a07;};'use strict';var EventEmitter=require(_0x1d5d('0x0'));var MailMessage=require(_0x1d5d('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1d5d('0x2'),'afterUpdate':_0x1d5d('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4cedd3){return function(_0x2c85c8,_0x291433,_0x1b5c3c){MailMessageEvents[_0x1d5d('0x4')](_0x4cedd3+':'+_0x2c85c8['id'],_0x2c85c8);MailMessageEvents[_0x1d5d('0x4')](_0x4cedd3,_0x2c85c8);_0x1b5c3c(null);};}for(var e in events){if(events[_0x1d5d('0x5')](e)){var event=events[e];MailMessage[_0x1d5d('0x6')](e,emitEvent(event));}}module[_0x1d5d('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index f769ed4..1a0663f 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 _0x896a=['messageId','fti_mail_messages','plainBody','FULLTEXT','body','fromString','models','direction','toLowerCase','secret','isNil','MailInteraction','findOne','MailInteractionId','update','createdAt','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','html-to-text','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages'];(function(_0x3672ef,_0x3ad383){var _0x452250=function(_0x1aab52){while(--_0x1aab52){_0x3672ef['push'](_0x3672ef['shift']());}};_0x452250(++_0x3ad383);}(_0x896a,0x120));var _0xa896=function(_0x18d0d8,_0x53d78e){_0x18d0d8=_0x18d0d8-0x0;var _0x22c127=_0x896a[_0x18d0d8];return _0x22c127;};'use strict';var _=require(_0xa896('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa896('0x1'));var moment=require(_0xa896('0x2'));var BPromise=require(_0xa896('0x3'));var rp=require(_0xa896('0x4'));var htmlToText=require(_0xa896('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa896('0x6'));var attributes=require(_0xa896('0x7'));module[_0xa896('0x8')]=function(_0x42e61a,_0x162d09){return _0x42e61a[_0xa896('0x9')](_0xa896('0xa'),attributes,{'tableName':_0xa896('0xb'),'paranoid':![],'indexes':[{'name':_0xa896('0xc'),'fields':[_0xa896('0xc')]},{'name':_0xa896('0xd'),'fields':[_0xa896('0xe'),'subject'],'type':_0xa896('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2c3af5,_0xba4dd,_0x26b164){if(_0x2c3af5[_0xa896('0x10')]){_0x2c3af5[_0xa896('0xe')]=htmlToText[_0xa896('0x11')](_0x2c3af5[_0xa896('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x26b164(null,_0xba4dd);},'afterCreate':function(_0x45d622,_0x467a3d,_0x145513){var _0x37c6ea=_0x42e61a[_0xa896('0x12')];var _0x121619=_0x45d622['get']({'plain':!![]});if(_0x121619[_0xa896('0x13')][_0xa896('0x14')]()==='in'||_0x121619[_0xa896('0x13')]['toLowerCase']()==='out'&&!_0x121619[_0xa896('0x15')]&&!_[_0xa896('0x16')](_0x121619['UserId'])){_0x37c6ea[_0xa896('0x17')][_0xa896('0x18')]({'where':{'id':_0x121619[_0xa896('0x19')]}})['then'](function(_0xf0ac3e){if(_0xf0ac3e){_0xf0ac3e[_0xa896('0x1a')]({'lastMsgAt':_0x121619[_0xa896('0x1b')],'lastMsgDirection':_0x121619[_0xa896('0x13')][_0xa896('0x14')]()});}})['catch'](function(_0x53f384){console['error'](_0x53f384);});}_0x145513();}},'charset':_0xa896('0x1c'),'collate':_0xa896('0x1d')});}; \ No newline at end of file +var _0x6e19=['subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','isNil','UserId','findOne','then','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages'];(function(_0x21aca3,_0x5b6ecf){var _0x3d68d4=function(_0x10523b){while(--_0x10523b){_0x21aca3['push'](_0x21aca3['shift']());}};_0x3d68d4(++_0x5b6ecf);}(_0x6e19,0x165));var _0x96e1=function(_0x300a85,_0x11f8cf){_0x300a85=_0x300a85-0x0;var _0x4fda6e=_0x6e19[_0x300a85];return _0x4fda6e;};'use strict';var _=require(_0x96e1('0x0'));var util=require(_0x96e1('0x1'));var logger=require(_0x96e1('0x2'))(_0x96e1('0x3'));var moment=require('moment');var BPromise=require(_0x96e1('0x4'));var rp=require(_0x96e1('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x96e1('0x6'));var rimraf=require(_0x96e1('0x7'));var config=require(_0x96e1('0x8'));var attributes=require('./mailMessage.attributes');module[_0x96e1('0x9')]=function(_0x223ad0,_0x30a604){return _0x223ad0[_0x96e1('0xa')](_0x96e1('0xb'),attributes,{'tableName':_0x96e1('0xc'),'paranoid':![],'indexes':[{'name':_0x96e1('0xd'),'fields':['messageId']},{'name':_0x96e1('0xe'),'fields':['plainBody',_0x96e1('0xf')],'type':_0x96e1('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x24477f,_0x4e4427,_0x396dec){if(_0x24477f[_0x96e1('0x11')]){_0x24477f['plainBody']=htmlToText[_0x96e1('0x12')](_0x24477f[_0x96e1('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x396dec(null,_0x4e4427);},'afterCreate':function(_0x13c867,_0x159c2c,_0x1822ff){var _0x3de7ca=_0x223ad0[_0x96e1('0x13')];var _0x40eb68=_0x13c867[_0x96e1('0x14')]({'plain':!![]});if(_0x40eb68[_0x96e1('0x15')][_0x96e1('0x16')]()==='in'||_0x40eb68[_0x96e1('0x15')][_0x96e1('0x16')]()==='out'&&!_0x40eb68['secret']&&!_[_0x96e1('0x17')](_0x40eb68[_0x96e1('0x18')])){_0x3de7ca['MailInteraction'][_0x96e1('0x19')]({'where':{'id':_0x40eb68['MailInteractionId']}})[_0x96e1('0x1a')](function(_0x5858fb){if(_0x5858fb){_0x5858fb['update']({'lastMsgAt':_0x40eb68[_0x96e1('0x1b')],'lastMsgDirection':_0x40eb68[_0x96e1('0x15')][_0x96e1('0x16')]()});}})['catch'](function(_0x5a8c44){console[_0x96e1('0x1c')](_0x5a8c44);});}_0x1822ff();}},'charset':_0x96e1('0x1d'),'collate':_0x96e1('0x1e')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index fd8ceb3..5ac7d8c 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 _0xab40=['raw','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','register','request','then','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateMailMessage','MailMessage','create','options'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xab40,0xcd));var _0x0ab4=function(_0x33ad9a,_0x199f58){_0x33ad9a=_0x33ad9a-0x0;var _0x3bdb79=_0xab40[_0x33ad9a];return _0x3bdb79;};'use strict';var _=require(_0x0ab4('0x0'));var util=require(_0x0ab4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ab4('0x2'));var db=require(_0x0ab4('0x3'))['db'];var utils=require(_0x0ab4('0x4'));var logger=require(_0x0ab4('0x5'))(_0x0ab4('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0ab4('0x7')]['http']({'port':0x232a});config[_0x0ab4('0x8')]=_[_0x0ab4('0x9')](config[_0x0ab4('0x8')],{'host':_0x0ab4('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailMessage.socket')[_0x0ab4('0xb')](socket);function respondWithRpcPromise(_0x30e726,_0x40e4d1,_0x464f7e){return new BPromise(function(_0x413d9b,_0x24c6c1){return client[_0x0ab4('0xc')](_0x30e726,_0x464f7e)[_0x0ab4('0xd')](function(_0x4e1708){logger['info'](_0x0ab4('0xe'),_0x40e4d1,'request\x20sent');logger[_0x0ab4('0xf')](_0x0ab4('0x10'),_0x40e4d1,_0x0ab4('0x11'),JSON[_0x0ab4('0x12')](_0x4e1708));if(_0x4e1708[_0x0ab4('0x13')]){if(_0x4e1708[_0x0ab4('0x13')][_0x0ab4('0x14')]===0x1f4){logger[_0x0ab4('0x13')](_0x0ab4('0xe'),_0x40e4d1,_0x4e1708[_0x0ab4('0x13')][_0x0ab4('0x15')]);return _0x24c6c1(_0x4e1708[_0x0ab4('0x13')][_0x0ab4('0x15')]);}logger[_0x0ab4('0x13')](_0x0ab4('0xe'),_0x40e4d1,_0x4e1708[_0x0ab4('0x13')][_0x0ab4('0x15')]);return _0x413d9b(_0x4e1708[_0x0ab4('0x13')]['message']);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x40e4d1,_0x0ab4('0x11'));_0x413d9b(_0x4e1708[_0x0ab4('0x16')][_0x0ab4('0x15')]);}})['catch'](function(_0x1e3fe2){logger[_0x0ab4('0x13')](_0x0ab4('0xe'),_0x40e4d1,_0x1e3fe2);_0x24c6c1(_0x1e3fe2);});});}exports[_0x0ab4('0x17')]=function(_0x4e7852){var _0x4ff836=this;return new Promise(function(_0xdb0797,_0x5b1ed5){return db[_0x0ab4('0x18')][_0x0ab4('0x19')](_0x4e7852['body'],{'raw':_0x4e7852[_0x0ab4('0x1a')]?_0x4e7852[_0x0ab4('0x1a')][_0x0ab4('0x1b')]===undefined?!![]:![]:!![]})[_0x0ab4('0xd')](function(_0x12d06d){logger['info']('CreateMailMessage',_0x4e7852);logger[_0x0ab4('0xf')](_0x0ab4('0x17'),_0x4e7852,JSON[_0x0ab4('0x12')](_0x12d06d));_0xdb0797(_0x12d06d);})[_0x0ab4('0x1c')](function(_0x4e4b80){logger[_0x0ab4('0x13')](_0x0ab4('0x17'),_0x4e4b80[_0x0ab4('0x15')],_0x4e7852);_0x5b1ed5(_0x4ff836['error'](0x1f4,_0x4e4b80['message']));});});}; \ No newline at end of file +var _0xef0f=['code','message','result','catch','CreateMailMessage','create','options','debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x20bbe5,_0x189723){var _0x1d94c7=function(_0x29c6b0){while(--_0x29c6b0){_0x20bbe5['push'](_0x20bbe5['shift']());}};_0x1d94c7(++_0x189723);}(_0xef0f,0x168));var _0xfef0=function(_0x1be3ed,_0x5a01ca){_0x1be3ed=_0x1be3ed-0x0;var _0x1fac22=_0xef0f[_0x1be3ed];return _0x1fac22;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var moment=require(_0xfef0('0x1'));var BPromise=require(_0xfef0('0x2'));var rs=require(_0xfef0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfef0('0x4'))['db'];var utils=require(_0xfef0('0x5'));var logger=require(_0xfef0('0x6'))('rpc');var config=require(_0xfef0('0x7'));var jayson=require(_0xfef0('0x8'));var client=jayson[_0xfef0('0x9')][_0xfef0('0xa')]({'port':0x232a});config[_0xfef0('0xb')]=_[_0xfef0('0xc')](config['redis'],{'host':_0xfef0('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfef0('0xb')]));require(_0xfef0('0xe'))[_0xfef0('0xf')](socket);function respondWithRpcPromise(_0x2d42dc,_0x334e74,_0x402dff){return new BPromise(function(_0xc177db,_0x4bd6f2){return client[_0xfef0('0x10')](_0x2d42dc,_0x402dff)[_0xfef0('0x11')](function(_0x410234){logger[_0xfef0('0x12')](_0xfef0('0x13'),_0x334e74,_0xfef0('0x14'));logger['debug'](_0xfef0('0x15'),_0x334e74,_0xfef0('0x14'),JSON[_0xfef0('0x16')](_0x410234));if(_0x410234[_0xfef0('0x17')]){if(_0x410234[_0xfef0('0x17')][_0xfef0('0x18')]===0x1f4){logger[_0xfef0('0x17')]('MailMessage,\x20%s,\x20%s',_0x334e74,_0x410234[_0xfef0('0x17')]['message']);return _0x4bd6f2(_0x410234['error']['message']);}logger[_0xfef0('0x17')](_0xfef0('0x13'),_0x334e74,_0x410234[_0xfef0('0x17')][_0xfef0('0x19')]);return _0xc177db(_0x410234[_0xfef0('0x17')][_0xfef0('0x19')]);}else{logger[_0xfef0('0x12')](_0xfef0('0x13'),_0x334e74,'request\x20sent');_0xc177db(_0x410234[_0xfef0('0x1a')][_0xfef0('0x19')]);}})[_0xfef0('0x1b')](function(_0x39f9d3){logger[_0xfef0('0x17')]('MailMessage,\x20%s,\x20%s',_0x334e74,_0x39f9d3);_0x4bd6f2(_0x39f9d3);});});}exports[_0xfef0('0x1c')]=function(_0x4e24de){var _0x20826b=this;return new Promise(function(_0x1a0aa0,_0x28dee1){return db['MailMessage'][_0xfef0('0x1d')](_0x4e24de['body'],{'raw':_0x4e24de[_0xfef0('0x1e')]?_0x4e24de[_0xfef0('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4b8b22){logger[_0xfef0('0x12')]('CreateMailMessage',_0x4e24de);logger[_0xfef0('0x1f')](_0xfef0('0x1c'),_0x4e24de,JSON[_0xfef0('0x16')](_0x4b8b22));_0x1a0aa0(_0x4b8b22);})[_0xfef0('0x1b')](function(_0x249fe4){logger[_0xfef0('0x17')]('CreateMailMessage',_0x249fe4['message'],_0x4e24de);_0x28dee1(_0x20826b[_0xfef0('0x17')](0x1f4,_0x249fe4[_0xfef0('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 4131d51..fff8def 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 _0xf280=['register','length','mailMessage:','./mailMessage.events','remove','update','emit','removeListener'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0xf280,0x113));var _0x0f28=function(_0x10f68e,_0xf198ea){_0x10f68e=_0x10f68e-0x0;var _0x4c8372=_0xf280[_0x10f68e];return _0x4c8372;};'use strict';var MailMessageEvents=require(_0x0f28('0x0'));var events=['save',_0x0f28('0x1'),_0x0f28('0x2')];function createListener(_0x465261,_0x241ab4){return function(_0x1f2db7){_0x241ab4[_0x0f28('0x3')](_0x465261,_0x1f2db7);};}function removeListener(_0x4e2fcd,_0x31c693){return function(){MailMessageEvents[_0x0f28('0x4')](_0x4e2fcd,_0x31c693);};}exports[_0x0f28('0x5')]=function(_0x35784){for(var _0xfd95c3=0x0,_0x33ca6a=events[_0x0f28('0x6')];_0xfd95c3<_0x33ca6a;_0xfd95c3++){var _0x3d0bab=events[_0xfd95c3];var _0x1c9263=createListener(_0x0f28('0x7')+_0x3d0bab,_0x35784);MailMessageEvents['on'](_0x3d0bab,_0x1c9263);}}; \ No newline at end of file +var _0x62ec=['register','mailMessage:','save','update','emit'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x62ec,0xca));var _0xc62e=function(_0x32792f,_0x169145){_0x32792f=_0x32792f-0x0;var _0xda292a=_0x62ec[_0x32792f];return _0xda292a;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xc62e('0x0'),'remove',_0xc62e('0x1')];function createListener(_0x11b275,_0x456f7d){return function(_0x3d07ef){_0x456f7d[_0xc62e('0x2')](_0x11b275,_0x3d07ef);};}function removeListener(_0x2d9670,_0x4323b1){return function(){MailMessageEvents['removeListener'](_0x2d9670,_0x4323b1);};}exports[_0xc62e('0x3')]=function(_0x3a018c){for(var _0xd328df=0x0,_0x532369=events['length'];_0xd328df<_0x532369;_0xd328df++){var _0x4bf1de=events[_0xd328df];var _0x1c3e85=createListener(_0xc62e('0x4')+_0x4bf1de,_0x3a018c);MailMessageEvents['on'](_0x4bf1de,_0x1c3e85);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 38519bd..ee02a37 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 _0xd398=['exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','destroy','/:id/teams','removeTeams','removeAgents'];(function(_0x446f77,_0x349cfc){var _0x1aef39=function(_0x195f4f){while(--_0x195f4f){_0x446f77['push'](_0x446f77['shift']());}};_0x1aef39(++_0x349cfc);}(_0xd398,0x187));var _0x8d39=function(_0x3e4b95,_0x5bd35a){_0x3e4b95=_0x3e4b95-0x0;var _0x4108af=_0xd398[_0x3e4b95];return _0x4108af;};'use strict';var multer=require(_0x8d39('0x0'));var util=require(_0x8d39('0x1'));var path=require('path');var timeout=require(_0x8d39('0x2'));var express=require(_0x8d39('0x3'));var router=express['Router']();var fs_extra=require(_0x8d39('0x4'));var auth=require(_0x8d39('0x5'));var interaction=require(_0x8d39('0x6'));var config=require(_0x8d39('0x7'));var controller=require(_0x8d39('0x8'));router[_0x8d39('0x9')]('/',auth[_0x8d39('0xa')](),controller[_0x8d39('0xb')]);router[_0x8d39('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x8d39('0xc')]);router[_0x8d39('0x9')](_0x8d39('0xd'),auth[_0x8d39('0xa')](),controller['show']);router[_0x8d39('0x9')](_0x8d39('0xe'),auth['isAuthenticated'](),controller[_0x8d39('0xf')]);router[_0x8d39('0x9')]('/:id/teams',auth[_0x8d39('0xa')](),controller[_0x8d39('0x10')]);router[_0x8d39('0x9')](_0x8d39('0x11'),auth['isAuthenticated'](),controller[_0x8d39('0x12')]);router[_0x8d39('0x13')]('/',auth[_0x8d39('0xa')](),controller[_0x8d39('0x14')]);router[_0x8d39('0x13')]('/:id/teams',auth[_0x8d39('0xa')](),controller[_0x8d39('0x15')]);router['post'](_0x8d39('0x11'),auth[_0x8d39('0xa')](),controller[_0x8d39('0x16')]);router['put']('/:id',auth[_0x8d39('0xa')](),controller[_0x8d39('0x17')]);router[_0x8d39('0x18')]('/:id',auth[_0x8d39('0xa')](),controller[_0x8d39('0x19')]);router[_0x8d39('0x18')](_0x8d39('0x1a'),auth[_0x8d39('0xa')](),controller[_0x8d39('0x1b')]);router['delete'](_0x8d39('0x11'),auth[_0x8d39('0xa')](),controller[_0x8d39('0x1c')]);module[_0x8d39('0x1d')]=router; \ No newline at end of file +var _0x488c=['put','update','destroy','delete','removeAgents','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x488c,0x10b));var _0xc488=function(_0x4ca536,_0x57c8de){_0x4ca536=_0x4ca536-0x0;var _0x3bd35f=_0x488c[_0x4ca536];return _0x3bd35f;};'use strict';var multer=require('multer');var util=require(_0xc488('0x0'));var path=require('path');var timeout=require(_0xc488('0x1'));var express=require(_0xc488('0x2'));var router=express['Router']();var fs_extra=require(_0xc488('0x3'));var auth=require(_0xc488('0x4'));var interaction=require(_0xc488('0x5'));var config=require(_0xc488('0x6'));var controller=require(_0xc488('0x7'));router[_0xc488('0x8')]('/',auth[_0xc488('0x9')](),controller[_0xc488('0xa')]);router[_0xc488('0x8')](_0xc488('0xb'),auth[_0xc488('0x9')](),controller[_0xc488('0xc')]);router[_0xc488('0x8')](_0xc488('0xd'),auth['isAuthenticated'](),controller[_0xc488('0xe')]);router['get'](_0xc488('0xf'),auth[_0xc488('0x9')](),controller['getMembers']);router[_0xc488('0x8')](_0xc488('0x10'),auth[_0xc488('0x9')](),controller[_0xc488('0x11')]);router['get'](_0xc488('0x12'),auth['isAuthenticated'](),controller[_0xc488('0x13')]);router[_0xc488('0x14')]('/',auth[_0xc488('0x9')](),controller['create']);router[_0xc488('0x14')]('/:id/teams',auth[_0xc488('0x9')](),controller[_0xc488('0x15')]);router[_0xc488('0x14')](_0xc488('0x12'),auth['isAuthenticated'](),controller[_0xc488('0x16')]);router[_0xc488('0x17')](_0xc488('0xd'),auth[_0xc488('0x9')](),controller[_0xc488('0x18')]);router['delete']('/:id',auth[_0xc488('0x9')](),controller[_0xc488('0x19')]);router[_0xc488('0x1a')](_0xc488('0x10'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xc488('0x1a')](_0xc488('0x12'),auth[_0xc488('0x9')](),controller[_0xc488('0x1b')]);module[_0xc488('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 7a92cf2..2162f39 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 _0x99d5=['exports','STRING','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x158da6,_0x3cb06d){var _0x429c30=function(_0x2d5895){while(--_0x2d5895){_0x158da6['push'](_0x158da6['shift']());}};_0x429c30(++_0x3cb06d);}(_0x99d5,0x125));var _0x599d=function(_0x16c06e,_0x4a4a06){_0x16c06e=_0x16c06e-0x0;var _0x3ce423=_0x99d5[_0x16c06e];return _0x3ce423;};'use strict';var Sequelize=require(_0x599d('0x0'));module[_0x599d('0x1')]={'name':{'type':Sequelize[_0x599d('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x599d('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x599d('0x3')](_0x599d('0x4'),'beepall',_0x599d('0x5'))}}; \ No newline at end of file +var _0xa66f=['INTEGER','ENUM','beepall','roundrobin','exports','STRING','name'];(function(_0x221368,_0x2e2d94){var _0x11da3a=function(_0x5230f2){while(--_0x5230f2){_0x221368['push'](_0x221368['shift']());}};_0x11da3a(++_0x2e2d94);}(_0xa66f,0xba));var _0xfa66=function(_0xb5f333,_0x56a59c){_0xb5f333=_0xb5f333-0x0;var _0x5d9773=_0xa66f[_0xb5f333];return _0x5d9773;};'use strict';var Sequelize=require('sequelize');module[_0xfa66('0x0')]={'name':{'type':Sequelize[_0xfa66('0x1')],'unique':_0xfa66('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfa66('0x1')]},'timeout':{'type':Sequelize[_0xfa66('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfa66('0x4')]('rrmemory',_0xfa66('0x5'),_0xfa66('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 20a871e..12631d7 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 _0xbe99=['undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','MailQueues','UserProfileResource','sendStatus','stack','name','send','index','map','MailQueue','rawAttributes','type','key','model','keys','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','show','intersection','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserMailQueue','MailQueueId','findAll','User','findAndCountAll','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','Team','online','interface','Agents','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','ids','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','removeTeams','isEmpty','userMailQueue:remove','addAgents','omit','removeAgents','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./mailQueue.socket','status','end','json','offset'];(function(_0x5721ba,_0x2fd935){var _0x409314=function(_0x1918ad){while(--_0x1918ad){_0x5721ba['push'](_0x5721ba['shift']());}};_0x409314(++_0x2fd935);}(_0xbe99,0x196));var _0x9be9=function(_0x164760,_0x5874b0){_0x164760=_0x164760-0x0;var _0x8b91b2=_0xbe99[_0x164760];return _0x8b91b2;};'use strict';var emlformat=require(_0x9be9('0x0'));var rimraf=require(_0x9be9('0x1'));var zipdir=require(_0x9be9('0x2'));var jsonpatch=require(_0x9be9('0x3'));var rp=require(_0x9be9('0x4'));var moment=require('moment');var BPromise=require(_0x9be9('0x5'));var Mustache=require('mustache');var util=require(_0x9be9('0x6'));var path=require(_0x9be9('0x7'));var sox=require(_0x9be9('0x8'));var csv=require(_0x9be9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9be9('0xa'));var _=require(_0x9be9('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9be9('0xc'));var deskjs=require(_0x9be9('0xd'));var toCsv=require(_0x9be9('0x9'));var querystring=require(_0x9be9('0xe'));var Papa=require(_0x9be9('0xf'));var Redis=require(_0x9be9('0x10'));var authService=require(_0x9be9('0x11'));var qs=require(_0x9be9('0x12'));var as=require(_0x9be9('0x13'));var hardwareService=require(_0x9be9('0x14'));var logger=require(_0x9be9('0x15'))(_0x9be9('0x16'));var utils=require(_0x9be9('0x17'));var config=require(_0x9be9('0x18'));var licenseUtil=require(_0x9be9('0x19'));var db=require(_0x9be9('0x1a'))['db'];config[_0x9be9('0x1b')]=_['defaults'](config[_0x9be9('0x1b')],{'host':_0x9be9('0x1c'),'port':0x18eb});var socket=require(_0x9be9('0x1d'))(new Redis(config[_0x9be9('0x1b')]));require(_0x9be9('0x1e'))['register'](socket);function respondWithStatusCode(_0x2798bd,_0xd3408c){_0xd3408c=_0xd3408c||0xcc;return function(_0x464df5){if(_0x464df5){return _0x2798bd['sendStatus'](_0xd3408c);}return _0x2798bd[_0x9be9('0x1f')](_0xd3408c)[_0x9be9('0x20')]();};}function respondWithResult(_0x3c92cc,_0x1c1307){_0x1c1307=_0x1c1307||0xc8;return function(_0x13a055){if(_0x13a055){return _0x3c92cc['status'](_0x1c1307)[_0x9be9('0x21')](_0x13a055);}};}function respondWithFilteredResult(_0x1cbff7,_0xa51592){return function(_0x5f2612){if(_0x5f2612){var _0x49649f=typeof _0xa51592[_0x9be9('0x22')]===_0x9be9('0x23')&&typeof _0xa51592[_0x9be9('0x24')]==='undefined';var _0x5aeca2=_0x5f2612[_0x9be9('0x25')];var _0x356dea=_0x49649f?0x0:_0xa51592[_0x9be9('0x22')];var _0x380a8c=_0x49649f?_0x5f2612[_0x9be9('0x25')]:_0xa51592[_0x9be9('0x22')]+_0xa51592[_0x9be9('0x24')];var _0x2c1f2f;if(_0x380a8c>=_0x5aeca2){_0x380a8c=_0x5aeca2;_0x2c1f2f=0xc8;}else{_0x2c1f2f=0xce;}_0x1cbff7[_0x9be9('0x1f')](_0x2c1f2f);return _0x1cbff7[_0x9be9('0x26')](_0x9be9('0x27'),_0x356dea+'-'+_0x380a8c+'/'+_0x5aeca2)[_0x9be9('0x21')](_0x5f2612);}return null;};}function patchUpdates(_0x599429){return function(_0x33d3a5){try{jsonpatch['apply'](_0x33d3a5,_0x599429,!![]);}catch(_0x2d543d){return BPromise[_0x9be9('0x28')](_0x2d543d);}return _0x33d3a5[_0x9be9('0x29')]();};}function saveUpdates(_0x3fe959,_0x500e60){return function(_0xf6109b){if(_0xf6109b){return _0xf6109b[_0x9be9('0x2a')](_0x3fe959)[_0x9be9('0x2b')](function(_0x42a486){return _0x42a486;});}return null;};}function removeEntity(_0x60f1ad,_0x13d557){return function(_0x4177a4){if(_0x4177a4){return _0x4177a4[_0x9be9('0x2c')]()[_0x9be9('0x2b')](function(){var _0x27be52=_0x4177a4['get']({'plain':!![]});var _0x195330=_0x9be9('0x2d');return db[_0x9be9('0x2e')][_0x9be9('0x2c')]({'where':{'type':_0x195330,'resourceId':_0x27be52['id']}})[_0x9be9('0x2b')](function(){return _0x4177a4;});})['then'](function(){_0x60f1ad[_0x9be9('0x1f')](0xcc)[_0x9be9('0x20')]();});}};}function handleEntityNotFound(_0x49ed5d,_0x199623){return function(_0x49e398){if(!_0x49e398){_0x49ed5d[_0x9be9('0x2f')](0x194);}return _0x49e398;};}function handleError(_0x16ef5d,_0x27e270){_0x27e270=_0x27e270||0x1f4;return function(_0x199cbd){logger['error'](_0x199cbd[_0x9be9('0x30')]);if(_0x199cbd[_0x9be9('0x31')]){delete _0x199cbd[_0x9be9('0x31')];}_0x16ef5d[_0x9be9('0x1f')](_0x27e270)[_0x9be9('0x32')](_0x199cbd);};}exports[_0x9be9('0x33')]=function(_0x359755,_0x3dcb2a){var _0x50dbb9={},_0x4eb2c0={},_0x1e414f={'count':0x0,'rows':[]};var _0x50640b=_[_0x9be9('0x34')](db[_0x9be9('0x35')][_0x9be9('0x36')],function(_0x2966f0){return{'name':_0x2966f0['fieldName'],'type':_0x2966f0[_0x9be9('0x37')][_0x9be9('0x38')]};});_0x4eb2c0[_0x9be9('0x39')]=_[_0x9be9('0x34')](_0x50640b,_0x9be9('0x31'));_0x4eb2c0['query']=_[_0x9be9('0x3a')](_0x359755['query']);_0x4eb2c0['filters']=_['intersection'](_0x4eb2c0['model'],_0x4eb2c0[_0x9be9('0x3b')]);_0x50dbb9[_0x9be9('0x3c')]=_['intersection'](_0x4eb2c0[_0x9be9('0x39')],qs[_0x9be9('0x3d')](_0x359755[_0x9be9('0x3b')][_0x9be9('0x3d')]));_0x50dbb9[_0x9be9('0x3c')]=_0x50dbb9['attributes'][_0x9be9('0x3e')]?_0x50dbb9[_0x9be9('0x3c')]:_0x4eb2c0[_0x9be9('0x39')];if(!_0x359755[_0x9be9('0x3b')][_0x9be9('0x3f')](_0x9be9('0x40'))){_0x50dbb9[_0x9be9('0x24')]=qs[_0x9be9('0x24')](_0x359755[_0x9be9('0x3b')][_0x9be9('0x24')]);_0x50dbb9[_0x9be9('0x22')]=qs[_0x9be9('0x22')](_0x359755[_0x9be9('0x3b')][_0x9be9('0x22')]);}_0x50dbb9[_0x9be9('0x41')]=qs[_0x9be9('0x42')](_0x359755[_0x9be9('0x3b')][_0x9be9('0x42')]);_0x50dbb9[_0x9be9('0x43')]=qs[_0x9be9('0x44')](_[_0x9be9('0x45')](_0x359755[_0x9be9('0x3b')],_0x4eb2c0[_0x9be9('0x44')]),_0x50640b);if(_0x359755[_0x9be9('0x3b')]['filter']){_0x50dbb9[_0x9be9('0x43')]=_[_0x9be9('0x46')](_0x50dbb9[_0x9be9('0x43')],{'$or':_[_0x9be9('0x34')](_0x50640b,function(_0x1c99f4){if(_0x1c99f4['type']!==_0x9be9('0x47')){var _0x2a5961={};_0x2a5961[_0x1c99f4[_0x9be9('0x31')]]={'$like':'%'+_0x359755[_0x9be9('0x3b')][_0x9be9('0x48')]+'%'};return _0x2a5961;}})});}_0x50dbb9=_[_0x9be9('0x46')]({},_0x50dbb9,_0x359755[_0x9be9('0x49')]);var _0x15763c={'where':_0x50dbb9[_0x9be9('0x43')]};return db['MailQueue']['count'](_0x15763c)[_0x9be9('0x2b')](function(_0x56bf39){_0x1e414f['count']=_0x56bf39;if(_0x359755[_0x9be9('0x3b')][_0x9be9('0x4a')]){_0x50dbb9[_0x9be9('0x4b')]=[{'all':!![]}];}return db['MailQueue']['findAll'](_0x50dbb9);})[_0x9be9('0x2b')](function(_0x4f4168){_0x1e414f[_0x9be9('0x4c')]=_0x4f4168;return _0x1e414f;})[_0x9be9('0x2b')](respondWithFilteredResult(_0x3dcb2a,_0x50dbb9))['catch'](handleError(_0x3dcb2a,null));};exports[_0x9be9('0x4d')]=function(_0x1e1675,_0x1fbc1c){var _0x472543={'raw':!![],'where':{'id':_0x1e1675['params']['id']}},_0x35209e={};_0x35209e[_0x9be9('0x39')]=_[_0x9be9('0x3a')](db[_0x9be9('0x35')]['rawAttributes']);_0x35209e[_0x9be9('0x3b')]=_['keys'](_0x1e1675[_0x9be9('0x3b')]);_0x35209e[_0x9be9('0x44')]=_[_0x9be9('0x4e')](_0x35209e[_0x9be9('0x39')],_0x35209e['query']);_0x472543['attributes']=_[_0x9be9('0x4e')](_0x35209e[_0x9be9('0x39')],qs['fields'](_0x1e1675[_0x9be9('0x3b')][_0x9be9('0x3d')]));_0x472543[_0x9be9('0x3c')]=_0x472543[_0x9be9('0x3c')][_0x9be9('0x3e')]?_0x472543[_0x9be9('0x3c')]:_0x35209e[_0x9be9('0x39')];if(_0x1e1675[_0x9be9('0x3b')][_0x9be9('0x4a')]){_0x472543[_0x9be9('0x4b')]=[{'all':!![]}];}_0x472543=_[_0x9be9('0x46')]({},_0x472543,_0x1e1675[_0x9be9('0x49')]);return db['MailQueue'][_0x9be9('0x4f')](_0x472543)[_0x9be9('0x2b')](handleEntityNotFound(_0x1fbc1c,null))[_0x9be9('0x2b')](respondWithResult(_0x1fbc1c,null))[_0x9be9('0x50')](handleError(_0x1fbc1c,null));};exports['create']=function(_0x589737,_0x9fa026){return db[_0x9be9('0x35')][_0x9be9('0x51')](_0x589737[_0x9be9('0x52')],{})[_0x9be9('0x2b')](function(_0x5840fc){var _0x240265=_0x589737[_0x9be9('0x53')]['get']({'plain':!![]});if(!_0x240265)throw new Error(_0x9be9('0x54'));if(_0x240265[_0x9be9('0x55')]==='user'){var _0x5a4795=_0x5840fc[_0x9be9('0x56')]({'plain':!![]});var _0x1ccb41=_0x9be9('0x2d');return db['UserProfileSection'][_0x9be9('0x4f')]({'where':{'name':_0x1ccb41,'userProfileId':_0x240265[_0x9be9('0x57')]},'raw':!![]})[_0x9be9('0x2b')](function(_0x46a7d2){if(_0x46a7d2&&_0x46a7d2[_0x9be9('0x58')]===0x0){return db[_0x9be9('0x2e')][_0x9be9('0x51')]({'name':_0x5a4795[_0x9be9('0x31')],'resourceId':_0x5a4795['id'],'type':_0x46a7d2[_0x9be9('0x31')],'sectionId':_0x46a7d2['id']},{})[_0x9be9('0x2b')](function(){return _0x5840fc;});}else{return _0x5840fc;}})['catch'](function(_0x489f39){logger['error'](_0x9be9('0x59'),_0x489f39);throw _0x489f39;});}return _0x5840fc;})[_0x9be9('0x2b')](respondWithResult(_0x9fa026,0xc9))['catch'](handleError(_0x9fa026,null));};exports[_0x9be9('0x2a')]=function(_0x251451,_0x3e83ec){if(_0x251451[_0x9be9('0x52')]['id']){delete _0x251451[_0x9be9('0x52')]['id'];}return db[_0x9be9('0x35')][_0x9be9('0x4f')]({'where':{'id':_0x251451['params']['id']}})[_0x9be9('0x2b')](handleEntityNotFound(_0x3e83ec,null))['then'](saveUpdates(_0x251451[_0x9be9('0x52')],null))[_0x9be9('0x2b')](respondWithResult(_0x3e83ec,null))['catch'](handleError(_0x3e83ec,null));};exports[_0x9be9('0x2c')]=function(_0x2a6fa9,_0x41648e){return db['MailQueue'][_0x9be9('0x4f')]({'where':{'id':_0x2a6fa9[_0x9be9('0x5a')]['id']}})[_0x9be9('0x2b')](handleEntityNotFound(_0x41648e,null))[_0x9be9('0x2b')](removeEntity(_0x41648e,null))[_0x9be9('0x50')](handleError(_0x41648e,null));};exports[_0x9be9('0x5b')]=function(_0x2e025f,_0x5310f5){return db[_0x9be9('0x35')][_0x9be9('0x5b')]()[_0x9be9('0x2b')](respondWithResult(_0x5310f5,null))[_0x9be9('0x50')](handleError(_0x5310f5,null));};exports[_0x9be9('0x5c')]=function(_0x3fc460,_0x458b19,_0x328c21){var _0x4286af={'raw':!![],'where':{}},_0x388c5b={},_0x515220;return db['MailQueue'][_0x9be9('0x5d')]({'where':{'id':_0x3fc460[_0x9be9('0x5a')]['id']}})['then'](handleEntityNotFound(_0x458b19,null))['then'](function(_0x2d0f36){if(_0x2d0f36){_0x515220=_0x2d0f36[_0x9be9('0x56')]({'plain':!![]});_0x388c5b[_0x9be9('0x39')]=_[_0x9be9('0x3a')](db[_0x9be9('0x5e')]['rawAttributes']);_0x388c5b['query']=_[_0x9be9('0x3a')](_0x3fc460[_0x9be9('0x3b')]);_0x388c5b[_0x9be9('0x44')]=_[_0x9be9('0x4e')](_0x388c5b[_0x9be9('0x39')],_0x388c5b[_0x9be9('0x3b')]);_0x4286af[_0x9be9('0x3c')]=_[_0x9be9('0x4e')](_0x388c5b['model'],qs[_0x9be9('0x3d')](_0x3fc460[_0x9be9('0x3b')][_0x9be9('0x3d')]));_0x4286af[_0x9be9('0x3c')]=_0x4286af['attributes'][_0x9be9('0x3e')]?_0x4286af[_0x9be9('0x3c')]:_0x388c5b[_0x9be9('0x39')];if(!_0x3fc460['query'][_0x9be9('0x3f')](_0x9be9('0x40'))){_0x4286af['limit']=qs[_0x9be9('0x24')](_0x3fc460['query']['limit']);_0x4286af[_0x9be9('0x22')]=qs['offset'](_0x3fc460['query'][_0x9be9('0x22')]);}_0x4286af[_0x9be9('0x41')]=qs[_0x9be9('0x42')](_0x3fc460[_0x9be9('0x3b')][_0x9be9('0x42')]);_0x4286af[_0x9be9('0x43')]=qs['filters'](_[_0x9be9('0x45')](_0x3fc460[_0x9be9('0x3b')],_0x388c5b[_0x9be9('0x44')]));_0x4286af[_0x9be9('0x43')][_0x9be9('0x5f')]=_0x2d0f36['id'];if(_0x3fc460['query'][_0x9be9('0x48')]){_0x4286af[_0x9be9('0x43')]=_[_0x9be9('0x46')](_0x4286af['where'],{'$or':_['map'](_0x4286af[_0x9be9('0x3c')],function(_0x179c64){var _0x2425e0={};_0x2425e0[_0x179c64]={'$like':'%'+_0x3fc460[_0x9be9('0x3b')][_0x9be9('0x48')]+'%'};return _0x2425e0;})});}_0x4286af=_['merge']({},_0x4286af,_0x3fc460[_0x9be9('0x49')]);return db[_0x9be9('0x5e')][_0x9be9('0x60')](_0x4286af);}})[_0x9be9('0x2b')](function(_0x50433d){if(_0x50433d){return db[_0x9be9('0x61')][_0x9be9('0x62')]({'where':{'id':_[_0x9be9('0x34')](_0x50433d,'UserId'),'role':_0x9be9('0x63')},'attributes':['id',_0x9be9('0x31'),_0x9be9('0x64'),_0x9be9('0x65'),_0x9be9('0x66')]});}})[_0x9be9('0x2b')](function(_0x5869ba){if(_0x5869ba){return{'count':_0x5869ba['count'],'rows':_[_0x9be9('0x34')](_0x5869ba[_0x9be9('0x4c')],function(_0x300b1d){return{'membername':_0x300b1d['name'],'UserId':_0x300b1d['id'],'queue_name':_0x515220['name'],'MailQueueId':_0x515220['id'],'interface':util[_0x9be9('0x67')](_0x9be9('0x68'),_0x9be9('0x69'),_0x300b1d[_0x9be9('0x31')]),'penalty':0x0,'paused':_0x300b1d[_0x9be9('0x64')],'createdAt':_0x300b1d[_0x9be9('0x66')],'updatedAt':_0x300b1d[_0x9be9('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9be9('0x2b')](respondWithFilteredResult(_0x458b19,_0x4286af))['catch'](handleError(_0x458b19,null));};exports['getTeams']=function(_0x3f9da3,_0x2db265,_0x5d1db5){var _0x13578d={};var _0xaab526={};var _0x3daa2a;var _0xe3425b;return db[_0x9be9('0x35')][_0x9be9('0x5d')]({'where':{'id':_0x3f9da3[_0x9be9('0x5a')]['id']}})[_0x9be9('0x2b')](handleEntityNotFound(_0x2db265,null))[_0x9be9('0x2b')](function(_0x4f4d10){if(_0x4f4d10){_0x3daa2a=_0x4f4d10;_0xaab526[_0x9be9('0x39')]=_['keys'](db['Team'][_0x9be9('0x36')]);_0xaab526['query']=_['keys'](_0x3f9da3[_0x9be9('0x3b')]);_0xaab526['filters']=_[_0x9be9('0x4e')](_0xaab526[_0x9be9('0x39')],_0xaab526[_0x9be9('0x3b')]);_0x13578d['attributes']=_['intersection'](_0xaab526['model'],qs[_0x9be9('0x3d')](_0x3f9da3[_0x9be9('0x3b')][_0x9be9('0x3d')]));_0x13578d[_0x9be9('0x3c')]=_0x13578d[_0x9be9('0x3c')]['length']?_0x13578d[_0x9be9('0x3c')]:_0xaab526[_0x9be9('0x39')];_0x13578d[_0x9be9('0x41')]=qs[_0x9be9('0x42')](_0x3f9da3[_0x9be9('0x3b')][_0x9be9('0x42')]);_0x13578d[_0x9be9('0x43')]=qs['filters'](_[_0x9be9('0x45')](_0x3f9da3[_0x9be9('0x3b')],_0xaab526[_0x9be9('0x44')]));if(_0x3f9da3[_0x9be9('0x3b')]['filter']){_0x13578d[_0x9be9('0x43')]=_[_0x9be9('0x46')](_0x13578d['where'],{'$or':_[_0x9be9('0x34')](_0x13578d[_0x9be9('0x3c')],function(_0x5b9c66){var _0x40a630={};_0x40a630[_0x5b9c66]={'$like':'%'+_0x3f9da3[_0x9be9('0x3b')]['filter']+'%'};return _0x40a630;})});}_0x13578d=_[_0x9be9('0x46')]({},_0x13578d,_0x3f9da3[_0x9be9('0x49')]);return _0x3daa2a[_0x9be9('0x6a')](_0x13578d);}})[_0x9be9('0x2b')](function(_0x345232){if(_0x345232){_0xe3425b=_0x345232[_0x9be9('0x3e')];if(!_0x3f9da3[_0x9be9('0x3b')][_0x9be9('0x3f')](_0x9be9('0x40'))){_0x13578d[_0x9be9('0x24')]=qs['limit'](_0x3f9da3[_0x9be9('0x3b')][_0x9be9('0x24')]);_0x13578d[_0x9be9('0x22')]=qs['offset'](_0x3f9da3[_0x9be9('0x3b')][_0x9be9('0x22')]);}return _0x3daa2a[_0x9be9('0x6a')](_0x13578d);}})['then'](function(_0x29eb11){if(_0x29eb11){return _0x29eb11?{'count':_0xe3425b,'rows':_0x29eb11}:null;}})[_0x9be9('0x2b')](respondWithResult(_0x2db265,null))[_0x9be9('0x50')](handleError(_0x2db265,null));};exports[_0x9be9('0x6b')]=function(_0x1618b6,_0x5563b2,_0x5c1b73){var _0x4afe39=_0x1618b6[_0x9be9('0x52')]['ids'];return db[_0x9be9('0x6c')]['findAll']({'where':{'id':_0x4afe39},'attributes':['id'],'include':[{'model':db[_0x9be9('0x61')],'as':'Agents','attributes':['id','name',_0x9be9('0x6d'),'voicePause',_0x9be9('0x6e')],'raw':!![]}]})[_0x9be9('0x2b')](function(_0x2314f5){if(_0x2314f5){var _0x2506e3=_['flatMap'](_0x2314f5,function(_0x4a4fea){var _0x525957=_0x4a4fea[_0x9be9('0x56')]({'plain':!![]});return _0x525957[_0x9be9('0x6f')];});return db[_0x9be9('0x35')][_0x9be9('0x4f')]({'where':{'id':_0x1618b6[_0x9be9('0x5a')]['id']}})[_0x9be9('0x2b')](function(_0x2485b0){return db['sequelize'][_0x9be9('0x70')](function(_0x6f256d){return _0x2485b0[_0x9be9('0x6b')](_0x4afe39,{'transaction':_0x6f256d})['then'](function(){return BPromise[_0x9be9('0x71')](_0x2506e3,function(_0x5c98d7){return db['UserMailQueue'][_0x9be9('0x72')]({'where':{'UserId':_0x5c98d7['id'],'MailQueueId':_0x1618b6[_0x9be9('0x5a')]['id']},'transaction':_0x6f256d});});})[_0x9be9('0x2b')](function(){_0x2506e3[_0x9be9('0x73')](function(_0x147d4e){socket[_0x9be9('0x74')](_0x9be9('0x75'),{'UserId':_0x147d4e['id'],'MailQueueId':_0x2485b0['id']});});});});});}})[_0x9be9('0x2b')](respondWithStatusCode(_0x5563b2,null))[_0x9be9('0x50')](handleError(_0x5563b2,null));};exports['removeTeams']=function(_0x4ee7e2,_0x1e05d2,_0x27e48c){return db[_0x9be9('0x6c')]['findAll']({'where':{'id':_0x4ee7e2['query'][_0x9be9('0x76')]},'attributes':['id'],'include':[{'model':db[_0x9be9('0x61')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x9be9('0x2b')](handleEntityNotFound(_0x1e05d2,null))[_0x9be9('0x2b')](function(_0x3e3352){var _0x44b2d5=_[_0x9be9('0x34')](_0x3e3352,'id');var _0x1054aa=[];var _0x1f593c=[];var _0x2fcfd5=squel['select']();_0x2fcfd5[_0x9be9('0x77')](_0x9be9('0x78'))[_0x9be9('0x79')](_0x9be9('0x7a'),'tq')[_0x9be9('0x7b')](_0x9be9('0x7c'),'ut',_0x9be9('0x7d'))['where'](_0x9be9('0x7e'),_0x4ee7e2[_0x9be9('0x5a')]['id']);for(var _0x179638=0x0;_0x179638<_0x3e3352[_0x9be9('0x3e')];_0x179638+=0x1){let _0xbb7810=_0x3e3352[_0x179638];for(var _0x262245=0x0;_0x262245<_0xbb7810[_0x9be9('0x6f')][_0x9be9('0x3e')];_0x262245+=0x1){let _0x5d023c=_0xbb7810[_0x9be9('0x6f')][_0x262245];var _0x4ebb6c=_0x2fcfd5[_0x9be9('0x7f')]();_0x4ebb6c[_0x9be9('0x43')](_0x9be9('0x80'),_0x5d023c['id']);_0x1f593c[_0x9be9('0x81')](db[_0x9be9('0x82')][_0x9be9('0x3b')](_0x4ebb6c[_0x9be9('0x83')](),{'type':db[_0x9be9('0x82')][_0x9be9('0x84')][_0x9be9('0x85')]})[_0x9be9('0x2b')](function(_0x3a14aa){if(_0x3a14aa[_0x9be9('0x3e')]===0x1){return _0x5d023c['id'];}else{var _0x14d2ba=_[_0x9be9('0x86')](_[_0x9be9('0x34')](_0x3a14aa,_0x9be9('0x87')),function(_0x2b306b){return _[_0x9be9('0x88')](_0x44b2d5,_0x2b306b);});if(_0x14d2ba){return _0x5d023c['id'];}}}));}}return BPromise['all'](_0x1f593c)['then'](function(_0x7f0389){_0x1054aa=_(_0x1054aa)[_0x9be9('0x89')](_0x7f0389)[_0x9be9('0x8a')]()[_0x9be9('0x8b')]();return db[_0x9be9('0x35')][_0x9be9('0x4f')]({'where':{'id':_0x4ee7e2[_0x9be9('0x5a')]['id']}})[_0x9be9('0x2b')](function(_0x3d2184){return db[_0x9be9('0x82')][_0x9be9('0x70')](function(_0x2f6c44){return _0x3d2184[_0x9be9('0x8c')](_0x4ee7e2[_0x9be9('0x3b')]['ids'],{'transaction':_0x2f6c44})[_0x9be9('0x2b')](function(){if(!_[_0x9be9('0x8d')](_0x1054aa)){return _0x3d2184['removeAgents'](_0x1054aa,{'transaction':_0x2f6c44});}})['then'](function(){_0x1054aa['forEach'](function(_0x36ab1f){socket[_0x9be9('0x74')](_0x9be9('0x8e'),{'UserId':_0x36ab1f,'MailQueueId':_0x3d2184['id']});});});});});});})[_0x9be9('0x2b')](respondWithStatusCode(_0x1e05d2,null))[_0x9be9('0x50')](handleError(_0x1e05d2,null));};exports[_0x9be9('0x8f')]=function(_0x94fe4d,_0x4bb1d1,_0x1ed9cd){return db[_0x9be9('0x35')][_0x9be9('0x4f')]({'where':{'id':_0x94fe4d[_0x9be9('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4bb1d1,null))[_0x9be9('0x2b')](function(_0x4594f6){if(_0x4594f6){return _0x4594f6['addAgents'](_0x94fe4d[_0x9be9('0x52')]['ids'],_[_0x9be9('0x90')](_0x94fe4d[_0x9be9('0x52')],[_0x9be9('0x76'),'id'])||{})['spread'](function(_0x2e24c7){for(var _0x90d612=0x0;_0x90d612<_0x94fe4d[_0x9be9('0x52')][_0x9be9('0x76')][_0x9be9('0x3e')];_0x90d612+=0x1){socket[_0x9be9('0x74')]('userMailQueue:save',{'UserId':Number(_0x94fe4d[_0x9be9('0x52')][_0x9be9('0x76')][_0x90d612]),'MailQueueId':Number(_0x94fe4d[_0x9be9('0x5a')]['id'])});}return _0x2e24c7;});}})[_0x9be9('0x2b')](respondWithResult(_0x4bb1d1,null))[_0x9be9('0x50')](handleError(_0x4bb1d1,null));};exports[_0x9be9('0x91')]=function(_0x36c2ad,_0xdb2352,_0x2f798f){return db[_0x9be9('0x35')][_0x9be9('0x4f')]({'where':{'id':_0x36c2ad[_0x9be9('0x5a')]['id']}})[_0x9be9('0x2b')](handleEntityNotFound(_0xdb2352,null))[_0x9be9('0x2b')](function(_0xa23312){if(_0xa23312){return _0xa23312['removeAgents'](_0x36c2ad[_0x9be9('0x3b')][_0x9be9('0x76')])[_0x9be9('0x2b')](function(){if(_['isArray'](_0x36c2ad[_0x9be9('0x3b')][_0x9be9('0x76')])){for(var _0x492a5c=0x0;_0x492a5c<_0x36c2ad['query'][_0x9be9('0x76')][_0x9be9('0x3e')];_0x492a5c+=0x1){socket[_0x9be9('0x74')]('userMailQueue:remove',{'UserId':Number(_0x36c2ad[_0x9be9('0x3b')]['ids'][_0x492a5c]),'MailQueueId':Number(_0x36c2ad[_0x9be9('0x5a')]['id'])});}}else{socket[_0x9be9('0x74')]('userMailQueue:remove',{'UserId':Number(_0x36c2ad[_0x9be9('0x3b')][_0x9be9('0x76')]),'MailQueueId':Number(_0x36c2ad[_0x9be9('0x5a')]['id'])});}});}})[_0x9be9('0x2b')](respondWithStatusCode(_0xdb2352,null))[_0x9be9('0x50')](handleError(_0xdb2352,null));};exports[_0x9be9('0x92')]=function(_0xea621d,_0x3f1ce3,_0x2cf61a){var _0x2514fb={};var _0x291a2a={};var _0x6777ce;var _0x4a5d11;return db[_0x9be9('0x35')][_0x9be9('0x5d')]({'where':{'id':_0xea621d[_0x9be9('0x5a')]['id']}})[_0x9be9('0x2b')](handleEntityNotFound(_0x3f1ce3,null))[_0x9be9('0x2b')](function(_0x366d2d){if(_0x366d2d){_0x6777ce=_0x366d2d;_0x291a2a[_0x9be9('0x39')]=_[_0x9be9('0x3a')](db['User']['rawAttributes']);_0x291a2a[_0x9be9('0x3b')]=_[_0x9be9('0x3a')](_0xea621d[_0x9be9('0x3b')]);_0x291a2a[_0x9be9('0x44')]=_[_0x9be9('0x4e')](_0x291a2a[_0x9be9('0x39')],_0x291a2a[_0x9be9('0x3b')]);_0x2514fb[_0x9be9('0x3c')]=_['intersection'](_0x291a2a['model'],qs[_0x9be9('0x3d')](_0xea621d[_0x9be9('0x3b')][_0x9be9('0x3d')]));_0x2514fb[_0x9be9('0x3c')]=_0x2514fb[_0x9be9('0x3c')][_0x9be9('0x3e')]?_0x2514fb['attributes']:_0x291a2a[_0x9be9('0x39')];_0x2514fb[_0x9be9('0x41')]=qs['sort'](_0xea621d[_0x9be9('0x3b')][_0x9be9('0x42')]);_0x2514fb[_0x9be9('0x43')]=qs[_0x9be9('0x44')](_['pick'](_0xea621d[_0x9be9('0x3b')],_0x291a2a[_0x9be9('0x44')]));if(_0xea621d[_0x9be9('0x3b')]['filter']){_0x2514fb[_0x9be9('0x43')]=_['merge'](_0x2514fb[_0x9be9('0x43')],{'$or':_[_0x9be9('0x34')](_0x2514fb[_0x9be9('0x3c')],function(_0x1d9621){var _0x44e9a9={};_0x44e9a9[_0x1d9621]={'$like':'%'+_0xea621d[_0x9be9('0x3b')]['filter']+'%'};return _0x44e9a9;})});}_0x2514fb=_[_0x9be9('0x46')]({},_0x2514fb,_0xea621d[_0x9be9('0x49')]);return _0x6777ce[_0x9be9('0x92')](_0x2514fb);}})[_0x9be9('0x2b')](function(_0x3cc0e0){if(_0x3cc0e0){_0x4a5d11=_0x3cc0e0['length'];if(!_0xea621d[_0x9be9('0x3b')][_0x9be9('0x3f')](_0x9be9('0x40'))){_0x2514fb[_0x9be9('0x24')]=qs[_0x9be9('0x24')](_0xea621d[_0x9be9('0x3b')][_0x9be9('0x24')]);_0x2514fb[_0x9be9('0x22')]=qs[_0x9be9('0x22')](_0xea621d[_0x9be9('0x3b')][_0x9be9('0x22')]);}return _0x6777ce[_0x9be9('0x92')](_0x2514fb);}})[_0x9be9('0x2b')](function(_0x18a38e){if(_0x18a38e){return _0x18a38e?{'count':_0x4a5d11,'rows':_0x18a38e}:null;}})[_0x9be9('0x2b')](respondWithResult(_0x3f1ce3,null))[_0x9be9('0x50')](handleError(_0x3f1ce3,null));}; \ No newline at end of file +var _0x80d9=['interface','flatMap','transaction','each','findOrCreate','removeTeams','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','removeAgents','forEach','emit','userMailQueue:remove','addAgents','omit','spread','userMailQueue:save','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','index','map','MailQueue','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','rows','catch','show','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','MailQueueId','findAll','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','ids','User','Agents','online','voicePause'];(function(_0xdc356f,_0x3003d0){var _0x339eaa=function(_0xc2283e){while(--_0xc2283e){_0xdc356f['push'](_0xdc356f['shift']());}};_0x339eaa(++_0x3003d0);}(_0x80d9,0xb6));var _0x980d=function(_0x1e4ecd,_0x34fb2e){_0x1e4ecd=_0x1e4ecd-0x0;var _0x5c9d1e=_0x80d9[_0x1e4ecd];return _0x5c9d1e;};'use strict';var emlformat=require(_0x980d('0x0'));var rimraf=require(_0x980d('0x1'));var zipdir=require(_0x980d('0x2'));var jsonpatch=require(_0x980d('0x3'));var rp=require(_0x980d('0x4'));var moment=require(_0x980d('0x5'));var BPromise=require(_0x980d('0x6'));var Mustache=require(_0x980d('0x7'));var util=require('util');var path=require(_0x980d('0x8'));var sox=require(_0x980d('0x9'));var csv=require(_0x980d('0xa'));var ejs=require(_0x980d('0xb'));var fs=require('fs');var fs_extra=require(_0x980d('0xc'));var _=require(_0x980d('0xd'));var squel=require('squel');var crypto=require(_0x980d('0xe'));var jsforce=require(_0x980d('0xf'));var deskjs=require(_0x980d('0x10'));var toCsv=require(_0x980d('0xa'));var querystring=require(_0x980d('0x11'));var Papa=require('papaparse');var Redis=require(_0x980d('0x12'));var authService=require(_0x980d('0x13'));var qs=require(_0x980d('0x14'));var as=require(_0x980d('0x15'));var hardwareService=require(_0x980d('0x16'));var logger=require(_0x980d('0x17'))(_0x980d('0x18'));var utils=require('../../config/utils');var config=require(_0x980d('0x19'));var licenseUtil=require(_0x980d('0x1a'));var db=require(_0x980d('0x1b'))['db'];config['redis']=_[_0x980d('0x1c')](config[_0x980d('0x1d')],{'host':_0x980d('0x1e'),'port':0x18eb});var socket=require(_0x980d('0x1f'))(new Redis(config[_0x980d('0x1d')]));require('./mailQueue.socket')[_0x980d('0x20')](socket);function respondWithStatusCode(_0x267afa,_0x514eb3){_0x514eb3=_0x514eb3||0xcc;return function(_0x3cfd58){if(_0x3cfd58){return _0x267afa[_0x980d('0x21')](_0x514eb3);}return _0x267afa['status'](_0x514eb3)[_0x980d('0x22')]();};}function respondWithResult(_0x7200ff,_0x4ca40a){_0x4ca40a=_0x4ca40a||0xc8;return function(_0x3fdd1e){if(_0x3fdd1e){return _0x7200ff[_0x980d('0x23')](_0x4ca40a)[_0x980d('0x24')](_0x3fdd1e);}};}function respondWithFilteredResult(_0x1e9f8f,_0x600d00){return function(_0xfeb412){if(_0xfeb412){var _0x396da5=typeof _0x600d00['offset']===_0x980d('0x25')&&typeof _0x600d00[_0x980d('0x26')]===_0x980d('0x25');var _0x588edb=_0xfeb412[_0x980d('0x27')];var _0xebf580=_0x396da5?0x0:_0x600d00[_0x980d('0x28')];var _0x510f3f=_0x396da5?_0xfeb412[_0x980d('0x27')]:_0x600d00['offset']+_0x600d00[_0x980d('0x26')];var _0x415d95;if(_0x510f3f>=_0x588edb){_0x510f3f=_0x588edb;_0x415d95=0xc8;}else{_0x415d95=0xce;}_0x1e9f8f[_0x980d('0x23')](_0x415d95);return _0x1e9f8f[_0x980d('0x29')](_0x980d('0x2a'),_0xebf580+'-'+_0x510f3f+'/'+_0x588edb)['json'](_0xfeb412);}return null;};}function patchUpdates(_0xefca47){return function(_0x4106ee){try{jsonpatch[_0x980d('0x2b')](_0x4106ee,_0xefca47,!![]);}catch(_0x5ca53a){return BPromise['reject'](_0x5ca53a);}return _0x4106ee[_0x980d('0x2c')]();};}function saveUpdates(_0x537b8d,_0x5884ad){return function(_0x34169c){if(_0x34169c){return _0x34169c[_0x980d('0x2d')](_0x537b8d)[_0x980d('0x2e')](function(_0x47cdd1){return _0x47cdd1;});}return null;};}function removeEntity(_0x32f39f,_0x64a665){return function(_0x1b786d){if(_0x1b786d){return _0x1b786d[_0x980d('0x2f')]()[_0x980d('0x2e')](function(){var _0x1a96bd=_0x1b786d[_0x980d('0x30')]({'plain':!![]});var _0x22ed70='MailQueues';return db[_0x980d('0x31')]['destroy']({'where':{'type':_0x22ed70,'resourceId':_0x1a96bd['id']}})[_0x980d('0x2e')](function(){return _0x1b786d;});})[_0x980d('0x2e')](function(){_0x32f39f['status'](0xcc)[_0x980d('0x22')]();});}};}function handleEntityNotFound(_0x4d5e16,_0x261be8){return function(_0x2ac46a){if(!_0x2ac46a){_0x4d5e16[_0x980d('0x21')](0x194);}return _0x2ac46a;};}function handleError(_0x35fe61,_0x1bfc25){_0x1bfc25=_0x1bfc25||0x1f4;return function(_0x4eab1b){logger[_0x980d('0x32')](_0x4eab1b[_0x980d('0x33')]);if(_0x4eab1b[_0x980d('0x34')]){delete _0x4eab1b[_0x980d('0x34')];}_0x35fe61[_0x980d('0x23')](_0x1bfc25)['send'](_0x4eab1b);};}exports[_0x980d('0x35')]=function(_0x56c5f7,_0x4b78fc){var _0x22587a={},_0x2e864e={},_0x5f29fd={'count':0x0,'rows':[]};var _0x2d1699=_[_0x980d('0x36')](db[_0x980d('0x37')][_0x980d('0x38')],function(_0x2bdb0f){return{'name':_0x2bdb0f[_0x980d('0x39')],'type':_0x2bdb0f['type'][_0x980d('0x3a')]};});_0x2e864e[_0x980d('0x3b')]=_[_0x980d('0x36')](_0x2d1699,'name');_0x2e864e[_0x980d('0x3c')]=_[_0x980d('0x3d')](_0x56c5f7[_0x980d('0x3c')]);_0x2e864e[_0x980d('0x3e')]=_['intersection'](_0x2e864e[_0x980d('0x3b')],_0x2e864e['query']);_0x22587a[_0x980d('0x3f')]=_[_0x980d('0x40')](_0x2e864e[_0x980d('0x3b')],qs[_0x980d('0x41')](_0x56c5f7[_0x980d('0x3c')][_0x980d('0x41')]));_0x22587a['attributes']=_0x22587a[_0x980d('0x3f')]['length']?_0x22587a[_0x980d('0x3f')]:_0x2e864e['model'];if(!_0x56c5f7['query'][_0x980d('0x42')](_0x980d('0x43'))){_0x22587a['limit']=qs[_0x980d('0x26')](_0x56c5f7[_0x980d('0x3c')]['limit']);_0x22587a['offset']=qs[_0x980d('0x28')](_0x56c5f7[_0x980d('0x3c')][_0x980d('0x28')]);}_0x22587a[_0x980d('0x44')]=qs[_0x980d('0x45')](_0x56c5f7['query'][_0x980d('0x45')]);_0x22587a[_0x980d('0x46')]=qs['filters'](_[_0x980d('0x47')](_0x56c5f7[_0x980d('0x3c')],_0x2e864e[_0x980d('0x3e')]),_0x2d1699);if(_0x56c5f7[_0x980d('0x3c')][_0x980d('0x48')]){_0x22587a[_0x980d('0x46')]=_['merge'](_0x22587a[_0x980d('0x46')],{'$or':_['map'](_0x2d1699,function(_0x53dbd6){if(_0x53dbd6[_0x980d('0x49')]!==_0x980d('0x4a')){var _0x156111={};_0x156111[_0x53dbd6[_0x980d('0x34')]]={'$like':'%'+_0x56c5f7[_0x980d('0x3c')][_0x980d('0x48')]+'%'};return _0x156111;}})});}_0x22587a=_[_0x980d('0x4b')]({},_0x22587a,_0x56c5f7[_0x980d('0x4c')]);var _0x57915d={'where':_0x22587a['where']};return db[_0x980d('0x37')]['count'](_0x57915d)['then'](function(_0x31f4bf){_0x5f29fd[_0x980d('0x27')]=_0x31f4bf;if(_0x56c5f7[_0x980d('0x3c')][_0x980d('0x4d')]){_0x22587a['include']=[{'all':!![]}];}return db['MailQueue']['findAll'](_0x22587a);})[_0x980d('0x2e')](function(_0x148738){_0x5f29fd[_0x980d('0x4e')]=_0x148738;return _0x5f29fd;})[_0x980d('0x2e')](respondWithFilteredResult(_0x4b78fc,_0x22587a))[_0x980d('0x4f')](handleError(_0x4b78fc,null));};exports[_0x980d('0x50')]=function(_0x5dd882,_0x4f8e1c){var _0x145618={'raw':!![],'where':{'id':_0x5dd882['params']['id']}},_0xb0fc56={};_0xb0fc56[_0x980d('0x3b')]=_['keys'](db[_0x980d('0x37')][_0x980d('0x38')]);_0xb0fc56[_0x980d('0x3c')]=_[_0x980d('0x3d')](_0x5dd882['query']);_0xb0fc56[_0x980d('0x3e')]=_[_0x980d('0x40')](_0xb0fc56[_0x980d('0x3b')],_0xb0fc56[_0x980d('0x3c')]);_0x145618[_0x980d('0x3f')]=_[_0x980d('0x40')](_0xb0fc56[_0x980d('0x3b')],qs[_0x980d('0x41')](_0x5dd882[_0x980d('0x3c')][_0x980d('0x41')]));_0x145618[_0x980d('0x3f')]=_0x145618[_0x980d('0x3f')][_0x980d('0x51')]?_0x145618[_0x980d('0x3f')]:_0xb0fc56[_0x980d('0x3b')];if(_0x5dd882[_0x980d('0x3c')]['includeAll']){_0x145618[_0x980d('0x52')]=[{'all':!![]}];}_0x145618=_[_0x980d('0x4b')]({},_0x145618,_0x5dd882[_0x980d('0x4c')]);return db[_0x980d('0x37')][_0x980d('0x53')](_0x145618)[_0x980d('0x2e')](handleEntityNotFound(_0x4f8e1c,null))[_0x980d('0x2e')](respondWithResult(_0x4f8e1c,null))[_0x980d('0x4f')](handleError(_0x4f8e1c,null));};exports['create']=function(_0x1a1ecd,_0x4e35b5){return db['MailQueue'][_0x980d('0x54')](_0x1a1ecd[_0x980d('0x55')],{})['then'](function(_0x13ac81){var _0x14ed18=_0x1a1ecd[_0x980d('0x56')][_0x980d('0x30')]({'plain':!![]});if(!_0x14ed18)throw new Error(_0x980d('0x57'));if(_0x14ed18[_0x980d('0x58')]==='user'){var _0x52a286=_0x13ac81[_0x980d('0x30')]({'plain':!![]});var _0x1abbaf=_0x980d('0x59');return db[_0x980d('0x5a')][_0x980d('0x53')]({'where':{'name':_0x1abbaf,'userProfileId':_0x14ed18[_0x980d('0x5b')]},'raw':!![]})['then'](function(_0x14a8c4){if(_0x14a8c4&&_0x14a8c4[_0x980d('0x5c')]===0x0){return db[_0x980d('0x31')]['create']({'name':_0x52a286[_0x980d('0x34')],'resourceId':_0x52a286['id'],'type':_0x14a8c4['name'],'sectionId':_0x14a8c4['id']},{})['then'](function(){return _0x13ac81;});}else{return _0x13ac81;}})[_0x980d('0x4f')](function(_0x55db97){logger[_0x980d('0x32')](_0x980d('0x5d'),_0x55db97);throw _0x55db97;});}return _0x13ac81;})[_0x980d('0x2e')](respondWithResult(_0x4e35b5,0xc9))['catch'](handleError(_0x4e35b5,null));};exports[_0x980d('0x2d')]=function(_0xbb96d2,_0x2a86b2){if(_0xbb96d2[_0x980d('0x55')]['id']){delete _0xbb96d2['body']['id'];}return db['MailQueue'][_0x980d('0x53')]({'where':{'id':_0xbb96d2[_0x980d('0x5e')]['id']}})[_0x980d('0x2e')](handleEntityNotFound(_0x2a86b2,null))['then'](saveUpdates(_0xbb96d2['body'],null))[_0x980d('0x2e')](respondWithResult(_0x2a86b2,null))['catch'](handleError(_0x2a86b2,null));};exports[_0x980d('0x2f')]=function(_0x2a28d6,_0x537eef){return db[_0x980d('0x37')][_0x980d('0x53')]({'where':{'id':_0x2a28d6[_0x980d('0x5e')]['id']}})[_0x980d('0x2e')](handleEntityNotFound(_0x537eef,null))['then'](removeEntity(_0x537eef,null))[_0x980d('0x4f')](handleError(_0x537eef,null));};exports['describe']=function(_0x216994,_0xa09cc){return db[_0x980d('0x37')][_0x980d('0x5f')]()[_0x980d('0x2e')](respondWithResult(_0xa09cc,null))[_0x980d('0x4f')](handleError(_0xa09cc,null));};exports[_0x980d('0x60')]=function(_0x480a5d,_0x183e1b,_0x5cc602){var _0x163ef6={'raw':!![],'where':{}},_0x12db70={},_0x3ee6d5;return db[_0x980d('0x37')][_0x980d('0x61')]({'where':{'id':_0x480a5d['params']['id']}})[_0x980d('0x2e')](handleEntityNotFound(_0x183e1b,null))[_0x980d('0x2e')](function(_0x233e3f){if(_0x233e3f){_0x3ee6d5=_0x233e3f['get']({'plain':!![]});_0x12db70[_0x980d('0x3b')]=_[_0x980d('0x3d')](db['UserMailQueue']['rawAttributes']);_0x12db70['query']=_['keys'](_0x480a5d[_0x980d('0x3c')]);_0x12db70[_0x980d('0x3e')]=_['intersection'](_0x12db70[_0x980d('0x3b')],_0x12db70[_0x980d('0x3c')]);_0x163ef6['attributes']=_[_0x980d('0x40')](_0x12db70[_0x980d('0x3b')],qs[_0x980d('0x41')](_0x480a5d[_0x980d('0x3c')][_0x980d('0x41')]));_0x163ef6[_0x980d('0x3f')]=_0x163ef6['attributes'][_0x980d('0x51')]?_0x163ef6[_0x980d('0x3f')]:_0x12db70[_0x980d('0x3b')];if(!_0x480a5d['query'][_0x980d('0x42')](_0x980d('0x43'))){_0x163ef6[_0x980d('0x26')]=qs[_0x980d('0x26')](_0x480a5d[_0x980d('0x3c')][_0x980d('0x26')]);_0x163ef6[_0x980d('0x28')]=qs[_0x980d('0x28')](_0x480a5d[_0x980d('0x3c')]['offset']);}_0x163ef6[_0x980d('0x44')]=qs[_0x980d('0x45')](_0x480a5d[_0x980d('0x3c')]['sort']);_0x163ef6[_0x980d('0x46')]=qs['filters'](_[_0x980d('0x47')](_0x480a5d[_0x980d('0x3c')],_0x12db70['filters']));_0x163ef6['where'][_0x980d('0x62')]=_0x233e3f['id'];if(_0x480a5d[_0x980d('0x3c')][_0x980d('0x48')]){_0x163ef6[_0x980d('0x46')]=_['merge'](_0x163ef6['where'],{'$or':_['map'](_0x163ef6['attributes'],function(_0x44c929){var _0x55a1a0={};_0x55a1a0[_0x44c929]={'$like':'%'+_0x480a5d['query']['filter']+'%'};return _0x55a1a0;})});}_0x163ef6=_[_0x980d('0x4b')]({},_0x163ef6,_0x480a5d[_0x980d('0x4c')]);return db['UserMailQueue'][_0x980d('0x63')](_0x163ef6);}})[_0x980d('0x2e')](function(_0xa12b5d){if(_0xa12b5d){return db['User'][_0x980d('0x64')]({'where':{'id':_['map'](_0xa12b5d,_0x980d('0x65')),'role':_0x980d('0x66')},'attributes':['id',_0x980d('0x34'),_0x980d('0x67'),_0x980d('0x68'),_0x980d('0x69')]});}})[_0x980d('0x2e')](function(_0x3fec8c){if(_0x3fec8c){return{'count':_0x3fec8c[_0x980d('0x27')],'rows':_[_0x980d('0x36')](_0x3fec8c[_0x980d('0x4e')],function(_0x2969a3){return{'membername':_0x2969a3['name'],'UserId':_0x2969a3['id'],'queue_name':_0x3ee6d5['name'],'MailQueueId':_0x3ee6d5['id'],'interface':util[_0x980d('0x6a')](_0x980d('0x6b'),'SIP',_0x2969a3['name']),'penalty':0x0,'paused':_0x2969a3[_0x980d('0x67')],'createdAt':_0x2969a3[_0x980d('0x69')],'updatedAt':_0x2969a3[_0x980d('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x980d('0x2e')](respondWithFilteredResult(_0x183e1b,_0x163ef6))['catch'](handleError(_0x183e1b,null));};exports[_0x980d('0x6c')]=function(_0x59da9f,_0x2f49c4,_0x2ee63b){var _0x4651ba={};var _0x1b4282={};var _0x17d5ff;var _0x5e8d51;return db[_0x980d('0x37')][_0x980d('0x61')]({'where':{'id':_0x59da9f[_0x980d('0x5e')]['id']}})[_0x980d('0x2e')](handleEntityNotFound(_0x2f49c4,null))[_0x980d('0x2e')](function(_0x36d923){if(_0x36d923){_0x17d5ff=_0x36d923;_0x1b4282['model']=_[_0x980d('0x3d')](db[_0x980d('0x6d')][_0x980d('0x38')]);_0x1b4282[_0x980d('0x3c')]=_['keys'](_0x59da9f[_0x980d('0x3c')]);_0x1b4282['filters']=_[_0x980d('0x40')](_0x1b4282['model'],_0x1b4282[_0x980d('0x3c')]);_0x4651ba['attributes']=_[_0x980d('0x40')](_0x1b4282[_0x980d('0x3b')],qs[_0x980d('0x41')](_0x59da9f['query'][_0x980d('0x41')]));_0x4651ba['attributes']=_0x4651ba[_0x980d('0x3f')][_0x980d('0x51')]?_0x4651ba[_0x980d('0x3f')]:_0x1b4282[_0x980d('0x3b')];_0x4651ba['order']=qs[_0x980d('0x45')](_0x59da9f[_0x980d('0x3c')][_0x980d('0x45')]);_0x4651ba[_0x980d('0x46')]=qs[_0x980d('0x3e')](_['pick'](_0x59da9f['query'],_0x1b4282[_0x980d('0x3e')]));if(_0x59da9f['query'][_0x980d('0x48')]){_0x4651ba[_0x980d('0x46')]=_['merge'](_0x4651ba[_0x980d('0x46')],{'$or':_[_0x980d('0x36')](_0x4651ba[_0x980d('0x3f')],function(_0x473486){var _0x3ed945={};_0x3ed945[_0x473486]={'$like':'%'+_0x59da9f[_0x980d('0x3c')][_0x980d('0x48')]+'%'};return _0x3ed945;})});}_0x4651ba=_[_0x980d('0x4b')]({},_0x4651ba,_0x59da9f[_0x980d('0x4c')]);return _0x17d5ff[_0x980d('0x6c')](_0x4651ba);}})[_0x980d('0x2e')](function(_0x2381c7){if(_0x2381c7){_0x5e8d51=_0x2381c7[_0x980d('0x51')];if(!_0x59da9f[_0x980d('0x3c')]['hasOwnProperty'](_0x980d('0x43'))){_0x4651ba['limit']=qs[_0x980d('0x26')](_0x59da9f[_0x980d('0x3c')]['limit']);_0x4651ba[_0x980d('0x28')]=qs[_0x980d('0x28')](_0x59da9f[_0x980d('0x3c')][_0x980d('0x28')]);}return _0x17d5ff[_0x980d('0x6c')](_0x4651ba);}})['then'](function(_0x1b79eb){if(_0x1b79eb){return _0x1b79eb?{'count':_0x5e8d51,'rows':_0x1b79eb}:null;}})['then'](respondWithResult(_0x2f49c4,null))[_0x980d('0x4f')](handleError(_0x2f49c4,null));};exports[_0x980d('0x6e')]=function(_0x3258bd,_0x56a0ba,_0x149504){var _0x3c624f=_0x3258bd[_0x980d('0x55')][_0x980d('0x6f')];return db[_0x980d('0x6d')][_0x980d('0x63')]({'where':{'id':_0x3c624f},'attributes':['id'],'include':[{'model':db[_0x980d('0x70')],'as':_0x980d('0x71'),'attributes':['id',_0x980d('0x34'),_0x980d('0x72'),_0x980d('0x73'),_0x980d('0x74')],'raw':!![]}]})[_0x980d('0x2e')](function(_0x486a60){if(_0x486a60){var _0x5af8c4=_[_0x980d('0x75')](_0x486a60,function(_0xd46a0f){var _0x5a08fe=_0xd46a0f[_0x980d('0x30')]({'plain':!![]});return _0x5a08fe[_0x980d('0x71')];});return db[_0x980d('0x37')][_0x980d('0x53')]({'where':{'id':_0x3258bd[_0x980d('0x5e')]['id']}})[_0x980d('0x2e')](function(_0x3fea45){return db['sequelize'][_0x980d('0x76')](function(_0x136a97){return _0x3fea45[_0x980d('0x6e')](_0x3c624f,{'transaction':_0x136a97})[_0x980d('0x2e')](function(){return BPromise[_0x980d('0x77')](_0x5af8c4,function(_0x1b369a){return db['UserMailQueue'][_0x980d('0x78')]({'where':{'UserId':_0x1b369a['id'],'MailQueueId':_0x3258bd['params']['id']},'transaction':_0x136a97});});})[_0x980d('0x2e')](function(){_0x5af8c4['forEach'](function(_0x1bca28){socket['emit']('userMailQueue:save',{'UserId':_0x1bca28['id'],'MailQueueId':_0x3fea45['id']});});});});});}})['then'](respondWithStatusCode(_0x56a0ba,null))[_0x980d('0x4f')](handleError(_0x56a0ba,null));};exports[_0x980d('0x79')]=function(_0x3566e1,_0x15c4c7,_0x5bdf02){return db[_0x980d('0x6d')][_0x980d('0x63')]({'where':{'id':_0x3566e1[_0x980d('0x3c')][_0x980d('0x6f')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x980d('0x71'),'attributes':['id'],'raw':!![]}]})[_0x980d('0x2e')](handleEntityNotFound(_0x15c4c7,null))[_0x980d('0x2e')](function(_0x3a9953){var _0x18d8d9=_[_0x980d('0x36')](_0x3a9953,'id');var _0x217e48=[];var _0x393aee=[];var _0x181678=squel[_0x980d('0x7a')]();_0x181678['field'](_0x980d('0x7b'))[_0x980d('0x7c')]('team_has_mail_queues','tq')[_0x980d('0x7d')](_0x980d('0x7e'),'ut',_0x980d('0x7f'))['where']('MailQueueId\x20=\x20?',_0x3566e1[_0x980d('0x5e')]['id']);for(var _0x5199f2=0x0;_0x5199f2<_0x3a9953[_0x980d('0x51')];_0x5199f2+=0x1){let _0x26c021=_0x3a9953[_0x5199f2];for(var _0x5ad040=0x0;_0x5ad040<_0x26c021[_0x980d('0x71')][_0x980d('0x51')];_0x5ad040+=0x1){let _0xbb788b=_0x26c021[_0x980d('0x71')][_0x5ad040];var _0x19829d=_0x181678['clone']();_0x19829d[_0x980d('0x46')](_0x980d('0x80'),_0xbb788b['id']);_0x393aee[_0x980d('0x81')](db[_0x980d('0x82')][_0x980d('0x3c')](_0x19829d[_0x980d('0x83')](),{'type':db['sequelize'][_0x980d('0x84')][_0x980d('0x85')]})['then'](function(_0x549d89){if(_0x549d89[_0x980d('0x51')]===0x1){return _0xbb788b['id'];}else{var _0x3c4c10=_['every'](_['map'](_0x549d89,_0x980d('0x86')),function(_0x53ac09){return _[_0x980d('0x87')](_0x18d8d9,_0x53ac09);});if(_0x3c4c10){return _0xbb788b['id'];}}}));}}return BPromise[_0x980d('0x88')](_0x393aee)[_0x980d('0x2e')](function(_0x3483ae){_0x217e48=_(_0x217e48)[_0x980d('0x89')](_0x3483ae)[_0x980d('0x8a')]()[_0x980d('0x8b')]();return db[_0x980d('0x37')][_0x980d('0x53')]({'where':{'id':_0x3566e1['params']['id']}})['then'](function(_0x1afc2d){return db['sequelize'][_0x980d('0x76')](function(_0x19dad5){return _0x1afc2d[_0x980d('0x79')](_0x3566e1[_0x980d('0x3c')]['ids'],{'transaction':_0x19dad5})[_0x980d('0x2e')](function(){if(!_['isEmpty'](_0x217e48)){return _0x1afc2d[_0x980d('0x8c')](_0x217e48,{'transaction':_0x19dad5});}})[_0x980d('0x2e')](function(){_0x217e48[_0x980d('0x8d')](function(_0x23b345){socket[_0x980d('0x8e')](_0x980d('0x8f'),{'UserId':_0x23b345,'MailQueueId':_0x1afc2d['id']});});});});});});})[_0x980d('0x2e')](respondWithStatusCode(_0x15c4c7,null))[_0x980d('0x4f')](handleError(_0x15c4c7,null));};exports[_0x980d('0x90')]=function(_0x1f40ee,_0x51a596,_0x326a67){return db[_0x980d('0x37')][_0x980d('0x53')]({'where':{'id':_0x1f40ee[_0x980d('0x5e')]['id']}})[_0x980d('0x2e')](handleEntityNotFound(_0x51a596,null))[_0x980d('0x2e')](function(_0x528e78){if(_0x528e78){return _0x528e78[_0x980d('0x90')](_0x1f40ee[_0x980d('0x55')]['ids'],_[_0x980d('0x91')](_0x1f40ee[_0x980d('0x55')],[_0x980d('0x6f'),'id'])||{})[_0x980d('0x92')](function(_0x5031ba){for(var _0xa12886=0x0;_0xa12886<_0x1f40ee['body'][_0x980d('0x6f')][_0x980d('0x51')];_0xa12886+=0x1){socket[_0x980d('0x8e')](_0x980d('0x93'),{'UserId':Number(_0x1f40ee[_0x980d('0x55')][_0x980d('0x6f')][_0xa12886]),'MailQueueId':Number(_0x1f40ee['params']['id'])});}return _0x5031ba;});}})[_0x980d('0x2e')](respondWithResult(_0x51a596,null))[_0x980d('0x4f')](handleError(_0x51a596,null));};exports[_0x980d('0x8c')]=function(_0x4c1816,_0x3ec3e2,_0x533e88){return db[_0x980d('0x37')][_0x980d('0x53')]({'where':{'id':_0x4c1816[_0x980d('0x5e')]['id']}})[_0x980d('0x2e')](handleEntityNotFound(_0x3ec3e2,null))[_0x980d('0x2e')](function(_0x17c6c4){if(_0x17c6c4){return _0x17c6c4[_0x980d('0x8c')](_0x4c1816[_0x980d('0x3c')][_0x980d('0x6f')])['then'](function(){if(_['isArray'](_0x4c1816[_0x980d('0x3c')][_0x980d('0x6f')])){for(var _0x21a1b1=0x0;_0x21a1b1<_0x4c1816[_0x980d('0x3c')][_0x980d('0x6f')][_0x980d('0x51')];_0x21a1b1+=0x1){socket[_0x980d('0x8e')](_0x980d('0x8f'),{'UserId':Number(_0x4c1816[_0x980d('0x3c')]['ids'][_0x21a1b1]),'MailQueueId':Number(_0x4c1816['params']['id'])});}}else{socket['emit'](_0x980d('0x8f'),{'UserId':Number(_0x4c1816[_0x980d('0x3c')][_0x980d('0x6f')]),'MailQueueId':Number(_0x4c1816[_0x980d('0x5e')]['id'])});}});}})['then'](respondWithStatusCode(_0x3ec3e2,null))[_0x980d('0x4f')](handleError(_0x3ec3e2,null));};exports[_0x980d('0x94')]=function(_0x1c8a64,_0x413d68,_0x8106cd){var _0x2de72a={};var _0x3f7f35={};var _0x349dfe;var _0x2baafe;return db['MailQueue'][_0x980d('0x61')]({'where':{'id':_0x1c8a64[_0x980d('0x5e')]['id']}})['then'](handleEntityNotFound(_0x413d68,null))[_0x980d('0x2e')](function(_0x20fd61){if(_0x20fd61){_0x349dfe=_0x20fd61;_0x3f7f35[_0x980d('0x3b')]=_['keys'](db['User']['rawAttributes']);_0x3f7f35['query']=_[_0x980d('0x3d')](_0x1c8a64[_0x980d('0x3c')]);_0x3f7f35['filters']=_[_0x980d('0x40')](_0x3f7f35[_0x980d('0x3b')],_0x3f7f35['query']);_0x2de72a[_0x980d('0x3f')]=_['intersection'](_0x3f7f35[_0x980d('0x3b')],qs[_0x980d('0x41')](_0x1c8a64[_0x980d('0x3c')][_0x980d('0x41')]));_0x2de72a[_0x980d('0x3f')]=_0x2de72a[_0x980d('0x3f')][_0x980d('0x51')]?_0x2de72a[_0x980d('0x3f')]:_0x3f7f35['model'];_0x2de72a[_0x980d('0x44')]=qs[_0x980d('0x45')](_0x1c8a64[_0x980d('0x3c')][_0x980d('0x45')]);_0x2de72a[_0x980d('0x46')]=qs['filters'](_['pick'](_0x1c8a64[_0x980d('0x3c')],_0x3f7f35['filters']));if(_0x1c8a64['query'][_0x980d('0x48')]){_0x2de72a[_0x980d('0x46')]=_['merge'](_0x2de72a[_0x980d('0x46')],{'$or':_[_0x980d('0x36')](_0x2de72a[_0x980d('0x3f')],function(_0x499128){var _0xb91d28={};_0xb91d28[_0x499128]={'$like':'%'+_0x1c8a64[_0x980d('0x3c')]['filter']+'%'};return _0xb91d28;})});}_0x2de72a=_['merge']({},_0x2de72a,_0x1c8a64['options']);return _0x349dfe[_0x980d('0x94')](_0x2de72a);}})[_0x980d('0x2e')](function(_0x37f694){if(_0x37f694){_0x2baafe=_0x37f694[_0x980d('0x51')];if(!_0x1c8a64[_0x980d('0x3c')][_0x980d('0x42')](_0x980d('0x43'))){_0x2de72a[_0x980d('0x26')]=qs[_0x980d('0x26')](_0x1c8a64['query'][_0x980d('0x26')]);_0x2de72a[_0x980d('0x28')]=qs[_0x980d('0x28')](_0x1c8a64[_0x980d('0x3c')][_0x980d('0x28')]);}return _0x349dfe['getAgents'](_0x2de72a);}})['then'](function(_0x39e159){if(_0x39e159){return _0x39e159?{'count':_0x2baafe,'rows':_0x39e159}:null;}})[_0x980d('0x2e')](respondWithResult(_0x413d68,null))['catch'](handleError(_0x413d68,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 8c72058..3b343d8 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 _0xf8b9=['exports','events','MailQueue','save','remove','emit','hasOwnProperty','hook'];(function(_0x4d5205,_0x2c3de1){var _0x3b3e1b=function(_0x32bf69){while(--_0x32bf69){_0x4d5205['push'](_0x4d5205['shift']());}};_0x3b3e1b(++_0x2c3de1);}(_0xf8b9,0x101));var _0x9f8b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf8b9[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x9f8b('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x9f8b('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9f8b('0x2'),'afterUpdate':'update','afterDestroy':_0x9f8b('0x3')};function emitEvent(_0x60867e){return function(_0x32fbf4,_0x4501ee,_0xd87237){MailQueueEvents[_0x9f8b('0x4')](_0x60867e+':'+_0x32fbf4['id'],_0x32fbf4);MailQueueEvents[_0x9f8b('0x4')](_0x60867e,_0x32fbf4);_0xd87237(null);};}for(var e in events){if(events[_0x9f8b('0x5')](e)){var event=events[e];MailQueue[_0x9f8b('0x6')](e,emitEvent(event));}}module[_0x9f8b('0x7')]=MailQueueEvents; \ No newline at end of file +var _0x9a76=['update','remove','emit','hook','exports','../../mysqldb','MailQueue','setMaxListeners','save'];(function(_0x1b31ba,_0x2ce303){var _0x39bc9f=function(_0x376b6f){while(--_0x376b6f){_0x1b31ba['push'](_0x1b31ba['shift']());}};_0x39bc9f(++_0x2ce303);}(_0x9a76,0x1d9));var _0x69a7=function(_0x167269,_0x1af375){_0x167269=_0x167269-0x0;var _0x3761fd=_0x9a76[_0x167269];return _0x3761fd;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x69a7('0x0'))['db'][_0x69a7('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x69a7('0x2')](0x0);var events={'afterCreate':_0x69a7('0x3'),'afterUpdate':_0x69a7('0x4'),'afterDestroy':_0x69a7('0x5')};function emitEvent(_0x3ab86c){return function(_0x106ba1,_0x3e2497,_0x226005){MailQueueEvents['emit'](_0x3ab86c+':'+_0x106ba1['id'],_0x106ba1);MailQueueEvents[_0x69a7('0x6')](_0x3ab86c,_0x106ba1);_0x226005(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x69a7('0x7')](e,emitEvent(event));}}module[_0x69a7('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 274df20..5668799 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 _0x878d=['MailQueue','mail_queues','util','../../config/logger','moment','request-promise','path','./mailQueue.attributes','exports','define'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x878d,0x19c));var _0xd878=function(_0x4abab9,_0xde21a4){_0x4abab9=_0x4abab9-0x0;var _0x374eba=_0x878d[_0x4abab9];return _0x374eba;};'use strict';var _=require('lodash');var util=require(_0xd878('0x0'));var logger=require(_0xd878('0x1'))('api');var moment=require(_0xd878('0x2'));var BPromise=require('bluebird');var rp=require(_0xd878('0x3'));var fs=require('fs');var path=require(_0xd878('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd878('0x5'));module[_0xd878('0x6')]=function(_0x505dcd,_0x16ad92){return _0x505dcd[_0xd878('0x7')](_0xd878('0x8'),attributes,{'tableName':_0xd878('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1892=['../../config/environment','exports','define','MailQueue','mail_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x1892,0xef));var _0x2189=function(_0x1a6cb2,_0x1945e0){_0x1a6cb2=_0x1a6cb2-0x0;var _0x1482a1=_0x1892[_0x1a6cb2];return _0x1482a1;};'use strict';var _=require(_0x2189('0x0'));var util=require(_0x2189('0x1'));var logger=require('../../config/logger')(_0x2189('0x2'));var moment=require(_0x2189('0x3'));var BPromise=require(_0x2189('0x4'));var rp=require(_0x2189('0x5'));var fs=require('fs');var path=require(_0x2189('0x6'));var rimraf=require(_0x2189('0x7'));var config=require(_0x2189('0x8'));var attributes=require('./mailQueue.attributes');module[_0x2189('0x9')]=function(_0x3da599,_0x4e9fc9){return _0x3da599[_0x2189('0xa')](_0x2189('0xb'),attributes,{'tableName':_0x2189('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index bab48d9..0079363 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 _0x4d5d=['./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','GetMailQueue','MailQueue','findAll','options','where','attributes','limit','include','map','model','stringify','ShowMailQueue','find','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter'];(function(_0x5cc205,_0x1665b5){var _0x13dadb=function(_0x5eb0f7){while(--_0x5eb0f7){_0x5cc205['push'](_0x5cc205['shift']());}};_0x13dadb(++_0x1665b5);}(_0x4d5d,0x111));var _0xd4d5=function(_0x4057ec,_0x425f09){_0x4057ec=_0x4057ec-0x0;var _0xe062c=_0x4d5d[_0x4057ec];return _0xe062c;};'use strict';var _=require(_0xd4d5('0x0'));var util=require(_0xd4d5('0x1'));var moment=require(_0xd4d5('0x2'));var BPromise=require(_0xd4d5('0x3'));var rs=require(_0xd4d5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd4d5('0x5'))['db'];var utils=require(_0xd4d5('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xd4d5('0x7'));var jayson=require(_0xd4d5('0x8'));var client=jayson[_0xd4d5('0x9')][_0xd4d5('0xa')]({'port':0x232a});config[_0xd4d5('0xb')]=_['defaults'](config['redis'],{'host':_0xd4d5('0xc'),'port':0x18eb});var socket=require(_0xd4d5('0xd'))(new Redis(config['redis']));require(_0xd4d5('0xe'))[_0xd4d5('0xf')](socket);function respondWithRpcPromise(_0x559012,_0x4ba113,_0x4224e7){return new BPromise(function(_0x54181e,_0x3bcfce){return client[_0xd4d5('0x10')](_0x559012,_0x4224e7)[_0xd4d5('0x11')](function(_0x373c4a){logger[_0xd4d5('0x12')](_0xd4d5('0x13'),_0x4ba113,'request\x20sent');logger[_0xd4d5('0x14')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x4ba113,_0xd4d5('0x15'),JSON['stringify'](_0x373c4a));if(_0x373c4a[_0xd4d5('0x16')]){if(_0x373c4a[_0xd4d5('0x16')][_0xd4d5('0x17')]===0x1f4){logger[_0xd4d5('0x16')](_0xd4d5('0x13'),_0x4ba113,_0x373c4a[_0xd4d5('0x16')]['message']);return _0x3bcfce(_0x373c4a[_0xd4d5('0x16')][_0xd4d5('0x18')]);}logger[_0xd4d5('0x16')](_0xd4d5('0x13'),_0x4ba113,_0x373c4a[_0xd4d5('0x16')][_0xd4d5('0x18')]);return _0x54181e(_0x373c4a['error'][_0xd4d5('0x18')]);}else{logger[_0xd4d5('0x12')](_0xd4d5('0x13'),_0x4ba113,'request\x20sent');_0x54181e(_0x373c4a[_0xd4d5('0x19')]['message']);}})[_0xd4d5('0x1a')](function(_0x1ef287){logger[_0xd4d5('0x16')](_0xd4d5('0x13'),_0x4ba113,_0x1ef287);_0x3bcfce(_0x1ef287);});});}exports[_0xd4d5('0x1b')]=function(_0x8e5aaa){var _0x1cf3be=this;return new Promise(function(_0x4be62b,_0x5c6fb4){return db[_0xd4d5('0x1c')][_0xd4d5('0x1d')]({'raw':_0x8e5aaa[_0xd4d5('0x1e')]?_0x8e5aaa[_0xd4d5('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x8e5aaa[_0xd4d5('0x1e')]?_0x8e5aaa[_0xd4d5('0x1e')][_0xd4d5('0x1f')]||null:null,'attributes':_0x8e5aaa[_0xd4d5('0x1e')]?_0x8e5aaa[_0xd4d5('0x1e')][_0xd4d5('0x20')]||null:null,'limit':_0x8e5aaa[_0xd4d5('0x1e')]?_0x8e5aaa[_0xd4d5('0x1e')][_0xd4d5('0x21')]||null:null,'include':_0x8e5aaa['options']?_0x8e5aaa['options'][_0xd4d5('0x22')]?_[_0xd4d5('0x23')](_0x8e5aaa[_0xd4d5('0x1e')]['include'],function(_0x12e4e8){return{'model':db[_0x12e4e8[_0xd4d5('0x24')]],'as':_0x12e4e8['as'],'attributes':_0x12e4e8[_0xd4d5('0x20')],'include':_0x12e4e8['include']?_[_0xd4d5('0x23')](_0x12e4e8[_0xd4d5('0x22')],function(_0x3445a2){return{'model':db[_0x3445a2[_0xd4d5('0x24')]],'as':_0x3445a2['as'],'attributes':_0x3445a2['attributes'],'include':_0x3445a2[_0xd4d5('0x22')]?_['map'](_0x3445a2['include'],function(_0x5be0e7){return{'model':db[_0x5be0e7[_0xd4d5('0x24')]],'as':_0x5be0e7['as'],'attributes':_0x5be0e7[_0xd4d5('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd4d5('0x11')](function(_0xfbb0b4){logger[_0xd4d5('0x12')](_0xd4d5('0x1b'),_0x8e5aaa);logger[_0xd4d5('0x14')](_0xd4d5('0x1b'),_0x8e5aaa,JSON[_0xd4d5('0x25')](_0xfbb0b4));_0x4be62b(_0xfbb0b4);})['catch'](function(_0x41bb94){logger[_0xd4d5('0x16')](_0xd4d5('0x1b'),_0x41bb94[_0xd4d5('0x18')],_0x8e5aaa);_0x5c6fb4(_0x1cf3be['error'](0x1f4,_0x41bb94[_0xd4d5('0x18')]));});});};exports[_0xd4d5('0x26')]=function(_0x3b1eaa){var _0x48117d=this;return new Promise(function(_0x13d92d,_0x220498){return db['MailQueue'][_0xd4d5('0x27')]({'raw':_0x3b1eaa[_0xd4d5('0x1e')]?_0x3b1eaa[_0xd4d5('0x1e')][_0xd4d5('0x28')]===undefined?!![]:![]:!![],'where':_0x3b1eaa[_0xd4d5('0x1e')]?_0x3b1eaa['options'][_0xd4d5('0x1f')]||null:null,'attributes':_0x3b1eaa[_0xd4d5('0x1e')]?_0x3b1eaa[_0xd4d5('0x1e')]['attributes']||null:null,'include':_0x3b1eaa[_0xd4d5('0x1e')]?_0x3b1eaa[_0xd4d5('0x1e')][_0xd4d5('0x22')]?_[_0xd4d5('0x23')](_0x3b1eaa[_0xd4d5('0x1e')][_0xd4d5('0x22')],function(_0x3c8010){return{'model':db[_0x3c8010[_0xd4d5('0x24')]],'as':_0x3c8010['as'],'attributes':_0x3c8010[_0xd4d5('0x20')],'include':_0x3c8010['include']?_[_0xd4d5('0x23')](_0x3c8010[_0xd4d5('0x22')],function(_0x4ccf55){return{'model':db[_0x4ccf55['model']],'as':_0x4ccf55['as'],'attributes':_0x4ccf55['attributes'],'include':_0x4ccf55[_0xd4d5('0x22')]?_[_0xd4d5('0x23')](_0x4ccf55['include'],function(_0xc009d0){return{'model':db[_0xc009d0[_0xd4d5('0x24')]],'as':_0xc009d0['as'],'attributes':_0xc009d0[_0xd4d5('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x240f3c){logger['info']('ShowMailQueue',_0x3b1eaa);logger['debug'](_0xd4d5('0x26'),_0x3b1eaa,JSON[_0xd4d5('0x25')](_0x240f3c));_0x13d92d(_0x240f3c);})[_0xd4d5('0x1a')](function(_0x17144f){logger[_0xd4d5('0x16')](_0xd4d5('0x26'),_0x17144f['message'],_0x3b1eaa);_0x220498(_0x48117d['error'](0x1f4,_0x17144f['message']));});});}; \ No newline at end of file +var _0xe073=['socket.io-emitter','register','request','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailQueue','MailQueue','findAll','raw','options','where','attributes','limit','include','map','model','ShowMailQueue','find','then','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x2a9bf4,_0x5e0ffb){var _0x5f5ff1=function(_0x34dfce){while(--_0x34dfce){_0x2a9bf4['push'](_0x2a9bf4['shift']());}};_0x5f5ff1(++_0x5e0ffb);}(_0xe073,0x1b6));var _0x3e07=function(_0x112736,_0x390684){_0x112736=_0x112736-0x0;var _0x815a5e=_0xe073[_0x112736];return _0x815a5e;};'use strict';var _=require(_0x3e07('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3e07('0x1'));var rs=require(_0x3e07('0x2'));var fs=require('fs');var Redis=require(_0x3e07('0x3'));var db=require(_0x3e07('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e07('0x5'))(_0x3e07('0x6'));var config=require(_0x3e07('0x7'));var jayson=require(_0x3e07('0x8'));var client=jayson[_0x3e07('0x9')][_0x3e07('0xa')]({'port':0x232a});config[_0x3e07('0xb')]=_[_0x3e07('0xc')](config[_0x3e07('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x3e07('0xd'))(new Redis(config[_0x3e07('0xb')]));require('./mailQueue.socket')[_0x3e07('0xe')](socket);function respondWithRpcPromise(_0x225827,_0x4b0c44,_0x23dc74){return new BPromise(function(_0x115274,_0x5ea01b){return client[_0x3e07('0xf')](_0x225827,_0x23dc74)['then'](function(_0x22545){logger[_0x3e07('0x10')](_0x3e07('0x11'),_0x4b0c44,_0x3e07('0x12'));logger[_0x3e07('0x13')](_0x3e07('0x14'),_0x4b0c44,_0x3e07('0x12'),JSON[_0x3e07('0x15')](_0x22545));if(_0x22545[_0x3e07('0x16')]){if(_0x22545[_0x3e07('0x16')][_0x3e07('0x17')]===0x1f4){logger[_0x3e07('0x16')](_0x3e07('0x11'),_0x4b0c44,_0x22545[_0x3e07('0x16')][_0x3e07('0x18')]);return _0x5ea01b(_0x22545['error']['message']);}logger[_0x3e07('0x16')](_0x3e07('0x11'),_0x4b0c44,_0x22545[_0x3e07('0x16')][_0x3e07('0x18')]);return _0x115274(_0x22545['error']['message']);}else{logger['info'](_0x3e07('0x11'),_0x4b0c44,_0x3e07('0x12'));_0x115274(_0x22545[_0x3e07('0x19')][_0x3e07('0x18')]);}})[_0x3e07('0x1a')](function(_0x440d18){logger[_0x3e07('0x16')](_0x3e07('0x11'),_0x4b0c44,_0x440d18);_0x5ea01b(_0x440d18);});});}exports[_0x3e07('0x1b')]=function(_0x40cb06){var _0x6efdfb=this;return new Promise(function(_0x5870c3,_0x50e858){return db[_0x3e07('0x1c')][_0x3e07('0x1d')]({'raw':_0x40cb06['options']?_0x40cb06['options'][_0x3e07('0x1e')]===undefined?!![]:![]:!![],'where':_0x40cb06['options']?_0x40cb06[_0x3e07('0x1f')][_0x3e07('0x20')]||null:null,'attributes':_0x40cb06['options']?_0x40cb06[_0x3e07('0x1f')][_0x3e07('0x21')]||null:null,'limit':_0x40cb06[_0x3e07('0x1f')]?_0x40cb06['options'][_0x3e07('0x22')]||null:null,'include':_0x40cb06[_0x3e07('0x1f')]?_0x40cb06[_0x3e07('0x1f')][_0x3e07('0x23')]?_[_0x3e07('0x24')](_0x40cb06['options'][_0x3e07('0x23')],function(_0x1240d4){return{'model':db[_0x1240d4[_0x3e07('0x25')]],'as':_0x1240d4['as'],'attributes':_0x1240d4[_0x3e07('0x21')],'include':_0x1240d4[_0x3e07('0x23')]?_[_0x3e07('0x24')](_0x1240d4[_0x3e07('0x23')],function(_0x37ff9e){return{'model':db[_0x37ff9e[_0x3e07('0x25')]],'as':_0x37ff9e['as'],'attributes':_0x37ff9e['attributes'],'include':_0x37ff9e[_0x3e07('0x23')]?_[_0x3e07('0x24')](_0x37ff9e['include'],function(_0x5e59ee){return{'model':db[_0x5e59ee[_0x3e07('0x25')]],'as':_0x5e59ee['as'],'attributes':_0x5e59ee[_0x3e07('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x51c7b4){logger[_0x3e07('0x10')](_0x3e07('0x1b'),_0x40cb06);logger[_0x3e07('0x13')](_0x3e07('0x1b'),_0x40cb06,JSON[_0x3e07('0x15')](_0x51c7b4));_0x5870c3(_0x51c7b4);})[_0x3e07('0x1a')](function(_0x10f517){logger[_0x3e07('0x16')](_0x3e07('0x1b'),_0x10f517[_0x3e07('0x18')],_0x40cb06);_0x50e858(_0x6efdfb[_0x3e07('0x16')](0x1f4,_0x10f517[_0x3e07('0x18')]));});});};exports[_0x3e07('0x26')]=function(_0x58a2cc){var _0x39eb35=this;return new Promise(function(_0x1bb56d,_0x1cbbcd){return db['MailQueue'][_0x3e07('0x27')]({'raw':_0x58a2cc[_0x3e07('0x1f')]?_0x58a2cc['options']['raw']===undefined?!![]:![]:!![],'where':_0x58a2cc[_0x3e07('0x1f')]?_0x58a2cc[_0x3e07('0x1f')][_0x3e07('0x20')]||null:null,'attributes':_0x58a2cc[_0x3e07('0x1f')]?_0x58a2cc['options'][_0x3e07('0x21')]||null:null,'include':_0x58a2cc[_0x3e07('0x1f')]?_0x58a2cc['options']['include']?_[_0x3e07('0x24')](_0x58a2cc['options'][_0x3e07('0x23')],function(_0x38cf8f){return{'model':db[_0x38cf8f['model']],'as':_0x38cf8f['as'],'attributes':_0x38cf8f[_0x3e07('0x21')],'include':_0x38cf8f[_0x3e07('0x23')]?_[_0x3e07('0x24')](_0x38cf8f['include'],function(_0x30407f){return{'model':db[_0x30407f[_0x3e07('0x25')]],'as':_0x30407f['as'],'attributes':_0x30407f[_0x3e07('0x21')],'include':_0x30407f['include']?_[_0x3e07('0x24')](_0x30407f[_0x3e07('0x23')],function(_0x2ed01a){return{'model':db[_0x2ed01a[_0x3e07('0x25')]],'as':_0x2ed01a['as'],'attributes':_0x2ed01a[_0x3e07('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3e07('0x28')](function(_0x510fd5){logger[_0x3e07('0x10')]('ShowMailQueue',_0x58a2cc);logger[_0x3e07('0x13')](_0x3e07('0x26'),_0x58a2cc,JSON[_0x3e07('0x15')](_0x510fd5));_0x1bb56d(_0x510fd5);})[_0x3e07('0x1a')](function(_0x570bd5){logger['error'](_0x3e07('0x26'),_0x570bd5['message'],_0x58a2cc);_0x1cbbcd(_0x39eb35[_0x3e07('0x16')](0x1f4,_0x570bd5[_0x3e07('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 9d41999..f4a6d1d 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 _0xfd49=['mailQueue:','./mailQueue.events','save','remove','update','removeListener'];(function(_0x24106c,_0x367a6f){var _0xbaeb73=function(_0x483603){while(--_0x483603){_0x24106c['push'](_0x24106c['shift']());}};_0xbaeb73(++_0x367a6f);}(_0xfd49,0x91));var _0x9fd4=function(_0x41dca4,_0x2b4e08){_0x41dca4=_0x41dca4-0x0;var _0x177767=_0xfd49[_0x41dca4];return _0x177767;};'use strict';var MailQueueEvents=require(_0x9fd4('0x0'));var events=[_0x9fd4('0x1'),_0x9fd4('0x2'),_0x9fd4('0x3')];function createListener(_0x3c34b6,_0x3ac18d){return function(_0x138952){_0x3ac18d['emit'](_0x3c34b6,_0x138952);};}function removeListener(_0x4c6d44,_0x53108f){return function(){MailQueueEvents[_0x9fd4('0x4')](_0x4c6d44,_0x53108f);};}exports['register']=function(_0x35f894){for(var _0x37e564=0x0,_0x1ac096=events['length'];_0x37e564<_0x1ac096;_0x37e564++){var _0x5ce929=events[_0x37e564];var _0x21b91a=createListener(_0x9fd4('0x5')+_0x5ce929,_0x35f894);MailQueueEvents['on'](_0x5ce929,_0x21b91a);}}; \ No newline at end of file +var _0x7ec8=['register','length','mailQueue:','save','remove','update','removeListener'];(function(_0x699200,_0x39c101){var _0x266fd1=function(_0x1a9368){while(--_0x1a9368){_0x699200['push'](_0x699200['shift']());}};_0x266fd1(++_0x39c101);}(_0x7ec8,0xce));var _0x87ec=function(_0x1c59ed,_0x100673){_0x1c59ed=_0x1c59ed-0x0;var _0x1926e8=_0x7ec8[_0x1c59ed];return _0x1926e8;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x87ec('0x0'),_0x87ec('0x1'),_0x87ec('0x2')];function createListener(_0x4ee78f,_0x1cb9ea){return function(_0x2d4585){_0x1cb9ea['emit'](_0x4ee78f,_0x2d4585);};}function removeListener(_0x170433,_0x3a0afe){return function(){MailQueueEvents[_0x87ec('0x3')](_0x170433,_0x3a0afe);};}exports[_0x87ec('0x4')]=function(_0x2a8982){for(var _0x44c73e=0x0,_0xd0ab4=events[_0x87ec('0x5')];_0x44c73e<_0xd0ab4;_0x44c73e++){var _0x42c604=events[_0x44c73e];var _0x53e062=createListener(_0x87ec('0x6')+_0x42c604,_0x2a8982);MailQueueEvents['on'](_0x42c604,_0x53e062);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 8ea393b..bbd0886 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 _0x2596=['put','update','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','create'];(function(_0x2a2c72,_0x3f5a4a){var _0x354f0e=function(_0x5b8990){while(--_0x5b8990){_0x2a2c72['push'](_0x2a2c72['shift']());}};_0x354f0e(++_0x3f5a4a);}(_0x2596,0x89));var _0x6259=function(_0x262e4a,_0x3e5cd9){_0x262e4a=_0x262e4a-0x0;var _0x3fc7c6=_0x2596[_0x262e4a];return _0x3fc7c6;};'use strict';var multer=require('multer');var util=require(_0x6259('0x0'));var path=require('path');var timeout=require(_0x6259('0x1'));var express=require(_0x6259('0x2'));var router=express[_0x6259('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6259('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6259('0x5'));var controller=require(_0x6259('0x6'));router['get']('/',auth[_0x6259('0x7')](),controller[_0x6259('0x8')]);router[_0x6259('0x9')](_0x6259('0xa'),auth[_0x6259('0x7')](),controller[_0x6259('0xb')]);router[_0x6259('0x9')](_0x6259('0xc'),auth[_0x6259('0x7')](),controller[_0x6259('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6259('0xe')]);router[_0x6259('0xf')](_0x6259('0xc'),auth[_0x6259('0x7')](),controller[_0x6259('0x10')]);router['delete']('/:id',auth[_0x6259('0x7')](),controller[_0x6259('0x11')]);module[_0x6259('0x12')]=router; \ No newline at end of file +var _0x3d9f=['isAuthenticated','index','describe','post','create','put','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get'];(function(_0x336030,_0x4086ea){var _0x2b203b=function(_0x10b0ad){while(--_0x10b0ad){_0x336030['push'](_0x336030['shift']());}};_0x2b203b(++_0x4086ea);}(_0x3d9f,0xf3));var _0xf3d9=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x3d9f[_0x4154a6];return _0x3b2786;};'use strict';var multer=require(_0xf3d9('0x0'));var util=require(_0xf3d9('0x1'));var path=require(_0xf3d9('0x2'));var timeout=require(_0xf3d9('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf3d9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf3d9('0x5'));var config=require(_0xf3d9('0x6'));var controller=require(_0xf3d9('0x7'));router[_0xf3d9('0x8')]('/',auth[_0xf3d9('0x9')](),controller[_0xf3d9('0xa')]);router[_0xf3d9('0x8')]('/describe',auth[_0xf3d9('0x9')](),controller[_0xf3d9('0xb')]);router[_0xf3d9('0x8')]('/:id',auth[_0xf3d9('0x9')](),controller['show']);router[_0xf3d9('0xc')]('/',auth[_0xf3d9('0x9')](),controller[_0xf3d9('0xd')]);router[_0xf3d9('0xe')]('/:id',auth[_0xf3d9('0x9')](),controller[_0xf3d9('0xf')]);router[_0xf3d9('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xf3d9('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index a88db0a..78de2cf 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 _0xe3ab=['moment','sequelize','exports','STRING','DATE'];(function(_0x1f4c20,_0x5a597c){var _0x37f667=function(_0x5e5c9f){while(--_0x5e5c9f){_0x1f4c20['push'](_0x1f4c20['shift']());}};_0x37f667(++_0x5a597c);}(_0xe3ab,0x181));var _0xbe3a=function(_0x259aa1,_0x33caa0){_0x259aa1=_0x259aa1-0x0;var _0x1bedda=_0xe3ab[_0x259aa1];return _0x1bedda;};'use strict';var moment=require(_0xbe3a('0x0'));var Sequelize=require(_0xbe3a('0x1'));module[_0xbe3a('0x2')]={'uniqueid':{'type':Sequelize[_0xbe3a('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xbe3a('0x3')]},'joinAt':{'type':Sequelize[_0xbe3a('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xbe3a('0x4')]},'reason':{'type':Sequelize[_0xbe3a('0x3')]}}; \ No newline at end of file +var _0x82e1=['moment','sequelize','exports','STRING','DATE'];(function(_0x5287a5,_0x3ff0ad){var _0x158a73=function(_0x351f02){while(--_0x351f02){_0x5287a5['push'](_0x5287a5['shift']());}};_0x158a73(++_0x3ff0ad);}(_0x82e1,0x14f));var _0x182e=function(_0x54daf5,_0x528643){_0x54daf5=_0x54daf5-0x0;var _0xf70158=_0x82e1[_0x54daf5];return _0xf70158;};'use strict';var moment=require(_0x182e('0x0'));var Sequelize=require(_0x182e('0x1'));module[_0x182e('0x2')]={'uniqueid':{'type':Sequelize[_0x182e('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x182e('0x3')]},'joinAt':{'type':Sequelize[_0x182e('0x4')]},'leaveAt':{'type':Sequelize[_0x182e('0x4')]},'acceptAt':{'type':Sequelize[_0x182e('0x4')]},'exitAt':{'type':Sequelize[_0x182e('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 2b12ace..04e4abb 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 _0x958a=['sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','MailQueueReport','include','findAll','rows','catch','show','params','keys','includeAll','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x958a,0x128));var _0xa958=function(_0x5d1289,_0x5af6cf){_0x5d1289=_0x5d1289-0x0;var _0x33c3bc=_0x958a[_0x5d1289];return _0x33c3bc;};'use strict';var emlformat=require(_0xa958('0x0'));var rimraf=require(_0xa958('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa958('0x2'));var rp=require(_0xa958('0x3'));var moment=require(_0xa958('0x4'));var BPromise=require(_0xa958('0x5'));var Mustache=require(_0xa958('0x6'));var util=require('util');var path=require(_0xa958('0x7'));var sox=require('sox');var csv=require(_0xa958('0x8'));var ejs=require(_0xa958('0x9'));var fs=require('fs');var fs_extra=require(_0xa958('0xa'));var _=require(_0xa958('0xb'));var squel=require(_0xa958('0xc'));var crypto=require(_0xa958('0xd'));var jsforce=require(_0xa958('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa958('0xf'));var Papa=require(_0xa958('0x10'));var Redis=require(_0xa958('0x11'));var authService=require(_0xa958('0x12'));var qs=require(_0xa958('0x13'));var as=require(_0xa958('0x14'));var hardwareService=require(_0xa958('0x15'));var logger=require(_0xa958('0x16'))(_0xa958('0x17'));var utils=require(_0xa958('0x18'));var config=require(_0xa958('0x19'));var licenseUtil=require(_0xa958('0x1a'));var db=require(_0xa958('0x1b'))['db'];function respondWithStatusCode(_0x53bf27,_0x5063ae){_0x5063ae=_0x5063ae||0xcc;return function(_0x5bcc66){if(_0x5bcc66){return _0x53bf27[_0xa958('0x1c')](_0x5063ae);}return _0x53bf27[_0xa958('0x1d')](_0x5063ae)[_0xa958('0x1e')]();};}function respondWithResult(_0x591d4d,_0x3ebc66){_0x3ebc66=_0x3ebc66||0xc8;return function(_0x54c439){if(_0x54c439){return _0x591d4d['status'](_0x3ebc66)['json'](_0x54c439);}};}function respondWithFilteredResult(_0x1fe41e,_0x15fca8){return function(_0xb90ac6){if(_0xb90ac6){var _0x6a81c7=typeof _0x15fca8[_0xa958('0x1f')]===_0xa958('0x20')&&typeof _0x15fca8[_0xa958('0x21')]===_0xa958('0x20');var _0x4d836f=_0xb90ac6[_0xa958('0x22')];var _0x4eadc9=_0x6a81c7?0x0:_0x15fca8[_0xa958('0x1f')];var _0x70d13e=_0x6a81c7?_0xb90ac6['count']:_0x15fca8[_0xa958('0x1f')]+_0x15fca8[_0xa958('0x21')];var _0x47636f;if(_0x70d13e>=_0x4d836f){_0x70d13e=_0x4d836f;_0x47636f=0xc8;}else{_0x47636f=0xce;}_0x1fe41e[_0xa958('0x1d')](_0x47636f);return _0x1fe41e[_0xa958('0x23')](_0xa958('0x24'),_0x4eadc9+'-'+_0x70d13e+'/'+_0x4d836f)['json'](_0xb90ac6);}return null;};}function patchUpdates(_0x4a90c2){return function(_0x373661){try{jsonpatch[_0xa958('0x25')](_0x373661,_0x4a90c2,!![]);}catch(_0x16c0be){return BPromise['reject'](_0x16c0be);}return _0x373661[_0xa958('0x26')]();};}function saveUpdates(_0x383aa3,_0x5c091a){return function(_0x28cf12){if(_0x28cf12){return _0x28cf12[_0xa958('0x27')](_0x383aa3)['then'](function(_0x5c5a2b){return _0x5c5a2b;});}return null;};}function removeEntity(_0x201ed3,_0x40b51e){return function(_0x50b3c3){if(_0x50b3c3){return _0x50b3c3[_0xa958('0x28')]()[_0xa958('0x29')](function(){_0x201ed3[_0xa958('0x1d')](0xcc)[_0xa958('0x1e')]();});}};}function handleEntityNotFound(_0x16b04a,_0xf1436e){return function(_0x50fdb1){if(!_0x50fdb1){_0x16b04a[_0xa958('0x1c')](0x194);}return _0x50fdb1;};}function handleError(_0x48ef34,_0x43df63){_0x43df63=_0x43df63||0x1f4;return function(_0x3c2ea3){logger[_0xa958('0x2a')](_0x3c2ea3[_0xa958('0x2b')]);if(_0x3c2ea3[_0xa958('0x2c')]){delete _0x3c2ea3[_0xa958('0x2c')];}_0x48ef34[_0xa958('0x1d')](_0x43df63)[_0xa958('0x2d')](_0x3c2ea3);};}exports[_0xa958('0x2e')]=function(_0x404d07,_0x4c4c37){var _0x47895c={},_0xd2fcc9={},_0x4ef4f6={'count':0x0,'rows':[]};var _0x1febd2=_[_0xa958('0x2f')](db['MailQueueReport'][_0xa958('0x30')],function(_0x3d4711){return{'name':_0x3d4711[_0xa958('0x31')],'type':_0x3d4711[_0xa958('0x32')][_0xa958('0x33')]};});_0xd2fcc9['model']=_['map'](_0x1febd2,_0xa958('0x2c'));_0xd2fcc9['query']=_['keys'](_0x404d07[_0xa958('0x34')]);_0xd2fcc9[_0xa958('0x35')]=_[_0xa958('0x36')](_0xd2fcc9[_0xa958('0x37')],_0xd2fcc9[_0xa958('0x34')]);_0x47895c[_0xa958('0x38')]=_['intersection'](_0xd2fcc9[_0xa958('0x37')],qs['fields'](_0x404d07['query'][_0xa958('0x39')]));_0x47895c[_0xa958('0x38')]=_0x47895c[_0xa958('0x38')][_0xa958('0x3a')]?_0x47895c[_0xa958('0x38')]:_0xd2fcc9[_0xa958('0x37')];if(!_0x404d07[_0xa958('0x34')][_0xa958('0x3b')]('nolimit')){_0x47895c['limit']=qs[_0xa958('0x21')](_0x404d07[_0xa958('0x34')][_0xa958('0x21')]);_0x47895c[_0xa958('0x1f')]=qs[_0xa958('0x1f')](_0x404d07['query'][_0xa958('0x1f')]);}_0x47895c[_0xa958('0x3c')]=qs[_0xa958('0x3d')](_0x404d07[_0xa958('0x34')]['sort']);_0x47895c[_0xa958('0x3e')]=qs[_0xa958('0x35')](_[_0xa958('0x3f')](_0x404d07[_0xa958('0x34')],_0xd2fcc9[_0xa958('0x35')]),_0x1febd2);if(_0x404d07['query'][_0xa958('0x40')]){_0x47895c[_0xa958('0x3e')]=_[_0xa958('0x41')](_0x47895c[_0xa958('0x3e')],{'$or':_[_0xa958('0x2f')](_0x1febd2,function(_0x45603f){if(_0x45603f[_0xa958('0x32')]!==_0xa958('0x42')){var _0x2378df={};_0x2378df[_0x45603f[_0xa958('0x2c')]]={'$like':'%'+_0x404d07['query'][_0xa958('0x40')]+'%'};return _0x2378df;}})});}_0x47895c=_[_0xa958('0x41')]({},_0x47895c,_0x404d07[_0xa958('0x43')]);var _0x5d5ae1={'where':_0x47895c[_0xa958('0x3e')]};return db[_0xa958('0x44')]['count'](_0x5d5ae1)['then'](function(_0x53710e){_0x4ef4f6['count']=_0x53710e;if(_0x404d07[_0xa958('0x34')]['includeAll']){_0x47895c[_0xa958('0x45')]=[{'all':!![]}];}return db['MailQueueReport'][_0xa958('0x46')](_0x47895c);})[_0xa958('0x29')](function(_0x44fa44){_0x4ef4f6[_0xa958('0x47')]=_0x44fa44;return _0x4ef4f6;})[_0xa958('0x29')](respondWithFilteredResult(_0x4c4c37,_0x47895c))[_0xa958('0x48')](handleError(_0x4c4c37,null));};exports[_0xa958('0x49')]=function(_0x18f110,_0x517319){var _0x10e4ee={'raw':!![],'where':{'id':_0x18f110[_0xa958('0x4a')]['id']}},_0x38dfb4={};_0x38dfb4['model']=_['keys'](db['MailQueueReport'][_0xa958('0x30')]);_0x38dfb4[_0xa958('0x34')]=_[_0xa958('0x4b')](_0x18f110[_0xa958('0x34')]);_0x38dfb4[_0xa958('0x35')]=_['intersection'](_0x38dfb4[_0xa958('0x37')],_0x38dfb4[_0xa958('0x34')]);_0x10e4ee[_0xa958('0x38')]=_[_0xa958('0x36')](_0x38dfb4[_0xa958('0x37')],qs[_0xa958('0x39')](_0x18f110[_0xa958('0x34')][_0xa958('0x39')]));_0x10e4ee[_0xa958('0x38')]=_0x10e4ee[_0xa958('0x38')][_0xa958('0x3a')]?_0x10e4ee[_0xa958('0x38')]:_0x38dfb4[_0xa958('0x37')];if(_0x18f110[_0xa958('0x34')][_0xa958('0x4c')]){_0x10e4ee[_0xa958('0x45')]=[{'all':!![]}];}_0x10e4ee=_[_0xa958('0x41')]({},_0x10e4ee,_0x18f110['options']);return db['MailQueueReport']['find'](_0x10e4ee)[_0xa958('0x29')](handleEntityNotFound(_0x517319,null))[_0xa958('0x29')](respondWithResult(_0x517319,null))[_0xa958('0x48')](handleError(_0x517319,null));};exports[_0xa958('0x4d')]=function(_0x55ab45,_0x34faa2){return db[_0xa958('0x44')][_0xa958('0x4d')](_0x55ab45[_0xa958('0x4e')],{})[_0xa958('0x29')](respondWithResult(_0x34faa2,0xc9))['catch'](handleError(_0x34faa2,null));};exports[_0xa958('0x27')]=function(_0x2bbb2e,_0x3f8407){if(_0x2bbb2e['body']['id']){delete _0x2bbb2e[_0xa958('0x4e')]['id'];}return db['MailQueueReport'][_0xa958('0x4f')]({'where':{'id':_0x2bbb2e[_0xa958('0x4a')]['id']}})[_0xa958('0x29')](handleEntityNotFound(_0x3f8407,null))['then'](saveUpdates(_0x2bbb2e[_0xa958('0x4e')],null))['then'](respondWithResult(_0x3f8407,null))[_0xa958('0x48')](handleError(_0x3f8407,null));};exports[_0xa958('0x28')]=function(_0x85fc0d,_0x402d0a){return db[_0xa958('0x44')]['find']({'where':{'id':_0x85fc0d[_0xa958('0x4a')]['id']}})['then'](handleEntityNotFound(_0x402d0a,null))[_0xa958('0x29')](removeEntity(_0x402d0a,null))[_0xa958('0x48')](handleError(_0x402d0a,null));};exports['describe']=function(_0x17e4e7,_0x4f0a27){return db[_0xa958('0x44')][_0xa958('0x50')]()[_0xa958('0x29')](respondWithResult(_0x4f0a27,null))[_0xa958('0x48')](handleError(_0x4f0a27,null));}; \ No newline at end of file +var _0x4325=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','MailQueueReport','findAll','catch','show','params','include','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x4325,0x1da));var _0x5432=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4325[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require(_0x5432('0x0'));var rimraf=require(_0x5432('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5432('0x2'));var rp=require(_0x5432('0x3'));var moment=require(_0x5432('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5432('0x5'));var path=require(_0x5432('0x6'));var sox=require(_0x5432('0x7'));var csv=require('to-csv');var ejs=require(_0x5432('0x8'));var fs=require('fs');var fs_extra=require(_0x5432('0x9'));var _=require('lodash');var squel=require(_0x5432('0xa'));var crypto=require('crypto');var jsforce=require(_0x5432('0xb'));var deskjs=require(_0x5432('0xc'));var toCsv=require(_0x5432('0xd'));var querystring=require(_0x5432('0xe'));var Papa=require(_0x5432('0xf'));var Redis=require('ioredis');var authService=require(_0x5432('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5432('0x11'));var hardwareService=require(_0x5432('0x12'));var logger=require(_0x5432('0x13'))(_0x5432('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5432('0x15'));var db=require(_0x5432('0x16'))['db'];function respondWithStatusCode(_0x5366a0,_0x10a289){_0x10a289=_0x10a289||0xcc;return function(_0x111c54){if(_0x111c54){return _0x5366a0[_0x5432('0x17')](_0x10a289);}return _0x5366a0[_0x5432('0x18')](_0x10a289)[_0x5432('0x19')]();};}function respondWithResult(_0x1a084d,_0x54f41a){_0x54f41a=_0x54f41a||0xc8;return function(_0x5617ce){if(_0x5617ce){return _0x1a084d[_0x5432('0x18')](_0x54f41a)[_0x5432('0x1a')](_0x5617ce);}};}function respondWithFilteredResult(_0x3859d1,_0x364152){return function(_0x9d2023){if(_0x9d2023){var _0x11db3c=typeof _0x364152['offset']===_0x5432('0x1b')&&typeof _0x364152['limit']===_0x5432('0x1b');var _0x3de07a=_0x9d2023[_0x5432('0x1c')];var _0x32fe60=_0x11db3c?0x0:_0x364152[_0x5432('0x1d')];var _0x5f011f=_0x11db3c?_0x9d2023[_0x5432('0x1c')]:_0x364152[_0x5432('0x1d')]+_0x364152[_0x5432('0x1e')];var _0x2bfe04;if(_0x5f011f>=_0x3de07a){_0x5f011f=_0x3de07a;_0x2bfe04=0xc8;}else{_0x2bfe04=0xce;}_0x3859d1[_0x5432('0x18')](_0x2bfe04);return _0x3859d1[_0x5432('0x1f')](_0x5432('0x20'),_0x32fe60+'-'+_0x5f011f+'/'+_0x3de07a)['json'](_0x9d2023);}return null;};}function patchUpdates(_0x66911a){return function(_0x29cde7){try{jsonpatch[_0x5432('0x21')](_0x29cde7,_0x66911a,!![]);}catch(_0xa6c864){return BPromise[_0x5432('0x22')](_0xa6c864);}return _0x29cde7['save']();};}function saveUpdates(_0x5901e2,_0x4d09cd){return function(_0x61827e){if(_0x61827e){return _0x61827e[_0x5432('0x23')](_0x5901e2)[_0x5432('0x24')](function(_0x1f4870){return _0x1f4870;});}return null;};}function removeEntity(_0x4af9f6,_0x4af5f4){return function(_0x3e0b66){if(_0x3e0b66){return _0x3e0b66[_0x5432('0x25')]()['then'](function(){_0x4af9f6[_0x5432('0x18')](0xcc)[_0x5432('0x19')]();});}};}function handleEntityNotFound(_0x637582,_0x4b6ea5){return function(_0xd9928a){if(!_0xd9928a){_0x637582[_0x5432('0x17')](0x194);}return _0xd9928a;};}function handleError(_0xe7eda2,_0x520da1){_0x520da1=_0x520da1||0x1f4;return function(_0x4ab09d){logger[_0x5432('0x26')](_0x4ab09d[_0x5432('0x27')]);if(_0x4ab09d['name']){delete _0x4ab09d[_0x5432('0x28')];}_0xe7eda2[_0x5432('0x18')](_0x520da1)[_0x5432('0x29')](_0x4ab09d);};}exports['index']=function(_0x29dc15,_0x5be867){var _0x4821be={},_0x6fc7f5={},_0x4a52ba={'count':0x0,'rows':[]};var _0x428141=_['map'](db['MailQueueReport'][_0x5432('0x2a')],function(_0x21735e){return{'name':_0x21735e[_0x5432('0x2b')],'type':_0x21735e['type'][_0x5432('0x2c')]};});_0x6fc7f5[_0x5432('0x2d')]=_[_0x5432('0x2e')](_0x428141,_0x5432('0x28'));_0x6fc7f5[_0x5432('0x2f')]=_[_0x5432('0x30')](_0x29dc15[_0x5432('0x2f')]);_0x6fc7f5[_0x5432('0x31')]=_[_0x5432('0x32')](_0x6fc7f5['model'],_0x6fc7f5['query']);_0x4821be[_0x5432('0x33')]=_[_0x5432('0x32')](_0x6fc7f5[_0x5432('0x2d')],qs[_0x5432('0x34')](_0x29dc15[_0x5432('0x2f')]['fields']));_0x4821be[_0x5432('0x33')]=_0x4821be['attributes'][_0x5432('0x35')]?_0x4821be[_0x5432('0x33')]:_0x6fc7f5[_0x5432('0x2d')];if(!_0x29dc15[_0x5432('0x2f')][_0x5432('0x36')](_0x5432('0x37'))){_0x4821be['limit']=qs[_0x5432('0x1e')](_0x29dc15[_0x5432('0x2f')][_0x5432('0x1e')]);_0x4821be[_0x5432('0x1d')]=qs['offset'](_0x29dc15[_0x5432('0x2f')][_0x5432('0x1d')]);}_0x4821be[_0x5432('0x38')]=qs[_0x5432('0x39')](_0x29dc15[_0x5432('0x2f')][_0x5432('0x39')]);_0x4821be[_0x5432('0x3a')]=qs[_0x5432('0x31')](_[_0x5432('0x3b')](_0x29dc15[_0x5432('0x2f')],_0x6fc7f5[_0x5432('0x31')]),_0x428141);if(_0x29dc15[_0x5432('0x2f')][_0x5432('0x3c')]){_0x4821be[_0x5432('0x3a')]=_['merge'](_0x4821be[_0x5432('0x3a')],{'$or':_['map'](_0x428141,function(_0x6f5006){if(_0x6f5006[_0x5432('0x3d')]!==_0x5432('0x3e')){var _0x1a5561={};_0x1a5561[_0x6f5006['name']]={'$like':'%'+_0x29dc15['query']['filter']+'%'};return _0x1a5561;}})});}_0x4821be=_[_0x5432('0x3f')]({},_0x4821be,_0x29dc15[_0x5432('0x40')]);var _0x139d0a={'where':_0x4821be[_0x5432('0x3a')]};return db['MailQueueReport'][_0x5432('0x1c')](_0x139d0a)[_0x5432('0x24')](function(_0x3cd343){_0x4a52ba['count']=_0x3cd343;if(_0x29dc15[_0x5432('0x2f')][_0x5432('0x41')]){_0x4821be['include']=[{'all':!![]}];}return db[_0x5432('0x42')][_0x5432('0x43')](_0x4821be);})['then'](function(_0x23f8f4){_0x4a52ba['rows']=_0x23f8f4;return _0x4a52ba;})[_0x5432('0x24')](respondWithFilteredResult(_0x5be867,_0x4821be))[_0x5432('0x44')](handleError(_0x5be867,null));};exports[_0x5432('0x45')]=function(_0x11c7f2,_0x5cf59a){var _0x9cfb8b={'raw':!![],'where':{'id':_0x11c7f2[_0x5432('0x46')]['id']}},_0x4b93b4={};_0x4b93b4[_0x5432('0x2d')]=_[_0x5432('0x30')](db[_0x5432('0x42')][_0x5432('0x2a')]);_0x4b93b4[_0x5432('0x2f')]=_[_0x5432('0x30')](_0x11c7f2['query']);_0x4b93b4[_0x5432('0x31')]=_[_0x5432('0x32')](_0x4b93b4[_0x5432('0x2d')],_0x4b93b4[_0x5432('0x2f')]);_0x9cfb8b[_0x5432('0x33')]=_[_0x5432('0x32')](_0x4b93b4[_0x5432('0x2d')],qs['fields'](_0x11c7f2[_0x5432('0x2f')][_0x5432('0x34')]));_0x9cfb8b[_0x5432('0x33')]=_0x9cfb8b[_0x5432('0x33')][_0x5432('0x35')]?_0x9cfb8b['attributes']:_0x4b93b4[_0x5432('0x2d')];if(_0x11c7f2['query'][_0x5432('0x41')]){_0x9cfb8b[_0x5432('0x47')]=[{'all':!![]}];}_0x9cfb8b=_['merge']({},_0x9cfb8b,_0x11c7f2[_0x5432('0x40')]);return db['MailQueueReport'][_0x5432('0x48')](_0x9cfb8b)[_0x5432('0x24')](handleEntityNotFound(_0x5cf59a,null))['then'](respondWithResult(_0x5cf59a,null))['catch'](handleError(_0x5cf59a,null));};exports[_0x5432('0x49')]=function(_0xa971bd,_0x3718be){return db[_0x5432('0x42')][_0x5432('0x49')](_0xa971bd[_0x5432('0x4a')],{})[_0x5432('0x24')](respondWithResult(_0x3718be,0xc9))['catch'](handleError(_0x3718be,null));};exports[_0x5432('0x23')]=function(_0x14763c,_0x429da8){if(_0x14763c['body']['id']){delete _0x14763c['body']['id'];}return db['MailQueueReport']['find']({'where':{'id':_0x14763c[_0x5432('0x46')]['id']}})[_0x5432('0x24')](handleEntityNotFound(_0x429da8,null))[_0x5432('0x24')](saveUpdates(_0x14763c[_0x5432('0x4a')],null))[_0x5432('0x24')](respondWithResult(_0x429da8,null))['catch'](handleError(_0x429da8,null));};exports[_0x5432('0x25')]=function(_0xce691b,_0x7937f9){return db['MailQueueReport'][_0x5432('0x48')]({'where':{'id':_0xce691b[_0x5432('0x46')]['id']}})[_0x5432('0x24')](handleEntityNotFound(_0x7937f9,null))[_0x5432('0x24')](removeEntity(_0x7937f9,null))[_0x5432('0x44')](handleError(_0x7937f9,null));};exports['describe']=function(_0xbcf523,_0x5bbedb){return db[_0x5432('0x42')]['describe']()[_0x5432('0x24')](respondWithResult(_0x5bbedb,null))[_0x5432('0x44')](handleError(_0x5bbedb,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 61b9d2c..fac0ce8 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 _0xd96d=['define','MailQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd96d,0x1d4));var _0xdd96=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xd96d[_0x139a3c];return _0x2b375b;};'use strict';var _=require(_0xdd96('0x0'));var util=require(_0xdd96('0x1'));var logger=require(_0xdd96('0x2'))(_0xdd96('0x3'));var moment=require(_0xdd96('0x4'));var BPromise=require(_0xdd96('0x5'));var rp=require(_0xdd96('0x6'));var fs=require('fs');var path=require(_0xdd96('0x7'));var rimraf=require(_0xdd96('0x8'));var config=require(_0xdd96('0x9'));var attributes=require(_0xdd96('0xa'));module[_0xdd96('0xb')]=function(_0x1e04a3,_0x34ccb9){return _0x1e04a3[_0xdd96('0xc')](_0xdd96('0xd'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xdd96('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc86d=['request-promise','path','../../config/environment','exports','MailQueueReport','report_mail_queue','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x5ac0f0,_0xee4d98){var _0x4aceec=function(_0x3a9044){while(--_0x3a9044){_0x5ac0f0['push'](_0x5ac0f0['shift']());}};_0x4aceec(++_0xee4d98);}(_0xc86d,0x10f));var _0xdc86=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xc86d[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0xdc86('0x0'));var util=require(_0xdc86('0x1'));var logger=require('../../config/logger')(_0xdc86('0x2'));var moment=require(_0xdc86('0x3'));var BPromise=require(_0xdc86('0x4'));var rp=require(_0xdc86('0x5'));var fs=require('fs');var path=require(_0xdc86('0x6'));var rimraf=require('rimraf');var config=require(_0xdc86('0x7'));var attributes=require('./mailQueueReport.attributes');module[_0xdc86('0x8')]=function(_0x468cc2,_0x576975){return _0x468cc2['define'](_0xdc86('0x9'),attributes,{'tableName':_0xdc86('0xa'),'paranoid':![],'indexes':[{'name':_0xdc86('0xb'),'fields':[_0xdc86('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 4f10520..af4c40e 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 _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailQueueReport','body','options','raw','stringify','MailQueueReport','update','where','UpdateMailQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x41bbb6,_0x18b96d){var _0x372b34=function(_0x3200d6){while(--_0x3200d6){_0x41bbb6['push'](_0x41bbb6['shift']());}};_0x372b34(++_0x18b96d);}(_0x1261,0x144));var _0x1126=function(_0x275f4a,_0x2077d4){_0x275f4a=_0x275f4a-0x0;var _0x4b4a21=_0x1261[_0x275f4a];return _0x4b4a21;};'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')]('MailQueueReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});}exports[_0x1126('0x15')]=function(_0x4a7b49){var _0x4d2b38=this;return new Promise(function(_0x22ae0b,_0x2b2487){return db['MailQueueReport']['create'](_0x4a7b49[_0x1126('0x16')],{'raw':_0x4a7b49['options']?_0x4a7b49[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![]})[_0x1126('0xc')](function(_0x54400a){logger[_0x1126('0xd')]('CreateMailQueueReport',_0x4a7b49);logger['debug'](_0x1126('0x15'),_0x4a7b49,JSON[_0x1126('0x19')](_0x54400a));_0x22ae0b(_0x54400a);})[_0x1126('0x14')](function(_0x36d254){logger['error'](_0x1126('0x15'),_0x36d254[_0x1126('0x13')],_0x4a7b49);_0x2b2487(_0x4d2b38['error'](0x1f4,_0x36d254[_0x1126('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0x529dd9){var _0x4b57ab=this;return new Promise(function(_0x2199d9,_0x15bcc3){return db[_0x1126('0x1a')][_0x1126('0x1b')](_0x529dd9[_0x1126('0x16')],{'raw':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529dd9['options']?_0x529dd9[_0x1126('0x17')][_0x1126('0x1c')]||null:null,'attributes':_0x529dd9[_0x1126('0x17')]?_0x529dd9['options']['attributes']||null:null,'limit':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')]['limit']||null:null})[_0x1126('0xc')](function(_0x23d2bc){logger['info'](_0x1126('0x1d'),_0x529dd9);logger['debug'](_0x1126('0x1d'),_0x529dd9,JSON['stringify'](_0x23d2bc));_0x2199d9(_0x23d2bc);})[_0x1126('0x14')](function(_0x583ce6){logger[_0x1126('0x11')]('UpdateMailQueueReport',_0x583ce6['message'],_0x529dd9);_0x15bcc3(_0x4b57ab['error'](0x1f4,_0x583ce6[_0x1126('0x13')]));});});}; \ No newline at end of file +var _0xadb5=['MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','create','options','raw','debug','MailQueueReport','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x48c847,_0x264494){var _0xce1b47=function(_0x412fa8){while(--_0x412fa8){_0x48c847['push'](_0x48c847['shift']());}};_0xce1b47(++_0x264494);}(_0xadb5,0xad));var _0x5adb=function(_0x5d3bee,_0x25b975){_0x5d3bee=_0x5d3bee-0x0;var _0x5bea59=_0xadb5[_0x5d3bee];return _0x5bea59;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailQueueReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['MailQueueReport'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![]})[_0x5adb('0xb')](function(_0x1fd4a7){logger[_0x5adb('0xc')]('CreateMailQueueReport',_0x529b65);logger[_0x5adb('0x19')]('CreateMailQueueReport',_0x529b65,JSON['stringify'](_0x1fd4a7));_0x5de028(_0x1fd4a7);})[_0x5adb('0x14')](function(_0x379b33){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x379b33[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x379b33[_0x5adb('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x4b1957){var _0x373cc3=this;return new Promise(function(_0x3220cd,_0x3839fb){return db[_0x5adb('0x1a')]['update'](_0x4b1957[_0x5adb('0x1b')],{'raw':_0x4b1957[_0x5adb('0x17')]?_0x4b1957['options'][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')]['where']||null:null,'attributes':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1c')]||null:null,'limit':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1d')]||null:null})['then'](function(_0x49992e){logger['info'](_0x5adb('0x1e'),_0x4b1957);logger[_0x5adb('0x19')](_0x5adb('0x1e'),_0x4b1957,JSON[_0x5adb('0xf')](_0x49992e));_0x3220cd(_0x49992e);})[_0x5adb('0x14')](function(_0x4de310){logger[_0x5adb('0x10')](_0x5adb('0x1e'),_0x4de310[_0x5adb('0x12')],_0x4b1957);_0x3839fb(_0x373cc3[_0x5adb('0x10')](0x1f4,_0x4de310[_0x5adb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index e8b0250..280120a 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x446a58,_0x38c2b6){var _0x1cbb3f=function(_0x4f501b){while(--_0x4f501b){_0x446a58['push'](_0x446a58['shift']());}};_0x1cbb3f(++_0x38c2b6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3c4a7c,_0x2f4e3c){_0x3c4a7c=_0x3c4a7c-0x0;var _0xf13d1e=_0xcb91[_0x3c4a7c];return _0xf13d1e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2a7f2d,_0x595e1b){var _0x12743=function(_0x516f51){while(--_0x516f51){_0x2a7f2d['push'](_0x2a7f2d['shift']());}};_0x12743(++_0x595e1b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index ffe823f..78965f2 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 _0x9beb=['INBOX','sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x283bd5,_0x57e79){var _0xbdbb21=function(_0x10f0f8){while(--_0x10f0f8){_0x283bd5['push'](_0x283bd5['shift']());}};_0xbdbb21(++_0x57e79);}(_0x9beb,0x151));var _0xb9be=function(_0x4251b5,_0x547a93){_0x4251b5=_0x4251b5-0x0;var _0x36415d=_0x9beb[_0x4251b5];return _0x36415d;};'use strict';var Sequelize=require(_0xb9be('0x0'));module[_0xb9be('0x1')]={'description':{'type':Sequelize[_0xb9be('0x2')]},'host':{'type':Sequelize[_0xb9be('0x2')]},'authentication':{'type':Sequelize[_0xb9be('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xb9be('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xb9be('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xb9be('0x2')],'defaultValue':_0xb9be('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xb9be('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xb9be('0x2')]},'modernAuthentication':{'type':Sequelize[_0xb9be('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xe230=['BOOLEAN','INTEGER','INBOX','sequelize','exports','STRING'];(function(_0x6d3223,_0x2ab591){var _0x19363c=function(_0x1e0e36){while(--_0x1e0e36){_0x6d3223['push'](_0x6d3223['shift']());}};_0x19363c(++_0x2ab591);}(_0xe230,0xe1));var _0x0e23=function(_0x5c650a,_0xa08c95){_0x5c650a=_0x5c650a-0x0;var _0x51470b=_0xe230[_0x5c650a];return _0x51470b;};'use strict';var Sequelize=require(_0x0e23('0x0'));module[_0x0e23('0x1')]={'description':{'type':Sequelize[_0x0e23('0x2')]},'host':{'type':Sequelize[_0x0e23('0x2')]},'authentication':{'type':Sequelize[_0x0e23('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x0e23('0x2')]},'password':{'type':Sequelize[_0x0e23('0x2')]},'port':{'type':Sequelize[_0x0e23('0x4')]},'tls':{'type':Sequelize[_0x0e23('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x0e23('0x2')],'defaultValue':_0x0e23('0x5')},'connTimeout':{'type':Sequelize[_0x0e23('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x0e23('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x0e23('0x2')]},'modernAuthentication':{'type':Sequelize[_0x0e23('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 8451dc5..c7f938b 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 _0xfeb4=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','mail_servers_in','lodash','util'];(function(_0x406238,_0x3907ab){var _0x223b51=function(_0x4975c5){while(--_0x4975c5){_0x406238['push'](_0x406238['shift']());}};_0x223b51(++_0x3907ab);}(_0xfeb4,0x102));var _0x4feb=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xfeb4[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0x4feb('0x0'));var util=require(_0x4feb('0x1'));var logger=require(_0x4feb('0x2'))(_0x4feb('0x3'));var moment=require(_0x4feb('0x4'));var BPromise=require('bluebird');var rp=require(_0x4feb('0x5'));var fs=require('fs');var path=require(_0x4feb('0x6'));var rimraf=require(_0x4feb('0x7'));var config=require(_0x4feb('0x8'));var attributes=require(_0x4feb('0x9'));module[_0x4feb('0xa')]=function(_0x2d7f5c,_0x47e664){return _0x2d7f5c[_0x4feb('0xb')]('MailServerIn',attributes,{'tableName':_0x4feb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf5a4=['path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xf5a4,0x174));var _0x4f5a=function(_0x15808b,_0x3d2a33){_0x15808b=_0x15808b-0x0;var _0x2036d0=_0xf5a4[_0x15808b];return _0x2036d0;};'use strict';var _=require(_0x4f5a('0x0'));var util=require('util');var logger=require(_0x4f5a('0x1'))(_0x4f5a('0x2'));var moment=require('moment');var BPromise=require(_0x4f5a('0x3'));var rp=require(_0x4f5a('0x4'));var fs=require('fs');var path=require(_0x4f5a('0x5'));var rimraf=require(_0x4f5a('0x6'));var config=require(_0x4f5a('0x7'));var attributes=require(_0x4f5a('0x8'));module[_0x4f5a('0x9')]=function(_0xf1d85e,_0x3f9eb5){return _0xf1d85e[_0x4f5a('0xa')](_0x4f5a('0xb'),attributes,{'tableName':_0x4f5a('0xc'),'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 f716be7..9d6560c 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 _0xe617=['lodash','util','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','request','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','findAll','options','raw','attributes','limit','include','map','model','then','GetMailServerIn','debug'];(function(_0x129edf,_0xfa7302){var _0x70563a=function(_0x549205){while(--_0x549205){_0x129edf['push'](_0x129edf['shift']());}};_0x70563a(++_0xfa7302);}(_0xe617,0x13f));var _0x7e61=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe617[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7e61('0x0'));var util=require(_0x7e61('0x1'));var moment=require('moment');var BPromise=require(_0x7e61('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7e61('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e61('0x4'));var logger=require('../../config/logger')(_0x7e61('0x5'));var config=require(_0x7e61('0x6'));var jayson=require(_0x7e61('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2394dd,_0x2e4419,_0x6641b6){return new BPromise(function(_0x8a4508,_0x10b615){return client[_0x7e61('0x8')](_0x2394dd,_0x6641b6)['then'](function(_0x4c328c){logger[_0x7e61('0x9')](_0x7e61('0xa'),_0x2e4419,_0x7e61('0xb'));logger['debug'](_0x7e61('0xc'),_0x2e4419,_0x7e61('0xb'),JSON[_0x7e61('0xd')](_0x4c328c));if(_0x4c328c[_0x7e61('0xe')]){if(_0x4c328c[_0x7e61('0xe')][_0x7e61('0xf')]===0x1f4){logger['error'](_0x7e61('0xa'),_0x2e4419,_0x4c328c[_0x7e61('0xe')][_0x7e61('0x10')]);return _0x10b615(_0x4c328c[_0x7e61('0xe')]['message']);}logger[_0x7e61('0xe')](_0x7e61('0xa'),_0x2e4419,_0x4c328c[_0x7e61('0xe')]['message']);return _0x8a4508(_0x4c328c[_0x7e61('0xe')]['message']);}else{logger[_0x7e61('0x9')](_0x7e61('0xa'),_0x2e4419,_0x7e61('0xb'));_0x8a4508(_0x4c328c[_0x7e61('0x11')]['message']);}})['catch'](function(_0x4cc495){logger[_0x7e61('0xe')](_0x7e61('0xa'),_0x2e4419,_0x4cc495);_0x10b615(_0x4cc495);});});}exports['GetMailServerIn']=function(_0x166bac){var _0x5d40a2=this;return new Promise(function(_0x1a2323,_0x584bb3){return db['MailServerIn'][_0x7e61('0x12')]({'raw':_0x166bac[_0x7e61('0x13')]?_0x166bac[_0x7e61('0x13')][_0x7e61('0x14')]===undefined?!![]:![]:!![],'where':_0x166bac[_0x7e61('0x13')]?_0x166bac[_0x7e61('0x13')]['where']||null:null,'attributes':_0x166bac[_0x7e61('0x13')]?_0x166bac[_0x7e61('0x13')][_0x7e61('0x15')]||null:null,'limit':_0x166bac['options']?_0x166bac[_0x7e61('0x13')][_0x7e61('0x16')]||null:null,'include':_0x166bac[_0x7e61('0x13')]?_0x166bac['options'][_0x7e61('0x17')]?_[_0x7e61('0x18')](_0x166bac['options']['include'],function(_0x149578){return{'model':db[_0x149578['model']],'as':_0x149578['as'],'attributes':_0x149578[_0x7e61('0x15')],'include':_0x149578['include']?_[_0x7e61('0x18')](_0x149578['include'],function(_0x4e581d){return{'model':db[_0x4e581d[_0x7e61('0x19')]],'as':_0x4e581d['as'],'attributes':_0x4e581d[_0x7e61('0x15')],'include':_0x4e581d[_0x7e61('0x17')]?_[_0x7e61('0x18')](_0x4e581d[_0x7e61('0x17')],function(_0x5c502a){return{'model':db[_0x5c502a['model']],'as':_0x5c502a['as'],'attributes':_0x5c502a[_0x7e61('0x15')]};}):[]};}):[]};}):[]:[]})[_0x7e61('0x1a')](function(_0x450ecb){logger[_0x7e61('0x9')](_0x7e61('0x1b'),_0x166bac);logger[_0x7e61('0x1c')]('GetMailServerIn',_0x166bac,JSON[_0x7e61('0xd')](_0x450ecb));_0x1a2323(_0x450ecb);})['catch'](function(_0x18d662){logger[_0x7e61('0xe')]('GetMailServerIn',_0x18d662['message'],_0x166bac);_0x584bb3(_0x5d40a2[_0x7e61('0xe')](0x1f4,_0x18d662[_0x7e61('0x10')]));});});}; \ No newline at end of file +var _0x5882=['catch','MailServerIn','options','where','attributes','limit','include','map','model','GetMailServerIn','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x36e1bf,_0x47317e){var _0x3a2aba=function(_0x40cab7){while(--_0x40cab7){_0x36e1bf['push'](_0x36e1bf['shift']());}};_0x3a2aba(++_0x47317e);}(_0x5882,0x1db));var _0x2588=function(_0x277038,_0x30a52f){_0x277038=_0x277038-0x0;var _0x586337=_0x5882[_0x277038];return _0x586337;};'use strict';var _=require('lodash');var util=require(_0x2588('0x0'));var moment=require(_0x2588('0x1'));var BPromise=require('bluebird');var rs=require(_0x2588('0x2'));var fs=require('fs');var Redis=require(_0x2588('0x3'));var db=require(_0x2588('0x4'))['db'];var utils=require(_0x2588('0x5'));var logger=require(_0x2588('0x6'))(_0x2588('0x7'));var config=require(_0x2588('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2588('0x9')][_0x2588('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56e594,_0x32dd94,_0x1b53e5){return new BPromise(function(_0x4e19cd,_0x19a43e){return client[_0x2588('0xb')](_0x56e594,_0x1b53e5)[_0x2588('0xc')](function(_0x3c8ac5){logger['info'](_0x2588('0xd'),_0x32dd94,_0x2588('0xe'));logger[_0x2588('0xf')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x32dd94,_0x2588('0xe'),JSON[_0x2588('0x10')](_0x3c8ac5));if(_0x3c8ac5['error']){if(_0x3c8ac5[_0x2588('0x11')][_0x2588('0x12')]===0x1f4){logger[_0x2588('0x11')](_0x2588('0xd'),_0x32dd94,_0x3c8ac5[_0x2588('0x11')][_0x2588('0x13')]);return _0x19a43e(_0x3c8ac5[_0x2588('0x11')][_0x2588('0x13')]);}logger['error'](_0x2588('0xd'),_0x32dd94,_0x3c8ac5[_0x2588('0x11')][_0x2588('0x13')]);return _0x4e19cd(_0x3c8ac5['error'][_0x2588('0x13')]);}else{logger[_0x2588('0x14')](_0x2588('0xd'),_0x32dd94,_0x2588('0xe'));_0x4e19cd(_0x3c8ac5['result']['message']);}})[_0x2588('0x15')](function(_0x42b84b){logger[_0x2588('0x11')](_0x2588('0xd'),_0x32dd94,_0x42b84b);_0x19a43e(_0x42b84b);});});}exports['GetMailServerIn']=function(_0x56b174){var _0x4e792e=this;return new Promise(function(_0x254417,_0xe9f78){return db[_0x2588('0x16')]['findAll']({'raw':_0x56b174[_0x2588('0x17')]?_0x56b174[_0x2588('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x56b174[_0x2588('0x17')]?_0x56b174[_0x2588('0x17')][_0x2588('0x18')]||null:null,'attributes':_0x56b174[_0x2588('0x17')]?_0x56b174[_0x2588('0x17')][_0x2588('0x19')]||null:null,'limit':_0x56b174[_0x2588('0x17')]?_0x56b174[_0x2588('0x17')][_0x2588('0x1a')]||null:null,'include':_0x56b174[_0x2588('0x17')]?_0x56b174[_0x2588('0x17')][_0x2588('0x1b')]?_[_0x2588('0x1c')](_0x56b174[_0x2588('0x17')]['include'],function(_0x3820a6){return{'model':db[_0x3820a6['model']],'as':_0x3820a6['as'],'attributes':_0x3820a6[_0x2588('0x19')],'include':_0x3820a6[_0x2588('0x1b')]?_['map'](_0x3820a6[_0x2588('0x1b')],function(_0x2afb56){return{'model':db[_0x2afb56[_0x2588('0x1d')]],'as':_0x2afb56['as'],'attributes':_0x2afb56[_0x2588('0x19')],'include':_0x2afb56[_0x2588('0x1b')]?_[_0x2588('0x1c')](_0x2afb56['include'],function(_0x3e3bad){return{'model':db[_0x3e3bad[_0x2588('0x1d')]],'as':_0x3e3bad['as'],'attributes':_0x3e3bad[_0x2588('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2588('0xc')](function(_0x13562c){logger['info'](_0x2588('0x1e'),_0x56b174);logger[_0x2588('0xf')](_0x2588('0x1e'),_0x56b174,JSON[_0x2588('0x10')](_0x13562c));_0x254417(_0x13562c);})[_0x2588('0x15')](function(_0x39bfb7){logger['error']('GetMailServerIn',_0x39bfb7['message'],_0x56b174);_0xe9f78(_0x4e792e[_0x2588('0x11')](0x1f4,_0x39bfb7['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index ba04bd0..6690999 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(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x7a54,0x106));var _0x47a5=function(_0x3ff443,_0xb29938){_0x3ff443=_0x3ff443-0x0;var _0x5c974c=_0x7a54[_0x3ff443];return _0x5c974c;};'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 60be506..4c98bab 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 _0x065e=['STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x57c0ea,_0x306b85){var _0x3bfcb7=function(_0x4b6b0b){while(--_0x4b6b0b){_0x57c0ea['push'](_0x57c0ea['shift']());}};_0x3bfcb7(++_0x306b85);}(_0x065e,0x1a7));var _0xe065=function(_0x16300f,_0x78a8ba){_0x16300f=_0x16300f-0x0;var _0x5e1920=_0x065e[_0x16300f];return _0x5e1920;};'use strict';var Sequelize=require(_0xe065('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xe065('0x1')]},'pass':{'type':Sequelize[_0xe065('0x1')]},'port':{'type':Sequelize[_0xe065('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xe065('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xe065('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x3423=['INTEGER','BOOLEAN','STRING'];(function(_0x422559,_0x431db3){var _0x33b51a=function(_0x125e43){while(--_0x125e43){_0x422559['push'](_0x422559['shift']());}};_0x33b51a(++_0x431db3);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x3342('0x0')]},'host':{'type':Sequelize[_0x3342('0x0')]},'user':{'type':Sequelize[_0x3342('0x0')]},'pass':{'type':Sequelize[_0x3342('0x0')]},'port':{'type':Sequelize[_0x3342('0x1')]},'secure':{'type':Sequelize[_0x3342('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0x3342('0x0')]},'authentication':{'type':Sequelize[_0x3342('0x2')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x3342('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 2477e60..8d60c09 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 _0x0032=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','end','error','stack','name','send','index','map','MailServerOut','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x4020a6,_0x2ffa8d){var _0x3d6181=function(_0x41d613){while(--_0x41d613){_0x4020a6['push'](_0x4020a6['shift']());}};_0x3d6181(++_0x2ffa8d);}(_0x0032,0xcb));var _0x2003=function(_0x12e264,_0x4a5b5d){_0x12e264=_0x12e264-0x0;var _0x1a7ad4=_0x0032[_0x12e264];return _0x1a7ad4;};'use strict';var emlformat=require(_0x2003('0x0'));var rimraf=require(_0x2003('0x1'));var zipdir=require(_0x2003('0x2'));var jsonpatch=require(_0x2003('0x3'));var rp=require('request-promise');var moment=require(_0x2003('0x4'));var BPromise=require(_0x2003('0x5'));var Mustache=require('mustache');var util=require(_0x2003('0x6'));var path=require(_0x2003('0x7'));var sox=require('sox');var csv=require(_0x2003('0x8'));var ejs=require(_0x2003('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2003('0xa'));var squel=require(_0x2003('0xb'));var crypto=require(_0x2003('0xc'));var jsforce=require(_0x2003('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2003('0x8'));var querystring=require(_0x2003('0xe'));var Papa=require(_0x2003('0xf'));var Redis=require(_0x2003('0x10'));var authService=require(_0x2003('0x11'));var qs=require(_0x2003('0x12'));var as=require(_0x2003('0x13'));var hardwareService=require(_0x2003('0x14'));var logger=require(_0x2003('0x15'))(_0x2003('0x16'));var utils=require('../../config/utils');var config=require(_0x2003('0x17'));var licenseUtil=require(_0x2003('0x18'));var db=require(_0x2003('0x19'))['db'];function respondWithStatusCode(_0xedb526,_0x195c42){_0x195c42=_0x195c42||0xcc;return function(_0x86aa28){if(_0x86aa28){return _0xedb526[_0x2003('0x1a')](_0x195c42);}return _0xedb526[_0x2003('0x1b')](_0x195c42)['end']();};}function respondWithResult(_0x2dbf7e,_0x59133b){_0x59133b=_0x59133b||0xc8;return function(_0x43fadf){if(_0x43fadf){return _0x2dbf7e[_0x2003('0x1b')](_0x59133b)[_0x2003('0x1c')](_0x43fadf);}};}function respondWithFilteredResult(_0x3b3bbe,_0x86bbf){return function(_0x2c8e2a){if(_0x2c8e2a){var _0x2fc2a9=typeof _0x86bbf[_0x2003('0x1d')]===_0x2003('0x1e')&&typeof _0x86bbf[_0x2003('0x1f')]===_0x2003('0x1e');var _0x5410ca=_0x2c8e2a[_0x2003('0x20')];var _0x40e730=_0x2fc2a9?0x0:_0x86bbf[_0x2003('0x1d')];var _0x29e6db=_0x2fc2a9?_0x2c8e2a['count']:_0x86bbf[_0x2003('0x1d')]+_0x86bbf['limit'];var _0x1695d1;if(_0x29e6db>=_0x5410ca){_0x29e6db=_0x5410ca;_0x1695d1=0xc8;}else{_0x1695d1=0xce;}_0x3b3bbe['status'](_0x1695d1);return _0x3b3bbe[_0x2003('0x21')](_0x2003('0x22'),_0x40e730+'-'+_0x29e6db+'/'+_0x5410ca)[_0x2003('0x1c')](_0x2c8e2a);}return null;};}function patchUpdates(_0x47db24){return function(_0x449cbe){try{jsonpatch['apply'](_0x449cbe,_0x47db24,!![]);}catch(_0x1d7cb3){return BPromise['reject'](_0x1d7cb3);}return _0x449cbe[_0x2003('0x23')]();};}function saveUpdates(_0x267c0b,_0x3cde02){return function(_0xd1d8b2){if(_0xd1d8b2){return _0xd1d8b2[_0x2003('0x24')](_0x267c0b)[_0x2003('0x25')](function(_0x161329){return _0x161329;});}return null;};}function removeEntity(_0xe8b352,_0x14dd00){return function(_0x29c30d){if(_0x29c30d){return _0x29c30d['destroy']()[_0x2003('0x25')](function(){_0xe8b352[_0x2003('0x1b')](0xcc)[_0x2003('0x26')]();});}};}function handleEntityNotFound(_0x4ea334,_0x4c812c){return function(_0x30288e){if(!_0x30288e){_0x4ea334[_0x2003('0x1a')](0x194);}return _0x30288e;};}function handleError(_0x4fd050,_0xa1926d){_0xa1926d=_0xa1926d||0x1f4;return function(_0xbfec95){logger[_0x2003('0x27')](_0xbfec95[_0x2003('0x28')]);if(_0xbfec95[_0x2003('0x29')]){delete _0xbfec95[_0x2003('0x29')];}_0x4fd050[_0x2003('0x1b')](_0xa1926d)[_0x2003('0x2a')](_0xbfec95);};}exports[_0x2003('0x2b')]=function(_0x39f38d,_0x5929f0){var _0x176cae={},_0x278fd5={},_0x29449a={'count':0x0,'rows':[]};var _0x2c46bf=_[_0x2003('0x2c')](db[_0x2003('0x2d')][_0x2003('0x2e')],function(_0x43bfad){return{'name':_0x43bfad['fieldName'],'type':_0x43bfad[_0x2003('0x2f')][_0x2003('0x30')]};});_0x278fd5['model']=_[_0x2003('0x2c')](_0x2c46bf,_0x2003('0x29'));_0x278fd5[_0x2003('0x31')]=_[_0x2003('0x32')](_0x39f38d['query']);_0x278fd5[_0x2003('0x33')]=_['intersection'](_0x278fd5[_0x2003('0x34')],_0x278fd5[_0x2003('0x31')]);_0x176cae[_0x2003('0x35')]=_[_0x2003('0x36')](_0x278fd5[_0x2003('0x34')],qs['fields'](_0x39f38d['query'][_0x2003('0x37')]));_0x176cae[_0x2003('0x35')]=_0x176cae['attributes'][_0x2003('0x38')]?_0x176cae[_0x2003('0x35')]:_0x278fd5[_0x2003('0x34')];if(!_0x39f38d['query']['hasOwnProperty'](_0x2003('0x39'))){_0x176cae[_0x2003('0x1f')]=qs[_0x2003('0x1f')](_0x39f38d[_0x2003('0x31')]['limit']);_0x176cae[_0x2003('0x1d')]=qs[_0x2003('0x1d')](_0x39f38d[_0x2003('0x31')]['offset']);}_0x176cae['order']=qs[_0x2003('0x3a')](_0x39f38d[_0x2003('0x31')][_0x2003('0x3a')]);_0x176cae[_0x2003('0x3b')]=qs['filters'](_[_0x2003('0x3c')](_0x39f38d[_0x2003('0x31')],_0x278fd5[_0x2003('0x33')]),_0x2c46bf);if(_0x39f38d[_0x2003('0x31')]['filter']){_0x176cae[_0x2003('0x3b')]=_[_0x2003('0x3d')](_0x176cae[_0x2003('0x3b')],{'$or':_[_0x2003('0x2c')](_0x2c46bf,function(_0x8b826b){if(_0x8b826b[_0x2003('0x2f')]!==_0x2003('0x3e')){var _0x43401f={};_0x43401f[_0x8b826b[_0x2003('0x29')]]={'$like':'%'+_0x39f38d[_0x2003('0x31')][_0x2003('0x3f')]+'%'};return _0x43401f;}})});}_0x176cae=_[_0x2003('0x3d')]({},_0x176cae,_0x39f38d[_0x2003('0x40')]);var _0x5255fa={'where':_0x176cae[_0x2003('0x3b')]};return db[_0x2003('0x2d')][_0x2003('0x20')](_0x5255fa)[_0x2003('0x25')](function(_0x229b24){_0x29449a[_0x2003('0x20')]=_0x229b24;if(_0x39f38d['query'][_0x2003('0x41')]){_0x176cae[_0x2003('0x42')]=[{'all':!![]}];}return db[_0x2003('0x2d')][_0x2003('0x43')](_0x176cae);})[_0x2003('0x25')](function(_0x1f555c){_0x29449a[_0x2003('0x44')]=_0x1f555c;return _0x29449a;})[_0x2003('0x25')](respondWithFilteredResult(_0x5929f0,_0x176cae))['catch'](handleError(_0x5929f0,null));};exports[_0x2003('0x45')]=function(_0x53cca0,_0x214b27){var _0x33b531={'raw':!![],'where':{'id':_0x53cca0[_0x2003('0x46')]['id']}},_0xa24cd0={};_0xa24cd0[_0x2003('0x34')]=_[_0x2003('0x32')](db['MailServerOut'][_0x2003('0x2e')]);_0xa24cd0[_0x2003('0x31')]=_[_0x2003('0x32')](_0x53cca0[_0x2003('0x31')]);_0xa24cd0[_0x2003('0x33')]=_[_0x2003('0x36')](_0xa24cd0['model'],_0xa24cd0[_0x2003('0x31')]);_0x33b531[_0x2003('0x35')]=_[_0x2003('0x36')](_0xa24cd0['model'],qs[_0x2003('0x37')](_0x53cca0['query'][_0x2003('0x37')]));_0x33b531[_0x2003('0x35')]=_0x33b531[_0x2003('0x35')][_0x2003('0x38')]?_0x33b531[_0x2003('0x35')]:_0xa24cd0[_0x2003('0x34')];if(_0x53cca0['query'][_0x2003('0x41')]){_0x33b531['include']=[{'all':!![]}];}_0x33b531=_[_0x2003('0x3d')]({},_0x33b531,_0x53cca0[_0x2003('0x40')]);return db[_0x2003('0x2d')][_0x2003('0x47')](_0x33b531)[_0x2003('0x25')](handleEntityNotFound(_0x214b27,null))[_0x2003('0x25')](respondWithResult(_0x214b27,null))[_0x2003('0x48')](handleError(_0x214b27,null));};exports[_0x2003('0x49')]=function(_0x4b2e55,_0x5717b1){return db['MailServerOut']['create'](_0x4b2e55[_0x2003('0x4a')],{})['then'](respondWithResult(_0x5717b1,0xc9))[_0x2003('0x48')](handleError(_0x5717b1,null));};exports[_0x2003('0x24')]=function(_0x2bc605,_0x5db7c4){if(_0x2bc605[_0x2003('0x4a')]['id']){delete _0x2bc605[_0x2003('0x4a')]['id'];}return db[_0x2003('0x2d')][_0x2003('0x47')]({'where':{'id':_0x2bc605['params']['id']}})[_0x2003('0x25')](handleEntityNotFound(_0x5db7c4,null))[_0x2003('0x25')](saveUpdates(_0x2bc605[_0x2003('0x4a')],null))['then'](respondWithResult(_0x5db7c4,null))[_0x2003('0x48')](handleError(_0x5db7c4,null));};exports['destroy']=function(_0x4e71cd,_0x4ad38c){return db[_0x2003('0x2d')][_0x2003('0x47')]({'where':{'id':_0x4e71cd[_0x2003('0x46')]['id']}})[_0x2003('0x25')](handleEntityNotFound(_0x4ad38c,null))[_0x2003('0x25')](removeEntity(_0x4ad38c,null))[_0x2003('0x48')](handleError(_0x4ad38c,null));}; \ No newline at end of file +var _0xd337=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','map','MailServerOut','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','filter','VIRTUAL','includeAll','include','findAll','catch','show','params','rawAttributes','length','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x2d502f,_0xfc1c1d){var _0x4b3516=function(_0x7b5475){while(--_0x7b5475){_0x2d502f['push'](_0x2d502f['shift']());}};_0x4b3516(++_0xfc1c1d);}(_0xd337,0xd4));var _0x7d33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd337[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7d33('0x0'));var rimraf=require(_0x7d33('0x1'));var zipdir=require(_0x7d33('0x2'));var jsonpatch=require(_0x7d33('0x3'));var rp=require(_0x7d33('0x4'));var moment=require('moment');var BPromise=require(_0x7d33('0x5'));var Mustache=require(_0x7d33('0x6'));var util=require('util');var path=require('path');var sox=require(_0x7d33('0x7'));var csv=require(_0x7d33('0x8'));var ejs=require(_0x7d33('0x9'));var fs=require('fs');var fs_extra=require(_0x7d33('0xa'));var _=require(_0x7d33('0xb'));var squel=require(_0x7d33('0xc'));var crypto=require(_0x7d33('0xd'));var jsforce=require(_0x7d33('0xe'));var deskjs=require(_0x7d33('0xf'));var toCsv=require(_0x7d33('0x8'));var querystring=require(_0x7d33('0x10'));var Papa=require('papaparse');var Redis=require(_0x7d33('0x11'));var authService=require(_0x7d33('0x12'));var qs=require(_0x7d33('0x13'));var as=require(_0x7d33('0x14'));var hardwareService=require(_0x7d33('0x15'));var logger=require(_0x7d33('0x16'))(_0x7d33('0x17'));var utils=require(_0x7d33('0x18'));var config=require(_0x7d33('0x19'));var licenseUtil=require(_0x7d33('0x1a'));var db=require(_0x7d33('0x1b'))['db'];function respondWithStatusCode(_0x299a17,_0x213f0c){_0x213f0c=_0x213f0c||0xcc;return function(_0x45c8df){if(_0x45c8df){return _0x299a17[_0x7d33('0x1c')](_0x213f0c);}return _0x299a17[_0x7d33('0x1d')](_0x213f0c)['end']();};}function respondWithResult(_0x19f528,_0x2e40a2){_0x2e40a2=_0x2e40a2||0xc8;return function(_0x229941){if(_0x229941){return _0x19f528[_0x7d33('0x1d')](_0x2e40a2)[_0x7d33('0x1e')](_0x229941);}};}function respondWithFilteredResult(_0x1fa683,_0x2578b4){return function(_0x10c74c){if(_0x10c74c){var _0x3eb08e=typeof _0x2578b4[_0x7d33('0x1f')]===_0x7d33('0x20')&&typeof _0x2578b4[_0x7d33('0x21')]==='undefined';var _0x511449=_0x10c74c[_0x7d33('0x22')];var _0x256344=_0x3eb08e?0x0:_0x2578b4[_0x7d33('0x1f')];var _0x3840af=_0x3eb08e?_0x10c74c['count']:_0x2578b4[_0x7d33('0x1f')]+_0x2578b4[_0x7d33('0x21')];var _0x380a3e;if(_0x3840af>=_0x511449){_0x3840af=_0x511449;_0x380a3e=0xc8;}else{_0x380a3e=0xce;}_0x1fa683[_0x7d33('0x1d')](_0x380a3e);return _0x1fa683[_0x7d33('0x23')](_0x7d33('0x24'),_0x256344+'-'+_0x3840af+'/'+_0x511449)[_0x7d33('0x1e')](_0x10c74c);}return null;};}function patchUpdates(_0x3e39a9){return function(_0x50bf34){try{jsonpatch[_0x7d33('0x25')](_0x50bf34,_0x3e39a9,!![]);}catch(_0x2c5ed8){return BPromise[_0x7d33('0x26')](_0x2c5ed8);}return _0x50bf34[_0x7d33('0x27')]();};}function saveUpdates(_0x44a377,_0x3e23cc){return function(_0x562438){if(_0x562438){return _0x562438[_0x7d33('0x28')](_0x44a377)['then'](function(_0x5a7464){return _0x5a7464;});}return null;};}function removeEntity(_0x5e02c5,_0x368fb4){return function(_0x391ac0){if(_0x391ac0){return _0x391ac0['destroy']()[_0x7d33('0x29')](function(){_0x5e02c5[_0x7d33('0x1d')](0xcc)[_0x7d33('0x2a')]();});}};}function handleEntityNotFound(_0x1ceb35,_0x11c91c){return function(_0x244f43){if(!_0x244f43){_0x1ceb35[_0x7d33('0x1c')](0x194);}return _0x244f43;};}function handleError(_0x4bf8f4,_0x390a34){_0x390a34=_0x390a34||0x1f4;return function(_0x2f3d3b){logger[_0x7d33('0x2b')](_0x2f3d3b[_0x7d33('0x2c')]);if(_0x2f3d3b['name']){delete _0x2f3d3b[_0x7d33('0x2d')];}_0x4bf8f4[_0x7d33('0x1d')](_0x390a34)[_0x7d33('0x2e')](_0x2f3d3b);};}exports[_0x7d33('0x2f')]=function(_0x4ce7b4,_0x1f3070){var _0x2e0779={},_0x434758={},_0xe1105e={'count':0x0,'rows':[]};var _0x3794e6=_[_0x7d33('0x30')](db[_0x7d33('0x31')]['rawAttributes'],function(_0x4f5ff0){return{'name':_0x4f5ff0[_0x7d33('0x32')],'type':_0x4f5ff0[_0x7d33('0x33')][_0x7d33('0x34')]};});_0x434758['model']=_[_0x7d33('0x30')](_0x3794e6,_0x7d33('0x2d'));_0x434758[_0x7d33('0x35')]=_[_0x7d33('0x36')](_0x4ce7b4[_0x7d33('0x35')]);_0x434758[_0x7d33('0x37')]=_[_0x7d33('0x38')](_0x434758[_0x7d33('0x39')],_0x434758[_0x7d33('0x35')]);_0x2e0779[_0x7d33('0x3a')]=_[_0x7d33('0x38')](_0x434758['model'],qs[_0x7d33('0x3b')](_0x4ce7b4[_0x7d33('0x35')][_0x7d33('0x3b')]));_0x2e0779['attributes']=_0x2e0779[_0x7d33('0x3a')]['length']?_0x2e0779[_0x7d33('0x3a')]:_0x434758['model'];if(!_0x4ce7b4['query']['hasOwnProperty'](_0x7d33('0x3c'))){_0x2e0779[_0x7d33('0x21')]=qs[_0x7d33('0x21')](_0x4ce7b4[_0x7d33('0x35')]['limit']);_0x2e0779[_0x7d33('0x1f')]=qs[_0x7d33('0x1f')](_0x4ce7b4[_0x7d33('0x35')][_0x7d33('0x1f')]);}_0x2e0779[_0x7d33('0x3d')]=qs[_0x7d33('0x3e')](_0x4ce7b4[_0x7d33('0x35')]['sort']);_0x2e0779[_0x7d33('0x3f')]=qs[_0x7d33('0x37')](_['pick'](_0x4ce7b4[_0x7d33('0x35')],_0x434758['filters']),_0x3794e6);if(_0x4ce7b4[_0x7d33('0x35')][_0x7d33('0x40')]){_0x2e0779[_0x7d33('0x3f')]=_['merge'](_0x2e0779[_0x7d33('0x3f')],{'$or':_[_0x7d33('0x30')](_0x3794e6,function(_0x2f0086){if(_0x2f0086[_0x7d33('0x33')]!==_0x7d33('0x41')){var _0x288833={};_0x288833[_0x2f0086[_0x7d33('0x2d')]]={'$like':'%'+_0x4ce7b4[_0x7d33('0x35')][_0x7d33('0x40')]+'%'};return _0x288833;}})});}_0x2e0779=_['merge']({},_0x2e0779,_0x4ce7b4['options']);var _0x1df352={'where':_0x2e0779[_0x7d33('0x3f')]};return db[_0x7d33('0x31')][_0x7d33('0x22')](_0x1df352)[_0x7d33('0x29')](function(_0xb79b04){_0xe1105e[_0x7d33('0x22')]=_0xb79b04;if(_0x4ce7b4[_0x7d33('0x35')][_0x7d33('0x42')]){_0x2e0779[_0x7d33('0x43')]=[{'all':!![]}];}return db['MailServerOut'][_0x7d33('0x44')](_0x2e0779);})[_0x7d33('0x29')](function(_0x35ead2){_0xe1105e['rows']=_0x35ead2;return _0xe1105e;})[_0x7d33('0x29')](respondWithFilteredResult(_0x1f3070,_0x2e0779))[_0x7d33('0x45')](handleError(_0x1f3070,null));};exports[_0x7d33('0x46')]=function(_0x2c18d2,_0x242696){var _0xf886ca={'raw':!![],'where':{'id':_0x2c18d2[_0x7d33('0x47')]['id']}},_0x19149f={};_0x19149f[_0x7d33('0x39')]=_['keys'](db[_0x7d33('0x31')][_0x7d33('0x48')]);_0x19149f[_0x7d33('0x35')]=_[_0x7d33('0x36')](_0x2c18d2[_0x7d33('0x35')]);_0x19149f[_0x7d33('0x37')]=_['intersection'](_0x19149f[_0x7d33('0x39')],_0x19149f[_0x7d33('0x35')]);_0xf886ca[_0x7d33('0x3a')]=_['intersection'](_0x19149f[_0x7d33('0x39')],qs[_0x7d33('0x3b')](_0x2c18d2[_0x7d33('0x35')][_0x7d33('0x3b')]));_0xf886ca[_0x7d33('0x3a')]=_0xf886ca[_0x7d33('0x3a')][_0x7d33('0x49')]?_0xf886ca[_0x7d33('0x3a')]:_0x19149f['model'];if(_0x2c18d2['query']['includeAll']){_0xf886ca['include']=[{'all':!![]}];}_0xf886ca=_['merge']({},_0xf886ca,_0x2c18d2[_0x7d33('0x4a')]);return db[_0x7d33('0x31')][_0x7d33('0x4b')](_0xf886ca)[_0x7d33('0x29')](handleEntityNotFound(_0x242696,null))[_0x7d33('0x29')](respondWithResult(_0x242696,null))['catch'](handleError(_0x242696,null));};exports[_0x7d33('0x4c')]=function(_0x3e02b5,_0x5a6ba2){return db[_0x7d33('0x31')][_0x7d33('0x4c')](_0x3e02b5['body'],{})['then'](respondWithResult(_0x5a6ba2,0xc9))[_0x7d33('0x45')](handleError(_0x5a6ba2,null));};exports[_0x7d33('0x28')]=function(_0x51a681,_0x1ab5c2){if(_0x51a681[_0x7d33('0x4d')]['id']){delete _0x51a681[_0x7d33('0x4d')]['id'];}return db[_0x7d33('0x31')][_0x7d33('0x4b')]({'where':{'id':_0x51a681[_0x7d33('0x47')]['id']}})[_0x7d33('0x29')](handleEntityNotFound(_0x1ab5c2,null))['then'](saveUpdates(_0x51a681['body'],null))['then'](respondWithResult(_0x1ab5c2,null))[_0x7d33('0x45')](handleError(_0x1ab5c2,null));};exports['destroy']=function(_0x5a9517,_0x4693cf){return db[_0x7d33('0x31')][_0x7d33('0x4b')]({'where':{'id':_0x5a9517[_0x7d33('0x47')]['id']}})[_0x7d33('0x29')](handleEntityNotFound(_0x4693cf,null))[_0x7d33('0x29')](removeEntity(_0x4693cf,null))[_0x7d33('0x45')](handleError(_0x4693cf,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 7a1e69e..4bfd9a2 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 _0x4ac2=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','mail_servers_out','lodash','util','../../config/logger'];(function(_0x532112,_0x37d94b){var _0x23e5fb=function(_0x690ac8){while(--_0x690ac8){_0x532112['push'](_0x532112['shift']());}};_0x23e5fb(++_0x37d94b);}(_0x4ac2,0xf9));var _0x24ac=function(_0x313bb3,_0x5af89c){_0x313bb3=_0x313bb3-0x0;var _0x19ef94=_0x4ac2[_0x313bb3];return _0x19ef94;};'use strict';var _=require(_0x24ac('0x0'));var util=require(_0x24ac('0x1'));var logger=require(_0x24ac('0x2'))(_0x24ac('0x3'));var moment=require(_0x24ac('0x4'));var BPromise=require(_0x24ac('0x5'));var rp=require(_0x24ac('0x6'));var fs=require('fs');var path=require(_0x24ac('0x7'));var rimraf=require(_0x24ac('0x8'));var config=require(_0x24ac('0x9'));var attributes=require(_0x24ac('0xa'));module[_0x24ac('0xb')]=function(_0x3728b3,_0x1b9a2e){return _0x3728b3[_0x24ac('0xc')]('MailServerOut',attributes,{'tableName':_0x24ac('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc6fa=['lodash','../../config/logger','api','moment','request-promise','../../config/environment','./mailServerOut.attributes','exports','define','mail_servers_out'];(function(_0x541359,_0x173c93){var _0x944095=function(_0x5f33a7){while(--_0x5f33a7){_0x541359['push'](_0x541359['shift']());}};_0x944095(++_0x173c93);}(_0xc6fa,0x154));var _0xac6f=function(_0x56e4e7,_0x1db098){_0x56e4e7=_0x56e4e7-0x0;var _0x383618=_0xc6fa[_0x56e4e7];return _0x383618;};'use strict';var _=require(_0xac6f('0x0'));var util=require('util');var logger=require(_0xac6f('0x1'))(_0xac6f('0x2'));var moment=require(_0xac6f('0x3'));var BPromise=require('bluebird');var rp=require(_0xac6f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac6f('0x5'));var attributes=require(_0xac6f('0x6'));module[_0xac6f('0x7')]=function(_0x9820bc,_0x206b74){return _0x9820bc[_0xac6f('0x8')]('MailServerOut',attributes,{'tableName':_0xac6f('0x9'),'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 d146446..0a289b2 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x4c7f6f,_0x31abaf){var _0xa0959a=function(_0x47984f){while(--_0x47984f){_0x4c7f6f['push'](_0x4c7f6f['shift']());}};_0xa0959a(++_0x31abaf);}(_0xdb28,0x106));var _0x8db2=function(_0x1d6d11,_0x19b0d3){_0x1d6d11=_0x1d6d11-0x0;var _0x15d006=_0xdb28[_0x1d6d11];return _0x15d006;};'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')]('MailServerOut,\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);});});} \ No newline at end of file +var _0x7a54=['info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x134976,_0x5275fc){_0x134976=_0x134976-0x0;var _0x419de9=_0x7a54[_0x134976];return _0x419de9;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 64902ea..a018426 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 _0xed0f=['get','/:id','show','post','isAuthenticated','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','index','/describe','describe'];(function(_0x4924ae,_0x1dd735){var _0x2238e4=function(_0x48dc88){while(--_0x48dc88){_0x4924ae['push'](_0x4924ae['shift']());}};_0x2238e4(++_0x1dd735);}(_0xed0f,0x1bf));var _0xfed0=function(_0x367d6a,_0x22c648){_0x367d6a=_0x367d6a-0x0;var _0x1dc991=_0xed0f[_0x367d6a];return _0x1dc991;};'use strict';var multer=require(_0xfed0('0x0'));var util=require(_0xfed0('0x1'));var path=require(_0xfed0('0x2'));var timeout=require(_0xfed0('0x3'));var express=require(_0xfed0('0x4'));var router=express['Router']();var fs_extra=require(_0xfed0('0x5'));var auth=require(_0xfed0('0x6'));var interaction=require(_0xfed0('0x7'));var config=require(_0xfed0('0x8'));var controller=require(_0xfed0('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xfed0('0xa')]);router['get'](_0xfed0('0xb'),auth['isAuthenticated'](),controller[_0xfed0('0xc')]);router[_0xfed0('0xd')](_0xfed0('0xe'),auth['isAuthenticated'](),controller[_0xfed0('0xf')]);router[_0xfed0('0x10')]('/',auth[_0xfed0('0x11')](),controller['create']);router[_0xfed0('0x12')]('/:id',auth[_0xfed0('0x11')](),controller[_0xfed0('0x13')]);router[_0xfed0('0x14')](_0xfed0('0xe'),auth[_0xfed0('0x11')](),controller[_0xfed0('0x15')]);module[_0xfed0('0x16')]=router; \ No newline at end of file +var _0xb61a=['exports','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x5e8eae,_0x4f81e0){var _0xdd09cd=function(_0x28c85c){while(--_0x28c85c){_0x5e8eae['push'](_0x5e8eae['shift']());}};_0xdd09cd(++_0x4f81e0);}(_0xb61a,0x191));var _0xab61=function(_0x4f4423,_0x386f87){_0x4f4423=_0x4f4423-0x0;var _0x196fa7=_0xb61a[_0x4f4423];return _0x196fa7;};'use strict';var multer=require('multer');var util=require(_0xab61('0x0'));var path=require(_0xab61('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xab61('0x2')]();var fs_extra=require(_0xab61('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xab61('0x4'));var config=require(_0xab61('0x5'));var controller=require('./mailSubstatus.controller');router[_0xab61('0x6')]('/',auth[_0xab61('0x7')](),controller[_0xab61('0x8')]);router[_0xab61('0x6')](_0xab61('0x9'),auth['isAuthenticated'](),controller[_0xab61('0xa')]);router[_0xab61('0x6')](_0xab61('0xb'),auth[_0xab61('0x7')](),controller[_0xab61('0xc')]);router[_0xab61('0xd')]('/',auth['isAuthenticated'](),controller[_0xab61('0xe')]);router[_0xab61('0xf')](_0xab61('0xb'),auth[_0xab61('0x7')](),controller[_0xab61('0x10')]);router[_0xab61('0x11')](_0xab61('0xb'),auth['isAuthenticated'](),controller[_0xab61('0x12')]);module[_0xab61('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 9407e19..9f53552 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 _0xa46e=['name','STRING','sequelize','exports'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0xa46e,0x8a));var _0xea46=function(_0x492535,_0x46524a){_0x492535=_0x492535-0x0;var _0x256620=_0xa46e[_0x492535];return _0x256620;};'use strict';var Sequelize=require(_0xea46('0x0'));module[_0xea46('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xea46('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xea46('0x3')]}}; \ No newline at end of file +var _0x038b=['exports','STRING','name'];(function(_0x38045f,_0x551f77){var _0xfd4f8c=function(_0x362607){while(--_0x362607){_0x38045f['push'](_0x38045f['shift']());}};_0xfd4f8c(++_0x551f77);}(_0x038b,0x114));var _0xb038=function(_0x345982,_0x2a8a75){_0x345982=_0x345982-0x0;var _0x347530=_0x038b[_0x345982];return _0x347530;};'use strict';var Sequelize=require('sequelize');module[_0xb038('0x0')]={'name':{'type':Sequelize[_0xb038('0x1')],'unique':_0xb038('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 2f3e15c..d2ae28f 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 _0x2cde=['order','sort','where','filters','pick','filter','VIRTUAL','merge','MailSubstatus','include','findAll','rows','catch','show','params','keys','options','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','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','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','reject','save','then','destroy','error','name','send','index','rawAttributes','type','key','map','query','model','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2cde,0xf5));var _0xe2cd=function(_0x11c8eb,_0x1ddaf6){_0x11c8eb=_0x11c8eb-0x0;var _0x1dea92=_0x2cde[_0x11c8eb];return _0x1dea92;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe2cd('0x0'));var zipdir=require(_0xe2cd('0x1'));var jsonpatch=require(_0xe2cd('0x2'));var rp=require(_0xe2cd('0x3'));var moment=require(_0xe2cd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe2cd('0x5'));var util=require(_0xe2cd('0x6'));var path=require(_0xe2cd('0x7'));var sox=require(_0xe2cd('0x8'));var csv=require(_0xe2cd('0x9'));var ejs=require(_0xe2cd('0xa'));var fs=require('fs');var fs_extra=require(_0xe2cd('0xb'));var _=require(_0xe2cd('0xc'));var squel=require(_0xe2cd('0xd'));var crypto=require('crypto');var jsforce=require(_0xe2cd('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe2cd('0xf'));var Papa=require(_0xe2cd('0x10'));var Redis=require(_0xe2cd('0x11'));var authService=require(_0xe2cd('0x12'));var qs=require(_0xe2cd('0x13'));var as=require(_0xe2cd('0x14'));var hardwareService=require(_0xe2cd('0x15'));var logger=require(_0xe2cd('0x16'))(_0xe2cd('0x17'));var utils=require(_0xe2cd('0x18'));var config=require(_0xe2cd('0x19'));var licenseUtil=require(_0xe2cd('0x1a'));var db=require(_0xe2cd('0x1b'))['db'];function respondWithStatusCode(_0x1e9834,_0x1d5057){_0x1d5057=_0x1d5057||0xcc;return function(_0x12d601){if(_0x12d601){return _0x1e9834[_0xe2cd('0x1c')](_0x1d5057);}return _0x1e9834[_0xe2cd('0x1d')](_0x1d5057)[_0xe2cd('0x1e')]();};}function respondWithResult(_0x1b7fb8,_0x322f48){_0x322f48=_0x322f48||0xc8;return function(_0x294824){if(_0x294824){return _0x1b7fb8[_0xe2cd('0x1d')](_0x322f48)['json'](_0x294824);}};}function respondWithFilteredResult(_0x787638,_0x392116){return function(_0x3eb183){if(_0x3eb183){var _0x229e01=typeof _0x392116[_0xe2cd('0x1f')]==='undefined'&&typeof _0x392116[_0xe2cd('0x20')]===_0xe2cd('0x21');var _0x47f38b=_0x3eb183[_0xe2cd('0x22')];var _0x47cae6=_0x229e01?0x0:_0x392116[_0xe2cd('0x1f')];var _0x31437a=_0x229e01?_0x3eb183['count']:_0x392116[_0xe2cd('0x1f')]+_0x392116[_0xe2cd('0x20')];var _0x1f37f4;if(_0x31437a>=_0x47f38b){_0x31437a=_0x47f38b;_0x1f37f4=0xc8;}else{_0x1f37f4=0xce;}_0x787638[_0xe2cd('0x1d')](_0x1f37f4);return _0x787638[_0xe2cd('0x23')]('Content-Range',_0x47cae6+'-'+_0x31437a+'/'+_0x47f38b)['json'](_0x3eb183);}return null;};}function patchUpdates(_0x5202d6){return function(_0x31a7fe){try{jsonpatch['apply'](_0x31a7fe,_0x5202d6,!![]);}catch(_0x3b0cbc){return BPromise[_0xe2cd('0x24')](_0x3b0cbc);}return _0x31a7fe[_0xe2cd('0x25')]();};}function saveUpdates(_0xcd913b,_0x4d1d29){return function(_0x4055af){if(_0x4055af){return _0x4055af['update'](_0xcd913b)[_0xe2cd('0x26')](function(_0x6454fd){return _0x6454fd;});}return null;};}function removeEntity(_0x5cbad8,_0x4baabe){return function(_0x37b663){if(_0x37b663){return _0x37b663[_0xe2cd('0x27')]()['then'](function(){_0x5cbad8[_0xe2cd('0x1d')](0xcc)[_0xe2cd('0x1e')]();});}};}function handleEntityNotFound(_0x4284fc,_0x3066c6){return function(_0x3b3e53){if(!_0x3b3e53){_0x4284fc['sendStatus'](0x194);}return _0x3b3e53;};}function handleError(_0x1eb186,_0x235a8f){_0x235a8f=_0x235a8f||0x1f4;return function(_0x42e184){logger[_0xe2cd('0x28')](_0x42e184['stack']);if(_0x42e184[_0xe2cd('0x29')]){delete _0x42e184[_0xe2cd('0x29')];}_0x1eb186[_0xe2cd('0x1d')](_0x235a8f)[_0xe2cd('0x2a')](_0x42e184);};}exports[_0xe2cd('0x2b')]=function(_0x5588ad,_0x540bf2){var _0x445af6={},_0x57d365={},_0x4ea846={'count':0x0,'rows':[]};var _0x397489=_['map'](db['MailSubstatus'][_0xe2cd('0x2c')],function(_0x21c5a5){return{'name':_0x21c5a5['fieldName'],'type':_0x21c5a5[_0xe2cd('0x2d')][_0xe2cd('0x2e')]};});_0x57d365['model']=_[_0xe2cd('0x2f')](_0x397489,_0xe2cd('0x29'));_0x57d365[_0xe2cd('0x30')]=_['keys'](_0x5588ad['query']);_0x57d365['filters']=_['intersection'](_0x57d365[_0xe2cd('0x31')],_0x57d365[_0xe2cd('0x30')]);_0x445af6[_0xe2cd('0x32')]=_[_0xe2cd('0x33')](_0x57d365[_0xe2cd('0x31')],qs[_0xe2cd('0x34')](_0x5588ad['query'][_0xe2cd('0x34')]));_0x445af6[_0xe2cd('0x32')]=_0x445af6['attributes'][_0xe2cd('0x35')]?_0x445af6[_0xe2cd('0x32')]:_0x57d365['model'];if(!_0x5588ad[_0xe2cd('0x30')][_0xe2cd('0x36')]('nolimit')){_0x445af6[_0xe2cd('0x20')]=qs[_0xe2cd('0x20')](_0x5588ad[_0xe2cd('0x30')][_0xe2cd('0x20')]);_0x445af6['offset']=qs[_0xe2cd('0x1f')](_0x5588ad['query'][_0xe2cd('0x1f')]);}_0x445af6[_0xe2cd('0x37')]=qs[_0xe2cd('0x38')](_0x5588ad[_0xe2cd('0x30')][_0xe2cd('0x38')]);_0x445af6[_0xe2cd('0x39')]=qs[_0xe2cd('0x3a')](_[_0xe2cd('0x3b')](_0x5588ad[_0xe2cd('0x30')],_0x57d365[_0xe2cd('0x3a')]),_0x397489);if(_0x5588ad[_0xe2cd('0x30')][_0xe2cd('0x3c')]){_0x445af6['where']=_['merge'](_0x445af6['where'],{'$or':_[_0xe2cd('0x2f')](_0x397489,function(_0x2abac7){if(_0x2abac7['type']!==_0xe2cd('0x3d')){var _0x2bf381={};_0x2bf381[_0x2abac7[_0xe2cd('0x29')]]={'$like':'%'+_0x5588ad[_0xe2cd('0x30')][_0xe2cd('0x3c')]+'%'};return _0x2bf381;}})});}_0x445af6=_[_0xe2cd('0x3e')]({},_0x445af6,_0x5588ad['options']);var _0x142895={'where':_0x445af6['where']};return db[_0xe2cd('0x3f')][_0xe2cd('0x22')](_0x142895)[_0xe2cd('0x26')](function(_0x270e7d){_0x4ea846[_0xe2cd('0x22')]=_0x270e7d;if(_0x5588ad[_0xe2cd('0x30')]['includeAll']){_0x445af6[_0xe2cd('0x40')]=[{'all':!![]}];}return db[_0xe2cd('0x3f')][_0xe2cd('0x41')](_0x445af6);})[_0xe2cd('0x26')](function(_0x246653){_0x4ea846[_0xe2cd('0x42')]=_0x246653;return _0x4ea846;})['then'](respondWithFilteredResult(_0x540bf2,_0x445af6))[_0xe2cd('0x43')](handleError(_0x540bf2,null));};exports[_0xe2cd('0x44')]=function(_0x3931a2,_0x20ca81){var _0x45d452={'raw':!![],'where':{'id':_0x3931a2[_0xe2cd('0x45')]['id']}},_0x2386cb={};_0x2386cb[_0xe2cd('0x31')]=_[_0xe2cd('0x46')](db[_0xe2cd('0x3f')][_0xe2cd('0x2c')]);_0x2386cb[_0xe2cd('0x30')]=_[_0xe2cd('0x46')](_0x3931a2['query']);_0x2386cb['filters']=_['intersection'](_0x2386cb[_0xe2cd('0x31')],_0x2386cb[_0xe2cd('0x30')]);_0x45d452[_0xe2cd('0x32')]=_[_0xe2cd('0x33')](_0x2386cb['model'],qs[_0xe2cd('0x34')](_0x3931a2[_0xe2cd('0x30')][_0xe2cd('0x34')]));_0x45d452[_0xe2cd('0x32')]=_0x45d452['attributes'][_0xe2cd('0x35')]?_0x45d452['attributes']:_0x2386cb[_0xe2cd('0x31')];if(_0x3931a2['query']['includeAll']){_0x45d452['include']=[{'all':!![]}];}_0x45d452=_[_0xe2cd('0x3e')]({},_0x45d452,_0x3931a2[_0xe2cd('0x47')]);return db[_0xe2cd('0x3f')]['find'](_0x45d452)[_0xe2cd('0x26')](handleEntityNotFound(_0x20ca81,null))[_0xe2cd('0x26')](respondWithResult(_0x20ca81,null))[_0xe2cd('0x43')](handleError(_0x20ca81,null));};exports[_0xe2cd('0x48')]=function(_0x5b41a0,_0x5a7e0e){return db[_0xe2cd('0x3f')][_0xe2cd('0x48')](_0x5b41a0[_0xe2cd('0x49')],{})[_0xe2cd('0x26')](respondWithResult(_0x5a7e0e,0xc9))['catch'](handleError(_0x5a7e0e,null));};exports[_0xe2cd('0x4a')]=function(_0x12946c,_0x594305){if(_0x12946c[_0xe2cd('0x49')]['id']){delete _0x12946c[_0xe2cd('0x49')]['id'];}return db[_0xe2cd('0x3f')]['find']({'where':{'id':_0x12946c['params']['id']}})[_0xe2cd('0x26')](handleEntityNotFound(_0x594305,null))[_0xe2cd('0x26')](saveUpdates(_0x12946c[_0xe2cd('0x49')],null))[_0xe2cd('0x26')](respondWithResult(_0x594305,null))[_0xe2cd('0x43')](handleError(_0x594305,null));};exports[_0xe2cd('0x27')]=function(_0x3db627,_0xdeaaeb){return db['MailSubstatus']['find']({'where':{'id':_0x3db627['params']['id']}})[_0xe2cd('0x26')](handleEntityNotFound(_0xdeaaeb,null))[_0xe2cd('0x26')](removeEntity(_0xdeaaeb,null))[_0xe2cd('0x43')](handleError(_0xdeaaeb,null));};exports['describe']=function(_0x5155d9,_0x47d36f){return db['MailSubstatus']['describe']()['then'](respondWithResult(_0x47d36f,null))[_0xe2cd('0x43')](handleError(_0x47d36f,null));}; \ No newline at end of file +var _0x1fd2=['rawAttributes','key','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','filter','merge','type','VIRTUAL','count','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','then','destroy','sendStatus','error','stack','name','index','map','MailSubstatus'];(function(_0x10e50c,_0x1fe321){var _0x311805=function(_0x3a422c){while(--_0x3a422c){_0x10e50c['push'](_0x10e50c['shift']());}};_0x311805(++_0x1fe321);}(_0x1fd2,0xaa));var _0x21fd=function(_0x3572eb,_0x13c85f){_0x3572eb=_0x3572eb-0x0;var _0x731632=_0x1fd2[_0x3572eb];return _0x731632;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x21fd('0x0'));var zipdir=require(_0x21fd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x21fd('0x2'));var moment=require(_0x21fd('0x3'));var BPromise=require(_0x21fd('0x4'));var Mustache=require('mustache');var util=require(_0x21fd('0x5'));var path=require(_0x21fd('0x6'));var sox=require(_0x21fd('0x7'));var csv=require(_0x21fd('0x8'));var ejs=require(_0x21fd('0x9'));var fs=require('fs');var fs_extra=require(_0x21fd('0xa'));var _=require(_0x21fd('0xb'));var squel=require(_0x21fd('0xc'));var crypto=require('crypto');var jsforce=require(_0x21fd('0xd'));var deskjs=require(_0x21fd('0xe'));var toCsv=require(_0x21fd('0x8'));var querystring=require('querystring');var Papa=require(_0x21fd('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x21fd('0x10'));var hardwareService=require(_0x21fd('0x11'));var logger=require(_0x21fd('0x12'))(_0x21fd('0x13'));var utils=require(_0x21fd('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d2aa6,_0x163013){_0x163013=_0x163013||0xcc;return function(_0x9e5ff4){if(_0x9e5ff4){return _0x3d2aa6['sendStatus'](_0x163013);}return _0x3d2aa6[_0x21fd('0x15')](_0x163013)[_0x21fd('0x16')]();};}function respondWithResult(_0x1bb926,_0x1f1fd5){_0x1f1fd5=_0x1f1fd5||0xc8;return function(_0x3da1c4){if(_0x3da1c4){return _0x1bb926[_0x21fd('0x15')](_0x1f1fd5)[_0x21fd('0x17')](_0x3da1c4);}};}function respondWithFilteredResult(_0x3b55ca,_0x2cf90a){return function(_0x130008){if(_0x130008){var _0x4b8fbf=typeof _0x2cf90a[_0x21fd('0x18')]===_0x21fd('0x19')&&typeof _0x2cf90a['limit']==='undefined';var _0x5a348b=_0x130008['count'];var _0x3fedd2=_0x4b8fbf?0x0:_0x2cf90a['offset'];var _0x50aa6b=_0x4b8fbf?_0x130008['count']:_0x2cf90a[_0x21fd('0x18')]+_0x2cf90a[_0x21fd('0x1a')];var _0x2f9aea;if(_0x50aa6b>=_0x5a348b){_0x50aa6b=_0x5a348b;_0x2f9aea=0xc8;}else{_0x2f9aea=0xce;}_0x3b55ca[_0x21fd('0x15')](_0x2f9aea);return _0x3b55ca[_0x21fd('0x1b')](_0x21fd('0x1c'),_0x3fedd2+'-'+_0x50aa6b+'/'+_0x5a348b)[_0x21fd('0x17')](_0x130008);}return null;};}function patchUpdates(_0x47ed67){return function(_0x2b7fa7){try{jsonpatch['apply'](_0x2b7fa7,_0x47ed67,!![]);}catch(_0x6a3f4c){return BPromise[_0x21fd('0x1d')](_0x6a3f4c);}return _0x2b7fa7[_0x21fd('0x1e')]();};}function saveUpdates(_0x2f5659,_0x2ca913){return function(_0x747459){if(_0x747459){return _0x747459['update'](_0x2f5659)[_0x21fd('0x1f')](function(_0x4969ce){return _0x4969ce;});}return null;};}function removeEntity(_0x2dcf78,_0x1cecb9){return function(_0x171593){if(_0x171593){return _0x171593[_0x21fd('0x20')]()[_0x21fd('0x1f')](function(){_0x2dcf78['status'](0xcc)[_0x21fd('0x16')]();});}};}function handleEntityNotFound(_0x2cccfb,_0x578d57){return function(_0x176c33){if(!_0x176c33){_0x2cccfb[_0x21fd('0x21')](0x194);}return _0x176c33;};}function handleError(_0x2e0654,_0xf61487){_0xf61487=_0xf61487||0x1f4;return function(_0x473dd9){logger[_0x21fd('0x22')](_0x473dd9[_0x21fd('0x23')]);if(_0x473dd9[_0x21fd('0x24')]){delete _0x473dd9['name'];}_0x2e0654[_0x21fd('0x15')](_0xf61487)['send'](_0x473dd9);};}exports[_0x21fd('0x25')]=function(_0x119125,_0x58aae8){var _0x449d82={},_0x5a7140={},_0x418139={'count':0x0,'rows':[]};var _0x122033=_[_0x21fd('0x26')](db[_0x21fd('0x27')][_0x21fd('0x28')],function(_0xdc6a4){return{'name':_0xdc6a4['fieldName'],'type':_0xdc6a4['type'][_0x21fd('0x29')]};});_0x5a7140['model']=_[_0x21fd('0x26')](_0x122033,_0x21fd('0x24'));_0x5a7140['query']=_['keys'](_0x119125[_0x21fd('0x2a')]);_0x5a7140[_0x21fd('0x2b')]=_[_0x21fd('0x2c')](_0x5a7140[_0x21fd('0x2d')],_0x5a7140['query']);_0x449d82[_0x21fd('0x2e')]=_[_0x21fd('0x2c')](_0x5a7140[_0x21fd('0x2d')],qs[_0x21fd('0x2f')](_0x119125[_0x21fd('0x2a')][_0x21fd('0x2f')]));_0x449d82[_0x21fd('0x2e')]=_0x449d82[_0x21fd('0x2e')][_0x21fd('0x30')]?_0x449d82[_0x21fd('0x2e')]:_0x5a7140[_0x21fd('0x2d')];if(!_0x119125[_0x21fd('0x2a')]['hasOwnProperty'](_0x21fd('0x31'))){_0x449d82[_0x21fd('0x1a')]=qs[_0x21fd('0x1a')](_0x119125[_0x21fd('0x2a')][_0x21fd('0x1a')]);_0x449d82['offset']=qs[_0x21fd('0x18')](_0x119125[_0x21fd('0x2a')][_0x21fd('0x18')]);}_0x449d82['order']=qs[_0x21fd('0x32')](_0x119125[_0x21fd('0x2a')][_0x21fd('0x32')]);_0x449d82[_0x21fd('0x33')]=qs[_0x21fd('0x2b')](_['pick'](_0x119125['query'],_0x5a7140[_0x21fd('0x2b')]),_0x122033);if(_0x119125[_0x21fd('0x2a')][_0x21fd('0x34')]){_0x449d82[_0x21fd('0x33')]=_[_0x21fd('0x35')](_0x449d82[_0x21fd('0x33')],{'$or':_['map'](_0x122033,function(_0x384a86){if(_0x384a86[_0x21fd('0x36')]!==_0x21fd('0x37')){var _0xbe9f0d={};_0xbe9f0d[_0x384a86[_0x21fd('0x24')]]={'$like':'%'+_0x119125[_0x21fd('0x2a')][_0x21fd('0x34')]+'%'};return _0xbe9f0d;}})});}_0x449d82=_['merge']({},_0x449d82,_0x119125['options']);var _0x5c984f={'where':_0x449d82['where']};return db['MailSubstatus'][_0x21fd('0x38')](_0x5c984f)[_0x21fd('0x1f')](function(_0x5dcbd8){_0x418139['count']=_0x5dcbd8;if(_0x119125[_0x21fd('0x2a')][_0x21fd('0x39')]){_0x449d82[_0x21fd('0x3a')]=[{'all':!![]}];}return db['MailSubstatus'][_0x21fd('0x3b')](_0x449d82);})[_0x21fd('0x1f')](function(_0x595ab5){_0x418139[_0x21fd('0x3c')]=_0x595ab5;return _0x418139;})['then'](respondWithFilteredResult(_0x58aae8,_0x449d82))['catch'](handleError(_0x58aae8,null));};exports[_0x21fd('0x3d')]=function(_0x1aad0b,_0x5a3917){var _0x485395={'raw':!![],'where':{'id':_0x1aad0b[_0x21fd('0x3e')]['id']}},_0x3b8a5e={};_0x3b8a5e[_0x21fd('0x2d')]=_[_0x21fd('0x3f')](db[_0x21fd('0x27')][_0x21fd('0x28')]);_0x3b8a5e[_0x21fd('0x2a')]=_[_0x21fd('0x3f')](_0x1aad0b[_0x21fd('0x2a')]);_0x3b8a5e[_0x21fd('0x2b')]=_['intersection'](_0x3b8a5e['model'],_0x3b8a5e[_0x21fd('0x2a')]);_0x485395[_0x21fd('0x2e')]=_[_0x21fd('0x2c')](_0x3b8a5e[_0x21fd('0x2d')],qs[_0x21fd('0x2f')](_0x1aad0b[_0x21fd('0x2a')][_0x21fd('0x2f')]));_0x485395['attributes']=_0x485395['attributes'][_0x21fd('0x30')]?_0x485395[_0x21fd('0x2e')]:_0x3b8a5e[_0x21fd('0x2d')];if(_0x1aad0b[_0x21fd('0x2a')][_0x21fd('0x39')]){_0x485395[_0x21fd('0x3a')]=[{'all':!![]}];}_0x485395=_[_0x21fd('0x35')]({},_0x485395,_0x1aad0b[_0x21fd('0x40')]);return db['MailSubstatus'][_0x21fd('0x41')](_0x485395)[_0x21fd('0x1f')](handleEntityNotFound(_0x5a3917,null))[_0x21fd('0x1f')](respondWithResult(_0x5a3917,null))[_0x21fd('0x42')](handleError(_0x5a3917,null));};exports[_0x21fd('0x43')]=function(_0x57a2f3,_0x14e5bf){return db['MailSubstatus'][_0x21fd('0x43')](_0x57a2f3[_0x21fd('0x44')],{})[_0x21fd('0x1f')](respondWithResult(_0x14e5bf,0xc9))[_0x21fd('0x42')](handleError(_0x14e5bf,null));};exports['update']=function(_0x1bcd4b,_0x151373){if(_0x1bcd4b[_0x21fd('0x44')]['id']){delete _0x1bcd4b[_0x21fd('0x44')]['id'];}return db[_0x21fd('0x27')][_0x21fd('0x41')]({'where':{'id':_0x1bcd4b[_0x21fd('0x3e')]['id']}})['then'](handleEntityNotFound(_0x151373,null))[_0x21fd('0x1f')](saveUpdates(_0x1bcd4b[_0x21fd('0x44')],null))['then'](respondWithResult(_0x151373,null))[_0x21fd('0x42')](handleError(_0x151373,null));};exports['destroy']=function(_0x382576,_0x4a0418){return db[_0x21fd('0x27')][_0x21fd('0x41')]({'where':{'id':_0x382576[_0x21fd('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4a0418,null))[_0x21fd('0x1f')](removeEntity(_0x4a0418,null))[_0x21fd('0x42')](handleError(_0x4a0418,null));};exports[_0x21fd('0x45')]=function(_0x428244,_0x41836e){return db[_0x21fd('0x27')][_0x21fd('0x45')]()[_0x21fd('0x1f')](respondWithResult(_0x41836e,null))[_0x21fd('0x42')](handleError(_0x41836e,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index a5a805f..062a46d 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 _0xaa98=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailSubstatus','setMaxListeners','update'];(function(_0x35237c,_0x32935b){var _0x37226b=function(_0x5ee637){while(--_0x5ee637){_0x35237c['push'](_0x35237c['shift']());}};_0x37226b(++_0x32935b);}(_0xaa98,0x1ab));var _0x8aa9=function(_0x437227,_0x242fda){_0x437227=_0x437227-0x0;var _0x17e1e6=_0xaa98[_0x437227];return _0x17e1e6;};'use strict';var EventEmitter=require(_0x8aa9('0x0'));var MailSubstatus=require(_0x8aa9('0x1'))['db'][_0x8aa9('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x8aa9('0x3')](0x0);var events={'afterUpdate':_0x8aa9('0x4')};function emitEvent(_0x595548){return function(_0x39282a,_0xfe0268,_0xd72ac0){MailSubstatusEvents['emit'](_0x595548+':'+_0x39282a['id'],_0x39282a);MailSubstatusEvents[_0x8aa9('0x5')](_0x595548,_0x39282a);_0xd72ac0(null);};}for(var e in events){if(events[_0x8aa9('0x6')](e)){var event=events[e];MailSubstatus[_0x8aa9('0x7')](e,emitEvent(event));}}module[_0x8aa9('0x8')]=MailSubstatusEvents; \ No newline at end of file +var _0x4f33=['exports','events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x2b4acc,_0x165295){var _0x101262=function(_0x179937){while(--_0x179937){_0x2b4acc['push'](_0x2b4acc['shift']());}};_0x101262(++_0x165295);}(_0x4f33,0xc7));var _0x34f3=function(_0x53afa6,_0x59e786){_0x53afa6=_0x53afa6-0x0;var _0x51f86a=_0x4f33[_0x53afa6];return _0x51f86a;};'use strict';var EventEmitter=require(_0x34f3('0x0'));var MailSubstatus=require(_0x34f3('0x1'))['db'][_0x34f3('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x34f3('0x3')](0x0);var events={'afterUpdate':_0x34f3('0x4')};function emitEvent(_0xaab4ef){return function(_0x33fb7d,_0x14d602,_0x58d51a){MailSubstatusEvents[_0x34f3('0x5')](_0xaab4ef+':'+_0x33fb7d['id'],_0x33fb7d);MailSubstatusEvents[_0x34f3('0x5')](_0xaab4ef,_0x33fb7d);_0x58d51a(null);};}for(var e in events){if(events[_0x34f3('0x6')](e)){var event=events[e];MailSubstatus[_0x34f3('0x7')](e,emitEvent(event));}}module[_0x34f3('0x8')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 05d3a4d..52a098b 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 _0x2d76=['define','MailSubstatus','mail_substatuses','Condition','update','name','mailSubstatus','_previousDataValues','then','catch','exports','models'];(function(_0x2a5f2f,_0x5ee8e9){var _0x1a678f=function(_0x3ec12c){while(--_0x3ec12c){_0x2a5f2f['push'](_0x2a5f2f['shift']());}};_0x1a678f(++_0x5ee8e9);}(_0x2d76,0x15a));var _0x62d7=function(_0x323590,_0x3211db){_0x323590=_0x323590-0x0;var _0x246383=_0x2d76[_0x323590];return _0x246383;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x62d7('0x0')]=function(_0x5eb546){var _0x38cfed=_0x5eb546[_0x62d7('0x1')];return _0x5eb546[_0x62d7('0x2')](_0x62d7('0x3'),attributes,{'tableName':_0x62d7('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x5955cd,_0x23d20c,_0x42eaa9){return _0x38cfed[_0x62d7('0x5')][_0x62d7('0x6')]({'value':_0x5955cd[_0x62d7('0x7')]},{'where':{'field':_0x62d7('0x8'),'value':_0x5955cd[_0x62d7('0x9')][_0x62d7('0x7')]}})[_0x62d7('0xa')](function(){_0x42eaa9();})[_0x62d7('0xb')](function(_0x337da7){_0x42eaa9(_0x337da7);});}}});}; \ No newline at end of file +var _0x4077=['name','./mailSubstatus.attributes','exports','models','define','MailSubstatus','mail_substatuses','mailSubstatus','_previousDataValues'];(function(_0x3e07eb,_0x58a4a1){var _0x4f24ce=function(_0x48f3c4){while(--_0x48f3c4){_0x3e07eb['push'](_0x3e07eb['shift']());}};_0x4f24ce(++_0x58a4a1);}(_0x4077,0xa3));var _0x7407=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4077[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require(_0x7407('0x0'));module[_0x7407('0x1')]=function(_0x2cb396){var _0x4e16ab=_0x2cb396[_0x7407('0x2')];return _0x2cb396[_0x7407('0x3')](_0x7407('0x4'),attributes,{'tableName':_0x7407('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x25553d,_0x43e4b9,_0x4c7bf1){return _0x4e16ab['Condition']['update']({'value':_0x25553d['name']},{'where':{'field':_0x7407('0x6'),'value':_0x25553d[_0x7407('0x7')][_0x7407('0x8')]}})['then'](function(){_0x4c7bf1();})['catch'](function(_0x3bc059){_0x4c7bf1(_0x3bc059);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index b6d9bc0..84c74a3 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 _0xaa96=['http','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x21df06,_0x5bd172){var _0x3fb672=function(_0xda1c0e){while(--_0xda1c0e){_0x21df06['push'](_0x21df06['shift']());}};_0x3fb672(++_0x5bd172);}(_0xaa96,0x145));var _0x6aa9=function(_0x152e4c,_0x2b1261){_0x152e4c=_0x152e4c-0x0;var _0x38ae52=_0xaa96[_0x152e4c];return _0x38ae52;};'use strict';var _=require('lodash');var util=require(_0x6aa9('0x0'));var moment=require(_0x6aa9('0x1'));var BPromise=require(_0x6aa9('0x2'));var rs=require(_0x6aa9('0x3'));var fs=require('fs');var Redis=require(_0x6aa9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6aa9('0x5'));var logger=require(_0x6aa9('0x6'))(_0x6aa9('0x7'));var config=require(_0x6aa9('0x8'));var jayson=require(_0x6aa9('0x9'));var client=jayson[_0x6aa9('0xa')][_0x6aa9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x922843,_0x38ea05,_0x542cbd){return new BPromise(function(_0x5d2a68,_0x13cc3d){return client[_0x6aa9('0xc')](_0x922843,_0x542cbd)['then'](function(_0x108f37){logger[_0x6aa9('0xd')](_0x6aa9('0xe'),_0x38ea05,_0x6aa9('0xf'));logger[_0x6aa9('0x10')](_0x6aa9('0x11'),_0x38ea05,_0x6aa9('0xf'),JSON[_0x6aa9('0x12')](_0x108f37));if(_0x108f37[_0x6aa9('0x13')]){if(_0x108f37[_0x6aa9('0x13')][_0x6aa9('0x14')]===0x1f4){logger[_0x6aa9('0x13')](_0x6aa9('0xe'),_0x38ea05,_0x108f37[_0x6aa9('0x13')][_0x6aa9('0x15')]);return _0x13cc3d(_0x108f37[_0x6aa9('0x13')][_0x6aa9('0x15')]);}logger['error'](_0x6aa9('0xe'),_0x38ea05,_0x108f37[_0x6aa9('0x13')][_0x6aa9('0x15')]);return _0x5d2a68(_0x108f37['error'][_0x6aa9('0x15')]);}else{logger[_0x6aa9('0xd')](_0x6aa9('0xe'),_0x38ea05,'request\x20sent');_0x5d2a68(_0x108f37[_0x6aa9('0x16')][_0x6aa9('0x15')]);}})[_0x6aa9('0x17')](function(_0x4d9682){logger[_0x6aa9('0x13')](_0x6aa9('0xe'),_0x38ea05,_0x4d9682);_0x13cc3d(_0x4d9682);});});} \ No newline at end of file +var _0x0d37=['request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','result','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info'];(function(_0x54cd0b,_0x182ab9){var _0x2dbfb7=function(_0x41d47e){while(--_0x41d47e){_0x54cd0b['push'](_0x54cd0b['shift']());}};_0x2dbfb7(++_0x182ab9);}(_0x0d37,0x171));var _0x70d3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0d37[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x70d3('0x0'));var util=require(_0x70d3('0x1'));var moment=require(_0x70d3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x70d3('0x3'))['db'];var utils=require(_0x70d3('0x4'));var logger=require(_0x70d3('0x5'))('rpc');var config=require(_0x70d3('0x6'));var jayson=require(_0x70d3('0x7'));var client=jayson[_0x70d3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x90d6f6,_0x3c40ed,_0xcd67b4){return new BPromise(function(_0x14e794,_0xba78a1){return client['request'](_0x90d6f6,_0xcd67b4)[_0x70d3('0x9')](function(_0x4241c6){logger[_0x70d3('0xa')]('MailSubstatus,\x20%s,\x20%s',_0x3c40ed,_0x70d3('0xb'));logger['debug'](_0x70d3('0xc'),_0x3c40ed,_0x70d3('0xb'),JSON[_0x70d3('0xd')](_0x4241c6));if(_0x4241c6[_0x70d3('0xe')]){if(_0x4241c6[_0x70d3('0xe')][_0x70d3('0xf')]===0x1f4){logger['error'](_0x70d3('0x10'),_0x3c40ed,_0x4241c6[_0x70d3('0xe')]['message']);return _0xba78a1(_0x4241c6['error'][_0x70d3('0x11')]);}logger[_0x70d3('0xe')](_0x70d3('0x10'),_0x3c40ed,_0x4241c6['error'][_0x70d3('0x11')]);return _0x14e794(_0x4241c6['error'][_0x70d3('0x11')]);}else{logger['info'](_0x70d3('0x10'),_0x3c40ed,_0x70d3('0xb'));_0x14e794(_0x4241c6[_0x70d3('0x12')]['message']);}})['catch'](function(_0x1fafa3){logger[_0x70d3('0xe')](_0x70d3('0x10'),_0x3c40ed,_0x1fafa3);_0xba78a1(_0x1fafa3);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 6bed0e8..96a8f77 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 _0x1963=['post','put','delete','exports','multer','util','Router','fs-extra','../../components/auth/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','/describe','/:id'];(function(_0x841eb4,_0xb200b5){var _0xc48924=function(_0x1cc2cd){while(--_0x1cc2cd){_0x841eb4['push'](_0x841eb4['shift']());}};_0xc48924(++_0xb200b5);}(_0x1963,0xf4));var _0x3196=function(_0x17abbd,_0x137471){_0x17abbd=_0x17abbd-0x0;var _0x324bab=_0x1963[_0x17abbd];return _0x324bab;};'use strict';var multer=require(_0x3196('0x0'));var util=require(_0x3196('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3196('0x2')]();var fs_extra=require(_0x3196('0x3'));var auth=require(_0x3196('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3196('0x5'));var controller=require(_0x3196('0x6'));router[_0x3196('0x7')]('/',auth[_0x3196('0x8')](),controller['index']);router[_0x3196('0x7')](_0x3196('0x9'),auth[_0x3196('0x8')](),controller['describe']);router[_0x3196('0x7')](_0x3196('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x3196('0xb')]('/',auth[_0x3196('0x8')](),controller['create']);router[_0x3196('0xc')](_0x3196('0xa'),auth[_0x3196('0x8')](),controller['update']);router[_0x3196('0xd')](_0x3196('0xa'),auth[_0x3196('0x8')](),controller['destroy']);module[_0x3196('0xe')]=router; \ No newline at end of file +var _0xdabb=['isAuthenticated','describe','/:id','post','create','put','update','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','index','/describe'];(function(_0x1f2844,_0x111ae3){var _0xa9da98=function(_0x3f09f5){while(--_0x3f09f5){_0x1f2844['push'](_0x1f2844['shift']());}};_0xa9da98(++_0x111ae3);}(_0xdabb,0x86));var _0xbdab=function(_0x307049,_0x1e9968){_0x307049=_0x307049-0x0;var _0x2d3015=_0xdabb[_0x307049];return _0x2d3015;};'use strict';var multer=require(_0xbdab('0x0'));var util=require(_0xbdab('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbdab('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xbdab('0x3'));var interaction=require(_0xbdab('0x4'));var config=require(_0xbdab('0x5'));var controller=require(_0xbdab('0x6'));router[_0xbdab('0x7')]('/',auth['isAuthenticated'](),controller[_0xbdab('0x8')]);router[_0xbdab('0x7')](_0xbdab('0x9'),auth[_0xbdab('0xa')](),controller[_0xbdab('0xb')]);router[_0xbdab('0x7')](_0xbdab('0xc'),auth[_0xbdab('0xa')](),controller['show']);router[_0xbdab('0xd')]('/',auth[_0xbdab('0xa')](),controller[_0xbdab('0xe')]);router[_0xbdab('0xf')](_0xbdab('0xc'),auth[_0xbdab('0xa')](),controller[_0xbdab('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xbdab('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index d754cee..4df6d82 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x71af84,_0x5f514d){var _0x1d550d=function(_0x17f9f4){while(--_0x17f9f4){_0x71af84['push'](_0x71af84['shift']());}};_0x1d550d(++_0x5f514d);}(_0x54ef,0x112));var _0xf54e=function(_0x3362e4,_0x23ad93){_0x3362e4=_0x3362e4-0x0;var _0x54e6fc=_0x54ef[_0x3362e4];return _0x54e6fc;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x525276,_0xd269da){var _0x49d8e2=function(_0x4725b0){while(--_0x4725b0){_0x525276['push'](_0x525276['shift']());}};_0x49d8e2(++_0xd269da);}(_0x34e8,0x12c));var _0x834e=function(_0x4c9e1c,_0x274cba){_0x4c9e1c=_0x4c9e1c-0x0;var _0x11d83a=_0x34e8[_0x4c9e1c];return _0x11d83a;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 31b98ed..4e7e33f 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 _0xd2ca=['request-promise','moment','mustache','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','MailTransferReport','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','length','nolimit','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x458852,_0x559828){var _0x30e456=function(_0x5c30b6){while(--_0x5c30b6){_0x458852['push'](_0x458852['shift']());}};_0x30e456(++_0x559828);}(_0xd2ca,0x164));var _0xad2c=function(_0x2c1194,_0x194283){_0x2c1194=_0x2c1194-0x0;var _0x3d5ad1=_0xd2ca[_0x2c1194];return _0x3d5ad1;};'use strict';var emlformat=require(_0xad2c('0x0'));var rimraf=require(_0xad2c('0x1'));var zipdir=require(_0xad2c('0x2'));var jsonpatch=require(_0xad2c('0x3'));var rp=require(_0xad2c('0x4'));var moment=require(_0xad2c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xad2c('0x6'));var util=require('util');var path=require(_0xad2c('0x7'));var sox=require('sox');var csv=require(_0xad2c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xad2c('0x9'));var _=require(_0xad2c('0xa'));var squel=require(_0xad2c('0xb'));var crypto=require('crypto');var jsforce=require(_0xad2c('0xc'));var deskjs=require(_0xad2c('0xd'));var toCsv=require(_0xad2c('0x8'));var querystring=require('querystring');var Papa=require(_0xad2c('0xe'));var Redis=require(_0xad2c('0xf'));var authService=require(_0xad2c('0x10'));var qs=require(_0xad2c('0x11'));var as=require(_0xad2c('0x12'));var hardwareService=require(_0xad2c('0x13'));var logger=require(_0xad2c('0x14'))('api');var utils=require(_0xad2c('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x153736,_0x55786c){_0x55786c=_0x55786c||0xcc;return function(_0x402835){if(_0x402835){return _0x153736[_0xad2c('0x16')](_0x55786c);}return _0x153736[_0xad2c('0x17')](_0x55786c)[_0xad2c('0x18')]();};}function respondWithResult(_0x217471,_0x37b990){_0x37b990=_0x37b990||0xc8;return function(_0x378927){if(_0x378927){return _0x217471[_0xad2c('0x17')](_0x37b990)[_0xad2c('0x19')](_0x378927);}};}function respondWithFilteredResult(_0x470554,_0x471815){return function(_0xb54c19){if(_0xb54c19){var _0xf95b45=typeof _0x471815[_0xad2c('0x1a')]===_0xad2c('0x1b')&&typeof _0x471815[_0xad2c('0x1c')]===_0xad2c('0x1b');var _0x1d722a=_0xb54c19[_0xad2c('0x1d')];var _0x3d44ff=_0xf95b45?0x0:_0x471815['offset'];var _0x308c1f=_0xf95b45?_0xb54c19['count']:_0x471815[_0xad2c('0x1a')]+_0x471815[_0xad2c('0x1c')];var _0x306cd9;if(_0x308c1f>=_0x1d722a){_0x308c1f=_0x1d722a;_0x306cd9=0xc8;}else{_0x306cd9=0xce;}_0x470554[_0xad2c('0x17')](_0x306cd9);return _0x470554[_0xad2c('0x1e')](_0xad2c('0x1f'),_0x3d44ff+'-'+_0x308c1f+'/'+_0x1d722a)[_0xad2c('0x19')](_0xb54c19);}return null;};}function patchUpdates(_0x34911e){return function(_0x3d7806){try{jsonpatch['apply'](_0x3d7806,_0x34911e,!![]);}catch(_0x98eb4b){return BPromise[_0xad2c('0x20')](_0x98eb4b);}return _0x3d7806[_0xad2c('0x21')]();};}function saveUpdates(_0x92cf39,_0x7b7b73){return function(_0x243234){if(_0x243234){return _0x243234[_0xad2c('0x22')](_0x92cf39)[_0xad2c('0x23')](function(_0xc9d1b){return _0xc9d1b;});}return null;};}function removeEntity(_0x5f5db5,_0x5c048b){return function(_0x4e009d){if(_0x4e009d){return _0x4e009d[_0xad2c('0x24')]()['then'](function(){_0x5f5db5[_0xad2c('0x17')](0xcc)[_0xad2c('0x18')]();});}};}function handleEntityNotFound(_0x200cda,_0x178805){return function(_0x518559){if(!_0x518559){_0x200cda[_0xad2c('0x16')](0x194);}return _0x518559;};}function handleError(_0x4b3eb5,_0x30697c){_0x30697c=_0x30697c||0x1f4;return function(_0x5c35f2){logger[_0xad2c('0x25')](_0x5c35f2[_0xad2c('0x26')]);if(_0x5c35f2[_0xad2c('0x27')]){delete _0x5c35f2[_0xad2c('0x27')];}_0x4b3eb5[_0xad2c('0x17')](_0x30697c)[_0xad2c('0x28')](_0x5c35f2);};}exports['index']=function(_0x55702a,_0x50a294){var _0x3c3229={},_0xbb4123={},_0x4a626b={'count':0x0,'rows':[]};var _0x137d79=_[_0xad2c('0x29')](db[_0xad2c('0x2a')][_0xad2c('0x2b')],function(_0x2a8133){return{'name':_0x2a8133[_0xad2c('0x2c')],'type':_0x2a8133['type'][_0xad2c('0x2d')]};});_0xbb4123[_0xad2c('0x2e')]=_[_0xad2c('0x29')](_0x137d79,'name');_0xbb4123[_0xad2c('0x2f')]=_[_0xad2c('0x30')](_0x55702a['query']);_0xbb4123['filters']=_['intersection'](_0xbb4123[_0xad2c('0x2e')],_0xbb4123[_0xad2c('0x2f')]);_0x3c3229[_0xad2c('0x31')]=_[_0xad2c('0x32')](_0xbb4123['model'],qs['fields'](_0x55702a[_0xad2c('0x2f')]['fields']));_0x3c3229['attributes']=_0x3c3229[_0xad2c('0x31')][_0xad2c('0x33')]?_0x3c3229['attributes']:_0xbb4123['model'];if(!_0x55702a['query']['hasOwnProperty'](_0xad2c('0x34'))){_0x3c3229[_0xad2c('0x1c')]=qs[_0xad2c('0x1c')](_0x55702a[_0xad2c('0x2f')][_0xad2c('0x1c')]);_0x3c3229[_0xad2c('0x1a')]=qs[_0xad2c('0x1a')](_0x55702a[_0xad2c('0x2f')][_0xad2c('0x1a')]);}_0x3c3229[_0xad2c('0x35')]=qs[_0xad2c('0x36')](_0x55702a[_0xad2c('0x2f')][_0xad2c('0x36')]);_0x3c3229[_0xad2c('0x37')]=qs[_0xad2c('0x38')](_[_0xad2c('0x39')](_0x55702a[_0xad2c('0x2f')],_0xbb4123[_0xad2c('0x38')]),_0x137d79);if(_0x55702a[_0xad2c('0x2f')][_0xad2c('0x3a')]){_0x3c3229[_0xad2c('0x37')]=_[_0xad2c('0x3b')](_0x3c3229[_0xad2c('0x37')],{'$or':_[_0xad2c('0x29')](_0x137d79,function(_0x18de9d){if(_0x18de9d['type']!=='VIRTUAL'){var _0x1a3b4e={};_0x1a3b4e[_0x18de9d[_0xad2c('0x27')]]={'$like':'%'+_0x55702a[_0xad2c('0x2f')]['filter']+'%'};return _0x1a3b4e;}})});}_0x3c3229=_[_0xad2c('0x3b')]({},_0x3c3229,_0x55702a[_0xad2c('0x3c')]);var _0x1edaa6={'where':_0x3c3229[_0xad2c('0x37')]};return db['MailTransferReport'][_0xad2c('0x1d')](_0x1edaa6)[_0xad2c('0x23')](function(_0x17baae){_0x4a626b[_0xad2c('0x1d')]=_0x17baae;if(_0x55702a[_0xad2c('0x2f')]['includeAll']){_0x3c3229[_0xad2c('0x3d')]=[{'all':!![]}];}return db[_0xad2c('0x2a')][_0xad2c('0x3e')](_0x3c3229);})[_0xad2c('0x23')](function(_0x297468){_0x4a626b[_0xad2c('0x3f')]=_0x297468;return _0x4a626b;})[_0xad2c('0x23')](respondWithFilteredResult(_0x50a294,_0x3c3229))[_0xad2c('0x40')](handleError(_0x50a294,null));};exports[_0xad2c('0x41')]=function(_0x4b4f2e,_0x34f369){var _0x49ac08={'raw':!![],'where':{'id':_0x4b4f2e[_0xad2c('0x42')]['id']}},_0x476dc4={};_0x476dc4[_0xad2c('0x2e')]=_['keys'](db[_0xad2c('0x2a')]['rawAttributes']);_0x476dc4[_0xad2c('0x2f')]=_['keys'](_0x4b4f2e[_0xad2c('0x2f')]);_0x476dc4[_0xad2c('0x38')]=_[_0xad2c('0x32')](_0x476dc4[_0xad2c('0x2e')],_0x476dc4[_0xad2c('0x2f')]);_0x49ac08[_0xad2c('0x31')]=_[_0xad2c('0x32')](_0x476dc4[_0xad2c('0x2e')],qs['fields'](_0x4b4f2e[_0xad2c('0x2f')]['fields']));_0x49ac08[_0xad2c('0x31')]=_0x49ac08[_0xad2c('0x31')][_0xad2c('0x33')]?_0x49ac08[_0xad2c('0x31')]:_0x476dc4['model'];if(_0x4b4f2e[_0xad2c('0x2f')][_0xad2c('0x43')]){_0x49ac08[_0xad2c('0x3d')]=[{'all':!![]}];}_0x49ac08=_['merge']({},_0x49ac08,_0x4b4f2e[_0xad2c('0x3c')]);return db['MailTransferReport'][_0xad2c('0x44')](_0x49ac08)[_0xad2c('0x23')](handleEntityNotFound(_0x34f369,null))[_0xad2c('0x23')](respondWithResult(_0x34f369,null))[_0xad2c('0x40')](handleError(_0x34f369,null));};exports[_0xad2c('0x45')]=function(_0x1eead0,_0x501e22){return db['MailTransferReport']['create'](_0x1eead0[_0xad2c('0x46')],{})['then'](respondWithResult(_0x501e22,0xc9))['catch'](handleError(_0x501e22,null));};exports[_0xad2c('0x22')]=function(_0x4a8db6,_0x438646){if(_0x4a8db6[_0xad2c('0x46')]['id']){delete _0x4a8db6[_0xad2c('0x46')]['id'];}return db[_0xad2c('0x2a')][_0xad2c('0x44')]({'where':{'id':_0x4a8db6[_0xad2c('0x42')]['id']}})['then'](handleEntityNotFound(_0x438646,null))[_0xad2c('0x23')](saveUpdates(_0x4a8db6[_0xad2c('0x46')],null))['then'](respondWithResult(_0x438646,null))['catch'](handleError(_0x438646,null));};exports[_0xad2c('0x24')]=function(_0x4af857,_0x453089){return db[_0xad2c('0x2a')][_0xad2c('0x44')]({'where':{'id':_0x4af857[_0xad2c('0x42')]['id']}})[_0xad2c('0x23')](handleEntityNotFound(_0x453089,null))[_0xad2c('0x23')](removeEntity(_0x453089,null))['catch'](handleError(_0x453089,null));};exports['describe']=function(_0x3a0860,_0x53c0be){return db[_0xad2c('0x2a')][_0xad2c('0x47')]()[_0xad2c('0x23')](respondWithResult(_0x53c0be,null))[_0xad2c('0x40')](handleError(_0x53c0be,null));}; \ No newline at end of file +var _0xd8e1=['filter','merge','VIRTUAL','options','MailTransferReport','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','reject','save','destroy','then','error','stack','name','send','index','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd8e1,0xa3));var _0x1d8e=function(_0x5d784d,_0x43a0c2){_0x5d784d=_0x5d784d-0x0;var _0x4bd08c=_0xd8e1[_0x5d784d];return _0x4bd08c;};'use strict';var emlformat=require(_0x1d8e('0x0'));var rimraf=require(_0x1d8e('0x1'));var zipdir=require(_0x1d8e('0x2'));var jsonpatch=require(_0x1d8e('0x3'));var rp=require(_0x1d8e('0x4'));var moment=require(_0x1d8e('0x5'));var BPromise=require(_0x1d8e('0x6'));var Mustache=require('mustache');var util=require(_0x1d8e('0x7'));var path=require(_0x1d8e('0x8'));var sox=require('sox');var csv=require(_0x1d8e('0x9'));var ejs=require(_0x1d8e('0xa'));var fs=require('fs');var fs_extra=require(_0x1d8e('0xb'));var _=require('lodash');var squel=require(_0x1d8e('0xc'));var crypto=require(_0x1d8e('0xd'));var jsforce=require(_0x1d8e('0xe'));var deskjs=require(_0x1d8e('0xf'));var toCsv=require(_0x1d8e('0x9'));var querystring=require(_0x1d8e('0x10'));var Papa=require(_0x1d8e('0x11'));var Redis=require('ioredis');var authService=require(_0x1d8e('0x12'));var qs=require(_0x1d8e('0x13'));var as=require(_0x1d8e('0x14'));var hardwareService=require(_0x1d8e('0x15'));var logger=require(_0x1d8e('0x16'))('api');var utils=require(_0x1d8e('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d625a,_0x2dc234){_0x2dc234=_0x2dc234||0xcc;return function(_0x551fcc){if(_0x551fcc){return _0x3d625a[_0x1d8e('0x18')](_0x2dc234);}return _0x3d625a[_0x1d8e('0x19')](_0x2dc234)[_0x1d8e('0x1a')]();};}function respondWithResult(_0x38fef9,_0x1fce45){_0x1fce45=_0x1fce45||0xc8;return function(_0x5d69bd){if(_0x5d69bd){return _0x38fef9[_0x1d8e('0x19')](_0x1fce45)['json'](_0x5d69bd);}};}function respondWithFilteredResult(_0x450f1e,_0xb59570){return function(_0x7879e6){if(_0x7879e6){var _0xbfa62f=typeof _0xb59570[_0x1d8e('0x1b')]===_0x1d8e('0x1c')&&typeof _0xb59570['limit']==='undefined';var _0x42efae=_0x7879e6[_0x1d8e('0x1d')];var _0x529a2f=_0xbfa62f?0x0:_0xb59570['offset'];var _0x2dd6fe=_0xbfa62f?_0x7879e6[_0x1d8e('0x1d')]:_0xb59570[_0x1d8e('0x1b')]+_0xb59570[_0x1d8e('0x1e')];var _0x3e25f0;if(_0x2dd6fe>=_0x42efae){_0x2dd6fe=_0x42efae;_0x3e25f0=0xc8;}else{_0x3e25f0=0xce;}_0x450f1e[_0x1d8e('0x19')](_0x3e25f0);return _0x450f1e['set'](_0x1d8e('0x1f'),_0x529a2f+'-'+_0x2dd6fe+'/'+_0x42efae)[_0x1d8e('0x20')](_0x7879e6);}return null;};}function patchUpdates(_0x5618a7){return function(_0x52dbb5){try{jsonpatch['apply'](_0x52dbb5,_0x5618a7,!![]);}catch(_0x128772){return BPromise[_0x1d8e('0x21')](_0x128772);}return _0x52dbb5[_0x1d8e('0x22')]();};}function saveUpdates(_0x8041af,_0x183bfc){return function(_0x13c003){if(_0x13c003){return _0x13c003['update'](_0x8041af)['then'](function(_0x51535a){return _0x51535a;});}return null;};}function removeEntity(_0x4dd09a,_0x29f62d){return function(_0x562825){if(_0x562825){return _0x562825[_0x1d8e('0x23')]()[_0x1d8e('0x24')](function(){_0x4dd09a[_0x1d8e('0x19')](0xcc)[_0x1d8e('0x1a')]();});}};}function handleEntityNotFound(_0x2a4953,_0x343f9c){return function(_0x30a0d0){if(!_0x30a0d0){_0x2a4953[_0x1d8e('0x18')](0x194);}return _0x30a0d0;};}function handleError(_0x4ef9cc,_0x129669){_0x129669=_0x129669||0x1f4;return function(_0x2a4f2a){logger[_0x1d8e('0x25')](_0x2a4f2a[_0x1d8e('0x26')]);if(_0x2a4f2a[_0x1d8e('0x27')]){delete _0x2a4f2a[_0x1d8e('0x27')];}_0x4ef9cc[_0x1d8e('0x19')](_0x129669)[_0x1d8e('0x28')](_0x2a4f2a);};}exports[_0x1d8e('0x29')]=function(_0x29813a,_0x500819){var _0x313b85={},_0x3af9da={},_0x47be6f={'count':0x0,'rows':[]};var _0x30cd16=_['map'](db['MailTransferReport']['rawAttributes'],function(_0x36f2b4){return{'name':_0x36f2b4['fieldName'],'type':_0x36f2b4['type'][_0x1d8e('0x2a')]};});_0x3af9da[_0x1d8e('0x2b')]=_[_0x1d8e('0x2c')](_0x30cd16,_0x1d8e('0x27'));_0x3af9da[_0x1d8e('0x2d')]=_[_0x1d8e('0x2e')](_0x29813a[_0x1d8e('0x2d')]);_0x3af9da[_0x1d8e('0x2f')]=_['intersection'](_0x3af9da['model'],_0x3af9da[_0x1d8e('0x2d')]);_0x313b85[_0x1d8e('0x30')]=_[_0x1d8e('0x31')](_0x3af9da['model'],qs[_0x1d8e('0x32')](_0x29813a[_0x1d8e('0x2d')][_0x1d8e('0x32')]));_0x313b85[_0x1d8e('0x30')]=_0x313b85['attributes'][_0x1d8e('0x33')]?_0x313b85[_0x1d8e('0x30')]:_0x3af9da[_0x1d8e('0x2b')];if(!_0x29813a[_0x1d8e('0x2d')][_0x1d8e('0x34')](_0x1d8e('0x35'))){_0x313b85[_0x1d8e('0x1e')]=qs[_0x1d8e('0x1e')](_0x29813a[_0x1d8e('0x2d')][_0x1d8e('0x1e')]);_0x313b85[_0x1d8e('0x1b')]=qs[_0x1d8e('0x1b')](_0x29813a[_0x1d8e('0x2d')][_0x1d8e('0x1b')]);}_0x313b85['order']=qs[_0x1d8e('0x36')](_0x29813a[_0x1d8e('0x2d')][_0x1d8e('0x36')]);_0x313b85[_0x1d8e('0x37')]=qs['filters'](_['pick'](_0x29813a['query'],_0x3af9da[_0x1d8e('0x2f')]),_0x30cd16);if(_0x29813a[_0x1d8e('0x2d')][_0x1d8e('0x38')]){_0x313b85[_0x1d8e('0x37')]=_[_0x1d8e('0x39')](_0x313b85[_0x1d8e('0x37')],{'$or':_[_0x1d8e('0x2c')](_0x30cd16,function(_0x2f2938){if(_0x2f2938['type']!==_0x1d8e('0x3a')){var _0x4134cf={};_0x4134cf[_0x2f2938[_0x1d8e('0x27')]]={'$like':'%'+_0x29813a['query'][_0x1d8e('0x38')]+'%'};return _0x4134cf;}})});}_0x313b85=_[_0x1d8e('0x39')]({},_0x313b85,_0x29813a[_0x1d8e('0x3b')]);var _0x5c3cb0={'where':_0x313b85[_0x1d8e('0x37')]};return db[_0x1d8e('0x3c')][_0x1d8e('0x1d')](_0x5c3cb0)[_0x1d8e('0x24')](function(_0x103a86){_0x47be6f[_0x1d8e('0x1d')]=_0x103a86;if(_0x29813a[_0x1d8e('0x2d')][_0x1d8e('0x3d')]){_0x313b85[_0x1d8e('0x3e')]=[{'all':!![]}];}return db[_0x1d8e('0x3c')][_0x1d8e('0x3f')](_0x313b85);})['then'](function(_0x549a02){_0x47be6f[_0x1d8e('0x40')]=_0x549a02;return _0x47be6f;})[_0x1d8e('0x24')](respondWithFilteredResult(_0x500819,_0x313b85))[_0x1d8e('0x41')](handleError(_0x500819,null));};exports['show']=function(_0x4dee1a,_0x1e614f){var _0x38008a={'raw':!![],'where':{'id':_0x4dee1a[_0x1d8e('0x42')]['id']}},_0x4c180a={};_0x4c180a[_0x1d8e('0x2b')]=_[_0x1d8e('0x2e')](db[_0x1d8e('0x3c')][_0x1d8e('0x43')]);_0x4c180a[_0x1d8e('0x2d')]=_[_0x1d8e('0x2e')](_0x4dee1a[_0x1d8e('0x2d')]);_0x4c180a[_0x1d8e('0x2f')]=_[_0x1d8e('0x31')](_0x4c180a['model'],_0x4c180a[_0x1d8e('0x2d')]);_0x38008a[_0x1d8e('0x30')]=_['intersection'](_0x4c180a['model'],qs['fields'](_0x4dee1a[_0x1d8e('0x2d')][_0x1d8e('0x32')]));_0x38008a[_0x1d8e('0x30')]=_0x38008a[_0x1d8e('0x30')][_0x1d8e('0x33')]?_0x38008a[_0x1d8e('0x30')]:_0x4c180a[_0x1d8e('0x2b')];if(_0x4dee1a[_0x1d8e('0x2d')][_0x1d8e('0x3d')]){_0x38008a[_0x1d8e('0x3e')]=[{'all':!![]}];}_0x38008a=_[_0x1d8e('0x39')]({},_0x38008a,_0x4dee1a[_0x1d8e('0x3b')]);return db[_0x1d8e('0x3c')][_0x1d8e('0x44')](_0x38008a)[_0x1d8e('0x24')](handleEntityNotFound(_0x1e614f,null))[_0x1d8e('0x24')](respondWithResult(_0x1e614f,null))[_0x1d8e('0x41')](handleError(_0x1e614f,null));};exports[_0x1d8e('0x45')]=function(_0x3fb05d,_0x7f1b2){return db['MailTransferReport'][_0x1d8e('0x45')](_0x3fb05d[_0x1d8e('0x46')],{})[_0x1d8e('0x24')](respondWithResult(_0x7f1b2,0xc9))[_0x1d8e('0x41')](handleError(_0x7f1b2,null));};exports[_0x1d8e('0x47')]=function(_0x16bff9,_0x361248){if(_0x16bff9[_0x1d8e('0x46')]['id']){delete _0x16bff9[_0x1d8e('0x46')]['id'];}return db['MailTransferReport'][_0x1d8e('0x44')]({'where':{'id':_0x16bff9[_0x1d8e('0x42')]['id']}})[_0x1d8e('0x24')](handleEntityNotFound(_0x361248,null))[_0x1d8e('0x24')](saveUpdates(_0x16bff9['body'],null))[_0x1d8e('0x24')](respondWithResult(_0x361248,null))[_0x1d8e('0x41')](handleError(_0x361248,null));};exports[_0x1d8e('0x23')]=function(_0xb3e7dd,_0x48c04b){return db['MailTransferReport'][_0x1d8e('0x44')]({'where':{'id':_0xb3e7dd[_0x1d8e('0x42')]['id']}})['then'](handleEntityNotFound(_0x48c04b,null))[_0x1d8e('0x24')](removeEntity(_0x48c04b,null))[_0x1d8e('0x41')](handleError(_0x48c04b,null));};exports[_0x1d8e('0x48')]=function(_0x148757,_0x35a14a){return db[_0x1d8e('0x3c')][_0x1d8e('0x48')]()[_0x1d8e('0x24')](respondWithResult(_0x35a14a,null))[_0x1d8e('0x41')](handleError(_0x35a14a,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index a2ae585..5bda8e3 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 _0xf360=['report_mail_transfer','uniqueid','lodash','util','../../config/logger','moment','request-promise','path','rimraf','./mailTransferReport.attributes','exports','define','MailTransferReport'];(function(_0x43f19b,_0x3f825c){var _0x1e53d5=function(_0x11792d){while(--_0x11792d){_0x43f19b['push'](_0x43f19b['shift']());}};_0x1e53d5(++_0x3f825c);}(_0xf360,0x9e));var _0x0f36=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf360[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0f36('0x0'));var util=require(_0x0f36('0x1'));var logger=require(_0x0f36('0x2'))('api');var moment=require(_0x0f36('0x3'));var BPromise=require('bluebird');var rp=require(_0x0f36('0x4'));var fs=require('fs');var path=require(_0x0f36('0x5'));var rimraf=require(_0x0f36('0x6'));var config=require('../../config/environment');var attributes=require(_0x0f36('0x7'));module[_0x0f36('0x8')]=function(_0x13d262,_0x110709){return _0x13d262[_0x0f36('0x9')](_0x0f36('0xa'),attributes,{'tableName':_0x0f36('0xb'),'paranoid':![],'indexes':[{'name':_0x0f36('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb439=['exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./mailTransferReport.attributes'];(function(_0x5b4ac9,_0x9644e){var _0xb3afb1=function(_0x342ead){while(--_0x342ead){_0x5b4ac9['push'](_0x5b4ac9['shift']());}};_0xb3afb1(++_0x9644e);}(_0xb439,0x87));var _0x9b43=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xb439[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x9b43('0x0'));var util=require(_0x9b43('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9b43('0x2'));var BPromise=require(_0x9b43('0x3'));var rp=require(_0x9b43('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9b43('0x5'));var config=require(_0x9b43('0x6'));var attributes=require(_0x9b43('0x7'));module[_0x9b43('0x8')]=function(_0x3ab870,_0x3d2a05){return _0x3ab870[_0x9b43('0x9')](_0x9b43('0xa'),attributes,{'tableName':_0x9b43('0xb'),'paranoid':![],'indexes':[{'name':_0x9b43('0xc'),'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 86ecaa3..4bd7f2c 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 _0xbb8d=['error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0xe5bfdd,_0x5dba2e){var _0x3040aa=function(_0x550ffe){while(--_0x550ffe){_0xe5bfdd['push'](_0xe5bfdd['shift']());}};_0x3040aa(++_0x5dba2e);}(_0xbb8d,0xa6));var _0xdbb8=function(_0x3fc315,_0x42e206){_0x3fc315=_0x3fc315-0x0;var _0x197823=_0xbb8d[_0x3fc315];return _0x197823;};'use strict';var _=require(_0xdbb8('0x0'));var util=require('util');var moment=require(_0xdbb8('0x1'));var BPromise=require(_0xdbb8('0x2'));var rs=require(_0xdbb8('0x3'));var fs=require('fs');var Redis=require(_0xdbb8('0x4'));var db=require(_0xdbb8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdbb8('0x6'))(_0xdbb8('0x7'));var config=require(_0xdbb8('0x8'));var jayson=require(_0xdbb8('0x9'));var client=jayson['client'][_0xdbb8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe03b76,_0x6e7bc7,_0xf9f772){return new BPromise(function(_0x4dc914,_0x4e1cd8){return client[_0xdbb8('0xb')](_0xe03b76,_0xf9f772)[_0xdbb8('0xc')](function(_0xde71a8){logger[_0xdbb8('0xd')](_0xdbb8('0xe'),_0x6e7bc7,_0xdbb8('0xf'));logger[_0xdbb8('0x10')](_0xdbb8('0x11'),_0x6e7bc7,_0xdbb8('0xf'),JSON['stringify'](_0xde71a8));if(_0xde71a8[_0xdbb8('0x12')]){if(_0xde71a8[_0xdbb8('0x12')][_0xdbb8('0x13')]===0x1f4){logger[_0xdbb8('0x12')](_0xdbb8('0xe'),_0x6e7bc7,_0xde71a8['error'][_0xdbb8('0x14')]);return _0x4e1cd8(_0xde71a8[_0xdbb8('0x12')][_0xdbb8('0x14')]);}logger[_0xdbb8('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x6e7bc7,_0xde71a8['error'][_0xdbb8('0x14')]);return _0x4dc914(_0xde71a8[_0xdbb8('0x12')]['message']);}else{logger[_0xdbb8('0xd')](_0xdbb8('0xe'),_0x6e7bc7,_0xdbb8('0xf'));_0x4dc914(_0xde71a8[_0xdbb8('0x15')]['message']);}})[_0xdbb8('0x16')](function(_0x2b628a){logger[_0xdbb8('0x12')](_0xdbb8('0xe'),_0x6e7bc7,_0x2b628a);_0x4e1cd8(_0x2b628a);});});} \ No newline at end of file +var _0x2ce9=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird'];(function(_0x31b264,_0x1bbb4b){var _0x599a0e=function(_0x196e88){while(--_0x196e88){_0x31b264['push'](_0x31b264['shift']());}};_0x599a0e(++_0x1bbb4b);}(_0x2ce9,0xcc));var _0x92ce=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0x2ce9[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require('lodash');var util=require(_0x92ce('0x0'));var moment=require(_0x92ce('0x1'));var BPromise=require(_0x92ce('0x2'));var rs=require(_0x92ce('0x3'));var fs=require('fs');var Redis=require(_0x92ce('0x4'));var db=require(_0x92ce('0x5'))['db'];var utils=require(_0x92ce('0x6'));var logger=require(_0x92ce('0x7'))(_0x92ce('0x8'));var config=require('../../config/environment');var jayson=require(_0x92ce('0x9'));var client=jayson[_0x92ce('0xa')][_0x92ce('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5202c2,_0x43f6d4,_0x54620d){return new BPromise(function(_0x489efd,_0xb4afa9){return client[_0x92ce('0xc')](_0x5202c2,_0x54620d)['then'](function(_0x529627){logger[_0x92ce('0xd')](_0x92ce('0xe'),_0x43f6d4,_0x92ce('0xf'));logger['debug'](_0x92ce('0x10'),_0x43f6d4,_0x92ce('0xf'),JSON[_0x92ce('0x11')](_0x529627));if(_0x529627[_0x92ce('0x12')]){if(_0x529627['error'][_0x92ce('0x13')]===0x1f4){logger[_0x92ce('0x12')](_0x92ce('0xe'),_0x43f6d4,_0x529627[_0x92ce('0x12')][_0x92ce('0x14')]);return _0xb4afa9(_0x529627[_0x92ce('0x12')][_0x92ce('0x14')]);}logger[_0x92ce('0x12')](_0x92ce('0xe'),_0x43f6d4,_0x529627['error'][_0x92ce('0x14')]);return _0x489efd(_0x529627['error'][_0x92ce('0x14')]);}else{logger['info'](_0x92ce('0xe'),_0x43f6d4,_0x92ce('0xf'));_0x489efd(_0x529627[_0x92ce('0x15')]['message']);}})[_0x92ce('0x16')](function(_0xdcb679){logger[_0x92ce('0x12')](_0x92ce('0xe'),_0x43f6d4,_0xdcb679);_0xb4afa9(_0xdcb679);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 5ba4a1d..1f7031d 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 _0x766c=['post','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','describe','/:id','show'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x766c,0x183));var _0xc766=function(_0x1c5dd2,_0x2fd7e4){_0x1c5dd2=_0x1c5dd2-0x0;var _0x518f85=_0x766c[_0x1c5dd2];return _0x518f85;};'use strict';var multer=require('multer');var util=require(_0xc766('0x0'));var path=require(_0xc766('0x1'));var timeout=require('connect-timeout');var express=require(_0xc766('0x2'));var router=express[_0xc766('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc766('0x4'));var interaction=require(_0xc766('0x5'));var config=require(_0xc766('0x6'));var controller=require(_0xc766('0x7'));router[_0xc766('0x8')]('/',auth[_0xc766('0x9')](),controller['index']);router[_0xc766('0x8')]('/describe',auth[_0xc766('0x9')](),controller[_0xc766('0xa')]);router['get'](_0xc766('0xb'),auth[_0xc766('0x9')](),controller[_0xc766('0xc')]);router[_0xc766('0xd')]('/',auth[_0xc766('0x9')](),controller['create']);router['put']('/:id',auth[_0xc766('0x9')](),controller['update']);router['delete'](_0xc766('0xb'),auth[_0xc766('0x9')](),controller[_0xc766('0xe')]);module[_0xc766('0xf')]=router; \ No newline at end of file +var _0x15e3=['multer','util','path','express','Router','fs-extra','./memberReport.controller','isAuthenticated','get','/describe','describe','/:id','show','put','update','destroy','exports'];(function(_0x3d30a6,_0x41e361){var _0x162e8b=function(_0x5ed068){while(--_0x5ed068){_0x3d30a6['push'](_0x3d30a6['shift']());}};_0x162e8b(++_0x41e361);}(_0x15e3,0x165));var _0x315e=function(_0xefa8f4,_0x5c6b42){_0xefa8f4=_0xefa8f4-0x0;var _0x36e674=_0x15e3[_0xefa8f4];return _0x36e674;};'use strict';var multer=require(_0x315e('0x0'));var util=require(_0x315e('0x1'));var path=require(_0x315e('0x2'));var timeout=require('connect-timeout');var express=require(_0x315e('0x3'));var router=express[_0x315e('0x4')]();var fs_extra=require(_0x315e('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x315e('0x6'));router['get']('/',auth[_0x315e('0x7')](),controller['index']);router[_0x315e('0x8')](_0x315e('0x9'),auth[_0x315e('0x7')](),controller[_0x315e('0xa')]);router['get'](_0x315e('0xb'),auth[_0x315e('0x7')](),controller[_0x315e('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x315e('0xd')](_0x315e('0xb'),auth[_0x315e('0x7')](),controller[_0x315e('0xe')]);router['delete'](_0x315e('0xb'),auth[_0x315e('0x7')](),controller[_0x315e('0xf')]);module[_0x315e('0x10')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 59c3965..d0b8c7a 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 _0x65fb=['DATE','getDataValue','diff','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[dial\x20string]','talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER'];(function(_0x1f4b18,_0x4e777c){var _0xde3957=function(_0x1dcbbc){while(--_0x1dcbbc){_0x1f4b18['push'](_0x1f4b18['shift']());}};_0xde3957(++_0x4e777c);}(_0x65fb,0x1f2));var _0xb65f=function(_0x1bb812,_0x23eacc){_0x1bb812=_0x1bb812-0x0;var _0x372adb=_0x65fb[_0x1bb812];return _0x372adb;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb65f('0x0'));module[_0xb65f('0x1')]={'channel':{'type':Sequelize[_0xb65f('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':_0xb65f('0x3'),'comment':_0xb65f('0x4')},'duration':{'type':Sequelize[_0xb65f('0x5')]},'enterAt':{'type':Sequelize[_0xb65f('0x6')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x534062){var _0x20f7b1=moment(_0x534062);var _0x5bfa79=moment(this[_0xb65f('0x7')]('enterAt'));var _0x45faec=_0x20f7b1[_0xb65f('0x8')](_0x5bfa79,'seconds');this[_0xb65f('0x9')](_0xb65f('0xa'),_0x534062);this[_0xb65f('0x9')]('duration',_0x45faec>=0x0?_0x45faec:null);}},'data1':{'type':Sequelize[_0xb65f('0x2')],'comment':_0xb65f('0xb')},'data2':{'type':Sequelize[_0xb65f('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xb65f('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0xb65f('0x2')],'comment':_0xb65f('0xc')},'data5':{'type':Sequelize[_0xb65f('0x2')],'comment':_0xb65f('0xd')},'role':{'type':Sequelize[_0xb65f('0x2')]},'internal':{'type':Sequelize[_0xb65f('0x5')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe32d=['DATE','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','sequelize','exports','STRING','DEFAULT\x20PAUSE','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe32d,0x1ab));var _0xde32=function(_0x3d84a2,_0x2db342){_0x3d84a2=_0x3d84a2-0x0;var _0x4a60f4=_0xe32d[_0x3d84a2];return _0x4a60f4;};'use strict';var Sequelize=require(_0xde32('0x0'));var moment=require('moment');module[_0xde32('0x1')]={'channel':{'type':Sequelize[_0xde32('0x2')]},'membername':{'type':Sequelize[_0xde32('0x2')]},'interface':{'type':Sequelize[_0xde32('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0xde32('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xde32('0x4')]},'enterAt':{'type':Sequelize[_0xde32('0x5')]},'exitAt':{'type':Sequelize[_0xde32('0x5')],'set':function(_0x3ced72){var _0x5b2981=moment(_0x3ced72);var _0x51823b=moment(this['getDataValue']('enterAt'));var _0x412faa=_0x5b2981[_0xde32('0x6')](_0x51823b,_0xde32('0x7'));this[_0xde32('0x8')](_0xde32('0x9'),_0x3ced72);this[_0xde32('0x8')](_0xde32('0xa'),_0x412faa>=0x0?_0x412faa:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0xde32('0xb')},'data2':{'type':Sequelize[_0xde32('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize['STRING'],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0xde32('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0xde32('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 08d7456..da5fba5 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 _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x34e8,0x12c));var _0x834e=function(_0x1a4ac1,_0x41e2ec){_0x1a4ac1=_0x1a4ac1-0x0;var _0x46bc16=_0x34e8[_0x1a4ac1];return _0x46bc16;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file +var _0x9957=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x3cd025,_0x1e2adf){var _0xaa86eb=function(_0x1029d0){while(--_0x1029d0){_0x3cd025['push'](_0x3cd025['shift']());}};_0xaa86eb(++_0x1e2adf);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['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['MemberReport'][_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['MemberReport'][_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('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index d1cd830..ba70f53 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 _0x58b9=['membername_interface','membername','interface','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member'];(function(_0x10420c,_0x466c3f){var _0x576de4=function(_0x1415d2){while(--_0x1415d2){_0x10420c['push'](_0x10420c['shift']());}};_0x576de4(++_0x466c3f);}(_0x58b9,0xad));var _0x958b=function(_0x2e9842,_0x514356){_0x2e9842=_0x2e9842-0x0;var _0x44e929=_0x58b9[_0x2e9842];return _0x44e929;};'use strict';var _=require(_0x958b('0x0'));var util=require('util');var logger=require(_0x958b('0x1'))(_0x958b('0x2'));var moment=require(_0x958b('0x3'));var BPromise=require(_0x958b('0x4'));var rp=require(_0x958b('0x5'));var fs=require('fs');var path=require(_0x958b('0x6'));var rimraf=require(_0x958b('0x7'));var config=require(_0x958b('0x8'));var attributes=require(_0x958b('0x9'));module[_0x958b('0xa')]=function(_0x1d3ffd,_0x2ad801){return _0x1d3ffd[_0x958b('0xb')](_0x958b('0xc'),attributes,{'tableName':_0x958b('0xd'),'paranoid':![],'indexes':[{'name':_0x958b('0xe'),'fields':[_0x958b('0xf'),_0x958b('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7d8d=['../../config/environment','exports','define','MemberReport','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x337829,_0x28a9c1){var _0xf94c69=function(_0x316083){while(--_0x316083){_0x337829['push'](_0x337829['shift']());}};_0xf94c69(++_0x28a9c1);}(_0x7d8d,0x134));var _0xd7d8=function(_0x25722e,_0x1ce2a0){_0x25722e=_0x25722e-0x0;var _0x50d3f8=_0x7d8d[_0x25722e];return _0x50d3f8;};'use strict';var _=require(_0xd7d8('0x0'));var util=require(_0xd7d8('0x1'));var logger=require(_0xd7d8('0x2'))('api');var moment=require(_0xd7d8('0x3'));var BPromise=require('bluebird');var rp=require(_0xd7d8('0x4'));var fs=require('fs');var path=require(_0xd7d8('0x5'));var rimraf=require(_0xd7d8('0x6'));var config=require(_0xd7d8('0x7'));var attributes=require('./memberReport.attributes');module[_0xd7d8('0x8')]=function(_0x447858,_0x2e8e80){return _0x447858[_0xd7d8('0x9')](_0xd7d8('0xa'),attributes,{'tableName':_0xd7d8('0xb'),'paranoid':![],'indexes':[{'name':_0xd7d8('0xc'),'fields':[_0xd7d8('0xd'),_0xd7d8('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 5733337..9d257ef 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 _0xcde7=['debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','include','map','model','CreateMemberReport','create','UpdateMemberReport','update','body','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','MemberReport,\x20%s,\x20%s','request\x20sent'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xcde7,0x65));var _0x7cde=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xcde7[_0x178e48];return _0x440d7e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7cde('0x0'));var BPromise=require(_0x7cde('0x1'));var rs=require(_0x7cde('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7cde('0x3'));var logger=require('../../config/logger')(_0x7cde('0x4'));var config=require(_0x7cde('0x5'));var jayson=require(_0x7cde('0x6'));var client=jayson[_0x7cde('0x7')][_0x7cde('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x15b9ec,_0x5c8606,_0x20e8cd){return new BPromise(function(_0x512fae,_0x236dbd){return client[_0x7cde('0x9')](_0x15b9ec,_0x20e8cd)[_0x7cde('0xa')](function(_0x14fd55){logger['info'](_0x7cde('0xb'),_0x5c8606,_0x7cde('0xc'));logger[_0x7cde('0xd')](_0x7cde('0xe'),_0x5c8606,_0x7cde('0xc'),JSON[_0x7cde('0xf')](_0x14fd55));if(_0x14fd55[_0x7cde('0x10')]){if(_0x14fd55[_0x7cde('0x10')][_0x7cde('0x11')]===0x1f4){logger[_0x7cde('0x10')]('MemberReport,\x20%s,\x20%s',_0x5c8606,_0x14fd55[_0x7cde('0x10')][_0x7cde('0x12')]);return _0x236dbd(_0x14fd55[_0x7cde('0x10')][_0x7cde('0x12')]);}logger[_0x7cde('0x10')](_0x7cde('0xb'),_0x5c8606,_0x14fd55[_0x7cde('0x10')][_0x7cde('0x12')]);return _0x512fae(_0x14fd55[_0x7cde('0x10')]['message']);}else{logger[_0x7cde('0x13')](_0x7cde('0xb'),_0x5c8606,_0x7cde('0xc'));_0x512fae(_0x14fd55[_0x7cde('0x14')][_0x7cde('0x12')]);}})[_0x7cde('0x15')](function(_0x3bf97a){logger[_0x7cde('0x10')](_0x7cde('0xb'),_0x5c8606,_0x3bf97a);_0x236dbd(_0x3bf97a);});});}exports[_0x7cde('0x16')]=function(_0x87ebf0){var _0x3f2e82=this;return new Promise(function(_0x3b1e08,_0x4844d2){return db[_0x7cde('0x17')][_0x7cde('0x18')]({'raw':_0x87ebf0[_0x7cde('0x19')]?_0x87ebf0['options'][_0x7cde('0x1a')]===undefined?!![]:![]:!![],'where':_0x87ebf0[_0x7cde('0x19')]?_0x87ebf0['options'][_0x7cde('0x1b')]||null:null,'attributes':_0x87ebf0[_0x7cde('0x19')]?_0x87ebf0[_0x7cde('0x19')][_0x7cde('0x1c')]||null:null,'limit':_0x87ebf0[_0x7cde('0x19')]?_0x87ebf0[_0x7cde('0x19')][_0x7cde('0x1d')]||null:null,'include':_0x87ebf0[_0x7cde('0x19')]?_0x87ebf0['options'][_0x7cde('0x1e')]?_['map'](_0x87ebf0['options']['include'],function(_0x261833){return{'model':db[_0x261833['model']],'as':_0x261833['as'],'attributes':_0x261833[_0x7cde('0x1c')],'include':_0x261833[_0x7cde('0x1e')]?_[_0x7cde('0x1f')](_0x261833['include'],function(_0x4b25e3){return{'model':db[_0x4b25e3[_0x7cde('0x20')]],'as':_0x4b25e3['as'],'attributes':_0x4b25e3['attributes'],'include':_0x4b25e3[_0x7cde('0x1e')]?_[_0x7cde('0x1f')](_0x4b25e3[_0x7cde('0x1e')],function(_0x4b28b2){return{'model':db[_0x4b28b2[_0x7cde('0x20')]],'as':_0x4b28b2['as'],'attributes':_0x4b28b2[_0x7cde('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a3b36){logger[_0x7cde('0x13')](_0x7cde('0x16'),_0x87ebf0);logger[_0x7cde('0xd')]('GetMemberReport',_0x87ebf0,JSON[_0x7cde('0xf')](_0x3a3b36));_0x3b1e08(_0x3a3b36);})['catch'](function(_0x532c92){logger[_0x7cde('0x10')](_0x7cde('0x16'),_0x532c92[_0x7cde('0x12')],_0x87ebf0);_0x4844d2(_0x3f2e82[_0x7cde('0x10')](0x1f4,_0x532c92[_0x7cde('0x12')]));});});};exports[_0x7cde('0x21')]=function(_0x50f3db){var _0x5b6e2c=this;return new Promise(function(_0xfa949d,_0x6052be){return db[_0x7cde('0x17')][_0x7cde('0x22')](_0x50f3db['body'],{'raw':_0x50f3db['options']?_0x50f3db[_0x7cde('0x19')][_0x7cde('0x1a')]===undefined?!![]:![]:!![]})[_0x7cde('0xa')](function(_0x227e15){logger[_0x7cde('0x13')]('CreateMemberReport',_0x50f3db);logger['debug'](_0x7cde('0x21'),_0x50f3db,JSON[_0x7cde('0xf')](_0x227e15));_0xfa949d(_0x227e15);})[_0x7cde('0x15')](function(_0x3bf73d){logger[_0x7cde('0x10')]('CreateMemberReport',_0x3bf73d[_0x7cde('0x12')],_0x50f3db);_0x6052be(_0x5b6e2c[_0x7cde('0x10')](0x1f4,_0x3bf73d[_0x7cde('0x12')]));});});};exports[_0x7cde('0x23')]=function(_0xa0251d){var _0x50ac2b=this;return new Promise(function(_0x19a6c2,_0xff58d0){return db[_0x7cde('0x17')][_0x7cde('0x24')](_0xa0251d[_0x7cde('0x25')],{'raw':_0xa0251d[_0x7cde('0x19')]?_0xa0251d[_0x7cde('0x19')][_0x7cde('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa0251d[_0x7cde('0x19')]?_0xa0251d[_0x7cde('0x19')][_0x7cde('0x1b')]||null:null,'attributes':_0xa0251d[_0x7cde('0x19')]?_0xa0251d[_0x7cde('0x19')]['attributes']||null:null,'limit':_0xa0251d[_0x7cde('0x19')]?_0xa0251d[_0x7cde('0x19')][_0x7cde('0x1d')]||null:null})[_0x7cde('0xa')](function(_0x3cba3b){logger[_0x7cde('0x13')](_0x7cde('0x23'),_0xa0251d);logger[_0x7cde('0xd')](_0x7cde('0x23'),_0xa0251d,JSON[_0x7cde('0xf')](_0x3cba3b));_0x19a6c2(_0x3cba3b);})[_0x7cde('0x15')](function(_0x26623b){logger['error'](_0x7cde('0x23'),_0x26623b[_0x7cde('0x12')],_0xa0251d);_0xff58d0(_0x50ac2b[_0x7cde('0x10')](0x1f4,_0x26623b[_0x7cde('0x12')]));});});}; \ No newline at end of file +var _0xdf98=['debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','options','raw','where','attributes','map','include','model','CreateMemberReport','body','UpdateMemberReport','MemberReport','update','limit','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MemberReport,\x20%s,\x20%s','request\x20sent'];(function(_0x3a7db0,_0xe93c50){var _0x17cbba=function(_0x577f4c){while(--_0x577f4c){_0x3a7db0['push'](_0x3a7db0['shift']());}};_0x17cbba(++_0xe93c50);}(_0xdf98,0xcf));var _0x8df9=function(_0x3fd27c,_0x291768){_0x3fd27c=_0x3fd27c-0x0;var _0x35f210=_0xdf98[_0x3fd27c];return _0x35f210;};'use strict';var _=require(_0x8df9('0x0'));var util=require('util');var moment=require(_0x8df9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8df9('0x2'));var db=require(_0x8df9('0x3'))['db'];var utils=require(_0x8df9('0x4'));var logger=require(_0x8df9('0x5'))(_0x8df9('0x6'));var config=require(_0x8df9('0x7'));var jayson=require(_0x8df9('0x8'));var client=jayson[_0x8df9('0x9')][_0x8df9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e79af,_0x1ffe3b,_0x393533){return new BPromise(function(_0x410568,_0x48bc8e){return client['request'](_0x5e79af,_0x393533)[_0x8df9('0xb')](function(_0x513b37){logger[_0x8df9('0xc')](_0x8df9('0xd'),_0x1ffe3b,_0x8df9('0xe'));logger[_0x8df9('0xf')](_0x8df9('0x10'),_0x1ffe3b,_0x8df9('0xe'),JSON[_0x8df9('0x11')](_0x513b37));if(_0x513b37[_0x8df9('0x12')]){if(_0x513b37['error'][_0x8df9('0x13')]===0x1f4){logger[_0x8df9('0x12')](_0x8df9('0xd'),_0x1ffe3b,_0x513b37['error'][_0x8df9('0x14')]);return _0x48bc8e(_0x513b37[_0x8df9('0x12')][_0x8df9('0x14')]);}logger[_0x8df9('0x12')]('MemberReport,\x20%s,\x20%s',_0x1ffe3b,_0x513b37['error'][_0x8df9('0x14')]);return _0x410568(_0x513b37[_0x8df9('0x12')][_0x8df9('0x14')]);}else{logger['info'](_0x8df9('0xd'),_0x1ffe3b,'request\x20sent');_0x410568(_0x513b37[_0x8df9('0x15')]['message']);}})[_0x8df9('0x16')](function(_0x8e547d){logger[_0x8df9('0x12')](_0x8df9('0xd'),_0x1ffe3b,_0x8e547d);_0x48bc8e(_0x8e547d);});});}exports[_0x8df9('0x17')]=function(_0x16e8c4){var _0x5e19e5=this;return new Promise(function(_0x54f2b0,_0x3bf137){return db['MemberReport']['findAll']({'raw':_0x16e8c4[_0x8df9('0x18')]?_0x16e8c4[_0x8df9('0x18')][_0x8df9('0x19')]===undefined?!![]:![]:!![],'where':_0x16e8c4[_0x8df9('0x18')]?_0x16e8c4[_0x8df9('0x18')][_0x8df9('0x1a')]||null:null,'attributes':_0x16e8c4['options']?_0x16e8c4[_0x8df9('0x18')][_0x8df9('0x1b')]||null:null,'limit':_0x16e8c4[_0x8df9('0x18')]?_0x16e8c4['options']['limit']||null:null,'include':_0x16e8c4['options']?_0x16e8c4['options']['include']?_[_0x8df9('0x1c')](_0x16e8c4[_0x8df9('0x18')][_0x8df9('0x1d')],function(_0x3dea66){return{'model':db[_0x3dea66[_0x8df9('0x1e')]],'as':_0x3dea66['as'],'attributes':_0x3dea66[_0x8df9('0x1b')],'include':_0x3dea66[_0x8df9('0x1d')]?_[_0x8df9('0x1c')](_0x3dea66['include'],function(_0x3323dc){return{'model':db[_0x3323dc[_0x8df9('0x1e')]],'as':_0x3323dc['as'],'attributes':_0x3323dc[_0x8df9('0x1b')],'include':_0x3323dc['include']?_['map'](_0x3323dc[_0x8df9('0x1d')],function(_0x5117c9){return{'model':db[_0x5117c9['model']],'as':_0x5117c9['as'],'attributes':_0x5117c9[_0x8df9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8df9('0xb')](function(_0x3a43c5){logger[_0x8df9('0xc')](_0x8df9('0x17'),_0x16e8c4);logger['debug']('GetMemberReport',_0x16e8c4,JSON[_0x8df9('0x11')](_0x3a43c5));_0x54f2b0(_0x3a43c5);})[_0x8df9('0x16')](function(_0x2a9fee){logger['error'](_0x8df9('0x17'),_0x2a9fee[_0x8df9('0x14')],_0x16e8c4);_0x3bf137(_0x5e19e5['error'](0x1f4,_0x2a9fee[_0x8df9('0x14')]));});});};exports[_0x8df9('0x1f')]=function(_0x4a522f){var _0x26b063=this;return new Promise(function(_0x6463b5,_0x13ee72){return db['MemberReport']['create'](_0x4a522f[_0x8df9('0x20')],{'raw':_0x4a522f[_0x8df9('0x18')]?_0x4a522f[_0x8df9('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x8df9('0xb')](function(_0x395651){logger[_0x8df9('0xc')](_0x8df9('0x1f'),_0x4a522f);logger['debug'](_0x8df9('0x1f'),_0x4a522f,JSON[_0x8df9('0x11')](_0x395651));_0x6463b5(_0x395651);})['catch'](function(_0x26e3b6){logger['error']('CreateMemberReport',_0x26e3b6['message'],_0x4a522f);_0x13ee72(_0x26b063['error'](0x1f4,_0x26e3b6[_0x8df9('0x14')]));});});};exports[_0x8df9('0x21')]=function(_0x16b95e){var _0x8c94f6=this;return new Promise(function(_0x43dce0,_0x3bfe71){return db[_0x8df9('0x22')][_0x8df9('0x23')](_0x16b95e[_0x8df9('0x20')],{'raw':_0x16b95e[_0x8df9('0x18')]?_0x16b95e[_0x8df9('0x18')][_0x8df9('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x16b95e['options']?_0x16b95e['options']['where']||null:null,'attributes':_0x16b95e[_0x8df9('0x18')]?_0x16b95e[_0x8df9('0x18')]['attributes']||null:null,'limit':_0x16b95e[_0x8df9('0x18')]?_0x16b95e['options'][_0x8df9('0x24')]||null:null})[_0x8df9('0xb')](function(_0x4fdf54){logger['info']('UpdateMemberReport',_0x16b95e);logger[_0x8df9('0xf')](_0x8df9('0x21'),_0x16b95e,JSON[_0x8df9('0x11')](_0x4fdf54));_0x43dce0(_0x4fdf54);})['catch'](function(_0x589633){logger[_0x8df9('0x12')]('UpdateMemberReport',_0x589633[_0x8df9('0x14')],_0x16b95e);_0x3bfe71(_0x8c94f6[_0x8df9('0x12')](0x1f4,_0x589633['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 40db0bb..5f34b84 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 _0x85a9=['exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index'];(function(_0x238830,_0x545f75){var _0x5917f0=function(_0x12f821){while(--_0x12f821){_0x238830['push'](_0x238830['shift']());}};_0x5917f0(++_0x545f75);}(_0x85a9,0x1a3));var _0x985a=function(_0x595bd1,_0xb1e7a){_0x595bd1=_0x595bd1-0x0;var _0xd0344f=_0x85a9[_0x595bd1];return _0xd0344f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x985a('0x0'));var express=require(_0x985a('0x1'));var router=express[_0x985a('0x2')]();var fs_extra=require(_0x985a('0x3'));var auth=require(_0x985a('0x4'));var interaction=require(_0x985a('0x5'));var config=require(_0x985a('0x6'));var controller=require(_0x985a('0x7'));router[_0x985a('0x8')]('/',controller[_0x985a('0x9')]);module[_0x985a('0xa')]=router; \ No newline at end of file +var _0xe8ba=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','util'];(function(_0x3b56c0,_0xe100d8){var _0x377efe=function(_0x181589){while(--_0x181589){_0x3b56c0['push'](_0x3b56c0['shift']());}};_0x377efe(++_0xe100d8);}(_0xe8ba,0x18b));var _0xae8b=function(_0x6ed942,_0x3aa028){_0x6ed942=_0x6ed942-0x0;var _0x1be18b=_0xe8ba[_0x6ed942];return _0x1be18b;};'use strict';var multer=require('multer');var util=require(_0xae8b('0x0'));var path=require(_0xae8b('0x1'));var timeout=require(_0xae8b('0x2'));var express=require(_0xae8b('0x3'));var router=express[_0xae8b('0x4')]();var fs_extra=require(_0xae8b('0x5'));var auth=require(_0xae8b('0x6'));var interaction=require(_0xae8b('0x7'));var config=require('../../config/environment');var controller=require('./migration.controller');router[_0xae8b('0x8')]('/',controller['index']);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 3521033..5cb250c 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 _0xa935=['STRING','version','sequelize','exports'];(function(_0x3f497e,_0x5d3ce3){var _0x380626=function(_0x325063){while(--_0x325063){_0x3f497e['push'](_0x3f497e['shift']());}};_0x380626(++_0x5d3ce3);}(_0xa935,0x162));var _0x5a93=function(_0x1194ad,_0x435140){_0x1194ad=_0x1194ad-0x0;var _0x5f374d=_0xa935[_0x1194ad];return _0x5f374d;};'use strict';var Sequelize=require(_0x5a93('0x0'));module[_0x5a93('0x1')]={'version':{'type':Sequelize[_0x5a93('0x2')],'unique':_0x5a93('0x3')}}; \ No newline at end of file +var _0x84b5=['exports','STRING','sequelize'];(function(_0x285c9,_0x53c6a8){var _0x1f4d83=function(_0x28e720){while(--_0x28e720){_0x285c9['push'](_0x285c9['shift']());}};_0x1f4d83(++_0x53c6a8);}(_0x84b5,0xf5));var _0x584b=function(_0x1110fd,_0x4ccd29){_0x1110fd=_0x1110fd-0x0;var _0x5e9179=_0x84b5[_0x1110fd];return _0x5e9179;};'use strict';var Sequelize=require(_0x584b('0x0'));module[_0x584b('0x1')]={'version':{'type':Sequelize[_0x584b('0x2')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 9be0402..061281b 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 _0x59db=['merge','type','options','includeAll','include','findAll','rows','catch','eml-format','rimraf','request-promise','moment','bluebird','util','path','ejs','fs-extra','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','status','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','name','send','index','Migration','rawAttributes','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter'];(function(_0x4c6f74,_0x9bd55d){var _0x2ad749=function(_0x12d5b7){while(--_0x12d5b7){_0x4c6f74['push'](_0x4c6f74['shift']());}};_0x2ad749(++_0x9bd55d);}(_0x59db,0x108));var _0xb59d=function(_0xf32042,_0x1af47c){_0xf32042=_0xf32042-0x0;var _0x34d11c=_0x59db[_0xf32042];return _0x34d11c;};'use strict';var emlformat=require(_0xb59d('0x0'));var rimraf=require(_0xb59d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb59d('0x2'));var moment=require(_0xb59d('0x3'));var BPromise=require(_0xb59d('0x4'));var Mustache=require('mustache');var util=require(_0xb59d('0x5'));var path=require(_0xb59d('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb59d('0x7'));var fs=require('fs');var fs_extra=require(_0xb59d('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb59d('0x9'));var deskjs=require(_0xb59d('0xa'));var toCsv=require('to-csv');var querystring=require(_0xb59d('0xb'));var Papa=require(_0xb59d('0xc'));var Redis=require(_0xb59d('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xb59d('0xe'));var as=require(_0xb59d('0xf'));var hardwareService=require(_0xb59d('0x10'));var logger=require(_0xb59d('0x11'))(_0xb59d('0x12'));var utils=require(_0xb59d('0x13'));var config=require(_0xb59d('0x14'));var licenseUtil=require(_0xb59d('0x15'));var db=require(_0xb59d('0x16'))['db'];function respondWithStatusCode(_0x35b42e,_0x34a3b2){_0x34a3b2=_0x34a3b2||0xcc;return function(_0x3be2b3){if(_0x3be2b3){return _0x35b42e['sendStatus'](_0x34a3b2);}return _0x35b42e[_0xb59d('0x17')](_0x34a3b2)['end']();};}function respondWithResult(_0x41e5b3,_0x147e14){_0x147e14=_0x147e14||0xc8;return function(_0x99f1e5){if(_0x99f1e5){return _0x41e5b3[_0xb59d('0x17')](_0x147e14)[_0xb59d('0x18')](_0x99f1e5);}};}function respondWithFilteredResult(_0x136e25,_0x48c235){return function(_0x42c3e1){if(_0x42c3e1){var _0x848d57=typeof _0x48c235[_0xb59d('0x19')]==='undefined'&&typeof _0x48c235[_0xb59d('0x1a')]==='undefined';var _0x1f07a4=_0x42c3e1[_0xb59d('0x1b')];var _0x157035=_0x848d57?0x0:_0x48c235['offset'];var _0x3e229a=_0x848d57?_0x42c3e1[_0xb59d('0x1b')]:_0x48c235['offset']+_0x48c235[_0xb59d('0x1a')];var _0x2fc575;if(_0x3e229a>=_0x1f07a4){_0x3e229a=_0x1f07a4;_0x2fc575=0xc8;}else{_0x2fc575=0xce;}_0x136e25['status'](_0x2fc575);return _0x136e25['set'](_0xb59d('0x1c'),_0x157035+'-'+_0x3e229a+'/'+_0x1f07a4)['json'](_0x42c3e1);}return null;};}function patchUpdates(_0x30357c){return function(_0x5484fe){try{jsonpatch[_0xb59d('0x1d')](_0x5484fe,_0x30357c,!![]);}catch(_0x3e5dd6){return BPromise[_0xb59d('0x1e')](_0x3e5dd6);}return _0x5484fe[_0xb59d('0x1f')]();};}function saveUpdates(_0x7b76a5,_0x58324c){return function(_0x41b979){if(_0x41b979){return _0x41b979[_0xb59d('0x20')](_0x7b76a5)[_0xb59d('0x21')](function(_0x17da15){return _0x17da15;});}return null;};}function removeEntity(_0x18e21e,_0x554f7e){return function(_0x510e56){if(_0x510e56){return _0x510e56[_0xb59d('0x22')]()[_0xb59d('0x21')](function(){_0x18e21e[_0xb59d('0x17')](0xcc)[_0xb59d('0x23')]();});}};}function handleEntityNotFound(_0x1b376e,_0x251ec5){return function(_0x31e760){if(!_0x31e760){_0x1b376e[_0xb59d('0x24')](0x194);}return _0x31e760;};}function handleError(_0x1cc419,_0x56813d){_0x56813d=_0x56813d||0x1f4;return function(_0x757918){logger['error'](_0x757918['stack']);if(_0x757918[_0xb59d('0x25')]){delete _0x757918[_0xb59d('0x25')];}_0x1cc419[_0xb59d('0x17')](_0x56813d)[_0xb59d('0x26')](_0x757918);};}exports[_0xb59d('0x27')]=function(_0x27d512,_0x2a2da4){var _0x151031={},_0x115c50={},_0x176025={'count':0x0,'rows':[]};var _0x533783=_['map'](db[_0xb59d('0x28')][_0xb59d('0x29')],function(_0x59e908){return{'name':_0x59e908['fieldName'],'type':_0x59e908['type'][_0xb59d('0x2a')]};});_0x115c50[_0xb59d('0x2b')]=_[_0xb59d('0x2c')](_0x533783,_0xb59d('0x25'));_0x115c50[_0xb59d('0x2d')]=_['keys'](_0x27d512[_0xb59d('0x2d')]);_0x115c50[_0xb59d('0x2e')]=_[_0xb59d('0x2f')](_0x115c50['model'],_0x115c50[_0xb59d('0x2d')]);_0x151031['attributes']=_[_0xb59d('0x2f')](_0x115c50[_0xb59d('0x2b')],qs['fields'](_0x27d512[_0xb59d('0x2d')][_0xb59d('0x30')]));_0x151031['attributes']=_0x151031[_0xb59d('0x31')]['length']?_0x151031[_0xb59d('0x31')]:_0x115c50[_0xb59d('0x2b')];if(!_0x27d512[_0xb59d('0x2d')][_0xb59d('0x32')]('nolimit')){_0x151031[_0xb59d('0x1a')]=qs[_0xb59d('0x1a')](_0x27d512['query']['limit']);_0x151031[_0xb59d('0x19')]=qs[_0xb59d('0x19')](_0x27d512[_0xb59d('0x2d')]['offset']);}_0x151031[_0xb59d('0x33')]=qs[_0xb59d('0x34')](_0x27d512[_0xb59d('0x2d')][_0xb59d('0x34')]);_0x151031[_0xb59d('0x35')]=qs[_0xb59d('0x2e')](_[_0xb59d('0x36')](_0x27d512[_0xb59d('0x2d')],_0x115c50[_0xb59d('0x2e')]),_0x533783);if(_0x27d512[_0xb59d('0x2d')][_0xb59d('0x37')]){_0x151031[_0xb59d('0x35')]=_[_0xb59d('0x38')](_0x151031[_0xb59d('0x35')],{'$or':_[_0xb59d('0x2c')](_0x533783,function(_0x5363ac){if(_0x5363ac[_0xb59d('0x39')]!=='VIRTUAL'){var _0x4c3d42={};_0x4c3d42[_0x5363ac[_0xb59d('0x25')]]={'$like':'%'+_0x27d512[_0xb59d('0x2d')]['filter']+'%'};return _0x4c3d42;}})});}_0x151031=_[_0xb59d('0x38')]({},_0x151031,_0x27d512[_0xb59d('0x3a')]);var _0x1af48b={'where':_0x151031[_0xb59d('0x35')]};return db['Migration'][_0xb59d('0x1b')](_0x1af48b)['then'](function(_0x31a5d1){_0x176025[_0xb59d('0x1b')]=_0x31a5d1;if(_0x27d512[_0xb59d('0x2d')][_0xb59d('0x3b')]){_0x151031[_0xb59d('0x3c')]=[{'all':!![]}];}return db[_0xb59d('0x28')][_0xb59d('0x3d')](_0x151031);})['then'](function(_0x5df188){_0x176025[_0xb59d('0x3e')]=_0x5df188;return _0x176025;})[_0xb59d('0x21')](respondWithFilteredResult(_0x2a2da4,_0x151031))[_0xb59d('0x3f')](handleError(_0x2a2da4,null));}; \ No newline at end of file +var _0xfaad=['keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','map','VIRTUAL','filter','merge','options','include','findAll','catch','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','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','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','save','destroy','then','error','send','index','Migration','rawAttributes','fieldName','type','model','name'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xfaad,0x1a0));var _0xdfaa=function(_0x879147,_0x2169a0){_0x879147=_0x879147-0x0;var _0x269335=_0xfaad[_0x879147];return _0x269335;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdfaa('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdfaa('0x1'));var rp=require(_0xdfaa('0x2'));var moment=require('moment');var BPromise=require(_0xdfaa('0x3'));var Mustache=require(_0xdfaa('0x4'));var util=require(_0xdfaa('0x5'));var path=require('path');var sox=require(_0xdfaa('0x6'));var csv=require(_0xdfaa('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdfaa('0x8'));var _=require(_0xdfaa('0x9'));var squel=require(_0xdfaa('0xa'));var crypto=require(_0xdfaa('0xb'));var jsforce=require(_0xdfaa('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdfaa('0x7'));var querystring=require(_0xdfaa('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdfaa('0xe'));var qs=require(_0xdfaa('0xf'));var as=require(_0xdfaa('0x10'));var hardwareService=require(_0xdfaa('0x11'));var logger=require(_0xdfaa('0x12'))(_0xdfaa('0x13'));var utils=require(_0xdfaa('0x14'));var config=require(_0xdfaa('0x15'));var licenseUtil=require(_0xdfaa('0x16'));var db=require(_0xdfaa('0x17'))['db'];function respondWithStatusCode(_0x537f99,_0x5b882a){_0x5b882a=_0x5b882a||0xcc;return function(_0x24515b){if(_0x24515b){return _0x537f99[_0xdfaa('0x18')](_0x5b882a);}return _0x537f99[_0xdfaa('0x19')](_0x5b882a)[_0xdfaa('0x1a')]();};}function respondWithResult(_0x5e266d,_0x4cb4d7){_0x4cb4d7=_0x4cb4d7||0xc8;return function(_0x4dcbc3){if(_0x4dcbc3){return _0x5e266d[_0xdfaa('0x19')](_0x4cb4d7)['json'](_0x4dcbc3);}};}function respondWithFilteredResult(_0x26c260,_0x473828){return function(_0xddb042){if(_0xddb042){var _0x872455=typeof _0x473828[_0xdfaa('0x1b')]==='undefined'&&typeof _0x473828['limit']===_0xdfaa('0x1c');var _0xfaf292=_0xddb042['count'];var _0x33ace7=_0x872455?0x0:_0x473828[_0xdfaa('0x1b')];var _0x3b6527=_0x872455?_0xddb042[_0xdfaa('0x1d')]:_0x473828[_0xdfaa('0x1b')]+_0x473828['limit'];var _0x5c19c9;if(_0x3b6527>=_0xfaf292){_0x3b6527=_0xfaf292;_0x5c19c9=0xc8;}else{_0x5c19c9=0xce;}_0x26c260['status'](_0x5c19c9);return _0x26c260[_0xdfaa('0x1e')](_0xdfaa('0x1f'),_0x33ace7+'-'+_0x3b6527+'/'+_0xfaf292)[_0xdfaa('0x20')](_0xddb042);}return null;};}function patchUpdates(_0x73ebee){return function(_0x71087d){try{jsonpatch[_0xdfaa('0x21')](_0x71087d,_0x73ebee,!![]);}catch(_0x30834a){return BPromise['reject'](_0x30834a);}return _0x71087d[_0xdfaa('0x22')]();};}function saveUpdates(_0x4fb023,_0x3fb71f){return function(_0xda9eb6){if(_0xda9eb6){return _0xda9eb6['update'](_0x4fb023)['then'](function(_0x597bd0){return _0x597bd0;});}return null;};}function removeEntity(_0x36708a,_0x444a93){return function(_0x45e009){if(_0x45e009){return _0x45e009[_0xdfaa('0x23')]()[_0xdfaa('0x24')](function(){_0x36708a[_0xdfaa('0x19')](0xcc)[_0xdfaa('0x1a')]();});}};}function handleEntityNotFound(_0x323e6b,_0xb1e3da){return function(_0x1bdf54){if(!_0x1bdf54){_0x323e6b[_0xdfaa('0x18')](0x194);}return _0x1bdf54;};}function handleError(_0x4a25bb,_0xbf4373){_0xbf4373=_0xbf4373||0x1f4;return function(_0x353c00){logger[_0xdfaa('0x25')](_0x353c00['stack']);if(_0x353c00['name']){delete _0x353c00['name'];}_0x4a25bb[_0xdfaa('0x19')](_0xbf4373)[_0xdfaa('0x26')](_0x353c00);};}exports[_0xdfaa('0x27')]=function(_0x43a8fc,_0x2e39be){var _0xc71b8a={},_0x259525={},_0x1de77a={'count':0x0,'rows':[]};var _0x417d99=_['map'](db[_0xdfaa('0x28')][_0xdfaa('0x29')],function(_0x29c9bf){return{'name':_0x29c9bf[_0xdfaa('0x2a')],'type':_0x29c9bf[_0xdfaa('0x2b')]['key']};});_0x259525[_0xdfaa('0x2c')]=_['map'](_0x417d99,_0xdfaa('0x2d'));_0x259525['query']=_[_0xdfaa('0x2e')](_0x43a8fc[_0xdfaa('0x2f')]);_0x259525[_0xdfaa('0x30')]=_[_0xdfaa('0x31')](_0x259525[_0xdfaa('0x2c')],_0x259525[_0xdfaa('0x2f')]);_0xc71b8a[_0xdfaa('0x32')]=_['intersection'](_0x259525[_0xdfaa('0x2c')],qs[_0xdfaa('0x33')](_0x43a8fc['query'][_0xdfaa('0x33')]));_0xc71b8a[_0xdfaa('0x32')]=_0xc71b8a[_0xdfaa('0x32')]['length']?_0xc71b8a[_0xdfaa('0x32')]:_0x259525['model'];if(!_0x43a8fc[_0xdfaa('0x2f')][_0xdfaa('0x34')](_0xdfaa('0x35'))){_0xc71b8a['limit']=qs[_0xdfaa('0x36')](_0x43a8fc[_0xdfaa('0x2f')][_0xdfaa('0x36')]);_0xc71b8a['offset']=qs[_0xdfaa('0x1b')](_0x43a8fc[_0xdfaa('0x2f')]['offset']);}_0xc71b8a['order']=qs[_0xdfaa('0x37')](_0x43a8fc[_0xdfaa('0x2f')][_0xdfaa('0x37')]);_0xc71b8a[_0xdfaa('0x38')]=qs[_0xdfaa('0x30')](_[_0xdfaa('0x39')](_0x43a8fc[_0xdfaa('0x2f')],_0x259525[_0xdfaa('0x30')]),_0x417d99);if(_0x43a8fc[_0xdfaa('0x2f')]['filter']){_0xc71b8a[_0xdfaa('0x38')]=_['merge'](_0xc71b8a[_0xdfaa('0x38')],{'$or':_[_0xdfaa('0x3a')](_0x417d99,function(_0x1aa6b4){if(_0x1aa6b4[_0xdfaa('0x2b')]!==_0xdfaa('0x3b')){var _0xb81309={};_0xb81309[_0x1aa6b4[_0xdfaa('0x2d')]]={'$like':'%'+_0x43a8fc['query'][_0xdfaa('0x3c')]+'%'};return _0xb81309;}})});}_0xc71b8a=_[_0xdfaa('0x3d')]({},_0xc71b8a,_0x43a8fc[_0xdfaa('0x3e')]);var _0xf70258={'where':_0xc71b8a[_0xdfaa('0x38')]};return db[_0xdfaa('0x28')][_0xdfaa('0x1d')](_0xf70258)[_0xdfaa('0x24')](function(_0x3c8f84){_0x1de77a['count']=_0x3c8f84;if(_0x43a8fc[_0xdfaa('0x2f')]['includeAll']){_0xc71b8a[_0xdfaa('0x3f')]=[{'all':!![]}];}return db[_0xdfaa('0x28')][_0xdfaa('0x40')](_0xc71b8a);})['then'](function(_0x300763){_0x1de77a['rows']=_0x300763;return _0x1de77a;})[_0xdfaa('0x24')](respondWithFilteredResult(_0x2e39be,_0xc71b8a))[_0xdfaa('0x41')](handleError(_0x2e39be,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 1521549..0256df4 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 _0x3a18=['./migration.attributes','exports','Migration','migrations','lodash','util','api','moment','bluebird','../../config/environment'];(function(_0x41f691,_0xd247d3){var _0x553888=function(_0x3caa74){while(--_0x3caa74){_0x41f691['push'](_0x41f691['shift']());}};_0x553888(++_0xd247d3);}(_0x3a18,0x1c6));var _0x83a1=function(_0x976f6b,_0x5b1a10){_0x976f6b=_0x976f6b-0x0;var _0x918265=_0x3a18[_0x976f6b];return _0x918265;};'use strict';var _=require(_0x83a1('0x0'));var util=require(_0x83a1('0x1'));var logger=require('../../config/logger')(_0x83a1('0x2'));var moment=require(_0x83a1('0x3'));var BPromise=require(_0x83a1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x83a1('0x5'));var attributes=require(_0x83a1('0x6'));module[_0x83a1('0x7')]=function(_0x3b88af,_0x34d4e8){return _0x3b88af['define'](_0x83a1('0x8'),attributes,{'tableName':_0x83a1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7991=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','Migration','migrations','lodash'];(function(_0x1e34aa,_0x46e09d){var _0xbf907d=function(_0x518ffd){while(--_0x518ffd){_0x1e34aa['push'](_0x1e34aa['shift']());}};_0xbf907d(++_0x46e09d);}(_0x7991,0x18b));var _0x1799=function(_0x12e707,_0x798cad){_0x12e707=_0x12e707-0x0;var _0x2c3ae8=_0x7991[_0x12e707];return _0x2c3ae8;};'use strict';var _=require(_0x1799('0x0'));var util=require(_0x1799('0x1'));var logger=require(_0x1799('0x2'))('api');var moment=require(_0x1799('0x3'));var BPromise=require('bluebird');var rp=require(_0x1799('0x4'));var fs=require('fs');var path=require(_0x1799('0x5'));var rimraf=require(_0x1799('0x6'));var config=require(_0x1799('0x7'));var attributes=require('./migration.attributes');module[_0x1799('0x8')]=function(_0x5b2b30,_0x5384d2){return _0x5b2b30[_0x1799('0x9')](_0x1799('0xa'),attributes,{'tableName':_0x1799('0xb'),'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 66d370d..a7f6efc 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 _0xd547=['bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client','http','request','Migration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','catch','moment'];(function(_0xf65503,_0x156551){var _0x2036d6=function(_0x20631d){while(--_0x20631d){_0xf65503['push'](_0xf65503['shift']());}};_0x2036d6(++_0x156551);}(_0xd547,0x1c1));var _0x7d54=function(_0x3c1312,_0x45bfdb){_0x3c1312=_0x3c1312-0x0;var _0x5b4831=_0xd547[_0x3c1312];return _0x5b4831;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7d54('0x0'));var BPromise=require(_0x7d54('0x1'));var rs=require(_0x7d54('0x2'));var fs=require('fs');var Redis=require(_0x7d54('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7d54('0x4'))('rpc');var config=require(_0x7d54('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x7d54('0x6')][_0x7d54('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1b7fc1,_0x5186ae,_0x5b0b16){return new BPromise(function(_0x478f9b,_0xb224a9){return client[_0x7d54('0x8')](_0x1b7fc1,_0x5b0b16)['then'](function(_0xa5b980){logger['info'](_0x7d54('0x9'),_0x5186ae,'request\x20sent');logger[_0x7d54('0xa')]('Migration,\x20%s,\x20%s,\x20%s',_0x5186ae,_0x7d54('0xb'),JSON[_0x7d54('0xc')](_0xa5b980));if(_0xa5b980['error']){if(_0xa5b980['error']['code']===0x1f4){logger[_0x7d54('0xd')](_0x7d54('0x9'),_0x5186ae,_0xa5b980[_0x7d54('0xd')]['message']);return _0xb224a9(_0xa5b980[_0x7d54('0xd')]['message']);}logger[_0x7d54('0xd')]('Migration,\x20%s,\x20%s',_0x5186ae,_0xa5b980[_0x7d54('0xd')][_0x7d54('0xe')]);return _0x478f9b(_0xa5b980['error'][_0x7d54('0xe')]);}else{logger[_0x7d54('0xf')](_0x7d54('0x9'),_0x5186ae,'request\x20sent');_0x478f9b(_0xa5b980[_0x7d54('0x10')][_0x7d54('0xe')]);}})[_0x7d54('0x11')](function(_0x12c48d){logger[_0x7d54('0xd')](_0x7d54('0x9'),_0x5186ae,_0x12c48d);_0xb224a9(_0x12c48d);});});} \ No newline at end of file +var _0xc718=['message','result','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','http','request','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0xc718,0xb6));var _0x8c71=function(_0x28448b,_0x8e0815){_0x28448b=_0x28448b-0x0;var _0x7d684a=_0xc718[_0x28448b];return _0x7d684a;};'use strict';var _=require(_0x8c71('0x0'));var util=require('util');var moment=require(_0x8c71('0x1'));var BPromise=require(_0x8c71('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c71('0x3'));var db=require(_0x8c71('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8c71('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x8c71('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4cfd67,_0xf122c7,_0x10c4a){return new BPromise(function(_0x29f3b7,_0x143ca0){return client[_0x8c71('0x7')](_0x4cfd67,_0x10c4a)['then'](function(_0xaeb417){logger[_0x8c71('0x8')](_0x8c71('0x9'),_0xf122c7,_0x8c71('0xa'));logger[_0x8c71('0xb')](_0x8c71('0xc'),_0xf122c7,_0x8c71('0xa'),JSON[_0x8c71('0xd')](_0xaeb417));if(_0xaeb417[_0x8c71('0xe')]){if(_0xaeb417['error'][_0x8c71('0xf')]===0x1f4){logger[_0x8c71('0xe')](_0x8c71('0x9'),_0xf122c7,_0xaeb417[_0x8c71('0xe')][_0x8c71('0x10')]);return _0x143ca0(_0xaeb417[_0x8c71('0xe')][_0x8c71('0x10')]);}logger[_0x8c71('0xe')](_0x8c71('0x9'),_0xf122c7,_0xaeb417[_0x8c71('0xe')][_0x8c71('0x10')]);return _0x29f3b7(_0xaeb417[_0x8c71('0xe')][_0x8c71('0x10')]);}else{logger[_0x8c71('0x8')](_0x8c71('0x9'),_0xf122c7,_0x8c71('0xa'));_0x29f3b7(_0xaeb417[_0x8c71('0x11')][_0x8c71('0x10')]);}})['catch'](function(_0x2588b3){logger[_0x8c71('0xe')]('Migration,\x20%s,\x20%s',_0xf122c7,_0x2588b3);_0x143ca0(_0x2588b3);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index f3c6d26..5df98ac 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 _0xf8fa=['../../components/interaction/service','../../config/environment','./network.controller','isAuthenticated','index','get','/:id','create','put','update','delete','exports','util','path','connect-timeout','express','fs-extra'];(function(_0x5b70a8,_0xb5daf0){var _0x4b68d2=function(_0x344eaf){while(--_0x344eaf){_0x5b70a8['push'](_0x5b70a8['shift']());}};_0x4b68d2(++_0xb5daf0);}(_0xf8fa,0x13e));var _0xaf8f=function(_0x4f7122,_0x35e5e5){_0x4f7122=_0x4f7122-0x0;var _0x1d1053=_0xf8fa[_0x4f7122];return _0x1d1053;};'use strict';var multer=require('multer');var util=require(_0xaf8f('0x0'));var path=require(_0xaf8f('0x1'));var timeout=require(_0xaf8f('0x2'));var express=require(_0xaf8f('0x3'));var router=express['Router']();var fs_extra=require(_0xaf8f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xaf8f('0x5'));var config=require(_0xaf8f('0x6'));var controller=require(_0xaf8f('0x7'));router['get']('/',auth[_0xaf8f('0x8')](),controller[_0xaf8f('0x9')]);router[_0xaf8f('0xa')](_0xaf8f('0xb'),auth[_0xaf8f('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xaf8f('0xc')]);router[_0xaf8f('0xd')](_0xaf8f('0xb'),auth[_0xaf8f('0x8')](),controller[_0xaf8f('0xe')]);router[_0xaf8f('0xf')](_0xaf8f('0xb'),auth[_0xaf8f('0x8')](),controller['destroy']);module[_0xaf8f('0x10')]=router; \ No newline at end of file +var _0x3c6a=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','index','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','util'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x3c6a,0xd1));var _0xa3c6=function(_0x5f519b,_0x5b606f){_0x5f519b=_0x5f519b-0x0;var _0x2461e2=_0x3c6a[_0x5f519b];return _0x2461e2;};'use strict';var multer=require('multer');var util=require(_0xa3c6('0x0'));var path=require(_0xa3c6('0x1'));var timeout=require(_0xa3c6('0x2'));var express=require(_0xa3c6('0x3'));var router=express[_0xa3c6('0x4')]();var fs_extra=require(_0xa3c6('0x5'));var auth=require(_0xa3c6('0x6'));var interaction=require(_0xa3c6('0x7'));var config=require(_0xa3c6('0x8'));var controller=require(_0xa3c6('0x9'));router[_0xa3c6('0xa')]('/',auth['isAuthenticated'](),controller[_0xa3c6('0xb')]);router[_0xa3c6('0xa')](_0xa3c6('0xc'),auth[_0xa3c6('0xd')](),controller[_0xa3c6('0xe')]);router[_0xa3c6('0xf')]('/',auth[_0xa3c6('0xd')](),controller[_0xa3c6('0x10')]);router[_0xa3c6('0x11')](_0xa3c6('0xc'),auth[_0xa3c6('0xd')](),controller['update']);router[_0xa3c6('0x12')]('/:id',auth[_0xa3c6('0xd')](),controller[_0xa3c6('0x13')]);module[_0xa3c6('0x14')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index cb7bdab..e381331 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 _0x9a9c=['exports','ENUM','localnet','externip','stun','turn','STRING','sequelize'];(function(_0x125c58,_0x115a58){var _0x3b657b=function(_0x3e044a){while(--_0x3e044a){_0x125c58['push'](_0x125c58['shift']());}};_0x3b657b(++_0x115a58);}(_0x9a9c,0x15f));var _0xc9a9=function(_0x5dd349,_0x229f43){_0x5dd349=_0x5dd349-0x0;var _0x3cd4d6=_0x9a9c[_0x5dd349];return _0x3cd4d6;};'use strict';var Sequelize=require(_0xc9a9('0x0'));module[_0xc9a9('0x1')]={'type':{'type':Sequelize[_0xc9a9('0x2')](_0xc9a9('0x3'),_0xc9a9('0x4'),_0xc9a9('0x5'),_0xc9a9('0x6'))},'value':{'type':Sequelize[_0xc9a9('0x7')]},'username':{'type':Sequelize[_0xc9a9('0x7')]},'password':{'type':Sequelize[_0xc9a9('0x7')]}}; \ No newline at end of file +var _0xfd61=['externip','STRING','sequelize','exports','localnet'];(function(_0x3a3f4d,_0x431eb8){var _0x58e2b1=function(_0x343efc){while(--_0x343efc){_0x3a3f4d['push'](_0x3a3f4d['shift']());}};_0x58e2b1(++_0x431eb8);}(_0xfd61,0x1e7));var _0x1fd6=function(_0x41868e,_0x30f9a6){_0x41868e=_0x41868e-0x0;var _0x27b68e=_0xfd61[_0x41868e];return _0x27b68e;};'use strict';var Sequelize=require(_0x1fd6('0x0'));module[_0x1fd6('0x1')]={'type':{'type':Sequelize['ENUM'](_0x1fd6('0x2'),_0x1fd6('0x3'),'stun','turn')},'value':{'type':Sequelize[_0x1fd6('0x4')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x1fd6('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 3d9b3a4..d5597b2 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 _0x0d8c=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','name','index','map','Network','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','sort','where','filters','pick','merge','VIRTUAL','filter','include','rows','show','length','includeAll','find','catch','transaction','create','body','findAll','STUN','join','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','toUpperCase','TURN','readFileSync','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','format','toLowerCase','chan_sip.so','params','server/files/templates/stun_multiple.ejs','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','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','../../mysqldb','jayson/promise','http','request','then','info','debug','Network,\x20%s,\x20%s,\x20%s','code','Network,\x20%s,\x20%s','error','message','request\x20sent','result','sendStatus'];(function(_0x4eafed,_0x26e2bc){var _0x159c85=function(_0x6f129f){while(--_0x6f129f){_0x4eafed['push'](_0x4eafed['shift']());}};_0x159c85(++_0x26e2bc);}(_0x0d8c,0xae));var _0xc0d8=function(_0x17ef94,_0x508369){_0x17ef94=_0x17ef94-0x0;var _0x599c10=_0x0d8c[_0x17ef94];return _0x599c10;};'use strict';var emlformat=require(_0xc0d8('0x0'));var rimraf=require(_0xc0d8('0x1'));var zipdir=require(_0xc0d8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc0d8('0x3'));var moment=require(_0xc0d8('0x4'));var BPromise=require(_0xc0d8('0x5'));var Mustache=require(_0xc0d8('0x6'));var util=require(_0xc0d8('0x7'));var path=require(_0xc0d8('0x8'));var sox=require(_0xc0d8('0x9'));var csv=require(_0xc0d8('0xa'));var ejs=require(_0xc0d8('0xb'));var fs=require('fs');var fs_extra=require(_0xc0d8('0xc'));var _=require(_0xc0d8('0xd'));var squel=require(_0xc0d8('0xe'));var crypto=require('crypto');var jsforce=require(_0xc0d8('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xc0d8('0xa'));var querystring=require(_0xc0d8('0x10'));var Papa=require(_0xc0d8('0x11'));var Redis=require(_0xc0d8('0x12'));var authService=require(_0xc0d8('0x13'));var qs=require(_0xc0d8('0x14'));var as=require(_0xc0d8('0x15'));var hardwareService=require(_0xc0d8('0x16'));var logger=require(_0xc0d8('0x17'))(_0xc0d8('0x18'));var utils=require(_0xc0d8('0x19'));var config=require(_0xc0d8('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xc0d8('0x1b'))['db'];var jayson=require(_0xc0d8('0x1c'));var client=jayson['client'][_0xc0d8('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x318050,_0x218743,_0x211986,_0x2e3961){return new BPromise(function(_0x16cfd1,_0x307415){var _0x2c2558=_0x2e3961||client;return _0x2c2558[_0xc0d8('0x1e')](_0x318050,_0x211986)[_0xc0d8('0x1f')](function(_0x2cdfb6){logger[_0xc0d8('0x20')]('Network,\x20%s,\x20%s',_0x218743,'request\x20sent');logger[_0xc0d8('0x21')](_0xc0d8('0x22'),_0x218743,'request\x20sent',JSON['stringify'](_0x2cdfb6));if(_0x2cdfb6['error']){if(_0x2cdfb6['error'][_0xc0d8('0x23')]===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0x218743,_0x2cdfb6['error']['message']);return _0x307415(_0x2cdfb6['error']['message']);}logger['error'](_0xc0d8('0x24'),_0x218743,_0x2cdfb6[_0xc0d8('0x25')][_0xc0d8('0x26')]);return _0x16cfd1(_0x2cdfb6[_0xc0d8('0x25')]['message']);}else{logger['info'](_0xc0d8('0x24'),_0x218743,_0xc0d8('0x27'));_0x16cfd1(_0x2cdfb6[_0xc0d8('0x28')][_0xc0d8('0x26')]);}})['catch'](function(_0x2446f4){logger[_0xc0d8('0x25')](_0xc0d8('0x24'),_0x218743,_0x2446f4);_0x307415(_0x2446f4);});});}function respondWithStatusCode(_0x119133,_0x561741){_0x561741=_0x561741||0xcc;return function(_0x205e19){if(_0x205e19){return _0x119133[_0xc0d8('0x29')](_0x561741);}return _0x119133[_0xc0d8('0x2a')](_0x561741)[_0xc0d8('0x2b')]();};}function respondWithResult(_0x423997,_0x2401aa){_0x2401aa=_0x2401aa||0xc8;return function(_0x21b666){if(_0x21b666){return _0x423997[_0xc0d8('0x2a')](_0x2401aa)[_0xc0d8('0x2c')](_0x21b666);}};}function respondWithFilteredResult(_0x14f868,_0x1761c9){return function(_0x22b3ff){if(_0x22b3ff){var _0x19d97a=typeof _0x1761c9[_0xc0d8('0x2d')]===_0xc0d8('0x2e')&&typeof _0x1761c9[_0xc0d8('0x2f')]===_0xc0d8('0x2e');var _0x2a2ded=_0x22b3ff[_0xc0d8('0x30')];var _0x15b941=_0x19d97a?0x0:_0x1761c9[_0xc0d8('0x2d')];var _0x2bcb3f=_0x19d97a?_0x22b3ff[_0xc0d8('0x30')]:_0x1761c9[_0xc0d8('0x2d')]+_0x1761c9['limit'];var _0x575b6a;if(_0x2bcb3f>=_0x2a2ded){_0x2bcb3f=_0x2a2ded;_0x575b6a=0xc8;}else{_0x575b6a=0xce;}_0x14f868[_0xc0d8('0x2a')](_0x575b6a);return _0x14f868[_0xc0d8('0x31')](_0xc0d8('0x32'),_0x15b941+'-'+_0x2bcb3f+'/'+_0x2a2ded)[_0xc0d8('0x2c')](_0x22b3ff);}return null;};}function patchUpdates(_0x1d8c82){return function(_0x29be31){try{jsonpatch[_0xc0d8('0x33')](_0x29be31,_0x1d8c82,!![]);}catch(_0x2cf601){return BPromise[_0xc0d8('0x34')](_0x2cf601);}return _0x29be31[_0xc0d8('0x35')]();};}function saveUpdates(_0x2b852e,_0x29fe41){return function(_0x59ee93){if(_0x59ee93){return _0x59ee93[_0xc0d8('0x36')](_0x2b852e)[_0xc0d8('0x1f')](function(_0x33fd02){return _0x33fd02;});}return null;};}function removeEntity(_0x24618c,_0x373946){return function(_0x460c72){if(_0x460c72){return _0x460c72['destroy']()[_0xc0d8('0x1f')](function(){_0x24618c[_0xc0d8('0x2a')](0xcc)[_0xc0d8('0x2b')]();});}};}function handleEntityNotFound(_0x8aa6c6,_0x57e8c8){return function(_0xf09265){if(!_0xf09265){_0x8aa6c6[_0xc0d8('0x29')](0x194);}return _0xf09265;};}function handleError(_0x15fd96,_0x57a345){_0x57a345=_0x57a345||0x1f4;return function(_0x246014){logger['error'](_0x246014['stack']);if(_0x246014[_0xc0d8('0x37')]){delete _0x246014['name'];}_0x15fd96[_0xc0d8('0x2a')](_0x57a345)['send'](_0x246014);};}exports[_0xc0d8('0x38')]=function(_0x37a819,_0x255117){var _0x1a3c96={},_0xb6589b={},_0x18303f={'count':0x0,'rows':[]};var _0x4b5986=_[_0xc0d8('0x39')](db[_0xc0d8('0x3a')][_0xc0d8('0x3b')],function(_0x17c8c6){return{'name':_0x17c8c6[_0xc0d8('0x3c')],'type':_0x17c8c6[_0xc0d8('0x3d')][_0xc0d8('0x3e')]};});_0xb6589b[_0xc0d8('0x3f')]=_['map'](_0x4b5986,_0xc0d8('0x37'));_0xb6589b[_0xc0d8('0x40')]=_[_0xc0d8('0x41')](_0x37a819[_0xc0d8('0x40')]);_0xb6589b['filters']=_['intersection'](_0xb6589b[_0xc0d8('0x3f')],_0xb6589b[_0xc0d8('0x40')]);_0x1a3c96[_0xc0d8('0x42')]=_[_0xc0d8('0x43')](_0xb6589b['model'],qs[_0xc0d8('0x44')](_0x37a819[_0xc0d8('0x40')][_0xc0d8('0x44')]));_0x1a3c96[_0xc0d8('0x42')]=_0x1a3c96['attributes']['length']?_0x1a3c96[_0xc0d8('0x42')]:_0xb6589b['model'];if(!_0x37a819[_0xc0d8('0x40')]['hasOwnProperty']('nolimit')){_0x1a3c96[_0xc0d8('0x2f')]=qs[_0xc0d8('0x2f')](_0x37a819[_0xc0d8('0x40')]['limit']);_0x1a3c96[_0xc0d8('0x2d')]=qs['offset'](_0x37a819[_0xc0d8('0x40')]['offset']);}_0x1a3c96['order']=qs[_0xc0d8('0x45')](_0x37a819[_0xc0d8('0x40')][_0xc0d8('0x45')]);_0x1a3c96[_0xc0d8('0x46')]=qs[_0xc0d8('0x47')](_[_0xc0d8('0x48')](_0x37a819['query'],_0xb6589b[_0xc0d8('0x47')]),_0x4b5986);if(_0x37a819['query']['filter']){_0x1a3c96[_0xc0d8('0x46')]=_[_0xc0d8('0x49')](_0x1a3c96[_0xc0d8('0x46')],{'$or':_[_0xc0d8('0x39')](_0x4b5986,function(_0x913a37){if(_0x913a37[_0xc0d8('0x3d')]!==_0xc0d8('0x4a')){var _0x21fd86={};_0x21fd86[_0x913a37[_0xc0d8('0x37')]]={'$like':'%'+_0x37a819[_0xc0d8('0x40')][_0xc0d8('0x4b')]+'%'};return _0x21fd86;}})});}_0x1a3c96=_[_0xc0d8('0x49')]({},_0x1a3c96,_0x37a819['options']);var _0x2a20f5={'where':_0x1a3c96[_0xc0d8('0x46')]};return db[_0xc0d8('0x3a')]['count'](_0x2a20f5)[_0xc0d8('0x1f')](function(_0x21a350){_0x18303f['count']=_0x21a350;if(_0x37a819[_0xc0d8('0x40')]['includeAll']){_0x1a3c96[_0xc0d8('0x4c')]=[{'all':!![]}];}return db[_0xc0d8('0x3a')]['findAll'](_0x1a3c96);})['then'](function(_0x1976ac){_0x18303f[_0xc0d8('0x4d')]=_0x1976ac;return _0x18303f;})[_0xc0d8('0x1f')](respondWithFilteredResult(_0x255117,_0x1a3c96))['catch'](handleError(_0x255117,null));};exports[_0xc0d8('0x4e')]=function(_0x18e588,_0x44d120){var _0x23dc3c={'raw':!![],'where':{'id':_0x18e588['params']['id']}},_0x340143={};_0x340143[_0xc0d8('0x3f')]=_[_0xc0d8('0x41')](db[_0xc0d8('0x3a')][_0xc0d8('0x3b')]);_0x340143[_0xc0d8('0x40')]=_[_0xc0d8('0x41')](_0x18e588[_0xc0d8('0x40')]);_0x340143[_0xc0d8('0x47')]=_[_0xc0d8('0x43')](_0x340143['model'],_0x340143[_0xc0d8('0x40')]);_0x23dc3c[_0xc0d8('0x42')]=_[_0xc0d8('0x43')](_0x340143[_0xc0d8('0x3f')],qs[_0xc0d8('0x44')](_0x18e588['query'][_0xc0d8('0x44')]));_0x23dc3c[_0xc0d8('0x42')]=_0x23dc3c[_0xc0d8('0x42')][_0xc0d8('0x4f')]?_0x23dc3c[_0xc0d8('0x42')]:_0x340143[_0xc0d8('0x3f')];if(_0x18e588[_0xc0d8('0x40')][_0xc0d8('0x50')]){_0x23dc3c[_0xc0d8('0x4c')]=[{'all':!![]}];}_0x23dc3c=_['merge']({},_0x23dc3c,_0x18e588['options']);return db[_0xc0d8('0x3a')][_0xc0d8('0x51')](_0x23dc3c)[_0xc0d8('0x1f')](handleEntityNotFound(_0x44d120,null))['then'](respondWithResult(_0x44d120,null))[_0xc0d8('0x52')](handleError(_0x44d120,null));};exports['create']=function(_0x4b3627,_0x27e49f,_0x3c65f7){var _0x3f39df;return db['sequelize'][_0xc0d8('0x53')](function(_0x1ff60){return db[_0xc0d8('0x3a')][_0xc0d8('0x54')](_0x4b3627[_0xc0d8('0x55')],{'raw':!![]})[_0xc0d8('0x1f')](function(_0x36769d){_0x3f39df=_0x36769d;return db[_0xc0d8('0x3a')][_0xc0d8('0x56')]({'where':{'type':_0x4b3627[_0xc0d8('0x55')][_0xc0d8('0x3d')]},'raw':!![]});})[_0xc0d8('0x1f')](function(_0x317611){if(_0x3f39df[_0xc0d8('0x3d')]['toUpperCase']()==_0xc0d8('0x57')){var _0x3a0d19=fs['readFileSync'](path[_0xc0d8('0x58')](config[_0xc0d8('0x59')],'server/files/templates/stun_multiple.ejs'),_0xc0d8('0x5a'));var _0x411eea=ejs[_0xc0d8('0x5b')](_0x3a0d19,{'networks':_0x317611||[]});fs[_0xc0d8('0x5c')](_0xc0d8('0x5d'),_0x411eea);return respondWithRpcPromise('Reload',_0xc0d8('0x54'),{'module':_0xc0d8('0x5e')});}else if(_0x3f39df[_0xc0d8('0x3d')][_0xc0d8('0x5f')]()==_0xc0d8('0x60')){var _0x4342a2=fs[_0xc0d8('0x61')](path[_0xc0d8('0x58')](config['root'],_0xc0d8('0x62')),_0xc0d8('0x5a'));var _0x522092=ejs[_0xc0d8('0x5b')](_0x4342a2,{'networks':_0x317611||[]});fs[_0xc0d8('0x5c')](_0xc0d8('0x63'),_0x522092);return respondWithRpcPromise(_0xc0d8('0x64'),'create',{'module':_0xc0d8('0x5e')});}else{var _0x3d9796=fs[_0xc0d8('0x61')](path[_0xc0d8('0x58')](config['root'],_0xc0d8('0x65')),_0xc0d8('0x5a'));var _0x441749=ejs[_0xc0d8('0x5b')](_0x3d9796,{'networks':_0x317611||[]});fs[_0xc0d8('0x5c')](util[_0xc0d8('0x66')]('/etc/asterisk/sip_xcally_%s.conf',_0x4b3627[_0xc0d8('0x55')]['type'][_0xc0d8('0x67')]()),_0x441749);return respondWithRpcPromise(_0xc0d8('0x64'),'create',{'module':_0xc0d8('0x68')});}return null;})[_0xc0d8('0x1f')](function(){return _0x3f39df;});})[_0xc0d8('0x1f')](respondWithResult(_0x27e49f,0xc9))['catch'](handleError(_0x27e49f,null));};exports[_0xc0d8('0x36')]=function(_0x3b08a4,_0x1c14d4,_0x44cc1b){var _0x214208;return db['sequelize'][_0xc0d8('0x53')](function(_0x5bc6bc){return db[_0xc0d8('0x3a')][_0xc0d8('0x51')]({'where':{'id':_0x3b08a4[_0xc0d8('0x69')]['id']}})[_0xc0d8('0x1f')](handleEntityNotFound(_0x1c14d4,null))[_0xc0d8('0x1f')](saveUpdates(_0x3b08a4[_0xc0d8('0x55')],null))[_0xc0d8('0x1f')](function(_0x234997){if(_0x234997){_0x214208=_0x234997;return db[_0xc0d8('0x3a')]['findAll']({'where':{'type':_0x214208[_0xc0d8('0x3d')]},'raw':!![]});}return null;})[_0xc0d8('0x1f')](function(_0x2cd466){if(_0x214208['type']['toUpperCase']()=='STUN'){var _0x250fd2=fs[_0xc0d8('0x61')](path[_0xc0d8('0x58')](config['root'],_0xc0d8('0x6a')),_0xc0d8('0x5a'));var _0x3893cf=ejs[_0xc0d8('0x5b')](_0x250fd2,{'networks':_0x2cd466||[]});fs[_0xc0d8('0x5c')](_0xc0d8('0x5d'),_0x3893cf);return respondWithRpcPromise(_0xc0d8('0x64'),'update',{'module':_0xc0d8('0x5e')});}else if(_0x214208[_0xc0d8('0x3d')][_0xc0d8('0x5f')]()==_0xc0d8('0x60')){var _0x368b2f=fs[_0xc0d8('0x61')](path['join'](config[_0xc0d8('0x59')],_0xc0d8('0x62')),_0xc0d8('0x5a'));var _0x56a052=ejs[_0xc0d8('0x5b')](_0x368b2f,{'networks':_0x2cd466||[]});fs[_0xc0d8('0x5c')]('/etc/asterisk/turn_xcally.conf',_0x56a052);return respondWithRpcPromise(_0xc0d8('0x64'),_0xc0d8('0x36'),{'module':_0xc0d8('0x5e')});}else{var _0x1e2f08=fs[_0xc0d8('0x61')](path[_0xc0d8('0x58')](config[_0xc0d8('0x59')],_0xc0d8('0x65')),_0xc0d8('0x5a'));var _0x569b76=ejs[_0xc0d8('0x5b')](_0x1e2f08,{'networks':_0x2cd466||[]});fs[_0xc0d8('0x5c')](util[_0xc0d8('0x66')]('/etc/asterisk/sip_xcally_%s.conf',_0x3b08a4[_0xc0d8('0x55')][_0xc0d8('0x3d')]['toLowerCase']()),_0x569b76);return respondWithRpcPromise(_0xc0d8('0x64'),_0xc0d8('0x36'),{'module':_0xc0d8('0x68')});}return null;})[_0xc0d8('0x1f')](function(_0x51d4f1){if(_0x51d4f1){return _0x214208;}return null;});})[_0xc0d8('0x1f')](respondWithResult(_0x1c14d4,null))[_0xc0d8('0x52')](handleError(_0x1c14d4,null));};exports[_0xc0d8('0x6b')]=function(_0x1beb35,_0x2a7fe1,_0xa5663b){var _0xb6278e;return db[_0xc0d8('0x3a')][_0xc0d8('0x51')]({'where':{'id':_0x1beb35[_0xc0d8('0x69')]['id']}})[_0xc0d8('0x1f')](function(_0x11a5fb){_0xb6278e=_0x11a5fb;return _0x11a5fb;})[_0xc0d8('0x1f')](handleEntityNotFound(_0x2a7fe1,null))['then'](removeEntity(_0x2a7fe1,null))[_0xc0d8('0x1f')](function(){if(_0xb6278e){return db[_0xc0d8('0x3a')][_0xc0d8('0x56')]({'where':{'type':_0xb6278e[_0xc0d8('0x3d')]},'raw':!![]});}})[_0xc0d8('0x1f')](function(_0x2b97db){if(_0xb6278e[_0xc0d8('0x3d')]['toUpperCase']()==_0xc0d8('0x57')){var _0xa12973=fs[_0xc0d8('0x61')](path[_0xc0d8('0x58')](config[_0xc0d8('0x59')],_0xc0d8('0x6a')),_0xc0d8('0x5a'));var _0x277b3b=ejs[_0xc0d8('0x5b')](_0xa12973,{'networks':_0x2b97db||[]});fs[_0xc0d8('0x5c')](_0xc0d8('0x5d'),_0x277b3b);return respondWithRpcPromise(_0xc0d8('0x64'),_0xc0d8('0x6b'),{'module':_0xc0d8('0x5e')});}else if(_0xb6278e[_0xc0d8('0x3d')][_0xc0d8('0x5f')]()==_0xc0d8('0x60')){var _0x204dd8=fs[_0xc0d8('0x61')](path[_0xc0d8('0x58')](config[_0xc0d8('0x59')],_0xc0d8('0x62')),_0xc0d8('0x5a'));var _0x43be31=ejs['render'](_0x204dd8,{'networks':_0x2b97db||[]});fs['writeFileSync'](_0xc0d8('0x63'),_0x43be31);return respondWithRpcPromise('Reload','destroy',{'module':_0xc0d8('0x5e')});}else{var _0x3c3463=fs[_0xc0d8('0x61')](path[_0xc0d8('0x58')](config['root'],_0xc0d8('0x65')),'utf8');var _0x5c94f8=ejs[_0xc0d8('0x5b')](_0x3c3463,{'networks':_0x2b97db||[]});fs[_0xc0d8('0x5c')](util[_0xc0d8('0x66')]('/etc/asterisk/sip_xcally_%s.conf',_0x1beb35['body']['type'][_0xc0d8('0x67')]()),_0x5c94f8);return respondWithRpcPromise('Reload',_0xc0d8('0x6b'),{'module':_0xc0d8('0x68')});}return null;})[_0xc0d8('0x52')](handleError(_0x2a7fe1,null));}; \ No newline at end of file +var _0x155e=['name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','merge','where','VIRTUAL','options','Network','includeAll','include','rows','create','sequelize','body','toUpperCase','STUN','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','Reload','res_stun_monitor.so','TURN','readFileSync','join','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','find','params','findAll','update','toLowerCase','/etc/asterisk/stun_xcally.conf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','sendStatus','status','end','json','offset','limit','undefined','count','reject','save','destroy','stack'];(function(_0x15af0f,_0x5454ce){var _0x2bd1cb=function(_0x593818){while(--_0x593818){_0x15af0f['push'](_0x15af0f['shift']());}};_0x2bd1cb(++_0x5454ce);}(_0x155e,0x9c));var _0xe155=function(_0x1dbe4c,_0x307507){_0x1dbe4c=_0x1dbe4c-0x0;var _0x13fb88=_0x155e[_0x1dbe4c];return _0x13fb88;};'use strict';var emlformat=require(_0xe155('0x0'));var rimraf=require(_0xe155('0x1'));var zipdir=require(_0xe155('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe155('0x3'));var moment=require(_0xe155('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe155('0x5'));var util=require(_0xe155('0x6'));var path=require('path');var sox=require(_0xe155('0x7'));var csv=require(_0xe155('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe155('0x9'));var _=require(_0xe155('0xa'));var squel=require(_0xe155('0xb'));var crypto=require(_0xe155('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe155('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe155('0xe'));var Papa=require(_0xe155('0xf'));var Redis=require(_0xe155('0x10'));var authService=require(_0xe155('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe155('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe155('0x13'));var utils=require(_0xe155('0x14'));var config=require(_0xe155('0x15'));var licenseUtil=require(_0xe155('0x16'));var db=require(_0xe155('0x17'))['db'];var jayson=require(_0xe155('0x18'));var client=jayson[_0xe155('0x19')][_0xe155('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x33b050,_0x47a3c4,_0x3b03f,_0x40bd7c){return new BPromise(function(_0x41615c,_0x2ca046){var _0x93378b=_0x40bd7c||client;return _0x93378b['request'](_0x33b050,_0x3b03f)[_0xe155('0x1b')](function(_0x428b6b){logger[_0xe155('0x1c')](_0xe155('0x1d'),_0x47a3c4,'request\x20sent');logger['debug'](_0xe155('0x1e'),_0x47a3c4,'request\x20sent',JSON[_0xe155('0x1f')](_0x428b6b));if(_0x428b6b['error']){if(_0x428b6b[_0xe155('0x20')]['code']===0x1f4){logger[_0xe155('0x20')](_0xe155('0x1d'),_0x47a3c4,_0x428b6b[_0xe155('0x20')][_0xe155('0x21')]);return _0x2ca046(_0x428b6b[_0xe155('0x20')][_0xe155('0x21')]);}logger[_0xe155('0x20')](_0xe155('0x1d'),_0x47a3c4,_0x428b6b[_0xe155('0x20')][_0xe155('0x21')]);return _0x41615c(_0x428b6b[_0xe155('0x20')]['message']);}else{logger[_0xe155('0x1c')](_0xe155('0x1d'),_0x47a3c4,_0xe155('0x22'));_0x41615c(_0x428b6b['result'][_0xe155('0x21')]);}})[_0xe155('0x23')](function(_0x2c24b0){logger['error'](_0xe155('0x1d'),_0x47a3c4,_0x2c24b0);_0x2ca046(_0x2c24b0);});});}function respondWithStatusCode(_0x18b742,_0x1037bf){_0x1037bf=_0x1037bf||0xcc;return function(_0x1fe3c5){if(_0x1fe3c5){return _0x18b742[_0xe155('0x24')](_0x1037bf);}return _0x18b742[_0xe155('0x25')](_0x1037bf)[_0xe155('0x26')]();};}function respondWithResult(_0x1146b9,_0x1b139a){_0x1b139a=_0x1b139a||0xc8;return function(_0x51e659){if(_0x51e659){return _0x1146b9[_0xe155('0x25')](_0x1b139a)[_0xe155('0x27')](_0x51e659);}};}function respondWithFilteredResult(_0x590114,_0x3cf87e){return function(_0x12e79e){if(_0x12e79e){var _0x3e4a6f=typeof _0x3cf87e[_0xe155('0x28')]==='undefined'&&typeof _0x3cf87e[_0xe155('0x29')]===_0xe155('0x2a');var _0x1dbba2=_0x12e79e[_0xe155('0x2b')];var _0x5cc352=_0x3e4a6f?0x0:_0x3cf87e[_0xe155('0x28')];var _0x37b694=_0x3e4a6f?_0x12e79e[_0xe155('0x2b')]:_0x3cf87e['offset']+_0x3cf87e['limit'];var _0x3949a3;if(_0x37b694>=_0x1dbba2){_0x37b694=_0x1dbba2;_0x3949a3=0xc8;}else{_0x3949a3=0xce;}_0x590114[_0xe155('0x25')](_0x3949a3);return _0x590114['set']('Content-Range',_0x5cc352+'-'+_0x37b694+'/'+_0x1dbba2)[_0xe155('0x27')](_0x12e79e);}return null;};}function patchUpdates(_0x13235e){return function(_0x948d3e){try{jsonpatch['apply'](_0x948d3e,_0x13235e,!![]);}catch(_0x3ee862){return BPromise[_0xe155('0x2c')](_0x3ee862);}return _0x948d3e[_0xe155('0x2d')]();};}function saveUpdates(_0x2eb5b8,_0x482eaa){return function(_0x295870){if(_0x295870){return _0x295870['update'](_0x2eb5b8)[_0xe155('0x1b')](function(_0x2c067f){return _0x2c067f;});}return null;};}function removeEntity(_0x38b58b,_0x53206c){return function(_0x353d7f){if(_0x353d7f){return _0x353d7f[_0xe155('0x2e')]()[_0xe155('0x1b')](function(){_0x38b58b[_0xe155('0x25')](0xcc)[_0xe155('0x26')]();});}};}function handleEntityNotFound(_0x5234f5,_0x7edb5c){return function(_0x27d288){if(!_0x27d288){_0x5234f5[_0xe155('0x24')](0x194);}return _0x27d288;};}function handleError(_0x1e570f,_0x46040e){_0x46040e=_0x46040e||0x1f4;return function(_0xa35dd7){logger[_0xe155('0x20')](_0xa35dd7[_0xe155('0x2f')]);if(_0xa35dd7[_0xe155('0x30')]){delete _0xa35dd7['name'];}_0x1e570f[_0xe155('0x25')](_0x46040e)[_0xe155('0x31')](_0xa35dd7);};}exports['index']=function(_0x5acf16,_0x191a6e){var _0x1f74ae={},_0x250abc={},_0xaf9a55={'count':0x0,'rows':[]};var _0xed7757=_[_0xe155('0x32')](db['Network'][_0xe155('0x33')],function(_0x5126f2){return{'name':_0x5126f2[_0xe155('0x34')],'type':_0x5126f2[_0xe155('0x35')][_0xe155('0x36')]};});_0x250abc[_0xe155('0x37')]=_[_0xe155('0x32')](_0xed7757,_0xe155('0x30'));_0x250abc[_0xe155('0x38')]=_[_0xe155('0x39')](_0x5acf16[_0xe155('0x38')]);_0x250abc[_0xe155('0x3a')]=_[_0xe155('0x3b')](_0x250abc[_0xe155('0x37')],_0x250abc[_0xe155('0x38')]);_0x1f74ae[_0xe155('0x3c')]=_[_0xe155('0x3b')](_0x250abc[_0xe155('0x37')],qs[_0xe155('0x3d')](_0x5acf16['query']['fields']));_0x1f74ae['attributes']=_0x1f74ae[_0xe155('0x3c')][_0xe155('0x3e')]?_0x1f74ae[_0xe155('0x3c')]:_0x250abc['model'];if(!_0x5acf16[_0xe155('0x38')][_0xe155('0x3f')]('nolimit')){_0x1f74ae[_0xe155('0x29')]=qs[_0xe155('0x29')](_0x5acf16['query'][_0xe155('0x29')]);_0x1f74ae[_0xe155('0x28')]=qs[_0xe155('0x28')](_0x5acf16[_0xe155('0x38')][_0xe155('0x28')]);}_0x1f74ae[_0xe155('0x40')]=qs[_0xe155('0x41')](_0x5acf16[_0xe155('0x38')]['sort']);_0x1f74ae['where']=qs['filters'](_['pick'](_0x5acf16[_0xe155('0x38')],_0x250abc[_0xe155('0x3a')]),_0xed7757);if(_0x5acf16[_0xe155('0x38')][_0xe155('0x42')]){_0x1f74ae['where']=_[_0xe155('0x43')](_0x1f74ae[_0xe155('0x44')],{'$or':_[_0xe155('0x32')](_0xed7757,function(_0x446470){if(_0x446470[_0xe155('0x35')]!==_0xe155('0x45')){var _0x15312f={};_0x15312f[_0x446470[_0xe155('0x30')]]={'$like':'%'+_0x5acf16[_0xe155('0x38')][_0xe155('0x42')]+'%'};return _0x15312f;}})});}_0x1f74ae=_[_0xe155('0x43')]({},_0x1f74ae,_0x5acf16[_0xe155('0x46')]);var _0x3f03a5={'where':_0x1f74ae[_0xe155('0x44')]};return db[_0xe155('0x47')][_0xe155('0x2b')](_0x3f03a5)['then'](function(_0x1a5560){_0xaf9a55[_0xe155('0x2b')]=_0x1a5560;if(_0x5acf16[_0xe155('0x38')][_0xe155('0x48')]){_0x1f74ae[_0xe155('0x49')]=[{'all':!![]}];}return db['Network']['findAll'](_0x1f74ae);})[_0xe155('0x1b')](function(_0x2df8dd){_0xaf9a55[_0xe155('0x4a')]=_0x2df8dd;return _0xaf9a55;})[_0xe155('0x1b')](respondWithFilteredResult(_0x191a6e,_0x1f74ae))[_0xe155('0x23')](handleError(_0x191a6e,null));};exports['show']=function(_0x3b6512,_0x43c5a3){var _0x1b50b3={'raw':!![],'where':{'id':_0x3b6512['params']['id']}},_0x5cf00f={};_0x5cf00f[_0xe155('0x37')]=_['keys'](db[_0xe155('0x47')]['rawAttributes']);_0x5cf00f['query']=_['keys'](_0x3b6512[_0xe155('0x38')]);_0x5cf00f[_0xe155('0x3a')]=_[_0xe155('0x3b')](_0x5cf00f['model'],_0x5cf00f[_0xe155('0x38')]);_0x1b50b3[_0xe155('0x3c')]=_[_0xe155('0x3b')](_0x5cf00f['model'],qs[_0xe155('0x3d')](_0x3b6512[_0xe155('0x38')]['fields']));_0x1b50b3[_0xe155('0x3c')]=_0x1b50b3[_0xe155('0x3c')][_0xe155('0x3e')]?_0x1b50b3[_0xe155('0x3c')]:_0x5cf00f[_0xe155('0x37')];if(_0x3b6512['query'][_0xe155('0x48')]){_0x1b50b3[_0xe155('0x49')]=[{'all':!![]}];}_0x1b50b3=_[_0xe155('0x43')]({},_0x1b50b3,_0x3b6512[_0xe155('0x46')]);return db[_0xe155('0x47')]['find'](_0x1b50b3)[_0xe155('0x1b')](handleEntityNotFound(_0x43c5a3,null))[_0xe155('0x1b')](respondWithResult(_0x43c5a3,null))[_0xe155('0x23')](handleError(_0x43c5a3,null));};exports[_0xe155('0x4b')]=function(_0x39a120,_0x13fa36,_0x16cb8e){var _0x11d514;return db[_0xe155('0x4c')]['transaction'](function(_0x303bfa){return db[_0xe155('0x47')]['create'](_0x39a120['body'],{'raw':!![]})[_0xe155('0x1b')](function(_0x366fb7){_0x11d514=_0x366fb7;return db[_0xe155('0x47')]['findAll']({'where':{'type':_0x39a120[_0xe155('0x4d')][_0xe155('0x35')]},'raw':!![]});})[_0xe155('0x1b')](function(_0x3236ba){if(_0x11d514[_0xe155('0x35')][_0xe155('0x4e')]()==_0xe155('0x4f')){var _0x260465=fs['readFileSync'](path['join'](config[_0xe155('0x50')],_0xe155('0x51')),_0xe155('0x52'));var _0x5b2af3=ejs[_0xe155('0x53')](_0x260465,{'networks':_0x3236ba||[]});fs[_0xe155('0x54')]('/etc/asterisk/stun_xcally.conf',_0x5b2af3);return respondWithRpcPromise(_0xe155('0x55'),_0xe155('0x4b'),{'module':_0xe155('0x56')});}else if(_0x11d514['type'][_0xe155('0x4e')]()==_0xe155('0x57')){var _0xec5add=fs[_0xe155('0x58')](path[_0xe155('0x59')](config[_0xe155('0x50')],_0xe155('0x5a')),'utf8');var _0x35ded8=ejs['render'](_0xec5add,{'networks':_0x3236ba||[]});fs[_0xe155('0x54')](_0xe155('0x5b'),_0x35ded8);return respondWithRpcPromise('Reload',_0xe155('0x4b'),{'module':_0xe155('0x56')});}else{var _0xbecf41=fs[_0xe155('0x58')](path[_0xe155('0x59')](config['root'],_0xe155('0x5c')),_0xe155('0x52'));var _0x448254=ejs[_0xe155('0x53')](_0xbecf41,{'networks':_0x3236ba||[]});fs[_0xe155('0x54')](util[_0xe155('0x5d')](_0xe155('0x5e'),_0x39a120[_0xe155('0x4d')][_0xe155('0x35')]['toLowerCase']()),_0x448254);return respondWithRpcPromise(_0xe155('0x55'),_0xe155('0x4b'),{'module':_0xe155('0x5f')});}return null;})[_0xe155('0x1b')](function(){return _0x11d514;});})[_0xe155('0x1b')](respondWithResult(_0x13fa36,0xc9))[_0xe155('0x23')](handleError(_0x13fa36,null));};exports['update']=function(_0x265288,_0x594482,_0x398544){var _0x186dc2;return db[_0xe155('0x4c')]['transaction'](function(_0x330499){return db[_0xe155('0x47')][_0xe155('0x60')]({'where':{'id':_0x265288[_0xe155('0x61')]['id']}})[_0xe155('0x1b')](handleEntityNotFound(_0x594482,null))['then'](saveUpdates(_0x265288[_0xe155('0x4d')],null))[_0xe155('0x1b')](function(_0x2af77b){if(_0x2af77b){_0x186dc2=_0x2af77b;return db[_0xe155('0x47')][_0xe155('0x62')]({'where':{'type':_0x186dc2[_0xe155('0x35')]},'raw':!![]});}return null;})[_0xe155('0x1b')](function(_0x1f6aeb){if(_0x186dc2[_0xe155('0x35')][_0xe155('0x4e')]()==_0xe155('0x4f')){var _0x33fb3b=fs['readFileSync'](path['join'](config[_0xe155('0x50')],'server/files/templates/stun_multiple.ejs'),_0xe155('0x52'));var _0x641388=ejs['render'](_0x33fb3b,{'networks':_0x1f6aeb||[]});fs[_0xe155('0x54')]('/etc/asterisk/stun_xcally.conf',_0x641388);return respondWithRpcPromise(_0xe155('0x55'),_0xe155('0x63'),{'module':_0xe155('0x56')});}else if(_0x186dc2['type']['toUpperCase']()==_0xe155('0x57')){var _0x5ee3df=fs[_0xe155('0x58')](path[_0xe155('0x59')](config['root'],_0xe155('0x5a')),_0xe155('0x52'));var _0x82a636=ejs['render'](_0x5ee3df,{'networks':_0x1f6aeb||[]});fs['writeFileSync'](_0xe155('0x5b'),_0x82a636);return respondWithRpcPromise('Reload',_0xe155('0x63'),{'module':_0xe155('0x56')});}else{var _0x22b32a=fs[_0xe155('0x58')](path[_0xe155('0x59')](config['root'],_0xe155('0x5c')),_0xe155('0x52'));var _0x78aa9=ejs['render'](_0x22b32a,{'networks':_0x1f6aeb||[]});fs[_0xe155('0x54')](util[_0xe155('0x5d')](_0xe155('0x5e'),_0x265288[_0xe155('0x4d')][_0xe155('0x35')][_0xe155('0x64')]()),_0x78aa9);return respondWithRpcPromise(_0xe155('0x55'),'update',{'module':'chan_sip.so'});}return null;})['then'](function(_0x372917){if(_0x372917){return _0x186dc2;}return null;});})[_0xe155('0x1b')](respondWithResult(_0x594482,null))[_0xe155('0x23')](handleError(_0x594482,null));};exports['destroy']=function(_0x2820f3,_0xaece2e,_0x5420c6){var _0x3cb0a9;return db[_0xe155('0x47')][_0xe155('0x60')]({'where':{'id':_0x2820f3['params']['id']}})[_0xe155('0x1b')](function(_0x348a16){_0x3cb0a9=_0x348a16;return _0x348a16;})[_0xe155('0x1b')](handleEntityNotFound(_0xaece2e,null))[_0xe155('0x1b')](removeEntity(_0xaece2e,null))[_0xe155('0x1b')](function(){if(_0x3cb0a9){return db['Network'][_0xe155('0x62')]({'where':{'type':_0x3cb0a9['type']},'raw':!![]});}})[_0xe155('0x1b')](function(_0x46306f){if(_0x3cb0a9[_0xe155('0x35')]['toUpperCase']()==_0xe155('0x4f')){var _0x233be0=fs[_0xe155('0x58')](path[_0xe155('0x59')](config['root'],'server/files/templates/stun_multiple.ejs'),_0xe155('0x52'));var _0x9a413c=ejs[_0xe155('0x53')](_0x233be0,{'networks':_0x46306f||[]});fs[_0xe155('0x54')](_0xe155('0x65'),_0x9a413c);return respondWithRpcPromise(_0xe155('0x55'),_0xe155('0x2e'),{'module':_0xe155('0x56')});}else if(_0x3cb0a9[_0xe155('0x35')]['toUpperCase']()==_0xe155('0x57')){var _0x106ae6=fs[_0xe155('0x58')](path[_0xe155('0x59')](config[_0xe155('0x50')],_0xe155('0x5a')),'utf8');var _0x8c3675=ejs[_0xe155('0x53')](_0x106ae6,{'networks':_0x46306f||[]});fs[_0xe155('0x54')](_0xe155('0x5b'),_0x8c3675);return respondWithRpcPromise(_0xe155('0x55'),_0xe155('0x2e'),{'module':'res_stun_monitor.so'});}else{var _0x21f7f4=fs[_0xe155('0x58')](path[_0xe155('0x59')](config[_0xe155('0x50')],_0xe155('0x5c')),_0xe155('0x52'));var _0x235dfb=ejs[_0xe155('0x53')](_0x21f7f4,{'networks':_0x46306f||[]});fs[_0xe155('0x54')](util[_0xe155('0x5d')]('/etc/asterisk/sip_xcally_%s.conf',_0x2820f3[_0xe155('0x4d')][_0xe155('0x35')][_0xe155('0x64')]()),_0x235dfb);return respondWithRpcPromise(_0xe155('0x55'),_0xe155('0x2e'),{'module':_0xe155('0x5f')});}return null;})['catch'](handleError(_0xaece2e,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index ab2fe6d..794bcab 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 _0xcea2=['../../config/environment','./network.attributes','define','Network','network','lodash','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x443215,_0x19408e){var _0x50f95e=function(_0x31ee49){while(--_0x31ee49){_0x443215['push'](_0x443215['shift']());}};_0x50f95e(++_0x19408e);}(_0xcea2,0x15a));var _0x2cea=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0xcea2[_0x24f31b];return _0x488401;};'use strict';var _=require(_0x2cea('0x0'));var util=require('util');var logger=require(_0x2cea('0x1'))('api');var moment=require(_0x2cea('0x2'));var BPromise=require(_0x2cea('0x3'));var rp=require(_0x2cea('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2cea('0x5'));var config=require(_0x2cea('0x6'));var attributes=require(_0x2cea('0x7'));module['exports']=function(_0x34f0f2,_0x485c26){return _0x34f0f2[_0x2cea('0x8')](_0x2cea('0x9'),attributes,{'tableName':_0x2cea('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a12=['util','bluebird','path','rimraf','../../config/environment','./network.attributes','exports','network'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x0a12,0xb8));var _0x20a1=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x0a12[_0xb24a3e];return _0x4038d7;};'use strict';var _=require('lodash');var util=require(_0x20a1('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x20a1('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20a1('0x2'));var rimraf=require(_0x20a1('0x3'));var config=require(_0x20a1('0x4'));var attributes=require(_0x20a1('0x5'));module[_0x20a1('0x6')]=function(_0x2e0ad3,_0x1fedd2){return _0x2e0ad3['define']('Network',attributes,{'tableName':_0x20a1('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index ac9db59..a0553f3 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x570eaa,_0x1fbecd){var _0x77c72a=function(_0x3fa0df){while(--_0x3fa0df){_0x570eaa['push'](_0x570eaa['shift']());}};_0x77c72a(++_0x1fbecd);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x10ca1b,_0x1c0fc6){_0x10ca1b=_0x10ca1b-0x0;var _0x445669=_0x7a54[_0x10ca1b];return _0x445669;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 97a5cf9..8707de8 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 _0x96a0=['removeDispositions','delete','removeAgents','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','update','destroy'];(function(_0x5d610d,_0x3fb616){var _0x2acb97=function(_0x5ed877){while(--_0x5ed877){_0x5d610d['push'](_0x5d610d['shift']());}};_0x2acb97(++_0x3fb616);}(_0x96a0,0x176));var _0x096a=function(_0x1233d2,_0x5efbb1){_0x1233d2=_0x1233d2-0x0;var _0x44af31=_0x96a0[_0x1233d2];return _0x44af31;};'use strict';var multer=require(_0x096a('0x0'));var util=require(_0x096a('0x1'));var path=require(_0x096a('0x2'));var timeout=require(_0x096a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x096a('0x4'));var auth=require(_0x096a('0x5'));var interaction=require(_0x096a('0x6'));var config=require(_0x096a('0x7'));var controller=require('./openchannelAccount.controller');router[_0x096a('0x8')]('/',auth[_0x096a('0x9')](),controller[_0x096a('0xa')]);router[_0x096a('0x8')]('/describe',auth[_0x096a('0x9')](),controller['describe']);router[_0x096a('0x8')](_0x096a('0xb'),auth[_0x096a('0x9')](),controller[_0x096a('0xc')]);router[_0x096a('0x8')](_0x096a('0xd'),auth['isAuthenticated'](),controller[_0x096a('0xe')]);router[_0x096a('0x8')](_0x096a('0xf'),auth[_0x096a('0x9')](),controller[_0x096a('0x10')]);router[_0x096a('0x8')](_0x096a('0x11'),auth[_0x096a('0x9')](),controller['getApplications']);router['get'](_0x096a('0x12'),auth[_0x096a('0x9')](),controller[_0x096a('0x13')]);router[_0x096a('0x8')](_0x096a('0x14'),auth[_0x096a('0x9')](),controller[_0x096a('0x15')]);router[_0x096a('0x16')]('/',auth[_0x096a('0x9')](),controller[_0x096a('0x17')]);router[_0x096a('0x16')](_0x096a('0xd'),auth[_0x096a('0x9')](),controller['addDisposition']);router[_0x096a('0x16')](_0x096a('0xf'),auth[_0x096a('0x9')](),controller['addAnswer']);router['post'](_0x096a('0x18'),controller[_0x096a('0x19')]);router[_0x096a('0x16')](_0x096a('0x11'),auth[_0x096a('0x9')](),controller[_0x096a('0x1a')]);router[_0x096a('0x16')](_0x096a('0x14'),auth[_0x096a('0x9')](),controller[_0x096a('0x1b')]);router['post'](_0x096a('0x1c'),auth['isAuthenticated'](),controller[_0x096a('0x1d')]);router[_0x096a('0x1e')](_0x096a('0xb'),auth[_0x096a('0x9')](),controller[_0x096a('0x1f')]);router['delete'](_0x096a('0xb'),auth['isAuthenticated'](),controller[_0x096a('0x20')]);router['delete']('/:id/dispositions',auth[_0x096a('0x9')](),controller[_0x096a('0x21')]);router[_0x096a('0x22')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0x096a('0x22')]('/:id/users',auth[_0x096a('0x9')](),controller[_0x096a('0x23')]);module[_0x096a('0x24')]=router; \ No newline at end of file +var _0xf2ce=['delete','/:id/dispositions','removeDispositions','removeAnswers','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','/describe','getDispositions','getAnswers','getApplications','/:id/interactions','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','/:id/notify','notify','addAgents','/:id/send','send','put','/:id','destroy'];(function(_0x1ffce4,_0x57b273){var _0x365f38=function(_0x299df7){while(--_0x299df7){_0x1ffce4['push'](_0x1ffce4['shift']());}};_0x365f38(++_0x57b273);}(_0xf2ce,0xfa));var _0xef2c=function(_0x4a0dae,_0x150977){_0x4a0dae=_0x4a0dae-0x0;var _0x129db0=_0xf2ce[_0x4a0dae];return _0x129db0;};'use strict';var multer=require(_0xef2c('0x0'));var util=require(_0xef2c('0x1'));var path=require(_0xef2c('0x2'));var timeout=require('connect-timeout');var express=require(_0xef2c('0x3'));var router=express[_0xef2c('0x4')]();var fs_extra=require(_0xef2c('0x5'));var auth=require(_0xef2c('0x6'));var interaction=require(_0xef2c('0x7'));var config=require('../../config/environment');var controller=require(_0xef2c('0x8'));router[_0xef2c('0x9')]('/',auth[_0xef2c('0xa')](),controller['index']);router[_0xef2c('0x9')](_0xef2c('0xb'),auth[_0xef2c('0xa')](),controller['describe']);router[_0xef2c('0x9')]('/:id',auth[_0xef2c('0xa')](),controller['show']);router[_0xef2c('0x9')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xef2c('0xc')]);router['get']('/:id/canned_answers',auth[_0xef2c('0xa')](),controller[_0xef2c('0xd')]);router['get']('/:id/applications',auth[_0xef2c('0xa')](),controller[_0xef2c('0xe')]);router[_0xef2c('0x9')](_0xef2c('0xf'),auth[_0xef2c('0xa')](),controller['getInteractions']);router['get'](_0xef2c('0x10'),auth[_0xef2c('0xa')](),controller[_0xef2c('0x11')]);router[_0xef2c('0x12')]('/',auth['isAuthenticated'](),controller[_0xef2c('0x13')]);router[_0xef2c('0x12')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xef2c('0x14')]);router[_0xef2c('0x12')](_0xef2c('0x15'),auth[_0xef2c('0xa')](),controller['addAnswer']);router[_0xef2c('0x12')](_0xef2c('0x16'),controller[_0xef2c('0x17')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller['addApplications']);router['post']('/:id/users',auth[_0xef2c('0xa')](),controller[_0xef2c('0x18')]);router[_0xef2c('0x12')](_0xef2c('0x19'),auth[_0xef2c('0xa')](),controller[_0xef2c('0x1a')]);router[_0xef2c('0x1b')](_0xef2c('0x1c'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xef2c('0x1c'),auth['isAuthenticated'](),controller[_0xef2c('0x1d')]);router[_0xef2c('0x1e')](_0xef2c('0x1f'),auth['isAuthenticated'](),controller[_0xef2c('0x20')]);router[_0xef2c('0x1e')]('/:id/canned_answers',auth[_0xef2c('0xa')](),controller[_0xef2c('0x21')]);router[_0xef2c('0x1e')](_0xef2c('0x10'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xef2c('0x22')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 54414b3..bfd7f79 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 _0xc15d=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','generate'];(function(_0x28ba74,_0x21d454){var _0x5ba3d8=function(_0x3384ab){while(--_0x3384ab){_0x28ba74['push'](_0x28ba74['shift']());}};_0x5ba3d8(++_0x21d454);}(_0xc15d,0x1b6));var _0xdc15=function(_0x43db15,_0x32aa9d){_0x43db15=_0x43db15-0x0;var _0x4c0319=_0xc15d[_0x43db15];return _0x4c0319;};'use strict';var Sequelize=require(_0xdc15('0x0'));var rs=require(_0xdc15('0x1'));module[_0xdc15('0x2')]={'name':{'type':Sequelize[_0xdc15('0x3')],'unique':_0xdc15('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xdc15('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xdc15('0x5')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xdc15('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xdc15('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdc15('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xdc15('0x3')]},'queueTransfer':{'type':Sequelize[_0xdc15('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdc15('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdc15('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdc15('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xdc15('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xdc15('0x6')],'defaultValue':![],'comment':_0xdc15('0x9'),'set':function(_0x4d9950){if(!_0x4d9950)this[_0xdc15('0xa')](_0xdc15('0xb'),null);this[_0xdc15('0xa')]('mandatoryDisposition',_0x4d9950);}}}; \ No newline at end of file +var _0x7a64=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','name','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0xc1ece5,_0x11849a){var _0x27b075=function(_0x2843ff){while(--_0x2843ff){_0xc1ece5['push'](_0xc1ece5['shift']());}};_0x27b075(++_0x11849a);}(_0x7a64,0x136));var _0x47a6=function(_0x18995b,_0x3fe313){_0x18995b=_0x18995b-0x0;var _0x33aff5=_0x7a64[_0x18995b];return _0x33aff5;};'use strict';var Sequelize=require(_0x47a6('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x47a6('0x1')],'unique':_0x47a6('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x47a6('0x1')]},'token':{'type':Sequelize[_0x47a6('0x1')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x47a6('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x47a6('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x47a6('0x3')],'defaultValue':function(){return _0x47a6('0x4');}},'notificationSound':{'type':Sequelize[_0x47a6('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x47a6('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x47a6('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x47a6('0x1')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x47a6('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x47a6('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x47a6('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x47a6('0x7'),'set':function(_0xa220f9){if(!_0xa220f9)this[_0x47a6('0x8')](_0x47a6('0x9'),null);this['setDataValue'](_0x47a6('0xa'),_0xa220f9);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 3897881..83ce915 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 _0xb5ae=['sort','filters','pick','where','merge','type','options','OpenchannelAccount','includeAll','findAll','rows','show','params','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','nolimit','filter','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','List','Contacts','DESC','OpenchannelApplication','account','applications','Applications','list','orderBy','priority','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','lastName','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','UserId','User','unshift','waitForTheAssignedAgent','startRouting','Start','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','finally','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','send','CmList','out','dataValues','Messages','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','jayson/promise','client','http','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','OpenchannelAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','rawAttributes','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','order'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0xb5ae,0x135));var _0xeb5a=function(_0x1374f2,_0x27d58d){_0x1374f2=_0x1374f2-0x0;var _0x15be85=_0xb5ae[_0x1374f2];return _0x15be85;};'use strict';var emlformat=require(_0xeb5a('0x0'));var rimraf=require(_0xeb5a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xeb5a('0x2'));var moment=require(_0xeb5a('0x3'));var BPromise=require(_0xeb5a('0x4'));var Mustache=require(_0xeb5a('0x5'));var util=require(_0xeb5a('0x6'));var path=require(_0xeb5a('0x7'));var sox=require(_0xeb5a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeb5a('0x9'));var _=require(_0xeb5a('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xeb5a('0xb'));var deskjs=require(_0xeb5a('0xc'));var toCsv=require(_0xeb5a('0xd'));var querystring=require(_0xeb5a('0xe'));var Papa=require(_0xeb5a('0xf'));var Redis=require(_0xeb5a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xeb5a('0x11'));var as=require(_0xeb5a('0x12'));var hardwareService=require(_0xeb5a('0x13'));var logger=require('../../config/logger')(_0xeb5a('0x14'));var utils=require(_0xeb5a('0x15'));var config=require(_0xeb5a('0x16'));var licenseUtil=require(_0xeb5a('0x17'));var db=require(_0xeb5a('0x18'))['db'];config['redis']=_[_0xeb5a('0x19')](config['redis'],{'host':_0xeb5a('0x1a'),'port':0x18eb});var socket=require(_0xeb5a('0x1b'))(new Redis(config['redis']));require('./openchannelAccount.socket')['register'](socket);var jayson=require(_0xeb5a('0x1c'));var client=jayson[_0xeb5a('0x1d')][_0xeb5a('0x1e')]({'port':0x232c});var client9002=jayson[_0xeb5a('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f8c0e,_0x5e1f53,_0x2f487f,_0x35ac03){return new BPromise(function(_0xa2a3a5,_0x5bff37){var _0x109aad=_0x35ac03||client;return _0x109aad[_0xeb5a('0x1f')](_0x2f8c0e,_0x2f487f)['then'](function(_0xff8831){logger['info'](_0xeb5a('0x20'),_0x5e1f53,_0xeb5a('0x21'));logger[_0xeb5a('0x22')](_0xeb5a('0x23'),_0x5e1f53,'request\x20sent',JSON[_0xeb5a('0x24')](_0xff8831));if(_0xff8831[_0xeb5a('0x25')]){if(_0xff8831[_0xeb5a('0x25')][_0xeb5a('0x26')]===0x1f4){logger['error'](_0xeb5a('0x20'),_0x5e1f53,_0xff8831[_0xeb5a('0x25')][_0xeb5a('0x27')]);return _0x5bff37(_0xff8831[_0xeb5a('0x25')][_0xeb5a('0x27')]);}logger[_0xeb5a('0x25')](_0xeb5a('0x20'),_0x5e1f53,_0xff8831['error']['message']);return _0xa2a3a5(_0xff8831[_0xeb5a('0x25')][_0xeb5a('0x27')]);}else{logger[_0xeb5a('0x28')](_0xeb5a('0x20'),_0x5e1f53,_0xeb5a('0x21'));_0xa2a3a5(_0xff8831[_0xeb5a('0x29')]['message']);}})[_0xeb5a('0x2a')](function(_0x56c719){logger[_0xeb5a('0x25')](_0xeb5a('0x20'),_0x5e1f53,_0x56c719);_0x5bff37(_0x56c719);});});}function respondWithStatusCode(_0x38c008,_0x17341a){_0x17341a=_0x17341a||0xcc;return function(_0x38d0a7){if(_0x38d0a7){return _0x38c008[_0xeb5a('0x2b')](_0x17341a);}return _0x38c008[_0xeb5a('0x2c')](_0x17341a)[_0xeb5a('0x2d')]();};}function respondWithResult(_0x1b01ac,_0x41f14e){_0x41f14e=_0x41f14e||0xc8;return function(_0x38d4d4){if(_0x38d4d4){return _0x1b01ac[_0xeb5a('0x2c')](_0x41f14e)[_0xeb5a('0x2e')](_0x38d4d4);}};}function respondWithFilteredResult(_0x1ab695,_0xb70abd){return function(_0x5129d9){if(_0x5129d9){var _0x42aef8=typeof _0xb70abd[_0xeb5a('0x2f')]==='undefined'&&typeof _0xb70abd[_0xeb5a('0x30')]===_0xeb5a('0x31');var _0x1e0873=_0x5129d9['count'];var _0x29945b=_0x42aef8?0x0:_0xb70abd[_0xeb5a('0x2f')];var _0x4a707f=_0x42aef8?_0x5129d9[_0xeb5a('0x32')]:_0xb70abd['offset']+_0xb70abd['limit'];var _0xdc0514;if(_0x4a707f>=_0x1e0873){_0x4a707f=_0x1e0873;_0xdc0514=0xc8;}else{_0xdc0514=0xce;}_0x1ab695[_0xeb5a('0x2c')](_0xdc0514);return _0x1ab695[_0xeb5a('0x33')](_0xeb5a('0x34'),_0x29945b+'-'+_0x4a707f+'/'+_0x1e0873)[_0xeb5a('0x2e')](_0x5129d9);}return null;};}function patchUpdates(_0x53bd2b){return function(_0x10885b){try{jsonpatch['apply'](_0x10885b,_0x53bd2b,!![]);}catch(_0x4f2e5d){return BPromise[_0xeb5a('0x35')](_0x4f2e5d);}return _0x10885b[_0xeb5a('0x36')]();};}function saveUpdates(_0x5d205e,_0x3895e4){return function(_0x60a418){if(_0x60a418){return _0x60a418[_0xeb5a('0x37')](_0x5d205e)[_0xeb5a('0x38')](function(_0x5a9484){return _0x5a9484;});}return null;};}function removeEntity(_0x197070,_0x41f50d){return function(_0x4383c9){if(_0x4383c9){return _0x4383c9[_0xeb5a('0x39')]()[_0xeb5a('0x38')](function(){var _0x453838=_0x4383c9['get']({'plain':!![]});var _0x59f5a3=_0xeb5a('0x3a');return db[_0xeb5a('0x3b')][_0xeb5a('0x39')]({'where':{'type':_0x59f5a3,'resourceId':_0x453838['id']}})[_0xeb5a('0x38')](function(){return _0x4383c9;});})['then'](function(){_0x197070['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x35d3dd,_0x471f49){return function(_0x4c1511){if(!_0x4c1511){_0x35d3dd['sendStatus'](0x194);}return _0x4c1511;};}function handleError(_0x394155,_0x430e61){_0x430e61=_0x430e61||0x1f4;return function(_0x12a376){logger['error'](_0x12a376[_0xeb5a('0x3c')]);if(_0x12a376[_0xeb5a('0x3d')]){delete _0x12a376[_0xeb5a('0x3d')];}_0x394155['status'](_0x430e61)['send'](_0x12a376);};}exports[_0xeb5a('0x3e')]=function(_0x3804d2,_0x49c934){var _0x3a8426={'include':[{'model':db[_0xeb5a('0x3f')],'as':_0xeb5a('0x40')}]},_0x8df6b7={},_0x476cfe={'count':0x0,'rows':[]};var _0x5d4558=_[_0xeb5a('0x41')](db['OpenchannelAccount'][_0xeb5a('0x42')],function(_0x7361ac){return{'name':_0x7361ac['fieldName'],'type':_0x7361ac['type'][_0xeb5a('0x43')]};});_0x8df6b7['model']=_[_0xeb5a('0x41')](_0x5d4558,_0xeb5a('0x3d'));_0x8df6b7[_0xeb5a('0x44')]=_[_0xeb5a('0x45')](_0x3804d2[_0xeb5a('0x44')]);_0x8df6b7['filters']=_[_0xeb5a('0x46')](_0x8df6b7[_0xeb5a('0x47')],_0x8df6b7[_0xeb5a('0x44')]);_0x3a8426['attributes']=_[_0xeb5a('0x46')](_0x8df6b7[_0xeb5a('0x47')],qs[_0xeb5a('0x48')](_0x3804d2['query'][_0xeb5a('0x48')]));_0x3a8426[_0xeb5a('0x49')]=_0x3a8426[_0xeb5a('0x49')][_0xeb5a('0x4a')]?_0x3a8426[_0xeb5a('0x49')]:_0x8df6b7[_0xeb5a('0x47')];if(!_0x3804d2[_0xeb5a('0x44')][_0xeb5a('0x4b')]('nolimit')){_0x3a8426[_0xeb5a('0x30')]=qs[_0xeb5a('0x30')](_0x3804d2['query']['limit']);_0x3a8426[_0xeb5a('0x2f')]=qs[_0xeb5a('0x2f')](_0x3804d2['query'][_0xeb5a('0x2f')]);}_0x3a8426[_0xeb5a('0x4c')]=qs[_0xeb5a('0x4d')](_0x3804d2[_0xeb5a('0x44')][_0xeb5a('0x4d')]);_0x3a8426['where']=qs[_0xeb5a('0x4e')](_[_0xeb5a('0x4f')](_0x3804d2[_0xeb5a('0x44')],_0x8df6b7[_0xeb5a('0x4e')]),_0x5d4558);if(_0x3804d2['query']['filter']){_0x3a8426[_0xeb5a('0x50')]=_[_0xeb5a('0x51')](_0x3a8426['where'],{'$or':_[_0xeb5a('0x41')](_0x5d4558,function(_0x45053f){if(_0x45053f[_0xeb5a('0x52')]!=='VIRTUAL'){var _0x298de4={};_0x298de4[_0x45053f[_0xeb5a('0x3d')]]={'$like':'%'+_0x3804d2['query']['filter']+'%'};return _0x298de4;}})});}_0x3a8426=_[_0xeb5a('0x51')]({},_0x3a8426,_0x3804d2[_0xeb5a('0x53')]);var _0x2ee940={'where':_0x3a8426['where']};return db[_0xeb5a('0x54')][_0xeb5a('0x32')](_0x2ee940)[_0xeb5a('0x38')](function(_0x87254b){_0x476cfe[_0xeb5a('0x32')]=_0x87254b;if(_0x3804d2['query'][_0xeb5a('0x55')]){_0x3a8426['include']=[{'all':!![]}];}return db[_0xeb5a('0x54')][_0xeb5a('0x56')](_0x3a8426);})['then'](function(_0x3b3b35){_0x476cfe[_0xeb5a('0x57')]=_0x3b3b35;return _0x476cfe;})['then'](respondWithFilteredResult(_0x49c934,_0x3a8426))[_0xeb5a('0x2a')](handleError(_0x49c934,null));};exports[_0xeb5a('0x58')]=function(_0x414790,_0x42306b){var _0x42fab0={'raw':![],'where':{'id':_0x414790[_0xeb5a('0x59')]['id']},'include':[{'model':db[_0xeb5a('0x3f')],'as':_0xeb5a('0x40')}]},_0x1a8652={};_0x1a8652[_0xeb5a('0x47')]=_[_0xeb5a('0x45')](db[_0xeb5a('0x54')][_0xeb5a('0x42')]);_0x1a8652[_0xeb5a('0x44')]=_[_0xeb5a('0x45')](_0x414790[_0xeb5a('0x44')]);_0x1a8652['filters']=_['intersection'](_0x1a8652['model'],_0x1a8652[_0xeb5a('0x44')]);_0x42fab0[_0xeb5a('0x49')]=_[_0xeb5a('0x46')](_0x1a8652[_0xeb5a('0x47')],qs[_0xeb5a('0x48')](_0x414790[_0xeb5a('0x44')][_0xeb5a('0x48')]));_0x42fab0[_0xeb5a('0x49')]=_0x42fab0[_0xeb5a('0x49')][_0xeb5a('0x4a')]?_0x42fab0[_0xeb5a('0x49')]:_0x1a8652[_0xeb5a('0x47')];if(_0x414790['query'][_0xeb5a('0x55')]){_0x42fab0[_0xeb5a('0x5a')]=[{'all':!![]}];}_0x42fab0=_['merge']({},_0x42fab0,_0x414790['options']);return db[_0xeb5a('0x54')][_0xeb5a('0x5b')](_0x42fab0)[_0xeb5a('0x38')](handleEntityNotFound(_0x42306b,null))[_0xeb5a('0x38')](respondWithResult(_0x42306b,null))[_0xeb5a('0x2a')](handleError(_0x42306b,null));};exports['create']=function(_0x4c42df,_0x15c5a4){return db[_0xeb5a('0x54')][_0xeb5a('0x5c')](_0x4c42df[_0xeb5a('0x5d')],{})[_0xeb5a('0x38')](function(_0x238c70){var _0x252baf=_0x4c42df[_0xeb5a('0x5e')][_0xeb5a('0x5f')]({'plain':!![]});if(!_0x252baf)throw new Error(_0xeb5a('0x60'));if(_0x252baf[_0xeb5a('0x61')]===_0xeb5a('0x5e')){var _0x2d4d76=_0x238c70[_0xeb5a('0x5f')]({'plain':!![]});var _0xb4f376=_0xeb5a('0x3a');return db[_0xeb5a('0x62')][_0xeb5a('0x5b')]({'where':{'name':_0xb4f376,'userProfileId':_0x252baf['userProfileId']},'raw':!![]})[_0xeb5a('0x38')](function(_0x1db9a7){if(_0x1db9a7&&_0x1db9a7[_0xeb5a('0x63')]===0x0){return db[_0xeb5a('0x3b')][_0xeb5a('0x5c')]({'name':_0x2d4d76[_0xeb5a('0x3d')],'resourceId':_0x2d4d76['id'],'type':_0x1db9a7['name'],'sectionId':_0x1db9a7['id']},{})[_0xeb5a('0x38')](function(){return _0x238c70;});}else{return _0x238c70;}})[_0xeb5a('0x2a')](function(_0x5100a5){logger[_0xeb5a('0x25')](_0xeb5a('0x64'),_0x5100a5);throw _0x5100a5;});}return _0x238c70;})['then'](respondWithResult(_0x15c5a4,0xc9))['catch'](handleError(_0x15c5a4,null));};exports[_0xeb5a('0x37')]=function(_0x2fda3d,_0x3366f2){if(_0x2fda3d[_0xeb5a('0x5d')]['id']){delete _0x2fda3d[_0xeb5a('0x5d')]['id'];}return db[_0xeb5a('0x54')][_0xeb5a('0x5b')]({'where':{'id':_0x2fda3d[_0xeb5a('0x59')]['id']},'include':[{'model':db[_0xeb5a('0x3f')],'as':_0xeb5a('0x40')}]})[_0xeb5a('0x38')](handleEntityNotFound(_0x3366f2,null))[_0xeb5a('0x38')](saveUpdates(_0x2fda3d[_0xeb5a('0x5d')],null))[_0xeb5a('0x38')](respondWithResult(_0x3366f2,null))[_0xeb5a('0x2a')](handleError(_0x3366f2,null));};exports[_0xeb5a('0x39')]=function(_0x13572f,_0x44eb50){return db['OpenchannelAccount'][_0xeb5a('0x5b')]({'where':{'id':_0x13572f['params']['id']}})['then'](handleEntityNotFound(_0x44eb50,null))[_0xeb5a('0x38')](removeEntity(_0x44eb50,null))[_0xeb5a('0x2a')](handleError(_0x44eb50,null));};exports[_0xeb5a('0x65')]=function(_0x83eb1b,_0xa80796){return db['OpenchannelAccount'][_0xeb5a('0x65')]()[_0xeb5a('0x38')](respondWithResult(_0xa80796,null))['catch'](handleError(_0xa80796,null));};exports[_0xeb5a('0x66')]=function(_0x3ffbba,_0x275140,_0x264d15){if(_0x3ffbba[_0xeb5a('0x5d')]['id']){delete _0x3ffbba[_0xeb5a('0x5d')]['id'];}return db['OpenchannelAccount'][_0xeb5a('0x5b')]({'where':{'id':_0x3ffbba[_0xeb5a('0x59')]['id']}})['then'](handleEntityNotFound(_0x275140,null))[_0xeb5a('0x38')](function(_0x2566b3){if(_0x2566b3){_0x3ffbba[_0xeb5a('0x5d')][_0xeb5a('0x67')]=_0x2566b3['id'];return db[_0xeb5a('0x68')][_0xeb5a('0x5c')](_0x3ffbba[_0xeb5a('0x5d')]);}})['then'](respondWithResult(_0x275140,null))['catch'](handleError(_0x275140,null));};exports[_0xeb5a('0x69')]=function(_0x43d78d,_0x340e4d,_0x54a6eb){var _0x59cc1f={'raw':![],'where':{}};var _0x5f43e5={};var _0x1123aa={'count':0x0,'rows':[]};return db[_0xeb5a('0x54')]['findOne']({'where':{'id':_0x43d78d[_0xeb5a('0x59')]['id']}})['then'](handleEntityNotFound(_0x340e4d,null))[_0xeb5a('0x38')](function(_0x51f213){if(_0x51f213){_0x5f43e5['model']=_[_0xeb5a('0x45')](db[_0xeb5a('0x68')][_0xeb5a('0x42')]);_0x5f43e5[_0xeb5a('0x44')]=_[_0xeb5a('0x45')](_0x43d78d['query']);_0x5f43e5[_0xeb5a('0x4e')]=_[_0xeb5a('0x46')](_0x5f43e5['model'],_0x5f43e5[_0xeb5a('0x44')]);_0x59cc1f[_0xeb5a('0x49')]=_[_0xeb5a('0x46')](_0x5f43e5[_0xeb5a('0x47')],qs['fields'](_0x43d78d['query'][_0xeb5a('0x48')]));_0x59cc1f[_0xeb5a('0x49')]=_0x59cc1f[_0xeb5a('0x49')][_0xeb5a('0x4a')]?_0x59cc1f['attributes']:_0x5f43e5[_0xeb5a('0x47')];if(!_0x43d78d[_0xeb5a('0x44')]['hasOwnProperty'](_0xeb5a('0x6a'))){_0x59cc1f[_0xeb5a('0x30')]=qs[_0xeb5a('0x30')](_0x43d78d[_0xeb5a('0x44')][_0xeb5a('0x30')]);_0x59cc1f[_0xeb5a('0x2f')]=qs[_0xeb5a('0x2f')](_0x43d78d['query']['offset']);}_0x59cc1f['order']=qs[_0xeb5a('0x4d')](_0x43d78d[_0xeb5a('0x44')][_0xeb5a('0x4d')]);_0x59cc1f[_0xeb5a('0x50')]=qs[_0xeb5a('0x4e')](_[_0xeb5a('0x4f')](_0x43d78d['query'],_0x5f43e5['filters']));_0x59cc1f[_0xeb5a('0x50')][_0xeb5a('0x67')]=_0x51f213['id'];if(_0x43d78d[_0xeb5a('0x44')]['filter']){_0x59cc1f[_0xeb5a('0x50')]=_[_0xeb5a('0x51')](_0x59cc1f[_0xeb5a('0x50')],{'$or':_[_0xeb5a('0x41')](_0x59cc1f[_0xeb5a('0x49')],function(_0x196e72){var _0x26bcdb={};_0x26bcdb[_0x196e72]={'$like':'%'+_0x43d78d[_0xeb5a('0x44')][_0xeb5a('0x6b')]+'%'};return _0x26bcdb;})});}_0x59cc1f=_[_0xeb5a('0x51')]({},_0x59cc1f,_0x43d78d[_0xeb5a('0x53')]);return db[_0xeb5a('0x68')][_0xeb5a('0x32')]({'where':_0x59cc1f[_0xeb5a('0x50')]})[_0xeb5a('0x38')](function(_0x2920e3){_0x1123aa[_0xeb5a('0x32')]=_0x2920e3;if(_0x43d78d['query'][_0xeb5a('0x55')]){_0x59cc1f['include']=[{'all':!![]}];}return db[_0xeb5a('0x68')][_0xeb5a('0x56')](_0x59cc1f);})[_0xeb5a('0x38')](function(_0x447ca1){_0x1123aa[_0xeb5a('0x57')]=_0x447ca1;return _0x1123aa;});}})[_0xeb5a('0x38')](respondWithFilteredResult(_0x340e4d,_0x59cc1f))['catch'](handleError(_0x340e4d,null));};exports[_0xeb5a('0x6c')]=function(_0x599781,_0x217a78,_0x3d3b98){return db['OpenchannelAccount'][_0xeb5a('0x5b')]({'where':{'id':_0x599781[_0xeb5a('0x59')]['id']}})[_0xeb5a('0x38')](handleEntityNotFound(_0x217a78,null))[_0xeb5a('0x38')](function(_0x2cd9b5){if(_0x2cd9b5){return _0x2cd9b5[_0xeb5a('0x6c')](_0x599781[_0xeb5a('0x44')][_0xeb5a('0x6d')]);}})['then'](respondWithStatusCode(_0x217a78,null))[_0xeb5a('0x2a')](handleError(_0x217a78,null));};exports[_0xeb5a('0x6e')]=function(_0x13b8b5,_0x4dc808,_0x526730){if(_0x13b8b5['body']['id']){delete _0x13b8b5['body']['id'];}return db[_0xeb5a('0x54')][_0xeb5a('0x5b')]({'where':{'id':_0x13b8b5['params']['id']}})['then'](handleEntityNotFound(_0x4dc808,null))['then'](function(_0x1a863f){if(_0x1a863f){_0x13b8b5[_0xeb5a('0x5d')][_0xeb5a('0x67')]=_0x1a863f['id'];return db[_0xeb5a('0x6f')]['create'](_0x13b8b5[_0xeb5a('0x5d')]);}})[_0xeb5a('0x38')](respondWithResult(_0x4dc808,null))['catch'](handleError(_0x4dc808,null));};exports[_0xeb5a('0x70')]=function(_0x5c08b8,_0x3b1dd6,_0x3386e4){var _0x4f64f2={'raw':![],'where':{}};var _0x21ab83={};var _0x3db865={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x5c08b8[_0xeb5a('0x59')]['id']}})[_0xeb5a('0x38')](handleEntityNotFound(_0x3b1dd6,null))[_0xeb5a('0x38')](function(_0x49e6e8){if(_0x49e6e8){_0x21ab83[_0xeb5a('0x47')]=_[_0xeb5a('0x45')](db['CannedAnswer'][_0xeb5a('0x42')]);_0x21ab83[_0xeb5a('0x44')]=_[_0xeb5a('0x45')](_0x5c08b8[_0xeb5a('0x44')]);_0x21ab83['filters']=_[_0xeb5a('0x46')](_0x21ab83[_0xeb5a('0x47')],_0x21ab83[_0xeb5a('0x44')]);_0x4f64f2['attributes']=_[_0xeb5a('0x46')](_0x21ab83[_0xeb5a('0x47')],qs[_0xeb5a('0x48')](_0x5c08b8['query']['fields']));_0x4f64f2['attributes']=_0x4f64f2[_0xeb5a('0x49')]['length']?_0x4f64f2[_0xeb5a('0x49')]:_0x21ab83[_0xeb5a('0x47')];if(!_0x5c08b8[_0xeb5a('0x44')][_0xeb5a('0x4b')](_0xeb5a('0x6a'))){_0x4f64f2['limit']=qs['limit'](_0x5c08b8[_0xeb5a('0x44')][_0xeb5a('0x30')]);_0x4f64f2[_0xeb5a('0x2f')]=qs['offset'](_0x5c08b8['query'][_0xeb5a('0x2f')]);}_0x4f64f2[_0xeb5a('0x4c')]=qs['sort'](_0x5c08b8[_0xeb5a('0x44')][_0xeb5a('0x4d')]);_0x4f64f2[_0xeb5a('0x50')]=qs[_0xeb5a('0x4e')](_[_0xeb5a('0x4f')](_0x5c08b8[_0xeb5a('0x44')],_0x21ab83[_0xeb5a('0x4e')]));_0x4f64f2[_0xeb5a('0x50')]['OpenchannelAccountId']=_0x49e6e8['id'];if(_0x5c08b8[_0xeb5a('0x44')]['filter']){_0x4f64f2[_0xeb5a('0x50')]=_[_0xeb5a('0x51')](_0x4f64f2[_0xeb5a('0x50')],{'$or':_[_0xeb5a('0x41')](_0x4f64f2['attributes'],function(_0x1428dd){var _0x5c1b1a={};_0x5c1b1a[_0x1428dd]={'$like':'%'+_0x5c08b8[_0xeb5a('0x44')]['filter']+'%'};return _0x5c1b1a;})});}_0x4f64f2=_[_0xeb5a('0x51')]({},_0x4f64f2,_0x5c08b8[_0xeb5a('0x53')]);return db[_0xeb5a('0x6f')]['count']({'where':_0x4f64f2['where']})['then'](function(_0x482bf2){_0x3db865[_0xeb5a('0x32')]=_0x482bf2;if(_0x5c08b8[_0xeb5a('0x44')][_0xeb5a('0x55')]){_0x4f64f2['include']=[{'all':!![]}];}return db[_0xeb5a('0x6f')][_0xeb5a('0x56')](_0x4f64f2);})[_0xeb5a('0x38')](function(_0x20fcbc){_0x3db865['rows']=_0x20fcbc;return _0x3db865;});}})['then'](respondWithFilteredResult(_0x3b1dd6,_0x4f64f2))[_0xeb5a('0x2a')](handleError(_0x3b1dd6,null));};exports[_0xeb5a('0x71')]=function(_0x1f25f8,_0x18f06c,_0x35f355){return db[_0xeb5a('0x54')][_0xeb5a('0x5b')]({'where':{'id':_0x1f25f8[_0xeb5a('0x59')]['id']}})[_0xeb5a('0x38')](handleEntityNotFound(_0x18f06c,null))[_0xeb5a('0x38')](function(_0x103b03){if(_0x103b03){return _0x103b03[_0xeb5a('0x71')](_0x1f25f8[_0xeb5a('0x44')][_0xeb5a('0x6d')]);}})['then'](respondWithStatusCode(_0x18f06c,null))[_0xeb5a('0x2a')](handleError(_0x18f06c,null));};exports[_0xeb5a('0x72')]=function(_0x476bb0,_0x4474a8,_0x4128ff){var _0x42c678={'body':_0x476bb0[_0xeb5a('0x5d')],'channel':_0xeb5a('0x73')};var _0x4e9836=[];var _0x2ba944=[];var _0x45ae61={};var _0x271b4a=![];return db[_0xeb5a('0x74')][_0xeb5a('0x65')]()[_0xeb5a('0x38')](function(_0x4245c4){if(!_0x4245c4){throw new db[(_0xeb5a('0x75'))][(_0xeb5a('0x76'))]('no\x20available\x20attributes');}_0x4e9836=_['difference'](_[_0xeb5a('0x45')](_0x4245c4),[_0xeb5a('0x77'),_0xeb5a('0x78')]);_0x2ba944=_['difference'](_['keys'](_0x4245c4),[_0xeb5a('0x77'),_0xeb5a('0x78'),_0xeb5a('0x79'),_0xeb5a('0x7a')]);if(_0x476bb0[_0xeb5a('0x5d')]['id']){delete _0x476bb0[_0xeb5a('0x5d')]['id'];}if(_[_0xeb5a('0x7b')](_0x476bb0[_0xeb5a('0x5d')][_0xeb5a('0x7c')])){throw new db[(_0xeb5a('0x75'))][(_0xeb5a('0x76'))](_0xeb5a('0x7d'));}if(_[_0xeb5a('0x7b')](_0x476bb0[_0xeb5a('0x5d')][_0xeb5a('0x5d')])||_0x476bb0[_0xeb5a('0x5d')]['body']===''){throw new db[(_0xeb5a('0x75'))][(_0xeb5a('0x76'))](_0xeb5a('0x7e'));}if(_['isNil'](_0x476bb0[_0xeb5a('0x5d')][_0xeb5a('0x7f')])){throw new db[(_0xeb5a('0x75'))][(_0xeb5a('0x76'))](_0xeb5a('0x80')+_0x2ba944);}if(!_[_0xeb5a('0x81')](_0x2ba944,_0x476bb0['body'][_0xeb5a('0x7f')])){throw new db[(_0xeb5a('0x75'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2ba944);}_0x45ae61[_0x476bb0[_0xeb5a('0x5d')][_0xeb5a('0x7f')]]=_0x476bb0[_0xeb5a('0x5d')]['from'];})[_0xeb5a('0x38')](function(){return db[_0xeb5a('0x54')][_0xeb5a('0x5b')]({'where':{'id':_0x476bb0[_0xeb5a('0x59')]['id']},'include':[{'model':db['CmList'],'as':_0xeb5a('0x82'),'include':[{'model':db[_0xeb5a('0x74')],'as':_0xeb5a('0x83'),'where':_0x45ae61,'limit':0x1,'order':[['updatedAt',_0xeb5a('0x84')]]}]},{'model':db[_0xeb5a('0x85')],'as':'Applications'}]});})[_0xeb5a('0x38')](handleEntityNotFound(_0x4474a8,null))[_0xeb5a('0x38')](function(_0x5859cf){if(_0x5859cf&&_0x5859cf['List']){_0x42c678[_0xeb5a('0x86')]=_0x5859cf;_0x42c678[_0xeb5a('0x87')]=_0x5859cf[_0xeb5a('0x88')];_0x42c678[_0xeb5a('0x89')]=_0x5859cf[_0xeb5a('0x82')];_0x42c678[_0xeb5a('0x87')]=_[_0xeb5a('0x8a')](_0x42c678[_0xeb5a('0x87')],[_0xeb5a('0x8b')],['asc']);if(_0x42c678['account'][_0xeb5a('0x88')]){delete _0x42c678[_0xeb5a('0x86')][_0xeb5a('0x88')];}if(_0x42c678['account'][_0xeb5a('0x82')]&&_0x42c678[_0xeb5a('0x86')][_0xeb5a('0x82')][_0xeb5a('0x83')][_0xeb5a('0x4a')]){return _0x42c678[_0xeb5a('0x86')][_0xeb5a('0x82')][_0xeb5a('0x83')][0x0];}var _0x233800=_[_0xeb5a('0x19')](_0x476bb0[_0xeb5a('0x5d')],{'firstName':_0x476bb0[_0xeb5a('0x5d')][_0xeb5a('0x7c')],'ListId':_0x5859cf['ListId']});_0x233800[_0x476bb0[_0xeb5a('0x5d')]['mapKey']]=_0x476bb0['body'][_0xeb5a('0x7c')];return db[_0xeb5a('0x74')]['create'](_0x233800,{'fields':_0x4e9836,'raw':!![]});}})['then'](handleEntityNotFound(_0x4474a8,null))['then'](function(_0x14ca32){_0x42c678[_0xeb5a('0x8c')]=_0x14ca32;if(_0x14ca32){var _0x40ccaf={'ContactId':_0x14ca32['id'],'OpenchannelAccountId':_0x476bb0[_0xeb5a('0x59')]['id'],'from':(_0x14ca32[_0xeb5a('0x8d')]||'')+'\x20'+(_0x14ca32['lastName']||'')};var _0x50a3c8={'OpenchannelAccountId':_0x476bb0[_0xeb5a('0x59')]['id'],'closed':![]};if(_0x476bb0['body'][_0xeb5a('0x8e')]){_0x50a3c8[_0xeb5a('0x8e')]=_0x476bb0[_0xeb5a('0x5d')]['threadId'];return db[_0xeb5a('0x8f')][_0xeb5a('0x5b')]({'where':_0x50a3c8})['then'](function(_0x49ecc0){if(_0x49ecc0){return[_0x49ecc0,![]];}_0x40ccaf[_0xeb5a('0x8e')]=_0x476bb0[_0xeb5a('0x5d')][_0xeb5a('0x8e')];_0x40ccaf[_0xeb5a('0x90')]=_0x476bb0[_0xeb5a('0x5d')][_0xeb5a('0x90')];return db[_0xeb5a('0x8f')][_0xeb5a('0x5c')](_0x40ccaf)[_0xeb5a('0x38')](function(_0x45e5e0){return[_0x45e5e0,!![]];});});}else{_0x50a3c8['threadId']=null;}_0x50a3c8[_0xeb5a('0x91')]=_0x14ca32['id'];return db[_0xeb5a('0x8f')][_0xeb5a('0x5b')]({'where':_0x50a3c8})['then'](function(_0x19fb6f){if(_0x19fb6f){return[_0x19fb6f,![]];}return db['OpenchannelInteraction'][_0xeb5a('0x5c')](_0x40ccaf)['then'](function(_0x536718){return[_0x536718,!![]];});});}})[_0xeb5a('0x92')](function(_0x4bc95d,_0x2390a4){if(_0x4bc95d){_0x271b4a=_0x2390a4;if(!_0x2390a4){var _0x2ba1d8={'from':(_0x42c678[_0xeb5a('0x8c')]['firstName']||'')+'\x20'+(_0x42c678[_0xeb5a('0x8c')][_0xeb5a('0x93')]||'')};if(_0x476bb0['body'][_0xeb5a('0x8e')]&&_0x476bb0['body'][_0xeb5a('0x94')]&&_0x476bb0[_0xeb5a('0x5d')][_0xeb5a('0x8e')]!=_0x476bb0[_0xeb5a('0x5d')][_0xeb5a('0x94')]){_0x2ba1d8[_0xeb5a('0x8e')]=_0x476bb0[_0xeb5a('0x5d')][_0xeb5a('0x94')];}return _0x4bc95d[_0xeb5a('0x37')](_0x2ba1d8);}else{return _0x4bc95d;}}})[_0xeb5a('0x38')](function(_0xf3782a){_0x42c678[_0xeb5a('0x95')]=_0xf3782a['get']({'plain':!![]});_0x42c678[_0xeb5a('0x95')][_0xeb5a('0x96')]=_0x271b4a;if(_0x42c678[_0xeb5a('0x95')][_0xeb5a('0x96')]){if(_0x42c678[_0xeb5a('0x86')][_0xeb5a('0x97')]){_0x42c678[_0xeb5a('0x87')][_0xeb5a('0x98')]({'id':0x0,'priority':_0x42c678[_0xeb5a('0x87')]['length']+0x1,'app':_0xeb5a('0x99'),'appdata':_0xeb5a('0x9a'),'interval':_0xeb5a('0x9b')});}}return db[_0xeb5a('0x9c')][_0xeb5a('0x5c')]({'body':_0x476bb0[_0xeb5a('0x5d')][_0xeb5a('0x5d')],'OpenchannelAccountId':_0x476bb0['params']['id'],'OpenchannelInteractionId':_0xf3782a['id'],'direction':'in','ContactId':_0x42c678[_0xeb5a('0x8c')]['id'],'AttachmentId':_0x476bb0['body']['AttachmentId']});})[_0xeb5a('0x38')](function(_0x57d7fd){_0x42c678[_0xeb5a('0x27')]=_0x57d7fd;if(_0x42c678[_0xeb5a('0x95')][_0xeb5a('0x9d')]){return db[_0xeb5a('0x9e')][_0xeb5a('0x5b')]({'attributes':['id','name'],'where':{'id':_0x42c678[_0xeb5a('0x95')][_0xeb5a('0x9d')]}})[_0xeb5a('0x38')](function(_0x2ce0e0){if(_0x2ce0e0){_0x42c678[_0xeb5a('0x87')][_0xeb5a('0x9f')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2ce0e0[_0xeb5a('0x3d')]+','+(_0x42c678[_0xeb5a('0x86')][_0xeb5a('0xa0')]||0xa),'interval':'*,*,*,*'});_0x42c678['forcedOwnership']=![];}return respondWithRpcPromise('Start',_0xeb5a('0xa1'),_0x42c678);});}return respondWithRpcPromise(_0xeb5a('0xa2'),_0xeb5a('0xa1'),_0x42c678);})['then'](function(_0x54c406){respondWithRpcPromise(_0xeb5a('0xa3'),_0xeb5a('0xa3'),{'event':'notify','message':_0x54c406},client9002);return _0x54c406;})[_0xeb5a('0x38')](respondWithResult(_0x4474a8,null))['catch'](handleError(_0x4474a8,null));};exports[_0xeb5a('0xa4')]=function(_0x9a84ef,_0x5d4d74){var _0x118881=_0x9a84ef['params']['id'];var _0xdab4eb=_0x9a84ef['body'];var _0xbac09=0xc8;var _0x1bebe6=null;return db[_0xeb5a('0xa5')][_0xeb5a('0xa6')]({'isolationLevel':db[_0xeb5a('0xa5')][_0xeb5a('0xa7')][_0xeb5a('0xa8')][_0xeb5a('0xa9')]},function(_0x5b15d5){return db[_0xeb5a('0x54')][_0xeb5a('0xaa')]({'where':{'id':_0x118881},'transaction':_0x5b15d5})['then'](function(_0x3ffe3c){if(_0x3ffe3c){return db[_0xeb5a('0x85')][_0xeb5a('0x39')]({'where':{'OpenchannelAccountId':_0x118881},'transaction':_0x5b15d5})[_0xeb5a('0x38')](function(){var _0x2d9748=_[_0xeb5a('0x41')](_0xdab4eb,function(_0x5b449d){_0x5b449d[_0xeb5a('0x67')]=_0x118881;return _0x5b449d;});return db['OpenchannelApplication']['bulkCreate'](_0x2d9748,{'transaction':_0x5b15d5});});}else{_0xbac09=0x194;_0x1bebe6=[];}});})[_0xeb5a('0x38')](function(){if(_0xbac09!==0x194){return db[_0xeb5a('0x85')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x118881},'order':'priority'})['then'](function(_0x672cf2){_0x1bebe6=_0x672cf2;});}})[_0xeb5a('0x2a')](function(_0x4b4ff2){_0xbac09=0x1f4;logger['error'](_0x4b4ff2['stack']);if(_0x4b4ff2[_0xeb5a('0x3d')]){delete _0x4b4ff2[_0xeb5a('0x3d')];}_0x1bebe6=_0x4b4ff2;})[_0xeb5a('0xab')](function(){if(_0x1bebe6===null){_0x5d4d74[_0xeb5a('0x2b')](_0xbac09);}else{if(_0xbac09===0x1f4){_0x5d4d74[_0xeb5a('0x2c')](_0xbac09)['send'](_0x1bebe6);}else{_0x5d4d74['status'](_0xbac09)[_0xeb5a('0x2e')](_0x1bebe6);}}});};exports[_0xeb5a('0xac')]=function(_0x5716c5,_0x527570,_0x5e2f3b){var _0x30a91b={};var _0x3a1abc={};var _0x2f7692;var _0xb64ecd;return db[_0xeb5a('0x54')][_0xeb5a('0xaa')]({'where':{'id':_0x5716c5[_0xeb5a('0x59')]['id']}})[_0xeb5a('0x38')](handleEntityNotFound(_0x527570,null))['then'](function(_0x281a75){if(_0x281a75){_0x2f7692=_0x281a75;_0x3a1abc[_0xeb5a('0x47')]=_[_0xeb5a('0x45')](db[_0xeb5a('0x85')]['rawAttributes']);_0x3a1abc[_0xeb5a('0x44')]=_[_0xeb5a('0x45')](_0x5716c5['query']);_0x3a1abc['filters']=_[_0xeb5a('0x46')](_0x3a1abc['model'],_0x3a1abc[_0xeb5a('0x44')]);_0x30a91b[_0xeb5a('0x49')]=_[_0xeb5a('0x46')](_0x3a1abc['model'],qs[_0xeb5a('0x48')](_0x5716c5[_0xeb5a('0x44')][_0xeb5a('0x48')]));_0x30a91b['attributes']=_0x30a91b[_0xeb5a('0x49')][_0xeb5a('0x4a')]?_0x30a91b[_0xeb5a('0x49')]:_0x3a1abc[_0xeb5a('0x47')];_0x30a91b[_0xeb5a('0x4c')]=qs[_0xeb5a('0x4d')](_0x5716c5[_0xeb5a('0x44')]['sort']);_0x30a91b[_0xeb5a('0x50')]=qs['filters'](_[_0xeb5a('0x4f')](_0x5716c5[_0xeb5a('0x44')],_0x3a1abc[_0xeb5a('0x4e')]));if(_0x5716c5[_0xeb5a('0x44')]['filter']){_0x30a91b[_0xeb5a('0x50')]=_[_0xeb5a('0x51')](_0x30a91b[_0xeb5a('0x50')],{'$or':_[_0xeb5a('0x41')](_0x30a91b['attributes'],function(_0x4951f6){var _0x164324={};_0x164324[_0x4951f6]={'$like':'%'+_0x5716c5['query']['filter']+'%'};return _0x164324;})});}_0x30a91b=_[_0xeb5a('0x51')]({},_0x30a91b,_0x5716c5[_0xeb5a('0x53')]);return _0x2f7692[_0xeb5a('0xac')](_0x30a91b);}})[_0xeb5a('0x38')](function(_0x5d0e56){if(_0x5d0e56){_0xb64ecd=_0x5d0e56[_0xeb5a('0x4a')];if(!_0x5716c5['query'][_0xeb5a('0x4b')]('nolimit')){_0x30a91b[_0xeb5a('0x30')]=qs[_0xeb5a('0x30')](_0x5716c5[_0xeb5a('0x44')][_0xeb5a('0x30')]);_0x30a91b[_0xeb5a('0x2f')]=qs['offset'](_0x5716c5[_0xeb5a('0x44')][_0xeb5a('0x2f')]);}return _0x2f7692['getApplications'](_0x30a91b);}})[_0xeb5a('0x38')](function(_0xbb035f){if(_0xbb035f){return _0xbb035f?{'count':_0xb64ecd,'rows':_0xbb035f}:null;}})[_0xeb5a('0x38')](respondWithResult(_0x527570,null))[_0xeb5a('0x2a')](handleError(_0x527570,null));};exports[_0xeb5a('0xad')]=function(_0x473199,_0x212d33,_0x2125d0){var _0x5e1daf={'raw':![],'where':{}};var _0x537d00={};var _0x43963b={'count':0x0,'rows':[]};return db[_0xeb5a('0x54')][_0xeb5a('0xaa')]({'where':{'id':_0x473199['params']['id']}})['then'](handleEntityNotFound(_0x212d33,null))[_0xeb5a('0x38')](function(_0x3ffba4){if(_0x3ffba4){_0x537d00[_0xeb5a('0x47')]=_[_0xeb5a('0x45')](db[_0xeb5a('0x8f')][_0xeb5a('0x42')]);_0x537d00[_0xeb5a('0x44')]=_['keys'](_0x473199['query']);_0x537d00[_0xeb5a('0x4e')]=_['intersection'](_0x537d00[_0xeb5a('0x47')],_0x537d00[_0xeb5a('0x44')]);_0x5e1daf[_0xeb5a('0x49')]=_[_0xeb5a('0x46')](_0x537d00[_0xeb5a('0x47')],qs[_0xeb5a('0x48')](_0x473199['query'][_0xeb5a('0x48')]));_0x5e1daf[_0xeb5a('0x49')]=_0x5e1daf[_0xeb5a('0x49')][_0xeb5a('0x4a')]?_0x5e1daf[_0xeb5a('0x49')]:_0x537d00['model'];if(!_0x473199['query']['hasOwnProperty'](_0xeb5a('0x6a'))){_0x5e1daf['limit']=qs['limit'](_0x473199['query'][_0xeb5a('0x30')]);_0x5e1daf['offset']=qs[_0xeb5a('0x2f')](_0x473199[_0xeb5a('0x44')]['offset']);}_0x5e1daf[_0xeb5a('0x4c')]=qs[_0xeb5a('0x4d')](_0x473199[_0xeb5a('0x44')][_0xeb5a('0x4d')]);_0x5e1daf[_0xeb5a('0x50')]=qs[_0xeb5a('0x4e')](_[_0xeb5a('0x4f')](_0x473199[_0xeb5a('0x44')],_0x537d00[_0xeb5a('0x4e')]));_0x5e1daf[_0xeb5a('0x50')]['OpenchannelAccountId']=_0x3ffba4['id'];if(_0x473199['query'][_0xeb5a('0x6b')]){_0x5e1daf['where']=_[_0xeb5a('0x51')](_0x5e1daf[_0xeb5a('0x50')],{'$or':_[_0xeb5a('0x41')](_0x5e1daf[_0xeb5a('0x49')],function(_0x112f2f){var _0x1d849f={};_0x1d849f[_0x112f2f]={'$like':'%'+_0x473199[_0xeb5a('0x44')][_0xeb5a('0x6b')]+'%'};return _0x1d849f;})});}_0x5e1daf=_[_0xeb5a('0x51')]({},_0x5e1daf,_0x473199[_0xeb5a('0x53')]);return db[_0xeb5a('0x8f')][_0xeb5a('0x32')]({'where':_0x5e1daf[_0xeb5a('0x50')]})[_0xeb5a('0x38')](function(_0x151d4c){_0x43963b['count']=_0x151d4c;if(_0x473199['query'][_0xeb5a('0x55')]){_0x5e1daf[_0xeb5a('0x5a')]=[{'model':db[_0xeb5a('0x74')],'as':_0xeb5a('0xae'),'required':![]},{'model':db[_0xeb5a('0x9e')],'as':_0xeb5a('0xaf'),'attributes':['name',_0xeb5a('0xb0'),'internal'],'required':![]},{'model':db[_0xeb5a('0xb1')],'as':_0xeb5a('0xb2'),'attributes':['id',_0xeb5a('0x3d'),_0xeb5a('0xb3')],'where':_0x473199['query'][_0xeb5a('0xb4')]?{'id':_0x473199[_0xeb5a('0x44')][_0xeb5a('0xb4')]}:undefined,'required':_0x473199[_0xeb5a('0x44')]['tag']?!![]:![]}];}return db[_0xeb5a('0x8f')][_0xeb5a('0x56')](_0x5e1daf);})['then'](function(_0x59ef58){_0x43963b[_0xeb5a('0x57')]=_0x59ef58;return _0x43963b;});}})[_0xeb5a('0x38')](respondWithFilteredResult(_0x212d33,_0x5e1daf))[_0xeb5a('0x2a')](handleError(_0x212d33,null));};exports[_0xeb5a('0xb5')]=function(_0x1000ce,_0x1e3992,_0x114cba){return db[_0xeb5a('0x54')][_0xeb5a('0x5b')]({'where':{'id':_0x1000ce[_0xeb5a('0x59')]['id']}})[_0xeb5a('0x38')](handleEntityNotFound(_0x1e3992,null))[_0xeb5a('0x38')](function(_0x1bbb39){if(_0x1bbb39){return _0x1bbb39[_0xeb5a('0xb5')](_0x1000ce[_0xeb5a('0x5d')][_0xeb5a('0x6d')],_[_0xeb5a('0xb6')](_0x1000ce[_0xeb5a('0x5d')],[_0xeb5a('0x6d'),'id'])||{})[_0xeb5a('0x92')](function(_0x21a2c6){for(var _0x1b0333=0x0;_0x1b0333<_0x1000ce['body'][_0xeb5a('0x6d')][_0xeb5a('0x4a')];_0x1b0333+=0x1){socket[_0xeb5a('0xb7')](_0xeb5a('0xb8'),{'UserId':Number(_0x1000ce[_0xeb5a('0x5d')][_0xeb5a('0x6d')][_0x1b0333]),'OpenchannelAccountId':Number(_0x1000ce[_0xeb5a('0x59')]['id'])});}return _0x21a2c6;});}})[_0xeb5a('0x38')](respondWithResult(_0x1e3992,null))[_0xeb5a('0x2a')](handleError(_0x1e3992,null));};exports[_0xeb5a('0xb9')]=function(_0x2ff7b4,_0x2e3195,_0x4b7c0b){return db['OpenchannelAccount'][_0xeb5a('0x5b')]({'where':{'id':_0x2ff7b4[_0xeb5a('0x59')]['id']}})['then'](handleEntityNotFound(_0x2e3195,null))[_0xeb5a('0x38')](function(_0x5ecbb7){if(_0x5ecbb7){return _0x5ecbb7[_0xeb5a('0xb9')](_0x2ff7b4['query'][_0xeb5a('0x6d')])[_0xeb5a('0x38')](function(){if(_['isArray'](_0x2ff7b4[_0xeb5a('0x44')][_0xeb5a('0x6d')])){for(var _0xf4b405=0x0;_0xf4b405<_0x2ff7b4[_0xeb5a('0x44')][_0xeb5a('0x6d')]['length'];_0xf4b405+=0x1){socket[_0xeb5a('0xb7')]('userOpenchannelAccount:remove',{'UserId':Number(_0x2ff7b4[_0xeb5a('0x44')][_0xeb5a('0x6d')][_0xf4b405]),'OpenchannelAccountId':Number(_0x2ff7b4[_0xeb5a('0x59')]['id'])});}}else{socket['emit'](_0xeb5a('0xba'),{'UserId':Number(_0x2ff7b4['query']['ids']),'OpenchannelAccountId':Number(_0x2ff7b4[_0xeb5a('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x2e3195,null))['catch'](handleError(_0x2e3195,null));};exports[_0xeb5a('0xbb')]=function(_0x275666,_0xb2ab0,_0x25e113){var _0x350134={};var _0x35aa21={};var _0x166e28;var _0x59c587;return db[_0xeb5a('0x54')][_0xeb5a('0xaa')]({'where':{'id':_0x275666['params']['id']}})[_0xeb5a('0x38')](handleEntityNotFound(_0xb2ab0,null))['then'](function(_0x5ba754){if(_0x5ba754){_0x166e28=_0x5ba754;_0x35aa21[_0xeb5a('0x47')]=_[_0xeb5a('0x45')](db[_0xeb5a('0x9e')][_0xeb5a('0x42')]);_0x35aa21[_0xeb5a('0x44')]=_[_0xeb5a('0x45')](_0x275666[_0xeb5a('0x44')]);_0x35aa21[_0xeb5a('0x4e')]=_['intersection'](_0x35aa21['model'],_0x35aa21['query']);_0x350134[_0xeb5a('0x49')]=_[_0xeb5a('0x46')](_0x35aa21[_0xeb5a('0x47')],qs[_0xeb5a('0x48')](_0x275666['query'][_0xeb5a('0x48')]));_0x350134['attributes']=_0x350134[_0xeb5a('0x49')][_0xeb5a('0x4a')]?_0x350134[_0xeb5a('0x49')]:_0x35aa21[_0xeb5a('0x47')];_0x350134[_0xeb5a('0x4c')]=qs[_0xeb5a('0x4d')](_0x275666[_0xeb5a('0x44')][_0xeb5a('0x4d')]);_0x350134['where']=qs['filters'](_[_0xeb5a('0x4f')](_0x275666['query'],_0x35aa21[_0xeb5a('0x4e')]));if(_0x275666[_0xeb5a('0x44')][_0xeb5a('0x6b')]){_0x350134[_0xeb5a('0x50')]=_['merge'](_0x350134[_0xeb5a('0x50')],{'$or':_[_0xeb5a('0x41')](_0x350134[_0xeb5a('0x49')],function(_0x52d5ca){var _0xca460={};_0xca460[_0x52d5ca]={'$like':'%'+_0x275666[_0xeb5a('0x44')][_0xeb5a('0x6b')]+'%'};return _0xca460;})});}_0x350134=_[_0xeb5a('0x51')]({},_0x350134,_0x275666[_0xeb5a('0x53')]);return _0x166e28[_0xeb5a('0xbb')](_0x350134);}})[_0xeb5a('0x38')](function(_0x34904f){if(_0x34904f){_0x59c587=_0x34904f[_0xeb5a('0x4a')];if(!_0x275666[_0xeb5a('0x44')][_0xeb5a('0x4b')](_0xeb5a('0x6a'))){_0x350134[_0xeb5a('0x30')]=qs[_0xeb5a('0x30')](_0x275666[_0xeb5a('0x44')][_0xeb5a('0x30')]);_0x350134[_0xeb5a('0x2f')]=qs[_0xeb5a('0x2f')](_0x275666[_0xeb5a('0x44')][_0xeb5a('0x2f')]);}return _0x166e28[_0xeb5a('0xbb')](_0x350134);}})['then'](function(_0x40569e){if(_0x40569e){return _0x40569e?{'count':_0x59c587,'rows':_0x40569e}:null;}})[_0xeb5a('0x38')](respondWithResult(_0xb2ab0,null))[_0xeb5a('0x2a')](handleError(_0xb2ab0,null));};exports[_0xeb5a('0xbc')]=function(_0x4c4386,_0x4c597b,_0x4e75cf){var _0x5ddade,_0x5ecab1,_0x29d5ea;if(_[_0xeb5a('0x7b')](_0x4c4386[_0xeb5a('0x5d')][_0xeb5a('0x5d')])||_0x4c4386[_0xeb5a('0x5d')][_0xeb5a('0x5d')]===''){throw new db['Sequelize'][(_0xeb5a('0x76'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xeb5a('0x7b')](_0x4c4386[_0xeb5a('0x5d')]['to'])){}_0x5ddade=_0x4c4386[_0xeb5a('0x5d')]['to'];return db[_0xeb5a('0x54')][_0xeb5a('0xaa')]({'where':{'id':_0x4c4386[_0xeb5a('0x59')]['id']}})[_0xeb5a('0x38')](handleEntityNotFound(_0x4c597b,null))[_0xeb5a('0x38')](function(_0x28bb92){if(_0x28bb92){return db[_0xeb5a('0x54')][_0xeb5a('0x5b')]({'where':{'id':_0x28bb92['id']},'include':[{'model':db[_0xeb5a('0xbd')],'as':_0xeb5a('0x82'),'include':[{'model':db['CmContact'],'as':_0xeb5a('0x83'),'where':{[_0x28bb92[_0xeb5a('0x7f')]]:_0x5ddade},'limit':0x1,'order':[[_0xeb5a('0x78'),_0xeb5a('0x84')]]}]}]})[_0xeb5a('0x38')](handleEntityNotFound(_0x4c597b,null))[_0xeb5a('0x38')](function(_0x5022bc){if(_0x5022bc&&_0x5022bc[_0xeb5a('0x82')]){_0x5ecab1=_0x5022bc['get']({'plain':!![]});if(_0x5ecab1['List']&&_0x5ecab1[_0xeb5a('0x82')][_0xeb5a('0x83')][_0xeb5a('0x4a')]){return _0x5ecab1[_0xeb5a('0x82')][_0xeb5a('0x83')][0x0];}return db[_0xeb5a('0x74')]['create'](_['defaults'](_0x4c4386[_0xeb5a('0x5d')],{'firstName':_0x5ddade,[_0x5022bc[_0xeb5a('0x7f')]]:_0x5ddade,'phone':_0x5ddade,'ListId':_0x5ecab1['ListId']}));}})['then'](handleEntityNotFound(_0x4c597b,null))['then'](function(_0x197ee9){if(_0x197ee9){_0x29d5ea=_0x197ee9;return db['OpenchannelInteraction'][_0xeb5a('0x5b')]({'where':{'ContactId':_0x29d5ea['id'],'closed':![],'OpenchannelAccountId':_0x5ecab1['id']}})[_0xeb5a('0x38')](function(_0x464cce){if(_0x464cce){return[_0x464cce,![]];}return db[_0xeb5a('0x8f')][_0xeb5a('0x5c')]({'UserId':_0x4c4386[_0xeb5a('0x5e')]['id'],'ContactId':_0x29d5ea['id'],'OpenchannelAccountId':_0x5ecab1['id'],'lastMsgDirection':_0xeb5a('0xbe'),'Messages':[_[_0xeb5a('0x51')](_0x4c4386[_0xeb5a('0x5d')],{'read':![],'body':_0x4c4386[_0xeb5a('0x5d')][_0xeb5a('0x5d')],'OpenchannelAccountId':_0x5ecab1['id'],'UserId':_0x4c4386[_0xeb5a('0x5e')]['id'],'ContactId':_0x29d5ea['id']})]},{'include':[{'model':db[_0xeb5a('0x9c')],'as':'Messages'}]})['then'](function(_0x32b567){return[_0x32b567,!![]];});});}})[_0xeb5a('0x92')](function(_0x262fc8,_0x316613){if(_0x316613){return _0x262fc8;}return db[_0xeb5a('0x9c')][_0xeb5a('0x5c')](_[_0xeb5a('0x51')](_0x4c4386[_0xeb5a('0x5d')],{'read':![],'body':_0x4c4386['body'][_0xeb5a('0x5d')],'OpenchannelAccountId':_0x5ecab1['id'],'OpenchannelInteractionId':_0x262fc8['id'],'UserId':_0x4c4386[_0xeb5a('0x5e')]['id'],'ContactId':_0x29d5ea['id']}))['then'](function(_0x4aa861){_0x262fc8[_0xeb5a('0xbf')][_0xeb5a('0xc0')]=[];_0x262fc8['dataValues']['Messages']['push'](_0x4aa861['dataValues']);return _0x262fc8;});});}})[_0xeb5a('0x38')](respondWithResult(_0x4c597b,null))[_0xeb5a('0x2a')](handleError(_0x4c597b,null));}; \ No newline at end of file +var _0x57d8=['EventManager','addApplications','transaction','sequelize','ISOLATION_LEVELS','OpenchannelApplication','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Owner','fullname','internal','Tag','Tags','color','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','out','OpenchannelMessage','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','redis','defaults','localhost','./openchannelAccount.socket','register','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','body','describe','OpenchannelAccountId','Disposition','findOne','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','Applications','account','applications','priority','asc','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','contact','messageId','interaction','created','autoclose','push','close','unmanaged','UserId','User','unshift','agent','*,*,*,*','forcedOwnership','startRouting','Start'];(function(_0x11804e,_0x450edf){var _0x1da271=function(_0x3a46cc){while(--_0x3a46cc){_0x11804e['push'](_0x11804e['shift']());}};_0x1da271(++_0x450edf);}(_0x57d8,0xdb));var _0x857d=function(_0x480c21,_0x127a04){_0x480c21=_0x480c21-0x0;var _0x1a1edd=_0x57d8[_0x480c21];return _0x1a1edd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x857d('0x0'));var zipdir=require(_0x857d('0x1'));var jsonpatch=require(_0x857d('0x2'));var rp=require(_0x857d('0x3'));var moment=require('moment');var BPromise=require(_0x857d('0x4'));var Mustache=require(_0x857d('0x5'));var util=require(_0x857d('0x6'));var path=require(_0x857d('0x7'));var sox=require(_0x857d('0x8'));var csv=require(_0x857d('0x9'));var ejs=require(_0x857d('0xa'));var fs=require('fs');var fs_extra=require(_0x857d('0xb'));var _=require(_0x857d('0xc'));var squel=require('squel');var crypto=require(_0x857d('0xd'));var jsforce=require(_0x857d('0xe'));var deskjs=require(_0x857d('0xf'));var toCsv=require(_0x857d('0x9'));var querystring=require('querystring');var Papa=require(_0x857d('0x10'));var Redis=require(_0x857d('0x11'));var authService=require(_0x857d('0x12'));var qs=require(_0x857d('0x13'));var as=require(_0x857d('0x14'));var hardwareService=require(_0x857d('0x15'));var logger=require(_0x857d('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x857d('0x17')]=_[_0x857d('0x18')](config[_0x857d('0x17')],{'host':_0x857d('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x857d('0x1a'))[_0x857d('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x857d('0x1c')]['http']({'port':0x232c});var client9002=jayson['client'][_0x857d('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x10daae,_0x5f5742,_0x2a5119,_0x4fdd61){return new BPromise(function(_0x2867ab,_0x52f9db){var _0x431821=_0x4fdd61||client;return _0x431821[_0x857d('0x1e')](_0x10daae,_0x2a5119)[_0x857d('0x1f')](function(_0x283c00){logger[_0x857d('0x20')](_0x857d('0x21'),_0x5f5742,_0x857d('0x22'));logger[_0x857d('0x23')](_0x857d('0x24'),_0x5f5742,'request\x20sent',JSON['stringify'](_0x283c00));if(_0x283c00[_0x857d('0x25')]){if(_0x283c00[_0x857d('0x25')][_0x857d('0x26')]===0x1f4){logger[_0x857d('0x25')](_0x857d('0x21'),_0x5f5742,_0x283c00['error'][_0x857d('0x27')]);return _0x52f9db(_0x283c00['error'][_0x857d('0x27')]);}logger[_0x857d('0x25')](_0x857d('0x21'),_0x5f5742,_0x283c00[_0x857d('0x25')]['message']);return _0x2867ab(_0x283c00[_0x857d('0x25')]['message']);}else{logger[_0x857d('0x20')](_0x857d('0x21'),_0x5f5742,_0x857d('0x22'));_0x2867ab(_0x283c00[_0x857d('0x28')][_0x857d('0x27')]);}})[_0x857d('0x29')](function(_0x5d5260){logger['error'](_0x857d('0x21'),_0x5f5742,_0x5d5260);_0x52f9db(_0x5d5260);});});}function respondWithStatusCode(_0x14f3ba,_0x42fd91){_0x42fd91=_0x42fd91||0xcc;return function(_0x20053b){if(_0x20053b){return _0x14f3ba[_0x857d('0x2a')](_0x42fd91);}return _0x14f3ba[_0x857d('0x2b')](_0x42fd91)[_0x857d('0x2c')]();};}function respondWithResult(_0x22ea0b,_0x271a33){_0x271a33=_0x271a33||0xc8;return function(_0x5e8d76){if(_0x5e8d76){return _0x22ea0b[_0x857d('0x2b')](_0x271a33)['json'](_0x5e8d76);}};}function respondWithFilteredResult(_0x1ca927,_0x15ea2e){return function(_0x2a8657){if(_0x2a8657){var _0x2247fa=typeof _0x15ea2e[_0x857d('0x2d')]==='undefined'&&typeof _0x15ea2e['limit']===_0x857d('0x2e');var _0x4d49ac=_0x2a8657[_0x857d('0x2f')];var _0x17a644=_0x2247fa?0x0:_0x15ea2e[_0x857d('0x2d')];var _0x2aca3d=_0x2247fa?_0x2a8657[_0x857d('0x2f')]:_0x15ea2e[_0x857d('0x2d')]+_0x15ea2e['limit'];var _0x1b794f;if(_0x2aca3d>=_0x4d49ac){_0x2aca3d=_0x4d49ac;_0x1b794f=0xc8;}else{_0x1b794f=0xce;}_0x1ca927[_0x857d('0x2b')](_0x1b794f);return _0x1ca927[_0x857d('0x30')](_0x857d('0x31'),_0x17a644+'-'+_0x2aca3d+'/'+_0x4d49ac)[_0x857d('0x32')](_0x2a8657);}return null;};}function patchUpdates(_0x2a847e){return function(_0x5837c2){try{jsonpatch[_0x857d('0x33')](_0x5837c2,_0x2a847e,!![]);}catch(_0x4b952f){return BPromise[_0x857d('0x34')](_0x4b952f);}return _0x5837c2[_0x857d('0x35')]();};}function saveUpdates(_0x289fa6,_0x434821){return function(_0x39ade2){if(_0x39ade2){return _0x39ade2[_0x857d('0x36')](_0x289fa6)[_0x857d('0x1f')](function(_0x5b29ca){return _0x5b29ca;});}return null;};}function removeEntity(_0x55e945,_0x355366){return function(_0xee3285){if(_0xee3285){return _0xee3285[_0x857d('0x37')]()['then'](function(){var _0x3e1e59=_0xee3285[_0x857d('0x38')]({'plain':!![]});var _0x289706=_0x857d('0x39');return db[_0x857d('0x3a')][_0x857d('0x37')]({'where':{'type':_0x289706,'resourceId':_0x3e1e59['id']}})[_0x857d('0x1f')](function(){return _0xee3285;});})[_0x857d('0x1f')](function(){_0x55e945[_0x857d('0x2b')](0xcc)[_0x857d('0x2c')]();});}};}function handleEntityNotFound(_0x535665,_0xfcc9c7){return function(_0x442566){if(!_0x442566){_0x535665[_0x857d('0x2a')](0x194);}return _0x442566;};}function handleError(_0x18afbc,_0x173e44){_0x173e44=_0x173e44||0x1f4;return function(_0x218d90){logger['error'](_0x218d90[_0x857d('0x3b')]);if(_0x218d90['name']){delete _0x218d90[_0x857d('0x3c')];}_0x18afbc[_0x857d('0x2b')](_0x173e44)[_0x857d('0x3d')](_0x218d90);};}exports[_0x857d('0x3e')]=function(_0x40d542,_0x484566){var _0x49d166={'include':[{'model':db[_0x857d('0x3f')],'as':_0x857d('0x40')}]},_0x25cb38={},_0x525a4f={'count':0x0,'rows':[]};var _0x42bfb2=_[_0x857d('0x41')](db[_0x857d('0x42')][_0x857d('0x43')],function(_0x288d58){return{'name':_0x288d58[_0x857d('0x44')],'type':_0x288d58[_0x857d('0x45')][_0x857d('0x46')]};});_0x25cb38['model']=_[_0x857d('0x41')](_0x42bfb2,_0x857d('0x3c'));_0x25cb38[_0x857d('0x47')]=_[_0x857d('0x48')](_0x40d542[_0x857d('0x47')]);_0x25cb38[_0x857d('0x49')]=_['intersection'](_0x25cb38['model'],_0x25cb38[_0x857d('0x47')]);_0x49d166['attributes']=_[_0x857d('0x4a')](_0x25cb38[_0x857d('0x4b')],qs[_0x857d('0x4c')](_0x40d542[_0x857d('0x47')]['fields']));_0x49d166['attributes']=_0x49d166[_0x857d('0x4d')][_0x857d('0x4e')]?_0x49d166[_0x857d('0x4d')]:_0x25cb38[_0x857d('0x4b')];if(!_0x40d542[_0x857d('0x47')][_0x857d('0x4f')](_0x857d('0x50'))){_0x49d166[_0x857d('0x51')]=qs['limit'](_0x40d542[_0x857d('0x47')]['limit']);_0x49d166['offset']=qs[_0x857d('0x2d')](_0x40d542[_0x857d('0x47')][_0x857d('0x2d')]);}_0x49d166[_0x857d('0x52')]=qs[_0x857d('0x53')](_0x40d542['query']['sort']);_0x49d166['where']=qs[_0x857d('0x49')](_[_0x857d('0x54')](_0x40d542['query'],_0x25cb38[_0x857d('0x49')]),_0x42bfb2);if(_0x40d542['query'][_0x857d('0x55')]){_0x49d166[_0x857d('0x56')]=_[_0x857d('0x57')](_0x49d166[_0x857d('0x56')],{'$or':_[_0x857d('0x41')](_0x42bfb2,function(_0x402524){if(_0x402524['type']!==_0x857d('0x58')){var _0x118c5a={};_0x118c5a[_0x402524[_0x857d('0x3c')]]={'$like':'%'+_0x40d542['query'][_0x857d('0x55')]+'%'};return _0x118c5a;}})});}_0x49d166=_[_0x857d('0x57')]({},_0x49d166,_0x40d542[_0x857d('0x59')]);var _0x228b0e={'where':_0x49d166[_0x857d('0x56')]};return db[_0x857d('0x42')][_0x857d('0x2f')](_0x228b0e)[_0x857d('0x1f')](function(_0x10e16d){_0x525a4f[_0x857d('0x2f')]=_0x10e16d;if(_0x40d542[_0x857d('0x47')][_0x857d('0x5a')]){_0x49d166['include']=[{'all':!![]}];}return db[_0x857d('0x42')][_0x857d('0x5b')](_0x49d166);})['then'](function(_0x3f41bb){_0x525a4f[_0x857d('0x5c')]=_0x3f41bb;return _0x525a4f;})['then'](respondWithFilteredResult(_0x484566,_0x49d166))['catch'](handleError(_0x484566,null));};exports[_0x857d('0x5d')]=function(_0x54dff6,_0x1d9fed){var _0x45c1cc={'raw':![],'where':{'id':_0x54dff6[_0x857d('0x5e')]['id']},'include':[{'model':db['Pause'],'as':_0x857d('0x40')}]},_0x3bfb53={};_0x3bfb53[_0x857d('0x4b')]=_[_0x857d('0x48')](db[_0x857d('0x42')]['rawAttributes']);_0x3bfb53[_0x857d('0x47')]=_['keys'](_0x54dff6['query']);_0x3bfb53[_0x857d('0x49')]=_[_0x857d('0x4a')](_0x3bfb53[_0x857d('0x4b')],_0x3bfb53['query']);_0x45c1cc[_0x857d('0x4d')]=_[_0x857d('0x4a')](_0x3bfb53[_0x857d('0x4b')],qs[_0x857d('0x4c')](_0x54dff6[_0x857d('0x47')]['fields']));_0x45c1cc[_0x857d('0x4d')]=_0x45c1cc[_0x857d('0x4d')]['length']?_0x45c1cc['attributes']:_0x3bfb53[_0x857d('0x4b')];if(_0x54dff6['query'][_0x857d('0x5a')]){_0x45c1cc[_0x857d('0x5f')]=[{'all':!![]}];}_0x45c1cc=_[_0x857d('0x57')]({},_0x45c1cc,_0x54dff6['options']);return db[_0x857d('0x42')][_0x857d('0x60')](_0x45c1cc)[_0x857d('0x1f')](handleEntityNotFound(_0x1d9fed,null))[_0x857d('0x1f')](respondWithResult(_0x1d9fed,null))[_0x857d('0x29')](handleError(_0x1d9fed,null));};exports[_0x857d('0x61')]=function(_0xce9266,_0x48eb29){return db[_0x857d('0x42')][_0x857d('0x61')](_0xce9266['body'],{})[_0x857d('0x1f')](function(_0x470e59){var _0x217ad2=_0xce9266[_0x857d('0x62')][_0x857d('0x38')]({'plain':!![]});if(!_0x217ad2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x217ad2[_0x857d('0x63')]===_0x857d('0x62')){var _0x4ae320=_0x470e59[_0x857d('0x38')]({'plain':!![]});var _0x1a64c0='OpenchannelAccounts';return db[_0x857d('0x64')][_0x857d('0x60')]({'where':{'name':_0x1a64c0,'userProfileId':_0x217ad2[_0x857d('0x65')]},'raw':!![]})[_0x857d('0x1f')](function(_0x477f15){if(_0x477f15&&_0x477f15[_0x857d('0x66')]===0x0){return db['UserProfileResource'][_0x857d('0x61')]({'name':_0x4ae320[_0x857d('0x3c')],'resourceId':_0x4ae320['id'],'type':_0x477f15[_0x857d('0x3c')],'sectionId':_0x477f15['id']},{})[_0x857d('0x1f')](function(){return _0x470e59;});}else{return _0x470e59;}})[_0x857d('0x29')](function(_0x31121f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x31121f);throw _0x31121f;});}return _0x470e59;})[_0x857d('0x1f')](respondWithResult(_0x48eb29,0xc9))[_0x857d('0x29')](handleError(_0x48eb29,null));};exports[_0x857d('0x36')]=function(_0x2afaac,_0x4fef30){if(_0x2afaac[_0x857d('0x67')]['id']){delete _0x2afaac[_0x857d('0x67')]['id'];}return db[_0x857d('0x42')][_0x857d('0x60')]({'where':{'id':_0x2afaac['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x857d('0x1f')](handleEntityNotFound(_0x4fef30,null))[_0x857d('0x1f')](saveUpdates(_0x2afaac['body'],null))[_0x857d('0x1f')](respondWithResult(_0x4fef30,null))[_0x857d('0x29')](handleError(_0x4fef30,null));};exports[_0x857d('0x37')]=function(_0x428283,_0xa5ffe3){return db[_0x857d('0x42')][_0x857d('0x60')]({'where':{'id':_0x428283[_0x857d('0x5e')]['id']}})['then'](handleEntityNotFound(_0xa5ffe3,null))[_0x857d('0x1f')](removeEntity(_0xa5ffe3,null))[_0x857d('0x29')](handleError(_0xa5ffe3,null));};exports[_0x857d('0x68')]=function(_0x3bc63a,_0x2ebcd8){return db[_0x857d('0x42')][_0x857d('0x68')]()['then'](respondWithResult(_0x2ebcd8,null))['catch'](handleError(_0x2ebcd8,null));};exports['addDisposition']=function(_0x4be5f5,_0x2facbf,_0xe87f0b){if(_0x4be5f5['body']['id']){delete _0x4be5f5[_0x857d('0x67')]['id'];}return db['OpenchannelAccount'][_0x857d('0x60')]({'where':{'id':_0x4be5f5[_0x857d('0x5e')]['id']}})[_0x857d('0x1f')](handleEntityNotFound(_0x2facbf,null))[_0x857d('0x1f')](function(_0x1f8261){if(_0x1f8261){_0x4be5f5[_0x857d('0x67')][_0x857d('0x69')]=_0x1f8261['id'];return db[_0x857d('0x6a')][_0x857d('0x61')](_0x4be5f5[_0x857d('0x67')]);}})['then'](respondWithResult(_0x2facbf,null))[_0x857d('0x29')](handleError(_0x2facbf,null));};exports['getDispositions']=function(_0x5c6dbc,_0x272cc6,_0x3b5d36){var _0x994387={'raw':![],'where':{}};var _0x10b874={};var _0x16b147={'count':0x0,'rows':[]};return db[_0x857d('0x42')][_0x857d('0x6b')]({'where':{'id':_0x5c6dbc[_0x857d('0x5e')]['id']}})['then'](handleEntityNotFound(_0x272cc6,null))[_0x857d('0x1f')](function(_0x43fcc8){if(_0x43fcc8){_0x10b874[_0x857d('0x4b')]=_[_0x857d('0x48')](db[_0x857d('0x6a')]['rawAttributes']);_0x10b874[_0x857d('0x47')]=_[_0x857d('0x48')](_0x5c6dbc['query']);_0x10b874[_0x857d('0x49')]=_[_0x857d('0x4a')](_0x10b874[_0x857d('0x4b')],_0x10b874[_0x857d('0x47')]);_0x994387['attributes']=_[_0x857d('0x4a')](_0x10b874[_0x857d('0x4b')],qs[_0x857d('0x4c')](_0x5c6dbc[_0x857d('0x47')]['fields']));_0x994387[_0x857d('0x4d')]=_0x994387[_0x857d('0x4d')]['length']?_0x994387['attributes']:_0x10b874[_0x857d('0x4b')];if(!_0x5c6dbc[_0x857d('0x47')][_0x857d('0x4f')](_0x857d('0x50'))){_0x994387['limit']=qs[_0x857d('0x51')](_0x5c6dbc['query']['limit']);_0x994387[_0x857d('0x2d')]=qs[_0x857d('0x2d')](_0x5c6dbc[_0x857d('0x47')][_0x857d('0x2d')]);}_0x994387[_0x857d('0x52')]=qs[_0x857d('0x53')](_0x5c6dbc['query']['sort']);_0x994387['where']=qs['filters'](_[_0x857d('0x54')](_0x5c6dbc[_0x857d('0x47')],_0x10b874['filters']));_0x994387[_0x857d('0x56')]['OpenchannelAccountId']=_0x43fcc8['id'];if(_0x5c6dbc[_0x857d('0x47')]['filter']){_0x994387[_0x857d('0x56')]=_[_0x857d('0x57')](_0x994387['where'],{'$or':_[_0x857d('0x41')](_0x994387[_0x857d('0x4d')],function(_0x3b3b43){var _0x18f4fe={};_0x18f4fe[_0x3b3b43]={'$like':'%'+_0x5c6dbc[_0x857d('0x47')][_0x857d('0x55')]+'%'};return _0x18f4fe;})});}_0x994387=_['merge']({},_0x994387,_0x5c6dbc[_0x857d('0x59')]);return db[_0x857d('0x6a')][_0x857d('0x2f')]({'where':_0x994387[_0x857d('0x56')]})['then'](function(_0x7c9209){_0x16b147[_0x857d('0x2f')]=_0x7c9209;if(_0x5c6dbc[_0x857d('0x47')][_0x857d('0x5a')]){_0x994387[_0x857d('0x5f')]=[{'all':!![]}];}return db[_0x857d('0x6a')][_0x857d('0x5b')](_0x994387);})[_0x857d('0x1f')](function(_0x30e6b7){_0x16b147[_0x857d('0x5c')]=_0x30e6b7;return _0x16b147;});}})[_0x857d('0x1f')](respondWithFilteredResult(_0x272cc6,_0x994387))['catch'](handleError(_0x272cc6,null));};exports['removeDispositions']=function(_0x594f7,_0x123707,_0x43b04d){return db[_0x857d('0x42')][_0x857d('0x60')]({'where':{'id':_0x594f7[_0x857d('0x5e')]['id']}})[_0x857d('0x1f')](handleEntityNotFound(_0x123707,null))['then'](function(_0x4ce594){if(_0x4ce594){return _0x4ce594[_0x857d('0x6c')](_0x594f7[_0x857d('0x47')][_0x857d('0x6d')]);}})[_0x857d('0x1f')](respondWithStatusCode(_0x123707,null))['catch'](handleError(_0x123707,null));};exports['addAnswer']=function(_0x1772f3,_0x13b0f3,_0x111062){if(_0x1772f3[_0x857d('0x67')]['id']){delete _0x1772f3['body']['id'];}return db[_0x857d('0x42')][_0x857d('0x60')]({'where':{'id':_0x1772f3[_0x857d('0x5e')]['id']}})['then'](handleEntityNotFound(_0x13b0f3,null))['then'](function(_0x3718ef){if(_0x3718ef){_0x1772f3[_0x857d('0x67')][_0x857d('0x69')]=_0x3718ef['id'];return db['CannedAnswer'][_0x857d('0x61')](_0x1772f3['body']);}})[_0x857d('0x1f')](respondWithResult(_0x13b0f3,null))[_0x857d('0x29')](handleError(_0x13b0f3,null));};exports[_0x857d('0x6e')]=function(_0x171ea6,_0x37639a,_0x287258){var _0x29aef5={'raw':![],'where':{}};var _0x591ccf={};var _0x3dc2a5={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x857d('0x6b')]({'where':{'id':_0x171ea6['params']['id']}})[_0x857d('0x1f')](handleEntityNotFound(_0x37639a,null))[_0x857d('0x1f')](function(_0x590bff){if(_0x590bff){_0x591ccf[_0x857d('0x4b')]=_[_0x857d('0x48')](db[_0x857d('0x6f')]['rawAttributes']);_0x591ccf[_0x857d('0x47')]=_[_0x857d('0x48')](_0x171ea6[_0x857d('0x47')]);_0x591ccf['filters']=_['intersection'](_0x591ccf[_0x857d('0x4b')],_0x591ccf['query']);_0x29aef5['attributes']=_[_0x857d('0x4a')](_0x591ccf[_0x857d('0x4b')],qs['fields'](_0x171ea6['query']['fields']));_0x29aef5[_0x857d('0x4d')]=_0x29aef5[_0x857d('0x4d')][_0x857d('0x4e')]?_0x29aef5['attributes']:_0x591ccf[_0x857d('0x4b')];if(!_0x171ea6[_0x857d('0x47')][_0x857d('0x4f')]('nolimit')){_0x29aef5[_0x857d('0x51')]=qs[_0x857d('0x51')](_0x171ea6[_0x857d('0x47')][_0x857d('0x51')]);_0x29aef5[_0x857d('0x2d')]=qs[_0x857d('0x2d')](_0x171ea6[_0x857d('0x47')][_0x857d('0x2d')]);}_0x29aef5['order']=qs[_0x857d('0x53')](_0x171ea6[_0x857d('0x47')][_0x857d('0x53')]);_0x29aef5[_0x857d('0x56')]=qs['filters'](_[_0x857d('0x54')](_0x171ea6[_0x857d('0x47')],_0x591ccf[_0x857d('0x49')]));_0x29aef5[_0x857d('0x56')][_0x857d('0x69')]=_0x590bff['id'];if(_0x171ea6[_0x857d('0x47')][_0x857d('0x55')]){_0x29aef5[_0x857d('0x56')]=_[_0x857d('0x57')](_0x29aef5[_0x857d('0x56')],{'$or':_['map'](_0x29aef5[_0x857d('0x4d')],function(_0x2de6cb){var _0x5e7cf4={};_0x5e7cf4[_0x2de6cb]={'$like':'%'+_0x171ea6[_0x857d('0x47')][_0x857d('0x55')]+'%'};return _0x5e7cf4;})});}_0x29aef5=_['merge']({},_0x29aef5,_0x171ea6[_0x857d('0x59')]);return db[_0x857d('0x6f')]['count']({'where':_0x29aef5[_0x857d('0x56')]})[_0x857d('0x1f')](function(_0x883c09){_0x3dc2a5[_0x857d('0x2f')]=_0x883c09;if(_0x171ea6[_0x857d('0x47')][_0x857d('0x5a')]){_0x29aef5[_0x857d('0x5f')]=[{'all':!![]}];}return db[_0x857d('0x6f')][_0x857d('0x5b')](_0x29aef5);})[_0x857d('0x1f')](function(_0x2c17d5){_0x3dc2a5[_0x857d('0x5c')]=_0x2c17d5;return _0x3dc2a5;});}})[_0x857d('0x1f')](respondWithFilteredResult(_0x37639a,_0x29aef5))[_0x857d('0x29')](handleError(_0x37639a,null));};exports[_0x857d('0x70')]=function(_0xf5132e,_0x33472d,_0x1c437b){return db[_0x857d('0x42')]['find']({'where':{'id':_0xf5132e[_0x857d('0x5e')]['id']}})[_0x857d('0x1f')](handleEntityNotFound(_0x33472d,null))[_0x857d('0x1f')](function(_0x2e66bc){if(_0x2e66bc){return _0x2e66bc[_0x857d('0x70')](_0xf5132e[_0x857d('0x47')][_0x857d('0x6d')]);}})[_0x857d('0x1f')](respondWithStatusCode(_0x33472d,null))[_0x857d('0x29')](handleError(_0x33472d,null));};exports['notify']=function(_0x2339ea,_0x2dd45a,_0x94ea72){var _0xc48fc4={'body':_0x2339ea[_0x857d('0x67')],'channel':'openchannel'};var _0x1f889d=[];var _0x40b740=[];var _0x2170b1={};var _0x3bf3c1=![];return db[_0x857d('0x71')][_0x857d('0x68')]()['then'](function(_0x64b5ba){if(!_0x64b5ba){throw new db[(_0x857d('0x72'))][(_0x857d('0x73'))](_0x857d('0x74'));}_0x1f889d=_[_0x857d('0x75')](_[_0x857d('0x48')](_0x64b5ba),[_0x857d('0x76'),_0x857d('0x77')]);_0x40b740=_['difference'](_[_0x857d('0x48')](_0x64b5ba),['createdAt',_0x857d('0x77'),_0x857d('0x78'),_0x857d('0x79')]);if(_0x2339ea[_0x857d('0x67')]['id']){delete _0x2339ea[_0x857d('0x67')]['id'];}if(_[_0x857d('0x7a')](_0x2339ea[_0x857d('0x67')][_0x857d('0x7b')])){throw new db[(_0x857d('0x72'))][(_0x857d('0x73'))](_0x857d('0x7c'));}if(_['isNil'](_0x2339ea['body']['body'])||_0x2339ea[_0x857d('0x67')][_0x857d('0x67')]===''){throw new db[(_0x857d('0x72'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2339ea[_0x857d('0x67')][_0x857d('0x7d')])){throw new db[(_0x857d('0x72'))]['ValidationError'](_0x857d('0x7e')+_0x40b740);}if(!_['includes'](_0x40b740,_0x2339ea[_0x857d('0x67')][_0x857d('0x7d')])){throw new db[(_0x857d('0x72'))][(_0x857d('0x73'))](_0x857d('0x7f')+_0x40b740);}_0x2170b1[_0x2339ea[_0x857d('0x67')][_0x857d('0x7d')]]=_0x2339ea['body'][_0x857d('0x7b')];})[_0x857d('0x1f')](function(){return db[_0x857d('0x42')][_0x857d('0x60')]({'where':{'id':_0x2339ea['params']['id']},'include':[{'model':db[_0x857d('0x80')],'as':_0x857d('0x81'),'include':[{'model':db['CmContact'],'as':_0x857d('0x82'),'where':_0x2170b1,'limit':0x1,'order':[[_0x857d('0x77'),_0x857d('0x83')]]}]},{'model':db['OpenchannelApplication'],'as':_0x857d('0x84')}]});})[_0x857d('0x1f')](handleEntityNotFound(_0x2dd45a,null))['then'](function(_0x193384){if(_0x193384&&_0x193384['List']){_0xc48fc4[_0x857d('0x85')]=_0x193384;_0xc48fc4['applications']=_0x193384[_0x857d('0x84')];_0xc48fc4['list']=_0x193384[_0x857d('0x81')];_0xc48fc4[_0x857d('0x86')]=_['orderBy'](_0xc48fc4['applications'],[_0x857d('0x87')],[_0x857d('0x88')]);if(_0xc48fc4[_0x857d('0x85')]['Applications']){delete _0xc48fc4['account']['Applications'];}if(_0xc48fc4[_0x857d('0x85')]['List']&&_0xc48fc4[_0x857d('0x85')][_0x857d('0x81')][_0x857d('0x82')][_0x857d('0x4e')]){return _0xc48fc4['account']['List']['Contacts'][0x0];}var _0x5f1344=_[_0x857d('0x18')](_0x2339ea['body'],{'firstName':_0x2339ea[_0x857d('0x67')][_0x857d('0x7b')],'ListId':_0x193384[_0x857d('0x79')]});_0x5f1344[_0x2339ea[_0x857d('0x67')][_0x857d('0x7d')]]=_0x2339ea[_0x857d('0x67')][_0x857d('0x7b')];return db['CmContact'][_0x857d('0x61')](_0x5f1344,{'fields':_0x1f889d,'raw':!![]});}})['then'](handleEntityNotFound(_0x2dd45a,null))[_0x857d('0x1f')](function(_0x7b4571){_0xc48fc4['contact']=_0x7b4571;if(_0x7b4571){var _0xc6e954={'ContactId':_0x7b4571['id'],'OpenchannelAccountId':_0x2339ea['params']['id'],'from':(_0x7b4571[_0x857d('0x89')]||'')+'\x20'+(_0x7b4571[_0x857d('0x8a')]||'')};var _0x2cdf17={'OpenchannelAccountId':_0x2339ea[_0x857d('0x5e')]['id'],'closed':![]};if(_0x2339ea[_0x857d('0x67')][_0x857d('0x8b')]){_0x2cdf17[_0x857d('0x8b')]=_0x2339ea[_0x857d('0x67')]['threadId'];return db[_0x857d('0x8c')]['find']({'where':_0x2cdf17})['then'](function(_0x430c7f){if(_0x430c7f){return[_0x430c7f,![]];}_0xc6e954[_0x857d('0x8b')]=_0x2339ea[_0x857d('0x67')][_0x857d('0x8b')];_0xc6e954[_0x857d('0x8d')]=_0x2339ea[_0x857d('0x67')]['externalUrl'];return db[_0x857d('0x8c')][_0x857d('0x61')](_0xc6e954)['then'](function(_0x21c49d){return[_0x21c49d,!![]];});});}else{_0x2cdf17['threadId']=null;}_0x2cdf17['ContactId']=_0x7b4571['id'];return db[_0x857d('0x8c')][_0x857d('0x60')]({'where':_0x2cdf17})[_0x857d('0x1f')](function(_0x5861ba){if(_0x5861ba){return[_0x5861ba,![]];}return db[_0x857d('0x8c')]['create'](_0xc6e954)['then'](function(_0x20add3){return[_0x20add3,!![]];});});}})[_0x857d('0x8e')](function(_0x39aed8,_0x430bec){if(_0x39aed8){_0x3bf3c1=_0x430bec;if(!_0x430bec){var _0x3dc78e={'from':(_0xc48fc4[_0x857d('0x8f')][_0x857d('0x89')]||'')+'\x20'+(_0xc48fc4[_0x857d('0x8f')]['lastName']||'')};if(_0x2339ea[_0x857d('0x67')][_0x857d('0x8b')]&&_0x2339ea[_0x857d('0x67')][_0x857d('0x90')]&&_0x2339ea['body'][_0x857d('0x8b')]!=_0x2339ea[_0x857d('0x67')]['messageId']){_0x3dc78e['threadId']=_0x2339ea[_0x857d('0x67')]['messageId'];}return _0x39aed8['update'](_0x3dc78e);}else{return _0x39aed8;}}})[_0x857d('0x1f')](function(_0x23ec4b){_0xc48fc4[_0x857d('0x91')]=_0x23ec4b['get']({'plain':!![]});_0xc48fc4[_0x857d('0x91')][_0x857d('0x92')]=_0x3bf3c1;if(_0xc48fc4[_0x857d('0x91')][_0x857d('0x92')]){if(_0xc48fc4['account'][_0x857d('0x93')]){_0xc48fc4[_0x857d('0x86')][_0x857d('0x94')]({'id':0x0,'priority':_0xc48fc4[_0x857d('0x86')][_0x857d('0x4e')]+0x1,'app':_0x857d('0x95'),'appdata':_0x857d('0x96'),'interval':'*,*,*,*'});}}return db['OpenchannelMessage']['create']({'body':_0x2339ea[_0x857d('0x67')][_0x857d('0x67')],'OpenchannelAccountId':_0x2339ea[_0x857d('0x5e')]['id'],'OpenchannelInteractionId':_0x23ec4b['id'],'direction':'in','ContactId':_0xc48fc4['contact']['id'],'AttachmentId':_0x2339ea['body']['AttachmentId']});})[_0x857d('0x1f')](function(_0x5f8d2f){_0xc48fc4[_0x857d('0x27')]=_0x5f8d2f;if(_0xc48fc4[_0x857d('0x91')][_0x857d('0x97')]){return db[_0x857d('0x98')][_0x857d('0x60')]({'attributes':['id',_0x857d('0x3c')],'where':{'id':_0xc48fc4['interaction'][_0x857d('0x97')]}})[_0x857d('0x1f')](function(_0x40b715){if(_0x40b715){_0xc48fc4['applications'][_0x857d('0x99')]({'id':0x0,'priority':0x0,'app':_0x857d('0x9a'),'appdata':_0x40b715[_0x857d('0x3c')]+','+(_0xc48fc4[_0x857d('0x85')]['waitForTheAssignedAgent']||0xa),'interval':_0x857d('0x9b')});_0xc48fc4[_0x857d('0x9c')]=![];}return respondWithRpcPromise('Start',_0x857d('0x9d'),_0xc48fc4);});}return respondWithRpcPromise(_0x857d('0x9e'),'startRouting',_0xc48fc4);})[_0x857d('0x1f')](function(_0x4d33c4){respondWithRpcPromise(_0x857d('0x9f'),'EventManager',{'event':'notify','message':_0x4d33c4},client9002);return _0x4d33c4;})[_0x857d('0x1f')](respondWithResult(_0x2dd45a,null))['catch'](handleError(_0x2dd45a,null));};exports[_0x857d('0xa0')]=function(_0x5ec58c,_0x44e9f2){var _0x5670b8=_0x5ec58c['params']['id'];var _0x5c731e=_0x5ec58c[_0x857d('0x67')];var _0xa8ef49=0xc8;var _0x5714c2=null;return db['sequelize'][_0x857d('0xa1')]({'isolationLevel':db[_0x857d('0xa2')]['Transaction'][_0x857d('0xa3')]['READ_COMMITTED']},function(_0x568b77){return db['OpenchannelAccount'][_0x857d('0x6b')]({'where':{'id':_0x5670b8},'transaction':_0x568b77})[_0x857d('0x1f')](function(_0x23968b){if(_0x23968b){return db[_0x857d('0xa4')][_0x857d('0x37')]({'where':{'OpenchannelAccountId':_0x5670b8},'transaction':_0x568b77})[_0x857d('0x1f')](function(){var _0x358d77=_[_0x857d('0x41')](_0x5c731e,function(_0x1e57e8){_0x1e57e8[_0x857d('0x69')]=_0x5670b8;return _0x1e57e8;});return db[_0x857d('0xa4')][_0x857d('0xa5')](_0x358d77,{'transaction':_0x568b77});});}else{_0xa8ef49=0x194;_0x5714c2=[];}});})[_0x857d('0x1f')](function(){if(_0xa8ef49!==0x194){return db[_0x857d('0xa4')][_0x857d('0xa6')]({'where':{'OpenchannelAccountId':_0x5670b8},'order':_0x857d('0x87')})[_0x857d('0x1f')](function(_0x98e9c6){_0x5714c2=_0x98e9c6;});}})[_0x857d('0x29')](function(_0x346735){_0xa8ef49=0x1f4;logger[_0x857d('0x25')](_0x346735[_0x857d('0x3b')]);if(_0x346735[_0x857d('0x3c')]){delete _0x346735['name'];}_0x5714c2=_0x346735;})[_0x857d('0xa7')](function(){if(_0x5714c2===null){_0x44e9f2['sendStatus'](_0xa8ef49);}else{if(_0xa8ef49===0x1f4){_0x44e9f2[_0x857d('0x2b')](_0xa8ef49)[_0x857d('0x3d')](_0x5714c2);}else{_0x44e9f2[_0x857d('0x2b')](_0xa8ef49)[_0x857d('0x32')](_0x5714c2);}}});};exports[_0x857d('0xa8')]=function(_0x38c857,_0x3eb6ef,_0x2df4ab){var _0x18be63={};var _0x53e609={};var _0x2ef364;var _0x56d64d;return db[_0x857d('0x42')][_0x857d('0x6b')]({'where':{'id':_0x38c857[_0x857d('0x5e')]['id']}})[_0x857d('0x1f')](handleEntityNotFound(_0x3eb6ef,null))[_0x857d('0x1f')](function(_0x3a9779){if(_0x3a9779){_0x2ef364=_0x3a9779;_0x53e609[_0x857d('0x4b')]=_[_0x857d('0x48')](db[_0x857d('0xa4')][_0x857d('0x43')]);_0x53e609['query']=_[_0x857d('0x48')](_0x38c857[_0x857d('0x47')]);_0x53e609[_0x857d('0x49')]=_[_0x857d('0x4a')](_0x53e609['model'],_0x53e609['query']);_0x18be63[_0x857d('0x4d')]=_[_0x857d('0x4a')](_0x53e609[_0x857d('0x4b')],qs[_0x857d('0x4c')](_0x38c857[_0x857d('0x47')][_0x857d('0x4c')]));_0x18be63['attributes']=_0x18be63[_0x857d('0x4d')][_0x857d('0x4e')]?_0x18be63[_0x857d('0x4d')]:_0x53e609[_0x857d('0x4b')];_0x18be63[_0x857d('0x52')]=qs['sort'](_0x38c857[_0x857d('0x47')][_0x857d('0x53')]);_0x18be63[_0x857d('0x56')]=qs[_0x857d('0x49')](_[_0x857d('0x54')](_0x38c857[_0x857d('0x47')],_0x53e609[_0x857d('0x49')]));if(_0x38c857[_0x857d('0x47')]['filter']){_0x18be63['where']=_[_0x857d('0x57')](_0x18be63[_0x857d('0x56')],{'$or':_[_0x857d('0x41')](_0x18be63[_0x857d('0x4d')],function(_0x8b7b65){var _0x2b89ff={};_0x2b89ff[_0x8b7b65]={'$like':'%'+_0x38c857[_0x857d('0x47')][_0x857d('0x55')]+'%'};return _0x2b89ff;})});}_0x18be63=_['merge']({},_0x18be63,_0x38c857[_0x857d('0x59')]);return _0x2ef364[_0x857d('0xa8')](_0x18be63);}})[_0x857d('0x1f')](function(_0x2d64b8){if(_0x2d64b8){_0x56d64d=_0x2d64b8[_0x857d('0x4e')];if(!_0x38c857[_0x857d('0x47')][_0x857d('0x4f')]('nolimit')){_0x18be63[_0x857d('0x51')]=qs[_0x857d('0x51')](_0x38c857[_0x857d('0x47')][_0x857d('0x51')]);_0x18be63[_0x857d('0x2d')]=qs['offset'](_0x38c857[_0x857d('0x47')][_0x857d('0x2d')]);}return _0x2ef364['getApplications'](_0x18be63);}})[_0x857d('0x1f')](function(_0x5e82d1){if(_0x5e82d1){return _0x5e82d1?{'count':_0x56d64d,'rows':_0x5e82d1}:null;}})[_0x857d('0x1f')](respondWithResult(_0x3eb6ef,null))[_0x857d('0x29')](handleError(_0x3eb6ef,null));};exports[_0x857d('0xa9')]=function(_0xc597dc,_0x244d30,_0x28726d){var _0x48a62c={'raw':![],'where':{}};var _0x45a798={};var _0x4ae730={'count':0x0,'rows':[]};return db[_0x857d('0x42')]['findOne']({'where':{'id':_0xc597dc[_0x857d('0x5e')]['id']}})[_0x857d('0x1f')](handleEntityNotFound(_0x244d30,null))[_0x857d('0x1f')](function(_0x477c83){if(_0x477c83){_0x45a798['model']=_[_0x857d('0x48')](db[_0x857d('0x8c')][_0x857d('0x43')]);_0x45a798['query']=_['keys'](_0xc597dc['query']);_0x45a798[_0x857d('0x49')]=_[_0x857d('0x4a')](_0x45a798[_0x857d('0x4b')],_0x45a798[_0x857d('0x47')]);_0x48a62c[_0x857d('0x4d')]=_[_0x857d('0x4a')](_0x45a798[_0x857d('0x4b')],qs[_0x857d('0x4c')](_0xc597dc[_0x857d('0x47')][_0x857d('0x4c')]));_0x48a62c['attributes']=_0x48a62c[_0x857d('0x4d')][_0x857d('0x4e')]?_0x48a62c['attributes']:_0x45a798[_0x857d('0x4b')];if(!_0xc597dc[_0x857d('0x47')][_0x857d('0x4f')](_0x857d('0x50'))){_0x48a62c[_0x857d('0x51')]=qs['limit'](_0xc597dc[_0x857d('0x47')][_0x857d('0x51')]);_0x48a62c[_0x857d('0x2d')]=qs[_0x857d('0x2d')](_0xc597dc[_0x857d('0x47')][_0x857d('0x2d')]);}_0x48a62c[_0x857d('0x52')]=qs[_0x857d('0x53')](_0xc597dc['query'][_0x857d('0x53')]);_0x48a62c[_0x857d('0x56')]=qs['filters'](_[_0x857d('0x54')](_0xc597dc[_0x857d('0x47')],_0x45a798[_0x857d('0x49')]));_0x48a62c[_0x857d('0x56')][_0x857d('0x69')]=_0x477c83['id'];if(_0xc597dc[_0x857d('0x47')][_0x857d('0x55')]){_0x48a62c[_0x857d('0x56')]=_['merge'](_0x48a62c[_0x857d('0x56')],{'$or':_[_0x857d('0x41')](_0x48a62c['attributes'],function(_0x3295f3){var _0x14c3fb={};_0x14c3fb[_0x3295f3]={'$like':'%'+_0xc597dc[_0x857d('0x47')][_0x857d('0x55')]+'%'};return _0x14c3fb;})});}_0x48a62c=_['merge']({},_0x48a62c,_0xc597dc[_0x857d('0x59')]);return db['OpenchannelInteraction'][_0x857d('0x2f')]({'where':_0x48a62c[_0x857d('0x56')]})[_0x857d('0x1f')](function(_0x817c8b){_0x4ae730['count']=_0x817c8b;if(_0xc597dc[_0x857d('0x47')]['includeAll']){_0x48a62c[_0x857d('0x5f')]=[{'model':db[_0x857d('0x71')],'as':'Contact','required':![]},{'model':db[_0x857d('0x98')],'as':_0x857d('0xaa'),'attributes':[_0x857d('0x3c'),_0x857d('0xab'),_0x857d('0xac')],'required':![]},{'model':db[_0x857d('0xad')],'as':_0x857d('0xae'),'attributes':['id',_0x857d('0x3c'),_0x857d('0xaf')],'where':_0xc597dc[_0x857d('0x47')]['tag']?{'id':_0xc597dc[_0x857d('0x47')]['tag']}:undefined,'required':_0xc597dc[_0x857d('0x47')]['tag']?!![]:![]}];}return db[_0x857d('0x8c')][_0x857d('0x5b')](_0x48a62c);})['then'](function(_0x1b7274){_0x4ae730['rows']=_0x1b7274;return _0x4ae730;});}})['then'](respondWithFilteredResult(_0x244d30,_0x48a62c))['catch'](handleError(_0x244d30,null));};exports[_0x857d('0xb0')]=function(_0x1bd322,_0x47781f,_0x5abdaa){return db['OpenchannelAccount'][_0x857d('0x60')]({'where':{'id':_0x1bd322[_0x857d('0x5e')]['id']}})[_0x857d('0x1f')](handleEntityNotFound(_0x47781f,null))[_0x857d('0x1f')](function(_0x387a43){if(_0x387a43){return _0x387a43['addAgents'](_0x1bd322[_0x857d('0x67')]['ids'],_[_0x857d('0xb1')](_0x1bd322['body'],['ids','id'])||{})[_0x857d('0x8e')](function(_0x197650){for(var _0x457eca=0x0;_0x457eca<_0x1bd322[_0x857d('0x67')][_0x857d('0x6d')][_0x857d('0x4e')];_0x457eca+=0x1){socket['emit'](_0x857d('0xb2'),{'UserId':Number(_0x1bd322[_0x857d('0x67')][_0x857d('0x6d')][_0x457eca]),'OpenchannelAccountId':Number(_0x1bd322[_0x857d('0x5e')]['id'])});}return _0x197650;});}})[_0x857d('0x1f')](respondWithResult(_0x47781f,null))[_0x857d('0x29')](handleError(_0x47781f,null));};exports[_0x857d('0xb3')]=function(_0x307f46,_0x44c6aa,_0x37e2d0){return db[_0x857d('0x42')][_0x857d('0x60')]({'where':{'id':_0x307f46[_0x857d('0x5e')]['id']}})[_0x857d('0x1f')](handleEntityNotFound(_0x44c6aa,null))[_0x857d('0x1f')](function(_0x3dc4bb){if(_0x3dc4bb){return _0x3dc4bb['removeAgents'](_0x307f46[_0x857d('0x47')][_0x857d('0x6d')])['then'](function(){if(_[_0x857d('0xb4')](_0x307f46['query'][_0x857d('0x6d')])){for(var _0x122ed7=0x0;_0x122ed7<_0x307f46['query'][_0x857d('0x6d')][_0x857d('0x4e')];_0x122ed7+=0x1){socket[_0x857d('0xb5')](_0x857d('0xb6'),{'UserId':Number(_0x307f46[_0x857d('0x47')][_0x857d('0x6d')][_0x122ed7]),'OpenchannelAccountId':Number(_0x307f46[_0x857d('0x5e')]['id'])});}}else{socket[_0x857d('0xb5')](_0x857d('0xb6'),{'UserId':Number(_0x307f46[_0x857d('0x47')][_0x857d('0x6d')]),'OpenchannelAccountId':Number(_0x307f46[_0x857d('0x5e')]['id'])});}});}})[_0x857d('0x1f')](respondWithStatusCode(_0x44c6aa,null))[_0x857d('0x29')](handleError(_0x44c6aa,null));};exports[_0x857d('0xb7')]=function(_0x41bfe2,_0x5a0507,_0x5e5764){var _0x39e96a={};var _0x5b4315={};var _0x3c4202;var _0x397b33;return db['OpenchannelAccount'][_0x857d('0x6b')]({'where':{'id':_0x41bfe2[_0x857d('0x5e')]['id']}})[_0x857d('0x1f')](handleEntityNotFound(_0x5a0507,null))[_0x857d('0x1f')](function(_0x3db5c4){if(_0x3db5c4){_0x3c4202=_0x3db5c4;_0x5b4315['model']=_[_0x857d('0x48')](db[_0x857d('0x98')][_0x857d('0x43')]);_0x5b4315[_0x857d('0x47')]=_[_0x857d('0x48')](_0x41bfe2[_0x857d('0x47')]);_0x5b4315[_0x857d('0x49')]=_[_0x857d('0x4a')](_0x5b4315[_0x857d('0x4b')],_0x5b4315[_0x857d('0x47')]);_0x39e96a[_0x857d('0x4d')]=_['intersection'](_0x5b4315['model'],qs[_0x857d('0x4c')](_0x41bfe2[_0x857d('0x47')]['fields']));_0x39e96a['attributes']=_0x39e96a['attributes'][_0x857d('0x4e')]?_0x39e96a[_0x857d('0x4d')]:_0x5b4315[_0x857d('0x4b')];_0x39e96a[_0x857d('0x52')]=qs['sort'](_0x41bfe2[_0x857d('0x47')][_0x857d('0x53')]);_0x39e96a['where']=qs['filters'](_[_0x857d('0x54')](_0x41bfe2[_0x857d('0x47')],_0x5b4315[_0x857d('0x49')]));if(_0x41bfe2[_0x857d('0x47')][_0x857d('0x55')]){_0x39e96a[_0x857d('0x56')]=_[_0x857d('0x57')](_0x39e96a[_0x857d('0x56')],{'$or':_[_0x857d('0x41')](_0x39e96a[_0x857d('0x4d')],function(_0xb845de){var _0x327a2d={};_0x327a2d[_0xb845de]={'$like':'%'+_0x41bfe2[_0x857d('0x47')][_0x857d('0x55')]+'%'};return _0x327a2d;})});}_0x39e96a=_[_0x857d('0x57')]({},_0x39e96a,_0x41bfe2['options']);return _0x3c4202['getAgents'](_0x39e96a);}})['then'](function(_0x571db6){if(_0x571db6){_0x397b33=_0x571db6['length'];if(!_0x41bfe2[_0x857d('0x47')]['hasOwnProperty'](_0x857d('0x50'))){_0x39e96a['limit']=qs[_0x857d('0x51')](_0x41bfe2[_0x857d('0x47')][_0x857d('0x51')]);_0x39e96a[_0x857d('0x2d')]=qs[_0x857d('0x2d')](_0x41bfe2[_0x857d('0x47')][_0x857d('0x2d')]);}return _0x3c4202[_0x857d('0xb7')](_0x39e96a);}})[_0x857d('0x1f')](function(_0x4eead8){if(_0x4eead8){return _0x4eead8?{'count':_0x397b33,'rows':_0x4eead8}:null;}})[_0x857d('0x1f')](respondWithResult(_0x5a0507,null))[_0x857d('0x29')](handleError(_0x5a0507,null));};exports['send']=function(_0x1e4933,_0x600835,_0x11f0e5){var _0x4e9835,_0x195b90,_0x5da232;if(_[_0x857d('0x7a')](_0x1e4933['body'][_0x857d('0x67')])||_0x1e4933['body']['body']===''){throw new db[(_0x857d('0x72'))][(_0x857d('0x73'))](_0x857d('0xb8'));}if(_[_0x857d('0x7a')](_0x1e4933[_0x857d('0x67')]['to'])){}_0x4e9835=_0x1e4933[_0x857d('0x67')]['to'];return db[_0x857d('0x42')][_0x857d('0x6b')]({'where':{'id':_0x1e4933[_0x857d('0x5e')]['id']}})['then'](handleEntityNotFound(_0x600835,null))['then'](function(_0x431a06){if(_0x431a06){return db['OpenchannelAccount'][_0x857d('0x60')]({'where':{'id':_0x431a06['id']},'include':[{'model':db[_0x857d('0x80')],'as':_0x857d('0x81'),'include':[{'model':db[_0x857d('0x71')],'as':_0x857d('0x82'),'where':{[_0x431a06[_0x857d('0x7d')]]:_0x4e9835},'limit':0x1,'order':[[_0x857d('0x77'),'DESC']]}]}]})[_0x857d('0x1f')](handleEntityNotFound(_0x600835,null))['then'](function(_0x37f59d){if(_0x37f59d&&_0x37f59d[_0x857d('0x81')]){_0x195b90=_0x37f59d[_0x857d('0x38')]({'plain':!![]});if(_0x195b90[_0x857d('0x81')]&&_0x195b90[_0x857d('0x81')]['Contacts'][_0x857d('0x4e')]){return _0x195b90[_0x857d('0x81')][_0x857d('0x82')][0x0];}return db[_0x857d('0x71')]['create'](_[_0x857d('0x18')](_0x1e4933[_0x857d('0x67')],{'firstName':_0x4e9835,[_0x37f59d['mapKey']]:_0x4e9835,'phone':_0x4e9835,'ListId':_0x195b90[_0x857d('0x79')]}));}})[_0x857d('0x1f')](handleEntityNotFound(_0x600835,null))[_0x857d('0x1f')](function(_0x16f026){if(_0x16f026){_0x5da232=_0x16f026;return db[_0x857d('0x8c')][_0x857d('0x60')]({'where':{'ContactId':_0x5da232['id'],'closed':![],'OpenchannelAccountId':_0x195b90['id']}})['then'](function(_0x334f3b){if(_0x334f3b){return[_0x334f3b,![]];}return db[_0x857d('0x8c')][_0x857d('0x61')]({'UserId':_0x1e4933['user']['id'],'ContactId':_0x5da232['id'],'OpenchannelAccountId':_0x195b90['id'],'lastMsgDirection':_0x857d('0xb9'),'Messages':[_['merge'](_0x1e4933[_0x857d('0x67')],{'read':![],'body':_0x1e4933['body'][_0x857d('0x67')],'OpenchannelAccountId':_0x195b90['id'],'UserId':_0x1e4933[_0x857d('0x62')]['id'],'ContactId':_0x5da232['id']})]},{'include':[{'model':db[_0x857d('0xba')],'as':_0x857d('0xbb')}]})[_0x857d('0x1f')](function(_0x2f1468){return[_0x2f1468,!![]];});});}})[_0x857d('0x8e')](function(_0x153eee,_0x2ae0e9){if(_0x2ae0e9){return _0x153eee;}return db['OpenchannelMessage'][_0x857d('0x61')](_[_0x857d('0x57')](_0x1e4933[_0x857d('0x67')],{'read':![],'body':_0x1e4933[_0x857d('0x67')][_0x857d('0x67')],'OpenchannelAccountId':_0x195b90['id'],'OpenchannelInteractionId':_0x153eee['id'],'UserId':_0x1e4933[_0x857d('0x62')]['id'],'ContactId':_0x5da232['id']}))[_0x857d('0x1f')](function(_0x2b9a9c){_0x153eee[_0x857d('0xbc')]['Messages']=[];_0x153eee[_0x857d('0xbc')][_0x857d('0xbb')][_0x857d('0x94')](_0x2b9a9c[_0x857d('0xbc')]);return _0x153eee;});});}})[_0x857d('0x1f')](respondWithResult(_0x600835,null))[_0x857d('0x29')](handleError(_0x600835,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 1aa9515..89e2851 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 _0xcb91=['save','update','emit','hasOwnProperty','hook','OpenchannelAccount','setMaxListeners'];(function(_0x22bdcd,_0x513415){var _0x142d96=function(_0x433de8){while(--_0x433de8){_0x22bdcd['push'](_0x22bdcd['shift']());}};_0x142d96(++_0x513415);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x193e28,_0x3dac1d){_0x193e28=_0x193e28-0x0;var _0x20ef59=_0xcb91[_0x193e28];return _0x20ef59;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x1cb9('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x1cb9('0x1')](0x0);var events={'afterCreate':_0x1cb9('0x2'),'afterUpdate':_0x1cb9('0x3'),'afterDestroy':'remove'};function emitEvent(_0x8c392f){return function(_0x2c17b8,_0x545a34,_0x13d5fd){OpenchannelAccountEvents[_0x1cb9('0x4')](_0x8c392f+':'+_0x2c17b8['id'],_0x2c17b8);OpenchannelAccountEvents['emit'](_0x8c392f,_0x2c17b8);_0x13d5fd(null);};}for(var e in events){if(events[_0x1cb9('0x5')](e)){var event=events[e];OpenchannelAccount[_0x1cb9('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0xac4a=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','emit','hook','events'];(function(_0x4d827b,_0xb86299){var _0x1466c9=function(_0x410443){while(--_0x410443){_0x4d827b['push'](_0x4d827b['shift']());}};_0x1466c9(++_0xb86299);}(_0xac4a,0x13f));var _0xaac4=function(_0x1ca599,_0x245e3c){_0x1ca599=_0x1ca599-0x0;var _0x543031=_0xac4a[_0x1ca599];return _0x543031;};'use strict';var EventEmitter=require(_0xaac4('0x0'));var OpenchannelAccount=require(_0xaac4('0x1'))['db'][_0xaac4('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xaac4('0x3')](0x0);var events={'afterCreate':_0xaac4('0x4'),'afterUpdate':_0xaac4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x58626e){return function(_0x2af0f6,_0x2a5762,_0x32d34c){OpenchannelAccountEvents['emit'](_0x58626e+':'+_0x2af0f6['id'],_0x2af0f6);OpenchannelAccountEvents[_0xaac4('0x6')](_0x58626e,_0x2af0f6);_0x32d34c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xaac4('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 6a7e0f6..a5db86c 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(_0x4104c9,_0x2a8403){var _0x4728f5=function(_0xd3d1b1){while(--_0xd3d1b1){_0x4104c9['push'](_0x4104c9['shift']());}};_0x4728f5(++_0x2a8403);}(_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 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(_0x5f2f83,_0xee3226){var _0x3d43ff=function(_0x4f9158){while(--_0x4f9158){_0x5f2f83['push'](_0x5f2f83['shift']());}};_0x3d43ff(++_0xee3226);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 d57221c..7dabfc8 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 _0x6cb4=['register','request','then','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter'];(function(_0xc40bc,_0x31d144){var _0x5d8c3d=function(_0x28c775){while(--_0x28c775){_0xc40bc['push'](_0xc40bc['shift']());}};_0x5d8c3d(++_0x31d144);}(_0x6cb4,0xff));var _0x46cb=function(_0x44e351,_0x515e21){_0x44e351=_0x44e351-0x0;var _0x43616b=_0x6cb4[_0x44e351];return _0x43616b;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var moment=require(_0x46cb('0x2'));var BPromise=require(_0x46cb('0x3'));var rs=require(_0x46cb('0x4'));var fs=require('fs');var Redis=require(_0x46cb('0x5'));var db=require(_0x46cb('0x6'))['db'];var utils=require(_0x46cb('0x7'));var logger=require(_0x46cb('0x8'))('rpc');var config=require(_0x46cb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x46cb('0xa')]['http']({'port':0x232a});config[_0x46cb('0xb')]=_[_0x46cb('0xc')](config[_0x46cb('0xb')],{'host':_0x46cb('0xd'),'port':0x18eb});var socket=require(_0x46cb('0xe'))(new Redis(config[_0x46cb('0xb')]));require('./openchannelAccount.socket')[_0x46cb('0xf')](socket);function respondWithRpcPromise(_0x34f9e9,_0x48101c,_0x206f10){return new BPromise(function(_0x106a87,_0x4a60b2){return client[_0x46cb('0x10')](_0x34f9e9,_0x206f10)[_0x46cb('0x11')](function(_0x570cfd){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x48101c,_0x46cb('0x12'));logger[_0x46cb('0x13')](_0x46cb('0x14'),_0x48101c,_0x46cb('0x12'),JSON['stringify'](_0x570cfd));if(_0x570cfd[_0x46cb('0x15')]){if(_0x570cfd[_0x46cb('0x15')][_0x46cb('0x16')]===0x1f4){logger[_0x46cb('0x15')](_0x46cb('0x17'),_0x48101c,_0x570cfd[_0x46cb('0x15')][_0x46cb('0x18')]);return _0x4a60b2(_0x570cfd[_0x46cb('0x15')][_0x46cb('0x18')]);}logger[_0x46cb('0x15')](_0x46cb('0x17'),_0x48101c,_0x570cfd['error'][_0x46cb('0x18')]);return _0x106a87(_0x570cfd['error'][_0x46cb('0x18')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x48101c,'request\x20sent');_0x106a87(_0x570cfd[_0x46cb('0x19')][_0x46cb('0x18')]);}})[_0x46cb('0x1a')](function(_0xcc8e2){logger[_0x46cb('0x15')](_0x46cb('0x17'),_0x48101c,_0xcc8e2);_0x4a60b2(_0xcc8e2);});});} \ No newline at end of file +var _0x823c=['redis','./openchannelAccount.socket','request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults'];(function(_0x1a014b,_0x48acae){var _0x462258=function(_0x1473be){while(--_0x1473be){_0x1a014b['push'](_0x1a014b['shift']());}};_0x462258(++_0x48acae);}(_0x823c,0x143));var _0xc823=function(_0x4c49d5,_0x4b44af){_0x4c49d5=_0x4c49d5-0x0;var _0x30f906=_0x823c[_0x4c49d5];return _0x30f906;};'use strict';var _=require(_0xc823('0x0'));var util=require('util');var moment=require(_0xc823('0x1'));var BPromise=require(_0xc823('0x2'));var rs=require(_0xc823('0x3'));var fs=require('fs');var Redis=require(_0xc823('0x4'));var db=require(_0xc823('0x5'))['db'];var utils=require(_0xc823('0x6'));var logger=require('../../config/logger')(_0xc823('0x7'));var config=require(_0xc823('0x8'));var jayson=require(_0xc823('0x9'));var client=jayson[_0xc823('0xa')][_0xc823('0xb')]({'port':0x232a});config['redis']=_[_0xc823('0xc')](config[_0xc823('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc823('0xd')]));require(_0xc823('0xe'))['register'](socket);function respondWithRpcPromise(_0x43bbd8,_0x2716a0,_0x5c214c){return new BPromise(function(_0x4dbd5b,_0x409ae1){return client[_0xc823('0xf')](_0x43bbd8,_0x5c214c)[_0xc823('0x10')](function(_0x35afbd){logger[_0xc823('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x2716a0,_0xc823('0x12'));logger[_0xc823('0x13')](_0xc823('0x14'),_0x2716a0,_0xc823('0x12'),JSON[_0xc823('0x15')](_0x35afbd));if(_0x35afbd[_0xc823('0x16')]){if(_0x35afbd['error'][_0xc823('0x17')]===0x1f4){logger[_0xc823('0x16')](_0xc823('0x18'),_0x2716a0,_0x35afbd[_0xc823('0x16')]['message']);return _0x409ae1(_0x35afbd['error']['message']);}logger['error'](_0xc823('0x18'),_0x2716a0,_0x35afbd['error'][_0xc823('0x19')]);return _0x4dbd5b(_0x35afbd[_0xc823('0x16')][_0xc823('0x19')]);}else{logger[_0xc823('0x11')](_0xc823('0x18'),_0x2716a0,_0xc823('0x12'));_0x4dbd5b(_0x35afbd[_0xc823('0x1a')]['message']);}})[_0xc823('0x1b')](function(_0x4a713a){logger[_0xc823('0x16')](_0xc823('0x18'),_0x2716a0,_0x4a713a);_0x409ae1(_0x4a713a);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index fa186c2..98da4ca 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 _0x4e34=['update','removeListener','length','openchannelAccount:','remove'];(function(_0x3c3ae0,_0x120a3a){var _0x1a8f61=function(_0x20c044){while(--_0x20c044){_0x3c3ae0['push'](_0x3c3ae0['shift']());}};_0x1a8f61(++_0x120a3a);}(_0x4e34,0x19e));var _0x44e3=function(_0x6ab3b6,_0x5905c4){_0x6ab3b6=_0x6ab3b6-0x0;var _0x5420a6=_0x4e34[_0x6ab3b6];return _0x5420a6;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0x44e3('0x0'),_0x44e3('0x1')];function createListener(_0x4d3831,_0x511088){return function(_0xdaba22){_0x511088['emit'](_0x4d3831,_0xdaba22);};}function removeListener(_0x45571,_0x36cbe3){return function(){OpenchannelAccountEvents[_0x44e3('0x2')](_0x45571,_0x36cbe3);};}exports['register']=function(_0x50805a){for(var _0x162bd9=0x0,_0x19e7de=events[_0x44e3('0x3')];_0x162bd9<_0x19e7de;_0x162bd9++){var _0x1ca56e=events[_0x162bd9];var _0x37b7d4=createListener(_0x44e3('0x4')+_0x1ca56e,_0x50805a);OpenchannelAccountEvents['on'](_0x1ca56e,_0x37b7d4);}}; \ No newline at end of file +var _0xca56=['remove','update','emit','removeListener','register','length','./openchannelAccount.events','save'];(function(_0x5027b1,_0x1409a5){var _0x4a46cf=function(_0x121920){while(--_0x121920){_0x5027b1['push'](_0x5027b1['shift']());}};_0x4a46cf(++_0x1409a5);}(_0xca56,0xee));var _0x6ca5=function(_0x569bd6,_0x406550){_0x569bd6=_0x569bd6-0x0;var _0x54c93e=_0xca56[_0x569bd6];return _0x54c93e;};'use strict';var OpenchannelAccountEvents=require(_0x6ca5('0x0'));var events=[_0x6ca5('0x1'),_0x6ca5('0x2'),_0x6ca5('0x3')];function createListener(_0x404fb9,_0x17e955){return function(_0x2f20c2){_0x17e955[_0x6ca5('0x4')](_0x404fb9,_0x2f20c2);};}function removeListener(_0x15105e,_0x5456b0){return function(){OpenchannelAccountEvents[_0x6ca5('0x5')](_0x15105e,_0x5456b0);};}exports[_0x6ca5('0x6')]=function(_0x4440bd){for(var _0x2c078a=0x0,_0x529cbe=events[_0x6ca5('0x7')];_0x2c078a<_0x529cbe;_0x2c078a++){var _0x232b31=events[_0x2c078a];var _0x511b48=createListener('openchannelAccount:'+_0x232b31,_0x4440bd);OpenchannelAccountEvents['on'](_0x232b31,_0x511b48);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index bcb99b9..abb9c7e 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 _0xb38d=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelApplication.controller','index','/:id','isAuthenticated','show','put','update','delete'];(function(_0xdfc0a4,_0x19adab){var _0x1a0c85=function(_0x30c73e){while(--_0x30c73e){_0xdfc0a4['push'](_0xdfc0a4['shift']());}};_0x1a0c85(++_0x19adab);}(_0xb38d,0xb0));var _0xdb38=function(_0x5443ac,_0x2cb686){_0x5443ac=_0x5443ac-0x0;var _0x2e4780=_0xb38d[_0x5443ac];return _0x2e4780;};'use strict';var multer=require(_0xdb38('0x0'));var util=require(_0xdb38('0x1'));var path=require(_0xdb38('0x2'));var timeout=require(_0xdb38('0x3'));var express=require(_0xdb38('0x4'));var router=express[_0xdb38('0x5')]();var fs_extra=require(_0xdb38('0x6'));var auth=require(_0xdb38('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdb38('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xdb38('0x9')]);router['get'](_0xdb38('0xa'),auth[_0xdb38('0xb')](),controller[_0xdb38('0xc')]);router['post']('/',auth[_0xdb38('0xb')](),controller['create']);router[_0xdb38('0xd')](_0xdb38('0xa'),auth['isAuthenticated'](),controller[_0xdb38('0xe')]);router[_0xdb38('0xf')](_0xdb38('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x27f1=['show','post','isAuthenticated','create','update','delete','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','index','/:id'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x27f1,0x1db));var _0x127f=function(_0x28e74e,_0x53fdf1){_0x28e74e=_0x28e74e-0x0;var _0xb45ac1=_0x27f1[_0x28e74e];return _0xb45ac1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x127f('0x0'));var timeout=require(_0x127f('0x1'));var express=require(_0x127f('0x2'));var router=express['Router']();var fs_extra=require(_0x127f('0x3'));var auth=require(_0x127f('0x4'));var interaction=require(_0x127f('0x5'));var config=require(_0x127f('0x6'));var controller=require(_0x127f('0x7'));router[_0x127f('0x8')]('/',auth['isAuthenticated'](),controller[_0x127f('0x9')]);router['get'](_0x127f('0xa'),auth['isAuthenticated'](),controller[_0x127f('0xb')]);router[_0x127f('0xc')]('/',auth[_0x127f('0xd')](),controller[_0x127f('0xe')]);router['put']('/:id',auth[_0x127f('0xd')](),controller[_0x127f('0xf')]);router[_0x127f('0x10')]('/:id',auth[_0x127f('0xd')](),controller['destroy']);module[_0x127f('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 8c7f8ca..1a14cb9 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 _0x6bcb=['STRING','TEXT','exports','INTEGER'];(function(_0x173367,_0x4cdbb5){var _0xfe5bcf=function(_0x494e47){while(--_0x494e47){_0x173367['push'](_0x173367['shift']());}};_0xfe5bcf(++_0x4cdbb5);}(_0x6bcb,0x132));var _0xb6bc=function(_0x238830,_0x545f75){_0x238830=_0x238830-0x0;var _0x5917f0=_0x6bcb[_0x238830];return _0x5917f0;};'use strict';var Sequelize=require('sequelize');module[_0xb6bc('0x0')]={'priority':{'type':Sequelize[_0xb6bc('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xb6bc('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xb6bc('0x3')]()},'description':{'type':Sequelize[_0xb6bc('0x2')]},'interval':{'type':Sequelize[_0xb6bc('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x0fa6=['INTEGER','STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x35b87c,_0x166a8c){var _0x24795b=function(_0x2cb112){while(--_0x2cb112){_0x35b87c['push'](_0x35b87c['shift']());}};_0x24795b(++_0x166a8c);}(_0x0fa6,0x160));var _0x60fa=function(_0x1ec318,_0x130e57){_0x1ec318=_0x1ec318-0x0;var _0x301b08=_0x0fa6[_0x1ec318];return _0x301b08;};'use strict';var Sequelize=require(_0x60fa('0x0'));module[_0x60fa('0x1')]={'priority':{'type':Sequelize[_0x60fa('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x60fa('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x60fa('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x60fa('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 3e5b982..f6c55b2 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 _0xd17f=['stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','OpenchannelApplication','includeAll','include','findAll','catch','show','params','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','reject','save','update','then','destroy','error'];(function(_0xd3e36d,_0x5533ce){var _0x45b310=function(_0x112d1d){while(--_0x112d1d){_0xd3e36d['push'](_0xd3e36d['shift']());}};_0x45b310(++_0x5533ce);}(_0xd17f,0x69));var _0xfd17=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xd17f[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0xfd17('0x0'));var rimraf=require(_0xfd17('0x1'));var zipdir=require(_0xfd17('0x2'));var jsonpatch=require(_0xfd17('0x3'));var rp=require(_0xfd17('0x4'));var moment=require(_0xfd17('0x5'));var BPromise=require(_0xfd17('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfd17('0x7'));var sox=require(_0xfd17('0x8'));var csv=require(_0xfd17('0x9'));var ejs=require(_0xfd17('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfd17('0xb'));var deskjs=require(_0xfd17('0xc'));var toCsv=require(_0xfd17('0x9'));var querystring=require(_0xfd17('0xd'));var Papa=require(_0xfd17('0xe'));var Redis=require(_0xfd17('0xf'));var authService=require(_0xfd17('0x10'));var qs=require(_0xfd17('0x11'));var as=require(_0xfd17('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xfd17('0x13'));var licenseUtil=require(_0xfd17('0x14'));var db=require(_0xfd17('0x15'))['db'];function respondWithStatusCode(_0x4ba04d,_0x247c2e){_0x247c2e=_0x247c2e||0xcc;return function(_0x47d4d1){if(_0x47d4d1){return _0x4ba04d[_0xfd17('0x16')](_0x247c2e);}return _0x4ba04d[_0xfd17('0x17')](_0x247c2e)[_0xfd17('0x18')]();};}function respondWithResult(_0x585be0,_0x5bacf8){_0x5bacf8=_0x5bacf8||0xc8;return function(_0x5b25b7){if(_0x5b25b7){return _0x585be0[_0xfd17('0x17')](_0x5bacf8)[_0xfd17('0x19')](_0x5b25b7);}};}function respondWithFilteredResult(_0x27c510,_0x52a2df){return function(_0x3aebda){if(_0x3aebda){var _0x280d8a=typeof _0x52a2df['offset']===_0xfd17('0x1a')&&typeof _0x52a2df[_0xfd17('0x1b')]===_0xfd17('0x1a');var _0x34fc78=_0x3aebda['count'];var _0x563739=_0x280d8a?0x0:_0x52a2df[_0xfd17('0x1c')];var _0x1065ee=_0x280d8a?_0x3aebda[_0xfd17('0x1d')]:_0x52a2df[_0xfd17('0x1c')]+_0x52a2df[_0xfd17('0x1b')];var _0x4f9e03;if(_0x1065ee>=_0x34fc78){_0x1065ee=_0x34fc78;_0x4f9e03=0xc8;}else{_0x4f9e03=0xce;}_0x27c510['status'](_0x4f9e03);return _0x27c510['set'](_0xfd17('0x1e'),_0x563739+'-'+_0x1065ee+'/'+_0x34fc78)[_0xfd17('0x19')](_0x3aebda);}return null;};}function patchUpdates(_0x3fdd22){return function(_0x2dd97b){try{jsonpatch['apply'](_0x2dd97b,_0x3fdd22,!![]);}catch(_0x2604bc){return BPromise[_0xfd17('0x1f')](_0x2604bc);}return _0x2dd97b[_0xfd17('0x20')]();};}function saveUpdates(_0x2ef1c7,_0xaa65c4){return function(_0x3690bb){if(_0x3690bb){return _0x3690bb[_0xfd17('0x21')](_0x2ef1c7)[_0xfd17('0x22')](function(_0x4bbd2c){return _0x4bbd2c;});}return null;};}function removeEntity(_0x3a1b3b,_0x56a4ef){return function(_0x566fe3){if(_0x566fe3){return _0x566fe3[_0xfd17('0x23')]()[_0xfd17('0x22')](function(){_0x3a1b3b['status'](0xcc)[_0xfd17('0x18')]();});}};}function handleEntityNotFound(_0x5721e4,_0x46689e){return function(_0x313f3d){if(!_0x313f3d){_0x5721e4[_0xfd17('0x16')](0x194);}return _0x313f3d;};}function handleError(_0x5b1ee1,_0x33fb76){_0x33fb76=_0x33fb76||0x1f4;return function(_0x17600e){logger[_0xfd17('0x24')](_0x17600e[_0xfd17('0x25')]);if(_0x17600e['name']){delete _0x17600e[_0xfd17('0x26')];}_0x5b1ee1['status'](_0x33fb76)[_0xfd17('0x27')](_0x17600e);};}exports['index']=function(_0x2d94be,_0x583e7f){var _0x5ebc68={},_0x2791f7={},_0x72eb23={'count':0x0,'rows':[]};var _0x5d5f44=_[_0xfd17('0x28')](db['OpenchannelApplication'][_0xfd17('0x29')],function(_0x41008a){return{'name':_0x41008a[_0xfd17('0x2a')],'type':_0x41008a[_0xfd17('0x2b')][_0xfd17('0x2c')]};});_0x2791f7[_0xfd17('0x2d')]=_[_0xfd17('0x28')](_0x5d5f44,_0xfd17('0x26'));_0x2791f7['query']=_[_0xfd17('0x2e')](_0x2d94be[_0xfd17('0x2f')]);_0x2791f7[_0xfd17('0x30')]=_[_0xfd17('0x31')](_0x2791f7[_0xfd17('0x2d')],_0x2791f7['query']);_0x5ebc68[_0xfd17('0x32')]=_[_0xfd17('0x31')](_0x2791f7[_0xfd17('0x2d')],qs[_0xfd17('0x33')](_0x2d94be[_0xfd17('0x2f')][_0xfd17('0x33')]));_0x5ebc68[_0xfd17('0x32')]=_0x5ebc68[_0xfd17('0x32')]['length']?_0x5ebc68[_0xfd17('0x32')]:_0x2791f7[_0xfd17('0x2d')];if(!_0x2d94be[_0xfd17('0x2f')][_0xfd17('0x34')](_0xfd17('0x35'))){_0x5ebc68[_0xfd17('0x1b')]=qs[_0xfd17('0x1b')](_0x2d94be[_0xfd17('0x2f')]['limit']);_0x5ebc68[_0xfd17('0x1c')]=qs[_0xfd17('0x1c')](_0x2d94be[_0xfd17('0x2f')][_0xfd17('0x1c')]);}_0x5ebc68[_0xfd17('0x36')]=qs[_0xfd17('0x37')](_0x2d94be['query'][_0xfd17('0x37')]);_0x5ebc68[_0xfd17('0x38')]=qs[_0xfd17('0x30')](_['pick'](_0x2d94be['query'],_0x2791f7[_0xfd17('0x30')]),_0x5d5f44);if(_0x2d94be[_0xfd17('0x2f')]['filter']){_0x5ebc68[_0xfd17('0x38')]=_[_0xfd17('0x39')](_0x5ebc68[_0xfd17('0x38')],{'$or':_[_0xfd17('0x28')](_0x5d5f44,function(_0x5e2bdf){if(_0x5e2bdf['type']!==_0xfd17('0x3a')){var _0x53a5cb={};_0x53a5cb[_0x5e2bdf[_0xfd17('0x26')]]={'$like':'%'+_0x2d94be[_0xfd17('0x2f')]['filter']+'%'};return _0x53a5cb;}})});}_0x5ebc68=_[_0xfd17('0x39')]({},_0x5ebc68,_0x2d94be[_0xfd17('0x3b')]);var _0x1826a2={'where':_0x5ebc68[_0xfd17('0x38')]};return db[_0xfd17('0x3c')]['count'](_0x1826a2)['then'](function(_0x344f0e){_0x72eb23[_0xfd17('0x1d')]=_0x344f0e;if(_0x2d94be[_0xfd17('0x2f')][_0xfd17('0x3d')]){_0x5ebc68[_0xfd17('0x3e')]=[{'all':!![]}];}return db[_0xfd17('0x3c')][_0xfd17('0x3f')](_0x5ebc68);})['then'](function(_0x1e2193){_0x72eb23['rows']=_0x1e2193;return _0x72eb23;})[_0xfd17('0x22')](respondWithFilteredResult(_0x583e7f,_0x5ebc68))[_0xfd17('0x40')](handleError(_0x583e7f,null));};exports[_0xfd17('0x41')]=function(_0x1e256e,_0x1bc9b9){var _0x2d48c2={'raw':!![],'where':{'id':_0x1e256e[_0xfd17('0x42')]['id']}},_0x5360f4={};_0x5360f4[_0xfd17('0x2d')]=_['keys'](db[_0xfd17('0x3c')][_0xfd17('0x29')]);_0x5360f4[_0xfd17('0x2f')]=_['keys'](_0x1e256e['query']);_0x5360f4[_0xfd17('0x30')]=_[_0xfd17('0x31')](_0x5360f4['model'],_0x5360f4[_0xfd17('0x2f')]);_0x2d48c2[_0xfd17('0x32')]=_[_0xfd17('0x31')](_0x5360f4['model'],qs[_0xfd17('0x33')](_0x1e256e[_0xfd17('0x2f')][_0xfd17('0x33')]));_0x2d48c2[_0xfd17('0x32')]=_0x2d48c2[_0xfd17('0x32')][_0xfd17('0x43')]?_0x2d48c2[_0xfd17('0x32')]:_0x5360f4[_0xfd17('0x2d')];if(_0x1e256e['query'][_0xfd17('0x3d')]){_0x2d48c2[_0xfd17('0x3e')]=[{'all':!![]}];}_0x2d48c2=_['merge']({},_0x2d48c2,_0x1e256e[_0xfd17('0x3b')]);return db[_0xfd17('0x3c')][_0xfd17('0x44')](_0x2d48c2)[_0xfd17('0x22')](handleEntityNotFound(_0x1bc9b9,null))[_0xfd17('0x22')](respondWithResult(_0x1bc9b9,null))[_0xfd17('0x40')](handleError(_0x1bc9b9,null));};exports[_0xfd17('0x45')]=function(_0xd1bf6d,_0x58f307){return db[_0xfd17('0x3c')][_0xfd17('0x45')](_0xd1bf6d[_0xfd17('0x46')],{})[_0xfd17('0x22')](respondWithResult(_0x58f307,0xc9))[_0xfd17('0x40')](handleError(_0x58f307,null));};exports[_0xfd17('0x21')]=function(_0x346dcc,_0x26f602){if(_0x346dcc[_0xfd17('0x46')]['id']){delete _0x346dcc[_0xfd17('0x46')]['id'];}return db[_0xfd17('0x3c')][_0xfd17('0x44')]({'where':{'id':_0x346dcc['params']['id']}})[_0xfd17('0x22')](handleEntityNotFound(_0x26f602,null))[_0xfd17('0x22')](saveUpdates(_0x346dcc['body'],null))[_0xfd17('0x22')](respondWithResult(_0x26f602,null))[_0xfd17('0x40')](handleError(_0x26f602,null));};exports[_0xfd17('0x23')]=function(_0x25dd8e,_0xd073a5){return db[_0xfd17('0x3c')][_0xfd17('0x44')]({'where':{'id':_0x25dd8e[_0xfd17('0x42')]['id']}})[_0xfd17('0x22')](handleEntityNotFound(_0xd073a5,null))[_0xfd17('0x22')](removeEntity(_0xd073a5,null))[_0xfd17('0x40')](handleError(_0xd073a5,null));}; \ No newline at end of file +var _0x6d0e=['Content-Range','json','apply','reject','save','then','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','create','body','destroy','find','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set'];(function(_0x435dee,_0x4f6f5c){var _0x156dc8=function(_0x1c7084){while(--_0x1c7084){_0x435dee['push'](_0x435dee['shift']());}};_0x156dc8(++_0x4f6f5c);}(_0x6d0e,0x1f2));var _0xe6d0=function(_0x15ca96,_0x549591){_0x15ca96=_0x15ca96-0x0;var _0x5c684f=_0x6d0e[_0x15ca96];return _0x5c684f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe6d0('0x0'));var jsonpatch=require(_0xe6d0('0x1'));var rp=require(_0xe6d0('0x2'));var moment=require(_0xe6d0('0x3'));var BPromise=require(_0xe6d0('0x4'));var Mustache=require(_0xe6d0('0x5'));var util=require(_0xe6d0('0x6'));var path=require(_0xe6d0('0x7'));var sox=require(_0xe6d0('0x8'));var csv=require(_0xe6d0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe6d0('0xa'));var squel=require(_0xe6d0('0xb'));var crypto=require(_0xe6d0('0xc'));var jsforce=require(_0xe6d0('0xd'));var deskjs=require(_0xe6d0('0xe'));var toCsv=require(_0xe6d0('0x9'));var querystring=require(_0xe6d0('0xf'));var Papa=require(_0xe6d0('0x10'));var Redis=require(_0xe6d0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe6d0('0x12'));var as=require(_0xe6d0('0x13'));var hardwareService=require(_0xe6d0('0x14'));var logger=require(_0xe6d0('0x15'))(_0xe6d0('0x16'));var utils=require(_0xe6d0('0x17'));var config=require(_0xe6d0('0x18'));var licenseUtil=require(_0xe6d0('0x19'));var db=require(_0xe6d0('0x1a'))['db'];function respondWithStatusCode(_0x5cdf59,_0x3afb68){_0x3afb68=_0x3afb68||0xcc;return function(_0x3bb7e8){if(_0x3bb7e8){return _0x5cdf59[_0xe6d0('0x1b')](_0x3afb68);}return _0x5cdf59[_0xe6d0('0x1c')](_0x3afb68)['end']();};}function respondWithResult(_0x43802f,_0x24a787){_0x24a787=_0x24a787||0xc8;return function(_0x4a8803){if(_0x4a8803){return _0x43802f['status'](_0x24a787)['json'](_0x4a8803);}};}function respondWithFilteredResult(_0x3227e7,_0x535fd8){return function(_0x58cdef){if(_0x58cdef){var _0x820c2f=typeof _0x535fd8['offset']===_0xe6d0('0x1d')&&typeof _0x535fd8[_0xe6d0('0x1e')]===_0xe6d0('0x1d');var _0x256bdd=_0x58cdef[_0xe6d0('0x1f')];var _0x1d3e17=_0x820c2f?0x0:_0x535fd8[_0xe6d0('0x20')];var _0x1d9ee2=_0x820c2f?_0x58cdef[_0xe6d0('0x1f')]:_0x535fd8[_0xe6d0('0x20')]+_0x535fd8[_0xe6d0('0x1e')];var _0x35a761;if(_0x1d9ee2>=_0x256bdd){_0x1d9ee2=_0x256bdd;_0x35a761=0xc8;}else{_0x35a761=0xce;}_0x3227e7[_0xe6d0('0x1c')](_0x35a761);return _0x3227e7[_0xe6d0('0x21')](_0xe6d0('0x22'),_0x1d3e17+'-'+_0x1d9ee2+'/'+_0x256bdd)[_0xe6d0('0x23')](_0x58cdef);}return null;};}function patchUpdates(_0x2b8172){return function(_0x54b8cf){try{jsonpatch[_0xe6d0('0x24')](_0x54b8cf,_0x2b8172,!![]);}catch(_0xa9a24b){return BPromise[_0xe6d0('0x25')](_0xa9a24b);}return _0x54b8cf[_0xe6d0('0x26')]();};}function saveUpdates(_0x163733,_0x55c97d){return function(_0x19477c){if(_0x19477c){return _0x19477c['update'](_0x163733)[_0xe6d0('0x27')](function(_0x3e6a95){return _0x3e6a95;});}return null;};}function removeEntity(_0x3da9da,_0x3809bb){return function(_0xac1ebc){if(_0xac1ebc){return _0xac1ebc['destroy']()[_0xe6d0('0x27')](function(){_0x3da9da['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x439fcf,_0x3a7dc4){return function(_0x4c25e3){if(!_0x4c25e3){_0x439fcf[_0xe6d0('0x1b')](0x194);}return _0x4c25e3;};}function handleError(_0x56ea66,_0x51e885){_0x51e885=_0x51e885||0x1f4;return function(_0x3dfce0){logger[_0xe6d0('0x28')](_0x3dfce0[_0xe6d0('0x29')]);if(_0x3dfce0['name']){delete _0x3dfce0[_0xe6d0('0x2a')];}_0x56ea66[_0xe6d0('0x1c')](_0x51e885)[_0xe6d0('0x2b')](_0x3dfce0);};}exports[_0xe6d0('0x2c')]=function(_0x28829c,_0x1a2056){var _0x200d84={},_0x20d867={},_0x1db858={'count':0x0,'rows':[]};var _0x2c00ea=_[_0xe6d0('0x2d')](db[_0xe6d0('0x2e')][_0xe6d0('0x2f')],function(_0x10d491){return{'name':_0x10d491[_0xe6d0('0x30')],'type':_0x10d491[_0xe6d0('0x31')]['key']};});_0x20d867[_0xe6d0('0x32')]=_[_0xe6d0('0x2d')](_0x2c00ea,'name');_0x20d867['query']=_[_0xe6d0('0x33')](_0x28829c[_0xe6d0('0x34')]);_0x20d867[_0xe6d0('0x35')]=_[_0xe6d0('0x36')](_0x20d867[_0xe6d0('0x32')],_0x20d867[_0xe6d0('0x34')]);_0x200d84[_0xe6d0('0x37')]=_[_0xe6d0('0x36')](_0x20d867['model'],qs[_0xe6d0('0x38')](_0x28829c[_0xe6d0('0x34')][_0xe6d0('0x38')]));_0x200d84[_0xe6d0('0x37')]=_0x200d84[_0xe6d0('0x37')][_0xe6d0('0x39')]?_0x200d84[_0xe6d0('0x37')]:_0x20d867[_0xe6d0('0x32')];if(!_0x28829c[_0xe6d0('0x34')][_0xe6d0('0x3a')](_0xe6d0('0x3b'))){_0x200d84[_0xe6d0('0x1e')]=qs[_0xe6d0('0x1e')](_0x28829c[_0xe6d0('0x34')][_0xe6d0('0x1e')]);_0x200d84['offset']=qs[_0xe6d0('0x20')](_0x28829c[_0xe6d0('0x34')][_0xe6d0('0x20')]);}_0x200d84['order']=qs[_0xe6d0('0x3c')](_0x28829c[_0xe6d0('0x34')][_0xe6d0('0x3c')]);_0x200d84[_0xe6d0('0x3d')]=qs[_0xe6d0('0x35')](_[_0xe6d0('0x3e')](_0x28829c[_0xe6d0('0x34')],_0x20d867[_0xe6d0('0x35')]),_0x2c00ea);if(_0x28829c[_0xe6d0('0x34')][_0xe6d0('0x3f')]){_0x200d84['where']=_[_0xe6d0('0x40')](_0x200d84['where'],{'$or':_[_0xe6d0('0x2d')](_0x2c00ea,function(_0x5c7e38){if(_0x5c7e38[_0xe6d0('0x31')]!==_0xe6d0('0x41')){var _0x369b29={};_0x369b29[_0x5c7e38[_0xe6d0('0x2a')]]={'$like':'%'+_0x28829c['query'][_0xe6d0('0x3f')]+'%'};return _0x369b29;}})});}_0x200d84=_[_0xe6d0('0x40')]({},_0x200d84,_0x28829c[_0xe6d0('0x42')]);var _0x152978={'where':_0x200d84[_0xe6d0('0x3d')]};return db[_0xe6d0('0x2e')][_0xe6d0('0x1f')](_0x152978)['then'](function(_0x29227c){_0x1db858[_0xe6d0('0x1f')]=_0x29227c;if(_0x28829c[_0xe6d0('0x34')][_0xe6d0('0x43')]){_0x200d84[_0xe6d0('0x44')]=[{'all':!![]}];}return db[_0xe6d0('0x2e')][_0xe6d0('0x45')](_0x200d84);})['then'](function(_0x555f7e){_0x1db858['rows']=_0x555f7e;return _0x1db858;})['then'](respondWithFilteredResult(_0x1a2056,_0x200d84))[_0xe6d0('0x46')](handleError(_0x1a2056,null));};exports['show']=function(_0x12f1ce,_0x52f5e4){var _0x17fc4f={'raw':!![],'where':{'id':_0x12f1ce[_0xe6d0('0x47')]['id']}},_0x4590a0={};_0x4590a0['model']=_[_0xe6d0('0x33')](db['OpenchannelApplication'][_0xe6d0('0x2f')]);_0x4590a0[_0xe6d0('0x34')]=_[_0xe6d0('0x33')](_0x12f1ce[_0xe6d0('0x34')]);_0x4590a0[_0xe6d0('0x35')]=_[_0xe6d0('0x36')](_0x4590a0[_0xe6d0('0x32')],_0x4590a0[_0xe6d0('0x34')]);_0x17fc4f[_0xe6d0('0x37')]=_[_0xe6d0('0x36')](_0x4590a0['model'],qs['fields'](_0x12f1ce['query'][_0xe6d0('0x38')]));_0x17fc4f[_0xe6d0('0x37')]=_0x17fc4f[_0xe6d0('0x37')][_0xe6d0('0x39')]?_0x17fc4f[_0xe6d0('0x37')]:_0x4590a0[_0xe6d0('0x32')];if(_0x12f1ce[_0xe6d0('0x34')][_0xe6d0('0x43')]){_0x17fc4f['include']=[{'all':!![]}];}_0x17fc4f=_['merge']({},_0x17fc4f,_0x12f1ce['options']);return db['OpenchannelApplication']['find'](_0x17fc4f)['then'](handleEntityNotFound(_0x52f5e4,null))[_0xe6d0('0x27')](respondWithResult(_0x52f5e4,null))[_0xe6d0('0x46')](handleError(_0x52f5e4,null));};exports[_0xe6d0('0x48')]=function(_0x17fe00,_0x4f7301){return db[_0xe6d0('0x2e')][_0xe6d0('0x48')](_0x17fe00[_0xe6d0('0x49')],{})[_0xe6d0('0x27')](respondWithResult(_0x4f7301,0xc9))[_0xe6d0('0x46')](handleError(_0x4f7301,null));};exports['update']=function(_0x511fd3,_0x551de8){if(_0x511fd3[_0xe6d0('0x49')]['id']){delete _0x511fd3['body']['id'];}return db[_0xe6d0('0x2e')]['find']({'where':{'id':_0x511fd3[_0xe6d0('0x47')]['id']}})[_0xe6d0('0x27')](handleEntityNotFound(_0x551de8,null))[_0xe6d0('0x27')](saveUpdates(_0x511fd3[_0xe6d0('0x49')],null))[_0xe6d0('0x27')](respondWithResult(_0x551de8,null))[_0xe6d0('0x46')](handleError(_0x551de8,null));};exports[_0xe6d0('0x4a')]=function(_0x44a8a6,_0x3a7a27){return db[_0xe6d0('0x2e')][_0xe6d0('0x4b')]({'where':{'id':_0x44a8a6[_0xe6d0('0x47')]['id']}})[_0xe6d0('0x27')](handleEntityNotFound(_0x3a7a27,null))[_0xe6d0('0x27')](removeEntity(_0x3a7a27,null))[_0xe6d0('0x46')](handleError(_0x3a7a27,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 2069d71..5630c61 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 _0x29c1=['api','moment','bluebird','request-promise','path','rimraf','./openchannelApplication.attributes','exports','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x29c1,0x16a));var _0x129c=function(_0x2cf880,_0x52fe8f){_0x2cf880=_0x2cf880-0x0;var _0x2508dd=_0x29c1[_0x2cf880];return _0x2508dd;};'use strict';var _=require('lodash');var util=require(_0x129c('0x0'));var logger=require(_0x129c('0x1'))(_0x129c('0x2'));var moment=require(_0x129c('0x3'));var BPromise=require(_0x129c('0x4'));var rp=require(_0x129c('0x5'));var fs=require('fs');var path=require(_0x129c('0x6'));var rimraf=require(_0x129c('0x7'));var config=require('../../config/environment');var attributes=require(_0x129c('0x8'));module[_0x129c('0x9')]=function(_0xcf49ab,_0x213d0d){return _0xcf49ab[_0x129c('0xa')]('OpenchannelApplication',attributes,{'tableName':_0x129c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x129c('0xc'),'collate':_0x129c('0xd')});}; \ No newline at end of file +var _0x5179=['bluebird','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','lodash','../../config/logger','api'];(function(_0x2dee27,_0x58a14e){var _0x24c440=function(_0x4352b3){while(--_0x4352b3){_0x2dee27['push'](_0x2dee27['shift']());}};_0x24c440(++_0x58a14e);}(_0x5179,0xcf));var _0x9517=function(_0x2cc594,_0x4d727b){_0x2cc594=_0x2cc594-0x0;var _0x4abff7=_0x5179[_0x2cc594];return _0x4abff7;};'use strict';var _=require(_0x9517('0x0'));var util=require('util');var logger=require(_0x9517('0x1'))(_0x9517('0x2'));var moment=require('moment');var BPromise=require(_0x9517('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9517('0x4'));var attributes=require(_0x9517('0x5'));module[_0x9517('0x6')]=function(_0x541c7e,_0x5d84d2){return _0x541c7e[_0x9517('0x7')](_0x9517('0x8'),attributes,{'tableName':_0x9517('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','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 cb9153d..0bc6294 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 _0xf832=['jayson/promise','client','http','request','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5e238b,_0x17ae49){var _0x389bea=function(_0x3cc1c1){while(--_0x3cc1c1){_0x5e238b['push'](_0x5e238b['shift']());}};_0x389bea(++_0x17ae49);}(_0xf832,0x1d6));var _0x2f83=function(_0x478235,_0x410c47){_0x478235=_0x478235-0x0;var _0x157c2b=_0xf832[_0x478235];return _0x157c2b;};'use strict';var _=require(_0x2f83('0x0'));var util=require(_0x2f83('0x1'));var moment=require(_0x2f83('0x2'));var BPromise=require(_0x2f83('0x3'));var rs=require(_0x2f83('0x4'));var fs=require('fs');var Redis=require(_0x2f83('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2f83('0x6'));var logger=require(_0x2f83('0x7'))(_0x2f83('0x8'));var config=require(_0x2f83('0x9'));var jayson=require(_0x2f83('0xa'));var client=jayson[_0x2f83('0xb')][_0x2f83('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5d3dfe,_0x22dbd6,_0x1dd09c){return new BPromise(function(_0x125d09,_0x1c70b9){return client[_0x2f83('0xd')](_0x5d3dfe,_0x1dd09c)[_0x2f83('0xe')](function(_0x46d7e4){logger['info'](_0x2f83('0xf'),_0x22dbd6,_0x2f83('0x10'));logger[_0x2f83('0x11')](_0x2f83('0x12'),_0x22dbd6,_0x2f83('0x10'),JSON[_0x2f83('0x13')](_0x46d7e4));if(_0x46d7e4[_0x2f83('0x14')]){if(_0x46d7e4['error']['code']===0x1f4){logger['error'](_0x2f83('0xf'),_0x22dbd6,_0x46d7e4[_0x2f83('0x14')][_0x2f83('0x15')]);return _0x1c70b9(_0x46d7e4[_0x2f83('0x14')][_0x2f83('0x15')]);}logger[_0x2f83('0x14')](_0x2f83('0xf'),_0x22dbd6,_0x46d7e4[_0x2f83('0x14')][_0x2f83('0x15')]);return _0x125d09(_0x46d7e4[_0x2f83('0x14')][_0x2f83('0x15')]);}else{logger['info'](_0x2f83('0xf'),_0x22dbd6,_0x2f83('0x10'));_0x125d09(_0x46d7e4['result'][_0x2f83('0x15')]);}})[_0x2f83('0x16')](function(_0xcc56aa){logger[_0x2f83('0x14')](_0x2f83('0xf'),_0x22dbd6,_0xcc56aa);_0x1c70b9(_0xcc56aa);});});}exports[_0x2f83('0x17')]=function(_0xf5aa2b){var _0x3d5314=this;return new Promise(function(_0xba1cd7,_0x348530){return db[_0x2f83('0x18')][_0x2f83('0x19')](_0xf5aa2b[_0x2f83('0x1a')],{'raw':_0xf5aa2b[_0x2f83('0x1b')]?_0xf5aa2b[_0x2f83('0x1b')][_0x2f83('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf5aa2b[_0x2f83('0x1b')]?_0xf5aa2b[_0x2f83('0x1b')][_0x2f83('0x1d')]||null:null,'attributes':_0xf5aa2b[_0x2f83('0x1b')]?_0xf5aa2b[_0x2f83('0x1b')][_0x2f83('0x1e')]||null:null,'limit':_0xf5aa2b['options']?_0xf5aa2b[_0x2f83('0x1b')][_0x2f83('0x1f')]||null:null})['then'](function(_0x4aedbe){logger['info'](_0x2f83('0x17'),_0xf5aa2b);logger['debug'](_0x2f83('0x17'),_0xf5aa2b,JSON[_0x2f83('0x13')](_0x4aedbe));_0xba1cd7(_0x4aedbe);})[_0x2f83('0x16')](function(_0x5da8bf){logger[_0x2f83('0x14')](_0x2f83('0x17'),_0x5da8bf[_0x2f83('0x15')],_0xf5aa2b);_0x348530(_0x3d5314[_0x2f83('0x14')](0x1f4,_0x5da8bf[_0x2f83('0x15')]));});});}; \ No newline at end of file +var _0x2aaf=['OpenchannelApplication','update','body','options','raw','limit','debug','stringify','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','code','OpenchannelApplication,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelApplication'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x2aaf,0x168));var _0xf2aa=function(_0x33eabc,_0x4fc950){_0x33eabc=_0x33eabc-0x0;var _0x15cddc=_0x2aaf[_0x33eabc];return _0x15cddc;};'use strict';var _=require(_0xf2aa('0x0'));var util=require(_0xf2aa('0x1'));var moment=require('moment');var BPromise=require(_0xf2aa('0x2'));var rs=require(_0xf2aa('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf2aa('0x4'))['db'];var utils=require(_0xf2aa('0x5'));var logger=require(_0xf2aa('0x6'))(_0xf2aa('0x7'));var config=require(_0xf2aa('0x8'));var jayson=require(_0xf2aa('0x9'));var client=jayson[_0xf2aa('0xa')][_0xf2aa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1700bd,_0x321437,_0x1482bf){return new BPromise(function(_0x3ad8d0,_0x45832a){return client[_0xf2aa('0xc')](_0x1700bd,_0x1482bf)[_0xf2aa('0xd')](function(_0x332923){logger[_0xf2aa('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0x321437,_0xf2aa('0xf'));logger['debug'](_0xf2aa('0x10'),_0x321437,'request\x20sent',JSON['stringify'](_0x332923));if(_0x332923[_0xf2aa('0x11')]){if(_0x332923[_0xf2aa('0x11')][_0xf2aa('0x12')]===0x1f4){logger[_0xf2aa('0x11')](_0xf2aa('0x13'),_0x321437,_0x332923[_0xf2aa('0x11')]['message']);return _0x45832a(_0x332923['error'][_0xf2aa('0x14')]);}logger[_0xf2aa('0x11')](_0xf2aa('0x13'),_0x321437,_0x332923['error'][_0xf2aa('0x14')]);return _0x3ad8d0(_0x332923['error'][_0xf2aa('0x14')]);}else{logger['info'](_0xf2aa('0x13'),_0x321437,'request\x20sent');_0x3ad8d0(_0x332923[_0xf2aa('0x15')][_0xf2aa('0x14')]);}})[_0xf2aa('0x16')](function(_0x184b27){logger[_0xf2aa('0x11')](_0xf2aa('0x13'),_0x321437,_0x184b27);_0x45832a(_0x184b27);});});}exports[_0xf2aa('0x17')]=function(_0xe56a28){var _0x1cee4b=this;return new Promise(function(_0x90d401,_0x34837a){return db[_0xf2aa('0x18')][_0xf2aa('0x19')](_0xe56a28[_0xf2aa('0x1a')],{'raw':_0xe56a28[_0xf2aa('0x1b')]?_0xe56a28['options'][_0xf2aa('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe56a28[_0xf2aa('0x1b')]?_0xe56a28[_0xf2aa('0x1b')]['where']||null:null,'attributes':_0xe56a28['options']?_0xe56a28[_0xf2aa('0x1b')]['attributes']||null:null,'limit':_0xe56a28['options']?_0xe56a28[_0xf2aa('0x1b')][_0xf2aa('0x1d')]||null:null})[_0xf2aa('0xd')](function(_0x5bedd7){logger[_0xf2aa('0xe')]('UpdateOpenchannelApplication',_0xe56a28);logger[_0xf2aa('0x1e')]('UpdateOpenchannelApplication',_0xe56a28,JSON[_0xf2aa('0x1f')](_0x5bedd7));_0x90d401(_0x5bedd7);})[_0xf2aa('0x16')](function(_0x519fac){logger[_0xf2aa('0x11')](_0xf2aa('0x17'),_0x519fac[_0xf2aa('0x14')],_0xe56a28);_0x34837a(_0x1cee4b[_0xf2aa('0x11')](0x1f4,_0x519fac[_0xf2aa('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index b204dbd..e509932 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 _0x2569=['addTags','put','openchannelinteraction:update','update','delete','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags'];(function(_0x170288,_0x5e23ea){var _0x451745=function(_0x5757bd){while(--_0x5757bd){_0x170288['push'](_0x170288['shift']());}};_0x451745(++_0x5e23ea);}(_0x2569,0x6a));var _0x9256=function(_0x5eaa6a,_0x41d4f9){_0x5eaa6a=_0x5eaa6a-0x0;var _0x332a98=_0x2569[_0x5eaa6a];return _0x332a98;};'use strict';var multer=require(_0x9256('0x0'));var util=require(_0x9256('0x1'));var path=require(_0x9256('0x2'));var timeout=require(_0x9256('0x3'));var express=require(_0x9256('0x4'));var router=express['Router']();var fs_extra=require(_0x9256('0x5'));var auth=require(_0x9256('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9256('0x7'));var controller=require('./openchannelInteraction.controller');router[_0x9256('0x8')]('/',auth[_0x9256('0x9')](),controller[_0x9256('0xa')]);router[_0x9256('0x8')](_0x9256('0xb'),auth[_0x9256('0x9')](),controller[_0x9256('0xc')]);router['get'](_0x9256('0xd'),auth[_0x9256('0x9')](),controller[_0x9256('0xe')]);router['get'](_0x9256('0xf'),auth[_0x9256('0x9')](),controller[_0x9256('0x10')]);router['get'](_0x9256('0x11'),auth[_0x9256('0x9')](),controller[_0x9256('0x12')]);router['post']('/',auth[_0x9256('0x9')](),controller[_0x9256('0x13')]);router[_0x9256('0x14')]('/:id/messages',auth['isAuthenticated'](),controller[_0x9256('0x15')]);router['post'](_0x9256('0x16'),auth[_0x9256('0x9')](),interaction[_0x9256('0x17')](_0x9256('0x18'),_0x9256('0x19')),controller[_0x9256('0x1a')]);router[_0x9256('0x1b')](_0x9256('0xd'),auth['isAuthenticated'](),interaction[_0x9256('0x17')]('openchannel',_0x9256('0x1c')),controller[_0x9256('0x1d')]);router[_0x9256('0x1e')]('/:id',auth[_0x9256('0x9')](),interaction[_0x9256('0x17')](_0x9256('0x18'),'openchannelinteraction:destroy'),controller['destroy']);router[_0x9256('0x1e')](_0x9256('0x16'),auth[_0x9256('0x9')](),controller[_0x9256('0x1f')]);module[_0x9256('0x20')]=router; \ No newline at end of file +var _0x2bd9=['show','/:id/messages','/:id/download','download','post','create','addMessage','tracked','openchannel','openchannelinteraction:addtags','addTags','/:id','openchannelinteraction:update','update','openchannelinteraction:destroy','delete','/:id/tags','removeTags','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','get','/describe'];(function(_0x345181,_0x3d928a){var _0x2ccb5c=function(_0x1c68f7){while(--_0x1c68f7){_0x345181['push'](_0x345181['shift']());}};_0x2ccb5c(++_0x3d928a);}(_0x2bd9,0x15c));var _0x92bd=function(_0x3bed3b,_0x18b1de){_0x3bed3b=_0x3bed3b-0x0;var _0x309570=_0x2bd9[_0x3bed3b];return _0x309570;};'use strict';var multer=require('multer');var util=require(_0x92bd('0x0'));var path=require('path');var timeout=require(_0x92bd('0x1'));var express=require(_0x92bd('0x2'));var router=express[_0x92bd('0x3')]();var fs_extra=require(_0x92bd('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x92bd('0x5'));var config=require(_0x92bd('0x6'));var controller=require(_0x92bd('0x7'));router['get']('/',auth[_0x92bd('0x8')](),controller[_0x92bd('0x9')]);router[_0x92bd('0xa')](_0x92bd('0xb'),auth[_0x92bd('0x8')](),controller['describe']);router[_0x92bd('0xa')]('/:id',auth[_0x92bd('0x8')](),controller[_0x92bd('0xc')]);router[_0x92bd('0xa')](_0x92bd('0xd'),auth[_0x92bd('0x8')](),controller['getMessages']);router[_0x92bd('0xa')](_0x92bd('0xe'),auth[_0x92bd('0x8')](),controller[_0x92bd('0xf')]);router[_0x92bd('0x10')]('/',auth[_0x92bd('0x8')](),controller[_0x92bd('0x11')]);router[_0x92bd('0x10')](_0x92bd('0xd'),auth[_0x92bd('0x8')](),controller[_0x92bd('0x12')]);router[_0x92bd('0x10')]('/:id/tags',auth[_0x92bd('0x8')](),interaction[_0x92bd('0x13')](_0x92bd('0x14'),_0x92bd('0x15')),controller[_0x92bd('0x16')]);router['put'](_0x92bd('0x17'),auth['isAuthenticated'](),interaction['tracked'](_0x92bd('0x14'),_0x92bd('0x18')),controller[_0x92bd('0x19')]);router['delete'](_0x92bd('0x17'),auth['isAuthenticated'](),interaction[_0x92bd('0x13')](_0x92bd('0x14'),_0x92bd('0x1a')),controller['destroy']);router[_0x92bd('0x1b')](_0x92bd('0x1c'),auth[_0x92bd('0x8')](),controller[_0x92bd('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 5b96d11..6738bb9 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 _0xc300=['sequelize','exports','STRING','DATE','ENUM','out'];(function(_0x349699,_0x58ebd8){var _0xa233ec=function(_0x5cc682){while(--_0x5cc682){_0x349699['push'](_0x349699['shift']());}};_0xa233ec(++_0x58ebd8);}(_0xc300,0x132));var _0x0c30=function(_0x1ae493,_0x5b27e2){_0x1ae493=_0x1ae493-0x0;var _0xcb6559=_0xc300[_0x1ae493];return _0xcb6559;};'use strict';var Sequelize=require(_0x0c30('0x0'));module[_0x0c30('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x0c30('0x2')]},'secondDisposition':{'type':Sequelize[_0x0c30('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0c30('0x2')]},'read1stAt':{'type':Sequelize[_0x0c30('0x3')]},'threadId':{'type':Sequelize[_0x0c30('0x2')]},'externalUrl':{'type':Sequelize[_0x0c30('0x2')]},'lastMsgAt':{'type':Sequelize[_0x0c30('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x0c30('0x4')]('in',_0x0c30('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x0c30('0x2')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xafa5=['out','exports','BOOLEAN','DATE','STRING'];(function(_0x4fa2da,_0x8ab535){var _0xd6958a=function(_0x30477f){while(--_0x30477f){_0x4fa2da['push'](_0x4fa2da['shift']());}};_0xd6958a(++_0x8ab535);}(_0xafa5,0x1af));var _0x5afa=function(_0xac5327,_0x5c9565){_0xac5327=_0xac5327-0x0;var _0x32d9eb=_0xafa5[_0xac5327];return _0x32d9eb;};'use strict';var Sequelize=require('sequelize');module[_0x5afa('0x0')]={'closed':{'type':Sequelize[_0x5afa('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5afa('0x2')]},'disposition':{'type':Sequelize[_0x5afa('0x3')]},'secondDisposition':{'type':Sequelize[_0x5afa('0x3')]},'thirdDisposition':{'type':Sequelize[_0x5afa('0x3')]},'note':{'type':Sequelize[_0x5afa('0x3')]},'read1stAt':{'type':Sequelize[_0x5afa('0x2')]},'threadId':{'type':Sequelize[_0x5afa('0x3')]},'externalUrl':{'type':Sequelize[_0x5afa('0x3')]},'lastMsgAt':{'type':Sequelize[_0x5afa('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x5afa('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x5afa('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x5afa('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 2022063..1af4487 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 _0x17f4=['CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','ui.OpenchannelInteractionId\x20IN\x20?','OpenchannelInteractionId','all','params','includeAll','options','catch','create','body','destroy','describe','addMessage','ids','omit','getMessages','rawAttributes','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','OpenchannelMessage','rows','addTags','setTags','findAll','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','tmp','files','CmContact','firstName','lastName','attachments','Attachment','Messages','direction','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','closedAt','disposition','threadId','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','System','out','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','fs-extra','lodash','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelInteraction.socket','register','sendStatus','end','json','offset','undefined','limit','status','set','Content-Range','apply','save','update','name','send','fullname','TagIds','split','forEach','Tags','push','then','waiting','talking','answered','total','closed','UserId','unmanaged','index','map','OpenchannelInteraction','fieldName','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','from','user_has_openchannel_interactions','left_join','users','openchannel_interactions','cm_contacts','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','length','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','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','buildExpression','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?'];(function(_0x57532c,_0x2c75cf){var _0x5cb9a6=function(_0x3a4dea){while(--_0x3a4dea){_0x57532c['push'](_0x57532c['shift']());}};_0x5cb9a6(++_0x2c75cf);}(_0x17f4,0x15f));var _0x417f=function(_0x16e690,_0x5d4683){_0x16e690=_0x16e690-0x0;var _0x3beb56=_0x17f4[_0x16e690];return _0x3beb56;};'use strict';var emlformat=require(_0x417f('0x0'));var rimraf=require(_0x417f('0x1'));var zipdir=require(_0x417f('0x2'));var jsonpatch=require(_0x417f('0x3'));var rp=require(_0x417f('0x4'));var moment=require('moment');var BPromise=require(_0x417f('0x5'));var Mustache=require(_0x417f('0x6'));var util=require('util');var path=require(_0x417f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x417f('0x8'));var _=require(_0x417f('0x9'));var squel=require('squel');var crypto=require(_0x417f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x417f('0xb'));var toCsv=require(_0x417f('0xc'));var querystring=require(_0x417f('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x417f('0xe'));var qs=require(_0x417f('0xf'));var as=require(_0x417f('0x10'));var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x417f('0x11'));var utils=require(_0x417f('0x12'));var config=require(_0x417f('0x13'));var licenseUtil=require(_0x417f('0x14'));var db=require(_0x417f('0x15'))['db'];config[_0x417f('0x16')]=_[_0x417f('0x17')](config[_0x417f('0x16')],{'host':_0x417f('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x417f('0x16')]));require(_0x417f('0x19'))[_0x417f('0x1a')](socket);function respondWithStatusCode(_0x592455,_0x2fdce3){_0x2fdce3=_0x2fdce3||0xcc;return function(_0x256533){if(_0x256533){return _0x592455[_0x417f('0x1b')](_0x2fdce3);}return _0x592455['status'](_0x2fdce3)[_0x417f('0x1c')]();};}function respondWithResult(_0x1d3b2f,_0x3419b4){_0x3419b4=_0x3419b4||0xc8;return function(_0x49c1a7){if(_0x49c1a7){return _0x1d3b2f['status'](_0x3419b4)[_0x417f('0x1d')](_0x49c1a7);}};}function respondWithFilteredResult(_0x41b1db,_0xc6dbbf){return function(_0x20f46e){if(_0x20f46e){var _0x205c99=typeof _0xc6dbbf[_0x417f('0x1e')]===_0x417f('0x1f')&&typeof _0xc6dbbf[_0x417f('0x20')]===_0x417f('0x1f');var _0x102f2c=_0x20f46e['count'];var _0x23252c=_0x205c99?0x0:_0xc6dbbf[_0x417f('0x1e')];var _0x5990b4=_0x205c99?_0x20f46e['count']:_0xc6dbbf['offset']+_0xc6dbbf[_0x417f('0x20')];var _0xc42fe;if(_0x5990b4>=_0x102f2c){_0x5990b4=_0x102f2c;_0xc42fe=0xc8;}else{_0xc42fe=0xce;}_0x41b1db[_0x417f('0x21')](_0xc42fe);return _0x41b1db[_0x417f('0x22')](_0x417f('0x23'),_0x23252c+'-'+_0x5990b4+'/'+_0x102f2c)['json'](_0x20f46e);}return null;};}function patchUpdates(_0x2abce8){return function(_0x398197){try{jsonpatch[_0x417f('0x24')](_0x398197,_0x2abce8,!![]);}catch(_0x2c736a){return BPromise['reject'](_0x2c736a);}return _0x398197[_0x417f('0x25')]();};}function saveUpdates(_0x320355,_0x5c6b5e){return function(_0x92fd39){if(_0x92fd39){return _0x92fd39[_0x417f('0x26')](_0x320355)['then'](function(_0x4b9766){return _0x4b9766;});}return null;};}function removeEntity(_0x5afa57,_0x10a4f1){return function(_0x4547ae){if(_0x4547ae){return _0x4547ae['destroy']()['then'](function(){_0x5afa57[_0x417f('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8d17fc,_0x3d2553){return function(_0xb204eb){if(!_0xb204eb){_0x8d17fc['sendStatus'](0x194);}return _0xb204eb;};}function handleError(_0x2afe4b,_0x2219ec){_0x2219ec=_0x2219ec||0x1f4;return function(_0x5aef97){logger['error'](_0x5aef97['stack']);if(_0x5aef97[_0x417f('0x27')]){delete _0x5aef97[_0x417f('0x27')];}_0x2afe4b[_0x417f('0x21')](_0x2219ec)[_0x417f('0x28')](_0x5aef97);};}function getInteractionUsers(_0x4f532c,_0x14a38d){return new BPromise(function(_0xcc3c80,_0x4b8fe3){try{if(_0x14a38d[_0x4f532c['id']]){_0x4f532c['Users']=_['map'](_0x14a38d[_0x4f532c['id']],function(_0x32c5a9){return{'id':_0x32c5a9['id'],'fullname':_0x32c5a9[_0x417f('0x29')]};});}}catch(_0x261a58){_0x4b8fe3(_0x261a58);}_0xcc3c80(_0x4f532c);});}function getInteractionTags(_0x32d55b,_0x4b1792){return new BPromise(function(_0x156314,_0x5c818b){try{if(_0x32d55b[_0x417f('0x2a')]){_0x32d55b['Tags']=[];_0x32d55b['TagIds'][_0x417f('0x2b')](',')[_0x417f('0x2c')](function(_0x558249){_0x32d55b[_0x417f('0x2d')][_0x417f('0x2e')](_0x4b1792[_0x558249]);});}delete _0x32d55b[_0x417f('0x2a')];}catch(_0x1dac4c){_0x5c818b(_0x1dac4c);}_0x156314(_0x32d55b);});}function updateOpenchannelInteraction(_0x227b43,_0x1d272d,_0x5eff08){return new BPromise(function(_0x1cd4de,_0x2b2b4c){return getInteractionUsers(_0x227b43,_0x5eff08)[_0x417f('0x2f')](function(_0x4ead5e){return getInteractionTags(_0x4ead5e,_0x1d272d);})[_0x417f('0x2f')](function(_0x37ab04){return getStateInteraction(_0x37ab04);})['then'](function(_0x55a839){_0x1cd4de(_0x55a839);})['catch'](function(_0x18580c){_0x2b2b4c(_0x18580c);});});}function getStateInteraction(_0x566161){return new BPromise(function(_0x530127){_0x566161[_0x417f('0x30')]=0x0;_0x566161[_0x417f('0x31')]=0x0;_0x566161[_0x417f('0x32')]=0x0;_0x566161['unmanaged']=0x0;_0x566161[_0x417f('0x33')]=0x0;if(!_0x566161[_0x417f('0x34')]&&!_0x566161['UserId']){_0x566161[_0x417f('0x30')]+=0x1;}if(!_0x566161[_0x417f('0x34')]&&_0x566161[_0x417f('0x35')]){_0x566161['talking']+=0x1;if(_0x566161['waiting']){_0x566161['waiting']-=0x1;}}if(_0x566161[_0x417f('0x34')]&&_0x566161['UserId']){_0x566161[_0x417f('0x32')]+=0x1;if(_0x566161['talking']){_0x566161[_0x417f('0x31')]-=0x1;}}if(_0x566161[_0x417f('0x34')]&&!_0x566161[_0x417f('0x35')]){_0x566161[_0x417f('0x36')]+=0x1;if(_0x566161[_0x417f('0x30')]){_0x566161[_0x417f('0x30')]-=0x1;}}_0x566161[_0x417f('0x33')]+=0x1;_0x530127(_0x566161);});}exports[_0x417f('0x37')]=function(_0x3f8907,_0xa5ef2f){var _0x46dd94={},_0x2cc5cf={},_0xf28d99={'count':0x0,'rows':[]};var _0xfd0172=_[_0x417f('0x38')](db[_0x417f('0x39')]['rawAttributes'],function(_0x347b89){return{'name':_0x347b89[_0x417f('0x3a')],'type':_0x347b89['type'][_0x417f('0x3b')]};});_0x2cc5cf[_0x417f('0x3c')]=_[_0x417f('0x38')](_0xfd0172,_0x417f('0x27'));_0x2cc5cf[_0x417f('0x3d')]=_[_0x417f('0x3e')](_0x3f8907[_0x417f('0x3d')]);_0x2cc5cf[_0x417f('0x3f')]=_['intersection'](_0x2cc5cf[_0x417f('0x3c')],_0x2cc5cf[_0x417f('0x3d')]);_0x46dd94['attributes']=_[_0x417f('0x40')](_0x2cc5cf[_0x417f('0x3c')],qs[_0x417f('0x41')](_0x3f8907[_0x417f('0x3d')][_0x417f('0x41')]));_0x46dd94[_0x417f('0x42')]=_0x46dd94[_0x417f('0x42')]['length']?_0x46dd94[_0x417f('0x42')]:_0x2cc5cf[_0x417f('0x3c')];if(!_0x3f8907[_0x417f('0x3d')]['hasOwnProperty'](_0x417f('0x43'))){_0x46dd94[_0x417f('0x20')]=qs['limit'](_0x3f8907[_0x417f('0x3d')]['limit']);_0x46dd94[_0x417f('0x1e')]=qs['offset'](_0x3f8907[_0x417f('0x3d')][_0x417f('0x1e')]);}_0x46dd94[_0x417f('0x44')]=qs[_0x417f('0x45')](_0x3f8907['query']['sort']);_0x46dd94[_0x417f('0x46')]=qs['filters'](_[_0x417f('0x47')](_0x3f8907[_0x417f('0x3d')],_0x2cc5cf['filters']),_0xfd0172);var _0x2e15a6=[];var _0x119886=squel[_0x417f('0x48')]()['field']('id')[_0x417f('0x49')]('name')['field'](_0x417f('0x4a'))['from'](_0x417f('0x4b'));var _0x59abaa=squel[_0x417f('0x48')]()[_0x417f('0x49')](_0x417f('0x4c'))[_0x417f('0x49')](_0x417f('0x4d'))[_0x417f('0x49')](_0x417f('0x4e'))[_0x417f('0x4f')](_0x417f('0x50'),'ui')[_0x417f('0x51')](_0x417f('0x52'),'u','u.id\x20=\x20ui.UserId');var _0x2d2171=squel[_0x417f('0x48')]()['from'](_0x417f('0x53'),'i')[_0x417f('0x51')](_0x417f('0x54'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x417f('0x52'),'o','o.id\x20=\x20i.UserId')[_0x417f('0x51')](_0x417f('0x55'),'a',_0x417f('0x56'))[_0x417f('0x51')]('openchannel_messages','me',_0x417f('0x57'))[_0x417f('0x51')]('openchannel_interaction_has_tags','it',_0x417f('0x58'))[_0x417f('0x51')](_0x417f('0x4b'),'t',_0x417f('0x59'));var _0xfcd67b=squel[_0x417f('0x5a')]();var _0x29d7e1=[];var _0x228df1=squel['expr']();var _0x13395d;if(_0x3f8907[_0x417f('0x3d')]['search']){_0x13395d=as[_0x417f('0x5b')](_0x3f8907['query'][_0x417f('0x5c')]);var _0x2751fd=_0x13395d['sqlOperator'];for(var _0x2b4bf7=0x0;_0x2b4bf7<_0x13395d[_0x417f('0x5d')][_0x417f('0x5e')];_0x2b4bf7++){var _0x50d3d8=_0x13395d[_0x417f('0x5d')][_0x2b4bf7];var _0x1cc2cc='i';var _0x210826=_['find'](_0xfd0172,['name',_0x50d3d8[_0x417f('0x49')]]);if(!_0x210826){switch(_0x50d3d8[_0x417f('0x49')]){case _0x417f('0x5f'):if(_0x50d3d8[_0x417f('0x60')]==0x1){_0x2d2171['having']('`'+_0x50d3d8['field']+_0x417f('0x61'));}else{_0x2d2171[_0x417f('0x62')]('`'+_0x50d3d8[_0x417f('0x49')]+_0x417f('0x63'));}break;case _0x417f('0x64'):if(_0x50d3d8[_0x417f('0x65')]===_0x417f('0x66')){if(_0x50d3d8[_0x417f('0x60')][_0x417f('0x2b')]('\x20')[_0x417f('0x5e')]>0x1){_0xfcd67b[_0x2751fd](_0x417f('0x67'),qs[_0x417f('0x68')](_0x50d3d8[_0x417f('0x60')]),null);}else{var _0x32f73e='%'+_0x50d3d8[_0x417f('0x60')]+'%';_0xfcd67b[_0x2751fd](_0x417f('0x69'),_0x32f73e,_0x32f73e,_0x32f73e);}}else{_0x210826=_[_0x417f('0x6a')](_0xfd0172,[_0x417f('0x27'),_0x417f('0x6b')]);_0x50d3d8['field']=_0x417f('0x6b');_0x30bc95=as['buildExpression'](_0x1cc2cc,_0x210826[_0x417f('0x6c')],_0x50d3d8);_0xfcd67b[_0x2751fd](_0x30bc95[_0x417f('0x6d')],_0x30bc95['value'][_0x417f('0x6e')],_0x30bc95[_0x417f('0x60')][_0x417f('0x1c')]);}break;case _0x417f('0x6f'):var _0x2d32c7=_0x50d3d8[_0x417f('0x60')][_0x417f('0x2b')](',')['map'](function(_0x38fba2){return Number(_0x38fba2);});_0x2d32c7[_0x417f('0x2c')](function(_0x231ead){_0x228df1['or'](_0x417f('0x70'),'%,'+_0x231ead+',%');});_0x29d7e1=_['union'](_0x29d7e1,_0x2d32c7);break;case _0x417f('0x71'):if(_0x50d3d8[_0x417f('0x65')]==='$substring'){_0xfcd67b[_0x2751fd]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x50d3d8['value']+'%',null);}else{_0x210826=_[_0x417f('0x6a')](_0xfd0172,[_0x417f('0x27'),_0x417f('0x35')]);_0x50d3d8[_0x417f('0x49')]='UserId';_0x30bc95=as[_0x417f('0x72')](_0x1cc2cc,_0x210826[_0x417f('0x6c')],_0x50d3d8);_0xfcd67b[_0x2751fd](_0x30bc95['text'],_0x30bc95['value'][_0x417f('0x6e')],_0x30bc95['value']['end']);}break;case'body':_0x30bc95=as[_0x417f('0x72')]('me',null,_0x50d3d8);_0xfcd67b[_0x2751fd](_0x30bc95['text'],_0x30bc95[_0x417f('0x60')][_0x417f('0x6e')],_0x30bc95[_0x417f('0x60')]['end']);break;}}else{var _0x30bc95=as['buildExpression'](_0x1cc2cc,_0x210826[_0x417f('0x6c')],_0x50d3d8);_0xfcd67b[_0x2751fd](_0x30bc95[_0x417f('0x6d')],_0x30bc95[_0x417f('0x60')]['start'],_0x30bc95[_0x417f('0x60')][_0x417f('0x1c')]);}}}else{var _0xf78600=_(_0x3f8907['query'])[_0x417f('0x3e')]()[_0x417f('0x38')](function(_0x3801c3){return _['some'](_0xfd0172,[_0x417f('0x27'),_0x3801c3])?_0x3801c3:undefined;})['compact']()[_0x417f('0x60')]();if(!_[_0x417f('0x73')](_0xf78600)){_0xf78600[_0x417f('0x2c')](function(_0x470219){if(_0x470219===_0x417f('0x74')){_0x2d2171[_0x417f('0x46')](_0x417f('0x75'),[][_0x417f('0x76')](_0x3f8907[_0x417f('0x3d')][_0x470219]));}else if(_0x470219===_0x417f('0x77')){var _0x3ed249=JSON[_0x417f('0x78')](_0x3f8907[_0x417f('0x3d')][_0x470219])[_0x417f('0x79')];var _0x23d207=JSON[_0x417f('0x78')](_0x3f8907['query'][_0x470219])['$lte'];_0x2d2171[_0x417f('0x46')](_0x417f('0x7a'),_0x3ed249,_0x23d207);}else{if(_0x3f8907[_0x417f('0x3d')][_0x470219]===_0x417f('0x7b')){_0x2d2171['where']('i.'+_0x470219+_0x417f('0x7c'));}else{_0x2d2171[_0x417f('0x46')]('i.'+_0x470219+'\x20=\x20?',_0x3f8907['query'][_0x470219]);}}});}if(_0x3f8907[_0x417f('0x3d')][_0x417f('0x7d')]){if(_0x3f8907[_0x417f('0x3d')][_0x417f('0x7d')]==0x1){_0x2d2171[_0x417f('0x62')](_0x417f('0x7e'));}else{_0x2d2171['having'](_0x417f('0x7f'));}}if(_0x3f8907[_0x417f('0x3d')][_0x417f('0x80')]){_0x29d7e1=_[_0x417f('0x81')](_0x3f8907[_0x417f('0x3d')]['tag'])?_0x3f8907[_0x417f('0x3d')][_0x417f('0x80')]:new Array(_0x3f8907[_0x417f('0x3d')][_0x417f('0x80')]);_0x29d7e1[_0x417f('0x2c')](function(_0x210f54){_0x228df1['or'](_0x417f('0x70'),'%,'+_0x210f54+',%');});}if(_0x3f8907[_0x417f('0x3d')][_0x417f('0x82')]){var _0xa23b4c=_0x3f8907[_0x417f('0x3d')][_0x417f('0x82')][_0x417f('0x83')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x417f('0x84')](_0xa23b4c)){_0xfcd67b['or']('i.id\x20LIKE\x20?',_0xa23b4c+'%');}else{_0xfcd67b['or'](_0x417f('0x85'),qs[_0x417f('0x68')](_0xa23b4c))['or'](_0x417f('0x86'),_0xa23b4c+'%')['or'](_0x417f('0x87'),_0xa23b4c+'%');}}}_0x2d2171[_0x417f('0x46')](_0xfcd67b);_0x2d2171[_0x417f('0x88')](_0x417f('0x89'));var _0xa9cc6e={'type':db[_0x417f('0x8a')][_0x417f('0x8b')][_0x417f('0x8c')],'raw':!![]};var _0x37e28e=_0x2d2171['clone']();_0x37e28e['field'](_0x417f('0x89'));_0x37e28e[_0x417f('0x49')](_0x417f('0x8d'),_0x417f('0x5f'));if(_0x46dd94[_0x417f('0x44')]){_0x46dd94['order']['forEach'](function(_0x275cb4){var _0x31f0a7=_0x275cb4[0x0]===_0x417f('0x8e')?_0x275cb4[0x0]:'i.'+_0x275cb4[0x0];_0x2d2171[_0x417f('0x44')](_0x31f0a7,_0x275cb4[0x1]===_0x417f('0x8f')?![]:!![]);});}if(!_[_0x417f('0x73')](_0x29d7e1)){_0x2d2171[_0x417f('0x62')](_0x228df1);_0x37e28e['where'](_0x417f('0x90'),_0x29d7e1);}BPromise[_0x417f('0x91')]()[_0x417f('0x2f')](function(){if(!_0x13395d){if(_0x3f8907['query'][_0x417f('0x74')])return;_0x37e28e[_0x417f('0x46')](_0x417f('0x92'));_0x2d2171[_0x417f('0x46')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x3f8907[_0x417f('0x93')][_0x417f('0x94')]!==_0x417f('0x95'))return;return _0x3f8907[_0x417f('0x93')][_0x417f('0x96')]({'attributes':['id'],'raw':!![]})[_0x417f('0x2f')](function(_0x49fc42){if(_[_0x417f('0x73')](_0x49fc42)){_0x37e28e[_0x417f('0x46')](_0x417f('0x97'));_0x2d2171['where'](_0x417f('0x97'));}else{_0x37e28e[_0x417f('0x46')](_0x417f('0x75'),_[_0x417f('0x38')](_0x49fc42,'id'));_0x2d2171[_0x417f('0x46')](_0x417f('0x75'),_[_0x417f('0x38')](_0x49fc42,'id'));}});})[_0x417f('0x2f')](function(){if(_0x3f8907[_0x417f('0x93')][_0x417f('0x94')]==='agent'&&!_0x13395d&&!_0x3f8907[_0x417f('0x3d')]['OpenchannelAccountId'])return[];return db[_0x417f('0x98')][_0x417f('0x3d')](_0x37e28e[_0x417f('0x99')](),_0xa9cc6e);})[_0x417f('0x2f')](function(_0xf8862b){_0xf28d99[_0x417f('0x9a')]=_0xf8862b[_0x417f('0x5e')];if(_0xf28d99[_0x417f('0x9a')]===0x0)return[];return db[_0x417f('0x98')][_0x417f('0x3d')](_0x119886['toString'](),_0xa9cc6e)[_0x417f('0x2f')](function(_0x2f0eea){_0x2e15a6=_[_0x417f('0x9b')](_0x2f0eea,'id');_0xa9cc6e=_[_0x417f('0x9c')](_0xa9cc6e,{'model':db[_0x417f('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3f8907[_0x417f('0x3d')][_0x417f('0x41')]){_0x46dd94[_0x417f('0x42')]['forEach'](function(_0x389f03){_0x2d2171['field']('i.'+_0x389f03);});}else{_0x2d2171[_0x417f('0x49')](_0x417f('0x8d'),'unreadMessages');_0x2d2171['field']('a.key',_0x417f('0x9d'));_0x2d2171['field'](_0x417f('0x9e'),_0x417f('0x9f'));_0x2d2171['field']('CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x2d2171[_0x417f('0x49')](_0x417f('0xa0'));_0x2d2171['field'](_0x417f('0xa1'),'Contact.firstName');_0x2d2171[_0x417f('0x49')](_0x417f('0xa2'),_0x417f('0xa3'));_0x2d2171['field'](_0x417f('0xa4'),_0x417f('0xa5'));_0x2d2171[_0x417f('0x49')](_0x417f('0xa6'),_0x417f('0xa7'));_0x2d2171['field'](_0x417f('0xa8'),_0x417f('0xa9'));_0x2d2171['field'](_0x417f('0xaa'),_0x417f('0xab'));_0x2d2171[_0x417f('0x49')](_0x417f('0xac'),_0x417f('0xad'));_0x2d2171[_0x417f('0x49')](_0x417f('0xae'),'Owner.internal');_0x2d2171[_0x417f('0x49')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x417f('0x2a'));}if(_0x46dd94['limit'])_0x2d2171[_0x417f('0x20')](_0x46dd94['limit']);if(_0x46dd94[_0x417f('0x1e')])_0x2d2171['offset'](_0x46dd94[_0x417f('0x1e')]);return db[_0x417f('0x98')][_0x417f('0x3d')](_0x2d2171[_0x417f('0x99')](),_0xa9cc6e);})['then'](function(_0x4f47a0){if(_0x4f47a0['length']>0x0)_0x59abaa[_0x417f('0x46')](_0x417f('0xaf'),_['map'](_0x4f47a0,'id'));return db[_0x417f('0x98')][_0x417f('0x3d')](_0x59abaa[_0x417f('0x99')](),_0xa9cc6e)[_0x417f('0x2f')](function(_0x3c8bdd){var _0x5f5785=_['groupBy'](_0x3c8bdd,_0x417f('0xb0'));var _0x564a77=[];_0x4f47a0['forEach'](function(_0x5f4947){_0x564a77[_0x417f('0x2e')](updateOpenchannelInteraction(_0x5f4947,_0x2e15a6,_0x5f5785));});return BPromise[_0x417f('0xb1')](_0x564a77);});});})[_0x417f('0x2f')](function(_0x49b4c7){_0xf28d99['rows']=_0x49b4c7;return _0xf28d99;})['then'](respondWithFilteredResult(_0xa5ef2f,_0x46dd94))['catch'](handleError(_0xa5ef2f,null));};exports['show']=function(_0xb84352,_0x1ee43e){var _0x1ee06f={};if(_0xb84352[_0x417f('0x3d')][_0x417f('0x6c')]&&_0xb84352[_0x417f('0x3d')][_0x417f('0x6c')]===_0x417f('0x4f')){_0x1ee06f[_0x417f('0x4f')]=_0xb84352[_0x417f('0xb2')]['id'];}else{_0x1ee06f['id']=_0xb84352[_0x417f('0xb2')]['id'];}var _0x4815cc={'raw':![],'where':_0x1ee06f},_0x4ce1e4={};_0x4ce1e4[_0x417f('0x3c')]=_[_0x417f('0x3e')](db[_0x417f('0x39')]['rawAttributes']);_0x4ce1e4[_0x417f('0x3d')]=_[_0x417f('0x3e')](_0xb84352[_0x417f('0x3d')]);_0x4ce1e4['filters']=_[_0x417f('0x40')](_0x4ce1e4[_0x417f('0x3c')],_0x4ce1e4[_0x417f('0x3d')]);_0x4815cc[_0x417f('0x42')]=_[_0x417f('0x40')](_0x4ce1e4[_0x417f('0x3c')],qs['fields'](_0xb84352[_0x417f('0x3d')]['fields']));_0x4815cc['attributes']=_0x4815cc[_0x417f('0x42')][_0x417f('0x5e')]?_0x4815cc[_0x417f('0x42')]:_0x4ce1e4['model'];if(_0xb84352[_0x417f('0x3d')][_0x417f('0xb3')]){_0x4815cc['include']=[{'all':!![]}];}_0x4815cc=_[_0x417f('0x9c')]({},_0x4815cc,_0xb84352[_0x417f('0xb4')]);return db['OpenchannelInteraction'][_0x417f('0x6a')](_0x4815cc)[_0x417f('0x2f')](handleEntityNotFound(_0x1ee43e,null))[_0x417f('0x2f')](respondWithResult(_0x1ee43e,null))[_0x417f('0xb5')](handleError(_0x1ee43e,null));};exports['create']=function(_0x2877ab,_0x578fae){return db[_0x417f('0x39')][_0x417f('0xb6')](_0x2877ab[_0x417f('0xb7')],{})[_0x417f('0x2f')](respondWithResult(_0x578fae,0xc9))['catch'](handleError(_0x578fae,null));};exports[_0x417f('0x26')]=function(_0x3bd29f,_0x4f1747){if(_0x3bd29f['body']['id']){delete _0x3bd29f[_0x417f('0xb7')]['id'];}return db[_0x417f('0x39')]['find']({'where':{'id':_0x3bd29f[_0x417f('0xb2')]['id']}})['then'](handleEntityNotFound(_0x4f1747,null))[_0x417f('0x2f')](saveUpdates(_0x3bd29f[_0x417f('0xb7')],null))[_0x417f('0x2f')](respondWithResult(_0x4f1747,null))[_0x417f('0xb5')](handleError(_0x4f1747,null));};exports[_0x417f('0xb8')]=function(_0x482fb6,_0x1dde77){return db[_0x417f('0x39')][_0x417f('0x6a')]({'where':{'id':_0x482fb6['params']['id']}})[_0x417f('0x2f')](handleEntityNotFound(_0x1dde77,null))[_0x417f('0x2f')](removeEntity(_0x1dde77,null))['catch'](handleError(_0x1dde77,null));};exports[_0x417f('0xb9')]=function(_0x39379b,_0x6a9cb){return db['OpenchannelInteraction'][_0x417f('0xb9')]()[_0x417f('0x2f')](respondWithResult(_0x6a9cb,null))[_0x417f('0xb5')](handleError(_0x6a9cb,null));};exports[_0x417f('0xba')]=function(_0x382692,_0x162e63,_0x4549a5){return db['OpenchannelMessage'][_0x417f('0x6a')]({'where':{'id':_0x382692['params']['id']}})['then'](handleEntityNotFound(_0x162e63,null))[_0x417f('0x2f')](function(_0x5059e9){if(_0x5059e9){return _0x5059e9[_0x417f('0xba')](_0x382692[_0x417f('0xb7')][_0x417f('0xbb')],_[_0x417f('0xbc')](_0x382692['body'],['ids','id'])||{});}})[_0x417f('0x2f')](respondWithResult(_0x162e63,null))[_0x417f('0xb5')](handleError(_0x162e63,null));};exports[_0x417f('0xbd')]=function(_0x1a2794,_0x587b4b,_0x249a4a){var _0x2c235a={'raw':![],'where':{}};var _0x178d93={};var _0x3889b2={'count':0x0,'rows':[]};return db[_0x417f('0x39')]['findOne']({'where':{'id':_0x1a2794[_0x417f('0xb2')]['id']}})['then'](handleEntityNotFound(_0x587b4b,null))[_0x417f('0x2f')](function(_0x3abe80){if(_0x3abe80){_0x178d93[_0x417f('0x3c')]=_[_0x417f('0x3e')](db['OpenchannelMessage'][_0x417f('0xbe')]);_0x178d93[_0x417f('0x3d')]=_[_0x417f('0x3e')](_0x1a2794[_0x417f('0x3d')]);_0x178d93['filters']=_[_0x417f('0x40')](_0x178d93['model'],_0x178d93[_0x417f('0x3d')]);_0x2c235a['attributes']=_[_0x417f('0x40')](_0x178d93[_0x417f('0x3c')],qs[_0x417f('0x41')](_0x1a2794[_0x417f('0x3d')]['fields']));_0x2c235a[_0x417f('0x42')]=_0x2c235a['attributes'][_0x417f('0x5e')]?_0x2c235a[_0x417f('0x42')]:_0x178d93[_0x417f('0x3c')];if(!_0x1a2794[_0x417f('0x3d')][_0x417f('0xbf')]('nolimit')){_0x2c235a[_0x417f('0x20')]=qs[_0x417f('0x20')](_0x1a2794[_0x417f('0x3d')][_0x417f('0x20')]);_0x2c235a[_0x417f('0x1e')]=qs[_0x417f('0x1e')](_0x1a2794['query'][_0x417f('0x1e')]);}_0x2c235a[_0x417f('0x44')]=qs['sort'](_0x1a2794[_0x417f('0x3d')][_0x417f('0x45')]);_0x2c235a[_0x417f('0x46')]=qs[_0x417f('0x3f')](_['pick'](_0x1a2794['query'],_0x178d93[_0x417f('0x3f')]));_0x2c235a['where']['OpenchannelInteractionId']=_0x3abe80['id'];if(_0x1a2794['query'][_0x417f('0x82')]){_0x2c235a[_0x417f('0x46')]=_[_0x417f('0x9c')](_0x2c235a['where'],{'$or':_[_0x417f('0x38')](_0x2c235a['attributes'],function(_0x5b7b2b){var _0x24d1a7={};_0x24d1a7[_0x5b7b2b]={'$like':'%'+_0x1a2794['query'][_0x417f('0x82')]+'%'};return _0x24d1a7;})});}if(_0x1a2794['query'][_0x417f('0x79')]){var _0x249dcf=_0x1a2794['query'][_0x417f('0x79')][_0x417f('0x2b')](',');var _0x829561={};_0x829561[_0x249dcf[0x0]]={'$gte':moment(_0x249dcf[0x1])[_0x417f('0xc0')](_0x417f('0xc1'))};_0x2c235a[_0x417f('0x46')]=_[_0x417f('0x9c')](_0x2c235a[_0x417f('0x46')],_0x829561);}_0x2c235a=_['merge']({},_0x2c235a,_0x1a2794[_0x417f('0xb4')]);return db['OpenchannelMessage'][_0x417f('0x9a')]({'where':_0x2c235a[_0x417f('0x46')]})[_0x417f('0x2f')](function(_0x59ae5d){_0x3889b2['count']=_0x59ae5d;if(_0x1a2794['query'][_0x417f('0xb3')]){_0x2c235a['include']=[{'all':!![]}];}return db[_0x417f('0xc2')]['findAll'](_0x2c235a);})[_0x417f('0x2f')](function(_0x11c6e2){_0x3889b2[_0x417f('0xc3')]=_0x11c6e2;return _0x3889b2;});}})['then'](respondWithFilteredResult(_0x587b4b,_0x2c235a))['catch'](handleError(_0x587b4b,null));};exports[_0x417f('0xc4')]=function(_0x5f5ca5,_0x2323b2,_0x240394){return db[_0x417f('0x39')][_0x417f('0x6a')]({'where':{'id':_0x5f5ca5[_0x417f('0xb2')]['id']}})[_0x417f('0x2f')](handleEntityNotFound(_0x2323b2,null))['then'](function(_0xb7df0b){if(_0xb7df0b){return _0xb7df0b[_0x417f('0xc5')](_0x5f5ca5[_0x417f('0xb7')][_0x417f('0xbb')],_[_0x417f('0xbc')](_0x5f5ca5[_0x417f('0xb7')],[_0x417f('0xbb'),'id'])||{})['spread'](function(){return db[_0x417f('0x6f')][_0x417f('0xc6')]({'attributes':['id','name',_0x417f('0x4a')],'where':{'id':_0x5f5ca5[_0x417f('0xb7')][_0x417f('0xbb')]}});})[_0x417f('0x2f')](function(_0x7c63ea){socket[_0x417f('0xc7')](_0x417f('0xc8'),{'id':Number(_0x5f5ca5[_0x417f('0xb2')]['id']),'tags':_0x7c63ea||[]});return{'id':Number(_0x5f5ca5['params']['id']),'tags':_0x7c63ea||[]};});}})[_0x417f('0x2f')](respondWithResult(_0x2323b2,null))['catch'](handleError(_0x2323b2,null));};exports[_0x417f('0xc9')]=function(_0xa4834f,_0x32eb21,_0x872dd3){return db[_0x417f('0x39')][_0x417f('0x6a')]({'where':{'id':_0xa4834f[_0x417f('0xb2')]['id']}})[_0x417f('0x2f')](handleEntityNotFound(_0x32eb21,null))[_0x417f('0x2f')](function(_0x3355bb){if(_0x3355bb){return _0x3355bb[_0x417f('0xc9')](_0xa4834f[_0x417f('0x3d')]['ids']);}})[_0x417f('0x2f')](respondWithStatusCode(_0x32eb21,null))[_0x417f('0xb5')](handleError(_0x32eb21,null));};exports[_0x417f('0xca')]=function(_0x243be,_0x538871){var _0x8cf98a=moment()[_0x417f('0xcb')]()[_0x417f('0x99')]();var _0x5a30b6=path[_0x417f('0xcc')](config[_0x417f('0xcd')],_0x417f('0xce'),'files',_0x417f('0xcf'));var _0x27e113=path[_0x417f('0xcc')](config[_0x417f('0xcd')],_0x417f('0xce'),_0x417f('0xd0'),'attachments');var _0x397909=path[_0x417f('0xcc')](_0x5a30b6,_0x8cf98a);var _0x2354ec=util[_0x417f('0xc0')]('transcript-%d-%s.zip',_0x243be[_0x417f('0xb2')]['id'],_0x8cf98a);var _0x53cbe9=path[_0x417f('0xcc')](_0x5a30b6,_0x2354ec);var _0x399da0=[];_0x399da0[_0x417f('0x2e')]({'model':db['User'],'as':'User','attributes':['id',_0x417f('0x29')],'raw':!![]});_0x399da0[_0x417f('0x2e')]({'model':db[_0x417f('0xd1')],'as':'Contact','attributes':['id',_0x417f('0xd2'),_0x417f('0xd3')],'raw':!![]});if(_0x243be[_0x417f('0x3d')][_0x417f('0xd4')]){_0x399da0[_0x417f('0x2e')]({'model':db[_0x417f('0xd5')],'as':_0x417f('0xd5'),'raw':!![]});}var _0x2daf51=[{'model':db[_0x417f('0xc2')],'as':_0x417f('0xd6'),'attributes':['id',_0x417f('0xb7'),_0x417f('0x77'),_0x417f('0xd7'),_0x417f('0xd8'),'read'],'include':_0x399da0}];_0x2daf51[_0x417f('0x2e')]({'model':db[_0x417f('0xd9')],'as':_0x417f('0xda'),'attributes':['id',_0x417f('0x27')]});_0x2daf51[_0x417f('0x2e')]({'model':db['User'],'as':_0x417f('0xdb'),'attributes':['id',_0x417f('0x29')]});return db[_0x417f('0x39')][_0x417f('0x6a')]({'where':{'id':_0x243be[_0x417f('0xb2')]['id']},'include':_0x2daf51})[_0x417f('0x2f')](handleEntityNotFound(_0x538871,null))[_0x417f('0x2f')](function(_0x12eea1){if(_0x12eea1){var _0x554b7a=_0x12eea1[_0x417f('0xdc')]({'plain':!![]});fs[_0x417f('0xdd')](_0x397909);var _0x7f2efa={'channel':_0x417f('0xde'),'account':_0x554b7a['Account']['name'],'agent':_0x554b7a[_0x417f('0xdb')]?_0x554b7a['Owner'][_0x417f('0x29')]:_0x417f('0xdf'),'createdAt':moment(_0x554b7a[_0x417f('0x77')])[_0x417f('0xc0')](_0x417f('0xc1'))[_0x417f('0x99')](),'closedAt':_0x554b7a['closed']?moment(_0x554b7a[_0x417f('0xe0')])[_0x417f('0xc0')](_0x417f('0xc1'))['toString']():'','disposition':_0x554b7a[_0x417f('0xe1')],'visibility':_0x554b7a[_0x417f('0xe2')]?_0x417f('0xe3'):_0x417f('0xe4'),'messages':_(_0x554b7a[_0x417f('0xd6')])[_0x417f('0x82')]({'secret':![]})['map'](function(_0x2456be){if(_0x2456be[_0x417f('0xd5')]){var _0x225741=path[_0x417f('0xcc')](_0x27e113,_0x2456be['Attachment'][_0x417f('0xe5')]);if(fs[_0x417f('0xe6')](_0x225741)){fs[_0x417f('0xe7')](_0x225741)[_0x417f('0xe8')](fs[_0x417f('0xe9')](path[_0x417f('0xcc')](_0x397909,_0x2456be[_0x417f('0xd5')][_0x417f('0xe5')])));}}return{'date':moment(_0x2456be['createdAt'])[_0x417f('0xc0')]('YYYY-MM-DD\x20HH:mm:ss')[_0x417f('0x99')](),'sender':_0x2456be['direction']==='out'?_0x2456be[_0x417f('0x71')]?_0x2456be[_0x417f('0x71')][_0x417f('0x29')]:_0x417f('0xea'):_0x2456be[_0x417f('0x64')][_0x417f('0xd2')]+(_0x2456be[_0x417f('0x64')][_0x417f('0xd3')]?'\x20'+_0x2456be[_0x417f('0x64')][_0x417f('0xd3')]:''),'body':_0x2456be[_0x417f('0xd5')]?_0x2456be[_0x417f('0xd5')][_0x417f('0xe5')]:_0x2456be[_0x417f('0xb7')],'direction':_0x2456be['direction']===_0x417f('0xeb')?'A':'C','secret':_0x2456be['secret'],'read':_0x2456be[_0x417f('0x7d')],'attachment':_0x2456be[_0x417f('0xd5')]};})[_0x417f('0x60')]()};return ejs[_0x417f('0xec')](path[_0x417f('0xcc')](config['root'],_0x417f('0xce'),_0x417f('0xed'),_0x417f('0xee')),{'interaction':_0x7f2efa})['then'](function(_0x9687f5){var _0x2fe1b4=path[_0x417f('0xcc')](_0x397909,_0x417f('0xef')+_0x554b7a['id']+'-'+_0x8cf98a+_0x417f('0xf0'));var _0x3c3885={'path':_0x2fe1b4,'channel':'Openchannel','interactionId':_0x554b7a['id']};return pdf[_0x417f('0xf1')](_0x9687f5,_0x3c3885);})[_0x417f('0x2f')](function(){return new BPromise(function(_0x2c1591,_0x339c22){zipdir(_0x397909,{'saveTo':_0x53cbe9},function(_0x53516b,_0x32acac){if(_0x53516b)return _0x339c22(_0x53516b);return _0x2c1591(_0x32acac);});})[_0x417f('0x2f')](function(){return new BPromise(function(_0x4efe24,_0x3417ec){rimraf(_0x397909,function(_0x20be00){if(_0x20be00)_0x3417ec(_0x20be00);return _0x4efe24();});});})['then'](function(){return _0x538871[_0x417f('0xca')](_0x53cbe9,_0x2354ec,function(_0x125418){if(_0x125418){console['log'](_0x417f('0xf2'),_0x125418);}else{fs['unlinkSync'](_0x53cbe9);}});});});}else{return _0x538871[_0x417f('0x1b')](0xc8);}})[_0x417f('0xb5')](handleError(_0x538871,null));}; \ No newline at end of file +var _0xbace=['select','u.id','u.fullname','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','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','search','parseSearch','sqlOperator','conditions','find','field','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','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','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','type','body','some','compact','forEach','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','isNumeric','i.id\x20LIKE\x20?','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','rows','show','params','includeAll','include','options','create','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','pick','OpenchannelInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','transcript-%d-%s.zip','User','CmContact','firstName','lastName','attachments','Attachment','Messages','direction','secret','OpenchannelAccount','Owner','get','mkdirSync','Openchannel','Account','closedAt','disposition','threadId','basename','existsSync','createReadStream','pipe','createWriteStream','out','renderFile','views','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','Users','map','fullname','TagIds','Tags','split','push','catch','waiting','talking','unmanaged','total','closed','UserId','answered','index','OpenchannelInteraction','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','color','from'];(function(_0x30f07a,_0x98341){var _0xb38461=function(_0x7b287a){while(--_0x7b287a){_0x30f07a['push'](_0x30f07a['shift']());}};_0xb38461(++_0x98341);}(_0xbace,0x19c));var _0xebac=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xbace[_0x465a0c];return _0x1e202e;};'use strict';var emlformat=require(_0xebac('0x0'));var rimraf=require(_0xebac('0x1'));var zipdir=require(_0xebac('0x2'));var jsonpatch=require(_0xebac('0x3'));var rp=require(_0xebac('0x4'));var moment=require(_0xebac('0x5'));var BPromise=require(_0xebac('0x6'));var Mustache=require(_0xebac('0x7'));var util=require(_0xebac('0x8'));var path=require(_0xebac('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xebac('0xa'));var fs=require('fs');var fs_extra=require(_0xebac('0xb'));var _=require('lodash');var squel=require(_0xebac('0xc'));var crypto=require(_0xebac('0xd'));var jsforce=require(_0xebac('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xebac('0xf'));var Papa=require(_0xebac('0x10'));var Redis=require(_0xebac('0x11'));var authService=require(_0xebac('0x12'));var qs=require(_0xebac('0x13'));var as=require(_0xebac('0x14'));var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xebac('0x15'));var utils=require('../../config/utils');var config=require(_0xebac('0x16'));var licenseUtil=require(_0xebac('0x17'));var db=require(_0xebac('0x18'))['db'];config['redis']=_[_0xebac('0x19')](config['redis'],{'host':_0xebac('0x1a'),'port':0x18eb});var socket=require(_0xebac('0x1b'))(new Redis(config[_0xebac('0x1c')]));require('./openchannelInteraction.socket')[_0xebac('0x1d')](socket);function respondWithStatusCode(_0x5b07f1,_0x369c67){_0x369c67=_0x369c67||0xcc;return function(_0x54c589){if(_0x54c589){return _0x5b07f1[_0xebac('0x1e')](_0x369c67);}return _0x5b07f1['status'](_0x369c67)[_0xebac('0x1f')]();};}function respondWithResult(_0x566982,_0x3d3dcc){_0x3d3dcc=_0x3d3dcc||0xc8;return function(_0x21265a){if(_0x21265a){return _0x566982[_0xebac('0x20')](_0x3d3dcc)[_0xebac('0x21')](_0x21265a);}};}function respondWithFilteredResult(_0x231444,_0x155c83){return function(_0x4fecd9){if(_0x4fecd9){var _0x5a4fff=typeof _0x155c83[_0xebac('0x22')]===_0xebac('0x23')&&typeof _0x155c83[_0xebac('0x24')]===_0xebac('0x23');var _0xa5070b=_0x4fecd9['count'];var _0x4f18cc=_0x5a4fff?0x0:_0x155c83[_0xebac('0x22')];var _0x24c268=_0x5a4fff?_0x4fecd9[_0xebac('0x25')]:_0x155c83[_0xebac('0x22')]+_0x155c83[_0xebac('0x24')];var _0x1d2bf2;if(_0x24c268>=_0xa5070b){_0x24c268=_0xa5070b;_0x1d2bf2=0xc8;}else{_0x1d2bf2=0xce;}_0x231444['status'](_0x1d2bf2);return _0x231444['set'](_0xebac('0x26'),_0x4f18cc+'-'+_0x24c268+'/'+_0xa5070b)[_0xebac('0x21')](_0x4fecd9);}return null;};}function patchUpdates(_0x4251e0){return function(_0x439e5b){try{jsonpatch[_0xebac('0x27')](_0x439e5b,_0x4251e0,!![]);}catch(_0x5b2364){return BPromise['reject'](_0x5b2364);}return _0x439e5b[_0xebac('0x28')]();};}function saveUpdates(_0x2c9e03,_0x54584c){return function(_0x44082d){if(_0x44082d){return _0x44082d[_0xebac('0x29')](_0x2c9e03)[_0xebac('0x2a')](function(_0x21a64a){return _0x21a64a;});}return null;};}function removeEntity(_0x49e35e,_0x58897e){return function(_0x125f44){if(_0x125f44){return _0x125f44[_0xebac('0x2b')]()[_0xebac('0x2a')](function(){_0x49e35e['status'](0xcc)[_0xebac('0x1f')]();});}};}function handleEntityNotFound(_0xa8867,_0x3b8640){return function(_0x2b9e64){if(!_0x2b9e64){_0xa8867[_0xebac('0x1e')](0x194);}return _0x2b9e64;};}function handleError(_0x495192,_0x531dc3){_0x531dc3=_0x531dc3||0x1f4;return function(_0x584023){logger[_0xebac('0x2c')](_0x584023[_0xebac('0x2d')]);if(_0x584023['name']){delete _0x584023[_0xebac('0x2e')];}_0x495192[_0xebac('0x20')](_0x531dc3)['send'](_0x584023);};}function getInteractionUsers(_0x459ff3,_0x7c26e7){return new BPromise(function(_0x58af0b,_0x517d3b){try{if(_0x7c26e7[_0x459ff3['id']]){_0x459ff3[_0xebac('0x2f')]=_[_0xebac('0x30')](_0x7c26e7[_0x459ff3['id']],function(_0x5913ed){return{'id':_0x5913ed['id'],'fullname':_0x5913ed[_0xebac('0x31')]};});}}catch(_0x4ab54f){_0x517d3b(_0x4ab54f);}_0x58af0b(_0x459ff3);});}function getInteractionTags(_0x3d4fb0,_0x368e14){return new BPromise(function(_0x20f6e9,_0x4dc5fd){try{if(_0x3d4fb0[_0xebac('0x32')]){_0x3d4fb0[_0xebac('0x33')]=[];_0x3d4fb0[_0xebac('0x32')][_0xebac('0x34')](',')['forEach'](function(_0x50e541){_0x3d4fb0[_0xebac('0x33')][_0xebac('0x35')](_0x368e14[_0x50e541]);});}delete _0x3d4fb0['TagIds'];}catch(_0x55c36f){_0x4dc5fd(_0x55c36f);}_0x20f6e9(_0x3d4fb0);});}function updateOpenchannelInteraction(_0x4b9eb3,_0x3e1ee6,_0x236b05){return new BPromise(function(_0x26925f,_0x555504){return getInteractionUsers(_0x4b9eb3,_0x236b05)[_0xebac('0x2a')](function(_0x39913b){return getInteractionTags(_0x39913b,_0x3e1ee6);})[_0xebac('0x2a')](function(_0x163a0a){return getStateInteraction(_0x163a0a);})[_0xebac('0x2a')](function(_0x5dab01){_0x26925f(_0x5dab01);})[_0xebac('0x36')](function(_0x25aa7a){_0x555504(_0x25aa7a);});});}function getStateInteraction(_0x41f93b){return new BPromise(function(_0xd8163b){_0x41f93b[_0xebac('0x37')]=0x0;_0x41f93b[_0xebac('0x38')]=0x0;_0x41f93b['answered']=0x0;_0x41f93b[_0xebac('0x39')]=0x0;_0x41f93b[_0xebac('0x3a')]=0x0;if(!_0x41f93b[_0xebac('0x3b')]&&!_0x41f93b[_0xebac('0x3c')]){_0x41f93b[_0xebac('0x37')]+=0x1;}if(!_0x41f93b['closed']&&_0x41f93b['UserId']){_0x41f93b[_0xebac('0x38')]+=0x1;if(_0x41f93b[_0xebac('0x37')]){_0x41f93b[_0xebac('0x37')]-=0x1;}}if(_0x41f93b[_0xebac('0x3b')]&&_0x41f93b[_0xebac('0x3c')]){_0x41f93b[_0xebac('0x3d')]+=0x1;if(_0x41f93b[_0xebac('0x38')]){_0x41f93b[_0xebac('0x38')]-=0x1;}}if(_0x41f93b[_0xebac('0x3b')]&&!_0x41f93b['UserId']){_0x41f93b[_0xebac('0x39')]+=0x1;if(_0x41f93b[_0xebac('0x37')]){_0x41f93b[_0xebac('0x37')]-=0x1;}}_0x41f93b[_0xebac('0x3a')]+=0x1;_0xd8163b(_0x41f93b);});}exports[_0xebac('0x3e')]=function(_0x1adb88,_0x197755){var _0x2d80b7={},_0x158998={},_0x583f3c={'count':0x0,'rows':[]};var _0x54cd60=_[_0xebac('0x30')](db[_0xebac('0x3f')][_0xebac('0x40')],function(_0x2dc811){return{'name':_0x2dc811[_0xebac('0x41')],'type':_0x2dc811['type'][_0xebac('0x42')]};});_0x158998[_0xebac('0x43')]=_[_0xebac('0x30')](_0x54cd60,_0xebac('0x2e'));_0x158998['query']=_[_0xebac('0x44')](_0x1adb88[_0xebac('0x45')]);_0x158998[_0xebac('0x46')]=_[_0xebac('0x47')](_0x158998[_0xebac('0x43')],_0x158998[_0xebac('0x45')]);_0x2d80b7[_0xebac('0x48')]=_['intersection'](_0x158998[_0xebac('0x43')],qs['fields'](_0x1adb88[_0xebac('0x45')][_0xebac('0x49')]));_0x2d80b7[_0xebac('0x48')]=_0x2d80b7[_0xebac('0x48')][_0xebac('0x4a')]?_0x2d80b7[_0xebac('0x48')]:_0x158998[_0xebac('0x43')];if(!_0x1adb88['query'][_0xebac('0x4b')](_0xebac('0x4c'))){_0x2d80b7['limit']=qs[_0xebac('0x24')](_0x1adb88[_0xebac('0x45')][_0xebac('0x24')]);_0x2d80b7[_0xebac('0x22')]=qs[_0xebac('0x22')](_0x1adb88[_0xebac('0x45')][_0xebac('0x22')]);}_0x2d80b7[_0xebac('0x4d')]=qs[_0xebac('0x4e')](_0x1adb88[_0xebac('0x45')]['sort']);_0x2d80b7[_0xebac('0x4f')]=qs['filters'](_['pick'](_0x1adb88[_0xebac('0x45')],_0x158998[_0xebac('0x46')]),_0x54cd60);var _0x4153f8=[];var _0x799224=squel['select']()['field']('id')['field'](_0xebac('0x2e'))['field'](_0xebac('0x50'))[_0xebac('0x51')]('tools_tags');var _0x164218=squel[_0xebac('0x52')]()['field'](_0xebac('0x53'))['field'](_0xebac('0x54'))['field']('ui.OpenchannelInteractionId')['from'](_0xebac('0x55'),'ui')[_0xebac('0x56')](_0xebac('0x57'),'u',_0xebac('0x58'));var _0x3172df=squel[_0xebac('0x52')]()['from'](_0xebac('0x59'),'i')[_0xebac('0x56')]('cm_contacts','c',_0xebac('0x5a'))[_0xebac('0x56')]('users','o',_0xebac('0x5b'))[_0xebac('0x56')](_0xebac('0x5c'),'a',_0xebac('0x5d'))[_0xebac('0x56')]('openchannel_messages','me',_0xebac('0x5e'))[_0xebac('0x56')](_0xebac('0x5f'),'it',_0xebac('0x60'))['left_join'](_0xebac('0x61'),'t',_0xebac('0x62'));var _0x30b3e5=squel[_0xebac('0x63')]();var _0x43e9d1=[];var _0x1dbed7=squel[_0xebac('0x63')]();var _0x4f5b40;if(_0x1adb88[_0xebac('0x45')][_0xebac('0x64')]){_0x4f5b40=as[_0xebac('0x65')](_0x1adb88[_0xebac('0x45')]['search']);var _0x162529=_0x4f5b40[_0xebac('0x66')];for(var _0x4c94be=0x0;_0x4c94be<_0x4f5b40[_0xebac('0x67')]['length'];_0x4c94be++){var _0x7f1fdd=_0x4f5b40[_0xebac('0x67')][_0x4c94be];var _0x3baeb7='i';var _0x22ee83=_[_0xebac('0x68')](_0x54cd60,[_0xebac('0x2e'),_0x7f1fdd['field']]);if(!_0x22ee83){switch(_0x7f1fdd[_0xebac('0x69')]){case _0xebac('0x6a'):if(_0x7f1fdd[_0xebac('0x6b')]==0x1){_0x3172df[_0xebac('0x6c')]('`'+_0x7f1fdd[_0xebac('0x69')]+_0xebac('0x6d'));}else{_0x3172df[_0xebac('0x6c')]('`'+_0x7f1fdd[_0xebac('0x69')]+'`\x20>\x200');}break;case _0xebac('0x6e'):if(_0x7f1fdd[_0xebac('0x6f')]===_0xebac('0x70')){if(_0x7f1fdd[_0xebac('0x6b')]['split']('\x20')[_0xebac('0x4a')]>0x1){_0x30b3e5[_0x162529]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xebac('0x71')](_0x7f1fdd[_0xebac('0x6b')]),null);}else{var _0x5d1426='%'+_0x7f1fdd['value']+'%';_0x30b3e5[_0x162529](_0xebac('0x72'),_0x5d1426,_0x5d1426,_0x5d1426);}}else{_0x22ee83=_[_0xebac('0x68')](_0x54cd60,[_0xebac('0x2e'),_0xebac('0x73')]);_0x7f1fdd[_0xebac('0x69')]='ContactId';_0x266822=as[_0xebac('0x74')](_0x3baeb7,_0x22ee83['type'],_0x7f1fdd);_0x30b3e5[_0x162529](_0x266822[_0xebac('0x75')],_0x266822[_0xebac('0x6b')][_0xebac('0x76')],_0x266822[_0xebac('0x6b')][_0xebac('0x1f')]);}break;case _0xebac('0x77'):var _0x582b11=_0x7f1fdd[_0xebac('0x6b')][_0xebac('0x34')](',')[_0xebac('0x30')](function(_0x1c3b1e){return Number(_0x1c3b1e);});_0x582b11['forEach'](function(_0x209afa){_0x1dbed7['or'](_0xebac('0x78'),'%,'+_0x209afa+',%');});_0x43e9d1=_[_0xebac('0x79')](_0x43e9d1,_0x582b11);break;case'User':if(_0x7f1fdd[_0xebac('0x6f')]===_0xebac('0x70')){_0x30b3e5[_0x162529](_0xebac('0x7a'),'%'+_0x7f1fdd[_0xebac('0x6b')]+'%',null);}else{_0x22ee83=_[_0xebac('0x68')](_0x54cd60,[_0xebac('0x2e'),_0xebac('0x3c')]);_0x7f1fdd[_0xebac('0x69')]=_0xebac('0x3c');_0x266822=as[_0xebac('0x74')](_0x3baeb7,_0x22ee83[_0xebac('0x7b')],_0x7f1fdd);_0x30b3e5[_0x162529](_0x266822[_0xebac('0x75')],_0x266822[_0xebac('0x6b')][_0xebac('0x76')],_0x266822[_0xebac('0x6b')][_0xebac('0x1f')]);}break;case _0xebac('0x7c'):_0x266822=as[_0xebac('0x74')]('me',null,_0x7f1fdd);_0x30b3e5[_0x162529](_0x266822[_0xebac('0x75')],_0x266822[_0xebac('0x6b')][_0xebac('0x76')],_0x266822['value']['end']);break;}}else{var _0x266822=as[_0xebac('0x74')](_0x3baeb7,_0x22ee83[_0xebac('0x7b')],_0x7f1fdd);_0x30b3e5[_0x162529](_0x266822['text'],_0x266822['value'][_0xebac('0x76')],_0x266822['value'][_0xebac('0x1f')]);}}}else{var _0x21b3ec=_(_0x1adb88[_0xebac('0x45')])['keys']()[_0xebac('0x30')](function(_0x4fbcb5){return _[_0xebac('0x7d')](_0x54cd60,['name',_0x4fbcb5])?_0x4fbcb5:undefined;})[_0xebac('0x7e')]()[_0xebac('0x6b')]();if(!_['isEmpty'](_0x21b3ec)){_0x21b3ec[_0xebac('0x7f')](function(_0x14d593){if(_0x14d593===_0xebac('0x80')){_0x3172df[_0xebac('0x4f')](_0xebac('0x81'),[][_0xebac('0x82')](_0x1adb88[_0xebac('0x45')][_0x14d593]));}else if(_0x14d593===_0xebac('0x83')){var _0xf4bd74=JSON[_0xebac('0x84')](_0x1adb88['query'][_0x14d593])[_0xebac('0x85')];var _0x2cd06c=JSON['parse'](_0x1adb88[_0xebac('0x45')][_0x14d593])['$lte'];_0x3172df[_0xebac('0x4f')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xf4bd74,_0x2cd06c);}else{if(_0x1adb88['query'][_0x14d593]===_0xebac('0x86')){_0x3172df[_0xebac('0x4f')]('i.'+_0x14d593+_0xebac('0x87'));}else{_0x3172df['where']('i.'+_0x14d593+_0xebac('0x88'),_0x1adb88[_0xebac('0x45')][_0x14d593]);}}});}if(_0x1adb88[_0xebac('0x45')][_0xebac('0x89')]){if(_0x1adb88[_0xebac('0x45')]['read']==0x1){_0x3172df[_0xebac('0x6c')](_0xebac('0x8a'));}else{_0x3172df[_0xebac('0x6c')](_0xebac('0x8b'));}}if(_0x1adb88[_0xebac('0x45')]['tag']){_0x43e9d1=_[_0xebac('0x8c')](_0x1adb88[_0xebac('0x45')][_0xebac('0x8d')])?_0x1adb88[_0xebac('0x45')]['tag']:new Array(_0x1adb88[_0xebac('0x45')][_0xebac('0x8d')]);_0x43e9d1[_0xebac('0x7f')](function(_0x4a121d){_0x1dbed7['or'](_0xebac('0x78'),'%,'+_0x4a121d+',%');});}if(_0x1adb88['query'][_0xebac('0x8e')]){var _0x490976=_0x1adb88['query']['filter']['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xebac('0x8f')](_0x490976)){_0x30b3e5['or'](_0xebac('0x90'),_0x490976+'%');}else{_0x30b3e5['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xebac('0x71')](_0x490976))['or'](_0xebac('0x91'),_0x490976+'%')['or'](_0xebac('0x92'),_0x490976+'%');}}}_0x3172df[_0xebac('0x4f')](_0x30b3e5);_0x3172df[_0xebac('0x93')]('i.id');var _0x283de5={'type':db[_0xebac('0x94')]['QueryTypes'][_0xebac('0x95')],'raw':!![]};var _0x4020f9=_0x3172df['clone']();_0x4020f9[_0xebac('0x69')](_0xebac('0x96'));_0x4020f9[_0xebac('0x69')](_0xebac('0x97'),_0xebac('0x6a'));if(_0x2d80b7[_0xebac('0x4d')]){_0x2d80b7['order'][_0xebac('0x7f')](function(_0x4966ff){var _0x273e8c=_0x4966ff[0x0]==='contactName'?_0x4966ff[0x0]:'i.'+_0x4966ff[0x0];_0x3172df[_0xebac('0x4d')](_0x273e8c,_0x4966ff[0x1]===_0xebac('0x98')?![]:!![]);});}if(!_[_0xebac('0x99')](_0x43e9d1)){_0x3172df['having'](_0x1dbed7);_0x4020f9[_0xebac('0x4f')](_0xebac('0x9a'),_0x43e9d1);}BPromise[_0xebac('0x9b')]()[_0xebac('0x2a')](function(){if(!_0x4f5b40){if(_0x1adb88[_0xebac('0x45')][_0xebac('0x80')])return;_0x4020f9[_0xebac('0x4f')](_0xebac('0x9c'));_0x3172df[_0xebac('0x4f')](_0xebac('0x9c'));return;}if(_0x1adb88[_0xebac('0x9d')][_0xebac('0x9e')]!==_0xebac('0x9f'))return;return _0x1adb88[_0xebac('0x9d')][_0xebac('0xa0')]({'attributes':['id'],'raw':!![]})[_0xebac('0x2a')](function(_0x3c7b60){if(_['isEmpty'](_0x3c7b60)){_0x4020f9[_0xebac('0x4f')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x3172df[_0xebac('0x4f')](_0xebac('0xa1'));}else{_0x4020f9[_0xebac('0x4f')](_0xebac('0x81'),_[_0xebac('0x30')](_0x3c7b60,'id'));_0x3172df['where'](_0xebac('0x81'),_[_0xebac('0x30')](_0x3c7b60,'id'));}});})[_0xebac('0x2a')](function(){if(_0x1adb88['user'][_0xebac('0x9e')]==='agent'&&!_0x4f5b40&&!_0x1adb88[_0xebac('0x45')]['OpenchannelAccountId'])return[];return db[_0xebac('0xa2')][_0xebac('0x45')](_0x4020f9[_0xebac('0xa3')](),_0x283de5);})['then'](function(_0x29e909){_0x583f3c[_0xebac('0x25')]=_0x29e909[_0xebac('0x4a')];if(_0x583f3c['count']===0x0)return[];return db['sequelize'][_0xebac('0x45')](_0x799224[_0xebac('0xa3')](),_0x283de5)['then'](function(_0x56a8ca){_0x4153f8=_[_0xebac('0xa4')](_0x56a8ca,'id');_0x283de5=_[_0xebac('0xa5')](_0x283de5,{'model':db[_0xebac('0x3f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1adb88[_0xebac('0x45')][_0xebac('0x49')]){_0x2d80b7[_0xebac('0x48')][_0xebac('0x7f')](function(_0x5d8b32){_0x3172df[_0xebac('0x69')]('i.'+_0x5d8b32);});}else{_0x3172df[_0xebac('0x69')](_0xebac('0x97'),_0xebac('0x6a'));_0x3172df['field'](_0xebac('0xa6'),_0xebac('0xa7'));_0x3172df['field'](_0xebac('0xa8'),_0xebac('0xa9'));_0x3172df['field'](_0xebac('0xaa'),'contactName');_0x3172df[_0xebac('0x69')]('i.*');_0x3172df[_0xebac('0x69')](_0xebac('0xab'),'Contact.firstName');_0x3172df[_0xebac('0x69')]('c.lastName',_0xebac('0xac'));_0x3172df[_0xebac('0x69')](_0xebac('0xad'),_0xebac('0xae'));_0x3172df[_0xebac('0x69')](_0xebac('0xaf'),_0xebac('0xb0'));_0x3172df[_0xebac('0x69')](_0xebac('0xb1'),_0xebac('0xb2'));_0x3172df[_0xebac('0x69')](_0xebac('0xb3'),_0xebac('0xb4'));_0x3172df[_0xebac('0x69')]('o.fullname',_0xebac('0xb5'));_0x3172df[_0xebac('0x69')](_0xebac('0xb6'),_0xebac('0xb7'));_0x3172df[_0xebac('0x69')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xebac('0x32'));}if(_0x2d80b7[_0xebac('0x24')])_0x3172df[_0xebac('0x24')](_0x2d80b7[_0xebac('0x24')]);if(_0x2d80b7['offset'])_0x3172df['offset'](_0x2d80b7[_0xebac('0x22')]);return db[_0xebac('0xa2')][_0xebac('0x45')](_0x3172df[_0xebac('0xa3')](),_0x283de5);})['then'](function(_0x1f3cb7){if(_0x1f3cb7[_0xebac('0x4a')]>0x0)_0x164218[_0xebac('0x4f')]('ui.OpenchannelInteractionId\x20IN\x20?',_[_0xebac('0x30')](_0x1f3cb7,'id'));return db[_0xebac('0xa2')][_0xebac('0x45')](_0x164218[_0xebac('0xa3')](),_0x283de5)[_0xebac('0x2a')](function(_0x2667f2){var _0x33a2cc=_['groupBy'](_0x2667f2,'OpenchannelInteractionId');var _0x5093df=[];_0x1f3cb7['forEach'](function(_0x18fc0e){_0x5093df['push'](updateOpenchannelInteraction(_0x18fc0e,_0x4153f8,_0x33a2cc));});return BPromise['all'](_0x5093df);});});})[_0xebac('0x2a')](function(_0x191cca){_0x583f3c[_0xebac('0xb8')]=_0x191cca;return _0x583f3c;})[_0xebac('0x2a')](respondWithFilteredResult(_0x197755,_0x2d80b7))[_0xebac('0x36')](handleError(_0x197755,null));};exports[_0xebac('0xb9')]=function(_0x211cc8,_0xb8ea07){var _0x5c6e3a={};if(_0x211cc8[_0xebac('0x45')][_0xebac('0x7b')]&&_0x211cc8[_0xebac('0x45')]['type']==='from'){_0x5c6e3a[_0xebac('0x51')]=_0x211cc8[_0xebac('0xba')]['id'];}else{_0x5c6e3a['id']=_0x211cc8['params']['id'];}var _0x2da180={'raw':![],'where':_0x5c6e3a},_0xf4c9fb={};_0xf4c9fb[_0xebac('0x43')]=_[_0xebac('0x44')](db['OpenchannelInteraction']['rawAttributes']);_0xf4c9fb[_0xebac('0x45')]=_[_0xebac('0x44')](_0x211cc8['query']);_0xf4c9fb['filters']=_[_0xebac('0x47')](_0xf4c9fb[_0xebac('0x43')],_0xf4c9fb[_0xebac('0x45')]);_0x2da180[_0xebac('0x48')]=_[_0xebac('0x47')](_0xf4c9fb[_0xebac('0x43')],qs[_0xebac('0x49')](_0x211cc8[_0xebac('0x45')][_0xebac('0x49')]));_0x2da180[_0xebac('0x48')]=_0x2da180['attributes'][_0xebac('0x4a')]?_0x2da180[_0xebac('0x48')]:_0xf4c9fb[_0xebac('0x43')];if(_0x211cc8['query'][_0xebac('0xbb')]){_0x2da180[_0xebac('0xbc')]=[{'all':!![]}];}_0x2da180=_[_0xebac('0xa5')]({},_0x2da180,_0x211cc8[_0xebac('0xbd')]);return db[_0xebac('0x3f')]['find'](_0x2da180)[_0xebac('0x2a')](handleEntityNotFound(_0xb8ea07,null))[_0xebac('0x2a')](respondWithResult(_0xb8ea07,null))[_0xebac('0x36')](handleError(_0xb8ea07,null));};exports[_0xebac('0xbe')]=function(_0x129741,_0x47b733){return db[_0xebac('0x3f')][_0xebac('0xbe')](_0x129741['body'],{})[_0xebac('0x2a')](respondWithResult(_0x47b733,0xc9))['catch'](handleError(_0x47b733,null));};exports[_0xebac('0x29')]=function(_0x40a479,_0x18712c){if(_0x40a479[_0xebac('0x7c')]['id']){delete _0x40a479[_0xebac('0x7c')]['id'];}return db[_0xebac('0x3f')]['find']({'where':{'id':_0x40a479[_0xebac('0xba')]['id']}})[_0xebac('0x2a')](handleEntityNotFound(_0x18712c,null))[_0xebac('0x2a')](saveUpdates(_0x40a479[_0xebac('0x7c')],null))[_0xebac('0x2a')](respondWithResult(_0x18712c,null))[_0xebac('0x36')](handleError(_0x18712c,null));};exports[_0xebac('0x2b')]=function(_0x5b2268,_0x243950){return db['OpenchannelInteraction'][_0xebac('0x68')]({'where':{'id':_0x5b2268['params']['id']}})[_0xebac('0x2a')](handleEntityNotFound(_0x243950,null))['then'](removeEntity(_0x243950,null))['catch'](handleError(_0x243950,null));};exports[_0xebac('0xbf')]=function(_0x18fa98,_0x48e875){return db[_0xebac('0x3f')]['describe']()[_0xebac('0x2a')](respondWithResult(_0x48e875,null))[_0xebac('0x36')](handleError(_0x48e875,null));};exports[_0xebac('0xc0')]=function(_0x5539a2,_0x189f82,_0x3aabee){return db[_0xebac('0xc1')][_0xebac('0x68')]({'where':{'id':_0x5539a2[_0xebac('0xba')]['id']}})['then'](handleEntityNotFound(_0x189f82,null))['then'](function(_0x34e6a2){if(_0x34e6a2){return _0x34e6a2['addMessage'](_0x5539a2[_0xebac('0x7c')][_0xebac('0xc2')],_[_0xebac('0xc3')](_0x5539a2[_0xebac('0x7c')],[_0xebac('0xc2'),'id'])||{});}})[_0xebac('0x2a')](respondWithResult(_0x189f82,null))[_0xebac('0x36')](handleError(_0x189f82,null));};exports[_0xebac('0xc4')]=function(_0x257533,_0x2becbc,_0x55413b){var _0x2e197f={'raw':![],'where':{}};var _0x152a55={};var _0x3c2b54={'count':0x0,'rows':[]};return db[_0xebac('0x3f')][_0xebac('0xc5')]({'where':{'id':_0x257533[_0xebac('0xba')]['id']}})[_0xebac('0x2a')](handleEntityNotFound(_0x2becbc,null))['then'](function(_0x2db086){if(_0x2db086){_0x152a55[_0xebac('0x43')]=_[_0xebac('0x44')](db[_0xebac('0xc1')][_0xebac('0x40')]);_0x152a55[_0xebac('0x45')]=_[_0xebac('0x44')](_0x257533[_0xebac('0x45')]);_0x152a55[_0xebac('0x46')]=_[_0xebac('0x47')](_0x152a55[_0xebac('0x43')],_0x152a55[_0xebac('0x45')]);_0x2e197f[_0xebac('0x48')]=_[_0xebac('0x47')](_0x152a55[_0xebac('0x43')],qs['fields'](_0x257533[_0xebac('0x45')]['fields']));_0x2e197f[_0xebac('0x48')]=_0x2e197f['attributes'][_0xebac('0x4a')]?_0x2e197f[_0xebac('0x48')]:_0x152a55[_0xebac('0x43')];if(!_0x257533[_0xebac('0x45')][_0xebac('0x4b')](_0xebac('0x4c'))){_0x2e197f['limit']=qs[_0xebac('0x24')](_0x257533[_0xebac('0x45')][_0xebac('0x24')]);_0x2e197f[_0xebac('0x22')]=qs[_0xebac('0x22')](_0x257533['query'][_0xebac('0x22')]);}_0x2e197f[_0xebac('0x4d')]=qs[_0xebac('0x4e')](_0x257533[_0xebac('0x45')]['sort']);_0x2e197f[_0xebac('0x4f')]=qs[_0xebac('0x46')](_[_0xebac('0xc6')](_0x257533[_0xebac('0x45')],_0x152a55[_0xebac('0x46')]));_0x2e197f[_0xebac('0x4f')][_0xebac('0xc7')]=_0x2db086['id'];if(_0x257533[_0xebac('0x45')][_0xebac('0x8e')]){_0x2e197f[_0xebac('0x4f')]=_[_0xebac('0xa5')](_0x2e197f[_0xebac('0x4f')],{'$or':_['map'](_0x2e197f[_0xebac('0x48')],function(_0x96ccca){var _0x359e3e={};_0x359e3e[_0x96ccca]={'$like':'%'+_0x257533[_0xebac('0x45')][_0xebac('0x8e')]+'%'};return _0x359e3e;})});}if(_0x257533[_0xebac('0x45')][_0xebac('0x85')]){var _0x54b7ee=_0x257533[_0xebac('0x45')][_0xebac('0x85')][_0xebac('0x34')](',');var _0x567453={};_0x567453[_0x54b7ee[0x0]]={'$gte':moment(_0x54b7ee[0x1])[_0xebac('0xc8')](_0xebac('0xc9'))};_0x2e197f[_0xebac('0x4f')]=_[_0xebac('0xa5')](_0x2e197f[_0xebac('0x4f')],_0x567453);}_0x2e197f=_['merge']({},_0x2e197f,_0x257533['options']);return db[_0xebac('0xc1')][_0xebac('0x25')]({'where':_0x2e197f[_0xebac('0x4f')]})[_0xebac('0x2a')](function(_0x422b93){_0x3c2b54[_0xebac('0x25')]=_0x422b93;if(_0x257533[_0xebac('0x45')]['includeAll']){_0x2e197f[_0xebac('0xbc')]=[{'all':!![]}];}return db[_0xebac('0xc1')][_0xebac('0xca')](_0x2e197f);})[_0xebac('0x2a')](function(_0x1c027e){_0x3c2b54[_0xebac('0xb8')]=_0x1c027e;return _0x3c2b54;});}})[_0xebac('0x2a')](respondWithFilteredResult(_0x2becbc,_0x2e197f))['catch'](handleError(_0x2becbc,null));};exports['addTags']=function(_0x5d8f4d,_0x3f3922,_0x2586f3){return db[_0xebac('0x3f')][_0xebac('0x68')]({'where':{'id':_0x5d8f4d[_0xebac('0xba')]['id']}})['then'](handleEntityNotFound(_0x3f3922,null))[_0xebac('0x2a')](function(_0x1b3dd3){if(_0x1b3dd3){return _0x1b3dd3[_0xebac('0xcb')](_0x5d8f4d[_0xebac('0x7c')][_0xebac('0xc2')],_[_0xebac('0xc3')](_0x5d8f4d['body'],[_0xebac('0xc2'),'id'])||{})[_0xebac('0xcc')](function(){return db['Tag'][_0xebac('0xca')]({'attributes':['id',_0xebac('0x2e'),_0xebac('0x50')],'where':{'id':_0x5d8f4d[_0xebac('0x7c')]['ids']}});})[_0xebac('0x2a')](function(_0x29053a){socket[_0xebac('0xcd')](_0xebac('0xce'),{'id':Number(_0x5d8f4d[_0xebac('0xba')]['id']),'tags':_0x29053a||[]});return{'id':Number(_0x5d8f4d['params']['id']),'tags':_0x29053a||[]};});}})['then'](respondWithResult(_0x3f3922,null))[_0xebac('0x36')](handleError(_0x3f3922,null));};exports[_0xebac('0xcf')]=function(_0x5ba614,_0x1e7975,_0x563884){return db['OpenchannelInteraction'][_0xebac('0x68')]({'where':{'id':_0x5ba614['params']['id']}})[_0xebac('0x2a')](handleEntityNotFound(_0x1e7975,null))['then'](function(_0x354e66){if(_0x354e66){return _0x354e66['removeTags'](_0x5ba614[_0xebac('0x45')][_0xebac('0xc2')]);}})[_0xebac('0x2a')](respondWithStatusCode(_0x1e7975,null))['catch'](handleError(_0x1e7975,null));};exports[_0xebac('0xd0')]=function(_0x2ecd9a,_0x42c069){var _0x1b2fa3=moment()[_0xebac('0xd1')]()[_0xebac('0xa3')]();var _0x4a86cb=path[_0xebac('0xd2')](config[_0xebac('0xd3')],_0xebac('0xd4'),_0xebac('0xd5'),'tmp');var _0x3b4187=path[_0xebac('0xd2')](config['root'],_0xebac('0xd4'),_0xebac('0xd5'),'attachments');var _0x41cf97=path[_0xebac('0xd2')](_0x4a86cb,_0x1b2fa3);var _0xbbae37=util[_0xebac('0xc8')](_0xebac('0xd6'),_0x2ecd9a['params']['id'],_0x1b2fa3);var _0x20478d=path['join'](_0x4a86cb,_0xbbae37);var _0x59d338=[];_0x59d338[_0xebac('0x35')]({'model':db[_0xebac('0xd7')],'as':_0xebac('0xd7'),'attributes':['id',_0xebac('0x31')],'raw':!![]});_0x59d338['push']({'model':db[_0xebac('0xd8')],'as':_0xebac('0x6e'),'attributes':['id',_0xebac('0xd9'),_0xebac('0xda')],'raw':!![]});if(_0x2ecd9a[_0xebac('0x45')][_0xebac('0xdb')]){_0x59d338['push']({'model':db['Attachment'],'as':_0xebac('0xdc'),'raw':!![]});}var _0x1d7838=[{'model':db['OpenchannelMessage'],'as':_0xebac('0xdd'),'attributes':['id',_0xebac('0x7c'),_0xebac('0x83'),_0xebac('0xde'),_0xebac('0xdf'),_0xebac('0x89')],'include':_0x59d338}];_0x1d7838[_0xebac('0x35')]({'model':db[_0xebac('0xe0')],'as':'Account','attributes':['id',_0xebac('0x2e')]});_0x1d7838[_0xebac('0x35')]({'model':db['User'],'as':_0xebac('0xe1'),'attributes':['id',_0xebac('0x31')]});return db[_0xebac('0x3f')]['find']({'where':{'id':_0x2ecd9a[_0xebac('0xba')]['id']},'include':_0x1d7838})[_0xebac('0x2a')](handleEntityNotFound(_0x42c069,null))[_0xebac('0x2a')](function(_0x207d26){if(_0x207d26){var _0x5f395b=_0x207d26[_0xebac('0xe2')]({'plain':!![]});fs[_0xebac('0xe3')](_0x41cf97);var _0x3907a7={'channel':_0xebac('0xe4'),'account':_0x5f395b[_0xebac('0xe5')]['name'],'agent':_0x5f395b['Owner']?_0x5f395b[_0xebac('0xe1')][_0xebac('0x31')]:'N.A.','createdAt':moment(_0x5f395b[_0xebac('0x83')])['format'](_0xebac('0xc9'))[_0xebac('0xa3')](),'closedAt':_0x5f395b[_0xebac('0x3b')]?moment(_0x5f395b[_0xebac('0xe6')])['format'](_0xebac('0xc9'))[_0xebac('0xa3')]():'','disposition':_0x5f395b[_0xebac('0xe7')],'visibility':_0x5f395b[_0xebac('0xe8')]?'Public':'Private','messages':_(_0x5f395b[_0xebac('0xdd')])[_0xebac('0x8e')]({'secret':![]})['map'](function(_0x2fbdf0){if(_0x2fbdf0[_0xebac('0xdc')]){var _0x3957d4=path[_0xebac('0xd2')](_0x3b4187,_0x2fbdf0[_0xebac('0xdc')][_0xebac('0xe9')]);if(fs[_0xebac('0xea')](_0x3957d4)){fs[_0xebac('0xeb')](_0x3957d4)[_0xebac('0xec')](fs[_0xebac('0xed')](path[_0xebac('0xd2')](_0x41cf97,_0x2fbdf0[_0xebac('0xdc')][_0xebac('0xe9')])));}}return{'date':moment(_0x2fbdf0[_0xebac('0x83')])[_0xebac('0xc8')]('YYYY-MM-DD\x20HH:mm:ss')[_0xebac('0xa3')](),'sender':_0x2fbdf0['direction']==='out'?_0x2fbdf0[_0xebac('0xd7')]?_0x2fbdf0[_0xebac('0xd7')]['fullname']:'System':_0x2fbdf0[_0xebac('0x6e')][_0xebac('0xd9')]+(_0x2fbdf0[_0xebac('0x6e')][_0xebac('0xda')]?'\x20'+_0x2fbdf0[_0xebac('0x6e')][_0xebac('0xda')]:''),'body':_0x2fbdf0['Attachment']?_0x2fbdf0['Attachment'][_0xebac('0xe9')]:_0x2fbdf0['body'],'direction':_0x2fbdf0[_0xebac('0xde')]===_0xebac('0xee')?'A':'C','secret':_0x2fbdf0[_0xebac('0xdf')],'read':_0x2fbdf0[_0xebac('0x89')],'attachment':_0x2fbdf0[_0xebac('0xdc')]};})[_0xebac('0x6b')]()};return ejs[_0xebac('0xef')](path[_0xebac('0xd2')](config[_0xebac('0xd3')],'server',_0xebac('0xf0'),'downloadInteraction.ejs'),{'interaction':_0x3907a7})[_0xebac('0x2a')](function(_0x342620){var _0x494c46=path[_0xebac('0xd2')](_0x41cf97,_0xebac('0xf1')+_0x5f395b['id']+'-'+_0x1b2fa3+_0xebac('0xf2'));var _0x597a0c={'path':_0x494c46,'channel':_0xebac('0xe4'),'interactionId':_0x5f395b['id']};return pdf[_0xebac('0xf3')](_0x342620,_0x597a0c);})[_0xebac('0x2a')](function(){return new BPromise(function(_0x2744aa,_0x239108){zipdir(_0x41cf97,{'saveTo':_0x20478d},function(_0x4a985f,_0x1708c8){if(_0x4a985f)return _0x239108(_0x4a985f);return _0x2744aa(_0x1708c8);});})[_0xebac('0x2a')](function(){return new BPromise(function(_0x5c4783,_0x40d83e){rimraf(_0x41cf97,function(_0x2f8f73){if(_0x2f8f73)_0x40d83e(_0x2f8f73);return _0x5c4783();});});})[_0xebac('0x2a')](function(){return _0x42c069['download'](_0x20478d,_0xbbae37,function(_0x51f9d6){if(_0x51f9d6){console[_0xebac('0xf4')](_0xebac('0xf5'),_0x51f9d6);}else{fs[_0xebac('0xf6')](_0x20478d);}});});});}else{return _0x42c069[_0xebac('0x1e')](0xc8);}})[_0xebac('0x36')](handleError(_0x42c069,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 53fddf3..ce4e955 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 _0x8ade=['map','findAll','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update','remove','then','setDataValue'];(function(_0x54d7dd,_0x24b28d){var _0x5e1f78=function(_0x4c911d){while(--_0x4c911d){_0x54d7dd['push'](_0x54d7dd['shift']());}};_0x5e1f78(++_0x24b28d);}(_0x8ade,0x1ca));var _0xe8ad=function(_0x53c775,_0x56efed){_0x53c775=_0x53c775-0x0;var _0x184b94=_0x8ade[_0x53c775];return _0x184b94;};'use strict';var EventEmitter=require(_0xe8ad('0x0'));var OpenchannelInteraction=require(_0xe8ad('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0xe8ad('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xe8ad('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe8ad('0x3'),'afterDestroy':_0xe8ad('0x4')};function emitEvent(_0x523fea){return function(_0x3d1ed5,_0x2383d9,_0x8c2d7c){_0x3d1ed5['getUsers']({'attributes':['id'],'raw':!![]})[_0xe8ad('0x5')](function(_0x5b3d23){_0x3d1ed5[_0xe8ad('0x6')]('Users',_0x5b3d23[_0xe8ad('0x7')](function(_0x17c75a){return{'id':_0x17c75a['id']};}));return OpenchannelMessage[_0xe8ad('0x8')]({'where':{'OpenchannelInteractionId':_0x3d1ed5['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe8ad('0x5')](function(_0x556749){_0x3d1ed5[_0xe8ad('0x6')]('unreadMessages',_0x556749[_0xe8ad('0x9')]);OpenchannelInteractionEvents[_0xe8ad('0xa')](_0x523fea+':'+_0x3d1ed5['id'],_0x3d1ed5);OpenchannelInteractionEvents[_0xe8ad('0xa')](_0x523fea,_0x3d1ed5);_0x8c2d7c(null);})[_0xe8ad('0xb')](_0x8c2d7c(null));};}for(var e in events){if(events[_0xe8ad('0xc')](e)){var event=events[e];OpenchannelInteraction[_0xe8ad('0xd')](e,emitEvent(event));}}module[_0xe8ad('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xd2f4=['OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','Users','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x576b78,_0x5a8f09){var _0x2b4f61=function(_0x3582ae){while(--_0x3582ae){_0x576b78['push'](_0x576b78['shift']());}};_0x2b4f61(++_0x5a8f09);}(_0xd2f4,0xb2));var _0x4d2f=function(_0x4d9088,_0xf3bbf8){_0x4d9088=_0x4d9088-0x0;var _0x34342f=_0xd2f4[_0x4d9088];return _0x34342f;};'use strict';var EventEmitter=require(_0x4d2f('0x0'));var OpenchannelInteraction=require(_0x4d2f('0x1'))['db'][_0x4d2f('0x2')];var OpenchannelMessage=require(_0x4d2f('0x1'))['db'][_0x4d2f('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x4d2f('0x4')](0x0);var events={'afterCreate':_0x4d2f('0x5'),'afterUpdate':_0x4d2f('0x6'),'afterDestroy':_0x4d2f('0x7')};function emitEvent(_0x29b455){return function(_0x144b90,_0x245d0d,_0x30260){_0x144b90[_0x4d2f('0x8')]({'attributes':['id'],'raw':!![]})[_0x4d2f('0x9')](function(_0x535ce9){_0x144b90['setDataValue'](_0x4d2f('0xa'),_0x535ce9['map'](function(_0x3c5a77){return{'id':_0x3c5a77['id']};}));return OpenchannelMessage[_0x4d2f('0xb')]({'where':{'OpenchannelInteractionId':_0x144b90['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4d2f('0x9')](function(_0x2066eb){_0x144b90[_0x4d2f('0xc')](_0x4d2f('0xd'),_0x2066eb[_0x4d2f('0xe')]);OpenchannelInteractionEvents[_0x4d2f('0xf')](_0x29b455+':'+_0x144b90['id'],_0x144b90);OpenchannelInteractionEvents[_0x4d2f('0xf')](_0x29b455,_0x144b90);_0x30260(null);})[_0x4d2f('0x10')](_0x30260(null));};}for(var e in events){if(events[_0x4d2f('0x11')](e)){var event=events[e];OpenchannelInteraction[_0x4d2f('0x12')](e,emitEvent(event));}}module[_0x4d2f('0x13')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 865aeb7..ca53f1b 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 _0x2371=['api','moment','bluebird','request-promise','path','../../config/environment','./openchannelInteraction.attributes','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x48c03c,_0x3a0d41){var _0x33b898=function(_0x1d5f1a){while(--_0x1d5f1a){_0x48c03c['push'](_0x48c03c['shift']());}};_0x33b898(++_0x3a0d41);}(_0x2371,0x140));var _0x1237=function(_0x9db5d3,_0x4eea5e){_0x9db5d3=_0x9db5d3-0x0;var _0x477a81=_0x2371[_0x9db5d3];return _0x477a81;};'use strict';var _=require(_0x1237('0x0'));var util=require(_0x1237('0x1'));var logger=require(_0x1237('0x2'))(_0x1237('0x3'));var moment=require(_0x1237('0x4'));var BPromise=require(_0x1237('0x5'));var rp=require(_0x1237('0x6'));var fs=require('fs');var path=require(_0x1237('0x7'));var rimraf=require('rimraf');var config=require(_0x1237('0x8'));var attributes=require(_0x1237('0x9'));module['exports']=function(_0x427caf,_0x4b6fbf){return _0x427caf[_0x1237('0xa')](_0x1237('0xb'),attributes,{'tableName':_0x1237('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1237('0xd'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x17ccec,_0x3c69d9,_0x42d8d7){if(_0x17ccec['changed'](_0x1237('0xe'))){_0x17ccec['closedAt']=moment()[_0x1237('0xf')](_0x1237('0x10'));}_0x42d8d7(null,_0x17ccec);}}});}; \ No newline at end of file +var _0xb766=['request-promise','path','rimraf','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment'];(function(_0x1752e2,_0xbb3dcc){var _0x4ceab3=function(_0x422ff9){while(--_0x422ff9){_0x1752e2['push'](_0x1752e2['shift']());}};_0x4ceab3(++_0xbb3dcc);}(_0xb766,0x150));var _0x6b76=function(_0xa3c06b,_0x490f99){_0xa3c06b=_0xa3c06b-0x0;var _0x33aa1d=_0xb766[_0xa3c06b];return _0x33aa1d;};'use strict';var _=require(_0x6b76('0x0'));var util=require(_0x6b76('0x1'));var logger=require('../../config/logger')(_0x6b76('0x2'));var moment=require(_0x6b76('0x3'));var BPromise=require('bluebird');var rp=require(_0x6b76('0x4'));var fs=require('fs');var path=require(_0x6b76('0x5'));var rimraf=require(_0x6b76('0x6'));var config=require('../../config/environment');var attributes=require(_0x6b76('0x7'));module[_0x6b76('0x8')]=function(_0x38ce89,_0x518836){return _0x38ce89[_0x6b76('0x9')](_0x6b76('0xa'),attributes,{'tableName':_0x6b76('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6b76('0xc'),'collate':_0x6b76('0xd'),'hooks':{'beforeUpdate':function(_0x3e3355,_0x1d34ac,_0x49dab6){if(_0x3e3355[_0x6b76('0xe')]('closed')){_0x3e3355[_0x6b76('0xf')]=moment()['format'](_0x6b76('0x10'));}_0x49dab6(null,_0x3e3355);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 75e8521..c08605f 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 _0x953d=['UpdateOpenchannelInteraction','debug','AddTagsToOpenchannelInteraction','find','addTags','body','omit','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','update','options','raw','attributes'];(function(_0x1baf81,_0x83bf3e){var _0x579ddf=function(_0x56ef5b){while(--_0x56ef5b){_0x1baf81['push'](_0x1baf81['shift']());}};_0x579ddf(++_0x83bf3e);}(_0x953d,0x1d2));var _0xd953=function(_0x9a57d3,_0xc6453c){_0x9a57d3=_0x9a57d3-0x0;var _0x45ec2d=_0x953d[_0x9a57d3];return _0x45ec2d;};'use strict';var _=require(_0xd953('0x0'));var util=require(_0xd953('0x1'));var moment=require('moment');var BPromise=require(_0xd953('0x2'));var rs=require(_0xd953('0x3'));var fs=require('fs');var Redis=require(_0xd953('0x4'));var db=require(_0xd953('0x5'))['db'];var utils=require(_0xd953('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd953('0x7')]({'port':0x232a});config[_0xd953('0x8')]=_[_0xd953('0x9')](config[_0xd953('0x8')],{'host':_0xd953('0xa'),'port':0x18eb});var socket=require(_0xd953('0xb'))(new Redis(config[_0xd953('0x8')]));require(_0xd953('0xc'))['register'](socket);function respondWithRpcPromise(_0x1034a2,_0x14b393,_0x29731a){return new BPromise(function(_0x39e477,_0x420391){return client[_0xd953('0xd')](_0x1034a2,_0x29731a)[_0xd953('0xe')](function(_0x3484fa){logger[_0xd953('0xf')](_0xd953('0x10'),_0x14b393,'request\x20sent');logger['debug'](_0xd953('0x11'),_0x14b393,_0xd953('0x12'),JSON[_0xd953('0x13')](_0x3484fa));if(_0x3484fa['error']){if(_0x3484fa[_0xd953('0x14')][_0xd953('0x15')]===0x1f4){logger[_0xd953('0x14')](_0xd953('0x10'),_0x14b393,_0x3484fa[_0xd953('0x14')][_0xd953('0x16')]);return _0x420391(_0x3484fa['error'][_0xd953('0x16')]);}logger[_0xd953('0x14')](_0xd953('0x10'),_0x14b393,_0x3484fa['error']['message']);return _0x39e477(_0x3484fa[_0xd953('0x14')][_0xd953('0x16')]);}else{logger[_0xd953('0xf')]('OpenchannelInteraction,\x20%s,\x20%s',_0x14b393,'request\x20sent');_0x39e477(_0x3484fa['result'][_0xd953('0x16')]);}})[_0xd953('0x17')](function(_0x4b7636){logger['error'](_0xd953('0x10'),_0x14b393,_0x4b7636);_0x420391(_0x4b7636);});});}exports['UpdateOpenchannelInteraction']=function(_0x58472f){var _0x527a09=this;return new Promise(function(_0x1d4483,_0xb37983){return db['OpenchannelInteraction'][_0xd953('0x18')](_0x58472f['body'],{'raw':_0x58472f[_0xd953('0x19')]?_0x58472f['options'][_0xd953('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58472f[_0xd953('0x19')]?_0x58472f[_0xd953('0x19')]['where']||null:null,'attributes':_0x58472f['options']?_0x58472f[_0xd953('0x19')][_0xd953('0x1b')]||null:null,'limit':_0x58472f[_0xd953('0x19')]?_0x58472f[_0xd953('0x19')]['limit']||null:null})[_0xd953('0xe')](function(_0x214ee0){logger[_0xd953('0xf')](_0xd953('0x1c'),_0x58472f);logger[_0xd953('0x1d')]('UpdateOpenchannelInteraction',_0x58472f,JSON[_0xd953('0x13')](_0x214ee0));_0x1d4483(_0x214ee0);})['catch'](function(_0x20bc18){logger[_0xd953('0x14')](_0xd953('0x1c'),_0x20bc18['message'],_0x58472f);_0xb37983(_0x527a09[_0xd953('0x14')](0x1f4,_0x20bc18[_0xd953('0x16')]));});});};exports[_0xd953('0x1e')]=function(_0x31bd3e){return new Promise(function(_0x5298c6,_0x81b36e){return db['OpenchannelInteraction'][_0xd953('0x1f')]({'where':_0x31bd3e[_0xd953('0x19')]?_0x31bd3e['options']['where']||null:null})[_0xd953('0xe')](function(_0x2f48a7){if(_0x2f48a7){return _0x2f48a7[_0xd953('0x20')](_0x31bd3e[_0xd953('0x21')]['ids'],_[_0xd953('0x22')](_0x31bd3e[_0xd953('0x21')],[_0xd953('0x23'),'id'])||{});}})[_0xd953('0x24')](function(_0x20c1cf){logger[_0xd953('0xf')](_0xd953('0x25'),_0x31bd3e);logger[_0xd953('0x1d')]('AddTags',_0x31bd3e,JSON['stringify'](_0x20c1cf));_0x5298c6(_0x20c1cf);})[_0xd953('0x17')](function(_0x7014f6){logger[_0xd953('0x14')](_0xd953('0x25'),_0x7014f6['message'],_0x31bd3e);_0x81b36e(_this['error'](0x1f4,_0x7014f6[_0xd953('0x16')]));});});}; \ No newline at end of file +var _0x1869=['../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','attributes','limit','debug','find','where','omit','ids','spread','AddTags','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3e932d,_0x147e54){var _0x21ca0a=function(_0x5d161d){while(--_0x5d161d){_0x3e932d['push'](_0x3e932d['shift']());}};_0x21ca0a(++_0x147e54);}(_0x1869,0x1bc));var _0x9186=function(_0x404d52,_0x68f0ae){_0x404d52=_0x404d52-0x0;var _0x433640=_0x1869[_0x404d52];return _0x433640;};'use strict';var _=require(_0x9186('0x0'));var util=require(_0x9186('0x1'));var moment=require(_0x9186('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9186('0x3'))['db'];var utils=require(_0x9186('0x4'));var logger=require(_0x9186('0x5'))(_0x9186('0x6'));var config=require(_0x9186('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9186('0x8')]({'port':0x232a});config[_0x9186('0x9')]=_[_0x9186('0xa')](config[_0x9186('0x9')],{'host':_0x9186('0xb'),'port':0x18eb});var socket=require(_0x9186('0xc'))(new Redis(config[_0x9186('0x9')]));require(_0x9186('0xd'))[_0x9186('0xe')](socket);function respondWithRpcPromise(_0x2ce444,_0x171fab,_0x3c211c){return new BPromise(function(_0x389266,_0x51e7f1){return client['request'](_0x2ce444,_0x3c211c)[_0x9186('0xf')](function(_0x319bb1){logger[_0x9186('0x10')](_0x9186('0x11'),_0x171fab,_0x9186('0x12'));logger['debug'](_0x9186('0x13'),_0x171fab,'request\x20sent',JSON[_0x9186('0x14')](_0x319bb1));if(_0x319bb1[_0x9186('0x15')]){if(_0x319bb1[_0x9186('0x15')][_0x9186('0x16')]===0x1f4){logger[_0x9186('0x15')](_0x9186('0x11'),_0x171fab,_0x319bb1['error'][_0x9186('0x17')]);return _0x51e7f1(_0x319bb1['error'][_0x9186('0x17')]);}logger[_0x9186('0x15')](_0x9186('0x11'),_0x171fab,_0x319bb1[_0x9186('0x15')][_0x9186('0x17')]);return _0x389266(_0x319bb1[_0x9186('0x15')]['message']);}else{logger[_0x9186('0x10')](_0x9186('0x11'),_0x171fab,_0x9186('0x12'));_0x389266(_0x319bb1[_0x9186('0x18')][_0x9186('0x17')]);}})[_0x9186('0x19')](function(_0x38334a){logger[_0x9186('0x15')](_0x9186('0x11'),_0x171fab,_0x38334a);_0x51e7f1(_0x38334a);});});}exports[_0x9186('0x1a')]=function(_0x183588){var _0x4acb4e=this;return new Promise(function(_0x18945f,_0xd6bd5){return db[_0x9186('0x1b')][_0x9186('0x1c')](_0x183588[_0x9186('0x1d')],{'raw':_0x183588[_0x9186('0x1e')]?_0x183588[_0x9186('0x1e')][_0x9186('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x183588['options']?_0x183588[_0x9186('0x1e')]['where']||null:null,'attributes':_0x183588['options']?_0x183588['options'][_0x9186('0x20')]||null:null,'limit':_0x183588[_0x9186('0x1e')]?_0x183588['options'][_0x9186('0x21')]||null:null})[_0x9186('0xf')](function(_0x418a39){logger[_0x9186('0x10')](_0x9186('0x1a'),_0x183588);logger[_0x9186('0x22')]('UpdateOpenchannelInteraction',_0x183588,JSON['stringify'](_0x418a39));_0x18945f(_0x418a39);})[_0x9186('0x19')](function(_0x54f69f){logger['error'](_0x9186('0x1a'),_0x54f69f[_0x9186('0x17')],_0x183588);_0xd6bd5(_0x4acb4e[_0x9186('0x15')](0x1f4,_0x54f69f[_0x9186('0x17')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x121958){return new Promise(function(_0x16e84e,_0x27073a){return db['OpenchannelInteraction'][_0x9186('0x23')]({'where':_0x121958[_0x9186('0x1e')]?_0x121958['options'][_0x9186('0x24')]||null:null})[_0x9186('0xf')](function(_0x573494){if(_0x573494){return _0x573494['addTags'](_0x121958['body']['ids'],_[_0x9186('0x25')](_0x121958[_0x9186('0x1d')],[_0x9186('0x26'),'id'])||{});}})[_0x9186('0x27')](function(_0x18abcd){logger[_0x9186('0x10')](_0x9186('0x28'),_0x121958);logger[_0x9186('0x22')](_0x9186('0x28'),_0x121958,JSON[_0x9186('0x14')](_0x18abcd));_0x16e84e(_0x18abcd);})[_0x9186('0x19')](function(_0x47cc9a){logger['error'](_0x9186('0x28'),_0x47cc9a[_0x9186('0x17')],_0x121958);_0x27073a(_this[_0x9186('0x15')](0x1f4,_0x47cc9a[_0x9186('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 124717c..a088e30 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 _0x4246=['removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','remove','update','emit'];(function(_0x4231f7,_0x4698d2){var _0x3f2942=function(_0x100e27){while(--_0x100e27){_0x4231f7['push'](_0x4231f7['shift']());}};_0x3f2942(++_0x4698d2);}(_0x4246,0x7c));var _0x6424=function(_0x2d91d3,_0x5bceb6){_0x2d91d3=_0x2d91d3-0x0;var _0x3e9d18=_0x4246[_0x2d91d3];return _0x3e9d18;};'use strict';var OpenchannelInteractionEvents=require(_0x6424('0x0'));var events=['save',_0x6424('0x1'),_0x6424('0x2')];function createListener(_0x299ab5,_0x3d9218){return function(_0x4da852){_0x3d9218[_0x6424('0x3')](_0x299ab5,_0x4da852);};}function removeListener(_0x436daf,_0x2f5468){return function(){OpenchannelInteractionEvents[_0x6424('0x4')](_0x436daf,_0x2f5468);};}exports[_0x6424('0x5')]=function(_0x3b8b7c){for(var _0x26c026=0x0,_0x24eb86=events[_0x6424('0x6')];_0x26c026<_0x24eb86;_0x26c026++){var _0x40fd13=events[_0x26c026];var _0x4779b2=createListener(_0x6424('0x7')+_0x40fd13,_0x3b8b7c);OpenchannelInteractionEvents['on'](_0x40fd13,_0x4779b2);}}; \ No newline at end of file +var _0xa5df=['removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save','emit'];(function(_0x4e6a31,_0x440524){var _0x53f350=function(_0x57378d){while(--_0x57378d){_0x4e6a31['push'](_0x4e6a31['shift']());}};_0x53f350(++_0x440524);}(_0xa5df,0xd6));var _0xfa5d=function(_0x48ed93,_0x58c2a4){_0x48ed93=_0x48ed93-0x0;var _0x4d9f03=_0xa5df[_0x48ed93];return _0x4d9f03;};'use strict';var OpenchannelInteractionEvents=require(_0xfa5d('0x0'));var events=[_0xfa5d('0x1'),'remove','update'];function createListener(_0xaa916b,_0x57772a){return function(_0x3ccbce){_0x57772a[_0xfa5d('0x2')](_0xaa916b,_0x3ccbce);};}function removeListener(_0x414909,_0x5ba710){return function(){OpenchannelInteractionEvents[_0xfa5d('0x3')](_0x414909,_0x5ba710);};}exports[_0xfa5d('0x4')]=function(_0x54e5c4){for(var _0x2c30f5=0x0,_0x1cae82=events[_0xfa5d('0x5')];_0x2c30f5<_0x1cae82;_0x2c30f5++){var _0x3b7d04=events[_0x2c30f5];var _0x50e654=createListener(_0xfa5d('0x6')+_0x3b7d04,_0x54e5c4);OpenchannelInteractionEvents['on'](_0x3b7d04,_0x50e654);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 7b4fef5..1da77a7 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 _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x494fa2,_0x84b5d8){var _0xf013c7=function(_0x348859){while(--_0x348859){_0x494fa2['push'](_0x494fa2['shift']());}};_0xf013c7(++_0x84b5d8);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xcb91[_0x82129b];return _0x2ae5dc;};'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');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x483f42,_0x3af164){var _0xe7deb0=function(_0x1ae433){while(--_0x1ae433){_0x483f42['push'](_0x483f42['shift']());}};_0xe7deb0(++_0x3af164);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./openchannelMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 38f316d..a6a4727 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 _0x9158=['DATE','STRING','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x28c939,_0x110e29){var _0x527fe9=function(_0x1df2a6){while(--_0x1df2a6){_0x28c939['push'](_0x28c939['shift']());}};_0x527fe9(++_0x110e29);}(_0x9158,0x16e));var _0x8915=function(_0x39463e,_0x39d7da){_0x39463e=_0x39463e-0x0;var _0x5f916=_0x9158[_0x39463e];return _0x5f916;};'use strict';var Sequelize=require(_0x8915('0x0'));module[_0x8915('0x1')]={'body':{'type':Sequelize[_0x8915('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x8915('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x8915('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x8915('0x5')]},'providerName':{'type':Sequelize[_0x8915('0x6')]},'providerResponse':{'type':Sequelize[_0x8915('0x2')]}}; \ No newline at end of file +var _0x065e=['ENUM','DATE','STRING','sequelize','BOOLEAN'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x065e,0x1a7));var _0xe065=function(_0x3bb7b7,_0x5236ae){_0x3bb7b7=_0x3bb7b7-0x0;var _0x925e91=_0x065e[_0x3bb7b7];return _0x925e91;};'use strict';var Sequelize=require(_0xe065('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe065('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0xe065('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe065('0x2')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xe065('0x3')]},'providerName':{'type':Sequelize[_0xe065('0x4')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 7a97f3b..ea4e486 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 _0x3d49=['status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','OpenchannelMessage','rawAttributes','key','model','query','keys','filters','attributes','intersection','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','show','params','fields','includeAll','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','YYYY-MM-DD\x20HH:mm:ss','user','UserId','OpenchannelInteraction','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','User','fullname','email','internal','format','SIP/%s','channel','EventManager','acceptmessage','agent','OpenchannelInteractionId','get','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','contact','event','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','./openchannelMessage.socket','jayson/promise','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','sendStatus','end'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x3d49,0x151));var _0x93d4=function(_0x31218c,_0x28ae34){_0x31218c=_0x31218c-0x0;var _0x13e4ab=_0x3d49[_0x31218c];return _0x13e4ab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x93d4('0x0'));var zipdir=require(_0x93d4('0x1'));var jsonpatch=require(_0x93d4('0x2'));var rp=require(_0x93d4('0x3'));var moment=require('moment');var BPromise=require(_0x93d4('0x4'));var Mustache=require(_0x93d4('0x5'));var util=require(_0x93d4('0x6'));var path=require(_0x93d4('0x7'));var sox=require(_0x93d4('0x8'));var csv=require(_0x93d4('0x9'));var ejs=require('ejs');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(_0x93d4('0xa'));var toCsv=require(_0x93d4('0x9'));var querystring=require(_0x93d4('0xb'));var Papa=require(_0x93d4('0xc'));var Redis=require(_0x93d4('0xd'));var authService=require(_0x93d4('0xe'));var qs=require(_0x93d4('0xf'));var as=require(_0x93d4('0x10'));var hardwareService=require(_0x93d4('0x11'));var logger=require(_0x93d4('0x12'))(_0x93d4('0x13'));var utils=require(_0x93d4('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x93d4('0x15'));var db=require('../../mysqldb')['db'];config[_0x93d4('0x16')]=_[_0x93d4('0x17')](config[_0x93d4('0x16')],{'host':_0x93d4('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x93d4('0x16')]));require(_0x93d4('0x19'))['register'](socket);var jayson=require(_0x93d4('0x1a'));var client=jayson[_0x93d4('0x1b')][_0x93d4('0x1c')]({'port':0x232c});var client9002=jayson[_0x93d4('0x1b')][_0x93d4('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4ab341,_0x47d14c,_0x9cf9f2,_0x5c2e82){return new BPromise(function(_0x1ffdc5,_0x35d136){var _0x11d81c=_0x5c2e82||client;return _0x11d81c[_0x93d4('0x1d')](_0x4ab341,_0x9cf9f2)[_0x93d4('0x1e')](function(_0x266e0a){logger['info'](_0x93d4('0x1f'),_0x47d14c,_0x93d4('0x20'));logger[_0x93d4('0x21')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x47d14c,_0x93d4('0x20'),JSON['stringify'](_0x266e0a));if(_0x266e0a[_0x93d4('0x22')]){if(_0x266e0a[_0x93d4('0x22')][_0x93d4('0x23')]===0x1f4){logger[_0x93d4('0x22')](_0x93d4('0x1f'),_0x47d14c,_0x266e0a['error'][_0x93d4('0x24')]);return _0x35d136(_0x266e0a[_0x93d4('0x22')][_0x93d4('0x24')]);}logger[_0x93d4('0x22')](_0x93d4('0x1f'),_0x47d14c,_0x266e0a[_0x93d4('0x22')]['message']);return _0x1ffdc5(_0x266e0a[_0x93d4('0x22')][_0x93d4('0x24')]);}else{logger[_0x93d4('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x47d14c,_0x93d4('0x20'));_0x1ffdc5(_0x266e0a['result'][_0x93d4('0x24')]);}})[_0x93d4('0x26')](function(_0x57989a){logger[_0x93d4('0x22')](_0x93d4('0x1f'),_0x47d14c,_0x57989a);_0x35d136(_0x57989a);});});}function respondWithStatusCode(_0x2294af,_0x517efb){_0x517efb=_0x517efb||0xcc;return function(_0x572c52){if(_0x572c52){return _0x2294af[_0x93d4('0x27')](_0x517efb);}return _0x2294af['status'](_0x517efb)[_0x93d4('0x28')]();};}function respondWithResult(_0x12a9cb,_0x4dd4d0){_0x4dd4d0=_0x4dd4d0||0xc8;return function(_0x59f03b){if(_0x59f03b){return _0x12a9cb[_0x93d4('0x29')](_0x4dd4d0)[_0x93d4('0x2a')](_0x59f03b);}};}function respondWithFilteredResult(_0x8ed25e,_0x440dd3){return function(_0x25c7ef){if(_0x25c7ef){var _0x2cfe55=typeof _0x440dd3[_0x93d4('0x2b')]===_0x93d4('0x2c')&&typeof _0x440dd3[_0x93d4('0x2d')]==='undefined';var _0x12c863=_0x25c7ef[_0x93d4('0x2e')];var _0x3d5536=_0x2cfe55?0x0:_0x440dd3['offset'];var _0x1baaac=_0x2cfe55?_0x25c7ef[_0x93d4('0x2e')]:_0x440dd3[_0x93d4('0x2b')]+_0x440dd3[_0x93d4('0x2d')];var _0x20fa41;if(_0x1baaac>=_0x12c863){_0x1baaac=_0x12c863;_0x20fa41=0xc8;}else{_0x20fa41=0xce;}_0x8ed25e['status'](_0x20fa41);return _0x8ed25e[_0x93d4('0x2f')](_0x93d4('0x30'),_0x3d5536+'-'+_0x1baaac+'/'+_0x12c863)[_0x93d4('0x2a')](_0x25c7ef);}return null;};}function patchUpdates(_0x543d5e){return function(_0x9306fc){try{jsonpatch[_0x93d4('0x31')](_0x9306fc,_0x543d5e,!![]);}catch(_0x2d7115){return BPromise[_0x93d4('0x32')](_0x2d7115);}return _0x9306fc[_0x93d4('0x33')]();};}function saveUpdates(_0x5e0405,_0x2cce08){return function(_0x1d25f1){if(_0x1d25f1){return _0x1d25f1[_0x93d4('0x34')](_0x5e0405)[_0x93d4('0x1e')](function(_0x3249d8){return _0x3249d8;});}return null;};}function removeEntity(_0x328173,_0x26e9ec){return function(_0x23d3aa){if(_0x23d3aa){return _0x23d3aa[_0x93d4('0x35')]()[_0x93d4('0x1e')](function(){_0x328173[_0x93d4('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33b790,_0x52ee0d){return function(_0x5ab937){if(!_0x5ab937){_0x33b790['sendStatus'](0x194);}return _0x5ab937;};}function handleError(_0x4d559e,_0x13fdd1){_0x13fdd1=_0x13fdd1||0x1f4;return function(_0x303935){logger[_0x93d4('0x22')](_0x303935[_0x93d4('0x36')]);if(_0x303935[_0x93d4('0x37')]){delete _0x303935[_0x93d4('0x37')];}_0x4d559e[_0x93d4('0x29')](_0x13fdd1)[_0x93d4('0x38')](_0x303935);};}exports['index']=function(_0x44b786,_0x2db0c1){var _0x1b26f4={},_0x2e4cee={},_0x1da107={'count':0x0,'rows':[]};var _0x760250=_[_0x93d4('0x39')](db[_0x93d4('0x3a')][_0x93d4('0x3b')],function(_0x1d0ba2){return{'name':_0x1d0ba2['fieldName'],'type':_0x1d0ba2['type'][_0x93d4('0x3c')]};});_0x2e4cee[_0x93d4('0x3d')]=_[_0x93d4('0x39')](_0x760250,_0x93d4('0x37'));_0x2e4cee[_0x93d4('0x3e')]=_[_0x93d4('0x3f')](_0x44b786[_0x93d4('0x3e')]);_0x2e4cee[_0x93d4('0x40')]=_['intersection'](_0x2e4cee[_0x93d4('0x3d')],_0x2e4cee[_0x93d4('0x3e')]);_0x1b26f4[_0x93d4('0x41')]=_[_0x93d4('0x42')](_0x2e4cee[_0x93d4('0x3d')],qs['fields'](_0x44b786[_0x93d4('0x3e')]['fields']));_0x1b26f4[_0x93d4('0x41')]=_0x1b26f4[_0x93d4('0x41')][_0x93d4('0x43')]?_0x1b26f4[_0x93d4('0x41')]:_0x2e4cee['model'];if(!_0x44b786[_0x93d4('0x3e')]['hasOwnProperty'](_0x93d4('0x44'))){_0x1b26f4['limit']=qs[_0x93d4('0x2d')](_0x44b786[_0x93d4('0x3e')][_0x93d4('0x2d')]);_0x1b26f4['offset']=qs[_0x93d4('0x2b')](_0x44b786[_0x93d4('0x3e')][_0x93d4('0x2b')]);}_0x1b26f4[_0x93d4('0x45')]=qs['sort'](_0x44b786[_0x93d4('0x3e')][_0x93d4('0x46')]);_0x1b26f4[_0x93d4('0x47')]=qs[_0x93d4('0x40')](_['pick'](_0x44b786[_0x93d4('0x3e')],_0x2e4cee[_0x93d4('0x40')]),_0x760250);if(_0x44b786[_0x93d4('0x3e')][_0x93d4('0x48')]){_0x1b26f4[_0x93d4('0x47')]=_[_0x93d4('0x49')](_0x1b26f4[_0x93d4('0x47')],{'$or':_[_0x93d4('0x39')](_0x760250,function(_0x4ba532){if(_0x4ba532[_0x93d4('0x4a')]!==_0x93d4('0x4b')){var _0x1d0e8a={};_0x1d0e8a[_0x4ba532[_0x93d4('0x37')]]={'$like':'%'+_0x44b786[_0x93d4('0x3e')][_0x93d4('0x48')]+'%'};return _0x1d0e8a;}})});}_0x1b26f4=_[_0x93d4('0x49')]({},_0x1b26f4,_0x44b786[_0x93d4('0x4c')]);var _0x12e9a0={'where':_0x1b26f4[_0x93d4('0x47')]};return db[_0x93d4('0x3a')][_0x93d4('0x2e')](_0x12e9a0)[_0x93d4('0x1e')](function(_0x4b4333){_0x1da107[_0x93d4('0x2e')]=_0x4b4333;if(_0x44b786[_0x93d4('0x3e')]['includeAll']){_0x1b26f4[_0x93d4('0x4d')]=[{'all':!![]}];}return db[_0x93d4('0x3a')][_0x93d4('0x4e')](_0x1b26f4);})[_0x93d4('0x1e')](function(_0x1ee747){_0x1da107[_0x93d4('0x4f')]=_0x1ee747;return _0x1da107;})[_0x93d4('0x1e')](respondWithFilteredResult(_0x2db0c1,_0x1b26f4))[_0x93d4('0x26')](handleError(_0x2db0c1,null));};exports[_0x93d4('0x50')]=function(_0x3df59b,_0x151917){var _0x28987b={'raw':!![],'where':{'id':_0x3df59b[_0x93d4('0x51')]['id']}},_0x16bb7c={};_0x16bb7c['model']=_[_0x93d4('0x3f')](db[_0x93d4('0x3a')][_0x93d4('0x3b')]);_0x16bb7c[_0x93d4('0x3e')]=_[_0x93d4('0x3f')](_0x3df59b['query']);_0x16bb7c[_0x93d4('0x40')]=_['intersection'](_0x16bb7c[_0x93d4('0x3d')],_0x16bb7c[_0x93d4('0x3e')]);_0x28987b[_0x93d4('0x41')]=_[_0x93d4('0x42')](_0x16bb7c[_0x93d4('0x3d')],qs[_0x93d4('0x52')](_0x3df59b[_0x93d4('0x3e')][_0x93d4('0x52')]));_0x28987b[_0x93d4('0x41')]=_0x28987b[_0x93d4('0x41')][_0x93d4('0x43')]?_0x28987b[_0x93d4('0x41')]:_0x16bb7c[_0x93d4('0x3d')];if(_0x3df59b[_0x93d4('0x3e')][_0x93d4('0x53')]){_0x28987b[_0x93d4('0x4d')]=[{'all':!![]}];}_0x28987b=_[_0x93d4('0x49')]({},_0x28987b,_0x3df59b[_0x93d4('0x4c')]);return db['OpenchannelMessage'][_0x93d4('0x54')](_0x28987b)[_0x93d4('0x1e')](handleEntityNotFound(_0x151917,null))[_0x93d4('0x1e')](respondWithResult(_0x151917,null))[_0x93d4('0x26')](handleError(_0x151917,null));};exports[_0x93d4('0x55')]=function(_0x30e106,_0xcc3f52){return db[_0x93d4('0x3a')][_0x93d4('0x55')](_0x30e106[_0x93d4('0x56')],{})[_0x93d4('0x1e')](respondWithResult(_0xcc3f52,0xc9))[_0x93d4('0x26')](handleError(_0xcc3f52,null));};exports[_0x93d4('0x34')]=function(_0x42439f,_0x17d82c){if(_0x42439f[_0x93d4('0x56')]['id']){delete _0x42439f[_0x93d4('0x56')]['id'];}return db[_0x93d4('0x3a')]['find']({'where':{'id':_0x42439f['params']['id']}})[_0x93d4('0x1e')](handleEntityNotFound(_0x17d82c,null))[_0x93d4('0x1e')](saveUpdates(_0x42439f[_0x93d4('0x56')],null))[_0x93d4('0x1e')](respondWithResult(_0x17d82c,null))[_0x93d4('0x26')](handleError(_0x17d82c,null));};exports[_0x93d4('0x35')]=function(_0x301c8d,_0x4918e6){return db[_0x93d4('0x3a')][_0x93d4('0x54')]({'where':{'id':_0x301c8d[_0x93d4('0x51')]['id']}})[_0x93d4('0x1e')](handleEntityNotFound(_0x4918e6,null))['then'](removeEntity(_0x4918e6,null))['catch'](handleError(_0x4918e6,null));};exports[_0x93d4('0x57')]=function(_0xa00b8,_0x4e0f09){return db[_0x93d4('0x3a')][_0x93d4('0x57')]()[_0x93d4('0x1e')](respondWithResult(_0x4e0f09,null))[_0x93d4('0x26')](handleError(_0x4e0f09,null));};var interaction_log=require(_0x93d4('0x12'))(_0x93d4('0x58'));exports[_0x93d4('0x59')]=function(_0x10f735,_0x36c485,_0x174906){var _0x174955={'agent':{},'channel':_0x93d4('0x5a')};if(_0x10f735[_0x93d4('0x56')]['id']){delete _0x10f735[_0x93d4('0x56')]['id'];}_0x10f735[_0x93d4('0x56')][_0x93d4('0x5b')]=!![];_0x10f735[_0x93d4('0x56')][_0x93d4('0x5c')]=moment()['format'](_0x93d4('0x5d'));_0x10f735[_0x93d4('0x56')]['UserId']=_0x10f735[_0x93d4('0x56')]['UserId']||_0x10f735[_0x93d4('0x5e')]['id'];_0x174955['agent']['id']=_0x10f735['body'][_0x93d4('0x5f')];return db[_0x93d4('0x3a')][_0x93d4('0x54')]({'where':{'id':_0x10f735[_0x93d4('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x36c485,null))[_0x93d4('0x1e')](saveUpdates(_0x10f735[_0x93d4('0x56')],null))[_0x93d4('0x1e')](function(_0x30feea){if(_0x30feea){_0x174955[_0x93d4('0x24')]=_0x30feea['get']({'plain':!![]});return db[_0x93d4('0x60')][_0x93d4('0x54')]({'where':{'id':_0x30feea['OpenchannelInteractionId']}});}return null;})[_0x93d4('0x1e')](handleEntityNotFound(_0x36c485,null))[_0x93d4('0x1e')](function(_0x32b982){if(_0x32b982){return _0x32b982['update']({'UserId':_0x10f735[_0x93d4('0x56')][_0x93d4('0x5f')],'read1stAt':_['isNil'](_0x32b982[_0x93d4('0x61')])?moment()['format'](_0x93d4('0x5d')):undefined});}return null;})['then'](function(_0x4f6dd7){if(_0x4f6dd7){_0x174955[_0x93d4('0x62')]=_0x4f6dd7['get']({'plain':!![]});interaction_log[_0x93d4('0x25')](_0x93d4('0x63'),_0x10f735[_0x93d4('0x5e')]['id'],_0x10f735[_0x93d4('0x5e')][_0x93d4('0x37')],_0x10f735[_0x93d4('0x5e')][_0x93d4('0x64')],_0x174955['interaction']['id'],_0x10f735['body']?JSON['stringify'](_0x10f735[_0x93d4('0x56')]):_0x93d4('0x65'));return respondWithRpcPromise(_0x93d4('0x66'),_0x93d4('0x67'),_0x174955);}return null;})['then'](function(_0x18ce4c){var _0x2104c0=_0x93d4('0x68')+_0x18ce4c[_0x93d4('0x24')][_0x93d4('0x69')];return db[_0x93d4('0x6a')]['query'](_0x2104c0,{'type':db['Sequelize'][_0x93d4('0x6b')][_0x93d4('0x6c')],'raw':!![]})[_0x93d4('0x1e')](function(_0x42faa8){return _0x42faa8;});})[_0x93d4('0x1e')](function(_0x1d0b6e){if(_0x1d0b6e){_0x174955['message']['contact']=_0x1d0b6e[0x0];if(!_0x10f735[_0x93d4('0x56')][_0x93d4('0x5f')])return;return db[_0x93d4('0x6d')][_0x93d4('0x54')]({'where':{'id':_0x10f735[_0x93d4('0x56')][_0x93d4('0x5f')],'role':'agent'},'attributes':['id',_0x93d4('0x37'),_0x93d4('0x6e'),_0x93d4('0x6f'),_0x93d4('0x70')],'raw':!![]});}return null;})['then'](function(_0x5d3702){if(!_0x5d3702)return null;_0x174955[_0x93d4('0x24')]['agent']=_0x5d3702;return _0x174955;})['then'](function(_0x125c65){if(_0x125c65){if(_0x10f735[_0x93d4('0x56')]['manual']){_0x174955[_0x93d4('0x24')]['interface']=util[_0x93d4('0x71')](_0x93d4('0x72'),_0x10f735[_0x93d4('0x5e')][_0x93d4('0x37')]);_0x174955['message'][_0x93d4('0x73')]=_0x174955[_0x93d4('0x73')];_0x174955[_0x93d4('0x24')]['motionChannel']=_0x174955[_0x93d4('0x73')];_0x174955[_0x93d4('0x24')]['event']=_0x93d4('0x59');return respondWithRpcPromise(_0x93d4('0x74'),_0x93d4('0x74'),{'event':_0x93d4('0x75'),'message':_0x174955[_0x93d4('0x24')]},client9002)[_0x93d4('0x1e')](function(){return _0x174955;});}return _0x174955;}return null;})['then'](respondWithResult(_0x36c485,null))['catch'](handleError(_0x36c485,null));};var interaction_log=require(_0x93d4('0x12'))('openchannel-interactions');exports[_0x93d4('0x32')]=function(_0x2b70bc,_0x25f042,_0x21b784){var _0x31aec8={'agent':{},'channel':_0x93d4('0x5a')};if(_0x2b70bc['body']['id']){delete _0x2b70bc[_0x93d4('0x56')]['id'];}_0x2b70bc[_0x93d4('0x56')][_0x93d4('0x5f')]=_0x2b70bc[_0x93d4('0x56')][_0x93d4('0x5f')]||_0x2b70bc['user']['id'];_0x31aec8[_0x93d4('0x76')]['id']=_0x2b70bc[_0x93d4('0x56')]['UserId'];return db['OpenchannelMessage']['find']({'where':{'id':_0x2b70bc[_0x93d4('0x51')]['id'],'UserId':null}})[_0x93d4('0x1e')](handleEntityNotFound(_0x25f042,null))['then'](function(_0x2a12b7){if(_0x2a12b7){_0x31aec8[_0x93d4('0x24')]=_0x2a12b7['get']({'plain':!![]});return db[_0x93d4('0x60')]['find']({'where':{'id':_0x2a12b7[_0x93d4('0x77')]}});}return null;})[_0x93d4('0x1e')](handleEntityNotFound(_0x25f042,null))[_0x93d4('0x1e')](function(_0x2b98c9){if(_0x2b98c9){_0x31aec8['interaction']=_0x2b98c9[_0x93d4('0x78')]({'plain':!![]});interaction_log['info'](_0x93d4('0x79'),_0x2b70bc[_0x93d4('0x5e')]['id'],_0x2b70bc[_0x93d4('0x5e')][_0x93d4('0x37')],_0x2b70bc[_0x93d4('0x5e')]['role'],_0x31aec8[_0x93d4('0x62')]['id'],_0x2b70bc['body']?JSON[_0x93d4('0x7a')](_0x2b70bc[_0x93d4('0x56')]):'null');return respondWithRpcPromise(_0x93d4('0x7b'),'rejectMessage',_0x31aec8);}return null;})[_0x93d4('0x1e')](function(_0x2b794b){var _0x37a82a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2b794b[_0x93d4('0x24')][_0x93d4('0x69')];return db['sequelize'][_0x93d4('0x3e')](_0x37a82a,{'type':db['Sequelize']['QueryTypes'][_0x93d4('0x6c')],'raw':!![]})[_0x93d4('0x1e')](function(_0x1ea1a0){return _0x1ea1a0;});})[_0x93d4('0x1e')](function(_0x1f0172){if(_0x1f0172){_0x31aec8[_0x93d4('0x24')][_0x93d4('0x7c')]=_0x1f0172[0x0];if(!_0x2b70bc[_0x93d4('0x56')][_0x93d4('0x5f')])return;return db[_0x93d4('0x6d')][_0x93d4('0x54')]({'where':{'id':_0x2b70bc[_0x93d4('0x56')]['UserId'],'role':'agent'},'attributes':['id','name',_0x93d4('0x6e'),_0x93d4('0x6f'),_0x93d4('0x70')],'raw':!![]});}return null;})[_0x93d4('0x1e')](function(_0x64a2b5){if(!_0x64a2b5)return null;_0x31aec8[_0x93d4('0x24')]['agent']=_0x64a2b5;return _0x31aec8;})['then'](function(_0x4463ae){if(_0x4463ae){_0x4463ae[_0x93d4('0x24')]['interface']=util[_0x93d4('0x71')](_0x93d4('0x72'),_0x2b70bc[_0x93d4('0x5e')][_0x93d4('0x37')]);_0x4463ae[_0x93d4('0x24')][_0x93d4('0x73')]=_0x31aec8[_0x93d4('0x73')];_0x4463ae[_0x93d4('0x24')]['motionChannel']=_0x31aec8[_0x93d4('0x73')];_0x4463ae[_0x93d4('0x24')][_0x93d4('0x7d')]=_0x93d4('0x32');respondWithRpcPromise(_0x93d4('0x74'),_0x93d4('0x74'),{'event':'rejectmessage','message':_0x4463ae[_0x93d4('0x24')]},client9002);return _0x31aec8;}return null;})[_0x93d4('0x1e')](respondWithResult(_0x25f042,null))[_0x93d4('0x26')](handleError(_0x25f042,null));}; \ No newline at end of file +var _0xbc4a=['format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','email','EventManager','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','sendStatus','status','end','json','undefined','limit','offset','count','set','apply','reject','stack','name','send','map','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','OpenchannelMessage','include','findAll','rows','catch','show','params','rawAttributes','includeAll','options','create','body','update','find','destroy','describe','openchannel-interactions','read','readAt'];(function(_0x254635,_0x472b4c){var _0x35293c=function(_0x731a6d){while(--_0x731a6d){_0x254635['push'](_0x254635['shift']());}};_0x35293c(++_0x472b4c);}(_0xbc4a,0x137));var _0xabc4=function(_0x5729e7,_0x2f7320){_0x5729e7=_0x5729e7-0x0;var _0x4c25c4=_0xbc4a[_0x5729e7];return _0x4c25c4;};'use strict';var emlformat=require(_0xabc4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xabc4('0x1'));var jsonpatch=require(_0xabc4('0x2'));var rp=require(_0xabc4('0x3'));var moment=require(_0xabc4('0x4'));var BPromise=require(_0xabc4('0x5'));var Mustache=require(_0xabc4('0x6'));var util=require(_0xabc4('0x7'));var path=require(_0xabc4('0x8'));var sox=require(_0xabc4('0x9'));var csv=require(_0xabc4('0xa'));var ejs=require(_0xabc4('0xb'));var fs=require('fs');var fs_extra=require(_0xabc4('0xc'));var _=require(_0xabc4('0xd'));var squel=require(_0xabc4('0xe'));var crypto=require(_0xabc4('0xf'));var jsforce=require(_0xabc4('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xabc4('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xabc4('0x11'));var authService=require(_0xabc4('0x12'));var qs=require(_0xabc4('0x13'));var as=require(_0xabc4('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xabc4('0x15'))(_0xabc4('0x16'));var utils=require('../../config/utils');var config=require(_0xabc4('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xabc4('0x18')](config[_0xabc4('0x19')],{'host':_0xabc4('0x1a'),'port':0x18eb});var socket=require(_0xabc4('0x1b'))(new Redis(config[_0xabc4('0x19')]));require('./openchannelMessage.socket')[_0xabc4('0x1c')](socket);var jayson=require(_0xabc4('0x1d'));var client=jayson[_0xabc4('0x1e')][_0xabc4('0x1f')]({'port':0x232c});var client9002=jayson[_0xabc4('0x1e')][_0xabc4('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x4caca3,_0x3f1893,_0x21c883,_0x1e74c2){return new BPromise(function(_0x37b382,_0xff3a27){var _0xa8bfe=_0x1e74c2||client;return _0xa8bfe[_0xabc4('0x20')](_0x4caca3,_0x21c883)[_0xabc4('0x21')](function(_0x454e6c){logger['info'](_0xabc4('0x22'),_0x3f1893,'request\x20sent');logger[_0xabc4('0x23')](_0xabc4('0x24'),_0x3f1893,'request\x20sent',JSON[_0xabc4('0x25')](_0x454e6c));if(_0x454e6c['error']){if(_0x454e6c[_0xabc4('0x26')][_0xabc4('0x27')]===0x1f4){logger[_0xabc4('0x26')](_0xabc4('0x22'),_0x3f1893,_0x454e6c[_0xabc4('0x26')][_0xabc4('0x28')]);return _0xff3a27(_0x454e6c[_0xabc4('0x26')][_0xabc4('0x28')]);}logger[_0xabc4('0x26')](_0xabc4('0x22'),_0x3f1893,_0x454e6c[_0xabc4('0x26')][_0xabc4('0x28')]);return _0x37b382(_0x454e6c[_0xabc4('0x26')][_0xabc4('0x28')]);}else{logger[_0xabc4('0x29')]('OpenchannelMessage,\x20%s,\x20%s',_0x3f1893,_0xabc4('0x2a'));_0x37b382(_0x454e6c['result'][_0xabc4('0x28')]);}})['catch'](function(_0x5129b7){logger[_0xabc4('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x3f1893,_0x5129b7);_0xff3a27(_0x5129b7);});});}function respondWithStatusCode(_0x2ee44d,_0x265c21){_0x265c21=_0x265c21||0xcc;return function(_0x361ffe){if(_0x361ffe){return _0x2ee44d[_0xabc4('0x2b')](_0x265c21);}return _0x2ee44d[_0xabc4('0x2c')](_0x265c21)[_0xabc4('0x2d')]();};}function respondWithResult(_0xa81f89,_0x42f4e9){_0x42f4e9=_0x42f4e9||0xc8;return function(_0x26c969){if(_0x26c969){return _0xa81f89['status'](_0x42f4e9)[_0xabc4('0x2e')](_0x26c969);}};}function respondWithFilteredResult(_0x2524a7,_0x5cbcf7){return function(_0x172e60){if(_0x172e60){var _0x5f49a4=typeof _0x5cbcf7['offset']===_0xabc4('0x2f')&&typeof _0x5cbcf7[_0xabc4('0x30')]===_0xabc4('0x2f');var _0x145977=_0x172e60['count'];var _0x22ea00=_0x5f49a4?0x0:_0x5cbcf7[_0xabc4('0x31')];var _0x5aa975=_0x5f49a4?_0x172e60[_0xabc4('0x32')]:_0x5cbcf7[_0xabc4('0x31')]+_0x5cbcf7[_0xabc4('0x30')];var _0x28d0a2;if(_0x5aa975>=_0x145977){_0x5aa975=_0x145977;_0x28d0a2=0xc8;}else{_0x28d0a2=0xce;}_0x2524a7['status'](_0x28d0a2);return _0x2524a7[_0xabc4('0x33')]('Content-Range',_0x22ea00+'-'+_0x5aa975+'/'+_0x145977)[_0xabc4('0x2e')](_0x172e60);}return null;};}function patchUpdates(_0x4dc842){return function(_0x4691fa){try{jsonpatch[_0xabc4('0x34')](_0x4691fa,_0x4dc842,!![]);}catch(_0x53849c){return BPromise[_0xabc4('0x35')](_0x53849c);}return _0x4691fa['save']();};}function saveUpdates(_0x310096,_0x2c5501){return function(_0x4019da){if(_0x4019da){return _0x4019da['update'](_0x310096)[_0xabc4('0x21')](function(_0x7836d7){return _0x7836d7;});}return null;};}function removeEntity(_0x3c1231,_0x378db9){return function(_0x12b9b1){if(_0x12b9b1){return _0x12b9b1['destroy']()[_0xabc4('0x21')](function(){_0x3c1231['status'](0xcc)[_0xabc4('0x2d')]();});}};}function handleEntityNotFound(_0x3040a3,_0xd3da48){return function(_0xba3ecb){if(!_0xba3ecb){_0x3040a3[_0xabc4('0x2b')](0x194);}return _0xba3ecb;};}function handleError(_0x60a08e,_0x388b54){_0x388b54=_0x388b54||0x1f4;return function(_0x12a9c0){logger['error'](_0x12a9c0[_0xabc4('0x36')]);if(_0x12a9c0[_0xabc4('0x37')]){delete _0x12a9c0[_0xabc4('0x37')];}_0x60a08e[_0xabc4('0x2c')](_0x388b54)[_0xabc4('0x38')](_0x12a9c0);};}exports['index']=function(_0x24f033,_0x4e6644){var _0x360d38={},_0x5290a5={},_0x4cc707={'count':0x0,'rows':[]};var _0x5e1ebe=_[_0xabc4('0x39')](db['OpenchannelMessage']['rawAttributes'],function(_0x142165){return{'name':_0x142165[_0xabc4('0x3a')],'type':_0x142165['type'][_0xabc4('0x3b')]};});_0x5290a5[_0xabc4('0x3c')]=_[_0xabc4('0x39')](_0x5e1ebe,_0xabc4('0x37'));_0x5290a5['query']=_[_0xabc4('0x3d')](_0x24f033[_0xabc4('0x3e')]);_0x5290a5['filters']=_[_0xabc4('0x3f')](_0x5290a5['model'],_0x5290a5[_0xabc4('0x3e')]);_0x360d38[_0xabc4('0x40')]=_[_0xabc4('0x3f')](_0x5290a5[_0xabc4('0x3c')],qs['fields'](_0x24f033[_0xabc4('0x3e')][_0xabc4('0x41')]));_0x360d38[_0xabc4('0x40')]=_0x360d38[_0xabc4('0x40')][_0xabc4('0x42')]?_0x360d38[_0xabc4('0x40')]:_0x5290a5[_0xabc4('0x3c')];if(!_0x24f033[_0xabc4('0x3e')][_0xabc4('0x43')](_0xabc4('0x44'))){_0x360d38['limit']=qs[_0xabc4('0x30')](_0x24f033[_0xabc4('0x3e')][_0xabc4('0x30')]);_0x360d38[_0xabc4('0x31')]=qs[_0xabc4('0x31')](_0x24f033[_0xabc4('0x3e')][_0xabc4('0x31')]);}_0x360d38[_0xabc4('0x45')]=qs[_0xabc4('0x46')](_0x24f033[_0xabc4('0x3e')][_0xabc4('0x46')]);_0x360d38['where']=qs[_0xabc4('0x47')](_[_0xabc4('0x48')](_0x24f033['query'],_0x5290a5['filters']),_0x5e1ebe);if(_0x24f033[_0xabc4('0x3e')][_0xabc4('0x49')]){_0x360d38[_0xabc4('0x4a')]=_[_0xabc4('0x4b')](_0x360d38[_0xabc4('0x4a')],{'$or':_[_0xabc4('0x39')](_0x5e1ebe,function(_0x2c95cf){if(_0x2c95cf[_0xabc4('0x4c')]!==_0xabc4('0x4d')){var _0x50c657={};_0x50c657[_0x2c95cf[_0xabc4('0x37')]]={'$like':'%'+_0x24f033[_0xabc4('0x3e')][_0xabc4('0x49')]+'%'};return _0x50c657;}})});}_0x360d38=_[_0xabc4('0x4b')]({},_0x360d38,_0x24f033['options']);var _0x526d60={'where':_0x360d38[_0xabc4('0x4a')]};return db[_0xabc4('0x4e')][_0xabc4('0x32')](_0x526d60)[_0xabc4('0x21')](function(_0x1ecafa){_0x4cc707[_0xabc4('0x32')]=_0x1ecafa;if(_0x24f033[_0xabc4('0x3e')]['includeAll']){_0x360d38[_0xabc4('0x4f')]=[{'all':!![]}];}return db[_0xabc4('0x4e')][_0xabc4('0x50')](_0x360d38);})[_0xabc4('0x21')](function(_0x1e0a6e){_0x4cc707[_0xabc4('0x51')]=_0x1e0a6e;return _0x4cc707;})['then'](respondWithFilteredResult(_0x4e6644,_0x360d38))[_0xabc4('0x52')](handleError(_0x4e6644,null));};exports[_0xabc4('0x53')]=function(_0x2fe919,_0x2de0fb){var _0x51e1b1={'raw':!![],'where':{'id':_0x2fe919[_0xabc4('0x54')]['id']}},_0x385046={};_0x385046[_0xabc4('0x3c')]=_[_0xabc4('0x3d')](db[_0xabc4('0x4e')][_0xabc4('0x55')]);_0x385046[_0xabc4('0x3e')]=_[_0xabc4('0x3d')](_0x2fe919['query']);_0x385046[_0xabc4('0x47')]=_['intersection'](_0x385046[_0xabc4('0x3c')],_0x385046[_0xabc4('0x3e')]);_0x51e1b1[_0xabc4('0x40')]=_['intersection'](_0x385046[_0xabc4('0x3c')],qs['fields'](_0x2fe919[_0xabc4('0x3e')]['fields']));_0x51e1b1['attributes']=_0x51e1b1[_0xabc4('0x40')][_0xabc4('0x42')]?_0x51e1b1['attributes']:_0x385046['model'];if(_0x2fe919[_0xabc4('0x3e')][_0xabc4('0x56')]){_0x51e1b1[_0xabc4('0x4f')]=[{'all':!![]}];}_0x51e1b1=_[_0xabc4('0x4b')]({},_0x51e1b1,_0x2fe919[_0xabc4('0x57')]);return db['OpenchannelMessage']['find'](_0x51e1b1)[_0xabc4('0x21')](handleEntityNotFound(_0x2de0fb,null))[_0xabc4('0x21')](respondWithResult(_0x2de0fb,null))[_0xabc4('0x52')](handleError(_0x2de0fb,null));};exports[_0xabc4('0x58')]=function(_0x5a4f4b,_0x55083e){return db[_0xabc4('0x4e')][_0xabc4('0x58')](_0x5a4f4b[_0xabc4('0x59')],{})[_0xabc4('0x21')](respondWithResult(_0x55083e,0xc9))[_0xabc4('0x52')](handleError(_0x55083e,null));};exports[_0xabc4('0x5a')]=function(_0x387b91,_0x526565){if(_0x387b91[_0xabc4('0x59')]['id']){delete _0x387b91[_0xabc4('0x59')]['id'];}return db[_0xabc4('0x4e')][_0xabc4('0x5b')]({'where':{'id':_0x387b91[_0xabc4('0x54')]['id']}})[_0xabc4('0x21')](handleEntityNotFound(_0x526565,null))[_0xabc4('0x21')](saveUpdates(_0x387b91[_0xabc4('0x59')],null))['then'](respondWithResult(_0x526565,null))[_0xabc4('0x52')](handleError(_0x526565,null));};exports[_0xabc4('0x5c')]=function(_0x26418c,_0x26e7f5){return db[_0xabc4('0x4e')][_0xabc4('0x5b')]({'where':{'id':_0x26418c[_0xabc4('0x54')]['id']}})[_0xabc4('0x21')](handleEntityNotFound(_0x26e7f5,null))['then'](removeEntity(_0x26e7f5,null))[_0xabc4('0x52')](handleError(_0x26e7f5,null));};exports['describe']=function(_0x22310d,_0x1dd6a3){return db[_0xabc4('0x4e')][_0xabc4('0x5d')]()[_0xabc4('0x21')](respondWithResult(_0x1dd6a3,null))[_0xabc4('0x52')](handleError(_0x1dd6a3,null));};var interaction_log=require(_0xabc4('0x15'))(_0xabc4('0x5e'));exports['accept']=function(_0x3988a6,_0x41d906,_0xadb46f){var _0x3c59a4={'agent':{},'channel':'openchannel'};if(_0x3988a6[_0xabc4('0x59')]['id']){delete _0x3988a6[_0xabc4('0x59')]['id'];}_0x3988a6[_0xabc4('0x59')][_0xabc4('0x5f')]=!![];_0x3988a6[_0xabc4('0x59')][_0xabc4('0x60')]=moment()[_0xabc4('0x61')](_0xabc4('0x62'));_0x3988a6[_0xabc4('0x59')][_0xabc4('0x63')]=_0x3988a6['body'][_0xabc4('0x63')]||_0x3988a6[_0xabc4('0x64')]['id'];_0x3c59a4[_0xabc4('0x65')]['id']=_0x3988a6['body'][_0xabc4('0x63')];return db[_0xabc4('0x4e')][_0xabc4('0x5b')]({'where':{'id':_0x3988a6[_0xabc4('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x41d906,null))[_0xabc4('0x21')](saveUpdates(_0x3988a6[_0xabc4('0x59')],null))[_0xabc4('0x21')](function(_0x539af8){if(_0x539af8){_0x3c59a4[_0xabc4('0x28')]=_0x539af8[_0xabc4('0x66')]({'plain':!![]});return db[_0xabc4('0x67')]['find']({'where':{'id':_0x539af8[_0xabc4('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x41d906,null))[_0xabc4('0x21')](function(_0x3675ac){if(_0x3675ac){return _0x3675ac[_0xabc4('0x5a')]({'UserId':_0x3988a6[_0xabc4('0x59')][_0xabc4('0x63')],'read1stAt':_[_0xabc4('0x69')](_0x3675ac['read1stAt'])?moment()['format'](_0xabc4('0x62')):undefined});}return null;})[_0xabc4('0x21')](function(_0x36b21d){if(_0x36b21d){_0x3c59a4[_0xabc4('0x6a')]=_0x36b21d[_0xabc4('0x66')]({'plain':!![]});interaction_log['info'](_0xabc4('0x6b'),_0x3988a6[_0xabc4('0x64')]['id'],_0x3988a6[_0xabc4('0x64')][_0xabc4('0x37')],_0x3988a6[_0xabc4('0x64')][_0xabc4('0x6c')],_0x3c59a4['interaction']['id'],_0x3988a6[_0xabc4('0x59')]?JSON[_0xabc4('0x25')](_0x3988a6[_0xabc4('0x59')]):_0xabc4('0x6d'));return respondWithRpcPromise(_0xabc4('0x6e'),_0xabc4('0x6f'),_0x3c59a4);}return null;})['then'](function(_0xa158c7){var _0x10ea7e=_0xabc4('0x70')+_0xa158c7[_0xabc4('0x28')][_0xabc4('0x71')];return db[_0xabc4('0x72')]['query'](_0x10ea7e,{'type':db[_0xabc4('0x73')][_0xabc4('0x74')][_0xabc4('0x75')],'raw':!![]})[_0xabc4('0x21')](function(_0x418f7b){return _0x418f7b;});})['then'](function(_0x5ab29b){if(_0x5ab29b){_0x3c59a4[_0xabc4('0x28')][_0xabc4('0x76')]=_0x5ab29b[0x0];if(!_0x3988a6[_0xabc4('0x59')]['UserId'])return;return db[_0xabc4('0x77')][_0xabc4('0x5b')]({'where':{'id':_0x3988a6['body'][_0xabc4('0x63')],'role':_0xabc4('0x65')},'attributes':['id',_0xabc4('0x37'),_0xabc4('0x78'),'email',_0xabc4('0x79')],'raw':!![]});}return null;})['then'](function(_0x36e858){if(!_0x36e858)return null;_0x3c59a4[_0xabc4('0x28')]['agent']=_0x36e858;return _0x3c59a4;})[_0xabc4('0x21')](function(_0x1035ef){if(_0x1035ef){if(_0x3988a6['body'][_0xabc4('0x7a')]){_0x3c59a4['message'][_0xabc4('0x7b')]=util[_0xabc4('0x61')](_0xabc4('0x7c'),_0x3988a6[_0xabc4('0x64')][_0xabc4('0x37')]);_0x3c59a4[_0xabc4('0x28')][_0xabc4('0x7d')]=_0x3c59a4[_0xabc4('0x7d')];_0x3c59a4[_0xabc4('0x28')][_0xabc4('0x7e')]=_0x3c59a4[_0xabc4('0x7d')];_0x3c59a4['message'][_0xabc4('0x7f')]=_0xabc4('0x80');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xabc4('0x81'),'message':_0x3c59a4['message']},client9002)['then'](function(){return _0x3c59a4;});}return _0x3c59a4;}return null;})[_0xabc4('0x21')](respondWithResult(_0x41d906,null))[_0xabc4('0x52')](handleError(_0x41d906,null));};var interaction_log=require(_0xabc4('0x15'))(_0xabc4('0x5e'));exports[_0xabc4('0x35')]=function(_0xa747da,_0x36a997,_0x1d4ff7){var _0x324e8d={'agent':{},'channel':'openchannel'};if(_0xa747da['body']['id']){delete _0xa747da[_0xabc4('0x59')]['id'];}_0xa747da[_0xabc4('0x59')][_0xabc4('0x63')]=_0xa747da[_0xabc4('0x59')][_0xabc4('0x63')]||_0xa747da[_0xabc4('0x64')]['id'];_0x324e8d[_0xabc4('0x65')]['id']=_0xa747da[_0xabc4('0x59')][_0xabc4('0x63')];return db['OpenchannelMessage'][_0xabc4('0x5b')]({'where':{'id':_0xa747da['params']['id'],'UserId':null}})[_0xabc4('0x21')](handleEntityNotFound(_0x36a997,null))['then'](function(_0x2dd87f){if(_0x2dd87f){_0x324e8d['message']=_0x2dd87f[_0xabc4('0x66')]({'plain':!![]});return db['OpenchannelInteraction'][_0xabc4('0x5b')]({'where':{'id':_0x2dd87f[_0xabc4('0x68')]}});}return null;})[_0xabc4('0x21')](handleEntityNotFound(_0x36a997,null))[_0xabc4('0x21')](function(_0x35c501){if(_0x35c501){_0x324e8d[_0xabc4('0x6a')]=_0x35c501[_0xabc4('0x66')]({'plain':!![]});interaction_log[_0xabc4('0x29')](_0xabc4('0x82'),_0xa747da[_0xabc4('0x64')]['id'],_0xa747da[_0xabc4('0x64')][_0xabc4('0x37')],_0xa747da[_0xabc4('0x64')][_0xabc4('0x6c')],_0x324e8d[_0xabc4('0x6a')]['id'],_0xa747da[_0xabc4('0x59')]?JSON[_0xabc4('0x25')](_0xa747da['body']):_0xabc4('0x6d'));return respondWithRpcPromise(_0xabc4('0x83'),_0xabc4('0x84'),_0x324e8d);}return null;})['then'](function(_0x2b965e){var _0xde7048='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2b965e[_0xabc4('0x28')][_0xabc4('0x71')];return db[_0xabc4('0x72')][_0xabc4('0x3e')](_0xde7048,{'type':db[_0xabc4('0x73')][_0xabc4('0x74')][_0xabc4('0x75')],'raw':!![]})['then'](function(_0x490464){return _0x490464;});})[_0xabc4('0x21')](function(_0x5541c4){if(_0x5541c4){_0x324e8d['message']['contact']=_0x5541c4[0x0];if(!_0xa747da[_0xabc4('0x59')][_0xabc4('0x63')])return;return db[_0xabc4('0x77')][_0xabc4('0x5b')]({'where':{'id':_0xa747da[_0xabc4('0x59')][_0xabc4('0x63')],'role':_0xabc4('0x65')},'attributes':['id','name','fullname',_0xabc4('0x85'),_0xabc4('0x79')],'raw':!![]});}return null;})[_0xabc4('0x21')](function(_0x1fc730){if(!_0x1fc730)return null;_0x324e8d['message'][_0xabc4('0x65')]=_0x1fc730;return _0x324e8d;})[_0xabc4('0x21')](function(_0x2da369){if(_0x2da369){_0x2da369[_0xabc4('0x28')][_0xabc4('0x7b')]=util[_0xabc4('0x61')](_0xabc4('0x7c'),_0xa747da['user']['name']);_0x2da369['message'][_0xabc4('0x7d')]=_0x324e8d[_0xabc4('0x7d')];_0x2da369[_0xabc4('0x28')]['motionChannel']=_0x324e8d[_0xabc4('0x7d')];_0x2da369['message'][_0xabc4('0x7f')]=_0xabc4('0x35');respondWithRpcPromise(_0xabc4('0x86'),_0xabc4('0x86'),{'event':_0xabc4('0x87'),'message':_0x2da369[_0xabc4('0x28')]},client9002);return _0x324e8d;}return null;})[_0xabc4('0x21')](respondWithResult(_0x36a997,null))['catch'](handleError(_0x36a997,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index efa0582..dfd5495 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 _0x18d5=['exports','../../mysqldb','OpenchannelMessage','setMaxListeners','update','remove','hasOwnProperty','hook'];(function(_0x39dc98,_0x60ce35){var _0x4f6309=function(_0x513e5d){while(--_0x513e5d){_0x39dc98['push'](_0x39dc98['shift']());}};_0x4f6309(++_0x60ce35);}(_0x18d5,0x1d1));var _0x518d=function(_0x415a14,_0x506241){_0x415a14=_0x415a14-0x0;var _0x5b4dc0=_0x18d5[_0x415a14];return _0x5b4dc0;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x518d('0x0'))['db'][_0x518d('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x518d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x518d('0x3'),'afterDestroy':_0x518d('0x4')};function emitEvent(_0x1c08b8){return function(_0x1672ef,_0x21c1d7,_0x14a9f7){OpenchannelMessageEvents['emit'](_0x1c08b8+':'+_0x1672ef['id'],_0x1672ef);OpenchannelMessageEvents['emit'](_0x1c08b8,_0x1672ef);_0x14a9f7(null);};}for(var e in events){if(events[_0x518d('0x5')](e)){var event=events[e];OpenchannelMessage[_0x518d('0x6')](e,emitEvent(event));}}module[_0x518d('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xadb8=['save','update','emit','hasOwnProperty','hook','exports','OpenchannelMessage','setMaxListeners'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0xadb8,0xce));var _0x8adb=function(_0x17730a,_0x362127){_0x17730a=_0x17730a-0x0;var _0x485db1=_0xadb8[_0x17730a];return _0x485db1;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require('../../mysqldb')['db'][_0x8adb('0x0')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x8adb('0x1')](0x0);var events={'afterCreate':_0x8adb('0x2'),'afterUpdate':_0x8adb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1a1d4c){return function(_0x212038,_0x35cc69,_0x1dd5a3){OpenchannelMessageEvents[_0x8adb('0x4')](_0x1a1d4c+':'+_0x212038['id'],_0x212038);OpenchannelMessageEvents[_0x8adb('0x4')](_0x1a1d4c,_0x212038);_0x1dd5a3(null);};}for(var e in events){if(events[_0x8adb('0x5')](e)){var event=events[e];OpenchannelMessage[_0x8adb('0x6')](e,emitEvent(event));}}module[_0x8adb('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 01b6698..0769438 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 _0xea28=['moment','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','update','createdAt','catch','error','CmContact','describe','then','OpenchannelAccount','find','OpenchannelAccountId','Interactions','get','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','omit','Contact','POST','GET','afterCreate','threadId','finally','utf8mb4','lodash','util','../../config/logger','api'];(function(_0x593846,_0x376959){var _0x10eeda=function(_0x3c185b){while(--_0x3c185b){_0x593846['push'](_0x593846['shift']());}};_0x10eeda(++_0x376959);}(_0xea28,0x13a));var _0x8ea2=function(_0x46c737,_0x214ecd){_0x46c737=_0x46c737-0x0;var _0x388796=_0xea28[_0x46c737];return _0x388796;};'use strict';var _=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var logger=require(_0x8ea2('0x2'))(_0x8ea2('0x3'));var moment=require(_0x8ea2('0x4'));var BPromise=require(_0x8ea2('0x5'));var rp=require(_0x8ea2('0x6'));var fs=require('fs');var path=require(_0x8ea2('0x7'));var rimraf=require('rimraf');var config=require(_0x8ea2('0x8'));var attributes=require(_0x8ea2('0x9'));module[_0x8ea2('0xa')]=function(_0x513a0d,_0x29b82b){return _0x513a0d[_0x8ea2('0xb')](_0x8ea2('0xc'),attributes,{'tableName':_0x8ea2('0xd'),'paranoid':![],'indexes':[{'name':_0x8ea2('0xe'),'fields':[_0x8ea2('0xf')],'type':_0x8ea2('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x320750,_0x3de4a1,_0x3000f9){var _0x3d0b35=_0x513a0d[_0x8ea2('0x11')];var _0x500b82=_0x320750['get']({'plain':!![]});if(_0x500b82[_0x8ea2('0x12')][_0x8ea2('0x13')]()==='in'||_0x500b82[_0x8ea2('0x12')]['toLowerCase']()===_0x8ea2('0x14')&&!_0x500b82[_0x8ea2('0x15')]&&!_[_0x8ea2('0x16')](_0x500b82[_0x8ea2('0x17')])){_0x3d0b35[_0x8ea2('0x18')]['findOne']({'where':{'id':_0x500b82[_0x8ea2('0x19')]}})['then'](function(_0x4b2192){if(_0x4b2192){_0x4b2192[_0x8ea2('0x1a')]({'lastMsgAt':_0x500b82[_0x8ea2('0x1b')],'lastMsgDirection':_0x500b82[_0x8ea2('0x12')][_0x8ea2('0x13')]()});}})[_0x8ea2('0x1c')](function(_0xbb9bd1){console[_0x8ea2('0x1d')](_0xbb9bd1);});}if(_0x500b82[_0x8ea2('0x12')]===_0x8ea2('0x14')&&!_0x500b82[_0x8ea2('0x15')]){var _0x2dfa7c;_0x3d0b35[_0x8ea2('0x1e')][_0x8ea2('0x1f')]()[_0x8ea2('0x20')](function(_0x1b64cf){return _0x3d0b35[_0x8ea2('0x21')][_0x8ea2('0x22')]({'where':{'id':_0x500b82[_0x8ea2('0x23')]},'include':[{'model':_0x3d0b35[_0x8ea2('0x18')],'as':_0x8ea2('0x24'),'where':{'id':_0x500b82[_0x8ea2('0x19')]},'limit':0x1,'include':[{'model':_0x3d0b35[_0x8ea2('0x1e')],'as':'Contact','attributes':_['keys'](_0x1b64cf)}]}]});})[_0x8ea2('0x20')](function(_0x248c18){_0x2dfa7c=_0x248c18[_0x8ea2('0x25')]({'plain':!![]});if(_0x2dfa7c&&_0x2dfa7c['replyUri']){logger[_0x8ea2('0x26')](_0x8ea2('0x27'),'afterCreate',util[_0x8ea2('0x28')](_0x8ea2('0x29'),_0x500b82['id'],_0x2dfa7c[_0x8ea2('0x2a')]));if(_0x2dfa7c[_0x8ea2('0x24')]&&_0x2dfa7c[_0x8ea2('0x24')][_0x8ea2('0x2b')]){_0x500b82[_0x8ea2('0x2c')]=_[_0x8ea2('0x2d')](_0x2dfa7c[_0x8ea2('0x24')][0x0],'Contact');_0x500b82[_0x8ea2('0x2e')]=_0x2dfa7c['Interactions'][0x0][_0x8ea2('0x2e')];}var _0x3de4a1={'method':_0x8ea2('0x2f'),'uri':encodeURI(_0x2dfa7c['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3de4a1['method']){case _0x8ea2('0x30'):_0x3de4a1['qs']=_0x500b82;break;case'POST':_0x3de4a1[_0x8ea2('0xf')]=_0x500b82;break;}return rp(_0x3de4a1)['then'](function(_0x3be291){logger[_0x8ea2('0x26')](_0x8ea2('0x27'),_0x8ea2('0x31'),util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x500b82['id'],_0x2dfa7c[_0x8ea2('0x2a')]));if(_0x3be291['body'][_0x8ea2('0x32')]&&_0x3be291[_0x8ea2('0xf')][_0x8ea2('0x32')]!=_0x500b82[_0x8ea2('0x2c')][_0x8ea2('0x32')]){return _0x3d0b35[_0x8ea2('0x18')][_0x8ea2('0x1a')]({'threadId':_0x3be291[_0x8ea2('0xf')][_0x8ea2('0x32')]},{'logging':!![],'where':{'id':_0x500b82[_0x8ea2('0x2c')]['id']}});}else{return;}})['then'](function(){return _0x320750['update']({'read':!![]});})[_0x8ea2('0x1c')](function(_0x188553){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x8ea2('0x31'),util['inspect'](_0x188553,{'showHidden':![],'depth':null}));_0x3000f9();});}else{_0x3000f9();}})[_0x8ea2('0x33')](function(){_0x3000f9();});}else{_0x3000f9();}}},'charset':_0x8ea2('0x34'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1a85=['openchannel_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','error','CmContact','then','OpenchannelAccount','find','OpenchannelAccountId','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','POST','method','GET','info','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','inspect','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','OpenchannelMessage'];(function(_0x3803a6,_0x4fd85a){var _0x446812=function(_0x172c6f){while(--_0x172c6f){_0x3803a6['push'](_0x3803a6['shift']());}};_0x446812(++_0x4fd85a);}(_0x1a85,0x178));var _0x51a8=function(_0x450f09,_0x59561d){_0x450f09=_0x450f09-0x0;var _0x4e22ec=_0x1a85[_0x450f09];return _0x4e22ec;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x51a8('0x0'))(_0x51a8('0x1'));var moment=require(_0x51a8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x51a8('0x3'));var rimraf=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var attributes=require('./openchannelMessage.attributes');module[_0x51a8('0x6')]=function(_0x4b76a8,_0x2c1180){return _0x4b76a8['define'](_0x51a8('0x7'),attributes,{'tableName':_0x51a8('0x8'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x51a8('0x9')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x56e1b4,_0x39e06a,_0x2f276b){var _0x1a476d=_0x4b76a8[_0x51a8('0xa')];var _0x418f06=_0x56e1b4[_0x51a8('0xb')]({'plain':!![]});if(_0x418f06[_0x51a8('0xc')][_0x51a8('0xd')]()==='in'||_0x418f06[_0x51a8('0xc')][_0x51a8('0xd')]()===_0x51a8('0xe')&&!_0x418f06[_0x51a8('0xf')]&&!_[_0x51a8('0x10')](_0x418f06[_0x51a8('0x11')])){_0x1a476d[_0x51a8('0x12')][_0x51a8('0x13')]({'where':{'id':_0x418f06[_0x51a8('0x14')]}})['then'](function(_0x461f5c){if(_0x461f5c){_0x461f5c[_0x51a8('0x15')]({'lastMsgAt':_0x418f06[_0x51a8('0x16')],'lastMsgDirection':_0x418f06['direction'][_0x51a8('0xd')]()});}})['catch'](function(_0x10584b){console[_0x51a8('0x17')](_0x10584b);});}if(_0x418f06[_0x51a8('0xc')]===_0x51a8('0xe')&&!_0x418f06[_0x51a8('0xf')]){var _0x3e0603;_0x1a476d[_0x51a8('0x18')]['describe']()[_0x51a8('0x19')](function(_0x45a433){return _0x1a476d[_0x51a8('0x1a')][_0x51a8('0x1b')]({'where':{'id':_0x418f06[_0x51a8('0x1c')]},'include':[{'model':_0x1a476d[_0x51a8('0x12')],'as':'Interactions','where':{'id':_0x418f06[_0x51a8('0x14')]},'limit':0x1,'include':[{'model':_0x1a476d[_0x51a8('0x18')],'as':_0x51a8('0x1d'),'attributes':_[_0x51a8('0x1e')](_0x45a433)}]}]});})[_0x51a8('0x19')](function(_0x3bc044){_0x3e0603=_0x3bc044[_0x51a8('0xb')]({'plain':!![]});if(_0x3e0603&&_0x3e0603[_0x51a8('0x1f')]){logger['info'](_0x51a8('0x20'),'afterCreate',util[_0x51a8('0x21')](_0x51a8('0x22'),_0x418f06['id'],_0x3e0603[_0x51a8('0x1f')]));if(_0x3e0603[_0x51a8('0x23')]&&_0x3e0603['Interactions'][_0x51a8('0x24')]){_0x418f06['Interaction']=_['omit'](_0x3e0603[_0x51a8('0x23')][0x0],'Contact');_0x418f06[_0x51a8('0x1d')]=_0x3e0603[_0x51a8('0x23')][0x0][_0x51a8('0x1d')];}var _0x39e06a={'method':_0x51a8('0x25'),'uri':encodeURI(_0x3e0603[_0x51a8('0x1f')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x39e06a[_0x51a8('0x26')]){case _0x51a8('0x27'):_0x39e06a['qs']=_0x418f06;break;case'POST':_0x39e06a[_0x51a8('0x9')]=_0x418f06;break;}return rp(_0x39e06a)[_0x51a8('0x19')](function(_0xca5746){logger[_0x51a8('0x28')](_0x51a8('0x20'),_0x51a8('0x29'),util[_0x51a8('0x21')](_0x51a8('0x2a'),_0x418f06['id'],_0x3e0603[_0x51a8('0x1f')]));if(_0xca5746[_0x51a8('0x9')][_0x51a8('0x2b')]&&_0xca5746[_0x51a8('0x9')]['threadId']!=_0x418f06[_0x51a8('0x2c')]['threadId']){return _0x1a476d[_0x51a8('0x12')][_0x51a8('0x15')]({'threadId':_0xca5746[_0x51a8('0x9')][_0x51a8('0x2b')]},{'logging':!![],'where':{'id':_0x418f06[_0x51a8('0x2c')]['id']}});}else{return;}})['then'](function(){return _0x56e1b4[_0x51a8('0x15')]({'read':!![]});})['catch'](function(_0x41c4de){logger[_0x51a8('0x17')](_0x51a8('0x20'),'afterCreate',util[_0x51a8('0x2d')](_0x41c4de,{'showHidden':![],'depth':null}));_0x2f276b();});}else{_0x2f276b();}})['finally'](function(){_0x2f276b();});}else{_0x2f276b();}}},'charset':_0x51a8('0x2e'),'collate':_0x51a8('0x2f')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 3755938..52587cd 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 _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x5e7f86,_0x2333a5){var _0x3bfe5f=function(_0x49c69f){while(--_0x49c69f){_0x5e7f86['push'](_0x5e7f86['shift']());}};_0x3bfe5f(++_0x2333a5);}(_0x7a54,0x106));var _0x47a5=function(_0x4f90fc,_0x47b047){_0x4f90fc=_0x4f90fc-0x0;var _0x1eea1a=_0x7a54[_0x4f90fc];return _0x1eea1a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file +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(_0x1d5910,_0x2d74de){var _0x509012=function(_0x2844fd){while(--_0x2844fd){_0x1d5910['push'](_0x1d5910['shift']());}};_0x509012(++_0x2d74de);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x5f66[_0x4c12ec];return _0x3ae42c;};'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 5547b98..324975e 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 _0x943a=['./openchannelMessage.events','update','register','openchannelMessage:'];(function(_0x43a9a7,_0x381320){var _0x16e607=function(_0x24bf22){while(--_0x24bf22){_0x43a9a7['push'](_0x43a9a7['shift']());}};_0x16e607(++_0x381320);}(_0x943a,0xfc));var _0xa943=function(_0x2eacb1,_0x3dfca0){_0x2eacb1=_0x2eacb1-0x0;var _0x203502=_0x943a[_0x2eacb1];return _0x203502;};'use strict';var OpenchannelMessageEvents=require(_0xa943('0x0'));var events=['save','remove',_0xa943('0x1')];function createListener(_0x26c22,_0x2b3944){return function(_0x53ae23){_0x2b3944['emit'](_0x26c22,_0x53ae23);};}function removeListener(_0x4480ad,_0x34ce5a){return function(){OpenchannelMessageEvents['removeListener'](_0x4480ad,_0x34ce5a);};}exports[_0xa943('0x2')]=function(_0x441e94){for(var _0x1069d5=0x0,_0x57ae25=events['length'];_0x1069d5<_0x57ae25;_0x1069d5++){var _0xb4bc1c=events[_0x1069d5];var _0x727619=createListener(_0xa943('0x3')+_0xb4bc1c,_0x441e94);OpenchannelMessageEvents['on'](_0xb4bc1c,_0x727619);}}; \ No newline at end of file +var _0x724d=['emit','removeListener','register','length','openchannelMessage:','./openchannelMessage.events','save','remove'];(function(_0x22c597,_0x1b85f5){var _0x42ded4=function(_0x31cecc){while(--_0x31cecc){_0x22c597['push'](_0x22c597['shift']());}};_0x42ded4(++_0x1b85f5);}(_0x724d,0xe5));var _0xd724=function(_0x3d5f84,_0x569548){_0x3d5f84=_0x3d5f84-0x0;var _0x1981b8=_0x724d[_0x3d5f84];return _0x1981b8;};'use strict';var OpenchannelMessageEvents=require(_0xd724('0x0'));var events=[_0xd724('0x1'),_0xd724('0x2'),'update'];function createListener(_0x1fb96a,_0x1f5db6){return function(_0x46094e){_0x1f5db6[_0xd724('0x3')](_0x1fb96a,_0x46094e);};}function removeListener(_0x399665,_0x3012ba){return function(){OpenchannelMessageEvents[_0xd724('0x4')](_0x399665,_0x3012ba);};}exports[_0xd724('0x5')]=function(_0x4a7a6d){for(var _0xdb8f9f=0x0,_0x100428=events[_0xd724('0x6')];_0xdb8f9f<_0x100428;_0xdb8f9f++){var _0x37938f=events[_0xdb8f9f];var _0x53601e=createListener(_0xd724('0x7')+_0x37938f,_0x4a7a6d);OpenchannelMessageEvents['on'](_0x37938f,_0x53601e);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index f7b3699..ac140c9 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 _0x3bec=['destroy','removeTeams','removeAgents','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','describe','/:id','/:id/members','/:id/teams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete'];(function(_0x48599f,_0x3339a0){var _0x5d889d=function(_0x29a408){while(--_0x29a408){_0x48599f['push'](_0x48599f['shift']());}};_0x5d889d(++_0x3339a0);}(_0x3bec,0xb9));var _0xc3be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3bec[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xc3be('0x0'));var path=require(_0xc3be('0x1'));var timeout=require(_0xc3be('0x2'));var express=require('express');var router=express[_0xc3be('0x3')]();var fs_extra=require(_0xc3be('0x4'));var auth=require(_0xc3be('0x5'));var interaction=require(_0xc3be('0x6'));var config=require(_0xc3be('0x7'));var controller=require(_0xc3be('0x8'));router[_0xc3be('0x9')]('/',auth[_0xc3be('0xa')](),controller['index']);router[_0xc3be('0x9')]('/describe',auth[_0xc3be('0xa')](),controller[_0xc3be('0xb')]);router['get'](_0xc3be('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xc3be('0x9')](_0xc3be('0xd'),auth[_0xc3be('0xa')](),controller['getMembers']);router[_0xc3be('0x9')](_0xc3be('0xe'),auth['isAuthenticated'](),controller['getTeams']);router['get'](_0xc3be('0xf'),auth[_0xc3be('0xa')](),controller[_0xc3be('0x10')]);router['post']('/',auth[_0xc3be('0xa')](),controller['create']);router[_0xc3be('0x11')](_0xc3be('0xe'),auth[_0xc3be('0xa')](),controller[_0xc3be('0x12')]);router['post'](_0xc3be('0xf'),auth['isAuthenticated'](),controller[_0xc3be('0x13')]);router[_0xc3be('0x14')](_0xc3be('0xc'),auth[_0xc3be('0xa')](),controller[_0xc3be('0x15')]);router[_0xc3be('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xc3be('0x17')]);router['delete'](_0xc3be('0xe'),auth[_0xc3be('0xa')](),controller[_0xc3be('0x18')]);router[_0xc3be('0x16')](_0xc3be('0xf'),auth[_0xc3be('0xa')](),controller[_0xc3be('0x19')]);module['exports']=router; \ No newline at end of file +var _0xb313=['create','removeAgents','exports','multer','util','connect-timeout','express','fs-extra','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0xb313,0x17d));var _0x3b31=function(_0x3594e3,_0x4abf7c){_0x3594e3=_0x3594e3-0x0;var _0x162922=_0xb313[_0x3594e3];return _0x162922;};'use strict';var multer=require(_0x3b31('0x0'));var util=require(_0x3b31('0x1'));var path=require('path');var timeout=require(_0x3b31('0x2'));var express=require(_0x3b31('0x3'));var router=express['Router']();var fs_extra=require(_0x3b31('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3b31('0x5'));var controller=require(_0x3b31('0x6'));router[_0x3b31('0x7')]('/',auth[_0x3b31('0x8')](),controller['index']);router[_0x3b31('0x7')](_0x3b31('0x9'),auth[_0x3b31('0x8')](),controller[_0x3b31('0xa')]);router['get'](_0x3b31('0xb'),auth[_0x3b31('0x8')](),controller['show']);router[_0x3b31('0x7')](_0x3b31('0xc'),auth[_0x3b31('0x8')](),controller[_0x3b31('0xd')]);router['get'](_0x3b31('0xe'),auth[_0x3b31('0x8')](),controller[_0x3b31('0xf')]);router[_0x3b31('0x7')](_0x3b31('0x10'),auth[_0x3b31('0x8')](),controller['getAgents']);router[_0x3b31('0x11')]('/',auth[_0x3b31('0x8')](),controller[_0x3b31('0x12')]);router[_0x3b31('0x11')](_0x3b31('0xe'),auth[_0x3b31('0x8')](),controller['addTeams']);router['post'](_0x3b31('0x10'),auth[_0x3b31('0x8')](),controller['addAgents']);router['put'](_0x3b31('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x3b31('0xb'),auth[_0x3b31('0x8')](),controller['destroy']);router['delete'](_0x3b31('0xe'),auth['isAuthenticated'](),controller['removeTeams']);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x3b31('0x13')]);module[_0x3b31('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index ae666eb..9b0b411 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 _0x26d4=['exports','STRING','ENUM','rrmemory','beepall'];(function(_0x16d83d,_0xc408e){var _0x518d14=function(_0x3a6f1a){while(--_0x3a6f1a){_0x16d83d['push'](_0x16d83d['shift']());}};_0x518d14(++_0xc408e);}(_0x26d4,0x16d));var _0x426d=function(_0x29629c,_0x4e6ba0){_0x29629c=_0x29629c-0x0;var _0x13e64c=_0x26d4[_0x29629c];return _0x13e64c;};'use strict';var Sequelize=require('sequelize');module[_0x426d('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x426d('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x426d('0x2')](_0x426d('0x3'),_0x426d('0x4'),'roundrobin')}}; \ No newline at end of file +var _0xf684=['STRING','name','rrmemory','roundrobin'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xf684,0x120));var _0x4f68=function(_0xd0fba0,_0x46fee9){_0xd0fba0=_0xd0fba0-0x0;var _0x2abc10=_0xf684[_0xd0fba0];return _0x2abc10;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4f68('0x0')],'unique':_0x4f68('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4f68('0x0')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x4f68('0x2'),'beepall',_0x4f68('0x3'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index d27d550..159c772 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 _0x50da=['length','order','OpenchannelQueueId','UserOpenchannelQueue','User','UserId','agent','openchannelPause','updatedAt','createdAt','rows','format','%s/%s','getTeams','Team','addTeams','findAll','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','QueryTypes','SELECT','TeamId','all','compact','isEmpty','removeAgents','addAgents','omit','isArray','userOpenchannelQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','UserProfileResource','sendStatus','error','stack','send','index','map','OpenchannelQueue','rawAttributes','type','key','name','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','pick','where','merge','filter','options','includeAll','include','catch','show','params','find','create','body','user','get','role','OpenchannelQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne'];(function(_0x509273,_0x13fc9f){var _0x38ef40=function(_0xf8d4c9){while(--_0xf8d4c9){_0x509273['push'](_0x509273['shift']());}};_0x38ef40(++_0x13fc9f);}(_0x50da,0x14c));var _0xa50d=function(_0x21f1be,_0xcf148){_0x21f1be=_0x21f1be-0x0;var _0xce1bcc=_0x50da[_0x21f1be];return _0xce1bcc;};'use strict';var emlformat=require(_0xa50d('0x0'));var rimraf=require(_0xa50d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa50d('0x2'));var rp=require(_0xa50d('0x3'));var moment=require(_0xa50d('0x4'));var BPromise=require(_0xa50d('0x5'));var Mustache=require(_0xa50d('0x6'));var util=require(_0xa50d('0x7'));var path=require(_0xa50d('0x8'));var sox=require(_0xa50d('0x9'));var csv=require(_0xa50d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa50d('0xb'));var squel=require(_0xa50d('0xc'));var crypto=require(_0xa50d('0xd'));var jsforce=require(_0xa50d('0xe'));var deskjs=require(_0xa50d('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa50d('0x10'));var Papa=require(_0xa50d('0x11'));var Redis=require(_0xa50d('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa50d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa50d('0x14'))('api');var utils=require(_0xa50d('0x15'));var config=require(_0xa50d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa50d('0x17'))['db'];config[_0xa50d('0x18')]=_[_0xa50d('0x19')](config[_0xa50d('0x18')],{'host':_0xa50d('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa50d('0x18')]));require(_0xa50d('0x1b'))['register'](socket);function respondWithStatusCode(_0xa5a5cd,_0x406be5){_0x406be5=_0x406be5||0xcc;return function(_0x227784){if(_0x227784){return _0xa5a5cd['sendStatus'](_0x406be5);}return _0xa5a5cd['status'](_0x406be5)[_0xa50d('0x1c')]();};}function respondWithResult(_0x4cfbbe,_0x97b439){_0x97b439=_0x97b439||0xc8;return function(_0x2666bf){if(_0x2666bf){return _0x4cfbbe[_0xa50d('0x1d')](_0x97b439)['json'](_0x2666bf);}};}function respondWithFilteredResult(_0x12b356,_0x11ca62){return function(_0x134220){if(_0x134220){var _0x41e51e=typeof _0x11ca62[_0xa50d('0x1e')]===_0xa50d('0x1f')&&typeof _0x11ca62[_0xa50d('0x20')]===_0xa50d('0x1f');var _0x5de0e3=_0x134220[_0xa50d('0x21')];var _0x417ee8=_0x41e51e?0x0:_0x11ca62[_0xa50d('0x1e')];var _0x50106f=_0x41e51e?_0x134220[_0xa50d('0x21')]:_0x11ca62['offset']+_0x11ca62[_0xa50d('0x20')];var _0x196e1e;if(_0x50106f>=_0x5de0e3){_0x50106f=_0x5de0e3;_0x196e1e=0xc8;}else{_0x196e1e=0xce;}_0x12b356[_0xa50d('0x1d')](_0x196e1e);return _0x12b356[_0xa50d('0x22')](_0xa50d('0x23'),_0x417ee8+'-'+_0x50106f+'/'+_0x5de0e3)[_0xa50d('0x24')](_0x134220);}return null;};}function patchUpdates(_0x3cf171){return function(_0x4f1dfe){try{jsonpatch[_0xa50d('0x25')](_0x4f1dfe,_0x3cf171,!![]);}catch(_0x35ee8e){return BPromise[_0xa50d('0x26')](_0x35ee8e);}return _0x4f1dfe[_0xa50d('0x27')]();};}function saveUpdates(_0x5b1520,_0x5cf865){return function(_0x54729d){if(_0x54729d){return _0x54729d[_0xa50d('0x28')](_0x5b1520)['then'](function(_0x293d2b){return _0x293d2b;});}return null;};}function removeEntity(_0x261a19,_0x3de508){return function(_0x1731b3){if(_0x1731b3){return _0x1731b3[_0xa50d('0x29')]()[_0xa50d('0x2a')](function(){var _0x411fee=_0x1731b3['get']({'plain':!![]});var _0x501e2b='OpenchannelQueues';return db[_0xa50d('0x2b')][_0xa50d('0x29')]({'where':{'type':_0x501e2b,'resourceId':_0x411fee['id']}})['then'](function(){return _0x1731b3;});})[_0xa50d('0x2a')](function(){_0x261a19['status'](0xcc)[_0xa50d('0x1c')]();});}};}function handleEntityNotFound(_0xfc5b6a,_0x5e1b0c){return function(_0x2ddd20){if(!_0x2ddd20){_0xfc5b6a[_0xa50d('0x2c')](0x194);}return _0x2ddd20;};}function handleError(_0x342ac9,_0x492725){_0x492725=_0x492725||0x1f4;return function(_0x46b28a){logger[_0xa50d('0x2d')](_0x46b28a[_0xa50d('0x2e')]);if(_0x46b28a['name']){delete _0x46b28a['name'];}_0x342ac9[_0xa50d('0x1d')](_0x492725)[_0xa50d('0x2f')](_0x46b28a);};}exports[_0xa50d('0x30')]=function(_0x5c58c6,_0x248304){var _0x471da1={},_0x4d6693={},_0x441e79={'count':0x0,'rows':[]};var _0x497163=_[_0xa50d('0x31')](db[_0xa50d('0x32')][_0xa50d('0x33')],function(_0x4c2247){return{'name':_0x4c2247['fieldName'],'type':_0x4c2247[_0xa50d('0x34')][_0xa50d('0x35')]};});_0x4d6693['model']=_[_0xa50d('0x31')](_0x497163,_0xa50d('0x36'));_0x4d6693[_0xa50d('0x37')]=_[_0xa50d('0x38')](_0x5c58c6[_0xa50d('0x37')]);_0x4d6693[_0xa50d('0x39')]=_[_0xa50d('0x3a')](_0x4d6693[_0xa50d('0x3b')],_0x4d6693['query']);_0x471da1[_0xa50d('0x3c')]=_['intersection'](_0x4d6693[_0xa50d('0x3b')],qs[_0xa50d('0x3d')](_0x5c58c6[_0xa50d('0x37')][_0xa50d('0x3d')]));_0x471da1[_0xa50d('0x3c')]=_0x471da1['attributes']['length']?_0x471da1['attributes']:_0x4d6693[_0xa50d('0x3b')];if(!_0x5c58c6[_0xa50d('0x37')][_0xa50d('0x3e')](_0xa50d('0x3f'))){_0x471da1[_0xa50d('0x20')]=qs['limit'](_0x5c58c6['query']['limit']);_0x471da1[_0xa50d('0x1e')]=qs['offset'](_0x5c58c6[_0xa50d('0x37')][_0xa50d('0x1e')]);}_0x471da1['order']=qs[_0xa50d('0x40')](_0x5c58c6[_0xa50d('0x37')][_0xa50d('0x40')]);_0x471da1['where']=qs[_0xa50d('0x39')](_[_0xa50d('0x41')](_0x5c58c6[_0xa50d('0x37')],_0x4d6693[_0xa50d('0x39')]),_0x497163);if(_0x5c58c6[_0xa50d('0x37')]['filter']){_0x471da1[_0xa50d('0x42')]=_[_0xa50d('0x43')](_0x471da1[_0xa50d('0x42')],{'$or':_[_0xa50d('0x31')](_0x497163,function(_0x5f52f3){if(_0x5f52f3[_0xa50d('0x34')]!=='VIRTUAL'){var _0x2cf1c6={};_0x2cf1c6[_0x5f52f3[_0xa50d('0x36')]]={'$like':'%'+_0x5c58c6[_0xa50d('0x37')][_0xa50d('0x44')]+'%'};return _0x2cf1c6;}})});}_0x471da1=_[_0xa50d('0x43')]({},_0x471da1,_0x5c58c6[_0xa50d('0x45')]);var _0x2a3259={'where':_0x471da1['where']};return db[_0xa50d('0x32')][_0xa50d('0x21')](_0x2a3259)[_0xa50d('0x2a')](function(_0x493656){_0x441e79[_0xa50d('0x21')]=_0x493656;if(_0x5c58c6['query'][_0xa50d('0x46')]){_0x471da1[_0xa50d('0x47')]=[{'all':!![]}];}return db[_0xa50d('0x32')]['findAll'](_0x471da1);})[_0xa50d('0x2a')](function(_0x10cd75){_0x441e79['rows']=_0x10cd75;return _0x441e79;})[_0xa50d('0x2a')](respondWithFilteredResult(_0x248304,_0x471da1))[_0xa50d('0x48')](handleError(_0x248304,null));};exports[_0xa50d('0x49')]=function(_0x3e18ad,_0x53b720){var _0x81d828={'raw':!![],'where':{'id':_0x3e18ad[_0xa50d('0x4a')]['id']}},_0x4ae147={};_0x4ae147[_0xa50d('0x3b')]=_['keys'](db[_0xa50d('0x32')][_0xa50d('0x33')]);_0x4ae147['query']=_[_0xa50d('0x38')](_0x3e18ad[_0xa50d('0x37')]);_0x4ae147[_0xa50d('0x39')]=_['intersection'](_0x4ae147[_0xa50d('0x3b')],_0x4ae147[_0xa50d('0x37')]);_0x81d828[_0xa50d('0x3c')]=_[_0xa50d('0x3a')](_0x4ae147[_0xa50d('0x3b')],qs['fields'](_0x3e18ad['query']['fields']));_0x81d828[_0xa50d('0x3c')]=_0x81d828[_0xa50d('0x3c')]['length']?_0x81d828[_0xa50d('0x3c')]:_0x4ae147[_0xa50d('0x3b')];if(_0x3e18ad[_0xa50d('0x37')][_0xa50d('0x46')]){_0x81d828[_0xa50d('0x47')]=[{'all':!![]}];}_0x81d828=_[_0xa50d('0x43')]({},_0x81d828,_0x3e18ad[_0xa50d('0x45')]);return db[_0xa50d('0x32')][_0xa50d('0x4b')](_0x81d828)['then'](handleEntityNotFound(_0x53b720,null))[_0xa50d('0x2a')](respondWithResult(_0x53b720,null))[_0xa50d('0x48')](handleError(_0x53b720,null));};exports[_0xa50d('0x4c')]=function(_0x340a27,_0x472fe1){return db['OpenchannelQueue'][_0xa50d('0x4c')](_0x340a27[_0xa50d('0x4d')],{})[_0xa50d('0x2a')](function(_0x29307b){var _0x16e023=_0x340a27[_0xa50d('0x4e')][_0xa50d('0x4f')]({'plain':!![]});if(!_0x16e023)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16e023[_0xa50d('0x50')]===_0xa50d('0x4e')){var _0x52a3d6=_0x29307b[_0xa50d('0x4f')]({'plain':!![]});var _0x4e2697=_0xa50d('0x51');return db[_0xa50d('0x52')][_0xa50d('0x4b')]({'where':{'name':_0x4e2697,'userProfileId':_0x16e023[_0xa50d('0x53')]},'raw':!![]})['then'](function(_0x56cb46){if(_0x56cb46&&_0x56cb46[_0xa50d('0x54')]===0x0){return db[_0xa50d('0x2b')][_0xa50d('0x4c')]({'name':_0x52a3d6['name'],'resourceId':_0x52a3d6['id'],'type':_0x56cb46[_0xa50d('0x36')],'sectionId':_0x56cb46['id']},{})[_0xa50d('0x2a')](function(){return _0x29307b;});}else{return _0x29307b;}})[_0xa50d('0x48')](function(_0x4aca22){logger['error'](_0xa50d('0x55'),_0x4aca22);throw _0x4aca22;});}return _0x29307b;})[_0xa50d('0x2a')](respondWithResult(_0x472fe1,0xc9))[_0xa50d('0x48')](handleError(_0x472fe1,null));};exports['update']=function(_0x44da88,_0x514e0f){if(_0x44da88[_0xa50d('0x4d')]['id']){delete _0x44da88[_0xa50d('0x4d')]['id'];}return db[_0xa50d('0x32')][_0xa50d('0x4b')]({'where':{'id':_0x44da88[_0xa50d('0x4a')]['id']}})[_0xa50d('0x2a')](handleEntityNotFound(_0x514e0f,null))[_0xa50d('0x2a')](saveUpdates(_0x44da88['body'],null))[_0xa50d('0x2a')](respondWithResult(_0x514e0f,null))['catch'](handleError(_0x514e0f,null));};exports[_0xa50d('0x29')]=function(_0x4d7a73,_0x29aac5){return db[_0xa50d('0x32')][_0xa50d('0x4b')]({'where':{'id':_0x4d7a73[_0xa50d('0x4a')]['id']}})[_0xa50d('0x2a')](handleEntityNotFound(_0x29aac5,null))[_0xa50d('0x2a')](removeEntity(_0x29aac5,null))[_0xa50d('0x48')](handleError(_0x29aac5,null));};exports[_0xa50d('0x56')]=function(_0x3cd283,_0x4e9220){return db[_0xa50d('0x32')][_0xa50d('0x56')]()[_0xa50d('0x2a')](respondWithResult(_0x4e9220,null))[_0xa50d('0x48')](handleError(_0x4e9220,null));};exports['getMembers']=function(_0x177f37,_0x16c4e4,_0x200a45){var _0x2139be={'raw':!![],'where':{}},_0x5b6b82={},_0x5656d2;return db[_0xa50d('0x32')][_0xa50d('0x57')]({'where':{'id':_0x177f37['params']['id']}})[_0xa50d('0x2a')](handleEntityNotFound(_0x16c4e4,null))['then'](function(_0x3597b7){if(_0x3597b7){_0x5656d2=_0x3597b7[_0xa50d('0x4f')]({'plain':!![]});_0x5b6b82['model']=_[_0xa50d('0x38')](db['UserOpenchannelQueue'][_0xa50d('0x33')]);_0x5b6b82[_0xa50d('0x37')]=_[_0xa50d('0x38')](_0x177f37[_0xa50d('0x37')]);_0x5b6b82[_0xa50d('0x39')]=_[_0xa50d('0x3a')](_0x5b6b82['model'],_0x5b6b82['query']);_0x2139be[_0xa50d('0x3c')]=_['intersection'](_0x5b6b82[_0xa50d('0x3b')],qs[_0xa50d('0x3d')](_0x177f37[_0xa50d('0x37')]['fields']));_0x2139be[_0xa50d('0x3c')]=_0x2139be[_0xa50d('0x3c')][_0xa50d('0x58')]?_0x2139be[_0xa50d('0x3c')]:_0x5b6b82[_0xa50d('0x3b')];if(!_0x177f37[_0xa50d('0x37')][_0xa50d('0x3e')](_0xa50d('0x3f'))){_0x2139be[_0xa50d('0x20')]=qs['limit'](_0x177f37[_0xa50d('0x37')][_0xa50d('0x20')]);_0x2139be[_0xa50d('0x1e')]=qs['offset'](_0x177f37[_0xa50d('0x37')][_0xa50d('0x1e')]);}_0x2139be[_0xa50d('0x59')]=qs[_0xa50d('0x40')](_0x177f37[_0xa50d('0x37')]['sort']);_0x2139be[_0xa50d('0x42')]=qs['filters'](_['pick'](_0x177f37[_0xa50d('0x37')],_0x5b6b82[_0xa50d('0x39')]));_0x2139be['where'][_0xa50d('0x5a')]=_0x3597b7['id'];if(_0x177f37['query'][_0xa50d('0x44')]){_0x2139be[_0xa50d('0x42')]=_['merge'](_0x2139be['where'],{'$or':_[_0xa50d('0x31')](_0x2139be['attributes'],function(_0x26caf6){var _0x28422e={};_0x28422e[_0x26caf6]={'$like':'%'+_0x177f37[_0xa50d('0x37')][_0xa50d('0x44')]+'%'};return _0x28422e;})});}_0x2139be=_['merge']({},_0x2139be,_0x177f37[_0xa50d('0x45')]);return db[_0xa50d('0x5b')]['findAll'](_0x2139be);}})['then'](function(_0x2a27bb){if(_0x2a27bb){return db[_0xa50d('0x5c')]['findAndCountAll']({'where':{'id':_[_0xa50d('0x31')](_0x2a27bb,_0xa50d('0x5d')),'role':_0xa50d('0x5e')},'attributes':['id',_0xa50d('0x36'),_0xa50d('0x5f'),_0xa50d('0x60'),_0xa50d('0x61')]});}})[_0xa50d('0x2a')](function(_0x5cc6b3){if(_0x5cc6b3){return{'count':_0x5cc6b3[_0xa50d('0x21')],'rows':_['map'](_0x5cc6b3[_0xa50d('0x62')],function(_0x3c277a){return{'membername':_0x3c277a[_0xa50d('0x36')],'UserId':_0x3c277a['id'],'queue_name':_0x5656d2[_0xa50d('0x36')],'OpenchannelQueueId':_0x5656d2['id'],'interface':util[_0xa50d('0x63')](_0xa50d('0x64'),'SIP',_0x3c277a['name']),'penalty':0x0,'paused':_0x3c277a[_0xa50d('0x5f')],'createdAt':_0x3c277a[_0xa50d('0x61')],'updatedAt':_0x3c277a['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xa50d('0x2a')](respondWithFilteredResult(_0x16c4e4,_0x2139be))['catch'](handleError(_0x16c4e4,null));};exports[_0xa50d('0x65')]=function(_0x513cce,_0x3677ee,_0x1061d4){var _0x3e53df={};var _0x5215f3={};var _0x35d4b1;var _0x7a25f7;return db[_0xa50d('0x32')][_0xa50d('0x57')]({'where':{'id':_0x513cce[_0xa50d('0x4a')]['id']}})[_0xa50d('0x2a')](handleEntityNotFound(_0x3677ee,null))['then'](function(_0xa7b6ca){if(_0xa7b6ca){_0x35d4b1=_0xa7b6ca;_0x5215f3['model']=_['keys'](db[_0xa50d('0x66')][_0xa50d('0x33')]);_0x5215f3['query']=_[_0xa50d('0x38')](_0x513cce[_0xa50d('0x37')]);_0x5215f3['filters']=_[_0xa50d('0x3a')](_0x5215f3['model'],_0x5215f3[_0xa50d('0x37')]);_0x3e53df['attributes']=_[_0xa50d('0x3a')](_0x5215f3[_0xa50d('0x3b')],qs[_0xa50d('0x3d')](_0x513cce[_0xa50d('0x37')][_0xa50d('0x3d')]));_0x3e53df[_0xa50d('0x3c')]=_0x3e53df[_0xa50d('0x3c')][_0xa50d('0x58')]?_0x3e53df['attributes']:_0x5215f3[_0xa50d('0x3b')];_0x3e53df['order']=qs['sort'](_0x513cce[_0xa50d('0x37')][_0xa50d('0x40')]);_0x3e53df[_0xa50d('0x42')]=qs['filters'](_[_0xa50d('0x41')](_0x513cce[_0xa50d('0x37')],_0x5215f3['filters']));if(_0x513cce['query'][_0xa50d('0x44')]){_0x3e53df[_0xa50d('0x42')]=_['merge'](_0x3e53df['where'],{'$or':_[_0xa50d('0x31')](_0x3e53df[_0xa50d('0x3c')],function(_0x384766){var _0x460edc={};_0x460edc[_0x384766]={'$like':'%'+_0x513cce[_0xa50d('0x37')][_0xa50d('0x44')]+'%'};return _0x460edc;})});}_0x3e53df=_[_0xa50d('0x43')]({},_0x3e53df,_0x513cce[_0xa50d('0x45')]);return _0x35d4b1[_0xa50d('0x65')](_0x3e53df);}})[_0xa50d('0x2a')](function(_0x355dfb){if(_0x355dfb){_0x7a25f7=_0x355dfb['length'];if(!_0x513cce['query'][_0xa50d('0x3e')](_0xa50d('0x3f'))){_0x3e53df[_0xa50d('0x20')]=qs[_0xa50d('0x20')](_0x513cce[_0xa50d('0x37')][_0xa50d('0x20')]);_0x3e53df['offset']=qs[_0xa50d('0x1e')](_0x513cce['query'][_0xa50d('0x1e')]);}return _0x35d4b1[_0xa50d('0x65')](_0x3e53df);}})[_0xa50d('0x2a')](function(_0x403350){if(_0x403350){return _0x403350?{'count':_0x7a25f7,'rows':_0x403350}:null;}})[_0xa50d('0x2a')](respondWithResult(_0x3677ee,null))[_0xa50d('0x48')](handleError(_0x3677ee,null));};exports[_0xa50d('0x67')]=function(_0x1e5599,_0x1695c4,_0x45e5c1){var _0x12aa4e=_0x1e5599['body']['ids'];return db[_0xa50d('0x66')][_0xa50d('0x68')]({'where':{'id':_0x12aa4e},'attributes':['id'],'include':[{'model':db[_0xa50d('0x5c')],'as':_0xa50d('0x69'),'attributes':['id',_0xa50d('0x36'),_0xa50d('0x6a'),_0xa50d('0x6b'),_0xa50d('0x6c')],'raw':!![]}]})[_0xa50d('0x2a')](function(_0x460feb){if(_0x460feb){var _0x2bb2f1=_['flatMap'](_0x460feb,function(_0x1f016c){var _0x238dbe=_0x1f016c['get']({'plain':!![]});return _0x238dbe[_0xa50d('0x69')];});return db[_0xa50d('0x32')][_0xa50d('0x4b')]({'where':{'id':_0x1e5599[_0xa50d('0x4a')]['id']}})[_0xa50d('0x2a')](function(_0x24671c){return db[_0xa50d('0x6d')][_0xa50d('0x6e')](function(_0x58e758){return _0x24671c[_0xa50d('0x67')](_0x12aa4e,{'transaction':_0x58e758})['then'](function(){return BPromise[_0xa50d('0x6f')](_0x2bb2f1,function(_0x3c7718){return db[_0xa50d('0x5b')][_0xa50d('0x70')]({'where':{'UserId':_0x3c7718['id'],'OpenchannelQueueId':_0x1e5599[_0xa50d('0x4a')]['id']},'transaction':_0x58e758});});})['then'](function(){_0x2bb2f1[_0xa50d('0x71')](function(_0x1bf727){socket[_0xa50d('0x72')](_0xa50d('0x73'),{'UserId':_0x1bf727['id'],'OpenchannelQueueId':_0x24671c['id']});});});});});}})[_0xa50d('0x2a')](respondWithStatusCode(_0x1695c4,null))[_0xa50d('0x48')](handleError(_0x1695c4,null));};exports[_0xa50d('0x74')]=function(_0x492910,_0x4c9750,_0x144938){return db[_0xa50d('0x66')][_0xa50d('0x68')]({'where':{'id':_0x492910[_0xa50d('0x37')][_0xa50d('0x75')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xa50d('0x2a')](handleEntityNotFound(_0x4c9750,null))[_0xa50d('0x2a')](function(_0xf1ca03){var _0x44562d=_['map'](_0xf1ca03,'id');var _0x17f397=[];var _0x3b6d0e=[];var _0x40679d=squel['select']();_0x40679d[_0xa50d('0x76')](_0xa50d('0x77'))[_0xa50d('0x78')](_0xa50d('0x79'),'tq')[_0xa50d('0x7a')](_0xa50d('0x7b'),'ut',_0xa50d('0x7c'))[_0xa50d('0x42')]('OpenchannelQueueId\x20=\x20?',_0x492910[_0xa50d('0x4a')]['id']);for(var _0x1595e2=0x0;_0x1595e2<_0xf1ca03[_0xa50d('0x58')];_0x1595e2+=0x1){let _0xd176d4=_0xf1ca03[_0x1595e2];for(var _0x5a0f40=0x0;_0x5a0f40<_0xd176d4[_0xa50d('0x69')][_0xa50d('0x58')];_0x5a0f40+=0x1){let _0x468097=_0xd176d4[_0xa50d('0x69')][_0x5a0f40];var _0x5acae0=_0x40679d[_0xa50d('0x7d')]();_0x5acae0[_0xa50d('0x42')]('ut.UserId\x20=\x20?',_0x468097['id']);_0x3b6d0e[_0xa50d('0x7e')](db[_0xa50d('0x6d')][_0xa50d('0x37')](_0x5acae0[_0xa50d('0x7f')](),{'type':db[_0xa50d('0x6d')][_0xa50d('0x80')][_0xa50d('0x81')]})[_0xa50d('0x2a')](function(_0x1fb6ae){if(_0x1fb6ae[_0xa50d('0x58')]===0x1){return _0x468097['id'];}else{var _0x5b12c2=_['every'](_[_0xa50d('0x31')](_0x1fb6ae,_0xa50d('0x82')),function(_0x437a3e){return _['includes'](_0x44562d,_0x437a3e);});if(_0x5b12c2){return _0x468097['id'];}}}));}}return BPromise[_0xa50d('0x83')](_0x3b6d0e)[_0xa50d('0x2a')](function(_0x153108){_0x17f397=_(_0x17f397)['union'](_0x153108)[_0xa50d('0x84')]()['value']();return db[_0xa50d('0x32')][_0xa50d('0x4b')]({'where':{'id':_0x492910[_0xa50d('0x4a')]['id']}})[_0xa50d('0x2a')](function(_0x3aca6c){return db[_0xa50d('0x6d')][_0xa50d('0x6e')](function(_0xa6636e){return _0x3aca6c[_0xa50d('0x74')](_0x492910[_0xa50d('0x37')][_0xa50d('0x75')],{'transaction':_0xa6636e})[_0xa50d('0x2a')](function(){if(!_[_0xa50d('0x85')](_0x17f397)){return _0x3aca6c[_0xa50d('0x86')](_0x17f397,{'transaction':_0xa6636e});}})[_0xa50d('0x2a')](function(){_0x17f397[_0xa50d('0x71')](function(_0x2dc4ef){socket[_0xa50d('0x72')]('userOpenchannelQueue:remove',{'UserId':_0x2dc4ef,'OpenchannelQueueId':_0x3aca6c['id']});});});});});});})[_0xa50d('0x2a')](respondWithStatusCode(_0x4c9750,null))[_0xa50d('0x48')](handleError(_0x4c9750,null));};exports[_0xa50d('0x87')]=function(_0x3a46a1,_0x2e68da,_0x33dc37){return db['OpenchannelQueue'][_0xa50d('0x4b')]({'where':{'id':_0x3a46a1['params']['id']}})[_0xa50d('0x2a')](handleEntityNotFound(_0x2e68da,null))[_0xa50d('0x2a')](function(_0x3c2e3a){if(_0x3c2e3a){return _0x3c2e3a[_0xa50d('0x87')](_0x3a46a1[_0xa50d('0x4d')]['ids'],_[_0xa50d('0x88')](_0x3a46a1[_0xa50d('0x4d')],[_0xa50d('0x75'),'id'])||{})['spread'](function(_0x55a1f6){for(var _0x48bc77=0x0;_0x48bc77<_0x3a46a1[_0xa50d('0x4d')][_0xa50d('0x75')][_0xa50d('0x58')];_0x48bc77+=0x1){socket[_0xa50d('0x72')](_0xa50d('0x73'),{'UserId':Number(_0x3a46a1[_0xa50d('0x4d')][_0xa50d('0x75')][_0x48bc77]),'OpenchannelQueueId':Number(_0x3a46a1[_0xa50d('0x4a')]['id'])});}return _0x55a1f6;});}})[_0xa50d('0x2a')](respondWithResult(_0x2e68da,null))[_0xa50d('0x48')](handleError(_0x2e68da,null));};exports['removeAgents']=function(_0x2c43ba,_0x42c917,_0x29f944){return db[_0xa50d('0x32')][_0xa50d('0x4b')]({'where':{'id':_0x2c43ba[_0xa50d('0x4a')]['id']}})[_0xa50d('0x2a')](handleEntityNotFound(_0x42c917,null))[_0xa50d('0x2a')](function(_0x1b3409){if(_0x1b3409){return _0x1b3409[_0xa50d('0x86')](_0x2c43ba[_0xa50d('0x37')][_0xa50d('0x75')])['then'](function(){if(_[_0xa50d('0x89')](_0x2c43ba[_0xa50d('0x37')][_0xa50d('0x75')])){for(var _0x243c8c=0x0;_0x243c8c<_0x2c43ba[_0xa50d('0x37')]['ids']['length'];_0x243c8c+=0x1){socket[_0xa50d('0x72')](_0xa50d('0x8a'),{'UserId':Number(_0x2c43ba['query'][_0xa50d('0x75')][_0x243c8c]),'OpenchannelQueueId':Number(_0x2c43ba[_0xa50d('0x4a')]['id'])});}}else{socket[_0xa50d('0x72')](_0xa50d('0x8a'),{'UserId':Number(_0x2c43ba['query'][_0xa50d('0x75')]),'OpenchannelQueueId':Number(_0x2c43ba[_0xa50d('0x4a')]['id'])});}});}})[_0xa50d('0x2a')](respondWithStatusCode(_0x42c917,null))[_0xa50d('0x48')](handleError(_0x42c917,null));};exports[_0xa50d('0x8b')]=function(_0x183f2b,_0x3853a0,_0x25cbf0){var _0x112361={};var _0x15aa01={};var _0x28bcbd;var _0x5167bb;return db[_0xa50d('0x32')][_0xa50d('0x57')]({'where':{'id':_0x183f2b['params']['id']}})['then'](handleEntityNotFound(_0x3853a0,null))['then'](function(_0x53949){if(_0x53949){_0x28bcbd=_0x53949;_0x15aa01[_0xa50d('0x3b')]=_[_0xa50d('0x38')](db[_0xa50d('0x5c')][_0xa50d('0x33')]);_0x15aa01['query']=_['keys'](_0x183f2b['query']);_0x15aa01['filters']=_[_0xa50d('0x3a')](_0x15aa01[_0xa50d('0x3b')],_0x15aa01[_0xa50d('0x37')]);_0x112361[_0xa50d('0x3c')]=_[_0xa50d('0x3a')](_0x15aa01['model'],qs['fields'](_0x183f2b['query'][_0xa50d('0x3d')]));_0x112361[_0xa50d('0x3c')]=_0x112361[_0xa50d('0x3c')][_0xa50d('0x58')]?_0x112361[_0xa50d('0x3c')]:_0x15aa01['model'];_0x112361['order']=qs[_0xa50d('0x40')](_0x183f2b[_0xa50d('0x37')][_0xa50d('0x40')]);_0x112361[_0xa50d('0x42')]=qs['filters'](_[_0xa50d('0x41')](_0x183f2b[_0xa50d('0x37')],_0x15aa01['filters']));if(_0x183f2b['query'][_0xa50d('0x44')]){_0x112361[_0xa50d('0x42')]=_[_0xa50d('0x43')](_0x112361[_0xa50d('0x42')],{'$or':_[_0xa50d('0x31')](_0x112361[_0xa50d('0x3c')],function(_0x51ac81){var _0xa0a018={};_0xa0a018[_0x51ac81]={'$like':'%'+_0x183f2b[_0xa50d('0x37')][_0xa50d('0x44')]+'%'};return _0xa0a018;})});}_0x112361=_[_0xa50d('0x43')]({},_0x112361,_0x183f2b[_0xa50d('0x45')]);return _0x28bcbd['getAgents'](_0x112361);}})['then'](function(_0x2e5283){if(_0x2e5283){_0x5167bb=_0x2e5283[_0xa50d('0x58')];if(!_0x183f2b[_0xa50d('0x37')][_0xa50d('0x3e')]('nolimit')){_0x112361['limit']=qs[_0xa50d('0x20')](_0x183f2b[_0xa50d('0x37')][_0xa50d('0x20')]);_0x112361[_0xa50d('0x1e')]=qs[_0xa50d('0x1e')](_0x183f2b['query'][_0xa50d('0x1e')]);}return _0x28bcbd['getAgents'](_0x112361);}})[_0xa50d('0x2a')](function(_0x23cc5a){if(_0x23cc5a){return _0x23cc5a?{'count':_0x5167bb,'rows':_0x23cc5a}:null;}})[_0xa50d('0x2a')](respondWithResult(_0x3853a0,null))['catch'](handleError(_0x3853a0,null));}; \ No newline at end of file +var _0x4736=['union','compact','isEmpty','removeAgents','addAgents','spread','emit','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','status','end','offset','undefined','limit','count','set','json','apply','save','update','destroy','then','get','OpenchannelQueues','UserProfileResource','sendStatus','error','stack','name','index','OpenchannelQueue','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','show','params','catch','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','describe','getMembers','findOne','UserOpenchannelQueue','pick','OpenchannelQueueId','findAll','User','UserId','agent','openchannelPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','addTeams','ids','Team','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','SELECT','every','TeamId','all'];(function(_0x22193e,_0x2ae001){var _0x10c378=function(_0x411e3f){while(--_0x411e3f){_0x22193e['push'](_0x22193e['shift']());}};_0x10c378(++_0x2ae001);}(_0x4736,0x123));var _0x6473=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4736[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x6473('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6473('0x1'));var jsonpatch=require(_0x6473('0x2'));var rp=require(_0x6473('0x3'));var moment=require(_0x6473('0x4'));var BPromise=require(_0x6473('0x5'));var Mustache=require(_0x6473('0x6'));var util=require('util');var path=require(_0x6473('0x7'));var sox=require(_0x6473('0x8'));var csv=require(_0x6473('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6473('0xa'));var _=require(_0x6473('0xb'));var squel=require(_0x6473('0xc'));var crypto=require(_0x6473('0xd'));var jsforce=require(_0x6473('0xe'));var deskjs=require(_0x6473('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6473('0x10'));var Papa=require(_0x6473('0x11'));var Redis=require(_0x6473('0x12'));var authService=require(_0x6473('0x13'));var qs=require(_0x6473('0x14'));var as=require(_0x6473('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6473('0x16'))(_0x6473('0x17'));var utils=require(_0x6473('0x18'));var config=require(_0x6473('0x19'));var licenseUtil=require(_0x6473('0x1a'));var db=require(_0x6473('0x1b'))['db'];config[_0x6473('0x1c')]=_['defaults'](config[_0x6473('0x1c')],{'host':_0x6473('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelQueue.socket')['register'](socket);function respondWithStatusCode(_0x4f5d44,_0x51e741){_0x51e741=_0x51e741||0xcc;return function(_0x366a7f){if(_0x366a7f){return _0x4f5d44['sendStatus'](_0x51e741);}return _0x4f5d44[_0x6473('0x1e')](_0x51e741)[_0x6473('0x1f')]();};}function respondWithResult(_0xa9ad92,_0x2d2b20){_0x2d2b20=_0x2d2b20||0xc8;return function(_0x4a83a4){if(_0x4a83a4){return _0xa9ad92[_0x6473('0x1e')](_0x2d2b20)['json'](_0x4a83a4);}};}function respondWithFilteredResult(_0x4640ce,_0x5dc327){return function(_0x22ffa3){if(_0x22ffa3){var _0x3f048f=typeof _0x5dc327[_0x6473('0x20')]===_0x6473('0x21')&&typeof _0x5dc327[_0x6473('0x22')]===_0x6473('0x21');var _0x19cbee=_0x22ffa3[_0x6473('0x23')];var _0x4ee002=_0x3f048f?0x0:_0x5dc327[_0x6473('0x20')];var _0x836ef4=_0x3f048f?_0x22ffa3[_0x6473('0x23')]:_0x5dc327[_0x6473('0x20')]+_0x5dc327[_0x6473('0x22')];var _0x2dbb7b;if(_0x836ef4>=_0x19cbee){_0x836ef4=_0x19cbee;_0x2dbb7b=0xc8;}else{_0x2dbb7b=0xce;}_0x4640ce['status'](_0x2dbb7b);return _0x4640ce[_0x6473('0x24')]('Content-Range',_0x4ee002+'-'+_0x836ef4+'/'+_0x19cbee)[_0x6473('0x25')](_0x22ffa3);}return null;};}function patchUpdates(_0x4325bf){return function(_0x5c797a){try{jsonpatch[_0x6473('0x26')](_0x5c797a,_0x4325bf,!![]);}catch(_0x1f905a){return BPromise['reject'](_0x1f905a);}return _0x5c797a[_0x6473('0x27')]();};}function saveUpdates(_0x4b39a1,_0x5d7ff8){return function(_0x2b9ae0){if(_0x2b9ae0){return _0x2b9ae0[_0x6473('0x28')](_0x4b39a1)['then'](function(_0x2ff564){return _0x2ff564;});}return null;};}function removeEntity(_0x2b85b2,_0x23c94e){return function(_0x5489d0){if(_0x5489d0){return _0x5489d0[_0x6473('0x29')]()[_0x6473('0x2a')](function(){var _0x150354=_0x5489d0[_0x6473('0x2b')]({'plain':!![]});var _0xe5d902=_0x6473('0x2c');return db[_0x6473('0x2d')][_0x6473('0x29')]({'where':{'type':_0xe5d902,'resourceId':_0x150354['id']}})[_0x6473('0x2a')](function(){return _0x5489d0;});})[_0x6473('0x2a')](function(){_0x2b85b2[_0x6473('0x1e')](0xcc)[_0x6473('0x1f')]();});}};}function handleEntityNotFound(_0x8e5fb5,_0x28c8d3){return function(_0x85f6f1){if(!_0x85f6f1){_0x8e5fb5[_0x6473('0x2e')](0x194);}return _0x85f6f1;};}function handleError(_0x12b8f0,_0x504f12){_0x504f12=_0x504f12||0x1f4;return function(_0x2d4e4d){logger[_0x6473('0x2f')](_0x2d4e4d[_0x6473('0x30')]);if(_0x2d4e4d[_0x6473('0x31')]){delete _0x2d4e4d[_0x6473('0x31')];}_0x12b8f0[_0x6473('0x1e')](_0x504f12)['send'](_0x2d4e4d);};}exports[_0x6473('0x32')]=function(_0x51b22c,_0x23f58b){var _0x71e5d9={},_0x35ef05={},_0x51c95b={'count':0x0,'rows':[]};var _0x2b008d=_['map'](db[_0x6473('0x33')][_0x6473('0x34')],function(_0x4ae675){return{'name':_0x4ae675[_0x6473('0x35')],'type':_0x4ae675['type'][_0x6473('0x36')]};});_0x35ef05[_0x6473('0x37')]=_[_0x6473('0x38')](_0x2b008d,_0x6473('0x31'));_0x35ef05[_0x6473('0x39')]=_[_0x6473('0x3a')](_0x51b22c['query']);_0x35ef05[_0x6473('0x3b')]=_['intersection'](_0x35ef05[_0x6473('0x37')],_0x35ef05[_0x6473('0x39')]);_0x71e5d9[_0x6473('0x3c')]=_[_0x6473('0x3d')](_0x35ef05[_0x6473('0x37')],qs['fields'](_0x51b22c['query'][_0x6473('0x3e')]));_0x71e5d9['attributes']=_0x71e5d9[_0x6473('0x3c')][_0x6473('0x3f')]?_0x71e5d9[_0x6473('0x3c')]:_0x35ef05[_0x6473('0x37')];if(!_0x51b22c[_0x6473('0x39')][_0x6473('0x40')](_0x6473('0x41'))){_0x71e5d9[_0x6473('0x22')]=qs[_0x6473('0x22')](_0x51b22c[_0x6473('0x39')][_0x6473('0x22')]);_0x71e5d9[_0x6473('0x20')]=qs[_0x6473('0x20')](_0x51b22c['query'][_0x6473('0x20')]);}_0x71e5d9[_0x6473('0x42')]=qs[_0x6473('0x43')](_0x51b22c[_0x6473('0x39')][_0x6473('0x43')]);_0x71e5d9[_0x6473('0x44')]=qs[_0x6473('0x3b')](_['pick'](_0x51b22c['query'],_0x35ef05[_0x6473('0x3b')]),_0x2b008d);if(_0x51b22c['query'][_0x6473('0x45')]){_0x71e5d9[_0x6473('0x44')]=_['merge'](_0x71e5d9[_0x6473('0x44')],{'$or':_[_0x6473('0x38')](_0x2b008d,function(_0x12ce33){if(_0x12ce33['type']!==_0x6473('0x46')){var _0x4ccd91={};_0x4ccd91[_0x12ce33['name']]={'$like':'%'+_0x51b22c[_0x6473('0x39')][_0x6473('0x45')]+'%'};return _0x4ccd91;}})});}_0x71e5d9=_[_0x6473('0x47')]({},_0x71e5d9,_0x51b22c[_0x6473('0x48')]);var _0x1675b5={'where':_0x71e5d9[_0x6473('0x44')]};return db[_0x6473('0x33')][_0x6473('0x23')](_0x1675b5)[_0x6473('0x2a')](function(_0x5bde08){_0x51c95b['count']=_0x5bde08;if(_0x51b22c[_0x6473('0x39')][_0x6473('0x49')]){_0x71e5d9[_0x6473('0x4a')]=[{'all':!![]}];}return db[_0x6473('0x33')]['findAll'](_0x71e5d9);})['then'](function(_0x16cc48){_0x51c95b[_0x6473('0x4b')]=_0x16cc48;return _0x51c95b;})['then'](respondWithFilteredResult(_0x23f58b,_0x71e5d9))['catch'](handleError(_0x23f58b,null));};exports[_0x6473('0x4c')]=function(_0xc3c8ea,_0x5277cb){var _0x1864d7={'raw':!![],'where':{'id':_0xc3c8ea[_0x6473('0x4d')]['id']}},_0x2b7655={};_0x2b7655[_0x6473('0x37')]=_[_0x6473('0x3a')](db[_0x6473('0x33')][_0x6473('0x34')]);_0x2b7655['query']=_[_0x6473('0x3a')](_0xc3c8ea[_0x6473('0x39')]);_0x2b7655[_0x6473('0x3b')]=_[_0x6473('0x3d')](_0x2b7655[_0x6473('0x37')],_0x2b7655[_0x6473('0x39')]);_0x1864d7[_0x6473('0x3c')]=_[_0x6473('0x3d')](_0x2b7655[_0x6473('0x37')],qs[_0x6473('0x3e')](_0xc3c8ea['query'][_0x6473('0x3e')]));_0x1864d7[_0x6473('0x3c')]=_0x1864d7[_0x6473('0x3c')][_0x6473('0x3f')]?_0x1864d7[_0x6473('0x3c')]:_0x2b7655[_0x6473('0x37')];if(_0xc3c8ea['query'][_0x6473('0x49')]){_0x1864d7['include']=[{'all':!![]}];}_0x1864d7=_['merge']({},_0x1864d7,_0xc3c8ea[_0x6473('0x48')]);return db[_0x6473('0x33')]['find'](_0x1864d7)[_0x6473('0x2a')](handleEntityNotFound(_0x5277cb,null))['then'](respondWithResult(_0x5277cb,null))[_0x6473('0x4e')](handleError(_0x5277cb,null));};exports[_0x6473('0x4f')]=function(_0x2433e4,_0x69484){return db[_0x6473('0x33')]['create'](_0x2433e4[_0x6473('0x50')],{})[_0x6473('0x2a')](function(_0xadbed5){var _0xf404c8=_0x2433e4[_0x6473('0x51')][_0x6473('0x2b')]({'plain':!![]});if(!_0xf404c8)throw new Error(_0x6473('0x52'));if(_0xf404c8[_0x6473('0x53')]===_0x6473('0x51')){var _0xa7464c=_0xadbed5['get']({'plain':!![]});var _0xf13d78=_0x6473('0x2c');return db[_0x6473('0x54')][_0x6473('0x55')]({'where':{'name':_0xf13d78,'userProfileId':_0xf404c8[_0x6473('0x56')]},'raw':!![]})[_0x6473('0x2a')](function(_0x16b0a1){if(_0x16b0a1&&_0x16b0a1[_0x6473('0x57')]===0x0){return db['UserProfileResource'][_0x6473('0x4f')]({'name':_0xa7464c['name'],'resourceId':_0xa7464c['id'],'type':_0x16b0a1[_0x6473('0x31')],'sectionId':_0x16b0a1['id']},{})['then'](function(){return _0xadbed5;});}else{return _0xadbed5;}})[_0x6473('0x4e')](function(_0x45e4ee){logger[_0x6473('0x2f')](_0x6473('0x58'),_0x45e4ee);throw _0x45e4ee;});}return _0xadbed5;})[_0x6473('0x2a')](respondWithResult(_0x69484,0xc9))[_0x6473('0x4e')](handleError(_0x69484,null));};exports[_0x6473('0x28')]=function(_0x405992,_0xf38efd){if(_0x405992[_0x6473('0x50')]['id']){delete _0x405992[_0x6473('0x50')]['id'];}return db[_0x6473('0x33')][_0x6473('0x55')]({'where':{'id':_0x405992['params']['id']}})[_0x6473('0x2a')](handleEntityNotFound(_0xf38efd,null))[_0x6473('0x2a')](saveUpdates(_0x405992['body'],null))[_0x6473('0x2a')](respondWithResult(_0xf38efd,null))[_0x6473('0x4e')](handleError(_0xf38efd,null));};exports[_0x6473('0x29')]=function(_0x1bae08,_0x5387dc){return db[_0x6473('0x33')][_0x6473('0x55')]({'where':{'id':_0x1bae08[_0x6473('0x4d')]['id']}})[_0x6473('0x2a')](handleEntityNotFound(_0x5387dc,null))[_0x6473('0x2a')](removeEntity(_0x5387dc,null))[_0x6473('0x4e')](handleError(_0x5387dc,null));};exports[_0x6473('0x59')]=function(_0x31703a,_0x547f61){return db['OpenchannelQueue']['describe']()['then'](respondWithResult(_0x547f61,null))[_0x6473('0x4e')](handleError(_0x547f61,null));};exports[_0x6473('0x5a')]=function(_0x16af21,_0x5cd100,_0x3a5a9d){var _0x58ddbc={'raw':!![],'where':{}},_0x245f72={},_0x5e7f5f;return db['OpenchannelQueue'][_0x6473('0x5b')]({'where':{'id':_0x16af21['params']['id']}})[_0x6473('0x2a')](handleEntityNotFound(_0x5cd100,null))[_0x6473('0x2a')](function(_0xeb9d23){if(_0xeb9d23){_0x5e7f5f=_0xeb9d23[_0x6473('0x2b')]({'plain':!![]});_0x245f72[_0x6473('0x37')]=_[_0x6473('0x3a')](db[_0x6473('0x5c')]['rawAttributes']);_0x245f72[_0x6473('0x39')]=_[_0x6473('0x3a')](_0x16af21[_0x6473('0x39')]);_0x245f72['filters']=_[_0x6473('0x3d')](_0x245f72[_0x6473('0x37')],_0x245f72[_0x6473('0x39')]);_0x58ddbc[_0x6473('0x3c')]=_[_0x6473('0x3d')](_0x245f72[_0x6473('0x37')],qs[_0x6473('0x3e')](_0x16af21[_0x6473('0x39')][_0x6473('0x3e')]));_0x58ddbc[_0x6473('0x3c')]=_0x58ddbc['attributes'][_0x6473('0x3f')]?_0x58ddbc[_0x6473('0x3c')]:_0x245f72[_0x6473('0x37')];if(!_0x16af21['query'][_0x6473('0x40')](_0x6473('0x41'))){_0x58ddbc[_0x6473('0x22')]=qs[_0x6473('0x22')](_0x16af21['query'][_0x6473('0x22')]);_0x58ddbc[_0x6473('0x20')]=qs['offset'](_0x16af21[_0x6473('0x39')]['offset']);}_0x58ddbc[_0x6473('0x42')]=qs['sort'](_0x16af21[_0x6473('0x39')][_0x6473('0x43')]);_0x58ddbc[_0x6473('0x44')]=qs['filters'](_[_0x6473('0x5d')](_0x16af21[_0x6473('0x39')],_0x245f72[_0x6473('0x3b')]));_0x58ddbc[_0x6473('0x44')][_0x6473('0x5e')]=_0xeb9d23['id'];if(_0x16af21[_0x6473('0x39')][_0x6473('0x45')]){_0x58ddbc[_0x6473('0x44')]=_[_0x6473('0x47')](_0x58ddbc[_0x6473('0x44')],{'$or':_[_0x6473('0x38')](_0x58ddbc[_0x6473('0x3c')],function(_0x2b589d){var _0x3644e3={};_0x3644e3[_0x2b589d]={'$like':'%'+_0x16af21[_0x6473('0x39')][_0x6473('0x45')]+'%'};return _0x3644e3;})});}_0x58ddbc=_[_0x6473('0x47')]({},_0x58ddbc,_0x16af21[_0x6473('0x48')]);return db[_0x6473('0x5c')][_0x6473('0x5f')](_0x58ddbc);}})[_0x6473('0x2a')](function(_0x529c97){if(_0x529c97){return db[_0x6473('0x60')]['findAndCountAll']({'where':{'id':_[_0x6473('0x38')](_0x529c97,_0x6473('0x61')),'role':_0x6473('0x62')},'attributes':['id',_0x6473('0x31'),_0x6473('0x63'),_0x6473('0x64'),'createdAt']});}})[_0x6473('0x2a')](function(_0x15e84a){if(_0x15e84a){return{'count':_0x15e84a[_0x6473('0x23')],'rows':_[_0x6473('0x38')](_0x15e84a[_0x6473('0x4b')],function(_0x4db54e){return{'membername':_0x4db54e[_0x6473('0x31')],'UserId':_0x4db54e['id'],'queue_name':_0x5e7f5f[_0x6473('0x31')],'OpenchannelQueueId':_0x5e7f5f['id'],'interface':util[_0x6473('0x65')](_0x6473('0x66'),_0x6473('0x67'),_0x4db54e[_0x6473('0x31')]),'penalty':0x0,'paused':_0x4db54e['openchannelPause'],'createdAt':_0x4db54e[_0x6473('0x68')],'updatedAt':_0x4db54e[_0x6473('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6473('0x2a')](respondWithFilteredResult(_0x5cd100,_0x58ddbc))[_0x6473('0x4e')](handleError(_0x5cd100,null));};exports[_0x6473('0x69')]=function(_0x18d55a,_0x215382,_0x450c75){var _0x5ad10a={};var _0x365c7a={};var _0x407ba6;var _0x223f5a;return db[_0x6473('0x33')][_0x6473('0x5b')]({'where':{'id':_0x18d55a[_0x6473('0x4d')]['id']}})[_0x6473('0x2a')](handleEntityNotFound(_0x215382,null))[_0x6473('0x2a')](function(_0x1454f9){if(_0x1454f9){_0x407ba6=_0x1454f9;_0x365c7a[_0x6473('0x37')]=_[_0x6473('0x3a')](db['Team'][_0x6473('0x34')]);_0x365c7a[_0x6473('0x39')]=_['keys'](_0x18d55a[_0x6473('0x39')]);_0x365c7a[_0x6473('0x3b')]=_['intersection'](_0x365c7a['model'],_0x365c7a[_0x6473('0x39')]);_0x5ad10a['attributes']=_[_0x6473('0x3d')](_0x365c7a['model'],qs[_0x6473('0x3e')](_0x18d55a['query']['fields']));_0x5ad10a[_0x6473('0x3c')]=_0x5ad10a[_0x6473('0x3c')][_0x6473('0x3f')]?_0x5ad10a['attributes']:_0x365c7a[_0x6473('0x37')];_0x5ad10a['order']=qs['sort'](_0x18d55a[_0x6473('0x39')][_0x6473('0x43')]);_0x5ad10a['where']=qs[_0x6473('0x3b')](_[_0x6473('0x5d')](_0x18d55a[_0x6473('0x39')],_0x365c7a[_0x6473('0x3b')]));if(_0x18d55a[_0x6473('0x39')]['filter']){_0x5ad10a[_0x6473('0x44')]=_[_0x6473('0x47')](_0x5ad10a[_0x6473('0x44')],{'$or':_['map'](_0x5ad10a[_0x6473('0x3c')],function(_0x23941a){var _0x53abb4={};_0x53abb4[_0x23941a]={'$like':'%'+_0x18d55a[_0x6473('0x39')][_0x6473('0x45')]+'%'};return _0x53abb4;})});}_0x5ad10a=_[_0x6473('0x47')]({},_0x5ad10a,_0x18d55a[_0x6473('0x48')]);return _0x407ba6[_0x6473('0x69')](_0x5ad10a);}})[_0x6473('0x2a')](function(_0x24ba2e){if(_0x24ba2e){_0x223f5a=_0x24ba2e[_0x6473('0x3f')];if(!_0x18d55a[_0x6473('0x39')][_0x6473('0x40')](_0x6473('0x41'))){_0x5ad10a['limit']=qs[_0x6473('0x22')](_0x18d55a[_0x6473('0x39')][_0x6473('0x22')]);_0x5ad10a[_0x6473('0x20')]=qs['offset'](_0x18d55a['query']['offset']);}return _0x407ba6[_0x6473('0x69')](_0x5ad10a);}})['then'](function(_0x1aa7a5){if(_0x1aa7a5){return _0x1aa7a5?{'count':_0x223f5a,'rows':_0x1aa7a5}:null;}})[_0x6473('0x2a')](respondWithResult(_0x215382,null))[_0x6473('0x4e')](handleError(_0x215382,null));};exports[_0x6473('0x6a')]=function(_0x221400,_0x4c819a,_0x4ae0d6){var _0x54740e=_0x221400['body'][_0x6473('0x6b')];return db[_0x6473('0x6c')]['findAll']({'where':{'id':_0x54740e},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6473('0x6d'),'attributes':['id',_0x6473('0x31'),_0x6473('0x6e'),'voicePause',_0x6473('0x6f')],'raw':!![]}]})['then'](function(_0x20e2af){if(_0x20e2af){var _0x5e43e6=_[_0x6473('0x70')](_0x20e2af,function(_0x180c02){var _0x1535f9=_0x180c02[_0x6473('0x2b')]({'plain':!![]});return _0x1535f9[_0x6473('0x6d')];});return db[_0x6473('0x33')][_0x6473('0x55')]({'where':{'id':_0x221400[_0x6473('0x4d')]['id']}})[_0x6473('0x2a')](function(_0x42a0c0){return db[_0x6473('0x71')][_0x6473('0x72')](function(_0x16605c){return _0x42a0c0[_0x6473('0x6a')](_0x54740e,{'transaction':_0x16605c})[_0x6473('0x2a')](function(){return BPromise[_0x6473('0x73')](_0x5e43e6,function(_0x13aad9){return db[_0x6473('0x5c')][_0x6473('0x74')]({'where':{'UserId':_0x13aad9['id'],'OpenchannelQueueId':_0x221400[_0x6473('0x4d')]['id']},'transaction':_0x16605c});});})['then'](function(){_0x5e43e6[_0x6473('0x75')](function(_0x3cb4cb){socket['emit'](_0x6473('0x76'),{'UserId':_0x3cb4cb['id'],'OpenchannelQueueId':_0x42a0c0['id']});});});});});}})['then'](respondWithStatusCode(_0x4c819a,null))[_0x6473('0x4e')](handleError(_0x4c819a,null));};exports[_0x6473('0x77')]=function(_0x487539,_0x5e85c2,_0x11de26){return db[_0x6473('0x6c')][_0x6473('0x5f')]({'where':{'id':_0x487539[_0x6473('0x39')][_0x6473('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x6473('0x60')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5e85c2,null))['then'](function(_0x27d069){var _0xeb5cdd=_[_0x6473('0x38')](_0x27d069,'id');var _0x4c3236=[];var _0x2bb652=[];var _0x50d6af=squel['select']();_0x50d6af[_0x6473('0x78')](_0x6473('0x79'))[_0x6473('0x7a')](_0x6473('0x7b'),'tq')[_0x6473('0x7c')](_0x6473('0x7d'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x6473('0x7e'),_0x487539[_0x6473('0x4d')]['id']);for(var _0xe9c7e3=0x0;_0xe9c7e3<_0x27d069[_0x6473('0x3f')];_0xe9c7e3+=0x1){let _0x417588=_0x27d069[_0xe9c7e3];for(var _0x489994=0x0;_0x489994<_0x417588['Agents'][_0x6473('0x3f')];_0x489994+=0x1){let _0x138c22=_0x417588[_0x6473('0x6d')][_0x489994];var _0x3905ab=_0x50d6af['clone']();_0x3905ab['where'](_0x6473('0x7f'),_0x138c22['id']);_0x2bb652['push'](db['sequelize'][_0x6473('0x39')](_0x3905ab['toString'](),{'type':db[_0x6473('0x71')]['QueryTypes'][_0x6473('0x80')]})[_0x6473('0x2a')](function(_0x147d3b){if(_0x147d3b['length']===0x1){return _0x138c22['id'];}else{var _0x9204d=_[_0x6473('0x81')](_[_0x6473('0x38')](_0x147d3b,_0x6473('0x82')),function(_0x5b8d5b){return _['includes'](_0xeb5cdd,_0x5b8d5b);});if(_0x9204d){return _0x138c22['id'];}}}));}}return BPromise[_0x6473('0x83')](_0x2bb652)[_0x6473('0x2a')](function(_0x44240f){_0x4c3236=_(_0x4c3236)[_0x6473('0x84')](_0x44240f)[_0x6473('0x85')]()['value']();return db[_0x6473('0x33')][_0x6473('0x55')]({'where':{'id':_0x487539[_0x6473('0x4d')]['id']}})['then'](function(_0x22e6b8){return db[_0x6473('0x71')][_0x6473('0x72')](function(_0x42e3c1){return _0x22e6b8[_0x6473('0x77')](_0x487539[_0x6473('0x39')][_0x6473('0x6b')],{'transaction':_0x42e3c1})[_0x6473('0x2a')](function(){if(!_[_0x6473('0x86')](_0x4c3236)){return _0x22e6b8[_0x6473('0x87')](_0x4c3236,{'transaction':_0x42e3c1});}})[_0x6473('0x2a')](function(){_0x4c3236[_0x6473('0x75')](function(_0x30b1f7){socket['emit']('userOpenchannelQueue:remove',{'UserId':_0x30b1f7,'OpenchannelQueueId':_0x22e6b8['id']});});});});});});})[_0x6473('0x2a')](respondWithStatusCode(_0x5e85c2,null))[_0x6473('0x4e')](handleError(_0x5e85c2,null));};exports[_0x6473('0x88')]=function(_0x3d099f,_0x5ddba5,_0xe7e008){return db[_0x6473('0x33')][_0x6473('0x55')]({'where':{'id':_0x3d099f['params']['id']}})[_0x6473('0x2a')](handleEntityNotFound(_0x5ddba5,null))[_0x6473('0x2a')](function(_0x3ef620){if(_0x3ef620){return _0x3ef620[_0x6473('0x88')](_0x3d099f[_0x6473('0x50')][_0x6473('0x6b')],_['omit'](_0x3d099f['body'],[_0x6473('0x6b'),'id'])||{})[_0x6473('0x89')](function(_0x155da9){for(var _0xa6ced8=0x0;_0xa6ced8<_0x3d099f[_0x6473('0x50')]['ids'][_0x6473('0x3f')];_0xa6ced8+=0x1){socket[_0x6473('0x8a')](_0x6473('0x76'),{'UserId':Number(_0x3d099f[_0x6473('0x50')][_0x6473('0x6b')][_0xa6ced8]),'OpenchannelQueueId':Number(_0x3d099f[_0x6473('0x4d')]['id'])});}return _0x155da9;});}})[_0x6473('0x2a')](respondWithResult(_0x5ddba5,null))[_0x6473('0x4e')](handleError(_0x5ddba5,null));};exports[_0x6473('0x87')]=function(_0x359067,_0x4b74ba,_0x231fd7){return db[_0x6473('0x33')][_0x6473('0x55')]({'where':{'id':_0x359067[_0x6473('0x4d')]['id']}})[_0x6473('0x2a')](handleEntityNotFound(_0x4b74ba,null))[_0x6473('0x2a')](function(_0x3c3d4d){if(_0x3c3d4d){return _0x3c3d4d['removeAgents'](_0x359067[_0x6473('0x39')][_0x6473('0x6b')])[_0x6473('0x2a')](function(){if(_[_0x6473('0x8b')](_0x359067[_0x6473('0x39')][_0x6473('0x6b')])){for(var _0x2ecf3a=0x0;_0x2ecf3a<_0x359067[_0x6473('0x39')][_0x6473('0x6b')]['length'];_0x2ecf3a+=0x1){socket[_0x6473('0x8a')]('userOpenchannelQueue:remove',{'UserId':Number(_0x359067['query'][_0x6473('0x6b')][_0x2ecf3a]),'OpenchannelQueueId':Number(_0x359067[_0x6473('0x4d')]['id'])});}}else{socket[_0x6473('0x8a')]('userOpenchannelQueue:remove',{'UserId':Number(_0x359067['query'][_0x6473('0x6b')]),'OpenchannelQueueId':Number(_0x359067['params']['id'])});}});}})['then'](respondWithStatusCode(_0x4b74ba,null))[_0x6473('0x4e')](handleError(_0x4b74ba,null));};exports['getAgents']=function(_0x105330,_0x555ef5,_0x389148){var _0x281ace={};var _0x472ef6={};var _0x4fa5f6;var _0x2651aa;return db[_0x6473('0x33')][_0x6473('0x5b')]({'where':{'id':_0x105330[_0x6473('0x4d')]['id']}})['then'](handleEntityNotFound(_0x555ef5,null))[_0x6473('0x2a')](function(_0x50c909){if(_0x50c909){_0x4fa5f6=_0x50c909;_0x472ef6[_0x6473('0x37')]=_['keys'](db[_0x6473('0x60')]['rawAttributes']);_0x472ef6[_0x6473('0x39')]=_['keys'](_0x105330[_0x6473('0x39')]);_0x472ef6[_0x6473('0x3b')]=_[_0x6473('0x3d')](_0x472ef6['model'],_0x472ef6[_0x6473('0x39')]);_0x281ace[_0x6473('0x3c')]=_[_0x6473('0x3d')](_0x472ef6['model'],qs[_0x6473('0x3e')](_0x105330['query'][_0x6473('0x3e')]));_0x281ace[_0x6473('0x3c')]=_0x281ace[_0x6473('0x3c')]['length']?_0x281ace[_0x6473('0x3c')]:_0x472ef6[_0x6473('0x37')];_0x281ace['order']=qs[_0x6473('0x43')](_0x105330['query'][_0x6473('0x43')]);_0x281ace[_0x6473('0x44')]=qs[_0x6473('0x3b')](_[_0x6473('0x5d')](_0x105330[_0x6473('0x39')],_0x472ef6[_0x6473('0x3b')]));if(_0x105330[_0x6473('0x39')]['filter']){_0x281ace[_0x6473('0x44')]=_[_0x6473('0x47')](_0x281ace['where'],{'$or':_[_0x6473('0x38')](_0x281ace['attributes'],function(_0x25fc97){var _0x46ba8c={};_0x46ba8c[_0x25fc97]={'$like':'%'+_0x105330[_0x6473('0x39')]['filter']+'%'};return _0x46ba8c;})});}_0x281ace=_[_0x6473('0x47')]({},_0x281ace,_0x105330[_0x6473('0x48')]);return _0x4fa5f6['getAgents'](_0x281ace);}})['then'](function(_0x353bbb){if(_0x353bbb){_0x2651aa=_0x353bbb[_0x6473('0x3f')];if(!_0x105330[_0x6473('0x39')][_0x6473('0x40')]('nolimit')){_0x281ace[_0x6473('0x22')]=qs['limit'](_0x105330[_0x6473('0x39')][_0x6473('0x22')]);_0x281ace['offset']=qs[_0x6473('0x20')](_0x105330[_0x6473('0x39')][_0x6473('0x20')]);}return _0x4fa5f6[_0x6473('0x8c')](_0x281ace);}})[_0x6473('0x2a')](function(_0x5495af){if(_0x5495af){return _0x5495af?{'count':_0x2651aa,'rows':_0x5495af}:null;}})['then'](respondWithResult(_0x555ef5,null))[_0x6473('0x4e')](handleError(_0x555ef5,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index c4505a9..30dca92 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 _0xaa87=['hasOwnProperty','hook','exports','../../mysqldb','OpenchannelQueue','save','update','emit'];(function(_0x3aec43,_0x1b69b6){var _0x49b1ac=function(_0x117579){while(--_0x117579){_0x3aec43['push'](_0x3aec43['shift']());}};_0x49b1ac(++_0x1b69b6);}(_0xaa87,0x1b3));var _0x7aa8=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xaa87[_0x1cc8fe];return _0x230054;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x7aa8('0x0'))['db'][_0x7aa8('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7aa8('0x2'),'afterUpdate':_0x7aa8('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5698f0){return function(_0xff3fd5,_0x711c25,_0x4a577f){OpenchannelQueueEvents[_0x7aa8('0x4')](_0x5698f0+':'+_0xff3fd5['id'],_0xff3fd5);OpenchannelQueueEvents[_0x7aa8('0x4')](_0x5698f0,_0xff3fd5);_0x4a577f(null);};}for(var e in events){if(events[_0x7aa8('0x5')](e)){var event=events[e];OpenchannelQueue[_0x7aa8('0x6')](e,emitEvent(event));}}module[_0x7aa8('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xdf4b=['events','../../mysqldb','setMaxListeners','save','update','emit','hook','exports'];(function(_0x2fc741,_0x4f327f){var _0x589e02=function(_0x13f337){while(--_0x13f337){_0x2fc741['push'](_0x2fc741['shift']());}};_0x589e02(++_0x4f327f);}(_0xdf4b,0x88));var _0xbdf4=function(_0x532e23,_0x2c6329){_0x532e23=_0x532e23-0x0;var _0x55eb3f=_0xdf4b[_0x532e23];return _0x55eb3f;};'use strict';var EventEmitter=require(_0xbdf4('0x0'));var OpenchannelQueue=require(_0xbdf4('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xbdf4('0x2')](0x0);var events={'afterCreate':_0xbdf4('0x3'),'afterUpdate':_0xbdf4('0x4'),'afterDestroy':'remove'};function emitEvent(_0x54bf58){return function(_0x486822,_0x264d19,_0x460118){OpenchannelQueueEvents[_0xbdf4('0x5')](_0x54bf58+':'+_0x486822['id'],_0x486822);OpenchannelQueueEvents[_0xbdf4('0x5')](_0x54bf58,_0x486822);_0x460118(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xbdf4('0x6')](e,emitEvent(event));}}module[_0xbdf4('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 7d7831d..79b51bc 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 _0xb349=['exports','OpenchannelQueue','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelQueue.attributes'];(function(_0x2f1848,_0x151655){var _0x2bff71=function(_0x2aadf2){while(--_0x2aadf2){_0x2f1848['push'](_0x2f1848['shift']());}};_0x2bff71(++_0x151655);}(_0xb349,0x1e6));var _0x9b34=function(_0x4ae52c,_0x5dda74){_0x4ae52c=_0x4ae52c-0x0;var _0xb91678=_0xb349[_0x4ae52c];return _0xb91678;};'use strict';var _=require(_0x9b34('0x0'));var util=require('util');var logger=require(_0x9b34('0x1'))(_0x9b34('0x2'));var moment=require(_0x9b34('0x3'));var BPromise=require(_0x9b34('0x4'));var rp=require(_0x9b34('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9b34('0x6'));var config=require(_0x9b34('0x7'));var attributes=require(_0x9b34('0x8'));module[_0x9b34('0x9')]=function(_0x49f45e,_0x191e21){return _0x49f45e['define'](_0x9b34('0xa'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc07=['util','../../config/logger','api','moment','bluebird','request-promise','exports','define','OpenchannelQueue','openchannel_queues','lodash'];(function(_0x448f04,_0xa951e9){var _0x37641f=function(_0x4a0c58){while(--_0x4a0c58){_0x448f04['push'](_0x448f04['shift']());}};_0x37641f(++_0xa951e9);}(_0xfc07,0x1cd));var _0x7fc0=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xfc07[_0x565ed7];return _0x183ad7;};'use strict';var _=require(_0x7fc0('0x0'));var util=require(_0x7fc0('0x1'));var logger=require(_0x7fc0('0x2'))(_0x7fc0('0x3'));var moment=require(_0x7fc0('0x4'));var BPromise=require(_0x7fc0('0x5'));var rp=require(_0x7fc0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelQueue.attributes');module[_0x7fc0('0x7')]=function(_0x48d2f5,_0x50bd7a){return _0x48d2f5[_0x7fc0('0x8')](_0x7fc0('0x9'),attributes,{'tableName':_0x7fc0('0xa'),'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 551a231..dd3aa65 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 _0xb884=['map','attributes','model','then','catch','find','where','ShowOpenchannelQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','redis','defaults','localhost','register','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','GetOpenchannelQueue','OpenchannelQueue','options','raw','limit','include'];(function(_0x217ba3,_0x57c162){var _0x164dce=function(_0x303959){while(--_0x303959){_0x217ba3['push'](_0x217ba3['shift']());}};_0x164dce(++_0x57c162);}(_0xb884,0x143));var _0x4b88=function(_0x38aa04,_0x2c8039){_0x38aa04=_0x38aa04-0x0;var _0x39bb22=_0xb884[_0x38aa04];return _0x39bb22;};'use strict';var _=require(_0x4b88('0x0'));var util=require(_0x4b88('0x1'));var moment=require(_0x4b88('0x2'));var BPromise=require(_0x4b88('0x3'));var rs=require(_0x4b88('0x4'));var fs=require('fs');var Redis=require(_0x4b88('0x5'));var db=require(_0x4b88('0x6'))['db'];var utils=require(_0x4b88('0x7'));var logger=require(_0x4b88('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x4b88('0x9')]=_[_0x4b88('0xa')](config['redis'],{'host':_0x4b88('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4b88('0x9')]));require('./openchannelQueue.socket')[_0x4b88('0xc')](socket);function respondWithRpcPromise(_0x5cb33d,_0x1bee0f,_0x4a77ec){return new BPromise(function(_0x2e4ac6,_0x5bc484){return client['request'](_0x5cb33d,_0x4a77ec)['then'](function(_0x3bc347){logger['info'](_0x4b88('0xd'),_0x1bee0f,_0x4b88('0xe'));logger[_0x4b88('0xf')](_0x4b88('0x10'),_0x1bee0f,_0x4b88('0xe'),JSON[_0x4b88('0x11')](_0x3bc347));if(_0x3bc347[_0x4b88('0x12')]){if(_0x3bc347[_0x4b88('0x12')]['code']===0x1f4){logger[_0x4b88('0x12')](_0x4b88('0xd'),_0x1bee0f,_0x3bc347[_0x4b88('0x12')][_0x4b88('0x13')]);return _0x5bc484(_0x3bc347['error'][_0x4b88('0x13')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x1bee0f,_0x3bc347[_0x4b88('0x12')][_0x4b88('0x13')]);return _0x2e4ac6(_0x3bc347[_0x4b88('0x12')][_0x4b88('0x13')]);}else{logger[_0x4b88('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x1bee0f,_0x4b88('0xe'));_0x2e4ac6(_0x3bc347['result']['message']);}})['catch'](function(_0x23df93){logger[_0x4b88('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x1bee0f,_0x23df93);_0x5bc484(_0x23df93);});});}exports[_0x4b88('0x15')]=function(_0x33cf1c){var _0x126d17=this;return new Promise(function(_0x4a646b,_0x386495){return db[_0x4b88('0x16')]['findAll']({'raw':_0x33cf1c[_0x4b88('0x17')]?_0x33cf1c[_0x4b88('0x17')][_0x4b88('0x18')]===undefined?!![]:![]:!![],'where':_0x33cf1c[_0x4b88('0x17')]?_0x33cf1c[_0x4b88('0x17')]['where']||null:null,'attributes':_0x33cf1c['options']?_0x33cf1c[_0x4b88('0x17')]['attributes']||null:null,'limit':_0x33cf1c[_0x4b88('0x17')]?_0x33cf1c['options'][_0x4b88('0x19')]||null:null,'include':_0x33cf1c[_0x4b88('0x17')]?_0x33cf1c['options'][_0x4b88('0x1a')]?_[_0x4b88('0x1b')](_0x33cf1c[_0x4b88('0x17')][_0x4b88('0x1a')],function(_0x5d2505){return{'model':db[_0x5d2505['model']],'as':_0x5d2505['as'],'attributes':_0x5d2505[_0x4b88('0x1c')],'include':_0x5d2505[_0x4b88('0x1a')]?_[_0x4b88('0x1b')](_0x5d2505[_0x4b88('0x1a')],function(_0x1a9d83){return{'model':db[_0x1a9d83[_0x4b88('0x1d')]],'as':_0x1a9d83['as'],'attributes':_0x1a9d83[_0x4b88('0x1c')],'include':_0x1a9d83[_0x4b88('0x1a')]?_[_0x4b88('0x1b')](_0x1a9d83[_0x4b88('0x1a')],function(_0x5ab971){return{'model':db[_0x5ab971[_0x4b88('0x1d')]],'as':_0x5ab971['as'],'attributes':_0x5ab971['attributes']};}):[]};}):[]};}):[]:[]})[_0x4b88('0x1e')](function(_0x3b203c){logger[_0x4b88('0x14')]('GetOpenchannelQueue',_0x33cf1c);logger[_0x4b88('0xf')](_0x4b88('0x15'),_0x33cf1c,JSON[_0x4b88('0x11')](_0x3b203c));_0x4a646b(_0x3b203c);})[_0x4b88('0x1f')](function(_0x4c6f61){logger[_0x4b88('0x12')](_0x4b88('0x15'),_0x4c6f61['message'],_0x33cf1c);_0x386495(_0x126d17['error'](0x1f4,_0x4c6f61[_0x4b88('0x13')]));});});};exports['ShowOpenchannelQueue']=function(_0x515fc2){var _0x943313=this;return new Promise(function(_0x874ab9,_0x15a813){return db[_0x4b88('0x16')][_0x4b88('0x20')]({'raw':_0x515fc2['options']?_0x515fc2[_0x4b88('0x17')][_0x4b88('0x18')]===undefined?!![]:![]:!![],'where':_0x515fc2['options']?_0x515fc2['options'][_0x4b88('0x21')]||null:null,'attributes':_0x515fc2['options']?_0x515fc2[_0x4b88('0x17')][_0x4b88('0x1c')]||null:null,'include':_0x515fc2[_0x4b88('0x17')]?_0x515fc2[_0x4b88('0x17')][_0x4b88('0x1a')]?_[_0x4b88('0x1b')](_0x515fc2['options']['include'],function(_0x2cdbd0){return{'model':db[_0x2cdbd0['model']],'as':_0x2cdbd0['as'],'attributes':_0x2cdbd0[_0x4b88('0x1c')],'include':_0x2cdbd0[_0x4b88('0x1a')]?_[_0x4b88('0x1b')](_0x2cdbd0[_0x4b88('0x1a')],function(_0x10af47){return{'model':db[_0x10af47['model']],'as':_0x10af47['as'],'attributes':_0x10af47['attributes'],'include':_0x10af47[_0x4b88('0x1a')]?_['map'](_0x10af47[_0x4b88('0x1a')],function(_0x592262){return{'model':db[_0x592262[_0x4b88('0x1d')]],'as':_0x592262['as'],'attributes':_0x592262['attributes']};}):[]};}):[]};}):[]:[]})[_0x4b88('0x1e')](function(_0x5edbfd){logger['info'](_0x4b88('0x22'),_0x515fc2);logger[_0x4b88('0xf')](_0x4b88('0x22'),_0x515fc2,JSON[_0x4b88('0x11')](_0x5edbfd));_0x874ab9(_0x5edbfd);})[_0x4b88('0x1f')](function(_0x5d39eb){logger['error'](_0x4b88('0x22'),_0x5d39eb[_0x4b88('0x13')],_0x515fc2);_0x15a813(_0x943313[_0x4b88('0x12')](0x1f4,_0x5d39eb[_0x4b88('0x13')]));});});}; \ No newline at end of file +var _0xc40e=['OpenchannelQueue','findAll','options','where','attributes','limit','include','map','model','ShowOpenchannelQueue','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','request','then','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','GetOpenchannelQueue'];(function(_0x36a0b0,_0x1abe7a){var _0x5e8256=function(_0xe175e0){while(--_0xe175e0){_0x36a0b0['push'](_0x36a0b0['shift']());}};_0x5e8256(++_0x1abe7a);}(_0xc40e,0x1b0));var _0xec40=function(_0x3ef0db,_0x340169){_0x3ef0db=_0x3ef0db-0x0;var _0x11d71d=_0xc40e[_0x3ef0db];return _0x11d71d;};'use strict';var _=require(_0xec40('0x0'));var util=require(_0xec40('0x1'));var moment=require(_0xec40('0x2'));var BPromise=require(_0xec40('0x3'));var rs=require(_0xec40('0x4'));var fs=require('fs');var Redis=require(_0xec40('0x5'));var db=require(_0xec40('0x6'))['db'];var utils=require(_0xec40('0x7'));var logger=require('../../config/logger')(_0xec40('0x8'));var config=require(_0xec40('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xec40('0xa')][_0xec40('0xb')]({'port':0x232a});config[_0xec40('0xc')]=_[_0xec40('0xd')](config[_0xec40('0xc')],{'host':_0xec40('0xe'),'port':0x18eb});var socket=require(_0xec40('0xf'))(new Redis(config[_0xec40('0xc')]));require(_0xec40('0x10'))['register'](socket);function respondWithRpcPromise(_0x40741e,_0x58fbd2,_0x3cae20){return new BPromise(function(_0x21a515,_0x3168db){return client[_0xec40('0x11')](_0x40741e,_0x3cae20)[_0xec40('0x12')](function(_0xa175cf){logger[_0xec40('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x58fbd2,_0xec40('0x14'));logger[_0xec40('0x15')](_0xec40('0x16'),_0x58fbd2,'request\x20sent',JSON[_0xec40('0x17')](_0xa175cf));if(_0xa175cf[_0xec40('0x18')]){if(_0xa175cf[_0xec40('0x18')]['code']===0x1f4){logger[_0xec40('0x18')](_0xec40('0x19'),_0x58fbd2,_0xa175cf[_0xec40('0x18')][_0xec40('0x1a')]);return _0x3168db(_0xa175cf[_0xec40('0x18')][_0xec40('0x1a')]);}logger[_0xec40('0x18')](_0xec40('0x19'),_0x58fbd2,_0xa175cf[_0xec40('0x18')][_0xec40('0x1a')]);return _0x21a515(_0xa175cf['error'][_0xec40('0x1a')]);}else{logger[_0xec40('0x13')](_0xec40('0x19'),_0x58fbd2,_0xec40('0x14'));_0x21a515(_0xa175cf[_0xec40('0x1b')][_0xec40('0x1a')]);}})[_0xec40('0x1c')](function(_0x2aa8a6){logger[_0xec40('0x18')](_0xec40('0x19'),_0x58fbd2,_0x2aa8a6);_0x3168db(_0x2aa8a6);});});}exports[_0xec40('0x1d')]=function(_0x594d7b){var _0x2b868e=this;return new Promise(function(_0x4d4892,_0xc95358){return db[_0xec40('0x1e')][_0xec40('0x1f')]({'raw':_0x594d7b[_0xec40('0x20')]?_0x594d7b[_0xec40('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x594d7b[_0xec40('0x20')]?_0x594d7b[_0xec40('0x20')][_0xec40('0x21')]||null:null,'attributes':_0x594d7b['options']?_0x594d7b['options'][_0xec40('0x22')]||null:null,'limit':_0x594d7b['options']?_0x594d7b[_0xec40('0x20')][_0xec40('0x23')]||null:null,'include':_0x594d7b[_0xec40('0x20')]?_0x594d7b[_0xec40('0x20')][_0xec40('0x24')]?_[_0xec40('0x25')](_0x594d7b[_0xec40('0x20')][_0xec40('0x24')],function(_0x5cf2fb){return{'model':db[_0x5cf2fb[_0xec40('0x26')]],'as':_0x5cf2fb['as'],'attributes':_0x5cf2fb[_0xec40('0x22')],'include':_0x5cf2fb[_0xec40('0x24')]?_[_0xec40('0x25')](_0x5cf2fb[_0xec40('0x24')],function(_0x39003b){return{'model':db[_0x39003b[_0xec40('0x26')]],'as':_0x39003b['as'],'attributes':_0x39003b[_0xec40('0x22')],'include':_0x39003b[_0xec40('0x24')]?_[_0xec40('0x25')](_0x39003b['include'],function(_0x24329e){return{'model':db[_0x24329e['model']],'as':_0x24329e['as'],'attributes':_0x24329e['attributes']};}):[]};}):[]};}):[]:[]})[_0xec40('0x12')](function(_0x2cd2e6){logger[_0xec40('0x13')](_0xec40('0x1d'),_0x594d7b);logger[_0xec40('0x15')](_0xec40('0x1d'),_0x594d7b,JSON[_0xec40('0x17')](_0x2cd2e6));_0x4d4892(_0x2cd2e6);})['catch'](function(_0x3d3985){logger['error']('GetOpenchannelQueue',_0x3d3985[_0xec40('0x1a')],_0x594d7b);_0xc95358(_0x2b868e['error'](0x1f4,_0x3d3985[_0xec40('0x1a')]));});});};exports[_0xec40('0x27')]=function(_0x442d71){var _0x1d2bdc=this;return new Promise(function(_0x595830,_0x5eabb6){return db[_0xec40('0x1e')][_0xec40('0x28')]({'raw':_0x442d71[_0xec40('0x20')]?_0x442d71[_0xec40('0x20')][_0xec40('0x29')]===undefined?!![]:![]:!![],'where':_0x442d71[_0xec40('0x20')]?_0x442d71[_0xec40('0x20')][_0xec40('0x21')]||null:null,'attributes':_0x442d71[_0xec40('0x20')]?_0x442d71['options'][_0xec40('0x22')]||null:null,'include':_0x442d71[_0xec40('0x20')]?_0x442d71['options'][_0xec40('0x24')]?_['map'](_0x442d71[_0xec40('0x20')][_0xec40('0x24')],function(_0x1dc81e){return{'model':db[_0x1dc81e[_0xec40('0x26')]],'as':_0x1dc81e['as'],'attributes':_0x1dc81e[_0xec40('0x22')],'include':_0x1dc81e[_0xec40('0x24')]?_['map'](_0x1dc81e[_0xec40('0x24')],function(_0xa611b2){return{'model':db[_0xa611b2[_0xec40('0x26')]],'as':_0xa611b2['as'],'attributes':_0xa611b2['attributes'],'include':_0xa611b2[_0xec40('0x24')]?_['map'](_0xa611b2[_0xec40('0x24')],function(_0x34fa56){return{'model':db[_0x34fa56[_0xec40('0x26')]],'as':_0x34fa56['as'],'attributes':_0x34fa56[_0xec40('0x22')]};}):[]};}):[]};}):[]:[]})[_0xec40('0x12')](function(_0x5149a4){logger[_0xec40('0x13')]('ShowOpenchannelQueue',_0x442d71);logger[_0xec40('0x15')](_0xec40('0x27'),_0x442d71,JSON[_0xec40('0x17')](_0x5149a4));_0x595830(_0x5149a4);})[_0xec40('0x1c')](function(_0x497757){logger[_0xec40('0x18')](_0xec40('0x27'),_0x497757[_0xec40('0x1a')],_0x442d71);_0x5eabb6(_0x1d2bdc[_0xec40('0x18')](0x1f4,_0x497757[_0xec40('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index cca573a..945de9b 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 _0x9e42=['update','removeListener','register','length','openchannelQueue:','save'];(function(_0x2de0a7,_0x38d3e7){var _0x429437=function(_0x23c148){while(--_0x23c148){_0x2de0a7['push'](_0x2de0a7['shift']());}};_0x429437(++_0x38d3e7);}(_0x9e42,0x1d9));var _0x29e4=function(_0x5c619e,_0x1bccdf){_0x5c619e=_0x5c619e-0x0;var _0x445cf8=_0x9e42[_0x5c619e];return _0x445cf8;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x29e4('0x0'),'remove',_0x29e4('0x1')];function createListener(_0x25dacd,_0x2d0289){return function(_0x5a16b8){_0x2d0289['emit'](_0x25dacd,_0x5a16b8);};}function removeListener(_0x4ea165,_0x144521){return function(){OpenchannelQueueEvents[_0x29e4('0x2')](_0x4ea165,_0x144521);};}exports[_0x29e4('0x3')]=function(_0x3aaed2){for(var _0x5f0b48=0x0,_0x2b12f3=events[_0x29e4('0x4')];_0x5f0b48<_0x2b12f3;_0x5f0b48++){var _0x14485b=events[_0x5f0b48];var _0x3f8a16=createListener(_0x29e4('0x5')+_0x14485b,_0x3aaed2);OpenchannelQueueEvents['on'](_0x14485b,_0x3f8a16);}}; \ No newline at end of file +var _0xa7af=['update','emit','removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save','remove'];(function(_0x479d50,_0x4abfd8){var _0x13924e=function(_0x394540){while(--_0x394540){_0x479d50['push'](_0x479d50['shift']());}};_0x13924e(++_0x4abfd8);}(_0xa7af,0x114));var _0xfa7a=function(_0xfa3d78,_0x3bf79f){_0xfa3d78=_0xfa3d78-0x0;var _0x446841=_0xa7af[_0xfa3d78];return _0x446841;};'use strict';var OpenchannelQueueEvents=require(_0xfa7a('0x0'));var events=[_0xfa7a('0x1'),_0xfa7a('0x2'),_0xfa7a('0x3')];function createListener(_0x4e29d6,_0x33af0c){return function(_0x181f2f){_0x33af0c[_0xfa7a('0x4')](_0x4e29d6,_0x181f2f);};}function removeListener(_0x55b614,_0xf41f44){return function(){OpenchannelQueueEvents[_0xfa7a('0x5')](_0x55b614,_0xf41f44);};}exports[_0xfa7a('0x6')]=function(_0x3331f4){for(var _0x2c122b=0x0,_0x528549=events[_0xfa7a('0x7')];_0x2c122b<_0x528549;_0x2c122b++){var _0xd779f5=events[_0x2c122b];var _0x3eac96=createListener(_0xfa7a('0x8')+_0xd779f5,_0x3331f4);OpenchannelQueueEvents['on'](_0xd779f5,_0x3eac96);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 40cc71f..386be66 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 _0x0016=['../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create','put','delete','destroy','exports','multer','path','express','Router','fs-extra'];(function(_0x590a38,_0x2bc65c){var _0xf36626=function(_0x551cd1){while(--_0x551cd1){_0x590a38['push'](_0x590a38['shift']());}};_0xf36626(++_0x2bc65c);}(_0x0016,0xeb));var _0x6001=function(_0x585d81,_0xf6d74f){_0x585d81=_0x585d81-0x0;var _0x1aca0d=_0x0016[_0x585d81];return _0x1aca0d;};'use strict';var multer=require(_0x6001('0x0'));var util=require('util');var path=require(_0x6001('0x1'));var timeout=require('connect-timeout');var express=require(_0x6001('0x2'));var router=express[_0x6001('0x3')]();var fs_extra=require(_0x6001('0x4'));var auth=require(_0x6001('0x5'));var interaction=require(_0x6001('0x6'));var config=require('../../config/environment');var controller=require(_0x6001('0x7'));router['get']('/',auth[_0x6001('0x8')](),controller[_0x6001('0x9')]);router[_0x6001('0xa')](_0x6001('0xb'),auth[_0x6001('0x8')](),controller[_0x6001('0xc')]);router[_0x6001('0xa')](_0x6001('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x6001('0xe')]('/',auth['isAuthenticated'](),controller[_0x6001('0xf')]);router[_0x6001('0x10')](_0x6001('0xd'),auth[_0x6001('0x8')](),controller['update']);router[_0x6001('0x11')](_0x6001('0xd'),auth[_0x6001('0x8')](),controller[_0x6001('0x12')]);module[_0x6001('0x13')]=router; \ No newline at end of file +var _0x8bda=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','/describe','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','Router','fs-extra'];(function(_0x40a8ce,_0x298f1a){var _0x578903=function(_0x32140f){while(--_0x32140f){_0x40a8ce['push'](_0x40a8ce['shift']());}};_0x578903(++_0x298f1a);}(_0x8bda,0xfd));var _0xa8bd=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x8bda[_0x3b0731];return _0x4204d7;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa8bd('0x0')]();var fs_extra=require(_0xa8bd('0x1'));var auth=require(_0xa8bd('0x2'));var interaction=require(_0xa8bd('0x3'));var config=require(_0xa8bd('0x4'));var controller=require(_0xa8bd('0x5'));router[_0xa8bd('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa8bd('0x6')](_0xa8bd('0x7'),auth[_0xa8bd('0x8')](),controller['describe']);router[_0xa8bd('0x6')](_0xa8bd('0x9'),auth[_0xa8bd('0x8')](),controller[_0xa8bd('0xa')]);router['post']('/',auth[_0xa8bd('0x8')](),controller[_0xa8bd('0xb')]);router[_0xa8bd('0xc')](_0xa8bd('0x9'),auth['isAuthenticated'](),controller[_0xa8bd('0xd')]);router[_0xa8bd('0xe')]('/:id',auth[_0xa8bd('0x8')](),controller[_0xa8bd('0xf')]);module[_0xa8bd('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 54ee137..b154076 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 _0x5ff6=['STRING','DATE','moment','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ff6,0x18d));var _0x65ff=function(_0x2722ce,_0x8a5282){_0x2722ce=_0x2722ce-0x0;var _0x1a1339=_0x5ff6[_0x2722ce];return _0x1a1339;};'use strict';var moment=require(_0x65ff('0x0'));var Sequelize=require(_0x65ff('0x1'));module[_0x65ff('0x2')]={'uniqueid':{'type':Sequelize[_0x65ff('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x65ff('0x3')]},'joinAt':{'type':Sequelize[_0x65ff('0x4')]},'leaveAt':{'type':Sequelize[_0x65ff('0x4')]},'acceptAt':{'type':Sequelize[_0x65ff('0x4')]},'exitAt':{'type':Sequelize[_0x65ff('0x4')]},'reason':{'type':Sequelize[_0x65ff('0x3')]}}; \ No newline at end of file +var _0xb2f1=['STRING','DATE','moment','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb2f1,0xee));var _0x1b2f=function(_0x31227d,_0x51bd8e){_0x31227d=_0x31227d-0x0;var _0x438d0b=_0xb2f1[_0x31227d];return _0x438d0b;};'use strict';var moment=require(_0x1b2f('0x0'));var Sequelize=require(_0x1b2f('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x1b2f('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x1b2f('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x1b2f('0x3')]},'acceptAt':{'type':Sequelize[_0x1b2f('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 17dd0d6..b88ba59 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 _0x1549=['hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelQueueReport','then','include','findAll','rows','catch','show','params','find','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','sendStatus','error','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x4ba508,_0x39f27c){var _0x4e9c65=function(_0x5d4172){while(--_0x5d4172){_0x4ba508['push'](_0x4ba508['shift']());}};_0x4e9c65(++_0x39f27c);}(_0x1549,0x12d));var _0x9154=function(_0x34bd34,_0x1444f7){_0x34bd34=_0x34bd34-0x0;var _0x4e36d6=_0x1549[_0x34bd34];return _0x4e36d6;};'use strict';var emlformat=require(_0x9154('0x0'));var rimraf=require(_0x9154('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9154('0x2'));var rp=require(_0x9154('0x3'));var moment=require(_0x9154('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9154('0x5'));var path=require(_0x9154('0x6'));var sox=require(_0x9154('0x7'));var csv=require(_0x9154('0x8'));var ejs=require(_0x9154('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9154('0xa'));var squel=require(_0x9154('0xb'));var crypto=require(_0x9154('0xc'));var jsforce=require(_0x9154('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9154('0x8'));var querystring=require(_0x9154('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9154('0xf'));var qs=require(_0x9154('0x10'));var as=require(_0x9154('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9154('0x12'));var utils=require(_0x9154('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x9154('0x14'));var db=require(_0x9154('0x15'))['db'];function respondWithStatusCode(_0x549f7a,_0x1fc5eb){_0x1fc5eb=_0x1fc5eb||0xcc;return function(_0x2bf0bf){if(_0x2bf0bf){return _0x549f7a['sendStatus'](_0x1fc5eb);}return _0x549f7a[_0x9154('0x16')](_0x1fc5eb)['end']();};}function respondWithResult(_0x1dac0f,_0x2250b4){_0x2250b4=_0x2250b4||0xc8;return function(_0x159ef8){if(_0x159ef8){return _0x1dac0f[_0x9154('0x16')](_0x2250b4)['json'](_0x159ef8);}};}function respondWithFilteredResult(_0x328235,_0x5d447b){return function(_0x40254f){if(_0x40254f){var _0x23e8bf=typeof _0x5d447b[_0x9154('0x17')]===_0x9154('0x18')&&typeof _0x5d447b[_0x9154('0x19')]==='undefined';var _0x44622c=_0x40254f['count'];var _0x15f75d=_0x23e8bf?0x0:_0x5d447b['offset'];var _0x45f8aa=_0x23e8bf?_0x40254f[_0x9154('0x1a')]:_0x5d447b[_0x9154('0x17')]+_0x5d447b[_0x9154('0x19')];var _0x2cb646;if(_0x45f8aa>=_0x44622c){_0x45f8aa=_0x44622c;_0x2cb646=0xc8;}else{_0x2cb646=0xce;}_0x328235[_0x9154('0x16')](_0x2cb646);return _0x328235[_0x9154('0x1b')](_0x9154('0x1c'),_0x15f75d+'-'+_0x45f8aa+'/'+_0x44622c)[_0x9154('0x1d')](_0x40254f);}return null;};}function patchUpdates(_0x534084){return function(_0x45f094){try{jsonpatch[_0x9154('0x1e')](_0x45f094,_0x534084,!![]);}catch(_0xcff5e8){return BPromise[_0x9154('0x1f')](_0xcff5e8);}return _0x45f094[_0x9154('0x20')]();};}function saveUpdates(_0xbc002d,_0x414811){return function(_0x20b021){if(_0x20b021){return _0x20b021[_0x9154('0x21')](_0xbc002d)['then'](function(_0x31d53b){return _0x31d53b;});}return null;};}function removeEntity(_0x1f8a32,_0xbc91da){return function(_0x25dfd9){if(_0x25dfd9){return _0x25dfd9['destroy']()['then'](function(){_0x1f8a32[_0x9154('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35bf27,_0xbc9919){return function(_0x4aca70){if(!_0x4aca70){_0x35bf27[_0x9154('0x22')](0x194);}return _0x4aca70;};}function handleError(_0x590b86,_0x5f4bc5){_0x5f4bc5=_0x5f4bc5||0x1f4;return function(_0x22f6eb){logger[_0x9154('0x23')](_0x22f6eb['stack']);if(_0x22f6eb[_0x9154('0x24')]){delete _0x22f6eb[_0x9154('0x24')];}_0x590b86[_0x9154('0x16')](_0x5f4bc5)[_0x9154('0x25')](_0x22f6eb);};}exports['index']=function(_0x2515a6,_0x20d76a){var _0xb67217={},_0x5628b5={},_0x1b0939={'count':0x0,'rows':[]};var _0xd22a7f=_[_0x9154('0x26')](db['OpenchannelQueueReport'][_0x9154('0x27')],function(_0x3c3721){return{'name':_0x3c3721['fieldName'],'type':_0x3c3721[_0x9154('0x28')][_0x9154('0x29')]};});_0x5628b5[_0x9154('0x2a')]=_['map'](_0xd22a7f,_0x9154('0x24'));_0x5628b5[_0x9154('0x2b')]=_[_0x9154('0x2c')](_0x2515a6[_0x9154('0x2b')]);_0x5628b5[_0x9154('0x2d')]=_[_0x9154('0x2e')](_0x5628b5['model'],_0x5628b5[_0x9154('0x2b')]);_0xb67217[_0x9154('0x2f')]=_['intersection'](_0x5628b5['model'],qs[_0x9154('0x30')](_0x2515a6[_0x9154('0x2b')][_0x9154('0x30')]));_0xb67217[_0x9154('0x2f')]=_0xb67217[_0x9154('0x2f')]['length']?_0xb67217[_0x9154('0x2f')]:_0x5628b5['model'];if(!_0x2515a6['query'][_0x9154('0x31')]('nolimit')){_0xb67217['limit']=qs[_0x9154('0x19')](_0x2515a6[_0x9154('0x2b')][_0x9154('0x19')]);_0xb67217[_0x9154('0x17')]=qs[_0x9154('0x17')](_0x2515a6[_0x9154('0x2b')]['offset']);}_0xb67217[_0x9154('0x32')]=qs[_0x9154('0x33')](_0x2515a6[_0x9154('0x2b')][_0x9154('0x33')]);_0xb67217[_0x9154('0x34')]=qs['filters'](_[_0x9154('0x35')](_0x2515a6[_0x9154('0x2b')],_0x5628b5[_0x9154('0x2d')]),_0xd22a7f);if(_0x2515a6[_0x9154('0x2b')][_0x9154('0x36')]){_0xb67217['where']=_[_0x9154('0x37')](_0xb67217['where'],{'$or':_['map'](_0xd22a7f,function(_0x53878e){if(_0x53878e['type']!==_0x9154('0x38')){var _0x496127={};_0x496127[_0x53878e[_0x9154('0x24')]]={'$like':'%'+_0x2515a6[_0x9154('0x2b')][_0x9154('0x36')]+'%'};return _0x496127;}})});}_0xb67217=_[_0x9154('0x37')]({},_0xb67217,_0x2515a6[_0x9154('0x39')]);var _0x4f1c13={'where':_0xb67217['where']};return db[_0x9154('0x3a')][_0x9154('0x1a')](_0x4f1c13)[_0x9154('0x3b')](function(_0x322854){_0x1b0939[_0x9154('0x1a')]=_0x322854;if(_0x2515a6['query']['includeAll']){_0xb67217[_0x9154('0x3c')]=[{'all':!![]}];}return db[_0x9154('0x3a')][_0x9154('0x3d')](_0xb67217);})['then'](function(_0xb1f415){_0x1b0939[_0x9154('0x3e')]=_0xb1f415;return _0x1b0939;})['then'](respondWithFilteredResult(_0x20d76a,_0xb67217))[_0x9154('0x3f')](handleError(_0x20d76a,null));};exports[_0x9154('0x40')]=function(_0x57a81b,_0x395538){var _0x21e2f7={'raw':!![],'where':{'id':_0x57a81b[_0x9154('0x41')]['id']}},_0x195ff5={};_0x195ff5[_0x9154('0x2a')]=_[_0x9154('0x2c')](db[_0x9154('0x3a')][_0x9154('0x27')]);_0x195ff5[_0x9154('0x2b')]=_[_0x9154('0x2c')](_0x57a81b['query']);_0x195ff5[_0x9154('0x2d')]=_[_0x9154('0x2e')](_0x195ff5['model'],_0x195ff5['query']);_0x21e2f7['attributes']=_[_0x9154('0x2e')](_0x195ff5[_0x9154('0x2a')],qs[_0x9154('0x30')](_0x57a81b[_0x9154('0x2b')][_0x9154('0x30')]));_0x21e2f7[_0x9154('0x2f')]=_0x21e2f7[_0x9154('0x2f')]['length']?_0x21e2f7[_0x9154('0x2f')]:_0x195ff5[_0x9154('0x2a')];if(_0x57a81b[_0x9154('0x2b')]['includeAll']){_0x21e2f7['include']=[{'all':!![]}];}_0x21e2f7=_['merge']({},_0x21e2f7,_0x57a81b['options']);return db['OpenchannelQueueReport'][_0x9154('0x42')](_0x21e2f7)[_0x9154('0x3b')](handleEntityNotFound(_0x395538,null))[_0x9154('0x3b')](respondWithResult(_0x395538,null))['catch'](handleError(_0x395538,null));};exports['create']=function(_0x386e25,_0x35ab3b){return db[_0x9154('0x3a')]['create'](_0x386e25[_0x9154('0x43')],{})[_0x9154('0x3b')](respondWithResult(_0x35ab3b,0xc9))[_0x9154('0x3f')](handleError(_0x35ab3b,null));};exports[_0x9154('0x21')]=function(_0x53f0b4,_0x3ba953){if(_0x53f0b4[_0x9154('0x43')]['id']){delete _0x53f0b4['body']['id'];}return db[_0x9154('0x3a')][_0x9154('0x42')]({'where':{'id':_0x53f0b4[_0x9154('0x41')]['id']}})[_0x9154('0x3b')](handleEntityNotFound(_0x3ba953,null))[_0x9154('0x3b')](saveUpdates(_0x53f0b4[_0x9154('0x43')],null))[_0x9154('0x3b')](respondWithResult(_0x3ba953,null))[_0x9154('0x3f')](handleError(_0x3ba953,null));};exports[_0x9154('0x44')]=function(_0x5ebd6c,_0x524cd){return db[_0x9154('0x3a')][_0x9154('0x42')]({'where':{'id':_0x5ebd6c[_0x9154('0x41')]['id']}})[_0x9154('0x3b')](handleEntityNotFound(_0x524cd,null))['then'](removeEntity(_0x524cd,null))[_0x9154('0x3f')](handleError(_0x524cd,null));};exports[_0x9154('0x45')]=function(_0x563242,_0x7475be){return db['OpenchannelQueueReport'][_0x9154('0x45')]()[_0x9154('0x3b')](respondWithResult(_0x7475be,null))[_0x9154('0x3f')](handleError(_0x7475be,null));}; \ No newline at end of file +var _0xfc06=['send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','OpenchannelQueueReport','includeAll','rows','catch','show','include','find','body','params','describe','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','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','save','update','then','destroy','stack','name'];(function(_0x4603c6,_0x3b9a42){var _0x50a6a0=function(_0xa2800){while(--_0xa2800){_0x4603c6['push'](_0x4603c6['shift']());}};_0x50a6a0(++_0x3b9a42);}(_0xfc06,0x18d));var _0x6fc0=function(_0x5dbba5,_0x1163e4){_0x5dbba5=_0x5dbba5-0x0;var _0x299834=_0xfc06[_0x5dbba5];return _0x299834;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6fc0('0x0'));var rp=require(_0x6fc0('0x1'));var moment=require(_0x6fc0('0x2'));var BPromise=require(_0x6fc0('0x3'));var Mustache=require(_0x6fc0('0x4'));var util=require(_0x6fc0('0x5'));var path=require(_0x6fc0('0x6'));var sox=require(_0x6fc0('0x7'));var csv=require(_0x6fc0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6fc0('0x9'));var _=require(_0x6fc0('0xa'));var squel=require(_0x6fc0('0xb'));var crypto=require(_0x6fc0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6fc0('0xd'));var toCsv=require(_0x6fc0('0x8'));var querystring=require(_0x6fc0('0xe'));var Papa=require(_0x6fc0('0xf'));var Redis=require(_0x6fc0('0x10'));var authService=require(_0x6fc0('0x11'));var qs=require(_0x6fc0('0x12'));var as=require(_0x6fc0('0x13'));var hardwareService=require(_0x6fc0('0x14'));var logger=require(_0x6fc0('0x15'))(_0x6fc0('0x16'));var utils=require(_0x6fc0('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6fc0('0x18'));var db=require(_0x6fc0('0x19'))['db'];function respondWithStatusCode(_0xf53419,_0x1791bc){_0x1791bc=_0x1791bc||0xcc;return function(_0x202fa0){if(_0x202fa0){return _0xf53419[_0x6fc0('0x1a')](_0x1791bc);}return _0xf53419[_0x6fc0('0x1b')](_0x1791bc)[_0x6fc0('0x1c')]();};}function respondWithResult(_0x3072a1,_0x2ae6a9){_0x2ae6a9=_0x2ae6a9||0xc8;return function(_0x3f781d){if(_0x3f781d){return _0x3072a1[_0x6fc0('0x1b')](_0x2ae6a9)[_0x6fc0('0x1d')](_0x3f781d);}};}function respondWithFilteredResult(_0x5c1999,_0xeff4d0){return function(_0x3b2db7){if(_0x3b2db7){var _0x56f4de=typeof _0xeff4d0['offset']===_0x6fc0('0x1e')&&typeof _0xeff4d0[_0x6fc0('0x1f')]==='undefined';var _0x5da877=_0x3b2db7[_0x6fc0('0x20')];var _0x7740fa=_0x56f4de?0x0:_0xeff4d0[_0x6fc0('0x21')];var _0x36ec49=_0x56f4de?_0x3b2db7['count']:_0xeff4d0['offset']+_0xeff4d0['limit'];var _0x2033ed;if(_0x36ec49>=_0x5da877){_0x36ec49=_0x5da877;_0x2033ed=0xc8;}else{_0x2033ed=0xce;}_0x5c1999['status'](_0x2033ed);return _0x5c1999['set'](_0x6fc0('0x22'),_0x7740fa+'-'+_0x36ec49+'/'+_0x5da877)['json'](_0x3b2db7);}return null;};}function patchUpdates(_0x406cbc){return function(_0x5e3f7f){try{jsonpatch['apply'](_0x5e3f7f,_0x406cbc,!![]);}catch(_0x110715){return BPromise['reject'](_0x110715);}return _0x5e3f7f[_0x6fc0('0x23')]();};}function saveUpdates(_0x143b2e,_0x1b66ce){return function(_0x447f42){if(_0x447f42){return _0x447f42[_0x6fc0('0x24')](_0x143b2e)[_0x6fc0('0x25')](function(_0x2fa570){return _0x2fa570;});}return null;};}function removeEntity(_0x40ff2f,_0x5b9f95){return function(_0x25c410){if(_0x25c410){return _0x25c410[_0x6fc0('0x26')]()[_0x6fc0('0x25')](function(){_0x40ff2f[_0x6fc0('0x1b')](0xcc)[_0x6fc0('0x1c')]();});}};}function handleEntityNotFound(_0xa0ebe8,_0x536884){return function(_0x2c4d6c){if(!_0x2c4d6c){_0xa0ebe8[_0x6fc0('0x1a')](0x194);}return _0x2c4d6c;};}function handleError(_0x233c4e,_0x33de30){_0x33de30=_0x33de30||0x1f4;return function(_0x31d128){logger['error'](_0x31d128[_0x6fc0('0x27')]);if(_0x31d128[_0x6fc0('0x28')]){delete _0x31d128[_0x6fc0('0x28')];}_0x233c4e[_0x6fc0('0x1b')](_0x33de30)[_0x6fc0('0x29')](_0x31d128);};}exports[_0x6fc0('0x2a')]=function(_0x4cd876,_0x417b0c){var _0x268a24={},_0x2bd75f={},_0x1feba8={'count':0x0,'rows':[]};var _0x478b11=_['map'](db['OpenchannelQueueReport'][_0x6fc0('0x2b')],function(_0x41a11d){return{'name':_0x41a11d['fieldName'],'type':_0x41a11d[_0x6fc0('0x2c')][_0x6fc0('0x2d')]};});_0x2bd75f[_0x6fc0('0x2e')]=_[_0x6fc0('0x2f')](_0x478b11,_0x6fc0('0x28'));_0x2bd75f[_0x6fc0('0x30')]=_[_0x6fc0('0x31')](_0x4cd876[_0x6fc0('0x30')]);_0x2bd75f[_0x6fc0('0x32')]=_[_0x6fc0('0x33')](_0x2bd75f[_0x6fc0('0x2e')],_0x2bd75f['query']);_0x268a24[_0x6fc0('0x34')]=_[_0x6fc0('0x33')](_0x2bd75f[_0x6fc0('0x2e')],qs[_0x6fc0('0x35')](_0x4cd876[_0x6fc0('0x30')][_0x6fc0('0x35')]));_0x268a24[_0x6fc0('0x34')]=_0x268a24[_0x6fc0('0x34')][_0x6fc0('0x36')]?_0x268a24[_0x6fc0('0x34')]:_0x2bd75f[_0x6fc0('0x2e')];if(!_0x4cd876[_0x6fc0('0x30')][_0x6fc0('0x37')]('nolimit')){_0x268a24[_0x6fc0('0x1f')]=qs['limit'](_0x4cd876[_0x6fc0('0x30')][_0x6fc0('0x1f')]);_0x268a24[_0x6fc0('0x21')]=qs[_0x6fc0('0x21')](_0x4cd876[_0x6fc0('0x30')][_0x6fc0('0x21')]);}_0x268a24[_0x6fc0('0x38')]=qs[_0x6fc0('0x39')](_0x4cd876['query']['sort']);_0x268a24[_0x6fc0('0x3a')]=qs['filters'](_['pick'](_0x4cd876[_0x6fc0('0x30')],_0x2bd75f[_0x6fc0('0x32')]),_0x478b11);if(_0x4cd876[_0x6fc0('0x30')][_0x6fc0('0x3b')]){_0x268a24[_0x6fc0('0x3a')]=_[_0x6fc0('0x3c')](_0x268a24[_0x6fc0('0x3a')],{'$or':_[_0x6fc0('0x2f')](_0x478b11,function(_0x95e02){if(_0x95e02['type']!==_0x6fc0('0x3d')){var _0x553633={};_0x553633[_0x95e02[_0x6fc0('0x28')]]={'$like':'%'+_0x4cd876[_0x6fc0('0x30')][_0x6fc0('0x3b')]+'%'};return _0x553633;}})});}_0x268a24=_[_0x6fc0('0x3c')]({},_0x268a24,_0x4cd876[_0x6fc0('0x3e')]);var _0x597db3={'where':_0x268a24[_0x6fc0('0x3a')]};return db[_0x6fc0('0x3f')][_0x6fc0('0x20')](_0x597db3)[_0x6fc0('0x25')](function(_0x38dee4){_0x1feba8[_0x6fc0('0x20')]=_0x38dee4;if(_0x4cd876[_0x6fc0('0x30')][_0x6fc0('0x40')]){_0x268a24['include']=[{'all':!![]}];}return db[_0x6fc0('0x3f')]['findAll'](_0x268a24);})[_0x6fc0('0x25')](function(_0x155cda){_0x1feba8[_0x6fc0('0x41')]=_0x155cda;return _0x1feba8;})['then'](respondWithFilteredResult(_0x417b0c,_0x268a24))[_0x6fc0('0x42')](handleError(_0x417b0c,null));};exports[_0x6fc0('0x43')]=function(_0x18fbd9,_0x5cd628){var _0x524edc={'raw':!![],'where':{'id':_0x18fbd9['params']['id']}},_0x1d18d6={};_0x1d18d6[_0x6fc0('0x2e')]=_[_0x6fc0('0x31')](db[_0x6fc0('0x3f')][_0x6fc0('0x2b')]);_0x1d18d6[_0x6fc0('0x30')]=_[_0x6fc0('0x31')](_0x18fbd9[_0x6fc0('0x30')]);_0x1d18d6[_0x6fc0('0x32')]=_['intersection'](_0x1d18d6[_0x6fc0('0x2e')],_0x1d18d6['query']);_0x524edc[_0x6fc0('0x34')]=_['intersection'](_0x1d18d6['model'],qs[_0x6fc0('0x35')](_0x18fbd9[_0x6fc0('0x30')][_0x6fc0('0x35')]));_0x524edc[_0x6fc0('0x34')]=_0x524edc['attributes']['length']?_0x524edc[_0x6fc0('0x34')]:_0x1d18d6[_0x6fc0('0x2e')];if(_0x18fbd9[_0x6fc0('0x30')]['includeAll']){_0x524edc[_0x6fc0('0x44')]=[{'all':!![]}];}_0x524edc=_[_0x6fc0('0x3c')]({},_0x524edc,_0x18fbd9[_0x6fc0('0x3e')]);return db['OpenchannelQueueReport'][_0x6fc0('0x45')](_0x524edc)[_0x6fc0('0x25')](handleEntityNotFound(_0x5cd628,null))[_0x6fc0('0x25')](respondWithResult(_0x5cd628,null))[_0x6fc0('0x42')](handleError(_0x5cd628,null));};exports['create']=function(_0x4f1811,_0x54b2f7){return db[_0x6fc0('0x3f')]['create'](_0x4f1811[_0x6fc0('0x46')],{})['then'](respondWithResult(_0x54b2f7,0xc9))[_0x6fc0('0x42')](handleError(_0x54b2f7,null));};exports[_0x6fc0('0x24')]=function(_0x359869,_0x272a63){if(_0x359869[_0x6fc0('0x46')]['id']){delete _0x359869[_0x6fc0('0x46')]['id'];}return db[_0x6fc0('0x3f')][_0x6fc0('0x45')]({'where':{'id':_0x359869[_0x6fc0('0x47')]['id']}})[_0x6fc0('0x25')](handleEntityNotFound(_0x272a63,null))[_0x6fc0('0x25')](saveUpdates(_0x359869[_0x6fc0('0x46')],null))[_0x6fc0('0x25')](respondWithResult(_0x272a63,null))[_0x6fc0('0x42')](handleError(_0x272a63,null));};exports['destroy']=function(_0x1b5107,_0x342e8c){return db['OpenchannelQueueReport'][_0x6fc0('0x45')]({'where':{'id':_0x1b5107['params']['id']}})[_0x6fc0('0x25')](handleEntityNotFound(_0x342e8c,null))[_0x6fc0('0x25')](removeEntity(_0x342e8c,null))[_0x6fc0('0x42')](handleError(_0x342e8c,null));};exports[_0x6fc0('0x48')]=function(_0x306ef0,_0xa61e6e){return db[_0x6fc0('0x3f')]['describe']()['then'](respondWithResult(_0xa61e6e,null))[_0x6fc0('0x42')](handleError(_0xa61e6e,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index aa406df..2f5b2f7 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 _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x497f16,_0x71ced4){var _0x453aaf=function(_0x1ed693){while(--_0x1ed693){_0x497f16['push'](_0x497f16['shift']());}};_0x453aaf(++_0x71ced4);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xc4aa[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0xbbf04e,_0x3e58c4){var _0x3dc6f8=function(_0x3a0a41){while(--_0x3a0a41){_0xbbf04e['push'](_0xbbf04e['shift']());}};_0x3dc6f8(++_0x3e58c4);}(_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 logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 5974738..13dc08d 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 _0xb10b=['then','info','OpenchannelQueueReport,\x20%s,\x20%s','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','raw','debug','UpdateOpenchannelQueueReport','where','attributes','limit','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb10b,0x12a));var _0xbb10=function(_0x25d2fa,_0x1d35c6){_0x25d2fa=_0x25d2fa-0x0;var _0x42d4aa=_0xb10b[_0x25d2fa];return _0x42d4aa;};'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')]('CreateOpenchannelQueueReport',_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')]));});});};exports[_0xbb10('0x1b')]=function(_0x436104){var _0x7f2377=this;return new Promise(function(_0x395404,_0x3ba6cd){return db[_0xbb10('0x16')]['update'](_0x436104['body'],{'raw':_0x436104['options']?_0x436104[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x436104[_0xbb10('0x18')]?_0x436104['options'][_0xbb10('0x1c')]||null:null,'attributes':_0x436104[_0xbb10('0x18')]?_0x436104[_0xbb10('0x18')][_0xbb10('0x1d')]||null:null,'limit':_0x436104[_0xbb10('0x18')]?_0x436104[_0xbb10('0x18')][_0xbb10('0x1e')]||null:null})['then'](function(_0x3796c7){logger[_0xbb10('0xd')](_0xbb10('0x1b'),_0x436104);logger[_0xbb10('0x1a')](_0xbb10('0x1b'),_0x436104,JSON[_0xbb10('0x11')](_0x3796c7));_0x395404(_0x3796c7);})['catch'](function(_0x221624){logger['error'](_0xbb10('0x1b'),_0x221624['message'],_0x436104);_0x3ba6cd(_0x7f2377[_0xbb10('0x12')](0x1f4,_0x221624[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x9f0e=['message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','raw','UpdateOpenchannelQueueReport','update','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x57d13b,_0x52d8cb){var _0x467696=function(_0x153000){while(--_0x153000){_0x57d13b['push'](_0x57d13b['shift']());}};_0x467696(++_0x52d8cb);}(_0x9f0e,0x116));var _0xe9f0=function(_0x461ad6,_0x183fbd){_0x461ad6=_0x461ad6-0x0;var _0x3fddce=_0x9f0e[_0x461ad6];return _0x3fddce;};'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')]('OpenchannelQueueReport,\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);});});}exports[_0xe9f0('0x16')]=function(_0x2ab12b){var _0x3da237=this;return new Promise(function(_0x59bf5a,_0x15a33b){return db[_0xe9f0('0x17')][_0xe9f0('0x18')](_0x2ab12b['body'],{'raw':_0x2ab12b[_0xe9f0('0x19')]?_0x2ab12b[_0xe9f0('0x19')][_0xe9f0('0x1a')]===undefined?!![]:![]:!![]})[_0xe9f0('0xb')](function(_0x5ba788){logger[_0xe9f0('0xc')](_0xe9f0('0x16'),_0x2ab12b);logger['debug']('CreateOpenchannelQueueReport',_0x2ab12b,JSON['stringify'](_0x5ba788));_0x59bf5a(_0x5ba788);})[_0xe9f0('0x15')](function(_0xa1ddc){logger[_0xe9f0('0x12')](_0xe9f0('0x16'),_0xa1ddc[_0xe9f0('0x13')],_0x2ab12b);_0x15a33b(_0x3da237['error'](0x1f4,_0xa1ddc[_0xe9f0('0x13')]));});});};exports[_0xe9f0('0x1b')]=function(_0x437d43){var _0x10801b=this;return new Promise(function(_0x3ca991,_0x372ffd){return db[_0xe9f0('0x17')][_0xe9f0('0x1c')](_0x437d43[_0xe9f0('0x1d')],{'raw':_0x437d43[_0xe9f0('0x19')]?_0x437d43['options'][_0xe9f0('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x437d43[_0xe9f0('0x19')]?_0x437d43[_0xe9f0('0x19')][_0xe9f0('0x1e')]||null:null,'attributes':_0x437d43['options']?_0x437d43[_0xe9f0('0x19')][_0xe9f0('0x1f')]||null:null,'limit':_0x437d43[_0xe9f0('0x19')]?_0x437d43[_0xe9f0('0x19')][_0xe9f0('0x20')]||null:null})['then'](function(_0x130f96){logger[_0xe9f0('0xc')](_0xe9f0('0x1b'),_0x437d43);logger[_0xe9f0('0xf')](_0xe9f0('0x1b'),_0x437d43,JSON[_0xe9f0('0x11')](_0x130f96));_0x3ca991(_0x130f96);})[_0xe9f0('0x15')](function(_0x2efd33){logger[_0xe9f0('0x12')](_0xe9f0('0x1b'),_0x2efd33[_0xe9f0('0x13')],_0x437d43);_0x372ffd(_0x10801b[_0xe9f0('0x12')](0x1f4,_0x2efd33[_0xe9f0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 93d6b52..de0fb97 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 _0xe1ae=['isAuthenticated','index','/describe','describe','get','/:id','show','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller'];(function(_0x58ca75,_0x39f1dc){var _0x5940f6=function(_0x18cd6c){while(--_0x18cd6c){_0x58ca75['push'](_0x58ca75['shift']());}};_0x5940f6(++_0x39f1dc);}(_0xe1ae,0x97));var _0xee1a=function(_0x18175b,_0x4d7376){_0x18175b=_0x18175b-0x0;var _0x210d45=_0xe1ae[_0x18175b];return _0x210d45;};'use strict';var multer=require(_0xee1a('0x0'));var util=require(_0xee1a('0x1'));var path=require(_0xee1a('0x2'));var timeout=require(_0xee1a('0x3'));var express=require(_0xee1a('0x4'));var router=express[_0xee1a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xee1a('0x6'));var interaction=require(_0xee1a('0x7'));var config=require('../../config/environment');var controller=require(_0xee1a('0x8'));router['get']('/',auth[_0xee1a('0x9')](),controller[_0xee1a('0xa')]);router['get'](_0xee1a('0xb'),auth[_0xee1a('0x9')](),controller[_0xee1a('0xc')]);router[_0xee1a('0xd')](_0xee1a('0xe'),auth[_0xee1a('0x9')](),controller[_0xee1a('0xf')]);router['post']('/',auth[_0xee1a('0x9')](),controller['create']);router[_0xee1a('0x10')](_0xee1a('0xe'),auth['isAuthenticated'](),controller[_0xee1a('0x11')]);router[_0xee1a('0x12')]('/:id',auth[_0xee1a('0x9')](),controller['destroy']);module[_0xee1a('0x13')]=router; \ No newline at end of file +var _0x92bd=['create','put','destroy','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x92bd,0x1df));var _0xd92b=function(_0x3574e6,_0x314534){_0x3574e6=_0x3574e6-0x0;var _0x345c37=_0x92bd[_0x3574e6];return _0x345c37;};'use strict';var multer=require(_0xd92b('0x0'));var util=require(_0xd92b('0x1'));var path=require('path');var timeout=require(_0xd92b('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd92b('0x3'));var interaction=require(_0xd92b('0x4'));var config=require(_0xd92b('0x5'));var controller=require(_0xd92b('0x6'));router[_0xd92b('0x7')]('/',auth[_0xd92b('0x8')](),controller[_0xd92b('0x9')]);router[_0xd92b('0x7')](_0xd92b('0xa'),auth[_0xd92b('0x8')](),controller[_0xd92b('0xb')]);router['get'](_0xd92b('0xc'),auth[_0xd92b('0x8')](),controller['show']);router[_0xd92b('0xd')]('/',auth[_0xd92b('0x8')](),controller[_0xd92b('0xe')]);router[_0xd92b('0xf')]('/:id',auth[_0xd92b('0x8')](),controller['update']);router['delete'](_0xd92b('0xc'),auth[_0xd92b('0x8')](),controller[_0xd92b('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 5ccf496..a26dc92 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x4cdc76,_0x55f538){var _0x137516=function(_0x55677f){while(--_0x55677f){_0x4cdc76['push'](_0x4cdc76['shift']());}};_0x137516(++_0x55f538);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x11f226,_0x491e30){_0x11f226=_0x11f226-0x0;var _0x30be77=_0xcb91[_0x11f226];return _0x30be77;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x51a77e,_0x2ce723){var _0x1edce3=function(_0x379073){while(--_0x379073){_0x51a77e['push'](_0x51a77e['shift']());}};_0x1edce3(++_0x2ce723);}(_0x70e0,0x17b));var _0x070e=function(_0x224f0b,_0x481ea1){_0x224f0b=_0x224f0b-0x0;var _0x3b7f41=_0x70e0[_0x224f0b];return _0x3b7f41;};'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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index f03170f..764fc5d 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 _0x77a2=['filter','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','count','offset','set','reject','save','update','then','destroy','error','stack','name','index','map','OpenchannelTransferReport','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','merge','VIRTUAL'];(function(_0x1db8b6,_0x2b356f){var _0x3782a1=function(_0x3e36eb){while(--_0x3e36eb){_0x1db8b6['push'](_0x1db8b6['shift']());}};_0x3782a1(++_0x2b356f);}(_0x77a2,0x1c1));var _0x277a=function(_0x251812,_0x58702a){_0x251812=_0x251812-0x0;var _0x39a446=_0x77a2[_0x251812];return _0x39a446;};'use strict';var emlformat=require(_0x277a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x277a('0x1'));var rp=require('request-promise');var moment=require(_0x277a('0x2'));var BPromise=require(_0x277a('0x3'));var Mustache=require(_0x277a('0x4'));var util=require(_0x277a('0x5'));var path=require(_0x277a('0x6'));var sox=require(_0x277a('0x7'));var csv=require('to-csv');var ejs=require(_0x277a('0x8'));var fs=require('fs');var fs_extra=require(_0x277a('0x9'));var _=require(_0x277a('0xa'));var squel=require(_0x277a('0xb'));var crypto=require('crypto');var jsforce=require(_0x277a('0xc'));var deskjs=require(_0x277a('0xd'));var toCsv=require(_0x277a('0xe'));var querystring=require(_0x277a('0xf'));var Papa=require(_0x277a('0x10'));var Redis=require(_0x277a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x277a('0x12'));var hardwareService=require(_0x277a('0x13'));var logger=require(_0x277a('0x14'))('api');var utils=require(_0x277a('0x15'));var config=require(_0x277a('0x16'));var licenseUtil=require(_0x277a('0x17'));var db=require(_0x277a('0x18'))['db'];function respondWithStatusCode(_0x495db4,_0x13234e){_0x13234e=_0x13234e||0xcc;return function(_0x33d951){if(_0x33d951){return _0x495db4[_0x277a('0x19')](_0x13234e);}return _0x495db4['status'](_0x13234e)[_0x277a('0x1a')]();};}function respondWithResult(_0x51681b,_0x474c1d){_0x474c1d=_0x474c1d||0xc8;return function(_0x1bad68){if(_0x1bad68){return _0x51681b[_0x277a('0x1b')](_0x474c1d)['json'](_0x1bad68);}};}function respondWithFilteredResult(_0x3e8dc2,_0x26e0f2){return function(_0x4fd29f){if(_0x4fd29f){var _0x2a7023=typeof _0x26e0f2['offset']==='undefined'&&typeof _0x26e0f2['limit']===_0x277a('0x1c');var _0x84757a=_0x4fd29f[_0x277a('0x1d')];var _0x3b1ee8=_0x2a7023?0x0:_0x26e0f2['offset'];var _0x265ef8=_0x2a7023?_0x4fd29f[_0x277a('0x1d')]:_0x26e0f2[_0x277a('0x1e')]+_0x26e0f2['limit'];var _0x4f776d;if(_0x265ef8>=_0x84757a){_0x265ef8=_0x84757a;_0x4f776d=0xc8;}else{_0x4f776d=0xce;}_0x3e8dc2[_0x277a('0x1b')](_0x4f776d);return _0x3e8dc2[_0x277a('0x1f')]('Content-Range',_0x3b1ee8+'-'+_0x265ef8+'/'+_0x84757a)['json'](_0x4fd29f);}return null;};}function patchUpdates(_0x178058){return function(_0x6996c3){try{jsonpatch['apply'](_0x6996c3,_0x178058,!![]);}catch(_0x362703){return BPromise[_0x277a('0x20')](_0x362703);}return _0x6996c3[_0x277a('0x21')]();};}function saveUpdates(_0x409462,_0x406946){return function(_0x1d3231){if(_0x1d3231){return _0x1d3231[_0x277a('0x22')](_0x409462)[_0x277a('0x23')](function(_0x18d31c){return _0x18d31c;});}return null;};}function removeEntity(_0x59f4b9,_0x4d490c){return function(_0xeb91a5){if(_0xeb91a5){return _0xeb91a5[_0x277a('0x24')]()['then'](function(){_0x59f4b9[_0x277a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x456678,_0x21454d){return function(_0xe3b334){if(!_0xe3b334){_0x456678[_0x277a('0x19')](0x194);}return _0xe3b334;};}function handleError(_0x48e745,_0x2e1ceb){_0x2e1ceb=_0x2e1ceb||0x1f4;return function(_0x144c7a){logger[_0x277a('0x25')](_0x144c7a[_0x277a('0x26')]);if(_0x144c7a[_0x277a('0x27')]){delete _0x144c7a['name'];}_0x48e745[_0x277a('0x1b')](_0x2e1ceb)['send'](_0x144c7a);};}exports[_0x277a('0x28')]=function(_0x41e462,_0x2928da){var _0x47c787={},_0x13148c={},_0x5bc91b={'count':0x0,'rows':[]};var _0x20cb1b=_[_0x277a('0x29')](db[_0x277a('0x2a')][_0x277a('0x2b')],function(_0xe685c2){return{'name':_0xe685c2['fieldName'],'type':_0xe685c2[_0x277a('0x2c')][_0x277a('0x2d')]};});_0x13148c[_0x277a('0x2e')]=_['map'](_0x20cb1b,'name');_0x13148c[_0x277a('0x2f')]=_[_0x277a('0x30')](_0x41e462[_0x277a('0x2f')]);_0x13148c['filters']=_[_0x277a('0x31')](_0x13148c[_0x277a('0x2e')],_0x13148c[_0x277a('0x2f')]);_0x47c787[_0x277a('0x32')]=_['intersection'](_0x13148c[_0x277a('0x2e')],qs[_0x277a('0x33')](_0x41e462[_0x277a('0x2f')][_0x277a('0x33')]));_0x47c787[_0x277a('0x32')]=_0x47c787[_0x277a('0x32')][_0x277a('0x34')]?_0x47c787['attributes']:_0x13148c[_0x277a('0x2e')];if(!_0x41e462['query'][_0x277a('0x35')](_0x277a('0x36'))){_0x47c787[_0x277a('0x37')]=qs['limit'](_0x41e462[_0x277a('0x2f')]['limit']);_0x47c787[_0x277a('0x1e')]=qs[_0x277a('0x1e')](_0x41e462['query'][_0x277a('0x1e')]);}_0x47c787['order']=qs[_0x277a('0x38')](_0x41e462[_0x277a('0x2f')][_0x277a('0x38')]);_0x47c787[_0x277a('0x39')]=qs[_0x277a('0x3a')](_[_0x277a('0x3b')](_0x41e462[_0x277a('0x2f')],_0x13148c[_0x277a('0x3a')]),_0x20cb1b);if(_0x41e462[_0x277a('0x2f')]['filter']){_0x47c787[_0x277a('0x39')]=_[_0x277a('0x3c')](_0x47c787[_0x277a('0x39')],{'$or':_[_0x277a('0x29')](_0x20cb1b,function(_0x2ea6b1){if(_0x2ea6b1[_0x277a('0x2c')]!==_0x277a('0x3d')){var _0x13936c={};_0x13936c[_0x2ea6b1[_0x277a('0x27')]]={'$like':'%'+_0x41e462[_0x277a('0x2f')][_0x277a('0x3e')]+'%'};return _0x13936c;}})});}_0x47c787=_[_0x277a('0x3c')]({},_0x47c787,_0x41e462['options']);var _0x287e78={'where':_0x47c787['where']};return db[_0x277a('0x2a')][_0x277a('0x1d')](_0x287e78)['then'](function(_0x457f76){_0x5bc91b[_0x277a('0x1d')]=_0x457f76;if(_0x41e462[_0x277a('0x2f')]['includeAll']){_0x47c787[_0x277a('0x3f')]=[{'all':!![]}];}return db[_0x277a('0x2a')][_0x277a('0x40')](_0x47c787);})['then'](function(_0x5552a9){_0x5bc91b[_0x277a('0x41')]=_0x5552a9;return _0x5bc91b;})['then'](respondWithFilteredResult(_0x2928da,_0x47c787))[_0x277a('0x42')](handleError(_0x2928da,null));};exports[_0x277a('0x43')]=function(_0x525cb9,_0x1cfa8f){var _0x1b6edb={'raw':!![],'where':{'id':_0x525cb9[_0x277a('0x44')]['id']}},_0x5aa0f8={};_0x5aa0f8[_0x277a('0x2e')]=_['keys'](db[_0x277a('0x2a')][_0x277a('0x2b')]);_0x5aa0f8[_0x277a('0x2f')]=_['keys'](_0x525cb9[_0x277a('0x2f')]);_0x5aa0f8['filters']=_[_0x277a('0x31')](_0x5aa0f8[_0x277a('0x2e')],_0x5aa0f8[_0x277a('0x2f')]);_0x1b6edb[_0x277a('0x32')]=_['intersection'](_0x5aa0f8[_0x277a('0x2e')],qs['fields'](_0x525cb9[_0x277a('0x2f')][_0x277a('0x33')]));_0x1b6edb[_0x277a('0x32')]=_0x1b6edb['attributes'][_0x277a('0x34')]?_0x1b6edb['attributes']:_0x5aa0f8[_0x277a('0x2e')];if(_0x525cb9['query']['includeAll']){_0x1b6edb[_0x277a('0x3f')]=[{'all':!![]}];}_0x1b6edb=_[_0x277a('0x3c')]({},_0x1b6edb,_0x525cb9['options']);return db[_0x277a('0x2a')][_0x277a('0x45')](_0x1b6edb)[_0x277a('0x23')](handleEntityNotFound(_0x1cfa8f,null))[_0x277a('0x23')](respondWithResult(_0x1cfa8f,null))[_0x277a('0x42')](handleError(_0x1cfa8f,null));};exports[_0x277a('0x46')]=function(_0x7fcd3d,_0x3ea00c){return db['OpenchannelTransferReport'][_0x277a('0x46')](_0x7fcd3d[_0x277a('0x47')],{})[_0x277a('0x23')](respondWithResult(_0x3ea00c,0xc9))[_0x277a('0x42')](handleError(_0x3ea00c,null));};exports[_0x277a('0x22')]=function(_0x2bc4af,_0x4761c0){if(_0x2bc4af['body']['id']){delete _0x2bc4af['body']['id'];}return db[_0x277a('0x2a')][_0x277a('0x45')]({'where':{'id':_0x2bc4af[_0x277a('0x44')]['id']}})['then'](handleEntityNotFound(_0x4761c0,null))[_0x277a('0x23')](saveUpdates(_0x2bc4af['body'],null))[_0x277a('0x23')](respondWithResult(_0x4761c0,null))[_0x277a('0x42')](handleError(_0x4761c0,null));};exports[_0x277a('0x24')]=function(_0x22d3e7,_0x5c70bc){return db['OpenchannelTransferReport'][_0x277a('0x45')]({'where':{'id':_0x22d3e7[_0x277a('0x44')]['id']}})[_0x277a('0x23')](handleEntityNotFound(_0x5c70bc,null))[_0x277a('0x23')](removeEntity(_0x5c70bc,null))[_0x277a('0x42')](handleError(_0x5c70bc,null));};exports[_0x277a('0x48')]=function(_0x4ff391,_0x46da0b){return db[_0x277a('0x2a')]['describe']()['then'](respondWithResult(_0x46da0b,null))[_0x277a('0x42')](handleError(_0x46da0b,null));}; \ No newline at end of file +var _0xc2b1=['pick','filter','where','type','merge','options','OpenchannelTransferReport','count','includeAll','include','findAll','rows','catch','show','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','set','apply','reject','update','then','sendStatus','error','stack','name','index','map','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x10c6b9,_0x462e4f){var _0x1e5c55=function(_0x14a414){while(--_0x14a414){_0x10c6b9['push'](_0x10c6b9['shift']());}};_0x1e5c55(++_0x462e4f);}(_0xc2b1,0x18b));var _0x1c2b=function(_0x4fdcc0,_0x560a01){_0x4fdcc0=_0x4fdcc0-0x0;var _0xc0ce94=_0xc2b1[_0x4fdcc0];return _0xc0ce94;};'use strict';var emlformat=require(_0x1c2b('0x0'));var rimraf=require(_0x1c2b('0x1'));var zipdir=require(_0x1c2b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1c2b('0x3'));var moment=require(_0x1c2b('0x4'));var BPromise=require(_0x1c2b('0x5'));var Mustache=require('mustache');var util=require(_0x1c2b('0x6'));var path=require('path');var sox=require(_0x1c2b('0x7'));var csv=require(_0x1c2b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1c2b('0x9'));var _=require(_0x1c2b('0xa'));var squel=require(_0x1c2b('0xb'));var crypto=require(_0x1c2b('0xc'));var jsforce=require(_0x1c2b('0xd'));var deskjs=require(_0x1c2b('0xe'));var toCsv=require(_0x1c2b('0x8'));var querystring=require(_0x1c2b('0xf'));var Papa=require('papaparse');var Redis=require(_0x1c2b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1c2b('0x11'));var as=require(_0x1c2b('0x12'));var hardwareService=require(_0x1c2b('0x13'));var logger=require(_0x1c2b('0x14'))(_0x1c2b('0x15'));var utils=require('../../config/utils');var config=require(_0x1c2b('0x16'));var licenseUtil=require(_0x1c2b('0x17'));var db=require(_0x1c2b('0x18'))['db'];function respondWithStatusCode(_0x2803ea,_0x1e9a87){_0x1e9a87=_0x1e9a87||0xcc;return function(_0x50b58f){if(_0x50b58f){return _0x2803ea['sendStatus'](_0x1e9a87);}return _0x2803ea[_0x1c2b('0x19')](_0x1e9a87)[_0x1c2b('0x1a')]();};}function respondWithResult(_0xb54e80,_0x3f6039){_0x3f6039=_0x3f6039||0xc8;return function(_0x2d73cb){if(_0x2d73cb){return _0xb54e80['status'](_0x3f6039)[_0x1c2b('0x1b')](_0x2d73cb);}};}function respondWithFilteredResult(_0x33c164,_0x3f05d1){return function(_0x3e1be5){if(_0x3e1be5){var _0x10589e=typeof _0x3f05d1['offset']===_0x1c2b('0x1c')&&typeof _0x3f05d1[_0x1c2b('0x1d')]===_0x1c2b('0x1c');var _0x17f1df=_0x3e1be5['count'];var _0x54701e=_0x10589e?0x0:_0x3f05d1[_0x1c2b('0x1e')];var _0xc754f=_0x10589e?_0x3e1be5['count']:_0x3f05d1[_0x1c2b('0x1e')]+_0x3f05d1[_0x1c2b('0x1d')];var _0x12fc98;if(_0xc754f>=_0x17f1df){_0xc754f=_0x17f1df;_0x12fc98=0xc8;}else{_0x12fc98=0xce;}_0x33c164[_0x1c2b('0x19')](_0x12fc98);return _0x33c164[_0x1c2b('0x1f')]('Content-Range',_0x54701e+'-'+_0xc754f+'/'+_0x17f1df)[_0x1c2b('0x1b')](_0x3e1be5);}return null;};}function patchUpdates(_0x1cdd15){return function(_0x2b8875){try{jsonpatch[_0x1c2b('0x20')](_0x2b8875,_0x1cdd15,!![]);}catch(_0x41eea5){return BPromise[_0x1c2b('0x21')](_0x41eea5);}return _0x2b8875['save']();};}function saveUpdates(_0x346055,_0x22c014){return function(_0x210783){if(_0x210783){return _0x210783[_0x1c2b('0x22')](_0x346055)[_0x1c2b('0x23')](function(_0x423368){return _0x423368;});}return null;};}function removeEntity(_0xa554ed,_0xc5195){return function(_0x3dc5c5){if(_0x3dc5c5){return _0x3dc5c5['destroy']()[_0x1c2b('0x23')](function(){_0xa554ed[_0x1c2b('0x19')](0xcc)[_0x1c2b('0x1a')]();});}};}function handleEntityNotFound(_0x59a2af,_0xb670d9){return function(_0x400219){if(!_0x400219){_0x59a2af[_0x1c2b('0x24')](0x194);}return _0x400219;};}function handleError(_0x411422,_0x460ff0){_0x460ff0=_0x460ff0||0x1f4;return function(_0x3c2226){logger[_0x1c2b('0x25')](_0x3c2226[_0x1c2b('0x26')]);if(_0x3c2226[_0x1c2b('0x27')]){delete _0x3c2226[_0x1c2b('0x27')];}_0x411422[_0x1c2b('0x19')](_0x460ff0)['send'](_0x3c2226);};}exports[_0x1c2b('0x28')]=function(_0x4681fe,_0x230a42){var _0x1d6954={},_0x2db618={},_0x747288={'count':0x0,'rows':[]};var _0x10a48e=_[_0x1c2b('0x29')](db['OpenchannelTransferReport'][_0x1c2b('0x2a')],function(_0x2a2dc8){return{'name':_0x2a2dc8['fieldName'],'type':_0x2a2dc8['type'][_0x1c2b('0x2b')]};});_0x2db618['model']=_[_0x1c2b('0x29')](_0x10a48e,_0x1c2b('0x27'));_0x2db618[_0x1c2b('0x2c')]=_[_0x1c2b('0x2d')](_0x4681fe[_0x1c2b('0x2c')]);_0x2db618[_0x1c2b('0x2e')]=_[_0x1c2b('0x2f')](_0x2db618[_0x1c2b('0x30')],_0x2db618[_0x1c2b('0x2c')]);_0x1d6954[_0x1c2b('0x31')]=_[_0x1c2b('0x2f')](_0x2db618['model'],qs[_0x1c2b('0x32')](_0x4681fe[_0x1c2b('0x2c')][_0x1c2b('0x32')]));_0x1d6954[_0x1c2b('0x31')]=_0x1d6954[_0x1c2b('0x31')][_0x1c2b('0x33')]?_0x1d6954[_0x1c2b('0x31')]:_0x2db618[_0x1c2b('0x30')];if(!_0x4681fe[_0x1c2b('0x2c')][_0x1c2b('0x34')]('nolimit')){_0x1d6954[_0x1c2b('0x1d')]=qs['limit'](_0x4681fe[_0x1c2b('0x2c')]['limit']);_0x1d6954[_0x1c2b('0x1e')]=qs[_0x1c2b('0x1e')](_0x4681fe['query'][_0x1c2b('0x1e')]);}_0x1d6954[_0x1c2b('0x35')]=qs[_0x1c2b('0x36')](_0x4681fe[_0x1c2b('0x2c')][_0x1c2b('0x36')]);_0x1d6954['where']=qs[_0x1c2b('0x2e')](_[_0x1c2b('0x37')](_0x4681fe[_0x1c2b('0x2c')],_0x2db618[_0x1c2b('0x2e')]),_0x10a48e);if(_0x4681fe[_0x1c2b('0x2c')][_0x1c2b('0x38')]){_0x1d6954[_0x1c2b('0x39')]=_['merge'](_0x1d6954[_0x1c2b('0x39')],{'$or':_['map'](_0x10a48e,function(_0x56bcd1){if(_0x56bcd1[_0x1c2b('0x3a')]!=='VIRTUAL'){var _0x317a08={};_0x317a08[_0x56bcd1[_0x1c2b('0x27')]]={'$like':'%'+_0x4681fe[_0x1c2b('0x2c')][_0x1c2b('0x38')]+'%'};return _0x317a08;}})});}_0x1d6954=_[_0x1c2b('0x3b')]({},_0x1d6954,_0x4681fe[_0x1c2b('0x3c')]);var _0x1cb8af={'where':_0x1d6954[_0x1c2b('0x39')]};return db[_0x1c2b('0x3d')]['count'](_0x1cb8af)[_0x1c2b('0x23')](function(_0x2ad783){_0x747288[_0x1c2b('0x3e')]=_0x2ad783;if(_0x4681fe[_0x1c2b('0x2c')][_0x1c2b('0x3f')]){_0x1d6954[_0x1c2b('0x40')]=[{'all':!![]}];}return db[_0x1c2b('0x3d')][_0x1c2b('0x41')](_0x1d6954);})[_0x1c2b('0x23')](function(_0x12d72c){_0x747288[_0x1c2b('0x42')]=_0x12d72c;return _0x747288;})[_0x1c2b('0x23')](respondWithFilteredResult(_0x230a42,_0x1d6954))[_0x1c2b('0x43')](handleError(_0x230a42,null));};exports[_0x1c2b('0x44')]=function(_0x129956,_0x4fb821){var _0x3f43d9={'raw':!![],'where':{'id':_0x129956['params']['id']}},_0x497bd8={};_0x497bd8[_0x1c2b('0x30')]=_[_0x1c2b('0x2d')](db[_0x1c2b('0x3d')]['rawAttributes']);_0x497bd8[_0x1c2b('0x2c')]=_['keys'](_0x129956[_0x1c2b('0x2c')]);_0x497bd8[_0x1c2b('0x2e')]=_[_0x1c2b('0x2f')](_0x497bd8[_0x1c2b('0x30')],_0x497bd8[_0x1c2b('0x2c')]);_0x3f43d9['attributes']=_[_0x1c2b('0x2f')](_0x497bd8[_0x1c2b('0x30')],qs['fields'](_0x129956['query'][_0x1c2b('0x32')]));_0x3f43d9['attributes']=_0x3f43d9[_0x1c2b('0x31')][_0x1c2b('0x33')]?_0x3f43d9['attributes']:_0x497bd8[_0x1c2b('0x30')];if(_0x129956[_0x1c2b('0x2c')]['includeAll']){_0x3f43d9[_0x1c2b('0x40')]=[{'all':!![]}];}_0x3f43d9=_[_0x1c2b('0x3b')]({},_0x3f43d9,_0x129956[_0x1c2b('0x3c')]);return db['OpenchannelTransferReport'][_0x1c2b('0x45')](_0x3f43d9)[_0x1c2b('0x23')](handleEntityNotFound(_0x4fb821,null))[_0x1c2b('0x23')](respondWithResult(_0x4fb821,null))[_0x1c2b('0x43')](handleError(_0x4fb821,null));};exports[_0x1c2b('0x46')]=function(_0x1aca56,_0x5ea77d){return db['OpenchannelTransferReport'][_0x1c2b('0x46')](_0x1aca56[_0x1c2b('0x47')],{})[_0x1c2b('0x23')](respondWithResult(_0x5ea77d,0xc9))[_0x1c2b('0x43')](handleError(_0x5ea77d,null));};exports[_0x1c2b('0x22')]=function(_0x1c3c7c,_0x7c7b69){if(_0x1c3c7c[_0x1c2b('0x47')]['id']){delete _0x1c3c7c['body']['id'];}return db[_0x1c2b('0x3d')][_0x1c2b('0x45')]({'where':{'id':_0x1c3c7c[_0x1c2b('0x48')]['id']}})[_0x1c2b('0x23')](handleEntityNotFound(_0x7c7b69,null))['then'](saveUpdates(_0x1c3c7c[_0x1c2b('0x47')],null))[_0x1c2b('0x23')](respondWithResult(_0x7c7b69,null))[_0x1c2b('0x43')](handleError(_0x7c7b69,null));};exports[_0x1c2b('0x49')]=function(_0x468017,_0x4a414a){return db['OpenchannelTransferReport'][_0x1c2b('0x45')]({'where':{'id':_0x468017[_0x1c2b('0x48')]['id']}})[_0x1c2b('0x23')](handleEntityNotFound(_0x4a414a,null))[_0x1c2b('0x23')](removeEntity(_0x4a414a,null))[_0x1c2b('0x43')](handleError(_0x4a414a,null));};exports[_0x1c2b('0x4a')]=function(_0x8a8c23,_0x35d47d){return db['OpenchannelTransferReport'][_0x1c2b('0x4a')]()[_0x1c2b('0x23')](respondWithResult(_0x35d47d,null))[_0x1c2b('0x43')](handleError(_0x35d47d,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 3bda015..4c72a6a 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 _0x7cef=['lodash','../../config/logger','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x7cef,0xf8));var _0xf7ce=function(_0x1d473b,_0x1f5ec){_0x1d473b=_0x1d473b-0x0;var _0x235514=_0x7cef[_0x1d473b];return _0x235514;};'use strict';var _=require(_0xf7ce('0x0'));var util=require('util');var logger=require(_0xf7ce('0x1'))('api');var moment=require('moment');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(_0xf7ce('0x2'));module[_0xf7ce('0x3')]=function(_0x4d5636,_0x291eb5){return _0x4d5636[_0xf7ce('0x4')](_0xf7ce('0x5'),attributes,{'tableName':_0xf7ce('0x6'),'paranoid':![],'indexes':[{'name':_0xf7ce('0x7'),'fields':[_0xf7ce('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeedd=['lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','report_openchannel_transfer','uniqueid'];(function(_0x321273,_0x1d05fb){var _0x869b81=function(_0x410fe9){while(--_0x410fe9){_0x321273['push'](_0x321273['shift']());}};_0x869b81(++_0x1d05fb);}(_0xeedd,0x12c));var _0xdeed=function(_0x4c6784,_0x414810){_0x4c6784=_0x4c6784-0x0;var _0x3d75af=_0xeedd[_0x4c6784];return _0x3d75af;};'use strict';var _=require(_0xdeed('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdeed('0x1'));var moment=require('moment');var BPromise=require(_0xdeed('0x2'));var rp=require(_0xdeed('0x3'));var fs=require('fs');var path=require(_0xdeed('0x4'));var rimraf=require(_0xdeed('0x5'));var config=require(_0xdeed('0x6'));var attributes=require(_0xdeed('0x7'));module[_0xdeed('0x8')]=function(_0x35d5fa,_0x3d1dc2){return _0x35d5fa[_0xdeed('0x9')]('OpenchannelTransferReport',attributes,{'tableName':_0xdeed('0xa'),'paranoid':![],'indexes':[{'name':_0xdeed('0xb'),'fields':[_0xdeed('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 3c914f2..805b4d8 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 _0xbcba=['code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x14a1df,_0x3657e2){var _0x2dd91e=function(_0x19a56a){while(--_0x19a56a){_0x14a1df['push'](_0x14a1df['shift']());}};_0x2dd91e(++_0x3657e2);}(_0xbcba,0x6d));var _0xabcb=function(_0x2f2a53,_0x3ef79){_0x2f2a53=_0x2f2a53-0x0;var _0x1e3959=_0xbcba[_0x2f2a53];return _0x1e3959;};'use strict';var _=require(_0xabcb('0x0'));var util=require(_0xabcb('0x1'));var moment=require('moment');var BPromise=require(_0xabcb('0x2'));var rs=require(_0xabcb('0x3'));var fs=require('fs');var Redis=require(_0xabcb('0x4'));var db=require(_0xabcb('0x5'))['db'];var utils=require(_0xabcb('0x6'));var logger=require(_0xabcb('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xabcb('0x8'));var client=jayson[_0xabcb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5322e7,_0x84557f,_0x192b36){return new BPromise(function(_0x5e693d,_0x4b43c0){return client[_0xabcb('0xa')](_0x5322e7,_0x192b36)['then'](function(_0x28e6fc){logger[_0xabcb('0xb')](_0xabcb('0xc'),_0x84557f,_0xabcb('0xd'));logger['debug'](_0xabcb('0xe'),_0x84557f,_0xabcb('0xd'),JSON[_0xabcb('0xf')](_0x28e6fc));if(_0x28e6fc[_0xabcb('0x10')]){if(_0x28e6fc[_0xabcb('0x10')][_0xabcb('0x11')]===0x1f4){logger[_0xabcb('0x10')](_0xabcb('0xc'),_0x84557f,_0x28e6fc['error'][_0xabcb('0x12')]);return _0x4b43c0(_0x28e6fc[_0xabcb('0x10')][_0xabcb('0x12')]);}logger[_0xabcb('0x10')](_0xabcb('0xc'),_0x84557f,_0x28e6fc[_0xabcb('0x10')]['message']);return _0x5e693d(_0x28e6fc[_0xabcb('0x10')][_0xabcb('0x12')]);}else{logger[_0xabcb('0xb')](_0xabcb('0xc'),_0x84557f,_0xabcb('0xd'));_0x5e693d(_0x28e6fc[_0xabcb('0x13')][_0xabcb('0x12')]);}})[_0xabcb('0x14')](function(_0x19032f){logger[_0xabcb('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x84557f,_0x19032f);_0x4b43c0(_0x19032f);});});} \ No newline at end of file +var _0x8958=['client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x51d71a,_0x596fda){var _0xff01f1=function(_0x30480f){while(--_0x30480f){_0x51d71a['push'](_0x51d71a['shift']());}};_0xff01f1(++_0x596fda);}(_0x8958,0x93));var _0x8895=function(_0xc55a9d,_0x10f137){_0xc55a9d=_0xc55a9d-0x0;var _0x2b057d=_0x8958[_0xc55a9d];return _0x2b057d;};'use strict';var _=require('lodash');var util=require(_0x8895('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8895('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x8895('0x2'))(_0x8895('0x3'));var config=require(_0x8895('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x8895('0x5')][_0x8895('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x124e1e,_0x40cec6,_0x33013a){return new BPromise(function(_0x51376b,_0xe018b8){return client[_0x8895('0x7')](_0x124e1e,_0x33013a)[_0x8895('0x8')](function(_0x24fe49){logger[_0x8895('0x9')](_0x8895('0xa'),_0x40cec6,_0x8895('0xb'));logger[_0x8895('0xc')](_0x8895('0xd'),_0x40cec6,_0x8895('0xb'),JSON['stringify'](_0x24fe49));if(_0x24fe49[_0x8895('0xe')]){if(_0x24fe49[_0x8895('0xe')][_0x8895('0xf')]===0x1f4){logger[_0x8895('0xe')](_0x8895('0xa'),_0x40cec6,_0x24fe49[_0x8895('0xe')]['message']);return _0xe018b8(_0x24fe49[_0x8895('0xe')][_0x8895('0x10')]);}logger[_0x8895('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x40cec6,_0x24fe49['error'][_0x8895('0x10')]);return _0x51376b(_0x24fe49['error'][_0x8895('0x10')]);}else{logger[_0x8895('0x9')](_0x8895('0xa'),_0x40cec6,_0x8895('0xb'));_0x51376b(_0x24fe49[_0x8895('0x11')]['message']);}})[_0x8895('0x12')](function(_0x100fc8){logger[_0x8895('0xe')](_0x8895('0xa'),_0x40cec6,_0x100fc8);_0xe018b8(_0x100fc8);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index bd5a4b4..29c574a 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 _0x2a5a=['isAuthenticated','/:id','show','post','create','put','update','delete','multer','express','Router','fs-extra','../../components/auth/service','../../config/environment','./pause.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a5a,0x198));var _0xa2a5=function(_0x277865,_0x14e61e){_0x277865=_0x277865-0x0;var _0x471bb1=_0x2a5a[_0x277865];return _0x471bb1;};'use strict';var multer=require(_0xa2a5('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa2a5('0x1'));var router=express[_0xa2a5('0x2')]();var fs_extra=require(_0xa2a5('0x3'));var auth=require(_0xa2a5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa2a5('0x5'));var controller=require(_0xa2a5('0x6'));router[_0xa2a5('0x7')]('/',auth[_0xa2a5('0x8')](),controller['index']);router['get'](_0xa2a5('0x9'),auth[_0xa2a5('0x8')](),controller[_0xa2a5('0xa')]);router[_0xa2a5('0xb')]('/',auth[_0xa2a5('0x8')](),controller[_0xa2a5('0xc')]);router[_0xa2a5('0xd')](_0xa2a5('0x9'),auth[_0xa2a5('0x8')](),controller[_0xa2a5('0xe')]);router[_0xa2a5('0xf')](_0xa2a5('0x9'),auth[_0xa2a5('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc14e=['put','/:id','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','show','create'];(function(_0xcd4e86,_0x10338c){var _0x3b10ed=function(_0x136a41){while(--_0x136a41){_0xcd4e86['push'](_0xcd4e86['shift']());}};_0x3b10ed(++_0x10338c);}(_0xc14e,0x1d9));var _0xec14=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc14e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xec14('0x0'));var util=require('util');var path=require(_0xec14('0x1'));var timeout=require(_0xec14('0x2'));var express=require(_0xec14('0x3'));var router=express['Router']();var fs_extra=require(_0xec14('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xec14('0x5'));var config=require(_0xec14('0x6'));var controller=require(_0xec14('0x7'));router[_0xec14('0x8')]('/',auth[_0xec14('0x9')](),controller[_0xec14('0xa')]);router['get']('/:id',auth[_0xec14('0x9')](),controller[_0xec14('0xb')]);router['post']('/',auth[_0xec14('0x9')](),controller[_0xec14('0xc')]);router[_0xec14('0xd')](_0xec14('0xe'),auth[_0xec14('0x9')](),controller['update']);router[_0xec14('0xf')](_0xec14('0xe'),auth[_0xec14('0x9')](),controller[_0xec14('0x10')]);module[_0xec14('0x11')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 8cd7b2e..5ee61e1 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 _0x3559=['STRING','name','sequelize','exports'];(function(_0x27a1a0,_0x410857){var _0x1321a0=function(_0x4d0991){while(--_0x4d0991){_0x27a1a0['push'](_0x27a1a0['shift']());}};_0x1321a0(++_0x410857);}(_0x3559,0x156));var _0x9355=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3559[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x9355('0x0'));module[_0x9355('0x1')]={'name':{'type':Sequelize[_0x9355('0x2')],'unique':_0x9355('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x9355('0x2')]}}; \ No newline at end of file +var _0xdcca=['exports','STRING','name','sequelize'];(function(_0xd4636c,_0x34dbf6){var _0x5ee17d=function(_0x223c38){while(--_0x223c38){_0xd4636c['push'](_0xd4636c['shift']());}};_0x5ee17d(++_0x34dbf6);}(_0xdcca,0xfb));var _0xadcc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdcca[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xadcc('0x0'));module[_0xadcc('0x1')]={'name':{'type':Sequelize[_0xadcc('0x2')],'unique':_0xadcc('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xadcc('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 6d6e806..ed861f4 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 _0x0fec=['Pauses','UserProfileResource','error','stack','name','send','index','map','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Pause','includeAll','include','findAll','catch','show','rawAttributes','create','body','user','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get'];(function(_0x42c175,_0x4011b7){var _0x45e1c5=function(_0x10f2e6){while(--_0x10f2e6){_0x42c175['push'](_0x42c175['shift']());}};_0x45e1c5(++_0x4011b7);}(_0x0fec,0x1be));var _0xc0fe=function(_0x45fe5a,_0x37e880){_0x45fe5a=_0x45fe5a-0x0;var _0xe77216=_0x0fec[_0x45fe5a];return _0xe77216;};'use strict';var emlformat=require(_0xc0fe('0x0'));var rimraf=require(_0xc0fe('0x1'));var zipdir=require(_0xc0fe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc0fe('0x3'));var moment=require('moment');var BPromise=require(_0xc0fe('0x4'));var Mustache=require(_0xc0fe('0x5'));var util=require('util');var path=require(_0xc0fe('0x6'));var sox=require(_0xc0fe('0x7'));var csv=require(_0xc0fe('0x8'));var ejs=require(_0xc0fe('0x9'));var fs=require('fs');var fs_extra=require(_0xc0fe('0xa'));var _=require(_0xc0fe('0xb'));var squel=require('squel');var crypto=require(_0xc0fe('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc0fe('0xd'));var Redis=require(_0xc0fe('0xe'));var authService=require(_0xc0fe('0xf'));var qs=require(_0xc0fe('0x10'));var as=require(_0xc0fe('0x11'));var hardwareService=require(_0xc0fe('0x12'));var logger=require(_0xc0fe('0x13'))(_0xc0fe('0x14'));var utils=require(_0xc0fe('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc0fe('0x16'));var db=require(_0xc0fe('0x17'))['db'];function respondWithStatusCode(_0x4e7d0b,_0x4403ea){_0x4403ea=_0x4403ea||0xcc;return function(_0x30c4b7){if(_0x30c4b7){return _0x4e7d0b[_0xc0fe('0x18')](_0x4403ea);}return _0x4e7d0b[_0xc0fe('0x19')](_0x4403ea)['end']();};}function respondWithResult(_0x5116dd,_0x4edb1d){_0x4edb1d=_0x4edb1d||0xc8;return function(_0x55e605){if(_0x55e605){return _0x5116dd[_0xc0fe('0x19')](_0x4edb1d)[_0xc0fe('0x1a')](_0x55e605);}};}function respondWithFilteredResult(_0x50f056,_0x49bf51){return function(_0x88bc74){if(_0x88bc74){var _0xe4fe72=typeof _0x49bf51[_0xc0fe('0x1b')]===_0xc0fe('0x1c')&&typeof _0x49bf51[_0xc0fe('0x1d')]===_0xc0fe('0x1c');var _0x9f955a=_0x88bc74[_0xc0fe('0x1e')];var _0x4339e6=_0xe4fe72?0x0:_0x49bf51[_0xc0fe('0x1b')];var _0xe7a408=_0xe4fe72?_0x88bc74['count']:_0x49bf51[_0xc0fe('0x1b')]+_0x49bf51[_0xc0fe('0x1d')];var _0x2eafad;if(_0xe7a408>=_0x9f955a){_0xe7a408=_0x9f955a;_0x2eafad=0xc8;}else{_0x2eafad=0xce;}_0x50f056['status'](_0x2eafad);return _0x50f056[_0xc0fe('0x1f')](_0xc0fe('0x20'),_0x4339e6+'-'+_0xe7a408+'/'+_0x9f955a)['json'](_0x88bc74);}return null;};}function patchUpdates(_0x163a5e){return function(_0x238519){try{jsonpatch[_0xc0fe('0x21')](_0x238519,_0x163a5e,!![]);}catch(_0x3387f7){return BPromise[_0xc0fe('0x22')](_0x3387f7);}return _0x238519[_0xc0fe('0x23')]();};}function saveUpdates(_0x4c66f7,_0x50d65a){return function(_0x4966b3){if(_0x4966b3){return _0x4966b3[_0xc0fe('0x24')](_0x4c66f7)[_0xc0fe('0x25')](function(_0x2f2e14){return _0x2f2e14;});}return null;};}function removeEntity(_0x2f421e,_0x3bc655){return function(_0x40c44e){if(_0x40c44e){return _0x40c44e[_0xc0fe('0x26')]()[_0xc0fe('0x25')](function(){var _0x120b2a=_0x40c44e[_0xc0fe('0x27')]({'plain':!![]});var _0x997e33=_0xc0fe('0x28');return db[_0xc0fe('0x29')][_0xc0fe('0x26')]({'where':{'type':_0x997e33,'resourceId':_0x120b2a['id']}})[_0xc0fe('0x25')](function(){return _0x40c44e;});})[_0xc0fe('0x25')](function(){_0x2f421e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x527de1,_0x10f8c5){return function(_0x38c597){if(!_0x38c597){_0x527de1['sendStatus'](0x194);}return _0x38c597;};}function handleError(_0x2d4e7e,_0x4a1b32){_0x4a1b32=_0x4a1b32||0x1f4;return function(_0x2b5a63){logger[_0xc0fe('0x2a')](_0x2b5a63[_0xc0fe('0x2b')]);if(_0x2b5a63['name']){delete _0x2b5a63[_0xc0fe('0x2c')];}_0x2d4e7e['status'](_0x4a1b32)[_0xc0fe('0x2d')](_0x2b5a63);};}exports[_0xc0fe('0x2e')]=function(_0x3974ae,_0x5ea514){var _0x35cf9a={},_0x1c66e7={},_0x835ac2={'count':0x0,'rows':[]};var _0x2462ba=_[_0xc0fe('0x2f')](db['Pause']['rawAttributes'],function(_0x2b768a){return{'name':_0x2b768a[_0xc0fe('0x30')],'type':_0x2b768a[_0xc0fe('0x31')]['key']};});_0x1c66e7[_0xc0fe('0x32')]=_['map'](_0x2462ba,_0xc0fe('0x2c'));_0x1c66e7[_0xc0fe('0x33')]=_[_0xc0fe('0x34')](_0x3974ae['query']);_0x1c66e7['filters']=_[_0xc0fe('0x35')](_0x1c66e7[_0xc0fe('0x32')],_0x1c66e7[_0xc0fe('0x33')]);_0x35cf9a[_0xc0fe('0x36')]=_[_0xc0fe('0x35')](_0x1c66e7[_0xc0fe('0x32')],qs['fields'](_0x3974ae[_0xc0fe('0x33')][_0xc0fe('0x37')]));_0x35cf9a['attributes']=_0x35cf9a[_0xc0fe('0x36')][_0xc0fe('0x38')]?_0x35cf9a['attributes']:_0x1c66e7['model'];if(!_0x3974ae[_0xc0fe('0x33')][_0xc0fe('0x39')]('nolimit')){_0x35cf9a[_0xc0fe('0x1d')]=qs['limit'](_0x3974ae[_0xc0fe('0x33')][_0xc0fe('0x1d')]);_0x35cf9a[_0xc0fe('0x1b')]=qs[_0xc0fe('0x1b')](_0x3974ae['query'][_0xc0fe('0x1b')]);}_0x35cf9a[_0xc0fe('0x3a')]=qs[_0xc0fe('0x3b')](_0x3974ae['query'][_0xc0fe('0x3b')]);_0x35cf9a[_0xc0fe('0x3c')]=qs[_0xc0fe('0x3d')](_[_0xc0fe('0x3e')](_0x3974ae[_0xc0fe('0x33')],_0x1c66e7[_0xc0fe('0x3d')]),_0x2462ba);if(_0x3974ae['query'][_0xc0fe('0x3f')]){_0x35cf9a[_0xc0fe('0x3c')]=_[_0xc0fe('0x40')](_0x35cf9a[_0xc0fe('0x3c')],{'$or':_['map'](_0x2462ba,function(_0x568243){if(_0x568243['type']!==_0xc0fe('0x41')){var _0x42e419={};_0x42e419[_0x568243[_0xc0fe('0x2c')]]={'$like':'%'+_0x3974ae['query'][_0xc0fe('0x3f')]+'%'};return _0x42e419;}})});}_0x35cf9a=_['merge']({},_0x35cf9a,_0x3974ae[_0xc0fe('0x42')]);var _0x4c6a30={'where':_0x35cf9a['where']};return db[_0xc0fe('0x43')][_0xc0fe('0x1e')](_0x4c6a30)[_0xc0fe('0x25')](function(_0x467f05){_0x835ac2['count']=_0x467f05;if(_0x3974ae[_0xc0fe('0x33')][_0xc0fe('0x44')]){_0x35cf9a[_0xc0fe('0x45')]=[{'all':!![]}];}return db[_0xc0fe('0x43')][_0xc0fe('0x46')](_0x35cf9a);})[_0xc0fe('0x25')](function(_0x38d8dd){_0x835ac2['rows']=_0x38d8dd;return _0x835ac2;})['then'](respondWithFilteredResult(_0x5ea514,_0x35cf9a))[_0xc0fe('0x47')](handleError(_0x5ea514,null));};exports[_0xc0fe('0x48')]=function(_0x524767,_0x5c1907){var _0x791098={'raw':!![],'where':{'id':_0x524767['params']['id']}},_0x593113={};_0x593113[_0xc0fe('0x32')]=_['keys'](db[_0xc0fe('0x43')][_0xc0fe('0x49')]);_0x593113[_0xc0fe('0x33')]=_[_0xc0fe('0x34')](_0x524767[_0xc0fe('0x33')]);_0x593113[_0xc0fe('0x3d')]=_[_0xc0fe('0x35')](_0x593113['model'],_0x593113[_0xc0fe('0x33')]);_0x791098[_0xc0fe('0x36')]=_[_0xc0fe('0x35')](_0x593113[_0xc0fe('0x32')],qs[_0xc0fe('0x37')](_0x524767[_0xc0fe('0x33')][_0xc0fe('0x37')]));_0x791098[_0xc0fe('0x36')]=_0x791098['attributes'][_0xc0fe('0x38')]?_0x791098['attributes']:_0x593113['model'];if(_0x524767[_0xc0fe('0x33')][_0xc0fe('0x44')]){_0x791098[_0xc0fe('0x45')]=[{'all':!![]}];}_0x791098=_[_0xc0fe('0x40')]({},_0x791098,_0x524767[_0xc0fe('0x42')]);return db[_0xc0fe('0x43')]['find'](_0x791098)[_0xc0fe('0x25')](handleEntityNotFound(_0x5c1907,null))[_0xc0fe('0x25')](respondWithResult(_0x5c1907,null))[_0xc0fe('0x47')](handleError(_0x5c1907,null));};exports[_0xc0fe('0x4a')]=function(_0x502cdd,_0x426118){return db[_0xc0fe('0x43')][_0xc0fe('0x4a')](_0x502cdd[_0xc0fe('0x4b')],{})[_0xc0fe('0x25')](function(_0x163c37){var _0x3da1d2=_0x502cdd[_0xc0fe('0x4c')][_0xc0fe('0x27')]({'plain':!![]});if(!_0x3da1d2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3da1d2['role']===_0xc0fe('0x4c')){var _0x4c827f=_0x163c37[_0xc0fe('0x27')]({'plain':!![]});var _0x416f29=_0xc0fe('0x28');return db[_0xc0fe('0x4d')][_0xc0fe('0x4e')]({'where':{'name':_0x416f29,'userProfileId':_0x3da1d2['userProfileId']},'raw':!![]})[_0xc0fe('0x25')](function(_0x1600bc){if(_0x1600bc&&_0x1600bc['autoAssociation']===0x0){return db[_0xc0fe('0x29')][_0xc0fe('0x4a')]({'name':_0x4c827f[_0xc0fe('0x2c')],'resourceId':_0x4c827f['id'],'type':_0x1600bc[_0xc0fe('0x2c')],'sectionId':_0x1600bc['id']},{})[_0xc0fe('0x25')](function(){return _0x163c37;});}else{return _0x163c37;}})[_0xc0fe('0x47')](function(_0x2d3dba){logger[_0xc0fe('0x2a')](_0xc0fe('0x4f'),_0x2d3dba);throw _0x2d3dba;});}return _0x163c37;})[_0xc0fe('0x25')](respondWithResult(_0x426118,0xc9))[_0xc0fe('0x47')](handleError(_0x426118,null));};exports[_0xc0fe('0x24')]=function(_0x1ae801,_0xe9040){if(_0x1ae801[_0xc0fe('0x4b')]['id']){delete _0x1ae801['body']['id'];}return db[_0xc0fe('0x43')][_0xc0fe('0x4e')]({'where':{'id':_0x1ae801[_0xc0fe('0x50')]['id']}})[_0xc0fe('0x25')](handleEntityNotFound(_0xe9040,null))[_0xc0fe('0x25')](saveUpdates(_0x1ae801[_0xc0fe('0x4b')],null))[_0xc0fe('0x25')](respondWithResult(_0xe9040,null))[_0xc0fe('0x47')](handleError(_0xe9040,null));};exports[_0xc0fe('0x26')]=function(_0x8a54ca,_0x3b70ce){return db[_0xc0fe('0x43')][_0xc0fe('0x4e')]({'where':{'id':_0x8a54ca[_0xc0fe('0x50')]['id']}})[_0xc0fe('0x25')](handleEntityNotFound(_0x3b70ce,null))[_0xc0fe('0x25')](removeEntity(_0x3b70ce,null))[_0xc0fe('0x47')](handleError(_0x3b70ce,null));}; \ No newline at end of file +var _0x25d6=['../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Pauses','UserProfileResource','error','stack','name','map','Pause','rawAttributes','fieldName','type','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x2b4629,_0x2cfe26){var _0x1d8fa9=function(_0x54de40){while(--_0x54de40){_0x2b4629['push'](_0x2b4629['shift']());}};_0x1d8fa9(++_0x2cfe26);}(_0x25d6,0x199));var _0x625d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x25d6[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x625d('0x0'));var rimraf=require(_0x625d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x625d('0x2'));var rp=require(_0x625d('0x3'));var moment=require(_0x625d('0x4'));var BPromise=require(_0x625d('0x5'));var Mustache=require(_0x625d('0x6'));var util=require(_0x625d('0x7'));var path=require(_0x625d('0x8'));var sox=require(_0x625d('0x9'));var csv=require(_0x625d('0xa'));var ejs=require(_0x625d('0xb'));var fs=require('fs');var fs_extra=require(_0x625d('0xc'));var _=require(_0x625d('0xd'));var squel=require(_0x625d('0xe'));var crypto=require(_0x625d('0xf'));var jsforce=require(_0x625d('0x10'));var deskjs=require(_0x625d('0x11'));var toCsv=require(_0x625d('0xa'));var querystring=require(_0x625d('0x12'));var Papa=require('papaparse');var Redis=require(_0x625d('0x13'));var authService=require(_0x625d('0x14'));var qs=require(_0x625d('0x15'));var as=require(_0x625d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x625d('0x17'));var config=require(_0x625d('0x18'));var licenseUtil=require(_0x625d('0x19'));var db=require(_0x625d('0x1a'))['db'];function respondWithStatusCode(_0x56bfab,_0x229aeb){_0x229aeb=_0x229aeb||0xcc;return function(_0x4725ce){if(_0x4725ce){return _0x56bfab[_0x625d('0x1b')](_0x229aeb);}return _0x56bfab[_0x625d('0x1c')](_0x229aeb)[_0x625d('0x1d')]();};}function respondWithResult(_0x1f2f2f,_0x588e5e){_0x588e5e=_0x588e5e||0xc8;return function(_0x5a41ed){if(_0x5a41ed){return _0x1f2f2f['status'](_0x588e5e)[_0x625d('0x1e')](_0x5a41ed);}};}function respondWithFilteredResult(_0x29902f,_0x26ea9d){return function(_0x3ebc16){if(_0x3ebc16){var _0x489d49=typeof _0x26ea9d[_0x625d('0x1f')]===_0x625d('0x20')&&typeof _0x26ea9d['limit']===_0x625d('0x20');var _0x465d3b=_0x3ebc16[_0x625d('0x21')];var _0x48a71b=_0x489d49?0x0:_0x26ea9d[_0x625d('0x1f')];var _0x47f2f5=_0x489d49?_0x3ebc16[_0x625d('0x21')]:_0x26ea9d[_0x625d('0x1f')]+_0x26ea9d[_0x625d('0x22')];var _0xd37d28;if(_0x47f2f5>=_0x465d3b){_0x47f2f5=_0x465d3b;_0xd37d28=0xc8;}else{_0xd37d28=0xce;}_0x29902f[_0x625d('0x1c')](_0xd37d28);return _0x29902f[_0x625d('0x23')](_0x625d('0x24'),_0x48a71b+'-'+_0x47f2f5+'/'+_0x465d3b)[_0x625d('0x1e')](_0x3ebc16);}return null;};}function patchUpdates(_0x1e3b70){return function(_0x13bb1){try{jsonpatch[_0x625d('0x25')](_0x13bb1,_0x1e3b70,!![]);}catch(_0x23d680){return BPromise[_0x625d('0x26')](_0x23d680);}return _0x13bb1[_0x625d('0x27')]();};}function saveUpdates(_0x7cee8f,_0x388096){return function(_0x627973){if(_0x627973){return _0x627973[_0x625d('0x28')](_0x7cee8f)[_0x625d('0x29')](function(_0x2b889c){return _0x2b889c;});}return null;};}function removeEntity(_0x5c22fb,_0x4728ae){return function(_0x24d7ca){if(_0x24d7ca){return _0x24d7ca[_0x625d('0x2a')]()[_0x625d('0x29')](function(){var _0x2300ea=_0x24d7ca[_0x625d('0x2b')]({'plain':!![]});var _0x36ca27=_0x625d('0x2c');return db[_0x625d('0x2d')][_0x625d('0x2a')]({'where':{'type':_0x36ca27,'resourceId':_0x2300ea['id']}})[_0x625d('0x29')](function(){return _0x24d7ca;});})[_0x625d('0x29')](function(){_0x5c22fb['status'](0xcc)[_0x625d('0x1d')]();});}};}function handleEntityNotFound(_0x5bd99a,_0x328fb6){return function(_0x2490ce){if(!_0x2490ce){_0x5bd99a[_0x625d('0x1b')](0x194);}return _0x2490ce;};}function handleError(_0x36699f,_0x241c85){_0x241c85=_0x241c85||0x1f4;return function(_0x270577){logger[_0x625d('0x2e')](_0x270577[_0x625d('0x2f')]);if(_0x270577[_0x625d('0x30')]){delete _0x270577[_0x625d('0x30')];}_0x36699f['status'](_0x241c85)['send'](_0x270577);};}exports['index']=function(_0x213898,_0x2fa04a){var _0x3d3157={},_0x1f7d4c={},_0x59aa61={'count':0x0,'rows':[]};var _0x270215=_[_0x625d('0x31')](db[_0x625d('0x32')][_0x625d('0x33')],function(_0x5b4fdd){return{'name':_0x5b4fdd[_0x625d('0x34')],'type':_0x5b4fdd[_0x625d('0x35')]['key']};});_0x1f7d4c['model']=_[_0x625d('0x31')](_0x270215,'name');_0x1f7d4c['query']=_[_0x625d('0x36')](_0x213898[_0x625d('0x37')]);_0x1f7d4c[_0x625d('0x38')]=_[_0x625d('0x39')](_0x1f7d4c['model'],_0x1f7d4c[_0x625d('0x37')]);_0x3d3157[_0x625d('0x3a')]=_['intersection'](_0x1f7d4c[_0x625d('0x3b')],qs[_0x625d('0x3c')](_0x213898[_0x625d('0x37')][_0x625d('0x3c')]));_0x3d3157[_0x625d('0x3a')]=_0x3d3157['attributes'][_0x625d('0x3d')]?_0x3d3157[_0x625d('0x3a')]:_0x1f7d4c[_0x625d('0x3b')];if(!_0x213898[_0x625d('0x37')][_0x625d('0x3e')](_0x625d('0x3f'))){_0x3d3157[_0x625d('0x22')]=qs['limit'](_0x213898['query'][_0x625d('0x22')]);_0x3d3157[_0x625d('0x1f')]=qs[_0x625d('0x1f')](_0x213898[_0x625d('0x37')][_0x625d('0x1f')]);}_0x3d3157[_0x625d('0x40')]=qs[_0x625d('0x41')](_0x213898['query']['sort']);_0x3d3157[_0x625d('0x42')]=qs['filters'](_[_0x625d('0x43')](_0x213898['query'],_0x1f7d4c[_0x625d('0x38')]),_0x270215);if(_0x213898[_0x625d('0x37')]['filter']){_0x3d3157[_0x625d('0x42')]=_[_0x625d('0x44')](_0x3d3157['where'],{'$or':_[_0x625d('0x31')](_0x270215,function(_0x87a448){if(_0x87a448[_0x625d('0x35')]!==_0x625d('0x45')){var _0x1a1642={};_0x1a1642[_0x87a448['name']]={'$like':'%'+_0x213898['query'][_0x625d('0x46')]+'%'};return _0x1a1642;}})});}_0x3d3157=_[_0x625d('0x44')]({},_0x3d3157,_0x213898['options']);var _0x2bedce={'where':_0x3d3157[_0x625d('0x42')]};return db['Pause']['count'](_0x2bedce)[_0x625d('0x29')](function(_0x18add8){_0x59aa61[_0x625d('0x21')]=_0x18add8;if(_0x213898[_0x625d('0x37')]['includeAll']){_0x3d3157[_0x625d('0x47')]=[{'all':!![]}];}return db[_0x625d('0x32')][_0x625d('0x48')](_0x3d3157);})['then'](function(_0x280734){_0x59aa61[_0x625d('0x49')]=_0x280734;return _0x59aa61;})[_0x625d('0x29')](respondWithFilteredResult(_0x2fa04a,_0x3d3157))[_0x625d('0x4a')](handleError(_0x2fa04a,null));};exports[_0x625d('0x4b')]=function(_0x3452ef,_0x3c28fa){var _0x296483={'raw':!![],'where':{'id':_0x3452ef[_0x625d('0x4c')]['id']}},_0x20d37a={};_0x20d37a[_0x625d('0x3b')]=_['keys'](db['Pause'][_0x625d('0x33')]);_0x20d37a['query']=_[_0x625d('0x36')](_0x3452ef['query']);_0x20d37a['filters']=_[_0x625d('0x39')](_0x20d37a[_0x625d('0x3b')],_0x20d37a[_0x625d('0x37')]);_0x296483['attributes']=_['intersection'](_0x20d37a[_0x625d('0x3b')],qs[_0x625d('0x3c')](_0x3452ef[_0x625d('0x37')][_0x625d('0x3c')]));_0x296483['attributes']=_0x296483[_0x625d('0x3a')][_0x625d('0x3d')]?_0x296483[_0x625d('0x3a')]:_0x20d37a[_0x625d('0x3b')];if(_0x3452ef[_0x625d('0x37')][_0x625d('0x4d')]){_0x296483[_0x625d('0x47')]=[{'all':!![]}];}_0x296483=_[_0x625d('0x44')]({},_0x296483,_0x3452ef[_0x625d('0x4e')]);return db[_0x625d('0x32')][_0x625d('0x4f')](_0x296483)['then'](handleEntityNotFound(_0x3c28fa,null))[_0x625d('0x29')](respondWithResult(_0x3c28fa,null))[_0x625d('0x4a')](handleError(_0x3c28fa,null));};exports[_0x625d('0x50')]=function(_0x1db668,_0x39d07e){return db[_0x625d('0x32')][_0x625d('0x50')](_0x1db668[_0x625d('0x51')],{})[_0x625d('0x29')](function(_0x2a52bc){var _0x458229=_0x1db668[_0x625d('0x52')]['get']({'plain':!![]});if(!_0x458229)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x458229['role']===_0x625d('0x52')){var _0x3c17a5=_0x2a52bc['get']({'plain':!![]});var _0x3b73dc='Pauses';return db[_0x625d('0x53')]['find']({'where':{'name':_0x3b73dc,'userProfileId':_0x458229[_0x625d('0x54')]},'raw':!![]})['then'](function(_0x2a9db7){if(_0x2a9db7&&_0x2a9db7[_0x625d('0x55')]===0x0){return db[_0x625d('0x2d')][_0x625d('0x50')]({'name':_0x3c17a5[_0x625d('0x30')],'resourceId':_0x3c17a5['id'],'type':_0x2a9db7[_0x625d('0x30')],'sectionId':_0x2a9db7['id']},{})[_0x625d('0x29')](function(){return _0x2a52bc;});}else{return _0x2a52bc;}})[_0x625d('0x4a')](function(_0x42a683){logger[_0x625d('0x2e')](_0x625d('0x56'),_0x42a683);throw _0x42a683;});}return _0x2a52bc;})[_0x625d('0x29')](respondWithResult(_0x39d07e,0xc9))['catch'](handleError(_0x39d07e,null));};exports['update']=function(_0x331e17,_0x5ac072){if(_0x331e17[_0x625d('0x51')]['id']){delete _0x331e17[_0x625d('0x51')]['id'];}return db[_0x625d('0x32')][_0x625d('0x4f')]({'where':{'id':_0x331e17[_0x625d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5ac072,null))[_0x625d('0x29')](saveUpdates(_0x331e17['body'],null))['then'](respondWithResult(_0x5ac072,null))[_0x625d('0x4a')](handleError(_0x5ac072,null));};exports[_0x625d('0x2a')]=function(_0x2cbff2,_0x2c479e){return db['Pause'][_0x625d('0x4f')]({'where':{'id':_0x2cbff2[_0x625d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2c479e,null))[_0x625d('0x29')](removeEntity(_0x2c479e,null))[_0x625d('0x4a')](handleError(_0x2c479e,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 45ea639..fe120c7 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 _0xe14b=['bluebird','path','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','moment'];(function(_0x58ce05,_0xa0dc04){var _0x4ea0c3=function(_0x71f48f){while(--_0x71f48f){_0x58ce05['push'](_0x58ce05['shift']());}};_0x4ea0c3(++_0xa0dc04);}(_0xe14b,0x93));var _0xbe14=function(_0x4157d8,_0x1146a2){_0x4157d8=_0x4157d8-0x0;var _0xd80490=_0xe14b[_0x4157d8];return _0xd80490;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','moment'];(function(_0x24d5a5,_0x2affc9){var _0x1b943b=function(_0x212f1f){while(--_0x212f1f){_0x24d5a5['push'](_0x24d5a5['shift']());}};_0x1b943b(++_0x2affc9);}(_0xe14b,0x93));var _0xbe14=function(_0x5e5a45,_0x39f8b2){_0x5e5a45=_0x5e5a45-0x0;var _0x67fbfc=_0xe14b[_0x5e5a45];return _0x67fbfc;};'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 74b3b1e..9feba0e 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x53ead1,_0x32f927){var _0xd76035=function(_0x39e4c1){while(--_0x39e4c1){_0x53ead1['push'](_0x53ead1['shift']());}};_0xd76035(++_0x32f927);}(_0xb10b,0x12a));var _0xbb10=function(_0x542f45,_0x37468a){_0x542f45=_0x542f45-0x0;var _0x38c609=_0xb10b[_0x542f45];return _0x38c609;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x57b0fd,_0x1da11d){var _0x1438b2=function(_0x3b5c6d){while(--_0x3b5c6d){_0x57b0fd['push'](_0x57b0fd['shift']());}};_0x1438b2(++_0x1da11d);}(_0x7a54,0x106));var _0x47a5=function(_0xa380de,_0x297b10){_0xa380de=_0xa380de-0x0;var _0x4cff94=_0x7a54[_0xa380de];return _0x4cff94;};'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 14513f0..5ee1e03 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 _0xb332=['server/files/plugins','originalname','replace','format','basename','extname','now','post','single','file','upload','/:id','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','/:id/download','download','diskStorage','join','root'];(function(_0x1168b8,_0x1c4453){var _0x2b5206=function(_0x16f8d8){while(--_0x16f8d8){_0x1168b8['push'](_0x1168b8['shift']());}};_0x2b5206(++_0x1c4453);}(_0xb332,0xd9));var _0x2b33=function(_0x61b3ab,_0x1fc298){_0x61b3ab=_0x61b3ab-0x0;var _0x57097f=_0xb332[_0x61b3ab];return _0x57097f;};'use strict';var multer=require(_0x2b33('0x0'));var util=require('util');var path=require(_0x2b33('0x1'));var timeout=require(_0x2b33('0x2'));var express=require('express');var router=express[_0x2b33('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2b33('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2b33('0x5'));var controller=require('./plugin.controller');router[_0x2b33('0x6')]('/',auth[_0x2b33('0x7')](),controller[_0x2b33('0x8')]);router[_0x2b33('0x6')]('/webhook',controller['webhookGet']);router[_0x2b33('0x6')]('/:id',auth[_0x2b33('0x7')](),controller[_0x2b33('0x9')]);router[_0x2b33('0x6')](_0x2b33('0xa'),auth['isAuthenticated'](),controller[_0x2b33('0xb')]);var upload=multer({'storage':multer[_0x2b33('0xc')]({'destination':function(_0x1be19d,_0x1d83a6,_0x1989f3){_0x1989f3(null,path[_0x2b33('0xd')](config[_0x2b33('0xe')],_0x2b33('0xf')));},'filename':function(_0x1e0d36,_0x3969cb,_0xca2248){_0x3969cb['originalname']=_0x3969cb[_0x2b33('0x10')][_0x2b33('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xca2248(null,util[_0x2b33('0x12')]('%s-%s%s',path[_0x2b33('0x13')](_0x3969cb['originalname'],path[_0x2b33('0x14')](_0x3969cb[_0x2b33('0x10')])),Date[_0x2b33('0x15')](),path['extname'](_0x3969cb['originalname'])));}})});router[_0x2b33('0x16')]('/',upload[_0x2b33('0x17')](_0x2b33('0x18')),controller[_0x2b33('0x19')]);router[_0x2b33('0x16')]('/webhook',controller['webhookPost']);router['put'](_0x2b33('0x1a'),auth['isAuthenticated'](),controller['update']);router[_0x2b33('0x1b')](_0x2b33('0x1a'),auth[_0x2b33('0x7')](),controller['delete']);module[_0x2b33('0x1c')]=router; \ No newline at end of file +var _0x6334=['../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','/:id','show','/:id/download','download','diskStorage','join','root','format','%s-%s%s','extname','now','originalname','post','file','upload','webhookPost','put','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x51cf1a,_0x26e85f){var _0x4a42c1=function(_0x3f8247){while(--_0x3f8247){_0x51cf1a['push'](_0x51cf1a['shift']());}};_0x4a42c1(++_0x26e85f);}(_0x6334,0x119));var _0x4633=function(_0xf5fbb7,_0xdb7f69){_0xf5fbb7=_0xf5fbb7-0x0;var _0x330d55=_0x6334[_0xf5fbb7];return _0x330d55;};'use strict';var multer=require(_0x4633('0x0'));var util=require(_0x4633('0x1'));var path=require(_0x4633('0x2'));var timeout=require(_0x4633('0x3'));var express=require(_0x4633('0x4'));var router=express[_0x4633('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4633('0x6'));var interaction=require(_0x4633('0x7'));var config=require(_0x4633('0x8'));var controller=require(_0x4633('0x9'));router[_0x4633('0xa')]('/',auth[_0x4633('0xb')](),controller[_0x4633('0xc')]);router['get'](_0x4633('0xd'),controller['webhookGet']);router[_0x4633('0xa')](_0x4633('0xe'),auth['isAuthenticated'](),controller[_0x4633('0xf')]);router[_0x4633('0xa')](_0x4633('0x10'),auth['isAuthenticated'](),controller[_0x4633('0x11')]);var upload=multer({'storage':multer[_0x4633('0x12')]({'destination':function(_0x5157a7,_0x6a63b,_0x3d5182){_0x3d5182(null,path[_0x4633('0x13')](config[_0x4633('0x14')],'server/files/plugins'));},'filename':function(_0x73b5e4,_0xad405,_0x438e87){_0xad405['originalname']=_0xad405['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x438e87(null,util[_0x4633('0x15')](_0x4633('0x16'),path['basename'](_0xad405['originalname'],path[_0x4633('0x17')](_0xad405['originalname'])),Date[_0x4633('0x18')](),path[_0x4633('0x17')](_0xad405[_0x4633('0x19')])));}})});router[_0x4633('0x1a')]('/',upload['single'](_0x4633('0x1b')),controller[_0x4633('0x1c')]);router[_0x4633('0x1a')]('/webhook',controller[_0x4633('0x1d')]);router[_0x4633('0x1e')](_0x4633('0xe'),auth[_0x4633('0xb')](),controller[_0x4633('0x1f')]);router['delete'](_0x4633('0xe'),auth[_0x4633('0xb')](),controller['delete']);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index f17efbb..1d98400 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 _0xa68a=['sequelize','exports','STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','adminOnly','agentOnly','always'];(function(_0x55c485,_0x3fe77e){var _0x6bb521=function(_0x466a3d){while(--_0x466a3d){_0x55c485['push'](_0x55c485['shift']());}};_0x6bb521(++_0x3fe77e);}(_0xa68a,0x172));var _0xaa68=function(_0x2d2685,_0x5d1714){_0x2d2685=_0x2d2685-0x0;var _0x4167c0=_0xa68a[_0x2d2685];return _0x4167c0;};'use strict';var Sequelize=require(_0xaa68('0x0'));module[_0xaa68('0x1')]={'name':{'type':Sequelize[_0xaa68('0x2')]},'type':{'type':Sequelize[_0xaa68('0x3')](_0xaa68('0x4'),'script')},'description':{'type':Sequelize[_0xaa68('0x5')]},'version':{'type':Sequelize[_0xaa68('0x5')]},'path':{'type':Sequelize[_0xaa68('0x2')],'comment':_0xaa68('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0xaa68('0x3')](_0xaa68('0x7'),_0xaa68('0x8'),_0xaa68('0x9'),'never'),'defaultValue':_0xaa68('0x9'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0xaa68('0x2')]},'adminUrl':{'type':Sequelize[_0xaa68('0x2')]},'agentUrl':{'type':Sequelize[_0xaa68('0x2')]},'scriptName':{'type':Sequelize[_0xaa68('0x2')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdf74=['always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','adminOnly','agentOnly'];(function(_0x5c6c3f,_0x37b4f5){var _0x3a0309=function(_0x2a8ffb){while(--_0x2a8ffb){_0x5c6c3f['push'](_0x5c6c3f['shift']());}};_0x3a0309(++_0x37b4f5);}(_0xdf74,0xf1));var _0x4df7=function(_0x2c6b3c,_0x194d6a){_0x2c6b3c=_0x2c6b3c-0x0;var _0x3f9ae0=_0xdf74[_0x2c6b3c];return _0x3f9ae0;};'use strict';var Sequelize=require('sequelize');module[_0x4df7('0x0')]={'name':{'type':Sequelize[_0x4df7('0x1')]},'type':{'type':Sequelize['ENUM'](_0x4df7('0x2'),_0x4df7('0x3'))},'description':{'type':Sequelize[_0x4df7('0x4')]},'version':{'type':Sequelize[_0x4df7('0x4')]},'path':{'type':Sequelize[_0x4df7('0x1')],'comment':_0x4df7('0x5')},'active':{'type':Sequelize[_0x4df7('0x6')],'defaultValue':0x0,'comment':_0x4df7('0x7')},'sidebar':{'type':Sequelize[_0x4df7('0x8')](_0x4df7('0x9'),_0x4df7('0xa'),_0x4df7('0xb'),_0x4df7('0xc')),'defaultValue':_0x4df7('0xb'),'comment':_0x4df7('0xd')},'icon':{'type':Sequelize[_0x4df7('0x1')]},'adminUrl':{'type':Sequelize[_0x4df7('0x1')]},'agentUrl':{'type':Sequelize[_0x4df7('0x1')]},'scriptName':{'type':Sequelize[_0x4df7('0x1')]},'scriptPath':{'type':Sequelize[_0x4df7('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 64013c9..7d0eeb6 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 _0xff97=['download','join','root','server/files/plugins','%s.zip','basename','createWriteStream','warning','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','path','node_modules/**/*','attachments/**/*','finalize','close','existsSync','format','Sequelize','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','test','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','plugins','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','set','endsWith','statusCode','webhookPost','http://localhost:','content-type','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','status','end','offset','undefined','limit','count','json','apply','reject','save','update','destroy','then','get','Plugins','UserProfileResource','sendStatus','error','stack','send','map','Plugin','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','filter','where','VIRTUAL','name','merge','include','findAll','rows','show','params','options','catch'];(function(_0x4733d3,_0x454290){var _0x1b9a44=function(_0x1a93bb){while(--_0x1a93bb){_0x4733d3['push'](_0x4733d3['shift']());}};_0x1b9a44(++_0x454290);}(_0xff97,0x1b5));var _0x7ff9=function(_0x5946ed,_0x1f317c){_0x5946ed=_0x5946ed-0x0;var _0x377ea9=_0xff97[_0x5946ed];return _0x377ea9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7ff9('0x0'));var zipdir=require(_0x7ff9('0x1'));var jsonpatch=require(_0x7ff9('0x2'));var rp=require(_0x7ff9('0x3'));var moment=require(_0x7ff9('0x4'));var BPromise=require(_0x7ff9('0x5'));var Mustache=require(_0x7ff9('0x6'));var util=require(_0x7ff9('0x7'));var path=require('path');var sox=require(_0x7ff9('0x8'));var csv=require(_0x7ff9('0x9'));var ejs=require(_0x7ff9('0xa'));var fs=require('fs');var fs_extra=require(_0x7ff9('0xb'));var _=require('lodash');var squel=require(_0x7ff9('0xc'));var crypto=require(_0x7ff9('0xd'));var jsforce=require(_0x7ff9('0xe'));var deskjs=require(_0x7ff9('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7ff9('0x10'));var extract=require(_0x7ff9('0x11'));var rimraf=require(_0x7ff9('0x0'));var archiver=require(_0x7ff9('0x12'));var Redis=require(_0x7ff9('0x13'));var authService=require(_0x7ff9('0x14'));var qs=require(_0x7ff9('0x15'));var as=require(_0x7ff9('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7ff9('0x17'));var utils=require(_0x7ff9('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7ff9('0x19'));var db=require(_0x7ff9('0x1a'))['db'];config['redis']=_[_0x7ff9('0x1b')](config['redis'],{'host':_0x7ff9('0x1c'),'port':0x18eb});var socket=require(_0x7ff9('0x1d'))(new Redis(config[_0x7ff9('0x1e')]));require('./plugin.socket')['register'](socket);function respondWithStatusCode(_0x49fd67,_0x4c7161){_0x4c7161=_0x4c7161||0xcc;return function(_0x3ed155){if(_0x3ed155){return _0x49fd67['sendStatus'](_0x4c7161);}return _0x49fd67[_0x7ff9('0x1f')](_0x4c7161)[_0x7ff9('0x20')]();};}function respondWithResult(_0x42a9a1,_0x3d2173){_0x3d2173=_0x3d2173||0xc8;return function(_0x33965b){if(_0x33965b){return _0x42a9a1[_0x7ff9('0x1f')](_0x3d2173)['json'](_0x33965b);}};}function respondWithFilteredResult(_0x482117,_0x38b320){return function(_0x30aa2a){if(_0x30aa2a){var _0x338feb=typeof _0x38b320[_0x7ff9('0x21')]===_0x7ff9('0x22')&&typeof _0x38b320[_0x7ff9('0x23')]===_0x7ff9('0x22');var _0x2d20da=_0x30aa2a[_0x7ff9('0x24')];var _0x226976=_0x338feb?0x0:_0x38b320[_0x7ff9('0x21')];var _0x5a15bf=_0x338feb?_0x30aa2a[_0x7ff9('0x24')]:_0x38b320[_0x7ff9('0x21')]+_0x38b320[_0x7ff9('0x23')];var _0x43466e;if(_0x5a15bf>=_0x2d20da){_0x5a15bf=_0x2d20da;_0x43466e=0xc8;}else{_0x43466e=0xce;}_0x482117['status'](_0x43466e);return _0x482117['set']('Content-Range',_0x226976+'-'+_0x5a15bf+'/'+_0x2d20da)[_0x7ff9('0x25')](_0x30aa2a);}return null;};}function patchUpdates(_0x16898f){return function(_0x308b89){try{jsonpatch[_0x7ff9('0x26')](_0x308b89,_0x16898f,!![]);}catch(_0x5eed33){return BPromise[_0x7ff9('0x27')](_0x5eed33);}return _0x308b89[_0x7ff9('0x28')]();};}function saveUpdates(_0x2aabf7,_0x6acc26){return function(_0x3cfde1){if(_0x3cfde1){return _0x3cfde1[_0x7ff9('0x29')](_0x2aabf7)['then'](function(_0x32f664){return _0x32f664;});}return null;};}function removeEntity(_0x13c170,_0x12e6c2){return function(_0x38aa77){if(_0x38aa77){return _0x38aa77[_0x7ff9('0x2a')]()[_0x7ff9('0x2b')](function(){var _0x16a195=_0x38aa77[_0x7ff9('0x2c')]({'plain':!![]});var _0x1078cc=_0x7ff9('0x2d');return db[_0x7ff9('0x2e')][_0x7ff9('0x2a')]({'where':{'type':_0x1078cc,'resourceId':_0x16a195['id']}})[_0x7ff9('0x2b')](function(){return _0x38aa77;});})[_0x7ff9('0x2b')](function(){_0x13c170['status'](0xcc)[_0x7ff9('0x20')]();});}};}function handleEntityNotFound(_0x413bb7,_0x118a4f){return function(_0x3f1251){if(!_0x3f1251){_0x413bb7[_0x7ff9('0x2f')](0x194);}return _0x3f1251;};}function handleError(_0x5cb0c4,_0x59159d){_0x59159d=_0x59159d||0x1f4;return function(_0x4c565b){logger[_0x7ff9('0x30')](_0x4c565b[_0x7ff9('0x31')]);if(_0x4c565b['name']){delete _0x4c565b['name'];}_0x5cb0c4['status'](_0x59159d)[_0x7ff9('0x32')](_0x4c565b);};}exports['index']=function(_0x2b76a7,_0x4a3ad6){var _0x4ee879={},_0x46bb18={},_0x286489={'count':0x0,'rows':[]};var _0x286034=_[_0x7ff9('0x33')](db[_0x7ff9('0x34')][_0x7ff9('0x35')],function(_0xd9effc){return{'name':_0xd9effc[_0x7ff9('0x36')],'type':_0xd9effc[_0x7ff9('0x37')]['key']};});_0x46bb18[_0x7ff9('0x38')]=_[_0x7ff9('0x33')](_0x286034,'name');_0x46bb18[_0x7ff9('0x39')]=_[_0x7ff9('0x3a')](_0x2b76a7[_0x7ff9('0x39')]);_0x46bb18[_0x7ff9('0x3b')]=_['intersection'](_0x46bb18[_0x7ff9('0x38')],_0x46bb18[_0x7ff9('0x39')]);_0x4ee879[_0x7ff9('0x3c')]=_[_0x7ff9('0x3d')](_0x46bb18[_0x7ff9('0x38')],qs[_0x7ff9('0x3e')](_0x2b76a7['query'][_0x7ff9('0x3e')]));_0x4ee879[_0x7ff9('0x3c')]=_0x4ee879[_0x7ff9('0x3c')][_0x7ff9('0x3f')]?_0x4ee879[_0x7ff9('0x3c')]:_0x46bb18[_0x7ff9('0x38')];if(!_0x2b76a7[_0x7ff9('0x39')]['hasOwnProperty'](_0x7ff9('0x40'))){_0x4ee879[_0x7ff9('0x23')]=qs[_0x7ff9('0x23')](_0x2b76a7['query'][_0x7ff9('0x23')]);_0x4ee879['offset']=qs[_0x7ff9('0x21')](_0x2b76a7[_0x7ff9('0x39')]['offset']);}_0x4ee879[_0x7ff9('0x41')]=qs[_0x7ff9('0x42')](_0x2b76a7[_0x7ff9('0x39')][_0x7ff9('0x42')]);_0x4ee879['where']=qs['filters'](_['pick'](_0x2b76a7[_0x7ff9('0x39')],_0x46bb18[_0x7ff9('0x3b')]),_0x286034);if(_0x2b76a7['query'][_0x7ff9('0x43')]){_0x4ee879[_0x7ff9('0x44')]=_['merge'](_0x4ee879['where'],{'$or':_[_0x7ff9('0x33')](_0x286034,function(_0x1672d2){if(_0x1672d2[_0x7ff9('0x37')]!==_0x7ff9('0x45')){var _0x43d0d1={};_0x43d0d1[_0x1672d2[_0x7ff9('0x46')]]={'$like':'%'+_0x2b76a7[_0x7ff9('0x39')][_0x7ff9('0x43')]+'%'};return _0x43d0d1;}})});}_0x4ee879=_[_0x7ff9('0x47')]({},_0x4ee879,_0x2b76a7['options']);var _0x33d66f={'where':_0x4ee879['where']};return db[_0x7ff9('0x34')][_0x7ff9('0x24')](_0x33d66f)[_0x7ff9('0x2b')](function(_0x55308e){_0x286489['count']=_0x55308e;if(_0x2b76a7['query']['includeAll']){_0x4ee879[_0x7ff9('0x48')]=[{'all':!![]}];}return db['Plugin'][_0x7ff9('0x49')](_0x4ee879);})[_0x7ff9('0x2b')](function(_0x3db48e){_0x286489[_0x7ff9('0x4a')]=_0x3db48e;return _0x286489;})[_0x7ff9('0x2b')](respondWithFilteredResult(_0x4a3ad6,_0x4ee879))['catch'](handleError(_0x4a3ad6,null));};exports[_0x7ff9('0x4b')]=function(_0x53b213,_0x1979b6){var _0x390abb={'raw':!![],'where':{'id':_0x53b213[_0x7ff9('0x4c')]['id']}},_0x5212f6={};_0x5212f6[_0x7ff9('0x38')]=_[_0x7ff9('0x3a')](db[_0x7ff9('0x34')][_0x7ff9('0x35')]);_0x5212f6[_0x7ff9('0x39')]=_[_0x7ff9('0x3a')](_0x53b213['query']);_0x5212f6[_0x7ff9('0x3b')]=_['intersection'](_0x5212f6[_0x7ff9('0x38')],_0x5212f6[_0x7ff9('0x39')]);_0x390abb[_0x7ff9('0x3c')]=_[_0x7ff9('0x3d')](_0x5212f6[_0x7ff9('0x38')],qs['fields'](_0x53b213['query'][_0x7ff9('0x3e')]));_0x390abb[_0x7ff9('0x3c')]=_0x390abb[_0x7ff9('0x3c')][_0x7ff9('0x3f')]?_0x390abb[_0x7ff9('0x3c')]:_0x5212f6[_0x7ff9('0x38')];if(_0x53b213[_0x7ff9('0x39')]['includeAll']){_0x390abb[_0x7ff9('0x48')]=[{'all':!![]}];}_0x390abb=_['merge']({},_0x390abb,_0x53b213[_0x7ff9('0x4d')]);return db['Plugin']['find'](_0x390abb)[_0x7ff9('0x2b')](handleEntityNotFound(_0x1979b6,null))['then'](respondWithResult(_0x1979b6,null))[_0x7ff9('0x4e')](handleError(_0x1979b6,null));};exports[_0x7ff9('0x4f')]=function(_0x20497a,_0x218990,_0x2fbbb0){return db[_0x7ff9('0x34')]['find']({'where':{'id':_0x20497a['params']['id']},'attributes':['name','path'],'raw':!![]})[_0x7ff9('0x2b')](handleEntityNotFound(_0x218990,null))[_0x7ff9('0x2b')](function(_0x4c3000){if(_0x4c3000){var _0x49683a=path[_0x7ff9('0x50')](config[_0x7ff9('0x51')],_0x7ff9('0x52'),util['format'](_0x7ff9('0x53'),path[_0x7ff9('0x54')](_0x4c3000['path'])));var _0x33a4cd=fs[_0x7ff9('0x55')](_0x49683a);var _0x3b911d=archiver('zip',{'zlib':{'level':0x9}});_0x3b911d['on'](_0x7ff9('0x56'),function(_0x8cbfd1){if(_0x8cbfd1['code']===_0x7ff9('0x57')){logger[_0x7ff9('0x30')](_0x8cbfd1);}else{throw new db['Sequelize'][(_0x7ff9('0x58'))](_0x7ff9('0x59'));}});_0x3b911d['on'](_0x7ff9('0x30'),function(_0x4cc471){throw new db['Sequelize']['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x3b911d[_0x7ff9('0x5a')](_0x33a4cd);_0x3b911d[_0x7ff9('0x5b')](_0x7ff9('0x5c'),{'cwd':path[_0x7ff9('0x50')](config['root'],_0x7ff9('0x52'),path[_0x7ff9('0x5d')](_0x4c3000[_0x7ff9('0x5e')])),'ignore':[path[_0x7ff9('0x50')](path[_0x7ff9('0x54')](_0x4c3000['path']),_0x7ff9('0x5f')),path['join'](path[_0x7ff9('0x54')](_0x4c3000[_0x7ff9('0x5e')]),_0x7ff9('0x60'))],'nodir':!![]})[_0x7ff9('0x61')]();_0x33a4cd['on'](_0x7ff9('0x62'),function(){if(!fs[_0x7ff9('0x63')](_0x49683a)){throw new db['Sequelize'][(_0x7ff9('0x58'))]('Plugin\x20not\x20found');}return _0x218990[_0x7ff9('0x4f')](_0x49683a,util[_0x7ff9('0x64')](_0x7ff9('0x53'),path[_0x7ff9('0x54')](_0x4c3000['path'])),function(_0xa1c346){if(_0xa1c346){throw new db[(_0x7ff9('0x65'))]['Error'](_0x7ff9('0x66'));}fs[_0x7ff9('0x67')](_0x49683a);logger[_0x7ff9('0x68')]('Download\x20completed');logger[_0x7ff9('0x68')](_0x7ff9('0x69'));});});}return null;})['catch'](handleError(_0x218990,null));};exports[_0x7ff9('0x6a')]=function(_0x28f596,_0x50137b,_0x332f6c){var _0x3cd889=path['basename'](_0x28f596[_0x7ff9('0x6b')][_0x7ff9('0x6c')],path[_0x7ff9('0x6d')](_0x28f596['file'][_0x7ff9('0x6c')]));var _0x46fe6b=path[_0x7ff9('0x50')](config['root'],_0x7ff9('0x52'),_0x28f596[_0x7ff9('0x6b')][_0x7ff9('0x6c')]);var _0x47d968=path[_0x7ff9('0x50')](config[_0x7ff9('0x51')],_0x7ff9('0x52'),_0x3cd889);logger[_0x7ff9('0x68')](_0x7ff9('0x6e'),_0x46fe6b);logger['info'](_0x7ff9('0x6f'),_0x47d968);try{fs['chmodSync'](_0x46fe6b,parseInt(_0x7ff9('0x70'),0x8));extract(_0x46fe6b,{'dir':_0x47d968},function(_0x1311bf){if(_0x1311bf){logger[_0x7ff9('0x30')](_0x1311bf);handleError(_0x1311bf,!![]);};var _0x1776e9=fs[_0x7ff9('0x71')](_0x47d968);if(_0x1776e9[_0x7ff9('0x3f')]>0x1){removeReferences(_0x46fe6b,_0x47d968);logger[_0x7ff9('0x30')](_0x7ff9('0x72'));return _0x332f6c(new Error(_0x7ff9('0x72')));}var _0x1b4875=fs[_0x7ff9('0x73')](path[_0x7ff9('0x50')](_0x47d968,_0x1776e9[0x0]));if(_0x1b4875[_0x7ff9('0x74')]()){removeReferences(_0x46fe6b,_0x47d968);logger[_0x7ff9('0x30')](_0x7ff9('0x72'));return _0x332f6c(new Error(_0x7ff9('0x72')));}if(_0x1b4875[_0x7ff9('0x75')]()){var _0x2342a3=fs[_0x7ff9('0x71')](path[_0x7ff9('0x50')](_0x47d968,_0x1776e9[0x0]));if(_0x2342a3['length']===0x0){removeReferences(_0x46fe6b,_0x47d968);logger[_0x7ff9('0x30')](_0x7ff9('0x72'));return _0x332f6c(new Error('Invalid\x20plugin\x20structure'));}var _0x12047c=_0x2342a3['some'](function(_0x1d23f4){return _0x1d23f4===_0x7ff9('0x76');});if(!_0x12047c){return _0x332f6c(new Error(_0x7ff9('0x77')));}var _0x9eb95f=fs[_0x7ff9('0x78')](path[_0x7ff9('0x50')](_0x47d968,_0x1776e9[0x0],_0x7ff9('0x76')));var _0x2e41a4=JSON[_0x7ff9('0x79')](_0x9eb95f);if(_0x7ff9('0x22')==typeof _0x2e41a4['name']){return _0x332f6c(new Error(_0x7ff9('0x7a')));}if('undefined'==typeof _0x2e41a4[_0x7ff9('0x37')]){return _0x332f6c(new Error(_0x7ff9('0x7b')));}if(_0x7ff9('0x22')==typeof _0x2e41a4[_0x7ff9('0x7c')]){return _0x332f6c(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x2e41a4[_0x7ff9('0x7d')]){return _0x332f6c(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x2e41a4[_0x7ff9('0x37')]==='html'){if(_0x7ff9('0x22')==typeof _0x2e41a4['parameters']['views']){return _0x332f6c(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x2e41a4['parameters'][_0x7ff9('0x7e')][_0x7ff9('0x7f')]&&_0x7ff9('0x22')==typeof _0x2e41a4['parameters'][_0x7ff9('0x7e')][_0x7ff9('0x80')]){return _0x332f6c(new Error(_0x7ff9('0x81')));}}else if(_0x2e41a4[_0x7ff9('0x37')]===_0x7ff9('0x82')){if('undefined'==typeof _0x2e41a4[_0x7ff9('0x7d')][_0x7ff9('0x83')]){return _0x332f6c(new Error(_0x7ff9('0x84')));}if('undefined'==typeof _0x2e41a4[_0x7ff9('0x7d')][_0x7ff9('0x85')]){return _0x332f6c(new Error(_0x7ff9('0x86')));}}else{return _0x332f6c(new Error(_0x7ff9('0x87')));}var _0x3924cf=_0x2e41a4[_0x7ff9('0x46')];var _0x45ba60=_0x2e41a4[_0x7ff9('0x88')];var _0xbf28f4=_0x2e41a4['type'];var _0x56d9ea=_0x2e41a4[_0x7ff9('0x89')]?_0x2e41a4[_0x7ff9('0x89')]:_0x7ff9('0x8a');var _0x233595=_0x2e41a4[_0x7ff9('0x8b')]?_0x2e41a4[_0x7ff9('0x8b')]:'icon-apps';var _0x169605='';var _0x201121='';var _0x3f38e3='';var _0x3bc8c5='';var _0x53f423=_0x2e41a4[_0x7ff9('0x7c')];if(_0xbf28f4==='html'){if(_0x7ff9('0x22')!=typeof _0x2e41a4[_0x7ff9('0x7d')]['views'][_0x7ff9('0x7f')]){var _0x6ee8c9=_0x2e41a4[_0x7ff9('0x7d')][_0x7ff9('0x7e')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x7ff9('0x8c')](_0x6ee8c9)){_0x169605=path[_0x7ff9('0x50')]('plugins',_0x3cd889,_0x1776e9[0x0],_0x6ee8c9);}else{_0x169605=_0x6ee8c9;}}else{logger[_0x7ff9('0x68')](_0x7ff9('0x8d'));}if('undefined'!=typeof _0x2e41a4[_0x7ff9('0x7d')][_0x7ff9('0x7e')][_0x7ff9('0x80')]){var _0x1bdead=_0x2e41a4[_0x7ff9('0x7d')][_0x7ff9('0x7e')][_0x7ff9('0x80')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1bdead)){_0x201121=path['join']('plugins',_0x3cd889,_0x1776e9[0x0],_0x1bdead);}else{_0x201121=_0x1bdead;}}else{logger[_0x7ff9('0x68')](_0x7ff9('0x8e'));}}else if(_0xbf28f4===_0x7ff9('0x82')){_0x3f38e3=_0x2e41a4[_0x7ff9('0x7d')]['scriptName'];_0x3bc8c5=_0x2e41a4[_0x7ff9('0x7d')][_0x7ff9('0x85')];if(_0x7ff9('0x22')!=typeof _0x2e41a4[_0x7ff9('0x7d')][_0x7ff9('0x7e')]){if('undefined'!=typeof _0x2e41a4[_0x7ff9('0x7d')][_0x7ff9('0x7e')][_0x7ff9('0x7f')]){var _0x6ee8c9=_0x2e41a4[_0x7ff9('0x7d')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x6ee8c9)){_0x169605=path[_0x7ff9('0x50')](_0x7ff9('0x8f'),_0x3cd889,_0x1776e9[0x0],_0x6ee8c9);}else{_0x169605=_0x6ee8c9;}}if(_0x7ff9('0x22')!=typeof _0x2e41a4[_0x7ff9('0x7d')][_0x7ff9('0x7e')]['agent']){var _0x1bdead=_0x2e41a4[_0x7ff9('0x7d')]['views'][_0x7ff9('0x80')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1bdead)){_0x201121=path[_0x7ff9('0x50')](_0x7ff9('0x8f'),_0x3cd889,_0x1776e9[0x0],_0x1bdead);}else{_0x201121=_0x1bdead;}}}}var _0x1a0799={'name':_0x3924cf,'description':_0x45ba60,'path':path['join'](_0x3cd889,_0x1776e9[0x0]),'type':_0xbf28f4,'sidebar':_0x56d9ea,'icon':_0x233595,'adminUrl':_0x169605,'agentUrl':_0x201121,'scriptName':_0x3f38e3,'scriptPath':_0x3bc8c5,'version':_0x53f423};removeReferences(_0x46fe6b,null);return db[_0x7ff9('0x34')][_0x7ff9('0x90')](_0x1a0799)[_0x7ff9('0x2b')](function(_0x54b813){var _0x19a74d={'role':_0x28f596[_0x7ff9('0x91')][_0x7ff9('0x92')],'userProfileId':_0x28f596['body'][_0x7ff9('0x93')]};if(!_0x19a74d)throw new Error(_0x7ff9('0x94'));if(_0x19a74d[_0x7ff9('0x92')]==='user'){var _0x176621=_0x54b813[_0x7ff9('0x2c')]({'plain':!![]});return db[_0x7ff9('0x95')][_0x7ff9('0x96')]({'where':{'name':_0x7ff9('0x2d'),'userProfileId':_0x19a74d['userProfileId']},'raw':!![]})[_0x7ff9('0x2b')](function(_0x4a64a4){if(_0x4a64a4&&_0x4a64a4[_0x7ff9('0x97')]===0x0){return db['UserProfileResource'][_0x7ff9('0x90')]({'name':_0x176621[_0x7ff9('0x46')],'resourceId':_0x176621['id'],'type':_0x4a64a4[_0x7ff9('0x46')],'sectionId':_0x4a64a4['id']},{})['then'](function(){return _0x54b813;});}else{return _0x54b813;}})[_0x7ff9('0x4e')](function(_0x5bb755){logger[_0x7ff9('0x30')](_0x7ff9('0x98'),_0x5bb755);throw _0x5bb755;});}return _0x54b813;})[_0x7ff9('0x2b')](respondWithResult(_0x50137b,null))[_0x7ff9('0x4e')](handleError(_0x50137b,null));}});}catch(_0x24e5eb){_0x50137b[_0x7ff9('0x1f')](0x1f4)['send'](_0x24e5eb);}};function removeReferences(_0xbad019,_0x4ed04a){try{if(_0xbad019){fs[_0x7ff9('0x67')](_0xbad019);logger[_0x7ff9('0x68')]('Zip\x20archive\x20removed');}if(_0x4ed04a){rimraf(_0x4ed04a,function(){});logger[_0x7ff9('0x68')](_0x7ff9('0x99'));}}catch(_0x2230fd){logger['error'](_0x2230fd);}}exports['update']=function(_0x2b690a,_0x558ddb,_0x414522){return db[_0x7ff9('0x34')]['find']({'where':{'id':_0x2b690a[_0x7ff9('0x4c')]['id']}})[_0x7ff9('0x2b')](handleEntityNotFound(_0x558ddb,null))[_0x7ff9('0x2b')](saveUpdates(_0x2b690a[_0x7ff9('0x91')],null))[_0x7ff9('0x2b')](respondWithResult(_0x558ddb,null))[_0x7ff9('0x4e')](handleError(_0x558ddb,null));};exports[_0x7ff9('0x9a')]=function(_0x109033,_0xd6d1a7,_0xaf5253){return db['Plugin'][_0x7ff9('0x96')]({'where':{'id':_0x109033[_0x7ff9('0x4c')]['id']}})[_0x7ff9('0x2b')](function(_0x25108e){if(_0x25108e){return _0x25108e[_0x7ff9('0x2a')]();}})[_0x7ff9('0x2b')](function(_0x1b3e11){rimraf(path[_0x7ff9('0x50')](config[_0x7ff9('0x51')],_0x7ff9('0x52'),path['dirname'](_0x1b3e11[_0x7ff9('0x5e')])),function(){});return _0x1b3e11;})[_0x7ff9('0x2b')](handleEntityNotFound(_0xd6d1a7,null))[_0x7ff9('0x2b')](respondWithStatusCode(_0xd6d1a7,null))['catch'](handleError(_0xd6d1a7,null));};exports[_0x7ff9('0x9b')]=function(_0x1627c4,_0xac4661,_0x1dc695){return BPromise[_0x7ff9('0x9c')]()[_0x7ff9('0x2b')](function(){if(!_0x1627c4[_0x7ff9('0x39')]['path']){throw new Error(_0x7ff9('0x9d'));}if(!_0x1627c4[_0x7ff9('0x39')][_0x7ff9('0x9e')]){throw new Error(_0x7ff9('0x9f'));}var _0x568a43=_0x1627c4[_0x7ff9('0x39')][_0x7ff9('0xa0')]?_0x1627c4[_0x7ff9('0x39')][_0x7ff9('0xa0')]+':'+_0x1627c4[_0x7ff9('0x39')][_0x7ff9('0x9e')]:'http://localhost:'+_0x1627c4['query'][_0x7ff9('0x9e')];var _0x45d82e=_0x1627c4[_0x7ff9('0x39')][_0x7ff9('0x25')]?_0x1627c4[_0x7ff9('0x39')][_0x7ff9('0x25')]:!![];var _0x358d12=_0x1627c4[_0x7ff9('0x39')][_0x7ff9('0xa1')]?_0x1627c4[_0x7ff9('0x39')][_0x7ff9('0xa1')]:null;var _0x325e42={'method':_0x1627c4[_0x7ff9('0xa2')],'uri':util[_0x7ff9('0x64')](_0x7ff9('0xa3'),_0x568a43,_0x1627c4[_0x7ff9('0x39')]['path']),'json':_0x45d82e,'resolveWithFullResponse':!![],'encoding':_0x358d12,'qs':_0x1627c4[_0x7ff9('0x39')]};if(_0x1627c4[_0x7ff9('0xa4')]){_0x325e42['headers']=_0x1627c4[_0x7ff9('0xa4')];if(_0x325e42[_0x7ff9('0xa4')][_0x7ff9('0xa5')]){delete _0x325e42['headers'][_0x7ff9('0xa5')];}}if(_0x325e42[_0x7ff9('0xa4')]['content-type']){delete _0x325e42['headers']['content-type'];}return rp(_0x325e42);})[_0x7ff9('0x2b')](function(_0x43f943){if(_0x43f943){_0xac4661[_0x7ff9('0xa6')](_0x43f943['headers']);logger[_0x7ff9('0x68')](_0x43f943[_0x7ff9('0x91')]);if(_[_0x7ff9('0xa7')](_0x1627c4['query'][_0x7ff9('0x5e')],_0x7ff9('0x4f'))&&_0x43f943[_0x7ff9('0xa8')]==0x1f4){return _0xac4661[_0x7ff9('0x2f')](_0x43f943[_0x7ff9('0xa8')]);}else{return _0xac4661[_0x7ff9('0x1f')](_0x43f943[_0x7ff9('0xa8')])[_0x7ff9('0x32')](_0x43f943[_0x7ff9('0x91')]);}}else{return _0xac4661['sendStatus'](0xc8);}})[_0x7ff9('0x4e')](handleError(_0xac4661,null));};exports[_0x7ff9('0xa9')]=function(_0xf49f47,_0x3beea9,_0x1f2dd){return BPromise['resolve']()['then'](function(){if(!_0xf49f47[_0x7ff9('0x39')][_0x7ff9('0x5e')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0xf49f47['query'][_0x7ff9('0x9e')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x4d94d0=_0xf49f47[_0x7ff9('0x39')]['hostname']?_0xf49f47['query'][_0x7ff9('0xa0')]+':'+_0xf49f47[_0x7ff9('0x39')][_0x7ff9('0x9e')]:_0x7ff9('0xaa')+_0xf49f47[_0x7ff9('0x39')][_0x7ff9('0x9e')];var _0x1e76a5=_0xf49f47[_0x7ff9('0x39')]['json']?_0xf49f47[_0x7ff9('0x39')][_0x7ff9('0x25')]:!![];var _0x11dce6=_0xf49f47['query'][_0x7ff9('0xa1')]?_0xf49f47[_0x7ff9('0x39')][_0x7ff9('0xa1')]:null;var _0x372b29={'method':_0xf49f47[_0x7ff9('0xa2')],'uri':util['format']('%s%s',_0x4d94d0,_0xf49f47[_0x7ff9('0x39')]['path']),'json':_0x1e76a5,'resolveWithFullResponse':!![],'encoding':_0x11dce6,'body':_0xf49f47[_0x7ff9('0x91')]};if(_0xf49f47['headers']){_0x372b29[_0x7ff9('0xa4')]=_0xf49f47[_0x7ff9('0xa4')];if(_0x372b29[_0x7ff9('0xa4')]['content-length']){delete _0x372b29[_0x7ff9('0xa4')][_0x7ff9('0xa5')];}}if(_0x372b29[_0x7ff9('0xa4')][_0x7ff9('0xab')]){delete _0x372b29[_0x7ff9('0xa4')][_0x7ff9('0xab')];}return rp(_0x372b29);})[_0x7ff9('0x2b')](function(_0x1ff877){if(_0x1ff877){_0x3beea9[_0x7ff9('0xa6')](_0x1ff877['headers']);logger['info'](_0x1ff877[_0x7ff9('0x91')]);return _0x3beea9[_0x7ff9('0x1f')](_0x1ff877[_0x7ff9('0xa8')])[_0x7ff9('0x32')](_0x1ff877[_0x7ff9('0x91')]);}else{return _0x3beea9[_0x7ff9('0x2f')](0xc8);}})[_0x7ff9('0x4e')](handleError(_0x3beea9,null));}; \ No newline at end of file +var _0x6ab7=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','get','error','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','catch','show','params','keys','find','download','root','server/files/plugins','format','%s.zip','basename','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','**/*','join','dirname','node_modules/**/*','attachments/**/*','finalize','close','unlinkSync','upload','file','filename','info','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','Warning:\x20agent\x20view\x20not\x20specified','create','body','userProfileId','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','headers','content-length','content-type','endsWith','statusCode','webhookPost','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','rimraf','archiver','ioredis'];(function(_0x25d2fb,_0x18a774){var _0x1ded53=function(_0x4c0715){while(--_0x4c0715){_0x25d2fb['push'](_0x25d2fb['shift']());}};_0x1ded53(++_0x18a774);}(_0x6ab7,0x137));var _0x76ab=function(_0xf6f62d,_0x1b1084){_0xf6f62d=_0xf6f62d-0x0;var _0x2e5abc=_0x6ab7[_0xf6f62d];return _0x2e5abc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x76ab('0x0'));var jsonpatch=require(_0x76ab('0x1'));var rp=require(_0x76ab('0x2'));var moment=require('moment');var BPromise=require(_0x76ab('0x3'));var Mustache=require(_0x76ab('0x4'));var util=require('util');var path=require(_0x76ab('0x5'));var sox=require(_0x76ab('0x6'));var csv=require('to-csv');var ejs=require(_0x76ab('0x7'));var fs=require('fs');var fs_extra=require(_0x76ab('0x8'));var _=require(_0x76ab('0x9'));var squel=require(_0x76ab('0xa'));var crypto=require(_0x76ab('0xb'));var jsforce=require(_0x76ab('0xc'));var deskjs=require(_0x76ab('0xd'));var toCsv=require(_0x76ab('0xe'));var querystring=require(_0x76ab('0xf'));var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require(_0x76ab('0x10'));var archiver=require(_0x76ab('0x11'));var Redis=require(_0x76ab('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x76ab('0x13'));var as=require(_0x76ab('0x14'));var hardwareService=require(_0x76ab('0x15'));var logger=require(_0x76ab('0x16'))(_0x76ab('0x17'));var utils=require(_0x76ab('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x76ab('0x19'));var db=require(_0x76ab('0x1a'))['db'];config[_0x76ab('0x1b')]=_[_0x76ab('0x1c')](config['redis'],{'host':_0x76ab('0x1d'),'port':0x18eb});var socket=require(_0x76ab('0x1e'))(new Redis(config[_0x76ab('0x1b')]));require(_0x76ab('0x1f'))[_0x76ab('0x20')](socket);function respondWithStatusCode(_0xc99ed8,_0xb115c0){_0xb115c0=_0xb115c0||0xcc;return function(_0xbb07d4){if(_0xbb07d4){return _0xc99ed8[_0x76ab('0x21')](_0xb115c0);}return _0xc99ed8[_0x76ab('0x22')](_0xb115c0)[_0x76ab('0x23')]();};}function respondWithResult(_0xc7346d,_0x45d947){_0x45d947=_0x45d947||0xc8;return function(_0x127a61){if(_0x127a61){return _0xc7346d[_0x76ab('0x22')](_0x45d947)[_0x76ab('0x24')](_0x127a61);}};}function respondWithFilteredResult(_0x7de4bb,_0x331e44){return function(_0x2d67eb){if(_0x2d67eb){var _0x4ea22d=typeof _0x331e44[_0x76ab('0x25')]===_0x76ab('0x26')&&typeof _0x331e44[_0x76ab('0x27')]===_0x76ab('0x26');var _0x2c75cb=_0x2d67eb[_0x76ab('0x28')];var _0x54255f=_0x4ea22d?0x0:_0x331e44[_0x76ab('0x25')];var _0x36be86=_0x4ea22d?_0x2d67eb['count']:_0x331e44[_0x76ab('0x25')]+_0x331e44['limit'];var _0x32ef8a;if(_0x36be86>=_0x2c75cb){_0x36be86=_0x2c75cb;_0x32ef8a=0xc8;}else{_0x32ef8a=0xce;}_0x7de4bb[_0x76ab('0x22')](_0x32ef8a);return _0x7de4bb[_0x76ab('0x29')]('Content-Range',_0x54255f+'-'+_0x36be86+'/'+_0x2c75cb)[_0x76ab('0x24')](_0x2d67eb);}return null;};}function patchUpdates(_0xce9d0){return function(_0x5256bc){try{jsonpatch['apply'](_0x5256bc,_0xce9d0,!![]);}catch(_0x2754b3){return BPromise[_0x76ab('0x2a')](_0x2754b3);}return _0x5256bc[_0x76ab('0x2b')]();};}function saveUpdates(_0x4b3fde,_0x11fe1d){return function(_0xc8ed32){if(_0xc8ed32){return _0xc8ed32[_0x76ab('0x2c')](_0x4b3fde)[_0x76ab('0x2d')](function(_0xc18ca0){return _0xc18ca0;});}return null;};}function removeEntity(_0xc9da6,_0xa7a9c5){return function(_0x2efea4){if(_0x2efea4){return _0x2efea4[_0x76ab('0x2e')]()[_0x76ab('0x2d')](function(){var _0x3a07f7=_0x2efea4[_0x76ab('0x2f')]({'plain':!![]});var _0x1f62c4='Plugins';return db['UserProfileResource']['destroy']({'where':{'type':_0x1f62c4,'resourceId':_0x3a07f7['id']}})[_0x76ab('0x2d')](function(){return _0x2efea4;});})[_0x76ab('0x2d')](function(){_0xc9da6[_0x76ab('0x22')](0xcc)[_0x76ab('0x23')]();});}};}function handleEntityNotFound(_0x1bf25a,_0xf21f71){return function(_0x3883af){if(!_0x3883af){_0x1bf25a[_0x76ab('0x21')](0x194);}return _0x3883af;};}function handleError(_0x51e344,_0x5bc86f){_0x5bc86f=_0x5bc86f||0x1f4;return function(_0x140076){logger[_0x76ab('0x30')](_0x140076['stack']);if(_0x140076[_0x76ab('0x31')]){delete _0x140076[_0x76ab('0x31')];}_0x51e344['status'](_0x5bc86f)[_0x76ab('0x32')](_0x140076);};}exports[_0x76ab('0x33')]=function(_0x41a52d,_0x51c7dc){var _0x2e8900={},_0x8af5c9={},_0x3c3031={'count':0x0,'rows':[]};var _0x439a4e=_[_0x76ab('0x34')](db[_0x76ab('0x35')][_0x76ab('0x36')],function(_0x59771f){return{'name':_0x59771f[_0x76ab('0x37')],'type':_0x59771f[_0x76ab('0x38')][_0x76ab('0x39')]};});_0x8af5c9[_0x76ab('0x3a')]=_[_0x76ab('0x34')](_0x439a4e,_0x76ab('0x31'));_0x8af5c9[_0x76ab('0x3b')]=_['keys'](_0x41a52d[_0x76ab('0x3b')]);_0x8af5c9[_0x76ab('0x3c')]=_[_0x76ab('0x3d')](_0x8af5c9['model'],_0x8af5c9['query']);_0x2e8900['attributes']=_[_0x76ab('0x3d')](_0x8af5c9[_0x76ab('0x3a')],qs[_0x76ab('0x3e')](_0x41a52d[_0x76ab('0x3b')][_0x76ab('0x3e')]));_0x2e8900[_0x76ab('0x3f')]=_0x2e8900[_0x76ab('0x3f')]['length']?_0x2e8900[_0x76ab('0x3f')]:_0x8af5c9[_0x76ab('0x3a')];if(!_0x41a52d[_0x76ab('0x3b')][_0x76ab('0x40')](_0x76ab('0x41'))){_0x2e8900[_0x76ab('0x27')]=qs[_0x76ab('0x27')](_0x41a52d[_0x76ab('0x3b')][_0x76ab('0x27')]);_0x2e8900['offset']=qs[_0x76ab('0x25')](_0x41a52d['query'][_0x76ab('0x25')]);}_0x2e8900[_0x76ab('0x42')]=qs['sort'](_0x41a52d['query'][_0x76ab('0x43')]);_0x2e8900['where']=qs[_0x76ab('0x3c')](_[_0x76ab('0x44')](_0x41a52d[_0x76ab('0x3b')],_0x8af5c9['filters']),_0x439a4e);if(_0x41a52d[_0x76ab('0x3b')][_0x76ab('0x45')]){_0x2e8900[_0x76ab('0x46')]=_[_0x76ab('0x47')](_0x2e8900[_0x76ab('0x46')],{'$or':_['map'](_0x439a4e,function(_0x2b7c71){if(_0x2b7c71['type']!==_0x76ab('0x48')){var _0x50d308={};_0x50d308[_0x2b7c71['name']]={'$like':'%'+_0x41a52d['query'][_0x76ab('0x45')]+'%'};return _0x50d308;}})});}_0x2e8900=_[_0x76ab('0x47')]({},_0x2e8900,_0x41a52d[_0x76ab('0x49')]);var _0x5606f6={'where':_0x2e8900[_0x76ab('0x46')]};return db['Plugin'][_0x76ab('0x28')](_0x5606f6)[_0x76ab('0x2d')](function(_0x3ec1de){_0x3c3031[_0x76ab('0x28')]=_0x3ec1de;if(_0x41a52d[_0x76ab('0x3b')][_0x76ab('0x4a')]){_0x2e8900[_0x76ab('0x4b')]=[{'all':!![]}];}return db[_0x76ab('0x35')]['findAll'](_0x2e8900);})[_0x76ab('0x2d')](function(_0x469fb6){_0x3c3031['rows']=_0x469fb6;return _0x3c3031;})[_0x76ab('0x2d')](respondWithFilteredResult(_0x51c7dc,_0x2e8900))[_0x76ab('0x4c')](handleError(_0x51c7dc,null));};exports[_0x76ab('0x4d')]=function(_0x38bb6e,_0x41b16c){var _0x3d4e52={'raw':!![],'where':{'id':_0x38bb6e[_0x76ab('0x4e')]['id']}},_0x564ee3={};_0x564ee3[_0x76ab('0x3a')]=_[_0x76ab('0x4f')](db['Plugin']['rawAttributes']);_0x564ee3[_0x76ab('0x3b')]=_[_0x76ab('0x4f')](_0x38bb6e['query']);_0x564ee3[_0x76ab('0x3c')]=_[_0x76ab('0x3d')](_0x564ee3['model'],_0x564ee3['query']);_0x3d4e52[_0x76ab('0x3f')]=_[_0x76ab('0x3d')](_0x564ee3[_0x76ab('0x3a')],qs['fields'](_0x38bb6e[_0x76ab('0x3b')][_0x76ab('0x3e')]));_0x3d4e52[_0x76ab('0x3f')]=_0x3d4e52[_0x76ab('0x3f')]['length']?_0x3d4e52[_0x76ab('0x3f')]:_0x564ee3['model'];if(_0x38bb6e[_0x76ab('0x3b')]['includeAll']){_0x3d4e52[_0x76ab('0x4b')]=[{'all':!![]}];}_0x3d4e52=_[_0x76ab('0x47')]({},_0x3d4e52,_0x38bb6e['options']);return db[_0x76ab('0x35')][_0x76ab('0x50')](_0x3d4e52)[_0x76ab('0x2d')](handleEntityNotFound(_0x41b16c,null))['then'](respondWithResult(_0x41b16c,null))['catch'](handleError(_0x41b16c,null));};exports[_0x76ab('0x51')]=function(_0x568905,_0x30c9e6,_0x546fcd){return db[_0x76ab('0x35')][_0x76ab('0x50')]({'where':{'id':_0x568905[_0x76ab('0x4e')]['id']},'attributes':[_0x76ab('0x31'),_0x76ab('0x5')],'raw':!![]})[_0x76ab('0x2d')](handleEntityNotFound(_0x30c9e6,null))['then'](function(_0x2d6c6e){if(_0x2d6c6e){var _0xeb905d=path['join'](config[_0x76ab('0x52')],_0x76ab('0x53'),util[_0x76ab('0x54')](_0x76ab('0x55'),path[_0x76ab('0x56')](_0x2d6c6e[_0x76ab('0x5')])));var _0xdc51e=fs['createWriteStream'](_0xeb905d);var _0x2ac036=archiver('zip',{'zlib':{'level':0x9}});_0x2ac036['on'](_0x76ab('0x57'),function(_0x529a7d){if(_0x529a7d[_0x76ab('0x58')]===_0x76ab('0x59')){logger[_0x76ab('0x30')](_0x529a7d);}else{throw new db[(_0x76ab('0x5a'))][(_0x76ab('0x5b'))](_0x76ab('0x5c'));}});_0x2ac036['on'](_0x76ab('0x30'),function(_0x4e6641){throw new db[(_0x76ab('0x5a'))][(_0x76ab('0x5b'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x2ac036['pipe'](_0xdc51e);_0x2ac036['glob'](_0x76ab('0x5d'),{'cwd':path[_0x76ab('0x5e')](config[_0x76ab('0x52')],_0x76ab('0x53'),path[_0x76ab('0x5f')](_0x2d6c6e[_0x76ab('0x5')])),'ignore':[path[_0x76ab('0x5e')](path[_0x76ab('0x56')](_0x2d6c6e['path']),_0x76ab('0x60')),path[_0x76ab('0x5e')](path[_0x76ab('0x56')](_0x2d6c6e[_0x76ab('0x5')]),_0x76ab('0x61'))],'nodir':!![]})[_0x76ab('0x62')]();_0xdc51e['on'](_0x76ab('0x63'),function(){if(!fs['existsSync'](_0xeb905d)){throw new db[(_0x76ab('0x5a'))]['Error']('Plugin\x20not\x20found');}return _0x30c9e6[_0x76ab('0x51')](_0xeb905d,util[_0x76ab('0x54')]('%s.zip',path[_0x76ab('0x56')](_0x2d6c6e['path'])),function(_0x57236d){if(_0x57236d){throw new db[(_0x76ab('0x5a'))][(_0x76ab('0x5b'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x76ab('0x64')](_0xeb905d);logger['info']('Download\x20completed');logger['info']('Temporary\x20file\x20removed');});});}return null;})[_0x76ab('0x4c')](handleError(_0x30c9e6,null));};exports[_0x76ab('0x65')]=function(_0x1e6cb2,_0x186b90,_0x4c57b6){var _0x5eee17=path[_0x76ab('0x56')](_0x1e6cb2[_0x76ab('0x66')]['filename'],path['extname'](_0x1e6cb2[_0x76ab('0x66')][_0x76ab('0x67')]));var _0x353696=path[_0x76ab('0x5e')](config['root'],'server/files/plugins',_0x1e6cb2['file'][_0x76ab('0x67')]);var _0x12f76a=path[_0x76ab('0x5e')](config[_0x76ab('0x52')],_0x76ab('0x53'),_0x5eee17);logger[_0x76ab('0x68')](_0x76ab('0x69'),_0x353696);logger[_0x76ab('0x68')](_0x76ab('0x6a'),_0x12f76a);try{fs[_0x76ab('0x6b')](_0x353696,parseInt(_0x76ab('0x6c'),0x8));extract(_0x353696,{'dir':_0x12f76a},function(_0xf69ce0){if(_0xf69ce0){logger['error'](_0xf69ce0);handleError(_0xf69ce0,!![]);};var _0x3f05e9=fs[_0x76ab('0x6d')](_0x12f76a);if(_0x3f05e9['length']>0x1){removeReferences(_0x353696,_0x12f76a);logger['error'](_0x76ab('0x6e'));return _0x4c57b6(new Error(_0x76ab('0x6e')));}var _0x486035=fs['lstatSync'](path['join'](_0x12f76a,_0x3f05e9[0x0]));if(_0x486035[_0x76ab('0x6f')]()){removeReferences(_0x353696,_0x12f76a);logger[_0x76ab('0x30')](_0x76ab('0x6e'));return _0x4c57b6(new Error(_0x76ab('0x6e')));}if(_0x486035[_0x76ab('0x70')]()){var _0x4d8d45=fs[_0x76ab('0x6d')](path[_0x76ab('0x5e')](_0x12f76a,_0x3f05e9[0x0]));if(_0x4d8d45['length']===0x0){removeReferences(_0x353696,_0x12f76a);logger['error'](_0x76ab('0x6e'));return _0x4c57b6(new Error(_0x76ab('0x6e')));}var _0x6ea6d8=_0x4d8d45['some'](function(_0x44d367){return _0x44d367==='manifest.json';});if(!_0x6ea6d8){return _0x4c57b6(new Error('Plugin\x20manifest\x20missing'));}var _0x483d61=fs[_0x76ab('0x71')](path[_0x76ab('0x5e')](_0x12f76a,_0x3f05e9[0x0],'manifest.json'));var _0x589167=JSON[_0x76ab('0x72')](_0x483d61);if(_0x76ab('0x26')==typeof _0x589167[_0x76ab('0x31')]){return _0x4c57b6(new Error(_0x76ab('0x73')));}if(_0x76ab('0x26')==typeof _0x589167[_0x76ab('0x38')]){return _0x4c57b6(new Error(_0x76ab('0x74')));}if('undefined'==typeof _0x589167[_0x76ab('0x75')]){return _0x4c57b6(new Error(_0x76ab('0x76')));}if(_0x76ab('0x26')==typeof _0x589167[_0x76ab('0x77')]){return _0x4c57b6(new Error(_0x76ab('0x78')));}if(_0x589167[_0x76ab('0x38')]===_0x76ab('0x79')){if(_0x76ab('0x26')==typeof _0x589167[_0x76ab('0x77')][_0x76ab('0x7a')]){return _0x4c57b6(new Error(_0x76ab('0x7b')));}if(_0x76ab('0x26')==typeof _0x589167[_0x76ab('0x77')]['views'][_0x76ab('0x7c')]&&'undefined'==typeof _0x589167[_0x76ab('0x77')]['views'][_0x76ab('0x7d')]){return _0x4c57b6(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x589167[_0x76ab('0x38')]===_0x76ab('0x7e')){if(_0x76ab('0x26')==typeof _0x589167['parameters'][_0x76ab('0x7f')]){return _0x4c57b6(new Error(_0x76ab('0x80')));}if(_0x76ab('0x26')==typeof _0x589167['parameters'][_0x76ab('0x81')]){return _0x4c57b6(new Error(_0x76ab('0x82')));}}else{return _0x4c57b6(new Error(_0x76ab('0x83')));}var _0x38d30b=_0x589167[_0x76ab('0x31')];var _0x3185ab=_0x589167[_0x76ab('0x84')];var _0x250b1b=_0x589167['type'];var _0x2779c8=_0x589167[_0x76ab('0x85')]?_0x589167[_0x76ab('0x85')]:_0x76ab('0x86');var _0x487de6=_0x589167[_0x76ab('0x87')]?_0x589167['icon']:'icon-apps';var _0x349049='';var _0x1d4838='';var _0x1cc60a='';var _0x44cc95='';var _0x1fe449=_0x589167[_0x76ab('0x75')];if(_0x250b1b===_0x76ab('0x79')){if(_0x76ab('0x26')!=typeof _0x589167[_0x76ab('0x77')]['views']['admin']){var _0x1ad056=_0x589167['parameters'][_0x76ab('0x7a')][_0x76ab('0x7c')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1ad056)){_0x349049=path['join'](_0x76ab('0x88'),_0x5eee17,_0x3f05e9[0x0],_0x1ad056);}else{_0x349049=_0x1ad056;}}else{logger[_0x76ab('0x68')](_0x76ab('0x89'));}if(_0x76ab('0x26')!=typeof _0x589167['parameters'][_0x76ab('0x7a')][_0x76ab('0x7d')]){var _0x3f171d=_0x589167[_0x76ab('0x77')][_0x76ab('0x7a')][_0x76ab('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x76ab('0x8a')](_0x3f171d)){_0x1d4838=path[_0x76ab('0x5e')]('plugins',_0x5eee17,_0x3f05e9[0x0],_0x3f171d);}else{_0x1d4838=_0x3f171d;}}else{logger['info'](_0x76ab('0x8b'));}}else if(_0x250b1b===_0x76ab('0x7e')){_0x1cc60a=_0x589167['parameters'][_0x76ab('0x7f')];_0x44cc95=_0x589167['parameters']['scriptPath'];if(_0x76ab('0x26')!=typeof _0x589167[_0x76ab('0x77')]['views']){if(_0x76ab('0x26')!=typeof _0x589167[_0x76ab('0x77')][_0x76ab('0x7a')][_0x76ab('0x7c')]){var _0x1ad056=_0x589167[_0x76ab('0x77')][_0x76ab('0x7a')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x76ab('0x8a')](_0x1ad056)){_0x349049=path['join']('plugins',_0x5eee17,_0x3f05e9[0x0],_0x1ad056);}else{_0x349049=_0x1ad056;}}if(_0x76ab('0x26')!=typeof _0x589167[_0x76ab('0x77')]['views'][_0x76ab('0x7d')]){var _0x3f171d=_0x589167['parameters']['views'][_0x76ab('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x76ab('0x8a')](_0x3f171d)){_0x1d4838=path[_0x76ab('0x5e')](_0x76ab('0x88'),_0x5eee17,_0x3f05e9[0x0],_0x3f171d);}else{_0x1d4838=_0x3f171d;}}}}var _0x580b9e={'name':_0x38d30b,'description':_0x3185ab,'path':path[_0x76ab('0x5e')](_0x5eee17,_0x3f05e9[0x0]),'type':_0x250b1b,'sidebar':_0x2779c8,'icon':_0x487de6,'adminUrl':_0x349049,'agentUrl':_0x1d4838,'scriptName':_0x1cc60a,'scriptPath':_0x44cc95,'version':_0x1fe449};removeReferences(_0x353696,null);return db[_0x76ab('0x35')][_0x76ab('0x8c')](_0x580b9e)[_0x76ab('0x2d')](function(_0x10a536){var _0x223485={'role':_0x1e6cb2[_0x76ab('0x8d')]['role'],'userProfileId':_0x1e6cb2[_0x76ab('0x8d')][_0x76ab('0x8e')]};if(!_0x223485)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x223485[_0x76ab('0x8f')]===_0x76ab('0x90')){var _0x3bc92e=_0x10a536[_0x76ab('0x2f')]({'plain':!![]});return db[_0x76ab('0x91')][_0x76ab('0x50')]({'where':{'name':'Plugins','userProfileId':_0x223485[_0x76ab('0x8e')]},'raw':!![]})['then'](function(_0x1f376b){if(_0x1f376b&&_0x1f376b[_0x76ab('0x92')]===0x0){return db[_0x76ab('0x93')][_0x76ab('0x8c')]({'name':_0x3bc92e[_0x76ab('0x31')],'resourceId':_0x3bc92e['id'],'type':_0x1f376b[_0x76ab('0x31')],'sectionId':_0x1f376b['id']},{})[_0x76ab('0x2d')](function(){return _0x10a536;});}else{return _0x10a536;}})[_0x76ab('0x4c')](function(_0x46ad60){logger[_0x76ab('0x30')](_0x76ab('0x94'),_0x46ad60);throw _0x46ad60;});}return _0x10a536;})[_0x76ab('0x2d')](respondWithResult(_0x186b90,null))['catch'](handleError(_0x186b90,null));}});}catch(_0x39c443){_0x186b90['status'](0x1f4)[_0x76ab('0x32')](_0x39c443);}};function removeReferences(_0x3fbf3c,_0x4b41d3){try{if(_0x3fbf3c){fs['unlinkSync'](_0x3fbf3c);logger[_0x76ab('0x68')](_0x76ab('0x95'));}if(_0x4b41d3){rimraf(_0x4b41d3,function(){});logger[_0x76ab('0x68')]('Extracted\x20folder\x20removed');}}catch(_0x47b561){logger['error'](_0x47b561);}}exports[_0x76ab('0x2c')]=function(_0x2aace0,_0x5e9c1b,_0x4e839f){return db[_0x76ab('0x35')][_0x76ab('0x50')]({'where':{'id':_0x2aace0['params']['id']}})[_0x76ab('0x2d')](handleEntityNotFound(_0x5e9c1b,null))['then'](saveUpdates(_0x2aace0['body'],null))[_0x76ab('0x2d')](respondWithResult(_0x5e9c1b,null))[_0x76ab('0x4c')](handleError(_0x5e9c1b,null));};exports['delete']=function(_0x4da9da,_0x2a61b0,_0x3aee8a){return db['Plugin']['find']({'where':{'id':_0x4da9da[_0x76ab('0x4e')]['id']}})[_0x76ab('0x2d')](function(_0x4da750){if(_0x4da750){return _0x4da750['destroy']();}})[_0x76ab('0x2d')](function(_0x15d851){rimraf(path[_0x76ab('0x5e')](config[_0x76ab('0x52')],_0x76ab('0x53'),path[_0x76ab('0x5f')](_0x15d851[_0x76ab('0x5')])),function(){});return _0x15d851;})[_0x76ab('0x2d')](handleEntityNotFound(_0x2a61b0,null))[_0x76ab('0x2d')](respondWithStatusCode(_0x2a61b0,null))[_0x76ab('0x4c')](handleError(_0x2a61b0,null));};exports[_0x76ab('0x96')]=function(_0x518cf6,_0x33de49,_0x2f43ab){return BPromise[_0x76ab('0x97')]()[_0x76ab('0x2d')](function(){if(!_0x518cf6[_0x76ab('0x3b')][_0x76ab('0x5')]){throw new Error(_0x76ab('0x98'));}if(!_0x518cf6['query']['port']){throw new Error(_0x76ab('0x99'));}var _0x317f87=_0x518cf6[_0x76ab('0x3b')][_0x76ab('0x9a')]?_0x518cf6[_0x76ab('0x3b')][_0x76ab('0x9a')]+':'+_0x518cf6[_0x76ab('0x3b')][_0x76ab('0x9b')]:_0x76ab('0x9c')+_0x518cf6[_0x76ab('0x3b')]['port'];var _0x51483e=_0x518cf6[_0x76ab('0x3b')][_0x76ab('0x24')]?_0x518cf6[_0x76ab('0x3b')][_0x76ab('0x24')]:!![];var _0x51fafd=_0x518cf6['query'][_0x76ab('0x9d')]?_0x518cf6[_0x76ab('0x3b')][_0x76ab('0x9d')]:null;var _0x1278ad={'method':_0x518cf6[_0x76ab('0x9e')],'uri':util[_0x76ab('0x54')]('%s%s',_0x317f87,_0x518cf6[_0x76ab('0x3b')]['path']),'json':_0x51483e,'resolveWithFullResponse':!![],'encoding':_0x51fafd,'qs':_0x518cf6['query']};if(_0x518cf6[_0x76ab('0x9f')]){_0x1278ad[_0x76ab('0x9f')]=_0x518cf6[_0x76ab('0x9f')];if(_0x1278ad[_0x76ab('0x9f')]['content-length']){delete _0x1278ad[_0x76ab('0x9f')][_0x76ab('0xa0')];}}if(_0x1278ad[_0x76ab('0x9f')][_0x76ab('0xa1')]){delete _0x1278ad['headers'][_0x76ab('0xa1')];}return rp(_0x1278ad);})['then'](function(_0x73b84e){if(_0x73b84e){_0x33de49['set'](_0x73b84e[_0x76ab('0x9f')]);logger['info'](_0x73b84e[_0x76ab('0x8d')]);if(_[_0x76ab('0xa2')](_0x518cf6['query']['path'],'download')&&_0x73b84e[_0x76ab('0xa3')]==0x1f4){return _0x33de49['sendStatus'](_0x73b84e[_0x76ab('0xa3')]);}else{return _0x33de49[_0x76ab('0x22')](_0x73b84e[_0x76ab('0xa3')])['send'](_0x73b84e['body']);}}else{return _0x33de49[_0x76ab('0x21')](0xc8);}})['catch'](handleError(_0x33de49,null));};exports[_0x76ab('0xa4')]=function(_0x72dcad,_0x44e21f,_0xb9177e){return BPromise[_0x76ab('0x97')]()[_0x76ab('0x2d')](function(){if(!_0x72dcad[_0x76ab('0x3b')]['path']){throw new Error(_0x76ab('0x98'));}if(!_0x72dcad['query'][_0x76ab('0x9b')]){throw new Error(_0x76ab('0x99'));}var _0x7710cf=_0x72dcad[_0x76ab('0x3b')]['hostname']?_0x72dcad['query'][_0x76ab('0x9a')]+':'+_0x72dcad[_0x76ab('0x3b')][_0x76ab('0x9b')]:_0x76ab('0x9c')+_0x72dcad['query'][_0x76ab('0x9b')];var _0x1a9251=_0x72dcad['query'][_0x76ab('0x24')]?_0x72dcad['query']['json']:!![];var _0x4461e9=_0x72dcad[_0x76ab('0x3b')][_0x76ab('0x9d')]?_0x72dcad[_0x76ab('0x3b')]['encoding']:null;var _0x39c467={'method':_0x72dcad[_0x76ab('0x9e')],'uri':util[_0x76ab('0x54')]('%s%s',_0x7710cf,_0x72dcad[_0x76ab('0x3b')]['path']),'json':_0x1a9251,'resolveWithFullResponse':!![],'encoding':_0x4461e9,'body':_0x72dcad[_0x76ab('0x8d')]};if(_0x72dcad[_0x76ab('0x9f')]){_0x39c467[_0x76ab('0x9f')]=_0x72dcad[_0x76ab('0x9f')];if(_0x39c467[_0x76ab('0x9f')]['content-length']){delete _0x39c467[_0x76ab('0x9f')][_0x76ab('0xa0')];}}if(_0x39c467[_0x76ab('0x9f')][_0x76ab('0xa1')]){delete _0x39c467[_0x76ab('0x9f')][_0x76ab('0xa1')];}return rp(_0x39c467);})[_0x76ab('0x2d')](function(_0x1ff6d7){if(_0x1ff6d7){_0x44e21f[_0x76ab('0x29')](_0x1ff6d7[_0x76ab('0x9f')]);logger[_0x76ab('0x68')](_0x1ff6d7[_0x76ab('0x8d')]);return _0x44e21f[_0x76ab('0x22')](_0x1ff6d7[_0x76ab('0xa3')])[_0x76ab('0x32')](_0x1ff6d7[_0x76ab('0x8d')]);}else{return _0x44e21f[_0x76ab('0x21')](0xc8);}})[_0x76ab('0x4c')](handleError(_0x44e21f,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 81d9e3d..73224ab 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 _0x573a=['update','remove','emit','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x5e9ae3,_0x4ecd9e){var _0x25b35c=function(_0x4adbe1){while(--_0x4adbe1){_0x5e9ae3['push'](_0x5e9ae3['shift']());}};_0x25b35c(++_0x4ecd9e);}(_0x573a,0x124));var _0xa573=function(_0x4f0e62,_0x28e44f){_0x4f0e62=_0x4f0e62-0x0;var _0x117ab8=_0x573a[_0x4f0e62];return _0x117ab8;};'use strict';var EventEmitter=require(_0xa573('0x0'));var Plugin=require(_0xa573('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0xa573('0x2')](0x0);var events={'afterCreate':_0xa573('0x3'),'afterUpdate':_0xa573('0x4'),'afterDestroy':_0xa573('0x5')};function emitEvent(_0x19bca6){return function(_0x59a1d5,_0x41fbd3,_0x4b7f7c){PluginEvents[_0xa573('0x6')](_0x19bca6+':'+_0x59a1d5['id'],_0x59a1d5);PluginEvents[_0xa573('0x6')](_0x19bca6,_0x59a1d5);_0x4b7f7c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xa573('0x7')]=PluginEvents; \ No newline at end of file +var _0xcfcb=['hook','exports','events','save','update','remove','emit','hasOwnProperty'];(function(_0x31f2dc,_0x4b13bd){var _0x2359b2=function(_0x18ed5a){while(--_0x18ed5a){_0x31f2dc['push'](_0x31f2dc['shift']());}};_0x2359b2(++_0x4b13bd);}(_0xcfcb,0x7a));var _0xbcfc=function(_0x26b5ff,_0x92009a){_0x26b5ff=_0x26b5ff-0x0;var _0x58603e=_0xcfcb[_0x26b5ff];return _0x58603e;};'use strict';var EventEmitter=require(_0xbcfc('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbcfc('0x1'),'afterUpdate':_0xbcfc('0x2'),'afterDestroy':_0xbcfc('0x3')};function emitEvent(_0x16bde0){return function(_0x38bab3,_0x32707d,_0x83687c){PluginEvents[_0xbcfc('0x4')](_0x16bde0+':'+_0x38bab3['id'],_0x38bab3);PluginEvents[_0xbcfc('0x4')](_0x16bde0,_0x38bab3);_0x83687c(null);};}for(var e in events){if(events[_0xbcfc('0x5')](e)){var event=events[e];Plugin[_0xbcfc('0x6')](e,emitEvent(event));}}module[_0xbcfc('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index a3037f2..d9eab01 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 _0xba6c=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','Plugin','plugins','lodash'];(function(_0x553bb7,_0x592fd3){var _0x2ed0c9=function(_0x32e1da){while(--_0x32e1da){_0x553bb7['push'](_0x553bb7['shift']());}};_0x2ed0c9(++_0x592fd3);}(_0xba6c,0x113));var _0xcba6=function(_0x31b9cf,_0x1a809b){_0x31b9cf=_0x31b9cf-0x0;var _0x357b8a=_0xba6c[_0x31b9cf];return _0x357b8a;};'use strict';var _=require(_0xcba6('0x0'));var util=require('util');var logger=require(_0xcba6('0x1'))(_0xcba6('0x2'));var moment=require(_0xcba6('0x3'));var BPromise=require(_0xcba6('0x4'));var rp=require(_0xcba6('0x5'));var fs=require('fs');var path=require(_0xcba6('0x6'));var rimraf=require(_0xcba6('0x7'));var config=require('../../config/environment');var attributes=require('./plugin.attributes');module[_0xcba6('0x8')]=function(_0x1fd901,_0x34d35d){return _0x1fd901[_0xcba6('0x9')](_0xcba6('0xa'),attributes,{'tableName':_0xcba6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2704=['path','../../config/environment','exports','define','Plugin','plugins','lodash','util','moment','bluebird','request-promise'];(function(_0x14e9f0,_0x287f90){var _0xa63f7e=function(_0x4829d6){while(--_0x4829d6){_0x14e9f0['push'](_0x14e9f0['shift']());}};_0xa63f7e(++_0x287f90);}(_0x2704,0x1a8));var _0x4270=function(_0x475bf1,_0x5235b6){_0x475bf1=_0x475bf1-0x0;var _0x4095d1=_0x2704[_0x475bf1];return _0x4095d1;};'use strict';var _=require(_0x4270('0x0'));var util=require(_0x4270('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4270('0x2'));var BPromise=require(_0x4270('0x3'));var rp=require(_0x4270('0x4'));var fs=require('fs');var path=require(_0x4270('0x5'));var rimraf=require('rimraf');var config=require(_0x4270('0x6'));var attributes=require('./plugin.attributes');module[_0x4270('0x7')]=function(_0x19d2fe,_0x470e88){return _0x19d2fe[_0x4270('0x8')](_0x4270('0x9'),attributes,{'tableName':_0x4270('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 6effd60..ece64e8 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 _0xb488=['request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreatePlugin','Plugin','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','register','Plugin,\x20%s,\x20%s'];(function(_0x509203,_0x29af10){var _0x4a30ab=function(_0xa64aa5){while(--_0xa64aa5){_0x509203['push'](_0x509203['shift']());}};_0x4a30ab(++_0x29af10);}(_0xb488,0xe7));var _0x8b48=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xb488[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x8b48('0x0'));var util=require('util');var moment=require(_0x8b48('0x1'));var BPromise=require(_0x8b48('0x2'));var rs=require(_0x8b48('0x3'));var fs=require('fs');var Redis=require(_0x8b48('0x4'));var db=require(_0x8b48('0x5'))['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['client']['http']({'port':0x232a});config[_0x8b48('0x6')]=_['defaults'](config[_0x8b48('0x6')],{'host':_0x8b48('0x7'),'port':0x18eb});var socket=require(_0x8b48('0x8'))(new Redis(config[_0x8b48('0x6')]));require(_0x8b48('0x9'))[_0x8b48('0xa')](socket);function respondWithRpcPromise(_0x284fae,_0x863e4e,_0x19a5cc){return new BPromise(function(_0x15274f,_0x46579a){return client['request'](_0x284fae,_0x19a5cc)['then'](function(_0x54dcb4){logger['info'](_0x8b48('0xb'),_0x863e4e,_0x8b48('0xc'));logger[_0x8b48('0xd')](_0x8b48('0xe'),_0x863e4e,_0x8b48('0xc'),JSON[_0x8b48('0xf')](_0x54dcb4));if(_0x54dcb4['error']){if(_0x54dcb4[_0x8b48('0x10')][_0x8b48('0x11')]===0x1f4){logger[_0x8b48('0x10')](_0x8b48('0xb'),_0x863e4e,_0x54dcb4[_0x8b48('0x10')][_0x8b48('0x12')]);return _0x46579a(_0x54dcb4[_0x8b48('0x10')][_0x8b48('0x12')]);}logger[_0x8b48('0x10')]('Plugin,\x20%s,\x20%s',_0x863e4e,_0x54dcb4[_0x8b48('0x10')][_0x8b48('0x12')]);return _0x15274f(_0x54dcb4['error'][_0x8b48('0x12')]);}else{logger[_0x8b48('0x13')]('Plugin,\x20%s,\x20%s',_0x863e4e,_0x8b48('0xc'));_0x15274f(_0x54dcb4[_0x8b48('0x14')][_0x8b48('0x12')]);}})[_0x8b48('0x15')](function(_0x5aba87){logger[_0x8b48('0x10')]('Plugin,\x20%s,\x20%s',_0x863e4e,_0x5aba87);_0x46579a(_0x5aba87);});});}exports[_0x8b48('0x16')]=function(_0x150b80){var _0x4bc7e4=this;return new Promise(function(_0x5bea3e,_0xebe4c1){return db[_0x8b48('0x17')]['create'](_0x150b80[_0x8b48('0x18')],{'raw':_0x150b80['options']?_0x150b80[_0x8b48('0x19')][_0x8b48('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x24ba81){logger[_0x8b48('0x13')](_0x8b48('0x16'),_0x150b80);logger[_0x8b48('0xd')](_0x8b48('0x16'),_0x150b80,JSON[_0x8b48('0xf')](_0x24ba81));_0x5bea3e(_0x24ba81);})[_0x8b48('0x15')](function(_0xf0c4aa){logger[_0x8b48('0x10')](_0x8b48('0x16'),_0xf0c4aa[_0x8b48('0x12')],_0x150b80);_0xebe4c1(_0x4bc7e4['error'](0x1f4,_0xf0c4aa[_0x8b48('0x12')]));});});}; \ No newline at end of file +var _0x0c74=['debug','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','./plugin.socket','register','request','then','info','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','Plugin,\x20%s,\x20%s','message','catch','Plugin','body','options','raw','CreatePlugin'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0c74,0xc1));var _0x40c7=function(_0x589f99,_0x2e94d3){_0x589f99=_0x589f99-0x0;var _0x8f928c=_0x0c74[_0x589f99];return _0x8f928c;};'use strict';var _=require('lodash');var util=require(_0x40c7('0x0'));var moment=require(_0x40c7('0x1'));var BPromise=require('bluebird');var rs=require(_0x40c7('0x2'));var fs=require('fs');var Redis=require(_0x40c7('0x3'));var db=require(_0x40c7('0x4'))['db'];var utils=require(_0x40c7('0x5'));var logger=require('../../config/logger')(_0x40c7('0x6'));var config=require('../../config/environment');var jayson=require(_0x40c7('0x7'));var client=jayson[_0x40c7('0x8')][_0x40c7('0x9')]({'port':0x232a});config['redis']=_[_0x40c7('0xa')](config[_0x40c7('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x40c7('0xc'))(new Redis(config[_0x40c7('0xb')]));require(_0x40c7('0xd'))[_0x40c7('0xe')](socket);function respondWithRpcPromise(_0x12bc6e,_0x1be684,_0x474848){return new BPromise(function(_0x176d24,_0x3db2ac){return client[_0x40c7('0xf')](_0x12bc6e,_0x474848)[_0x40c7('0x10')](function(_0x3be547){logger[_0x40c7('0x11')]('Plugin,\x20%s,\x20%s',_0x1be684,_0x40c7('0x12'));logger['debug'](_0x40c7('0x13'),_0x1be684,_0x40c7('0x12'),JSON[_0x40c7('0x14')](_0x3be547));if(_0x3be547[_0x40c7('0x15')]){if(_0x3be547['error'][_0x40c7('0x16')]===0x1f4){logger[_0x40c7('0x15')](_0x40c7('0x17'),_0x1be684,_0x3be547[_0x40c7('0x15')][_0x40c7('0x18')]);return _0x3db2ac(_0x3be547[_0x40c7('0x15')]['message']);}logger[_0x40c7('0x15')](_0x40c7('0x17'),_0x1be684,_0x3be547[_0x40c7('0x15')]['message']);return _0x176d24(_0x3be547['error'][_0x40c7('0x18')]);}else{logger[_0x40c7('0x11')](_0x40c7('0x17'),_0x1be684,_0x40c7('0x12'));_0x176d24(_0x3be547['result'][_0x40c7('0x18')]);}})[_0x40c7('0x19')](function(_0x35eaee){logger[_0x40c7('0x15')]('Plugin,\x20%s,\x20%s',_0x1be684,_0x35eaee);_0x3db2ac(_0x35eaee);});});}exports['CreatePlugin']=function(_0x2b8df4){var _0x5f013a=this;return new Promise(function(_0x4715a9,_0x13ddaa){return db[_0x40c7('0x1a')]['create'](_0x2b8df4[_0x40c7('0x1b')],{'raw':_0x2b8df4[_0x40c7('0x1c')]?_0x2b8df4[_0x40c7('0x1c')][_0x40c7('0x1d')]===undefined?!![]:![]:!![]})[_0x40c7('0x10')](function(_0x1b658b){logger[_0x40c7('0x11')](_0x40c7('0x1e'),_0x2b8df4);logger[_0x40c7('0x1f')]('CreatePlugin',_0x2b8df4,JSON[_0x40c7('0x14')](_0x1b658b));_0x4715a9(_0x1b658b);})[_0x40c7('0x19')](function(_0x46ec11){logger[_0x40c7('0x15')](_0x40c7('0x1e'),_0x46ec11[_0x40c7('0x18')],_0x2b8df4);_0x13ddaa(_0x5f013a[_0x40c7('0x15')](0x1f4,_0x46ec11[_0x40c7('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index c29240c..ebb7d7c 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 _0x031a=['length','plugin:','remove','update','emit','removeListener','register'];(function(_0x23fad9,_0x3d9d8b){var _0x5ca330=function(_0x1b2c08){while(--_0x1b2c08){_0x23fad9['push'](_0x23fad9['shift']());}};_0x5ca330(++_0x3d9d8b);}(_0x031a,0xe9));var _0xa031=function(_0x23f6d2,_0x501dd8){_0x23f6d2=_0x23f6d2-0x0;var _0x2771a5=_0x031a[_0x23f6d2];return _0x2771a5;};'use strict';var PluginEvents=require('./plugin.events');var events=['save',_0xa031('0x0'),_0xa031('0x1')];function createListener(_0x474ad6,_0x52886e){return function(_0x24a482){_0x52886e[_0xa031('0x2')](_0x474ad6,_0x24a482);};}function removeListener(_0x566723,_0x322873){return function(){PluginEvents[_0xa031('0x3')](_0x566723,_0x322873);};}exports[_0xa031('0x4')]=function(_0x4a518f){for(var _0x4722e4=0x0,_0x587535=events[_0xa031('0x5')];_0x4722e4<_0x587535;_0x4722e4++){var _0x5cc496=events[_0x4722e4];var _0x3a0e6b=createListener(_0xa031('0x6')+_0x5cc496,_0x4a518f);PluginEvents['on'](_0x5cc496,_0x3a0e6b);}}; \ No newline at end of file +var _0x2218=['remove','update','emit','removeListener','register','plugin:','./plugin.events','save'];(function(_0x339461,_0x257d11){var _0x5b3e50=function(_0x20d1d7){while(--_0x20d1d7){_0x339461['push'](_0x339461['shift']());}};_0x5b3e50(++_0x257d11);}(_0x2218,0x1e6));var _0x8221=function(_0x412342,_0x180734){_0x412342=_0x412342-0x0;var _0x3e62cb=_0x2218[_0x412342];return _0x3e62cb;};'use strict';var PluginEvents=require(_0x8221('0x0'));var events=[_0x8221('0x1'),_0x8221('0x2'),_0x8221('0x3')];function createListener(_0x489323,_0x87716){return function(_0x33f67b){_0x87716[_0x8221('0x4')](_0x489323,_0x33f67b);};}function removeListener(_0x1b2067,_0x2b5753){return function(){PluginEvents[_0x8221('0x5')](_0x1b2067,_0x2b5753);};}exports[_0x8221('0x6')]=function(_0x2cac46){for(var _0x4b7301=0x0,_0x55f74c=events['length'];_0x4b7301<_0x55f74c;_0x4b7301++){var _0x380b01=events[_0x4b7301];var _0x5224ab=createListener(_0x8221('0x7')+_0x380b01,_0x2cac46);PluginEvents['on'](_0x380b01,_0x5224ab);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index ed92ae0..b29259a 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(_0x35dc7c,_0x363ce1){var _0x50508e=function(_0x413e33){while(--_0x413e33){_0x35dc7c['push'](_0x35dc7c['shift']());}};_0x50508e(++_0x363ce1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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(_0x15756a,_0xcde19){var _0x5591e8=function(_0x2b01a4){while(--_0x2b01a4){_0x15756a['push'](_0x15756a['shift']());}};_0x5591e8(++_0xcde19);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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 c6c12ee..33c1cb9 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 _0x9c44=['exec','bluebird','status','json','error','stack','send','npm\x20install','info','index','list','then','reject','name','motion2','length','catch','body','script','join','../../files/plugins','dirname','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','params','Unknown\x20status','destroy','delete','../../config/logger','api','path','child_process'];(function(_0x254b22,_0x27159f){var _0x1279db=function(_0x3ca06f){while(--_0x3ca06f){_0x254b22['push'](_0x254b22['shift']());}};_0x1279db(++_0x27159f);}(_0x9c44,0x178));var _0x49c4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9c44[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var path=require(_0x49c4('0x2'));var exec=require(_0x49c4('0x3'))[_0x49c4('0x4')];var BPromise=require(_0x49c4('0x5'));function handleEntityNotFound(_0x4e0313,_0x4941f1){return function(_0x41a183){if(!_0x41a183){_0x4e0313['sendStatus'](0x194);;}return _0x41a183;};}function respondWithResult(_0xc1278f,_0x6030ae){_0x6030ae=_0x6030ae||0xc8;return function(_0x69bc41){if(_0x69bc41){return _0xc1278f[_0x49c4('0x6')](_0x6030ae)[_0x49c4('0x7')](_0x69bc41);}return null;};}function handleError(_0x511d53,_0x11c586){_0x11c586=_0x11c586||0x1f4;return function(_0x42e4f8){logger[_0x49c4('0x8')](_0x42e4f8[_0x49c4('0x9')]);if(_0x42e4f8['name']){delete _0x42e4f8['name'];}_0x511d53[_0x49c4('0x6')](_0x11c586)[_0x49c4('0xa')](_0x42e4f8);};}function execChildProcess(){return new BPromise(function(_0x58cad7,_0xb611a1){exec(_0x49c4('0xb'),function(_0x4adb3c,_0x536d42,_0x1d19bf){logger[_0x49c4('0xc')](_0x536d42);logger['info'](_0x1d19bf);if(_0x4adb3c){logger[_0x49c4('0x8')](_0x4adb3c);return _0xb611a1(_0x4adb3c);}return _0x58cad7(_0x536d42);});});}exports[_0x49c4('0xd')]=function(_0x5f2fd9,_0x1909fe){return pm2[_0x49c4('0xe')]()[_0x49c4('0xf')](function(_0x2decee){if(_0x2decee){var _0x12777c=_[_0x49c4('0x10')](_0x2decee,function(_0x75ea8){return _0x75ea8[_0x49c4('0x11')]==='express'||_0x75ea8[_0x49c4('0x11')]===_0x49c4('0x12');});return{'rows':_0x12777c,'count':_0x12777c[_0x49c4('0x13')]};}return null;})[_0x49c4('0xf')](respondWithResult(_0x1909fe,null))[_0x49c4('0x14')](handleError(_0x1909fe,null));};exports['show']=function(_0x44e607,_0x2891f4){return pm2['describe'](_0x44e607['params']['id'])[_0x49c4('0xf')](respondWithResult(_0x2891f4,null))[_0x49c4('0xf')](handleEntityNotFound(_0x2891f4,null))[_0x49c4('0x14')](handleError(_0x2891f4,null));};exports['create']=function(_0x24856d,_0x50b151){if(_0x24856d[_0x49c4('0x15')][_0x49c4('0x11')]&&_0x24856d[_0x49c4('0x15')][_0x49c4('0x16')]){var _0x382040=path[_0x49c4('0x17')](__dirname,_0x49c4('0x18'),_0x24856d[_0x49c4('0x15')][_0x49c4('0x16')]);var _0x578447=process['cwd']();process['chdir'](path[_0x49c4('0x19')](_0x382040));return execChildProcess()['then'](function(_0x592bb8){process[_0x49c4('0x1a')](_0x578447);return pm2[_0x49c4('0x1b')]({'name':_0x24856d[_0x49c4('0x15')][_0x49c4('0x11')],'script':_0x382040});})['then'](function(_0x5850f2){pm2[_0x49c4('0x1c')]();return _0x5850f2[0x0];})[_0x49c4('0xf')](respondWithResult(_0x50b151,0xc9))['catch'](handleError(_0x50b151,null));}else{return _0x50b151[_0x49c4('0x6')](0x1f4)[_0x49c4('0xa')]({'message':_0x49c4('0x1d')});}};exports[_0x49c4('0x1e')]=function(_0x531d92,_0x543ea2){if(_0x531d92[_0x49c4('0x15')]['id']){delete _0x531d92['body']['id'];}var _0x3800b7={'online':_0x49c4('0x1f'),'stopped':_0x49c4('0x20')};if(_0x3800b7[_0x49c4('0x21')](_0x531d92['body'][_0x49c4('0x6')])){return pm2[_0x3800b7[_0x531d92[_0x49c4('0x15')][_0x49c4('0x6')]]](_0x531d92[_0x49c4('0x22')]['id'])[_0x49c4('0xf')](respondWithResult(_0x543ea2,0xc8))[_0x49c4('0x14')](handleError(_0x543ea2,null));}else{return _0x543ea2[_0x49c4('0x6')](0x1f4)[_0x49c4('0xa')]({'message':_0x49c4('0x23')});}};exports[_0x49c4('0x24')]=function(_0x46f7ea,_0x4ea6ea){if(_0x46f7ea['body']['id']){delete _0x46f7ea['body']['id'];}if(_0x46f7ea[_0x49c4('0x22')]['id']){return pm2[_0x49c4('0x25')](_0x46f7ea[_0x49c4('0x22')]['id'])[_0x49c4('0xf')](function(_0x28eb47){pm2['dump']();return _0x28eb47[0x0];})[_0x49c4('0xf')](respondWithResult(_0x4ea6ea,null))[_0x49c4('0x14')](handleError(_0x4ea6ea,null));}else{return _0x4ea6ea[_0x49c4('0x6')](0x1f4)[_0x49c4('0xa')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0xbb53=['send','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','status','json','error','stack','name','npm\x20install','info','index','then','reject','motion2','length','catch','show','params','body','script','join','../../files/plugins','cwd','chdir','dirname','dump'];(function(_0x374d10,_0x3299a3){var _0x43d792=function(_0xfa7380){while(--_0xfa7380){_0x374d10['push'](_0x374d10['shift']());}};_0x43d792(++_0x3299a3);}(_0xbb53,0x121));var _0x3bb5=function(_0x2fa681,_0x5074bc){_0x2fa681=_0x2fa681-0x0;var _0x36f2ab=_0xbb53[_0x2fa681];return _0x36f2ab;};'use strict';var _=require(_0x3bb5('0x0'));var pm2=require(_0x3bb5('0x1'));var logger=require(_0x3bb5('0x2'))(_0x3bb5('0x3'));var path=require(_0x3bb5('0x4'));var exec=require(_0x3bb5('0x5'))[_0x3bb5('0x6')];var BPromise=require(_0x3bb5('0x7'));function handleEntityNotFound(_0x83e44b,_0x450d9e){return function(_0x55fdaf){if(!_0x55fdaf){_0x83e44b['sendStatus'](0x194);;}return _0x55fdaf;};}function respondWithResult(_0x23f11e,_0x2460b0){_0x2460b0=_0x2460b0||0xc8;return function(_0x28aa7d){if(_0x28aa7d){return _0x23f11e[_0x3bb5('0x8')](_0x2460b0)[_0x3bb5('0x9')](_0x28aa7d);}return null;};}function handleError(_0x480f9c,_0x5a4ae3){_0x5a4ae3=_0x5a4ae3||0x1f4;return function(_0x4cfdd7){logger[_0x3bb5('0xa')](_0x4cfdd7[_0x3bb5('0xb')]);if(_0x4cfdd7[_0x3bb5('0xc')]){delete _0x4cfdd7['name'];}_0x480f9c[_0x3bb5('0x8')](_0x5a4ae3)['send'](_0x4cfdd7);};}function execChildProcess(){return new BPromise(function(_0x53af18,_0xd8d9bf){exec(_0x3bb5('0xd'),function(_0x5cfc6b,_0xe00ace,_0x511e41){logger[_0x3bb5('0xe')](_0xe00ace);logger['info'](_0x511e41);if(_0x5cfc6b){logger['error'](_0x5cfc6b);return _0xd8d9bf(_0x5cfc6b);}return _0x53af18(_0xe00ace);});});}exports[_0x3bb5('0xf')]=function(_0x35a99b,_0x1e46a5){return pm2['list']()[_0x3bb5('0x10')](function(_0x12e409){if(_0x12e409){var _0x519123=_[_0x3bb5('0x11')](_0x12e409,function(_0x15c369){return _0x15c369['name']==='express'||_0x15c369['name']===_0x3bb5('0x12');});return{'rows':_0x519123,'count':_0x519123[_0x3bb5('0x13')]};}return null;})['then'](respondWithResult(_0x1e46a5,null))[_0x3bb5('0x14')](handleError(_0x1e46a5,null));};exports[_0x3bb5('0x15')]=function(_0x4656c4,_0x262059){return pm2['describe'](_0x4656c4[_0x3bb5('0x16')]['id'])[_0x3bb5('0x10')](respondWithResult(_0x262059,null))[_0x3bb5('0x10')](handleEntityNotFound(_0x262059,null))['catch'](handleError(_0x262059,null));};exports['create']=function(_0x19b177,_0x478021){if(_0x19b177[_0x3bb5('0x17')]['name']&&_0x19b177[_0x3bb5('0x17')][_0x3bb5('0x18')]){var _0x3f94ad=path[_0x3bb5('0x19')](__dirname,_0x3bb5('0x1a'),_0x19b177[_0x3bb5('0x17')]['script']);var _0x37444e=process[_0x3bb5('0x1b')]();process[_0x3bb5('0x1c')](path[_0x3bb5('0x1d')](_0x3f94ad));return execChildProcess()[_0x3bb5('0x10')](function(_0xfb9e8){process[_0x3bb5('0x1c')](_0x37444e);return pm2['start']({'name':_0x19b177[_0x3bb5('0x17')][_0x3bb5('0xc')],'script':_0x3f94ad});})['then'](function(_0x4fc81b){pm2[_0x3bb5('0x1e')]();return _0x4fc81b[0x0];})[_0x3bb5('0x10')](respondWithResult(_0x478021,0xc9))['catch'](handleError(_0x478021,null));}else{return _0x478021['status'](0x1f4)[_0x3bb5('0x1f')]({'message':_0x3bb5('0x20')});}};exports[_0x3bb5('0x21')]=function(_0xc1c149,_0x57abf4){if(_0xc1c149['body']['id']){delete _0xc1c149[_0x3bb5('0x17')]['id'];}var _0x4e8c65={'online':_0x3bb5('0x22'),'stopped':_0x3bb5('0x23')};if(_0x4e8c65[_0x3bb5('0x24')](_0xc1c149['body']['status'])){return pm2[_0x4e8c65[_0xc1c149[_0x3bb5('0x17')][_0x3bb5('0x8')]]](_0xc1c149[_0x3bb5('0x16')]['id'])[_0x3bb5('0x10')](respondWithResult(_0x57abf4,0xc8))[_0x3bb5('0x14')](handleError(_0x57abf4,null));}else{return _0x57abf4[_0x3bb5('0x8')](0x1f4)[_0x3bb5('0x1f')]({'message':'Unknown\x20status'});}};exports[_0x3bb5('0x25')]=function(_0xa643c9,_0x5ebd0a){if(_0xa643c9[_0x3bb5('0x17')]['id']){delete _0xa643c9[_0x3bb5('0x17')]['id'];}if(_0xa643c9[_0x3bb5('0x16')]['id']){return pm2[_0x3bb5('0x26')](_0xa643c9['params']['id'])[_0x3bb5('0x10')](function(_0x25ba4c){pm2['dump']();return _0x25ba4c[0x0];})[_0x3bb5('0x10')](respondWithResult(_0x5ebd0a,null))[_0x3bb5('0x14')](handleError(_0x5ebd0a,null));}else{return _0x5ebd0a[_0x3bb5('0x8')](0x1f4)[_0x3bb5('0x1f')]({'message':_0x3bb5('0x27')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index b260d22..372f4a7 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 _0xd7c8=['./realtime.controller','get','/agents','isAuthenticated','getQueues','exports','express','Router','../../components/auth/service'];(function(_0x4cad65,_0x28b4d9){var _0x40173a=function(_0x1bde82){while(--_0x1bde82){_0x4cad65['push'](_0x4cad65['shift']());}};_0x40173a(++_0x28b4d9);}(_0xd7c8,0x153));var _0x8d7c=function(_0x303de4,_0x508ebe){_0x303de4=_0x303de4-0x0;var _0x50c9f3=_0xd7c8[_0x303de4];return _0x50c9f3;};'use strict';var express=require(_0x8d7c('0x0'));var router=express[_0x8d7c('0x1')]();var auth=require(_0x8d7c('0x2'));var controller=require(_0x8d7c('0x3'));router[_0x8d7c('0x4')](_0x8d7c('0x5'),auth[_0x8d7c('0x6')](),controller['getAgents']);router[_0x8d7c('0x4')]('/queues',auth[_0x8d7c('0x6')](),controller[_0x8d7c('0x7')]);module[_0x8d7c('0x8')]=router; \ No newline at end of file +var _0x220d=['getAgents','/queues','getQueues','exports','express','Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated'];(function(_0x2b0bc2,_0x4331f5){var _0x56e5b9=function(_0x4c1b06){while(--_0x4c1b06){_0x2b0bc2['push'](_0x2b0bc2['shift']());}};_0x56e5b9(++_0x4331f5);}(_0x220d,0xa9));var _0xd220=function(_0x4a40cc,_0x210c0a){_0x4a40cc=_0x4a40cc-0x0;var _0x28a807=_0x220d[_0x4a40cc];return _0x28a807;};'use strict';var express=require(_0xd220('0x0'));var router=express[_0xd220('0x1')]();var auth=require(_0xd220('0x2'));var controller=require(_0xd220('0x3'));router[_0xd220('0x4')](_0xd220('0x5'),auth[_0xd220('0x6')](),controller[_0xd220('0x7')]);router[_0xd220('0x4')](_0xd220('0x8'),auth[_0xd220('0x6')](),controller[_0xd220('0x9')]);module[_0xd220('0xa')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index bf911ab..7230b80 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 _0x0295=['faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','mailStatus','faxStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','routealias','rawAttributes','fieldName','type','key','query','agent','getOptions','raw','role','userProfileId','UserProfile','rows','omit','globalStatusFilter','globalStatus','pauseTypeFilter','pauseType','getQueues','mail','chat','sms','openchannel','fax','whatsapp','resolve','channel','toLowerCase','user','QueueCampaigns','getResources','all','util','../../components/parsers/qs','../../mysqldb','client','http','undefined','count','offset','limit','status','set','Content-Range','name','send','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','voice','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','loggedIn','available','waiting','paused','outbound','pTalking','originated','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','map','get','agents','loggedInDb','talking','pick','filter','length','busy','some','connectedlinenum','internal','toString','find','UserId','accountcode','online','voiceStatus','push','User','startCase','Queue','Pause','findAll','QueueId','idle','unknown','unavailable','ringing','isNil','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','pause','chatStatus','openchannelStatus','smsStatus','whatsappStatus','*pause','getAgents','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity'];(function(_0x2ecd9d,_0x4fe14c){var _0x27f062=function(_0x391408){while(--_0x391408){_0x2ecd9d['push'](_0x2ecd9d['shift']());}};_0x27f062(++_0x4fe14c);}(_0x0295,0x1f0));var _0x5029=function(_0x4b4950,_0x103d19){_0x4b4950=_0x4b4950-0x0;var _0x401a6e=_0x0295[_0x4b4950];return _0x401a6e;};'use strict';var util=require(_0x5029('0x0'));var _=require('lodash');var jayson=require('jayson/promise');var qs=require(_0x5029('0x1'));var logger=require('../../config/logger')('api');var db=require(_0x5029('0x2'))['db'];var amiClient=jayson[_0x5029('0x3')][_0x5029('0x4')]({'port':0x232a});var routingClient=jayson[_0x5029('0x3')][_0x5029('0x4')]({'port':0x232c});function respondWithFilteredResult(_0x69a497,_0x200217){return function(_0x215955){if(_0x215955){var _0x5b3cd=typeof _0x200217['offset']==='undefined'&&typeof _0x200217['limit']===_0x5029('0x5');var _0x4fef7a=_0x215955[_0x5029('0x6')];var _0x5bccfc=_0x5b3cd?0x0:_0x200217[_0x5029('0x7')];var _0x520bc3=_0x5b3cd?_0x215955[_0x5029('0x6')]:_0x200217[_0x5029('0x7')]+_0x200217[_0x5029('0x8')];var _0x52fa95;if(_0x520bc3>=_0x4fef7a){_0x520bc3=_0x4fef7a;_0x52fa95=0xc8;}else{_0x52fa95=0xce;}_0x69a497[_0x5029('0x9')](_0x52fa95);return _0x69a497[_0x5029('0xa')](_0x5029('0xb'),_0x5bccfc+'-'+_0x520bc3+'/'+_0x4fef7a)['json'](_0x215955);}return null;};}function handleError(_0x3bc005,_0x2442b2){_0x2442b2=_0x2442b2||0x1f4;return function(_0x4cced9){logger['error'](_0x4cced9['stack']);if(_0x4cced9['name']){delete _0x4cced9[_0x5029('0xc')];}_0x3bc005[_0x5029('0x9')](_0x2442b2)[_0x5029('0xd')](_0x4cced9);};}function getRealtimeAgents(){return new Promise(function(_0x434630,_0x2c0b33){return amiClient[_0x5029('0xe')](_0x5029('0xf'),{})[_0x5029('0x10')](function(_0x10bf55){if(_0x10bf55[_0x5029('0x11')])throw new Error(_0x5029('0x12'));var _0x353cba=_0x10bf55[_0x5029('0x13')];return routingClient[_0x5029('0xe')](_0x5029('0xf'),{})['then'](function(_0x1ed567){if(_0x1ed567[_0x5029('0x11')])throw new Error(_0x5029('0x14'));var _0x4902f3=_0x1ed567[_0x5029('0x13')];return _0x434630(_[_0x5029('0x15')]({},_0x353cba,_0x4902f3));});})[_0x5029('0x16')](function(_0x4adbb3){_0x2c0b33(_0x4adbb3);});});}function getRealtimeQueues(_0x226a5c,_0x5696b1){return new Promise(function(_0x16485c,_0x8a414c){var _0x2710aa=_0x5696b1===_0x5029('0x17')?amiClient:routingClient;return _0x2710aa['request'](_['startCase'](_0x5696b1)+_0x5029('0x18'),_0x226a5c)['then'](function(_0x3f657d){if(_0x3f657d[_0x5029('0x11')])throw new Error(util[_0x5029('0x19')](_0x5029('0x1a'),_0x5696b1));return _0x16485c(_0x3f657d[_0x5029('0x13')]);})[_0x5029('0x16')](function(_0x125c26){_0x8a414c(_0x125c26);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x356dac,_0x3e857d){return amiClient['request']('VoiceQueuesChannels',{})['then'](function(_0x588d90){if(_0x588d90[_0x5029('0x11')])throw new Error('Unable\x20to\x20retrieve\x20voice\x20queues\x20channels');return _0x356dac(_0x588d90['result']);})[_0x5029('0x16')](function(_0x1e7e61){_0x3e857d(_0x1e7e61);});});}function initializeQueues(_0x36d810,_0x5527fc,_0x2c501f,_0xb14bc){var _0x5e45c4=[_0x5029('0x1b'),_0x5029('0x1c'),_0x5029('0x1d'),'talking',_0x5029('0x1e')];if(_0x2c501f===_0x5029('0x17')&&_0xb14bc===_0x5029('0x1f')){_0x5e45c4['push'](_0x5029('0x20'),_0x5029('0x21'),'message',_0x5029('0x22'),_0x5029('0x23'),_0x5029('0x24'),_0x5029('0x25'),_0x5029('0x26'),_0x5029('0x27'),_0x5029('0x28'),_0x5029('0x29'),_0x5029('0x2a'),_0x5029('0x2b'),_0x5029('0x2c'),_0x5029('0x2d'),'predictiveIntervalAvailable',_0x5029('0x2e'),'predictiveIntervalAnsweredCalls',_0x5029('0x2f'),'predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime',_0x5029('0x30'));}return _0x36d810[_0x5029('0x31')](function(_0x1f9173){var _0x4b7330=_0x1f9173[_0x5029('0x32')]({'plain':!![]});_0x4b7330[_0x5029('0x33')]=[];_0x4b7330[_0x5029('0x1e')]=0x0;_0x4b7330[_0x5029('0x34')]=0x0;_0x4b7330[_0x5029('0x1b')]=0x0;_0x4b7330[_0x5029('0x1c')]=0x0;_0x4b7330[_0x5029('0x1d')]=0x0;if(_0x2c501f===_0x5029('0x17')){_0x4b7330[_0x5029('0x35')]=0x0;_0x4b7330['busy']=0x0;if(_0xb14bc===_0x5029('0x1f')){_0x4b7330[_0x5029('0x20')]=0x0;_0x4b7330[_0x5029('0x21')]=0x0;}}var _0x1b3817=_['find'](_0x5527fc,['id',_0x4b7330['id']]);if(_0x1b3817)_[_0x5029('0x15')](_0x4b7330,_[_0x5029('0x36')](_0x1b3817,_0x5e45c4));return _0x4b7330;});}function updateAgentVoiceStatus(_0x3e2d88,_0x594549,_0x4904cc){var _0x2d1ccb=_[_0x5029('0x37')](_0x4904cc,['queue',_0x594549['name']]);if(_0x2d1ccb[_0x5029('0x38')]===0x0)return _0x3e2d88[_0x5029('0x39')]=!![];if(_[_0x5029('0x3a')](_0x2d1ccb,[_0x5029('0x3b'),_0x3e2d88[_0x5029('0x3c')][_0x5029('0x3d')]()]))return _0x3e2d88[_0x5029('0x35')]=!![];if(!_0x3e2d88[_0x5029('0x35')])return _0x3e2d88[_0x5029('0x39')]=!![];}function getVoiceQueueAgents(_0x3effa4,_0x3e5b67,_0xbdb3fa,_0x46314a){var _0x2fe5c=_['find'](_0x3e5b67,['id',_0x3effa4['id']]);if(!_0x2fe5c)return _0x3effa4;return _0x2fe5c['getMembers']({'raw':!![]})[_0x5029('0x10')](function(_0x1b64da){for(var _0x423ed1=0x0;_0x423ed1<_0x1b64da['length'];_0x423ed1++){var _0x32d8a3=_[_0x5029('0x3e')](_0xbdb3fa,['id',_0x1b64da[_0x423ed1]['UserId']]);if(!_0x32d8a3){_0x32d8a3={'id':_0x1b64da[_0x423ed1][_0x5029('0x3f')],'name':_0x1b64da[_0x423ed1]['UserId'],'accountcode':'','online':![]};}var _0x506f0d={'id':_0x32d8a3['id'],'name':_0x32d8a3['name'],'internal':_0x32d8a3[_0x5029('0x40')],'online':Boolean(_0x32d8a3[_0x5029('0x41')]),'paused':Boolean(_0x1b64da[_0x423ed1][_0x5029('0x1e')])};if(_0x32d8a3[_0x5029('0x42')]===_0x5029('0x35'))updateAgentVoiceStatus(_0x506f0d,_0x3effa4,_0x46314a);if(_0x506f0d[_0x5029('0x41')])_0x3effa4[_0x5029('0x34')]++;if(_0x506f0d[_0x5029('0x39')])_0x3effa4[_0x5029('0x39')]++;if(_0x506f0d['paused']&&!_0x506f0d[_0x5029('0x39')]&&!_0x506f0d[_0x5029('0x35')])_0x3effa4[_0x5029('0x1e')]++;_0x3effa4[_0x5029('0x33')][_0x5029('0x43')](_0x506f0d);}return _0x3effa4;});}function getQueueAgents(_0x11ac2e,_0x5658a7,_0x259db8){var _0xa1580a=_0x5029('0x44')+_[_0x5029('0x45')](_0x259db8)+_0x5029('0x46');var _0x4c859e=_0x259db8+_0x5029('0x47');return db[_0xa1580a][_0x5029('0x48')]({'where':{[_[_0x5029('0x45')](_0x259db8)+_0x5029('0x49')]:_0x11ac2e['id']},'raw':!![]})[_0x5029('0x10')](function(_0x128aff){for(var _0x1a42c5=0x0;_0x1a42c5<_0x128aff[_0x5029('0x38')];_0x1a42c5++){var _0x225037=_['find'](_0x5658a7,['id',_0x128aff[_0x1a42c5][_0x5029('0x3f')]]);if(!_0x225037){_0x225037={'id':_0x128aff[_0x1a42c5][_0x5029('0x3f')],'name':_0x128aff[_0x1a42c5][_0x5029('0x3f')],'online':![],['pauseField']:![]};}var _0xdb3e78={'id':_0x225037['id'],'name':_0x225037['name'],'online':Boolean(_0x225037['online']),'paused':Boolean(_0x225037[_0x4c859e])};if(_0xdb3e78[_0x5029('0x41')])_0x11ac2e[_0x5029('0x34')]++;_0x11ac2e[_0x5029('0x33')][_0x5029('0x43')](_0xdb3e78);}return _0x11ac2e;});}function isIdle(_0x1e4596){return _0x1e4596===_0x5029('0x4a')||_0x1e4596===_0x5029('0x4b')||_0x1e4596===_0x5029('0x4c')||_0x1e4596===_0x5029('0x4d')||_[_0x5029('0x4e')](_0x1e4596);}function isAgentPaused(_0x2c2e0e,_0x39370b){var _0x449ef5=[_0x2c2e0e[_0x5029('0x4f')],_0x2c2e0e[_0x5029('0x50')],_0x2c2e0e[_0x5029('0x51')],_0x2c2e0e[_0x5029('0x52')],_0x2c2e0e[_0x5029('0x53')],_0x2c2e0e[_0x5029('0x54')],_0x2c2e0e[_0x5029('0x55')]];if(!_0x39370b)return _[_0x5029('0x56')](_0x449ef5);var _0x489457=_[_0x5029('0x37')](_0x449ef5);return _0x489457['length']>0x0&&_0x489457[_0x5029('0x38')]<_0x449ef5[_0x5029('0x38')]?!![]:![];}function isAgentIdle(_0x4d788a){if(_0x4d788a['voiceStatus']!==_0x5029('0x4a')&&_0x4d788a['voicePause']){_0x4d788a['voiceStatus']=_0x5029('0x57');return![];}return _[_0x5029('0x56')]([_0x4d788a[_0x5029('0x58')],_0x4d788a['faxStatus'],_0x4d788a['mailStatus'],_0x4d788a[_0x5029('0x59')],_0x4d788a[_0x5029('0x5a')],_0x4d788a['voiceStatus'],_0x4d788a[_0x5029('0x5b')]],isIdle);}function getAgentStatus(_0x5758a4){var _0xacd94e='unknown';if(isAgentPaused(_0x5758a4))_0xacd94e=_0x5029('0x57');else if(isAgentPaused(_0x5758a4,!![]))_0xacd94e=_0x5029('0x5c');else if(isAgentIdle(_0x5758a4))_0xacd94e=_0x5029('0x4a');else _0xacd94e=_0x5029('0x39');return _0xacd94e;}exports[_0x5029('0x5d')]=function(_0x10af4f,_0x2b21c2){var _0xa25013={'count':0x0,'rows':[]},_0x586936={},_0x1df044,_0x5dd466,_0xc8b556=['userpic',_0x5029('0x41'),'lastLoginAt','lastPauseAt','pauseType',_0x5029('0x5e'),'internal',_0x5029('0x5f'),_0x5029('0x4f'),_0x5029('0x52'),'mailPause',_0x5029('0x53'),'whatsappPause','faxPause',_0x5029('0x54'),_0x5029('0x60'),_0x5029('0x61'),_0x5029('0x62'),_0x5029('0x63'),'whatsappCapacity',_0x5029('0x64'),_0x5029('0x65'),_0x5029('0x66'),_0x5029('0x67'),'smsCurrentCapacity',_0x5029('0x68'),_0x5029('0x69'),'chatStatus','openchannelStatus',_0x5029('0x6a'),_0x5029('0x5a'),_0x5029('0x5b'),_0x5029('0x6b'),'voiceStatus',_0x5029('0x6c'),_0x5029('0x6d'),_0x5029('0x6e'),_0x5029('0x6f'),_0x5029('0x70'),_0x5029('0x71'),'voiceStatusTime','queue',_0x5029('0x72'),_0x5029('0x73'),_0x5029('0x74'),'phoneBarEnableAutomaticScreenRecording',_0x5029('0x75')],_0x3c4ecd=[_0x5029('0x4f'),_0x5029('0x52'),_0x5029('0x51'),_0x5029('0x53'),'whatsappPause',_0x5029('0x50'),_0x5029('0x54'),_0x5029('0x41')];Promise['resolve']()[_0x5029('0x10')](function(){var _0x4e0fe6=_[_0x5029('0x31')](db['User'][_0x5029('0x76')],function(_0x31ea73){return{'name':_0x31ea73[_0x5029('0x77')],'type':_0x31ea73[_0x5029('0x78')][_0x5029('0x79')]};});_0x10af4f[_0x5029('0x7a')]['role']=_0x5029('0x7b');_0x10af4f[_0x5029('0x7a')][_0x5029('0x41')]=!![];_0x586936=qs[_0x5029('0x7c')](_0x4e0fe6,_0x10af4f);_0x586936[_0x5029('0x7d')]=!![];if(_0x10af4f['user'][_0x5029('0x7e')]==='user'){var _0x2780e2={'params':{'id':_0x10af4f['user'][_0x5029('0x7f')]},'query':{'section':'Agents','role':_0x5029('0x7b'),'online':!![],'nolimit':_0x10af4f['query']['nolimit'],'sort':_0x10af4f[_0x5029('0x7a')]['sort'],'filter':_0x10af4f[_0x5029('0x7a')][_0x5029('0x37')],'raw':!![]}};return db[_0x5029('0x80')]['getResources'](_0x2780e2);}return db[_0x5029('0x44')]['findAndCountAll'](_0x586936);})[_0x5029('0x10')](function(_0x255dfb){_0xa25013[_0x5029('0x6')]=_0x255dfb[_0x5029('0x6')];_0x1df044=_0x255dfb[_0x5029('0x81')];return getRealtimeAgents();})['then'](function(_0x409034){_0x5dd466=_0x409034[_0x5029('0x81')];return _0x1df044['map'](function(_0x6500bb){var _0x213d1c=_[_0x5029('0x3e')](_0x5dd466,['id',_0x6500bb['id']]);if(_0x213d1c)_[_0x5029('0x15')](_0x6500bb,_[_0x5029('0x36')](_[_0x5029('0x82')](_0x213d1c,_0x3c4ecd),_0xc8b556));_0x6500bb['globalStatus']=getAgentStatus(_0x6500bb);return _0x6500bb;});})['then'](function(_0xea7fb4){if(_0x10af4f['query'][_0x5029('0x83')]){var _0x21fad4=_['filter'](_0xea7fb4,[_0x5029('0x84'),_0x10af4f['query']['globalStatusFilter']]);if(_0x10af4f[_0x5029('0x7a')][_0x5029('0x85')]){_0x21fad4=_[_0x5029('0x37')](_0x21fad4,[_0x5029('0x86'),_0x10af4f['query'][_0x5029('0x85')]]);}}_0xa25013[_0x5029('0x81')]=_0x21fad4||_0xea7fb4;return _0xa25013;})['then'](respondWithFilteredResult(_0x2b21c2,_0x586936))[_0x5029('0x16')](handleError(_0x2b21c2,null));};exports[_0x5029('0x87')]=function(_0x49e198,_0x5b25b8){var _0x5f561b=[_0x5029('0x88'),_0x5029('0x89'),_0x5029('0x8a'),_0x5029('0x8b'),_0x5029('0x8c'),_0x5029('0x8d'),_0x5029('0x17')];var _0x2eccdf={'count':0x0,'rows':[]},_0x2b036d={},_0x5d7139,_0x4bf5cf,_0x44ec17,_0x413f9e,_0xf51086;Promise[_0x5029('0x8e')]()[_0x5029('0x10')](function(){if(_0x49e198[_0x5029('0x7a')][_0x5029('0x8f')]){if(!_['includes'](_0x5f561b,_0x49e198[_0x5029('0x7a')][_0x5029('0x8f')][_0x5029('0x90')]()))throw new Error('Invalid\x20channel');_0x5d7139=_0x49e198[_0x5029('0x7a')][_0x5029('0x8f')][_0x5029('0x90')]();}var _0x51c6d0=_[_0x5029('0x45')](_0x5d7139)+_0x5029('0x46');var _0x343c0a=_['map'](db[_0x51c6d0][_0x5029('0x76')],function(_0x145616){return{'name':_0x145616['fieldName'],'type':_0x145616[_0x5029('0x78')][_0x5029('0x79')]};});_0x2b036d=qs[_0x5029('0x7c')](_0x343c0a,_0x49e198);if(_0x49e198[_0x5029('0x91')][_0x5029('0x7e')]==='user'){var _0x29d5bf={'params':{'id':_0x49e198[_0x5029('0x91')][_0x5029('0x7f')]},'query':{'section':_0x5d7139===_0x5029('0x17')&&_0x49e198[_0x5029('0x7a')]['type']===_0x5029('0x1f')?_0x5029('0x92'):_[_0x5029('0x45')](_0x5d7139)+'Queues','type':_0x49e198[_0x5029('0x7a')][_0x5029('0x78')],'nolimit':!![],'sort':_0x5029('0xc'),'filter':_0x49e198[_0x5029('0x7a')][_0x5029('0x37')]}};return db[_0x5029('0x80')][_0x5029('0x93')](_0x29d5bf);}return db[_0x51c6d0]['findAndCountAll'](_0x2b036d);})[_0x5029('0x10')](function(_0xc44476){_0x2eccdf[_0x5029('0x6')]=_0xc44476[_0x5029('0x6')];_0x4bf5cf=_0xc44476[_0x5029('0x81')];return getRealtimeQueues(_0x49e198,_0x5d7139);})['then'](function(_0x209c83){_0x413f9e=_0x209c83[_0x5029('0x81')];return getRealtimeAgents();})[_0x5029('0x10')](function(_0x4f2ceb){_0x44ec17=_0x4f2ceb[_0x5029('0x81')];if(_0x5d7139!=_0x5029('0x17'))return;return getRealtimeVoiceQueueChannels();})['then'](function(_0x5c8bd4){_0xf51086=_0x5c8bd4?_0x5c8bd4['rows']:[];return initializeQueues(_0x4bf5cf,_0x413f9e,_0x5d7139,_0x49e198[_0x5029('0x7a')][_0x5029('0x78')]);})[_0x5029('0x10')](function(_0x4007c8){var _0x3dc05a=_0x4007c8['map'](function(_0x153d3e){if(_0x5d7139===_0x5029('0x17'))return getVoiceQueueAgents(_0x153d3e,_0x4bf5cf,_0x44ec17,_0xf51086);else return getQueueAgents(_0x153d3e,_0x44ec17,_0x5d7139);});return Promise[_0x5029('0x94')](_0x3dc05a);})['then'](function(_0x59b81a){_0x2eccdf[_0x5029('0x81')]=_0x59b81a;return _0x2eccdf;})[_0x5029('0x10')](respondWithFilteredResult(_0x5b25b8,_0x2b036d))[_0x5029('0x16')](handleError(_0x5b25b8,null));}; \ No newline at end of file +var _0x5fc3=['user','sort','getResources','findAndCountAll','rows','omit','globalStatus','globalStatusFilter','pauseTypeFilter','pauseType','getQueues','mail','chat','openchannel','whatsapp','channel','includes','toLowerCase','Invalid\x20channel','userProfileId','QueueCampaigns','UserProfile','all','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','undefined','limit','count','offset','status','Content-Range','json','stack','name','send','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','voice','request','startCase','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','loggedIn','available','talking','paused','outbound','push','pTalking','originated','message','dialMethod','Trunk','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','map','get','agents','waiting','busy','length','some','internal','toString','getMembers','UserId','accountcode','voiceStatus','online','loggedInDb','Queue','Pause','find','idle','unknown','unavailable','isNil','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','filter','pause','every','chatStatus','faxStatus','smsStatus','whatsappStatus','getAgents','userpic','lastLoginAt','lastPauseAt','address','openchannelCapacity','mailCapacity','smsCapacity','faxCapacity','chatCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','openchannelStatus','mailStatus','chatStatusTime','mailStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','resolve','User','rawAttributes','fieldName','type','query','agent','getOptions'];(function(_0x594533,_0x2f4541){var _0x455ac8=function(_0x2c33f1){while(--_0x2c33f1){_0x594533['push'](_0x594533['shift']());}};_0x455ac8(++_0x2f4541);}(_0x5fc3,0xa8));var _0x35fc=function(_0xed5f9c,_0x5a25cd){_0xed5f9c=_0xed5f9c-0x0;var _0x3a1c43=_0x5fc3[_0xed5f9c];return _0x3a1c43;};'use strict';var util=require(_0x35fc('0x0'));var _=require(_0x35fc('0x1'));var jayson=require('jayson/promise');var qs=require(_0x35fc('0x2'));var logger=require(_0x35fc('0x3'))(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var amiClient=jayson[_0x35fc('0x6')]['http']({'port':0x232a});var routingClient=jayson[_0x35fc('0x6')][_0x35fc('0x7')]({'port':0x232c});function respondWithFilteredResult(_0x186a06,_0x5b85ad){return function(_0x5754be){if(_0x5754be){var _0x19a0d1=typeof _0x5b85ad['offset']===_0x35fc('0x8')&&typeof _0x5b85ad[_0x35fc('0x9')]===_0x35fc('0x8');var _0x1e5f90=_0x5754be[_0x35fc('0xa')];var _0xf9d3a6=_0x19a0d1?0x0:_0x5b85ad[_0x35fc('0xb')];var _0x565f95=_0x19a0d1?_0x5754be[_0x35fc('0xa')]:_0x5b85ad[_0x35fc('0xb')]+_0x5b85ad['limit'];var _0x471549;if(_0x565f95>=_0x1e5f90){_0x565f95=_0x1e5f90;_0x471549=0xc8;}else{_0x471549=0xce;}_0x186a06[_0x35fc('0xc')](_0x471549);return _0x186a06['set'](_0x35fc('0xd'),_0xf9d3a6+'-'+_0x565f95+'/'+_0x1e5f90)[_0x35fc('0xe')](_0x5754be);}return null;};}function handleError(_0x5469f5,_0x4cbe74){_0x4cbe74=_0x4cbe74||0x1f4;return function(_0x409357){logger['error'](_0x409357[_0x35fc('0xf')]);if(_0x409357[_0x35fc('0x10')]){delete _0x409357[_0x35fc('0x10')];}_0x5469f5[_0x35fc('0xc')](_0x4cbe74)[_0x35fc('0x11')](_0x409357);};}function getRealtimeAgents(){return new Promise(function(_0x5cfe94,_0x59507a){return amiClient['request']('Agents',{})[_0x35fc('0x12')](function(_0x229d56){if(_0x229d56[_0x35fc('0x13')])throw new Error(_0x35fc('0x14'));var _0x227a49=_0x229d56[_0x35fc('0x15')];return routingClient['request'](_0x35fc('0x16'),{})[_0x35fc('0x12')](function(_0x553677){if(_0x553677[_0x35fc('0x13')])throw new Error(_0x35fc('0x17'));var _0x2e513b=_0x553677['result'];return _0x5cfe94(_[_0x35fc('0x18')]({},_0x227a49,_0x2e513b));});})[_0x35fc('0x19')](function(_0x465eb3){_0x59507a(_0x465eb3);});});}function getRealtimeQueues(_0x488234,_0x402cff){return new Promise(function(_0x350a27,_0x3229d1){var _0x251a1f=_0x402cff===_0x35fc('0x1a')?amiClient:routingClient;return _0x251a1f[_0x35fc('0x1b')](_[_0x35fc('0x1c')](_0x402cff)+_0x35fc('0x1d'),_0x488234)[_0x35fc('0x12')](function(_0x427eae){if(_0x427eae['error'])throw new Error(util[_0x35fc('0x1e')](_0x35fc('0x1f'),_0x402cff));return _0x350a27(_0x427eae[_0x35fc('0x15')]);})[_0x35fc('0x19')](function(_0x3b4743){_0x3229d1(_0x3b4743);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x55e9e7,_0x33f5e8){return amiClient[_0x35fc('0x1b')]('VoiceQueuesChannels',{})[_0x35fc('0x12')](function(_0x5a93df){if(_0x5a93df[_0x35fc('0x13')])throw new Error('Unable\x20to\x20retrieve\x20voice\x20queues\x20channels');return _0x55e9e7(_0x5a93df[_0x35fc('0x15')]);})['catch'](function(_0x1bf180){_0x33f5e8(_0x1bf180);});});}function initializeQueues(_0xdfab9f,_0x5cb986,_0x519264,_0x47774c){var _0x58edb6=[_0x35fc('0x20'),_0x35fc('0x21'),'waiting',_0x35fc('0x22'),_0x35fc('0x23')];if(_0x519264===_0x35fc('0x1a')&&_0x47774c===_0x35fc('0x24')){_0x58edb6[_0x35fc('0x25')](_0x35fc('0x26'),_0x35fc('0x27'),_0x35fc('0x28'),'dialActive',_0x35fc('0x29'),_0x35fc('0x2a'),_0x35fc('0x2b'),'startProgressive',_0x35fc('0x2c'),_0x35fc('0x2d'),_0x35fc('0x2e'),_0x35fc('0x2f'),_0x35fc('0x30'),_0x35fc('0x31'),_0x35fc('0x32'),_0x35fc('0x33'),_0x35fc('0x34'),_0x35fc('0x35'),'predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit',_0x35fc('0x36'),'predictiveIntervalAvgTalktime');}return _0xdfab9f[_0x35fc('0x37')](function(_0x39454e){var _0x1c4b8b=_0x39454e[_0x35fc('0x38')]({'plain':!![]});_0x1c4b8b[_0x35fc('0x39')]=[];_0x1c4b8b[_0x35fc('0x23')]=0x0;_0x1c4b8b['loggedInDb']=0x0;_0x1c4b8b[_0x35fc('0x20')]=0x0;_0x1c4b8b[_0x35fc('0x21')]=0x0;_0x1c4b8b[_0x35fc('0x3a')]=0x0;if(_0x519264===_0x35fc('0x1a')){_0x1c4b8b[_0x35fc('0x22')]=0x0;_0x1c4b8b[_0x35fc('0x3b')]=0x0;if(_0x47774c==='outbound'){_0x1c4b8b[_0x35fc('0x26')]=0x0;_0x1c4b8b[_0x35fc('0x27')]=0x0;}}var _0x1fecdf=_['find'](_0x5cb986,['id',_0x1c4b8b['id']]);if(_0x1fecdf)_[_0x35fc('0x18')](_0x1c4b8b,_['pick'](_0x1fecdf,_0x58edb6));return _0x1c4b8b;});}function updateAgentVoiceStatus(_0x2ecb2e,_0x33a377,_0x266a11){var _0x2e00e3=_['filter'](_0x266a11,['queue',_0x33a377['name']]);if(_0x2e00e3[_0x35fc('0x3c')]===0x0)return _0x2ecb2e['busy']=!![];if(_[_0x35fc('0x3d')](_0x2e00e3,['connectedlinenum',_0x2ecb2e[_0x35fc('0x3e')][_0x35fc('0x3f')]()]))return _0x2ecb2e[_0x35fc('0x22')]=!![];if(!_0x2ecb2e[_0x35fc('0x22')])return _0x2ecb2e[_0x35fc('0x3b')]=!![];}function getVoiceQueueAgents(_0x3313fa,_0x9fe7d6,_0x4ec0dc,_0x4467f8){var _0x16087d=_['find'](_0x9fe7d6,['id',_0x3313fa['id']]);if(!_0x16087d)return _0x3313fa;return _0x16087d[_0x35fc('0x40')]({'raw':!![]})[_0x35fc('0x12')](function(_0x1aac67){for(var _0x1d2ffe=0x0;_0x1d2ffe<_0x1aac67[_0x35fc('0x3c')];_0x1d2ffe++){var _0x31d926=_['find'](_0x4ec0dc,['id',_0x1aac67[_0x1d2ffe][_0x35fc('0x41')]]);if(!_0x31d926){_0x31d926={'id':_0x1aac67[_0x1d2ffe][_0x35fc('0x41')],'name':_0x1aac67[_0x1d2ffe][_0x35fc('0x41')],'accountcode':'','online':![]};}var _0x52543b={'id':_0x31d926['id'],'name':_0x31d926[_0x35fc('0x10')],'internal':_0x31d926[_0x35fc('0x42')],'online':Boolean(_0x31d926['online']),'paused':Boolean(_0x1aac67[_0x1d2ffe][_0x35fc('0x23')])};if(_0x31d926[_0x35fc('0x43')]===_0x35fc('0x22'))updateAgentVoiceStatus(_0x52543b,_0x3313fa,_0x4467f8);if(_0x52543b[_0x35fc('0x44')])_0x3313fa[_0x35fc('0x45')]++;if(_0x52543b[_0x35fc('0x3b')])_0x3313fa[_0x35fc('0x3b')]++;if(_0x52543b[_0x35fc('0x23')]&&!_0x52543b['busy']&&!_0x52543b['talking'])_0x3313fa[_0x35fc('0x23')]++;_0x3313fa[_0x35fc('0x39')]['push'](_0x52543b);}return _0x3313fa;});}function getQueueAgents(_0x5c2e5c,_0x4ff202,_0x79677d){var _0x10f98b='User'+_[_0x35fc('0x1c')](_0x79677d)+_0x35fc('0x46');var _0x1fb0a6=_0x79677d+_0x35fc('0x47');return db[_0x10f98b]['findAll']({'where':{[_['startCase'](_0x79677d)+'QueueId']:_0x5c2e5c['id']},'raw':!![]})['then'](function(_0x56bdb9){for(var _0xb26e3f=0x0;_0xb26e3f<_0x56bdb9[_0x35fc('0x3c')];_0xb26e3f++){var _0x4fc5bc=_[_0x35fc('0x48')](_0x4ff202,['id',_0x56bdb9[_0xb26e3f]['UserId']]);if(!_0x4fc5bc){_0x4fc5bc={'id':_0x56bdb9[_0xb26e3f][_0x35fc('0x41')],'name':_0x56bdb9[_0xb26e3f][_0x35fc('0x41')],'online':![],['pauseField']:![]};}var _0x350237={'id':_0x4fc5bc['id'],'name':_0x4fc5bc[_0x35fc('0x10')],'online':Boolean(_0x4fc5bc[_0x35fc('0x44')]),'paused':Boolean(_0x4fc5bc[_0x1fb0a6])};if(_0x350237['online'])_0x5c2e5c[_0x35fc('0x45')]++;_0x5c2e5c[_0x35fc('0x39')]['push'](_0x350237);}return _0x5c2e5c;});}function isIdle(_0x18181b){return _0x18181b===_0x35fc('0x49')||_0x18181b===_0x35fc('0x4a')||_0x18181b===_0x35fc('0x4b')||_0x18181b==='ringing'||_[_0x35fc('0x4c')](_0x18181b);}function isAgentPaused(_0x4c82d8,_0x583f67){var _0x1b6160=[_0x4c82d8[_0x35fc('0x4d')],_0x4c82d8[_0x35fc('0x4e')],_0x4c82d8[_0x35fc('0x4f')],_0x4c82d8[_0x35fc('0x50')],_0x4c82d8[_0x35fc('0x51')],_0x4c82d8[_0x35fc('0x52')],_0x4c82d8[_0x35fc('0x53')]];if(!_0x583f67)return _['every'](_0x1b6160);var _0x3e2961=_[_0x35fc('0x54')](_0x1b6160);return _0x3e2961[_0x35fc('0x3c')]>0x0&&_0x3e2961[_0x35fc('0x3c')]<_0x1b6160[_0x35fc('0x3c')]?!![]:![];}function isAgentIdle(_0x1e3221){if(_0x1e3221[_0x35fc('0x43')]!==_0x35fc('0x49')&&_0x1e3221[_0x35fc('0x52')]){_0x1e3221[_0x35fc('0x43')]=_0x35fc('0x55');return![];}return _[_0x35fc('0x56')]([_0x1e3221[_0x35fc('0x57')],_0x1e3221[_0x35fc('0x58')],_0x1e3221['mailStatus'],_0x1e3221['openchannelStatus'],_0x1e3221[_0x35fc('0x59')],_0x1e3221[_0x35fc('0x43')],_0x1e3221[_0x35fc('0x5a')]],isIdle);}function getAgentStatus(_0x2bf0b0){var _0x3ee296=_0x35fc('0x4a');if(isAgentPaused(_0x2bf0b0))_0x3ee296='pause';else if(isAgentPaused(_0x2bf0b0,!![]))_0x3ee296='*pause';else if(isAgentIdle(_0x2bf0b0))_0x3ee296=_0x35fc('0x49');else _0x3ee296=_0x35fc('0x3b');return _0x3ee296;}exports[_0x35fc('0x5b')]=function(_0x38bc78,_0x5b2595){var _0x467980={'count':0x0,'rows':[]},_0x13281f={},_0x4965d2,_0x199a00,_0x2536d3=[_0x35fc('0x5c'),_0x35fc('0x44'),_0x35fc('0x5d'),_0x35fc('0x5e'),'pauseType','lastPauseAt','internal',_0x35fc('0x5f'),_0x35fc('0x4d'),'openchannelPause',_0x35fc('0x4f'),_0x35fc('0x51'),_0x35fc('0x53'),_0x35fc('0x4e'),_0x35fc('0x52'),'chatCapacity',_0x35fc('0x60'),_0x35fc('0x61'),_0x35fc('0x62'),'whatsappCapacity',_0x35fc('0x63'),_0x35fc('0x64'),'openchannelCurrentCapacity',_0x35fc('0x65'),_0x35fc('0x66'),_0x35fc('0x67'),_0x35fc('0x68'),_0x35fc('0x57'),_0x35fc('0x69'),_0x35fc('0x6a'),_0x35fc('0x59'),'whatsappStatus',_0x35fc('0x58'),_0x35fc('0x43'),_0x35fc('0x6b'),'openchannelStatusTime',_0x35fc('0x6c'),'smsStatusTime','whatsappStatusTime','faxStatusTime',_0x35fc('0x6d'),_0x35fc('0x6e'),_0x35fc('0x6f'),_0x35fc('0x70'),_0x35fc('0x71'),'phoneBarEnableAutomaticScreenRecording','routealias'],_0x590faa=['chatPause','openchannelPause','mailPause',_0x35fc('0x51'),_0x35fc('0x53'),_0x35fc('0x4e'),_0x35fc('0x52'),'online'];Promise[_0x35fc('0x72')]()[_0x35fc('0x12')](function(){var _0x390e16=_[_0x35fc('0x37')](db[_0x35fc('0x73')][_0x35fc('0x74')],function(_0x27071b){return{'name':_0x27071b[_0x35fc('0x75')],'type':_0x27071b[_0x35fc('0x76')]['key']};});_0x38bc78[_0x35fc('0x77')]['role']=_0x35fc('0x78');_0x38bc78[_0x35fc('0x77')][_0x35fc('0x44')]=!![];_0x13281f=qs[_0x35fc('0x79')](_0x390e16,_0x38bc78);_0x13281f['raw']=!![];if(_0x38bc78[_0x35fc('0x7a')]['role']==='user'){var _0x5f1d4a={'params':{'id':_0x38bc78[_0x35fc('0x7a')]['userProfileId']},'query':{'section':_0x35fc('0x16'),'role':'agent','online':!![],'nolimit':_0x38bc78[_0x35fc('0x77')]['nolimit'],'sort':_0x38bc78[_0x35fc('0x77')][_0x35fc('0x7b')],'filter':_0x38bc78[_0x35fc('0x77')][_0x35fc('0x54')],'raw':!![]}};return db['UserProfile'][_0x35fc('0x7c')](_0x5f1d4a);}return db[_0x35fc('0x73')][_0x35fc('0x7d')](_0x13281f);})['then'](function(_0x3aa7fa){_0x467980[_0x35fc('0xa')]=_0x3aa7fa[_0x35fc('0xa')];_0x4965d2=_0x3aa7fa[_0x35fc('0x7e')];return getRealtimeAgents();})[_0x35fc('0x12')](function(_0x2c4309){_0x199a00=_0x2c4309[_0x35fc('0x7e')];return _0x4965d2[_0x35fc('0x37')](function(_0x5159a0){var _0x28a44b=_[_0x35fc('0x48')](_0x199a00,['id',_0x5159a0['id']]);if(_0x28a44b)_[_0x35fc('0x18')](_0x5159a0,_['pick'](_[_0x35fc('0x7f')](_0x28a44b,_0x590faa),_0x2536d3));_0x5159a0[_0x35fc('0x80')]=getAgentStatus(_0x5159a0);return _0x5159a0;});})['then'](function(_0x4d09d4){if(_0x38bc78[_0x35fc('0x77')]['globalStatusFilter']){var _0x223ad3=_[_0x35fc('0x54')](_0x4d09d4,[_0x35fc('0x80'),_0x38bc78[_0x35fc('0x77')][_0x35fc('0x81')]]);if(_0x38bc78[_0x35fc('0x77')][_0x35fc('0x82')]){_0x223ad3=_[_0x35fc('0x54')](_0x223ad3,[_0x35fc('0x83'),_0x38bc78[_0x35fc('0x77')][_0x35fc('0x82')]]);}}_0x467980[_0x35fc('0x7e')]=_0x223ad3||_0x4d09d4;return _0x467980;})[_0x35fc('0x12')](respondWithFilteredResult(_0x5b2595,_0x13281f))[_0x35fc('0x19')](handleError(_0x5b2595,null));};exports[_0x35fc('0x84')]=function(_0xd1e7ed,_0x2d8219){var _0x2d7b16=[_0x35fc('0x85'),_0x35fc('0x86'),'sms',_0x35fc('0x87'),'fax',_0x35fc('0x88'),_0x35fc('0x1a')];var _0x2185ce={'count':0x0,'rows':[]},_0x516b26={},_0x25af78,_0x3f56f4,_0x2913ba,_0x32023a,_0x2fed7b;Promise[_0x35fc('0x72')]()[_0x35fc('0x12')](function(){if(_0xd1e7ed['query'][_0x35fc('0x89')]){if(!_[_0x35fc('0x8a')](_0x2d7b16,_0xd1e7ed[_0x35fc('0x77')][_0x35fc('0x89')][_0x35fc('0x8b')]()))throw new Error(_0x35fc('0x8c'));_0x25af78=_0xd1e7ed['query'][_0x35fc('0x89')][_0x35fc('0x8b')]();}var _0x277514=_[_0x35fc('0x1c')](_0x25af78)+_0x35fc('0x46');var _0x3e2a8e=_[_0x35fc('0x37')](db[_0x277514][_0x35fc('0x74')],function(_0xa92234){return{'name':_0xa92234['fieldName'],'type':_0xa92234[_0x35fc('0x76')]['key']};});_0x516b26=qs[_0x35fc('0x79')](_0x3e2a8e,_0xd1e7ed);if(_0xd1e7ed[_0x35fc('0x7a')]['role']===_0x35fc('0x7a')){var _0x41002a={'params':{'id':_0xd1e7ed[_0x35fc('0x7a')][_0x35fc('0x8d')]},'query':{'section':_0x25af78===_0x35fc('0x1a')&&_0xd1e7ed[_0x35fc('0x77')][_0x35fc('0x76')]===_0x35fc('0x24')?_0x35fc('0x8e'):_['startCase'](_0x25af78)+'Queues','type':_0xd1e7ed['query']['type'],'nolimit':!![],'sort':_0x35fc('0x10'),'filter':_0xd1e7ed[_0x35fc('0x77')][_0x35fc('0x54')]}};return db[_0x35fc('0x8f')][_0x35fc('0x7c')](_0x41002a);}return db[_0x277514]['findAndCountAll'](_0x516b26);})[_0x35fc('0x12')](function(_0x19682e){_0x2185ce[_0x35fc('0xa')]=_0x19682e[_0x35fc('0xa')];_0x3f56f4=_0x19682e['rows'];return getRealtimeQueues(_0xd1e7ed,_0x25af78);})[_0x35fc('0x12')](function(_0x3ddd21){_0x32023a=_0x3ddd21[_0x35fc('0x7e')];return getRealtimeAgents();})['then'](function(_0x314886){_0x2913ba=_0x314886[_0x35fc('0x7e')];if(_0x25af78!=_0x35fc('0x1a'))return;return getRealtimeVoiceQueueChannels();})[_0x35fc('0x12')](function(_0x99c2a7){_0x2fed7b=_0x99c2a7?_0x99c2a7[_0x35fc('0x7e')]:[];return initializeQueues(_0x3f56f4,_0x32023a,_0x25af78,_0xd1e7ed[_0x35fc('0x77')][_0x35fc('0x76')]);})['then'](function(_0x2faff7){var _0xa2c5f8=_0x2faff7[_0x35fc('0x37')](function(_0x2799c8){if(_0x25af78===_0x35fc('0x1a'))return getVoiceQueueAgents(_0x2799c8,_0x3f56f4,_0x2913ba,_0x2fed7b);else return getQueueAgents(_0x2799c8,_0x2913ba,_0x25af78);});return Promise[_0x35fc('0x90')](_0xa2c5f8);})['then'](function(_0x495cf6){_0x2185ce['rows']=_0x495cf6;return _0x2185ce;})['then'](respondWithFilteredResult(_0x2d8219,_0x516b26))[_0x35fc('0x19')](handleError(_0x2d8219,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 104b2ce..6e1d094 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x44ba89,_0x40b031){var _0x557823=function(_0x7fcd83){while(--_0x7fcd83){_0x44ba89['push'](_0x44ba89['shift']());}};_0x557823(++_0x40b031);}(_0x70e0,0x17b));var _0x070e=function(_0x473ba7,_0x2b3493){_0x473ba7=_0x473ba7-0x0;var _0x4955d8=_0x70e0[_0x473ba7];return _0x4955d8;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x39dae4,_0x58a305){var _0x39ab08=function(_0x1ceb0c){while(--_0x1ceb0c){_0x39dae4['push'](_0x39dae4['shift']());}};_0x39ab08(++_0x58a305);}(_0x9c44,0x178));var _0x49c4=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9c44[_0x3b0731];return _0x4204d7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index f45d6df..01a7f82 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 _0x304b=['INTEGER','STRING','DATE','exports'];(function(_0x34db78,_0xe3935a){var _0x575188=function(_0x495959){while(--_0x495959){_0x34db78['push'](_0x34db78['shift']());}};_0x575188(++_0xe3935a);}(_0x304b,0xfb));var _0xb304=function(_0x311f21,_0x2d7bb1){_0x311f21=_0x311f21-0x0;var _0x413a76=_0x304b[_0x311f21];return _0x413a76;};'use strict';var Sequelize=require('sequelize');module[_0xb304('0x0')]={'state':{'type':Sequelize[_0xb304('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xb304('0x2')]},'scheduledat':{'type':Sequelize[_0xb304('0x3')]},'uniqueid':{'type':Sequelize[_0xb304('0x2')]},'starttime':{'type':Sequelize[_0xb304('0x3')]},'responsetime':{'type':Sequelize[_0xb304('0x3')]},'ringtime':{'type':Sequelize[_0xb304('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xb304('0x2')]}}; \ No newline at end of file +var _0xf2e0=['exports','STRING','DATE','INTEGER','sequelize'];(function(_0x52c526,_0x1da866){var _0x461dad=function(_0x239125){while(--_0x239125){_0x52c526['push'](_0x52c526['shift']());}};_0x461dad(++_0x1da866);}(_0xf2e0,0xc7));var _0x0f2e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xf2e0[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x0f2e('0x0'));module[_0x0f2e('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x0f2e('0x2')]},'scheduledat':{'type':Sequelize[_0x0f2e('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x0f2e('0x3')]},'responsetime':{'type':Sequelize[_0x0f2e('0x3')]},'ringtime':{'type':Sequelize[_0x0f2e('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x0f2e('0x2')]},'membername':{'type':Sequelize[_0x0f2e('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index d4e7870..e13f306 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 _0xa8f7=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview'];(function(_0x455b31,_0x45b54d){var _0x2221ff=function(_0x6906ad){while(--_0x6906ad){_0x455b31['push'](_0x455b31['shift']());}};_0x2221ff(++_0x45b54d);}(_0xa8f7,0xe4));var _0x7a8f=function(_0x584d76,_0xf8a139){_0x584d76=_0x584d76-0x0;var _0x40e8c1=_0xa8f7[_0x584d76];return _0x40e8c1;};'use strict';var _=require('lodash');var util=require(_0x7a8f('0x0'));var logger=require(_0x7a8f('0x1'))('api');var moment=require(_0x7a8f('0x2'));var BPromise=require(_0x7a8f('0x3'));var rp=require(_0x7a8f('0x4'));var fs=require('fs');var path=require(_0x7a8f('0x5'));var rimraf=require(_0x7a8f('0x6'));var config=require('../../config/environment');var attributes=require(_0x7a8f('0x7'));module[_0x7a8f('0x8')]=function(_0x3eadbd,_0x164b0e){return _0x3eadbd[_0x7a8f('0x9')](_0x7a8f('0xa'),attributes,{'tableName':_0x7a8f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x984c=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./reportAgentPreview.attributes','define','ReportAgentPreview','report_agent_preview'];(function(_0x410f0a,_0x4c8394){var _0x27defa=function(_0x122d56){while(--_0x122d56){_0x410f0a['push'](_0x410f0a['shift']());}};_0x27defa(++_0x4c8394);}(_0x984c,0x198));var _0xc984=function(_0x3791e3,_0x100979){_0x3791e3=_0x3791e3-0x0;var _0x21d424=_0x984c[_0x3791e3];return _0x21d424;};'use strict';var _=require(_0xc984('0x0'));var util=require('util');var logger=require(_0xc984('0x1'))(_0xc984('0x2'));var moment=require(_0xc984('0x3'));var BPromise=require(_0xc984('0x4'));var rp=require(_0xc984('0x5'));var fs=require('fs');var path=require(_0xc984('0x6'));var rimraf=require('rimraf');var config=require(_0xc984('0x7'));var attributes=require(_0xc984('0x8'));module['exports']=function(_0x411ab7,_0x1c3028){return _0x411ab7[_0xc984('0x9')](_0xc984('0xa'),attributes,{'tableName':_0xc984('0xb'),'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 d2feee8..20bdc93 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 _0x2370=['message','result','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x2370,0x1ef));var _0x0237=function(_0xfcc0e,_0x1da886){_0xfcc0e=_0xfcc0e-0x0;var _0x32bb2e=_0x2370[_0xfcc0e];return _0x32bb2e;};'use strict';var _=require(_0x0237('0x0'));var util=require(_0x0237('0x1'));var moment=require(_0x0237('0x2'));var BPromise=require(_0x0237('0x3'));var rs=require(_0x0237('0x4'));var fs=require('fs');var Redis=require(_0x0237('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0237('0x6'))('rpc');var config=require(_0x0237('0x7'));var jayson=require(_0x0237('0x8'));var client=jayson[_0x0237('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b6eaf,_0x1afd42,_0x4a2ea7){return new BPromise(function(_0x17d324,_0x53f8f1){return client[_0x0237('0xa')](_0x3b6eaf,_0x4a2ea7)[_0x0237('0xb')](function(_0x4d9260){logger[_0x0237('0xc')](_0x0237('0xd'),_0x1afd42,_0x0237('0xe'));logger[_0x0237('0xf')](_0x0237('0x10'),_0x1afd42,_0x0237('0xe'),JSON['stringify'](_0x4d9260));if(_0x4d9260[_0x0237('0x11')]){if(_0x4d9260['error']['code']===0x1f4){logger['error'](_0x0237('0xd'),_0x1afd42,_0x4d9260['error'][_0x0237('0x12')]);return _0x53f8f1(_0x4d9260[_0x0237('0x11')]['message']);}logger[_0x0237('0x11')](_0x0237('0xd'),_0x1afd42,_0x4d9260[_0x0237('0x11')][_0x0237('0x12')]);return _0x17d324(_0x4d9260[_0x0237('0x11')][_0x0237('0x12')]);}else{logger[_0x0237('0xc')](_0x0237('0xd'),_0x1afd42,_0x0237('0xe'));_0x17d324(_0x4d9260[_0x0237('0x13')]['message']);}})['catch'](function(_0x2d6ae1){logger[_0x0237('0x11')](_0x0237('0xd'),_0x1afd42,_0x2d6ae1);_0x53f8f1(_0x2d6ae1);});});}exports[_0x0237('0x14')]=function(_0x37fc7d){var _0x579dca=this;return new Promise(function(_0x70676f,_0x3a6bdd){return db[_0x0237('0x15')][_0x0237('0x16')](_0x37fc7d[_0x0237('0x17')],{'raw':_0x37fc7d[_0x0237('0x18')]?_0x37fc7d['options'][_0x0237('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x25f146){logger[_0x0237('0xc')]('CreateReportAgentPreview',_0x37fc7d);logger[_0x0237('0xf')](_0x0237('0x14'),_0x37fc7d,JSON['stringify'](_0x25f146));_0x70676f(_0x25f146);})[_0x0237('0x1a')](function(_0xa55f31){logger[_0x0237('0x11')]('CreateReportAgentPreview',_0xa55f31[_0x0237('0x12')],_0x37fc7d);_0x3a6bdd(_0x579dca['error'](0x1f4,_0xa55f31[_0x0237('0x12')]));});});}; \ No newline at end of file +var _0x337f=['result','CreateReportAgentPreview','ReportAgentPreview','create','options','catch','util','moment','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x216d31,_0x2901c3){var _0x1829f8=function(_0x4ed27d){while(--_0x4ed27d){_0x216d31['push'](_0x216d31['shift']());}};_0x1829f8(++_0x2901c3);}(_0x337f,0xa7));var _0xf337=function(_0x353b3c,_0x5da02b){_0x353b3c=_0x353b3c-0x0;var _0x2c7201=_0x337f[_0x353b3c];return _0x2c7201;};'use strict';var _=require('lodash');var util=require(_0xf337('0x0'));var moment=require(_0xf337('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf337('0x2'));var logger=require(_0xf337('0x3'))(_0xf337('0x4'));var config=require('../../config/environment');var jayson=require(_0xf337('0x5'));var client=jayson['client'][_0xf337('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4d00b8,_0x213994,_0x15ef38){return new BPromise(function(_0x512e6a,_0x6a7420){return client[_0xf337('0x7')](_0x4d00b8,_0x15ef38)[_0xf337('0x8')](function(_0xfa8d1d){logger[_0xf337('0x9')](_0xf337('0xa'),_0x213994,_0xf337('0xb'));logger[_0xf337('0xc')](_0xf337('0xd'),_0x213994,'request\x20sent',JSON['stringify'](_0xfa8d1d));if(_0xfa8d1d[_0xf337('0xe')]){if(_0xfa8d1d[_0xf337('0xe')][_0xf337('0xf')]===0x1f4){logger[_0xf337('0xe')](_0xf337('0xa'),_0x213994,_0xfa8d1d['error'][_0xf337('0x10')]);return _0x6a7420(_0xfa8d1d['error']['message']);}logger[_0xf337('0xe')](_0xf337('0xa'),_0x213994,_0xfa8d1d[_0xf337('0xe')][_0xf337('0x10')]);return _0x512e6a(_0xfa8d1d[_0xf337('0xe')][_0xf337('0x10')]);}else{logger[_0xf337('0x9')](_0xf337('0xa'),_0x213994,'request\x20sent');_0x512e6a(_0xfa8d1d[_0xf337('0x11')][_0xf337('0x10')]);}})['catch'](function(_0xe7a2ff){logger[_0xf337('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x213994,_0xe7a2ff);_0x6a7420(_0xe7a2ff);});});}exports[_0xf337('0x12')]=function(_0x5d4d19){var _0x146896=this;return new Promise(function(_0x26f5dc,_0x1ac4cc){return db[_0xf337('0x13')][_0xf337('0x14')](_0x5d4d19['body'],{'raw':_0x5d4d19[_0xf337('0x15')]?_0x5d4d19['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x51a505){logger['info']('CreateReportAgentPreview',_0x5d4d19);logger[_0xf337('0xc')](_0xf337('0x12'),_0x5d4d19,JSON['stringify'](_0x51a505));_0x26f5dc(_0x51a505);})[_0xf337('0x16')](function(_0x36a02a){logger[_0xf337('0xe')](_0xf337('0x12'),_0x36a02a[_0xf337('0x10')],_0x5d4d19);_0x1ac4cc(_0x146896['error'](0x1f4,_0x36a02a[_0xf337('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index e805962..c8319e2 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 _0x257b=['queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','util','path','Router','../../components/auth/service','./rpc.controller','/voice/channels','get','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','/voice/queues/:id','updateVoiceQueue','outbound','outboundChannels','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesIdWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify'];(function(_0x531726,_0x41c9bc){var _0x2cf3d8=function(_0x3b8906){while(--_0x3b8906){_0x531726['push'](_0x531726['shift']());}};_0x2cf3d8(++_0x41c9bc);}(_0x257b,0x1e5));var _0xb257=function(_0x26fde3,_0x5b560d){_0x26fde3=_0x26fde3-0x0;var _0x1018ce=_0x257b[_0x26fde3];return _0x1018ce;};'use strict';var multer=require('multer');var util=require(_0xb257('0x0'));var path=require(_0xb257('0x1'));var express=require('express');var router=express[_0xb257('0x2')]();var auth=require(_0xb257('0x3'));var controller=require(_0xb257('0x4'));router['get'](_0xb257('0x5'),auth['isAuthenticated'](),controller['voiceChannels']);router[_0xb257('0x6')](_0xb257('0x7'),auth[_0xb257('0x8')](),controller[_0xb257('0x9')]);router[_0xb257('0x6')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0xb257('0x8')](),controller['voiceChannelStopMixMonitor']);router[_0xb257('0x6')](_0xb257('0xa'),auth[_0xb257('0x8')](),controller['voiceQueues']);router[_0xb257('0x6')](_0xb257('0xb'),auth[_0xb257('0x8')](),controller[_0xb257('0xc')]);router[_0xb257('0x6')](_0xb257('0xd'),auth['isAuthenticated'](),controller['mailQueues']);router[_0xb257('0x6')]('/mail/accounts',auth[_0xb257('0x8')](),controller[_0xb257('0xe')]);router[_0xb257('0x6')](_0xb257('0xf'),auth['isAuthenticated'](),controller[_0xb257('0x10')]);router['get']('/sms/queues',auth[_0xb257('0x8')](),controller[_0xb257('0x11')]);router['get'](_0xb257('0x12'),auth['isAuthenticated'](),controller[_0xb257('0x13')]);router[_0xb257('0x6')]('/fax/queues',auth[_0xb257('0x8')](),controller[_0xb257('0x14')]);router[_0xb257('0x6')](_0xb257('0x15'),auth[_0xb257('0x8')](),controller[_0xb257('0x16')]);router[_0xb257('0x6')](_0xb257('0x17'),auth[_0xb257('0x8')](),controller['voiceQueuesChannels']);router[_0xb257('0x6')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0xb257('0x18')]);router[_0xb257('0x6')]('/voice/queues/channels/:uniqueid/hangup',auth[_0xb257('0x8')](),controller[_0xb257('0x19')]);router[_0xb257('0x6')](_0xb257('0x1a'),auth[_0xb257('0x8')](),controller[_0xb257('0x1b')]);router[_0xb257('0x6')]('/voice/queues/:id',auth[_0xb257('0x8')](),controller[_0xb257('0x1c')]);router['put'](_0xb257('0x1d'),auth[_0xb257('0x8')](),controller[_0xb257('0x1e')]);router[_0xb257('0x6')]('/outbound',auth[_0xb257('0x8')](),controller[_0xb257('0x1f')]);router[_0xb257('0x6')]('/outbound/channels',auth[_0xb257('0x8')](),controller[_0xb257('0x20')]);router[_0xb257('0x6')]('/agents',auth[_0xb257('0x8')](),controller[_0xb257('0x21')]);router[_0xb257('0x22')](_0xb257('0x23'),auth['isAuthenticated'](),controller[_0xb257('0x24')]);router['get'](_0xb257('0x25'),auth[_0xb257('0x8')](),controller[_0xb257('0x26')]);router[_0xb257('0x6')](_0xb257('0x27'),auth[_0xb257('0x8')](),controller[_0xb257('0x28')]);router[_0xb257('0x6')](_0xb257('0x29'),auth[_0xb257('0x8')](),controller['campaigns']);router['get']('/fax/accounts',auth[_0xb257('0x8')](),controller[_0xb257('0x2a')]);router[_0xb257('0x6')](_0xb257('0x2b'),auth[_0xb257('0x8')](),controller[_0xb257('0x2c')]);router['get'](_0xb257('0x2d'),auth[_0xb257('0x8')](),controller[_0xb257('0x2e')]);router[_0xb257('0x6')](_0xb257('0x2f'),auth[_0xb257('0x8')](),controller['openchannelQueuesWaitingInteractions']);router[_0xb257('0x6')]('/openchannel/queues/:id/waitinginteractions',auth['isAuthenticated'](),controller[_0xb257('0x30')]);router['get']('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller['smsQueuesWaitingInteractions']);router[_0xb257('0x6')]('/whatsapp/queues/waitinginteractions',auth[_0xb257('0x8')](),controller[_0xb257('0x31')]);router[_0xb257('0x6')](_0xb257('0x32'),auth[_0xb257('0x8')](),controller[_0xb257('0x33')]);router[_0xb257('0x34')](_0xb257('0x35'),auth[_0xb257('0x8')](),controller[_0xb257('0x36')](_0xb257('0x37')));router[_0xb257('0x6')](_0xb257('0x38'),auth[_0xb257('0x8')](),controller[_0xb257('0x39')]);router['post']('/chat/queues/:id/notify',auth[_0xb257('0x8')](),controller[_0xb257('0x36')]('chat'));router[_0xb257('0x6')](_0xb257('0x3a'),auth[_0xb257('0x8')](),controller[_0xb257('0x3b')]);router['post'](_0xb257('0x3c'),auth[_0xb257('0x8')](),controller[_0xb257('0x36')](_0xb257('0x3d')));router[_0xb257('0x6')](_0xb257('0x3e'),auth[_0xb257('0x8')](),controller[_0xb257('0x3f')]);router['post'](_0xb257('0x40'),auth[_0xb257('0x8')](),controller[_0xb257('0x36')]('openchannel'));router[_0xb257('0x6')]('/openchannel/queues/:id',auth[_0xb257('0x8')](),controller[_0xb257('0x41')]);router[_0xb257('0x34')](_0xb257('0x42'),auth[_0xb257('0x8')](),controller['queueNotify'](_0xb257('0x43')));router[_0xb257('0x34')](_0xb257('0x44'),auth[_0xb257('0x8')](),controller[_0xb257('0x36')](_0xb257('0x45')));router['get'](_0xb257('0x46'),auth['isAuthenticated'](),controller[_0xb257('0x47')]);router['get'](_0xb257('0x48'),auth[_0xb257('0x8')](),controller[_0xb257('0x49')]);router['post'](_0xb257('0x4a'),auth[_0xb257('0x8')](),controller[_0xb257('0x4b')]);module[_0xb257('0x4c')]=router; \ No newline at end of file +var _0x7505=['openchannelQueues','/sms/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','/outbound','outbound','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','isAuthenticated','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailAccounts','/openchannel/queues'];(function(_0x1dffcc,_0x1fb905){var _0x5a773e=function(_0x9a4d48){while(--_0x9a4d48){_0x1dffcc['push'](_0x1dffcc['shift']());}};_0x5a773e(++_0x1fb905);}(_0x7505,0x1cc));var _0x5750=function(_0x1ca839,_0x2b52df){_0x1ca839=_0x1ca839-0x0;var _0x595b68=_0x7505[_0x1ca839];return _0x595b68;};'use strict';var multer=require(_0x5750('0x0'));var util=require(_0x5750('0x1'));var path=require(_0x5750('0x2'));var express=require('express');var router=express[_0x5750('0x3')]();var auth=require(_0x5750('0x4'));var controller=require(_0x5750('0x5'));router[_0x5750('0x6')](_0x5750('0x7'),auth['isAuthenticated'](),controller[_0x5750('0x8')]);router['get'](_0x5750('0x9'),auth['isAuthenticated'](),controller[_0x5750('0xa')]);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x5750('0xb')](),controller[_0x5750('0xc')]);router['get'](_0x5750('0xd'),auth[_0x5750('0xb')](),controller[_0x5750('0xe')]);router[_0x5750('0x6')](_0x5750('0xf'),auth[_0x5750('0xb')](),controller[_0x5750('0x10')]);router['get'](_0x5750('0x11'),auth['isAuthenticated'](),controller['mailQueues']);router[_0x5750('0x6')]('/mail/accounts',auth[_0x5750('0xb')](),controller[_0x5750('0x12')]);router['get'](_0x5750('0x13'),auth[_0x5750('0xb')](),controller[_0x5750('0x14')]);router['get'](_0x5750('0x15'),auth[_0x5750('0xb')](),controller['smsQueues']);router[_0x5750('0x6')]('/whatsapp/queues',auth[_0x5750('0xb')](),controller['whatsappQueues']);router[_0x5750('0x6')](_0x5750('0x16'),auth[_0x5750('0xb')](),controller[_0x5750('0x17')]);router[_0x5750('0x6')](_0x5750('0x18'),auth[_0x5750('0xb')](),controller[_0x5750('0x19')]);router[_0x5750('0x6')](_0x5750('0x1a'),auth['isAuthenticated'](),controller[_0x5750('0x1b')]);router[_0x5750('0x6')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0x5750('0x1c')]);router[_0x5750('0x6')](_0x5750('0x1d'),auth['isAuthenticated'](),controller['voiceQueuesChannelHangup']);router[_0x5750('0x6')](_0x5750('0x1e'),auth[_0x5750('0xb')](),controller['voiceQueuesChannelRedirect']);router[_0x5750('0x6')](_0x5750('0x1f'),auth[_0x5750('0xb')](),controller[_0x5750('0x20')]);router[_0x5750('0x21')]('/voice/queues/:id',auth[_0x5750('0xb')](),controller['updateVoiceQueue']);router[_0x5750('0x6')](_0x5750('0x22'),auth['isAuthenticated'](),controller[_0x5750('0x23')]);router[_0x5750('0x6')]('/outbound/channels',auth[_0x5750('0xb')](),controller[_0x5750('0x24')]);router[_0x5750('0x6')](_0x5750('0x25'),auth['isAuthenticated'](),controller[_0x5750('0x26')]);router['put'](_0x5750('0x27'),auth[_0x5750('0xb')](),controller[_0x5750('0x28')]);router[_0x5750('0x6')](_0x5750('0x29'),auth[_0x5750('0xb')](),controller[_0x5750('0x2a')]);router['get'](_0x5750('0x2b'),auth[_0x5750('0xb')](),controller['trunks']);router[_0x5750('0x6')](_0x5750('0x2c'),auth[_0x5750('0xb')](),controller[_0x5750('0x2d')]);router[_0x5750('0x6')](_0x5750('0x2e'),auth['isAuthenticated'](),controller[_0x5750('0x2f')]);router[_0x5750('0x6')]('/chat/queues/waitinginteractions',auth[_0x5750('0xb')](),controller[_0x5750('0x30')]);router[_0x5750('0x6')]('/mail/queues/waitinginteractions',auth[_0x5750('0xb')](),controller[_0x5750('0x31')]);router[_0x5750('0x6')](_0x5750('0x32'),auth[_0x5750('0xb')](),controller[_0x5750('0x33')]);router[_0x5750('0x6')](_0x5750('0x34'),auth[_0x5750('0xb')](),controller[_0x5750('0x35')]);router['get'](_0x5750('0x36'),auth[_0x5750('0xb')](),controller['smsQueuesWaitingInteractions']);router[_0x5750('0x6')]('/whatsapp/queues/waitinginteractions',auth[_0x5750('0xb')](),controller[_0x5750('0x37')]);router['get'](_0x5750('0x38'),auth[_0x5750('0xb')](),controller['faxQueuesWaitingInteractions']);router[_0x5750('0x39')](_0x5750('0x3a'),auth[_0x5750('0xb')](),controller[_0x5750('0x3b')](_0x5750('0x3c')));router['get'](_0x5750('0x3d'),auth[_0x5750('0xb')](),controller[_0x5750('0x3e')]);router[_0x5750('0x39')](_0x5750('0x3f'),auth[_0x5750('0xb')](),controller[_0x5750('0x3b')](_0x5750('0x40')));router[_0x5750('0x6')](_0x5750('0x41'),auth['isAuthenticated'](),controller[_0x5750('0x42')]);router['post'](_0x5750('0x43'),auth[_0x5750('0xb')](),controller[_0x5750('0x3b')]('fax'));router['get']('/fax/queues/:id',auth[_0x5750('0xb')](),controller[_0x5750('0x44')]);router[_0x5750('0x39')](_0x5750('0x45'),auth[_0x5750('0xb')](),controller['queueNotify'](_0x5750('0x46')));router['get'](_0x5750('0x47'),auth[_0x5750('0xb')](),controller[_0x5750('0x48')]);router['post'](_0x5750('0x49'),auth[_0x5750('0xb')](),controller[_0x5750('0x3b')]('sms'));router[_0x5750('0x39')]('/whatsapp/queues/:id/notify',auth[_0x5750('0xb')](),controller['queueNotify'](_0x5750('0x4a')));router[_0x5750('0x6')](_0x5750('0x4b'),auth['isAuthenticated'](),controller[_0x5750('0x4c')]);router[_0x5750('0x6')]('/whatsapp/queues/:id',auth['isAuthenticated'](),controller['showWhatsappQueues']);router[_0x5750('0x39')](_0x5750('0x4d'),auth[_0x5750('0xb')](),controller[_0x5750('0x4e')]);module[_0x5750('0x4f')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 475ed22..05674d0 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 _0x1cb9=['query','params','voiceChannelStopMixMonitor','voiceQueues','VoiceQueues','updateVoiceQueue','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelRedirect','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','MemberReport','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','length','findOrCreate','agent','AgentCapacity','telephones','trunks','Trunks','campaigns','Campaigns','ChatQueues','showChatQueues','MailQueues','mailAccounts','MailAccounts','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','map','value','filter','indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','findOne','\x20Queue\x20not\x20found','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','User','Agent\x20not\x20found','Message','bluebird','lodash','util','../../mysqldb','../../config/logger','jayson/promise','client','http','then','error','code','message','result','status','json','sendStatus','name','send','isNil','rows','find','voiceChannels','VoiceChannels','catch','voiceChannelMixMonitor','merge'];(function(_0xbed58e,_0x3a1272){var _0x295e44=function(_0x45755a){while(--_0x45755a){_0xbed58e['push'](_0xbed58e['shift']());}};_0x295e44(++_0x3a1272);}(_0x1cb9,0x14e));var _0x91cb=function(_0x2f9f50,_0x201f3e){_0x2f9f50=_0x2f9f50-0x0;var _0x4169bb=_0x1cb9[_0x2f9f50];return _0x4169bb;};'use strict';var BPromise=require(_0x91cb('0x0'));var moment=require('moment');var _=require(_0x91cb('0x1'));var util=require(_0x91cb('0x2'));var db=require(_0x91cb('0x3'))['db'];var logger=require(_0x91cb('0x4'))('api');var jayson=require(_0x91cb('0x5'));var amiClient=jayson[_0x91cb('0x6')]['http']({'port':0x232a});var mailClient=jayson[_0x91cb('0x6')][_0x91cb('0x7')]({'port':0x232b});var routingClient=jayson[_0x91cb('0x6')][_0x91cb('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){var _0x2fdfce=_0x4c1f56?_0x4c1f56:amiClient;return _0x2fdfce['request'](_0x3b9d98,_0x8f8a3b)[_0x91cb('0x8')](function(_0x317df0){if(_0x317df0[_0x91cb('0x9')]){if(_0x317df0[_0x91cb('0x9')][_0x91cb('0xa')]===0x1f4){return _0x5bda2f(_0x317df0[_0x91cb('0x9')][_0x91cb('0xb')]);}return _0x15c517(_0x317df0[_0x91cb('0x9')][_0x91cb('0xb')]);}else{_0x15c517(_0x317df0[_0x91cb('0xc')]);}})['catch'](function(_0x3c1f56){_0x5bda2f(_0x3c1f56);});});}function respondWithResult(_0x366f09,_0x4ba2f2){_0x4ba2f2=_0x4ba2f2||0xc8;return function(_0x20e6e0){if(_0x20e6e0){return _0x366f09[_0x91cb('0xd')](_0x4ba2f2)[_0x91cb('0xe')](_0x20e6e0);}return _0x366f09[_0x91cb('0xf')](0x194);};}function handleError(_0x4a7d45,_0x4cc6ef){_0x4cc6ef=_0x4cc6ef||0x1f4;return function(_0x4aae25){logger[_0x91cb('0x9')](_0x4aae25['stack']);if(_0x4aae25['name']){delete _0x4aae25[_0x91cb('0x10')];}_0x4a7d45[_0x91cb('0xd')](_0x4cc6ef)[_0x91cb('0x11')](_0x4aae25);};}function findById(_0x5ea796){return function(_0x238f11){if(!_[_0x91cb('0x12')](_0x5ea796)&&!_['isNil'](_0x238f11)&&!_[_0x91cb('0x12')](_0x238f11[_0x91cb('0x13')])){return _[_0x91cb('0x14')](_0x238f11[_0x91cb('0x13')],function(_0x5cc1c3){return _0x5cc1c3['id']==_0x5ea796;});}return null;};}exports[_0x91cb('0x15')]=function(_0x7dcf60,_0x4ca8e8){return respondWithRpcPromise(_0x91cb('0x16'),_0x7dcf60['query'])['then'](respondWithResult(_0x4ca8e8,null))[_0x91cb('0x17')](handleError(_0x4ca8e8,null));};exports[_0x91cb('0x18')]=function(_0x56e409,_0x51a1d5){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x91cb('0x19')](_0x56e409[_0x91cb('0x1a')],_0x56e409[_0x91cb('0x1b')]))[_0x91cb('0x8')](respondWithResult(_0x51a1d5,null))['catch'](handleError(_0x51a1d5,null));};exports[_0x91cb('0x1c')]=function(_0x43881c,_0x1fa837){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x91cb('0x19')](_0x43881c[_0x91cb('0x1a')],_0x43881c[_0x91cb('0x1b')]))[_0x91cb('0x8')](respondWithResult(_0x1fa837,null))[_0x91cb('0x17')](handleError(_0x1fa837,null));};exports[_0x91cb('0x1d')]=function(_0x414e60,_0x423c4f){return respondWithRpcPromise(_0x91cb('0x1e'),_0x414e60['query'])['then'](respondWithResult(_0x423c4f,null))[_0x91cb('0x17')](handleError(_0x423c4f,null));};exports['showVoiceQueues']=function(_0x1c67d2,_0x34d372){return respondWithRpcPromise(_0x91cb('0x1e'),_0x1c67d2['query'])[_0x91cb('0x8')](findById(_0x1c67d2['params']['id']))[_0x91cb('0x8')](respondWithResult(_0x34d372,null))[_0x91cb('0x17')](handleError(_0x34d372,null));};exports[_0x91cb('0x1f')]=function(_0x2fb473,_0x468908){return respondWithRpcPromise('UpdateVoiceQueue',_[_0x91cb('0x19')](_0x2fb473['body'],_0x2fb473[_0x91cb('0x1b')]))[_0x91cb('0x8')](respondWithResult(_0x468908,null))[_0x91cb('0x17')](handleError(_0x468908,null));};exports['voiceQueuesPreview']=function(_0x775c25,_0x146e1f){return respondWithRpcPromise(_0x91cb('0x20'),_[_0x91cb('0x19')](_0x775c25[_0x91cb('0x1a')],_0x775c25[_0x91cb('0x1b')]))[_0x91cb('0x8')](respondWithResult(_0x146e1f,null))[_0x91cb('0x17')](handleError(_0x146e1f,null));};exports[_0x91cb('0x21')]=function(_0x5e6ed3,_0x2ccf6e){return respondWithRpcPromise(_0x91cb('0x22'),_0x5e6ed3[_0x91cb('0x1a')])[_0x91cb('0x8')](respondWithResult(_0x2ccf6e,null))[_0x91cb('0x17')](handleError(_0x2ccf6e,null));};exports['voiceQueuesChannel']=function(_0x2409d3,_0x74b443){return respondWithRpcPromise(_0x91cb('0x23'),_[_0x91cb('0x19')](_0x2409d3[_0x91cb('0x1a')],_0x2409d3['params']))[_0x91cb('0x8')](respondWithResult(_0x74b443,null))['catch'](handleError(_0x74b443,null));};exports['voiceQueuesChannelHangup']=function(_0x479968,_0x2011fc){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x91cb('0x19')](_0x479968['query'],_0x479968['params']))[_0x91cb('0x8')](respondWithResult(_0x2011fc,null))[_0x91cb('0x17')](handleError(_0x2011fc,null));};exports[_0x91cb('0x24')]=function(_0x14319b,_0x2d8fb9){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x91cb('0x19')](_0x14319b[_0x91cb('0x1a')],_0x14319b[_0x91cb('0x1b')]))[_0x91cb('0x8')](respondWithResult(_0x2d8fb9,null))['catch'](handleError(_0x2d8fb9,null));};exports['outbound']=function(_0x1eed21,_0x135bf1){return respondWithRpcPromise('Outbound',_0x1eed21[_0x91cb('0x1a')])[_0x91cb('0x8')](respondWithResult(_0x135bf1,null))['catch'](handleError(_0x135bf1,null));};exports[_0x91cb('0x25')]=function(_0xddc409,_0x5f456c){return respondWithRpcPromise(_0x91cb('0x26'),_0xddc409['query'])[_0x91cb('0x8')](respondWithResult(_0x5f456c,null))[_0x91cb('0x17')](handleError(_0x5f456c,null));};exports[_0x91cb('0x27')]=function(_0x279ad5,_0x51d0ea){var _0x20bf50;return respondWithRpcPromise('Agents',_0x279ad5[_0x91cb('0x1a')])[_0x91cb('0x8')](function(_0x4e5b4b){_0x20bf50=_0x4e5b4b;return respondWithRpcPromise(_0x91cb('0x28'),_0x279ad5['query'],routingClient);})[_0x91cb('0x8')](function(_0x2eac87){return _[_0x91cb('0x19')]({},_0x2eac87,_0x20bf50);})[_0x91cb('0x8')](respondWithResult(_0x51d0ea,null))['catch'](handleError(_0x51d0ea,null));};exports[_0x91cb('0x29')]=function(_0x5af0e6,_0x2cf27e){if(_0x5af0e6[_0x91cb('0x2a')]&&_0x5af0e6[_0x91cb('0x2a')][_0x91cb('0x2b')]&&_0x5af0e6[_0x91cb('0x2c')]&&_0x5af0e6[_0x91cb('0x2c')][_0x91cb('0x10')]){for(var _0x3cc4c1 in _0x5af0e6['body'][_0x91cb('0x2b')]){if(_0x5af0e6['body'][_0x91cb('0x2b')]['hasOwnProperty'](_0x3cc4c1)){db[_0x91cb('0x2d')]['findAll']({'where':{'channel':_0x3cc4c1,'membername':_0x5af0e6[_0x91cb('0x2c')][_0x91cb('0x10')],'type':_0x91cb('0x2e'),'exitAt':null,'uniqueid':_0x5af0e6[_0x91cb('0x2a')]['interaction'][_0x3cc4c1]&&_0x5af0e6[_0x91cb('0x2a')][_0x91cb('0x2b')][_0x3cc4c1]['length']?{'$notIn':_0x5af0e6[_0x91cb('0x2a')][_0x91cb('0x2b')][_0x3cc4c1]}:{'$ne':null}}})[_0x91cb('0x8')](function(_0x32517d){var _0x267efb=moment()[_0x91cb('0x2f')](_0x91cb('0x30'));for(var _0x29d5a1=0x0,_0x396b81=_0x32517d['length'];_0x29d5a1<_0x396b81;_0x29d5a1+=0x1){_0x32517d[_0x29d5a1][_0x91cb('0x31')]({'exitAt':_0x267efb});}});for(var _0x3e20d1=0x0;_0x3e20d1<_0x5af0e6[_0x91cb('0x2a')][_0x91cb('0x2b')][_0x3cc4c1][_0x91cb('0x32')];_0x3e20d1+=0x1){db[_0x91cb('0x2d')][_0x91cb('0x33')]({'where':{'channel':_0x3cc4c1,'membername':_0x5af0e6[_0x91cb('0x2c')]['name'],'type':_0x91cb('0x2e'),'uniqueid':_0x5af0e6[_0x91cb('0x2a')][_0x91cb('0x2b')][_0x3cc4c1][_0x3e20d1],'exitAt':null},'defaults':{'channel':_0x3cc4c1,'membername':_0x5af0e6[_0x91cb('0x2c')]['name'],'interface':_[_0x91cb('0x12')](_0x5af0e6[_0x91cb('0x2c')]['interface'])?util[_0x91cb('0x2f')]('SIP/%s',_0x5af0e6[_0x91cb('0x2c')]['name']):_0x5af0e6['user']['interface'],'type':_0x91cb('0x2e'),'enterAt':moment()[_0x91cb('0x2f')](_0x91cb('0x30')),'role':_0x91cb('0x34'),'internal':_0x5af0e6[_0x91cb('0x2c')]['internal'],'uniqueid':_0x5af0e6['body'][_0x91cb('0x2b')][_0x3cc4c1][_0x3e20d1]}});}}}}return respondWithRpcPromise(_0x91cb('0x35'),{'id':_0x5af0e6[_0x91cb('0x1b')]['id'],'capacity':_0x5af0e6[_0x91cb('0x2a')]['capacity']},routingClient)['then'](respondWithResult(_0x2cf27e,null))['catch'](handleError(_0x2cf27e,null));};exports[_0x91cb('0x36')]=function(_0x490417,_0x3f22a1){return respondWithRpcPromise('Telephones',_0x490417[_0x91cb('0x1a')])[_0x91cb('0x8')](respondWithResult(_0x3f22a1,null))[_0x91cb('0x17')](handleError(_0x3f22a1,null));};exports[_0x91cb('0x37')]=function(_0x1884bc,_0x362532){return respondWithRpcPromise(_0x91cb('0x38'),_0x1884bc[_0x91cb('0x1a')])[_0x91cb('0x8')](respondWithResult(_0x362532,null))[_0x91cb('0x17')](handleError(_0x362532,null));};exports[_0x91cb('0x39')]=function(_0x5752ed,_0x1e445a){return respondWithRpcPromise(_0x91cb('0x3a'),_0x5752ed['query'])[_0x91cb('0x8')](respondWithResult(_0x1e445a,null))[_0x91cb('0x17')](handleError(_0x1e445a,null));};exports['chatQueues']=function(_0x2f5311,_0x166eeb){return respondWithRpcPromise(_0x91cb('0x3b'),_0x2f5311[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](respondWithResult(_0x166eeb,null))[_0x91cb('0x17')](handleError(_0x166eeb,null));};exports[_0x91cb('0x3c')]=function(_0x274fff,_0x3320bd){return respondWithRpcPromise(_0x91cb('0x3b'),_0x274fff[_0x91cb('0x1a')],routingClient)['then'](findById(_0x274fff[_0x91cb('0x1b')]['id']))['then'](respondWithResult(_0x3320bd,null))[_0x91cb('0x17')](handleError(_0x3320bd,null));};exports['mailQueues']=function(_0x3dfff9,_0x1b2fec){return respondWithRpcPromise(_0x91cb('0x3d'),_0x3dfff9['query'],routingClient)[_0x91cb('0x8')](respondWithResult(_0x1b2fec,null))[_0x91cb('0x17')](handleError(_0x1b2fec,null));};exports['showMailQueues']=function(_0xef4754,_0x102025){return respondWithRpcPromise(_0x91cb('0x3d'),_0xef4754[_0x91cb('0x1a')],routingClient)['then'](findById(_0xef4754[_0x91cb('0x1b')]['id']))[_0x91cb('0x8')](respondWithResult(_0x102025,null))[_0x91cb('0x17')](handleError(_0x102025,null));};exports[_0x91cb('0x3e')]=function(_0x55a0e3,_0x11025a){return respondWithRpcPromise(_0x91cb('0x3f'),_0x55a0e3['query'],mailClient)['then'](respondWithResult(_0x11025a,null))[_0x91cb('0x17')](handleError(_0x11025a,null));};exports['openchannelQueues']=function(_0x1180ac,_0x1237fd){return respondWithRpcPromise('OpenchannelQueues',_0x1180ac['query'],routingClient)[_0x91cb('0x8')](respondWithResult(_0x1237fd,null))['catch'](handleError(_0x1237fd,null));};exports[_0x91cb('0x40')]=function(_0x961ebf,_0x33de58){return respondWithRpcPromise('OpenchannelQueues',_0x961ebf[_0x91cb('0x1a')],routingClient)['then'](findById(_0x961ebf[_0x91cb('0x1b')]['id']))[_0x91cb('0x8')](respondWithResult(_0x33de58,null))[_0x91cb('0x17')](handleError(_0x33de58,null));};exports[_0x91cb('0x41')]=function(_0x483172,_0xb37f8e){return respondWithRpcPromise(_0x91cb('0x42'),_0x483172[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](respondWithResult(_0xb37f8e,null))[_0x91cb('0x17')](handleError(_0xb37f8e,null));};exports[_0x91cb('0x43')]=function(_0x14114d,_0x2785f9){return respondWithRpcPromise(_0x91cb('0x42'),_0x14114d[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](findById(_0x14114d[_0x91cb('0x1b')]['id']))['then'](respondWithResult(_0x2785f9,null))[_0x91cb('0x17')](handleError(_0x2785f9,null));};exports[_0x91cb('0x44')]=function(_0x474682,_0x51ab8a){return respondWithRpcPromise(_0x91cb('0x45'),_0x474682[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](respondWithResult(_0x51ab8a,null))['catch'](handleError(_0x51ab8a,null));};exports[_0x91cb('0x46')]=function(_0x5a3c7d,_0x4484d6){return respondWithRpcPromise(_0x91cb('0x45'),_0x5a3c7d[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](findById(_0x5a3c7d['params']['id']))[_0x91cb('0x8')](respondWithResult(_0x4484d6,null))[_0x91cb('0x17')](handleError(_0x4484d6,null));};exports[_0x91cb('0x47')]=function(_0x404b50,_0x1bb16f){return respondWithRpcPromise(_0x91cb('0x48'),_0x404b50['query'],routingClient)[_0x91cb('0x8')](respondWithResult(_0x1bb16f,null))[_0x91cb('0x17')](handleError(_0x1bb16f,null));};exports[_0x91cb('0x49')]=function(_0x1f0ba2,_0x891569){return respondWithRpcPromise(_0x91cb('0x48'),_0x1f0ba2[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](findById(_0x1f0ba2[_0x91cb('0x1b')]['id']))[_0x91cb('0x8')](respondWithResult(_0x891569,null))[_0x91cb('0x17')](handleError(_0x891569,null));};exports[_0x91cb('0x4a')]=function(_0xda123b,_0x3eead5){return respondWithRpcPromise(_0x91cb('0x4b'),_0xda123b[_0x91cb('0x1a')])[_0x91cb('0x8')](respondWithResult(_0x3eead5,null))['catch'](handleError(_0x3eead5,null));};exports[_0x91cb('0x4c')]=function(_0x1455cd,_0x4b639d){return respondWithRpcPromise(_0x91cb('0x4d'),_0x1455cd[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](respondWithResult(_0x4b639d,null))['catch'](handleError(_0x4b639d,null));};exports[_0x91cb('0x4e')]=function(_0x6ecba8,_0x5cd31c){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x6ecba8[_0x91cb('0x1a')],routingClient)['then'](respondWithResult(_0x5cd31c,null))[_0x91cb('0x17')](handleError(_0x5cd31c,null));};exports[_0x91cb('0x4f')]=function(_0x4e11e3,_0x43a8b1){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4e11e3[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](respondWithResult(_0x43a8b1,null))['catch'](handleError(_0x43a8b1,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x16a21f,_0x43be3e){return respondWithRpcPromise(_0x91cb('0x50'),_0x16a21f['query'],routingClient)[_0x91cb('0x8')](function(_0x23a458){if(_0x16a21f[_0x91cb('0x1a')][_0x91cb('0x51')]!==undefined){var _0x570f6b=_(_0x23a458[_0x91cb('0x13')])['filter']([_0x16a21f[_0x91cb('0x1a')][_0x91cb('0x51')],_0x16a21f[_0x91cb('0x1b')]['id']])[_0x91cb('0x52')]('queue_id')['uniq']()[_0x91cb('0x53')]();return _0x23a458['rows'][_0x91cb('0x54')](function(_0x3dc6f9){return _0x570f6b[_0x91cb('0x55')](_0x3dc6f9[_0x91cb('0x56')])>-0x1;});}else{return _0x23a458[_0x91cb('0x13')][_0x91cb('0x54')](function(_0x12d3d1){return _0x12d3d1['queue_id']===parseInt(_0x16a21f[_0x91cb('0x1b')]['id']);});}})[_0x91cb('0x8')](respondWithResult(_0x43be3e,null))['catch'](handleError(_0x43be3e,null));};exports[_0x91cb('0x57')]=function(_0x4d5862,_0x35525c){return respondWithRpcPromise(_0x91cb('0x58'),_0x4d5862[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](respondWithResult(_0x35525c,null))[_0x91cb('0x17')](handleError(_0x35525c,null));};exports[_0x91cb('0x59')]=function(_0x1459c4,_0x30259d){return respondWithRpcPromise(_0x91cb('0x5a'),_0x1459c4[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](respondWithResult(_0x30259d,null))[_0x91cb('0x17')](handleError(_0x30259d,null));};exports[_0x91cb('0x5b')]=function(_0x14882d,_0x22ba54){return respondWithRpcPromise(_0x91cb('0x5c'),_0x14882d['query'],routingClient)[_0x91cb('0x8')](respondWithResult(_0x22ba54,null))['catch'](handleError(_0x22ba54,null));};exports[_0x91cb('0x5d')]=function(_0x123d72){return function(_0x13f358,_0x422928){var _0x319289,_0x1fa3c7;var _0x324bdb=_[_0x91cb('0x5e')](_0x123d72);var _0x569df1=_0x123d72===_0x91cb('0x5f')?_0x91cb('0x60'):'Account';return db[_0x324bdb+'Queue'][_0x91cb('0x61')]({'raw':!![],'where':{'id':_0x13f358['params']['id']}})['then'](function(_0x95f2de){if(_['isNil'](_0x95f2de)){throw new Error(_0x324bdb+_0x91cb('0x62'));}_0x319289=_0x95f2de;return db[_0x324bdb+'Message'][_0x91cb('0x61')]({'where':{'id':_0x13f358[_0x91cb('0x2a')][_0x91cb('0x63')]},'include':[{'model':db[_0x324bdb+_0x91cb('0x64')],'as':'Interaction'},{'model':db[_0x324bdb+_0x569df1],'as':_0x91cb('0x65')}]});})[_0x91cb('0x8')](function(_0x42d07b){if(_[_0x91cb('0x12')](_0x42d07b)){throw new Error(_0x324bdb+_0x91cb('0x66'));}_0x1fa3c7=_0x42d07b;return _0x42d07b[_0x91cb('0x67')]({'read':0x0,'readAt':null,'UserId':null});})[_0x91cb('0x8')](function(){var _0x3cf8c5={'uniqueid':_0x123d72+'.'+_0x1fa3c7['id']+'.'+_0x1fa3c7[_0x91cb('0x64')]['id'],'FromUserId':_0x13f358[_0x91cb('0x2c')]['id'],'type':_0x91cb('0x68')};_0x3cf8c5[_0x324bdb+_0x91cb('0x69')]=_0x1fa3c7['id'];_0x3cf8c5[_0x324bdb+_0x91cb('0x6a')]=_0x1fa3c7[_0x91cb('0x64')]['id'];_0x3cf8c5[_0x91cb('0x6b')+_0x324bdb+_0x569df1+'Id']=_0x1fa3c7[_0x91cb('0x65')]['id'];_0x3cf8c5['To'+_0x324bdb+_0x91cb('0x6c')]=_0x319289['id'];return db[_0x324bdb+_0x91cb('0x6d')][_0x91cb('0x6e')](_0x3cf8c5);})[_0x91cb('0x8')](function(){return respondWithRpcPromise(_0x91cb('0x6f'),{'channel':_0x123d72,'interaction':_0x1fa3c7[_0x91cb('0x64')],'message':_0x1fa3c7,'account':_0x1fa3c7[_0x91cb('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x91cb('0x68'),'appdata':_0x319289[_0x91cb('0x10')]+','+(_0x1fa3c7['Account'][_0x91cb('0x70')]||0x12c),'interval':_0x91cb('0x71')}]},routingClient);})[_0x91cb('0x8')](respondWithResult(_0x422928,null))[_0x91cb('0x17')](handleError(_0x422928,null));};};exports[_0x91cb('0x72')]=function(_0x650ac9,_0x404457){var _0xa9de8b,_0x3bf154;if(_[_0x91cb('0x12')](_0x650ac9[_0x91cb('0x2a')]['channel'])){throw new Error(_0x91cb('0x73'));}var _0x4c459a=_0x650ac9['body'][_0x91cb('0x74')];var _0x265ffb=_[_0x91cb('0x5e')](_0x4c459a);var _0x446738=_0x4c459a===_0x91cb('0x5f')?_0x91cb('0x60'):_0x91cb('0x65');return db[_0x91cb('0x75')][_0x91cb('0x61')]({'raw':!![],'where':{'id':_0x650ac9[_0x91cb('0x1b')]['id'],'role':'agent'}})[_0x91cb('0x8')](function(_0xb784d5){if(_['isNil'](_0xb784d5)){throw new Error(_0x91cb('0x76'));}_0xa9de8b=_0xb784d5;return db[_0x265ffb+_0x91cb('0x77')]['findOne']({'where':{'id':_0x650ac9[_0x91cb('0x2a')][_0x91cb('0x63')]},'include':[{'model':db[_0x265ffb+_0x91cb('0x64')],'as':_0x91cb('0x64')},{'model':db[_0x265ffb+_0x446738],'as':_0x91cb('0x65')}]});})[_0x91cb('0x8')](function(_0x65c551){if(_[_0x91cb('0x12')](_0x65c551)){throw new Error(_0x265ffb+_0x91cb('0x66'));}_0x3bf154=_0x65c551;return _0x65c551[_0x91cb('0x67')]({'read':0x0,'readAt':null,'UserId':null});})[_0x91cb('0x8')](function(){var _0x378cd0={'uniqueid':_0x4c459a+'.'+_0x3bf154['id']+'.'+_0x3bf154['Interaction']['id'],'FromUserId':_0x650ac9['user']['id'],'type':_0x91cb('0x68'),'ToUserId':_0xa9de8b['id']};_0x378cd0[_0x265ffb+_0x91cb('0x69')]=_0x3bf154['id'];_0x378cd0[_0x265ffb+_0x91cb('0x6a')]=_0x3bf154[_0x91cb('0x64')]['id'];_0x378cd0[_0x91cb('0x6b')+_0x265ffb+_0x446738+'Id']=_0x3bf154[_0x91cb('0x65')]['id'];return db[_0x265ffb+_0x91cb('0x6d')]['create'](_0x378cd0);})[_0x91cb('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x4c459a,'interaction':_0x3bf154[_0x91cb('0x64')],'message':_0x3bf154,'account':_0x3bf154[_0x91cb('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x91cb('0x34'),'appdata':_0xa9de8b[_0x91cb('0x10')]+','+(_0x3bf154[_0x91cb('0x65')]['agentTransferTimeout']||0x12c),'interval':_0x91cb('0x71')}]},routingClient);})[_0x91cb('0x8')](respondWithResult(_0x404457,null))[_0x91cb('0x17')](handleError(_0x404457,null));}; \ No newline at end of file +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(_0x2ddc51,_0x369435){var _0x2ae4cc=function(_0x537745){while(--_0x537745){_0x2ddc51['push'](_0x2ddc51['shift']());}};_0x2ae4cc(++_0x369435);}(_0x425d,0x1e0));var _0xd425=function(_0x4fab6d,_0x244b72){_0x4fab6d=_0x4fab6d-0x0;var _0x1c454c=_0x425d[_0x4fab6d];return _0x1c454c;};'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 diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index eb53705..b300d1f 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 _0x47d3=['../../components/auth/service','./schedule.controller','isAuthenticated','get','/:id','show','/:id/run','run','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x276dc4,_0x5e2740){var _0xf66fcc=function(_0x35b2d7){while(--_0x35b2d7){_0x276dc4['push'](_0x276dc4['shift']());}};_0xf66fcc(++_0x5e2740);}(_0x47d3,0x1ee));var _0x347d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x47d3[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x347d('0x0'));var util=require(_0x347d('0x1'));var path=require(_0x347d('0x2'));var timeout=require(_0x347d('0x3'));var express=require(_0x347d('0x4'));var router=express[_0x347d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x347d('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x347d('0x7'));router['get']('/',auth[_0x347d('0x8')](),controller['index']);router[_0x347d('0x9')](_0x347d('0xa'),auth['isAuthenticated'](),controller[_0x347d('0xb')]);router[_0x347d('0x9')](_0x347d('0xc'),auth['isAuthenticated'](),controller[_0x347d('0xd')]);router[_0x347d('0xe')]('/',auth[_0x347d('0x8')](),controller[_0x347d('0xf')]);router[_0x347d('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x347d('0x11')]);router[_0x347d('0x12')](_0x347d('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x347d('0x13')]=router; \ No newline at end of file +var _0x1b28=['delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','./schedule.controller','get','isAuthenticated','index','show','/:id/run','run','create','/:id','update'];(function(_0x829c01,_0x2a9d36){var _0x5b5549=function(_0x554465){while(--_0x554465){_0x829c01['push'](_0x829c01['shift']());}};_0x5b5549(++_0x2a9d36);}(_0x1b28,0x159));var _0x81b2=function(_0x3d0c84,_0x26c0a1){_0x3d0c84=_0x3d0c84-0x0;var _0x23bec6=_0x1b28[_0x3d0c84];return _0x23bec6;};'use strict';var multer=require(_0x81b2('0x0'));var util=require(_0x81b2('0x1'));var path=require(_0x81b2('0x2'));var timeout=require(_0x81b2('0x3'));var express=require(_0x81b2('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x81b2('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x81b2('0x6'));router[_0x81b2('0x7')]('/',auth[_0x81b2('0x8')](),controller[_0x81b2('0x9')]);router[_0x81b2('0x7')]('/:id',auth[_0x81b2('0x8')](),controller[_0x81b2('0xa')]);router[_0x81b2('0x7')](_0x81b2('0xb'),auth['isAuthenticated'](),controller[_0x81b2('0xc')]);router['post']('/',auth[_0x81b2('0x8')](),controller[_0x81b2('0xd')]);router['put'](_0x81b2('0xe'),auth[_0x81b2('0x8')](),controller[_0x81b2('0xf')]);router[_0x81b2('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x81b2('0x11')]);module[_0x81b2('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index e061d0b..39e6037 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 _0x0543=['minutes','ENUM','csv','pdf','xlsx','default','BOOLEAN','TEXT','exports','STRING','DATE','INTEGER','years','quarters','months','days'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x0543,0x1a8));var _0x3054=function(_0x15a042,_0x30bbd0){_0x15a042=_0x15a042-0x0;var _0x4a81a0=_0x0543[_0x15a042];return _0x4a81a0;};'use strict';var Sequelize=require('sequelize');module[_0x3054('0x0')]={'name':{'type':Sequelize[_0x3054('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x3054('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x3054('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x3054('0x2')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x3054('0x3')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x3054('0x4'),_0x3054('0x5'),_0x3054('0x6'),'weeks',_0x3054('0x7'),'hours',_0x3054('0x8')),'allowNull':![],'defaultValue':_0x3054('0x7')},'output':{'type':Sequelize[_0x3054('0x9')](_0x3054('0xa'),_0x3054('0xb'),_0x3054('0xc')),'allowNull':![],'defaultValue':_0x3054('0xa')},'type':{'type':Sequelize[_0x3054('0x9')]('custom',_0x3054('0xd')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x3054('0xe')],'defaultValue':![]},'email':{'type':Sequelize[_0x3054('0x1')]},'cc':{'type':Sequelize[_0x3054('0xf')]},'bcc':{'type':Sequelize[_0x3054('0xf')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x68b1=['ENUM','csv','pdf','default','custom','BOOLEAN','TEXT','sequelize','STRING','0\x200\x20*\x20*\x20*','DATE','years','days','hours','minutes'];(function(_0x5c8e81,_0x53351e){var _0x31e3a8=function(_0x53179c){while(--_0x53179c){_0x5c8e81['push'](_0x5c8e81['shift']());}};_0x31e3a8(++_0x53351e);}(_0x68b1,0xf7));var _0x168b=function(_0x5d689d,_0x3fac90){_0x5d689d=_0x5d689d-0x0;var _0x33a7a7=_0x68b1[_0x5d689d];return _0x33a7a7;};'use strict';var Sequelize=require(_0x168b('0x0'));module['exports']={'name':{'type':Sequelize[_0x168b('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x168b('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x168b('0x2')},'startAt':{'type':Sequelize[_0x168b('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x168b('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x168b('0x4'),'quarters','months','weeks',_0x168b('0x5'),_0x168b('0x6'),_0x168b('0x7')),'allowNull':![],'defaultValue':_0x168b('0x5')},'output':{'type':Sequelize[_0x168b('0x8')](_0x168b('0x9'),_0x168b('0xa'),'xlsx'),'allowNull':![],'defaultValue':_0x168b('0x9')},'type':{'type':Sequelize[_0x168b('0x8')]('custom',_0x168b('0xb')),'allowNull':![],'defaultValue':_0x168b('0xc')},'sendMail':{'type':Sequelize[_0x168b('0xd')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x168b('0xe')]},'bcc':{'type':Sequelize[_0x168b('0xe')]},'sendIfEmpty':{'type':Sequelize[_0x168b('0xd')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index adaeb52..27f5246 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 _0x3a6f=['run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','ejs','fs-extra','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','destroy','Scheduler','error','stack','send','index','map','rawAttributes','fieldName','type','key','name','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filters','where','VIRTUAL','filter','merge','options','Schedule','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update'];(function(_0x44900d,_0x47c756){var _0x3a9fbb=function(_0x4da89b){while(--_0x4da89b){_0x44900d['push'](_0x44900d['shift']());}};_0x3a9fbb(++_0x47c756);}(_0x3a6f,0x100));var _0xf3a6=function(_0x6b44a0,_0xb52b2e){_0x6b44a0=_0x6b44a0-0x0;var _0x443db7=_0x3a6f[_0x6b44a0];return _0x443db7;};'use strict';var emlformat=require(_0xf3a6('0x0'));var rimraf=require(_0xf3a6('0x1'));var zipdir=require(_0xf3a6('0x2'));var jsonpatch=require(_0xf3a6('0x3'));var rp=require(_0xf3a6('0x4'));var moment=require('moment');var BPromise=require(_0xf3a6('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf3a6('0x6'));var sox=require(_0xf3a6('0x7'));var csv=require('to-csv');var ejs=require(_0xf3a6('0x8'));var fs=require('fs');var fs_extra=require(_0xf3a6('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf3a6('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf3a6('0xb'));var toCsv=require(_0xf3a6('0xc'));var querystring=require(_0xf3a6('0xd'));var Papa=require(_0xf3a6('0xe'));var Redis=require('ioredis');var authService=require(_0xf3a6('0xf'));var qs=require(_0xf3a6('0x10'));var as=require(_0xf3a6('0x11'));var hardwareService=require(_0xf3a6('0x12'));var logger=require(_0xf3a6('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xf3a6('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xf3a6('0x15'))['db'];function respondWithStatusCode(_0x35197c,_0x1a819a){_0x1a819a=_0x1a819a||0xcc;return function(_0x9469b9){if(_0x9469b9){return _0x35197c[_0xf3a6('0x16')](_0x1a819a);}return _0x35197c[_0xf3a6('0x17')](_0x1a819a)[_0xf3a6('0x18')]();};}function respondWithResult(_0x4aca3a,_0x597adb){_0x597adb=_0x597adb||0xc8;return function(_0x303717){if(_0x303717){return _0x4aca3a[_0xf3a6('0x17')](_0x597adb)[_0xf3a6('0x19')](_0x303717);}};}function respondWithFilteredResult(_0x4d7ec5,_0x1ace22){return function(_0x1e6015){if(_0x1e6015){var _0x124d18=typeof _0x1ace22['offset']===_0xf3a6('0x1a')&&typeof _0x1ace22[_0xf3a6('0x1b')]==='undefined';var _0x10e4a1=_0x1e6015[_0xf3a6('0x1c')];var _0x3aec2d=_0x124d18?0x0:_0x1ace22[_0xf3a6('0x1d')];var _0xb022f4=_0x124d18?_0x1e6015[_0xf3a6('0x1c')]:_0x1ace22['offset']+_0x1ace22[_0xf3a6('0x1b')];var _0x240964;if(_0xb022f4>=_0x10e4a1){_0xb022f4=_0x10e4a1;_0x240964=0xc8;}else{_0x240964=0xce;}_0x4d7ec5[_0xf3a6('0x17')](_0x240964);return _0x4d7ec5['set'](_0xf3a6('0x1e'),_0x3aec2d+'-'+_0xb022f4+'/'+_0x10e4a1)['json'](_0x1e6015);}return null;};}function patchUpdates(_0x1d6563){return function(_0x4d4f2c){try{jsonpatch[_0xf3a6('0x1f')](_0x4d4f2c,_0x1d6563,!![]);}catch(_0x10c0d9){return BPromise[_0xf3a6('0x20')](_0x10c0d9);}return _0x4d4f2c[_0xf3a6('0x21')]();};}function saveUpdates(_0x47dbdc,_0xfad94c){return function(_0x1aa907){if(_0x1aa907){return _0x1aa907['update'](_0x47dbdc)[_0xf3a6('0x22')](function(_0x1682bb){return _0x1682bb;});}return null;};}function removeEntity(_0x151e4f,_0xf90390){return function(_0x3e094f){if(_0x3e094f){return _0x3e094f[_0xf3a6('0x23')]()['then'](function(){var _0x1b83ae=_0x3e094f['get']({'plain':!![]});var _0x58b39d=_0xf3a6('0x24');return db['UserProfileResource'][_0xf3a6('0x23')]({'where':{'type':_0x58b39d,'resourceId':_0x1b83ae['id']}})[_0xf3a6('0x22')](function(){return _0x3e094f;});})['then'](function(){_0x151e4f[_0xf3a6('0x17')](0xcc)[_0xf3a6('0x18')]();});}};}function handleEntityNotFound(_0x44bfc6,_0x5a0f0b){return function(_0xe9416d){if(!_0xe9416d){_0x44bfc6[_0xf3a6('0x16')](0x194);}return _0xe9416d;};}function handleError(_0x15bb79,_0x3bbef7){_0x3bbef7=_0x3bbef7||0x1f4;return function(_0x43fbf6){logger[_0xf3a6('0x25')](_0x43fbf6[_0xf3a6('0x26')]);if(_0x43fbf6['name']){delete _0x43fbf6['name'];}_0x15bb79[_0xf3a6('0x17')](_0x3bbef7)[_0xf3a6('0x27')](_0x43fbf6);};}exports[_0xf3a6('0x28')]=function(_0x327c94,_0x3f605d){var _0x431b29={},_0x183e4f={},_0x83b2a3={'count':0x0,'rows':[]};var _0x17461b=_[_0xf3a6('0x29')](db['Schedule'][_0xf3a6('0x2a')],function(_0x25a93e){return{'name':_0x25a93e[_0xf3a6('0x2b')],'type':_0x25a93e[_0xf3a6('0x2c')][_0xf3a6('0x2d')]};});_0x183e4f['model']=_[_0xf3a6('0x29')](_0x17461b,_0xf3a6('0x2e'));_0x183e4f[_0xf3a6('0x2f')]=_[_0xf3a6('0x30')](_0x327c94[_0xf3a6('0x2f')]);_0x183e4f['filters']=_[_0xf3a6('0x31')](_0x183e4f[_0xf3a6('0x32')],_0x183e4f[_0xf3a6('0x2f')]);_0x431b29[_0xf3a6('0x33')]=_[_0xf3a6('0x31')](_0x183e4f[_0xf3a6('0x32')],qs[_0xf3a6('0x34')](_0x327c94['query']['fields']));_0x431b29[_0xf3a6('0x33')]=_0x431b29[_0xf3a6('0x33')][_0xf3a6('0x35')]?_0x431b29[_0xf3a6('0x33')]:_0x183e4f[_0xf3a6('0x32')];if(!_0x327c94[_0xf3a6('0x2f')][_0xf3a6('0x36')](_0xf3a6('0x37'))){_0x431b29[_0xf3a6('0x1b')]=qs[_0xf3a6('0x1b')](_0x327c94['query'][_0xf3a6('0x1b')]);_0x431b29['offset']=qs[_0xf3a6('0x1d')](_0x327c94[_0xf3a6('0x2f')][_0xf3a6('0x1d')]);}_0x431b29['order']=qs[_0xf3a6('0x38')](_0x327c94[_0xf3a6('0x2f')][_0xf3a6('0x38')]);_0x431b29['where']=qs['filters'](_[_0xf3a6('0x39')](_0x327c94[_0xf3a6('0x2f')],_0x183e4f[_0xf3a6('0x3a')]),_0x17461b);if(_0x327c94[_0xf3a6('0x2f')]['filter']){_0x431b29[_0xf3a6('0x3b')]=_['merge'](_0x431b29['where'],{'$or':_['map'](_0x17461b,function(_0x1eb3ba){if(_0x1eb3ba[_0xf3a6('0x2c')]!==_0xf3a6('0x3c')){var _0xe7aca1={};_0xe7aca1[_0x1eb3ba['name']]={'$like':'%'+_0x327c94[_0xf3a6('0x2f')][_0xf3a6('0x3d')]+'%'};return _0xe7aca1;}})});}_0x431b29=_[_0xf3a6('0x3e')]({},_0x431b29,_0x327c94[_0xf3a6('0x3f')]);var _0x9775d6={'where':_0x431b29['where']};return db[_0xf3a6('0x40')][_0xf3a6('0x1c')](_0x9775d6)[_0xf3a6('0x22')](function(_0x45cb5e){_0x83b2a3[_0xf3a6('0x1c')]=_0x45cb5e;if(_0x327c94['query'][_0xf3a6('0x41')]){_0x431b29['include']=[{'all':!![]}];}return db[_0xf3a6('0x40')][_0xf3a6('0x42')](_0x431b29);})[_0xf3a6('0x22')](function(_0x458e06){_0x83b2a3[_0xf3a6('0x43')]=_0x458e06;return _0x83b2a3;})[_0xf3a6('0x22')](respondWithFilteredResult(_0x3f605d,_0x431b29))[_0xf3a6('0x44')](handleError(_0x3f605d,null));};exports[_0xf3a6('0x45')]=function(_0x19fe81,_0x169c8d){var _0x1c536b={'raw':![],'where':{'id':_0x19fe81[_0xf3a6('0x46')]['id']}},_0x1f6f83={};_0x1f6f83['model']=_[_0xf3a6('0x30')](db['Schedule'][_0xf3a6('0x2a')]);_0x1f6f83['query']=_['keys'](_0x19fe81[_0xf3a6('0x2f')]);_0x1f6f83[_0xf3a6('0x3a')]=_[_0xf3a6('0x31')](_0x1f6f83[_0xf3a6('0x32')],_0x1f6f83[_0xf3a6('0x2f')]);_0x1c536b['attributes']=_['intersection'](_0x1f6f83[_0xf3a6('0x32')],qs[_0xf3a6('0x34')](_0x19fe81[_0xf3a6('0x2f')][_0xf3a6('0x34')]));_0x1c536b[_0xf3a6('0x33')]=_0x1c536b[_0xf3a6('0x33')][_0xf3a6('0x35')]?_0x1c536b[_0xf3a6('0x33')]:_0x1f6f83['model'];if(_0x19fe81[_0xf3a6('0x2f')][_0xf3a6('0x41')]){_0x1c536b[_0xf3a6('0x47')]=[{'all':!![]}];}_0x1c536b=_[_0xf3a6('0x3e')]({},_0x1c536b,_0x19fe81[_0xf3a6('0x3f')]);return db[_0xf3a6('0x40')][_0xf3a6('0x48')](_0x1c536b)[_0xf3a6('0x22')](handleEntityNotFound(_0x169c8d,null))['then'](respondWithResult(_0x169c8d,null))[_0xf3a6('0x44')](handleError(_0x169c8d,null));};exports[_0xf3a6('0x49')]=function(_0x5e66b8,_0x56791d){return db[_0xf3a6('0x40')][_0xf3a6('0x49')](_0x5e66b8[_0xf3a6('0x4a')],{})[_0xf3a6('0x22')](function(_0x4daf99){var _0x515f55=_0x5e66b8[_0xf3a6('0x4b')][_0xf3a6('0x4c')]({'plain':!![]});if(!_0x515f55)throw new Error(_0xf3a6('0x4d'));if(_0x515f55[_0xf3a6('0x4e')]==='user'){var _0x53ba3d=_0x4daf99[_0xf3a6('0x4c')]({'plain':!![]});var _0x124c24='Scheduler';return db[_0xf3a6('0x4f')][_0xf3a6('0x48')]({'where':{'name':_0x124c24,'userProfileId':_0x515f55['userProfileId']},'raw':!![]})[_0xf3a6('0x22')](function(_0x3d6735){if(_0x3d6735&&_0x3d6735[_0xf3a6('0x50')]===0x0){return db[_0xf3a6('0x51')][_0xf3a6('0x49')]({'name':_0x53ba3d[_0xf3a6('0x2e')],'resourceId':_0x53ba3d['id'],'type':_0x3d6735[_0xf3a6('0x2e')],'sectionId':_0x3d6735['id']},{})[_0xf3a6('0x22')](function(){return _0x4daf99;});}else{return _0x4daf99;}})[_0xf3a6('0x44')](function(_0x46f5c4){logger[_0xf3a6('0x25')](_0xf3a6('0x52'),_0x46f5c4);throw _0x46f5c4;});}return _0x4daf99;})[_0xf3a6('0x22')](respondWithResult(_0x56791d,0xc9))[_0xf3a6('0x44')](handleError(_0x56791d,null));};exports[_0xf3a6('0x53')]=function(_0x558871,_0x544f90){if(_0x558871[_0xf3a6('0x4a')]['id']){delete _0x558871[_0xf3a6('0x4a')]['id'];}return db[_0xf3a6('0x40')][_0xf3a6('0x48')]({'where':{'id':_0x558871[_0xf3a6('0x46')]['id']}})[_0xf3a6('0x22')](handleEntityNotFound(_0x544f90,null))[_0xf3a6('0x22')](saveUpdates(_0x558871[_0xf3a6('0x4a')],null))[_0xf3a6('0x22')](respondWithResult(_0x544f90,null))[_0xf3a6('0x44')](handleError(_0x544f90,null));};exports['destroy']=function(_0x4d543b,_0x4fc11f){return db[_0xf3a6('0x40')][_0xf3a6('0x48')]({'where':{'id':_0x4d543b[_0xf3a6('0x46')]['id']}})[_0xf3a6('0x22')](handleEntityNotFound(_0x4fc11f,null))[_0xf3a6('0x22')](removeEntity(_0x4fc11f,null))[_0xf3a6('0x44')](handleError(_0x4fc11f,null));};exports[_0xf3a6('0x54')]=function(_0x449d4b,_0x295e42,_0x4fcb51){var _0x299c24=require('../../config/schedule');return db['Schedule']['find']({'where':{'id':_0x449d4b[_0xf3a6('0x46')]['id']},'raw':!![]})[_0xf3a6('0x22')](handleEntityNotFound(_0x295e42,null))[_0xf3a6('0x22')](function(){_0x299c24[_0xf3a6('0x54')](_0x449d4b[_0xf3a6('0x46')]['id']);})[_0xf3a6('0x22')](respondWithStatusCode(_0x295e42,null))[_0xf3a6('0x44')](handleError(_0x295e42,null));}; \ No newline at end of file +var _0x6526=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','then','get','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','intersection','attributes','model','fields','order','sort','filters','pick','where','filter','merge','options','includeAll','include','findAll','rows','show','params','Schedule','find','catch','create','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x2a558d,_0x2df0ff){var _0xa7bc9c=function(_0x12a30e){while(--_0x12a30e){_0x2a558d['push'](_0x2a558d['shift']());}};_0xa7bc9c(++_0x2df0ff);}(_0x6526,0x141));var _0x6652=function(_0x4996d5,_0x123daf){_0x4996d5=_0x4996d5-0x0;var _0x4793f9=_0x6526[_0x4996d5];return _0x4793f9;};'use strict';var emlformat=require(_0x6652('0x0'));var rimraf=require(_0x6652('0x1'));var zipdir=require(_0x6652('0x2'));var jsonpatch=require(_0x6652('0x3'));var rp=require(_0x6652('0x4'));var moment=require(_0x6652('0x5'));var BPromise=require(_0x6652('0x6'));var Mustache=require(_0x6652('0x7'));var util=require(_0x6652('0x8'));var path=require(_0x6652('0x9'));var sox=require(_0x6652('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6652('0xb'));var _=require('lodash');var squel=require(_0x6652('0xc'));var crypto=require('crypto');var jsforce=require(_0x6652('0xd'));var deskjs=require(_0x6652('0xe'));var toCsv=require(_0x6652('0xf'));var querystring=require('querystring');var Papa=require(_0x6652('0x10'));var Redis=require(_0x6652('0x11'));var authService=require(_0x6652('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6652('0x13'));var hardwareService=require(_0x6652('0x14'));var logger=require('../../config/logger')(_0x6652('0x15'));var utils=require(_0x6652('0x16'));var config=require(_0x6652('0x17'));var licenseUtil=require(_0x6652('0x18'));var db=require(_0x6652('0x19'))['db'];function respondWithStatusCode(_0x2d318e,_0x3e8114){_0x3e8114=_0x3e8114||0xcc;return function(_0x2beddd){if(_0x2beddd){return _0x2d318e[_0x6652('0x1a')](_0x3e8114);}return _0x2d318e[_0x6652('0x1b')](_0x3e8114)[_0x6652('0x1c')]();};}function respondWithResult(_0x1a51ef,_0x14f97c){_0x14f97c=_0x14f97c||0xc8;return function(_0x8fea27){if(_0x8fea27){return _0x1a51ef[_0x6652('0x1b')](_0x14f97c)[_0x6652('0x1d')](_0x8fea27);}};}function respondWithFilteredResult(_0x21bed1,_0x89766c){return function(_0x5f5dc0){if(_0x5f5dc0){var _0x1a5444=typeof _0x89766c['offset']===_0x6652('0x1e')&&typeof _0x89766c[_0x6652('0x1f')]===_0x6652('0x1e');var _0x5bdb56=_0x5f5dc0[_0x6652('0x20')];var _0x59ba51=_0x1a5444?0x0:_0x89766c['offset'];var _0x45b0b0=_0x1a5444?_0x5f5dc0[_0x6652('0x20')]:_0x89766c[_0x6652('0x21')]+_0x89766c['limit'];var _0x3672d6;if(_0x45b0b0>=_0x5bdb56){_0x45b0b0=_0x5bdb56;_0x3672d6=0xc8;}else{_0x3672d6=0xce;}_0x21bed1[_0x6652('0x1b')](_0x3672d6);return _0x21bed1[_0x6652('0x22')](_0x6652('0x23'),_0x59ba51+'-'+_0x45b0b0+'/'+_0x5bdb56)['json'](_0x5f5dc0);}return null;};}function patchUpdates(_0xc3324a){return function(_0x3947ad){try{jsonpatch[_0x6652('0x24')](_0x3947ad,_0xc3324a,!![]);}catch(_0x110fc3){return BPromise[_0x6652('0x25')](_0x110fc3);}return _0x3947ad[_0x6652('0x26')]();};}function saveUpdates(_0x31083e,_0x3b4d9a){return function(_0x45434a){if(_0x45434a){return _0x45434a['update'](_0x31083e)['then'](function(_0x5a26b5){return _0x5a26b5;});}return null;};}function removeEntity(_0x413d48,_0x499445){return function(_0x17e4dc){if(_0x17e4dc){return _0x17e4dc[_0x6652('0x27')]()[_0x6652('0x28')](function(){var _0x301257=_0x17e4dc[_0x6652('0x29')]({'plain':!![]});var _0xad160f='Scheduler';return db[_0x6652('0x2a')][_0x6652('0x27')]({'where':{'type':_0xad160f,'resourceId':_0x301257['id']}})[_0x6652('0x28')](function(){return _0x17e4dc;});})['then'](function(){_0x413d48['status'](0xcc)[_0x6652('0x1c')]();});}};}function handleEntityNotFound(_0x32deac,_0x460303){return function(_0xedab46){if(!_0xedab46){_0x32deac[_0x6652('0x1a')](0x194);}return _0xedab46;};}function handleError(_0x3a623a,_0x47ec32){_0x47ec32=_0x47ec32||0x1f4;return function(_0x16cc0d){logger[_0x6652('0x2b')](_0x16cc0d[_0x6652('0x2c')]);if(_0x16cc0d[_0x6652('0x2d')]){delete _0x16cc0d[_0x6652('0x2d')];}_0x3a623a['status'](_0x47ec32)[_0x6652('0x2e')](_0x16cc0d);};}exports[_0x6652('0x2f')]=function(_0x80f84d,_0x441803){var _0x1e91e9={},_0x5e2707={},_0x41a0e7={'count':0x0,'rows':[]};var _0x88edd3=_[_0x6652('0x30')](db['Schedule'][_0x6652('0x31')],function(_0x1f691a){return{'name':_0x1f691a[_0x6652('0x32')],'type':_0x1f691a[_0x6652('0x33')]['key']};});_0x5e2707['model']=_['map'](_0x88edd3,_0x6652('0x2d'));_0x5e2707[_0x6652('0x34')]=_[_0x6652('0x35')](_0x80f84d['query']);_0x5e2707['filters']=_[_0x6652('0x36')](_0x5e2707['model'],_0x5e2707[_0x6652('0x34')]);_0x1e91e9[_0x6652('0x37')]=_['intersection'](_0x5e2707[_0x6652('0x38')],qs[_0x6652('0x39')](_0x80f84d['query'][_0x6652('0x39')]));_0x1e91e9['attributes']=_0x1e91e9[_0x6652('0x37')]['length']?_0x1e91e9['attributes']:_0x5e2707[_0x6652('0x38')];if(!_0x80f84d[_0x6652('0x34')]['hasOwnProperty']('nolimit')){_0x1e91e9[_0x6652('0x1f')]=qs[_0x6652('0x1f')](_0x80f84d[_0x6652('0x34')][_0x6652('0x1f')]);_0x1e91e9['offset']=qs[_0x6652('0x21')](_0x80f84d['query']['offset']);}_0x1e91e9[_0x6652('0x3a')]=qs[_0x6652('0x3b')](_0x80f84d[_0x6652('0x34')][_0x6652('0x3b')]);_0x1e91e9['where']=qs[_0x6652('0x3c')](_[_0x6652('0x3d')](_0x80f84d[_0x6652('0x34')],_0x5e2707[_0x6652('0x3c')]),_0x88edd3);if(_0x80f84d[_0x6652('0x34')]['filter']){_0x1e91e9[_0x6652('0x3e')]=_['merge'](_0x1e91e9[_0x6652('0x3e')],{'$or':_[_0x6652('0x30')](_0x88edd3,function(_0x575f2d){if(_0x575f2d[_0x6652('0x33')]!=='VIRTUAL'){var _0x1bd4f5={};_0x1bd4f5[_0x575f2d[_0x6652('0x2d')]]={'$like':'%'+_0x80f84d[_0x6652('0x34')][_0x6652('0x3f')]+'%'};return _0x1bd4f5;}})});}_0x1e91e9=_[_0x6652('0x40')]({},_0x1e91e9,_0x80f84d[_0x6652('0x41')]);var _0x56648b={'where':_0x1e91e9['where']};return db['Schedule'][_0x6652('0x20')](_0x56648b)[_0x6652('0x28')](function(_0x3ca890){_0x41a0e7[_0x6652('0x20')]=_0x3ca890;if(_0x80f84d[_0x6652('0x34')][_0x6652('0x42')]){_0x1e91e9[_0x6652('0x43')]=[{'all':!![]}];}return db['Schedule'][_0x6652('0x44')](_0x1e91e9);})[_0x6652('0x28')](function(_0x4e1853){_0x41a0e7[_0x6652('0x45')]=_0x4e1853;return _0x41a0e7;})['then'](respondWithFilteredResult(_0x441803,_0x1e91e9))['catch'](handleError(_0x441803,null));};exports[_0x6652('0x46')]=function(_0x4a481a,_0x3343aa){var _0x457391={'raw':![],'where':{'id':_0x4a481a[_0x6652('0x47')]['id']}},_0x2ea768={};_0x2ea768[_0x6652('0x38')]=_[_0x6652('0x35')](db[_0x6652('0x48')]['rawAttributes']);_0x2ea768[_0x6652('0x34')]=_[_0x6652('0x35')](_0x4a481a[_0x6652('0x34')]);_0x2ea768[_0x6652('0x3c')]=_[_0x6652('0x36')](_0x2ea768['model'],_0x2ea768['query']);_0x457391[_0x6652('0x37')]=_[_0x6652('0x36')](_0x2ea768[_0x6652('0x38')],qs['fields'](_0x4a481a['query'][_0x6652('0x39')]));_0x457391[_0x6652('0x37')]=_0x457391[_0x6652('0x37')]['length']?_0x457391[_0x6652('0x37')]:_0x2ea768['model'];if(_0x4a481a[_0x6652('0x34')][_0x6652('0x42')]){_0x457391[_0x6652('0x43')]=[{'all':!![]}];}_0x457391=_[_0x6652('0x40')]({},_0x457391,_0x4a481a[_0x6652('0x41')]);return db[_0x6652('0x48')][_0x6652('0x49')](_0x457391)[_0x6652('0x28')](handleEntityNotFound(_0x3343aa,null))[_0x6652('0x28')](respondWithResult(_0x3343aa,null))[_0x6652('0x4a')](handleError(_0x3343aa,null));};exports['create']=function(_0x577489,_0x2123dd){return db[_0x6652('0x48')][_0x6652('0x4b')](_0x577489['body'],{})[_0x6652('0x28')](function(_0x53dd4f){var _0x42daea=_0x577489['user'][_0x6652('0x29')]({'plain':!![]});if(!_0x42daea)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x42daea[_0x6652('0x4c')]===_0x6652('0x4d')){var _0x25554b=_0x53dd4f[_0x6652('0x29')]({'plain':!![]});var _0x5603d4='Scheduler';return db[_0x6652('0x4e')][_0x6652('0x49')]({'where':{'name':_0x5603d4,'userProfileId':_0x42daea[_0x6652('0x4f')]},'raw':!![]})[_0x6652('0x28')](function(_0x2d6faf){if(_0x2d6faf&&_0x2d6faf[_0x6652('0x50')]===0x0){return db[_0x6652('0x2a')][_0x6652('0x4b')]({'name':_0x25554b[_0x6652('0x2d')],'resourceId':_0x25554b['id'],'type':_0x2d6faf[_0x6652('0x2d')],'sectionId':_0x2d6faf['id']},{})[_0x6652('0x28')](function(){return _0x53dd4f;});}else{return _0x53dd4f;}})[_0x6652('0x4a')](function(_0x3f21ab){logger['error'](_0x6652('0x51'),_0x3f21ab);throw _0x3f21ab;});}return _0x53dd4f;})[_0x6652('0x28')](respondWithResult(_0x2123dd,0xc9))['catch'](handleError(_0x2123dd,null));};exports[_0x6652('0x52')]=function(_0x40070f,_0x152820){if(_0x40070f[_0x6652('0x53')]['id']){delete _0x40070f[_0x6652('0x53')]['id'];}return db[_0x6652('0x48')][_0x6652('0x49')]({'where':{'id':_0x40070f[_0x6652('0x47')]['id']}})[_0x6652('0x28')](handleEntityNotFound(_0x152820,null))[_0x6652('0x28')](saveUpdates(_0x40070f[_0x6652('0x53')],null))[_0x6652('0x28')](respondWithResult(_0x152820,null))[_0x6652('0x4a')](handleError(_0x152820,null));};exports[_0x6652('0x27')]=function(_0x53d429,_0x21500b){return db[_0x6652('0x48')][_0x6652('0x49')]({'where':{'id':_0x53d429[_0x6652('0x47')]['id']}})['then'](handleEntityNotFound(_0x21500b,null))[_0x6652('0x28')](removeEntity(_0x21500b,null))[_0x6652('0x4a')](handleError(_0x21500b,null));};exports[_0x6652('0x54')]=function(_0x551f0c,_0x1f22ec,_0x43bb5d){var _0x49b146=require(_0x6652('0x55'));return db['Schedule'][_0x6652('0x49')]({'where':{'id':_0x551f0c['params']['id']},'raw':!![]})[_0x6652('0x28')](handleEntityNotFound(_0x1f22ec,null))[_0x6652('0x28')](function(){_0x49b146[_0x6652('0x54')](_0x551f0c[_0x6652('0x47')]['id']);})[_0x6652('0x28')](respondWithStatusCode(_0x1f22ec,null))[_0x6652('0x4a')](handleError(_0x1f22ec,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 7f1e522..9d2c89c 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 _0x3299=['../../config/logger','api','bluebird','request-promise','rimraf','./schedule.attributes','exports','tools_schedules','lodash','util'];(function(_0x66f455,_0x43978d){var _0x2f4d67=function(_0x5cc247){while(--_0x5cc247){_0x66f455['push'](_0x66f455['shift']());}};_0x2f4d67(++_0x43978d);}(_0x3299,0x8a));var _0x9329=function(_0x577c9d,_0x299493){_0x577c9d=_0x577c9d-0x0;var _0x51ff9e=_0x3299[_0x577c9d];return _0x51ff9e;};'use strict';var _=require(_0x9329('0x0'));var util=require(_0x9329('0x1'));var logger=require(_0x9329('0x2'))(_0x9329('0x3'));var moment=require('moment');var BPromise=require(_0x9329('0x4'));var rp=require(_0x9329('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9329('0x6'));var config=require('../../config/environment');var attributes=require(_0x9329('0x7'));module[_0x9329('0x8')]=function(_0xcc2fc6,_0x753f4c){return _0xcc2fc6['define']('Schedule',attributes,{'tableName':_0x9329('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50b6=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','define','tools_schedules'];(function(_0x29d570,_0xc7c8cd){var _0x2f9708=function(_0x1e810a){while(--_0x1e810a){_0x29d570['push'](_0x29d570['shift']());}};_0x2f9708(++_0xc7c8cd);}(_0x50b6,0xea));var _0x650b=function(_0x46911e,_0x2e1051){_0x46911e=_0x46911e-0x0;var _0x13fc6c=_0x50b6[_0x46911e];return _0x13fc6c;};'use strict';var _=require(_0x650b('0x0'));var util=require('util');var logger=require(_0x650b('0x1'))(_0x650b('0x2'));var moment=require(_0x650b('0x3'));var BPromise=require(_0x650b('0x4'));var rp=require(_0x650b('0x5'));var fs=require('fs');var path=require(_0x650b('0x6'));var rimraf=require(_0x650b('0x7'));var config=require(_0x650b('0x8'));var attributes=require(_0x650b('0x9'));module[_0x650b('0xa')]=function(_0x206604,_0xe39333){return _0x206604[_0x650b('0xb')]('Schedule',attributes,{'tableName':_0x650b('0xc'),'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 da7262f..38ed616 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 _0x899c=['client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x427648,_0x20f4b4){var _0x9d51e2=function(_0x1fafad){while(--_0x1fafad){_0x427648['push'](_0x427648['shift']());}};_0x9d51e2(++_0x20f4b4);}(_0x899c,0x193));var _0xc899=function(_0x77e7e8,_0x5a319f){_0x77e7e8=_0x77e7e8-0x0;var _0x205a3e=_0x899c[_0x77e7e8];return _0x205a3e;};'use strict';var _=require(_0xc899('0x0'));var util=require(_0xc899('0x1'));var moment=require(_0xc899('0x2'));var BPromise=require(_0xc899('0x3'));var rs=require(_0xc899('0x4'));var fs=require('fs');var Redis=require(_0xc899('0x5'));var db=require(_0xc899('0x6'))['db'];var utils=require(_0xc899('0x7'));var logger=require(_0xc899('0x8'))(_0xc899('0x9'));var config=require(_0xc899('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc899('0xb')][_0xc899('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21d16e,_0x40cf91,_0x477088){return new BPromise(function(_0x32804a,_0x5aa799){return client[_0xc899('0xd')](_0x21d16e,_0x477088)[_0xc899('0xe')](function(_0x73f0ab){logger[_0xc899('0xf')](_0xc899('0x10'),_0x40cf91,_0xc899('0x11'));logger[_0xc899('0x12')]('Schedule,\x20%s,\x20%s,\x20%s',_0x40cf91,_0xc899('0x11'),JSON[_0xc899('0x13')](_0x73f0ab));if(_0x73f0ab['error']){if(_0x73f0ab[_0xc899('0x14')]['code']===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x40cf91,_0x73f0ab['error'][_0xc899('0x15')]);return _0x5aa799(_0x73f0ab[_0xc899('0x14')][_0xc899('0x15')]);}logger['error'](_0xc899('0x10'),_0x40cf91,_0x73f0ab['error'][_0xc899('0x15')]);return _0x32804a(_0x73f0ab[_0xc899('0x14')][_0xc899('0x15')]);}else{logger[_0xc899('0xf')](_0xc899('0x10'),_0x40cf91,_0xc899('0x11'));_0x32804a(_0x73f0ab[_0xc899('0x16')]['message']);}})['catch'](function(_0x528d7f){logger[_0xc899('0x14')]('Schedule,\x20%s,\x20%s',_0x40cf91,_0x528d7f);_0x5aa799(_0x528d7f);});});} \ No newline at end of file +var _0xf231=['Schedule,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code'];(function(_0x3794a0,_0x1a9cfc){var _0x5bdaba=function(_0x14a764){while(--_0x14a764){_0x3794a0['push'](_0x3794a0['shift']());}};_0x5bdaba(++_0x1a9cfc);}(_0xf231,0xab));var _0x1f23=function(_0x207155,_0x579af8){_0x207155=_0x207155-0x0;var _0x55cdec=_0xf231[_0x207155];return _0x55cdec;};'use strict';var _=require(_0x1f23('0x0'));var util=require(_0x1f23('0x1'));var moment=require(_0x1f23('0x2'));var BPromise=require(_0x1f23('0x3'));var rs=require(_0x1f23('0x4'));var fs=require('fs');var Redis=require(_0x1f23('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1f23('0x6'));var logger=require(_0x1f23('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1f23('0x8'));var client=jayson[_0x1f23('0x9')][_0x1f23('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa4b95e,_0x4a09d7,_0x12e0c2){return new BPromise(function(_0x159489,_0x1328e9){return client[_0x1f23('0xb')](_0xa4b95e,_0x12e0c2)['then'](function(_0x3609be){logger[_0x1f23('0xc')]('Schedule,\x20%s,\x20%s',_0x4a09d7,_0x1f23('0xd'));logger[_0x1f23('0xe')]('Schedule,\x20%s,\x20%s,\x20%s',_0x4a09d7,_0x1f23('0xd'),JSON[_0x1f23('0xf')](_0x3609be));if(_0x3609be[_0x1f23('0x10')]){if(_0x3609be[_0x1f23('0x10')][_0x1f23('0x11')]===0x1f4){logger[_0x1f23('0x10')](_0x1f23('0x12'),_0x4a09d7,_0x3609be[_0x1f23('0x10')][_0x1f23('0x13')]);return _0x1328e9(_0x3609be[_0x1f23('0x10')][_0x1f23('0x13')]);}logger[_0x1f23('0x10')]('Schedule,\x20%s,\x20%s',_0x4a09d7,_0x3609be[_0x1f23('0x10')]['message']);return _0x159489(_0x3609be[_0x1f23('0x10')][_0x1f23('0x13')]);}else{logger[_0x1f23('0xc')](_0x1f23('0x12'),_0x4a09d7,_0x1f23('0xd'));_0x159489(_0x3609be[_0x1f23('0x14')][_0x1f23('0x13')]);}})['catch'](function(_0x52eb49){logger[_0x1f23('0x10')](_0x1f23('0x12'),_0x4a09d7,_0x52eb49);_0x1328e9(_0x52eb49);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 3448d39..3be0edf 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 _0x92ad=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id/download','download','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x10dc60,_0x2fcce1){var _0x47dec5=function(_0x24b5e4){while(--_0x24b5e4){_0x10dc60['push'](_0x10dc60['shift']());}};_0x47dec5(++_0x2fcce1);}(_0x92ad,0x108));var _0xd92a=function(_0x3a1aab,_0xb45bca){_0x3a1aab=_0x3a1aab-0x0;var _0x3fbab2=_0x92ad[_0x3a1aab];return _0x3fbab2;};'use strict';var multer=require(_0xd92a('0x0'));var util=require(_0xd92a('0x1'));var path=require(_0xd92a('0x2'));var timeout=require(_0xd92a('0x3'));var express=require('express');var router=express[_0xd92a('0x4')]();var fs_extra=require(_0xd92a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd92a('0x6'));var config=require(_0xd92a('0x7'));var controller=require('./screenRecording.controller');router[_0xd92a('0x8')]('/',auth[_0xd92a('0x9')](),controller['index']);router['get']('/describe',auth[_0xd92a('0x9')](),controller['describe']);router['get']('/:id',auth[_0xd92a('0x9')](),controller['show']);router[_0xd92a('0x8')](_0xd92a('0xa'),auth[_0xd92a('0x9')](),controller[_0xd92a('0xb')]);router['post']('/',auth[_0xd92a('0x9')](),controller[_0xd92a('0xc')]);router[_0xd92a('0xd')](_0xd92a('0xe'),auth[_0xd92a('0x9')](),controller[_0xd92a('0xf')]);router[_0xd92a('0x10')](_0xd92a('0xe'),auth[_0xd92a('0x9')](),controller[_0xd92a('0x11')]);module['exports']=router; \ No newline at end of file +var _0x00e9=['../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','create','put','update','exports','multer','util','path','express','Router','fs-extra'];(function(_0x4c6c17,_0x46fc5a){var _0x3d6cd6=function(_0x3cdba0){while(--_0x3cdba0){_0x4c6c17['push'](_0x4c6c17['shift']());}};_0x3d6cd6(++_0x46fc5a);}(_0x00e9,0x1c8));var _0x900e=function(_0x4bceef,_0x4177f8){_0x4bceef=_0x4bceef-0x0;var _0x3a74f6=_0x00e9[_0x4bceef];return _0x3a74f6;};'use strict';var multer=require(_0x900e('0x0'));var util=require(_0x900e('0x1'));var path=require(_0x900e('0x2'));var timeout=require('connect-timeout');var express=require(_0x900e('0x3'));var router=express[_0x900e('0x4')]();var fs_extra=require(_0x900e('0x5'));var auth=require(_0x900e('0x6'));var interaction=require(_0x900e('0x7'));var config=require(_0x900e('0x8'));var controller=require(_0x900e('0x9'));router[_0x900e('0xa')]('/',auth[_0x900e('0xb')](),controller['index']);router[_0x900e('0xa')](_0x900e('0xc'),auth[_0x900e('0xb')](),controller[_0x900e('0xd')]);router[_0x900e('0xa')](_0x900e('0xe'),auth['isAuthenticated'](),controller[_0x900e('0xf')]);router[_0x900e('0xa')](_0x900e('0x10'),auth['isAuthenticated'](),controller[_0x900e('0x11')]);router['post']('/',auth[_0x900e('0xb')](),controller[_0x900e('0x12')]);router[_0x900e('0x13')](_0x900e('0xe'),auth[_0x900e('0xb')](),controller[_0x900e('0x14')]);router['delete']('/:id',auth[_0x900e('0xb')](),controller['destroy']);module[_0x900e('0x15')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 6828428..fb5b6a7 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 _0xf55c=['toString','createdAt','updatedAt','sequelize','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm'];(function(_0x9b83c3,_0x307937){var _0xf071e4=function(_0x4a28c8){while(--_0x4a28c8){_0x9b83c3['push'](_0x9b83c3['shift']());}};_0xf071e4(++_0x307937);}(_0xf55c,0x1e7));var _0xcf55=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xf55c[_0x376b45];return _0x2341b3;};'use strict';var Sequelize=require(_0xcf55('0x0'));var moment=require('moment');var path=require(_0xcf55('0x1'));var config=require(_0xcf55('0x2'));module[_0xcf55('0x3')]={'format':{'type':Sequelize[_0xcf55('0x4')],'get':function(){return this[_0xcf55('0x5')](_0xcf55('0x6'))?path[_0xcf55('0x7')](this['getDataValue'](_0xcf55('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xcf55('0x8')]},'channel':{'type':Sequelize[_0xcf55('0x8')]},'value':{'type':Sequelize[_0xcf55('0x8')],'set':function(_0x4b3453){var _0x29566b=_0x4b3453[_0xcf55('0x9')](/\\/g,'/');this[_0xcf55('0xa')](_0xcf55('0x6'),_0x29566b);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xcf55('0xb')],'set':function(_0x3ce5d2){this[_0xcf55('0xa')](_0xcf55('0xc'),moment()[_0xcf55('0xd')](_0x3ce5d2,'ms'));this[_0xcf55('0xa')](_0xcf55('0xe'),moment());this['setDataValue'](_0xcf55('0xf'),_0x3ce5d2);}},'startedAt':{'type':Sequelize[_0xcf55('0x10')],'get':function(){return moment(this['getDataValue']('startedAt'))[_0xcf55('0x11')](_0xcf55('0x12'))[_0xcf55('0x13')]();}},'closedAt':{'type':Sequelize[_0xcf55('0x10')],'get':function(){return moment(this[_0xcf55('0x5')](_0xcf55('0xe')))[_0xcf55('0x11')](_0xcf55('0x12'))[_0xcf55('0x13')]();}},'createdAt':{'type':Sequelize[_0xcf55('0x10')],'get':function(){return moment(this[_0xcf55('0x5')](_0xcf55('0x14')))['format'](_0xcf55('0x12'))[_0xcf55('0x13')]();}},'updatedAt':{'type':Sequelize[_0xcf55('0x10')],'get':function(){return moment(this[_0xcf55('0x5')](_0xcf55('0x15')))['format'](_0xcf55('0x12'))[_0xcf55('0x13')]();}}}; \ No newline at end of file +var _0x27fb=['path','exports','getDataValue','value','extname','STRING','replace','INTEGER','setDataValue','startedAt','subtract','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','moment'];(function(_0x4a1c90,_0x426ead){var _0x280c0c=function(_0x24f5a7){while(--_0x24f5a7){_0x4a1c90['push'](_0x4a1c90['shift']());}};_0x280c0c(++_0x426ead);}(_0x27fb,0x1de));var _0xb27f=function(_0x260b34,_0x225d94){_0x260b34=_0x260b34-0x0;var _0x1ceaca=_0x27fb[_0x260b34];return _0x1ceaca;};'use strict';var Sequelize=require(_0xb27f('0x0'));var moment=require(_0xb27f('0x1'));var path=require(_0xb27f('0x2'));var config=require('../../config/environment');module[_0xb27f('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xb27f('0x4')](_0xb27f('0x5'))?path[_0xb27f('0x6')](this['getDataValue'](_0xb27f('0x5'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xb27f('0x7')]},'value':{'type':Sequelize[_0xb27f('0x7')],'set':function(_0x3cc341){var _0x1b7bd9=_0x3cc341[_0xb27f('0x8')](/\\/g,'/');this['setDataValue'](_0xb27f('0x5'),_0x1b7bd9);}},'rating':{'type':Sequelize[_0xb27f('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x338393){this[_0xb27f('0xa')](_0xb27f('0xb'),moment()[_0xb27f('0xc')](_0x338393,'ms'));this['setDataValue'](_0xb27f('0xd'),moment());this[_0xb27f('0xa')]('duration',_0x338393);}},'startedAt':{'type':Sequelize[_0xb27f('0xe')],'get':function(){return moment(this[_0xb27f('0x4')]('startedAt'))[_0xb27f('0xf')](_0xb27f('0x10'))[_0xb27f('0x11')]();}},'closedAt':{'type':Sequelize[_0xb27f('0xe')],'get':function(){return moment(this[_0xb27f('0x4')](_0xb27f('0xd')))['format'](_0xb27f('0x10'))['toString']();}},'createdAt':{'type':Sequelize[_0xb27f('0xe')],'get':function(){return moment(this['getDataValue'](_0xb27f('0x12')))[_0xb27f('0xf')](_0xb27f('0x10'))[_0xb27f('0x11')]();}},'updatedAt':{'type':Sequelize[_0xb27f('0xe')],'get':function(){return moment(this['getDataValue'](_0xb27f('0x13')))[_0xb27f('0xf')](_0xb27f('0x10'))[_0xb27f('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index a6da0ed..1f2317d 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 _0xee14=['path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','ScreenRecording','includeAll','include','findAll','rows','catch','params','find','create','body','duration','describe','../../components/encryptor','uniqueid','value','server/files/screen_recordings','existsSync','decryptFile','secrets','recording','root','Sequelize','ValidationError','filename','download','unlink','ScreenRecording\x20not\x20found','isNil','Entity\x20not\x20found','join','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x2a5c46,_0x17c14c){var _0x303342=function(_0x1406cd){while(--_0x1406cd){_0x2a5c46['push'](_0x2a5c46['shift']());}};_0x303342(++_0x17c14c);}(_0xee14,0x13a));var _0x4ee1=function(_0x29f0c2,_0x2eca9){_0x29f0c2=_0x29f0c2-0x0;var _0x3d6e72=_0xee14[_0x29f0c2];return _0x3d6e72;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4ee1('0x0'));var jsonpatch=require(_0x4ee1('0x1'));var rp=require(_0x4ee1('0x2'));var moment=require(_0x4ee1('0x3'));var BPromise=require(_0x4ee1('0x4'));var Mustache=require(_0x4ee1('0x5'));var util=require(_0x4ee1('0x6'));var path=require(_0x4ee1('0x7'));var sox=require(_0x4ee1('0x8'));var csv=require('to-csv');var ejs=require(_0x4ee1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ee1('0xa'));var squel=require(_0x4ee1('0xb'));var crypto=require(_0x4ee1('0xc'));var jsforce=require(_0x4ee1('0xd'));var deskjs=require(_0x4ee1('0xe'));var toCsv=require(_0x4ee1('0xf'));var querystring=require('querystring');var Papa=require(_0x4ee1('0x10'));var Redis=require(_0x4ee1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4ee1('0x12'));var as=require(_0x4ee1('0x13'));var hardwareService=require(_0x4ee1('0x14'));var logger=require(_0x4ee1('0x15'))('api');var utils=require(_0x4ee1('0x16'));var config=require(_0x4ee1('0x17'));var licenseUtil=require(_0x4ee1('0x18'));var db=require(_0x4ee1('0x19'))['db'];function respondWithStatusCode(_0x2f864e,_0x174427){_0x174427=_0x174427||0xcc;return function(_0x5616d6){if(_0x5616d6){return _0x2f864e[_0x4ee1('0x1a')](_0x174427);}return _0x2f864e[_0x4ee1('0x1b')](_0x174427)[_0x4ee1('0x1c')]();};}function respondWithResult(_0x24a915,_0x46d2c2){_0x46d2c2=_0x46d2c2||0xc8;return function(_0x1c342a){if(_0x1c342a){return _0x24a915[_0x4ee1('0x1b')](_0x46d2c2)[_0x4ee1('0x1d')](_0x1c342a);}};}function respondWithFilteredResult(_0xb7eafd,_0x4e3490){return function(_0x2f9194){if(_0x2f9194){var _0x38008f=typeof _0x4e3490[_0x4ee1('0x1e')]===_0x4ee1('0x1f')&&typeof _0x4e3490[_0x4ee1('0x20')]===_0x4ee1('0x1f');var _0x2eff91=_0x2f9194[_0x4ee1('0x21')];var _0x360056=_0x38008f?0x0:_0x4e3490[_0x4ee1('0x1e')];var _0x274de5=_0x38008f?_0x2f9194['count']:_0x4e3490[_0x4ee1('0x1e')]+_0x4e3490[_0x4ee1('0x20')];var _0x173388;if(_0x274de5>=_0x2eff91){_0x274de5=_0x2eff91;_0x173388=0xc8;}else{_0x173388=0xce;}_0xb7eafd[_0x4ee1('0x1b')](_0x173388);return _0xb7eafd[_0x4ee1('0x22')](_0x4ee1('0x23'),_0x360056+'-'+_0x274de5+'/'+_0x2eff91)['json'](_0x2f9194);}return null;};}function patchUpdates(_0x8a631f){return function(_0x333e96){try{jsonpatch[_0x4ee1('0x24')](_0x333e96,_0x8a631f,!![]);}catch(_0x3f0d59){return BPromise[_0x4ee1('0x25')](_0x3f0d59);}return _0x333e96[_0x4ee1('0x26')]();};}function saveUpdates(_0x328f21,_0x40fd98){return function(_0x1dc1a8){if(_0x1dc1a8){return _0x1dc1a8[_0x4ee1('0x27')](_0x328f21)['then'](function(_0x53d43f){return _0x53d43f;});}return null;};}function removeEntity(_0x14110c,_0x459e2e){return function(_0xaf87e7){if(_0xaf87e7){return _0xaf87e7[_0x4ee1('0x28')]()[_0x4ee1('0x29')](function(){_0x14110c[_0x4ee1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cc0b5,_0x442c71){return function(_0x28b7e1){if(!_0x28b7e1){_0x5cc0b5['sendStatus'](0x194);}return _0x28b7e1;};}function handleError(_0x35900d,_0x213db8){_0x213db8=_0x213db8||0x1f4;return function(_0x36654c){logger[_0x4ee1('0x2a')](_0x36654c[_0x4ee1('0x2b')]);if(_0x36654c[_0x4ee1('0x2c')]){delete _0x36654c[_0x4ee1('0x2c')];}_0x35900d['status'](_0x213db8)[_0x4ee1('0x2d')](_0x36654c);};}exports['index']=function(_0x4746c2,_0x4ec408){var _0x3dc870={},_0x1d91be={},_0x59a34e={'count':0x0,'rows':[]};var _0x13944c=_[_0x4ee1('0x2e')](db['ScreenRecording'][_0x4ee1('0x2f')],function(_0x5b3792){return{'name':_0x5b3792[_0x4ee1('0x30')],'type':_0x5b3792[_0x4ee1('0x31')][_0x4ee1('0x32')]};});_0x1d91be[_0x4ee1('0x33')]=_[_0x4ee1('0x34')](_['map'](_0x13944c,_0x4ee1('0x2c')),[_0x4ee1('0x35')]);_0x1d91be[_0x4ee1('0x36')]=_[_0x4ee1('0x37')](_0x4746c2[_0x4ee1('0x36')]);_0x1d91be[_0x4ee1('0x38')]=_['intersection'](_0x1d91be['model'],_0x1d91be[_0x4ee1('0x36')]);_0x3dc870[_0x4ee1('0x39')]=_[_0x4ee1('0x3a')](_0x1d91be['model'],qs[_0x4ee1('0x3b')](_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x3b')]));_0x3dc870[_0x4ee1('0x39')]=_0x3dc870[_0x4ee1('0x39')][_0x4ee1('0x3c')]?_0x3dc870[_0x4ee1('0x39')]:_0x1d91be[_0x4ee1('0x33')];if(!_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x3d')](_0x4ee1('0x3e'))){_0x3dc870[_0x4ee1('0x20')]=qs[_0x4ee1('0x20')](_0x4746c2['query'][_0x4ee1('0x20')]);_0x3dc870[_0x4ee1('0x1e')]=qs[_0x4ee1('0x1e')](_0x4746c2['query']['offset']);}_0x3dc870[_0x4ee1('0x3f')]=qs[_0x4ee1('0x40')](_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x40')]);_0x3dc870['where']=qs[_0x4ee1('0x38')](_[_0x4ee1('0x41')](_0x4746c2[_0x4ee1('0x36')],_0x1d91be[_0x4ee1('0x38')]),_0x13944c);if(_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x42')]){_0x3dc870[_0x4ee1('0x43')]=_[_0x4ee1('0x44')](_0x3dc870['where'],{'$or':_[_0x4ee1('0x2e')](_0x13944c,function(_0x1116b4){if(_0x1116b4[_0x4ee1('0x31')]!==_0x4ee1('0x45')){var _0x45bb22={};_0x45bb22[_0x1116b4[_0x4ee1('0x2c')]]={'$like':'%'+_0x4746c2['query'][_0x4ee1('0x42')]+'%'};return _0x45bb22;}})});}_0x3dc870=_[_0x4ee1('0x44')]({},_0x3dc870,_0x4746c2[_0x4ee1('0x46')]);var _0x333690={'where':_0x3dc870[_0x4ee1('0x43')]};return db[_0x4ee1('0x47')][_0x4ee1('0x21')](_0x333690)[_0x4ee1('0x29')](function(_0x23bb5f){_0x59a34e[_0x4ee1('0x21')]=_0x23bb5f;if(_0x4746c2[_0x4ee1('0x36')][_0x4ee1('0x48')]){_0x3dc870[_0x4ee1('0x49')]=[{'all':!![]}];}return db['ScreenRecording'][_0x4ee1('0x4a')](_0x3dc870);})[_0x4ee1('0x29')](function(_0x5ee7b4){_0x59a34e[_0x4ee1('0x4b')]=_0x5ee7b4;return _0x59a34e;})['then'](respondWithFilteredResult(_0x4ec408,_0x3dc870))[_0x4ee1('0x4c')](handleError(_0x4ec408,null));};exports['show']=function(_0x14c333,_0xc7580c){var _0x557126={'raw':![],'where':{'id':_0x14c333[_0x4ee1('0x4d')]['id']}},_0x25d683={};_0x25d683[_0x4ee1('0x33')]=_[_0x4ee1('0x37')](db['ScreenRecording'][_0x4ee1('0x2f')]);_0x25d683[_0x4ee1('0x36')]=_[_0x4ee1('0x37')](_0x14c333['query']);_0x25d683['filters']=_[_0x4ee1('0x3a')](_0x25d683[_0x4ee1('0x33')],_0x25d683[_0x4ee1('0x36')]);_0x557126[_0x4ee1('0x39')]=_[_0x4ee1('0x3a')](_0x25d683['model'],qs['fields'](_0x14c333[_0x4ee1('0x36')][_0x4ee1('0x3b')]));_0x557126[_0x4ee1('0x39')]=_0x557126[_0x4ee1('0x39')]['length']?_0x557126[_0x4ee1('0x39')]:_0x25d683[_0x4ee1('0x33')];if(_0x14c333['query'][_0x4ee1('0x48')]){_0x557126[_0x4ee1('0x49')]=[{'all':!![]}];}_0x557126=_[_0x4ee1('0x44')]({},_0x557126,_0x14c333[_0x4ee1('0x46')]);return db[_0x4ee1('0x47')][_0x4ee1('0x4e')](_0x557126)[_0x4ee1('0x29')](handleEntityNotFound(_0xc7580c,null))[_0x4ee1('0x29')](respondWithResult(_0xc7580c,null))[_0x4ee1('0x4c')](handleError(_0xc7580c,null));};exports['create']=function(_0x49b667,_0x1a972b){return db[_0x4ee1('0x47')][_0x4ee1('0x4f')](_0x49b667[_0x4ee1('0x50')],{})['then'](respondWithResult(_0x1a972b,0xc9))[_0x4ee1('0x4c')](handleError(_0x1a972b,null));};exports[_0x4ee1('0x27')]=function(_0x42dd8d,_0x2bc77f){if(_0x42dd8d[_0x4ee1('0x50')]['id']){delete _0x42dd8d['body']['id'];}delete _0x42dd8d[_0x4ee1('0x50')][_0x4ee1('0x51')];delete _0x42dd8d[_0x4ee1('0x50')]['createdAt'];delete _0x42dd8d[_0x4ee1('0x50')]['closedAt'];delete _0x42dd8d[_0x4ee1('0x50')]['value'];return db[_0x4ee1('0x47')]['find']({'where':{'id':_0x42dd8d[_0x4ee1('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2bc77f,null))[_0x4ee1('0x29')](saveUpdates(_0x42dd8d[_0x4ee1('0x50')],null))[_0x4ee1('0x29')](respondWithResult(_0x2bc77f,null))['catch'](handleError(_0x2bc77f,null));};exports[_0x4ee1('0x52')]=function(_0x4118d7,_0xcdb873){return db[_0x4ee1('0x47')][_0x4ee1('0x52')]()[_0x4ee1('0x29')](respondWithResult(_0xcdb873,null))[_0x4ee1('0x4c')](handleError(_0xcdb873,null));};exports['download']=function(_0x4c4178,_0x1feb78,_0xcddc5d){var _0xf58cd8=require(_0x4ee1('0x53'));var _0x44e65f=![];var _0x31e82d={};if(_0x4c4178[_0x4ee1('0x36')][_0x4ee1('0x31')]&&_0x4c4178[_0x4ee1('0x36')][_0x4ee1('0x31')]===_0x4ee1('0x54')){_0x31e82d[_0x4ee1('0x54')]=_0x4c4178[_0x4ee1('0x4d')]['id'];}else{_0x31e82d['id']=_0x4c4178['params']['id'];}return db[_0x4ee1('0x47')]['find']({'where':_0x31e82d,'attributes':['id',_0x4ee1('0x55')],'raw':!![]})[_0x4ee1('0x29')](handleEntityNotFound(_0x1feb78,null))['then'](function(_0x1e0aac){if(_0x1e0aac){var _0x184e36=path['join'](config['root'],_0x4ee1('0x56'),_0x1e0aac['value']);var _0x1ce99e=util[_0x4ee1('0x35')]('%s.cypher',_0x184e36);if(fs[_0x4ee1('0x57')](_0x1ce99e)){_0x44e65f=!![];return _0xf58cd8[_0x4ee1('0x58')](_0x1ce99e,_0x184e36,config[_0x4ee1('0x59')][_0x4ee1('0x5a')])[_0x4ee1('0x29')](function(){return _0x1e0aac;});}return _0x1e0aac;}})[_0x4ee1('0x29')](function(_0x11f619){if(_0x11f619){var _0x5f5694=path['join'](config[_0x4ee1('0x5b')],_0x4ee1('0x56'),_0x11f619['value']);if(!fs[_0x4ee1('0x57')](_0x5f5694)){throw new db[(_0x4ee1('0x5c'))][(_0x4ee1('0x5d'))]('ScreenRecording\x20not\x20found');}if(_0x11f619[_0x4ee1('0x5e')]){return _0x1feb78['download'](_0x5f5694,_0x11f619[_0x4ee1('0x5e')]+path['extname'](_0x5f5694),function(){if(_0x44e65f){fs['unlink'](_0x5f5694);}});}else{return _0x1feb78[_0x4ee1('0x5f')](_0x5f5694,function(_0x16fcd0){if(_0x44e65f){fs[_0x4ee1('0x60')](_0x5f5694);}});}}})[_0x4ee1('0x4c')](function(_0x38e889){if(_0x38e889['message']===_0x4ee1('0x61')){_0x1feb78[_0x4ee1('0x1b')](0x194)[_0x4ee1('0x2d')]('Not\x20found');}else{return handleError(_0x1feb78,null);}});};exports[_0x4ee1('0x28')]=function(_0x109dc6,_0x3fdd61){return db[_0x4ee1('0x47')][_0x4ee1('0x4e')]({'where':{'id':_0x109dc6[_0x4ee1('0x4d')]['id']}})[_0x4ee1('0x29')](function(_0x20ca0b){if(_[_0x4ee1('0x62')](_0x20ca0b)){throw new ReferenceError(_0x4ee1('0x63'));}return _0x20ca0b;})[_0x4ee1('0x29')](function(_0x38e86f){var _0x5d396c=path[_0x4ee1('0x64')](config['root'],_0x4ee1('0x56'),_0x38e86f['value']);logger[_0x4ee1('0x65')](_0x4ee1('0x66'),_0x5d396c);if(!_[_0x4ee1('0x62')](_0x38e86f[_0x4ee1('0x55')])&&fs[_0x4ee1('0x57')](_0x5d396c)){logger[_0x4ee1('0x65')](_0x4ee1('0x67')+_0x5d396c+_0x4ee1('0x68'));fs[_0x4ee1('0x69')](_0x5d396c);}_0x5d396c=_0x5d396c+_0x4ee1('0x6a');if(!_[_0x4ee1('0x62')](_0x38e86f[_0x4ee1('0x55')])&&fs['existsSync'](_0x5d396c)){logger[_0x4ee1('0x65')](_0x4ee1('0x67')+_0x5d396c+_0x4ee1('0x68'));fs['unlinkSync'](_0x5d396c);}return _0x38e86f;})['then'](function(_0x40dac3){if(!_0x40dac3)throw new InternalError();return _0x40dac3[_0x4ee1('0x28')]();})['then'](function(){_0x3fdd61[_0x4ee1('0x1b')](0xcc)[_0x4ee1('0x1c')]();})[_0x4ee1('0x4c')](handleError(_0x3fdd61,null));}; \ No newline at end of file +var _0x4c4e=['findAll','rows','catch','params','keys','find','create','body','duration','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','existsSync','secrets','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','destroy','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','sendStatus','name','index','map','ScreenRecording','rawAttributes','type','key','model','differenceBy','format','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include'];(function(_0x53a7a8,_0xed2bff){var _0x555f71=function(_0x48e696){while(--_0x48e696){_0x53a7a8['push'](_0x53a7a8['shift']());}};_0x555f71(++_0xed2bff);}(_0x4c4e,0x152));var _0xe4c4=function(_0x37a434,_0x1b9a87){_0x37a434=_0x37a434-0x0;var _0x3d9e9b=_0x4c4e[_0x37a434];return _0x3d9e9b;};'use strict';var emlformat=require(_0xe4c4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe4c4('0x1'));var jsonpatch=require(_0xe4c4('0x2'));var rp=require(_0xe4c4('0x3'));var moment=require('moment');var BPromise=require(_0xe4c4('0x4'));var Mustache=require(_0xe4c4('0x5'));var util=require(_0xe4c4('0x6'));var path=require('path');var sox=require(_0xe4c4('0x7'));var csv=require('to-csv');var ejs=require(_0xe4c4('0x8'));var fs=require('fs');var fs_extra=require(_0xe4c4('0x9'));var _=require(_0xe4c4('0xa'));var squel=require(_0xe4c4('0xb'));var crypto=require(_0xe4c4('0xc'));var jsforce=require(_0xe4c4('0xd'));var deskjs=require(_0xe4c4('0xe'));var toCsv=require(_0xe4c4('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe4c4('0x10'));var authService=require(_0xe4c4('0x11'));var qs=require(_0xe4c4('0x12'));var as=require(_0xe4c4('0x13'));var hardwareService=require(_0xe4c4('0x14'));var logger=require(_0xe4c4('0x15'))('api');var utils=require(_0xe4c4('0x16'));var config=require(_0xe4c4('0x17'));var licenseUtil=require(_0xe4c4('0x18'));var db=require(_0xe4c4('0x19'))['db'];function respondWithStatusCode(_0x50bfab,_0x262083){_0x262083=_0x262083||0xcc;return function(_0x115802){if(_0x115802){return _0x50bfab['sendStatus'](_0x262083);}return _0x50bfab[_0xe4c4('0x1a')](_0x262083)[_0xe4c4('0x1b')]();};}function respondWithResult(_0x5aa89b,_0x42ce9e){_0x42ce9e=_0x42ce9e||0xc8;return function(_0x29766a){if(_0x29766a){return _0x5aa89b['status'](_0x42ce9e)[_0xe4c4('0x1c')](_0x29766a);}};}function respondWithFilteredResult(_0x465c9b,_0x26ea05){return function(_0x40a36e){if(_0x40a36e){var _0x19e59b=typeof _0x26ea05[_0xe4c4('0x1d')]===_0xe4c4('0x1e')&&typeof _0x26ea05[_0xe4c4('0x1f')]===_0xe4c4('0x1e');var _0x36b10c=_0x40a36e[_0xe4c4('0x20')];var _0x42242c=_0x19e59b?0x0:_0x26ea05[_0xe4c4('0x1d')];var _0x43a9ce=_0x19e59b?_0x40a36e[_0xe4c4('0x20')]:_0x26ea05['offset']+_0x26ea05[_0xe4c4('0x1f')];var _0x24f946;if(_0x43a9ce>=_0x36b10c){_0x43a9ce=_0x36b10c;_0x24f946=0xc8;}else{_0x24f946=0xce;}_0x465c9b[_0xe4c4('0x1a')](_0x24f946);return _0x465c9b[_0xe4c4('0x21')]('Content-Range',_0x42242c+'-'+_0x43a9ce+'/'+_0x36b10c)[_0xe4c4('0x1c')](_0x40a36e);}return null;};}function patchUpdates(_0x1cad5d){return function(_0x1727eb){try{jsonpatch[_0xe4c4('0x22')](_0x1727eb,_0x1cad5d,!![]);}catch(_0x2c5aea){return BPromise[_0xe4c4('0x23')](_0x2c5aea);}return _0x1727eb[_0xe4c4('0x24')]();};}function saveUpdates(_0x393c96,_0x21bbb1){return function(_0x1a7690){if(_0x1a7690){return _0x1a7690[_0xe4c4('0x25')](_0x393c96)[_0xe4c4('0x26')](function(_0x138ead){return _0x138ead;});}return null;};}function removeEntity(_0x1db719,_0x15873e){return function(_0x59498e){if(_0x59498e){return _0x59498e['destroy']()[_0xe4c4('0x26')](function(){_0x1db719['status'](0xcc)[_0xe4c4('0x1b')]();});}};}function handleEntityNotFound(_0x5374fd,_0x3adfcb){return function(_0x5efc4c){if(!_0x5efc4c){_0x5374fd[_0xe4c4('0x27')](0x194);}return _0x5efc4c;};}function handleError(_0x583393,_0xba53ef){_0xba53ef=_0xba53ef||0x1f4;return function(_0x4a0199){logger['error'](_0x4a0199['stack']);if(_0x4a0199['name']){delete _0x4a0199[_0xe4c4('0x28')];}_0x583393['status'](_0xba53ef)['send'](_0x4a0199);};}exports[_0xe4c4('0x29')]=function(_0x11deab,_0x4bb911){var _0x57ba43={},_0x7428ad={},_0x33de43={'count':0x0,'rows':[]};var _0x4aa6c1=_[_0xe4c4('0x2a')](db[_0xe4c4('0x2b')][_0xe4c4('0x2c')],function(_0x48060e){return{'name':_0x48060e['fieldName'],'type':_0x48060e[_0xe4c4('0x2d')][_0xe4c4('0x2e')]};});_0x7428ad[_0xe4c4('0x2f')]=_[_0xe4c4('0x30')](_['map'](_0x4aa6c1,'name'),[_0xe4c4('0x31')]);_0x7428ad[_0xe4c4('0x32')]=_['keys'](_0x11deab[_0xe4c4('0x32')]);_0x7428ad[_0xe4c4('0x33')]=_[_0xe4c4('0x34')](_0x7428ad['model'],_0x7428ad[_0xe4c4('0x32')]);_0x57ba43['attributes']=_[_0xe4c4('0x34')](_0x7428ad[_0xe4c4('0x2f')],qs[_0xe4c4('0x35')](_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x35')]));_0x57ba43[_0xe4c4('0x36')]=_0x57ba43[_0xe4c4('0x36')][_0xe4c4('0x37')]?_0x57ba43[_0xe4c4('0x36')]:_0x7428ad[_0xe4c4('0x2f')];if(!_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x38')]('nolimit')){_0x57ba43[_0xe4c4('0x1f')]=qs[_0xe4c4('0x1f')](_0x11deab[_0xe4c4('0x32')]['limit']);_0x57ba43[_0xe4c4('0x1d')]=qs[_0xe4c4('0x1d')](_0x11deab[_0xe4c4('0x32')]['offset']);}_0x57ba43[_0xe4c4('0x39')]=qs[_0xe4c4('0x3a')](_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x3a')]);_0x57ba43[_0xe4c4('0x3b')]=qs[_0xe4c4('0x33')](_[_0xe4c4('0x3c')](_0x11deab[_0xe4c4('0x32')],_0x7428ad[_0xe4c4('0x33')]),_0x4aa6c1);if(_0x11deab[_0xe4c4('0x32')]['filter']){_0x57ba43[_0xe4c4('0x3b')]=_[_0xe4c4('0x3d')](_0x57ba43[_0xe4c4('0x3b')],{'$or':_[_0xe4c4('0x2a')](_0x4aa6c1,function(_0x4c5551){if(_0x4c5551[_0xe4c4('0x2d')]!==_0xe4c4('0x3e')){var _0x4e6bd9={};_0x4e6bd9[_0x4c5551[_0xe4c4('0x28')]]={'$like':'%'+_0x11deab[_0xe4c4('0x32')]['filter']+'%'};return _0x4e6bd9;}})});}_0x57ba43=_[_0xe4c4('0x3d')]({},_0x57ba43,_0x11deab[_0xe4c4('0x3f')]);var _0x127bcd={'where':_0x57ba43[_0xe4c4('0x3b')]};return db[_0xe4c4('0x2b')][_0xe4c4('0x20')](_0x127bcd)[_0xe4c4('0x26')](function(_0x43201e){_0x33de43[_0xe4c4('0x20')]=_0x43201e;if(_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x40')]){_0x57ba43[_0xe4c4('0x41')]=[{'all':!![]}];}return db['ScreenRecording'][_0xe4c4('0x42')](_0x57ba43);})[_0xe4c4('0x26')](function(_0x2b306d){_0x33de43[_0xe4c4('0x43')]=_0x2b306d;return _0x33de43;})[_0xe4c4('0x26')](respondWithFilteredResult(_0x4bb911,_0x57ba43))[_0xe4c4('0x44')](handleError(_0x4bb911,null));};exports['show']=function(_0x312a49,_0x526bef){var _0xca07dc={'raw':![],'where':{'id':_0x312a49[_0xe4c4('0x45')]['id']}},_0x3c067a={};_0x3c067a[_0xe4c4('0x2f')]=_[_0xe4c4('0x46')](db['ScreenRecording']['rawAttributes']);_0x3c067a[_0xe4c4('0x32')]=_[_0xe4c4('0x46')](_0x312a49[_0xe4c4('0x32')]);_0x3c067a['filters']=_[_0xe4c4('0x34')](_0x3c067a[_0xe4c4('0x2f')],_0x3c067a[_0xe4c4('0x32')]);_0xca07dc[_0xe4c4('0x36')]=_['intersection'](_0x3c067a[_0xe4c4('0x2f')],qs[_0xe4c4('0x35')](_0x312a49[_0xe4c4('0x32')][_0xe4c4('0x35')]));_0xca07dc[_0xe4c4('0x36')]=_0xca07dc[_0xe4c4('0x36')][_0xe4c4('0x37')]?_0xca07dc[_0xe4c4('0x36')]:_0x3c067a[_0xe4c4('0x2f')];if(_0x312a49['query'][_0xe4c4('0x40')]){_0xca07dc['include']=[{'all':!![]}];}_0xca07dc=_[_0xe4c4('0x3d')]({},_0xca07dc,_0x312a49[_0xe4c4('0x3f')]);return db[_0xe4c4('0x2b')][_0xe4c4('0x47')](_0xca07dc)[_0xe4c4('0x26')](handleEntityNotFound(_0x526bef,null))[_0xe4c4('0x26')](respondWithResult(_0x526bef,null))[_0xe4c4('0x44')](handleError(_0x526bef,null));};exports[_0xe4c4('0x48')]=function(_0x36f8ad,_0x18fb82){return db[_0xe4c4('0x2b')][_0xe4c4('0x48')](_0x36f8ad[_0xe4c4('0x49')],{})[_0xe4c4('0x26')](respondWithResult(_0x18fb82,0xc9))['catch'](handleError(_0x18fb82,null));};exports['update']=function(_0xe0e351,_0x198961){if(_0xe0e351['body']['id']){delete _0xe0e351[_0xe4c4('0x49')]['id'];}delete _0xe0e351[_0xe4c4('0x49')][_0xe4c4('0x4a')];delete _0xe0e351[_0xe4c4('0x49')][_0xe4c4('0x4b')];delete _0xe0e351['body'][_0xe4c4('0x4c')];delete _0xe0e351[_0xe4c4('0x49')]['value'];return db[_0xe4c4('0x2b')][_0xe4c4('0x47')]({'where':{'id':_0xe0e351['params']['id']}})[_0xe4c4('0x26')](handleEntityNotFound(_0x198961,null))['then'](saveUpdates(_0xe0e351[_0xe4c4('0x49')],null))[_0xe4c4('0x26')](respondWithResult(_0x198961,null))[_0xe4c4('0x44')](handleError(_0x198961,null));};exports[_0xe4c4('0x4d')]=function(_0x12eaed,_0x525534){return db[_0xe4c4('0x2b')][_0xe4c4('0x4d')]()[_0xe4c4('0x26')](respondWithResult(_0x525534,null))[_0xe4c4('0x44')](handleError(_0x525534,null));};exports[_0xe4c4('0x4e')]=function(_0x32a50e,_0x3ddcbe,_0x3aa205){var _0x1a96ba=require(_0xe4c4('0x4f'));var _0x1fe354=![];var _0x1940e3={};if(_0x32a50e[_0xe4c4('0x32')][_0xe4c4('0x2d')]&&_0x32a50e[_0xe4c4('0x32')][_0xe4c4('0x2d')]==='uniqueid'){_0x1940e3[_0xe4c4('0x50')]=_0x32a50e[_0xe4c4('0x45')]['id'];}else{_0x1940e3['id']=_0x32a50e[_0xe4c4('0x45')]['id'];}return db['ScreenRecording'][_0xe4c4('0x47')]({'where':_0x1940e3,'attributes':['id',_0xe4c4('0x51')],'raw':!![]})[_0xe4c4('0x26')](handleEntityNotFound(_0x3ddcbe,null))['then'](function(_0x45f959){if(_0x45f959){var _0x485c50=path[_0xe4c4('0x52')](config[_0xe4c4('0x53')],_0xe4c4('0x54'),_0x45f959['value']);var _0x479361=util[_0xe4c4('0x31')](_0xe4c4('0x55'),_0x485c50);if(fs[_0xe4c4('0x56')](_0x479361)){_0x1fe354=!![];return _0x1a96ba['decryptFile'](_0x479361,_0x485c50,config[_0xe4c4('0x57')]['recording'])['then'](function(){return _0x45f959;});}return _0x45f959;}})['then'](function(_0x4e08ec){if(_0x4e08ec){var _0x1ca931=path[_0xe4c4('0x52')](config[_0xe4c4('0x53')],_0xe4c4('0x54'),_0x4e08ec[_0xe4c4('0x51')]);if(!fs[_0xe4c4('0x56')](_0x1ca931)){throw new db['Sequelize'][(_0xe4c4('0x58'))](_0xe4c4('0x59'));}if(_0x4e08ec[_0xe4c4('0x5a')]){return _0x3ddcbe[_0xe4c4('0x4e')](_0x1ca931,_0x4e08ec[_0xe4c4('0x5a')]+path[_0xe4c4('0x5b')](_0x1ca931),function(){if(_0x1fe354){fs['unlink'](_0x1ca931);}});}else{return _0x3ddcbe['download'](_0x1ca931,function(_0x27599b){if(_0x1fe354){fs[_0xe4c4('0x5c')](_0x1ca931);}});}}})[_0xe4c4('0x44')](function(_0x3c8e44){if(_0x3c8e44[_0xe4c4('0x5d')]===_0xe4c4('0x59')){_0x3ddcbe[_0xe4c4('0x1a')](0x194)[_0xe4c4('0x5e')](_0xe4c4('0x5f'));}else{return handleError(_0x3ddcbe,null);}});};exports['destroy']=function(_0x59f033,_0x5a4138){return db['ScreenRecording'][_0xe4c4('0x47')]({'where':{'id':_0x59f033[_0xe4c4('0x45')]['id']}})[_0xe4c4('0x26')](function(_0x58f2dd){if(_[_0xe4c4('0x60')](_0x58f2dd)){throw new ReferenceError('Entity\x20not\x20found');}return _0x58f2dd;})[_0xe4c4('0x26')](function(_0x56ead3){var _0x5d6c0a=path[_0xe4c4('0x52')](config[_0xe4c4('0x53')],_0xe4c4('0x54'),_0x56ead3['value']);logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x5d6c0a);if(!_[_0xe4c4('0x60')](_0x56ead3[_0xe4c4('0x51')])&&fs['existsSync'](_0x5d6c0a)){logger[_0xe4c4('0x61')](_0xe4c4('0x62')+_0x5d6c0a+_0xe4c4('0x63'));fs['unlinkSync'](_0x5d6c0a);}_0x5d6c0a=_0x5d6c0a+'.cypher';if(!_[_0xe4c4('0x60')](_0x56ead3[_0xe4c4('0x51')])&&fs[_0xe4c4('0x56')](_0x5d6c0a)){logger[_0xe4c4('0x61')](_0xe4c4('0x62')+_0x5d6c0a+_0xe4c4('0x63'));fs['unlinkSync'](_0x5d6c0a);}return _0x56ead3;})[_0xe4c4('0x26')](function(_0x1bddd5){if(!_0x1bddd5)throw new InternalError();return _0x1bddd5[_0xe4c4('0x64')]();})['then'](function(){_0x5a4138[_0xe4c4('0x1a')](0xcc)[_0xe4c4('0x1b')]();})[_0xe4c4('0x44')](handleError(_0x5a4138,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 204755d..7dfc344 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 _0xa925=['../../config/environment','./screenRecording.attributes','exports','define','interactionid','lodash','util','api','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa925,0x94));var _0x5a92=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xa925[_0x38ced4];return _0x547c07;};'use strict';var _=require(_0x5a92('0x0'));var util=require(_0x5a92('0x1'));var logger=require('../../config/logger')(_0x5a92('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5a92('0x3'));var fs=require('fs');var path=require(_0x5a92('0x4'));var rimraf=require(_0x5a92('0x5'));var config=require(_0x5a92('0x6'));var attributes=require(_0x5a92('0x7'));module[_0x5a92('0x8')]=function(_0x349eec,_0x32d835){return _0x349eec[_0x5a92('0x9')]('ScreenRecording',attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x5a92('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x15cd=['request-promise','path','../../config/environment','define','ScreenRecording','interactionid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x15cd,0xea));var _0xd15c=function(_0x870b62,_0x2143f9){_0x870b62=_0x870b62-0x0;var _0x2dcb39=_0x15cd[_0x870b62];return _0x2dcb39;};'use strict';var _=require(_0xd15c('0x0'));var util=require(_0xd15c('0x1'));var logger=require(_0xd15c('0x2'))(_0xd15c('0x3'));var moment=require(_0xd15c('0x4'));var BPromise=require(_0xd15c('0x5'));var rp=require(_0xd15c('0x6'));var fs=require('fs');var path=require(_0xd15c('0x7'));var rimraf=require('rimraf');var config=require(_0xd15c('0x8'));var attributes=require('./screenRecording.attributes');module['exports']=function(_0x16189d,_0x5b15aa){return _0x16189d[_0xd15c('0x9')](_0xd15c('0xa'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0xd15c('0xb'),'fields':[_0xd15c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 849c750..06a913a 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 _0xa331=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util'];(function(_0x4c8812,_0xa9d102){var _0x42d129=function(_0x139047){while(--_0x139047){_0x4c8812['push'](_0x4c8812['shift']());}};_0x42d129(++_0xa9d102);}(_0xa331,0x175));var _0x1a33=function(_0x4c91af,_0xc7d39){_0x4c91af=_0x4c91af-0x0;var _0x9589bc=_0xa331[_0x4c91af];return _0x9589bc;};'use strict';var _=require(_0x1a33('0x0'));var util=require(_0x1a33('0x1'));var moment=require(_0x1a33('0x2'));var BPromise=require(_0x1a33('0x3'));var rs=require(_0x1a33('0x4'));var fs=require('fs');var Redis=require(_0x1a33('0x5'));var db=require(_0x1a33('0x6'))['db'];var utils=require(_0x1a33('0x7'));var logger=require(_0x1a33('0x8'))('rpc');var config=require(_0x1a33('0x9'));var jayson=require(_0x1a33('0xa'));var client=jayson[_0x1a33('0xb')][_0x1a33('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2690e5,_0x1f8b84,_0x36f314){return new BPromise(function(_0xf2314b,_0x3c60f3){return client[_0x1a33('0xd')](_0x2690e5,_0x36f314)[_0x1a33('0xe')](function(_0x2134b1){logger[_0x1a33('0xf')](_0x1a33('0x10'),_0x1f8b84,'request\x20sent');logger[_0x1a33('0x11')](_0x1a33('0x12'),_0x1f8b84,_0x1a33('0x13'),JSON[_0x1a33('0x14')](_0x2134b1));if(_0x2134b1[_0x1a33('0x15')]){if(_0x2134b1[_0x1a33('0x15')][_0x1a33('0x16')]===0x1f4){logger[_0x1a33('0x15')](_0x1a33('0x10'),_0x1f8b84,_0x2134b1[_0x1a33('0x15')][_0x1a33('0x17')]);return _0x3c60f3(_0x2134b1['error'][_0x1a33('0x17')]);}logger[_0x1a33('0x15')](_0x1a33('0x10'),_0x1f8b84,_0x2134b1[_0x1a33('0x15')][_0x1a33('0x17')]);return _0xf2314b(_0x2134b1[_0x1a33('0x15')][_0x1a33('0x17')]);}else{logger['info']('ScreenRecording,\x20%s,\x20%s',_0x1f8b84,_0x1a33('0x13'));_0xf2314b(_0x2134b1['result'][_0x1a33('0x17')]);}})[_0x1a33('0x18')](function(_0x2d80b6){logger['error'](_0x1a33('0x10'),_0x1f8b84,_0x2d80b6);_0x3c60f3(_0x2d80b6);});});} \ No newline at end of file +var _0x2e57=['http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x30e770,_0x46125d){var _0x5bc88d=function(_0x593377){while(--_0x593377){_0x30e770['push'](_0x30e770['shift']());}};_0x5bc88d(++_0x46125d);}(_0x2e57,0x16d));var _0x72e5=function(_0x163e0a,_0x4c4c09){_0x163e0a=_0x163e0a-0x0;var _0x1a39ea=_0x2e57[_0x163e0a];return _0x1a39ea;};'use strict';var _=require(_0x72e5('0x0'));var util=require('util');var moment=require(_0x72e5('0x1'));var BPromise=require(_0x72e5('0x2'));var rs=require(_0x72e5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x72e5('0x4'));var logger=require(_0x72e5('0x5'))(_0x72e5('0x6'));var config=require('../../config/environment');var jayson=require(_0x72e5('0x7'));var client=jayson[_0x72e5('0x8')][_0x72e5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ef6d3,_0x3a0429,_0x60b2ab){return new BPromise(function(_0x4a9feb,_0x18a8ab){return client[_0x72e5('0xa')](_0x1ef6d3,_0x60b2ab)[_0x72e5('0xb')](function(_0x32b7cb){logger[_0x72e5('0xc')](_0x72e5('0xd'),_0x3a0429,_0x72e5('0xe'));logger[_0x72e5('0xf')](_0x72e5('0x10'),_0x3a0429,_0x72e5('0xe'),JSON['stringify'](_0x32b7cb));if(_0x32b7cb[_0x72e5('0x11')]){if(_0x32b7cb[_0x72e5('0x11')][_0x72e5('0x12')]===0x1f4){logger[_0x72e5('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x3a0429,_0x32b7cb[_0x72e5('0x11')]['message']);return _0x18a8ab(_0x32b7cb[_0x72e5('0x11')][_0x72e5('0x13')]);}logger[_0x72e5('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x3a0429,_0x32b7cb['error'][_0x72e5('0x13')]);return _0x4a9feb(_0x32b7cb['error'][_0x72e5('0x13')]);}else{logger[_0x72e5('0xc')](_0x72e5('0xd'),_0x3a0429,_0x72e5('0xe'));_0x4a9feb(_0x32b7cb[_0x72e5('0x14')][_0x72e5('0x13')]);}})[_0x72e5('0x15')](function(_0x3c334c){logger[_0x72e5('0x11')](_0x72e5('0xd'),_0x3a0429,_0x3c334c);_0x18a8ab(_0x3c334c);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index d2b7134..74009c3 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 _0xa49e=['/:id/logo_login','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','format','logo','extname','originalname','post','file','addLogo','%s%s','logologin','single','server/files/images/logos/','favicon','addFavicon','put','exports','util','path','express','Router','../../components/auth/service','../../config/environment','./setting.controller','get','isAuthenticated','getDate','/:id','show','/:id/logo','getLogo'];(function(_0x26660c,_0xa474ef){var _0x21fb98=function(_0xcedc16){while(--_0xcedc16){_0x26660c['push'](_0x26660c['shift']());}};_0x21fb98(++_0xa474ef);}(_0xa49e,0xdc));var _0xea49=function(_0x1a051d,_0x3a017a){_0x1a051d=_0x1a051d-0x0;var _0x275ccb=_0xa49e[_0x1a051d];return _0x275ccb;};'use strict';var multer=require('multer');var util=require(_0xea49('0x0'));var path=require(_0xea49('0x1'));var timeout=require('connect-timeout');var express=require(_0xea49('0x2'));var router=express[_0xea49('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xea49('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xea49('0x5'));var controller=require(_0xea49('0x6'));router[_0xea49('0x7')]('/',auth[_0xea49('0x8')](),controller['index']);router[_0xea49('0x7')]('/now',controller[_0xea49('0x9')]);router[_0xea49('0x7')](_0xea49('0xa'),controller[_0xea49('0xb')]);router[_0xea49('0x7')](_0xea49('0xc'),controller[_0xea49('0xd')]);router[_0xea49('0x7')](_0xea49('0xe'),controller['getLogoLogin']);router[_0xea49('0x7')](_0xea49('0xf'),controller[_0xea49('0x10')]);router[_0xea49('0x7')](_0xea49('0x11'),controller[_0xea49('0x12')]);router[_0xea49('0x7')](_0xea49('0x13'),controller[_0xea49('0x14')]);var upload=multer({'storage':multer[_0xea49('0x15')]({'destination':function(_0x53577a,_0x2cc278,_0x3f1951){_0x3f1951(null,path[_0xea49('0x16')](config[_0xea49('0x17')],'server/files/images/logos/'));},'filename':function(_0x3bf966,_0x295cd4,_0x631bb2){_0x631bb2(null,util[_0xea49('0x18')]('%s%s',_0xea49('0x19'),path[_0xea49('0x1a')](_0x295cd4[_0xea49('0x1b')])));}})});router[_0xea49('0x1c')](_0xea49('0xc'),upload['single'](_0xea49('0x1d')),controller[_0xea49('0x1e')]);var upload=multer({'storage':multer[_0xea49('0x15')]({'destination':function(_0xbd9f16,_0x5b651d,_0x3ad486){_0x3ad486(null,path[_0xea49('0x16')](config['root'],'server/files/images/logos/'));},'filename':function(_0x7e31a1,_0x432bde,_0x539bd4){_0x539bd4(null,util[_0xea49('0x18')](_0xea49('0x1f'),_0xea49('0x20'),path[_0xea49('0x1a')](_0x432bde[_0xea49('0x1b')])));}})});router[_0xea49('0x1c')]('/:id/logo_login',upload[_0xea49('0x21')]('file'),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xea49('0x15')]({'destination':function(_0x3c4693,_0x3aca1c,_0x557a0f){_0x557a0f(null,path[_0xea49('0x16')](config[_0xea49('0x17')],_0xea49('0x22')));},'filename':function(_0x1b08bb,_0x10814b,_0x19df2b){_0x19df2b(null,util[_0xea49('0x18')](_0xea49('0x1f'),'preferred',path[_0xea49('0x1a')](_0x10814b[_0xea49('0x1b')])));}})});router[_0xea49('0x1c')]('/:id/preferred',upload[_0xea49('0x21')](_0xea49('0x1d')),controller['addPreferred']);var upload=multer({'storage':multer[_0xea49('0x15')]({'destination':function(_0x313115,_0x26a746,_0x2f17f6){_0x2f17f6(null,path[_0xea49('0x16')](config[_0xea49('0x17')],_0xea49('0x22')));},'filename':function(_0x13202b,_0x336e00,_0x526edd){_0x526edd(null,util[_0xea49('0x18')]('%s%s',_0xea49('0x23'),path['extname'](_0x336e00['originalname'])));}})});router[_0xea49('0x1c')]('/:id/favicon',upload['single'](_0xea49('0x1d')),controller[_0xea49('0x24')]);router[_0xea49('0x25')]('/:id',auth['isAuthenticated'](),controller['update']);module[_0xea49('0x26')]=router; \ No newline at end of file +var _0xaa80=['addPreferred','favicon','put','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','index','get','/now','getDate','/:id','getLogo','/:id/logo_login','getLogoLogin','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','root','server/files/images/logos/','%s%s','logo','extname','originalname','post','/:id/logo','single','file','addLogo','diskStorage','join','format','logologin','addLogoLogin','preferred'];(function(_0x2ca985,_0x5d63c1){var _0x36f271=function(_0x4aa334){while(--_0x4aa334){_0x2ca985['push'](_0x2ca985['shift']());}};_0x36f271(++_0x5d63c1);}(_0xaa80,0x119));var _0x0aa8=function(_0x3fe95d,_0x463b02){_0x3fe95d=_0x3fe95d-0x0;var _0x5d96dc=_0xaa80[_0x3fe95d];return _0x5d96dc;};'use strict';var multer=require('multer');var util=require(_0x0aa8('0x0'));var path=require(_0x0aa8('0x1'));var timeout=require(_0x0aa8('0x2'));var express=require(_0x0aa8('0x3'));var router=express[_0x0aa8('0x4')]();var fs_extra=require(_0x0aa8('0x5'));var auth=require(_0x0aa8('0x6'));var interaction=require(_0x0aa8('0x7'));var config=require(_0x0aa8('0x8'));var controller=require(_0x0aa8('0x9'));router['get']('/',auth[_0x0aa8('0xa')](),controller[_0x0aa8('0xb')]);router[_0x0aa8('0xc')](_0x0aa8('0xd'),controller[_0x0aa8('0xe')]);router[_0x0aa8('0xc')](_0x0aa8('0xf'),controller['show']);router[_0x0aa8('0xc')]('/:id/logo',controller[_0x0aa8('0x10')]);router[_0x0aa8('0xc')](_0x0aa8('0x11'),controller[_0x0aa8('0x12')]);router[_0x0aa8('0xc')]('/:id/gdpr',controller[_0x0aa8('0x13')]);router['get'](_0x0aa8('0x14'),controller[_0x0aa8('0x15')]);router['get'](_0x0aa8('0x16'),controller[_0x0aa8('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x955868,_0x3b6927,_0x23426c){_0x23426c(null,path['join'](config[_0x0aa8('0x18')],_0x0aa8('0x19')));},'filename':function(_0x266339,_0x195169,_0xc89978){_0xc89978(null,util['format'](_0x0aa8('0x1a'),_0x0aa8('0x1b'),path[_0x0aa8('0x1c')](_0x195169[_0x0aa8('0x1d')])));}})});router[_0x0aa8('0x1e')](_0x0aa8('0x1f'),upload[_0x0aa8('0x20')](_0x0aa8('0x21')),controller[_0x0aa8('0x22')]);var upload=multer({'storage':multer[_0x0aa8('0x23')]({'destination':function(_0x3400f8,_0x37e14e,_0x415b2e){_0x415b2e(null,path[_0x0aa8('0x24')](config[_0x0aa8('0x18')],'server/files/images/logos/'));},'filename':function(_0xe7ee8,_0x3b7e9a,_0x12ca66){_0x12ca66(null,util[_0x0aa8('0x25')](_0x0aa8('0x1a'),_0x0aa8('0x26'),path[_0x0aa8('0x1c')](_0x3b7e9a[_0x0aa8('0x1d')])));}})});router[_0x0aa8('0x1e')](_0x0aa8('0x11'),upload[_0x0aa8('0x20')]('file'),controller[_0x0aa8('0x27')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x8e2743,_0x2fbbd4,_0x902c29){_0x902c29(null,path['join'](config[_0x0aa8('0x18')],_0x0aa8('0x19')));},'filename':function(_0x116c6d,_0x58b0ee,_0x453ca7){_0x453ca7(null,util['format'](_0x0aa8('0x1a'),_0x0aa8('0x28'),path[_0x0aa8('0x1c')](_0x58b0ee['originalname'])));}})});router[_0x0aa8('0x1e')](_0x0aa8('0x14'),upload['single'](_0x0aa8('0x21')),controller[_0x0aa8('0x29')]);var upload=multer({'storage':multer[_0x0aa8('0x23')]({'destination':function(_0x4c9857,_0x30f06f,_0x3bd76e){_0x3bd76e(null,path[_0x0aa8('0x24')](config[_0x0aa8('0x18')],'server/files/images/logos/'));},'filename':function(_0x4f0d22,_0x4e1e7a,_0x598f6c){_0x598f6c(null,util[_0x0aa8('0x25')](_0x0aa8('0x1a'),_0x0aa8('0x2a'),path['extname'](_0x4e1e7a[_0x0aa8('0x1d')])));}})});router[_0x0aa8('0x1e')](_0x0aa8('0x16'),upload[_0x0aa8('0x20')](_0x0aa8('0x21')),controller['addFavicon']);router[_0x0aa8('0x2b')](_0x0aa8('0xf'),auth[_0x0aa8('0xa')](),controller[_0x0aa8('0x2c')]);module[_0x0aa8('0x2d')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 529a8af..7a56c79 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 _0xf865=['https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','sequelize','exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN'];(function(_0x1c0e80,_0x31928e){var _0x39ce51=function(_0x4f40f8){while(--_0x4f40f8){_0x1c0e80['push'](_0x1c0e80['shift']());}};_0x39ce51(++_0x31928e);}(_0xf865,0x11a));var _0x5f86=function(_0x3e7e96,_0x5683ca){_0x3e7e96=_0x3e7e96-0x0;var _0x13f6f0=_0xf865[_0x3e7e96];return _0x13f6f0;};'use strict';var Sequelize=require(_0x5f86('0x0'));module[_0x5f86('0x1')]={'min_internal':{'type':Sequelize[_0x5f86('0x2')](0xb),'unique':_0x5f86('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x5f86('0x2')](0xb),'unique':_0x5f86('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x5f86('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x5f86('0x5')],'defaultValue':_0x5f86('0x6')},'logo':{'type':Sequelize[_0x5f86('0x5')]},'defaultLogo':{'type':Sequelize[_0x5f86('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x5f86('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x5f86('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x5f86('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x5f86('0x5')]},'turnusername':{'type':Sequelize[_0x5f86('0x5')]},'turnpassword':{'type':Sequelize[_0x5f86('0x5')]},'pageTitle':{'type':Sequelize[_0x5f86('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x5f86('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x5f86('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x5f86('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x5f86('0x5')],'defaultValue':_0x5f86('0x8')},'enableEmailPreview':{'type':Sequelize[_0x5f86('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x5f86('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x5f86('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x5f86('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x5f86('0x5')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x5f86('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x5f86('0x5')]},'defaultPreferred':{'type':Sequelize[_0x5f86('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x5f86('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x5f86('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x5f86('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x5f86('0x5')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x5f86('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x5f86('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x5f86('0x2')]},'transcribeRegion':{'type':Sequelize[_0x5f86('0x5')]},'sentiment':{'type':Sequelize[_0x5f86('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x5f86('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x5f86('0x2')]},'sentimentRegion':{'type':Sequelize[_0x5f86('0x5')]},'language':{'type':Sequelize[_0x5f86('0x5')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x5f86('0x7')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x5f86('0x2')](0x2)[_0x5f86('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x5f86('0x2')](0x2)[_0x5f86('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x5f86('0x2')](0x2)[_0x5f86('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x5f86('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x5f86('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x5f86('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x5f86('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x5f86('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x5f86('0x7')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x5f86('0x7')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x5f86('0x2')],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0x5f86('0x7')],'defaultValue':![]},'limitTabs':{'type':Sequelize['INTEGER'],'defaultValue':0x14}}; \ No newline at end of file +var _0x80e0=['/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','INTEGER','min_internal','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x80e0,0x9d));var _0x080e=function(_0x5c0bd8,_0x24c304){_0x5c0bd8=_0x5c0bd8-0x0;var _0x14eca7=_0x80e0[_0x5c0bd8];return _0x14eca7;};'use strict';var Sequelize=require('sequelize');module['exports']={'min_internal':{'type':Sequelize[_0x080e('0x0')](0xb),'unique':_0x080e('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x080e('0x0')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x080e('0x0')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x080e('0x2')],'defaultValue':_0x080e('0x3')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x080e('0x4')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x080e('0x2')]},'defaultLoginLogo':{'type':Sequelize[_0x080e('0x4')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x080e('0x4')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x080e('0x2')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x080e('0x2')]},'pageTitle':{'type':Sequelize[_0x080e('0x2')]},'defaultPageTitle':{'type':Sequelize[_0x080e('0x4')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x080e('0x4')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x080e('0x0')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x080e('0x5')},'enableEmailPreview':{'type':Sequelize[_0x080e('0x4')],'defaultValue':![]},'split':{'type':Sequelize[_0x080e('0x4')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x080e('0x0')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x080e('0x2')],'defaultValue':_0x080e('0x6')},'chatTimeout':{'type':Sequelize[_0x080e('0x0')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x080e('0x2')]},'defaultPreferred':{'type':Sequelize[_0x080e('0x4')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x080e('0x2')]},'defaultFavicon':{'type':Sequelize[_0x080e('0x4')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x080e('0x4')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x080e('0x4')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x080e('0x0')]},'sentimentRegion':{'type':Sequelize[_0x080e('0x2')]},'language':{'type':Sequelize[_0x080e('0x2')]},'bucket':{'type':Sequelize[_0x080e('0x2')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x080e('0x4')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x080e('0x4')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x080e('0x0')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x080e('0x0')](0x2)[_0x080e('0x7')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x080e('0x0')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x080e('0x0')](0x2)[_0x080e('0x7')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x080e('0x4')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x080e('0x0')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x080e('0x0')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x080e('0x0')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x080e('0x4')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x080e('0x4')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x080e('0x4')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x080e('0x0')],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0x080e('0x4')],'defaultValue':![]},'limitTabs':{'type':Sequelize['INTEGER'],'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 dcf11a6..6134278 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 _0x0662=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','info','Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','stack','name','index','map','Setting','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','then','include','findAll','show','includeAll','find','update','body','params','addLogo','file','filename','logo','loginLogo','server/files/images/logos','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','root','toLower','join','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','getLogoLogin','getLicense','defaultLogo','default_loginLogo.svg','securePassword','addPreferred','getPreferred','default_preferred.png','download','getFavicon','default_favicon.ico','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x55c632,_0x2e7b2b){var _0x204ede=function(_0x1ddae5){while(--_0x1ddae5){_0x55c632['push'](_0x55c632['shift']());}};_0x204ede(++_0x2e7b2b);}(_0x0662,0x175));var _0x2066=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x0662[_0x5783f4];return _0x28e380;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2066('0x0'));var zipdir=require(_0x2066('0x1'));var jsonpatch=require(_0x2066('0x2'));var rp=require(_0x2066('0x3'));var moment=require('moment');var BPromise=require(_0x2066('0x4'));var Mustache=require(_0x2066('0x5'));var util=require(_0x2066('0x6'));var path=require(_0x2066('0x7'));var sox=require(_0x2066('0x8'));var csv=require(_0x2066('0x9'));var ejs=require(_0x2066('0xa'));var fs=require('fs');var fs_extra=require(_0x2066('0xb'));var _=require(_0x2066('0xc'));var squel=require(_0x2066('0xd'));var crypto=require(_0x2066('0xe'));var jsforce=require(_0x2066('0xf'));var deskjs=require(_0x2066('0x10'));var toCsv=require(_0x2066('0x9'));var querystring=require(_0x2066('0x11'));var Papa=require(_0x2066('0x12'));var Redis=require(_0x2066('0x13'));var authService=require(_0x2066('0x14'));var qs=require(_0x2066('0x15'));var as=require(_0x2066('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2066('0x17'))(_0x2066('0x18'));var utils=require(_0x2066('0x19'));var config=require(_0x2066('0x1a'));var licenseUtil=require(_0x2066('0x1b'));var db=require(_0x2066('0x1c'))['db'];var jayson=require(_0x2066('0x1d'));var client=jayson[_0x2066('0x1e')][_0x2066('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x341d13,_0x3878f4,_0x1d537c,_0x15038c){return new BPromise(function(_0x1b1f68,_0xb2f61d){var _0x279782=_0x15038c||client;return _0x279782['request'](_0x341d13,_0x1d537c)['then'](function(_0x1ed390){logger[_0x2066('0x20')](_0x2066('0x21'),_0x3878f4,'request\x20sent');logger['debug'](_0x2066('0x22'),_0x3878f4,_0x2066('0x23'),JSON[_0x2066('0x24')](_0x1ed390));if(_0x1ed390[_0x2066('0x25')]){if(_0x1ed390[_0x2066('0x25')][_0x2066('0x26')]===0x1f4){logger[_0x2066('0x25')](_0x2066('0x21'),_0x3878f4,_0x1ed390['error']['message']);return _0xb2f61d(_0x1ed390['error'][_0x2066('0x27')]);}logger['error'](_0x2066('0x21'),_0x3878f4,_0x1ed390['error']['message']);return _0x1b1f68(_0x1ed390['error']['message']);}else{logger['info'](_0x2066('0x21'),_0x3878f4,'request\x20sent');_0x1b1f68(_0x1ed390[_0x2066('0x28')][_0x2066('0x27')]);}})[_0x2066('0x29')](function(_0x10512d){logger[_0x2066('0x25')](_0x2066('0x21'),_0x3878f4,_0x10512d);_0xb2f61d(_0x10512d);});});}function respondWithStatusCode(_0x35d882,_0x5c2a1a){_0x5c2a1a=_0x5c2a1a||0xcc;return function(_0x807bf4){if(_0x807bf4){return _0x35d882[_0x2066('0x2a')](_0x5c2a1a);}return _0x35d882[_0x2066('0x2b')](_0x5c2a1a)[_0x2066('0x2c')]();};}function respondWithResult(_0x1ff0af,_0x17cbd7){_0x17cbd7=_0x17cbd7||0xc8;return function(_0x5c361c){if(_0x5c361c){return _0x1ff0af['status'](_0x17cbd7)[_0x2066('0x2d')](_0x5c361c);}};}function respondWithFilteredResult(_0x4acc66,_0x200ebe){return function(_0xe1e656){if(_0xe1e656){var _0xd6c366=typeof _0x200ebe[_0x2066('0x2e')]===_0x2066('0x2f')&&typeof _0x200ebe['limit']===_0x2066('0x2f');var _0x531bb6=_0xe1e656[_0x2066('0x30')];var _0x4d826b=_0xd6c366?0x0:_0x200ebe[_0x2066('0x2e')];var _0x4de5d7=_0xd6c366?_0xe1e656[_0x2066('0x30')]:_0x200ebe[_0x2066('0x2e')]+_0x200ebe[_0x2066('0x31')];var _0x4a6b83;if(_0x4de5d7>=_0x531bb6){_0x4de5d7=_0x531bb6;_0x4a6b83=0xc8;}else{_0x4a6b83=0xce;}_0x4acc66[_0x2066('0x2b')](_0x4a6b83);return _0x4acc66[_0x2066('0x32')](_0x2066('0x33'),_0x4d826b+'-'+_0x4de5d7+'/'+_0x531bb6)[_0x2066('0x2d')](_0xe1e656);}return null;};}function patchUpdates(_0x39cb0b){return function(_0x46dc0b){try{jsonpatch[_0x2066('0x34')](_0x46dc0b,_0x39cb0b,!![]);}catch(_0x393aa5){return BPromise[_0x2066('0x35')](_0x393aa5);}return _0x46dc0b[_0x2066('0x36')]();};}function saveUpdates(_0x57370c,_0x50d222){return function(_0x160149){if(_0x160149){return _0x160149['update'](_0x57370c)['then'](function(_0x5c5f3d){return _0x5c5f3d;});}return null;};}function removeEntity(_0x6210b2,_0x473dda){return function(_0x23f418){if(_0x23f418){return _0x23f418[_0x2066('0x37')]()['then'](function(){_0x6210b2[_0x2066('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ee13c,_0x23378e){return function(_0x4c642a){if(!_0x4c642a){_0x4ee13c[_0x2066('0x2a')](0x194);}return _0x4c642a;};}function handleError(_0x3d2aa5,_0x2c493d){_0x2c493d=_0x2c493d||0x1f4;return function(_0x3e07c9){logger[_0x2066('0x25')](_0x3e07c9[_0x2066('0x38')]);if(_0x3e07c9['name']){delete _0x3e07c9[_0x2066('0x39')];}_0x3d2aa5[_0x2066('0x2b')](_0x2c493d)['send'](_0x3e07c9);};}exports[_0x2066('0x3a')]=function(_0x4c8eb2,_0x2367dc){var _0x14bfd2={},_0xfe221e={},_0x121d97={'count':0x0,'rows':[]};var _0x4e9985=_[_0x2066('0x3b')](db[_0x2066('0x3c')][_0x2066('0x3d')],function(_0x115612){return{'name':_0x115612[_0x2066('0x3e')],'type':_0x115612[_0x2066('0x3f')][_0x2066('0x40')]};});_0xfe221e[_0x2066('0x41')]=_[_0x2066('0x3b')](_0x4e9985,_0x2066('0x39'));_0xfe221e[_0x2066('0x42')]=_[_0x2066('0x43')](_0x4c8eb2[_0x2066('0x42')]);_0xfe221e[_0x2066('0x44')]=_[_0x2066('0x45')](_0xfe221e[_0x2066('0x41')],_0xfe221e[_0x2066('0x42')]);_0x14bfd2[_0x2066('0x46')]=_[_0x2066('0x45')](_0xfe221e[_0x2066('0x41')],qs['fields'](_0x4c8eb2[_0x2066('0x42')][_0x2066('0x47')]));_0x14bfd2[_0x2066('0x46')]=_0x14bfd2['attributes'][_0x2066('0x48')]?_0x14bfd2['attributes']:_0xfe221e[_0x2066('0x41')];if(!_0x4c8eb2[_0x2066('0x42')]['hasOwnProperty'](_0x2066('0x49'))){_0x14bfd2[_0x2066('0x31')]=qs[_0x2066('0x31')](_0x4c8eb2[_0x2066('0x42')][_0x2066('0x31')]);_0x14bfd2[_0x2066('0x2e')]=qs[_0x2066('0x2e')](_0x4c8eb2['query']['offset']);}_0x14bfd2[_0x2066('0x4a')]=qs['sort'](_0x4c8eb2[_0x2066('0x42')][_0x2066('0x4b')]);_0x14bfd2['where']=qs[_0x2066('0x44')](_[_0x2066('0x4c')](_0x4c8eb2[_0x2066('0x42')],_0xfe221e[_0x2066('0x44')]),_0x4e9985);if(_0x4c8eb2[_0x2066('0x42')][_0x2066('0x4d')]){_0x14bfd2[_0x2066('0x4e')]=_[_0x2066('0x4f')](_0x14bfd2[_0x2066('0x4e')],{'$or':_[_0x2066('0x3b')](_0x4e9985,function(_0x557e54){if(_0x557e54[_0x2066('0x3f')]!=='VIRTUAL'){var _0x1415ae={};_0x1415ae[_0x557e54[_0x2066('0x39')]]={'$like':'%'+_0x4c8eb2['query'][_0x2066('0x4d')]+'%'};return _0x1415ae;}})});}_0x14bfd2=_[_0x2066('0x4f')]({},_0x14bfd2,_0x4c8eb2[_0x2066('0x50')]);var _0x2725f8={'where':_0x14bfd2[_0x2066('0x4e')]};return db[_0x2066('0x3c')][_0x2066('0x30')](_0x2725f8)[_0x2066('0x51')](function(_0x2a0283){_0x121d97[_0x2066('0x30')]=_0x2a0283;if(_0x4c8eb2[_0x2066('0x42')]['includeAll']){_0x14bfd2[_0x2066('0x52')]=[{'all':!![]}];}return db[_0x2066('0x3c')][_0x2066('0x53')](_0x14bfd2);})[_0x2066('0x51')](function(_0x4c9cae){_0x121d97['rows']=_0x4c9cae;return _0x121d97;})[_0x2066('0x51')](respondWithFilteredResult(_0x2367dc,_0x14bfd2))[_0x2066('0x29')](handleError(_0x2367dc,null));};exports[_0x2066('0x54')]=function(_0x1f5781,_0x511336){var _0x2e4fd9={'raw':![],'where':{'id':_0x1f5781['params']['id']}},_0x8173c8={};_0x8173c8[_0x2066('0x41')]=_[_0x2066('0x43')](db[_0x2066('0x3c')][_0x2066('0x3d')]);_0x8173c8[_0x2066('0x42')]=_[_0x2066('0x43')](_0x1f5781[_0x2066('0x42')]);_0x8173c8['filters']=_[_0x2066('0x45')](_0x8173c8[_0x2066('0x41')],_0x8173c8[_0x2066('0x42')]);_0x2e4fd9[_0x2066('0x46')]=_['intersection'](_0x8173c8['model'],qs[_0x2066('0x47')](_0x1f5781['query'][_0x2066('0x47')]));_0x2e4fd9[_0x2066('0x46')]=_0x2e4fd9[_0x2066('0x46')][_0x2066('0x48')]?_0x2e4fd9[_0x2066('0x46')]:_0x8173c8['model'];if(_0x1f5781['query'][_0x2066('0x55')]){_0x2e4fd9[_0x2066('0x52')]=[{'all':!![]}];}_0x2e4fd9=_[_0x2066('0x4f')]({},_0x2e4fd9,_0x1f5781[_0x2066('0x50')]);return db[_0x2066('0x3c')][_0x2066('0x56')](_0x2e4fd9)[_0x2066('0x51')](handleEntityNotFound(_0x511336,null))[_0x2066('0x51')](respondWithResult(_0x511336,null))['catch'](handleError(_0x511336,null));};exports[_0x2066('0x57')]=function(_0x216070,_0x155c69){if(_0x216070[_0x2066('0x58')]['id']){delete _0x216070[_0x2066('0x58')]['id'];}return db[_0x2066('0x3c')]['find']({'where':{'id':_0x216070[_0x2066('0x59')]['id']}})[_0x2066('0x51')](handleEntityNotFound(_0x155c69,null))['then'](saveUpdates(_0x216070['body'],null))[_0x2066('0x51')](respondWithResult(_0x155c69,null))['catch'](handleError(_0x155c69,null));};exports[_0x2066('0x5a')]=function(_0x29e587,_0x42c92b,_0x56b04c){if(_0x29e587[_0x2066('0x5b')]&&_0x29e587['file'][_0x2066('0x5c')]){_0x29e587[_0x2066('0x58')][_0x2066('0x5d')]=_0x29e587['file'][_0x2066('0x5c')];}return db[_0x2066('0x3c')][_0x2066('0x56')]({'where':{'id':_0x29e587['params']['id']}})[_0x2066('0x51')](handleEntityNotFound(_0x42c92b,null))[_0x2066('0x51')](saveUpdates(_0x29e587[_0x2066('0x58')],null))[_0x2066('0x51')](respondWithResult(_0x42c92b,null))[_0x2066('0x29')](handleError(_0x42c92b,null));};exports['addLogoLogin']=function(_0x571250,_0x15969f,_0x275723){if(_0x571250[_0x2066('0x5b')]&&_0x571250[_0x2066('0x5b')]['filename']){_0x571250[_0x2066('0x58')][_0x2066('0x5e')]=_0x571250['file']['filename'];}return db[_0x2066('0x3c')][_0x2066('0x56')]({'where':{'id':_0x571250['params']['id']}})[_0x2066('0x51')](handleEntityNotFound(_0x15969f,null))[_0x2066('0x51')](saveUpdates(_0x571250[_0x2066('0x58')],null))[_0x2066('0x51')](respondWithResult(_0x15969f,null))['catch'](handleError(_0x15969f,null));};var utilLicense=require(_0x2066('0x1b'));exports['getLogo']=function(_0xdcf3d4,_0x3a7a81,_0x371a6c){var _0x674d65=_0x2066('0x5f');var _0x18ae18={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x4c6087){if(_0x4c6087){_0x18ae18=_0x4c6087;}return db[_0x2066('0x3c')][_0x2066('0x56')]({'where':{'id':_0xdcf3d4[_0x2066('0x59')]['id']},'attributes':[_0x2066('0x5d'),_0x2066('0x5e'),_0x2066('0x60'),_0x2066('0x61'),'defaultLogo',_0x2066('0x62'),_0x2066('0x63'),_0x2066('0x64')],'raw':!![]});})['then'](handleEntityNotFound(_0x3a7a81,null))[_0x2066('0x51')](function(_0x3500be){if(_0x3500be){var _0x5cfb5c=_0x3500be['logo']&&fs[_0x2066('0x65')](path['join'](config[_0x2066('0x66')],_0x674d65,_[_0x2066('0x67')](_0x3500be['logo'])))?path[_0x2066('0x68')](config['root'],_0x674d65,_[_0x2066('0x67')](_0x3500be[_0x2066('0x5d')])):path[_0x2066('0x68')](config[_0x2066('0x66')],_0x674d65,_[_0x2066('0x67')](_0x2066('0x69')));var _0x253bd9=_0x2066('0x6a')+_[_0x2066('0x6b')]('logo');if(_0x3500be[_0x253bd9]||!_0x18ae18[_0x2066('0x6c')]){_0x5cfb5c=path[_0x2066('0x68')](config['root'],_0x674d65,_[_0x2066('0x67')](_0x2066('0x69')));}if(!fs[_0x2066('0x65')](_0x5cfb5c)){throw new db[(_0x2066('0x6d'))][(_0x2066('0x6e'))](_[_0x2066('0x6b')](_0x2066('0x5d'))+_0x2066('0x6f'));}return _0x3a7a81['download'](_0x5cfb5c);}})['catch'](handleError(_0x3a7a81,null));};var utilLicense=require(_0x2066('0x1b'));exports[_0x2066('0x70')]=function(_0x1ed4d5,_0x394b50,_0x1df45d){var _0x4dd3f2='server/files/images/logos';var _0x11a0e0={'custom':![]};return utilLicense[_0x2066('0x71')]()[_0x2066('0x51')](function(_0xd4b045){if(_0xd4b045){_0x11a0e0=_0xd4b045;}return db['Setting'][_0x2066('0x56')]({'where':{'id':_0x1ed4d5[_0x2066('0x59')]['id']},'attributes':['logo',_0x2066('0x5e'),_0x2066('0x60'),'favicon',_0x2066('0x72'),_0x2066('0x62'),_0x2066('0x63'),_0x2066('0x64')],'raw':!![]});})[_0x2066('0x51')](handleEntityNotFound(_0x394b50,null))[_0x2066('0x51')](function(_0x19442a){if(_0x19442a){var _0x3a7691=_0x19442a['loginLogo']&&fs[_0x2066('0x65')](path[_0x2066('0x68')](config[_0x2066('0x66')],_0x4dd3f2,_['toLower'](_0x19442a[_0x2066('0x5e')])))?path[_0x2066('0x68')](config[_0x2066('0x66')],_0x4dd3f2,_[_0x2066('0x67')](_0x19442a[_0x2066('0x5e')])):path['join'](config[_0x2066('0x66')],_0x4dd3f2,_[_0x2066('0x67')](_0x2066('0x73')));var _0x10df47=_0x2066('0x6a')+_['upperFirst']('loginLogo');if(_0x19442a[_0x10df47]||!_0x11a0e0[_0x2066('0x6c')]){_0x3a7691=path[_0x2066('0x68')](config[_0x2066('0x66')],_0x4dd3f2,_[_0x2066('0x67')](_0x2066('0x73')));}if(!fs[_0x2066('0x65')](_0x3a7691)){throw new db['Sequelize'][(_0x2066('0x6e'))](_['upperFirst'](_0x2066('0x5e'))+_0x2066('0x6f'));}return _0x394b50['download'](_0x3a7691);}})[_0x2066('0x29')](handleError(_0x394b50,null));};exports['gdpr']=function(_0x3e9673,_0x5cb2fb){return db[_0x2066('0x3c')][_0x2066('0x56')]({'where':{'id':_0x3e9673[_0x2066('0x59')]['id']},'attributes':[_0x2066('0x74')]})['then'](respondWithResult(_0x5cb2fb,null))[_0x2066('0x29')](handleError(_0x5cb2fb,null));};exports[_0x2066('0x75')]=function(_0x2e3343,_0x2620a2,_0x587415){if(_0x2e3343['file']&&_0x2e3343[_0x2066('0x5b')]['filename']){_0x2e3343['body'][_0x2066('0x60')]=_0x2e3343['file']['filename'];}return db[_0x2066('0x3c')][_0x2066('0x56')]({'where':{'id':_0x2e3343['params']['id']}})[_0x2066('0x51')](handleEntityNotFound(_0x2620a2,null))[_0x2066('0x51')](saveUpdates(_0x2e3343[_0x2066('0x58')],null))[_0x2066('0x51')](respondWithResult(_0x2620a2,null))[_0x2066('0x29')](handleError(_0x2620a2,null));};var utilLicense=require(_0x2066('0x1b'));exports[_0x2066('0x76')]=function(_0x48afd7,_0x11943e,_0x163c84){var _0x1eca37=_0x2066('0x5f');var _0x219136={'custom':![]};return utilLicense[_0x2066('0x71')]()[_0x2066('0x51')](function(_0x5f414c){if(_0x5f414c){_0x219136=_0x5f414c;}return db[_0x2066('0x3c')][_0x2066('0x56')]({'where':{'id':_0x48afd7['params']['id']},'attributes':['logo',_0x2066('0x5e'),_0x2066('0x60'),_0x2066('0x61'),_0x2066('0x72'),'defaultLoginLogo',_0x2066('0x63'),_0x2066('0x64')],'raw':!![]});})['then'](handleEntityNotFound(_0x11943e,null))[_0x2066('0x51')](function(_0x37251){if(_0x37251){var _0x43f7bd=_0x37251['preferred']&&fs['existsSync'](path[_0x2066('0x68')](config['root'],_0x1eca37,_[_0x2066('0x67')](_0x37251['preferred'])))?path[_0x2066('0x68')](config['root'],_0x1eca37,_['toLower'](_0x37251[_0x2066('0x60')])):path[_0x2066('0x68')](config[_0x2066('0x66')],_0x1eca37,_['toLower']('default_preferred.png'));var _0x5d4af4=_0x2066('0x6a')+_['upperFirst']('preferred');if(_0x37251[_0x5d4af4]||!_0x219136[_0x2066('0x6c')]||!_0x219136[_0x2066('0x60')]){_0x43f7bd=path['join'](config[_0x2066('0x66')],_0x1eca37,_[_0x2066('0x67')](_0x2066('0x77')));}if(!fs['existsSync'](_0x43f7bd)){throw new db[(_0x2066('0x6d'))][(_0x2066('0x6e'))](_[_0x2066('0x6b')](_0x2066('0x60'))+_0x2066('0x6f'));}return _0x11943e[_0x2066('0x78')](_0x43f7bd);}})[_0x2066('0x29')](handleError(_0x11943e,null));};exports['addFavicon']=function(_0xd4dad4,_0x564863,_0x33b70a){if(_0xd4dad4[_0x2066('0x5b')]&&_0xd4dad4['file'][_0x2066('0x5c')]){_0xd4dad4[_0x2066('0x58')]['favicon']=_0xd4dad4[_0x2066('0x5b')]['filename'];}return db[_0x2066('0x3c')]['find']({'where':{'id':_0xd4dad4['params']['id']}})['then'](handleEntityNotFound(_0x564863,null))[_0x2066('0x51')](saveUpdates(_0xd4dad4['body'],null))[_0x2066('0x51')](respondWithResult(_0x564863,null))[_0x2066('0x29')](handleError(_0x564863,null));};var utilLicense=require('../../config/license/util');exports[_0x2066('0x79')]=function(_0x3ac595,_0xb9e449,_0x1b733f){var _0x5c4471='server/files/images/logos';var _0x62c5de={'custom':![]};return utilLicense[_0x2066('0x71')]()['then'](function(_0xb918e3){if(_0xb918e3){_0x62c5de=_0xb918e3;}return db[_0x2066('0x3c')][_0x2066('0x56')]({'where':{'id':_0x3ac595[_0x2066('0x59')]['id']},'attributes':[_0x2066('0x5d'),_0x2066('0x5e'),_0x2066('0x60'),_0x2066('0x61'),'defaultLogo',_0x2066('0x62'),_0x2066('0x63'),_0x2066('0x64')],'raw':!![]});})[_0x2066('0x51')](handleEntityNotFound(_0xb9e449,null))[_0x2066('0x51')](function(_0x4a8b47){if(_0x4a8b47){var _0x412163=_0x4a8b47['favicon']&&fs[_0x2066('0x65')](path[_0x2066('0x68')](config[_0x2066('0x66')],_0x5c4471,_[_0x2066('0x67')](_0x4a8b47[_0x2066('0x61')])))?path['join'](config['root'],_0x5c4471,_[_0x2066('0x67')](_0x4a8b47[_0x2066('0x61')])):path[_0x2066('0x68')](config[_0x2066('0x66')],_0x5c4471,_[_0x2066('0x67')](_0x2066('0x7a')));var _0x30b688=_0x2066('0x6a')+_['upperFirst']('favicon');if(_0x4a8b47[_0x30b688]||!_0x62c5de[_0x2066('0x6c')]){_0x412163=path[_0x2066('0x68')](config[_0x2066('0x66')],_0x5c4471,_[_0x2066('0x67')]('default_favicon.ico'));}if(!fs['existsSync'](_0x412163)){throw new db[(_0x2066('0x6d'))][(_0x2066('0x6e'))](_['upperFirst'](_0x2066('0x61'))+_0x2066('0x6f'));}return _0xb9e449[_0x2066('0x78')](_0x412163);}})[_0x2066('0x29')](handleError(_0xb9e449,null));};exports['getDate']=function(_0x5135fe,_0x3180e8){var _0x311ecf={'offset':moment()[_0x2066('0x7b')]()};_0x311ecf[_0x2066('0x7c')]=moment()['utcOffset'](_0x311ecf[_0x2066('0x2e')])[_0x2066('0x7d')](_0x2066('0x7e'));return _0x3180e8['status'](0xc8)[_0x2066('0x7f')](_0x311ecf);}; \ No newline at end of file +var _0xf4ac=['code','message','result','catch','sendStatus','json','offset','undefined','count','limit','status','set','Content-Range','reject','destroy','stack','name','send','index','Setting','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','update','find','body','addLogo','file','logo','filename','addLogoLogin','loginLogo','getLogo','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','join','root','toLower','default_logo.svg','default','custom','upperFirst','\x20not\x20found','server/files/images/logos','existsSync','default_loginLogo.svg','Sequelize','ValidationError','download','securePassword','addPreferred','getPreferred','getLicense','favicon','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x3a68be,_0x1535a2){var _0x315a36=function(_0x1ee0c2){while(--_0x1ee0c2){_0x3a68be['push'](_0x3a68be['shift']());}};_0x315a36(++_0x1535a2);}(_0xf4ac,0xd0));var _0xcf4a=function(_0x725621,_0x3e3533){_0x725621=_0x725621-0x0;var _0x1194f4=_0xf4ac[_0x725621];return _0x1194f4;};'use strict';var emlformat=require(_0xcf4a('0x0'));var rimraf=require(_0xcf4a('0x1'));var zipdir=require(_0xcf4a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcf4a('0x3'));var Mustache=require('mustache');var util=require(_0xcf4a('0x4'));var path=require(_0xcf4a('0x5'));var sox=require(_0xcf4a('0x6'));var csv=require(_0xcf4a('0x7'));var ejs=require(_0xcf4a('0x8'));var fs=require('fs');var fs_extra=require(_0xcf4a('0x9'));var _=require(_0xcf4a('0xa'));var squel=require(_0xcf4a('0xb'));var crypto=require(_0xcf4a('0xc'));var jsforce=require(_0xcf4a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xcf4a('0x7'));var querystring=require(_0xcf4a('0xe'));var Papa=require(_0xcf4a('0xf'));var Redis=require('ioredis');var authService=require(_0xcf4a('0x10'));var qs=require(_0xcf4a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcf4a('0x12'));var logger=require('../../config/logger')(_0xcf4a('0x13'));var utils=require(_0xcf4a('0x14'));var config=require(_0xcf4a('0x15'));var licenseUtil=require(_0xcf4a('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0xcf4a('0x17'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x221d9c,_0x5d0dc9,_0x1179ab,_0x1c62d1){return new BPromise(function(_0x97653b,_0x2b8d8d){var _0x47bd42=_0x1c62d1||client;return _0x47bd42[_0xcf4a('0x18')](_0x221d9c,_0x1179ab)[_0xcf4a('0x19')](function(_0x1ad40b){logger[_0xcf4a('0x1a')](_0xcf4a('0x1b'),_0x5d0dc9,_0xcf4a('0x1c'));logger[_0xcf4a('0x1d')]('Setting,\x20%s,\x20%s,\x20%s',_0x5d0dc9,_0xcf4a('0x1c'),JSON[_0xcf4a('0x1e')](_0x1ad40b));if(_0x1ad40b[_0xcf4a('0x1f')]){if(_0x1ad40b[_0xcf4a('0x1f')][_0xcf4a('0x20')]===0x1f4){logger[_0xcf4a('0x1f')](_0xcf4a('0x1b'),_0x5d0dc9,_0x1ad40b[_0xcf4a('0x1f')][_0xcf4a('0x21')]);return _0x2b8d8d(_0x1ad40b[_0xcf4a('0x1f')]['message']);}logger['error'](_0xcf4a('0x1b'),_0x5d0dc9,_0x1ad40b[_0xcf4a('0x1f')]['message']);return _0x97653b(_0x1ad40b[_0xcf4a('0x1f')][_0xcf4a('0x21')]);}else{logger['info'](_0xcf4a('0x1b'),_0x5d0dc9,'request\x20sent');_0x97653b(_0x1ad40b[_0xcf4a('0x22')][_0xcf4a('0x21')]);}})[_0xcf4a('0x23')](function(_0xe37416){logger['error'](_0xcf4a('0x1b'),_0x5d0dc9,_0xe37416);_0x2b8d8d(_0xe37416);});});}function respondWithStatusCode(_0x317124,_0x406036){_0x406036=_0x406036||0xcc;return function(_0x26de7c){if(_0x26de7c){return _0x317124[_0xcf4a('0x24')](_0x406036);}return _0x317124['status'](_0x406036)['end']();};}function respondWithResult(_0x483b03,_0x4ab76e){_0x4ab76e=_0x4ab76e||0xc8;return function(_0x2f9155){if(_0x2f9155){return _0x483b03['status'](_0x4ab76e)[_0xcf4a('0x25')](_0x2f9155);}};}function respondWithFilteredResult(_0x23a1d2,_0x4040a7){return function(_0x2cb735){if(_0x2cb735){var _0xbd5889=typeof _0x4040a7[_0xcf4a('0x26')]===_0xcf4a('0x27')&&typeof _0x4040a7['limit']===_0xcf4a('0x27');var _0x4a0a43=_0x2cb735[_0xcf4a('0x28')];var _0x1f411e=_0xbd5889?0x0:_0x4040a7[_0xcf4a('0x26')];var _0x38ecc3=_0xbd5889?_0x2cb735[_0xcf4a('0x28')]:_0x4040a7[_0xcf4a('0x26')]+_0x4040a7[_0xcf4a('0x29')];var _0xed1d55;if(_0x38ecc3>=_0x4a0a43){_0x38ecc3=_0x4a0a43;_0xed1d55=0xc8;}else{_0xed1d55=0xce;}_0x23a1d2[_0xcf4a('0x2a')](_0xed1d55);return _0x23a1d2[_0xcf4a('0x2b')](_0xcf4a('0x2c'),_0x1f411e+'-'+_0x38ecc3+'/'+_0x4a0a43)[_0xcf4a('0x25')](_0x2cb735);}return null;};}function patchUpdates(_0x540a04){return function(_0x293fe){try{jsonpatch['apply'](_0x293fe,_0x540a04,!![]);}catch(_0x484d11){return BPromise[_0xcf4a('0x2d')](_0x484d11);}return _0x293fe['save']();};}function saveUpdates(_0x455fee,_0x4c26f3){return function(_0x463f30){if(_0x463f30){return _0x463f30['update'](_0x455fee)[_0xcf4a('0x19')](function(_0x4526d2){return _0x4526d2;});}return null;};}function removeEntity(_0x2fbb79,_0x1838b4){return function(_0x3eaaca){if(_0x3eaaca){return _0x3eaaca[_0xcf4a('0x2e')]()[_0xcf4a('0x19')](function(){_0x2fbb79[_0xcf4a('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x202b82,_0x49e3ae){return function(_0x581fed){if(!_0x581fed){_0x202b82['sendStatus'](0x194);}return _0x581fed;};}function handleError(_0x56af56,_0x1fe8ee){_0x1fe8ee=_0x1fe8ee||0x1f4;return function(_0x2374ca){logger[_0xcf4a('0x1f')](_0x2374ca[_0xcf4a('0x2f')]);if(_0x2374ca[_0xcf4a('0x30')]){delete _0x2374ca[_0xcf4a('0x30')];}_0x56af56['status'](_0x1fe8ee)[_0xcf4a('0x31')](_0x2374ca);};}exports[_0xcf4a('0x32')]=function(_0x2eb683,_0x5da0b2){var _0x1d7393={},_0x3685dc={},_0x46fc18={'count':0x0,'rows':[]};var _0x1ce471=_['map'](db[_0xcf4a('0x33')]['rawAttributes'],function(_0xaa7568){return{'name':_0xaa7568['fieldName'],'type':_0xaa7568[_0xcf4a('0x34')]['key']};});_0x3685dc[_0xcf4a('0x35')]=_[_0xcf4a('0x36')](_0x1ce471,_0xcf4a('0x30'));_0x3685dc['query']=_[_0xcf4a('0x37')](_0x2eb683[_0xcf4a('0x38')]);_0x3685dc[_0xcf4a('0x39')]=_[_0xcf4a('0x3a')](_0x3685dc['model'],_0x3685dc[_0xcf4a('0x38')]);_0x1d7393[_0xcf4a('0x3b')]=_[_0xcf4a('0x3a')](_0x3685dc[_0xcf4a('0x35')],qs[_0xcf4a('0x3c')](_0x2eb683[_0xcf4a('0x38')][_0xcf4a('0x3c')]));_0x1d7393[_0xcf4a('0x3b')]=_0x1d7393['attributes'][_0xcf4a('0x3d')]?_0x1d7393[_0xcf4a('0x3b')]:_0x3685dc[_0xcf4a('0x35')];if(!_0x2eb683[_0xcf4a('0x38')][_0xcf4a('0x3e')](_0xcf4a('0x3f'))){_0x1d7393[_0xcf4a('0x29')]=qs['limit'](_0x2eb683[_0xcf4a('0x38')][_0xcf4a('0x29')]);_0x1d7393['offset']=qs[_0xcf4a('0x26')](_0x2eb683[_0xcf4a('0x38')][_0xcf4a('0x26')]);}_0x1d7393[_0xcf4a('0x40')]=qs[_0xcf4a('0x41')](_0x2eb683[_0xcf4a('0x38')]['sort']);_0x1d7393[_0xcf4a('0x42')]=qs[_0xcf4a('0x39')](_[_0xcf4a('0x43')](_0x2eb683[_0xcf4a('0x38')],_0x3685dc[_0xcf4a('0x39')]),_0x1ce471);if(_0x2eb683['query'][_0xcf4a('0x44')]){_0x1d7393[_0xcf4a('0x42')]=_[_0xcf4a('0x45')](_0x1d7393['where'],{'$or':_[_0xcf4a('0x36')](_0x1ce471,function(_0x38eeaa){if(_0x38eeaa[_0xcf4a('0x34')]!==_0xcf4a('0x46')){var _0x3fd2f2={};_0x3fd2f2[_0x38eeaa[_0xcf4a('0x30')]]={'$like':'%'+_0x2eb683[_0xcf4a('0x38')][_0xcf4a('0x44')]+'%'};return _0x3fd2f2;}})});}_0x1d7393=_['merge']({},_0x1d7393,_0x2eb683[_0xcf4a('0x47')]);var _0x5c854c={'where':_0x1d7393['where']};return db[_0xcf4a('0x33')][_0xcf4a('0x28')](_0x5c854c)[_0xcf4a('0x19')](function(_0x20f269){_0x46fc18[_0xcf4a('0x28')]=_0x20f269;if(_0x2eb683[_0xcf4a('0x38')][_0xcf4a('0x48')]){_0x1d7393[_0xcf4a('0x49')]=[{'all':!![]}];}return db[_0xcf4a('0x33')][_0xcf4a('0x4a')](_0x1d7393);})[_0xcf4a('0x19')](function(_0xc7b0bc){_0x46fc18[_0xcf4a('0x4b')]=_0xc7b0bc;return _0x46fc18;})[_0xcf4a('0x19')](respondWithFilteredResult(_0x5da0b2,_0x1d7393))[_0xcf4a('0x23')](handleError(_0x5da0b2,null));};exports[_0xcf4a('0x4c')]=function(_0x2d421a,_0x23f739){var _0xc8ffc9={'raw':![],'where':{'id':_0x2d421a[_0xcf4a('0x4d')]['id']}},_0x51e42a={};_0x51e42a[_0xcf4a('0x35')]=_[_0xcf4a('0x37')](db[_0xcf4a('0x33')][_0xcf4a('0x4e')]);_0x51e42a['query']=_['keys'](_0x2d421a['query']);_0x51e42a[_0xcf4a('0x39')]=_[_0xcf4a('0x3a')](_0x51e42a[_0xcf4a('0x35')],_0x51e42a[_0xcf4a('0x38')]);_0xc8ffc9[_0xcf4a('0x3b')]=_['intersection'](_0x51e42a[_0xcf4a('0x35')],qs[_0xcf4a('0x3c')](_0x2d421a[_0xcf4a('0x38')][_0xcf4a('0x3c')]));_0xc8ffc9[_0xcf4a('0x3b')]=_0xc8ffc9['attributes']['length']?_0xc8ffc9[_0xcf4a('0x3b')]:_0x51e42a[_0xcf4a('0x35')];if(_0x2d421a[_0xcf4a('0x38')][_0xcf4a('0x48')]){_0xc8ffc9['include']=[{'all':!![]}];}_0xc8ffc9=_[_0xcf4a('0x45')]({},_0xc8ffc9,_0x2d421a[_0xcf4a('0x47')]);return db[_0xcf4a('0x33')]['find'](_0xc8ffc9)[_0xcf4a('0x19')](handleEntityNotFound(_0x23f739,null))[_0xcf4a('0x19')](respondWithResult(_0x23f739,null))[_0xcf4a('0x23')](handleError(_0x23f739,null));};exports[_0xcf4a('0x4f')]=function(_0x90f3bb,_0x5f48d3){if(_0x90f3bb['body']['id']){delete _0x90f3bb['body']['id'];}return db['Setting'][_0xcf4a('0x50')]({'where':{'id':_0x90f3bb['params']['id']}})['then'](handleEntityNotFound(_0x5f48d3,null))[_0xcf4a('0x19')](saveUpdates(_0x90f3bb[_0xcf4a('0x51')],null))[_0xcf4a('0x19')](respondWithResult(_0x5f48d3,null))[_0xcf4a('0x23')](handleError(_0x5f48d3,null));};exports[_0xcf4a('0x52')]=function(_0x230bc9,_0xcb3185,_0x484fe7){if(_0x230bc9['file']&&_0x230bc9[_0xcf4a('0x53')]['filename']){_0x230bc9[_0xcf4a('0x51')][_0xcf4a('0x54')]=_0x230bc9['file'][_0xcf4a('0x55')];}return db['Setting'][_0xcf4a('0x50')]({'where':{'id':_0x230bc9[_0xcf4a('0x4d')]['id']}})[_0xcf4a('0x19')](handleEntityNotFound(_0xcb3185,null))[_0xcf4a('0x19')](saveUpdates(_0x230bc9[_0xcf4a('0x51')],null))[_0xcf4a('0x19')](respondWithResult(_0xcb3185,null))[_0xcf4a('0x23')](handleError(_0xcb3185,null));};exports[_0xcf4a('0x56')]=function(_0x512195,_0x3b7528,_0x1bdedd){if(_0x512195[_0xcf4a('0x53')]&&_0x512195[_0xcf4a('0x53')]['filename']){_0x512195[_0xcf4a('0x51')][_0xcf4a('0x57')]=_0x512195[_0xcf4a('0x53')][_0xcf4a('0x55')];}return db[_0xcf4a('0x33')][_0xcf4a('0x50')]({'where':{'id':_0x512195[_0xcf4a('0x4d')]['id']}})[_0xcf4a('0x19')](handleEntityNotFound(_0x3b7528,null))['then'](saveUpdates(_0x512195['body'],null))[_0xcf4a('0x19')](respondWithResult(_0x3b7528,null))[_0xcf4a('0x23')](handleError(_0x3b7528,null));};var utilLicense=require(_0xcf4a('0x16'));exports[_0xcf4a('0x58')]=function(_0x3dc609,_0x1dd0a1,_0x3e9f8d){var _0x33c987='server/files/images/logos';var _0x6e0f57={'custom':![]};return utilLicense['getLicense']()[_0xcf4a('0x19')](function(_0xb40ee1){if(_0xb40ee1){_0x6e0f57=_0xb40ee1;}return db[_0xcf4a('0x33')][_0xcf4a('0x50')]({'where':{'id':_0x3dc609['params']['id']},'attributes':[_0xcf4a('0x54'),_0xcf4a('0x57'),_0xcf4a('0x59'),'favicon',_0xcf4a('0x5a'),_0xcf4a('0x5b'),_0xcf4a('0x5c'),_0xcf4a('0x5d')],'raw':!![]});})[_0xcf4a('0x19')](handleEntityNotFound(_0x1dd0a1,null))[_0xcf4a('0x19')](function(_0x120819){if(_0x120819){var _0x421423=_0x120819[_0xcf4a('0x54')]&&fs['existsSync'](path[_0xcf4a('0x5e')](config[_0xcf4a('0x5f')],_0x33c987,_[_0xcf4a('0x60')](_0x120819['logo'])))?path['join'](config['root'],_0x33c987,_[_0xcf4a('0x60')](_0x120819[_0xcf4a('0x54')])):path['join'](config['root'],_0x33c987,_['toLower'](_0xcf4a('0x61')));var _0x2cb6bd=_0xcf4a('0x62')+_['upperFirst'](_0xcf4a('0x54'));if(_0x120819[_0x2cb6bd]||!_0x6e0f57[_0xcf4a('0x63')]){_0x421423=path[_0xcf4a('0x5e')](config[_0xcf4a('0x5f')],_0x33c987,_[_0xcf4a('0x60')](_0xcf4a('0x61')));}if(!fs['existsSync'](_0x421423)){throw new db['Sequelize']['ValidationError'](_[_0xcf4a('0x64')]('logo')+_0xcf4a('0x65'));}return _0x1dd0a1['download'](_0x421423);}})[_0xcf4a('0x23')](handleError(_0x1dd0a1,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0x395ce7,_0x373e6f,_0x395c65){var _0x381056=_0xcf4a('0x66');var _0x50cd51={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x5cdbcf){if(_0x5cdbcf){_0x50cd51=_0x5cdbcf;}return db[_0xcf4a('0x33')][_0xcf4a('0x50')]({'where':{'id':_0x395ce7[_0xcf4a('0x4d')]['id']},'attributes':[_0xcf4a('0x54'),_0xcf4a('0x57'),'preferred','favicon','defaultLogo','defaultLoginLogo',_0xcf4a('0x5c'),_0xcf4a('0x5d')],'raw':!![]});})[_0xcf4a('0x19')](handleEntityNotFound(_0x373e6f,null))[_0xcf4a('0x19')](function(_0x51509b){if(_0x51509b){var _0x24debb=_0x51509b[_0xcf4a('0x57')]&&fs[_0xcf4a('0x67')](path[_0xcf4a('0x5e')](config[_0xcf4a('0x5f')],_0x381056,_[_0xcf4a('0x60')](_0x51509b[_0xcf4a('0x57')])))?path[_0xcf4a('0x5e')](config[_0xcf4a('0x5f')],_0x381056,_[_0xcf4a('0x60')](_0x51509b[_0xcf4a('0x57')])):path['join'](config[_0xcf4a('0x5f')],_0x381056,_['toLower'](_0xcf4a('0x68')));var _0x594fdc=_0xcf4a('0x62')+_['upperFirst'](_0xcf4a('0x57'));if(_0x51509b[_0x594fdc]||!_0x50cd51[_0xcf4a('0x63')]){_0x24debb=path[_0xcf4a('0x5e')](config[_0xcf4a('0x5f')],_0x381056,_[_0xcf4a('0x60')](_0xcf4a('0x68')));}if(!fs['existsSync'](_0x24debb)){throw new db[(_0xcf4a('0x69'))][(_0xcf4a('0x6a'))](_[_0xcf4a('0x64')](_0xcf4a('0x57'))+_0xcf4a('0x65'));}return _0x373e6f[_0xcf4a('0x6b')](_0x24debb);}})[_0xcf4a('0x23')](handleError(_0x373e6f,null));};exports['gdpr']=function(_0x26b693,_0x547e15){return db[_0xcf4a('0x33')][_0xcf4a('0x50')]({'where':{'id':_0x26b693['params']['id']},'attributes':[_0xcf4a('0x6c')]})[_0xcf4a('0x19')](respondWithResult(_0x547e15,null))[_0xcf4a('0x23')](handleError(_0x547e15,null));};exports[_0xcf4a('0x6d')]=function(_0x1fb841,_0x2ebf35,_0x8fa936){if(_0x1fb841['file']&&_0x1fb841[_0xcf4a('0x53')][_0xcf4a('0x55')]){_0x1fb841[_0xcf4a('0x51')]['preferred']=_0x1fb841[_0xcf4a('0x53')]['filename'];}return db[_0xcf4a('0x33')][_0xcf4a('0x50')]({'where':{'id':_0x1fb841[_0xcf4a('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2ebf35,null))[_0xcf4a('0x19')](saveUpdates(_0x1fb841[_0xcf4a('0x51')],null))[_0xcf4a('0x19')](respondWithResult(_0x2ebf35,null))[_0xcf4a('0x23')](handleError(_0x2ebf35,null));};var utilLicense=require('../../config/license/util');exports[_0xcf4a('0x6e')]=function(_0x43b27d,_0x3bb952,_0x24d2d8){var _0xdeb97e='server/files/images/logos';var _0x2336a7={'custom':![]};return utilLicense[_0xcf4a('0x6f')]()[_0xcf4a('0x19')](function(_0x440df3){if(_0x440df3){_0x2336a7=_0x440df3;}return db[_0xcf4a('0x33')][_0xcf4a('0x50')]({'where':{'id':_0x43b27d[_0xcf4a('0x4d')]['id']},'attributes':['logo',_0xcf4a('0x57'),_0xcf4a('0x59'),_0xcf4a('0x70'),_0xcf4a('0x5a'),_0xcf4a('0x5b'),_0xcf4a('0x5c'),_0xcf4a('0x5d')],'raw':!![]});})[_0xcf4a('0x19')](handleEntityNotFound(_0x3bb952,null))[_0xcf4a('0x19')](function(_0xc3e8a2){if(_0xc3e8a2){var _0x5af49a=_0xc3e8a2[_0xcf4a('0x59')]&&fs[_0xcf4a('0x67')](path[_0xcf4a('0x5e')](config[_0xcf4a('0x5f')],_0xdeb97e,_['toLower'](_0xc3e8a2[_0xcf4a('0x59')])))?path['join'](config['root'],_0xdeb97e,_['toLower'](_0xc3e8a2['preferred'])):path[_0xcf4a('0x5e')](config[_0xcf4a('0x5f')],_0xdeb97e,_[_0xcf4a('0x60')](_0xcf4a('0x71')));var _0x2b92ad=_0xcf4a('0x62')+_['upperFirst'](_0xcf4a('0x59'));if(_0xc3e8a2[_0x2b92ad]||!_0x2336a7['custom']||!_0x2336a7['preferred']){_0x5af49a=path['join'](config[_0xcf4a('0x5f')],_0xdeb97e,_[_0xcf4a('0x60')](_0xcf4a('0x71')));}if(!fs[_0xcf4a('0x67')](_0x5af49a)){throw new db[(_0xcf4a('0x69'))][(_0xcf4a('0x6a'))](_['upperFirst'](_0xcf4a('0x59'))+_0xcf4a('0x65'));}return _0x3bb952[_0xcf4a('0x6b')](_0x5af49a);}})[_0xcf4a('0x23')](handleError(_0x3bb952,null));};exports[_0xcf4a('0x72')]=function(_0xfdf4d5,_0x36d69d,_0x5d1007){if(_0xfdf4d5['file']&&_0xfdf4d5[_0xcf4a('0x53')]['filename']){_0xfdf4d5[_0xcf4a('0x51')]['favicon']=_0xfdf4d5[_0xcf4a('0x53')]['filename'];}return db['Setting'][_0xcf4a('0x50')]({'where':{'id':_0xfdf4d5['params']['id']}})[_0xcf4a('0x19')](handleEntityNotFound(_0x36d69d,null))['then'](saveUpdates(_0xfdf4d5[_0xcf4a('0x51')],null))[_0xcf4a('0x19')](respondWithResult(_0x36d69d,null))['catch'](handleError(_0x36d69d,null));};var utilLicense=require(_0xcf4a('0x16'));exports[_0xcf4a('0x73')]=function(_0x3b315e,_0x2a22d9,_0x88daf4){var _0x2d9c4f=_0xcf4a('0x66');var _0xa06f9e={'custom':![]};return utilLicense[_0xcf4a('0x6f')]()[_0xcf4a('0x19')](function(_0x4ce777){if(_0x4ce777){_0xa06f9e=_0x4ce777;}return db['Setting'][_0xcf4a('0x50')]({'where':{'id':_0x3b315e[_0xcf4a('0x4d')]['id']},'attributes':[_0xcf4a('0x54'),_0xcf4a('0x57'),_0xcf4a('0x59'),_0xcf4a('0x70'),_0xcf4a('0x5a'),_0xcf4a('0x5b'),_0xcf4a('0x5c'),_0xcf4a('0x5d')],'raw':!![]});})[_0xcf4a('0x19')](handleEntityNotFound(_0x2a22d9,null))[_0xcf4a('0x19')](function(_0x54b13e){if(_0x54b13e){var _0x587df6=_0x54b13e[_0xcf4a('0x70')]&&fs['existsSync'](path[_0xcf4a('0x5e')](config[_0xcf4a('0x5f')],_0x2d9c4f,_[_0xcf4a('0x60')](_0x54b13e[_0xcf4a('0x70')])))?path['join'](config[_0xcf4a('0x5f')],_0x2d9c4f,_[_0xcf4a('0x60')](_0x54b13e[_0xcf4a('0x70')])):path[_0xcf4a('0x5e')](config[_0xcf4a('0x5f')],_0x2d9c4f,_[_0xcf4a('0x60')](_0xcf4a('0x74')));var _0x5cd849=_0xcf4a('0x62')+_['upperFirst']('favicon');if(_0x54b13e[_0x5cd849]||!_0xa06f9e[_0xcf4a('0x63')]){_0x587df6=path[_0xcf4a('0x5e')](config['root'],_0x2d9c4f,_[_0xcf4a('0x60')](_0xcf4a('0x74')));}if(!fs[_0xcf4a('0x67')](_0x587df6)){throw new db[(_0xcf4a('0x69'))][(_0xcf4a('0x6a'))](_[_0xcf4a('0x64')](_0xcf4a('0x70'))+_0xcf4a('0x65'));}return _0x2a22d9[_0xcf4a('0x6b')](_0x587df6);}})[_0xcf4a('0x23')](handleError(_0x2a22d9,null));};exports[_0xcf4a('0x75')]=function(_0x186c6c,_0x11371d){var _0x283b08={'offset':moment()[_0xcf4a('0x76')]()};_0x283b08['now']=moment()[_0xcf4a('0x76')](_0x283b08[_0xcf4a('0x26')])['format'](_0xcf4a('0x77'));return _0x11371d['status'](0xc8)['send'](_0x283b08);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index c59fed9..f7154e5 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 _0x34e8=['settings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','Setting'];(function(_0x523a7e,_0x2c8886){var _0x5bb526=function(_0x4c816c){while(--_0x4c816c){_0x523a7e['push'](_0x523a7e['shift']());}};_0x5bb526(++_0x2c8886);}(_0x34e8,0x12c));var _0x834e=function(_0x42985a,_0x2eb77d){_0x42985a=_0x42985a-0x0;var _0x145d54=_0x34e8[_0x42985a];return _0x145d54;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_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':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 9f5402f..5766230 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 _0xd1d8=['find','options','include','map','model','attributes','then','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSetting','Setting'];(function(_0x2a3f10,_0x11decc){var _0x2a8b55=function(_0x4138d0){while(--_0x4138d0){_0x2a3f10['push'](_0x2a3f10['shift']());}};_0x2a8b55(++_0x11decc);}(_0xd1d8,0x10f));var _0x8d1d=function(_0xfaf455,_0x13c0a9){_0xfaf455=_0xfaf455-0x0;var _0x5aaa60=_0xd1d8[_0xfaf455];return _0x5aaa60;};'use strict';var _=require('lodash');var util=require(_0x8d1d('0x0'));var moment=require(_0x8d1d('0x1'));var BPromise=require(_0x8d1d('0x2'));var rs=require(_0x8d1d('0x3'));var fs=require('fs');var Redis=require(_0x8d1d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8d1d('0x5'));var logger=require(_0x8d1d('0x6'))(_0x8d1d('0x7'));var config=require(_0x8d1d('0x8'));var jayson=require(_0x8d1d('0x9'));var client=jayson[_0x8d1d('0xa')][_0x8d1d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x908701,_0x4881e3,_0x1ae0f8){return new BPromise(function(_0x2a0924,_0x5c152d){return client[_0x8d1d('0xc')](_0x908701,_0x1ae0f8)['then'](function(_0x547559){logger['info'](_0x8d1d('0xd'),_0x4881e3,_0x8d1d('0xe'));logger[_0x8d1d('0xf')](_0x8d1d('0x10'),_0x4881e3,_0x8d1d('0xe'),JSON[_0x8d1d('0x11')](_0x547559));if(_0x547559[_0x8d1d('0x12')]){if(_0x547559[_0x8d1d('0x12')][_0x8d1d('0x13')]===0x1f4){logger[_0x8d1d('0x12')](_0x8d1d('0xd'),_0x4881e3,_0x547559['error'][_0x8d1d('0x14')]);return _0x5c152d(_0x547559['error'][_0x8d1d('0x14')]);}logger[_0x8d1d('0x12')](_0x8d1d('0xd'),_0x4881e3,_0x547559[_0x8d1d('0x12')][_0x8d1d('0x14')]);return _0x2a0924(_0x547559[_0x8d1d('0x12')][_0x8d1d('0x14')]);}else{logger[_0x8d1d('0x15')]('Setting,\x20%s,\x20%s',_0x4881e3,_0x8d1d('0xe'));_0x2a0924(_0x547559[_0x8d1d('0x16')][_0x8d1d('0x14')]);}})[_0x8d1d('0x17')](function(_0x5745ea){logger[_0x8d1d('0x12')](_0x8d1d('0xd'),_0x4881e3,_0x5745ea);_0x5c152d(_0x5745ea);});});}exports[_0x8d1d('0x18')]=function(_0x587e5f){var _0x58d989=this;return new Promise(function(_0x50c85e,_0x4ffa03){return db[_0x8d1d('0x19')][_0x8d1d('0x1a')]({'raw':_0x587e5f[_0x8d1d('0x1b')]?_0x587e5f['options']['raw']===undefined?!![]:![]:!![],'where':_0x587e5f['options']?_0x587e5f[_0x8d1d('0x1b')]['where']||null:null,'attributes':_0x587e5f['options']?_0x587e5f[_0x8d1d('0x1b')]['attributes']||null:null,'include':_0x587e5f['options']?_0x587e5f[_0x8d1d('0x1b')][_0x8d1d('0x1c')]?_[_0x8d1d('0x1d')](_0x587e5f[_0x8d1d('0x1b')][_0x8d1d('0x1c')],function(_0x34ab1a){return{'model':db[_0x34ab1a[_0x8d1d('0x1e')]],'as':_0x34ab1a['as'],'attributes':_0x34ab1a[_0x8d1d('0x1f')],'include':_0x34ab1a[_0x8d1d('0x1c')]?_['map'](_0x34ab1a[_0x8d1d('0x1c')],function(_0x18aff7){return{'model':db[_0x18aff7[_0x8d1d('0x1e')]],'as':_0x18aff7['as'],'attributes':_0x18aff7[_0x8d1d('0x1f')],'include':_0x18aff7[_0x8d1d('0x1c')]?_[_0x8d1d('0x1d')](_0x18aff7[_0x8d1d('0x1c')],function(_0x409ee4){return{'model':db[_0x409ee4[_0x8d1d('0x1e')]],'as':_0x409ee4['as'],'attributes':_0x409ee4[_0x8d1d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8d1d('0x20')](function(_0x44f1f2){logger[_0x8d1d('0x15')](_0x8d1d('0x18'),_0x587e5f);logger[_0x8d1d('0xf')](_0x8d1d('0x18'),_0x587e5f,JSON['stringify'](_0x44f1f2));_0x50c85e(_0x44f1f2);})['catch'](function(_0x3c27a7){logger[_0x8d1d('0x12')](_0x8d1d('0x18'),_0x3c27a7[_0x8d1d('0x14')],_0x587e5f);_0x4ffa03(_0x58d989[_0x8d1d('0x12')](0x1f4,_0x3c27a7[_0x8d1d('0x14')]));});});}; \ No newline at end of file +var _0x7786=['include','attributes','model','catch','moment','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','ShowSetting','Setting','find','raw','options','where','map'];(function(_0x3e603c,_0x3cae36){var _0x240ad3=function(_0x162793){while(--_0x162793){_0x3e603c['push'](_0x3e603c['shift']());}};_0x240ad3(++_0x3cae36);}(_0x7786,0xb2));var _0x6778=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7786[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6778('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6778('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x6778('0x2'));var logger=require(_0x6778('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6778('0x4'));var client=jayson[_0x6778('0x5')][_0x6778('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1bb266,_0x161ffb,_0x336472){return new BPromise(function(_0x46cdf6,_0x555f64){return client['request'](_0x1bb266,_0x336472)[_0x6778('0x7')](function(_0x5a68c5){logger[_0x6778('0x8')](_0x6778('0x9'),_0x161ffb,'request\x20sent');logger[_0x6778('0xa')](_0x6778('0xb'),_0x161ffb,_0x6778('0xc'),JSON[_0x6778('0xd')](_0x5a68c5));if(_0x5a68c5[_0x6778('0xe')]){if(_0x5a68c5[_0x6778('0xe')][_0x6778('0xf')]===0x1f4){logger[_0x6778('0xe')](_0x6778('0x9'),_0x161ffb,_0x5a68c5['error'][_0x6778('0x10')]);return _0x555f64(_0x5a68c5[_0x6778('0xe')][_0x6778('0x10')]);}logger[_0x6778('0xe')](_0x6778('0x9'),_0x161ffb,_0x5a68c5[_0x6778('0xe')][_0x6778('0x10')]);return _0x46cdf6(_0x5a68c5['error'][_0x6778('0x10')]);}else{logger[_0x6778('0x8')](_0x6778('0x9'),_0x161ffb,_0x6778('0xc'));_0x46cdf6(_0x5a68c5[_0x6778('0x11')][_0x6778('0x10')]);}})['catch'](function(_0x194423){logger['error'](_0x6778('0x9'),_0x161ffb,_0x194423);_0x555f64(_0x194423);});});}exports[_0x6778('0x12')]=function(_0x35f9dd){var _0x380a46=this;return new Promise(function(_0x21d9cd,_0xcb1282){return db[_0x6778('0x13')][_0x6778('0x14')]({'raw':_0x35f9dd['options']?_0x35f9dd['options'][_0x6778('0x15')]===undefined?!![]:![]:!![],'where':_0x35f9dd[_0x6778('0x16')]?_0x35f9dd[_0x6778('0x16')][_0x6778('0x17')]||null:null,'attributes':_0x35f9dd[_0x6778('0x16')]?_0x35f9dd[_0x6778('0x16')]['attributes']||null:null,'include':_0x35f9dd[_0x6778('0x16')]?_0x35f9dd[_0x6778('0x16')]['include']?_[_0x6778('0x18')](_0x35f9dd[_0x6778('0x16')][_0x6778('0x19')],function(_0x53c746){return{'model':db[_0x53c746['model']],'as':_0x53c746['as'],'attributes':_0x53c746[_0x6778('0x1a')],'include':_0x53c746[_0x6778('0x19')]?_[_0x6778('0x18')](_0x53c746[_0x6778('0x19')],function(_0x446535){return{'model':db[_0x446535[_0x6778('0x1b')]],'as':_0x446535['as'],'attributes':_0x446535[_0x6778('0x1a')],'include':_0x446535['include']?_['map'](_0x446535['include'],function(_0x3b83f7){return{'model':db[_0x3b83f7[_0x6778('0x1b')]],'as':_0x3b83f7['as'],'attributes':_0x3b83f7[_0x6778('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6778('0x7')](function(_0x4b23c8){logger[_0x6778('0x8')]('ShowSetting',_0x35f9dd);logger[_0x6778('0xa')](_0x6778('0x12'),_0x35f9dd,JSON[_0x6778('0xd')](_0x4b23c8));_0x21d9cd(_0x4b23c8);})[_0x6778('0x1c')](function(_0x5b0425){logger['error'](_0x6778('0x12'),_0x5b0425[_0x6778('0x10')],_0x35f9dd);_0xcb1282(_0x380a46[_0x6778('0xe')](0x1f4,_0x5b0425['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index d5e6e19..f339cfb 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 _0xf494=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','getAgents','post','/:id/applications','addApplications','/:id/send','send','/:id/users','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf494,0x1c6));var _0x4f49=function(_0x2124ec,_0x31ecd){_0x2124ec=_0x2124ec-0x0;var _0x50a0e1=_0xf494[_0x2124ec];return _0x50a0e1;};'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')]('/describe',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0xa')](_0x4f49('0x10'),auth[_0x4f49('0xb')](),controller['getDispositions']);router[_0x4f49('0xa')](_0x4f49('0x11'),auth['isAuthenticated'](),controller[_0x4f49('0x12')]);router['get']('/:id/applications',auth[_0x4f49('0xb')](),controller[_0x4f49('0x13')]);router['get'](_0x4f49('0x14'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x15')]);router[_0x4f49('0xa')](_0x4f49('0x16'),controller[_0x4f49('0x17')]);router[_0x4f49('0xa')]('/:id/users',auth[_0x4f49('0xb')](),controller[_0x4f49('0x18')]);router[_0x4f49('0x19')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4f49('0x19')](_0x4f49('0x10'),auth[_0x4f49('0xb')](),controller['addDisposition']);router[_0x4f49('0x19')](_0x4f49('0x11'),auth[_0x4f49('0xb')](),controller['addAnswer']);router['post']('/:id/notify',controller['notify']);router[_0x4f49('0x19')](_0x4f49('0x1a'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x1b')]);router['post'](_0x4f49('0x1c'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x1d')]);router[_0x4f49('0x19')](_0x4f49('0x16'),controller['status']);router[_0x4f49('0x19')](_0x4f49('0x1e'),auth[_0x4f49('0xb')](),controller['addAgents']);router[_0x4f49('0x1f')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x20')]);router[_0x4f49('0x21')](_0x4f49('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0x4f49('0x21')](_0x4f49('0x10'),auth['isAuthenticated'](),controller[_0x4f49('0x22')]);router[_0x4f49('0x21')](_0x4f49('0x11'),auth['isAuthenticated'](),controller[_0x4f49('0x23')]);router[_0x4f49('0x21')](_0x4f49('0x1e'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x24')]);module[_0x4f49('0x25')]=router; \ No newline at end of file +var _0x7217=['/:id/send','status','put','update','delete','removeDispositions','removeAnswers','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','create','post','/:id/notify','notify','addApplications'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7217,0x19e));var _0x7721=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x7217[_0x43d11d];return _0x38cd08;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getApplications']);router[_0x7721('0x8')](_0x7721('0x14'),auth['isAuthenticated'](),controller[_0x7721('0x15')]);router[_0x7721('0x8')](_0x7721('0x16'),controller[_0x7721('0x17')]);router['get'](_0x7721('0x18'),auth[_0x7721('0x9')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x1a')](_0x7721('0xf'),auth[_0x7721('0x9')](),controller['addDisposition']);router[_0x7721('0x1a')]('/:id/canned_answers',auth[_0x7721('0x9')](),controller['addAnswer']);router[_0x7721('0x1a')](_0x7721('0x1b'),controller[_0x7721('0x1c')]);router[_0x7721('0x1a')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1d')]);router[_0x7721('0x1a')](_0x7721('0x1e'),auth[_0x7721('0x9')](),controller['send']);router[_0x7721('0x1a')](_0x7721('0x16'),controller[_0x7721('0x1f')]);router[_0x7721('0x1a')]('/:id/users',auth[_0x7721('0x9')](),controller['addAgents']);router[_0x7721('0x20')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0x21')]);router[_0x7721('0x22')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller['destroy']);router[_0x7721('0x22')](_0x7721('0xf'),auth[_0x7721('0x9')](),controller[_0x7721('0x23')]);router[_0x7721('0x22')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x24')]);router[_0x7721('0x22')]('/:id/users',auth[_0x7721('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 4a65b60..81517df 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 _0x8d94=['mandatoryDisposition','randomstring','exports','STRING','name','generate','skebby','connectel','clicksend','plivo','clickatell','bandwidth','infobip','intelepeer','ENUM','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0xb11d70,_0x3dc1be){var _0x1837b5=function(_0x5e997e){while(--_0x5e997e){_0xb11d70['push'](_0xb11d70['shift']());}};_0x1837b5(++_0x3dc1be);}(_0x8d94,0xb5));var _0x48d9=function(_0x10f68e,_0x414019){_0x10f68e=_0x10f68e-0x0;var _0x5a3da8=_0x8d94[_0x10f68e];return _0x5a3da8;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x48d9('0x0'));module[_0x48d9('0x1')]={'name':{'type':Sequelize[_0x48d9('0x2')],'unique':_0x48d9('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x48d9('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x48d9('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x48d9('0x2')],'defaultValue':function(){return rs[_0x48d9('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM']('twilio',_0x48d9('0x5'),_0x48d9('0x6'),_0x48d9('0x7'),_0x48d9('0x8'),_0x48d9('0x9'),_0x48d9('0xa'),'csc',_0x48d9('0xb'),_0x48d9('0xc'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x48d9('0x2')]},'authToken':{'type':Sequelize[_0x48d9('0x2')]},'smsMethod':{'type':Sequelize[_0x48d9('0xd')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x48d9('0x2')]},'apiKey':{'type':Sequelize[_0x48d9('0x2')]},'applicationId':{'type':Sequelize[_0x48d9('0x2')]},'accountId':{'type':Sequelize[_0x48d9('0x2')]},'senderString':{'type':Sequelize[_0x48d9('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x48d9('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x48d9('0xe');}},'notificationSound':{'type':Sequelize[_0x48d9('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x48d9('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x48d9('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x48d9('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x48d9('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x48d9('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x48d9('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x48d9('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x48d9('0x11'),'set':function(_0x565537){if(!_0x565537)this[_0x48d9('0x12')]('mandatoryDispositionPauseId',null);this[_0x48d9('0x12')](_0x48d9('0x13'),_0x565537);}}}; \ No newline at end of file +var _0x756c=['exports','name','STRING','generate','ENUM','twilio','skebby','connectel','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','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize'];(function(_0x4f7f69,_0x51bd8d){var _0x4873fd=function(_0x36d3aa){while(--_0x36d3aa){_0x4f7f69['push'](_0x4f7f69['shift']());}};_0x4873fd(++_0x51bd8d);}(_0x756c,0x133));var _0xc756=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x756c[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xc756('0x0'));var rs=require('randomstring');module[_0xc756('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xc756('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xc756('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xc756('0x3')],'defaultValue':function(){return rs[_0xc756('0x4')]();}},'phone':{'type':Sequelize[_0xc756('0x3')]},'type':{'type':Sequelize[_0xc756('0x5')](_0xc756('0x6'),_0xc756('0x7'),_0xc756('0x8'),'clicksend','plivo',_0xc756('0x9'),_0xc756('0xa'),_0xc756('0xb'),_0xc756('0xc'),_0xc756('0xd'))},'accountSid':{'type':Sequelize[_0xc756('0x3')]},'authId':{'type':Sequelize[_0xc756('0x3')]},'authToken':{'type':Sequelize[_0xc756('0x3')]},'smsMethod':{'type':Sequelize[_0xc756('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xc756('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xc756('0x3')]},'applicationId':{'type':Sequelize[_0xc756('0x3')]},'accountId':{'type':Sequelize[_0xc756('0x3')]},'senderString':{'type':Sequelize[_0xc756('0x3')]},'deliveryReport':{'type':Sequelize[_0xc756('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0xc756('0x3')]},'notificationTemplate':{'type':Sequelize[_0xc756('0xf')],'defaultValue':function(){return _0xc756('0x10');}},'notificationSound':{'type':Sequelize[_0xc756('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc756('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc756('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc756('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc756('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xc756('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xc756('0xe')],'defaultValue':![],'comment':_0xc756('0x12'),'set':function(_0x5152e1){if(!_0x5152e1)this['setDataValue'](_0xc756('0x13'),null);this[_0xc756('0x14')](_0xc756('0x15'),_0x5152e1);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 9beab2f..ab0d45e 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 _0xcd5c=['removeAgents','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','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','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','destroy','SmsAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','fieldName','key','model','query','keys','attributes','intersection','length','hasOwnProperty','where','filters','filter','merge','type','VIRTUAL','options','SmsAccount','includeAll','findAll','rows','rawAttributes','fields','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','params','describe','getDispositions','Disposition','nolimit','order','sort','SmsAccountId','include','removeDispositions','ids','addAnswer','getAnswers','findOne','pick','CannedAnswer','notify','sms','SmsApplication','Applications','account','applications','orderBy','asc','CmContact','ValidationError','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','sender','connectel','clicksend','message_id','MessageUUID','infobip','results','text','csc','originatingAddress','segmentedMessage','clickatell','bandwidth','intelepeer','Sequelize','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','omit','defaults','contact','SmsInteraction','spread','interaction','autoclose','close','unmanaged','*,*,*,*','created','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','text/xml','send','\x0a','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','priority','finally','getApplications','getInteractions','Contact','Owner','internal','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','List','out','Messages','SmsMessage','dataValues','push','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','userSmsAccount:save'];(function(_0x1fe355,_0xe414c){var _0x325d30=function(_0x2d3ace){while(--_0x2d3ace){_0x1fe355['push'](_0x1fe355['shift']());}};_0x325d30(++_0xe414c);}(_0xcd5c,0xed));var _0xccd5=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xcd5c[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0xccd5('0x0'));var rimraf=require(_0xccd5('0x1'));var zipdir=require(_0xccd5('0x2'));var jsonpatch=require(_0xccd5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xccd5('0x4'));var Mustache=require(_0xccd5('0x5'));var util=require('util');var path=require(_0xccd5('0x6'));var sox=require('sox');var csv=require(_0xccd5('0x7'));var ejs=require(_0xccd5('0x8'));var fs=require('fs');var fs_extra=require(_0xccd5('0x9'));var _=require(_0xccd5('0xa'));var squel=require(_0xccd5('0xb'));var crypto=require(_0xccd5('0xc'));var jsforce=require(_0xccd5('0xd'));var deskjs=require(_0xccd5('0xe'));var toCsv=require(_0xccd5('0x7'));var querystring=require(_0xccd5('0xf'));var Papa=require(_0xccd5('0x10'));var Redis=require(_0xccd5('0x11'));var authService=require(_0xccd5('0x12'));var qs=require(_0xccd5('0x13'));var as=require(_0xccd5('0x14'));var hardwareService=require(_0xccd5('0x15'));var logger=require(_0xccd5('0x16'))(_0xccd5('0x17'));var utils=require(_0xccd5('0x18'));var config=require(_0xccd5('0x19'));var licenseUtil=require(_0xccd5('0x1a'));var db=require('../../mysqldb')['db'];config[_0xccd5('0x1b')]=_['defaults'](config[_0xccd5('0x1b')],{'host':_0xccd5('0x1c'),'port':0x18eb});var socket=require(_0xccd5('0x1d'))(new Redis(config[_0xccd5('0x1b')]));require(_0xccd5('0x1e'))[_0xccd5('0x1f')](socket);var jayson=require(_0xccd5('0x20'));var client=jayson[_0xccd5('0x21')]['http']({'port':0x232c});function respondWithRpcPromise(_0x45de88,_0x53ee49,_0x3e3be7,_0x225b98){return new BPromise(function(_0x19241f,_0x3e9fd5){var _0x258267=_0x225b98||client;return _0x258267[_0xccd5('0x22')](_0x45de88,_0x3e3be7)[_0xccd5('0x23')](function(_0x3949bc){logger[_0xccd5('0x24')](_0xccd5('0x25'),_0x53ee49,_0xccd5('0x26'));logger['debug'](_0xccd5('0x27'),_0x53ee49,_0xccd5('0x26'),JSON[_0xccd5('0x28')](_0x3949bc));if(_0x3949bc[_0xccd5('0x29')]){if(_0x3949bc[_0xccd5('0x29')][_0xccd5('0x2a')]===0x1f4){logger[_0xccd5('0x29')](_0xccd5('0x25'),_0x53ee49,_0x3949bc[_0xccd5('0x29')]['message']);return _0x3e9fd5(_0x3949bc['error'][_0xccd5('0x2b')]);}logger[_0xccd5('0x29')]('SmsAccount,\x20%s,\x20%s',_0x53ee49,_0x3949bc['error'][_0xccd5('0x2b')]);return _0x19241f(_0x3949bc[_0xccd5('0x29')]['message']);}else{logger[_0xccd5('0x24')](_0xccd5('0x25'),_0x53ee49,'request\x20sent');_0x19241f(_0x3949bc[_0xccd5('0x2c')][_0xccd5('0x2b')]);}})[_0xccd5('0x2d')](function(_0x3882a2){logger[_0xccd5('0x29')](_0xccd5('0x25'),_0x53ee49,_0x3882a2);_0x3e9fd5(_0x3882a2);});});}function respondWithStatusCode(_0x5bc745,_0x163abd){_0x163abd=_0x163abd||0xcc;return function(_0x2b993f){if(_0x2b993f){return _0x5bc745[_0xccd5('0x2e')](_0x163abd);}return _0x5bc745[_0xccd5('0x2f')](_0x163abd)[_0xccd5('0x30')]();};}function respondWithResult(_0x511574,_0x24ef55){_0x24ef55=_0x24ef55||0xc8;return function(_0x29dc1a){if(_0x29dc1a){return _0x511574[_0xccd5('0x2f')](_0x24ef55)[_0xccd5('0x31')](_0x29dc1a);}};}function respondWithFilteredResult(_0x353f75,_0x5216b3){return function(_0x2bd300){if(_0x2bd300){var _0x8f8f38=typeof _0x5216b3[_0xccd5('0x32')]==='undefined'&&typeof _0x5216b3['limit']===_0xccd5('0x33');var _0x306c0b=_0x2bd300[_0xccd5('0x34')];var _0x126905=_0x8f8f38?0x0:_0x5216b3['offset'];var _0x39a041=_0x8f8f38?_0x2bd300[_0xccd5('0x34')]:_0x5216b3[_0xccd5('0x32')]+_0x5216b3[_0xccd5('0x35')];var _0x2b0540;if(_0x39a041>=_0x306c0b){_0x39a041=_0x306c0b;_0x2b0540=0xc8;}else{_0x2b0540=0xce;}_0x353f75[_0xccd5('0x2f')](_0x2b0540);return _0x353f75['set'](_0xccd5('0x36'),_0x126905+'-'+_0x39a041+'/'+_0x306c0b)[_0xccd5('0x31')](_0x2bd300);}return null;};}function patchUpdates(_0x1bc90d){return function(_0x3c7e62){try{jsonpatch['apply'](_0x3c7e62,_0x1bc90d,!![]);}catch(_0x80a40d){return BPromise[_0xccd5('0x37')](_0x80a40d);}return _0x3c7e62[_0xccd5('0x38')]();};}function saveUpdates(_0x5c7604,_0x1b1ef0){return function(_0x49af91){if(_0x49af91){return _0x49af91[_0xccd5('0x39')](_0x5c7604)[_0xccd5('0x23')](function(_0x17ec5e){return _0x17ec5e;});}return null;};}function removeEntity(_0x234dc0,_0x121526){return function(_0x489e92){if(_0x489e92){return _0x489e92[_0xccd5('0x3a')]()['then'](function(){var _0x2102f1=_0x489e92['get']({'plain':!![]});var _0x58ec11=_0xccd5('0x3b');return db[_0xccd5('0x3c')][_0xccd5('0x3a')]({'where':{'type':_0x58ec11,'resourceId':_0x2102f1['id']}})['then'](function(){return _0x489e92;});})[_0xccd5('0x23')](function(){_0x234dc0['status'](0xcc)[_0xccd5('0x30')]();});}};}function handleEntityNotFound(_0x6cb3d,_0x3fdd7a){return function(_0x2a223f){if(!_0x2a223f){_0x6cb3d[_0xccd5('0x2e')](0x194);}return _0x2a223f;};}function handleError(_0x115ea3,_0x21e6e9){_0x21e6e9=_0x21e6e9||0x1f4;return function(_0x3ccbce){logger[_0xccd5('0x29')](_0x3ccbce[_0xccd5('0x3d')]);if(_0x3ccbce[_0xccd5('0x3e')]){delete _0x3ccbce[_0xccd5('0x3e')];}_0x115ea3['status'](_0x21e6e9)['send'](_0x3ccbce);};}exports[_0xccd5('0x3f')]=function(_0x5dbfcf,_0x18b762){var _0x43d4f0={'include':[{'model':db[_0xccd5('0x40')],'as':_0xccd5('0x41')}]},_0x4b374e={},_0x252fbb={'count':0x0,'rows':[]};var _0xfe6e35=_[_0xccd5('0x42')](db['SmsAccount']['rawAttributes'],function(_0x531402){return{'name':_0x531402[_0xccd5('0x43')],'type':_0x531402['type'][_0xccd5('0x44')]};});_0x4b374e[_0xccd5('0x45')]=_[_0xccd5('0x42')](_0xfe6e35,_0xccd5('0x3e'));_0x4b374e[_0xccd5('0x46')]=_[_0xccd5('0x47')](_0x5dbfcf[_0xccd5('0x46')]);_0x4b374e['filters']=_['intersection'](_0x4b374e['model'],_0x4b374e[_0xccd5('0x46')]);_0x43d4f0[_0xccd5('0x48')]=_[_0xccd5('0x49')](_0x4b374e[_0xccd5('0x45')],qs['fields'](_0x5dbfcf[_0xccd5('0x46')]['fields']));_0x43d4f0[_0xccd5('0x48')]=_0x43d4f0[_0xccd5('0x48')][_0xccd5('0x4a')]?_0x43d4f0[_0xccd5('0x48')]:_0x4b374e[_0xccd5('0x45')];if(!_0x5dbfcf[_0xccd5('0x46')][_0xccd5('0x4b')]('nolimit')){_0x43d4f0[_0xccd5('0x35')]=qs[_0xccd5('0x35')](_0x5dbfcf[_0xccd5('0x46')][_0xccd5('0x35')]);_0x43d4f0[_0xccd5('0x32')]=qs[_0xccd5('0x32')](_0x5dbfcf[_0xccd5('0x46')][_0xccd5('0x32')]);}_0x43d4f0['order']=qs['sort'](_0x5dbfcf['query']['sort']);_0x43d4f0[_0xccd5('0x4c')]=qs[_0xccd5('0x4d')](_['pick'](_0x5dbfcf[_0xccd5('0x46')],_0x4b374e['filters']),_0xfe6e35);if(_0x5dbfcf[_0xccd5('0x46')][_0xccd5('0x4e')]){_0x43d4f0[_0xccd5('0x4c')]=_[_0xccd5('0x4f')](_0x43d4f0[_0xccd5('0x4c')],{'$or':_[_0xccd5('0x42')](_0xfe6e35,function(_0x2fc8d6){if(_0x2fc8d6[_0xccd5('0x50')]!==_0xccd5('0x51')){var _0x37075c={};_0x37075c[_0x2fc8d6[_0xccd5('0x3e')]]={'$like':'%'+_0x5dbfcf[_0xccd5('0x46')]['filter']+'%'};return _0x37075c;}})});}_0x43d4f0=_['merge']({},_0x43d4f0,_0x5dbfcf[_0xccd5('0x52')]);var _0x451a01={'where':_0x43d4f0[_0xccd5('0x4c')]};return db[_0xccd5('0x53')]['count'](_0x451a01)['then'](function(_0x2f3506){_0x252fbb[_0xccd5('0x34')]=_0x2f3506;if(_0x5dbfcf[_0xccd5('0x46')][_0xccd5('0x54')]){_0x43d4f0['include']=[{'all':!![]}];}return db[_0xccd5('0x53')][_0xccd5('0x55')](_0x43d4f0);})['then'](function(_0x249c5d){_0x252fbb[_0xccd5('0x56')]=_0x249c5d;return _0x252fbb;})[_0xccd5('0x23')](respondWithFilteredResult(_0x18b762,_0x43d4f0))[_0xccd5('0x2d')](handleError(_0x18b762,null));};exports['show']=function(_0x418b86,_0x399837){var _0x3bbbd0={'raw':![],'where':{'id':_0x418b86['params']['id']},'include':[{'model':db[_0xccd5('0x40')],'as':_0xccd5('0x41')}]},_0x55864a={};_0x55864a[_0xccd5('0x45')]=_[_0xccd5('0x47')](db[_0xccd5('0x53')][_0xccd5('0x57')]);_0x55864a[_0xccd5('0x46')]=_[_0xccd5('0x47')](_0x418b86[_0xccd5('0x46')]);_0x55864a[_0xccd5('0x4d')]=_[_0xccd5('0x49')](_0x55864a[_0xccd5('0x45')],_0x55864a['query']);_0x3bbbd0['attributes']=_[_0xccd5('0x49')](_0x55864a[_0xccd5('0x45')],qs[_0xccd5('0x58')](_0x418b86[_0xccd5('0x46')]['fields']));_0x3bbbd0['attributes']=_0x3bbbd0[_0xccd5('0x48')][_0xccd5('0x4a')]?_0x3bbbd0[_0xccd5('0x48')]:_0x55864a[_0xccd5('0x45')];if(_0x418b86['query']['includeAll']){_0x3bbbd0['include']=[{'all':!![]}];}_0x3bbbd0=_[_0xccd5('0x4f')]({},_0x3bbbd0,_0x418b86[_0xccd5('0x52')]);return db['SmsAccount'][_0xccd5('0x59')](_0x3bbbd0)[_0xccd5('0x23')](handleEntityNotFound(_0x399837,null))[_0xccd5('0x23')](respondWithResult(_0x399837,null))[_0xccd5('0x2d')](handleError(_0x399837,null));};exports[_0xccd5('0x5a')]=function(_0x7b1445,_0x3ef0e1){return db['SmsAccount'][_0xccd5('0x5a')](_0x7b1445[_0xccd5('0x5b')],{})[_0xccd5('0x23')](function(_0xa54e85){var _0x23de73=_0x7b1445['user'][_0xccd5('0x5c')]({'plain':!![]});if(!_0x23de73)throw new Error(_0xccd5('0x5d'));if(_0x23de73[_0xccd5('0x5e')]===_0xccd5('0x5f')){var _0x40dcb6=_0xa54e85[_0xccd5('0x5c')]({'plain':!![]});var _0x1f96c1=_0xccd5('0x3b');return db['UserProfileSection'][_0xccd5('0x59')]({'where':{'name':_0x1f96c1,'userProfileId':_0x23de73[_0xccd5('0x60')]},'raw':!![]})[_0xccd5('0x23')](function(_0x26569f){if(_0x26569f&&_0x26569f[_0xccd5('0x61')]===0x0){return db[_0xccd5('0x3c')][_0xccd5('0x5a')]({'name':_0x40dcb6[_0xccd5('0x3e')],'resourceId':_0x40dcb6['id'],'type':_0x26569f[_0xccd5('0x3e')],'sectionId':_0x26569f['id']},{})[_0xccd5('0x23')](function(){return _0xa54e85;});}else{return _0xa54e85;}})[_0xccd5('0x2d')](function(_0x2bd625){logger[_0xccd5('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2bd625);throw _0x2bd625;});}return _0xa54e85;})[_0xccd5('0x23')](respondWithResult(_0x3ef0e1,0xc9))[_0xccd5('0x2d')](handleError(_0x3ef0e1,null));};exports[_0xccd5('0x39')]=function(_0x24f100,_0x5be6c6){if(_0x24f100[_0xccd5('0x5b')]['id']){delete _0x24f100['body']['id'];}return db[_0xccd5('0x53')][_0xccd5('0x59')]({'where':{'id':_0x24f100['params']['id']},'include':[{'model':db[_0xccd5('0x40')],'as':'mandatoryDispositionPause'}]})[_0xccd5('0x23')](handleEntityNotFound(_0x5be6c6,null))['then'](saveUpdates(_0x24f100[_0xccd5('0x5b')],null))[_0xccd5('0x23')](respondWithResult(_0x5be6c6,null))[_0xccd5('0x2d')](handleError(_0x5be6c6,null));};exports[_0xccd5('0x3a')]=function(_0x54eea1,_0x566a7d){return db[_0xccd5('0x53')][_0xccd5('0x59')]({'where':{'id':_0x54eea1[_0xccd5('0x62')]['id']}})['then'](handleEntityNotFound(_0x566a7d,null))[_0xccd5('0x23')](removeEntity(_0x566a7d,null))[_0xccd5('0x2d')](handleError(_0x566a7d,null));};exports[_0xccd5('0x63')]=function(_0x3c3c24,_0x205598){return db[_0xccd5('0x53')][_0xccd5('0x63')]()['then'](respondWithResult(_0x205598,null))[_0xccd5('0x2d')](handleError(_0x205598,null));};exports['addDisposition']=function(_0x22a031,_0x332fd7,_0x2aec03){if(_0x22a031[_0xccd5('0x5b')]['id']){delete _0x22a031['body']['id'];}return db[_0xccd5('0x53')][_0xccd5('0x59')]({'where':{'id':_0x22a031['params']['id']}})[_0xccd5('0x23')](handleEntityNotFound(_0x332fd7,null))['then'](function(_0x453d5d){if(_0x453d5d){_0x22a031[_0xccd5('0x5b')]['SmsAccountId']=_0x453d5d['id'];return db['Disposition'][_0xccd5('0x5a')](_0x22a031[_0xccd5('0x5b')]);}})[_0xccd5('0x23')](respondWithResult(_0x332fd7,null))['catch'](handleError(_0x332fd7,null));};exports[_0xccd5('0x64')]=function(_0x403fb1,_0x14e0dd,_0x26e06c){var _0x4f8b25={'raw':![],'where':{}};var _0x2709f9={};var _0x21bb21={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x403fb1[_0xccd5('0x62')]['id']}})[_0xccd5('0x23')](handleEntityNotFound(_0x14e0dd,null))['then'](function(_0x4b1c81){if(_0x4b1c81){_0x2709f9['model']=_[_0xccd5('0x47')](db[_0xccd5('0x65')][_0xccd5('0x57')]);_0x2709f9[_0xccd5('0x46')]=_[_0xccd5('0x47')](_0x403fb1[_0xccd5('0x46')]);_0x2709f9[_0xccd5('0x4d')]=_[_0xccd5('0x49')](_0x2709f9[_0xccd5('0x45')],_0x2709f9['query']);_0x4f8b25[_0xccd5('0x48')]=_['intersection'](_0x2709f9[_0xccd5('0x45')],qs[_0xccd5('0x58')](_0x403fb1[_0xccd5('0x46')][_0xccd5('0x58')]));_0x4f8b25[_0xccd5('0x48')]=_0x4f8b25['attributes'][_0xccd5('0x4a')]?_0x4f8b25[_0xccd5('0x48')]:_0x2709f9[_0xccd5('0x45')];if(!_0x403fb1[_0xccd5('0x46')][_0xccd5('0x4b')](_0xccd5('0x66'))){_0x4f8b25[_0xccd5('0x35')]=qs[_0xccd5('0x35')](_0x403fb1[_0xccd5('0x46')][_0xccd5('0x35')]);_0x4f8b25['offset']=qs[_0xccd5('0x32')](_0x403fb1[_0xccd5('0x46')][_0xccd5('0x32')]);}_0x4f8b25[_0xccd5('0x67')]=qs['sort'](_0x403fb1[_0xccd5('0x46')][_0xccd5('0x68')]);_0x4f8b25[_0xccd5('0x4c')]=qs[_0xccd5('0x4d')](_['pick'](_0x403fb1[_0xccd5('0x46')],_0x2709f9[_0xccd5('0x4d')]));_0x4f8b25[_0xccd5('0x4c')][_0xccd5('0x69')]=_0x4b1c81['id'];if(_0x403fb1['query']['filter']){_0x4f8b25[_0xccd5('0x4c')]=_['merge'](_0x4f8b25[_0xccd5('0x4c')],{'$or':_[_0xccd5('0x42')](_0x4f8b25[_0xccd5('0x48')],function(_0x267993){var _0x2c4d6b={};_0x2c4d6b[_0x267993]={'$like':'%'+_0x403fb1['query'][_0xccd5('0x4e')]+'%'};return _0x2c4d6b;})});}_0x4f8b25=_[_0xccd5('0x4f')]({},_0x4f8b25,_0x403fb1[_0xccd5('0x52')]);return db['Disposition'][_0xccd5('0x34')]({'where':_0x4f8b25[_0xccd5('0x4c')]})[_0xccd5('0x23')](function(_0x5f4b54){_0x21bb21[_0xccd5('0x34')]=_0x5f4b54;if(_0x403fb1[_0xccd5('0x46')]['includeAll']){_0x4f8b25[_0xccd5('0x6a')]=[{'all':!![]}];}return db[_0xccd5('0x65')]['findAll'](_0x4f8b25);})[_0xccd5('0x23')](function(_0x1b937d){_0x21bb21[_0xccd5('0x56')]=_0x1b937d;return _0x21bb21;});}})['then'](respondWithFilteredResult(_0x14e0dd,_0x4f8b25))[_0xccd5('0x2d')](handleError(_0x14e0dd,null));};exports[_0xccd5('0x6b')]=function(_0x190da7,_0x3896ad,_0x152617){return db[_0xccd5('0x53')]['find']({'where':{'id':_0x190da7[_0xccd5('0x62')]['id']}})[_0xccd5('0x23')](handleEntityNotFound(_0x3896ad,null))['then'](function(_0x355806){if(_0x355806){return _0x355806[_0xccd5('0x6b')](_0x190da7[_0xccd5('0x46')][_0xccd5('0x6c')]);}})[_0xccd5('0x23')](respondWithStatusCode(_0x3896ad,null))[_0xccd5('0x2d')](handleError(_0x3896ad,null));};exports[_0xccd5('0x6d')]=function(_0x51cea0,_0x5b8eab,_0x2fbe6c){if(_0x51cea0[_0xccd5('0x5b')]['id']){delete _0x51cea0[_0xccd5('0x5b')]['id'];}return db[_0xccd5('0x53')][_0xccd5('0x59')]({'where':{'id':_0x51cea0['params']['id']}})[_0xccd5('0x23')](handleEntityNotFound(_0x5b8eab,null))[_0xccd5('0x23')](function(_0x309c45){if(_0x309c45){_0x51cea0['body'][_0xccd5('0x69')]=_0x309c45['id'];return db['CannedAnswer'][_0xccd5('0x5a')](_0x51cea0[_0xccd5('0x5b')]);}})['then'](respondWithResult(_0x5b8eab,null))[_0xccd5('0x2d')](handleError(_0x5b8eab,null));};exports[_0xccd5('0x6e')]=function(_0x19ea46,_0x4aa266,_0x291cf6){var _0x3d8306={'raw':![],'where':{}};var _0x5705ca={};var _0x718dba={'count':0x0,'rows':[]};return db['SmsAccount'][_0xccd5('0x6f')]({'where':{'id':_0x19ea46[_0xccd5('0x62')]['id']}})[_0xccd5('0x23')](handleEntityNotFound(_0x4aa266,null))['then'](function(_0x30980b){if(_0x30980b){_0x5705ca['model']=_[_0xccd5('0x47')](db['CannedAnswer'][_0xccd5('0x57')]);_0x5705ca[_0xccd5('0x46')]=_['keys'](_0x19ea46['query']);_0x5705ca[_0xccd5('0x4d')]=_[_0xccd5('0x49')](_0x5705ca['model'],_0x5705ca['query']);_0x3d8306[_0xccd5('0x48')]=_['intersection'](_0x5705ca[_0xccd5('0x45')],qs[_0xccd5('0x58')](_0x19ea46['query'][_0xccd5('0x58')]));_0x3d8306[_0xccd5('0x48')]=_0x3d8306[_0xccd5('0x48')][_0xccd5('0x4a')]?_0x3d8306[_0xccd5('0x48')]:_0x5705ca[_0xccd5('0x45')];if(!_0x19ea46[_0xccd5('0x46')][_0xccd5('0x4b')](_0xccd5('0x66'))){_0x3d8306[_0xccd5('0x35')]=qs['limit'](_0x19ea46['query'][_0xccd5('0x35')]);_0x3d8306[_0xccd5('0x32')]=qs['offset'](_0x19ea46[_0xccd5('0x46')][_0xccd5('0x32')]);}_0x3d8306[_0xccd5('0x67')]=qs['sort'](_0x19ea46[_0xccd5('0x46')][_0xccd5('0x68')]);_0x3d8306[_0xccd5('0x4c')]=qs['filters'](_[_0xccd5('0x70')](_0x19ea46[_0xccd5('0x46')],_0x5705ca[_0xccd5('0x4d')]));_0x3d8306[_0xccd5('0x4c')][_0xccd5('0x69')]=_0x30980b['id'];if(_0x19ea46['query']['filter']){_0x3d8306['where']=_[_0xccd5('0x4f')](_0x3d8306[_0xccd5('0x4c')],{'$or':_[_0xccd5('0x42')](_0x3d8306[_0xccd5('0x48')],function(_0x16ac9f){var _0x4178ee={};_0x4178ee[_0x16ac9f]={'$like':'%'+_0x19ea46[_0xccd5('0x46')][_0xccd5('0x4e')]+'%'};return _0x4178ee;})});}_0x3d8306=_[_0xccd5('0x4f')]({},_0x3d8306,_0x19ea46[_0xccd5('0x52')]);return db['CannedAnswer'][_0xccd5('0x34')]({'where':_0x3d8306[_0xccd5('0x4c')]})['then'](function(_0x2e6362){_0x718dba[_0xccd5('0x34')]=_0x2e6362;if(_0x19ea46[_0xccd5('0x46')]['includeAll']){_0x3d8306['include']=[{'all':!![]}];}return db[_0xccd5('0x71')][_0xccd5('0x55')](_0x3d8306);})[_0xccd5('0x23')](function(_0x193925){_0x718dba[_0xccd5('0x56')]=_0x193925;return _0x718dba;});}})[_0xccd5('0x23')](respondWithFilteredResult(_0x4aa266,_0x3d8306))[_0xccd5('0x2d')](handleError(_0x4aa266,null));};exports['removeAnswers']=function(_0x3fcb39,_0x1d175f,_0x2cb56b){return db[_0xccd5('0x53')][_0xccd5('0x59')]({'where':{'id':_0x3fcb39[_0xccd5('0x62')]['id']}})['then'](handleEntityNotFound(_0x1d175f,null))['then'](function(_0xe657dd){if(_0xe657dd){return _0xe657dd['removeAnswers'](_0x3fcb39[_0xccd5('0x46')][_0xccd5('0x6c')]);}})[_0xccd5('0x23')](respondWithStatusCode(_0x1d175f,null))[_0xccd5('0x2d')](handleError(_0x1d175f,null));};exports[_0xccd5('0x72')]=function(_0x56feff,_0x2be2e3,_0xdd5cca){var _0x47177f={'channel':_0xccd5('0x73')};var _0x518a0c=[];var _0xed4ef=[];var _0x386856={};return db[_0xccd5('0x53')]['find']({'where':{'id':_0x56feff['params']['id']},'include':[{'model':db[_0xccd5('0x74')],'as':_0xccd5('0x75')}]})[_0xccd5('0x23')](handleEntityNotFound(_0x2be2e3,null))[_0xccd5('0x23')](function(_0x2eff9d){_0x47177f[_0xccd5('0x76')]=_0x2eff9d;_0x47177f[_0xccd5('0x77')]=_[_0xccd5('0x78')](_0x2eff9d['Applications'],['priority'],[_0xccd5('0x79')]);if(_0x47177f[_0xccd5('0x76')][_0xccd5('0x75')]){delete _0x47177f[_0xccd5('0x76')][_0xccd5('0x75')];}return db[_0xccd5('0x7a')][_0xccd5('0x63')]();})[_0xccd5('0x23')](function(_0x436e76){if(!_0x436e76){throw new db['Sequelize'][(_0xccd5('0x7b'))]('no\x20available\x20attributes');}_0x518a0c=_[_0xccd5('0x7c')](_[_0xccd5('0x47')](_0x436e76),[_0xccd5('0x7d'),_0xccd5('0x7e')]);_0xed4ef=_['difference'](_[_0xccd5('0x47')](_0x436e76),[_0xccd5('0x7d'),_0xccd5('0x7e'),_0xccd5('0x7f'),'ListId']);_0x47177f['body']={'mapKey':_0xccd5('0x80')};if(_0x47177f[_0xccd5('0x76')]['type']){switch(_0x47177f[_0xccd5('0x76')]['type']){case _0xccd5('0x81'):_0x47177f[_0xccd5('0x5b')][_0xccd5('0x82')]=_0x56feff[_0xccd5('0x5b')][_0xccd5('0x83')];_0x47177f[_0xccd5('0x5b')][_0xccd5('0x5b')]=_0x56feff['body'][_0xccd5('0x84')];_0x47177f[_0xccd5('0x5b')][_0xccd5('0x85')]=_0x56feff[_0xccd5('0x5b')][_0xccd5('0x86')];break;case _0xccd5('0x87'):_0x47177f[_0xccd5('0x5b')][_0xccd5('0x82')]='+'+_0x56feff['body'][_0xccd5('0x88')];_0x47177f[_0xccd5('0x5b')][_0xccd5('0x5b')]=_0x56feff[_0xccd5('0x5b')]['text'];break;case _0xccd5('0x89'):_0x47177f[_0xccd5('0x5b')][_0xccd5('0x82')]=_0x56feff['body'][_0xccd5('0x82')];_0x47177f[_0xccd5('0x5b')][_0xccd5('0x5b')]=_0x56feff[_0xccd5('0x5b')]['message'];break;case _0xccd5('0x8a'):_0x47177f[_0xccd5('0x5b')]['from']=_0x56feff['body'][_0xccd5('0x82')];_0x47177f[_0xccd5('0x5b')][_0xccd5('0x5b')]=_0x56feff[_0xccd5('0x5b')][_0xccd5('0x5b')];_0x47177f[_0xccd5('0x5b')][_0xccd5('0x85')]=_0x56feff[_0xccd5('0x5b')][_0xccd5('0x8b')];break;case'plivo':_0x47177f[_0xccd5('0x5b')]['from']=_0x56feff[_0xccd5('0x5b')][_0xccd5('0x83')];_0x47177f['body'][_0xccd5('0x5b')]=_0x56feff[_0xccd5('0x5b')]['Text'];_0x47177f[_0xccd5('0x5b')][_0xccd5('0x85')]=_0x56feff['body'][_0xccd5('0x8c')];break;case _0xccd5('0x8d'):_0x47177f[_0xccd5('0x5b')]['from']='+'+_0x56feff['body'][_0xccd5('0x8e')][0x0]['from'];_0x47177f[_0xccd5('0x5b')][_0xccd5('0x5b')]=_0x56feff[_0xccd5('0x5b')][_0xccd5('0x8e')][0x0][_0xccd5('0x8f')];_0x47177f[_0xccd5('0x5b')][_0xccd5('0x85')]=_0x56feff[_0xccd5('0x5b')][_0xccd5('0x8e')][0x0][_0xccd5('0x85')];break;case _0xccd5('0x90'):_0x47177f[_0xccd5('0x5b')][_0xccd5('0x82')]=_0x56feff[_0xccd5('0x5b')][_0xccd5('0x91')];_0x47177f[_0xccd5('0x5b')][_0xccd5('0x5b')]=_0x56feff[_0xccd5('0x5b')][_0xccd5('0x92')][_0xccd5('0x2b')];break;case _0xccd5('0x93'):_0x47177f[_0xccd5('0x5b')][_0xccd5('0x82')]=_0x56feff[_0xccd5('0x5b')]['fromNumber'];_0x47177f[_0xccd5('0x5b')][_0xccd5('0x5b')]=_0x56feff['body'][_0xccd5('0x8f')];_0x47177f[_0xccd5('0x5b')][_0xccd5('0x85')]=_0x56feff[_0xccd5('0x5b')]['replyMessageId'];break;case _0xccd5('0x94'):_0x47177f[_0xccd5('0x5b')]['messageId']=_0x56feff[_0xccd5('0x5b')][0x0][_0xccd5('0x2b')]['id'];_0x47177f[_0xccd5('0x5b')][_0xccd5('0x82')]=_0x56feff['body'][0x0][_0xccd5('0x2b')][_0xccd5('0x82')];_0x47177f['body'][_0xccd5('0x5b')]=_0x56feff[_0xccd5('0x5b')][0x0][_0xccd5('0x2b')][_0xccd5('0x8f')];break;case _0xccd5('0x95'):_0x47177f[_0xccd5('0x5b')][_0xccd5('0x82')]=_0x56feff[_0xccd5('0x5b')][_0xccd5('0x82')];_0x47177f[_0xccd5('0x5b')][_0xccd5('0x5b')]=_0x56feff['body']['message'];_0x47177f['body'][_0xccd5('0x85')]=_0x56feff[_0xccd5('0x5b')]['refid'];break;}}if(_0x47177f[_0xccd5('0x5b')]['id']){delete _0x47177f[_0xccd5('0x5b')]['id'];}if(_['isNil'](_0x47177f[_0xccd5('0x5b')][_0xccd5('0x82')])){throw new db[(_0xccd5('0x96'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0xccd5('0x97')](_0x47177f['body'][_0xccd5('0x5b')])||_0x47177f[_0xccd5('0x5b')][_0xccd5('0x5b')]===''){throw new db['Sequelize'][(_0xccd5('0x7b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x47177f[_0xccd5('0x5b')][_0xccd5('0x98')])){throw new db[(_0xccd5('0x96'))][(_0xccd5('0x7b'))](_0xccd5('0x99')+_0xed4ef);}if(!_['includes'](_0xed4ef,_0x47177f[_0xccd5('0x5b')]['mapKey'])){throw new db[(_0xccd5('0x96'))][(_0xccd5('0x7b'))](_0xccd5('0x9a')+_0xed4ef);}_0x386856[_0x47177f['body'][_0xccd5('0x98')]]=_0x47177f['body'][_0xccd5('0x82')];return db[_0xccd5('0x9b')][_0xccd5('0x59')]({'where':{'id':_0x47177f[_0xccd5('0x76')][_0xccd5('0x9c')]},'include':[{'model':db['CmContact'],'as':_0xccd5('0x9d'),'where':_0x386856,'limit':0x1,'order':[['updatedAt',_0xccd5('0x9e')]]}]});})[_0xccd5('0x23')](handleEntityNotFound(_0x2be2e3,null))[_0xccd5('0x23')](function(_0x51dd10){if(_0x51dd10){_0x47177f[_0xccd5('0x9f')]=_[_0xccd5('0xa0')](_0x51dd10,['Contacts']);if(_0x51dd10[_0xccd5('0x9d')]['length']){return _0x51dd10[_0xccd5('0x9d')][0x0];}var _0x59fd0e=_[_0xccd5('0xa1')](_0x47177f[_0xccd5('0x5b')],{'firstName':_0x47177f['body'][_0xccd5('0x82')],'ListId':_0x51dd10['id']});_0x59fd0e[_0x47177f[_0xccd5('0x5b')][_0xccd5('0x98')]]=_0x47177f[_0xccd5('0x5b')][_0xccd5('0x82')];return db[_0xccd5('0x7a')]['create'](_0x59fd0e,{'fields':_0x518a0c,'raw':!![]});}})['then'](handleEntityNotFound(_0x2be2e3,null))[_0xccd5('0x23')](function(_0x5678be){if(_0x5678be){_0x47177f[_0xccd5('0xa2')]=_0x5678be;var _0x2b4ac2={'ContactId':_0x5678be['id'],'phone':_0x47177f[_0xccd5('0x5b')]['from'],'SmsAccountId':_0x56feff[_0xccd5('0x62')]['id']};var _0x36b451={'ContactId':_0x5678be['id'],'SmsAccountId':_0x56feff[_0xccd5('0x62')]['id'],'closed':![]};return db['SmsInteraction']['find']({'where':_0x36b451})[_0xccd5('0x23')](function(_0x29063b){if(_0x29063b){return[_0x29063b,![]];}return db[_0xccd5('0xa3')][_0xccd5('0x5a')](_0x2b4ac2)[_0xccd5('0x23')](function(_0x5e57a0){return[_0x5e57a0,!![]];});});}})[_0xccd5('0xa4')](function(_0x91ec03,_0x1c3297){_0x47177f[_0xccd5('0xa5')]=_0x91ec03[_0xccd5('0x5c')]({'plain':!![]});_0x47177f[_0xccd5('0xa5')]['created']=![];if(_0x1c3297){if(_0x47177f[_0xccd5('0x76')][_0xccd5('0xa6')]){_0x47177f['applications']['push']({'id':0x0,'priority':_0x47177f[_0xccd5('0x77')][_0xccd5('0x4a')]+0x1,'app':_0xccd5('0xa7'),'appdata':_0xccd5('0xa8'),'interval':_0xccd5('0xa9')});}_0x47177f[_0xccd5('0xa5')][_0xccd5('0xaa')]=!![];}return db['SmsMessage'][_0xccd5('0x5a')]({'phone':_0x47177f[_0xccd5('0x5b')][_0xccd5('0x82')],'messageId':_0x47177f['body'][_0xccd5('0x85')],'body':_0x47177f[_0xccd5('0x5b')][_0xccd5('0x5b')],'SmsAccountId':_0x56feff[_0xccd5('0x62')]['id'],'SmsInteractionId':_0x91ec03['id'],'direction':'in','ContactId':_0x91ec03['ContactId'],'AttachmentId':_0x47177f[_0xccd5('0x5b')][_0xccd5('0xab')]});})[_0xccd5('0x23')](function(_0x4e7dd5){_0x47177f[_0xccd5('0x2b')]=_0x4e7dd5;if(_0x47177f[_0xccd5('0xa5')]['UserId']){return db[_0xccd5('0xac')][_0xccd5('0x59')]({'attributes':['id','name'],'where':{'id':_0x47177f[_0xccd5('0xa5')][_0xccd5('0xad')]}})['then'](function(_0x2d75e0){if(_0x2d75e0){_0x47177f[_0xccd5('0x77')][_0xccd5('0xae')]({'id':0x0,'priority':0x0,'app':_0xccd5('0xaf'),'appdata':_0x2d75e0[_0xccd5('0x3e')]+','+(_0x47177f[_0xccd5('0x76')][_0xccd5('0xb0')]||0xa),'interval':_0xccd5('0xa9')});}return respondWithRpcPromise(_0xccd5('0xb1'),_0xccd5('0xb2'),_0x47177f);});}return respondWithRpcPromise(_0xccd5('0xb1'),_0xccd5('0xb2'),_0x47177f);})[_0xccd5('0x23')](function(_0x1164c0){if(_0x1164c0){var _0x549751=0xc8;var _0x47a844=_0xccd5('0xb3');logger[_0xccd5('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x47a844,_0x549751,'entity\x20found');logger[_0xccd5('0xb4')](_0xccd5('0xb5'),_0x47a844,_0x549751,'entity\x20found',JSON[_0xccd5('0x28')](_0x1164c0));if(_0x47177f['account']['type']==='twilio'){return _0x2be2e3[_0xccd5('0x2f')](_0x549751)[_0xccd5('0xb6')]('Content-Type',_0xccd5('0xb7'))[_0xccd5('0xb8')](_0xccd5('0xb9'));}else{return _0x2be2e3[_0xccd5('0x2f')](_0x549751)['json'](_0x1164c0);}}})[_0xccd5('0x2d')](handleError(_0x2be2e3,null));};exports[_0xccd5('0xba')]=function(_0x1711ca,_0x37ad14){var _0x119a19=_0x1711ca[_0xccd5('0x62')]['id'];var _0x124017=_0x1711ca[_0xccd5('0x5b')];var _0x482996=0xc8;var _0x48c507=null;return db[_0xccd5('0xbb')][_0xccd5('0xbc')]({'isolationLevel':db['sequelize']['Transaction'][_0xccd5('0xbd')][_0xccd5('0xbe')]},function(_0x13e3de){return db['SmsAccount'][_0xccd5('0x6f')]({'where':{'id':_0x119a19},'transaction':_0x13e3de})[_0xccd5('0x23')](function(_0x146a5f){if(_0x146a5f){return db[_0xccd5('0x74')][_0xccd5('0x3a')]({'where':{'SmsAccountId':_0x119a19},'transaction':_0x13e3de})[_0xccd5('0x23')](function(){var _0x239c2c=_['map'](_0x124017,function(_0x553dbb){_0x553dbb['SmsAccountId']=_0x119a19;return _0x553dbb;});return db[_0xccd5('0x74')]['bulkCreate'](_0x239c2c,{'transaction':_0x13e3de});});}else{_0x482996=0x194;_0x48c507=[];}});})[_0xccd5('0x23')](function(){if(_0x482996!==0x194){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x119a19},'order':_0xccd5('0xbf')})[_0xccd5('0x23')](function(_0xdb5661){_0x48c507=_0xdb5661;});}})['catch'](function(_0x4c0521){_0x482996=0x1f4;logger[_0xccd5('0x29')](_0x4c0521[_0xccd5('0x3d')]);if(_0x4c0521[_0xccd5('0x3e')]){delete _0x4c0521[_0xccd5('0x3e')];}_0x48c507=_0x4c0521;})[_0xccd5('0xc0')](function(){if(_0x48c507===null){_0x37ad14[_0xccd5('0x2e')](_0x482996);}else{if(_0x482996===0x1f4){_0x37ad14[_0xccd5('0x2f')](_0x482996)['send'](_0x48c507);}else{_0x37ad14['status'](_0x482996)[_0xccd5('0x31')](_0x48c507);}}});};exports[_0xccd5('0xc1')]=function(_0x3be933,_0x2435c7,_0x351749){var _0x3e43c5={};var _0x5f53de={};var _0x1e7e8a;var _0x15dd8c;return db[_0xccd5('0x53')][_0xccd5('0x6f')]({'where':{'id':_0x3be933[_0xccd5('0x62')]['id']}})[_0xccd5('0x23')](handleEntityNotFound(_0x2435c7,null))['then'](function(_0x344cee){if(_0x344cee){_0x1e7e8a=_0x344cee;_0x5f53de['model']=_['keys'](db[_0xccd5('0x74')][_0xccd5('0x57')]);_0x5f53de[_0xccd5('0x46')]=_[_0xccd5('0x47')](_0x3be933[_0xccd5('0x46')]);_0x5f53de[_0xccd5('0x4d')]=_[_0xccd5('0x49')](_0x5f53de['model'],_0x5f53de[_0xccd5('0x46')]);_0x3e43c5[_0xccd5('0x48')]=_[_0xccd5('0x49')](_0x5f53de[_0xccd5('0x45')],qs[_0xccd5('0x58')](_0x3be933[_0xccd5('0x46')]['fields']));_0x3e43c5['attributes']=_0x3e43c5[_0xccd5('0x48')][_0xccd5('0x4a')]?_0x3e43c5[_0xccd5('0x48')]:_0x5f53de[_0xccd5('0x45')];_0x3e43c5[_0xccd5('0x67')]=qs[_0xccd5('0x68')](_0x3be933[_0xccd5('0x46')]['sort']);_0x3e43c5[_0xccd5('0x4c')]=qs['filters'](_[_0xccd5('0x70')](_0x3be933[_0xccd5('0x46')],_0x5f53de[_0xccd5('0x4d')]));if(_0x3be933[_0xccd5('0x46')][_0xccd5('0x4e')]){_0x3e43c5[_0xccd5('0x4c')]=_[_0xccd5('0x4f')](_0x3e43c5[_0xccd5('0x4c')],{'$or':_['map'](_0x3e43c5['attributes'],function(_0xdcc0fa){var _0x11d9fb={};_0x11d9fb[_0xdcc0fa]={'$like':'%'+_0x3be933[_0xccd5('0x46')]['filter']+'%'};return _0x11d9fb;})});}_0x3e43c5=_[_0xccd5('0x4f')]({},_0x3e43c5,_0x3be933[_0xccd5('0x52')]);return _0x1e7e8a[_0xccd5('0xc1')](_0x3e43c5);}})['then'](function(_0x3e6dec){if(_0x3e6dec){_0x15dd8c=_0x3e6dec[_0xccd5('0x4a')];if(!_0x3be933[_0xccd5('0x46')][_0xccd5('0x4b')](_0xccd5('0x66'))){_0x3e43c5[_0xccd5('0x35')]=qs[_0xccd5('0x35')](_0x3be933[_0xccd5('0x46')][_0xccd5('0x35')]);_0x3e43c5[_0xccd5('0x32')]=qs[_0xccd5('0x32')](_0x3be933['query'][_0xccd5('0x32')]);}return _0x1e7e8a[_0xccd5('0xc1')](_0x3e43c5);}})[_0xccd5('0x23')](function(_0x199c39){if(_0x199c39){return _0x199c39?{'count':_0x15dd8c,'rows':_0x199c39}:null;}})['then'](respondWithResult(_0x2435c7,null))[_0xccd5('0x2d')](handleError(_0x2435c7,null));};exports[_0xccd5('0xc2')]=function(_0x173470,_0x4ce5b0,_0x4e4cbc){var _0x25c4cd={'raw':![],'where':{}};var _0x22694c={};var _0xe30d76={'count':0x0,'rows':[]};return db[_0xccd5('0x53')][_0xccd5('0x6f')]({'where':{'id':_0x173470[_0xccd5('0x62')]['id']}})[_0xccd5('0x23')](handleEntityNotFound(_0x4ce5b0,null))[_0xccd5('0x23')](function(_0x3a3d54){if(_0x3a3d54){_0x22694c['model']=_[_0xccd5('0x47')](db[_0xccd5('0xa3')][_0xccd5('0x57')]);_0x22694c[_0xccd5('0x46')]=_['keys'](_0x173470[_0xccd5('0x46')]);_0x22694c[_0xccd5('0x4d')]=_[_0xccd5('0x49')](_0x22694c[_0xccd5('0x45')],_0x22694c['query']);_0x25c4cd[_0xccd5('0x48')]=_[_0xccd5('0x49')](_0x22694c['model'],qs[_0xccd5('0x58')](_0x173470[_0xccd5('0x46')][_0xccd5('0x58')]));_0x25c4cd['attributes']=_0x25c4cd[_0xccd5('0x48')][_0xccd5('0x4a')]?_0x25c4cd['attributes']:_0x22694c[_0xccd5('0x45')];if(!_0x173470['query'][_0xccd5('0x4b')](_0xccd5('0x66'))){_0x25c4cd['limit']=qs[_0xccd5('0x35')](_0x173470[_0xccd5('0x46')]['limit']);_0x25c4cd[_0xccd5('0x32')]=qs['offset'](_0x173470[_0xccd5('0x46')][_0xccd5('0x32')]);}_0x25c4cd['order']=qs['sort'](_0x173470['query'][_0xccd5('0x68')]);_0x25c4cd[_0xccd5('0x4c')]=qs['filters'](_[_0xccd5('0x70')](_0x173470[_0xccd5('0x46')],_0x22694c['filters']));_0x25c4cd[_0xccd5('0x4c')][_0xccd5('0x69')]=_0x3a3d54['id'];if(_0x173470['query'][_0xccd5('0x4e')]){_0x25c4cd[_0xccd5('0x4c')]=_[_0xccd5('0x4f')](_0x25c4cd[_0xccd5('0x4c')],{'$or':_[_0xccd5('0x42')](_0x25c4cd[_0xccd5('0x48')],function(_0x21b674){var _0x4cf131={};_0x4cf131[_0x21b674]={'$like':'%'+_0x173470[_0xccd5('0x46')][_0xccd5('0x4e')]+'%'};return _0x4cf131;})});}_0x25c4cd=_[_0xccd5('0x4f')]({},_0x25c4cd,_0x173470['options']);return db[_0xccd5('0xa3')]['count']({'where':_0x25c4cd['where']})['then'](function(_0x3ed522){_0xe30d76[_0xccd5('0x34')]=_0x3ed522;if(_0x173470[_0xccd5('0x46')]['includeAll']){_0x25c4cd[_0xccd5('0x6a')]=[{'model':db[_0xccd5('0x7a')],'as':_0xccd5('0xc3'),'required':![]},{'model':db['User'],'as':_0xccd5('0xc4'),'attributes':[_0xccd5('0x3e'),'fullname',_0xccd5('0xc5')],'required':![]},{'model':db[_0xccd5('0xc6')],'as':_0xccd5('0xc7'),'attributes':['id',_0xccd5('0x3e'),_0xccd5('0xc8')],'where':_0x173470['query'][_0xccd5('0xc9')]?{'id':_0x173470[_0xccd5('0x46')][_0xccd5('0xc9')]}:undefined,'required':_0x173470[_0xccd5('0x46')][_0xccd5('0xc9')]?!![]:![]}];}return db[_0xccd5('0xa3')][_0xccd5('0x55')](_0x25c4cd);})['then'](function(_0x5d8a18){_0xe30d76[_0xccd5('0x56')]=_0x5d8a18;return _0xe30d76;});}})[_0xccd5('0x23')](respondWithFilteredResult(_0x4ce5b0,_0x25c4cd))[_0xccd5('0x2d')](handleError(_0x4ce5b0,null));};exports[_0xccd5('0xb8')]=function(_0x4285b5,_0x5004de,_0x92271){var _0x5db0eb,_0x4aa9e6,_0x69e235;if(_['isNil'](_0x4285b5[_0xccd5('0x5b')][_0xccd5('0x5b')])||_0x4285b5[_0xccd5('0x5b')]['body']===''){throw new db[(_0xccd5('0x96'))][(_0xccd5('0x7b'))](_0xccd5('0xca'));}if(_[_0xccd5('0x97')](_0x4285b5[_0xccd5('0x5b')]['to'])){throw new db[(_0xccd5('0x96'))]['ValidationError']('to\x20is\x20mandatory');}_0x5db0eb=_0x4285b5[_0xccd5('0x5b')]['to'];return db['SmsAccount'][_0xccd5('0x59')]({'where':{'id':_0x4285b5[_0xccd5('0x62')]['id']},'include':[{'model':db[_0xccd5('0x9b')],'as':_0xccd5('0xcb'),'include':[{'model':db[_0xccd5('0x7a')],'as':'Contacts','where':{'mobile':_0x5db0eb},'limit':0x1,'order':[[_0xccd5('0x7e'),_0xccd5('0x9e')]]}]}]})['then'](handleEntityNotFound(_0x5004de,null))[_0xccd5('0x23')](function(_0x250878){if(_0x250878&&_0x250878[_0xccd5('0xcb')]){_0x4aa9e6=_0x250878['get']({'plain':!![]});if(_0x4aa9e6[_0xccd5('0xcb')]&&_0x4aa9e6[_0xccd5('0xcb')][_0xccd5('0x9d')][_0xccd5('0x4a')]){return _0x4aa9e6[_0xccd5('0xcb')]['Contacts'][0x0];}return db['CmContact']['create'](_[_0xccd5('0xa1')](_0x4285b5['body'],{'firstName':_0x5db0eb,'mobile':_0x5db0eb,'phone':_0x5db0eb,'ListId':_0x4aa9e6['ListId']}));}})['then'](handleEntityNotFound(_0x5004de,null))[_0xccd5('0x23')](function(_0x28ae83){if(_0x28ae83){_0x69e235=_0x28ae83;return db[_0xccd5('0xa3')][_0xccd5('0x59')]({'where':{'ContactId':_0x69e235['id'],'closed':![],'SmsAccountId':_0x4aa9e6['id']}})[_0xccd5('0x23')](function(_0x28b39d){if(_0x28b39d){return[_0x28b39d,![]];}return db[_0xccd5('0xa3')][_0xccd5('0x5a')]({'UserId':_0x4285b5[_0xccd5('0x5f')]['id'],'ContactId':_0x69e235['id'],'SmsAccountId':_0x4aa9e6['id'],'phone':_0x5db0eb,'firstMsgDirection':_0xccd5('0xcc'),'Messages':[_['merge'](_0x4285b5[_0xccd5('0x5b')],{'read':![],'body':_0x4285b5[_0xccd5('0x5b')]['body'],'phone':_0x5db0eb,'SmsAccountId':_0x4aa9e6['id'],'UserId':_0x4285b5[_0xccd5('0x5f')]['id'],'ContactId':_0x69e235['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xccd5('0xcd')}]})[_0xccd5('0x23')](function(_0x28f29f){return[_0x28f29f,!![]];});});}})['spread'](function(_0x46c3ef,_0x4d951d){if(_0x4d951d){return _0x46c3ef;}return db[_0xccd5('0xce')][_0xccd5('0x5a')](_[_0xccd5('0x4f')](_0x4285b5['body'],{'read':![],'body':_0x4285b5[_0xccd5('0x5b')][_0xccd5('0x5b')],'phone':_0x5db0eb,'SmsAccountId':_0x4aa9e6['id'],'SmsInteractionId':_0x46c3ef['id'],'UserId':_0x4285b5[_0xccd5('0x5f')]['id'],'ContactId':_0x69e235['id']}))['then'](function(_0x2fa262){_0x46c3ef[_0xccd5('0xcf')][_0xccd5('0xcd')]=[];_0x46c3ef[_0xccd5('0xcf')][_0xccd5('0xcd')][_0xccd5('0xd0')](_0x2fa262[_0xccd5('0xcf')]);return _0x46c3ef;});})[_0xccd5('0x23')](respondWithResult(_0x5004de,null))['catch'](handleError(_0x5004de,null));};exports[_0xccd5('0x2f')]=function(_0x3c99e4,_0x39b59f,_0x16aae6){if(_0x3c99e4['body']['id']){delete _0x3c99e4['body']['id'];}var _0x11a72f,_0x1c2800,_0x3bc749;return db['SmsAccount'][_0xccd5('0x59')]({'where':{'id':_0x3c99e4[_0xccd5('0x62')]['id']}})[_0xccd5('0x23')](handleEntityNotFound(_0x39b59f,null))[_0xccd5('0x23')](function(_0xd55d7){if(_0xd55d7){_0x3bc749=_0xd55d7;logger[_0xccd5('0xb4')](_0xccd5('0x27'),_0xccd5('0x2f'),_0xccd5('0xd1'),_0xd55d7[_0xccd5('0x50')],util[_0xccd5('0xd2')](_0x3c99e4[_0xccd5('0x5b')],{'showHidden':![],'depth':null}));switch(_0xd55d7[_0xccd5('0x50')]){case _0xccd5('0x87'):if(_0x3c99e4[_0xccd5('0x5b')][_0xccd5('0xd3')]&&_0x3c99e4[_0xccd5('0x5b')][_0xccd5('0x2f')]){_0x1c2800=_0x3c99e4['body'][_0xccd5('0x2f')];return db[_0xccd5('0xce')][_0xccd5('0x59')]({'where':{'messageId':_0x3c99e4[_0xccd5('0x5b')][_0xccd5('0xd3')]}});}break;case _0xccd5('0x89'):if(_0x3c99e4[_0xccd5('0x5b')][_0xccd5('0xd4')]&&_0x3c99e4[_0xccd5('0x5b')][_0xccd5('0xd5')]){_0x1c2800=_0x3c99e4[_0xccd5('0x5b')]['statusInt'];return db[_0xccd5('0xce')]['find']({'where':{'messageId':_0x3c99e4['body'][_0xccd5('0xd4')]}});}break;case _0xccd5('0x8a'):if(_0x3c99e4[_0xccd5('0x5b')][_0xccd5('0x8b')]&&_0x3c99e4[_0xccd5('0x5b')]['status_code']){_0x1c2800=_0x3c99e4[_0xccd5('0x5b')][_0xccd5('0xd6')];return db[_0xccd5('0xce')][_0xccd5('0x59')]({'where':{'messageId':_0x3c99e4[_0xccd5('0x5b')]['message_id']}});}break;case _0xccd5('0x8d'):var _0x1a8ed=_0x3c99e4[_0xccd5('0x5b')][_0xccd5('0x8e')][0x0];if(_0x1a8ed[_0xccd5('0x85')]&&_0x1a8ed[_0xccd5('0x2f')][_0xccd5('0xd7')]===_0xccd5('0xd8')){_0x1c2800=_0x1a8ed[_0xccd5('0x2f')][_0xccd5('0xd7')];return db[_0xccd5('0xce')]['find']({'where':{'messageId':_0x1a8ed[_0xccd5('0x85')]}});}break;case _0xccd5('0x93'):if(_0x3c99e4[_0xccd5('0x5b')][_0xccd5('0x85')]&&_0x3c99e4[_0xccd5('0x5b')][_0xccd5('0x2f')]){_0x1c2800=_0x3c99e4['body'][_0xccd5('0x2f')];return db['SmsMessage'][_0xccd5('0x59')]({'where':{'messageId':_0x3c99e4[_0xccd5('0x5b')]['messageId']}});}break;case _0xccd5('0x94'):if(_0x3c99e4[_0xccd5('0x5b')][0x0]['message']['id']){_0x1c2800=_0x3c99e4[_0xccd5('0x5b')][0x0][_0xccd5('0x50')];return db[_0xccd5('0xce')][_0xccd5('0x59')]({'where':{'messageId':_0x3c99e4[_0xccd5('0x5b')][0x0][_0xccd5('0x2b')]['id']}});}break;case _0xccd5('0x95'):if(_0x3c99e4[_0xccd5('0x5b')]['redif']&&_0x3c99e4['body'][_0xccd5('0x2f')]){_0x1c2800=_0x3c99e4['body'][_0xccd5('0x2f')];return db[_0xccd5('0xce')][_0xccd5('0x59')]({'where':{'messageId':_0x3c99e4[_0xccd5('0x5b')][_0xccd5('0xd9')]}});}break;}}})['then'](handleEntityNotFound(_0x39b59f,null))['then'](function(_0x2aec33){if(_0x2aec33){_0x11a72f=_0x2aec33;switch(_0x3bc749[_0xccd5('0x50')]){case'skebby':if(_0x1c2800===_0xccd5('0xd8')){return _0x11a72f['update']({'read':!![]});}else{logger[_0xccd5('0x29')](_0xccd5('0x27'),_0xccd5('0x2f'),_0xccd5('0x87'),util[_0xccd5('0xd2')](_0x3c99e4[_0xccd5('0x5b')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x1c2800==='1'){return _0x11a72f[_0xccd5('0x39')]({'read':!![]});}else{logger[_0xccd5('0x29')](_0xccd5('0x27'),_0xccd5('0x2f'),_0xccd5('0x87'),util[_0xccd5('0xd2')](_0x3c99e4[_0xccd5('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xccd5('0x8a'):if(!_0x3c99e4[_0xccd5('0x5b')][_0xccd5('0xda')]&&_0x1c2800>=0xc8&&_0x1c2800<=0xce){return _0x11a72f[_0xccd5('0x39')]({'read':!![]});}else{logger[_0xccd5('0x29')](_0xccd5('0x27'),_0xccd5('0x2f'),_0xccd5('0x8a'),util[_0xccd5('0xd2')](_0x3c99e4[_0xccd5('0x5b')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x34c6f3=_0x3c99e4[_0xccd5('0x5b')][_0xccd5('0x8e')][0x0];if(_0x34c6f3[_0xccd5('0x2f')][_0xccd5('0xd7')]===_0xccd5('0xd8')){return _0x11a72f[_0xccd5('0x39')]({'read':!![]});}else{logger[_0xccd5('0x29')](_0xccd5('0x27'),_0xccd5('0x2f'),_0xccd5('0x8d'),util['inspect'](_0x3c99e4[_0xccd5('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xccd5('0x93'):if(_0x1c2800==_0xccd5('0xdb')||_0x1c2800==_0xccd5('0xdc')){return _0x11a72f[_0xccd5('0x39')]({'read':!![]});}else{logger['error'](_0xccd5('0x27'),_0xccd5('0x2f'),_0xccd5('0x93'),util[_0xccd5('0xd2')](_0x3c99e4[_0xccd5('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xccd5('0x94'):if(_0x1c2800==_0xccd5('0xdd')){return _0x11a72f[_0xccd5('0x39')]({'read':!![]});}else{logger[_0xccd5('0x29')](_0xccd5('0x27'),_0xccd5('0x2f'),_0xccd5('0x94'),util[_0xccd5('0xd2')](_0x3c99e4[_0xccd5('0x5b')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x1c2800===_0xccd5('0xde')||_0x1c2800===_0xccd5('0xdf')){return _0x11a72f[_0xccd5('0x39')]({'read':!![]});}else{logger[_0xccd5('0x29')](_0xccd5('0x27'),_0xccd5('0x2f'),_0xccd5('0x95'),util[_0xccd5('0xd2')](_0x3c99e4['body'],{'showHidden':![],'depth':null}));}break;}return _0x11a72f;}})['then'](respondWithResult(_0x39b59f,null))[_0xccd5('0x2d')](handleError(_0x39b59f,null));};exports[_0xccd5('0xe0')]=function(_0x5c89a5,_0x100f60,_0x422c6f){var _0xd40990,_0xfa3cb0,_0x2d343c;return db[_0xccd5('0x53')][_0xccd5('0x59')]({'where':{'id':_0x5c89a5[_0xccd5('0x62')]['id']}})['then'](handleEntityNotFound(_0x100f60,null))[_0xccd5('0x23')](function(_0x27f4e8){if(_0x27f4e8){_0x2d343c=_0x27f4e8;logger[_0xccd5('0xb4')](_0xccd5('0x27'),_0xccd5('0x2f'),_0xccd5('0xd1'),_0x27f4e8[_0xccd5('0x50')],util[_0xccd5('0xd2')](_0x5c89a5[_0xccd5('0x46')],{'showHidden':![],'depth':null}));switch(_0x27f4e8[_0xccd5('0x50')]){case'csc':if(_0x5c89a5[_0xccd5('0x46')][_0xccd5('0xe1')]&&_0x5c89a5[_0xccd5('0x46')]['state']){_0xfa3cb0=_0x5c89a5['query'][_0xccd5('0xe2')];return db[_0xccd5('0xce')][_0xccd5('0x59')]({'where':{'messageId':_0x5c89a5[_0xccd5('0x46')][_0xccd5('0xe1')]}});}break;}}})[_0xccd5('0x23')](handleEntityNotFound(_0x100f60,null))['then'](function(_0x3806f9){if(_0x3806f9){_0xd40990=_0x3806f9;switch(_0x2d343c[_0xccd5('0x50')]){case _0xccd5('0x90'):if(_0xfa3cb0==='2'||_0xfa3cb0==='6'){return _0xd40990['update']({'read':!![]});}else{logger[_0xccd5('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xccd5('0x2f'),_0xccd5('0x90'),util[_0xccd5('0xd2')](_0x5c89a5[_0xccd5('0x46')],{'showHidden':![],'depth':null}));};break;}return _0xd40990;}})[_0xccd5('0x23')](respondWithResult(_0x100f60,null))[_0xccd5('0x2d')](handleError(_0x100f60,null));};exports['addAgents']=function(_0x2c5b5d,_0x372e10,_0x22341f){return db[_0xccd5('0x53')][_0xccd5('0x59')]({'where':{'id':_0x2c5b5d[_0xccd5('0x62')]['id']}})[_0xccd5('0x23')](handleEntityNotFound(_0x372e10,null))[_0xccd5('0x23')](function(_0x312845){if(_0x312845){return _0x312845[_0xccd5('0xe3')](_0x2c5b5d[_0xccd5('0x5b')][_0xccd5('0x6c')],_[_0xccd5('0xa0')](_0x2c5b5d[_0xccd5('0x5b')],[_0xccd5('0x6c'),'id'])||{})[_0xccd5('0xa4')](function(_0x51c0e5){for(var _0x5c403e=0x0;_0x5c403e<_0x2c5b5d[_0xccd5('0x5b')][_0xccd5('0x6c')][_0xccd5('0x4a')];_0x5c403e+=0x1){socket['emit'](_0xccd5('0xe4'),{'UserId':Number(_0x2c5b5d[_0xccd5('0x5b')]['ids'][_0x5c403e]),'SmsAccountId':Number(_0x2c5b5d['params']['id'])});}return _0x51c0e5;});}})[_0xccd5('0x23')](respondWithResult(_0x372e10,null))[_0xccd5('0x2d')](handleError(_0x372e10,null));};exports[_0xccd5('0xe5')]=function(_0x4028ea,_0x13d650,_0x2c4676){return db[_0xccd5('0x53')][_0xccd5('0x59')]({'where':{'id':_0x4028ea[_0xccd5('0x62')]['id']}})['then'](handleEntityNotFound(_0x13d650,null))[_0xccd5('0x23')](function(_0x46e43d){if(_0x46e43d){return _0x46e43d['removeAgents'](_0x4028ea['query'][_0xccd5('0x6c')])[_0xccd5('0x23')](function(){if(_['isArray'](_0x4028ea[_0xccd5('0x46')][_0xccd5('0x6c')])){for(var _0x59216e=0x0;_0x59216e<_0x4028ea[_0xccd5('0x46')]['ids'][_0xccd5('0x4a')];_0x59216e+=0x1){socket[_0xccd5('0xe6')](_0xccd5('0xe7'),{'UserId':Number(_0x4028ea[_0xccd5('0x46')][_0xccd5('0x6c')][_0x59216e]),'SmsAccountId':Number(_0x4028ea[_0xccd5('0x62')]['id'])});}}else{socket[_0xccd5('0xe6')](_0xccd5('0xe7'),{'UserId':Number(_0x4028ea[_0xccd5('0x46')][_0xccd5('0x6c')]),'SmsAccountId':Number(_0x4028ea[_0xccd5('0x62')]['id'])});}});}})[_0xccd5('0x23')](respondWithStatusCode(_0x13d650,null))['catch'](handleError(_0x13d650,null));};exports[_0xccd5('0xe8')]=function(_0x51d516,_0x543711,_0x150ed0){var _0xdfaa9d={};var _0x5044e5={};var _0x5bce6b;var _0x40ef63;return db[_0xccd5('0x53')][_0xccd5('0x6f')]({'where':{'id':_0x51d516[_0xccd5('0x62')]['id']}})['then'](handleEntityNotFound(_0x543711,null))['then'](function(_0x304484){if(_0x304484){_0x5bce6b=_0x304484;_0x5044e5[_0xccd5('0x45')]=_[_0xccd5('0x47')](db[_0xccd5('0xac')][_0xccd5('0x57')]);_0x5044e5[_0xccd5('0x46')]=_[_0xccd5('0x47')](_0x51d516[_0xccd5('0x46')]);_0x5044e5[_0xccd5('0x4d')]=_[_0xccd5('0x49')](_0x5044e5['model'],_0x5044e5[_0xccd5('0x46')]);_0xdfaa9d[_0xccd5('0x48')]=_[_0xccd5('0x49')](_0x5044e5[_0xccd5('0x45')],qs['fields'](_0x51d516[_0xccd5('0x46')][_0xccd5('0x58')]));_0xdfaa9d[_0xccd5('0x48')]=_0xdfaa9d[_0xccd5('0x48')][_0xccd5('0x4a')]?_0xdfaa9d['attributes']:_0x5044e5[_0xccd5('0x45')];_0xdfaa9d[_0xccd5('0x67')]=qs[_0xccd5('0x68')](_0x51d516['query']['sort']);_0xdfaa9d['where']=qs[_0xccd5('0x4d')](_['pick'](_0x51d516[_0xccd5('0x46')],_0x5044e5[_0xccd5('0x4d')]));if(_0x51d516[_0xccd5('0x46')][_0xccd5('0x4e')]){_0xdfaa9d['where']=_[_0xccd5('0x4f')](_0xdfaa9d['where'],{'$or':_[_0xccd5('0x42')](_0xdfaa9d[_0xccd5('0x48')],function(_0x2b4bc1){var _0x3cda48={};_0x3cda48[_0x2b4bc1]={'$like':'%'+_0x51d516[_0xccd5('0x46')][_0xccd5('0x4e')]+'%'};return _0x3cda48;})});}_0xdfaa9d=_['merge']({},_0xdfaa9d,_0x51d516[_0xccd5('0x52')]);return _0x5bce6b[_0xccd5('0xe8')](_0xdfaa9d);}})[_0xccd5('0x23')](function(_0xda3364){if(_0xda3364){_0x40ef63=_0xda3364['length'];if(!_0x51d516[_0xccd5('0x46')][_0xccd5('0x4b')](_0xccd5('0x66'))){_0xdfaa9d[_0xccd5('0x35')]=qs[_0xccd5('0x35')](_0x51d516[_0xccd5('0x46')][_0xccd5('0x35')]);_0xdfaa9d['offset']=qs['offset'](_0x51d516[_0xccd5('0x46')][_0xccd5('0x32')]);}return _0x5bce6b['getAgents'](_0xdfaa9d);}})['then'](function(_0x19c65b){if(_0x19c65b){return _0x19c65b?{'count':_0x40ef63,'rows':_0x19c65b}:null;}})[_0xccd5('0x23')](respondWithResult(_0x543711,null))[_0xccd5('0x2d')](handleError(_0x543711,null));}; \ No newline at end of file +var _0xfd89=['unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','addApplications','sequelize','Transaction','bulkCreate','finally','getApplications','getInteractions','Owner','fullname','Tag','color','tag','List','SmsMessage','Messages','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','intelepeer','redif','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','client','http','request','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','then','get','SmsAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','params','length','options','find','create','body','user','UserProfileSection','autoAssociation','describe','addDisposition','getDispositions','findOne','Disposition','SmsAccountId','removeDispositions','ids','CannedAnswer','removeAnswers','notify','sms','SmsApplication','account','orderBy','Applications','priority','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','difference','CompanyId','twilio','from','From','Body','messageId','skebby','sender','text','connectel','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','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','ListId','Contacts','DESC','list','omit','SmsInteraction','spread','interaction','created','autoclose','applications','push','close','unmanaged','*,*,*,*','User','UserId'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xfd89,0x110));var _0x9fd8=function(_0x2af82b,_0x568514){_0x2af82b=_0x2af82b-0x0;var _0x5e4dcf=_0xfd89[_0x2af82b];return _0x5e4dcf;};'use strict';var emlformat=require(_0x9fd8('0x0'));var rimraf=require(_0x9fd8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9fd8('0x2'));var Mustache=require(_0x9fd8('0x3'));var util=require(_0x9fd8('0x4'));var path=require(_0x9fd8('0x5'));var sox=require(_0x9fd8('0x6'));var csv=require(_0x9fd8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9fd8('0x8'));var _=require(_0x9fd8('0x9'));var squel=require(_0x9fd8('0xa'));var crypto=require('crypto');var jsforce=require(_0x9fd8('0xb'));var deskjs=require(_0x9fd8('0xc'));var toCsv=require(_0x9fd8('0x7'));var querystring=require(_0x9fd8('0xd'));var Papa=require('papaparse');var Redis=require(_0x9fd8('0xe'));var authService=require(_0x9fd8('0xf'));var qs=require(_0x9fd8('0x10'));var as=require(_0x9fd8('0x11'));var hardwareService=require(_0x9fd8('0x12'));var logger=require(_0x9fd8('0x13'))(_0x9fd8('0x14'));var utils=require(_0x9fd8('0x15'));var config=require(_0x9fd8('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9fd8('0x17'))['db'];config[_0x9fd8('0x18')]=_[_0x9fd8('0x19')](config[_0x9fd8('0x18')],{'host':_0x9fd8('0x1a'),'port':0x18eb});var socket=require(_0x9fd8('0x1b'))(new Redis(config['redis']));require(_0x9fd8('0x1c'))[_0x9fd8('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9fd8('0x1e')][_0x9fd8('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x46eeff,_0xab0e4c,_0x57d93c,_0x322b2f){return new BPromise(function(_0x385434,_0x33bf18){var _0x5c7ec5=_0x322b2f||client;return _0x5c7ec5[_0x9fd8('0x20')](_0x46eeff,_0x57d93c)['then'](function(_0x321541){logger['info'](_0x9fd8('0x21'),_0xab0e4c,_0x9fd8('0x22'));logger[_0x9fd8('0x23')](_0x9fd8('0x24'),_0xab0e4c,_0x9fd8('0x22'),JSON[_0x9fd8('0x25')](_0x321541));if(_0x321541[_0x9fd8('0x26')]){if(_0x321541[_0x9fd8('0x26')][_0x9fd8('0x27')]===0x1f4){logger[_0x9fd8('0x26')](_0x9fd8('0x21'),_0xab0e4c,_0x321541[_0x9fd8('0x26')][_0x9fd8('0x28')]);return _0x33bf18(_0x321541[_0x9fd8('0x26')]['message']);}logger[_0x9fd8('0x26')](_0x9fd8('0x21'),_0xab0e4c,_0x321541[_0x9fd8('0x26')][_0x9fd8('0x28')]);return _0x385434(_0x321541[_0x9fd8('0x26')][_0x9fd8('0x28')]);}else{logger[_0x9fd8('0x29')](_0x9fd8('0x21'),_0xab0e4c,'request\x20sent');_0x385434(_0x321541['result'][_0x9fd8('0x28')]);}})[_0x9fd8('0x2a')](function(_0x28e200){logger[_0x9fd8('0x26')](_0x9fd8('0x21'),_0xab0e4c,_0x28e200);_0x33bf18(_0x28e200);});});}function respondWithStatusCode(_0x369af1,_0x11c8db){_0x11c8db=_0x11c8db||0xcc;return function(_0x249585){if(_0x249585){return _0x369af1[_0x9fd8('0x2b')](_0x11c8db);}return _0x369af1[_0x9fd8('0x2c')](_0x11c8db)[_0x9fd8('0x2d')]();};}function respondWithResult(_0x1b4891,_0x55b9cf){_0x55b9cf=_0x55b9cf||0xc8;return function(_0x242afd){if(_0x242afd){return _0x1b4891['status'](_0x55b9cf)['json'](_0x242afd);}};}function respondWithFilteredResult(_0x173709,_0x2d477e){return function(_0x24c2e9){if(_0x24c2e9){var _0x50ffb0=typeof _0x2d477e[_0x9fd8('0x2e')]===_0x9fd8('0x2f')&&typeof _0x2d477e[_0x9fd8('0x30')]==='undefined';var _0x2bf6d1=_0x24c2e9[_0x9fd8('0x31')];var _0x54f6bc=_0x50ffb0?0x0:_0x2d477e[_0x9fd8('0x2e')];var _0x5e0def=_0x50ffb0?_0x24c2e9[_0x9fd8('0x31')]:_0x2d477e[_0x9fd8('0x2e')]+_0x2d477e['limit'];var _0x52ffa3;if(_0x5e0def>=_0x2bf6d1){_0x5e0def=_0x2bf6d1;_0x52ffa3=0xc8;}else{_0x52ffa3=0xce;}_0x173709[_0x9fd8('0x2c')](_0x52ffa3);return _0x173709[_0x9fd8('0x32')](_0x9fd8('0x33'),_0x54f6bc+'-'+_0x5e0def+'/'+_0x2bf6d1)[_0x9fd8('0x34')](_0x24c2e9);}return null;};}function patchUpdates(_0x592376){return function(_0x5a4687){try{jsonpatch['apply'](_0x5a4687,_0x592376,!![]);}catch(_0x1ba264){return BPromise[_0x9fd8('0x35')](_0x1ba264);}return _0x5a4687[_0x9fd8('0x36')]();};}function saveUpdates(_0x2523af,_0x509031){return function(_0x2f7510){if(_0x2f7510){return _0x2f7510[_0x9fd8('0x37')](_0x2523af)['then'](function(_0x342aef){return _0x342aef;});}return null;};}function removeEntity(_0x3d2d08,_0x2798c5){return function(_0x354cb6){if(_0x354cb6){return _0x354cb6[_0x9fd8('0x38')]()[_0x9fd8('0x39')](function(){var _0x57e047=_0x354cb6[_0x9fd8('0x3a')]({'plain':!![]});var _0x4b27ab=_0x9fd8('0x3b');return db[_0x9fd8('0x3c')][_0x9fd8('0x38')]({'where':{'type':_0x4b27ab,'resourceId':_0x57e047['id']}})['then'](function(){return _0x354cb6;});})[_0x9fd8('0x39')](function(){_0x3d2d08[_0x9fd8('0x2c')](0xcc)[_0x9fd8('0x2d')]();});}};}function handleEntityNotFound(_0x11927d,_0x517b1d){return function(_0x958055){if(!_0x958055){_0x11927d['sendStatus'](0x194);}return _0x958055;};}function handleError(_0x46f068,_0x17447a){_0x17447a=_0x17447a||0x1f4;return function(_0x38cfe6){logger['error'](_0x38cfe6[_0x9fd8('0x3d')]);if(_0x38cfe6[_0x9fd8('0x3e')]){delete _0x38cfe6[_0x9fd8('0x3e')];}_0x46f068[_0x9fd8('0x2c')](_0x17447a)[_0x9fd8('0x3f')](_0x38cfe6);};}exports['index']=function(_0x331eef,_0x2d703f){var _0x44122e={'include':[{'model':db[_0x9fd8('0x40')],'as':_0x9fd8('0x41')}]},_0x757694={},_0x41f82e={'count':0x0,'rows':[]};var _0x1eb1c9=_[_0x9fd8('0x42')](db[_0x9fd8('0x43')][_0x9fd8('0x44')],function(_0x389fc4){return{'name':_0x389fc4['fieldName'],'type':_0x389fc4[_0x9fd8('0x45')][_0x9fd8('0x46')]};});_0x757694[_0x9fd8('0x47')]=_[_0x9fd8('0x42')](_0x1eb1c9,_0x9fd8('0x3e'));_0x757694[_0x9fd8('0x48')]=_[_0x9fd8('0x49')](_0x331eef[_0x9fd8('0x48')]);_0x757694[_0x9fd8('0x4a')]=_[_0x9fd8('0x4b')](_0x757694['model'],_0x757694[_0x9fd8('0x48')]);_0x44122e[_0x9fd8('0x4c')]=_[_0x9fd8('0x4b')](_0x757694[_0x9fd8('0x47')],qs[_0x9fd8('0x4d')](_0x331eef[_0x9fd8('0x48')][_0x9fd8('0x4d')]));_0x44122e[_0x9fd8('0x4c')]=_0x44122e[_0x9fd8('0x4c')]['length']?_0x44122e[_0x9fd8('0x4c')]:_0x757694['model'];if(!_0x331eef[_0x9fd8('0x48')][_0x9fd8('0x4e')](_0x9fd8('0x4f'))){_0x44122e['limit']=qs[_0x9fd8('0x30')](_0x331eef['query'][_0x9fd8('0x30')]);_0x44122e['offset']=qs['offset'](_0x331eef[_0x9fd8('0x48')][_0x9fd8('0x2e')]);}_0x44122e[_0x9fd8('0x50')]=qs[_0x9fd8('0x51')](_0x331eef[_0x9fd8('0x48')]['sort']);_0x44122e[_0x9fd8('0x52')]=qs['filters'](_[_0x9fd8('0x53')](_0x331eef[_0x9fd8('0x48')],_0x757694['filters']),_0x1eb1c9);if(_0x331eef[_0x9fd8('0x48')]['filter']){_0x44122e['where']=_[_0x9fd8('0x54')](_0x44122e[_0x9fd8('0x52')],{'$or':_[_0x9fd8('0x42')](_0x1eb1c9,function(_0x285438){if(_0x285438['type']!==_0x9fd8('0x55')){var _0x30155f={};_0x30155f[_0x285438[_0x9fd8('0x3e')]]={'$like':'%'+_0x331eef[_0x9fd8('0x48')][_0x9fd8('0x56')]+'%'};return _0x30155f;}})});}_0x44122e=_[_0x9fd8('0x54')]({},_0x44122e,_0x331eef['options']);var _0x1e2b1d={'where':_0x44122e['where']};return db[_0x9fd8('0x43')][_0x9fd8('0x31')](_0x1e2b1d)['then'](function(_0x1f8c87){_0x41f82e['count']=_0x1f8c87;if(_0x331eef[_0x9fd8('0x48')][_0x9fd8('0x57')]){_0x44122e[_0x9fd8('0x58')]=[{'all':!![]}];}return db['SmsAccount'][_0x9fd8('0x59')](_0x44122e);})[_0x9fd8('0x39')](function(_0x54d8de){_0x41f82e[_0x9fd8('0x5a')]=_0x54d8de;return _0x41f82e;})['then'](respondWithFilteredResult(_0x2d703f,_0x44122e))[_0x9fd8('0x2a')](handleError(_0x2d703f,null));};exports['show']=function(_0x18c8f5,_0x500814){var _0x5d18cc={'raw':![],'where':{'id':_0x18c8f5[_0x9fd8('0x5b')]['id']},'include':[{'model':db[_0x9fd8('0x40')],'as':_0x9fd8('0x41')}]},_0x1becc6={};_0x1becc6[_0x9fd8('0x47')]=_[_0x9fd8('0x49')](db[_0x9fd8('0x43')][_0x9fd8('0x44')]);_0x1becc6[_0x9fd8('0x48')]=_[_0x9fd8('0x49')](_0x18c8f5[_0x9fd8('0x48')]);_0x1becc6[_0x9fd8('0x4a')]=_['intersection'](_0x1becc6[_0x9fd8('0x47')],_0x1becc6[_0x9fd8('0x48')]);_0x5d18cc[_0x9fd8('0x4c')]=_[_0x9fd8('0x4b')](_0x1becc6[_0x9fd8('0x47')],qs[_0x9fd8('0x4d')](_0x18c8f5[_0x9fd8('0x48')][_0x9fd8('0x4d')]));_0x5d18cc['attributes']=_0x5d18cc[_0x9fd8('0x4c')][_0x9fd8('0x5c')]?_0x5d18cc[_0x9fd8('0x4c')]:_0x1becc6[_0x9fd8('0x47')];if(_0x18c8f5[_0x9fd8('0x48')][_0x9fd8('0x57')]){_0x5d18cc[_0x9fd8('0x58')]=[{'all':!![]}];}_0x5d18cc=_[_0x9fd8('0x54')]({},_0x5d18cc,_0x18c8f5[_0x9fd8('0x5d')]);return db[_0x9fd8('0x43')][_0x9fd8('0x5e')](_0x5d18cc)[_0x9fd8('0x39')](handleEntityNotFound(_0x500814,null))[_0x9fd8('0x39')](respondWithResult(_0x500814,null))[_0x9fd8('0x2a')](handleError(_0x500814,null));};exports[_0x9fd8('0x5f')]=function(_0xd7d274,_0x5d8e6d){return db['SmsAccount'][_0x9fd8('0x5f')](_0xd7d274[_0x9fd8('0x60')],{})['then'](function(_0x4ed6fc){var _0x1289fc=_0xd7d274[_0x9fd8('0x61')]['get']({'plain':!![]});if(!_0x1289fc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1289fc['role']===_0x9fd8('0x61')){var _0x2dd11e=_0x4ed6fc['get']({'plain':!![]});var _0x32f5c5=_0x9fd8('0x3b');return db[_0x9fd8('0x62')][_0x9fd8('0x5e')]({'where':{'name':_0x32f5c5,'userProfileId':_0x1289fc['userProfileId']},'raw':!![]})['then'](function(_0x3a102f){if(_0x3a102f&&_0x3a102f[_0x9fd8('0x63')]===0x0){return db['UserProfileResource'][_0x9fd8('0x5f')]({'name':_0x2dd11e[_0x9fd8('0x3e')],'resourceId':_0x2dd11e['id'],'type':_0x3a102f[_0x9fd8('0x3e')],'sectionId':_0x3a102f['id']},{})['then'](function(){return _0x4ed6fc;});}else{return _0x4ed6fc;}})[_0x9fd8('0x2a')](function(_0x464e45){logger[_0x9fd8('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x464e45);throw _0x464e45;});}return _0x4ed6fc;})[_0x9fd8('0x39')](respondWithResult(_0x5d8e6d,0xc9))[_0x9fd8('0x2a')](handleError(_0x5d8e6d,null));};exports[_0x9fd8('0x37')]=function(_0x18fe8c,_0x46bb51){if(_0x18fe8c[_0x9fd8('0x60')]['id']){delete _0x18fe8c[_0x9fd8('0x60')]['id'];}return db[_0x9fd8('0x43')][_0x9fd8('0x5e')]({'where':{'id':_0x18fe8c[_0x9fd8('0x5b')]['id']},'include':[{'model':db[_0x9fd8('0x40')],'as':_0x9fd8('0x41')}]})[_0x9fd8('0x39')](handleEntityNotFound(_0x46bb51,null))[_0x9fd8('0x39')](saveUpdates(_0x18fe8c[_0x9fd8('0x60')],null))[_0x9fd8('0x39')](respondWithResult(_0x46bb51,null))['catch'](handleError(_0x46bb51,null));};exports[_0x9fd8('0x38')]=function(_0x51e5a3,_0x2cd2c1){return db[_0x9fd8('0x43')][_0x9fd8('0x5e')]({'where':{'id':_0x51e5a3['params']['id']}})[_0x9fd8('0x39')](handleEntityNotFound(_0x2cd2c1,null))[_0x9fd8('0x39')](removeEntity(_0x2cd2c1,null))[_0x9fd8('0x2a')](handleError(_0x2cd2c1,null));};exports['describe']=function(_0x1a3962,_0x2f49e3){return db[_0x9fd8('0x43')][_0x9fd8('0x64')]()[_0x9fd8('0x39')](respondWithResult(_0x2f49e3,null))[_0x9fd8('0x2a')](handleError(_0x2f49e3,null));};exports[_0x9fd8('0x65')]=function(_0x5dd395,_0x47d76f,_0xac5d37){if(_0x5dd395[_0x9fd8('0x60')]['id']){delete _0x5dd395[_0x9fd8('0x60')]['id'];}return db[_0x9fd8('0x43')][_0x9fd8('0x5e')]({'where':{'id':_0x5dd395[_0x9fd8('0x5b')]['id']}})[_0x9fd8('0x39')](handleEntityNotFound(_0x47d76f,null))[_0x9fd8('0x39')](function(_0x8dc167){if(_0x8dc167){_0x5dd395[_0x9fd8('0x60')]['SmsAccountId']=_0x8dc167['id'];return db['Disposition'][_0x9fd8('0x5f')](_0x5dd395[_0x9fd8('0x60')]);}})[_0x9fd8('0x39')](respondWithResult(_0x47d76f,null))[_0x9fd8('0x2a')](handleError(_0x47d76f,null));};exports[_0x9fd8('0x66')]=function(_0x5309b3,_0x260592,_0x1a695a){var _0x50ef09={'raw':![],'where':{}};var _0x416cfa={};var _0x41cd40={'count':0x0,'rows':[]};return db[_0x9fd8('0x43')][_0x9fd8('0x67')]({'where':{'id':_0x5309b3['params']['id']}})['then'](handleEntityNotFound(_0x260592,null))[_0x9fd8('0x39')](function(_0xe6948){if(_0xe6948){_0x416cfa[_0x9fd8('0x47')]=_[_0x9fd8('0x49')](db[_0x9fd8('0x68')][_0x9fd8('0x44')]);_0x416cfa['query']=_[_0x9fd8('0x49')](_0x5309b3[_0x9fd8('0x48')]);_0x416cfa['filters']=_[_0x9fd8('0x4b')](_0x416cfa[_0x9fd8('0x47')],_0x416cfa['query']);_0x50ef09[_0x9fd8('0x4c')]=_[_0x9fd8('0x4b')](_0x416cfa[_0x9fd8('0x47')],qs[_0x9fd8('0x4d')](_0x5309b3['query'][_0x9fd8('0x4d')]));_0x50ef09[_0x9fd8('0x4c')]=_0x50ef09[_0x9fd8('0x4c')][_0x9fd8('0x5c')]?_0x50ef09['attributes']:_0x416cfa[_0x9fd8('0x47')];if(!_0x5309b3[_0x9fd8('0x48')][_0x9fd8('0x4e')]('nolimit')){_0x50ef09[_0x9fd8('0x30')]=qs[_0x9fd8('0x30')](_0x5309b3['query'][_0x9fd8('0x30')]);_0x50ef09[_0x9fd8('0x2e')]=qs[_0x9fd8('0x2e')](_0x5309b3['query'][_0x9fd8('0x2e')]);}_0x50ef09[_0x9fd8('0x50')]=qs['sort'](_0x5309b3[_0x9fd8('0x48')][_0x9fd8('0x51')]);_0x50ef09['where']=qs[_0x9fd8('0x4a')](_[_0x9fd8('0x53')](_0x5309b3[_0x9fd8('0x48')],_0x416cfa['filters']));_0x50ef09[_0x9fd8('0x52')][_0x9fd8('0x69')]=_0xe6948['id'];if(_0x5309b3[_0x9fd8('0x48')]['filter']){_0x50ef09[_0x9fd8('0x52')]=_[_0x9fd8('0x54')](_0x50ef09[_0x9fd8('0x52')],{'$or':_[_0x9fd8('0x42')](_0x50ef09[_0x9fd8('0x4c')],function(_0x568e83){var _0x204e18={};_0x204e18[_0x568e83]={'$like':'%'+_0x5309b3[_0x9fd8('0x48')][_0x9fd8('0x56')]+'%'};return _0x204e18;})});}_0x50ef09=_[_0x9fd8('0x54')]({},_0x50ef09,_0x5309b3[_0x9fd8('0x5d')]);return db['Disposition'][_0x9fd8('0x31')]({'where':_0x50ef09[_0x9fd8('0x52')]})['then'](function(_0x195e65){_0x41cd40[_0x9fd8('0x31')]=_0x195e65;if(_0x5309b3[_0x9fd8('0x48')][_0x9fd8('0x57')]){_0x50ef09['include']=[{'all':!![]}];}return db[_0x9fd8('0x68')][_0x9fd8('0x59')](_0x50ef09);})[_0x9fd8('0x39')](function(_0x4309ee){_0x41cd40[_0x9fd8('0x5a')]=_0x4309ee;return _0x41cd40;});}})['then'](respondWithFilteredResult(_0x260592,_0x50ef09))[_0x9fd8('0x2a')](handleError(_0x260592,null));};exports[_0x9fd8('0x6a')]=function(_0x67340f,_0x110b93,_0x424ca4){return db[_0x9fd8('0x43')][_0x9fd8('0x5e')]({'where':{'id':_0x67340f[_0x9fd8('0x5b')]['id']}})[_0x9fd8('0x39')](handleEntityNotFound(_0x110b93,null))[_0x9fd8('0x39')](function(_0x2a2233){if(_0x2a2233){return _0x2a2233[_0x9fd8('0x6a')](_0x67340f[_0x9fd8('0x48')][_0x9fd8('0x6b')]);}})['then'](respondWithStatusCode(_0x110b93,null))[_0x9fd8('0x2a')](handleError(_0x110b93,null));};exports['addAnswer']=function(_0x4f9ebf,_0x4fe2db,_0x1e4608){if(_0x4f9ebf[_0x9fd8('0x60')]['id']){delete _0x4f9ebf[_0x9fd8('0x60')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x4f9ebf[_0x9fd8('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4fe2db,null))[_0x9fd8('0x39')](function(_0x2e298f){if(_0x2e298f){_0x4f9ebf['body'][_0x9fd8('0x69')]=_0x2e298f['id'];return db['CannedAnswer'][_0x9fd8('0x5f')](_0x4f9ebf[_0x9fd8('0x60')]);}})['then'](respondWithResult(_0x4fe2db,null))[_0x9fd8('0x2a')](handleError(_0x4fe2db,null));};exports['getAnswers']=function(_0x4c5ef8,_0x351264,_0x271995){var _0x16da97={'raw':![],'where':{}};var _0x37a926={};var _0xbdec77={'count':0x0,'rows':[]};return db[_0x9fd8('0x43')][_0x9fd8('0x67')]({'where':{'id':_0x4c5ef8[_0x9fd8('0x5b')]['id']}})[_0x9fd8('0x39')](handleEntityNotFound(_0x351264,null))[_0x9fd8('0x39')](function(_0xa796da){if(_0xa796da){_0x37a926[_0x9fd8('0x47')]=_['keys'](db[_0x9fd8('0x6c')][_0x9fd8('0x44')]);_0x37a926[_0x9fd8('0x48')]=_[_0x9fd8('0x49')](_0x4c5ef8[_0x9fd8('0x48')]);_0x37a926['filters']=_[_0x9fd8('0x4b')](_0x37a926[_0x9fd8('0x47')],_0x37a926[_0x9fd8('0x48')]);_0x16da97[_0x9fd8('0x4c')]=_['intersection'](_0x37a926[_0x9fd8('0x47')],qs[_0x9fd8('0x4d')](_0x4c5ef8[_0x9fd8('0x48')][_0x9fd8('0x4d')]));_0x16da97['attributes']=_0x16da97[_0x9fd8('0x4c')]['length']?_0x16da97['attributes']:_0x37a926['model'];if(!_0x4c5ef8[_0x9fd8('0x48')][_0x9fd8('0x4e')]('nolimit')){_0x16da97['limit']=qs[_0x9fd8('0x30')](_0x4c5ef8[_0x9fd8('0x48')][_0x9fd8('0x30')]);_0x16da97[_0x9fd8('0x2e')]=qs[_0x9fd8('0x2e')](_0x4c5ef8[_0x9fd8('0x48')][_0x9fd8('0x2e')]);}_0x16da97[_0x9fd8('0x50')]=qs['sort'](_0x4c5ef8[_0x9fd8('0x48')][_0x9fd8('0x51')]);_0x16da97[_0x9fd8('0x52')]=qs[_0x9fd8('0x4a')](_['pick'](_0x4c5ef8['query'],_0x37a926[_0x9fd8('0x4a')]));_0x16da97[_0x9fd8('0x52')][_0x9fd8('0x69')]=_0xa796da['id'];if(_0x4c5ef8[_0x9fd8('0x48')][_0x9fd8('0x56')]){_0x16da97[_0x9fd8('0x52')]=_[_0x9fd8('0x54')](_0x16da97['where'],{'$or':_[_0x9fd8('0x42')](_0x16da97['attributes'],function(_0x6dcf6a){var _0x5dfe5c={};_0x5dfe5c[_0x6dcf6a]={'$like':'%'+_0x4c5ef8[_0x9fd8('0x48')][_0x9fd8('0x56')]+'%'};return _0x5dfe5c;})});}_0x16da97=_[_0x9fd8('0x54')]({},_0x16da97,_0x4c5ef8[_0x9fd8('0x5d')]);return db[_0x9fd8('0x6c')][_0x9fd8('0x31')]({'where':_0x16da97['where']})[_0x9fd8('0x39')](function(_0x12fb27){_0xbdec77[_0x9fd8('0x31')]=_0x12fb27;if(_0x4c5ef8[_0x9fd8('0x48')][_0x9fd8('0x57')]){_0x16da97['include']=[{'all':!![]}];}return db[_0x9fd8('0x6c')][_0x9fd8('0x59')](_0x16da97);})[_0x9fd8('0x39')](function(_0x17cbbf){_0xbdec77[_0x9fd8('0x5a')]=_0x17cbbf;return _0xbdec77;});}})[_0x9fd8('0x39')](respondWithFilteredResult(_0x351264,_0x16da97))['catch'](handleError(_0x351264,null));};exports[_0x9fd8('0x6d')]=function(_0x33ddee,_0x2a3cad,_0x5c2cb9){return db[_0x9fd8('0x43')][_0x9fd8('0x5e')]({'where':{'id':_0x33ddee['params']['id']}})[_0x9fd8('0x39')](handleEntityNotFound(_0x2a3cad,null))[_0x9fd8('0x39')](function(_0x4de268){if(_0x4de268){return _0x4de268['removeAnswers'](_0x33ddee[_0x9fd8('0x48')]['ids']);}})[_0x9fd8('0x39')](respondWithStatusCode(_0x2a3cad,null))[_0x9fd8('0x2a')](handleError(_0x2a3cad,null));};exports[_0x9fd8('0x6e')]=function(_0xb45a4e,_0x5e9255,_0x433b53){var _0xf8e3c5={'channel':_0x9fd8('0x6f')};var _0x57aa9e=[];var _0x5109c5=[];var _0x8ee62b={};return db[_0x9fd8('0x43')][_0x9fd8('0x5e')]({'where':{'id':_0xb45a4e[_0x9fd8('0x5b')]['id']},'include':[{'model':db[_0x9fd8('0x70')],'as':'Applications'}]})[_0x9fd8('0x39')](handleEntityNotFound(_0x5e9255,null))[_0x9fd8('0x39')](function(_0x560f75){_0xf8e3c5[_0x9fd8('0x71')]=_0x560f75;_0xf8e3c5['applications']=_[_0x9fd8('0x72')](_0x560f75[_0x9fd8('0x73')],[_0x9fd8('0x74')],['asc']);if(_0xf8e3c5['account']['Applications']){delete _0xf8e3c5[_0x9fd8('0x71')][_0x9fd8('0x73')];}return db[_0x9fd8('0x75')][_0x9fd8('0x64')]();})[_0x9fd8('0x39')](function(_0x3ee84d){if(!_0x3ee84d){throw new db[(_0x9fd8('0x76'))][(_0x9fd8('0x77'))](_0x9fd8('0x78'));}_0x57aa9e=_['difference'](_[_0x9fd8('0x49')](_0x3ee84d),['createdAt',_0x9fd8('0x79')]);_0x5109c5=_[_0x9fd8('0x7a')](_['keys'](_0x3ee84d),['createdAt','updatedAt',_0x9fd8('0x7b'),'ListId']);_0xf8e3c5[_0x9fd8('0x60')]={'mapKey':'mobile'};if(_0xf8e3c5[_0x9fd8('0x71')]['type']){switch(_0xf8e3c5['account'][_0x9fd8('0x45')]){case _0x9fd8('0x7c'):_0xf8e3c5[_0x9fd8('0x60')][_0x9fd8('0x7d')]=_0xb45a4e['body'][_0x9fd8('0x7e')];_0xf8e3c5[_0x9fd8('0x60')][_0x9fd8('0x60')]=_0xb45a4e['body'][_0x9fd8('0x7f')];_0xf8e3c5[_0x9fd8('0x60')][_0x9fd8('0x80')]=_0xb45a4e[_0x9fd8('0x60')]['MessageSid'];break;case _0x9fd8('0x81'):_0xf8e3c5[_0x9fd8('0x60')]['from']='+'+_0xb45a4e[_0x9fd8('0x60')][_0x9fd8('0x82')];_0xf8e3c5[_0x9fd8('0x60')]['body']=_0xb45a4e[_0x9fd8('0x60')][_0x9fd8('0x83')];break;case _0x9fd8('0x84'):_0xf8e3c5[_0x9fd8('0x60')][_0x9fd8('0x7d')]=_0xb45a4e['body'][_0x9fd8('0x7d')];_0xf8e3c5[_0x9fd8('0x60')]['body']=_0xb45a4e[_0x9fd8('0x60')]['message'];break;case _0x9fd8('0x85'):_0xf8e3c5[_0x9fd8('0x60')][_0x9fd8('0x7d')]=_0xb45a4e[_0x9fd8('0x60')]['from'];_0xf8e3c5[_0x9fd8('0x60')][_0x9fd8('0x60')]=_0xb45a4e[_0x9fd8('0x60')]['body'];_0xf8e3c5['body'][_0x9fd8('0x80')]=_0xb45a4e[_0x9fd8('0x60')][_0x9fd8('0x86')];break;case _0x9fd8('0x87'):_0xf8e3c5[_0x9fd8('0x60')][_0x9fd8('0x7d')]=_0xb45a4e[_0x9fd8('0x60')][_0x9fd8('0x7e')];_0xf8e3c5[_0x9fd8('0x60')][_0x9fd8('0x60')]=_0xb45a4e[_0x9fd8('0x60')][_0x9fd8('0x88')];_0xf8e3c5[_0x9fd8('0x60')][_0x9fd8('0x80')]=_0xb45a4e[_0x9fd8('0x60')][_0x9fd8('0x89')];break;case _0x9fd8('0x8a'):_0xf8e3c5['body'][_0x9fd8('0x7d')]='+'+_0xb45a4e[_0x9fd8('0x60')][_0x9fd8('0x8b')][0x0]['from'];_0xf8e3c5['body'][_0x9fd8('0x60')]=_0xb45a4e[_0x9fd8('0x60')][_0x9fd8('0x8b')][0x0][_0x9fd8('0x83')];_0xf8e3c5[_0x9fd8('0x60')]['messageId']=_0xb45a4e[_0x9fd8('0x60')][_0x9fd8('0x8b')][0x0][_0x9fd8('0x80')];break;case _0x9fd8('0x8c'):_0xf8e3c5[_0x9fd8('0x60')][_0x9fd8('0x7d')]=_0xb45a4e['body'][_0x9fd8('0x8d')];_0xf8e3c5[_0x9fd8('0x60')]['body']=_0xb45a4e[_0x9fd8('0x60')][_0x9fd8('0x8e')][_0x9fd8('0x28')];break;case _0x9fd8('0x8f'):_0xf8e3c5[_0x9fd8('0x60')][_0x9fd8('0x7d')]=_0xb45a4e[_0x9fd8('0x60')][_0x9fd8('0x90')];_0xf8e3c5[_0x9fd8('0x60')][_0x9fd8('0x60')]=_0xb45a4e[_0x9fd8('0x60')][_0x9fd8('0x83')];_0xf8e3c5[_0x9fd8('0x60')]['messageId']=_0xb45a4e[_0x9fd8('0x60')][_0x9fd8('0x91')];break;case _0x9fd8('0x92'):_0xf8e3c5[_0x9fd8('0x60')][_0x9fd8('0x80')]=_0xb45a4e[_0x9fd8('0x60')][0x0][_0x9fd8('0x28')]['id'];_0xf8e3c5[_0x9fd8('0x60')]['from']=_0xb45a4e[_0x9fd8('0x60')][0x0][_0x9fd8('0x28')]['from'];_0xf8e3c5[_0x9fd8('0x60')]['body']=_0xb45a4e[_0x9fd8('0x60')][0x0][_0x9fd8('0x28')][_0x9fd8('0x83')];break;case'intelepeer':_0xf8e3c5['body']['from']=_0xb45a4e[_0x9fd8('0x60')][_0x9fd8('0x7d')];_0xf8e3c5[_0x9fd8('0x60')][_0x9fd8('0x60')]=_0xb45a4e['body']['message'];_0xf8e3c5['body']['messageId']=_0xb45a4e[_0x9fd8('0x60')]['refid'];break;}}if(_0xf8e3c5[_0x9fd8('0x60')]['id']){delete _0xf8e3c5[_0x9fd8('0x60')]['id'];}if(_[_0x9fd8('0x93')](_0xf8e3c5['body'][_0x9fd8('0x7d')])){throw new db[(_0x9fd8('0x76'))][(_0x9fd8('0x77'))](_0x9fd8('0x94'));}if(_[_0x9fd8('0x93')](_0xf8e3c5[_0x9fd8('0x60')][_0x9fd8('0x60')])||_0xf8e3c5[_0x9fd8('0x60')][_0x9fd8('0x60')]===''){throw new db['Sequelize'][(_0x9fd8('0x77'))](_0x9fd8('0x95'));}if(_[_0x9fd8('0x93')](_0xf8e3c5['body'][_0x9fd8('0x96')])){throw new db['Sequelize']['ValidationError'](_0x9fd8('0x97')+_0x5109c5);}if(!_['includes'](_0x5109c5,_0xf8e3c5[_0x9fd8('0x60')][_0x9fd8('0x96')])){throw new db['Sequelize']['ValidationError'](_0x9fd8('0x98')+_0x5109c5);}_0x8ee62b[_0xf8e3c5[_0x9fd8('0x60')][_0x9fd8('0x96')]]=_0xf8e3c5[_0x9fd8('0x60')]['from'];return db['CmList'][_0x9fd8('0x5e')]({'where':{'id':_0xf8e3c5[_0x9fd8('0x71')][_0x9fd8('0x99')]},'include':[{'model':db['CmContact'],'as':_0x9fd8('0x9a'),'where':_0x8ee62b,'limit':0x1,'order':[[_0x9fd8('0x79'),_0x9fd8('0x9b')]]}]});})[_0x9fd8('0x39')](handleEntityNotFound(_0x5e9255,null))['then'](function(_0x2650f0){if(_0x2650f0){_0xf8e3c5[_0x9fd8('0x9c')]=_[_0x9fd8('0x9d')](_0x2650f0,[_0x9fd8('0x9a')]);if(_0x2650f0[_0x9fd8('0x9a')][_0x9fd8('0x5c')]){return _0x2650f0[_0x9fd8('0x9a')][0x0];}var _0x2207f9=_[_0x9fd8('0x19')](_0xf8e3c5[_0x9fd8('0x60')],{'firstName':_0xf8e3c5[_0x9fd8('0x60')][_0x9fd8('0x7d')],'ListId':_0x2650f0['id']});_0x2207f9[_0xf8e3c5[_0x9fd8('0x60')][_0x9fd8('0x96')]]=_0xf8e3c5[_0x9fd8('0x60')][_0x9fd8('0x7d')];return db['CmContact']['create'](_0x2207f9,{'fields':_0x57aa9e,'raw':!![]});}})[_0x9fd8('0x39')](handleEntityNotFound(_0x5e9255,null))['then'](function(_0x28d988){if(_0x28d988){_0xf8e3c5['contact']=_0x28d988;var _0x33eec5={'ContactId':_0x28d988['id'],'phone':_0xf8e3c5[_0x9fd8('0x60')][_0x9fd8('0x7d')],'SmsAccountId':_0xb45a4e[_0x9fd8('0x5b')]['id']};var _0xa44204={'ContactId':_0x28d988['id'],'SmsAccountId':_0xb45a4e[_0x9fd8('0x5b')]['id'],'closed':![]};return db[_0x9fd8('0x9e')][_0x9fd8('0x5e')]({'where':_0xa44204})[_0x9fd8('0x39')](function(_0x146306){if(_0x146306){return[_0x146306,![]];}return db['SmsInteraction'][_0x9fd8('0x5f')](_0x33eec5)[_0x9fd8('0x39')](function(_0x592430){return[_0x592430,!![]];});});}})[_0x9fd8('0x9f')](function(_0x1ce7a0,_0x5b211c){_0xf8e3c5[_0x9fd8('0xa0')]=_0x1ce7a0[_0x9fd8('0x3a')]({'plain':!![]});_0xf8e3c5[_0x9fd8('0xa0')][_0x9fd8('0xa1')]=![];if(_0x5b211c){if(_0xf8e3c5[_0x9fd8('0x71')][_0x9fd8('0xa2')]){_0xf8e3c5[_0x9fd8('0xa3')][_0x9fd8('0xa4')]({'id':0x0,'priority':_0xf8e3c5[_0x9fd8('0xa3')][_0x9fd8('0x5c')]+0x1,'app':_0x9fd8('0xa5'),'appdata':_0x9fd8('0xa6'),'interval':_0x9fd8('0xa7')});}_0xf8e3c5[_0x9fd8('0xa0')]['created']=!![];}return db['SmsMessage']['create']({'phone':_0xf8e3c5[_0x9fd8('0x60')][_0x9fd8('0x7d')],'messageId':_0xf8e3c5[_0x9fd8('0x60')][_0x9fd8('0x80')],'body':_0xf8e3c5[_0x9fd8('0x60')][_0x9fd8('0x60')],'SmsAccountId':_0xb45a4e[_0x9fd8('0x5b')]['id'],'SmsInteractionId':_0x1ce7a0['id'],'direction':'in','ContactId':_0x1ce7a0['ContactId'],'AttachmentId':_0xf8e3c5[_0x9fd8('0x60')]['AttachmentId']});})[_0x9fd8('0x39')](function(_0x563afd){_0xf8e3c5['message']=_0x563afd;if(_0xf8e3c5[_0x9fd8('0xa0')]['UserId']){return db[_0x9fd8('0xa8')]['find']({'attributes':['id',_0x9fd8('0x3e')],'where':{'id':_0xf8e3c5[_0x9fd8('0xa0')][_0x9fd8('0xa9')]}})[_0x9fd8('0x39')](function(_0x4b5e00){if(_0x4b5e00){_0xf8e3c5[_0x9fd8('0xa3')][_0x9fd8('0xaa')]({'id':0x0,'priority':0x0,'app':_0x9fd8('0xab'),'appdata':_0x4b5e00[_0x9fd8('0x3e')]+','+(_0xf8e3c5[_0x9fd8('0x71')][_0x9fd8('0xac')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x9fd8('0xad'),_0x9fd8('0xae'),_0xf8e3c5);});}return respondWithRpcPromise('Start',_0x9fd8('0xae'),_0xf8e3c5);})[_0x9fd8('0x39')](function(_0x3d9b65){if(_0x3d9b65){var _0x57886f=0xc8;var _0x3a0e44=_0x9fd8('0xaf');logger['info'](_0x9fd8('0x24'),_0x3a0e44,_0x57886f,_0x9fd8('0xb0'));logger[_0x9fd8('0x23')](_0x9fd8('0xb1'),_0x3a0e44,_0x57886f,_0x9fd8('0xb0'),JSON['stringify'](_0x3d9b65));if(_0xf8e3c5['account'][_0x9fd8('0x45')]===_0x9fd8('0x7c')){return _0x5e9255[_0x9fd8('0x2c')](_0x57886f)['set'](_0x9fd8('0xb2'),'text/xml')[_0x9fd8('0x3f')](_0x9fd8('0xb3'));}else{return _0x5e9255[_0x9fd8('0x2c')](_0x57886f)['json'](_0x3d9b65);}}})['catch'](handleError(_0x5e9255,null));};exports[_0x9fd8('0xb4')]=function(_0x253d84,_0xb950bc){var _0x7d1970=_0x253d84['params']['id'];var _0x50d0d0=_0x253d84[_0x9fd8('0x60')];var _0x258f37=0xc8;var _0xe58297=null;return db[_0x9fd8('0xb5')]['transaction']({'isolationLevel':db[_0x9fd8('0xb5')][_0x9fd8('0xb6')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x1b08c6){return db[_0x9fd8('0x43')][_0x9fd8('0x67')]({'where':{'id':_0x7d1970},'transaction':_0x1b08c6})[_0x9fd8('0x39')](function(_0x36f6ec){if(_0x36f6ec){return db[_0x9fd8('0x70')][_0x9fd8('0x38')]({'where':{'SmsAccountId':_0x7d1970},'transaction':_0x1b08c6})[_0x9fd8('0x39')](function(){var _0x53d814=_['map'](_0x50d0d0,function(_0x474b10){_0x474b10[_0x9fd8('0x69')]=_0x7d1970;return _0x474b10;});return db[_0x9fd8('0x70')][_0x9fd8('0xb7')](_0x53d814,{'transaction':_0x1b08c6});});}else{_0x258f37=0x194;_0xe58297=[];}});})[_0x9fd8('0x39')](function(){if(_0x258f37!==0x194){return db[_0x9fd8('0x70')]['findAndCountAll']({'where':{'SmsAccountId':_0x7d1970},'order':_0x9fd8('0x74')})['then'](function(_0x3a7777){_0xe58297=_0x3a7777;});}})[_0x9fd8('0x2a')](function(_0x4c0097){_0x258f37=0x1f4;logger[_0x9fd8('0x26')](_0x4c0097[_0x9fd8('0x3d')]);if(_0x4c0097[_0x9fd8('0x3e')]){delete _0x4c0097[_0x9fd8('0x3e')];}_0xe58297=_0x4c0097;})[_0x9fd8('0xb8')](function(){if(_0xe58297===null){_0xb950bc[_0x9fd8('0x2b')](_0x258f37);}else{if(_0x258f37===0x1f4){_0xb950bc['status'](_0x258f37)['send'](_0xe58297);}else{_0xb950bc[_0x9fd8('0x2c')](_0x258f37)[_0x9fd8('0x34')](_0xe58297);}}});};exports[_0x9fd8('0xb9')]=function(_0x22ed28,_0x55a7e7,_0x217b0b){var _0x2e56c4={};var _0x52c02f={};var _0x2ac0ca;var _0x31cfc3;return db[_0x9fd8('0x43')]['findOne']({'where':{'id':_0x22ed28[_0x9fd8('0x5b')]['id']}})[_0x9fd8('0x39')](handleEntityNotFound(_0x55a7e7,null))[_0x9fd8('0x39')](function(_0x369d98){if(_0x369d98){_0x2ac0ca=_0x369d98;_0x52c02f[_0x9fd8('0x47')]=_[_0x9fd8('0x49')](db[_0x9fd8('0x70')][_0x9fd8('0x44')]);_0x52c02f[_0x9fd8('0x48')]=_[_0x9fd8('0x49')](_0x22ed28[_0x9fd8('0x48')]);_0x52c02f['filters']=_['intersection'](_0x52c02f[_0x9fd8('0x47')],_0x52c02f[_0x9fd8('0x48')]);_0x2e56c4[_0x9fd8('0x4c')]=_[_0x9fd8('0x4b')](_0x52c02f[_0x9fd8('0x47')],qs[_0x9fd8('0x4d')](_0x22ed28[_0x9fd8('0x48')][_0x9fd8('0x4d')]));_0x2e56c4['attributes']=_0x2e56c4[_0x9fd8('0x4c')][_0x9fd8('0x5c')]?_0x2e56c4[_0x9fd8('0x4c')]:_0x52c02f[_0x9fd8('0x47')];_0x2e56c4['order']=qs[_0x9fd8('0x51')](_0x22ed28[_0x9fd8('0x48')]['sort']);_0x2e56c4[_0x9fd8('0x52')]=qs[_0x9fd8('0x4a')](_[_0x9fd8('0x53')](_0x22ed28['query'],_0x52c02f[_0x9fd8('0x4a')]));if(_0x22ed28[_0x9fd8('0x48')][_0x9fd8('0x56')]){_0x2e56c4[_0x9fd8('0x52')]=_['merge'](_0x2e56c4[_0x9fd8('0x52')],{'$or':_[_0x9fd8('0x42')](_0x2e56c4['attributes'],function(_0x41632e){var _0x5d29cf={};_0x5d29cf[_0x41632e]={'$like':'%'+_0x22ed28[_0x9fd8('0x48')][_0x9fd8('0x56')]+'%'};return _0x5d29cf;})});}_0x2e56c4=_['merge']({},_0x2e56c4,_0x22ed28[_0x9fd8('0x5d')]);return _0x2ac0ca[_0x9fd8('0xb9')](_0x2e56c4);}})[_0x9fd8('0x39')](function(_0x2367ac){if(_0x2367ac){_0x31cfc3=_0x2367ac['length'];if(!_0x22ed28[_0x9fd8('0x48')]['hasOwnProperty'](_0x9fd8('0x4f'))){_0x2e56c4[_0x9fd8('0x30')]=qs[_0x9fd8('0x30')](_0x22ed28[_0x9fd8('0x48')][_0x9fd8('0x30')]);_0x2e56c4[_0x9fd8('0x2e')]=qs['offset'](_0x22ed28[_0x9fd8('0x48')]['offset']);}return _0x2ac0ca[_0x9fd8('0xb9')](_0x2e56c4);}})[_0x9fd8('0x39')](function(_0x1dc03e){if(_0x1dc03e){return _0x1dc03e?{'count':_0x31cfc3,'rows':_0x1dc03e}:null;}})[_0x9fd8('0x39')](respondWithResult(_0x55a7e7,null))[_0x9fd8('0x2a')](handleError(_0x55a7e7,null));};exports[_0x9fd8('0xba')]=function(_0x2c17dd,_0x12052f,_0x1758c9){var _0x402cc8={'raw':![],'where':{}};var _0x417ab5={};var _0x3277cb={'count':0x0,'rows':[]};return db[_0x9fd8('0x43')]['findOne']({'where':{'id':_0x2c17dd[_0x9fd8('0x5b')]['id']}})[_0x9fd8('0x39')](handleEntityNotFound(_0x12052f,null))[_0x9fd8('0x39')](function(_0x360489){if(_0x360489){_0x417ab5[_0x9fd8('0x47')]=_['keys'](db[_0x9fd8('0x9e')][_0x9fd8('0x44')]);_0x417ab5[_0x9fd8('0x48')]=_[_0x9fd8('0x49')](_0x2c17dd[_0x9fd8('0x48')]);_0x417ab5[_0x9fd8('0x4a')]=_[_0x9fd8('0x4b')](_0x417ab5[_0x9fd8('0x47')],_0x417ab5[_0x9fd8('0x48')]);_0x402cc8['attributes']=_[_0x9fd8('0x4b')](_0x417ab5[_0x9fd8('0x47')],qs[_0x9fd8('0x4d')](_0x2c17dd[_0x9fd8('0x48')][_0x9fd8('0x4d')]));_0x402cc8[_0x9fd8('0x4c')]=_0x402cc8[_0x9fd8('0x4c')][_0x9fd8('0x5c')]?_0x402cc8[_0x9fd8('0x4c')]:_0x417ab5[_0x9fd8('0x47')];if(!_0x2c17dd[_0x9fd8('0x48')][_0x9fd8('0x4e')](_0x9fd8('0x4f'))){_0x402cc8['limit']=qs[_0x9fd8('0x30')](_0x2c17dd[_0x9fd8('0x48')][_0x9fd8('0x30')]);_0x402cc8[_0x9fd8('0x2e')]=qs[_0x9fd8('0x2e')](_0x2c17dd[_0x9fd8('0x48')][_0x9fd8('0x2e')]);}_0x402cc8['order']=qs[_0x9fd8('0x51')](_0x2c17dd[_0x9fd8('0x48')]['sort']);_0x402cc8['where']=qs[_0x9fd8('0x4a')](_['pick'](_0x2c17dd[_0x9fd8('0x48')],_0x417ab5[_0x9fd8('0x4a')]));_0x402cc8[_0x9fd8('0x52')][_0x9fd8('0x69')]=_0x360489['id'];if(_0x2c17dd['query'][_0x9fd8('0x56')]){_0x402cc8[_0x9fd8('0x52')]=_[_0x9fd8('0x54')](_0x402cc8[_0x9fd8('0x52')],{'$or':_[_0x9fd8('0x42')](_0x402cc8[_0x9fd8('0x4c')],function(_0x3a2137){var _0x2bd6ef={};_0x2bd6ef[_0x3a2137]={'$like':'%'+_0x2c17dd[_0x9fd8('0x48')][_0x9fd8('0x56')]+'%'};return _0x2bd6ef;})});}_0x402cc8=_[_0x9fd8('0x54')]({},_0x402cc8,_0x2c17dd[_0x9fd8('0x5d')]);return db[_0x9fd8('0x9e')][_0x9fd8('0x31')]({'where':_0x402cc8[_0x9fd8('0x52')]})[_0x9fd8('0x39')](function(_0x5a7aa0){_0x3277cb[_0x9fd8('0x31')]=_0x5a7aa0;if(_0x2c17dd[_0x9fd8('0x48')][_0x9fd8('0x57')]){_0x402cc8[_0x9fd8('0x58')]=[{'model':db[_0x9fd8('0x75')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x9fd8('0xbb'),'attributes':[_0x9fd8('0x3e'),_0x9fd8('0xbc'),'internal'],'required':![]},{'model':db[_0x9fd8('0xbd')],'as':'Tags','attributes':['id',_0x9fd8('0x3e'),_0x9fd8('0xbe')],'where':_0x2c17dd[_0x9fd8('0x48')]['tag']?{'id':_0x2c17dd[_0x9fd8('0x48')][_0x9fd8('0xbf')]}:undefined,'required':_0x2c17dd[_0x9fd8('0x48')][_0x9fd8('0xbf')]?!![]:![]}];}return db['SmsInteraction'][_0x9fd8('0x59')](_0x402cc8);})[_0x9fd8('0x39')](function(_0x8d0abf){_0x3277cb['rows']=_0x8d0abf;return _0x3277cb;});}})[_0x9fd8('0x39')](respondWithFilteredResult(_0x12052f,_0x402cc8))[_0x9fd8('0x2a')](handleError(_0x12052f,null));};exports[_0x9fd8('0x3f')]=function(_0x54bec6,_0x14d0a3,_0x34c561){var _0x41f666,_0x565332,_0x43bc0f;if(_['isNil'](_0x54bec6[_0x9fd8('0x60')][_0x9fd8('0x60')])||_0x54bec6[_0x9fd8('0x60')][_0x9fd8('0x60')]===''){throw new db[(_0x9fd8('0x76'))][(_0x9fd8('0x77'))](_0x9fd8('0x95'));}if(_['isNil'](_0x54bec6[_0x9fd8('0x60')]['to'])){throw new db[(_0x9fd8('0x76'))][(_0x9fd8('0x77'))]('to\x20is\x20mandatory');}_0x41f666=_0x54bec6['body']['to'];return db[_0x9fd8('0x43')]['find']({'where':{'id':_0x54bec6[_0x9fd8('0x5b')]['id']},'include':[{'model':db['CmList'],'as':_0x9fd8('0xc0'),'include':[{'model':db[_0x9fd8('0x75')],'as':'Contacts','where':{'mobile':_0x41f666},'limit':0x1,'order':[[_0x9fd8('0x79'),_0x9fd8('0x9b')]]}]}]})[_0x9fd8('0x39')](handleEntityNotFound(_0x14d0a3,null))[_0x9fd8('0x39')](function(_0x1b17c1){if(_0x1b17c1&&_0x1b17c1['List']){_0x565332=_0x1b17c1[_0x9fd8('0x3a')]({'plain':!![]});if(_0x565332[_0x9fd8('0xc0')]&&_0x565332[_0x9fd8('0xc0')][_0x9fd8('0x9a')]['length']){return _0x565332[_0x9fd8('0xc0')][_0x9fd8('0x9a')][0x0];}return db[_0x9fd8('0x75')][_0x9fd8('0x5f')](_[_0x9fd8('0x19')](_0x54bec6[_0x9fd8('0x60')],{'firstName':_0x41f666,'mobile':_0x41f666,'phone':_0x41f666,'ListId':_0x565332[_0x9fd8('0x99')]}));}})['then'](handleEntityNotFound(_0x14d0a3,null))['then'](function(_0x4f528f){if(_0x4f528f){_0x43bc0f=_0x4f528f;return db['SmsInteraction'][_0x9fd8('0x5e')]({'where':{'ContactId':_0x43bc0f['id'],'closed':![],'SmsAccountId':_0x565332['id']}})['then'](function(_0x22034f){if(_0x22034f){return[_0x22034f,![]];}return db['SmsInteraction']['create']({'UserId':_0x54bec6[_0x9fd8('0x61')]['id'],'ContactId':_0x43bc0f['id'],'SmsAccountId':_0x565332['id'],'phone':_0x41f666,'firstMsgDirection':'out','Messages':[_[_0x9fd8('0x54')](_0x54bec6[_0x9fd8('0x60')],{'read':![],'body':_0x54bec6[_0x9fd8('0x60')][_0x9fd8('0x60')],'phone':_0x41f666,'SmsAccountId':_0x565332['id'],'UserId':_0x54bec6['user']['id'],'ContactId':_0x43bc0f['id']})]},{'include':[{'model':db[_0x9fd8('0xc1')],'as':_0x9fd8('0xc2')}]})['then'](function(_0x574ca4){return[_0x574ca4,!![]];});});}})[_0x9fd8('0x9f')](function(_0x3bbb8a,_0x80ad68){if(_0x80ad68){return _0x3bbb8a;}return db[_0x9fd8('0xc1')]['create'](_['merge'](_0x54bec6['body'],{'read':![],'body':_0x54bec6[_0x9fd8('0x60')][_0x9fd8('0x60')],'phone':_0x41f666,'SmsAccountId':_0x565332['id'],'SmsInteractionId':_0x3bbb8a['id'],'UserId':_0x54bec6[_0x9fd8('0x61')]['id'],'ContactId':_0x43bc0f['id']}))['then'](function(_0xb637d1){_0x3bbb8a[_0x9fd8('0xc3')][_0x9fd8('0xc2')]=[];_0x3bbb8a[_0x9fd8('0xc3')]['Messages'][_0x9fd8('0xa4')](_0xb637d1[_0x9fd8('0xc3')]);return _0x3bbb8a;});})['then'](respondWithResult(_0x14d0a3,null))[_0x9fd8('0x2a')](handleError(_0x14d0a3,null));};exports[_0x9fd8('0x2c')]=function(_0x3c2ef5,_0x54f4a4,_0x5c854f){if(_0x3c2ef5['body']['id']){delete _0x3c2ef5[_0x9fd8('0x60')]['id'];}var _0x4233d7,_0x26b904,_0x691bd3;return db['SmsAccount'][_0x9fd8('0x5e')]({'where':{'id':_0x3c2ef5[_0x9fd8('0x5b')]['id']}})[_0x9fd8('0x39')](handleEntityNotFound(_0x54f4a4,null))['then'](function(_0x441532){if(_0x441532){_0x691bd3=_0x441532;logger['debug'](_0x9fd8('0x24'),'status',_0x9fd8('0xc4'),_0x441532['type'],util['inspect'](_0x3c2ef5[_0x9fd8('0x60')],{'showHidden':![],'depth':null}));switch(_0x441532[_0x9fd8('0x45')]){case'skebby':if(_0x3c2ef5[_0x9fd8('0x60')]['skebby_dispatch_id']&&_0x3c2ef5[_0x9fd8('0x60')]['status']){_0x26b904=_0x3c2ef5[_0x9fd8('0x60')][_0x9fd8('0x2c')];return db['SmsMessage'][_0x9fd8('0x5e')]({'where':{'messageId':_0x3c2ef5[_0x9fd8('0x60')][_0x9fd8('0xc5')]}});}break;case _0x9fd8('0x84'):if(_0x3c2ef5[_0x9fd8('0x60')][_0x9fd8('0xc6')]&&_0x3c2ef5[_0x9fd8('0x60')][_0x9fd8('0xc7')]){_0x26b904=_0x3c2ef5[_0x9fd8('0x60')][_0x9fd8('0xc7')];return db[_0x9fd8('0xc1')][_0x9fd8('0x5e')]({'where':{'messageId':_0x3c2ef5[_0x9fd8('0x60')][_0x9fd8('0xc6')]}});}break;case _0x9fd8('0x85'):if(_0x3c2ef5[_0x9fd8('0x60')][_0x9fd8('0x86')]&&_0x3c2ef5[_0x9fd8('0x60')][_0x9fd8('0xc8')]){_0x26b904=_0x3c2ef5['body'][_0x9fd8('0xc8')];return db['SmsMessage'][_0x9fd8('0x5e')]({'where':{'messageId':_0x3c2ef5[_0x9fd8('0x60')][_0x9fd8('0x86')]}});}break;case _0x9fd8('0x8a'):var _0x4823e4=_0x3c2ef5[_0x9fd8('0x60')][_0x9fd8('0x8b')][0x0];if(_0x4823e4[_0x9fd8('0x80')]&&_0x4823e4[_0x9fd8('0x2c')][_0x9fd8('0xc9')]===_0x9fd8('0xca')){_0x26b904=_0x4823e4[_0x9fd8('0x2c')]['groupName'];return db[_0x9fd8('0xc1')]['find']({'where':{'messageId':_0x4823e4['messageId']}});}break;case _0x9fd8('0x8f'):if(_0x3c2ef5[_0x9fd8('0x60')][_0x9fd8('0x80')]&&_0x3c2ef5[_0x9fd8('0x60')][_0x9fd8('0x2c')]){_0x26b904=_0x3c2ef5[_0x9fd8('0x60')]['status'];return db[_0x9fd8('0xc1')][_0x9fd8('0x5e')]({'where':{'messageId':_0x3c2ef5[_0x9fd8('0x60')][_0x9fd8('0x80')]}});}break;case _0x9fd8('0x92'):if(_0x3c2ef5[_0x9fd8('0x60')][0x0]['message']['id']){_0x26b904=_0x3c2ef5[_0x9fd8('0x60')][0x0]['type'];return db[_0x9fd8('0xc1')]['find']({'where':{'messageId':_0x3c2ef5[_0x9fd8('0x60')][0x0][_0x9fd8('0x28')]['id']}});}break;case _0x9fd8('0xcb'):if(_0x3c2ef5['body'][_0x9fd8('0xcc')]&&_0x3c2ef5[_0x9fd8('0x60')]['status']){_0x26b904=_0x3c2ef5[_0x9fd8('0x60')][_0x9fd8('0x2c')];return db[_0x9fd8('0xc1')][_0x9fd8('0x5e')]({'where':{'messageId':_0x3c2ef5['body']['redif']}});}break;}}})['then'](handleEntityNotFound(_0x54f4a4,null))[_0x9fd8('0x39')](function(_0x140a33){if(_0x140a33){_0x4233d7=_0x140a33;switch(_0x691bd3[_0x9fd8('0x45')]){case _0x9fd8('0x81'):if(_0x26b904===_0x9fd8('0xca')){return _0x4233d7[_0x9fd8('0x37')]({'read':!![]});}else{logger['error'](_0x9fd8('0x24'),'status',_0x9fd8('0x81'),util[_0x9fd8('0xcd')](_0x3c2ef5['body'],{'showHidden':![],'depth':null}));}break;case _0x9fd8('0x84'):if(_0x26b904==='1'){return _0x4233d7[_0x9fd8('0x37')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9fd8('0x2c'),_0x9fd8('0x81'),util['inspect'](_0x3c2ef5['body'],{'showHidden':![],'depth':null}));}break;case _0x9fd8('0x85'):if(!_0x3c2ef5[_0x9fd8('0x60')][_0x9fd8('0xce')]&&_0x26b904>=0xc8&&_0x26b904<=0xce){return _0x4233d7['update']({'read':!![]});}else{logger[_0x9fd8('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x9fd8('0x85'),util[_0x9fd8('0xcd')](_0x3c2ef5[_0x9fd8('0x60')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x2762ed=_0x3c2ef5['body'][_0x9fd8('0x8b')][0x0];if(_0x2762ed['status'][_0x9fd8('0xc9')]===_0x9fd8('0xca')){return _0x4233d7[_0x9fd8('0x37')]({'read':!![]});}else{logger[_0x9fd8('0x26')](_0x9fd8('0x24'),_0x9fd8('0x2c'),'infobip',util[_0x9fd8('0xcd')](_0x3c2ef5[_0x9fd8('0x60')],{'showHidden':![],'depth':null}));}break;case _0x9fd8('0x8f'):if(_0x26b904==_0x9fd8('0xcf')||_0x26b904==_0x9fd8('0xd0')){return _0x4233d7['update']({'read':!![]});}else{logger['error'](_0x9fd8('0x24'),_0x9fd8('0x2c'),'clickatell',util[_0x9fd8('0xcd')](_0x3c2ef5[_0x9fd8('0x60')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x26b904==_0x9fd8('0xd1')){return _0x4233d7[_0x9fd8('0x37')]({'read':!![]});}else{logger[_0x9fd8('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x9fd8('0x92'),util[_0x9fd8('0xcd')](_0x3c2ef5[_0x9fd8('0x60')],{'showHidden':![],'depth':null}));}break;case _0x9fd8('0xcb'):if(_0x26b904===_0x9fd8('0xd2')||_0x26b904===_0x9fd8('0xd3')){return _0x4233d7[_0x9fd8('0x37')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x9fd8('0xcb'),util[_0x9fd8('0xcd')](_0x3c2ef5[_0x9fd8('0x60')],{'showHidden':![],'depth':null}));}break;}return _0x4233d7;}})[_0x9fd8('0x39')](respondWithResult(_0x54f4a4,null))[_0x9fd8('0x2a')](handleError(_0x54f4a4,null));};exports[_0x9fd8('0xd4')]=function(_0x4d9a5a,_0x59171a,_0x57f057){var _0x1667dd,_0x50f0f0,_0x296312;return db[_0x9fd8('0x43')]['find']({'where':{'id':_0x4d9a5a[_0x9fd8('0x5b')]['id']}})[_0x9fd8('0x39')](handleEntityNotFound(_0x59171a,null))['then'](function(_0x56af55){if(_0x56af55){_0x296312=_0x56af55;logger['debug'](_0x9fd8('0x24'),_0x9fd8('0x2c'),_0x9fd8('0xc4'),_0x56af55[_0x9fd8('0x45')],util['inspect'](_0x4d9a5a[_0x9fd8('0x48')],{'showHidden':![],'depth':null}));switch(_0x56af55[_0x9fd8('0x45')]){case'csc':if(_0x4d9a5a[_0x9fd8('0x48')][_0x9fd8('0xd5')]&&_0x4d9a5a[_0x9fd8('0x48')][_0x9fd8('0xd6')]){_0x50f0f0=_0x4d9a5a[_0x9fd8('0x48')][_0x9fd8('0xd6')];return db[_0x9fd8('0xc1')][_0x9fd8('0x5e')]({'where':{'messageId':_0x4d9a5a[_0x9fd8('0x48')]['message-id']}});}break;}}})['then'](handleEntityNotFound(_0x59171a,null))[_0x9fd8('0x39')](function(_0xe284ef){if(_0xe284ef){_0x1667dd=_0xe284ef;switch(_0x296312[_0x9fd8('0x45')]){case _0x9fd8('0x8c'):if(_0x50f0f0==='2'||_0x50f0f0==='6'){return _0x1667dd[_0x9fd8('0x37')]({'read':!![]});}else{logger[_0x9fd8('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','csc',util['inspect'](_0x4d9a5a[_0x9fd8('0x48')],{'showHidden':![],'depth':null}));};break;}return _0x1667dd;}})[_0x9fd8('0x39')](respondWithResult(_0x59171a,null))[_0x9fd8('0x2a')](handleError(_0x59171a,null));};exports['addAgents']=function(_0x5c21f3,_0x549e67,_0x4c07fa){return db[_0x9fd8('0x43')][_0x9fd8('0x5e')]({'where':{'id':_0x5c21f3['params']['id']}})[_0x9fd8('0x39')](handleEntityNotFound(_0x549e67,null))[_0x9fd8('0x39')](function(_0x48334d){if(_0x48334d){return _0x48334d[_0x9fd8('0xd7')](_0x5c21f3[_0x9fd8('0x60')][_0x9fd8('0x6b')],_[_0x9fd8('0x9d')](_0x5c21f3['body'],[_0x9fd8('0x6b'),'id'])||{})[_0x9fd8('0x9f')](function(_0x3e0f80){for(var _0x14733c=0x0;_0x14733c<_0x5c21f3[_0x9fd8('0x60')]['ids'][_0x9fd8('0x5c')];_0x14733c+=0x1){socket['emit']('userSmsAccount:save',{'UserId':Number(_0x5c21f3['body'][_0x9fd8('0x6b')][_0x14733c]),'SmsAccountId':Number(_0x5c21f3['params']['id'])});}return _0x3e0f80;});}})[_0x9fd8('0x39')](respondWithResult(_0x549e67,null))[_0x9fd8('0x2a')](handleError(_0x549e67,null));};exports[_0x9fd8('0xd8')]=function(_0x54b431,_0x5092e0,_0x3f0f1e){return db[_0x9fd8('0x43')][_0x9fd8('0x5e')]({'where':{'id':_0x54b431['params']['id']}})[_0x9fd8('0x39')](handleEntityNotFound(_0x5092e0,null))[_0x9fd8('0x39')](function(_0x20c749){if(_0x20c749){return _0x20c749[_0x9fd8('0xd8')](_0x54b431[_0x9fd8('0x48')][_0x9fd8('0x6b')])[_0x9fd8('0x39')](function(){if(_[_0x9fd8('0xd9')](_0x54b431['query'][_0x9fd8('0x6b')])){for(var _0x86af47=0x0;_0x86af47<_0x54b431[_0x9fd8('0x48')][_0x9fd8('0x6b')][_0x9fd8('0x5c')];_0x86af47+=0x1){socket[_0x9fd8('0xda')](_0x9fd8('0xdb'),{'UserId':Number(_0x54b431['query'][_0x9fd8('0x6b')][_0x86af47]),'SmsAccountId':Number(_0x54b431[_0x9fd8('0x5b')]['id'])});}}else{socket[_0x9fd8('0xda')](_0x9fd8('0xdb'),{'UserId':Number(_0x54b431[_0x9fd8('0x48')]['ids']),'SmsAccountId':Number(_0x54b431['params']['id'])});}});}})[_0x9fd8('0x39')](respondWithStatusCode(_0x5092e0,null))[_0x9fd8('0x2a')](handleError(_0x5092e0,null));};exports[_0x9fd8('0xdc')]=function(_0x243b5c,_0x39df19,_0x238c0b){var _0xf64038={};var _0x500911={};var _0x582d3c;var _0x37e223;return db['SmsAccount']['findOne']({'where':{'id':_0x243b5c['params']['id']}})[_0x9fd8('0x39')](handleEntityNotFound(_0x39df19,null))[_0x9fd8('0x39')](function(_0x26a7f2){if(_0x26a7f2){_0x582d3c=_0x26a7f2;_0x500911[_0x9fd8('0x47')]=_[_0x9fd8('0x49')](db[_0x9fd8('0xa8')][_0x9fd8('0x44')]);_0x500911['query']=_[_0x9fd8('0x49')](_0x243b5c[_0x9fd8('0x48')]);_0x500911[_0x9fd8('0x4a')]=_[_0x9fd8('0x4b')](_0x500911['model'],_0x500911[_0x9fd8('0x48')]);_0xf64038[_0x9fd8('0x4c')]=_[_0x9fd8('0x4b')](_0x500911[_0x9fd8('0x47')],qs[_0x9fd8('0x4d')](_0x243b5c[_0x9fd8('0x48')][_0x9fd8('0x4d')]));_0xf64038[_0x9fd8('0x4c')]=_0xf64038['attributes']['length']?_0xf64038['attributes']:_0x500911[_0x9fd8('0x47')];_0xf64038[_0x9fd8('0x50')]=qs['sort'](_0x243b5c[_0x9fd8('0x48')][_0x9fd8('0x51')]);_0xf64038['where']=qs['filters'](_[_0x9fd8('0x53')](_0x243b5c['query'],_0x500911[_0x9fd8('0x4a')]));if(_0x243b5c[_0x9fd8('0x48')][_0x9fd8('0x56')]){_0xf64038[_0x9fd8('0x52')]=_[_0x9fd8('0x54')](_0xf64038[_0x9fd8('0x52')],{'$or':_[_0x9fd8('0x42')](_0xf64038[_0x9fd8('0x4c')],function(_0x4e17ad){var _0x54162e={};_0x54162e[_0x4e17ad]={'$like':'%'+_0x243b5c[_0x9fd8('0x48')][_0x9fd8('0x56')]+'%'};return _0x54162e;})});}_0xf64038=_[_0x9fd8('0x54')]({},_0xf64038,_0x243b5c[_0x9fd8('0x5d')]);return _0x582d3c[_0x9fd8('0xdc')](_0xf64038);}})[_0x9fd8('0x39')](function(_0x51e1c2){if(_0x51e1c2){_0x37e223=_0x51e1c2[_0x9fd8('0x5c')];if(!_0x243b5c[_0x9fd8('0x48')]['hasOwnProperty'](_0x9fd8('0x4f'))){_0xf64038['limit']=qs[_0x9fd8('0x30')](_0x243b5c[_0x9fd8('0x48')][_0x9fd8('0x30')]);_0xf64038['offset']=qs[_0x9fd8('0x2e')](_0x243b5c[_0x9fd8('0x48')][_0x9fd8('0x2e')]);}return _0x582d3c[_0x9fd8('0xdc')](_0xf64038);}})[_0x9fd8('0x39')](function(_0x57dbe3){if(_0x57dbe3){return _0x57dbe3?{'count':_0x37e223,'rows':_0x57dbe3}:null;}})['then'](respondWithResult(_0x39df19,null))['catch'](handleError(_0x39df19,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 19fe5d4..ea7e808 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 _0xa3b4=['save','update','emit','exports','SmsAccount','setMaxListeners'];(function(_0x32b588,_0x176408){var _0x57529c=function(_0x3a5106){while(--_0x3a5106){_0x32b588['push'](_0x32b588['shift']());}};_0x57529c(++_0x176408);}(_0xa3b4,0x12a));var _0x4a3b=function(_0x5d2a8e,_0x134aff){_0x5d2a8e=_0x5d2a8e-0x0;var _0x20749d=_0xa3b4[_0x5d2a8e];return _0x20749d;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db'][_0x4a3b('0x0')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x4a3b('0x1')](0x0);var events={'afterCreate':_0x4a3b('0x2'),'afterUpdate':_0x4a3b('0x3'),'afterDestroy':'remove'};function emitEvent(_0xf85756){return function(_0xf5faea,_0x3a846b,_0x1e09e0){SmsAccountEvents[_0x4a3b('0x4')](_0xf85756+':'+_0xf5faea['id'],_0xf5faea);SmsAccountEvents[_0x4a3b('0x4')](_0xf85756,_0xf5faea);_0x1e09e0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x4a3b('0x5')]=SmsAccountEvents; \ No newline at end of file +var _0xe19e=['setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xe19e,0xc3));var _0xee19=function(_0x59398a,_0x2241ad){_0x59398a=_0x59398a-0x0;var _0xacae73=_0xe19e[_0x59398a];return _0xacae73;};'use strict';var EventEmitter=require(_0xee19('0x0'));var SmsAccount=require(_0xee19('0x1'))['db'][_0xee19('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xee19('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xee19('0x4'),'afterDestroy':'remove'};function emitEvent(_0x412491){return function(_0x38b2d9,_0x396d15,_0x1ba55c){SmsAccountEvents[_0xee19('0x5')](_0x412491+':'+_0x38b2d9['id'],_0x38b2d9);SmsAccountEvents[_0xee19('0x5')](_0x412491,_0x38b2d9);_0x1ba55c(null);};}for(var e in events){if(events[_0xee19('0x6')](e)){var event=events[e];SmsAccount[_0xee19('0x7')](e,emitEvent(event));}}module[_0xee19('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 7f4f371..79d1445 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 _0x99ff=['./smsAccount.attributes','exports','define','sms_accounts','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4b8417,_0x3575d1){var _0x2a0a6a=function(_0x142d70){while(--_0x142d70){_0x4b8417['push'](_0x4b8417['shift']());}};_0x2a0a6a(++_0x3575d1);}(_0x99ff,0xf6));var _0xf99f=function(_0x44fc33,_0x480283){_0x44fc33=_0x44fc33-0x0;var _0x1e64a1=_0x99ff[_0x44fc33];return _0x1e64a1;};'use strict';var _=require(_0xf99f('0x0'));var util=require(_0xf99f('0x1'));var logger=require('../../config/logger')(_0xf99f('0x2'));var moment=require('moment');var BPromise=require(_0xf99f('0x3'));var rp=require(_0xf99f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf99f('0x5'));var config=require(_0xf99f('0x6'));var attributes=require(_0xf99f('0x7'));module[_0xf99f('0x8')]=function(_0x152544,_0x25a1eb){return _0x152544[_0xf99f('0x9')]('SmsAccount',attributes,{'tableName':_0xf99f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd44f=['../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x2a9635,_0x430e20){var _0x485662=function(_0x1d9800){while(--_0x1d9800){_0x2a9635['push'](_0x2a9635['shift']());}};_0x485662(++_0x430e20);}(_0xd44f,0x18c));var _0xfd44=function(_0xe37cad,_0x9fcbdd){_0xe37cad=_0xe37cad-0x0;var _0x24593e=_0xd44f[_0xe37cad];return _0x24593e;};'use strict';var _=require(_0xfd44('0x0'));var util=require(_0xfd44('0x1'));var logger=require('../../config/logger')(_0xfd44('0x2'));var moment=require(_0xfd44('0x3'));var BPromise=require(_0xfd44('0x4'));var rp=require(_0xfd44('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfd44('0x6'));var config=require(_0xfd44('0x7'));var attributes=require(_0xfd44('0x8'));module[_0xfd44('0x9')]=function(_0x1c126a,_0x5dff8a){return _0x1c126a[_0xfd44('0xa')](_0xfd44('0xb'),attributes,{'tableName':_0xfd44('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 0847e65..5446789 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 _0xee0d=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','include','attributes','map','model','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x284b22,_0x1e0f2c){var _0x261e08=function(_0x167b12){while(--_0x167b12){_0x284b22['push'](_0x284b22['shift']());}};_0x261e08(++_0x1e0f2c);}(_0xee0d,0x109));var _0xdee0=function(_0x1c3680,_0x2671ab){_0x1c3680=_0x1c3680-0x0;var _0x39c687=_0xee0d[_0x1c3680];return _0x39c687;};'use strict';var _=require(_0xdee0('0x0'));var util=require(_0xdee0('0x1'));var moment=require(_0xdee0('0x2'));var BPromise=require('bluebird');var rs=require(_0xdee0('0x3'));var fs=require('fs');var Redis=require(_0xdee0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdee0('0x5'));var logger=require('../../config/logger')(_0xdee0('0x6'));var config=require(_0xdee0('0x7'));var jayson=require(_0xdee0('0x8'));var client=jayson[_0xdee0('0x9')][_0xdee0('0xa')]({'port':0x232a});config[_0xdee0('0xb')]=_[_0xdee0('0xc')](config[_0xdee0('0xb')],{'host':_0xdee0('0xd'),'port':0x18eb});var socket=require(_0xdee0('0xe'))(new Redis(config['redis']));require(_0xdee0('0xf'))[_0xdee0('0x10')](socket);function respondWithRpcPromise(_0x1a3953,_0x161baa,_0x121e9f){return new BPromise(function(_0x1e161d,_0x48d890){return client[_0xdee0('0x11')](_0x1a3953,_0x121e9f)[_0xdee0('0x12')](function(_0x53e962){logger[_0xdee0('0x13')](_0xdee0('0x14'),_0x161baa,_0xdee0('0x15'));logger[_0xdee0('0x16')](_0xdee0('0x17'),_0x161baa,_0xdee0('0x15'),JSON[_0xdee0('0x18')](_0x53e962));if(_0x53e962[_0xdee0('0x19')]){if(_0x53e962[_0xdee0('0x19')][_0xdee0('0x1a')]===0x1f4){logger[_0xdee0('0x19')](_0xdee0('0x14'),_0x161baa,_0x53e962[_0xdee0('0x19')][_0xdee0('0x1b')]);return _0x48d890(_0x53e962[_0xdee0('0x19')]['message']);}logger[_0xdee0('0x19')](_0xdee0('0x14'),_0x161baa,_0x53e962['error'][_0xdee0('0x1b')]);return _0x1e161d(_0x53e962[_0xdee0('0x19')]['message']);}else{logger[_0xdee0('0x13')](_0xdee0('0x14'),_0x161baa,_0xdee0('0x15'));_0x1e161d(_0x53e962[_0xdee0('0x1c')]['message']);}})[_0xdee0('0x1d')](function(_0x50b73b){logger[_0xdee0('0x19')](_0xdee0('0x14'),_0x161baa,_0x50b73b);_0x48d890(_0x50b73b);});});}exports[_0xdee0('0x1e')]=function(_0x5f2c55){var _0x50d5bf=this;return new Promise(function(_0x46f83d,_0x211766){return db[_0xdee0('0x1f')][_0xdee0('0x20')]({'raw':_0x5f2c55[_0xdee0('0x21')]?_0x5f2c55[_0xdee0('0x21')][_0xdee0('0x22')]===undefined?!![]:![]:!![],'where':_0x5f2c55['options']?_0x5f2c55[_0xdee0('0x21')]['where']||null:null,'attributes':_0x5f2c55['options']?_0x5f2c55[_0xdee0('0x21')]['attributes']||null:null,'include':_0x5f2c55[_0xdee0('0x21')]?_0x5f2c55['options'][_0xdee0('0x23')]?_['map'](_0x5f2c55[_0xdee0('0x21')][_0xdee0('0x23')],function(_0x14bd4d){return{'model':db[_0x14bd4d['model']],'as':_0x14bd4d['as'],'attributes':_0x14bd4d[_0xdee0('0x24')],'include':_0x14bd4d['include']?_[_0xdee0('0x25')](_0x14bd4d['include'],function(_0x4f13c6){return{'model':db[_0x4f13c6['model']],'as':_0x4f13c6['as'],'attributes':_0x4f13c6['attributes'],'include':_0x4f13c6[_0xdee0('0x23')]?_[_0xdee0('0x25')](_0x4f13c6[_0xdee0('0x23')],function(_0x3b9a89){return{'model':db[_0x3b9a89[_0xdee0('0x26')]],'as':_0x3b9a89['as'],'attributes':_0x3b9a89['attributes']};}):[]};}):[]};}):[]:[]})[_0xdee0('0x12')](function(_0x4241b5){logger[_0xdee0('0x13')]('ShowSmsAccount',_0x5f2c55);logger[_0xdee0('0x16')](_0xdee0('0x1e'),_0x5f2c55,JSON['stringify'](_0x4241b5));_0x46f83d(_0x4241b5);})[_0xdee0('0x1d')](function(_0x336f50){logger[_0xdee0('0x19')](_0xdee0('0x1e'),_0x336f50[_0xdee0('0x1b')],_0x5f2c55);_0x211766(_0x50d5bf[_0xdee0('0x19')](0x1f4,_0x336f50[_0xdee0('0x1b')]));});});}; \ No newline at end of file +var _0x8591=['SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','map','include','model','then','debug','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','./smsAccount.socket','request','info','SmsAccount,\x20%s,\x20%s'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x8591,0x80));var _0x1859=function(_0x1813cb,_0x27bf53){_0x1813cb=_0x1813cb-0x0;var _0x30ab0b=_0x8591[_0x1813cb];return _0x30ab0b;};'use strict';var _=require('lodash');var util=require(_0x1859('0x0'));var moment=require(_0x1859('0x1'));var BPromise=require(_0x1859('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1859('0x3'));var db=require(_0x1859('0x4'))['db'];var utils=require(_0x1859('0x5'));var logger=require(_0x1859('0x6'))(_0x1859('0x7'));var config=require('../../config/environment');var jayson=require(_0x1859('0x8'));var client=jayson['client'][_0x1859('0x9')]({'port':0x232a});config['redis']=_[_0x1859('0xa')](config[_0x1859('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1859('0xc'))['register'](socket);function respondWithRpcPromise(_0x40f5db,_0x1af3fa,_0x4ea253){return new BPromise(function(_0x20e838,_0x13cd6d){return client[_0x1859('0xd')](_0x40f5db,_0x4ea253)['then'](function(_0x87982e){logger[_0x1859('0xe')](_0x1859('0xf'),_0x1af3fa,'request\x20sent');logger['debug'](_0x1859('0x10'),_0x1af3fa,_0x1859('0x11'),JSON[_0x1859('0x12')](_0x87982e));if(_0x87982e['error']){if(_0x87982e['error'][_0x1859('0x13')]===0x1f4){logger[_0x1859('0x14')](_0x1859('0xf'),_0x1af3fa,_0x87982e[_0x1859('0x14')][_0x1859('0x15')]);return _0x13cd6d(_0x87982e['error'][_0x1859('0x15')]);}logger[_0x1859('0x14')](_0x1859('0xf'),_0x1af3fa,_0x87982e['error']['message']);return _0x20e838(_0x87982e[_0x1859('0x14')][_0x1859('0x15')]);}else{logger[_0x1859('0xe')](_0x1859('0xf'),_0x1af3fa,_0x1859('0x11'));_0x20e838(_0x87982e[_0x1859('0x16')][_0x1859('0x15')]);}})[_0x1859('0x17')](function(_0x509eeb){logger[_0x1859('0x14')]('SmsAccount,\x20%s,\x20%s',_0x1af3fa,_0x509eeb);_0x13cd6d(_0x509eeb);});});}exports[_0x1859('0x18')]=function(_0x35c58e){var _0x3c579e=this;return new Promise(function(_0x2a16ec,_0x32243e){return db[_0x1859('0x19')][_0x1859('0x1a')]({'raw':_0x35c58e[_0x1859('0x1b')]?_0x35c58e['options'][_0x1859('0x1c')]===undefined?!![]:![]:!![],'where':_0x35c58e[_0x1859('0x1b')]?_0x35c58e['options'][_0x1859('0x1d')]||null:null,'attributes':_0x35c58e[_0x1859('0x1b')]?_0x35c58e['options'][_0x1859('0x1e')]||null:null,'include':_0x35c58e['options']?_0x35c58e['options']['include']?_[_0x1859('0x1f')](_0x35c58e['options'][_0x1859('0x20')],function(_0x3b53b7){return{'model':db[_0x3b53b7[_0x1859('0x21')]],'as':_0x3b53b7['as'],'attributes':_0x3b53b7[_0x1859('0x1e')],'include':_0x3b53b7[_0x1859('0x20')]?_[_0x1859('0x1f')](_0x3b53b7['include'],function(_0x26c59b){return{'model':db[_0x26c59b[_0x1859('0x21')]],'as':_0x26c59b['as'],'attributes':_0x26c59b['attributes'],'include':_0x26c59b['include']?_[_0x1859('0x1f')](_0x26c59b[_0x1859('0x20')],function(_0x5bf809){return{'model':db[_0x5bf809[_0x1859('0x21')]],'as':_0x5bf809['as'],'attributes':_0x5bf809[_0x1859('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1859('0x22')](function(_0x1e9bbb){logger[_0x1859('0xe')](_0x1859('0x18'),_0x35c58e);logger[_0x1859('0x23')](_0x1859('0x18'),_0x35c58e,JSON[_0x1859('0x12')](_0x1e9bbb));_0x2a16ec(_0x1e9bbb);})[_0x1859('0x17')](function(_0x2dbe2d){logger[_0x1859('0x14')]('ShowSmsAccount',_0x2dbe2d[_0x1859('0x15')],_0x35c58e);_0x32243e(_0x3c579e['error'](0x1f4,_0x2dbe2d[_0x1859('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 61cc010..6c1f3bf 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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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 c818735..dbe4bbd 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(_0x544bd9,_0x4ec40d){var _0x54c740=function(_0x5bb7b6){while(--_0x5bb7b6){_0x544bd9['push'](_0x544bd9['shift']());}};_0x54c740(++_0x4ec40d);}(_0x7217,0x19e));var _0x7721=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x7217[_0x1facfa];return _0x9ec701;};'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 _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x28bea5,_0x4c0c43){var _0x33194c=function(_0x453df2){while(--_0x453df2){_0x28bea5['push'](_0x28bea5['shift']());}};_0x33194c(++_0x4c0c43);}(_0x3e74,0x175));var _0x43e7=function(_0x38e546,_0x4d6cf1){_0x38e546=_0x38e546-0x0;var _0x1e64f0=_0x3e74[_0x38e546];return _0x1e64f0;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index cfb4d2d..d35d6fc 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 _0x209e=['INTEGER','STRING','exports'];(function(_0x43c8b8,_0x5e8934){var _0x413be3=function(_0x23969c){while(--_0x23969c){_0x43c8b8['push'](_0x43c8b8['shift']());}};_0x413be3(++_0x5e8934);}(_0x209e,0x89));var _0xe209=function(_0x1c19a5,_0x18fd78){_0x1c19a5=_0x1c19a5-0x0;var _0x5c783c=_0x209e[_0x1c19a5];return _0x5c783c;};'use strict';var Sequelize=require('sequelize');module[_0xe209('0x0')]={'priority':{'type':Sequelize[_0xe209('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xe209('0x2')]},'interval':{'type':Sequelize[_0xe209('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x7535=['TEXT','STRING','sequelize','exports','INTEGER','noop'];(function(_0x2e1b41,_0x17914a){var _0x163368=function(_0x1b2c7e){while(--_0x1b2c7e){_0x2e1b41['push'](_0x2e1b41['shift']());}};_0x163368(++_0x17914a);}(_0x7535,0x68));var _0x5753=function(_0x1b64dd,_0x2cf769){_0x1b64dd=_0x1b64dd-0x0;var _0xeb464c=_0x7535[_0x1b64dd];return _0xeb464c;};'use strict';var Sequelize=require(_0x5753('0x0'));module[_0x5753('0x1')]={'priority':{'type':Sequelize[_0x5753('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5753('0x3')},'appdata':{'type':Sequelize[_0x5753('0x4')]()},'description':{'type':Sequelize[_0x5753('0x5')]},'interval':{'type':Sequelize[_0x5753('0x5')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index e3eea3a..55b61fd 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 _0xb635=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','SmsApplication','includeAll','include','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0xaca61a,_0xba6ce4){var _0x336db0=function(_0x59d781){while(--_0x59d781){_0xaca61a['push'](_0xaca61a['shift']());}};_0x336db0(++_0xba6ce4);}(_0xb635,0x1bf));var _0x5b63=function(_0x27220f,_0x823162){_0x27220f=_0x27220f-0x0;var _0x4aa5ee=_0xb635[_0x27220f];return _0x4aa5ee;};'use strict';var emlformat=require(_0x5b63('0x0'));var rimraf=require(_0x5b63('0x1'));var zipdir=require(_0x5b63('0x2'));var jsonpatch=require(_0x5b63('0x3'));var rp=require(_0x5b63('0x4'));var moment=require(_0x5b63('0x5'));var BPromise=require(_0x5b63('0x6'));var Mustache=require(_0x5b63('0x7'));var util=require(_0x5b63('0x8'));var path=require(_0x5b63('0x9'));var sox=require(_0x5b63('0xa'));var csv=require(_0x5b63('0xb'));var ejs=require(_0x5b63('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5b63('0xd'));var squel=require(_0x5b63('0xe'));var crypto=require(_0x5b63('0xf'));var jsforce=require(_0x5b63('0x10'));var deskjs=require(_0x5b63('0x11'));var toCsv=require('to-csv');var querystring=require(_0x5b63('0x12'));var Papa=require(_0x5b63('0x13'));var Redis=require(_0x5b63('0x14'));var authService=require(_0x5b63('0x15'));var qs=require(_0x5b63('0x16'));var as=require(_0x5b63('0x17'));var hardwareService=require(_0x5b63('0x18'));var logger=require('../../config/logger')(_0x5b63('0x19'));var utils=require(_0x5b63('0x1a'));var config=require(_0x5b63('0x1b'));var licenseUtil=require(_0x5b63('0x1c'));var db=require(_0x5b63('0x1d'))['db'];function respondWithStatusCode(_0xb5a0b5,_0x1bc27a){_0x1bc27a=_0x1bc27a||0xcc;return function(_0x486bc9){if(_0x486bc9){return _0xb5a0b5[_0x5b63('0x1e')](_0x1bc27a);}return _0xb5a0b5['status'](_0x1bc27a)[_0x5b63('0x1f')]();};}function respondWithResult(_0x57a0af,_0x71dc09){_0x71dc09=_0x71dc09||0xc8;return function(_0x25812d){if(_0x25812d){return _0x57a0af[_0x5b63('0x20')](_0x71dc09)[_0x5b63('0x21')](_0x25812d);}};}function respondWithFilteredResult(_0x298f87,_0x2c44ba){return function(_0x2454ab){if(_0x2454ab){var _0x4e8e08=typeof _0x2c44ba[_0x5b63('0x22')]===_0x5b63('0x23')&&typeof _0x2c44ba['limit']===_0x5b63('0x23');var _0x212ab2=_0x2454ab['count'];var _0x2ae488=_0x4e8e08?0x0:_0x2c44ba[_0x5b63('0x22')];var _0x46afe1=_0x4e8e08?_0x2454ab[_0x5b63('0x24')]:_0x2c44ba[_0x5b63('0x22')]+_0x2c44ba[_0x5b63('0x25')];var _0x1eec43;if(_0x46afe1>=_0x212ab2){_0x46afe1=_0x212ab2;_0x1eec43=0xc8;}else{_0x1eec43=0xce;}_0x298f87[_0x5b63('0x20')](_0x1eec43);return _0x298f87[_0x5b63('0x26')]('Content-Range',_0x2ae488+'-'+_0x46afe1+'/'+_0x212ab2)[_0x5b63('0x21')](_0x2454ab);}return null;};}function patchUpdates(_0x2a43d3){return function(_0x152f2a){try{jsonpatch['apply'](_0x152f2a,_0x2a43d3,!![]);}catch(_0x36cb17){return BPromise['reject'](_0x36cb17);}return _0x152f2a[_0x5b63('0x27')]();};}function saveUpdates(_0x1ce06a,_0x2c996e){return function(_0x453622){if(_0x453622){return _0x453622[_0x5b63('0x28')](_0x1ce06a)['then'](function(_0xf0908){return _0xf0908;});}return null;};}function removeEntity(_0x5680bc,_0x30f9e8){return function(_0x355fef){if(_0x355fef){return _0x355fef['destroy']()[_0x5b63('0x29')](function(){_0x5680bc[_0x5b63('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x597573,_0x13e30b){return function(_0x561f7c){if(!_0x561f7c){_0x597573['sendStatus'](0x194);}return _0x561f7c;};}function handleError(_0x5116c3,_0x36a3e9){_0x36a3e9=_0x36a3e9||0x1f4;return function(_0x54d606){logger[_0x5b63('0x2a')](_0x54d606[_0x5b63('0x2b')]);if(_0x54d606['name']){delete _0x54d606[_0x5b63('0x2c')];}_0x5116c3[_0x5b63('0x20')](_0x36a3e9)[_0x5b63('0x2d')](_0x54d606);};}exports[_0x5b63('0x2e')]=function(_0x2f8b09,_0x1fcbde){var _0x1011e3={},_0x23ca14={},_0x36f180={'count':0x0,'rows':[]};var _0xc9038b=_[_0x5b63('0x2f')](db['SmsApplication'][_0x5b63('0x30')],function(_0x348b89){return{'name':_0x348b89[_0x5b63('0x31')],'type':_0x348b89['type']['key']};});_0x23ca14[_0x5b63('0x32')]=_[_0x5b63('0x2f')](_0xc9038b,_0x5b63('0x2c'));_0x23ca14[_0x5b63('0x33')]=_['keys'](_0x2f8b09['query']);_0x23ca14[_0x5b63('0x34')]=_[_0x5b63('0x35')](_0x23ca14[_0x5b63('0x32')],_0x23ca14[_0x5b63('0x33')]);_0x1011e3[_0x5b63('0x36')]=_[_0x5b63('0x35')](_0x23ca14[_0x5b63('0x32')],qs[_0x5b63('0x37')](_0x2f8b09[_0x5b63('0x33')][_0x5b63('0x37')]));_0x1011e3[_0x5b63('0x36')]=_0x1011e3[_0x5b63('0x36')][_0x5b63('0x38')]?_0x1011e3[_0x5b63('0x36')]:_0x23ca14[_0x5b63('0x32')];if(!_0x2f8b09[_0x5b63('0x33')]['hasOwnProperty'](_0x5b63('0x39'))){_0x1011e3[_0x5b63('0x25')]=qs[_0x5b63('0x25')](_0x2f8b09[_0x5b63('0x33')]['limit']);_0x1011e3[_0x5b63('0x22')]=qs[_0x5b63('0x22')](_0x2f8b09[_0x5b63('0x33')][_0x5b63('0x22')]);}_0x1011e3[_0x5b63('0x3a')]=qs[_0x5b63('0x3b')](_0x2f8b09[_0x5b63('0x33')]['sort']);_0x1011e3['where']=qs['filters'](_[_0x5b63('0x3c')](_0x2f8b09[_0x5b63('0x33')],_0x23ca14['filters']),_0xc9038b);if(_0x2f8b09[_0x5b63('0x33')][_0x5b63('0x3d')]){_0x1011e3['where']=_[_0x5b63('0x3e')](_0x1011e3[_0x5b63('0x3f')],{'$or':_[_0x5b63('0x2f')](_0xc9038b,function(_0x51e3d8){if(_0x51e3d8[_0x5b63('0x40')]!==_0x5b63('0x41')){var _0x5790bc={};_0x5790bc[_0x51e3d8[_0x5b63('0x2c')]]={'$like':'%'+_0x2f8b09['query']['filter']+'%'};return _0x5790bc;}})});}_0x1011e3=_[_0x5b63('0x3e')]({},_0x1011e3,_0x2f8b09[_0x5b63('0x42')]);var _0x2806fb={'where':_0x1011e3['where']};return db[_0x5b63('0x43')][_0x5b63('0x24')](_0x2806fb)['then'](function(_0x40fedd){_0x36f180['count']=_0x40fedd;if(_0x2f8b09[_0x5b63('0x33')][_0x5b63('0x44')]){_0x1011e3[_0x5b63('0x45')]=[{'all':!![]}];}return db['SmsApplication']['findAll'](_0x1011e3);})[_0x5b63('0x29')](function(_0x9bc19e){_0x36f180['rows']=_0x9bc19e;return _0x36f180;})['then'](respondWithFilteredResult(_0x1fcbde,_0x1011e3))[_0x5b63('0x46')](handleError(_0x1fcbde,null));};exports[_0x5b63('0x47')]=function(_0x4ab9ff,_0x5daaac){var _0x4282e6={'raw':!![],'where':{'id':_0x4ab9ff[_0x5b63('0x48')]['id']}},_0xe767d5={};_0xe767d5['model']=_[_0x5b63('0x49')](db['SmsApplication'][_0x5b63('0x30')]);_0xe767d5[_0x5b63('0x33')]=_[_0x5b63('0x49')](_0x4ab9ff['query']);_0xe767d5[_0x5b63('0x34')]=_[_0x5b63('0x35')](_0xe767d5['model'],_0xe767d5[_0x5b63('0x33')]);_0x4282e6[_0x5b63('0x36')]=_[_0x5b63('0x35')](_0xe767d5[_0x5b63('0x32')],qs[_0x5b63('0x37')](_0x4ab9ff['query']['fields']));_0x4282e6[_0x5b63('0x36')]=_0x4282e6[_0x5b63('0x36')]['length']?_0x4282e6['attributes']:_0xe767d5['model'];if(_0x4ab9ff['query'][_0x5b63('0x44')]){_0x4282e6[_0x5b63('0x45')]=[{'all':!![]}];}_0x4282e6=_['merge']({},_0x4282e6,_0x4ab9ff['options']);return db[_0x5b63('0x43')][_0x5b63('0x4a')](_0x4282e6)[_0x5b63('0x29')](handleEntityNotFound(_0x5daaac,null))[_0x5b63('0x29')](respondWithResult(_0x5daaac,null))['catch'](handleError(_0x5daaac,null));};exports[_0x5b63('0x4b')]=function(_0x4bf15f,_0x444c21){return db[_0x5b63('0x43')][_0x5b63('0x4b')](_0x4bf15f[_0x5b63('0x4c')],{})[_0x5b63('0x29')](respondWithResult(_0x444c21,0xc9))['catch'](handleError(_0x444c21,null));};exports[_0x5b63('0x28')]=function(_0x262c46,_0x1d6d52){if(_0x262c46[_0x5b63('0x4c')]['id']){delete _0x262c46['body']['id'];}return db[_0x5b63('0x43')][_0x5b63('0x4a')]({'where':{'id':_0x262c46[_0x5b63('0x48')]['id']}})[_0x5b63('0x29')](handleEntityNotFound(_0x1d6d52,null))[_0x5b63('0x29')](saveUpdates(_0x262c46[_0x5b63('0x4c')],null))[_0x5b63('0x29')](respondWithResult(_0x1d6d52,null))[_0x5b63('0x46')](handleError(_0x1d6d52,null));};exports['destroy']=function(_0x7888de,_0x57108c){return db[_0x5b63('0x43')][_0x5b63('0x4a')]({'where':{'id':_0x7888de[_0x5b63('0x48')]['id']}})['then'](handleEntityNotFound(_0x57108c,null))['then'](removeEntity(_0x57108c,null))[_0x5b63('0x46')](handleError(_0x57108c,null));}; \ No newline at end of file +var _0x5589=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','length','include','options','find','body','rimraf','zip-dir','request-promise','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5589,0x12b));var _0x9558=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x5589[_0x1969a7];return _0x3d665f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9558('0x0'));var zipdir=require(_0x9558('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9558('0x2'));var moment=require(_0x9558('0x3'));var BPromise=require(_0x9558('0x4'));var Mustache=require(_0x9558('0x5'));var util=require(_0x9558('0x6'));var path=require(_0x9558('0x7'));var sox=require(_0x9558('0x8'));var csv=require(_0x9558('0x9'));var ejs=require(_0x9558('0xa'));var fs=require('fs');var fs_extra=require(_0x9558('0xb'));var _=require(_0x9558('0xc'));var squel=require('squel');var crypto=require(_0x9558('0xd'));var jsforce=require(_0x9558('0xe'));var deskjs=require(_0x9558('0xf'));var toCsv=require(_0x9558('0x9'));var querystring=require('querystring');var Papa=require(_0x9558('0x10'));var Redis=require(_0x9558('0x11'));var authService=require(_0x9558('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9558('0x13'));var logger=require('../../config/logger')(_0x9558('0x14'));var utils=require(_0x9558('0x15'));var config=require(_0x9558('0x16'));var licenseUtil=require(_0x9558('0x17'));var db=require(_0x9558('0x18'))['db'];function respondWithStatusCode(_0x58aa9b,_0x32fd10){_0x32fd10=_0x32fd10||0xcc;return function(_0x3e7cf9){if(_0x3e7cf9){return _0x58aa9b[_0x9558('0x19')](_0x32fd10);}return _0x58aa9b[_0x9558('0x1a')](_0x32fd10)[_0x9558('0x1b')]();};}function respondWithResult(_0x47ea87,_0x188248){_0x188248=_0x188248||0xc8;return function(_0x217905){if(_0x217905){return _0x47ea87[_0x9558('0x1a')](_0x188248)[_0x9558('0x1c')](_0x217905);}};}function respondWithFilteredResult(_0x36c7b0,_0x2f7321){return function(_0x220bcd){if(_0x220bcd){var _0x4d3519=typeof _0x2f7321['offset']==='undefined'&&typeof _0x2f7321['limit']===_0x9558('0x1d');var _0x248760=_0x220bcd[_0x9558('0x1e')];var _0x231331=_0x4d3519?0x0:_0x2f7321[_0x9558('0x1f')];var _0x13c245=_0x4d3519?_0x220bcd['count']:_0x2f7321[_0x9558('0x1f')]+_0x2f7321['limit'];var _0x2c8e31;if(_0x13c245>=_0x248760){_0x13c245=_0x248760;_0x2c8e31=0xc8;}else{_0x2c8e31=0xce;}_0x36c7b0['status'](_0x2c8e31);return _0x36c7b0[_0x9558('0x20')](_0x9558('0x21'),_0x231331+'-'+_0x13c245+'/'+_0x248760)[_0x9558('0x1c')](_0x220bcd);}return null;};}function patchUpdates(_0x3c9f57){return function(_0x5d62f4){try{jsonpatch[_0x9558('0x22')](_0x5d62f4,_0x3c9f57,!![]);}catch(_0x4a02be){return BPromise[_0x9558('0x23')](_0x4a02be);}return _0x5d62f4[_0x9558('0x24')]();};}function saveUpdates(_0x259792,_0x3f19e8){return function(_0x1a2d8f){if(_0x1a2d8f){return _0x1a2d8f['update'](_0x259792)[_0x9558('0x25')](function(_0x947c63){return _0x947c63;});}return null;};}function removeEntity(_0x30c62b,_0x2ef532){return function(_0x23ce96){if(_0x23ce96){return _0x23ce96[_0x9558('0x26')]()[_0x9558('0x25')](function(){_0x30c62b[_0x9558('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e2b34,_0x5625de){return function(_0x8e17eb){if(!_0x8e17eb){_0x3e2b34['sendStatus'](0x194);}return _0x8e17eb;};}function handleError(_0x4a24e3,_0x38b2de){_0x38b2de=_0x38b2de||0x1f4;return function(_0x297304){logger['error'](_0x297304[_0x9558('0x27')]);if(_0x297304[_0x9558('0x28')]){delete _0x297304[_0x9558('0x28')];}_0x4a24e3[_0x9558('0x1a')](_0x38b2de)[_0x9558('0x29')](_0x297304);};}exports[_0x9558('0x2a')]=function(_0x266702,_0x53cb8b){var _0x4026b1={},_0x5a9e9e={},_0x4c0719={'count':0x0,'rows':[]};var _0x2368b2=_[_0x9558('0x2b')](db[_0x9558('0x2c')][_0x9558('0x2d')],function(_0x34f5f2){return{'name':_0x34f5f2[_0x9558('0x2e')],'type':_0x34f5f2[_0x9558('0x2f')][_0x9558('0x30')]};});_0x5a9e9e[_0x9558('0x31')]=_[_0x9558('0x2b')](_0x2368b2,_0x9558('0x28'));_0x5a9e9e['query']=_[_0x9558('0x32')](_0x266702[_0x9558('0x33')]);_0x5a9e9e[_0x9558('0x34')]=_['intersection'](_0x5a9e9e[_0x9558('0x31')],_0x5a9e9e[_0x9558('0x33')]);_0x4026b1[_0x9558('0x35')]=_[_0x9558('0x36')](_0x5a9e9e[_0x9558('0x31')],qs[_0x9558('0x37')](_0x266702[_0x9558('0x33')]['fields']));_0x4026b1[_0x9558('0x35')]=_0x4026b1[_0x9558('0x35')]['length']?_0x4026b1[_0x9558('0x35')]:_0x5a9e9e[_0x9558('0x31')];if(!_0x266702['query'][_0x9558('0x38')](_0x9558('0x39'))){_0x4026b1['limit']=qs[_0x9558('0x3a')](_0x266702['query']['limit']);_0x4026b1['offset']=qs[_0x9558('0x1f')](_0x266702[_0x9558('0x33')][_0x9558('0x1f')]);}_0x4026b1[_0x9558('0x3b')]=qs['sort'](_0x266702[_0x9558('0x33')]['sort']);_0x4026b1[_0x9558('0x3c')]=qs[_0x9558('0x34')](_[_0x9558('0x3d')](_0x266702['query'],_0x5a9e9e[_0x9558('0x34')]),_0x2368b2);if(_0x266702['query'][_0x9558('0x3e')]){_0x4026b1['where']=_[_0x9558('0x3f')](_0x4026b1[_0x9558('0x3c')],{'$or':_[_0x9558('0x2b')](_0x2368b2,function(_0xc8a508){if(_0xc8a508[_0x9558('0x2f')]!==_0x9558('0x40')){var _0x21c702={};_0x21c702[_0xc8a508['name']]={'$like':'%'+_0x266702[_0x9558('0x33')]['filter']+'%'};return _0x21c702;}})});}_0x4026b1=_['merge']({},_0x4026b1,_0x266702['options']);var _0x428b91={'where':_0x4026b1[_0x9558('0x3c')]};return db[_0x9558('0x2c')][_0x9558('0x1e')](_0x428b91)[_0x9558('0x25')](function(_0x64e7ce){_0x4c0719[_0x9558('0x1e')]=_0x64e7ce;if(_0x266702[_0x9558('0x33')][_0x9558('0x41')]){_0x4026b1['include']=[{'all':!![]}];}return db['SmsApplication'][_0x9558('0x42')](_0x4026b1);})[_0x9558('0x25')](function(_0x4bec34){_0x4c0719[_0x9558('0x43')]=_0x4bec34;return _0x4c0719;})['then'](respondWithFilteredResult(_0x53cb8b,_0x4026b1))[_0x9558('0x44')](handleError(_0x53cb8b,null));};exports[_0x9558('0x45')]=function(_0x2f59b1,_0x35d497){var _0x3fb7b8={'raw':!![],'where':{'id':_0x2f59b1[_0x9558('0x46')]['id']}},_0x3db8d0={};_0x3db8d0['model']=_[_0x9558('0x32')](db[_0x9558('0x2c')]['rawAttributes']);_0x3db8d0[_0x9558('0x33')]=_[_0x9558('0x32')](_0x2f59b1[_0x9558('0x33')]);_0x3db8d0[_0x9558('0x34')]=_[_0x9558('0x36')](_0x3db8d0[_0x9558('0x31')],_0x3db8d0[_0x9558('0x33')]);_0x3fb7b8[_0x9558('0x35')]=_[_0x9558('0x36')](_0x3db8d0[_0x9558('0x31')],qs['fields'](_0x2f59b1[_0x9558('0x33')]['fields']));_0x3fb7b8[_0x9558('0x35')]=_0x3fb7b8[_0x9558('0x35')][_0x9558('0x47')]?_0x3fb7b8[_0x9558('0x35')]:_0x3db8d0[_0x9558('0x31')];if(_0x2f59b1[_0x9558('0x33')][_0x9558('0x41')]){_0x3fb7b8[_0x9558('0x48')]=[{'all':!![]}];}_0x3fb7b8=_[_0x9558('0x3f')]({},_0x3fb7b8,_0x2f59b1[_0x9558('0x49')]);return db[_0x9558('0x2c')][_0x9558('0x4a')](_0x3fb7b8)[_0x9558('0x25')](handleEntityNotFound(_0x35d497,null))['then'](respondWithResult(_0x35d497,null))[_0x9558('0x44')](handleError(_0x35d497,null));};exports['create']=function(_0x14f62f,_0xf37f42){return db['SmsApplication']['create'](_0x14f62f[_0x9558('0x4b')],{})['then'](respondWithResult(_0xf37f42,0xc9))[_0x9558('0x44')](handleError(_0xf37f42,null));};exports['update']=function(_0x5cebb2,_0x5d4f39){if(_0x5cebb2[_0x9558('0x4b')]['id']){delete _0x5cebb2['body']['id'];}return db[_0x9558('0x2c')]['find']({'where':{'id':_0x5cebb2[_0x9558('0x46')]['id']}})[_0x9558('0x25')](handleEntityNotFound(_0x5d4f39,null))[_0x9558('0x25')](saveUpdates(_0x5cebb2['body'],null))[_0x9558('0x25')](respondWithResult(_0x5d4f39,null))[_0x9558('0x44')](handleError(_0x5d4f39,null));};exports[_0x9558('0x26')]=function(_0x1087cb,_0x2683ca){return db[_0x9558('0x2c')][_0x9558('0x4a')]({'where':{'id':_0x1087cb[_0x9558('0x46')]['id']}})[_0x9558('0x25')](handleEntityNotFound(_0x2683ca,null))[_0x9558('0x25')](removeEntity(_0x2683ca,null))['catch'](handleError(_0x2683ca,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 0605de0..91b43d1 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 _0xd740=['utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','SmsApplication','sms_applications'];(function(_0x4116b6,_0x310c2a){var _0x2b85b2=function(_0x599e4f){while(--_0x599e4f){_0x4116b6['push'](_0x4116b6['shift']());}};_0x2b85b2(++_0x310c2a);}(_0xd740,0x72));var _0x0d74=function(_0x5ad0c6,_0x56ee17){_0x5ad0c6=_0x5ad0c6-0x0;var _0x167958=_0xd740[_0x5ad0c6];return _0x167958;};'use strict';var _=require(_0x0d74('0x0'));var util=require(_0x0d74('0x1'));var logger=require('../../config/logger')(_0x0d74('0x2'));var moment=require(_0x0d74('0x3'));var BPromise=require('bluebird');var rp=require(_0x0d74('0x4'));var fs=require('fs');var path=require(_0x0d74('0x5'));var rimraf=require(_0x0d74('0x6'));var config=require(_0x0d74('0x7'));var attributes=require('./smsApplication.attributes');module[_0x0d74('0x8')]=function(_0x43a02b,_0x37c3e2){return _0x43a02b[_0x0d74('0x9')](_0x0d74('0xa'),attributes,{'tableName':_0x0d74('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0d74('0xc'),'collate':_0x0d74('0xd')});}; \ No newline at end of file +var _0x1b94=['sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./smsApplication.attributes','exports','define','SmsApplication'];(function(_0x450526,_0x2980ae){var _0x135de9=function(_0x2d55b1){while(--_0x2d55b1){_0x450526['push'](_0x450526['shift']());}};_0x135de9(++_0x2980ae);}(_0x1b94,0x1f2));var _0x41b9=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x1b94[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x41b9('0x0'));var util=require(_0x41b9('0x1'));var logger=require(_0x41b9('0x2'))(_0x41b9('0x3'));var moment=require(_0x41b9('0x4'));var BPromise=require('bluebird');var rp=require(_0x41b9('0x5'));var fs=require('fs');var path=require(_0x41b9('0x6'));var rimraf=require(_0x41b9('0x7'));var config=require('../../config/environment');var attributes=require(_0x41b9('0x8'));module[_0x41b9('0x9')]=function(_0x368c00,_0x5e58d8){return _0x368c00[_0x41b9('0xa')](_0x41b9('0xb'),attributes,{'tableName':_0x41b9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x41b9('0xd'),'collate':_0x41b9('0xe')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 2af78ba..2ba23cf 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 _0xed03=['info','SmsApplication,\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(_0x50b658,_0xd3077f){var _0x484d1d=function(_0x15f39b){while(--_0x15f39b){_0x50b658['push'](_0x50b658['shift']());}};_0x484d1d(++_0xd3077f);}(_0xed03,0xdc));var _0x3ed0=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0xed03[_0x363ef8];return _0x148822;};'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')]('SmsApplication,\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')]('SmsApplication,\x20%s,\x20%s',_0x3f1277,_0x3ed0('0xe'));_0x4500aa(_0x34950c[_0x3ed0('0x13')][_0x3ed0('0x12')]);}})[_0x3ed0('0x14')](function(_0xaa73cd){logger[_0x3ed0('0x10')]('SmsApplication,\x20%s,\x20%s',_0x3f1277,_0xaa73cd);_0xddc4c5(_0xaa73cd);});});} \ No newline at end of file +var _0x4808=['stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4808,0x160));var _0x8480=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x4808[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0x8480('0x0'));var util=require(_0x8480('0x1'));var moment=require(_0x8480('0x2'));var BPromise=require('bluebird');var rs=require(_0x8480('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8480('0x4'))['db'];var utils=require(_0x8480('0x5'));var logger=require(_0x8480('0x6'))('rpc');var config=require(_0x8480('0x7'));var jayson=require(_0x8480('0x8'));var client=jayson['client'][_0x8480('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5060aa,_0x364f22,_0x4b9f45){return new BPromise(function(_0x3480e7,_0x2b1ffb){return client[_0x8480('0xa')](_0x5060aa,_0x4b9f45)[_0x8480('0xb')](function(_0x337d1e){logger['info'](_0x8480('0xc'),_0x364f22,_0x8480('0xd'));logger[_0x8480('0xe')](_0x8480('0xf'),_0x364f22,_0x8480('0xd'),JSON[_0x8480('0x10')](_0x337d1e));if(_0x337d1e[_0x8480('0x11')]){if(_0x337d1e[_0x8480('0x11')][_0x8480('0x12')]===0x1f4){logger[_0x8480('0x11')](_0x8480('0xc'),_0x364f22,_0x337d1e[_0x8480('0x11')][_0x8480('0x13')]);return _0x2b1ffb(_0x337d1e[_0x8480('0x11')][_0x8480('0x13')]);}logger[_0x8480('0x11')](_0x8480('0xc'),_0x364f22,_0x337d1e[_0x8480('0x11')][_0x8480('0x13')]);return _0x3480e7(_0x337d1e['error'][_0x8480('0x13')]);}else{logger[_0x8480('0x14')](_0x8480('0xc'),_0x364f22,'request\x20sent');_0x3480e7(_0x337d1e[_0x8480('0x15')][_0x8480('0x13')]);}})[_0x8480('0x16')](function(_0x35dd6a){logger[_0x8480('0x11')](_0x8480('0xc'),_0x364f22,_0x35dd6a);_0x2b1ffb(_0x35dd6a);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 8bde6e5..577b592 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 _0xb10b=['smsinteraction:addtags','addTags','put','update','delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','post','create','addMessage','tracked','sms'];(function(_0x38dc5c,_0x3d0e2e){var _0x20d974=function(_0x15300b){while(--_0x15300b){_0x38dc5c['push'](_0x38dc5c['shift']());}};_0x20d974(++_0x3d0e2e);}(_0xb10b,0x12a));var _0xbb10=function(_0x1a08cf,_0x186382){_0x1a08cf=_0x1a08cf-0x0;var _0x4174b7=_0xb10b[_0x1a08cf];return _0x4174b7;};'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('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getMessages']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['download']);router[_0xbb10('0x11')]('/',auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x11')](_0xbb10('0xf'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router[_0xbb10('0x11')]('/:id/tags',auth[_0xbb10('0xb')](),interaction[_0xbb10('0x14')](_0xbb10('0x15'),_0xbb10('0x16')),controller[_0xbb10('0x17')]);router[_0xbb10('0x18')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),interaction[_0xbb10('0x14')](_0xbb10('0x15'),'smsinteraction:update'),controller[_0xbb10('0x19')]);router[_0xbb10('0x1a')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),interaction[_0xbb10('0x14')](_0xbb10('0x15'),_0xbb10('0x1b')),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1a')](_0xbb10('0x1d'),auth['isAuthenticated'](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file +var _0x5eb8=['smsinteraction:update','update','delete','smsinteraction:destroy','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put'];(function(_0x381104,_0x45e21d){var _0x130dfc=function(_0x48938b){while(--_0x48938b){_0x381104['push'](_0x381104['shift']());}};_0x130dfc(++_0x45e21d);}(_0x5eb8,0xb0));var _0x85eb=function(_0x51b0dc,_0x5307b7){_0x51b0dc=_0x51b0dc-0x0;var _0x13fa89=_0x5eb8[_0x51b0dc];return _0x13fa89;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['get'](_0x85eb('0xe'),auth['isAuthenticated'](),controller[_0x85eb('0xf')]);router[_0x85eb('0x9')](_0x85eb('0x10'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x11')]);router[_0x85eb('0x9')](_0x85eb('0x12'),auth['isAuthenticated'](),controller[_0x85eb('0x13')]);router[_0x85eb('0x14')]('/',auth['isAuthenticated'](),controller[_0x85eb('0x15')]);router[_0x85eb('0x14')](_0x85eb('0x10'),auth[_0x85eb('0xa')](),controller['addMessage']);router['post'](_0x85eb('0x16'),auth['isAuthenticated'](),interaction[_0x85eb('0x17')](_0x85eb('0x18'),_0x85eb('0x19')),controller[_0x85eb('0x1a')]);router[_0x85eb('0x1b')]('/:id',auth[_0x85eb('0xa')](),interaction['tracked'](_0x85eb('0x18'),_0x85eb('0x1c')),controller[_0x85eb('0x1d')]);router[_0x85eb('0x1e')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x85eb('0x18'),_0x85eb('0x1f')),controller[_0x85eb('0x20')]);router[_0x85eb('0x1e')](_0x85eb('0x16'),auth[_0x85eb('0xa')](),controller['removeTags']);module[_0x85eb('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 7c5bd06..281a386 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 _0x3c94=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment','exports'];(function(_0x193284,_0x3aeaed){var _0x20727c=function(_0x47385d){while(--_0x47385d){_0x193284['push'](_0x193284['shift']());}};_0x20727c(++_0x3aeaed);}(_0x3c94,0xcd));var _0x43c9=function(_0x184cc6,_0x4961ee){_0x184cc6=_0x184cc6-0x0;var _0x3f7435=_0x3c94[_0x184cc6];return _0x3f7435;};'use strict';var Sequelize=require(_0x43c9('0x0'));var moment=require(_0x43c9('0x1'));module[_0x43c9('0x2')]={'closed':{'type':Sequelize[_0x43c9('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x43c9('0x4')]},'disposition':{'type':Sequelize[_0x43c9('0x5')]},'secondDisposition':{'type':Sequelize[_0x43c9('0x5')]},'thirdDisposition':{'type':Sequelize[_0x43c9('0x5')]},'note':{'type':Sequelize[_0x43c9('0x5')]},'phone':{'type':Sequelize[_0x43c9('0x5')]},'read1stAt':{'type':Sequelize[_0x43c9('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x43c9('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x43c9('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x43c9('0x6')]('in',_0x43c9('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x43c9('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x4074=['ENUM','out','sequelize','moment','exports','DATE','STRING'];(function(_0x499eaf,_0x560a5a){var _0x2fa121=function(_0x286a7b){while(--_0x286a7b){_0x499eaf['push'](_0x499eaf['shift']());}};_0x2fa121(++_0x560a5a);}(_0x4074,0xf0));var _0x4407=function(_0x20b354,_0x52553e){_0x20b354=_0x20b354-0x0;var _0xb81a90=_0x4074[_0x20b354];return _0xb81a90;};'use strict';var Sequelize=require(_0x4407('0x0'));var moment=require(_0x4407('0x1'));module[_0x4407('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4407('0x3')]},'disposition':{'type':Sequelize[_0x4407('0x4')]},'secondDisposition':{'type':Sequelize[_0x4407('0x4')]},'thirdDisposition':{'type':Sequelize[_0x4407('0x4')]},'note':{'type':Sequelize[_0x4407('0x4')]},'phone':{'type':Sequelize[_0x4407('0x4')]},'read1stAt':{'type':Sequelize[_0x4407('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x4407('0x5')]('in',_0x4407('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4407('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x4407('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 98698dd..7450d8c 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 _0xb616=['sort','where','field','color','tools_tags','select','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','from','sms_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.SmsAccountId','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','expr','search','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','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?','find','start','some','compact','isEmpty','SmsAccountId','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','order','contactName','DESC','t.id\x20IN\x20?','role','agent','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','SmsInteraction','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','all','rows','show','includeAll','include','options','body','params','describe','addMessage','omit','ids','findOne','SmsMessage','pick','SmsInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','emit','removeTags','join','root','files','tmp','attachments','Contact','firstName','lastName','createdAt','direction','SmsAccount','get','Sms','N.A.','disposition','Messages','out','System','secret','renderFile','server','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','download','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','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/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','./smsInteraction.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','talking','unmanaged','closed','UserId','answered','total','index','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x48a2e6,_0x14a1e9){var _0x2bc896=function(_0x47252c){while(--_0x47252c){_0x48a2e6['push'](_0x48a2e6['shift']());}};_0x2bc896(++_0x14a1e9);}(_0xb616,0x9e));var _0x6b61=function(_0x244a88,_0x5b57ff){_0x244a88=_0x244a88-0x0;var _0x48017d=_0xb616[_0x244a88];return _0x48017d;};'use strict';var emlformat=require(_0x6b61('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6b61('0x1'));var jsonpatch=require(_0x6b61('0x2'));var rp=require('request-promise');var moment=require(_0x6b61('0x3'));var BPromise=require(_0x6b61('0x4'));var Mustache=require(_0x6b61('0x5'));var util=require(_0x6b61('0x6'));var path=require(_0x6b61('0x7'));var sox=require(_0x6b61('0x8'));var csv=require(_0x6b61('0x9'));var ejs=require(_0x6b61('0xa'));var fs=require('fs');var fs_extra=require(_0x6b61('0xb'));var _=require(_0x6b61('0xc'));var squel=require(_0x6b61('0xd'));var crypto=require(_0x6b61('0xe'));var jsforce=require(_0x6b61('0xf'));var deskjs=require(_0x6b61('0x10'));var toCsv=require(_0x6b61('0x9'));var querystring=require(_0x6b61('0x11'));var Papa=require(_0x6b61('0x12'));var Redis=require(_0x6b61('0x13'));var authService=require(_0x6b61('0x14'));var qs=require(_0x6b61('0x15'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x6b61('0x16'));var hardwareService=require(_0x6b61('0x17'));var logger=require(_0x6b61('0x18'))(_0x6b61('0x19'));var utils=require(_0x6b61('0x1a'));var config=require(_0x6b61('0x1b'));var licenseUtil=require(_0x6b61('0x1c'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6b61('0x1d')]));require(_0x6b61('0x1e'))[_0x6b61('0x1f')](socket);function respondWithStatusCode(_0x501c30,_0x26ad67){_0x26ad67=_0x26ad67||0xcc;return function(_0x20655a){if(_0x20655a){return _0x501c30[_0x6b61('0x20')](_0x26ad67);}return _0x501c30['status'](_0x26ad67)[_0x6b61('0x21')]();};}function respondWithResult(_0x1e26aa,_0x1c47dc){_0x1c47dc=_0x1c47dc||0xc8;return function(_0x19036a){if(_0x19036a){return _0x1e26aa[_0x6b61('0x22')](_0x1c47dc)[_0x6b61('0x23')](_0x19036a);}};}function respondWithFilteredResult(_0x31921e,_0x2d2a8d){return function(_0x49e703){if(_0x49e703){var _0x1e99b1=typeof _0x2d2a8d[_0x6b61('0x24')]===_0x6b61('0x25')&&typeof _0x2d2a8d[_0x6b61('0x26')]==='undefined';var _0x3fb884=_0x49e703[_0x6b61('0x27')];var _0x596ba3=_0x1e99b1?0x0:_0x2d2a8d[_0x6b61('0x24')];var _0x78f3ea=_0x1e99b1?_0x49e703[_0x6b61('0x27')]:_0x2d2a8d[_0x6b61('0x24')]+_0x2d2a8d[_0x6b61('0x26')];var _0x2c5444;if(_0x78f3ea>=_0x3fb884){_0x78f3ea=_0x3fb884;_0x2c5444=0xc8;}else{_0x2c5444=0xce;}_0x31921e[_0x6b61('0x22')](_0x2c5444);return _0x31921e[_0x6b61('0x28')](_0x6b61('0x29'),_0x596ba3+'-'+_0x78f3ea+'/'+_0x3fb884)[_0x6b61('0x23')](_0x49e703);}return null;};}function patchUpdates(_0x257e97){return function(_0x2a85cd){try{jsonpatch[_0x6b61('0x2a')](_0x2a85cd,_0x257e97,!![]);}catch(_0x1b4918){return BPromise['reject'](_0x1b4918);}return _0x2a85cd['save']();};}function saveUpdates(_0x46ea27,_0x14fe0a){return function(_0x2b9bdd){if(_0x2b9bdd){return _0x2b9bdd[_0x6b61('0x2b')](_0x46ea27)['then'](function(_0x4b703c){return _0x4b703c;});}return null;};}function removeEntity(_0x35bc82,_0x43e674){return function(_0x23d2fc){if(_0x23d2fc){return _0x23d2fc[_0x6b61('0x2c')]()[_0x6b61('0x2d')](function(){_0x35bc82[_0x6b61('0x22')](0xcc)[_0x6b61('0x21')]();});}};}function handleEntityNotFound(_0x5e9787,_0x1ea729){return function(_0x51dbda){if(!_0x51dbda){_0x5e9787[_0x6b61('0x20')](0x194);}return _0x51dbda;};}function handleError(_0x114d08,_0x4c0d85){_0x4c0d85=_0x4c0d85||0x1f4;return function(_0x1fe2c7){logger[_0x6b61('0x2e')](_0x1fe2c7[_0x6b61('0x2f')]);if(_0x1fe2c7[_0x6b61('0x30')]){delete _0x1fe2c7['name'];}_0x114d08[_0x6b61('0x22')](_0x4c0d85)[_0x6b61('0x31')](_0x1fe2c7);};}function getInteractionUsers(_0x33246c,_0x76f8b7){return new BPromise(function(_0x2d5dab,_0x272958){try{if(_0x76f8b7[_0x33246c['id']]){_0x33246c[_0x6b61('0x32')]=_[_0x6b61('0x33')](_0x76f8b7[_0x33246c['id']],function(_0x23e629){return{'id':_0x23e629['id'],'fullname':_0x23e629[_0x6b61('0x34')]};});}}catch(_0x3f1b9c){_0x272958(_0x3f1b9c);}_0x2d5dab(_0x33246c);});}function getInteractionTags(_0x338b84,_0x2c6797){return new BPromise(function(_0x315e8b,_0x58b22d){try{if(_0x338b84[_0x6b61('0x35')]){_0x338b84[_0x6b61('0x36')]=[];_0x338b84[_0x6b61('0x35')][_0x6b61('0x37')](',')[_0x6b61('0x38')](function(_0x3e57eb){_0x338b84[_0x6b61('0x36')][_0x6b61('0x39')](_0x2c6797[_0x3e57eb]);});}delete _0x338b84['TagIds'];}catch(_0x3c14ac){_0x58b22d(_0x3c14ac);}_0x315e8b(_0x338b84);});}function updateSmsInteraction(_0x1bf527,_0x24c445,_0x8f8db8){return new BPromise(function(_0x5f06a7,_0x19747a){return getInteractionUsers(_0x1bf527,_0x8f8db8)[_0x6b61('0x2d')](function(_0x35b3a5){return getInteractionTags(_0x35b3a5,_0x24c445);})['then'](function(_0x269562){return getStateInteraction(_0x269562);})[_0x6b61('0x2d')](function(_0x570c47){_0x5f06a7(_0x570c47);})[_0x6b61('0x3a')](function(_0x57f278){_0x19747a(_0x57f278);});});}function getStateInteraction(_0x278be7){return new BPromise(function(_0x28e9a6){_0x278be7['waiting']=0x0;_0x278be7[_0x6b61('0x3b')]=0x0;_0x278be7['answered']=0x0;_0x278be7[_0x6b61('0x3c')]=0x0;_0x278be7['total']=0x0;if(!_0x278be7[_0x6b61('0x3d')]&&!_0x278be7['UserId']){_0x278be7['waiting']+=0x1;}if(!_0x278be7[_0x6b61('0x3d')]&&_0x278be7['UserId']){_0x278be7[_0x6b61('0x3b')]+=0x1;if(_0x278be7['waiting']){_0x278be7['waiting']-=0x1;}}if(_0x278be7['closed']&&_0x278be7[_0x6b61('0x3e')]){_0x278be7[_0x6b61('0x3f')]+=0x1;if(_0x278be7[_0x6b61('0x3b')]){_0x278be7[_0x6b61('0x3b')]-=0x1;}}if(_0x278be7['closed']&&!_0x278be7[_0x6b61('0x3e')]){_0x278be7[_0x6b61('0x3c')]+=0x1;if(_0x278be7['waiting']){_0x278be7['waiting']-=0x1;}}_0x278be7[_0x6b61('0x40')]+=0x1;_0x28e9a6(_0x278be7);});}exports[_0x6b61('0x41')]=function(_0x7779ad,_0x2dde81){var _0x1ec8a9={},_0xdb26f8={},_0xba022f={'count':0x0,'rows':[]};var _0x40237c=_['map'](db['SmsInteraction'][_0x6b61('0x42')],function(_0x4637d9){return{'name':_0x4637d9['fieldName'],'type':_0x4637d9['type'][_0x6b61('0x43')]};});_0xdb26f8[_0x6b61('0x44')]=_[_0x6b61('0x33')](_0x40237c,_0x6b61('0x30'));_0xdb26f8[_0x6b61('0x45')]=_[_0x6b61('0x46')](_0x7779ad['query']);_0xdb26f8[_0x6b61('0x47')]=_[_0x6b61('0x48')](_0xdb26f8[_0x6b61('0x44')],_0xdb26f8[_0x6b61('0x45')]);_0x1ec8a9[_0x6b61('0x49')]=_[_0x6b61('0x48')](_0xdb26f8[_0x6b61('0x44')],qs[_0x6b61('0x4a')](_0x7779ad[_0x6b61('0x45')][_0x6b61('0x4a')]));_0x1ec8a9['attributes']=_0x1ec8a9['attributes'][_0x6b61('0x4b')]?_0x1ec8a9[_0x6b61('0x49')]:_0xdb26f8[_0x6b61('0x44')];if(!_0x7779ad[_0x6b61('0x45')][_0x6b61('0x4c')](_0x6b61('0x4d'))){_0x1ec8a9[_0x6b61('0x26')]=qs[_0x6b61('0x26')](_0x7779ad[_0x6b61('0x45')][_0x6b61('0x26')]);_0x1ec8a9[_0x6b61('0x24')]=qs[_0x6b61('0x24')](_0x7779ad['query'][_0x6b61('0x24')]);}_0x1ec8a9['order']=qs[_0x6b61('0x4e')](_0x7779ad['query'][_0x6b61('0x4e')]);_0x1ec8a9[_0x6b61('0x4f')]=qs[_0x6b61('0x47')](_['pick'](_0x7779ad['query'],_0xdb26f8[_0x6b61('0x47')]),_0x40237c);var _0x198702=[];var _0x325532=squel['select']()[_0x6b61('0x50')]('id')[_0x6b61('0x50')](_0x6b61('0x30'))[_0x6b61('0x50')](_0x6b61('0x51'))['from'](_0x6b61('0x52'));var _0x29b3bc=squel[_0x6b61('0x53')]()[_0x6b61('0x50')]('u.id')[_0x6b61('0x50')](_0x6b61('0x54'))[_0x6b61('0x50')](_0x6b61('0x55'))['from'](_0x6b61('0x56'),'ui')[_0x6b61('0x57')](_0x6b61('0x58'),'u','u.id\x20=\x20ui.UserId');var _0x8fa5a=squel['select']()[_0x6b61('0x59')](_0x6b61('0x5a'),'i')[_0x6b61('0x57')]('cm_contacts','c',_0x6b61('0x5b'))[_0x6b61('0x57')](_0x6b61('0x58'),'o',_0x6b61('0x5c'))[_0x6b61('0x57')]('sms_accounts','a',_0x6b61('0x5d'))['left_join']('sms_messages','me','me.SmsInteractionId\x20=\x20i.id')['left_join'](_0x6b61('0x5e'),'it',_0x6b61('0x5f'))[_0x6b61('0x57')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0xf71e3c=squel[_0x6b61('0x60')]();var _0x5895af=[];var _0x55c95b=squel[_0x6b61('0x60')]();var _0x2f88ca;if(_0x7779ad[_0x6b61('0x45')][_0x6b61('0x61')]){_0x2f88ca=as['parseSearch'](_0x7779ad[_0x6b61('0x45')]['search']);var _0x1d7d68=_0x2f88ca['sqlOperator'];for(var _0x33eff1=0x0;_0x33eff1<_0x2f88ca['conditions'][_0x6b61('0x4b')];_0x33eff1++){var _0x4cdd33=_0x2f88ca[_0x6b61('0x62')][_0x33eff1];var _0x11a419='i';var _0x3b4a55=_['find'](_0x40237c,[_0x6b61('0x30'),_0x4cdd33[_0x6b61('0x50')]]);if(!_0x3b4a55){switch(_0x4cdd33['field']){case _0x6b61('0x63'):if(_0x4cdd33[_0x6b61('0x64')]==0x1){_0x8fa5a[_0x6b61('0x65')]('`'+_0x4cdd33[_0x6b61('0x50')]+_0x6b61('0x66'));}else{_0x8fa5a[_0x6b61('0x65')]('`'+_0x4cdd33['field']+_0x6b61('0x67'));}break;case'Contact':if(_0x4cdd33[_0x6b61('0x68')]===_0x6b61('0x69')){if(_0x4cdd33[_0x6b61('0x64')][_0x6b61('0x37')]('\x20')[_0x6b61('0x4b')]>0x1){_0xf71e3c[_0x1d7d68](_0x6b61('0x6a'),qs[_0x6b61('0x6b')](_0x4cdd33['value']),null);}else{var _0x5cd799='%'+_0x4cdd33['value']+'%';_0xf71e3c[_0x1d7d68](_0x6b61('0x6c'),_0x5cd799,_0x5cd799,_0x5cd799);}}else{_0x3b4a55=_['find'](_0x40237c,['name',_0x6b61('0x6d')]);_0x4cdd33[_0x6b61('0x50')]=_0x6b61('0x6d');_0x31a158=as[_0x6b61('0x6e')](_0x11a419,_0x3b4a55[_0x6b61('0x6f')],_0x4cdd33);_0xf71e3c[_0x1d7d68](_0x31a158[_0x6b61('0x70')],_0x31a158[_0x6b61('0x64')]['start'],_0x31a158[_0x6b61('0x64')][_0x6b61('0x21')]);}break;case _0x6b61('0x71'):var _0x4bfe58=_0x4cdd33['value'][_0x6b61('0x37')](',')[_0x6b61('0x33')](function(_0x205e01){return Number(_0x205e01);});_0x4bfe58[_0x6b61('0x38')](function(_0x5b7afe){_0x55c95b['or'](_0x6b61('0x72'),'%,'+_0x5b7afe+',%');});_0x5895af=_['union'](_0x5895af,_0x4bfe58);break;case _0x6b61('0x73'):if(_0x4cdd33[_0x6b61('0x68')]===_0x6b61('0x69')){_0xf71e3c[_0x1d7d68](_0x6b61('0x74'),'%'+_0x4cdd33[_0x6b61('0x64')]+'%',null);}else{_0x3b4a55=_[_0x6b61('0x75')](_0x40237c,[_0x6b61('0x30'),_0x6b61('0x3e')]);_0x4cdd33[_0x6b61('0x50')]='UserId';_0x31a158=as[_0x6b61('0x6e')](_0x11a419,_0x3b4a55['type'],_0x4cdd33);_0xf71e3c[_0x1d7d68](_0x31a158[_0x6b61('0x70')],_0x31a158[_0x6b61('0x64')][_0x6b61('0x76')],_0x31a158[_0x6b61('0x64')]['end']);}break;case'body':_0x31a158=as['buildExpression']('me',null,_0x4cdd33);_0xf71e3c[_0x1d7d68](_0x31a158[_0x6b61('0x70')],_0x31a158[_0x6b61('0x64')][_0x6b61('0x76')],_0x31a158['value'][_0x6b61('0x21')]);break;}}else{var _0x31a158=as[_0x6b61('0x6e')](_0x11a419,_0x3b4a55['type'],_0x4cdd33);_0xf71e3c[_0x1d7d68](_0x31a158[_0x6b61('0x70')],_0x31a158[_0x6b61('0x64')][_0x6b61('0x76')],_0x31a158[_0x6b61('0x64')][_0x6b61('0x21')]);}}}else{var _0x4aabc1=_(_0x7779ad[_0x6b61('0x45')])[_0x6b61('0x46')]()[_0x6b61('0x33')](function(_0x2b7d5c){return _[_0x6b61('0x77')](_0x40237c,[_0x6b61('0x30'),_0x2b7d5c])?_0x2b7d5c:undefined;})[_0x6b61('0x78')]()[_0x6b61('0x64')]();if(!_[_0x6b61('0x79')](_0x4aabc1)){_0x4aabc1[_0x6b61('0x38')](function(_0x25aac5){if(_0x25aac5===_0x6b61('0x7a')){_0x8fa5a['where']('i.SmsAccountId\x20IN\x20?',[]['concat'](_0x7779ad[_0x6b61('0x45')][_0x25aac5]));}else if(_0x25aac5==='createdAt'){var _0x849e28=JSON[_0x6b61('0x7b')](_0x7779ad[_0x6b61('0x45')][_0x25aac5])['$gte'];var _0xf1c344=JSON[_0x6b61('0x7b')](_0x7779ad[_0x6b61('0x45')][_0x25aac5])['$lte'];_0x8fa5a[_0x6b61('0x4f')](_0x6b61('0x7c'),_0x849e28,_0xf1c344);}else{if(_0x7779ad['query'][_0x25aac5]===_0x6b61('0x7d')){_0x8fa5a[_0x6b61('0x4f')]('i.'+_0x25aac5+_0x6b61('0x7e'));}else{_0x8fa5a['where']('i.'+_0x25aac5+_0x6b61('0x7f'),_0x7779ad[_0x6b61('0x45')][_0x25aac5]);}}});}if(_0x7779ad[_0x6b61('0x45')][_0x6b61('0x80')]){if(_0x7779ad[_0x6b61('0x45')]['read']==0x1){_0x8fa5a[_0x6b61('0x65')](_0x6b61('0x81'));}else{_0x8fa5a[_0x6b61('0x65')](_0x6b61('0x82'));}}if(_0x7779ad['query']['tag']){_0x5895af=_[_0x6b61('0x83')](_0x7779ad[_0x6b61('0x45')][_0x6b61('0x84')])?_0x7779ad['query']['tag']:new Array(_0x7779ad[_0x6b61('0x45')][_0x6b61('0x84')]);_0x5895af[_0x6b61('0x38')](function(_0x78ed91){_0x55c95b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x78ed91+',%');});}if(_0x7779ad[_0x6b61('0x45')][_0x6b61('0x85')]){var _0x146db5=_0x7779ad[_0x6b61('0x45')][_0x6b61('0x85')]['replace']('\x5c','\x5c\x5c')[_0x6b61('0x86')](/'/g,'\x27\x27');if(qs[_0x6b61('0x87')](_0x146db5)){_0xf71e3c['or'](_0x6b61('0x88'),_0x146db5+'%')['or'](_0x6b61('0x89'),_0x146db5+'%');}else{_0xf71e3c['or'](_0x6b61('0x8a'),qs['getFullTextValue'](_0x146db5))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x146db5+'%');}}}_0x8fa5a[_0x6b61('0x4f')](_0xf71e3c);_0x8fa5a[_0x6b61('0x8b')](_0x6b61('0x8c'));var _0x80f45a={'type':db[_0x6b61('0x8d')][_0x6b61('0x8e')][_0x6b61('0x8f')],'raw':!![]};var _0x19ca28=_0x8fa5a[_0x6b61('0x90')]();_0x19ca28[_0x6b61('0x50')](_0x6b61('0x8c'));_0x19ca28[_0x6b61('0x50')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x6b61('0x63'));if(_0x1ec8a9[_0x6b61('0x91')]){_0x1ec8a9['order']['forEach'](function(_0x3bceac){var _0x5c0fe1=_0x3bceac[0x0]===_0x6b61('0x92')?_0x3bceac[0x0]:'i.'+_0x3bceac[0x0];_0x8fa5a[_0x6b61('0x91')](_0x5c0fe1,_0x3bceac[0x1]===_0x6b61('0x93')?![]:!![]);});}if(!_[_0x6b61('0x79')](_0x5895af)){_0x8fa5a[_0x6b61('0x65')](_0x55c95b);_0x19ca28[_0x6b61('0x4f')](_0x6b61('0x94'),_0x5895af);}BPromise['resolve']()[_0x6b61('0x2d')](function(){if(!_0x2f88ca){if(_0x7779ad[_0x6b61('0x45')][_0x6b61('0x7a')])return;_0x19ca28[_0x6b61('0x4f')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x8fa5a[_0x6b61('0x4f')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x7779ad['user'][_0x6b61('0x95')]!==_0x6b61('0x96'))return;return _0x7779ad[_0x6b61('0x97')][_0x6b61('0x98')]({'attributes':['id'],'raw':!![]})['then'](function(_0xc5fda){if(_[_0x6b61('0x79')](_0xc5fda)){_0x19ca28['where'](_0x6b61('0x99'));_0x8fa5a[_0x6b61('0x4f')](_0x6b61('0x99'));}else{_0x19ca28[_0x6b61('0x4f')](_0x6b61('0x9a'),_[_0x6b61('0x33')](_0xc5fda,'id'));_0x8fa5a[_0x6b61('0x4f')](_0x6b61('0x9a'),_[_0x6b61('0x33')](_0xc5fda,'id'));}});})[_0x6b61('0x2d')](function(){if(_0x7779ad[_0x6b61('0x97')][_0x6b61('0x95')]==='agent'&&!_0x2f88ca&&!_0x7779ad[_0x6b61('0x45')]['SmsAccountId'])return[];return db[_0x6b61('0x9b')]['query'](_0x19ca28[_0x6b61('0x9c')](),_0x80f45a);})[_0x6b61('0x2d')](function(_0x505513){_0xba022f[_0x6b61('0x27')]=_0x505513[_0x6b61('0x4b')];if(_0xba022f[_0x6b61('0x27')]===0x0)return[];return db[_0x6b61('0x9b')][_0x6b61('0x45')](_0x325532[_0x6b61('0x9c')](),_0x80f45a)[_0x6b61('0x2d')](function(_0x456e60){_0x198702=_[_0x6b61('0x9d')](_0x456e60,'id');_0x80f45a=_[_0x6b61('0x9e')](_0x80f45a,{'model':db[_0x6b61('0x9f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x7779ad[_0x6b61('0x45')][_0x6b61('0x4a')]){_0x1ec8a9[_0x6b61('0x49')][_0x6b61('0x38')](function(_0x3d332b){_0x8fa5a[_0x6b61('0x50')]('i.'+_0x3d332b);});}else{_0x8fa5a[_0x6b61('0x50')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x6b61('0x63'));_0x8fa5a[_0x6b61('0x50')](_0x6b61('0xa0'),_0x6b61('0xa1'));_0x8fa5a['field'](_0x6b61('0xa2'),'Account.mandatoryDisposition');_0x8fa5a[_0x6b61('0x50')](_0x6b61('0xa3'),_0x6b61('0x92'));_0x8fa5a[_0x6b61('0x50')](_0x6b61('0xa4'));_0x8fa5a[_0x6b61('0x50')](_0x6b61('0xa5'),'Contact.firstName');_0x8fa5a[_0x6b61('0x50')]('c.lastName',_0x6b61('0xa6'));_0x8fa5a[_0x6b61('0x50')](_0x6b61('0xa7'),_0x6b61('0xa8'));_0x8fa5a[_0x6b61('0x50')](_0x6b61('0xa9'),_0x6b61('0xaa'));_0x8fa5a['field'](_0x6b61('0xab'),_0x6b61('0xac'));_0x8fa5a[_0x6b61('0x50')](_0x6b61('0xad'),_0x6b61('0xae'));_0x8fa5a[_0x6b61('0x50')](_0x6b61('0xaf'),_0x6b61('0xb0'));_0x8fa5a['field'](_0x6b61('0xb1'),_0x6b61('0xb2'));_0x8fa5a[_0x6b61('0x50')](_0x6b61('0xb3'),_0x6b61('0x35'));}if(_0x1ec8a9[_0x6b61('0x26')])_0x8fa5a[_0x6b61('0x26')](_0x1ec8a9['limit']);if(_0x1ec8a9[_0x6b61('0x24')])_0x8fa5a[_0x6b61('0x24')](_0x1ec8a9['offset']);return db[_0x6b61('0x9b')][_0x6b61('0x45')](_0x8fa5a[_0x6b61('0x9c')](),_0x80f45a);})[_0x6b61('0x2d')](function(_0x3271c0){if(_0x3271c0[_0x6b61('0x4b')]>0x0)_0x29b3bc[_0x6b61('0x4f')](_0x6b61('0xb4'),_[_0x6b61('0x33')](_0x3271c0,'id'));return db['sequelize'][_0x6b61('0x45')](_0x29b3bc['toString'](),_0x80f45a)[_0x6b61('0x2d')](function(_0x2965ff){var _0xf62a6f=_[_0x6b61('0xb5')](_0x2965ff,'SmsInteractionId');var _0x534975=[];_0x3271c0[_0x6b61('0x38')](function(_0x492871){_0x534975[_0x6b61('0x39')](updateSmsInteraction(_0x492871,_0x198702,_0xf62a6f));});return BPromise[_0x6b61('0xb6')](_0x534975);});});})[_0x6b61('0x2d')](function(_0x3f4470){_0xba022f[_0x6b61('0xb7')]=_0x3f4470;return _0xba022f;})['then'](respondWithFilteredResult(_0x2dde81,_0x1ec8a9))[_0x6b61('0x3a')](handleError(_0x2dde81,null));};exports[_0x6b61('0xb8')]=function(_0x3958b2,_0x12ddca){var _0x479f07={'raw':![],'where':{'id':_0x3958b2['params']['id']}},_0x426e41={};_0x426e41[_0x6b61('0x44')]=_[_0x6b61('0x46')](db[_0x6b61('0x9f')][_0x6b61('0x42')]);_0x426e41[_0x6b61('0x45')]=_['keys'](_0x3958b2[_0x6b61('0x45')]);_0x426e41['filters']=_[_0x6b61('0x48')](_0x426e41[_0x6b61('0x44')],_0x426e41[_0x6b61('0x45')]);_0x479f07[_0x6b61('0x49')]=_[_0x6b61('0x48')](_0x426e41[_0x6b61('0x44')],qs[_0x6b61('0x4a')](_0x3958b2['query']['fields']));_0x479f07[_0x6b61('0x49')]=_0x479f07['attributes']['length']?_0x479f07[_0x6b61('0x49')]:_0x426e41[_0x6b61('0x44')];if(_0x3958b2[_0x6b61('0x45')][_0x6b61('0xb9')]){_0x479f07[_0x6b61('0xba')]=[{'all':!![]}];}_0x479f07=_[_0x6b61('0x9e')]({},_0x479f07,_0x3958b2[_0x6b61('0xbb')]);return db[_0x6b61('0x9f')]['find'](_0x479f07)[_0x6b61('0x2d')](handleEntityNotFound(_0x12ddca,null))[_0x6b61('0x2d')](respondWithResult(_0x12ddca,null))['catch'](handleError(_0x12ddca,null));};exports['create']=function(_0xabedf2,_0x563e1b){return db['SmsInteraction']['create'](_0xabedf2['body'],{})[_0x6b61('0x2d')](respondWithResult(_0x563e1b,0xc9))[_0x6b61('0x3a')](handleError(_0x563e1b,null));};exports[_0x6b61('0x2b')]=function(_0x408524,_0x1766c0){if(_0x408524['body']['id']){delete _0x408524[_0x6b61('0xbc')]['id'];}return db[_0x6b61('0x9f')]['find']({'where':{'id':_0x408524[_0x6b61('0xbd')]['id']}})['then'](handleEntityNotFound(_0x1766c0,null))['then'](saveUpdates(_0x408524['body'],null))[_0x6b61('0x2d')](respondWithResult(_0x1766c0,null))[_0x6b61('0x3a')](handleError(_0x1766c0,null));};exports[_0x6b61('0x2c')]=function(_0x14079e,_0x359434){return db[_0x6b61('0x9f')][_0x6b61('0x75')]({'where':{'id':_0x14079e[_0x6b61('0xbd')]['id']}})[_0x6b61('0x2d')](handleEntityNotFound(_0x359434,null))['then'](removeEntity(_0x359434,null))['catch'](handleError(_0x359434,null));};exports['describe']=function(_0x5ddffe,_0x2df63a){return db[_0x6b61('0x9f')][_0x6b61('0xbe')]()['then'](respondWithResult(_0x2df63a,null))[_0x6b61('0x3a')](handleError(_0x2df63a,null));};exports[_0x6b61('0xbf')]=function(_0x4aa1fa,_0x1219d4,_0x4935ac){return db['SmsMessage'][_0x6b61('0x75')]({'where':{'id':_0x4aa1fa['params']['id']}})[_0x6b61('0x2d')](handleEntityNotFound(_0x1219d4,null))[_0x6b61('0x2d')](function(_0x448311){if(_0x448311){return _0x448311[_0x6b61('0xbf')](_0x4aa1fa[_0x6b61('0xbc')]['ids'],_[_0x6b61('0xc0')](_0x4aa1fa[_0x6b61('0xbc')],[_0x6b61('0xc1'),'id'])||{});}})[_0x6b61('0x2d')](respondWithResult(_0x1219d4,null))[_0x6b61('0x3a')](handleError(_0x1219d4,null));};exports['getMessages']=function(_0x54559a,_0x3cb885,_0x23bee8){var _0x2d00d8={'raw':![],'where':{}};var _0x424dcd={};var _0x222c52={'count':0x0,'rows':[]};return db[_0x6b61('0x9f')][_0x6b61('0xc2')]({'where':{'id':_0x54559a[_0x6b61('0xbd')]['id']}})[_0x6b61('0x2d')](handleEntityNotFound(_0x3cb885,null))[_0x6b61('0x2d')](function(_0x5a094e){if(_0x5a094e){_0x424dcd[_0x6b61('0x44')]=_[_0x6b61('0x46')](db[_0x6b61('0xc3')][_0x6b61('0x42')]);_0x424dcd[_0x6b61('0x45')]=_[_0x6b61('0x46')](_0x54559a[_0x6b61('0x45')]);_0x424dcd[_0x6b61('0x47')]=_[_0x6b61('0x48')](_0x424dcd['model'],_0x424dcd[_0x6b61('0x45')]);_0x2d00d8['attributes']=_[_0x6b61('0x48')](_0x424dcd[_0x6b61('0x44')],qs[_0x6b61('0x4a')](_0x54559a[_0x6b61('0x45')][_0x6b61('0x4a')]));_0x2d00d8[_0x6b61('0x49')]=_0x2d00d8['attributes'][_0x6b61('0x4b')]?_0x2d00d8[_0x6b61('0x49')]:_0x424dcd[_0x6b61('0x44')];if(!_0x54559a[_0x6b61('0x45')][_0x6b61('0x4c')](_0x6b61('0x4d'))){_0x2d00d8['limit']=qs[_0x6b61('0x26')](_0x54559a['query'][_0x6b61('0x26')]);_0x2d00d8[_0x6b61('0x24')]=qs[_0x6b61('0x24')](_0x54559a[_0x6b61('0x45')][_0x6b61('0x24')]);}_0x2d00d8[_0x6b61('0x91')]=qs[_0x6b61('0x4e')](_0x54559a[_0x6b61('0x45')][_0x6b61('0x4e')]);_0x2d00d8[_0x6b61('0x4f')]=qs[_0x6b61('0x47')](_[_0x6b61('0xc4')](_0x54559a['query'],_0x424dcd['filters']));_0x2d00d8['where'][_0x6b61('0xc5')]=_0x5a094e['id'];if(_0x54559a[_0x6b61('0x45')][_0x6b61('0x85')]){_0x2d00d8['where']=_[_0x6b61('0x9e')](_0x2d00d8[_0x6b61('0x4f')],{'$or':_['map'](_0x2d00d8[_0x6b61('0x49')],function(_0x449683){var _0x18bf10={};_0x18bf10[_0x449683]={'$like':'%'+_0x54559a['query']['filter']+'%'};return _0x18bf10;})});}if(_0x54559a[_0x6b61('0x45')][_0x6b61('0xc6')]){var _0x4f180b=_0x54559a[_0x6b61('0x45')][_0x6b61('0xc6')][_0x6b61('0x37')](',');var _0x39babd={};_0x39babd[_0x4f180b[0x0]]={'$gte':moment(_0x4f180b[0x1])[_0x6b61('0xc7')](_0x6b61('0xc8'))};_0x2d00d8['where']=_[_0x6b61('0x9e')](_0x2d00d8[_0x6b61('0x4f')],_0x39babd);}_0x2d00d8=_[_0x6b61('0x9e')]({},_0x2d00d8,_0x54559a['options']);return db['SmsMessage'][_0x6b61('0x27')]({'where':_0x2d00d8['where']})[_0x6b61('0x2d')](function(_0x3bc0c5){_0x222c52[_0x6b61('0x27')]=_0x3bc0c5;if(_0x54559a['query'][_0x6b61('0xb9')]){_0x2d00d8['include']=[{'all':!![]}];}return db[_0x6b61('0xc3')][_0x6b61('0xc9')](_0x2d00d8);})[_0x6b61('0x2d')](function(_0x356154){_0x222c52[_0x6b61('0xb7')]=_0x356154;return _0x222c52;});}})[_0x6b61('0x2d')](respondWithFilteredResult(_0x3cb885,_0x2d00d8))[_0x6b61('0x3a')](handleError(_0x3cb885,null));};exports[_0x6b61('0xca')]=function(_0x1e4c47,_0x730899,_0x33d44c){return db[_0x6b61('0x9f')][_0x6b61('0x75')]({'where':{'id':_0x1e4c47[_0x6b61('0xbd')]['id']}})[_0x6b61('0x2d')](handleEntityNotFound(_0x730899,null))[_0x6b61('0x2d')](function(_0x58aa89){if(_0x58aa89){return _0x58aa89[_0x6b61('0xcb')](_0x1e4c47[_0x6b61('0xbc')][_0x6b61('0xc1')],_[_0x6b61('0xc0')](_0x1e4c47['body'],[_0x6b61('0xc1'),'id'])||{})[_0x6b61('0xcc')](function(){return db[_0x6b61('0x71')][_0x6b61('0xc9')]({'attributes':['id',_0x6b61('0x30'),'color'],'where':{'id':_0x1e4c47[_0x6b61('0xbc')][_0x6b61('0xc1')]}});})[_0x6b61('0x2d')](function(_0x2802cd){socket[_0x6b61('0xcd')]('smsInteractionTags:save',{'id':Number(_0x1e4c47[_0x6b61('0xbd')]['id']),'tags':_0x2802cd||[]});return{'id':Number(_0x1e4c47[_0x6b61('0xbd')]['id']),'tags':_0x2802cd||[]};});}})[_0x6b61('0x2d')](respondWithResult(_0x730899,null))[_0x6b61('0x3a')](handleError(_0x730899,null));};exports[_0x6b61('0xce')]=function(_0x3b4917,_0x4a5d37,_0x5ea24c){return db[_0x6b61('0x9f')][_0x6b61('0x75')]({'where':{'id':_0x3b4917[_0x6b61('0xbd')]['id']}})['then'](handleEntityNotFound(_0x4a5d37,null))[_0x6b61('0x2d')](function(_0x3489b0){if(_0x3489b0){return _0x3489b0[_0x6b61('0xce')](_0x3b4917[_0x6b61('0x45')][_0x6b61('0xc1')]);}})['then'](respondWithStatusCode(_0x4a5d37,null))[_0x6b61('0x3a')](handleError(_0x4a5d37,null));};exports['download']=function(_0x4873d9,_0x2e5ed9){var _0x4c13b2=moment()['unix']()[_0x6b61('0x9c')]();var _0x28394e=path[_0x6b61('0xcf')](config[_0x6b61('0xd0')],'server',_0x6b61('0xd1'),_0x6b61('0xd2'));var _0x3dae21=path[_0x6b61('0xcf')](config['root'],'server',_0x6b61('0xd1'),_0x6b61('0xd3'));var _0x39c3a6=path[_0x6b61('0xcf')](_0x28394e,_0x4c13b2);var _0x48b874=util[_0x6b61('0xc7')]('transcript-%d-%s.zip',_0x4873d9[_0x6b61('0xbd')]['id'],_0x4c13b2);var _0x5edf7d=path['join'](_0x28394e,_0x48b874);var _0x369166=[];_0x369166[_0x6b61('0x39')]({'model':db['User'],'as':_0x6b61('0x73'),'attributes':['id',_0x6b61('0x34')],'raw':!![]});_0x369166[_0x6b61('0x39')]({'model':db['CmContact'],'as':_0x6b61('0xd4'),'attributes':['id',_0x6b61('0xd5'),_0x6b61('0xd6')],'raw':!![]});var _0x46670f=[{'model':db[_0x6b61('0xc3')],'as':'Messages','attributes':['id',_0x6b61('0xbc'),_0x6b61('0xd7'),_0x6b61('0xd8'),'secret',_0x6b61('0x80')],'include':_0x369166}];_0x46670f['push']({'model':db[_0x6b61('0xd9')],'as':'Account','attributes':['id',_0x6b61('0x30')]});_0x46670f[_0x6b61('0x39')]({'model':db['User'],'as':'Owner','attributes':['id',_0x6b61('0x34')]});return db[_0x6b61('0x9f')]['find']({'where':{'id':_0x4873d9[_0x6b61('0xbd')]['id']},'include':_0x46670f})[_0x6b61('0x2d')](handleEntityNotFound(_0x2e5ed9,null))['then'](function(_0x4c2c7b){if(_0x4c2c7b){var _0x39f9e7=_0x4c2c7b[_0x6b61('0xda')]({'plain':!![]});fs['mkdirSync'](_0x39c3a6);var _0x1ce966={'channel':_0x6b61('0xdb'),'account':_0x39f9e7['Account'][_0x6b61('0x30')],'agent':_0x39f9e7['Owner']?_0x39f9e7['Owner']['fullname']:_0x6b61('0xdc'),'createdAt':moment(_0x39f9e7[_0x6b61('0xd7')])['format'](_0x6b61('0xc8'))[_0x6b61('0x9c')](),'closedAt':_0x39f9e7[_0x6b61('0x3d')]?moment(_0x39f9e7['closedAt'])[_0x6b61('0xc7')](_0x6b61('0xc8'))[_0x6b61('0x9c')]():'','disposition':_0x39f9e7[_0x6b61('0xdd')],'messages':_(_0x39f9e7[_0x6b61('0xde')])['filter']({'secret':![]})[_0x6b61('0x33')](function(_0x4ed0f5){return{'date':moment(_0x4ed0f5[_0x6b61('0xd7')])[_0x6b61('0xc7')](_0x6b61('0xc8'))[_0x6b61('0x9c')](),'sender':_0x4ed0f5['direction']===_0x6b61('0xdf')?_0x4ed0f5[_0x6b61('0x73')]?_0x4ed0f5['User'][_0x6b61('0x34')]:_0x6b61('0xe0'):_0x4ed0f5['Contact'][_0x6b61('0xd5')]+(_0x4ed0f5[_0x6b61('0xd4')]['lastName']?'\x20'+_0x4ed0f5[_0x6b61('0xd4')][_0x6b61('0xd6')]:''),'body':_0x4ed0f5['body'],'direction':_0x4ed0f5[_0x6b61('0xd8')]==='out'?'A':'C','secret':_0x4ed0f5[_0x6b61('0xe1')],'read':_0x4ed0f5[_0x6b61('0x80')]};})[_0x6b61('0x64')]()};return ejs[_0x6b61('0xe2')](path[_0x6b61('0xcf')](config[_0x6b61('0xd0')],_0x6b61('0xe3'),_0x6b61('0xe4'),_0x6b61('0xe5')),{'interaction':_0x1ce966})[_0x6b61('0x2d')](function(_0x297664){var _0x3d9b42=path[_0x6b61('0xcf')](_0x39c3a6,'transcript-'+_0x39f9e7['id']+'-'+_0x4c13b2+_0x6b61('0xe6'));var _0x1e045f={'path':_0x3d9b42,'channel':_0x6b61('0xdb'),'interactionId':_0x39f9e7['id']};return pdf[_0x6b61('0xe7')](_0x297664,_0x1e045f);})['then'](function(){return new BPromise(function(_0x4cc1c7,_0x201eca){zipdir(_0x39c3a6,{'saveTo':_0x5edf7d},function(_0x3ba99f,_0x4e97a0){if(_0x3ba99f)return _0x201eca(_0x3ba99f);return _0x4cc1c7(_0x4e97a0);});})[_0x6b61('0x2d')](function(){return new BPromise(function(_0x4d1c5c,_0x26bc04){rimraf(_0x39c3a6,function(_0x39a29e){if(_0x39a29e)_0x26bc04(_0x39a29e);return _0x4d1c5c();});});})[_0x6b61('0x2d')](function(){return _0x2e5ed9[_0x6b61('0xe8')](_0x5edf7d,_0x48b874,function(_0x21ead6){if(_0x21ead6){console[_0x6b61('0xe9')](_0x6b61('0xea'),_0x21ead6);}else{fs[_0x6b61('0xeb')](_0x5edf7d);}});});});}else{return _0x2e5ed9[_0x6b61('0x20')](0xc8);}})['catch'](handleError(_0x2e5ed9,null));}; \ No newline at end of file +var _0xa216=['Messages','out','System','lastName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','log','err','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','fullname','TagIds','forEach','Tags','push','catch','waiting','talking','unmanaged','closed','UserId','total','index','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','select','field','u.fullname','from','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','split','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','start','some','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','$gte','$lte','where','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','role','agent','sequelize','toString','merge','SmsInteraction','fields','a.key','Account.key','a.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','SmsInteractionId','rows','show','params','include','options','create','describe','SmsMessage','addMessage','ids','omit','findOne','pick','format','YYYY-MM-DD\x20HH:mm:ss','addTags','spread','smsInteractionTags:save','removeTags','unix','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','CmContact','firstName','direction','secret','SmsAccount','Account','Owner','get','mkdirSync','Sms','N.A.','closedAt','disposition'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0xa216,0xf4));var _0x6a21=function(_0x5b0f5a,_0x229787){_0x5b0f5a=_0x5b0f5a-0x0;var _0x4c0a72=_0xa216[_0x5b0f5a];return _0x4c0a72;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6a21('0x0'));var zipdir=require(_0x6a21('0x1'));var jsonpatch=require(_0x6a21('0x2'));var rp=require(_0x6a21('0x3'));var moment=require(_0x6a21('0x4'));var BPromise=require(_0x6a21('0x5'));var Mustache=require(_0x6a21('0x6'));var util=require(_0x6a21('0x7'));var path=require(_0x6a21('0x8'));var sox=require('sox');var csv=require(_0x6a21('0x9'));var ejs=require(_0x6a21('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6a21('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6a21('0x9'));var querystring=require(_0x6a21('0xc'));var Papa=require(_0x6a21('0xd'));var Redis=require(_0x6a21('0xe'));var authService=require(_0x6a21('0xf'));var qs=require(_0x6a21('0x10'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x6a21('0x11'));var hardwareService=require(_0x6a21('0x12'));var logger=require(_0x6a21('0x13'))(_0x6a21('0x14'));var utils=require(_0x6a21('0x15'));var config=require(_0x6a21('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6a21('0x17'))['db'];config[_0x6a21('0x18')]=_['defaults'](config['redis'],{'host':_0x6a21('0x19'),'port':0x18eb});var socket=require(_0x6a21('0x1a'))(new Redis(config[_0x6a21('0x18')]));require(_0x6a21('0x1b'))[_0x6a21('0x1c')](socket);function respondWithStatusCode(_0xda6424,_0x1ea6ee){_0x1ea6ee=_0x1ea6ee||0xcc;return function(_0x360e2e){if(_0x360e2e){return _0xda6424[_0x6a21('0x1d')](_0x1ea6ee);}return _0xda6424[_0x6a21('0x1e')](_0x1ea6ee)[_0x6a21('0x1f')]();};}function respondWithResult(_0x3cb81a,_0x4525e8){_0x4525e8=_0x4525e8||0xc8;return function(_0x4e7cf7){if(_0x4e7cf7){return _0x3cb81a[_0x6a21('0x1e')](_0x4525e8)[_0x6a21('0x20')](_0x4e7cf7);}};}function respondWithFilteredResult(_0x2b823b,_0xf55225){return function(_0x101eda){if(_0x101eda){var _0x37e3dd=typeof _0xf55225[_0x6a21('0x21')]===_0x6a21('0x22')&&typeof _0xf55225[_0x6a21('0x23')]===_0x6a21('0x22');var _0x84bd1f=_0x101eda['count'];var _0x2643bc=_0x37e3dd?0x0:_0xf55225[_0x6a21('0x21')];var _0x201ed3=_0x37e3dd?_0x101eda[_0x6a21('0x24')]:_0xf55225[_0x6a21('0x21')]+_0xf55225[_0x6a21('0x23')];var _0x1279c8;if(_0x201ed3>=_0x84bd1f){_0x201ed3=_0x84bd1f;_0x1279c8=0xc8;}else{_0x1279c8=0xce;}_0x2b823b[_0x6a21('0x1e')](_0x1279c8);return _0x2b823b[_0x6a21('0x25')](_0x6a21('0x26'),_0x2643bc+'-'+_0x201ed3+'/'+_0x84bd1f)['json'](_0x101eda);}return null;};}function patchUpdates(_0x4c601a){return function(_0x2e976f){try{jsonpatch['apply'](_0x2e976f,_0x4c601a,!![]);}catch(_0x4625ef){return BPromise[_0x6a21('0x27')](_0x4625ef);}return _0x2e976f[_0x6a21('0x28')]();};}function saveUpdates(_0x31d6ee,_0x25b6ae){return function(_0xe52375){if(_0xe52375){return _0xe52375[_0x6a21('0x29')](_0x31d6ee)[_0x6a21('0x2a')](function(_0x3d69f9){return _0x3d69f9;});}return null;};}function removeEntity(_0x3d445e,_0x358fd0){return function(_0x4e4e32){if(_0x4e4e32){return _0x4e4e32[_0x6a21('0x2b')]()[_0x6a21('0x2a')](function(){_0x3d445e[_0x6a21('0x1e')](0xcc)[_0x6a21('0x1f')]();});}};}function handleEntityNotFound(_0x45aa2b,_0xbad9b8){return function(_0x43ef3b){if(!_0x43ef3b){_0x45aa2b[_0x6a21('0x1d')](0x194);}return _0x43ef3b;};}function handleError(_0x10e6a6,_0x2e886e){_0x2e886e=_0x2e886e||0x1f4;return function(_0x1284cb){logger[_0x6a21('0x2c')](_0x1284cb[_0x6a21('0x2d')]);if(_0x1284cb[_0x6a21('0x2e')]){delete _0x1284cb[_0x6a21('0x2e')];}_0x10e6a6[_0x6a21('0x1e')](_0x2e886e)[_0x6a21('0x2f')](_0x1284cb);};}function getInteractionUsers(_0x4441a7,_0x42775d){return new BPromise(function(_0x40eefd,_0x11ec7d){try{if(_0x42775d[_0x4441a7['id']]){_0x4441a7['Users']=_[_0x6a21('0x30')](_0x42775d[_0x4441a7['id']],function(_0x570920){return{'id':_0x570920['id'],'fullname':_0x570920[_0x6a21('0x31')]};});}}catch(_0x511df4){_0x11ec7d(_0x511df4);}_0x40eefd(_0x4441a7);});}function getInteractionTags(_0x2df5a0,_0x1550f8){return new BPromise(function(_0x5e032e,_0x51a606){try{if(_0x2df5a0[_0x6a21('0x32')]){_0x2df5a0['Tags']=[];_0x2df5a0[_0x6a21('0x32')]['split'](',')[_0x6a21('0x33')](function(_0x697257){_0x2df5a0[_0x6a21('0x34')][_0x6a21('0x35')](_0x1550f8[_0x697257]);});}delete _0x2df5a0['TagIds'];}catch(_0x2604e3){_0x51a606(_0x2604e3);}_0x5e032e(_0x2df5a0);});}function updateSmsInteraction(_0x33a8dd,_0x8fff3d,_0xa87394){return new BPromise(function(_0x94bad9,_0xd60dae){return getInteractionUsers(_0x33a8dd,_0xa87394)[_0x6a21('0x2a')](function(_0x4b2f42){return getInteractionTags(_0x4b2f42,_0x8fff3d);})[_0x6a21('0x2a')](function(_0x30a8de){return getStateInteraction(_0x30a8de);})[_0x6a21('0x2a')](function(_0x22fd81){_0x94bad9(_0x22fd81);})[_0x6a21('0x36')](function(_0x164532){_0xd60dae(_0x164532);});});}function getStateInteraction(_0x3d5d4e){return new BPromise(function(_0x57c15f){_0x3d5d4e[_0x6a21('0x37')]=0x0;_0x3d5d4e[_0x6a21('0x38')]=0x0;_0x3d5d4e['answered']=0x0;_0x3d5d4e[_0x6a21('0x39')]=0x0;_0x3d5d4e['total']=0x0;if(!_0x3d5d4e[_0x6a21('0x3a')]&&!_0x3d5d4e[_0x6a21('0x3b')]){_0x3d5d4e[_0x6a21('0x37')]+=0x1;}if(!_0x3d5d4e[_0x6a21('0x3a')]&&_0x3d5d4e[_0x6a21('0x3b')]){_0x3d5d4e['talking']+=0x1;if(_0x3d5d4e['waiting']){_0x3d5d4e['waiting']-=0x1;}}if(_0x3d5d4e[_0x6a21('0x3a')]&&_0x3d5d4e[_0x6a21('0x3b')]){_0x3d5d4e['answered']+=0x1;if(_0x3d5d4e[_0x6a21('0x38')]){_0x3d5d4e[_0x6a21('0x38')]-=0x1;}}if(_0x3d5d4e[_0x6a21('0x3a')]&&!_0x3d5d4e['UserId']){_0x3d5d4e[_0x6a21('0x39')]+=0x1;if(_0x3d5d4e['waiting']){_0x3d5d4e[_0x6a21('0x37')]-=0x1;}}_0x3d5d4e[_0x6a21('0x3c')]+=0x1;_0x57c15f(_0x3d5d4e);});}exports[_0x6a21('0x3d')]=function(_0x1297ff,_0x43c8c0){var _0x477f7d={},_0x1897b8={},_0x1f8cb8={'count':0x0,'rows':[]};var _0x4ae30b=_[_0x6a21('0x30')](db['SmsInteraction'][_0x6a21('0x3e')],function(_0x21cd8a){return{'name':_0x21cd8a[_0x6a21('0x3f')],'type':_0x21cd8a[_0x6a21('0x40')][_0x6a21('0x41')]};});_0x1897b8['model']=_[_0x6a21('0x30')](_0x4ae30b,_0x6a21('0x2e'));_0x1897b8[_0x6a21('0x42')]=_[_0x6a21('0x43')](_0x1297ff[_0x6a21('0x42')]);_0x1897b8[_0x6a21('0x44')]=_[_0x6a21('0x45')](_0x1897b8[_0x6a21('0x46')],_0x1897b8[_0x6a21('0x42')]);_0x477f7d[_0x6a21('0x47')]=_[_0x6a21('0x45')](_0x1897b8[_0x6a21('0x46')],qs['fields'](_0x1297ff[_0x6a21('0x42')]['fields']));_0x477f7d['attributes']=_0x477f7d['attributes'][_0x6a21('0x48')]?_0x477f7d[_0x6a21('0x47')]:_0x1897b8[_0x6a21('0x46')];if(!_0x1297ff['query'][_0x6a21('0x49')](_0x6a21('0x4a'))){_0x477f7d[_0x6a21('0x23')]=qs[_0x6a21('0x23')](_0x1297ff[_0x6a21('0x42')][_0x6a21('0x23')]);_0x477f7d[_0x6a21('0x21')]=qs['offset'](_0x1297ff['query'][_0x6a21('0x21')]);}_0x477f7d[_0x6a21('0x4b')]=qs['sort'](_0x1297ff[_0x6a21('0x42')][_0x6a21('0x4c')]);_0x477f7d['where']=qs[_0x6a21('0x44')](_['pick'](_0x1297ff[_0x6a21('0x42')],_0x1897b8[_0x6a21('0x44')]),_0x4ae30b);var _0x246004=[];var _0x4cf5b1=squel[_0x6a21('0x4d')]()[_0x6a21('0x4e')]('id')[_0x6a21('0x4e')](_0x6a21('0x2e'))[_0x6a21('0x4e')]('color')['from']('tools_tags');var _0x18b13a=squel[_0x6a21('0x4d')]()['field']('u.id')[_0x6a21('0x4e')](_0x6a21('0x4f'))['field']('ui.SmsInteractionId')[_0x6a21('0x50')](_0x6a21('0x51'),'ui')[_0x6a21('0x52')](_0x6a21('0x53'),'u',_0x6a21('0x54'));var _0x2709ba=squel[_0x6a21('0x4d')]()[_0x6a21('0x50')](_0x6a21('0x55'),'i')[_0x6a21('0x52')](_0x6a21('0x56'),'c',_0x6a21('0x57'))['left_join'](_0x6a21('0x53'),'o',_0x6a21('0x58'))[_0x6a21('0x52')](_0x6a21('0x59'),'a','a.id\x20=\x20i.SmsAccountId')['left_join']('sms_messages','me','me.SmsInteractionId\x20=\x20i.id')[_0x6a21('0x52')](_0x6a21('0x5a'),'it',_0x6a21('0x5b'))[_0x6a21('0x52')]('tools_tags','t',_0x6a21('0x5c'));var _0x10af09=squel['expr']();var _0x21cac9=[];var _0x34aa4d=squel[_0x6a21('0x5d')]();var _0x4a44ad;if(_0x1297ff[_0x6a21('0x42')][_0x6a21('0x5e')]){_0x4a44ad=as[_0x6a21('0x5f')](_0x1297ff[_0x6a21('0x42')][_0x6a21('0x5e')]);var _0x15bf5f=_0x4a44ad['sqlOperator'];for(var _0x31cb7c=0x0;_0x31cb7c<_0x4a44ad[_0x6a21('0x60')][_0x6a21('0x48')];_0x31cb7c++){var _0x5afaec=_0x4a44ad[_0x6a21('0x60')][_0x31cb7c];var _0x152b83='i';var _0x432455=_[_0x6a21('0x61')](_0x4ae30b,[_0x6a21('0x2e'),_0x5afaec['field']]);if(!_0x432455){switch(_0x5afaec[_0x6a21('0x4e')]){case _0x6a21('0x62'):if(_0x5afaec[_0x6a21('0x63')]==0x1){_0x2709ba[_0x6a21('0x64')]('`'+_0x5afaec['field']+'`\x20=\x200');}else{_0x2709ba['having']('`'+_0x5afaec['field']+_0x6a21('0x65'));}break;case _0x6a21('0x66'):if(_0x5afaec['operator']==='$substring'){if(_0x5afaec[_0x6a21('0x63')][_0x6a21('0x67')]('\x20')['length']>0x1){_0x10af09[_0x15bf5f]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5afaec[_0x6a21('0x63')]),null);}else{var _0x21cf13='%'+_0x5afaec[_0x6a21('0x63')]+'%';_0x10af09[_0x15bf5f](_0x6a21('0x68'),_0x21cf13,_0x21cf13,_0x21cf13);}}else{_0x432455=_[_0x6a21('0x61')](_0x4ae30b,['name','ContactId']);_0x5afaec[_0x6a21('0x4e')]=_0x6a21('0x69');_0x2be347=as[_0x6a21('0x6a')](_0x152b83,_0x432455[_0x6a21('0x40')],_0x5afaec);_0x10af09[_0x15bf5f](_0x2be347[_0x6a21('0x6b')],_0x2be347['value']['start'],_0x2be347[_0x6a21('0x63')][_0x6a21('0x1f')]);}break;case _0x6a21('0x6c'):var _0x444c03=_0x5afaec[_0x6a21('0x63')][_0x6a21('0x67')](',')[_0x6a21('0x30')](function(_0x165cde){return Number(_0x165cde);});_0x444c03[_0x6a21('0x33')](function(_0x23488c){_0x34aa4d['or'](_0x6a21('0x6d'),'%,'+_0x23488c+',%');});_0x21cac9=_[_0x6a21('0x6e')](_0x21cac9,_0x444c03);break;case _0x6a21('0x6f'):if(_0x5afaec[_0x6a21('0x70')]===_0x6a21('0x71')){_0x10af09[_0x15bf5f](_0x6a21('0x72'),'%'+_0x5afaec[_0x6a21('0x63')]+'%',null);}else{_0x432455=_[_0x6a21('0x61')](_0x4ae30b,[_0x6a21('0x2e'),_0x6a21('0x3b')]);_0x5afaec[_0x6a21('0x4e')]='UserId';_0x2be347=as[_0x6a21('0x6a')](_0x152b83,_0x432455[_0x6a21('0x40')],_0x5afaec);_0x10af09[_0x15bf5f](_0x2be347[_0x6a21('0x6b')],_0x2be347['value']['start'],_0x2be347[_0x6a21('0x63')][_0x6a21('0x1f')]);}break;case _0x6a21('0x73'):_0x2be347=as['buildExpression']('me',null,_0x5afaec);_0x10af09[_0x15bf5f](_0x2be347[_0x6a21('0x6b')],_0x2be347[_0x6a21('0x63')][_0x6a21('0x74')],_0x2be347[_0x6a21('0x63')][_0x6a21('0x1f')]);break;}}else{var _0x2be347=as[_0x6a21('0x6a')](_0x152b83,_0x432455[_0x6a21('0x40')],_0x5afaec);_0x10af09[_0x15bf5f](_0x2be347[_0x6a21('0x6b')],_0x2be347[_0x6a21('0x63')]['start'],_0x2be347[_0x6a21('0x63')][_0x6a21('0x1f')]);}}}else{var _0x1e36d6=_(_0x1297ff[_0x6a21('0x42')])[_0x6a21('0x43')]()[_0x6a21('0x30')](function(_0x4b5207){return _[_0x6a21('0x75')](_0x4ae30b,[_0x6a21('0x2e'),_0x4b5207])?_0x4b5207:undefined;})['compact']()[_0x6a21('0x63')]();if(!_[_0x6a21('0x76')](_0x1e36d6)){_0x1e36d6[_0x6a21('0x33')](function(_0xf06a87){if(_0xf06a87===_0x6a21('0x77')){_0x2709ba['where'](_0x6a21('0x78'),[][_0x6a21('0x79')](_0x1297ff['query'][_0xf06a87]));}else if(_0xf06a87===_0x6a21('0x7a')){var _0x259add=JSON['parse'](_0x1297ff[_0x6a21('0x42')][_0xf06a87])[_0x6a21('0x7b')];var _0x38321e=JSON['parse'](_0x1297ff[_0x6a21('0x42')][_0xf06a87])[_0x6a21('0x7c')];_0x2709ba[_0x6a21('0x7d')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x259add,_0x38321e);}else{if(_0x1297ff[_0x6a21('0x42')][_0xf06a87]===_0x6a21('0x7e')){_0x2709ba[_0x6a21('0x7d')]('i.'+_0xf06a87+_0x6a21('0x7f'));}else{_0x2709ba['where']('i.'+_0xf06a87+'\x20=\x20?',_0x1297ff[_0x6a21('0x42')][_0xf06a87]);}}});}if(_0x1297ff['query'][_0x6a21('0x80')]){if(_0x1297ff[_0x6a21('0x42')][_0x6a21('0x80')]==0x1){_0x2709ba['having'](_0x6a21('0x81'));}else{_0x2709ba[_0x6a21('0x64')](_0x6a21('0x82'));}}if(_0x1297ff['query'][_0x6a21('0x83')]){_0x21cac9=_[_0x6a21('0x84')](_0x1297ff[_0x6a21('0x42')][_0x6a21('0x83')])?_0x1297ff['query']['tag']:new Array(_0x1297ff['query'][_0x6a21('0x83')]);_0x21cac9[_0x6a21('0x33')](function(_0x56dea7){_0x34aa4d['or'](_0x6a21('0x6d'),'%,'+_0x56dea7+',%');});}if(_0x1297ff[_0x6a21('0x42')][_0x6a21('0x85')]){var _0x4182df=_0x1297ff[_0x6a21('0x42')]['filter'][_0x6a21('0x86')]('\x5c','\x5c\x5c')[_0x6a21('0x86')](/'/g,'\x27\x27');if(qs[_0x6a21('0x87')](_0x4182df)){_0x10af09['or']('i.id\x20LIKE\x20?',_0x4182df+'%')['or'](_0x6a21('0x88'),_0x4182df+'%');}else{_0x10af09['or'](_0x6a21('0x89'),qs[_0x6a21('0x8a')](_0x4182df))['or'](_0x6a21('0x8b'),_0x4182df+'%');}}}_0x2709ba[_0x6a21('0x7d')](_0x10af09);_0x2709ba[_0x6a21('0x8c')](_0x6a21('0x8d'));var _0x20116a={'type':db['Sequelize'][_0x6a21('0x8e')][_0x6a21('0x8f')],'raw':!![]};var _0x20ee08=_0x2709ba['clone']();_0x20ee08['field'](_0x6a21('0x8d'));_0x20ee08['field'](_0x6a21('0x90'),'unreadMessages');if(_0x477f7d[_0x6a21('0x4b')]){_0x477f7d['order'][_0x6a21('0x33')](function(_0x5469bc){var _0x254c84=_0x5469bc[0x0]===_0x6a21('0x91')?_0x5469bc[0x0]:'i.'+_0x5469bc[0x0];_0x2709ba[_0x6a21('0x4b')](_0x254c84,_0x5469bc[0x1]===_0x6a21('0x92')?![]:!![]);});}if(!_[_0x6a21('0x76')](_0x21cac9)){_0x2709ba[_0x6a21('0x64')](_0x34aa4d);_0x20ee08[_0x6a21('0x7d')](_0x6a21('0x93'),_0x21cac9);}BPromise['resolve']()[_0x6a21('0x2a')](function(){if(!_0x4a44ad){if(_0x1297ff[_0x6a21('0x42')][_0x6a21('0x77')])return;_0x20ee08['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x2709ba['where'](_0x6a21('0x94'));return;}if(_0x1297ff[_0x6a21('0x95')]['role']!=='agent')return;return _0x1297ff[_0x6a21('0x95')][_0x6a21('0x96')]({'attributes':['id'],'raw':!![]})[_0x6a21('0x2a')](function(_0x5e3e4b){if(_['isEmpty'](_0x5e3e4b)){_0x20ee08[_0x6a21('0x7d')](_0x6a21('0x97'));_0x2709ba[_0x6a21('0x7d')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x20ee08[_0x6a21('0x7d')](_0x6a21('0x78'),_[_0x6a21('0x30')](_0x5e3e4b,'id'));_0x2709ba[_0x6a21('0x7d')](_0x6a21('0x78'),_['map'](_0x5e3e4b,'id'));}});})[_0x6a21('0x2a')](function(){if(_0x1297ff[_0x6a21('0x95')][_0x6a21('0x98')]===_0x6a21('0x99')&&!_0x4a44ad&&!_0x1297ff[_0x6a21('0x42')][_0x6a21('0x77')])return[];return db[_0x6a21('0x9a')][_0x6a21('0x42')](_0x20ee08[_0x6a21('0x9b')](),_0x20116a);})[_0x6a21('0x2a')](function(_0x29074a){_0x1f8cb8[_0x6a21('0x24')]=_0x29074a[_0x6a21('0x48')];if(_0x1f8cb8[_0x6a21('0x24')]===0x0)return[];return db[_0x6a21('0x9a')][_0x6a21('0x42')](_0x4cf5b1[_0x6a21('0x9b')](),_0x20116a)[_0x6a21('0x2a')](function(_0x53ce88){_0x246004=_['keyBy'](_0x53ce88,'id');_0x20116a=_[_0x6a21('0x9c')](_0x20116a,{'model':db[_0x6a21('0x9d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1297ff['query'][_0x6a21('0x9e')]){_0x477f7d['attributes'][_0x6a21('0x33')](function(_0x3f2d8d){_0x2709ba[_0x6a21('0x4e')]('i.'+_0x3f2d8d);});}else{_0x2709ba['field'](_0x6a21('0x90'),_0x6a21('0x62'));_0x2709ba['field'](_0x6a21('0x9f'),_0x6a21('0xa0'));_0x2709ba['field'](_0x6a21('0xa1'),'Account.mandatoryDisposition');_0x2709ba[_0x6a21('0x4e')]('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',_0x6a21('0x91'));_0x2709ba['field'](_0x6a21('0xa2'));_0x2709ba[_0x6a21('0x4e')]('c.firstName',_0x6a21('0xa3'));_0x2709ba[_0x6a21('0x4e')](_0x6a21('0xa4'),_0x6a21('0xa5'));_0x2709ba['field'](_0x6a21('0xa6'),_0x6a21('0xa7'));_0x2709ba[_0x6a21('0x4e')](_0x6a21('0xa8'),_0x6a21('0xa9'));_0x2709ba[_0x6a21('0x4e')](_0x6a21('0xaa'),'Contact.mobile');_0x2709ba[_0x6a21('0x4e')](_0x6a21('0xab'),'Contact.fax');_0x2709ba[_0x6a21('0x4e')](_0x6a21('0xac'),_0x6a21('0xad'));_0x2709ba[_0x6a21('0x4e')]('o.internal',_0x6a21('0xae'));_0x2709ba[_0x6a21('0x4e')](_0x6a21('0xaf'),_0x6a21('0x32'));}if(_0x477f7d['limit'])_0x2709ba[_0x6a21('0x23')](_0x477f7d['limit']);if(_0x477f7d[_0x6a21('0x21')])_0x2709ba[_0x6a21('0x21')](_0x477f7d[_0x6a21('0x21')]);return db['sequelize'][_0x6a21('0x42')](_0x2709ba[_0x6a21('0x9b')](),_0x20116a);})[_0x6a21('0x2a')](function(_0x269d2b){if(_0x269d2b[_0x6a21('0x48')]>0x0)_0x18b13a[_0x6a21('0x7d')]('ui.SmsInteractionId\x20IN\x20?',_[_0x6a21('0x30')](_0x269d2b,'id'));return db['sequelize']['query'](_0x18b13a[_0x6a21('0x9b')](),_0x20116a)[_0x6a21('0x2a')](function(_0x4a1594){var _0x5cc39b=_[_0x6a21('0xb0')](_0x4a1594,_0x6a21('0xb1'));var _0x4ff624=[];_0x269d2b[_0x6a21('0x33')](function(_0x3f87c7){_0x4ff624[_0x6a21('0x35')](updateSmsInteraction(_0x3f87c7,_0x246004,_0x5cc39b));});return BPromise['all'](_0x4ff624);});});})[_0x6a21('0x2a')](function(_0x1cd218){_0x1f8cb8[_0x6a21('0xb2')]=_0x1cd218;return _0x1f8cb8;})[_0x6a21('0x2a')](respondWithFilteredResult(_0x43c8c0,_0x477f7d))[_0x6a21('0x36')](handleError(_0x43c8c0,null));};exports[_0x6a21('0xb3')]=function(_0x4a08db,_0x20e265){var _0x41364b={'raw':![],'where':{'id':_0x4a08db[_0x6a21('0xb4')]['id']}},_0x2b0c9c={};_0x2b0c9c[_0x6a21('0x46')]=_['keys'](db[_0x6a21('0x9d')][_0x6a21('0x3e')]);_0x2b0c9c[_0x6a21('0x42')]=_[_0x6a21('0x43')](_0x4a08db['query']);_0x2b0c9c[_0x6a21('0x44')]=_['intersection'](_0x2b0c9c[_0x6a21('0x46')],_0x2b0c9c['query']);_0x41364b[_0x6a21('0x47')]=_[_0x6a21('0x45')](_0x2b0c9c[_0x6a21('0x46')],qs[_0x6a21('0x9e')](_0x4a08db['query'][_0x6a21('0x9e')]));_0x41364b['attributes']=_0x41364b[_0x6a21('0x47')][_0x6a21('0x48')]?_0x41364b[_0x6a21('0x47')]:_0x2b0c9c[_0x6a21('0x46')];if(_0x4a08db[_0x6a21('0x42')]['includeAll']){_0x41364b[_0x6a21('0xb5')]=[{'all':!![]}];}_0x41364b=_[_0x6a21('0x9c')]({},_0x41364b,_0x4a08db[_0x6a21('0xb6')]);return db['SmsInteraction'][_0x6a21('0x61')](_0x41364b)['then'](handleEntityNotFound(_0x20e265,null))[_0x6a21('0x2a')](respondWithResult(_0x20e265,null))['catch'](handleError(_0x20e265,null));};exports[_0x6a21('0xb7')]=function(_0x47f8b5,_0x809f71){return db[_0x6a21('0x9d')][_0x6a21('0xb7')](_0x47f8b5[_0x6a21('0x73')],{})[_0x6a21('0x2a')](respondWithResult(_0x809f71,0xc9))[_0x6a21('0x36')](handleError(_0x809f71,null));};exports[_0x6a21('0x29')]=function(_0x2e14c8,_0x1cb388){if(_0x2e14c8[_0x6a21('0x73')]['id']){delete _0x2e14c8['body']['id'];}return db[_0x6a21('0x9d')][_0x6a21('0x61')]({'where':{'id':_0x2e14c8[_0x6a21('0xb4')]['id']}})[_0x6a21('0x2a')](handleEntityNotFound(_0x1cb388,null))[_0x6a21('0x2a')](saveUpdates(_0x2e14c8[_0x6a21('0x73')],null))[_0x6a21('0x2a')](respondWithResult(_0x1cb388,null))['catch'](handleError(_0x1cb388,null));};exports[_0x6a21('0x2b')]=function(_0x37d0ae,_0x5a0941){return db[_0x6a21('0x9d')][_0x6a21('0x61')]({'where':{'id':_0x37d0ae[_0x6a21('0xb4')]['id']}})['then'](handleEntityNotFound(_0x5a0941,null))['then'](removeEntity(_0x5a0941,null))[_0x6a21('0x36')](handleError(_0x5a0941,null));};exports['describe']=function(_0x226a0a,_0x3329aa){return db['SmsInteraction'][_0x6a21('0xb8')]()['then'](respondWithResult(_0x3329aa,null))[_0x6a21('0x36')](handleError(_0x3329aa,null));};exports['addMessage']=function(_0x539c45,_0x5242d0,_0xc5277f){return db[_0x6a21('0xb9')][_0x6a21('0x61')]({'where':{'id':_0x539c45[_0x6a21('0xb4')]['id']}})['then'](handleEntityNotFound(_0x5242d0,null))[_0x6a21('0x2a')](function(_0x573dca){if(_0x573dca){return _0x573dca[_0x6a21('0xba')](_0x539c45['body'][_0x6a21('0xbb')],_[_0x6a21('0xbc')](_0x539c45['body'],['ids','id'])||{});}})[_0x6a21('0x2a')](respondWithResult(_0x5242d0,null))['catch'](handleError(_0x5242d0,null));};exports['getMessages']=function(_0x5436b1,_0x3766d6,_0x2ab51e){var _0x323d3e={'raw':![],'where':{}};var _0x2342e8={};var _0x583565={'count':0x0,'rows':[]};return db[_0x6a21('0x9d')][_0x6a21('0xbd')]({'where':{'id':_0x5436b1[_0x6a21('0xb4')]['id']}})['then'](handleEntityNotFound(_0x3766d6,null))[_0x6a21('0x2a')](function(_0x4cc702){if(_0x4cc702){_0x2342e8['model']=_['keys'](db['SmsMessage'][_0x6a21('0x3e')]);_0x2342e8[_0x6a21('0x42')]=_[_0x6a21('0x43')](_0x5436b1[_0x6a21('0x42')]);_0x2342e8[_0x6a21('0x44')]=_[_0x6a21('0x45')](_0x2342e8['model'],_0x2342e8[_0x6a21('0x42')]);_0x323d3e['attributes']=_['intersection'](_0x2342e8['model'],qs[_0x6a21('0x9e')](_0x5436b1['query']['fields']));_0x323d3e[_0x6a21('0x47')]=_0x323d3e[_0x6a21('0x47')][_0x6a21('0x48')]?_0x323d3e['attributes']:_0x2342e8['model'];if(!_0x5436b1[_0x6a21('0x42')][_0x6a21('0x49')]('nolimit')){_0x323d3e[_0x6a21('0x23')]=qs['limit'](_0x5436b1[_0x6a21('0x42')][_0x6a21('0x23')]);_0x323d3e[_0x6a21('0x21')]=qs[_0x6a21('0x21')](_0x5436b1[_0x6a21('0x42')][_0x6a21('0x21')]);}_0x323d3e[_0x6a21('0x4b')]=qs['sort'](_0x5436b1[_0x6a21('0x42')]['sort']);_0x323d3e[_0x6a21('0x7d')]=qs[_0x6a21('0x44')](_[_0x6a21('0xbe')](_0x5436b1[_0x6a21('0x42')],_0x2342e8[_0x6a21('0x44')]));_0x323d3e[_0x6a21('0x7d')][_0x6a21('0xb1')]=_0x4cc702['id'];if(_0x5436b1[_0x6a21('0x42')][_0x6a21('0x85')]){_0x323d3e[_0x6a21('0x7d')]=_[_0x6a21('0x9c')](_0x323d3e[_0x6a21('0x7d')],{'$or':_['map'](_0x323d3e['attributes'],function(_0x83e535){var _0x7e7d46={};_0x7e7d46[_0x83e535]={'$like':'%'+_0x5436b1[_0x6a21('0x42')][_0x6a21('0x85')]+'%'};return _0x7e7d46;})});}if(_0x5436b1[_0x6a21('0x42')][_0x6a21('0x7b')]){var _0x1c6a7e=_0x5436b1[_0x6a21('0x42')][_0x6a21('0x7b')][_0x6a21('0x67')](',');var _0x4b78c3={};_0x4b78c3[_0x1c6a7e[0x0]]={'$gte':moment(_0x1c6a7e[0x1])[_0x6a21('0xbf')](_0x6a21('0xc0'))};_0x323d3e[_0x6a21('0x7d')]=_['merge'](_0x323d3e[_0x6a21('0x7d')],_0x4b78c3);}_0x323d3e=_[_0x6a21('0x9c')]({},_0x323d3e,_0x5436b1[_0x6a21('0xb6')]);return db['SmsMessage']['count']({'where':_0x323d3e[_0x6a21('0x7d')]})['then'](function(_0x4630c2){_0x583565[_0x6a21('0x24')]=_0x4630c2;if(_0x5436b1[_0x6a21('0x42')]['includeAll']){_0x323d3e[_0x6a21('0xb5')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x323d3e);})['then'](function(_0x458b73){_0x583565['rows']=_0x458b73;return _0x583565;});}})[_0x6a21('0x2a')](respondWithFilteredResult(_0x3766d6,_0x323d3e))[_0x6a21('0x36')](handleError(_0x3766d6,null));};exports[_0x6a21('0xc1')]=function(_0x57bc18,_0x314f38,_0x320079){return db[_0x6a21('0x9d')][_0x6a21('0x61')]({'where':{'id':_0x57bc18[_0x6a21('0xb4')]['id']}})[_0x6a21('0x2a')](handleEntityNotFound(_0x314f38,null))[_0x6a21('0x2a')](function(_0x462392){if(_0x462392){return _0x462392['setTags'](_0x57bc18['body'][_0x6a21('0xbb')],_[_0x6a21('0xbc')](_0x57bc18[_0x6a21('0x73')],[_0x6a21('0xbb'),'id'])||{})[_0x6a21('0xc2')](function(){return db[_0x6a21('0x6c')]['findAll']({'attributes':['id',_0x6a21('0x2e'),'color'],'where':{'id':_0x57bc18[_0x6a21('0x73')][_0x6a21('0xbb')]}});})['then'](function(_0x115fee){socket['emit'](_0x6a21('0xc3'),{'id':Number(_0x57bc18['params']['id']),'tags':_0x115fee||[]});return{'id':Number(_0x57bc18[_0x6a21('0xb4')]['id']),'tags':_0x115fee||[]};});}})['then'](respondWithResult(_0x314f38,null))[_0x6a21('0x36')](handleError(_0x314f38,null));};exports[_0x6a21('0xc4')]=function(_0x26088b,_0x54b6b3,_0x5d89ef){return db['SmsInteraction'][_0x6a21('0x61')]({'where':{'id':_0x26088b[_0x6a21('0xb4')]['id']}})[_0x6a21('0x2a')](handleEntityNotFound(_0x54b6b3,null))[_0x6a21('0x2a')](function(_0x35989b){if(_0x35989b){return _0x35989b[_0x6a21('0xc4')](_0x26088b[_0x6a21('0x42')][_0x6a21('0xbb')]);}})[_0x6a21('0x2a')](respondWithStatusCode(_0x54b6b3,null))[_0x6a21('0x36')](handleError(_0x54b6b3,null));};exports['download']=function(_0x352cda,_0x2f8129){var _0xfa6884=moment()[_0x6a21('0xc5')]()['toString']();var _0x35b740=path[_0x6a21('0xc6')](config['root'],_0x6a21('0xc7'),_0x6a21('0xc8'),_0x6a21('0xc9'));var _0x112500=path['join'](config[_0x6a21('0xca')],_0x6a21('0xc7'),_0x6a21('0xc8'),_0x6a21('0xcb'));var _0x2509d0=path['join'](_0x35b740,_0xfa6884);var _0x3c2e42=util[_0x6a21('0xbf')](_0x6a21('0xcc'),_0x352cda[_0x6a21('0xb4')]['id'],_0xfa6884);var _0x5bed3f=path[_0x6a21('0xc6')](_0x35b740,_0x3c2e42);var _0x70512f=[];_0x70512f['push']({'model':db[_0x6a21('0x6f')],'as':'User','attributes':['id',_0x6a21('0x31')],'raw':!![]});_0x70512f[_0x6a21('0x35')]({'model':db[_0x6a21('0xcd')],'as':_0x6a21('0x66'),'attributes':['id',_0x6a21('0xce'),'lastName'],'raw':!![]});var _0x6c4820=[{'model':db[_0x6a21('0xb9')],'as':'Messages','attributes':['id',_0x6a21('0x73'),_0x6a21('0x7a'),_0x6a21('0xcf'),_0x6a21('0xd0'),_0x6a21('0x80')],'include':_0x70512f}];_0x6c4820[_0x6a21('0x35')]({'model':db[_0x6a21('0xd1')],'as':_0x6a21('0xd2'),'attributes':['id',_0x6a21('0x2e')]});_0x6c4820[_0x6a21('0x35')]({'model':db[_0x6a21('0x6f')],'as':_0x6a21('0xd3'),'attributes':['id',_0x6a21('0x31')]});return db[_0x6a21('0x9d')][_0x6a21('0x61')]({'where':{'id':_0x352cda[_0x6a21('0xb4')]['id']},'include':_0x6c4820})[_0x6a21('0x2a')](handleEntityNotFound(_0x2f8129,null))[_0x6a21('0x2a')](function(_0x19bc2c){if(_0x19bc2c){var _0x4568e8=_0x19bc2c[_0x6a21('0xd4')]({'plain':!![]});fs[_0x6a21('0xd5')](_0x2509d0);var _0x497f0e={'channel':_0x6a21('0xd6'),'account':_0x4568e8['Account'][_0x6a21('0x2e')],'agent':_0x4568e8[_0x6a21('0xd3')]?_0x4568e8['Owner'][_0x6a21('0x31')]:_0x6a21('0xd7'),'createdAt':moment(_0x4568e8[_0x6a21('0x7a')])[_0x6a21('0xbf')](_0x6a21('0xc0'))['toString'](),'closedAt':_0x4568e8[_0x6a21('0x3a')]?moment(_0x4568e8[_0x6a21('0xd8')])[_0x6a21('0xbf')](_0x6a21('0xc0'))[_0x6a21('0x9b')]():'','disposition':_0x4568e8[_0x6a21('0xd9')],'messages':_(_0x4568e8[_0x6a21('0xda')])[_0x6a21('0x85')]({'secret':![]})[_0x6a21('0x30')](function(_0x396ad5){return{'date':moment(_0x396ad5['createdAt'])['format'](_0x6a21('0xc0'))[_0x6a21('0x9b')](),'sender':_0x396ad5[_0x6a21('0xcf')]===_0x6a21('0xdb')?_0x396ad5[_0x6a21('0x6f')]?_0x396ad5[_0x6a21('0x6f')][_0x6a21('0x31')]:_0x6a21('0xdc'):_0x396ad5[_0x6a21('0x66')][_0x6a21('0xce')]+(_0x396ad5[_0x6a21('0x66')][_0x6a21('0xdd')]?'\x20'+_0x396ad5[_0x6a21('0x66')][_0x6a21('0xdd')]:''),'body':_0x396ad5[_0x6a21('0x73')],'direction':_0x396ad5[_0x6a21('0xcf')]===_0x6a21('0xdb')?'A':'C','secret':_0x396ad5[_0x6a21('0xd0')],'read':_0x396ad5['read']};})[_0x6a21('0x63')]()};return ejs[_0x6a21('0xde')](path[_0x6a21('0xc6')](config[_0x6a21('0xca')],_0x6a21('0xc7'),_0x6a21('0xdf'),_0x6a21('0xe0')),{'interaction':_0x497f0e})['then'](function(_0x1adf4e){var _0x21da41=path[_0x6a21('0xc6')](_0x2509d0,_0x6a21('0xe1')+_0x4568e8['id']+'-'+_0xfa6884+_0x6a21('0xe2'));var _0x4a7230={'path':_0x21da41,'channel':_0x6a21('0xd6'),'interactionId':_0x4568e8['id']};return pdf[_0x6a21('0xe3')](_0x1adf4e,_0x4a7230);})[_0x6a21('0x2a')](function(){return new BPromise(function(_0x50d797,_0x407472){zipdir(_0x2509d0,{'saveTo':_0x5bed3f},function(_0x3328b0,_0x20bb4d){if(_0x3328b0)return _0x407472(_0x3328b0);return _0x50d797(_0x20bb4d);});})[_0x6a21('0x2a')](function(){return new BPromise(function(_0x545961,_0x13354f){rimraf(_0x2509d0,function(_0x4b7092){if(_0x4b7092)_0x13354f(_0x4b7092);return _0x545961();});});})[_0x6a21('0x2a')](function(){return _0x2f8129[_0x6a21('0xe4')](_0x5bed3f,_0x3c2e42,function(_0x103eeb){if(_0x103eeb){console[_0x6a21('0xe5')](_0x6a21('0xe6'),_0x103eeb);}else{fs['unlinkSync'](_0x5bed3f);}});});});}else{return _0x2f8129['sendStatus'](0xc8);}})[_0x6a21('0x36')](handleError(_0x2f8129,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 16593e0..9f83d31 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 _0x4991=['then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','events','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers'];(function(_0x5ed0fe,_0x2d4687){var _0x1716b8=function(_0x18ca13){while(--_0x18ca13){_0x5ed0fe['push'](_0x5ed0fe['shift']());}};_0x1716b8(++_0x2d4687);}(_0x4991,0xf7));var _0x1499=function(_0x13550e,_0x383063){_0x13550e=_0x13550e-0x0;var _0x215f39=_0x4991[_0x13550e];return _0x215f39;};'use strict';var EventEmitter=require(_0x1499('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x1499('0x1')];var SmsMessage=require('../../mysqldb')['db'][_0x1499('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x1499('0x3')](0x0);var events={'afterCreate':_0x1499('0x4'),'afterUpdate':_0x1499('0x5'),'afterDestroy':_0x1499('0x6')};function emitEvent(_0x158134){return function(_0x19adff,_0x209616,_0x4b6154){_0x19adff[_0x1499('0x7')]({'attributes':['id'],'raw':!![]})[_0x1499('0x8')](function(_0x1c65c3){_0x19adff[_0x1499('0x9')](_0x1499('0xa'),_0x1c65c3[_0x1499('0xb')](function(_0x3277b3){return{'id':_0x3277b3['id']};}));return SmsMessage[_0x1499('0xc')]({'where':{'SmsInteractionId':_0x19adff['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x16e8ad){_0x19adff[_0x1499('0x9')]('unreadMessages',_0x16e8ad[_0x1499('0xd')]);SmsInteractionEvents[_0x1499('0xe')](_0x158134+':'+_0x19adff['id'],_0x19adff);SmsInteractionEvents['emit'](_0x158134,_0x19adff);_0x4b6154(null);})[_0x1499('0xf')](_0x4b6154(null));};}for(var e in events){if(events[_0x1499('0x10')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x0120=['hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','setDataValue','Users','map','then','unreadMessages','emit','catch'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0120,0x6f));var _0x0012=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x0120[_0x2f5ac5];return _0x37c9a8;};'use strict';var EventEmitter=require(_0x0012('0x0'));var SmsInteraction=require(_0x0012('0x1'))['db'][_0x0012('0x2')];var SmsMessage=require(_0x0012('0x1'))['db'][_0x0012('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x0012('0x4')](0x0);var events={'afterCreate':_0x0012('0x5'),'afterUpdate':_0x0012('0x6'),'afterDestroy':_0x0012('0x7')};function emitEvent(_0x302029){return function(_0x3505ab,_0x3fcfbc,_0x4eaa5b){_0x3505ab['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x95d441){_0x3505ab[_0x0012('0x8')](_0x0012('0x9'),_0x95d441[_0x0012('0xa')](function(_0x33c82f){return{'id':_0x33c82f['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x3505ab['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0012('0xb')](function(_0x2d484c){_0x3505ab[_0x0012('0x8')](_0x0012('0xc'),_0x2d484c['length']);SmsInteractionEvents[_0x0012('0xd')](_0x302029+':'+_0x3505ab['id'],_0x3505ab);SmsInteractionEvents['emit'](_0x302029,_0x3505ab);_0x4eaa5b(null);})[_0x0012('0xe')](_0x4eaa5b(null));};}for(var e in events){if(events[_0x0012('0xf')](e)){var event=events[e];SmsInteraction[_0x0012('0x10')](e,emitEvent(event));}}module[_0x0012('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 2b46c13..361d458 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 _0x91d5=['path','rimraf','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise'];(function(_0x47cbf6,_0x195024){var _0x20d9ab=function(_0x3dd639){while(--_0x3dd639){_0x47cbf6['push'](_0x47cbf6['shift']());}};_0x20d9ab(++_0x195024);}(_0x91d5,0x182));var _0x591d=function(_0x33c082,_0x4e74ba){_0x33c082=_0x33c082-0x0;var _0x1c247d=_0x91d5[_0x33c082];return _0x1c247d;};'use strict';var _=require(_0x591d('0x0'));var util=require(_0x591d('0x1'));var logger=require('../../config/logger')(_0x591d('0x2'));var moment=require(_0x591d('0x3'));var BPromise=require(_0x591d('0x4'));var rp=require(_0x591d('0x5'));var fs=require('fs');var path=require(_0x591d('0x6'));var rimraf=require(_0x591d('0x7'));var config=require('../../config/environment');var attributes=require(_0x591d('0x8'));module[_0x591d('0x9')]=function(_0x3b922f,_0x474802){return _0x3b922f['define'](_0x591d('0xa'),attributes,{'tableName':_0x591d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x35d636,_0x32edf3,_0x2ced95){if(_0x35d636['changed'](_0x591d('0xc'))){_0x35d636['closedAt']=moment()['format'](_0x591d('0xd'));}_0x2ced95(null,_0x35d636);}}});}; \ No newline at end of file +var _0x7bf0=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','path','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','changed','closedAt'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x7bf0,0x152));var _0x07bf=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x7bf0[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x07bf('0x0'));var util=require(_0x07bf('0x1'));var logger=require('../../config/logger')(_0x07bf('0x2'));var moment=require(_0x07bf('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x07bf('0x4'));var rimraf=require('rimraf');var config=require(_0x07bf('0x5'));var attributes=require(_0x07bf('0x6'));module[_0x07bf('0x7')]=function(_0x55dcae,_0x411292){return _0x55dcae['define'](_0x07bf('0x8'),attributes,{'tableName':_0x07bf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x33c7ce,_0x559d6b,_0x5ad68d){if(_0x33c7ce[_0x07bf('0xa')]('closed')){_0x33c7ce[_0x07bf('0xb')]=moment()[_0x07bf('0xc')](_0x07bf('0xd'));}_0x5ad68d(null,_0x33c7ce);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index c7f731c..2545fb4 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 _0x56f9=['request\x20sent','stringify','error','code','message','info','SmsInteraction,\x20%s,\x20%s','result','catch','body','options','where','attributes','UpdateSmsInteraction','debug','AddTagsToSmsInteraction','SmsInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','redis','./smsInteraction.socket','register','then'];(function(_0x4a4310,_0x1762c5){var _0xe64594=function(_0x22c66e){while(--_0x22c66e){_0x4a4310['push'](_0x4a4310['shift']());}};_0xe64594(++_0x1762c5);}(_0x56f9,0x10d));var _0x956f=function(_0x2b4abc,_0x3c9864){_0x2b4abc=_0x2b4abc-0x0;var _0x48e81d=_0x56f9[_0x2b4abc];return _0x48e81d;};'use strict';var _=require(_0x956f('0x0'));var util=require(_0x956f('0x1'));var moment=require(_0x956f('0x2'));var BPromise=require(_0x956f('0x3'));var rs=require(_0x956f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x956f('0x5'))['db'];var utils=require(_0x956f('0x6'));var logger=require('../../config/logger')(_0x956f('0x7'));var config=require(_0x956f('0x8'));var jayson=require(_0x956f('0x9'));var client=jayson[_0x956f('0xa')][_0x956f('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x956f('0xc'),'port':0x18eb});var socket=require(_0x956f('0xd'))(new Redis(config[_0x956f('0xe')]));require(_0x956f('0xf'))[_0x956f('0x10')](socket);function respondWithRpcPromise(_0x45563f,_0x56c700,_0x25e381){return new BPromise(function(_0xd9edd4,_0x2cb29e){return client['request'](_0x45563f,_0x25e381)[_0x956f('0x11')](function(_0x1db31f){logger['info']('SmsInteraction,\x20%s,\x20%s',_0x56c700,_0x956f('0x12'));logger['debug']('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x56c700,_0x956f('0x12'),JSON[_0x956f('0x13')](_0x1db31f));if(_0x1db31f[_0x956f('0x14')]){if(_0x1db31f[_0x956f('0x14')][_0x956f('0x15')]===0x1f4){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x56c700,_0x1db31f[_0x956f('0x14')][_0x956f('0x16')]);return _0x2cb29e(_0x1db31f[_0x956f('0x14')][_0x956f('0x16')]);}logger[_0x956f('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x56c700,_0x1db31f[_0x956f('0x14')][_0x956f('0x16')]);return _0xd9edd4(_0x1db31f['error'][_0x956f('0x16')]);}else{logger[_0x956f('0x17')](_0x956f('0x18'),_0x56c700,'request\x20sent');_0xd9edd4(_0x1db31f[_0x956f('0x19')][_0x956f('0x16')]);}})[_0x956f('0x1a')](function(_0xc48980){logger['error'](_0x956f('0x18'),_0x56c700,_0xc48980);_0x2cb29e(_0xc48980);});});}exports['UpdateSmsInteraction']=function(_0x27ee18){var _0x295f4c=this;return new Promise(function(_0x3b73ee,_0x55657d){return db['SmsInteraction']['update'](_0x27ee18[_0x956f('0x1b')],{'raw':_0x27ee18[_0x956f('0x1c')]?_0x27ee18[_0x956f('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27ee18[_0x956f('0x1c')]?_0x27ee18[_0x956f('0x1c')][_0x956f('0x1d')]||null:null,'attributes':_0x27ee18[_0x956f('0x1c')]?_0x27ee18[_0x956f('0x1c')][_0x956f('0x1e')]||null:null,'limit':_0x27ee18[_0x956f('0x1c')]?_0x27ee18[_0x956f('0x1c')]['limit']||null:null})[_0x956f('0x11')](function(_0x55d7f6){logger[_0x956f('0x17')](_0x956f('0x1f'),_0x27ee18);logger[_0x956f('0x20')]('UpdateSmsInteraction',_0x27ee18,JSON[_0x956f('0x13')](_0x55d7f6));_0x3b73ee(_0x55d7f6);})[_0x956f('0x1a')](function(_0x2911cd){logger[_0x956f('0x14')](_0x956f('0x1f'),_0x2911cd[_0x956f('0x16')],_0x27ee18);_0x55657d(_0x295f4c[_0x956f('0x14')](0x1f4,_0x2911cd[_0x956f('0x16')]));});});};exports[_0x956f('0x21')]=function(_0x52d2e5){return new Promise(function(_0x1bc6bd,_0x3dcf3c){return db[_0x956f('0x22')][_0x956f('0x23')]({'where':_0x52d2e5[_0x956f('0x1c')]?_0x52d2e5['options'][_0x956f('0x1d')]||null:null})[_0x956f('0x11')](function(_0x52e756){if(_0x52e756){return _0x52e756[_0x956f('0x24')](_0x52d2e5[_0x956f('0x1b')][_0x956f('0x25')],_[_0x956f('0x26')](_0x52d2e5['body'],[_0x956f('0x25'),'id'])||{});}})[_0x956f('0x27')](function(_0x10d6b5){logger[_0x956f('0x17')](_0x956f('0x28'),_0x52d2e5);logger[_0x956f('0x20')](_0x956f('0x28'),_0x52d2e5,JSON[_0x956f('0x13')](_0x10d6b5));_0x1bc6bd(_0x10d6b5);})[_0x956f('0x1a')](function(_0x2a5869){logger['error']('AddTags',_0x2a5869[_0x956f('0x16')],_0x52d2e5);_0x3dcf3c(_this[_0x956f('0x14')](0x1f4,_0x2a5869[_0x956f('0x16')]));});});}; \ No newline at end of file +var _0x962d=['message','request\x20sent','result','catch','UpdateSmsInteraction','SmsInteraction','update','options','raw','where','attributes','limit','AddTagsToSmsInteraction','find','addTags','ids','omit','body','spread','AddTags','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3c7f4a,_0x55ab59){var _0x4b691f=function(_0x3f3f0b){while(--_0x3f3f0b){_0x3c7f4a['push'](_0x3c7f4a['shift']());}};_0x4b691f(++_0x55ab59);}(_0x962d,0x6e));var _0xd962=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0x962d[_0x5cb1af];return _0x8d7940;};'use strict';var _=require(_0xd962('0x0'));var util=require(_0xd962('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd962('0x2'))['db'];var utils=require(_0xd962('0x3'));var logger=require(_0xd962('0x4'))(_0xd962('0x5'));var config=require(_0xd962('0x6'));var jayson=require(_0xd962('0x7'));var client=jayson[_0xd962('0x8')][_0xd962('0x9')]({'port':0x232a});config[_0xd962('0xa')]=_[_0xd962('0xb')](config[_0xd962('0xa')],{'host':_0xd962('0xc'),'port':0x18eb});var socket=require(_0xd962('0xd'))(new Redis(config[_0xd962('0xa')]));require(_0xd962('0xe'))[_0xd962('0xf')](socket);function respondWithRpcPromise(_0x435822,_0x4a62c1,_0x2153ac){return new BPromise(function(_0x49af38,_0x25bd8e){return client[_0xd962('0x10')](_0x435822,_0x2153ac)[_0xd962('0x11')](function(_0x29e641){logger[_0xd962('0x12')](_0xd962('0x13'),_0x4a62c1,'request\x20sent');logger[_0xd962('0x14')](_0xd962('0x15'),_0x4a62c1,'request\x20sent',JSON[_0xd962('0x16')](_0x29e641));if(_0x29e641[_0xd962('0x17')]){if(_0x29e641[_0xd962('0x17')][_0xd962('0x18')]===0x1f4){logger[_0xd962('0x17')](_0xd962('0x13'),_0x4a62c1,_0x29e641['error'][_0xd962('0x19')]);return _0x25bd8e(_0x29e641[_0xd962('0x17')][_0xd962('0x19')]);}logger[_0xd962('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x4a62c1,_0x29e641[_0xd962('0x17')][_0xd962('0x19')]);return _0x49af38(_0x29e641[_0xd962('0x17')]['message']);}else{logger[_0xd962('0x12')](_0xd962('0x13'),_0x4a62c1,_0xd962('0x1a'));_0x49af38(_0x29e641[_0xd962('0x1b')]['message']);}})[_0xd962('0x1c')](function(_0x424c17){logger[_0xd962('0x17')](_0xd962('0x13'),_0x4a62c1,_0x424c17);_0x25bd8e(_0x424c17);});});}exports[_0xd962('0x1d')]=function(_0x290f1c){var _0x31b9ec=this;return new Promise(function(_0x5552c2,_0x544d12){return db[_0xd962('0x1e')][_0xd962('0x1f')](_0x290f1c['body'],{'raw':_0x290f1c['options']?_0x290f1c[_0xd962('0x20')][_0xd962('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x290f1c[_0xd962('0x20')]?_0x290f1c[_0xd962('0x20')][_0xd962('0x22')]||null:null,'attributes':_0x290f1c['options']?_0x290f1c[_0xd962('0x20')][_0xd962('0x23')]||null:null,'limit':_0x290f1c['options']?_0x290f1c['options'][_0xd962('0x24')]||null:null})[_0xd962('0x11')](function(_0x20d240){logger['info'](_0xd962('0x1d'),_0x290f1c);logger[_0xd962('0x14')](_0xd962('0x1d'),_0x290f1c,JSON[_0xd962('0x16')](_0x20d240));_0x5552c2(_0x20d240);})['catch'](function(_0x468f4f){logger[_0xd962('0x17')]('UpdateSmsInteraction',_0x468f4f[_0xd962('0x19')],_0x290f1c);_0x544d12(_0x31b9ec[_0xd962('0x17')](0x1f4,_0x468f4f[_0xd962('0x19')]));});});};exports[_0xd962('0x25')]=function(_0x2fc7b7){return new Promise(function(_0x595b7f,_0x4e919a){return db[_0xd962('0x1e')][_0xd962('0x26')]({'where':_0x2fc7b7['options']?_0x2fc7b7['options'][_0xd962('0x22')]||null:null})['then'](function(_0x3ab2b6){if(_0x3ab2b6){return _0x3ab2b6[_0xd962('0x27')](_0x2fc7b7['body'][_0xd962('0x28')],_[_0xd962('0x29')](_0x2fc7b7[_0xd962('0x2a')],[_0xd962('0x28'),'id'])||{});}})[_0xd962('0x2b')](function(_0x252ff5){logger[_0xd962('0x12')]('AddTags',_0x2fc7b7);logger[_0xd962('0x14')](_0xd962('0x2c'),_0x2fc7b7,JSON[_0xd962('0x16')](_0x252ff5));_0x595b7f(_0x252ff5);})['catch'](function(_0x24e2cb){logger[_0xd962('0x17')](_0xd962('0x2c'),_0x24e2cb['message'],_0x2fc7b7);_0x4e919a(_this[_0xd962('0x17')](0x1f4,_0x24e2cb[_0xd962('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 2fec786..ecdcabb 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 _0x34ec=['smsInteraction:','./smsInteraction.events','save','remove','update','emit','register','length'];(function(_0x1e2adf,_0x55c73a){var _0x103fec=function(_0x1d071b){while(--_0x1d071b){_0x1e2adf['push'](_0x1e2adf['shift']());}};_0x103fec(++_0x55c73a);}(_0x34ec,0x159));var _0xc34e=function(_0x8fad8c,_0xf1573b){_0x8fad8c=_0x8fad8c-0x0;var _0xae3eb6=_0x34ec[_0x8fad8c];return _0xae3eb6;};'use strict';var SmsInteractionEvents=require(_0xc34e('0x0'));var events=[_0xc34e('0x1'),_0xc34e('0x2'),_0xc34e('0x3')];function createListener(_0xe6074c,_0x37f1fe){return function(_0x120f08){_0x37f1fe[_0xc34e('0x4')](_0xe6074c,_0x120f08);};}function removeListener(_0x5798e4,_0x2386a8){return function(){SmsInteractionEvents['removeListener'](_0x5798e4,_0x2386a8);};}exports[_0xc34e('0x5')]=function(_0x2b169d){for(var _0x4a111e=0x0,_0xa86034=events[_0xc34e('0x6')];_0x4a111e<_0xa86034;_0x4a111e++){var _0x695cf4=events[_0x4a111e];var _0x134a7a=createListener(_0xc34e('0x7')+_0x695cf4,_0x2b169d);SmsInteractionEvents['on'](_0x695cf4,_0x134a7a);}}; \ No newline at end of file +var _0x9386=['update','removeListener','register','smsInteraction:','./smsInteraction.events','save','remove'];(function(_0x2dbcf5,_0xdf924b){var _0x21031c=function(_0x55ecb5){while(--_0x55ecb5){_0x2dbcf5['push'](_0x2dbcf5['shift']());}};_0x21031c(++_0xdf924b);}(_0x9386,0xf9));var _0x6938=function(_0x1f41ca,_0x5b0d24){_0x1f41ca=_0x1f41ca-0x0;var _0xdd0f6b=_0x9386[_0x1f41ca];return _0xdd0f6b;};'use strict';var SmsInteractionEvents=require(_0x6938('0x0'));var events=[_0x6938('0x1'),_0x6938('0x2'),_0x6938('0x3')];function createListener(_0xa12f69,_0x52cb4f){return function(_0x2a3b67){_0x52cb4f['emit'](_0xa12f69,_0x2a3b67);};}function removeListener(_0x37d86b,_0xfe70b3){return function(){SmsInteractionEvents[_0x6938('0x4')](_0x37d86b,_0xfe70b3);};}exports[_0x6938('0x5')]=function(_0x3ccc4e){for(var _0x2abaa7=0x0,_0x57e540=events['length'];_0x2abaa7<_0x57e540;_0x2abaa7++){var _0x3047c6=events[_0x2abaa7];var _0x5b9ea2=createListener(_0x6938('0x6')+_0x3047c6,_0x3ccc4e);SmsInteractionEvents['on'](_0x3047c6,_0x5b9ea2);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 770267e..b6b839c 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 _0x307f=['put','update','accept','/:id/reject','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','tracked','sms','smsmessage:create','/:id/status'];(function(_0xeadb88,_0x499ed1){var _0x5d87e8=function(_0x4b0fe9){while(--_0x4b0fe9){_0xeadb88['push'](_0xeadb88['shift']());}};_0x5d87e8(++_0x499ed1);}(_0x307f,0x1af));var _0xf307=function(_0x909e74,_0x18e6d1){_0x909e74=_0x909e74-0x0;var _0xcc69db=_0x307f[_0x909e74];return _0xcc69db;};'use strict';var multer=require(_0xf307('0x0'));var util=require(_0xf307('0x1'));var path=require(_0xf307('0x2'));var timeout=require(_0xf307('0x3'));var express=require('express');var router=express[_0xf307('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf307('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf307('0x6'));var controller=require(_0xf307('0x7'));router[_0xf307('0x8')]('/',auth[_0xf307('0x9')](),controller['index']);router[_0xf307('0x8')](_0xf307('0xa'),auth[_0xf307('0x9')](),controller[_0xf307('0xb')]);router[_0xf307('0x8')](_0xf307('0xc'),auth['isAuthenticated'](),controller[_0xf307('0xd')]);router[_0xf307('0xe')]('/',auth[_0xf307('0x9')](),interaction[_0xf307('0xf')](_0xf307('0x10'),_0xf307('0x11')),controller['create']);router['post'](_0xf307('0x12'),controller['status']);router[_0xf307('0x13')]('/:id',auth[_0xf307('0x9')](),controller[_0xf307('0x14')]);router[_0xf307('0x13')]('/:id/accept',auth['isAuthenticated'](),controller[_0xf307('0x15')]);router[_0xf307('0x13')](_0xf307('0x16'),auth[_0xf307('0x9')](),controller['reject']);router[_0xf307('0x17')](_0xf307('0xc'),auth[_0xf307('0x9')](),controller[_0xf307('0x18')]);module['exports']=router; \ No newline at end of file +var _0x398a=['get','/describe','/:id','show','post','tracked','smsmessage:create','status','put','update','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','isAuthenticated','index'];(function(_0x4035df,_0x456ef0){var _0x545a4e=function(_0x5c3bc1){while(--_0x5c3bc1){_0x4035df['push'](_0x4035df['shift']());}};_0x545a4e(++_0x456ef0);}(_0x398a,0xe0));var _0xa398=function(_0x2cd164,_0x524ff3){_0x2cd164=_0x2cd164-0x0;var _0x4003df=_0x398a[_0x2cd164];return _0x4003df;};'use strict';var multer=require(_0xa398('0x0'));var util=require(_0xa398('0x1'));var path=require('path');var timeout=require(_0xa398('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa398('0x3'));var auth=require(_0xa398('0x4'));var interaction=require(_0xa398('0x5'));var config=require(_0xa398('0x6'));var controller=require(_0xa398('0x7'));router['get']('/',auth[_0xa398('0x8')](),controller[_0xa398('0x9')]);router[_0xa398('0xa')](_0xa398('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xa398('0xa')](_0xa398('0xc'),auth[_0xa398('0x8')](),controller[_0xa398('0xd')]);router[_0xa398('0xe')]('/',auth[_0xa398('0x8')](),interaction[_0xa398('0xf')]('sms',_0xa398('0x10')),controller['create']);router['post']('/:id/status',controller[_0xa398('0x11')]);router[_0xa398('0x12')](_0xa398('0xc'),auth['isAuthenticated'](),controller[_0xa398('0x13')]);router[_0xa398('0x12')]('/:id/accept',auth[_0xa398('0x8')](),controller[_0xa398('0x14')]);router['put'](_0xa398('0x15'),auth[_0xa398('0x8')](),controller[_0xa398('0x16')]);router[_0xa398('0x17')](_0xa398('0xc'),auth[_0xa398('0x8')](),controller[_0xa398('0x18')]);module[_0xa398('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 100e005..0530261 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 _0x5f50=['TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports'];(function(_0x2e744d,_0x5bfc22){var _0x163ed1=function(_0x3fac91){while(--_0x3fac91){_0x2e744d['push'](_0x2e744d['shift']());}};_0x163ed1(++_0x5bfc22);}(_0x5f50,0xbb));var _0x05f5=function(_0x1132f8,_0x122a52){_0x1132f8=_0x1132f8-0x0;var _0x481f4c=_0x5f50[_0x1132f8];return _0x481f4c;};'use strict';var Sequelize=require(_0x05f5('0x0'));module[_0x05f5('0x1')]={'body':{'type':Sequelize[_0x05f5('0x2')](_0x05f5('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x05f5('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x05f5('0x5')]('in',_0x05f5('0x6')),'defaultValue':_0x05f5('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x05f5('0x7')](0xbe)},'phone':{'type':Sequelize[_0x05f5('0x7')]},'readAt':{'type':Sequelize[_0x05f5('0x8')]},'secret':{'type':Sequelize[_0x05f5('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x05f5('0x7')]},'providerResponse':{'type':Sequelize[_0x05f5('0x2')]}}; \ No newline at end of file +var _0xf6e4=['BOOLEAN','sequelize','exports','TEXT','ENUM','out','STRING','DATE'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0xf6e4,0x129));var _0x4f6e=function(_0xff9b0,_0x13a83a){_0xff9b0=_0xff9b0-0x0;var _0x555b74=_0xf6e4[_0xff9b0];return _0x555b74;};'use strict';var Sequelize=require(_0x4f6e('0x0'));module[_0x4f6e('0x1')]={'body':{'type':Sequelize[_0x4f6e('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x4f6e('0x3')]('in',_0x4f6e('0x4')),'defaultValue':_0x4f6e('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x4f6e('0x5')](0xbe)},'phone':{'type':Sequelize[_0x4f6e('0x5')]},'readAt':{'type':Sequelize[_0x4f6e('0x6')]},'secret':{'type':Sequelize[_0x4f6e('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x4f6e('0x5')]},'providerResponse':{'type':Sequelize[_0x4f6e('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 231eab8..4605074 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 _0xd945=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsMessage.socket','jayson/promise','client','http','request','then','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','offset','undefined','limit','count','apply','reject','save','update','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','filters','pick','merge','filter','options','includeAll','include','findAll','rows','show','length','find','create','body','params','describe','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','SELECT','contact','email','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','sms-interactions','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','QueryTypes','fullname','internal','interface','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','delivered','Status','plivio','infobip','groupName','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x919445,_0x5467dc){var _0x511b3e=function(_0xde10f3){while(--_0xde10f3){_0x919445['push'](_0x919445['shift']());}};_0x511b3e(++_0x5467dc);}(_0xd945,0x84));var _0x5d94=function(_0x1c25f0,_0xb683d4){_0x1c25f0=_0x1c25f0-0x0;var _0x2b484d=_0xd945[_0x1c25f0];return _0x2b484d;};'use strict';var emlformat=require(_0x5d94('0x0'));var rimraf=require(_0x5d94('0x1'));var zipdir=require(_0x5d94('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5d94('0x3'));var moment=require(_0x5d94('0x4'));var BPromise=require(_0x5d94('0x5'));var Mustache=require(_0x5d94('0x6'));var util=require(_0x5d94('0x7'));var path=require('path');var sox=require(_0x5d94('0x8'));var csv=require(_0x5d94('0x9'));var ejs=require(_0x5d94('0xa'));var fs=require('fs');var fs_extra=require(_0x5d94('0xb'));var _=require(_0x5d94('0xc'));var squel=require('squel');var crypto=require(_0x5d94('0xd'));var jsforce=require(_0x5d94('0xe'));var deskjs=require(_0x5d94('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5d94('0x10'));var Papa=require(_0x5d94('0x11'));var Redis=require(_0x5d94('0x12'));var authService=require(_0x5d94('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5d94('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d94('0x15'))(_0x5d94('0x16'));var utils=require(_0x5d94('0x17'));var config=require(_0x5d94('0x18'));var licenseUtil=require(_0x5d94('0x19'));var db=require(_0x5d94('0x1a'))['db'];config[_0x5d94('0x1b')]=_[_0x5d94('0x1c')](config[_0x5d94('0x1b')],{'host':_0x5d94('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5d94('0x1b')]));require(_0x5d94('0x1e'))['register'](socket);var jayson=require(_0x5d94('0x1f'));var client=jayson[_0x5d94('0x20')][_0x5d94('0x21')]({'port':0x232c});var client9002=jayson[_0x5d94('0x20')][_0x5d94('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x452a88,_0x5c4d65,_0x555419,_0x541ef1){return new BPromise(function(_0x38d3c7,_0x470c8b){var _0x1ef529=_0x541ef1||client;return _0x1ef529[_0x5d94('0x22')](_0x452a88,_0x555419)[_0x5d94('0x23')](function(_0x47ea45){logger[_0x5d94('0x24')](_0x5d94('0x25'),_0x5c4d65,_0x5d94('0x26'));logger[_0x5d94('0x27')](_0x5d94('0x28'),_0x5c4d65,_0x5d94('0x26'),JSON[_0x5d94('0x29')](_0x47ea45));if(_0x47ea45[_0x5d94('0x2a')]){if(_0x47ea45[_0x5d94('0x2a')][_0x5d94('0x2b')]===0x1f4){logger[_0x5d94('0x2a')](_0x5d94('0x25'),_0x5c4d65,_0x47ea45[_0x5d94('0x2a')]['message']);return _0x470c8b(_0x47ea45[_0x5d94('0x2a')][_0x5d94('0x2c')]);}logger[_0x5d94('0x2a')](_0x5d94('0x25'),_0x5c4d65,_0x47ea45[_0x5d94('0x2a')][_0x5d94('0x2c')]);return _0x38d3c7(_0x47ea45[_0x5d94('0x2a')][_0x5d94('0x2c')]);}else{logger[_0x5d94('0x24')](_0x5d94('0x25'),_0x5c4d65,_0x5d94('0x26'));_0x38d3c7(_0x47ea45[_0x5d94('0x2d')][_0x5d94('0x2c')]);}})[_0x5d94('0x2e')](function(_0x1c1344){logger['error'](_0x5d94('0x25'),_0x5c4d65,_0x1c1344);_0x470c8b(_0x1c1344);});});}function respondWithStatusCode(_0x452ad7,_0x3c8cc2){_0x3c8cc2=_0x3c8cc2||0xcc;return function(_0x390e01){if(_0x390e01){return _0x452ad7[_0x5d94('0x2f')](_0x3c8cc2);}return _0x452ad7[_0x5d94('0x30')](_0x3c8cc2)[_0x5d94('0x31')]();};}function respondWithResult(_0x140f8a,_0x2f3b3e){_0x2f3b3e=_0x2f3b3e||0xc8;return function(_0x456c59){if(_0x456c59){return _0x140f8a[_0x5d94('0x30')](_0x2f3b3e)['json'](_0x456c59);}};}function respondWithFilteredResult(_0x5a117f,_0xbf0bc6){return function(_0x54d4df){if(_0x54d4df){var _0x19ef72=typeof _0xbf0bc6[_0x5d94('0x32')]===_0x5d94('0x33')&&typeof _0xbf0bc6[_0x5d94('0x34')]===_0x5d94('0x33');var _0x27a401=_0x54d4df[_0x5d94('0x35')];var _0x12a145=_0x19ef72?0x0:_0xbf0bc6[_0x5d94('0x32')];var _0x150f56=_0x19ef72?_0x54d4df['count']:_0xbf0bc6['offset']+_0xbf0bc6[_0x5d94('0x34')];var _0x34569a;if(_0x150f56>=_0x27a401){_0x150f56=_0x27a401;_0x34569a=0xc8;}else{_0x34569a=0xce;}_0x5a117f[_0x5d94('0x30')](_0x34569a);return _0x5a117f['set']('Content-Range',_0x12a145+'-'+_0x150f56+'/'+_0x27a401)['json'](_0x54d4df);}return null;};}function patchUpdates(_0x31acb6){return function(_0x4e4bc0){try{jsonpatch[_0x5d94('0x36')](_0x4e4bc0,_0x31acb6,!![]);}catch(_0x21008a){return BPromise[_0x5d94('0x37')](_0x21008a);}return _0x4e4bc0[_0x5d94('0x38')]();};}function saveUpdates(_0x460e4e,_0x12066c){return function(_0x30d3f8){if(_0x30d3f8){return _0x30d3f8[_0x5d94('0x39')](_0x460e4e)['then'](function(_0x41067a){return _0x41067a;});}return null;};}function removeEntity(_0x247056,_0x315a58){return function(_0x1f95ca){if(_0x1f95ca){return _0x1f95ca['destroy']()['then'](function(){_0x247056[_0x5d94('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f186a,_0x1655b7){return function(_0x45495f){if(!_0x45495f){_0x5f186a['sendStatus'](0x194);}return _0x45495f;};}function handleError(_0x56ada6,_0x41b06c){_0x41b06c=_0x41b06c||0x1f4;return function(_0x41709c){logger['error'](_0x41709c[_0x5d94('0x3a')]);if(_0x41709c[_0x5d94('0x3b')]){delete _0x41709c[_0x5d94('0x3b')];}_0x56ada6[_0x5d94('0x30')](_0x41b06c)[_0x5d94('0x3c')](_0x41709c);};}exports[_0x5d94('0x3d')]=function(_0x3f4d4c,_0xc73dcd){var _0x3ff75f={},_0x12c118={},_0x4f16e6={'count':0x0,'rows':[]};var _0xd15523=_[_0x5d94('0x3e')](db[_0x5d94('0x3f')][_0x5d94('0x40')],function(_0x4aa034){return{'name':_0x4aa034[_0x5d94('0x41')],'type':_0x4aa034[_0x5d94('0x42')]['key']};});_0x12c118['model']=_[_0x5d94('0x3e')](_0xd15523,_0x5d94('0x3b'));_0x12c118[_0x5d94('0x43')]=_[_0x5d94('0x44')](_0x3f4d4c[_0x5d94('0x43')]);_0x12c118['filters']=_[_0x5d94('0x45')](_0x12c118[_0x5d94('0x46')],_0x12c118[_0x5d94('0x43')]);_0x3ff75f[_0x5d94('0x47')]=_['intersection'](_0x12c118[_0x5d94('0x46')],qs[_0x5d94('0x48')](_0x3f4d4c[_0x5d94('0x43')]['fields']));_0x3ff75f[_0x5d94('0x47')]=_0x3ff75f['attributes']['length']?_0x3ff75f['attributes']:_0x12c118[_0x5d94('0x46')];if(!_0x3f4d4c[_0x5d94('0x43')][_0x5d94('0x49')](_0x5d94('0x4a'))){_0x3ff75f['limit']=qs[_0x5d94('0x34')](_0x3f4d4c[_0x5d94('0x43')]['limit']);_0x3ff75f['offset']=qs[_0x5d94('0x32')](_0x3f4d4c[_0x5d94('0x43')]['offset']);}_0x3ff75f[_0x5d94('0x4b')]=qs['sort'](_0x3f4d4c[_0x5d94('0x43')]['sort']);_0x3ff75f[_0x5d94('0x4c')]=qs[_0x5d94('0x4d')](_[_0x5d94('0x4e')](_0x3f4d4c[_0x5d94('0x43')],_0x12c118[_0x5d94('0x4d')]),_0xd15523);if(_0x3f4d4c[_0x5d94('0x43')]['filter']){_0x3ff75f[_0x5d94('0x4c')]=_[_0x5d94('0x4f')](_0x3ff75f[_0x5d94('0x4c')],{'$or':_[_0x5d94('0x3e')](_0xd15523,function(_0x55a34d){if(_0x55a34d[_0x5d94('0x42')]!=='VIRTUAL'){var _0x4aa243={};_0x4aa243[_0x55a34d[_0x5d94('0x3b')]]={'$like':'%'+_0x3f4d4c[_0x5d94('0x43')][_0x5d94('0x50')]+'%'};return _0x4aa243;}})});}_0x3ff75f=_[_0x5d94('0x4f')]({},_0x3ff75f,_0x3f4d4c[_0x5d94('0x51')]);var _0x16c8a4={'where':_0x3ff75f['where']};return db['SmsMessage'][_0x5d94('0x35')](_0x16c8a4)[_0x5d94('0x23')](function(_0x12f893){_0x4f16e6[_0x5d94('0x35')]=_0x12f893;if(_0x3f4d4c[_0x5d94('0x43')][_0x5d94('0x52')]){_0x3ff75f[_0x5d94('0x53')]=[{'all':!![]}];}return db['SmsMessage'][_0x5d94('0x54')](_0x3ff75f);})[_0x5d94('0x23')](function(_0x5c6521){_0x4f16e6[_0x5d94('0x55')]=_0x5c6521;return _0x4f16e6;})[_0x5d94('0x23')](respondWithFilteredResult(_0xc73dcd,_0x3ff75f))[_0x5d94('0x2e')](handleError(_0xc73dcd,null));};exports[_0x5d94('0x56')]=function(_0x40e595,_0x12e049){var _0x195463={'raw':!![],'where':{'id':_0x40e595['params']['id']}},_0x2b7c09={};_0x2b7c09['model']=_[_0x5d94('0x44')](db[_0x5d94('0x3f')][_0x5d94('0x40')]);_0x2b7c09[_0x5d94('0x43')]=_['keys'](_0x40e595[_0x5d94('0x43')]);_0x2b7c09[_0x5d94('0x4d')]=_[_0x5d94('0x45')](_0x2b7c09['model'],_0x2b7c09[_0x5d94('0x43')]);_0x195463[_0x5d94('0x47')]=_[_0x5d94('0x45')](_0x2b7c09[_0x5d94('0x46')],qs['fields'](_0x40e595[_0x5d94('0x43')][_0x5d94('0x48')]));_0x195463[_0x5d94('0x47')]=_0x195463['attributes'][_0x5d94('0x57')]?_0x195463[_0x5d94('0x47')]:_0x2b7c09[_0x5d94('0x46')];if(_0x40e595['query'][_0x5d94('0x52')]){_0x195463[_0x5d94('0x53')]=[{'all':!![]}];}_0x195463=_[_0x5d94('0x4f')]({},_0x195463,_0x40e595[_0x5d94('0x51')]);return db[_0x5d94('0x3f')][_0x5d94('0x58')](_0x195463)[_0x5d94('0x23')](handleEntityNotFound(_0x12e049,null))[_0x5d94('0x23')](respondWithResult(_0x12e049,null))[_0x5d94('0x2e')](handleError(_0x12e049,null));};exports[_0x5d94('0x59')]=function(_0x503bac,_0x287464){return db[_0x5d94('0x3f')][_0x5d94('0x59')](_0x503bac[_0x5d94('0x5a')],{})[_0x5d94('0x23')](respondWithResult(_0x287464,0xc9))[_0x5d94('0x2e')](handleError(_0x287464,null));};exports['update']=function(_0x1381f1,_0x469fa4){if(_0x1381f1[_0x5d94('0x5a')]['id']){delete _0x1381f1[_0x5d94('0x5a')]['id'];}return db[_0x5d94('0x3f')][_0x5d94('0x58')]({'where':{'id':_0x1381f1[_0x5d94('0x5b')]['id']}})[_0x5d94('0x23')](handleEntityNotFound(_0x469fa4,null))[_0x5d94('0x23')](saveUpdates(_0x1381f1['body'],null))['then'](respondWithResult(_0x469fa4,null))[_0x5d94('0x2e')](handleError(_0x469fa4,null));};exports['destroy']=function(_0x6a9625,_0x13ab17){return db[_0x5d94('0x3f')][_0x5d94('0x58')]({'where':{'id':_0x6a9625[_0x5d94('0x5b')]['id']}})['then'](handleEntityNotFound(_0x13ab17,null))['then'](removeEntity(_0x13ab17,null))[_0x5d94('0x2e')](handleError(_0x13ab17,null));};exports['describe']=function(_0x4203f7,_0x12aec2){return db[_0x5d94('0x3f')][_0x5d94('0x5c')]()[_0x5d94('0x23')](respondWithResult(_0x12aec2,null))['catch'](handleError(_0x12aec2,null));};var interaction_log=require(_0x5d94('0x15'))('sms-interactions');exports[_0x5d94('0x5d')]=function(_0x17e08d,_0x64c270,_0x1d47d2){var _0x3ffd95={'agent':{},'channel':_0x5d94('0x5e')};if(_0x17e08d[_0x5d94('0x5a')]['id']){delete _0x17e08d[_0x5d94('0x5a')]['id'];}_0x17e08d[_0x5d94('0x5a')][_0x5d94('0x5f')]=!![];_0x17e08d[_0x5d94('0x5a')][_0x5d94('0x60')]=moment()[_0x5d94('0x61')](_0x5d94('0x62'));_0x17e08d[_0x5d94('0x5a')][_0x5d94('0x63')]=_0x17e08d[_0x5d94('0x5a')][_0x5d94('0x63')]||_0x17e08d[_0x5d94('0x64')]['id'];_0x3ffd95[_0x5d94('0x65')]['id']=_0x17e08d[_0x5d94('0x5a')][_0x5d94('0x63')];return db['SmsMessage'][_0x5d94('0x58')]({'where':{'id':_0x17e08d['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x64c270,null))[_0x5d94('0x23')](saveUpdates(_0x17e08d[_0x5d94('0x5a')],null))['then'](function(_0x56149a){if(_0x56149a){_0x3ffd95[_0x5d94('0x2c')]=_0x56149a[_0x5d94('0x66')]({'plain':!![]});return db[_0x5d94('0x67')][_0x5d94('0x58')]({'where':{'id':_0x56149a[_0x5d94('0x68')]}});}return null;})[_0x5d94('0x23')](handleEntityNotFound(_0x64c270,null))[_0x5d94('0x23')](function(_0x21111f){if(_0x21111f){return _0x21111f[_0x5d94('0x39')]({'UserId':_0x17e08d[_0x5d94('0x5a')]['UserId'],'read1stAt':_[_0x5d94('0x69')](_0x21111f[_0x5d94('0x6a')])?moment()[_0x5d94('0x61')](_0x5d94('0x62')):undefined});}return null;})[_0x5d94('0x23')](function(_0x51dedb){if(_0x51dedb){_0x3ffd95[_0x5d94('0x6b')]=_0x51dedb[_0x5d94('0x66')]({'plain':!![]});interaction_log[_0x5d94('0x24')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x17e08d['user']['id'],_0x17e08d[_0x5d94('0x64')]['name'],_0x17e08d[_0x5d94('0x64')][_0x5d94('0x6c')],_0x3ffd95[_0x5d94('0x6b')]['id'],_0x17e08d[_0x5d94('0x5a')]?JSON[_0x5d94('0x29')](_0x17e08d[_0x5d94('0x5a')]):_0x5d94('0x6d'));return respondWithRpcPromise(_0x5d94('0x6e'),_0x5d94('0x6f'),_0x3ffd95);}return null;})['then'](function(_0x59ef0b){var _0x47c058=_0x5d94('0x70')+_0x59ef0b[_0x5d94('0x2c')][_0x5d94('0x71')];return db[_0x5d94('0x72')][_0x5d94('0x43')](_0x47c058,{'type':db['Sequelize']['QueryTypes'][_0x5d94('0x73')],'raw':!![]})[_0x5d94('0x23')](function(_0x65bacd){return _0x65bacd;});})[_0x5d94('0x23')](function(_0x2fd6b8){if(_0x2fd6b8){_0x3ffd95[_0x5d94('0x2c')][_0x5d94('0x74')]=_0x2fd6b8[0x0];if(!_0x17e08d[_0x5d94('0x5a')][_0x5d94('0x63')])return;return db['User'][_0x5d94('0x58')]({'where':{'id':_0x17e08d[_0x5d94('0x5a')]['UserId'],'role':_0x5d94('0x65')},'attributes':['id','name','fullname',_0x5d94('0x75'),'internal'],'raw':!![]});}return null;})[_0x5d94('0x23')](function(_0x195dd8){if(!_0x195dd8)return null;_0x3ffd95[_0x5d94('0x2c')][_0x5d94('0x65')]=_0x195dd8;return _0x3ffd95;})[_0x5d94('0x23')](function(_0x5c8f5c){if(_0x5c8f5c){if(_0x17e08d[_0x5d94('0x5a')][_0x5d94('0x76')]){_0x3ffd95[_0x5d94('0x2c')]['interface']=util[_0x5d94('0x61')](_0x5d94('0x77'),_0x17e08d['user'][_0x5d94('0x3b')]);_0x3ffd95[_0x5d94('0x2c')][_0x5d94('0x78')]=_0x3ffd95['channel'];_0x3ffd95[_0x5d94('0x2c')][_0x5d94('0x79')]=_0x3ffd95['channel'];_0x3ffd95[_0x5d94('0x2c')][_0x5d94('0x7a')]=_0x5d94('0x5d');return respondWithRpcPromise('EventManager',_0x5d94('0x7b'),{'event':_0x5d94('0x7c'),'message':_0x3ffd95[_0x5d94('0x2c')]},client9002)['then'](function(){return _0x3ffd95;});}return _0x3ffd95;}return null;})[_0x5d94('0x23')](respondWithResult(_0x64c270,null))[_0x5d94('0x2e')](handleError(_0x64c270,null));};var interaction_log=require(_0x5d94('0x15'))(_0x5d94('0x7d'));exports[_0x5d94('0x37')]=function(_0x10b926,_0x213cf8,_0x32418e){var _0x5efb3b={'agent':{},'channel':_0x5d94('0x5e')};if(_0x10b926['body']['id']){delete _0x10b926[_0x5d94('0x5a')]['id'];}_0x10b926['body']['UserId']=_0x10b926[_0x5d94('0x5a')][_0x5d94('0x63')]||_0x10b926[_0x5d94('0x64')]['id'];_0x5efb3b[_0x5d94('0x65')]['id']=_0x10b926[_0x5d94('0x5a')][_0x5d94('0x63')];return db['SmsMessage']['find']({'where':{'id':_0x10b926[_0x5d94('0x5b')]['id'],'UserId':null}})[_0x5d94('0x23')](handleEntityNotFound(_0x213cf8,null))[_0x5d94('0x23')](function(_0x2c9f60){if(_0x2c9f60){_0x5efb3b[_0x5d94('0x2c')]=_0x2c9f60[_0x5d94('0x66')]({'plain':!![]});return db[_0x5d94('0x67')]['find']({'where':{'id':_0x2c9f60[_0x5d94('0x68')]}});}return null;})[_0x5d94('0x23')](handleEntityNotFound(_0x213cf8,null))[_0x5d94('0x23')](function(_0x2b8715){if(_0x2b8715){_0x5efb3b[_0x5d94('0x6b')]=_0x2b8715['get']({'plain':!![]});interaction_log[_0x5d94('0x24')](_0x5d94('0x7e'),_0x10b926[_0x5d94('0x64')]['id'],_0x10b926[_0x5d94('0x64')]['name'],_0x10b926[_0x5d94('0x64')][_0x5d94('0x6c')],_0x5efb3b[_0x5d94('0x6b')]['id'],_0x10b926[_0x5d94('0x5a')]?JSON[_0x5d94('0x29')](_0x10b926[_0x5d94('0x5a')]):_0x5d94('0x6d'));return respondWithRpcPromise(_0x5d94('0x7f'),_0x5d94('0x80'),_0x5efb3b);}return null;})[_0x5d94('0x23')](function(_0x4078ba){var _0x151891=_0x5d94('0x70')+_0x4078ba['message']['ContactId'];return db[_0x5d94('0x72')][_0x5d94('0x43')](_0x151891,{'type':db[_0x5d94('0x81')][_0x5d94('0x82')][_0x5d94('0x73')],'raw':!![]})[_0x5d94('0x23')](function(_0x2f37e3){return _0x2f37e3;});})[_0x5d94('0x23')](function(_0x411b1b){if(_0x411b1b){_0x5efb3b[_0x5d94('0x2c')]['contact']=_0x411b1b[0x0];if(!_0x10b926['body'][_0x5d94('0x63')])return;return db['User']['find']({'where':{'id':_0x10b926['body']['UserId'],'role':_0x5d94('0x65')},'attributes':['id','name',_0x5d94('0x83'),'email',_0x5d94('0x84')],'raw':!![]});}return null;})[_0x5d94('0x23')](function(_0x3b8904){if(!_0x3b8904)return null;_0x5efb3b[_0x5d94('0x2c')]['agent']=_0x3b8904;return _0x5efb3b;})[_0x5d94('0x23')](function(_0x54530f){if(_0x54530f){_0x54530f[_0x5d94('0x2c')][_0x5d94('0x85')]=util[_0x5d94('0x61')](_0x5d94('0x77'),_0x10b926['user'][_0x5d94('0x3b')]);_0x54530f[_0x5d94('0x2c')][_0x5d94('0x78')]=_0x5efb3b[_0x5d94('0x78')];_0x54530f[_0x5d94('0x2c')][_0x5d94('0x79')]=_0x5efb3b['channel'];_0x54530f[_0x5d94('0x2c')][_0x5d94('0x7a')]=_0x5d94('0x37');respondWithRpcPromise('EventManager',_0x5d94('0x7b'),{'event':_0x5d94('0x86'),'message':_0x54530f[_0x5d94('0x2c')]},client9002);return _0x5efb3b;}return null;})[_0x5d94('0x23')](respondWithResult(_0x213cf8,null))[_0x5d94('0x2e')](handleError(_0x213cf8,null));};exports['status']=function(_0x5026de,_0xa324ac,_0x391d76){if(_0x5026de['body']['id']){delete _0x5026de[_0x5d94('0x5a')]['id'];}var _0x6381da;return db[_0x5d94('0x3f')][_0x5d94('0x58')]({'where':{'id':_0x5026de['params']['id']}})[_0x5d94('0x23')](handleEntityNotFound(_0xa324ac,null))[_0x5d94('0x23')](function(_0x59462f){if(_0x59462f){_0x6381da=_0x59462f;return db['SmsAccount'][_0x5d94('0x58')]({'where':{'id':_0x59462f[_0x5d94('0x87')]}});}})[_0x5d94('0x23')](handleEntityNotFound(_0xa324ac,null))[_0x5d94('0x23')](function(_0x138922){if(_0x138922){logger[_0x5d94('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s','status',_0x5d94('0x88'),_0x138922[_0x5d94('0x42')],util[_0x5d94('0x89')](_0x5026de[_0x5d94('0x5a')],{'showHidden':![],'depth':null}));switch(_0x138922[_0x5d94('0x42')]){case _0x5d94('0x8a'):if(_0x5026de[_0x5d94('0x5a')][_0x5d94('0x8b')]&&_0x5026de[_0x5d94('0x5a')][_0x5d94('0x8b')]===_0x6381da[_0x5d94('0x8c')]){return _0x6381da[_0x5d94('0x39')]({'read':!![]});}else{logger['error'](_0x5d94('0x8d'),'status',_0x5d94('0x8a'),util[_0x5d94('0x89')](_0x5026de[_0x5d94('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x5d94('0x8e'):if(_0x5026de[_0x5d94('0x5a')][_0x5d94('0x8f')]&&_0x5026de[_0x5d94('0x5a')][_0x5d94('0x8f')]===_0x6381da[_0x5d94('0x8c')]&&_[_0x5d94('0x90')](['sent',_0x5d94('0x91')],_0x5026de[_0x5d94('0x5a')][_0x5d94('0x92')])>=0x0){return _0x6381da[_0x5d94('0x39')]({'read':!![]});}else{logger[_0x5d94('0x2a')](_0x5d94('0x8d'),_0x5d94('0x30'),_0x5d94('0x93'),util[_0x5d94('0x89')](_0x5026de[_0x5d94('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x5d94('0x94'):var _0x2b6ce5=_0x5026de[_0x5d94('0x5a')]['results'][0x0];if(_0x2b6ce5[_0x5d94('0x30')][_0x5d94('0x95')]==='DELIVERED'){return _0x6381da[_0x5d94('0x39')]({'read':!![]});}else{logger['error'](_0x5d94('0x8d'),'status',_0x5d94('0x94'),util[_0x5d94('0x89')](_0x5026de[_0x5d94('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x6381da;}})[_0x5d94('0x23')](respondWithResult(_0xa324ac,null))[_0x5d94('0x2e')](handleError(_0xa324ac,null));}; \ No newline at end of file +var _0x5288=['User','agent','internal','manual','interface','format','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','sms-interactions','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','sequelize','email','rejectmessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','infobip','results','groupName','DELIVERED','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','sendStatus','status','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','fields','find','create','body','params','describe','../../config/logger','sms','read','readAt','UserId','user','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','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','QueryTypes','SELECT','contact'];(function(_0x41cc3f,_0x2678a2){var _0x47ff58=function(_0x190d53){while(--_0x190d53){_0x41cc3f['push'](_0x41cc3f['shift']());}};_0x47ff58(++_0x2678a2);}(_0x5288,0x1ed));var _0x8528=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x5288[_0xe73080];return _0x12cbc4;};'use strict';var emlformat=require(_0x8528('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8528('0x1'));var jsonpatch=require(_0x8528('0x2'));var rp=require(_0x8528('0x3'));var moment=require(_0x8528('0x4'));var BPromise=require(_0x8528('0x5'));var Mustache=require(_0x8528('0x6'));var util=require('util');var path=require('path');var sox=require(_0x8528('0x7'));var csv=require(_0x8528('0x8'));var ejs=require(_0x8528('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8528('0xa'));var squel=require(_0x8528('0xb'));var crypto=require(_0x8528('0xc'));var jsforce=require(_0x8528('0xd'));var deskjs=require(_0x8528('0xe'));var toCsv=require(_0x8528('0x8'));var querystring=require(_0x8528('0xf'));var Papa=require(_0x8528('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8528('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8528('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x8528('0x13'));var config=require(_0x8528('0x14'));var licenseUtil=require(_0x8528('0x15'));var db=require('../../mysqldb')['db'];config[_0x8528('0x16')]=_[_0x8528('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8528('0x18'))[_0x8528('0x19')](socket);var jayson=require(_0x8528('0x1a'));var client=jayson[_0x8528('0x1b')][_0x8528('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x8528('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4daf42,_0x5aac73,_0x30f4e6,_0x2115aa){return new BPromise(function(_0x5488f0,_0x36e690){var _0x442731=_0x2115aa||client;return _0x442731[_0x8528('0x1d')](_0x4daf42,_0x30f4e6)[_0x8528('0x1e')](function(_0x1d0bf4){logger[_0x8528('0x1f')](_0x8528('0x20'),_0x5aac73,_0x8528('0x21'));logger[_0x8528('0x22')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5aac73,'request\x20sent',JSON[_0x8528('0x23')](_0x1d0bf4));if(_0x1d0bf4['error']){if(_0x1d0bf4['error']['code']===0x1f4){logger[_0x8528('0x24')](_0x8528('0x20'),_0x5aac73,_0x1d0bf4[_0x8528('0x24')][_0x8528('0x25')]);return _0x36e690(_0x1d0bf4[_0x8528('0x24')][_0x8528('0x25')]);}logger[_0x8528('0x24')](_0x8528('0x20'),_0x5aac73,_0x1d0bf4[_0x8528('0x24')][_0x8528('0x25')]);return _0x5488f0(_0x1d0bf4[_0x8528('0x24')][_0x8528('0x25')]);}else{logger[_0x8528('0x1f')]('SmsMessage,\x20%s,\x20%s',_0x5aac73,_0x8528('0x21'));_0x5488f0(_0x1d0bf4[_0x8528('0x26')][_0x8528('0x25')]);}})['catch'](function(_0xb4da99){logger[_0x8528('0x24')](_0x8528('0x20'),_0x5aac73,_0xb4da99);_0x36e690(_0xb4da99);});});}function respondWithStatusCode(_0x1aa62d,_0x17ebb9){_0x17ebb9=_0x17ebb9||0xcc;return function(_0x26b628){if(_0x26b628){return _0x1aa62d[_0x8528('0x27')](_0x17ebb9);}return _0x1aa62d[_0x8528('0x28')](_0x17ebb9)['end']();};}function respondWithResult(_0x1769ed,_0x3397d3){_0x3397d3=_0x3397d3||0xc8;return function(_0x18d430){if(_0x18d430){return _0x1769ed[_0x8528('0x28')](_0x3397d3)[_0x8528('0x29')](_0x18d430);}};}function respondWithFilteredResult(_0x5c0a6a,_0x56db8d){return function(_0x54e66f){if(_0x54e66f){var _0x16aa24=typeof _0x56db8d['offset']==='undefined'&&typeof _0x56db8d[_0x8528('0x2a')]===_0x8528('0x2b');var _0x33951f=_0x54e66f['count'];var _0x22fd47=_0x16aa24?0x0:_0x56db8d[_0x8528('0x2c')];var _0x1744c3=_0x16aa24?_0x54e66f[_0x8528('0x2d')]:_0x56db8d['offset']+_0x56db8d[_0x8528('0x2a')];var _0x35d086;if(_0x1744c3>=_0x33951f){_0x1744c3=_0x33951f;_0x35d086=0xc8;}else{_0x35d086=0xce;}_0x5c0a6a[_0x8528('0x28')](_0x35d086);return _0x5c0a6a[_0x8528('0x2e')](_0x8528('0x2f'),_0x22fd47+'-'+_0x1744c3+'/'+_0x33951f)[_0x8528('0x29')](_0x54e66f);}return null;};}function patchUpdates(_0xb66a3c){return function(_0x36bb20){try{jsonpatch[_0x8528('0x30')](_0x36bb20,_0xb66a3c,!![]);}catch(_0x17c068){return BPromise[_0x8528('0x31')](_0x17c068);}return _0x36bb20[_0x8528('0x32')]();};}function saveUpdates(_0x5ea896,_0x4e6d24){return function(_0x46e7a7){if(_0x46e7a7){return _0x46e7a7[_0x8528('0x33')](_0x5ea896)['then'](function(_0xdce4d6){return _0xdce4d6;});}return null;};}function removeEntity(_0x1b1f96,_0x196241){return function(_0x432e00){if(_0x432e00){return _0x432e00[_0x8528('0x34')]()[_0x8528('0x1e')](function(){_0x1b1f96[_0x8528('0x28')](0xcc)[_0x8528('0x35')]();});}};}function handleEntityNotFound(_0x232b01,_0x5c5ffd){return function(_0x5997f4){if(!_0x5997f4){_0x232b01[_0x8528('0x27')](0x194);}return _0x5997f4;};}function handleError(_0xceeb29,_0x2f1b48){_0x2f1b48=_0x2f1b48||0x1f4;return function(_0x88cd25){logger['error'](_0x88cd25[_0x8528('0x36')]);if(_0x88cd25[_0x8528('0x37')]){delete _0x88cd25[_0x8528('0x37')];}_0xceeb29[_0x8528('0x28')](_0x2f1b48)['send'](_0x88cd25);};}exports[_0x8528('0x38')]=function(_0x21027c,_0x58f891){var _0x27312a={},_0x2356fb={},_0x3f7d3a={'count':0x0,'rows':[]};var _0x449d75=_[_0x8528('0x39')](db[_0x8528('0x3a')][_0x8528('0x3b')],function(_0x3335db){return{'name':_0x3335db[_0x8528('0x3c')],'type':_0x3335db[_0x8528('0x3d')][_0x8528('0x3e')]};});_0x2356fb[_0x8528('0x3f')]=_[_0x8528('0x39')](_0x449d75,_0x8528('0x37'));_0x2356fb[_0x8528('0x40')]=_['keys'](_0x21027c['query']);_0x2356fb['filters']=_[_0x8528('0x41')](_0x2356fb[_0x8528('0x3f')],_0x2356fb[_0x8528('0x40')]);_0x27312a['attributes']=_['intersection'](_0x2356fb[_0x8528('0x3f')],qs['fields'](_0x21027c[_0x8528('0x40')]['fields']));_0x27312a['attributes']=_0x27312a[_0x8528('0x42')]['length']?_0x27312a[_0x8528('0x42')]:_0x2356fb[_0x8528('0x3f')];if(!_0x21027c[_0x8528('0x40')][_0x8528('0x43')](_0x8528('0x44'))){_0x27312a[_0x8528('0x2a')]=qs[_0x8528('0x2a')](_0x21027c[_0x8528('0x40')][_0x8528('0x2a')]);_0x27312a[_0x8528('0x2c')]=qs['offset'](_0x21027c[_0x8528('0x40')][_0x8528('0x2c')]);}_0x27312a[_0x8528('0x45')]=qs[_0x8528('0x46')](_0x21027c['query'][_0x8528('0x46')]);_0x27312a[_0x8528('0x47')]=qs[_0x8528('0x48')](_[_0x8528('0x49')](_0x21027c[_0x8528('0x40')],_0x2356fb[_0x8528('0x48')]),_0x449d75);if(_0x21027c[_0x8528('0x40')]['filter']){_0x27312a['where']=_[_0x8528('0x4a')](_0x27312a['where'],{'$or':_['map'](_0x449d75,function(_0x407d71){if(_0x407d71[_0x8528('0x3d')]!==_0x8528('0x4b')){var _0xf44738={};_0xf44738[_0x407d71[_0x8528('0x37')]]={'$like':'%'+_0x21027c[_0x8528('0x40')]['filter']+'%'};return _0xf44738;}})});}_0x27312a=_[_0x8528('0x4a')]({},_0x27312a,_0x21027c[_0x8528('0x4c')]);var _0x503dcf={'where':_0x27312a[_0x8528('0x47')]};return db[_0x8528('0x3a')][_0x8528('0x2d')](_0x503dcf)[_0x8528('0x1e')](function(_0x3ce5b5){_0x3f7d3a['count']=_0x3ce5b5;if(_0x21027c[_0x8528('0x40')][_0x8528('0x4d')]){_0x27312a[_0x8528('0x4e')]=[{'all':!![]}];}return db[_0x8528('0x3a')][_0x8528('0x4f')](_0x27312a);})[_0x8528('0x1e')](function(_0x33576c){_0x3f7d3a[_0x8528('0x50')]=_0x33576c;return _0x3f7d3a;})[_0x8528('0x1e')](respondWithFilteredResult(_0x58f891,_0x27312a))[_0x8528('0x51')](handleError(_0x58f891,null));};exports[_0x8528('0x52')]=function(_0x4d4abe,_0x2c8651){var _0x1f84fe={'raw':!![],'where':{'id':_0x4d4abe['params']['id']}},_0x98a04d={};_0x98a04d[_0x8528('0x3f')]=_[_0x8528('0x53')](db['SmsMessage']['rawAttributes']);_0x98a04d[_0x8528('0x40')]=_[_0x8528('0x53')](_0x4d4abe[_0x8528('0x40')]);_0x98a04d['filters']=_[_0x8528('0x41')](_0x98a04d['model'],_0x98a04d[_0x8528('0x40')]);_0x1f84fe[_0x8528('0x42')]=_[_0x8528('0x41')](_0x98a04d[_0x8528('0x3f')],qs[_0x8528('0x54')](_0x4d4abe[_0x8528('0x40')][_0x8528('0x54')]));_0x1f84fe['attributes']=_0x1f84fe[_0x8528('0x42')]['length']?_0x1f84fe['attributes']:_0x98a04d[_0x8528('0x3f')];if(_0x4d4abe[_0x8528('0x40')][_0x8528('0x4d')]){_0x1f84fe['include']=[{'all':!![]}];}_0x1f84fe=_['merge']({},_0x1f84fe,_0x4d4abe[_0x8528('0x4c')]);return db[_0x8528('0x3a')][_0x8528('0x55')](_0x1f84fe)['then'](handleEntityNotFound(_0x2c8651,null))[_0x8528('0x1e')](respondWithResult(_0x2c8651,null))[_0x8528('0x51')](handleError(_0x2c8651,null));};exports[_0x8528('0x56')]=function(_0x104127,_0x56d68d){return db[_0x8528('0x3a')][_0x8528('0x56')](_0x104127[_0x8528('0x57')],{})[_0x8528('0x1e')](respondWithResult(_0x56d68d,0xc9))['catch'](handleError(_0x56d68d,null));};exports[_0x8528('0x33')]=function(_0x25ace6,_0x48be0e){if(_0x25ace6['body']['id']){delete _0x25ace6['body']['id'];}return db[_0x8528('0x3a')][_0x8528('0x55')]({'where':{'id':_0x25ace6[_0x8528('0x58')]['id']}})['then'](handleEntityNotFound(_0x48be0e,null))['then'](saveUpdates(_0x25ace6[_0x8528('0x57')],null))[_0x8528('0x1e')](respondWithResult(_0x48be0e,null))[_0x8528('0x51')](handleError(_0x48be0e,null));};exports[_0x8528('0x34')]=function(_0x1b7e99,_0x2e16d8){return db[_0x8528('0x3a')][_0x8528('0x55')]({'where':{'id':_0x1b7e99[_0x8528('0x58')]['id']}})[_0x8528('0x1e')](handleEntityNotFound(_0x2e16d8,null))['then'](removeEntity(_0x2e16d8,null))[_0x8528('0x51')](handleError(_0x2e16d8,null));};exports[_0x8528('0x59')]=function(_0x3a4959,_0x15d1e7){return db['SmsMessage'][_0x8528('0x59')]()[_0x8528('0x1e')](respondWithResult(_0x15d1e7,null))[_0x8528('0x51')](handleError(_0x15d1e7,null));};var interaction_log=require(_0x8528('0x5a'))('sms-interactions');exports['accept']=function(_0x4b7cb4,_0x3118b8,_0xbd8bec){var _0x58e310={'agent':{},'channel':_0x8528('0x5b')};if(_0x4b7cb4[_0x8528('0x57')]['id']){delete _0x4b7cb4[_0x8528('0x57')]['id'];}_0x4b7cb4[_0x8528('0x57')][_0x8528('0x5c')]=!![];_0x4b7cb4[_0x8528('0x57')][_0x8528('0x5d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4b7cb4[_0x8528('0x57')]['UserId']=_0x4b7cb4['body'][_0x8528('0x5e')]||_0x4b7cb4[_0x8528('0x5f')]['id'];_0x58e310['agent']['id']=_0x4b7cb4['body'][_0x8528('0x5e')];return db[_0x8528('0x3a')][_0x8528('0x55')]({'where':{'id':_0x4b7cb4[_0x8528('0x58')]['id'],'UserId':null}})[_0x8528('0x1e')](handleEntityNotFound(_0x3118b8,null))[_0x8528('0x1e')](saveUpdates(_0x4b7cb4[_0x8528('0x57')],null))[_0x8528('0x1e')](function(_0x4a4fd6){if(_0x4a4fd6){_0x58e310['message']=_0x4a4fd6[_0x8528('0x60')]({'plain':!![]});return db[_0x8528('0x61')][_0x8528('0x55')]({'where':{'id':_0x4a4fd6[_0x8528('0x62')]}});}return null;})[_0x8528('0x1e')](handleEntityNotFound(_0x3118b8,null))['then'](function(_0x519a8d){if(_0x519a8d){return _0x519a8d[_0x8528('0x33')]({'UserId':_0x4b7cb4[_0x8528('0x57')][_0x8528('0x5e')],'read1stAt':_[_0x8528('0x63')](_0x519a8d[_0x8528('0x64')])?moment()['format'](_0x8528('0x65')):undefined});}return null;})[_0x8528('0x1e')](function(_0x3e9680){if(_0x3e9680){_0x58e310[_0x8528('0x66')]=_0x3e9680['get']({'plain':!![]});interaction_log[_0x8528('0x1f')](_0x8528('0x67'),_0x4b7cb4[_0x8528('0x5f')]['id'],_0x4b7cb4['user'][_0x8528('0x37')],_0x4b7cb4[_0x8528('0x5f')]['role'],_0x58e310[_0x8528('0x66')]['id'],_0x4b7cb4[_0x8528('0x57')]?JSON['stringify'](_0x4b7cb4[_0x8528('0x57')]):'null');return respondWithRpcPromise('AcceptMessage',_0x8528('0x68'),_0x58e310);}return null;})['then'](function(_0x311005){var _0x36f04a=_0x8528('0x69')+_0x311005[_0x8528('0x25')][_0x8528('0x6a')];return db['sequelize'][_0x8528('0x40')](_0x36f04a,{'type':db[_0x8528('0x6b')][_0x8528('0x6c')][_0x8528('0x6d')],'raw':!![]})[_0x8528('0x1e')](function(_0x3cb443){return _0x3cb443;});})['then'](function(_0x270ffa){if(_0x270ffa){_0x58e310['message'][_0x8528('0x6e')]=_0x270ffa[0x0];if(!_0x4b7cb4[_0x8528('0x57')]['UserId'])return;return db[_0x8528('0x6f')][_0x8528('0x55')]({'where':{'id':_0x4b7cb4[_0x8528('0x57')][_0x8528('0x5e')],'role':_0x8528('0x70')},'attributes':['id',_0x8528('0x37'),'fullname','email',_0x8528('0x71')],'raw':!![]});}return null;})[_0x8528('0x1e')](function(_0x43afd1){if(!_0x43afd1)return null;_0x58e310[_0x8528('0x25')][_0x8528('0x70')]=_0x43afd1;return _0x58e310;})[_0x8528('0x1e')](function(_0x58039f){if(_0x58039f){if(_0x4b7cb4[_0x8528('0x57')][_0x8528('0x72')]){_0x58e310[_0x8528('0x25')][_0x8528('0x73')]=util[_0x8528('0x74')](_0x8528('0x75'),_0x4b7cb4[_0x8528('0x5f')][_0x8528('0x37')]);_0x58e310[_0x8528('0x25')][_0x8528('0x76')]=_0x58e310[_0x8528('0x76')];_0x58e310[_0x8528('0x25')][_0x8528('0x77')]=_0x58e310[_0x8528('0x76')];_0x58e310[_0x8528('0x25')][_0x8528('0x78')]=_0x8528('0x79');return respondWithRpcPromise(_0x8528('0x7a'),_0x8528('0x7a'),{'event':_0x8528('0x7b'),'message':_0x58e310[_0x8528('0x25')]},client9002)[_0x8528('0x1e')](function(){return _0x58e310;});}return _0x58e310;}return null;})[_0x8528('0x1e')](respondWithResult(_0x3118b8,null))[_0x8528('0x51')](handleError(_0x3118b8,null));};var interaction_log=require(_0x8528('0x5a'))(_0x8528('0x7c'));exports[_0x8528('0x31')]=function(_0x51ba67,_0x50636a,_0x3724ec){var _0x1225a0={'agent':{},'channel':'sms'};if(_0x51ba67[_0x8528('0x57')]['id']){delete _0x51ba67[_0x8528('0x57')]['id'];}_0x51ba67[_0x8528('0x57')][_0x8528('0x5e')]=_0x51ba67['body'][_0x8528('0x5e')]||_0x51ba67[_0x8528('0x5f')]['id'];_0x1225a0[_0x8528('0x70')]['id']=_0x51ba67[_0x8528('0x57')][_0x8528('0x5e')];return db[_0x8528('0x3a')][_0x8528('0x55')]({'where':{'id':_0x51ba67[_0x8528('0x58')]['id'],'UserId':null}})[_0x8528('0x1e')](handleEntityNotFound(_0x50636a,null))[_0x8528('0x1e')](function(_0x13e3f2){if(_0x13e3f2){_0x1225a0[_0x8528('0x25')]=_0x13e3f2['get']({'plain':!![]});return db[_0x8528('0x61')][_0x8528('0x55')]({'where':{'id':_0x13e3f2[_0x8528('0x62')]}});}return null;})[_0x8528('0x1e')](handleEntityNotFound(_0x50636a,null))[_0x8528('0x1e')](function(_0x32774a){if(_0x32774a){_0x1225a0[_0x8528('0x66')]=_0x32774a[_0x8528('0x60')]({'plain':!![]});interaction_log[_0x8528('0x1f')](_0x8528('0x7d'),_0x51ba67[_0x8528('0x5f')]['id'],_0x51ba67[_0x8528('0x5f')][_0x8528('0x37')],_0x51ba67[_0x8528('0x5f')]['role'],_0x1225a0[_0x8528('0x66')]['id'],_0x51ba67['body']?JSON[_0x8528('0x23')](_0x51ba67[_0x8528('0x57')]):_0x8528('0x7e'));return respondWithRpcPromise(_0x8528('0x7f'),_0x8528('0x80'),_0x1225a0);}return null;})['then'](function(_0x1848bb){var _0x2cc364='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1848bb[_0x8528('0x25')][_0x8528('0x6a')];return db[_0x8528('0x81')][_0x8528('0x40')](_0x2cc364,{'type':db[_0x8528('0x6b')][_0x8528('0x6c')][_0x8528('0x6d')],'raw':!![]})[_0x8528('0x1e')](function(_0x38010e){return _0x38010e;});})['then'](function(_0x3020a9){if(_0x3020a9){_0x1225a0[_0x8528('0x25')][_0x8528('0x6e')]=_0x3020a9[0x0];if(!_0x51ba67[_0x8528('0x57')][_0x8528('0x5e')])return;return db['User'][_0x8528('0x55')]({'where':{'id':_0x51ba67[_0x8528('0x57')][_0x8528('0x5e')],'role':_0x8528('0x70')},'attributes':['id',_0x8528('0x37'),'fullname',_0x8528('0x82'),_0x8528('0x71')],'raw':!![]});}return null;})['then'](function(_0x194c25){if(!_0x194c25)return null;_0x1225a0['message']['agent']=_0x194c25;return _0x1225a0;})[_0x8528('0x1e')](function(_0x23dd4a){if(_0x23dd4a){_0x23dd4a[_0x8528('0x25')][_0x8528('0x73')]=util[_0x8528('0x74')]('SIP/%s',_0x51ba67['user'][_0x8528('0x37')]);_0x23dd4a['message']['channel']=_0x1225a0[_0x8528('0x76')];_0x23dd4a[_0x8528('0x25')]['motionChannel']=_0x1225a0[_0x8528('0x76')];_0x23dd4a[_0x8528('0x25')][_0x8528('0x78')]=_0x8528('0x31');respondWithRpcPromise('EventManager',_0x8528('0x7a'),{'event':_0x8528('0x83'),'message':_0x23dd4a[_0x8528('0x25')]},client9002);return _0x1225a0;}return null;})['then'](respondWithResult(_0x50636a,null))['catch'](handleError(_0x50636a,null));};exports['status']=function(_0x552b6e,_0xe49d6,_0x12190a){if(_0x552b6e[_0x8528('0x57')]['id']){delete _0x552b6e[_0x8528('0x57')]['id'];}var _0x196be6;return db[_0x8528('0x3a')][_0x8528('0x55')]({'where':{'id':_0x552b6e['params']['id']}})[_0x8528('0x1e')](handleEntityNotFound(_0xe49d6,null))[_0x8528('0x1e')](function(_0x395bf5){if(_0x395bf5){_0x196be6=_0x395bf5;return db[_0x8528('0x84')]['find']({'where':{'id':_0x395bf5[_0x8528('0x85')]}});}})[_0x8528('0x1e')](handleEntityNotFound(_0xe49d6,null))[_0x8528('0x1e')](function(_0x3251ff){if(_0x3251ff){logger[_0x8528('0x22')](_0x8528('0x86'),_0x8528('0x28'),_0x8528('0x87'),_0x3251ff[_0x8528('0x3d')],util[_0x8528('0x88')](_0x552b6e['body'],{'showHidden':![],'depth':null}));switch(_0x3251ff[_0x8528('0x3d')]){case _0x8528('0x89'):if(_0x552b6e[_0x8528('0x57')]['MessageSid']&&_0x552b6e[_0x8528('0x57')][_0x8528('0x8a')]===_0x196be6[_0x8528('0x8b')]){return _0x196be6['update']({'read':!![]});}else{logger[_0x8528('0x24')](_0x8528('0x8c'),_0x8528('0x28'),_0x8528('0x89'),util[_0x8528('0x88')](_0x552b6e[_0x8528('0x57')],{'showHidden':![],'depth':null}));}break;case _0x8528('0x8d'):if(_0x552b6e[_0x8528('0x57')][_0x8528('0x8e')]&&_0x552b6e[_0x8528('0x57')][_0x8528('0x8e')]===_0x196be6[_0x8528('0x8b')]&&_[_0x8528('0x8f')]([_0x8528('0x90'),_0x8528('0x91')],_0x552b6e[_0x8528('0x57')][_0x8528('0x92')])>=0x0){return _0x196be6[_0x8528('0x33')]({'read':!![]});}else{logger[_0x8528('0x24')](_0x8528('0x8c'),_0x8528('0x28'),'plivio',util[_0x8528('0x88')](_0x552b6e[_0x8528('0x57')],{'showHidden':![],'depth':null}));}break;case _0x8528('0x93'):var _0x1a3785=_0x552b6e[_0x8528('0x57')][_0x8528('0x94')][0x0];if(_0x1a3785['status'][_0x8528('0x95')]===_0x8528('0x96')){return _0x196be6[_0x8528('0x33')]({'read':!![]});}else{logger[_0x8528('0x24')](_0x8528('0x8c'),_0x8528('0x28'),_0x8528('0x93'),util[_0x8528('0x88')](_0x552b6e[_0x8528('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x196be6;}})[_0x8528('0x1e')](respondWithResult(_0xe49d6,null))[_0x8528('0x51')](handleError(_0xe49d6,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 6343f32..b40b069 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 _0x9026=['emit','hasOwnProperty','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','remove'];(function(_0x5514ac,_0x10c345){var _0xcda336=function(_0x19fdda){while(--_0x19fdda){_0x5514ac['push'](_0x5514ac['shift']());}};_0xcda336(++_0x10c345);}(_0x9026,0x12c));var _0x6902=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x9026[_0x263a74];return _0x2aa86c;};'use strict';var EventEmitter=require(_0x6902('0x0'));var SmsMessage=require(_0x6902('0x1'))['db'][_0x6902('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x6902('0x3')](0x0);var events={'afterCreate':_0x6902('0x4'),'afterUpdate':'update','afterDestroy':_0x6902('0x5')};function emitEvent(_0x2cda7c){return function(_0x45e6ae,_0x49b929,_0x321008){SmsMessageEvents['emit'](_0x2cda7c+':'+_0x45e6ae['id'],_0x45e6ae);SmsMessageEvents[_0x6902('0x6')](_0x2cda7c,_0x45e6ae);_0x321008(null);};}for(var e in events){if(events[_0x6902('0x7')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x6902('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0xa330=['hook','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa330,0x7f));var _0x0a33=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xa330[_0x4e676e];return _0x336a3c;};'use strict';var EventEmitter=require(_0x0a33('0x0'));var SmsMessage=require(_0x0a33('0x1'))['db'][_0x0a33('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x0a33('0x3')](0x0);var events={'afterCreate':_0x0a33('0x4'),'afterUpdate':_0x0a33('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2eed3f){return function(_0x4ea998,_0x12b4f7,_0x294454){SmsMessageEvents['emit'](_0x2eed3f+':'+_0x4ea998['id'],_0x4ea998);SmsMessageEvents[_0x0a33('0x6')](_0x2eed3f,_0x4ea998);_0x294454(null);};}for(var e in events){if(events[_0x0a33('0x7')](e)){var event=events[e];SmsMessage[_0x0a33('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 4514749..5e2d717 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 _0x8563=['UserId','SmsInteractionId','findOne','then','createdAt','catch','error','secret','SmsAccount','find','SmsAccountId','type','twilio','accountSid','phone','authToken','create','remote','/api/sms/messages/','token','update','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','login?username=','&password=','GET','split','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','requestid','Missing\x20parameters:\x20authToken','clicksend','password','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','toString','base64','http_code','data','queued_count','messages','clickSend','plivo','authId','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','/auth/1/session','baseUrl','/sms/2/text/advanced','application/json','messageId','infobip','Missing\x20parameters:\x20base_url','csc','crypto','sort','apiKey','createHash','md5','digest','hex','/external/get/send.php?','keys','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','bandwidth','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','refid','intelepeer','finally','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','body','FULLTEXT','get','direction','toLowerCase','out','isNil'];(function(_0x3ce7f3,_0x3ddc3a){var _0x283393=function(_0x39c889){while(--_0x39c889){_0x3ce7f3['push'](_0x3ce7f3['shift']());}};_0x283393(++_0x3ddc3a);}(_0x8563,0xe0));var _0x3856=function(_0x33c2ef,_0x4dc644){_0x33c2ef=_0x33c2ef-0x0;var _0x61f52f=_0x8563[_0x33c2ef];return _0x61f52f;};'use strict';var _=require(_0x3856('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3856('0x1'));var moment=require(_0x3856('0x2'));var BPromise=require(_0x3856('0x3'));var rp=require(_0x3856('0x4'));var fs=require('fs');var path=require(_0x3856('0x5'));var rimraf=require(_0x3856('0x6'));var config=require(_0x3856('0x7'));var attributes=require(_0x3856('0x8'));module[_0x3856('0x9')]=function(_0x271342,_0x40cc23){return _0x271342[_0x3856('0xa')](_0x3856('0xb'),attributes,{'tableName':_0x3856('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':'fti_sms_messages','fields':[_0x3856('0xd')],'type':_0x3856('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3cc3db,_0x77e093,_0x3b9a2e){var _0x31a6de=_0x271342['models'];var _0x23420f=_0x3cc3db[_0x3856('0xf')]({'plain':!![]});if(_0x23420f[_0x3856('0x10')][_0x3856('0x11')]()==='in'||_0x23420f[_0x3856('0x10')]['toLowerCase']()===_0x3856('0x12')&&!_0x23420f['secret']&&!_[_0x3856('0x13')](_0x23420f[_0x3856('0x14')])&&!_[_0x3856('0x13')](_0x23420f[_0x3856('0x15')])){_0x31a6de['SmsInteraction'][_0x3856('0x16')]({'where':{'id':_0x23420f[_0x3856('0x15')]}})[_0x3856('0x17')](function(_0x56c65f){if(_0x56c65f){_0x56c65f['update']({'lastMsgAt':_0x23420f[_0x3856('0x18')],'lastMsgDirection':_0x23420f[_0x3856('0x10')][_0x3856('0x11')]()});}})[_0x3856('0x19')](function(_0x2a643c){console[_0x3856('0x1a')](_0x2a643c);});}if(_0x23420f[_0x3856('0x10')]===_0x3856('0x12')&&!_0x23420f[_0x3856('0x1b')]){var _0x35d985;_0x31a6de[_0x3856('0x1c')][_0x3856('0x1d')]({'where':{'id':_0x23420f[_0x3856('0x1e')]},'raw':!![]})['then'](function(_0x4fac5c){_0x35d985=_0x4fac5c;if(_0x35d985&&_0x35d985['type']){switch(_0x35d985[_0x3856('0x1f')]){case _0x3856('0x20'):var _0x28ce47=require('twilio');if(_0x35d985[_0x3856('0x21')]&&_0x35d985['authToken']&&_0x35d985[_0x3856('0x22')]){var _0x27cc83=new _0x28ce47(_0x35d985['accountSid'],_0x35d985[_0x3856('0x23')]);_0x27cc83['messages'][_0x3856('0x24')]({'body':_0x23420f[_0x3856('0xd')],'to':_0x23420f[_0x3856('0x22')],'from':_0x35d985[_0x3856('0x22')],'statusCallback':_0x35d985[_0x3856('0x25')]+_0x3856('0x26')+_0x23420f['id']+'/status?token='+_0x35d985[_0x3856('0x27')]})[_0x3856('0x17')](function(_0xc04951){if(_0xc04951['sid']){return _0x3cc3db[_0x3856('0x28')]({'messageId':_0xc04951[_0x3856('0x29')]});}})[_0x3856('0x19')](function(_0x443e66){logger[_0x3856('0x1a')](_0x3856('0x2a'),_0x3856('0x2b'),'twilio',util['inspect'](_0x443e66,{'showHidden':![],'depth':null}));});}else{logger[_0x3856('0x1a')](_0x3856('0x2a'),_0x3856('0x2b'),_0x3856('0x20'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x3856('0x2c'):var _0x1c4c11=_0x3856('0x2d');if(_0x35d985[_0x3856('0x2e')]&&_0x35d985['password']){var _0x387ed9={'recipient':[_0x23420f['phone']],'message':_0x23420f[_0x3856('0xd')],'message_type':_0x35d985['smsMethod']};if(_0x35d985[_0x3856('0x2f')]&&_0x35d985[_0x3856('0x2f')]!=='SI'){_0x387ed9[_0x3856('0x30')]=_0x35d985['phone'];}var _0x4d1051={'url':_0x1c4c11+_0x3856('0x31')+_0x35d985[_0x3856('0x2e')]+_0x3856('0x32')+_0x35d985['password'],'method':_0x3856('0x33')};rp(_0x4d1051)[_0x3856('0x17')](function(_0x3f44fd){var _0x343d94=_0x3f44fd[_0x3856('0x34')](';');var _0x209a81={'user_key':_0x343d94[0x0],'session_key':_0x343d94[0x1]};_0x4d1051={'url':_0x1c4c11+'sms','method':_0x3856('0x35'),'headers':{'user_key':_0x209a81[_0x3856('0x36')],'Session_key':_0x209a81[_0x3856('0x37')]},'json':!![],'body':_0x387ed9};return rp(_0x4d1051);})[_0x3856('0x17')](function(_0x1b43d9){if(_0x1b43d9[_0x3856('0x38')]>=0x1){var _0x46545c={'messageId':_0x1b43d9[_0x3856('0x39')]};if(_0x35d985[_0x3856('0x2f')]!=='GP'||!_0x35d985[_0x3856('0x3a')]){_0x46545c[_0x3856('0x3b')]=!![];}return _0x3cc3db[_0x3856('0x28')](_0x46545c);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x3856('0x2c'),util[_0x3856('0x3c')](_0x1b43d9,{'showHidden':![],'depth':null}));}})[_0x3856('0x19')](function(_0xc37777){return logger[_0x3856('0x1a')](_0x3856('0x2a'),_0x3856('0x2b'),_0x3856('0x2c'),util['inspect'](_0xc37777,{'showHidden':![],'depth':null}));});}else{logger[_0x3856('0x1a')](_0x3856('0x2a'),'afterCreate',_0x3856('0x2c'),_0x3856('0x3d'));}break;case _0x3856('0x3e'):if(_0x35d985['authToken']){var _0x29ae81={'recipient':_0x23420f[_0x3856('0x22')],'message':_0x23420f[_0x3856('0xd')],'sender':_0x35d985[_0x3856('0x3f')]||_0x35d985['phone'],'authorization':_0x35d985[_0x3856('0x23')]};var _0x77e093={'method':_0x3856('0x35'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x29ae81,'json':!![]};rp(_0x77e093)[_0x3856('0x17')](function(_0x28473b){var _0x4e3e58={'messageId':_0x28473b[_0x3856('0x40')]};if(!_0x35d985[_0x3856('0x3a')]){_0x4e3e58['read']=!![];}return _0x3cc3db[_0x3856('0x28')](_0x4e3e58);})[_0x3856('0x19')](function(_0x4b469f){logger[_0x3856('0x1a')](_0x3856('0x2a'),'afterCreate',_0x3856('0x3e'),util[_0x3856('0x3c')](_0x4b469f,{'showHidden':![],'depth':null}));});}else{logger[_0x3856('0x1a')](_0x3856('0x2a'),_0x3856('0x2b'),_0x3856('0x3e'),_0x3856('0x41'));}break;case _0x3856('0x42'):if(_0x35d985[_0x3856('0x2e')]&&_0x35d985[_0x3856('0x43')]){var _0x29ae81={'messages':[{'source':_0x3856('0x44'),'to':_0x23420f[_0x3856('0x22')],'body':_0x23420f[_0x3856('0xd')],'from':_0x35d985[_0x3856('0x3f')]||_0x35d985[_0x3856('0x22')]}]};var _0x16f993=util['format'](_0x3856('0x45'),_0x35d985['username'],_0x35d985[_0x3856('0x43')]);var _0x77e093={'method':_0x3856('0x35'),'uri':_0x3856('0x46'),'body':_0x29ae81,'headers':{'Authorization':util[_0x3856('0x47')](_0x3856('0x48'),new Buffer(_0x16f993)[_0x3856('0x49')](_0x3856('0x4a')))},'json':!![]};rp(_0x77e093)['then'](function(_0x8fb029){if(_0x8fb029[_0x3856('0x4b')]>=0xc8&&_0x8fb029['http_code']<=0xce){if(_0x8fb029[_0x3856('0x4c')]&&_0x8fb029[_0x3856('0x4c')][_0x3856('0x4d')]>0x0){var _0x2ac4a1=_['head'](_0x8fb029[_0x3856('0x4c')][_0x3856('0x4e')]);var _0x39e8f4={'messageId':_0x2ac4a1['message_id']};if(!_0x35d985['deliveryReport']){_0x39e8f4[_0x3856('0x3b')]=!![];}return _0x3cc3db['update'](_0x39e8f4);}else{logger['error'](_0x3856('0x2a'),_0x3856('0x2b'),_0x3856('0x4f'),util[_0x3856('0x3c')](_0x8fb029,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x3856('0x2a'),_0x3856('0x2b'),'clickSend',util[_0x3856('0x3c')](_0x8fb029,{'showHidden':![],'depth':null}));}})[_0x3856('0x19')](function(_0x520b0a){logger[_0x3856('0x1a')](_0x3856('0x2a'),_0x3856('0x2b'),_0x3856('0x4f'),util['inspect'](_0x520b0a,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3856('0x2b'),_0x3856('0x4f'),_0x3856('0x3d'));}break;case _0x3856('0x50'):if(_0x35d985[_0x3856('0x51')]&&_0x35d985['authToken']){var _0x29ae81={'dst':_0x23420f[_0x3856('0x22')],'text':_0x23420f[_0x3856('0xd')],'src':_0x35d985[_0x3856('0x3f')]||_0x35d985['phone'],'url':_0x35d985[_0x3856('0x25')]+_0x3856('0x26')+_0x23420f['id']+_0x3856('0x52')+_0x35d985['token']};var _0x16f993=util['format']('%s:%s',_0x35d985['authId'],_0x35d985[_0x3856('0x23')]);var _0x77e093={'method':_0x3856('0x35'),'uri':util[_0x3856('0x47')](_0x3856('0x53'),_0x35d985[_0x3856('0x51')]),'body':_0x29ae81,'headers':{'Authorization':util[_0x3856('0x47')](_0x3856('0x48'),new Buffer(_0x16f993)[_0x3856('0x49')](_0x3856('0x4a')))},'json':!![]};rp(_0x77e093)[_0x3856('0x17')](function(_0xac086f){var _0x1ad262={'messageId':_0xac086f[_0x3856('0x54')][0x0]};return _0x3cc3db[_0x3856('0x28')](_0x1ad262);})[_0x3856('0x19')](function(_0x402b33){logger[_0x3856('0x1a')](_0x3856('0x2a'),_0x3856('0x2b'),_0x3856('0x50'),util[_0x3856('0x3c')](_0x402b33,{'showHidden':![],'depth':null}));});}else{logger[_0x3856('0x1a')](_0x3856('0x2a'),_0x3856('0x2b'),_0x3856('0x50'),_0x3856('0x55'));}break;case'infobip':if(_0x35d985[_0x3856('0x2e')]&&_0x35d985['password']){if(_0x35d985['baseUrl']){var _0x55633a={'method':_0x3856('0x35'),'uri':_0x35d985['baseUrl']+_0x3856('0x56'),'body':{'username':_0x35d985[_0x3856('0x2e')],'password':_0x35d985[_0x3856('0x43')]},'json':!![]};return rp(_0x55633a)[_0x3856('0x17')](function(_0x46a19f){var _0xc84762={'method':_0x3856('0x35'),'uri':_0x35d985[_0x3856('0x57')]+_0x3856('0x58'),'body':{'messages':[{'from':_0x35d985[_0x3856('0x22')],'destinations':[{'to':_0x23420f[_0x3856('0x22')]}],'text':_0x23420f[_0x3856('0xd')],'notifyUrl':_0x35d985['remote']+_0x3856('0x26')+_0x23420f['id']+_0x3856('0x52')+_0x35d985[_0x3856('0x27')],'notifyContentType':_0x3856('0x59'),'callbackData':_0x35d985[_0x3856('0x22')]+';'+_0x23420f[_0x3856('0xd')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x46a19f[_0x3856('0x27')]},'json':!![]};return rp(_0xc84762)[_0x3856('0x17')](function(_0x485edc){if(_0x485edc[_0x3856('0x4e')]){var _0x44948f={'messageId':_0x485edc['messages'][0x0][_0x3856('0x5a')]};if(!_0x35d985[_0x3856('0x3a')]){_0x44948f[_0x3856('0x3b')]=!![];}return _0x3cc3db[_0x3856('0x28')](_0x44948f);}else{return logger[_0x3856('0x1a')](_0x3856('0x2a'),_0x3856('0x2b'),_0x3856('0x5b'),util['inspect'](_0x485edc,{'showHidden':![],'depth':null}));}});})[_0x3856('0x19')](function(_0x28d6a3){return logger['error'](_0x3856('0x2a'),_0x3856('0x2b'),_0x3856('0x5b'),util['inspect'](_0x28d6a3,{'showHidden':![],'depth':null}));});}else{logger[_0x3856('0x1a')](_0x3856('0x2a'),'afterCreate','infobip',_0x3856('0x5c'));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x3856('0x5b'),_0x3856('0x3d'));}break;case _0x3856('0x5d'):var _0x5aa0c7=require(_0x3856('0x5e'));if(_0x35d985['apiKey']){var _0x239c68={};_0x239c68['login']=_0x35d985[_0x3856('0x2e')];_0x239c68['phone']=_0x23420f[_0x3856('0x22')];_0x239c68[_0x3856('0x30')]=_0x35d985[_0x3856('0x22')];_0x239c68['text']=_0x23420f[_0x3856('0xd')];_0x239c68['timestamp']=+new Date();var _0x4c8cd4='';var _0x286f4d='';var _0x43fb33=Object['keys'](_0x239c68);_0x43fb33[_0x3856('0x5f')]();for(var _0x503e54=0x0;_0x503e54<_0x43fb33['length'];_0x503e54++){if(_0x4c8cd4!=''){_0x4c8cd4+='&';}_0x4c8cd4+=_0x43fb33[_0x503e54]+'='+encodeURIComponent(_0x239c68[_0x43fb33[_0x503e54]]);_0x286f4d+=_0x239c68[_0x43fb33[_0x503e54]];}_0x286f4d+=_0x35d985[_0x3856('0x60')];_0x286f4d=_0x5aa0c7[_0x3856('0x61')](_0x3856('0x62'))[_0x3856('0x28')](_0x286f4d)[_0x3856('0x63')](_0x3856('0x64'));if(_0x4c8cd4!==''){_0x4c8cd4+='&';}_0x4c8cd4+='signature='+_0x286f4d;var _0x4d1051={'method':_0x3856('0x33'),'uri':_0x35d985[_0x3856('0x57')]+_0x3856('0x65')+_0x4c8cd4,'json':!![]};return rp(_0x4d1051)[_0x3856('0x17')](function(_0x54542d){var _0x2192b7=Object[_0x3856('0x66')](_0x54542d);if(_0x54542d[_0x2192b7[0x0]][_0x3856('0x1a')]&&parseInt(_0x54542d[_0x2192b7[0x0]][_0x3856('0x1a')])===0x0){var _0x2d3795={'messageId':_0x54542d[_0x2192b7[0x0]][_0x3856('0x67')]};if(!_0x35d985[_0x3856('0x3a')]){_0x2d3795[_0x3856('0x3b')]=!![];}return _0x3cc3db[_0x3856('0x28')](_0x2d3795);}else{return logger[_0x3856('0x1a')](_0x3856('0x2a'),_0x3856('0x2b'),_0x3856('0x5d'),util[_0x3856('0x3c')](_0x54542d['error'],{'showHidden':![],'depth':null}));}})[_0x3856('0x19')](function(_0x13baaf){return logger['error'](_0x3856('0x2a'),'afterCreate',_0x3856('0x5d'),util[_0x3856('0x3c')](_0x13baaf,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x3856('0x5d'),_0x3856('0x68'));}break;case _0x3856('0x69'):if(_0x35d985['apiKey']){var _0x315b35={'method':'POST','uri':_0x3856('0x6a'),'headers':{'Authorization':_0x35d985[_0x3856('0x60')]},'body':{'content':_0x23420f[_0x3856('0xd')],'to':[_0x23420f[_0x3856('0x22')]],'from':_0x35d985[_0x3856('0x22')],'binary':![],'clientMessageId':'uuid','charset':_0x3856('0x6b')},'json':!![]};rp(_0x315b35)[_0x3856('0x17')](function(_0x2eae06){if(!_0x2eae06[_0x3856('0x1a')]){var _0x86e106={'messageId':_0x2eae06['messages'][0x0][_0x3856('0x6c')]};if(!_0x35d985['deliveryReport']){_0x86e106['read']=!![];}return _0x3cc3db[_0x3856('0x28')](_0x86e106);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3856('0x2b'),_0x3856('0x69'),util[_0x3856('0x3c')](_0x2eae06[_0x3856('0x1a')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x14c407){return logger[_0x3856('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3856('0x2b'),'clickatell',util[_0x3856('0x3c')](_0x14c407,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3856('0x2a'),_0x3856('0x2b'),_0x3856('0x69'),_0x3856('0x68'));}break;case'bandwidth':if(_0x35d985['username']&&_0x35d985[_0x3856('0x43')]){var _0x16f993=util[_0x3856('0x47')](_0x3856('0x45'),_0x35d985[_0x3856('0x2e')],_0x35d985['password']);var _0x77e093={'method':_0x3856('0x35'),'uri':_0x3856('0x6d')+_0x35d985[_0x3856('0x6e')]+_0x3856('0x6f'),'body':{'to':[_0x23420f[_0x3856('0x22')]],'text':_0x23420f[_0x3856('0xd')],'from':_0x35d985[_0x3856('0x22')],'applicationId':_0x35d985['applicationId']},'headers':{'Authorization':util[_0x3856('0x47')](_0x3856('0x48'),new Buffer(_0x16f993)[_0x3856('0x49')](_0x3856('0x4a')))},'json':!![]};rp(_0x77e093)[_0x3856('0x17')](function(_0x3b6c25){if(_0x3b6c25['id']){var _0x3689e0={'messageId':_0x3b6c25['id']};return _0x3cc3db['update'](_0x3689e0);}else{logger[_0x3856('0x1a')](_0x3856('0x2a'),_0x3856('0x2b'),_0x3856('0x70'),util[_0x3856('0x3c')](_0x3b6c25,{'showHidden':![],'depth':null}));}})[_0x3856('0x19')](function(_0x342ab5){logger[_0x3856('0x1a')](_0x3856('0x2a'),_0x3856('0x2b'),_0x3856('0x70'),util[_0x3856('0x3c')](_0x342ab5,{'showHidden':![],'depth':null}));});}else{logger[_0x3856('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3856('0x2b'),_0x3856('0x70'),'Missing\x20parameters:\x20username,\x20password');}break;case'intelepeer':if(_0x35d985[_0x3856('0x60')]){var _0xbe1410={};var _0x4d1051={'method':'POST','uri':_0x3856('0x71'),'headers':{'Authorization':_0x3856('0x72')+_0x35d985['apiKey'],'Content-Type':_0x3856('0x59')},'body':{'from':_0x35d985[_0x3856('0x22')],'to':_0x23420f[_0x3856('0x22')],'text':_0x23420f[_0x3856('0xd')]},'json':!![]};return rp(_0x4d1051)[_0x3856('0x17')](function(_0x5c2b10){if(_0x5c2b10[_0x3856('0x73')]==0xca){_0xbe1410[_0x3856('0x74')]=_0x5c2b10;var _0x5c0242={'method':_0x3856('0x35'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x3856('0x72')+_0x35d985[_0x3856('0x60')],'Content-Type':_0x3856('0x59')},'body':{'refid':_0xbe1410[_0x3856('0x74')][_0x3856('0x75')]},'json':!![]};return rp(_0x5c0242)[_0x3856('0x17')](function(_0x4309cb){_0xbe1410['status']=_0x4309cb;var _0x2ab769={'messageId':_0xbe1410[_0x3856('0x74')]['refid'],'read':!![]};return _0x3cc3db[_0x3856('0x28')](_0x2ab769);});}else{return logger['error'](_0x3856('0x2a'),_0x3856('0x2b'),'intelepeer',util[_0x3856('0x3c')](_0x5c2b10,{'showHidden':![],'depth':null}));}})['catch'](function(_0x189eed){return logger[_0x3856('0x1a')](_0x3856('0x2a'),'afterCreate',_0x3856('0x76'),util[_0x3856('0x3c')](_0x189eed,{'showHidden':![],'depth':null}));});}else{return logger[_0x3856('0x1a')](_0x3856('0x2a'),_0x3856('0x2b'),_0x3856('0x76'),'Token\x20not\x20received');}break;}}})[_0x3856('0x77')](function(){_0x3b9a2e();});}else{_0x3b9a2e();}}},'charset':_0x3856('0x78'),'collate':_0x3856('0x79')});}; \ No newline at end of file +var _0x7a54=['Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','request-promise','path','rimraf','../../config/environment','exports','define','sms_messages','messageId','body','FULLTEXT','get','direction','toLowerCase','secret','isNil','UserId','SmsInteractionId','findOne','then','update','createdAt','catch','error','out','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','messages','create','phone','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','username','&password=','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','Missing\x20parameters:\x20username,\x20password','https://smsapi.connectel.se/api/v2/send/','requestid','read','connectel','Missing\x20parameters:\x20authToken','clicksend','format','%s:%s','https://rest.clicksend.com/v3/sms/send','toString','base64','http_code','data','queued_count','head','clickSend','plivo','remote','authId','Basic\x20%s','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','keys','length','createHash','hex','id_sms','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','bandwidth','accountId','/messages','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer'];(function(_0x10126b,_0xafa952){var _0x4684b5=function(_0x5a5008){while(--_0x5a5008){_0x10126b['push'](_0x10126b['shift']());}};_0x4684b5(++_0xafa952);}(_0x7a54,0x7b));var _0x47a5=function(_0x267488,_0x27d152){_0x267488=_0x267488-0x0;var _0x478152=_0x7a54[_0x267488];return _0x478152;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rp=require(_0x47a5('0x3'));var fs=require('fs');var path=require(_0x47a5('0x4'));var rimraf=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var attributes=require('./smsMessage.attributes');module[_0x47a5('0x7')]=function(_0x34fbbf,_0x4ddaf0){return _0x34fbbf[_0x47a5('0x8')]('SmsMessage',attributes,{'tableName':_0x47a5('0x9'),'paranoid':![],'indexes':[{'name':_0x47a5('0xa'),'fields':[_0x47a5('0xa')]},{'name':'fti_sms_messages','fields':[_0x47a5('0xb')],'type':_0x47a5('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x478ec9,_0x18fa10,_0x21d014){var _0x54f1e8=_0x34fbbf['models'];var _0x31b1ef=_0x478ec9[_0x47a5('0xd')]({'plain':!![]});if(_0x31b1ef[_0x47a5('0xe')][_0x47a5('0xf')]()==='in'||_0x31b1ef[_0x47a5('0xe')][_0x47a5('0xf')]()==='out'&&!_0x31b1ef[_0x47a5('0x10')]&&!_[_0x47a5('0x11')](_0x31b1ef[_0x47a5('0x12')])&&!_[_0x47a5('0x11')](_0x31b1ef[_0x47a5('0x13')])){_0x54f1e8['SmsInteraction'][_0x47a5('0x14')]({'where':{'id':_0x31b1ef[_0x47a5('0x13')]}})[_0x47a5('0x15')](function(_0x2eef6d){if(_0x2eef6d){_0x2eef6d[_0x47a5('0x16')]({'lastMsgAt':_0x31b1ef[_0x47a5('0x17')],'lastMsgDirection':_0x31b1ef[_0x47a5('0xe')]['toLowerCase']()});}})[_0x47a5('0x18')](function(_0x3c8d0c){console[_0x47a5('0x19')](_0x3c8d0c);});}if(_0x31b1ef['direction']===_0x47a5('0x1a')&&!_0x31b1ef[_0x47a5('0x10')]){var _0x5098e2;_0x54f1e8[_0x47a5('0x1b')][_0x47a5('0x1c')]({'where':{'id':_0x31b1ef[_0x47a5('0x1d')]},'raw':!![]})[_0x47a5('0x15')](function(_0x4c0b52){_0x5098e2=_0x4c0b52;if(_0x5098e2&&_0x5098e2[_0x47a5('0x1e')]){switch(_0x5098e2['type']){case _0x47a5('0x1f'):var _0xd6ad2a=require(_0x47a5('0x1f'));if(_0x5098e2[_0x47a5('0x20')]&&_0x5098e2[_0x47a5('0x21')]&&_0x5098e2['phone']){var _0x5e14b7=new _0xd6ad2a(_0x5098e2[_0x47a5('0x20')],_0x5098e2[_0x47a5('0x21')]);_0x5e14b7[_0x47a5('0x22')][_0x47a5('0x23')]({'body':_0x31b1ef['body'],'to':_0x31b1ef[_0x47a5('0x24')],'from':_0x5098e2[_0x47a5('0x24')],'statusCallback':_0x5098e2['remote']+'/api/sms/messages/'+_0x31b1ef['id']+_0x47a5('0x25')+_0x5098e2[_0x47a5('0x26')]})[_0x47a5('0x15')](function(_0x5cf336){if(_0x5cf336[_0x47a5('0x27')]){return _0x478ec9[_0x47a5('0x16')]({'messageId':_0x5cf336['sid']});}})[_0x47a5('0x18')](function(_0x33d523){logger[_0x47a5('0x19')](_0x47a5('0x28'),'afterCreate',_0x47a5('0x1f'),util[_0x47a5('0x29')](_0x33d523,{'showHidden':![],'depth':null}));});}else{logger[_0x47a5('0x19')](_0x47a5('0x28'),_0x47a5('0x2a'),_0x47a5('0x1f'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x47a5('0x2b'):var _0x1b828f=_0x47a5('0x2c');if(_0x5098e2['username']&&_0x5098e2[_0x47a5('0x2d')]){var _0x434a16={'recipient':[_0x31b1ef[_0x47a5('0x24')]],'message':_0x31b1ef['body'],'message_type':_0x5098e2[_0x47a5('0x2e')]};if(_0x5098e2[_0x47a5('0x2e')]&&_0x5098e2[_0x47a5('0x2e')]!=='SI'){_0x434a16[_0x47a5('0x2f')]=_0x5098e2[_0x47a5('0x24')];}var _0x55e126={'url':_0x1b828f+_0x47a5('0x30')+_0x5098e2[_0x47a5('0x31')]+_0x47a5('0x32')+_0x5098e2[_0x47a5('0x2d')],'method':_0x47a5('0x33')};rp(_0x55e126)['then'](function(_0x1a9580){var _0x113a51=_0x1a9580[_0x47a5('0x34')](';');var _0x13b29d={'user_key':_0x113a51[0x0],'session_key':_0x113a51[0x1]};_0x55e126={'url':_0x1b828f+_0x47a5('0x35'),'method':_0x47a5('0x36'),'headers':{'user_key':_0x13b29d[_0x47a5('0x37')],'Session_key':_0x13b29d[_0x47a5('0x38')]},'json':!![],'body':_0x434a16};return rp(_0x55e126);})[_0x47a5('0x15')](function(_0x2ea778){if(_0x2ea778[_0x47a5('0x39')]>=0x1){var _0x413b6c={'messageId':_0x2ea778[_0x47a5('0x3a')]};if(_0x5098e2[_0x47a5('0x2e')]!=='GP'||!_0x5098e2[_0x47a5('0x3b')]){_0x413b6c['read']=!![];}return _0x478ec9[_0x47a5('0x16')](_0x413b6c);}else{return logger[_0x47a5('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x47a5('0x2a'),_0x47a5('0x2b'),util['inspect'](_0x2ea778,{'showHidden':![],'depth':null}));}})[_0x47a5('0x18')](function(_0x1b4ce9){return logger[_0x47a5('0x19')](_0x47a5('0x28'),_0x47a5('0x2a'),_0x47a5('0x2b'),util[_0x47a5('0x29')](_0x1b4ce9,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x47a5('0x28'),_0x47a5('0x2a'),_0x47a5('0x2b'),_0x47a5('0x3c'));}break;case'connectel':if(_0x5098e2['authToken']){var _0x4969c2={'recipient':_0x31b1ef[_0x47a5('0x24')],'message':_0x31b1ef['body'],'sender':_0x5098e2['senderString']||_0x5098e2[_0x47a5('0x24')],'authorization':_0x5098e2[_0x47a5('0x21')]};var _0x18fa10={'method':_0x47a5('0x36'),'uri':_0x47a5('0x3d'),'body':_0x4969c2,'json':!![]};rp(_0x18fa10)['then'](function(_0x450959){var _0x3dbf24={'messageId':_0x450959[_0x47a5('0x3e')]};if(!_0x5098e2[_0x47a5('0x3b')]){_0x3dbf24[_0x47a5('0x3f')]=!![];}return _0x478ec9[_0x47a5('0x16')](_0x3dbf24);})[_0x47a5('0x18')](function(_0xce2d6){logger['error'](_0x47a5('0x28'),'afterCreate',_0x47a5('0x40'),util['inspect'](_0xce2d6,{'showHidden':![],'depth':null}));});}else{logger[_0x47a5('0x19')](_0x47a5('0x28'),_0x47a5('0x2a'),_0x47a5('0x40'),_0x47a5('0x41'));}break;case _0x47a5('0x42'):if(_0x5098e2[_0x47a5('0x31')]&&_0x5098e2[_0x47a5('0x2d')]){var _0x4969c2={'messages':[{'source':'xCALLY\x20Motion','to':_0x31b1ef['phone'],'body':_0x31b1ef['body'],'from':_0x5098e2['senderString']||_0x5098e2[_0x47a5('0x24')]}]};var _0x3ea25a=util[_0x47a5('0x43')](_0x47a5('0x44'),_0x5098e2[_0x47a5('0x31')],_0x5098e2[_0x47a5('0x2d')]);var _0x18fa10={'method':_0x47a5('0x36'),'uri':_0x47a5('0x45'),'body':_0x4969c2,'headers':{'Authorization':util[_0x47a5('0x43')]('Basic\x20%s',new Buffer(_0x3ea25a)[_0x47a5('0x46')](_0x47a5('0x47')))},'json':!![]};rp(_0x18fa10)['then'](function(_0x66320b){if(_0x66320b[_0x47a5('0x48')]>=0xc8&&_0x66320b[_0x47a5('0x48')]<=0xce){if(_0x66320b[_0x47a5('0x49')]&&_0x66320b[_0x47a5('0x49')][_0x47a5('0x4a')]>0x0){var _0x6ac687=_[_0x47a5('0x4b')](_0x66320b[_0x47a5('0x49')][_0x47a5('0x22')]);var _0x57c167={'messageId':_0x6ac687['message_id']};if(!_0x5098e2['deliveryReport']){_0x57c167['read']=!![];}return _0x478ec9[_0x47a5('0x16')](_0x57c167);}else{logger[_0x47a5('0x19')](_0x47a5('0x28'),'afterCreate',_0x47a5('0x4c'),util[_0x47a5('0x29')](_0x66320b,{'showHidden':![],'depth':null}));}}else{logger[_0x47a5('0x19')](_0x47a5('0x28'),_0x47a5('0x2a'),_0x47a5('0x4c'),util[_0x47a5('0x29')](_0x66320b,{'showHidden':![],'depth':null}));}})[_0x47a5('0x18')](function(_0x4b44c7){logger[_0x47a5('0x19')](_0x47a5('0x28'),'afterCreate',_0x47a5('0x4c'),util[_0x47a5('0x29')](_0x4b44c7,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x47a5('0x28'),'afterCreate',_0x47a5('0x4c'),_0x47a5('0x3c'));}break;case _0x47a5('0x4d'):if(_0x5098e2['authId']&&_0x5098e2[_0x47a5('0x21')]){var _0x4969c2={'dst':_0x31b1ef[_0x47a5('0x24')],'text':_0x31b1ef[_0x47a5('0xb')],'src':_0x5098e2['senderString']||_0x5098e2[_0x47a5('0x24')],'url':_0x5098e2[_0x47a5('0x4e')]+'/api/sms/messages/'+_0x31b1ef['id']+_0x47a5('0x25')+_0x5098e2[_0x47a5('0x26')]};var _0x3ea25a=util['format'](_0x47a5('0x44'),_0x5098e2[_0x47a5('0x4f')],_0x5098e2[_0x47a5('0x21')]);var _0x18fa10={'method':_0x47a5('0x36'),'uri':util[_0x47a5('0x43')]('https://api.plivo.com/v1/Account/%s/Message/',_0x5098e2['authId']),'body':_0x4969c2,'headers':{'Authorization':util[_0x47a5('0x43')](_0x47a5('0x50'),new Buffer(_0x3ea25a)[_0x47a5('0x46')]('base64'))},'json':!![]};rp(_0x18fa10)['then'](function(_0x381e25){var _0x3b2618={'messageId':_0x381e25[_0x47a5('0x51')][0x0]};return _0x478ec9['update'](_0x3b2618);})[_0x47a5('0x18')](function(_0x2e142f){logger[_0x47a5('0x19')](_0x47a5('0x28'),_0x47a5('0x2a'),_0x47a5('0x4d'),util['inspect'](_0x2e142f,{'showHidden':![],'depth':null}));});}else{logger[_0x47a5('0x19')](_0x47a5('0x28'),'afterCreate','plivo',_0x47a5('0x52'));}break;case _0x47a5('0x53'):if(_0x5098e2[_0x47a5('0x31')]&&_0x5098e2['password']){if(_0x5098e2[_0x47a5('0x54')]){var _0x326f81={'method':'POST','uri':_0x5098e2[_0x47a5('0x54')]+_0x47a5('0x55'),'body':{'username':_0x5098e2[_0x47a5('0x31')],'password':_0x5098e2['password']},'json':!![]};return rp(_0x326f81)[_0x47a5('0x15')](function(_0x4e8067){var _0x3be1de={'method':'POST','uri':_0x5098e2['baseUrl']+_0x47a5('0x56'),'body':{'messages':[{'from':_0x5098e2['phone'],'destinations':[{'to':_0x31b1ef[_0x47a5('0x24')]}],'text':_0x31b1ef[_0x47a5('0xb')],'notifyUrl':_0x5098e2['remote']+'/api/sms/messages/'+_0x31b1ef['id']+_0x47a5('0x25')+_0x5098e2[_0x47a5('0x26')],'notifyContentType':'application/json','callbackData':_0x5098e2[_0x47a5('0x24')]+';'+_0x31b1ef[_0x47a5('0xb')]}]},'headers':{'Authorization':_0x47a5('0x57')+_0x4e8067[_0x47a5('0x26')]},'json':!![]};return rp(_0x3be1de)[_0x47a5('0x15')](function(_0x145f15){if(_0x145f15['messages']){var _0x51f0ba={'messageId':_0x145f15['messages'][0x0][_0x47a5('0xa')]};if(!_0x5098e2[_0x47a5('0x3b')]){_0x51f0ba['read']=!![];}return _0x478ec9['update'](_0x51f0ba);}else{return logger['error'](_0x47a5('0x28'),_0x47a5('0x2a'),_0x47a5('0x53'),util['inspect'](_0x145f15,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x339968){return logger[_0x47a5('0x19')](_0x47a5('0x28'),'afterCreate',_0x47a5('0x53'),util['inspect'](_0x339968,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x47a5('0x28'),_0x47a5('0x2a'),_0x47a5('0x53'),_0x47a5('0x58'));}}else{logger[_0x47a5('0x19')](_0x47a5('0x28'),_0x47a5('0x2a'),'infobip',_0x47a5('0x3c'));}break;case _0x47a5('0x59'):var _0x45eb6b=require(_0x47a5('0x5a'));if(_0x5098e2[_0x47a5('0x5b')]){var _0x344335={};_0x344335[_0x47a5('0x5c')]=_0x5098e2[_0x47a5('0x31')];_0x344335[_0x47a5('0x24')]=_0x31b1ef['phone'];_0x344335['sender']=_0x5098e2[_0x47a5('0x24')];_0x344335[_0x47a5('0x5d')]=_0x31b1ef[_0x47a5('0xb')];_0x344335[_0x47a5('0x5e')]=+new Date();var _0x59b01b='';var _0x1a63f9='';var _0x506c01=Object[_0x47a5('0x5f')](_0x344335);_0x506c01['sort']();for(var _0x33eaf4=0x0;_0x33eaf4<_0x506c01[_0x47a5('0x60')];_0x33eaf4++){if(_0x59b01b!=''){_0x59b01b+='&';}_0x59b01b+=_0x506c01[_0x33eaf4]+'='+encodeURIComponent(_0x344335[_0x506c01[_0x33eaf4]]);_0x1a63f9+=_0x344335[_0x506c01[_0x33eaf4]];}_0x1a63f9+=_0x5098e2['apiKey'];_0x1a63f9=_0x45eb6b[_0x47a5('0x61')]('md5')[_0x47a5('0x16')](_0x1a63f9)['digest'](_0x47a5('0x62'));if(_0x59b01b!==''){_0x59b01b+='&';}_0x59b01b+='signature='+_0x1a63f9;var _0x55e126={'method':_0x47a5('0x33'),'uri':_0x5098e2[_0x47a5('0x54')]+'/external/get/send.php?'+_0x59b01b,'json':!![]};return rp(_0x55e126)[_0x47a5('0x15')](function(_0x3787be){var _0x243458=Object[_0x47a5('0x5f')](_0x3787be);if(_0x3787be[_0x243458[0x0]][_0x47a5('0x19')]&&parseInt(_0x3787be[_0x243458[0x0]]['error'])===0x0){var _0x102d04={'messageId':_0x3787be[_0x243458[0x0]][_0x47a5('0x63')]};if(!_0x5098e2['deliveryReport']){_0x102d04['read']=!![];}return _0x478ec9[_0x47a5('0x16')](_0x102d04);}else{return logger[_0x47a5('0x19')](_0x47a5('0x28'),'afterCreate',_0x47a5('0x59'),util[_0x47a5('0x29')](_0x3787be[_0x47a5('0x19')],{'showHidden':![],'depth':null}));}})[_0x47a5('0x18')](function(_0x478c5c){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x47a5('0x2a'),_0x47a5('0x59'),util[_0x47a5('0x29')](_0x478c5c,{'showHidden':![],'depth':null}));});}else{logger[_0x47a5('0x19')](_0x47a5('0x28'),_0x47a5('0x2a'),_0x47a5('0x59'),'Missing\x20parameters:\x20apiKey');}break;case _0x47a5('0x64'):if(_0x5098e2[_0x47a5('0x5b')]){var _0x5e0360={'method':_0x47a5('0x36'),'uri':_0x47a5('0x65'),'headers':{'Authorization':_0x5098e2['apiKey']},'body':{'content':_0x31b1ef[_0x47a5('0xb')],'to':[_0x31b1ef['phone']],'from':_0x5098e2['phone'],'binary':![],'clientMessageId':_0x47a5('0x66'),'charset':_0x47a5('0x67')},'json':!![]};rp(_0x5e0360)[_0x47a5('0x15')](function(_0x44508e){if(!_0x44508e[_0x47a5('0x19')]){var _0x19c9f5={'messageId':_0x44508e[_0x47a5('0x22')][0x0][_0x47a5('0x68')]};if(!_0x5098e2['deliveryReport']){_0x19c9f5[_0x47a5('0x3f')]=!![];}return _0x478ec9[_0x47a5('0x16')](_0x19c9f5);}else{return logger[_0x47a5('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x47a5('0x2a'),'clickatell',util[_0x47a5('0x29')](_0x44508e[_0x47a5('0x19')],{'showHidden':![],'depth':null}));}})[_0x47a5('0x18')](function(_0x3af559){return logger[_0x47a5('0x19')](_0x47a5('0x28'),_0x47a5('0x2a'),_0x47a5('0x64'),util[_0x47a5('0x29')](_0x3af559,{'showHidden':![],'depth':null}));});}else{logger[_0x47a5('0x19')](_0x47a5('0x28'),_0x47a5('0x2a'),_0x47a5('0x64'),_0x47a5('0x69'));}break;case _0x47a5('0x6a'):if(_0x5098e2[_0x47a5('0x31')]&&_0x5098e2[_0x47a5('0x2d')]){var _0x3ea25a=util[_0x47a5('0x43')](_0x47a5('0x44'),_0x5098e2['username'],_0x5098e2['password']);var _0x18fa10={'method':_0x47a5('0x36'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x5098e2[_0x47a5('0x6b')]+_0x47a5('0x6c'),'body':{'to':[_0x31b1ef[_0x47a5('0x24')]],'text':_0x31b1ef['body'],'from':_0x5098e2['phone'],'applicationId':_0x5098e2['applicationId']},'headers':{'Authorization':util[_0x47a5('0x43')](_0x47a5('0x50'),new Buffer(_0x3ea25a)['toString'](_0x47a5('0x47')))},'json':!![]};rp(_0x18fa10)[_0x47a5('0x15')](function(_0x8d548d){if(_0x8d548d['id']){var _0x5004a1={'messageId':_0x8d548d['id']};return _0x478ec9[_0x47a5('0x16')](_0x5004a1);}else{logger['error'](_0x47a5('0x28'),_0x47a5('0x2a'),'bandwidth',util[_0x47a5('0x29')](_0x8d548d,{'showHidden':![],'depth':null}));}})[_0x47a5('0x18')](function(_0x701df7){logger[_0x47a5('0x19')](_0x47a5('0x28'),_0x47a5('0x2a'),_0x47a5('0x6a'),util[_0x47a5('0x29')](_0x701df7,{'showHidden':![],'depth':null}));});}else{logger[_0x47a5('0x19')](_0x47a5('0x28'),'afterCreate',_0x47a5('0x6a'),'Missing\x20parameters:\x20username,\x20password');}break;case'intelepeer':if(_0x5098e2[_0x47a5('0x5b')]){var _0x5117de={};var _0x55e126={'method':_0x47a5('0x36'),'uri':_0x47a5('0x6d'),'headers':{'Authorization':_0x47a5('0x6e')+_0x5098e2[_0x47a5('0x5b')],'Content-Type':'application/json'},'body':{'from':_0x5098e2['phone'],'to':_0x31b1ef[_0x47a5('0x24')],'text':_0x31b1ef[_0x47a5('0xb')]},'json':!![]};return rp(_0x55e126)[_0x47a5('0x15')](function(_0x1c5324){if(_0x1c5324[_0x47a5('0x6f')]==0xca){_0x5117de[_0x47a5('0x70')]=_0x1c5324;var _0x3ab2a1={'method':_0x47a5('0x36'),'uri':_0x47a5('0x71'),'headers':{'Authorization':_0x47a5('0x6e')+_0x5098e2[_0x47a5('0x5b')],'Content-Type':'application/json'},'body':{'refid':_0x5117de['message'][_0x47a5('0x72')]},'json':!![]};return rp(_0x3ab2a1)[_0x47a5('0x15')](function(_0xd53ace){_0x5117de[_0x47a5('0x73')]=_0xd53ace;var _0x3f8b67={'messageId':_0x5117de[_0x47a5('0x70')][_0x47a5('0x72')],'read':!![]};return _0x478ec9[_0x47a5('0x16')](_0x3f8b67);});}else{return logger[_0x47a5('0x19')](_0x47a5('0x28'),_0x47a5('0x2a'),_0x47a5('0x74'),util[_0x47a5('0x29')](_0x1c5324,{'showHidden':![],'depth':null}));}})['catch'](function(_0x176a6a){return logger[_0x47a5('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x47a5('0x74'),util[_0x47a5('0x29')](_0x176a6a,{'showHidden':![],'depth':null}));});}else{return logger[_0x47a5('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x47a5('0x2a'),_0x47a5('0x74'),_0x47a5('0x75'));}break;}}})['finally'](function(){_0x21d014();});}else{_0x21d014();}}},'charset':_0x47a5('0x76'),'collate':_0x47a5('0x77')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 431a81d..724049e 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 _0xd8fd=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','create','body','options','raw','then','CreateSmsMessage','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x3fd3a3,_0x36c863){var _0xa3e4d5=function(_0x1fd03b){while(--_0x1fd03b){_0x3fd3a3['push'](_0x3fd3a3['shift']());}};_0xa3e4d5(++_0x36c863);}(_0xd8fd,0x129));var _0xdd8f=function(_0x41225c,_0x2c4c94){_0x41225c=_0x41225c-0x0;var _0xb75a5f=_0xd8fd[_0x41225c];return _0xb75a5f;};'use strict';var _=require(_0xdd8f('0x0'));var util=require(_0xdd8f('0x1'));var moment=require(_0xdd8f('0x2'));var BPromise=require('bluebird');var rs=require(_0xdd8f('0x3'));var fs=require('fs');var Redis=require(_0xdd8f('0x4'));var db=require(_0xdd8f('0x5'))['db'];var utils=require(_0xdd8f('0x6'));var logger=require(_0xdd8f('0x7'))('rpc');var config=require(_0xdd8f('0x8'));var jayson=require(_0xdd8f('0x9'));var client=jayson[_0xdd8f('0xa')]['http']({'port':0x232a});config[_0xdd8f('0xb')]=_[_0xdd8f('0xc')](config[_0xdd8f('0xb')],{'host':_0xdd8f('0xd'),'port':0x18eb});var socket=require(_0xdd8f('0xe'))(new Redis(config[_0xdd8f('0xb')]));require(_0xdd8f('0xf'))[_0xdd8f('0x10')](socket);function respondWithRpcPromise(_0x207b47,_0x5eb021,_0x21309c){return new BPromise(function(_0x32f95c,_0x5a815f){return client[_0xdd8f('0x11')](_0x207b47,_0x21309c)['then'](function(_0x2632ad){logger[_0xdd8f('0x12')]('SmsMessage,\x20%s,\x20%s',_0x5eb021,_0xdd8f('0x13'));logger[_0xdd8f('0x14')](_0xdd8f('0x15'),_0x5eb021,_0xdd8f('0x13'),JSON[_0xdd8f('0x16')](_0x2632ad));if(_0x2632ad[_0xdd8f('0x17')]){if(_0x2632ad[_0xdd8f('0x17')][_0xdd8f('0x18')]===0x1f4){logger[_0xdd8f('0x17')](_0xdd8f('0x19'),_0x5eb021,_0x2632ad['error']['message']);return _0x5a815f(_0x2632ad[_0xdd8f('0x17')][_0xdd8f('0x1a')]);}logger[_0xdd8f('0x17')](_0xdd8f('0x19'),_0x5eb021,_0x2632ad['error'][_0xdd8f('0x1a')]);return _0x32f95c(_0x2632ad[_0xdd8f('0x17')][_0xdd8f('0x1a')]);}else{logger[_0xdd8f('0x12')](_0xdd8f('0x19'),_0x5eb021,_0xdd8f('0x13'));_0x32f95c(_0x2632ad['result'][_0xdd8f('0x1a')]);}})['catch'](function(_0x3f8b73){logger['error'](_0xdd8f('0x19'),_0x5eb021,_0x3f8b73);_0x5a815f(_0x3f8b73);});});}exports['CreateSmsMessage']=function(_0x4eca11){var _0x5a703a=this;return new Promise(function(_0x13a977,_0x179c48){return db['SmsMessage'][_0xdd8f('0x1b')](_0x4eca11[_0xdd8f('0x1c')],{'raw':_0x4eca11['options']?_0x4eca11[_0xdd8f('0x1d')][_0xdd8f('0x1e')]===undefined?!![]:![]:!![]})[_0xdd8f('0x1f')](function(_0x184aef){logger[_0xdd8f('0x12')](_0xdd8f('0x20'),_0x4eca11);logger[_0xdd8f('0x14')](_0xdd8f('0x20'),_0x4eca11,JSON[_0xdd8f('0x16')](_0x184aef));_0x13a977(_0x184aef);})[_0xdd8f('0x21')](function(_0x82e29){logger['error'](_0xdd8f('0x20'),_0x82e29['message'],_0x4eca11);_0x179c48(_0x5a703a['error'](0x1f4,_0x82e29['message']));});});}; \ No newline at end of file +var _0x38c5=['SmsMessage,\x20%s,\x20%s','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./smsMessage.socket','register','then','info','request\x20sent','stringify','error','code'];(function(_0x22baaa,_0x64526b){var _0x4a40bc=function(_0x4f97f1){while(--_0x4f97f1){_0x22baaa['push'](_0x22baaa['shift']());}};_0x4a40bc(++_0x64526b);}(_0x38c5,0xdd));var _0x538c=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x38c5[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x538c('0x0'));var util=require(_0x538c('0x1'));var moment=require(_0x538c('0x2'));var BPromise=require(_0x538c('0x3'));var rs=require(_0x538c('0x4'));var fs=require('fs');var Redis=require(_0x538c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x538c('0x6'));var logger=require(_0x538c('0x7'))(_0x538c('0x8'));var config=require(_0x538c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x538c('0xa')][_0x538c('0xb')]({'port':0x232a});config['redis']=_[_0x538c('0xc')](config['redis'],{'host':_0x538c('0xd'),'port':0x18eb});var socket=require(_0x538c('0xe'))(new Redis(config[_0x538c('0xf')]));require(_0x538c('0x10'))[_0x538c('0x11')](socket);function respondWithRpcPromise(_0x36d1ea,_0x34a73b,_0xc00b88){return new BPromise(function(_0x237b3e,_0x3ccd48){return client['request'](_0x36d1ea,_0xc00b88)[_0x538c('0x12')](function(_0x37c894){logger[_0x538c('0x13')]('SmsMessage,\x20%s,\x20%s',_0x34a73b,_0x538c('0x14'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x34a73b,_0x538c('0x14'),JSON[_0x538c('0x15')](_0x37c894));if(_0x37c894[_0x538c('0x16')]){if(_0x37c894['error'][_0x538c('0x17')]===0x1f4){logger[_0x538c('0x16')](_0x538c('0x18'),_0x34a73b,_0x37c894[_0x538c('0x16')][_0x538c('0x19')]);return _0x3ccd48(_0x37c894[_0x538c('0x16')][_0x538c('0x19')]);}logger[_0x538c('0x16')](_0x538c('0x18'),_0x34a73b,_0x37c894['error'][_0x538c('0x19')]);return _0x237b3e(_0x37c894['error']['message']);}else{logger[_0x538c('0x13')](_0x538c('0x18'),_0x34a73b,_0x538c('0x14'));_0x237b3e(_0x37c894[_0x538c('0x1a')]['message']);}})[_0x538c('0x1b')](function(_0x1c09e4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x34a73b,_0x1c09e4);_0x3ccd48(_0x1c09e4);});});}exports[_0x538c('0x1c')]=function(_0x4be61b){var _0x54faa8=this;return new Promise(function(_0x3aa94c,_0x55969d){return db[_0x538c('0x1d')][_0x538c('0x1e')](_0x4be61b[_0x538c('0x1f')],{'raw':_0x4be61b[_0x538c('0x20')]?_0x4be61b[_0x538c('0x20')][_0x538c('0x21')]===undefined?!![]:![]:!![]})[_0x538c('0x12')](function(_0x56ad68){logger[_0x538c('0x13')](_0x538c('0x1c'),_0x4be61b);logger[_0x538c('0x22')](_0x538c('0x1c'),_0x4be61b,JSON['stringify'](_0x56ad68));_0x3aa94c(_0x56ad68);})[_0x538c('0x1b')](function(_0x1ca9a3){logger[_0x538c('0x16')]('CreateSmsMessage',_0x1ca9a3['message'],_0x4be61b);_0x55969d(_0x54faa8[_0x538c('0x16')](0x1f4,_0x1ca9a3[_0x538c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index c0e8d74..39b6a90 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 _0xbed4=['register','length','./smsMessage.events','save','emit','removeListener'];(function(_0x5c6ee1,_0x364673){var _0x53ebe4=function(_0x2aa725){while(--_0x2aa725){_0x5c6ee1['push'](_0x5c6ee1['shift']());}};_0x53ebe4(++_0x364673);}(_0xbed4,0x10a));var _0x4bed=function(_0x365917,_0x545bcc){_0x365917=_0x365917-0x0;var _0x20f7a0=_0xbed4[_0x365917];return _0x20f7a0;};'use strict';var SmsMessageEvents=require(_0x4bed('0x0'));var events=[_0x4bed('0x1'),'remove','update'];function createListener(_0x8e1fa2,_0x43f03b){return function(_0x420ea3){_0x43f03b[_0x4bed('0x2')](_0x8e1fa2,_0x420ea3);};}function removeListener(_0x26b4fa,_0x21af1c){return function(){SmsMessageEvents[_0x4bed('0x3')](_0x26b4fa,_0x21af1c);};}exports[_0x4bed('0x4')]=function(_0x1fb607){for(var _0x168c4e=0x0,_0x29ea9f=events[_0x4bed('0x5')];_0x168c4e<_0x29ea9f;_0x168c4e++){var _0x901ba4=events[_0x168c4e];var _0x32a0b2=createListener('smsMessage:'+_0x901ba4,_0x1fb607);SmsMessageEvents['on'](_0x901ba4,_0x32a0b2);}}; \ No newline at end of file +var _0xc36c=['save','update','emit','register','length','smsMessage:'];(function(_0x56138f,_0x1e9ebb){var _0x1acaf7=function(_0x48690d){while(--_0x48690d){_0x56138f['push'](_0x56138f['shift']());}};_0x1acaf7(++_0x1e9ebb);}(_0xc36c,0xd8));var _0xcc36=function(_0x4dd934,_0xf88bb9){_0x4dd934=_0x4dd934-0x0;var _0x27996c=_0xc36c[_0x4dd934];return _0x27996c;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xcc36('0x0'),'remove',_0xcc36('0x1')];function createListener(_0x3dcd46,_0x4d1f7f){return function(_0x25ab45){_0x4d1f7f[_0xcc36('0x2')](_0x3dcd46,_0x25ab45);};}function removeListener(_0x1763cb,_0x19b169){return function(){SmsMessageEvents['removeListener'](_0x1763cb,_0x19b169);};}exports[_0xcc36('0x3')]=function(_0x3f4980){for(var _0x2cef34=0x0,_0x2568f4=events[_0xcc36('0x4')];_0x2cef34<_0x2568f4;_0x2cef34++){var _0x2877a4=events[_0x2cef34];var _0x1dc128=createListener(_0xcc36('0x5')+_0x2877a4,_0x3f4980);SmsMessageEvents['on'](_0x2877a4,_0x1dc128);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 3af2b0d..9e72fc1 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 _0xca0e=['removeAgents','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete'];(function(_0x50e865,_0x11d8ed){var _0x373a11=function(_0x293f81){while(--_0x293f81){_0x50e865['push'](_0x50e865['shift']());}};_0x373a11(++_0x11d8ed);}(_0xca0e,0x146));var _0xeca0=function(_0x5a2868,_0x2a5807){_0x5a2868=_0x5a2868-0x0;var _0x1e5e52=_0xca0e[_0x5a2868];return _0x1e5e52;};'use strict';var multer=require(_0xeca0('0x0'));var util=require('util');var path=require(_0xeca0('0x1'));var timeout=require(_0xeca0('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeca0('0x3'));var interaction=require(_0xeca0('0x4'));var config=require(_0xeca0('0x5'));var controller=require(_0xeca0('0x6'));router[_0xeca0('0x7')]('/',auth[_0xeca0('0x8')](),controller[_0xeca0('0x9')]);router[_0xeca0('0x7')]('/describe',auth[_0xeca0('0x8')](),controller[_0xeca0('0xa')]);router[_0xeca0('0x7')](_0xeca0('0xb'),auth[_0xeca0('0x8')](),controller[_0xeca0('0xc')]);router[_0xeca0('0x7')](_0xeca0('0xd'),auth[_0xeca0('0x8')](),controller[_0xeca0('0xe')]);router[_0xeca0('0x7')](_0xeca0('0xf'),auth[_0xeca0('0x8')](),controller[_0xeca0('0x10')]);router[_0xeca0('0x7')](_0xeca0('0x11'),auth[_0xeca0('0x8')](),controller[_0xeca0('0x12')]);router[_0xeca0('0x13')]('/',auth[_0xeca0('0x8')](),controller[_0xeca0('0x14')]);router[_0xeca0('0x13')](_0xeca0('0xf'),auth[_0xeca0('0x8')](),controller[_0xeca0('0x15')]);router[_0xeca0('0x13')](_0xeca0('0x11'),auth[_0xeca0('0x8')](),controller[_0xeca0('0x16')]);router['put'](_0xeca0('0xb'),auth['isAuthenticated'](),controller[_0xeca0('0x17')]);router[_0xeca0('0x18')](_0xeca0('0xb'),auth[_0xeca0('0x8')](),controller['destroy']);router[_0xeca0('0x18')]('/:id/teams',auth[_0xeca0('0x8')](),controller['removeTeams']);router['delete'](_0xeca0('0x11'),auth[_0xeca0('0x8')](),controller[_0xeca0('0x19')]);module[_0xeca0('0x1a')]=router; \ No newline at end of file +var _0x0276=['Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','update','destroy','delete','removeTeams','/:id/users','exports','multer','util','path','connect-timeout','express'];(function(_0x2d076f,_0x55eea9){var _0x3efbde=function(_0x39496c){while(--_0x39496c){_0x2d076f['push'](_0x2d076f['shift']());}};_0x3efbde(++_0x55eea9);}(_0x0276,0x167));var _0x6027=function(_0x1d20ba,_0x5425bf){_0x1d20ba=_0x1d20ba-0x0;var _0x347f2a=_0x0276[_0x1d20ba];return _0x347f2a;};'use strict';var multer=require(_0x6027('0x0'));var util=require(_0x6027('0x1'));var path=require(_0x6027('0x2'));var timeout=require(_0x6027('0x3'));var express=require(_0x6027('0x4'));var router=express[_0x6027('0x5')]();var fs_extra=require(_0x6027('0x6'));var auth=require(_0x6027('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6027('0x8'));var controller=require('./smsQueue.controller');router[_0x6027('0x9')]('/',auth[_0x6027('0xa')](),controller['index']);router['get']('/describe',auth[_0x6027('0xa')](),controller[_0x6027('0xb')]);router['get'](_0x6027('0xc'),auth['isAuthenticated'](),controller[_0x6027('0xd')]);router['get'](_0x6027('0xe'),auth[_0x6027('0xa')](),controller[_0x6027('0xf')]);router['get'](_0x6027('0x10'),auth[_0x6027('0xa')](),controller[_0x6027('0x11')]);router[_0x6027('0x9')]('/:id/users',auth[_0x6027('0xa')](),controller[_0x6027('0x12')]);router[_0x6027('0x13')]('/',auth[_0x6027('0xa')](),controller[_0x6027('0x14')]);router[_0x6027('0x13')]('/:id/teams',auth[_0x6027('0xa')](),controller[_0x6027('0x15')]);router[_0x6027('0x13')]('/:id/users',auth[_0x6027('0xa')](),controller['addAgents']);router['put'](_0x6027('0xc'),auth[_0x6027('0xa')](),controller[_0x6027('0x16')]);router['delete']('/:id',auth[_0x6027('0xa')](),controller[_0x6027('0x17')]);router[_0x6027('0x18')]('/:id/teams',auth[_0x6027('0xa')](),controller[_0x6027('0x19')]);router['delete'](_0x6027('0x1a'),auth[_0x6027('0xa')](),controller['removeAgents']);module[_0x6027('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 51b4096..ecf63ee 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 _0xde89=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','INTEGER'];(function(_0x24afd3,_0xcc36f0){var _0xffe96f=function(_0x4f9cb0){while(--_0x4f9cb0){_0x24afd3['push'](_0x24afd3['shift']());}};_0xffe96f(++_0xcc36f0);}(_0xde89,0x1c4));var _0x9de8=function(_0x3b5049,_0x495a94){_0x3b5049=_0x3b5049-0x0;var _0x12454e=_0xde89[_0x3b5049];return _0x12454e;};'use strict';var Sequelize=require(_0x9de8('0x0'));module[_0x9de8('0x1')]={'name':{'type':Sequelize[_0x9de8('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9de8('0x2')]},'timeout':{'type':Sequelize[_0x9de8('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9de8('0x4')](_0x9de8('0x5'),_0x9de8('0x6'),_0x9de8('0x7'))}}; \ No newline at end of file +var _0x5130=['roundrobin','sequelize','exports','name','STRING','INTEGER','rrmemory','beepall'];(function(_0x5d113e,_0x9cd46f){var _0x3c5bb5=function(_0x25995e){while(--_0x25995e){_0x5d113e['push'](_0x5d113e['shift']());}};_0x3c5bb5(++_0x9cd46f);}(_0x5130,0x171));var _0x0513=function(_0x1d1d09,_0x504d77){_0x1d1d09=_0x1d1d09-0x0;var _0x8827e=_0x5130[_0x1d1d09];return _0x8827e;};'use strict';var Sequelize=require(_0x0513('0x0'));module[_0x0513('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0513('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0513('0x3')]},'timeout':{'type':Sequelize[_0x0513('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x0513('0x5'),_0x0513('0x6'),_0x0513('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index c91a658..511e34e 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 _0x96ed=['redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','SmsQueues','error','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','catch','keys','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','options','User','findAndCountAll','UserId','agent','smsPause','updatedAt','rows','format','%s/%s','SIP','getTeams','Team','order','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','findOrCreate','emit','userSmsQueue:save','select','tq.TeamId','join','user_has_teams','SmsQueueId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','union','compact','value','removeTeams','isEmpty','removeAgents','forEach','addAgents','spread','isArray','userSmsQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults'];(function(_0x3f9afd,_0x4ea295){var _0x4bb900=function(_0x4e4394){while(--_0x4e4394){_0x3f9afd['push'](_0x3f9afd['shift']());}};_0x4bb900(++_0x4ea295);}(_0x96ed,0xfc));var _0xd96e=function(_0x1a73af,_0x5b5055){_0x1a73af=_0x1a73af-0x0;var _0x4d309a=_0x96ed[_0x1a73af];return _0x4d309a;};'use strict';var emlformat=require(_0xd96e('0x0'));var rimraf=require(_0xd96e('0x1'));var zipdir=require(_0xd96e('0x2'));var jsonpatch=require(_0xd96e('0x3'));var rp=require(_0xd96e('0x4'));var moment=require(_0xd96e('0x5'));var BPromise=require(_0xd96e('0x6'));var Mustache=require(_0xd96e('0x7'));var util=require(_0xd96e('0x8'));var path=require(_0xd96e('0x9'));var sox=require(_0xd96e('0xa'));var csv=require(_0xd96e('0xb'));var ejs=require(_0xd96e('0xc'));var fs=require('fs');var fs_extra=require(_0xd96e('0xd'));var _=require(_0xd96e('0xe'));var squel=require(_0xd96e('0xf'));var crypto=require('crypto');var jsforce=require(_0xd96e('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd96e('0x11'));var Papa=require('papaparse');var Redis=require(_0xd96e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd96e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd96e('0x14'));var logger=require(_0xd96e('0x15'))(_0xd96e('0x16'));var utils=require(_0xd96e('0x17'));var config=require(_0xd96e('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xd96e('0x19')](config[_0xd96e('0x1a')],{'host':_0xd96e('0x1b'),'port':0x18eb});var socket=require(_0xd96e('0x1c'))(new Redis(config['redis']));require('./smsQueue.socket')['register'](socket);function respondWithStatusCode(_0x1cf96d,_0x4e42e0){_0x4e42e0=_0x4e42e0||0xcc;return function(_0x285e53){if(_0x285e53){return _0x1cf96d[_0xd96e('0x1d')](_0x4e42e0);}return _0x1cf96d[_0xd96e('0x1e')](_0x4e42e0)[_0xd96e('0x1f')]();};}function respondWithResult(_0x2ab8ef,_0x4837e7){_0x4837e7=_0x4837e7||0xc8;return function(_0x29f2ba){if(_0x29f2ba){return _0x2ab8ef['status'](_0x4837e7)[_0xd96e('0x20')](_0x29f2ba);}};}function respondWithFilteredResult(_0x391fb3,_0x335f22){return function(_0x447f18){if(_0x447f18){var _0x33d97b=typeof _0x335f22[_0xd96e('0x21')]===_0xd96e('0x22')&&typeof _0x335f22[_0xd96e('0x23')]===_0xd96e('0x22');var _0x52015f=_0x447f18[_0xd96e('0x24')];var _0xce02c=_0x33d97b?0x0:_0x335f22[_0xd96e('0x21')];var _0x2e22d8=_0x33d97b?_0x447f18[_0xd96e('0x24')]:_0x335f22[_0xd96e('0x21')]+_0x335f22[_0xd96e('0x23')];var _0x352b8d;if(_0x2e22d8>=_0x52015f){_0x2e22d8=_0x52015f;_0x352b8d=0xc8;}else{_0x352b8d=0xce;}_0x391fb3['status'](_0x352b8d);return _0x391fb3[_0xd96e('0x25')](_0xd96e('0x26'),_0xce02c+'-'+_0x2e22d8+'/'+_0x52015f)['json'](_0x447f18);}return null;};}function patchUpdates(_0x143a02){return function(_0x18d3ed){try{jsonpatch[_0xd96e('0x27')](_0x18d3ed,_0x143a02,!![]);}catch(_0x56ba76){return BPromise[_0xd96e('0x28')](_0x56ba76);}return _0x18d3ed['save']();};}function saveUpdates(_0xbcf90,_0x55f5e8){return function(_0x289ea0){if(_0x289ea0){return _0x289ea0[_0xd96e('0x29')](_0xbcf90)[_0xd96e('0x2a')](function(_0x16ff98){return _0x16ff98;});}return null;};}function removeEntity(_0x52afee,_0x4b697c){return function(_0x23c5b3){if(_0x23c5b3){return _0x23c5b3[_0xd96e('0x2b')]()[_0xd96e('0x2a')](function(){var _0x5690f3=_0x23c5b3['get']({'plain':!![]});var _0xd794e=_0xd96e('0x2c');return db['UserProfileResource'][_0xd96e('0x2b')]({'where':{'type':_0xd794e,'resourceId':_0x5690f3['id']}})[_0xd96e('0x2a')](function(){return _0x23c5b3;});})['then'](function(){_0x52afee[_0xd96e('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1652f2,_0x4c565b){return function(_0x4adab2){if(!_0x4adab2){_0x1652f2[_0xd96e('0x1d')](0x194);}return _0x4adab2;};}function handleError(_0x1ce8e0,_0x495f8e){_0x495f8e=_0x495f8e||0x1f4;return function(_0x3d2957){logger[_0xd96e('0x2d')](_0x3d2957['stack']);if(_0x3d2957[_0xd96e('0x2e')]){delete _0x3d2957[_0xd96e('0x2e')];}_0x1ce8e0[_0xd96e('0x1e')](_0x495f8e)[_0xd96e('0x2f')](_0x3d2957);};}exports[_0xd96e('0x30')]=function(_0x16a398,_0x40d28c){var _0xee287b={},_0x276920={},_0x32c28f={'count':0x0,'rows':[]};var _0x36b9f3=_[_0xd96e('0x31')](db[_0xd96e('0x32')][_0xd96e('0x33')],function(_0x2d1666){return{'name':_0x2d1666[_0xd96e('0x34')],'type':_0x2d1666[_0xd96e('0x35')][_0xd96e('0x36')]};});_0x276920[_0xd96e('0x37')]=_[_0xd96e('0x31')](_0x36b9f3,_0xd96e('0x2e'));_0x276920[_0xd96e('0x38')]=_['keys'](_0x16a398[_0xd96e('0x38')]);_0x276920[_0xd96e('0x39')]=_[_0xd96e('0x3a')](_0x276920[_0xd96e('0x37')],_0x276920[_0xd96e('0x38')]);_0xee287b[_0xd96e('0x3b')]=_[_0xd96e('0x3a')](_0x276920[_0xd96e('0x37')],qs[_0xd96e('0x3c')](_0x16a398[_0xd96e('0x38')]['fields']));_0xee287b[_0xd96e('0x3b')]=_0xee287b[_0xd96e('0x3b')][_0xd96e('0x3d')]?_0xee287b['attributes']:_0x276920[_0xd96e('0x37')];if(!_0x16a398[_0xd96e('0x38')][_0xd96e('0x3e')](_0xd96e('0x3f'))){_0xee287b[_0xd96e('0x23')]=qs['limit'](_0x16a398[_0xd96e('0x38')][_0xd96e('0x23')]);_0xee287b[_0xd96e('0x21')]=qs[_0xd96e('0x21')](_0x16a398[_0xd96e('0x38')]['offset']);}_0xee287b['order']=qs[_0xd96e('0x40')](_0x16a398[_0xd96e('0x38')][_0xd96e('0x40')]);_0xee287b['where']=qs[_0xd96e('0x39')](_[_0xd96e('0x41')](_0x16a398[_0xd96e('0x38')],_0x276920[_0xd96e('0x39')]),_0x36b9f3);if(_0x16a398[_0xd96e('0x38')][_0xd96e('0x42')]){_0xee287b[_0xd96e('0x43')]=_[_0xd96e('0x44')](_0xee287b[_0xd96e('0x43')],{'$or':_[_0xd96e('0x31')](_0x36b9f3,function(_0xd4fe5c){if(_0xd4fe5c['type']!==_0xd96e('0x45')){var _0x382758={};_0x382758[_0xd4fe5c['name']]={'$like':'%'+_0x16a398[_0xd96e('0x38')][_0xd96e('0x42')]+'%'};return _0x382758;}})});}_0xee287b=_[_0xd96e('0x44')]({},_0xee287b,_0x16a398['options']);var _0x4374f8={'where':_0xee287b[_0xd96e('0x43')]};return db[_0xd96e('0x32')]['count'](_0x4374f8)[_0xd96e('0x2a')](function(_0x5550d1){_0x32c28f[_0xd96e('0x24')]=_0x5550d1;if(_0x16a398['query'][_0xd96e('0x46')]){_0xee287b['include']=[{'all':!![]}];}return db['SmsQueue'][_0xd96e('0x47')](_0xee287b);})[_0xd96e('0x2a')](function(_0x1ceba2){_0x32c28f['rows']=_0x1ceba2;return _0x32c28f;})[_0xd96e('0x2a')](respondWithFilteredResult(_0x40d28c,_0xee287b))[_0xd96e('0x48')](handleError(_0x40d28c,null));};exports['show']=function(_0x2c7368,_0x3ae4c2){var _0x4d5387={'raw':!![],'where':{'id':_0x2c7368['params']['id']}},_0x315542={};_0x315542[_0xd96e('0x37')]=_[_0xd96e('0x49')](db[_0xd96e('0x32')][_0xd96e('0x33')]);_0x315542[_0xd96e('0x38')]=_[_0xd96e('0x49')](_0x2c7368[_0xd96e('0x38')]);_0x315542['filters']=_[_0xd96e('0x3a')](_0x315542[_0xd96e('0x37')],_0x315542[_0xd96e('0x38')]);_0x4d5387[_0xd96e('0x3b')]=_[_0xd96e('0x3a')](_0x315542[_0xd96e('0x37')],qs[_0xd96e('0x3c')](_0x2c7368[_0xd96e('0x38')][_0xd96e('0x3c')]));_0x4d5387[_0xd96e('0x3b')]=_0x4d5387[_0xd96e('0x3b')][_0xd96e('0x3d')]?_0x4d5387[_0xd96e('0x3b')]:_0x315542[_0xd96e('0x37')];if(_0x2c7368[_0xd96e('0x38')]['includeAll']){_0x4d5387[_0xd96e('0x4a')]=[{'all':!![]}];}_0x4d5387=_[_0xd96e('0x44')]({},_0x4d5387,_0x2c7368['options']);return db['SmsQueue'][_0xd96e('0x4b')](_0x4d5387)[_0xd96e('0x2a')](handleEntityNotFound(_0x3ae4c2,null))[_0xd96e('0x2a')](respondWithResult(_0x3ae4c2,null))[_0xd96e('0x48')](handleError(_0x3ae4c2,null));};exports[_0xd96e('0x4c')]=function(_0x126c1f,_0x7d7137){return db[_0xd96e('0x32')][_0xd96e('0x4c')](_0x126c1f[_0xd96e('0x4d')],{})[_0xd96e('0x2a')](function(_0xd72182){var _0x20ffd5=_0x126c1f[_0xd96e('0x4e')][_0xd96e('0x4f')]({'plain':!![]});if(!_0x20ffd5)throw new Error(_0xd96e('0x50'));if(_0x20ffd5[_0xd96e('0x51')]==='user'){var _0x5cec5a=_0xd72182[_0xd96e('0x4f')]({'plain':!![]});var _0x247ef6=_0xd96e('0x2c');return db[_0xd96e('0x52')][_0xd96e('0x4b')]({'where':{'name':_0x247ef6,'userProfileId':_0x20ffd5['userProfileId']},'raw':!![]})[_0xd96e('0x2a')](function(_0x214513){if(_0x214513&&_0x214513['autoAssociation']===0x0){return db[_0xd96e('0x53')][_0xd96e('0x4c')]({'name':_0x5cec5a[_0xd96e('0x2e')],'resourceId':_0x5cec5a['id'],'type':_0x214513['name'],'sectionId':_0x214513['id']},{})[_0xd96e('0x2a')](function(){return _0xd72182;});}else{return _0xd72182;}})[_0xd96e('0x48')](function(_0x6ed64){logger[_0xd96e('0x2d')](_0xd96e('0x54'),_0x6ed64);throw _0x6ed64;});}return _0xd72182;})[_0xd96e('0x2a')](respondWithResult(_0x7d7137,0xc9))[_0xd96e('0x48')](handleError(_0x7d7137,null));};exports[_0xd96e('0x29')]=function(_0x3df8a7,_0x264f50){if(_0x3df8a7['body']['id']){delete _0x3df8a7['body']['id'];}return db['SmsQueue'][_0xd96e('0x4b')]({'where':{'id':_0x3df8a7[_0xd96e('0x55')]['id']}})[_0xd96e('0x2a')](handleEntityNotFound(_0x264f50,null))[_0xd96e('0x2a')](saveUpdates(_0x3df8a7['body'],null))[_0xd96e('0x2a')](respondWithResult(_0x264f50,null))[_0xd96e('0x48')](handleError(_0x264f50,null));};exports[_0xd96e('0x2b')]=function(_0x3771b9,_0x13221b){return db[_0xd96e('0x32')][_0xd96e('0x4b')]({'where':{'id':_0x3771b9[_0xd96e('0x55')]['id']}})[_0xd96e('0x2a')](handleEntityNotFound(_0x13221b,null))[_0xd96e('0x2a')](removeEntity(_0x13221b,null))[_0xd96e('0x48')](handleError(_0x13221b,null));};exports['describe']=function(_0x104130,_0x4fa00d){return db[_0xd96e('0x32')][_0xd96e('0x56')]()[_0xd96e('0x2a')](respondWithResult(_0x4fa00d,null))[_0xd96e('0x48')](handleError(_0x4fa00d,null));};exports[_0xd96e('0x57')]=function(_0x9aef9d,_0x3bc5ea,_0x761a7){var _0x5c35ea={'raw':!![],'where':{}},_0x1b50ca={},_0xe92b6a;return db[_0xd96e('0x32')][_0xd96e('0x58')]({'where':{'id':_0x9aef9d[_0xd96e('0x55')]['id']}})[_0xd96e('0x2a')](handleEntityNotFound(_0x3bc5ea,null))[_0xd96e('0x2a')](function(_0x13817b){if(_0x13817b){_0xe92b6a=_0x13817b[_0xd96e('0x4f')]({'plain':!![]});_0x1b50ca['model']=_[_0xd96e('0x49')](db[_0xd96e('0x59')][_0xd96e('0x33')]);_0x1b50ca['query']=_[_0xd96e('0x49')](_0x9aef9d[_0xd96e('0x38')]);_0x1b50ca['filters']=_[_0xd96e('0x3a')](_0x1b50ca[_0xd96e('0x37')],_0x1b50ca[_0xd96e('0x38')]);_0x5c35ea[_0xd96e('0x3b')]=_[_0xd96e('0x3a')](_0x1b50ca[_0xd96e('0x37')],qs[_0xd96e('0x3c')](_0x9aef9d['query']['fields']));_0x5c35ea['attributes']=_0x5c35ea[_0xd96e('0x3b')][_0xd96e('0x3d')]?_0x5c35ea[_0xd96e('0x3b')]:_0x1b50ca[_0xd96e('0x37')];if(!_0x9aef9d[_0xd96e('0x38')][_0xd96e('0x3e')]('nolimit')){_0x5c35ea[_0xd96e('0x23')]=qs[_0xd96e('0x23')](_0x9aef9d['query'][_0xd96e('0x23')]);_0x5c35ea[_0xd96e('0x21')]=qs[_0xd96e('0x21')](_0x9aef9d[_0xd96e('0x38')][_0xd96e('0x21')]);}_0x5c35ea['order']=qs[_0xd96e('0x40')](_0x9aef9d[_0xd96e('0x38')][_0xd96e('0x40')]);_0x5c35ea[_0xd96e('0x43')]=qs[_0xd96e('0x39')](_['pick'](_0x9aef9d[_0xd96e('0x38')],_0x1b50ca['filters']));_0x5c35ea['where'][_0xd96e('0x5a')]=_0x13817b['id'];if(_0x9aef9d[_0xd96e('0x38')][_0xd96e('0x42')]){_0x5c35ea[_0xd96e('0x43')]=_['merge'](_0x5c35ea[_0xd96e('0x43')],{'$or':_['map'](_0x5c35ea[_0xd96e('0x3b')],function(_0x24b32b){var _0x44e615={};_0x44e615[_0x24b32b]={'$like':'%'+_0x9aef9d['query']['filter']+'%'};return _0x44e615;})});}_0x5c35ea=_[_0xd96e('0x44')]({},_0x5c35ea,_0x9aef9d[_0xd96e('0x5b')]);return db[_0xd96e('0x59')][_0xd96e('0x47')](_0x5c35ea);}})[_0xd96e('0x2a')](function(_0x1647be){if(_0x1647be){return db[_0xd96e('0x5c')][_0xd96e('0x5d')]({'where':{'id':_[_0xd96e('0x31')](_0x1647be,_0xd96e('0x5e')),'role':_0xd96e('0x5f')},'attributes':['id',_0xd96e('0x2e'),_0xd96e('0x60'),_0xd96e('0x61'),'createdAt']});}})['then'](function(_0x192e7f){if(_0x192e7f){return{'count':_0x192e7f[_0xd96e('0x24')],'rows':_[_0xd96e('0x31')](_0x192e7f[_0xd96e('0x62')],function(_0x256b0d){return{'membername':_0x256b0d[_0xd96e('0x2e')],'UserId':_0x256b0d['id'],'queue_name':_0xe92b6a[_0xd96e('0x2e')],'SmsQueueId':_0xe92b6a['id'],'interface':util[_0xd96e('0x63')](_0xd96e('0x64'),_0xd96e('0x65'),_0x256b0d[_0xd96e('0x2e')]),'penalty':0x0,'paused':_0x256b0d[_0xd96e('0x60')],'createdAt':_0x256b0d['createdAt'],'updatedAt':_0x256b0d[_0xd96e('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd96e('0x2a')](respondWithFilteredResult(_0x3bc5ea,_0x5c35ea))['catch'](handleError(_0x3bc5ea,null));};exports[_0xd96e('0x66')]=function(_0x4e99e0,_0x4c218b,_0x4b06c6){var _0x3404a2={};var _0x415f51={};var _0x5e5595;var _0x2542cf;return db[_0xd96e('0x32')][_0xd96e('0x58')]({'where':{'id':_0x4e99e0[_0xd96e('0x55')]['id']}})[_0xd96e('0x2a')](handleEntityNotFound(_0x4c218b,null))['then'](function(_0x1363ad){if(_0x1363ad){_0x5e5595=_0x1363ad;_0x415f51['model']=_[_0xd96e('0x49')](db[_0xd96e('0x67')][_0xd96e('0x33')]);_0x415f51[_0xd96e('0x38')]=_[_0xd96e('0x49')](_0x4e99e0[_0xd96e('0x38')]);_0x415f51[_0xd96e('0x39')]=_[_0xd96e('0x3a')](_0x415f51[_0xd96e('0x37')],_0x415f51[_0xd96e('0x38')]);_0x3404a2[_0xd96e('0x3b')]=_[_0xd96e('0x3a')](_0x415f51[_0xd96e('0x37')],qs[_0xd96e('0x3c')](_0x4e99e0[_0xd96e('0x38')][_0xd96e('0x3c')]));_0x3404a2['attributes']=_0x3404a2[_0xd96e('0x3b')][_0xd96e('0x3d')]?_0x3404a2['attributes']:_0x415f51[_0xd96e('0x37')];_0x3404a2[_0xd96e('0x68')]=qs[_0xd96e('0x40')](_0x4e99e0[_0xd96e('0x38')]['sort']);_0x3404a2['where']=qs[_0xd96e('0x39')](_['pick'](_0x4e99e0[_0xd96e('0x38')],_0x415f51['filters']));if(_0x4e99e0[_0xd96e('0x38')][_0xd96e('0x42')]){_0x3404a2[_0xd96e('0x43')]=_[_0xd96e('0x44')](_0x3404a2[_0xd96e('0x43')],{'$or':_[_0xd96e('0x31')](_0x3404a2[_0xd96e('0x3b')],function(_0x284119){var _0x24df7f={};_0x24df7f[_0x284119]={'$like':'%'+_0x4e99e0[_0xd96e('0x38')]['filter']+'%'};return _0x24df7f;})});}_0x3404a2=_[_0xd96e('0x44')]({},_0x3404a2,_0x4e99e0[_0xd96e('0x5b')]);return _0x5e5595['getTeams'](_0x3404a2);}})[_0xd96e('0x2a')](function(_0x2413bb){if(_0x2413bb){_0x2542cf=_0x2413bb[_0xd96e('0x3d')];if(!_0x4e99e0[_0xd96e('0x38')][_0xd96e('0x3e')](_0xd96e('0x3f'))){_0x3404a2['limit']=qs[_0xd96e('0x23')](_0x4e99e0[_0xd96e('0x38')]['limit']);_0x3404a2['offset']=qs[_0xd96e('0x21')](_0x4e99e0[_0xd96e('0x38')][_0xd96e('0x21')]);}return _0x5e5595['getTeams'](_0x3404a2);}})[_0xd96e('0x2a')](function(_0x5970c1){if(_0x5970c1){return _0x5970c1?{'count':_0x2542cf,'rows':_0x5970c1}:null;}})[_0xd96e('0x2a')](respondWithResult(_0x4c218b,null))['catch'](handleError(_0x4c218b,null));};exports[_0xd96e('0x69')]=function(_0x4dae73,_0x366e41,_0x56f309){var _0x50f752=_0x4dae73[_0xd96e('0x4d')][_0xd96e('0x6a')];return db[_0xd96e('0x67')]['findAll']({'where':{'id':_0x50f752},'attributes':['id'],'include':[{'model':db[_0xd96e('0x5c')],'as':_0xd96e('0x6b'),'attributes':['id',_0xd96e('0x2e'),_0xd96e('0x6c'),_0xd96e('0x6d'),_0xd96e('0x6e')],'raw':!![]}]})['then'](function(_0x8d51f9){if(_0x8d51f9){var _0x19607d=_['flatMap'](_0x8d51f9,function(_0x4e98ea){var _0x199db3=_0x4e98ea['get']({'plain':!![]});return _0x199db3[_0xd96e('0x6b')];});return db[_0xd96e('0x32')][_0xd96e('0x4b')]({'where':{'id':_0x4dae73[_0xd96e('0x55')]['id']}})[_0xd96e('0x2a')](function(_0xaf0eb1){return db[_0xd96e('0x6f')][_0xd96e('0x70')](function(_0x41c8a0){return _0xaf0eb1[_0xd96e('0x69')](_0x50f752,{'transaction':_0x41c8a0})['then'](function(){return BPromise['each'](_0x19607d,function(_0x1e2096){return db[_0xd96e('0x59')][_0xd96e('0x71')]({'where':{'UserId':_0x1e2096['id'],'SmsQueueId':_0x4dae73[_0xd96e('0x55')]['id']},'transaction':_0x41c8a0});});})[_0xd96e('0x2a')](function(){_0x19607d['forEach'](function(_0x58baf2){socket[_0xd96e('0x72')](_0xd96e('0x73'),{'UserId':_0x58baf2['id'],'SmsQueueId':_0xaf0eb1['id']});});});});});}})[_0xd96e('0x2a')](respondWithStatusCode(_0x366e41,null))['catch'](handleError(_0x366e41,null));};exports['removeTeams']=function(_0x5c0af5,_0xb750e5,_0x575af2){return db[_0xd96e('0x67')][_0xd96e('0x47')]({'where':{'id':_0x5c0af5[_0xd96e('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0xd96e('0x5c')],'as':_0xd96e('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xd96e('0x2a')](handleEntityNotFound(_0xb750e5,null))[_0xd96e('0x2a')](function(_0x8535d7){var _0x465849=_[_0xd96e('0x31')](_0x8535d7,'id');var _0x5da7e0=[];var _0x3fb7ec=[];var _0x5aa9b3=squel[_0xd96e('0x74')]();_0x5aa9b3['field'](_0xd96e('0x75'))['from']('team_has_sms_queues','tq')[_0xd96e('0x76')](_0xd96e('0x77'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xd96e('0x43')](_0xd96e('0x78'),_0x5c0af5[_0xd96e('0x55')]['id']);for(var _0x2af90a=0x0;_0x2af90a<_0x8535d7[_0xd96e('0x3d')];_0x2af90a+=0x1){let _0x52eba4=_0x8535d7[_0x2af90a];for(var _0x4c2480=0x0;_0x4c2480<_0x52eba4[_0xd96e('0x6b')]['length'];_0x4c2480+=0x1){let _0x29ebe1=_0x52eba4[_0xd96e('0x6b')][_0x4c2480];var _0x237f83=_0x5aa9b3['clone']();_0x237f83['where']('ut.UserId\x20=\x20?',_0x29ebe1['id']);_0x3fb7ec[_0xd96e('0x79')](db[_0xd96e('0x6f')][_0xd96e('0x38')](_0x237f83[_0xd96e('0x7a')](),{'type':db[_0xd96e('0x6f')][_0xd96e('0x7b')][_0xd96e('0x7c')]})[_0xd96e('0x2a')](function(_0x5d0145){if(_0x5d0145[_0xd96e('0x3d')]===0x1){return _0x29ebe1['id'];}else{var _0x19d047=_[_0xd96e('0x7d')](_[_0xd96e('0x31')](_0x5d0145,'TeamId'),function(_0x223f3f){return _[_0xd96e('0x7e')](_0x465849,_0x223f3f);});if(_0x19d047){return _0x29ebe1['id'];}}}));}}return BPromise['all'](_0x3fb7ec)[_0xd96e('0x2a')](function(_0x59d620){_0x5da7e0=_(_0x5da7e0)[_0xd96e('0x7f')](_0x59d620)[_0xd96e('0x80')]()[_0xd96e('0x81')]();return db[_0xd96e('0x32')][_0xd96e('0x4b')]({'where':{'id':_0x5c0af5[_0xd96e('0x55')]['id']}})[_0xd96e('0x2a')](function(_0x293ada){return db['sequelize'][_0xd96e('0x70')](function(_0x3e413f){return _0x293ada[_0xd96e('0x82')](_0x5c0af5[_0xd96e('0x38')]['ids'],{'transaction':_0x3e413f})['then'](function(){if(!_[_0xd96e('0x83')](_0x5da7e0)){return _0x293ada[_0xd96e('0x84')](_0x5da7e0,{'transaction':_0x3e413f});}})[_0xd96e('0x2a')](function(){_0x5da7e0[_0xd96e('0x85')](function(_0x390c4d){socket[_0xd96e('0x72')]('userSmsQueue:remove',{'UserId':_0x390c4d,'SmsQueueId':_0x293ada['id']});});});});});});})[_0xd96e('0x2a')](respondWithStatusCode(_0xb750e5,null))[_0xd96e('0x48')](handleError(_0xb750e5,null));};exports[_0xd96e('0x86')]=function(_0x55c0b6,_0x5035ba,_0x46810f){return db['SmsQueue'][_0xd96e('0x4b')]({'where':{'id':_0x55c0b6[_0xd96e('0x55')]['id']}})[_0xd96e('0x2a')](handleEntityNotFound(_0x5035ba,null))['then'](function(_0x10ed2a){if(_0x10ed2a){return _0x10ed2a[_0xd96e('0x86')](_0x55c0b6[_0xd96e('0x4d')][_0xd96e('0x6a')],_['omit'](_0x55c0b6[_0xd96e('0x4d')],[_0xd96e('0x6a'),'id'])||{})[_0xd96e('0x87')](function(_0x38a586){for(var _0x328573=0x0;_0x328573<_0x55c0b6[_0xd96e('0x4d')][_0xd96e('0x6a')][_0xd96e('0x3d')];_0x328573+=0x1){socket[_0xd96e('0x72')]('userSmsQueue:save',{'UserId':Number(_0x55c0b6['body'][_0xd96e('0x6a')][_0x328573]),'SmsQueueId':Number(_0x55c0b6[_0xd96e('0x55')]['id'])});}return _0x38a586;});}})[_0xd96e('0x2a')](respondWithResult(_0x5035ba,null))[_0xd96e('0x48')](handleError(_0x5035ba,null));};exports[_0xd96e('0x84')]=function(_0x104e84,_0x173e67,_0x3e3e5e){return db[_0xd96e('0x32')][_0xd96e('0x4b')]({'where':{'id':_0x104e84[_0xd96e('0x55')]['id']}})[_0xd96e('0x2a')](handleEntityNotFound(_0x173e67,null))[_0xd96e('0x2a')](function(_0x40141f){if(_0x40141f){return _0x40141f[_0xd96e('0x84')](_0x104e84[_0xd96e('0x38')][_0xd96e('0x6a')])[_0xd96e('0x2a')](function(){if(_[_0xd96e('0x88')](_0x104e84[_0xd96e('0x38')]['ids'])){for(var _0x5cf55f=0x0;_0x5cf55f<_0x104e84[_0xd96e('0x38')]['ids'][_0xd96e('0x3d')];_0x5cf55f+=0x1){socket[_0xd96e('0x72')](_0xd96e('0x89'),{'UserId':Number(_0x104e84[_0xd96e('0x38')][_0xd96e('0x6a')][_0x5cf55f]),'SmsQueueId':Number(_0x104e84['params']['id'])});}}else{socket[_0xd96e('0x72')](_0xd96e('0x89'),{'UserId':Number(_0x104e84['query'][_0xd96e('0x6a')]),'SmsQueueId':Number(_0x104e84[_0xd96e('0x55')]['id'])});}});}})[_0xd96e('0x2a')](respondWithStatusCode(_0x173e67,null))[_0xd96e('0x48')](handleError(_0x173e67,null));};exports[_0xd96e('0x8a')]=function(_0x41f1ac,_0x1612ea,_0x21dce3){var _0x27a57a={};var _0x407f96={};var _0x138758;var _0x2a927f;return db[_0xd96e('0x32')][_0xd96e('0x58')]({'where':{'id':_0x41f1ac[_0xd96e('0x55')]['id']}})[_0xd96e('0x2a')](handleEntityNotFound(_0x1612ea,null))[_0xd96e('0x2a')](function(_0x2e791c){if(_0x2e791c){_0x138758=_0x2e791c;_0x407f96[_0xd96e('0x37')]=_[_0xd96e('0x49')](db[_0xd96e('0x5c')]['rawAttributes']);_0x407f96[_0xd96e('0x38')]=_[_0xd96e('0x49')](_0x41f1ac[_0xd96e('0x38')]);_0x407f96[_0xd96e('0x39')]=_[_0xd96e('0x3a')](_0x407f96[_0xd96e('0x37')],_0x407f96[_0xd96e('0x38')]);_0x27a57a['attributes']=_[_0xd96e('0x3a')](_0x407f96[_0xd96e('0x37')],qs['fields'](_0x41f1ac[_0xd96e('0x38')][_0xd96e('0x3c')]));_0x27a57a[_0xd96e('0x3b')]=_0x27a57a[_0xd96e('0x3b')][_0xd96e('0x3d')]?_0x27a57a[_0xd96e('0x3b')]:_0x407f96[_0xd96e('0x37')];_0x27a57a[_0xd96e('0x68')]=qs[_0xd96e('0x40')](_0x41f1ac[_0xd96e('0x38')][_0xd96e('0x40')]);_0x27a57a[_0xd96e('0x43')]=qs[_0xd96e('0x39')](_['pick'](_0x41f1ac[_0xd96e('0x38')],_0x407f96[_0xd96e('0x39')]));if(_0x41f1ac[_0xd96e('0x38')][_0xd96e('0x42')]){_0x27a57a[_0xd96e('0x43')]=_[_0xd96e('0x44')](_0x27a57a[_0xd96e('0x43')],{'$or':_[_0xd96e('0x31')](_0x27a57a[_0xd96e('0x3b')],function(_0x3a7110){var _0x58e41d={};_0x58e41d[_0x3a7110]={'$like':'%'+_0x41f1ac[_0xd96e('0x38')][_0xd96e('0x42')]+'%'};return _0x58e41d;})});}_0x27a57a=_[_0xd96e('0x44')]({},_0x27a57a,_0x41f1ac[_0xd96e('0x5b')]);return _0x138758[_0xd96e('0x8a')](_0x27a57a);}})[_0xd96e('0x2a')](function(_0x1d7f17){if(_0x1d7f17){_0x2a927f=_0x1d7f17[_0xd96e('0x3d')];if(!_0x41f1ac['query'][_0xd96e('0x3e')]('nolimit')){_0x27a57a[_0xd96e('0x23')]=qs['limit'](_0x41f1ac['query'][_0xd96e('0x23')]);_0x27a57a['offset']=qs[_0xd96e('0x21')](_0x41f1ac[_0xd96e('0x38')]['offset']);}return _0x138758['getAgents'](_0x27a57a);}})['then'](function(_0x421fe4){if(_0x421fe4){return _0x421fe4?{'count':_0x2a927f,'rows':_0x421fe4}:null;}})[_0xd96e('0x2a')](respondWithResult(_0x1612ea,null))[_0xd96e('0x48')](handleError(_0x1612ea,null));}; \ No newline at end of file +var _0x098c=['UserId','agent','smsPause','createdAt','format','updatedAt','getTeams','addTeams','ids','Team','Agents','online','voicePause','flatMap','sequelize','transaction','forEach','userSmsQueue:save','removeTeams','User','select','tq.TeamId','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','all','compact','value','removeAgents','emit','userSmsQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','register','status','end','json','offset','undefined','limit','count','apply','save','update','then','destroy','get','SmsQueues','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','SmsQueue','includeAll','include','findAll','show','length','catch','create','body','role','user','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserSmsQueue','order','SmsQueueId','findAndCountAll'];(function(_0x5469f7,_0x3f390e){var _0x78c529=function(_0x7f578e){while(--_0x7f578e){_0x5469f7['push'](_0x5469f7['shift']());}};_0x78c529(++_0x3f390e);}(_0x098c,0x133));var _0xc098=function(_0x533bc2,_0x3cd49a){_0x533bc2=_0x533bc2-0x0;var _0x16161a=_0x098c[_0x533bc2];return _0x16161a;};'use strict';var emlformat=require(_0xc098('0x0'));var rimraf=require(_0xc098('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc098('0x2'));var rp=require('request-promise');var moment=require(_0xc098('0x3'));var BPromise=require(_0xc098('0x4'));var Mustache=require(_0xc098('0x5'));var util=require(_0xc098('0x6'));var path=require(_0xc098('0x7'));var sox=require('sox');var csv=require(_0xc098('0x8'));var ejs=require(_0xc098('0x9'));var fs=require('fs');var fs_extra=require(_0xc098('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc098('0xb'));var deskjs=require(_0xc098('0xc'));var toCsv=require(_0xc098('0x8'));var querystring=require(_0xc098('0xd'));var Papa=require(_0xc098('0xe'));var Redis=require(_0xc098('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc098('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc098('0x11'));var logger=require(_0xc098('0x12'))(_0xc098('0x13'));var utils=require(_0xc098('0x14'));var config=require(_0xc098('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc098('0x16'))['db'];config[_0xc098('0x17')]=_[_0xc098('0x18')](config[_0xc098('0x17')],{'host':_0xc098('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc098('0x1a'))[_0xc098('0x1b')](socket);function respondWithStatusCode(_0x396420,_0x1e0996){_0x1e0996=_0x1e0996||0xcc;return function(_0x902a1d){if(_0x902a1d){return _0x396420['sendStatus'](_0x1e0996);}return _0x396420[_0xc098('0x1c')](_0x1e0996)[_0xc098('0x1d')]();};}function respondWithResult(_0x34d6a0,_0x2606f3){_0x2606f3=_0x2606f3||0xc8;return function(_0x576675){if(_0x576675){return _0x34d6a0[_0xc098('0x1c')](_0x2606f3)[_0xc098('0x1e')](_0x576675);}};}function respondWithFilteredResult(_0x390255,_0x122174){return function(_0x4ccef9){if(_0x4ccef9){var _0xf57e49=typeof _0x122174[_0xc098('0x1f')]===_0xc098('0x20')&&typeof _0x122174[_0xc098('0x21')]==='undefined';var _0x426fc5=_0x4ccef9['count'];var _0x1a19a6=_0xf57e49?0x0:_0x122174[_0xc098('0x1f')];var _0xbc8ea5=_0xf57e49?_0x4ccef9[_0xc098('0x22')]:_0x122174[_0xc098('0x1f')]+_0x122174[_0xc098('0x21')];var _0x11c8fc;if(_0xbc8ea5>=_0x426fc5){_0xbc8ea5=_0x426fc5;_0x11c8fc=0xc8;}else{_0x11c8fc=0xce;}_0x390255[_0xc098('0x1c')](_0x11c8fc);return _0x390255['set']('Content-Range',_0x1a19a6+'-'+_0xbc8ea5+'/'+_0x426fc5)[_0xc098('0x1e')](_0x4ccef9);}return null;};}function patchUpdates(_0x49fae0){return function(_0x29ca21){try{jsonpatch[_0xc098('0x23')](_0x29ca21,_0x49fae0,!![]);}catch(_0x3ea1f4){return BPromise['reject'](_0x3ea1f4);}return _0x29ca21[_0xc098('0x24')]();};}function saveUpdates(_0x4fd9f8,_0x3ff779){return function(_0x202042){if(_0x202042){return _0x202042[_0xc098('0x25')](_0x4fd9f8)[_0xc098('0x26')](function(_0x5087d0){return _0x5087d0;});}return null;};}function removeEntity(_0x84405e,_0x3daf22){return function(_0x3b13f2){if(_0x3b13f2){return _0x3b13f2[_0xc098('0x27')]()[_0xc098('0x26')](function(){var _0x2e9899=_0x3b13f2[_0xc098('0x28')]({'plain':!![]});var _0x3bf568=_0xc098('0x29');return db['UserProfileResource'][_0xc098('0x27')]({'where':{'type':_0x3bf568,'resourceId':_0x2e9899['id']}})[_0xc098('0x26')](function(){return _0x3b13f2;});})[_0xc098('0x26')](function(){_0x84405e[_0xc098('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd06bfa,_0x487d18){return function(_0x561cf8){if(!_0x561cf8){_0xd06bfa[_0xc098('0x2a')](0x194);}return _0x561cf8;};}function handleError(_0x69076b,_0xc3bbcd){_0xc3bbcd=_0xc3bbcd||0x1f4;return function(_0x547391){logger[_0xc098('0x2b')](_0x547391[_0xc098('0x2c')]);if(_0x547391[_0xc098('0x2d')]){delete _0x547391[_0xc098('0x2d')];}_0x69076b['status'](_0xc3bbcd)[_0xc098('0x2e')](_0x547391);};}exports[_0xc098('0x2f')]=function(_0x1c23af,_0x2f9ab3){var _0x3c76dc={},_0x2ac5fc={},_0x101c86={'count':0x0,'rows':[]};var _0x4d261d=_[_0xc098('0x30')](db['SmsQueue'][_0xc098('0x31')],function(_0x4af87e){return{'name':_0x4af87e[_0xc098('0x32')],'type':_0x4af87e[_0xc098('0x33')][_0xc098('0x34')]};});_0x2ac5fc[_0xc098('0x35')]=_[_0xc098('0x30')](_0x4d261d,_0xc098('0x2d'));_0x2ac5fc[_0xc098('0x36')]=_[_0xc098('0x37')](_0x1c23af[_0xc098('0x36')]);_0x2ac5fc[_0xc098('0x38')]=_['intersection'](_0x2ac5fc[_0xc098('0x35')],_0x2ac5fc[_0xc098('0x36')]);_0x3c76dc[_0xc098('0x39')]=_[_0xc098('0x3a')](_0x2ac5fc[_0xc098('0x35')],qs['fields'](_0x1c23af['query'][_0xc098('0x3b')]));_0x3c76dc[_0xc098('0x39')]=_0x3c76dc['attributes']['length']?_0x3c76dc['attributes']:_0x2ac5fc[_0xc098('0x35')];if(!_0x1c23af[_0xc098('0x36')][_0xc098('0x3c')](_0xc098('0x3d'))){_0x3c76dc['limit']=qs[_0xc098('0x21')](_0x1c23af[_0xc098('0x36')][_0xc098('0x21')]);_0x3c76dc[_0xc098('0x1f')]=qs[_0xc098('0x1f')](_0x1c23af[_0xc098('0x36')]['offset']);}_0x3c76dc['order']=qs[_0xc098('0x3e')](_0x1c23af[_0xc098('0x36')][_0xc098('0x3e')]);_0x3c76dc[_0xc098('0x3f')]=qs[_0xc098('0x38')](_[_0xc098('0x40')](_0x1c23af[_0xc098('0x36')],_0x2ac5fc[_0xc098('0x38')]),_0x4d261d);if(_0x1c23af['query'][_0xc098('0x41')]){_0x3c76dc[_0xc098('0x3f')]=_[_0xc098('0x42')](_0x3c76dc[_0xc098('0x3f')],{'$or':_['map'](_0x4d261d,function(_0x43f64f){if(_0x43f64f[_0xc098('0x33')]!==_0xc098('0x43')){var _0x292f4c={};_0x292f4c[_0x43f64f['name']]={'$like':'%'+_0x1c23af['query']['filter']+'%'};return _0x292f4c;}})});}_0x3c76dc=_[_0xc098('0x42')]({},_0x3c76dc,_0x1c23af[_0xc098('0x44')]);var _0x503a38={'where':_0x3c76dc[_0xc098('0x3f')]};return db[_0xc098('0x45')]['count'](_0x503a38)[_0xc098('0x26')](function(_0x28c783){_0x101c86[_0xc098('0x22')]=_0x28c783;if(_0x1c23af[_0xc098('0x36')][_0xc098('0x46')]){_0x3c76dc[_0xc098('0x47')]=[{'all':!![]}];}return db[_0xc098('0x45')][_0xc098('0x48')](_0x3c76dc);})['then'](function(_0xea65e8){_0x101c86['rows']=_0xea65e8;return _0x101c86;})[_0xc098('0x26')](respondWithFilteredResult(_0x2f9ab3,_0x3c76dc))['catch'](handleError(_0x2f9ab3,null));};exports[_0xc098('0x49')]=function(_0x5e4f7d,_0xf44b4b){var _0x391a0b={'raw':!![],'where':{'id':_0x5e4f7d['params']['id']}},_0x8e64d2={};_0x8e64d2['model']=_[_0xc098('0x37')](db[_0xc098('0x45')][_0xc098('0x31')]);_0x8e64d2[_0xc098('0x36')]=_['keys'](_0x5e4f7d[_0xc098('0x36')]);_0x8e64d2['filters']=_[_0xc098('0x3a')](_0x8e64d2['model'],_0x8e64d2['query']);_0x391a0b['attributes']=_[_0xc098('0x3a')](_0x8e64d2[_0xc098('0x35')],qs['fields'](_0x5e4f7d[_0xc098('0x36')]['fields']));_0x391a0b['attributes']=_0x391a0b[_0xc098('0x39')][_0xc098('0x4a')]?_0x391a0b[_0xc098('0x39')]:_0x8e64d2[_0xc098('0x35')];if(_0x5e4f7d[_0xc098('0x36')][_0xc098('0x46')]){_0x391a0b['include']=[{'all':!![]}];}_0x391a0b=_[_0xc098('0x42')]({},_0x391a0b,_0x5e4f7d[_0xc098('0x44')]);return db['SmsQueue']['find'](_0x391a0b)[_0xc098('0x26')](handleEntityNotFound(_0xf44b4b,null))[_0xc098('0x26')](respondWithResult(_0xf44b4b,null))[_0xc098('0x4b')](handleError(_0xf44b4b,null));};exports[_0xc098('0x4c')]=function(_0x361031,_0x316b10){return db['SmsQueue']['create'](_0x361031[_0xc098('0x4d')],{})['then'](function(_0x17615e){var _0x21aae7=_0x361031['user'][_0xc098('0x28')]({'plain':!![]});if(!_0x21aae7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21aae7[_0xc098('0x4e')]===_0xc098('0x4f')){var _0x4215a9=_0x17615e[_0xc098('0x28')]({'plain':!![]});var _0x1bb4fa=_0xc098('0x29');return db[_0xc098('0x50')][_0xc098('0x51')]({'where':{'name':_0x1bb4fa,'userProfileId':_0x21aae7['userProfileId']},'raw':!![]})['then'](function(_0x18a027){if(_0x18a027&&_0x18a027[_0xc098('0x52')]===0x0){return db[_0xc098('0x53')][_0xc098('0x4c')]({'name':_0x4215a9[_0xc098('0x2d')],'resourceId':_0x4215a9['id'],'type':_0x18a027[_0xc098('0x2d')],'sectionId':_0x18a027['id']},{})['then'](function(){return _0x17615e;});}else{return _0x17615e;}})[_0xc098('0x4b')](function(_0x4f0ede){logger[_0xc098('0x2b')](_0xc098('0x54'),_0x4f0ede);throw _0x4f0ede;});}return _0x17615e;})[_0xc098('0x26')](respondWithResult(_0x316b10,0xc9))[_0xc098('0x4b')](handleError(_0x316b10,null));};exports['update']=function(_0x64d3ac,_0x40a3d5){if(_0x64d3ac['body']['id']){delete _0x64d3ac[_0xc098('0x4d')]['id'];}return db[_0xc098('0x45')][_0xc098('0x51')]({'where':{'id':_0x64d3ac[_0xc098('0x55')]['id']}})['then'](handleEntityNotFound(_0x40a3d5,null))['then'](saveUpdates(_0x64d3ac[_0xc098('0x4d')],null))[_0xc098('0x26')](respondWithResult(_0x40a3d5,null))[_0xc098('0x4b')](handleError(_0x40a3d5,null));};exports[_0xc098('0x27')]=function(_0x26872a,_0x193675){return db[_0xc098('0x45')][_0xc098('0x51')]({'where':{'id':_0x26872a[_0xc098('0x55')]['id']}})[_0xc098('0x26')](handleEntityNotFound(_0x193675,null))[_0xc098('0x26')](removeEntity(_0x193675,null))[_0xc098('0x4b')](handleError(_0x193675,null));};exports[_0xc098('0x56')]=function(_0x468b2f,_0x32b8c3){return db[_0xc098('0x45')][_0xc098('0x56')]()[_0xc098('0x26')](respondWithResult(_0x32b8c3,null))[_0xc098('0x4b')](handleError(_0x32b8c3,null));};exports['getMembers']=function(_0x4cecce,_0x44283c,_0x347eb8){var _0x4f619a={'raw':!![],'where':{}},_0x30bfe2={},_0x5e04e9;return db[_0xc098('0x45')][_0xc098('0x57')]({'where':{'id':_0x4cecce['params']['id']}})['then'](handleEntityNotFound(_0x44283c,null))[_0xc098('0x26')](function(_0x2aca9b){if(_0x2aca9b){_0x5e04e9=_0x2aca9b[_0xc098('0x28')]({'plain':!![]});_0x30bfe2[_0xc098('0x35')]=_[_0xc098('0x37')](db[_0xc098('0x58')][_0xc098('0x31')]);_0x30bfe2[_0xc098('0x36')]=_[_0xc098('0x37')](_0x4cecce[_0xc098('0x36')]);_0x30bfe2[_0xc098('0x38')]=_['intersection'](_0x30bfe2[_0xc098('0x35')],_0x30bfe2['query']);_0x4f619a[_0xc098('0x39')]=_[_0xc098('0x3a')](_0x30bfe2[_0xc098('0x35')],qs[_0xc098('0x3b')](_0x4cecce[_0xc098('0x36')]['fields']));_0x4f619a[_0xc098('0x39')]=_0x4f619a[_0xc098('0x39')][_0xc098('0x4a')]?_0x4f619a[_0xc098('0x39')]:_0x30bfe2[_0xc098('0x35')];if(!_0x4cecce[_0xc098('0x36')]['hasOwnProperty'](_0xc098('0x3d'))){_0x4f619a[_0xc098('0x21')]=qs['limit'](_0x4cecce['query'][_0xc098('0x21')]);_0x4f619a[_0xc098('0x1f')]=qs[_0xc098('0x1f')](_0x4cecce[_0xc098('0x36')][_0xc098('0x1f')]);}_0x4f619a[_0xc098('0x59')]=qs[_0xc098('0x3e')](_0x4cecce['query'][_0xc098('0x3e')]);_0x4f619a[_0xc098('0x3f')]=qs['filters'](_['pick'](_0x4cecce['query'],_0x30bfe2[_0xc098('0x38')]));_0x4f619a[_0xc098('0x3f')][_0xc098('0x5a')]=_0x2aca9b['id'];if(_0x4cecce[_0xc098('0x36')][_0xc098('0x41')]){_0x4f619a[_0xc098('0x3f')]=_['merge'](_0x4f619a[_0xc098('0x3f')],{'$or':_[_0xc098('0x30')](_0x4f619a[_0xc098('0x39')],function(_0x43b6d0){var _0x1ea816={};_0x1ea816[_0x43b6d0]={'$like':'%'+_0x4cecce[_0xc098('0x36')]['filter']+'%'};return _0x1ea816;})});}_0x4f619a=_[_0xc098('0x42')]({},_0x4f619a,_0x4cecce[_0xc098('0x44')]);return db[_0xc098('0x58')]['findAll'](_0x4f619a);}})['then'](function(_0x46dc13){if(_0x46dc13){return db['User'][_0xc098('0x5b')]({'where':{'id':_[_0xc098('0x30')](_0x46dc13,_0xc098('0x5c')),'role':_0xc098('0x5d')},'attributes':['id','name',_0xc098('0x5e'),'updatedAt',_0xc098('0x5f')]});}})[_0xc098('0x26')](function(_0x21b948){if(_0x21b948){return{'count':_0x21b948[_0xc098('0x22')],'rows':_[_0xc098('0x30')](_0x21b948['rows'],function(_0x2d4c78){return{'membername':_0x2d4c78[_0xc098('0x2d')],'UserId':_0x2d4c78['id'],'queue_name':_0x5e04e9[_0xc098('0x2d')],'SmsQueueId':_0x5e04e9['id'],'interface':util[_0xc098('0x60')]('%s/%s','SIP',_0x2d4c78[_0xc098('0x2d')]),'penalty':0x0,'paused':_0x2d4c78[_0xc098('0x5e')],'createdAt':_0x2d4c78['createdAt'],'updatedAt':_0x2d4c78[_0xc098('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc098('0x26')](respondWithFilteredResult(_0x44283c,_0x4f619a))[_0xc098('0x4b')](handleError(_0x44283c,null));};exports[_0xc098('0x62')]=function(_0x470f7b,_0x5d295b,_0xd42715){var _0x2fcd70={};var _0x2008d7={};var _0x3072e7;var _0x2097df;return db[_0xc098('0x45')][_0xc098('0x57')]({'where':{'id':_0x470f7b[_0xc098('0x55')]['id']}})[_0xc098('0x26')](handleEntityNotFound(_0x5d295b,null))[_0xc098('0x26')](function(_0x5308b3){if(_0x5308b3){_0x3072e7=_0x5308b3;_0x2008d7[_0xc098('0x35')]=_[_0xc098('0x37')](db['Team'][_0xc098('0x31')]);_0x2008d7['query']=_[_0xc098('0x37')](_0x470f7b[_0xc098('0x36')]);_0x2008d7[_0xc098('0x38')]=_[_0xc098('0x3a')](_0x2008d7['model'],_0x2008d7[_0xc098('0x36')]);_0x2fcd70['attributes']=_[_0xc098('0x3a')](_0x2008d7[_0xc098('0x35')],qs[_0xc098('0x3b')](_0x470f7b['query'][_0xc098('0x3b')]));_0x2fcd70[_0xc098('0x39')]=_0x2fcd70[_0xc098('0x39')]['length']?_0x2fcd70['attributes']:_0x2008d7[_0xc098('0x35')];_0x2fcd70[_0xc098('0x59')]=qs[_0xc098('0x3e')](_0x470f7b[_0xc098('0x36')][_0xc098('0x3e')]);_0x2fcd70[_0xc098('0x3f')]=qs[_0xc098('0x38')](_[_0xc098('0x40')](_0x470f7b['query'],_0x2008d7[_0xc098('0x38')]));if(_0x470f7b['query'][_0xc098('0x41')]){_0x2fcd70[_0xc098('0x3f')]=_[_0xc098('0x42')](_0x2fcd70[_0xc098('0x3f')],{'$or':_[_0xc098('0x30')](_0x2fcd70[_0xc098('0x39')],function(_0x692040){var _0x50f1b5={};_0x50f1b5[_0x692040]={'$like':'%'+_0x470f7b[_0xc098('0x36')][_0xc098('0x41')]+'%'};return _0x50f1b5;})});}_0x2fcd70=_['merge']({},_0x2fcd70,_0x470f7b[_0xc098('0x44')]);return _0x3072e7[_0xc098('0x62')](_0x2fcd70);}})['then'](function(_0x2564ea){if(_0x2564ea){_0x2097df=_0x2564ea['length'];if(!_0x470f7b[_0xc098('0x36')][_0xc098('0x3c')]('nolimit')){_0x2fcd70['limit']=qs[_0xc098('0x21')](_0x470f7b['query']['limit']);_0x2fcd70[_0xc098('0x1f')]=qs[_0xc098('0x1f')](_0x470f7b['query'][_0xc098('0x1f')]);}return _0x3072e7[_0xc098('0x62')](_0x2fcd70);}})['then'](function(_0x58839d){if(_0x58839d){return _0x58839d?{'count':_0x2097df,'rows':_0x58839d}:null;}})[_0xc098('0x26')](respondWithResult(_0x5d295b,null))[_0xc098('0x4b')](handleError(_0x5d295b,null));};exports[_0xc098('0x63')]=function(_0x4e8690,_0x4de09e,_0x4d9097){var _0x2b8647=_0x4e8690[_0xc098('0x4d')][_0xc098('0x64')];return db[_0xc098('0x65')]['findAll']({'where':{'id':_0x2b8647},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc098('0x66'),'attributes':['id',_0xc098('0x2d'),_0xc098('0x67'),_0xc098('0x68'),'interface'],'raw':!![]}]})['then'](function(_0x1d9e7f){if(_0x1d9e7f){var _0x3aee3c=_[_0xc098('0x69')](_0x1d9e7f,function(_0x1aa121){var _0x3a6a1c=_0x1aa121[_0xc098('0x28')]({'plain':!![]});return _0x3a6a1c[_0xc098('0x66')];});return db[_0xc098('0x45')][_0xc098('0x51')]({'where':{'id':_0x4e8690[_0xc098('0x55')]['id']}})[_0xc098('0x26')](function(_0x3782ec){return db[_0xc098('0x6a')][_0xc098('0x6b')](function(_0x28d001){return _0x3782ec['addTeams'](_0x2b8647,{'transaction':_0x28d001})[_0xc098('0x26')](function(){return BPromise['each'](_0x3aee3c,function(_0x43001d){return db[_0xc098('0x58')]['findOrCreate']({'where':{'UserId':_0x43001d['id'],'SmsQueueId':_0x4e8690['params']['id']},'transaction':_0x28d001});});})[_0xc098('0x26')](function(){_0x3aee3c[_0xc098('0x6c')](function(_0x367ff7){socket['emit'](_0xc098('0x6d'),{'UserId':_0x367ff7['id'],'SmsQueueId':_0x3782ec['id']});});});});});}})[_0xc098('0x26')](respondWithStatusCode(_0x4de09e,null))[_0xc098('0x4b')](handleError(_0x4de09e,null));};exports[_0xc098('0x6e')]=function(_0x2fa5a2,_0x101c60,_0x346b0d){return db[_0xc098('0x65')]['findAll']({'where':{'id':_0x2fa5a2[_0xc098('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0xc098('0x6f')],'as':_0xc098('0x66'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x101c60,null))['then'](function(_0x18939c){var _0x268ec4=_[_0xc098('0x30')](_0x18939c,'id');var _0x5b8607=[];var _0x37f210=[];var _0x18806d=squel[_0xc098('0x70')]();_0x18806d['field'](_0xc098('0x71'))['from'](_0xc098('0x72'),'tq')[_0xc098('0x73')](_0xc098('0x74'),'ut',_0xc098('0x75'))[_0xc098('0x3f')]('SmsQueueId\x20=\x20?',_0x2fa5a2['params']['id']);for(var _0x4bbd83=0x0;_0x4bbd83<_0x18939c[_0xc098('0x4a')];_0x4bbd83+=0x1){let _0x29e30f=_0x18939c[_0x4bbd83];for(var _0x535198=0x0;_0x535198<_0x29e30f[_0xc098('0x66')][_0xc098('0x4a')];_0x535198+=0x1){let _0x40128d=_0x29e30f[_0xc098('0x66')][_0x535198];var _0x1cb3c1=_0x18806d['clone']();_0x1cb3c1['where'](_0xc098('0x76'),_0x40128d['id']);_0x37f210['push'](db[_0xc098('0x6a')][_0xc098('0x36')](_0x1cb3c1[_0xc098('0x77')](),{'type':db['sequelize'][_0xc098('0x78')][_0xc098('0x79')]})[_0xc098('0x26')](function(_0x5d0576){if(_0x5d0576['length']===0x1){return _0x40128d['id'];}else{var _0x35e0f3=_['every'](_['map'](_0x5d0576,_0xc098('0x7a')),function(_0x6a7597){return _['includes'](_0x268ec4,_0x6a7597);});if(_0x35e0f3){return _0x40128d['id'];}}}));}}return BPromise[_0xc098('0x7b')](_0x37f210)[_0xc098('0x26')](function(_0x41d98a){_0x5b8607=_(_0x5b8607)['union'](_0x41d98a)[_0xc098('0x7c')]()[_0xc098('0x7d')]();return db['SmsQueue'][_0xc098('0x51')]({'where':{'id':_0x2fa5a2[_0xc098('0x55')]['id']}})[_0xc098('0x26')](function(_0x2b9160){return db[_0xc098('0x6a')]['transaction'](function(_0xc08f21){return _0x2b9160[_0xc098('0x6e')](_0x2fa5a2[_0xc098('0x36')][_0xc098('0x64')],{'transaction':_0xc08f21})[_0xc098('0x26')](function(){if(!_['isEmpty'](_0x5b8607)){return _0x2b9160[_0xc098('0x7e')](_0x5b8607,{'transaction':_0xc08f21});}})[_0xc098('0x26')](function(){_0x5b8607[_0xc098('0x6c')](function(_0x4a1c35){socket[_0xc098('0x7f')](_0xc098('0x80'),{'UserId':_0x4a1c35,'SmsQueueId':_0x2b9160['id']});});});});});});})[_0xc098('0x26')](respondWithStatusCode(_0x101c60,null))[_0xc098('0x4b')](handleError(_0x101c60,null));};exports[_0xc098('0x81')]=function(_0x13b35d,_0x429a5a,_0x34766f){return db['SmsQueue'][_0xc098('0x51')]({'where':{'id':_0x13b35d['params']['id']}})[_0xc098('0x26')](handleEntityNotFound(_0x429a5a,null))[_0xc098('0x26')](function(_0x27ed80){if(_0x27ed80){return _0x27ed80[_0xc098('0x81')](_0x13b35d[_0xc098('0x4d')][_0xc098('0x64')],_['omit'](_0x13b35d[_0xc098('0x4d')],['ids','id'])||{})[_0xc098('0x82')](function(_0x265008){for(var _0x54c95b=0x0;_0x54c95b<_0x13b35d['body'][_0xc098('0x64')][_0xc098('0x4a')];_0x54c95b+=0x1){socket[_0xc098('0x7f')](_0xc098('0x6d'),{'UserId':Number(_0x13b35d[_0xc098('0x4d')][_0xc098('0x64')][_0x54c95b]),'SmsQueueId':Number(_0x13b35d['params']['id'])});}return _0x265008;});}})[_0xc098('0x26')](respondWithResult(_0x429a5a,null))[_0xc098('0x4b')](handleError(_0x429a5a,null));};exports['removeAgents']=function(_0x1b7f90,_0x15256d,_0x5cbf23){return db[_0xc098('0x45')]['find']({'where':{'id':_0x1b7f90[_0xc098('0x55')]['id']}})[_0xc098('0x26')](handleEntityNotFound(_0x15256d,null))[_0xc098('0x26')](function(_0x313c72){if(_0x313c72){return _0x313c72[_0xc098('0x7e')](_0x1b7f90[_0xc098('0x36')][_0xc098('0x64')])[_0xc098('0x26')](function(){if(_[_0xc098('0x83')](_0x1b7f90[_0xc098('0x36')][_0xc098('0x64')])){for(var _0x445325=0x0;_0x445325<_0x1b7f90['query'][_0xc098('0x64')][_0xc098('0x4a')];_0x445325+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x1b7f90[_0xc098('0x36')][_0xc098('0x64')][_0x445325]),'SmsQueueId':Number(_0x1b7f90['params']['id'])});}}else{socket[_0xc098('0x7f')](_0xc098('0x80'),{'UserId':Number(_0x1b7f90[_0xc098('0x36')][_0xc098('0x64')]),'SmsQueueId':Number(_0x1b7f90['params']['id'])});}});}})[_0xc098('0x26')](respondWithStatusCode(_0x15256d,null))[_0xc098('0x4b')](handleError(_0x15256d,null));};exports[_0xc098('0x84')]=function(_0x3a02be,_0x367655,_0x44830d){var _0x367fd3={};var _0x401f5d={};var _0x2667ed;var _0x494828;return db[_0xc098('0x45')]['findOne']({'where':{'id':_0x3a02be['params']['id']}})['then'](handleEntityNotFound(_0x367655,null))['then'](function(_0x253011){if(_0x253011){_0x2667ed=_0x253011;_0x401f5d[_0xc098('0x35')]=_[_0xc098('0x37')](db[_0xc098('0x6f')][_0xc098('0x31')]);_0x401f5d[_0xc098('0x36')]=_[_0xc098('0x37')](_0x3a02be[_0xc098('0x36')]);_0x401f5d['filters']=_[_0xc098('0x3a')](_0x401f5d['model'],_0x401f5d[_0xc098('0x36')]);_0x367fd3[_0xc098('0x39')]=_['intersection'](_0x401f5d[_0xc098('0x35')],qs[_0xc098('0x3b')](_0x3a02be[_0xc098('0x36')]['fields']));_0x367fd3[_0xc098('0x39')]=_0x367fd3[_0xc098('0x39')]['length']?_0x367fd3['attributes']:_0x401f5d[_0xc098('0x35')];_0x367fd3[_0xc098('0x59')]=qs[_0xc098('0x3e')](_0x3a02be[_0xc098('0x36')][_0xc098('0x3e')]);_0x367fd3[_0xc098('0x3f')]=qs[_0xc098('0x38')](_['pick'](_0x3a02be[_0xc098('0x36')],_0x401f5d[_0xc098('0x38')]));if(_0x3a02be['query']['filter']){_0x367fd3[_0xc098('0x3f')]=_['merge'](_0x367fd3[_0xc098('0x3f')],{'$or':_[_0xc098('0x30')](_0x367fd3[_0xc098('0x39')],function(_0x7478c8){var _0x1ac3eb={};_0x1ac3eb[_0x7478c8]={'$like':'%'+_0x3a02be[_0xc098('0x36')]['filter']+'%'};return _0x1ac3eb;})});}_0x367fd3=_['merge']({},_0x367fd3,_0x3a02be[_0xc098('0x44')]);return _0x2667ed['getAgents'](_0x367fd3);}})[_0xc098('0x26')](function(_0x16fcfc){if(_0x16fcfc){_0x494828=_0x16fcfc['length'];if(!_0x3a02be['query'][_0xc098('0x3c')](_0xc098('0x3d'))){_0x367fd3[_0xc098('0x21')]=qs[_0xc098('0x21')](_0x3a02be[_0xc098('0x36')][_0xc098('0x21')]);_0x367fd3[_0xc098('0x1f')]=qs[_0xc098('0x1f')](_0x3a02be[_0xc098('0x36')]['offset']);}return _0x2667ed[_0xc098('0x84')](_0x367fd3);}})[_0xc098('0x26')](function(_0x49423c){if(_0x49423c){return _0x49423c?{'count':_0x494828,'rows':_0x49423c}:null;}})[_0xc098('0x26')](respondWithResult(_0x367655,null))[_0xc098('0x4b')](handleError(_0x367655,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 922c537..b41c4e2 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 _0x1a76=['events','../../mysqldb','save','remove','emit','hasOwnProperty','hook'];(function(_0x103877,_0x495588){var _0x128ff5=function(_0x5a0307){while(--_0x5a0307){_0x103877['push'](_0x103877['shift']());}};_0x128ff5(++_0x495588);}(_0x1a76,0x1ce));var _0x61a7=function(_0x1d4449,_0x495153){_0x1d4449=_0x1d4449-0x0;var _0x4dcde3=_0x1a76[_0x1d4449];return _0x4dcde3;};'use strict';var EventEmitter=require(_0x61a7('0x0'));var SmsQueue=require(_0x61a7('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x61a7('0x2'),'afterUpdate':'update','afterDestroy':_0x61a7('0x3')};function emitEvent(_0x2245b8){return function(_0x599a49,_0x23491b,_0x18f79a){SmsQueueEvents[_0x61a7('0x4')](_0x2245b8+':'+_0x599a49['id'],_0x599a49);SmsQueueEvents['emit'](_0x2245b8,_0x599a49);_0x18f79a(null);};}for(var e in events){if(events[_0x61a7('0x5')](e)){var event=events[e];SmsQueue[_0x61a7('0x6')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0xe26c=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue'];(function(_0x2f404a,_0x5b8624){var _0x555abd=function(_0x434265){while(--_0x434265){_0x2f404a['push'](_0x2f404a['shift']());}};_0x555abd(++_0x5b8624);}(_0xe26c,0x131));var _0xce26=function(_0x2a994b,_0x533278){_0x2a994b=_0x2a994b-0x0;var _0x564e11=_0xe26c[_0x2a994b];return _0x564e11;};'use strict';var EventEmitter=require(_0xce26('0x0'));var SmsQueue=require(_0xce26('0x1'))['db'][_0xce26('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xce26('0x3')](0x0);var events={'afterCreate':_0xce26('0x4'),'afterUpdate':_0xce26('0x5'),'afterDestroy':_0xce26('0x6')};function emitEvent(_0x3d6def){return function(_0x115c5a,_0x4f03a3,_0x3d79f6){SmsQueueEvents[_0xce26('0x7')](_0x3d6def+':'+_0x115c5a['id'],_0x115c5a);SmsQueueEvents['emit'](_0x3d6def,_0x115c5a);_0x3d79f6(null);};}for(var e in events){if(events[_0xce26('0x8')](e)){var event=events[e];SmsQueue[_0xce26('0x9')](e,emitEvent(event));}}module[_0xce26('0xa')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 710e695..38948ed 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 _0xace9=['../../config/environment','./smsQueue.attributes','exports','SmsQueue','sms_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0xace9,0xa1));var _0x9ace=function(_0x5a5abc,_0x5b7e79){_0x5a5abc=_0x5a5abc-0x0;var _0x5adbed=_0xace9[_0x5a5abc];return _0x5adbed;};'use strict';var _=require(_0x9ace('0x0'));var util=require(_0x9ace('0x1'));var logger=require(_0x9ace('0x2'))('api');var moment=require(_0x9ace('0x3'));var BPromise=require(_0x9ace('0x4'));var rp=require(_0x9ace('0x5'));var fs=require('fs');var path=require(_0x9ace('0x6'));var rimraf=require(_0x9ace('0x7'));var config=require(_0x9ace('0x8'));var attributes=require(_0x9ace('0x9'));module[_0x9ace('0xa')]=function(_0x3bcb09,_0x2ec4c4){return _0x3bcb09['define'](_0x9ace('0xb'),attributes,{'tableName':_0x9ace('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x805d=['moment','bluebird','request-promise','path','../../config/environment','./smsQueue.attributes','exports','SmsQueue','sms_queues','lodash','util','../../config/logger','api'];(function(_0x44ceee,_0x2a5e28){var _0x1a065c=function(_0x24ec16){while(--_0x24ec16){_0x44ceee['push'](_0x44ceee['shift']());}};_0x1a065c(++_0x2a5e28);}(_0x805d,0x1ea));var _0xd805=function(_0x5983b3,_0x4e81e0){_0x5983b3=_0x5983b3-0x0;var _0x5875fb=_0x805d[_0x5983b3];return _0x5875fb;};'use strict';var _=require(_0xd805('0x0'));var util=require(_0xd805('0x1'));var logger=require(_0xd805('0x2'))(_0xd805('0x3'));var moment=require(_0xd805('0x4'));var BPromise=require(_0xd805('0x5'));var rp=require(_0xd805('0x6'));var fs=require('fs');var path=require(_0xd805('0x7'));var rimraf=require('rimraf');var config=require(_0xd805('0x8'));var attributes=require(_0xd805('0x9'));module[_0xd805('0xa')]=function(_0x1d4104,_0x4a5988){return _0x1d4104['define'](_0xd805('0xb'),attributes,{'tableName':_0xd805('0xc'),'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 845ce8f..97dd2f9 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 _0x639e=['then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetSmsQueue','SmsQueue','raw','options','where','attributes','limit','include','map','model','debug','ShowSmsQueue','find','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request'];(function(_0x40e8d9,_0x292262){var _0x6fc5de=function(_0x4fdb53){while(--_0x4fdb53){_0x40e8d9['push'](_0x40e8d9['shift']());}};_0x6fc5de(++_0x292262);}(_0x639e,0x189));var _0xe639=function(_0x8585ff,_0x9232d){_0x8585ff=_0x8585ff-0x0;var _0x3ff111=_0x639e[_0x8585ff];return _0x3ff111;};'use strict';var _=require(_0xe639('0x0'));var util=require(_0xe639('0x1'));var moment=require('moment');var BPromise=require(_0xe639('0x2'));var rs=require(_0xe639('0x3'));var fs=require('fs');var Redis=require(_0xe639('0x4'));var db=require(_0xe639('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe639('0x6'))('rpc');var config=require(_0xe639('0x7'));var jayson=require(_0xe639('0x8'));var client=jayson[_0xe639('0x9')][_0xe639('0xa')]({'port':0x232a});config[_0xe639('0xb')]=_[_0xe639('0xc')](config[_0xe639('0xb')],{'host':_0xe639('0xd'),'port':0x18eb});var socket=require(_0xe639('0xe'))(new Redis(config[_0xe639('0xb')]));require('./smsQueue.socket')[_0xe639('0xf')](socket);function respondWithRpcPromise(_0x15256c,_0x4e58b2,_0x1683fe){return new BPromise(function(_0x25c07d,_0x1081a3){return client[_0xe639('0x10')](_0x15256c,_0x1683fe)[_0xe639('0x11')](function(_0x4dbd76){logger[_0xe639('0x12')](_0xe639('0x13'),_0x4e58b2,_0xe639('0x14'));logger['debug'](_0xe639('0x15'),_0x4e58b2,_0xe639('0x14'),JSON['stringify'](_0x4dbd76));if(_0x4dbd76[_0xe639('0x16')]){if(_0x4dbd76[_0xe639('0x16')][_0xe639('0x17')]===0x1f4){logger[_0xe639('0x16')](_0xe639('0x13'),_0x4e58b2,_0x4dbd76[_0xe639('0x16')][_0xe639('0x18')]);return _0x1081a3(_0x4dbd76[_0xe639('0x16')]['message']);}logger[_0xe639('0x16')](_0xe639('0x13'),_0x4e58b2,_0x4dbd76['error'][_0xe639('0x18')]);return _0x25c07d(_0x4dbd76[_0xe639('0x16')][_0xe639('0x18')]);}else{logger[_0xe639('0x12')](_0xe639('0x13'),_0x4e58b2,_0xe639('0x14'));_0x25c07d(_0x4dbd76[_0xe639('0x19')][_0xe639('0x18')]);}})[_0xe639('0x1a')](function(_0x449b41){logger[_0xe639('0x16')](_0xe639('0x13'),_0x4e58b2,_0x449b41);_0x1081a3(_0x449b41);});});}exports[_0xe639('0x1b')]=function(_0x58ac52){var _0x46dab3=this;return new Promise(function(_0x368200,_0x5efb13){return db[_0xe639('0x1c')]['findAll']({'raw':_0x58ac52['options']?_0x58ac52['options'][_0xe639('0x1d')]===undefined?!![]:![]:!![],'where':_0x58ac52[_0xe639('0x1e')]?_0x58ac52['options'][_0xe639('0x1f')]||null:null,'attributes':_0x58ac52[_0xe639('0x1e')]?_0x58ac52['options'][_0xe639('0x20')]||null:null,'limit':_0x58ac52[_0xe639('0x1e')]?_0x58ac52[_0xe639('0x1e')][_0xe639('0x21')]||null:null,'include':_0x58ac52[_0xe639('0x1e')]?_0x58ac52[_0xe639('0x1e')][_0xe639('0x22')]?_[_0xe639('0x23')](_0x58ac52[_0xe639('0x1e')][_0xe639('0x22')],function(_0x5b43ab){return{'model':db[_0x5b43ab[_0xe639('0x24')]],'as':_0x5b43ab['as'],'attributes':_0x5b43ab[_0xe639('0x20')],'include':_0x5b43ab['include']?_['map'](_0x5b43ab[_0xe639('0x22')],function(_0xd7f610){return{'model':db[_0xd7f610[_0xe639('0x24')]],'as':_0xd7f610['as'],'attributes':_0xd7f610['attributes'],'include':_0xd7f610[_0xe639('0x22')]?_[_0xe639('0x23')](_0xd7f610[_0xe639('0x22')],function(_0x1d33ec){return{'model':db[_0x1d33ec[_0xe639('0x24')]],'as':_0x1d33ec['as'],'attributes':_0x1d33ec[_0xe639('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe639('0x11')](function(_0x108894){logger[_0xe639('0x12')](_0xe639('0x1b'),_0x58ac52);logger[_0xe639('0x25')]('GetSmsQueue',_0x58ac52,JSON['stringify'](_0x108894));_0x368200(_0x108894);})[_0xe639('0x1a')](function(_0x3e163d){logger['error'](_0xe639('0x1b'),_0x3e163d[_0xe639('0x18')],_0x58ac52);_0x5efb13(_0x46dab3[_0xe639('0x16')](0x1f4,_0x3e163d[_0xe639('0x18')]));});});};exports[_0xe639('0x26')]=function(_0x359b6c){var _0x1d87d8=this;return new Promise(function(_0x14437b,_0x226286){return db[_0xe639('0x1c')][_0xe639('0x27')]({'raw':_0x359b6c['options']?_0x359b6c[_0xe639('0x1e')][_0xe639('0x1d')]===undefined?!![]:![]:!![],'where':_0x359b6c[_0xe639('0x1e')]?_0x359b6c[_0xe639('0x1e')]['where']||null:null,'attributes':_0x359b6c['options']?_0x359b6c[_0xe639('0x1e')][_0xe639('0x20')]||null:null,'include':_0x359b6c[_0xe639('0x1e')]?_0x359b6c[_0xe639('0x1e')]['include']?_['map'](_0x359b6c['options'][_0xe639('0x22')],function(_0x39a356){return{'model':db[_0x39a356['model']],'as':_0x39a356['as'],'attributes':_0x39a356[_0xe639('0x20')],'include':_0x39a356[_0xe639('0x22')]?_['map'](_0x39a356['include'],function(_0x3589ba){return{'model':db[_0x3589ba[_0xe639('0x24')]],'as':_0x3589ba['as'],'attributes':_0x3589ba['attributes'],'include':_0x3589ba[_0xe639('0x22')]?_['map'](_0x3589ba[_0xe639('0x22')],function(_0x36caee){return{'model':db[_0x36caee[_0xe639('0x24')]],'as':_0x36caee['as'],'attributes':_0x36caee[_0xe639('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x44466c){logger[_0xe639('0x12')](_0xe639('0x26'),_0x359b6c);logger[_0xe639('0x25')](_0xe639('0x26'),_0x359b6c,JSON[_0xe639('0x28')](_0x44466c));_0x14437b(_0x44466c);})[_0xe639('0x1a')](function(_0x25e18d){logger[_0xe639('0x16')](_0xe639('0x26'),_0x25e18d[_0xe639('0x18')],_0x359b6c);_0x226286(_0x1d87d8[_0xe639('0x16')](0x1f4,_0x25e18d[_0xe639('0x18')]));});});}; \ No newline at end of file +var _0xc8cf=['../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsQueue.socket','register','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','GetSmsQueue','SmsQueue','options','where','limit','include','map','model','attributes','stringify','ShowSmsQueue','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x14c554,_0x21fb09){var _0x28dc64=function(_0x402e8e){while(--_0x402e8e){_0x14c554['push'](_0x14c554['shift']());}};_0x28dc64(++_0x21fb09);}(_0xc8cf,0xc1));var _0xfc8c=function(_0x668413,_0x5c0b6f){_0x668413=_0x668413-0x0;var _0x5488d6=_0xc8cf[_0x668413];return _0x5488d6;};'use strict';var _=require('lodash');var util=require(_0xfc8c('0x0'));var moment=require(_0xfc8c('0x1'));var BPromise=require(_0xfc8c('0x2'));var rs=require(_0xfc8c('0x3'));var fs=require('fs');var Redis=require(_0xfc8c('0x4'));var db=require(_0xfc8c('0x5'))['db'];var utils=require(_0xfc8c('0x6'));var logger=require(_0xfc8c('0x7'))('rpc');var config=require(_0xfc8c('0x8'));var jayson=require(_0xfc8c('0x9'));var client=jayson[_0xfc8c('0xa')][_0xfc8c('0xb')]({'port':0x232a});config[_0xfc8c('0xc')]=_[_0xfc8c('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfc8c('0xe'))(new Redis(config[_0xfc8c('0xc')]));require(_0xfc8c('0xf'))[_0xfc8c('0x10')](socket);function respondWithRpcPromise(_0x3d7978,_0x2daf1e,_0x481814){return new BPromise(function(_0x5c299b,_0x50d81b){return client[_0xfc8c('0x11')](_0x3d7978,_0x481814)[_0xfc8c('0x12')](function(_0x29965a){logger['info'](_0xfc8c('0x13'),_0x2daf1e,_0xfc8c('0x14'));logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0x2daf1e,_0xfc8c('0x14'),JSON['stringify'](_0x29965a));if(_0x29965a['error']){if(_0x29965a[_0xfc8c('0x15')][_0xfc8c('0x16')]===0x1f4){logger[_0xfc8c('0x15')]('SmsQueue,\x20%s,\x20%s',_0x2daf1e,_0x29965a['error'][_0xfc8c('0x17')]);return _0x50d81b(_0x29965a[_0xfc8c('0x15')]['message']);}logger[_0xfc8c('0x15')](_0xfc8c('0x13'),_0x2daf1e,_0x29965a[_0xfc8c('0x15')]['message']);return _0x5c299b(_0x29965a[_0xfc8c('0x15')][_0xfc8c('0x17')]);}else{logger[_0xfc8c('0x18')](_0xfc8c('0x13'),_0x2daf1e,_0xfc8c('0x14'));_0x5c299b(_0x29965a[_0xfc8c('0x19')][_0xfc8c('0x17')]);}})[_0xfc8c('0x1a')](function(_0x5861aa){logger['error']('SmsQueue,\x20%s,\x20%s',_0x2daf1e,_0x5861aa);_0x50d81b(_0x5861aa);});});}exports[_0xfc8c('0x1b')]=function(_0xeed5f0){var _0x244dbd=this;return new Promise(function(_0x198367,_0x2c3945){return db[_0xfc8c('0x1c')]['findAll']({'raw':_0xeed5f0[_0xfc8c('0x1d')]?_0xeed5f0[_0xfc8c('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0xeed5f0[_0xfc8c('0x1d')]?_0xeed5f0[_0xfc8c('0x1d')][_0xfc8c('0x1e')]||null:null,'attributes':_0xeed5f0['options']?_0xeed5f0[_0xfc8c('0x1d')]['attributes']||null:null,'limit':_0xeed5f0['options']?_0xeed5f0[_0xfc8c('0x1d')][_0xfc8c('0x1f')]||null:null,'include':_0xeed5f0['options']?_0xeed5f0[_0xfc8c('0x1d')][_0xfc8c('0x20')]?_[_0xfc8c('0x21')](_0xeed5f0['options'][_0xfc8c('0x20')],function(_0x1106be){return{'model':db[_0x1106be[_0xfc8c('0x22')]],'as':_0x1106be['as'],'attributes':_0x1106be[_0xfc8c('0x23')],'include':_0x1106be[_0xfc8c('0x20')]?_[_0xfc8c('0x21')](_0x1106be[_0xfc8c('0x20')],function(_0x39220a){return{'model':db[_0x39220a['model']],'as':_0x39220a['as'],'attributes':_0x39220a['attributes'],'include':_0x39220a['include']?_[_0xfc8c('0x21')](_0x39220a[_0xfc8c('0x20')],function(_0x199689){return{'model':db[_0x199689[_0xfc8c('0x22')]],'as':_0x199689['as'],'attributes':_0x199689[_0xfc8c('0x23')]};}):[]};}):[]};}):[]:[]})[_0xfc8c('0x12')](function(_0x28ef3d){logger[_0xfc8c('0x18')]('GetSmsQueue',_0xeed5f0);logger['debug'](_0xfc8c('0x1b'),_0xeed5f0,JSON[_0xfc8c('0x24')](_0x28ef3d));_0x198367(_0x28ef3d);})['catch'](function(_0x316eb4){logger[_0xfc8c('0x15')](_0xfc8c('0x1b'),_0x316eb4[_0xfc8c('0x17')],_0xeed5f0);_0x2c3945(_0x244dbd[_0xfc8c('0x15')](0x1f4,_0x316eb4[_0xfc8c('0x17')]));});});};exports[_0xfc8c('0x25')]=function(_0x200568){var _0x422607=this;return new Promise(function(_0x27dbf4,_0x250f79){return db[_0xfc8c('0x1c')][_0xfc8c('0x26')]({'raw':_0x200568[_0xfc8c('0x1d')]?_0x200568[_0xfc8c('0x1d')][_0xfc8c('0x27')]===undefined?!![]:![]:!![],'where':_0x200568[_0xfc8c('0x1d')]?_0x200568[_0xfc8c('0x1d')][_0xfc8c('0x1e')]||null:null,'attributes':_0x200568[_0xfc8c('0x1d')]?_0x200568['options']['attributes']||null:null,'include':_0x200568[_0xfc8c('0x1d')]?_0x200568['options']['include']?_[_0xfc8c('0x21')](_0x200568['options'][_0xfc8c('0x20')],function(_0x35db77){return{'model':db[_0x35db77[_0xfc8c('0x22')]],'as':_0x35db77['as'],'attributes':_0x35db77['attributes'],'include':_0x35db77[_0xfc8c('0x20')]?_[_0xfc8c('0x21')](_0x35db77[_0xfc8c('0x20')],function(_0x1cfe44){return{'model':db[_0x1cfe44['model']],'as':_0x1cfe44['as'],'attributes':_0x1cfe44['attributes'],'include':_0x1cfe44['include']?_[_0xfc8c('0x21')](_0x1cfe44['include'],function(_0x2d48e3){return{'model':db[_0x2d48e3[_0xfc8c('0x22')]],'as':_0x2d48e3['as'],'attributes':_0x2d48e3[_0xfc8c('0x23')]};}):[]};}):[]};}):[]:[]})[_0xfc8c('0x12')](function(_0x581992){logger[_0xfc8c('0x18')]('ShowSmsQueue',_0x200568);logger['debug']('ShowSmsQueue',_0x200568,JSON[_0xfc8c('0x24')](_0x581992));_0x27dbf4(_0x581992);})['catch'](function(_0x1cfc7d){logger[_0xfc8c('0x15')](_0xfc8c('0x25'),_0x1cfc7d[_0xfc8c('0x17')],_0x200568);_0x250f79(_0x422607[_0xfc8c('0x15')](0x1f4,_0x1cfc7d[_0xfc8c('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 9684bd4..d07870d 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 _0x9fa6=['length','./smsQueue.events','remove','update','removeListener'];(function(_0x58f069,_0x597e89){var _0x4174a3=function(_0x23b440){while(--_0x23b440){_0x58f069['push'](_0x58f069['shift']());}};_0x4174a3(++_0x597e89);}(_0x9fa6,0x92));var _0x69fa=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x9fa6[_0x4e9d3c];return _0x2d0825;};'use strict';var SmsQueueEvents=require(_0x69fa('0x0'));var events=['save',_0x69fa('0x1'),_0x69fa('0x2')];function createListener(_0x16e868,_0x34faab){return function(_0x52a6fe){_0x34faab['emit'](_0x16e868,_0x52a6fe);};}function removeListener(_0x2c5b71,_0x5c19cc){return function(){SmsQueueEvents[_0x69fa('0x3')](_0x2c5b71,_0x5c19cc);};}exports['register']=function(_0x2f6cce){for(var _0x5966bf=0x0,_0x132021=events[_0x69fa('0x4')];_0x5966bf<_0x132021;_0x5966bf++){var _0x420b4e=events[_0x5966bf];var _0xf34cb1=createListener('smsQueue:'+_0x420b4e,_0x2f6cce);SmsQueueEvents['on'](_0x420b4e,_0xf34cb1);}}; \ No newline at end of file +var _0x29fc=['remove','emit','register','length','./smsQueue.events','save'];(function(_0x42585d,_0x207085){var _0xa9d328=function(_0x2095b0){while(--_0x2095b0){_0x42585d['push'](_0x42585d['shift']());}};_0xa9d328(++_0x207085);}(_0x29fc,0x1f0));var _0xc29f=function(_0x11d40f,_0x4c2393){_0x11d40f=_0x11d40f-0x0;var _0x18f078=_0x29fc[_0x11d40f];return _0x18f078;};'use strict';var SmsQueueEvents=require(_0xc29f('0x0'));var events=[_0xc29f('0x1'),_0xc29f('0x2'),'update'];function createListener(_0x1ba1c2,_0x1800fd){return function(_0x318d9c){_0x1800fd[_0xc29f('0x3')](_0x1ba1c2,_0x318d9c);};}function removeListener(_0x1c6d17,_0xd30466){return function(){SmsQueueEvents['removeListener'](_0x1c6d17,_0xd30466);};}exports[_0xc29f('0x4')]=function(_0x2ec269){for(var _0x4e02a6=0x0,_0x24b7a1=events[_0xc29f('0x5')];_0x4e02a6<_0x24b7a1;_0x4e02a6++){var _0x7a0214=events[_0x4e02a6];var _0x223b77=createListener('smsQueue:'+_0x7a0214,_0x2ec269);SmsQueueEvents['on'](_0x7a0214,_0x223b77);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 4759547..dbdf99e 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 _0x5f41=['get','isAuthenticated','index','/describe','/:id','show','post','create','update','delete','multer','path','express','./smsQueueReport.controller'];(function(_0x5874b5,_0x38d7ff){var _0x6de931=function(_0x5b3669){while(--_0x5b3669){_0x5874b5['push'](_0x5874b5['shift']());}};_0x6de931(++_0x38d7ff);}(_0x5f41,0x14c));var _0x15f4=function(_0x5c5c7d,_0x24bca1){_0x5c5c7d=_0x5c5c7d-0x0;var _0x3b6c42=_0x5f41[_0x5c5c7d];return _0x3b6c42;};'use strict';var multer=require(_0x15f4('0x0'));var util=require('util');var path=require(_0x15f4('0x1'));var timeout=require('connect-timeout');var express=require(_0x15f4('0x2'));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(_0x15f4('0x3'));router[_0x15f4('0x4')]('/',auth[_0x15f4('0x5')](),controller[_0x15f4('0x6')]);router['get'](_0x15f4('0x7'),auth[_0x15f4('0x5')](),controller['describe']);router['get'](_0x15f4('0x8'),auth[_0x15f4('0x5')](),controller[_0x15f4('0x9')]);router[_0x15f4('0xa')]('/',auth['isAuthenticated'](),controller[_0x15f4('0xb')]);router['put'](_0x15f4('0x8'),auth[_0x15f4('0x5')](),controller[_0x15f4('0xc')]);router[_0x15f4('0xd')](_0x15f4('0x8'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5cd7=['get','isAuthenticated','index','describe','/:id','show','post','create','put','delete','destroy','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller'];(function(_0x4e40a7,_0x5399a0){var _0x24a63a=function(_0x4e6e04){while(--_0x4e6e04){_0x4e40a7['push'](_0x4e40a7['shift']());}};_0x24a63a(++_0x5399a0);}(_0x5cd7,0x102));var _0x75cd=function(_0x29e0eb,_0x9acb52){_0x29e0eb=_0x29e0eb-0x0;var _0x597d2d=_0x5cd7[_0x29e0eb];return _0x597d2d;};'use strict';var multer=require(_0x75cd('0x0'));var util=require('util');var path=require(_0x75cd('0x1'));var timeout=require(_0x75cd('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x75cd('0x3'));var auth=require(_0x75cd('0x4'));var interaction=require(_0x75cd('0x5'));var config=require(_0x75cd('0x6'));var controller=require(_0x75cd('0x7'));router[_0x75cd('0x8')]('/',auth[_0x75cd('0x9')](),controller[_0x75cd('0xa')]);router[_0x75cd('0x8')]('/describe',auth[_0x75cd('0x9')](),controller[_0x75cd('0xb')]);router[_0x75cd('0x8')](_0x75cd('0xc'),auth[_0x75cd('0x9')](),controller[_0x75cd('0xd')]);router[_0x75cd('0xe')]('/',auth[_0x75cd('0x9')](),controller[_0x75cd('0xf')]);router[_0x75cd('0x10')]('/:id',auth[_0x75cd('0x9')](),controller['update']);router[_0x75cd('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x75cd('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index c994ab4..37edca9 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 _0x7789=['STRING','DATE','moment','sequelize','exports'];(function(_0x5c67af,_0x2da921){var _0x2811ad=function(_0x26182){while(--_0x26182){_0x5c67af['push'](_0x5c67af['shift']());}};_0x2811ad(++_0x2da921);}(_0x7789,0x11a));var _0x9778=function(_0x39e13d,_0x1f5052){_0x39e13d=_0x39e13d-0x0;var _0x33bd89=_0x7789[_0x39e13d];return _0x33bd89;};'use strict';var moment=require(_0x9778('0x0'));var Sequelize=require(_0x9778('0x1'));module[_0x9778('0x2')]={'uniqueid':{'type':Sequelize[_0x9778('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x9778('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x9778('0x4')]},'acceptAt':{'type':Sequelize[_0x9778('0x4')]},'exitAt':{'type':Sequelize[_0x9778('0x4')]},'reason':{'type':Sequelize[_0x9778('0x3')]}}; \ No newline at end of file +var _0xfd27=['DATE','moment','exports'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xfd27,0x1cf));var _0x7fd2=function(_0x6d0f2f,_0x20686a){_0x6d0f2f=_0x6d0f2f-0x0;var _0x5c22f3=_0xfd27[_0x6d0f2f];return _0x5c22f3;};'use strict';var moment=require(_0x7fd2('0x0'));var Sequelize=require('sequelize');module[_0x7fd2('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x7fd2('0x2')]},'leaveAt':{'type':Sequelize[_0x7fd2('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x7fd2('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 765d2ca..c690686 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 _0xaea8=['../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','SmsQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','rows','catch','show','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0xf83170,_0x189751){var _0xa6c834=function(_0x28b9ef){while(--_0x28b9ef){_0xf83170['push'](_0xf83170['shift']());}};_0xa6c834(++_0x189751);}(_0xaea8,0x1ea));var _0x8aea=function(_0x1a4ee5,_0x615495){_0x1a4ee5=_0x1a4ee5-0x0;var _0x4e9f44=_0xaea8[_0x1a4ee5];return _0x4e9f44;};'use strict';var emlformat=require(_0x8aea('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8aea('0x1'));var jsonpatch=require(_0x8aea('0x2'));var rp=require('request-promise');var moment=require(_0x8aea('0x3'));var BPromise=require(_0x8aea('0x4'));var Mustache=require(_0x8aea('0x5'));var util=require('util');var path=require(_0x8aea('0x6'));var sox=require(_0x8aea('0x7'));var csv=require(_0x8aea('0x8'));var ejs=require(_0x8aea('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8aea('0xa'));var squel=require(_0x8aea('0xb'));var crypto=require(_0x8aea('0xc'));var jsforce=require(_0x8aea('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8aea('0x8'));var querystring=require('querystring');var Papa=require(_0x8aea('0xe'));var Redis=require(_0x8aea('0xf'));var authService=require(_0x8aea('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8aea('0x11'));var hardwareService=require(_0x8aea('0x12'));var logger=require(_0x8aea('0x13'))(_0x8aea('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8aea('0x15'));var db=require(_0x8aea('0x16'))['db'];function respondWithStatusCode(_0x28c8b4,_0x396e21){_0x396e21=_0x396e21||0xcc;return function(_0x488b54){if(_0x488b54){return _0x28c8b4[_0x8aea('0x17')](_0x396e21);}return _0x28c8b4[_0x8aea('0x18')](_0x396e21)['end']();};}function respondWithResult(_0x35541f,_0x5212a3){_0x5212a3=_0x5212a3||0xc8;return function(_0x525795){if(_0x525795){return _0x35541f[_0x8aea('0x18')](_0x5212a3)[_0x8aea('0x19')](_0x525795);}};}function respondWithFilteredResult(_0x471137,_0xfc3c41){return function(_0x5730ac){if(_0x5730ac){var _0x19bdae=typeof _0xfc3c41[_0x8aea('0x1a')]==='undefined'&&typeof _0xfc3c41['limit']===_0x8aea('0x1b');var _0x2fe109=_0x5730ac[_0x8aea('0x1c')];var _0x2aeb3f=_0x19bdae?0x0:_0xfc3c41[_0x8aea('0x1a')];var _0x308acb=_0x19bdae?_0x5730ac[_0x8aea('0x1c')]:_0xfc3c41[_0x8aea('0x1a')]+_0xfc3c41[_0x8aea('0x1d')];var _0x3a2959;if(_0x308acb>=_0x2fe109){_0x308acb=_0x2fe109;_0x3a2959=0xc8;}else{_0x3a2959=0xce;}_0x471137[_0x8aea('0x18')](_0x3a2959);return _0x471137['set'](_0x8aea('0x1e'),_0x2aeb3f+'-'+_0x308acb+'/'+_0x2fe109)[_0x8aea('0x19')](_0x5730ac);}return null;};}function patchUpdates(_0x30b382){return function(_0x13d6d3){try{jsonpatch[_0x8aea('0x1f')](_0x13d6d3,_0x30b382,!![]);}catch(_0x5f48d8){return BPromise[_0x8aea('0x20')](_0x5f48d8);}return _0x13d6d3[_0x8aea('0x21')]();};}function saveUpdates(_0x5ddcb6,_0x5d918d){return function(_0x2d30a4){if(_0x2d30a4){return _0x2d30a4[_0x8aea('0x22')](_0x5ddcb6)[_0x8aea('0x23')](function(_0x1efb78){return _0x1efb78;});}return null;};}function removeEntity(_0x256553,_0x1b5166){return function(_0x107e4f){if(_0x107e4f){return _0x107e4f[_0x8aea('0x24')]()[_0x8aea('0x23')](function(){_0x256553[_0x8aea('0x18')](0xcc)[_0x8aea('0x25')]();});}};}function handleEntityNotFound(_0x36c3ca,_0x557abf){return function(_0x5aba8c){if(!_0x5aba8c){_0x36c3ca['sendStatus'](0x194);}return _0x5aba8c;};}function handleError(_0x13180f,_0x47548e){_0x47548e=_0x47548e||0x1f4;return function(_0x3ff4d4){logger[_0x8aea('0x26')](_0x3ff4d4[_0x8aea('0x27')]);if(_0x3ff4d4[_0x8aea('0x28')]){delete _0x3ff4d4[_0x8aea('0x28')];}_0x13180f[_0x8aea('0x18')](_0x47548e)[_0x8aea('0x29')](_0x3ff4d4);};}exports['index']=function(_0x258793,_0x2f8724){var _0x5bb284={},_0x2a9083={},_0x2fe3ec={'count':0x0,'rows':[]};var _0x4f94fa=_[_0x8aea('0x2a')](db[_0x8aea('0x2b')][_0x8aea('0x2c')],function(_0x45800a){return{'name':_0x45800a['fieldName'],'type':_0x45800a[_0x8aea('0x2d')][_0x8aea('0x2e')]};});_0x2a9083[_0x8aea('0x2f')]=_['map'](_0x4f94fa,'name');_0x2a9083[_0x8aea('0x30')]=_[_0x8aea('0x31')](_0x258793[_0x8aea('0x30')]);_0x2a9083[_0x8aea('0x32')]=_[_0x8aea('0x33')](_0x2a9083['model'],_0x2a9083[_0x8aea('0x30')]);_0x5bb284[_0x8aea('0x34')]=_['intersection'](_0x2a9083[_0x8aea('0x2f')],qs['fields'](_0x258793[_0x8aea('0x30')][_0x8aea('0x35')]));_0x5bb284[_0x8aea('0x34')]=_0x5bb284[_0x8aea('0x34')][_0x8aea('0x36')]?_0x5bb284[_0x8aea('0x34')]:_0x2a9083[_0x8aea('0x2f')];if(!_0x258793[_0x8aea('0x30')]['hasOwnProperty'](_0x8aea('0x37'))){_0x5bb284[_0x8aea('0x1d')]=qs[_0x8aea('0x1d')](_0x258793['query'][_0x8aea('0x1d')]);_0x5bb284['offset']=qs[_0x8aea('0x1a')](_0x258793[_0x8aea('0x30')][_0x8aea('0x1a')]);}_0x5bb284[_0x8aea('0x38')]=qs[_0x8aea('0x39')](_0x258793[_0x8aea('0x30')][_0x8aea('0x39')]);_0x5bb284['where']=qs['filters'](_[_0x8aea('0x3a')](_0x258793[_0x8aea('0x30')],_0x2a9083[_0x8aea('0x32')]),_0x4f94fa);if(_0x258793[_0x8aea('0x30')][_0x8aea('0x3b')]){_0x5bb284[_0x8aea('0x3c')]=_['merge'](_0x5bb284[_0x8aea('0x3c')],{'$or':_['map'](_0x4f94fa,function(_0x46ea6c){if(_0x46ea6c[_0x8aea('0x2d')]!=='VIRTUAL'){var _0x3228dc={};_0x3228dc[_0x46ea6c[_0x8aea('0x28')]]={'$like':'%'+_0x258793['query'][_0x8aea('0x3b')]+'%'};return _0x3228dc;}})});}_0x5bb284=_[_0x8aea('0x3d')]({},_0x5bb284,_0x258793[_0x8aea('0x3e')]);var _0x3bb0f0={'where':_0x5bb284[_0x8aea('0x3c')]};return db[_0x8aea('0x2b')][_0x8aea('0x1c')](_0x3bb0f0)['then'](function(_0x10b499){_0x2fe3ec[_0x8aea('0x1c')]=_0x10b499;if(_0x258793[_0x8aea('0x30')][_0x8aea('0x3f')]){_0x5bb284[_0x8aea('0x40')]=[{'all':!![]}];}return db[_0x8aea('0x2b')]['findAll'](_0x5bb284);})[_0x8aea('0x23')](function(_0x45dc50){_0x2fe3ec[_0x8aea('0x41')]=_0x45dc50;return _0x2fe3ec;})[_0x8aea('0x23')](respondWithFilteredResult(_0x2f8724,_0x5bb284))[_0x8aea('0x42')](handleError(_0x2f8724,null));};exports[_0x8aea('0x43')]=function(_0x4bffec,_0x5d7f88){var _0x3b5bfb={'raw':!![],'where':{'id':_0x4bffec[_0x8aea('0x44')]['id']}},_0x4ee157={};_0x4ee157['model']=_[_0x8aea('0x31')](db['SmsQueueReport'][_0x8aea('0x2c')]);_0x4ee157[_0x8aea('0x30')]=_[_0x8aea('0x31')](_0x4bffec[_0x8aea('0x30')]);_0x4ee157[_0x8aea('0x32')]=_[_0x8aea('0x33')](_0x4ee157[_0x8aea('0x2f')],_0x4ee157[_0x8aea('0x30')]);_0x3b5bfb[_0x8aea('0x34')]=_[_0x8aea('0x33')](_0x4ee157[_0x8aea('0x2f')],qs[_0x8aea('0x35')](_0x4bffec[_0x8aea('0x30')][_0x8aea('0x35')]));_0x3b5bfb[_0x8aea('0x34')]=_0x3b5bfb['attributes'][_0x8aea('0x36')]?_0x3b5bfb[_0x8aea('0x34')]:_0x4ee157[_0x8aea('0x2f')];if(_0x4bffec[_0x8aea('0x30')][_0x8aea('0x3f')]){_0x3b5bfb['include']=[{'all':!![]}];}_0x3b5bfb=_['merge']({},_0x3b5bfb,_0x4bffec[_0x8aea('0x3e')]);return db['SmsQueueReport'][_0x8aea('0x45')](_0x3b5bfb)[_0x8aea('0x23')](handleEntityNotFound(_0x5d7f88,null))[_0x8aea('0x23')](respondWithResult(_0x5d7f88,null))['catch'](handleError(_0x5d7f88,null));};exports[_0x8aea('0x46')]=function(_0x371957,_0x3872a8){return db[_0x8aea('0x2b')][_0x8aea('0x46')](_0x371957[_0x8aea('0x47')],{})[_0x8aea('0x23')](respondWithResult(_0x3872a8,0xc9))[_0x8aea('0x42')](handleError(_0x3872a8,null));};exports[_0x8aea('0x22')]=function(_0x323c77,_0x48570e){if(_0x323c77[_0x8aea('0x47')]['id']){delete _0x323c77[_0x8aea('0x47')]['id'];}return db[_0x8aea('0x2b')][_0x8aea('0x45')]({'where':{'id':_0x323c77[_0x8aea('0x44')]['id']}})[_0x8aea('0x23')](handleEntityNotFound(_0x48570e,null))[_0x8aea('0x23')](saveUpdates(_0x323c77['body'],null))['then'](respondWithResult(_0x48570e,null))[_0x8aea('0x42')](handleError(_0x48570e,null));};exports['destroy']=function(_0x1590ad,_0x150082){return db['SmsQueueReport'][_0x8aea('0x45')]({'where':{'id':_0x1590ad[_0x8aea('0x44')]['id']}})[_0x8aea('0x23')](handleEntityNotFound(_0x150082,null))[_0x8aea('0x23')](removeEntity(_0x150082,null))[_0x8aea('0x42')](handleError(_0x150082,null));};exports[_0x8aea('0x48')]=function(_0x271dd0,_0x4721bf){return db[_0x8aea('0x2b')][_0x8aea('0x48')]()[_0x8aea('0x23')](respondWithResult(_0x4721bf,null))[_0x8aea('0x42')](handleError(_0x4721bf,null));}; \ No newline at end of file +var _0x6769=['SmsQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x6769,0x101));var _0x9676=function(_0x29c189,_0x94013){_0x29c189=_0x29c189-0x0;var _0xd757a6=_0x6769[_0x29c189];return _0xd757a6;};'use strict';var emlformat=require(_0x9676('0x0'));var rimraf=require(_0x9676('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9676('0x2'));var rp=require(_0x9676('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9676('0x4'));var util=require(_0x9676('0x5'));var path=require(_0x9676('0x6'));var sox=require(_0x9676('0x7'));var csv=require('to-csv');var ejs=require(_0x9676('0x8'));var fs=require('fs');var fs_extra=require(_0x9676('0x9'));var _=require('lodash');var squel=require(_0x9676('0xa'));var crypto=require(_0x9676('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9676('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9676('0xd'));var Papa=require(_0x9676('0xe'));var Redis=require('ioredis');var authService=require(_0x9676('0xf'));var qs=require(_0x9676('0x10'));var as=require(_0x9676('0x11'));var hardwareService=require(_0x9676('0x12'));var logger=require('../../config/logger')(_0x9676('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9676('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10305c,_0x32bd17){_0x32bd17=_0x32bd17||0xcc;return function(_0x3c7391){if(_0x3c7391){return _0x10305c[_0x9676('0x15')](_0x32bd17);}return _0x10305c[_0x9676('0x16')](_0x32bd17)[_0x9676('0x17')]();};}function respondWithResult(_0x25b663,_0x214379){_0x214379=_0x214379||0xc8;return function(_0x1bec6a){if(_0x1bec6a){return _0x25b663[_0x9676('0x16')](_0x214379)['json'](_0x1bec6a);}};}function respondWithFilteredResult(_0x38e043,_0x139147){return function(_0x481093){if(_0x481093){var _0x3b373c=typeof _0x139147[_0x9676('0x18')]===_0x9676('0x19')&&typeof _0x139147[_0x9676('0x1a')]===_0x9676('0x19');var _0x599950=_0x481093[_0x9676('0x1b')];var _0x31d70a=_0x3b373c?0x0:_0x139147[_0x9676('0x18')];var _0x41bdff=_0x3b373c?_0x481093[_0x9676('0x1b')]:_0x139147[_0x9676('0x18')]+_0x139147[_0x9676('0x1a')];var _0x222980;if(_0x41bdff>=_0x599950){_0x41bdff=_0x599950;_0x222980=0xc8;}else{_0x222980=0xce;}_0x38e043[_0x9676('0x16')](_0x222980);return _0x38e043[_0x9676('0x1c')](_0x9676('0x1d'),_0x31d70a+'-'+_0x41bdff+'/'+_0x599950)[_0x9676('0x1e')](_0x481093);}return null;};}function patchUpdates(_0xf65044){return function(_0x101c11){try{jsonpatch[_0x9676('0x1f')](_0x101c11,_0xf65044,!![]);}catch(_0xe5f000){return BPromise[_0x9676('0x20')](_0xe5f000);}return _0x101c11[_0x9676('0x21')]();};}function saveUpdates(_0x109a5e,_0x353a5e){return function(_0x539214){if(_0x539214){return _0x539214[_0x9676('0x22')](_0x109a5e)[_0x9676('0x23')](function(_0x39edd3){return _0x39edd3;});}return null;};}function removeEntity(_0x1d3bc4,_0x333f92){return function(_0x3ae399){if(_0x3ae399){return _0x3ae399[_0x9676('0x24')]()[_0x9676('0x23')](function(){_0x1d3bc4[_0x9676('0x16')](0xcc)[_0x9676('0x17')]();});}};}function handleEntityNotFound(_0x4843ac,_0x48cbb8){return function(_0x255ce2){if(!_0x255ce2){_0x4843ac['sendStatus'](0x194);}return _0x255ce2;};}function handleError(_0x2fd4b4,_0x2c1210){_0x2c1210=_0x2c1210||0x1f4;return function(_0x20ec3e){logger[_0x9676('0x25')](_0x20ec3e[_0x9676('0x26')]);if(_0x20ec3e[_0x9676('0x27')]){delete _0x20ec3e[_0x9676('0x27')];}_0x2fd4b4[_0x9676('0x16')](_0x2c1210)[_0x9676('0x28')](_0x20ec3e);};}exports[_0x9676('0x29')]=function(_0x158a8f,_0x367b8b){var _0xf59e8a={},_0x531bc3={},_0x4f7b31={'count':0x0,'rows':[]};var _0x4d3fed=_[_0x9676('0x2a')](db[_0x9676('0x2b')][_0x9676('0x2c')],function(_0x51e2df){return{'name':_0x51e2df['fieldName'],'type':_0x51e2df[_0x9676('0x2d')][_0x9676('0x2e')]};});_0x531bc3[_0x9676('0x2f')]=_[_0x9676('0x2a')](_0x4d3fed,_0x9676('0x27'));_0x531bc3[_0x9676('0x30')]=_[_0x9676('0x31')](_0x158a8f[_0x9676('0x30')]);_0x531bc3[_0x9676('0x32')]=_[_0x9676('0x33')](_0x531bc3[_0x9676('0x2f')],_0x531bc3[_0x9676('0x30')]);_0xf59e8a['attributes']=_[_0x9676('0x33')](_0x531bc3['model'],qs['fields'](_0x158a8f[_0x9676('0x30')][_0x9676('0x34')]));_0xf59e8a[_0x9676('0x35')]=_0xf59e8a[_0x9676('0x35')][_0x9676('0x36')]?_0xf59e8a[_0x9676('0x35')]:_0x531bc3[_0x9676('0x2f')];if(!_0x158a8f[_0x9676('0x30')][_0x9676('0x37')](_0x9676('0x38'))){_0xf59e8a[_0x9676('0x1a')]=qs[_0x9676('0x1a')](_0x158a8f[_0x9676('0x30')][_0x9676('0x1a')]);_0xf59e8a['offset']=qs['offset'](_0x158a8f[_0x9676('0x30')][_0x9676('0x18')]);}_0xf59e8a[_0x9676('0x39')]=qs[_0x9676('0x3a')](_0x158a8f['query'][_0x9676('0x3a')]);_0xf59e8a[_0x9676('0x3b')]=qs[_0x9676('0x32')](_['pick'](_0x158a8f['query'],_0x531bc3['filters']),_0x4d3fed);if(_0x158a8f[_0x9676('0x30')][_0x9676('0x3c')]){_0xf59e8a[_0x9676('0x3b')]=_['merge'](_0xf59e8a[_0x9676('0x3b')],{'$or':_[_0x9676('0x2a')](_0x4d3fed,function(_0x360797){if(_0x360797[_0x9676('0x2d')]!==_0x9676('0x3d')){var _0x4c1e8b={};_0x4c1e8b[_0x360797['name']]={'$like':'%'+_0x158a8f[_0x9676('0x30')][_0x9676('0x3c')]+'%'};return _0x4c1e8b;}})});}_0xf59e8a=_[_0x9676('0x3e')]({},_0xf59e8a,_0x158a8f[_0x9676('0x3f')]);var _0x3eb0b3={'where':_0xf59e8a[_0x9676('0x3b')]};return db[_0x9676('0x2b')][_0x9676('0x1b')](_0x3eb0b3)['then'](function(_0x2f472a){_0x4f7b31[_0x9676('0x1b')]=_0x2f472a;if(_0x158a8f[_0x9676('0x30')][_0x9676('0x40')]){_0xf59e8a[_0x9676('0x41')]=[{'all':!![]}];}return db[_0x9676('0x2b')][_0x9676('0x42')](_0xf59e8a);})[_0x9676('0x23')](function(_0x482dfb){_0x4f7b31[_0x9676('0x43')]=_0x482dfb;return _0x4f7b31;})[_0x9676('0x23')](respondWithFilteredResult(_0x367b8b,_0xf59e8a))[_0x9676('0x44')](handleError(_0x367b8b,null));};exports[_0x9676('0x45')]=function(_0x3ac5dc,_0x24c0c9){var _0x409b30={'raw':!![],'where':{'id':_0x3ac5dc[_0x9676('0x46')]['id']}},_0x2031e7={};_0x2031e7[_0x9676('0x2f')]=_['keys'](db['SmsQueueReport'][_0x9676('0x2c')]);_0x2031e7[_0x9676('0x30')]=_[_0x9676('0x31')](_0x3ac5dc[_0x9676('0x30')]);_0x2031e7[_0x9676('0x32')]=_[_0x9676('0x33')](_0x2031e7[_0x9676('0x2f')],_0x2031e7[_0x9676('0x30')]);_0x409b30['attributes']=_[_0x9676('0x33')](_0x2031e7['model'],qs['fields'](_0x3ac5dc[_0x9676('0x30')][_0x9676('0x34')]));_0x409b30[_0x9676('0x35')]=_0x409b30[_0x9676('0x35')][_0x9676('0x36')]?_0x409b30['attributes']:_0x2031e7[_0x9676('0x2f')];if(_0x3ac5dc['query'][_0x9676('0x40')]){_0x409b30[_0x9676('0x41')]=[{'all':!![]}];}_0x409b30=_[_0x9676('0x3e')]({},_0x409b30,_0x3ac5dc[_0x9676('0x3f')]);return db['SmsQueueReport'][_0x9676('0x47')](_0x409b30)[_0x9676('0x23')](handleEntityNotFound(_0x24c0c9,null))[_0x9676('0x23')](respondWithResult(_0x24c0c9,null))[_0x9676('0x44')](handleError(_0x24c0c9,null));};exports[_0x9676('0x48')]=function(_0x20aa65,_0x3adaae){return db[_0x9676('0x2b')]['create'](_0x20aa65[_0x9676('0x49')],{})[_0x9676('0x23')](respondWithResult(_0x3adaae,0xc9))[_0x9676('0x44')](handleError(_0x3adaae,null));};exports[_0x9676('0x22')]=function(_0x1a1700,_0x5e8440){if(_0x1a1700['body']['id']){delete _0x1a1700['body']['id'];}return db[_0x9676('0x2b')][_0x9676('0x47')]({'where':{'id':_0x1a1700[_0x9676('0x46')]['id']}})[_0x9676('0x23')](handleEntityNotFound(_0x5e8440,null))['then'](saveUpdates(_0x1a1700[_0x9676('0x49')],null))['then'](respondWithResult(_0x5e8440,null))[_0x9676('0x44')](handleError(_0x5e8440,null));};exports['destroy']=function(_0x10d103,_0x13fbf7){return db['SmsQueueReport']['find']({'where':{'id':_0x10d103['params']['id']}})['then'](handleEntityNotFound(_0x13fbf7,null))[_0x9676('0x23')](removeEntity(_0x13fbf7,null))[_0x9676('0x44')](handleError(_0x13fbf7,null));};exports[_0x9676('0x4a')]=function(_0x39a729,_0x5dee60){return db[_0x9676('0x2b')][_0x9676('0x4a')]()['then'](respondWithResult(_0x5dee60,null))['catch'](handleError(_0x5dee60,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index c684397..ecd720f 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 _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x17d6de,_0xc70935){var _0x295f54=function(_0x31e8b6){while(--_0x31e8b6){_0x17d6de['push'](_0x17d6de['shift']());}};_0x295f54(++_0xc70935);}(_0xb7e7,0x121));var _0x7b7e=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0xb7e7[_0x432fca];return _0x3adba4;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1936f4,_0x3a987b){var _0x56ff82=function(_0x3af798){while(--_0x3af798){_0x1936f4['push'](_0x1936f4['shift']());}};_0x56ff82(++_0x3a987b);}(_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('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index ce90d51..aec5bbf 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 _0x395d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','result','catch','SmsQueueReport','create','body','options','then','info','CreateSmsQueueReport','UpdateSmsQueueReport','raw','attributes','limit','util'];(function(_0x32f3d0,_0x18caa6){var _0x3cfb65=function(_0x1b97ba){while(--_0x1b97ba){_0x32f3d0['push'](_0x32f3d0['shift']());}};_0x3cfb65(++_0x18caa6);}(_0x395d,0x7f));var _0xd395=function(_0x46f6fd,_0x39af3c){_0x46f6fd=_0x46f6fd-0x0;var _0x3d30bf=_0x395d[_0x46f6fd];return _0x3d30bf;};'use strict';var _=require('lodash');var util=require(_0xd395('0x0'));var moment=require('moment');var BPromise=require(_0xd395('0x1'));var rs=require(_0xd395('0x2'));var fs=require('fs');var Redis=require(_0xd395('0x3'));var db=require(_0xd395('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd395('0x5'))(_0xd395('0x6'));var config=require(_0xd395('0x7'));var jayson=require(_0xd395('0x8'));var client=jayson[_0xd395('0x9')][_0xd395('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55e34a,_0x54b9ca,_0x2ac2e3){return new BPromise(function(_0x678728,_0x31ada4){return client[_0xd395('0xb')](_0x55e34a,_0x2ac2e3)['then'](function(_0x573500){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x54b9ca,_0xd395('0xc'));logger[_0xd395('0xd')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x54b9ca,_0xd395('0xc'),JSON[_0xd395('0xe')](_0x573500));if(_0x573500['error']){if(_0x573500[_0xd395('0xf')][_0xd395('0x10')]===0x1f4){logger['error'](_0xd395('0x11'),_0x54b9ca,_0x573500[_0xd395('0xf')]['message']);return _0x31ada4(_0x573500[_0xd395('0xf')][_0xd395('0x12')]);}logger[_0xd395('0xf')](_0xd395('0x11'),_0x54b9ca,_0x573500[_0xd395('0xf')]['message']);return _0x678728(_0x573500['error'][_0xd395('0x12')]);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x54b9ca,_0xd395('0xc'));_0x678728(_0x573500[_0xd395('0x13')]['message']);}})[_0xd395('0x14')](function(_0x69b0ac){logger[_0xd395('0xf')](_0xd395('0x11'),_0x54b9ca,_0x69b0ac);_0x31ada4(_0x69b0ac);});});}exports['CreateSmsQueueReport']=function(_0x183ef1){var _0x2436f8=this;return new Promise(function(_0xf3ae96,_0x242385){return db[_0xd395('0x15')][_0xd395('0x16')](_0x183ef1[_0xd395('0x17')],{'raw':_0x183ef1[_0xd395('0x18')]?_0x183ef1['options']['raw']===undefined?!![]:![]:!![]})[_0xd395('0x19')](function(_0x2c6793){logger[_0xd395('0x1a')](_0xd395('0x1b'),_0x183ef1);logger[_0xd395('0xd')](_0xd395('0x1b'),_0x183ef1,JSON[_0xd395('0xe')](_0x2c6793));_0xf3ae96(_0x2c6793);})[_0xd395('0x14')](function(_0xe2fd47){logger[_0xd395('0xf')](_0xd395('0x1b'),_0xe2fd47[_0xd395('0x12')],_0x183ef1);_0x242385(_0x2436f8[_0xd395('0xf')](0x1f4,_0xe2fd47['message']));});});};exports[_0xd395('0x1c')]=function(_0x594b0d){var _0x16e34d=this;return new Promise(function(_0x4205dd,_0x2636a9){return db[_0xd395('0x15')]['update'](_0x594b0d['body'],{'raw':_0x594b0d['options']?_0x594b0d[_0xd395('0x18')][_0xd395('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x594b0d['options']?_0x594b0d[_0xd395('0x18')]['where']||null:null,'attributes':_0x594b0d['options']?_0x594b0d[_0xd395('0x18')][_0xd395('0x1e')]||null:null,'limit':_0x594b0d[_0xd395('0x18')]?_0x594b0d['options'][_0xd395('0x1f')]||null:null})[_0xd395('0x19')](function(_0x583f88){logger[_0xd395('0x1a')](_0xd395('0x1c'),_0x594b0d);logger[_0xd395('0xd')]('UpdateSmsQueueReport',_0x594b0d,JSON[_0xd395('0xe')](_0x583f88));_0x4205dd(_0x583f88);})['catch'](function(_0x272749){logger[_0xd395('0xf')]('UpdateSmsQueueReport',_0x272749[_0xd395('0x12')],_0x594b0d);_0x2636a9(_0x16e34d[_0xd395('0xf')](0x1f4,_0x272749['message']));});});}; \ No newline at end of file +var _0xffca=['SmsQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','SmsQueueReport','create','body','options','raw','CreateSmsQueueReport','debug','stringify','update','where','attributes','limit','UpdateSmsQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x2308db,_0x2e95c9){var _0x38d5de=function(_0x553804){while(--_0x553804){_0x2308db['push'](_0x2308db['shift']());}};_0x38d5de(++_0x2e95c9);}(_0xffca,0x192));var _0xaffc=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xffca[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0xaffc('0x0'));var util=require(_0xaffc('0x1'));var moment=require(_0xaffc('0x2'));var BPromise=require('bluebird');var rs=require(_0xaffc('0x3'));var fs=require('fs');var Redis=require(_0xaffc('0x4'));var db=require(_0xaffc('0x5'))['db'];var utils=require(_0xaffc('0x6'));var logger=require('../../config/logger')(_0xaffc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xaffc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x277847,_0x51a5b7,_0xda1fb0){return new BPromise(function(_0x3b042e,_0x4c9b68){return client[_0xaffc('0x9')](_0x277847,_0xda1fb0)[_0xaffc('0xa')](function(_0x50ccfb){logger[_0xaffc('0xb')](_0xaffc('0xc'),_0x51a5b7,_0xaffc('0xd'));logger['debug'](_0xaffc('0xe'),_0x51a5b7,_0xaffc('0xd'),JSON['stringify'](_0x50ccfb));if(_0x50ccfb[_0xaffc('0xf')]){if(_0x50ccfb[_0xaffc('0xf')]['code']===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x51a5b7,_0x50ccfb['error'][_0xaffc('0x10')]);return _0x4c9b68(_0x50ccfb[_0xaffc('0xf')][_0xaffc('0x10')]);}logger[_0xaffc('0xf')](_0xaffc('0xc'),_0x51a5b7,_0x50ccfb[_0xaffc('0xf')][_0xaffc('0x10')]);return _0x3b042e(_0x50ccfb[_0xaffc('0xf')]['message']);}else{logger['info'](_0xaffc('0xc'),_0x51a5b7,_0xaffc('0xd'));_0x3b042e(_0x50ccfb[_0xaffc('0x11')][_0xaffc('0x10')]);}})[_0xaffc('0x12')](function(_0xa4a577){logger[_0xaffc('0xf')](_0xaffc('0xc'),_0x51a5b7,_0xa4a577);_0x4c9b68(_0xa4a577);});});}exports['CreateSmsQueueReport']=function(_0x3c1322){var _0x40c063=this;return new Promise(function(_0x5a93d7,_0x294f3a){return db[_0xaffc('0x13')][_0xaffc('0x14')](_0x3c1322[_0xaffc('0x15')],{'raw':_0x3c1322['options']?_0x3c1322[_0xaffc('0x16')][_0xaffc('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4e31f2){logger[_0xaffc('0xb')](_0xaffc('0x18'),_0x3c1322);logger[_0xaffc('0x19')](_0xaffc('0x18'),_0x3c1322,JSON[_0xaffc('0x1a')](_0x4e31f2));_0x5a93d7(_0x4e31f2);})[_0xaffc('0x12')](function(_0x3620a1){logger[_0xaffc('0xf')](_0xaffc('0x18'),_0x3620a1[_0xaffc('0x10')],_0x3c1322);_0x294f3a(_0x40c063[_0xaffc('0xf')](0x1f4,_0x3620a1['message']));});});};exports['UpdateSmsQueueReport']=function(_0x163c67){var _0x1777cd=this;return new Promise(function(_0x520789,_0x501045){return db[_0xaffc('0x13')][_0xaffc('0x1b')](_0x163c67['body'],{'raw':_0x163c67[_0xaffc('0x16')]?_0x163c67[_0xaffc('0x16')][_0xaffc('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x163c67[_0xaffc('0x16')]?_0x163c67[_0xaffc('0x16')][_0xaffc('0x1c')]||null:null,'attributes':_0x163c67['options']?_0x163c67['options'][_0xaffc('0x1d')]||null:null,'limit':_0x163c67[_0xaffc('0x16')]?_0x163c67['options'][_0xaffc('0x1e')]||null:null})[_0xaffc('0xa')](function(_0x495cfd){logger[_0xaffc('0xb')](_0xaffc('0x1f'),_0x163c67);logger[_0xaffc('0x19')](_0xaffc('0x1f'),_0x163c67,JSON['stringify'](_0x495cfd));_0x520789(_0x495cfd);})[_0xaffc('0x12')](function(_0x20b741){logger['error'](_0xaffc('0x1f'),_0x20b741[_0xaffc('0x10')],_0x163c67);_0x501045(_0x1777cd[_0xaffc('0xf')](0x1f4,_0x20b741[_0xaffc('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 1644629..09da56b 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 _0x8ce1=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0xa9386b,_0x22b29c){var _0x4e0231=function(_0x12840e){while(--_0x12840e){_0xa9386b['push'](_0xa9386b['shift']());}};_0x4e0231(++_0x22b29c);}(_0x8ce1,0x183));var _0x18ce=function(_0x3363b6,_0x33931c){_0x3363b6=_0x3363b6-0x0;var _0x596e75=_0x8ce1[_0x3363b6];return _0x596e75;};'use strict';var multer=require(_0x18ce('0x0'));var util=require(_0x18ce('0x1'));var path=require(_0x18ce('0x2'));var timeout=require(_0x18ce('0x3'));var express=require(_0x18ce('0x4'));var router=express[_0x18ce('0x5')]();var fs_extra=require(_0x18ce('0x6'));var auth=require(_0x18ce('0x7'));var interaction=require(_0x18ce('0x8'));var config=require(_0x18ce('0x9'));var controller=require(_0x18ce('0xa'));router[_0x18ce('0xb')]('/',auth[_0x18ce('0xc')](),controller[_0x18ce('0xd')]);router[_0x18ce('0xb')](_0x18ce('0xe'),auth['isAuthenticated'](),controller[_0x18ce('0xf')]);router[_0x18ce('0xb')](_0x18ce('0x10'),auth[_0x18ce('0xc')](),controller['show']);router[_0x18ce('0x11')]('/',auth[_0x18ce('0xc')](),controller[_0x18ce('0x12')]);router[_0x18ce('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x18ce('0x14')]);router[_0x18ce('0x15')](_0x18ce('0x10'),auth[_0x18ce('0xc')](),controller[_0x18ce('0x16')]);module['exports']=router; \ No newline at end of file +var _0xf987=['../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','update','delete','destroy','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x34f708,_0x686120){var _0x52dc3e=function(_0x381737){while(--_0x381737){_0x34f708['push'](_0x34f708['shift']());}};_0x52dc3e(++_0x686120);}(_0xf987,0x18a));var _0x7f98=function(_0x6d852d,_0x47f251){_0x6d852d=_0x6d852d-0x0;var _0x2224ca=_0xf987[_0x6d852d];return _0x2224ca;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7f98('0x0'));var timeout=require(_0x7f98('0x1'));var express=require('express');var router=express[_0x7f98('0x2')]();var fs_extra=require(_0x7f98('0x3'));var auth=require(_0x7f98('0x4'));var interaction=require(_0x7f98('0x5'));var config=require(_0x7f98('0x6'));var controller=require(_0x7f98('0x7'));router[_0x7f98('0x8')]('/',auth[_0x7f98('0x9')](),controller[_0x7f98('0xa')]);router[_0x7f98('0x8')](_0x7f98('0xb'),auth[_0x7f98('0x9')](),controller['describe']);router[_0x7f98('0x8')](_0x7f98('0xc'),auth[_0x7f98('0x9')](),controller[_0x7f98('0xd')]);router[_0x7f98('0xe')]('/',auth['isAuthenticated'](),controller[_0x7f98('0xf')]);router['put']('/:id',auth[_0x7f98('0x9')](),controller[_0x7f98('0x10')]);router[_0x7f98('0x11')](_0x7f98('0xc'),auth['isAuthenticated'](),controller[_0x7f98('0x12')]);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 9b0ddb4..7acb976 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x15b7e7,_0x122147){var _0xeee54d=function(_0xd2daf1){while(--_0xd2daf1){_0x15b7e7['push'](_0x15b7e7['shift']());}};_0xeee54d(++_0x122147);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x4abab9,_0xde21a4){_0x4abab9=_0x4abab9-0x0;var _0x374eba=_0xf3cd[_0x4abab9];return _0x374eba;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x4d1ce8,_0x1a778e){var _0x129384=function(_0x15e43b){while(--_0x15e43b){_0x4d1ce8['push'](_0x4d1ce8['shift']());}};_0x129384(++_0x1a778e);}(_0x54ef,0x112));var _0xf54e=function(_0x3d7e1f,_0x3dfe7b){_0x3d7e1f=_0x3d7e1f-0x0;var _0x18a8c6=_0x54ef[_0x3d7e1f];return _0x18a8c6;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 24dc33b..5a1153b 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 _0x9a68=['bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','undefined','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','SmsTransferReport','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','findAll','rows','catch','show','intersection','includeAll','find','create','body','update','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x41f6c0,_0x553f63){var _0xb6fb37=function(_0x3b71f4){while(--_0x3b71f4){_0x41f6c0['push'](_0x41f6c0['shift']());}};_0xb6fb37(++_0x553f63);}(_0x9a68,0x1d5));var _0x89a6=function(_0x3859de,_0x28d26f){_0x3859de=_0x3859de-0x0;var _0x37b5b0=_0x9a68[_0x3859de];return _0x37b5b0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x89a6('0x0'));var zipdir=require(_0x89a6('0x1'));var jsonpatch=require(_0x89a6('0x2'));var rp=require(_0x89a6('0x3'));var moment=require(_0x89a6('0x4'));var BPromise=require(_0x89a6('0x5'));var Mustache=require(_0x89a6('0x6'));var util=require(_0x89a6('0x7'));var path=require(_0x89a6('0x8'));var sox=require('sox');var csv=require(_0x89a6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x89a6('0xa'));var _=require(_0x89a6('0xb'));var squel=require(_0x89a6('0xc'));var crypto=require(_0x89a6('0xd'));var jsforce=require(_0x89a6('0xe'));var deskjs=require(_0x89a6('0xf'));var toCsv=require(_0x89a6('0x9'));var querystring=require('querystring');var Papa=require(_0x89a6('0x10'));var Redis=require(_0x89a6('0x11'));var authService=require(_0x89a6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x89a6('0x13'));var hardwareService=require(_0x89a6('0x14'));var logger=require(_0x89a6('0x15'))(_0x89a6('0x16'));var utils=require(_0x89a6('0x17'));var config=require(_0x89a6('0x18'));var licenseUtil=require(_0x89a6('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45e1c7,_0x572546){_0x572546=_0x572546||0xcc;return function(_0x4974c4){if(_0x4974c4){return _0x45e1c7[_0x89a6('0x1a')](_0x572546);}return _0x45e1c7['status'](_0x572546)[_0x89a6('0x1b')]();};}function respondWithResult(_0x7d2cc,_0x31d4a4){_0x31d4a4=_0x31d4a4||0xc8;return function(_0x101c87){if(_0x101c87){return _0x7d2cc[_0x89a6('0x1c')](_0x31d4a4)[_0x89a6('0x1d')](_0x101c87);}};}function respondWithFilteredResult(_0x3e5246,_0x444931){return function(_0x57b4cc){if(_0x57b4cc){var _0x18c774=typeof _0x444931[_0x89a6('0x1e')]==='undefined'&&typeof _0x444931[_0x89a6('0x1f')]===_0x89a6('0x20');var _0x516c31=_0x57b4cc['count'];var _0x4d34e=_0x18c774?0x0:_0x444931[_0x89a6('0x1e')];var _0xe1186a=_0x18c774?_0x57b4cc['count']:_0x444931[_0x89a6('0x1e')]+_0x444931['limit'];var _0x30132c;if(_0xe1186a>=_0x516c31){_0xe1186a=_0x516c31;_0x30132c=0xc8;}else{_0x30132c=0xce;}_0x3e5246[_0x89a6('0x1c')](_0x30132c);return _0x3e5246[_0x89a6('0x21')](_0x89a6('0x22'),_0x4d34e+'-'+_0xe1186a+'/'+_0x516c31)[_0x89a6('0x1d')](_0x57b4cc);}return null;};}function patchUpdates(_0x3ec5ab){return function(_0x1e642e){try{jsonpatch[_0x89a6('0x23')](_0x1e642e,_0x3ec5ab,!![]);}catch(_0x4a3db7){return BPromise[_0x89a6('0x24')](_0x4a3db7);}return _0x1e642e[_0x89a6('0x25')]();};}function saveUpdates(_0x542a1d,_0x1faafa){return function(_0x320f0f){if(_0x320f0f){return _0x320f0f['update'](_0x542a1d)['then'](function(_0x48e167){return _0x48e167;});}return null;};}function removeEntity(_0x909419,_0x3b25d2){return function(_0x55c9ff){if(_0x55c9ff){return _0x55c9ff[_0x89a6('0x26')]()[_0x89a6('0x27')](function(){_0x909419[_0x89a6('0x1c')](0xcc)[_0x89a6('0x1b')]();});}};}function handleEntityNotFound(_0x1b7bd5,_0x359fe0){return function(_0x352132){if(!_0x352132){_0x1b7bd5[_0x89a6('0x1a')](0x194);}return _0x352132;};}function handleError(_0x1fb77b,_0x3db0ca){_0x3db0ca=_0x3db0ca||0x1f4;return function(_0x135bac){logger[_0x89a6('0x28')](_0x135bac[_0x89a6('0x29')]);if(_0x135bac[_0x89a6('0x2a')]){delete _0x135bac[_0x89a6('0x2a')];}_0x1fb77b['status'](_0x3db0ca)[_0x89a6('0x2b')](_0x135bac);};}exports[_0x89a6('0x2c')]=function(_0x184b7c,_0x5590a6){var _0x2fd795={},_0x4d242d={},_0x5ce886={'count':0x0,'rows':[]};var _0x35d0d6=_['map'](db[_0x89a6('0x2d')][_0x89a6('0x2e')],function(_0x8f6f14){return{'name':_0x8f6f14[_0x89a6('0x2f')],'type':_0x8f6f14[_0x89a6('0x30')]['key']};});_0x4d242d[_0x89a6('0x31')]=_[_0x89a6('0x32')](_0x35d0d6,_0x89a6('0x2a'));_0x4d242d[_0x89a6('0x33')]=_[_0x89a6('0x34')](_0x184b7c[_0x89a6('0x33')]);_0x4d242d[_0x89a6('0x35')]=_['intersection'](_0x4d242d['model'],_0x4d242d[_0x89a6('0x33')]);_0x2fd795[_0x89a6('0x36')]=_['intersection'](_0x4d242d['model'],qs[_0x89a6('0x37')](_0x184b7c['query'][_0x89a6('0x37')]));_0x2fd795[_0x89a6('0x36')]=_0x2fd795[_0x89a6('0x36')][_0x89a6('0x38')]?_0x2fd795[_0x89a6('0x36')]:_0x4d242d[_0x89a6('0x31')];if(!_0x184b7c[_0x89a6('0x33')][_0x89a6('0x39')](_0x89a6('0x3a'))){_0x2fd795[_0x89a6('0x1f')]=qs[_0x89a6('0x1f')](_0x184b7c[_0x89a6('0x33')][_0x89a6('0x1f')]);_0x2fd795[_0x89a6('0x1e')]=qs[_0x89a6('0x1e')](_0x184b7c['query'][_0x89a6('0x1e')]);}_0x2fd795[_0x89a6('0x3b')]=qs[_0x89a6('0x3c')](_0x184b7c[_0x89a6('0x33')][_0x89a6('0x3c')]);_0x2fd795[_0x89a6('0x3d')]=qs['filters'](_['pick'](_0x184b7c[_0x89a6('0x33')],_0x4d242d[_0x89a6('0x35')]),_0x35d0d6);if(_0x184b7c[_0x89a6('0x33')][_0x89a6('0x3e')]){_0x2fd795[_0x89a6('0x3d')]=_[_0x89a6('0x3f')](_0x2fd795['where'],{'$or':_['map'](_0x35d0d6,function(_0x3d14dd){if(_0x3d14dd[_0x89a6('0x30')]!==_0x89a6('0x40')){var _0x3dcfbd={};_0x3dcfbd[_0x3d14dd[_0x89a6('0x2a')]]={'$like':'%'+_0x184b7c[_0x89a6('0x33')]['filter']+'%'};return _0x3dcfbd;}})});}_0x2fd795=_[_0x89a6('0x3f')]({},_0x2fd795,_0x184b7c[_0x89a6('0x41')]);var _0x5374cc={'where':_0x2fd795[_0x89a6('0x3d')]};return db[_0x89a6('0x2d')][_0x89a6('0x42')](_0x5374cc)[_0x89a6('0x27')](function(_0x372007){_0x5ce886[_0x89a6('0x42')]=_0x372007;if(_0x184b7c[_0x89a6('0x33')]['includeAll']){_0x2fd795['include']=[{'all':!![]}];}return db['SmsTransferReport'][_0x89a6('0x43')](_0x2fd795);})[_0x89a6('0x27')](function(_0x5ad887){_0x5ce886[_0x89a6('0x44')]=_0x5ad887;return _0x5ce886;})[_0x89a6('0x27')](respondWithFilteredResult(_0x5590a6,_0x2fd795))[_0x89a6('0x45')](handleError(_0x5590a6,null));};exports[_0x89a6('0x46')]=function(_0x72191e,_0x1b06f2){var _0x2e14fb={'raw':!![],'where':{'id':_0x72191e['params']['id']}},_0x4c6bf7={};_0x4c6bf7[_0x89a6('0x31')]=_[_0x89a6('0x34')](db['SmsTransferReport'][_0x89a6('0x2e')]);_0x4c6bf7['query']=_[_0x89a6('0x34')](_0x72191e['query']);_0x4c6bf7[_0x89a6('0x35')]=_[_0x89a6('0x47')](_0x4c6bf7['model'],_0x4c6bf7[_0x89a6('0x33')]);_0x2e14fb[_0x89a6('0x36')]=_['intersection'](_0x4c6bf7['model'],qs[_0x89a6('0x37')](_0x72191e[_0x89a6('0x33')]['fields']));_0x2e14fb['attributes']=_0x2e14fb[_0x89a6('0x36')][_0x89a6('0x38')]?_0x2e14fb['attributes']:_0x4c6bf7[_0x89a6('0x31')];if(_0x72191e[_0x89a6('0x33')][_0x89a6('0x48')]){_0x2e14fb['include']=[{'all':!![]}];}_0x2e14fb=_['merge']({},_0x2e14fb,_0x72191e[_0x89a6('0x41')]);return db[_0x89a6('0x2d')][_0x89a6('0x49')](_0x2e14fb)['then'](handleEntityNotFound(_0x1b06f2,null))[_0x89a6('0x27')](respondWithResult(_0x1b06f2,null))['catch'](handleError(_0x1b06f2,null));};exports[_0x89a6('0x4a')]=function(_0x416990,_0x50222f){return db[_0x89a6('0x2d')]['create'](_0x416990[_0x89a6('0x4b')],{})[_0x89a6('0x27')](respondWithResult(_0x50222f,0xc9))[_0x89a6('0x45')](handleError(_0x50222f,null));};exports[_0x89a6('0x4c')]=function(_0x2a6164,_0x3fa87c){if(_0x2a6164[_0x89a6('0x4b')]['id']){delete _0x2a6164[_0x89a6('0x4b')]['id'];}return db[_0x89a6('0x2d')]['find']({'where':{'id':_0x2a6164[_0x89a6('0x4d')]['id']}})[_0x89a6('0x27')](handleEntityNotFound(_0x3fa87c,null))[_0x89a6('0x27')](saveUpdates(_0x2a6164['body'],null))[_0x89a6('0x27')](respondWithResult(_0x3fa87c,null))['catch'](handleError(_0x3fa87c,null));};exports[_0x89a6('0x26')]=function(_0x17a668,_0x3dfb47){return db[_0x89a6('0x2d')][_0x89a6('0x49')]({'where':{'id':_0x17a668[_0x89a6('0x4d')]['id']}})[_0x89a6('0x27')](handleEntityNotFound(_0x3dfb47,null))[_0x89a6('0x27')](removeEntity(_0x3dfb47,null))[_0x89a6('0x45')](handleError(_0x3dfb47,null));};exports[_0x89a6('0x4e')]=function(_0x3f7683,_0x38e1ef){return db[_0x89a6('0x2d')][_0x89a6('0x4e')]()[_0x89a6('0x27')](respondWithResult(_0x38e1ef,null))[_0x89a6('0x45')](handleError(_0x38e1ef,null));}; \ No newline at end of file +var _0xafc8=['status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','then','destroy','stack','name','send','index','map','SmsTransferReport','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','create','body','find','describe','eml-format','zip-dir','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x149cb3,_0x5abc68){var _0x3153a8=function(_0x3b37f2){while(--_0x3b37f2){_0x149cb3['push'](_0x149cb3['shift']());}};_0x3153a8(++_0x5abc68);}(_0xafc8,0x7a));var _0x8afc=function(_0xceeedd,_0x18d0ce){_0xceeedd=_0xceeedd-0x0;var _0x2f28c4=_0xafc8[_0xceeedd];return _0x2f28c4;};'use strict';var emlformat=require(_0x8afc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8afc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8afc('0x2'));var moment=require('moment');var BPromise=require(_0x8afc('0x3'));var Mustache=require(_0x8afc('0x4'));var util=require(_0x8afc('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x8afc('0x6'));var ejs=require(_0x8afc('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8afc('0x8'));var squel=require(_0x8afc('0x9'));var crypto=require(_0x8afc('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x8afc('0xb'));var toCsv=require(_0x8afc('0x6'));var querystring=require(_0x8afc('0xc'));var Papa=require(_0x8afc('0xd'));var Redis=require(_0x8afc('0xe'));var authService=require(_0x8afc('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8afc('0x10'));var hardwareService=require(_0x8afc('0x11'));var logger=require(_0x8afc('0x12'))(_0x8afc('0x13'));var utils=require('../../config/utils');var config=require(_0x8afc('0x14'));var licenseUtil=require(_0x8afc('0x15'));var db=require(_0x8afc('0x16'))['db'];function respondWithStatusCode(_0x375853,_0x539ebe){_0x539ebe=_0x539ebe||0xcc;return function(_0x33a83b){if(_0x33a83b){return _0x375853[_0x8afc('0x17')](_0x539ebe);}return _0x375853[_0x8afc('0x18')](_0x539ebe)[_0x8afc('0x19')]();};}function respondWithResult(_0x1c9fa8,_0x37f322){_0x37f322=_0x37f322||0xc8;return function(_0x597e15){if(_0x597e15){return _0x1c9fa8[_0x8afc('0x18')](_0x37f322)[_0x8afc('0x1a')](_0x597e15);}};}function respondWithFilteredResult(_0x36c2b0,_0x971a42){return function(_0x78a77e){if(_0x78a77e){var _0x457c2b=typeof _0x971a42[_0x8afc('0x1b')]===_0x8afc('0x1c')&&typeof _0x971a42['limit']===_0x8afc('0x1c');var _0x4a8246=_0x78a77e[_0x8afc('0x1d')];var _0x2e7503=_0x457c2b?0x0:_0x971a42[_0x8afc('0x1b')];var _0x12cafb=_0x457c2b?_0x78a77e[_0x8afc('0x1d')]:_0x971a42[_0x8afc('0x1b')]+_0x971a42[_0x8afc('0x1e')];var _0x495e8f;if(_0x12cafb>=_0x4a8246){_0x12cafb=_0x4a8246;_0x495e8f=0xc8;}else{_0x495e8f=0xce;}_0x36c2b0[_0x8afc('0x18')](_0x495e8f);return _0x36c2b0['set'](_0x8afc('0x1f'),_0x2e7503+'-'+_0x12cafb+'/'+_0x4a8246)[_0x8afc('0x1a')](_0x78a77e);}return null;};}function patchUpdates(_0x2415af){return function(_0x41a252){try{jsonpatch[_0x8afc('0x20')](_0x41a252,_0x2415af,!![]);}catch(_0x47606a){return BPromise[_0x8afc('0x21')](_0x47606a);}return _0x41a252['save']();};}function saveUpdates(_0x3bef04,_0x32f8bd){return function(_0x45dd14){if(_0x45dd14){return _0x45dd14['update'](_0x3bef04)[_0x8afc('0x22')](function(_0x3458e0){return _0x3458e0;});}return null;};}function removeEntity(_0x309c42,_0x2688eb){return function(_0x520f2b){if(_0x520f2b){return _0x520f2b[_0x8afc('0x23')]()[_0x8afc('0x22')](function(){_0x309c42[_0x8afc('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x224bfa,_0x147a5f){return function(_0x11edae){if(!_0x11edae){_0x224bfa[_0x8afc('0x17')](0x194);}return _0x11edae;};}function handleError(_0xa03e71,_0x2ce552){_0x2ce552=_0x2ce552||0x1f4;return function(_0x538ace){logger['error'](_0x538ace[_0x8afc('0x24')]);if(_0x538ace[_0x8afc('0x25')]){delete _0x538ace['name'];}_0xa03e71['status'](_0x2ce552)[_0x8afc('0x26')](_0x538ace);};}exports[_0x8afc('0x27')]=function(_0x355c9b,_0x4b140f){var _0x32820a={},_0x672f80={},_0x349326={'count':0x0,'rows':[]};var _0x1555ec=_[_0x8afc('0x28')](db[_0x8afc('0x29')]['rawAttributes'],function(_0x2290f2){return{'name':_0x2290f2[_0x8afc('0x2a')],'type':_0x2290f2[_0x8afc('0x2b')][_0x8afc('0x2c')]};});_0x672f80['model']=_[_0x8afc('0x28')](_0x1555ec,_0x8afc('0x25'));_0x672f80[_0x8afc('0x2d')]=_[_0x8afc('0x2e')](_0x355c9b[_0x8afc('0x2d')]);_0x672f80[_0x8afc('0x2f')]=_[_0x8afc('0x30')](_0x672f80[_0x8afc('0x31')],_0x672f80[_0x8afc('0x2d')]);_0x32820a[_0x8afc('0x32')]=_[_0x8afc('0x30')](_0x672f80['model'],qs[_0x8afc('0x33')](_0x355c9b[_0x8afc('0x2d')][_0x8afc('0x33')]));_0x32820a[_0x8afc('0x32')]=_0x32820a[_0x8afc('0x32')][_0x8afc('0x34')]?_0x32820a[_0x8afc('0x32')]:_0x672f80[_0x8afc('0x31')];if(!_0x355c9b[_0x8afc('0x2d')][_0x8afc('0x35')](_0x8afc('0x36'))){_0x32820a[_0x8afc('0x1e')]=qs[_0x8afc('0x1e')](_0x355c9b[_0x8afc('0x2d')]['limit']);_0x32820a[_0x8afc('0x1b')]=qs[_0x8afc('0x1b')](_0x355c9b[_0x8afc('0x2d')][_0x8afc('0x1b')]);}_0x32820a['order']=qs['sort'](_0x355c9b[_0x8afc('0x2d')][_0x8afc('0x37')]);_0x32820a[_0x8afc('0x38')]=qs[_0x8afc('0x2f')](_[_0x8afc('0x39')](_0x355c9b[_0x8afc('0x2d')],_0x672f80[_0x8afc('0x2f')]),_0x1555ec);if(_0x355c9b[_0x8afc('0x2d')][_0x8afc('0x3a')]){_0x32820a[_0x8afc('0x38')]=_[_0x8afc('0x3b')](_0x32820a[_0x8afc('0x38')],{'$or':_['map'](_0x1555ec,function(_0x5ed7c4){if(_0x5ed7c4[_0x8afc('0x2b')]!==_0x8afc('0x3c')){var _0x4fb299={};_0x4fb299[_0x5ed7c4['name']]={'$like':'%'+_0x355c9b['query']['filter']+'%'};return _0x4fb299;}})});}_0x32820a=_[_0x8afc('0x3b')]({},_0x32820a,_0x355c9b[_0x8afc('0x3d')]);var _0x5b518a={'where':_0x32820a['where']};return db[_0x8afc('0x29')][_0x8afc('0x1d')](_0x5b518a)[_0x8afc('0x22')](function(_0x476a7a){_0x349326['count']=_0x476a7a;if(_0x355c9b[_0x8afc('0x2d')][_0x8afc('0x3e')]){_0x32820a[_0x8afc('0x3f')]=[{'all':!![]}];}return db['SmsTransferReport']['findAll'](_0x32820a);})[_0x8afc('0x22')](function(_0x4a9880){_0x349326[_0x8afc('0x40')]=_0x4a9880;return _0x349326;})[_0x8afc('0x22')](respondWithFilteredResult(_0x4b140f,_0x32820a))[_0x8afc('0x41')](handleError(_0x4b140f,null));};exports[_0x8afc('0x42')]=function(_0x42f46b,_0x12851c){var _0x2ed782={'raw':!![],'where':{'id':_0x42f46b[_0x8afc('0x43')]['id']}},_0x49dc79={};_0x49dc79['model']=_[_0x8afc('0x2e')](db[_0x8afc('0x29')][_0x8afc('0x44')]);_0x49dc79[_0x8afc('0x2d')]=_[_0x8afc('0x2e')](_0x42f46b['query']);_0x49dc79['filters']=_[_0x8afc('0x30')](_0x49dc79[_0x8afc('0x31')],_0x49dc79['query']);_0x2ed782[_0x8afc('0x32')]=_[_0x8afc('0x30')](_0x49dc79[_0x8afc('0x31')],qs[_0x8afc('0x33')](_0x42f46b[_0x8afc('0x2d')][_0x8afc('0x33')]));_0x2ed782[_0x8afc('0x32')]=_0x2ed782[_0x8afc('0x32')][_0x8afc('0x34')]?_0x2ed782[_0x8afc('0x32')]:_0x49dc79[_0x8afc('0x31')];if(_0x42f46b[_0x8afc('0x2d')][_0x8afc('0x3e')]){_0x2ed782[_0x8afc('0x3f')]=[{'all':!![]}];}_0x2ed782=_[_0x8afc('0x3b')]({},_0x2ed782,_0x42f46b[_0x8afc('0x3d')]);return db[_0x8afc('0x29')]['find'](_0x2ed782)['then'](handleEntityNotFound(_0x12851c,null))['then'](respondWithResult(_0x12851c,null))['catch'](handleError(_0x12851c,null));};exports[_0x8afc('0x45')]=function(_0x508744,_0x255822){return db[_0x8afc('0x29')][_0x8afc('0x45')](_0x508744[_0x8afc('0x46')],{})['then'](respondWithResult(_0x255822,0xc9))[_0x8afc('0x41')](handleError(_0x255822,null));};exports['update']=function(_0x48082b,_0x649777){if(_0x48082b['body']['id']){delete _0x48082b['body']['id'];}return db[_0x8afc('0x29')][_0x8afc('0x47')]({'where':{'id':_0x48082b[_0x8afc('0x43')]['id']}})[_0x8afc('0x22')](handleEntityNotFound(_0x649777,null))[_0x8afc('0x22')](saveUpdates(_0x48082b[_0x8afc('0x46')],null))[_0x8afc('0x22')](respondWithResult(_0x649777,null))[_0x8afc('0x41')](handleError(_0x649777,null));};exports['destroy']=function(_0x7c687f,_0x3fc837){return db[_0x8afc('0x29')][_0x8afc('0x47')]({'where':{'id':_0x7c687f[_0x8afc('0x43')]['id']}})[_0x8afc('0x22')](handleEntityNotFound(_0x3fc837,null))['then'](removeEntity(_0x3fc837,null))['catch'](handleError(_0x3fc837,null));};exports[_0x8afc('0x48')]=function(_0x35e704,_0x2edacd){return db[_0x8afc('0x29')][_0x8afc('0x48')]()[_0x8afc('0x22')](respondWithResult(_0x2edacd,null))['catch'](handleError(_0x2edacd,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 1e1549e..991ec54 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 _0xf12f=['bluebird','request-promise','path','rimraf','./smsTransferReport.attributes','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x5c5d10,_0x42d355){var _0x45f003=function(_0x9e58c){while(--_0x9e58c){_0x5c5d10['push'](_0x5c5d10['shift']());}};_0x45f003(++_0x42d355);}(_0xf12f,0x1bb));var _0xff12=function(_0x355bcb,_0x244f4a){_0x355bcb=_0x355bcb-0x0;var _0x236e9b=_0xf12f[_0x355bcb];return _0x236e9b;};'use strict';var _=require(_0xff12('0x0'));var util=require(_0xff12('0x1'));var logger=require(_0xff12('0x2'))(_0xff12('0x3'));var moment=require(_0xff12('0x4'));var BPromise=require(_0xff12('0x5'));var rp=require(_0xff12('0x6'));var fs=require('fs');var path=require(_0xff12('0x7'));var rimraf=require(_0xff12('0x8'));var config=require('../../config/environment');var attributes=require(_0xff12('0x9'));module['exports']=function(_0x37a286,_0x271e49){return _0x37a286[_0xff12('0xa')](_0xff12('0xb'),attributes,{'tableName':_0xff12('0xc'),'paranoid':![],'indexes':[{'name':_0xff12('0xd'),'fields':[_0xff12('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x45ea=['rimraf','../../config/environment','./smsTransferReport.attributes','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3b231a,_0x53a00d){var _0x18d67a=function(_0x5e14c6){while(--_0x5e14c6){_0x3b231a['push'](_0x3b231a['shift']());}};_0x18d67a(++_0x53a00d);}(_0x45ea,0x1f0));var _0xa45e=function(_0x1d0a4b,_0x2efed6){_0x1d0a4b=_0x1d0a4b-0x0;var _0x3951ca=_0x45ea[_0x1d0a4b];return _0x3951ca;};'use strict';var _=require(_0xa45e('0x0'));var util=require(_0xa45e('0x1'));var logger=require(_0xa45e('0x2'))(_0xa45e('0x3'));var moment=require(_0xa45e('0x4'));var BPromise=require(_0xa45e('0x5'));var rp=require(_0xa45e('0x6'));var fs=require('fs');var path=require(_0xa45e('0x7'));var rimraf=require(_0xa45e('0x8'));var config=require(_0xa45e('0x9'));var attributes=require(_0xa45e('0xa'));module['exports']=function(_0x418a41,_0x3ee60d){return _0x418a41['define']('SmsTransferReport',attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xa45e('0xb'),'fields':[_0xa45e('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 924ab71..e30eab6 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 _0xf9d5=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','stringify','error','SmsTransferReport,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis'];(function(_0x313748,_0x16dcfc){var _0x44c8b7=function(_0x3a6a5d){while(--_0x3a6a5d){_0x313748['push'](_0x313748['shift']());}};_0x44c8b7(++_0x16dcfc);}(_0xf9d5,0x122));var _0x5f9d=function(_0x4e2b73,_0x2aa168){_0x4e2b73=_0x4e2b73-0x0;var _0x161106=_0xf9d5[_0x4e2b73];return _0x161106;};'use strict';var _=require('lodash');var util=require(_0x5f9d('0x0'));var moment=require(_0x5f9d('0x1'));var BPromise=require('bluebird');var rs=require(_0x5f9d('0x2'));var fs=require('fs');var Redis=require(_0x5f9d('0x3'));var db=require(_0x5f9d('0x4'))['db'];var utils=require(_0x5f9d('0x5'));var logger=require(_0x5f9d('0x6'))(_0x5f9d('0x7'));var config=require(_0x5f9d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5f9d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24999e,_0x38fb6b,_0x4fb9f7){return new BPromise(function(_0x3420b2,_0x23e865){return client[_0x5f9d('0xa')](_0x24999e,_0x4fb9f7)[_0x5f9d('0xb')](function(_0xcc3772){logger[_0x5f9d('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x38fb6b,_0x5f9d('0xd'));logger[_0x5f9d('0xe')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x38fb6b,'request\x20sent',JSON[_0x5f9d('0xf')](_0xcc3772));if(_0xcc3772[_0x5f9d('0x10')]){if(_0xcc3772[_0x5f9d('0x10')]['code']===0x1f4){logger[_0x5f9d('0x10')](_0x5f9d('0x11'),_0x38fb6b,_0xcc3772[_0x5f9d('0x10')][_0x5f9d('0x12')]);return _0x23e865(_0xcc3772['error'][_0x5f9d('0x12')]);}logger[_0x5f9d('0x10')](_0x5f9d('0x11'),_0x38fb6b,_0xcc3772['error'][_0x5f9d('0x12')]);return _0x3420b2(_0xcc3772[_0x5f9d('0x10')]['message']);}else{logger['info'](_0x5f9d('0x11'),_0x38fb6b,_0x5f9d('0xd'));_0x3420b2(_0xcc3772[_0x5f9d('0x13')][_0x5f9d('0x12')]);}})[_0x5f9d('0x14')](function(_0x47f480){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x38fb6b,_0x47f480);_0x23e865(_0x47f480);});});} \ No newline at end of file +var _0x4491=['rpc','jayson/promise','http','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','message','info','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x345194,_0xc362b3){var _0x15b7d9=function(_0x50f9a9){while(--_0x50f9a9){_0x345194['push'](_0x345194['shift']());}};_0x15b7d9(++_0xc362b3);}(_0x4491,0x1bb));var _0x1449=function(_0xcbdfbf,_0xab502f){_0xcbdfbf=_0xcbdfbf-0x0;var _0x2376c1=_0x4491[_0xcbdfbf];return _0x2376c1;};'use strict';var _=require(_0x1449('0x0'));var util=require('util');var moment=require(_0x1449('0x1'));var BPromise=require('bluebird');var rs=require(_0x1449('0x2'));var fs=require('fs');var Redis=require(_0x1449('0x3'));var db=require(_0x1449('0x4'))['db'];var utils=require(_0x1449('0x5'));var logger=require(_0x1449('0x6'))(_0x1449('0x7'));var config=require('../../config/environment');var jayson=require(_0x1449('0x8'));var client=jayson['client'][_0x1449('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5dfe4c,_0x3b79bd,_0x2f4189){return new BPromise(function(_0x10e119,_0x3bc237){return client['request'](_0x5dfe4c,_0x2f4189)[_0x1449('0xa')](function(_0x2ea86d){logger['info'](_0x1449('0xb'),_0x3b79bd,_0x1449('0xc'));logger['debug'](_0x1449('0xd'),_0x3b79bd,_0x1449('0xc'),JSON['stringify'](_0x2ea86d));if(_0x2ea86d[_0x1449('0xe')]){if(_0x2ea86d['error']['code']===0x1f4){logger[_0x1449('0xe')](_0x1449('0xb'),_0x3b79bd,_0x2ea86d[_0x1449('0xe')][_0x1449('0xf')]);return _0x3bc237(_0x2ea86d[_0x1449('0xe')][_0x1449('0xf')]);}logger[_0x1449('0xe')](_0x1449('0xb'),_0x3b79bd,_0x2ea86d[_0x1449('0xe')][_0x1449('0xf')]);return _0x10e119(_0x2ea86d[_0x1449('0xe')][_0x1449('0xf')]);}else{logger[_0x1449('0x10')](_0x1449('0xb'),_0x3b79bd,_0x1449('0xc'));_0x10e119(_0x2ea86d['result'][_0x1449('0xf')]);}})[_0x1449('0x11')](function(_0x4a3508){logger[_0x1449('0xe')](_0x1449('0xb'),_0x3b79bd,_0x4a3508);_0x3bc237(_0x4a3508);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index c2e9917..02964ed 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 _0x20d9=['diskStorage','join','server/files/sounds/original/','originalname','replace','%s-%s%s','extname','now','single','file','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','isAuthenticated','index','/:id/download'];(function(_0xf98d20,_0x39a333){var _0x496c3d=function(_0x30c2a8){while(--_0x30c2a8){_0xf98d20['push'](_0xf98d20['shift']());}};_0x496c3d(++_0x39a333);}(_0x20d9,0x1a5));var _0x920d=function(_0x38eebe,_0xa29628){_0x38eebe=_0x38eebe-0x0;var _0x4b0a16=_0x20d9[_0x38eebe];return _0x4b0a16;};'use strict';var multer=require(_0x920d('0x0'));var util=require(_0x920d('0x1'));var path=require(_0x920d('0x2'));var timeout=require(_0x920d('0x3'));var express=require(_0x920d('0x4'));var router=express[_0x920d('0x5')]();var fs_extra=require(_0x920d('0x6'));var auth=require(_0x920d('0x7'));var interaction=require(_0x920d('0x8'));var config=require(_0x920d('0x9'));var controller=require(_0x920d('0xa'));router['get']('/',auth[_0x920d('0xb')](),controller[_0x920d('0xc')]);router['get']('/:id',auth[_0x920d('0xb')](),controller['show']);router['get'](_0x920d('0xd'),auth[_0x920d('0xb')](),controller['download']);var upload=multer({'storage':multer[_0x920d('0xe')]({'destination':function(_0x166288,_0x51831e,_0x4b47ab){_0x4b47ab(null,path[_0x920d('0xf')](config['root'],_0x920d('0x10')));},'filename':function(_0xcb824b,_0x37d541,_0x646f64){_0x37d541['originalname']=_0x37d541[_0x920d('0x11')][_0x920d('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x646f64(null,util['format'](_0x920d('0x13'),path['basename'](_0x37d541['originalname'],path[_0x920d('0x14')](_0x37d541[_0x920d('0x11')])),Date[_0x920d('0x15')](),path[_0x920d('0x14')](_0x37d541[_0x920d('0x11')])));}})});router['post']('/',upload[_0x920d('0x16')](_0x920d('0x17')),controller['create']);router[_0x920d('0x18')](_0x920d('0x19'),auth['isAuthenticated'](),controller[_0x920d('0x1a')]);router[_0x920d('0x1b')](_0x920d('0x19'),auth[_0x920d('0xb')](),controller[_0x920d('0x1b')]);module[_0x920d('0x1c')]=router; \ No newline at end of file +var _0xebdd=['../../components/interaction/service','../../config/environment','get','index','/:id','show','/:id/download','isAuthenticated','download','root','server/files/sounds/original/','originalname','format','%s-%s%s','extname','now','post','single','file','create','put','update','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3e86d8,_0xaf6e5c){var _0x52daf1=function(_0xa867aa){while(--_0xa867aa){_0x3e86d8['push'](_0x3e86d8['shift']());}};_0x52daf1(++_0xaf6e5c);}(_0xebdd,0x19f));var _0xdebd=function(_0x1f99a0,_0x50b73d){_0x1f99a0=_0x1f99a0-0x0;var _0x1e0849=_0xebdd[_0x1f99a0];return _0x1e0849;};'use strict';var multer=require(_0xdebd('0x0'));var util=require(_0xdebd('0x1'));var path=require(_0xdebd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdebd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdebd('0x4'));var interaction=require(_0xdebd('0x5'));var config=require(_0xdebd('0x6'));var controller=require('./sound.controller');router[_0xdebd('0x7')]('/',auth['isAuthenticated'](),controller[_0xdebd('0x8')]);router[_0xdebd('0x7')](_0xdebd('0x9'),auth['isAuthenticated'](),controller[_0xdebd('0xa')]);router[_0xdebd('0x7')](_0xdebd('0xb'),auth[_0xdebd('0xc')](),controller[_0xdebd('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x578234,_0x1f1b9c,_0x40af49){_0x40af49(null,path['join'](config[_0xdebd('0xe')],_0xdebd('0xf')));},'filename':function(_0x5a3649,_0x2c7d09,_0x46bbfd){_0x2c7d09[_0xdebd('0x10')]=_0x2c7d09[_0xdebd('0x10')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x46bbfd(null,util[_0xdebd('0x11')](_0xdebd('0x12'),path['basename'](_0x2c7d09[_0xdebd('0x10')],path[_0xdebd('0x13')](_0x2c7d09['originalname'])),Date[_0xdebd('0x14')](),path[_0xdebd('0x13')](_0x2c7d09[_0xdebd('0x10')])));}})});router[_0xdebd('0x15')]('/',upload[_0xdebd('0x16')](_0xdebd('0x17')),controller[_0xdebd('0x18')]);router[_0xdebd('0x19')]('/:id',auth[_0xdebd('0xc')](),controller[_0xdebd('0x1a')]);router['delete'](_0xdebd('0x9'),auth[_0xdebd('0xc')](),controller['delete']);module[_0xdebd('0x1b')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index dde6f02..d035f06 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 _0x285b=['sequelize','exports','name','STRING','FLOAT','INTEGER','BIGINT'];(function(_0x16e19f,_0x4f7c13){var _0x580e0c=function(_0x19c974){while(--_0x19c974){_0x16e19f['push'](_0x16e19f['shift']());}};_0x580e0c(++_0x4f7c13);}(_0x285b,0x13b));var _0xb285=function(_0x1f5352,_0x49667e){_0x1f5352=_0x1f5352-0x0;var _0x4a7d8f=_0x285b[_0x1f5352];return _0x4a7d8f;};'use strict';var Sequelize=require(_0xb285('0x0'));module[_0xb285('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb285('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xb285('0x3')]},'display_name':{'type':Sequelize[_0xb285('0x3')],'defaultValue':''},'description':{'type':Sequelize[_0xb285('0x3')]},'original_format':{'type':Sequelize[_0xb285('0x3')]},'original_duration':{'type':Sequelize[_0xb285('0x4')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xb285('0x5')]},'original_bitRate':{'type':Sequelize[_0xb285('0x6')]},'original_sampleRate':{'type':Sequelize[_0xb285('0x5')]},'converted_format':{'type':Sequelize[_0xb285('0x3')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xb285('0x6')]},'converted_channelCount':{'type':Sequelize[_0xb285('0x5')]},'converted_bitRate':{'type':Sequelize[_0xb285('0x6')]},'converted_sampleRate':{'type':Sequelize[_0xb285('0x5')]}}; \ No newline at end of file +var _0x32d8=['FLOAT','sequelize','STRING','BIGINT','INTEGER'];(function(_0xb3a8ea,_0x1a12f4){var _0x4ddc9f=function(_0x2381a8){while(--_0x2381a8){_0xb3a8ea['push'](_0xb3a8ea['shift']());}};_0x4ddc9f(++_0x1a12f4);}(_0x32d8,0x141));var _0x832d=function(_0x3614f2,_0x1bb103){_0x3614f2=_0x3614f2-0x0;var _0x5dc391=_0x32d8[_0x3614f2];return _0x5dc391;};'use strict';var Sequelize=require(_0x832d('0x0'));module['exports']={'name':{'type':Sequelize[_0x832d('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x832d('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x832d('0x1')]},'original_format':{'type':Sequelize[_0x832d('0x1')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x832d('0x2')]},'original_sampleRate':{'type':Sequelize[_0x832d('0x3')]},'converted_format':{'type':Sequelize[_0x832d('0x1')]},'converted_duration':{'type':Sequelize[_0x832d('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x832d('0x2')]},'converted_channelCount':{'type':Sequelize[_0x832d('0x3')]},'converted_bitRate':{'type':Sequelize[_0x832d('0x2')]},'converted_sampleRate':{'type':Sequelize[_0x832d('0x3')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 53e3abc..5789176 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 _0xf711=['path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','Sounds','end','error','name','Sound','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','includeAll','include','findAll','rows','show','find','converted_format','join','root','server/files/sounds/converted','save_name','Sequelize','Sound\x20not\x20found','download','format','%s.%s','create','basename','file','originalname','extname','substring','wav','server/files/sounds/original','filename','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','send','src','original_duration','duration','sampleCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_sampleRate','body','userProfileId','UserProfileSection','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','params','pick','description','delete','original_format','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x2b5731,_0x352aa1){var _0x45d053=function(_0x247713){while(--_0x247713){_0x2b5731['push'](_0x2b5731['shift']());}};_0x45d053(++_0x352aa1);}(_0xf711,0x71));var _0x1f71=function(_0x144b11,_0x2a5701){_0x144b11=_0x144b11-0x0;var _0x55e422=_0xf711[_0x144b11];return _0x55e422;};'use strict';var emlformat=require(_0x1f71('0x0'));var rimraf=require(_0x1f71('0x1'));var zipdir=require(_0x1f71('0x2'));var jsonpatch=require(_0x1f71('0x3'));var rp=require(_0x1f71('0x4'));var moment=require('moment');var BPromise=require(_0x1f71('0x5'));var Mustache=require(_0x1f71('0x6'));var util=require('util');var path=require(_0x1f71('0x7'));var sox=require(_0x1f71('0x8'));var csv=require(_0x1f71('0x9'));var ejs=require(_0x1f71('0xa'));var fs=require('fs');var fs_extra=require(_0x1f71('0xb'));var _=require(_0x1f71('0xc'));var squel=require('squel');var crypto=require(_0x1f71('0xd'));var jsforce=require(_0x1f71('0xe'));var deskjs=require(_0x1f71('0xf'));var toCsv=require(_0x1f71('0x9'));var querystring=require(_0x1f71('0x10'));var Papa=require('papaparse');var Redis=require(_0x1f71('0x11'));var authService=require(_0x1f71('0x12'));var qs=require(_0x1f71('0x13'));var as=require(_0x1f71('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1f71('0x15'))(_0x1f71('0x16'));var utils=require(_0x1f71('0x17'));var config=require(_0x1f71('0x18'));var licenseUtil=require(_0x1f71('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b6f63,_0x55f4c2){_0x55f4c2=_0x55f4c2||0xcc;return function(_0x5738d1){if(_0x5738d1){return _0x5b6f63[_0x1f71('0x1a')](_0x55f4c2);}return _0x5b6f63[_0x1f71('0x1b')](_0x55f4c2)['end']();};}function respondWithResult(_0x220481,_0x368baa){_0x368baa=_0x368baa||0xc8;return function(_0x5ea42){if(_0x5ea42){return _0x220481[_0x1f71('0x1b')](_0x368baa)['json'](_0x5ea42);}};}function respondWithFilteredResult(_0x1fdda5,_0x58ba25){return function(_0x554711){if(_0x554711){var _0xd1592a=typeof _0x58ba25[_0x1f71('0x1c')]===_0x1f71('0x1d')&&typeof _0x58ba25[_0x1f71('0x1e')]===_0x1f71('0x1d');var _0x3e386e=_0x554711[_0x1f71('0x1f')];var _0x4906a2=_0xd1592a?0x0:_0x58ba25[_0x1f71('0x1c')];var _0x402d36=_0xd1592a?_0x554711['count']:_0x58ba25['offset']+_0x58ba25[_0x1f71('0x1e')];var _0x5207bc;if(_0x402d36>=_0x3e386e){_0x402d36=_0x3e386e;_0x5207bc=0xc8;}else{_0x5207bc=0xce;}_0x1fdda5[_0x1f71('0x1b')](_0x5207bc);return _0x1fdda5[_0x1f71('0x20')](_0x1f71('0x21'),_0x4906a2+'-'+_0x402d36+'/'+_0x3e386e)['json'](_0x554711);}return null;};}function patchUpdates(_0x16e0b5){return function(_0x51e052){try{jsonpatch['apply'](_0x51e052,_0x16e0b5,!![]);}catch(_0x343a11){return BPromise[_0x1f71('0x22')](_0x343a11);}return _0x51e052[_0x1f71('0x23')]();};}function saveUpdates(_0x7ed848,_0x3555ba){return function(_0x2217f2){if(_0x2217f2){return _0x2217f2[_0x1f71('0x24')](_0x7ed848)[_0x1f71('0x25')](function(_0x595d63){return _0x595d63;});}return null;};}function removeEntity(_0x2fca9c,_0x79b1bc){return function(_0x37b525){if(_0x37b525){return _0x37b525[_0x1f71('0x26')]()[_0x1f71('0x25')](function(){var _0x360cf2=_0x37b525[_0x1f71('0x27')]({'plain':!![]});var _0x119666=_0x1f71('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x119666,'resourceId':_0x360cf2['id']}})[_0x1f71('0x25')](function(){return _0x37b525;});})[_0x1f71('0x25')](function(){_0x2fca9c[_0x1f71('0x1b')](0xcc)[_0x1f71('0x29')]();});}};}function handleEntityNotFound(_0x595696,_0x211ba4){return function(_0x2913fc){if(!_0x2913fc){_0x595696[_0x1f71('0x1a')](0x194);}return _0x2913fc;};}function handleError(_0x539373,_0x463939){_0x463939=_0x463939||0x1f4;return function(_0x561372){logger[_0x1f71('0x2a')](_0x561372['stack']);if(_0x561372[_0x1f71('0x2b')]){delete _0x561372['name'];}_0x539373[_0x1f71('0x1b')](_0x463939)['send'](_0x561372);};}exports['index']=function(_0x3dbe33,_0x14efb1){var _0x17e7a4={},_0x546e76={},_0x3c1791={'count':0x0,'rows':[]};var _0x25c8c2=_['map'](db[_0x1f71('0x2c')][_0x1f71('0x2d')],function(_0x2bc175){return{'name':_0x2bc175['fieldName'],'type':_0x2bc175[_0x1f71('0x2e')]['key']};});_0x546e76[_0x1f71('0x2f')]=_['map'](_0x25c8c2,_0x1f71('0x2b'));_0x546e76[_0x1f71('0x30')]=_[_0x1f71('0x31')](_0x3dbe33['query']);_0x546e76['filters']=_[_0x1f71('0x32')](_0x546e76[_0x1f71('0x2f')],_0x546e76[_0x1f71('0x30')]);_0x17e7a4[_0x1f71('0x33')]=_[_0x1f71('0x32')](_0x546e76[_0x1f71('0x2f')],qs[_0x1f71('0x34')](_0x3dbe33[_0x1f71('0x30')][_0x1f71('0x34')]));_0x17e7a4[_0x1f71('0x33')]=_0x17e7a4['attributes'][_0x1f71('0x35')]?_0x17e7a4['attributes']:_0x546e76['model'];if(!_0x3dbe33[_0x1f71('0x30')][_0x1f71('0x36')](_0x1f71('0x37'))){_0x17e7a4[_0x1f71('0x1e')]=qs[_0x1f71('0x1e')](_0x3dbe33[_0x1f71('0x30')]['limit']);_0x17e7a4[_0x1f71('0x1c')]=qs[_0x1f71('0x1c')](_0x3dbe33[_0x1f71('0x30')][_0x1f71('0x1c')]);}_0x17e7a4[_0x1f71('0x38')]=qs[_0x1f71('0x39')](_0x3dbe33[_0x1f71('0x30')][_0x1f71('0x39')]);_0x17e7a4['where']=qs[_0x1f71('0x3a')](_['pick'](_0x3dbe33[_0x1f71('0x30')],_0x546e76[_0x1f71('0x3a')]),_0x25c8c2);if(_0x3dbe33[_0x1f71('0x30')][_0x1f71('0x3b')]){_0x17e7a4[_0x1f71('0x3c')]=_[_0x1f71('0x3d')](_0x17e7a4[_0x1f71('0x3c')],{'$or':_['map'](_0x25c8c2,function(_0x4928d4){if(_0x4928d4['type']!=='VIRTUAL'){var _0x61a87d={};_0x61a87d[_0x4928d4[_0x1f71('0x2b')]]={'$like':'%'+_0x3dbe33[_0x1f71('0x30')][_0x1f71('0x3b')]+'%'};return _0x61a87d;}})});}_0x17e7a4=_[_0x1f71('0x3d')]({},_0x17e7a4,_0x3dbe33['options']);var _0x370823={'where':_0x17e7a4[_0x1f71('0x3c')]};return db[_0x1f71('0x2c')]['count'](_0x370823)[_0x1f71('0x25')](function(_0x505b79){_0x3c1791[_0x1f71('0x1f')]=_0x505b79;if(_0x3dbe33[_0x1f71('0x30')][_0x1f71('0x3e')]){_0x17e7a4[_0x1f71('0x3f')]=[{'all':!![]}];}return db[_0x1f71('0x2c')][_0x1f71('0x40')](_0x17e7a4);})['then'](function(_0x87b1a2){_0x3c1791[_0x1f71('0x41')]=_0x87b1a2;return _0x3c1791;})[_0x1f71('0x25')](respondWithFilteredResult(_0x14efb1,_0x17e7a4))['catch'](handleError(_0x14efb1,null));};exports[_0x1f71('0x42')]=function(_0x2e78c2,_0x4eee18){var _0x3dd20f={'raw':!![],'where':{'id':_0x2e78c2['params']['id']}},_0x438e9f={};_0x438e9f[_0x1f71('0x2f')]=_[_0x1f71('0x31')](db[_0x1f71('0x2c')][_0x1f71('0x2d')]);_0x438e9f['query']=_['keys'](_0x2e78c2[_0x1f71('0x30')]);_0x438e9f[_0x1f71('0x3a')]=_['intersection'](_0x438e9f[_0x1f71('0x2f')],_0x438e9f[_0x1f71('0x30')]);_0x3dd20f[_0x1f71('0x33')]=_['intersection'](_0x438e9f[_0x1f71('0x2f')],qs[_0x1f71('0x34')](_0x2e78c2[_0x1f71('0x30')][_0x1f71('0x34')]));_0x3dd20f['attributes']=_0x3dd20f['attributes'][_0x1f71('0x35')]?_0x3dd20f[_0x1f71('0x33')]:_0x438e9f['model'];if(_0x2e78c2[_0x1f71('0x30')][_0x1f71('0x3e')]){_0x3dd20f['include']=[{'all':!![]}];}_0x3dd20f=_[_0x1f71('0x3d')]({},_0x3dd20f,_0x2e78c2['options']);return db[_0x1f71('0x2c')][_0x1f71('0x43')](_0x3dd20f)['then'](handleEntityNotFound(_0x4eee18,null))[_0x1f71('0x25')](respondWithResult(_0x4eee18,null))['catch'](handleError(_0x4eee18,null));};exports['download']=function(_0x41bceb,_0x113ce9,_0x12063b){return db[_0x1f71('0x2c')][_0x1f71('0x43')]({'where':{'id':_0x41bceb['params']['id']},'attributes':[_0x1f71('0x2b'),'save_name',_0x1f71('0x44')],'raw':!![]})[_0x1f71('0x25')](handleEntityNotFound(_0x113ce9,null))['then'](function(_0x1b782b){if(_0x1b782b){if(!fs['existsSync'](path[_0x1f71('0x45')](config[_0x1f71('0x46')],_0x1f71('0x47'),_0x1b782b[_0x1f71('0x48')]+'.'+_0x1b782b['converted_format']))){throw new db[(_0x1f71('0x49'))]['ValidationError'](_0x1f71('0x4a'));}return _0x113ce9[_0x1f71('0x4b')](path[_0x1f71('0x45')](config[_0x1f71('0x46')],_0x1f71('0x47'),util[_0x1f71('0x4c')]('%s.%s',_0x1b782b['save_name'],_0x1b782b['converted_format'])),util[_0x1f71('0x4c')](_0x1f71('0x4d'),_0x1b782b[_0x1f71('0x2b')],_0x1b782b[_0x1f71('0x44')]));}return null;})['catch'](handleError(_0x113ce9,null));};exports[_0x1f71('0x4e')]=function(_0x4162e7,_0x40c368,_0x5b796f){var _0x13bf21={'name':path[_0x1f71('0x4f')](_0x4162e7[_0x1f71('0x50')][_0x1f71('0x51')],path['extname'](_0x4162e7[_0x1f71('0x50')][_0x1f71('0x51')])),'save_name':path[_0x1f71('0x4f')](_0x4162e7[_0x1f71('0x50')]['filename'],path['extname'](_0x4162e7[_0x1f71('0x50')]['filename'])),'original_format':path[_0x1f71('0x52')](_0x4162e7[_0x1f71('0x50')]['originalname'])[_0x1f71('0x53')](0x1),'converted_format':_0x1f71('0x54')};var _0x54337e=path[_0x1f71('0x45')](config[_0x1f71('0x46')],_0x1f71('0x55'),_0x4162e7[_0x1f71('0x50')][_0x1f71('0x56')]);var _0x1aca56=path[_0x1f71('0x45')](config[_0x1f71('0x46')],'server/files/sounds/converted',util[_0x1f71('0x4c')](_0x1f71('0x4d'),path[_0x1f71('0x4f')](_0x4162e7[_0x1f71('0x50')][_0x1f71('0x56')],path[_0x1f71('0x52')](_0x4162e7['file']['filename'])),_0x13bf21[_0x1f71('0x44')]));logger[_0x1f71('0x57')](_0x1f71('0x58'),_0x54337e);logger[_0x1f71('0x57')]('Sound\x20upload\x20destination:\x20%s',_0x1aca56);try{fs[_0x1f71('0x59')](_0x54337e,parseInt(_0x1f71('0x5a'),0x8));var _0x23f48e=sox[_0x1f71('0x5b')](_0x54337e,_0x1aca56,{'sampleRate':0x1f40,'format':_0x1f71('0x54'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x23f48e['on'](_0x1f71('0x2a'),function(_0x21537c){fs['unlinkSync'](_0x54337e);_0x40c368[_0x1f71('0x1b')](0x1f4)[_0x1f71('0x5c')](_0x21537c);});_0x23f48e['on'](_0x1f71('0x5d'),function(_0x52453a){_0x13bf21[_0x1f71('0x5e')]=isNaN(_0x52453a[_0x1f71('0x5f')])?null:_0x52453a['duration']*0x3e8;_0x13bf21['original_sampleCount']=isNaN(_0x52453a[_0x1f71('0x60')])?null:_0x52453a['sampleCount'];_0x13bf21['original_channelCount']=isNaN(_0x52453a['channelCount'])?null:_0x52453a[_0x1f71('0x61')];_0x13bf21[_0x1f71('0x62')]=isNaN(_0x52453a[_0x1f71('0x63')])?null:_0x52453a[_0x1f71('0x63')];_0x13bf21['original_sampleRate']=isNaN(_0x52453a[_0x1f71('0x64')])?null:_0x52453a[_0x1f71('0x64')];});_0x23f48e['on'](_0x1f71('0x65'),function(_0x241e6a){_0x13bf21[_0x1f71('0x66')]=isNaN(_0x241e6a[_0x1f71('0x5f')])?null:_0x241e6a[_0x1f71('0x5f')]*0x3e8;_0x13bf21[_0x1f71('0x67')]=isNaN(_0x241e6a[_0x1f71('0x60')])?null:_0x241e6a[_0x1f71('0x60')];_0x13bf21[_0x1f71('0x68')]=isNaN(_0x241e6a['channelCount'])?null:_0x241e6a[_0x1f71('0x61')];_0x13bf21['converted_bitRate']=isNaN(_0x241e6a[_0x1f71('0x63')])?null:_0x241e6a[_0x1f71('0x63')];_0x13bf21[_0x1f71('0x69')]=isNaN(_0x241e6a['sampleRate'])?null:_0x241e6a['sampleRate'];});_0x23f48e['on'](_0x1f71('0x29'),function(){fs[_0x1f71('0x59')](_0x1aca56,parseInt(_0x1f71('0x5a'),0x8));return db['Sound'][_0x1f71('0x4e')](_0x13bf21)[_0x1f71('0x25')](function(_0x28a4a8){var _0x1461fa={'role':_0x4162e7[_0x1f71('0x6a')]['role'],'userProfileId':_0x4162e7['body'][_0x1f71('0x6b')]};if(!_0x1461fa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1461fa['role']==='user'){var _0x4e22bc=_0x28a4a8[_0x1f71('0x27')]({'plain':!![]});return db[_0x1f71('0x6c')]['find']({'where':{'name':_0x1f71('0x28'),'userProfileId':_0x1461fa[_0x1f71('0x6b')]},'raw':!![]})[_0x1f71('0x25')](function(_0x2b37a0){if(_0x2b37a0&&_0x2b37a0[_0x1f71('0x6d')]===0x0){return db[_0x1f71('0x6e')][_0x1f71('0x4e')]({'name':_0x4e22bc['name'],'resourceId':_0x4e22bc['id'],'type':_0x2b37a0[_0x1f71('0x2b')],'sectionId':_0x2b37a0['id']},{})[_0x1f71('0x25')](function(){return _0x28a4a8;});}else{return _0x28a4a8;}})[_0x1f71('0x6f')](function(_0x5d1132){logger['error'](_0x1f71('0x70'),_0x5d1132);throw _0x5d1132;});}return _0x28a4a8;})[_0x1f71('0x25')](respondWithResult(_0x40c368,null))[_0x1f71('0x6f')](handleError(_0x40c368,null));});_0x23f48e[_0x1f71('0x71')]();}catch(_0x589055){_0x40c368[_0x1f71('0x1b')](0x1f4)[_0x1f71('0x5c')](_0x589055);}};exports[_0x1f71('0x24')]=function(_0x16e5e7,_0x33c8a6,_0x3a0bc2){return db['Sound']['find']({'where':{'id':_0x16e5e7[_0x1f71('0x72')]['id']}})[_0x1f71('0x25')](handleEntityNotFound(_0x33c8a6,null))[_0x1f71('0x25')](saveUpdates(_[_0x1f71('0x73')](_0x16e5e7[_0x1f71('0x6a')],[_0x1f71('0x2b'),_0x1f71('0x74')]),null))[_0x1f71('0x25')](respondWithResult(_0x33c8a6,null))[_0x1f71('0x6f')](handleError(_0x33c8a6,null));};exports[_0x1f71('0x75')]=function(_0x3ee492,_0x47122d,_0x4678e0){return db[_0x1f71('0x2c')][_0x1f71('0x43')]({'where':{'id':_0x3ee492[_0x1f71('0x72')]['id']}})['then'](function(_0x13dc2b){if(_0x13dc2b){return _0x13dc2b[_0x1f71('0x26')]();}})[_0x1f71('0x25')](function(_0x5565f1){var _0x4c798a=path[_0x1f71('0x45')](config['root'],_0x1f71('0x55'),util[_0x1f71('0x4c')](_0x1f71('0x4d'),_0x5565f1['save_name'],_0x5565f1[_0x1f71('0x76')]));var _0x3ac86d=path[_0x1f71('0x45')](config[_0x1f71('0x46')],_0x1f71('0x47'),util[_0x1f71('0x4c')](_0x1f71('0x4d'),_0x5565f1[_0x1f71('0x48')],_0x5565f1[_0x1f71('0x44')]));fs['unlinkSync'](_0x4c798a);fs[_0x1f71('0x77')](_0x3ac86d);return _0x5565f1;})[_0x1f71('0x25')](function(_0xba22cc){if(_0xba22cc){return _0x47122d[_0x1f71('0x1b')](0xcc)[_0x1f71('0x29')]();}})[_0x1f71('0x25')](handleEntityNotFound(_0x47122d,null))['catch'](handleError(_0x47122d,null));}; \ No newline at end of file +var _0x5812=['Sound\x20upload\x20destination:\x20%s','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_sampleRate','body','role','userProfileId','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','description','delete','server/files/sounds/original','original_format','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','get','Sounds','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','sort','where','filters','VIRTUAL','filter','merge','options','Sound','includeAll','include','rows','show','params','length','find','catch','save_name','existsSync','join','root','server/files/sounds/converted','converted_format','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5812,0x97));var _0x2581=function(_0x40d4ce,_0x4d1dfd){_0x40d4ce=_0x40d4ce-0x0;var _0x397cb8=_0x5812[_0x40d4ce];return _0x397cb8;};'use strict';var emlformat=require(_0x2581('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2581('0x1'));var jsonpatch=require(_0x2581('0x2'));var rp=require(_0x2581('0x3'));var moment=require(_0x2581('0x4'));var BPromise=require(_0x2581('0x5'));var Mustache=require(_0x2581('0x6'));var util=require(_0x2581('0x7'));var path=require(_0x2581('0x8'));var sox=require('sox');var csv=require(_0x2581('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2581('0xa'));var _=require(_0x2581('0xb'));var squel=require('squel');var crypto=require(_0x2581('0xc'));var jsforce=require(_0x2581('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2581('0x9'));var querystring=require(_0x2581('0xe'));var Papa=require('papaparse');var Redis=require(_0x2581('0xf'));var authService=require(_0x2581('0x10'));var qs=require(_0x2581('0x11'));var as=require(_0x2581('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2581('0x13'))(_0x2581('0x14'));var utils=require(_0x2581('0x15'));var config=require(_0x2581('0x16'));var licenseUtil=require(_0x2581('0x17'));var db=require(_0x2581('0x18'))['db'];function respondWithStatusCode(_0x5db356,_0x5350ff){_0x5350ff=_0x5350ff||0xcc;return function(_0xa6b12f){if(_0xa6b12f){return _0x5db356[_0x2581('0x19')](_0x5350ff);}return _0x5db356[_0x2581('0x1a')](_0x5350ff)[_0x2581('0x1b')]();};}function respondWithResult(_0x4a81d6,_0x77b9a9){_0x77b9a9=_0x77b9a9||0xc8;return function(_0x33b3af){if(_0x33b3af){return _0x4a81d6['status'](_0x77b9a9)[_0x2581('0x1c')](_0x33b3af);}};}function respondWithFilteredResult(_0x2acaa1,_0x4ca4eb){return function(_0x4dd95f){if(_0x4dd95f){var _0x33ca63=typeof _0x4ca4eb['offset']===_0x2581('0x1d')&&typeof _0x4ca4eb[_0x2581('0x1e')]===_0x2581('0x1d');var _0x8c9826=_0x4dd95f[_0x2581('0x1f')];var _0x4e1037=_0x33ca63?0x0:_0x4ca4eb['offset'];var _0x1d3b45=_0x33ca63?_0x4dd95f['count']:_0x4ca4eb[_0x2581('0x20')]+_0x4ca4eb['limit'];var _0x145326;if(_0x1d3b45>=_0x8c9826){_0x1d3b45=_0x8c9826;_0x145326=0xc8;}else{_0x145326=0xce;}_0x2acaa1[_0x2581('0x1a')](_0x145326);return _0x2acaa1[_0x2581('0x21')](_0x2581('0x22'),_0x4e1037+'-'+_0x1d3b45+'/'+_0x8c9826)[_0x2581('0x1c')](_0x4dd95f);}return null;};}function patchUpdates(_0x2af038){return function(_0x2cec81){try{jsonpatch['apply'](_0x2cec81,_0x2af038,!![]);}catch(_0x1a7cf6){return BPromise[_0x2581('0x23')](_0x1a7cf6);}return _0x2cec81[_0x2581('0x24')]();};}function saveUpdates(_0x3d0438,_0x32bf65){return function(_0x3b3901){if(_0x3b3901){return _0x3b3901[_0x2581('0x25')](_0x3d0438)[_0x2581('0x26')](function(_0x39037e){return _0x39037e;});}return null;};}function removeEntity(_0x4cefb7,_0x2eb5ed){return function(_0x41408d){if(_0x41408d){return _0x41408d[_0x2581('0x27')]()['then'](function(){var _0x269b46=_0x41408d[_0x2581('0x28')]({'plain':!![]});var _0x5471e3=_0x2581('0x29');return db['UserProfileResource'][_0x2581('0x27')]({'where':{'type':_0x5471e3,'resourceId':_0x269b46['id']}})['then'](function(){return _0x41408d;});})[_0x2581('0x26')](function(){_0x4cefb7['status'](0xcc)[_0x2581('0x1b')]();});}};}function handleEntityNotFound(_0x1b9b87,_0x32e753){return function(_0x5cde96){if(!_0x5cde96){_0x1b9b87[_0x2581('0x19')](0x194);}return _0x5cde96;};}function handleError(_0x313be4,_0x4becf1){_0x4becf1=_0x4becf1||0x1f4;return function(_0x2fe34b){logger[_0x2581('0x2a')](_0x2fe34b[_0x2581('0x2b')]);if(_0x2fe34b[_0x2581('0x2c')]){delete _0x2fe34b[_0x2581('0x2c')];}_0x313be4[_0x2581('0x1a')](_0x4becf1)[_0x2581('0x2d')](_0x2fe34b);};}exports[_0x2581('0x2e')]=function(_0x333c5e,_0x4213a){var _0x3a6d8b={},_0x4c61b9={},_0x239e12={'count':0x0,'rows':[]};var _0x564357=_[_0x2581('0x2f')](db['Sound'][_0x2581('0x30')],function(_0x637345){return{'name':_0x637345[_0x2581('0x31')],'type':_0x637345[_0x2581('0x32')][_0x2581('0x33')]};});_0x4c61b9[_0x2581('0x34')]=_[_0x2581('0x2f')](_0x564357,_0x2581('0x2c'));_0x4c61b9['query']=_[_0x2581('0x35')](_0x333c5e[_0x2581('0x36')]);_0x4c61b9['filters']=_[_0x2581('0x37')](_0x4c61b9[_0x2581('0x34')],_0x4c61b9[_0x2581('0x36')]);_0x3a6d8b[_0x2581('0x38')]=_['intersection'](_0x4c61b9[_0x2581('0x34')],qs[_0x2581('0x39')](_0x333c5e[_0x2581('0x36')][_0x2581('0x39')]));_0x3a6d8b['attributes']=_0x3a6d8b['attributes']['length']?_0x3a6d8b[_0x2581('0x38')]:_0x4c61b9[_0x2581('0x34')];if(!_0x333c5e[_0x2581('0x36')][_0x2581('0x3a')]('nolimit')){_0x3a6d8b[_0x2581('0x1e')]=qs['limit'](_0x333c5e[_0x2581('0x36')][_0x2581('0x1e')]);_0x3a6d8b[_0x2581('0x20')]=qs[_0x2581('0x20')](_0x333c5e[_0x2581('0x36')][_0x2581('0x20')]);}_0x3a6d8b['order']=qs[_0x2581('0x3b')](_0x333c5e[_0x2581('0x36')][_0x2581('0x3b')]);_0x3a6d8b[_0x2581('0x3c')]=qs[_0x2581('0x3d')](_['pick'](_0x333c5e[_0x2581('0x36')],_0x4c61b9[_0x2581('0x3d')]),_0x564357);if(_0x333c5e['query']['filter']){_0x3a6d8b[_0x2581('0x3c')]=_['merge'](_0x3a6d8b[_0x2581('0x3c')],{'$or':_[_0x2581('0x2f')](_0x564357,function(_0x4fdecc){if(_0x4fdecc[_0x2581('0x32')]!==_0x2581('0x3e')){var _0x2a7cdc={};_0x2a7cdc[_0x4fdecc[_0x2581('0x2c')]]={'$like':'%'+_0x333c5e[_0x2581('0x36')][_0x2581('0x3f')]+'%'};return _0x2a7cdc;}})});}_0x3a6d8b=_[_0x2581('0x40')]({},_0x3a6d8b,_0x333c5e[_0x2581('0x41')]);var _0x3101f6={'where':_0x3a6d8b['where']};return db[_0x2581('0x42')][_0x2581('0x1f')](_0x3101f6)[_0x2581('0x26')](function(_0x14b00f){_0x239e12[_0x2581('0x1f')]=_0x14b00f;if(_0x333c5e[_0x2581('0x36')][_0x2581('0x43')]){_0x3a6d8b[_0x2581('0x44')]=[{'all':!![]}];}return db[_0x2581('0x42')]['findAll'](_0x3a6d8b);})[_0x2581('0x26')](function(_0xd6cd0c){_0x239e12[_0x2581('0x45')]=_0xd6cd0c;return _0x239e12;})[_0x2581('0x26')](respondWithFilteredResult(_0x4213a,_0x3a6d8b))['catch'](handleError(_0x4213a,null));};exports[_0x2581('0x46')]=function(_0x2d87c1,_0x358b80){var _0x518aab={'raw':!![],'where':{'id':_0x2d87c1[_0x2581('0x47')]['id']}},_0x23dd8f={};_0x23dd8f[_0x2581('0x34')]=_[_0x2581('0x35')](db[_0x2581('0x42')]['rawAttributes']);_0x23dd8f[_0x2581('0x36')]=_[_0x2581('0x35')](_0x2d87c1[_0x2581('0x36')]);_0x23dd8f[_0x2581('0x3d')]=_['intersection'](_0x23dd8f[_0x2581('0x34')],_0x23dd8f['query']);_0x518aab[_0x2581('0x38')]=_[_0x2581('0x37')](_0x23dd8f[_0x2581('0x34')],qs['fields'](_0x2d87c1[_0x2581('0x36')][_0x2581('0x39')]));_0x518aab['attributes']=_0x518aab[_0x2581('0x38')][_0x2581('0x48')]?_0x518aab[_0x2581('0x38')]:_0x23dd8f[_0x2581('0x34')];if(_0x2d87c1[_0x2581('0x36')][_0x2581('0x43')]){_0x518aab[_0x2581('0x44')]=[{'all':!![]}];}_0x518aab=_[_0x2581('0x40')]({},_0x518aab,_0x2d87c1[_0x2581('0x41')]);return db[_0x2581('0x42')][_0x2581('0x49')](_0x518aab)[_0x2581('0x26')](handleEntityNotFound(_0x358b80,null))[_0x2581('0x26')](respondWithResult(_0x358b80,null))[_0x2581('0x4a')](handleError(_0x358b80,null));};exports['download']=function(_0x24571,_0x44d92e,_0x5c25a6){return db[_0x2581('0x42')]['find']({'where':{'id':_0x24571['params']['id']},'attributes':[_0x2581('0x2c'),_0x2581('0x4b'),'converted_format'],'raw':!![]})[_0x2581('0x26')](handleEntityNotFound(_0x44d92e,null))[_0x2581('0x26')](function(_0xd504ad){if(_0xd504ad){if(!fs[_0x2581('0x4c')](path[_0x2581('0x4d')](config[_0x2581('0x4e')],_0x2581('0x4f'),_0xd504ad[_0x2581('0x4b')]+'.'+_0xd504ad[_0x2581('0x50')]))){throw new db[(_0x2581('0x51'))][(_0x2581('0x52'))](_0x2581('0x53'));}return _0x44d92e['download'](path[_0x2581('0x4d')](config['root'],_0x2581('0x4f'),util[_0x2581('0x54')]('%s.%s',_0xd504ad[_0x2581('0x4b')],_0xd504ad[_0x2581('0x50')])),util[_0x2581('0x54')](_0x2581('0x55'),_0xd504ad['name'],_0xd504ad[_0x2581('0x50')]));}return null;})[_0x2581('0x4a')](handleError(_0x44d92e,null));};exports[_0x2581('0x56')]=function(_0x5a78bf,_0x1c5895,_0x44b8c0){var _0x35eb90={'name':path[_0x2581('0x57')](_0x5a78bf[_0x2581('0x58')][_0x2581('0x59')],path[_0x2581('0x5a')](_0x5a78bf[_0x2581('0x58')][_0x2581('0x59')])),'save_name':path[_0x2581('0x57')](_0x5a78bf['file'][_0x2581('0x5b')],path[_0x2581('0x5a')](_0x5a78bf[_0x2581('0x58')][_0x2581('0x5b')])),'original_format':path[_0x2581('0x5a')](_0x5a78bf[_0x2581('0x58')][_0x2581('0x59')])[_0x2581('0x5c')](0x1),'converted_format':_0x2581('0x5d')};var _0x62b4d7=path[_0x2581('0x4d')](config['root'],'server/files/sounds/original',_0x5a78bf['file'][_0x2581('0x5b')]);var _0x39b741=path[_0x2581('0x4d')](config[_0x2581('0x4e')],_0x2581('0x4f'),util['format']('%s.%s',path[_0x2581('0x57')](_0x5a78bf[_0x2581('0x58')]['filename'],path['extname'](_0x5a78bf[_0x2581('0x58')][_0x2581('0x5b')])),_0x35eb90[_0x2581('0x50')]));logger[_0x2581('0x5e')]('Sound\x20upload\x20filepath:\x20%s',_0x62b4d7);logger[_0x2581('0x5e')](_0x2581('0x5f'),_0x39b741);try{fs['chmodSync'](_0x62b4d7,parseInt('0777',0x8));var _0x1a145c=sox['transcode'](_0x62b4d7,_0x39b741,{'sampleRate':0x1f40,'format':_0x2581('0x5d'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1a145c['on']('error',function(_0x47da51){fs['unlinkSync'](_0x62b4d7);_0x1c5895[_0x2581('0x1a')](0x1f4)[_0x2581('0x2d')](_0x47da51);});_0x1a145c['on'](_0x2581('0x60'),function(_0x52dbc9){_0x35eb90['original_duration']=isNaN(_0x52dbc9[_0x2581('0x61')])?null:_0x52dbc9[_0x2581('0x61')]*0x3e8;_0x35eb90[_0x2581('0x62')]=isNaN(_0x52dbc9['sampleCount'])?null:_0x52dbc9[_0x2581('0x63')];_0x35eb90[_0x2581('0x64')]=isNaN(_0x52dbc9[_0x2581('0x65')])?null:_0x52dbc9[_0x2581('0x65')];_0x35eb90['original_bitRate']=isNaN(_0x52dbc9[_0x2581('0x66')])?null:_0x52dbc9[_0x2581('0x66')];_0x35eb90[_0x2581('0x67')]=isNaN(_0x52dbc9[_0x2581('0x68')])?null:_0x52dbc9['sampleRate'];});_0x1a145c['on']('dest',function(_0x43f9ac){_0x35eb90[_0x2581('0x69')]=isNaN(_0x43f9ac[_0x2581('0x61')])?null:_0x43f9ac[_0x2581('0x61')]*0x3e8;_0x35eb90[_0x2581('0x6a')]=isNaN(_0x43f9ac[_0x2581('0x63')])?null:_0x43f9ac['sampleCount'];_0x35eb90['converted_channelCount']=isNaN(_0x43f9ac[_0x2581('0x65')])?null:_0x43f9ac['channelCount'];_0x35eb90['converted_bitRate']=isNaN(_0x43f9ac[_0x2581('0x66')])?null:_0x43f9ac['bitRate'];_0x35eb90[_0x2581('0x6b')]=isNaN(_0x43f9ac['sampleRate'])?null:_0x43f9ac[_0x2581('0x68')];});_0x1a145c['on'](_0x2581('0x1b'),function(){fs['chmodSync'](_0x39b741,parseInt('0777',0x8));return db[_0x2581('0x42')][_0x2581('0x56')](_0x35eb90)['then'](function(_0x563e33){var _0x27b595={'role':_0x5a78bf[_0x2581('0x6c')][_0x2581('0x6d')],'userProfileId':_0x5a78bf['body'][_0x2581('0x6e')]};if(!_0x27b595)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x27b595['role']===_0x2581('0x6f')){var _0x494f53=_0x563e33[_0x2581('0x28')]({'plain':!![]});return db[_0x2581('0x70')][_0x2581('0x49')]({'where':{'name':_0x2581('0x29'),'userProfileId':_0x27b595[_0x2581('0x6e')]},'raw':!![]})[_0x2581('0x26')](function(_0x4799cc){if(_0x4799cc&&_0x4799cc[_0x2581('0x71')]===0x0){return db[_0x2581('0x72')][_0x2581('0x56')]({'name':_0x494f53[_0x2581('0x2c')],'resourceId':_0x494f53['id'],'type':_0x4799cc[_0x2581('0x2c')],'sectionId':_0x4799cc['id']},{})[_0x2581('0x26')](function(){return _0x563e33;});}else{return _0x563e33;}})[_0x2581('0x4a')](function(_0x22dd85){logger[_0x2581('0x2a')](_0x2581('0x73'),_0x22dd85);throw _0x22dd85;});}return _0x563e33;})[_0x2581('0x26')](respondWithResult(_0x1c5895,null))['catch'](handleError(_0x1c5895,null));});_0x1a145c[_0x2581('0x74')]();}catch(_0xea51b6){_0x1c5895[_0x2581('0x1a')](0x1f4)[_0x2581('0x2d')](_0xea51b6);}};exports[_0x2581('0x25')]=function(_0xe5ebbf,_0x15b550,_0x36d61e){return db[_0x2581('0x42')]['find']({'where':{'id':_0xe5ebbf['params']['id']}})[_0x2581('0x26')](handleEntityNotFound(_0x15b550,null))[_0x2581('0x26')](saveUpdates(_[_0x2581('0x75')](_0xe5ebbf[_0x2581('0x6c')],[_0x2581('0x2c'),_0x2581('0x76')]),null))['then'](respondWithResult(_0x15b550,null))['catch'](handleError(_0x15b550,null));};exports[_0x2581('0x77')]=function(_0x3c735d,_0x50e453,_0x3d05ba){return db['Sound'][_0x2581('0x49')]({'where':{'id':_0x3c735d[_0x2581('0x47')]['id']}})['then'](function(_0x33a899){if(_0x33a899){return _0x33a899[_0x2581('0x27')]();}})[_0x2581('0x26')](function(_0x253401){var _0x4c5e7a=path[_0x2581('0x4d')](config['root'],_0x2581('0x78'),util['format'](_0x2581('0x55'),_0x253401[_0x2581('0x4b')],_0x253401[_0x2581('0x79')]));var _0x565b00=path[_0x2581('0x4d')](config[_0x2581('0x4e')],_0x2581('0x4f'),util['format'](_0x2581('0x55'),_0x253401[_0x2581('0x4b')],_0x253401[_0x2581('0x50')]));fs[_0x2581('0x7a')](_0x4c5e7a);fs[_0x2581('0x7a')](_0x565b00);return _0x253401;})[_0x2581('0x26')](function(_0x4d3cd0){if(_0x4d3cd0){return _0x50e453[_0x2581('0x1a')](0xcc)[_0x2581('0x1b')]();}})[_0x2581('0x26')](handleEntityNotFound(_0x50e453,null))[_0x2581('0x4a')](handleError(_0x50e453,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 695435e..0a801d1 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 _0x9d34=['../../config/environment','exports','define','Sound','tools_sounds','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4a93bb,_0x495404){var _0x208468=function(_0x1d82b7){while(--_0x1d82b7){_0x4a93bb['push'](_0x4a93bb['shift']());}};_0x208468(++_0x495404);}(_0x9d34,0xdd));var _0x49d3=function(_0x5e3e02,_0x197125){_0x5e3e02=_0x5e3e02-0x0;var _0x5c0f2f=_0x9d34[_0x5e3e02];return _0x5c0f2f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49d3('0x0'))(_0x49d3('0x1'));var moment=require(_0x49d3('0x2'));var BPromise=require(_0x49d3('0x3'));var rp=require(_0x49d3('0x4'));var fs=require('fs');var path=require(_0x49d3('0x5'));var rimraf=require(_0x49d3('0x6'));var config=require(_0x49d3('0x7'));var attributes=require('./sound.attributes');module[_0x49d3('0x8')]=function(_0x29c91f,_0x5c9219){return _0x29c91f[_0x49d3('0x9')](_0x49d3('0xa'),attributes,{'tableName':_0x49d3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc6a3=['define','tools_sounds','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports'];(function(_0x43fc41,_0x5bd95f){var _0x4a7c2b=function(_0x3dd08c){while(--_0x3dd08c){_0x43fc41['push'](_0x43fc41['shift']());}};_0x4a7c2b(++_0x5bd95f);}(_0xc6a3,0xb6));var _0x3c6a=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xc6a3[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x3c6a('0x0'));var util=require('util');var logger=require(_0x3c6a('0x1'))(_0x3c6a('0x2'));var moment=require(_0x3c6a('0x3'));var BPromise=require('bluebird');var rp=require(_0x3c6a('0x4'));var fs=require('fs');var path=require(_0x3c6a('0x5'));var rimraf=require(_0x3c6a('0x6'));var config=require(_0x3c6a('0x7'));var attributes=require(_0x3c6a('0x8'));module[_0x3c6a('0x9')]=function(_0x20984e,_0x164633){return _0x20984e[_0x3c6a('0xa')]('Sound',attributes,{'tableName':_0x3c6a('0xb'),'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 3ec44b8..1fc9332 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 _0xfd73=['info','ShowSound','stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message','catch','Sound','options','raw','include','map','model','attributes'];(function(_0x146b3f,_0x16d955){var _0xe63804=function(_0x1e41f4){while(--_0x1e41f4){_0x146b3f['push'](_0x146b3f['shift']());}};_0xe63804(++_0x16d955);}(_0xfd73,0x12f));var _0x3fd7=function(_0x2bc7ca,_0x347fc8){_0x2bc7ca=_0x2bc7ca-0x0;var _0x439626=_0xfd73[_0x2bc7ca];return _0x439626;};'use strict';var _=require(_0x3fd7('0x0'));var util=require(_0x3fd7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3fd7('0x2'));var fs=require('fs');var Redis=require(_0x3fd7('0x3'));var db=require(_0x3fd7('0x4'))['db'];var utils=require(_0x3fd7('0x5'));var logger=require('../../config/logger')(_0x3fd7('0x6'));var config=require('../../config/environment');var jayson=require(_0x3fd7('0x7'));var client=jayson[_0x3fd7('0x8')][_0x3fd7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b56c6,_0x513374,_0x554316){return new BPromise(function(_0x30504c,_0x4bf259){return client[_0x3fd7('0xa')](_0x5b56c6,_0x554316)[_0x3fd7('0xb')](function(_0x4f33d6){logger['info'](_0x3fd7('0xc'),_0x513374,_0x3fd7('0xd'));logger[_0x3fd7('0xe')](_0x3fd7('0xf'),_0x513374,_0x3fd7('0xd'),JSON['stringify'](_0x4f33d6));if(_0x4f33d6[_0x3fd7('0x10')]){if(_0x4f33d6[_0x3fd7('0x10')][_0x3fd7('0x11')]===0x1f4){logger['error'](_0x3fd7('0xc'),_0x513374,_0x4f33d6['error'][_0x3fd7('0x12')]);return _0x4bf259(_0x4f33d6['error']['message']);}logger['error'](_0x3fd7('0xc'),_0x513374,_0x4f33d6[_0x3fd7('0x10')][_0x3fd7('0x12')]);return _0x30504c(_0x4f33d6['error'][_0x3fd7('0x12')]);}else{logger['info']('Sound,\x20%s,\x20%s',_0x513374,'request\x20sent');_0x30504c(_0x4f33d6['result'][_0x3fd7('0x12')]);}})[_0x3fd7('0x13')](function(_0x1cc3ea){logger[_0x3fd7('0x10')](_0x3fd7('0xc'),_0x513374,_0x1cc3ea);_0x4bf259(_0x1cc3ea);});});}exports['ShowSound']=function(_0x1a8a73){var _0x4e2c2d=this;return new Promise(function(_0x235f40,_0x2af37a){return db[_0x3fd7('0x14')]['find']({'raw':_0x1a8a73[_0x3fd7('0x15')]?_0x1a8a73[_0x3fd7('0x15')][_0x3fd7('0x16')]===undefined?!![]:![]:!![],'where':_0x1a8a73['options']?_0x1a8a73[_0x3fd7('0x15')]['where']||null:null,'attributes':_0x1a8a73['options']?_0x1a8a73[_0x3fd7('0x15')]['attributes']||null:null,'include':_0x1a8a73[_0x3fd7('0x15')]?_0x1a8a73['options'][_0x3fd7('0x17')]?_[_0x3fd7('0x18')](_0x1a8a73[_0x3fd7('0x15')][_0x3fd7('0x17')],function(_0x585c6b){return{'model':db[_0x585c6b[_0x3fd7('0x19')]],'as':_0x585c6b['as'],'attributes':_0x585c6b[_0x3fd7('0x1a')],'include':_0x585c6b[_0x3fd7('0x17')]?_[_0x3fd7('0x18')](_0x585c6b[_0x3fd7('0x17')],function(_0x526a80){return{'model':db[_0x526a80['model']],'as':_0x526a80['as'],'attributes':_0x526a80[_0x3fd7('0x1a')],'include':_0x526a80[_0x3fd7('0x17')]?_['map'](_0x526a80['include'],function(_0x28cc3e){return{'model':db[_0x28cc3e['model']],'as':_0x28cc3e['as'],'attributes':_0x28cc3e[_0x3fd7('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x39c45){logger[_0x3fd7('0x1b')](_0x3fd7('0x1c'),_0x1a8a73);logger[_0x3fd7('0xe')](_0x3fd7('0x1c'),_0x1a8a73,JSON[_0x3fd7('0x1d')](_0x39c45));_0x235f40(_0x39c45);})[_0x3fd7('0x13')](function(_0x568c2a){logger['error'](_0x3fd7('0x1c'),_0x568c2a[_0x3fd7('0x12')],_0x1a8a73);_0x2af37a(_0x4e2c2d[_0x3fd7('0x10')](0x1f4,_0x568c2a[_0x3fd7('0x12')]));});});}; \ No newline at end of file +var _0xb3cd=['message','result','catch','ShowSound','Sound','find','options','raw','where','attributes','map','model','include','stringify','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x4c125a,_0x582c7c){var _0xd7a9a1=function(_0x104428){while(--_0x104428){_0x4c125a['push'](_0x4c125a['shift']());}};_0xd7a9a1(++_0x582c7c);}(_0xb3cd,0x1ee));var _0xdb3c=function(_0x1283d4,_0x36b6f1){_0x1283d4=_0x1283d4-0x0;var _0x433643=_0xb3cd[_0x1283d4];return _0x433643;};'use strict';var _=require(_0xdb3c('0x0'));var util=require(_0xdb3c('0x1'));var moment=require(_0xdb3c('0x2'));var BPromise=require(_0xdb3c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdb3c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdb3c('0x5'));var logger=require(_0xdb3c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdb3c('0x7'));var client=jayson[_0xdb3c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3cc2ec,_0x12fb94,_0x15dca0){return new BPromise(function(_0x46a59f,_0x273983){return client[_0xdb3c('0x9')](_0x3cc2ec,_0x15dca0)[_0xdb3c('0xa')](function(_0x8723ae){logger[_0xdb3c('0xb')](_0xdb3c('0xc'),_0x12fb94,_0xdb3c('0xd'));logger[_0xdb3c('0xe')](_0xdb3c('0xf'),_0x12fb94,_0xdb3c('0xd'),JSON['stringify'](_0x8723ae));if(_0x8723ae[_0xdb3c('0x10')]){if(_0x8723ae[_0xdb3c('0x10')][_0xdb3c('0x11')]===0x1f4){logger[_0xdb3c('0x10')](_0xdb3c('0xc'),_0x12fb94,_0x8723ae['error'][_0xdb3c('0x12')]);return _0x273983(_0x8723ae[_0xdb3c('0x10')][_0xdb3c('0x12')]);}logger[_0xdb3c('0x10')](_0xdb3c('0xc'),_0x12fb94,_0x8723ae['error'][_0xdb3c('0x12')]);return _0x46a59f(_0x8723ae[_0xdb3c('0x10')][_0xdb3c('0x12')]);}else{logger[_0xdb3c('0xb')]('Sound,\x20%s,\x20%s',_0x12fb94,_0xdb3c('0xd'));_0x46a59f(_0x8723ae[_0xdb3c('0x13')]['message']);}})[_0xdb3c('0x14')](function(_0x3f5f05){logger[_0xdb3c('0x10')](_0xdb3c('0xc'),_0x12fb94,_0x3f5f05);_0x273983(_0x3f5f05);});});}exports[_0xdb3c('0x15')]=function(_0x41c5ba){var _0x18c512=this;return new Promise(function(_0x3ee664,_0xfeac18){return db[_0xdb3c('0x16')][_0xdb3c('0x17')]({'raw':_0x41c5ba[_0xdb3c('0x18')]?_0x41c5ba['options'][_0xdb3c('0x19')]===undefined?!![]:![]:!![],'where':_0x41c5ba[_0xdb3c('0x18')]?_0x41c5ba[_0xdb3c('0x18')][_0xdb3c('0x1a')]||null:null,'attributes':_0x41c5ba[_0xdb3c('0x18')]?_0x41c5ba[_0xdb3c('0x18')][_0xdb3c('0x1b')]||null:null,'include':_0x41c5ba[_0xdb3c('0x18')]?_0x41c5ba[_0xdb3c('0x18')]['include']?_[_0xdb3c('0x1c')](_0x41c5ba['options']['include'],function(_0xb9e43f){return{'model':db[_0xb9e43f[_0xdb3c('0x1d')]],'as':_0xb9e43f['as'],'attributes':_0xb9e43f[_0xdb3c('0x1b')],'include':_0xb9e43f['include']?_[_0xdb3c('0x1c')](_0xb9e43f[_0xdb3c('0x1e')],function(_0x32a975){return{'model':db[_0x32a975['model']],'as':_0x32a975['as'],'attributes':_0x32a975['attributes'],'include':_0x32a975['include']?_[_0xdb3c('0x1c')](_0x32a975[_0xdb3c('0x1e')],function(_0x36df5a){return{'model':db[_0x36df5a[_0xdb3c('0x1d')]],'as':_0x36df5a['as'],'attributes':_0x36df5a[_0xdb3c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xdb3c('0xa')](function(_0x405a11){logger[_0xdb3c('0xb')](_0xdb3c('0x15'),_0x41c5ba);logger[_0xdb3c('0xe')](_0xdb3c('0x15'),_0x41c5ba,JSON[_0xdb3c('0x1f')](_0x405a11));_0x3ee664(_0x405a11);})[_0xdb3c('0x14')](function(_0x3cc230){logger[_0xdb3c('0x10')]('ShowSound',_0x3cc230['message'],_0x41c5ba);_0xfeac18(_0x18c512['error'](0x1f4,_0x3cc230[_0xdb3c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 99b10ed..40584fa 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 _0xd8b0=['update','delete','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','create','put','/:id'];(function(_0x471f28,_0xdc23f0){var _0x3929a1=function(_0x206ef2){while(--_0x206ef2){_0x471f28['push'](_0x471f28['shift']());}};_0x3929a1(++_0xdc23f0);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['post']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xb')]);router[_0x0d8b('0xc')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xd'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);module['exports']=router; \ No newline at end of file +var _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0x3a6a94,_0x247217){var _0x169489=function(_0x4d9f82){while(--_0x4d9f82){_0x3a6a94['push'](_0x3a6a94['shift']());}};_0x169489(++_0x247217);}(_0x5eb8,0xb0));var _0x85eb=function(_0x17045c,_0x470ebe){_0x17045c=_0x17045c-0x0;var _0x844ac5=_0x5eb8[_0x17045c];return _0x844ac5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['post']('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0xe')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xf')]);router[_0x85eb('0x10')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['destroy']);module[_0x85eb('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index c55b572..afaacd6 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 _0x551e=['sequelize','TEXT','ENUM','out','STRING'];(function(_0x239904,_0x4b11e2){var _0x259609=function(_0x41d52a){while(--_0x41d52a){_0x239904['push'](_0x239904['shift']());}};_0x259609(++_0x4b11e2);}(_0x551e,0xfa));var _0xe551=function(_0x1f5def,_0xe3fd5a){_0x1f5def=_0x1f5def-0x0;var _0x33fe86=_0x551e[_0x1f5def];return _0x33fe86;};'use strict';var Sequelize=require(_0xe551('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xe551('0x1')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xe551('0x2')]('in',_0xe551('0x3')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0xe551('0x4')]},'providerResponse':{'type':Sequelize[_0xe551('0x1')]}}; \ No newline at end of file +var _0x2a6e=['out','STRING','TEXT','medium','ENUM'];(function(_0x2d0ef5,_0x5621a4){var _0x550979=function(_0x23d4c7){while(--_0x23d4c7){_0x2d0ef5['push'](_0x2d0ef5['shift']());}};_0x550979(++_0x5621a4);}(_0x2a6e,0x7e));var _0xe2a6=function(_0x12dbec,_0x39f62b){_0x12dbec=_0x12dbec-0x0;var _0x38168e=_0x2a6e[_0x12dbec];return _0x38168e;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xe2a6('0x0')]},'body':{'type':Sequelize[_0xe2a6('0x1')](_0xe2a6('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0xe2a6('0x3')]('in',_0xe2a6('0x4')),'defaultValue':_0xe2a6('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0xe2a6('0x0')]},'providerResponse':{'type':Sequelize[_0xe2a6('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 1f9eb0b..017b1a0 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 _0xb072=['../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','undefined','offset','limit','set','save','update','then','error','stack','name','send','index','SquareMessage','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0xb072,0x1a7));var _0x2b07=function(_0x853839,_0x59c7be){_0x853839=_0x853839-0x0;var _0x5218cf=_0xb072[_0x853839];return _0x5218cf;};'use strict';var emlformat=require(_0x2b07('0x0'));var rimraf=require(_0x2b07('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2b07('0x2'));var rp=require(_0x2b07('0x3'));var moment=require(_0x2b07('0x4'));var BPromise=require(_0x2b07('0x5'));var Mustache=require(_0x2b07('0x6'));var util=require(_0x2b07('0x7'));var path=require(_0x2b07('0x8'));var sox=require(_0x2b07('0x9'));var csv=require(_0x2b07('0xa'));var ejs=require(_0x2b07('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2b07('0xc'));var squel=require(_0x2b07('0xd'));var crypto=require('crypto');var jsforce=require(_0x2b07('0xe'));var deskjs=require(_0x2b07('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2b07('0x10'));var Papa=require(_0x2b07('0x11'));var Redis=require(_0x2b07('0x12'));var authService=require(_0x2b07('0x13'));var qs=require(_0x2b07('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b07('0x15'))(_0x2b07('0x16'));var utils=require(_0x2b07('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2b07('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x276354,_0x3c0126){_0x3c0126=_0x3c0126||0xcc;return function(_0xa11cde){if(_0xa11cde){return _0x276354[_0x2b07('0x19')](_0x3c0126);}return _0x276354[_0x2b07('0x1a')](_0x3c0126)['end']();};}function respondWithResult(_0x592a8d,_0x212ab1){_0x212ab1=_0x212ab1||0xc8;return function(_0x474a63){if(_0x474a63){return _0x592a8d[_0x2b07('0x1a')](_0x212ab1)[_0x2b07('0x1b')](_0x474a63);}};}function respondWithFilteredResult(_0x17d911,_0x1fec24){return function(_0x2fd99e){if(_0x2fd99e){var _0x4df5d5=typeof _0x1fec24['offset']===_0x2b07('0x1c')&&typeof _0x1fec24['limit']==='undefined';var _0x362140=_0x2fd99e['count'];var _0x518d2d=_0x4df5d5?0x0:_0x1fec24[_0x2b07('0x1d')];var _0x2904ff=_0x4df5d5?_0x2fd99e['count']:_0x1fec24[_0x2b07('0x1d')]+_0x1fec24[_0x2b07('0x1e')];var _0x477077;if(_0x2904ff>=_0x362140){_0x2904ff=_0x362140;_0x477077=0xc8;}else{_0x477077=0xce;}_0x17d911[_0x2b07('0x1a')](_0x477077);return _0x17d911[_0x2b07('0x1f')]('Content-Range',_0x518d2d+'-'+_0x2904ff+'/'+_0x362140)[_0x2b07('0x1b')](_0x2fd99e);}return null;};}function patchUpdates(_0x184cae){return function(_0xb0fa34){try{jsonpatch['apply'](_0xb0fa34,_0x184cae,!![]);}catch(_0x329e66){return BPromise['reject'](_0x329e66);}return _0xb0fa34[_0x2b07('0x20')]();};}function saveUpdates(_0x5a10f0,_0x27936f){return function(_0xd46102){if(_0xd46102){return _0xd46102[_0x2b07('0x21')](_0x5a10f0)[_0x2b07('0x22')](function(_0x10cd2){return _0x10cd2;});}return null;};}function removeEntity(_0x1c0c47,_0x4e8cd9){return function(_0x14ee3d){if(_0x14ee3d){return _0x14ee3d['destroy']()['then'](function(){_0x1c0c47[_0x2b07('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34d9a2,_0x3b1f3f){return function(_0x41e761){if(!_0x41e761){_0x34d9a2[_0x2b07('0x19')](0x194);}return _0x41e761;};}function handleError(_0x4e9362,_0x2647e7){_0x2647e7=_0x2647e7||0x1f4;return function(_0x3944fa){logger[_0x2b07('0x23')](_0x3944fa[_0x2b07('0x24')]);if(_0x3944fa[_0x2b07('0x25')]){delete _0x3944fa[_0x2b07('0x25')];}_0x4e9362['status'](_0x2647e7)[_0x2b07('0x26')](_0x3944fa);};}exports[_0x2b07('0x27')]=function(_0xfa9491,_0x401327){var _0x549c4e={},_0x33d312={},_0x154054={'count':0x0,'rows':[]};var _0x54d08a=_['map'](db[_0x2b07('0x28')][_0x2b07('0x29')],function(_0x43f1e6){return{'name':_0x43f1e6[_0x2b07('0x2a')],'type':_0x43f1e6[_0x2b07('0x2b')][_0x2b07('0x2c')]};});_0x33d312[_0x2b07('0x2d')]=_[_0x2b07('0x2e')](_0x54d08a,_0x2b07('0x25'));_0x33d312[_0x2b07('0x2f')]=_[_0x2b07('0x30')](_0xfa9491[_0x2b07('0x2f')]);_0x33d312['filters']=_[_0x2b07('0x31')](_0x33d312[_0x2b07('0x2d')],_0x33d312[_0x2b07('0x2f')]);_0x549c4e[_0x2b07('0x32')]=_[_0x2b07('0x31')](_0x33d312['model'],qs['fields'](_0xfa9491[_0x2b07('0x2f')][_0x2b07('0x33')]));_0x549c4e['attributes']=_0x549c4e[_0x2b07('0x32')][_0x2b07('0x34')]?_0x549c4e[_0x2b07('0x32')]:_0x33d312[_0x2b07('0x2d')];if(!_0xfa9491[_0x2b07('0x2f')][_0x2b07('0x35')](_0x2b07('0x36'))){_0x549c4e[_0x2b07('0x1e')]=qs[_0x2b07('0x1e')](_0xfa9491['query']['limit']);_0x549c4e[_0x2b07('0x1d')]=qs[_0x2b07('0x1d')](_0xfa9491['query'][_0x2b07('0x1d')]);}_0x549c4e[_0x2b07('0x37')]=qs[_0x2b07('0x38')](_0xfa9491[_0x2b07('0x2f')][_0x2b07('0x38')]);_0x549c4e[_0x2b07('0x39')]=qs[_0x2b07('0x3a')](_['pick'](_0xfa9491['query'],_0x33d312['filters']),_0x54d08a);if(_0xfa9491[_0x2b07('0x2f')][_0x2b07('0x3b')]){_0x549c4e['where']=_[_0x2b07('0x3c')](_0x549c4e['where'],{'$or':_[_0x2b07('0x2e')](_0x54d08a,function(_0x4f80a8){if(_0x4f80a8[_0x2b07('0x2b')]!==_0x2b07('0x3d')){var _0x415786={};_0x415786[_0x4f80a8['name']]={'$like':'%'+_0xfa9491[_0x2b07('0x2f')]['filter']+'%'};return _0x415786;}})});}_0x549c4e=_['merge']({},_0x549c4e,_0xfa9491[_0x2b07('0x3e')]);var _0x42dab1={'where':_0x549c4e[_0x2b07('0x39')]};return db['SquareMessage'][_0x2b07('0x3f')](_0x42dab1)[_0x2b07('0x22')](function(_0x4e81ac){_0x154054['count']=_0x4e81ac;if(_0xfa9491[_0x2b07('0x2f')][_0x2b07('0x40')]){_0x549c4e[_0x2b07('0x41')]=[{'all':!![]}];}return db[_0x2b07('0x28')]['findAll'](_0x549c4e);})[_0x2b07('0x22')](function(_0x3eca51){_0x154054[_0x2b07('0x42')]=_0x3eca51;return _0x154054;})[_0x2b07('0x22')](respondWithFilteredResult(_0x401327,_0x549c4e))[_0x2b07('0x43')](handleError(_0x401327,null));};exports[_0x2b07('0x44')]=function(_0xed80a9,_0x3b0613){var _0x17df96={'raw':!![],'where':{'id':_0xed80a9[_0x2b07('0x45')]['id']}},_0x564aa6={};_0x564aa6[_0x2b07('0x2d')]=_[_0x2b07('0x30')](db[_0x2b07('0x28')]['rawAttributes']);_0x564aa6['query']=_['keys'](_0xed80a9['query']);_0x564aa6['filters']=_['intersection'](_0x564aa6[_0x2b07('0x2d')],_0x564aa6[_0x2b07('0x2f')]);_0x17df96[_0x2b07('0x32')]=_[_0x2b07('0x31')](_0x564aa6[_0x2b07('0x2d')],qs[_0x2b07('0x33')](_0xed80a9[_0x2b07('0x2f')]['fields']));_0x17df96[_0x2b07('0x32')]=_0x17df96[_0x2b07('0x32')]['length']?_0x17df96[_0x2b07('0x32')]:_0x564aa6[_0x2b07('0x2d')];if(_0xed80a9[_0x2b07('0x2f')]['includeAll']){_0x17df96[_0x2b07('0x41')]=[{'all':!![]}];}_0x17df96=_[_0x2b07('0x3c')]({},_0x17df96,_0xed80a9[_0x2b07('0x3e')]);return db[_0x2b07('0x28')][_0x2b07('0x46')](_0x17df96)[_0x2b07('0x22')](handleEntityNotFound(_0x3b0613,null))[_0x2b07('0x22')](respondWithResult(_0x3b0613,null))[_0x2b07('0x43')](handleError(_0x3b0613,null));};exports[_0x2b07('0x47')]=function(_0x4928b8,_0x712c89){return db['SquareMessage']['create'](_0x4928b8['body'],{})[_0x2b07('0x22')](respondWithResult(_0x712c89,0xc9))[_0x2b07('0x43')](handleError(_0x712c89,null));};exports[_0x2b07('0x21')]=function(_0xb4b8e0,_0x4fe7a6){if(_0xb4b8e0[_0x2b07('0x48')]['id']){delete _0xb4b8e0[_0x2b07('0x48')]['id'];}return db[_0x2b07('0x28')][_0x2b07('0x46')]({'where':{'id':_0xb4b8e0[_0x2b07('0x45')]['id']}})[_0x2b07('0x22')](handleEntityNotFound(_0x4fe7a6,null))['then'](saveUpdates(_0xb4b8e0['body'],null))[_0x2b07('0x22')](respondWithResult(_0x4fe7a6,null))[_0x2b07('0x43')](handleError(_0x4fe7a6,null));};exports[_0x2b07('0x49')]=function(_0x127d45,_0x122793){return db['SquareMessage'][_0x2b07('0x46')]({'where':{'id':_0x127d45[_0x2b07('0x45')]['id']}})[_0x2b07('0x22')](handleEntityNotFound(_0x122793,null))[_0x2b07('0x22')](removeEntity(_0x122793,null))[_0x2b07('0x43')](handleError(_0x122793,null));}; \ No newline at end of file +var _0xa2bf=['where','filters','filter','merge','VIRTUAL','options','SquareMessage','include','rows','show','params','keys','rawAttributes','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','apply','save','update','then','destroy','sendStatus','name','send','index','map','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x3f71c0,_0x2e3e79){var _0x15b444=function(_0x5d73b5){while(--_0x5d73b5){_0x3f71c0['push'](_0x3f71c0['shift']());}};_0x15b444(++_0x2e3e79);}(_0xa2bf,0xa8));var _0xfa2b=function(_0x213622,_0x5c5aa7){_0x213622=_0x213622-0x0;var _0x3025ab=_0xa2bf[_0x213622];return _0x3025ab;};'use strict';var emlformat=require(_0xfa2b('0x0'));var rimraf=require(_0xfa2b('0x1'));var zipdir=require(_0xfa2b('0x2'));var jsonpatch=require(_0xfa2b('0x3'));var rp=require('request-promise');var moment=require(_0xfa2b('0x4'));var BPromise=require(_0xfa2b('0x5'));var Mustache=require(_0xfa2b('0x6'));var util=require(_0xfa2b('0x7'));var path=require(_0xfa2b('0x8'));var sox=require(_0xfa2b('0x9'));var csv=require(_0xfa2b('0xa'));var ejs=require(_0xfa2b('0xb'));var fs=require('fs');var fs_extra=require(_0xfa2b('0xc'));var _=require(_0xfa2b('0xd'));var squel=require(_0xfa2b('0xe'));var crypto=require(_0xfa2b('0xf'));var jsforce=require(_0xfa2b('0x10'));var deskjs=require(_0xfa2b('0x11'));var toCsv=require('to-csv');var querystring=require(_0xfa2b('0x12'));var Papa=require(_0xfa2b('0x13'));var Redis=require('ioredis');var authService=require(_0xfa2b('0x14'));var qs=require(_0xfa2b('0x15'));var as=require(_0xfa2b('0x16'));var hardwareService=require(_0xfa2b('0x17'));var logger=require(_0xfa2b('0x18'))(_0xfa2b('0x19'));var utils=require(_0xfa2b('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfa2b('0x1b'))['db'];function respondWithStatusCode(_0x5c9f84,_0x165a0f){_0x165a0f=_0x165a0f||0xcc;return function(_0x328d77){if(_0x328d77){return _0x5c9f84['sendStatus'](_0x165a0f);}return _0x5c9f84[_0xfa2b('0x1c')](_0x165a0f)[_0xfa2b('0x1d')]();};}function respondWithResult(_0x138766,_0x31b1ad){_0x31b1ad=_0x31b1ad||0xc8;return function(_0x1d0ab1){if(_0x1d0ab1){return _0x138766[_0xfa2b('0x1c')](_0x31b1ad)[_0xfa2b('0x1e')](_0x1d0ab1);}};}function respondWithFilteredResult(_0x479953,_0x55f20c){return function(_0x13d602){if(_0x13d602){var _0x4bac69=typeof _0x55f20c[_0xfa2b('0x1f')]===_0xfa2b('0x20')&&typeof _0x55f20c[_0xfa2b('0x21')]==='undefined';var _0xcdc2c4=_0x13d602[_0xfa2b('0x22')];var _0x1991c9=_0x4bac69?0x0:_0x55f20c[_0xfa2b('0x1f')];var _0x4bb40e=_0x4bac69?_0x13d602[_0xfa2b('0x22')]:_0x55f20c[_0xfa2b('0x1f')]+_0x55f20c[_0xfa2b('0x21')];var _0x4213d3;if(_0x4bb40e>=_0xcdc2c4){_0x4bb40e=_0xcdc2c4;_0x4213d3=0xc8;}else{_0x4213d3=0xce;}_0x479953['status'](_0x4213d3);return _0x479953['set']('Content-Range',_0x1991c9+'-'+_0x4bb40e+'/'+_0xcdc2c4)[_0xfa2b('0x1e')](_0x13d602);}return null;};}function patchUpdates(_0x56e3ae){return function(_0x11576f){try{jsonpatch[_0xfa2b('0x23')](_0x11576f,_0x56e3ae,!![]);}catch(_0x58cf62){return BPromise['reject'](_0x58cf62);}return _0x11576f[_0xfa2b('0x24')]();};}function saveUpdates(_0x555d89,_0x4849b4){return function(_0x191b38){if(_0x191b38){return _0x191b38[_0xfa2b('0x25')](_0x555d89)[_0xfa2b('0x26')](function(_0x2be80f){return _0x2be80f;});}return null;};}function removeEntity(_0x1cedba,_0x278fa1){return function(_0x4a47a3){if(_0x4a47a3){return _0x4a47a3[_0xfa2b('0x27')]()['then'](function(){_0x1cedba['status'](0xcc)[_0xfa2b('0x1d')]();});}};}function handleEntityNotFound(_0x559132,_0x9fc622){return function(_0xa58602){if(!_0xa58602){_0x559132[_0xfa2b('0x28')](0x194);}return _0xa58602;};}function handleError(_0x3da8e6,_0x434ccc){_0x434ccc=_0x434ccc||0x1f4;return function(_0x3bbc6d){logger['error'](_0x3bbc6d['stack']);if(_0x3bbc6d[_0xfa2b('0x29')]){delete _0x3bbc6d[_0xfa2b('0x29')];}_0x3da8e6['status'](_0x434ccc)[_0xfa2b('0x2a')](_0x3bbc6d);};}exports[_0xfa2b('0x2b')]=function(_0x533bb5,_0x4ddcb4){var _0x552b93={},_0x2de0fd={},_0x40053c={'count':0x0,'rows':[]};var _0x42ae95=_[_0xfa2b('0x2c')](db['SquareMessage']['rawAttributes'],function(_0x221281){return{'name':_0x221281[_0xfa2b('0x2d')],'type':_0x221281[_0xfa2b('0x2e')]['key']};});_0x2de0fd[_0xfa2b('0x2f')]=_[_0xfa2b('0x2c')](_0x42ae95,_0xfa2b('0x29'));_0x2de0fd['query']=_['keys'](_0x533bb5[_0xfa2b('0x30')]);_0x2de0fd['filters']=_[_0xfa2b('0x31')](_0x2de0fd[_0xfa2b('0x2f')],_0x2de0fd[_0xfa2b('0x30')]);_0x552b93[_0xfa2b('0x32')]=_[_0xfa2b('0x31')](_0x2de0fd[_0xfa2b('0x2f')],qs[_0xfa2b('0x33')](_0x533bb5[_0xfa2b('0x30')]['fields']));_0x552b93[_0xfa2b('0x32')]=_0x552b93[_0xfa2b('0x32')][_0xfa2b('0x34')]?_0x552b93[_0xfa2b('0x32')]:_0x2de0fd['model'];if(!_0x533bb5[_0xfa2b('0x30')][_0xfa2b('0x35')](_0xfa2b('0x36'))){_0x552b93['limit']=qs[_0xfa2b('0x21')](_0x533bb5[_0xfa2b('0x30')]['limit']);_0x552b93[_0xfa2b('0x1f')]=qs[_0xfa2b('0x1f')](_0x533bb5[_0xfa2b('0x30')][_0xfa2b('0x1f')]);}_0x552b93[_0xfa2b('0x37')]=qs['sort'](_0x533bb5['query'][_0xfa2b('0x38')]);_0x552b93[_0xfa2b('0x39')]=qs[_0xfa2b('0x3a')](_['pick'](_0x533bb5[_0xfa2b('0x30')],_0x2de0fd['filters']),_0x42ae95);if(_0x533bb5[_0xfa2b('0x30')][_0xfa2b('0x3b')]){_0x552b93['where']=_[_0xfa2b('0x3c')](_0x552b93['where'],{'$or':_[_0xfa2b('0x2c')](_0x42ae95,function(_0xb18a6f){if(_0xb18a6f['type']!==_0xfa2b('0x3d')){var _0xe6aae0={};_0xe6aae0[_0xb18a6f[_0xfa2b('0x29')]]={'$like':'%'+_0x533bb5[_0xfa2b('0x30')][_0xfa2b('0x3b')]+'%'};return _0xe6aae0;}})});}_0x552b93=_[_0xfa2b('0x3c')]({},_0x552b93,_0x533bb5[_0xfa2b('0x3e')]);var _0xca087e={'where':_0x552b93['where']};return db[_0xfa2b('0x3f')][_0xfa2b('0x22')](_0xca087e)[_0xfa2b('0x26')](function(_0x418388){_0x40053c[_0xfa2b('0x22')]=_0x418388;if(_0x533bb5[_0xfa2b('0x30')]['includeAll']){_0x552b93[_0xfa2b('0x40')]=[{'all':!![]}];}return db[_0xfa2b('0x3f')]['findAll'](_0x552b93);})[_0xfa2b('0x26')](function(_0x328232){_0x40053c[_0xfa2b('0x41')]=_0x328232;return _0x40053c;})[_0xfa2b('0x26')](respondWithFilteredResult(_0x4ddcb4,_0x552b93))['catch'](handleError(_0x4ddcb4,null));};exports[_0xfa2b('0x42')]=function(_0x1160ad,_0x4816f7){var _0x3031d0={'raw':!![],'where':{'id':_0x1160ad[_0xfa2b('0x43')]['id']}},_0x528f2f={};_0x528f2f[_0xfa2b('0x2f')]=_[_0xfa2b('0x44')](db[_0xfa2b('0x3f')][_0xfa2b('0x45')]);_0x528f2f['query']=_[_0xfa2b('0x44')](_0x1160ad[_0xfa2b('0x30')]);_0x528f2f[_0xfa2b('0x3a')]=_[_0xfa2b('0x31')](_0x528f2f[_0xfa2b('0x2f')],_0x528f2f[_0xfa2b('0x30')]);_0x3031d0[_0xfa2b('0x32')]=_[_0xfa2b('0x31')](_0x528f2f[_0xfa2b('0x2f')],qs[_0xfa2b('0x33')](_0x1160ad[_0xfa2b('0x30')]['fields']));_0x3031d0[_0xfa2b('0x32')]=_0x3031d0[_0xfa2b('0x32')][_0xfa2b('0x34')]?_0x3031d0[_0xfa2b('0x32')]:_0x528f2f['model'];if(_0x1160ad[_0xfa2b('0x30')][_0xfa2b('0x46')]){_0x3031d0[_0xfa2b('0x40')]=[{'all':!![]}];}_0x3031d0=_[_0xfa2b('0x3c')]({},_0x3031d0,_0x1160ad[_0xfa2b('0x3e')]);return db[_0xfa2b('0x3f')][_0xfa2b('0x47')](_0x3031d0)[_0xfa2b('0x26')](handleEntityNotFound(_0x4816f7,null))[_0xfa2b('0x26')](respondWithResult(_0x4816f7,null))[_0xfa2b('0x48')](handleError(_0x4816f7,null));};exports[_0xfa2b('0x49')]=function(_0x17cc01,_0x5e8d6c){return db[_0xfa2b('0x3f')][_0xfa2b('0x49')](_0x17cc01[_0xfa2b('0x4a')],{})[_0xfa2b('0x26')](respondWithResult(_0x5e8d6c,0xc9))[_0xfa2b('0x48')](handleError(_0x5e8d6c,null));};exports[_0xfa2b('0x25')]=function(_0x310d1d,_0x569304){if(_0x310d1d[_0xfa2b('0x4a')]['id']){delete _0x310d1d['body']['id'];}return db[_0xfa2b('0x3f')]['find']({'where':{'id':_0x310d1d[_0xfa2b('0x43')]['id']}})[_0xfa2b('0x26')](handleEntityNotFound(_0x569304,null))[_0xfa2b('0x26')](saveUpdates(_0x310d1d['body'],null))[_0xfa2b('0x26')](respondWithResult(_0x569304,null))['catch'](handleError(_0x569304,null));};exports['destroy']=function(_0x5b3777,_0x4a4601){return db[_0xfa2b('0x3f')][_0xfa2b('0x47')]({'where':{'id':_0x5b3777[_0xfa2b('0x43')]['id']}})[_0xfa2b('0x26')](handleEntityNotFound(_0x4a4601,null))[_0xfa2b('0x26')](removeEntity(_0x4a4601,null))[_0xfa2b('0x48')](handleError(_0x4a4601,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index c281a54..6c8dda7 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 _0xb6c6=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./squareMessage.attributes','define','SquareMessage','square_messages','lodash'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xb6c6,0x1ee));var _0x6b6c=function(_0x2a046b,_0x3b1396){_0x2a046b=_0x2a046b-0x0;var _0x3ccc45=_0xb6c6[_0x2a046b];return _0x3ccc45;};'use strict';var _=require(_0x6b6c('0x0'));var util=require('util');var logger=require(_0x6b6c('0x1'))(_0x6b6c('0x2'));var moment=require(_0x6b6c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6b6c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6b6c('0x5'));var config=require(_0x6b6c('0x6'));var attributes=require(_0x6b6c('0x7'));module['exports']=function(_0x5cefef,_0x1a0043){return _0x5cefef[_0x6b6c('0x8')](_0x6b6c('0x9'),attributes,{'tableName':_0x6b6c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9995=['define','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./squareMessage.attributes','exports'];(function(_0x26f06e,_0x5e440f){var _0x128477=function(_0x4c5feb){while(--_0x4c5feb){_0x26f06e['push'](_0x26f06e['shift']());}};_0x128477(++_0x5e440f);}(_0x9995,0x141));var _0x5999=function(_0x11541a,_0x1dd673){_0x11541a=_0x11541a-0x0;var _0x5dded5=_0x9995[_0x11541a];return _0x5dded5;};'use strict';var _=require(_0x5999('0x0'));var util=require(_0x5999('0x1'));var logger=require(_0x5999('0x2'))(_0x5999('0x3'));var moment=require('moment');var BPromise=require(_0x5999('0x4'));var rp=require(_0x5999('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5999('0x6'));var attributes=require(_0x5999('0x7'));module[_0x5999('0x8')]=function(_0x3499f8,_0x55b2c4){return _0x3499f8[_0x5999('0x9')]('SquareMessage',attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 6cd3e1e..6762134 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 _0x00f0=['client','http','request','then','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareMessage','SquareMessage','body','options','raw','debug','lodash','ioredis','../../config/environment','jayson/promise'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0x00f0,0x17c));var _0x000f=function(_0x4b58fa,_0x188592){_0x4b58fa=_0x4b58fa-0x0;var _0x23ba11=_0x00f0[_0x4b58fa];return _0x23ba11;};'use strict';var _=require(_0x000f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x000f('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x000f('0x2'));var jayson=require(_0x000f('0x3'));var client=jayson[_0x000f('0x4')][_0x000f('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x54358f,_0x78e40b,_0x5baa37){return new BPromise(function(_0x4b2e2b,_0x327445){return client[_0x000f('0x6')](_0x54358f,_0x5baa37)[_0x000f('0x7')](function(_0x3de7c9){logger['info'](_0x000f('0x8'),_0x78e40b,_0x000f('0x9'));logger['debug'](_0x000f('0xa'),_0x78e40b,_0x000f('0x9'),JSON[_0x000f('0xb')](_0x3de7c9));if(_0x3de7c9['error']){if(_0x3de7c9[_0x000f('0xc')][_0x000f('0xd')]===0x1f4){logger[_0x000f('0xc')](_0x000f('0x8'),_0x78e40b,_0x3de7c9[_0x000f('0xc')][_0x000f('0xe')]);return _0x327445(_0x3de7c9['error'][_0x000f('0xe')]);}logger['error'](_0x000f('0x8'),_0x78e40b,_0x3de7c9['error'][_0x000f('0xe')]);return _0x4b2e2b(_0x3de7c9[_0x000f('0xc')][_0x000f('0xe')]);}else{logger[_0x000f('0xf')](_0x000f('0x8'),_0x78e40b,_0x000f('0x9'));_0x4b2e2b(_0x3de7c9[_0x000f('0x10')][_0x000f('0xe')]);}})[_0x000f('0x11')](function(_0x5c47d6){logger['error'](_0x000f('0x8'),_0x78e40b,_0x5c47d6);_0x327445(_0x5c47d6);});});}exports[_0x000f('0x12')]=function(_0x1d32f8){var _0x44a21e=this;return new Promise(function(_0x336a07,_0x1f1cb5){return db[_0x000f('0x13')]['create'](_0x1d32f8[_0x000f('0x14')],{'raw':_0x1d32f8['options']?_0x1d32f8[_0x000f('0x15')][_0x000f('0x16')]===undefined?!![]:![]:!![]})[_0x000f('0x7')](function(_0x152701){logger[_0x000f('0xf')](_0x000f('0x12'),_0x1d32f8);logger[_0x000f('0x17')](_0x000f('0x12'),_0x1d32f8,JSON[_0x000f('0xb')](_0x152701));_0x336a07(_0x152701);})[_0x000f('0x11')](function(_0x43d8fd){logger[_0x000f('0xc')](_0x000f('0x12'),_0x43d8fd[_0x000f('0xe')],_0x1d32f8);_0x1f1cb5(_0x44a21e[_0x000f('0xc')](0x1f4,_0x43d8fd['message']));});});}; \ No newline at end of file +var _0x8000=['SquareMessage','create','body','options','raw','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','CreateSquareMessage'];(function(_0x2e21b5,_0x1f197a){var _0x5ab37d=function(_0x4f4b4b){while(--_0x4f4b4b){_0x2e21b5['push'](_0x2e21b5['shift']());}};_0x5ab37d(++_0x1f197a);}(_0x8000,0xa1));var _0x0800=function(_0x428249,_0x3f9e3a){_0x428249=_0x428249-0x0;var _0x2c84c=_0x8000[_0x428249];return _0x2c84c;};'use strict';var _=require('lodash');var util=require(_0x0800('0x0'));var moment=require('moment');var BPromise=require(_0x0800('0x1'));var rs=require(_0x0800('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0800('0x3'))['db'];var utils=require(_0x0800('0x4'));var logger=require(_0x0800('0x5'))(_0x0800('0x6'));var config=require('../../config/environment');var jayson=require(_0x0800('0x7'));var client=jayson[_0x0800('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1554df,_0x436be2,_0x3fccc1){return new BPromise(function(_0x183ae2,_0x365d1e){return client[_0x0800('0x9')](_0x1554df,_0x3fccc1)[_0x0800('0xa')](function(_0x198576){logger[_0x0800('0xb')](_0x0800('0xc'),_0x436be2,_0x0800('0xd'));logger[_0x0800('0xe')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x436be2,'request\x20sent',JSON[_0x0800('0xf')](_0x198576));if(_0x198576['error']){if(_0x198576['error'][_0x0800('0x10')]===0x1f4){logger[_0x0800('0x11')](_0x0800('0xc'),_0x436be2,_0x198576[_0x0800('0x11')][_0x0800('0x12')]);return _0x365d1e(_0x198576[_0x0800('0x11')][_0x0800('0x12')]);}logger['error'](_0x0800('0xc'),_0x436be2,_0x198576[_0x0800('0x11')][_0x0800('0x12')]);return _0x183ae2(_0x198576[_0x0800('0x11')][_0x0800('0x12')]);}else{logger[_0x0800('0xb')](_0x0800('0xc'),_0x436be2,_0x0800('0xd'));_0x183ae2(_0x198576[_0x0800('0x13')][_0x0800('0x12')]);}})['catch'](function(_0x3f49cf){logger[_0x0800('0x11')](_0x0800('0xc'),_0x436be2,_0x3f49cf);_0x365d1e(_0x3f49cf);});});}exports[_0x0800('0x14')]=function(_0x11d467){var _0x1363c2=this;return new Promise(function(_0x4fe28e,_0x5c84ba){return db[_0x0800('0x15')][_0x0800('0x16')](_0x11d467[_0x0800('0x17')],{'raw':_0x11d467[_0x0800('0x18')]?_0x11d467[_0x0800('0x18')][_0x0800('0x19')]===undefined?!![]:![]:!![]})[_0x0800('0xa')](function(_0x2d922b){logger['info'](_0x0800('0x14'),_0x11d467);logger[_0x0800('0xe')]('CreateSquareMessage',_0x11d467,JSON[_0x0800('0xf')](_0x2d922b));_0x4fe28e(_0x2d922b);})['catch'](function(_0x181890){logger['error'](_0x0800('0x14'),_0x181890[_0x0800('0x12')],_0x11d467);_0x5c84ba(_0x1363c2['error'](0x1f4,_0x181890[_0x0800('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index ba34216..1144be6 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 _0x1014=['test','post','create','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/test','15s'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x1014,0x1bd));var _0x4101=function(_0x1b997b,_0x310ebc){_0x1b997b=_0x1b997b-0x0;var _0x43d67b=_0x1014[_0x1b997b];return _0x43d67b;};'use strict';var multer=require('multer');var util=require(_0x4101('0x0'));var path=require(_0x4101('0x1'));var timeout=require(_0x4101('0x2'));var express=require(_0x4101('0x3'));var router=express[_0x4101('0x4')]();var fs_extra=require(_0x4101('0x5'));var auth=require(_0x4101('0x6'));var interaction=require(_0x4101('0x7'));var config=require(_0x4101('0x8'));var controller=require('./squareOdbc.controller');router[_0x4101('0x9')]('/',auth[_0x4101('0xa')](),controller[_0x4101('0xb')]);router[_0x4101('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x4101('0xc')]);router[_0x4101('0x9')](_0x4101('0xd'),auth['isAuthenticated'](),timeout(_0x4101('0xe')),controller[_0x4101('0xf')]);router[_0x4101('0x10')]('/',auth[_0x4101('0xa')](),controller[_0x4101('0x11')]);router[_0x4101('0x12')](_0x4101('0x13'),auth[_0x4101('0xa')](),controller[_0x4101('0x14')]);router[_0x4101('0x15')](_0x4101('0x13'),auth[_0x4101('0xa')](),controller['destroy']);module[_0x4101('0x16')]=router; \ No newline at end of file +var _0xa2f2=['./squareOdbc.controller','get','isAuthenticated','index','/:id','show','15s','create','delete','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x50762b,_0x1e807f){var _0x31bfb8=function(_0x239e54){while(--_0x239e54){_0x50762b['push'](_0x50762b['shift']());}};_0x31bfb8(++_0x1e807f);}(_0xa2f2,0x11a));var _0x2a2f=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xa2f2[_0x3ab9ee];return _0x82ee88;};'use strict';var multer=require(_0x2a2f('0x0'));var util=require('util');var path=require(_0x2a2f('0x1'));var timeout=require(_0x2a2f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2a2f('0x3'));var auth=require(_0x2a2f('0x4'));var interaction=require(_0x2a2f('0x5'));var config=require(_0x2a2f('0x6'));var controller=require(_0x2a2f('0x7'));router[_0x2a2f('0x8')]('/',auth[_0x2a2f('0x9')](),controller[_0x2a2f('0xa')]);router[_0x2a2f('0x8')](_0x2a2f('0xb'),auth[_0x2a2f('0x9')](),controller[_0x2a2f('0xc')]);router[_0x2a2f('0x8')]('/:id/test',auth[_0x2a2f('0x9')](),timeout(_0x2a2f('0xd')),controller['test']);router['post']('/',auth[_0x2a2f('0x9')](),controller[_0x2a2f('0xe')]);router['put']('/:id',auth[_0x2a2f('0x9')](),controller['update']);router[_0x2a2f('0xf')](_0x2a2f('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x2a2f('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index e245a8e..7f1572b 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 _0xde50=['STRING'];(function(_0x555e12,_0x2cc9b7){var _0x6ba92b=function(_0x2727b9){while(--_0x2727b9){_0x555e12['push'](_0x555e12['shift']());}};_0x6ba92b(++_0x2cc9b7);}(_0xde50,0xb7));var _0x0de5=function(_0x17e02d,_0x471838){_0x17e02d=_0x17e02d-0x0;var _0x1b0fdb=_0xde50[_0x17e02d];return _0x1b0fdb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0de5('0x0')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x0de5('0x0')]},'description':{'type':Sequelize[_0x0de5('0x0')]}}; \ No newline at end of file +var _0xfca4=['exports','STRING','name','sequelize'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xfca4,0x87));var _0x4fca=function(_0x2723b5,_0x4c701d){_0x2723b5=_0x2723b5-0x0;var _0x2f6c0c=_0xfca4[_0x2723b5];return _0x2f6c0c;};'use strict';var Sequelize=require(_0x4fca('0x0'));module[_0x4fca('0x1')]={'name':{'type':Sequelize[_0x4fca('0x2')],'unique':_0x4fca('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4fca('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 955dee0..22e1139 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 _0x1953=['role','get','ODBC','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','test','dsn','odbc','openSync','closeSync','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','UserProfileResource','error','name','send','index','map','SquareOdbc','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','params','keys','include','options','create','user'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1953,0x166));var _0x3195=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x1953[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3195('0x0'));var rp=require(_0x3195('0x1'));var moment=require(_0x3195('0x2'));var BPromise=require(_0x3195('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3195('0x4'));var sox=require(_0x3195('0x5'));var csv=require(_0x3195('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3195('0x7'));var crypto=require(_0x3195('0x8'));var jsforce=require(_0x3195('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x3195('0x6'));var querystring=require(_0x3195('0xa'));var Papa=require(_0x3195('0xb'));var Redis=require('ioredis');var authService=require(_0x3195('0xc'));var qs=require(_0x3195('0xd'));var as=require(_0x3195('0xe'));var hardwareService=require(_0x3195('0xf'));var logger=require(_0x3195('0x10'))(_0x3195('0x11'));var utils=require(_0x3195('0x12'));var config=require(_0x3195('0x13'));var licenseUtil=require(_0x3195('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x552d2c,_0x108fb1){_0x108fb1=_0x108fb1||0xcc;return function(_0x415fe3){if(_0x415fe3){return _0x552d2c[_0x3195('0x15')](_0x108fb1);}return _0x552d2c[_0x3195('0x16')](_0x108fb1)[_0x3195('0x17')]();};}function respondWithResult(_0xf46717,_0x32711b){_0x32711b=_0x32711b||0xc8;return function(_0x22a82e){if(_0x22a82e){return _0xf46717['status'](_0x32711b)[_0x3195('0x18')](_0x22a82e);}};}function respondWithFilteredResult(_0x4d5d7b,_0x4d8811){return function(_0x151800){if(_0x151800){var _0x214768=typeof _0x4d8811[_0x3195('0x19')]===_0x3195('0x1a')&&typeof _0x4d8811['limit']===_0x3195('0x1a');var _0x452632=_0x151800[_0x3195('0x1b')];var _0x175654=_0x214768?0x0:_0x4d8811[_0x3195('0x19')];var _0x40280c=_0x214768?_0x151800['count']:_0x4d8811[_0x3195('0x19')]+_0x4d8811[_0x3195('0x1c')];var _0xd1f7bd;if(_0x40280c>=_0x452632){_0x40280c=_0x452632;_0xd1f7bd=0xc8;}else{_0xd1f7bd=0xce;}_0x4d5d7b['status'](_0xd1f7bd);return _0x4d5d7b[_0x3195('0x1d')](_0x3195('0x1e'),_0x175654+'-'+_0x40280c+'/'+_0x452632)[_0x3195('0x18')](_0x151800);}return null;};}function patchUpdates(_0xf1be5d){return function(_0xc4e266){try{jsonpatch[_0x3195('0x1f')](_0xc4e266,_0xf1be5d,!![]);}catch(_0x4291b1){return BPromise[_0x3195('0x20')](_0x4291b1);}return _0xc4e266[_0x3195('0x21')]();};}function saveUpdates(_0x26801b,_0x83545f){return function(_0x2f4e78){if(_0x2f4e78){return _0x2f4e78['update'](_0x26801b)[_0x3195('0x22')](function(_0x71ab6f){return _0x71ab6f;});}return null;};}function removeEntity(_0x3d779e,_0x56378a){return function(_0x4f4f11){if(_0x4f4f11){return _0x4f4f11[_0x3195('0x23')]()['then'](function(){var _0x3ff099=_0x4f4f11['get']({'plain':!![]});var _0x2c677f='ODBC';return db[_0x3195('0x24')][_0x3195('0x23')]({'where':{'type':_0x2c677f,'resourceId':_0x3ff099['id']}})[_0x3195('0x22')](function(){return _0x4f4f11;});})[_0x3195('0x22')](function(){_0x3d779e[_0x3195('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13b329,_0x47e78d){return function(_0x42331a){if(!_0x42331a){_0x13b329[_0x3195('0x15')](0x194);}return _0x42331a;};}function handleError(_0xe8e3ba,_0x31264f){_0x31264f=_0x31264f||0x1f4;return function(_0x41b817){logger[_0x3195('0x25')](_0x41b817['stack']);if(_0x41b817[_0x3195('0x26')]){delete _0x41b817['name'];}_0xe8e3ba[_0x3195('0x16')](_0x31264f)[_0x3195('0x27')](_0x41b817);};}exports[_0x3195('0x28')]=function(_0x1a9edf,_0x4fe33f){var _0x52f78c={},_0x57fdd9={},_0x12b3ea={'count':0x0,'rows':[]};var _0x1771b8=_[_0x3195('0x29')](db[_0x3195('0x2a')]['rawAttributes'],function(_0x5284c5){return{'name':_0x5284c5[_0x3195('0x2b')],'type':_0x5284c5[_0x3195('0x2c')][_0x3195('0x2d')]};});_0x57fdd9[_0x3195('0x2e')]=_[_0x3195('0x29')](_0x1771b8,_0x3195('0x26'));_0x57fdd9[_0x3195('0x2f')]=_['keys'](_0x1a9edf['query']);_0x57fdd9[_0x3195('0x30')]=_[_0x3195('0x31')](_0x57fdd9[_0x3195('0x2e')],_0x57fdd9['query']);_0x52f78c[_0x3195('0x32')]=_['intersection'](_0x57fdd9[_0x3195('0x2e')],qs[_0x3195('0x33')](_0x1a9edf[_0x3195('0x2f')][_0x3195('0x33')]));_0x52f78c[_0x3195('0x32')]=_0x52f78c['attributes'][_0x3195('0x34')]?_0x52f78c[_0x3195('0x32')]:_0x57fdd9[_0x3195('0x2e')];if(!_0x1a9edf[_0x3195('0x2f')][_0x3195('0x35')](_0x3195('0x36'))){_0x52f78c[_0x3195('0x1c')]=qs[_0x3195('0x1c')](_0x1a9edf[_0x3195('0x2f')][_0x3195('0x1c')]);_0x52f78c[_0x3195('0x19')]=qs[_0x3195('0x19')](_0x1a9edf[_0x3195('0x2f')]['offset']);}_0x52f78c[_0x3195('0x37')]=qs[_0x3195('0x38')](_0x1a9edf[_0x3195('0x2f')]['sort']);_0x52f78c[_0x3195('0x39')]=qs[_0x3195('0x30')](_[_0x3195('0x3a')](_0x1a9edf[_0x3195('0x2f')],_0x57fdd9[_0x3195('0x30')]),_0x1771b8);if(_0x1a9edf[_0x3195('0x2f')][_0x3195('0x3b')]){_0x52f78c[_0x3195('0x39')]=_[_0x3195('0x3c')](_0x52f78c[_0x3195('0x39')],{'$or':_['map'](_0x1771b8,function(_0x358624){if(_0x358624[_0x3195('0x2c')]!==_0x3195('0x3d')){var _0x46b893={};_0x46b893[_0x358624['name']]={'$like':'%'+_0x1a9edf[_0x3195('0x2f')]['filter']+'%'};return _0x46b893;}})});}_0x52f78c=_[_0x3195('0x3c')]({},_0x52f78c,_0x1a9edf['options']);var _0x37340c={'where':_0x52f78c[_0x3195('0x39')]};return db[_0x3195('0x2a')][_0x3195('0x1b')](_0x37340c)['then'](function(_0x251b9a){_0x12b3ea[_0x3195('0x1b')]=_0x251b9a;if(_0x1a9edf[_0x3195('0x2f')][_0x3195('0x3e')]){_0x52f78c['include']=[{'all':!![]}];}return db[_0x3195('0x2a')][_0x3195('0x3f')](_0x52f78c);})[_0x3195('0x22')](function(_0x112a85){_0x12b3ea[_0x3195('0x40')]=_0x112a85;return _0x12b3ea;})['then'](respondWithFilteredResult(_0x4fe33f,_0x52f78c))[_0x3195('0x41')](handleError(_0x4fe33f,null));};exports['show']=function(_0xc4e476,_0x53f8d5){var _0x48a897={'raw':!![],'where':{'id':_0xc4e476[_0x3195('0x42')]['id']}},_0x405e9d={};_0x405e9d[_0x3195('0x2e')]=_['keys'](db[_0x3195('0x2a')]['rawAttributes']);_0x405e9d[_0x3195('0x2f')]=_[_0x3195('0x43')](_0xc4e476[_0x3195('0x2f')]);_0x405e9d[_0x3195('0x30')]=_[_0x3195('0x31')](_0x405e9d[_0x3195('0x2e')],_0x405e9d[_0x3195('0x2f')]);_0x48a897[_0x3195('0x32')]=_['intersection'](_0x405e9d[_0x3195('0x2e')],qs[_0x3195('0x33')](_0xc4e476[_0x3195('0x2f')]['fields']));_0x48a897[_0x3195('0x32')]=_0x48a897[_0x3195('0x32')][_0x3195('0x34')]?_0x48a897['attributes']:_0x405e9d[_0x3195('0x2e')];if(_0xc4e476[_0x3195('0x2f')]['includeAll']){_0x48a897[_0x3195('0x44')]=[{'all':!![]}];}_0x48a897=_[_0x3195('0x3c')]({},_0x48a897,_0xc4e476[_0x3195('0x45')]);return db[_0x3195('0x2a')]['find'](_0x48a897)['then'](handleEntityNotFound(_0x53f8d5,null))[_0x3195('0x22')](respondWithResult(_0x53f8d5,null))[_0x3195('0x41')](handleError(_0x53f8d5,null));};exports['create']=function(_0x413507,_0x4c758b){return db[_0x3195('0x2a')][_0x3195('0x46')](_0x413507['body'],{})[_0x3195('0x22')](function(_0x5b4630){var _0x771e1b=_0x413507[_0x3195('0x47')]['get']({'plain':!![]});if(!_0x771e1b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x771e1b[_0x3195('0x48')]===_0x3195('0x47')){var _0x39ff8a=_0x5b4630[_0x3195('0x49')]({'plain':!![]});var _0x59c34c=_0x3195('0x4a');return db['UserProfileSection'][_0x3195('0x4b')]({'where':{'name':_0x59c34c,'userProfileId':_0x771e1b[_0x3195('0x4c')]},'raw':!![]})[_0x3195('0x22')](function(_0x69919a){if(_0x69919a&&_0x69919a[_0x3195('0x4d')]===0x0){return db['UserProfileResource'][_0x3195('0x46')]({'name':_0x39ff8a[_0x3195('0x26')],'resourceId':_0x39ff8a['id'],'type':_0x69919a['name'],'sectionId':_0x69919a['id']},{})[_0x3195('0x22')](function(){return _0x5b4630;});}else{return _0x5b4630;}})[_0x3195('0x41')](function(_0x212a3a){logger[_0x3195('0x25')](_0x3195('0x4e'),_0x212a3a);throw _0x212a3a;});}return _0x5b4630;})['then'](respondWithResult(_0x4c758b,0xc9))[_0x3195('0x41')](handleError(_0x4c758b,null));};exports[_0x3195('0x4f')]=function(_0x55da2b,_0x560260){if(_0x55da2b[_0x3195('0x50')]['id']){delete _0x55da2b[_0x3195('0x50')]['id'];}return db[_0x3195('0x2a')][_0x3195('0x4b')]({'where':{'id':_0x55da2b[_0x3195('0x42')]['id']}})[_0x3195('0x22')](handleEntityNotFound(_0x560260,null))[_0x3195('0x22')](saveUpdates(_0x55da2b['body'],null))['then'](respondWithResult(_0x560260,null))['catch'](handleError(_0x560260,null));};exports[_0x3195('0x23')]=function(_0x881dd7,_0x4f4241){return db[_0x3195('0x2a')][_0x3195('0x4b')]({'where':{'id':_0x881dd7[_0x3195('0x42')]['id']}})[_0x3195('0x22')](handleEntityNotFound(_0x4f4241,null))[_0x3195('0x22')](removeEntity(_0x4f4241,null))[_0x3195('0x41')](handleError(_0x4f4241,null));};exports[_0x3195('0x51')]=function(_0x1a8237,_0x22af78,_0x8cf831){var _0x16c28d;return db['SquareOdbc'][_0x3195('0x4b')]({'where':{'id':_0x1a8237[_0x3195('0x42')]['id']},'attributes':['id',_0x3195('0x52')]})[_0x3195('0x22')](handleEntityNotFound(_0x22af78,null))[_0x3195('0x22')](function(_0x1f3ff5){if(_0x1f3ff5){var _0x260de4=require(_0x3195('0x53'))();_0x260de4[_0x3195('0x54')](_0x1f3ff5[_0x3195('0x52')]);_0x260de4[_0x3195('0x55')]();return _0x1f3ff5;}})[_0x3195('0x22')](respondWithResult(_0x22af78,null))[_0x3195('0x41')](handleError(_0x22af78,null));}; \ No newline at end of file +var _0xc629=['key','model','map','query','keys','filters','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','SquareOdbc','includeAll','include','findAll','rows','catch','show','params','intersection','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','test','odbc','dsn','closeSync','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','get','ODBC','then','error','stack','name','rawAttributes','fieldName','type'];(function(_0x4c47ed,_0x2839f6){var _0x1bce84=function(_0x4e1151){while(--_0x4e1151){_0x4c47ed['push'](_0x4c47ed['shift']());}};_0x1bce84(++_0x2839f6);}(_0xc629,0x188));var _0x9c62=function(_0x974f32,_0x2eba9f){_0x974f32=_0x974f32-0x0;var _0x2473f7=_0xc629[_0x974f32];return _0x2473f7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9c62('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9c62('0x1'));var moment=require(_0x9c62('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9c62('0x3'));var util=require(_0x9c62('0x4'));var path=require(_0x9c62('0x5'));var sox=require(_0x9c62('0x6'));var csv=require(_0x9c62('0x7'));var ejs=require(_0x9c62('0x8'));var fs=require('fs');var fs_extra=require(_0x9c62('0x9'));var _=require(_0x9c62('0xa'));var squel=require(_0x9c62('0xb'));var crypto=require(_0x9c62('0xc'));var jsforce=require(_0x9c62('0xd'));var deskjs=require(_0x9c62('0xe'));var toCsv=require(_0x9c62('0x7'));var querystring=require(_0x9c62('0xf'));var Papa=require(_0x9c62('0x10'));var Redis=require(_0x9c62('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9c62('0x12'));var as=require(_0x9c62('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9c62('0x14'))(_0x9c62('0x15'));var utils=require(_0x9c62('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9c62('0x17'));var db=require(_0x9c62('0x18'))['db'];function respondWithStatusCode(_0x5eea6a,_0x359711){_0x359711=_0x359711||0xcc;return function(_0x433edf){if(_0x433edf){return _0x5eea6a[_0x9c62('0x19')](_0x359711);}return _0x5eea6a[_0x9c62('0x1a')](_0x359711)[_0x9c62('0x1b')]();};}function respondWithResult(_0x58d9c8,_0x233e0a){_0x233e0a=_0x233e0a||0xc8;return function(_0x2794a5){if(_0x2794a5){return _0x58d9c8[_0x9c62('0x1a')](_0x233e0a)[_0x9c62('0x1c')](_0x2794a5);}};}function respondWithFilteredResult(_0x2b5008,_0x567df9){return function(_0x2c3d34){if(_0x2c3d34){var _0xf499fd=typeof _0x567df9[_0x9c62('0x1d')]===_0x9c62('0x1e')&&typeof _0x567df9[_0x9c62('0x1f')]===_0x9c62('0x1e');var _0x14864c=_0x2c3d34[_0x9c62('0x20')];var _0x336524=_0xf499fd?0x0:_0x567df9[_0x9c62('0x1d')];var _0x507433=_0xf499fd?_0x2c3d34[_0x9c62('0x20')]:_0x567df9[_0x9c62('0x1d')]+_0x567df9['limit'];var _0xf4ba98;if(_0x507433>=_0x14864c){_0x507433=_0x14864c;_0xf4ba98=0xc8;}else{_0xf4ba98=0xce;}_0x2b5008[_0x9c62('0x1a')](_0xf4ba98);return _0x2b5008[_0x9c62('0x21')](_0x9c62('0x22'),_0x336524+'-'+_0x507433+'/'+_0x14864c)['json'](_0x2c3d34);}return null;};}function patchUpdates(_0x4d5c2b){return function(_0x2801cc){try{jsonpatch['apply'](_0x2801cc,_0x4d5c2b,!![]);}catch(_0x5b8864){return BPromise[_0x9c62('0x23')](_0x5b8864);}return _0x2801cc[_0x9c62('0x24')]();};}function saveUpdates(_0x4d26f7,_0x1f3e15){return function(_0x138437){if(_0x138437){return _0x138437[_0x9c62('0x25')](_0x4d26f7)['then'](function(_0x3db39c){return _0x3db39c;});}return null;};}function removeEntity(_0x2c77f8,_0x32d0a4){return function(_0x187fa6){if(_0x187fa6){return _0x187fa6[_0x9c62('0x26')]()['then'](function(){var _0x209cd4=_0x187fa6[_0x9c62('0x27')]({'plain':!![]});var _0xf43115=_0x9c62('0x28');return db['UserProfileResource'][_0x9c62('0x26')]({'where':{'type':_0xf43115,'resourceId':_0x209cd4['id']}})['then'](function(){return _0x187fa6;});})[_0x9c62('0x29')](function(){_0x2c77f8[_0x9c62('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1401e5,_0x59fc85){return function(_0x50ae2){if(!_0x50ae2){_0x1401e5[_0x9c62('0x19')](0x194);}return _0x50ae2;};}function handleError(_0x32bf1a,_0x2fed2d){_0x2fed2d=_0x2fed2d||0x1f4;return function(_0x52a7d4){logger[_0x9c62('0x2a')](_0x52a7d4[_0x9c62('0x2b')]);if(_0x52a7d4[_0x9c62('0x2c')]){delete _0x52a7d4['name'];}_0x32bf1a[_0x9c62('0x1a')](_0x2fed2d)['send'](_0x52a7d4);};}exports['index']=function(_0x2cd085,_0x24ca13){var _0x387d8e={},_0x148462={},_0x50f1d9={'count':0x0,'rows':[]};var _0x26b938=_['map'](db['SquareOdbc'][_0x9c62('0x2d')],function(_0xdb714b){return{'name':_0xdb714b[_0x9c62('0x2e')],'type':_0xdb714b[_0x9c62('0x2f')][_0x9c62('0x30')]};});_0x148462[_0x9c62('0x31')]=_[_0x9c62('0x32')](_0x26b938,'name');_0x148462[_0x9c62('0x33')]=_[_0x9c62('0x34')](_0x2cd085[_0x9c62('0x33')]);_0x148462[_0x9c62('0x35')]=_['intersection'](_0x148462[_0x9c62('0x31')],_0x148462[_0x9c62('0x33')]);_0x387d8e['attributes']=_['intersection'](_0x148462['model'],qs[_0x9c62('0x36')](_0x2cd085[_0x9c62('0x33')][_0x9c62('0x36')]));_0x387d8e[_0x9c62('0x37')]=_0x387d8e['attributes'][_0x9c62('0x38')]?_0x387d8e['attributes']:_0x148462['model'];if(!_0x2cd085[_0x9c62('0x33')][_0x9c62('0x39')]('nolimit')){_0x387d8e[_0x9c62('0x1f')]=qs[_0x9c62('0x1f')](_0x2cd085['query'][_0x9c62('0x1f')]);_0x387d8e[_0x9c62('0x1d')]=qs[_0x9c62('0x1d')](_0x2cd085[_0x9c62('0x33')]['offset']);}_0x387d8e['order']=qs[_0x9c62('0x3a')](_0x2cd085[_0x9c62('0x33')][_0x9c62('0x3a')]);_0x387d8e['where']=qs['filters'](_[_0x9c62('0x3b')](_0x2cd085[_0x9c62('0x33')],_0x148462[_0x9c62('0x35')]),_0x26b938);if(_0x2cd085['query'][_0x9c62('0x3c')]){_0x387d8e[_0x9c62('0x3d')]=_[_0x9c62('0x3e')](_0x387d8e[_0x9c62('0x3d')],{'$or':_[_0x9c62('0x32')](_0x26b938,function(_0x33a585){if(_0x33a585[_0x9c62('0x2f')]!==_0x9c62('0x3f')){var _0x4c584c={};_0x4c584c[_0x33a585[_0x9c62('0x2c')]]={'$like':'%'+_0x2cd085[_0x9c62('0x33')][_0x9c62('0x3c')]+'%'};return _0x4c584c;}})});}_0x387d8e=_[_0x9c62('0x3e')]({},_0x387d8e,_0x2cd085[_0x9c62('0x40')]);var _0x59ba71={'where':_0x387d8e[_0x9c62('0x3d')]};return db[_0x9c62('0x41')]['count'](_0x59ba71)[_0x9c62('0x29')](function(_0x2e7ba2){_0x50f1d9['count']=_0x2e7ba2;if(_0x2cd085[_0x9c62('0x33')][_0x9c62('0x42')]){_0x387d8e[_0x9c62('0x43')]=[{'all':!![]}];}return db[_0x9c62('0x41')][_0x9c62('0x44')](_0x387d8e);})[_0x9c62('0x29')](function(_0x320ac4){_0x50f1d9[_0x9c62('0x45')]=_0x320ac4;return _0x50f1d9;})[_0x9c62('0x29')](respondWithFilteredResult(_0x24ca13,_0x387d8e))[_0x9c62('0x46')](handleError(_0x24ca13,null));};exports[_0x9c62('0x47')]=function(_0x54cb97,_0x19da42){var _0x486619={'raw':!![],'where':{'id':_0x54cb97[_0x9c62('0x48')]['id']}},_0x606d65={};_0x606d65[_0x9c62('0x31')]=_[_0x9c62('0x34')](db['SquareOdbc'][_0x9c62('0x2d')]);_0x606d65[_0x9c62('0x33')]=_['keys'](_0x54cb97[_0x9c62('0x33')]);_0x606d65['filters']=_['intersection'](_0x606d65[_0x9c62('0x31')],_0x606d65['query']);_0x486619[_0x9c62('0x37')]=_[_0x9c62('0x49')](_0x606d65['model'],qs[_0x9c62('0x36')](_0x54cb97[_0x9c62('0x33')][_0x9c62('0x36')]));_0x486619[_0x9c62('0x37')]=_0x486619[_0x9c62('0x37')][_0x9c62('0x38')]?_0x486619[_0x9c62('0x37')]:_0x606d65[_0x9c62('0x31')];if(_0x54cb97[_0x9c62('0x33')][_0x9c62('0x42')]){_0x486619['include']=[{'all':!![]}];}_0x486619=_['merge']({},_0x486619,_0x54cb97[_0x9c62('0x40')]);return db[_0x9c62('0x41')][_0x9c62('0x4a')](_0x486619)[_0x9c62('0x29')](handleEntityNotFound(_0x19da42,null))[_0x9c62('0x29')](respondWithResult(_0x19da42,null))['catch'](handleError(_0x19da42,null));};exports['create']=function(_0x9f3fc2,_0x58a119){return db['SquareOdbc'][_0x9c62('0x4b')](_0x9f3fc2[_0x9c62('0x4c')],{})[_0x9c62('0x29')](function(_0x5c2dc4){var _0xb6921=_0x9f3fc2[_0x9c62('0x4d')][_0x9c62('0x27')]({'plain':!![]});if(!_0xb6921)throw new Error(_0x9c62('0x4e'));if(_0xb6921[_0x9c62('0x4f')]==='user'){var _0x56c00a=_0x5c2dc4[_0x9c62('0x27')]({'plain':!![]});var _0x2feb06=_0x9c62('0x28');return db[_0x9c62('0x50')][_0x9c62('0x4a')]({'where':{'name':_0x2feb06,'userProfileId':_0xb6921[_0x9c62('0x51')]},'raw':!![]})['then'](function(_0x2b70a4){if(_0x2b70a4&&_0x2b70a4[_0x9c62('0x52')]===0x0){return db['UserProfileResource'][_0x9c62('0x4b')]({'name':_0x56c00a[_0x9c62('0x2c')],'resourceId':_0x56c00a['id'],'type':_0x2b70a4[_0x9c62('0x2c')],'sectionId':_0x2b70a4['id']},{})[_0x9c62('0x29')](function(){return _0x5c2dc4;});}else{return _0x5c2dc4;}})[_0x9c62('0x46')](function(_0x5d0722){logger[_0x9c62('0x2a')](_0x9c62('0x53'),_0x5d0722);throw _0x5d0722;});}return _0x5c2dc4;})[_0x9c62('0x29')](respondWithResult(_0x58a119,0xc9))[_0x9c62('0x46')](handleError(_0x58a119,null));};exports['update']=function(_0xcf7596,_0x5aa790){if(_0xcf7596[_0x9c62('0x4c')]['id']){delete _0xcf7596[_0x9c62('0x4c')]['id'];}return db[_0x9c62('0x41')][_0x9c62('0x4a')]({'where':{'id':_0xcf7596['params']['id']}})[_0x9c62('0x29')](handleEntityNotFound(_0x5aa790,null))[_0x9c62('0x29')](saveUpdates(_0xcf7596[_0x9c62('0x4c')],null))['then'](respondWithResult(_0x5aa790,null))[_0x9c62('0x46')](handleError(_0x5aa790,null));};exports['destroy']=function(_0x2b4479,_0x550ef5){return db['SquareOdbc'][_0x9c62('0x4a')]({'where':{'id':_0x2b4479[_0x9c62('0x48')]['id']}})[_0x9c62('0x29')](handleEntityNotFound(_0x550ef5,null))['then'](removeEntity(_0x550ef5,null))['catch'](handleError(_0x550ef5,null));};exports[_0x9c62('0x54')]=function(_0xfcf9b7,_0x1d1b0a,_0x5e035c){var _0x414d34;return db[_0x9c62('0x41')][_0x9c62('0x4a')]({'where':{'id':_0xfcf9b7[_0x9c62('0x48')]['id']},'attributes':['id','dsn']})[_0x9c62('0x29')](handleEntityNotFound(_0x1d1b0a,null))[_0x9c62('0x29')](function(_0x1ebe9d){if(_0x1ebe9d){var _0x24e0ef=require(_0x9c62('0x55'))();_0x24e0ef['openSync'](_0x1ebe9d[_0x9c62('0x56')]);_0x24e0ef[_0x9c62('0x57')]();return _0x1ebe9d;}})[_0x9c62('0x29')](respondWithResult(_0x1d1b0a,null))[_0x9c62('0x46')](handleError(_0x1d1b0a,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 9a06ef3..d1bc192 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 _0x984a=['lodash','api','moment','bluebird','path','rimraf','exports','define','SquareOdbc','square_odbc'];(function(_0x402c8f,_0x30cc1d){var _0x11e809=function(_0x4ccfa3){while(--_0x4ccfa3){_0x402c8f['push'](_0x402c8f['shift']());}};_0x11e809(++_0x30cc1d);}(_0x984a,0x96));var _0xa984=function(_0xfc42b3,_0x1dd6f4){_0xfc42b3=_0xfc42b3-0x0;var _0x4bb392=_0x984a[_0xfc42b3];return _0x4bb392;};'use strict';var _=require(_0xa984('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa984('0x1'));var moment=require(_0xa984('0x2'));var BPromise=require(_0xa984('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa984('0x4'));var rimraf=require(_0xa984('0x5'));var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module[_0xa984('0x6')]=function(_0x5dbb86,_0x27a118){return _0x5dbb86[_0xa984('0x7')](_0xa984('0x8'),attributes,{'tableName':_0xa984('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed31=['bluebird','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','square_odbc','util','../../config/logger','api','moment'];(function(_0x1005ab,_0x188736){var _0x3fed9e=function(_0x3629f7){while(--_0x3629f7){_0x1005ab['push'](_0x1005ab['shift']());}};_0x3fed9e(++_0x188736);}(_0xed31,0xa1));var _0x1ed3=function(_0x3d1ef3,_0x5dd67c){_0x3d1ef3=_0x3d1ef3-0x0;var _0x329935=_0xed31[_0x3d1ef3];return _0x329935;};'use strict';var _=require('lodash');var util=require(_0x1ed3('0x0'));var logger=require(_0x1ed3('0x1'))(_0x1ed3('0x2'));var moment=require(_0x1ed3('0x3'));var BPromise=require(_0x1ed3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1ed3('0x5'));var rimraf=require(_0x1ed3('0x6'));var config=require(_0x1ed3('0x7'));var attributes=require(_0x1ed3('0x8'));module[_0x1ed3('0x9')]=function(_0x51eb37,_0x2a8518){return _0x51eb37['define']('SquareOdbc',attributes,{'tableName':_0x1ed3('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 e6cad5e..73fb6b1 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 _0x8f50=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','map','model','include','stringify','moment','bluebird'];(function(_0x3f2245,_0x40101c){var _0x3eb438=function(_0x697376){while(--_0x697376){_0x3f2245['push'](_0x3f2245['shift']());}};_0x3eb438(++_0x40101c);}(_0x8f50,0x6e));var _0x08f5=function(_0x329862,_0x59aec9){_0x329862=_0x329862-0x0;var _0x5a45d6=_0x8f50[_0x329862];return _0x5a45d6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x08f5('0x0'));var BPromise=require(_0x08f5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x08f5('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x08f5('0x3'));var logger=require(_0x08f5('0x4'))(_0x08f5('0x5'));var config=require(_0x08f5('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3b1dbf,_0x22efc0,_0x122560){return new BPromise(function(_0x48a6f4,_0x551c67){return client[_0x08f5('0x7')](_0x3b1dbf,_0x122560)[_0x08f5('0x8')](function(_0xa2dda7){logger[_0x08f5('0x9')](_0x08f5('0xa'),_0x22efc0,_0x08f5('0xb'));logger[_0x08f5('0xc')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x22efc0,'request\x20sent',JSON['stringify'](_0xa2dda7));if(_0xa2dda7['error']){if(_0xa2dda7['error'][_0x08f5('0xd')]===0x1f4){logger[_0x08f5('0xe')]('SquareOdbc,\x20%s,\x20%s',_0x22efc0,_0xa2dda7[_0x08f5('0xe')][_0x08f5('0xf')]);return _0x551c67(_0xa2dda7[_0x08f5('0xe')][_0x08f5('0xf')]);}logger[_0x08f5('0xe')](_0x08f5('0xa'),_0x22efc0,_0xa2dda7[_0x08f5('0xe')]['message']);return _0x48a6f4(_0xa2dda7[_0x08f5('0xe')][_0x08f5('0xf')]);}else{logger[_0x08f5('0x9')](_0x08f5('0xa'),_0x22efc0,_0x08f5('0xb'));_0x48a6f4(_0xa2dda7[_0x08f5('0x10')]['message']);}})['catch'](function(_0x2babaa){logger[_0x08f5('0xe')]('SquareOdbc,\x20%s,\x20%s',_0x22efc0,_0x2babaa);_0x551c67(_0x2babaa);});});}exports[_0x08f5('0x11')]=function(_0x51b5b5){var _0xa0b88d=this;return new Promise(function(_0x2dcdd4,_0x97f904){return db[_0x08f5('0x12')][_0x08f5('0x13')]({'raw':_0x51b5b5['options']?_0x51b5b5[_0x08f5('0x14')][_0x08f5('0x15')]===undefined?!![]:![]:!![],'where':_0x51b5b5[_0x08f5('0x14')]?_0x51b5b5[_0x08f5('0x14')][_0x08f5('0x16')]||null:null,'attributes':_0x51b5b5[_0x08f5('0x14')]?_0x51b5b5[_0x08f5('0x14')][_0x08f5('0x17')]||null:null,'include':_0x51b5b5[_0x08f5('0x14')]?_0x51b5b5[_0x08f5('0x14')]['include']?_[_0x08f5('0x18')](_0x51b5b5[_0x08f5('0x14')]['include'],function(_0x1081f3){return{'model':db[_0x1081f3[_0x08f5('0x19')]],'as':_0x1081f3['as'],'attributes':_0x1081f3[_0x08f5('0x17')],'include':_0x1081f3[_0x08f5('0x1a')]?_[_0x08f5('0x18')](_0x1081f3[_0x08f5('0x1a')],function(_0x22a5cc){return{'model':db[_0x22a5cc[_0x08f5('0x19')]],'as':_0x22a5cc['as'],'attributes':_0x22a5cc[_0x08f5('0x17')],'include':_0x22a5cc[_0x08f5('0x1a')]?_[_0x08f5('0x18')](_0x22a5cc[_0x08f5('0x1a')],function(_0x494ebf){return{'model':db[_0x494ebf[_0x08f5('0x19')]],'as':_0x494ebf['as'],'attributes':_0x494ebf['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2178d6){logger[_0x08f5('0x9')](_0x08f5('0x11'),_0x51b5b5);logger[_0x08f5('0xc')](_0x08f5('0x11'),_0x51b5b5,JSON[_0x08f5('0x1b')](_0x2178d6));_0x2dcdd4(_0x2178d6);})['catch'](function(_0x294dde){logger[_0x08f5('0xe')](_0x08f5('0x11'),_0x294dde[_0x08f5('0xf')],_0x51b5b5);_0x97f904(_0xa0b88d['error'](0x1f4,_0x294dde['message']));});});}; \ No newline at end of file +var _0x906c=['attributes','map','model','include','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareOdbc,\x20%s,\x20%s','request\x20sent','result','catch','ShowSquareOdbc','SquareOdbc','find','options','where'];(function(_0x479819,_0x32c583){var _0x7f41e8=function(_0x515823){while(--_0x515823){_0x479819['push'](_0x479819['shift']());}};_0x7f41e8(++_0x32c583);}(_0x906c,0xa9));var _0xc906=function(_0x25ba89,_0x2952b4){_0x25ba89=_0x25ba89-0x0;var _0x5f4560=_0x906c[_0x25ba89];return _0x5f4560;};'use strict';var _=require(_0xc906('0x0'));var util=require('util');var moment=require(_0xc906('0x1'));var BPromise=require('bluebird');var rs=require(_0xc906('0x2'));var fs=require('fs');var Redis=require(_0xc906('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc906('0x4'));var logger=require(_0xc906('0x5'))(_0xc906('0x6'));var config=require(_0xc906('0x7'));var jayson=require(_0xc906('0x8'));var client=jayson[_0xc906('0x9')][_0xc906('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ee09b,_0x539f77,_0x5daaa5){return new BPromise(function(_0x405c4f,_0x26a632){return client[_0xc906('0xb')](_0x2ee09b,_0x5daaa5)[_0xc906('0xc')](function(_0x30b3ad){logger[_0xc906('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x539f77,'request\x20sent');logger[_0xc906('0xe')](_0xc906('0xf'),_0x539f77,'request\x20sent',JSON[_0xc906('0x10')](_0x30b3ad));if(_0x30b3ad[_0xc906('0x11')]){if(_0x30b3ad[_0xc906('0x11')][_0xc906('0x12')]===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x539f77,_0x30b3ad['error']['message']);return _0x26a632(_0x30b3ad[_0xc906('0x11')][_0xc906('0x13')]);}logger[_0xc906('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x539f77,_0x30b3ad['error'][_0xc906('0x13')]);return _0x405c4f(_0x30b3ad[_0xc906('0x11')][_0xc906('0x13')]);}else{logger[_0xc906('0xd')](_0xc906('0x14'),_0x539f77,_0xc906('0x15'));_0x405c4f(_0x30b3ad[_0xc906('0x16')]['message']);}})[_0xc906('0x17')](function(_0x37e8e9){logger[_0xc906('0x11')](_0xc906('0x14'),_0x539f77,_0x37e8e9);_0x26a632(_0x37e8e9);});});}exports[_0xc906('0x18')]=function(_0x270a32){var _0x1344ce=this;return new Promise(function(_0x5d16d7,_0x54f948){return db[_0xc906('0x19')][_0xc906('0x1a')]({'raw':_0x270a32[_0xc906('0x1b')]?_0x270a32['options']['raw']===undefined?!![]:![]:!![],'where':_0x270a32[_0xc906('0x1b')]?_0x270a32['options'][_0xc906('0x1c')]||null:null,'attributes':_0x270a32[_0xc906('0x1b')]?_0x270a32[_0xc906('0x1b')][_0xc906('0x1d')]||null:null,'include':_0x270a32[_0xc906('0x1b')]?_0x270a32[_0xc906('0x1b')]['include']?_[_0xc906('0x1e')](_0x270a32['options']['include'],function(_0x32a4de){return{'model':db[_0x32a4de[_0xc906('0x1f')]],'as':_0x32a4de['as'],'attributes':_0x32a4de[_0xc906('0x1d')],'include':_0x32a4de[_0xc906('0x20')]?_[_0xc906('0x1e')](_0x32a4de[_0xc906('0x20')],function(_0x3bc6df){return{'model':db[_0x3bc6df[_0xc906('0x1f')]],'as':_0x3bc6df['as'],'attributes':_0x3bc6df[_0xc906('0x1d')],'include':_0x3bc6df[_0xc906('0x20')]?_[_0xc906('0x1e')](_0x3bc6df[_0xc906('0x20')],function(_0x39c46a){return{'model':db[_0x39c46a[_0xc906('0x1f')]],'as':_0x39c46a['as'],'attributes':_0x39c46a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x23caa3){logger['info']('ShowSquareOdbc',_0x270a32);logger[_0xc906('0xe')](_0xc906('0x18'),_0x270a32,JSON[_0xc906('0x10')](_0x23caa3));_0x5d16d7(_0x23caa3);})[_0xc906('0x17')](function(_0x514d2d){logger[_0xc906('0x11')](_0xc906('0x18'),_0x514d2d['message'],_0x270a32);_0x54f948(_0x1344ce['error'](0x1f4,_0x514d2d[_0xc906('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 1993c57..15e1b74 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 _0x68ee=['get','isAuthenticated','/:id','show','getUsers','create','post','/:id/users','addUsers','update','delete','removeUsers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x4ae916,_0x36a86a){var _0x54e145=function(_0x559acc){while(--_0x559acc){_0x4ae916['push'](_0x4ae916['shift']());}};_0x54e145(++_0x36a86a);}(_0x68ee,0xd3));var _0xe68e=function(_0x2cd7d8,_0x132e4f){_0x2cd7d8=_0x2cd7d8-0x0;var _0x462db1=_0x68ee[_0x2cd7d8];return _0x462db1;};'use strict';var multer=require(_0xe68e('0x0'));var util=require(_0xe68e('0x1'));var path=require(_0xe68e('0x2'));var timeout=require(_0xe68e('0x3'));var express=require(_0xe68e('0x4'));var router=express[_0xe68e('0x5')]();var fs_extra=require(_0xe68e('0x6'));var auth=require(_0xe68e('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe68e('0x8'));var controller=require('./squareProject.controller');router[_0xe68e('0x9')]('/',auth[_0xe68e('0xa')](),controller['index']);router[_0xe68e('0x9')](_0xe68e('0xb'),auth['isAuthenticated'](),controller[_0xe68e('0xc')]);router[_0xe68e('0x9')]('/:id/users',auth[_0xe68e('0xa')](),controller[_0xe68e('0xd')]);router['post']('/',auth[_0xe68e('0xa')](),controller[_0xe68e('0xe')]);router[_0xe68e('0xf')](_0xe68e('0x10'),auth[_0xe68e('0xa')](),controller[_0xe68e('0x11')]);router['put']('/:id',auth[_0xe68e('0xa')](),controller[_0xe68e('0x12')]);router[_0xe68e('0x13')](_0xe68e('0xb'),auth[_0xe68e('0xa')](),controller['destroy']);router[_0xe68e('0x13')]('/:id/users',auth[_0xe68e('0xa')](),controller[_0xe68e('0x14')]);module[_0xe68e('0x15')]=router; \ No newline at end of file +var _0x793b=['connect-timeout','express','fs-extra','../../components/auth/service','./squareProject.controller','get','isAuthenticated','index','/:id','show','/:id/users','getUsers','post','put','update','delete','destroy','removeUsers','exports','multer','util','path'];(function(_0x5ede20,_0x3b508d){var _0xd2579d=function(_0x4248d4){while(--_0x4248d4){_0x5ede20['push'](_0x5ede20['shift']());}};_0xd2579d(++_0x3b508d);}(_0x793b,0x189));var _0xb793=function(_0x42c966,_0x3cbefb){_0x42c966=_0x42c966-0x0;var _0x2ae2e4=_0x793b[_0x42c966];return _0x2ae2e4;};'use strict';var multer=require(_0xb793('0x0'));var util=require(_0xb793('0x1'));var path=require(_0xb793('0x2'));var timeout=require(_0xb793('0x3'));var express=require(_0xb793('0x4'));var router=express['Router']();var fs_extra=require(_0xb793('0x5'));var auth=require(_0xb793('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb793('0x7'));router[_0xb793('0x8')]('/',auth[_0xb793('0x9')](),controller[_0xb793('0xa')]);router[_0xb793('0x8')](_0xb793('0xb'),auth[_0xb793('0x9')](),controller[_0xb793('0xc')]);router[_0xb793('0x8')](_0xb793('0xd'),auth[_0xb793('0x9')](),controller[_0xb793('0xe')]);router[_0xb793('0xf')]('/',auth[_0xb793('0x9')](),controller['create']);router[_0xb793('0xf')](_0xb793('0xd'),auth['isAuthenticated'](),controller['addUsers']);router[_0xb793('0x10')](_0xb793('0xb'),auth['isAuthenticated'](),controller[_0xb793('0x11')]);router[_0xb793('0x12')]('/:id',auth[_0xb793('0x9')](),controller[_0xb793('0x13')]);router[_0xb793('0x12')](_0xb793('0xd'),auth[_0xb793('0x9')](),controller[_0xb793('0x14')]);module[_0xb793('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 4af8e41..f356bec 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 _0xcfcb=['utf8','production','sequelize','STRING','TEXT','BLOB','long','getDataValue','preproduction','toString'];(function(_0x3ee08a,_0x4ac4b9){var _0x14b901=function(_0x94f9f7){while(--_0x94f9f7){_0x3ee08a['push'](_0x3ee08a['shift']());}};_0x14b901(++_0x4ac4b9);}(_0xcfcb,0x7a));var _0xbcfc=function(_0x2daab7,_0x377337){_0x2daab7=_0x2daab7-0x0;var _0x1714da=_0xcfcb[_0x2daab7];return _0x1714da;};'use strict';var Sequelize=require(_0xbcfc('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xbcfc('0x1')]},'notes':{'type':Sequelize[_0xbcfc('0x2')]},'preproduction':{'type':Sequelize[_0xbcfc('0x3')](_0xbcfc('0x4')),'get':function(){if(this[_0xbcfc('0x5')](_0xbcfc('0x6'))){return this[_0xbcfc('0x5')](_0xbcfc('0x6'))[_0xbcfc('0x7')](_0xbcfc('0x8'));}}},'production':{'type':Sequelize[_0xbcfc('0x3')](_0xbcfc('0x4')),'get':function(){if(this[_0xbcfc('0x5')](_0xbcfc('0x9'))){return this[_0xbcfc('0x5')](_0xbcfc('0x9'))[_0xbcfc('0x7')]('utf8');}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x95b5=['DATE','sequelize','STRING','preproduction','getDataValue','toString','production'];(function(_0xcf66f6,_0x281d62){var _0x1c6602=function(_0x8bcff4){while(--_0x8bcff4){_0xcf66f6['push'](_0xcf66f6['shift']());}};_0x1c6602(++_0x281d62);}(_0x95b5,0x143));var _0x595b=function(_0x458775,_0x523411){_0x458775=_0x458775-0x0;var _0x48eb06=_0x95b5[_0x458775];return _0x48eb06;};'use strict';var Sequelize=require(_0x595b('0x0'));module['exports']={'name':{'type':Sequelize[_0x595b('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize['BLOB']('long'),'get':function(){if(this['getDataValue'](_0x595b('0x2'))){return this[_0x595b('0x3')](_0x595b('0x2'))[_0x595b('0x4')]('utf8');}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0x595b('0x3')](_0x595b('0x5'))){return this[_0x595b('0x3')](_0x595b('0x5'))[_0x595b('0x4')]('utf8');}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x595b('0x6')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index aa8ab63..3b47420 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 _0x9a82=['length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','addUsers','omit','ids','removeUsers','isArray','userSquareProject:remove','emit','getUsers','findOne','User','pick','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','./squareProject.socket','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','destroy','then','get','SquareProjects','UserProfileResource','sendStatus','error','stack','name','map','SquareProject','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x9a82,0xe4));var _0x29a8=function(_0x4aba0d,_0x235628){_0x4aba0d=_0x4aba0d-0x0;var _0x2b7e6c=_0x9a82[_0x4aba0d];return _0x2b7e6c;};'use strict';var emlformat=require(_0x29a8('0x0'));var rimraf=require(_0x29a8('0x1'));var zipdir=require(_0x29a8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x29a8('0x3'));var moment=require(_0x29a8('0x4'));var BPromise=require(_0x29a8('0x5'));var Mustache=require(_0x29a8('0x6'));var util=require(_0x29a8('0x7'));var path=require('path');var sox=require(_0x29a8('0x8'));var csv=require(_0x29a8('0x9'));var ejs=require(_0x29a8('0xa'));var fs=require('fs');var fs_extra=require(_0x29a8('0xb'));var _=require(_0x29a8('0xc'));var squel=require(_0x29a8('0xd'));var crypto=require(_0x29a8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x29a8('0xf'));var toCsv=require(_0x29a8('0x9'));var querystring=require(_0x29a8('0x10'));var Papa=require(_0x29a8('0x11'));var Redis=require(_0x29a8('0x12'));var authService=require(_0x29a8('0x13'));var qs=require(_0x29a8('0x14'));var as=require(_0x29a8('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x29a8('0x16'))(_0x29a8('0x17'));var utils=require(_0x29a8('0x18'));var config=require(_0x29a8('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x29a8('0x1a'))['db'];config[_0x29a8('0x1b')]=_['defaults'](config[_0x29a8('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x29a8('0x1b')]));require(_0x29a8('0x1c'))['register'](socket);function respondWithStatusCode(_0x32aae6,_0x56d5cc){_0x56d5cc=_0x56d5cc||0xcc;return function(_0x307e89){if(_0x307e89){return _0x32aae6['sendStatus'](_0x56d5cc);}return _0x32aae6[_0x29a8('0x1d')](_0x56d5cc)[_0x29a8('0x1e')]();};}function respondWithResult(_0x959f94,_0x326949){_0x326949=_0x326949||0xc8;return function(_0x4772ce){if(_0x4772ce){return _0x959f94[_0x29a8('0x1d')](_0x326949)[_0x29a8('0x1f')](_0x4772ce);}};}function respondWithFilteredResult(_0x525f43,_0x51dcae){return function(_0x369f4f){if(_0x369f4f){var _0x522da3=typeof _0x51dcae['offset']===_0x29a8('0x20')&&typeof _0x51dcae[_0x29a8('0x21')]===_0x29a8('0x20');var _0x264f72=_0x369f4f[_0x29a8('0x22')];var _0x265c24=_0x522da3?0x0:_0x51dcae['offset'];var _0x450907=_0x522da3?_0x369f4f[_0x29a8('0x22')]:_0x51dcae[_0x29a8('0x23')]+_0x51dcae[_0x29a8('0x21')];var _0x45c054;if(_0x450907>=_0x264f72){_0x450907=_0x264f72;_0x45c054=0xc8;}else{_0x45c054=0xce;}_0x525f43['status'](_0x45c054);return _0x525f43['set'](_0x29a8('0x24'),_0x265c24+'-'+_0x450907+'/'+_0x264f72)[_0x29a8('0x1f')](_0x369f4f);}return null;};}function patchUpdates(_0x42c99b){return function(_0x2a6a66){try{jsonpatch['apply'](_0x2a6a66,_0x42c99b,!![]);}catch(_0x12e1a6){return BPromise[_0x29a8('0x25')](_0x12e1a6);}return _0x2a6a66[_0x29a8('0x26')]();};}function saveUpdates(_0x1f6876,_0x22d05b){return function(_0x1ab5bf){if(_0x1ab5bf){return _0x1ab5bf['update'](_0x1f6876)['then'](function(_0x8a525b){return _0x8a525b;});}return null;};}function removeEntity(_0x163ce8,_0x5755a7){return function(_0x5d03de){if(_0x5d03de){return _0x5d03de[_0x29a8('0x27')]()[_0x29a8('0x28')](function(){var _0x28da94=_0x5d03de[_0x29a8('0x29')]({'plain':!![]});var _0x41e28c=_0x29a8('0x2a');return db[_0x29a8('0x2b')][_0x29a8('0x27')]({'where':{'type':_0x41e28c,'resourceId':_0x28da94['id']}})['then'](function(){return _0x5d03de;});})[_0x29a8('0x28')](function(){_0x163ce8[_0x29a8('0x1d')](0xcc)[_0x29a8('0x1e')]();});}};}function handleEntityNotFound(_0xde4a0a,_0x5c07f4){return function(_0x52d8d5){if(!_0x52d8d5){_0xde4a0a[_0x29a8('0x2c')](0x194);}return _0x52d8d5;};}function handleError(_0x2a6f78,_0x1ac451){_0x1ac451=_0x1ac451||0x1f4;return function(_0x4bd514){logger[_0x29a8('0x2d')](_0x4bd514[_0x29a8('0x2e')]);if(_0x4bd514[_0x29a8('0x2f')]){delete _0x4bd514['name'];}_0x2a6f78[_0x29a8('0x1d')](_0x1ac451)['send'](_0x4bd514);};}exports['index']=function(_0x575dcd,_0x5ec6fb){var _0x1094f4={},_0xeaa5e8={},_0x5b583d={'count':0x0,'rows':[]};var _0xdffd51=_[_0x29a8('0x30')](db[_0x29a8('0x31')][_0x29a8('0x32')],function(_0x5dc68e){return{'name':_0x5dc68e[_0x29a8('0x33')],'type':_0x5dc68e['type'][_0x29a8('0x34')]};});_0xeaa5e8[_0x29a8('0x35')]=_['map'](_0xdffd51,_0x29a8('0x2f'));_0xeaa5e8[_0x29a8('0x36')]=_[_0x29a8('0x37')](_0x575dcd[_0x29a8('0x36')]);_0xeaa5e8[_0x29a8('0x38')]=_[_0x29a8('0x39')](_0xeaa5e8[_0x29a8('0x35')],_0xeaa5e8[_0x29a8('0x36')]);_0x1094f4[_0x29a8('0x3a')]=_['intersection'](_0xeaa5e8[_0x29a8('0x35')],qs[_0x29a8('0x3b')](_0x575dcd[_0x29a8('0x36')][_0x29a8('0x3b')]));_0x1094f4[_0x29a8('0x3a')]=_0x1094f4['attributes'][_0x29a8('0x3c')]?_0x1094f4[_0x29a8('0x3a')]:_0xeaa5e8['model'];if(!_0x575dcd['query'][_0x29a8('0x3d')](_0x29a8('0x3e'))){_0x1094f4[_0x29a8('0x21')]=qs[_0x29a8('0x21')](_0x575dcd[_0x29a8('0x36')][_0x29a8('0x21')]);_0x1094f4[_0x29a8('0x23')]=qs[_0x29a8('0x23')](_0x575dcd['query'][_0x29a8('0x23')]);}_0x1094f4['order']=qs[_0x29a8('0x3f')](_0x575dcd['query']['sort']);_0x1094f4[_0x29a8('0x40')]=qs['filters'](_['pick'](_0x575dcd['query'],_0xeaa5e8[_0x29a8('0x38')]),_0xdffd51);if(_0x575dcd[_0x29a8('0x36')][_0x29a8('0x41')]){_0x1094f4[_0x29a8('0x40')]=_['merge'](_0x1094f4[_0x29a8('0x40')],{'$or':_[_0x29a8('0x30')](_0xdffd51,function(_0x4d0f0d){if(_0x4d0f0d['type']!==_0x29a8('0x42')){var _0x34a9e2={};_0x34a9e2[_0x4d0f0d[_0x29a8('0x2f')]]={'$like':'%'+_0x575dcd[_0x29a8('0x36')][_0x29a8('0x41')]+'%'};return _0x34a9e2;}})});}_0x1094f4=_[_0x29a8('0x43')]({},_0x1094f4,_0x575dcd['options']);var _0x1f7853={'where':_0x1094f4[_0x29a8('0x40')]};return db['SquareProject'][_0x29a8('0x22')](_0x1f7853)[_0x29a8('0x28')](function(_0x53d0cc){_0x5b583d[_0x29a8('0x22')]=_0x53d0cc;if(_0x575dcd[_0x29a8('0x36')][_0x29a8('0x44')]){_0x1094f4[_0x29a8('0x45')]=[{'all':!![]}];}return db['SquareProject'][_0x29a8('0x46')](_0x1094f4);})['then'](function(_0x166d5b){_0x5b583d[_0x29a8('0x47')]=_0x166d5b;return _0x5b583d;})['then'](respondWithFilteredResult(_0x5ec6fb,_0x1094f4))[_0x29a8('0x48')](handleError(_0x5ec6fb,null));};exports[_0x29a8('0x49')]=function(_0x45a243,_0x3bb155){var _0x49ac3c={'raw':![],'where':{'id':_0x45a243[_0x29a8('0x4a')]['id']}},_0x416a1d={};_0x416a1d[_0x29a8('0x35')]=_[_0x29a8('0x37')](db[_0x29a8('0x31')][_0x29a8('0x32')]);_0x416a1d[_0x29a8('0x36')]=_[_0x29a8('0x37')](_0x45a243['query']);_0x416a1d['filters']=_['intersection'](_0x416a1d['model'],_0x416a1d[_0x29a8('0x36')]);_0x49ac3c[_0x29a8('0x3a')]=_[_0x29a8('0x39')](_0x416a1d[_0x29a8('0x35')],qs[_0x29a8('0x3b')](_0x45a243['query'][_0x29a8('0x3b')]));_0x49ac3c[_0x29a8('0x3a')]=_0x49ac3c[_0x29a8('0x3a')][_0x29a8('0x3c')]?_0x49ac3c[_0x29a8('0x3a')]:_0x416a1d['model'];if(_0x45a243[_0x29a8('0x36')][_0x29a8('0x44')]){_0x49ac3c['include']=[{'all':!![]}];}_0x49ac3c=_[_0x29a8('0x43')]({},_0x49ac3c,_0x45a243[_0x29a8('0x4b')]);return db[_0x29a8('0x31')][_0x29a8('0x4c')](_0x49ac3c)[_0x29a8('0x28')](handleEntityNotFound(_0x3bb155,null))[_0x29a8('0x28')](respondWithResult(_0x3bb155,null))[_0x29a8('0x48')](handleError(_0x3bb155,null));};exports[_0x29a8('0x4d')]=function(_0x351fd2,_0x2394cb){return db[_0x29a8('0x31')][_0x29a8('0x4d')](_0x351fd2[_0x29a8('0x4e')],{})[_0x29a8('0x28')](function(_0x3d2ef4){var _0x53e49e=_0x351fd2[_0x29a8('0x4f')]['get']({'plain':!![]});if(!_0x53e49e)throw new Error(_0x29a8('0x50'));if(_0x53e49e[_0x29a8('0x51')]===_0x29a8('0x4f')){var _0x2b7457=_0x3d2ef4['get']({'plain':!![]});var _0xab214a=_0x29a8('0x2a');return db[_0x29a8('0x52')][_0x29a8('0x4c')]({'where':{'name':_0xab214a,'userProfileId':_0x53e49e[_0x29a8('0x53')]},'raw':!![]})['then'](function(_0x2c482b){if(_0x2c482b&&_0x2c482b[_0x29a8('0x54')]===0x0){return db[_0x29a8('0x2b')]['create']({'name':_0x2b7457[_0x29a8('0x2f')],'resourceId':_0x2b7457['id'],'type':_0x2c482b[_0x29a8('0x2f')],'sectionId':_0x2c482b['id']},{})[_0x29a8('0x28')](function(){return _0x3d2ef4;});}else{return _0x3d2ef4;}})['catch'](function(_0x26c86f){logger[_0x29a8('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x26c86f);throw _0x26c86f;});}return _0x3d2ef4;})['then'](respondWithResult(_0x2394cb,0xc9))['catch'](handleError(_0x2394cb,null));};exports['update']=function(_0xa65308,_0xbf8acb){if(_0xa65308['body']['id']){delete _0xa65308[_0x29a8('0x4e')]['id'];}return db['SquareProject']['find']({'where':{'id':_0xa65308[_0x29a8('0x4a')]['id']}})['then'](handleEntityNotFound(_0xbf8acb,null))[_0x29a8('0x28')](saveUpdates(_0xa65308[_0x29a8('0x4e')],null))[_0x29a8('0x28')](respondWithResult(_0xbf8acb,null))[_0x29a8('0x48')](handleError(_0xbf8acb,null));};exports[_0x29a8('0x27')]=function(_0x2762a3,_0x12f3e){return db[_0x29a8('0x31')][_0x29a8('0x4c')]({'where':{'id':_0x2762a3['params']['id']}})['then'](handleEntityNotFound(_0x12f3e,null))[_0x29a8('0x28')](removeEntity(_0x12f3e,null))[_0x29a8('0x48')](handleError(_0x12f3e,null));};exports[_0x29a8('0x55')]=function(_0x4d08f9,_0x453642,_0x383b6b){return db[_0x29a8('0x31')]['find']({'where':{'id':_0x4d08f9[_0x29a8('0x4a')]['id']}})[_0x29a8('0x28')](handleEntityNotFound(_0x453642,null))[_0x29a8('0x28')](function(_0x342fe8){if(_0x342fe8){return _0x342fe8[_0x29a8('0x55')](_0x4d08f9['body']['ids'],_[_0x29a8('0x56')](_0x4d08f9[_0x29a8('0x4e')],[_0x29a8('0x57'),'id'])||{});}})[_0x29a8('0x28')](respondWithResult(_0x453642,null))[_0x29a8('0x48')](handleError(_0x453642,null));};exports[_0x29a8('0x58')]=function(_0x2da3f3,_0x10842f,_0x3e963e){return db[_0x29a8('0x31')]['find']({'where':{'id':_0x2da3f3[_0x29a8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x10842f,null))[_0x29a8('0x28')](function(_0x24aabf){if(_0x24aabf){return _0x24aabf[_0x29a8('0x58')](_0x2da3f3['query']['ids'])[_0x29a8('0x28')](function(){if(_[_0x29a8('0x59')](_0x2da3f3[_0x29a8('0x36')][_0x29a8('0x57')])){for(var _0x983448=0x0;_0x983448<_0x2da3f3[_0x29a8('0x36')]['ids'][_0x29a8('0x3c')];_0x983448+=0x1){socket['emit'](_0x29a8('0x5a'),{'UserId':Number(_0x2da3f3['query'][_0x29a8('0x57')][_0x983448]),'SquareProjectId':Number(_0x2da3f3[_0x29a8('0x4a')]['id'])});}}else{socket[_0x29a8('0x5b')](_0x29a8('0x5a'),{'UserId':Number(_0x2da3f3[_0x29a8('0x36')][_0x29a8('0x57')]),'SquareProjectId':Number(_0x2da3f3['params']['id'])});}});}})[_0x29a8('0x28')](respondWithStatusCode(_0x10842f,null))[_0x29a8('0x48')](handleError(_0x10842f,null));};exports[_0x29a8('0x5c')]=function(_0x7ce630,_0x176841,_0x16379b){var _0x2b6c90={};var _0x500cda={};var _0x540a77;var _0x189dc8;return db[_0x29a8('0x31')][_0x29a8('0x5d')]({'where':{'id':_0x7ce630[_0x29a8('0x4a')]['id']}})[_0x29a8('0x28')](handleEntityNotFound(_0x176841,null))[_0x29a8('0x28')](function(_0x325687){if(_0x325687){_0x540a77=_0x325687;_0x500cda[_0x29a8('0x35')]=_[_0x29a8('0x37')](db[_0x29a8('0x5e')]['rawAttributes']);_0x500cda[_0x29a8('0x36')]=_[_0x29a8('0x37')](_0x7ce630[_0x29a8('0x36')]);_0x500cda['filters']=_[_0x29a8('0x39')](_0x500cda['model'],_0x500cda[_0x29a8('0x36')]);_0x2b6c90['attributes']=_[_0x29a8('0x39')](_0x500cda[_0x29a8('0x35')],qs[_0x29a8('0x3b')](_0x7ce630[_0x29a8('0x36')][_0x29a8('0x3b')]));_0x2b6c90[_0x29a8('0x3a')]=_0x2b6c90['attributes'][_0x29a8('0x3c')]?_0x2b6c90[_0x29a8('0x3a')]:_0x500cda[_0x29a8('0x35')];_0x2b6c90['order']=qs[_0x29a8('0x3f')](_0x7ce630[_0x29a8('0x36')][_0x29a8('0x3f')]);_0x2b6c90[_0x29a8('0x40')]=qs[_0x29a8('0x38')](_[_0x29a8('0x5f')](_0x7ce630[_0x29a8('0x36')],_0x500cda['filters']));if(_0x7ce630[_0x29a8('0x36')][_0x29a8('0x41')]){_0x2b6c90[_0x29a8('0x40')]=_[_0x29a8('0x43')](_0x2b6c90[_0x29a8('0x40')],{'$or':_[_0x29a8('0x30')](_0x2b6c90[_0x29a8('0x3a')],function(_0xccbc19){var _0x1f275e={};_0x1f275e[_0xccbc19]={'$like':'%'+_0x7ce630[_0x29a8('0x36')]['filter']+'%'};return _0x1f275e;})});}_0x2b6c90=_[_0x29a8('0x43')]({},_0x2b6c90,_0x7ce630[_0x29a8('0x4b')]);return _0x540a77[_0x29a8('0x5c')](_0x2b6c90);}})['then'](function(_0x119e0b){if(_0x119e0b){_0x189dc8=_0x119e0b[_0x29a8('0x3c')];if(!_0x7ce630['query'][_0x29a8('0x3d')](_0x29a8('0x3e'))){_0x2b6c90['limit']=qs[_0x29a8('0x21')](_0x7ce630['query']['limit']);_0x2b6c90['offset']=qs['offset'](_0x7ce630[_0x29a8('0x36')]['offset']);}return _0x540a77[_0x29a8('0x5c')](_0x2b6c90);}})[_0x29a8('0x28')](function(_0x1ecad0){if(_0x1ecad0){return _0x1ecad0?{'count':_0x189dc8,'rows':_0x1ecad0}:null;}})[_0x29a8('0x28')](respondWithResult(_0x176841,null))['catch'](handleError(_0x176841,null));}; \ No newline at end of file +var _0x7e16=['role','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addUsers','omit','ids','removeUsers','isArray','emit','getUsers','findOne','order','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./squareProject.socket','register','sendStatus','status','undefined','limit','count','offset','set','apply','reject','then','destroy','get','SquareProjects','end','error','stack','name','map','SquareProject','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','keys','length','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x1dd2cc,_0x36ddfe){var _0x305d8e=function(_0x27df09){while(--_0x27df09){_0x1dd2cc['push'](_0x1dd2cc['shift']());}};_0x305d8e(++_0x36ddfe);}(_0x7e16,0x70));var _0x67e1=function(_0x40dd7f,_0x39aaee){_0x40dd7f=_0x40dd7f-0x0;var _0xf56b5a=_0x7e16[_0x40dd7f];return _0xf56b5a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x67e1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x67e1('0x1'));var rp=require(_0x67e1('0x2'));var moment=require(_0x67e1('0x3'));var BPromise=require(_0x67e1('0x4'));var Mustache=require(_0x67e1('0x5'));var util=require(_0x67e1('0x6'));var path=require(_0x67e1('0x7'));var sox=require(_0x67e1('0x8'));var csv=require(_0x67e1('0x9'));var ejs=require(_0x67e1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x67e1('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x67e1('0xc'));var toCsv=require('to-csv');var querystring=require(_0x67e1('0xd'));var Papa=require(_0x67e1('0xe'));var Redis=require(_0x67e1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x67e1('0x10'));var as=require(_0x67e1('0x11'));var hardwareService=require(_0x67e1('0x12'));var logger=require(_0x67e1('0x13'))(_0x67e1('0x14'));var utils=require(_0x67e1('0x15'));var config=require(_0x67e1('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x67e1('0x17'))['db'];config[_0x67e1('0x18')]=_[_0x67e1('0x19')](config[_0x67e1('0x18')],{'host':_0x67e1('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x67e1('0x18')]));require(_0x67e1('0x1b'))[_0x67e1('0x1c')](socket);function respondWithStatusCode(_0x45e8a7,_0xdd0111){_0xdd0111=_0xdd0111||0xcc;return function(_0x139761){if(_0x139761){return _0x45e8a7[_0x67e1('0x1d')](_0xdd0111);}return _0x45e8a7[_0x67e1('0x1e')](_0xdd0111)['end']();};}function respondWithResult(_0x41101a,_0xf26bfc){_0xf26bfc=_0xf26bfc||0xc8;return function(_0x44dffa){if(_0x44dffa){return _0x41101a[_0x67e1('0x1e')](_0xf26bfc)['json'](_0x44dffa);}};}function respondWithFilteredResult(_0x1849ea,_0x5076c1){return function(_0x26fd18){if(_0x26fd18){var _0x49e2ce=typeof _0x5076c1['offset']===_0x67e1('0x1f')&&typeof _0x5076c1[_0x67e1('0x20')]==='undefined';var _0x29bb1a=_0x26fd18[_0x67e1('0x21')];var _0x140a2e=_0x49e2ce?0x0:_0x5076c1[_0x67e1('0x22')];var _0x14382d=_0x49e2ce?_0x26fd18[_0x67e1('0x21')]:_0x5076c1['offset']+_0x5076c1[_0x67e1('0x20')];var _0x4884bc;if(_0x14382d>=_0x29bb1a){_0x14382d=_0x29bb1a;_0x4884bc=0xc8;}else{_0x4884bc=0xce;}_0x1849ea['status'](_0x4884bc);return _0x1849ea[_0x67e1('0x23')]('Content-Range',_0x140a2e+'-'+_0x14382d+'/'+_0x29bb1a)['json'](_0x26fd18);}return null;};}function patchUpdates(_0x50d5ac){return function(_0x39b60e){try{jsonpatch[_0x67e1('0x24')](_0x39b60e,_0x50d5ac,!![]);}catch(_0x29b1c3){return BPromise[_0x67e1('0x25')](_0x29b1c3);}return _0x39b60e['save']();};}function saveUpdates(_0x54a879,_0x1cd310){return function(_0xc1edc8){if(_0xc1edc8){return _0xc1edc8['update'](_0x54a879)[_0x67e1('0x26')](function(_0x308091){return _0x308091;});}return null;};}function removeEntity(_0x42fb6f,_0x22edde){return function(_0x2d1dc4){if(_0x2d1dc4){return _0x2d1dc4[_0x67e1('0x27')]()[_0x67e1('0x26')](function(){var _0x363fcf=_0x2d1dc4[_0x67e1('0x28')]({'plain':!![]});var _0x40afdb=_0x67e1('0x29');return db['UserProfileResource'][_0x67e1('0x27')]({'where':{'type':_0x40afdb,'resourceId':_0x363fcf['id']}})['then'](function(){return _0x2d1dc4;});})[_0x67e1('0x26')](function(){_0x42fb6f['status'](0xcc)[_0x67e1('0x2a')]();});}};}function handleEntityNotFound(_0x3d27e7,_0x402b3d){return function(_0x273bf3){if(!_0x273bf3){_0x3d27e7[_0x67e1('0x1d')](0x194);}return _0x273bf3;};}function handleError(_0x5c668d,_0x500385){_0x500385=_0x500385||0x1f4;return function(_0x1e3ae2){logger[_0x67e1('0x2b')](_0x1e3ae2[_0x67e1('0x2c')]);if(_0x1e3ae2[_0x67e1('0x2d')]){delete _0x1e3ae2[_0x67e1('0x2d')];}_0x5c668d[_0x67e1('0x1e')](_0x500385)['send'](_0x1e3ae2);};}exports['index']=function(_0x5baaab,_0xb5f7ac){var _0x3142e2={},_0x493ea={},_0x18c021={'count':0x0,'rows':[]};var _0x4a4f99=_[_0x67e1('0x2e')](db[_0x67e1('0x2f')][_0x67e1('0x30')],function(_0x310af8){return{'name':_0x310af8[_0x67e1('0x31')],'type':_0x310af8[_0x67e1('0x32')][_0x67e1('0x33')]};});_0x493ea[_0x67e1('0x34')]=_[_0x67e1('0x2e')](_0x4a4f99,_0x67e1('0x2d'));_0x493ea[_0x67e1('0x35')]=_['keys'](_0x5baaab['query']);_0x493ea[_0x67e1('0x36')]=_[_0x67e1('0x37')](_0x493ea[_0x67e1('0x34')],_0x493ea[_0x67e1('0x35')]);_0x3142e2['attributes']=_[_0x67e1('0x37')](_0x493ea[_0x67e1('0x34')],qs[_0x67e1('0x38')](_0x5baaab[_0x67e1('0x35')][_0x67e1('0x38')]));_0x3142e2[_0x67e1('0x39')]=_0x3142e2[_0x67e1('0x39')]['length']?_0x3142e2[_0x67e1('0x39')]:_0x493ea[_0x67e1('0x34')];if(!_0x5baaab[_0x67e1('0x35')][_0x67e1('0x3a')](_0x67e1('0x3b'))){_0x3142e2[_0x67e1('0x20')]=qs[_0x67e1('0x20')](_0x5baaab[_0x67e1('0x35')][_0x67e1('0x20')]);_0x3142e2[_0x67e1('0x22')]=qs[_0x67e1('0x22')](_0x5baaab['query']['offset']);}_0x3142e2['order']=qs[_0x67e1('0x3c')](_0x5baaab['query']['sort']);_0x3142e2[_0x67e1('0x3d')]=qs[_0x67e1('0x36')](_[_0x67e1('0x3e')](_0x5baaab['query'],_0x493ea[_0x67e1('0x36')]),_0x4a4f99);if(_0x5baaab['query'][_0x67e1('0x3f')]){_0x3142e2['where']=_[_0x67e1('0x40')](_0x3142e2[_0x67e1('0x3d')],{'$or':_[_0x67e1('0x2e')](_0x4a4f99,function(_0x434310){if(_0x434310[_0x67e1('0x32')]!==_0x67e1('0x41')){var _0x42aa85={};_0x42aa85[_0x434310[_0x67e1('0x2d')]]={'$like':'%'+_0x5baaab[_0x67e1('0x35')][_0x67e1('0x3f')]+'%'};return _0x42aa85;}})});}_0x3142e2=_[_0x67e1('0x40')]({},_0x3142e2,_0x5baaab[_0x67e1('0x42')]);var _0x56b6b2={'where':_0x3142e2[_0x67e1('0x3d')]};return db['SquareProject'][_0x67e1('0x21')](_0x56b6b2)[_0x67e1('0x26')](function(_0x31342e){_0x18c021[_0x67e1('0x21')]=_0x31342e;if(_0x5baaab[_0x67e1('0x35')]['includeAll']){_0x3142e2[_0x67e1('0x43')]=[{'all':!![]}];}return db[_0x67e1('0x2f')][_0x67e1('0x44')](_0x3142e2);})['then'](function(_0x362b4d){_0x18c021['rows']=_0x362b4d;return _0x18c021;})[_0x67e1('0x26')](respondWithFilteredResult(_0xb5f7ac,_0x3142e2))[_0x67e1('0x45')](handleError(_0xb5f7ac,null));};exports[_0x67e1('0x46')]=function(_0x4f391d,_0xccb24f){var _0x3051c8={'raw':![],'where':{'id':_0x4f391d[_0x67e1('0x47')]['id']}},_0x1ddd44={};_0x1ddd44['model']=_['keys'](db[_0x67e1('0x2f')][_0x67e1('0x30')]);_0x1ddd44[_0x67e1('0x35')]=_[_0x67e1('0x48')](_0x4f391d['query']);_0x1ddd44[_0x67e1('0x36')]=_[_0x67e1('0x37')](_0x1ddd44[_0x67e1('0x34')],_0x1ddd44[_0x67e1('0x35')]);_0x3051c8[_0x67e1('0x39')]=_[_0x67e1('0x37')](_0x1ddd44[_0x67e1('0x34')],qs[_0x67e1('0x38')](_0x4f391d[_0x67e1('0x35')][_0x67e1('0x38')]));_0x3051c8['attributes']=_0x3051c8[_0x67e1('0x39')][_0x67e1('0x49')]?_0x3051c8[_0x67e1('0x39')]:_0x1ddd44[_0x67e1('0x34')];if(_0x4f391d[_0x67e1('0x35')][_0x67e1('0x4a')]){_0x3051c8[_0x67e1('0x43')]=[{'all':!![]}];}_0x3051c8=_[_0x67e1('0x40')]({},_0x3051c8,_0x4f391d[_0x67e1('0x42')]);return db[_0x67e1('0x2f')]['find'](_0x3051c8)['then'](handleEntityNotFound(_0xccb24f,null))[_0x67e1('0x26')](respondWithResult(_0xccb24f,null))['catch'](handleError(_0xccb24f,null));};exports[_0x67e1('0x4b')]=function(_0x2b6bac,_0x6e40a1){return db[_0x67e1('0x2f')][_0x67e1('0x4b')](_0x2b6bac['body'],{})['then'](function(_0x1fcb9d){var _0x7a98d8=_0x2b6bac[_0x67e1('0x4c')][_0x67e1('0x28')]({'plain':!![]});if(!_0x7a98d8)throw new Error(_0x67e1('0x4d'));if(_0x7a98d8[_0x67e1('0x4e')]===_0x67e1('0x4c')){var _0x43a77c=_0x1fcb9d[_0x67e1('0x28')]({'plain':!![]});var _0x30b955=_0x67e1('0x29');return db[_0x67e1('0x4f')][_0x67e1('0x50')]({'where':{'name':_0x30b955,'userProfileId':_0x7a98d8[_0x67e1('0x51')]},'raw':!![]})['then'](function(_0x57e5b4){if(_0x57e5b4&&_0x57e5b4['autoAssociation']===0x0){return db[_0x67e1('0x52')]['create']({'name':_0x43a77c['name'],'resourceId':_0x43a77c['id'],'type':_0x57e5b4[_0x67e1('0x2d')],'sectionId':_0x57e5b4['id']},{})[_0x67e1('0x26')](function(){return _0x1fcb9d;});}else{return _0x1fcb9d;}})[_0x67e1('0x45')](function(_0x597cb2){logger[_0x67e1('0x2b')](_0x67e1('0x53'),_0x597cb2);throw _0x597cb2;});}return _0x1fcb9d;})[_0x67e1('0x26')](respondWithResult(_0x6e40a1,0xc9))[_0x67e1('0x45')](handleError(_0x6e40a1,null));};exports[_0x67e1('0x54')]=function(_0xa93b85,_0x37a458){if(_0xa93b85[_0x67e1('0x55')]['id']){delete _0xa93b85[_0x67e1('0x55')]['id'];}return db['SquareProject']['find']({'where':{'id':_0xa93b85[_0x67e1('0x47')]['id']}})[_0x67e1('0x26')](handleEntityNotFound(_0x37a458,null))[_0x67e1('0x26')](saveUpdates(_0xa93b85['body'],null))[_0x67e1('0x26')](respondWithResult(_0x37a458,null))[_0x67e1('0x45')](handleError(_0x37a458,null));};exports[_0x67e1('0x27')]=function(_0x53a80e,_0x9138fc){return db[_0x67e1('0x2f')][_0x67e1('0x50')]({'where':{'id':_0x53a80e[_0x67e1('0x47')]['id']}})[_0x67e1('0x26')](handleEntityNotFound(_0x9138fc,null))['then'](removeEntity(_0x9138fc,null))[_0x67e1('0x45')](handleError(_0x9138fc,null));};exports[_0x67e1('0x56')]=function(_0x2db356,_0x5bc17b,_0x2612f3){return db[_0x67e1('0x2f')]['find']({'where':{'id':_0x2db356[_0x67e1('0x47')]['id']}})[_0x67e1('0x26')](handleEntityNotFound(_0x5bc17b,null))[_0x67e1('0x26')](function(_0x53182c){if(_0x53182c){return _0x53182c[_0x67e1('0x56')](_0x2db356[_0x67e1('0x55')]['ids'],_[_0x67e1('0x57')](_0x2db356[_0x67e1('0x55')],[_0x67e1('0x58'),'id'])||{});}})[_0x67e1('0x26')](respondWithResult(_0x5bc17b,null))[_0x67e1('0x45')](handleError(_0x5bc17b,null));};exports['removeUsers']=function(_0x420490,_0x2b364a,_0xd3285b){return db[_0x67e1('0x2f')][_0x67e1('0x50')]({'where':{'id':_0x420490[_0x67e1('0x47')]['id']}})[_0x67e1('0x26')](handleEntityNotFound(_0x2b364a,null))['then'](function(_0x39b895){if(_0x39b895){return _0x39b895[_0x67e1('0x59')](_0x420490['query'][_0x67e1('0x58')])[_0x67e1('0x26')](function(){if(_[_0x67e1('0x5a')](_0x420490['query'][_0x67e1('0x58')])){for(var _0xbc434e=0x0;_0xbc434e<_0x420490[_0x67e1('0x35')][_0x67e1('0x58')][_0x67e1('0x49')];_0xbc434e+=0x1){socket[_0x67e1('0x5b')]('userSquareProject:remove',{'UserId':Number(_0x420490[_0x67e1('0x35')][_0x67e1('0x58')][_0xbc434e]),'SquareProjectId':Number(_0x420490[_0x67e1('0x47')]['id'])});}}else{socket[_0x67e1('0x5b')]('userSquareProject:remove',{'UserId':Number(_0x420490[_0x67e1('0x35')][_0x67e1('0x58')]),'SquareProjectId':Number(_0x420490['params']['id'])});}});}})[_0x67e1('0x26')](respondWithStatusCode(_0x2b364a,null))[_0x67e1('0x45')](handleError(_0x2b364a,null));};exports[_0x67e1('0x5c')]=function(_0x418552,_0x5272c7,_0x94532c){var _0x75a978={};var _0x4acbc0={};var _0x129a66;var _0x2bd154;return db['SquareProject'][_0x67e1('0x5d')]({'where':{'id':_0x418552[_0x67e1('0x47')]['id']}})[_0x67e1('0x26')](handleEntityNotFound(_0x5272c7,null))[_0x67e1('0x26')](function(_0x4c66b6){if(_0x4c66b6){_0x129a66=_0x4c66b6;_0x4acbc0['model']=_[_0x67e1('0x48')](db['User']['rawAttributes']);_0x4acbc0[_0x67e1('0x35')]=_['keys'](_0x418552[_0x67e1('0x35')]);_0x4acbc0[_0x67e1('0x36')]=_[_0x67e1('0x37')](_0x4acbc0[_0x67e1('0x34')],_0x4acbc0['query']);_0x75a978[_0x67e1('0x39')]=_[_0x67e1('0x37')](_0x4acbc0[_0x67e1('0x34')],qs['fields'](_0x418552[_0x67e1('0x35')][_0x67e1('0x38')]));_0x75a978[_0x67e1('0x39')]=_0x75a978[_0x67e1('0x39')][_0x67e1('0x49')]?_0x75a978[_0x67e1('0x39')]:_0x4acbc0['model'];_0x75a978[_0x67e1('0x5e')]=qs['sort'](_0x418552['query'][_0x67e1('0x3c')]);_0x75a978[_0x67e1('0x3d')]=qs[_0x67e1('0x36')](_[_0x67e1('0x3e')](_0x418552[_0x67e1('0x35')],_0x4acbc0[_0x67e1('0x36')]));if(_0x418552[_0x67e1('0x35')][_0x67e1('0x3f')]){_0x75a978[_0x67e1('0x3d')]=_[_0x67e1('0x40')](_0x75a978['where'],{'$or':_[_0x67e1('0x2e')](_0x75a978['attributes'],function(_0x42f25d){var _0x38dbfa={};_0x38dbfa[_0x42f25d]={'$like':'%'+_0x418552[_0x67e1('0x35')][_0x67e1('0x3f')]+'%'};return _0x38dbfa;})});}_0x75a978=_[_0x67e1('0x40')]({},_0x75a978,_0x418552[_0x67e1('0x42')]);return _0x129a66[_0x67e1('0x5c')](_0x75a978);}})['then'](function(_0x284e47){if(_0x284e47){_0x2bd154=_0x284e47[_0x67e1('0x49')];if(!_0x418552['query'][_0x67e1('0x3a')]('nolimit')){_0x75a978[_0x67e1('0x20')]=qs[_0x67e1('0x20')](_0x418552['query'][_0x67e1('0x20')]);_0x75a978['offset']=qs['offset'](_0x418552[_0x67e1('0x35')]['offset']);}return _0x129a66[_0x67e1('0x5c')](_0x75a978);}})['then'](function(_0x79458){if(_0x79458){return _0x79458?{'count':_0x2bd154,'rows':_0x79458}:null;}})['then'](respondWithResult(_0x5272c7,null))[_0x67e1('0x45')](handleError(_0x5272c7,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index cf43faf..2bc01d5 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 _0xfcdb=['hasOwnProperty','hook','../../mysqldb','SquareProject','save','remove','emit'];(function(_0x4a8de3,_0x49ed3c){var _0x334065=function(_0xfb65d6){while(--_0xfb65d6){_0x4a8de3['push'](_0x4a8de3['shift']());}};_0x334065(++_0x49ed3c);}(_0xfcdb,0x64));var _0xbfcd=function(_0x57388d,_0x4c123f){_0x57388d=_0x57388d-0x0;var _0x421171=_0xfcdb[_0x57388d];return _0x421171;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0xbfcd('0x0'))['db'][_0xbfcd('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbfcd('0x2'),'afterUpdate':'update','afterDestroy':_0xbfcd('0x3')};function emitEvent(_0x49ffbe){return function(_0x131ffa,_0xd9159f,_0x3aeaf8){SquareProjectEvents[_0xbfcd('0x4')](_0x49ffbe+':'+_0x131ffa['id'],_0x131ffa);SquareProjectEvents[_0xbfcd('0x4')](_0x49ffbe,_0x131ffa);_0x3aeaf8(null);};}for(var e in events){if(events[_0xbfcd('0x5')](e)){var event=events[e];SquareProject[_0xbfcd('0x6')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0x614d=['hasOwnProperty','hook','SquareProject','setMaxListeners','save','update','remove','emit'];(function(_0x51e9fb,_0x1e1fa5){var _0x15d94b=function(_0x18b9ef){while(--_0x18b9ef){_0x51e9fb['push'](_0x51e9fb['shift']());}};_0x15d94b(++_0x1e1fa5);}(_0x614d,0x18a));var _0xd614=function(_0x44f6d2,_0x3c9bc5){_0x44f6d2=_0x44f6d2-0x0;var _0xca54ec=_0x614d[_0x44f6d2];return _0xca54ec;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db'][_0xd614('0x0')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xd614('0x1')](0x0);var events={'afterCreate':_0xd614('0x2'),'afterUpdate':_0xd614('0x3'),'afterDestroy':_0xd614('0x4')};function emitEvent(_0x3e2e48){return function(_0x1a9c5c,_0x231a5d,_0x10a2c9){SquareProjectEvents[_0xd614('0x5')](_0x3e2e48+':'+_0x1a9c5c['id'],_0x1a9c5c);SquareProjectEvents[_0xd614('0x5')](_0x3e2e48,_0x1a9c5c);_0x10a2c9(null);};}for(var e in events){if(events[_0xd614('0x6')](e)){var event=events[e];SquareProject[_0xd614('0x7')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index eb5212e..7975c73 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 _0x4533=['request-promise','rimraf','../../config/environment','exports','define','SquareProject','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','production','publishedAt','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xfd49ed,_0x1272e1){var _0x355f54=function(_0x3fc70f){while(--_0x3fc70f){_0xfd49ed['push'](_0xfd49ed['shift']());}};_0x355f54(++_0x1272e1);}(_0x4533,0xde));var _0x3453=function(_0x25d3d1,_0x2befbf){_0x25d3d1=_0x25d3d1-0x0;var _0x81d5d9=_0x4533[_0x25d3d1];return _0x81d5d9;};'use strict';var _=require(_0x3453('0x0'));var util=require(_0x3453('0x1'));var logger=require(_0x3453('0x2'))(_0x3453('0x3'));var moment=require(_0x3453('0x4'));var BPromise=require(_0x3453('0x5'));var rp=require(_0x3453('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3453('0x7'));var config=require(_0x3453('0x8'));var attributes=require('./squareProject.attributes');module[_0x3453('0x9')]=function(_0x52deb2,_0x1ef62e){return _0x52deb2[_0x3453('0xa')](_0x3453('0xb'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1605b3,_0x3f2729,_0x68c2dd){if(_0x1605b3['changed'](_0x3453('0xc'))){_0x1605b3[_0x3453('0xd')]=moment()[_0x3453('0xe')](_0x3453('0xf'));}if(_0x1605b3[_0x3453('0x10')](_0x3453('0x11'))){_0x1605b3[_0x3453('0x12')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x68c2dd(null,_0x1605b3);}}});}; \ No newline at end of file +var _0x4028=['SquareProject','square_projects','changed','preproduction','savedAt','format','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','moment','request-promise','./squareProject.attributes','exports','define'];(function(_0x2499a4,_0x24ab91){var _0x27cff1=function(_0x2ca926){while(--_0x2ca926){_0x2499a4['push'](_0x2499a4['shift']());}};_0x27cff1(++_0x24ab91);}(_0x4028,0x90));var _0x8402=function(_0x4968d4,_0x49dd6e){_0x4968d4=_0x4968d4-0x0;var _0xf6d9be=_0x4028[_0x4968d4];return _0xf6d9be;};'use strict';var _=require(_0x8402('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x8402('0x1'));var BPromise=require('bluebird');var rp=require(_0x8402('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8402('0x3'));module[_0x8402('0x4')]=function(_0x1c0da1,_0x5947a1){return _0x1c0da1[_0x8402('0x5')](_0x8402('0x6'),attributes,{'tableName':_0x8402('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4b432d,_0x33232a,_0x1375ba){if(_0x4b432d[_0x8402('0x8')](_0x8402('0x9'))){_0x4b432d[_0x8402('0xa')]=moment()[_0x8402('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x4b432d['changed'](_0x8402('0xc'))){_0x4b432d[_0x8402('0xd')]=moment()[_0x8402('0xb')](_0x8402('0xe'));}_0x1375ba(null,_0x4b432d);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 13c4437..f453e65 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 _0xd304=['rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','SquareProject,\x20%s,\x20%s','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSquareProject','options','raw','where','attributes','include','map','model','then','debug','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xdd827a,_0x482ad2){var _0x2f46f1=function(_0x221046){while(--_0x221046){_0xdd827a['push'](_0xdd827a['shift']());}};_0x2f46f1(++_0x482ad2);}(_0xd304,0x66));var _0x4d30=function(_0x379efb,_0x1b275e){_0x379efb=_0x379efb-0x0;var _0x1d0926=_0xd304[_0x379efb];return _0x1d0926;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x4d30('0x0'));var rs=require(_0x4d30('0x1'));var fs=require('fs');var Redis=require(_0x4d30('0x2'));var db=require(_0x4d30('0x3'))['db'];var utils=require(_0x4d30('0x4'));var logger=require(_0x4d30('0x5'))(_0x4d30('0x6'));var config=require(_0x4d30('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4d30('0x8')][_0x4d30('0x9')]({'port':0x232a});config['redis']=_[_0x4d30('0xa')](config[_0x4d30('0xb')],{'host':_0x4d30('0xc'),'port':0x18eb});var socket=require(_0x4d30('0xd'))(new Redis(config[_0x4d30('0xb')]));require(_0x4d30('0xe'))[_0x4d30('0xf')](socket);function respondWithRpcPromise(_0x368c68,_0x5ad8c7,_0x103824){return new BPromise(function(_0x4d48a2,_0x882b41){return client['request'](_0x368c68,_0x103824)['then'](function(_0x35eb90){logger['info'](_0x4d30('0x10'),_0x5ad8c7,_0x4d30('0x11'));logger['debug'](_0x4d30('0x12'),_0x5ad8c7,'request\x20sent',JSON[_0x4d30('0x13')](_0x35eb90));if(_0x35eb90[_0x4d30('0x14')]){if(_0x35eb90[_0x4d30('0x14')][_0x4d30('0x15')]===0x1f4){logger['error'](_0x4d30('0x10'),_0x5ad8c7,_0x35eb90[_0x4d30('0x14')][_0x4d30('0x16')]);return _0x882b41(_0x35eb90[_0x4d30('0x14')][_0x4d30('0x16')]);}logger[_0x4d30('0x14')](_0x4d30('0x10'),_0x5ad8c7,_0x35eb90[_0x4d30('0x14')]['message']);return _0x4d48a2(_0x35eb90[_0x4d30('0x14')][_0x4d30('0x16')]);}else{logger[_0x4d30('0x17')]('SquareProject,\x20%s,\x20%s',_0x5ad8c7,'request\x20sent');_0x4d48a2(_0x35eb90[_0x4d30('0x18')][_0x4d30('0x16')]);}})[_0x4d30('0x19')](function(_0x4d8654){logger[_0x4d30('0x14')](_0x4d30('0x10'),_0x5ad8c7,_0x4d8654);_0x882b41(_0x4d8654);});});}exports[_0x4d30('0x1a')]=function(_0x4b435c){var _0x47c28d=this;return new Promise(function(_0xe418cc,_0x22bb61){return db['SquareProject']['find']({'raw':_0x4b435c[_0x4d30('0x1b')]?_0x4b435c[_0x4d30('0x1b')][_0x4d30('0x1c')]===undefined?!![]:![]:!![],'where':_0x4b435c[_0x4d30('0x1b')]?_0x4b435c[_0x4d30('0x1b')][_0x4d30('0x1d')]||null:null,'attributes':_0x4b435c[_0x4d30('0x1b')]?_0x4b435c[_0x4d30('0x1b')][_0x4d30('0x1e')]||null:null,'include':_0x4b435c['options']?_0x4b435c['options'][_0x4d30('0x1f')]?_[_0x4d30('0x20')](_0x4b435c[_0x4d30('0x1b')][_0x4d30('0x1f')],function(_0x5290a8){return{'model':db[_0x5290a8[_0x4d30('0x21')]],'as':_0x5290a8['as'],'attributes':_0x5290a8[_0x4d30('0x1e')],'include':_0x5290a8['include']?_[_0x4d30('0x20')](_0x5290a8[_0x4d30('0x1f')],function(_0x2e5248){return{'model':db[_0x2e5248['model']],'as':_0x2e5248['as'],'attributes':_0x2e5248[_0x4d30('0x1e')],'include':_0x2e5248['include']?_['map'](_0x2e5248['include'],function(_0xe20a81){return{'model':db[_0xe20a81[_0x4d30('0x21')]],'as':_0xe20a81['as'],'attributes':_0xe20a81[_0x4d30('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4d30('0x22')](function(_0x2a6284){logger['info']('ShowSquareProject',_0x4b435c);logger[_0x4d30('0x23')](_0x4d30('0x1a'),_0x4b435c,JSON['stringify'](_0x2a6284));_0xe418cc(_0x2a6284);})[_0x4d30('0x19')](function(_0x48dcd8){logger[_0x4d30('0x14')]('ShowSquareProject',_0x48dcd8[_0x4d30('0x16')],_0x4b435c);_0x22bb61(_0x47c28d[_0x4d30('0x14')](0x1f4,_0x48dcd8['message']));});});}; \ No newline at end of file +var _0xd30e=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','./squareProject.socket','register','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowSquareProject','SquareProject','find','options','raw','attributes','include','model','map','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xd30e,0x96));var _0xed30=function(_0x48e089,_0x402510){_0x48e089=_0x48e089-0x0;var _0x35e815=_0xd30e[_0x48e089];return _0x35e815;};'use strict';var _=require(_0xed30('0x0'));var util=require(_0xed30('0x1'));var moment=require(_0xed30('0x2'));var BPromise=require('bluebird');var rs=require(_0xed30('0x3'));var fs=require('fs');var Redis=require(_0xed30('0x4'));var db=require(_0xed30('0x5'))['db'];var utils=require(_0xed30('0x6'));var logger=require(_0xed30('0x7'))(_0xed30('0x8'));var config=require(_0xed30('0x9'));var jayson=require(_0xed30('0xa'));var client=jayson[_0xed30('0xb')][_0xed30('0xc')]({'port':0x232a});config['redis']=_[_0xed30('0xd')](config[_0xed30('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xed30('0xe')]));require(_0xed30('0xf'))[_0xed30('0x10')](socket);function respondWithRpcPromise(_0x182c9a,_0x5c6e0c,_0x596d98){return new BPromise(function(_0xbb6fd5,_0x498277){return client[_0xed30('0x11')](_0x182c9a,_0x596d98)[_0xed30('0x12')](function(_0x29908e){logger[_0xed30('0x13')](_0xed30('0x14'),_0x5c6e0c,_0xed30('0x15'));logger[_0xed30('0x16')](_0xed30('0x17'),_0x5c6e0c,_0xed30('0x15'),JSON[_0xed30('0x18')](_0x29908e));if(_0x29908e[_0xed30('0x19')]){if(_0x29908e[_0xed30('0x19')][_0xed30('0x1a')]===0x1f4){logger[_0xed30('0x19')](_0xed30('0x14'),_0x5c6e0c,_0x29908e['error'][_0xed30('0x1b')]);return _0x498277(_0x29908e['error'][_0xed30('0x1b')]);}logger[_0xed30('0x19')](_0xed30('0x14'),_0x5c6e0c,_0x29908e[_0xed30('0x19')][_0xed30('0x1b')]);return _0xbb6fd5(_0x29908e[_0xed30('0x19')]['message']);}else{logger[_0xed30('0x13')]('SquareProject,\x20%s,\x20%s',_0x5c6e0c,_0xed30('0x15'));_0xbb6fd5(_0x29908e[_0xed30('0x1c')]['message']);}})['catch'](function(_0x16544){logger['error']('SquareProject,\x20%s,\x20%s',_0x5c6e0c,_0x16544);_0x498277(_0x16544);});});}exports[_0xed30('0x1d')]=function(_0x336807){var _0x4dcfd9=this;return new Promise(function(_0xac0c07,_0x591619){return db[_0xed30('0x1e')][_0xed30('0x1f')]({'raw':_0x336807['options']?_0x336807[_0xed30('0x20')][_0xed30('0x21')]===undefined?!![]:![]:!![],'where':_0x336807[_0xed30('0x20')]?_0x336807[_0xed30('0x20')]['where']||null:null,'attributes':_0x336807[_0xed30('0x20')]?_0x336807[_0xed30('0x20')][_0xed30('0x22')]||null:null,'include':_0x336807[_0xed30('0x20')]?_0x336807[_0xed30('0x20')]['include']?_['map'](_0x336807[_0xed30('0x20')][_0xed30('0x23')],function(_0x7d1e8c){return{'model':db[_0x7d1e8c[_0xed30('0x24')]],'as':_0x7d1e8c['as'],'attributes':_0x7d1e8c['attributes'],'include':_0x7d1e8c[_0xed30('0x23')]?_[_0xed30('0x25')](_0x7d1e8c[_0xed30('0x23')],function(_0x5146ff){return{'model':db[_0x5146ff[_0xed30('0x24')]],'as':_0x5146ff['as'],'attributes':_0x5146ff[_0xed30('0x22')],'include':_0x5146ff['include']?_['map'](_0x5146ff[_0xed30('0x23')],function(_0x3fd4b0){return{'model':db[_0x3fd4b0[_0xed30('0x24')]],'as':_0x3fd4b0['as'],'attributes':_0x3fd4b0[_0xed30('0x22')]};}):[]};}):[]};}):[]:[]})[_0xed30('0x12')](function(_0x18f3f1){logger[_0xed30('0x13')]('ShowSquareProject',_0x336807);logger[_0xed30('0x16')](_0xed30('0x1d'),_0x336807,JSON[_0xed30('0x18')](_0x18f3f1));_0xac0c07(_0x18f3f1);})[_0xed30('0x26')](function(_0x1f091f){logger[_0xed30('0x19')](_0xed30('0x1d'),_0x1f091f[_0xed30('0x1b')],_0x336807);_0x591619(_0x4dcfd9[_0xed30('0x19')](0x1f4,_0x1f091f['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index ae9eb91..a6a07bd 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 _0x4930=['removeListener','register','length','squareProject:','./squareProject.events','save','remove','update','emit'];(function(_0x1539c3,_0x46aae5){var _0x29446b=function(_0x5a6ddf){while(--_0x5a6ddf){_0x1539c3['push'](_0x1539c3['shift']());}};_0x29446b(++_0x46aae5);}(_0x4930,0xa6));var _0x0493=function(_0x2c7568,_0x981a9e){_0x2c7568=_0x2c7568-0x0;var _0x10443c=_0x4930[_0x2c7568];return _0x10443c;};'use strict';var SquareProjectEvents=require(_0x0493('0x0'));var events=[_0x0493('0x1'),_0x0493('0x2'),_0x0493('0x3')];function createListener(_0x1766f1,_0x56f89b){return function(_0x550994){_0x56f89b[_0x0493('0x4')](_0x1766f1,_0x550994);};}function removeListener(_0x53332a,_0x52e1ff){return function(){SquareProjectEvents[_0x0493('0x5')](_0x53332a,_0x52e1ff);};}exports[_0x0493('0x6')]=function(_0x38448e){for(var _0x1af5db=0x0,_0x44c755=events[_0x0493('0x7')];_0x1af5db<_0x44c755;_0x1af5db++){var _0x5be980=events[_0x1af5db];var _0x3d6de9=createListener(_0x0493('0x8')+_0x5be980,_0x38448e);SquareProjectEvents['on'](_0x5be980,_0x3d6de9);}}; \ No newline at end of file +var _0xba6c=['save','remove','update','emit','removeListener','register','length','./squareProject.events'];(function(_0x4bbdb6,_0x2e1ac3){var _0x55f828=function(_0x4f58c6){while(--_0x4f58c6){_0x4bbdb6['push'](_0x4bbdb6['shift']());}};_0x55f828(++_0x2e1ac3);}(_0xba6c,0x6f));var _0xcba6=function(_0x23c73d,_0x357b21){_0x23c73d=_0x23c73d-0x0;var _0x36ba47=_0xba6c[_0x23c73d];return _0x36ba47;};'use strict';var SquareProjectEvents=require(_0xcba6('0x0'));var events=[_0xcba6('0x1'),_0xcba6('0x2'),_0xcba6('0x3')];function createListener(_0xeae70,_0x21c26e){return function(_0x2e813f){_0x21c26e[_0xcba6('0x4')](_0xeae70,_0x2e813f);};}function removeListener(_0x1ae003,_0x562616){return function(){SquareProjectEvents[_0xcba6('0x5')](_0x1ae003,_0x562616);};}exports[_0xcba6('0x6')]=function(_0x232b7f){for(var _0x1eb842=0x0,_0x1faf51=events[_0xcba6('0x7')];_0x1eb842<_0x1faf51;_0x1eb842++){var _0x27afc1=events[_0x1eb842];var _0x2c37fc=createListener('squareProject:'+_0x27afc1,_0x232b7f);SquareProjectEvents['on'](_0x27afc1,_0x2c37fc);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index b26cce9..cbf6dc4 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 _0x53ec=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareRecording.controller','isAuthenticated','get','/:id','show','/:id/download','download','post','create','put'];(function(_0xb7759b,_0x23c67f){var _0x2de746=function(_0x43daf6){while(--_0x43daf6){_0xb7759b['push'](_0xb7759b['shift']());}};_0x2de746(++_0x23c67f);}(_0x53ec,0x192));var _0xc53e=function(_0x524bf9,_0x47462b){_0x524bf9=_0x524bf9-0x0;var _0x550148=_0x53ec[_0x524bf9];return _0x550148;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xf')]('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router[_0xc53e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc53e('0x12')]);router['delete']('/:id',auth[_0xc53e('0x9')](),controller[_0xc53e('0x13')]);module[_0xc53e('0x14')]=router; \ No newline at end of file +var _0x326f=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','download','post','create','put','delete','exports'];(function(_0x1d5677,_0x342d27){var _0x274227=function(_0x5ead9c){while(--_0x5ead9c){_0x1d5677['push'](_0x1d5677['shift']());}};_0x274227(++_0x342d27);}(_0x326f,0xd1));var _0xf326=function(_0x1a58d7,_0x5acc12){_0x1a58d7=_0x1a58d7-0x0;var _0x5f3785=_0x326f[_0x1a58d7];return _0x5f3785;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0xe')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router[_0xf326('0x10')]('/:id',auth[_0xf326('0xa')](),controller['update']);router[_0xf326('0x11')]('/:id',auth[_0xf326('0xa')](),controller['destroy']);module[_0xf326('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index d3c36dd..477c231 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 _0x7217=['lastIndexOf','sequelize','STRING','VIRTUAL','getDataValue','savePath','substring'];(function(_0x7e3bf6,_0xfbe90c){var _0x319692=function(_0x11968c){while(--_0x11968c){_0x7e3bf6['push'](_0x7e3bf6['shift']());}};_0x319692(++_0xfbe90c);}(_0x7217,0x19e));var _0x7721=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x7217[_0x24237f];return _0x48298e;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7721('0x1')]},'callerid':{'type':Sequelize[_0x7721('0x1')]},'calleridname':{'type':Sequelize[_0x7721('0x1')]},'context':{'type':Sequelize[_0x7721('0x1')]},'extension':{'type':Sequelize[_0x7721('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x7721('0x1')]},'projectName':{'type':Sequelize[_0x7721('0x1')]},'saveName':{'type':Sequelize[_0x7721('0x1')]},'filename':{'type':Sequelize[_0x7721('0x1')]},'savePath':{'type':Sequelize[_0x7721('0x1')]},'format':{'type':Sequelize[_0x7721('0x2')],'get':function(){var _0x18ab6b='';var _0x21f680=this[_0x7721('0x3')](_0x7721('0x4'));if(_0x21f680){_0x18ab6b=_0x21f680[_0x7721('0x5')](_0x21f680[_0x7721('0x6')]('.'));}return _0x18ab6b;}}}; \ No newline at end of file +var _0x7c09=['exports','STRING','VIRTUAL','getDataValue','savePath','lastIndexOf'];(function(_0x391e22,_0x33c432){var _0x5598a9=function(_0x82415e){while(--_0x82415e){_0x391e22['push'](_0x391e22['shift']());}};_0x5598a9(++_0x33c432);}(_0x7c09,0x102));var _0x97c0=function(_0x39c1a1,_0x4647a8){_0x39c1a1=_0x39c1a1-0x0;var _0x81a7=_0x7c09[_0x39c1a1];return _0x81a7;};'use strict';var Sequelize=require('sequelize');module[_0x97c0('0x0')]={'uniqueid':{'type':Sequelize[_0x97c0('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x97c0('0x1')]},'context':{'type':Sequelize[_0x97c0('0x1')]},'extension':{'type':Sequelize[_0x97c0('0x1')]},'priority':{'type':Sequelize[_0x97c0('0x1')]},'accountcode':{'type':Sequelize[_0x97c0('0x1')]},'dnid':{'type':Sequelize[_0x97c0('0x1')]},'projectName':{'type':Sequelize[_0x97c0('0x1')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x97c0('0x2')],'get':function(){var _0x42c6c7='';var _0x2c19fa=this[_0x97c0('0x3')](_0x97c0('0x4'));if(_0x2c19fa){_0x42c6c7=_0x2c19fa['substring'](_0x2c19fa[_0x97c0('0x5')]('.'));}return _0x42c6c7;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index b692ad2..00e6fcb 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 _0x9274=['SquareRecording','rawAttributes','fieldName','type','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','intersection','create','body','download','../../components/encryptor','uniqueid','find','savePath','filename','format','%s.cypher','existsSync','secrets','Sequelize','SquareRecording\x20not\x20found','extname','message','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map'];(function(_0x27dd46,_0x594638){var _0x2ab512=function(_0x18d7a6){while(--_0x18d7a6){_0x27dd46['push'](_0x27dd46['shift']());}};_0x2ab512(++_0x594638);}(_0x9274,0x1ab));var _0x4927=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9274[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x4927('0x0'));var rimraf=require(_0x4927('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4927('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4927('0x3'));var Mustache=require(_0x4927('0x4'));var util=require(_0x4927('0x5'));var path=require(_0x4927('0x6'));var sox=require(_0x4927('0x7'));var csv=require(_0x4927('0x8'));var ejs=require(_0x4927('0x9'));var fs=require('fs');var fs_extra=require(_0x4927('0xa'));var _=require(_0x4927('0xb'));var squel=require(_0x4927('0xc'));var crypto=require('crypto');var jsforce=require(_0x4927('0xd'));var deskjs=require(_0x4927('0xe'));var toCsv=require(_0x4927('0x8'));var querystring=require(_0x4927('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4927('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4927('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4927('0x12'))(_0x4927('0x13'));var utils=require('../../config/utils');var config=require(_0x4927('0x14'));var licenseUtil=require(_0x4927('0x15'));var db=require(_0x4927('0x16'))['db'];function respondWithStatusCode(_0x2831d8,_0x3a45b2){_0x3a45b2=_0x3a45b2||0xcc;return function(_0xa90b9d){if(_0xa90b9d){return _0x2831d8[_0x4927('0x17')](_0x3a45b2);}return _0x2831d8[_0x4927('0x18')](_0x3a45b2)[_0x4927('0x19')]();};}function respondWithResult(_0x57f5b1,_0x59195c){_0x59195c=_0x59195c||0xc8;return function(_0x4d3115){if(_0x4d3115){return _0x57f5b1[_0x4927('0x18')](_0x59195c)[_0x4927('0x1a')](_0x4d3115);}};}function respondWithFilteredResult(_0x2d2c30,_0xb38ab2){return function(_0x31b56f){if(_0x31b56f){var _0x2902f1=typeof _0xb38ab2[_0x4927('0x1b')]==='undefined'&&typeof _0xb38ab2[_0x4927('0x1c')]===_0x4927('0x1d');var _0x4a840c=_0x31b56f[_0x4927('0x1e')];var _0x5eac0b=_0x2902f1?0x0:_0xb38ab2['offset'];var _0x1f44bc=_0x2902f1?_0x31b56f[_0x4927('0x1e')]:_0xb38ab2['offset']+_0xb38ab2[_0x4927('0x1c')];var _0x52154c;if(_0x1f44bc>=_0x4a840c){_0x1f44bc=_0x4a840c;_0x52154c=0xc8;}else{_0x52154c=0xce;}_0x2d2c30['status'](_0x52154c);return _0x2d2c30[_0x4927('0x1f')](_0x4927('0x20'),_0x5eac0b+'-'+_0x1f44bc+'/'+_0x4a840c)[_0x4927('0x1a')](_0x31b56f);}return null;};}function patchUpdates(_0x415672){return function(_0x34b761){try{jsonpatch[_0x4927('0x21')](_0x34b761,_0x415672,!![]);}catch(_0x1e1832){return BPromise['reject'](_0x1e1832);}return _0x34b761[_0x4927('0x22')]();};}function saveUpdates(_0x2e0803,_0x4e7d67){return function(_0x243e87){if(_0x243e87){return _0x243e87[_0x4927('0x23')](_0x2e0803)[_0x4927('0x24')](function(_0x44f595){return _0x44f595;});}return null;};}function removeEntity(_0x5d1261,_0xd08b8d){return function(_0x58898f){if(_0x58898f){return _0x58898f[_0x4927('0x25')]()[_0x4927('0x24')](function(){_0x5d1261[_0x4927('0x18')](0xcc)[_0x4927('0x19')]();});}};}function handleEntityNotFound(_0x138113,_0x3f8a63){return function(_0x667c72){if(!_0x667c72){_0x138113[_0x4927('0x17')](0x194);}return _0x667c72;};}function handleError(_0x239489,_0x57d55d){_0x57d55d=_0x57d55d||0x1f4;return function(_0x1c4318){logger[_0x4927('0x26')](_0x1c4318[_0x4927('0x27')]);if(_0x1c4318[_0x4927('0x28')]){delete _0x1c4318[_0x4927('0x28')];}_0x239489[_0x4927('0x18')](_0x57d55d)['send'](_0x1c4318);};}exports[_0x4927('0x29')]=function(_0x222fdf,_0x242da){var _0x1c2251={},_0x34892e={},_0x3e1f7b={'count':0x0,'rows':[]};var _0x269f0f=_[_0x4927('0x2a')](db[_0x4927('0x2b')][_0x4927('0x2c')],function(_0x137958){return{'name':_0x137958[_0x4927('0x2d')],'type':_0x137958[_0x4927('0x2e')]['key']};});_0x34892e[_0x4927('0x2f')]=_[_0x4927('0x2a')](_0x269f0f,_0x4927('0x28'));_0x34892e[_0x4927('0x30')]=_['keys'](_0x222fdf[_0x4927('0x30')]);_0x34892e[_0x4927('0x31')]=_['intersection'](_0x34892e[_0x4927('0x2f')],_0x34892e[_0x4927('0x30')]);_0x1c2251[_0x4927('0x32')]=_['intersection'](_0x34892e[_0x4927('0x2f')],qs[_0x4927('0x33')](_0x222fdf[_0x4927('0x30')][_0x4927('0x33')]));_0x1c2251['attributes']=_0x1c2251[_0x4927('0x32')][_0x4927('0x34')]?_0x1c2251[_0x4927('0x32')]:_0x34892e[_0x4927('0x2f')];if(!_0x222fdf[_0x4927('0x30')][_0x4927('0x35')](_0x4927('0x36'))){_0x1c2251[_0x4927('0x1c')]=qs['limit'](_0x222fdf[_0x4927('0x30')]['limit']);_0x1c2251['offset']=qs[_0x4927('0x1b')](_0x222fdf[_0x4927('0x30')]['offset']);}_0x1c2251['order']=qs[_0x4927('0x37')](_0x222fdf[_0x4927('0x30')][_0x4927('0x37')]);_0x1c2251[_0x4927('0x38')]=qs[_0x4927('0x31')](_[_0x4927('0x39')](_0x222fdf['query'],_0x34892e[_0x4927('0x31')]),_0x269f0f);if(_0x222fdf[_0x4927('0x30')][_0x4927('0x3a')]){_0x1c2251[_0x4927('0x38')]=_[_0x4927('0x3b')](_0x1c2251[_0x4927('0x38')],{'$or':_[_0x4927('0x2a')](_0x269f0f,function(_0x5b3a4c){if(_0x5b3a4c[_0x4927('0x2e')]!==_0x4927('0x3c')){var _0x1c806b={};_0x1c806b[_0x5b3a4c['name']]={'$like':'%'+_0x222fdf[_0x4927('0x30')][_0x4927('0x3a')]+'%'};return _0x1c806b;}})});}_0x1c2251=_[_0x4927('0x3b')]({},_0x1c2251,_0x222fdf[_0x4927('0x3d')]);var _0x483aea={'where':_0x1c2251[_0x4927('0x38')]};return db[_0x4927('0x2b')]['count'](_0x483aea)['then'](function(_0x47f390){_0x3e1f7b[_0x4927('0x1e')]=_0x47f390;if(_0x222fdf[_0x4927('0x30')]['includeAll']){_0x1c2251[_0x4927('0x3e')]=[{'all':!![]}];}return db['SquareRecording'][_0x4927('0x3f')](_0x1c2251);})[_0x4927('0x24')](function(_0x13dec4){_0x3e1f7b[_0x4927('0x40')]=_0x13dec4;return _0x3e1f7b;})[_0x4927('0x24')](respondWithFilteredResult(_0x242da,_0x1c2251))[_0x4927('0x41')](handleError(_0x242da,null));};exports[_0x4927('0x42')]=function(_0x1cceaa,_0x52b510){var _0x398431={'raw':!![],'where':{'id':_0x1cceaa[_0x4927('0x43')]['id']}},_0x4c5c8f={};_0x4c5c8f[_0x4927('0x2f')]=_[_0x4927('0x44')](db[_0x4927('0x2b')]['rawAttributes']);_0x4c5c8f['query']=_['keys'](_0x1cceaa[_0x4927('0x30')]);_0x4c5c8f['filters']=_['intersection'](_0x4c5c8f['model'],_0x4c5c8f[_0x4927('0x30')]);_0x398431[_0x4927('0x32')]=_[_0x4927('0x45')](_0x4c5c8f[_0x4927('0x2f')],qs[_0x4927('0x33')](_0x1cceaa[_0x4927('0x30')][_0x4927('0x33')]));_0x398431[_0x4927('0x32')]=_0x398431['attributes'][_0x4927('0x34')]?_0x398431['attributes']:_0x4c5c8f[_0x4927('0x2f')];if(_0x1cceaa[_0x4927('0x30')]['includeAll']){_0x398431[_0x4927('0x3e')]=[{'all':!![]}];}_0x398431=_[_0x4927('0x3b')]({},_0x398431,_0x1cceaa[_0x4927('0x3d')]);return db[_0x4927('0x2b')]['find'](_0x398431)[_0x4927('0x24')](handleEntityNotFound(_0x52b510,null))['then'](respondWithResult(_0x52b510,null))[_0x4927('0x41')](handleError(_0x52b510,null));};exports[_0x4927('0x46')]=function(_0xa37541,_0xbb4fda){return db[_0x4927('0x2b')][_0x4927('0x46')](_0xa37541[_0x4927('0x47')],{})['then'](respondWithResult(_0xbb4fda,0xc9))['catch'](handleError(_0xbb4fda,null));};exports[_0x4927('0x23')]=function(_0x310345,_0x2cf3dc){if(_0x310345['body']['id']){delete _0x310345[_0x4927('0x47')]['id'];}return db[_0x4927('0x2b')]['find']({'where':{'id':_0x310345[_0x4927('0x43')]['id']}})['then'](handleEntityNotFound(_0x2cf3dc,null))[_0x4927('0x24')](saveUpdates(_0x310345[_0x4927('0x47')],null))['then'](respondWithResult(_0x2cf3dc,null))['catch'](handleError(_0x2cf3dc,null));};exports[_0x4927('0x48')]=function(_0x3ef537,_0x5668b6,_0x358fe9){var _0x2e25b3=require(_0x4927('0x49'));var _0x2f0183=![];var _0x24c9bd={};if(_0x3ef537[_0x4927('0x30')][_0x4927('0x2e')]&&_0x3ef537[_0x4927('0x30')][_0x4927('0x2e')]===_0x4927('0x4a')){_0x24c9bd['uniqueid']=_0x3ef537[_0x4927('0x43')]['id'];}else{_0x24c9bd['id']=_0x3ef537[_0x4927('0x43')]['id'];}return db['SquareRecording'][_0x4927('0x4b')]({'where':_0x24c9bd,'attributes':['id',_0x4927('0x4c'),_0x4927('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x5668b6,null))[_0x4927('0x24')](function(_0x3bec42){if(_0x3bec42){var _0x1f4e2f=_0x3bec42['savePath'];var _0x49e150=util[_0x4927('0x4e')](_0x4927('0x4f'),_0x1f4e2f);if(fs[_0x4927('0x50')](_0x49e150)){_0x2f0183=!![];return _0x2e25b3['decryptFile'](_0x49e150,_0x1f4e2f,config[_0x4927('0x51')]['recording'])[_0x4927('0x24')](function(){return _0x3bec42;});}return _0x3bec42;}})[_0x4927('0x24')](function(_0x5ce3ad){if(_0x5ce3ad){var _0x410552=_0x5ce3ad[_0x4927('0x4c')];if(!fs[_0x4927('0x50')](_0x410552)){throw new db[(_0x4927('0x52'))]['ValidationError'](_0x4927('0x53'));}if(_0x5ce3ad['filename']){return _0x5668b6[_0x4927('0x48')](_0x410552,_0x5ce3ad[_0x4927('0x4d')]+path[_0x4927('0x54')](_0x410552),function(){if(_0x2f0183){fs['unlink'](_0x410552);}});}else{return _0x5668b6[_0x4927('0x48')](_0x410552,function(_0x165b08){if(_0x2f0183){fs['unlink'](_0x410552);}});}}})[_0x4927('0x41')](function(_0x39f689){if(_0x39f689[_0x4927('0x55')]===_0x4927('0x53')){_0x5668b6[_0x4927('0x18')](0x194)['send'](_0x4927('0x56'));}else{return handleError(_0x5668b6,null);}});};exports[_0x4927('0x25')]=function(_0x15e22e,_0x583772){return db[_0x4927('0x2b')][_0x4927('0x4b')]({'where':{'id':_0x15e22e[_0x4927('0x43')]['id']}})['then'](function(_0xffe9a7){if(_['isNil'](_0xffe9a7)){throw new ReferenceError('Entity\x20not\x20found');}return _0xffe9a7;})[_0x4927('0x24')](function(_0x2d54f7){var _0x5b8945=_0x2d54f7[_0x4927('0x4c')];logger[_0x4927('0x57')](_0x4927('0x58'),_0x5b8945);if(!_[_0x4927('0x59')](_0x2d54f7[_0x4927('0x4c')])&&fs['existsSync'](_0x5b8945)){logger['info'](_0x4927('0x5a')+_0x5b8945+_0x4927('0x5b'));fs[_0x4927('0x5c')](_0x5b8945);}_0x5b8945=_0x5b8945+_0x4927('0x5d');if(!_[_0x4927('0x59')](_0x2d54f7[_0x4927('0x4c')])&&fs['existsSync'](_0x5b8945)){logger[_0x4927('0x57')](_0x4927('0x5a')+_0x5b8945+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x4927('0x5c')](_0x5b8945);}return _0x2d54f7;})['then'](function(_0x356cb2){if(!_0x356cb2)throw new InternalError();return _0x356cb2[_0x4927('0x25')]();})[_0x4927('0x24')](function(){_0x583772[_0x4927('0x18')](0xcc)[_0x4927('0x19')]();})['catch'](handleError(_0x583772,null));}; \ No newline at end of file +var _0x9a1f=['%s.cypher','decryptFile','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','download','message','send','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','error','stack','name','index','map','SquareRecording','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','uniqueid','savePath','format'];(function(_0x31ead7,_0x2e9a7c){var _0x3516f0=function(_0x47fa36){while(--_0x47fa36){_0x31ead7['push'](_0x31ead7['shift']());}};_0x3516f0(++_0x2e9a7c);}(_0x9a1f,0x141));var _0xf9a1=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x9a1f[_0x5d80de];return _0x1c7556;};'use strict';var emlformat=require(_0xf9a1('0x0'));var rimraf=require(_0xf9a1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf9a1('0x2'));var rp=require(_0xf9a1('0x3'));var moment=require(_0xf9a1('0x4'));var BPromise=require(_0xf9a1('0x5'));var Mustache=require(_0xf9a1('0x6'));var util=require(_0xf9a1('0x7'));var path=require(_0xf9a1('0x8'));var sox=require(_0xf9a1('0x9'));var csv=require('to-csv');var ejs=require(_0xf9a1('0xa'));var fs=require('fs');var fs_extra=require(_0xf9a1('0xb'));var _=require(_0xf9a1('0xc'));var squel=require(_0xf9a1('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf9a1('0xe'));var toCsv=require(_0xf9a1('0xf'));var querystring=require(_0xf9a1('0x10'));var Papa=require(_0xf9a1('0x11'));var Redis=require(_0xf9a1('0x12'));var authService=require(_0xf9a1('0x13'));var qs=require(_0xf9a1('0x14'));var as=require(_0xf9a1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf9a1('0x16'));var utils=require('../../config/utils');var config=require(_0xf9a1('0x17'));var licenseUtil=require(_0xf9a1('0x18'));var db=require(_0xf9a1('0x19'))['db'];function respondWithStatusCode(_0x539736,_0x24fbd2){_0x24fbd2=_0x24fbd2||0xcc;return function(_0x4ac810){if(_0x4ac810){return _0x539736[_0xf9a1('0x1a')](_0x24fbd2);}return _0x539736[_0xf9a1('0x1b')](_0x24fbd2)[_0xf9a1('0x1c')]();};}function respondWithResult(_0x50b7ab,_0x187f28){_0x187f28=_0x187f28||0xc8;return function(_0x3d5095){if(_0x3d5095){return _0x50b7ab[_0xf9a1('0x1b')](_0x187f28)[_0xf9a1('0x1d')](_0x3d5095);}};}function respondWithFilteredResult(_0x4ef7db,_0x15b752){return function(_0x2ea921){if(_0x2ea921){var _0x48a5e1=typeof _0x15b752[_0xf9a1('0x1e')]===_0xf9a1('0x1f')&&typeof _0x15b752[_0xf9a1('0x20')]===_0xf9a1('0x1f');var _0x50a70d=_0x2ea921[_0xf9a1('0x21')];var _0x34b3ec=_0x48a5e1?0x0:_0x15b752[_0xf9a1('0x1e')];var _0x809cf=_0x48a5e1?_0x2ea921[_0xf9a1('0x21')]:_0x15b752[_0xf9a1('0x1e')]+_0x15b752[_0xf9a1('0x20')];var _0x27193f;if(_0x809cf>=_0x50a70d){_0x809cf=_0x50a70d;_0x27193f=0xc8;}else{_0x27193f=0xce;}_0x4ef7db['status'](_0x27193f);return _0x4ef7db['set'](_0xf9a1('0x22'),_0x34b3ec+'-'+_0x809cf+'/'+_0x50a70d)[_0xf9a1('0x1d')](_0x2ea921);}return null;};}function patchUpdates(_0x127d31){return function(_0x37354b){try{jsonpatch[_0xf9a1('0x23')](_0x37354b,_0x127d31,!![]);}catch(_0xa40c10){return BPromise['reject'](_0xa40c10);}return _0x37354b['save']();};}function saveUpdates(_0x4fd195,_0x2bd27f){return function(_0x4ad304){if(_0x4ad304){return _0x4ad304[_0xf9a1('0x24')](_0x4fd195)[_0xf9a1('0x25')](function(_0x22d4fc){return _0x22d4fc;});}return null;};}function removeEntity(_0x7daaf1,_0x488129){return function(_0x4c9d16){if(_0x4c9d16){return _0x4c9d16[_0xf9a1('0x26')]()[_0xf9a1('0x25')](function(){_0x7daaf1['status'](0xcc)[_0xf9a1('0x1c')]();});}};}function handleEntityNotFound(_0x182188,_0x2c2615){return function(_0x3fc2af){if(!_0x3fc2af){_0x182188[_0xf9a1('0x1a')](0x194);}return _0x3fc2af;};}function handleError(_0x12077,_0x3248a8){_0x3248a8=_0x3248a8||0x1f4;return function(_0x4283f6){logger[_0xf9a1('0x27')](_0x4283f6[_0xf9a1('0x28')]);if(_0x4283f6[_0xf9a1('0x29')]){delete _0x4283f6[_0xf9a1('0x29')];}_0x12077[_0xf9a1('0x1b')](_0x3248a8)['send'](_0x4283f6);};}exports[_0xf9a1('0x2a')]=function(_0x19ca5a,_0x512c5d){var _0x42cd39={},_0x4fbf7f={},_0x35c724={'count':0x0,'rows':[]};var _0x27bc03=_[_0xf9a1('0x2b')](db[_0xf9a1('0x2c')]['rawAttributes'],function(_0x134aca){return{'name':_0x134aca[_0xf9a1('0x2d')],'type':_0x134aca[_0xf9a1('0x2e')][_0xf9a1('0x2f')]};});_0x4fbf7f[_0xf9a1('0x30')]=_[_0xf9a1('0x2b')](_0x27bc03,_0xf9a1('0x29'));_0x4fbf7f[_0xf9a1('0x31')]=_[_0xf9a1('0x32')](_0x19ca5a[_0xf9a1('0x31')]);_0x4fbf7f[_0xf9a1('0x33')]=_[_0xf9a1('0x34')](_0x4fbf7f[_0xf9a1('0x30')],_0x4fbf7f['query']);_0x42cd39['attributes']=_[_0xf9a1('0x34')](_0x4fbf7f[_0xf9a1('0x30')],qs[_0xf9a1('0x35')](_0x19ca5a['query'][_0xf9a1('0x35')]));_0x42cd39['attributes']=_0x42cd39[_0xf9a1('0x36')]['length']?_0x42cd39[_0xf9a1('0x36')]:_0x4fbf7f[_0xf9a1('0x30')];if(!_0x19ca5a[_0xf9a1('0x31')][_0xf9a1('0x37')](_0xf9a1('0x38'))){_0x42cd39[_0xf9a1('0x20')]=qs[_0xf9a1('0x20')](_0x19ca5a[_0xf9a1('0x31')][_0xf9a1('0x20')]);_0x42cd39['offset']=qs[_0xf9a1('0x1e')](_0x19ca5a[_0xf9a1('0x31')][_0xf9a1('0x1e')]);}_0x42cd39[_0xf9a1('0x39')]=qs[_0xf9a1('0x3a')](_0x19ca5a[_0xf9a1('0x31')][_0xf9a1('0x3a')]);_0x42cd39[_0xf9a1('0x3b')]=qs[_0xf9a1('0x33')](_[_0xf9a1('0x3c')](_0x19ca5a[_0xf9a1('0x31')],_0x4fbf7f[_0xf9a1('0x33')]),_0x27bc03);if(_0x19ca5a['query'][_0xf9a1('0x3d')]){_0x42cd39[_0xf9a1('0x3b')]=_[_0xf9a1('0x3e')](_0x42cd39[_0xf9a1('0x3b')],{'$or':_[_0xf9a1('0x2b')](_0x27bc03,function(_0x5d2d77){if(_0x5d2d77['type']!=='VIRTUAL'){var _0x37c81a={};_0x37c81a[_0x5d2d77['name']]={'$like':'%'+_0x19ca5a['query']['filter']+'%'};return _0x37c81a;}})});}_0x42cd39=_[_0xf9a1('0x3e')]({},_0x42cd39,_0x19ca5a[_0xf9a1('0x3f')]);var _0x11a28a={'where':_0x42cd39[_0xf9a1('0x3b')]};return db['SquareRecording']['count'](_0x11a28a)[_0xf9a1('0x25')](function(_0x1a67a1){_0x35c724[_0xf9a1('0x21')]=_0x1a67a1;if(_0x19ca5a[_0xf9a1('0x31')][_0xf9a1('0x40')]){_0x42cd39[_0xf9a1('0x41')]=[{'all':!![]}];}return db['SquareRecording'][_0xf9a1('0x42')](_0x42cd39);})[_0xf9a1('0x25')](function(_0x52c7be){_0x35c724[_0xf9a1('0x43')]=_0x52c7be;return _0x35c724;})[_0xf9a1('0x25')](respondWithFilteredResult(_0x512c5d,_0x42cd39))[_0xf9a1('0x44')](handleError(_0x512c5d,null));};exports[_0xf9a1('0x45')]=function(_0x35d07f,_0x41c010){var _0x3fd86c={'raw':!![],'where':{'id':_0x35d07f[_0xf9a1('0x46')]['id']}},_0x5eadb9={};_0x5eadb9[_0xf9a1('0x30')]=_[_0xf9a1('0x32')](db[_0xf9a1('0x2c')][_0xf9a1('0x47')]);_0x5eadb9['query']=_['keys'](_0x35d07f['query']);_0x5eadb9[_0xf9a1('0x33')]=_[_0xf9a1('0x34')](_0x5eadb9[_0xf9a1('0x30')],_0x5eadb9['query']);_0x3fd86c[_0xf9a1('0x36')]=_['intersection'](_0x5eadb9[_0xf9a1('0x30')],qs[_0xf9a1('0x35')](_0x35d07f[_0xf9a1('0x31')][_0xf9a1('0x35')]));_0x3fd86c[_0xf9a1('0x36')]=_0x3fd86c['attributes'][_0xf9a1('0x48')]?_0x3fd86c['attributes']:_0x5eadb9[_0xf9a1('0x30')];if(_0x35d07f[_0xf9a1('0x31')][_0xf9a1('0x40')]){_0x3fd86c[_0xf9a1('0x41')]=[{'all':!![]}];}_0x3fd86c=_['merge']({},_0x3fd86c,_0x35d07f[_0xf9a1('0x3f')]);return db['SquareRecording'][_0xf9a1('0x49')](_0x3fd86c)[_0xf9a1('0x25')](handleEntityNotFound(_0x41c010,null))[_0xf9a1('0x25')](respondWithResult(_0x41c010,null))['catch'](handleError(_0x41c010,null));};exports[_0xf9a1('0x4a')]=function(_0x34e3f3,_0x33f698){return db[_0xf9a1('0x2c')][_0xf9a1('0x4a')](_0x34e3f3['body'],{})['then'](respondWithResult(_0x33f698,0xc9))[_0xf9a1('0x44')](handleError(_0x33f698,null));};exports['update']=function(_0x2d9302,_0x13dd1d){if(_0x2d9302[_0xf9a1('0x4b')]['id']){delete _0x2d9302[_0xf9a1('0x4b')]['id'];}return db[_0xf9a1('0x2c')][_0xf9a1('0x49')]({'where':{'id':_0x2d9302[_0xf9a1('0x46')]['id']}})[_0xf9a1('0x25')](handleEntityNotFound(_0x13dd1d,null))['then'](saveUpdates(_0x2d9302[_0xf9a1('0x4b')],null))[_0xf9a1('0x25')](respondWithResult(_0x13dd1d,null))[_0xf9a1('0x44')](handleError(_0x13dd1d,null));};exports['download']=function(_0x3a870b,_0x27cb1a,_0x6494a6){var _0x3b2e62=require('../../components/encryptor');var _0xf90cfd=![];var _0xa77911={};if(_0x3a870b[_0xf9a1('0x31')][_0xf9a1('0x2e')]&&_0x3a870b[_0xf9a1('0x31')]['type']===_0xf9a1('0x4c')){_0xa77911[_0xf9a1('0x4c')]=_0x3a870b[_0xf9a1('0x46')]['id'];}else{_0xa77911['id']=_0x3a870b[_0xf9a1('0x46')]['id'];}return db[_0xf9a1('0x2c')]['find']({'where':_0xa77911,'attributes':['id','savePath','filename'],'raw':!![]})['then'](handleEntityNotFound(_0x27cb1a,null))[_0xf9a1('0x25')](function(_0x11d9f7){if(_0x11d9f7){var _0x859ba0=_0x11d9f7[_0xf9a1('0x4d')];var _0x5db2aa=util[_0xf9a1('0x4e')](_0xf9a1('0x4f'),_0x859ba0);if(fs['existsSync'](_0x5db2aa)){_0xf90cfd=!![];return _0x3b2e62[_0xf9a1('0x50')](_0x5db2aa,_0x859ba0,config['secrets']['recording'])[_0xf9a1('0x25')](function(){return _0x11d9f7;});}return _0x11d9f7;}})['then'](function(_0x3c0956){if(_0x3c0956){var _0x586c14=_0x3c0956['savePath'];if(!fs[_0xf9a1('0x51')](_0x586c14)){throw new db[(_0xf9a1('0x52'))][(_0xf9a1('0x53'))](_0xf9a1('0x54'));}if(_0x3c0956[_0xf9a1('0x55')]){return _0x27cb1a['download'](_0x586c14,_0x3c0956['filename']+path[_0xf9a1('0x56')](_0x586c14),function(){if(_0xf90cfd){fs[_0xf9a1('0x57')](_0x586c14);}});}else{return _0x27cb1a[_0xf9a1('0x58')](_0x586c14,function(_0x188622){if(_0xf90cfd){fs[_0xf9a1('0x57')](_0x586c14);}});}}})[_0xf9a1('0x44')](function(_0x366023){if(_0x366023[_0xf9a1('0x59')]===_0xf9a1('0x54')){_0x27cb1a[_0xf9a1('0x1b')](0x194)[_0xf9a1('0x5a')](_0xf9a1('0x5b'));}else{return handleError(_0x27cb1a,null);}});};exports[_0xf9a1('0x26')]=function(_0x55d7c5,_0x2b4f28){return db[_0xf9a1('0x2c')][_0xf9a1('0x49')]({'where':{'id':_0x55d7c5[_0xf9a1('0x46')]['id']}})[_0xf9a1('0x25')](function(_0x13d2ce){if(_[_0xf9a1('0x5c')](_0x13d2ce)){throw new ReferenceError(_0xf9a1('0x5d'));}return _0x13d2ce;})[_0xf9a1('0x25')](function(_0x4b49a4){var _0x59ac7c=_0x4b49a4[_0xf9a1('0x4d')];logger[_0xf9a1('0x5e')](_0xf9a1('0x5f'),_0x59ac7c);if(!_['isNil'](_0x4b49a4[_0xf9a1('0x4d')])&&fs[_0xf9a1('0x51')](_0x59ac7c)){logger[_0xf9a1('0x5e')](_0xf9a1('0x60')+_0x59ac7c+_0xf9a1('0x61'));fs[_0xf9a1('0x62')](_0x59ac7c);}_0x59ac7c=_0x59ac7c+_0xf9a1('0x63');if(!_[_0xf9a1('0x5c')](_0x4b49a4[_0xf9a1('0x4d')])&&fs[_0xf9a1('0x51')](_0x59ac7c)){logger[_0xf9a1('0x5e')](_0xf9a1('0x60')+_0x59ac7c+_0xf9a1('0x61'));fs[_0xf9a1('0x62')](_0x59ac7c);}return _0x4b49a4;})['then'](function(_0x1a2911){if(!_0x1a2911)throw new InternalError();return _0x1a2911[_0xf9a1('0x26')]();})[_0xf9a1('0x25')](function(){_0x2b4f28[_0xf9a1('0x1b')](0xcc)[_0xf9a1('0x1c')]();})[_0xf9a1('0x44')](handleError(_0x2b4f28,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index bf1f5a6..2435f0f 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 _0xd98a=['define','SquareRecording','lodash','api','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x26d386,_0x1660c0){var _0x4ef9a8=function(_0x55e2d3){while(--_0x55e2d3){_0x26d386['push'](_0x26d386['shift']());}};_0x4ef9a8(++_0x1660c0);}(_0xd98a,0xfc));var _0xad98=function(_0x31a7d7,_0x4fca55){_0x31a7d7=_0x31a7d7-0x0;var _0x421c90=_0xd98a[_0x31a7d7];return _0x421c90;};'use strict';var _=require(_0xad98('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xad98('0x1'));var moment=require(_0xad98('0x2'));var BPromise=require(_0xad98('0x3'));var rp=require(_0xad98('0x4'));var fs=require('fs');var path=require(_0xad98('0x5'));var rimraf=require(_0xad98('0x6'));var config=require('../../config/environment');var attributes=require('./squareRecording.attributes');module[_0xad98('0x7')]=function(_0x38f547,_0x17e650){return _0x38f547[_0xad98('0x8')](_0xad98('0x9'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x195f=['rimraf','../../config/environment','./squareRecording.attributes','exports','define','lodash','util','api','moment','request-promise'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x195f,0x113));var _0xf195=function(_0x414f67,_0x861aed){_0x414f67=_0x414f67-0x0;var _0x338537=_0x195f[_0x414f67];return _0x338537;};'use strict';var _=require(_0xf195('0x0'));var util=require(_0xf195('0x1'));var logger=require('../../config/logger')(_0xf195('0x2'));var moment=require(_0xf195('0x3'));var BPromise=require('bluebird');var rp=require(_0xf195('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf195('0x5'));var config=require(_0xf195('0x6'));var attributes=require(_0xf195('0x7'));module[_0xf195('0x8')]=function(_0x2c45fd,_0x7aeadd){return _0x2c45fd[_0xf195('0x9')]('SquareRecording',attributes,{'tableName':'square_recordings','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 567120a..4a75d35 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 _0x14eb=['catch','CreateSquareRecording','SquareRecording','create','body','options','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x14eb,0xdf));var _0xb14e=function(_0x3c2040,_0xc00cf3){_0x3c2040=_0x3c2040-0x0;var _0xdc2154=_0x14eb[_0x3c2040];return _0xdc2154;};'use strict';var _=require(_0xb14e('0x0'));var util=require(_0xb14e('0x1'));var moment=require(_0xb14e('0x2'));var BPromise=require(_0xb14e('0x3'));var rs=require(_0xb14e('0x4'));var fs=require('fs');var Redis=require(_0xb14e('0x5'));var db=require(_0xb14e('0x6'))['db'];var utils=require(_0xb14e('0x7'));var logger=require('../../config/logger')(_0xb14e('0x8'));var config=require(_0xb14e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb14e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c713d,_0x34e414,_0x1a4db0){return new BPromise(function(_0x3f9a1f,_0x2cd2f8){return client[_0xb14e('0xb')](_0x5c713d,_0x1a4db0)[_0xb14e('0xc')](function(_0x59acfe){logger[_0xb14e('0xd')](_0xb14e('0xe'),_0x34e414,_0xb14e('0xf'));logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x34e414,_0xb14e('0xf'),JSON[_0xb14e('0x10')](_0x59acfe));if(_0x59acfe[_0xb14e('0x11')]){if(_0x59acfe[_0xb14e('0x11')][_0xb14e('0x12')]===0x1f4){logger[_0xb14e('0x11')](_0xb14e('0xe'),_0x34e414,_0x59acfe[_0xb14e('0x11')]['message']);return _0x2cd2f8(_0x59acfe[_0xb14e('0x11')][_0xb14e('0x13')]);}logger['error'](_0xb14e('0xe'),_0x34e414,_0x59acfe[_0xb14e('0x11')]['message']);return _0x3f9a1f(_0x59acfe[_0xb14e('0x11')][_0xb14e('0x13')]);}else{logger[_0xb14e('0xd')](_0xb14e('0xe'),_0x34e414,'request\x20sent');_0x3f9a1f(_0x59acfe['result'][_0xb14e('0x13')]);}})[_0xb14e('0x14')](function(_0x4f783c){logger[_0xb14e('0x11')](_0xb14e('0xe'),_0x34e414,_0x4f783c);_0x2cd2f8(_0x4f783c);});});}exports[_0xb14e('0x15')]=function(_0x3d7a47){var _0x13961f=this;return new Promise(function(_0x53bef7,_0x2e6c96){return db[_0xb14e('0x16')][_0xb14e('0x17')](_0x3d7a47[_0xb14e('0x18')],{'raw':_0x3d7a47[_0xb14e('0x19')]?_0x3d7a47[_0xb14e('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xb14e('0xc')](function(_0x223c17){logger[_0xb14e('0xd')](_0xb14e('0x15'),_0x3d7a47);logger[_0xb14e('0x1a')]('CreateSquareRecording',_0x3d7a47,JSON['stringify'](_0x223c17));_0x53bef7(_0x223c17);})['catch'](function(_0x58de66){logger[_0xb14e('0x11')](_0xb14e('0x15'),_0x58de66['message'],_0x3d7a47);_0x2e6c96(_0x13961f[_0xb14e('0x11')](0x1f4,_0x58de66[_0xb14e('0x13')]));});});}; \ No newline at end of file +var _0x4677=['catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','SquareRecording','create','options','CreateSquareRecording'];(function(_0x2d09b1,_0x228b73){var _0x50da6a=function(_0xd3fed3){while(--_0xd3fed3){_0x2d09b1['push'](_0x2d09b1['shift']());}};_0x50da6a(++_0x228b73);}(_0x4677,0x83));var _0x7467=function(_0x2900a2,_0x1c3e2f){_0x2900a2=_0x2900a2-0x0;var _0x197acc=_0x4677[_0x2900a2];return _0x197acc;};'use strict';var _=require('lodash');var util=require(_0x7467('0x0'));var moment=require(_0x7467('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7467('0x2'));var db=require(_0x7467('0x3'))['db'];var utils=require(_0x7467('0x4'));var logger=require(_0x7467('0x5'))(_0x7467('0x6'));var config=require(_0x7467('0x7'));var jayson=require(_0x7467('0x8'));var client=jayson[_0x7467('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x490d3e,_0x1f6cae,_0x5c26a2){return new BPromise(function(_0x117f26,_0x211ecb){return client[_0x7467('0xa')](_0x490d3e,_0x5c26a2)[_0x7467('0xb')](function(_0x54fce8){logger[_0x7467('0xc')](_0x7467('0xd'),_0x1f6cae,_0x7467('0xe'));logger[_0x7467('0xf')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x1f6cae,_0x7467('0xe'),JSON[_0x7467('0x10')](_0x54fce8));if(_0x54fce8[_0x7467('0x11')]){if(_0x54fce8[_0x7467('0x11')][_0x7467('0x12')]===0x1f4){logger['error'](_0x7467('0xd'),_0x1f6cae,_0x54fce8['error']['message']);return _0x211ecb(_0x54fce8[_0x7467('0x11')][_0x7467('0x13')]);}logger[_0x7467('0x11')]('SquareRecording,\x20%s,\x20%s',_0x1f6cae,_0x54fce8[_0x7467('0x11')]['message']);return _0x117f26(_0x54fce8[_0x7467('0x11')][_0x7467('0x13')]);}else{logger[_0x7467('0xc')](_0x7467('0xd'),_0x1f6cae,_0x7467('0xe'));_0x117f26(_0x54fce8[_0x7467('0x14')]['message']);}})['catch'](function(_0x4a9dec){logger[_0x7467('0x11')](_0x7467('0xd'),_0x1f6cae,_0x4a9dec);_0x211ecb(_0x4a9dec);});});}exports['CreateSquareRecording']=function(_0x27d094){var _0x5ac794=this;return new Promise(function(_0x5cd81e,_0x523bb4){return db[_0x7467('0x15')][_0x7467('0x16')](_0x27d094['body'],{'raw':_0x27d094[_0x7467('0x17')]?_0x27d094[_0x7467('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x7467('0xb')](function(_0x4e7f3f){logger[_0x7467('0xc')](_0x7467('0x18'),_0x27d094);logger[_0x7467('0xf')](_0x7467('0x18'),_0x27d094,JSON[_0x7467('0x10')](_0x4e7f3f));_0x5cd81e(_0x4e7f3f);})[_0x7467('0x19')](function(_0x56e0d1){logger[_0x7467('0x11')](_0x7467('0x18'),_0x56e0d1[_0x7467('0x13')],_0x27d094);_0x523bb4(_0x5ac794['error'](0x1f4,_0x56e0d1[_0x7467('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 101818e..96e1a08 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x4704a1,_0x3c2642){var _0x194ae4=function(_0x50233d){while(--_0x50233d){_0x4704a1['push'](_0x4704a1['shift']());}};_0x194ae4(++_0x3c2642);}(_0xe706,0xa3));var _0x6e70=function(_0x588cbd,_0x43b872){_0x588cbd=_0x588cbd-0x0;var _0x571e75=_0xe706[_0x588cbd];return _0x571e75;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +var _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(_0x3d042c,_0x4e0db5){var _0xe90509=function(_0xfab1f5){while(--_0xfab1f5){_0x3d042c['push'](_0x3d042c['shift']());}};_0xe90509(++_0x4e0db5);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'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 7dd10f6..7f809a9 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 _0x445a=['STRING','DATE','BOOLEAN','exports'];(function(_0x4cddfb,_0x16816a){var _0x11eef7=function(_0x38546d){while(--_0x38546d){_0x4cddfb['push'](_0x4cddfb['shift']());}};_0x11eef7(++_0x16816a);}(_0x445a,0x1af));var _0xa445=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x445a[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0xa445('0x0')]={'network':{'type':Sequelize[_0xa445('0x1')]},'network_script':{'type':Sequelize[_0xa445('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa445('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa445('0x1')]},'uniqueid':{'type':Sequelize[_0xa445('0x1')]},'version':{'type':Sequelize[_0xa445('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xa445('0x1')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xa445('0x1')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xa445('0x1')]},'rdnis':{'type':Sequelize[_0xa445('0x1')]},'context':{'type':Sequelize[_0xa445('0x1')]},'extension':{'type':Sequelize[_0xa445('0x1')]},'priority':{'type':Sequelize[_0xa445('0x1')]},'enhanced':{'type':Sequelize[_0xa445('0x1')]},'accountcode':{'type':Sequelize[_0xa445('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xa445('0x2')]},'leaveAt':{'type':Sequelize[_0xa445('0x2')]},'bot':{'type':Sequelize[_0xa445('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x0cf9=['STRING','DATE','BOOLEAN','exports'];(function(_0x20752f,_0x2b3603){var _0x411638=function(_0x32a1c4){while(--_0x32a1c4){_0x20752f['push'](_0x20752f['shift']());}};_0x411638(++_0x2b3603);}(_0x0cf9,0x19f));var _0x90cf=function(_0x5bd98b,_0x22bf1c){_0x5bd98b=_0x5bd98b-0x0;var _0x49efe7=_0x0cf9[_0x5bd98b];return _0x49efe7;};'use strict';var Sequelize=require('sequelize');module[_0x90cf('0x0')]={'network':{'type':Sequelize[_0x90cf('0x1')]},'network_script':{'type':Sequelize[_0x90cf('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x90cf('0x1')]},'type':{'type':Sequelize[_0x90cf('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x90cf('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x90cf('0x1')]},'callington':{'type':Sequelize[_0x90cf('0x1')]},'callingtns':{'type':Sequelize[_0x90cf('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x90cf('0x1')]},'context':{'type':Sequelize[_0x90cf('0x1')]},'extension':{'type':Sequelize[_0x90cf('0x1')]},'priority':{'type':Sequelize[_0x90cf('0x1')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x90cf('0x1')]},'threadid':{'type':Sequelize[_0x90cf('0x1')]},'project_name':{'type':Sequelize[_0x90cf('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x90cf('0x2')]},'bot':{'type':Sequelize[_0x90cf('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 3754631..5621a10 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 _0xfc47=['rimraf','zip-dir','request-promise','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','SquareReport','rawAttributes','type','model','filters','intersection','fields','query','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','create','body','describe'];(function(_0x53245d,_0x2c7073){var _0x3f9a92=function(_0x5bea56){while(--_0x5bea56){_0x53245d['push'](_0x53245d['shift']());}};_0x3f9a92(++_0x2c7073);}(_0xfc47,0x90));var _0x7fc4=function(_0x5cb367,_0x27ec9d){_0x5cb367=_0x5cb367-0x0;var _0x279365=_0xfc47[_0x5cb367];return _0x279365;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7fc4('0x0'));var zipdir=require(_0x7fc4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7fc4('0x2'));var moment=require(_0x7fc4('0x3'));var BPromise=require(_0x7fc4('0x4'));var Mustache=require('mustache');var util=require(_0x7fc4('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x7fc4('0x6'));var ejs=require(_0x7fc4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7fc4('0x8'));var squel=require(_0x7fc4('0x9'));var crypto=require(_0x7fc4('0xa'));var jsforce=require(_0x7fc4('0xb'));var deskjs=require(_0x7fc4('0xc'));var toCsv=require(_0x7fc4('0x6'));var querystring=require(_0x7fc4('0xd'));var Papa=require(_0x7fc4('0xe'));var Redis=require(_0x7fc4('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7fc4('0x10'));var as=require(_0x7fc4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7fc4('0x12'));var utils=require(_0x7fc4('0x13'));var config=require(_0x7fc4('0x14'));var licenseUtil=require(_0x7fc4('0x15'));var db=require(_0x7fc4('0x16'))['db'];function respondWithStatusCode(_0x4f1b94,_0x3bf952){_0x3bf952=_0x3bf952||0xcc;return function(_0x82f8f3){if(_0x82f8f3){return _0x4f1b94[_0x7fc4('0x17')](_0x3bf952);}return _0x4f1b94[_0x7fc4('0x18')](_0x3bf952)[_0x7fc4('0x19')]();};}function respondWithResult(_0x398778,_0x3a9137){_0x3a9137=_0x3a9137||0xc8;return function(_0x29eb3c){if(_0x29eb3c){return _0x398778[_0x7fc4('0x18')](_0x3a9137)[_0x7fc4('0x1a')](_0x29eb3c);}};}function respondWithFilteredResult(_0x1b7cf4,_0x4da811){return function(_0x3504ee){if(_0x3504ee){var _0x452763=typeof _0x4da811['offset']===_0x7fc4('0x1b')&&typeof _0x4da811[_0x7fc4('0x1c')]===_0x7fc4('0x1b');var _0x566829=_0x3504ee[_0x7fc4('0x1d')];var _0x6c7f8f=_0x452763?0x0:_0x4da811[_0x7fc4('0x1e')];var _0x2fc750=_0x452763?_0x3504ee[_0x7fc4('0x1d')]:_0x4da811['offset']+_0x4da811[_0x7fc4('0x1c')];var _0x2f2297;if(_0x2fc750>=_0x566829){_0x2fc750=_0x566829;_0x2f2297=0xc8;}else{_0x2f2297=0xce;}_0x1b7cf4[_0x7fc4('0x18')](_0x2f2297);return _0x1b7cf4[_0x7fc4('0x1f')](_0x7fc4('0x20'),_0x6c7f8f+'-'+_0x2fc750+'/'+_0x566829)[_0x7fc4('0x1a')](_0x3504ee);}return null;};}function patchUpdates(_0x31ef33){return function(_0x57fe4d){try{jsonpatch[_0x7fc4('0x21')](_0x57fe4d,_0x31ef33,!![]);}catch(_0x3e4937){return BPromise[_0x7fc4('0x22')](_0x3e4937);}return _0x57fe4d['save']();};}function saveUpdates(_0x34c708,_0x49855d){return function(_0x5b7d21){if(_0x5b7d21){return _0x5b7d21[_0x7fc4('0x23')](_0x34c708)[_0x7fc4('0x24')](function(_0x511d16){return _0x511d16;});}return null;};}function removeEntity(_0x34e64a,_0x21ca48){return function(_0x5051fe){if(_0x5051fe){return _0x5051fe['destroy']()[_0x7fc4('0x24')](function(){_0x34e64a[_0x7fc4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3abe96,_0x59e8c1){return function(_0x19ee81){if(!_0x19ee81){_0x3abe96[_0x7fc4('0x17')](0x194);}return _0x19ee81;};}function handleError(_0x32221d,_0x3289dd){_0x3289dd=_0x3289dd||0x1f4;return function(_0x2d78e6){logger[_0x7fc4('0x25')](_0x2d78e6[_0x7fc4('0x26')]);if(_0x2d78e6[_0x7fc4('0x27')]){delete _0x2d78e6[_0x7fc4('0x27')];}_0x32221d[_0x7fc4('0x18')](_0x3289dd)[_0x7fc4('0x28')](_0x2d78e6);};}exports[_0x7fc4('0x29')]=function(_0x2590a4,_0x21635c){var _0x336935={},_0x2648d9={},_0x1f3037={'count':0x0,'rows':[]};var _0xfdd042=_[_0x7fc4('0x2a')](db[_0x7fc4('0x2b')][_0x7fc4('0x2c')],function(_0x4f74f8){return{'name':_0x4f74f8['fieldName'],'type':_0x4f74f8[_0x7fc4('0x2d')]['key']};});_0x2648d9[_0x7fc4('0x2e')]=_['map'](_0xfdd042,_0x7fc4('0x27'));_0x2648d9['query']=_['keys'](_0x2590a4['query']);_0x2648d9[_0x7fc4('0x2f')]=_[_0x7fc4('0x30')](_0x2648d9[_0x7fc4('0x2e')],_0x2648d9['query']);_0x336935['attributes']=_['intersection'](_0x2648d9['model'],qs[_0x7fc4('0x31')](_0x2590a4[_0x7fc4('0x32')][_0x7fc4('0x31')]));_0x336935[_0x7fc4('0x33')]=_0x336935[_0x7fc4('0x33')]['length']?_0x336935[_0x7fc4('0x33')]:_0x2648d9['model'];if(!_0x2590a4[_0x7fc4('0x32')][_0x7fc4('0x34')](_0x7fc4('0x35'))){_0x336935[_0x7fc4('0x1c')]=qs[_0x7fc4('0x1c')](_0x2590a4[_0x7fc4('0x32')][_0x7fc4('0x1c')]);_0x336935[_0x7fc4('0x1e')]=qs[_0x7fc4('0x1e')](_0x2590a4[_0x7fc4('0x32')]['offset']);}_0x336935[_0x7fc4('0x36')]=qs['sort'](_0x2590a4[_0x7fc4('0x32')][_0x7fc4('0x37')]);_0x336935[_0x7fc4('0x38')]=qs[_0x7fc4('0x2f')](_[_0x7fc4('0x39')](_0x2590a4[_0x7fc4('0x32')],_0x2648d9[_0x7fc4('0x2f')]),_0xfdd042);if(_0x2590a4[_0x7fc4('0x32')]['filter']){_0x336935['where']=_[_0x7fc4('0x3a')](_0x336935[_0x7fc4('0x38')],{'$or':_[_0x7fc4('0x2a')](_0xfdd042,function(_0x141340){if(_0x141340[_0x7fc4('0x2d')]!==_0x7fc4('0x3b')){var _0x3b772c={};_0x3b772c[_0x141340['name']]={'$like':'%'+_0x2590a4[_0x7fc4('0x32')][_0x7fc4('0x3c')]+'%'};return _0x3b772c;}})});}_0x336935=_[_0x7fc4('0x3a')]({},_0x336935,_0x2590a4[_0x7fc4('0x3d')]);var _0x5be878={'where':_0x336935['where']};return db[_0x7fc4('0x2b')]['count'](_0x5be878)[_0x7fc4('0x24')](function(_0x234f04){_0x1f3037[_0x7fc4('0x1d')]=_0x234f04;if(_0x2590a4[_0x7fc4('0x32')][_0x7fc4('0x3e')]){_0x336935[_0x7fc4('0x3f')]=[{'all':!![]}];}return db[_0x7fc4('0x2b')]['findAll'](_0x336935);})[_0x7fc4('0x24')](function(_0x461b45){_0x1f3037[_0x7fc4('0x40')]=_0x461b45;return _0x1f3037;})[_0x7fc4('0x24')](respondWithFilteredResult(_0x21635c,_0x336935))[_0x7fc4('0x41')](handleError(_0x21635c,null));};exports[_0x7fc4('0x42')]=function(_0x34c353,_0x1a03c3){var _0x384f7b={'raw':!![],'where':{'id':_0x34c353[_0x7fc4('0x43')]['id']}},_0x1713fc={};_0x1713fc[_0x7fc4('0x2e')]=_['keys'](db[_0x7fc4('0x2b')][_0x7fc4('0x2c')]);_0x1713fc[_0x7fc4('0x32')]=_['keys'](_0x34c353[_0x7fc4('0x32')]);_0x1713fc[_0x7fc4('0x2f')]=_[_0x7fc4('0x30')](_0x1713fc['model'],_0x1713fc[_0x7fc4('0x32')]);_0x384f7b[_0x7fc4('0x33')]=_['intersection'](_0x1713fc[_0x7fc4('0x2e')],qs[_0x7fc4('0x31')](_0x34c353[_0x7fc4('0x32')][_0x7fc4('0x31')]));_0x384f7b[_0x7fc4('0x33')]=_0x384f7b[_0x7fc4('0x33')]['length']?_0x384f7b[_0x7fc4('0x33')]:_0x1713fc[_0x7fc4('0x2e')];if(_0x34c353[_0x7fc4('0x32')]['includeAll']){_0x384f7b[_0x7fc4('0x3f')]=[{'all':!![]}];}_0x384f7b=_[_0x7fc4('0x3a')]({},_0x384f7b,_0x34c353['options']);return db[_0x7fc4('0x2b')][_0x7fc4('0x44')](_0x384f7b)[_0x7fc4('0x24')](handleEntityNotFound(_0x1a03c3,null))[_0x7fc4('0x24')](respondWithResult(_0x1a03c3,null))[_0x7fc4('0x41')](handleError(_0x1a03c3,null));};exports[_0x7fc4('0x45')]=function(_0xc002fb,_0x6c7265){return db[_0x7fc4('0x2b')]['create'](_0xc002fb[_0x7fc4('0x46')],{})[_0x7fc4('0x24')](respondWithResult(_0x6c7265,0xc9))[_0x7fc4('0x41')](handleError(_0x6c7265,null));};exports['update']=function(_0x5914bf,_0x4c11e3){if(_0x5914bf['body']['id']){delete _0x5914bf['body']['id'];}return db['SquareReport'][_0x7fc4('0x44')]({'where':{'id':_0x5914bf[_0x7fc4('0x43')]['id']}})[_0x7fc4('0x24')](handleEntityNotFound(_0x4c11e3,null))['then'](saveUpdates(_0x5914bf[_0x7fc4('0x46')],null))[_0x7fc4('0x24')](respondWithResult(_0x4c11e3,null))[_0x7fc4('0x41')](handleError(_0x4c11e3,null));};exports['destroy']=function(_0x90349,_0x3013af){return db[_0x7fc4('0x2b')]['find']({'where':{'id':_0x90349['params']['id']}})[_0x7fc4('0x24')](handleEntityNotFound(_0x3013af,null))['then'](removeEntity(_0x3013af,null))[_0x7fc4('0x41')](handleError(_0x3013af,null));};exports['describe']=function(_0x1721ad,_0x3691ed){return db['SquareReport'][_0x7fc4('0x47')]()[_0x7fc4('0x24')](respondWithResult(_0x3691ed,null))[_0x7fc4('0x41')](handleError(_0x3691ed,null));}; \ No newline at end of file +var _0xca11=['catch','length','options','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','index','SquareReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','nolimit','limit','order','sort','where','pick','merge','map','VIRTUAL','includeAll','include','findAll'];(function(_0x22f53f,_0x14ef66){var _0x57bc67=function(_0x375f18){while(--_0x375f18){_0x22f53f['push'](_0x22f53f['shift']());}};_0x57bc67(++_0x14ef66);}(_0xca11,0x9a));var _0x1ca1=function(_0xa58a4b,_0x374ae7){_0xa58a4b=_0xa58a4b-0x0;var _0x4b7ed2=_0xca11[_0xa58a4b];return _0x4b7ed2;};'use strict';var emlformat=require(_0x1ca1('0x0'));var rimraf=require(_0x1ca1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1ca1('0x2'));var rp=require('request-promise');var moment=require(_0x1ca1('0x3'));var BPromise=require(_0x1ca1('0x4'));var Mustache=require(_0x1ca1('0x5'));var util=require(_0x1ca1('0x6'));var path=require('path');var sox=require(_0x1ca1('0x7'));var csv=require('to-csv');var ejs=require(_0x1ca1('0x8'));var fs=require('fs');var fs_extra=require(_0x1ca1('0x9'));var _=require(_0x1ca1('0xa'));var squel=require(_0x1ca1('0xb'));var crypto=require(_0x1ca1('0xc'));var jsforce=require(_0x1ca1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1ca1('0xe'));var querystring=require('querystring');var Papa=require(_0x1ca1('0xf'));var Redis=require(_0x1ca1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1ca1('0x11'));var as=require(_0x1ca1('0x12'));var hardwareService=require(_0x1ca1('0x13'));var logger=require(_0x1ca1('0x14'))(_0x1ca1('0x15'));var utils=require(_0x1ca1('0x16'));var config=require(_0x1ca1('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c7532,_0x2d32e1){_0x2d32e1=_0x2d32e1||0xcc;return function(_0x169165){if(_0x169165){return _0x2c7532[_0x1ca1('0x18')](_0x2d32e1);}return _0x2c7532[_0x1ca1('0x19')](_0x2d32e1)['end']();};}function respondWithResult(_0x1f7aee,_0x5c5f60){_0x5c5f60=_0x5c5f60||0xc8;return function(_0x40cd7a){if(_0x40cd7a){return _0x1f7aee[_0x1ca1('0x19')](_0x5c5f60)[_0x1ca1('0x1a')](_0x40cd7a);}};}function respondWithFilteredResult(_0x531a66,_0xce133e){return function(_0x5b2842){if(_0x5b2842){var _0x56ced0=typeof _0xce133e[_0x1ca1('0x1b')]===_0x1ca1('0x1c')&&typeof _0xce133e['limit']===_0x1ca1('0x1c');var _0x188653=_0x5b2842[_0x1ca1('0x1d')];var _0x25c21e=_0x56ced0?0x0:_0xce133e[_0x1ca1('0x1b')];var _0x1a4551=_0x56ced0?_0x5b2842[_0x1ca1('0x1d')]:_0xce133e[_0x1ca1('0x1b')]+_0xce133e['limit'];var _0x48ed9d;if(_0x1a4551>=_0x188653){_0x1a4551=_0x188653;_0x48ed9d=0xc8;}else{_0x48ed9d=0xce;}_0x531a66[_0x1ca1('0x19')](_0x48ed9d);return _0x531a66[_0x1ca1('0x1e')](_0x1ca1('0x1f'),_0x25c21e+'-'+_0x1a4551+'/'+_0x188653)[_0x1ca1('0x1a')](_0x5b2842);}return null;};}function patchUpdates(_0x4d2039){return function(_0x3a57d8){try{jsonpatch[_0x1ca1('0x20')](_0x3a57d8,_0x4d2039,!![]);}catch(_0x870a30){return BPromise[_0x1ca1('0x21')](_0x870a30);}return _0x3a57d8[_0x1ca1('0x22')]();};}function saveUpdates(_0x365253,_0x5a8d56){return function(_0x4fa14b){if(_0x4fa14b){return _0x4fa14b[_0x1ca1('0x23')](_0x365253)[_0x1ca1('0x24')](function(_0x230ff8){return _0x230ff8;});}return null;};}function removeEntity(_0x4490ce,_0x24884b){return function(_0x3d63ae){if(_0x3d63ae){return _0x3d63ae['destroy']()[_0x1ca1('0x24')](function(){_0x4490ce[_0x1ca1('0x19')](0xcc)[_0x1ca1('0x25')]();});}};}function handleEntityNotFound(_0x550ee5,_0x3ba1e6){return function(_0x183cd3){if(!_0x183cd3){_0x550ee5[_0x1ca1('0x18')](0x194);}return _0x183cd3;};}function handleError(_0x45cbb6,_0x28025f){_0x28025f=_0x28025f||0x1f4;return function(_0x34ab95){logger[_0x1ca1('0x26')](_0x34ab95[_0x1ca1('0x27')]);if(_0x34ab95[_0x1ca1('0x28')]){delete _0x34ab95['name'];}_0x45cbb6['status'](_0x28025f)['send'](_0x34ab95);};}exports[_0x1ca1('0x29')]=function(_0x5b18ff,_0x1d0c2f){var _0x4616c6={},_0x548529={},_0x18afa7={'count':0x0,'rows':[]};var _0x1ec4f2=_['map'](db[_0x1ca1('0x2a')][_0x1ca1('0x2b')],function(_0x11b2b4){return{'name':_0x11b2b4[_0x1ca1('0x2c')],'type':_0x11b2b4['type'][_0x1ca1('0x2d')]};});_0x548529[_0x1ca1('0x2e')]=_['map'](_0x1ec4f2,_0x1ca1('0x28'));_0x548529[_0x1ca1('0x2f')]=_[_0x1ca1('0x30')](_0x5b18ff['query']);_0x548529[_0x1ca1('0x31')]=_['intersection'](_0x548529[_0x1ca1('0x2e')],_0x548529[_0x1ca1('0x2f')]);_0x4616c6['attributes']=_[_0x1ca1('0x32')](_0x548529[_0x1ca1('0x2e')],qs[_0x1ca1('0x33')](_0x5b18ff[_0x1ca1('0x2f')][_0x1ca1('0x33')]));_0x4616c6[_0x1ca1('0x34')]=_0x4616c6['attributes']['length']?_0x4616c6[_0x1ca1('0x34')]:_0x548529[_0x1ca1('0x2e')];if(!_0x5b18ff[_0x1ca1('0x2f')]['hasOwnProperty'](_0x1ca1('0x35'))){_0x4616c6[_0x1ca1('0x36')]=qs[_0x1ca1('0x36')](_0x5b18ff[_0x1ca1('0x2f')][_0x1ca1('0x36')]);_0x4616c6[_0x1ca1('0x1b')]=qs[_0x1ca1('0x1b')](_0x5b18ff[_0x1ca1('0x2f')][_0x1ca1('0x1b')]);}_0x4616c6[_0x1ca1('0x37')]=qs[_0x1ca1('0x38')](_0x5b18ff[_0x1ca1('0x2f')]['sort']);_0x4616c6[_0x1ca1('0x39')]=qs['filters'](_[_0x1ca1('0x3a')](_0x5b18ff[_0x1ca1('0x2f')],_0x548529[_0x1ca1('0x31')]),_0x1ec4f2);if(_0x5b18ff[_0x1ca1('0x2f')]['filter']){_0x4616c6[_0x1ca1('0x39')]=_[_0x1ca1('0x3b')](_0x4616c6['where'],{'$or':_[_0x1ca1('0x3c')](_0x1ec4f2,function(_0x26efbb){if(_0x26efbb['type']!==_0x1ca1('0x3d')){var _0x199b40={};_0x199b40[_0x26efbb[_0x1ca1('0x28')]]={'$like':'%'+_0x5b18ff[_0x1ca1('0x2f')]['filter']+'%'};return _0x199b40;}})});}_0x4616c6=_[_0x1ca1('0x3b')]({},_0x4616c6,_0x5b18ff['options']);var _0x80ff48={'where':_0x4616c6['where']};return db['SquareReport'][_0x1ca1('0x1d')](_0x80ff48)[_0x1ca1('0x24')](function(_0x3a89be){_0x18afa7[_0x1ca1('0x1d')]=_0x3a89be;if(_0x5b18ff[_0x1ca1('0x2f')][_0x1ca1('0x3e')]){_0x4616c6[_0x1ca1('0x3f')]=[{'all':!![]}];}return db[_0x1ca1('0x2a')][_0x1ca1('0x40')](_0x4616c6);})[_0x1ca1('0x24')](function(_0x14c4e0){_0x18afa7['rows']=_0x14c4e0;return _0x18afa7;})['then'](respondWithFilteredResult(_0x1d0c2f,_0x4616c6))[_0x1ca1('0x41')](handleError(_0x1d0c2f,null));};exports['show']=function(_0x4a33b3,_0x5c87b9){var _0x1c4014={'raw':!![],'where':{'id':_0x4a33b3['params']['id']}},_0xff0d78={};_0xff0d78[_0x1ca1('0x2e')]=_[_0x1ca1('0x30')](db[_0x1ca1('0x2a')][_0x1ca1('0x2b')]);_0xff0d78[_0x1ca1('0x2f')]=_[_0x1ca1('0x30')](_0x4a33b3[_0x1ca1('0x2f')]);_0xff0d78[_0x1ca1('0x31')]=_[_0x1ca1('0x32')](_0xff0d78['model'],_0xff0d78[_0x1ca1('0x2f')]);_0x1c4014[_0x1ca1('0x34')]=_[_0x1ca1('0x32')](_0xff0d78['model'],qs[_0x1ca1('0x33')](_0x4a33b3[_0x1ca1('0x2f')][_0x1ca1('0x33')]));_0x1c4014[_0x1ca1('0x34')]=_0x1c4014[_0x1ca1('0x34')][_0x1ca1('0x42')]?_0x1c4014[_0x1ca1('0x34')]:_0xff0d78['model'];if(_0x4a33b3[_0x1ca1('0x2f')][_0x1ca1('0x3e')]){_0x1c4014['include']=[{'all':!![]}];}_0x1c4014=_[_0x1ca1('0x3b')]({},_0x1c4014,_0x4a33b3[_0x1ca1('0x43')]);return db['SquareReport'][_0x1ca1('0x44')](_0x1c4014)[_0x1ca1('0x24')](handleEntityNotFound(_0x5c87b9,null))['then'](respondWithResult(_0x5c87b9,null))[_0x1ca1('0x41')](handleError(_0x5c87b9,null));};exports[_0x1ca1('0x45')]=function(_0x534cdb,_0x369b3f){return db[_0x1ca1('0x2a')][_0x1ca1('0x45')](_0x534cdb[_0x1ca1('0x46')],{})[_0x1ca1('0x24')](respondWithResult(_0x369b3f,0xc9))[_0x1ca1('0x41')](handleError(_0x369b3f,null));};exports[_0x1ca1('0x23')]=function(_0x554686,_0x4d64b1){if(_0x554686[_0x1ca1('0x46')]['id']){delete _0x554686['body']['id'];}return db[_0x1ca1('0x2a')]['find']({'where':{'id':_0x554686[_0x1ca1('0x47')]['id']}})[_0x1ca1('0x24')](handleEntityNotFound(_0x4d64b1,null))[_0x1ca1('0x24')](saveUpdates(_0x554686[_0x1ca1('0x46')],null))['then'](respondWithResult(_0x4d64b1,null))['catch'](handleError(_0x4d64b1,null));};exports['destroy']=function(_0x5ae4e6,_0xeef211){return db['SquareReport'][_0x1ca1('0x44')]({'where':{'id':_0x5ae4e6[_0x1ca1('0x47')]['id']}})[_0x1ca1('0x24')](handleEntityNotFound(_0xeef211,null))[_0x1ca1('0x24')](removeEntity(_0xeef211,null))[_0x1ca1('0x41')](handleError(_0xeef211,null));};exports[_0x1ca1('0x48')]=function(_0x56342f,_0xe296a7){return db[_0x1ca1('0x2a')]['describe']()[_0x1ca1('0x24')](respondWithResult(_0xe296a7,null))[_0x1ca1('0x41')](handleError(_0xe296a7,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index c7c0276..024e645 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 _0x9e02=['../../config/environment','./squareReport.attributes','exports','define','SquareReport','uid_pname','uniqueid','leaveAt','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x5ae21b,_0x528909){var _0x47c869=function(_0x588eb5){while(--_0x588eb5){_0x5ae21b['push'](_0x5ae21b['shift']());}};_0x47c869(++_0x528909);}(_0x9e02,0x152));var _0x29e0=function(_0x4696dc,_0x2b5288){_0x4696dc=_0x4696dc-0x0;var _0x36794d=_0x9e02[_0x4696dc];return _0x36794d;};'use strict';var _=require(_0x29e0('0x0'));var util=require('util');var logger=require(_0x29e0('0x1'))('api');var moment=require(_0x29e0('0x2'));var BPromise=require(_0x29e0('0x3'));var rp=require(_0x29e0('0x4'));var fs=require('fs');var path=require(_0x29e0('0x5'));var rimraf=require(_0x29e0('0x6'));var config=require(_0x29e0('0x7'));var attributes=require(_0x29e0('0x8'));module[_0x29e0('0x9')]=function(_0x1c5bdc,_0x3c3ec1){return _0x1c5bdc[_0x29e0('0xa')](_0x29e0('0xb'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x29e0('0xc'),'fields':[_0x29e0('0xd'),'project_name']},{'name':_0x29e0('0xe'),'fields':[_0x29e0('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa246=['bluebird','path','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uniqueid','project_name','leaveAt','util','moment'];(function(_0x2a4f1c,_0x27433c){var _0x4fefcb=function(_0x2da4cf){while(--_0x2da4cf){_0x2a4f1c['push'](_0x2a4f1c['shift']());}};_0x4fefcb(++_0x27433c);}(_0xa246,0xf5));var _0x6a24=function(_0x383710,_0x1a6a16){_0x383710=_0x383710-0x0;var _0x5a4d8e=_0xa246[_0x383710];return _0x5a4d8e;};'use strict';var _=require('lodash');var util=require(_0x6a24('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x6a24('0x1'));var BPromise=require(_0x6a24('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6a24('0x3'));var rimraf=require('rimraf');var config=require(_0x6a24('0x4'));var attributes=require(_0x6a24('0x5'));module[_0x6a24('0x6')]=function(_0x386525,_0xcae121){return _0x386525[_0x6a24('0x7')](_0x6a24('0x8'),attributes,{'tableName':_0x6a24('0x9'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x6a24('0xa'),_0x6a24('0xb')]},{'name':_0x6a24('0xc'),'fields':[_0x6a24('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 8d76d3a..ac48aac 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 _0xca0c=['SquareReport','create','body','options','raw','update','where','limit','catch','UpdateSquareReport','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareReport,\x20%s,\x20%s','message','result','CreateSquareReport'];(function(_0x531980,_0x5c9867){var _0x35963e=function(_0x43a21a){while(--_0x43a21a){_0x531980['push'](_0x531980['shift']());}};_0x35963e(++_0x5c9867);}(_0xca0c,0x73));var _0xcca0=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xca0c[_0x45d3f0];return _0x314b79;};'use strict';var _=require(_0xcca0('0x0'));var util=require('util');var moment=require(_0xcca0('0x1'));var BPromise=require('bluebird');var rs=require(_0xcca0('0x2'));var fs=require('fs');var Redis=require(_0xcca0('0x3'));var db=require(_0xcca0('0x4'))['db'];var utils=require(_0xcca0('0x5'));var logger=require(_0xcca0('0x6'))(_0xcca0('0x7'));var config=require(_0xcca0('0x8'));var jayson=require(_0xcca0('0x9'));var client=jayson[_0xcca0('0xa')][_0xcca0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x492e91,_0x2c1159,_0x11c1bf){return new BPromise(function(_0x17770b,_0x23905a){return client[_0xcca0('0xc')](_0x492e91,_0x11c1bf)[_0xcca0('0xd')](function(_0x471e6a){logger[_0xcca0('0xe')]('SquareReport,\x20%s,\x20%s',_0x2c1159,_0xcca0('0xf'));logger[_0xcca0('0x10')](_0xcca0('0x11'),_0x2c1159,_0xcca0('0xf'),JSON[_0xcca0('0x12')](_0x471e6a));if(_0x471e6a[_0xcca0('0x13')]){if(_0x471e6a['error'][_0xcca0('0x14')]===0x1f4){logger[_0xcca0('0x13')](_0xcca0('0x15'),_0x2c1159,_0x471e6a[_0xcca0('0x13')][_0xcca0('0x16')]);return _0x23905a(_0x471e6a['error'][_0xcca0('0x16')]);}logger[_0xcca0('0x13')]('SquareReport,\x20%s,\x20%s',_0x2c1159,_0x471e6a[_0xcca0('0x13')][_0xcca0('0x16')]);return _0x17770b(_0x471e6a[_0xcca0('0x13')][_0xcca0('0x16')]);}else{logger[_0xcca0('0xe')](_0xcca0('0x15'),_0x2c1159,_0xcca0('0xf'));_0x17770b(_0x471e6a[_0xcca0('0x17')][_0xcca0('0x16')]);}})['catch'](function(_0xc0f31e){logger[_0xcca0('0x13')]('SquareReport,\x20%s,\x20%s',_0x2c1159,_0xc0f31e);_0x23905a(_0xc0f31e);});});}exports[_0xcca0('0x18')]=function(_0x3e1e10){var _0x3ba680=this;return new Promise(function(_0x225604,_0x367219){return db[_0xcca0('0x19')][_0xcca0('0x1a')](_0x3e1e10[_0xcca0('0x1b')],{'raw':_0x3e1e10[_0xcca0('0x1c')]?_0x3e1e10[_0xcca0('0x1c')][_0xcca0('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x4e1fcf){logger[_0xcca0('0xe')](_0xcca0('0x18'),_0x3e1e10);logger[_0xcca0('0x10')](_0xcca0('0x18'),_0x3e1e10,JSON[_0xcca0('0x12')](_0x4e1fcf));_0x225604(_0x4e1fcf);})['catch'](function(_0x18427b){logger[_0xcca0('0x13')]('CreateSquareReport',_0x18427b[_0xcca0('0x16')],_0x3e1e10);_0x367219(_0x3ba680[_0xcca0('0x13')](0x1f4,_0x18427b['message']));});});};exports['UpdateSquareReport']=function(_0x576636){var _0x2d6262=this;return new Promise(function(_0x5d3b5f,_0x12f58f){return db[_0xcca0('0x19')][_0xcca0('0x1e')](_0x576636[_0xcca0('0x1b')],{'raw':_0x576636[_0xcca0('0x1c')]?_0x576636[_0xcca0('0x1c')][_0xcca0('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x576636[_0xcca0('0x1c')]?_0x576636['options'][_0xcca0('0x1f')]||null:null,'attributes':_0x576636[_0xcca0('0x1c')]?_0x576636[_0xcca0('0x1c')]['attributes']||null:null,'limit':_0x576636[_0xcca0('0x1c')]?_0x576636['options'][_0xcca0('0x20')]||null:null})[_0xcca0('0xd')](function(_0x143827){logger[_0xcca0('0xe')]('UpdateSquareReport',_0x576636);logger[_0xcca0('0x10')]('UpdateSquareReport',_0x576636,JSON[_0xcca0('0x12')](_0x143827));_0x5d3b5f(_0x143827);})[_0xcca0('0x21')](function(_0x40f9c2){logger[_0xcca0('0x13')](_0xcca0('0x22'),_0x40f9c2[_0xcca0('0x16')],_0x576636);_0x12f58f(_0x2d6262[_0xcca0('0x13')](0x1f4,_0x40f9c2[_0xcca0('0x16')]));});});}; \ No newline at end of file +var _0x68aa=['error','message','result','catch','CreateSquareReport','SquareReport','create','options','raw','stringify','UpdateSquareReport','where','attributes','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s'];(function(_0x5321e5,_0x15a692){var _0x33c448=function(_0x122fa3){while(--_0x122fa3){_0x5321e5['push'](_0x5321e5['shift']());}};_0x33c448(++_0x15a692);}(_0x68aa,0x81));var _0xa68a=function(_0x5ea282,_0x13ff28){_0x5ea282=_0x5ea282-0x0;var _0x63f94=_0x68aa[_0x5ea282];return _0x63f94;};'use strict';var _=require('lodash');var util=require(_0xa68a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa68a('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa68a('0x2'));var logger=require(_0xa68a('0x3'))(_0xa68a('0x4'));var config=require(_0xa68a('0x5'));var jayson=require(_0xa68a('0x6'));var client=jayson[_0xa68a('0x7')][_0xa68a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x581df3,_0x217c47,_0xe361a2){return new BPromise(function(_0x4764c2,_0x597c49){return client[_0xa68a('0x9')](_0x581df3,_0xe361a2)[_0xa68a('0xa')](function(_0x3969a0){logger[_0xa68a('0xb')](_0xa68a('0xc'),_0x217c47,_0xa68a('0xd'));logger[_0xa68a('0xe')](_0xa68a('0xf'),_0x217c47,_0xa68a('0xd'),JSON['stringify'](_0x3969a0));if(_0x3969a0[_0xa68a('0x10')]){if(_0x3969a0[_0xa68a('0x10')]['code']===0x1f4){logger[_0xa68a('0x10')](_0xa68a('0xc'),_0x217c47,_0x3969a0[_0xa68a('0x10')][_0xa68a('0x11')]);return _0x597c49(_0x3969a0['error']['message']);}logger[_0xa68a('0x10')](_0xa68a('0xc'),_0x217c47,_0x3969a0[_0xa68a('0x10')][_0xa68a('0x11')]);return _0x4764c2(_0x3969a0[_0xa68a('0x10')][_0xa68a('0x11')]);}else{logger[_0xa68a('0xb')](_0xa68a('0xc'),_0x217c47,_0xa68a('0xd'));_0x4764c2(_0x3969a0[_0xa68a('0x12')][_0xa68a('0x11')]);}})[_0xa68a('0x13')](function(_0x252f84){logger[_0xa68a('0x10')](_0xa68a('0xc'),_0x217c47,_0x252f84);_0x597c49(_0x252f84);});});}exports[_0xa68a('0x14')]=function(_0x3ebd5f){var _0x4a9693=this;return new Promise(function(_0x431ece,_0x10e0b4){return db[_0xa68a('0x15')][_0xa68a('0x16')](_0x3ebd5f['body'],{'raw':_0x3ebd5f[_0xa68a('0x17')]?_0x3ebd5f[_0xa68a('0x17')][_0xa68a('0x18')]===undefined?!![]:![]:!![]})[_0xa68a('0xa')](function(_0x5c7920){logger[_0xa68a('0xb')](_0xa68a('0x14'),_0x3ebd5f);logger[_0xa68a('0xe')](_0xa68a('0x14'),_0x3ebd5f,JSON[_0xa68a('0x19')](_0x5c7920));_0x431ece(_0x5c7920);})[_0xa68a('0x13')](function(_0x38adf4){logger[_0xa68a('0x10')]('CreateSquareReport',_0x38adf4[_0xa68a('0x11')],_0x3ebd5f);_0x10e0b4(_0x4a9693[_0xa68a('0x10')](0x1f4,_0x38adf4[_0xa68a('0x11')]));});});};exports[_0xa68a('0x1a')]=function(_0x17c5bd){var _0x295162=this;return new Promise(function(_0x389692,_0x568090){return db[_0xa68a('0x15')]['update'](_0x17c5bd['body'],{'raw':_0x17c5bd[_0xa68a('0x17')]?_0x17c5bd[_0xa68a('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17c5bd[_0xa68a('0x17')]?_0x17c5bd[_0xa68a('0x17')][_0xa68a('0x1b')]||null:null,'attributes':_0x17c5bd[_0xa68a('0x17')]?_0x17c5bd['options'][_0xa68a('0x1c')]||null:null,'limit':_0x17c5bd[_0xa68a('0x17')]?_0x17c5bd[_0xa68a('0x17')]['limit']||null:null})[_0xa68a('0xa')](function(_0x2c809f){logger[_0xa68a('0xb')](_0xa68a('0x1a'),_0x17c5bd);logger[_0xa68a('0xe')](_0xa68a('0x1a'),_0x17c5bd,JSON[_0xa68a('0x19')](_0x2c809f));_0x389692(_0x2c809f);})[_0xa68a('0x13')](function(_0x2d5b74){logger[_0xa68a('0x10')](_0xa68a('0x1a'),_0x2d5b74[_0xa68a('0x11')],_0x17c5bd);_0x568090(_0x295162[_0xa68a('0x10')](0x1f4,_0x2d5b74[_0xa68a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index ee16ccf..8a2d0ce 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 _0xf783=['show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./squareReportDetail.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x15b380,_0x1a3c5f){var _0x232c5c=function(_0x12f8e0){while(--_0x12f8e0){_0x15b380['push'](_0x15b380['shift']());}};_0x232c5c(++_0x1a3c5f);}(_0xf783,0x13c));var _0x3f78=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf783[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3f78('0x0'));var util=require(_0x3f78('0x1'));var path=require(_0x3f78('0x2'));var timeout=require(_0x3f78('0x3'));var express=require(_0x3f78('0x4'));var router=express[_0x3f78('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3f78('0x6'));var controller=require(_0x3f78('0x7'));router['get']('/',auth[_0x3f78('0x8')](),controller[_0x3f78('0x9')]);router[_0x3f78('0xa')](_0x3f78('0xb'),auth['isAuthenticated'](),controller[_0x3f78('0xc')]);router['get'](_0x3f78('0xd'),auth[_0x3f78('0x8')](),controller[_0x3f78('0xe')]);router[_0x3f78('0xf')]('/',auth['isAuthenticated'](),controller[_0x3f78('0x10')]);router[_0x3f78('0x11')](_0x3f78('0xd'),auth['isAuthenticated'](),controller[_0x3f78('0x12')]);router[_0x3f78('0x13')](_0x3f78('0xd'),auth[_0x3f78('0x8')](),controller[_0x3f78('0x14')]);module[_0x3f78('0x15')]=router; \ No newline at end of file +var _0x205f=['../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','index','/describe','isAuthenticated','show','post','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x16de85,_0x5b0595){var _0x28f2ea=function(_0x414b97){while(--_0x414b97){_0x16de85['push'](_0x16de85['shift']());}};_0x28f2ea(++_0x5b0595);}(_0x205f,0xea));var _0xf205=function(_0x1f7996,_0x299a14){_0x1f7996=_0x1f7996-0x0;var _0x584609=_0x205f[_0x1f7996];return _0x584609;};'use strict';var multer=require(_0xf205('0x0'));var util=require(_0xf205('0x1'));var path=require(_0xf205('0x2'));var timeout=require(_0xf205('0x3'));var express=require('express');var router=express[_0xf205('0x4')]();var fs_extra=require(_0xf205('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf205('0x6'));var config=require(_0xf205('0x7'));var controller=require(_0xf205('0x8'));router[_0xf205('0x9')]('/',auth['isAuthenticated'](),controller[_0xf205('0xa')]);router[_0xf205('0x9')](_0xf205('0xb'),auth[_0xf205('0xc')](),controller['describe']);router[_0xf205('0x9')]('/:id',auth[_0xf205('0xc')](),controller[_0xf205('0xd')]);router[_0xf205('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf205('0xf')](_0xf205('0x10'),auth[_0xf205('0xc')](),controller[_0xf205('0x11')]);router['delete'](_0xf205('0x10'),auth[_0xf205('0xc')](),controller[_0xf205('0x12')]);module[_0xf205('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 530ffe7..c171bf1 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 _0xfc72=['sequelize','exports','STRING','TEXT'];(function(_0x5561c5,_0x1ad666){var _0x5b2ee8=function(_0x44087c){while(--_0x44087c){_0x5561c5['push'](_0x5561c5['shift']());}};_0x5b2ee8(++_0x1ad666);}(_0xfc72,0x1b0));var _0x2fc7=function(_0x582e18,_0x4fd856){_0x582e18=_0x582e18-0x0;var _0x445d03=_0xfc72[_0x582e18];return _0x445d03;};'use strict';var Sequelize=require(_0x2fc7('0x0'));module[_0x2fc7('0x1')]={'uniqueid':{'type':Sequelize[_0x2fc7('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x2fc7('0x2')]},'data':{'type':Sequelize[_0x2fc7('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x2fc7('0x2')]}}; \ No newline at end of file +var _0x4806=['sequelize','STRING','TEXT'];(function(_0x46b41b,_0xc6dcee){var _0x581feb=function(_0xf1b1de){while(--_0xf1b1de){_0x46b41b['push'](_0x46b41b['shift']());}};_0x581feb(++_0xc6dcee);}(_0x4806,0x6f));var _0x6480=function(_0x2dc40c,_0x4c597d){_0x2dc40c=_0x2dc40c-0x0;var _0x134222=_0x4806[_0x2dc40c];return _0x134222;};'use strict';var Sequelize=require(_0x6480('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x6480('0x1')]},'node':{'type':Sequelize[_0x6480('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x6480('0x2')]},'project_name':{'type':Sequelize[_0x6480('0x1')]},'callerid':{'type':Sequelize[_0x6480('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index deafa39..4ea6b81 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 _0xdd94=['catch','show','params','include','find','create','body','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','SquareDetailsReport','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','findAll'];(function(_0x17f0fe,_0x2b60b4){var _0x5b04f6=function(_0x435962){while(--_0x435962){_0x17f0fe['push'](_0x17f0fe['shift']());}};_0x5b04f6(++_0x2b60b4);}(_0xdd94,0x170));var _0x4dd9=function(_0x4934b3,_0x1562ce){_0x4934b3=_0x4934b3-0x0;var _0x1794cb=_0xdd94[_0x4934b3];return _0x1794cb;};'use strict';var emlformat=require(_0x4dd9('0x0'));var rimraf=require(_0x4dd9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4dd9('0x2'));var BPromise=require(_0x4dd9('0x3'));var Mustache=require('mustache');var util=require(_0x4dd9('0x4'));var path=require(_0x4dd9('0x5'));var sox=require(_0x4dd9('0x6'));var csv=require(_0x4dd9('0x7'));var ejs=require(_0x4dd9('0x8'));var fs=require('fs');var fs_extra=require(_0x4dd9('0x9'));var _=require(_0x4dd9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4dd9('0xb'));var toCsv=require(_0x4dd9('0x7'));var querystring=require(_0x4dd9('0xc'));var Papa=require(_0x4dd9('0xd'));var Redis=require(_0x4dd9('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4dd9('0xf'));var as=require(_0x4dd9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4dd9('0x11'))(_0x4dd9('0x12'));var utils=require(_0x4dd9('0x13'));var config=require(_0x4dd9('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x4dd9('0x15'))['db'];function respondWithStatusCode(_0x50d1d5,_0x276d7d){_0x276d7d=_0x276d7d||0xcc;return function(_0x48379e){if(_0x48379e){return _0x50d1d5['sendStatus'](_0x276d7d);}return _0x50d1d5[_0x4dd9('0x16')](_0x276d7d)[_0x4dd9('0x17')]();};}function respondWithResult(_0x3d39a6,_0x1f1551){_0x1f1551=_0x1f1551||0xc8;return function(_0x388445){if(_0x388445){return _0x3d39a6['status'](_0x1f1551)[_0x4dd9('0x18')](_0x388445);}};}function respondWithFilteredResult(_0x605662,_0x41f21){return function(_0x2c3e84){if(_0x2c3e84){var _0xbc4bf5=typeof _0x41f21[_0x4dd9('0x19')]==='undefined'&&typeof _0x41f21[_0x4dd9('0x1a')]==='undefined';var _0x3364c5=_0x2c3e84[_0x4dd9('0x1b')];var _0x3b6f22=_0xbc4bf5?0x0:_0x41f21[_0x4dd9('0x19')];var _0x586446=_0xbc4bf5?_0x2c3e84[_0x4dd9('0x1b')]:_0x41f21['offset']+_0x41f21[_0x4dd9('0x1a')];var _0x57f28c;if(_0x586446>=_0x3364c5){_0x586446=_0x3364c5;_0x57f28c=0xc8;}else{_0x57f28c=0xce;}_0x605662['status'](_0x57f28c);return _0x605662['set'](_0x4dd9('0x1c'),_0x3b6f22+'-'+_0x586446+'/'+_0x3364c5)[_0x4dd9('0x18')](_0x2c3e84);}return null;};}function patchUpdates(_0x153f54){return function(_0x17c920){try{jsonpatch[_0x4dd9('0x1d')](_0x17c920,_0x153f54,!![]);}catch(_0x5a86a7){return BPromise[_0x4dd9('0x1e')](_0x5a86a7);}return _0x17c920[_0x4dd9('0x1f')]();};}function saveUpdates(_0x38df9e,_0x1139ef){return function(_0x245320){if(_0x245320){return _0x245320[_0x4dd9('0x20')](_0x38df9e)[_0x4dd9('0x21')](function(_0x51041b){return _0x51041b;});}return null;};}function removeEntity(_0x25d46f,_0x188c29){return function(_0x1c1d8d){if(_0x1c1d8d){return _0x1c1d8d[_0x4dd9('0x22')]()['then'](function(){_0x25d46f[_0x4dd9('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x118a1d,_0x19dc24){return function(_0x32fd26){if(!_0x32fd26){_0x118a1d[_0x4dd9('0x23')](0x194);}return _0x32fd26;};}function handleError(_0x113c4a,_0x57fe4a){_0x57fe4a=_0x57fe4a||0x1f4;return function(_0x2ec34d){logger['error'](_0x2ec34d[_0x4dd9('0x24')]);if(_0x2ec34d['name']){delete _0x2ec34d[_0x4dd9('0x25')];}_0x113c4a[_0x4dd9('0x16')](_0x57fe4a)[_0x4dd9('0x26')](_0x2ec34d);};}exports[_0x4dd9('0x27')]=function(_0x5de59f,_0x58eb58){var _0x10964f={},_0x131132={},_0x4e28f9={'count':0x0,'rows':[]};var _0x282cd5=_['map'](db[_0x4dd9('0x28')][_0x4dd9('0x29')],function(_0x34dd3f){return{'name':_0x34dd3f[_0x4dd9('0x2a')],'type':_0x34dd3f[_0x4dd9('0x2b')][_0x4dd9('0x2c')]};});_0x131132['model']=_[_0x4dd9('0x2d')](_0x282cd5,_0x4dd9('0x25'));_0x131132['query']=_[_0x4dd9('0x2e')](_0x5de59f[_0x4dd9('0x2f')]);_0x131132[_0x4dd9('0x30')]=_[_0x4dd9('0x31')](_0x131132[_0x4dd9('0x32')],_0x131132[_0x4dd9('0x2f')]);_0x10964f[_0x4dd9('0x33')]=_[_0x4dd9('0x31')](_0x131132[_0x4dd9('0x32')],qs['fields'](_0x5de59f[_0x4dd9('0x2f')][_0x4dd9('0x34')]));_0x10964f['attributes']=_0x10964f['attributes'][_0x4dd9('0x35')]?_0x10964f[_0x4dd9('0x33')]:_0x131132[_0x4dd9('0x32')];if(!_0x5de59f[_0x4dd9('0x2f')][_0x4dd9('0x36')](_0x4dd9('0x37'))){_0x10964f[_0x4dd9('0x1a')]=qs['limit'](_0x5de59f[_0x4dd9('0x2f')]['limit']);_0x10964f[_0x4dd9('0x19')]=qs[_0x4dd9('0x19')](_0x5de59f['query'][_0x4dd9('0x19')]);}_0x10964f[_0x4dd9('0x38')]=qs[_0x4dd9('0x39')](_0x5de59f[_0x4dd9('0x2f')][_0x4dd9('0x39')]);_0x10964f[_0x4dd9('0x3a')]=qs[_0x4dd9('0x30')](_[_0x4dd9('0x3b')](_0x5de59f[_0x4dd9('0x2f')],_0x131132[_0x4dd9('0x30')]),_0x282cd5);if(_0x5de59f[_0x4dd9('0x2f')][_0x4dd9('0x3c')]){_0x10964f[_0x4dd9('0x3a')]=_['merge'](_0x10964f[_0x4dd9('0x3a')],{'$or':_[_0x4dd9('0x2d')](_0x282cd5,function(_0x3156ef){if(_0x3156ef[_0x4dd9('0x2b')]!=='VIRTUAL'){var _0x523f37={};_0x523f37[_0x3156ef[_0x4dd9('0x25')]]={'$like':'%'+_0x5de59f[_0x4dd9('0x2f')][_0x4dd9('0x3c')]+'%'};return _0x523f37;}})});}_0x10964f=_['merge']({},_0x10964f,_0x5de59f[_0x4dd9('0x3d')]);var _0x20ce22={'where':_0x10964f['where']};return db[_0x4dd9('0x28')][_0x4dd9('0x1b')](_0x20ce22)['then'](function(_0x5490af){_0x4e28f9[_0x4dd9('0x1b')]=_0x5490af;if(_0x5de59f[_0x4dd9('0x2f')][_0x4dd9('0x3e')]){_0x10964f['include']=[{'all':!![]}];}return db[_0x4dd9('0x28')][_0x4dd9('0x3f')](_0x10964f);})[_0x4dd9('0x21')](function(_0xfca073){_0x4e28f9['rows']=_0xfca073;return _0x4e28f9;})[_0x4dd9('0x21')](respondWithFilteredResult(_0x58eb58,_0x10964f))[_0x4dd9('0x40')](handleError(_0x58eb58,null));};exports[_0x4dd9('0x41')]=function(_0x53aca8,_0x586275){var _0x2bb8e0={'raw':!![],'where':{'id':_0x53aca8[_0x4dd9('0x42')]['id']}},_0x4278de={};_0x4278de['model']=_[_0x4dd9('0x2e')](db['SquareDetailsReport']['rawAttributes']);_0x4278de['query']=_['keys'](_0x53aca8[_0x4dd9('0x2f')]);_0x4278de[_0x4dd9('0x30')]=_[_0x4dd9('0x31')](_0x4278de['model'],_0x4278de['query']);_0x2bb8e0[_0x4dd9('0x33')]=_[_0x4dd9('0x31')](_0x4278de['model'],qs[_0x4dd9('0x34')](_0x53aca8[_0x4dd9('0x2f')][_0x4dd9('0x34')]));_0x2bb8e0['attributes']=_0x2bb8e0[_0x4dd9('0x33')]['length']?_0x2bb8e0[_0x4dd9('0x33')]:_0x4278de[_0x4dd9('0x32')];if(_0x53aca8[_0x4dd9('0x2f')][_0x4dd9('0x3e')]){_0x2bb8e0[_0x4dd9('0x43')]=[{'all':!![]}];}_0x2bb8e0=_['merge']({},_0x2bb8e0,_0x53aca8['options']);return db[_0x4dd9('0x28')][_0x4dd9('0x44')](_0x2bb8e0)[_0x4dd9('0x21')](handleEntityNotFound(_0x586275,null))[_0x4dd9('0x21')](respondWithResult(_0x586275,null))[_0x4dd9('0x40')](handleError(_0x586275,null));};exports['create']=function(_0x1ad58a,_0x5cbac8){return db[_0x4dd9('0x28')][_0x4dd9('0x45')](_0x1ad58a[_0x4dd9('0x46')],{})['then'](respondWithResult(_0x5cbac8,0xc9))[_0x4dd9('0x40')](handleError(_0x5cbac8,null));};exports['update']=function(_0x140605,_0x3d4431){if(_0x140605[_0x4dd9('0x46')]['id']){delete _0x140605[_0x4dd9('0x46')]['id'];}return db[_0x4dd9('0x28')][_0x4dd9('0x44')]({'where':{'id':_0x140605[_0x4dd9('0x42')]['id']}})['then'](handleEntityNotFound(_0x3d4431,null))[_0x4dd9('0x21')](saveUpdates(_0x140605[_0x4dd9('0x46')],null))[_0x4dd9('0x21')](respondWithResult(_0x3d4431,null))[_0x4dd9('0x40')](handleError(_0x3d4431,null));};exports['destroy']=function(_0x3ebff2,_0x26fc35){return db[_0x4dd9('0x28')][_0x4dd9('0x44')]({'where':{'id':_0x3ebff2[_0x4dd9('0x42')]['id']}})['then'](handleEntityNotFound(_0x26fc35,null))[_0x4dd9('0x21')](removeEntity(_0x26fc35,null))[_0x4dd9('0x40')](handleError(_0x26fc35,null));};exports[_0x4dd9('0x47')]=function(_0x5d1a98,_0x1372cd){return db[_0x4dd9('0x28')][_0x4dd9('0x47')]()['then'](respondWithResult(_0x1372cd,null))[_0x4dd9('0x40')](handleError(_0x1372cd,null));}; \ No newline at end of file +var _0x8315=['json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','fields','find','catch','create','body','update','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end'];(function(_0x5d3463,_0x690813){var _0x4a1c37=function(_0x1ed123){while(--_0x1ed123){_0x5d3463['push'](_0x5d3463['shift']());}};_0x4a1c37(++_0x690813);}(_0x8315,0xcf));var _0x5831=function(_0x59ccac,_0x430459){_0x59ccac=_0x59ccac-0x0;var _0x9d2d3e=_0x8315[_0x59ccac];return _0x9d2d3e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5831('0x0'));var zipdir=require(_0x5831('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5831('0x2'));var moment=require(_0x5831('0x3'));var BPromise=require(_0x5831('0x4'));var Mustache=require(_0x5831('0x5'));var util=require(_0x5831('0x6'));var path=require(_0x5831('0x7'));var sox=require(_0x5831('0x8'));var csv=require(_0x5831('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5831('0xa'));var _=require(_0x5831('0xb'));var squel=require(_0x5831('0xc'));var crypto=require(_0x5831('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5831('0x9'));var querystring=require(_0x5831('0xe'));var Papa=require(_0x5831('0xf'));var Redis=require(_0x5831('0x10'));var authService=require(_0x5831('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5831('0x12'));var hardwareService=require(_0x5831('0x13'));var logger=require(_0x5831('0x14'))(_0x5831('0x15'));var utils=require(_0x5831('0x16'));var config=require(_0x5831('0x17'));var licenseUtil=require(_0x5831('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c04d8,_0x106dd8){_0x106dd8=_0x106dd8||0xcc;return function(_0x4f276c){if(_0x4f276c){return _0x5c04d8[_0x5831('0x19')](_0x106dd8);}return _0x5c04d8['status'](_0x106dd8)[_0x5831('0x1a')]();};}function respondWithResult(_0x51eaed,_0x14c918){_0x14c918=_0x14c918||0xc8;return function(_0x3ced96){if(_0x3ced96){return _0x51eaed['status'](_0x14c918)[_0x5831('0x1b')](_0x3ced96);}};}function respondWithFilteredResult(_0x5e10d6,_0x2fc410){return function(_0x52c045){if(_0x52c045){var _0x2e3c13=typeof _0x2fc410[_0x5831('0x1c')]===_0x5831('0x1d')&&typeof _0x2fc410['limit']==='undefined';var _0xc9a573=_0x52c045[_0x5831('0x1e')];var _0x5672b0=_0x2e3c13?0x0:_0x2fc410[_0x5831('0x1c')];var _0x136fee=_0x2e3c13?_0x52c045[_0x5831('0x1e')]:_0x2fc410[_0x5831('0x1c')]+_0x2fc410[_0x5831('0x1f')];var _0x169314;if(_0x136fee>=_0xc9a573){_0x136fee=_0xc9a573;_0x169314=0xc8;}else{_0x169314=0xce;}_0x5e10d6[_0x5831('0x20')](_0x169314);return _0x5e10d6[_0x5831('0x21')](_0x5831('0x22'),_0x5672b0+'-'+_0x136fee+'/'+_0xc9a573)[_0x5831('0x1b')](_0x52c045);}return null;};}function patchUpdates(_0x473751){return function(_0x86e154){try{jsonpatch[_0x5831('0x23')](_0x86e154,_0x473751,!![]);}catch(_0x2201df){return BPromise[_0x5831('0x24')](_0x2201df);}return _0x86e154[_0x5831('0x25')]();};}function saveUpdates(_0x1893b4,_0x42d333){return function(_0x159fc8){if(_0x159fc8){return _0x159fc8['update'](_0x1893b4)['then'](function(_0x5a91fe){return _0x5a91fe;});}return null;};}function removeEntity(_0x384926,_0x365f28){return function(_0x5650b4){if(_0x5650b4){return _0x5650b4[_0x5831('0x26')]()[_0x5831('0x27')](function(){_0x384926[_0x5831('0x20')](0xcc)[_0x5831('0x1a')]();});}};}function handleEntityNotFound(_0x8fe0ff,_0x165065){return function(_0x45e3ff){if(!_0x45e3ff){_0x8fe0ff[_0x5831('0x19')](0x194);}return _0x45e3ff;};}function handleError(_0x221853,_0xddeab3){_0xddeab3=_0xddeab3||0x1f4;return function(_0x56df6c){logger[_0x5831('0x28')](_0x56df6c[_0x5831('0x29')]);if(_0x56df6c[_0x5831('0x2a')]){delete _0x56df6c[_0x5831('0x2a')];}_0x221853['status'](_0xddeab3)[_0x5831('0x2b')](_0x56df6c);};}exports[_0x5831('0x2c')]=function(_0x516cf1,_0xe499d){var _0x463f13={},_0x14af0c={},_0x8a0acb={'count':0x0,'rows':[]};var _0x3bfcd0=_[_0x5831('0x2d')](db[_0x5831('0x2e')][_0x5831('0x2f')],function(_0x410da5){return{'name':_0x410da5[_0x5831('0x30')],'type':_0x410da5[_0x5831('0x31')][_0x5831('0x32')]};});_0x14af0c[_0x5831('0x33')]=_[_0x5831('0x2d')](_0x3bfcd0,_0x5831('0x2a'));_0x14af0c[_0x5831('0x34')]=_[_0x5831('0x35')](_0x516cf1[_0x5831('0x34')]);_0x14af0c[_0x5831('0x36')]=_[_0x5831('0x37')](_0x14af0c['model'],_0x14af0c[_0x5831('0x34')]);_0x463f13[_0x5831('0x38')]=_[_0x5831('0x37')](_0x14af0c[_0x5831('0x33')],qs['fields'](_0x516cf1['query']['fields']));_0x463f13[_0x5831('0x38')]=_0x463f13[_0x5831('0x38')][_0x5831('0x39')]?_0x463f13[_0x5831('0x38')]:_0x14af0c[_0x5831('0x33')];if(!_0x516cf1[_0x5831('0x34')]['hasOwnProperty'](_0x5831('0x3a'))){_0x463f13[_0x5831('0x1f')]=qs[_0x5831('0x1f')](_0x516cf1[_0x5831('0x34')][_0x5831('0x1f')]);_0x463f13['offset']=qs[_0x5831('0x1c')](_0x516cf1['query'][_0x5831('0x1c')]);}_0x463f13['order']=qs[_0x5831('0x3b')](_0x516cf1[_0x5831('0x34')][_0x5831('0x3b')]);_0x463f13[_0x5831('0x3c')]=qs['filters'](_[_0x5831('0x3d')](_0x516cf1[_0x5831('0x34')],_0x14af0c[_0x5831('0x36')]),_0x3bfcd0);if(_0x516cf1[_0x5831('0x34')]['filter']){_0x463f13[_0x5831('0x3c')]=_[_0x5831('0x3e')](_0x463f13[_0x5831('0x3c')],{'$or':_[_0x5831('0x2d')](_0x3bfcd0,function(_0xe22ce4){if(_0xe22ce4[_0x5831('0x31')]!==_0x5831('0x3f')){var _0x118a21={};_0x118a21[_0xe22ce4[_0x5831('0x2a')]]={'$like':'%'+_0x516cf1['query'][_0x5831('0x40')]+'%'};return _0x118a21;}})});}_0x463f13=_[_0x5831('0x3e')]({},_0x463f13,_0x516cf1[_0x5831('0x41')]);var _0x28c99a={'where':_0x463f13[_0x5831('0x3c')]};return db[_0x5831('0x2e')][_0x5831('0x1e')](_0x28c99a)[_0x5831('0x27')](function(_0xc691ae){_0x8a0acb[_0x5831('0x1e')]=_0xc691ae;if(_0x516cf1[_0x5831('0x34')][_0x5831('0x42')]){_0x463f13[_0x5831('0x43')]=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x463f13);})[_0x5831('0x27')](function(_0x330808){_0x8a0acb[_0x5831('0x44')]=_0x330808;return _0x8a0acb;})['then'](respondWithFilteredResult(_0xe499d,_0x463f13))['catch'](handleError(_0xe499d,null));};exports[_0x5831('0x45')]=function(_0x552b00,_0x46afee){var _0x483ef1={'raw':!![],'where':{'id':_0x552b00[_0x5831('0x46')]['id']}},_0x932cac={};_0x932cac[_0x5831('0x33')]=_[_0x5831('0x35')](db[_0x5831('0x2e')][_0x5831('0x2f')]);_0x932cac[_0x5831('0x34')]=_['keys'](_0x552b00[_0x5831('0x34')]);_0x932cac[_0x5831('0x36')]=_[_0x5831('0x37')](_0x932cac[_0x5831('0x33')],_0x932cac[_0x5831('0x34')]);_0x483ef1['attributes']=_['intersection'](_0x932cac[_0x5831('0x33')],qs[_0x5831('0x47')](_0x552b00[_0x5831('0x34')][_0x5831('0x47')]));_0x483ef1[_0x5831('0x38')]=_0x483ef1[_0x5831('0x38')][_0x5831('0x39')]?_0x483ef1[_0x5831('0x38')]:_0x932cac[_0x5831('0x33')];if(_0x552b00[_0x5831('0x34')]['includeAll']){_0x483ef1[_0x5831('0x43')]=[{'all':!![]}];}_0x483ef1=_['merge']({},_0x483ef1,_0x552b00[_0x5831('0x41')]);return db[_0x5831('0x2e')][_0x5831('0x48')](_0x483ef1)[_0x5831('0x27')](handleEntityNotFound(_0x46afee,null))[_0x5831('0x27')](respondWithResult(_0x46afee,null))[_0x5831('0x49')](handleError(_0x46afee,null));};exports[_0x5831('0x4a')]=function(_0x33d3dc,_0x638f3e){return db['SquareDetailsReport'][_0x5831('0x4a')](_0x33d3dc[_0x5831('0x4b')],{})[_0x5831('0x27')](respondWithResult(_0x638f3e,0xc9))[_0x5831('0x49')](handleError(_0x638f3e,null));};exports[_0x5831('0x4c')]=function(_0x2bc751,_0x437218){if(_0x2bc751[_0x5831('0x4b')]['id']){delete _0x2bc751[_0x5831('0x4b')]['id'];}return db[_0x5831('0x2e')][_0x5831('0x48')]({'where':{'id':_0x2bc751[_0x5831('0x46')]['id']}})['then'](handleEntityNotFound(_0x437218,null))[_0x5831('0x27')](saveUpdates(_0x2bc751[_0x5831('0x4b')],null))[_0x5831('0x27')](respondWithResult(_0x437218,null))[_0x5831('0x49')](handleError(_0x437218,null));};exports['destroy']=function(_0xbfe180,_0x226d20){return db[_0x5831('0x2e')][_0x5831('0x48')]({'where':{'id':_0xbfe180[_0x5831('0x46')]['id']}})['then'](handleEntityNotFound(_0x226d20,null))[_0x5831('0x27')](removeEntity(_0x226d20,null))['catch'](handleError(_0x226d20,null));};exports[_0x5831('0x4d')]=function(_0x13ea6a,_0x755fb){return db[_0x5831('0x2e')][_0x5831('0x4d')]()['then'](respondWithResult(_0x755fb,null))['catch'](handleError(_0x755fb,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 011b6fd..cbfb013 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 _0x7e02=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details'];(function(_0x1d0860,_0x262e3f){var _0x128dc0=function(_0x5f3664){while(--_0x5f3664){_0x1d0860['push'](_0x1d0860['shift']());}};_0x128dc0(++_0x262e3f);}(_0x7e02,0xe0));var _0x27e0=function(_0x46a634,_0x439b70){_0x46a634=_0x46a634-0x0;var _0x42007a=_0x7e02[_0x46a634];return _0x42007a;};'use strict';var _=require(_0x27e0('0x0'));var util=require(_0x27e0('0x1'));var logger=require(_0x27e0('0x2'))(_0x27e0('0x3'));var moment=require(_0x27e0('0x4'));var BPromise=require(_0x27e0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x27e0('0x6'));var rimraf=require(_0x27e0('0x7'));var config=require(_0x27e0('0x8'));var attributes=require(_0x27e0('0x9'));module[_0x27e0('0xa')]=function(_0xa3ddb,_0x38f861){return _0xa3ddb[_0x27e0('0xb')](_0x27e0('0xc'),attributes,{'tableName':_0x27e0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9f9=['../../config/logger','api','moment','rimraf','./squareReportDetail.attributes','exports','define','SquareDetailsReport','lodash','util'];(function(_0x422b16,_0x3371f3){var _0x55acde=function(_0x3a60d5){while(--_0x3a60d5){_0x422b16['push'](_0x422b16['shift']());}};_0x55acde(++_0x3371f3);}(_0xb9f9,0xee));var _0x9b9f=function(_0x304708,_0x243f40){_0x304708=_0x304708-0x0;var _0x5ea96e=_0xb9f9[_0x304708];return _0x5ea96e;};'use strict';var _=require(_0x9b9f('0x0'));var util=require(_0x9b9f('0x1'));var logger=require(_0x9b9f('0x2'))(_0x9b9f('0x3'));var moment=require(_0x9b9f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9b9f('0x5'));var config=require('../../config/environment');var attributes=require(_0x9b9f('0x6'));module[_0x9b9f('0x7')]=function(_0xef36a2,_0x228b76){return _0xef36a2[_0x9b9f('0x8')](_0x9b9f('0x9'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index f97e8a2..b22893a 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 _0xaebd=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','SquareDetailsReport,\x20%s,\x20%s','catch','CreateSquareDetailsReport','create','options','raw','debug','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x509a17,_0x497b29){var _0x2e4919=function(_0x52e5d2){while(--_0x52e5d2){_0x509a17['push'](_0x509a17['shift']());}};_0x2e4919(++_0x497b29);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x3df61a,_0x2de02e){_0x3df61a=_0x3df61a-0x0;var _0x51e925=_0xaebd[_0x3df61a];return _0x51e925;};'use strict';var _=require(_0xdaeb('0x0'));var util=require('util');var moment=require(_0xdaeb('0x1'));var BPromise=require(_0xdaeb('0x2'));var rs=require(_0xdaeb('0x3'));var fs=require('fs');var Redis=require(_0xdaeb('0x4'));var db=require(_0xdaeb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdaeb('0x6'))(_0xdaeb('0x7'));var config=require(_0xdaeb('0x8'));var jayson=require(_0xdaeb('0x9'));var client=jayson[_0xdaeb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ea090,_0x3f7ba1,_0x52c717){return new BPromise(function(_0x550bd9,_0x1b9d37){return client[_0xdaeb('0xb')](_0x3ea090,_0x52c717)[_0xdaeb('0xc')](function(_0x5e0ae9){logger[_0xdaeb('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0x3f7ba1,_0xdaeb('0xe'));logger['debug'](_0xdaeb('0xf'),_0x3f7ba1,'request\x20sent',JSON[_0xdaeb('0x10')](_0x5e0ae9));if(_0x5e0ae9[_0xdaeb('0x11')]){if(_0x5e0ae9['error']['code']===0x1f4){logger[_0xdaeb('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x3f7ba1,_0x5e0ae9[_0xdaeb('0x11')][_0xdaeb('0x12')]);return _0x1b9d37(_0x5e0ae9[_0xdaeb('0x11')][_0xdaeb('0x12')]);}logger[_0xdaeb('0x11')](_0xdaeb('0x13'),_0x3f7ba1,_0x5e0ae9[_0xdaeb('0x11')]['message']);return _0x550bd9(_0x5e0ae9['error'][_0xdaeb('0x12')]);}else{logger[_0xdaeb('0xd')](_0xdaeb('0x13'),_0x3f7ba1,_0xdaeb('0xe'));_0x550bd9(_0x5e0ae9['result']['message']);}})[_0xdaeb('0x14')](function(_0x4dd803){logger['error'](_0xdaeb('0x13'),_0x3f7ba1,_0x4dd803);_0x1b9d37(_0x4dd803);});});}exports[_0xdaeb('0x15')]=function(_0x1b5243){var _0x1fe84e=this;return new Promise(function(_0x2d8f11,_0x36f9ac){return db['SquareDetailsReport'][_0xdaeb('0x16')](_0x1b5243['body'],{'raw':_0x1b5243[_0xdaeb('0x17')]?_0x1b5243[_0xdaeb('0x17')][_0xdaeb('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x4e97e0){logger[_0xdaeb('0xd')](_0xdaeb('0x15'),_0x1b5243);logger[_0xdaeb('0x19')](_0xdaeb('0x15'),_0x1b5243,JSON[_0xdaeb('0x10')](_0x4e97e0));_0x2d8f11(_0x4e97e0);})['catch'](function(_0x597bb7){logger[_0xdaeb('0x11')](_0xdaeb('0x15'),_0x597bb7[_0xdaeb('0x12')],_0x1b5243);_0x36f9ac(_0x1fe84e[_0xdaeb('0x11')](0x1f4,_0x597bb7[_0xdaeb('0x12')]));});});}; \ No newline at end of file +var _0x8952=['jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','raw','debug','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x31bcb2,_0x23cc0e){var _0x3f150c=function(_0x119f71){while(--_0x119f71){_0x31bcb2['push'](_0x31bcb2['shift']());}};_0x3f150c(++_0x23cc0e);}(_0x8952,0x17e));var _0x2895=function(_0x24e1df,_0x6dcb19){_0x24e1df=_0x24e1df-0x0;var _0x514f79=_0x8952[_0x24e1df];return _0x514f79;};'use strict';var _=require('lodash');var util=require(_0x2895('0x0'));var moment=require(_0x2895('0x1'));var BPromise=require(_0x2895('0x2'));var rs=require(_0x2895('0x3'));var fs=require('fs');var Redis=require(_0x2895('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2895('0x5'));var logger=require(_0x2895('0x6'))(_0x2895('0x7'));var config=require('../../config/environment');var jayson=require(_0x2895('0x8'));var client=jayson[_0x2895('0x9')][_0x2895('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ea619,_0x526c32,_0x238b4a){return new BPromise(function(_0x335002,_0x159f86){return client[_0x2895('0xb')](_0x4ea619,_0x238b4a)[_0x2895('0xc')](function(_0x4952fa){logger[_0x2895('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0x526c32,_0x2895('0xe'));logger['debug']('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x526c32,'request\x20sent',JSON[_0x2895('0xf')](_0x4952fa));if(_0x4952fa[_0x2895('0x10')]){if(_0x4952fa[_0x2895('0x10')]['code']===0x1f4){logger[_0x2895('0x10')](_0x2895('0x11'),_0x526c32,_0x4952fa['error'][_0x2895('0x12')]);return _0x159f86(_0x4952fa[_0x2895('0x10')]['message']);}logger['error'](_0x2895('0x11'),_0x526c32,_0x4952fa[_0x2895('0x10')]['message']);return _0x335002(_0x4952fa[_0x2895('0x10')][_0x2895('0x12')]);}else{logger[_0x2895('0xd')](_0x2895('0x11'),_0x526c32,_0x2895('0xe'));_0x335002(_0x4952fa[_0x2895('0x13')][_0x2895('0x12')]);}})[_0x2895('0x14')](function(_0x3e96d7){logger[_0x2895('0x10')](_0x2895('0x11'),_0x526c32,_0x3e96d7);_0x159f86(_0x3e96d7);});});}exports[_0x2895('0x15')]=function(_0xbf8b63){var _0x2cb505=this;return new Promise(function(_0x155124,_0x184d11){return db[_0x2895('0x16')][_0x2895('0x17')](_0xbf8b63['body'],{'raw':_0xbf8b63['options']?_0xbf8b63['options'][_0x2895('0x18')]===undefined?!![]:![]:!![]})[_0x2895('0xc')](function(_0x3ec4da){logger['info'](_0x2895('0x15'),_0xbf8b63);logger[_0x2895('0x19')](_0x2895('0x15'),_0xbf8b63,JSON[_0x2895('0xf')](_0x3ec4da));_0x155124(_0x3ec4da);})[_0x2895('0x14')](function(_0x5dbbfe){logger[_0x2895('0x10')](_0x2895('0x15'),_0x5dbbfe['message'],_0xbf8b63);_0x184d11(_0x2cb505[_0x2895('0x10')](0x1f4,_0x5dbbfe[_0x2895('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 6868318..26ead01 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 _0xaf0b=['killProcess','express','Router','get','isAuthenticated','index'];(function(_0x502ec9,_0x1edbb4){var _0x3f521e=function(_0x53cfe7){while(--_0x53cfe7){_0x502ec9['push'](_0x502ec9['shift']());}};_0x3f521e(++_0x1edbb4);}(_0xaf0b,0x16f));var _0xbaf0=function(_0x28400e,_0x56b137){_0x28400e=_0x28400e-0x0;var _0xff030=_0xaf0b[_0x28400e];return _0xff030;};'use strict';var express=require(_0xbaf0('0x0'));var router=express[_0xbaf0('0x1')]();var auth=require('../../components/auth/service');var controller=require('./system.controller');router[_0xbaf0('0x2')]('/',auth[_0xbaf0('0x3')](),controller[_0xbaf0('0x4')]);router['get']('/process/:pid/kill',auth['isAuthenticated'](),controller[_0xbaf0('0x5')]);module['exports']=router; \ No newline at end of file +var _0x5dd1=['./system.controller','get','isAuthenticated','killProcess','exports','express','Router'];(function(_0x4f11cb,_0x14e174){var _0x491488=function(_0x2904a9){while(--_0x2904a9){_0x4f11cb['push'](_0x4f11cb['shift']());}};_0x491488(++_0x14e174);}(_0x5dd1,0x155));var _0x15dd=function(_0xfb1864,_0x1cc767){_0xfb1864=_0xfb1864-0x0;var _0x4767e7=_0x5dd1[_0xfb1864];return _0x4767e7;};'use strict';var express=require(_0x15dd('0x0'));var router=express[_0x15dd('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x15dd('0x2'));router[_0x15dd('0x3')]('/',auth[_0x15dd('0x4')](),controller['index']);router['get']('/process/:pid/kill',auth[_0x15dd('0x4')](),controller[_0x15dd('0x5')]);module[_0x15dd('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index ff67e0f..54dd764 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 _0x1269=['components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','then','split','length','pid','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','child_process','exec','api','util','bluebird','lodash','error','name','status','index','json','killProcess'];(function(_0x1024d2,_0x4df209){var _0x4aa07b=function(_0x1fe86a){while(--_0x1fe86a){_0x1024d2['push'](_0x1024d2['shift']());}};_0x4aa07b(++_0x4df209);}(_0x1269,0xd0));var _0x9126=function(_0x41b8f2,_0x1ebe99){_0x41b8f2=_0x41b8f2-0x0;var _0x555e15=_0x1269[_0x41b8f2];return _0x555e15;};'use strict';var info=require('systeminformation');var exec=require(_0x9126('0x0'))[_0x9126('0x1')];var logger=require('../../config/logger')(_0x9126('0x2'));var util=require(_0x9126('0x3'));var BPromise=require(_0x9126('0x4'));var _=require(_0x9126('0x5'));function handleError(_0x5426e6,_0x3b62bc,_0x57696d){_0x3b62bc=_0x3b62bc||0x1f4;return function(_0x39db5e){logger[_0x9126('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x57696d,_0x3b62bc,util['inspect'](_0x39db5e,{'showHidden':![],'depth':null}));delete _0x39db5e[_0x9126('0x7')];_0x5426e6[_0x9126('0x8')](_0x3b62bc)['send'](_0x39db5e);};}exports[_0x9126('0x9')]=function(_0xb45ef9,_0x27e872){return info['getAllData']()['then'](function(_0x5ea610){return _0x27e872['status'](0xc8)['json'](_0x5ea610);})['catch'](function(_0x50da7e){return _0x27e872['status'](0x1f4)[_0x9126('0xa')](_0x50da7e);});};exports[_0x9126('0xb')]=function(_0x30b8fb,_0x45415a){var _0x6ed350=[_0x9126('0xc')];return new BPromise(function(_0x4ca233,_0x59acc6){return exec(util['format'](_0x9126('0xd'),_0x30b8fb[_0x9126('0xe')]['pid']),function(_0x6466d3,_0x1e4b90,_0xa899df){if(_0x6466d3){return _0x59acc6(_0x6466d3);}return _0x4ca233(_0x1e4b90);});})[_0x9126('0xf')](function(_0x2d4ff2){var _0x4a018d=![];var _0x294300=_0x2d4ff2[_0x9126('0x10')](/\n/);for(var _0x496151=0x0,_0x4af936=_0x6ed350[_0x9126('0x11')];_0x496151<_0x4af936,_0x4a018d===![];_0x496151+=0x1){if(_0x2d4ff2['indexOf'](_0x6ed350[_0x496151])>=0x0){_0x4a018d=!![];}}if(!_0x4a018d){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x30b8fb[_0x9126('0xe')][_0x9126('0x12')]));}process['kill'](_0x30b8fb[_0x9126('0xe')][_0x9126('0x12')],_0x9126('0x13'));return _0x45415a[_0x9126('0x8')](0xc8)[_0x9126('0xa')]({'message':util['format'](_0x9126('0x14'),_0x30b8fb[_0x9126('0xe')][_0x9126('0x12')])});})[_0x9126('0x15')](handleError(_0x45415a,null,'killProcess'));}; \ No newline at end of file +var _0x8424=['util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','status','index','then','catch','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','indexOf','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x8424,0x17b));var _0x4842=function(_0x52e1f3,_0x488147){_0x52e1f3=_0x52e1f3-0x0;var _0x1318df=_0x8424[_0x52e1f3];return _0x1318df;};'use strict';var info=require('systeminformation');var exec=require(_0x4842('0x0'))['exec'];var logger=require('../../config/logger')('api');var util=require(_0x4842('0x1'));var BPromise=require('bluebird');var _=require(_0x4842('0x2'));function handleError(_0x2dc261,_0x1241e6,_0x29ce26){_0x1241e6=_0x1241e6||0x1f4;return function(_0x509c95){logger[_0x4842('0x3')](_0x4842('0x4'),_0x29ce26,_0x1241e6,util['inspect'](_0x509c95,{'showHidden':![],'depth':null}));delete _0x509c95['name'];_0x2dc261[_0x4842('0x5')](_0x1241e6)['send'](_0x509c95);};}exports[_0x4842('0x6')]=function(_0xbf14c5,_0x3d2c6e){return info['getAllData']()[_0x4842('0x7')](function(_0x148701){return _0x3d2c6e[_0x4842('0x5')](0xc8)['json'](_0x148701);})[_0x4842('0x8')](function(_0x331bfb){return _0x3d2c6e[_0x4842('0x5')](0x1f4)[_0x4842('0x9')](_0x331bfb);});};exports[_0x4842('0xa')]=function(_0x57a0ab,_0x36ab27){var _0x3a956c=[_0x4842('0xb')];return new BPromise(function(_0x4ab134,_0x43e615){return exec(util[_0x4842('0xc')](_0x4842('0xd'),_0x57a0ab[_0x4842('0xe')][_0x4842('0xf')]),function(_0x54ce6e,_0x4afa6d,_0x271041){if(_0x54ce6e){return _0x43e615(_0x54ce6e);}return _0x4ab134(_0x4afa6d);});})['then'](function(_0x57ce56){var _0x51255e=![];var _0xdb792b=_0x57ce56['split'](/\n/);for(var _0x1d5546=0x0,_0x1be511=_0x3a956c['length'];_0x1d5546<_0x1be511,_0x51255e===![];_0x1d5546+=0x1){if(_0x57ce56[_0x4842('0x10')](_0x3a956c[_0x1d5546])>=0x0){_0x51255e=!![];}}if(!_0x51255e){throw new Error(util[_0x4842('0xc')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x57a0ab['params'][_0x4842('0xf')]));}process[_0x4842('0x11')](_0x57a0ab[_0x4842('0xe')][_0x4842('0xf')],'SIGINT');return _0x36ab27[_0x4842('0x5')](0xc8)[_0x4842('0x9')]({'message':util[_0x4842('0xc')](_0x4842('0x12'),_0x57a0ab['params'][_0x4842('0xf')])});})['catch'](handleError(_0x36ab27,null,_0x4842('0xa')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 8cad43e..364b39f 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 _0x909a=['get','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./tag.controller','isAuthenticated','index'];(function(_0x13de83,_0xa9e51d){var _0x4860a2=function(_0x4c2c6d){while(--_0x4c2c6d){_0x13de83['push'](_0x13de83['shift']());}};_0x4860a2(++_0xa9e51d);}(_0x909a,0xbc));var _0xa909=function(_0x2e5a8c,_0x35f4bf){_0x2e5a8c=_0x2e5a8c-0x0;var _0x5816ec=_0x909a[_0x2e5a8c];return _0x5816ec;};'use strict';var multer=require(_0xa909('0x0'));var util=require(_0xa909('0x1'));var path=require(_0xa909('0x2'));var timeout=require(_0xa909('0x3'));var express=require('express');var router=express[_0xa909('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa909('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa909('0x6'));var controller=require(_0xa909('0x7'));router['get']('/',auth[_0xa909('0x8')](),controller[_0xa909('0x9')]);router[_0xa909('0xa')]('/:id',auth[_0xa909('0x8')](),controller['show']);router[_0xa909('0xb')]('/',auth['isAuthenticated'](),controller[_0xa909('0xc')]);router[_0xa909('0xd')](_0xa909('0xe'),auth['isAuthenticated'](),controller[_0xa909('0xf')]);router[_0xa909('0x10')](_0xa909('0xe'),auth[_0xa909('0x8')](),controller['destroy']);module[_0xa909('0x11')]=router; \ No newline at end of file +var _0xded4=['../../config/environment','./tag.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','exports','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x54c259,_0x22cc87){var _0x397069=function(_0x204c97){while(--_0x204c97){_0x54c259['push'](_0x54c259['shift']());}};_0x397069(++_0x22cc87);}(_0xded4,0x1bd));var _0x4ded=function(_0xb2bbcd,_0x1dc0d){_0xb2bbcd=_0xb2bbcd-0x0;var _0x1ff22b=_0xded4[_0xb2bbcd];return _0x1ff22b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4ded('0x0'));var timeout=require(_0x4ded('0x1'));var express=require(_0x4ded('0x2'));var router=express[_0x4ded('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4ded('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4ded('0x5'));var controller=require(_0x4ded('0x6'));router[_0x4ded('0x7')]('/',auth[_0x4ded('0x8')](),controller[_0x4ded('0x9')]);router[_0x4ded('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x4ded('0xa')]);router[_0x4ded('0xb')]('/',auth[_0x4ded('0x8')](),controller[_0x4ded('0xc')]);router[_0x4ded('0xd')](_0x4ded('0xe'),auth[_0x4ded('0x8')](),controller[_0x4ded('0xf')]);router[_0x4ded('0x10')](_0x4ded('0xe'),auth[_0x4ded('0x8')](),controller['destroy']);module[_0x4ded('0x11')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 87665c2..45f135b 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 _0xeb74=['name','#0091EA','sequelize','exports','STRING'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xeb74,0xe3));var _0x4eb7=function(_0x2e280d,_0x492d42){_0x2e280d=_0x2e280d-0x0;var _0x227c09=_0xeb74[_0x2e280d];return _0x227c09;};'use strict';var Sequelize=require(_0x4eb7('0x0'));module[_0x4eb7('0x1')]={'name':{'type':Sequelize[_0x4eb7('0x2')],'unique':_0x4eb7('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x4eb7('0x2')],'defaultValue':_0x4eb7('0x4')},'description':{'type':Sequelize[_0x4eb7('0x2')]}}; \ No newline at end of file +var _0x7e05=['sequelize','exports','name','#0091EA','STRING'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7e05,0x69));var _0x57e0=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x7e05[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x57e0('0x0'));module[_0x57e0('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x57e0('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x57e0('0x3')},'description':{'type':Sequelize[_0x57e0('0x4')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 293d12e..7b7c241 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 _0xc368=['error','name','map','Tag','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','includeAll','include','rows','catch','params','keys','length','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','then','UserProfileResource'];(function(_0x163555,_0x27ce78){var _0x250307=function(_0x27c529){while(--_0x27c529){_0x163555['push'](_0x163555['shift']());}};_0x250307(++_0x27ce78);}(_0xc368,0x7b));var _0x8c36=function(_0x214a64,_0x3e702a){_0x214a64=_0x214a64-0x0;var _0x11a279=_0xc368[_0x214a64];return _0x11a279;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8c36('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8c36('0x1'));var rp=require(_0x8c36('0x2'));var moment=require(_0x8c36('0x3'));var BPromise=require(_0x8c36('0x4'));var Mustache=require(_0x8c36('0x5'));var util=require('util');var path=require(_0x8c36('0x6'));var sox=require(_0x8c36('0x7'));var csv=require(_0x8c36('0x8'));var ejs=require(_0x8c36('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8c36('0xa'));var crypto=require(_0x8c36('0xb'));var jsforce=require(_0x8c36('0xc'));var deskjs=require(_0x8c36('0xd'));var toCsv=require(_0x8c36('0x8'));var querystring=require(_0x8c36('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8c36('0xf'));var as=require(_0x8c36('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c36('0x11'))(_0x8c36('0x12'));var utils=require(_0x8c36('0x13'));var config=require(_0x8c36('0x14'));var licenseUtil=require(_0x8c36('0x15'));var db=require(_0x8c36('0x16'))['db'];function respondWithStatusCode(_0xa09884,_0x23eb71){_0x23eb71=_0x23eb71||0xcc;return function(_0x205d5c){if(_0x205d5c){return _0xa09884[_0x8c36('0x17')](_0x23eb71);}return _0xa09884[_0x8c36('0x18')](_0x23eb71)[_0x8c36('0x19')]();};}function respondWithResult(_0x3c824b,_0x220f18){_0x220f18=_0x220f18||0xc8;return function(_0x5dfcd5){if(_0x5dfcd5){return _0x3c824b[_0x8c36('0x18')](_0x220f18)['json'](_0x5dfcd5);}};}function respondWithFilteredResult(_0xea7509,_0x3f83aa){return function(_0x29e791){if(_0x29e791){var _0x1fc68e=typeof _0x3f83aa[_0x8c36('0x1a')]===_0x8c36('0x1b')&&typeof _0x3f83aa[_0x8c36('0x1c')]===_0x8c36('0x1b');var _0x30229e=_0x29e791['count'];var _0x2be9b0=_0x1fc68e?0x0:_0x3f83aa[_0x8c36('0x1a')];var _0x47832a=_0x1fc68e?_0x29e791[_0x8c36('0x1d')]:_0x3f83aa[_0x8c36('0x1a')]+_0x3f83aa['limit'];var _0x15100f;if(_0x47832a>=_0x30229e){_0x47832a=_0x30229e;_0x15100f=0xc8;}else{_0x15100f=0xce;}_0xea7509[_0x8c36('0x18')](_0x15100f);return _0xea7509[_0x8c36('0x1e')](_0x8c36('0x1f'),_0x2be9b0+'-'+_0x47832a+'/'+_0x30229e)[_0x8c36('0x20')](_0x29e791);}return null;};}function patchUpdates(_0x2b07ad){return function(_0xfb9763){try{jsonpatch[_0x8c36('0x21')](_0xfb9763,_0x2b07ad,!![]);}catch(_0x153735){return BPromise[_0x8c36('0x22')](_0x153735);}return _0xfb9763[_0x8c36('0x23')]();};}function saveUpdates(_0x14ee6b,_0x46645d){return function(_0x51fd6c){if(_0x51fd6c){return _0x51fd6c['update'](_0x14ee6b)['then'](function(_0x55b844){return _0x55b844;});}return null;};}function removeEntity(_0x2269f5,_0x7effb8){return function(_0x2088aa){if(_0x2088aa){return _0x2088aa[_0x8c36('0x24')]()[_0x8c36('0x25')](function(){var _0x27c0df=_0x2088aa['get']({'plain':!![]});var _0x1d39ca='Tags';return db[_0x8c36('0x26')]['destroy']({'where':{'type':_0x1d39ca,'resourceId':_0x27c0df['id']}})[_0x8c36('0x25')](function(){return _0x2088aa;});})[_0x8c36('0x25')](function(){_0x2269f5[_0x8c36('0x18')](0xcc)[_0x8c36('0x19')]();});}};}function handleEntityNotFound(_0x50aa48,_0x55cbfb){return function(_0x7e7e56){if(!_0x7e7e56){_0x50aa48[_0x8c36('0x17')](0x194);}return _0x7e7e56;};}function handleError(_0x5ad933,_0x4fc3ba){_0x4fc3ba=_0x4fc3ba||0x1f4;return function(_0x418663){logger[_0x8c36('0x27')](_0x418663['stack']);if(_0x418663[_0x8c36('0x28')]){delete _0x418663[_0x8c36('0x28')];}_0x5ad933[_0x8c36('0x18')](_0x4fc3ba)['send'](_0x418663);};}exports['index']=function(_0x46b72f,_0x1531fc){var _0x3d7056={},_0x192ce3={},_0x3ae970={'count':0x0,'rows':[]};var _0x2e8855=_[_0x8c36('0x29')](db[_0x8c36('0x2a')][_0x8c36('0x2b')],function(_0x2d6476){return{'name':_0x2d6476[_0x8c36('0x2c')],'type':_0x2d6476[_0x8c36('0x2d')][_0x8c36('0x2e')]};});_0x192ce3[_0x8c36('0x2f')]=_[_0x8c36('0x29')](_0x2e8855,_0x8c36('0x28'));_0x192ce3[_0x8c36('0x30')]=_['keys'](_0x46b72f['query']);_0x192ce3['filters']=_[_0x8c36('0x31')](_0x192ce3[_0x8c36('0x2f')],_0x192ce3[_0x8c36('0x30')]);_0x3d7056[_0x8c36('0x32')]=_[_0x8c36('0x31')](_0x192ce3[_0x8c36('0x2f')],qs[_0x8c36('0x33')](_0x46b72f['query'][_0x8c36('0x33')]));_0x3d7056['attributes']=_0x3d7056[_0x8c36('0x32')]['length']?_0x3d7056[_0x8c36('0x32')]:_0x192ce3[_0x8c36('0x2f')];if(!_0x46b72f[_0x8c36('0x30')]['hasOwnProperty'](_0x8c36('0x34'))){_0x3d7056[_0x8c36('0x1c')]=qs[_0x8c36('0x1c')](_0x46b72f[_0x8c36('0x30')][_0x8c36('0x1c')]);_0x3d7056[_0x8c36('0x1a')]=qs[_0x8c36('0x1a')](_0x46b72f[_0x8c36('0x30')][_0x8c36('0x1a')]);}_0x3d7056[_0x8c36('0x35')]=qs[_0x8c36('0x36')](_0x46b72f[_0x8c36('0x30')][_0x8c36('0x36')]);_0x3d7056[_0x8c36('0x37')]=qs[_0x8c36('0x38')](_[_0x8c36('0x39')](_0x46b72f[_0x8c36('0x30')],_0x192ce3['filters']),_0x2e8855);if(_0x46b72f[_0x8c36('0x30')]['filter']){_0x3d7056[_0x8c36('0x37')]=_[_0x8c36('0x3a')](_0x3d7056[_0x8c36('0x37')],{'$or':_[_0x8c36('0x29')](_0x2e8855,function(_0x4da574){if(_0x4da574['type']!==_0x8c36('0x3b')){var _0x15a553={};_0x15a553[_0x4da574[_0x8c36('0x28')]]={'$like':'%'+_0x46b72f['query']['filter']+'%'};return _0x15a553;}})});}_0x3d7056=_[_0x8c36('0x3a')]({},_0x3d7056,_0x46b72f['options']);var _0x568290={'where':_0x3d7056[_0x8c36('0x37')]};return db[_0x8c36('0x2a')][_0x8c36('0x1d')](_0x568290)[_0x8c36('0x25')](function(_0x2a0272){_0x3ae970[_0x8c36('0x1d')]=_0x2a0272;if(_0x46b72f[_0x8c36('0x30')][_0x8c36('0x3c')]){_0x3d7056[_0x8c36('0x3d')]=[{'all':!![]}];}return db[_0x8c36('0x2a')]['findAll'](_0x3d7056);})[_0x8c36('0x25')](function(_0x24505c){_0x3ae970[_0x8c36('0x3e')]=_0x24505c;return _0x3ae970;})[_0x8c36('0x25')](respondWithFilteredResult(_0x1531fc,_0x3d7056))[_0x8c36('0x3f')](handleError(_0x1531fc,null));};exports['show']=function(_0xb1f8ac,_0x3dde7b){var _0x31699c={'raw':!![],'where':{'id':_0xb1f8ac[_0x8c36('0x40')]['id']}},_0x18e28e={};_0x18e28e[_0x8c36('0x2f')]=_['keys'](db[_0x8c36('0x2a')][_0x8c36('0x2b')]);_0x18e28e[_0x8c36('0x30')]=_[_0x8c36('0x41')](_0xb1f8ac[_0x8c36('0x30')]);_0x18e28e[_0x8c36('0x38')]=_[_0x8c36('0x31')](_0x18e28e['model'],_0x18e28e[_0x8c36('0x30')]);_0x31699c[_0x8c36('0x32')]=_[_0x8c36('0x31')](_0x18e28e[_0x8c36('0x2f')],qs[_0x8c36('0x33')](_0xb1f8ac[_0x8c36('0x30')][_0x8c36('0x33')]));_0x31699c[_0x8c36('0x32')]=_0x31699c[_0x8c36('0x32')][_0x8c36('0x42')]?_0x31699c[_0x8c36('0x32')]:_0x18e28e[_0x8c36('0x2f')];if(_0xb1f8ac['query']['includeAll']){_0x31699c[_0x8c36('0x3d')]=[{'all':!![]}];}_0x31699c=_[_0x8c36('0x3a')]({},_0x31699c,_0xb1f8ac[_0x8c36('0x43')]);return db[_0x8c36('0x2a')]['find'](_0x31699c)[_0x8c36('0x25')](handleEntityNotFound(_0x3dde7b,null))[_0x8c36('0x25')](respondWithResult(_0x3dde7b,null))['catch'](handleError(_0x3dde7b,null));};exports['create']=function(_0x4edf8e,_0xb4ebae){return db[_0x8c36('0x2a')][_0x8c36('0x44')](_0x4edf8e[_0x8c36('0x45')],{})[_0x8c36('0x25')](function(_0x2778b3){var _0x4dd393=_0x4edf8e[_0x8c36('0x46')][_0x8c36('0x47')]({'plain':!![]});if(!_0x4dd393)throw new Error(_0x8c36('0x48'));if(_0x4dd393[_0x8c36('0x49')]==='user'){var _0x5e668d=_0x2778b3['get']({'plain':!![]});var _0x3887e4=_0x8c36('0x4a');return db[_0x8c36('0x4b')][_0x8c36('0x4c')]({'where':{'name':_0x3887e4,'userProfileId':_0x4dd393[_0x8c36('0x4d')]},'raw':!![]})[_0x8c36('0x25')](function(_0x43b5e2){if(_0x43b5e2&&_0x43b5e2[_0x8c36('0x4e')]===0x0){return db[_0x8c36('0x26')]['create']({'name':_0x5e668d['name'],'resourceId':_0x5e668d['id'],'type':_0x43b5e2[_0x8c36('0x28')],'sectionId':_0x43b5e2['id']},{})['then'](function(){return _0x2778b3;});}else{return _0x2778b3;}})['catch'](function(_0x9955bc){logger['error'](_0x8c36('0x4f'),_0x9955bc);throw _0x9955bc;});}return _0x2778b3;})[_0x8c36('0x25')](respondWithResult(_0xb4ebae,0xc9))['catch'](handleError(_0xb4ebae,null));};exports[_0x8c36('0x50')]=function(_0x5af860,_0x31fbde){if(_0x5af860[_0x8c36('0x45')]['id']){delete _0x5af860[_0x8c36('0x45')]['id'];}return db['Tag'][_0x8c36('0x4c')]({'where':{'id':_0x5af860[_0x8c36('0x40')]['id']}})[_0x8c36('0x25')](handleEntityNotFound(_0x31fbde,null))[_0x8c36('0x25')](saveUpdates(_0x5af860[_0x8c36('0x45')],null))[_0x8c36('0x25')](respondWithResult(_0x31fbde,null))[_0x8c36('0x3f')](handleError(_0x31fbde,null));};exports[_0x8c36('0x24')]=function(_0x20f1d9,_0x4cd57c){return db['Tag']['find']({'where':{'id':_0x20f1d9[_0x8c36('0x40')]['id']}})['then'](handleEntityNotFound(_0x4cd57c,null))['then'](removeEntity(_0x4cd57c,null))[_0x8c36('0x3f')](handleError(_0x4cd57c,null));}; \ No newline at end of file +var _0x2750=['sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','update','destroy','then','get','Tags','UserProfileResource','error','stack','name','send','map','Tag','fieldName','type','key','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','keys','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x147698,_0x45b292){var _0x19b1bb=function(_0x257f0e){while(--_0x257f0e){_0x147698['push'](_0x147698['shift']());}};_0x19b1bb(++_0x45b292);}(_0x2750,0x13b));var _0x0275=function(_0x580fc4,_0x1244e3){_0x580fc4=_0x580fc4-0x0;var _0x323a31=_0x2750[_0x580fc4];return _0x323a31;};'use strict';var emlformat=require(_0x0275('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0275('0x1'));var jsonpatch=require(_0x0275('0x2'));var rp=require(_0x0275('0x3'));var moment=require(_0x0275('0x4'));var BPromise=require(_0x0275('0x5'));var Mustache=require(_0x0275('0x6'));var util=require(_0x0275('0x7'));var path=require(_0x0275('0x8'));var sox=require(_0x0275('0x9'));var csv=require(_0x0275('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0275('0xb'));var _=require(_0x0275('0xc'));var squel=require(_0x0275('0xd'));var crypto=require(_0x0275('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0275('0xf'));var toCsv=require(_0x0275('0xa'));var querystring=require(_0x0275('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0275('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0275('0x12'));var hardwareService=require(_0x0275('0x13'));var logger=require(_0x0275('0x14'))(_0x0275('0x15'));var utils=require(_0x0275('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0275('0x17'));var db=require(_0x0275('0x18'))['db'];function respondWithStatusCode(_0x1f128d,_0x4c6ee0){_0x4c6ee0=_0x4c6ee0||0xcc;return function(_0x55ffd6){if(_0x55ffd6){return _0x1f128d[_0x0275('0x19')](_0x4c6ee0);}return _0x1f128d[_0x0275('0x1a')](_0x4c6ee0)[_0x0275('0x1b')]();};}function respondWithResult(_0x46a729,_0x28827b){_0x28827b=_0x28827b||0xc8;return function(_0x36921c){if(_0x36921c){return _0x46a729['status'](_0x28827b)[_0x0275('0x1c')](_0x36921c);}};}function respondWithFilteredResult(_0x3030c0,_0x4aa412){return function(_0x6344fc){if(_0x6344fc){var _0xaae367=typeof _0x4aa412['offset']===_0x0275('0x1d')&&typeof _0x4aa412[_0x0275('0x1e')]==='undefined';var _0x5e7466=_0x6344fc['count'];var _0x591d27=_0xaae367?0x0:_0x4aa412['offset'];var _0x566ad6=_0xaae367?_0x6344fc[_0x0275('0x1f')]:_0x4aa412[_0x0275('0x20')]+_0x4aa412['limit'];var _0x7075c9;if(_0x566ad6>=_0x5e7466){_0x566ad6=_0x5e7466;_0x7075c9=0xc8;}else{_0x7075c9=0xce;}_0x3030c0[_0x0275('0x1a')](_0x7075c9);return _0x3030c0[_0x0275('0x21')]('Content-Range',_0x591d27+'-'+_0x566ad6+'/'+_0x5e7466)[_0x0275('0x1c')](_0x6344fc);}return null;};}function patchUpdates(_0x402f0d){return function(_0x575786){try{jsonpatch['apply'](_0x575786,_0x402f0d,!![]);}catch(_0x31ba9e){return BPromise[_0x0275('0x22')](_0x31ba9e);}return _0x575786[_0x0275('0x23')]();};}function saveUpdates(_0x592a53,_0xf3b68e){return function(_0x5ab9e7){if(_0x5ab9e7){return _0x5ab9e7[_0x0275('0x24')](_0x592a53)['then'](function(_0x26f2c2){return _0x26f2c2;});}return null;};}function removeEntity(_0xfa0081,_0x594321){return function(_0x140a18){if(_0x140a18){return _0x140a18[_0x0275('0x25')]()[_0x0275('0x26')](function(){var _0x52946b=_0x140a18[_0x0275('0x27')]({'plain':!![]});var _0x44bbf8=_0x0275('0x28');return db[_0x0275('0x29')][_0x0275('0x25')]({'where':{'type':_0x44bbf8,'resourceId':_0x52946b['id']}})[_0x0275('0x26')](function(){return _0x140a18;});})['then'](function(){_0xfa0081[_0x0275('0x1a')](0xcc)[_0x0275('0x1b')]();});}};}function handleEntityNotFound(_0x1d24b2,_0x275dac){return function(_0x4689a3){if(!_0x4689a3){_0x1d24b2['sendStatus'](0x194);}return _0x4689a3;};}function handleError(_0x1ffd57,_0xd59d69){_0xd59d69=_0xd59d69||0x1f4;return function(_0x3246ea){logger[_0x0275('0x2a')](_0x3246ea[_0x0275('0x2b')]);if(_0x3246ea['name']){delete _0x3246ea[_0x0275('0x2c')];}_0x1ffd57[_0x0275('0x1a')](_0xd59d69)[_0x0275('0x2d')](_0x3246ea);};}exports['index']=function(_0x5e2e22,_0x3cb2d7){var _0x299190={},_0x5dc2bc={},_0x7eff96={'count':0x0,'rows':[]};var _0x155a50=_[_0x0275('0x2e')](db[_0x0275('0x2f')]['rawAttributes'],function(_0x24c762){return{'name':_0x24c762[_0x0275('0x30')],'type':_0x24c762[_0x0275('0x31')][_0x0275('0x32')]};});_0x5dc2bc['model']=_[_0x0275('0x2e')](_0x155a50,'name');_0x5dc2bc[_0x0275('0x33')]=_['keys'](_0x5e2e22[_0x0275('0x33')]);_0x5dc2bc[_0x0275('0x34')]=_['intersection'](_0x5dc2bc[_0x0275('0x35')],_0x5dc2bc[_0x0275('0x33')]);_0x299190[_0x0275('0x36')]=_[_0x0275('0x37')](_0x5dc2bc['model'],qs[_0x0275('0x38')](_0x5e2e22[_0x0275('0x33')][_0x0275('0x38')]));_0x299190[_0x0275('0x36')]=_0x299190[_0x0275('0x36')]['length']?_0x299190[_0x0275('0x36')]:_0x5dc2bc[_0x0275('0x35')];if(!_0x5e2e22[_0x0275('0x33')][_0x0275('0x39')](_0x0275('0x3a'))){_0x299190[_0x0275('0x1e')]=qs[_0x0275('0x1e')](_0x5e2e22[_0x0275('0x33')][_0x0275('0x1e')]);_0x299190[_0x0275('0x20')]=qs[_0x0275('0x20')](_0x5e2e22['query'][_0x0275('0x20')]);}_0x299190[_0x0275('0x3b')]=qs[_0x0275('0x3c')](_0x5e2e22[_0x0275('0x33')][_0x0275('0x3c')]);_0x299190[_0x0275('0x3d')]=qs[_0x0275('0x34')](_[_0x0275('0x3e')](_0x5e2e22[_0x0275('0x33')],_0x5dc2bc[_0x0275('0x34')]),_0x155a50);if(_0x5e2e22[_0x0275('0x33')][_0x0275('0x3f')]){_0x299190[_0x0275('0x3d')]=_[_0x0275('0x40')](_0x299190['where'],{'$or':_[_0x0275('0x2e')](_0x155a50,function(_0x1cc40d){if(_0x1cc40d['type']!==_0x0275('0x41')){var _0x76b8fa={};_0x76b8fa[_0x1cc40d[_0x0275('0x2c')]]={'$like':'%'+_0x5e2e22[_0x0275('0x33')][_0x0275('0x3f')]+'%'};return _0x76b8fa;}})});}_0x299190=_[_0x0275('0x40')]({},_0x299190,_0x5e2e22[_0x0275('0x42')]);var _0x5e57b5={'where':_0x299190[_0x0275('0x3d')]};return db[_0x0275('0x2f')][_0x0275('0x1f')](_0x5e57b5)[_0x0275('0x26')](function(_0x4f888c){_0x7eff96[_0x0275('0x1f')]=_0x4f888c;if(_0x5e2e22[_0x0275('0x33')][_0x0275('0x43')]){_0x299190[_0x0275('0x44')]=[{'all':!![]}];}return db['Tag'][_0x0275('0x45')](_0x299190);})['then'](function(_0x261e66){_0x7eff96[_0x0275('0x46')]=_0x261e66;return _0x7eff96;})[_0x0275('0x26')](respondWithFilteredResult(_0x3cb2d7,_0x299190))[_0x0275('0x47')](handleError(_0x3cb2d7,null));};exports['show']=function(_0x13c651,_0x3d1bfc){var _0x59839d={'raw':!![],'where':{'id':_0x13c651[_0x0275('0x48')]['id']}},_0x1e143e={};_0x1e143e[_0x0275('0x35')]=_['keys'](db[_0x0275('0x2f')][_0x0275('0x49')]);_0x1e143e['query']=_[_0x0275('0x4a')](_0x13c651[_0x0275('0x33')]);_0x1e143e[_0x0275('0x34')]=_[_0x0275('0x37')](_0x1e143e[_0x0275('0x35')],_0x1e143e[_0x0275('0x33')]);_0x59839d[_0x0275('0x36')]=_[_0x0275('0x37')](_0x1e143e[_0x0275('0x35')],qs[_0x0275('0x38')](_0x13c651[_0x0275('0x33')]['fields']));_0x59839d[_0x0275('0x36')]=_0x59839d[_0x0275('0x36')][_0x0275('0x4b')]?_0x59839d[_0x0275('0x36')]:_0x1e143e[_0x0275('0x35')];if(_0x13c651[_0x0275('0x33')][_0x0275('0x43')]){_0x59839d[_0x0275('0x44')]=[{'all':!![]}];}_0x59839d=_[_0x0275('0x40')]({},_0x59839d,_0x13c651[_0x0275('0x42')]);return db[_0x0275('0x2f')]['find'](_0x59839d)['then'](handleEntityNotFound(_0x3d1bfc,null))[_0x0275('0x26')](respondWithResult(_0x3d1bfc,null))[_0x0275('0x47')](handleError(_0x3d1bfc,null));};exports[_0x0275('0x4c')]=function(_0x3bd019,_0x310c6b){return db['Tag'][_0x0275('0x4c')](_0x3bd019['body'],{})[_0x0275('0x26')](function(_0x17dde0){var _0x27a469=_0x3bd019[_0x0275('0x4d')]['get']({'plain':!![]});if(!_0x27a469)throw new Error(_0x0275('0x4e'));if(_0x27a469['role']==='user'){var _0x515860=_0x17dde0[_0x0275('0x27')]({'plain':!![]});var _0x4e36fc=_0x0275('0x28');return db[_0x0275('0x4f')][_0x0275('0x50')]({'where':{'name':_0x4e36fc,'userProfileId':_0x27a469[_0x0275('0x51')]},'raw':!![]})[_0x0275('0x26')](function(_0x11794b){if(_0x11794b&&_0x11794b[_0x0275('0x52')]===0x0){return db['UserProfileResource'][_0x0275('0x4c')]({'name':_0x515860['name'],'resourceId':_0x515860['id'],'type':_0x11794b[_0x0275('0x2c')],'sectionId':_0x11794b['id']},{})[_0x0275('0x26')](function(){return _0x17dde0;});}else{return _0x17dde0;}})[_0x0275('0x47')](function(_0x1686d9){logger[_0x0275('0x2a')](_0x0275('0x53'),_0x1686d9);throw _0x1686d9;});}return _0x17dde0;})[_0x0275('0x26')](respondWithResult(_0x310c6b,0xc9))[_0x0275('0x47')](handleError(_0x310c6b,null));};exports[_0x0275('0x24')]=function(_0x3673ad,_0x545333){if(_0x3673ad['body']['id']){delete _0x3673ad[_0x0275('0x54')]['id'];}return db['Tag']['find']({'where':{'id':_0x3673ad[_0x0275('0x48')]['id']}})[_0x0275('0x26')](handleEntityNotFound(_0x545333,null))[_0x0275('0x26')](saveUpdates(_0x3673ad[_0x0275('0x54')],null))[_0x0275('0x26')](respondWithResult(_0x545333,null))[_0x0275('0x47')](handleError(_0x545333,null));};exports['destroy']=function(_0x104232,_0x163ce2){return db[_0x0275('0x2f')][_0x0275('0x50')]({'where':{'id':_0x104232[_0x0275('0x48')]['id']}})[_0x0275('0x26')](handleEntityNotFound(_0x163ce2,null))['then'](removeEntity(_0x163ce2,null))[_0x0275('0x47')](handleError(_0x163ce2,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 0ac5e70..ec2d0b2 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 _0xe60e=['path','rimraf','./tag.attributes','exports','Tag','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1e6a69,_0x74aad0){var _0x4c2778=function(_0x19f49f){while(--_0x19f49f){_0x1e6a69['push'](_0x1e6a69['shift']());}};_0x4c2778(++_0x74aad0);}(_0xe60e,0x10a));var _0xee60=function(_0x30598d,_0x1cd92d){_0x30598d=_0x30598d-0x0;var _0x5e73bb=_0xe60e[_0x30598d];return _0x5e73bb;};'use strict';var _=require(_0xee60('0x0'));var util=require(_0xee60('0x1'));var logger=require(_0xee60('0x2'))(_0xee60('0x3'));var moment=require(_0xee60('0x4'));var BPromise=require(_0xee60('0x5'));var rp=require(_0xee60('0x6'));var fs=require('fs');var path=require(_0xee60('0x7'));var rimraf=require(_0xee60('0x8'));var config=require('../../config/environment');var attributes=require(_0xee60('0x9'));module[_0xee60('0xa')]=function(_0x3d35f7,_0x595ec1){return _0x3d35f7['define'](_0xee60('0xb'),attributes,{'tableName':_0xee60('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf590=['define','tools_tags','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./tag.attributes','exports'];(function(_0xab5cff,_0x5dc9f7){var _0x5a26ab=function(_0x6057b9){while(--_0x6057b9){_0xab5cff['push'](_0xab5cff['shift']());}};_0x5a26ab(++_0x5dc9f7);}(_0xf590,0x7a));var _0x0f59=function(_0x3cd881,_0x525fbd){_0x3cd881=_0x3cd881-0x0;var _0x16907d=_0xf590[_0x3cd881];return _0x16907d;};'use strict';var _=require(_0x0f59('0x0'));var util=require(_0x0f59('0x1'));var logger=require(_0x0f59('0x2'))('api');var moment=require(_0x0f59('0x3'));var BPromise=require(_0x0f59('0x4'));var rp=require(_0x0f59('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0f59('0x6'));var config=require(_0x0f59('0x7'));var attributes=require(_0x0f59('0x8'));module[_0x0f59('0x9')]=function(_0x4320be,_0x3fbc14){return _0x4320be[_0x0f59('0xa')]('Tag',attributes,{'tableName':_0x0f59('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 9b58cc6..0472557 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 _0x4876=['stringify','error','code','message','result','catch','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x270227,_0x399cd8){var _0x13e757=function(_0x47f5e7){while(--_0x47f5e7){_0x270227['push'](_0x270227['shift']());}};_0x13e757(++_0x399cd8);}(_0x4876,0x84));var _0x6487=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4876[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6487('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6487('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x6487('0x2'));var logger=require(_0x6487('0x3'))(_0x6487('0x4'));var config=require(_0x6487('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x6487('0x6')][_0x6487('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x52177e,_0x289918,_0x14d6d8){return new BPromise(function(_0x2df3c1,_0x3f237a){return client[_0x6487('0x8')](_0x52177e,_0x14d6d8)[_0x6487('0x9')](function(_0x84bd9f){logger[_0x6487('0xa')](_0x6487('0xb'),_0x289918,'request\x20sent');logger[_0x6487('0xc')](_0x6487('0xd'),_0x289918,_0x6487('0xe'),JSON[_0x6487('0xf')](_0x84bd9f));if(_0x84bd9f[_0x6487('0x10')]){if(_0x84bd9f[_0x6487('0x10')][_0x6487('0x11')]===0x1f4){logger[_0x6487('0x10')]('Tag,\x20%s,\x20%s',_0x289918,_0x84bd9f[_0x6487('0x10')][_0x6487('0x12')]);return _0x3f237a(_0x84bd9f[_0x6487('0x10')][_0x6487('0x12')]);}logger['error'](_0x6487('0xb'),_0x289918,_0x84bd9f[_0x6487('0x10')][_0x6487('0x12')]);return _0x2df3c1(_0x84bd9f[_0x6487('0x10')]['message']);}else{logger['info'](_0x6487('0xb'),_0x289918,'request\x20sent');_0x2df3c1(_0x84bd9f[_0x6487('0x13')]['message']);}})[_0x6487('0x14')](function(_0x3e7560){logger[_0x6487('0x10')](_0x6487('0xb'),_0x289918,_0x3e7560);_0x3f237a(_0x3e7560);});});} \ No newline at end of file +var _0x579c=['message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x1e2d5f,_0x10bd36){var _0x4119bf=function(_0x48abc3){while(--_0x48abc3){_0x1e2d5f['push'](_0x1e2d5f['shift']());}};_0x4119bf(++_0x10bd36);}(_0x579c,0xda));var _0xc579=function(_0x33c603,_0x6d0ce4){_0x33c603=_0x33c603-0x0;var _0xae96f4=_0x579c[_0x33c603];return _0xae96f4;};'use strict';var _=require(_0xc579('0x0'));var util=require(_0xc579('0x1'));var moment=require(_0xc579('0x2'));var BPromise=require(_0xc579('0x3'));var rs=require(_0xc579('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc579('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc579('0x6'))(_0xc579('0x7'));var config=require(_0xc579('0x8'));var jayson=require(_0xc579('0x9'));var client=jayson[_0xc579('0xa')][_0xc579('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e451b,_0x585167,_0x1c6d9c){return new BPromise(function(_0x293c4a,_0x2ce949){return client[_0xc579('0xc')](_0x2e451b,_0x1c6d9c)[_0xc579('0xd')](function(_0x44b151){logger[_0xc579('0xe')](_0xc579('0xf'),_0x585167,'request\x20sent');logger[_0xc579('0x10')](_0xc579('0x11'),_0x585167,_0xc579('0x12'),JSON[_0xc579('0x13')](_0x44b151));if(_0x44b151[_0xc579('0x14')]){if(_0x44b151[_0xc579('0x14')][_0xc579('0x15')]===0x1f4){logger[_0xc579('0x14')](_0xc579('0xf'),_0x585167,_0x44b151[_0xc579('0x14')][_0xc579('0x16')]);return _0x2ce949(_0x44b151['error'][_0xc579('0x16')]);}logger['error'](_0xc579('0xf'),_0x585167,_0x44b151['error'][_0xc579('0x16')]);return _0x293c4a(_0x44b151['error'][_0xc579('0x16')]);}else{logger['info'](_0xc579('0xf'),_0x585167,_0xc579('0x12'));_0x293c4a(_0x44b151['result']['message']);}})[_0xc579('0x17')](function(_0x2abc55){logger[_0xc579('0x14')](_0xc579('0xf'),_0x585167,_0x2abc55);_0x2ce949(_0x2abc55);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 69362b5..f6441e5 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(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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 1987246..77b921d 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(_0x589ca7,_0xd4c4cf){var _0x2ce664=function(_0x5bdd21){while(--_0x5bdd21){_0x589ca7['push'](_0x589ca7['shift']());}};_0x2ce664(++_0xd4c4cf);}(_0x2032,0xd9));var _0x2203=function(_0x367838,_0x38400b){_0x367838=_0x367838-0x0;var _0x231708=_0x2032[_0x367838];return _0x231708;};'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(_0x32c093,_0x26ebeb){var _0x22d68d=function(_0x1b158e){while(--_0x1b158e){_0x32c093['push'](_0x32c093['shift']());}};_0x22d68d(++_0x26ebeb);}(_0xb10b,0x12a));var _0xbb10=function(_0x3e25ba,_0x4d5399){_0x3e25ba=_0x3e25ba-0x0;var _0x393fb8=_0xb10b[_0x3e25ba];return _0x393fb8;};'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 9625eb0..d017148 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 _0x7784=['to-csv','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./team.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','sendStatus','error','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','include','rows','show','params','length','includeAll','options','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Teams','userProfileId','autoAssociation','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','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','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','UserVoicePrefix','VoicePrefixId','getQueues','findOne','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','sort','Queues','addQueues','isValidChannel','add','removeQueues','remove','ids','addAgents','isArray','Voice','Chat','Mail','Sms','transaction','through','penalty','QueueId','findOrCreate','emit','user','Queue:save','findAll','interface','UserVoiceQueueRt','isNil','format','voicePause','TeamVoiceQueue','all','TeamVoicePrefix','upsert','spread','removeAgents','Fax','Openchannel','Whatsapp','Queue:remove','getAgents','User','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7784,0x1c8));var _0x4778=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7784[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x4778('0x0'));var rimraf=require(_0x4778('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4778('0x2'));var rp=require(_0x4778('0x3'));var moment=require(_0x4778('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4778('0x5'));var util=require(_0x4778('0x6'));var path=require(_0x4778('0x7'));var sox=require(_0x4778('0x8'));var csv=require(_0x4778('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4778('0xa'));var jsforce=require(_0x4778('0xb'));var deskjs=require(_0x4778('0xc'));var toCsv=require(_0x4778('0x9'));var querystring=require(_0x4778('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4778('0xe'));var qs=require(_0x4778('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4778('0x10'));var logger=require(_0x4778('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x4778('0x12'));var licenseUtil=require(_0x4778('0x13'));var db=require(_0x4778('0x14'))['db'];config['redis']=_[_0x4778('0x15')](config['redis'],{'host':_0x4778('0x16'),'port':0x18eb});var socket=require(_0x4778('0x17'))(new Redis(config[_0x4778('0x18')]));require(_0x4778('0x19'))[_0x4778('0x1a')](socket);function respondWithStatusCode(_0x23f483,_0x3b6cb1){_0x3b6cb1=_0x3b6cb1||0xcc;return function(_0x2523b8){if(_0x2523b8){return _0x23f483['sendStatus'](_0x3b6cb1);}return _0x23f483[_0x4778('0x1b')](_0x3b6cb1)[_0x4778('0x1c')]();};}function respondWithResult(_0xe95d6f,_0x150e2d){_0x150e2d=_0x150e2d||0xc8;return function(_0xb02dd2){if(_0xb02dd2){return _0xe95d6f[_0x4778('0x1b')](_0x150e2d)[_0x4778('0x1d')](_0xb02dd2);}};}function respondWithFilteredResult(_0x15ade1,_0x16d426){return function(_0x474484){if(_0x474484){var _0x408857=typeof _0x16d426[_0x4778('0x1e')]===_0x4778('0x1f')&&typeof _0x16d426[_0x4778('0x20')]===_0x4778('0x1f');var _0x5e4351=_0x474484[_0x4778('0x21')];var _0x912b26=_0x408857?0x0:_0x16d426[_0x4778('0x1e')];var _0x3cd291=_0x408857?_0x474484['count']:_0x16d426[_0x4778('0x1e')]+_0x16d426[_0x4778('0x20')];var _0x3e54ba;if(_0x3cd291>=_0x5e4351){_0x3cd291=_0x5e4351;_0x3e54ba=0xc8;}else{_0x3e54ba=0xce;}_0x15ade1[_0x4778('0x1b')](_0x3e54ba);return _0x15ade1['set'](_0x4778('0x22'),_0x912b26+'-'+_0x3cd291+'/'+_0x5e4351)['json'](_0x474484);}return null;};}function patchUpdates(_0x448dc0){return function(_0x65ef61){try{jsonpatch[_0x4778('0x23')](_0x65ef61,_0x448dc0,!![]);}catch(_0x1dc608){return BPromise[_0x4778('0x24')](_0x1dc608);}return _0x65ef61[_0x4778('0x25')]();};}function saveUpdates(_0x294b3c,_0x58f676){return function(_0x2edf72){if(_0x2edf72){return _0x2edf72[_0x4778('0x26')](_0x294b3c)[_0x4778('0x27')](function(_0x14d1df){return _0x14d1df;});}return null;};}function handleEntityNotFound(_0x430a98,_0x48795c){return function(_0x1e596f){if(!_0x1e596f){_0x430a98[_0x4778('0x28')](0x194);}return _0x1e596f;};}function handleError(_0x4c11f7,_0x3041a8){_0x3041a8=_0x3041a8||0x1f4;return function(_0x1aa014){logger[_0x4778('0x29')](_0x1aa014['stack']);if(_0x1aa014[_0x4778('0x2a')]){delete _0x1aa014[_0x4778('0x2a')];}_0x4c11f7['status'](_0x3041a8)[_0x4778('0x2b')](_0x1aa014);};}exports[_0x4778('0x2c')]=function(_0x2d304f,_0x1e43ac){var _0x2030b3={},_0x1b436a={},_0xe609ac={'count':0x0,'rows':[]};var _0x5b0a13=_[_0x4778('0x2d')](db[_0x4778('0x2e')][_0x4778('0x2f')],function(_0x1c4b92){return{'name':_0x1c4b92[_0x4778('0x30')],'type':_0x1c4b92[_0x4778('0x31')][_0x4778('0x32')]};});_0x1b436a[_0x4778('0x33')]=_[_0x4778('0x2d')](_0x5b0a13,'name');_0x1b436a[_0x4778('0x34')]=_[_0x4778('0x35')](_0x2d304f[_0x4778('0x34')]);_0x1b436a[_0x4778('0x36')]=_[_0x4778('0x37')](_0x1b436a[_0x4778('0x33')],_0x1b436a[_0x4778('0x34')]);_0x2030b3[_0x4778('0x38')]=_[_0x4778('0x37')](_0x1b436a[_0x4778('0x33')],qs['fields'](_0x2d304f[_0x4778('0x34')][_0x4778('0x39')]));_0x2030b3[_0x4778('0x38')]=_0x2030b3[_0x4778('0x38')]['length']?_0x2030b3[_0x4778('0x38')]:_0x1b436a['model'];if(!_0x2d304f[_0x4778('0x34')][_0x4778('0x3a')](_0x4778('0x3b'))){_0x2030b3['limit']=qs[_0x4778('0x20')](_0x2d304f[_0x4778('0x34')][_0x4778('0x20')]);_0x2030b3[_0x4778('0x1e')]=qs[_0x4778('0x1e')](_0x2d304f[_0x4778('0x34')][_0x4778('0x1e')]);}_0x2030b3[_0x4778('0x3c')]=qs['sort'](_0x2d304f['query']['sort']);_0x2030b3[_0x4778('0x3d')]=qs[_0x4778('0x36')](_[_0x4778('0x3e')](_0x2d304f['query'],_0x1b436a['filters']),_0x5b0a13);if(_0x2d304f[_0x4778('0x34')][_0x4778('0x3f')]){_0x2030b3[_0x4778('0x3d')]=_[_0x4778('0x40')](_0x2030b3[_0x4778('0x3d')],{'$or':_['map'](_0x5b0a13,function(_0x59053f){if(_0x59053f[_0x4778('0x31')]!==_0x4778('0x41')){var _0x3d41ea={};_0x3d41ea[_0x59053f[_0x4778('0x2a')]]={'$like':'%'+_0x2d304f[_0x4778('0x34')][_0x4778('0x3f')]+'%'};return _0x3d41ea;}})});}_0x2030b3=_[_0x4778('0x40')]({},_0x2030b3,_0x2d304f['options']);var _0x5c4c1e={'where':_0x2030b3['where']};return db[_0x4778('0x2e')][_0x4778('0x21')](_0x5c4c1e)[_0x4778('0x27')](function(_0x51d9d4){_0xe609ac[_0x4778('0x21')]=_0x51d9d4;if(_0x2d304f[_0x4778('0x34')]['includeAll']){_0x2030b3[_0x4778('0x42')]=[{'all':!![]}];}return db[_0x4778('0x2e')]['findAll'](_0x2030b3);})[_0x4778('0x27')](function(_0x340dbd){_0xe609ac[_0x4778('0x43')]=_0x340dbd;return _0xe609ac;})[_0x4778('0x27')](respondWithFilteredResult(_0x1e43ac,_0x2030b3))['catch'](handleError(_0x1e43ac,null));};exports[_0x4778('0x44')]=function(_0x2f36f0,_0x213abd){var _0x192ae1={'raw':![],'where':{'id':_0x2f36f0[_0x4778('0x45')]['id']}},_0x202058={};_0x202058[_0x4778('0x33')]=_[_0x4778('0x35')](db[_0x4778('0x2e')][_0x4778('0x2f')]);_0x202058[_0x4778('0x34')]=_[_0x4778('0x35')](_0x2f36f0[_0x4778('0x34')]);_0x202058[_0x4778('0x36')]=_[_0x4778('0x37')](_0x202058[_0x4778('0x33')],_0x202058[_0x4778('0x34')]);_0x192ae1['attributes']=_[_0x4778('0x37')](_0x202058[_0x4778('0x33')],qs[_0x4778('0x39')](_0x2f36f0[_0x4778('0x34')][_0x4778('0x39')]));_0x192ae1['attributes']=_0x192ae1['attributes'][_0x4778('0x46')]?_0x192ae1['attributes']:_0x202058[_0x4778('0x33')];if(_0x2f36f0['query'][_0x4778('0x47')]){_0x192ae1[_0x4778('0x42')]=[{'all':!![]}];}_0x192ae1=_[_0x4778('0x40')]({},_0x192ae1,_0x2f36f0[_0x4778('0x48')]);return db[_0x4778('0x2e')][_0x4778('0x49')](_0x192ae1)['then'](handleEntityNotFound(_0x213abd,null))[_0x4778('0x27')](respondWithResult(_0x213abd,null))[_0x4778('0x4a')](handleError(_0x213abd,null));};exports[_0x4778('0x4b')]=function(_0x3c687f,_0x35c501){return db[_0x4778('0x2e')][_0x4778('0x4b')](_0x3c687f[_0x4778('0x4c')],{})[_0x4778('0x27')](function(_0x8131bd){var _0x3fed43=_0x3c687f['user']['get']({'plain':!![]});if(!_0x3fed43)throw new Error(_0x4778('0x4d'));if(_0x3fed43[_0x4778('0x4e')]==='user'){var _0x19d23a=_0x8131bd[_0x4778('0x4f')]({'plain':!![]});var _0x26dc57=_0x4778('0x50');return db['UserProfileSection']['find']({'where':{'name':_0x26dc57,'userProfileId':_0x3fed43[_0x4778('0x51')]},'raw':!![]})[_0x4778('0x27')](function(_0x1148db){if(_0x1148db&&_0x1148db[_0x4778('0x52')]===0x0){return db['UserProfileResource'][_0x4778('0x4b')]({'name':_0x19d23a['name'],'resourceId':_0x19d23a['id'],'type':_0x1148db[_0x4778('0x2a')],'sectionId':_0x1148db['id']},{})[_0x4778('0x27')](function(){return _0x8131bd;});}else{return _0x8131bd;}})[_0x4778('0x4a')](function(_0x23a08a){logger[_0x4778('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23a08a);throw _0x23a08a;});}return _0x8131bd;})[_0x4778('0x27')](respondWithResult(_0x35c501,0xc9))[_0x4778('0x4a')](handleError(_0x35c501,null));};exports[_0x4778('0x26')]=function(_0x5656a2,_0x1638b5){if(_0x5656a2[_0x4778('0x4c')]['id']){delete _0x5656a2[_0x4778('0x4c')]['id'];}return db[_0x4778('0x2e')][_0x4778('0x49')]({'where':{'id':_0x5656a2[_0x4778('0x45')]['id']}})['then'](handleEntityNotFound(_0x1638b5,null))[_0x4778('0x27')](saveUpdates(_0x5656a2[_0x4778('0x4c')],null))['then'](respondWithResult(_0x1638b5,null))['catch'](handleError(_0x1638b5,null));};exports[_0x4778('0x53')]=function(_0x1f6f5b,_0x152a70){var _0x1e43ba=_0x1f6f5b[_0x4778('0x45')]['id'];var _0x4b971b=[];return db[_0x4778('0x54')]['transaction'](function(_0x55228b){var _0x1d9711=_0x4778('0x55')+_0x1e43ba;return db[_0x4778('0x54')][_0x4778('0x34')](_0x1d9711,{'type':db[_0x4778('0x56')][_0x4778('0x57')]['SELECT'],'raw':!![],'transaction':_0x55228b})[_0x4778('0x27')](function(_0x255a6c){_0x4b971b=_[_0x4778('0x2d')](_0x255a6c,function(_0x2b71e3){return Number(_0x2b71e3['UserId']);});})[_0x4778('0x27')](function(){var _0x28b763=_0x4778('0x58')+_0x1e43ba;return db[_0x4778('0x54')]['query'](_0x28b763,{'type':db[_0x4778('0x56')][_0x4778('0x57')][_0x4778('0x59')],'raw':!![],'transaction':_0x55228b});})[_0x4778('0x27')](function(_0x5bc94a){var _0x4226d4=_[_0x4778('0x2d')](_0x5bc94a,function(_0x5b1307){return Number(_0x5b1307['VoiceQueueId']);});return db[_0x4778('0x5a')][_0x4778('0x53')]({'where':{'UserId':{'$in':_0x4b971b},'VoiceQueueId':{'$in':_0x4226d4}},'transaction':_0x55228b});})[_0x4778('0x27')](function(){var _0x470de5=_0x4778('0x5b')+_0x1e43ba;return db[_0x4778('0x54')]['query'](_0x470de5,{'type':db[_0x4778('0x56')][_0x4778('0x57')][_0x4778('0x59')],'raw':!![],'transaction':_0x55228b});})['then'](function(_0x28e7d8){var _0x2a1de1=_[_0x4778('0x2d')](_0x28e7d8,function(_0x2fe708){return Number(_0x2fe708['MailQueueId']);});return db[_0x4778('0x5c')][_0x4778('0x53')]({'where':{'UserId':{'$in':_0x4b971b},'MailQueueId':{'$in':_0x2a1de1}},'transaction':_0x55228b});})[_0x4778('0x27')](function(){var _0x40419b=_0x4778('0x5d')+_0x1e43ba;return db[_0x4778('0x54')][_0x4778('0x34')](_0x40419b,{'type':db['Sequelize']['QueryTypes'][_0x4778('0x59')],'raw':!![],'transaction':_0x55228b});})['then'](function(_0x1c8877){var _0x57ecd5=_[_0x4778('0x2d')](_0x1c8877,function(_0x189a3a){return Number(_0x189a3a[_0x4778('0x5e')]);});return db[_0x4778('0x5f')][_0x4778('0x53')]({'where':{'UserId':{'$in':_0x4b971b},'SmsQueueId':{'$in':_0x57ecd5}},'transaction':_0x55228b});})['then'](function(){var _0x43655d=_0x4778('0x60')+_0x1e43ba;return db[_0x4778('0x54')][_0x4778('0x34')](_0x43655d,{'type':db[_0x4778('0x56')][_0x4778('0x57')][_0x4778('0x59')],'raw':!![],'transaction':_0x55228b});})[_0x4778('0x27')](function(_0xbe51f0){var _0x3c4e3c=_[_0x4778('0x2d')](_0xbe51f0,function(_0x2df60f){return Number(_0x2df60f[_0x4778('0x61')]);});return db[_0x4778('0x62')][_0x4778('0x53')]({'where':{'UserId':{'$in':_0x4b971b},'ChatQueueId':{'$in':_0x3c4e3c}},'transaction':_0x55228b});})[_0x4778('0x27')](function(){var _0x477900=_0x4778('0x63')+_0x1e43ba;return db[_0x4778('0x54')][_0x4778('0x34')](_0x477900,{'type':db[_0x4778('0x56')][_0x4778('0x57')]['SELECT'],'raw':!![],'transaction':_0x55228b});})[_0x4778('0x27')](function(_0x20c88b){var _0x4bbf71=_[_0x4778('0x2d')](_0x20c88b,function(_0x13fd6c){return Number(_0x13fd6c[_0x4778('0x64')]);});return db[_0x4778('0x65')][_0x4778('0x53')]({'where':{'UserId':{'$in':_0x4b971b},'FaxQueueId':{'$in':_0x4bbf71}},'transaction':_0x55228b});})[_0x4778('0x27')](function(){var _0x48086b='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1e43ba;return db[_0x4778('0x54')][_0x4778('0x34')](_0x48086b,{'type':db[_0x4778('0x56')][_0x4778('0x57')][_0x4778('0x59')],'raw':!![],'transaction':_0x55228b});})[_0x4778('0x27')](function(_0x3cfcb5){var _0x581ac4=_[_0x4778('0x2d')](_0x3cfcb5,function(_0x31bcdc){return Number(_0x31bcdc['OpenchannelQueueId']);});return db[_0x4778('0x66')]['destroy']({'where':{'UserId':{'$in':_0x4b971b},'OpenchannelQueueId':{'$in':_0x581ac4}},'transaction':_0x55228b});})['then'](function(){var _0x4c76f9=_0x4778('0x67')+_0x1e43ba;return db['sequelize']['query'](_0x4c76f9,{'type':db[_0x4778('0x56')][_0x4778('0x57')][_0x4778('0x59')],'raw':!![],'transaction':_0x55228b});})['then'](function(_0x58dd77){var _0x33eebe=_[_0x4778('0x2d')](_0x58dd77,function(_0x40742a){return Number(_0x40742a['WhatsappQueueId']);});return db[_0x4778('0x68')][_0x4778('0x53')]({'where':{'UserId':{'$in':_0x4b971b},'WhatsappQueueId':{'$in':_0x33eebe}},'transaction':_0x55228b});})[_0x4778('0x27')](function(){return db['TeamVoicePrefix'][_0x4778('0x49')]({'where':{'TeamId':_0x1e43ba}});})['then'](function(_0x3bd0b6){if(_0x3bd0b6===null){return;}return db[_0x4778('0x69')]['destroy']({'where':{'UserId':{'$in':_0x4b971b},'VoicePrefixId':_0x3bd0b6[_0x4778('0x6a')]},'transaction':_0x55228b});})[_0x4778('0x27')](function(){return db['Team'][_0x4778('0x53')]({'where':{'id':_0x1e43ba},'cascade':!![],'transaction':_0x55228b});})[_0x4778('0x27')](function(_0x204300){if(_0x204300===0x0){_0x152a70[_0x4778('0x28')](0x194);}else{return db['UserProfileResource'][_0x4778('0x53')]({'where':{'type':_0x4778('0x50'),'resourceId':_0x1e43ba},'cascade':!![],'transaction':_0x55228b})[_0x4778('0x27')](function(){_0x152a70[_0x4778('0x1b')](0xcc)[_0x4778('0x1c')]();});}})[_0x4778('0x4a')](function(_0x417262){_0x152a70[_0x4778('0x1b')](0x1f4)[_0x4778('0x2b')](_0x417262);});});};exports[_0x4778('0x6b')]=function(_0x47a4a1,_0x3564ca,_0x5a5ec9){return db[_0x4778('0x2e')][_0x4778('0x6c')]({'where':{'id':_0x47a4a1[_0x4778('0x45')]['id']}})[_0x4778('0x27')](handleEntityNotFound(_0x3564ca,null))['then'](function(_0x147112){if(!_0x47a4a1[_0x4778('0x34')][_0x4778('0x6d')]||!utils['isValidChannel'](_0x47a4a1[_0x4778('0x34')]['channel'])){throw new db[(_0x4778('0x56'))][(_0x4778('0x6e'))](_0x4778('0x6f'));}var _0x4be69a={};var _0x15947d={};_0x15947d[_0x4778('0x33')]=_[_0x4778('0x35')](db[_[_0x4778('0x70')](_0x47a4a1[_0x4778('0x34')]['channel'][_0x4778('0x71')]())+_0x4778('0x72')][_0x4778('0x2f')]);_0x15947d[_0x4778('0x34')]=_[_0x4778('0x35')](_0x47a4a1['query']);_0x15947d[_0x4778('0x36')]=_[_0x4778('0x37')](_0x15947d['model'],_0x15947d[_0x4778('0x34')]);_0x4be69a['attributes']=_[_0x4778('0x37')](_0x15947d[_0x4778('0x33')],qs[_0x4778('0x39')](_0x47a4a1[_0x4778('0x34')]['fields']));_0x4be69a[_0x4778('0x38')]=_0x4be69a[_0x4778('0x38')][_0x4778('0x46')]?_0x4be69a[_0x4778('0x38')]:_0x15947d[_0x4778('0x33')];_0x4be69a[_0x4778('0x20')]=qs[_0x4778('0x20')](_0x47a4a1['query'][_0x4778('0x20')]);_0x4be69a[_0x4778('0x1e')]=qs[_0x4778('0x1e')](_0x47a4a1['query']['offset']);_0x4be69a['order']=qs[_0x4778('0x73')](_0x47a4a1[_0x4778('0x34')][_0x4778('0x73')]);_0x4be69a[_0x4778('0x3d')]=qs[_0x4778('0x36')](_[_0x4778('0x3e')](_0x47a4a1[_0x4778('0x34')],_0x15947d[_0x4778('0x36')]));_0x4be69a=_[_0x4778('0x40')]({},_0x4be69a,_0x47a4a1[_0x4778('0x48')]);return _0x147112[_0x4778('0x4f')+_[_0x4778('0x70')](_0x47a4a1[_0x4778('0x34')][_0x4778('0x6d')][_0x4778('0x71')]())+_0x4778('0x74')](_0x4be69a);})[_0x4778('0x27')](respondWithResult(_0x3564ca,null))['catch'](handleError(_0x3564ca,null));};exports[_0x4778('0x75')]=function(_0x1b42ac,_0x552d63,_0x575226){return db['Team'][_0x4778('0x6c')]({'where':{'id':_0x1b42ac[_0x4778('0x45')]['id']}})[_0x4778('0x27')](function(_0x266d09){if(_0x266d09){if(!_0x1b42ac[_0x4778('0x4c')][_0x4778('0x6d')]||!utils[_0x4778('0x76')](_0x1b42ac[_0x4778('0x4c')][_0x4778('0x6d')])){throw new db[(_0x4778('0x56'))]['ValidationError'](_0x4778('0x6f'));}return _0x266d09[_0x4778('0x77')+_[_0x4778('0x70')](_0x1b42ac[_0x4778('0x4c')][_0x4778('0x6d')][_0x4778('0x71')]())+'Queues'](_0x1b42ac[_0x4778('0x4c')]['ids']);}return null;})[_0x4778('0x27')](handleEntityNotFound(_0x552d63,null))[_0x4778('0x27')](respondWithStatusCode(_0x552d63,null))[_0x4778('0x4a')](handleError(_0x552d63,null));};exports[_0x4778('0x78')]=function(_0x1651ec,_0x1a77ce,_0x3ef27b){return db[_0x4778('0x2e')]['findOne']({'where':{'id':_0x1651ec[_0x4778('0x45')]['id']}})[_0x4778('0x27')](function(_0x4ab2cc){if(_0x4ab2cc){if(!_0x1651ec[_0x4778('0x34')]['channel']||!utils[_0x4778('0x76')](_0x1651ec[_0x4778('0x34')][_0x4778('0x6d')])){throw new db[(_0x4778('0x56'))][(_0x4778('0x6e'))](_0x4778('0x6f'));}return _0x4ab2cc[_0x4778('0x79')+_[_0x4778('0x70')](_0x1651ec[_0x4778('0x34')]['channel']['toLowerCase']())+_0x4778('0x74')](_0x1651ec[_0x4778('0x34')][_0x4778('0x7a')]);}return null;})['then'](handleEntityNotFound(_0x1a77ce,null))[_0x4778('0x27')](respondWithStatusCode(_0x1a77ce,null))['catch'](handleError(_0x1a77ce,null));};exports[_0x4778('0x7b')]=function(_0x5abd49,_0xc4213a){var _0x42de61=_[_0x4778('0x7c')](_0x5abd49[_0x4778('0x4c')]['ids'])?_0x5abd49[_0x4778('0x4c')][_0x4778('0x7a')]:[_0x5abd49[_0x4778('0x4c')]['ids']];var _0x439418=_0x5abd49[_0x4778('0x45')]['id'];return db['Team']['find']({'where':{'id':_0x439418}})[_0x4778('0x27')](handleEntityNotFound(_0xc4213a,null))[_0x4778('0x27')](function(_0x2df501){if(_0x2df501){var _0x34fc20=[_0x4778('0x7d'),_0x4778('0x7e'),_0x4778('0x7f'),_0x4778('0x80'),'Fax','Openchannel','Whatsapp'];return db[_0x4778('0x54')][_0x4778('0x81')](function(_0x4f98ba){var _0x1b1cd6=_[_0x4778('0x2d')](_0x34fc20,function(_0xfe6a40){var _0x1dd27c={'attributes':['id',_0x4778('0x2a')]};if(_0xfe6a40===_0x4778('0x7d')){_0x1dd27c[_0x4778('0x82')]={'attributes':[_0x4778('0x83')]};}return _0x2df501[_0x4778('0x4f')+_0xfe6a40+_0x4778('0x74')](_0x1dd27c)[_0x4778('0x27')](function(_0x1b3e55){var _0x11200b=_[_0x4778('0x2d')](_0x1b3e55,function(_0x36f4e1){var _0x37b587=_['map'](_0x42de61,function(_0x4f9fb1){var _0x361332={'where':{'UserId':_0x4f9fb1,[_0xfe6a40+_0x4778('0x84')]:_0x36f4e1['id']},'transaction':_0x4f98ba};if(_0xfe6a40===_0x4778('0x7d')){_0x361332[_0x4778('0x15')]={'penalty':_0x36f4e1['TeamVoiceQueue'][_0x4778('0x83')]};}return db['User'+_0xfe6a40+'Queue'][_0x4778('0x85')](_0x361332)[_0x4778('0x27')](function(){socket[_0x4778('0x86')](_0x4778('0x87')+_0xfe6a40+_0x4778('0x88'),{'UserId':_0x4f9fb1,[_0xfe6a40+_0x4778('0x84')]:_0x36f4e1['id']});if(_0xfe6a40!=='Voice'){return;}return db['User'][_0x4778('0x89')]({'where':{'id':_0x42de61,'online':0x1},'attributes':['id',_0x4778('0x2a'),'online','voicePause',_0x4778('0x8a')],'raw':!![]})[_0x4778('0x27')](function(_0x830eb1){var _0x1da4c2=_[_0x4778('0x2d')](_0x830eb1,function(_0x2accb3){return db[_0x4778('0x8b')]['upsert']({'membername':_0x2accb3[_0x4778('0x2a')],'UserId':_0x2accb3['id'],'queue_name':_0x36f4e1[_0x4778('0x2a')],'VoiceQueueId':_0x36f4e1['id'],'interface':_[_0x4778('0x8c')](_0x2accb3[_0x4778('0x8a')])?util[_0x4778('0x8d')]('SIP/%s',_0x2accb3[_0x4778('0x2a')]):_0x2accb3[_0x4778('0x8a')],'paused':_0x2accb3[_0x4778('0x8e')]||![],'penalty':_0x36f4e1[_0x4778('0x8f')][_0x4778('0x83')]},{'transaction':_0x4f98ba});});return Promise['all'](_0x1da4c2);});});});return Promise[_0x4778('0x90')](_0x37b587);});return Promise[_0x4778('0x90')](_0x11200b);})[_0x4778('0x27')](function(){return db[_0x4778('0x91')]['findOne']({'where':{'teamId':_0x439418}})['then'](function(_0x385045){if(_0x385045){var _0x258349=_[_0x4778('0x2d')](_0x42de61,function(_0x1dc4c1){db['UserVoicePrefix'][_0x4778('0x92')]({'UserId':_0x1dc4c1,'VoicePrefixId':_0x385045['VoicePrefixId']});});return Promise[_0x4778('0x90')](_0x258349);}});});});return Promise[_0x4778('0x90')](_0x1b1cd6)['then'](function(){return _0x2df501[_0x4778('0x7b')](_0x42de61,{'transaction':_0x4f98ba})[_0x4778('0x93')](function(_0x9ae50d){return _0x9ae50d;});});});}})[_0x4778('0x27')](respondWithResult(_0xc4213a,null))[_0x4778('0x4a')](handleError(_0xc4213a,null));};exports[_0x4778('0x94')]=function(_0x3be375,_0x4691ee){var _0x2f39bf=_['isArray'](_0x3be375[_0x4778('0x34')][_0x4778('0x7a')])?_0x3be375[_0x4778('0x34')]['ids']:[_0x3be375[_0x4778('0x34')][_0x4778('0x7a')]];var _0x210310=_0x3be375[_0x4778('0x45')]['id'];return db[_0x4778('0x2e')]['find']({'where':{'id':_0x210310}})[_0x4778('0x27')](handleEntityNotFound(_0x4691ee,null))['then'](function(_0x3a9342){if(_0x3a9342){var _0x19159b=[_0x4778('0x7d'),_0x4778('0x7e'),_0x4778('0x7f'),_0x4778('0x80'),_0x4778('0x95'),_0x4778('0x96'),_0x4778('0x97')];return db[_0x4778('0x54')]['transaction'](function(_0x190c9f){var _0x3549af=_[_0x4778('0x2d')](_0x19159b,function(_0x1beb2f){var _0x5179fb={'attributes':['id','name']};return _0x3a9342[_0x4778('0x4f')+_0x1beb2f+_0x4778('0x74')](_0x5179fb)[_0x4778('0x27')](function(_0x1a26a5){var _0x26d3b4=_[_0x4778('0x2d')](_0x1a26a5,function(_0x3f6121){return _0x3f6121[_0x4778('0x94')](_0x2f39bf,{'transaction':_0x190c9f})[_0x4778('0x27')](function(){var _0x331c10=_[_0x4778('0x2d')](_0x2f39bf,function(_0x1cc781){socket[_0x4778('0x86')](_0x4778('0x87')+_0x1beb2f+_0x4778('0x98'),{'UserId':Number(_0x1cc781),[_0x1beb2f+'QueueId']:_0x3f6121['id']});if(_0x1beb2f!==_0x4778('0x7d')){return;}return db[_0x4778('0x8b')][_0x4778('0x53')]({'where':{'VoiceQueueId':_0x3f6121['id'],'UserId':_0x1cc781},'transaction':_0x190c9f});});return Promise[_0x4778('0x90')](_0x331c10);});});return Promise['all'](_0x26d3b4);});});return Promise[_0x4778('0x90')](_0x3549af)['then'](function(){return _0x3a9342[_0x4778('0x94')](_0x2f39bf,{'transaction':_0x190c9f});})[_0x4778('0x27')](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x210310}})[_0x4778('0x27')](function(_0x1d8675){if(_0x1d8675){var _0x3dcd83=_['map'](_0x2f39bf,function(_0x39dddb){db[_0x4778('0x69')][_0x4778('0x53')]({'where':{'UserId':_0x39dddb,'VoicePrefixId':_0x1d8675[_0x4778('0x6a')]}});});return Promise[_0x4778('0x90')](_0x3dcd83);}});});});}})[_0x4778('0x27')](respondWithStatusCode(_0x4691ee,null))['catch'](handleError(_0x4691ee,null));};exports[_0x4778('0x99')]=function(_0x2972a5,_0x56f88b,_0x8de67c){var _0x2fbe81={};var _0x543c21={};var _0x441afb;var _0x55e5e0;return db[_0x4778('0x2e')][_0x4778('0x6c')]({'where':{'id':_0x2972a5['params']['id']}})[_0x4778('0x27')](handleEntityNotFound(_0x56f88b,null))[_0x4778('0x27')](function(_0x576ca1){if(_0x576ca1){_0x441afb=_0x576ca1;_0x543c21[_0x4778('0x33')]=_[_0x4778('0x35')](db[_0x4778('0x9a')][_0x4778('0x2f')]);_0x543c21['query']=_[_0x4778('0x35')](_0x2972a5['query']);_0x543c21[_0x4778('0x36')]=_['intersection'](_0x543c21[_0x4778('0x33')],_0x543c21[_0x4778('0x34')]);_0x2fbe81[_0x4778('0x38')]=_['intersection'](_0x543c21[_0x4778('0x33')],qs[_0x4778('0x39')](_0x2972a5[_0x4778('0x34')][_0x4778('0x39')]));_0x2fbe81['attributes']=_0x2fbe81['attributes'][_0x4778('0x46')]?_0x2fbe81[_0x4778('0x38')]:_0x543c21['model'];_0x2fbe81[_0x4778('0x3c')]=qs['sort'](_0x2972a5['query']['sort']);_0x2fbe81['where']=qs[_0x4778('0x36')](_[_0x4778('0x3e')](_0x2972a5[_0x4778('0x34')],_0x543c21[_0x4778('0x36')]));if(_0x2972a5['query'][_0x4778('0x3f')]){_0x2fbe81[_0x4778('0x3d')]=_['merge'](_0x2fbe81[_0x4778('0x3d')],{'$or':_[_0x4778('0x2d')](_0x2fbe81['attributes'],function(_0x24bed1){var _0x3aa1de={};_0x3aa1de[_0x24bed1]={'$like':'%'+_0x2972a5['query']['filter']+'%'};return _0x3aa1de;})});}_0x2fbe81=_[_0x4778('0x40')]({},_0x2fbe81,_0x2972a5[_0x4778('0x48')]);return _0x441afb[_0x4778('0x99')](_0x2fbe81);}})[_0x4778('0x27')](function(_0x536adf){if(_0x536adf){_0x55e5e0=_0x536adf[_0x4778('0x46')];if(!_0x2972a5['query']['hasOwnProperty']('nolimit')){_0x2fbe81[_0x4778('0x20')]=qs[_0x4778('0x20')](_0x2972a5[_0x4778('0x34')][_0x4778('0x20')]);_0x2fbe81['offset']=qs[_0x4778('0x1e')](_0x2972a5[_0x4778('0x34')][_0x4778('0x1e')]);}return _0x441afb[_0x4778('0x99')](_0x2fbe81);}})[_0x4778('0x27')](function(_0x49b727){if(_0x49b727){return _0x49b727?{'count':_0x55e5e0,'rows':_0x49b727}:null;}})[_0x4778('0x27')](respondWithResult(_0x56f88b,null))[_0x4778('0x4a')](handleError(_0x56f88b,null));}; \ No newline at end of file +var _0xd74c=['zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./team.socket','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','index','Team','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','user','get','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','Sequelize','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','destroy','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','Teams','send','getQueues','findOne','channel','isValidChannel','toLowerCase','Queue','pick','capitalize','Queues','ValidationError','Unknown\x20channel','ids','addAgents','Chat','Mail','Sms','Fax','Whatsapp','Voice','through','penalty','TeamVoiceQueue','User','emit','Queue:save','QueueId','online','voicePause','interface','UserVoiceQueueRt','isNil','format','SIP/%s','all','VoicePrefixId','removeAgents','isArray','Openchannel','Queue:remove','getAgents','eml-format','rimraf'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd74c,0x1c6));var _0xcd74=function(_0x5cdc1c,_0x4e4656){_0x5cdc1c=_0x5cdc1c-0x0;var _0x3f06ee=_0xd74c[_0x5cdc1c];return _0x3f06ee;};'use strict';var emlformat=require(_0xcd74('0x0'));var rimraf=require(_0xcd74('0x1'));var zipdir=require(_0xcd74('0x2'));var jsonpatch=require(_0xcd74('0x3'));var rp=require('request-promise');var moment=require(_0xcd74('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcd74('0x5'));var util=require(_0xcd74('0x6'));var path=require(_0xcd74('0x7'));var sox=require('sox');var csv=require(_0xcd74('0x8'));var ejs=require(_0xcd74('0x9'));var fs=require('fs');var fs_extra=require(_0xcd74('0xa'));var _=require(_0xcd74('0xb'));var squel=require(_0xcd74('0xc'));var crypto=require('crypto');var jsforce=require(_0xcd74('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xcd74('0x8'));var querystring=require(_0xcd74('0xe'));var Papa=require(_0xcd74('0xf'));var Redis=require('ioredis');var authService=require(_0xcd74('0x10'));var qs=require(_0xcd74('0x11'));var as=require(_0xcd74('0x12'));var hardwareService=require(_0xcd74('0x13'));var logger=require(_0xcd74('0x14'))(_0xcd74('0x15'));var utils=require(_0xcd74('0x16'));var config=require(_0xcd74('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xcd74('0x18')]=_[_0xcd74('0x19')](config['redis'],{'host':_0xcd74('0x1a'),'port':0x18eb});var socket=require(_0xcd74('0x1b'))(new Redis(config[_0xcd74('0x18')]));require(_0xcd74('0x1c'))['register'](socket);function respondWithStatusCode(_0x1a1e7e,_0x580367){_0x580367=_0x580367||0xcc;return function(_0x5364b5){if(_0x5364b5){return _0x1a1e7e[_0xcd74('0x1d')](_0x580367);}return _0x1a1e7e[_0xcd74('0x1e')](_0x580367)[_0xcd74('0x1f')]();};}function respondWithResult(_0x2a9b3f,_0xdfb562){_0xdfb562=_0xdfb562||0xc8;return function(_0x2370a9){if(_0x2370a9){return _0x2a9b3f[_0xcd74('0x1e')](_0xdfb562)['json'](_0x2370a9);}};}function respondWithFilteredResult(_0x1bc53b,_0x37d6d8){return function(_0x1e43c8){if(_0x1e43c8){var _0x5bd690=typeof _0x37d6d8[_0xcd74('0x20')]===_0xcd74('0x21')&&typeof _0x37d6d8[_0xcd74('0x22')]===_0xcd74('0x21');var _0x310982=_0x1e43c8[_0xcd74('0x23')];var _0x4a8743=_0x5bd690?0x0:_0x37d6d8[_0xcd74('0x20')];var _0x586031=_0x5bd690?_0x1e43c8[_0xcd74('0x23')]:_0x37d6d8['offset']+_0x37d6d8[_0xcd74('0x22')];var _0x192979;if(_0x586031>=_0x310982){_0x586031=_0x310982;_0x192979=0xc8;}else{_0x192979=0xce;}_0x1bc53b[_0xcd74('0x1e')](_0x192979);return _0x1bc53b['set'](_0xcd74('0x24'),_0x4a8743+'-'+_0x586031+'/'+_0x310982)['json'](_0x1e43c8);}return null;};}function patchUpdates(_0x4477c0){return function(_0x527b0f){try{jsonpatch[_0xcd74('0x25')](_0x527b0f,_0x4477c0,!![]);}catch(_0x50a1bc){return BPromise[_0xcd74('0x26')](_0x50a1bc);}return _0x527b0f[_0xcd74('0x27')]();};}function saveUpdates(_0x545bf4,_0xef225f){return function(_0x19297f){if(_0x19297f){return _0x19297f[_0xcd74('0x28')](_0x545bf4)[_0xcd74('0x29')](function(_0x5f0cf7){return _0x5f0cf7;});}return null;};}function handleEntityNotFound(_0x5f3821,_0x1d2076){return function(_0x38d3c8){if(!_0x38d3c8){_0x5f3821[_0xcd74('0x1d')](0x194);}return _0x38d3c8;};}function handleError(_0x451adb,_0x3ee8af){_0x3ee8af=_0x3ee8af||0x1f4;return function(_0xe5f8b5){logger[_0xcd74('0x2a')](_0xe5f8b5[_0xcd74('0x2b')]);if(_0xe5f8b5[_0xcd74('0x2c')]){delete _0xe5f8b5[_0xcd74('0x2c')];}_0x451adb[_0xcd74('0x1e')](_0x3ee8af)['send'](_0xe5f8b5);};}exports[_0xcd74('0x2d')]=function(_0x1b5d25,_0x4b4a89){var _0x52e639={},_0x55bcfc={},_0x190f09={'count':0x0,'rows':[]};var _0x4edbd4=_['map'](db[_0xcd74('0x2e')][_0xcd74('0x2f')],function(_0x2e9f05){return{'name':_0x2e9f05[_0xcd74('0x30')],'type':_0x2e9f05['type'][_0xcd74('0x31')]};});_0x55bcfc[_0xcd74('0x32')]=_[_0xcd74('0x33')](_0x4edbd4,_0xcd74('0x2c'));_0x55bcfc['query']=_[_0xcd74('0x34')](_0x1b5d25[_0xcd74('0x35')]);_0x55bcfc[_0xcd74('0x36')]=_[_0xcd74('0x37')](_0x55bcfc[_0xcd74('0x32')],_0x55bcfc[_0xcd74('0x35')]);_0x52e639['attributes']=_[_0xcd74('0x37')](_0x55bcfc[_0xcd74('0x32')],qs[_0xcd74('0x38')](_0x1b5d25[_0xcd74('0x35')][_0xcd74('0x38')]));_0x52e639[_0xcd74('0x39')]=_0x52e639[_0xcd74('0x39')][_0xcd74('0x3a')]?_0x52e639[_0xcd74('0x39')]:_0x55bcfc['model'];if(!_0x1b5d25['query'][_0xcd74('0x3b')](_0xcd74('0x3c'))){_0x52e639['limit']=qs[_0xcd74('0x22')](_0x1b5d25[_0xcd74('0x35')][_0xcd74('0x22')]);_0x52e639[_0xcd74('0x20')]=qs[_0xcd74('0x20')](_0x1b5d25[_0xcd74('0x35')]['offset']);}_0x52e639[_0xcd74('0x3d')]=qs['sort'](_0x1b5d25[_0xcd74('0x35')][_0xcd74('0x3e')]);_0x52e639[_0xcd74('0x3f')]=qs[_0xcd74('0x36')](_['pick'](_0x1b5d25[_0xcd74('0x35')],_0x55bcfc[_0xcd74('0x36')]),_0x4edbd4);if(_0x1b5d25['query'][_0xcd74('0x40')]){_0x52e639['where']=_[_0xcd74('0x41')](_0x52e639[_0xcd74('0x3f')],{'$or':_['map'](_0x4edbd4,function(_0x5821e4){if(_0x5821e4['type']!==_0xcd74('0x42')){var _0x5bff1c={};_0x5bff1c[_0x5821e4['name']]={'$like':'%'+_0x1b5d25[_0xcd74('0x35')][_0xcd74('0x40')]+'%'};return _0x5bff1c;}})});}_0x52e639=_[_0xcd74('0x41')]({},_0x52e639,_0x1b5d25[_0xcd74('0x43')]);var _0xc41690={'where':_0x52e639[_0xcd74('0x3f')]};return db[_0xcd74('0x2e')]['count'](_0xc41690)[_0xcd74('0x29')](function(_0x55c414){_0x190f09['count']=_0x55c414;if(_0x1b5d25['query'][_0xcd74('0x44')]){_0x52e639[_0xcd74('0x45')]=[{'all':!![]}];}return db['Team'][_0xcd74('0x46')](_0x52e639);})[_0xcd74('0x29')](function(_0x5e4cab){_0x190f09[_0xcd74('0x47')]=_0x5e4cab;return _0x190f09;})['then'](respondWithFilteredResult(_0x4b4a89,_0x52e639))['catch'](handleError(_0x4b4a89,null));};exports['show']=function(_0x172562,_0x5e8090){var _0x5c3100={'raw':![],'where':{'id':_0x172562[_0xcd74('0x48')]['id']}},_0x48ab11={};_0x48ab11[_0xcd74('0x32')]=_[_0xcd74('0x34')](db['Team'][_0xcd74('0x2f')]);_0x48ab11[_0xcd74('0x35')]=_['keys'](_0x172562['query']);_0x48ab11['filters']=_[_0xcd74('0x37')](_0x48ab11[_0xcd74('0x32')],_0x48ab11[_0xcd74('0x35')]);_0x5c3100['attributes']=_['intersection'](_0x48ab11[_0xcd74('0x32')],qs[_0xcd74('0x38')](_0x172562[_0xcd74('0x35')][_0xcd74('0x38')]));_0x5c3100[_0xcd74('0x39')]=_0x5c3100[_0xcd74('0x39')][_0xcd74('0x3a')]?_0x5c3100[_0xcd74('0x39')]:_0x48ab11[_0xcd74('0x32')];if(_0x172562[_0xcd74('0x35')]['includeAll']){_0x5c3100[_0xcd74('0x45')]=[{'all':!![]}];}_0x5c3100=_[_0xcd74('0x41')]({},_0x5c3100,_0x172562[_0xcd74('0x43')]);return db[_0xcd74('0x2e')][_0xcd74('0x49')](_0x5c3100)[_0xcd74('0x29')](handleEntityNotFound(_0x5e8090,null))['then'](respondWithResult(_0x5e8090,null))[_0xcd74('0x4a')](handleError(_0x5e8090,null));};exports['create']=function(_0x1d99c3,_0x2b8f9e){return db[_0xcd74('0x2e')][_0xcd74('0x4b')](_0x1d99c3['body'],{})['then'](function(_0x5681c2){var _0x1bf1fa=_0x1d99c3[_0xcd74('0x4c')][_0xcd74('0x4d')]({'plain':!![]});if(!_0x1bf1fa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1bf1fa['role']===_0xcd74('0x4c')){var _0x29df65=_0x5681c2[_0xcd74('0x4d')]({'plain':!![]});var _0x51ef6e='Teams';return db[_0xcd74('0x4e')]['find']({'where':{'name':_0x51ef6e,'userProfileId':_0x1bf1fa['userProfileId']},'raw':!![]})[_0xcd74('0x29')](function(_0x3f3f7e){if(_0x3f3f7e&&_0x3f3f7e[_0xcd74('0x4f')]===0x0){return db[_0xcd74('0x50')][_0xcd74('0x4b')]({'name':_0x29df65[_0xcd74('0x2c')],'resourceId':_0x29df65['id'],'type':_0x3f3f7e[_0xcd74('0x2c')],'sectionId':_0x3f3f7e['id']},{})['then'](function(){return _0x5681c2;});}else{return _0x5681c2;}})[_0xcd74('0x4a')](function(_0xc3f4ce){logger['error'](_0xcd74('0x51'),_0xc3f4ce);throw _0xc3f4ce;});}return _0x5681c2;})[_0xcd74('0x29')](respondWithResult(_0x2b8f9e,0xc9))[_0xcd74('0x4a')](handleError(_0x2b8f9e,null));};exports[_0xcd74('0x28')]=function(_0x38d666,_0x20c7bb){if(_0x38d666['body']['id']){delete _0x38d666[_0xcd74('0x52')]['id'];}return db[_0xcd74('0x2e')][_0xcd74('0x49')]({'where':{'id':_0x38d666[_0xcd74('0x48')]['id']}})[_0xcd74('0x29')](handleEntityNotFound(_0x20c7bb,null))[_0xcd74('0x29')](saveUpdates(_0x38d666[_0xcd74('0x52')],null))[_0xcd74('0x29')](respondWithResult(_0x20c7bb,null))['catch'](handleError(_0x20c7bb,null));};exports['destroy']=function(_0x3e3a00,_0x39197f){var _0x71a932=_0x3e3a00['params']['id'];var _0xbeecae=[];return db['sequelize'][_0xcd74('0x53')](function(_0x5de4d6){var _0x166358=_0xcd74('0x54')+_0x71a932;return db[_0xcd74('0x55')][_0xcd74('0x35')](_0x166358,{'type':db[_0xcd74('0x56')][_0xcd74('0x57')]['SELECT'],'raw':!![],'transaction':_0x5de4d6})['then'](function(_0x1d199b){_0xbeecae=_['map'](_0x1d199b,function(_0x3621dd){return Number(_0x3621dd[_0xcd74('0x58')]);});})[_0xcd74('0x29')](function(){var _0x2e6a81=_0xcd74('0x59')+_0x71a932;return db[_0xcd74('0x55')][_0xcd74('0x35')](_0x2e6a81,{'type':db[_0xcd74('0x56')]['QueryTypes'][_0xcd74('0x5a')],'raw':!![],'transaction':_0x5de4d6});})[_0xcd74('0x29')](function(_0x57a92d){var _0x2a0179=_[_0xcd74('0x33')](_0x57a92d,function(_0x4142f9){return Number(_0x4142f9['VoiceQueueId']);});return db[_0xcd74('0x5b')]['destroy']({'where':{'UserId':{'$in':_0xbeecae},'VoiceQueueId':{'$in':_0x2a0179}},'transaction':_0x5de4d6});})[_0xcd74('0x29')](function(){var _0x1ca6d1=_0xcd74('0x5c')+_0x71a932;return db[_0xcd74('0x55')]['query'](_0x1ca6d1,{'type':db[_0xcd74('0x56')][_0xcd74('0x57')][_0xcd74('0x5a')],'raw':!![],'transaction':_0x5de4d6});})[_0xcd74('0x29')](function(_0x19d4f4){var _0x519d95=_['map'](_0x19d4f4,function(_0x413260){return Number(_0x413260[_0xcd74('0x5d')]);});return db[_0xcd74('0x5e')][_0xcd74('0x5f')]({'where':{'UserId':{'$in':_0xbeecae},'MailQueueId':{'$in':_0x519d95}},'transaction':_0x5de4d6});})[_0xcd74('0x29')](function(){var _0x358abb=_0xcd74('0x60')+_0x71a932;return db[_0xcd74('0x55')]['query'](_0x358abb,{'type':db[_0xcd74('0x56')][_0xcd74('0x57')][_0xcd74('0x5a')],'raw':!![],'transaction':_0x5de4d6});})[_0xcd74('0x29')](function(_0x7f45dd){var _0x31567b=_[_0xcd74('0x33')](_0x7f45dd,function(_0x4ce6ad){return Number(_0x4ce6ad['SmsQueueId']);});return db[_0xcd74('0x61')][_0xcd74('0x5f')]({'where':{'UserId':{'$in':_0xbeecae},'SmsQueueId':{'$in':_0x31567b}},'transaction':_0x5de4d6});})[_0xcd74('0x29')](function(){var _0x57b251=_0xcd74('0x62')+_0x71a932;return db[_0xcd74('0x55')]['query'](_0x57b251,{'type':db[_0xcd74('0x56')][_0xcd74('0x57')][_0xcd74('0x5a')],'raw':!![],'transaction':_0x5de4d6});})[_0xcd74('0x29')](function(_0x5b73f3){var _0x166612=_[_0xcd74('0x33')](_0x5b73f3,function(_0x18c402){return Number(_0x18c402[_0xcd74('0x63')]);});return db['UserChatQueue'][_0xcd74('0x5f')]({'where':{'UserId':{'$in':_0xbeecae},'ChatQueueId':{'$in':_0x166612}},'transaction':_0x5de4d6});})[_0xcd74('0x29')](function(){var _0x266b64=_0xcd74('0x64')+_0x71a932;return db[_0xcd74('0x55')][_0xcd74('0x35')](_0x266b64,{'type':db[_0xcd74('0x56')][_0xcd74('0x57')][_0xcd74('0x5a')],'raw':!![],'transaction':_0x5de4d6});})[_0xcd74('0x29')](function(_0x17605c){var _0x40ac6e=_[_0xcd74('0x33')](_0x17605c,function(_0x12fd6d){return Number(_0x12fd6d[_0xcd74('0x65')]);});return db[_0xcd74('0x66')]['destroy']({'where':{'UserId':{'$in':_0xbeecae},'FaxQueueId':{'$in':_0x40ac6e}},'transaction':_0x5de4d6});})[_0xcd74('0x29')](function(){var _0x3ebd26=_0xcd74('0x67')+_0x71a932;return db[_0xcd74('0x55')][_0xcd74('0x35')](_0x3ebd26,{'type':db[_0xcd74('0x56')][_0xcd74('0x57')][_0xcd74('0x5a')],'raw':!![],'transaction':_0x5de4d6});})[_0xcd74('0x29')](function(_0x159bee){var _0x3dac12=_[_0xcd74('0x33')](_0x159bee,function(_0x183d21){return Number(_0x183d21[_0xcd74('0x68')]);});return db[_0xcd74('0x69')][_0xcd74('0x5f')]({'where':{'UserId':{'$in':_0xbeecae},'OpenchannelQueueId':{'$in':_0x3dac12}},'transaction':_0x5de4d6});})[_0xcd74('0x29')](function(){var _0x4a3d0b='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x71a932;return db['sequelize'][_0xcd74('0x35')](_0x4a3d0b,{'type':db[_0xcd74('0x56')][_0xcd74('0x57')][_0xcd74('0x5a')],'raw':!![],'transaction':_0x5de4d6});})[_0xcd74('0x29')](function(_0xb78ebf){var _0x43d9c1=_[_0xcd74('0x33')](_0xb78ebf,function(_0x30158b){return Number(_0x30158b[_0xcd74('0x6a')]);});return db[_0xcd74('0x6b')]['destroy']({'where':{'UserId':{'$in':_0xbeecae},'WhatsappQueueId':{'$in':_0x43d9c1}},'transaction':_0x5de4d6});})['then'](function(){return db[_0xcd74('0x6c')]['find']({'where':{'TeamId':_0x71a932}});})['then'](function(_0x12dfad){if(_0x12dfad===null){return;}return db[_0xcd74('0x6d')][_0xcd74('0x5f')]({'where':{'UserId':{'$in':_0xbeecae},'VoicePrefixId':_0x12dfad['VoicePrefixId']},'transaction':_0x5de4d6});})[_0xcd74('0x29')](function(){return db['Team']['destroy']({'where':{'id':_0x71a932},'cascade':!![],'transaction':_0x5de4d6});})[_0xcd74('0x29')](function(_0x1957ca){if(_0x1957ca===0x0){_0x39197f[_0xcd74('0x1d')](0x194);}else{return db['UserProfileResource'][_0xcd74('0x5f')]({'where':{'type':_0xcd74('0x6e'),'resourceId':_0x71a932},'cascade':!![],'transaction':_0x5de4d6})[_0xcd74('0x29')](function(){_0x39197f['status'](0xcc)[_0xcd74('0x1f')]();});}})[_0xcd74('0x4a')](function(_0x464f98){_0x39197f[_0xcd74('0x1e')](0x1f4)[_0xcd74('0x6f')](_0x464f98);});});};exports[_0xcd74('0x70')]=function(_0x4695e8,_0x406894,_0x219fb0){return db[_0xcd74('0x2e')][_0xcd74('0x71')]({'where':{'id':_0x4695e8[_0xcd74('0x48')]['id']}})[_0xcd74('0x29')](handleEntityNotFound(_0x406894,null))[_0xcd74('0x29')](function(_0x13106b){if(!_0x4695e8[_0xcd74('0x35')][_0xcd74('0x72')]||!utils[_0xcd74('0x73')](_0x4695e8['query'][_0xcd74('0x72')])){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}var _0x4b0101={};var _0x76a117={};_0x76a117[_0xcd74('0x32')]=_[_0xcd74('0x34')](db[_['capitalize'](_0x4695e8[_0xcd74('0x35')][_0xcd74('0x72')][_0xcd74('0x74')]())+_0xcd74('0x75')][_0xcd74('0x2f')]);_0x76a117['query']=_['keys'](_0x4695e8[_0xcd74('0x35')]);_0x76a117[_0xcd74('0x36')]=_[_0xcd74('0x37')](_0x76a117[_0xcd74('0x32')],_0x76a117[_0xcd74('0x35')]);_0x4b0101[_0xcd74('0x39')]=_[_0xcd74('0x37')](_0x76a117[_0xcd74('0x32')],qs[_0xcd74('0x38')](_0x4695e8[_0xcd74('0x35')][_0xcd74('0x38')]));_0x4b0101[_0xcd74('0x39')]=_0x4b0101['attributes']['length']?_0x4b0101[_0xcd74('0x39')]:_0x76a117['model'];_0x4b0101[_0xcd74('0x22')]=qs[_0xcd74('0x22')](_0x4695e8[_0xcd74('0x35')]['limit']);_0x4b0101[_0xcd74('0x20')]=qs[_0xcd74('0x20')](_0x4695e8[_0xcd74('0x35')][_0xcd74('0x20')]);_0x4b0101[_0xcd74('0x3d')]=qs[_0xcd74('0x3e')](_0x4695e8[_0xcd74('0x35')][_0xcd74('0x3e')]);_0x4b0101[_0xcd74('0x3f')]=qs[_0xcd74('0x36')](_[_0xcd74('0x76')](_0x4695e8['query'],_0x76a117[_0xcd74('0x36')]));_0x4b0101=_[_0xcd74('0x41')]({},_0x4b0101,_0x4695e8[_0xcd74('0x43')]);return _0x13106b[_0xcd74('0x4d')+_[_0xcd74('0x77')](_0x4695e8[_0xcd74('0x35')][_0xcd74('0x72')][_0xcd74('0x74')]())+_0xcd74('0x78')](_0x4b0101);})[_0xcd74('0x29')](respondWithResult(_0x406894,null))[_0xcd74('0x4a')](handleError(_0x406894,null));};exports['addQueues']=function(_0x20d9a7,_0x550d4a,_0x27e6e3){return db[_0xcd74('0x2e')]['findOne']({'where':{'id':_0x20d9a7[_0xcd74('0x48')]['id']}})[_0xcd74('0x29')](function(_0x5d2a0d){if(_0x5d2a0d){if(!_0x20d9a7[_0xcd74('0x52')]['channel']||!utils['isValidChannel'](_0x20d9a7['body'][_0xcd74('0x72')])){throw new db[(_0xcd74('0x56'))][(_0xcd74('0x79'))](_0xcd74('0x7a'));}return _0x5d2a0d['add'+_[_0xcd74('0x77')](_0x20d9a7[_0xcd74('0x52')]['channel'][_0xcd74('0x74')]())+'Queues'](_0x20d9a7[_0xcd74('0x52')]['ids']);}return null;})[_0xcd74('0x29')](handleEntityNotFound(_0x550d4a,null))[_0xcd74('0x29')](respondWithStatusCode(_0x550d4a,null))[_0xcd74('0x4a')](handleError(_0x550d4a,null));};exports['removeQueues']=function(_0x1d8959,_0x486328,_0x16e505){return db[_0xcd74('0x2e')][_0xcd74('0x71')]({'where':{'id':_0x1d8959['params']['id']}})[_0xcd74('0x29')](function(_0x26ee01){if(_0x26ee01){if(!_0x1d8959[_0xcd74('0x35')][_0xcd74('0x72')]||!utils['isValidChannel'](_0x1d8959[_0xcd74('0x35')][_0xcd74('0x72')])){throw new db[(_0xcd74('0x56'))]['ValidationError'](_0xcd74('0x7a'));}return _0x26ee01['remove'+_[_0xcd74('0x77')](_0x1d8959['query']['channel'][_0xcd74('0x74')]())+_0xcd74('0x78')](_0x1d8959['query'][_0xcd74('0x7b')]);}return null;})[_0xcd74('0x29')](handleEntityNotFound(_0x486328,null))[_0xcd74('0x29')](respondWithStatusCode(_0x486328,null))[_0xcd74('0x4a')](handleError(_0x486328,null));};exports[_0xcd74('0x7c')]=function(_0x2692cb,_0x204c16){var _0x43290c=_['isArray'](_0x2692cb[_0xcd74('0x52')][_0xcd74('0x7b')])?_0x2692cb[_0xcd74('0x52')]['ids']:[_0x2692cb['body']['ids']];var _0x1032ca=_0x2692cb[_0xcd74('0x48')]['id'];return db[_0xcd74('0x2e')][_0xcd74('0x49')]({'where':{'id':_0x1032ca}})[_0xcd74('0x29')](handleEntityNotFound(_0x204c16,null))[_0xcd74('0x29')](function(_0x12232f){if(_0x12232f){var _0x453fac=['Voice',_0xcd74('0x7d'),_0xcd74('0x7e'),_0xcd74('0x7f'),_0xcd74('0x80'),'Openchannel',_0xcd74('0x81')];return db[_0xcd74('0x55')][_0xcd74('0x53')](function(_0x22251a){var _0x515903=_['map'](_0x453fac,function(_0x9d41de){var _0x21bfe8={'attributes':['id',_0xcd74('0x2c')]};if(_0x9d41de===_0xcd74('0x82')){_0x21bfe8[_0xcd74('0x83')]={'attributes':[_0xcd74('0x84')]};}return _0x12232f[_0xcd74('0x4d')+_0x9d41de+_0xcd74('0x78')](_0x21bfe8)[_0xcd74('0x29')](function(_0x2f8e92){var _0x47588f=_[_0xcd74('0x33')](_0x2f8e92,function(_0x565a78){var _0x4dcff0=_[_0xcd74('0x33')](_0x43290c,function(_0x162057){var _0x52473a={'where':{'UserId':_0x162057,[_0x9d41de+'QueueId']:_0x565a78['id']},'transaction':_0x22251a};if(_0x9d41de===_0xcd74('0x82')){_0x52473a[_0xcd74('0x19')]={'penalty':_0x565a78[_0xcd74('0x85')][_0xcd74('0x84')]};}return db[_0xcd74('0x86')+_0x9d41de+'Queue']['findOrCreate'](_0x52473a)[_0xcd74('0x29')](function(){socket[_0xcd74('0x87')](_0xcd74('0x4c')+_0x9d41de+_0xcd74('0x88'),{'UserId':_0x162057,[_0x9d41de+_0xcd74('0x89')]:_0x565a78['id']});if(_0x9d41de!==_0xcd74('0x82')){return;}return db[_0xcd74('0x86')][_0xcd74('0x46')]({'where':{'id':_0x43290c,'online':0x1},'attributes':['id',_0xcd74('0x2c'),_0xcd74('0x8a'),_0xcd74('0x8b'),_0xcd74('0x8c')],'raw':!![]})['then'](function(_0x39279e){var _0x1dd45a=_[_0xcd74('0x33')](_0x39279e,function(_0x556dac){return db[_0xcd74('0x8d')]['upsert']({'membername':_0x556dac[_0xcd74('0x2c')],'UserId':_0x556dac['id'],'queue_name':_0x565a78[_0xcd74('0x2c')],'VoiceQueueId':_0x565a78['id'],'interface':_[_0xcd74('0x8e')](_0x556dac[_0xcd74('0x8c')])?util[_0xcd74('0x8f')](_0xcd74('0x90'),_0x556dac['name']):_0x556dac[_0xcd74('0x8c')],'paused':_0x556dac['voicePause']||![],'penalty':_0x565a78[_0xcd74('0x85')][_0xcd74('0x84')]},{'transaction':_0x22251a});});return Promise[_0xcd74('0x91')](_0x1dd45a);});});});return Promise['all'](_0x4dcff0);});return Promise[_0xcd74('0x91')](_0x47588f);})['then'](function(){return db[_0xcd74('0x6c')][_0xcd74('0x71')]({'where':{'teamId':_0x1032ca}})[_0xcd74('0x29')](function(_0xe75d36){if(_0xe75d36){var _0x10250b=_[_0xcd74('0x33')](_0x43290c,function(_0x1f2bed){db[_0xcd74('0x6d')]['upsert']({'UserId':_0x1f2bed,'VoicePrefixId':_0xe75d36[_0xcd74('0x92')]});});return Promise[_0xcd74('0x91')](_0x10250b);}});});});return Promise[_0xcd74('0x91')](_0x515903)[_0xcd74('0x29')](function(){return _0x12232f[_0xcd74('0x7c')](_0x43290c,{'transaction':_0x22251a})['spread'](function(_0xac120f){return _0xac120f;});});});}})['then'](respondWithResult(_0x204c16,null))['catch'](handleError(_0x204c16,null));};exports[_0xcd74('0x93')]=function(_0x240ec1,_0x781c2a){var _0x5e5a0d=_[_0xcd74('0x94')](_0x240ec1[_0xcd74('0x35')][_0xcd74('0x7b')])?_0x240ec1['query'][_0xcd74('0x7b')]:[_0x240ec1['query'][_0xcd74('0x7b')]];var _0x3b9e93=_0x240ec1['params']['id'];return db[_0xcd74('0x2e')]['find']({'where':{'id':_0x3b9e93}})[_0xcd74('0x29')](handleEntityNotFound(_0x781c2a,null))[_0xcd74('0x29')](function(_0x54f92d){if(_0x54f92d){var _0x5ce77d=[_0xcd74('0x82'),_0xcd74('0x7d'),'Mail','Sms',_0xcd74('0x80'),_0xcd74('0x95'),_0xcd74('0x81')];return db[_0xcd74('0x55')][_0xcd74('0x53')](function(_0xd59188){var _0x3d3558=_[_0xcd74('0x33')](_0x5ce77d,function(_0x5b553b){var _0xe92d9e={'attributes':['id',_0xcd74('0x2c')]};return _0x54f92d[_0xcd74('0x4d')+_0x5b553b+_0xcd74('0x78')](_0xe92d9e)[_0xcd74('0x29')](function(_0x1ea912){var _0x29f501=_[_0xcd74('0x33')](_0x1ea912,function(_0x46ba66){return _0x46ba66[_0xcd74('0x93')](_0x5e5a0d,{'transaction':_0xd59188})[_0xcd74('0x29')](function(){var _0x598c2b=_[_0xcd74('0x33')](_0x5e5a0d,function(_0x51cdbe){socket[_0xcd74('0x87')](_0xcd74('0x4c')+_0x5b553b+_0xcd74('0x96'),{'UserId':Number(_0x51cdbe),[_0x5b553b+'QueueId']:_0x46ba66['id']});if(_0x5b553b!==_0xcd74('0x82')){return;}return db[_0xcd74('0x8d')][_0xcd74('0x5f')]({'where':{'VoiceQueueId':_0x46ba66['id'],'UserId':_0x51cdbe},'transaction':_0xd59188});});return Promise[_0xcd74('0x91')](_0x598c2b);});});return Promise['all'](_0x29f501);});});return Promise['all'](_0x3d3558)['then'](function(){return _0x54f92d[_0xcd74('0x93')](_0x5e5a0d,{'transaction':_0xd59188});})['then'](function(){return db[_0xcd74('0x6c')]['findOne']({'where':{'teamId':_0x3b9e93}})[_0xcd74('0x29')](function(_0x253b0d){if(_0x253b0d){var _0x24ec02=_[_0xcd74('0x33')](_0x5e5a0d,function(_0x1f7ec8){db[_0xcd74('0x6d')]['destroy']({'where':{'UserId':_0x1f7ec8,'VoicePrefixId':_0x253b0d[_0xcd74('0x92')]}});});return Promise[_0xcd74('0x91')](_0x24ec02);}});});});}})[_0xcd74('0x29')](respondWithStatusCode(_0x781c2a,null))[_0xcd74('0x4a')](handleError(_0x781c2a,null));};exports[_0xcd74('0x97')]=function(_0x484e76,_0x283b1b,_0x503014){var _0x4ba176={};var _0x3fa3f1={};var _0x5a9d1d;var _0xd61f43;return db[_0xcd74('0x2e')][_0xcd74('0x71')]({'where':{'id':_0x484e76[_0xcd74('0x48')]['id']}})[_0xcd74('0x29')](handleEntityNotFound(_0x283b1b,null))[_0xcd74('0x29')](function(_0x540776){if(_0x540776){_0x5a9d1d=_0x540776;_0x3fa3f1[_0xcd74('0x32')]=_[_0xcd74('0x34')](db[_0xcd74('0x86')][_0xcd74('0x2f')]);_0x3fa3f1[_0xcd74('0x35')]=_[_0xcd74('0x34')](_0x484e76[_0xcd74('0x35')]);_0x3fa3f1[_0xcd74('0x36')]=_[_0xcd74('0x37')](_0x3fa3f1[_0xcd74('0x32')],_0x3fa3f1[_0xcd74('0x35')]);_0x4ba176['attributes']=_['intersection'](_0x3fa3f1[_0xcd74('0x32')],qs['fields'](_0x484e76[_0xcd74('0x35')][_0xcd74('0x38')]));_0x4ba176[_0xcd74('0x39')]=_0x4ba176['attributes'][_0xcd74('0x3a')]?_0x4ba176[_0xcd74('0x39')]:_0x3fa3f1[_0xcd74('0x32')];_0x4ba176[_0xcd74('0x3d')]=qs[_0xcd74('0x3e')](_0x484e76['query']['sort']);_0x4ba176[_0xcd74('0x3f')]=qs[_0xcd74('0x36')](_['pick'](_0x484e76[_0xcd74('0x35')],_0x3fa3f1[_0xcd74('0x36')]));if(_0x484e76['query']['filter']){_0x4ba176[_0xcd74('0x3f')]=_['merge'](_0x4ba176[_0xcd74('0x3f')],{'$or':_[_0xcd74('0x33')](_0x4ba176[_0xcd74('0x39')],function(_0x4a2946){var _0x22ceae={};_0x22ceae[_0x4a2946]={'$like':'%'+_0x484e76[_0xcd74('0x35')][_0xcd74('0x40')]+'%'};return _0x22ceae;})});}_0x4ba176=_['merge']({},_0x4ba176,_0x484e76[_0xcd74('0x43')]);return _0x5a9d1d[_0xcd74('0x97')](_0x4ba176);}})[_0xcd74('0x29')](function(_0x25db1a){if(_0x25db1a){_0xd61f43=_0x25db1a[_0xcd74('0x3a')];if(!_0x484e76[_0xcd74('0x35')][_0xcd74('0x3b')](_0xcd74('0x3c'))){_0x4ba176[_0xcd74('0x22')]=qs['limit'](_0x484e76[_0xcd74('0x35')][_0xcd74('0x22')]);_0x4ba176[_0xcd74('0x20')]=qs['offset'](_0x484e76[_0xcd74('0x35')]['offset']);}return _0x5a9d1d[_0xcd74('0x97')](_0x4ba176);}})[_0xcd74('0x29')](function(_0x46f372){if(_0x46f372){return _0x46f372?{'count':_0xd61f43,'rows':_0x46f372}:null;}})[_0xcd74('0x29')](respondWithResult(_0x283b1b,null))[_0xcd74('0x4a')](handleError(_0x283b1b,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 0b8cdd9..9938102 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 _0x0a3b=['hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x2791ed,_0x38ac0c){var _0x2195b8=function(_0x1c0b43){while(--_0x1c0b43){_0x2791ed['push'](_0x2791ed['shift']());}};_0x2195b8(++_0x38ac0c);}(_0x0a3b,0x1d7));var _0xb0a3=function(_0x5534fe,_0x43c22e){_0x5534fe=_0x5534fe-0x0;var _0x3d1dc2=_0x0a3b[_0x5534fe];return _0x3d1dc2;};'use strict';var EventEmitter=require('events');var Team=require(_0xb0a3('0x0'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xb0a3('0x1')](0x0);var events={'afterCreate':_0xb0a3('0x2'),'afterUpdate':_0xb0a3('0x3'),'afterDestroy':_0xb0a3('0x4')};function emitEvent(_0x37ce7a){return function(_0x486f4e,_0x48f94c,_0xec43b3){TeamEvents[_0xb0a3('0x5')](_0x37ce7a+':'+_0x486f4e['id'],_0x486f4e);TeamEvents[_0xb0a3('0x5')](_0x37ce7a,_0x486f4e);_0xec43b3(null);};}for(var e in events){if(events[_0xb0a3('0x6')](e)){var event=events[e];Team[_0xb0a3('0x7')](e,emitEvent(event));}}module[_0xb0a3('0x8')]=TeamEvents; \ No newline at end of file +var _0x43de=['update','remove','emit','hasOwnProperty','hook','events','setMaxListeners','save'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x43de,0x85));var _0xe43d=function(_0x420de8,_0x165730){_0x420de8=_0x420de8-0x0;var _0x59e659=_0x43de[_0x420de8];return _0x59e659;};'use strict';var EventEmitter=require(_0xe43d('0x0'));var Team=require('../../mysqldb')['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xe43d('0x1')](0x0);var events={'afterCreate':_0xe43d('0x2'),'afterUpdate':_0xe43d('0x3'),'afterDestroy':_0xe43d('0x4')};function emitEvent(_0x13c28a){return function(_0x22a606,_0x523a3e,_0x36a431){TeamEvents['emit'](_0x13c28a+':'+_0x22a606['id'],_0x22a606);TeamEvents[_0xe43d('0x5')](_0x13c28a,_0x22a606);_0x36a431(null);};}for(var e in events){if(events[_0xe43d('0x6')](e)){var event=events[e];Team[_0xe43d('0x7')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index ccd78eb..a03323c 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 _0x77c2=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','lodash','util'];(function(_0x121b30,_0x2fe25c){var _0x2d0778=function(_0x36006a){while(--_0x36006a){_0x121b30['push'](_0x121b30['shift']());}};_0x2d0778(++_0x2fe25c);}(_0x77c2,0xc4));var _0x277c=function(_0x1f0724,_0x3a58bf){_0x1f0724=_0x1f0724-0x0;var _0x253ffb=_0x77c2[_0x1f0724];return _0x253ffb;};'use strict';var _=require(_0x277c('0x0'));var util=require(_0x277c('0x1'));var logger=require(_0x277c('0x2'))(_0x277c('0x3'));var moment=require(_0x277c('0x4'));var BPromise=require(_0x277c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x277c('0x6'));var rimraf=require(_0x277c('0x7'));var config=require(_0x277c('0x8'));var attributes=require('./team.attributes');module[_0x277c('0x9')]=function(_0x3a0db8,_0x21f131){return _0x3a0db8[_0x277c('0xa')]('Team',attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x05ca=['exports','define','Team','teams','lodash','util','moment','bluebird','request-promise','path','rimraf','./team.attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x05ca,0x64));var _0xa05c=function(_0x2c7076,_0x1e7b51){_0x2c7076=_0x2c7076-0x0;var _0x514fb8=_0x05ca[_0x2c7076];return _0x514fb8;};'use strict';var _=require(_0xa05c('0x0'));var util=require(_0xa05c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa05c('0x2'));var BPromise=require(_0xa05c('0x3'));var rp=require(_0xa05c('0x4'));var fs=require('fs');var path=require(_0xa05c('0x5'));var rimraf=require(_0xa05c('0x6'));var config=require('../../config/environment');var attributes=require(_0xa05c('0x7'));module[_0xa05c('0x8')]=function(_0x4be2b1,_0x399718){return _0x4be2b1[_0xa05c('0x9')](_0xa05c('0xa'),attributes,{'tableName':_0xa05c('0xb'),'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 104d923..825c2f3 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 _0x4c21=['info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','http','redis','localhost','socket.io-emitter','./team.socket','register','request','then'];(function(_0x810025,_0x34bb04){var _0x4dbc81=function(_0x2c3907){while(--_0x2c3907){_0x810025['push'](_0x810025['shift']());}};_0x4dbc81(++_0x34bb04);}(_0x4c21,0x1d6));var _0x14c2=function(_0x34fc32,_0x1b372f){_0x34fc32=_0x34fc32-0x0;var _0x567758=_0x4c21[_0x34fc32];return _0x567758;};'use strict';var _=require(_0x14c2('0x0'));var util=require(_0x14c2('0x1'));var moment=require('moment');var BPromise=require(_0x14c2('0x2'));var rs=require(_0x14c2('0x3'));var fs=require('fs');var Redis=require(_0x14c2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x14c2('0x5'));var logger=require(_0x14c2('0x6'))('rpc');var config=require(_0x14c2('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x14c2('0x8')]({'port':0x232a});config[_0x14c2('0x9')]=_['defaults'](config[_0x14c2('0x9')],{'host':_0x14c2('0xa'),'port':0x18eb});var socket=require(_0x14c2('0xb'))(new Redis(config[_0x14c2('0x9')]));require(_0x14c2('0xc'))[_0x14c2('0xd')](socket);function respondWithRpcPromise(_0x3e7f5b,_0x531234,_0x4c88ea){return new BPromise(function(_0x53bdb9,_0x194836){return client[_0x14c2('0xe')](_0x3e7f5b,_0x4c88ea)[_0x14c2('0xf')](function(_0x2d817f){logger[_0x14c2('0x10')](_0x14c2('0x11'),_0x531234,_0x14c2('0x12'));logger[_0x14c2('0x13')](_0x14c2('0x14'),_0x531234,_0x14c2('0x12'),JSON[_0x14c2('0x15')](_0x2d817f));if(_0x2d817f[_0x14c2('0x16')]){if(_0x2d817f['error'][_0x14c2('0x17')]===0x1f4){logger[_0x14c2('0x16')](_0x14c2('0x11'),_0x531234,_0x2d817f[_0x14c2('0x16')][_0x14c2('0x18')]);return _0x194836(_0x2d817f[_0x14c2('0x16')]['message']);}logger[_0x14c2('0x16')](_0x14c2('0x11'),_0x531234,_0x2d817f[_0x14c2('0x16')][_0x14c2('0x18')]);return _0x53bdb9(_0x2d817f[_0x14c2('0x16')][_0x14c2('0x18')]);}else{logger[_0x14c2('0x10')](_0x14c2('0x11'),_0x531234,'request\x20sent');_0x53bdb9(_0x2d817f[_0x14c2('0x19')][_0x14c2('0x18')]);}})[_0x14c2('0x1a')](function(_0xded273){logger[_0x14c2('0x16')](_0x14c2('0x11'),_0x531234,_0xded273);_0x194836(_0xded273);});});} \ No newline at end of file +var _0xa020=['then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','register','request'];(function(_0x15f9d6,_0x542279){var _0x376d8f=function(_0x59dec5){while(--_0x59dec5){_0x15f9d6['push'](_0x15f9d6['shift']());}};_0x376d8f(++_0x542279);}(_0xa020,0x185));var _0x0a02=function(_0x4cc737,_0x54f129){_0x4cc737=_0x4cc737-0x0;var _0x4e017b=_0xa020[_0x4cc737];return _0x4e017b;};'use strict';var _=require(_0x0a02('0x0'));var util=require(_0x0a02('0x1'));var moment=require(_0x0a02('0x2'));var BPromise=require(_0x0a02('0x3'));var rs=require(_0x0a02('0x4'));var fs=require('fs');var Redis=require(_0x0a02('0x5'));var db=require(_0x0a02('0x6'))['db'];var utils=require(_0x0a02('0x7'));var logger=require(_0x0a02('0x8'))(_0x0a02('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0a02('0xa')]['http']({'port':0x232a});config[_0x0a02('0xb')]=_[_0x0a02('0xc')](config['redis'],{'host':_0x0a02('0xd'),'port':0x18eb});var socket=require(_0x0a02('0xe'))(new Redis(config[_0x0a02('0xb')]));require('./team.socket')[_0x0a02('0xf')](socket);function respondWithRpcPromise(_0x32c64e,_0xbc22d4,_0x66a837){return new BPromise(function(_0x36e853,_0x5b717c){return client[_0x0a02('0x10')](_0x32c64e,_0x66a837)[_0x0a02('0x11')](function(_0x20575e){logger[_0x0a02('0x12')](_0x0a02('0x13'),_0xbc22d4,_0x0a02('0x14'));logger[_0x0a02('0x15')](_0x0a02('0x16'),_0xbc22d4,_0x0a02('0x14'),JSON[_0x0a02('0x17')](_0x20575e));if(_0x20575e[_0x0a02('0x18')]){if(_0x20575e['error'][_0x0a02('0x19')]===0x1f4){logger['error'](_0x0a02('0x13'),_0xbc22d4,_0x20575e['error']['message']);return _0x5b717c(_0x20575e['error'][_0x0a02('0x1a')]);}logger[_0x0a02('0x18')](_0x0a02('0x13'),_0xbc22d4,_0x20575e[_0x0a02('0x18')][_0x0a02('0x1a')]);return _0x36e853(_0x20575e['error'][_0x0a02('0x1a')]);}else{logger['info']('Team,\x20%s,\x20%s',_0xbc22d4,_0x0a02('0x14'));_0x36e853(_0x20575e[_0x0a02('0x1b')]['message']);}})[_0x0a02('0x1c')](function(_0x1f1d14){logger[_0x0a02('0x18')]('Team,\x20%s,\x20%s',_0xbc22d4,_0x1f1d14);_0x5b717c(_0x1f1d14);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 714c9b0..9854c41 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 _0x63c6=['length','./team.events','save','emit','removeListener','register'];(function(_0xd436c4,_0x298c0b){var _0x506952=function(_0x771356){while(--_0x771356){_0xd436c4['push'](_0xd436c4['shift']());}};_0x506952(++_0x298c0b);}(_0x63c6,0xbb));var _0x663c=function(_0x1ed09d,_0x537888){_0x1ed09d=_0x1ed09d-0x0;var _0x517973=_0x63c6[_0x1ed09d];return _0x517973;};'use strict';var TeamEvents=require(_0x663c('0x0'));var events=[_0x663c('0x1'),'remove','update'];function createListener(_0x3df243,_0x859d1d){return function(_0x34c708){_0x859d1d[_0x663c('0x2')](_0x3df243,_0x34c708);};}function removeListener(_0x405301,_0x153d08){return function(){TeamEvents[_0x663c('0x3')](_0x405301,_0x153d08);};}exports[_0x663c('0x4')]=function(_0x6bdbd1){for(var _0x4fedf8=0x0,_0x1dbe47=events[_0x663c('0x5')];_0x4fedf8<_0x1dbe47;_0x4fedf8++){var _0x3eb551=events[_0x4fedf8];var _0xb32d9e=createListener('team:'+_0x3eb551,_0x6bdbd1);TeamEvents['on'](_0x3eb551,_0xb32d9e);}}; \ No newline at end of file +var _0x00ad=['emit','removeListener','register','length','team:','./team.events','save','update'];(function(_0x4d0ca2,_0x4833b8){var _0x224e56=function(_0x3a2700){while(--_0x3a2700){_0x4d0ca2['push'](_0x4d0ca2['shift']());}};_0x224e56(++_0x4833b8);}(_0x00ad,0x65));var _0xd00a=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x00ad[_0x19e35c];return _0x3e1fe8;};'use strict';var TeamEvents=require(_0xd00a('0x0'));var events=[_0xd00a('0x1'),'remove',_0xd00a('0x2')];function createListener(_0x476dfe,_0x3cac1a){return function(_0x50ca16){_0x3cac1a[_0xd00a('0x3')](_0x476dfe,_0x50ca16);};}function removeListener(_0x5175bd,_0x2d8939){return function(){TeamEvents[_0xd00a('0x4')](_0x5175bd,_0x2d8939);};}exports[_0xd00a('0x5')]=function(_0x55e599){for(var _0xc04afa=0x0,_0x885f6b=events[_0xd00a('0x6')];_0xc04afa<_0x885f6b;_0xc04afa++){var _0x5afe02=events[_0xc04afa];var _0xee48fa=createListener(_0xd00a('0x7')+_0x5afe02,_0x55e599);TeamEvents['on'](_0x5afe02,_0xee48fa);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index a55dbd0..cc4fa85 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 _0x80d9=['exports','INTEGER','sequelize'];(function(_0xaa0e2,_0x3aa20f){var _0x19a563=function(_0x2314c7){while(--_0x2314c7){_0xaa0e2['push'](_0xaa0e2['shift']());}};_0x19a563(++_0x3aa20f);}(_0x80d9,0xb6));var _0x980d=function(_0x2a98a2,_0x557c5a){_0x2a98a2=_0x2a98a2-0x0;var _0x1ef074=_0x80d9[_0x2a98a2];return _0x1ef074;};'use strict';var Sequelize=require(_0x980d('0x0'));module[_0x980d('0x1')]={'TeamId':{'type':Sequelize[_0x980d('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x980d('0x2')]}}; \ No newline at end of file +var _0x39cb=['INTEGER','exports'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0x39cb,0x1bd));var _0xb39c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x39cb[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xb39c('0x0')]={'TeamId':{'type':Sequelize[_0xb39c('0x1')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 48fa886..daf3f7e 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 _0xe3d4=['api','bluebird','request-promise','rimraf','./teamVoicePrefix.attributes','exports','define','team_has_voice_prefixes','util','../../config/logger'];(function(_0x2a4dbe,_0x427e77){var _0x3846a2=function(_0x50e7b2){while(--_0x50e7b2){_0x2a4dbe['push'](_0x2a4dbe['shift']());}};_0x3846a2(++_0x427e77);}(_0xe3d4,0xc6));var _0x4e3d=function(_0x40769f,_0x4d516d){_0x40769f=_0x40769f-0x0;var _0x469d2b=_0xe3d4[_0x40769f];return _0x469d2b;};'use strict';var _=require('lodash');var util=require(_0x4e3d('0x0'));var logger=require(_0x4e3d('0x1'))(_0x4e3d('0x2'));var moment=require('moment');var BPromise=require(_0x4e3d('0x3'));var rp=require(_0x4e3d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4e3d('0x5'));var config=require('../../config/environment');var attributes=require(_0x4e3d('0x6'));module[_0x4e3d('0x7')]=function(_0x4fd5ff,_0x3eaf60){return _0x4fd5ff[_0x4e3d('0x8')]('TeamVoicePrefix',attributes,{'tableName':_0x4e3d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa902=['../../config/logger','api','moment','request-promise','../../config/environment','./teamVoicePrefix.attributes','exports','define','team_has_voice_prefixes','lodash','util'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xa902,0x8d));var _0x2a90=function(_0x36e933,_0x2d1ed0){_0x36e933=_0x36e933-0x0;var _0x1643a2=_0xa902[_0x36e933];return _0x1643a2;};'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')]('TeamVoicePrefix',attributes,{'tableName':_0x2a90('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index abf741f..bf6d81c 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1d4d75,_0x48b6b4){var _0x11316d=function(_0xf25f35){while(--_0xf25f35){_0x1d4d75['push'](_0x1d4d75['shift']());}};_0x11316d(++_0x48b6b4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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(_0x545e19,_0xe3eba5){var _0xb12bae=function(_0x10a93b){while(--_0x10a93b){_0x545e19['push'](_0x545e19['shift']());}};_0xb12bae(++_0xe3eba5);}(_0x70e0,0x17b));var _0x070e=function(_0x1042b9,_0x4c875b){_0x1042b9=_0x1042b9-0x0;var _0x9384a2=_0x70e0[_0x1042b9];return _0x9384a2;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 06f8d40..34f90b9 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 _0x757a=['exports','INTEGER','sequelize'];(function(_0x2e0720,_0x2c3ea2){var _0xf36159=function(_0x16d2d1){while(--_0x16d2d1){_0x2e0720['push'](_0x2e0720['shift']());}};_0xf36159(++_0x2c3ea2);}(_0x757a,0x110));var _0xa757=function(_0x5527ed,_0x243e24){_0x5527ed=_0x5527ed-0x0;var _0x461e79=_0x757a[_0x5527ed];return _0x461e79;};'use strict';var Sequelize=require(_0xa757('0x0'));module[_0xa757('0x1')]={'penalty':{'type':Sequelize[_0xa757('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb3c8=['exports','INTEGER','sequelize'];(function(_0x1a49f2,_0x570a49){var _0x382da3=function(_0xd1e85){while(--_0xd1e85){_0x1a49f2['push'](_0x1a49f2['shift']());}};_0x382da3(++_0x570a49);}(_0xb3c8,0x197));var _0x8b3c=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xb3c8[_0xaa0309];return _0x5de7ce;};'use strict';var Sequelize=require(_0x8b3c('0x0'));module[_0x8b3c('0x1')]={'penalty':{'type':Sequelize[_0x8b3c('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 7cde8e9..801f718 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 _0x765b=['rimraf','../../config/environment','define','team_has_voice_queues','api','bluebird','path'];(function(_0x1fc0d1,_0x23e355){var _0x25996c=function(_0x269d15){while(--_0x269d15){_0x1fc0d1['push'](_0x1fc0d1['shift']());}};_0x25996c(++_0x23e355);}(_0x765b,0x18c));var _0xb765=function(_0x46d87a,_0x5183db){_0x46d87a=_0x46d87a-0x0;var _0x115296=_0x765b[_0x46d87a];return _0x115296;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xb765('0x0'));var moment=require('moment');var BPromise=require(_0xb765('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb765('0x2'));var rimraf=require(_0xb765('0x3'));var config=require(_0xb765('0x4'));var attributes=require('./teamVoiceQueue.attributes');module['exports']=function(_0x58195b,_0x5441a3){return _0x58195b[_0xb765('0x5')]('TeamVoiceQueue',attributes,{'tableName':_0xb765('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe22=['../../config/environment','./teamVoiceQueue.attributes','exports','TeamVoiceQueue','team_has_voice_queues','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x49748c,_0x3d2005){var _0xedf6b6=function(_0x11628d){while(--_0x11628d){_0x49748c['push'](_0x49748c['shift']());}};_0xedf6b6(++_0x3d2005);}(_0xbe22,0x1c1));var _0x2be2=function(_0x440372,_0x1ec6d1){_0x440372=_0x440372-0x0;var _0x381be4=_0xbe22[_0x440372];return _0x381be4;};'use strict';var _=require(_0x2be2('0x0'));var util=require(_0x2be2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2be2('0x2'));var BPromise=require(_0x2be2('0x3'));var rp=require(_0x2be2('0x4'));var fs=require('fs');var path=require(_0x2be2('0x5'));var rimraf=require(_0x2be2('0x6'));var config=require(_0x2be2('0x7'));var attributes=require(_0x2be2('0x8'));module[_0x2be2('0x9')]=function(_0x1b3bde,_0x3a4d77){return _0x1b3bde['define'](_0x2be2('0xa'),attributes,{'tableName':_0x2be2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 312882b..5b0e2ab 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 _0x7883=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','moment'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x7883,0x1b6));var _0x3788=function(_0x4fa82d,_0x1d423f){_0x4fa82d=_0x4fa82d-0x0;var _0x109ffd=_0x7883[_0x4fa82d];return _0x109ffd;};'use strict';var _=require(_0x3788('0x0'));var util=require('util');var moment=require(_0x3788('0x1'));var BPromise=require(_0x3788('0x2'));var rs=require(_0x3788('0x3'));var fs=require('fs');var Redis=require(_0x3788('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3788('0x5'));var logger=require(_0x3788('0x6'))(_0x3788('0x7'));var config=require(_0x3788('0x8'));var jayson=require(_0x3788('0x9'));var client=jayson[_0x3788('0xa')][_0x3788('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c8437,_0x16d5ff,_0x59e1b1){return new BPromise(function(_0xec0266,_0x104bb1){return client[_0x3788('0xc')](_0x3c8437,_0x59e1b1)[_0x3788('0xd')](function(_0x41a05f){logger['info'](_0x3788('0xe'),_0x16d5ff,_0x3788('0xf'));logger['debug'](_0x3788('0x10'),_0x16d5ff,_0x3788('0xf'),JSON['stringify'](_0x41a05f));if(_0x41a05f[_0x3788('0x11')]){if(_0x41a05f[_0x3788('0x11')][_0x3788('0x12')]===0x1f4){logger['error'](_0x3788('0xe'),_0x16d5ff,_0x41a05f[_0x3788('0x11')][_0x3788('0x13')]);return _0x104bb1(_0x41a05f[_0x3788('0x11')][_0x3788('0x13')]);}logger['error'](_0x3788('0xe'),_0x16d5ff,_0x41a05f[_0x3788('0x11')]['message']);return _0xec0266(_0x41a05f['error'][_0x3788('0x13')]);}else{logger[_0x3788('0x14')](_0x3788('0xe'),_0x16d5ff,'request\x20sent');_0xec0266(_0x41a05f['result'][_0x3788('0x13')]);}})[_0x3788('0x15')](function(_0x370bc8){logger[_0x3788('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x16d5ff,_0x370bc8);_0x104bb1(_0x370bc8);});});} \ No newline at end of file +var _0x10d8=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util'];(function(_0xbe6f0,_0x18e5e2){var _0x5e2b92=function(_0x11bc3e){while(--_0x11bc3e){_0xbe6f0['push'](_0xbe6f0['shift']());}};_0x5e2b92(++_0x18e5e2);}(_0x10d8,0xee));var _0x810d=function(_0x4189cf,_0x33d5b9){_0x4189cf=_0x4189cf-0x0;var _0xe9b93d=_0x10d8[_0x4189cf];return _0xe9b93d;};'use strict';var _=require(_0x810d('0x0'));var util=require(_0x810d('0x1'));var moment=require(_0x810d('0x2'));var BPromise=require('bluebird');var rs=require(_0x810d('0x3'));var fs=require('fs');var Redis=require(_0x810d('0x4'));var db=require(_0x810d('0x5'))['db'];var utils=require(_0x810d('0x6'));var logger=require(_0x810d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x810d('0x8'));var client=jayson[_0x810d('0x9')][_0x810d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a4786,_0x18af64,_0x3740af){return new BPromise(function(_0x3b0e88,_0x4efe33){return client['request'](_0x3a4786,_0x3740af)['then'](function(_0x485919){logger[_0x810d('0xb')](_0x810d('0xc'),_0x18af64,_0x810d('0xd'));logger[_0x810d('0xe')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x18af64,_0x810d('0xd'),JSON[_0x810d('0xf')](_0x485919));if(_0x485919[_0x810d('0x10')]){if(_0x485919[_0x810d('0x10')]['code']===0x1f4){logger[_0x810d('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x18af64,_0x485919['error'][_0x810d('0x11')]);return _0x4efe33(_0x485919['error'][_0x810d('0x11')]);}logger[_0x810d('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x18af64,_0x485919[_0x810d('0x10')][_0x810d('0x11')]);return _0x3b0e88(_0x485919[_0x810d('0x10')][_0x810d('0x11')]);}else{logger[_0x810d('0xb')]('TeamVoiceQueue,\x20%s,\x20%s',_0x18af64,'request\x20sent');_0x3b0e88(_0x485919[_0x810d('0x12')]['message']);}})[_0x810d('0x13')](function(_0x290563){logger[_0x810d('0x10')](_0x810d('0xc'),_0x18af64,_0x290563);_0x4efe33(_0x290563);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 397c830..121b7a1 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 _0xf811=['show','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id'];(function(_0x2dc7c9,_0x3a15f8){var _0x3e6536=function(_0x312829){while(--_0x312829){_0x2dc7c9['push'](_0x2dc7c9['shift']());}};_0x3e6536(++_0x3a15f8);}(_0xf811,0x6f));var _0x1f81=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xf811[_0xdea41a];return _0x15d0d8;};'use strict';var multer=require(_0x1f81('0x0'));var util=require(_0x1f81('0x1'));var path=require(_0x1f81('0x2'));var timeout=require(_0x1f81('0x3'));var express=require(_0x1f81('0x4'));var router=express[_0x1f81('0x5')]();var fs_extra=require(_0x1f81('0x6'));var auth=require(_0x1f81('0x7'));var interaction=require(_0x1f81('0x8'));var config=require(_0x1f81('0x9'));var controller=require(_0x1f81('0xa'));router[_0x1f81('0xb')]('/',auth[_0x1f81('0xc')](),controller[_0x1f81('0xd')]);router['get'](_0x1f81('0xe'),auth[_0x1f81('0xc')](),controller[_0x1f81('0xf')]);router['post']('/',auth[_0x1f81('0xc')](),controller[_0x1f81('0x10')]);router['put'](_0x1f81('0xe'),auth['isAuthenticated'](),controller[_0x1f81('0x11')]);router[_0x1f81('0x12')](_0x1f81('0xe'),auth[_0x1f81('0xc')](),controller[_0x1f81('0x13')]);module[_0x1f81('0x14')]=router; \ No newline at end of file +var _0xb114=['delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','isAuthenticated','index','get','/:id','show','post','create','update'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0xb114,0x11f));var _0x4b11=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xb114[_0x465a0c];return _0x1e202e;};'use strict';var multer=require(_0x4b11('0x0'));var util=require('util');var path=require(_0x4b11('0x1'));var timeout=require(_0x4b11('0x2'));var express=require('express');var router=express[_0x4b11('0x3')]();var fs_extra=require(_0x4b11('0x4'));var auth=require(_0x4b11('0x5'));var interaction=require(_0x4b11('0x6'));var config=require(_0x4b11('0x7'));var controller=require(_0x4b11('0x8'));router['get']('/',auth[_0x4b11('0x9')](),controller[_0x4b11('0xa')]);router[_0x4b11('0xb')](_0x4b11('0xc'),auth[_0x4b11('0x9')](),controller[_0x4b11('0xd')]);router[_0x4b11('0xe')]('/',auth['isAuthenticated'](),controller[_0x4b11('0xf')]);router['put'](_0x4b11('0xc'),auth[_0x4b11('0x9')](),controller[_0x4b11('0x10')]);router[_0x4b11('0x11')](_0x4b11('0xc'),auth[_0x4b11('0x9')](),controller['destroy']);module[_0x4b11('0x12')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index f2aeadd..2350396 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 _0x90f1=['sequelize','exports','STRING','TEXT'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x90f1,0x104));var _0x190f=function(_0x42383b,_0x418218){_0x42383b=_0x42383b-0x0;var _0x529a39=_0x90f1[_0x42383b];return _0x529a39;};'use strict';var Sequelize=require(_0x190f('0x0'));module[_0x190f('0x1')]={'name':{'type':Sequelize[_0x190f('0x2')]},'description':{'type':Sequelize[_0x190f('0x2')]},'html':{'type':Sequelize[_0x190f('0x3')]}}; \ No newline at end of file +var _0xabb2=['STRING','TEXT','sequelize','exports'];(function(_0x3eb404,_0x2b5ef4){var _0x280753=function(_0x37b32b){while(--_0x37b32b){_0x3eb404['push'](_0x3eb404['shift']());}};_0x280753(++_0x2b5ef4);}(_0xabb2,0x142));var _0x2abb=function(_0x112fe3,_0x16b642){_0x112fe3=_0x112fe3-0x0;var _0x1ec903=_0xabb2[_0x112fe3];return _0x1ec903;};'use strict';var Sequelize=require(_0x2abb('0x0'));module[_0x2abb('0x1')]={'name':{'type':Sequelize[_0x2abb('0x2')]},'description':{'type':Sequelize[_0x2abb('0x2')]},'html':{'type':Sequelize[_0x2abb('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 2c41e0e..d3cc781 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 _0x8799=['sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','save','then','destroy','get','Templates','UserProfileResource','error','stack','name','send','index','map','Template','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','catch','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','eml-format','rimraf','moment','bluebird','path','sox','to-csv','ejs','lodash','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x45e9a1,_0x1f5b6e){var _0x4e3485=function(_0x5eb41a){while(--_0x5eb41a){_0x45e9a1['push'](_0x45e9a1['shift']());}};_0x4e3485(++_0x1f5b6e);}(_0x8799,0x12e));var _0x9879=function(_0x10c24f,_0x1e905d){_0x10c24f=_0x10c24f-0x0;var _0xf268bd=_0x8799[_0x10c24f];return _0xf268bd;};'use strict';var emlformat=require(_0x9879('0x0'));var rimraf=require(_0x9879('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9879('0x2'));var BPromise=require(_0x9879('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9879('0x4'));var sox=require(_0x9879('0x5'));var csv=require(_0x9879('0x6'));var ejs=require(_0x9879('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9879('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9879('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9879('0xa'));var qs=require(_0x9879('0xb'));var as=require(_0x9879('0xc'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9879('0xd'))('api');var utils=require(_0x9879('0xe'));var config=require(_0x9879('0xf'));var licenseUtil=require(_0x9879('0x10'));var db=require(_0x9879('0x11'))['db'];function respondWithStatusCode(_0x2d1051,_0x5513b0){_0x5513b0=_0x5513b0||0xcc;return function(_0x321bb8){if(_0x321bb8){return _0x2d1051[_0x9879('0x12')](_0x5513b0);}return _0x2d1051[_0x9879('0x13')](_0x5513b0)[_0x9879('0x14')]();};}function respondWithResult(_0x19a0f1,_0x1634d5){_0x1634d5=_0x1634d5||0xc8;return function(_0x1afdb2){if(_0x1afdb2){return _0x19a0f1[_0x9879('0x13')](_0x1634d5)[_0x9879('0x15')](_0x1afdb2);}};}function respondWithFilteredResult(_0x19865a,_0x5cee39){return function(_0x375b4e){if(_0x375b4e){var _0xe7b164=typeof _0x5cee39['offset']===_0x9879('0x16')&&typeof _0x5cee39[_0x9879('0x17')]===_0x9879('0x16');var _0x5c3e44=_0x375b4e['count'];var _0x3ad203=_0xe7b164?0x0:_0x5cee39[_0x9879('0x18')];var _0xebe9f8=_0xe7b164?_0x375b4e[_0x9879('0x19')]:_0x5cee39['offset']+_0x5cee39[_0x9879('0x17')];var _0x233eff;if(_0xebe9f8>=_0x5c3e44){_0xebe9f8=_0x5c3e44;_0x233eff=0xc8;}else{_0x233eff=0xce;}_0x19865a['status'](_0x233eff);return _0x19865a['set'](_0x9879('0x1a'),_0x3ad203+'-'+_0xebe9f8+'/'+_0x5c3e44)[_0x9879('0x15')](_0x375b4e);}return null;};}function patchUpdates(_0x35e680){return function(_0x59e015){try{jsonpatch[_0x9879('0x1b')](_0x59e015,_0x35e680,!![]);}catch(_0x132b99){return BPromise[_0x9879('0x1c')](_0x132b99);}return _0x59e015[_0x9879('0x1d')]();};}function saveUpdates(_0x2dbffc,_0x11f02a){return function(_0x103fd4){if(_0x103fd4){return _0x103fd4['update'](_0x2dbffc)[_0x9879('0x1e')](function(_0x510ccd){return _0x510ccd;});}return null;};}function removeEntity(_0x57c323,_0x2ee358){return function(_0x2c41ca){if(_0x2c41ca){return _0x2c41ca[_0x9879('0x1f')]()[_0x9879('0x1e')](function(){var _0xa70ba2=_0x2c41ca[_0x9879('0x20')]({'plain':!![]});var _0x148727=_0x9879('0x21');return db[_0x9879('0x22')][_0x9879('0x1f')]({'where':{'type':_0x148727,'resourceId':_0xa70ba2['id']}})[_0x9879('0x1e')](function(){return _0x2c41ca;});})[_0x9879('0x1e')](function(){_0x57c323[_0x9879('0x13')](0xcc)[_0x9879('0x14')]();});}};}function handleEntityNotFound(_0x20a271,_0x4ba24f){return function(_0x5b3e4b){if(!_0x5b3e4b){_0x20a271['sendStatus'](0x194);}return _0x5b3e4b;};}function handleError(_0x506cee,_0x37829c){_0x37829c=_0x37829c||0x1f4;return function(_0x15f330){logger[_0x9879('0x23')](_0x15f330[_0x9879('0x24')]);if(_0x15f330[_0x9879('0x25')]){delete _0x15f330[_0x9879('0x25')];}_0x506cee[_0x9879('0x13')](_0x37829c)[_0x9879('0x26')](_0x15f330);};}exports[_0x9879('0x27')]=function(_0x266197,_0xd041ef){var _0x57e785={},_0x24fe99={},_0x2eadfa={'count':0x0,'rows':[]};var _0x4cdb9a=_[_0x9879('0x28')](db[_0x9879('0x29')][_0x9879('0x2a')],function(_0x3f349f){return{'name':_0x3f349f['fieldName'],'type':_0x3f349f[_0x9879('0x2b')][_0x9879('0x2c')]};});_0x24fe99[_0x9879('0x2d')]=_[_0x9879('0x28')](_0x4cdb9a,_0x9879('0x25'));_0x24fe99[_0x9879('0x2e')]=_[_0x9879('0x2f')](_0x266197[_0x9879('0x2e')]);_0x24fe99['filters']=_[_0x9879('0x30')](_0x24fe99[_0x9879('0x2d')],_0x24fe99[_0x9879('0x2e')]);_0x57e785['attributes']=_['intersection'](_0x24fe99[_0x9879('0x2d')],qs[_0x9879('0x31')](_0x266197[_0x9879('0x2e')][_0x9879('0x31')]));_0x57e785[_0x9879('0x32')]=_0x57e785[_0x9879('0x32')][_0x9879('0x33')]?_0x57e785['attributes']:_0x24fe99['model'];if(!_0x266197[_0x9879('0x2e')]['hasOwnProperty'](_0x9879('0x34'))){_0x57e785[_0x9879('0x17')]=qs[_0x9879('0x17')](_0x266197[_0x9879('0x2e')]['limit']);_0x57e785[_0x9879('0x18')]=qs[_0x9879('0x18')](_0x266197[_0x9879('0x2e')][_0x9879('0x18')]);}_0x57e785[_0x9879('0x35')]=qs[_0x9879('0x36')](_0x266197[_0x9879('0x2e')]['sort']);_0x57e785['where']=qs[_0x9879('0x37')](_[_0x9879('0x38')](_0x266197[_0x9879('0x2e')],_0x24fe99[_0x9879('0x37')]),_0x4cdb9a);if(_0x266197[_0x9879('0x2e')][_0x9879('0x39')]){_0x57e785[_0x9879('0x3a')]=_[_0x9879('0x3b')](_0x57e785[_0x9879('0x3a')],{'$or':_['map'](_0x4cdb9a,function(_0x367be9){if(_0x367be9['type']!==_0x9879('0x3c')){var _0x4251b5={};_0x4251b5[_0x367be9[_0x9879('0x25')]]={'$like':'%'+_0x266197[_0x9879('0x2e')][_0x9879('0x39')]+'%'};return _0x4251b5;}})});}_0x57e785=_[_0x9879('0x3b')]({},_0x57e785,_0x266197[_0x9879('0x3d')]);var _0x1ca217={'where':_0x57e785[_0x9879('0x3a')]};return db['Template'][_0x9879('0x19')](_0x1ca217)[_0x9879('0x1e')](function(_0x29c2a3){_0x2eadfa[_0x9879('0x19')]=_0x29c2a3;if(_0x266197[_0x9879('0x2e')][_0x9879('0x3e')]){_0x57e785[_0x9879('0x3f')]=[{'all':!![]}];}return db[_0x9879('0x29')][_0x9879('0x40')](_0x57e785);})['then'](function(_0x586c90){_0x2eadfa[_0x9879('0x41')]=_0x586c90;return _0x2eadfa;})[_0x9879('0x1e')](respondWithFilteredResult(_0xd041ef,_0x57e785))['catch'](handleError(_0xd041ef,null));};exports[_0x9879('0x42')]=function(_0x6a2fb3,_0x5c939f){var _0x24abd3={'raw':!![],'where':{'id':_0x6a2fb3[_0x9879('0x43')]['id']}},_0x9b9abc={};_0x9b9abc[_0x9879('0x2d')]=_[_0x9879('0x2f')](db['Template'][_0x9879('0x2a')]);_0x9b9abc['query']=_['keys'](_0x6a2fb3['query']);_0x9b9abc[_0x9879('0x37')]=_[_0x9879('0x30')](_0x9b9abc[_0x9879('0x2d')],_0x9b9abc['query']);_0x24abd3[_0x9879('0x32')]=_[_0x9879('0x30')](_0x9b9abc[_0x9879('0x2d')],qs[_0x9879('0x31')](_0x6a2fb3[_0x9879('0x2e')]['fields']));_0x24abd3[_0x9879('0x32')]=_0x24abd3[_0x9879('0x32')][_0x9879('0x33')]?_0x24abd3[_0x9879('0x32')]:_0x9b9abc['model'];if(_0x6a2fb3[_0x9879('0x2e')][_0x9879('0x3e')]){_0x24abd3['include']=[{'all':!![]}];}_0x24abd3=_['merge']({},_0x24abd3,_0x6a2fb3['options']);return db['Template']['find'](_0x24abd3)['then'](handleEntityNotFound(_0x5c939f,null))[_0x9879('0x1e')](respondWithResult(_0x5c939f,null))[_0x9879('0x44')](handleError(_0x5c939f,null));};exports['create']=function(_0x155b82,_0x325ca3){return db[_0x9879('0x29')][_0x9879('0x45')](_0x155b82[_0x9879('0x46')],{})[_0x9879('0x1e')](function(_0x43b986){var _0x5411d8=_0x155b82[_0x9879('0x47')]['get']({'plain':!![]});if(!_0x5411d8)throw new Error(_0x9879('0x48'));if(_0x5411d8[_0x9879('0x49')]===_0x9879('0x47')){var _0x27fad9=_0x43b986[_0x9879('0x20')]({'plain':!![]});var _0x1be740=_0x9879('0x21');return db[_0x9879('0x4a')][_0x9879('0x4b')]({'where':{'name':_0x1be740,'userProfileId':_0x5411d8[_0x9879('0x4c')]},'raw':!![]})[_0x9879('0x1e')](function(_0x53f352){if(_0x53f352&&_0x53f352[_0x9879('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x27fad9[_0x9879('0x25')],'resourceId':_0x27fad9['id'],'type':_0x53f352['name'],'sectionId':_0x53f352['id']},{})[_0x9879('0x1e')](function(){return _0x43b986;});}else{return _0x43b986;}})[_0x9879('0x44')](function(_0x4d9b37){logger[_0x9879('0x23')](_0x9879('0x4e'),_0x4d9b37);throw _0x4d9b37;});}return _0x43b986;})[_0x9879('0x1e')](respondWithResult(_0x325ca3,0xc9))['catch'](handleError(_0x325ca3,null));};exports[_0x9879('0x4f')]=function(_0x311d81,_0x4af1e5){if(_0x311d81[_0x9879('0x46')]['id']){delete _0x311d81[_0x9879('0x46')]['id'];}return db[_0x9879('0x29')][_0x9879('0x4b')]({'where':{'id':_0x311d81[_0x9879('0x43')]['id']}})[_0x9879('0x1e')](handleEntityNotFound(_0x4af1e5,null))[_0x9879('0x1e')](saveUpdates(_0x311d81[_0x9879('0x46')],null))['then'](respondWithResult(_0x4af1e5,null))['catch'](handleError(_0x4af1e5,null));};exports[_0x9879('0x1f')]=function(_0x613e98,_0x4ef81f){return db[_0x9879('0x29')]['find']({'where':{'id':_0x613e98[_0x9879('0x43')]['id']}})[_0x9879('0x1e')](handleEntityNotFound(_0x4ef81f,null))[_0x9879('0x1e')](removeEntity(_0x4ef81f,null))[_0x9879('0x44')](handleError(_0x4ef81f,null));}; \ No newline at end of file +var _0xf950=['save','update','then','destroy','get','UserProfileResource','end','error','stack','name','index','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','length','nolimit','order','sort','where','pick','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','intersection','fields','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Templates','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject'];(function(_0x3fd9d8,_0x9a1892){var _0x181131=function(_0x5a0d16){while(--_0x5a0d16){_0x3fd9d8['push'](_0x3fd9d8['shift']());}};_0x181131(++_0x9a1892);}(_0xf950,0x1e5));var _0x0f95=function(_0x40300e,_0x3d90d9){_0x40300e=_0x40300e-0x0;var _0x549d22=_0xf950[_0x40300e];return _0x549d22;};'use strict';var emlformat=require(_0x0f95('0x0'));var rimraf=require(_0x0f95('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0f95('0x2'));var rp=require(_0x0f95('0x3'));var moment=require(_0x0f95('0x4'));var BPromise=require(_0x0f95('0x5'));var Mustache=require(_0x0f95('0x6'));var util=require(_0x0f95('0x7'));var path=require(_0x0f95('0x8'));var sox=require(_0x0f95('0x9'));var csv=require(_0x0f95('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0f95('0xb'));var _=require(_0x0f95('0xc'));var squel=require(_0x0f95('0xd'));var crypto=require('crypto');var jsforce=require(_0x0f95('0xe'));var deskjs=require(_0x0f95('0xf'));var toCsv=require(_0x0f95('0xa'));var querystring=require(_0x0f95('0x10'));var Papa=require(_0x0f95('0x11'));var Redis=require(_0x0f95('0x12'));var authService=require(_0x0f95('0x13'));var qs=require(_0x0f95('0x14'));var as=require(_0x0f95('0x15'));var hardwareService=require(_0x0f95('0x16'));var logger=require('../../config/logger')(_0x0f95('0x17'));var utils=require(_0x0f95('0x18'));var config=require(_0x0f95('0x19'));var licenseUtil=require(_0x0f95('0x1a'));var db=require(_0x0f95('0x1b'))['db'];function respondWithStatusCode(_0x5c8514,_0x3194cd){_0x3194cd=_0x3194cd||0xcc;return function(_0x511bf8){if(_0x511bf8){return _0x5c8514[_0x0f95('0x1c')](_0x3194cd);}return _0x5c8514[_0x0f95('0x1d')](_0x3194cd)['end']();};}function respondWithResult(_0x284382,_0x3ad6e2){_0x3ad6e2=_0x3ad6e2||0xc8;return function(_0xfcae6a){if(_0xfcae6a){return _0x284382[_0x0f95('0x1d')](_0x3ad6e2)[_0x0f95('0x1e')](_0xfcae6a);}};}function respondWithFilteredResult(_0x4119f0,_0x456142){return function(_0x4935b5){if(_0x4935b5){var _0x3d7329=typeof _0x456142[_0x0f95('0x1f')]===_0x0f95('0x20')&&typeof _0x456142[_0x0f95('0x21')]===_0x0f95('0x20');var _0x544fc0=_0x4935b5[_0x0f95('0x22')];var _0x8ca61f=_0x3d7329?0x0:_0x456142[_0x0f95('0x1f')];var _0x3fa3ac=_0x3d7329?_0x4935b5['count']:_0x456142['offset']+_0x456142[_0x0f95('0x21')];var _0xe4056a;if(_0x3fa3ac>=_0x544fc0){_0x3fa3ac=_0x544fc0;_0xe4056a=0xc8;}else{_0xe4056a=0xce;}_0x4119f0[_0x0f95('0x1d')](_0xe4056a);return _0x4119f0['set'](_0x0f95('0x23'),_0x8ca61f+'-'+_0x3fa3ac+'/'+_0x544fc0)[_0x0f95('0x1e')](_0x4935b5);}return null;};}function patchUpdates(_0x1e75f5){return function(_0x1e0e3b){try{jsonpatch['apply'](_0x1e0e3b,_0x1e75f5,!![]);}catch(_0x55ed71){return BPromise[_0x0f95('0x24')](_0x55ed71);}return _0x1e0e3b[_0x0f95('0x25')]();};}function saveUpdates(_0x85868c,_0x2b1e4c){return function(_0x1bcd93){if(_0x1bcd93){return _0x1bcd93[_0x0f95('0x26')](_0x85868c)[_0x0f95('0x27')](function(_0x5da9f4){return _0x5da9f4;});}return null;};}function removeEntity(_0x1863dd,_0x53e1e7){return function(_0x3c46a4){if(_0x3c46a4){return _0x3c46a4[_0x0f95('0x28')]()['then'](function(){var _0x4061bb=_0x3c46a4[_0x0f95('0x29')]({'plain':!![]});var _0x200b9c='Templates';return db[_0x0f95('0x2a')]['destroy']({'where':{'type':_0x200b9c,'resourceId':_0x4061bb['id']}})[_0x0f95('0x27')](function(){return _0x3c46a4;});})[_0x0f95('0x27')](function(){_0x1863dd[_0x0f95('0x1d')](0xcc)[_0x0f95('0x2b')]();});}};}function handleEntityNotFound(_0x8bfdc8,_0x59fae3){return function(_0xc5bfbf){if(!_0xc5bfbf){_0x8bfdc8['sendStatus'](0x194);}return _0xc5bfbf;};}function handleError(_0x235c92,_0x11b1de){_0x11b1de=_0x11b1de||0x1f4;return function(_0x44e66d){logger[_0x0f95('0x2c')](_0x44e66d[_0x0f95('0x2d')]);if(_0x44e66d[_0x0f95('0x2e')]){delete _0x44e66d[_0x0f95('0x2e')];}_0x235c92[_0x0f95('0x1d')](_0x11b1de)['send'](_0x44e66d);};}exports[_0x0f95('0x2f')]=function(_0x3e4195,_0x5320a9){var _0x1cfd97={},_0x26b92d={},_0x12a08d={'count':0x0,'rows':[]};var _0x409cc6=_['map'](db[_0x0f95('0x30')][_0x0f95('0x31')],function(_0x32884d){return{'name':_0x32884d[_0x0f95('0x32')],'type':_0x32884d[_0x0f95('0x33')][_0x0f95('0x34')]};});_0x26b92d[_0x0f95('0x35')]=_['map'](_0x409cc6,_0x0f95('0x2e'));_0x26b92d[_0x0f95('0x36')]=_[_0x0f95('0x37')](_0x3e4195[_0x0f95('0x36')]);_0x26b92d[_0x0f95('0x38')]=_['intersection'](_0x26b92d['model'],_0x26b92d[_0x0f95('0x36')]);_0x1cfd97[_0x0f95('0x39')]=_['intersection'](_0x26b92d[_0x0f95('0x35')],qs['fields'](_0x3e4195[_0x0f95('0x36')]['fields']));_0x1cfd97[_0x0f95('0x39')]=_0x1cfd97[_0x0f95('0x39')][_0x0f95('0x3a')]?_0x1cfd97[_0x0f95('0x39')]:_0x26b92d[_0x0f95('0x35')];if(!_0x3e4195[_0x0f95('0x36')]['hasOwnProperty'](_0x0f95('0x3b'))){_0x1cfd97['limit']=qs[_0x0f95('0x21')](_0x3e4195[_0x0f95('0x36')]['limit']);_0x1cfd97['offset']=qs['offset'](_0x3e4195[_0x0f95('0x36')][_0x0f95('0x1f')]);}_0x1cfd97[_0x0f95('0x3c')]=qs[_0x0f95('0x3d')](_0x3e4195[_0x0f95('0x36')][_0x0f95('0x3d')]);_0x1cfd97[_0x0f95('0x3e')]=qs['filters'](_[_0x0f95('0x3f')](_0x3e4195[_0x0f95('0x36')],_0x26b92d[_0x0f95('0x38')]),_0x409cc6);if(_0x3e4195['query']['filter']){_0x1cfd97['where']=_[_0x0f95('0x40')](_0x1cfd97[_0x0f95('0x3e')],{'$or':_[_0x0f95('0x41')](_0x409cc6,function(_0x378ba2){if(_0x378ba2[_0x0f95('0x33')]!==_0x0f95('0x42')){var _0x4f2cb1={};_0x4f2cb1[_0x378ba2[_0x0f95('0x2e')]]={'$like':'%'+_0x3e4195[_0x0f95('0x36')][_0x0f95('0x43')]+'%'};return _0x4f2cb1;}})});}_0x1cfd97=_[_0x0f95('0x40')]({},_0x1cfd97,_0x3e4195[_0x0f95('0x44')]);var _0x1b68df={'where':_0x1cfd97[_0x0f95('0x3e')]};return db[_0x0f95('0x30')][_0x0f95('0x22')](_0x1b68df)[_0x0f95('0x27')](function(_0x1bcfdc){_0x12a08d[_0x0f95('0x22')]=_0x1bcfdc;if(_0x3e4195['query'][_0x0f95('0x45')]){_0x1cfd97[_0x0f95('0x46')]=[{'all':!![]}];}return db[_0x0f95('0x30')][_0x0f95('0x47')](_0x1cfd97);})[_0x0f95('0x27')](function(_0x2d8b9b){_0x12a08d[_0x0f95('0x48')]=_0x2d8b9b;return _0x12a08d;})[_0x0f95('0x27')](respondWithFilteredResult(_0x5320a9,_0x1cfd97))['catch'](handleError(_0x5320a9,null));};exports[_0x0f95('0x49')]=function(_0x273fce,_0x2f23f8){var _0x30516b={'raw':!![],'where':{'id':_0x273fce['params']['id']}},_0x263e0b={};_0x263e0b['model']=_['keys'](db['Template'][_0x0f95('0x31')]);_0x263e0b['query']=_[_0x0f95('0x37')](_0x273fce[_0x0f95('0x36')]);_0x263e0b[_0x0f95('0x38')]=_[_0x0f95('0x4a')](_0x263e0b[_0x0f95('0x35')],_0x263e0b[_0x0f95('0x36')]);_0x30516b[_0x0f95('0x39')]=_['intersection'](_0x263e0b[_0x0f95('0x35')],qs[_0x0f95('0x4b')](_0x273fce[_0x0f95('0x36')]['fields']));_0x30516b['attributes']=_0x30516b[_0x0f95('0x39')]['length']?_0x30516b['attributes']:_0x263e0b[_0x0f95('0x35')];if(_0x273fce[_0x0f95('0x36')][_0x0f95('0x45')]){_0x30516b[_0x0f95('0x46')]=[{'all':!![]}];}_0x30516b=_[_0x0f95('0x40')]({},_0x30516b,_0x273fce['options']);return db['Template'][_0x0f95('0x4c')](_0x30516b)['then'](handleEntityNotFound(_0x2f23f8,null))[_0x0f95('0x27')](respondWithResult(_0x2f23f8,null))[_0x0f95('0x4d')](handleError(_0x2f23f8,null));};exports[_0x0f95('0x4e')]=function(_0x26530f,_0x2d2638){return db[_0x0f95('0x30')][_0x0f95('0x4e')](_0x26530f[_0x0f95('0x4f')],{})[_0x0f95('0x27')](function(_0x4e85e3){var _0x5d1728=_0x26530f[_0x0f95('0x50')][_0x0f95('0x29')]({'plain':!![]});if(!_0x5d1728)throw new Error(_0x0f95('0x51'));if(_0x5d1728['role']===_0x0f95('0x50')){var _0xc38744=_0x4e85e3['get']({'plain':!![]});var _0x75c0cb=_0x0f95('0x52');return db[_0x0f95('0x53')]['find']({'where':{'name':_0x75c0cb,'userProfileId':_0x5d1728['userProfileId']},'raw':!![]})[_0x0f95('0x27')](function(_0x3201a7){if(_0x3201a7&&_0x3201a7[_0x0f95('0x54')]===0x0){return db[_0x0f95('0x2a')][_0x0f95('0x4e')]({'name':_0xc38744[_0x0f95('0x2e')],'resourceId':_0xc38744['id'],'type':_0x3201a7[_0x0f95('0x2e')],'sectionId':_0x3201a7['id']},{})['then'](function(){return _0x4e85e3;});}else{return _0x4e85e3;}})[_0x0f95('0x4d')](function(_0x186f41){logger[_0x0f95('0x2c')](_0x0f95('0x55'),_0x186f41);throw _0x186f41;});}return _0x4e85e3;})['then'](respondWithResult(_0x2d2638,0xc9))[_0x0f95('0x4d')](handleError(_0x2d2638,null));};exports[_0x0f95('0x26')]=function(_0x4d453b,_0x5cd49f){if(_0x4d453b['body']['id']){delete _0x4d453b['body']['id'];}return db[_0x0f95('0x30')][_0x0f95('0x4c')]({'where':{'id':_0x4d453b[_0x0f95('0x56')]['id']}})[_0x0f95('0x27')](handleEntityNotFound(_0x5cd49f,null))[_0x0f95('0x27')](saveUpdates(_0x4d453b['body'],null))[_0x0f95('0x27')](respondWithResult(_0x5cd49f,null))[_0x0f95('0x4d')](handleError(_0x5cd49f,null));};exports[_0x0f95('0x28')]=function(_0x31e631,_0x2dc611){return db[_0x0f95('0x30')][_0x0f95('0x4c')]({'where':{'id':_0x31e631[_0x0f95('0x56')]['id']}})[_0x0f95('0x27')](handleEntityNotFound(_0x2dc611,null))[_0x0f95('0x27')](removeEntity(_0x2dc611,null))[_0x0f95('0x4d')](handleError(_0x2dc611,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 6b54900..b5a9e14 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 _0xb095=['exports','define','Template','tools_templates','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes'];(function(_0x123405,_0x5b35df){var _0x570572=function(_0x366913){while(--_0x366913){_0x123405['push'](_0x123405['shift']());}};_0x570572(++_0x5b35df);}(_0xb095,0x163));var _0x5b09=function(_0x78d776,_0x46eee0){_0x78d776=_0x78d776-0x0;var _0x1eb9ff=_0xb095[_0x78d776];return _0x1eb9ff;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5b09('0x0'))(_0x5b09('0x1'));var moment=require(_0x5b09('0x2'));var BPromise=require(_0x5b09('0x3'));var rp=require(_0x5b09('0x4'));var fs=require('fs');var path=require(_0x5b09('0x5'));var rimraf=require(_0x5b09('0x6'));var config=require(_0x5b09('0x7'));var attributes=require(_0x5b09('0x8'));module[_0x5b09('0x9')]=function(_0xb973e,_0x3012b4){return _0xb973e[_0x5b09('0xa')](_0x5b09('0xb'),attributes,{'tableName':_0x5b09('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb06=['request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash','util','../../config/logger','api','bluebird'];(function(_0x22fc27,_0x38b151){var _0x1b22c2=function(_0x379015){while(--_0x379015){_0x22fc27['push'](_0x22fc27['shift']());}};_0x1b22c2(++_0x38b151);}(_0xbb06,0x13d));var _0x6bb0=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xbb06[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0x6bb0('0x0'));var util=require(_0x6bb0('0x1'));var logger=require(_0x6bb0('0x2'))(_0x6bb0('0x3'));var moment=require('moment');var BPromise=require(_0x6bb0('0x4'));var rp=require(_0x6bb0('0x5'));var fs=require('fs');var path=require(_0x6bb0('0x6'));var rimraf=require(_0x6bb0('0x7'));var config=require(_0x6bb0('0x8'));var attributes=require(_0x6bb0('0x9'));module[_0x6bb0('0xa')]=function(_0x15d2a3,_0x208147){return _0x15d2a3[_0x6bb0('0xb')](_0x6bb0('0xc'),attributes,{'tableName':_0x6bb0('0xd'),'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 0fb0cc7..5c8c9f1 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 _0x95f4=['request','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTemplate','Template','findAll','options','where','limit','include','map','model','attributes','then','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','client'];(function(_0x7a8139,_0x586ffb){var _0x236231=function(_0x18709d){while(--_0x18709d){_0x7a8139['push'](_0x7a8139['shift']());}};_0x236231(++_0x586ffb);}(_0x95f4,0xbd));var _0x495f=function(_0x449411,_0x533a98){_0x449411=_0x449411-0x0;var _0x5a2b78=_0x95f4[_0x449411];return _0x5a2b78;};'use strict';var _=require(_0x495f('0x0'));var util=require(_0x495f('0x1'));var moment=require(_0x495f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x495f('0x3'))['db'];var utils=require(_0x495f('0x4'));var logger=require(_0x495f('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x495f('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a714d,_0x3300b3,_0x14f3ee){return new BPromise(function(_0x3935a7,_0x36b27e){return client[_0x495f('0x7')](_0x5a714d,_0x14f3ee)['then'](function(_0x16c7e3){logger[_0x495f('0x8')](_0x495f('0x9'),_0x3300b3,_0x495f('0xa'));logger['debug'](_0x495f('0xb'),_0x3300b3,'request\x20sent',JSON[_0x495f('0xc')](_0x16c7e3));if(_0x16c7e3[_0x495f('0xd')]){if(_0x16c7e3[_0x495f('0xd')][_0x495f('0xe')]===0x1f4){logger['error'](_0x495f('0x9'),_0x3300b3,_0x16c7e3[_0x495f('0xd')][_0x495f('0xf')]);return _0x36b27e(_0x16c7e3[_0x495f('0xd')]['message']);}logger['error'](_0x495f('0x9'),_0x3300b3,_0x16c7e3[_0x495f('0xd')]['message']);return _0x3935a7(_0x16c7e3[_0x495f('0xd')][_0x495f('0xf')]);}else{logger[_0x495f('0x8')]('Template,\x20%s,\x20%s',_0x3300b3,_0x495f('0xa'));_0x3935a7(_0x16c7e3['result'][_0x495f('0xf')]);}})[_0x495f('0x10')](function(_0x44b597){logger['error'](_0x495f('0x9'),_0x3300b3,_0x44b597);_0x36b27e(_0x44b597);});});}exports[_0x495f('0x11')]=function(_0x547a05){var _0x50117f=this;return new Promise(function(_0x434dc5,_0x23f63c){return db[_0x495f('0x12')][_0x495f('0x13')]({'raw':_0x547a05[_0x495f('0x14')]?_0x547a05[_0x495f('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x547a05[_0x495f('0x14')]?_0x547a05[_0x495f('0x14')][_0x495f('0x15')]||null:null,'attributes':_0x547a05[_0x495f('0x14')]?_0x547a05[_0x495f('0x14')]['attributes']||null:null,'limit':_0x547a05[_0x495f('0x14')]?_0x547a05['options'][_0x495f('0x16')]||null:null,'include':_0x547a05[_0x495f('0x14')]?_0x547a05[_0x495f('0x14')][_0x495f('0x17')]?_[_0x495f('0x18')](_0x547a05[_0x495f('0x14')][_0x495f('0x17')],function(_0x552e9c){return{'model':db[_0x552e9c['model']],'as':_0x552e9c['as'],'attributes':_0x552e9c['attributes'],'include':_0x552e9c[_0x495f('0x17')]?_[_0x495f('0x18')](_0x552e9c[_0x495f('0x17')],function(_0x594ae3){return{'model':db[_0x594ae3[_0x495f('0x19')]],'as':_0x594ae3['as'],'attributes':_0x594ae3[_0x495f('0x1a')],'include':_0x594ae3[_0x495f('0x17')]?_['map'](_0x594ae3[_0x495f('0x17')],function(_0x536410){return{'model':db[_0x536410[_0x495f('0x19')]],'as':_0x536410['as'],'attributes':_0x536410[_0x495f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x495f('0x1b')](function(_0x21f2ec){logger[_0x495f('0x8')](_0x495f('0x11'),_0x547a05);logger['debug'](_0x495f('0x11'),_0x547a05,JSON[_0x495f('0xc')](_0x21f2ec));_0x434dc5(_0x21f2ec);})[_0x495f('0x10')](function(_0x18c043){logger[_0x495f('0xd')](_0x495f('0x11'),_0x18c043[_0x495f('0xf')],_0x547a05);_0x23f63c(_0x50117f[_0x495f('0xd')](0x1f4,_0x18c043['message']));});});}; \ No newline at end of file +var _0xe94c=['where','attributes','limit','include','map','model','then','debug','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Template,\x20%s,\x20%s','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetTemplate','Template','options','raw'];(function(_0x4e9d4d,_0x38114f){var _0x297012=function(_0x57b1f7){while(--_0x57b1f7){_0x4e9d4d['push'](_0x4e9d4d['shift']());}};_0x297012(++_0x38114f);}(_0xe94c,0x153));var _0xce94=function(_0x57be2f,_0x59e3fe){_0x57be2f=_0x57be2f-0x0;var _0x52503d=_0xe94c[_0x57be2f];return _0x52503d;};'use strict';var _=require(_0xce94('0x0'));var util=require('util');var moment=require(_0xce94('0x1'));var BPromise=require('bluebird');var rs=require(_0xce94('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xce94('0x3'))['db'];var utils=require(_0xce94('0x4'));var logger=require(_0xce94('0x5'))('rpc');var config=require(_0xce94('0x6'));var jayson=require(_0xce94('0x7'));var client=jayson[_0xce94('0x8')][_0xce94('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c7c70,_0x3eec34,_0x189205){return new BPromise(function(_0xd51861,_0x40bc36){return client[_0xce94('0xa')](_0x5c7c70,_0x189205)['then'](function(_0x374dd6){logger[_0xce94('0xb')](_0xce94('0xc'),_0x3eec34,'request\x20sent');logger['debug'](_0xce94('0xd'),_0x3eec34,_0xce94('0xe'),JSON[_0xce94('0xf')](_0x374dd6));if(_0x374dd6[_0xce94('0x10')]){if(_0x374dd6[_0xce94('0x10')][_0xce94('0x11')]===0x1f4){logger['error'](_0xce94('0xc'),_0x3eec34,_0x374dd6['error']['message']);return _0x40bc36(_0x374dd6['error'][_0xce94('0x12')]);}logger[_0xce94('0x10')]('Template,\x20%s,\x20%s',_0x3eec34,_0x374dd6['error']['message']);return _0xd51861(_0x374dd6[_0xce94('0x10')][_0xce94('0x12')]);}else{logger[_0xce94('0xb')]('Template,\x20%s,\x20%s',_0x3eec34,_0xce94('0xe'));_0xd51861(_0x374dd6[_0xce94('0x13')]['message']);}})['catch'](function(_0x504824){logger['error'](_0xce94('0xc'),_0x3eec34,_0x504824);_0x40bc36(_0x504824);});});}exports[_0xce94('0x14')]=function(_0x2606b4){var _0x1cdcb8=this;return new Promise(function(_0x469f80,_0x30ea49){return db[_0xce94('0x15')]['findAll']({'raw':_0x2606b4['options']?_0x2606b4[_0xce94('0x16')][_0xce94('0x17')]===undefined?!![]:![]:!![],'where':_0x2606b4[_0xce94('0x16')]?_0x2606b4[_0xce94('0x16')][_0xce94('0x18')]||null:null,'attributes':_0x2606b4[_0xce94('0x16')]?_0x2606b4['options'][_0xce94('0x19')]||null:null,'limit':_0x2606b4[_0xce94('0x16')]?_0x2606b4[_0xce94('0x16')][_0xce94('0x1a')]||null:null,'include':_0x2606b4['options']?_0x2606b4[_0xce94('0x16')][_0xce94('0x1b')]?_[_0xce94('0x1c')](_0x2606b4[_0xce94('0x16')][_0xce94('0x1b')],function(_0xe912d8){return{'model':db[_0xe912d8[_0xce94('0x1d')]],'as':_0xe912d8['as'],'attributes':_0xe912d8[_0xce94('0x19')],'include':_0xe912d8[_0xce94('0x1b')]?_[_0xce94('0x1c')](_0xe912d8['include'],function(_0x95c4f3){return{'model':db[_0x95c4f3['model']],'as':_0x95c4f3['as'],'attributes':_0x95c4f3[_0xce94('0x19')],'include':_0x95c4f3[_0xce94('0x1b')]?_['map'](_0x95c4f3[_0xce94('0x1b')],function(_0x306bb2){return{'model':db[_0x306bb2[_0xce94('0x1d')]],'as':_0x306bb2['as'],'attributes':_0x306bb2[_0xce94('0x19')]};}):[]};}):[]};}):[]:[]})[_0xce94('0x1e')](function(_0x423bc7){logger['info'](_0xce94('0x14'),_0x2606b4);logger[_0xce94('0x1f')](_0xce94('0x14'),_0x2606b4,JSON[_0xce94('0xf')](_0x423bc7));_0x469f80(_0x423bc7);})[_0xce94('0x20')](function(_0x4bd59d){logger[_0xce94('0x10')](_0xce94('0x14'),_0x4bd59d[_0xce94('0x12')],_0x2606b4);_0x30ea49(_0x1cdcb8[_0xce94('0x10')](0x1f4,_0x4bd59d[_0xce94('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 6a18656..bb97725 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 _0xef17=['index','/:id','show','/:id/all_conditions','getAllConditions','isAuthenticated','getAnyConditions','getActions','post','create','addAllCondition','addAnyCondition','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x3c22e0,_0x1dc6ea){var _0x215811=function(_0x1b453c){while(--_0x1b453c){_0x3c22e0['push'](_0x3c22e0['shift']());}};_0x215811(++_0x1dc6ea);}(_0xef17,0x1be));var _0x7ef1=function(_0x8161dd,_0x4a2b00){_0x8161dd=_0x8161dd-0x0;var _0x94cdcf=_0xef17[_0x8161dd];return _0x94cdcf;};'use strict';var multer=require(_0x7ef1('0x0'));var util=require(_0x7ef1('0x1'));var path=require(_0x7ef1('0x2'));var timeout=require('connect-timeout');var express=require(_0x7ef1('0x3'));var router=express[_0x7ef1('0x4')]();var fs_extra=require(_0x7ef1('0x5'));var auth=require(_0x7ef1('0x6'));var interaction=require(_0x7ef1('0x7'));var config=require(_0x7ef1('0x8'));var controller=require('./trigger.controller');router[_0x7ef1('0x9')]('/',auth['isAuthenticated'](),controller[_0x7ef1('0xa')]);router[_0x7ef1('0x9')](_0x7ef1('0xb'),auth['isAuthenticated'](),controller[_0x7ef1('0xc')]);router[_0x7ef1('0x9')](_0x7ef1('0xd'),auth['isAuthenticated'](),controller[_0x7ef1('0xe')]);router[_0x7ef1('0x9')]('/:id/any_conditions',auth[_0x7ef1('0xf')](),controller[_0x7ef1('0x10')]);router[_0x7ef1('0x9')]('/:id/actions',auth[_0x7ef1('0xf')](),controller[_0x7ef1('0x11')]);router[_0x7ef1('0x12')]('/',auth[_0x7ef1('0xf')](),controller[_0x7ef1('0x13')]);router[_0x7ef1('0x12')]('/:id/all_conditions',auth[_0x7ef1('0xf')](),controller[_0x7ef1('0x14')]);router[_0x7ef1('0x12')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0x7ef1('0x15')]);router[_0x7ef1('0x12')]('/:id/actions',auth[_0x7ef1('0xf')](),controller['addAction']);router['put'](_0x7ef1('0xb'),auth[_0x7ef1('0xf')](),controller['update']);router[_0x7ef1('0x16')]('/:id',auth[_0x7ef1('0xf')](),controller['destroy']);module[_0x7ef1('0x17')]=router; \ No newline at end of file +var _0x2080=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./trigger.controller','get','isAuthenticated','index','show','/:id/all_conditions','getAnyConditions','getActions','post','create','addAllCondition','/:id/any_conditions','addAction','/:id','update','delete'];(function(_0x5280f4,_0x3c36d0){var _0xba93e7=function(_0x14d63a){while(--_0x14d63a){_0x5280f4['push'](_0x5280f4['shift']());}};_0xba93e7(++_0x3c36d0);}(_0x2080,0x19f));var _0x0208=function(_0x4f33ff,_0x4cc52d){_0x4f33ff=_0x4f33ff-0x0;var _0x40e19c=_0x2080[_0x4f33ff];return _0x40e19c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0208('0x0'));var timeout=require(_0x0208('0x1'));var express=require(_0x0208('0x2'));var router=express[_0x0208('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0208('0x4'));var interaction=require(_0x0208('0x5'));var config=require('../../config/environment');var controller=require(_0x0208('0x6'));router[_0x0208('0x7')]('/',auth[_0x0208('0x8')](),controller[_0x0208('0x9')]);router[_0x0208('0x7')]('/:id',auth[_0x0208('0x8')](),controller[_0x0208('0xa')]);router[_0x0208('0x7')](_0x0208('0xb'),auth[_0x0208('0x8')](),controller['getAllConditions']);router[_0x0208('0x7')]('/:id/any_conditions',auth[_0x0208('0x8')](),controller[_0x0208('0xc')]);router['get']('/:id/actions',auth[_0x0208('0x8')](),controller[_0x0208('0xd')]);router[_0x0208('0xe')]('/',auth[_0x0208('0x8')](),controller[_0x0208('0xf')]);router[_0x0208('0xe')](_0x0208('0xb'),auth[_0x0208('0x8')](),controller[_0x0208('0x10')]);router['post'](_0x0208('0x11'),auth[_0x0208('0x8')](),controller['addAnyCondition']);router[_0x0208('0xe')]('/:id/actions',auth[_0x0208('0x8')](),controller[_0x0208('0x12')]);router['put'](_0x0208('0x13'),auth['isAuthenticated'](),controller[_0x0208('0x14')]);router[_0x0208('0x15')](_0x0208('0x13'),auth[_0x0208('0x8')](),controller['destroy']);module[_0x0208('0x16')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 1a813fe..7627dee 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 _0x0326=['BOOLEAN','sequelize','exports','STRING'];(function(_0x2407f7,_0x196839){var _0xc02d7c=function(_0x209d8c){while(--_0x209d8c){_0x2407f7['push'](_0x2407f7['shift']());}};_0xc02d7c(++_0x196839);}(_0x0326,0x81));var _0x6032=function(_0x2bcbc8,_0x3d1f69){_0x2bcbc8=_0x2bcbc8-0x0;var _0xf97356=_0x0326[_0x2bcbc8];return _0xf97356;};'use strict';var Sequelize=require(_0x6032('0x0'));module[_0x6032('0x1')]={'name':{'type':Sequelize[_0x6032('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6032('0x2')]},'status':{'type':Sequelize[_0x6032('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x0047=['BOOLEAN','sequelize','exports','STRING'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x0047,0x99));var _0x7004=function(_0x474c66,_0xbce925){_0x474c66=_0x474c66-0x0;var _0xcbd9bf=_0x0047[_0x474c66];return _0xcbd9bf;};'use strict';var Sequelize=require(_0x7004('0x0'));module[_0x7004('0x1')]={'name':{'type':Sequelize[_0x7004('0x2')]},'channel':{'type':Sequelize[_0x7004('0x2')]},'description':{'type':Sequelize[_0x7004('0x2')]},'status':{'type':Sequelize[_0x7004('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 8c9ffae..4c9c261 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 _0xa483=['sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','get','Triggers','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','update','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','nolimit','getAnyConditions','addAction','getActions','Action','eml-format','zip-dir','moment','mustache','util'];(function(_0x1757c8,_0x4aa781){var _0x3059f1=function(_0xb9d7f){while(--_0xb9d7f){_0x1757c8['push'](_0x1757c8['shift']());}};_0x3059f1(++_0x4aa781);}(_0xa483,0x16f));var _0x3a48=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa483[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x3a48('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3a48('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3a48('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3a48('0x3'));var util=require(_0x3a48('0x4'));var path=require('path');var sox=require(_0x3a48('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3a48('0x6'));var _=require(_0x3a48('0x7'));var squel=require(_0x3a48('0x8'));var crypto=require(_0x3a48('0x9'));var jsforce=require(_0x3a48('0xa'));var deskjs=require(_0x3a48('0xb'));var toCsv=require(_0x3a48('0xc'));var querystring=require(_0x3a48('0xd'));var Papa=require(_0x3a48('0xe'));var Redis=require(_0x3a48('0xf'));var authService=require(_0x3a48('0x10'));var qs=require(_0x3a48('0x11'));var as=require(_0x3a48('0x12'));var hardwareService=require(_0x3a48('0x13'));var logger=require(_0x3a48('0x14'))('api');var utils=require(_0x3a48('0x15'));var config=require(_0x3a48('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d211c,_0x5d93bf){_0x5d93bf=_0x5d93bf||0xcc;return function(_0x4f3ba3){if(_0x4f3ba3){return _0x5d211c[_0x3a48('0x17')](_0x5d93bf);}return _0x5d211c[_0x3a48('0x18')](_0x5d93bf)[_0x3a48('0x19')]();};}function respondWithResult(_0x187d4a,_0xb778c4){_0xb778c4=_0xb778c4||0xc8;return function(_0x39d195){if(_0x39d195){return _0x187d4a[_0x3a48('0x18')](_0xb778c4)[_0x3a48('0x1a')](_0x39d195);}};}function respondWithFilteredResult(_0x18c70b,_0x3861ad){return function(_0x505114){if(_0x505114){var _0x1cf2cc=typeof _0x3861ad[_0x3a48('0x1b')]===_0x3a48('0x1c')&&typeof _0x3861ad[_0x3a48('0x1d')]===_0x3a48('0x1c');var _0x580da0=_0x505114[_0x3a48('0x1e')];var _0x5bc8db=_0x1cf2cc?0x0:_0x3861ad['offset'];var _0x15a457=_0x1cf2cc?_0x505114[_0x3a48('0x1e')]:_0x3861ad['offset']+_0x3861ad['limit'];var _0x52e1c7;if(_0x15a457>=_0x580da0){_0x15a457=_0x580da0;_0x52e1c7=0xc8;}else{_0x52e1c7=0xce;}_0x18c70b[_0x3a48('0x18')](_0x52e1c7);return _0x18c70b[_0x3a48('0x1f')]('Content-Range',_0x5bc8db+'-'+_0x15a457+'/'+_0x580da0)['json'](_0x505114);}return null;};}function patchUpdates(_0xf6a159){return function(_0x1b956e){try{jsonpatch[_0x3a48('0x20')](_0x1b956e,_0xf6a159,!![]);}catch(_0x268f75){return BPromise[_0x3a48('0x21')](_0x268f75);}return _0x1b956e[_0x3a48('0x22')]();};}function saveUpdates(_0x4bfa66,_0x9768be){return function(_0x250830){if(_0x250830){return _0x250830['update'](_0x4bfa66)[_0x3a48('0x23')](function(_0x842ce6){return _0x842ce6;});}return null;};}function removeEntity(_0x286237,_0x221e38){return function(_0x1c7029){if(_0x1c7029){return _0x1c7029[_0x3a48('0x24')]()[_0x3a48('0x23')](function(){var _0x154cdb=_0x1c7029[_0x3a48('0x25')]({'plain':!![]});var _0xe13168=_0x3a48('0x26');return db['UserProfileResource'][_0x3a48('0x24')]({'where':{'type':_0xe13168,'resourceId':_0x154cdb['id']}})['then'](function(){return _0x1c7029;});})[_0x3a48('0x23')](function(){_0x286237[_0x3a48('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe66f8f,_0x2d7608){return function(_0x1f6de2){if(!_0x1f6de2){_0xe66f8f[_0x3a48('0x17')](0x194);}return _0x1f6de2;};}function handleError(_0x18d8e9,_0x437f3b){_0x437f3b=_0x437f3b||0x1f4;return function(_0x5f2c1d){logger[_0x3a48('0x27')](_0x5f2c1d[_0x3a48('0x28')]);if(_0x5f2c1d[_0x3a48('0x29')]){delete _0x5f2c1d[_0x3a48('0x29')];}_0x18d8e9[_0x3a48('0x18')](_0x437f3b)[_0x3a48('0x2a')](_0x5f2c1d);};}exports[_0x3a48('0x2b')]=function(_0x4ed0aa,_0x2d58b6){var _0x5828dd={},_0x5835eb={},_0x29f0bc={'count':0x0,'rows':[]};var _0xd8c539=_[_0x3a48('0x2c')](db[_0x3a48('0x2d')][_0x3a48('0x2e')],function(_0x4d9e03){return{'name':_0x4d9e03[_0x3a48('0x2f')],'type':_0x4d9e03[_0x3a48('0x30')][_0x3a48('0x31')]};});_0x5835eb[_0x3a48('0x32')]=_[_0x3a48('0x2c')](_0xd8c539,_0x3a48('0x29'));_0x5835eb[_0x3a48('0x33')]=_[_0x3a48('0x34')](_0x4ed0aa['query']);_0x5835eb[_0x3a48('0x35')]=_['intersection'](_0x5835eb[_0x3a48('0x32')],_0x5835eb[_0x3a48('0x33')]);_0x5828dd[_0x3a48('0x36')]=_[_0x3a48('0x37')](_0x5835eb['model'],qs[_0x3a48('0x38')](_0x4ed0aa[_0x3a48('0x33')]['fields']));_0x5828dd[_0x3a48('0x36')]=_0x5828dd[_0x3a48('0x36')][_0x3a48('0x39')]?_0x5828dd[_0x3a48('0x36')]:_0x5835eb[_0x3a48('0x32')];if(!_0x4ed0aa[_0x3a48('0x33')][_0x3a48('0x3a')]('nolimit')){_0x5828dd[_0x3a48('0x1d')]=qs[_0x3a48('0x1d')](_0x4ed0aa[_0x3a48('0x33')][_0x3a48('0x1d')]);_0x5828dd['offset']=qs['offset'](_0x4ed0aa[_0x3a48('0x33')][_0x3a48('0x1b')]);}_0x5828dd[_0x3a48('0x3b')]=qs[_0x3a48('0x3c')](_0x4ed0aa[_0x3a48('0x33')]['sort']);_0x5828dd[_0x3a48('0x3d')]=qs['filters'](_[_0x3a48('0x3e')](_0x4ed0aa[_0x3a48('0x33')],_0x5835eb['filters']),_0xd8c539);if(_0x4ed0aa[_0x3a48('0x33')][_0x3a48('0x3f')]){_0x5828dd[_0x3a48('0x3d')]=_[_0x3a48('0x40')](_0x5828dd[_0x3a48('0x3d')],{'$or':_[_0x3a48('0x2c')](_0xd8c539,function(_0x58f784){if(_0x58f784[_0x3a48('0x30')]!==_0x3a48('0x41')){var _0x4652f9={};_0x4652f9[_0x58f784['name']]={'$like':'%'+_0x4ed0aa[_0x3a48('0x33')][_0x3a48('0x3f')]+'%'};return _0x4652f9;}})});}_0x5828dd=_['merge']({},_0x5828dd,_0x4ed0aa[_0x3a48('0x42')]);var _0x543cb8={'where':_0x5828dd[_0x3a48('0x3d')]};return db[_0x3a48('0x2d')]['count'](_0x543cb8)[_0x3a48('0x23')](function(_0x70c030){_0x29f0bc[_0x3a48('0x1e')]=_0x70c030;if(_0x4ed0aa['query'][_0x3a48('0x43')]){_0x5828dd[_0x3a48('0x44')]=[{'all':!![]}];}return db[_0x3a48('0x2d')][_0x3a48('0x45')](_0x5828dd);})[_0x3a48('0x23')](function(_0x4ecdff){_0x29f0bc[_0x3a48('0x46')]=_0x4ecdff;return _0x29f0bc;})[_0x3a48('0x23')](respondWithFilteredResult(_0x2d58b6,_0x5828dd))[_0x3a48('0x47')](handleError(_0x2d58b6,null));};exports[_0x3a48('0x48')]=function(_0x34b15f,_0x306514){var _0x5757a2={'raw':![],'where':{'id':_0x34b15f[_0x3a48('0x49')]['id']}},_0x4d6a12={};_0x4d6a12[_0x3a48('0x32')]=_['keys'](db[_0x3a48('0x2d')][_0x3a48('0x2e')]);_0x4d6a12['query']=_[_0x3a48('0x34')](_0x34b15f[_0x3a48('0x33')]);_0x4d6a12[_0x3a48('0x35')]=_[_0x3a48('0x37')](_0x4d6a12['model'],_0x4d6a12['query']);_0x5757a2['attributes']=_[_0x3a48('0x37')](_0x4d6a12['model'],qs[_0x3a48('0x38')](_0x34b15f[_0x3a48('0x33')]['fields']));_0x5757a2[_0x3a48('0x36')]=_0x5757a2[_0x3a48('0x36')][_0x3a48('0x39')]?_0x5757a2[_0x3a48('0x36')]:_0x4d6a12[_0x3a48('0x32')];if(_0x34b15f[_0x3a48('0x33')]['includeAll']){_0x5757a2[_0x3a48('0x44')]=[{'all':!![]}];}_0x5757a2=_[_0x3a48('0x40')]({},_0x5757a2,_0x34b15f[_0x3a48('0x42')]);return db[_0x3a48('0x2d')][_0x3a48('0x4a')](_0x5757a2)[_0x3a48('0x23')](handleEntityNotFound(_0x306514,null))[_0x3a48('0x23')](respondWithResult(_0x306514,null))[_0x3a48('0x47')](handleError(_0x306514,null));};exports[_0x3a48('0x4b')]=function(_0x2f5e9d,_0x25bce2){return db[_0x3a48('0x2d')]['create'](_0x2f5e9d[_0x3a48('0x4c')],{})[_0x3a48('0x23')](function(_0x207e6a){var _0x13515d=_0x2f5e9d[_0x3a48('0x4d')][_0x3a48('0x25')]({'plain':!![]});if(!_0x13515d)throw new Error(_0x3a48('0x4e'));if(_0x13515d[_0x3a48('0x4f')]===_0x3a48('0x4d')){var _0xc8cf0c=_0x207e6a[_0x3a48('0x25')]({'plain':!![]});var _0x267feb=_0x3a48('0x26');return db[_0x3a48('0x50')][_0x3a48('0x4a')]({'where':{'name':_0x267feb,'userProfileId':_0x13515d['userProfileId']},'raw':!![]})[_0x3a48('0x23')](function(_0x1a8a08){if(_0x1a8a08&&_0x1a8a08['autoAssociation']===0x0){return db['UserProfileResource'][_0x3a48('0x4b')]({'name':_0xc8cf0c[_0x3a48('0x29')],'resourceId':_0xc8cf0c['id'],'type':_0x1a8a08[_0x3a48('0x29')],'sectionId':_0x1a8a08['id']},{})[_0x3a48('0x23')](function(){return _0x207e6a;});}else{return _0x207e6a;}})[_0x3a48('0x47')](function(_0x1ee497){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ee497);throw _0x1ee497;});}return _0x207e6a;})[_0x3a48('0x23')](respondWithResult(_0x25bce2,0xc9))[_0x3a48('0x47')](handleError(_0x25bce2,null));};exports[_0x3a48('0x51')]=function(_0x111187,_0x4e6fb5){if(_0x111187[_0x3a48('0x4c')]['id']){delete _0x111187[_0x3a48('0x4c')]['id'];}return db[_0x3a48('0x2d')][_0x3a48('0x4a')]({'where':{'id':_0x111187[_0x3a48('0x49')]['id']}})[_0x3a48('0x23')](handleEntityNotFound(_0x4e6fb5,null))[_0x3a48('0x23')](saveUpdates(_0x111187['body'],null))[_0x3a48('0x23')](respondWithResult(_0x4e6fb5,null))[_0x3a48('0x47')](handleError(_0x4e6fb5,null));};exports['destroy']=function(_0x4958bf,_0x2d45b6){return db[_0x3a48('0x2d')]['find']({'where':{'id':_0x4958bf[_0x3a48('0x49')]['id']}})['then'](handleEntityNotFound(_0x2d45b6,null))[_0x3a48('0x23')](removeEntity(_0x2d45b6,null))[_0x3a48('0x47')](handleError(_0x2d45b6,null));};exports['addAllCondition']=function(_0x1e61fa,_0x572cce,_0x76c6a3){if(_0x1e61fa[_0x3a48('0x4c')]['id']){delete _0x1e61fa[_0x3a48('0x4c')]['id'];}return db[_0x3a48('0x2d')][_0x3a48('0x4a')]({'where':{'id':_0x1e61fa[_0x3a48('0x49')]['id']}})[_0x3a48('0x23')](handleEntityNotFound(_0x572cce,null))[_0x3a48('0x23')](function(_0x581160){if(_0x581160){_0x1e61fa['body'][_0x3a48('0x52')]=_0x581160['id'];return db[_0x3a48('0x53')][_0x3a48('0x4b')](_0x1e61fa[_0x3a48('0x4c')]);}})[_0x3a48('0x23')](respondWithResult(_0x572cce,null))['catch'](handleError(_0x572cce,null));};exports[_0x3a48('0x54')]=function(_0xc403bf,_0xfe56f6,_0x22425c){if(_0xc403bf[_0x3a48('0x4c')]['id']){delete _0xc403bf[_0x3a48('0x4c')]['id'];}return db[_0x3a48('0x2d')][_0x3a48('0x4a')]({'where':{'id':_0xc403bf[_0x3a48('0x49')]['id']}})['then'](handleEntityNotFound(_0xfe56f6,null))[_0x3a48('0x23')](function(_0x35cdce){if(_0x35cdce){_0xc403bf[_0x3a48('0x4c')][_0x3a48('0x55')]=_0x35cdce['id'];return db['Condition']['create'](_0xc403bf[_0x3a48('0x4c')]);}})[_0x3a48('0x23')](respondWithResult(_0xfe56f6,null))[_0x3a48('0x47')](handleError(_0xfe56f6,null));};exports[_0x3a48('0x56')]=function(_0xc76259,_0x23a720,_0x491dc6){var _0xf80bf3={};var _0x35e179={};var _0x52b581;var _0x433211;return db[_0x3a48('0x2d')][_0x3a48('0x57')]({'where':{'id':_0xc76259['params']['id']}})[_0x3a48('0x23')](handleEntityNotFound(_0x23a720,null))['then'](function(_0x58f0fb){if(_0x58f0fb){_0x52b581=_0x58f0fb;_0x35e179['model']=_[_0x3a48('0x34')](db[_0x3a48('0x53')][_0x3a48('0x2e')]);_0x35e179[_0x3a48('0x33')]=_[_0x3a48('0x34')](_0xc76259['query']);_0x35e179['filters']=_[_0x3a48('0x37')](_0x35e179[_0x3a48('0x32')],_0x35e179['query']);_0xf80bf3[_0x3a48('0x36')]=_[_0x3a48('0x37')](_0x35e179[_0x3a48('0x32')],qs[_0x3a48('0x38')](_0xc76259[_0x3a48('0x33')][_0x3a48('0x38')]));_0xf80bf3[_0x3a48('0x36')]=_0xf80bf3[_0x3a48('0x36')][_0x3a48('0x39')]?_0xf80bf3[_0x3a48('0x36')]:_0x35e179[_0x3a48('0x32')];_0xf80bf3[_0x3a48('0x3b')]=qs[_0x3a48('0x3c')](_0xc76259[_0x3a48('0x33')][_0x3a48('0x3c')]);_0xf80bf3[_0x3a48('0x3d')]=qs[_0x3a48('0x35')](_['pick'](_0xc76259[_0x3a48('0x33')],_0x35e179[_0x3a48('0x35')]));if(_0xc76259['query'][_0x3a48('0x3f')]){_0xf80bf3[_0x3a48('0x3d')]=_[_0x3a48('0x40')](_0xf80bf3[_0x3a48('0x3d')],{'$or':_['map'](_0xf80bf3[_0x3a48('0x36')],function(_0x1b9b5c){var _0x442a26={};_0x442a26[_0x1b9b5c]={'$like':'%'+_0xc76259['query'][_0x3a48('0x3f')]+'%'};return _0x442a26;})});}_0xf80bf3=_[_0x3a48('0x40')]({},_0xf80bf3,_0xc76259[_0x3a48('0x42')]);return _0x52b581[_0x3a48('0x56')](_0xf80bf3);}})[_0x3a48('0x23')](function(_0x540c0c){if(_0x540c0c){_0x433211=_0x540c0c[_0x3a48('0x39')];if(!_0xc76259[_0x3a48('0x33')][_0x3a48('0x3a')](_0x3a48('0x58'))){_0xf80bf3[_0x3a48('0x1d')]=qs['limit'](_0xc76259['query'][_0x3a48('0x1d')]);_0xf80bf3[_0x3a48('0x1b')]=qs[_0x3a48('0x1b')](_0xc76259[_0x3a48('0x33')]['offset']);}return _0x52b581['getAllConditions'](_0xf80bf3);}})[_0x3a48('0x23')](function(_0x3bdfd1){if(_0x3bdfd1){return _0x3bdfd1?{'count':_0x433211,'rows':_0x3bdfd1}:null;}})[_0x3a48('0x23')](respondWithResult(_0x23a720,null))[_0x3a48('0x47')](handleError(_0x23a720,null));};exports[_0x3a48('0x59')]=function(_0xd1bf3,_0x4ba972,_0x363062){var _0x1724cd={};var _0x332472={};var _0x574c00;var _0x4c8ce3;return db['Trigger'][_0x3a48('0x57')]({'where':{'id':_0xd1bf3[_0x3a48('0x49')]['id']}})[_0x3a48('0x23')](handleEntityNotFound(_0x4ba972,null))[_0x3a48('0x23')](function(_0x14bb20){if(_0x14bb20){_0x574c00=_0x14bb20;_0x332472[_0x3a48('0x32')]=_[_0x3a48('0x34')](db[_0x3a48('0x53')][_0x3a48('0x2e')]);_0x332472[_0x3a48('0x33')]=_[_0x3a48('0x34')](_0xd1bf3[_0x3a48('0x33')]);_0x332472[_0x3a48('0x35')]=_[_0x3a48('0x37')](_0x332472[_0x3a48('0x32')],_0x332472[_0x3a48('0x33')]);_0x1724cd[_0x3a48('0x36')]=_[_0x3a48('0x37')](_0x332472[_0x3a48('0x32')],qs['fields'](_0xd1bf3[_0x3a48('0x33')]['fields']));_0x1724cd['attributes']=_0x1724cd[_0x3a48('0x36')]['length']?_0x1724cd[_0x3a48('0x36')]:_0x332472['model'];_0x1724cd['order']=qs['sort'](_0xd1bf3[_0x3a48('0x33')][_0x3a48('0x3c')]);_0x1724cd[_0x3a48('0x3d')]=qs[_0x3a48('0x35')](_[_0x3a48('0x3e')](_0xd1bf3[_0x3a48('0x33')],_0x332472[_0x3a48('0x35')]));if(_0xd1bf3[_0x3a48('0x33')][_0x3a48('0x3f')]){_0x1724cd[_0x3a48('0x3d')]=_[_0x3a48('0x40')](_0x1724cd[_0x3a48('0x3d')],{'$or':_['map'](_0x1724cd[_0x3a48('0x36')],function(_0x5030ef){var _0x556980={};_0x556980[_0x5030ef]={'$like':'%'+_0xd1bf3['query'][_0x3a48('0x3f')]+'%'};return _0x556980;})});}_0x1724cd=_[_0x3a48('0x40')]({},_0x1724cd,_0xd1bf3['options']);return _0x574c00[_0x3a48('0x59')](_0x1724cd);}})[_0x3a48('0x23')](function(_0x3322fb){if(_0x3322fb){_0x4c8ce3=_0x3322fb['length'];if(!_0xd1bf3[_0x3a48('0x33')][_0x3a48('0x3a')]('nolimit')){_0x1724cd[_0x3a48('0x1d')]=qs[_0x3a48('0x1d')](_0xd1bf3[_0x3a48('0x33')][_0x3a48('0x1d')]);_0x1724cd[_0x3a48('0x1b')]=qs['offset'](_0xd1bf3['query'][_0x3a48('0x1b')]);}return _0x574c00[_0x3a48('0x59')](_0x1724cd);}})[_0x3a48('0x23')](function(_0x16af81){if(_0x16af81){return _0x16af81?{'count':_0x4c8ce3,'rows':_0x16af81}:null;}})[_0x3a48('0x23')](respondWithResult(_0x4ba972,null))[_0x3a48('0x47')](handleError(_0x4ba972,null));};exports[_0x3a48('0x5a')]=function(_0xe1bb46,_0x52e263,_0x54d569){if(_0xe1bb46[_0x3a48('0x4c')]['id']){delete _0xe1bb46[_0x3a48('0x4c')]['id'];}return db[_0x3a48('0x2d')][_0x3a48('0x4a')]({'where':{'id':_0xe1bb46[_0x3a48('0x49')]['id']}})[_0x3a48('0x23')](handleEntityNotFound(_0x52e263,null))[_0x3a48('0x23')](function(_0x560e1d){if(_0x560e1d){_0xe1bb46[_0x3a48('0x4c')]['TriggerId']=_0x560e1d['id'];return db['Action'][_0x3a48('0x4b')](_0xe1bb46[_0x3a48('0x4c')]);}})[_0x3a48('0x23')](respondWithResult(_0x52e263,null))[_0x3a48('0x47')](handleError(_0x52e263,null));};exports[_0x3a48('0x5b')]=function(_0x4e6a25,_0x21a9d5,_0x44b693){var _0x4fd63b={};var _0x19c7e1={};var _0xf374a3;var _0x5b737c;return db[_0x3a48('0x2d')]['findOne']({'where':{'id':_0x4e6a25['params']['id']}})[_0x3a48('0x23')](handleEntityNotFound(_0x21a9d5,null))[_0x3a48('0x23')](function(_0x56e6b9){if(_0x56e6b9){_0xf374a3=_0x56e6b9;_0x19c7e1['model']=_[_0x3a48('0x34')](db[_0x3a48('0x5c')][_0x3a48('0x2e')]);_0x19c7e1[_0x3a48('0x33')]=_['keys'](_0x4e6a25[_0x3a48('0x33')]);_0x19c7e1[_0x3a48('0x35')]=_['intersection'](_0x19c7e1[_0x3a48('0x32')],_0x19c7e1['query']);_0x4fd63b[_0x3a48('0x36')]=_[_0x3a48('0x37')](_0x19c7e1['model'],qs[_0x3a48('0x38')](_0x4e6a25['query'][_0x3a48('0x38')]));_0x4fd63b['attributes']=_0x4fd63b['attributes'][_0x3a48('0x39')]?_0x4fd63b[_0x3a48('0x36')]:_0x19c7e1[_0x3a48('0x32')];_0x4fd63b[_0x3a48('0x3b')]=qs[_0x3a48('0x3c')](_0x4e6a25[_0x3a48('0x33')][_0x3a48('0x3c')]);_0x4fd63b[_0x3a48('0x3d')]=qs[_0x3a48('0x35')](_[_0x3a48('0x3e')](_0x4e6a25[_0x3a48('0x33')],_0x19c7e1['filters']));if(_0x4e6a25[_0x3a48('0x33')][_0x3a48('0x3f')]){_0x4fd63b['where']=_['merge'](_0x4fd63b[_0x3a48('0x3d')],{'$or':_['map'](_0x4fd63b['attributes'],function(_0x1e5de6){var _0x3e464b={};_0x3e464b[_0x1e5de6]={'$like':'%'+_0x4e6a25[_0x3a48('0x33')][_0x3a48('0x3f')]+'%'};return _0x3e464b;})});}_0x4fd63b=_['merge']({},_0x4fd63b,_0x4e6a25['options']);return _0xf374a3[_0x3a48('0x5b')](_0x4fd63b);}})[_0x3a48('0x23')](function(_0x2cbad3){if(_0x2cbad3){_0x5b737c=_0x2cbad3[_0x3a48('0x39')];if(!_0x4e6a25[_0x3a48('0x33')][_0x3a48('0x3a')]('nolimit')){_0x4fd63b[_0x3a48('0x1d')]=qs[_0x3a48('0x1d')](_0x4e6a25[_0x3a48('0x33')]['limit']);_0x4fd63b[_0x3a48('0x1b')]=qs[_0x3a48('0x1b')](_0x4e6a25['query']['offset']);}return _0xf374a3[_0x3a48('0x5b')](_0x4fd63b);}})[_0x3a48('0x23')](function(_0x5b3f6){if(_0x5b3f6){return _0x5b3f6?{'count':_0x5b737c,'rows':_0x5b3f6}:null;}})['then'](respondWithResult(_0x21a9d5,null))[_0x3a48('0x47')](handleError(_0x21a9d5,null));}; \ No newline at end of file +var _0xf79c=['reject','save','update','destroy','then','get','error','stack','name','map','Trigger','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','length','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','body','find','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','order','getAnyConditions','findOne','addAction','TriggerId','Action','getActions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set'];(function(_0x453aa0,_0x1fd5d4){var _0x4f2810=function(_0x2980a3){while(--_0x2980a3){_0x453aa0['push'](_0x453aa0['shift']());}};_0x4f2810(++_0x1fd5d4);}(_0xf79c,0x1bc));var _0xcf79=function(_0xf83ad3,_0x1540cb){_0xf83ad3=_0xf83ad3-0x0;var _0x2ff6c8=_0xf79c[_0xf83ad3];return _0x2ff6c8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcf79('0x0'));var zipdir=require(_0xcf79('0x1'));var jsonpatch=require(_0xcf79('0x2'));var rp=require(_0xcf79('0x3'));var moment=require(_0xcf79('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcf79('0x5'));var util=require(_0xcf79('0x6'));var path=require(_0xcf79('0x7'));var sox=require('sox');var csv=require(_0xcf79('0x8'));var ejs=require(_0xcf79('0x9'));var fs=require('fs');var fs_extra=require(_0xcf79('0xa'));var _=require(_0xcf79('0xb'));var squel=require(_0xcf79('0xc'));var crypto=require(_0xcf79('0xd'));var jsforce=require(_0xcf79('0xe'));var deskjs=require(_0xcf79('0xf'));var toCsv=require(_0xcf79('0x8'));var querystring=require(_0xcf79('0x10'));var Papa=require(_0xcf79('0x11'));var Redis=require(_0xcf79('0x12'));var authService=require(_0xcf79('0x13'));var qs=require(_0xcf79('0x14'));var as=require(_0xcf79('0x15'));var hardwareService=require(_0xcf79('0x16'));var logger=require('../../config/logger')(_0xcf79('0x17'));var utils=require(_0xcf79('0x18'));var config=require(_0xcf79('0x19'));var licenseUtil=require(_0xcf79('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x379283,_0x5120a6){_0x5120a6=_0x5120a6||0xcc;return function(_0x4555b7){if(_0x4555b7){return _0x379283[_0xcf79('0x1b')](_0x5120a6);}return _0x379283[_0xcf79('0x1c')](_0x5120a6)[_0xcf79('0x1d')]();};}function respondWithResult(_0x34307a,_0x478be0){_0x478be0=_0x478be0||0xc8;return function(_0x272fc2){if(_0x272fc2){return _0x34307a[_0xcf79('0x1c')](_0x478be0)[_0xcf79('0x1e')](_0x272fc2);}};}function respondWithFilteredResult(_0x4ca24b,_0x5b0ac7){return function(_0x54d474){if(_0x54d474){var _0x1c42db=typeof _0x5b0ac7[_0xcf79('0x1f')]==='undefined'&&typeof _0x5b0ac7[_0xcf79('0x20')]===_0xcf79('0x21');var _0x4e10d9=_0x54d474[_0xcf79('0x22')];var _0x34dd4e=_0x1c42db?0x0:_0x5b0ac7[_0xcf79('0x1f')];var _0x5d4162=_0x1c42db?_0x54d474[_0xcf79('0x22')]:_0x5b0ac7[_0xcf79('0x1f')]+_0x5b0ac7[_0xcf79('0x20')];var _0x8052ea;if(_0x5d4162>=_0x4e10d9){_0x5d4162=_0x4e10d9;_0x8052ea=0xc8;}else{_0x8052ea=0xce;}_0x4ca24b[_0xcf79('0x1c')](_0x8052ea);return _0x4ca24b[_0xcf79('0x23')]('Content-Range',_0x34dd4e+'-'+_0x5d4162+'/'+_0x4e10d9)[_0xcf79('0x1e')](_0x54d474);}return null;};}function patchUpdates(_0x132b0a){return function(_0x2d971a){try{jsonpatch['apply'](_0x2d971a,_0x132b0a,!![]);}catch(_0x48ff5e){return BPromise[_0xcf79('0x24')](_0x48ff5e);}return _0x2d971a[_0xcf79('0x25')]();};}function saveUpdates(_0x314ebd,_0x375502){return function(_0x2986b6){if(_0x2986b6){return _0x2986b6[_0xcf79('0x26')](_0x314ebd)['then'](function(_0x5b43dd){return _0x5b43dd;});}return null;};}function removeEntity(_0x1b5b3c,_0x2cdece){return function(_0x560ab5){if(_0x560ab5){return _0x560ab5[_0xcf79('0x27')]()[_0xcf79('0x28')](function(){var _0x5120a7=_0x560ab5[_0xcf79('0x29')]({'plain':!![]});var _0x14060d='Triggers';return db['UserProfileResource'][_0xcf79('0x27')]({'where':{'type':_0x14060d,'resourceId':_0x5120a7['id']}})[_0xcf79('0x28')](function(){return _0x560ab5;});})['then'](function(){_0x1b5b3c['status'](0xcc)[_0xcf79('0x1d')]();});}};}function handleEntityNotFound(_0x2b33c4,_0xe65cc5){return function(_0x4ed26b){if(!_0x4ed26b){_0x2b33c4['sendStatus'](0x194);}return _0x4ed26b;};}function handleError(_0x1865c1,_0x5f313f){_0x5f313f=_0x5f313f||0x1f4;return function(_0xf30eac){logger[_0xcf79('0x2a')](_0xf30eac[_0xcf79('0x2b')]);if(_0xf30eac[_0xcf79('0x2c')]){delete _0xf30eac[_0xcf79('0x2c')];}_0x1865c1['status'](_0x5f313f)['send'](_0xf30eac);};}exports['index']=function(_0x2826bb,_0x1f06d5){var _0x43ccdf={},_0xe9049c={},_0xf0a110={'count':0x0,'rows':[]};var _0xee77fc=_[_0xcf79('0x2d')](db[_0xcf79('0x2e')][_0xcf79('0x2f')],function(_0x17814e){return{'name':_0x17814e[_0xcf79('0x30')],'type':_0x17814e[_0xcf79('0x31')][_0xcf79('0x32')]};});_0xe9049c[_0xcf79('0x33')]=_[_0xcf79('0x2d')](_0xee77fc,_0xcf79('0x2c'));_0xe9049c[_0xcf79('0x34')]=_['keys'](_0x2826bb['query']);_0xe9049c[_0xcf79('0x35')]=_[_0xcf79('0x36')](_0xe9049c[_0xcf79('0x33')],_0xe9049c[_0xcf79('0x34')]);_0x43ccdf[_0xcf79('0x37')]=_['intersection'](_0xe9049c[_0xcf79('0x33')],qs[_0xcf79('0x38')](_0x2826bb[_0xcf79('0x34')]['fields']));_0x43ccdf[_0xcf79('0x37')]=_0x43ccdf[_0xcf79('0x37')]['length']?_0x43ccdf[_0xcf79('0x37')]:_0xe9049c[_0xcf79('0x33')];if(!_0x2826bb['query'][_0xcf79('0x39')](_0xcf79('0x3a'))){_0x43ccdf[_0xcf79('0x20')]=qs['limit'](_0x2826bb[_0xcf79('0x34')]['limit']);_0x43ccdf[_0xcf79('0x1f')]=qs[_0xcf79('0x1f')](_0x2826bb['query']['offset']);}_0x43ccdf['order']=qs[_0xcf79('0x3b')](_0x2826bb[_0xcf79('0x34')][_0xcf79('0x3b')]);_0x43ccdf[_0xcf79('0x3c')]=qs[_0xcf79('0x35')](_[_0xcf79('0x3d')](_0x2826bb[_0xcf79('0x34')],_0xe9049c[_0xcf79('0x35')]),_0xee77fc);if(_0x2826bb[_0xcf79('0x34')][_0xcf79('0x3e')]){_0x43ccdf['where']=_[_0xcf79('0x3f')](_0x43ccdf[_0xcf79('0x3c')],{'$or':_[_0xcf79('0x2d')](_0xee77fc,function(_0x2c676f){if(_0x2c676f['type']!==_0xcf79('0x40')){var _0xb3c490={};_0xb3c490[_0x2c676f[_0xcf79('0x2c')]]={'$like':'%'+_0x2826bb[_0xcf79('0x34')][_0xcf79('0x3e')]+'%'};return _0xb3c490;}})});}_0x43ccdf=_[_0xcf79('0x3f')]({},_0x43ccdf,_0x2826bb[_0xcf79('0x41')]);var _0x1b547c={'where':_0x43ccdf[_0xcf79('0x3c')]};return db[_0xcf79('0x2e')][_0xcf79('0x22')](_0x1b547c)[_0xcf79('0x28')](function(_0x19540b){_0xf0a110[_0xcf79('0x22')]=_0x19540b;if(_0x2826bb['query']['includeAll']){_0x43ccdf[_0xcf79('0x42')]=[{'all':!![]}];}return db[_0xcf79('0x2e')][_0xcf79('0x43')](_0x43ccdf);})[_0xcf79('0x28')](function(_0xacf05e){_0xf0a110[_0xcf79('0x44')]=_0xacf05e;return _0xf0a110;})[_0xcf79('0x28')](respondWithFilteredResult(_0x1f06d5,_0x43ccdf))[_0xcf79('0x45')](handleError(_0x1f06d5,null));};exports[_0xcf79('0x46')]=function(_0x3662b2,_0x1dc907){var _0x1502df={'raw':![],'where':{'id':_0x3662b2[_0xcf79('0x47')]['id']}},_0x34b711={};_0x34b711[_0xcf79('0x33')]=_[_0xcf79('0x48')](db['Trigger'][_0xcf79('0x2f')]);_0x34b711[_0xcf79('0x34')]=_[_0xcf79('0x48')](_0x3662b2['query']);_0x34b711[_0xcf79('0x35')]=_[_0xcf79('0x36')](_0x34b711[_0xcf79('0x33')],_0x34b711[_0xcf79('0x34')]);_0x1502df['attributes']=_[_0xcf79('0x36')](_0x34b711['model'],qs[_0xcf79('0x38')](_0x3662b2[_0xcf79('0x34')][_0xcf79('0x38')]));_0x1502df[_0xcf79('0x37')]=_0x1502df[_0xcf79('0x37')][_0xcf79('0x49')]?_0x1502df[_0xcf79('0x37')]:_0x34b711[_0xcf79('0x33')];if(_0x3662b2[_0xcf79('0x34')][_0xcf79('0x4a')]){_0x1502df['include']=[{'all':!![]}];}_0x1502df=_[_0xcf79('0x3f')]({},_0x1502df,_0x3662b2[_0xcf79('0x41')]);return db[_0xcf79('0x2e')]['find'](_0x1502df)['then'](handleEntityNotFound(_0x1dc907,null))[_0xcf79('0x28')](respondWithResult(_0x1dc907,null))[_0xcf79('0x45')](handleError(_0x1dc907,null));};exports[_0xcf79('0x4b')]=function(_0x570e60,_0x343df9){return db[_0xcf79('0x2e')][_0xcf79('0x4b')](_0x570e60['body'],{})[_0xcf79('0x28')](function(_0x1798ba){var _0x480737=_0x570e60[_0xcf79('0x4c')][_0xcf79('0x29')]({'plain':!![]});if(!_0x480737)throw new Error(_0xcf79('0x4d'));if(_0x480737[_0xcf79('0x4e')]===_0xcf79('0x4c')){var _0x3666c4=_0x1798ba[_0xcf79('0x29')]({'plain':!![]});var _0x510a8d='Triggers';return db[_0xcf79('0x4f')]['find']({'where':{'name':_0x510a8d,'userProfileId':_0x480737[_0xcf79('0x50')]},'raw':!![]})[_0xcf79('0x28')](function(_0x1d37b9){if(_0x1d37b9&&_0x1d37b9['autoAssociation']===0x0){return db[_0xcf79('0x51')][_0xcf79('0x4b')]({'name':_0x3666c4[_0xcf79('0x2c')],'resourceId':_0x3666c4['id'],'type':_0x1d37b9['name'],'sectionId':_0x1d37b9['id']},{})[_0xcf79('0x28')](function(){return _0x1798ba;});}else{return _0x1798ba;}})[_0xcf79('0x45')](function(_0x3ee7c7){logger[_0xcf79('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ee7c7);throw _0x3ee7c7;});}return _0x1798ba;})[_0xcf79('0x28')](respondWithResult(_0x343df9,0xc9))['catch'](handleError(_0x343df9,null));};exports[_0xcf79('0x26')]=function(_0x4b3e2a,_0x71a092){if(_0x4b3e2a[_0xcf79('0x52')]['id']){delete _0x4b3e2a[_0xcf79('0x52')]['id'];}return db[_0xcf79('0x2e')]['find']({'where':{'id':_0x4b3e2a[_0xcf79('0x47')]['id']}})[_0xcf79('0x28')](handleEntityNotFound(_0x71a092,null))[_0xcf79('0x28')](saveUpdates(_0x4b3e2a[_0xcf79('0x52')],null))['then'](respondWithResult(_0x71a092,null))['catch'](handleError(_0x71a092,null));};exports[_0xcf79('0x27')]=function(_0x2a65b5,_0x480160){return db['Trigger'][_0xcf79('0x53')]({'where':{'id':_0x2a65b5[_0xcf79('0x47')]['id']}})[_0xcf79('0x28')](handleEntityNotFound(_0x480160,null))[_0xcf79('0x28')](removeEntity(_0x480160,null))[_0xcf79('0x45')](handleError(_0x480160,null));};exports['addAllCondition']=function(_0xc52038,_0x4a76a9,_0x4c8547){if(_0xc52038['body']['id']){delete _0xc52038[_0xcf79('0x52')]['id'];}return db[_0xcf79('0x2e')][_0xcf79('0x53')]({'where':{'id':_0xc52038[_0xcf79('0x47')]['id']}})[_0xcf79('0x28')](handleEntityNotFound(_0x4a76a9,null))[_0xcf79('0x28')](function(_0x12dce7){if(_0x12dce7){_0xc52038[_0xcf79('0x52')][_0xcf79('0x54')]=_0x12dce7['id'];return db[_0xcf79('0x55')][_0xcf79('0x4b')](_0xc52038[_0xcf79('0x52')]);}})['then'](respondWithResult(_0x4a76a9,null))[_0xcf79('0x45')](handleError(_0x4a76a9,null));};exports[_0xcf79('0x56')]=function(_0x342720,_0x21b692,_0x354057){if(_0x342720[_0xcf79('0x52')]['id']){delete _0x342720['body']['id'];}return db['Trigger'][_0xcf79('0x53')]({'where':{'id':_0x342720[_0xcf79('0x47')]['id']}})[_0xcf79('0x28')](handleEntityNotFound(_0x21b692,null))[_0xcf79('0x28')](function(_0x5ed77e){if(_0x5ed77e){_0x342720['body'][_0xcf79('0x57')]=_0x5ed77e['id'];return db['Condition']['create'](_0x342720[_0xcf79('0x52')]);}})[_0xcf79('0x28')](respondWithResult(_0x21b692,null))[_0xcf79('0x45')](handleError(_0x21b692,null));};exports[_0xcf79('0x58')]=function(_0x599cd2,_0x1c0a98,_0x137c7e){var _0x13a8bc={};var _0x448a12={};var _0x4d95b9;var _0x5d48f6;return db['Trigger']['findOne']({'where':{'id':_0x599cd2[_0xcf79('0x47')]['id']}})[_0xcf79('0x28')](handleEntityNotFound(_0x1c0a98,null))[_0xcf79('0x28')](function(_0x1e0301){if(_0x1e0301){_0x4d95b9=_0x1e0301;_0x448a12[_0xcf79('0x33')]=_[_0xcf79('0x48')](db['Condition'][_0xcf79('0x2f')]);_0x448a12[_0xcf79('0x34')]=_[_0xcf79('0x48')](_0x599cd2[_0xcf79('0x34')]);_0x448a12[_0xcf79('0x35')]=_[_0xcf79('0x36')](_0x448a12['model'],_0x448a12[_0xcf79('0x34')]);_0x13a8bc[_0xcf79('0x37')]=_[_0xcf79('0x36')](_0x448a12[_0xcf79('0x33')],qs[_0xcf79('0x38')](_0x599cd2[_0xcf79('0x34')][_0xcf79('0x38')]));_0x13a8bc[_0xcf79('0x37')]=_0x13a8bc[_0xcf79('0x37')][_0xcf79('0x49')]?_0x13a8bc[_0xcf79('0x37')]:_0x448a12[_0xcf79('0x33')];_0x13a8bc[_0xcf79('0x59')]=qs[_0xcf79('0x3b')](_0x599cd2[_0xcf79('0x34')][_0xcf79('0x3b')]);_0x13a8bc[_0xcf79('0x3c')]=qs[_0xcf79('0x35')](_['pick'](_0x599cd2['query'],_0x448a12[_0xcf79('0x35')]));if(_0x599cd2['query'][_0xcf79('0x3e')]){_0x13a8bc[_0xcf79('0x3c')]=_[_0xcf79('0x3f')](_0x13a8bc[_0xcf79('0x3c')],{'$or':_['map'](_0x13a8bc[_0xcf79('0x37')],function(_0xc33cf3){var _0x50249c={};_0x50249c[_0xc33cf3]={'$like':'%'+_0x599cd2['query'][_0xcf79('0x3e')]+'%'};return _0x50249c;})});}_0x13a8bc=_[_0xcf79('0x3f')]({},_0x13a8bc,_0x599cd2[_0xcf79('0x41')]);return _0x4d95b9['getAllConditions'](_0x13a8bc);}})['then'](function(_0x5e8f6c){if(_0x5e8f6c){_0x5d48f6=_0x5e8f6c[_0xcf79('0x49')];if(!_0x599cd2[_0xcf79('0x34')][_0xcf79('0x39')](_0xcf79('0x3a'))){_0x13a8bc[_0xcf79('0x20')]=qs['limit'](_0x599cd2[_0xcf79('0x34')][_0xcf79('0x20')]);_0x13a8bc['offset']=qs['offset'](_0x599cd2[_0xcf79('0x34')][_0xcf79('0x1f')]);}return _0x4d95b9[_0xcf79('0x58')](_0x13a8bc);}})[_0xcf79('0x28')](function(_0x5028c3){if(_0x5028c3){return _0x5028c3?{'count':_0x5d48f6,'rows':_0x5028c3}:null;}})[_0xcf79('0x28')](respondWithResult(_0x1c0a98,null))[_0xcf79('0x45')](handleError(_0x1c0a98,null));};exports[_0xcf79('0x5a')]=function(_0xe85e8b,_0x2cd06a,_0x2d1f23){var _0x2d2f76={};var _0x35c2ac={};var _0x569af7;var _0x2ad656;return db['Trigger'][_0xcf79('0x5b')]({'where':{'id':_0xe85e8b[_0xcf79('0x47')]['id']}})['then'](handleEntityNotFound(_0x2cd06a,null))[_0xcf79('0x28')](function(_0x19c289){if(_0x19c289){_0x569af7=_0x19c289;_0x35c2ac['model']=_[_0xcf79('0x48')](db[_0xcf79('0x55')][_0xcf79('0x2f')]);_0x35c2ac[_0xcf79('0x34')]=_[_0xcf79('0x48')](_0xe85e8b['query']);_0x35c2ac[_0xcf79('0x35')]=_[_0xcf79('0x36')](_0x35c2ac[_0xcf79('0x33')],_0x35c2ac[_0xcf79('0x34')]);_0x2d2f76[_0xcf79('0x37')]=_[_0xcf79('0x36')](_0x35c2ac[_0xcf79('0x33')],qs[_0xcf79('0x38')](_0xe85e8b[_0xcf79('0x34')][_0xcf79('0x38')]));_0x2d2f76[_0xcf79('0x37')]=_0x2d2f76['attributes']['length']?_0x2d2f76[_0xcf79('0x37')]:_0x35c2ac[_0xcf79('0x33')];_0x2d2f76[_0xcf79('0x59')]=qs[_0xcf79('0x3b')](_0xe85e8b[_0xcf79('0x34')][_0xcf79('0x3b')]);_0x2d2f76['where']=qs[_0xcf79('0x35')](_['pick'](_0xe85e8b[_0xcf79('0x34')],_0x35c2ac['filters']));if(_0xe85e8b[_0xcf79('0x34')][_0xcf79('0x3e')]){_0x2d2f76[_0xcf79('0x3c')]=_['merge'](_0x2d2f76[_0xcf79('0x3c')],{'$or':_[_0xcf79('0x2d')](_0x2d2f76[_0xcf79('0x37')],function(_0x2fdc68){var _0x5eb0b5={};_0x5eb0b5[_0x2fdc68]={'$like':'%'+_0xe85e8b[_0xcf79('0x34')]['filter']+'%'};return _0x5eb0b5;})});}_0x2d2f76=_[_0xcf79('0x3f')]({},_0x2d2f76,_0xe85e8b['options']);return _0x569af7[_0xcf79('0x5a')](_0x2d2f76);}})['then'](function(_0x51fa31){if(_0x51fa31){_0x2ad656=_0x51fa31[_0xcf79('0x49')];if(!_0xe85e8b[_0xcf79('0x34')]['hasOwnProperty'](_0xcf79('0x3a'))){_0x2d2f76[_0xcf79('0x20')]=qs[_0xcf79('0x20')](_0xe85e8b[_0xcf79('0x34')][_0xcf79('0x20')]);_0x2d2f76[_0xcf79('0x1f')]=qs[_0xcf79('0x1f')](_0xe85e8b[_0xcf79('0x34')][_0xcf79('0x1f')]);}return _0x569af7[_0xcf79('0x5a')](_0x2d2f76);}})[_0xcf79('0x28')](function(_0x2fb0f1){if(_0x2fb0f1){return _0x2fb0f1?{'count':_0x2ad656,'rows':_0x2fb0f1}:null;}})[_0xcf79('0x28')](respondWithResult(_0x2cd06a,null))['catch'](handleError(_0x2cd06a,null));};exports[_0xcf79('0x5c')]=function(_0x2a16c6,_0xf98c09,_0x34fc95){if(_0x2a16c6['body']['id']){delete _0x2a16c6[_0xcf79('0x52')]['id'];}return db[_0xcf79('0x2e')][_0xcf79('0x53')]({'where':{'id':_0x2a16c6[_0xcf79('0x47')]['id']}})['then'](handleEntityNotFound(_0xf98c09,null))[_0xcf79('0x28')](function(_0x1cfd81){if(_0x1cfd81){_0x2a16c6[_0xcf79('0x52')][_0xcf79('0x5d')]=_0x1cfd81['id'];return db[_0xcf79('0x5e')]['create'](_0x2a16c6[_0xcf79('0x52')]);}})[_0xcf79('0x28')](respondWithResult(_0xf98c09,null))[_0xcf79('0x45')](handleError(_0xf98c09,null));};exports[_0xcf79('0x5f')]=function(_0x220fb0,_0x19e67e,_0x5dccd9){var _0x33a105={};var _0x3bd636={};var _0x617cdd;var _0x1051b6;return db[_0xcf79('0x2e')][_0xcf79('0x5b')]({'where':{'id':_0x220fb0['params']['id']}})[_0xcf79('0x28')](handleEntityNotFound(_0x19e67e,null))[_0xcf79('0x28')](function(_0x5e993d){if(_0x5e993d){_0x617cdd=_0x5e993d;_0x3bd636[_0xcf79('0x33')]=_[_0xcf79('0x48')](db['Action'][_0xcf79('0x2f')]);_0x3bd636[_0xcf79('0x34')]=_[_0xcf79('0x48')](_0x220fb0[_0xcf79('0x34')]);_0x3bd636[_0xcf79('0x35')]=_['intersection'](_0x3bd636[_0xcf79('0x33')],_0x3bd636[_0xcf79('0x34')]);_0x33a105['attributes']=_[_0xcf79('0x36')](_0x3bd636[_0xcf79('0x33')],qs['fields'](_0x220fb0['query'][_0xcf79('0x38')]));_0x33a105[_0xcf79('0x37')]=_0x33a105['attributes'][_0xcf79('0x49')]?_0x33a105['attributes']:_0x3bd636['model'];_0x33a105[_0xcf79('0x59')]=qs[_0xcf79('0x3b')](_0x220fb0['query'][_0xcf79('0x3b')]);_0x33a105[_0xcf79('0x3c')]=qs[_0xcf79('0x35')](_['pick'](_0x220fb0[_0xcf79('0x34')],_0x3bd636['filters']));if(_0x220fb0['query'][_0xcf79('0x3e')]){_0x33a105['where']=_[_0xcf79('0x3f')](_0x33a105[_0xcf79('0x3c')],{'$or':_[_0xcf79('0x2d')](_0x33a105[_0xcf79('0x37')],function(_0x5b035c){var _0x1ac4a3={};_0x1ac4a3[_0x5b035c]={'$like':'%'+_0x220fb0['query'][_0xcf79('0x3e')]+'%'};return _0x1ac4a3;})});}_0x33a105=_[_0xcf79('0x3f')]({},_0x33a105,_0x220fb0['options']);return _0x617cdd[_0xcf79('0x5f')](_0x33a105);}})[_0xcf79('0x28')](function(_0x48fcf4){if(_0x48fcf4){_0x1051b6=_0x48fcf4[_0xcf79('0x49')];if(!_0x220fb0[_0xcf79('0x34')][_0xcf79('0x39')](_0xcf79('0x3a'))){_0x33a105[_0xcf79('0x20')]=qs[_0xcf79('0x20')](_0x220fb0[_0xcf79('0x34')]['limit']);_0x33a105[_0xcf79('0x1f')]=qs[_0xcf79('0x1f')](_0x220fb0['query']['offset']);}return _0x617cdd[_0xcf79('0x5f')](_0x33a105);}})[_0xcf79('0x28')](function(_0x27f42c){if(_0x27f42c){return _0x27f42c?{'count':_0x1051b6,'rows':_0x27f42c}:null;}})['then'](respondWithResult(_0x19e67e,null))[_0xcf79('0x45')](handleError(_0x19e67e,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index ef41892..e2ba6b6 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 _0x6e12=['util','../../config/logger','api','bluebird','request-promise','path','./trigger.attributes','exports','define','tools_triggers','lodash'];(function(_0x271cb9,_0x17baba){var _0x49483b=function(_0x441d4d){while(--_0x441d4d){_0x271cb9['push'](_0x271cb9['shift']());}};_0x49483b(++_0x17baba);}(_0x6e12,0x154));var _0x26e1=function(_0x11a855,_0x42b0eb){_0x11a855=_0x11a855-0x0;var _0x31b0af=_0x6e12[_0x11a855];return _0x31b0af;};'use strict';var _=require(_0x26e1('0x0'));var util=require(_0x26e1('0x1'));var logger=require(_0x26e1('0x2'))(_0x26e1('0x3'));var moment=require('moment');var BPromise=require(_0x26e1('0x4'));var rp=require(_0x26e1('0x5'));var fs=require('fs');var path=require(_0x26e1('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x26e1('0x7'));module[_0x26e1('0x8')]=function(_0x18467c,_0x2073c9){return _0x18467c[_0x26e1('0x9')]('Trigger',attributes,{'tableName':_0x26e1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x885e=['api','moment','bluebird','request-promise','path','./trigger.attributes','exports','Trigger','lodash','util'];(function(_0x2a0b50,_0x33965f){var _0x5d7178=function(_0x5b7115){while(--_0x5b7115){_0x2a0b50['push'](_0x2a0b50['shift']());}};_0x5d7178(++_0x33965f);}(_0x885e,0xe4));var _0xe885=function(_0x1429d9,_0x36c628){_0x1429d9=_0x1429d9-0x0;var _0x15a32e=_0x885e[_0x1429d9];return _0x15a32e;};'use strict';var _=require(_0xe885('0x0'));var util=require(_0xe885('0x1'));var logger=require('../../config/logger')(_0xe885('0x2'));var moment=require(_0xe885('0x3'));var BPromise=require(_0xe885('0x4'));var rp=require(_0xe885('0x5'));var fs=require('fs');var path=require(_0xe885('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe885('0x7'));module[_0xe885('0x8')]=function(_0x33286a,_0x1a5fd6){return _0x33286a['define'](_0xe885('0x9'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 0d26db9..703104e 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 _0x11f8=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetTrigger','Trigger','findAll','options','raw','where','attributes','include','map','model','catch','ShowTrigger','then','lodash','util','bluebird','randomstring'];(function(_0x18563a,_0x3282f9){var _0x2bcce5=function(_0x51e67d){while(--_0x51e67d){_0x18563a['push'](_0x18563a['shift']());}};_0x2bcce5(++_0x3282f9);}(_0x11f8,0xf1));var _0x811f=function(_0xbb5223,_0x4d6983){_0xbb5223=_0xbb5223-0x0;var _0x11532d=_0x11f8[_0xbb5223];return _0x11532d;};'use strict';var _=require(_0x811f('0x0'));var util=require(_0x811f('0x1'));var moment=require('moment');var BPromise=require(_0x811f('0x2'));var rs=require(_0x811f('0x3'));var fs=require('fs');var Redis=require(_0x811f('0x4'));var db=require(_0x811f('0x5'))['db'];var utils=require(_0x811f('0x6'));var logger=require(_0x811f('0x7'))(_0x811f('0x8'));var config=require('../../config/environment');var jayson=require(_0x811f('0x9'));var client=jayson[_0x811f('0xa')][_0x811f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3060de,_0x54bf99,_0xb41e05){return new BPromise(function(_0xf5da7d,_0xb63375){return client[_0x811f('0xc')](_0x3060de,_0xb41e05)['then'](function(_0xd34480){logger[_0x811f('0xd')](_0x811f('0xe'),_0x54bf99,_0x811f('0xf'));logger[_0x811f('0x10')]('Trigger,\x20%s,\x20%s,\x20%s',_0x54bf99,'request\x20sent',JSON[_0x811f('0x11')](_0xd34480));if(_0xd34480[_0x811f('0x12')]){if(_0xd34480[_0x811f('0x12')][_0x811f('0x13')]===0x1f4){logger[_0x811f('0x12')](_0x811f('0xe'),_0x54bf99,_0xd34480[_0x811f('0x12')]['message']);return _0xb63375(_0xd34480['error']['message']);}logger[_0x811f('0x12')](_0x811f('0xe'),_0x54bf99,_0xd34480[_0x811f('0x12')][_0x811f('0x14')]);return _0xf5da7d(_0xd34480['error'][_0x811f('0x14')]);}else{logger['info'](_0x811f('0xe'),_0x54bf99,_0x811f('0xf'));_0xf5da7d(_0xd34480[_0x811f('0x15')][_0x811f('0x14')]);}})['catch'](function(_0x6e8d14){logger[_0x811f('0x12')](_0x811f('0xe'),_0x54bf99,_0x6e8d14);_0xb63375(_0x6e8d14);});});}exports[_0x811f('0x16')]=function(_0x238a98){var _0x309ad4=this;return new Promise(function(_0x2ea462,_0x542c4f){return db[_0x811f('0x17')][_0x811f('0x18')]({'raw':_0x238a98[_0x811f('0x19')]?_0x238a98[_0x811f('0x19')][_0x811f('0x1a')]===undefined?!![]:![]:!![],'where':_0x238a98[_0x811f('0x19')]?_0x238a98[_0x811f('0x19')][_0x811f('0x1b')]||null:null,'attributes':_0x238a98[_0x811f('0x19')]?_0x238a98[_0x811f('0x19')][_0x811f('0x1c')]||null:null,'limit':_0x238a98['options']?_0x238a98[_0x811f('0x19')]['limit']||null:null,'include':_0x238a98[_0x811f('0x19')]?_0x238a98[_0x811f('0x19')][_0x811f('0x1d')]?_[_0x811f('0x1e')](_0x238a98[_0x811f('0x19')][_0x811f('0x1d')],function(_0x368355){return{'model':db[_0x368355['model']],'as':_0x368355['as'],'attributes':_0x368355[_0x811f('0x1c')],'include':_0x368355[_0x811f('0x1d')]?_[_0x811f('0x1e')](_0x368355[_0x811f('0x1d')],function(_0x2b6041){return{'model':db[_0x2b6041[_0x811f('0x1f')]],'as':_0x2b6041['as'],'attributes':_0x2b6041[_0x811f('0x1c')],'include':_0x2b6041['include']?_['map'](_0x2b6041[_0x811f('0x1d')],function(_0x5e968e){return{'model':db[_0x5e968e['model']],'as':_0x5e968e['as'],'attributes':_0x5e968e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x22a10f){logger['info']('GetTrigger',_0x238a98);logger[_0x811f('0x10')](_0x811f('0x16'),_0x238a98,JSON[_0x811f('0x11')](_0x22a10f));_0x2ea462(_0x22a10f);})[_0x811f('0x20')](function(_0x52d574){logger['error'](_0x811f('0x16'),_0x52d574[_0x811f('0x14')],_0x238a98);_0x542c4f(_0x309ad4[_0x811f('0x12')](0x1f4,_0x52d574[_0x811f('0x14')]));});});};exports[_0x811f('0x21')]=function(_0x1f0848){var _0x3dbf29=this;return new Promise(function(_0x934fdf,_0x4cd71d){return db['Trigger']['find']({'raw':_0x1f0848['options']?_0x1f0848[_0x811f('0x19')][_0x811f('0x1a')]===undefined?!![]:![]:!![],'where':_0x1f0848[_0x811f('0x19')]?_0x1f0848['options'][_0x811f('0x1b')]||null:null,'attributes':_0x1f0848[_0x811f('0x19')]?_0x1f0848[_0x811f('0x19')]['attributes']||null:null,'include':_0x1f0848['options']?_0x1f0848[_0x811f('0x19')][_0x811f('0x1d')]?_[_0x811f('0x1e')](_0x1f0848[_0x811f('0x19')][_0x811f('0x1d')],function(_0x249a61){return{'model':db[_0x249a61[_0x811f('0x1f')]],'as':_0x249a61['as'],'attributes':_0x249a61[_0x811f('0x1c')],'include':_0x249a61[_0x811f('0x1d')]?_[_0x811f('0x1e')](_0x249a61[_0x811f('0x1d')],function(_0x27bd6e){return{'model':db[_0x27bd6e[_0x811f('0x1f')]],'as':_0x27bd6e['as'],'attributes':_0x27bd6e[_0x811f('0x1c')],'include':_0x27bd6e['include']?_['map'](_0x27bd6e[_0x811f('0x1d')],function(_0x1d9b47){return{'model':db[_0x1d9b47['model']],'as':_0x1d9b47['as'],'attributes':_0x1d9b47[_0x811f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x811f('0x22')](function(_0x9877b6){logger['info'](_0x811f('0x21'),_0x1f0848);logger[_0x811f('0x10')](_0x811f('0x21'),_0x1f0848,JSON[_0x811f('0x11')](_0x9877b6));_0x934fdf(_0x9877b6);})[_0x811f('0x20')](function(_0x2364f0){logger[_0x811f('0x12')]('ShowTrigger',_0x2364f0[_0x811f('0x14')],_0x1f0848);_0x4cd71d(_0x3dbf29['error'](0x1f4,_0x2364f0[_0x811f('0x14')]));});});}; \ No newline at end of file +var _0xdf6e=['client','http','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','Trigger','findAll','options','raw','where','attributes','limit','map','include','model','GetTrigger','stringify','ShowTrigger','find','then','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x5a4cec,_0x1a93dd){var _0x383105=function(_0x5748f6){while(--_0x5748f6){_0x5a4cec['push'](_0x5a4cec['shift']());}};_0x383105(++_0x1a93dd);}(_0xdf6e,0x183));var _0xedf6=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xdf6e[_0x23e7c1];return _0x1add43;};'use strict';var _=require(_0xedf6('0x0'));var util=require('util');var moment=require(_0xedf6('0x1'));var BPromise=require(_0xedf6('0x2'));var rs=require(_0xedf6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedf6('0x4'))['db'];var utils=require(_0xedf6('0x5'));var logger=require('../../config/logger')(_0xedf6('0x6'));var config=require(_0xedf6('0x7'));var jayson=require(_0xedf6('0x8'));var client=jayson[_0xedf6('0x9')][_0xedf6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfdd785,_0x3dbfe4,_0x562ec5){return new BPromise(function(_0x21dfde,_0x480773){return client['request'](_0xfdd785,_0x562ec5)['then'](function(_0x199c0a){logger['info'](_0xedf6('0xb'),_0x3dbfe4,_0xedf6('0xc'));logger[_0xedf6('0xd')](_0xedf6('0xe'),_0x3dbfe4,_0xedf6('0xc'),JSON['stringify'](_0x199c0a));if(_0x199c0a[_0xedf6('0xf')]){if(_0x199c0a[_0xedf6('0xf')][_0xedf6('0x10')]===0x1f4){logger[_0xedf6('0xf')]('Trigger,\x20%s,\x20%s',_0x3dbfe4,_0x199c0a['error'][_0xedf6('0x11')]);return _0x480773(_0x199c0a[_0xedf6('0xf')]['message']);}logger[_0xedf6('0xf')](_0xedf6('0xb'),_0x3dbfe4,_0x199c0a[_0xedf6('0xf')][_0xedf6('0x11')]);return _0x21dfde(_0x199c0a[_0xedf6('0xf')][_0xedf6('0x11')]);}else{logger[_0xedf6('0x12')]('Trigger,\x20%s,\x20%s',_0x3dbfe4,_0xedf6('0xc'));_0x21dfde(_0x199c0a[_0xedf6('0x13')][_0xedf6('0x11')]);}})[_0xedf6('0x14')](function(_0x10ff23){logger[_0xedf6('0xf')]('Trigger,\x20%s,\x20%s',_0x3dbfe4,_0x10ff23);_0x480773(_0x10ff23);});});}exports['GetTrigger']=function(_0x53a5c3){var _0x52ab04=this;return new Promise(function(_0x1d903d,_0x3e055d){return db[_0xedf6('0x15')][_0xedf6('0x16')]({'raw':_0x53a5c3['options']?_0x53a5c3[_0xedf6('0x17')][_0xedf6('0x18')]===undefined?!![]:![]:!![],'where':_0x53a5c3[_0xedf6('0x17')]?_0x53a5c3[_0xedf6('0x17')][_0xedf6('0x19')]||null:null,'attributes':_0x53a5c3[_0xedf6('0x17')]?_0x53a5c3['options'][_0xedf6('0x1a')]||null:null,'limit':_0x53a5c3['options']?_0x53a5c3[_0xedf6('0x17')][_0xedf6('0x1b')]||null:null,'include':_0x53a5c3['options']?_0x53a5c3[_0xedf6('0x17')]['include']?_[_0xedf6('0x1c')](_0x53a5c3[_0xedf6('0x17')][_0xedf6('0x1d')],function(_0x30ce8a){return{'model':db[_0x30ce8a[_0xedf6('0x1e')]],'as':_0x30ce8a['as'],'attributes':_0x30ce8a[_0xedf6('0x1a')],'include':_0x30ce8a[_0xedf6('0x1d')]?_['map'](_0x30ce8a[_0xedf6('0x1d')],function(_0x4f2ceb){return{'model':db[_0x4f2ceb[_0xedf6('0x1e')]],'as':_0x4f2ceb['as'],'attributes':_0x4f2ceb[_0xedf6('0x1a')],'include':_0x4f2ceb['include']?_[_0xedf6('0x1c')](_0x4f2ceb[_0xedf6('0x1d')],function(_0x2c3083){return{'model':db[_0x2c3083[_0xedf6('0x1e')]],'as':_0x2c3083['as'],'attributes':_0x2c3083[_0xedf6('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x58eda7){logger['info'](_0xedf6('0x1f'),_0x53a5c3);logger[_0xedf6('0xd')](_0xedf6('0x1f'),_0x53a5c3,JSON[_0xedf6('0x20')](_0x58eda7));_0x1d903d(_0x58eda7);})[_0xedf6('0x14')](function(_0x5af9e4){logger[_0xedf6('0xf')](_0xedf6('0x1f'),_0x5af9e4['message'],_0x53a5c3);_0x3e055d(_0x52ab04[_0xedf6('0xf')](0x1f4,_0x5af9e4[_0xedf6('0x11')]));});});};exports[_0xedf6('0x21')]=function(_0x323c3c){var _0x4ccc0c=this;return new Promise(function(_0x3b2186,_0x296f0d){return db['Trigger'][_0xedf6('0x22')]({'raw':_0x323c3c['options']?_0x323c3c['options'][_0xedf6('0x18')]===undefined?!![]:![]:!![],'where':_0x323c3c['options']?_0x323c3c[_0xedf6('0x17')]['where']||null:null,'attributes':_0x323c3c[_0xedf6('0x17')]?_0x323c3c[_0xedf6('0x17')][_0xedf6('0x1a')]||null:null,'include':_0x323c3c[_0xedf6('0x17')]?_0x323c3c[_0xedf6('0x17')]['include']?_[_0xedf6('0x1c')](_0x323c3c[_0xedf6('0x17')][_0xedf6('0x1d')],function(_0x35caeb){return{'model':db[_0x35caeb['model']],'as':_0x35caeb['as'],'attributes':_0x35caeb['attributes'],'include':_0x35caeb['include']?_[_0xedf6('0x1c')](_0x35caeb[_0xedf6('0x1d')],function(_0x4bbd29){return{'model':db[_0x4bbd29['model']],'as':_0x4bbd29['as'],'attributes':_0x4bbd29[_0xedf6('0x1a')],'include':_0x4bbd29[_0xedf6('0x1d')]?_[_0xedf6('0x1c')](_0x4bbd29[_0xedf6('0x1d')],function(_0x3052f6){return{'model':db[_0x3052f6['model']],'as':_0x3052f6['as'],'attributes':_0x3052f6['attributes']};}):[]};}):[]};}):[]:[]})[_0xedf6('0x23')](function(_0x46922d){logger['info'](_0xedf6('0x21'),_0x323c3c);logger[_0xedf6('0xd')](_0xedf6('0x21'),_0x323c3c,JSON[_0xedf6('0x20')](_0x46922d));_0x3b2186(_0x46922d);})['catch'](function(_0x382fe9){logger[_0xedf6('0xf')](_0xedf6('0x21'),_0x382fe9[_0xedf6('0x11')],_0x323c3c);_0x296f0d(_0x4ccc0c[_0xedf6('0xf')](0x1f4,_0x382fe9[_0xedf6('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 3d192ba..08aa775 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 _0x38fc=['update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','post','/:id/clone','clone','create','put'];(function(_0x4c705b,_0x487a40){var _0x23a05d=function(_0x25186a){while(--_0x25186a){_0x4c705b['push'](_0x4c705b['shift']());}};_0x23a05d(++_0x487a40);}(_0x38fc,0x18f));var _0xc38f=function(_0x2b4711,_0x9738e6){_0x2b4711=_0x2b4711-0x0;var _0x156348=_0x38fc[_0x2b4711];return _0x156348;};'use strict';var multer=require(_0xc38f('0x0'));var util=require(_0xc38f('0x1'));var path=require(_0xc38f('0x2'));var timeout=require(_0xc38f('0x3'));var express=require(_0xc38f('0x4'));var router=express[_0xc38f('0x5')]();var fs_extra=require(_0xc38f('0x6'));var auth=require(_0xc38f('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xc38f('0x8'));var controller=require(_0xc38f('0x9'));router[_0xc38f('0xa')]('/',auth[_0xc38f('0xb')](),controller[_0xc38f('0xc')]);router[_0xc38f('0xa')](_0xc38f('0xd'),auth[_0xc38f('0xb')](),controller['show']);router[_0xc38f('0xe')](_0xc38f('0xf'),auth[_0xc38f('0xb')](),controller[_0xc38f('0x10')]);router[_0xc38f('0xe')]('/',auth[_0xc38f('0xb')](),controller[_0xc38f('0x11')]);router[_0xc38f('0x12')](_0xc38f('0xd'),auth[_0xc38f('0xb')](),controller[_0xc38f('0x13')]);router[_0xc38f('0x14')](_0xc38f('0xd'),auth[_0xc38f('0xb')](),controller['destroy']);module[_0xc38f('0x15')]=router; \ No newline at end of file +var _0x3a94=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','isAuthenticated','index','/:id','show','/:id/clone','clone','create','put','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x4b97c3,_0x597c23){var _0x5e29ec=function(_0x599891){while(--_0x599891){_0x4b97c3['push'](_0x4b97c3['shift']());}};_0x5e29ec(++_0x597c23);}(_0x3a94,0x121));var _0x43a9=function(_0xc09c95,_0x7d6cb3){_0xc09c95=_0xc09c95-0x0;var _0x269489=_0x3a94[_0xc09c95];return _0x269489;};'use strict';var multer=require(_0x43a9('0x0'));var util=require(_0x43a9('0x1'));var path=require(_0x43a9('0x2'));var timeout=require(_0x43a9('0x3'));var express=require(_0x43a9('0x4'));var router=express[_0x43a9('0x5')]();var fs_extra=require(_0x43a9('0x6'));var auth=require(_0x43a9('0x7'));var interaction=require(_0x43a9('0x8'));var config=require(_0x43a9('0x9'));var controller=require(_0x43a9('0xa'));router['get']('/',auth[_0x43a9('0xb')](),controller[_0x43a9('0xc')]);router['get'](_0x43a9('0xd'),auth['isAuthenticated'](),controller[_0x43a9('0xe')]);router['post'](_0x43a9('0xf'),auth[_0x43a9('0xb')](),controller[_0x43a9('0x10')]);router['post']('/',auth[_0x43a9('0xb')](),controller[_0x43a9('0x11')]);router[_0x43a9('0x12')](_0x43a9('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x43a9('0x13')]('/:id',auth[_0x43a9('0xb')](),controller['destroy']);module[_0x43a9('0x14')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 27445a5..b73122e 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 _0x9069=['actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','ENUM','friend','user','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','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','yes','nonat','update','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','certificate','active','passive'];(function(_0x1b2531,_0x447a58){var _0x12c2b8=function(_0x348ddc){while(--_0x348ddc){_0x1b2531['push'](_0x1b2531['shift']());}};_0x12c2b8(++_0x447a58);}(_0x9069,0xf9));var _0x9906=function(_0x2cb71c,_0x503573){_0x2cb71c=_0x2cb71c-0x0;var _0x9c5a36=_0x9069[_0x2cb71c];return _0x9c5a36;};'use strict';var Sequelize=require(_0x9906('0x0'));module[_0x9906('0x1')]={'name':{'type':Sequelize[_0x9906('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x9906('0x3')](_0x9906('0x4'),_0x9906('0x5'),'peer'),'allowNull':![],'defaultValue':_0x9906('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x9906('0x3')](_0x9906('0x6'),_0x9906('0x7'),_0x9906('0x8'),_0x9906('0x9'),_0x9906('0xa'),_0x9906('0xb'),_0x9906('0xc'),_0x9906('0xd'))},'deny':{'type':Sequelize[_0x9906('0x2')]},'permit':{'type':Sequelize[_0x9906('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x9906('0x2')]},'remotesecret':{'type':Sequelize[_0x9906('0x2')]},'transport':{'type':Sequelize[_0x9906('0x2')],'defaultValue':_0x9906('0xe'),'set':function(_0x4a36bd){this[_0x9906('0xf')](_0x9906('0x10'),_0x4a36bd?_0x4a36bd[_0x9906('0x11')](','):null);},'get':function(){return this[_0x9906('0x12')](_0x9906('0x10'))?this[_0x9906('0x12')](_0x9906('0x10'))['split'](','):null;},'comment':_0x9906('0x13')},'dtmfmode':{'type':Sequelize[_0x9906('0x3')](_0x9906('0x14'),'info',_0x9906('0x15'),'inband','auto'),'defaultValue':_0x9906('0x14')},'directmedia':{'type':Sequelize[_0x9906('0x3')](_0x9906('0x16'),'no',_0x9906('0x17'),_0x9906('0x18'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x9906('0x2')]},'directmediadeny':{'type':Sequelize[_0x9906('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x294d39){this['setDataValue'](_0x9906('0x19'),_0x294d39?_0x294d39[_0x9906('0x11')](','):null);},'get':function(){return this['getDataValue']('nat')?this['getDataValue'](_0x9906('0x19'))['split'](','):null;},'comment':_0x9906('0x1a')},'callgroup':{'type':Sequelize[_0x9906('0x2')]},'namedcallgroup':{'type':Sequelize[_0x9906('0x2')]},'pickupgroup':{'type':Sequelize[_0x9906('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x9906('0x2')]},'language':{'type':Sequelize[_0x9906('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x9906('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x9906('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x9906('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x571534){this[_0x9906('0xf')](_0x9906('0x1b'),_0x571534?_0x571534[_0x9906('0x11')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x9906('0x12')](_0x9906('0x1b'))?this['getDataValue'](_0x9906('0x1b'))[_0x9906('0x1c')](';'):null;},'comment':_0x9906('0x1d')},'autoframing':{'type':Sequelize[_0x9906('0x3')](_0x9906('0x16'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x9906('0x1e'),'set':function(_0x275d91){this[_0x9906('0xf')](_0x9906('0x1f'),_0x275d91?_0x275d91[_0x9906('0x11')](','):null);},'get':function(){return this['getDataValue'](_0x9906('0x1f'))?this['getDataValue'](_0x9906('0x1f'))[_0x9906('0x1c')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x9906('0x3')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x9906('0x3')](_0x9906('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x9906('0x3')]('yes','no',_0x9906('0x20'))},'promiscredir':{'type':Sequelize[_0x9906('0x3')]('yes','no')},'useclientcode':{'type':Sequelize[_0x9906('0x3')]('yes','no')},'accountcode':{'type':Sequelize[_0x9906('0x21')](0xb)},'setvar':{'type':Sequelize[_0x9906('0x2')]},'callerid':{'type':Sequelize[_0x9906('0x2')],'defaultValue':_0x9906('0x22')},'amaflags':{'type':Sequelize[_0x9906('0x2')]},'callcounter':{'type':Sequelize[_0x9906('0x3')]('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x9906('0x21')](0xb)},'allowoverlap':{'type':Sequelize[_0x9906('0x3')](_0x9906('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0x9906('0x3')](_0x9906('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0x9906('0x3')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x9906('0x3')](_0x9906('0x16'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x9906('0x2')]},'videosupport':{'type':Sequelize[_0x9906('0x3')](_0x9906('0x16'),'no',_0x9906('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x9906('0x21')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x9906('0x16'),'no')},'mailbox':{'type':Sequelize[_0x9906('0x2')]},'session_timers':{'type':Sequelize[_0x9906('0x3')](_0x9906('0x24'),_0x9906('0x25'),_0x9906('0x26'))},'session_expires':{'type':Sequelize[_0x9906('0x21')](0xb)},'session_minse':{'type':Sequelize[_0x9906('0x21')](0xb)},'session_refresher':{'type':Sequelize[_0x9906('0x3')](_0x9906('0x27'),_0x9906('0x28')),'defaultValue':_0x9906('0x28')},'t38pt_usertpsource':{'type':Sequelize[_0x9906('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x9906('0x2')]},'fromuser':{'type':Sequelize[_0x9906('0x2')]},'port':{'type':Sequelize[_0x9906('0x21')](0x5)},'qualify':{'type':Sequelize[_0x9906('0x3')](_0x9906('0x16'),'no'),'defaultValue':_0x9906('0x16')},'keepalive':{'type':Sequelize[_0x9906('0x21')](0xb)},'defaultip':{'type':Sequelize[_0x9906('0x2')]},'defaultuser':{'type':Sequelize[_0x9906('0x2')]},'rtptimeout':{'type':Sequelize[_0x9906('0x21')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x9906('0x21')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x9906('0x16'),'no',_0x9906('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x9906('0x21')](0xb)},'timerb':{'type':Sequelize[_0x9906('0x21')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x9906('0x2')]},'use_q850_reason':{'type':Sequelize[_0x9906('0x2')]},'maxforwards':{'type':Sequelize[_0x9906('0x21')](0xb)},'encryption':{'type':Sequelize[_0x9906('0x3')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x9906('0x3')](_0x9906('0x16'),'no')},'force_avp':{'type':Sequelize[_0x9906('0x3')](_0x9906('0x16'),'no')},'icesupport':{'type':Sequelize[_0x9906('0x3')](_0x9906('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0x9906('0x3')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x9906('0x3')](_0x9906('0x16'),'no','fingerprint',_0x9906('0x2a'))},'dtlsrekey':{'type':Sequelize[_0x9906('0x21')](0xb)},'dtlscertfile':{'type':Sequelize[_0x9906('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x9906('0x2')]},'dtlscipher':{'type':Sequelize[_0x9906('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x9906('0x3')](_0x9906('0x2b'),_0x9906('0x2c'),_0x9906('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x9906('0x2')]},'usereqphone':{'type':Sequelize[_0x9906('0x3')](_0x9906('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x9906('0x2')]},'recordofffeature':{'type':Sequelize[_0x9906('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x9906('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0x9906('0x3')](_0x9906('0x16'),'no')},'vmexten':{'type':Sequelize[_0x9906('0x2')]},'mohinterpret':{'type':Sequelize[_0x9906('0x2')]},'mohsuggest':{'type':Sequelize[_0x9906('0x2')]},'parkinglot':{'type':Sequelize[_0x9906('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x9906('0x2')],'defaultValue':_0x9906('0x2e')},'canreinvite':{'type':Sequelize[_0x9906('0x3')](_0x9906('0x16'),'no',_0x9906('0x17'),'update',_0x9906('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x9906('0x2')]},'otherFields':{'type':Sequelize[_0x9906('0x2')]},'active':{'type':Sequelize[_0x9906('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0x657e=['INTEGER','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','actpass','dynamic','update','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer','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','rfc2833','info','shortinfo','inband','yes','nonat','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never'];(function(_0x281dc2,_0x17f49b){var _0x5b3401=function(_0x5e81af){while(--_0x5e81af){_0x281dc2['push'](_0x281dc2['shift']());}};_0x5b3401(++_0x17f49b);}(_0x657e,0x10e));var _0xe657=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x657e[_0x47b58b];return _0x46bebe;};'use strict';var Sequelize=require(_0xe657('0x0'));module[_0xe657('0x1')]={'name':{'type':Sequelize[_0xe657('0x2')],'allowNull':![],'unique':_0xe657('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xe657('0x4')](_0xe657('0x5'),_0xe657('0x6'),_0xe657('0x7')),'allowNull':![],'defaultValue':_0xe657('0x5')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize['ENUM'](_0xe657('0x8'),_0xe657('0x9'),_0xe657('0xa'),_0xe657('0xb'),_0xe657('0xc'),_0xe657('0xd'),_0xe657('0xe'),_0xe657('0xf'))},'deny':{'type':Sequelize[_0xe657('0x2')]},'permit':{'type':Sequelize[_0xe657('0x2')]},'secret':{'type':Sequelize[_0xe657('0x2')]},'md5secret':{'type':Sequelize[_0xe657('0x2')]},'remotesecret':{'type':Sequelize[_0xe657('0x2')]},'transport':{'type':Sequelize[_0xe657('0x2')],'defaultValue':_0xe657('0x10'),'set':function(_0x5c35d9){this[_0xe657('0x11')](_0xe657('0x12'),_0x5c35d9?_0x5c35d9[_0xe657('0x13')](','):null);},'get':function(){return this[_0xe657('0x14')](_0xe657('0x12'))?this[_0xe657('0x14')](_0xe657('0x12'))[_0xe657('0x15')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xe657('0x4')](_0xe657('0x16'),_0xe657('0x17'),_0xe657('0x18'),_0xe657('0x19'),'auto'),'defaultValue':_0xe657('0x16')},'directmedia':{'type':Sequelize[_0xe657('0x4')](_0xe657('0x1a'),'no',_0xe657('0x1b'),'update','outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xe657('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xe657('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xe657('0x2')],'defaultValue':_0xe657('0x1c'),'set':function(_0x4b75b7){this[_0xe657('0x11')](_0xe657('0x1d'),_0x4b75b7?_0x4b75b7[_0xe657('0x13')](','):null);},'get':function(){return this[_0xe657('0x14')](_0xe657('0x1d'))?this['getDataValue'](_0xe657('0x1d'))['split'](','):null;},'comment':_0xe657('0x1e')},'callgroup':{'type':Sequelize[_0xe657('0x2')]},'namedcallgroup':{'type':Sequelize[_0xe657('0x2')]},'pickupgroup':{'type':Sequelize[_0xe657('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xe657('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xe657('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xe657('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize[_0xe657('0x2')],'allowNull':![],'defaultValue':_0xe657('0x1f'),'set':function(_0xd5c5b){this[_0xe657('0x11')](_0xe657('0x20'),_0xd5c5b?_0xd5c5b[_0xe657('0x13')](';'):_0xe657('0x1f'));},'get':function(){return this[_0xe657('0x14')](_0xe657('0x20'))?this['getDataValue'](_0xe657('0x20'))[_0xe657('0x15')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xe657('0x4')](_0xe657('0x1a'),'no')},'insecure':{'type':Sequelize[_0xe657('0x2')],'defaultValue':'port,invite','set':function(_0x4a0f29){this['setDataValue'](_0xe657('0x21'),_0x4a0f29?_0x4a0f29[_0xe657('0x13')](','):null);},'get':function(){return this['getDataValue'](_0xe657('0x21'))?this[_0xe657('0x14')](_0xe657('0x21'))[_0xe657('0x15')](','):null;},'comment':_0xe657('0x22')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xe657('0x4')](_0xe657('0x1a'),'no',_0xe657('0x23'))},'promiscredir':{'type':Sequelize[_0xe657('0x4')](_0xe657('0x1a'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0xe657('0x1a'),'no')},'accountcode':{'type':Sequelize[_0xe657('0x24')](0xb)},'setvar':{'type':Sequelize[_0xe657('0x2')]},'callerid':{'type':Sequelize[_0xe657('0x2')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xe657('0x4')](_0xe657('0x1a'),'no'),'defaultValue':_0xe657('0x1a')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize['ENUM']('yes','no')},'allowsubscribe':{'type':Sequelize[_0xe657('0x4')](_0xe657('0x1a'),'no')},'allowtransfer':{'type':Sequelize['ENUM']('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xe657('0x4')]('yes','no')},'subscribecontext':{'type':Sequelize[_0xe657('0x2')]},'template':{'type':Sequelize[_0xe657('0x2')]},'videosupport':{'type':Sequelize[_0xe657('0x4')]('yes','no',_0xe657('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xe657('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xe657('0x4')](_0xe657('0x1a'),'no')},'mailbox':{'type':Sequelize[_0xe657('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0xe657('0x26'),_0xe657('0x27'),_0xe657('0x28'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xe657('0x24')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xe657('0x29'),_0xe657('0x2a')),'defaultValue':_0xe657('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0xe657('0x2')]},'regexten':{'type':Sequelize[_0xe657('0x2')]},'fromdomain':{'type':Sequelize[_0xe657('0x2')]},'fromuser':{'type':Sequelize[_0xe657('0x2')]},'port':{'type':Sequelize[_0xe657('0x24')](0x5)},'qualify':{'type':Sequelize[_0xe657('0x4')](_0xe657('0x1a'),'no'),'defaultValue':_0xe657('0x1a')},'keepalive':{'type':Sequelize[_0xe657('0x24')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0xe657('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xe657('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xe657('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0xe657('0x4')](_0xe657('0x1a'),'no',_0xe657('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xe657('0x2')]},'callbackextension':{'type':Sequelize[_0xe657('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0xe657('0x24')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xe657('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xe657('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xe657('0x2')]},'use_q850_reason':{'type':Sequelize[_0xe657('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xe657('0x4')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xe657('0x1a'),'no')},'force_avp':{'type':Sequelize[_0xe657('0x4')](_0xe657('0x1a'),'no')},'icesupport':{'type':Sequelize[_0xe657('0x4')](_0xe657('0x1a'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xe657('0x1a'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0xe657('0x1a'),'no',_0xe657('0x2c'),_0xe657('0x2d'))},'dtlsrekey':{'type':Sequelize[_0xe657('0x24')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0xe657('0x2')]},'dtlscafile':{'type':Sequelize[_0xe657('0x2')]},'dtlscapath':{'type':Sequelize[_0xe657('0x2')]},'dtlssetup':{'type':Sequelize[_0xe657('0x4')]('active','passive',_0xe657('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize['ENUM'](_0xe657('0x1a'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xe657('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xe657('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xe657('0x1a'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0xe657('0x1a'),'no')},'vmexten':{'type':Sequelize[_0xe657('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xe657('0x2')]},'parkinglot':{'type':Sequelize[_0xe657('0x2')]},'description':{'type':Sequelize[_0xe657('0x2')]},'host':{'type':Sequelize[_0xe657('0x2')],'defaultValue':_0xe657('0x2f')},'canreinvite':{'type':Sequelize[_0xe657('0x4')](_0xe657('0x1a'),'no',_0xe657('0x1b'),_0xe657('0x30'),_0xe657('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xe657('0x2')]},'otherFields':{'type':Sequelize[_0xe657('0x2')]},'active':{'type':Sequelize[_0xe657('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xe657('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 6a3ed6c..5e534b1 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 _0x8d0e=['omit','updatedAt','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','readFileSync','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','reject','update','destroy','get','Trunks','stack','name','send','map','Trunk','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','keys','rawAttributes','includeAll','find','createdAt','body'];(function(_0x1c238f,_0x36012b){var _0x344288=function(_0x59127f){while(--_0x59127f){_0x1c238f['push'](_0x1c238f['shift']());}};_0x344288(++_0x36012b);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x2e4e75,_0x4af94a){_0x2e4e75=_0x2e4e75-0x0;var _0x3db62f=_0x8d0e[_0x2e4e75];return _0x3db62f;};'use strict';var emlformat=require(_0xe8d0('0x0'));var rimraf=require(_0xe8d0('0x1'));var zipdir=require(_0xe8d0('0x2'));var jsonpatch=require(_0xe8d0('0x3'));var rp=require(_0xe8d0('0x4'));var moment=require(_0xe8d0('0x5'));var BPromise=require(_0xe8d0('0x6'));var Mustache=require(_0xe8d0('0x7'));var util=require(_0xe8d0('0x8'));var path=require('path');var sox=require(_0xe8d0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe8d0('0xa'));var _=require(_0xe8d0('0xb'));var squel=require(_0xe8d0('0xc'));var crypto=require(_0xe8d0('0xd'));var jsforce=require(_0xe8d0('0xe'));var deskjs=require(_0xe8d0('0xf'));var toCsv=require(_0xe8d0('0x10'));var querystring=require(_0xe8d0('0x11'));var Papa=require('papaparse');var Redis=require(_0xe8d0('0x12'));var authService=require(_0xe8d0('0x13'));var qs=require(_0xe8d0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe8d0('0x15'))(_0xe8d0('0x16'));var utils=require(_0xe8d0('0x17'));var config=require(_0xe8d0('0x18'));var licenseUtil=require(_0xe8d0('0x19'));var db=require(_0xe8d0('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe8d0('0x1b')][_0xe8d0('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x533b42,_0x2b640d,_0x4cbd26,_0x59b4b7){return new BPromise(function(_0x90a1ea,_0x2aa906){var _0x1aa725=_0x59b4b7||client;return _0x1aa725[_0xe8d0('0x1d')](_0x533b42,_0x4cbd26)[_0xe8d0('0x1e')](function(_0x7151c6){logger['info'](_0xe8d0('0x1f'),_0x2b640d,'request\x20sent');logger[_0xe8d0('0x20')](_0xe8d0('0x21'),_0x2b640d,_0xe8d0('0x22'),JSON['stringify'](_0x7151c6));if(_0x7151c6['error']){if(_0x7151c6['error'][_0xe8d0('0x23')]===0x1f4){logger[_0xe8d0('0x24')](_0xe8d0('0x1f'),_0x2b640d,_0x7151c6[_0xe8d0('0x24')][_0xe8d0('0x25')]);return _0x2aa906(_0x7151c6['error'][_0xe8d0('0x25')]);}logger[_0xe8d0('0x24')]('Trunk,\x20%s,\x20%s',_0x2b640d,_0x7151c6['error']['message']);return _0x90a1ea(_0x7151c6[_0xe8d0('0x24')][_0xe8d0('0x25')]);}else{logger[_0xe8d0('0x26')](_0xe8d0('0x1f'),_0x2b640d,_0xe8d0('0x22'));_0x90a1ea(_0x7151c6[_0xe8d0('0x27')][_0xe8d0('0x25')]);}})[_0xe8d0('0x28')](function(_0x32e39a){logger['error'](_0xe8d0('0x1f'),_0x2b640d,_0x32e39a);_0x2aa906(_0x32e39a);});});}function respondWithStatusCode(_0x9f747,_0x572c25){_0x572c25=_0x572c25||0xcc;return function(_0x106614){if(_0x106614){return _0x9f747[_0xe8d0('0x29')](_0x572c25);}return _0x9f747[_0xe8d0('0x2a')](_0x572c25)[_0xe8d0('0x2b')]();};}function respondWithResult(_0x146783,_0x149dfd){_0x149dfd=_0x149dfd||0xc8;return function(_0x31519b){if(_0x31519b){return _0x146783[_0xe8d0('0x2a')](_0x149dfd)[_0xe8d0('0x2c')](_0x31519b);}};}function respondWithFilteredResult(_0x2dee67,_0x264de4){return function(_0x539548){if(_0x539548){var _0x24982c=typeof _0x264de4[_0xe8d0('0x2d')]===_0xe8d0('0x2e')&&typeof _0x264de4['limit']===_0xe8d0('0x2e');var _0x343b08=_0x539548['count'];var _0x1519e2=_0x24982c?0x0:_0x264de4[_0xe8d0('0x2d')];var _0x11fcf2=_0x24982c?_0x539548[_0xe8d0('0x2f')]:_0x264de4[_0xe8d0('0x2d')]+_0x264de4['limit'];var _0x3cc292;if(_0x11fcf2>=_0x343b08){_0x11fcf2=_0x343b08;_0x3cc292=0xc8;}else{_0x3cc292=0xce;}_0x2dee67['status'](_0x3cc292);return _0x2dee67['set']('Content-Range',_0x1519e2+'-'+_0x11fcf2+'/'+_0x343b08)[_0xe8d0('0x2c')](_0x539548);}return null;};}function patchUpdates(_0x13cd4c){return function(_0x36ccec){try{jsonpatch['apply'](_0x36ccec,_0x13cd4c,!![]);}catch(_0x57e375){return BPromise[_0xe8d0('0x30')](_0x57e375);}return _0x36ccec['save']();};}function saveUpdates(_0x3b5d31,_0x383084){return function(_0x327004){if(_0x327004){return _0x327004[_0xe8d0('0x31')](_0x3b5d31)[_0xe8d0('0x1e')](function(_0x5bbc9e){return _0x5bbc9e;});}return null;};}function removeEntity(_0x1bee61,_0x4db53c){return function(_0x402e90){if(_0x402e90){return _0x402e90[_0xe8d0('0x32')]()['then'](function(){var _0x4547b6=_0x402e90[_0xe8d0('0x33')]({'plain':!![]});var _0x4c1347=_0xe8d0('0x34');return db['UserProfileResource'][_0xe8d0('0x32')]({'where':{'type':_0x4c1347,'resourceId':_0x4547b6['id']}})['then'](function(){return _0x402e90;});})[_0xe8d0('0x1e')](function(){_0x1bee61['status'](0xcc)[_0xe8d0('0x2b')]();});}};}function handleEntityNotFound(_0xb2cdbf,_0x1e2430){return function(_0x320565){if(!_0x320565){_0xb2cdbf['sendStatus'](0x194);}return _0x320565;};}function handleError(_0x36a650,_0x354e19){_0x354e19=_0x354e19||0x1f4;return function(_0x20eec5){logger['error'](_0x20eec5[_0xe8d0('0x35')]);if(_0x20eec5[_0xe8d0('0x36')]){delete _0x20eec5[_0xe8d0('0x36')];}_0x36a650[_0xe8d0('0x2a')](_0x354e19)[_0xe8d0('0x37')](_0x20eec5);};}exports['index']=function(_0x5a969a,_0x1828c5){var _0x10970d={},_0x3d76d5={},_0x318106={'count':0x0,'rows':[]};var _0x23d72e=_[_0xe8d0('0x38')](db[_0xe8d0('0x39')]['rawAttributes'],function(_0x5dff14){return{'name':_0x5dff14[_0xe8d0('0x3a')],'type':_0x5dff14[_0xe8d0('0x3b')][_0xe8d0('0x3c')]};});_0x3d76d5[_0xe8d0('0x3d')]=_[_0xe8d0('0x38')](_0x23d72e,'name');_0x3d76d5[_0xe8d0('0x3e')]=_['keys'](_0x5a969a[_0xe8d0('0x3e')]);_0x3d76d5[_0xe8d0('0x3f')]=_[_0xe8d0('0x40')](_0x3d76d5['model'],_0x3d76d5[_0xe8d0('0x3e')]);_0x10970d[_0xe8d0('0x41')]=_[_0xe8d0('0x40')](_0x3d76d5[_0xe8d0('0x3d')],qs[_0xe8d0('0x42')](_0x5a969a['query']['fields']));_0x10970d['attributes']=_0x10970d['attributes'][_0xe8d0('0x43')]?_0x10970d['attributes']:_0x3d76d5[_0xe8d0('0x3d')];if(!_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x44')](_0xe8d0('0x45'))){_0x10970d[_0xe8d0('0x46')]=qs[_0xe8d0('0x46')](_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x46')]);_0x10970d['offset']=qs[_0xe8d0('0x2d')](_0x5a969a[_0xe8d0('0x3e')]['offset']);}_0x10970d['order']=qs[_0xe8d0('0x47')](_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x47')]);_0x10970d['where']=qs[_0xe8d0('0x3f')](_[_0xe8d0('0x48')](_0x5a969a['query'],_0x3d76d5[_0xe8d0('0x3f')]),_0x23d72e);if(_0x5a969a[_0xe8d0('0x3e')]['filter']){_0x10970d[_0xe8d0('0x49')]=_[_0xe8d0('0x4a')](_0x10970d[_0xe8d0('0x49')],{'$or':_[_0xe8d0('0x38')](_0x23d72e,function(_0x1d5815){if(_0x1d5815[_0xe8d0('0x3b')]!==_0xe8d0('0x4b')){var _0x1ce97d={};_0x1ce97d[_0x1d5815['name']]={'$like':'%'+_0x5a969a[_0xe8d0('0x3e')][_0xe8d0('0x4c')]+'%'};return _0x1ce97d;}})});}_0x10970d=_[_0xe8d0('0x4a')]({},_0x10970d,_0x5a969a[_0xe8d0('0x4d')]);var _0x28d38b={'where':_0x10970d[_0xe8d0('0x49')]};return db[_0xe8d0('0x39')][_0xe8d0('0x2f')](_0x28d38b)[_0xe8d0('0x1e')](function(_0x2e2c05){_0x318106[_0xe8d0('0x2f')]=_0x2e2c05;if(_0x5a969a[_0xe8d0('0x3e')]['includeAll']){_0x10970d[_0xe8d0('0x4e')]=[{'all':!![]}];}return db[_0xe8d0('0x39')][_0xe8d0('0x4f')](_0x10970d);})[_0xe8d0('0x1e')](function(_0x34047c){_0x318106[_0xe8d0('0x50')]=_0x34047c;return _0x318106;})[_0xe8d0('0x1e')](respondWithFilteredResult(_0x1828c5,_0x10970d))['catch'](handleError(_0x1828c5,null));};exports[_0xe8d0('0x51')]=function(_0x424764,_0x151cf4){var _0x205933={'raw':![],'where':{'id':_0x424764[_0xe8d0('0x52')]['id']}},_0x4ed47f={};_0x4ed47f['model']=_[_0xe8d0('0x53')](db[_0xe8d0('0x39')][_0xe8d0('0x54')]);_0x4ed47f[_0xe8d0('0x3e')]=_[_0xe8d0('0x53')](_0x424764[_0xe8d0('0x3e')]);_0x4ed47f[_0xe8d0('0x3f')]=_['intersection'](_0x4ed47f[_0xe8d0('0x3d')],_0x4ed47f['query']);_0x205933['attributes']=_[_0xe8d0('0x40')](_0x4ed47f['model'],qs[_0xe8d0('0x42')](_0x424764['query'][_0xe8d0('0x42')]));_0x205933[_0xe8d0('0x41')]=_0x205933[_0xe8d0('0x41')][_0xe8d0('0x43')]?_0x205933['attributes']:_0x4ed47f[_0xe8d0('0x3d')];if(_0x424764[_0xe8d0('0x3e')][_0xe8d0('0x55')]){_0x205933[_0xe8d0('0x4e')]=[{'all':!![]}];}_0x205933=_[_0xe8d0('0x4a')]({},_0x205933,_0x424764['options']);return db[_0xe8d0('0x39')][_0xe8d0('0x56')](_0x205933)[_0xe8d0('0x1e')](handleEntityNotFound(_0x151cf4,null))['then'](respondWithResult(_0x151cf4,null))[_0xe8d0('0x28')](handleError(_0x151cf4,null));};exports['clone']=function(_0x56b4fa,_0x1bd329){var _0x37040a={'where':{'id':_0x56b4fa[_0xe8d0('0x52')]['id']}},_0x4e7b49={};_0x4e7b49[_0xe8d0('0x3d')]=_['keys'](db[_0xe8d0('0x39')][_0xe8d0('0x54')]);_0x37040a[_0xe8d0('0x41')]=_[_0xe8d0('0x40')](_0x4e7b49['model'],qs[_0xe8d0('0x42')](_0x56b4fa[_0xe8d0('0x3e')][_0xe8d0('0x42')]));_0x37040a[_0xe8d0('0x41')]=_0x37040a['attributes'][_0xe8d0('0x43')]?_0x37040a[_0xe8d0('0x41')]:_0x4e7b49[_0xe8d0('0x3d')];if(_0x56b4fa[_0xe8d0('0x3e')][_0xe8d0('0x55')]){_0x37040a[_0xe8d0('0x4e')]=[{'all':!![]}];}_0x37040a=_['merge']({},_0x37040a,_0x56b4fa['options']);return db[_0xe8d0('0x39')]['find'](_0x37040a)[_0xe8d0('0x1e')](handleEntityNotFound(_0x1bd329,null))[_0xe8d0('0x1e')](function(_0x4c0d4c){if(_0x4c0d4c){var _0x5ac1ae=_0x4c0d4c[_0xe8d0('0x33')]({'plain':!![]});_0x5ac1ae=qs['omit'](_0x5ac1ae,['id',_0xe8d0('0x57'),'updatedAt']);_0x56b4fa[_0xe8d0('0x58')]=_[_0xe8d0('0x59')](_0x56b4fa[_0xe8d0('0x58')],['id','createdAt',_0xe8d0('0x5a')]);return db[_0xe8d0('0x39')]['create'](_[_0xe8d0('0x4a')](_0x5ac1ae,_0x56b4fa['body']),{'include':_0x56b4fa[_0xe8d0('0x3e')]['includeAll']?[{'all':!![]}]:undefined})[_0xe8d0('0x1e')](function(_0x17afc2){var _0x29467d=_0x56b4fa[_0xe8d0('0x5b')][_0xe8d0('0x33')]({'plain':!![]});if(!_0x29467d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29467d['role']===_0xe8d0('0x5b')){var _0x55a2df=_0x17afc2[_0xe8d0('0x33')]({'plain':!![]});var _0x18b655=_0xe8d0('0x34');return db[_0xe8d0('0x5c')][_0xe8d0('0x56')]({'where':{'name':_0x18b655,'userProfileId':_0x29467d[_0xe8d0('0x5d')]},'raw':!![]})[_0xe8d0('0x1e')](function(_0x20647d){if(_0x20647d&&_0x20647d[_0xe8d0('0x5e')]===0x0){return db[_0xe8d0('0x5f')][_0xe8d0('0x60')]({'name':_0x55a2df[_0xe8d0('0x36')],'resourceId':_0x55a2df['id'],'type':_0x20647d[_0xe8d0('0x36')],'sectionId':_0x20647d['id']},{})[_0xe8d0('0x1e')](function(){return _0x17afc2;});}else{return _0x17afc2;}})[_0xe8d0('0x28')](function(_0x4a68d5){logger[_0xe8d0('0x24')](_0xe8d0('0x61'),_0x4a68d5);throw _0x4a68d5;});}return _0x17afc2;});}})[_0xe8d0('0x1e')](respondWithResult(_0x1bd329,0xc9))[_0xe8d0('0x28')](handleError(_0x1bd329,null));};exports[_0xe8d0('0x60')]=function(_0x4848d4,_0x2eeb92,_0x1d30c0){var _0x45b42b;return db[_0xe8d0('0x39')][_0xe8d0('0x60')](_0x4848d4[_0xe8d0('0x58')],{'raw':!![]})[_0xe8d0('0x1e')](function(_0x13ceb4){_0x45b42b=_0x13ceb4;return db[_0xe8d0('0x39')][_0xe8d0('0x4f')]({'raw':!![]});})[_0xe8d0('0x1e')](function(_0xdb3e53){var _0x556d7e=fs['readFileSync'](path[_0xe8d0('0x62')](config['root'],_0xe8d0('0x63')),_0xe8d0('0x64'));var _0x56761c=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config[_0xe8d0('0x66')],_0xe8d0('0x67')),_0xe8d0('0x64'));var _0x1b5df8=ejs[_0xe8d0('0x68')](_0x556d7e,{'trunks':_0xdb3e53||[]});fs[_0xe8d0('0x69')](_0xe8d0('0x6a'),_0x1b5df8);if(_0x45b42b[_0xe8d0('0x6b')]){var _0xb078d8=ejs[_0xe8d0('0x68')](_0x56761c,{'trunks':_0xdb3e53||[]});fs[_0xe8d0('0x69')](_0xe8d0('0x6c'),_0xb078d8);}})[_0xe8d0('0x1e')](function(){return respondWithRpcPromise(_0xe8d0('0x6d'),_0xe8d0('0x60'),{'module':_0xe8d0('0x6e')});})[_0xe8d0('0x1e')](function(){var _0x500fb0=_0x4848d4[_0xe8d0('0x5b')][_0xe8d0('0x33')]({'plain':!![]});if(!_0x500fb0)throw new Error(_0xe8d0('0x6f'));if(_0x500fb0['role']===_0xe8d0('0x5b')){var _0x4c54c4=_0x45b42b[_0xe8d0('0x33')]({'plain':!![]});return db[_0xe8d0('0x5c')][_0xe8d0('0x56')]({'where':{'name':'Trunks','userProfileId':_0x500fb0[_0xe8d0('0x5d')]},'raw':!![]})[_0xe8d0('0x1e')](function(_0xc94cd3){if(_0xc94cd3&&_0xc94cd3[_0xe8d0('0x5e')]===0x0){return db[_0xe8d0('0x5f')]['create']({'name':_0x4c54c4[_0xe8d0('0x36')],'resourceId':_0x4c54c4['id'],'type':_0xc94cd3[_0xe8d0('0x36')],'sectionId':_0xc94cd3['id']},{})[_0xe8d0('0x1e')](function(){return _0x45b42b;});}else{return _0x45b42b;}})[_0xe8d0('0x28')](function(_0x252f0e){logger[_0xe8d0('0x24')](_0xe8d0('0x61'),_0x252f0e);throw _0x252f0e;});}return _0x45b42b;})[_0xe8d0('0x1e')](respondWithResult(_0x2eeb92,0xc9))['catch'](handleError(_0x2eeb92,null));};exports[_0xe8d0('0x31')]=function(_0x31b9d3,_0x14d722,_0x2aa6fc){var _0x4d5997;return db[_0xe8d0('0x39')][_0xe8d0('0x56')]({'where':{'id':_0x31b9d3[_0xe8d0('0x52')]['id']}})['then'](handleEntityNotFound(_0x14d722,null))[_0xe8d0('0x1e')](saveUpdates(_0x31b9d3['body'],null))[_0xe8d0('0x1e')](function(_0x478eb2){if(_0x478eb2){_0x4d5997=_0x478eb2;return db[_0xe8d0('0x39')][_0xe8d0('0x4f')]({'raw':!![]});}})[_0xe8d0('0x1e')](function(_0xa90bdc){if(_0xa90bdc){var _0x87aa04=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config[_0xe8d0('0x66')],_0xe8d0('0x63')),_0xe8d0('0x64'));var _0x2eaf2f=fs[_0xe8d0('0x65')](path['join'](config[_0xe8d0('0x66')],_0xe8d0('0x67')),_0xe8d0('0x64'));var _0x761e97=ejs[_0xe8d0('0x68')](_0x87aa04,{'trunks':_0xa90bdc||[]});fs[_0xe8d0('0x69')](_0xe8d0('0x6a'),_0x761e97);var _0x605b5f=ejs[_0xe8d0('0x68')](_0x2eaf2f,{'trunks':_0xa90bdc||[]});fs[_0xe8d0('0x69')]('/etc/asterisk/sip_xcally_registers.conf',_0x605b5f);return respondWithRpcPromise(_0xe8d0('0x6d'),_0xe8d0('0x31'),{'module':_0xe8d0('0x6e')});}return null;})[_0xe8d0('0x1e')](function(_0x255e4b){if(_0x255e4b){return _0x4d5997;}})['then'](respondWithResult(_0x14d722,null))['catch'](handleError(_0x14d722,null));};exports[_0xe8d0('0x32')]=function(_0x5c8c7d,_0x3fb7c8,_0x16098b){var _0x363b3a;return db['Trunk'][_0xe8d0('0x56')]({'where':{'id':_0x5c8c7d['params']['id']}})[_0xe8d0('0x1e')](handleEntityNotFound(_0x3fb7c8,null))[_0xe8d0('0x1e')](removeEntity(_0x3fb7c8,null))[_0xe8d0('0x1e')](function(){return db[_0xe8d0('0x39')][_0xe8d0('0x4f')]({'raw':!![]});})['then'](function(_0x58034d){var _0xfbacce=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config[_0xe8d0('0x66')],_0xe8d0('0x63')),_0xe8d0('0x64'));var _0x2790f=fs[_0xe8d0('0x65')](path[_0xe8d0('0x62')](config['root'],_0xe8d0('0x67')),_0xe8d0('0x64'));var _0x142db4=ejs[_0xe8d0('0x68')](_0xfbacce,{'trunks':_0x58034d});var _0x4a568f=ejs['render'](_0x2790f,{'trunks':_0x58034d});fs[_0xe8d0('0x69')](_0xe8d0('0x6a'),_0x142db4);fs[_0xe8d0('0x69')](_0xe8d0('0x6c'),_0x4a568f);return respondWithRpcPromise(_0xe8d0('0x6d'),_0xe8d0('0x32'),{'module':_0xe8d0('0x6e')});})[_0xe8d0('0x28')](handleError(_0x3fb7c8,null));}; \ No newline at end of file +var _0x425d=['readFileSync','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','UserProfileSection','userProfileId','/etc/asterisk/sip_xcally_trunks.conf','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','Trunk,\x20%s,\x20%s','result','catch','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','get','Trunks','UserProfileResource','stack','name','send','index','map','Trunk','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','clone','find','omit','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8'];(function(_0x36eefe,_0x3a1c2c){var _0x5ccdd7=function(_0x57ff08){while(--_0x57ff08){_0x36eefe['push'](_0x36eefe['shift']());}};_0x5ccdd7(++_0x3a1c2c);}(_0x425d,0x1e0));var _0xd425=function(_0x48fd24,_0x13fa0b){_0x48fd24=_0x48fd24-0x0;var _0x2edb3a=_0x425d[_0x48fd24];return _0x2edb3a;};'use strict';var emlformat=require(_0xd425('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd425('0x1'));var jsonpatch=require(_0xd425('0x2'));var rp=require(_0xd425('0x3'));var moment=require(_0xd425('0x4'));var BPromise=require(_0xd425('0x5'));var Mustache=require(_0xd425('0x6'));var util=require(_0xd425('0x7'));var path=require('path');var sox=require(_0xd425('0x8'));var csv=require(_0xd425('0x9'));var ejs=require(_0xd425('0xa'));var fs=require('fs');var fs_extra=require(_0xd425('0xb'));var _=require(_0xd425('0xc'));var squel=require(_0xd425('0xd'));var crypto=require('crypto');var jsforce=require(_0xd425('0xe'));var deskjs=require(_0xd425('0xf'));var toCsv=require(_0xd425('0x9'));var querystring=require(_0xd425('0x10'));var Papa=require(_0xd425('0x11'));var Redis=require(_0xd425('0x12'));var authService=require(_0xd425('0x13'));var qs=require(_0xd425('0x14'));var as=require(_0xd425('0x15'));var hardwareService=require(_0xd425('0x16'));var logger=require(_0xd425('0x17'))(_0xd425('0x18'));var utils=require(_0xd425('0x19'));var config=require(_0xd425('0x1a'));var licenseUtil=require(_0xd425('0x1b'));var db=require(_0xd425('0x1c'))['db'];var jayson=require(_0xd425('0x1d'));var client=jayson[_0xd425('0x1e')][_0xd425('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x18eafb,_0x51263f,_0x27318c,_0x17a498){return new BPromise(function(_0x336dc3,_0x5d3d60){var _0x309263=_0x17a498||client;return _0x309263[_0xd425('0x20')](_0x18eafb,_0x27318c)[_0xd425('0x21')](function(_0x41f34d){logger[_0xd425('0x22')]('Trunk,\x20%s,\x20%s',_0x51263f,_0xd425('0x23'));logger[_0xd425('0x24')](_0xd425('0x25'),_0x51263f,_0xd425('0x23'),JSON['stringify'](_0x41f34d));if(_0x41f34d[_0xd425('0x26')]){if(_0x41f34d[_0xd425('0x26')][_0xd425('0x27')]===0x1f4){logger[_0xd425('0x26')]('Trunk,\x20%s,\x20%s',_0x51263f,_0x41f34d['error']['message']);return _0x5d3d60(_0x41f34d['error'][_0xd425('0x28')]);}logger[_0xd425('0x26')](_0xd425('0x29'),_0x51263f,_0x41f34d['error'][_0xd425('0x28')]);return _0x336dc3(_0x41f34d[_0xd425('0x26')]['message']);}else{logger[_0xd425('0x22')](_0xd425('0x29'),_0x51263f,_0xd425('0x23'));_0x336dc3(_0x41f34d[_0xd425('0x2a')][_0xd425('0x28')]);}})[_0xd425('0x2b')](function(_0x2480a0){logger[_0xd425('0x26')](_0xd425('0x29'),_0x51263f,_0x2480a0);_0x5d3d60(_0x2480a0);});});}function respondWithStatusCode(_0x2b030b,_0x151ad9){_0x151ad9=_0x151ad9||0xcc;return function(_0x40e84b){if(_0x40e84b){return _0x2b030b['sendStatus'](_0x151ad9);}return _0x2b030b[_0xd425('0x2c')](_0x151ad9)[_0xd425('0x2d')]();};}function respondWithResult(_0x398985,_0x1908a5){_0x1908a5=_0x1908a5||0xc8;return function(_0x2afcdb){if(_0x2afcdb){return _0x398985[_0xd425('0x2c')](_0x1908a5)[_0xd425('0x2e')](_0x2afcdb);}};}function respondWithFilteredResult(_0x577e4b,_0x12f951){return function(_0x177de2){if(_0x177de2){var _0x1d8861=typeof _0x12f951['offset']===_0xd425('0x2f')&&typeof _0x12f951[_0xd425('0x30')]===_0xd425('0x2f');var _0x999fb9=_0x177de2[_0xd425('0x31')];var _0x185d7e=_0x1d8861?0x0:_0x12f951[_0xd425('0x32')];var _0x37b63c=_0x1d8861?_0x177de2[_0xd425('0x31')]:_0x12f951[_0xd425('0x32')]+_0x12f951['limit'];var _0x471e3e;if(_0x37b63c>=_0x999fb9){_0x37b63c=_0x999fb9;_0x471e3e=0xc8;}else{_0x471e3e=0xce;}_0x577e4b[_0xd425('0x2c')](_0x471e3e);return _0x577e4b[_0xd425('0x33')](_0xd425('0x34'),_0x185d7e+'-'+_0x37b63c+'/'+_0x999fb9)[_0xd425('0x2e')](_0x177de2);}return null;};}function patchUpdates(_0x1abf33){return function(_0x47405f){try{jsonpatch[_0xd425('0x35')](_0x47405f,_0x1abf33,!![]);}catch(_0x3ec51b){return BPromise[_0xd425('0x36')](_0x3ec51b);}return _0x47405f[_0xd425('0x37')]();};}function saveUpdates(_0x5f3dab,_0x316493){return function(_0x2a2a9b){if(_0x2a2a9b){return _0x2a2a9b[_0xd425('0x38')](_0x5f3dab)[_0xd425('0x21')](function(_0x28870f){return _0x28870f;});}return null;};}function removeEntity(_0x4eddbc,_0x4aa168){return function(_0x3badcc){if(_0x3badcc){return _0x3badcc['destroy']()['then'](function(){var _0x51669d=_0x3badcc[_0xd425('0x39')]({'plain':!![]});var _0xfb0c8=_0xd425('0x3a');return db[_0xd425('0x3b')]['destroy']({'where':{'type':_0xfb0c8,'resourceId':_0x51669d['id']}})[_0xd425('0x21')](function(){return _0x3badcc;});})[_0xd425('0x21')](function(){_0x4eddbc[_0xd425('0x2c')](0xcc)[_0xd425('0x2d')]();});}};}function handleEntityNotFound(_0x27b9e2,_0x1e12f2){return function(_0x35bbec){if(!_0x35bbec){_0x27b9e2['sendStatus'](0x194);}return _0x35bbec;};}function handleError(_0x363fb0,_0x59b3d3){_0x59b3d3=_0x59b3d3||0x1f4;return function(_0x22df81){logger[_0xd425('0x26')](_0x22df81[_0xd425('0x3c')]);if(_0x22df81['name']){delete _0x22df81[_0xd425('0x3d')];}_0x363fb0[_0xd425('0x2c')](_0x59b3d3)[_0xd425('0x3e')](_0x22df81);};}exports[_0xd425('0x3f')]=function(_0x58f36d,_0x1d38fa){var _0x3cf540={},_0x59e326={},_0x5d310e={'count':0x0,'rows':[]};var _0x48fc85=_[_0xd425('0x40')](db[_0xd425('0x41')][_0xd425('0x42')],function(_0x588688){return{'name':_0x588688['fieldName'],'type':_0x588688['type'][_0xd425('0x43')]};});_0x59e326[_0xd425('0x44')]=_[_0xd425('0x40')](_0x48fc85,_0xd425('0x3d'));_0x59e326[_0xd425('0x45')]=_[_0xd425('0x46')](_0x58f36d[_0xd425('0x45')]);_0x59e326['filters']=_[_0xd425('0x47')](_0x59e326[_0xd425('0x44')],_0x59e326[_0xd425('0x45')]);_0x3cf540['attributes']=_[_0xd425('0x47')](_0x59e326[_0xd425('0x44')],qs[_0xd425('0x48')](_0x58f36d['query'][_0xd425('0x48')]));_0x3cf540[_0xd425('0x49')]=_0x3cf540[_0xd425('0x49')][_0xd425('0x4a')]?_0x3cf540['attributes']:_0x59e326[_0xd425('0x44')];if(!_0x58f36d[_0xd425('0x45')][_0xd425('0x4b')](_0xd425('0x4c'))){_0x3cf540[_0xd425('0x30')]=qs[_0xd425('0x30')](_0x58f36d[_0xd425('0x45')]['limit']);_0x3cf540[_0xd425('0x32')]=qs[_0xd425('0x32')](_0x58f36d['query'][_0xd425('0x32')]);}_0x3cf540['order']=qs['sort'](_0x58f36d[_0xd425('0x45')]['sort']);_0x3cf540[_0xd425('0x4d')]=qs['filters'](_[_0xd425('0x4e')](_0x58f36d[_0xd425('0x45')],_0x59e326[_0xd425('0x4f')]),_0x48fc85);if(_0x58f36d[_0xd425('0x45')][_0xd425('0x50')]){_0x3cf540['where']=_[_0xd425('0x51')](_0x3cf540['where'],{'$or':_[_0xd425('0x40')](_0x48fc85,function(_0x55a15d){if(_0x55a15d[_0xd425('0x52')]!==_0xd425('0x53')){var _0x3fd2ce={};_0x3fd2ce[_0x55a15d[_0xd425('0x3d')]]={'$like':'%'+_0x58f36d[_0xd425('0x45')]['filter']+'%'};return _0x3fd2ce;}})});}_0x3cf540=_[_0xd425('0x51')]({},_0x3cf540,_0x58f36d[_0xd425('0x54')]);var _0x35e77b={'where':_0x3cf540[_0xd425('0x4d')]};return db[_0xd425('0x41')]['count'](_0x35e77b)[_0xd425('0x21')](function(_0x177704){_0x5d310e[_0xd425('0x31')]=_0x177704;if(_0x58f36d[_0xd425('0x45')][_0xd425('0x55')]){_0x3cf540[_0xd425('0x56')]=[{'all':!![]}];}return db['Trunk'][_0xd425('0x57')](_0x3cf540);})[_0xd425('0x21')](function(_0x5bfac6){_0x5d310e[_0xd425('0x58')]=_0x5bfac6;return _0x5d310e;})[_0xd425('0x21')](respondWithFilteredResult(_0x1d38fa,_0x3cf540))[_0xd425('0x2b')](handleError(_0x1d38fa,null));};exports[_0xd425('0x59')]=function(_0x5c0219,_0x54f1d){var _0x2b8882={'raw':![],'where':{'id':_0x5c0219[_0xd425('0x5a')]['id']}},_0x4552cd={};_0x4552cd[_0xd425('0x44')]=_['keys'](db['Trunk'][_0xd425('0x42')]);_0x4552cd['query']=_[_0xd425('0x46')](_0x5c0219[_0xd425('0x45')]);_0x4552cd['filters']=_[_0xd425('0x47')](_0x4552cd['model'],_0x4552cd['query']);_0x2b8882[_0xd425('0x49')]=_[_0xd425('0x47')](_0x4552cd[_0xd425('0x44')],qs[_0xd425('0x48')](_0x5c0219[_0xd425('0x45')][_0xd425('0x48')]));_0x2b8882[_0xd425('0x49')]=_0x2b8882[_0xd425('0x49')]['length']?_0x2b8882[_0xd425('0x49')]:_0x4552cd[_0xd425('0x44')];if(_0x5c0219[_0xd425('0x45')][_0xd425('0x55')]){_0x2b8882[_0xd425('0x56')]=[{'all':!![]}];}_0x2b8882=_[_0xd425('0x51')]({},_0x2b8882,_0x5c0219[_0xd425('0x54')]);return db[_0xd425('0x41')]['find'](_0x2b8882)['then'](handleEntityNotFound(_0x54f1d,null))['then'](respondWithResult(_0x54f1d,null))[_0xd425('0x2b')](handleError(_0x54f1d,null));};exports[_0xd425('0x5b')]=function(_0x3dec61,_0x3c6b49){var _0x59c286={'where':{'id':_0x3dec61['params']['id']}},_0x4fedc0={};_0x4fedc0['model']=_[_0xd425('0x46')](db[_0xd425('0x41')]['rawAttributes']);_0x59c286[_0xd425('0x49')]=_[_0xd425('0x47')](_0x4fedc0[_0xd425('0x44')],qs['fields'](_0x3dec61['query'][_0xd425('0x48')]));_0x59c286['attributes']=_0x59c286['attributes']['length']?_0x59c286[_0xd425('0x49')]:_0x4fedc0[_0xd425('0x44')];if(_0x3dec61[_0xd425('0x45')]['includeAll']){_0x59c286[_0xd425('0x56')]=[{'all':!![]}];}_0x59c286=_['merge']({},_0x59c286,_0x3dec61[_0xd425('0x54')]);return db[_0xd425('0x41')][_0xd425('0x5c')](_0x59c286)[_0xd425('0x21')](handleEntityNotFound(_0x3c6b49,null))[_0xd425('0x21')](function(_0xd261a){if(_0xd261a){var _0xa21f7c=_0xd261a[_0xd425('0x39')]({'plain':!![]});_0xa21f7c=qs[_0xd425('0x5d')](_0xa21f7c,['id','createdAt',_0xd425('0x5e')]);_0x3dec61[_0xd425('0x5f')]=_[_0xd425('0x5d')](_0x3dec61[_0xd425('0x5f')],['id','createdAt','updatedAt']);return db[_0xd425('0x41')][_0xd425('0x60')](_[_0xd425('0x51')](_0xa21f7c,_0x3dec61[_0xd425('0x5f')]),{'include':_0x3dec61[_0xd425('0x45')][_0xd425('0x55')]?[{'all':!![]}]:undefined})[_0xd425('0x21')](function(_0x44782a){var _0x1fcde4=_0x3dec61[_0xd425('0x61')][_0xd425('0x39')]({'plain':!![]});if(!_0x1fcde4)throw new Error(_0xd425('0x62'));if(_0x1fcde4[_0xd425('0x63')]===_0xd425('0x61')){var _0x5e72db=_0x44782a[_0xd425('0x39')]({'plain':!![]});var _0x343cc1=_0xd425('0x3a');return db['UserProfileSection']['find']({'where':{'name':_0x343cc1,'userProfileId':_0x1fcde4['userProfileId']},'raw':!![]})[_0xd425('0x21')](function(_0x34d065){if(_0x34d065&&_0x34d065[_0xd425('0x64')]===0x0){return db['UserProfileResource'][_0xd425('0x60')]({'name':_0x5e72db['name'],'resourceId':_0x5e72db['id'],'type':_0x34d065[_0xd425('0x3d')],'sectionId':_0x34d065['id']},{})[_0xd425('0x21')](function(){return _0x44782a;});}else{return _0x44782a;}})[_0xd425('0x2b')](function(_0x5113fc){logger[_0xd425('0x26')](_0xd425('0x65'),_0x5113fc);throw _0x5113fc;});}return _0x44782a;});}})[_0xd425('0x21')](respondWithResult(_0x3c6b49,0xc9))[_0xd425('0x2b')](handleError(_0x3c6b49,null));};exports[_0xd425('0x60')]=function(_0x43b1a9,_0x38a762,_0x44db7f){var _0xcb1a64;return db[_0xd425('0x41')][_0xd425('0x60')](_0x43b1a9[_0xd425('0x5f')],{'raw':!![]})[_0xd425('0x21')](function(_0x285d54){_0xcb1a64=_0x285d54;return db[_0xd425('0x41')][_0xd425('0x57')]({'raw':!![]});})[_0xd425('0x21')](function(_0x25cae6){var _0x541218=fs['readFileSync'](path[_0xd425('0x66')](config['root'],_0xd425('0x67')),_0xd425('0x68'));var _0xb407bb=fs[_0xd425('0x69')](path['join'](config[_0xd425('0x6a')],_0xd425('0x6b')),_0xd425('0x68'));var _0x689332=ejs[_0xd425('0x6c')](_0x541218,{'trunks':_0x25cae6||[]});fs[_0xd425('0x6d')]('/etc/asterisk/sip_xcally_trunks.conf',_0x689332);if(_0xcb1a64['registry']){var _0x3ccffe=ejs[_0xd425('0x6c')](_0xb407bb,{'trunks':_0x25cae6||[]});fs['writeFileSync'](_0xd425('0x6e'),_0x3ccffe);}})['then'](function(){return respondWithRpcPromise(_0xd425('0x6f'),_0xd425('0x60'),{'module':_0xd425('0x70')});})[_0xd425('0x21')](function(){var _0x376134=_0x43b1a9[_0xd425('0x61')][_0xd425('0x39')]({'plain':!![]});if(!_0x376134)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x376134[_0xd425('0x63')]===_0xd425('0x61')){var _0x24af3=_0xcb1a64[_0xd425('0x39')]({'plain':!![]});return db[_0xd425('0x71')]['find']({'where':{'name':_0xd425('0x3a'),'userProfileId':_0x376134[_0xd425('0x72')]},'raw':!![]})['then'](function(_0x2bb36f){if(_0x2bb36f&&_0x2bb36f[_0xd425('0x64')]===0x0){return db['UserProfileResource'][_0xd425('0x60')]({'name':_0x24af3[_0xd425('0x3d')],'resourceId':_0x24af3['id'],'type':_0x2bb36f[_0xd425('0x3d')],'sectionId':_0x2bb36f['id']},{})[_0xd425('0x21')](function(){return _0xcb1a64;});}else{return _0xcb1a64;}})[_0xd425('0x2b')](function(_0x572f23){logger[_0xd425('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x572f23);throw _0x572f23;});}return _0xcb1a64;})[_0xd425('0x21')](respondWithResult(_0x38a762,0xc9))[_0xd425('0x2b')](handleError(_0x38a762,null));};exports['update']=function(_0x2bf8e6,_0xcf7b51,_0x66d87b){var _0x1fc64d;return db['Trunk']['find']({'where':{'id':_0x2bf8e6[_0xd425('0x5a')]['id']}})[_0xd425('0x21')](handleEntityNotFound(_0xcf7b51,null))[_0xd425('0x21')](saveUpdates(_0x2bf8e6['body'],null))[_0xd425('0x21')](function(_0xb1479e){if(_0xb1479e){_0x1fc64d=_0xb1479e;return db['Trunk'][_0xd425('0x57')]({'raw':!![]});}})['then'](function(_0x998ad1){if(_0x998ad1){var _0x46346c=fs[_0xd425('0x69')](path[_0xd425('0x66')](config['root'],'server/files/templates/trunk.ejs'),_0xd425('0x68'));var _0x413a65=fs['readFileSync'](path[_0xd425('0x66')](config[_0xd425('0x6a')],'server/files/templates/registry.ejs'),_0xd425('0x68'));var _0x369f8b=ejs[_0xd425('0x6c')](_0x46346c,{'trunks':_0x998ad1||[]});fs[_0xd425('0x6d')](_0xd425('0x73'),_0x369f8b);var _0xf251e6=ejs[_0xd425('0x6c')](_0x413a65,{'trunks':_0x998ad1||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0xf251e6);return respondWithRpcPromise(_0xd425('0x6f'),'update',{'module':_0xd425('0x70')});}return null;})[_0xd425('0x21')](function(_0x58cad5){if(_0x58cad5){return _0x1fc64d;}})[_0xd425('0x21')](respondWithResult(_0xcf7b51,null))[_0xd425('0x2b')](handleError(_0xcf7b51,null));};exports['destroy']=function(_0x592c40,_0x750685,_0x242ed8){var _0x16eac6;return db[_0xd425('0x41')][_0xd425('0x5c')]({'where':{'id':_0x592c40[_0xd425('0x5a')]['id']}})[_0xd425('0x21')](handleEntityNotFound(_0x750685,null))[_0xd425('0x21')](removeEntity(_0x750685,null))['then'](function(){return db[_0xd425('0x41')][_0xd425('0x57')]({'raw':!![]});})['then'](function(_0x2bbcf3){var _0x1d386c=fs[_0xd425('0x69')](path[_0xd425('0x66')](config[_0xd425('0x6a')],_0xd425('0x67')),_0xd425('0x68'));var _0x2c3995=fs[_0xd425('0x69')](path[_0xd425('0x66')](config[_0xd425('0x6a')],'server/files/templates/registry.ejs'),_0xd425('0x68'));var _0x498e81=ejs['render'](_0x1d386c,{'trunks':_0x2bbcf3});var _0x2c8d63=ejs['render'](_0x2c3995,{'trunks':_0x2bbcf3});fs[_0xd425('0x6d')](_0xd425('0x73'),_0x498e81);fs[_0xd425('0x6d')](_0xd425('0x6e'),_0x2c8d63);return respondWithRpcPromise(_0xd425('0x6f'),_0xd425('0x74'),{'module':_0xd425('0x70')});})['catch'](handleError(_0x750685,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index f9b2c80..79db7ae 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 _0x564f=['bluebird','rimraf','../../config/environment','./trunk.attributes','exports','define','tools_trunks','lodash','util','../../config/logger'];(function(_0x530528,_0x1215b0){var _0x50ba79=function(_0x1ed6d0){while(--_0x1ed6d0){_0x530528['push'](_0x530528['shift']());}};_0x50ba79(++_0x1215b0);}(_0x564f,0x1d3));var _0xf564=function(_0x3859f5,_0x22db78){_0x3859f5=_0x3859f5-0x0;var _0x2025df=_0x564f[_0x3859f5];return _0x2025df;};'use strict';var _=require(_0xf564('0x0'));var util=require(_0xf564('0x1'));var logger=require(_0xf564('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf564('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf564('0x4'));var config=require(_0xf564('0x5'));var attributes=require(_0xf564('0x6'));module[_0xf564('0x7')]=function(_0x2d9aff,_0x41e706){return _0x2d9aff[_0xf564('0x8')]('Trunk',attributes,{'tableName':_0xf564('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ccc=['bluebird','rimraf','../../config/environment','./trunk.attributes','exports','Trunk','tools_trunks','lodash','util','api','moment'];(function(_0x3b0492,_0x5dcab7){var _0x328739=function(_0x17b34b){while(--_0x17b34b){_0x3b0492['push'](_0x3b0492['shift']());}};_0x328739(++_0x5dcab7);}(_0x0ccc,0x1bf));var _0xc0cc=function(_0x1d63fa,_0x5988d3){_0x1d63fa=_0x1d63fa-0x0;var _0x15d73d=_0x0ccc[_0x1d63fa];return _0x15d73d;};'use strict';var _=require(_0xc0cc('0x0'));var util=require(_0xc0cc('0x1'));var logger=require('../../config/logger')(_0xc0cc('0x2'));var moment=require(_0xc0cc('0x3'));var BPromise=require(_0xc0cc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc0cc('0x5'));var config=require(_0xc0cc('0x6'));var attributes=require(_0xc0cc('0x7'));module[_0xc0cc('0x8')]=function(_0x318f3c,_0x18cc7a){return _0x318f3c['define'](_0xc0cc('0x9'),attributes,{'tableName':_0xc0cc('0xa'),'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 862c69e..cd14c2d 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 _0x7f90=['GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','ShowTrunk','find','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch'];(function(_0x3999ad,_0x5c6302){var _0x4503e4=function(_0x12d178){while(--_0x12d178){_0x3999ad['push'](_0x3999ad['shift']());}};_0x4503e4(++_0x5c6302);}(_0x7f90,0xf4));var _0x07f9=function(_0x216094,_0x27dcb5){_0x216094=_0x216094-0x0;var _0x241389=_0x7f90[_0x216094];return _0x241389;};'use strict';var _=require(_0x07f9('0x0'));var util=require(_0x07f9('0x1'));var moment=require(_0x07f9('0x2'));var BPromise=require(_0x07f9('0x3'));var rs=require(_0x07f9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x07f9('0x5'));var logger=require(_0x07f9('0x6'))('rpc');var config=require(_0x07f9('0x7'));var jayson=require(_0x07f9('0x8'));var client=jayson[_0x07f9('0x9')][_0x07f9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ded98,_0x52065b,_0x4e55e9){return new BPromise(function(_0x31050f,_0x139fb6){return client['request'](_0x3ded98,_0x4e55e9)[_0x07f9('0xb')](function(_0x56ecc1){logger[_0x07f9('0xc')](_0x07f9('0xd'),_0x52065b,_0x07f9('0xe'));logger[_0x07f9('0xf')]('Trunk,\x20%s,\x20%s,\x20%s',_0x52065b,_0x07f9('0xe'),JSON[_0x07f9('0x10')](_0x56ecc1));if(_0x56ecc1[_0x07f9('0x11')]){if(_0x56ecc1[_0x07f9('0x11')]['code']===0x1f4){logger[_0x07f9('0x11')]('Trunk,\x20%s,\x20%s',_0x52065b,_0x56ecc1[_0x07f9('0x11')][_0x07f9('0x12')]);return _0x139fb6(_0x56ecc1[_0x07f9('0x11')][_0x07f9('0x12')]);}logger[_0x07f9('0x11')]('Trunk,\x20%s,\x20%s',_0x52065b,_0x56ecc1[_0x07f9('0x11')][_0x07f9('0x12')]);return _0x31050f(_0x56ecc1['error'][_0x07f9('0x12')]);}else{logger['info'](_0x07f9('0xd'),_0x52065b,_0x07f9('0xe'));_0x31050f(_0x56ecc1['result'][_0x07f9('0x12')]);}})[_0x07f9('0x13')](function(_0xe7d6b6){logger[_0x07f9('0x11')]('Trunk,\x20%s,\x20%s',_0x52065b,_0xe7d6b6);_0x139fb6(_0xe7d6b6);});});}exports[_0x07f9('0x14')]=function(_0x2d32de){var _0x1b217d=this;return new Promise(function(_0x3850cc,_0x4a2678){return db[_0x07f9('0x15')][_0x07f9('0x16')]({'raw':_0x2d32de[_0x07f9('0x17')]?_0x2d32de[_0x07f9('0x17')][_0x07f9('0x18')]===undefined?!![]:![]:!![],'where':_0x2d32de['options']?_0x2d32de[_0x07f9('0x17')][_0x07f9('0x19')]||null:null,'attributes':_0x2d32de[_0x07f9('0x17')]?_0x2d32de[_0x07f9('0x17')][_0x07f9('0x1a')]||null:null,'limit':_0x2d32de['options']?_0x2d32de['options'][_0x07f9('0x1b')]||null:null,'include':_0x2d32de[_0x07f9('0x17')]?_0x2d32de[_0x07f9('0x17')][_0x07f9('0x1c')]?_[_0x07f9('0x1d')](_0x2d32de['options'][_0x07f9('0x1c')],function(_0x3354fb){return{'model':db[_0x3354fb[_0x07f9('0x1e')]],'as':_0x3354fb['as'],'attributes':_0x3354fb[_0x07f9('0x1a')],'include':_0x3354fb[_0x07f9('0x1c')]?_[_0x07f9('0x1d')](_0x3354fb[_0x07f9('0x1c')],function(_0x30de7d){return{'model':db[_0x30de7d[_0x07f9('0x1e')]],'as':_0x30de7d['as'],'attributes':_0x30de7d['attributes'],'include':_0x30de7d[_0x07f9('0x1c')]?_[_0x07f9('0x1d')](_0x30de7d['include'],function(_0x2c90d0){return{'model':db[_0x2c90d0[_0x07f9('0x1e')]],'as':_0x2c90d0['as'],'attributes':_0x2c90d0[_0x07f9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x07f9('0xb')](function(_0x10fe74){logger[_0x07f9('0xc')](_0x07f9('0x14'),_0x2d32de);logger[_0x07f9('0xf')](_0x07f9('0x14'),_0x2d32de,JSON[_0x07f9('0x10')](_0x10fe74));_0x3850cc(_0x10fe74);})['catch'](function(_0x2bd9da){logger['error']('GetTrunk',_0x2bd9da[_0x07f9('0x12')],_0x2d32de);_0x4a2678(_0x1b217d[_0x07f9('0x11')](0x1f4,_0x2bd9da[_0x07f9('0x12')]));});});};exports[_0x07f9('0x1f')]=function(_0x285e70){var _0x596e74=this;return new Promise(function(_0x55e732,_0x1c9c34){return db[_0x07f9('0x15')][_0x07f9('0x20')]({'raw':_0x285e70[_0x07f9('0x17')]?_0x285e70[_0x07f9('0x17')][_0x07f9('0x18')]===undefined?!![]:![]:!![],'where':_0x285e70[_0x07f9('0x17')]?_0x285e70[_0x07f9('0x17')][_0x07f9('0x19')]||null:null,'attributes':_0x285e70[_0x07f9('0x17')]?_0x285e70['options']['attributes']||null:null,'include':_0x285e70[_0x07f9('0x17')]?_0x285e70[_0x07f9('0x17')][_0x07f9('0x1c')]?_['map'](_0x285e70[_0x07f9('0x17')][_0x07f9('0x1c')],function(_0x30bf39){return{'model':db[_0x30bf39[_0x07f9('0x1e')]],'as':_0x30bf39['as'],'attributes':_0x30bf39[_0x07f9('0x1a')],'include':_0x30bf39['include']?_[_0x07f9('0x1d')](_0x30bf39[_0x07f9('0x1c')],function(_0x54bd31){return{'model':db[_0x54bd31[_0x07f9('0x1e')]],'as':_0x54bd31['as'],'attributes':_0x54bd31[_0x07f9('0x1a')],'include':_0x54bd31[_0x07f9('0x1c')]?_[_0x07f9('0x1d')](_0x54bd31[_0x07f9('0x1c')],function(_0x5adf1c){return{'model':db[_0x5adf1c['model']],'as':_0x5adf1c['as'],'attributes':_0x5adf1c[_0x07f9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x07f9('0xb')](function(_0x5ad0df){logger['info'](_0x07f9('0x1f'),_0x285e70);logger[_0x07f9('0xf')](_0x07f9('0x1f'),_0x285e70,JSON[_0x07f9('0x10')](_0x5ad0df));_0x55e732(_0x5ad0df);})[_0x07f9('0x13')](function(_0x1f356b){logger[_0x07f9('0x11')]('ShowTrunk',_0x1f356b[_0x07f9('0x12')],_0x285e70);_0x1c9c34(_0x596e74[_0x07f9('0x11')](0x1f4,_0x1f356b[_0x07f9('0x12')]));});});}; \ No newline at end of file +var _0x8822=['find','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','GetTrunk','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','ShowTrunk'];(function(_0x10b2d5,_0x5a7743){var _0x14b8d1=function(_0x3b888c){while(--_0x3b888c){_0x10b2d5['push'](_0x10b2d5['shift']());}};_0x14b8d1(++_0x5a7743);}(_0x8822,0x1b1));var _0x2882=function(_0x7e841,_0x5e7cdd){_0x7e841=_0x7e841-0x0;var _0x22ae52=_0x8822[_0x7e841];return _0x22ae52;};'use strict';var _=require(_0x2882('0x0'));var util=require('util');var moment=require(_0x2882('0x1'));var BPromise=require('bluebird');var rs=require(_0x2882('0x2'));var fs=require('fs');var Redis=require(_0x2882('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2882('0x4'));var logger=require(_0x2882('0x5'))(_0x2882('0x6'));var config=require(_0x2882('0x7'));var jayson=require(_0x2882('0x8'));var client=jayson[_0x2882('0x9')][_0x2882('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1de70b,_0x406256,_0x372b8b){return new BPromise(function(_0x58c735,_0x15afe0){return client[_0x2882('0xb')](_0x1de70b,_0x372b8b)[_0x2882('0xc')](function(_0x5e6fd4){logger[_0x2882('0xd')](_0x2882('0xe'),_0x406256,'request\x20sent');logger['debug'](_0x2882('0xf'),_0x406256,_0x2882('0x10'),JSON['stringify'](_0x5e6fd4));if(_0x5e6fd4['error']){if(_0x5e6fd4['error'][_0x2882('0x11')]===0x1f4){logger[_0x2882('0x12')]('Trunk,\x20%s,\x20%s',_0x406256,_0x5e6fd4[_0x2882('0x12')][_0x2882('0x13')]);return _0x15afe0(_0x5e6fd4[_0x2882('0x12')][_0x2882('0x13')]);}logger[_0x2882('0x12')]('Trunk,\x20%s,\x20%s',_0x406256,_0x5e6fd4[_0x2882('0x12')][_0x2882('0x13')]);return _0x58c735(_0x5e6fd4[_0x2882('0x12')][_0x2882('0x13')]);}else{logger[_0x2882('0xd')](_0x2882('0xe'),_0x406256,_0x2882('0x10'));_0x58c735(_0x5e6fd4[_0x2882('0x14')][_0x2882('0x13')]);}})[_0x2882('0x15')](function(_0x582d49){logger['error'](_0x2882('0xe'),_0x406256,_0x582d49);_0x15afe0(_0x582d49);});});}exports[_0x2882('0x16')]=function(_0x50634c){var _0x159d12=this;return new Promise(function(_0x40bd69,_0x44cd36){return db['Trunk'][_0x2882('0x17')]({'raw':_0x50634c[_0x2882('0x18')]?_0x50634c[_0x2882('0x18')][_0x2882('0x19')]===undefined?!![]:![]:!![],'where':_0x50634c[_0x2882('0x18')]?_0x50634c[_0x2882('0x18')][_0x2882('0x1a')]||null:null,'attributes':_0x50634c[_0x2882('0x18')]?_0x50634c[_0x2882('0x18')][_0x2882('0x1b')]||null:null,'limit':_0x50634c[_0x2882('0x18')]?_0x50634c[_0x2882('0x18')][_0x2882('0x1c')]||null:null,'include':_0x50634c['options']?_0x50634c[_0x2882('0x18')][_0x2882('0x1d')]?_[_0x2882('0x1e')](_0x50634c[_0x2882('0x18')][_0x2882('0x1d')],function(_0x2341e3){return{'model':db[_0x2341e3['model']],'as':_0x2341e3['as'],'attributes':_0x2341e3[_0x2882('0x1b')],'include':_0x2341e3[_0x2882('0x1d')]?_[_0x2882('0x1e')](_0x2341e3['include'],function(_0x3c39a0){return{'model':db[_0x3c39a0[_0x2882('0x1f')]],'as':_0x3c39a0['as'],'attributes':_0x3c39a0[_0x2882('0x1b')],'include':_0x3c39a0['include']?_['map'](_0x3c39a0['include'],function(_0x42f593){return{'model':db[_0x42f593['model']],'as':_0x42f593['as'],'attributes':_0x42f593['attributes']};}):[]};}):[]};}):[]:[]})[_0x2882('0xc')](function(_0x384b60){logger[_0x2882('0xd')](_0x2882('0x16'),_0x50634c);logger[_0x2882('0x20')](_0x2882('0x16'),_0x50634c,JSON[_0x2882('0x21')](_0x384b60));_0x40bd69(_0x384b60);})[_0x2882('0x15')](function(_0x3bc752){logger[_0x2882('0x12')](_0x2882('0x16'),_0x3bc752['message'],_0x50634c);_0x44cd36(_0x159d12[_0x2882('0x12')](0x1f4,_0x3bc752[_0x2882('0x13')]));});});};exports[_0x2882('0x22')]=function(_0x4b53fe){var _0x46f057=this;return new Promise(function(_0x5d563d,_0xd9f97e){return db['Trunk'][_0x2882('0x23')]({'raw':_0x4b53fe[_0x2882('0x18')]?_0x4b53fe['options'][_0x2882('0x19')]===undefined?!![]:![]:!![],'where':_0x4b53fe[_0x2882('0x18')]?_0x4b53fe[_0x2882('0x18')][_0x2882('0x1a')]||null:null,'attributes':_0x4b53fe[_0x2882('0x18')]?_0x4b53fe[_0x2882('0x18')][_0x2882('0x1b')]||null:null,'include':_0x4b53fe[_0x2882('0x18')]?_0x4b53fe[_0x2882('0x18')][_0x2882('0x1d')]?_[_0x2882('0x1e')](_0x4b53fe[_0x2882('0x18')]['include'],function(_0x5633ba){return{'model':db[_0x5633ba[_0x2882('0x1f')]],'as':_0x5633ba['as'],'attributes':_0x5633ba[_0x2882('0x1b')],'include':_0x5633ba['include']?_[_0x2882('0x1e')](_0x5633ba[_0x2882('0x1d')],function(_0x5b25bf){return{'model':db[_0x5b25bf['model']],'as':_0x5b25bf['as'],'attributes':_0x5b25bf[_0x2882('0x1b')],'include':_0x5b25bf[_0x2882('0x1d')]?_[_0x2882('0x1e')](_0x5b25bf['include'],function(_0x1c318f){return{'model':db[_0x1c318f[_0x2882('0x1f')]],'as':_0x1c318f['as'],'attributes':_0x1c318f[_0x2882('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36cd8d){logger['info'](_0x2882('0x22'),_0x4b53fe);logger[_0x2882('0x20')](_0x2882('0x22'),_0x4b53fe,JSON[_0x2882('0x21')](_0x36cd8d));_0x5d563d(_0x36cd8d);})[_0x2882('0x15')](function(_0x1e597f){logger[_0x2882('0x12')](_0x2882('0x22'),_0x1e597f[_0x2882('0x13')],_0x4b53fe);_0xd9f97e(_0x46f057[_0x2882('0x12')](0x1f4,_0x1e597f['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index f7fd843..bc8dda4 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 _0xd1ed=['isAuthenticated','Router','../../components/auth/service','./user-setting.controller','put'];(function(_0x4dbba7,_0x34d6d1){var _0x43ef83=function(_0x27acf1){while(--_0x27acf1){_0x4dbba7['push'](_0x4dbba7['shift']());}};_0x43ef83(++_0x34d6d1);}(_0xd1ed,0x1cd));var _0xdd1e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd1ed[_0x14add3];return _0x4a174f;};'use strict';var express=require('express');var router=express[_0xdd1e('0x0')]();var auth=require(_0xdd1e('0x1'));var controller=require(_0xdd1e('0x2'));router[_0xdd1e('0x3')]('/:id',auth[_0xdd1e('0x4')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x6081=['express','Router','../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated','update'];(function(_0x4b9cf4,_0x46b84f){var _0x281641=function(_0x5cade3){while(--_0x5cade3){_0x4b9cf4['push'](_0x4b9cf4['shift']());}};_0x281641(++_0x46b84f);}(_0x6081,0x160));var _0x1608=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6081[_0x20a584];return _0x4b41a8;};'use strict';var express=require(_0x1608('0x0'));var router=express[_0x1608('0x1')]();var auth=require(_0x1608('0x2'));var controller=require(_0x1608('0x3'));router[_0x1608('0x4')](_0x1608('0x5'),auth[_0x1608('0x6')](),controller[_0x1608('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 5223c2a..26d2b04 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 _0xf17e=['exports','ENUM','BOOLEAN','INTEGER','sequelize','warning','info'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xf17e,0x177));var _0xef17=function(_0x4aeaf3,_0x4d0553){_0x4aeaf3=_0x4aeaf3-0x0;var _0x2bb8fa=_0xf17e[_0x4aeaf3];return _0x2bb8fa;};'use strict';var Sequelize=require(_0xef17('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0xef17('0x1'),_0xef17('0x2'),'debug'];module[_0xef17('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0xef17('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xef17('0x5')],'defaultValue':![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xef17('0x6')],'unique':'UserId'}}; \ No newline at end of file +var _0xa87e=['INTEGER','UserId','sequelize','error','warning','info','exports','ENUM','BOOLEAN','TEXT','DATE'];(function(_0x5e6966,_0x985401){var _0x5409f2=function(_0x16c697){while(--_0x16c697){_0x5e6966['push'](_0x5e6966['shift']());}};_0x5409f2(++_0x985401);}(_0xa87e,0xb2));var _0xea87=function(_0x2402db,_0x273def){_0x2402db=_0x2402db-0x0;var _0x1c7ed2=_0xa87e[_0x2402db];return _0x1c7ed2;};'use strict';var Sequelize=require(_0xea87('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xea87('0x1'),_0xea87('0x2'),_0xea87('0x3'),'debug'];module[_0xea87('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0xea87('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xea87('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xea87('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xea87('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xea87('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xea87('0x9')],'unique':_0xea87('0xa')}}; \ 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 2967711..11d7520 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 _0x032e=['admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','find','body','lodash','../../config/logger','api','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','status','json','update','then','sendStatus','error','stack','name','send','user','role'];(function(_0x10e82f,_0x5f25d9){var _0x44e765=function(_0x53a76f){while(--_0x53a76f){_0x10e82f['push'](_0x10e82f['shift']());}};_0x44e765(++_0x5f25d9);}(_0x032e,0x124));var _0xe032=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x032e[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xe032('0x0'));var Redis=require('ioredis');var logger=require(_0xe032('0x1'))(_0xe032('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require(_0xe032('0x3'))(new Redis(config[_0xe032('0x4')]));require(_0xe032('0x5'))[_0xe032('0x6')](socket);config[_0xe032('0x4')]=_[_0xe032('0x7')](config[_0xe032('0x4')],{'host':_0xe032('0x8'),'port':0x18eb});function respondWithResult(_0x37432f,_0x1576c8){_0x1576c8=_0x1576c8||0xc8;return function(_0x3289b0){if(_0x3289b0){return _0x37432f[_0xe032('0x9')](_0x1576c8)[_0xe032('0xa')](_0x3289b0);}};}function saveUpdates(_0x3b0ef8){return function(_0x3d62fa){if(_0x3d62fa){return _0x3d62fa[_0xe032('0xb')](_0x3b0ef8)[_0xe032('0xc')](function(_0x167bd9){return _0x167bd9;});}return null;};}function handleEntityNotFound(_0x4aec53){return function(_0x1382e1){if(!_0x1382e1){_0x4aec53[_0xe032('0xd')](0x194);}return _0x1382e1;};}function handleError(_0x13c126,_0x42e2ba){_0x42e2ba=_0x42e2ba||0x1f4;return function(_0x244f93){logger[_0xe032('0xe')](_0x244f93[_0xe032('0xf')]);if(_0x244f93['name']){delete _0x244f93[_0xe032('0x10')];}_0x13c126[_0xe032('0x9')](_0x42e2ba)[_0xe032('0x11')](_0x244f93);};}exports[_0xe032('0xb')]=function(_0x4aee44,_0x311592){if(_0x4aee44[_0xe032('0x12')][_0xe032('0x13')]!==_0xe032('0x14'))throw new Error(_0xe032('0x15'));if(isNaN(Number(_0x4aee44[_0xe032('0x16')]['id'])))throw new Error(_0xe032('0x17'));return db['UserSetting'][_0xe032('0x18')]({'where':{'id':_0x4aee44[_0xe032('0x16')]['id']}})[_0xe032('0xc')](handleEntityNotFound(_0x311592,null))[_0xe032('0xc')](saveUpdates(_0x4aee44[_0xe032('0x19')],null))[_0xe032('0xc')](respondWithResult(_0x311592,null))['catch'](handleError(_0x311592,null));}; \ No newline at end of file +var _0x3189=['api','../../config/environment','../../mysqldb','redis','defaults','localhost','status','json','update','then','sendStatus','error','name','send','role','admin','Unauthorized','UserSetting','find','catch','lodash','ioredis'];(function(_0x1e2fea,_0xc67756){var _0x5df811=function(_0x1be170){while(--_0x1be170){_0x1e2fea['push'](_0x1e2fea['shift']());}};_0x5df811(++_0xc67756);}(_0x3189,0xae));var _0x9318=function(_0x3ee016,_0x255117){_0x3ee016=_0x3ee016-0x0;var _0x35314a=_0x3189[_0x3ee016];return _0x35314a;};'use strict';var _=require(_0x9318('0x0'));var Redis=require(_0x9318('0x1'));var logger=require('../../config/logger')(_0x9318('0x2'));var config=require(_0x9318('0x3'));var db=require(_0x9318('0x4'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x9318('0x5')]));require('./user-setting.socket')['register'](socket);config[_0x9318('0x5')]=_[_0x9318('0x6')](config['redis'],{'host':_0x9318('0x7'),'port':0x18eb});function respondWithResult(_0x4bb3c3,_0x4dbe95){_0x4dbe95=_0x4dbe95||0xc8;return function(_0x2f6831){if(_0x2f6831){return _0x4bb3c3[_0x9318('0x8')](_0x4dbe95)[_0x9318('0x9')](_0x2f6831);}};}function saveUpdates(_0x56f33b){return function(_0x2df2d5){if(_0x2df2d5){return _0x2df2d5[_0x9318('0xa')](_0x56f33b)[_0x9318('0xb')](function(_0x14ac5f){return _0x14ac5f;});}return null;};}function handleEntityNotFound(_0x58b98a){return function(_0x584ef7){if(!_0x584ef7){_0x58b98a[_0x9318('0xc')](0x194);}return _0x584ef7;};}function handleError(_0x554c82,_0x3dd355){_0x3dd355=_0x3dd355||0x1f4;return function(_0x27ba10){logger[_0x9318('0xd')](_0x27ba10['stack']);if(_0x27ba10[_0x9318('0xe')]){delete _0x27ba10['name'];}_0x554c82['status'](_0x3dd355)[_0x9318('0xf')](_0x27ba10);};}exports['update']=function(_0x32bb67,_0x41a953){if(_0x32bb67['user'][_0x9318('0x10')]!==_0x9318('0x11'))throw new Error(_0x9318('0x12'));if(isNaN(Number(_0x32bb67['params']['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0x9318('0x13')][_0x9318('0x14')]({'where':{'id':_0x32bb67['params']['id']}})[_0x9318('0xb')](handleEntityNotFound(_0x41a953,null))[_0x9318('0xb')](saveUpdates(_0x32bb67['body'],null))[_0x9318('0xb')](respondWithResult(_0x41a953,null))[_0x9318('0x15')](handleError(_0x41a953,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 d667095..db75f9b 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 _0x6940=['emit','hasOwnProperty','hook','events','setMaxListeners','save','update','remove'];(function(_0x1cff9a,_0x544ce0){var _0x2444b3=function(_0x594b79){while(--_0x594b79){_0x1cff9a['push'](_0x1cff9a['shift']());}};_0x2444b3(++_0x544ce0);}(_0x6940,0x83));var _0x0694=function(_0x3912f1,_0x16ae87){_0x3912f1=_0x3912f1-0x0;var _0x483477=_0x6940[_0x3912f1];return _0x483477;};'use strict';var EventEmitter=require(_0x0694('0x0'));var UserSetting=require('../../mysqldb')['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x0694('0x1')](0x0);var events={'afterCreate':_0x0694('0x2'),'afterUpdate':_0x0694('0x3'),'afterDestroy':_0x0694('0x4')};function emitEvent(_0x4d9e85){return function(_0x45b98d,_0x59567a,_0x3f05b0){UserSettingEvents[_0x0694('0x5')](_0x4d9e85+':'+_0x45b98d['id'],_0x45b98d);UserSettingEvents['emit'](_0x4d9e85,_0x45b98d);_0x3f05b0(null);};}for(var e in events){if(events[_0x0694('0x6')](e)){var event=events[e];UserSetting[_0x0694('0x7')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0x9ac5=['events','../../mysqldb','UserSetting','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports'];(function(_0x1684de,_0x2ae9b3){var _0x42dbe6=function(_0x2a5426){while(--_0x2a5426){_0x1684de['push'](_0x1684de['shift']());}};_0x42dbe6(++_0x2ae9b3);}(_0x9ac5,0x1d6));var _0x59ac=function(_0x19587b,_0x324fad){_0x19587b=_0x19587b-0x0;var _0x3aebb3=_0x9ac5[_0x19587b];return _0x3aebb3;};'use strict';var EventEmitter=require(_0x59ac('0x0'));var UserSetting=require(_0x59ac('0x1'))['db'][_0x59ac('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x59ac('0x3')](0x0);var events={'afterCreate':_0x59ac('0x4'),'afterUpdate':_0x59ac('0x5'),'afterDestroy':_0x59ac('0x6')};function emitEvent(_0x45652b){return function(_0x51f64a,_0x463fd2,_0x1277a0){UserSettingEvents['emit'](_0x45652b+':'+_0x51f64a['id'],_0x51f64a);UserSettingEvents['emit'](_0x45652b,_0x51f64a);_0x1277a0(null);};}for(var e in events){if(events[_0x59ac('0x7')](e)){var event=events[e];UserSetting[_0x59ac('0x8')](e,emitEvent(event));}}module[_0x59ac('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 e76d60e..66e2793 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 _0x22a4=['UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define'];(function(_0x103a8e,_0x54b9b0){var _0x390d2d=function(_0x17d46f){while(--_0x17d46f){_0x103a8e['push'](_0x103a8e['shift']());}};_0x390d2d(++_0x54b9b0);}(_0x22a4,0x1cb));var _0x422a=function(_0x3ad029,_0x1e7222){_0x3ad029=_0x3ad029-0x0;var _0x14c19d=_0x22a4[_0x3ad029];return _0x14c19d;};'use strict';var attributes=require(_0x422a('0x0'));module[_0x422a('0x1')]=function(_0xc33e81){return _0xc33e81[_0x422a('0x2')](_0x422a('0x3'),attributes,{'tableName':_0x422a('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4725b0){if(!_0x4725b0[_0x422a('0x5')])_0x4725b0['clientSideLoggingEnabledSince']=null;else if(_0x4725b0[_0x422a('0x6')]===null)_0x4725b0[_0x422a('0x6')]=new Date();}}});}; \ No newline at end of file +var _0xe706=['clientSideLoggingEnabledSince','./user-setting.attributes','exports','UserSetting','user_settings','clientSideLoggingEnabled'];(function(_0x19d846,_0x1096ec){var _0x24afbd=function(_0x168cf7){while(--_0x168cf7){_0x19d846['push'](_0x19d846['shift']());}};_0x24afbd(++_0x1096ec);}(_0xe706,0xa3));var _0x6e70=function(_0x25cec5,_0x115d0c){_0x25cec5=_0x25cec5-0x0;var _0x19fba4=_0xe706[_0x25cec5];return _0x19fba4;};'use strict';var attributes=require(_0x6e70('0x0'));module[_0x6e70('0x1')]=function(_0x311951){return _0x311951['define'](_0x6e70('0x2'),attributes,{'tableName':_0x6e70('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2ca810){if(!_0x2ca810[_0x6e70('0x4')])_0x2ca810[_0x6e70('0x5')]=null;else if(_0x2ca810[_0x6e70('0x5')]===null)_0x2ca810[_0x6e70('0x5')]=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 0d18b53..4f974fe 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 _0x52c8=['user-setting:','save','update','emit','user-setting:update:user-','UserId'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x52c8,0x1e1));var _0x852c=function(_0x21de89,_0x367053){_0x21de89=_0x21de89-0x0;var _0x290b7e=_0x52c8[_0x21de89];return _0x290b7e;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x852c('0x0'),'remove',_0x852c('0x1')];function createListener(_0x3a20b3,_0x136ed3){return function(_0x4e77e5){_0x136ed3[_0x852c('0x2')](_0x3a20b3,_0x4e77e5);if(_0x3a20b3==='user-setting:update'){_0x136ed3['emit'](_0x852c('0x3')+_0x4e77e5[_0x852c('0x4')],_0x4e77e5);}};}exports['register']=function(_0x27d8dd){for(var _0x2bbeb9=0x0,_0x12f7a5=events['length'];_0x2bbeb9<_0x12f7a5;_0x2bbeb9++){var _0x51db96=events[_0x2bbeb9];var _0x4d2f38=createListener(_0x852c('0x5')+_0x51db96,_0x27d8dd);UserSettingEvents['on'](_0x51db96,_0x4d2f38);}}; \ No newline at end of file +var _0x856a=['length','user-setting:','save','remove','emit','user-setting:update','UserId','register'];(function(_0x5ad7bf,_0x419399){var _0x4fd266=function(_0x3bbbfc){while(--_0x3bbbfc){_0x5ad7bf['push'](_0x5ad7bf['shift']());}};_0x4fd266(++_0x419399);}(_0x856a,0xba));var _0xa856=function(_0xec551d,_0x4a21c5){_0xec551d=_0xec551d-0x0;var _0x4b2c8f=_0x856a[_0xec551d];return _0x4b2c8f;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0xa856('0x0'),_0xa856('0x1'),'update'];function createListener(_0x1ed2a2,_0x35b835){return function(_0x8ba3d2){_0x35b835[_0xa856('0x2')](_0x1ed2a2,_0x8ba3d2);if(_0x1ed2a2===_0xa856('0x3')){_0x35b835[_0xa856('0x2')]('user-setting:update:user-'+_0x8ba3d2[_0xa856('0x4')],_0x8ba3d2);}};}exports[_0xa856('0x5')]=function(_0x4a97be){for(var _0x7659b6=0x0,_0x10f131=events[_0xa856('0x6')];_0x7659b6<_0x10f131;_0x7659b6++){var _0x15df0c=events[_0x7659b6];var _0x2b2605=createListener(_0xa856('0x7')+_0x15df0c,_0x4a97be);UserSettingEvents['on'](_0x15df0c,_0x2b2605);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 26c4f91..148954c 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 _0x1bc4=['/:id/scheduled_calls','getApiKey','post','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','format','%s-%s','now','originalname','/:id/avatar','single','file','/:id/login','login','/:id/logout','/:id/pause','pause','/:id/unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','/:id/square_projects','/:id/api_key','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','/:id/mail_accounts','removeMailAccounts','removeSmsAccounts','removeWhatsappAccounts','removeApiKey','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','getPresence','/:id','/:id/open_tabs','getOpenTabs','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','getSquareProjects'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0x1bc4,0xb7));var _0x41bc=function(_0x25b984,_0xd44cfe){_0x25b984=_0x25b984-0x0;var _0x2fcc06=_0x1bc4[_0x25b984];return _0x2fcc06;};'use strict';var multer=require(_0x41bc('0x0'));var util=require('util');var path=require(_0x41bc('0x1'));var timeout=require(_0x41bc('0x2'));var express=require(_0x41bc('0x3'));var router=express[_0x41bc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x41bc('0x5'));var interaction=require(_0x41bc('0x6'));var config=require(_0x41bc('0x7'));var controller=require(_0x41bc('0x8'));router[_0x41bc('0x9')]('/',auth[_0x41bc('0xa')](),controller[_0x41bc('0xb')]);router[_0x41bc('0x9')](_0x41bc('0xc'),auth[_0x41bc('0xa')](),controller[_0x41bc('0xd')]);router['get'](_0x41bc('0xe'),auth['isAuthenticated'](),controller[_0x41bc('0xf')]);router[_0x41bc('0x9')](_0x41bc('0x10'),auth[_0x41bc('0xa')](),controller[_0x41bc('0x11')]);router['get'](_0x41bc('0x12'),auth[_0x41bc('0xa')](),controller['show']);router[_0x41bc('0x9')]('/:id/avatar',controller['getAvatar']);router[_0x41bc('0x9')](_0x41bc('0x13'),auth[_0x41bc('0xa')](),controller[_0x41bc('0x14')]);router[_0x41bc('0x9')](_0x41bc('0x15'),auth[_0x41bc('0xa')](),controller['getContacts']);router[_0x41bc('0x9')](_0x41bc('0x16'),auth[_0x41bc('0xa')](),controller[_0x41bc('0x17')]);router['get'](_0x41bc('0x18'),auth[_0x41bc('0xa')](),controller[_0x41bc('0x19')]);router[_0x41bc('0x9')](_0x41bc('0x1a'),auth[_0x41bc('0xa')](),controller[_0x41bc('0x1b')]);router[_0x41bc('0x9')](_0x41bc('0x1c'),auth[_0x41bc('0xa')](),controller[_0x41bc('0x1d')]);router['get']('/:id/screen_recordings',auth[_0x41bc('0xa')](),controller['getScreenRecordings']);router[_0x41bc('0x9')]('/:id/chat/interactions',auth[_0x41bc('0xa')](),controller[_0x41bc('0x1e')]);router[_0x41bc('0x9')](_0x41bc('0x1f'),auth['isAuthenticated'](),controller['getOpenchannelInteractions']);router['get'](_0x41bc('0x20'),auth[_0x41bc('0xa')](),controller['getMailInteractions']);router[_0x41bc('0x9')](_0x41bc('0x21'),auth[_0x41bc('0xa')](),controller[_0x41bc('0x22')]);router['get']('/:id/fax/interactions',auth[_0x41bc('0xa')](),controller[_0x41bc('0x23')]);router[_0x41bc('0x9')](_0x41bc('0x24'),auth[_0x41bc('0xa')](),controller[_0x41bc('0x25')]);router[_0x41bc('0x9')](_0x41bc('0x26'),auth[_0x41bc('0xa')](),controller[_0x41bc('0x27')]);router[_0x41bc('0x9')](_0x41bc('0x28'),auth['isAuthenticated'](),controller[_0x41bc('0x29')]);router[_0x41bc('0x9')](_0x41bc('0x2a'),auth['isAuthenticated'](),controller[_0x41bc('0x2b')]);router[_0x41bc('0x9')]('/:id/prefixes',auth[_0x41bc('0xa')](),controller['getVoicePrefixes']);router['get'](_0x41bc('0x2c'),auth[_0x41bc('0xa')](),controller[_0x41bc('0x2d')]);router['get']('/:id/mail_accounts',auth[_0x41bc('0xa')](),controller[_0x41bc('0x2e')]);router['get'](_0x41bc('0x2f'),auth[_0x41bc('0xa')](),controller[_0x41bc('0x30')]);router['get'](_0x41bc('0x31'),auth[_0x41bc('0xa')](),controller['getSmsAccounts']);router['get'](_0x41bc('0x32'),auth[_0x41bc('0xa')](),controller[_0x41bc('0x33')]);router[_0x41bc('0x9')]('/:id/whatsapp_accounts',auth[_0x41bc('0xa')](),controller['getWhatsappAccounts']);router[_0x41bc('0x9')]('/:id/square_projects',auth[_0x41bc('0xa')](),controller[_0x41bc('0x34')]);router['get'](_0x41bc('0x35'),auth[_0x41bc('0xa')](),controller['getScheduledCalls']);router[_0x41bc('0x9')]('/:id/api_key',auth[_0x41bc('0xa')](),controller[_0x41bc('0x36')]);router[_0x41bc('0x37')](_0x41bc('0x15'),auth['isAuthenticated'](),controller[_0x41bc('0x38')]);router[_0x41bc('0x37')]('/',auth[_0x41bc('0xa')](),controller[_0x41bc('0x39')]);router['post'](_0x41bc('0x3a'),auth[_0x41bc('0xa')](),controller[_0x41bc('0x3b')]);router[_0x41bc('0x37')](_0x41bc('0x16'),auth[_0x41bc('0xa')](),controller[_0x41bc('0x3c')]);var upload=multer({'storage':multer[_0x41bc('0x3d')]({'destination':function(_0x4d0548,_0x298b80,_0x434f17){_0x434f17(null,path[_0x41bc('0x3e')](config[_0x41bc('0x3f')],'server/files/images/'));},'filename':function(_0x197912,_0x38d6b2,_0xc70dd5){_0xc70dd5(null,util[_0x41bc('0x40')](_0x41bc('0x41'),Date[_0x41bc('0x42')](),_0x38d6b2[_0x41bc('0x43')]));}})});router[_0x41bc('0x37')](_0x41bc('0x44'),upload[_0x41bc('0x45')](_0x41bc('0x46')),controller['addAvatar']);router['post'](_0x41bc('0x47'),auth[_0x41bc('0xa')](),controller[_0x41bc('0x48')]);router['post'](_0x41bc('0x49'),auth[_0x41bc('0xa')](),controller['logout']);router[_0x41bc('0x37')](_0x41bc('0x4a'),auth['isAuthenticated'](),controller[_0x41bc('0x4b')]);router[_0x41bc('0x37')](_0x41bc('0x4c'),auth[_0x41bc('0xa')](),controller['unpause']);router[_0x41bc('0x37')](_0x41bc('0x26'),auth[_0x41bc('0xa')](),controller[_0x41bc('0x4d')]);router[_0x41bc('0x37')](_0x41bc('0x4e'),auth[_0x41bc('0xa')](),controller['addChatInteractions']);router[_0x41bc('0x37')](_0x41bc('0x4f'),auth['isAuthenticated'](),controller[_0x41bc('0x50')]);router[_0x41bc('0x37')](_0x41bc('0x51'),auth[_0x41bc('0xa')](),controller[_0x41bc('0x52')]);router['post']('/:id/sms_interactions',auth[_0x41bc('0xa')](),controller[_0x41bc('0x53')]);router[_0x41bc('0x37')](_0x41bc('0x54'),auth[_0x41bc('0xa')](),controller[_0x41bc('0x55')]);router[_0x41bc('0x37')](_0x41bc('0x56'),auth[_0x41bc('0xa')](),controller[_0x41bc('0x57')]);router[_0x41bc('0x37')](_0x41bc('0x2c'),auth[_0x41bc('0xa')](),controller[_0x41bc('0x58')]);router[_0x41bc('0x37')]('/:id/mail_accounts',auth[_0x41bc('0xa')](),controller[_0x41bc('0x59')]);router[_0x41bc('0x37')](_0x41bc('0x2f'),auth[_0x41bc('0xa')](),controller[_0x41bc('0x5a')]);router[_0x41bc('0x37')](_0x41bc('0x31'),auth['isAuthenticated'](),controller['addSmsAccounts']);router[_0x41bc('0x37')]('/:id/chat_websites',auth[_0x41bc('0xa')](),controller[_0x41bc('0x5b')]);router['post'](_0x41bc('0x5c'),auth['isAuthenticated'](),controller[_0x41bc('0x5d')]);router[_0x41bc('0x37')](_0x41bc('0x5e'),auth[_0x41bc('0xa')](),controller['addSquareProjects']);router['post'](_0x41bc('0x5f'),auth[_0x41bc('0xa')](),controller[_0x41bc('0x60')]);router[_0x41bc('0x61')](_0x41bc('0x12'),auth[_0x41bc('0xa')](),controller[_0x41bc('0x62')]);router[_0x41bc('0x61')](_0x41bc('0x63'),auth['isAuthenticated'](),controller[_0x41bc('0x64')]);router[_0x41bc('0x65')](_0x41bc('0x16'),auth[_0x41bc('0xa')](),controller[_0x41bc('0x66')]);router['delete'](_0x41bc('0x26'),auth[_0x41bc('0xa')](),controller[_0x41bc('0x67')]);router[_0x41bc('0x65')](_0x41bc('0x12'),auth[_0x41bc('0xa')](),controller[_0x41bc('0x68')]);router[_0x41bc('0x65')](_0x41bc('0x4e'),auth[_0x41bc('0xa')](),controller[_0x41bc('0x69')]);router['delete'](_0x41bc('0x4f'),auth['isAuthenticated'](),controller[_0x41bc('0x6a')]);router[_0x41bc('0x65')](_0x41bc('0x51'),auth[_0x41bc('0xa')](),controller[_0x41bc('0x6b')]);router[_0x41bc('0x65')](_0x41bc('0x6c'),auth['isAuthenticated'](),controller[_0x41bc('0x6d')]);router[_0x41bc('0x65')](_0x41bc('0x54'),auth[_0x41bc('0xa')](),controller[_0x41bc('0x6e')]);router[_0x41bc('0x65')](_0x41bc('0x56'),auth['isAuthenticated'](),controller[_0x41bc('0x6f')]);router['delete'](_0x41bc('0x2c'),auth[_0x41bc('0xa')](),controller['removeFaxAccounts']);router['delete'](_0x41bc('0x70'),auth['isAuthenticated'](),controller[_0x41bc('0x71')]);router['delete'](_0x41bc('0x2f'),auth[_0x41bc('0xa')](),controller['removeOpenchannelAccounts']);router['delete'](_0x41bc('0x31'),auth[_0x41bc('0xa')](),controller[_0x41bc('0x72')]);router[_0x41bc('0x65')]('/:id/chat_websites',auth[_0x41bc('0xa')](),controller['removeChatWebsites']);router[_0x41bc('0x65')](_0x41bc('0x5c'),auth[_0x41bc('0xa')](),controller[_0x41bc('0x73')]);router[_0x41bc('0x65')](_0x41bc('0x5e'),auth[_0x41bc('0xa')](),controller['removeSquareProjects']);router['delete'](_0x41bc('0x5f'),auth[_0x41bc('0xa')](),controller[_0x41bc('0x74')]);module[_0x41bc('0x75')]=router; \ No newline at end of file +var _0xec09=['getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','/:id/prefixes','/:id/fax_accounts','/:id/mail_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','getSquareProjects','getScheduledCalls','/:id/api_key','getApiKey','post','create','/create_many','bulkCreate','addQueues','diskStorage','join','server/files/images/','format','%s-%s','now','single','file','addAvatar','/:id/login','login','/:id/logout','logout','pause','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','/:id/whatsapp_accounts','addWhatsappAccounts','/:id/square_projects','addSquareProjects','createApiKey','put','update','changePassword','delete','removeQueues','removeTeams','/:id','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','get','/describe','whoami','/presence','getPresence','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings'];(function(_0x4d3cfa,_0x3b7527){var _0x1dd9f6=function(_0x12ce4a){while(--_0x12ce4a){_0x4d3cfa['push'](_0x4d3cfa['shift']());}};_0x1dd9f6(++_0x3b7527);}(_0xec09,0x14b));var _0x9ec0=function(_0x281664,_0x20c5f4){_0x281664=_0x281664-0x0;var _0xccd1b0=_0xec09[_0x281664];return _0xccd1b0;};'use strict';var multer=require(_0x9ec0('0x0'));var util=require(_0x9ec0('0x1'));var path=require('path');var timeout=require(_0x9ec0('0x2'));var express=require(_0x9ec0('0x3'));var router=express['Router']();var fs_extra=require(_0x9ec0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9ec0('0x5'));var config=require(_0x9ec0('0x6'));var controller=require(_0x9ec0('0x7'));router['get']('/',auth[_0x9ec0('0x8')](),controller['index']);router[_0x9ec0('0x9')](_0x9ec0('0xa'),auth[_0x9ec0('0x8')](),controller['describe']);router[_0x9ec0('0x9')]('/whoami',auth[_0x9ec0('0x8')](),controller[_0x9ec0('0xb')]);router[_0x9ec0('0x9')](_0x9ec0('0xc'),auth[_0x9ec0('0x8')](),controller[_0x9ec0('0xd')]);router[_0x9ec0('0x9')]('/:id',auth[_0x9ec0('0x8')](),controller[_0x9ec0('0xe')]);router[_0x9ec0('0x9')](_0x9ec0('0xf'),controller[_0x9ec0('0x10')]);router[_0x9ec0('0x9')](_0x9ec0('0x11'),auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x12')]);router[_0x9ec0('0x9')](_0x9ec0('0x13'),auth['isAuthenticated'](),controller[_0x9ec0('0x14')]);router[_0x9ec0('0x9')](_0x9ec0('0x15'),auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x16')]);router[_0x9ec0('0x9')](_0x9ec0('0x17'),auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x18')]);router[_0x9ec0('0x9')](_0x9ec0('0x19'),auth['isAuthenticated'](),controller[_0x9ec0('0x1a')]);router[_0x9ec0('0x9')]('/:id/recordings',auth['isAuthenticated'](),controller[_0x9ec0('0x1b')]);router[_0x9ec0('0x9')](_0x9ec0('0x1c'),auth['isAuthenticated'](),controller[_0x9ec0('0x1d')]);router['get'](_0x9ec0('0x1e'),auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x1f')]);router[_0x9ec0('0x9')]('/:id/openchannel/interactions',auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x20')]);router[_0x9ec0('0x9')](_0x9ec0('0x21'),auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x22')]);router[_0x9ec0('0x9')](_0x9ec0('0x23'),auth['isAuthenticated'](),controller[_0x9ec0('0x24')]);router['get'](_0x9ec0('0x25'),auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x26')]);router[_0x9ec0('0x9')](_0x9ec0('0x27'),auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x28')]);router[_0x9ec0('0x9')](_0x9ec0('0x29'),auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x2a')]);router[_0x9ec0('0x9')](_0x9ec0('0x2b'),auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x2c')]);router[_0x9ec0('0x9')](_0x9ec0('0x2d'),auth[_0x9ec0('0x8')](),controller['getAgents']);router[_0x9ec0('0x9')](_0x9ec0('0x2e'),auth[_0x9ec0('0x8')](),controller['getVoicePrefixes']);router[_0x9ec0('0x9')](_0x9ec0('0x2f'),auth['isAuthenticated'](),controller['getFaxAccounts']);router[_0x9ec0('0x9')](_0x9ec0('0x30'),auth[_0x9ec0('0x8')](),controller['getMailAccounts']);router[_0x9ec0('0x9')]('/:id/openchannel_accounts',auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x31')]);router[_0x9ec0('0x9')](_0x9ec0('0x32'),auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x33')]);router[_0x9ec0('0x9')](_0x9ec0('0x34'),auth['isAuthenticated'](),controller[_0x9ec0('0x35')]);router['get']('/:id/whatsapp_accounts',auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x36')]);router[_0x9ec0('0x9')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0x9ec0('0x37')]);router[_0x9ec0('0x9')]('/:id/scheduled_calls',auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x38')]);router['get'](_0x9ec0('0x39'),auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x3a')]);router['post'](_0x9ec0('0x13'),auth[_0x9ec0('0x8')](),controller['addContacts']);router[_0x9ec0('0x3b')]('/',auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x3c')]);router[_0x9ec0('0x3b')](_0x9ec0('0x3d'),auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x3e')]);router[_0x9ec0('0x3b')](_0x9ec0('0x15'),auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x3f')]);var upload=multer({'storage':multer[_0x9ec0('0x40')]({'destination':function(_0x4b94a1,_0x251c91,_0x5eeb53){_0x5eeb53(null,path[_0x9ec0('0x41')](config['root'],_0x9ec0('0x42')));},'filename':function(_0x4852f8,_0x383902,_0x5b7f2e){_0x5b7f2e(null,util[_0x9ec0('0x43')](_0x9ec0('0x44'),Date[_0x9ec0('0x45')](),_0x383902['originalname']));}})});router[_0x9ec0('0x3b')](_0x9ec0('0xf'),upload[_0x9ec0('0x46')](_0x9ec0('0x47')),controller[_0x9ec0('0x48')]);router[_0x9ec0('0x3b')](_0x9ec0('0x49'),auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x4a')]);router[_0x9ec0('0x3b')](_0x9ec0('0x4b'),auth['isAuthenticated'](),controller[_0x9ec0('0x4c')]);router['post']('/:id/pause',auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x4d')]);router['post'](_0x9ec0('0x4e'),auth[_0x9ec0('0x8')](),controller['unpause']);router[_0x9ec0('0x3b')](_0x9ec0('0x29'),auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x4f')]);router['post'](_0x9ec0('0x50'),auth['isAuthenticated'](),controller[_0x9ec0('0x51')]);router[_0x9ec0('0x3b')]('/:id/mail_interactions',auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x52')]);router[_0x9ec0('0x3b')]('/:id/fax_interactions',auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x53')]);router[_0x9ec0('0x3b')](_0x9ec0('0x54'),auth['isAuthenticated'](),controller[_0x9ec0('0x55')]);router['post'](_0x9ec0('0x56'),auth[_0x9ec0('0x8')](),controller['addOpenchannelInteractions']);router[_0x9ec0('0x3b')](_0x9ec0('0x57'),auth[_0x9ec0('0x8')](),controller['addWhatsappInteractions']);router['post'](_0x9ec0('0x2f'),auth['isAuthenticated'](),controller[_0x9ec0('0x58')]);router[_0x9ec0('0x3b')](_0x9ec0('0x30'),auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x59')]);router[_0x9ec0('0x3b')](_0x9ec0('0x5a'),auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x5b')]);router[_0x9ec0('0x3b')](_0x9ec0('0x32'),auth[_0x9ec0('0x8')](),controller['addSmsAccounts']);router[_0x9ec0('0x3b')](_0x9ec0('0x34'),auth[_0x9ec0('0x8')](),controller['addChatWebsites']);router['post'](_0x9ec0('0x5c'),auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x5d')]);router[_0x9ec0('0x3b')](_0x9ec0('0x5e'),auth['isAuthenticated'](),controller[_0x9ec0('0x5f')]);router[_0x9ec0('0x3b')](_0x9ec0('0x39'),auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x60')]);router[_0x9ec0('0x61')]('/:id',auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x62')]);router['put']('/:id/password',auth['isAuthenticated'](),controller[_0x9ec0('0x63')]);router[_0x9ec0('0x64')](_0x9ec0('0x15'),auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x65')]);router['delete'](_0x9ec0('0x29'),auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x66')]);router[_0x9ec0('0x64')](_0x9ec0('0x67'),auth[_0x9ec0('0x8')](),controller['destroy']);router[_0x9ec0('0x64')](_0x9ec0('0x50'),auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x68')]);router[_0x9ec0('0x64')](_0x9ec0('0x69'),auth['isAuthenticated'](),controller[_0x9ec0('0x6a')]);router['delete'](_0x9ec0('0x6b'),auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x6c')]);router['delete'](_0x9ec0('0x54'),auth['isAuthenticated'](),controller[_0x9ec0('0x6d')]);router['delete']('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0x9ec0('0x6e')]);router['delete']('/:id/whatsapp_interactions',auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x6f')]);router['delete'](_0x9ec0('0x2f'),auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x70')]);router[_0x9ec0('0x64')]('/:id/mail_accounts',auth['isAuthenticated'](),controller['removeMailAccounts']);router[_0x9ec0('0x64')](_0x9ec0('0x5a'),auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x71')]);router['delete'](_0x9ec0('0x32'),auth['isAuthenticated'](),controller[_0x9ec0('0x72')]);router[_0x9ec0('0x64')](_0x9ec0('0x34'),auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x73')]);router[_0x9ec0('0x64')]('/:id/whatsapp_accounts',auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x74')]);router['delete']('/:id/square_projects',auth[_0x9ec0('0x8')](),controller[_0x9ec0('0x75')]);router[_0x9ec0('0x64')](_0x9ec0('0x39'),auth['isAuthenticated'](),controller[_0x9ec0('0x76')]);module[_0x9ec0('0x77')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 1fd9153..08a82e4 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 _0xb126=['PROHIB_FAILED_SCREEN','PROHIB','udp','transport','split','rfc2833','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]','all','ulaw;alaw;gsm','allow','join','insecure','never','\x22\x22\x20<>','always','originate','uas','fingerprint','certificate','active','nonat','update,nonat','showWebBar','get','encryption','avpf','force_avp','icesupport','dtlsenable','dtlssetup','wss','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','TEXT','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','format','\x22%s\x22\x20<%s>','internal','email','toLowerCase','ENUM','admin','user','agent','local','INTEGER','accountcode','callerid','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED','PROHIB_PASSED_SCREEN'];(function(_0x392726,_0x788044){var _0xff2dee=function(_0x566947){while(--_0x566947){_0x392726['push'](_0x392726['shift']());}};_0xff2dee(++_0x788044);}(_0xb126,0x92));var _0x6b12=function(_0x4c156b,_0x40d7a6){_0x4c156b=_0x4c156b-0x0;var _0x4ead8b=_0xb126[_0x4c156b];return _0x4ead8b;};'use strict';var Sequelize=require(_0x6b12('0x0'));var moment=require(_0x6b12('0x1'));var util=require(_0x6b12('0x2'));var _=require('lodash');module[_0x6b12('0x3')]={'name':{'type':Sequelize[_0x6b12('0x4')],'allowNull':![],'unique':_0x6b12('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1ccd8c){this[_0x6b12('0x6')](_0x6b12('0x5'),_0x1ccd8c);this[_0x6b12('0x6')](_0x6b12('0x7'),_0x1ccd8c);},'comment':_0x6b12('0x8')},'fullname':{'type':Sequelize[_0x6b12('0x4')],'allowNull':![],'set':function(_0x5e7caa){this[_0x6b12('0x6')](_0x6b12('0x9'),_0x5e7caa);this[_0x6b12('0x6')]('callerid',util[_0x6b12('0xa')](_0x6b12('0xb'),_0x5e7caa,this['getDataValue'](_0x6b12('0xc'))));}},'alias':{'type':Sequelize[_0x6b12('0x4')]},'email':{'type':Sequelize[_0x6b12('0x4')],'allowNull':![],'unique':_0x6b12('0xd'),'validate':{'isEmail':!![]},'set':function(_0x399014){if(_0x399014){this[_0x6b12('0x6')]('email',_0x399014[_0x6b12('0xe')]());}}},'role':{'type':Sequelize[_0x6b12('0xf')](_0x6b12('0x10'),_0x6b12('0x11'),_0x6b12('0x12'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x6b12('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x6b12('0x4')],'defaultValue':_0x6b12('0x13')},'internal':{'type':Sequelize[_0x6b12('0x14')](0xb),'allowNull':![],'unique':_0x6b12('0xc'),'set':function(_0x1d5304){this[_0x6b12('0x6')](_0x6b12('0xc'),_0x1d5304);this['setDataValue'](_0x6b12('0x15'),_0x1d5304);this[_0x6b12('0x6')](_0x6b12('0x16'),util[_0x6b12('0xa')]('\x22%s\x22\x20<%s>',this[_0x6b12('0x17')](_0x6b12('0x9')),_0x1d5304));}},'salt':{'type':Sequelize[_0x6b12('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x6b12('0x4')]},'userpic':{'type':Sequelize[_0x6b12('0x4')]},'city':{'type':Sequelize[_0x6b12('0x4')]},'country':{'type':Sequelize[_0x6b12('0x4')]},'online':{'type':Sequelize[_0x6b12('0x18')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x6b12('0x19')]},'voicePause':{'type':Sequelize[_0x6b12('0x18')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x6b12('0x18')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x6b12('0x18')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x6b12('0x18')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x6b12('0x18')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x6b12('0x18')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x6b12('0x18')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x6b12('0x4')],'defaultValue':_0x6b12('0x1a')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x6b12('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x6b12('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x6b12('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x6b12('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x6b12('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x6b12('0x18')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x6b12('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x6b12('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x6b12('0x18')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x6b12('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x6b12('0x18')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x6b12('0x18')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x6b12('0x18')],'defaultValue':![]},'description':{'type':Sequelize[_0x6b12('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x6b12('0x4')],'allowNull':!![],'defaultValue':_0x6b12('0x1b')},'ipaddr':{'type':Sequelize[_0x6b12('0x4')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x6b12('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x6b12('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x6b12('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x6b12('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x6b12('0xf')](_0x6b12('0x1c'),_0x6b12('0x11'),_0x6b12('0x1d')),'allowNull':!![],'defaultValue':_0x6b12('0x1c')},'context':{'type':Sequelize[_0x6b12('0x4')],'allowNull':!![],'defaultValue':_0x6b12('0x1e')},'callingpres':{'type':Sequelize[_0x6b12('0xf')](_0x6b12('0x1f'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0x6b12('0x20'),'PROHIB_NOT_SCREENED',_0x6b12('0x21'),_0x6b12('0x22'),_0x6b12('0x23')),'allowNull':!![]},'deny':{'type':Sequelize[_0x6b12('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x6b12('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x6b12('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x6b12('0x4')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x6b12('0x24'),'set':function(_0x2eee84){this[_0x6b12('0x6')](_0x6b12('0x25'),_0x2eee84?_0x2eee84['join'](','):null);},'get':function(){return this[_0x6b12('0x17')](_0x6b12('0x25'))?this[_0x6b12('0x17')](_0x6b12('0x25'))[_0x6b12('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x6b12('0xf')](_0x6b12('0x27'),'info',_0x6b12('0x28'),_0x6b12('0x29'),_0x6b12('0x2a')),'allowNull':!![],'defaultValue':_0x6b12('0x27')},'directmedia':{'type':Sequelize['ENUM'](_0x6b12('0x2b'),'no','nonat',_0x6b12('0x2c'),_0x6b12('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x6b12('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x6b12('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x6b12('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x6b12('0x4')],'allowNull':!![],'defaultValue':_0x6b12('0x2e'),'set':function(_0x52c0da){this['setDataValue'](_0x6b12('0x2f'),_0x52c0da?_0x52c0da['join'](','):null);},'get':function(){return this['getDataValue']('nat')?this['getDataValue'](_0x6b12('0x2f'))[_0x6b12('0x26')](','):null;},'comment':_0x6b12('0x30')},'callgroup':{'type':Sequelize[_0x6b12('0x4')]},'namedcallgroup':{'type':Sequelize[_0x6b12('0x4')]},'pickupgroup':{'type':Sequelize[_0x6b12('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x6b12('0x4')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x6b12('0x4')]},'disallow':{'type':Sequelize[_0x6b12('0x4')],'allowNull':![],'defaultValue':_0x6b12('0x31')},'allow':{'type':Sequelize[_0x6b12('0x4')],'allowNull':![],'defaultValue':_0x6b12('0x32'),'set':function(_0x481d16){this[_0x6b12('0x6')](_0x6b12('0x33'),_0x481d16?_0x481d16[_0x6b12('0x34')](';'):_0x6b12('0x32'));},'get':function(){return this[_0x6b12('0x17')](_0x6b12('0x33'))?this[_0x6b12('0x17')](_0x6b12('0x33'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x6b12('0xf')](_0x6b12('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x55cde3){this[_0x6b12('0x6')](_0x6b12('0x35'),_0x55cde3?_0x55cde3[_0x6b12('0x34')](','):null);},'get':function(){return this[_0x6b12('0x17')]('insecure')?this['getDataValue'](_0x6b12('0x35'))[_0x6b12('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x6b12('0xf')](_0x6b12('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x6b12('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x6b12('0xf')](_0x6b12('0x2b'),'no',_0x6b12('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x6b12('0xf')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x6b12('0xf')](_0x6b12('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x6b12('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x6b12('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x6b12('0x4')],'allowNull':!![],'defaultValue':_0x6b12('0x37')},'amaflags':{'type':Sequelize[_0x6b12('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x6b12('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x6b12('0x2b')},'busylevel':{'type':Sequelize[_0x6b12('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x6b12('0xf')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x6b12('0xf')](_0x6b12('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x6b12('0xf')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x6b12('0xf')](_0x6b12('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x6b12('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x6b12('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x6b12('0xf')](_0x6b12('0x2b'),'no',_0x6b12('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x6b12('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x6b12('0xf')](_0x6b12('0x2b'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x6b12('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x6b12('0xf')]('accept','refuse',_0x6b12('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x6b12('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x6b12('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x6b12('0xf')]('uac','uas'),'allowNull':!![],'defaultValue':_0x6b12('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0x6b12('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x6b12('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x6b12('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x6b12('0xf')]('yes','no'),'allowNull':!![],'defaultValue':_0x6b12('0x2b')},'keepalive':{'type':Sequelize[_0x6b12('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x6b12('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x6b12('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x6b12('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x6b12('0xf')](_0x6b12('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x6b12('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x6b12('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x6b12('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x6b12('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x6b12('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x6b12('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x6b12('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x6b12('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x6b12('0xf')](_0x6b12('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x6b12('0xf')](_0x6b12('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x6b12('0xf')](_0x6b12('0x2b'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x6b12('0xf')](_0x6b12('0x2b'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x6b12('0xf')](_0x6b12('0x2b'),'no',_0x6b12('0x3b'),_0x6b12('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x6b12('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x6b12('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x6b12('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x6b12('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x6b12('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x6b12('0xf')](_0x6b12('0x3d'),'passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x6b12('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x6b12('0xf')](_0x6b12('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x6b12('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x6b12('0xf')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x6b12('0xf')](_0x6b12('0x2b'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x6b12('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x6b12('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x6b12('0xf')](_0x6b12('0x2b'),'no',_0x6b12('0x3e'),_0x6b12('0x2c'),_0x6b12('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x6b12('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x6b12('0x19')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x6b12('0x14')],'defaultValue':0x0,'set':function(_0x4e932d){this[_0x6b12('0x6')](_0x6b12('0x40'),_0x4e932d);var _0x394f28=this[_0x6b12('0x41')]({'plain':!![]});switch(_0x4e932d){case 0x0:case 0x1:var _0x8cda76=_0x394f28[_0x6b12('0x25')]?_['isArray'](_0x394f28['transport'])?_0x394f28[_0x6b12('0x25')][_0x6b12('0x34')]():_0x394f28[_0x6b12('0x25')]:'udp';if(_0x8cda76==='wss'){_0x8cda76='udp';}this['setDataValue'](_0x6b12('0x25'),_0x8cda76);this[_0x6b12('0x6')](_0x6b12('0x42'),'no');this[_0x6b12('0x6')](_0x6b12('0x43'),null);this[_0x6b12('0x6')](_0x6b12('0x44'),null);this['setDataValue'](_0x6b12('0x45'),null);this[_0x6b12('0x6')](_0x6b12('0x46'),null);this['setDataValue']('dtlsverify',null);this[_0x6b12('0x6')](_0x6b12('0x47'),null);this[_0x6b12('0x6')]('dtlscertfile',null);this['setDataValue']('dtlsprivatekey',null);this[_0x6b12('0x6')]('rtcp_mux','no');break;case 0x2:this[_0x6b12('0x6')](_0x6b12('0x25'),_0x6b12('0x48'));this[_0x6b12('0x6')](_0x6b12('0x42'),'yes');this[_0x6b12('0x6')]('avpf',_0x6b12('0x2b'));this[_0x6b12('0x6')](_0x6b12('0x44'),_0x6b12('0x2b'));this[_0x6b12('0x6')](_0x6b12('0x45'),'yes');this['setDataValue'](_0x6b12('0x46'),_0x6b12('0x2b'));this[_0x6b12('0x6')]('dtlsverify','no');this[_0x6b12('0x6')](_0x6b12('0x47'),_0x6b12('0x49'));this[_0x6b12('0x6')](_0x6b12('0x4a'),_0x394f28[_0x6b12('0x4a')]||_0x6b12('0x4b'));this['setDataValue'](_0x6b12('0x4c'),_0x394f28[_0x6b12('0x4c')]||_0x6b12('0x4d'));this[_0x6b12('0x6')]('rtcp_mux',_0x6b12('0x2b'));break;default:}}},'permissions':{'type':Sequelize[_0x6b12('0x4e')],'set':function(_0x5ad2a5){this['setDataValue']('permissions',_0x5ad2a5?_0x5ad2a5[_0x6b12('0x34')](','):[]);},'get':function(){return this[_0x6b12('0x17')](_0x6b12('0x4f'))?_[_0x6b12('0x50')](this[_0x6b12('0x17')]('permissions')[_0x6b12('0x26')](','),function(_0x4faa02){return parseInt(_0x4faa02,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x6b12('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x6b12('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x6b12('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x6b12('0x18')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x6b12('0x18')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x6b12('0x18')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x6b12('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x6b12('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x6b12('0x18')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x6b12('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x6b12('0x18')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x6b12('0x18')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x6b12('0x17')](_0x6b12('0x51'))?this[_0x6b12('0x17')](_0x6b12('0x51')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x6b12('0x18')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x6b12('0x18')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x6b12('0x18')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x6b12('0x18')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x6b12('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x6b12('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x3eba41){if(typeof _0x3eba41===_0x6b12('0x52')){var _0x1f4207=_0x3eba41==='1'?!![]:_0x3eba41==='0'?![]:_0x3eba41===_0x6b12('0x53')?!![]:_0x3eba41===_0x6b12('0x54')?![]:![];this[_0x6b12('0x6')](_0x6b12('0x55'),_0x1f4207);}else{this['setDataValue'](_0x6b12('0x55'),_0x3eba41);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x18bd61){this['setDataValue'](_0x6b12('0x56'),_0x18bd61);if(_0x18bd61===!![]){this['setDataValue'](_0x6b12('0x57'),moment());this[_0x6b12('0x6')](_0x6b12('0x58'),0x0);}else{this[_0x6b12('0x6')](_0x6b12('0x57'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x6b12('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x6b12('0x18')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x6b12('0x18')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0x6b12('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x6b12('0x18')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x6b12('0x18')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x6b12('0x18')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x6b12('0x18')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x6b12('0x18')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x6b12('0x18')],'defaultValue':![]}}; \ No newline at end of file +var _0xb2fa=['DATE','TEXT','showWebBar','encryption','avpf','force_avp','icesupport','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','wss','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','lodash','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','STRING','email','ENUM','admin','user','agent','local','INTEGER','accountcode','fullname','BOOLEAN','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','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','actpass'];(function(_0xdcbb99,_0x5af4ca){var _0x55ca74=function(_0x2662a3){while(--_0x2662a3){_0xdcbb99['push'](_0xdcbb99['shift']());}};_0x55ca74(++_0x5af4ca);}(_0xb2fa,0xd0));var _0xab2f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb2fa[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xab2f('0x0'));var moment=require(_0xab2f('0x1'));var util=require('util');var _=require(_0xab2f('0x2'));module[_0xab2f('0x3')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x200e75){this['setDataValue'](_0xab2f('0x4'),_0x200e75);this[_0xab2f('0x5')](_0xab2f('0x6'),_0x200e75);},'comment':_0xab2f('0x7')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x4a1263){this[_0xab2f('0x5')]('fullname',_0x4a1263);this[_0xab2f('0x5')](_0xab2f('0x8'),util[_0xab2f('0x9')](_0xab2f('0xa'),_0x4a1263,this[_0xab2f('0xb')](_0xab2f('0xc'))));}},'alias':{'type':Sequelize[_0xab2f('0xd')]},'email':{'type':Sequelize[_0xab2f('0xd')],'allowNull':![],'unique':_0xab2f('0xe'),'validate':{'isEmail':!![]},'set':function(_0x17b911){if(_0x17b911){this[_0xab2f('0x5')](_0xab2f('0xe'),_0x17b911['toLowerCase']());}}},'role':{'type':Sequelize[_0xab2f('0xf')](_0xab2f('0x10'),_0xab2f('0x11'),_0xab2f('0x12'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0xab2f('0xd')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xab2f('0xd')],'defaultValue':_0xab2f('0x13')},'internal':{'type':Sequelize[_0xab2f('0x14')](0xb),'allowNull':![],'unique':_0xab2f('0xc'),'set':function(_0x3de5a8){this[_0xab2f('0x5')](_0xab2f('0xc'),_0x3de5a8);this['setDataValue'](_0xab2f('0x15'),_0x3de5a8);this[_0xab2f('0x5')](_0xab2f('0x8'),util[_0xab2f('0x9')]('\x22%s\x22\x20<%s>',this[_0xab2f('0xb')](_0xab2f('0x16')),_0x3de5a8));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xab2f('0xd')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0xab2f('0xd')]},'zipcode':{'type':Sequelize[_0xab2f('0xd')]},'userpic':{'type':Sequelize[_0xab2f('0xd')]},'city':{'type':Sequelize[_0xab2f('0xd')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xab2f('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0xab2f('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xab2f('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xab2f('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xab2f('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xab2f('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xab2f('0xd')],'defaultValue':_0xab2f('0x18')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0xab2f('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xab2f('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xab2f('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xab2f('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xab2f('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xab2f('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xab2f('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xab2f('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![]},'host':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![],'defaultValue':_0xab2f('0x19')},'ipaddr':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xab2f('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xab2f('0xf')](_0xab2f('0x1a'),_0xab2f('0x11'),_0xab2f('0x1b')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![],'defaultValue':_0xab2f('0x1c')},'callingpres':{'type':Sequelize[_0xab2f('0xf')](_0xab2f('0x1d'),_0xab2f('0x1e'),_0xab2f('0x1f'),'ALLOWED',_0xab2f('0x20'),_0xab2f('0x21'),_0xab2f('0x22'),_0xab2f('0x23')),'allowNull':!![]},'deny':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![]},'permit':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xab2f('0x24'),'set':function(_0x2c1768){this['setDataValue'](_0xab2f('0x25'),_0x2c1768?_0x2c1768[_0xab2f('0x26')](','):null);},'get':function(){return this['getDataValue'](_0xab2f('0x25'))?this['getDataValue'](_0xab2f('0x25'))['split'](','):null;},'comment':_0xab2f('0x27')},'dtmfmode':{'type':Sequelize[_0xab2f('0xf')](_0xab2f('0x28'),_0xab2f('0x29'),_0xab2f('0x2a'),_0xab2f('0x2b'),_0xab2f('0x2c')),'allowNull':!![],'defaultValue':_0xab2f('0x28')},'directmedia':{'type':Sequelize[_0xab2f('0xf')](_0xab2f('0x2d'),'no',_0xab2f('0x2e'),_0xab2f('0x2f'),_0xab2f('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xab2f('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![]},'nat':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![],'defaultValue':_0xab2f('0x31'),'set':function(_0x42eada){this[_0xab2f('0x5')](_0xab2f('0x32'),_0x42eada?_0x42eada[_0xab2f('0x26')](','):null);},'get':function(){return this[_0xab2f('0xb')](_0xab2f('0x32'))?this['getDataValue']('nat')[_0xab2f('0x33')](','):null;},'comment':_0xab2f('0x34')},'callgroup':{'type':Sequelize[_0xab2f('0xd')]},'namedcallgroup':{'type':Sequelize[_0xab2f('0xd')]},'pickupgroup':{'type':Sequelize[_0xab2f('0xd')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xab2f('0xd')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xab2f('0xd')]},'disallow':{'type':Sequelize[_0xab2f('0xd')],'allowNull':![],'defaultValue':_0xab2f('0x35')},'allow':{'type':Sequelize[_0xab2f('0xd')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x200db7){this['setDataValue'](_0xab2f('0x36'),_0x200db7?_0x200db7[_0xab2f('0x26')](';'):_0xab2f('0x37'));},'get':function(){return this[_0xab2f('0xb')]('allow')?this[_0xab2f('0xb')](_0xab2f('0x36'))[_0xab2f('0x33')](';'):null;},'comment':_0xab2f('0x38')},'autoframing':{'type':Sequelize[_0xab2f('0xf')](_0xab2f('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![],'set':function(_0x2a57a4){this[_0xab2f('0x5')](_0xab2f('0x39'),_0x2a57a4?_0x2a57a4['join'](','):null);},'get':function(){return this[_0xab2f('0xb')](_0xab2f('0x39'))?this[_0xab2f('0xb')]('insecure')['split'](','):null;},'comment':_0xab2f('0x3a')},'trustrpid':{'type':Sequelize['ENUM'](_0xab2f('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xab2f('0xf')](_0xab2f('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xab2f('0xf')](_0xab2f('0x2d'),'no',_0xab2f('0x3b')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xab2f('0xf')](_0xab2f('0x2d'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xab2f('0xf')](_0xab2f('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xab2f('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xab2f('0x3c')},'amaflags':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xab2f('0xf')](_0xab2f('0x2d'),'no'),'allowNull':!![],'defaultValue':_0xab2f('0x2d')},'busylevel':{'type':Sequelize[_0xab2f('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xab2f('0xf')](_0xab2f('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xab2f('0xf')](_0xab2f('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xab2f('0xf')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xab2f('0xf')](_0xab2f('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![]},'template':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0xab2f('0x2d'),'no',_0xab2f('0x3d')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xab2f('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xab2f('0xf')](_0xab2f('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xab2f('0xf')](_0xab2f('0x3e'),_0xab2f('0x3f'),_0xab2f('0x40')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xab2f('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xab2f('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xab2f('0xf')]('uac',_0xab2f('0x41')),'allowNull':!![],'defaultValue':_0xab2f('0x41')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xab2f('0xf')](_0xab2f('0x2d'),'no'),'allowNull':!![],'defaultValue':_0xab2f('0x2d')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xab2f('0xf')](_0xab2f('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xab2f('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xab2f('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xab2f('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xab2f('0xf')](_0xab2f('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xab2f('0xf')](_0xab2f('0x2d'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xab2f('0xf')](_0xab2f('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xab2f('0xf')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xab2f('0xf')](_0xab2f('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0xab2f('0x2d'),'no',_0xab2f('0x42'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xab2f('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xab2f('0xf')]('active','passive',_0xab2f('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xab2f('0xf')](_0xab2f('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xab2f('0xf')](_0xab2f('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xab2f('0xf')](_0xab2f('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xab2f('0xf')](_0xab2f('0x2d'),'no',_0xab2f('0x2e'),_0xab2f('0x2f'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xab2f('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xab2f('0xd')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0xab2f('0x44')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xab2f('0x45')]},'showWebBar':{'type':Sequelize[_0xab2f('0x14')],'defaultValue':0x0,'set':function(_0x3c1921){this[_0xab2f('0x5')](_0xab2f('0x46'),_0x3c1921);var _0x58b417=this['get']({'plain':!![]});switch(_0x3c1921){case 0x0:case 0x1:var _0x209855=_0x58b417[_0xab2f('0x25')]?_['isArray'](_0x58b417[_0xab2f('0x25')])?_0x58b417[_0xab2f('0x25')][_0xab2f('0x26')]():_0x58b417[_0xab2f('0x25')]:_0xab2f('0x24');if(_0x209855==='wss'){_0x209855='udp';}this[_0xab2f('0x5')](_0xab2f('0x25'),_0x209855);this[_0xab2f('0x5')](_0xab2f('0x47'),'no');this[_0xab2f('0x5')](_0xab2f('0x48'),null);this[_0xab2f('0x5')](_0xab2f('0x49'),null);this[_0xab2f('0x5')](_0xab2f('0x4a'),null);this['setDataValue']('dtlsenable',null);this[_0xab2f('0x5')](_0xab2f('0x4b'),null);this[_0xab2f('0x5')](_0xab2f('0x4c'),null);this[_0xab2f('0x5')](_0xab2f('0x4d'),null);this[_0xab2f('0x5')]('dtlsprivatekey',null);this[_0xab2f('0x5')](_0xab2f('0x4e'),'no');break;case 0x2:this[_0xab2f('0x5')]('transport',_0xab2f('0x4f'));this[_0xab2f('0x5')](_0xab2f('0x47'),'yes');this[_0xab2f('0x5')](_0xab2f('0x48'),'yes');this['setDataValue']('force_avp',_0xab2f('0x2d'));this[_0xab2f('0x5')]('icesupport',_0xab2f('0x2d'));this[_0xab2f('0x5')]('dtlsenable',_0xab2f('0x2d'));this[_0xab2f('0x5')](_0xab2f('0x4b'),'no');this[_0xab2f('0x5')](_0xab2f('0x4c'),_0xab2f('0x43'));this['setDataValue']('dtlscertfile',_0x58b417[_0xab2f('0x4d')]||_0xab2f('0x50'));this['setDataValue'](_0xab2f('0x51'),_0x58b417[_0xab2f('0x51')]||_0xab2f('0x52'));this[_0xab2f('0x5')](_0xab2f('0x4e'),_0xab2f('0x2d'));break;default:}}},'permissions':{'type':Sequelize[_0xab2f('0x45')],'set':function(_0x4f8354){this[_0xab2f('0x5')](_0xab2f('0x53'),_0x4f8354?_0x4f8354[_0xab2f('0x26')](','):[]);},'get':function(){return this['getDataValue'](_0xab2f('0x53'))?_[_0xab2f('0x54')](this[_0xab2f('0xb')](_0xab2f('0x53'))[_0xab2f('0x33')](','),function(_0x5061e1){return parseInt(_0x5061e1,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xab2f('0xd')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xab2f('0xd')]},'phoneBarBusyNumber':{'type':Sequelize[_0xab2f('0xd')]},'phoneBarUnconditional':{'type':Sequelize[_0xab2f('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xab2f('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xab2f('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xab2f('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xab2f('0xd')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xab2f('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xab2f('0xf')](_0xab2f('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xab2f('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xab2f('0xd')]},'phoneBarEnableJaws':{'type':Sequelize[_0xab2f('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xab2f('0xb')](_0xab2f('0x55'))?this[_0xab2f('0xb')](_0xab2f('0x55')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xab2f('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xab2f('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xab2f('0x17')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xab2f('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xab2f('0xd')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xab2f('0x17')],'defaultValue':![],'set':function(_0x3ca394){if(typeof _0x3ca394===_0xab2f('0x56')){var _0x4cccf0=_0x3ca394==='1'?!![]:_0x3ca394==='0'?![]:_0x3ca394==='true'?!![]:_0x3ca394===_0xab2f('0x57')?![]:![];this[_0xab2f('0x5')](_0xab2f('0x58'),_0x4cccf0);}else{this[_0xab2f('0x5')](_0xab2f('0x58'),_0x3ca394);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x40047f){this['setDataValue'](_0xab2f('0x59'),_0x40047f);if(_0x40047f===!![]){this[_0xab2f('0x5')](_0xab2f('0x5a'),moment());this[_0xab2f('0x5')](_0xab2f('0x5b'),0x0);}else{this[_0xab2f('0x5')](_0xab2f('0x5a'),null);}}},'blockedAt':{'type':Sequelize[_0xab2f('0x44')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xab2f('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xab2f('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xab2f('0x14')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xab2f('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xab2f('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xab2f('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xab2f('0x17')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 24e5893..5d77d3e 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 _0x869c=['includes','password','salt','where','query','includeAll','include','userSetting','UserSetting','attributes','findAll','rows','openTabs','true','length','push','chat','dataValues','sms','fax','openchannel','whatsapp','all','params','model','rawAttributes','keys','filters','intersection','fields','merge','mail','body','describe','addContacts','ids','internal','Setting','findById','securePassword','validatePasswordPattern','max','isNil','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','mailbox','VoiceMail','fullname','agent','permissions','102','103','113','110','104','106','107','108','109','100','111','114','115','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','each','compact','oldPassword','newPassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','ValidationError','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','spread','QueueId','emit','Queue:save','voice','get','format','SIP/%s','UserVoiceQueueRt','removeQueues','remove','isArray','Queue:remove','addAvatar','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','userpic','download','server/files/images/','getOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','getContacts','order','sort','pick','options','hasOwnProperty','List','color','tag','nolimit','getQueues','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','login','mobile','intrf','user:%s','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','forEach','getChannels','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','MemberReport','resolve','logout','QueuePause','pause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','whatsapppause','pauseType','lastPauseAt','manual','%s%s','Pause','getTeams','addTeams','omit','Team','Voice','getChatQueues','setDataValue','Chat','getMailQueues','Mail','getSmsQueues','Sms','getWhatsappQueues','getFaxQueues','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','getDataValue','upsert','UserVoicePrefix','VoicePrefixId','removeTeams','Whatsapp','Fax','sequelize','removeAgent','TeamVoicePrefix','getLists','CmList','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$gt','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$iLike','$notILike','$overlap','$contains','$contained','$any','firstName','lastName','phone','CmContact','Contact','dialActive','retrieveApiKey','json','No\x20API\x20access\x20key\x20found!','createApiKey','generateApiKey','iat','nonce','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','removeApiKey','apiKeyNonce','apiKeyIat','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','queues','isEmpty','teams','VoiceQueue','lower','asc','desc','substring','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','http','offline','idle','unknown','unavailable','ringing','voiceStatus','busy','slice','toUpperCase','select','InteractionId','ui.createdAt','user_has_','ui.UserId\x20=\x20?','toString','OpenTabs','moment','bluebird','util','path','lodash','squel','jayson/promise','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','register','defaults','localhost','client','request','then','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','update','destroy','admin','Users','user','Agents','Telephones','telephone','filter','ignore','map','value','role','find','name','UserProfileResource','send','index','User','type','key'];(function(_0x25035e,_0x3dcfe8){var _0x293a8c=function(_0x6bd425){while(--_0x6bd425){_0x25035e['push'](_0x25035e['shift']());}};_0x293a8c(++_0x3dcfe8);}(_0x869c,0x161));var _0xc869=function(_0x2ebc31,_0x336378){_0x2ebc31=_0x2ebc31-0x0;var _0x4a96ef=_0x869c[_0x2ebc31];return _0x4a96ef;};'use strict';var moment=require(_0xc869('0x0'));var BPromise=require(_0xc869('0x1'));var util=require(_0xc869('0x2'));var path=require(_0xc869('0x3'));var fs=require('fs');var _=require(_0xc869('0x4'));var squel=require(_0xc869('0x5'));var jayson=require(_0xc869('0x6'));var Redis=require(_0xc869('0x7'));var authService=require(_0xc869('0x8'));var qs=require(_0xc869('0x9'));var logger=require(_0xc869('0xa'))(_0xc869('0xb'));var utils=require(_0xc869('0xc'));var config=require(_0xc869('0xd'));var licenseUtil=require(_0xc869('0xe'));var db=require(_0xc869('0xf'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xc869('0x10')]));require('./user.socket')[_0xc869('0x11')](socket);config['redis']=_[_0xc869('0x12')](config['redis'],{'host':_0xc869('0x13'),'port':0x18eb});var client=jayson[_0xc869('0x14')]['http']({'port':0x232a});var values;function respondWithRpcPromise(_0x44213e,_0x2efecd,_0x3b49c8,_0x53e74d){return new BPromise(function(_0x355a63,_0x268d31){var _0x7b55ff=_0x53e74d||client;return _0x7b55ff[_0xc869('0x15')](_0x44213e,_0x3b49c8)[_0xc869('0x16')](function(_0x3f8930){logger[_0xc869('0x17')](_0xc869('0x18'),_0x2efecd,_0xc869('0x19'));logger['debug'](_0xc869('0x1a'),_0x2efecd,_0xc869('0x19'),JSON['stringify'](_0x3f8930));if(_0x3f8930[_0xc869('0x1b')]){if(_0x3f8930[_0xc869('0x1b')][_0xc869('0x1c')]===0x1f4){logger[_0xc869('0x1b')](_0xc869('0x18'),_0x2efecd,_0x3f8930[_0xc869('0x1b')]['message']);return _0x268d31(_0x3f8930[_0xc869('0x1b')][_0xc869('0x1d')]);}logger[_0xc869('0x1b')]('User,\x20%s,\x20%s',_0x2efecd,_0x3f8930[_0xc869('0x1b')][_0xc869('0x1d')]);return _0x355a63(_0x3f8930[_0xc869('0x1b')][_0xc869('0x1d')]);}else{logger[_0xc869('0x17')](_0xc869('0x18'),_0x2efecd,_0xc869('0x19'));_0x355a63(_0x3f8930['result'][_0xc869('0x1d')]);}})[_0xc869('0x1e')](function(_0x33c2f3){logger['error']('User,\x20%s,\x20%s',_0x2efecd,_0x33c2f3);_0x268d31(_0x33c2f3);});});}function respondWithStatusCode(_0xe9bfe7,_0x5a9354){_0x5a9354=_0x5a9354||0xcc;return function(_0x1dcd25){if(_0x1dcd25){return _0xe9bfe7[_0xc869('0x1f')](_0x5a9354);}return _0xe9bfe7[_0xc869('0x20')](_0x5a9354)[_0xc869('0x21')]();};}function respondWithResult(_0x54205e,_0x498167){_0x498167=_0x498167||0xc8;return function(_0x449af5){if(_0x449af5){return _0x54205e[_0xc869('0x20')](_0x498167)['json'](_0x449af5);}};}function respondWithFilteredResult(_0x4b09f4,_0x8deb50){return function(_0x16bfe4){if(_0x16bfe4){var _0x3af55a=typeof _0x8deb50[_0xc869('0x22')]===_0xc869('0x23')&&typeof _0x8deb50['limit']===_0xc869('0x23');var _0x599b3d=_0x16bfe4[_0xc869('0x24')];var _0x1913ba=_0x3af55a?0x0:_0x8deb50[_0xc869('0x22')];var _0x4be3a6=_0x3af55a?_0x16bfe4[_0xc869('0x24')]:_0x8deb50[_0xc869('0x22')]+_0x8deb50[_0xc869('0x25')];var _0x5ef84e;if(_0x4be3a6>=_0x599b3d){_0x4be3a6=_0x599b3d;_0x5ef84e=0xc8;}else{_0x5ef84e=0xce;}_0x4b09f4[_0xc869('0x20')](_0x5ef84e);return _0x4b09f4[_0xc869('0x26')](_0xc869('0x27'),_0x1913ba+'-'+_0x4be3a6+'/'+_0x599b3d)['json'](_0x16bfe4);}return null;};}function saveUpdates(_0x2efc87){return function(_0x218ca0){if(_0x218ca0){return _0x218ca0[_0xc869('0x28')](_0x2efc87)[_0xc869('0x16')](function(_0x24f218){return _0x24f218;});}return null;};}function removeEntity(_0x2794f3){return function(_0x4edcaf){if(_0x4edcaf){return _0x4edcaf[_0xc869('0x29')]()[_0xc869('0x16')](function(){var _0x41d077=_0x4edcaf['get']({'plain':!![]});if(_0x41d077['role']===_0xc869('0x2a'))return;var _0x497b36=[{'name':_0xc869('0x2b'),'value':_0xc869('0x2c'),'ignore':!![]},{'name':_0xc869('0x2d'),'value':'agent','ignore':![]},{'name':_0xc869('0x2e'),'value':_0xc869('0x2f'),'ignore':![]}];var _0x1ffdad=_(_0x497b36)[_0xc869('0x30')](_0xc869('0x31'))[_0xc869('0x32')](_0xc869('0x33'))['value']();if(_['includes'](_0x1ffdad,_0x41d077[_0xc869('0x34')])){return;}var _0x3a4a21=_[_0xc869('0x35')](_0x497b36,[_0xc869('0x33'),_0x41d077[_0xc869('0x34')]])[_0xc869('0x36')];return db[_0xc869('0x37')]['destroy']({'where':{'type':_0x3a4a21,'resourceId':_0x41d077['id']}})[_0xc869('0x16')](function(){return _0x4edcaf;});})[_0xc869('0x16')](function(){_0x2794f3['status'](0xcc)[_0xc869('0x21')]();});}};}function handleEntityNotFound(_0x3ed8b1){return function(_0x31a087){if(!_0x31a087){_0x3ed8b1['sendStatus'](0x194);}return _0x31a087;};}function handleError(_0x3f0ae8,_0x3b2792){_0x3b2792=_0x3b2792||0x1f4;return function(_0x339616){logger['error'](_0x339616['stack']);if(_0x339616[_0xc869('0x36')]){delete _0x339616['name'];}_0x3f0ae8[_0xc869('0x20')](_0x3b2792)[_0xc869('0x38')](_0x339616);};}exports[_0xc869('0x39')]=function(_0x4a905b,_0x178c09){var _0x5b579e={},_0x521ef4={'count':0x0,'rows':[]};var _0x5bb2b0=_(db[_0xc869('0x3a')]['rawAttributes'])['map'](function(_0x5bc710){return{'name':_0x5bc710['fieldName'],'type':_0x5bc710[_0xc869('0x3b')][_0xc869('0x3c')]};})[_0xc869('0x30')](function(_0x53b6d8){return!_[_0xc869('0x3d')]([_0xc869('0x3e'),_0xc869('0x3f')],_0x53b6d8[_0xc869('0x36')]);})[_0xc869('0x33')]();_0x5b579e=qs['getOptions'](_0x5bb2b0,_0x4a905b);var _0x302033={'where':_0x5b579e[_0xc869('0x40')]};return db[_0xc869('0x3a')]['count'](_0x302033)[_0xc869('0x16')](function(_0x4ea66b){_0x521ef4[_0xc869('0x24')]=_0x4ea66b;if(_0x4a905b[_0xc869('0x41')][_0xc869('0x42')]){_0x5b579e[_0xc869('0x43')]=[{'all':!![]}];}if(_0x4a905b[_0xc869('0x41')][_0xc869('0x44')]==='true'){_0x5b579e[_0xc869('0x43')]=[{'model':db[_0xc869('0x45')],'as':_0xc869('0x44')}];}if(!_[_0xc869('0x3d')](_0x5b579e[_0xc869('0x46')],'id')){_0x5b579e[_0xc869('0x46')]['push']('id');}return db[_0xc869('0x3a')][_0xc869('0x47')](_0x5b579e);})['then'](function(_0x3b5d25){_0x521ef4[_0xc869('0x48')]=_0x3b5d25;if(_0x4a905b[_0xc869('0x41')][_0xc869('0x49')]===_0xc869('0x4a')){var _0x3254b7=[];for(var _0x515f67=0x0;_0x515f67<_0x521ef4[_0xc869('0x48')][_0xc869('0x4b')];_0x515f67++){_0x3254b7[_0xc869('0x4c')](get_open_tabs(_0xc869('0x4d'),_0x521ef4[_0xc869('0x48')][_0x515f67][_0xc869('0x4e')]));_0x3254b7['push'](get_open_tabs(_0xc869('0x4f'),_0x521ef4['rows'][_0x515f67][_0xc869('0x4e')]));_0x3254b7[_0xc869('0x4c')](get_open_tabs(_0xc869('0x50'),_0x521ef4['rows'][_0x515f67]['dataValues']));_0x3254b7['push'](get_open_tabs('mail',_0x521ef4[_0xc869('0x48')][_0x515f67][_0xc869('0x4e')]));_0x3254b7[_0xc869('0x4c')](get_open_tabs(_0xc869('0x51'),_0x521ef4[_0xc869('0x48')][_0x515f67][_0xc869('0x4e')]));_0x3254b7[_0xc869('0x4c')](get_open_tabs(_0xc869('0x52'),_0x521ef4[_0xc869('0x48')][_0x515f67][_0xc869('0x4e')]));}return BPromise[_0xc869('0x53')](_0x3254b7)[_0xc869('0x16')](function(){return _0x521ef4;});}else{return _0x521ef4;}})[_0xc869('0x16')](respondWithFilteredResult(_0x178c09,_0x5b579e))[_0xc869('0x1e')](handleError(_0x178c09,null));};exports['show']=function(_0x41efd6,_0x4837ac){var _0x223f73={'raw':![],'where':{'id':_0x41efd6[_0xc869('0x54')]['id']}},_0x31bd4b={};_0x31bd4b[_0xc869('0x55')]=_['differenceBy'](_['keys'](db[_0xc869('0x3a')][_0xc869('0x56')]),[_0xc869('0x3e'),_0xc869('0x3f')]);_0x31bd4b[_0xc869('0x41')]=_[_0xc869('0x57')](_0x41efd6[_0xc869('0x41')]);_0x31bd4b[_0xc869('0x58')]=_[_0xc869('0x59')](_0x31bd4b[_0xc869('0x55')],_0x31bd4b[_0xc869('0x41')]);_0x223f73['attributes']=_[_0xc869('0x59')](_0x31bd4b[_0xc869('0x55')],qs[_0xc869('0x5a')](_0x41efd6['query'][_0xc869('0x5a')]));_0x223f73[_0xc869('0x46')]=_0x223f73[_0xc869('0x46')][_0xc869('0x4b')]?_0x223f73['attributes']:_0x31bd4b[_0xc869('0x55')];if(_0x41efd6[_0xc869('0x41')]['includeAll']){_0x223f73[_0xc869('0x43')]=[{'all':!![]}];}if(_0x41efd6[_0xc869('0x41')][_0xc869('0x44')]==='true'){_0x223f73[_0xc869('0x43')]=[{'model':db[_0xc869('0x45')],'as':_0xc869('0x44')}];}_0x223f73=_[_0xc869('0x5b')]({},_0x223f73,_0x41efd6['options']);if(!_[_0xc869('0x3d')](_0x223f73[_0xc869('0x46')],'id')){_0x223f73[_0xc869('0x46')][_0xc869('0x4c')]('id');}return db['User'][_0xc869('0x35')](_0x223f73)[_0xc869('0x16')](handleEntityNotFound(_0x4837ac,null))['then'](function(_0x1d8459){var _0x1b01ca=[];values=_0x1d8459;if(_0x41efd6[_0xc869('0x41')][_0xc869('0x49')]===_0xc869('0x4a')){_0x1b01ca['push'](get_open_tabs(_0xc869('0x4d'),_0x1d8459['dataValues']));_0x1b01ca[_0xc869('0x4c')](get_open_tabs(_0xc869('0x4f'),_0x1d8459['dataValues']));_0x1b01ca['push'](get_open_tabs(_0xc869('0x51'),_0x1d8459[_0xc869('0x4e')]));_0x1b01ca[_0xc869('0x4c')](get_open_tabs(_0xc869('0x52'),_0x1d8459['dataValues']));_0x1b01ca[_0xc869('0x4c')](get_open_tabs(_0xc869('0x50'),_0x1d8459[_0xc869('0x4e')]));_0x1b01ca[_0xc869('0x4c')](get_open_tabs(_0xc869('0x5c'),_0x1d8459[_0xc869('0x4e')]));return BPromise[_0xc869('0x53')](_0x1b01ca);}else{return values;}})['then'](function(){return values;})[_0xc869('0x16')](respondWithResult(_0x4837ac,null))['catch'](handleError(_0x4837ac,null));};exports[_0xc869('0x28')]=function(_0x460889,_0x2a7270){if(_0x460889['body']['id']){delete _0x460889['body']['id'];}delete _0x460889[_0xc869('0x5d')][_0xc869('0x34')];return db[_0xc869('0x3a')][_0xc869('0x35')]({'where':{'id':_0x460889[_0xc869('0x54')]['id']}})[_0xc869('0x16')](handleEntityNotFound(_0x2a7270,null))[_0xc869('0x16')](saveUpdates(_0x460889[_0xc869('0x5d')],null))['then'](respondWithResult(_0x2a7270,null))[_0xc869('0x1e')](handleError(_0x2a7270,null));};exports['describe']=function(_0x3ee668,_0x45d7e6){return db[_0xc869('0x3a')][_0xc869('0x5e')]()[_0xc869('0x16')](respondWithResult(_0x45d7e6,null))[_0xc869('0x1e')](handleError(_0x45d7e6,null));};exports['addContacts']=function(_0xc7b4dd,_0x4ff6d4){return db[_0xc869('0x3a')][_0xc869('0x35')]({'where':{'id':_0xc7b4dd[_0xc869('0x54')]['id']}})['then'](handleEntityNotFound(_0x4ff6d4,null))[_0xc869('0x16')](function(_0x17b4d1){if(_0x17b4d1){return _0x17b4d1[_0xc869('0x5f')](_0xc7b4dd[_0xc869('0x5d')][_0xc869('0x60')],_['omit'](_0xc7b4dd[_0xc869('0x5d')],[_0xc869('0x60'),'id'])||{});}})[_0xc869('0x16')](respondWithResult(_0x4ff6d4,null))[_0xc869('0x1e')](handleError(_0x4ff6d4,null));};function validateUser(_0x5dfc91){return new BPromise(function(_0x26d04e,_0x4f632c){if(_0x5dfc91[_0xc869('0x61')])return _0x26d04e(_0x5dfc91);return db[_0xc869('0x62')][_0xc869('0x63')](0x1)[_0xc869('0x16')](function(_0x4f17ee){if(_0x4f17ee[_0xc869('0x64')])authService[_0xc869('0x65')](_0x5dfc91[_0xc869('0x3e')]);db[_0xc869('0x3a')][_0xc869('0x66')](_0xc869('0x61'))[_0xc869('0x16')](function(_0x487aca){if(_[_0xc869('0x67')](_0x487aca)){_0x5dfc91[_0xc869('0x61')]=_0x4f17ee[_0xc869('0x68')]||0x1;return;}if(_[_0xc869('0x67')](_0x4f17ee[_0xc869('0x68')])||_0x4f17ee[_0xc869('0x68')]===_0x487aca){_0x5dfc91[_0xc869('0x61')]=_0x487aca+0x1;return;}if(_0x4f17ee['min_internal']>_0x487aca){_0x5dfc91[_0xc869('0x61')]=_0x4f17ee[_0xc869('0x68')];return;}return db['sequelize'][_0xc869('0x41')](_0xc869('0x69'),{'type':db['sequelize'][_0xc869('0x6a')][_0xc869('0x6b')]})[_0xc869('0x16')](function(_0xc665b8){if(_0xc665b8&&_0xc665b8[_0xc869('0x4b')]){for(var _0x1245bc=0x0,_0x3dc95a=_0xc665b8[_0xc869('0x4b')];_0x1245bc<_0x3dc95a&&_[_0xc869('0x67')](_0x5dfc91['internal']);_0x1245bc++){if(_0x4f17ee['min_internal']<=_0xc665b8[_0x1245bc][_0xc869('0x6c')]){_0x5dfc91[_0xc869('0x61')]=_0xc665b8[_0x1245bc]['from'];}else if(_0x4f17ee['min_internal']>_0xc665b8[_0x1245bc]['from']&&_0x4f17ee[_0xc869('0x68')]<=_0xc665b8[_0x1245bc]['to']){_0x5dfc91[_0xc869('0x61')]=_0x4f17ee[_0xc869('0x68')];}}}if(_[_0xc869('0x67')](_0x5dfc91['internal'])){_0x5dfc91[_0xc869('0x61')]=_0x487aca+0x1;}return _0x26d04e(_0x5dfc91);});});})[_0xc869('0x1e')](function(_0x3d437e){_0x4f632c(_0x3d437e);});});}function updateUser(_0x225772){return new BPromise(function(_0xd03c26,_0x4e5c82){try{if(_0x225772['voicemail']){_0x225772[_0xc869('0x6d')]=_0x225772[_0xc869('0x61')];_0x225772[_0xc869('0x6e')]={'mailbox':_0x225772[_0xc869('0x61')],'password':_0x225772[_0xc869('0x3e')],'fullname':_0x225772[_0xc869('0x6f')],'email':_0x225772['email']};}if(_0x225772[_0xc869('0x34')]===_0xc869('0x70')){if(!_0x225772[_0xc869('0x71')])_0x225772[_0xc869('0x71')]=['101',_0xc869('0x72'),_0xc869('0x73'),_0xc869('0x74'),_0xc869('0x75'),_0xc869('0x76'),'105',_0xc869('0x77'),_0xc869('0x78'),_0xc869('0x79'),_0xc869('0x7a'),_0xc869('0x7b'),_0xc869('0x7c'),_0xc869('0x7d'),_0xc869('0x7e')];}_0xd03c26(_0x225772);}catch(_0x23ed48){_0x4e5c82(_0x23ed48);}});}exports[_0xc869('0x7f')]=function(_0x5aa282,_0x5b20d5){if(_0x5aa282[_0xc869('0x2c')][_0xc869('0x34')]===_0xc869('0x70'))throw new Error(_0xc869('0x80'));if(_0x5aa282[_0xc869('0x5d')][_0xc869('0x34')]===_0xc869('0x2c')&&_0x5aa282[_0xc869('0x2c')][_0xc869('0x34')]!==_0xc869('0x2a')){throw new Error(_0xc869('0x81'));}if(_0x5aa282['body'][_0xc869('0x34')]===_0xc869('0x2a')&&_0x5aa282[_0xc869('0x2c')]['role']!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0xc869('0x82')]([_0x5aa282[_0xc869('0x5d')]])['then'](function(){return validateUser(_0x5aa282[_0xc869('0x5d')]);})[_0xc869('0x16')](function(_0x31c382){return updateUser(_0x31c382)[_0xc869('0x16')](function(_0x36f295){if(_0x36f295[_0xc869('0x34')]===_0xc869('0x2a')){_0x36f295[_0xc869('0x83')]=_0x5aa282[_0xc869('0x2c')][_0xc869('0x83')];delete _0x36f295[_0xc869('0x84')];}return _0x36f295;});})['then'](function(_0x12f80b){return db[_0xc869('0x3a')][_0xc869('0x7f')](_0x12f80b,{'include':[{'model':db[_0xc869('0x6e')],'as':_0xc869('0x6e')}]});})[_0xc869('0x16')](function(_0x573310){if(_0x5aa282[_0xc869('0x5d')]['role']===_0xc869('0x2c'))return _0x573310;if(_0x5aa282[_0xc869('0x2c')][_0xc869('0x34')]!==_0xc869('0x2c'))return _0x573310;return db[_0xc869('0x85')][_0xc869('0x35')]({'where':{'name':_0x573310[_0xc869('0x34')]===_0xc869('0x70')?_0xc869('0x2d'):_0xc869('0x2e'),'userProfileId':_0x5aa282[_0xc869('0x2c')][_0xc869('0x84')]},'raw':!![]})[_0xc869('0x16')](function(_0x41aeac){if(!_0x41aeac||_0x41aeac[_0xc869('0x86')]!=0x0)return _0x573310;return db[_0xc869('0x37')]['create']({'name':_0x573310[_0xc869('0x36')],'resourceId':_0x573310['id'],'type':_0x41aeac[_0xc869('0x36')],'sectionId':_0x41aeac['id']},{})[_0xc869('0x16')](function(){return _0x573310;});})['catch'](function(_0x2f0ad3){logger[_0xc869('0x1b')](_0xc869('0x87'),_0x2f0ad3);throw _0x2f0ad3;});})[_0xc869('0x16')](respondWithResult(_0x5b20d5,0xc9))[_0xc869('0x1e')](handleError(_0x5b20d5,null));};exports[_0xc869('0x88')]=function(_0x4beab1,_0x455f47){var _0x56bd32=_0x4beab1[_0xc869('0x5d')];var _0x107708=[];if(_0x4beab1['user'][_0xc869('0x34')]==='agent')throw new Error(_0xc869('0x80'));if(_[_0xc869('0x89')](_0x56bd32,[_0xc869('0x34'),_0xc869('0x2c')])&&_0x4beab1[_0xc869('0x2c')]['role']!==_0xc869('0x2a')){throw new Error(_0xc869('0x81'));}if(_[_0xc869('0x89')](_0x56bd32,[_0xc869('0x34'),_0xc869('0x2a')])&&_0x4beab1[_0xc869('0x2c')][_0xc869('0x34')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0xc869('0x82')](_0x56bd32)[_0xc869('0x16')](function(){return validateUser(_0x56bd32[0x0]);})[_0xc869('0x16')](function(){for(var _0x26b078=0x1;_0x26b078<_0x56bd32[_0xc869('0x4b')];_0x26b078++){var _0x229a58=_0x56bd32[_0x26b078-0x1]['internal'];if(!_0x56bd32[_0x26b078][_0xc869('0x61')])_0x56bd32[_0x26b078][_0xc869('0x61')]=_0x229a58+0x1;_0x107708[_0xc869('0x4c')](validateUser(_0x56bd32[_0x26b078]));}return BPromise['all'](_0x107708);})[_0xc869('0x16')](function(){_0x107708=[];for(var _0x32b10d=0x0;_0x32b10d<_0x56bd32[_0xc869('0x4b')];_0x32b10d++){_0x107708[_0xc869('0x4c')](updateUser(_0x56bd32[_0x32b10d]));}return BPromise[_0xc869('0x53')](_0x107708);})[_0xc869('0x16')](function(){return BPromise[_0xc869('0x8a')](_0x56bd32,function(_0x7e0537){return db[_0xc869('0x3a')]['create'](_0x7e0537,{'include':[{'model':db[_0xc869('0x6e')],'as':'VoiceMail'}]})[_0xc869('0x16')](function(_0x58e0e8){_0x7e0537['id']=_0x58e0e8['id'];return _0x7e0537;});});})[_0xc869('0x16')](function(_0x247568){if(_0x4beab1[_0xc869('0x5d')][_0xc869('0x34')]===_0xc869('0x2c'))return _0x247568;if(_0x4beab1[_0xc869('0x2c')][_0xc869('0x34')]!=='user')return _0x247568;var _0x484ec7=_['some'](_0x247568,function(_0x5c1f2f){return _0x5c1f2f[_0xc869('0x34')]===_0xc869('0x70')||_0x5c1f2f['role']==='telephone';});if(!_0x484ec7)return _0x247568;return db[_0xc869('0x85')]['findAll']({'where':{'name':{'$or':[_0xc869('0x2d'),_0xc869('0x2e')]},'userProfileId':_0x4beab1[_0xc869('0x2c')][_0xc869('0x84')]},'raw':!![]})[_0xc869('0x16')](function(_0x5155f4){if(_['isEmpty'](_0x5155f4)||!_[_0xc869('0x89')](_0x5155f4,[_0xc869('0x86'),0x0]))return _0x247568;_0x107708=[];var _0x1f886c=_(_0x5155f4)[_0xc869('0x32')](function(_0x4466ab){if(_0x4466ab['autoAssociation']===0x1)return;return _0x4466ab[_0xc869('0x36')]===_0xc869('0x2d')?'agent':'telephone';})[_0xc869('0x8b')]()[_0xc869('0x33')]();for(var _0x5a5624=0x0;_0x5a5624<_0x247568[_0xc869('0x4b')];_0x5a5624++){if(!_['includes'](_0x1f886c,_0x247568[_0x5a5624][_0xc869('0x34')]))return;var _0x1fbfc9=_0x247568[_0x5a5624]['role']===_0xc869('0x70')?_0xc869('0x2d'):_0xc869('0x2e');_0x107708[_0xc869('0x4c')](db[_0xc869('0x37')][_0xc869('0x7f')]({'name':_0x247568[_0x5a5624]['name'],'resourceId':_0x247568[_0x5a5624]['id'],'type':_0x1fbfc9,'sectionId':_['find'](_0x5155f4,[_0xc869('0x36'),_0x1fbfc9])['id']},{}));}return BPromise[_0xc869('0x53')](_0x107708);});})[_0xc869('0x16')](respondWithResult(_0x455f47,0xc9))['catch'](handleError(_0x455f47,null));};exports['changePassword']=function(_0x1bceda,_0x369730){if(_0x1bceda[_0xc869('0x5d')]['id']){delete _0x1bceda['body']['id'];}return db[_0xc869('0x3a')][_0xc869('0x35')]({'where':{'id':_0x1bceda[_0xc869('0x54')]['id']}})[_0xc869('0x16')](function(_0x5f3ec2){if(!_0x5f3ec2)return null;if(_0x5f3ec2['id']===_0x1bceda[_0xc869('0x2c')]['id']){if(!_0x1bceda[_0xc869('0x5d')][_0xc869('0x8c')]||!_0x1bceda[_0xc869('0x5d')][_0xc869('0x8d')]){throw new db[(_0xc869('0x8e'))]['ValidationError'](_0xc869('0x8f'));}if(!_0x5f3ec2['authenticate'](_0x1bceda[_0xc869('0x5d')][_0xc869('0x8c')])){throw new db['Sequelize'][(_0xc869('0x90'))](_0xc869('0x91'));}if(_0x1bceda[_0xc869('0x5d')][_0xc869('0x8c')]===_0x1bceda[_0xc869('0x5d')][_0xc869('0x8d')]){throw new db['Sequelize']['ValidationError'](_0xc869('0x92'));}}else if(_0x1bceda['user']['role']===_0xc869('0x2a')){if(!_0x1bceda[_0xc869('0x5d')][_0xc869('0x8d')]){throw new db[(_0xc869('0x8e'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x1bceda[_0xc869('0x2c')]['role']===_0xc869('0x2c')){if(!_0x1bceda[_0xc869('0x5d')]['newPassword']){throw new db['Sequelize'][(_0xc869('0x90'))](_0xc869('0x93'));}if(_0x5f3ec2[_0xc869('0x34')]!==_0xc869('0x70')){throw new db[(_0xc869('0x8e'))][(_0xc869('0x90'))](_0xc869('0x80'));}}else{throw new db[(_0xc869('0x8e'))][(_0xc869('0x90'))](_0xc869('0x80'));}return _0x5f3ec2;})['then'](handleEntityNotFound(_0x369730,null))[_0xc869('0x16')](function(_0x7ead4f){return db[_0xc869('0x62')][_0xc869('0x94')]({'attributes':['id',_0xc869('0x64'),_0xc869('0x95'),_0xc869('0x96')]})['then'](function(_0x2b4c7f){if(_0x2b4c7f[_0xc869('0x64')])authService[_0xc869('0x65')](_0x1bceda[_0xc869('0x5d')]['newPassword']);if(!_0x2b4c7f[_0xc869('0x95')]||!_0x7ead4f[_0xc869('0x97')])return _0x7ead4f;authService[_0xc869('0x98')](_0x1bceda[_0xc869('0x5d')][_0xc869('0x8d')],_0x7ead4f[_0xc869('0x97')],_0x2b4c7f[_0xc869('0x96')]);return _0x7ead4f;})[_0xc869('0x16')](saveUpdates({'password':_0x1bceda[_0xc869('0x5d')][_0xc869('0x8d')],'passwordResetAt':_0x1bceda[_0xc869('0x2c')]['id']==_0x1bceda[_0xc869('0x54')]['id']?moment():null,'previousPasswords':authService[_0xc869('0x99')](_0x1bceda['body'][_0xc869('0x8d')],_0x7ead4f[_0xc869('0x97')])},null));})['then'](respondWithResult(_0x369730,null))[_0xc869('0x1e')](handleError(_0x369730,null));};exports[_0xc869('0x9a')]=function(_0x37e652,_0x622e3e){var _0x28af96=_0x37e652[_0xc869('0x5d')][_0xc869('0x9b')];return db['User']['find']({'where':{'id':_0x37e652[_0xc869('0x54')]['id']},'attributes':['id',_0xc869('0x36'),_0xc869('0x34'),_0xc869('0x9c'),_0xc869('0x9d'),_0xc869('0x9e'),_0xc869('0x9f')]})[_0xc869('0x16')](handleEntityNotFound(_0x622e3e,null))[_0xc869('0x16')](function(_0x3a6c3c){if(_0x3a6c3c){if(!utils[_0xc869('0xa0')](_0x28af96)){throw new db[(_0xc869('0x8e'))][(_0xc869('0x90'))](_0xc869('0xa1'));}return _0x3a6c3c[_0xc869('0xa2')+_[_0xc869('0xa3')](_0x28af96[_0xc869('0xa4')]())+_0xc869('0xa5')](_0x37e652[_0xc869('0x5d')]['ids'],{'penalty':_0x37e652['body'][_0xc869('0xa6')]||0x0})[_0xc869('0xa7')](function(_0x4587ca){for(var _0x35fdca=0x0;_0x35fdca<_0x37e652['body'][_0xc869('0x60')][_0xc869('0x4b')];_0x35fdca+=0x1){var _0x1fc3d4={'UserId':Number(_0x37e652[_0xc869('0x54')]['id'])};_0x1fc3d4[_[_0xc869('0xa3')](_0x28af96['toLowerCase']())+_0xc869('0xa8')]=Number(_0x37e652[_0xc869('0x5d')][_0xc869('0x60')][_0x35fdca]);socket[_0xc869('0xa9')](_0xc869('0x2c')+_[_0xc869('0xa3')](_0x28af96[_0xc869('0xa4')]())+_0xc869('0xaa'),_0x1fc3d4);}return _0x4587ca;})[_0xc869('0x16')](function(){if(_0x28af96===_0xc869('0xab')){return db['VoiceQueue']['findAll']({'where':{'id':_0x37e652[_0xc869('0x5d')][_0xc869('0x60')]||[]},'raw':!![],'attributes':['id',_0xc869('0x36')]});}})[_0xc869('0x16')](function(_0x1d45c1){var _0xf676fb=_0x3a6c3c[_0xc869('0xac')]({'plain':!![]});var _0x3b0e47=[];if(_0x28af96===_0xc869('0xab')&&_0xf676fb[_0xc869('0x34')]===_0xc869('0x70')&&_0xf676fb['online']){for(var _0x1c688b=0x0;_0x1c688b<_0x1d45c1[_0xc869('0x4b')];_0x1c688b+=0x1){_0x3b0e47[_0xc869('0x4c')]({'membername':_0xf676fb[_0xc869('0x36')],'UserId':_0xf676fb['id'],'queue_name':_0x1d45c1[_0x1c688b]['name'],'VoiceQueueId':_0x1d45c1[_0x1c688b]['id'],'interface':_['isNil'](_0xf676fb['interface'])?util[_0xc869('0xad')](_0xc869('0xae'),_0xf676fb[_0xc869('0x36')]):_0xf676fb['interface'],'paused':_0xf676fb[_0xc869('0x9e')]||![],'penalty':_0x37e652[_0xc869('0x5d')][_0xc869('0xa6')]||0x0});}return BPromise[_0xc869('0x8a')](_0x3b0e47,function(_0x17ce9e){return db[_0xc869('0xaf')]['upsert'](_0x17ce9e);});}return _0x3a6c3c;});}})[_0xc869('0x16')](respondWithStatusCode(_0x622e3e,null))['catch'](handleError(_0x622e3e,null));};exports[_0xc869('0xb0')]=function(_0x3b241c,_0x409b95){var _0x543202,_0x46f951;return db[_0xc869('0x3a')][_0xc869('0x35')]({'where':{'id':_0x3b241c[_0xc869('0x54')]['id']},'attributes':['id',_0xc869('0x36'),_0xc869('0x34')]})['then'](handleEntityNotFound(_0x409b95,null))[_0xc869('0x16')](function(_0x35e725){if(_0x35e725){_0x543202=_0x35e725;if(!_0x3b241c[_0xc869('0x41')]['channel']||!utils['isValidChannel'](_0x3b241c[_0xc869('0x41')][_0xc869('0x9b')])){throw new db[(_0xc869('0x8e'))][(_0xc869('0x90'))]('Unknown\x20channel');}return _0x35e725[_0xc869('0xb1')+_[_0xc869('0xa3')](_0x3b241c[_0xc869('0x41')][_0xc869('0x9b')][_0xc869('0xa4')]())+_0xc869('0xa5')](_0x3b241c[_0xc869('0x41')][_0xc869('0x60')]);}})[_0xc869('0x16')](function(_0x32cd7e){if(_[_0xc869('0xb2')](_0x3b241c[_0xc869('0x41')]['ids'])){for(var _0x128bdb=0x0;_0x128bdb<_0x3b241c['query'][_0xc869('0x60')]['length'];_0x128bdb+=0x1){_0x46f951={'UserId':Number(_0x3b241c[_0xc869('0x54')]['id'])};_0x46f951[_['capitalize'](_0x3b241c[_0xc869('0x41')]['channel'][_0xc869('0xa4')]())+'QueueId']=Number(_0x3b241c[_0xc869('0x41')]['ids'][_0x128bdb]);socket[_0xc869('0xa9')]('user'+_[_0xc869('0xa3')](_0x3b241c[_0xc869('0x41')][_0xc869('0x9b')]['toLowerCase']())+_0xc869('0xb3'),_0x46f951);}}else{_0x46f951={'UserId':Number(_0x3b241c[_0xc869('0x54')]['id'])};_0x46f951[_[_0xc869('0xa3')](_0x3b241c[_0xc869('0x41')][_0xc869('0x9b')][_0xc869('0xa4')]())+_0xc869('0xa8')]=Number(_0x3b241c['query']['ids']);socket['emit']('user'+_[_0xc869('0xa3')](_0x3b241c[_0xc869('0x41')][_0xc869('0x9b')]['toLowerCase']())+'Queue:remove',_0x46f951);}return _0x32cd7e;})[_0xc869('0x16')](function(){if(_0x3b241c[_0xc869('0x41')][_0xc869('0x9b')]===_0xc869('0xab')){return db[_0xc869('0xaf')][_0xc869('0x29')]({'where':{'UserId':_0x3b241c[_0xc869('0x54')]['id'],'VoiceQueueId':_0x3b241c['query'][_0xc869('0x60')]},'individualHooks':!![]})['then'](function(){return _0x543202;});}return _0x543202;})['then'](respondWithStatusCode(_0x409b95,null))[_0xc869('0x1e')](handleError(_0x409b95,null));};exports[_0xc869('0xb4')]=function(_0x49b086,_0x330052){_0x49b086[_0xc869('0x5d')]['userpic']=_0x49b086[_0xc869('0xb5')][_0xc869('0xb6')];return db[_0xc869('0x3a')]['find']({'where':{'id':_0x49b086['params']['id']}})[_0xc869('0x16')](handleEntityNotFound(_0x330052,null))[_0xc869('0x16')](saveUpdates(_0x49b086['body'],null))[_0xc869('0x16')](respondWithResult(_0x330052,null))['catch'](handleError(_0x330052,null));};exports[_0xc869('0xb7')]=function(_0xb407e4,_0x8d6fb2){var _0x544ab3=path[_0xc869('0xb8')](config[_0xc869('0xb9')],_0xc869('0xba'));return db[_0xc869('0x3a')]['find']({'where':{'id':_0xb407e4[_0xc869('0x54')]['id']},'attributes':['id',_0xc869('0xbb')],'raw':!![]})[_0xc869('0x16')](handleEntityNotFound(_0x8d6fb2,null))[_0xc869('0x16')](function(_0x305ff8){if(_0x305ff8){if(_[_0xc869('0x67')](_0x305ff8['userpic'])){return _0x8d6fb2[_0xc869('0xbc')](_0x544ab3);}else{if(!fs['existsSync'](path['join'](config[_0xc869('0xb9')],_0xc869('0xbd'),_0x305ff8['userpic']))){return _0x8d6fb2[_0xc869('0xbc')](_0x544ab3);}return _0x8d6fb2[_0xc869('0xbc')](path[_0xc869('0xb8')](config[_0xc869('0xb9')],'server/files/images/',_0x305ff8[_0xc869('0xbb')]));}}})[_0xc869('0x1e')](handleError(_0x8d6fb2,null));};exports[_0xc869('0xbe')]=function(_0x370a78,_0x149e45){return db[_0xc869('0x3a')][_0xc869('0x35')]({'where':{'id':_0x370a78['params']['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x149e45,null))['then'](function(_0x7f5aa4){var _0x25f741=[];values=_0x7f5aa4[_0xc869('0x4e')];_0x25f741['push'](get_open_tabs(_0xc869('0x4d'),_0x7f5aa4[_0xc869('0x4e')]));_0x25f741[_0xc869('0x4c')](get_open_tabs(_0xc869('0x4f'),_0x7f5aa4[_0xc869('0x4e')]));_0x25f741[_0xc869('0x4c')](get_open_tabs(_0xc869('0x51'),_0x7f5aa4['dataValues']));_0x25f741[_0xc869('0x4c')](get_open_tabs(_0xc869('0x52'),_0x7f5aa4[_0xc869('0x4e')]));_0x25f741[_0xc869('0x4c')](get_open_tabs(_0xc869('0x50'),_0x7f5aa4[_0xc869('0x4e')]));_0x25f741[_0xc869('0x4c')](get_open_tabs(_0xc869('0x5c'),_0x7f5aa4[_0xc869('0x4e')]));return BPromise[_0xc869('0x53')](_0x25f741);})[_0xc869('0x16')](function(_0x1ce39f){if(_0x1ce39f){var _0x5648d9=_[_0xc869('0x32')](values['ChatOpenTabs'],function(_0x98e593){return{'channel':_0xc869('0xbf'),'id':_0x98e593['id'],'createdAt':_0x98e593[_0xc869('0xc0')]};});var _0x1a8889=_['map'](values[_0xc869('0xc1')],function(_0x459f41){return{'channel':_0xc869('0xc2'),'id':_0x459f41['id'],'createdAt':_0x459f41[_0xc869('0xc0')]};});var _0x2c4d7c=_['map'](values['OpenchannelOpenTabs'],function(_0x564cf9){return{'channel':_0xc869('0xc3'),'id':_0x564cf9['id'],'createdAt':_0x564cf9[_0xc869('0xc0')]};});var _0x35a332=_[_0xc869('0x32')](values[_0xc869('0xc4')],function(_0x3bfbb8){return{'channel':_0xc869('0xc5'),'id':_0x3bfbb8['id'],'createdAt':_0x3bfbb8[_0xc869('0xc0')]};});var _0x57209b=_[_0xc869('0x32')](values[_0xc869('0xc6')],function(_0x5a8eaa){return{'channel':_0xc869('0xc7'),'id':_0x5a8eaa['id'],'createdAt':_0x5a8eaa['createdAt']};});var _0x332d78=_[_0xc869('0x32')](values[_0xc869('0xc8')],function(_0xcbad41){return{'channel':'WHATSAPP','id':_0xcbad41['id'],'createdAt':_0xcbad41[_0xc869('0xc0')]};});var _0x5c4094=_['concat'](_0x5648d9,_0x1a8889,_0x2c4d7c,_0x35a332,_0x57209b,_0x332d78);var _0x4c38e7={'count':_0x5c4094[_0xc869('0x4b')],'rows':_0x5c4094};return _0x4c38e7;}else return null;})[_0xc869('0x16')](respondWithResult(_0x149e45,null))[_0xc869('0x1e')](handleError(_0x149e45,null));};exports[_0xc869('0xc9')]=function(_0x246f3d,_0xeeaa27){var _0x3aac76={};var _0x4af103={};var _0x2d5684;var _0x4354d4;return db['User'][_0xc869('0x94')]({'where':{'id':_0x246f3d[_0xc869('0x54')]['id']}})[_0xc869('0x16')](handleEntityNotFound(_0xeeaa27,null))[_0xc869('0x16')](function(_0x2b802f){if(_0x2b802f){_0x2d5684=_0x2b802f;_0x4af103[_0xc869('0x55')]=_[_0xc869('0x57')](db['CmContact'][_0xc869('0x56')]);_0x4af103['query']=_[_0xc869('0x57')](_0x246f3d[_0xc869('0x41')]);_0x4af103[_0xc869('0x58')]=_[_0xc869('0x59')](_0x4af103[_0xc869('0x55')],_0x4af103[_0xc869('0x41')]);_0x3aac76[_0xc869('0x46')]=_[_0xc869('0x59')](_0x4af103['model'],qs[_0xc869('0x5a')](_0x246f3d[_0xc869('0x41')][_0xc869('0x5a')]));_0x3aac76['attributes']=_0x3aac76[_0xc869('0x46')][_0xc869('0x4b')]?_0x3aac76['attributes']:_0x4af103[_0xc869('0x55')];_0x3aac76[_0xc869('0xca')]=qs[_0xc869('0xcb')](_0x246f3d[_0xc869('0x41')][_0xc869('0xcb')]);_0x3aac76[_0xc869('0x40')]=qs[_0xc869('0x58')](_[_0xc869('0xcc')](_0x246f3d[_0xc869('0x41')],_0x4af103[_0xc869('0x58')]));if(_0x246f3d[_0xc869('0x41')][_0xc869('0x30')]){_0x3aac76[_0xc869('0x40')]=_['merge'](_0x3aac76['where'],{'$or':_['map'](_0x3aac76['attributes'],function(_0x10d48c){var _0xd18528={};_0xd18528[_0x10d48c]={'$like':'%'+_0x246f3d[_0xc869('0x41')][_0xc869('0x30')]+'%'};return _0xd18528;})});}_0x3aac76=_[_0xc869('0x5b')]({},_0x3aac76,_0x246f3d[_0xc869('0xcd')]);return _0x2d5684[_0xc869('0xc9')](_0x3aac76);}})[_0xc869('0x16')](function(_0x4a9563){if(_0x4a9563){_0x4354d4=_0x4a9563[_0xc869('0x4b')];if(_0x246f3d['query'][_0xc869('0xce')]('includeAll')){_0x3aac76[_0xc869('0x43')]=[{'model':db['CmList'],'as':_0xc869('0xcf'),'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xc869('0x36'),_0xc869('0xd0')],'where':_0x246f3d[_0xc869('0x41')][_0xc869('0xd1')]?{'id':_0x246f3d['query'][_0xc869('0xd1')]}:undefined,'required':_0x246f3d['query'][_0xc869('0xd1')]?!![]:![]}];}if(!_0x246f3d[_0xc869('0x41')][_0xc869('0xce')](_0xc869('0xd2'))){_0x3aac76[_0xc869('0x25')]=qs['limit'](_0x246f3d[_0xc869('0x41')][_0xc869('0x25')]);_0x3aac76[_0xc869('0x22')]=qs[_0xc869('0x22')](_0x246f3d[_0xc869('0x41')][_0xc869('0x22')]);}return _0x2d5684['getContacts'](_0x3aac76);}})[_0xc869('0x16')](function(_0x1e73b0){if(_0x1e73b0){return _0x1e73b0?{'count':_0x4354d4,'rows':_0x1e73b0}:null;}})[_0xc869('0x16')](respondWithResult(_0xeeaa27,null))[_0xc869('0x1e')](handleError(_0xeeaa27,null));};exports[_0xc869('0xd3')]=function(_0x1808d8,_0x5509f0){var _0x3da290;var _0x2bbb5a={};var _0x29cad9;return db['User'][_0xc869('0x94')]({'where':{'id':_0x1808d8[_0xc869('0x54')]['id']},'attributes':['id',_0xc869('0x36'),_0xc869('0x34')]})[_0xc869('0x16')](handleEntityNotFound(_0x5509f0,null))[_0xc869('0x16')](function(_0x5da9de){if(!utils[_0xc869('0xa0')](_0x1808d8[_0xc869('0x41')][_0xc869('0x9b')])){throw new db[(_0xc869('0x8e'))][(_0xc869('0x90'))](_0xc869('0xa1'));}_0x3da290=_0x5da9de;var _0x5ec3f={};_0x5ec3f[_0xc869('0x55')]=_['keys'](db[_[_0xc869('0xa3')](_0x1808d8[_0xc869('0x41')][_0xc869('0x9b')])+_0xc869('0xd4')][_0xc869('0x56')]);_0x5ec3f[_0xc869('0x41')]=_[_0xc869('0x57')](_0x1808d8['query']);_0x5ec3f[_0xc869('0x58')]=_[_0xc869('0x59')](_0x5ec3f[_0xc869('0x55')],_0x5ec3f['query']);_0x2bbb5a['attributes']=_[_0xc869('0x59')](_0x5ec3f[_0xc869('0x55')],qs[_0xc869('0x5a')](_0x1808d8['query'][_0xc869('0x5a')]));_0x2bbb5a[_0xc869('0x46')]=_0x2bbb5a[_0xc869('0x46')][_0xc869('0x4b')]?_0x2bbb5a[_0xc869('0x46')]:_0x5ec3f[_0xc869('0x55')];_0x2bbb5a[_0xc869('0xca')]=qs[_0xc869('0xcb')](_0x1808d8[_0xc869('0x41')][_0xc869('0xcb')]);_0x2bbb5a[_0xc869('0x40')]=qs[_0xc869('0x58')](_[_0xc869('0xcc')](_0x1808d8[_0xc869('0x41')],_0x5ec3f[_0xc869('0x58')]));if(_0x1808d8['query'][_0xc869('0x30')]){_0x2bbb5a[_0xc869('0x40')]=_[_0xc869('0x5b')](_0x2bbb5a[_0xc869('0x40')],{'$or':_[_0xc869('0x32')](_0x2bbb5a[_0xc869('0x46')],function(_0x350d3c){var _0x31225f={};_0x31225f[_0x350d3c]={'$like':'%'+_0x1808d8[_0xc869('0x41')][_0xc869('0x30')]+'%'};return _0x31225f;})});}_0x2bbb5a=_[_0xc869('0x5b')]({},_0x2bbb5a,_0x1808d8['options']);switch(_0x3da290[_0xc869('0x34')]){case'admin':return db[_[_0xc869('0xa3')](_0x1808d8[_0xc869('0x41')][_0xc869('0x9b')])+_0xc869('0xd4')][_0xc869('0x47')](_0x2bbb5a);case'user':case _0xc869('0x70'):return _0x3da290[_0xc869('0xac')+_[_0xc869('0xa3')](_0x1808d8[_0xc869('0x41')][_0xc869('0x9b')])+_0xc869('0xa5')](_0x2bbb5a);default:throw new db[(_0xc869('0x8e'))][(_0xc869('0x90'))](_0xc869('0xd5'));}})[_0xc869('0x16')](function(_0xb9efee){_0x29cad9=_0xb9efee[_0xc869('0x4b')];if(!_0x1808d8[_0xc869('0x41')][_0xc869('0xce')]('nolimit')){_0x2bbb5a[_0xc869('0x25')]=qs[_0xc869('0x25')](_0x1808d8[_0xc869('0x41')]['limit']);_0x2bbb5a[_0xc869('0x22')]=qs['offset'](_0x1808d8['query'][_0xc869('0x22')]);}switch(_0x3da290[_0xc869('0x34')]){case _0xc869('0x2a'):return db[_[_0xc869('0xa3')](_0x1808d8[_0xc869('0x41')]['channel'])+_0xc869('0xd4')][_0xc869('0x47')](_0x2bbb5a);case _0xc869('0x2c'):case _0xc869('0x70'):return _0x3da290['get'+_[_0xc869('0xa3')](_0x1808d8[_0xc869('0x41')][_0xc869('0x9b')])+_0xc869('0xa5')](_0x2bbb5a);}})[_0xc869('0x16')](function(_0x1cd7af){return{'count':_0x29cad9,'rows':_0x1cd7af};})[_0xc869('0x16')](respondWithResult(_0x5509f0,null))['catch'](handleError(_0x5509f0,null));};exports[_0xc869('0xd6')]=function(_0x5ec8a4,_0x5dc8a4){var _0x351dfc={};var _0x53a51d={};var _0x460c24;var _0x2dc8d1;return db[_0xc869('0x3a')][_0xc869('0x94')]({'where':{'id':_0x5ec8a4['params']['id']}})['then'](handleEntityNotFound(_0x5dc8a4,null))[_0xc869('0x16')](function(_0x1d4173){if(_0x1d4173){_0x460c24=_0x1d4173;_0x53a51d[_0xc869('0x55')]=_[_0xc869('0x57')](db['UserVoiceQueueRt'][_0xc869('0x56')]);_0x53a51d[_0xc869('0x41')]=_[_0xc869('0x57')](_0x5ec8a4[_0xc869('0x41')]);_0x53a51d[_0xc869('0x58')]=_[_0xc869('0x59')](_0x53a51d[_0xc869('0x55')],_0x53a51d[_0xc869('0x41')]);_0x351dfc[_0xc869('0x46')]=_[_0xc869('0x59')](_0x53a51d[_0xc869('0x55')],qs['fields'](_0x5ec8a4['query']['fields']));_0x351dfc['attributes']=_0x351dfc[_0xc869('0x46')]['length']?_0x351dfc[_0xc869('0x46')]:_0x53a51d[_0xc869('0x55')];_0x351dfc[_0xc869('0xca')]=qs[_0xc869('0xcb')](_0x5ec8a4[_0xc869('0x41')][_0xc869('0xcb')]);_0x351dfc[_0xc869('0x40')]=qs[_0xc869('0x58')](_['pick'](_0x5ec8a4[_0xc869('0x41')],_0x53a51d[_0xc869('0x58')]));if(_0x5ec8a4[_0xc869('0x41')][_0xc869('0x30')]){_0x351dfc['where']=_['merge'](_0x351dfc[_0xc869('0x40')],{'$or':_['map'](_0x351dfc[_0xc869('0x46')],function(_0x14d210){var _0x5de15f={};_0x5de15f[_0x14d210]={'$like':'%'+_0x5ec8a4[_0xc869('0x41')][_0xc869('0x30')]+'%'};return _0x5de15f;})});}_0x351dfc=_['merge']({},_0x351dfc,_0x5ec8a4[_0xc869('0xcd')]);return _0x460c24[_0xc869('0xd6')](_0x351dfc);}})[_0xc869('0x16')](function(_0x2836e4){if(_0x2836e4){_0x2dc8d1=_0x2836e4['length'];if(!_0x5ec8a4[_0xc869('0x41')][_0xc869('0xce')](_0xc869('0xd2'))){_0x351dfc['limit']=qs[_0xc869('0x25')](_0x5ec8a4[_0xc869('0x41')][_0xc869('0x25')]);_0x351dfc[_0xc869('0x22')]=qs['offset'](_0x5ec8a4[_0xc869('0x41')]['offset']);}return _0x460c24['getVoiceQueuesRt'](_0x351dfc);}})[_0xc869('0x16')](function(_0x4b56ca){if(_0x4b56ca){return _0x4b56ca?{'count':_0x2dc8d1,'rows':_0x4b56ca}:null;}})[_0xc869('0x16')](respondWithResult(_0x5dc8a4,null))['catch'](handleError(_0x5dc8a4,null));};exports[_0xc869('0xd7')]=function(_0x177832,_0x4026ad){var _0x28b95f={};var _0x2a76f6={};var _0x57757b;var _0x35aaa1;return db['User'][_0xc869('0x94')]({'where':{'id':_0x177832['params']['id']}})[_0xc869('0x16')](handleEntityNotFound(_0x4026ad,null))[_0xc869('0x16')](function(_0x418255){if(_0x418255){_0x57757b=_0x418255;_0x2a76f6[_0xc869('0x55')]=_['keys'](db[_0xc869('0xd8')][_0xc869('0x56')]);_0x2a76f6[_0xc869('0x41')]=_[_0xc869('0x57')](_0x177832[_0xc869('0x41')]);_0x2a76f6['filters']=_[_0xc869('0x59')](_0x2a76f6[_0xc869('0x55')],_0x2a76f6[_0xc869('0x41')]);_0x28b95f[_0xc869('0x46')]=_['intersection'](_0x2a76f6[_0xc869('0x55')],qs[_0xc869('0x5a')](_0x177832[_0xc869('0x41')][_0xc869('0x5a')]));_0x28b95f[_0xc869('0x46')]=_0x28b95f[_0xc869('0x46')][_0xc869('0x4b')]?_0x28b95f[_0xc869('0x46')]:_0x2a76f6[_0xc869('0x55')];_0x28b95f[_0xc869('0xca')]=qs[_0xc869('0xcb')](_0x177832[_0xc869('0x41')][_0xc869('0xcb')]);_0x28b95f[_0xc869('0x40')]=qs[_0xc869('0x58')](_[_0xc869('0xcc')](_0x177832[_0xc869('0x41')],_0x2a76f6[_0xc869('0x58')]));if(_0x177832[_0xc869('0x41')]['filter']){_0x28b95f[_0xc869('0x40')]=_['merge'](_0x28b95f[_0xc869('0x40')],{'$or':_[_0xc869('0x32')](_0x28b95f[_0xc869('0x46')],function(_0x538248){var _0x39d270={};_0x39d270[_0x538248]={'$like':'%'+_0x177832[_0xc869('0x41')][_0xc869('0x30')]+'%'};return _0x39d270;})});}_0x28b95f=_[_0xc869('0x5b')]({},_0x28b95f,_0x177832[_0xc869('0xcd')]);return _0x57757b[_0xc869('0xd7')](_0x28b95f);}})[_0xc869('0x16')](function(_0x146cbd){if(_0x146cbd){_0x35aaa1=_0x146cbd[_0xc869('0x4b')];if(!_0x177832['query'][_0xc869('0xce')]('nolimit')){_0x28b95f['limit']=qs['limit'](_0x177832['query'][_0xc869('0x25')]);_0x28b95f['offset']=qs[_0xc869('0x22')](_0x177832['query'][_0xc869('0x22')]);}return _0x57757b[_0xc869('0xd7')](_0x28b95f);}})[_0xc869('0x16')](function(_0x5489c2){if(_0x5489c2){return _0x5489c2?{'count':_0x35aaa1,'rows':_0x5489c2}:null;}})[_0xc869('0x16')](respondWithResult(_0x4026ad,null))[_0xc869('0x1e')](handleError(_0x4026ad,null));};exports[_0xc869('0xd9')]=function(_0x130009,_0x4adaf7){var _0x2d2042={'raw':!![],'where':{}};var _0x4330ac={};var _0x4a1345={'count':0x0,'rows':[]};return db[_0xc869('0x3a')][_0xc869('0x94')]({'where':{'id':_0x130009[_0xc869('0x54')]['id']}})[_0xc869('0x16')](handleEntityNotFound(_0x4adaf7,null))[_0xc869('0x16')](function(_0x52d09b){if(_0x52d09b){_0x4330ac[_0xc869('0x55')]=_[_0xc869('0x57')](db[_0xc869('0xda')][_0xc869('0x56')]);_0x4330ac['query']=_[_0xc869('0x57')](_0x130009['query']);_0x4330ac[_0xc869('0x58')]=_[_0xc869('0x59')](_0x4330ac['model'],_0x4330ac[_0xc869('0x41')]);_0x2d2042['attributes']=_[_0xc869('0x59')](_0x4330ac['model'],qs[_0xc869('0x5a')](_0x130009[_0xc869('0x41')][_0xc869('0x5a')]));_0x2d2042['attributes']=_0x2d2042[_0xc869('0x46')][_0xc869('0x4b')]?_0x2d2042['attributes']:_0x4330ac[_0xc869('0x55')];if(!_0x130009['query']['hasOwnProperty']('nolimit')){_0x2d2042[_0xc869('0x25')]=qs[_0xc869('0x25')](_0x130009[_0xc869('0x41')][_0xc869('0x25')]);_0x2d2042['offset']=qs['offset'](_0x130009['query'][_0xc869('0x22')]);}_0x2d2042['order']=qs[_0xc869('0xcb')](_0x130009[_0xc869('0x41')]['sort']);_0x2d2042[_0xc869('0x40')]=qs[_0xc869('0x58')](_[_0xc869('0xcc')](_0x130009[_0xc869('0x41')],_0x4330ac[_0xc869('0x58')]));_0x2d2042[_0xc869('0x40')][_0xc869('0xdb')]=_0x52d09b['id'];if(_0x130009[_0xc869('0x41')][_0xc869('0x30')]){_0x2d2042[_0xc869('0x40')]=_[_0xc869('0x5b')](_0x2d2042['where'],{'$or':_[_0xc869('0x32')](_0x2d2042['attributes'],function(_0xd0a4ad){var _0x27d7cf={};_0x27d7cf[_0xd0a4ad]={'$like':'%'+_0x130009['query'][_0xc869('0x30')]+'%'};return _0x27d7cf;})});}_0x2d2042=_[_0xc869('0x5b')]({},_0x2d2042,_0x130009['options']);return db[_0xc869('0xda')][_0xc869('0x24')]({'where':_0x2d2042[_0xc869('0x40')]})['then'](function(_0x215b9b){_0x4a1345[_0xc869('0x24')]=_0x215b9b;if(_0x130009[_0xc869('0x41')][_0xc869('0x42')]){_0x2d2042[_0xc869('0x43')]=[{'all':!![]}];}return db[_0xc869('0xda')][_0xc869('0x47')](_0x2d2042);})[_0xc869('0x16')](function(_0x59330b){_0x4a1345[_0xc869('0x48')]=_0x59330b;return _0x4a1345;});}})[_0xc869('0x16')](respondWithFilteredResult(_0x4adaf7,_0x2d2042))[_0xc869('0x1e')](handleError(_0x4adaf7,null));};exports[_0xc869('0xdc')]=function(_0x2dc9bc,_0x4d3d4){var _0x54736d={'raw':!![],'where':{}};var _0x2587bc={};var _0x3f25f1={'count':0x0,'rows':[]};return db['User'][_0xc869('0x94')]({'where':{'id':_0x2dc9bc[_0xc869('0x54')]['id']}})[_0xc869('0x16')](handleEntityNotFound(_0x4d3d4,null))['then'](function(_0x33ac63){if(_0x33ac63){_0x2587bc[_0xc869('0x55')]=_[_0xc869('0x57')](db[_0xc869('0xdd')]['rawAttributes']);_0x2587bc[_0xc869('0x41')]=_[_0xc869('0x57')](_0x2dc9bc[_0xc869('0x41')]);_0x2587bc['filters']=_[_0xc869('0x59')](_0x2587bc[_0xc869('0x55')],_0x2587bc[_0xc869('0x41')]);_0x54736d[_0xc869('0x46')]=_[_0xc869('0x59')](_0x2587bc['model'],qs[_0xc869('0x5a')](_0x2dc9bc[_0xc869('0x41')][_0xc869('0x5a')]));_0x54736d[_0xc869('0x46')]=_0x54736d[_0xc869('0x46')]['length']?_0x54736d['attributes']:_0x2587bc[_0xc869('0x55')];if(!_0x2dc9bc[_0xc869('0x41')][_0xc869('0xce')](_0xc869('0xd2'))){_0x54736d[_0xc869('0x25')]=qs[_0xc869('0x25')](_0x2dc9bc[_0xc869('0x41')][_0xc869('0x25')]);_0x54736d[_0xc869('0x22')]=qs[_0xc869('0x22')](_0x2dc9bc[_0xc869('0x41')][_0xc869('0x22')]);}_0x54736d[_0xc869('0xca')]=qs[_0xc869('0xcb')](_0x2dc9bc[_0xc869('0x41')][_0xc869('0xcb')]);_0x54736d[_0xc869('0x40')]=qs['filters'](_[_0xc869('0xcc')](_0x2dc9bc['query'],_0x2587bc[_0xc869('0x58')]));_0x54736d[_0xc869('0x40')][_0xc869('0xdb')]=_0x33ac63['id'];if(_0x2dc9bc[_0xc869('0x41')][_0xc869('0x30')]){_0x54736d[_0xc869('0x40')]=_[_0xc869('0x5b')](_0x54736d['where'],{'$or':_[_0xc869('0x32')](_0x54736d['attributes'],function(_0x19d097){var _0x34afc9={};_0x34afc9[_0x19d097]={'$like':'%'+_0x2dc9bc[_0xc869('0x41')][_0xc869('0x30')]+'%'};return _0x34afc9;})});}_0x54736d=_[_0xc869('0x5b')]({},_0x54736d,_0x2dc9bc[_0xc869('0xcd')]);return db[_0xc869('0xdd')][_0xc869('0x24')]({'where':_0x54736d[_0xc869('0x40')]})[_0xc869('0x16')](function(_0x1a0031){_0x3f25f1[_0xc869('0x24')]=_0x1a0031;if(_0x2dc9bc['query'][_0xc869('0x42')]){_0x54736d[_0xc869('0x43')]=[{'all':!![]}];}return db[_0xc869('0xdd')]['findAll'](_0x54736d);})[_0xc869('0x16')](function(_0x295134){_0x3f25f1[_0xc869('0x48')]=_0x295134;return _0x3f25f1;});}})[_0xc869('0x16')](respondWithFilteredResult(_0x4d3d4,_0x54736d))['catch'](handleError(_0x4d3d4,null));};exports[_0xc869('0xde')]=function(_0x5b2a69,_0x4b1ddf){var _0x1a5aa7={};var _0x3ea131={};var _0x5715f7;var _0x495045;return db[_0xc869('0x3a')][_0xc869('0x94')]({'where':{'id':_0x5b2a69['params']['id']}})[_0xc869('0x16')](handleEntityNotFound(_0x4b1ddf,null))[_0xc869('0x16')](function(_0x4104c1){if(_0x4104c1){_0x5715f7=_0x4104c1;_0x3ea131['model']=_[_0xc869('0x57')](db[_0xc869('0xdf')][_0xc869('0x56')]);_0x3ea131[_0xc869('0x41')]=_['keys'](_0x5b2a69[_0xc869('0x41')]);_0x3ea131[_0xc869('0x58')]=_[_0xc869('0x59')](_0x3ea131[_0xc869('0x55')],_0x3ea131[_0xc869('0x41')]);_0x1a5aa7['attributes']=_[_0xc869('0x59')](_0x3ea131[_0xc869('0x55')],qs[_0xc869('0x5a')](_0x5b2a69['query'][_0xc869('0x5a')]));_0x1a5aa7[_0xc869('0x46')]=_0x1a5aa7['attributes']['length']?_0x1a5aa7[_0xc869('0x46')]:_0x3ea131[_0xc869('0x55')];_0x1a5aa7['order']=qs[_0xc869('0xcb')](_0x5b2a69[_0xc869('0x41')][_0xc869('0xcb')]);_0x1a5aa7[_0xc869('0x40')]=qs[_0xc869('0x58')](_[_0xc869('0xcc')](_0x5b2a69[_0xc869('0x41')],_0x3ea131[_0xc869('0x58')]));if(_0x5b2a69[_0xc869('0x41')][_0xc869('0x30')]){_0x1a5aa7[_0xc869('0x40')]=_['merge'](_0x1a5aa7[_0xc869('0x40')],{'$or':_[_0xc869('0x32')](_0x1a5aa7[_0xc869('0x46')],function(_0x35b733){var _0x2bdd11={};_0x2bdd11[_0x35b733]={'$like':'%'+_0x5b2a69[_0xc869('0x41')][_0xc869('0x30')]+'%'};return _0x2bdd11;})});}_0x1a5aa7=_[_0xc869('0x5b')]({},_0x1a5aa7,_0x5b2a69[_0xc869('0xcd')]);return _0x5715f7[_0xc869('0xde')](_0x1a5aa7);}})['then'](function(_0x22a839){if(_0x22a839){_0x495045=_0x22a839[_0xc869('0x4b')];if(!_0x5b2a69[_0xc869('0x41')]['hasOwnProperty']('nolimit')){_0x1a5aa7[_0xc869('0x25')]=qs['limit'](_0x5b2a69[_0xc869('0x41')][_0xc869('0x25')]);_0x1a5aa7[_0xc869('0x22')]=qs[_0xc869('0x22')](_0x5b2a69[_0xc869('0x41')][_0xc869('0x22')]);}return _0x5715f7[_0xc869('0xde')](_0x1a5aa7);}})[_0xc869('0x16')](function(_0x5e8d8e){if(_0x5e8d8e){return _0x5e8d8e?{'count':_0x495045,'rows':_0x5e8d8e}:null;}})[_0xc869('0x16')](respondWithResult(_0x4b1ddf,null))['catch'](handleError(_0x4b1ddf,null));};exports[_0xc869('0xe0')]=function(_0x4fb429,_0x34a3c2){var _0x298629={};var _0x58e068={};var _0x19f172;var _0xa1c5e9;return db[_0xc869('0x3a')][_0xc869('0x94')]({'where':{'id':_0x4fb429[_0xc869('0x54')]['id']}})[_0xc869('0x16')](handleEntityNotFound(_0x34a3c2,null))[_0xc869('0x16')](function(_0x27f77f){if(_0x27f77f){_0x19f172=_0x27f77f;_0x58e068['model']=_['keys'](db[_0xc869('0xe1')]['rawAttributes']);_0x58e068[_0xc869('0x41')]=_[_0xc869('0x57')](_0x4fb429[_0xc869('0x41')]);_0x58e068[_0xc869('0x58')]=_[_0xc869('0x59')](_0x58e068[_0xc869('0x55')],_0x58e068[_0xc869('0x41')]);_0x298629[_0xc869('0x46')]=_[_0xc869('0x59')](_0x58e068['model'],qs['fields'](_0x4fb429[_0xc869('0x41')]['fields']));_0x298629['attributes']=_0x298629[_0xc869('0x46')][_0xc869('0x4b')]?_0x298629[_0xc869('0x46')]:_0x58e068['model'];_0x298629['order']=qs[_0xc869('0xcb')](_0x4fb429[_0xc869('0x41')][_0xc869('0xcb')]);_0x298629[_0xc869('0x40')]=qs[_0xc869('0x58')](_['pick'](_0x4fb429['query'],_0x58e068['filters']));if(_0x4fb429[_0xc869('0x41')][_0xc869('0x30')]){_0x298629[_0xc869('0x40')]=_['merge'](_0x298629[_0xc869('0x40')],{'$or':_[_0xc869('0x32')](_0x298629['attributes'],function(_0x5adea1){var _0x4bfb33={};_0x4bfb33[_0x5adea1]={'$like':'%'+_0x4fb429[_0xc869('0x41')][_0xc869('0x30')]+'%'};return _0x4bfb33;})});}_0x298629=_['merge']({},_0x298629,_0x4fb429[_0xc869('0xcd')]);return _0x19f172['getOpenchannelInteractions'](_0x298629);}})['then'](function(_0x42d311){if(_0x42d311){_0xa1c5e9=_0x42d311[_0xc869('0x4b')];if(!_0x4fb429[_0xc869('0x41')]['hasOwnProperty'](_0xc869('0xd2'))){_0x298629[_0xc869('0x25')]=qs['limit'](_0x4fb429['query'][_0xc869('0x25')]);_0x298629[_0xc869('0x22')]=qs[_0xc869('0x22')](_0x4fb429['query'][_0xc869('0x22')]);}return _0x19f172[_0xc869('0xe0')](_0x298629);}})[_0xc869('0x16')](function(_0x6566e9){if(_0x6566e9){return _0x6566e9?{'count':_0xa1c5e9,'rows':_0x6566e9}:null;}})[_0xc869('0x16')](respondWithResult(_0x34a3c2,null))['catch'](handleError(_0x34a3c2,null));};exports[_0xc869('0xe2')]=function(_0x3e4e13,_0x2aeb49){var _0x30f901={'raw':!![],'where':{}};var _0x408023={};var _0x1db1bf={'count':0x0,'rows':[]};return db[_0xc869('0x3a')][_0xc869('0x94')]({'where':{'id':_0x3e4e13['params']['id']}})[_0xc869('0x16')](handleEntityNotFound(_0x2aeb49,null))[_0xc869('0x16')](function(_0x4be269){if(_0x4be269){_0x408023[_0xc869('0x55')]=_[_0xc869('0x57')](db['MailInteraction'][_0xc869('0x56')]);_0x408023[_0xc869('0x41')]=_[_0xc869('0x57')](_0x3e4e13[_0xc869('0x41')]);_0x408023[_0xc869('0x58')]=_[_0xc869('0x59')](_0x408023['model'],_0x408023[_0xc869('0x41')]);_0x30f901[_0xc869('0x46')]=_[_0xc869('0x59')](_0x408023[_0xc869('0x55')],qs['fields'](_0x3e4e13[_0xc869('0x41')]['fields']));_0x30f901['attributes']=_0x30f901[_0xc869('0x46')][_0xc869('0x4b')]?_0x30f901[_0xc869('0x46')]:_0x408023['model'];if(!_0x3e4e13['query'][_0xc869('0xce')](_0xc869('0xd2'))){_0x30f901[_0xc869('0x25')]=qs[_0xc869('0x25')](_0x3e4e13[_0xc869('0x41')]['limit']);_0x30f901[_0xc869('0x22')]=qs['offset'](_0x3e4e13[_0xc869('0x41')][_0xc869('0x22')]);}_0x30f901['order']=qs[_0xc869('0xcb')](_0x3e4e13[_0xc869('0x41')][_0xc869('0xcb')]);_0x30f901[_0xc869('0x40')]=qs[_0xc869('0x58')](_[_0xc869('0xcc')](_0x3e4e13['query'],_0x408023[_0xc869('0x58')]));_0x30f901['where']['UserId']=_0x4be269['id'];if(_0x3e4e13[_0xc869('0x41')][_0xc869('0x30')]){_0x30f901['where']=_[_0xc869('0x5b')](_0x30f901[_0xc869('0x40')],{'$or':_[_0xc869('0x32')](_0x30f901['attributes'],function(_0x3d057d){var _0x3d7441={};_0x3d7441[_0x3d057d]={'$like':'%'+_0x3e4e13['query'][_0xc869('0x30')]+'%'};return _0x3d7441;})});}_0x30f901=_[_0xc869('0x5b')]({},_0x30f901,_0x3e4e13[_0xc869('0xcd')]);return db['MailInteraction'][_0xc869('0x24')]({'where':_0x30f901['where']})[_0xc869('0x16')](function(_0x1d60c9){_0x1db1bf[_0xc869('0x24')]=_0x1d60c9;if(_0x3e4e13[_0xc869('0x41')][_0xc869('0x42')]){_0x30f901[_0xc869('0x43')]=[{'all':!![]}];}return db[_0xc869('0xe3')][_0xc869('0x47')](_0x30f901);})[_0xc869('0x16')](function(_0x1d49e7){_0x1db1bf[_0xc869('0x48')]=_0x1d49e7;return _0x1db1bf;});}})['then'](respondWithFilteredResult(_0x2aeb49,_0x30f901))['catch'](handleError(_0x2aeb49,null));};exports[_0xc869('0xe4')]=function(_0x29c099,_0x6292bc){var _0x21942f={};var _0x24573b={};var _0x111911;var _0x38c4e8;return db[_0xc869('0x3a')][_0xc869('0x94')]({'where':{'id':_0x29c099[_0xc869('0x54')]['id']}})[_0xc869('0x16')](handleEntityNotFound(_0x6292bc,null))['then'](function(_0x51b195){if(_0x51b195){_0x111911=_0x51b195;_0x24573b[_0xc869('0x55')]=_['keys'](db[_0xc869('0xe5')][_0xc869('0x56')]);_0x24573b[_0xc869('0x41')]=_[_0xc869('0x57')](_0x29c099['query']);_0x24573b[_0xc869('0x58')]=_['intersection'](_0x24573b[_0xc869('0x55')],_0x24573b['query']);_0x21942f['attributes']=_['intersection'](_0x24573b[_0xc869('0x55')],qs[_0xc869('0x5a')](_0x29c099[_0xc869('0x41')]['fields']));_0x21942f[_0xc869('0x46')]=_0x21942f[_0xc869('0x46')][_0xc869('0x4b')]?_0x21942f[_0xc869('0x46')]:_0x24573b[_0xc869('0x55')];_0x21942f[_0xc869('0xca')]=qs['sort'](_0x29c099[_0xc869('0x41')]['sort']);_0x21942f[_0xc869('0x40')]=qs[_0xc869('0x58')](_[_0xc869('0xcc')](_0x29c099[_0xc869('0x41')],_0x24573b[_0xc869('0x58')]));if(_0x29c099['query'][_0xc869('0x30')]){_0x21942f['where']=_[_0xc869('0x5b')](_0x21942f['where'],{'$or':_[_0xc869('0x32')](_0x21942f[_0xc869('0x46')],function(_0x555d64){var _0x1ad8dd={};_0x1ad8dd[_0x555d64]={'$like':'%'+_0x29c099[_0xc869('0x41')][_0xc869('0x30')]+'%'};return _0x1ad8dd;})});}_0x21942f=_[_0xc869('0x5b')]({},_0x21942f,_0x29c099[_0xc869('0xcd')]);return _0x111911[_0xc869('0xe4')](_0x21942f);}})[_0xc869('0x16')](function(_0xdf0567){if(_0xdf0567){_0x38c4e8=_0xdf0567[_0xc869('0x4b')];if(!_0x29c099[_0xc869('0x41')]['hasOwnProperty'](_0xc869('0xd2'))){_0x21942f[_0xc869('0x25')]=qs[_0xc869('0x25')](_0x29c099[_0xc869('0x41')][_0xc869('0x25')]);_0x21942f[_0xc869('0x22')]=qs[_0xc869('0x22')](_0x29c099['query'][_0xc869('0x22')]);}return _0x111911[_0xc869('0xe4')](_0x21942f);}})[_0xc869('0x16')](function(_0x1cbf71){if(_0x1cbf71){return _0x1cbf71?{'count':_0x38c4e8,'rows':_0x1cbf71}:null;}})[_0xc869('0x16')](respondWithResult(_0x6292bc,null))['catch'](handleError(_0x6292bc,null));};exports[_0xc869('0xe6')]=function(_0x2e38dc,_0x473c72){var _0x5b274e={};var _0x36a3b3={};var _0x4d1e9f;var _0x29f4e2;return db[_0xc869('0x3a')][_0xc869('0x94')]({'where':{'id':_0x2e38dc['params']['id']}})['then'](handleEntityNotFound(_0x473c72,null))[_0xc869('0x16')](function(_0xc721c1){if(_0xc721c1){_0x4d1e9f=_0xc721c1;_0x36a3b3['model']=_[_0xc869('0x57')](db[_0xc869('0xe7')]['rawAttributes']);_0x36a3b3[_0xc869('0x41')]=_[_0xc869('0x57')](_0x2e38dc[_0xc869('0x41')]);_0x36a3b3['filters']=_[_0xc869('0x59')](_0x36a3b3[_0xc869('0x55')],_0x36a3b3['query']);_0x5b274e['attributes']=_[_0xc869('0x59')](_0x36a3b3[_0xc869('0x55')],qs[_0xc869('0x5a')](_0x2e38dc[_0xc869('0x41')][_0xc869('0x5a')]));_0x5b274e[_0xc869('0x46')]=_0x5b274e[_0xc869('0x46')]['length']?_0x5b274e[_0xc869('0x46')]:_0x36a3b3[_0xc869('0x55')];_0x5b274e[_0xc869('0xca')]=qs['sort'](_0x2e38dc[_0xc869('0x41')][_0xc869('0xcb')]);_0x5b274e[_0xc869('0x40')]=qs[_0xc869('0x58')](_[_0xc869('0xcc')](_0x2e38dc['query'],_0x36a3b3[_0xc869('0x58')]));if(_0x2e38dc[_0xc869('0x41')][_0xc869('0x30')]){_0x5b274e[_0xc869('0x40')]=_[_0xc869('0x5b')](_0x5b274e[_0xc869('0x40')],{'$or':_[_0xc869('0x32')](_0x5b274e[_0xc869('0x46')],function(_0x1ea578){var _0x3f6827={};_0x3f6827[_0x1ea578]={'$like':'%'+_0x2e38dc[_0xc869('0x41')][_0xc869('0x30')]+'%'};return _0x3f6827;})});}_0x5b274e=_['merge']({},_0x5b274e,_0x2e38dc[_0xc869('0xcd')]);return _0x4d1e9f[_0xc869('0xe6')](_0x5b274e);}})[_0xc869('0x16')](function(_0x45f800){if(_0x45f800){_0x29f4e2=_0x45f800['length'];if(!_0x2e38dc['query'][_0xc869('0xce')](_0xc869('0xd2'))){_0x5b274e[_0xc869('0x25')]=qs[_0xc869('0x25')](_0x2e38dc[_0xc869('0x41')][_0xc869('0x25')]);_0x5b274e[_0xc869('0x22')]=qs[_0xc869('0x22')](_0x2e38dc['query']['offset']);}return _0x4d1e9f[_0xc869('0xe6')](_0x5b274e);}})[_0xc869('0x16')](function(_0x3d2d44){if(_0x3d2d44){return _0x3d2d44?{'count':_0x29f4e2,'rows':_0x3d2d44}:null;}})[_0xc869('0x16')](respondWithResult(_0x473c72,null))[_0xc869('0x1e')](handleError(_0x473c72,null));};exports['getWhatsappInteractions']=function(_0x58d005,_0x1e3ccd){var _0x3e3979={};var _0x4d5f9e={};var _0x1f643b;var _0x3fce9b;return db[_0xc869('0x3a')]['findOne']({'where':{'id':_0x58d005['params']['id']}})['then'](handleEntityNotFound(_0x1e3ccd,null))['then'](function(_0x4c2c08){if(_0x4c2c08){_0x1f643b=_0x4c2c08;_0x4d5f9e['model']=_['keys'](db['WhatsappInteraction'][_0xc869('0x56')]);_0x4d5f9e[_0xc869('0x41')]=_[_0xc869('0x57')](_0x58d005[_0xc869('0x41')]);_0x4d5f9e[_0xc869('0x58')]=_[_0xc869('0x59')](_0x4d5f9e[_0xc869('0x55')],_0x4d5f9e[_0xc869('0x41')]);_0x3e3979[_0xc869('0x46')]=_['intersection'](_0x4d5f9e[_0xc869('0x55')],qs[_0xc869('0x5a')](_0x58d005[_0xc869('0x41')]['fields']));_0x3e3979[_0xc869('0x46')]=_0x3e3979[_0xc869('0x46')][_0xc869('0x4b')]?_0x3e3979[_0xc869('0x46')]:_0x4d5f9e['model'];_0x3e3979[_0xc869('0xca')]=qs[_0xc869('0xcb')](_0x58d005[_0xc869('0x41')][_0xc869('0xcb')]);_0x3e3979[_0xc869('0x40')]=qs['filters'](_['pick'](_0x58d005['query'],_0x4d5f9e[_0xc869('0x58')]));if(_0x58d005[_0xc869('0x41')][_0xc869('0x30')]){_0x3e3979['where']=_[_0xc869('0x5b')](_0x3e3979[_0xc869('0x40')],{'$or':_[_0xc869('0x32')](_0x3e3979[_0xc869('0x46')],function(_0x1bbd3d){var _0x227176={};_0x227176[_0x1bbd3d]={'$like':'%'+_0x58d005[_0xc869('0x41')][_0xc869('0x30')]+'%'};return _0x227176;})});}_0x3e3979=_['merge']({},_0x3e3979,_0x58d005[_0xc869('0xcd')]);return _0x1f643b['getWhatsappInteractions'](_0x3e3979);}})[_0xc869('0x16')](function(_0xe0f7e){if(_0xe0f7e){_0x3fce9b=_0xe0f7e[_0xc869('0x4b')];if(!_0x58d005[_0xc869('0x41')]['hasOwnProperty'](_0xc869('0xd2'))){_0x3e3979[_0xc869('0x25')]=qs[_0xc869('0x25')](_0x58d005[_0xc869('0x41')][_0xc869('0x25')]);_0x3e3979[_0xc869('0x22')]=qs[_0xc869('0x22')](_0x58d005['query'][_0xc869('0x22')]);}return _0x1f643b[_0xc869('0xe8')](_0x3e3979);}})[_0xc869('0x16')](function(_0x1c1754){if(_0x1c1754){return _0x1c1754?{'count':_0x3fce9b,'rows':_0x1c1754}:null;}})[_0xc869('0x16')](respondWithResult(_0x1e3ccd,null))[_0xc869('0x1e')](handleError(_0x1e3ccd,null));};exports[_0xc869('0xe9')]=function(_0x28e5ca,_0x4fce96,_0x28b67f){var _0x2e5089;var _0x36ed87;var _0x1a1b33;var _0x6ad179=!_[_0xc869('0x67')](_0x28e5ca[_0xc869('0x54')]['id'])?_0x28e5ca[_0xc869('0x54')]['id']:!_[_0xc869('0x67')](_0x28e5ca[_0xc869('0x2c')]['id'])?_0x28e5ca[_0xc869('0x2c')]['id']:null;return db[_0xc869('0x3a')][_0xc869('0x35')]({'where':{'id':_0x6ad179,'role':{'$or':['admin','user',_0xc869('0x70')]}},'attributes':['id','name','phone',_0xc869('0xea'),_0xc869('0x34'),_0xc869('0x61'),_0xc869('0x9d')]})[_0xc869('0x16')](function(_0x3b5fb1){if(_0x3b5fb1){if(_0x3b5fb1[_0xc869('0x34')]===_0xc869('0x70')){_0x2e5089=_0x3b5fb1;if(_0x28e5ca['body']['interface']){_0x1a1b33=util[_0xc869('0xad')]('LOCAL/%s@from-sip/n',_0x2e5089[_0x28e5ca[_0xc869('0x5d')]['interface']]);}else if(_0x28e5ca[_0xc869('0x5d')][_0xc869('0xeb')]){_0x1a1b33=util['format'](_0xc869('0xae'),_0x28e5ca[_0xc869('0x5d')][_0xc869('0xeb')]);}else{_0x1a1b33=util['format'](_0xc869('0xae'),_0x2e5089[_0xc869('0x36')]);}socket['to'](util[_0xc869('0xad')](_0xc869('0xec'),_0x2e5089[_0xc869('0x36')]))['emit']('user:forcelogout',{'user':{'id':_0x2e5089['id'],'name':_0x2e5089[_0xc869('0x36')]},'ip':_0x28e5ca[_0xc869('0xed')][_0xc869('0xee')]||_0x28e5ca[_0xc869('0xef')]['remoteAddress']||_0x28e5ca['socket'][_0xc869('0xf0')]||_0x28e5ca[_0xc869('0xef')][_0xc869('0xf1')][_0xc869('0xf0')]});return db['UserVoiceQueueRt'][_0xc869('0x29')]({'where':{'membername':_0x2e5089['name']},'individualHooks':!![]});}}else{throw new db[(_0xc869('0x8e'))][(_0xc869('0x90'))](_0xc869('0xf2'));}})['then'](function(){if(_0x2e5089){return _0x2e5089[_0xc869('0xf3')]({'raw':!![]});}})['then'](function(_0x253c64){if(_0x2e5089){var _0x323d09=[];if(_0x253c64){_0x36ed87=_0x253c64;if(_0x36ed87['length']){for(var _0x553dcc=0x0;_0x553dcc<_0x36ed87['length'];_0x553dcc++){_0x323d09[_0xc869('0x4c')]({'membername':_0x2e5089[_0xc869('0x36')],'UserId':_0x2e5089['id'],'queue_name':_0x36ed87[_0x553dcc][_0xc869('0x36')],'VoiceQueueId':_0x36ed87[_0x553dcc]['id'],'interface':_0x1a1b33,'paused':_0x2e5089['loginInPause']||![],'penalty':_0x36ed87[_0x553dcc][_0xc869('0xf4')]||0x0});}return BPromise['each'](_0x323d09,function(_0x3b15fb){return db[_0xc869('0xaf')]['upsert'](_0x3b15fb);});}}}})[_0xc869('0x16')](function(){if(_0x2e5089){return db['MemberReport'][_0xc869('0x47')]({'where':{'membername':_0x2e5089[_0xc869('0x36')],'exitAt':null}});}})['then'](function(_0x42a219){if(_0x2e5089){var _0x430a7c=[];_0x42a219[_0xc869('0xf5')](function(_0x57b670){_0x430a7c['push'](_0x57b670['update']({'exitAt':moment()[_0xc869('0xad')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xc869('0x53')](_0x430a7c);}})[_0xc869('0x16')](function(){if(_0x2e5089){var _0x372ed4=[];var _0x4d0afb=[];var _0x23c92a=utils[_0xc869('0xf6')]();var _0x31fb97={'membername':_0x2e5089[_0xc869('0x36')],'interface':_0x1a1b33,'enterAt':moment()['format'](_0xc869('0xf7')),'role':_0x2e5089['role'],'internal':_0x2e5089[_0xc869('0x61')]};_0x23c92a[_0xc869('0xf5')](function(_0x5891bc){_0x372ed4[_0xc869('0x4c')](_[_0xc869('0x5b')]({'channel':_0x5891bc,'type':_0xc869('0xf8'),'data1':_0x28e5ca[_0xc869('0x5d')][_0xc869('0xf9')],'data2':_0x1a1b33},_0x31fb97));if(_0x2e5089[_0xc869('0x9d')]){_0x4d0afb[_0xc869('0x4c')](_[_0xc869('0x5b')]({'channel':_0x5891bc,'type':_0xc869('0xfa'),'data1':'LOGININPAUSE'},_0x31fb97));}});return db[_0xc869('0xfb')][_0xc869('0x88')](_0x372ed4['concat'](_0x4d0afb),{'individualHooks':!![]});}})[_0xc869('0x16')](function(){if(_0x2e5089){return _0x2e5089[_0xc869('0x28')]({'online':!![],'lastLoginAt':moment()[_0xc869('0xad')](_0xc869('0xf7')),'voicePause':_0x2e5089['loginInPause']||![],'mailPause':_0x2e5089['loginInPause']||![],'chatPause':_0x2e5089[_0xc869('0x9d')]||![],'faxPause':_0x2e5089[_0xc869('0x9d')]||![],'smsPause':_0x2e5089[_0xc869('0x9d')]||![],'openchannelPause':_0x2e5089[_0xc869('0x9d')]||![],'whatsappPause':_0x2e5089[_0xc869('0x9d')]||![],'pauseType':_0x2e5089['loginInPause']?'LOGININPAUSE':null,'interface':_0x1a1b33,'lastPauseAt':moment()['format'](_0xc869('0xf7'))});}})[_0xc869('0x16')](function(_0x5d4d81){if(_0x28e5ca['isMiddleware']){return _0x28b67f();}else{return BPromise[_0xc869('0xfc')](_0x5d4d81)[_0xc869('0x16')](respondWithResult(_0x4fce96,null));}})[_0xc869('0x1e')](handleError(_0x4fce96,null));};exports[_0xc869('0xfd')]=function(_0x4003df,_0x35f82e){var _0x2154ad;return db[_0xc869('0x3a')][_0xc869('0x35')]({'where':{'id':_0x4003df[_0xc869('0x54')]['id'],'role':_0xc869('0x70')},'attributes':['id',_0xc869('0x36'),_0xc869('0x34')]})['then'](handleEntityNotFound(_0x35f82e,null))[_0xc869('0x16')](function(_0x1264b1){if(_0x1264b1){_0x2154ad=_0x1264b1;return db[_0xc869('0xaf')][_0xc869('0x29')]({'where':{'membername':_0x2154ad[_0xc869('0x36')]},'individualHooks':!![]});}})['then'](function(){return db[_0xc869('0xfb')][_0xc869('0x47')]({'where':{'membername':_0x2154ad[_0xc869('0x36')],'exitAt':null}});})['then'](function(_0x5a9e5f){var _0x293f07=[];_0x5a9e5f[_0xc869('0xf5')](function(_0xdc357f){_0x293f07[_0xc869('0x4c')](_0xdc357f[_0xc869('0x28')]({'exitAt':moment()[_0xc869('0xad')](_0xc869('0xf7'))}));});return BPromise[_0xc869('0x53')](_0x293f07);})['then'](function(){return _0x2154ad[_0xc869('0x28')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xc869('0x16')](respondWithResult(_0x35f82e,null))[_0xc869('0x1e')](handleError(_0x35f82e,null));};exports['pause']=function(_0x173a19,_0x2d5289){var _0x4eebaa;return db['UserVoiceQueueRt'][_0xc869('0x28')]({'paused':0x1},{'where':{'UserId':_0x173a19['params']['id']},'individualHooks':!![]})[_0xc869('0x16')](function(){return db[_0xc869('0x3a')][_0xc869('0x35')]({'where':{'id':_0x173a19[_0xc869('0x54')]['id'],'role':_0xc869('0x70')},'attributes':['id','name','role',_0xc869('0x61'),_0xc869('0x9f')]});})[_0xc869('0x16')](handleEntityNotFound(_0x2d5289,null))[_0xc869('0x16')](function(_0x112f78){if(_0x112f78){_0x4eebaa=_0x112f78;return respondWithRpcPromise(_0xc869('0xfe'),_0xc869('0xff'),{'id':_0x4eebaa['id'],'name':_0x4eebaa[_0xc869('0x36')],'pause':!![]});}})[_0xc869('0x16')](function(){if(_0x4eebaa){return db[_0xc869('0xfb')][_0xc869('0x47')]({'where':{'membername':_0x4eebaa[_0xc869('0x36')],'type':'PAUSE','exitAt':null}});}})[_0xc869('0x16')](function(_0x5e67e3){if(_0x5e67e3[_0xc869('0x4b')]){var _0x4f2508=moment()['format'](_0xc869('0xf7'));for(var _0x41d9bd=0x0,_0x4a0b2a=_0x5e67e3['length'];_0x41d9bd<_0x4a0b2a;_0x41d9bd++){_0x5e67e3[_0x41d9bd][_0xc869('0x100')]({'exitAt':_0x4f2508});}}})[_0xc869('0x16')](function(){var _0x3e4a5f=[];var _0x5642e0=utils[_0xc869('0xf6')]();_0x5642e0[_0xc869('0xf5')](function(_0xf554ac){_0x3e4a5f['push']({'channel':_0xf554ac,'membername':_0x4eebaa[_0xc869('0x36')],'interface':_[_0xc869('0x67')](_0x4eebaa['interface'])?util['format'](_0xc869('0xae'),_0x4eebaa[_0xc869('0x36')]):_0x4eebaa[_0xc869('0x9f')],'type':_0xc869('0xfa'),'enterAt':moment()[_0xc869('0xad')](_0xc869('0xf7')),'data1':_0x173a19[_0xc869('0x5d')][_0xc869('0x3b')]||'DEFAULT\x20PAUSE','role':_0x4eebaa[_0xc869('0x34')],'internal':_0x4eebaa['internal']});});return db[_0xc869('0xfb')]['bulkCreate'](_0x3e4a5f,{'individualHooks':!![]});})[_0xc869('0x16')](function(){return _0x4eebaa['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x173a19[_0xc869('0x5d')]['type']||_0xc869('0x101'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0xc869('0x16')](respondWithResult(_0x2d5289,null))['catch'](handleError(_0x2d5289,null));};exports[_0xc869('0x102')]=function(_0x7f1ea8,_0x53e9a0){var _0x138c29;return db['User']['find']({'where':{'id':_0x7f1ea8['params']['id']},'attributes':['id',_0xc869('0x36'),_0xc869('0x34'),'voicePause',_0xc869('0x103'),_0xc869('0x104'),_0xc869('0x105'),_0xc869('0x106'),'smsPause',_0xc869('0x107'),_0xc869('0x108'),_0xc869('0x109')]})['then'](handleEntityNotFound(_0x53e9a0,null))[_0xc869('0x16')](function(_0x1fd9f7){if(_0x1fd9f7){_0x138c29=_0x1fd9f7;if(_0x7f1ea8['body'][_0xc869('0x9b')]&&!utils['isValidChannel'](_0x7f1ea8[_0xc869('0x5d')]['channel'])){throw new db['Sequelize'][(_0xc869('0x90'))](_0xc869('0xa1'));}switch(_0x7f1ea8[_0xc869('0x5d')][_0xc869('0x9b')]){case _0xc869('0xab'):return respondWithRpcPromise(_0xc869('0xfe'),_0xc869('0x102'),{'id':_0x138c29['id'],'name':_0x138c29[_0xc869('0x36')],'pause':![]})[_0xc869('0x16')](function(){return db[_0xc869('0xaf')][_0xc869('0x28')]({'paused':0x0},{'where':{'UserId':_0x138c29['id']},'individualHooks':!![]});})[_0xc869('0x16')](function(){return db['MemberReport']['find']({'where':{'channel':_0x7f1ea8['body'][_0xc869('0x9b')],'membername':_0x138c29[_0xc869('0x36')],'type':_0xc869('0xfa'),'exitAt':null}});})[_0xc869('0x16')](function(_0x591b75){if(_0x591b75){return _0x591b75[_0xc869('0x28')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xc869('0x10a')},{'individualHooks':!![]});}return null;})[_0xc869('0x16')](function(){return _0x138c29[_0xc869('0x28')]({'voicePause':![]});});case _0xc869('0x5c'):case _0xc869('0x4d'):case _0xc869('0x50'):case _0xc869('0x4f'):case _0xc869('0x52'):case _0xc869('0x51'):return db[_0xc869('0xfb')]['find']({'where':{'channel':_0x7f1ea8[_0xc869('0x5d')][_0xc869('0x9b')],'membername':_0x138c29[_0xc869('0x36')],'type':'PAUSE','exitAt':null}})[_0xc869('0x16')](function(_0x1b407d){if(_0x1b407d){return _0x1b407d[_0xc869('0x28')]({'exitAt':moment()[_0xc869('0xad')](_0xc869('0xf7')),'data2':_0xc869('0x10a')},{'individualHooks':!![]});}return null;})[_0xc869('0x16')](function(){var _0x7209f9={};_[_0xc869('0x26')](_0x7209f9,util[_0xc869('0xad')](_0xc869('0x10b'),_0x7f1ea8[_0xc869('0x5d')][_0xc869('0x9b')],_0xc869('0x10c')),![]);return _0x138c29[_0xc869('0x28')](_0x7209f9);});default:return respondWithRpcPromise(_0xc869('0xfe'),_0xc869('0x102'),{'id':_0x138c29['id'],'name':_0x138c29[_0xc869('0x36')],'pause':![]})[_0xc869('0x16')](function(){return db[_0xc869('0xaf')]['update']({'paused':0x0},{'where':{'UserId':_0x138c29['id']}});})[_0xc869('0x16')](function(){return db['MemberReport'][_0xc869('0x47')]({'where':{'membername':_0x138c29[_0xc869('0x36')],'type':_0xc869('0xfa'),'exitAt':null}});})['then'](function(_0x29050c){var _0x30ca48=[];_0x29050c[_0xc869('0xf5')](function(_0x2618a3){_0x30ca48[_0xc869('0x4c')](_0x2618a3['update']({'exitAt':moment()[_0xc869('0xad')](_0xc869('0xf7')),'data2':_0xc869('0x10a')}));});return BPromise['all'](_0x30ca48);})[_0xc869('0x16')](function(){return _0x138c29['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x53e9a0,null))[_0xc869('0x1e')](handleError(_0x53e9a0,null));};exports[_0xc869('0x10d')]=function(_0x1fb5e3,_0x2ae7d6){var _0x374241={};var _0x2e3f2f={};var _0x40d949;var _0x2cfd47;return db[_0xc869('0x3a')]['findOne']({'where':{'id':_0x1fb5e3[_0xc869('0x54')]['id']}})['then'](handleEntityNotFound(_0x2ae7d6,null))[_0xc869('0x16')](function(_0x2bc54c){if(_0x2bc54c){_0x40d949=_0x2bc54c;_0x2e3f2f[_0xc869('0x55')]=_['keys'](db['Team'][_0xc869('0x56')]);_0x2e3f2f['query']=_[_0xc869('0x57')](_0x1fb5e3['query']);_0x2e3f2f[_0xc869('0x58')]=_['intersection'](_0x2e3f2f[_0xc869('0x55')],_0x2e3f2f[_0xc869('0x41')]);_0x374241[_0xc869('0x46')]=_[_0xc869('0x59')](_0x2e3f2f['model'],qs[_0xc869('0x5a')](_0x1fb5e3[_0xc869('0x41')][_0xc869('0x5a')]));_0x374241[_0xc869('0x46')]=_0x374241['attributes']['length']?_0x374241['attributes']:_0x2e3f2f[_0xc869('0x55')];_0x374241[_0xc869('0xca')]=qs[_0xc869('0xcb')](_0x1fb5e3['query'][_0xc869('0xcb')]);_0x374241[_0xc869('0x40')]=qs[_0xc869('0x58')](_[_0xc869('0xcc')](_0x1fb5e3[_0xc869('0x41')],_0x2e3f2f[_0xc869('0x58')]));if(_0x1fb5e3['query'][_0xc869('0x30')]){_0x374241[_0xc869('0x40')]=_[_0xc869('0x5b')](_0x374241[_0xc869('0x40')],{'$or':_['map'](_0x374241[_0xc869('0x46')],function(_0xbae9d){var _0x3be695={};_0x3be695[_0xbae9d]={'$like':'%'+_0x1fb5e3[_0xc869('0x41')][_0xc869('0x30')]+'%'};return _0x3be695;})});}_0x374241=_[_0xc869('0x5b')]({},_0x374241,_0x1fb5e3[_0xc869('0xcd')]);return _0x40d949['getTeams'](_0x374241);}})[_0xc869('0x16')](function(_0x1e9f98){if(_0x1e9f98){_0x2cfd47=_0x1e9f98[_0xc869('0x4b')];if(!_0x1fb5e3[_0xc869('0x41')]['hasOwnProperty'](_0xc869('0xd2'))){_0x374241['limit']=qs[_0xc869('0x25')](_0x1fb5e3['query'][_0xc869('0x25')]);_0x374241[_0xc869('0x22')]=qs[_0xc869('0x22')](_0x1fb5e3['query'][_0xc869('0x22')]);}return _0x40d949['getTeams'](_0x374241);}})['then'](function(_0x4ad747){if(_0x4ad747){return _0x4ad747?{'count':_0x2cfd47,'rows':_0x4ad747}:null;}})[_0xc869('0x16')](respondWithResult(_0x2ae7d6,null))[_0xc869('0x1e')](handleError(_0x2ae7d6,null));};exports[_0xc869('0x10e')]=function(_0x558802,_0x197d15){return db[_0xc869('0x3a')][_0xc869('0x35')]({'where':{'id':_0x558802['params']['id']}})[_0xc869('0x16')](handleEntityNotFound(_0x197d15,null))[_0xc869('0x16')](function(_0x455ef5){if(_0x455ef5){var _0x47706c=_0x455ef5['get']({'plain':!![]});return _0x455ef5[_0xc869('0x10e')](_0x558802[_0xc869('0x5d')]['ids'],_[_0xc869('0x10f')](_0x558802[_0xc869('0x5d')],['ids','id'])||{})[_0xc869('0x16')](function(){for(var _0x3c1bf8=0x0;_0x3c1bf8<_0x558802['body'][_0xc869('0x60')]['length'];_0x3c1bf8++){var _0x226ecb=[];var _0x39e1bf={};db[_0xc869('0x110')][_0xc869('0x94')]({'where':{'id':_0x558802[_0xc869('0x5d')][_0xc869('0x60')][_0x3c1bf8]}})['then'](function(_0x2e930d){_0x39e1bf=_0x2e930d['dataValues'];_0x226ecb[_0xc869('0x4c')](_0x2e930d[_0xc869('0xf3')]()[_0xc869('0x16')](function(_0xc2e4ba){for(var _0x24093d=0x0;_0x24093d<_0xc2e4ba['length'];_0x24093d++){_0xc2e4ba[_0x24093d]['setDataValue'](_0xc869('0x9b'),_0xc869('0x111'));}return _0xc2e4ba;}));_0x226ecb[_0xc869('0x4c')](_0x2e930d[_0xc869('0x112')]()[_0xc869('0x16')](function(_0x5232e5){for(var _0x2703f2=0x0;_0x2703f2<_0x5232e5[_0xc869('0x4b')];_0x2703f2++){_0x5232e5[_0x2703f2][_0xc869('0x113')](_0xc869('0x9b'),_0xc869('0x114'));}return _0x5232e5;}));_0x226ecb[_0xc869('0x4c')](_0x2e930d[_0xc869('0x115')]()[_0xc869('0x16')](function(_0x529762){for(var _0xb13de2=0x0;_0xb13de2<_0x529762[_0xc869('0x4b')];_0xb13de2++){_0x529762[_0xb13de2][_0xc869('0x113')](_0xc869('0x9b'),_0xc869('0x116'));}return _0x529762;}));_0x226ecb[_0xc869('0x4c')](_0x2e930d[_0xc869('0x117')]()[_0xc869('0x16')](function(_0x47ef2d){for(var _0x1d1c3c=0x0;_0x1d1c3c<_0x47ef2d[_0xc869('0x4b')];_0x1d1c3c++){_0x47ef2d[_0x1d1c3c][_0xc869('0x113')](_0xc869('0x9b'),_0xc869('0x118'));}return _0x47ef2d;}));_0x226ecb[_0xc869('0x4c')](_0x2e930d[_0xc869('0x119')]()[_0xc869('0x16')](function(_0x49e170){for(var _0x38b24b=0x0;_0x38b24b<_0x49e170[_0xc869('0x4b')];_0x38b24b++){_0x49e170[_0x38b24b][_0xc869('0x113')](_0xc869('0x9b'),'Whatsapp');}return _0x49e170;}));_0x226ecb[_0xc869('0x4c')](_0x2e930d[_0xc869('0x11a')]()[_0xc869('0x16')](function(_0x1eb281){for(var _0x3cff5a=0x0;_0x3cff5a<_0x1eb281[_0xc869('0x4b')];_0x3cff5a++){_0x1eb281[_0x3cff5a][_0xc869('0x113')]('channel','Fax');}return _0x1eb281;}));_0x226ecb[_0xc869('0x4c')](_0x2e930d[_0xc869('0x11b')]()[_0xc869('0x16')](function(_0x1bcc6a){for(var _0x428539=0x0;_0x428539<_0x1bcc6a[_0xc869('0x4b')];_0x428539++){_0x1bcc6a[_0x428539][_0xc869('0x113')](_0xc869('0x9b'),_0xc869('0x11c'));}return _0x1bcc6a;}));return BPromise[_0xc869('0x53')](_0x226ecb);})[_0xc869('0x16')](function(_0x7de5f6){var _0x184f80=_[_0xc869('0x11d')](_0x7de5f6);_0x226ecb=[];return db['sequelize'][_0xc869('0x11e')](function(_0x462325){for(var _0x514fd1=0x0;_0x514fd1<_0x184f80[_0xc869('0x4b')];_0x514fd1++){_0x226ecb[_0xc869('0x4c')](_0x184f80[_0x514fd1][_0xc869('0x11f')](_0x47706c['id']),{'transaction':_0x462325});}return BPromise[_0xc869('0x53')](_0x226ecb)['then'](function(){if(_0x47706c['online']){return BPromise['each'](_[_0xc869('0x30')](_0x184f80,function(_0x4f39eb){return _0x4f39eb[_0xc869('0x120')](_0xc869('0x9b'))===_0xc869('0x111');}),function(_0x5db10c){return db[_0xc869('0xaf')][_0xc869('0x121')]({'membername':_0x47706c[_0xc869('0x36')],'UserId':_0x47706c['id'],'queue_name':_0x5db10c[_0xc869('0x36')],'VoiceQueueId':_0x5db10c['id'],'interface':_[_0xc869('0x67')](_0x47706c[_0xc869('0x9f')])?util['format']('SIP/%s',_0x47706c[_0xc869('0x36')]):_0x47706c[_0xc869('0x9f')],'paused':_0x47706c[_0xc869('0x9e')]||![],'penalty':_0x47706c[_0xc869('0xa6')]},{'transaction':_0x462325});});}else{return;}})[_0xc869('0x16')](function(){for(var _0x71e98a=0x0;_0x71e98a<_0x184f80['length'];_0x71e98a++){var _0x1e47f4=_0x184f80[_0x71e98a][_0xc869('0x120')](_0xc869('0x9b'));var _0x1ca6b5=_0x1e47f4+_0xc869('0xa8');socket[_0xc869('0xa9')](_0xc869('0x2c')+_0x1e47f4+_0xc869('0xaa'),{'UserId':_0x47706c['id'],['queueField']:_0x184f80[_0x71e98a]['id']});}});});})[_0xc869('0x16')](function(){db['TeamVoicePrefix'][_0xc869('0x94')]({'where':{'teamId':_0x39e1bf['id']}})[_0xc869('0x16')](function(_0x37a5a6){if(_0x37a5a6){db[_0xc869('0x122')][_0xc869('0x7f')]({'UserId':_0x558802['params']['id'],'VoicePrefixId':_0x37a5a6[_0xc869('0x123')]});}});});}});}})['then'](respondWithStatusCode(_0x197d15,null))[_0xc869('0x1e')](handleError(_0x197d15,null));};exports[_0xc869('0x124')]=function(_0x17f159,_0x4d9018){return db[_0xc869('0x3a')][_0xc869('0x94')]({'where':{'id':_0x17f159[_0xc869('0x54')]['id']}})[_0xc869('0x16')](handleEntityNotFound(_0x4d9018,null))['then'](function(_0x50d3f6){if(_0x50d3f6){var _0x2673ba=_0x50d3f6[_0xc869('0xac')]({'plain':!![]});var _0x511cc0=_0x17f159['query'][_0xc869('0x60')];return _0x50d3f6['removeTeams'](_0x511cc0)[_0xc869('0x16')](function(){for(var _0x2339a4=0x0;_0x2339a4<_0x511cc0['length'];_0x2339a4++){var _0x236533=[];var _0x36b4aa={};db['Team'][_0xc869('0x94')]({'where':{'id':_0x511cc0[_0x2339a4]}})[_0xc869('0x16')](function(_0x5108f3){_0x36b4aa=_0x5108f3[_0xc869('0x4e')];_0x236533[_0xc869('0x4c')](_0x5108f3['getVoiceQueues']()[_0xc869('0x16')](function(_0x3ebb67){for(var _0x50a001=0x0;_0x50a001<_0x3ebb67['length'];_0x50a001++){_0x3ebb67[_0x50a001]['setDataValue'](_0xc869('0x9b'),_0xc869('0x111'));}return _0x3ebb67;}));_0x236533[_0xc869('0x4c')](_0x5108f3[_0xc869('0x112')]()['then'](function(_0x5ba763){for(var _0x6841b5=0x0;_0x6841b5<_0x5ba763['length'];_0x6841b5++){_0x5ba763[_0x6841b5][_0xc869('0x113')]('channel',_0xc869('0x114'));}return _0x5ba763;}));_0x236533[_0xc869('0x4c')](_0x5108f3[_0xc869('0x115')]()[_0xc869('0x16')](function(_0x3878c9){for(var _0x2ca47b=0x0;_0x2ca47b<_0x3878c9[_0xc869('0x4b')];_0x2ca47b++){_0x3878c9[_0x2ca47b][_0xc869('0x113')](_0xc869('0x9b'),'Mail');}return _0x3878c9;}));_0x236533[_0xc869('0x4c')](_0x5108f3[_0xc869('0x117')]()['then'](function(_0x239a30){for(var _0x4b991c=0x0;_0x4b991c<_0x239a30[_0xc869('0x4b')];_0x4b991c++){_0x239a30[_0x4b991c][_0xc869('0x113')](_0xc869('0x9b'),_0xc869('0x118'));}return _0x239a30;}));_0x236533[_0xc869('0x4c')](_0x5108f3['getWhatsappQueues']()[_0xc869('0x16')](function(_0x42844c){for(var _0x1c72c9=0x0;_0x1c72c9<_0x42844c[_0xc869('0x4b')];_0x1c72c9++){_0x42844c[_0x1c72c9][_0xc869('0x113')]('channel',_0xc869('0x125'));}return _0x42844c;}));_0x236533[_0xc869('0x4c')](_0x5108f3[_0xc869('0x11a')]()[_0xc869('0x16')](function(_0x13c4d3){for(var _0x593fc3=0x0;_0x593fc3<_0x13c4d3[_0xc869('0x4b')];_0x593fc3++){_0x13c4d3[_0x593fc3][_0xc869('0x113')](_0xc869('0x9b'),_0xc869('0x126'));}return _0x13c4d3;}));_0x236533[_0xc869('0x4c')](_0x5108f3[_0xc869('0x11b')]()[_0xc869('0x16')](function(_0x1a9c93){for(var _0x4f5eda=0x0;_0x4f5eda<_0x1a9c93[_0xc869('0x4b')];_0x4f5eda++){_0x1a9c93[_0x4f5eda][_0xc869('0x113')](_0xc869('0x9b'),_0xc869('0x11c'));}return _0x1a9c93;}));return BPromise[_0xc869('0x53')](_0x236533);})[_0xc869('0x16')](function(_0x5ea054){var _0x290cb3=_[_0xc869('0x11d')](_0x5ea054);_0x236533=[];return db[_0xc869('0x127')]['transaction'](function(_0x805748){for(var _0x39f0c6=0x0;_0x39f0c6<_0x290cb3[_0xc869('0x4b')];_0x39f0c6++){_0x236533[_0xc869('0x4c')](_0x290cb3[_0x39f0c6][_0xc869('0x128')](_0x2673ba['id']),{'transaction':_0x805748});}return BPromise[_0xc869('0x53')](_0x236533)[_0xc869('0x16')](function(){if(_0x2673ba['online']){return BPromise[_0xc869('0x8a')](_[_0xc869('0x30')](_0x290cb3,function(_0x554168){return _0x554168['getDataValue']('channel')===_0xc869('0x111');}),function(_0x1a971d){return db[_0xc869('0xaf')]['destroy']({'where':{'VoiceQueueId':_0x1a971d['id'],'UserId':_0x2673ba['id']},'transaction':_0x805748});});}else{return;}})[_0xc869('0x16')](function(){db[_0xc869('0x129')][_0xc869('0x94')]({'where':{'teamId':_0x36b4aa['id']}})['then'](function(_0x5463ff){if(_0x5463ff){return db[_0xc869('0x122')][_0xc869('0x29')]({'where':{'UserId':_0x2673ba['id'],'VoicePrefixId':_0x5463ff[_0xc869('0x4e')]['VoicePrefixId']}});}});})[_0xc869('0x16')](function(){for(var _0x1a4859=0x0;_0x1a4859<_0x290cb3[_0xc869('0x4b')];_0x1a4859++){var _0x14fa6f=_0x290cb3[_0x1a4859][_0xc869('0x120')](_0xc869('0x9b'));var _0x448610=_0x14fa6f+'QueueId';socket['emit'](_0xc869('0x2c')+_0x14fa6f+_0xc869('0xb3'),{'UserId':_0x2673ba['id'],['queueField']:_0x290cb3[_0x1a4859]['id']});}});});});}});}})[_0xc869('0x16')](respondWithStatusCode(_0x4d9018,null))[_0xc869('0x1e')](handleError(_0x4d9018,null));};exports[_0xc869('0x12a')]=function(_0x32a2d8,_0xd4194b){var _0x41fa68={};var _0x2a68a9={};var _0x1d2d8d;var _0x22cd98;return db['User'][_0xc869('0x94')]({'where':{'id':_0x32a2d8[_0xc869('0x54')]['id']}})[_0xc869('0x16')](handleEntityNotFound(_0xd4194b,null))[_0xc869('0x16')](function(_0x14ea01){if(_0x14ea01){_0x1d2d8d=_0x14ea01;_0x2a68a9[_0xc869('0x55')]=_['keys'](db[_0xc869('0x12b')][_0xc869('0x56')]);_0x2a68a9[_0xc869('0x41')]=_[_0xc869('0x57')](_0x32a2d8[_0xc869('0x41')]);_0x2a68a9[_0xc869('0x58')]=_[_0xc869('0x59')](_0x2a68a9[_0xc869('0x55')],_0x2a68a9[_0xc869('0x41')]);_0x41fa68[_0xc869('0x46')]=_[_0xc869('0x59')](_0x2a68a9['model'],qs[_0xc869('0x5a')](_0x32a2d8[_0xc869('0x41')][_0xc869('0x5a')]));_0x41fa68['attributes']=_0x41fa68[_0xc869('0x46')][_0xc869('0x4b')]?_0x41fa68[_0xc869('0x46')]:_0x2a68a9[_0xc869('0x55')];_0x41fa68[_0xc869('0xca')]=qs[_0xc869('0xcb')](_0x32a2d8[_0xc869('0x41')][_0xc869('0xcb')]);_0x41fa68[_0xc869('0x40')]=qs[_0xc869('0x58')](_[_0xc869('0xcc')](_0x32a2d8[_0xc869('0x41')],_0x2a68a9['filters']));if(_0x32a2d8[_0xc869('0x41')][_0xc869('0x30')]){_0x41fa68[_0xc869('0x40')]=_['merge'](_0x41fa68['where'],{'$or':_[_0xc869('0x32')](_0x41fa68[_0xc869('0x46')],function(_0x5b71b3){var _0x535f97={};_0x535f97[_0x5b71b3]={'$like':'%'+_0x32a2d8[_0xc869('0x41')][_0xc869('0x30')]+'%'};return _0x535f97;})});}_0x41fa68=_[_0xc869('0x5b')]({},_0x41fa68,_0x32a2d8[_0xc869('0xcd')]);return _0x1d2d8d[_0xc869('0x12a')](_0x41fa68);}})['then'](function(_0x228e73){if(_0x228e73){_0x22cd98=_0x228e73['length'];if(!_0x32a2d8[_0xc869('0x41')][_0xc869('0xce')](_0xc869('0xd2'))){_0x41fa68[_0xc869('0x25')]=qs[_0xc869('0x25')](_0x32a2d8[_0xc869('0x41')][_0xc869('0x25')]);_0x41fa68[_0xc869('0x22')]=qs[_0xc869('0x22')](_0x32a2d8[_0xc869('0x41')][_0xc869('0x22')]);}return _0x1d2d8d[_0xc869('0x12a')](_0x41fa68);}})[_0xc869('0x16')](function(_0x393522){if(_0x393522){return _0x393522?{'count':_0x22cd98,'rows':_0x393522}:null;}})['then'](respondWithResult(_0xd4194b,null))[_0xc869('0x1e')](handleError(_0xd4194b,null));};exports['getAgents']=function(_0xd88b63,_0x5bc83d){var _0x2137c5={};var _0x1c4262={};var _0x4ae669;return db[_0xc869('0x3a')][_0xc869('0x94')]({'where':{'id':_0xd88b63['params']['id']}})['then'](handleEntityNotFound(_0x5bc83d,null))[_0xc869('0x16')](function(_0x3c0401){if(_0x3c0401){_0x4ae669=_0x3c0401;_0x1c4262[_0xc869('0x55')]=_['keys'](db[_0xc869('0x3a')][_0xc869('0x56')]);_0x1c4262['query']=_['keys'](_0xd88b63['query']);_0x1c4262['filters']=_[_0xc869('0x59')](_0x1c4262[_0xc869('0x55')],_0x1c4262['query']);_0x2137c5[_0xc869('0x46')]=_['intersection'](_0x1c4262['model'],qs[_0xc869('0x5a')](_0xd88b63[_0xc869('0x41')][_0xc869('0x5a')]));_0x2137c5[_0xc869('0x46')]=_0x2137c5[_0xc869('0x46')][_0xc869('0x4b')]?_0x2137c5[_0xc869('0x46')]:_0x1c4262['model'];_0x2137c5['order']=qs[_0xc869('0xcb')](_0xd88b63['query'][_0xc869('0xcb')]);_0x2137c5[_0xc869('0x40')]=qs['filters'](_[_0xc869('0xcc')](_0xd88b63['query'],_0x1c4262[_0xc869('0x58')]));if(_0xd88b63[_0xc869('0x41')]['filter']){_0x2137c5[_0xc869('0x40')]=_[_0xc869('0x5b')](_0x2137c5[_0xc869('0x40')],{'$or':_[_0xc869('0x32')](_0x2137c5[_0xc869('0x46')],function(_0x44af6b){var _0x29aecd={};_0x29aecd[_0x44af6b]={'$like':'%'+_0xd88b63['query'][_0xc869('0x30')]+'%'};return _0x29aecd;})});}_0x2137c5['model']=db[_0xc869('0x3a')];_0x2137c5['as']=_0xc869('0x2d');_0x2137c5=_[_0xc869('0x5b')]({},_0x2137c5,_0xd88b63['options']);return _0x4ae669[_0xc869('0xf3')]({'include':[_0x2137c5]});}})['then'](function(_0x54cd57){if(_0x54cd57){var _0x3fdde1={},_0x439aa1=[];for(var _0x4dff24=0x0;_0x4dff24<_0x54cd57[_0xc869('0x4b')];_0x4dff24+=0x1){for(var _0x29ac8d=0x0,_0x52d59b;_0x29ac8d<_0x54cd57[_0x4dff24]['Agents'][_0xc869('0x4b')];_0x29ac8d+=0x1){_0x52d59b=_0x54cd57[_0x4dff24][_0xc869('0x2d')][_0x29ac8d][_0xc869('0xac')]({'plain':!![]});_0x3fdde1[_0x52d59b['id']]=_0x52d59b;}}_0x3fdde1=_[_0xc869('0x12c')](_0x3fdde1);for(var _0x2b1d84=qs[_0xc869('0x22')](_0xd88b63[_0xc869('0x41')]['offset']);_0x2b1d84<_0x3fdde1[_0xc869('0x4b')]&&_0x439aa1['length']=_0x20e022){_0x4ec9d8=_0x20e022;_0x3401f8=0xc8;}else{_0x3401f8=0xce;}_0x429200['status'](_0x3401f8);return _0x429200['set'](_0xfe6e('0x29'),_0x3df462+'-'+_0x4ec9d8+'/'+_0x20e022)[_0xfe6e('0x24')](_0x583538);}return null;};}function saveUpdates(_0x2aa9ad){return function(_0x43e371){if(_0x43e371){return _0x43e371[_0xfe6e('0x2a')](_0x2aa9ad)[_0xfe6e('0x19')](function(_0x42b4a0){return _0x42b4a0;});}return null;};}function removeEntity(_0x115897){return function(_0x240ef7){if(_0x240ef7){return _0x240ef7[_0xfe6e('0x2b')]()[_0xfe6e('0x19')](function(){var _0x49e6f1=_0x240ef7[_0xfe6e('0x2c')]({'plain':!![]});if(_0x49e6f1[_0xfe6e('0x2d')]===_0xfe6e('0x2e'))return;var _0x415d8c=[{'name':_0xfe6e('0x2f'),'value':_0xfe6e('0x30'),'ignore':!![]},{'name':_0xfe6e('0x31'),'value':_0xfe6e('0x32'),'ignore':![]},{'name':_0xfe6e('0x33'),'value':'telephone','ignore':![]}];var _0x252026=_(_0x415d8c)[_0xfe6e('0x34')](_0xfe6e('0x35'))[_0xfe6e('0x36')](_0xfe6e('0x37'))[_0xfe6e('0x37')]();if(_['includes'](_0x252026,_0x49e6f1['role'])){return;}var _0x165b3d=_[_0xfe6e('0x38')](_0x415d8c,[_0xfe6e('0x37'),_0x49e6f1[_0xfe6e('0x2d')]])['name'];return db[_0xfe6e('0x39')]['destroy']({'where':{'type':_0x165b3d,'resourceId':_0x49e6f1['id']}})[_0xfe6e('0x19')](function(){return _0x240ef7;});})[_0xfe6e('0x19')](function(){_0x115897[_0xfe6e('0x23')](0xcc)[_0xfe6e('0x3a')]();});}};}function handleEntityNotFound(_0x4cfa52){return function(_0x20aa11){if(!_0x20aa11){_0x4cfa52[_0xfe6e('0x3b')](0x194);}return _0x20aa11;};}function handleError(_0x493d3f,_0x4e5bad){_0x4e5bad=_0x4e5bad||0x1f4;return function(_0x21d11a){logger['error'](_0x21d11a[_0xfe6e('0x3c')]);if(_0x21d11a[_0xfe6e('0x3d')]){delete _0x21d11a[_0xfe6e('0x3d')];}_0x493d3f[_0xfe6e('0x23')](_0x4e5bad)['send'](_0x21d11a);};}exports[_0xfe6e('0x3e')]=function(_0x185740,_0x4e732b){var _0x24eec1={},_0x58e5a0={'count':0x0,'rows':[]};var _0x385957=_(db[_0xfe6e('0x3f')][_0xfe6e('0x40')])[_0xfe6e('0x36')](function(_0x4ee3b1){return{'name':_0x4ee3b1[_0xfe6e('0x41')],'type':_0x4ee3b1[_0xfe6e('0x42')]['key']};})[_0xfe6e('0x34')](function(_0x21bc6d){return!_['includes']([_0xfe6e('0x43'),_0xfe6e('0x44')],_0x21bc6d['name']);})['value']();_0x24eec1=qs[_0xfe6e('0x45')](_0x385957,_0x185740);var _0x43ac1b={'where':_0x24eec1[_0xfe6e('0x46')]};return db[_0xfe6e('0x3f')]['count'](_0x43ac1b)[_0xfe6e('0x19')](function(_0x1ffe1c){_0x58e5a0[_0xfe6e('0x28')]=_0x1ffe1c;if(_0x185740[_0xfe6e('0x47')][_0xfe6e('0x48')]){_0x24eec1['include']=[{'all':!![]}];}if(_0x185740[_0xfe6e('0x47')][_0xfe6e('0x49')]==='true'){_0x24eec1['include']=[{'model':db['UserSetting'],'as':_0xfe6e('0x49')}];}if(!_[_0xfe6e('0x4a')](_0x24eec1[_0xfe6e('0x4b')],'id')){_0x24eec1[_0xfe6e('0x4b')][_0xfe6e('0x4c')]('id');}return db[_0xfe6e('0x3f')]['findAll'](_0x24eec1);})[_0xfe6e('0x19')](function(_0x45c8ac){_0x58e5a0[_0xfe6e('0x4d')]=_0x45c8ac;if(_0x185740[_0xfe6e('0x47')][_0xfe6e('0x4e')]===_0xfe6e('0x4f')){var _0x46ac52=[];for(var _0x701d9d=0x0;_0x701d9d<_0x58e5a0[_0xfe6e('0x4d')][_0xfe6e('0x50')];_0x701d9d++){_0x46ac52[_0xfe6e('0x4c')](get_open_tabs('chat',_0x58e5a0[_0xfe6e('0x4d')][_0x701d9d]['dataValues']));_0x46ac52[_0xfe6e('0x4c')](get_open_tabs('sms',_0x58e5a0[_0xfe6e('0x4d')][_0x701d9d][_0xfe6e('0x51')]));_0x46ac52[_0xfe6e('0x4c')](get_open_tabs(_0xfe6e('0x52'),_0x58e5a0[_0xfe6e('0x4d')][_0x701d9d][_0xfe6e('0x51')]));_0x46ac52[_0xfe6e('0x4c')](get_open_tabs(_0xfe6e('0x53'),_0x58e5a0[_0xfe6e('0x4d')][_0x701d9d][_0xfe6e('0x51')]));_0x46ac52[_0xfe6e('0x4c')](get_open_tabs(_0xfe6e('0x54'),_0x58e5a0['rows'][_0x701d9d][_0xfe6e('0x51')]));_0x46ac52['push'](get_open_tabs(_0xfe6e('0x55'),_0x58e5a0[_0xfe6e('0x4d')][_0x701d9d][_0xfe6e('0x51')]));}return BPromise['all'](_0x46ac52)['then'](function(){return _0x58e5a0;});}else{return _0x58e5a0;}})['then'](respondWithFilteredResult(_0x4e732b,_0x24eec1))[_0xfe6e('0x56')](handleError(_0x4e732b,null));};exports[_0xfe6e('0x57')]=function(_0x3be971,_0x57f9ac){var _0x539e0c={'raw':![],'where':{'id':_0x3be971[_0xfe6e('0x58')]['id']}},_0x2686a9={};_0x2686a9['model']=_[_0xfe6e('0x59')](_[_0xfe6e('0x5a')](db[_0xfe6e('0x3f')][_0xfe6e('0x40')]),[_0xfe6e('0x43'),'salt']);_0x2686a9['query']=_[_0xfe6e('0x5a')](_0x3be971[_0xfe6e('0x47')]);_0x2686a9['filters']=_[_0xfe6e('0x5b')](_0x2686a9[_0xfe6e('0x5c')],_0x2686a9[_0xfe6e('0x47')]);_0x539e0c[_0xfe6e('0x4b')]=_['intersection'](_0x2686a9[_0xfe6e('0x5c')],qs[_0xfe6e('0x5d')](_0x3be971[_0xfe6e('0x47')][_0xfe6e('0x5d')]));_0x539e0c[_0xfe6e('0x4b')]=_0x539e0c['attributes']['length']?_0x539e0c[_0xfe6e('0x4b')]:_0x2686a9[_0xfe6e('0x5c')];if(_0x3be971[_0xfe6e('0x47')]['includeAll']){_0x539e0c[_0xfe6e('0x5e')]=[{'all':!![]}];}if(_0x3be971[_0xfe6e('0x47')][_0xfe6e('0x49')]===_0xfe6e('0x4f')){_0x539e0c['include']=[{'model':db[_0xfe6e('0x5f')],'as':_0xfe6e('0x49')}];}_0x539e0c=_[_0xfe6e('0x60')]({},_0x539e0c,_0x3be971[_0xfe6e('0x61')]);if(!_[_0xfe6e('0x4a')](_0x539e0c['attributes'],'id')){_0x539e0c['attributes'][_0xfe6e('0x4c')]('id');}return db['User']['find'](_0x539e0c)[_0xfe6e('0x19')](handleEntityNotFound(_0x57f9ac,null))['then'](function(_0x50a454){var _0x5d6f72=[];values=_0x50a454;if(_0x3be971[_0xfe6e('0x47')][_0xfe6e('0x4e')]==='true'){_0x5d6f72[_0xfe6e('0x4c')](get_open_tabs(_0xfe6e('0x62'),_0x50a454[_0xfe6e('0x51')]));_0x5d6f72[_0xfe6e('0x4c')](get_open_tabs(_0xfe6e('0x63'),_0x50a454[_0xfe6e('0x51')]));_0x5d6f72[_0xfe6e('0x4c')](get_open_tabs(_0xfe6e('0x54'),_0x50a454[_0xfe6e('0x51')]));_0x5d6f72[_0xfe6e('0x4c')](get_open_tabs('whatsapp',_0x50a454[_0xfe6e('0x51')]));_0x5d6f72[_0xfe6e('0x4c')](get_open_tabs(_0xfe6e('0x52'),_0x50a454[_0xfe6e('0x51')]));_0x5d6f72[_0xfe6e('0x4c')](get_open_tabs(_0xfe6e('0x53'),_0x50a454[_0xfe6e('0x51')]));return BPromise[_0xfe6e('0x64')](_0x5d6f72);}else{return values;}})[_0xfe6e('0x19')](function(){return values;})[_0xfe6e('0x19')](respondWithResult(_0x57f9ac,null))[_0xfe6e('0x56')](handleError(_0x57f9ac,null));};exports[_0xfe6e('0x2a')]=function(_0x171337,_0x5569a1){if(_0x171337[_0xfe6e('0x65')]['id']){delete _0x171337[_0xfe6e('0x65')]['id'];}delete _0x171337[_0xfe6e('0x65')][_0xfe6e('0x2d')];return db[_0xfe6e('0x3f')][_0xfe6e('0x38')]({'where':{'id':_0x171337[_0xfe6e('0x58')]['id']}})['then'](handleEntityNotFound(_0x5569a1,null))[_0xfe6e('0x19')](saveUpdates(_0x171337[_0xfe6e('0x65')],null))[_0xfe6e('0x19')](respondWithResult(_0x5569a1,null))['catch'](handleError(_0x5569a1,null));};exports[_0xfe6e('0x66')]=function(_0x136453,_0x15c82c){return db[_0xfe6e('0x3f')][_0xfe6e('0x66')]()[_0xfe6e('0x19')](respondWithResult(_0x15c82c,null))[_0xfe6e('0x56')](handleError(_0x15c82c,null));};exports[_0xfe6e('0x67')]=function(_0x3ca426,_0x4cedfc){return db[_0xfe6e('0x3f')][_0xfe6e('0x38')]({'where':{'id':_0x3ca426['params']['id']}})['then'](handleEntityNotFound(_0x4cedfc,null))[_0xfe6e('0x19')](function(_0x18e0bf){if(_0x18e0bf){return _0x18e0bf[_0xfe6e('0x67')](_0x3ca426[_0xfe6e('0x65')][_0xfe6e('0x68')],_['omit'](_0x3ca426[_0xfe6e('0x65')],['ids','id'])||{});}})['then'](respondWithResult(_0x4cedfc,null))['catch'](handleError(_0x4cedfc,null));};function validateUser(_0x559bf0){return new BPromise(function(_0x143a12,_0x53fb7e){if(_0x559bf0[_0xfe6e('0x69')])return _0x143a12(_0x559bf0);return db[_0xfe6e('0x6a')]['findById'](0x1)[_0xfe6e('0x19')](function(_0xb61fd5){if(_0xb61fd5[_0xfe6e('0x6b')])authService[_0xfe6e('0x6c')](_0x559bf0[_0xfe6e('0x43')]);db[_0xfe6e('0x3f')][_0xfe6e('0x6d')]('internal')[_0xfe6e('0x19')](function(_0x4b48e0){if(_[_0xfe6e('0x6e')](_0x4b48e0)){_0x559bf0['internal']=_0xb61fd5[_0xfe6e('0x6f')]||0x1;return;}if(_[_0xfe6e('0x6e')](_0xb61fd5[_0xfe6e('0x6f')])||_0xb61fd5[_0xfe6e('0x6f')]===_0x4b48e0){_0x559bf0[_0xfe6e('0x69')]=_0x4b48e0+0x1;return;}if(_0xb61fd5[_0xfe6e('0x6f')]>_0x4b48e0){_0x559bf0[_0xfe6e('0x69')]=_0xb61fd5[_0xfe6e('0x6f')];return;}return db[_0xfe6e('0x70')][_0xfe6e('0x47')](_0xfe6e('0x71'),{'type':db[_0xfe6e('0x70')][_0xfe6e('0x72')]['SELECT']})[_0xfe6e('0x19')](function(_0x10af0e){if(_0x10af0e&&_0x10af0e[_0xfe6e('0x50')]){for(var _0x419773=0x0,_0x360cf1=_0x10af0e[_0xfe6e('0x50')];_0x419773<_0x360cf1&&_[_0xfe6e('0x6e')](_0x559bf0[_0xfe6e('0x69')]);_0x419773++){if(_0xb61fd5[_0xfe6e('0x6f')]<=_0x10af0e[_0x419773][_0xfe6e('0x73')]){_0x559bf0[_0xfe6e('0x69')]=_0x10af0e[_0x419773][_0xfe6e('0x73')];}else if(_0xb61fd5[_0xfe6e('0x6f')]>_0x10af0e[_0x419773]['from']&&_0xb61fd5[_0xfe6e('0x6f')]<=_0x10af0e[_0x419773]['to']){_0x559bf0['internal']=_0xb61fd5[_0xfe6e('0x6f')];}}}if(_['isNil'](_0x559bf0[_0xfe6e('0x69')])){_0x559bf0['internal']=_0x4b48e0+0x1;}return _0x143a12(_0x559bf0);});});})['catch'](function(_0x21b8a3){_0x53fb7e(_0x21b8a3);});});}function updateUser(_0x129d32){return new BPromise(function(_0xf3b70d,_0x30bacc){try{if(_0x129d32[_0xfe6e('0x74')]){_0x129d32[_0xfe6e('0x75')]=_0x129d32['internal'];_0x129d32[_0xfe6e('0x76')]={'mailbox':_0x129d32[_0xfe6e('0x69')],'password':_0x129d32[_0xfe6e('0x43')],'fullname':_0x129d32[_0xfe6e('0x77')],'email':_0x129d32[_0xfe6e('0x78')]};}if(_0x129d32['role']===_0xfe6e('0x32')){if(!_0x129d32[_0xfe6e('0x79')])_0x129d32[_0xfe6e('0x79')]=['101',_0xfe6e('0x7a'),'103',_0xfe6e('0x7b'),_0xfe6e('0x7c'),_0xfe6e('0x7d'),_0xfe6e('0x7e'),_0xfe6e('0x7f'),_0xfe6e('0x80'),_0xfe6e('0x81'),_0xfe6e('0x82'),'100',_0xfe6e('0x83'),'114',_0xfe6e('0x84')];}_0xf3b70d(_0x129d32);}catch(_0x3e204f){_0x30bacc(_0x3e204f);}});}exports['create']=function(_0x1d4f28,_0x16fa08){if(_0x1d4f28['user']['role']===_0xfe6e('0x32'))throw new Error(_0xfe6e('0x85'));if(_0x1d4f28[_0xfe6e('0x65')]['role']==='user'&&_0x1d4f28['user'][_0xfe6e('0x2d')]!==_0xfe6e('0x2e')){throw new Error(_0xfe6e('0x86'));}if(_0x1d4f28[_0xfe6e('0x65')][_0xfe6e('0x2d')]===_0xfe6e('0x2e')&&_0x1d4f28[_0xfe6e('0x30')][_0xfe6e('0x2d')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0xfe6e('0x87')]([_0x1d4f28[_0xfe6e('0x65')]])[_0xfe6e('0x19')](function(){return validateUser(_0x1d4f28[_0xfe6e('0x65')]);})[_0xfe6e('0x19')](function(_0x2c46fc){return updateUser(_0x2c46fc)[_0xfe6e('0x19')](function(_0xb408cc){if(_0xb408cc[_0xfe6e('0x2d')]==='admin'){_0xb408cc[_0xfe6e('0x88')]=_0x1d4f28[_0xfe6e('0x30')][_0xfe6e('0x88')];delete _0xb408cc[_0xfe6e('0x89')];}return _0xb408cc;});})[_0xfe6e('0x19')](function(_0x46a096){return db[_0xfe6e('0x3f')]['create'](_0x46a096,{'include':[{'model':db[_0xfe6e('0x76')],'as':_0xfe6e('0x76')}]});})[_0xfe6e('0x19')](function(_0x34a345){if(_0x1d4f28[_0xfe6e('0x65')][_0xfe6e('0x2d')]===_0xfe6e('0x30'))return _0x34a345;if(_0x1d4f28[_0xfe6e('0x30')][_0xfe6e('0x2d')]!=='user')return _0x34a345;return db[_0xfe6e('0x8a')][_0xfe6e('0x38')]({'where':{'name':_0x34a345[_0xfe6e('0x2d')]===_0xfe6e('0x32')?_0xfe6e('0x31'):_0xfe6e('0x33'),'userProfileId':_0x1d4f28[_0xfe6e('0x30')]['userProfileId']},'raw':!![]})[_0xfe6e('0x19')](function(_0x34b3a7){if(!_0x34b3a7||_0x34b3a7[_0xfe6e('0x8b')]!=0x0)return _0x34a345;return db[_0xfe6e('0x39')]['create']({'name':_0x34a345[_0xfe6e('0x3d')],'resourceId':_0x34a345['id'],'type':_0x34b3a7[_0xfe6e('0x3d')],'sectionId':_0x34b3a7['id']},{})['then'](function(){return _0x34a345;});})[_0xfe6e('0x56')](function(_0x522813){logger[_0xfe6e('0x1e')](_0xfe6e('0x8c'),_0x522813);throw _0x522813;});})['then'](respondWithResult(_0x16fa08,0xc9))['catch'](handleError(_0x16fa08,null));};exports['bulkCreate']=function(_0x50fad4,_0x60a543){var _0x5deeb3=_0x50fad4[_0xfe6e('0x65')];var _0x176416=[];if(_0x50fad4[_0xfe6e('0x30')][_0xfe6e('0x2d')]===_0xfe6e('0x32'))throw new Error('Unauthorized');if(_['some'](_0x5deeb3,[_0xfe6e('0x2d'),'user'])&&_0x50fad4[_0xfe6e('0x30')][_0xfe6e('0x2d')]!==_0xfe6e('0x2e')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0xfe6e('0x8d')](_0x5deeb3,[_0xfe6e('0x2d'),_0xfe6e('0x2e')])&&_0x50fad4['user'][_0xfe6e('0x2d')]!==_0xfe6e('0x2e')){throw new Error(_0xfe6e('0x8e'));}return licenseUtil['checkUserLimits'](_0x5deeb3)[_0xfe6e('0x19')](function(){return validateUser(_0x5deeb3[0x0]);})['then'](function(){for(var _0x306024=0x1;_0x306024<_0x5deeb3[_0xfe6e('0x50')];_0x306024++){var _0x168bbe=_0x5deeb3[_0x306024-0x1][_0xfe6e('0x69')];if(!_0x5deeb3[_0x306024][_0xfe6e('0x69')])_0x5deeb3[_0x306024]['internal']=_0x168bbe+0x1;_0x176416[_0xfe6e('0x4c')](validateUser(_0x5deeb3[_0x306024]));}return BPromise[_0xfe6e('0x64')](_0x176416);})[_0xfe6e('0x19')](function(){_0x176416=[];for(var _0x1f2f14=0x0;_0x1f2f14<_0x5deeb3['length'];_0x1f2f14++){_0x176416[_0xfe6e('0x4c')](updateUser(_0x5deeb3[_0x1f2f14]));}return BPromise[_0xfe6e('0x64')](_0x176416);})['then'](function(){return BPromise['each'](_0x5deeb3,function(_0x1657c1){return db[_0xfe6e('0x3f')][_0xfe6e('0x8f')](_0x1657c1,{'include':[{'model':db[_0xfe6e('0x76')],'as':'VoiceMail'}]})[_0xfe6e('0x19')](function(_0x35c01b){_0x1657c1['id']=_0x35c01b['id'];return _0x1657c1;});});})[_0xfe6e('0x19')](function(_0x4d2e96){if(_0x50fad4['body'][_0xfe6e('0x2d')]===_0xfe6e('0x30'))return _0x4d2e96;if(_0x50fad4[_0xfe6e('0x30')][_0xfe6e('0x2d')]!==_0xfe6e('0x30'))return _0x4d2e96;var _0x5bcbbf=_[_0xfe6e('0x8d')](_0x4d2e96,function(_0x49aa36){return _0x49aa36[_0xfe6e('0x2d')]===_0xfe6e('0x32')||_0x49aa36['role']===_0xfe6e('0x90');});if(!_0x5bcbbf)return _0x4d2e96;return db[_0xfe6e('0x8a')][_0xfe6e('0x91')]({'where':{'name':{'$or':['Agents',_0xfe6e('0x33')]},'userProfileId':_0x50fad4[_0xfe6e('0x30')][_0xfe6e('0x89')]},'raw':!![]})[_0xfe6e('0x19')](function(_0xba9085){if(_['isEmpty'](_0xba9085)||!_[_0xfe6e('0x8d')](_0xba9085,[_0xfe6e('0x8b'),0x0]))return _0x4d2e96;_0x176416=[];var _0x3f814a=_(_0xba9085)[_0xfe6e('0x36')](function(_0x1ea451){if(_0x1ea451[_0xfe6e('0x8b')]===0x1)return;return _0x1ea451['name']===_0xfe6e('0x31')?_0xfe6e('0x32'):_0xfe6e('0x90');})[_0xfe6e('0x92')]()[_0xfe6e('0x37')]();for(var _0x8d4614=0x0;_0x8d4614<_0x4d2e96[_0xfe6e('0x50')];_0x8d4614++){if(!_['includes'](_0x3f814a,_0x4d2e96[_0x8d4614][_0xfe6e('0x2d')]))return;var _0x986456=_0x4d2e96[_0x8d4614][_0xfe6e('0x2d')]===_0xfe6e('0x32')?_0xfe6e('0x31'):_0xfe6e('0x33');_0x176416[_0xfe6e('0x4c')](db['UserProfileResource'][_0xfe6e('0x8f')]({'name':_0x4d2e96[_0x8d4614]['name'],'resourceId':_0x4d2e96[_0x8d4614]['id'],'type':_0x986456,'sectionId':_[_0xfe6e('0x38')](_0xba9085,[_0xfe6e('0x3d'),_0x986456])['id']},{}));}return BPromise[_0xfe6e('0x64')](_0x176416);});})['then'](respondWithResult(_0x60a543,0xc9))[_0xfe6e('0x56')](handleError(_0x60a543,null));};exports[_0xfe6e('0x93')]=function(_0x38c5f9,_0x13d1f8){if(_0x38c5f9[_0xfe6e('0x65')]['id']){delete _0x38c5f9['body']['id'];}return db[_0xfe6e('0x3f')][_0xfe6e('0x38')]({'where':{'id':_0x38c5f9[_0xfe6e('0x58')]['id']}})[_0xfe6e('0x19')](function(_0x469701){if(!_0x469701)return null;if(_0x469701['id']===_0x38c5f9['user']['id']){if(!_0x38c5f9[_0xfe6e('0x65')][_0xfe6e('0x94')]||!_0x38c5f9['body'][_0xfe6e('0x95')]){throw new db[(_0xfe6e('0x96'))][(_0xfe6e('0x97'))](_0xfe6e('0x98'));}if(!_0x469701[_0xfe6e('0x99')](_0x38c5f9[_0xfe6e('0x65')][_0xfe6e('0x94')])){throw new db[(_0xfe6e('0x96'))]['ValidationError'](_0xfe6e('0x9a'));}if(_0x38c5f9[_0xfe6e('0x65')]['oldPassword']===_0x38c5f9[_0xfe6e('0x65')][_0xfe6e('0x95')]){throw new db[(_0xfe6e('0x96'))][(_0xfe6e('0x97'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x38c5f9[_0xfe6e('0x30')][_0xfe6e('0x2d')]===_0xfe6e('0x2e')){if(!_0x38c5f9[_0xfe6e('0x65')][_0xfe6e('0x95')]){throw new db['Sequelize'][(_0xfe6e('0x97'))](_0xfe6e('0x9b'));}}else if(_0x38c5f9[_0xfe6e('0x30')][_0xfe6e('0x2d')]===_0xfe6e('0x30')){if(!_0x38c5f9[_0xfe6e('0x65')][_0xfe6e('0x95')]){throw new db['Sequelize'][(_0xfe6e('0x97'))](_0xfe6e('0x9b'));}if(_0x469701['role']!==_0xfe6e('0x32')){throw new db['Sequelize']['ValidationError'](_0xfe6e('0x85'));}}else{throw new db[(_0xfe6e('0x96'))][(_0xfe6e('0x97'))](_0xfe6e('0x85'));}return _0x469701;})[_0xfe6e('0x19')](handleEntityNotFound(_0x13d1f8,null))[_0xfe6e('0x19')](function(_0x2e57bd){return db[_0xfe6e('0x6a')][_0xfe6e('0x9c')]({'attributes':['id',_0xfe6e('0x6b'),_0xfe6e('0x9d'),'passwordHistoryLimit']})['then'](function(_0x2719aa){if(_0x2719aa[_0xfe6e('0x6b')])authService[_0xfe6e('0x6c')](_0x38c5f9[_0xfe6e('0x65')][_0xfe6e('0x95')]);if(!_0x2719aa[_0xfe6e('0x9d')]||!_0x2e57bd[_0xfe6e('0x9e')])return _0x2e57bd;authService['validatePasswordHistory'](_0x38c5f9['body'][_0xfe6e('0x95')],_0x2e57bd[_0xfe6e('0x9e')],_0x2719aa[_0xfe6e('0x9f')]);return _0x2e57bd;})[_0xfe6e('0x19')](saveUpdates({'password':_0x38c5f9[_0xfe6e('0x65')][_0xfe6e('0x95')],'passwordResetAt':_0x38c5f9[_0xfe6e('0x30')]['id']==_0x38c5f9['params']['id']?moment():null,'previousPasswords':authService[_0xfe6e('0xa0')](_0x38c5f9[_0xfe6e('0x65')][_0xfe6e('0x95')],_0x2e57bd[_0xfe6e('0x9e')])},null));})[_0xfe6e('0x19')](respondWithResult(_0x13d1f8,null))[_0xfe6e('0x56')](handleError(_0x13d1f8,null));};exports[_0xfe6e('0xa1')]=function(_0x45c803,_0xc4bf69){var _0x5578ba=_0x45c803[_0xfe6e('0x65')][_0xfe6e('0xa2')];return db['User']['find']({'where':{'id':_0x45c803['params']['id']},'attributes':['id',_0xfe6e('0x3d'),'role',_0xfe6e('0xa3'),_0xfe6e('0xa4'),_0xfe6e('0xa5'),'interface']})[_0xfe6e('0x19')](handleEntityNotFound(_0xc4bf69,null))['then'](function(_0xb3a1f4){if(_0xb3a1f4){if(!utils[_0xfe6e('0xa6')](_0x5578ba)){throw new db[(_0xfe6e('0x96'))]['ValidationError'](_0xfe6e('0xa7'));}return _0xb3a1f4['add'+_['capitalize'](_0x5578ba[_0xfe6e('0xa8')]())+_0xfe6e('0xa9')](_0x45c803['body']['ids'],{'penalty':_0x45c803['body'][_0xfe6e('0xaa')]||0x0})[_0xfe6e('0xab')](function(_0x50ad10){for(var _0x5822f0=0x0;_0x5822f0<_0x45c803['body']['ids'][_0xfe6e('0x50')];_0x5822f0+=0x1){var _0x1abb5d={'UserId':Number(_0x45c803['params']['id'])};_0x1abb5d[_['capitalize'](_0x5578ba['toLowerCase']())+'QueueId']=Number(_0x45c803[_0xfe6e('0x65')]['ids'][_0x5822f0]);socket[_0xfe6e('0xac')]('user'+_[_0xfe6e('0xad')](_0x5578ba[_0xfe6e('0xa8')]())+_0xfe6e('0xae'),_0x1abb5d);}return _0x50ad10;})['then'](function(){if(_0x5578ba==='voice'){return db[_0xfe6e('0xaf')][_0xfe6e('0x91')]({'where':{'id':_0x45c803[_0xfe6e('0x65')][_0xfe6e('0x68')]||[]},'raw':!![],'attributes':['id',_0xfe6e('0x3d')]});}})[_0xfe6e('0x19')](function(_0x162138){var _0x1673b3=_0xb3a1f4[_0xfe6e('0x2c')]({'plain':!![]});var _0x48e56f=[];if(_0x5578ba===_0xfe6e('0xb0')&&_0x1673b3[_0xfe6e('0x2d')]===_0xfe6e('0x32')&&_0x1673b3['online']){for(var _0x45fde5=0x0;_0x45fde5<_0x162138[_0xfe6e('0x50')];_0x45fde5+=0x1){_0x48e56f[_0xfe6e('0x4c')]({'membername':_0x1673b3['name'],'UserId':_0x1673b3['id'],'queue_name':_0x162138[_0x45fde5][_0xfe6e('0x3d')],'VoiceQueueId':_0x162138[_0x45fde5]['id'],'interface':_['isNil'](_0x1673b3['interface'])?util['format'](_0xfe6e('0xb1'),_0x1673b3[_0xfe6e('0x3d')]):_0x1673b3[_0xfe6e('0xb2')],'paused':_0x1673b3[_0xfe6e('0xa5')]||![],'penalty':_0x45c803[_0xfe6e('0x65')][_0xfe6e('0xaa')]||0x0});}return BPromise[_0xfe6e('0xb3')](_0x48e56f,function(_0x5827be){return db['UserVoiceQueueRt'][_0xfe6e('0xb4')](_0x5827be);});}return _0xb3a1f4;});}})[_0xfe6e('0x19')](respondWithStatusCode(_0xc4bf69,null))[_0xfe6e('0x56')](handleError(_0xc4bf69,null));};exports['removeQueues']=function(_0xda847f,_0x3f422a){var _0x269428,_0x576c96;return db[_0xfe6e('0x3f')][_0xfe6e('0x38')]({'where':{'id':_0xda847f[_0xfe6e('0x58')]['id']},'attributes':['id','name','role']})['then'](handleEntityNotFound(_0x3f422a,null))[_0xfe6e('0x19')](function(_0x22bf57){if(_0x22bf57){_0x269428=_0x22bf57;if(!_0xda847f[_0xfe6e('0x47')][_0xfe6e('0xa2')]||!utils[_0xfe6e('0xa6')](_0xda847f[_0xfe6e('0x47')][_0xfe6e('0xa2')])){throw new db['Sequelize'][(_0xfe6e('0x97'))](_0xfe6e('0xa7'));}return _0x22bf57[_0xfe6e('0xb5')+_['capitalize'](_0xda847f[_0xfe6e('0x47')][_0xfe6e('0xa2')][_0xfe6e('0xa8')]())+_0xfe6e('0xa9')](_0xda847f['query']['ids']);}})[_0xfe6e('0x19')](function(_0x5e1506){if(_[_0xfe6e('0xb6')](_0xda847f[_0xfe6e('0x47')][_0xfe6e('0x68')])){for(var _0x11bced=0x0;_0x11bced<_0xda847f[_0xfe6e('0x47')]['ids'][_0xfe6e('0x50')];_0x11bced+=0x1){_0x576c96={'UserId':Number(_0xda847f['params']['id'])};_0x576c96[_[_0xfe6e('0xad')](_0xda847f[_0xfe6e('0x47')][_0xfe6e('0xa2')]['toLowerCase']())+_0xfe6e('0xb7')]=Number(_0xda847f[_0xfe6e('0x47')][_0xfe6e('0x68')][_0x11bced]);socket[_0xfe6e('0xac')](_0xfe6e('0x30')+_[_0xfe6e('0xad')](_0xda847f[_0xfe6e('0x47')]['channel'][_0xfe6e('0xa8')]())+_0xfe6e('0xb8'),_0x576c96);}}else{_0x576c96={'UserId':Number(_0xda847f[_0xfe6e('0x58')]['id'])};_0x576c96[_['capitalize'](_0xda847f[_0xfe6e('0x47')][_0xfe6e('0xa2')][_0xfe6e('0xa8')]())+_0xfe6e('0xb7')]=Number(_0xda847f[_0xfe6e('0x47')][_0xfe6e('0x68')]);socket['emit'](_0xfe6e('0x30')+_['capitalize'](_0xda847f[_0xfe6e('0x47')][_0xfe6e('0xa2')][_0xfe6e('0xa8')]())+_0xfe6e('0xb8'),_0x576c96);}return _0x5e1506;})[_0xfe6e('0x19')](function(){if(_0xda847f[_0xfe6e('0x47')][_0xfe6e('0xa2')]===_0xfe6e('0xb0')){return db[_0xfe6e('0xb9')][_0xfe6e('0x2b')]({'where':{'UserId':_0xda847f['params']['id'],'VoiceQueueId':_0xda847f[_0xfe6e('0x47')][_0xfe6e('0x68')]},'individualHooks':!![]})['then'](function(){return _0x269428;});}return _0x269428;})['then'](respondWithStatusCode(_0x3f422a,null))['catch'](handleError(_0x3f422a,null));};exports[_0xfe6e('0xba')]=function(_0x40e158,_0xc1745){_0x40e158[_0xfe6e('0x65')][_0xfe6e('0xbb')]=_0x40e158[_0xfe6e('0xbc')][_0xfe6e('0xbd')];return db[_0xfe6e('0x3f')]['find']({'where':{'id':_0x40e158[_0xfe6e('0x58')]['id']}})['then'](handleEntityNotFound(_0xc1745,null))[_0xfe6e('0x19')](saveUpdates(_0x40e158[_0xfe6e('0x65')],null))[_0xfe6e('0x19')](respondWithResult(_0xc1745,null))[_0xfe6e('0x56')](handleError(_0xc1745,null));};exports[_0xfe6e('0xbe')]=function(_0x5dc3e3,_0x53cf9a){var _0x450290=path['join'](config[_0xfe6e('0xbf')],_0xfe6e('0xc0'));return db[_0xfe6e('0x3f')][_0xfe6e('0x38')]({'where':{'id':_0x5dc3e3[_0xfe6e('0x58')]['id']},'attributes':['id',_0xfe6e('0xbb')],'raw':!![]})['then'](handleEntityNotFound(_0x53cf9a,null))['then'](function(_0x495324){if(_0x495324){if(_[_0xfe6e('0x6e')](_0x495324[_0xfe6e('0xbb')])){return _0x53cf9a[_0xfe6e('0xc1')](_0x450290);}else{if(!fs['existsSync'](path['join'](config['root'],_0xfe6e('0xc2'),_0x495324[_0xfe6e('0xbb')]))){return _0x53cf9a['download'](_0x450290);}return _0x53cf9a[_0xfe6e('0xc1')](path[_0xfe6e('0xc3')](config[_0xfe6e('0xbf')],'server/files/images/',_0x495324['userpic']));}}})['catch'](handleError(_0x53cf9a,null));};exports[_0xfe6e('0xc4')]=function(_0xd87fe1,_0x2b9293){return db['User']['find']({'where':{'id':_0xd87fe1['params']['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x2b9293,null))[_0xfe6e('0x19')](function(_0x5197cc){var _0x466d0d=[];values=_0x5197cc['dataValues'];_0x466d0d['push'](get_open_tabs(_0xfe6e('0x62'),_0x5197cc[_0xfe6e('0x51')]));_0x466d0d[_0xfe6e('0x4c')](get_open_tabs(_0xfe6e('0x63'),_0x5197cc[_0xfe6e('0x51')]));_0x466d0d[_0xfe6e('0x4c')](get_open_tabs('openchannel',_0x5197cc[_0xfe6e('0x51')]));_0x466d0d['push'](get_open_tabs(_0xfe6e('0x55'),_0x5197cc['dataValues']));_0x466d0d[_0xfe6e('0x4c')](get_open_tabs('fax',_0x5197cc['dataValues']));_0x466d0d[_0xfe6e('0x4c')](get_open_tabs(_0xfe6e('0x53'),_0x5197cc[_0xfe6e('0x51')]));return BPromise[_0xfe6e('0x64')](_0x466d0d);})[_0xfe6e('0x19')](function(_0x238477){if(_0x238477){var _0x474cdc=_[_0xfe6e('0x36')](values[_0xfe6e('0xc5')],function(_0x11ee15){return{'channel':_0xfe6e('0xc6'),'id':_0x11ee15['id'],'createdAt':_0x11ee15[_0xfe6e('0xc7')]};});var _0x13fe4a=_[_0xfe6e('0x36')](values[_0xfe6e('0xc8')],function(_0x36923b){return{'channel':_0xfe6e('0xc9'),'id':_0x36923b['id'],'createdAt':_0x36923b[_0xfe6e('0xc7')]};});var _0x14e47b=_['map'](values['OpenchannelOpenTabs'],function(_0x7cb0ce){return{'channel':_0xfe6e('0xca'),'id':_0x7cb0ce['id'],'createdAt':_0x7cb0ce[_0xfe6e('0xc7')]};});var _0x28c027=_['map'](values['MailOpenTabs'],function(_0x3073d4){return{'channel':_0xfe6e('0xcb'),'id':_0x3073d4['id'],'createdAt':_0x3073d4['createdAt']};});var _0x4d5ebc=_['map'](values[_0xfe6e('0xcc')],function(_0x2b7327){return{'channel':_0xfe6e('0xcd'),'id':_0x2b7327['id'],'createdAt':_0x2b7327[_0xfe6e('0xc7')]};});var _0x4f566a=_['map'](values[_0xfe6e('0xce')],function(_0x79b7e7){return{'channel':_0xfe6e('0xcf'),'id':_0x79b7e7['id'],'createdAt':_0x79b7e7[_0xfe6e('0xc7')]};});var _0x9110f4=_[_0xfe6e('0xd0')](_0x474cdc,_0x13fe4a,_0x14e47b,_0x28c027,_0x4d5ebc,_0x4f566a);var _0x4ec892={'count':_0x9110f4[_0xfe6e('0x50')],'rows':_0x9110f4};return _0x4ec892;}else return null;})[_0xfe6e('0x19')](respondWithResult(_0x2b9293,null))['catch'](handleError(_0x2b9293,null));};exports[_0xfe6e('0xd1')]=function(_0x1669cf,_0x1a3fc9){var _0x2808ad={};var _0x203a42={};var _0x4777f3;var _0x168b86;return db[_0xfe6e('0x3f')][_0xfe6e('0x9c')]({'where':{'id':_0x1669cf[_0xfe6e('0x58')]['id']}})[_0xfe6e('0x19')](handleEntityNotFound(_0x1a3fc9,null))[_0xfe6e('0x19')](function(_0x25720d){if(_0x25720d){_0x4777f3=_0x25720d;_0x203a42['model']=_[_0xfe6e('0x5a')](db[_0xfe6e('0xd2')][_0xfe6e('0x40')]);_0x203a42[_0xfe6e('0x47')]=_[_0xfe6e('0x5a')](_0x1669cf[_0xfe6e('0x47')]);_0x203a42['filters']=_['intersection'](_0x203a42[_0xfe6e('0x5c')],_0x203a42[_0xfe6e('0x47')]);_0x2808ad[_0xfe6e('0x4b')]=_['intersection'](_0x203a42[_0xfe6e('0x5c')],qs[_0xfe6e('0x5d')](_0x1669cf['query']['fields']));_0x2808ad[_0xfe6e('0x4b')]=_0x2808ad[_0xfe6e('0x4b')][_0xfe6e('0x50')]?_0x2808ad[_0xfe6e('0x4b')]:_0x203a42['model'];_0x2808ad[_0xfe6e('0xd3')]=qs[_0xfe6e('0xd4')](_0x1669cf['query']['sort']);_0x2808ad['where']=qs[_0xfe6e('0xd5')](_[_0xfe6e('0xd6')](_0x1669cf[_0xfe6e('0x47')],_0x203a42['filters']));if(_0x1669cf[_0xfe6e('0x47')][_0xfe6e('0x34')]){_0x2808ad[_0xfe6e('0x46')]=_[_0xfe6e('0x60')](_0x2808ad[_0xfe6e('0x46')],{'$or':_['map'](_0x2808ad[_0xfe6e('0x4b')],function(_0x83c864){var _0x2bf99a={};_0x2bf99a[_0x83c864]={'$like':'%'+_0x1669cf['query']['filter']+'%'};return _0x2bf99a;})});}_0x2808ad=_[_0xfe6e('0x60')]({},_0x2808ad,_0x1669cf['options']);return _0x4777f3[_0xfe6e('0xd1')](_0x2808ad);}})[_0xfe6e('0x19')](function(_0x3c9801){if(_0x3c9801){_0x168b86=_0x3c9801[_0xfe6e('0x50')];if(_0x1669cf[_0xfe6e('0x47')][_0xfe6e('0xd7')](_0xfe6e('0x48'))){_0x2808ad['include']=[{'model':db[_0xfe6e('0xd8')],'as':_0xfe6e('0xd9'),'required':![]},{'model':db['Tag'],'as':_0xfe6e('0xda'),'attributes':['id',_0xfe6e('0x3d'),_0xfe6e('0xdb')],'where':_0x1669cf[_0xfe6e('0x47')][_0xfe6e('0xdc')]?{'id':_0x1669cf[_0xfe6e('0x47')][_0xfe6e('0xdc')]}:undefined,'required':_0x1669cf[_0xfe6e('0x47')][_0xfe6e('0xdc')]?!![]:![]}];}if(!_0x1669cf[_0xfe6e('0x47')][_0xfe6e('0xd7')](_0xfe6e('0xdd'))){_0x2808ad[_0xfe6e('0x26')]=qs['limit'](_0x1669cf[_0xfe6e('0x47')][_0xfe6e('0x26')]);_0x2808ad[_0xfe6e('0x25')]=qs['offset'](_0x1669cf['query'][_0xfe6e('0x25')]);}return _0x4777f3['getContacts'](_0x2808ad);}})[_0xfe6e('0x19')](function(_0x581520){if(_0x581520){return _0x581520?{'count':_0x168b86,'rows':_0x581520}:null;}})['then'](respondWithResult(_0x1a3fc9,null))[_0xfe6e('0x56')](handleError(_0x1a3fc9,null));};exports[_0xfe6e('0xde')]=function(_0x56974c,_0x51f4d9){var _0x4f5318;var _0x11a29d={};var _0x454f00;return db[_0xfe6e('0x3f')][_0xfe6e('0x9c')]({'where':{'id':_0x56974c[_0xfe6e('0x58')]['id']},'attributes':['id',_0xfe6e('0x3d'),_0xfe6e('0x2d')]})['then'](handleEntityNotFound(_0x51f4d9,null))[_0xfe6e('0x19')](function(_0x55e5f7){if(!utils['isValidChannel'](_0x56974c[_0xfe6e('0x47')][_0xfe6e('0xa2')])){throw new db[(_0xfe6e('0x96'))]['ValidationError'](_0xfe6e('0xa7'));}_0x4f5318=_0x55e5f7;var _0x3a9d0a={};_0x3a9d0a['model']=_[_0xfe6e('0x5a')](db[_['capitalize'](_0x56974c['query']['channel'])+_0xfe6e('0xdf')][_0xfe6e('0x40')]);_0x3a9d0a[_0xfe6e('0x47')]=_['keys'](_0x56974c[_0xfe6e('0x47')]);_0x3a9d0a['filters']=_[_0xfe6e('0x5b')](_0x3a9d0a[_0xfe6e('0x5c')],_0x3a9d0a[_0xfe6e('0x47')]);_0x11a29d['attributes']=_['intersection'](_0x3a9d0a['model'],qs['fields'](_0x56974c[_0xfe6e('0x47')][_0xfe6e('0x5d')]));_0x11a29d[_0xfe6e('0x4b')]=_0x11a29d[_0xfe6e('0x4b')][_0xfe6e('0x50')]?_0x11a29d['attributes']:_0x3a9d0a[_0xfe6e('0x5c')];_0x11a29d[_0xfe6e('0xd3')]=qs[_0xfe6e('0xd4')](_0x56974c[_0xfe6e('0x47')][_0xfe6e('0xd4')]);_0x11a29d[_0xfe6e('0x46')]=qs[_0xfe6e('0xd5')](_[_0xfe6e('0xd6')](_0x56974c['query'],_0x3a9d0a['filters']));if(_0x56974c[_0xfe6e('0x47')][_0xfe6e('0x34')]){_0x11a29d[_0xfe6e('0x46')]=_['merge'](_0x11a29d[_0xfe6e('0x46')],{'$or':_[_0xfe6e('0x36')](_0x11a29d[_0xfe6e('0x4b')],function(_0x4a247e){var _0x582a81={};_0x582a81[_0x4a247e]={'$like':'%'+_0x56974c[_0xfe6e('0x47')][_0xfe6e('0x34')]+'%'};return _0x582a81;})});}_0x11a29d=_['merge']({},_0x11a29d,_0x56974c[_0xfe6e('0x61')]);switch(_0x4f5318[_0xfe6e('0x2d')]){case'admin':return db[_[_0xfe6e('0xad')](_0x56974c['query'][_0xfe6e('0xa2')])+_0xfe6e('0xdf')][_0xfe6e('0x91')](_0x11a29d);case _0xfe6e('0x30'):case _0xfe6e('0x32'):return _0x4f5318['get'+_['capitalize'](_0x56974c['query'][_0xfe6e('0xa2')])+_0xfe6e('0xa9')](_0x11a29d);default:throw new db[(_0xfe6e('0x96'))][(_0xfe6e('0x97'))](_0xfe6e('0xe0'));}})[_0xfe6e('0x19')](function(_0x576a03){_0x454f00=_0x576a03[_0xfe6e('0x50')];if(!_0x56974c[_0xfe6e('0x47')][_0xfe6e('0xd7')](_0xfe6e('0xdd'))){_0x11a29d[_0xfe6e('0x26')]=qs[_0xfe6e('0x26')](_0x56974c['query']['limit']);_0x11a29d[_0xfe6e('0x25')]=qs[_0xfe6e('0x25')](_0x56974c['query']['offset']);}switch(_0x4f5318[_0xfe6e('0x2d')]){case'admin':return db[_['capitalize'](_0x56974c[_0xfe6e('0x47')]['channel'])+_0xfe6e('0xdf')]['findAll'](_0x11a29d);case _0xfe6e('0x30'):case _0xfe6e('0x32'):return _0x4f5318[_0xfe6e('0x2c')+_[_0xfe6e('0xad')](_0x56974c[_0xfe6e('0x47')]['channel'])+_0xfe6e('0xa9')](_0x11a29d);}})[_0xfe6e('0x19')](function(_0x33f086){return{'count':_0x454f00,'rows':_0x33f086};})['then'](respondWithResult(_0x51f4d9,null))[_0xfe6e('0x56')](handleError(_0x51f4d9,null));};exports[_0xfe6e('0xe1')]=function(_0x237b94,_0xa5357d){var _0x2a17e8={};var _0x4aa03f={};var _0x1ad34d;var _0x32165f;return db[_0xfe6e('0x3f')][_0xfe6e('0x9c')]({'where':{'id':_0x237b94[_0xfe6e('0x58')]['id']}})[_0xfe6e('0x19')](handleEntityNotFound(_0xa5357d,null))[_0xfe6e('0x19')](function(_0x3868ed){if(_0x3868ed){_0x1ad34d=_0x3868ed;_0x4aa03f['model']=_[_0xfe6e('0x5a')](db[_0xfe6e('0xb9')]['rawAttributes']);_0x4aa03f['query']=_['keys'](_0x237b94[_0xfe6e('0x47')]);_0x4aa03f[_0xfe6e('0xd5')]=_[_0xfe6e('0x5b')](_0x4aa03f[_0xfe6e('0x5c')],_0x4aa03f[_0xfe6e('0x47')]);_0x2a17e8[_0xfe6e('0x4b')]=_[_0xfe6e('0x5b')](_0x4aa03f[_0xfe6e('0x5c')],qs[_0xfe6e('0x5d')](_0x237b94[_0xfe6e('0x47')][_0xfe6e('0x5d')]));_0x2a17e8[_0xfe6e('0x4b')]=_0x2a17e8[_0xfe6e('0x4b')]['length']?_0x2a17e8[_0xfe6e('0x4b')]:_0x4aa03f[_0xfe6e('0x5c')];_0x2a17e8[_0xfe6e('0xd3')]=qs['sort'](_0x237b94[_0xfe6e('0x47')]['sort']);_0x2a17e8[_0xfe6e('0x46')]=qs[_0xfe6e('0xd5')](_['pick'](_0x237b94[_0xfe6e('0x47')],_0x4aa03f[_0xfe6e('0xd5')]));if(_0x237b94[_0xfe6e('0x47')][_0xfe6e('0x34')]){_0x2a17e8[_0xfe6e('0x46')]=_[_0xfe6e('0x60')](_0x2a17e8[_0xfe6e('0x46')],{'$or':_[_0xfe6e('0x36')](_0x2a17e8['attributes'],function(_0x4413e1){var _0x16bbe2={};_0x16bbe2[_0x4413e1]={'$like':'%'+_0x237b94[_0xfe6e('0x47')][_0xfe6e('0x34')]+'%'};return _0x16bbe2;})});}_0x2a17e8=_[_0xfe6e('0x60')]({},_0x2a17e8,_0x237b94[_0xfe6e('0x61')]);return _0x1ad34d[_0xfe6e('0xe1')](_0x2a17e8);}})[_0xfe6e('0x19')](function(_0x4845dd){if(_0x4845dd){_0x32165f=_0x4845dd[_0xfe6e('0x50')];if(!_0x237b94[_0xfe6e('0x47')]['hasOwnProperty'](_0xfe6e('0xdd'))){_0x2a17e8[_0xfe6e('0x26')]=qs[_0xfe6e('0x26')](_0x237b94[_0xfe6e('0x47')][_0xfe6e('0x26')]);_0x2a17e8['offset']=qs[_0xfe6e('0x25')](_0x237b94[_0xfe6e('0x47')][_0xfe6e('0x25')]);}return _0x1ad34d[_0xfe6e('0xe1')](_0x2a17e8);}})[_0xfe6e('0x19')](function(_0x250ec0){if(_0x250ec0){return _0x250ec0?{'count':_0x32165f,'rows':_0x250ec0}:null;}})[_0xfe6e('0x19')](respondWithResult(_0xa5357d,null))[_0xfe6e('0x56')](handleError(_0xa5357d,null));};exports[_0xfe6e('0xe2')]=function(_0x251a25,_0x481416){var _0x19f3a8={};var _0x5c9757={};var _0x1a77f0;var _0x2e9b5e;return db[_0xfe6e('0x3f')][_0xfe6e('0x9c')]({'where':{'id':_0x251a25[_0xfe6e('0x58')]['id']}})['then'](handleEntityNotFound(_0x481416,null))[_0xfe6e('0x19')](function(_0x4c1827){if(_0x4c1827){_0x1a77f0=_0x4c1827;_0x5c9757[_0xfe6e('0x5c')]=_[_0xfe6e('0x5a')](db[_0xfe6e('0xe3')][_0xfe6e('0x40')]);_0x5c9757[_0xfe6e('0x47')]=_[_0xfe6e('0x5a')](_0x251a25[_0xfe6e('0x47')]);_0x5c9757[_0xfe6e('0xd5')]=_[_0xfe6e('0x5b')](_0x5c9757[_0xfe6e('0x5c')],_0x5c9757[_0xfe6e('0x47')]);_0x19f3a8[_0xfe6e('0x4b')]=_[_0xfe6e('0x5b')](_0x5c9757[_0xfe6e('0x5c')],qs[_0xfe6e('0x5d')](_0x251a25[_0xfe6e('0x47')][_0xfe6e('0x5d')]));_0x19f3a8[_0xfe6e('0x4b')]=_0x19f3a8[_0xfe6e('0x4b')]['length']?_0x19f3a8['attributes']:_0x5c9757[_0xfe6e('0x5c')];_0x19f3a8[_0xfe6e('0xd3')]=qs[_0xfe6e('0xd4')](_0x251a25[_0xfe6e('0x47')][_0xfe6e('0xd4')]);_0x19f3a8[_0xfe6e('0x46')]=qs['filters'](_['pick'](_0x251a25[_0xfe6e('0x47')],_0x5c9757[_0xfe6e('0xd5')]));if(_0x251a25[_0xfe6e('0x47')]['filter']){_0x19f3a8[_0xfe6e('0x46')]=_[_0xfe6e('0x60')](_0x19f3a8['where'],{'$or':_[_0xfe6e('0x36')](_0x19f3a8[_0xfe6e('0x4b')],function(_0x4a5d2c){var _0x4bd4de={};_0x4bd4de[_0x4a5d2c]={'$like':'%'+_0x251a25[_0xfe6e('0x47')][_0xfe6e('0x34')]+'%'};return _0x4bd4de;})});}_0x19f3a8=_[_0xfe6e('0x60')]({},_0x19f3a8,_0x251a25[_0xfe6e('0x61')]);return _0x1a77f0[_0xfe6e('0xe2')](_0x19f3a8);}})[_0xfe6e('0x19')](function(_0x3cfb04){if(_0x3cfb04){_0x2e9b5e=_0x3cfb04[_0xfe6e('0x50')];if(!_0x251a25[_0xfe6e('0x47')][_0xfe6e('0xd7')](_0xfe6e('0xdd'))){_0x19f3a8[_0xfe6e('0x26')]=qs[_0xfe6e('0x26')](_0x251a25[_0xfe6e('0x47')][_0xfe6e('0x26')]);_0x19f3a8[_0xfe6e('0x25')]=qs['offset'](_0x251a25[_0xfe6e('0x47')][_0xfe6e('0x25')]);}return _0x1a77f0['getGroups'](_0x19f3a8);}})[_0xfe6e('0x19')](function(_0x4cbe73){if(_0x4cbe73){return _0x4cbe73?{'count':_0x2e9b5e,'rows':_0x4cbe73}:null;}})[_0xfe6e('0x19')](respondWithResult(_0x481416,null))['catch'](handleError(_0x481416,null));};exports[_0xfe6e('0xe4')]=function(_0xaafb9a,_0x515aa1){var _0x1d0005={'raw':!![],'where':{}};var _0x5247bd={};var _0x6e081f={'count':0x0,'rows':[]};return db[_0xfe6e('0x3f')][_0xfe6e('0x9c')]({'where':{'id':_0xaafb9a[_0xfe6e('0x58')]['id']}})['then'](handleEntityNotFound(_0x515aa1,null))[_0xfe6e('0x19')](function(_0x5dc9e9){if(_0x5dc9e9){_0x5247bd[_0xfe6e('0x5c')]=_[_0xfe6e('0x5a')](db['VoiceRecording'][_0xfe6e('0x40')]);_0x5247bd[_0xfe6e('0x47')]=_[_0xfe6e('0x5a')](_0xaafb9a[_0xfe6e('0x47')]);_0x5247bd[_0xfe6e('0xd5')]=_[_0xfe6e('0x5b')](_0x5247bd[_0xfe6e('0x5c')],_0x5247bd[_0xfe6e('0x47')]);_0x1d0005[_0xfe6e('0x4b')]=_['intersection'](_0x5247bd[_0xfe6e('0x5c')],qs[_0xfe6e('0x5d')](_0xaafb9a[_0xfe6e('0x47')]['fields']));_0x1d0005['attributes']=_0x1d0005[_0xfe6e('0x4b')][_0xfe6e('0x50')]?_0x1d0005[_0xfe6e('0x4b')]:_0x5247bd[_0xfe6e('0x5c')];if(!_0xaafb9a[_0xfe6e('0x47')][_0xfe6e('0xd7')](_0xfe6e('0xdd'))){_0x1d0005[_0xfe6e('0x26')]=qs[_0xfe6e('0x26')](_0xaafb9a[_0xfe6e('0x47')][_0xfe6e('0x26')]);_0x1d0005[_0xfe6e('0x25')]=qs['offset'](_0xaafb9a['query'][_0xfe6e('0x25')]);}_0x1d0005[_0xfe6e('0xd3')]=qs[_0xfe6e('0xd4')](_0xaafb9a[_0xfe6e('0x47')]['sort']);_0x1d0005['where']=qs[_0xfe6e('0xd5')](_[_0xfe6e('0xd6')](_0xaafb9a['query'],_0x5247bd[_0xfe6e('0xd5')]));_0x1d0005[_0xfe6e('0x46')][_0xfe6e('0xe5')]=_0x5dc9e9['id'];if(_0xaafb9a[_0xfe6e('0x47')]['filter']){_0x1d0005[_0xfe6e('0x46')]=_[_0xfe6e('0x60')](_0x1d0005[_0xfe6e('0x46')],{'$or':_[_0xfe6e('0x36')](_0x1d0005['attributes'],function(_0x532b51){var _0x1653f0={};_0x1653f0[_0x532b51]={'$like':'%'+_0xaafb9a[_0xfe6e('0x47')][_0xfe6e('0x34')]+'%'};return _0x1653f0;})});}_0x1d0005=_['merge']({},_0x1d0005,_0xaafb9a[_0xfe6e('0x61')]);return db[_0xfe6e('0xe6')]['count']({'where':_0x1d0005[_0xfe6e('0x46')]})[_0xfe6e('0x19')](function(_0x58afe6){_0x6e081f['count']=_0x58afe6;if(_0xaafb9a[_0xfe6e('0x47')][_0xfe6e('0x48')]){_0x1d0005[_0xfe6e('0x5e')]=[{'all':!![]}];}return db[_0xfe6e('0xe6')][_0xfe6e('0x91')](_0x1d0005);})[_0xfe6e('0x19')](function(_0x3145b1){_0x6e081f[_0xfe6e('0x4d')]=_0x3145b1;return _0x6e081f;});}})['then'](respondWithFilteredResult(_0x515aa1,_0x1d0005))[_0xfe6e('0x56')](handleError(_0x515aa1,null));};exports[_0xfe6e('0xe7')]=function(_0xc227c2,_0x4e7a6b){var _0x3ed1e8={'raw':!![],'where':{}};var _0x5697b9={};var _0x160a5f={'count':0x0,'rows':[]};return db[_0xfe6e('0x3f')][_0xfe6e('0x9c')]({'where':{'id':_0xc227c2[_0xfe6e('0x58')]['id']}})[_0xfe6e('0x19')](handleEntityNotFound(_0x4e7a6b,null))[_0xfe6e('0x19')](function(_0xf432f){if(_0xf432f){_0x5697b9[_0xfe6e('0x5c')]=_[_0xfe6e('0x5a')](db[_0xfe6e('0xe8')][_0xfe6e('0x40')]);_0x5697b9[_0xfe6e('0x47')]=_[_0xfe6e('0x5a')](_0xc227c2[_0xfe6e('0x47')]);_0x5697b9['filters']=_[_0xfe6e('0x5b')](_0x5697b9[_0xfe6e('0x5c')],_0x5697b9['query']);_0x3ed1e8[_0xfe6e('0x4b')]=_[_0xfe6e('0x5b')](_0x5697b9[_0xfe6e('0x5c')],qs[_0xfe6e('0x5d')](_0xc227c2[_0xfe6e('0x47')]['fields']));_0x3ed1e8[_0xfe6e('0x4b')]=_0x3ed1e8[_0xfe6e('0x4b')][_0xfe6e('0x50')]?_0x3ed1e8[_0xfe6e('0x4b')]:_0x5697b9[_0xfe6e('0x5c')];if(!_0xc227c2[_0xfe6e('0x47')]['hasOwnProperty'](_0xfe6e('0xdd'))){_0x3ed1e8[_0xfe6e('0x26')]=qs[_0xfe6e('0x26')](_0xc227c2[_0xfe6e('0x47')][_0xfe6e('0x26')]);_0x3ed1e8[_0xfe6e('0x25')]=qs[_0xfe6e('0x25')](_0xc227c2['query']['offset']);}_0x3ed1e8[_0xfe6e('0xd3')]=qs[_0xfe6e('0xd4')](_0xc227c2[_0xfe6e('0x47')][_0xfe6e('0xd4')]);_0x3ed1e8[_0xfe6e('0x46')]=qs[_0xfe6e('0xd5')](_[_0xfe6e('0xd6')](_0xc227c2[_0xfe6e('0x47')],_0x5697b9['filters']));_0x3ed1e8[_0xfe6e('0x46')][_0xfe6e('0xe5')]=_0xf432f['id'];if(_0xc227c2['query']['filter']){_0x3ed1e8[_0xfe6e('0x46')]=_[_0xfe6e('0x60')](_0x3ed1e8[_0xfe6e('0x46')],{'$or':_[_0xfe6e('0x36')](_0x3ed1e8[_0xfe6e('0x4b')],function(_0x70dab3){var _0x1a0c49={};_0x1a0c49[_0x70dab3]={'$like':'%'+_0xc227c2['query'][_0xfe6e('0x34')]+'%'};return _0x1a0c49;})});}_0x3ed1e8=_[_0xfe6e('0x60')]({},_0x3ed1e8,_0xc227c2[_0xfe6e('0x61')]);return db[_0xfe6e('0xe8')][_0xfe6e('0x28')]({'where':_0x3ed1e8[_0xfe6e('0x46')]})[_0xfe6e('0x19')](function(_0x11c857){_0x160a5f[_0xfe6e('0x28')]=_0x11c857;if(_0xc227c2['query']['includeAll']){_0x3ed1e8['include']=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x3ed1e8);})['then'](function(_0x49762b){_0x160a5f[_0xfe6e('0x4d')]=_0x49762b;return _0x160a5f;});}})['then'](respondWithFilteredResult(_0x4e7a6b,_0x3ed1e8))[_0xfe6e('0x56')](handleError(_0x4e7a6b,null));};exports[_0xfe6e('0xe9')]=function(_0x5ccf23,_0x1bf7e9){var _0x5a6d7b={};var _0x465fbf={};var _0x292698;var _0x29b683;return db[_0xfe6e('0x3f')][_0xfe6e('0x9c')]({'where':{'id':_0x5ccf23[_0xfe6e('0x58')]['id']}})[_0xfe6e('0x19')](handleEntityNotFound(_0x1bf7e9,null))[_0xfe6e('0x19')](function(_0xe84f16){if(_0xe84f16){_0x292698=_0xe84f16;_0x465fbf[_0xfe6e('0x5c')]=_[_0xfe6e('0x5a')](db[_0xfe6e('0xea')][_0xfe6e('0x40')]);_0x465fbf[_0xfe6e('0x47')]=_[_0xfe6e('0x5a')](_0x5ccf23[_0xfe6e('0x47')]);_0x465fbf[_0xfe6e('0xd5')]=_['intersection'](_0x465fbf[_0xfe6e('0x5c')],_0x465fbf[_0xfe6e('0x47')]);_0x5a6d7b[_0xfe6e('0x4b')]=_[_0xfe6e('0x5b')](_0x465fbf['model'],qs[_0xfe6e('0x5d')](_0x5ccf23[_0xfe6e('0x47')][_0xfe6e('0x5d')]));_0x5a6d7b[_0xfe6e('0x4b')]=_0x5a6d7b['attributes']['length']?_0x5a6d7b[_0xfe6e('0x4b')]:_0x465fbf['model'];_0x5a6d7b[_0xfe6e('0xd3')]=qs[_0xfe6e('0xd4')](_0x5ccf23['query'][_0xfe6e('0xd4')]);_0x5a6d7b[_0xfe6e('0x46')]=qs[_0xfe6e('0xd5')](_[_0xfe6e('0xd6')](_0x5ccf23[_0xfe6e('0x47')],_0x465fbf[_0xfe6e('0xd5')]));if(_0x5ccf23[_0xfe6e('0x47')][_0xfe6e('0x34')]){_0x5a6d7b[_0xfe6e('0x46')]=_[_0xfe6e('0x60')](_0x5a6d7b['where'],{'$or':_['map'](_0x5a6d7b[_0xfe6e('0x4b')],function(_0x33f419){var _0x324a2b={};_0x324a2b[_0x33f419]={'$like':'%'+_0x5ccf23[_0xfe6e('0x47')]['filter']+'%'};return _0x324a2b;})});}_0x5a6d7b=_[_0xfe6e('0x60')]({},_0x5a6d7b,_0x5ccf23[_0xfe6e('0x61')]);return _0x292698[_0xfe6e('0xe9')](_0x5a6d7b);}})[_0xfe6e('0x19')](function(_0x31b3ca){if(_0x31b3ca){_0x29b683=_0x31b3ca[_0xfe6e('0x50')];if(!_0x5ccf23[_0xfe6e('0x47')][_0xfe6e('0xd7')](_0xfe6e('0xdd'))){_0x5a6d7b[_0xfe6e('0x26')]=qs[_0xfe6e('0x26')](_0x5ccf23[_0xfe6e('0x47')][_0xfe6e('0x26')]);_0x5a6d7b[_0xfe6e('0x25')]=qs[_0xfe6e('0x25')](_0x5ccf23[_0xfe6e('0x47')][_0xfe6e('0x25')]);}return _0x292698[_0xfe6e('0xe9')](_0x5a6d7b);}})[_0xfe6e('0x19')](function(_0x5389cc){if(_0x5389cc){return _0x5389cc?{'count':_0x29b683,'rows':_0x5389cc}:null;}})[_0xfe6e('0x19')](respondWithResult(_0x1bf7e9,null))[_0xfe6e('0x56')](handleError(_0x1bf7e9,null));};exports['getOpenchannelInteractions']=function(_0x244030,_0x2881f6){var _0x140573={};var _0x3cd042={};var _0x941a70;var _0x40a963;return db[_0xfe6e('0x3f')]['findOne']({'where':{'id':_0x244030['params']['id']}})[_0xfe6e('0x19')](handleEntityNotFound(_0x2881f6,null))[_0xfe6e('0x19')](function(_0x3c6512){if(_0x3c6512){_0x941a70=_0x3c6512;_0x3cd042[_0xfe6e('0x5c')]=_['keys'](db[_0xfe6e('0xeb')]['rawAttributes']);_0x3cd042['query']=_[_0xfe6e('0x5a')](_0x244030[_0xfe6e('0x47')]);_0x3cd042[_0xfe6e('0xd5')]=_['intersection'](_0x3cd042[_0xfe6e('0x5c')],_0x3cd042[_0xfe6e('0x47')]);_0x140573['attributes']=_[_0xfe6e('0x5b')](_0x3cd042[_0xfe6e('0x5c')],qs[_0xfe6e('0x5d')](_0x244030[_0xfe6e('0x47')]['fields']));_0x140573['attributes']=_0x140573['attributes'][_0xfe6e('0x50')]?_0x140573[_0xfe6e('0x4b')]:_0x3cd042[_0xfe6e('0x5c')];_0x140573['order']=qs[_0xfe6e('0xd4')](_0x244030[_0xfe6e('0x47')][_0xfe6e('0xd4')]);_0x140573[_0xfe6e('0x46')]=qs['filters'](_['pick'](_0x244030[_0xfe6e('0x47')],_0x3cd042[_0xfe6e('0xd5')]));if(_0x244030[_0xfe6e('0x47')]['filter']){_0x140573[_0xfe6e('0x46')]=_[_0xfe6e('0x60')](_0x140573[_0xfe6e('0x46')],{'$or':_['map'](_0x140573[_0xfe6e('0x4b')],function(_0x1c7f88){var _0xfa8da3={};_0xfa8da3[_0x1c7f88]={'$like':'%'+_0x244030[_0xfe6e('0x47')][_0xfe6e('0x34')]+'%'};return _0xfa8da3;})});}_0x140573=_[_0xfe6e('0x60')]({},_0x140573,_0x244030[_0xfe6e('0x61')]);return _0x941a70[_0xfe6e('0xec')](_0x140573);}})['then'](function(_0x505cd3){if(_0x505cd3){_0x40a963=_0x505cd3[_0xfe6e('0x50')];if(!_0x244030['query'][_0xfe6e('0xd7')](_0xfe6e('0xdd'))){_0x140573['limit']=qs[_0xfe6e('0x26')](_0x244030[_0xfe6e('0x47')][_0xfe6e('0x26')]);_0x140573[_0xfe6e('0x25')]=qs[_0xfe6e('0x25')](_0x244030[_0xfe6e('0x47')]['offset']);}return _0x941a70[_0xfe6e('0xec')](_0x140573);}})[_0xfe6e('0x19')](function(_0x14916d){if(_0x14916d){return _0x14916d?{'count':_0x40a963,'rows':_0x14916d}:null;}})[_0xfe6e('0x19')](respondWithResult(_0x2881f6,null))['catch'](handleError(_0x2881f6,null));};exports[_0xfe6e('0xed')]=function(_0x5f5a74,_0x58dfdf){var _0x1c2ab9={'raw':!![],'where':{}};var _0x491dbf={};var _0x32af3e={'count':0x0,'rows':[]};return db[_0xfe6e('0x3f')]['findOne']({'where':{'id':_0x5f5a74[_0xfe6e('0x58')]['id']}})['then'](handleEntityNotFound(_0x58dfdf,null))[_0xfe6e('0x19')](function(_0x4cb5c1){if(_0x4cb5c1){_0x491dbf[_0xfe6e('0x5c')]=_['keys'](db[_0xfe6e('0xee')][_0xfe6e('0x40')]);_0x491dbf[_0xfe6e('0x47')]=_['keys'](_0x5f5a74[_0xfe6e('0x47')]);_0x491dbf['filters']=_['intersection'](_0x491dbf['model'],_0x491dbf[_0xfe6e('0x47')]);_0x1c2ab9[_0xfe6e('0x4b')]=_['intersection'](_0x491dbf['model'],qs[_0xfe6e('0x5d')](_0x5f5a74[_0xfe6e('0x47')]['fields']));_0x1c2ab9['attributes']=_0x1c2ab9[_0xfe6e('0x4b')]['length']?_0x1c2ab9[_0xfe6e('0x4b')]:_0x491dbf[_0xfe6e('0x5c')];if(!_0x5f5a74[_0xfe6e('0x47')]['hasOwnProperty'](_0xfe6e('0xdd'))){_0x1c2ab9['limit']=qs['limit'](_0x5f5a74[_0xfe6e('0x47')][_0xfe6e('0x26')]);_0x1c2ab9[_0xfe6e('0x25')]=qs[_0xfe6e('0x25')](_0x5f5a74[_0xfe6e('0x47')]['offset']);}_0x1c2ab9[_0xfe6e('0xd3')]=qs[_0xfe6e('0xd4')](_0x5f5a74[_0xfe6e('0x47')][_0xfe6e('0xd4')]);_0x1c2ab9[_0xfe6e('0x46')]=qs[_0xfe6e('0xd5')](_['pick'](_0x5f5a74[_0xfe6e('0x47')],_0x491dbf[_0xfe6e('0xd5')]));_0x1c2ab9[_0xfe6e('0x46')][_0xfe6e('0xe5')]=_0x4cb5c1['id'];if(_0x5f5a74[_0xfe6e('0x47')][_0xfe6e('0x34')]){_0x1c2ab9[_0xfe6e('0x46')]=_[_0xfe6e('0x60')](_0x1c2ab9[_0xfe6e('0x46')],{'$or':_['map'](_0x1c2ab9[_0xfe6e('0x4b')],function(_0x3ce0c5){var _0x1d9dc6={};_0x1d9dc6[_0x3ce0c5]={'$like':'%'+_0x5f5a74[_0xfe6e('0x47')][_0xfe6e('0x34')]+'%'};return _0x1d9dc6;})});}_0x1c2ab9=_[_0xfe6e('0x60')]({},_0x1c2ab9,_0x5f5a74['options']);return db[_0xfe6e('0xee')][_0xfe6e('0x28')]({'where':_0x1c2ab9[_0xfe6e('0x46')]})[_0xfe6e('0x19')](function(_0x46836e){_0x32af3e[_0xfe6e('0x28')]=_0x46836e;if(_0x5f5a74[_0xfe6e('0x47')]['includeAll']){_0x1c2ab9[_0xfe6e('0x5e')]=[{'all':!![]}];}return db['MailInteraction'][_0xfe6e('0x91')](_0x1c2ab9);})[_0xfe6e('0x19')](function(_0x260ef6){_0x32af3e[_0xfe6e('0x4d')]=_0x260ef6;return _0x32af3e;});}})[_0xfe6e('0x19')](respondWithFilteredResult(_0x58dfdf,_0x1c2ab9))['catch'](handleError(_0x58dfdf,null));};exports[_0xfe6e('0xef')]=function(_0x294314,_0xbd8f40){var _0x492a90={};var _0x1abdda={};var _0x43780d;var _0x413a67;return db[_0xfe6e('0x3f')][_0xfe6e('0x9c')]({'where':{'id':_0x294314['params']['id']}})[_0xfe6e('0x19')](handleEntityNotFound(_0xbd8f40,null))[_0xfe6e('0x19')](function(_0x32151e){if(_0x32151e){_0x43780d=_0x32151e;_0x1abdda['model']=_['keys'](db[_0xfe6e('0xf0')]['rawAttributes']);_0x1abdda[_0xfe6e('0x47')]=_[_0xfe6e('0x5a')](_0x294314[_0xfe6e('0x47')]);_0x1abdda[_0xfe6e('0xd5')]=_[_0xfe6e('0x5b')](_0x1abdda[_0xfe6e('0x5c')],_0x1abdda[_0xfe6e('0x47')]);_0x492a90[_0xfe6e('0x4b')]=_[_0xfe6e('0x5b')](_0x1abdda[_0xfe6e('0x5c')],qs[_0xfe6e('0x5d')](_0x294314['query']['fields']));_0x492a90[_0xfe6e('0x4b')]=_0x492a90[_0xfe6e('0x4b')][_0xfe6e('0x50')]?_0x492a90[_0xfe6e('0x4b')]:_0x1abdda['model'];_0x492a90['order']=qs['sort'](_0x294314[_0xfe6e('0x47')][_0xfe6e('0xd4')]);_0x492a90[_0xfe6e('0x46')]=qs[_0xfe6e('0xd5')](_['pick'](_0x294314[_0xfe6e('0x47')],_0x1abdda[_0xfe6e('0xd5')]));if(_0x294314[_0xfe6e('0x47')][_0xfe6e('0x34')]){_0x492a90[_0xfe6e('0x46')]=_[_0xfe6e('0x60')](_0x492a90[_0xfe6e('0x46')],{'$or':_[_0xfe6e('0x36')](_0x492a90[_0xfe6e('0x4b')],function(_0x3ee808){var _0x528f03={};_0x528f03[_0x3ee808]={'$like':'%'+_0x294314['query']['filter']+'%'};return _0x528f03;})});}_0x492a90=_[_0xfe6e('0x60')]({},_0x492a90,_0x294314[_0xfe6e('0x61')]);return _0x43780d['getSmsInteractions'](_0x492a90);}})[_0xfe6e('0x19')](function(_0x4df199){if(_0x4df199){_0x413a67=_0x4df199[_0xfe6e('0x50')];if(!_0x294314[_0xfe6e('0x47')][_0xfe6e('0xd7')](_0xfe6e('0xdd'))){_0x492a90['limit']=qs[_0xfe6e('0x26')](_0x294314[_0xfe6e('0x47')][_0xfe6e('0x26')]);_0x492a90[_0xfe6e('0x25')]=qs[_0xfe6e('0x25')](_0x294314['query'][_0xfe6e('0x25')]);}return _0x43780d[_0xfe6e('0xef')](_0x492a90);}})['then'](function(_0x1092d4){if(_0x1092d4){return _0x1092d4?{'count':_0x413a67,'rows':_0x1092d4}:null;}})['then'](respondWithResult(_0xbd8f40,null))[_0xfe6e('0x56')](handleError(_0xbd8f40,null));};exports[_0xfe6e('0xf1')]=function(_0x5e1bec,_0x20c721){var _0x215536={};var _0x5e9c15={};var _0x21286c;var _0x292516;return db[_0xfe6e('0x3f')][_0xfe6e('0x9c')]({'where':{'id':_0x5e1bec['params']['id']}})[_0xfe6e('0x19')](handleEntityNotFound(_0x20c721,null))[_0xfe6e('0x19')](function(_0x376d4e){if(_0x376d4e){_0x21286c=_0x376d4e;_0x5e9c15['model']=_[_0xfe6e('0x5a')](db[_0xfe6e('0xf2')][_0xfe6e('0x40')]);_0x5e9c15[_0xfe6e('0x47')]=_['keys'](_0x5e1bec[_0xfe6e('0x47')]);_0x5e9c15[_0xfe6e('0xd5')]=_[_0xfe6e('0x5b')](_0x5e9c15['model'],_0x5e9c15[_0xfe6e('0x47')]);_0x215536['attributes']=_[_0xfe6e('0x5b')](_0x5e9c15['model'],qs[_0xfe6e('0x5d')](_0x5e1bec[_0xfe6e('0x47')][_0xfe6e('0x5d')]));_0x215536[_0xfe6e('0x4b')]=_0x215536[_0xfe6e('0x4b')][_0xfe6e('0x50')]?_0x215536[_0xfe6e('0x4b')]:_0x5e9c15[_0xfe6e('0x5c')];_0x215536[_0xfe6e('0xd3')]=qs['sort'](_0x5e1bec[_0xfe6e('0x47')]['sort']);_0x215536[_0xfe6e('0x46')]=qs[_0xfe6e('0xd5')](_['pick'](_0x5e1bec[_0xfe6e('0x47')],_0x5e9c15[_0xfe6e('0xd5')]));if(_0x5e1bec['query']['filter']){_0x215536[_0xfe6e('0x46')]=_['merge'](_0x215536[_0xfe6e('0x46')],{'$or':_[_0xfe6e('0x36')](_0x215536[_0xfe6e('0x4b')],function(_0x52bd6d){var _0x5a2417={};_0x5a2417[_0x52bd6d]={'$like':'%'+_0x5e1bec['query'][_0xfe6e('0x34')]+'%'};return _0x5a2417;})});}_0x215536=_[_0xfe6e('0x60')]({},_0x215536,_0x5e1bec[_0xfe6e('0x61')]);return _0x21286c[_0xfe6e('0xf1')](_0x215536);}})[_0xfe6e('0x19')](function(_0x171c16){if(_0x171c16){_0x292516=_0x171c16['length'];if(!_0x5e1bec[_0xfe6e('0x47')]['hasOwnProperty'](_0xfe6e('0xdd'))){_0x215536[_0xfe6e('0x26')]=qs[_0xfe6e('0x26')](_0x5e1bec[_0xfe6e('0x47')][_0xfe6e('0x26')]);_0x215536[_0xfe6e('0x25')]=qs[_0xfe6e('0x25')](_0x5e1bec[_0xfe6e('0x47')][_0xfe6e('0x25')]);}return _0x21286c['getFaxInteractions'](_0x215536);}})['then'](function(_0x1ba17e){if(_0x1ba17e){return _0x1ba17e?{'count':_0x292516,'rows':_0x1ba17e}:null;}})[_0xfe6e('0x19')](respondWithResult(_0x20c721,null))[_0xfe6e('0x56')](handleError(_0x20c721,null));};exports[_0xfe6e('0xf3')]=function(_0x6dcc80,_0x25f1a8){var _0x2979a3={};var _0x5de2ac={};var _0x50fa54;var _0x267b23;return db['User'][_0xfe6e('0x9c')]({'where':{'id':_0x6dcc80['params']['id']}})[_0xfe6e('0x19')](handleEntityNotFound(_0x25f1a8,null))[_0xfe6e('0x19')](function(_0x5cd038){if(_0x5cd038){_0x50fa54=_0x5cd038;_0x5de2ac['model']=_[_0xfe6e('0x5a')](db['WhatsappInteraction']['rawAttributes']);_0x5de2ac[_0xfe6e('0x47')]=_[_0xfe6e('0x5a')](_0x6dcc80[_0xfe6e('0x47')]);_0x5de2ac[_0xfe6e('0xd5')]=_[_0xfe6e('0x5b')](_0x5de2ac[_0xfe6e('0x5c')],_0x5de2ac['query']);_0x2979a3[_0xfe6e('0x4b')]=_[_0xfe6e('0x5b')](_0x5de2ac[_0xfe6e('0x5c')],qs['fields'](_0x6dcc80[_0xfe6e('0x47')]['fields']));_0x2979a3[_0xfe6e('0x4b')]=_0x2979a3['attributes'][_0xfe6e('0x50')]?_0x2979a3[_0xfe6e('0x4b')]:_0x5de2ac[_0xfe6e('0x5c')];_0x2979a3['order']=qs['sort'](_0x6dcc80[_0xfe6e('0x47')][_0xfe6e('0xd4')]);_0x2979a3[_0xfe6e('0x46')]=qs[_0xfe6e('0xd5')](_[_0xfe6e('0xd6')](_0x6dcc80['query'],_0x5de2ac['filters']));if(_0x6dcc80[_0xfe6e('0x47')]['filter']){_0x2979a3['where']=_[_0xfe6e('0x60')](_0x2979a3[_0xfe6e('0x46')],{'$or':_[_0xfe6e('0x36')](_0x2979a3[_0xfe6e('0x4b')],function(_0x52be54){var _0x1e8cb5={};_0x1e8cb5[_0x52be54]={'$like':'%'+_0x6dcc80[_0xfe6e('0x47')][_0xfe6e('0x34')]+'%'};return _0x1e8cb5;})});}_0x2979a3=_[_0xfe6e('0x60')]({},_0x2979a3,_0x6dcc80[_0xfe6e('0x61')]);return _0x50fa54[_0xfe6e('0xf3')](_0x2979a3);}})[_0xfe6e('0x19')](function(_0x368f9a){if(_0x368f9a){_0x267b23=_0x368f9a['length'];if(!_0x6dcc80[_0xfe6e('0x47')][_0xfe6e('0xd7')](_0xfe6e('0xdd'))){_0x2979a3[_0xfe6e('0x26')]=qs[_0xfe6e('0x26')](_0x6dcc80[_0xfe6e('0x47')][_0xfe6e('0x26')]);_0x2979a3[_0xfe6e('0x25')]=qs[_0xfe6e('0x25')](_0x6dcc80[_0xfe6e('0x47')][_0xfe6e('0x25')]);}return _0x50fa54['getWhatsappInteractions'](_0x2979a3);}})[_0xfe6e('0x19')](function(_0x4b1531){if(_0x4b1531){return _0x4b1531?{'count':_0x267b23,'rows':_0x4b1531}:null;}})[_0xfe6e('0x19')](respondWithResult(_0x25f1a8,null))[_0xfe6e('0x56')](handleError(_0x25f1a8,null));};exports[_0xfe6e('0xf4')]=function(_0x2dce00,_0x487adc,_0x42a885){var _0x2a0f3d;var _0x4c42f0;var _0x196d40;var _0xf343fb=!_[_0xfe6e('0x6e')](_0x2dce00[_0xfe6e('0x58')]['id'])?_0x2dce00[_0xfe6e('0x58')]['id']:!_['isNil'](_0x2dce00[_0xfe6e('0x30')]['id'])?_0x2dce00[_0xfe6e('0x30')]['id']:null;return db[_0xfe6e('0x3f')][_0xfe6e('0x38')]({'where':{'id':_0xf343fb,'role':{'$or':[_0xfe6e('0x2e'),_0xfe6e('0x30'),_0xfe6e('0x32')]}},'attributes':['id','name',_0xfe6e('0xf5'),'mobile',_0xfe6e('0x2d'),_0xfe6e('0x69'),_0xfe6e('0xa4')]})[_0xfe6e('0x19')](function(_0x20f79b){if(_0x20f79b){if(_0x20f79b[_0xfe6e('0x2d')]===_0xfe6e('0x32')){_0x2a0f3d=_0x20f79b;if(_0x2dce00['body'][_0xfe6e('0xb2')]){_0x196d40=util[_0xfe6e('0xf6')](_0xfe6e('0xf7'),_0x2a0f3d[_0x2dce00[_0xfe6e('0x65')][_0xfe6e('0xb2')]]);}else if(_0x2dce00['body'][_0xfe6e('0xf8')]){_0x196d40=util[_0xfe6e('0xf6')](_0xfe6e('0xb1'),_0x2dce00['body'][_0xfe6e('0xf8')]);}else{_0x196d40=util[_0xfe6e('0xf6')](_0xfe6e('0xb1'),_0x2a0f3d[_0xfe6e('0x3d')]);}socket['to'](util[_0xfe6e('0xf6')]('user:%s',_0x2a0f3d[_0xfe6e('0x3d')]))[_0xfe6e('0xac')](_0xfe6e('0xf9'),{'user':{'id':_0x2a0f3d['id'],'name':_0x2a0f3d[_0xfe6e('0x3d')]},'ip':_0x2dce00[_0xfe6e('0xfa')][_0xfe6e('0xfb')]||_0x2dce00[_0xfe6e('0xfc')]['remoteAddress']||_0x2dce00[_0xfe6e('0xfd')][_0xfe6e('0xfe')]||_0x2dce00[_0xfe6e('0xfc')][_0xfe6e('0xfd')][_0xfe6e('0xfe')]});return db[_0xfe6e('0xb9')][_0xfe6e('0x2b')]({'where':{'membername':_0x2a0f3d[_0xfe6e('0x3d')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0xfe6e('0x97'))](_0xfe6e('0xff'));}})[_0xfe6e('0x19')](function(){if(_0x2a0f3d){return _0x2a0f3d[_0xfe6e('0x100')]({'raw':!![]});}})['then'](function(_0x2a5842){if(_0x2a0f3d){var _0x5c46d3=[];if(_0x2a5842){_0x4c42f0=_0x2a5842;if(_0x4c42f0[_0xfe6e('0x50')]){for(var _0x34a383=0x0;_0x34a383<_0x4c42f0[_0xfe6e('0x50')];_0x34a383++){_0x5c46d3[_0xfe6e('0x4c')]({'membername':_0x2a0f3d[_0xfe6e('0x3d')],'UserId':_0x2a0f3d['id'],'queue_name':_0x4c42f0[_0x34a383]['name'],'VoiceQueueId':_0x4c42f0[_0x34a383]['id'],'interface':_0x196d40,'paused':_0x2a0f3d[_0xfe6e('0xa4')]||![],'penalty':_0x4c42f0[_0x34a383][_0xfe6e('0x101')]||0x0});}return BPromise[_0xfe6e('0xb3')](_0x5c46d3,function(_0x4eb6fa){return db['UserVoiceQueueRt'][_0xfe6e('0xb4')](_0x4eb6fa);});}}}})['then'](function(){if(_0x2a0f3d){return db[_0xfe6e('0x102')][_0xfe6e('0x91')]({'where':{'membername':_0x2a0f3d[_0xfe6e('0x3d')],'exitAt':null}});}})['then'](function(_0xb78f9c){if(_0x2a0f3d){var _0x4a0172=[];_0xb78f9c[_0xfe6e('0x103')](function(_0x391a4b){_0x4a0172['push'](_0x391a4b[_0xfe6e('0x2a')]({'exitAt':moment()[_0xfe6e('0xf6')](_0xfe6e('0x104'))}));});return BPromise[_0xfe6e('0x64')](_0x4a0172);}})[_0xfe6e('0x19')](function(){if(_0x2a0f3d){var _0x197176=[];var _0x15edf5=[];var _0x1e3dd1=utils['getChannels']();var _0x516f9b={'membername':_0x2a0f3d[_0xfe6e('0x3d')],'interface':_0x196d40,'enterAt':moment()[_0xfe6e('0xf6')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x2a0f3d[_0xfe6e('0x2d')],'internal':_0x2a0f3d[_0xfe6e('0x69')]};_0x1e3dd1[_0xfe6e('0x103')](function(_0x5d37ea){_0x197176['push'](_['merge']({'channel':_0x5d37ea,'type':'LOGIN','data1':_0x2dce00[_0xfe6e('0x65')][_0xfe6e('0x105')],'data2':_0x196d40},_0x516f9b));if(_0x2a0f3d['loginInPause']){_0x15edf5[_0xfe6e('0x4c')](_['merge']({'channel':_0x5d37ea,'type':_0xfe6e('0x106'),'data1':_0xfe6e('0x107')},_0x516f9b));}});return db[_0xfe6e('0x102')][_0xfe6e('0x108')](_0x197176['concat'](_0x15edf5),{'individualHooks':!![]});}})['then'](function(){if(_0x2a0f3d){return _0x2a0f3d[_0xfe6e('0x2a')]({'online':!![],'lastLoginAt':moment()[_0xfe6e('0xf6')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x2a0f3d[_0xfe6e('0xa4')]||![],'mailPause':_0x2a0f3d[_0xfe6e('0xa4')]||![],'chatPause':_0x2a0f3d[_0xfe6e('0xa4')]||![],'faxPause':_0x2a0f3d['loginInPause']||![],'smsPause':_0x2a0f3d[_0xfe6e('0xa4')]||![],'openchannelPause':_0x2a0f3d[_0xfe6e('0xa4')]||![],'whatsappPause':_0x2a0f3d[_0xfe6e('0xa4')]||![],'pauseType':_0x2a0f3d[_0xfe6e('0xa4')]?'LOGININPAUSE':null,'interface':_0x196d40,'lastPauseAt':moment()[_0xfe6e('0xf6')](_0xfe6e('0x104'))});}})[_0xfe6e('0x19')](function(_0x2c6482){if(_0x2dce00[_0xfe6e('0x109')]){return _0x42a885();}else{return BPromise[_0xfe6e('0x10a')](_0x2c6482)[_0xfe6e('0x19')](respondWithResult(_0x487adc,null));}})[_0xfe6e('0x56')](handleError(_0x487adc,null));};exports[_0xfe6e('0x10b')]=function(_0x2ea8c9,_0x466cae){var _0x4e5a7a;return db['User']['find']({'where':{'id':_0x2ea8c9[_0xfe6e('0x58')]['id'],'role':_0xfe6e('0x32')},'attributes':['id','name',_0xfe6e('0x2d')]})[_0xfe6e('0x19')](handleEntityNotFound(_0x466cae,null))['then'](function(_0x337702){if(_0x337702){_0x4e5a7a=_0x337702;return db[_0xfe6e('0xb9')]['destroy']({'where':{'membername':_0x4e5a7a[_0xfe6e('0x3d')]},'individualHooks':!![]});}})['then'](function(){return db[_0xfe6e('0x102')]['findAll']({'where':{'membername':_0x4e5a7a[_0xfe6e('0x3d')],'exitAt':null}});})[_0xfe6e('0x19')](function(_0x52a693){var _0x1fdfd3=[];_0x52a693[_0xfe6e('0x103')](function(_0x1f32a7){_0x1fdfd3[_0xfe6e('0x4c')](_0x1f32a7[_0xfe6e('0x2a')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xfe6e('0x64')](_0x1fdfd3);})[_0xfe6e('0x19')](function(){return _0x4e5a7a[_0xfe6e('0x2a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xfe6e('0x19')](respondWithResult(_0x466cae,null))[_0xfe6e('0x56')](handleError(_0x466cae,null));};exports[_0xfe6e('0x10c')]=function(_0x532ac1,_0x292be9){var _0x4f1648;return db[_0xfe6e('0xb9')][_0xfe6e('0x2a')]({'paused':0x1},{'where':{'UserId':_0x532ac1[_0xfe6e('0x58')]['id']},'individualHooks':!![]})[_0xfe6e('0x19')](function(){return db[_0xfe6e('0x3f')][_0xfe6e('0x38')]({'where':{'id':_0x532ac1[_0xfe6e('0x58')]['id'],'role':_0xfe6e('0x32')},'attributes':['id','name',_0xfe6e('0x2d'),'internal',_0xfe6e('0xb2')]});})['then'](handleEntityNotFound(_0x292be9,null))[_0xfe6e('0x19')](function(_0x1f53df){if(_0x1f53df){_0x4f1648=_0x1f53df;return respondWithRpcPromise(_0xfe6e('0x10d'),_0xfe6e('0x10c'),{'id':_0x4f1648['id'],'name':_0x4f1648[_0xfe6e('0x3d')],'pause':!![]});}})[_0xfe6e('0x19')](function(){if(_0x4f1648){return db[_0xfe6e('0x102')]['findAll']({'where':{'membername':_0x4f1648[_0xfe6e('0x3d')],'type':_0xfe6e('0x106'),'exitAt':null}});}})['then'](function(_0x1b5d78){if(_0x1b5d78[_0xfe6e('0x50')]){var _0x2d1c3b=moment()[_0xfe6e('0xf6')](_0xfe6e('0x104'));for(var _0x5eff89=0x0,_0x2cef06=_0x1b5d78[_0xfe6e('0x50')];_0x5eff89<_0x2cef06;_0x5eff89++){_0x1b5d78[_0x5eff89][_0xfe6e('0x10e')]({'exitAt':_0x2d1c3b});}}})['then'](function(){var _0x222c54=[];var _0x4c6791=utils['getChannels']();_0x4c6791[_0xfe6e('0x103')](function(_0x4b9a04){_0x222c54['push']({'channel':_0x4b9a04,'membername':_0x4f1648[_0xfe6e('0x3d')],'interface':_[_0xfe6e('0x6e')](_0x4f1648[_0xfe6e('0xb2')])?util['format']('SIP/%s',_0x4f1648['name']):_0x4f1648[_0xfe6e('0xb2')],'type':_0xfe6e('0x106'),'enterAt':moment()[_0xfe6e('0xf6')](_0xfe6e('0x104')),'data1':_0x532ac1[_0xfe6e('0x65')]['type']||'DEFAULT\x20PAUSE','role':_0x4f1648[_0xfe6e('0x2d')],'internal':_0x4f1648[_0xfe6e('0x69')]});});return db['MemberReport']['bulkCreate'](_0x222c54,{'individualHooks':!![]});})[_0xfe6e('0x19')](function(){return _0x4f1648['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x532ac1[_0xfe6e('0x65')][_0xfe6e('0x42')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xfe6e('0xf6')]('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0x292be9,null))[_0xfe6e('0x56')](handleError(_0x292be9,null));};exports['unpause']=function(_0x12dc4e,_0x3b8d3d){var _0x531f0c;return db[_0xfe6e('0x3f')][_0xfe6e('0x38')]({'where':{'id':_0x12dc4e['params']['id']},'attributes':['id',_0xfe6e('0x3d'),'role',_0xfe6e('0xa5'),_0xfe6e('0x10f'),_0xfe6e('0x110'),_0xfe6e('0x111'),_0xfe6e('0x112'),'smsPause',_0xfe6e('0x113'),_0xfe6e('0x114'),'lastPauseAt']})[_0xfe6e('0x19')](handleEntityNotFound(_0x3b8d3d,null))['then'](function(_0x227ea5){if(_0x227ea5){_0x531f0c=_0x227ea5;if(_0x12dc4e[_0xfe6e('0x65')]['channel']&&!utils[_0xfe6e('0xa6')](_0x12dc4e['body']['channel'])){throw new db['Sequelize'][(_0xfe6e('0x97'))](_0xfe6e('0xa7'));}switch(_0x12dc4e[_0xfe6e('0x65')][_0xfe6e('0xa2')]){case _0xfe6e('0xb0'):return respondWithRpcPromise('QueuePause','unpause',{'id':_0x531f0c['id'],'name':_0x531f0c[_0xfe6e('0x3d')],'pause':![]})[_0xfe6e('0x19')](function(){return db[_0xfe6e('0xb9')][_0xfe6e('0x2a')]({'paused':0x0},{'where':{'UserId':_0x531f0c['id']},'individualHooks':!![]});})[_0xfe6e('0x19')](function(){return db[_0xfe6e('0x102')]['find']({'where':{'channel':_0x12dc4e[_0xfe6e('0x65')][_0xfe6e('0xa2')],'membername':_0x531f0c['name'],'type':_0xfe6e('0x106'),'exitAt':null}});})[_0xfe6e('0x19')](function(_0x2642ba){if(_0x2642ba){return _0x2642ba[_0xfe6e('0x2a')]({'exitAt':moment()[_0xfe6e('0xf6')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xfe6e('0x115')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x531f0c[_0xfe6e('0x2a')]({'voicePause':![]});});case'mail':case _0xfe6e('0x62'):case _0xfe6e('0x52'):case _0xfe6e('0x63'):case'whatsapp':case _0xfe6e('0x54'):return db[_0xfe6e('0x102')][_0xfe6e('0x38')]({'where':{'channel':_0x12dc4e[_0xfe6e('0x65')][_0xfe6e('0xa2')],'membername':_0x531f0c[_0xfe6e('0x3d')],'type':_0xfe6e('0x106'),'exitAt':null}})[_0xfe6e('0x19')](function(_0x294f87){if(_0x294f87){return _0x294f87[_0xfe6e('0x2a')]({'exitAt':moment()[_0xfe6e('0xf6')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xfe6e('0x115')},{'individualHooks':!![]});}return null;})[_0xfe6e('0x19')](function(){var _0x5534fd={};_[_0xfe6e('0x116')](_0x5534fd,util[_0xfe6e('0xf6')](_0xfe6e('0x117'),_0x12dc4e[_0xfe6e('0x65')][_0xfe6e('0xa2')],_0xfe6e('0x118')),![]);return _0x531f0c[_0xfe6e('0x2a')](_0x5534fd);});default:return respondWithRpcPromise('QueuePause','unpause',{'id':_0x531f0c['id'],'name':_0x531f0c[_0xfe6e('0x3d')],'pause':![]})[_0xfe6e('0x19')](function(){return db[_0xfe6e('0xb9')][_0xfe6e('0x2a')]({'paused':0x0},{'where':{'UserId':_0x531f0c['id']}});})['then'](function(){return db[_0xfe6e('0x102')][_0xfe6e('0x91')]({'where':{'membername':_0x531f0c['name'],'type':_0xfe6e('0x106'),'exitAt':null}});})[_0xfe6e('0x19')](function(_0x42209f){var _0x5c13b0=[];_0x42209f[_0xfe6e('0x103')](function(_0x53d08e){_0x5c13b0[_0xfe6e('0x4c')](_0x53d08e[_0xfe6e('0x2a')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xfe6e('0x115')}));});return BPromise[_0xfe6e('0x64')](_0x5c13b0);})[_0xfe6e('0x19')](function(){return _0x531f0c[_0xfe6e('0x2a')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0xfe6e('0x19')](respondWithResult(_0x3b8d3d,null))[_0xfe6e('0x56')](handleError(_0x3b8d3d,null));};exports[_0xfe6e('0x119')]=function(_0x17e2a5,_0x21305e){var _0x40f6d2={};var _0x35ad98={};var _0x4c360b;var _0xeb3e59;return db[_0xfe6e('0x3f')][_0xfe6e('0x9c')]({'where':{'id':_0x17e2a5[_0xfe6e('0x58')]['id']}})[_0xfe6e('0x19')](handleEntityNotFound(_0x21305e,null))[_0xfe6e('0x19')](function(_0x2e45d6){if(_0x2e45d6){_0x4c360b=_0x2e45d6;_0x35ad98[_0xfe6e('0x5c')]=_[_0xfe6e('0x5a')](db[_0xfe6e('0x11a')][_0xfe6e('0x40')]);_0x35ad98['query']=_[_0xfe6e('0x5a')](_0x17e2a5[_0xfe6e('0x47')]);_0x35ad98[_0xfe6e('0xd5')]=_['intersection'](_0x35ad98[_0xfe6e('0x5c')],_0x35ad98['query']);_0x40f6d2[_0xfe6e('0x4b')]=_['intersection'](_0x35ad98[_0xfe6e('0x5c')],qs['fields'](_0x17e2a5[_0xfe6e('0x47')]['fields']));_0x40f6d2[_0xfe6e('0x4b')]=_0x40f6d2[_0xfe6e('0x4b')]['length']?_0x40f6d2[_0xfe6e('0x4b')]:_0x35ad98[_0xfe6e('0x5c')];_0x40f6d2['order']=qs[_0xfe6e('0xd4')](_0x17e2a5[_0xfe6e('0x47')][_0xfe6e('0xd4')]);_0x40f6d2[_0xfe6e('0x46')]=qs[_0xfe6e('0xd5')](_[_0xfe6e('0xd6')](_0x17e2a5['query'],_0x35ad98[_0xfe6e('0xd5')]));if(_0x17e2a5['query']['filter']){_0x40f6d2['where']=_[_0xfe6e('0x60')](_0x40f6d2[_0xfe6e('0x46')],{'$or':_[_0xfe6e('0x36')](_0x40f6d2[_0xfe6e('0x4b')],function(_0x46666e){var _0x118d45={};_0x118d45[_0x46666e]={'$like':'%'+_0x17e2a5['query']['filter']+'%'};return _0x118d45;})});}_0x40f6d2=_[_0xfe6e('0x60')]({},_0x40f6d2,_0x17e2a5['options']);return _0x4c360b['getTeams'](_0x40f6d2);}})[_0xfe6e('0x19')](function(_0x450302){if(_0x450302){_0xeb3e59=_0x450302[_0xfe6e('0x50')];if(!_0x17e2a5[_0xfe6e('0x47')][_0xfe6e('0xd7')](_0xfe6e('0xdd'))){_0x40f6d2[_0xfe6e('0x26')]=qs[_0xfe6e('0x26')](_0x17e2a5['query'][_0xfe6e('0x26')]);_0x40f6d2[_0xfe6e('0x25')]=qs[_0xfe6e('0x25')](_0x17e2a5[_0xfe6e('0x47')][_0xfe6e('0x25')]);}return _0x4c360b['getTeams'](_0x40f6d2);}})[_0xfe6e('0x19')](function(_0x57fb84){if(_0x57fb84){return _0x57fb84?{'count':_0xeb3e59,'rows':_0x57fb84}:null;}})[_0xfe6e('0x19')](respondWithResult(_0x21305e,null))[_0xfe6e('0x56')](handleError(_0x21305e,null));};exports[_0xfe6e('0x11b')]=function(_0x18c2b9,_0x463917){return db['User']['find']({'where':{'id':_0x18c2b9[_0xfe6e('0x58')]['id']}})['then'](handleEntityNotFound(_0x463917,null))[_0xfe6e('0x19')](function(_0x1ba329){if(_0x1ba329){var _0xb2fc38=_0x1ba329[_0xfe6e('0x2c')]({'plain':!![]});return _0x1ba329[_0xfe6e('0x11b')](_0x18c2b9[_0xfe6e('0x65')][_0xfe6e('0x68')],_[_0xfe6e('0x11c')](_0x18c2b9[_0xfe6e('0x65')],['ids','id'])||{})[_0xfe6e('0x19')](function(){for(var _0x2b522b=0x0;_0x2b522b<_0x18c2b9[_0xfe6e('0x65')]['ids'][_0xfe6e('0x50')];_0x2b522b++){var _0x43d8df=[];var _0x428f21={};db[_0xfe6e('0x11a')]['findOne']({'where':{'id':_0x18c2b9[_0xfe6e('0x65')][_0xfe6e('0x68')][_0x2b522b]}})[_0xfe6e('0x19')](function(_0x35ebd7){_0x428f21=_0x35ebd7[_0xfe6e('0x51')];_0x43d8df[_0xfe6e('0x4c')](_0x35ebd7[_0xfe6e('0x100')]()[_0xfe6e('0x19')](function(_0x40256e){for(var _0x5a5974=0x0;_0x5a5974<_0x40256e[_0xfe6e('0x50')];_0x5a5974++){_0x40256e[_0x5a5974][_0xfe6e('0x11d')]('channel','Voice');}return _0x40256e;}));_0x43d8df[_0xfe6e('0x4c')](_0x35ebd7[_0xfe6e('0x11e')]()[_0xfe6e('0x19')](function(_0x215542){for(var _0x4f0412=0x0;_0x4f0412<_0x215542['length'];_0x4f0412++){_0x215542[_0x4f0412]['setDataValue'](_0xfe6e('0xa2'),_0xfe6e('0x11f'));}return _0x215542;}));_0x43d8df[_0xfe6e('0x4c')](_0x35ebd7[_0xfe6e('0x120')]()[_0xfe6e('0x19')](function(_0x2d19ae){for(var _0x4b7af3=0x0;_0x4b7af3<_0x2d19ae[_0xfe6e('0x50')];_0x4b7af3++){_0x2d19ae[_0x4b7af3][_0xfe6e('0x11d')](_0xfe6e('0xa2'),_0xfe6e('0x121'));}return _0x2d19ae;}));_0x43d8df[_0xfe6e('0x4c')](_0x35ebd7[_0xfe6e('0x122')]()[_0xfe6e('0x19')](function(_0x35bdc6){for(var _0x352a2c=0x0;_0x352a2c<_0x35bdc6['length'];_0x352a2c++){_0x35bdc6[_0x352a2c][_0xfe6e('0x11d')]('channel',_0xfe6e('0x123'));}return _0x35bdc6;}));_0x43d8df[_0xfe6e('0x4c')](_0x35ebd7[_0xfe6e('0x124')]()[_0xfe6e('0x19')](function(_0x58c007){for(var _0x2fa1f4=0x0;_0x2fa1f4<_0x58c007[_0xfe6e('0x50')];_0x2fa1f4++){_0x58c007[_0x2fa1f4][_0xfe6e('0x11d')](_0xfe6e('0xa2'),'Whatsapp');}return _0x58c007;}));_0x43d8df[_0xfe6e('0x4c')](_0x35ebd7['getFaxQueues']()[_0xfe6e('0x19')](function(_0x51313a){for(var _0x387505=0x0;_0x387505<_0x51313a[_0xfe6e('0x50')];_0x387505++){_0x51313a[_0x387505]['setDataValue']('channel',_0xfe6e('0x125'));}return _0x51313a;}));_0x43d8df['push'](_0x35ebd7['getOpenchannelQueues']()[_0xfe6e('0x19')](function(_0x21f016){for(var _0x3276aa=0x0;_0x3276aa<_0x21f016[_0xfe6e('0x50')];_0x3276aa++){_0x21f016[_0x3276aa]['setDataValue']('channel',_0xfe6e('0x126'));}return _0x21f016;}));return BPromise[_0xfe6e('0x64')](_0x43d8df);})['then'](function(_0x261e69){var _0x9b14b4=_[_0xfe6e('0x127')](_0x261e69);_0x43d8df=[];return db[_0xfe6e('0x70')][_0xfe6e('0x128')](function(_0x1038e2){for(var _0x351e53=0x0;_0x351e53<_0x9b14b4[_0xfe6e('0x50')];_0x351e53++){_0x43d8df[_0xfe6e('0x4c')](_0x9b14b4[_0x351e53][_0xfe6e('0x129')](_0xb2fc38['id']),{'transaction':_0x1038e2});}return BPromise[_0xfe6e('0x64')](_0x43d8df)[_0xfe6e('0x19')](function(){if(_0xb2fc38[_0xfe6e('0xa3')]){return BPromise[_0xfe6e('0xb3')](_[_0xfe6e('0x34')](_0x9b14b4,function(_0x45981b){return _0x45981b[_0xfe6e('0x12a')](_0xfe6e('0xa2'))===_0xfe6e('0x12b');}),function(_0x1d792b){return db[_0xfe6e('0xb9')]['upsert']({'membername':_0xb2fc38[_0xfe6e('0x3d')],'UserId':_0xb2fc38['id'],'queue_name':_0x1d792b[_0xfe6e('0x3d')],'VoiceQueueId':_0x1d792b['id'],'interface':_['isNil'](_0xb2fc38[_0xfe6e('0xb2')])?util[_0xfe6e('0xf6')](_0xfe6e('0xb1'),_0xb2fc38['name']):_0xb2fc38[_0xfe6e('0xb2')],'paused':_0xb2fc38[_0xfe6e('0xa5')]||![],'penalty':_0xb2fc38[_0xfe6e('0xaa')]},{'transaction':_0x1038e2});});}else{return;}})[_0xfe6e('0x19')](function(){for(var _0x17512c=0x0;_0x17512c<_0x9b14b4[_0xfe6e('0x50')];_0x17512c++){var _0x3551e2=_0x9b14b4[_0x17512c][_0xfe6e('0x12a')](_0xfe6e('0xa2'));var _0x5d1015=_0x3551e2+_0xfe6e('0xb7');socket[_0xfe6e('0xac')](_0xfe6e('0x30')+_0x3551e2+_0xfe6e('0xae'),{'UserId':_0xb2fc38['id'],['queueField']:_0x9b14b4[_0x17512c]['id']});}});});})[_0xfe6e('0x19')](function(){db[_0xfe6e('0x12c')][_0xfe6e('0x9c')]({'where':{'teamId':_0x428f21['id']}})[_0xfe6e('0x19')](function(_0x21e8e2){if(_0x21e8e2){db['UserVoicePrefix']['create']({'UserId':_0x18c2b9[_0xfe6e('0x58')]['id'],'VoicePrefixId':_0x21e8e2['VoicePrefixId']});}});});}});}})['then'](respondWithStatusCode(_0x463917,null))[_0xfe6e('0x56')](handleError(_0x463917,null));};exports['removeTeams']=function(_0x506c66,_0x1d4640){return db[_0xfe6e('0x3f')][_0xfe6e('0x9c')]({'where':{'id':_0x506c66[_0xfe6e('0x58')]['id']}})['then'](handleEntityNotFound(_0x1d4640,null))[_0xfe6e('0x19')](function(_0x41d285){if(_0x41d285){var _0x1ef7fb=_0x41d285['get']({'plain':!![]});var _0xbcdfaf=_0x506c66['query'][_0xfe6e('0x68')];return _0x41d285[_0xfe6e('0x12d')](_0xbcdfaf)['then'](function(){for(var _0x496a53=0x0;_0x496a53<_0xbcdfaf[_0xfe6e('0x50')];_0x496a53++){var _0x24bfce=[];var _0x33099a={};db[_0xfe6e('0x11a')][_0xfe6e('0x9c')]({'where':{'id':_0xbcdfaf[_0x496a53]}})[_0xfe6e('0x19')](function(_0x471e55){_0x33099a=_0x471e55[_0xfe6e('0x51')];_0x24bfce[_0xfe6e('0x4c')](_0x471e55[_0xfe6e('0x100')]()[_0xfe6e('0x19')](function(_0x23f81d){for(var _0x4f1016=0x0;_0x4f1016<_0x23f81d[_0xfe6e('0x50')];_0x4f1016++){_0x23f81d[_0x4f1016][_0xfe6e('0x11d')](_0xfe6e('0xa2'),_0xfe6e('0x12b'));}return _0x23f81d;}));_0x24bfce['push'](_0x471e55[_0xfe6e('0x11e')]()['then'](function(_0x51a7ac){for(var _0x5485df=0x0;_0x5485df<_0x51a7ac[_0xfe6e('0x50')];_0x5485df++){_0x51a7ac[_0x5485df][_0xfe6e('0x11d')](_0xfe6e('0xa2'),_0xfe6e('0x11f'));}return _0x51a7ac;}));_0x24bfce[_0xfe6e('0x4c')](_0x471e55[_0xfe6e('0x120')]()[_0xfe6e('0x19')](function(_0x289383){for(var _0x49e9a0=0x0;_0x49e9a0<_0x289383[_0xfe6e('0x50')];_0x49e9a0++){_0x289383[_0x49e9a0][_0xfe6e('0x11d')](_0xfe6e('0xa2'),_0xfe6e('0x121'));}return _0x289383;}));_0x24bfce[_0xfe6e('0x4c')](_0x471e55[_0xfe6e('0x122')]()[_0xfe6e('0x19')](function(_0x1023f2){for(var _0x5a3513=0x0;_0x5a3513<_0x1023f2[_0xfe6e('0x50')];_0x5a3513++){_0x1023f2[_0x5a3513][_0xfe6e('0x11d')](_0xfe6e('0xa2'),'Sms');}return _0x1023f2;}));_0x24bfce['push'](_0x471e55[_0xfe6e('0x124')]()[_0xfe6e('0x19')](function(_0x3f7180){for(var _0x174ba1=0x0;_0x174ba1<_0x3f7180['length'];_0x174ba1++){_0x3f7180[_0x174ba1][_0xfe6e('0x11d')](_0xfe6e('0xa2'),_0xfe6e('0x12e'));}return _0x3f7180;}));_0x24bfce[_0xfe6e('0x4c')](_0x471e55[_0xfe6e('0x12f')]()[_0xfe6e('0x19')](function(_0xb18a99){for(var _0xe42536=0x0;_0xe42536<_0xb18a99[_0xfe6e('0x50')];_0xe42536++){_0xb18a99[_0xe42536][_0xfe6e('0x11d')](_0xfe6e('0xa2'),_0xfe6e('0x125'));}return _0xb18a99;}));_0x24bfce[_0xfe6e('0x4c')](_0x471e55[_0xfe6e('0x130')]()[_0xfe6e('0x19')](function(_0x45f3d4){for(var _0x49f37c=0x0;_0x49f37c<_0x45f3d4[_0xfe6e('0x50')];_0x49f37c++){_0x45f3d4[_0x49f37c][_0xfe6e('0x11d')]('channel',_0xfe6e('0x126'));}return _0x45f3d4;}));return BPromise[_0xfe6e('0x64')](_0x24bfce);})[_0xfe6e('0x19')](function(_0x244276){var _0x5a5f04=_[_0xfe6e('0x127')](_0x244276);_0x24bfce=[];return db[_0xfe6e('0x70')][_0xfe6e('0x128')](function(_0x116828){for(var _0x14e714=0x0;_0x14e714<_0x5a5f04[_0xfe6e('0x50')];_0x14e714++){_0x24bfce[_0xfe6e('0x4c')](_0x5a5f04[_0x14e714]['removeAgent'](_0x1ef7fb['id']),{'transaction':_0x116828});}return BPromise[_0xfe6e('0x64')](_0x24bfce)[_0xfe6e('0x19')](function(){if(_0x1ef7fb[_0xfe6e('0xa3')]){return BPromise['each'](_[_0xfe6e('0x34')](_0x5a5f04,function(_0x5e6b00){return _0x5e6b00[_0xfe6e('0x12a')](_0xfe6e('0xa2'))===_0xfe6e('0x12b');}),function(_0x258057){return db[_0xfe6e('0xb9')]['destroy']({'where':{'VoiceQueueId':_0x258057['id'],'UserId':_0x1ef7fb['id']},'transaction':_0x116828});});}else{return;}})[_0xfe6e('0x19')](function(){db[_0xfe6e('0x12c')]['findOne']({'where':{'teamId':_0x33099a['id']}})[_0xfe6e('0x19')](function(_0x3af602){if(_0x3af602){return db[_0xfe6e('0x131')][_0xfe6e('0x2b')]({'where':{'UserId':_0x1ef7fb['id'],'VoicePrefixId':_0x3af602[_0xfe6e('0x51')]['VoicePrefixId']}});}});})[_0xfe6e('0x19')](function(){for(var _0x2d9d9e=0x0;_0x2d9d9e<_0x5a5f04['length'];_0x2d9d9e++){var _0x26c9b8=_0x5a5f04[_0x2d9d9e][_0xfe6e('0x12a')](_0xfe6e('0xa2'));var _0x37ffe6=_0x26c9b8+_0xfe6e('0xb7');socket[_0xfe6e('0xac')](_0xfe6e('0x30')+_0x26c9b8+_0xfe6e('0xb8'),{'UserId':_0x1ef7fb['id'],['queueField']:_0x5a5f04[_0x2d9d9e]['id']});}});});});}});}})[_0xfe6e('0x19')](respondWithStatusCode(_0x1d4640,null))[_0xfe6e('0x56')](handleError(_0x1d4640,null));};exports[_0xfe6e('0x132')]=function(_0x44b2d4,_0x3feb16){var _0x243c3e={};var _0x150358={};var _0x5c17b1;var _0x383372;return db[_0xfe6e('0x3f')][_0xfe6e('0x9c')]({'where':{'id':_0x44b2d4[_0xfe6e('0x58')]['id']}})[_0xfe6e('0x19')](handleEntityNotFound(_0x3feb16,null))[_0xfe6e('0x19')](function(_0x392478){if(_0x392478){_0x5c17b1=_0x392478;_0x150358['model']=_['keys'](db[_0xfe6e('0xd8')][_0xfe6e('0x40')]);_0x150358['query']=_[_0xfe6e('0x5a')](_0x44b2d4['query']);_0x150358[_0xfe6e('0xd5')]=_[_0xfe6e('0x5b')](_0x150358['model'],_0x150358[_0xfe6e('0x47')]);_0x243c3e[_0xfe6e('0x4b')]=_[_0xfe6e('0x5b')](_0x150358['model'],qs[_0xfe6e('0x5d')](_0x44b2d4[_0xfe6e('0x47')]['fields']));_0x243c3e[_0xfe6e('0x4b')]=_0x243c3e[_0xfe6e('0x4b')][_0xfe6e('0x50')]?_0x243c3e['attributes']:_0x150358['model'];_0x243c3e[_0xfe6e('0xd3')]=qs[_0xfe6e('0xd4')](_0x44b2d4[_0xfe6e('0x47')][_0xfe6e('0xd4')]);_0x243c3e[_0xfe6e('0x46')]=qs[_0xfe6e('0xd5')](_['pick'](_0x44b2d4[_0xfe6e('0x47')],_0x150358[_0xfe6e('0xd5')]));if(_0x44b2d4[_0xfe6e('0x47')]['filter']){_0x243c3e[_0xfe6e('0x46')]=_[_0xfe6e('0x60')](_0x243c3e['where'],{'$or':_[_0xfe6e('0x36')](_0x243c3e[_0xfe6e('0x4b')],function(_0x3f756c){var _0x56f7cb={};_0x56f7cb[_0x3f756c]={'$like':'%'+_0x44b2d4[_0xfe6e('0x47')]['filter']+'%'};return _0x56f7cb;})});}_0x243c3e=_['merge']({},_0x243c3e,_0x44b2d4['options']);return _0x5c17b1[_0xfe6e('0x132')](_0x243c3e);}})['then'](function(_0x2eb0a7){if(_0x2eb0a7){_0x383372=_0x2eb0a7['length'];if(!_0x44b2d4['query'][_0xfe6e('0xd7')]('nolimit')){_0x243c3e[_0xfe6e('0x26')]=qs[_0xfe6e('0x26')](_0x44b2d4[_0xfe6e('0x47')][_0xfe6e('0x26')]);_0x243c3e[_0xfe6e('0x25')]=qs[_0xfe6e('0x25')](_0x44b2d4[_0xfe6e('0x47')][_0xfe6e('0x25')]);}return _0x5c17b1['getLists'](_0x243c3e);}})[_0xfe6e('0x19')](function(_0x5a6914){if(_0x5a6914){return _0x5a6914?{'count':_0x383372,'rows':_0x5a6914}:null;}})[_0xfe6e('0x19')](respondWithResult(_0x3feb16,null))[_0xfe6e('0x56')](handleError(_0x3feb16,null));};exports[_0xfe6e('0x133')]=function(_0x4a6f79,_0x52a088){var _0x2a3551={};var _0x3a3029={};var _0x967254;return db[_0xfe6e('0x3f')][_0xfe6e('0x9c')]({'where':{'id':_0x4a6f79[_0xfe6e('0x58')]['id']}})['then'](handleEntityNotFound(_0x52a088,null))[_0xfe6e('0x19')](function(_0x27d94d){if(_0x27d94d){_0x967254=_0x27d94d;_0x3a3029[_0xfe6e('0x5c')]=_[_0xfe6e('0x5a')](db[_0xfe6e('0x3f')][_0xfe6e('0x40')]);_0x3a3029[_0xfe6e('0x47')]=_[_0xfe6e('0x5a')](_0x4a6f79['query']);_0x3a3029[_0xfe6e('0xd5')]=_[_0xfe6e('0x5b')](_0x3a3029[_0xfe6e('0x5c')],_0x3a3029[_0xfe6e('0x47')]);_0x2a3551[_0xfe6e('0x4b')]=_[_0xfe6e('0x5b')](_0x3a3029[_0xfe6e('0x5c')],qs['fields'](_0x4a6f79[_0xfe6e('0x47')][_0xfe6e('0x5d')]));_0x2a3551[_0xfe6e('0x4b')]=_0x2a3551[_0xfe6e('0x4b')][_0xfe6e('0x50')]?_0x2a3551['attributes']:_0x3a3029['model'];_0x2a3551[_0xfe6e('0xd3')]=qs[_0xfe6e('0xd4')](_0x4a6f79['query'][_0xfe6e('0xd4')]);_0x2a3551[_0xfe6e('0x46')]=qs[_0xfe6e('0xd5')](_[_0xfe6e('0xd6')](_0x4a6f79['query'],_0x3a3029[_0xfe6e('0xd5')]));if(_0x4a6f79['query'][_0xfe6e('0x34')]){_0x2a3551[_0xfe6e('0x46')]=_[_0xfe6e('0x60')](_0x2a3551[_0xfe6e('0x46')],{'$or':_[_0xfe6e('0x36')](_0x2a3551[_0xfe6e('0x4b')],function(_0x58d721){var _0x41e162={};_0x41e162[_0x58d721]={'$like':'%'+_0x4a6f79[_0xfe6e('0x47')]['filter']+'%'};return _0x41e162;})});}_0x2a3551[_0xfe6e('0x5c')]=db[_0xfe6e('0x3f')];_0x2a3551['as']='Agents';_0x2a3551=_[_0xfe6e('0x60')]({},_0x2a3551,_0x4a6f79[_0xfe6e('0x61')]);return _0x967254[_0xfe6e('0x100')]({'include':[_0x2a3551]});}})['then'](function(_0x497d20){if(_0x497d20){var _0x310fca={},_0x4b33b2=[];for(var _0x45c9f8=0x0;_0x45c9f8<_0x497d20['length'];_0x45c9f8+=0x1){for(var _0x149184=0x0,_0x2ceee0;_0x149184<_0x497d20[_0x45c9f8][_0xfe6e('0x31')][_0xfe6e('0x50')];_0x149184+=0x1){_0x2ceee0=_0x497d20[_0x45c9f8][_0xfe6e('0x31')][_0x149184][_0xfe6e('0x2c')]({'plain':!![]});_0x310fca[_0x2ceee0['id']]=_0x2ceee0;}}_0x310fca=_[_0xfe6e('0x134')](_0x310fca);for(var _0x50f749=qs[_0xfe6e('0x25')](_0x4a6f79[_0xfe6e('0x47')]['offset']);_0x50f749<_0x310fca[_0xfe6e('0x50')]&&_0x4b33b2[_0xfe6e('0x50')]=_0x53ecce[_0x48b3('0x52')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})['then'](function(){if(_0x296332){return db[_0x48b3('0x2a')][_0x48b3('0x53')]({'where':{'membername':_0x296332[_0x48b3('0x2c')]},'individualHooks':!![]});}})[_0x48b3('0x10')](function(){if(_0x296332){return _0x296332[_0x48b3('0x54')]({'raw':!![]});}})[_0x48b3('0x10')](function(_0x5645c8){if(_0x296332){if(_0x5645c8){var _0x361998=[];_0x1eff12=_0x5645c8;if(_0x1eff12[_0x48b3('0x2f')]){for(var _0x4bb75c=0x0;_0x4bb75c<_0x1eff12['length'];_0x4bb75c++){_0x361998['push'](db[_0x48b3('0x2a')][_0x48b3('0x55')]({'membername':_0x296332['name'],'UserId':_0x296332['id'],'queue_name':_0x1eff12[_0x4bb75c][_0x48b3('0x2c')],'VoiceQueueId':_0x1eff12[_0x4bb75c]['id'],'interface':_0x2f19aa,'paused':_0x296332[_0x48b3('0x56')]||![],'penalty':_0x1eff12[_0x4bb75c][_0x48b3('0x57')]||0x0}));}return BPromise['all'](_0x361998);}}}})[_0x48b3('0x10')](function(){if(_0x296332){return db['MemberReport'][_0x48b3('0x1e')]({'where':{'membername':_0x296332[_0x48b3('0x2c')],'exitAt':null}});}})[_0x48b3('0x10')](function(_0x4e70d0){if(_0x296332){if(_0x4e70d0&&_0x4e70d0[_0x48b3('0x2f')]){var _0x2423e3=[];_0x4e70d0[_0x48b3('0x32')](function(_0x2c57a0){_0x2423e3[_0x48b3('0x33')](_0x2c57a0['update']({'exitAt':moment()[_0x48b3('0x35')](_0x48b3('0x2e'))}));});return BPromise[_0x48b3('0x4b')](_0x2423e3);}}})[_0x48b3('0x10')](function(_0x2d1eae){if(_0x296332){var _0x515481=[];var _0x56d390=[];var _0x3577f9=utils['getChannels']();var _0x559d35={'membername':_0x296332[_0x48b3('0x2c')],'interface':_0x2f19aa,'enterAt':moment()[_0x48b3('0x35')](_0x48b3('0x2e')),'role':_0x296332[_0x48b3('0x3a')],'internal':_0x296332[_0x48b3('0x28')]};_0x3577f9['forEach'](function(_0x489e52){_0x515481[_0x48b3('0x33')](_[_0x48b3('0x58')]({'channel':_0x489e52,'type':_0x48b3('0x59'),'data1':_0x48b3('0x5a'),'data2':_0x2f19aa},_0x559d35));if(_0x296332['loginInPause']){_0x56d390[_0x48b3('0x33')](_[_0x48b3('0x58')]({'channel':_0x489e52,'type':_0x48b3('0x2d'),'data1':'LOGININPAUSE'},_0x559d35));}});return db[_0x48b3('0x3c')][_0x48b3('0x3d')](_0x515481[_0x48b3('0x5b')](_0x56d390),{'individualHooks':!![]});}})['then'](function(){if(_0x296332){return _0x296332['update']({'online':!![],'lastLoginAt':moment()[_0x48b3('0x35')](_0x48b3('0x2e')),'voicePause':_0x296332[_0x48b3('0x56')]||![],'mailPause':_0x296332[_0x48b3('0x56')]||![],'chatPause':_0x296332[_0x48b3('0x56')]||![],'faxPause':_0x296332[_0x48b3('0x56')]||![],'smsPause':_0x296332['loginInPause']||![],'openchannelPause':_0x296332[_0x48b3('0x56')]||![],'pauseType':_0x296332[_0x48b3('0x56')]?_0x48b3('0x5c'):null,'lastPauseAt':moment()[_0x48b3('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x2f19aa});}})[_0x48b3('0x10')](function(_0x3d4b1a){_0x4d1056(_0x3d4b1a);})[_0x48b3('0x1b')](function(_0x375d03){_0x591a5b(_0x16ca8c['error'](0x1f4,_0x375d03[_0x48b3('0x19')]));});});}; \ No newline at end of file +var _0xa11c=['debug','raw','ShowUser','PauseUser','find','name','role','internal','interface','update','MemberReport','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','format','SIP/%s','type','DEFAULT\x20PAUSE','body','UnpauseUser','findOne','channel','isValidChannel','Unknown\x20channel','voice','system','mail','chat','sms','openchannel','whatsapp','set','%s%s','Pause','all','UserVoiceQueueRt','destroy','LoginUser','mobile','count','agent','getLicense','upsert','UserVoiceQueue.penalty','merge','loginInPause','LOGININPAUSE','bulkCreate','concat','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetUser','User','findAll','options','where','attributes','limit','include','map','model'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa11c,0xee));var _0xca11=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xa11c[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0xca11('0x0'));var util=require(_0xca11('0x1'));var moment=require(_0xca11('0x2'));var BPromise=require(_0xca11('0x3'));var rs=require(_0xca11('0x4'));var fs=require('fs');var Redis=require(_0xca11('0x5'));var db=require(_0xca11('0x6'))['db'];var utils=require(_0xca11('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xca11('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xca11('0x9')][_0xca11('0xa')]({'port':0x232a});config[_0xca11('0xb')]=_[_0xca11('0xc')](config[_0xca11('0xb')],{'host':_0xca11('0xd'),'port':0x18eb});var socket=require(_0xca11('0xe'))(new Redis(config['redis']));require('./user.socket')[_0xca11('0xf')](socket);function respondWithRpcPromise(_0x3114ea,_0x23639b,_0x228bff){return new BPromise(function(_0xc5d9fa,_0x372a1d){return client[_0xca11('0x10')](_0x3114ea,_0x228bff)[_0xca11('0x11')](function(_0x38a2dc){logger[_0xca11('0x12')](_0xca11('0x13'),_0x23639b,_0xca11('0x14'));logger['debug'](_0xca11('0x15'),_0x23639b,_0xca11('0x14'),JSON[_0xca11('0x16')](_0x38a2dc));if(_0x38a2dc[_0xca11('0x17')]){if(_0x38a2dc[_0xca11('0x17')][_0xca11('0x18')]===0x1f4){logger[_0xca11('0x17')](_0xca11('0x13'),_0x23639b,_0x38a2dc[_0xca11('0x17')][_0xca11('0x19')]);return _0x372a1d(_0x38a2dc[_0xca11('0x17')][_0xca11('0x19')]);}logger[_0xca11('0x17')](_0xca11('0x13'),_0x23639b,_0x38a2dc[_0xca11('0x17')][_0xca11('0x19')]);return _0xc5d9fa(_0x38a2dc['error'][_0xca11('0x19')]);}else{logger[_0xca11('0x12')](_0xca11('0x13'),_0x23639b,_0xca11('0x14'));_0xc5d9fa(_0x38a2dc[_0xca11('0x1a')][_0xca11('0x19')]);}})[_0xca11('0x1b')](function(_0x5f4ee6){logger[_0xca11('0x17')]('User,\x20%s,\x20%s',_0x23639b,_0x5f4ee6);_0x372a1d(_0x5f4ee6);});});}exports[_0xca11('0x1c')]=function(_0x7a6ad8){var _0x1da1e7=this;return new Promise(function(_0x440a8d,_0x4ab43f){return db[_0xca11('0x1d')][_0xca11('0x1e')]({'raw':_0x7a6ad8[_0xca11('0x1f')]?_0x7a6ad8['options']['raw']===undefined?!![]:![]:!![],'where':_0x7a6ad8[_0xca11('0x1f')]?_0x7a6ad8['options'][_0xca11('0x20')]||null:null,'attributes':_0x7a6ad8[_0xca11('0x1f')]?_0x7a6ad8['options'][_0xca11('0x21')]||null:null,'limit':_0x7a6ad8[_0xca11('0x1f')]?_0x7a6ad8['options'][_0xca11('0x22')]||null:null,'include':_0x7a6ad8['options']?_0x7a6ad8[_0xca11('0x1f')][_0xca11('0x23')]?_[_0xca11('0x24')](_0x7a6ad8[_0xca11('0x1f')]['include'],function(_0x3c9398){return{'model':db[_0x3c9398['model']],'as':_0x3c9398['as'],'attributes':_0x3c9398[_0xca11('0x21')],'include':_0x3c9398[_0xca11('0x23')]?_['map'](_0x3c9398[_0xca11('0x23')],function(_0x487ebf){return{'model':db[_0x487ebf[_0xca11('0x25')]],'as':_0x487ebf['as'],'attributes':_0x487ebf[_0xca11('0x21')],'include':_0x487ebf[_0xca11('0x23')]?_[_0xca11('0x24')](_0x487ebf[_0xca11('0x23')],function(_0x1b4b61){return{'model':db[_0x1b4b61[_0xca11('0x25')]],'as':_0x1b4b61['as'],'attributes':_0x1b4b61[_0xca11('0x21')]};}):[]};}):[]};}):[]:[]})[_0xca11('0x11')](function(_0x56f4bd){logger[_0xca11('0x12')](_0xca11('0x1c'),_0x7a6ad8);logger[_0xca11('0x26')](_0xca11('0x1c'),_0x7a6ad8,JSON['stringify'](_0x56f4bd));_0x440a8d(_0x56f4bd);})[_0xca11('0x1b')](function(_0x154461){logger['error'](_0xca11('0x1c'),_0x154461[_0xca11('0x19')],_0x7a6ad8);_0x4ab43f(_0x1da1e7[_0xca11('0x17')](0x1f4,_0x154461[_0xca11('0x19')]));});});};exports['ShowUser']=function(_0x2b9c7d){var _0x2fa1c4=this;return new Promise(function(_0x5f5ce6,_0x2c0b84){return db[_0xca11('0x1d')]['find']({'raw':_0x2b9c7d[_0xca11('0x1f')]?_0x2b9c7d[_0xca11('0x1f')][_0xca11('0x27')]===undefined?!![]:![]:!![],'where':_0x2b9c7d[_0xca11('0x1f')]?_0x2b9c7d[_0xca11('0x1f')][_0xca11('0x20')]||null:null,'attributes':_0x2b9c7d[_0xca11('0x1f')]?_0x2b9c7d[_0xca11('0x1f')][_0xca11('0x21')]||null:null,'include':_0x2b9c7d[_0xca11('0x1f')]?_0x2b9c7d['options'][_0xca11('0x23')]?_[_0xca11('0x24')](_0x2b9c7d[_0xca11('0x1f')][_0xca11('0x23')],function(_0x34f069){return{'model':db[_0x34f069[_0xca11('0x25')]],'as':_0x34f069['as'],'attributes':_0x34f069[_0xca11('0x21')],'include':_0x34f069[_0xca11('0x23')]?_['map'](_0x34f069[_0xca11('0x23')],function(_0x36b726){return{'model':db[_0x36b726[_0xca11('0x25')]],'as':_0x36b726['as'],'attributes':_0x36b726[_0xca11('0x21')],'include':_0x36b726[_0xca11('0x23')]?_[_0xca11('0x24')](_0x36b726[_0xca11('0x23')],function(_0x339e9e){return{'model':db[_0x339e9e[_0xca11('0x25')]],'as':_0x339e9e['as'],'attributes':_0x339e9e['attributes']};}):[]};}):[]};}):[]:[]})[_0xca11('0x11')](function(_0x57cc4c){logger['info']('ShowUser',_0x2b9c7d);logger[_0xca11('0x26')]('ShowUser',_0x2b9c7d,JSON[_0xca11('0x16')](_0x57cc4c));_0x5f5ce6(_0x57cc4c);})['catch'](function(_0x279b37){logger[_0xca11('0x17')](_0xca11('0x28'),_0x279b37['message'],_0x2b9c7d);_0x2c0b84(_0x2fa1c4['error'](0x1f4,_0x279b37[_0xca11('0x19')]));});});};exports[_0xca11('0x29')]=function(_0x5e6ad2){var _0x3b66ae=this;return new Promise(function(_0xe5f9ed,_0x304243){var _0x1cc234;return db[_0xca11('0x1d')][_0xca11('0x2a')]({'where':_0x5e6ad2[_0xca11('0x1f')]['where']||{},'attributes':['id',_0xca11('0x2b'),_0xca11('0x2c'),_0xca11('0x2d'),_0xca11('0x2e')]})[_0xca11('0x11')](function(_0x3ff47d){if(_0x3ff47d){_0x1cc234=_0x3ff47d;return db['UserVoiceQueueRt'][_0xca11('0x2f')]({'paused':0x1},{'where':{'UserId':_0x1cc234['id']},'individualHooks':!![]});}})['then'](function(){if(_0x1cc234){return db[_0xca11('0x30')]['findAll']({'where':{'membername':_0x1cc234['name'],'type':_0xca11('0x31'),'exitAt':null}});}})[_0xca11('0x11')](function(_0x4a55f1){if(_0x1cc234){if(_0x4a55f1&&_0x4a55f1[_0xca11('0x32')]){var _0x4a41fc=moment()['format'](_0xca11('0x33'));for(var _0x555702=0x0,_0x475d5d=_0x4a55f1[_0xca11('0x32')];_0x555702<_0x475d5d;_0x555702++){_0x4a55f1[_0x555702][_0xca11('0x34')]({'exitAt':_0x4a41fc});}}}})['then'](function(){if(_0x1cc234){var _0x3be3c2=[];var _0x17f147=utils[_0xca11('0x35')]();_0x17f147[_0xca11('0x36')](function(_0x44b701){_0x3be3c2[_0xca11('0x37')]({'channel':_0x44b701,'membername':_0x1cc234['name'],'interface':_[_0xca11('0x38')](_0x1cc234[_0xca11('0x2e')])?util[_0xca11('0x39')](_0xca11('0x3a'),_0x1cc234[_0xca11('0x2b')]):_0x1cc234[_0xca11('0x2e')],'type':_0xca11('0x31'),'enterAt':moment()[_0xca11('0x39')](_0xca11('0x33')),'data1':_0x5e6ad2['body'][_0xca11('0x3b')]||_0xca11('0x3c'),'role':_0x1cc234[_0xca11('0x2c')],'internal':_0x1cc234[_0xca11('0x2d')],'uniqueid':_0x5e6ad2[_0xca11('0x3d')]['uniqueid']||null});});return db[_0xca11('0x30')]['bulkCreate'](_0x3be3c2,{'individualHooks':!![]});}})['then'](function(){if(_0x1cc234){return _0x1cc234[_0xca11('0x2f')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x5e6ad2[_0xca11('0x3d')][_0xca11('0x3b')]||_0xca11('0x3c'),'lastPauseAt':moment()[_0xca11('0x39')](_0xca11('0x33'))});}})[_0xca11('0x11')](function(_0xddfdf8){_0xe5f9ed(_0xddfdf8);})[_0xca11('0x1b')](function(_0x2d14ce){_0x304243(_0x3b66ae[_0xca11('0x17')](0x1f4,_0x2d14ce['message']));});});};exports[_0xca11('0x3e')]=function(_0x2a4056){var _0x2171e9=this;return new Promise(function(_0x305399,_0x46ffe6){var _0x483967;return db[_0xca11('0x1d')][_0xca11('0x3f')]({'where':_0x2a4056['options'][_0xca11('0x20')]||{},'attributes':['id',_0xca11('0x2b')]})[_0xca11('0x11')](function(_0x459251){if(_0x459251){_0x483967=_0x459251;if(_0x2a4056[_0xca11('0x3d')][_0xca11('0x40')]&&!utils[_0xca11('0x41')](_0x2a4056[_0xca11('0x3d')]['channel'])){throw new Error(_0xca11('0x42'));}switch(_0x2a4056['body'][_0xca11('0x40')]){case _0xca11('0x43'):return db['UserVoiceQueueRt'][_0xca11('0x2f')]({'paused':0x0},{'where':{'UserId':_0x483967['id']}})[_0xca11('0x11')](function(){return db['MemberReport'][_0xca11('0x2a')]({'where':{'channel':_0x2a4056[_0xca11('0x3d')][_0xca11('0x40')],'membername':_0x483967[_0xca11('0x2b')],'type':_0xca11('0x31'),'exitAt':null}});})[_0xca11('0x11')](function(_0x26b1d1){if(_0x26b1d1){return _0x26b1d1[_0xca11('0x2f')]({'exitAt':moment()[_0xca11('0x39')](_0xca11('0x33')),'data2':_0xca11('0x44')},{'individualHooks':!![]});}return null;})[_0xca11('0x11')](function(){return _0x483967['update']({'voicePause':![]});});case _0xca11('0x45'):case _0xca11('0x46'):case'fax':case _0xca11('0x47'):case _0xca11('0x48'):case _0xca11('0x49'):return db[_0xca11('0x30')][_0xca11('0x2a')]({'where':{'channel':_0x2a4056[_0xca11('0x3d')][_0xca11('0x40')],'membername':_0x483967[_0xca11('0x2b')],'type':_0xca11('0x31'),'exitAt':null}})[_0xca11('0x11')](function(_0x36a501){return _0x36a501['update']({'exitAt':moment()[_0xca11('0x39')](_0xca11('0x33')),'data2':'system'},{'individualHooks':!![]});})[_0xca11('0x11')](function(){var _0x3e4939={};_[_0xca11('0x4a')](_0x3e4939,util[_0xca11('0x39')](_0xca11('0x4b'),_0x2a4056['body'][_0xca11('0x40')],_0xca11('0x4c')),![]);return _0x483967[_0xca11('0x2f')](_0x3e4939);});default:return db['UserVoiceQueueRt'][_0xca11('0x2f')]({'paused':0x0},{'where':{'UserId':_0x483967['id']}})[_0xca11('0x11')](function(){return db[_0xca11('0x30')][_0xca11('0x1e')]({'where':{'membername':_0x483967[_0xca11('0x2b')],'type':_0xca11('0x31'),'exitAt':null}});})[_0xca11('0x11')](function(_0x5b2ec8){var _0x1acd91=[];_0x5b2ec8[_0xca11('0x36')](function(_0x3fe208){_0x1acd91[_0xca11('0x37')](_0x3fe208['update']({'exitAt':moment()[_0xca11('0x39')](_0xca11('0x33')),'data2':_0xca11('0x44')}));});return BPromise[_0xca11('0x4d')](_0x1acd91);})[_0xca11('0x11')](function(){return _0x483967[_0xca11('0x2f')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0xca11('0x11')](function(_0x1d6e83){_0x305399(_0x1d6e83);})[_0xca11('0x1b')](function(_0x3da8d9){_0x46ffe6(_0x2171e9[_0xca11('0x17')](0x1f4,_0x3da8d9[_0xca11('0x19')]));});});};exports['LogoutUser']=function(_0x1a19cc){var _0x37841a=this;return new Promise(function(_0x54383f,_0xcccf3a){var _0x5f598e;return db[_0xca11('0x1d')]['findOne']({'where':_0x1a19cc[_0xca11('0x1f')][_0xca11('0x20')]||{},'attributes':['id',_0xca11('0x2b')]})[_0xca11('0x11')](function(_0x1b170b){if(_0x1b170b){_0x5f598e=_0x1b170b;return db[_0xca11('0x4e')][_0xca11('0x4f')]({'where':{'membername':_0x5f598e[_0xca11('0x2b')]},'individualHooks':!![]});}})[_0xca11('0x11')](function(){if(_0x5f598e){return db['MemberReport'][_0xca11('0x1e')]({'where':{'membername':_0x5f598e[_0xca11('0x2b')],'exitAt':null}});}})['then'](function(_0x1b7dbe){if(_0x5f598e){if(_0x1b7dbe&&_0x1b7dbe['length']){var _0x4af94b=[];_0x1b7dbe[_0xca11('0x36')](function(_0x105b17){_0x4af94b[_0xca11('0x37')](_0x105b17[_0xca11('0x2f')]({'exitAt':moment()[_0xca11('0x39')](_0xca11('0x33'))}));});return BPromise[_0xca11('0x4d')](_0x4af94b);}}})[_0xca11('0x11')](function(){if(_0x5f598e){return _0x5f598e['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xca11('0x11')](function(_0x472902){_0x54383f(_0x472902);})['catch'](function(_0x589c41){_0xcccf3a(_0x37841a[_0xca11('0x17')](0x1f4,_0x589c41[_0xca11('0x19')]));});});};exports[_0xca11('0x50')]=function(_0x44cefe){var _0x11366e=this;return new Promise(function(_0x4c43bf,_0x59ec7a){var _0xad189a;var _0x427571;var _0x21ee91;var _0x293eb2;return db[_0xca11('0x1d')][_0xca11('0x3f')]({'where':_0x44cefe[_0xca11('0x1f')][_0xca11('0x20')]||{},'attributes':['id',_0xca11('0x2b'),_0xca11('0x2c'),_0xca11('0x51'),'phone',_0xca11('0x2d'),'loginInPause',_0xca11('0x2e')]})['then'](function(_0x383ed0){if(_0x383ed0){_0xad189a=_0x383ed0;_0x293eb2=_0x44cefe[_0xca11('0x3d')][_0xca11('0x2e')]?_0x44cefe[_0xca11('0x3d')][_0xca11('0x2e')]:util[_0xca11('0x39')](_0xca11('0x3a'),_0xad189a[_0xca11('0x2b')]);return db[_0xca11('0x1d')][_0xca11('0x52')]({'where':{'role':_0xca11('0x53'),'online':!![],'id':{'$ne':_0xad189a['id']}}});}})[_0xca11('0x11')](function(_0x1493ea){if(_0x1493ea){_0x21ee91=_0x1493ea;return require('../../config/license/util')[_0xca11('0x54')]();}})[_0xca11('0x11')](function(_0x2e52ed){if(_0x2e52ed&&_0x2e52ed['agents']&&_0x21ee91>=_0x2e52ed['agents']){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0xca11('0x11')](function(){if(_0xad189a){return db[_0xca11('0x4e')][_0xca11('0x4f')]({'where':{'membername':_0xad189a['name']},'individualHooks':!![]});}})['then'](function(){if(_0xad189a){return _0xad189a['getVoiceQueues']({'raw':!![]});}})[_0xca11('0x11')](function(_0x556871){if(_0xad189a){if(_0x556871){var _0x59e559=[];_0x427571=_0x556871;if(_0x427571[_0xca11('0x32')]){for(var _0x1b0302=0x0;_0x1b0302<_0x427571['length'];_0x1b0302++){_0x59e559[_0xca11('0x37')](db[_0xca11('0x4e')][_0xca11('0x55')]({'membername':_0xad189a['name'],'UserId':_0xad189a['id'],'queue_name':_0x427571[_0x1b0302][_0xca11('0x2b')],'VoiceQueueId':_0x427571[_0x1b0302]['id'],'interface':_0x293eb2,'paused':_0xad189a['loginInPause']||![],'penalty':_0x427571[_0x1b0302][_0xca11('0x56')]||0x0}));}return BPromise[_0xca11('0x4d')](_0x59e559);}}}})[_0xca11('0x11')](function(){if(_0xad189a){return db[_0xca11('0x30')][_0xca11('0x1e')]({'where':{'membername':_0xad189a[_0xca11('0x2b')],'exitAt':null}});}})[_0xca11('0x11')](function(_0x377205){if(_0xad189a){if(_0x377205&&_0x377205['length']){var _0x202aa9=[];_0x377205[_0xca11('0x36')](function(_0x17c9e5){_0x202aa9['push'](_0x17c9e5[_0xca11('0x2f')]({'exitAt':moment()[_0xca11('0x39')](_0xca11('0x33'))}));});return BPromise[_0xca11('0x4d')](_0x202aa9);}}})[_0xca11('0x11')](function(_0x2a0899){if(_0xad189a){var _0x4726d2=[];var _0xb350a2=[];var _0x13307b=utils[_0xca11('0x35')]();var _0x4adfe6={'membername':_0xad189a[_0xca11('0x2b')],'interface':_0x293eb2,'enterAt':moment()[_0xca11('0x39')](_0xca11('0x33')),'role':_0xad189a[_0xca11('0x2c')],'internal':_0xad189a[_0xca11('0x2d')]};_0x13307b[_0xca11('0x36')](function(_0x1d449d){_0x4726d2[_0xca11('0x37')](_[_0xca11('0x57')]({'channel':_0x1d449d,'type':'LOGIN','data1':'callysquare','data2':_0x293eb2},_0x4adfe6));if(_0xad189a[_0xca11('0x58')]){_0xb350a2[_0xca11('0x37')](_[_0xca11('0x57')]({'channel':_0x1d449d,'type':'PAUSE','data1':_0xca11('0x59')},_0x4adfe6));}});return db[_0xca11('0x30')][_0xca11('0x5a')](_0x4726d2[_0xca11('0x5b')](_0xb350a2),{'individualHooks':!![]});}})['then'](function(){if(_0xad189a){return _0xad189a[_0xca11('0x2f')]({'online':!![],'lastLoginAt':moment()[_0xca11('0x39')](_0xca11('0x33')),'voicePause':_0xad189a[_0xca11('0x58')]||![],'mailPause':_0xad189a[_0xca11('0x58')]||![],'chatPause':_0xad189a[_0xca11('0x58')]||![],'faxPause':_0xad189a['loginInPause']||![],'smsPause':_0xad189a['loginInPause']||![],'openchannelPause':_0xad189a[_0xca11('0x58')]||![],'pauseType':_0xad189a['loginInPause']?_0xca11('0x59'):null,'lastPauseAt':moment()[_0xca11('0x39')](_0xca11('0x33')),'interface':_0x293eb2});}})[_0xca11('0x11')](function(_0x484c19){_0x4c43bf(_0x484c19);})[_0xca11('0x1b')](function(_0x9a1204){_0x59ec7a(_0x11366e[_0xca11('0x17')](0x1f4,_0x9a1204['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 18d5424..61b92b2 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 _0xb31a=['user:','./user.events','remove','update','emit','removeListener','register','length'];(function(_0x909459,_0x4a4572){var _0x4a748e=function(_0x47d949){while(--_0x47d949){_0x909459['push'](_0x909459['shift']());}};_0x4a748e(++_0x4a4572);}(_0xb31a,0x131));var _0xab31=function(_0x167cbc,_0x391d2b){_0x167cbc=_0x167cbc-0x0;var _0x1de555=_0xb31a[_0x167cbc];return _0x1de555;};'use strict';var UserEvents=require(_0xab31('0x0'));var events=['save',_0xab31('0x1'),_0xab31('0x2')];function createListener(_0x2c129c,_0x4c6c4b){return function(_0x2739d1){_0x4c6c4b[_0xab31('0x3')](_0x2c129c,_0x2739d1);};}function removeListener(_0x380b19,_0x1c905a){return function(){UserEvents[_0xab31('0x4')](_0x380b19,_0x1c905a);};}exports[_0xab31('0x5')]=function(_0x1e91d6){for(var _0x1d5995=0x0,_0x59b734=events[_0xab31('0x6')];_0x1d5995<_0x59b734;_0x1d5995++){var _0x187c6d=events[_0x1d5995];var _0x24cfca=createListener(_0xab31('0x7')+_0x187c6d,_0x1e91d6);UserEvents['on'](_0x187c6d,_0x24cfca);}}; \ No newline at end of file +var _0xe7f9=['remove','update','emit','register','length','user:','./user.events'];(function(_0x3a2fe4,_0x4d59bb){var _0x24b359=function(_0x3fd0bb){while(--_0x3fd0bb){_0x3a2fe4['push'](_0x3a2fe4['shift']());}};_0x24b359(++_0x4d59bb);}(_0xe7f9,0x8b));var _0x9e7f=function(_0x595604,_0x2cc998){_0x595604=_0x595604-0x0;var _0x1466f3=_0xe7f9[_0x595604];return _0x1466f3;};'use strict';var UserEvents=require(_0x9e7f('0x0'));var events=['save',_0x9e7f('0x1'),_0x9e7f('0x2')];function createListener(_0x1ea1e7,_0x563ccb){return function(_0x476519){_0x563ccb[_0x9e7f('0x3')](_0x1ea1e7,_0x476519);};}function removeListener(_0x296af9,_0x5d669c){return function(){UserEvents['removeListener'](_0x296af9,_0x5d669c);};}exports[_0x9e7f('0x4')]=function(_0xfdc26c){for(var _0x4e660e=0x0,_0x2fc624=events[_0x9e7f('0x5')];_0x4e660e<_0x2fc624;_0x4e660e++){var _0x4f47af=events[_0x4e660e];var _0x23b439=createListener(_0x9e7f('0x6')+_0x4f47af,_0xfdc26c);UserEvents['on'](_0x4f47af,_0x23b439);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index b716bed..aa792db 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0xf728ac,_0x5d8ee6){var _0x353024=function(_0x5e6a13){while(--_0x5e6a13){_0xf728ac['push'](_0xf728ac['shift']());}};_0x353024(++_0x5d8ee6);}(_0xedd9,0xfc));var _0x9edd=function(_0xc25967,_0x569b11){_0xc25967=_0xc25967-0x0;var _0x2f5f97=_0xedd9[_0xc25967];return _0x2f5f97;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4de1b5,_0x2a7626){var _0xed55cf=function(_0x5f1115){while(--_0x5f1115){_0x4de1b5['push'](_0x4de1b5['shift']());}};_0xed55cf(++_0x2a7626);}(_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 diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index a383ee2..6cbdd4b 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 _0x27c9=['exports','INTEGER','sequelize'];(function(_0x271ba2,_0x54a752){var _0x4e760e=function(_0x5324ca){while(--_0x5324ca){_0x271ba2['push'](_0x271ba2['shift']());}};_0x4e760e(++_0x54a752);}(_0x27c9,0x1af));var _0x927c=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x27c9[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require(_0x927c('0x0'));module[_0x927c('0x1')]={'penalty':{'type':Sequelize[_0x927c('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0a2f=['INTEGER','sequelize'];(function(_0x160803,_0x33353){var _0x147c1d=function(_0x567d13){while(--_0x567d13){_0x160803['push'](_0x160803['shift']());}};_0x147c1d(++_0x33353);}(_0x0a2f,0x6b));var _0xf0a2=function(_0x3c51d4,_0x36ba53){_0x3c51d4=_0x3c51d4-0x0;var _0x53c45f=_0x0a2f[_0x3c51d4];return _0x53c45f;};'use strict';var Sequelize=require(_0xf0a2('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xf0a2('0x1')],'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 dddc064..ee521a1 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 _0x4b59=['../../config/logger','api','moment','request-promise','path','rimraf','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash'];(function(_0x2138ee,_0x524c31){var _0x36c2bd=function(_0x3a122f){while(--_0x3a122f){_0x2138ee['push'](_0x2138ee['shift']());}};_0x36c2bd(++_0x524c31);}(_0x4b59,0x1d3));var _0x94b5=function(_0x451d04,_0x999e7d){_0x451d04=_0x451d04-0x0;var _0x32c6fe=_0x4b59[_0x451d04];return _0x32c6fe;};'use strict';var _=require(_0x94b5('0x0'));var util=require('util');var logger=require(_0x94b5('0x1'))(_0x94b5('0x2'));var moment=require(_0x94b5('0x3'));var BPromise=require('bluebird');var rp=require(_0x94b5('0x4'));var fs=require('fs');var path=require(_0x94b5('0x5'));var rimraf=require(_0x94b5('0x6'));var config=require('../../config/environment');var attributes=require(_0x94b5('0x7'));module[_0x94b5('0x8')]=function(_0x377917,_0x2dbeb1){return _0x377917[_0x94b5('0x9')](_0x94b5('0xa'),attributes,{'tableName':_0x94b5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a0f=['exports','define','UserChatQueue','user_has_chat_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3d44a3,_0x165fe4){var _0x1f6306=function(_0x2e8292){while(--_0x2e8292){_0x3d44a3['push'](_0x3d44a3['shift']());}};_0x1f6306(++_0x165fe4);}(_0x7a0f,0x148));var _0xf7a0=function(_0x3e410b,_0x10608a){_0x3e410b=_0x3e410b-0x0;var _0x25969c=_0x7a0f[_0x3e410b];return _0x25969c;};'use strict';var _=require('lodash');var util=require(_0xf7a0('0x0'));var logger=require(_0xf7a0('0x1'))(_0xf7a0('0x2'));var moment=require(_0xf7a0('0x3'));var BPromise=require(_0xf7a0('0x4'));var rp=require(_0xf7a0('0x5'));var fs=require('fs');var path=require(_0xf7a0('0x6'));var rimraf=require('rimraf');var config=require(_0xf7a0('0x7'));var attributes=require('./userChatQueue.attributes');module[_0xf7a0('0x8')]=function(_0x2afec0,_0x35e484){return _0x2afec0[_0xf7a0('0x9')](_0xf7a0('0xa'),attributes,{'tableName':_0xf7a0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 72e2367..2213fa2 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 _0x26c9=['../../config/utils','rpc','jayson/promise','client','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2ff918,_0xbb08d6){var _0x5028a3=function(_0x2efd0f){while(--_0x2efd0f){_0x2ff918['push'](_0x2ff918['shift']());}};_0x5028a3(++_0xbb08d6);}(_0x26c9,0x18a));var _0x926c=function(_0x39469e,_0x1d2d34){_0x39469e=_0x39469e-0x0;var _0x4d5e30=_0x26c9[_0x39469e];return _0x4d5e30;};'use strict';var _=require(_0x926c('0x0'));var util=require('util');var moment=require(_0x926c('0x1'));var BPromise=require(_0x926c('0x2'));var rs=require(_0x926c('0x3'));var fs=require('fs');var Redis=require(_0x926c('0x4'));var db=require(_0x926c('0x5'))['db'];var utils=require(_0x926c('0x6'));var logger=require('../../config/logger')(_0x926c('0x7'));var config=require('../../config/environment');var jayson=require(_0x926c('0x8'));var client=jayson[_0x926c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45cfe1,_0x24360e,_0x3c2790){return new BPromise(function(_0x30f79e,_0x58d935){return client['request'](_0x45cfe1,_0x3c2790)['then'](function(_0x1e7da0){logger[_0x926c('0xa')](_0x926c('0xb'),_0x24360e,_0x926c('0xc'));logger['debug'](_0x926c('0xd'),_0x24360e,_0x926c('0xc'),JSON[_0x926c('0xe')](_0x1e7da0));if(_0x1e7da0[_0x926c('0xf')]){if(_0x1e7da0[_0x926c('0xf')][_0x926c('0x10')]===0x1f4){logger[_0x926c('0xf')](_0x926c('0xb'),_0x24360e,_0x1e7da0[_0x926c('0xf')][_0x926c('0x11')]);return _0x58d935(_0x1e7da0[_0x926c('0xf')][_0x926c('0x11')]);}logger[_0x926c('0xf')](_0x926c('0xb'),_0x24360e,_0x1e7da0[_0x926c('0xf')][_0x926c('0x11')]);return _0x30f79e(_0x1e7da0['error'][_0x926c('0x11')]);}else{logger[_0x926c('0xa')](_0x926c('0xb'),_0x24360e,_0x926c('0xc'));_0x30f79e(_0x1e7da0[_0x926c('0x12')]['message']);}})[_0x926c('0x13')](function(_0x39d906){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x24360e,_0x39d906);_0x58d935(_0x39d906);});});} \ No newline at end of file +var _0xdb64=['client','http','then','info','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','UserChatQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xdb64,0x1ae));var _0x4db6=function(_0x16eadc,_0x3fc953){_0x16eadc=_0x16eadc-0x0;var _0x5b05c8=_0xdb64[_0x16eadc];return _0x5b05c8;};'use strict';var _=require(_0x4db6('0x0'));var util=require(_0x4db6('0x1'));var moment=require(_0x4db6('0x2'));var BPromise=require(_0x4db6('0x3'));var rs=require(_0x4db6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4db6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4db6('0x6'))(_0x4db6('0x7'));var config=require(_0x4db6('0x8'));var jayson=require(_0x4db6('0x9'));var client=jayson[_0x4db6('0xa')][_0x4db6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3dd64b,_0x5eb1c8,_0x5526a1){return new BPromise(function(_0x3a4bb0,_0x261a8b){return client['request'](_0x3dd64b,_0x5526a1)[_0x4db6('0xc')](function(_0x335123){logger[_0x4db6('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x5eb1c8,_0x4db6('0xe'));logger['debug'](_0x4db6('0xf'),_0x5eb1c8,_0x4db6('0xe'),JSON['stringify'](_0x335123));if(_0x335123[_0x4db6('0x10')]){if(_0x335123[_0x4db6('0x10')][_0x4db6('0x11')]===0x1f4){logger['error'](_0x4db6('0x12'),_0x5eb1c8,_0x335123[_0x4db6('0x10')]['message']);return _0x261a8b(_0x335123[_0x4db6('0x10')][_0x4db6('0x13')]);}logger[_0x4db6('0x10')](_0x4db6('0x12'),_0x5eb1c8,_0x335123[_0x4db6('0x10')][_0x4db6('0x13')]);return _0x3a4bb0(_0x335123[_0x4db6('0x10')][_0x4db6('0x13')]);}else{logger[_0x4db6('0xd')](_0x4db6('0x12'),_0x5eb1c8,_0x4db6('0xe'));_0x3a4bb0(_0x335123[_0x4db6('0x14')][_0x4db6('0x13')]);}})[_0x4db6('0x15')](function(_0x1d3537){logger[_0x4db6('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x5eb1c8,_0x1d3537);_0x261a8b(_0x1d3537);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 5bd9d5d..e43b431 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x45735b,_0x15bf2f){var _0x1c7553=function(_0x2e9713){while(--_0x2e9713){_0x45735b['push'](_0x45735b['shift']());}};_0x1c7553(++_0x15bf2f);}(_0x9c44,0x178));var _0x49c4=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x9c44[_0x68c979];return _0x4f0001;};'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(_0x185615,_0x1f5c81){var _0x1d5660=function(_0x160a7b){while(--_0x160a7b){_0x185615['push'](_0x185615['shift']());}};_0x1d5660(++_0x1f5c81);}(_0xe706,0xa3));var _0x6e70=function(_0x442a76,_0x2ad2ff){_0x442a76=_0x442a76-0x0;var _0x474fab=_0xe706[_0x442a76];return _0x474fab;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index b31f070..b410a3b 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 _0xa76e=['STRING','exports','INTEGER'];(function(_0x51dcc6,_0x159e0a){var _0x1aefbb=function(_0x448fa8){while(--_0x448fa8){_0x51dcc6['push'](_0x51dcc6['shift']());}};_0x1aefbb(++_0x159e0a);}(_0xa76e,0x160));var _0xea76=function(_0x3cfb0d,_0x4df584){_0x3cfb0d=_0x3cfb0d-0x0;var _0x3486b4=_0xa76e[_0x3cfb0d];return _0x3486b4;};'use strict';var Sequelize=require('sequelize');module[_0xea76('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xea76('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xea76('0x2')]}}; \ No newline at end of file +var _0x1ff8=['sequelize','exports','INTEGER','STRING'];(function(_0x22b013,_0x464855){var _0x1427dc=function(_0x51a603){while(--_0x51a603){_0x22b013['push'](_0x22b013['shift']());}};_0x1427dc(++_0x464855);}(_0x1ff8,0x188));var _0x81ff=function(_0x3b048d,_0x450938){_0x3b048d=_0x3b048d-0x0;var _0x31b2d4=_0x1ff8[_0x3b048d];return _0x31b2d4;};'use strict';var Sequelize=require(_0x81ff('0x0'));module[_0x81ff('0x1')]={'penalty':{'type':Sequelize[_0x81ff('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x81ff('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x81ff('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index d83d681..1fd0dea 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 _0x0636=['exports','define','UserFaxQueue','user_has_fax_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','./userFaxQueue.attributes'];(function(_0x146bf7,_0x5be872){var _0x3055da=function(_0xdddf1e){while(--_0xdddf1e){_0x146bf7['push'](_0x146bf7['shift']());}};_0x3055da(++_0x5be872);}(_0x0636,0x164));var _0x6063=function(_0x21662c,_0x29ead7){_0x21662c=_0x21662c-0x0;var _0x1e0d10=_0x0636[_0x21662c];return _0x1e0d10;};'use strict';var _=require(_0x6063('0x0'));var util=require('util');var logger=require(_0x6063('0x1'))(_0x6063('0x2'));var moment=require(_0x6063('0x3'));var BPromise=require(_0x6063('0x4'));var rp=require(_0x6063('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6063('0x6'));module[_0x6063('0x7')]=function(_0x374514,_0x206311){return _0x374514[_0x6063('0x8')](_0x6063('0x9'),attributes,{'tableName':_0x6063('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d7f=['api','moment','bluebird','path','rimraf','../../config/environment','exports','define','user_has_fax_queues','lodash','util','../../config/logger'];(function(_0x5bec33,_0xd19563){var _0x302828=function(_0xed43b5){while(--_0xed43b5){_0x5bec33['push'](_0x5bec33['shift']());}};_0x302828(++_0xd19563);}(_0x7d7f,0x81));var _0xf7d7=function(_0x1595bf,_0x172a78){_0x1595bf=_0x1595bf-0x0;var _0x25b9f5=_0x7d7f[_0x1595bf];return _0x25b9f5;};'use strict';var _=require(_0xf7d7('0x0'));var util=require(_0xf7d7('0x1'));var logger=require(_0xf7d7('0x2'))(_0xf7d7('0x3'));var moment=require(_0xf7d7('0x4'));var BPromise=require(_0xf7d7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf7d7('0x6'));var rimraf=require(_0xf7d7('0x7'));var config=require(_0xf7d7('0x8'));var attributes=require('./userFaxQueue.attributes');module[_0xf7d7('0x9')]=function(_0x5bb711,_0x426cd8){return _0x5bb711[_0xf7d7('0xa')]('UserFaxQueue',attributes,{'tableName':_0xf7d7('0xb'),'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 cb7cff9..5c587c5 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 _0x1e96=['code','UserFaxQueue,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1c9ce8,_0x365082){var _0x29d220=function(_0x4bb559){while(--_0x4bb559){_0x1c9ce8['push'](_0x1c9ce8['shift']());}};_0x29d220(++_0x365082);}(_0x1e96,0x14e));var _0x61e9=function(_0x367574,_0x45d979){_0x367574=_0x367574-0x0;var _0x2b7a43=_0x1e96[_0x367574];return _0x2b7a43;};'use strict';var _=require(_0x61e9('0x0'));var util=require('util');var moment=require(_0x61e9('0x1'));var BPromise=require(_0x61e9('0x2'));var rs=require(_0x61e9('0x3'));var fs=require('fs');var Redis=require(_0x61e9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x61e9('0x5'))('rpc');var config=require(_0x61e9('0x6'));var jayson=require(_0x61e9('0x7'));var client=jayson[_0x61e9('0x8')][_0x61e9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x339557,_0x19d3c1,_0x3f6f9e){return new BPromise(function(_0x5caf7e,_0x1b22f0){return client[_0x61e9('0xa')](_0x339557,_0x3f6f9e)[_0x61e9('0xb')](function(_0x5d9e9d){logger[_0x61e9('0xc')]('UserFaxQueue,\x20%s,\x20%s',_0x19d3c1,_0x61e9('0xd'));logger[_0x61e9('0xe')](_0x61e9('0xf'),_0x19d3c1,_0x61e9('0xd'),JSON[_0x61e9('0x10')](_0x5d9e9d));if(_0x5d9e9d[_0x61e9('0x11')]){if(_0x5d9e9d[_0x61e9('0x11')][_0x61e9('0x12')]===0x1f4){logger[_0x61e9('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x19d3c1,_0x5d9e9d[_0x61e9('0x11')]['message']);return _0x1b22f0(_0x5d9e9d[_0x61e9('0x11')]['message']);}logger['error'](_0x61e9('0x13'),_0x19d3c1,_0x5d9e9d[_0x61e9('0x11')][_0x61e9('0x14')]);return _0x5caf7e(_0x5d9e9d['error'][_0x61e9('0x14')]);}else{logger['info'](_0x61e9('0x13'),_0x19d3c1,'request\x20sent');_0x5caf7e(_0x5d9e9d[_0x61e9('0x15')]['message']);}})['catch'](function(_0x2cfe34){logger[_0x61e9('0x11')](_0x61e9('0x13'),_0x19d3c1,_0x2cfe34);_0x1b22f0(_0x2cfe34);});});} \ No newline at end of file +var _0x5223=['jayson/promise','client','request','then','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','UserFaxQueue,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x472599,_0x47b343){var _0x29c64a=function(_0x2fb779){while(--_0x2fb779){_0x472599['push'](_0x472599['shift']());}};_0x29c64a(++_0x47b343);}(_0x5223,0x122));var _0x3522=function(_0x244ab6,_0xa83c3b){_0x244ab6=_0x244ab6-0x0;var _0x1d12a1=_0x5223[_0x244ab6];return _0x1d12a1;};'use strict';var _=require(_0x3522('0x0'));var util=require(_0x3522('0x1'));var moment=require('moment');var BPromise=require(_0x3522('0x2'));var rs=require(_0x3522('0x3'));var fs=require('fs');var Redis=require(_0x3522('0x4'));var db=require(_0x3522('0x5'))['db'];var utils=require(_0x3522('0x6'));var logger=require(_0x3522('0x7'))(_0x3522('0x8'));var config=require(_0x3522('0x9'));var jayson=require(_0x3522('0xa'));var client=jayson[_0x3522('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x310897,_0x548e3f,_0x229265){return new BPromise(function(_0x1e36fa,_0x4c1d8a){return client[_0x3522('0xc')](_0x310897,_0x229265)[_0x3522('0xd')](function(_0x1c614f){logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x548e3f,_0x3522('0xe'));logger[_0x3522('0xf')](_0x3522('0x10'),_0x548e3f,_0x3522('0xe'),JSON[_0x3522('0x11')](_0x1c614f));if(_0x1c614f[_0x3522('0x12')]){if(_0x1c614f['error'][_0x3522('0x13')]===0x1f4){logger[_0x3522('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x548e3f,_0x1c614f[_0x3522('0x12')]['message']);return _0x4c1d8a(_0x1c614f[_0x3522('0x12')]['message']);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x548e3f,_0x1c614f[_0x3522('0x12')][_0x3522('0x14')]);return _0x1e36fa(_0x1c614f[_0x3522('0x12')]['message']);}else{logger[_0x3522('0x15')](_0x3522('0x16'),_0x548e3f,_0x3522('0xe'));_0x1e36fa(_0x1c614f[_0x3522('0x17')]['message']);}})[_0x3522('0x18')](function(_0x10fe36){logger[_0x3522('0x12')](_0x3522('0x16'),_0x548e3f,_0x10fe36);_0x4c1d8a(_0x10fe36);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 2ef988e..6d391a6 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(_0x5eb9d7,_0x51a632){var _0x28e037=function(_0x24372a){while(--_0x24372a){_0x5eb9d7['push'](_0x5eb9d7['shift']());}};_0x28e037(++_0x51a632);}(_0xe706,0xa3));var _0x6e70=function(_0x2265da,_0xfbbd2e){_0x2265da=_0x2265da-0x0;var _0x430c2b=_0xe706[_0x2265da];return _0x430c2b;};'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(_0x5b48a4,_0x1f655d){var _0x4a3b76=function(_0x2e2d68){while(--_0x2e2d68){_0x5b48a4['push'](_0x5b48a4['shift']());}};_0x4a3b76(++_0x1f655d);}(_0x70e0,0x17b));var _0x070e=function(_0x2fba63,_0x3fe207){_0x2fba63=_0x2fba63-0x0;var _0x375a9c=_0x70e0[_0x2fba63];return _0x375a9c;};'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 1a7f4d8..c041112 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 _0xcc34=['INTEGER'];(function(_0x30fccd,_0x5581c3){var _0x40dd2c=function(_0x164446){while(--_0x164446){_0x30fccd['push'](_0x30fccd['shift']());}};_0x40dd2c(++_0x5581c3);}(_0xcc34,0x7e));var _0x4cc3=function(_0x928b70,_0x4b8d21){_0x928b70=_0x928b70-0x0;var _0x4fe14c=_0xcc34[_0x928b70];return _0x4fe14c;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x4cc3('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8530=['INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8530,0x1ae));var _0x0853=function(_0x29a778,_0x258e03){_0x29a778=_0x29a778-0x0;var _0x5dcc6d=_0x8530[_0x29a778];return _0x5dcc6d;};'use strict';var Sequelize=require(_0x0853('0x0'));module[_0x0853('0x1')]={'penalty':{'type':Sequelize[_0x0853('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 a3d9817..1354297 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 _0xca71=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','user_has_mail_queues','lodash','util'];(function(_0x2c60d1,_0x5b778f){var _0xdf6e43=function(_0x58ec7c){while(--_0x58ec7c){_0x2c60d1['push'](_0x2c60d1['shift']());}};_0xdf6e43(++_0x5b778f);}(_0xca71,0x132));var _0x1ca7=function(_0x4e25eb,_0x350892){_0x4e25eb=_0x4e25eb-0x0;var _0x4d34ca=_0xca71[_0x4e25eb];return _0x4d34ca;};'use strict';var _=require(_0x1ca7('0x0'));var util=require(_0x1ca7('0x1'));var logger=require(_0x1ca7('0x2'))('api');var moment=require(_0x1ca7('0x3'));var BPromise=require(_0x1ca7('0x4'));var rp=require(_0x1ca7('0x5'));var fs=require('fs');var path=require(_0x1ca7('0x6'));var rimraf=require(_0x1ca7('0x7'));var config=require(_0x1ca7('0x8'));var attributes=require(_0x1ca7('0x9'));module['exports']=function(_0x2a1428,_0x224184){return _0x2a1428['define']('UserMailQueue',attributes,{'tableName':_0x1ca7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xefe4=['lodash','util','../../config/logger','api','moment','path','../../config/environment','exports','define','user_has_mail_queues'];(function(_0x370877,_0x3641c5){var _0x418b69=function(_0x57d817){while(--_0x57d817){_0x370877['push'](_0x370877['shift']());}};_0x418b69(++_0x3641c5);}(_0xefe4,0x1a4));var _0x4efe=function(_0x176c1e,_0x4c97ef){_0x176c1e=_0x176c1e-0x0;var _0x88a9ec=_0xefe4[_0x176c1e];return _0x88a9ec;};'use strict';var _=require(_0x4efe('0x0'));var util=require(_0x4efe('0x1'));var logger=require(_0x4efe('0x2'))(_0x4efe('0x3'));var moment=require(_0x4efe('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4efe('0x5'));var rimraf=require('rimraf');var config=require(_0x4efe('0x6'));var attributes=require('./userMailQueue.attributes');module[_0x4efe('0x7')]=function(_0x246341,_0x17c55c){return _0x246341[_0x4efe('0x8')]('UserMailQueue',attributes,{'tableName':_0x4efe('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index fae3344..bc1ed86 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 _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x24d32a,_0x301ada){var _0x18202c=function(_0x29d245){while(--_0x29d245){_0x24d32a['push'](_0x24d32a['shift']());}};_0x18202c(++_0x301ada);}(_0x8ef6,0xf2));var _0x68ef=function(_0x553d7d,_0x221d4e){_0x553d7d=_0x553d7d-0x0;var _0xd9dd19=_0x8ef6[_0x553d7d];return _0xd9dd19;};'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')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file +var _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x2ca9f0,_0x5849d1){var _0x31b4b3=function(_0x419cdc){while(--_0x419cdc){_0x2ca9f0['push'](_0x2ca9f0['shift']());}};_0x31b4b3(++_0x5849d1);}(_0xe14b,0x93));var _0xbe14=function(_0x383d0c,_0x521d28){_0x383d0c=_0x383d0c-0x0;var _0x42a1af=_0xe14b[_0x383d0c];return _0x42a1af;};'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);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index f477f4f..34cd0ae 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 _0x7135=['../../components/interaction/service','../../config/environment','post','multer','util','path','express','fs-extra'];(function(_0x50eb44,_0x18a994){var _0x18d31e=function(_0x474994){while(--_0x474994){_0x50eb44['push'](_0x50eb44['shift']());}};_0x18d31e(++_0x18a994);}(_0x7135,0x1e3));var _0x5713=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7135[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x5713('0x0'));var util=require(_0x5713('0x1'));var path=require(_0x5713('0x2'));var timeout=require('connect-timeout');var express=require(_0x5713('0x3'));var router=express['Router']();var fs_extra=require(_0x5713('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5713('0x5'));var config=require(_0x5713('0x6'));var controller=require('./userNotification.controller');router[_0x5713('0x7')]('/',auth['isAuthenticated'](),controller['sendUserNotification']);module['exports']=router; \ No newline at end of file +var _0x9d49=['post','isAuthenticated','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller'];(function(_0x263248,_0x1de47e){var _0x2f6124=function(_0x68f4d6){while(--_0x68f4d6){_0x263248['push'](_0x263248['shift']());}};_0x2f6124(++_0x1de47e);}(_0x9d49,0x78));var _0x99d4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9d49[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x99d4('0x0'));var util=require(_0x99d4('0x1'));var path=require(_0x99d4('0x2'));var timeout=require('connect-timeout');var express=require(_0x99d4('0x3'));var router=express[_0x99d4('0x4')]();var fs_extra=require(_0x99d4('0x5'));var auth=require(_0x99d4('0x6'));var interaction=require(_0x99d4('0x7'));var config=require(_0x99d4('0x8'));var controller=require(_0x99d4('0x9'));router[_0x99d4('0xa')]('/',auth[_0x99d4('0xb')](),controller['sendUserNotification']);module[_0x99d4('0xc')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index f02bf63..96366bc 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 _0x0924=['exports','TEXT','STRING','BOOLEAN'];(function(_0x20ea23,_0x4b060a){var _0x51995d=function(_0x3d2173){while(--_0x3d2173){_0x20ea23['push'](_0x20ea23['shift']());}};_0x51995d(++_0x4b060a);}(_0x0924,0x1b0));var _0x4092=function(_0x21ef85,_0x2d9f4f){_0x21ef85=_0x21ef85-0x0;var _0x5b9a7d=_0x0924[_0x21ef85];return _0x5b9a7d;};'use strict';var Sequelize=require('sequelize');module[_0x4092('0x0')]={'body':{'type':Sequelize[_0x4092('0x1')]},'senderName':{'type':Sequelize[_0x4092('0x2')]},'recipientsId':{'type':Sequelize[_0x4092('0x1')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x4092('0x3')]}}; \ No newline at end of file +var _0x36f2=['TEXT','STRING','BOOLEAN'];(function(_0x25c148,_0x1ed102){var _0x14f809=function(_0x18e4c9){while(--_0x18e4c9){_0x25c148['push'](_0x25c148['shift']());}};_0x14f809(++_0x1ed102);}(_0x36f2,0xc6));var _0x236f=function(_0x59060d,_0xa9520){_0x59060d=_0x59060d-0x0;var _0x46ad1f=_0x36f2[_0x59060d];return _0x46ad1f;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x236f('0x0')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x236f('0x1')]},'beep':{'type':Sequelize[_0x236f('0x2')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 855b0c6..c5774a5 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 _0x1b14=['model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','sortBy','UserNotification','forEach','recipient','emit','text','Template','findOne','html','render','User','union','queue','Queue','ids','flatten','catch','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','moment','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userNotification.socket','register','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','send','sendUserNotification','body','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','hasOwnProperty','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','error','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','voicequeue','whatsappqueue','team','user','some','includes'];(function(_0x378b4,_0x5ca7fa){var _0x11d07b=function(_0x35d420){while(--_0x35d420){_0x378b4['push'](_0x378b4['shift']());}};_0x11d07b(++_0x5ca7fa);}(_0x1b14,0x194));var _0x41b1=function(_0x3a1d0c,_0x35212e){_0x3a1d0c=_0x3a1d0c-0x0;var _0x18b83f=_0x1b14[_0x3a1d0c];return _0x18b83f;};'use strict';var emlformat=require(_0x41b1('0x0'));var rimraf=require(_0x41b1('0x1'));var zipdir=require(_0x41b1('0x2'));var jsonpatch=require(_0x41b1('0x3'));var rp=require('request-promise');var moment=require(_0x41b1('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x41b1('0x5'));var csv=require('to-csv');var ejs=require(_0x41b1('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x41b1('0x7'));var crypto=require(_0x41b1('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x41b1('0x9'));var toCsv=require(_0x41b1('0xa'));var querystring=require(_0x41b1('0xb'));var Papa=require(_0x41b1('0xc'));var Redis=require(_0x41b1('0xd'));var authService=require(_0x41b1('0xe'));var qs=require(_0x41b1('0xf'));var as=require(_0x41b1('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x41b1('0x11'))(_0x41b1('0x12'));var utils=require('../../config/utils');var config=require(_0x41b1('0x13'));var licenseUtil=require(_0x41b1('0x14'));var db=require(_0x41b1('0x15'))['db'];config[_0x41b1('0x16')]=_['defaults'](config['redis'],{'host':_0x41b1('0x17'),'port':0x18eb});var socket=require(_0x41b1('0x18'))(new Redis(config[_0x41b1('0x16')]));require(_0x41b1('0x19'))[_0x41b1('0x1a')](socket);function respondWithStatusCode(_0x4b5429,_0x48c854){_0x48c854=_0x48c854||0xcc;return function(_0x15e3b2){if(_0x15e3b2){return _0x4b5429['sendStatus'](_0x48c854);}return _0x4b5429['status'](_0x48c854)[_0x41b1('0x1b')]();};}function respondWithResult(_0x3ed6c0,_0x25befa){_0x25befa=_0x25befa||0xc8;return function(_0x3b64cf){if(_0x3b64cf){return _0x3ed6c0[_0x41b1('0x1c')](_0x25befa)[_0x41b1('0x1d')](_0x3b64cf);}};}function respondWithFilteredResult(_0x2a51ed,_0x313151){return function(_0x318f91){if(_0x318f91){var _0x10d661=typeof _0x313151[_0x41b1('0x1e')]===_0x41b1('0x1f')&&typeof _0x313151[_0x41b1('0x20')]===_0x41b1('0x1f');var _0x2fd121=_0x318f91[_0x41b1('0x21')];var _0x574c5c=_0x10d661?0x0:_0x313151[_0x41b1('0x1e')];var _0x108fd3=_0x10d661?_0x318f91[_0x41b1('0x21')]:_0x313151[_0x41b1('0x1e')]+_0x313151[_0x41b1('0x20')];var _0x16f492;if(_0x108fd3>=_0x2fd121){_0x108fd3=_0x2fd121;_0x16f492=0xc8;}else{_0x16f492=0xce;}_0x2a51ed[_0x41b1('0x1c')](_0x16f492);return _0x2a51ed[_0x41b1('0x22')](_0x41b1('0x23'),_0x574c5c+'-'+_0x108fd3+'/'+_0x2fd121)[_0x41b1('0x1d')](_0x318f91);}return null;};}function patchUpdates(_0x5b1c0a){return function(_0x466d64){try{jsonpatch['apply'](_0x466d64,_0x5b1c0a,!![]);}catch(_0x27a2b9){return BPromise[_0x41b1('0x24')](_0x27a2b9);}return _0x466d64[_0x41b1('0x25')]();};}function saveUpdates(_0x3dc398,_0x6cdf40){return function(_0x42feab){if(_0x42feab){return _0x42feab[_0x41b1('0x26')](_0x3dc398)[_0x41b1('0x27')](function(_0x2107fb){return _0x2107fb;});}return null;};}function removeEntity(_0x5a0fce,_0x186b84){return function(_0x2757bf){if(_0x2757bf){return _0x2757bf[_0x41b1('0x28')]()[_0x41b1('0x27')](function(){_0x5a0fce[_0x41b1('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b515e,_0x45e538){return function(_0x123f6f){if(!_0x123f6f){_0x1b515e[_0x41b1('0x29')](0x194);}return _0x123f6f;};}function handleError(_0x1f0ef1,_0x1b3925){_0x1b3925=_0x1b3925||0x1f4;return function(_0x254f62){logger['error'](_0x254f62[_0x41b1('0x2a')]);if(_0x254f62[_0x41b1('0x2b')]){delete _0x254f62[_0x41b1('0x2b')];}_0x1f0ef1[_0x41b1('0x1c')](_0x1b3925)[_0x41b1('0x2c')](_0x254f62);};}exports[_0x41b1('0x2d')]=function(_0x3b80e4,_0x147ac7,_0x5971a8){if(!_0x3b80e4['body']['hasOwnProperty']('text')&&!_0x3b80e4[_0x41b1('0x2e')]['hasOwnProperty'](_0x41b1('0x2f'))){throw new db['Sequelize'][(_0x41b1('0x30'))](_0x41b1('0x31'));}else{if(_0x3b80e4[_0x41b1('0x2e')][_0x41b1('0x32')]('TemplateId')&&!_0x3b80e4['body'][_0x41b1('0x32')](_0x41b1('0x33'))){throw new db[(_0x41b1('0x34'))][(_0x41b1('0x30'))](_0x41b1('0x35'));}if(!_0x3b80e4[_0x41b1('0x2e')][_0x41b1('0x32')](_0x41b1('0x36'))){throw new db[(_0x41b1('0x34'))][(_0x41b1('0x30'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x3c257f=JSON['parse'](_0x3b80e4[_0x41b1('0x2e')][_0x41b1('0x36')]);}catch(_0x14d727){logger[_0x41b1('0x37')](_0x14d727);throw new db['Sequelize'][(_0x41b1('0x30'))](_0x41b1('0x38'));}var _0x41cbf2=['chatqueue',_0x41b1('0x39'),_0x41b1('0x3a'),_0x41b1('0x3b'),'smsqueue',_0x41b1('0x3c'),_0x41b1('0x3d'),_0x41b1('0x3e'),_0x41b1('0x3f')];if(_[_0x41b1('0x40')](_0x3c257f,function(_0x20a725){return!_[_0x41b1('0x41')](_0x41cbf2,_0x20a725[_0x41b1('0x42')][_0x41b1('0x43')]());})){throw new db[(_0x41b1('0x34'))][(_0x41b1('0x30'))](_0x41b1('0x44'));}}}var _0x1b2f23={};_0x1b2f23['senderName']=_0x3b80e4[_0x41b1('0x2e')][_0x41b1('0x32')](_0x41b1('0x45'))?_0x3b80e4[_0x41b1('0x2e')][_0x41b1('0x45')]:_0x3b80e4[_0x41b1('0x3f')][_0x41b1('0x46')];_0x1b2f23[_0x41b1('0x47')]=_[_0x41b1('0x48')](_0x3b80e4[_0x41b1('0x2e')][_0x41b1('0x47')])?null:_0x3b80e4[_0x41b1('0x2e')]['recipientsDescription'];_0x1b2f23[_0x41b1('0x49')]=_0x3b80e4['body'][_0x41b1('0x49')]||![];_0x1b2f23[_0x41b1('0x4a')]=_0x3b80e4[_0x41b1('0x3f')]['id'];return getContent(_0x3b80e4[_0x41b1('0x2e')])['then'](function(_0x27247e){_0x1b2f23[_0x41b1('0x2e')]=_0x27247e;return getRecipients(_0x3c257f);})['then'](function(_0x3dd924){_0x1b2f23['recipientsId']=_[_0x41b1('0x4b')](_0x3dd924)['join'](',');return db['sequelize']['transaction'](function(_0x12c2b0){return db[_0x41b1('0x4c')]['create'](_0x1b2f23,{'raw':!![],'transaction':_0x12c2b0})[_0x41b1('0x27')](function(_0x1fd696){var _0x441989={'sender':_0x1b2f23[_0x41b1('0x45')],'description':_0x1b2f23[_0x41b1('0x47')],'content':_0x1b2f23[_0x41b1('0x2e')],'beep':_0x1b2f23[_0x41b1('0x49')]};_0x3dd924[_0x41b1('0x4d')](function(_0x196956){_0x441989[_0x41b1('0x4e')]=_0x196956;socket[_0x41b1('0x4f')]('userNotification:send',_0x441989);});return _0x1fd696;});});})[_0x41b1('0x27')](respondWithResult(_0x147ac7,0xc9))['catch'](handleError(_0x147ac7,null));};function getContent(_0x2b92cf){return new BPromise(function(_0x378d9c,_0x4a81fb){if(_0x2b92cf[_0x41b1('0x50')]){_0x378d9c(_0x2b92cf[_0x41b1('0x50')]);return;}return db[_0x41b1('0x51')][_0x41b1('0x52')]({'attributes':[_0x41b1('0x53')],'where':{'id':_0x2b92cf[_0x41b1('0x2f')]},'raw':!![]})[_0x41b1('0x27')](function(_0x4f0afc){if(!_0x4f0afc)throw new db[(_0x41b1('0x34'))][(_0x41b1('0x30'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x5b1218=Mustache[_0x41b1('0x54')](_0x4f0afc['html'],_0x2b92cf[_0x41b1('0x33')]);_0x378d9c(_0x5b1218);})['catch'](function(_0x428240){_0x4a81fb(_0x428240);});});}function getRecipients(_0x1464f8){return new BPromise(function(_0x41aa52,_0x12b400){var _0x77241e=[];var _0x3f25d9=[];_0x1464f8[_0x41b1('0x4d')](function(_0x50ff04){var _0x2927f5=_['startCase'](_0x50ff04[_0x41b1('0x42')]['toLowerCase']());if(_0x2927f5===_0x41b1('0x55')){_0x77241e=_[_0x41b1('0x56')](_0x77241e,_0x50ff04['ids']);}else{if(_['includes'](_0x2927f5,_0x41b1('0x57')))_0x2927f5=_0x2927f5['replace'](_0x41b1('0x57'),_0x41b1('0x58'));_0x50ff04[_0x41b1('0x59')]['forEach'](function(_0x45b626){_0x3f25d9['push'](getAgents(_0x2927f5,_0x45b626));});}});return BPromise['all'](_0x3f25d9)['then'](function(_0x1ddf89){_0x77241e=_['union'](_0x77241e,_[_0x41b1('0x5a')](_0x1ddf89));_0x41aa52(_0x77241e);})[_0x41b1('0x5b')](function(_0x2fc6ad){_0x12b400(_0x2fc6ad);});});}function getAgents(_0x3981f0,_0x3a40af){return new BPromise(function(_0x26c985,_0x3e2070){return db[_0x3981f0][_0x41b1('0x52')]({'where':{'id':_0x3a40af}})[_0x41b1('0x27')](function(_0x4b361e){return _0x4b361e[_0x41b1('0x5c')]({'attributes':['id'],'raw':!![]})[_0x41b1('0x27')](function(_0x33608e){var _0x4f3576=_[_0x41b1('0x5d')](_0x33608e,'id');_0x26c985(_0x4f3576);});})[_0x41b1('0x5b')](function(_0x358c6b){_0x3e2070(_0x358c6b);});});} \ No newline at end of file +var _0x9c56=['papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','transaction','UserNotification','create','forEach','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','startCase','User','union','ids','queue','replace','Queue','push','flatten','getAgents','map','eml-format','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring'];(function(_0x46ddb1,_0x3de9f1){var _0x4b5e22=function(_0x52a1c7){while(--_0x52a1c7){_0x46ddb1['push'](_0x46ddb1['shift']());}};_0x4b5e22(++_0x3de9f1);}(_0x9c56,0x120));var _0x69c5=function(_0x2d9419,_0x229c93){_0x2d9419=_0x2d9419-0x0;var _0x2ae33a=_0x9c56[_0x2d9419];return _0x2ae33a;};'use strict';var emlformat=require(_0x69c5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x69c5('0x1'));var BPromise=require(_0x69c5('0x2'));var Mustache=require('mustache');var util=require(_0x69c5('0x3'));var path=require('path');var sox=require(_0x69c5('0x4'));var csv=require(_0x69c5('0x5'));var ejs=require(_0x69c5('0x6'));var fs=require('fs');var fs_extra=require(_0x69c5('0x7'));var _=require('lodash');var squel=require(_0x69c5('0x8'));var crypto=require(_0x69c5('0x9'));var jsforce=require(_0x69c5('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x69c5('0x5'));var querystring=require(_0x69c5('0xb'));var Papa=require(_0x69c5('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x69c5('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x69c5('0xe'));var logger=require(_0x69c5('0xf'))(_0x69c5('0x10'));var utils=require(_0x69c5('0x11'));var config=require(_0x69c5('0x12'));var licenseUtil=require(_0x69c5('0x13'));var db=require('../../mysqldb')['db'];config[_0x69c5('0x14')]=_[_0x69c5('0x15')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x69c5('0x16'))(new Redis(config[_0x69c5('0x14')]));require(_0x69c5('0x17'))[_0x69c5('0x18')](socket);function respondWithStatusCode(_0x1dd99,_0x2544ac){_0x2544ac=_0x2544ac||0xcc;return function(_0x52d16c){if(_0x52d16c){return _0x1dd99[_0x69c5('0x19')](_0x2544ac);}return _0x1dd99[_0x69c5('0x1a')](_0x2544ac)[_0x69c5('0x1b')]();};}function respondWithResult(_0xb20519,_0x265c00){_0x265c00=_0x265c00||0xc8;return function(_0x5aedb6){if(_0x5aedb6){return _0xb20519[_0x69c5('0x1a')](_0x265c00)['json'](_0x5aedb6);}};}function respondWithFilteredResult(_0x550103,_0x4e953f){return function(_0x23c1f6){if(_0x23c1f6){var _0xa4e7cc=typeof _0x4e953f[_0x69c5('0x1c')]===_0x69c5('0x1d')&&typeof _0x4e953f[_0x69c5('0x1e')]===_0x69c5('0x1d');var _0x9f42cb=_0x23c1f6[_0x69c5('0x1f')];var _0x2d7f15=_0xa4e7cc?0x0:_0x4e953f[_0x69c5('0x1c')];var _0x3d455b=_0xa4e7cc?_0x23c1f6[_0x69c5('0x1f')]:_0x4e953f[_0x69c5('0x1c')]+_0x4e953f['limit'];var _0x59661f;if(_0x3d455b>=_0x9f42cb){_0x3d455b=_0x9f42cb;_0x59661f=0xc8;}else{_0x59661f=0xce;}_0x550103[_0x69c5('0x1a')](_0x59661f);return _0x550103[_0x69c5('0x20')](_0x69c5('0x21'),_0x2d7f15+'-'+_0x3d455b+'/'+_0x9f42cb)[_0x69c5('0x22')](_0x23c1f6);}return null;};}function patchUpdates(_0x46ecb6){return function(_0x40bf28){try{jsonpatch[_0x69c5('0x23')](_0x40bf28,_0x46ecb6,!![]);}catch(_0x5bc09d){return BPromise[_0x69c5('0x24')](_0x5bc09d);}return _0x40bf28[_0x69c5('0x25')]();};}function saveUpdates(_0x5ded5c,_0x339bc9){return function(_0x55979c){if(_0x55979c){return _0x55979c[_0x69c5('0x26')](_0x5ded5c)[_0x69c5('0x27')](function(_0x38805a){return _0x38805a;});}return null;};}function removeEntity(_0x5bd60d,_0x14497e){return function(_0x36494e){if(_0x36494e){return _0x36494e[_0x69c5('0x28')]()[_0x69c5('0x27')](function(){_0x5bd60d[_0x69c5('0x1a')](0xcc)[_0x69c5('0x1b')]();});}};}function handleEntityNotFound(_0xc2b1a0,_0x2bd5f9){return function(_0x236257){if(!_0x236257){_0xc2b1a0['sendStatus'](0x194);}return _0x236257;};}function handleError(_0x4cef30,_0x41c2f2){_0x41c2f2=_0x41c2f2||0x1f4;return function(_0x34e0aa){logger[_0x69c5('0x29')](_0x34e0aa['stack']);if(_0x34e0aa[_0x69c5('0x2a')]){delete _0x34e0aa[_0x69c5('0x2a')];}_0x4cef30[_0x69c5('0x1a')](_0x41c2f2)[_0x69c5('0x2b')](_0x34e0aa);};}exports[_0x69c5('0x2c')]=function(_0x369748,_0x530ab8,_0x3fb380){if(!_0x369748[_0x69c5('0x2d')][_0x69c5('0x2e')](_0x69c5('0x2f'))&&!_0x369748[_0x69c5('0x2d')]['hasOwnProperty'](_0x69c5('0x30'))){throw new db[(_0x69c5('0x31'))]['ValidationError'](_0x69c5('0x32'));}else{if(_0x369748[_0x69c5('0x2d')][_0x69c5('0x2e')](_0x69c5('0x30'))&&!_0x369748[_0x69c5('0x2d')][_0x69c5('0x2e')](_0x69c5('0x33'))){throw new db['Sequelize'][(_0x69c5('0x34'))](_0x69c5('0x35'));}if(!_0x369748[_0x69c5('0x2d')]['hasOwnProperty'](_0x69c5('0x36'))){throw new db[(_0x69c5('0x31'))][(_0x69c5('0x34'))](_0x69c5('0x37'));}else{try{var _0x4b731c=JSON[_0x69c5('0x38')](_0x369748[_0x69c5('0x2d')][_0x69c5('0x36')]);}catch(_0x2cad76){logger[_0x69c5('0x29')](_0x2cad76);throw new db[(_0x69c5('0x31'))][(_0x69c5('0x34'))](_0x69c5('0x39'));}var _0x168180=[_0x69c5('0x3a'),_0x69c5('0x3b'),'mailqueue',_0x69c5('0x3c'),_0x69c5('0x3d'),_0x69c5('0x3e'),_0x69c5('0x3f'),'team',_0x69c5('0x40')];if(_[_0x69c5('0x41')](_0x4b731c,function(_0xcb23){return!_[_0x69c5('0x42')](_0x168180,_0xcb23[_0x69c5('0x43')][_0x69c5('0x44')]());})){throw new db[(_0x69c5('0x31'))][(_0x69c5('0x34'))](_0x69c5('0x45'));}}}var _0xe31f71={};_0xe31f71[_0x69c5('0x46')]=_0x369748[_0x69c5('0x2d')][_0x69c5('0x2e')](_0x69c5('0x46'))?_0x369748[_0x69c5('0x2d')][_0x69c5('0x46')]:_0x369748[_0x69c5('0x40')][_0x69c5('0x47')];_0xe31f71[_0x69c5('0x48')]=_[_0x69c5('0x49')](_0x369748[_0x69c5('0x2d')][_0x69c5('0x48')])?null:_0x369748[_0x69c5('0x2d')][_0x69c5('0x48')];_0xe31f71[_0x69c5('0x4a')]=_0x369748[_0x69c5('0x2d')][_0x69c5('0x4a')]||![];_0xe31f71[_0x69c5('0x4b')]=_0x369748[_0x69c5('0x40')]['id'];return getContent(_0x369748[_0x69c5('0x2d')])[_0x69c5('0x27')](function(_0x12fb3f){_0xe31f71[_0x69c5('0x2d')]=_0x12fb3f;return getRecipients(_0x4b731c);})[_0x69c5('0x27')](function(_0x6ff943){_0xe31f71[_0x69c5('0x4c')]=_[_0x69c5('0x4d')](_0x6ff943)['join'](',');return db['sequelize'][_0x69c5('0x4e')](function(_0xac65c8){return db[_0x69c5('0x4f')][_0x69c5('0x50')](_0xe31f71,{'raw':!![],'transaction':_0xac65c8})[_0x69c5('0x27')](function(_0x2b42c4){var _0x27e88b={'sender':_0xe31f71[_0x69c5('0x46')],'description':_0xe31f71[_0x69c5('0x48')],'content':_0xe31f71['body'],'beep':_0xe31f71['beep']};_0x6ff943[_0x69c5('0x51')](function(_0x5cd694){_0x27e88b['recipient']=_0x5cd694;socket[_0x69c5('0x52')](_0x69c5('0x53'),_0x27e88b);});return _0x2b42c4;});});})[_0x69c5('0x27')](respondWithResult(_0x530ab8,0xc9))[_0x69c5('0x54')](handleError(_0x530ab8,null));};function getContent(_0x4c85bc){return new BPromise(function(_0x3a5f63,_0x2ed1d2){if(_0x4c85bc['text']){_0x3a5f63(_0x4c85bc[_0x69c5('0x2f')]);return;}return db[_0x69c5('0x55')][_0x69c5('0x56')]({'attributes':[_0x69c5('0x57')],'where':{'id':_0x4c85bc['TemplateId']},'raw':!![]})[_0x69c5('0x27')](function(_0xaa9945){if(!_0xaa9945)throw new db[(_0x69c5('0x31'))][(_0x69c5('0x34'))](_0x69c5('0x58'));var _0x2a9b81=Mustache['render'](_0xaa9945[_0x69c5('0x57')],_0x4c85bc[_0x69c5('0x33')]);_0x3a5f63(_0x2a9b81);})['catch'](function(_0x8b34c){_0x2ed1d2(_0x8b34c);});});}function getRecipients(_0x2d4be5){return new BPromise(function(_0x570954,_0x549794){var _0x2e706c=[];var _0xde5fda=[];_0x2d4be5[_0x69c5('0x51')](function(_0x3e2204){var _0x1dc393=_[_0x69c5('0x59')](_0x3e2204[_0x69c5('0x43')]['toLowerCase']());if(_0x1dc393===_0x69c5('0x5a')){_0x2e706c=_[_0x69c5('0x5b')](_0x2e706c,_0x3e2204[_0x69c5('0x5c')]);}else{if(_['includes'](_0x1dc393,_0x69c5('0x5d')))_0x1dc393=_0x1dc393[_0x69c5('0x5e')](_0x69c5('0x5d'),_0x69c5('0x5f'));_0x3e2204[_0x69c5('0x5c')][_0x69c5('0x51')](function(_0x3ed858){_0xde5fda[_0x69c5('0x60')](getAgents(_0x1dc393,_0x3ed858));});}});return BPromise['all'](_0xde5fda)[_0x69c5('0x27')](function(_0x11bfaf){_0x2e706c=_[_0x69c5('0x5b')](_0x2e706c,_[_0x69c5('0x61')](_0x11bfaf));_0x570954(_0x2e706c);})['catch'](function(_0x2de3dd){_0x549794(_0x2de3dd);});});}function getAgents(_0x55d1dd,_0x3577c8){return new BPromise(function(_0x2e1834,_0x5079b4){return db[_0x55d1dd][_0x69c5('0x56')]({'where':{'id':_0x3577c8}})[_0x69c5('0x27')](function(_0x10de1e){return _0x10de1e[_0x69c5('0x62')]({'attributes':['id'],'raw':!![]})[_0x69c5('0x27')](function(_0x114fb4){var _0x7679b5=_[_0x69c5('0x63')](_0x114fb4,'id');_0x2e1834(_0x7679b5);});})[_0x69c5('0x54')](function(_0x37bbdc){_0x5079b4(_0x37bbdc);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 57524da..d52dff5 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 _0x4fc0=['save','remove','emit','hasOwnProperty','hook','exports','UserNotification','setMaxListeners'];(function(_0x2b757b,_0x3537fd){var _0x4974ee=function(_0x3db32b){while(--_0x3db32b){_0x2b757b['push'](_0x2b757b['shift']());}};_0x4974ee(++_0x3537fd);}(_0x4fc0,0x12e));var _0x04fc=function(_0x322dd0,_0x1020dc){_0x322dd0=_0x322dd0-0x0;var _0x21ea0c=_0x4fc0[_0x322dd0];return _0x21ea0c;};'use strict';var EventEmitter=require('events');var UserNotification=require('../../mysqldb')['db'][_0x04fc('0x0')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x04fc('0x1')](0x0);var events={'afterCreate':_0x04fc('0x2'),'afterUpdate':'update','afterDestroy':_0x04fc('0x3')};function emitEvent(_0x181ed1){return function(_0x5dbac5,_0x5f358a,_0x2aa2ee){UserNotificationEvents[_0x04fc('0x4')](_0x181ed1+':'+_0x5dbac5['id'],_0x5dbac5);UserNotificationEvents[_0x04fc('0x4')](_0x181ed1,_0x5dbac5);_0x2aa2ee(null);};}for(var e in events){if(events[_0x04fc('0x5')](e)){var event=events[e];UserNotification[_0x04fc('0x6')](e,emitEvent(event));}}module[_0x04fc('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0xbc94=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x3ad537,_0x1b22a7){var _0x257bb8=function(_0x4fd60a){while(--_0x4fd60a){_0x3ad537['push'](_0x3ad537['shift']());}};_0x257bb8(++_0x1b22a7);}(_0xbc94,0x15f));var _0x4bc9=function(_0x132799,_0x3ffeaf){_0x132799=_0x132799-0x0;var _0x45587a=_0xbc94[_0x132799];return _0x45587a;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x4bc9('0x0'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4bc9('0x1'),'afterUpdate':_0x4bc9('0x2'),'afterDestroy':_0x4bc9('0x3')};function emitEvent(_0x5cddcf){return function(_0x3eb545,_0x1da7ac,_0x3b0808){UserNotificationEvents[_0x4bc9('0x4')](_0x5cddcf+':'+_0x3eb545['id'],_0x3eb545);UserNotificationEvents['emit'](_0x5cddcf,_0x3eb545);_0x3b0808(null);};}for(var e in events){if(events[_0x4bc9('0x5')](e)){var event=events[e];UserNotification[_0x4bc9('0x6')](e,emitEvent(event));}}module[_0x4bc9('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index d9c99be..b0d7668 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 _0x5bc2=['define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x20219f,_0x2fe67c){var _0x440b2a=function(_0x1075a9){while(--_0x1075a9){_0x20219f['push'](_0x20219f['shift']());}};_0x440b2a(++_0x2fe67c);}(_0x5bc2,0x1bf));var _0x25bc=function(_0x4849f6,_0x104836){_0x4849f6=_0x4849f6-0x0;var _0x1a3dcd=_0x5bc2[_0x4849f6];return _0x1a3dcd;};'use strict';var _=require(_0x25bc('0x0'));var util=require(_0x25bc('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x25bc('0x2'));var BPromise=require(_0x25bc('0x3'));var rp=require(_0x25bc('0x4'));var fs=require('fs');var path=require(_0x25bc('0x5'));var rimraf=require(_0x25bc('0x6'));var config=require(_0x25bc('0x7'));var attributes=require('./userNotification.attributes');module['exports']=function(_0x16761b,_0x4a9dcb){return _0x16761b[_0x25bc('0x8')](_0x25bc('0x9'),attributes,{'tableName':_0x25bc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x25bc('0xb'),'collate':_0x25bc('0xc')});}; \ No newline at end of file +var _0xe947=['bluebird','request-promise','path','rimraf','exports','define','UserNotification','userNotifications','utf8mb4_unicode_ci','lodash','util','api','moment'];(function(_0x4d9661,_0x422bb6){var _0x38d476=function(_0x465b7c){while(--_0x465b7c){_0x4d9661['push'](_0x4d9661['shift']());}};_0x38d476(++_0x422bb6);}(_0xe947,0x64));var _0x7e94=function(_0x34a8c8,_0x31e259){_0x34a8c8=_0x34a8c8-0x0;var _0x1fe6e5=_0xe947[_0x34a8c8];return _0x1fe6e5;};'use strict';var _=require(_0x7e94('0x0'));var util=require(_0x7e94('0x1'));var logger=require('../../config/logger')(_0x7e94('0x2'));var moment=require(_0x7e94('0x3'));var BPromise=require(_0x7e94('0x4'));var rp=require(_0x7e94('0x5'));var fs=require('fs');var path=require(_0x7e94('0x6'));var rimraf=require(_0x7e94('0x7'));var config=require('../../config/environment');var attributes=require('./userNotification.attributes');module[_0x7e94('0x8')]=function(_0x4a78e5,_0x399440){return _0x4a78e5[_0x7e94('0x9')](_0x7e94('0xa'),attributes,{'tableName':_0x7e94('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7e94('0xc')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 322f4da..5b9be22 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 _0x8db7=['defaults','localhost','socket.io-emitter','register','request','then','info','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','UserNotification,\x20%s,\x20%s','message','result','lodash','util','moment','ioredis','jayson/promise','client','http','redis'];(function(_0x12e411,_0x43d5a4){var _0x2915f7=function(_0x2866c4){while(--_0x2866c4){_0x12e411['push'](_0x12e411['shift']());}};_0x2915f7(++_0x43d5a4);}(_0x8db7,0x99));var _0x78db=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8db7[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x78db('0x0'));var util=require(_0x78db('0x1'));var moment=require(_0x78db('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x78db('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x78db('0x4'));var client=jayson[_0x78db('0x5')][_0x78db('0x6')]({'port':0x232a});config[_0x78db('0x7')]=_[_0x78db('0x8')](config[_0x78db('0x7')],{'host':_0x78db('0x9'),'port':0x18eb});var socket=require(_0x78db('0xa'))(new Redis(config[_0x78db('0x7')]));require('./userNotification.socket')[_0x78db('0xb')](socket);function respondWithRpcPromise(_0x33a00e,_0x3a1014,_0x5e8ea6){return new BPromise(function(_0x301dfe,_0x19823e){return client[_0x78db('0xc')](_0x33a00e,_0x5e8ea6)[_0x78db('0xd')](function(_0x177bcf){logger[_0x78db('0xe')]('UserNotification,\x20%s,\x20%s',_0x3a1014,'request\x20sent');logger[_0x78db('0xf')](_0x78db('0x10'),_0x3a1014,'request\x20sent',JSON[_0x78db('0x11')](_0x177bcf));if(_0x177bcf[_0x78db('0x12')]){if(_0x177bcf['error'][_0x78db('0x13')]===0x1f4){logger[_0x78db('0x12')](_0x78db('0x14'),_0x3a1014,_0x177bcf['error'][_0x78db('0x15')]);return _0x19823e(_0x177bcf[_0x78db('0x12')][_0x78db('0x15')]);}logger[_0x78db('0x12')](_0x78db('0x14'),_0x3a1014,_0x177bcf[_0x78db('0x12')]['message']);return _0x301dfe(_0x177bcf[_0x78db('0x12')]['message']);}else{logger['info'](_0x78db('0x14'),_0x3a1014,'request\x20sent');_0x301dfe(_0x177bcf[_0x78db('0x16')]['message']);}})['catch'](function(_0x2d2177){logger[_0x78db('0x12')](_0x78db('0x14'),_0x3a1014,_0x2d2177);_0x19823e(_0x2d2177);});});} \ No newline at end of file +var _0xd5ca=['lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','defaults','socket.io-emitter','./userNotification.socket','register','request','then','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','code','message','info','catch'];(function(_0x201b6e,_0x1452f5){var _0x35d54c=function(_0x1f291d){while(--_0x1f291d){_0x201b6e['push'](_0x201b6e['shift']());}};_0x35d54c(++_0x1452f5);}(_0xd5ca,0xaf));var _0xad5c=function(_0x3002c5,_0x3ca44f){_0x3002c5=_0x3002c5-0x0;var _0x6bef0b=_0xd5ca[_0x3002c5];return _0x6bef0b;};'use strict';var _=require(_0xad5c('0x0'));var util=require(_0xad5c('0x1'));var moment=require('moment');var BPromise=require(_0xad5c('0x2'));var rs=require(_0xad5c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad5c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xad5c('0x5'))(_0xad5c('0x6'));var config=require('../../config/environment');var jayson=require(_0xad5c('0x7'));var client=jayson['client'][_0xad5c('0x8')]({'port':0x232a});config[_0xad5c('0x9')]=_[_0xad5c('0xa')](config[_0xad5c('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xad5c('0xb'))(new Redis(config[_0xad5c('0x9')]));require(_0xad5c('0xc'))[_0xad5c('0xd')](socket);function respondWithRpcPromise(_0x2027e3,_0x2dbc7f,_0x270348){return new BPromise(function(_0x4e7310,_0x2199ac){return client[_0xad5c('0xe')](_0x2027e3,_0x270348)[_0xad5c('0xf')](function(_0x4f9993){logger['info'](_0xad5c('0x10'),_0x2dbc7f,_0xad5c('0x11'));logger[_0xad5c('0x12')](_0xad5c('0x13'),_0x2dbc7f,_0xad5c('0x11'),JSON['stringify'](_0x4f9993));if(_0x4f9993[_0xad5c('0x14')]){if(_0x4f9993['error'][_0xad5c('0x15')]===0x1f4){logger[_0xad5c('0x14')](_0xad5c('0x10'),_0x2dbc7f,_0x4f9993[_0xad5c('0x14')][_0xad5c('0x16')]);return _0x2199ac(_0x4f9993['error'][_0xad5c('0x16')]);}logger[_0xad5c('0x14')]('UserNotification,\x20%s,\x20%s',_0x2dbc7f,_0x4f9993[_0xad5c('0x14')][_0xad5c('0x16')]);return _0x4e7310(_0x4f9993['error'][_0xad5c('0x16')]);}else{logger[_0xad5c('0x17')](_0xad5c('0x10'),_0x2dbc7f,'request\x20sent');_0x4e7310(_0x4f9993['result']['message']);}})[_0xad5c('0x18')](function(_0x586b77){logger['error'](_0xad5c('0x10'),_0x2dbc7f,_0x586b77);_0x2199ac(_0x586b77);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index a875a14..24fb4a0 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 _0x1ced=['userNotification:','./userNotification.events','save','update','emit','removeListener','register'];(function(_0x37236d,_0x3e8445){var _0x5ea146=function(_0xb36353){while(--_0xb36353){_0x37236d['push'](_0x37236d['shift']());}};_0x5ea146(++_0x3e8445);}(_0x1ced,0x1cf));var _0xd1ce=function(_0x4b9dc9,_0x14b3a2){_0x4b9dc9=_0x4b9dc9-0x0;var _0x57b302=_0x1ced[_0x4b9dc9];return _0x57b302;};'use strict';var UserNotificationEvents=require(_0xd1ce('0x0'));var events=[_0xd1ce('0x1'),'remove',_0xd1ce('0x2')];function createListener(_0x277adb,_0x1fccca){return function(_0x2a8479){_0x1fccca[_0xd1ce('0x3')](_0x277adb,_0x2a8479);};}function removeListener(_0x20facc,_0x41736d){return function(){UserNotificationEvents[_0xd1ce('0x4')](_0x20facc,_0x41736d);};}exports[_0xd1ce('0x5')]=function(_0x446852){for(var _0x223880=0x0,_0x41d899=events['length'];_0x223880<_0x41d899;_0x223880++){var _0x31720c=events[_0x223880];var _0x3bddf5=createListener(_0xd1ce('0x6')+_0x31720c,_0x446852);UserNotificationEvents['on'](_0x31720c,_0x3bddf5);}}; \ No newline at end of file +var _0x4554=['save','remove','removeListener','register','length','userNotification:','./userNotification.events'];(function(_0x35f363,_0x50f60d){var _0x3f4b10=function(_0x39b7ba){while(--_0x39b7ba){_0x35f363['push'](_0x35f363['shift']());}};_0x3f4b10(++_0x50f60d);}(_0x4554,0xd8));var _0x4455=function(_0x6448e0,_0x2e3432){_0x6448e0=_0x6448e0-0x0;var _0x5c0f3e=_0x4554[_0x6448e0];return _0x5c0f3e;};'use strict';var UserNotificationEvents=require(_0x4455('0x0'));var events=[_0x4455('0x1'),_0x4455('0x2'),'update'];function createListener(_0x4ac8b2,_0x1d66a5){return function(_0x25c364){_0x1d66a5['emit'](_0x4ac8b2,_0x25c364);};}function removeListener(_0x3a7b2c,_0x20e223){return function(){UserNotificationEvents[_0x4455('0x3')](_0x3a7b2c,_0x20e223);};}exports[_0x4455('0x4')]=function(_0x133479){for(var _0x1ab361=0x0,_0x4b0077=events[_0x4455('0x5')];_0x1ab361<_0x4b0077;_0x1ab361++){var _0x22d199=events[_0x1ab361];var _0xc29b91=createListener(_0x4455('0x6')+_0x22d199,_0x133479);UserNotificationEvents['on'](_0x22d199,_0xc29b91);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 1ac67dd..33e311c 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3cd763,_0x6c9dba){var _0x3f0365=function(_0x2b9349){while(--_0x2b9349){_0x3cd763['push'](_0x3cd763['shift']());}};_0x3f0365(++_0x6c9dba);}(_0xe706,0xa3));var _0x6e70=function(_0x2f8c05,_0x551e3d){_0x2f8c05=_0x2f8c05-0x0;var _0x14cfde=_0xe706[_0x2f8c05];return _0x14cfde;};'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(_0x5d8a87,_0x3784df){var _0x4f4eb7=function(_0x2f90c7){while(--_0x2f90c7){_0x5d8a87['push'](_0x5d8a87['shift']());}};_0x4f4eb7(++_0x3784df);}(_0x70e0,0x17b));var _0x070e=function(_0x4f3a32,_0x35fe2c){_0x4f3a32=_0x4f3a32-0x0;var _0x1d5281=_0x70e0[_0x4f3a32];return _0x1d5281;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index cb8764e..ea05939 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 _0x2df6=['sequelize','exports','INTEGER'];(function(_0x3cdf6b,_0x15b37f){var _0xe90e10=function(_0x263c82){while(--_0x263c82){_0x3cdf6b['push'](_0x3cdf6b['shift']());}};_0xe90e10(++_0x15b37f);}(_0x2df6,0x6c));var _0x62df=function(_0x4a5046,_0x5b1d8e){_0x4a5046=_0x4a5046-0x0;var _0x3c3b34=_0x2df6[_0x4a5046];return _0x3c3b34;};'use strict';var Sequelize=require(_0x62df('0x0'));module[_0x62df('0x1')]={'penalty':{'type':Sequelize[_0x62df('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2531=['sequelize','exports','INTEGER'];(function(_0x284438,_0x57990c){var _0x3c3a43=function(_0x452903){while(--_0x452903){_0x284438['push'](_0x284438['shift']());}};_0x3c3a43(++_0x57990c);}(_0x2531,0xb1));var _0x1253=function(_0x2656ea,_0x3d8e93){_0x2656ea=_0x2656ea-0x0;var _0x3abcb8=_0x2531[_0x2656ea];return _0x3abcb8;};'use strict';var Sequelize=require(_0x1253('0x0'));module[_0x1253('0x1')]={'penalty':{'type':Sequelize[_0x1253('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index c204634..7fc8771 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 _0xde50=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./userOpenchannelQueue.attributes','UserOpenchannelQueue','user_has_openchannel_queues'];(function(_0x33cfce,_0x2e9c7a){var _0x7cf154=function(_0x4dd2ff){while(--_0x4dd2ff){_0x33cfce['push'](_0x33cfce['shift']());}};_0x7cf154(++_0x2e9c7a);}(_0xde50,0x11e));var _0x0de5=function(_0x1ef8e8,_0x2faebd){_0x1ef8e8=_0x1ef8e8-0x0;var _0x1d12f1=_0xde50[_0x1ef8e8];return _0x1d12f1;};'use strict';var _=require(_0x0de5('0x0'));var util=require(_0x0de5('0x1'));var logger=require(_0x0de5('0x2'))(_0x0de5('0x3'));var moment=require(_0x0de5('0x4'));var BPromise=require(_0x0de5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0de5('0x6'));var config=require(_0x0de5('0x7'));var attributes=require(_0x0de5('0x8'));module['exports']=function(_0x17ef89,_0x15a97a){return _0x17ef89['define'](_0x0de5('0x9'),attributes,{'tableName':_0x0de5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xecab=['moment','bluebird','request-promise','rimraf','exports','define','user_has_openchannel_queues','lodash','../../config/logger','api'];(function(_0x460bac,_0x1f11b1){var _0x17b493=function(_0x3dee94){while(--_0x3dee94){_0x460bac['push'](_0x460bac['shift']());}};_0x17b493(++_0x1f11b1);}(_0xecab,0x7f));var _0xbeca=function(_0x26547e,_0x1cf439){_0x26547e=_0x26547e-0x0;var _0x546f30=_0xecab[_0x26547e];return _0x546f30;};'use strict';var _=require(_0xbeca('0x0'));var util=require('util');var logger=require(_0xbeca('0x1'))(_0xbeca('0x2'));var moment=require(_0xbeca('0x3'));var BPromise=require(_0xbeca('0x4'));var rp=require(_0xbeca('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbeca('0x6'));var config=require('../../config/environment');var attributes=require('./userOpenchannelQueue.attributes');module[_0xbeca('0x7')]=function(_0x24273a,_0x33f790){return _0x24273a[_0xbeca('0x8')]('UserOpenchannelQueue',attributes,{'tableName':_0xbeca('0x9'),'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 8f45deb..407275e 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 _0x1353=['debug','stringify','error','code','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x231dda,_0x5b04cc){var _0x3f88cb=function(_0x16eb77){while(--_0x16eb77){_0x231dda['push'](_0x231dda['shift']());}};_0x3f88cb(++_0x5b04cc);}(_0x1353,0x10d));var _0x3135=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x1353[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x3135('0x0'));var util=require(_0x3135('0x1'));var moment=require(_0x3135('0x2'));var BPromise=require('bluebird');var rs=require(_0x3135('0x3'));var fs=require('fs');var Redis=require(_0x3135('0x4'));var db=require(_0x3135('0x5'))['db'];var utils=require(_0x3135('0x6'));var logger=require(_0x3135('0x7'))('rpc');var config=require(_0x3135('0x8'));var jayson=require(_0x3135('0x9'));var client=jayson[_0x3135('0xa')][_0x3135('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1db20d,_0x1442a2,_0x4209e6){return new BPromise(function(_0x48bf41,_0x2678e7){return client[_0x3135('0xc')](_0x1db20d,_0x4209e6)[_0x3135('0xd')](function(_0x1c1dd3){logger[_0x3135('0xe')](_0x3135('0xf'),_0x1442a2,_0x3135('0x10'));logger[_0x3135('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x1442a2,_0x3135('0x10'),JSON[_0x3135('0x12')](_0x1c1dd3));if(_0x1c1dd3[_0x3135('0x13')]){if(_0x1c1dd3['error'][_0x3135('0x14')]===0x1f4){logger[_0x3135('0x13')](_0x3135('0xf'),_0x1442a2,_0x1c1dd3[_0x3135('0x13')][_0x3135('0x15')]);return _0x2678e7(_0x1c1dd3[_0x3135('0x13')][_0x3135('0x15')]);}logger[_0x3135('0x13')](_0x3135('0xf'),_0x1442a2,_0x1c1dd3[_0x3135('0x13')][_0x3135('0x15')]);return _0x48bf41(_0x1c1dd3[_0x3135('0x13')]['message']);}else{logger[_0x3135('0xe')](_0x3135('0xf'),_0x1442a2,_0x3135('0x10'));_0x48bf41(_0x1c1dd3['result'][_0x3135('0x15')]);}})['catch'](function(_0xb593f2){logger[_0x3135('0x13')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1442a2,_0xb593f2);_0x2678e7(_0xb593f2);});});} \ No newline at end of file +var _0xe232=['debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xe232,0x118));var _0x2e23=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe232[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2e23('0x0'));var util=require('util');var moment=require(_0x2e23('0x1'));var BPromise=require(_0x2e23('0x2'));var rs=require(_0x2e23('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2e23('0x4'))['db'];var utils=require(_0x2e23('0x5'));var logger=require(_0x2e23('0x6'))(_0x2e23('0x7'));var config=require(_0x2e23('0x8'));var jayson=require(_0x2e23('0x9'));var client=jayson['client'][_0x2e23('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c4000,_0x1b45a0,_0x83c322){return new BPromise(function(_0x47dc6e,_0x518713){return client[_0x2e23('0xb')](_0x4c4000,_0x83c322)['then'](function(_0x3e8bed){logger[_0x2e23('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1b45a0,_0x2e23('0xd'));logger[_0x2e23('0xe')](_0x2e23('0xf'),_0x1b45a0,_0x2e23('0xd'),JSON['stringify'](_0x3e8bed));if(_0x3e8bed[_0x2e23('0x10')]){if(_0x3e8bed[_0x2e23('0x10')][_0x2e23('0x11')]===0x1f4){logger['error'](_0x2e23('0x12'),_0x1b45a0,_0x3e8bed[_0x2e23('0x10')][_0x2e23('0x13')]);return _0x518713(_0x3e8bed['error'][_0x2e23('0x13')]);}logger[_0x2e23('0x10')](_0x2e23('0x12'),_0x1b45a0,_0x3e8bed[_0x2e23('0x10')][_0x2e23('0x13')]);return _0x47dc6e(_0x3e8bed[_0x2e23('0x10')][_0x2e23('0x13')]);}else{logger[_0x2e23('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1b45a0,_0x2e23('0xd'));_0x47dc6e(_0x3e8bed['result']['message']);}})[_0x2e23('0x14')](function(_0x44c9d0){logger[_0x2e23('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1b45a0,_0x44c9d0);_0x518713(_0x44c9d0);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index a98e0e4..e9787f1 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 _0xe10a=['/:id','show','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','put','delete','destroy','/:id/sections','removeSections','removeResources','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfile.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe10a,0xea));var _0xae10=function(_0x42d0bd,_0x18983f){_0x42d0bd=_0x42d0bd-0x0;var _0x4a91d4=_0xe10a[_0x42d0bd];return _0x4a91d4;};'use strict';var multer=require(_0xae10('0x0'));var util=require(_0xae10('0x1'));var path=require('path');var timeout=require(_0xae10('0x2'));var express=require(_0xae10('0x3'));var router=express[_0xae10('0x4')]();var fs_extra=require(_0xae10('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xae10('0x6'));var config=require(_0xae10('0x7'));var controller=require(_0xae10('0x8'));router[_0xae10('0x9')]('/',auth['isAuthenticated'](),controller[_0xae10('0xa')]);router[_0xae10('0x9')](_0xae10('0xb'),auth[_0xae10('0xc')](),controller[_0xae10('0xd')]);router['get'](_0xae10('0xe'),auth[_0xae10('0xc')](),controller[_0xae10('0xf')]);router[_0xae10('0x9')]('/:id/sections',auth[_0xae10('0xc')](),controller[_0xae10('0x10')]);router[_0xae10('0x9')](_0xae10('0x11'),auth[_0xae10('0xc')](),controller[_0xae10('0x12')]);router[_0xae10('0x13')]('/',auth['isAuthenticated'](),controller[_0xae10('0x14')]);router[_0xae10('0x13')](_0xae10('0x15'),auth['isAuthenticated'](),controller[_0xae10('0x16')]);router[_0xae10('0x13')]('/:id/sections',auth[_0xae10('0xc')](),controller[_0xae10('0x17')]);router[_0xae10('0x13')](_0xae10('0x11'),auth[_0xae10('0xc')](),controller['addResources']);router[_0xae10('0x18')]('/:id',auth[_0xae10('0xc')](),controller['update']);router[_0xae10('0x19')](_0xae10('0xe'),auth[_0xae10('0xc')](),controller[_0xae10('0x1a')]);router[_0xae10('0x19')](_0xae10('0x1b'),auth[_0xae10('0xc')](),controller[_0xae10('0x1c')]);router[_0xae10('0x19')]('/:id/resources',auth[_0xae10('0xc')](),controller[_0xae10('0x1d')]);module[_0xae10('0x1e')]=router; \ No newline at end of file +var _0x474b=['/:id/resources','getResources','create','post','/:id/clone','addResources','put','update','destroy','delete','removeResources','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/sections','getSections'];(function(_0x188bd6,_0x1b7189){var _0x39ace4=function(_0x1262ef){while(--_0x1262ef){_0x188bd6['push'](_0x188bd6['shift']());}};_0x39ace4(++_0x1b7189);}(_0x474b,0x1ce));var _0xb474=function(_0x424d0f,_0x863fa1){_0x424d0f=_0x424d0f-0x0;var _0x550b8d=_0x474b[_0x424d0f];return _0x550b8d;};'use strict';var multer=require(_0xb474('0x0'));var util=require(_0xb474('0x1'));var path=require(_0xb474('0x2'));var timeout=require(_0xb474('0x3'));var express=require(_0xb474('0x4'));var router=express[_0xb474('0x5')]();var fs_extra=require(_0xb474('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb474('0x7'));var config=require(_0xb474('0x8'));var controller=require(_0xb474('0x9'));router['get']('/',auth[_0xb474('0xa')](),controller[_0xb474('0xb')]);router[_0xb474('0xc')](_0xb474('0xd'),auth['isAuthenticated'](),controller[_0xb474('0xe')]);router[_0xb474('0xc')](_0xb474('0xf'),auth[_0xb474('0xa')](),controller['show']);router[_0xb474('0xc')](_0xb474('0x10'),auth['isAuthenticated'](),controller[_0xb474('0x11')]);router[_0xb474('0xc')](_0xb474('0x12'),auth[_0xb474('0xa')](),controller[_0xb474('0x13')]);router['post']('/',auth[_0xb474('0xa')](),controller[_0xb474('0x14')]);router[_0xb474('0x15')](_0xb474('0x16'),auth[_0xb474('0xa')](),controller['clone']);router[_0xb474('0x15')]('/:id/sections',auth[_0xb474('0xa')](),controller['addSections']);router[_0xb474('0x15')]('/:id/resources',auth['isAuthenticated'](),controller[_0xb474('0x17')]);router[_0xb474('0x18')](_0xb474('0xf'),auth[_0xb474('0xa')](),controller[_0xb474('0x19')]);router['delete'](_0xb474('0xf'),auth[_0xb474('0xa')](),controller[_0xb474('0x1a')]);router[_0xb474('0x1b')](_0xb474('0x10'),auth[_0xb474('0xa')](),controller['removeSections']);router['delete'](_0xb474('0x12'),auth[_0xb474('0xa')](),controller[_0xb474('0x1c')]);module[_0xb474('0x1d')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 2a73897..98ee42e 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 _0x64b6=['split','BOOLEAN','sequelize','exports','STRING','crudPermissions','join','getDataValue'];(function(_0x3b6cc2,_0x20cefd){var _0x3b9664=function(_0xb56ded){while(--_0xb56ded){_0x3b6cc2['push'](_0x3b6cc2['shift']());}};_0x3b9664(++_0x20cefd);}(_0x64b6,0xda));var _0x664b=function(_0x4093bb,_0x12d5d8){_0x4093bb=_0x4093bb-0x0;var _0x349327=_0x64b6[_0x4093bb];return _0x349327;};'use strict';var Sequelize=require(_0x664b('0x0'));module[_0x664b('0x1')]={'name':{'type':Sequelize[_0x664b('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x664b('0x2')],'set':function(_0x3e4681){this['setDataValue'](_0x664b('0x3'),_0x3e4681?_0x3e4681[_0x664b('0x4')](''):[]);},'get':function(){return this[_0x664b('0x5')](_0x664b('0x3'))?this[_0x664b('0x5')](_0x664b('0x3'))[_0x664b('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x664b('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x664b('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x664b('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x664b('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x664b('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x664b('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x2114=['exports','STRING','setDataValue','join','crudPermissions','getDataValue','split','BOOLEAN','sequelize'];(function(_0x3ac12c,_0x2e0cdd){var _0x210f70=function(_0x467a8c){while(--_0x467a8c){_0x3ac12c['push'](_0x3ac12c['shift']());}};_0x210f70(++_0x2e0cdd);}(_0x2114,0x19d));var _0x4211=function(_0x115621,_0x341cde){_0x115621=_0x115621-0x0;var _0x5ef5ce=_0x2114[_0x115621];return _0x5ef5ce;};'use strict';var Sequelize=require(_0x4211('0x0'));module[_0x4211('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x4211('0x2')],'set':function(_0x2d60a6){this[_0x4211('0x3')]('crudPermissions',_0x2d60a6?_0x2d60a6[_0x4211('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0x4211('0x5'))?this[_0x4211('0x6')]('crudPermissions')[_0x4211('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x4211('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x4211('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x4211('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x4211('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 6c402ba..7a85607 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 _0x13b6=['VIRTUAL','UserProfile','includeAll','include','findAll','catch','params','find','create','body','clone','options','get','omit','crudPermissions','createdAt','updatedAt','sequelize','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','update','describe','transaction','push','includes','isEmpty','subsections','enabled','Dashboard','forEach','Plugin','addResources','bulkCreate','removeResources','section','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge'];(function(_0x3f9c06,_0x8e0bad){var _0x16d14a=function(_0x2598d9){while(--_0x2598d9){_0x3f9c06['push'](_0x3f9c06['shift']());}};_0x16d14a(++_0x8e0bad);}(_0x13b6,0x97));var _0x613b=function(_0x3501a1,_0xbe3366){_0x3501a1=_0x3501a1-0x0;var _0x28ce59=_0x13b6[_0x3501a1];return _0x28ce59;};'use strict';var emlformat=require(_0x613b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x613b('0x1'));var jsonpatch=require(_0x613b('0x2'));var rp=require(_0x613b('0x3'));var moment=require(_0x613b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x613b('0x5'));var util=require(_0x613b('0x6'));var path=require(_0x613b('0x7'));var sox=require('sox');var csv=require(_0x613b('0x8'));var ejs=require(_0x613b('0x9'));var fs=require('fs');var fs_extra=require(_0x613b('0xa'));var _=require('lodash');var squel=require(_0x613b('0xb'));var crypto=require('crypto');var jsforce=require(_0x613b('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x613b('0xd'));var Papa=require(_0x613b('0xe'));var Redis=require(_0x613b('0xf'));var authService=require(_0x613b('0x10'));var qs=require(_0x613b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x613b('0x12'))('api');var utils=require(_0x613b('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x613b('0x14'))['db'];config[_0x613b('0x15')]=_[_0x613b('0x16')](config['redis'],{'host':_0x613b('0x17'),'port':0x18eb});var socket=require(_0x613b('0x18'))(new Redis(config[_0x613b('0x15')]));require(_0x613b('0x19'))[_0x613b('0x1a')](socket);function respondWithStatusCode(_0x3516ed,_0xae6dd1){_0xae6dd1=_0xae6dd1||0xcc;return function(_0x3c1e24){if(_0x3c1e24){return _0x3516ed[_0x613b('0x1b')](_0xae6dd1);}return _0x3516ed[_0x613b('0x1c')](_0xae6dd1)['end']();};}function respondWithResult(_0xa74b30,_0x3023a4){_0x3023a4=_0x3023a4||0xc8;return function(_0x12f0d1){if(_0x12f0d1){return _0xa74b30['status'](_0x3023a4)['json'](_0x12f0d1);}};}function respondWithFilteredResult(_0x41a912,_0x588d5d){return function(_0x27949c){if(_0x27949c){var _0x4d3def=typeof _0x588d5d[_0x613b('0x1d')]===_0x613b('0x1e')&&typeof _0x588d5d[_0x613b('0x1f')]===_0x613b('0x1e');var _0x22fee9=_0x27949c[_0x613b('0x20')];var _0x231fcb=_0x4d3def?0x0:_0x588d5d['offset'];var _0x393168=_0x4d3def?_0x27949c[_0x613b('0x20')]:_0x588d5d['offset']+_0x588d5d['limit'];var _0x22b5ec;if(_0x393168>=_0x22fee9){_0x393168=_0x22fee9;_0x22b5ec=0xc8;}else{_0x22b5ec=0xce;}_0x41a912[_0x613b('0x1c')](_0x22b5ec);return _0x41a912[_0x613b('0x21')](_0x613b('0x22'),_0x231fcb+'-'+_0x393168+'/'+_0x22fee9)[_0x613b('0x23')](_0x27949c);}return null;};}function patchUpdates(_0x4d9728){return function(_0x84c80f){try{jsonpatch['apply'](_0x84c80f,_0x4d9728,!![]);}catch(_0x295420){return BPromise[_0x613b('0x24')](_0x295420);}return _0x84c80f[_0x613b('0x25')]();};}function saveUpdates(_0x101ec7,_0x485a6d){return function(_0x32a460){if(_0x32a460){return _0x32a460['update'](_0x101ec7)[_0x613b('0x26')](function(_0x4ad958){return _0x4ad958;});}return null;};}function removeEntity(_0x116b0e,_0x17e3ac){return function(_0x1a08dc){if(_0x1a08dc){return _0x1a08dc[_0x613b('0x27')]()[_0x613b('0x26')](function(){_0x116b0e[_0x613b('0x1c')](0xcc)[_0x613b('0x28')]();});}};}function handleEntityNotFound(_0x374547,_0x2d7191){return function(_0x63f8c3){if(!_0x63f8c3){_0x374547[_0x613b('0x1b')](0x194);}return _0x63f8c3;};}function handleError(_0x367c1a,_0x4f6bdf){_0x4f6bdf=_0x4f6bdf||0x1f4;return function(_0x46529a){logger[_0x613b('0x29')](_0x46529a[_0x613b('0x2a')]);if(_0x46529a[_0x613b('0x2b')]){delete _0x46529a[_0x613b('0x2b')];}_0x367c1a[_0x613b('0x1c')](_0x4f6bdf)[_0x613b('0x2c')](_0x46529a);};}exports['index']=function(_0x228f39,_0x169baf){var _0x56561f={},_0x3af1ff={},_0x4f2df9={'count':0x0,'rows':[]};var _0x3ed316=_[_0x613b('0x2d')](db['UserProfile'][_0x613b('0x2e')],function(_0x37294f){return{'name':_0x37294f[_0x613b('0x2f')],'type':_0x37294f[_0x613b('0x30')][_0x613b('0x31')]};});_0x3af1ff[_0x613b('0x32')]=_[_0x613b('0x2d')](_0x3ed316,_0x613b('0x2b'));_0x3af1ff[_0x613b('0x33')]=_[_0x613b('0x34')](_0x228f39[_0x613b('0x33')]);_0x3af1ff[_0x613b('0x35')]=_[_0x613b('0x36')](_0x3af1ff['model'],_0x3af1ff[_0x613b('0x33')]);_0x56561f[_0x613b('0x37')]=_[_0x613b('0x36')](_0x3af1ff[_0x613b('0x32')],qs['fields'](_0x228f39['query'][_0x613b('0x38')]));_0x56561f[_0x613b('0x37')]=_0x56561f[_0x613b('0x37')][_0x613b('0x39')]?_0x56561f[_0x613b('0x37')]:_0x3af1ff[_0x613b('0x32')];if(!_0x228f39[_0x613b('0x33')]['hasOwnProperty'](_0x613b('0x3a'))){_0x56561f[_0x613b('0x1f')]=qs[_0x613b('0x1f')](_0x228f39[_0x613b('0x33')][_0x613b('0x1f')]);_0x56561f[_0x613b('0x1d')]=qs[_0x613b('0x1d')](_0x228f39[_0x613b('0x33')][_0x613b('0x1d')]);}_0x56561f[_0x613b('0x3b')]=qs[_0x613b('0x3c')](_0x228f39[_0x613b('0x33')][_0x613b('0x3c')]);_0x56561f[_0x613b('0x3d')]=qs[_0x613b('0x35')](_[_0x613b('0x3e')](_0x228f39[_0x613b('0x33')],_0x3af1ff[_0x613b('0x35')]),_0x3ed316);if(_0x228f39['query'][_0x613b('0x3f')]){_0x56561f[_0x613b('0x3d')]=_[_0x613b('0x40')](_0x56561f[_0x613b('0x3d')],{'$or':_[_0x613b('0x2d')](_0x3ed316,function(_0x127500){if(_0x127500[_0x613b('0x30')]!==_0x613b('0x41')){var _0x18d31e={};_0x18d31e[_0x127500[_0x613b('0x2b')]]={'$like':'%'+_0x228f39[_0x613b('0x33')]['filter']+'%'};return _0x18d31e;}})});}_0x56561f=_[_0x613b('0x40')]({},_0x56561f,_0x228f39['options']);var _0x5ea015={'where':_0x56561f[_0x613b('0x3d')]};return db[_0x613b('0x42')][_0x613b('0x20')](_0x5ea015)[_0x613b('0x26')](function(_0x48bca8){_0x4f2df9[_0x613b('0x20')]=_0x48bca8;if(_0x228f39['query'][_0x613b('0x43')]){_0x56561f[_0x613b('0x44')]=[{'all':!![]}];}return db['UserProfile'][_0x613b('0x45')](_0x56561f);})['then'](function(_0x48a4fb){_0x4f2df9['rows']=_0x48a4fb;return _0x4f2df9;})['then'](respondWithFilteredResult(_0x169baf,_0x56561f))[_0x613b('0x46')](handleError(_0x169baf,null));};exports['show']=function(_0x385c1c,_0x389868){var _0x57d5fa={'raw':![],'where':{'id':_0x385c1c[_0x613b('0x47')]['id']}},_0x392a2d={};_0x392a2d[_0x613b('0x32')]=_[_0x613b('0x34')](db['UserProfile']['rawAttributes']);_0x392a2d[_0x613b('0x33')]=_[_0x613b('0x34')](_0x385c1c[_0x613b('0x33')]);_0x392a2d['filters']=_['intersection'](_0x392a2d[_0x613b('0x32')],_0x392a2d[_0x613b('0x33')]);_0x57d5fa[_0x613b('0x37')]=_['intersection'](_0x392a2d['model'],qs[_0x613b('0x38')](_0x385c1c[_0x613b('0x33')][_0x613b('0x38')]));_0x57d5fa[_0x613b('0x37')]=_0x57d5fa[_0x613b('0x37')][_0x613b('0x39')]?_0x57d5fa[_0x613b('0x37')]:_0x392a2d[_0x613b('0x32')];if(_0x385c1c[_0x613b('0x33')][_0x613b('0x43')]){_0x57d5fa[_0x613b('0x44')]=[{'all':!![]}];}_0x57d5fa=_[_0x613b('0x40')]({},_0x57d5fa,_0x385c1c['options']);return db[_0x613b('0x42')][_0x613b('0x48')](_0x57d5fa)[_0x613b('0x26')](handleEntityNotFound(_0x389868,null))[_0x613b('0x26')](respondWithResult(_0x389868,null))[_0x613b('0x46')](handleError(_0x389868,null));};exports['create']=function(_0x1e6226,_0x2d3995){return db[_0x613b('0x42')][_0x613b('0x49')](_0x1e6226[_0x613b('0x4a')],{})[_0x613b('0x26')](respondWithResult(_0x2d3995,0xc9))[_0x613b('0x46')](handleError(_0x2d3995,null));};exports[_0x613b('0x4b')]=function(_0x1b23a3,_0x378205){var _0x1813f8={'where':{'id':_0x1b23a3[_0x613b('0x47')]['id']}},_0x43fcf1={};_0x43fcf1[_0x613b('0x32')]=_[_0x613b('0x34')](db[_0x613b('0x42')][_0x613b('0x2e')]);_0x1813f8[_0x613b('0x37')]=_[_0x613b('0x36')](_0x43fcf1['model'],qs[_0x613b('0x38')](_0x1b23a3[_0x613b('0x33')][_0x613b('0x38')]));_0x1813f8['attributes']=_0x1813f8['attributes'][_0x613b('0x39')]?_0x1813f8[_0x613b('0x37')]:_0x43fcf1[_0x613b('0x32')];if(_0x1b23a3['query'][_0x613b('0x43')]){_0x1813f8[_0x613b('0x44')]=[{'all':!![]}];}_0x1813f8=_['merge']({},_0x1813f8,_0x1b23a3[_0x613b('0x4c')]);return db[_0x613b('0x42')][_0x613b('0x48')](_0x1813f8)[_0x613b('0x26')](handleEntityNotFound(_0x378205,null))[_0x613b('0x26')](function(_0x1eb1de){if(_0x1eb1de){var _0x5ef07a=_0x1eb1de[_0x613b('0x4d')]({'plain':!![]});_0x5ef07a=qs[_0x613b('0x4e')](_0x5ef07a,['id','createdAt','updatedAt',_0x613b('0x4f')]);_0x1b23a3['body']=_['omit'](_0x1b23a3[_0x613b('0x4a')],['id',_0x613b('0x50'),_0x613b('0x51')]);return db[_0x613b('0x52')]['transaction'](function(_0x2ea46a){return db[_0x613b('0x42')][_0x613b('0x49')](_['merge'](_0x5ef07a,_0x1b23a3['body']),{'include':_0x1b23a3[_0x613b('0x33')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x2ea46a})['then'](function(_0x258c69){var _0x5cdc2a=_0x258c69[_0x613b('0x4d')]({'plain':!![]});return db[_0x613b('0x53')][_0x613b('0x45')]({'where':{'userProfileId':_0x1b23a3[_0x613b('0x47')]['id']},'raw':!![]})['then'](function(_0x4f84b2){if(_0x4f84b2){return BPromise[_0x613b('0x54')](_0x4f84b2,function(_0x3751b6){return new BPromise(function(_0x109a2a,_0x209ff7){if(_0x3751b6[_0x613b('0x55')]===null||_0x3751b6[_0x613b('0x55')]===0x1)_0x109a2a(null);return db[_0x613b('0x56')][_0x613b('0x45')]({'where':{'sectionId':_0x3751b6['id']},'raw':!![]})[_0x613b('0x26')](function(_0x119c97){var _0x3600d0=_[_0x613b('0x2d')](_0x119c97,function(_0x3c3d22){return qs[_0x613b('0x4e')](_0x3c3d22,['id','createdAt',_0x613b('0x51'),_0x613b('0x57')]);});_0x109a2a(_0x3600d0);})[_0x613b('0x46')](function(_0x56bd02){_0x209ff7(_0x56bd02);});})[_0x613b('0x26')](function(_0x34bdaf){var _0x3cf80a=qs[_0x613b('0x4e')](_0x3751b6,['id',_0x613b('0x50'),_0x613b('0x51')]);_0x3cf80a[_0x613b('0x58')]=_0x5cdc2a['id'];if(_0x34bdaf)_0x3cf80a[_0x613b('0x59')]=_0x34bdaf;return _0x3cf80a;})['then'](function(_0x14a1ab){return db[_0x613b('0x53')]['create'](_0x14a1ab,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x2ea46a});});})['then'](function(){return _0x5cdc2a;});}});});});}})['then'](respondWithResult(_0x378205,0xc9))[_0x613b('0x46')](handleError(_0x378205,null));};exports[_0x613b('0x5a')]=function(_0x13d17b,_0x108318){if(_0x13d17b[_0x613b('0x4a')]['id']){delete _0x13d17b['body']['id'];}return db['UserProfile']['find']({'where':{'id':_0x13d17b[_0x613b('0x47')]['id']}})[_0x613b('0x26')](handleEntityNotFound(_0x108318,null))[_0x613b('0x26')](saveUpdates(_0x13d17b[_0x613b('0x4a')],null))['then'](respondWithResult(_0x108318,null))[_0x613b('0x46')](handleError(_0x108318,null));};exports[_0x613b('0x27')]=function(_0x7cfc4a,_0x2745c3){return db[_0x613b('0x42')]['find']({'where':{'id':_0x7cfc4a[_0x613b('0x47')]['id']}})[_0x613b('0x26')](handleEntityNotFound(_0x2745c3,null))[_0x613b('0x26')](removeEntity(_0x2745c3,null))[_0x613b('0x46')](handleError(_0x2745c3,null));};exports[_0x613b('0x5b')]=function(_0x7c00c5,_0xb235f5){return db[_0x613b('0x42')][_0x613b('0x5b')]()[_0x613b('0x26')](respondWithResult(_0xb235f5,null))[_0x613b('0x46')](handleError(_0xb235f5,null));};exports['addSections']=function(_0x279e27,_0x3ee588){var _0x3d58d3=_0x279e27['body'];return db['UserProfile'][_0x613b('0x48')]({'where':{'id':_0x279e27[_0x613b('0x47')]['id']}})[_0x613b('0x26')](handleEntityNotFound(_0x3ee588,null))[_0x613b('0x26')](function(_0x6b4199){if(_0x6b4199){return db[_0x613b('0x52')][_0x613b('0x5c')](function(_0x3e42d6){return db['UserProfileSection'][_0x613b('0x27')]({'where':{'userProfileId':_0x279e27[_0x613b('0x47')]['id'],'sectionId':_[_0x613b('0x2d')](_0x3d58d3,function(_0x2685ac){return _0x2685ac[_0x613b('0x57')];})},'transaction':_0x3e42d6})[_0x613b('0x26')](function(){var _0x5a58ce=_[_0x613b('0x2d')](_0x3d58d3,function(_0x5c9d99){_0x5c9d99[_0x613b('0x58')]=_0x279e27['params']['id'];return _0x5c9d99;});var _0x36c23c=[];return BPromise['each'](_0x5a58ce,function(_0x3e2213){return db[_0x613b('0x53')]['create'](_0x3e2213,{'include':[{'model':db[_0x613b('0x56')],'as':'Resources'}],'raw':!![],'transaction':_0x3e42d6})[_0x613b('0x26')](function(_0x1a26a2){_0x36c23c[_0x613b('0x5d')](_0x1a26a2['get']({'plain':!![]}));});})['then'](function(){return _0x36c23c;});});});}})[_0x613b('0x26')](function(_0xf05af9){return _0xf05af9;})['then'](respondWithResult(_0x3ee588,null))[_0x613b('0x46')](handleError(_0x3ee588,null));};exports['removeSections']=function(_0x881822,_0xfa8443){var _0x1eb029;return db[_0x613b('0x42')]['find']({'where':{'id':_0x881822[_0x613b('0x47')]['id']},'attributes':['id','name']})['then'](handleEntityNotFound(_0xfa8443,null))[_0x613b('0x26')](function(_0x13e836){if(_0x13e836){_0x1eb029=_0x13e836;return db[_0x613b('0x53')][_0x613b('0x27')]({'where':{'userProfileId':_0x881822[_0x613b('0x47')]['id'],'sectionId':_0x881822[_0x613b('0x33')]['ids']}});}})[_0x613b('0x26')](function(){return _0x1eb029;})[_0x613b('0x26')](respondWithStatusCode(_0xfa8443,null))[_0x613b('0x46')](handleError(_0xfa8443,null));};exports['getSections']=function(_0x4c0332,_0x8fcff4){var _0x331851=[];var _0x4e4ae2=[];return db[_0x613b('0x53')][_0x613b('0x45')]({'where':{'userProfileId':_0x4c0332['params']['id']},'raw':!![]})[_0x613b('0x26')](function(_0x1c077a){_0x331851=_[_0x613b('0x3f')](_0x1c077a,function(_0x14188f){return _0x14188f['enabled']===0x1||_[_0x613b('0x5e')]([0x3eb,0x709],_0x14188f[_0x613b('0x57')]);});if(!_[_0x613b('0x5f')](_0x331851)){return _[_0x613b('0x2d')](_0x331851,function(_0x2b2338){return _0x2b2338['sectionId'];});}else{return;}})[_0x613b('0x26')](function(_0x10b169){if(_0x10b169)_0x4e4ae2=_0x10b169;if(_[_0x613b('0x5e')](_0x4e4ae2,0x64)){var _0x261ee2=_[_0x613b('0x48')](_0x331851,{'sectionId':0x64});return hasDefaultDashboard(_0x261ee2)[_0x613b('0x26')](function(_0x49a2c3){return _[_0x613b('0x2d')](_0x331851,function(_0x54874f){if(_0x54874f['sectionId']===0x64){_0x54874f[_0x613b('0x60')]=_0x49a2c3;}return _0x54874f;});});}else{return;}})[_0x613b('0x26')](function(_0x325492){if(_0x325492)_0x331851=_0x325492;if(_[_0x613b('0x5e')](_0x4e4ae2,0x3eb)){var _0x343193=_[_0x613b('0x48')](_0x331851,{'sectionId':0x3eb});return getCustomDashboards(_0x343193)[_0x613b('0x26')](function(_0x1bf5d2){return _[_0x613b('0x2d')](_0x331851,function(_0x337ff3){if(_0x343193['enabled']){if(_0x337ff3['sectionId']===0x3eb){_0x337ff3[_0x613b('0x60')]=_0x1bf5d2;}}else{if(_0x337ff3[_0x613b('0x57')]===0x64){_0x337ff3['subsections']=_0x1bf5d2;}}return _0x337ff3;});});}else{return;}})['then'](function(_0x17f422){if(_0x17f422)_0x331851=_0x17f422;if(_[_0x613b('0x5e')](_0x4e4ae2,0x709)){var _0x187b77=_[_0x613b('0x48')](_0x331851,{'sectionId':0x709});return getPlugins(_0x187b77)['then'](function(_0x10ff52){if(_0x187b77[_0x613b('0x61')]){return _['map'](_0x331851,function(_0x4ae273){if(_0x4ae273[_0x613b('0x57')]===0x709){_0x4ae273[_0x613b('0x60')]=_0x10ff52;}return _0x4ae273;});}else{var _0x2e706f={'sectionId':0x76c,'enabled':0x1,'subsections':_0x10ff52};var _0x5944ac=_[_0x613b('0x2d')](_0x331851);_0x5944ac['push'](_0x2e706f);return _0x5944ac;}});}else{return;}})[_0x613b('0x26')](function(_0x378353){if(_0x378353)_0x331851=_0x378353;return _[_0x613b('0x3f')](_0x331851,[_0x613b('0x61'),0x1]);})[_0x613b('0x26')](respondWithResult(_0x8fcff4,null))[_0x613b('0x46')](handleError(_0x8fcff4,null));};function hasDefaultDashboard(_0x3d7bde){var _0x52a649=[0x65];return new BPromise(function(_0x352fc3,_0x2dec83){try{if(_0x3d7bde[_0x613b('0x55')]){_0x352fc3(_0x52a649);}else{return db[_0x613b('0x56')]['findOne']({'where':{'sectionId':_0x3d7bde['id']},'raw':!![]})[_0x613b('0x26')](function(_0x336061){_0x336061?_0x352fc3(_0x52a649):_0x352fc3();});}}catch(_0x4a440d){_0x2dec83(_0x4a440d);}});}function getCustomDashboards(_0x464689){var _0x118f1d=[];return new BPromise(function(_0x456eee,_0xbe7782){try{if(_0x464689['autoAssociation']){return db[_0x613b('0x62')][_0x613b('0x45')]({'raw':!![]})['then'](function(_0x2cb319){_0x2cb319[_0x613b('0x63')](function(_0x129436){_0x118f1d[_0x613b('0x5d')](_0x129436['id']+0x1869f);});_0x456eee(_0x118f1d);});}else{return db[_0x613b('0x56')][_0x613b('0x45')]({'where':{'sectionId':_0x464689['id']},'raw':!![]})[_0x613b('0x26')](function(_0x20c6c9){_0x20c6c9[_0x613b('0x63')](function(_0x348c77){_0x118f1d[_0x613b('0x5d')](_0x348c77['resourceId']+0x1869f);});_0x456eee(_0x118f1d);});}}catch(_0x36d6c0){_0xbe7782(_0x36d6c0);}});}function getPlugins(_0x4355bc){var _0x4dc34a=[];return new BPromise(function(_0x304f92,_0x93dcef){try{if(_0x4355bc[_0x613b('0x55')]){return db[_0x613b('0x64')]['findAll']({'raw':!![]})['then'](function(_0x11123f){_0x11123f[_0x613b('0x63')](function(_0x4a5881){_0x4dc34a[_0x613b('0x5d')](_0x4a5881['id']+0x15b38);});_0x304f92(_0x4dc34a);});}else{return db[_0x613b('0x56')]['findAll']({'where':{'sectionId':_0x4355bc['id']},'raw':!![]})[_0x613b('0x26')](function(_0x4c3966){_0x4c3966[_0x613b('0x63')](function(_0x2f9e30){_0x4dc34a[_0x613b('0x5d')](_0x2f9e30['resourceId']+0x15b38);});_0x304f92(_0x4dc34a);});}}catch(_0x15f1ae){_0x93dcef(_0x15f1ae);}});}exports[_0x613b('0x65')]=function(_0xc7522e,_0x5d0fa7){return db[_0x613b('0x42')][_0x613b('0x48')]({'where':{'id':_0xc7522e['params']['id']}})['then'](handleEntityNotFound(_0x5d0fa7,null))['then'](function(_0x110d2b){if(_0x110d2b){return db[_0x613b('0x52')][_0x613b('0x5c')](function(_0x4014a8){return db['UserProfileSection'][_0x613b('0x45')]({'where':{'userProfileId':_0xc7522e[_0x613b('0x47')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x4f1eaf){if(_0x4f1eaf){return db[_0x613b('0x53')][_0x613b('0x27')]({'where':{'userProfileId':_0xc7522e[_0x613b('0x47')]['id'],'id':_[_0x613b('0x2d')](_0x4f1eaf,function(_0x4acdc4){return _0x4acdc4['id'];})},'transaction':_0x4014a8});}})[_0x613b('0x26')](function(_0x3f9cd6){var _0x25528a=_['map'](_0xc7522e[_0x613b('0x4a')],function(_0x7d9ef2){_0x7d9ef2[_0x613b('0x58')]=_0xc7522e['params']['id'];return _0x7d9ef2;});return db[_0x613b('0x53')]['bulkCreate'](_0x25528a,{'raw':!![],'transaction':_0x4014a8});})['then'](function(_0x1710a8){var _0x2d2b31=_[_0x613b('0x3f')](_['map'](_0x1710a8,function(_0x4b769b){return _0x4b769b[_0x613b('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0x2d2b31){return db[_0x613b('0x53')][_0x613b('0x45')]({'where':{'userProfileId':_0xc7522e[_0x613b('0x47')]['id'],'sectionId':_[_0x613b('0x2d')](_0x2d2b31,function(_0x3cd9c1){return _0x3cd9c1[_0x613b('0x57')];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0x163f0d){var _0x17ca3f=_[_0x613b('0x2d')](_0xc7522e['body'],function(_0x35ab20){_0x35ab20['userProfileId']=_0xc7522e['params']['id'];return _0x35ab20;});return db[_0x613b('0x56')][_0x613b('0x66')](_0x17ca3f,{'raw':!![],'transaction':_0x4014a8});});}})[_0x613b('0x46')](handleError(_0x5d0fa7,null));});}})[_0x613b('0x26')](function(_0x273781){var _0xb40bf=_[_0x613b('0x2d')](_0x273781,function(_0x46cc74){return _0x46cc74['get']({'plain':!![]});});})[_0x613b('0x26')](respondWithResult(_0x5d0fa7,null))[_0x613b('0x46')](handleError(_0x5d0fa7,null));};exports[_0x613b('0x67')]=function(_0x19f46b,_0x269e3e,_0x46df6c){return db[_0x613b('0x42')]['find']({'where':{'id':_0x19f46b['params']['id']}})[_0x613b('0x26')](handleEntityNotFound(_0x269e3e,null))[_0x613b('0x26')](function(_0x380587){if(_0x380587){return _0x380587[_0x613b('0x67')](_0x19f46b['query']['ids']);}})[_0x613b('0x26')](respondWithStatusCode(_0x269e3e,null))[_0x613b('0x46')](handleError(_0x269e3e,null));};exports['getResources']=function(_0x1ce2da,_0x13eb17){var _0x253d59={};if(!_0x1ce2da[_0x613b('0x33')][_0x613b('0x68')])throw new Error(_0x613b('0x69'));if(!_0x1ce2da['query'][_0x613b('0x6a')](_0x613b('0x3a'))){_0x253d59[_0x613b('0x1f')]=qs[_0x613b('0x1f')](_0x1ce2da[_0x613b('0x33')][_0x613b('0x1f')]);_0x253d59['offset']=qs['offset'](_0x1ce2da[_0x613b('0x33')][_0x613b('0x1d')]);}return db[_0x613b('0x42')][_0x613b('0x48')]({'where':{'id':_0x1ce2da[_0x613b('0x47')]['id']}})[_0x613b('0x26')](function(_0x523629){if(!_0x523629)throw new Error(_0x613b('0x6b')+_0x1ce2da[_0x613b('0x47')]['id']);return db[_0x613b('0x42')]['getResources'](_0x1ce2da);})[_0x613b('0x26')](respondWithFilteredResult(_0x13eb17,_0x253d59))[_0x613b('0x46')](handleError(_0x13eb17,null));}; \ No newline at end of file +var _0xa3e8=['order','sort','where','pick','filters','VIRTUAL','filter','merge','rows','catch','show','params','includeAll','include','options','find','create','get','omit','createdAt','updatedAt','crudPermissions','body','sequelize','UserProfileSection','findAll','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','destroy','describe','addSections','transaction','each','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','push','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','index','map','UserProfile','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x3595a7,_0x2bdcdd){var _0x35c348=function(_0x2d84b5){while(--_0x2d84b5){_0x3595a7['push'](_0x3595a7['shift']());}};_0x35c348(++_0x2bdcdd);}(_0xa3e8,0x127));var _0x8a3e=function(_0x16f620,_0x8bc0fe){_0x16f620=_0x16f620-0x0;var _0x3aa876=_0xa3e8[_0x16f620];return _0x3aa876;};'use strict';var emlformat=require(_0x8a3e('0x0'));var rimraf=require(_0x8a3e('0x1'));var zipdir=require(_0x8a3e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8a3e('0x3'));var moment=require(_0x8a3e('0x4'));var BPromise=require(_0x8a3e('0x5'));var Mustache=require(_0x8a3e('0x6'));var util=require(_0x8a3e('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8a3e('0x8'));var fs=require('fs');var fs_extra=require(_0x8a3e('0x9'));var _=require(_0x8a3e('0xa'));var squel=require('squel');var crypto=require(_0x8a3e('0xb'));var jsforce=require(_0x8a3e('0xc'));var deskjs=require(_0x8a3e('0xd'));var toCsv=require(_0x8a3e('0xe'));var querystring=require(_0x8a3e('0xf'));var Papa=require(_0x8a3e('0x10'));var Redis=require(_0x8a3e('0x11'));var authService=require(_0x8a3e('0x12'));var qs=require(_0x8a3e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a3e('0x14'));var logger=require(_0x8a3e('0x15'))(_0x8a3e('0x16'));var utils=require('../../config/utils');var config=require(_0x8a3e('0x17'));var licenseUtil=require(_0x8a3e('0x18'));var db=require(_0x8a3e('0x19'))['db'];config[_0x8a3e('0x1a')]=_[_0x8a3e('0x1b')](config[_0x8a3e('0x1a')],{'host':_0x8a3e('0x1c'),'port':0x18eb});var socket=require(_0x8a3e('0x1d'))(new Redis(config[_0x8a3e('0x1a')]));require(_0x8a3e('0x1e'))[_0x8a3e('0x1f')](socket);function respondWithStatusCode(_0x2f6305,_0x333c51){_0x333c51=_0x333c51||0xcc;return function(_0x4d9a4c){if(_0x4d9a4c){return _0x2f6305[_0x8a3e('0x20')](_0x333c51);}return _0x2f6305[_0x8a3e('0x21')](_0x333c51)[_0x8a3e('0x22')]();};}function respondWithResult(_0xe302f3,_0x2f316e){_0x2f316e=_0x2f316e||0xc8;return function(_0x4cfba8){if(_0x4cfba8){return _0xe302f3['status'](_0x2f316e)[_0x8a3e('0x23')](_0x4cfba8);}};}function respondWithFilteredResult(_0x5aec3d,_0x49be9d){return function(_0x2f0b46){if(_0x2f0b46){var _0xb2f9c3=typeof _0x49be9d[_0x8a3e('0x24')]===_0x8a3e('0x25')&&typeof _0x49be9d[_0x8a3e('0x26')]===_0x8a3e('0x25');var _0x18bb0e=_0x2f0b46[_0x8a3e('0x27')];var _0x5f30ed=_0xb2f9c3?0x0:_0x49be9d[_0x8a3e('0x24')];var _0x4c25be=_0xb2f9c3?_0x2f0b46[_0x8a3e('0x27')]:_0x49be9d[_0x8a3e('0x24')]+_0x49be9d[_0x8a3e('0x26')];var _0x4a43c8;if(_0x4c25be>=_0x18bb0e){_0x4c25be=_0x18bb0e;_0x4a43c8=0xc8;}else{_0x4a43c8=0xce;}_0x5aec3d[_0x8a3e('0x21')](_0x4a43c8);return _0x5aec3d[_0x8a3e('0x28')]('Content-Range',_0x5f30ed+'-'+_0x4c25be+'/'+_0x18bb0e)[_0x8a3e('0x23')](_0x2f0b46);}return null;};}function patchUpdates(_0x34dc13){return function(_0x306632){try{jsonpatch[_0x8a3e('0x29')](_0x306632,_0x34dc13,!![]);}catch(_0x1cebd6){return BPromise[_0x8a3e('0x2a')](_0x1cebd6);}return _0x306632[_0x8a3e('0x2b')]();};}function saveUpdates(_0x422303,_0x328c45){return function(_0x36d365){if(_0x36d365){return _0x36d365[_0x8a3e('0x2c')](_0x422303)[_0x8a3e('0x2d')](function(_0x489015){return _0x489015;});}return null;};}function removeEntity(_0x1d34e5,_0x58195b){return function(_0x33322d){if(_0x33322d){return _0x33322d['destroy']()[_0x8a3e('0x2d')](function(){_0x1d34e5[_0x8a3e('0x21')](0xcc)[_0x8a3e('0x22')]();});}};}function handleEntityNotFound(_0x289318,_0x86eb3e){return function(_0x15c3ef){if(!_0x15c3ef){_0x289318[_0x8a3e('0x20')](0x194);}return _0x15c3ef;};}function handleError(_0x4f79d3,_0x1f8079){_0x1f8079=_0x1f8079||0x1f4;return function(_0x1c9a16){logger[_0x8a3e('0x2e')](_0x1c9a16[_0x8a3e('0x2f')]);if(_0x1c9a16[_0x8a3e('0x30')]){delete _0x1c9a16[_0x8a3e('0x30')];}_0x4f79d3[_0x8a3e('0x21')](_0x1f8079)['send'](_0x1c9a16);};}exports[_0x8a3e('0x31')]=function(_0x463efc,_0x1012b0){var _0xb21ef={},_0x9587fd={},_0x2ef24a={'count':0x0,'rows':[]};var _0x35ec0f=_[_0x8a3e('0x32')](db[_0x8a3e('0x33')][_0x8a3e('0x34')],function(_0xbd9410){return{'name':_0xbd9410[_0x8a3e('0x35')],'type':_0xbd9410[_0x8a3e('0x36')][_0x8a3e('0x37')]};});_0x9587fd[_0x8a3e('0x38')]=_['map'](_0x35ec0f,'name');_0x9587fd['query']=_[_0x8a3e('0x39')](_0x463efc[_0x8a3e('0x3a')]);_0x9587fd['filters']=_['intersection'](_0x9587fd[_0x8a3e('0x38')],_0x9587fd['query']);_0xb21ef['attributes']=_[_0x8a3e('0x3b')](_0x9587fd[_0x8a3e('0x38')],qs[_0x8a3e('0x3c')](_0x463efc[_0x8a3e('0x3a')][_0x8a3e('0x3c')]));_0xb21ef['attributes']=_0xb21ef[_0x8a3e('0x3d')][_0x8a3e('0x3e')]?_0xb21ef['attributes']:_0x9587fd[_0x8a3e('0x38')];if(!_0x463efc['query'][_0x8a3e('0x3f')](_0x8a3e('0x40'))){_0xb21ef[_0x8a3e('0x26')]=qs[_0x8a3e('0x26')](_0x463efc[_0x8a3e('0x3a')][_0x8a3e('0x26')]);_0xb21ef[_0x8a3e('0x24')]=qs[_0x8a3e('0x24')](_0x463efc['query'][_0x8a3e('0x24')]);}_0xb21ef[_0x8a3e('0x41')]=qs[_0x8a3e('0x42')](_0x463efc[_0x8a3e('0x3a')][_0x8a3e('0x42')]);_0xb21ef[_0x8a3e('0x43')]=qs['filters'](_[_0x8a3e('0x44')](_0x463efc[_0x8a3e('0x3a')],_0x9587fd[_0x8a3e('0x45')]),_0x35ec0f);if(_0x463efc[_0x8a3e('0x3a')]['filter']){_0xb21ef[_0x8a3e('0x43')]=_['merge'](_0xb21ef[_0x8a3e('0x43')],{'$or':_[_0x8a3e('0x32')](_0x35ec0f,function(_0x180ea2){if(_0x180ea2[_0x8a3e('0x36')]!==_0x8a3e('0x46')){var _0x100446={};_0x100446[_0x180ea2[_0x8a3e('0x30')]]={'$like':'%'+_0x463efc[_0x8a3e('0x3a')][_0x8a3e('0x47')]+'%'};return _0x100446;}})});}_0xb21ef=_[_0x8a3e('0x48')]({},_0xb21ef,_0x463efc['options']);var _0x5c5f85={'where':_0xb21ef[_0x8a3e('0x43')]};return db[_0x8a3e('0x33')]['count'](_0x5c5f85)[_0x8a3e('0x2d')](function(_0x1cf040){_0x2ef24a['count']=_0x1cf040;if(_0x463efc[_0x8a3e('0x3a')]['includeAll']){_0xb21ef['include']=[{'all':!![]}];}return db[_0x8a3e('0x33')]['findAll'](_0xb21ef);})['then'](function(_0x17cd6c){_0x2ef24a[_0x8a3e('0x49')]=_0x17cd6c;return _0x2ef24a;})['then'](respondWithFilteredResult(_0x1012b0,_0xb21ef))[_0x8a3e('0x4a')](handleError(_0x1012b0,null));};exports[_0x8a3e('0x4b')]=function(_0x5d40af,_0x22ea63){var _0x485fb5={'raw':![],'where':{'id':_0x5d40af[_0x8a3e('0x4c')]['id']}},_0x5ec137={};_0x5ec137[_0x8a3e('0x38')]=_[_0x8a3e('0x39')](db['UserProfile'][_0x8a3e('0x34')]);_0x5ec137[_0x8a3e('0x3a')]=_['keys'](_0x5d40af[_0x8a3e('0x3a')]);_0x5ec137[_0x8a3e('0x45')]=_['intersection'](_0x5ec137[_0x8a3e('0x38')],_0x5ec137[_0x8a3e('0x3a')]);_0x485fb5['attributes']=_['intersection'](_0x5ec137[_0x8a3e('0x38')],qs[_0x8a3e('0x3c')](_0x5d40af['query'][_0x8a3e('0x3c')]));_0x485fb5[_0x8a3e('0x3d')]=_0x485fb5[_0x8a3e('0x3d')][_0x8a3e('0x3e')]?_0x485fb5[_0x8a3e('0x3d')]:_0x5ec137['model'];if(_0x5d40af['query'][_0x8a3e('0x4d')]){_0x485fb5[_0x8a3e('0x4e')]=[{'all':!![]}];}_0x485fb5=_['merge']({},_0x485fb5,_0x5d40af[_0x8a3e('0x4f')]);return db['UserProfile'][_0x8a3e('0x50')](_0x485fb5)[_0x8a3e('0x2d')](handleEntityNotFound(_0x22ea63,null))['then'](respondWithResult(_0x22ea63,null))[_0x8a3e('0x4a')](handleError(_0x22ea63,null));};exports[_0x8a3e('0x51')]=function(_0x380b63,_0x12a86e){return db['UserProfile'][_0x8a3e('0x51')](_0x380b63['body'],{})[_0x8a3e('0x2d')](respondWithResult(_0x12a86e,0xc9))[_0x8a3e('0x4a')](handleError(_0x12a86e,null));};exports['clone']=function(_0x2fd323,_0x37eb08){var _0x28f217={'where':{'id':_0x2fd323[_0x8a3e('0x4c')]['id']}},_0x3ebe68={};_0x3ebe68['model']=_['keys'](db['UserProfile'][_0x8a3e('0x34')]);_0x28f217[_0x8a3e('0x3d')]=_['intersection'](_0x3ebe68[_0x8a3e('0x38')],qs[_0x8a3e('0x3c')](_0x2fd323[_0x8a3e('0x3a')]['fields']));_0x28f217['attributes']=_0x28f217[_0x8a3e('0x3d')]['length']?_0x28f217[_0x8a3e('0x3d')]:_0x3ebe68[_0x8a3e('0x38')];if(_0x2fd323['query'][_0x8a3e('0x4d')]){_0x28f217[_0x8a3e('0x4e')]=[{'all':!![]}];}_0x28f217=_[_0x8a3e('0x48')]({},_0x28f217,_0x2fd323[_0x8a3e('0x4f')]);return db[_0x8a3e('0x33')]['find'](_0x28f217)[_0x8a3e('0x2d')](handleEntityNotFound(_0x37eb08,null))[_0x8a3e('0x2d')](function(_0x105cb9){if(_0x105cb9){var _0x3acbc8=_0x105cb9[_0x8a3e('0x52')]({'plain':!![]});_0x3acbc8=qs[_0x8a3e('0x53')](_0x3acbc8,['id',_0x8a3e('0x54'),_0x8a3e('0x55'),_0x8a3e('0x56')]);_0x2fd323[_0x8a3e('0x57')]=_[_0x8a3e('0x53')](_0x2fd323[_0x8a3e('0x57')],['id',_0x8a3e('0x54'),_0x8a3e('0x55')]);return db[_0x8a3e('0x58')]['transaction'](function(_0x3db9f6){return db[_0x8a3e('0x33')][_0x8a3e('0x51')](_[_0x8a3e('0x48')](_0x3acbc8,_0x2fd323[_0x8a3e('0x57')]),{'include':_0x2fd323[_0x8a3e('0x3a')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x3db9f6})[_0x8a3e('0x2d')](function(_0x10073a){var _0x54c105=_0x10073a['get']({'plain':!![]});return db[_0x8a3e('0x59')][_0x8a3e('0x5a')]({'where':{'userProfileId':_0x2fd323[_0x8a3e('0x4c')]['id']},'raw':!![]})[_0x8a3e('0x2d')](function(_0x1ca373){if(_0x1ca373){return BPromise['each'](_0x1ca373,function(_0x520be1){return new BPromise(function(_0x11c3e3,_0x8a7c83){if(_0x520be1[_0x8a3e('0x5b')]===null||_0x520be1[_0x8a3e('0x5b')]===0x1)_0x11c3e3(null);return db[_0x8a3e('0x5c')][_0x8a3e('0x5a')]({'where':{'sectionId':_0x520be1['id']},'raw':!![]})['then'](function(_0x1d3d46){var _0x9202fb=_[_0x8a3e('0x32')](_0x1d3d46,function(_0x438c17){return qs[_0x8a3e('0x53')](_0x438c17,['id',_0x8a3e('0x54'),'updatedAt',_0x8a3e('0x5d')]);});_0x11c3e3(_0x9202fb);})[_0x8a3e('0x4a')](function(_0x17eed2){_0x8a7c83(_0x17eed2);});})['then'](function(_0x4724bd){var _0x1f845d=qs[_0x8a3e('0x53')](_0x520be1,['id',_0x8a3e('0x54'),_0x8a3e('0x55')]);_0x1f845d[_0x8a3e('0x5e')]=_0x54c105['id'];if(_0x4724bd)_0x1f845d[_0x8a3e('0x5f')]=_0x4724bd;return _0x1f845d;})[_0x8a3e('0x2d')](function(_0x3be636){return db['UserProfileSection']['create'](_0x3be636,{'include':[{'model':db[_0x8a3e('0x5c')],'as':_0x8a3e('0x5f')}],'raw':!![],'transaction':_0x3db9f6});});})[_0x8a3e('0x2d')](function(){return _0x54c105;});}});});});}})['then'](respondWithResult(_0x37eb08,0xc9))[_0x8a3e('0x4a')](handleError(_0x37eb08,null));};exports[_0x8a3e('0x2c')]=function(_0x161c33,_0x5c713a){if(_0x161c33['body']['id']){delete _0x161c33[_0x8a3e('0x57')]['id'];}return db['UserProfile'][_0x8a3e('0x50')]({'where':{'id':_0x161c33['params']['id']}})[_0x8a3e('0x2d')](handleEntityNotFound(_0x5c713a,null))['then'](saveUpdates(_0x161c33['body'],null))[_0x8a3e('0x2d')](respondWithResult(_0x5c713a,null))['catch'](handleError(_0x5c713a,null));};exports[_0x8a3e('0x60')]=function(_0x18d131,_0x3ecd38){return db[_0x8a3e('0x33')][_0x8a3e('0x50')]({'where':{'id':_0x18d131[_0x8a3e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3ecd38,null))['then'](removeEntity(_0x3ecd38,null))['catch'](handleError(_0x3ecd38,null));};exports[_0x8a3e('0x61')]=function(_0x370887,_0x468ff3){return db[_0x8a3e('0x33')]['describe']()[_0x8a3e('0x2d')](respondWithResult(_0x468ff3,null))['catch'](handleError(_0x468ff3,null));};exports[_0x8a3e('0x62')]=function(_0x1866e9,_0x425279){var _0x49080b=_0x1866e9[_0x8a3e('0x57')];return db[_0x8a3e('0x33')][_0x8a3e('0x50')]({'where':{'id':_0x1866e9[_0x8a3e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x425279,null))[_0x8a3e('0x2d')](function(_0x4a7561){if(_0x4a7561){return db[_0x8a3e('0x58')][_0x8a3e('0x63')](function(_0x223100){return db[_0x8a3e('0x59')][_0x8a3e('0x60')]({'where':{'userProfileId':_0x1866e9[_0x8a3e('0x4c')]['id'],'sectionId':_['map'](_0x49080b,function(_0x5d1094){return _0x5d1094[_0x8a3e('0x5d')];})},'transaction':_0x223100})[_0x8a3e('0x2d')](function(){var _0xd77af7=_[_0x8a3e('0x32')](_0x49080b,function(_0x301c06){_0x301c06['userProfileId']=_0x1866e9['params']['id'];return _0x301c06;});var _0x4df40f=[];return BPromise[_0x8a3e('0x64')](_0xd77af7,function(_0x53a593){return db[_0x8a3e('0x59')][_0x8a3e('0x51')](_0x53a593,{'include':[{'model':db[_0x8a3e('0x5c')],'as':_0x8a3e('0x5f')}],'raw':!![],'transaction':_0x223100})[_0x8a3e('0x2d')](function(_0x26ac52){_0x4df40f['push'](_0x26ac52['get']({'plain':!![]}));});})[_0x8a3e('0x2d')](function(){return _0x4df40f;});});});}})['then'](function(_0x4e7f48){return _0x4e7f48;})[_0x8a3e('0x2d')](respondWithResult(_0x425279,null))[_0x8a3e('0x4a')](handleError(_0x425279,null));};exports[_0x8a3e('0x65')]=function(_0x20c53b,_0x4daf56){var _0x4552d8;return db['UserProfile'][_0x8a3e('0x50')]({'where':{'id':_0x20c53b[_0x8a3e('0x4c')]['id']},'attributes':['id',_0x8a3e('0x30')]})[_0x8a3e('0x2d')](handleEntityNotFound(_0x4daf56,null))['then'](function(_0x2a900b){if(_0x2a900b){_0x4552d8=_0x2a900b;return db[_0x8a3e('0x59')][_0x8a3e('0x60')]({'where':{'userProfileId':_0x20c53b[_0x8a3e('0x4c')]['id'],'sectionId':_0x20c53b['query'][_0x8a3e('0x66')]}});}})[_0x8a3e('0x2d')](function(){return _0x4552d8;})['then'](respondWithStatusCode(_0x4daf56,null))[_0x8a3e('0x4a')](handleError(_0x4daf56,null));};exports[_0x8a3e('0x67')]=function(_0x33d7cb,_0xe28823){var _0x372602=[];var _0x2bfdf3=[];return db[_0x8a3e('0x59')][_0x8a3e('0x5a')]({'where':{'userProfileId':_0x33d7cb[_0x8a3e('0x4c')]['id']},'raw':!![]})[_0x8a3e('0x2d')](function(_0x2f6a55){_0x372602=_[_0x8a3e('0x47')](_0x2f6a55,function(_0x446ecc){return _0x446ecc[_0x8a3e('0x68')]===0x1||_[_0x8a3e('0x69')]([0x3eb,0x709],_0x446ecc[_0x8a3e('0x5d')]);});if(!_[_0x8a3e('0x6a')](_0x372602)){return _['map'](_0x372602,function(_0x5ca364){return _0x5ca364[_0x8a3e('0x5d')];});}else{return;}})['then'](function(_0x5713cc){if(_0x5713cc)_0x2bfdf3=_0x5713cc;if(_[_0x8a3e('0x69')](_0x2bfdf3,0x64)){var _0xf3f70d=_[_0x8a3e('0x50')](_0x372602,{'sectionId':0x64});return hasDefaultDashboard(_0xf3f70d)[_0x8a3e('0x2d')](function(_0x4aea68){return _[_0x8a3e('0x32')](_0x372602,function(_0x30bd8b){if(_0x30bd8b['sectionId']===0x64){_0x30bd8b[_0x8a3e('0x6b')]=_0x4aea68;}return _0x30bd8b;});});}else{return;}})['then'](function(_0x169aa1){if(_0x169aa1)_0x372602=_0x169aa1;if(_[_0x8a3e('0x69')](_0x2bfdf3,0x3eb)){var _0x94746b=_[_0x8a3e('0x50')](_0x372602,{'sectionId':0x3eb});return getCustomDashboards(_0x94746b)[_0x8a3e('0x2d')](function(_0x91e548){return _[_0x8a3e('0x32')](_0x372602,function(_0x348955){if(_0x94746b['enabled']){if(_0x348955[_0x8a3e('0x5d')]===0x3eb){_0x348955[_0x8a3e('0x6b')]=_0x91e548;}}else{if(_0x348955['sectionId']===0x64){_0x348955[_0x8a3e('0x6b')]=_0x91e548;}}return _0x348955;});});}else{return;}})[_0x8a3e('0x2d')](function(_0x46de23){if(_0x46de23)_0x372602=_0x46de23;if(_['includes'](_0x2bfdf3,0x709)){var _0x4b4573=_[_0x8a3e('0x50')](_0x372602,{'sectionId':0x709});return getPlugins(_0x4b4573)[_0x8a3e('0x2d')](function(_0x31f8dc){if(_0x4b4573['enabled']){return _[_0x8a3e('0x32')](_0x372602,function(_0x41cf47){if(_0x41cf47[_0x8a3e('0x5d')]===0x709){_0x41cf47[_0x8a3e('0x6b')]=_0x31f8dc;}return _0x41cf47;});}else{var _0x57abb1={'sectionId':0x76c,'enabled':0x1,'subsections':_0x31f8dc};var _0x38f001=_[_0x8a3e('0x32')](_0x372602);_0x38f001[_0x8a3e('0x6c')](_0x57abb1);return _0x38f001;}});}else{return;}})['then'](function(_0x45e6c5){if(_0x45e6c5)_0x372602=_0x45e6c5;return _['filter'](_0x372602,['enabled',0x1]);})[_0x8a3e('0x2d')](respondWithResult(_0xe28823,null))[_0x8a3e('0x4a')](handleError(_0xe28823,null));};function hasDefaultDashboard(_0x180087){var _0x1ed1b0=[0x65];return new BPromise(function(_0x1fc726,_0x58a2e3){try{if(_0x180087['autoAssociation']){_0x1fc726(_0x1ed1b0);}else{return db[_0x8a3e('0x5c')]['findOne']({'where':{'sectionId':_0x180087['id']},'raw':!![]})[_0x8a3e('0x2d')](function(_0x261e7d){_0x261e7d?_0x1fc726(_0x1ed1b0):_0x1fc726();});}}catch(_0x246ca0){_0x58a2e3(_0x246ca0);}});}function getCustomDashboards(_0x4a6158){var _0x119dfd=[];return new BPromise(function(_0xb683f3,_0x1990b4){try{if(_0x4a6158[_0x8a3e('0x5b')]){return db[_0x8a3e('0x6d')][_0x8a3e('0x5a')]({'raw':!![]})[_0x8a3e('0x2d')](function(_0x791f33){_0x791f33[_0x8a3e('0x6e')](function(_0x161fd9){_0x119dfd[_0x8a3e('0x6c')](_0x161fd9['id']+0x1869f);});_0xb683f3(_0x119dfd);});}else{return db['UserProfileResource'][_0x8a3e('0x5a')]({'where':{'sectionId':_0x4a6158['id']},'raw':!![]})[_0x8a3e('0x2d')](function(_0x4b5ed9){_0x4b5ed9['forEach'](function(_0x150b61){_0x119dfd[_0x8a3e('0x6c')](_0x150b61[_0x8a3e('0x6f')]+0x1869f);});_0xb683f3(_0x119dfd);});}}catch(_0x29b5ff){_0x1990b4(_0x29b5ff);}});}function getPlugins(_0x586a5f){var _0x24af9d=[];return new BPromise(function(_0x36e7cf,_0x3001b3){try{if(_0x586a5f[_0x8a3e('0x5b')]){return db[_0x8a3e('0x70')][_0x8a3e('0x5a')]({'raw':!![]})['then'](function(_0x598489){_0x598489[_0x8a3e('0x6e')](function(_0x728d3f){_0x24af9d[_0x8a3e('0x6c')](_0x728d3f['id']+0x15b38);});_0x36e7cf(_0x24af9d);});}else{return db[_0x8a3e('0x5c')]['findAll']({'where':{'sectionId':_0x586a5f['id']},'raw':!![]})[_0x8a3e('0x2d')](function(_0xfa2395){_0xfa2395[_0x8a3e('0x6e')](function(_0x3204d5){_0x24af9d[_0x8a3e('0x6c')](_0x3204d5[_0x8a3e('0x6f')]+0x15b38);});_0x36e7cf(_0x24af9d);});}}catch(_0x17525e){_0x3001b3(_0x17525e);}});}exports[_0x8a3e('0x71')]=function(_0xa7fcbe,_0x1b8bcf){return db[_0x8a3e('0x33')][_0x8a3e('0x50')]({'where':{'id':_0xa7fcbe[_0x8a3e('0x4c')]['id']}})[_0x8a3e('0x2d')](handleEntityNotFound(_0x1b8bcf,null))[_0x8a3e('0x2d')](function(_0x22fe4e){if(_0x22fe4e){return db['sequelize'][_0x8a3e('0x63')](function(_0x2ed6f9){return db[_0x8a3e('0x59')][_0x8a3e('0x5a')]({'where':{'userProfileId':_0xa7fcbe[_0x8a3e('0x4c')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x4a6680){if(_0x4a6680){return db[_0x8a3e('0x59')][_0x8a3e('0x60')]({'where':{'userProfileId':_0xa7fcbe[_0x8a3e('0x4c')]['id'],'id':_[_0x8a3e('0x32')](_0x4a6680,function(_0x457d5d){return _0x457d5d['id'];})},'transaction':_0x2ed6f9});}})['then'](function(_0x51bf05){var _0x2b122f=_[_0x8a3e('0x32')](_0xa7fcbe[_0x8a3e('0x57')],function(_0x12769c){_0x12769c[_0x8a3e('0x5e')]=_0xa7fcbe[_0x8a3e('0x4c')]['id'];return _0x12769c;});return db[_0x8a3e('0x59')][_0x8a3e('0x72')](_0x2b122f,{'raw':!![],'transaction':_0x2ed6f9});})[_0x8a3e('0x2d')](function(_0x26377b){var _0x3ba18e=_[_0x8a3e('0x47')](_['map'](_0x26377b,function(_0x26d1c4){return _0x26d1c4['get']({'plain':!![]});}),{'includeAll':![]});if(_0x3ba18e){return db[_0x8a3e('0x59')]['findAll']({'where':{'userProfileId':_0xa7fcbe[_0x8a3e('0x4c')]['id'],'sectionId':_[_0x8a3e('0x32')](_0x3ba18e,function(_0x17f100){return _0x17f100[_0x8a3e('0x5d')];})},'attributes':['id',_0x8a3e('0x5d')],'raw':!![]})[_0x8a3e('0x2d')](function(_0xaaf8d4){var _0x47ed32=_[_0x8a3e('0x32')](_0xa7fcbe[_0x8a3e('0x57')],function(_0x50146f){_0x50146f[_0x8a3e('0x5e')]=_0xa7fcbe[_0x8a3e('0x4c')]['id'];return _0x50146f;});return db['UserProfileResource']['bulkCreate'](_0x47ed32,{'raw':!![],'transaction':_0x2ed6f9});});}})[_0x8a3e('0x4a')](handleError(_0x1b8bcf,null));});}})[_0x8a3e('0x2d')](function(_0x467f3e){var _0x5088e6=_[_0x8a3e('0x32')](_0x467f3e,function(_0x40e4a5){return _0x40e4a5[_0x8a3e('0x52')]({'plain':!![]});});})[_0x8a3e('0x2d')](respondWithResult(_0x1b8bcf,null))[_0x8a3e('0x4a')](handleError(_0x1b8bcf,null));};exports[_0x8a3e('0x73')]=function(_0x1c6dad,_0x34f345,_0x345ab6){return db[_0x8a3e('0x33')][_0x8a3e('0x50')]({'where':{'id':_0x1c6dad[_0x8a3e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x34f345,null))[_0x8a3e('0x2d')](function(_0x3852ba){if(_0x3852ba){return _0x3852ba[_0x8a3e('0x73')](_0x1c6dad['query'][_0x8a3e('0x66')]);}})[_0x8a3e('0x2d')](respondWithStatusCode(_0x34f345,null))[_0x8a3e('0x4a')](handleError(_0x34f345,null));};exports['getResources']=function(_0x518788,_0x123db1){var _0x4bbdb2={};if(!_0x518788[_0x8a3e('0x3a')][_0x8a3e('0x74')])throw new Error(_0x8a3e('0x75'));if(!_0x518788[_0x8a3e('0x3a')][_0x8a3e('0x3f')](_0x8a3e('0x40'))){_0x4bbdb2[_0x8a3e('0x26')]=qs[_0x8a3e('0x26')](_0x518788[_0x8a3e('0x3a')][_0x8a3e('0x26')]);_0x4bbdb2['offset']=qs[_0x8a3e('0x24')](_0x518788[_0x8a3e('0x3a')][_0x8a3e('0x24')]);}return db['UserProfile'][_0x8a3e('0x50')]({'where':{'id':_0x518788[_0x8a3e('0x4c')]['id']}})[_0x8a3e('0x2d')](function(_0x440e86){if(!_0x440e86)throw new Error(_0x8a3e('0x76')+_0x518788[_0x8a3e('0x4c')]['id']);return db[_0x8a3e('0x33')][_0x8a3e('0x77')](_0x518788);})['then'](respondWithFilteredResult(_0x123db1,_0x4bbdb2))[_0x8a3e('0x4a')](handleError(_0x123db1,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 7952f46..8b169ad 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 _0x6003=['../../mysqldb','UserProfile','setMaxListeners','remove','emit','hasOwnProperty','events'];(function(_0x1089d6,_0x50a76d){var _0x4ed7e5=function(_0x154602){while(--_0x154602){_0x1089d6['push'](_0x1089d6['shift']());}};_0x4ed7e5(++_0x50a76d);}(_0x6003,0xae));var _0x3600=function(_0x561aae,_0x303eea){_0x561aae=_0x561aae-0x0;var _0x2a7844=_0x6003[_0x561aae];return _0x2a7844;};'use strict';var EventEmitter=require(_0x3600('0x0'));var UserProfile=require(_0x3600('0x1'))['db'][_0x3600('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x3600('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x3600('0x4')};function emitEvent(_0x3fb36b){return function(_0x29c0fd,_0x47b8b3,_0x29fadd){UserProfileEvents[_0x3600('0x5')](_0x3fb36b+':'+_0x29c0fd['id'],_0x29c0fd);UserProfileEvents['emit'](_0x3fb36b,_0x29c0fd);_0x29fadd(null);};}for(var e in events){if(events[_0x3600('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x7524=['emit','hasOwnProperty','hook','../../mysqldb','UserProfile','save','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7524,0xce));var _0x4752=function(_0x22b501,_0x5223a5){_0x22b501=_0x22b501-0x0;var _0x5e74db=_0x7524[_0x22b501];return _0x5e74db;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x4752('0x0'))['db'][_0x4752('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4752('0x2'),'afterUpdate':_0x4752('0x3'),'afterDestroy':'remove'};function emitEvent(_0x599e2b){return function(_0x3eae1a,_0x4d5e05,_0x3884b9){UserProfileEvents[_0x4752('0x4')](_0x599e2b+':'+_0x3eae1a['id'],_0x3eae1a);UserProfileEvents[_0x4752('0x4')](_0x599e2b,_0x3eae1a);_0x3884b9(null);};}for(var e in events){if(events[_0x4752('0x5')](e)){var event=events[e];UserProfile[_0x4752('0x6')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index cd7cf4e..86f7876 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 _0xf119=['SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','scheduler','Schedule','sounds','Sound','tags','Tag','templates','Template','Trigger','trunks','variables','Variable','plugins','Plugin','extractedreports','reportId','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','from','user_has_','where','sequelize','OpenTabs','define','UserProfile','user_profiles','raw','query','section','isEmpty','length','push','UserProfileSection','find','params','ignore','union','autoAssociation','all','rawAttributes','keys','filters','intersection','attributes','fields','nolimit','limit','offset','order','sort','pick','merge','foreignKey','forEach','includeAll','include','reportType','default','DefaultReports','CustomReports','count','rows','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','then','associatedResources','map','catch','model','name','resolve','UserProfileResource','findAll','field','AnalyticExtractedReport','resourceId','type','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','parentSections','Lists','lists','CmList','companies','globalcustomfields','chatqueues','ChatWebsite','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','role','agent','Telephones','User','telephone','queue','VoiceQueue','QueueCampaigns','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','mailaccounts','MailAccount','mailsubstatuses','openchannelaccounts','smsqueues','SmsAccount','whatsappqueues','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','admin','user','ZendeskAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf119,0x121));var _0x9f11=function(_0xec9aff,_0x27d168){_0xec9aff=_0xec9aff-0x0;var _0x4626de=_0xf119[_0xec9aff];return _0x4626de;};'use strict';var _=require(_0x9f11('0x0'));var attributes=require(_0x9f11('0x1'));var qs=require(_0x9f11('0x2'));var squel=require(_0x9f11('0x3'));module[_0x9f11('0x4')]=function(_0x2fadbd){var _0xba6710=_0x2fadbd[_0x9f11('0x5')];function _0x199bf5(_0x1fb7c8,_0x309d0e){return new Promise(function(_0x4d0a21,_0x4ab7e1){if(!_0x309d0e)return _0x4d0a21(null);var _0x53870e=_0x309d0e['filter']?{[_0x309d0e[_0x9f11('0x6')]['field']]:_0x309d0e[_0x9f11('0x6')]['value']}:undefined;return _0xba6710[_0x1fb7c8]['findAll']({'where':_0x53870e,'raw':!![]})[_0x9f11('0x7')](function(_0x400ad2){_0x309d0e[_0x9f11('0x8')]=_[_0x9f11('0x9')](_0x400ad2,'id');_0x4d0a21(_0x309d0e);})[_0x9f11('0xa')](function(_0x1d9b9b){_0x4ab7e1(_0x1d9b9b);});});}function _0x2b851b(_0x3ca6c6,_0x230785){return new Promise(function(_0x2bb931,_0x1de7a6){var _0x4cb5ca=_0x3ca6c6[_0x9f11('0x6')]?{[_0x3ca6c6[_0x9f11('0x6')]['field']]:_0x3ca6c6['filter']['value']}:undefined;return _0xba6710[_0x3ca6c6[_0x9f11('0xb')]]['findAll']({'where':_0x4cb5ca,'raw':!![]})[_0x9f11('0x7')](function(_0x1f88c8){_0x230785[_0x9f11('0x8')]=_[_0x9f11('0x9')](_0x1f88c8,function(_0x443784){return _0x443784[_0x9f11('0xc')];});_0x2bb931(_0x230785);})[_0x9f11('0xa')](function(_0x2e72da){_0x1de7a6(_0x2e72da);});});}function _0xce9880(_0x27c060,_0x316cea,_0x1e5b3f){if(!_0x316cea)return Promise[_0x9f11('0xd')](null);return new Promise(function(_0x2025e0,_0x154b9a){return _0xba6710[_0x9f11('0xe')][_0x9f11('0xf')]({'where':{'sectionId':_0x316cea['id']},'raw':!![]})['then'](function(_0x502ce7){if(_0x27c060[_0x9f11('0x10')]&&_0x27c060['field']!=='id'){_0x316cea[_0x9f11('0x8')]=_[_0x9f11('0x9')](_0x502ce7,function(_0x749e92){return _0x749e92[_0x27c060[_0x9f11('0x10')]];});}else{if(_0x1e5b3f===_0x9f11('0x11')){_0x316cea[_0x9f11('0x8')]=_[_0x9f11('0x9')](_0x502ce7,function(_0x24d105){return{'id':_0x24d105[_0x9f11('0x12')],'type':_0x24d105[_0x9f11('0x13')]};});}else{_0x316cea[_0x9f11('0x8')]=_[_0x9f11('0x9')](_0x502ce7,function(_0x1815c6){return _0x1815c6[_0x9f11('0x12')];});}}_0x2025e0(_0x316cea);})[_0x9f11('0xa')](function(_0x4fdc2f){_0x154b9a(_0x4fdc2f);});});}function _0x44f999(_0x35c26e,_0x2e1e61){var _0x1b1265={'parentSections':[]};switch(_0x35c26e['toLowerCase']()){case _0x9f11('0x14'):_0x1b1265[_0x9f11('0x15')]=_0x9f11('0x16');break;case _0x9f11('0x17'):_0x1b1265[_0x9f11('0x15')]=_0x9f11('0x18');break;case _0x9f11('0x19'):_0x1b1265[_0x9f11('0x15')]=_0x9f11('0x1a');_0x1b1265['parentSections']=[{'name':_0x9f11('0x1b'),'field':'name','foreignKey':_0x9f11('0x1c')}];break;case _0x9f11('0x1d'):_0x1b1265['childModel']=_0x9f11('0x1e');break;case _0x9f11('0x1f'):_0x1b1265[_0x9f11('0x15')]=_0x9f11('0x20');_0x1b1265[_0x9f11('0x21')]=[{'name':_0x9f11('0x22'),'field':'id','foreignKey':'ListId'}];break;case _0x9f11('0x23'):_0x1b1265['childModel']=_0x9f11('0x24');break;case _0x9f11('0x25'):_0x1b1265[_0x9f11('0x15')]='CmCompany';break;case _0x9f11('0x26'):_0x1b1265[_0x9f11('0x15')]='CmCustomField';break;case _0x9f11('0x27'):_0x1b1265['childModel']='ChatQueue';break;case'chatwebsites':_0x1b1265[_0x9f11('0x15')]=_0x9f11('0x28');break;case'faxqueues':_0x1b1265[_0x9f11('0x15')]='FaxQueue';break;case _0x9f11('0x29'):_0x1b1265['childModel']=_0x9f11('0x2a');break;case _0x9f11('0x2b'):case _0x9f11('0x2c'):case _0x9f11('0x2d'):_0x1b1265[_0x9f11('0x15')]=_0x9f11('0x2e');break;case _0x9f11('0x2f'):_0x1b1265[_0x9f11('0x15')]='VoiceContext';break;case'voicemails':_0x1b1265['childModel']=_0x9f11('0x30');break;case _0x9f11('0x31'):_0x1b1265[_0x9f11('0x15')]=_0x9f11('0x32');_0x1b1265[_0x9f11('0x21')]=[{'name':_0x9f11('0x33'),'field':_0x9f11('0xc'),'foreignKey':_0x9f11('0x34'),'model':'User','filter':{'field':_0x9f11('0x35'),'value':[_0x9f11('0x36')]}},{'name':_0x9f11('0x37'),'field':'name','foreignKey':'membername','model':_0x9f11('0x38'),'filter':{'field':_0x9f11('0x35'),'value':[_0x9f11('0x39')]}},{'name':'VoiceQueues','field':_0x9f11('0xc'),'foreignKey':_0x9f11('0x3a'),'model':_0x9f11('0x3b'),'filter':{'field':_0x9f11('0x13'),'value':['inbound']}},{'name':_0x9f11('0x3c'),'field':_0x9f11('0xc'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0x9f11('0x13'),'value':[_0x9f11('0x3d')]}}];break;case'musiconholds':_0x1b1265['childModel']=_0x9f11('0x3e');break;case _0x9f11('0x3f'):_0x1b1265[_0x9f11('0x15')]=_0x9f11('0x40');break;case _0x9f11('0x41'):_0x1b1265[_0x9f11('0x15')]=_0x9f11('0x42');break;case _0x9f11('0x43'):_0x1b1265[_0x9f11('0x15')]='Campaign';break;case'mailqueues':_0x1b1265[_0x9f11('0x15')]='MailQueue';break;case _0x9f11('0x44'):_0x1b1265[_0x9f11('0x15')]=_0x9f11('0x45');break;case _0x9f11('0x46'):_0x1b1265[_0x9f11('0x15')]='MailSubstatus';break;case'openchannelqueues':_0x1b1265[_0x9f11('0x15')]='OpenchannelQueue';break;case _0x9f11('0x47'):_0x1b1265[_0x9f11('0x15')]='OpenchannelAccount';break;case _0x9f11('0x48'):_0x1b1265[_0x9f11('0x15')]='SmsQueue';break;case'smsaccounts':_0x1b1265[_0x9f11('0x15')]=_0x9f11('0x49');break;case _0x9f11('0x4a'):_0x1b1265[_0x9f11('0x15')]='WhatsappQueue';break;case _0x9f11('0x4b'):_0x1b1265[_0x9f11('0x15')]=_0x9f11('0x4c');break;case _0x9f11('0x4d'):_0x1b1265[_0x9f11('0x15')]=_0x9f11('0x4e');break;case _0x9f11('0x4f'):case _0x9f11('0x50'):_0x1b1265[_0x9f11('0x15')]=_0x9f11('0x3b');if(_0x2e1e61){_0x1b1265['parentSections']=[{'name':'VoiceQueues'},{'name':_0x9f11('0x3c')}];}break;case _0x9f11('0x51'):case _0x9f11('0x52'):case _0x9f11('0x53'):_0x1b1265[_0x9f11('0x15')]=_0x9f11('0x38');if(_0x2e1e61){_0x1b1265['parentSections']=[{'name':'Users','filter':{'field':_0x9f11('0x35'),'value':[_0x9f11('0x54'),_0x9f11('0x55')]},'ignore':!![]},{'name':_0x9f11('0x33')},{'name':_0x9f11('0x37')}];}break;case'zendeskaccounts':_0x1b1265['childModel']=_0x9f11('0x56');break;case'salesforceaccounts':_0x1b1265[_0x9f11('0x15')]=_0x9f11('0x57');break;case _0x9f11('0x58'):_0x1b1265[_0x9f11('0x15')]=_0x9f11('0x59');break;case _0x9f11('0x5a'):_0x1b1265[_0x9f11('0x15')]=_0x9f11('0x5b');break;case _0x9f11('0x5c'):_0x1b1265[_0x9f11('0x15')]=_0x9f11('0x5d');break;case _0x9f11('0x5e'):_0x1b1265['childModel']=_0x9f11('0x5f');break;case _0x9f11('0x60'):_0x1b1265['childModel']=_0x9f11('0x38');break;case _0x9f11('0x61'):_0x1b1265['childModel']='CannedAnswer';break;case _0x9f11('0x62'):_0x1b1265[_0x9f11('0x15')]=_0x9f11('0x63');break;case _0x9f11('0x64'):_0x1b1265['childModel']=_0x9f11('0x65');break;case _0x9f11('0x66'):_0x1b1265[_0x9f11('0x15')]=_0x9f11('0x67');break;case _0x9f11('0x68'):_0x1b1265[_0x9f11('0x15')]='Pause';break;case _0x9f11('0x69'):_0x1b1265['childModel']=_0x9f11('0x6a');break;case _0x9f11('0x6b'):_0x1b1265[_0x9f11('0x15')]=_0x9f11('0x6c');break;case _0x9f11('0x6d'):_0x1b1265[_0x9f11('0x15')]=_0x9f11('0x6e');break;case _0x9f11('0x6f'):_0x1b1265['childModel']=_0x9f11('0x70');break;case'triggers':_0x1b1265[_0x9f11('0x15')]=_0x9f11('0x71');break;case _0x9f11('0x72'):_0x1b1265[_0x9f11('0x15')]='Trunk';break;case _0x9f11('0x73'):_0x1b1265[_0x9f11('0x15')]=_0x9f11('0x74');break;case _0x9f11('0x75'):_0x1b1265[_0x9f11('0x15')]=_0x9f11('0x76');break;case _0x9f11('0x77'):_0x1b1265['childModel']=_0x9f11('0x11');_0x1b1265[_0x9f11('0x21')]=[{'name':'Reports','field':'id','foreignKey':_0x9f11('0x78')}];break;case'metrics':_0x1b1265[_0x9f11('0x15')]=_0x9f11('0x79');break;}return _0x1b1265;}function _0x5a0f20(_0x46c69a,_0x5520be){var _0x524485=_0x46c69a[_0x9f11('0x7a')](0x0)[_0x9f11('0x7b')]()+_0x46c69a[_0x9f11('0x7c')](0x1);var _0x4bd504={'type':_0xba6710[_0x9f11('0x7d')][_0x9f11('0x7e')][_0x9f11('0x7f')],'raw':!![]};return new Promise(function(_0x2395ac,_0x4f2ce1){var _0x258ed8=squel[_0x9f11('0x80')]()['field'](_0x9f11('0x81')+_0x524485+_0x9f11('0x82'),'id')['field']('ui.createdAt')[_0x9f11('0x83')](_0x9f11('0x84')+_0x46c69a+'_interactions','ui')[_0x9f11('0x85')]('ui.UserId\x20=\x20?',_0x5520be['id']);return _0xba6710[_0x9f11('0x86')]['query'](_0x258ed8['toString'](),_0x4bd504)[_0x9f11('0x7')](function(_0x1f7fa1){_0x5520be[_0x524485+_0x9f11('0x87')]=_0x1f7fa1;_0x2395ac(_0x1f7fa1);})['catch'](function(_0x3df91f){_0x4f2ce1(_0x3df91f);});});}return _0x2fadbd[_0x9f11('0x88')](_0x9f11('0x89'),attributes,{'tableName':_0x9f11('0x8a'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1a4bdc){var _0x49977c={'raw':_0x1a4bdc['query'][_0x9f11('0x8b')],'where':{}};var _0x88cf0c={};var _0xc74638={'count':0x0,'rows':[]};var _0x4bfb4b=_0x1a4bdc[_0x9f11('0x8c')][_0x9f11('0x8d')];var _0xe05b67=_0x1a4bdc['query']['mergeResources']||![];var _0x38fe8f=_0x44f999(_0x4bfb4b,_0xe05b67);if(!_0x38fe8f['childModel'])throw new Error('Invalid\x20section\x20\x27'+_0x4bfb4b+'\x27');var _0x2ef773=[{'name':_0x4bfb4b}];if(!_[_0x9f11('0x8e')](_0x38fe8f[_0x9f11('0x21')]))_0x2ef773=_0x38fe8f[_0x9f11('0x21')];var _0x23aabb=[];for(var _0x565cb4=0x0;_0x565cb4<_0x2ef773[_0x9f11('0x8f')];_0x565cb4++){_0x23aabb[_0x9f11('0x90')](_0xba6710[_0x9f11('0x91')][_0x9f11('0x92')]({'where':{'userProfileId':_0x1a4bdc[_0x9f11('0x93')]['id'],'name':_0x2ef773[_0x565cb4]['name']},'raw':!![]}));}return Promise['all'](_0x23aabb)[_0x9f11('0x7')](function(_0x46f33c){var _0x250321=_[_0x9f11('0x6')](_0x46f33c,function(_0x1184ef){return _0x1184ef?_0x1184ef:undefined;});var _0x13888a=_[_0x9f11('0x6')](_0x2ef773,[_0x9f11('0x94'),!![]]);var _0x4d1fd9=_[_0x9f11('0x8e')](_0x250321)&&_[_0x9f11('0x8e')](_0x13888a)?null:_[_0x9f11('0x95')](_0x13888a,_0x250321);if(!_0x4d1fd9)return null;var _0x14811c=[];for(var _0x118358=0x0;_0x118358<_0x4d1fd9[_0x9f11('0x8f')];_0x118358++){var _0x115391=_[_0x9f11('0x92')](_0x2ef773,function(_0x1ebb96){return _0x4d1fd9[_0x118358]?_0x1ebb96['name']===_0x4d1fd9[_0x118358][_0x9f11('0xc')]:null;});if(_0x115391){if(_0x4d1fd9[_0x118358]['ignore']){_0x14811c[_0x9f11('0x90')](_0x199bf5(_0x38fe8f[_0x9f11('0x15')],_0x4d1fd9[_0x118358]));}else{if(!_0x4d1fd9[_0x118358][_0x9f11('0x96')]){_0x14811c[_0x9f11('0x90')](_0xce9880(_0x115391,_0x4d1fd9[_0x118358],_0x38fe8f[_0x9f11('0x15')]));}else{if(_0x115391[_0x9f11('0xb')]){_0x14811c['push'](_0x2b851b(_0x115391,_0x4d1fd9[_0x118358]));}}}}}return Promise[_0x9f11('0x97')](_0x14811c);})[_0x9f11('0x7')](function(_0x585a7a){var _0x1cacd3=_0x585a7a;var _0x10397b=null;if(_0x1cacd3){_0x10397b=_0x1cacd3[_0x9f11('0x8f')]===0x1?_0x1cacd3[0x0]:null;}if(!_0x10397b&&!_0x1cacd3)return _0xc74638;var _0x507a0a=_0xba6710[_0x38fe8f['childModel']][_0x9f11('0x98')];_0x88cf0c[_0x9f11('0xb')]=_[_0x9f11('0x99')](_0x507a0a);_0x88cf0c[_0x9f11('0x8c')]=_[_0x9f11('0x99')](_0x1a4bdc['query']);_0x88cf0c[_0x9f11('0x9a')]=_[_0x9f11('0x9b')](_0x88cf0c[_0x9f11('0xb')],_0x88cf0c[_0x9f11('0x8c')]);_0x49977c[_0x9f11('0x9c')]=_[_0x9f11('0x9b')](_0x88cf0c[_0x9f11('0xb')],qs[_0x9f11('0x9d')](_0x1a4bdc['query'][_0x9f11('0x9d')]));_0x49977c['attributes']=_0x49977c[_0x9f11('0x9c')][_0x9f11('0x8f')]?_0x49977c['attributes']:_0x88cf0c['model'];if(!_0x1a4bdc[_0x9f11('0x8c')]['hasOwnProperty'](_0x9f11('0x9e'))){_0x49977c['limit']=qs[_0x9f11('0x9f')](_0x1a4bdc[_0x9f11('0x8c')][_0x9f11('0x9f')]);_0x49977c['offset']=qs[_0x9f11('0xa0')](_0x1a4bdc[_0x9f11('0x8c')][_0x9f11('0xa0')]);}_0x49977c[_0x9f11('0xa1')]=qs[_0x9f11('0xa2')](_0x1a4bdc[_0x9f11('0x8c')][_0x9f11('0xa2')]);_0x49977c[_0x9f11('0x85')]=qs[_0x9f11('0x9a')](_[_0x9f11('0xa3')](_0x1a4bdc[_0x9f11('0x8c')],_0x88cf0c[_0x9f11('0x9a')]));if(_0x1a4bdc[_0x9f11('0x8c')]['filter']){_0x49977c[_0x9f11('0x85')]=_[_0x9f11('0xa4')](_0x49977c[_0x9f11('0x85')],{'$or':_[_0x9f11('0x9')](_0x507a0a,function(_0x268b20){if(_0x268b20[_0x9f11('0x13')]['key']!=='VIRTUAL'){var _0xfa6d76={};_0xfa6d76[_0x268b20[_0x9f11('0x10')]]={'$like':'%'+_0x1a4bdc[_0x9f11('0x8c')][_0x9f11('0x6')]+'%'};return _0xfa6d76;}})});}var _0x2a85ab=[];var _0xf4e04b=null;var _0x1115a4={};if(_0x10397b){_0xf4e04b=_[_0x9f11('0x92')](_0x2ef773,[_0x9f11('0xc'),_0x10397b[_0x9f11('0xc')]]);if(_0xf4e04b[_0x9f11('0x10')]){_0x1115a4={};if(_0x38fe8f[_0x9f11('0x15')]===_0x9f11('0x11')){_0x1115a4[_0xf4e04b['foreignKey']]=_[_0x9f11('0x9')](_0x10397b[_0x9f11('0x8')],'id');}else{_0x1115a4[_0xf4e04b[_0x9f11('0xa5')]]=_0x10397b[_0x9f11('0x8')];}_0x2a85ab[_0x9f11('0x90')](_0x1115a4);}else{_0x49977c[_0x9f11('0x85')]['id']=_0x10397b['associatedResources'];}}else{for(var _0xdc2df0=0x0;_0xdc2df0<_0x1cacd3[_0x9f11('0x8f')];_0xdc2df0++){_0xf4e04b=_['find'](_0x2ef773,['name',_0x1cacd3[_0xdc2df0]['name']]);if(_0xf4e04b[_0x9f11('0x10')]){_0x1115a4={};_0x1115a4[_0xf4e04b[_0x9f11('0xa5')]]=_0x1cacd3[_0xdc2df0][_0x9f11('0x8')];_0x2a85ab[_0x9f11('0x90')](_0x1115a4);}else{if(!_0x49977c[_0x9f11('0x85')]['id'])_0x49977c['where']['id']=[];_0x1cacd3[_0xdc2df0]['associatedResources'][_0x9f11('0xa6')](function(_0xa9220b){_0x49977c[_0x9f11('0x85')]['id'][_0x9f11('0x90')](_0xa9220b);});}}}if(!_[_0x9f11('0x8e')](_0x2a85ab)){_0x49977c[_0x9f11('0x85')]=_['merge'](_0x49977c[_0x9f11('0x85')],{'$and':{'$or':_0x2a85ab}});}_0x49977c=_['merge']({},_0x49977c,_0x1a4bdc['options']);if(_0x10397b&&!_0x10397b[_0x9f11('0x96')]&&_0x38fe8f['childModel']===_0x9f11('0x11')){if(_0x1a4bdc[_0x9f11('0x8c')][_0x9f11('0xa7')]){_0x49977c[_0x9f11('0xa8')]=[{'all':!![]}];}return _0xba6710[_0x38fe8f[_0x9f11('0x15')]][_0x9f11('0xf')](_0x49977c)[_0x9f11('0x7')](function(_0x2690b8){var _0x3457fb=[];_0x2690b8[_0x9f11('0xa6')](function(_0x3b9ea5){var _0x41b0ab;switch(_0x3b9ea5[_0x9f11('0xa9')]){case _0x9f11('0xaa'):_0x41b0ab=_[_0x9f11('0x92')](_0x10397b[_0x9f11('0x8')],function(_0x49c744){return _0x49c744['id']===_0x3b9ea5[_0x9f11('0x78')]&&_0x49c744[_0x9f11('0x13')]===_0x9f11('0xab');});break;case'custom':_0x41b0ab=_[_0x9f11('0x92')](_0x10397b[_0x9f11('0x8')],function(_0x14989b){return _0x14989b['id']===_0x3b9ea5[_0x9f11('0x78')]&&_0x14989b['type']===_0x9f11('0xac');});break;}if(_0x41b0ab)_0x3457fb[_0x9f11('0x90')](_0x3b9ea5);});_0xc74638[_0x9f11('0xad')]=_0x3457fb[_0x9f11('0x8f')];_0xc74638[_0x9f11('0xae')]=_0x3457fb;return _0xc74638;});}else{return _0xba6710[_0x38fe8f[_0x9f11('0x15')]]['count']({'where':_0x49977c['where']})['then'](function(_0x4d56e1){_0xc74638[_0x9f11('0xad')]=_0x4d56e1;if(_0x1a4bdc[_0x9f11('0x8c')]['includeAll']){if(_0x38fe8f['childModel']===_0x9f11('0x20')){_0x49977c['include']=[{'model':_0xba6710[_0x9f11('0x6e')],'as':_0x9f11('0xaf'),'attributes':['id',_0x9f11('0xc'),_0x9f11('0xb0')],'required':_0x1a4bdc[_0x9f11('0x8c')][_0x9f11('0xb1')]?!![]:![]},{'model':_0xba6710[_0x9f11('0x6e')],'as':_0x9f11('0xb2'),'attributes':['id','name','color'],'through':_0x1a4bdc[_0x9f11('0x8c')][_0x9f11('0xb1')]?{'attributes':[],'where':{'TagId':_0x1a4bdc[_0x9f11('0x8c')][_0x9f11('0xb1')]||undefined}}:{},'required':_0x1a4bdc['query'][_0x9f11('0xb1')]?!![]:![]}];}else{_0x49977c['include']=[{'all':!![]}];}}return _0xba6710[_0x38fe8f[_0x9f11('0x15')]][_0x9f11('0xf')](_0x49977c);})[_0x9f11('0x7')](function(_0x725d7d){_0xc74638['rows']=_0x725d7d;if(_0x4bfb4b===_0x9f11('0x33')&&_0x1a4bdc[_0x9f11('0x8c')][_0x9f11('0xb3')]===_0x9f11('0xb4')){var _0x1e8049=[];for(var _0x499e5f=0x0;_0x499e5f<_0xc74638[_0x9f11('0xae')]['length'];_0x499e5f++){_0x1e8049[_0x9f11('0x90')](_0x5a0f20(_0x9f11('0xb5'),_0xc74638[_0x9f11('0xae')][_0x499e5f][_0x9f11('0xb6')]));_0x1e8049[_0x9f11('0x90')](_0x5a0f20(_0x9f11('0xb7'),_0xc74638['rows'][_0x499e5f][_0x9f11('0xb6')]));_0x1e8049[_0x9f11('0x90')](_0x5a0f20(_0x9f11('0xb8'),_0xc74638[_0x9f11('0xae')][_0x499e5f][_0x9f11('0xb6')]));_0x1e8049[_0x9f11('0x90')](_0x5a0f20(_0x9f11('0xb9'),_0xc74638[_0x9f11('0xae')][_0x499e5f][_0x9f11('0xb6')]));_0x1e8049[_0x9f11('0x90')](_0x5a0f20(_0x9f11('0xba'),_0xc74638[_0x9f11('0xae')][_0x499e5f]['dataValues']));_0x1e8049[_0x9f11('0x90')](_0x5a0f20(_0x9f11('0xbb'),_0xc74638[_0x9f11('0xae')][_0x499e5f]['dataValues']));}return Promise[_0x9f11('0x97')](_0x1e8049)['then'](function(){return _0xc74638;});}return _0xc74638;});}});}}});}; \ No newline at end of file +var _0xdf22=['vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','Variable','plugins','Plugin','extractedreports','Reports','metrics','slice','Sequelize','SELECT','ui.','from','where','sequelize','query','toString','OpenTabs','define','user_profiles','raw','isEmpty','length','push','UserProfileSection','params','all','ignore','union','keys','filters','intersection','attributes','fields','nolimit','limit','offset','sort','key','VIRTUAL','find','foreignKey','forEach','merge','options','autoAssociation','default','reportId','DefaultReports','CustomReports','count','rows','include','Tags','color','tag','ThroughTags','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','exports','models','filter','field','value','findAll','catch','model','then','associatedResources','map','name','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','odbc','SquareOdbc','squarerecordings','childModel','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','CmCustomField','chatqueues','ChatQueue','chatwebsites','FaxQueue','faxaccounts','FaxAccount','inboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','VoiceRecording','Agents','membername','role','agent','Telephones','telephone','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','queue','outbound','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','MailQueue','mailsubstatuses','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','queuecampaigns','agents','telephones','User','admin','user','ZendeskAccount','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount'];(function(_0x421e73,_0x2d3fdc){var _0x2f71ec=function(_0x43241c){while(--_0x43241c){_0x421e73['push'](_0x421e73['shift']());}};_0x2f71ec(++_0x2d3fdc);}(_0xdf22,0x1b5));var _0x2df2=function(_0x18a7e0,_0xad1bd1){_0x18a7e0=_0x18a7e0-0x0;var _0xc4e5fc=_0xdf22[_0x18a7e0];return _0xc4e5fc;};'use strict';var _=require(_0x2df2('0x0'));var attributes=require('./userProfile.attributes');var qs=require('../../components/parsers/qs');var squel=require('squel');module[_0x2df2('0x1')]=function(_0x573bcd){var _0x504678=_0x573bcd[_0x2df2('0x2')];function _0x11fc73(_0x375b63,_0x20e701){return new Promise(function(_0x55b64c,_0x4e8d4c){if(!_0x20e701)return _0x55b64c(null);var _0x19f170=_0x20e701[_0x2df2('0x3')]?{[_0x20e701[_0x2df2('0x3')][_0x2df2('0x4')]]:_0x20e701[_0x2df2('0x3')][_0x2df2('0x5')]}:undefined;return _0x504678[_0x375b63][_0x2df2('0x6')]({'where':_0x19f170,'raw':!![]})['then'](function(_0x493bea){_0x20e701['associatedResources']=_['map'](_0x493bea,'id');_0x55b64c(_0x20e701);})[_0x2df2('0x7')](function(_0x56dab8){_0x4e8d4c(_0x56dab8);});});}function _0x1939f5(_0x104a31,_0x216081){return new Promise(function(_0x2f0ddf,_0x1b8666){var _0x596f00=_0x104a31['filter']?{[_0x104a31[_0x2df2('0x3')][_0x2df2('0x4')]]:_0x104a31['filter']['value']}:undefined;return _0x504678[_0x104a31[_0x2df2('0x8')]]['findAll']({'where':_0x596f00,'raw':!![]})[_0x2df2('0x9')](function(_0x14eb26){_0x216081[_0x2df2('0xa')]=_[_0x2df2('0xb')](_0x14eb26,function(_0x1d85bb){return _0x1d85bb[_0x2df2('0xc')];});_0x2f0ddf(_0x216081);})[_0x2df2('0x7')](function(_0x30d40e){_0x1b8666(_0x30d40e);});});}function _0x12db07(_0x2b7283,_0x27207b,_0x17d1a4){if(!_0x27207b)return Promise['resolve'](null);return new Promise(function(_0x2ae95d,_0x2fab72){return _0x504678[_0x2df2('0xd')][_0x2df2('0x6')]({'where':{'sectionId':_0x27207b['id']},'raw':!![]})['then'](function(_0x5c6795){if(_0x2b7283['field']&&_0x2b7283[_0x2df2('0x4')]!=='id'){_0x27207b['associatedResources']=_[_0x2df2('0xb')](_0x5c6795,function(_0x50ee8b){return _0x50ee8b[_0x2b7283['field']];});}else{if(_0x17d1a4===_0x2df2('0xe')){_0x27207b[_0x2df2('0xa')]=_[_0x2df2('0xb')](_0x5c6795,function(_0x6eb506){return{'id':_0x6eb506[_0x2df2('0xf')],'type':_0x6eb506[_0x2df2('0x10')]};});}else{_0x27207b[_0x2df2('0xa')]=_[_0x2df2('0xb')](_0x5c6795,function(_0x3a56ec){return _0x3a56ec['resourceId'];});}}_0x2ae95d(_0x27207b);})['catch'](function(_0x4baf88){_0x2fab72(_0x4baf88);});});}function _0xf269c1(_0xe6dad1,_0x56bcdf){var _0x23ea68={'parentSections':[]};switch(_0xe6dad1[_0x2df2('0x11')]()){case _0x2df2('0x12'):_0x23ea68['childModel']='SquareProject';break;case _0x2df2('0x13'):_0x23ea68['childModel']=_0x2df2('0x14');break;case _0x2df2('0x15'):_0x23ea68[_0x2df2('0x16')]=_0x2df2('0x17');_0x23ea68[_0x2df2('0x18')]=[{'name':_0x2df2('0x19'),'field':'name','foreignKey':_0x2df2('0x1a')}];break;case _0x2df2('0x1b'):_0x23ea68[_0x2df2('0x16')]=_0x2df2('0x1c');break;case _0x2df2('0x1d'):_0x23ea68[_0x2df2('0x16')]=_0x2df2('0x1e');_0x23ea68['parentSections']=[{'name':_0x2df2('0x1f'),'field':'id','foreignKey':_0x2df2('0x20')}];break;case _0x2df2('0x21'):_0x23ea68[_0x2df2('0x16')]=_0x2df2('0x22');break;case _0x2df2('0x23'):_0x23ea68[_0x2df2('0x16')]=_0x2df2('0x24');break;case'globalcustomfields':_0x23ea68[_0x2df2('0x16')]=_0x2df2('0x25');break;case _0x2df2('0x26'):_0x23ea68[_0x2df2('0x16')]=_0x2df2('0x27');break;case _0x2df2('0x28'):_0x23ea68[_0x2df2('0x16')]='ChatWebsite';break;case'faxqueues':_0x23ea68[_0x2df2('0x16')]=_0x2df2('0x29');break;case _0x2df2('0x2a'):_0x23ea68[_0x2df2('0x16')]=_0x2df2('0x2b');break;case _0x2df2('0x2c'):case'internalroutes':case'outboundroutes':_0x23ea68['childModel']=_0x2df2('0x2d');break;case _0x2df2('0x2e'):_0x23ea68[_0x2df2('0x16')]=_0x2df2('0x2f');break;case _0x2df2('0x30'):_0x23ea68[_0x2df2('0x16')]=_0x2df2('0x31');break;case'voicerecordings':_0x23ea68['childModel']=_0x2df2('0x32');_0x23ea68[_0x2df2('0x18')]=[{'name':_0x2df2('0x33'),'field':'name','foreignKey':_0x2df2('0x34'),'model':'User','filter':{'field':_0x2df2('0x35'),'value':[_0x2df2('0x36')]}},{'name':_0x2df2('0x37'),'field':_0x2df2('0xc'),'foreignKey':_0x2df2('0x34'),'model':'User','filter':{'field':_0x2df2('0x35'),'value':[_0x2df2('0x38')]}},{'name':_0x2df2('0x39'),'field':'name','foreignKey':'queue','model':_0x2df2('0x3a'),'filter':{'field':_0x2df2('0x10'),'value':[_0x2df2('0x3b')]}},{'name':_0x2df2('0x3c'),'field':_0x2df2('0xc'),'foreignKey':_0x2df2('0x3d'),'model':_0x2df2('0x3a'),'filter':{'field':_0x2df2('0x10'),'value':[_0x2df2('0x3e')]}}];break;case'musiconholds':_0x23ea68[_0x2df2('0x16')]='VoiceMusicOnHold';break;case _0x2df2('0x3f'):_0x23ea68[_0x2df2('0x16')]=_0x2df2('0x40');break;case'voiceprefixes':_0x23ea68[_0x2df2('0x16')]=_0x2df2('0x41');break;case _0x2df2('0x42'):_0x23ea68[_0x2df2('0x16')]='Campaign';break;case'mailqueues':_0x23ea68[_0x2df2('0x16')]=_0x2df2('0x43');break;case'mailaccounts':_0x23ea68['childModel']='MailAccount';break;case _0x2df2('0x44'):_0x23ea68[_0x2df2('0x16')]='MailSubstatus';break;case _0x2df2('0x45'):_0x23ea68[_0x2df2('0x16')]=_0x2df2('0x46');break;case'openchannelaccounts':_0x23ea68[_0x2df2('0x16')]=_0x2df2('0x47');break;case _0x2df2('0x48'):_0x23ea68[_0x2df2('0x16')]=_0x2df2('0x49');break;case'smsaccounts':_0x23ea68['childModel']=_0x2df2('0x4a');break;case _0x2df2('0x4b'):_0x23ea68[_0x2df2('0x16')]=_0x2df2('0x4c');break;case _0x2df2('0x4d'):_0x23ea68['childModel']=_0x2df2('0x4e');break;case _0x2df2('0x4f'):_0x23ea68[_0x2df2('0x16')]='Team';break;case'voicequeues':case _0x2df2('0x50'):_0x23ea68[_0x2df2('0x16')]='VoiceQueue';if(_0x56bcdf){_0x23ea68['parentSections']=[{'name':_0x2df2('0x39')},{'name':_0x2df2('0x3c')}];}break;case'users':case _0x2df2('0x51'):case _0x2df2('0x52'):_0x23ea68[_0x2df2('0x16')]=_0x2df2('0x53');if(_0x56bcdf){_0x23ea68[_0x2df2('0x18')]=[{'name':'Users','filter':{'field':'role','value':[_0x2df2('0x54'),_0x2df2('0x55')]},'ignore':!![]},{'name':_0x2df2('0x33')},{'name':_0x2df2('0x37')}];}break;case'zendeskaccounts':_0x23ea68[_0x2df2('0x16')]=_0x2df2('0x56');break;case'salesforceaccounts':_0x23ea68['childModel']=_0x2df2('0x57');break;case _0x2df2('0x58'):_0x23ea68[_0x2df2('0x16')]='FreshdeskAccount';break;case _0x2df2('0x59'):_0x23ea68[_0x2df2('0x16')]=_0x2df2('0x5a');break;case _0x2df2('0x5b'):_0x23ea68['childModel']='DeskAccount';break;case _0x2df2('0x5c'):_0x23ea68[_0x2df2('0x16')]=_0x2df2('0x5d');break;case _0x2df2('0x5e'):_0x23ea68[_0x2df2('0x16')]='User';break;case _0x2df2('0x5f'):_0x23ea68[_0x2df2('0x16')]=_0x2df2('0x60');break;case _0x2df2('0x61'):_0x23ea68[_0x2df2('0x16')]=_0x2df2('0x62');break;case _0x2df2('0x63'):_0x23ea68['childModel']=_0x2df2('0x64');break;case _0x2df2('0x65'):_0x23ea68[_0x2df2('0x16')]=_0x2df2('0x66');break;case _0x2df2('0x67'):_0x23ea68[_0x2df2('0x16')]=_0x2df2('0x68');break;case'scheduler':_0x23ea68['childModel']='Schedule';break;case _0x2df2('0x69'):_0x23ea68[_0x2df2('0x16')]=_0x2df2('0x6a');break;case _0x2df2('0x6b'):_0x23ea68[_0x2df2('0x16')]=_0x2df2('0x6c');break;case _0x2df2('0x6d'):_0x23ea68[_0x2df2('0x16')]=_0x2df2('0x6e');break;case _0x2df2('0x6f'):_0x23ea68[_0x2df2('0x16')]=_0x2df2('0x70');break;case _0x2df2('0x71'):_0x23ea68[_0x2df2('0x16')]=_0x2df2('0x72');break;case'variables':_0x23ea68[_0x2df2('0x16')]=_0x2df2('0x73');break;case _0x2df2('0x74'):_0x23ea68[_0x2df2('0x16')]=_0x2df2('0x75');break;case _0x2df2('0x76'):_0x23ea68[_0x2df2('0x16')]='AnalyticExtractedReport';_0x23ea68[_0x2df2('0x18')]=[{'name':_0x2df2('0x77'),'field':'id','foreignKey':'reportId'}];break;case _0x2df2('0x78'):_0x23ea68[_0x2df2('0x16')]='AnalyticMetric';break;}return _0x23ea68;}function _0x20dd38(_0x20c66a,_0x1701aa){var _0x12d8df=_0x20c66a['charAt'](0x0)['toUpperCase']()+_0x20c66a[_0x2df2('0x79')](0x1);var _0x1a7f07={'type':_0x504678[_0x2df2('0x7a')]['QueryTypes'][_0x2df2('0x7b')],'raw':!![]};return new Promise(function(_0x898872,_0x15504b){var _0x13f443=squel['select']()['field'](_0x2df2('0x7c')+_0x12d8df+'InteractionId','id')[_0x2df2('0x4')]('ui.createdAt')[_0x2df2('0x7d')]('user_has_'+_0x20c66a+'_interactions','ui')[_0x2df2('0x7e')]('ui.UserId\x20=\x20?',_0x1701aa['id']);return _0x504678[_0x2df2('0x7f')][_0x2df2('0x80')](_0x13f443[_0x2df2('0x81')](),_0x1a7f07)[_0x2df2('0x9')](function(_0x50e512){_0x1701aa[_0x12d8df+_0x2df2('0x82')]=_0x50e512;_0x898872(_0x50e512);})[_0x2df2('0x7')](function(_0x29e602){_0x15504b(_0x29e602);});});}return _0x573bcd[_0x2df2('0x83')]('UserProfile',attributes,{'tableName':_0x2df2('0x84'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x2f8064){var _0x399551={'raw':_0x2f8064[_0x2df2('0x80')][_0x2df2('0x85')],'where':{}};var _0x446885={};var _0x104be2={'count':0x0,'rows':[]};var _0x3053be=_0x2f8064['query']['section'];var _0x221464=_0x2f8064['query']['mergeResources']||![];var _0x1e614c=_0xf269c1(_0x3053be,_0x221464);if(!_0x1e614c['childModel'])throw new Error('Invalid\x20section\x20\x27'+_0x3053be+'\x27');var _0x5e4320=[{'name':_0x3053be}];if(!_[_0x2df2('0x86')](_0x1e614c[_0x2df2('0x18')]))_0x5e4320=_0x1e614c['parentSections'];var _0x1247bf=[];for(var _0xb2c1b2=0x0;_0xb2c1b2<_0x5e4320[_0x2df2('0x87')];_0xb2c1b2++){_0x1247bf[_0x2df2('0x88')](_0x504678[_0x2df2('0x89')]['find']({'where':{'userProfileId':_0x2f8064[_0x2df2('0x8a')]['id'],'name':_0x5e4320[_0xb2c1b2][_0x2df2('0xc')]},'raw':!![]}));}return Promise[_0x2df2('0x8b')](_0x1247bf)['then'](function(_0x1a9498){var _0x4be024=_[_0x2df2('0x3')](_0x1a9498,function(_0x71f1c8){return _0x71f1c8?_0x71f1c8:undefined;});var _0x160ce1=_[_0x2df2('0x3')](_0x5e4320,[_0x2df2('0x8c'),!![]]);var _0x4d780b=_[_0x2df2('0x86')](_0x4be024)&&_[_0x2df2('0x86')](_0x160ce1)?null:_[_0x2df2('0x8d')](_0x160ce1,_0x4be024);if(!_0x4d780b)return null;var _0x8ef72f=[];for(var _0x5bcace=0x0;_0x5bcace<_0x4d780b[_0x2df2('0x87')];_0x5bcace++){var _0x365d0e=_['find'](_0x5e4320,function(_0x13412f){return _0x4d780b[_0x5bcace]?_0x13412f[_0x2df2('0xc')]===_0x4d780b[_0x5bcace][_0x2df2('0xc')]:null;});if(_0x365d0e){if(_0x4d780b[_0x5bcace][_0x2df2('0x8c')]){_0x8ef72f[_0x2df2('0x88')](_0x11fc73(_0x1e614c[_0x2df2('0x16')],_0x4d780b[_0x5bcace]));}else{if(!_0x4d780b[_0x5bcace]['autoAssociation']){_0x8ef72f[_0x2df2('0x88')](_0x12db07(_0x365d0e,_0x4d780b[_0x5bcace],_0x1e614c[_0x2df2('0x16')]));}else{if(_0x365d0e[_0x2df2('0x8')]){_0x8ef72f[_0x2df2('0x88')](_0x1939f5(_0x365d0e,_0x4d780b[_0x5bcace]));}}}}}return Promise[_0x2df2('0x8b')](_0x8ef72f);})['then'](function(_0x1ef25a){var _0x4c66be=_0x1ef25a;var _0x17db2d=null;if(_0x4c66be){_0x17db2d=_0x4c66be[_0x2df2('0x87')]===0x1?_0x4c66be[0x0]:null;}if(!_0x17db2d&&!_0x4c66be)return _0x104be2;var _0x5a75ae=_0x504678[_0x1e614c['childModel']]['rawAttributes'];_0x446885[_0x2df2('0x8')]=_[_0x2df2('0x8e')](_0x5a75ae);_0x446885[_0x2df2('0x80')]=_[_0x2df2('0x8e')](_0x2f8064[_0x2df2('0x80')]);_0x446885[_0x2df2('0x8f')]=_[_0x2df2('0x90')](_0x446885['model'],_0x446885[_0x2df2('0x80')]);_0x399551[_0x2df2('0x91')]=_['intersection'](_0x446885[_0x2df2('0x8')],qs[_0x2df2('0x92')](_0x2f8064[_0x2df2('0x80')][_0x2df2('0x92')]));_0x399551['attributes']=_0x399551[_0x2df2('0x91')]['length']?_0x399551[_0x2df2('0x91')]:_0x446885['model'];if(!_0x2f8064[_0x2df2('0x80')]['hasOwnProperty'](_0x2df2('0x93'))){_0x399551[_0x2df2('0x94')]=qs[_0x2df2('0x94')](_0x2f8064[_0x2df2('0x80')][_0x2df2('0x94')]);_0x399551[_0x2df2('0x95')]=qs['offset'](_0x2f8064['query']['offset']);}_0x399551['order']=qs[_0x2df2('0x96')](_0x2f8064[_0x2df2('0x80')][_0x2df2('0x96')]);_0x399551[_0x2df2('0x7e')]=qs[_0x2df2('0x8f')](_['pick'](_0x2f8064[_0x2df2('0x80')],_0x446885[_0x2df2('0x8f')]));if(_0x2f8064[_0x2df2('0x80')][_0x2df2('0x3')]){_0x399551['where']=_['merge'](_0x399551[_0x2df2('0x7e')],{'$or':_[_0x2df2('0xb')](_0x5a75ae,function(_0x584000){if(_0x584000[_0x2df2('0x10')][_0x2df2('0x97')]!==_0x2df2('0x98')){var _0x4c34a2={};_0x4c34a2[_0x584000[_0x2df2('0x4')]]={'$like':'%'+_0x2f8064[_0x2df2('0x80')][_0x2df2('0x3')]+'%'};return _0x4c34a2;}})});}var _0x121bab=[];var _0x1d24b4=null;var _0xbd8bce={};if(_0x17db2d){_0x1d24b4=_[_0x2df2('0x99')](_0x5e4320,['name',_0x17db2d[_0x2df2('0xc')]]);if(_0x1d24b4['field']){_0xbd8bce={};if(_0x1e614c[_0x2df2('0x16')]===_0x2df2('0xe')){_0xbd8bce[_0x1d24b4[_0x2df2('0x9a')]]=_[_0x2df2('0xb')](_0x17db2d[_0x2df2('0xa')],'id');}else{_0xbd8bce[_0x1d24b4[_0x2df2('0x9a')]]=_0x17db2d[_0x2df2('0xa')];}_0x121bab[_0x2df2('0x88')](_0xbd8bce);}else{_0x399551[_0x2df2('0x7e')]['id']=_0x17db2d[_0x2df2('0xa')];}}else{for(var _0x375013=0x0;_0x375013<_0x4c66be[_0x2df2('0x87')];_0x375013++){_0x1d24b4=_[_0x2df2('0x99')](_0x5e4320,[_0x2df2('0xc'),_0x4c66be[_0x375013][_0x2df2('0xc')]]);if(_0x1d24b4[_0x2df2('0x4')]){_0xbd8bce={};_0xbd8bce[_0x1d24b4['foreignKey']]=_0x4c66be[_0x375013][_0x2df2('0xa')];_0x121bab[_0x2df2('0x88')](_0xbd8bce);}else{if(!_0x399551[_0x2df2('0x7e')]['id'])_0x399551['where']['id']=[];_0x4c66be[_0x375013][_0x2df2('0xa')][_0x2df2('0x9b')](function(_0x111d53){_0x399551[_0x2df2('0x7e')]['id']['push'](_0x111d53);});}}}if(!_[_0x2df2('0x86')](_0x121bab)){_0x399551[_0x2df2('0x7e')]=_[_0x2df2('0x9c')](_0x399551[_0x2df2('0x7e')],{'$and':{'$or':_0x121bab}});}_0x399551=_['merge']({},_0x399551,_0x2f8064[_0x2df2('0x9d')]);if(_0x17db2d&&!_0x17db2d[_0x2df2('0x9e')]&&_0x1e614c[_0x2df2('0x16')]===_0x2df2('0xe')){if(_0x2f8064['query']['includeAll']){_0x399551['include']=[{'all':!![]}];}return _0x504678[_0x1e614c[_0x2df2('0x16')]][_0x2df2('0x6')](_0x399551)[_0x2df2('0x9')](function(_0x5c6a20){var _0x429d3f=[];_0x5c6a20[_0x2df2('0x9b')](function(_0x94303b){var _0xd708b3;switch(_0x94303b['reportType']){case _0x2df2('0x9f'):_0xd708b3=_['find'](_0x17db2d[_0x2df2('0xa')],function(_0x337da3){return _0x337da3['id']===_0x94303b[_0x2df2('0xa0')]&&_0x337da3[_0x2df2('0x10')]===_0x2df2('0xa1');});break;case'custom':_0xd708b3=_[_0x2df2('0x99')](_0x17db2d['associatedResources'],function(_0x5b0d5e){return _0x5b0d5e['id']===_0x94303b['reportId']&&_0x5b0d5e[_0x2df2('0x10')]===_0x2df2('0xa2');});break;}if(_0xd708b3)_0x429d3f[_0x2df2('0x88')](_0x94303b);});_0x104be2[_0x2df2('0xa3')]=_0x429d3f[_0x2df2('0x87')];_0x104be2[_0x2df2('0xa4')]=_0x429d3f;return _0x104be2;});}else{return _0x504678[_0x1e614c[_0x2df2('0x16')]]['count']({'where':_0x399551[_0x2df2('0x7e')]})[_0x2df2('0x9')](function(_0x169c5a){_0x104be2[_0x2df2('0xa3')]=_0x169c5a;if(_0x2f8064[_0x2df2('0x80')]['includeAll']){if(_0x1e614c[_0x2df2('0x16')]===_0x2df2('0x1e')){_0x399551[_0x2df2('0xa5')]=[{'model':_0x504678[_0x2df2('0x6c')],'as':_0x2df2('0xa6'),'attributes':['id','name',_0x2df2('0xa7')],'required':_0x2f8064[_0x2df2('0x80')][_0x2df2('0xa8')]?!![]:![]},{'model':_0x504678[_0x2df2('0x6c')],'as':_0x2df2('0xa9'),'attributes':['id',_0x2df2('0xc'),_0x2df2('0xa7')],'through':_0x2f8064[_0x2df2('0x80')][_0x2df2('0xa8')]?{'attributes':[],'where':{'TagId':_0x2f8064[_0x2df2('0x80')][_0x2df2('0xa8')]||undefined}}:{},'required':_0x2f8064[_0x2df2('0x80')][_0x2df2('0xa8')]?!![]:![]}];}else{_0x399551[_0x2df2('0xa5')]=[{'all':!![]}];}}return _0x504678[_0x1e614c['childModel']][_0x2df2('0x6')](_0x399551);})[_0x2df2('0x9')](function(_0x4327cb){_0x104be2[_0x2df2('0xa4')]=_0x4327cb;if(_0x3053be===_0x2df2('0x33')&&_0x2f8064[_0x2df2('0x80')]['openTabs']==='true'){var _0xa83720=[];for(var _0x1c81ab=0x0;_0x1c81ab<_0x104be2[_0x2df2('0xa4')][_0x2df2('0x87')];_0x1c81ab++){_0xa83720[_0x2df2('0x88')](_0x20dd38(_0x2df2('0xaa'),_0x104be2[_0x2df2('0xa4')][_0x1c81ab][_0x2df2('0xab')]));_0xa83720[_0x2df2('0x88')](_0x20dd38(_0x2df2('0xac'),_0x104be2[_0x2df2('0xa4')][_0x1c81ab]['dataValues']));_0xa83720[_0x2df2('0x88')](_0x20dd38(_0x2df2('0xad'),_0x104be2[_0x2df2('0xa4')][_0x1c81ab][_0x2df2('0xab')]));_0xa83720['push'](_0x20dd38(_0x2df2('0xae'),_0x104be2[_0x2df2('0xa4')][_0x1c81ab][_0x2df2('0xab')]));_0xa83720[_0x2df2('0x88')](_0x20dd38(_0x2df2('0xaf'),_0x104be2[_0x2df2('0xa4')][_0x1c81ab][_0x2df2('0xab')]));_0xa83720['push'](_0x20dd38(_0x2df2('0xb0'),_0x104be2['rows'][_0x1c81ab][_0x2df2('0xab')]));}return Promise[_0x2df2('0x8b')](_0xa83720)[_0x2df2('0x9')](function(){return _0x104be2;});}return _0x104be2;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index c3ced8e..f362500 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 _0x27f3=['debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s'];(function(_0x2decea,_0x9fcff3){var _0xeb6aed=function(_0x20a20d){while(--_0x20a20d){_0x2decea['push'](_0x2decea['shift']());}};_0xeb6aed(++_0x9fcff3);}(_0x27f3,0x1e9));var _0x327f=function(_0x507c81,_0x3e1b56){_0x507c81=_0x507c81-0x0;var _0x368a25=_0x27f3[_0x507c81];return _0x368a25;};'use strict';var _=require(_0x327f('0x0'));var util=require(_0x327f('0x1'));var moment=require('moment');var BPromise=require(_0x327f('0x2'));var rs=require(_0x327f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x327f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x327f('0x5'))(_0x327f('0x6'));var config=require(_0x327f('0x7'));var jayson=require(_0x327f('0x8'));var client=jayson[_0x327f('0x9')][_0x327f('0xa')]({'port':0x232a});config[_0x327f('0xb')]=_[_0x327f('0xc')](config['redis'],{'host':_0x327f('0xd'),'port':0x18eb});var socket=require(_0x327f('0xe'))(new Redis(config[_0x327f('0xb')]));require(_0x327f('0xf'))[_0x327f('0x10')](socket);function respondWithRpcPromise(_0x18c142,_0x501f8b,_0x25295d){return new BPromise(function(_0x119120,_0x434e5a){return client[_0x327f('0x11')](_0x18c142,_0x25295d)[_0x327f('0x12')](function(_0xb2fd19){logger[_0x327f('0x13')](_0x327f('0x14'),_0x501f8b,'request\x20sent');logger[_0x327f('0x15')](_0x327f('0x16'),_0x501f8b,_0x327f('0x17'),JSON[_0x327f('0x18')](_0xb2fd19));if(_0xb2fd19[_0x327f('0x19')]){if(_0xb2fd19[_0x327f('0x19')][_0x327f('0x1a')]===0x1f4){logger[_0x327f('0x19')]('UserProfile,\x20%s,\x20%s',_0x501f8b,_0xb2fd19['error'][_0x327f('0x1b')]);return _0x434e5a(_0xb2fd19[_0x327f('0x19')][_0x327f('0x1b')]);}logger[_0x327f('0x19')](_0x327f('0x14'),_0x501f8b,_0xb2fd19[_0x327f('0x19')][_0x327f('0x1b')]);return _0x119120(_0xb2fd19[_0x327f('0x19')][_0x327f('0x1b')]);}else{logger[_0x327f('0x13')](_0x327f('0x14'),_0x501f8b,'request\x20sent');_0x119120(_0xb2fd19[_0x327f('0x1c')][_0x327f('0x1b')]);}})[_0x327f('0x1d')](function(_0x26a217){logger[_0x327f('0x19')](_0x327f('0x14'),_0x501f8b,_0x26a217);_0x434e5a(_0x26a217);});});} \ No newline at end of file +var _0x103f=['register','info','request\x20sent','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket'];(function(_0x4b23fb,_0x3e5765){var _0x2e16d4=function(_0x52d360){while(--_0x52d360){_0x4b23fb['push'](_0x4b23fb['shift']());}};_0x2e16d4(++_0x3e5765);}(_0x103f,0x13e));var _0xf103=function(_0x40c2f4,_0x25f098){_0x40c2f4=_0x40c2f4-0x0;var _0x5e4679=_0x103f[_0x40c2f4];return _0x5e4679;};'use strict';var _=require(_0xf103('0x0'));var util=require(_0xf103('0x1'));var moment=require(_0xf103('0x2'));var BPromise=require(_0xf103('0x3'));var rs=require(_0xf103('0x4'));var fs=require('fs');var Redis=require(_0xf103('0x5'));var db=require(_0xf103('0x6'))['db'];var utils=require(_0xf103('0x7'));var logger=require(_0xf103('0x8'))(_0xf103('0x9'));var config=require('../../config/environment');var jayson=require(_0xf103('0xa'));var client=jayson[_0xf103('0xb')][_0xf103('0xc')]({'port':0x232a});config[_0xf103('0xd')]=_[_0xf103('0xe')](config[_0xf103('0xd')],{'host':_0xf103('0xf'),'port':0x18eb});var socket=require(_0xf103('0x10'))(new Redis(config[_0xf103('0xd')]));require(_0xf103('0x11'))[_0xf103('0x12')](socket);function respondWithRpcPromise(_0x267ec4,_0x47b71b,_0x228805){return new BPromise(function(_0x532559,_0x2aa8fd){return client['request'](_0x267ec4,_0x228805)['then'](function(_0xb3a849){logger[_0xf103('0x13')]('UserProfile,\x20%s,\x20%s',_0x47b71b,_0xf103('0x14'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x47b71b,'request\x20sent',JSON[_0xf103('0x15')](_0xb3a849));if(_0xb3a849['error']){if(_0xb3a849[_0xf103('0x16')][_0xf103('0x17')]===0x1f4){logger['error'](_0xf103('0x18'),_0x47b71b,_0xb3a849[_0xf103('0x16')]['message']);return _0x2aa8fd(_0xb3a849[_0xf103('0x16')][_0xf103('0x19')]);}logger['error'](_0xf103('0x18'),_0x47b71b,_0xb3a849['error']['message']);return _0x532559(_0xb3a849[_0xf103('0x16')][_0xf103('0x19')]);}else{logger[_0xf103('0x13')](_0xf103('0x18'),_0x47b71b,_0xf103('0x14'));_0x532559(_0xb3a849[_0xf103('0x1a')]['message']);}})[_0xf103('0x1b')](function(_0x338a44){logger['error'](_0xf103('0x18'),_0x47b71b,_0x338a44);_0x2aa8fd(_0x338a44);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 1ecb7ae..49785a6 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 _0x11c2=['emit','register','userProfile:','./userProfile.events','remove','update'];(function(_0x19a001,_0x23ee61){var _0x5d90e0=function(_0x622a23){while(--_0x622a23){_0x19a001['push'](_0x19a001['shift']());}};_0x5d90e0(++_0x23ee61);}(_0x11c2,0x6f));var _0x211c=function(_0x414e57,_0x2dfc76){_0x414e57=_0x414e57-0x0;var _0x3407a1=_0x11c2[_0x414e57];return _0x3407a1;};'use strict';var UserProfileEvents=require(_0x211c('0x0'));var events=['save',_0x211c('0x1'),_0x211c('0x2')];function createListener(_0x121e31,_0x5c6f86){return function(_0x5c9223){_0x5c6f86[_0x211c('0x3')](_0x121e31,_0x5c9223);};}function removeListener(_0x551074,_0x59dcb9){return function(){UserProfileEvents['removeListener'](_0x551074,_0x59dcb9);};}exports[_0x211c('0x4')]=function(_0x186316){for(var _0x5ed70a=0x0,_0x3c7603=events['length'];_0x5ed70a<_0x3c7603;_0x5ed70a++){var _0x319446=events[_0x5ed70a];var _0x33a640=createListener(_0x211c('0x5')+_0x319446,_0x186316);UserProfileEvents['on'](_0x319446,_0x33a640);}}; \ No newline at end of file +var _0x3324=['remove','emit','removeListener','register','length','userProfile:','save'];(function(_0x34da82,_0x45a76f){var _0x34e621=function(_0x244a77){while(--_0x244a77){_0x34da82['push'](_0x34da82['shift']());}};_0x34e621(++_0x45a76f);}(_0x3324,0x11e));var _0x4332=function(_0x24a3c3,_0xe029f1){_0x24a3c3=_0x24a3c3-0x0;var _0x324055=_0x3324[_0x24a3c3];return _0x324055;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x4332('0x0'),_0x4332('0x1'),'update'];function createListener(_0x2378ee,_0x329c17){return function(_0x1d355b){_0x329c17[_0x4332('0x2')](_0x2378ee,_0x1d355b);};}function removeListener(_0x361701,_0x30d82b){return function(){UserProfileEvents[_0x4332('0x3')](_0x361701,_0x30d82b);};}exports[_0x4332('0x4')]=function(_0x4dde7f){for(var _0x2450cd=0x0,_0x4daa9f=events[_0x4332('0x5')];_0x2450cd<_0x4daa9f;_0x2450cd++){var _0x3151dc=events[_0x2450cd];var _0x426ee8=createListener(_0x4332('0x6')+_0x3151dc,_0x4dde7f);UserProfileEvents['on'](_0x3151dc,_0x426ee8);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 3981107..a9e9022 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 _0xd921=['put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','post'];(function(_0x2c0900,_0x292e42){var _0x146231=function(_0x2ad127){while(--_0x2ad127){_0x2c0900['push'](_0x2c0900['shift']());}};_0x146231(++_0x292e42);}(_0xd921,0x159));var _0x1d92=function(_0x329be7,_0x16c5be){_0x329be7=_0x329be7-0x0;var _0x2b6962=_0xd921[_0x329be7];return _0x2b6962;};'use strict';var multer=require(_0x1d92('0x0'));var util=require(_0x1d92('0x1'));var path=require(_0x1d92('0x2'));var timeout=require(_0x1d92('0x3'));var express=require(_0x1d92('0x4'));var router=express[_0x1d92('0x5')]();var fs_extra=require(_0x1d92('0x6'));var auth=require(_0x1d92('0x7'));var interaction=require(_0x1d92('0x8'));var config=require(_0x1d92('0x9'));var controller=require('./userProfileResource.controller');router[_0x1d92('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x1d92('0xb'),auth[_0x1d92('0xc')](),controller[_0x1d92('0xd')]);router['get']('/:id',auth[_0x1d92('0xc')](),controller['show']);router[_0x1d92('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1d92('0xf')](_0x1d92('0x10'),auth[_0x1d92('0xc')](),controller[_0x1d92('0x11')]);router['delete'](_0x1d92('0x10'),auth[_0x1d92('0xc')](),controller[_0x1d92('0x12')]);module[_0x1d92('0x13')]=router; \ No newline at end of file +var _0x936d=['/:id','post','create','put','update','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe'];(function(_0x2ad29b,_0x15be67){var _0x292844=function(_0x288c76){while(--_0x288c76){_0x2ad29b['push'](_0x2ad29b['shift']());}};_0x292844(++_0x15be67);}(_0x936d,0x127));var _0xd936=function(_0x1b9dac,_0x450e19){_0x1b9dac=_0x1b9dac-0x0;var _0x27bb56=_0x936d[_0x1b9dac];return _0x27bb56;};'use strict';var multer=require(_0xd936('0x0'));var util=require('util');var path=require(_0xd936('0x1'));var timeout=require(_0xd936('0x2'));var express=require('express');var router=express[_0xd936('0x3')]();var fs_extra=require(_0xd936('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd936('0x5'));var config=require('../../config/environment');var controller=require('./userProfileResource.controller');router[_0xd936('0x6')]('/',auth[_0xd936('0x7')](),controller[_0xd936('0x8')]);router['get'](_0xd936('0x9'),auth[_0xd936('0x7')](),controller[_0xd936('0xa')]);router[_0xd936('0x6')](_0xd936('0xb'),auth[_0xd936('0x7')](),controller['show']);router[_0xd936('0xc')]('/',auth[_0xd936('0x7')](),controller[_0xd936('0xd')]);router[_0xd936('0xe')](_0xd936('0xb'),auth[_0xd936('0x7')](),controller[_0xd936('0xf')]);router['delete'](_0xd936('0xb'),auth[_0xd936('0x7')](),controller[_0xd936('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index e0c9eb6..01adbe6 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 _0xe003=['exports','INTEGER','STRING'];(function(_0x404089,_0x328946){var _0x1d425f=function(_0x2c9e32){while(--_0x2c9e32){_0x404089['push'](_0x404089['shift']());}};_0x1d425f(++_0x328946);}(_0xe003,0x195));var _0x3e00=function(_0x1bd02e,_0x254edf){_0x1bd02e=_0x1bd02e-0x0;var _0x11e56a=_0xe003[_0x1bd02e];return _0x11e56a;};'use strict';var Sequelize=require('sequelize');module[_0x3e00('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x3e00('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x3e00('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xe933=['INTEGER','sequelize','exports','STRING'];(function(_0x13bcfa,_0x32d862){var _0x174210=function(_0x5b21b5){while(--_0x5b21b5){_0x13bcfa['push'](_0x13bcfa['shift']());}};_0x174210(++_0x32d862);}(_0xe933,0x131));var _0x3e93=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xe933[_0x25e7cb];return _0x375d92;};'use strict';var Sequelize=require(_0x3e93('0x0'));module[_0x3e93('0x1')]={'name':{'type':Sequelize[_0x3e93('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x3e93('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x3e93('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index c8aefac..020ddc2 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 _0xe2fe=['find','body','params','describe','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','name','send','index','map','UserProfileResource','rawAttributes','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show'];(function(_0x158e3b,_0x4534b){var _0x551a1d=function(_0x629c21){while(--_0x629c21){_0x158e3b['push'](_0x158e3b['shift']());}};_0x551a1d(++_0x4534b);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];function respondWithStatusCode(_0x346dbc,_0xa13e7b){_0xa13e7b=_0xa13e7b||0xcc;return function(_0x100449){if(_0x100449){return _0x346dbc[_0xee2f('0x11')](_0xa13e7b);}return _0x346dbc[_0xee2f('0x12')](_0xa13e7b)['end']();};}function respondWithResult(_0x3861e6,_0x531c3a){_0x531c3a=_0x531c3a||0xc8;return function(_0x36db10){if(_0x36db10){return _0x3861e6[_0xee2f('0x12')](_0x531c3a)['json'](_0x36db10);}};}function respondWithFilteredResult(_0x445ba8,_0x145241){return function(_0x28b614){if(_0x28b614){var _0x1bbf7d=typeof _0x145241[_0xee2f('0x13')]==='undefined'&&typeof _0x145241[_0xee2f('0x14')]==='undefined';var _0x17d288=_0x28b614[_0xee2f('0x15')];var _0x502eb6=_0x1bbf7d?0x0:_0x145241['offset'];var _0x40b5bc=_0x1bbf7d?_0x28b614['count']:_0x145241[_0xee2f('0x13')]+_0x145241[_0xee2f('0x14')];var _0x28549d;if(_0x40b5bc>=_0x17d288){_0x40b5bc=_0x17d288;_0x28549d=0xc8;}else{_0x28549d=0xce;}_0x445ba8['status'](_0x28549d);return _0x445ba8[_0xee2f('0x16')](_0xee2f('0x17'),_0x502eb6+'-'+_0x40b5bc+'/'+_0x17d288)[_0xee2f('0x18')](_0x28b614);}return null;};}function patchUpdates(_0x21fdf4){return function(_0x3d892d){try{jsonpatch['apply'](_0x3d892d,_0x21fdf4,!![]);}catch(_0x5e73ad){return BPromise[_0xee2f('0x19')](_0x5e73ad);}return _0x3d892d[_0xee2f('0x1a')]();};}function saveUpdates(_0x1ea808,_0x203b2f){return function(_0x472e3b){if(_0x472e3b){return _0x472e3b[_0xee2f('0x1b')](_0x1ea808)[_0xee2f('0x1c')](function(_0x4d68d3){return _0x4d68d3;});}return null;};}function removeEntity(_0x250399,_0x2c47c5){return function(_0x15ceda){if(_0x15ceda){return _0x15ceda[_0xee2f('0x1d')]()[_0xee2f('0x1c')](function(){_0x250399[_0xee2f('0x12')](0xcc)[_0xee2f('0x1e')]();});}};}function handleEntityNotFound(_0x13013f,_0x382174){return function(_0x1e394f){if(!_0x1e394f){_0x13013f[_0xee2f('0x11')](0x194);}return _0x1e394f;};}function handleError(_0x168adc,_0x1c8454){_0x1c8454=_0x1c8454||0x1f4;return function(_0x45c4a0){logger['error'](_0x45c4a0['stack']);if(_0x45c4a0['name']){delete _0x45c4a0[_0xee2f('0x1f')];}_0x168adc[_0xee2f('0x12')](_0x1c8454)[_0xee2f('0x20')](_0x45c4a0);};}exports[_0xee2f('0x21')]=function(_0x892a4e,_0x3737fd){var _0x4d8398={},_0x3d3806={},_0x52e1fa={'count':0x0,'rows':[]};var _0x235697=_[_0xee2f('0x22')](db[_0xee2f('0x23')][_0xee2f('0x24')],function(_0x3ddbe3){return{'name':_0x3ddbe3['fieldName'],'type':_0x3ddbe3[_0xee2f('0x25')][_0xee2f('0x26')]};});_0x3d3806['model']=_['map'](_0x235697,_0xee2f('0x1f'));_0x3d3806['query']=_[_0xee2f('0x27')](_0x892a4e[_0xee2f('0x28')]);_0x3d3806['filters']=_[_0xee2f('0x29')](_0x3d3806['model'],_0x3d3806['query']);_0x4d8398['attributes']=_[_0xee2f('0x29')](_0x3d3806[_0xee2f('0x2a')],qs['fields'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x2b')]));_0x4d8398[_0xee2f('0x2c')]=_0x4d8398[_0xee2f('0x2c')][_0xee2f('0x2d')]?_0x4d8398['attributes']:_0x3d3806[_0xee2f('0x2a')];if(!_0x892a4e['query'][_0xee2f('0x2e')](_0xee2f('0x2f'))){_0x4d8398[_0xee2f('0x14')]=qs['limit'](_0x892a4e[_0xee2f('0x28')]['limit']);_0x4d8398[_0xee2f('0x13')]=qs['offset'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x13')]);}_0x4d8398[_0xee2f('0x30')]=qs[_0xee2f('0x31')](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x31')]);_0x4d8398[_0xee2f('0x32')]=qs[_0xee2f('0x33')](_[_0xee2f('0x34')](_0x892a4e[_0xee2f('0x28')],_0x3d3806[_0xee2f('0x33')]),_0x235697);if(_0x892a4e['query'][_0xee2f('0x35')]){_0x4d8398['where']=_[_0xee2f('0x36')](_0x4d8398[_0xee2f('0x32')],{'$or':_[_0xee2f('0x22')](_0x235697,function(_0x2cbb89){if(_0x2cbb89[_0xee2f('0x25')]!==_0xee2f('0x37')){var _0x694950={};_0x694950[_0x2cbb89[_0xee2f('0x1f')]]={'$like':'%'+_0x892a4e['query']['filter']+'%'};return _0x694950;}})});}_0x4d8398=_['merge']({},_0x4d8398,_0x892a4e[_0xee2f('0x38')]);var _0x5483ae={'where':_0x4d8398[_0xee2f('0x32')]};return db['UserProfileResource']['count'](_0x5483ae)['then'](function(_0x58e361){_0x52e1fa[_0xee2f('0x15')]=_0x58e361;if(_0x892a4e[_0xee2f('0x28')][_0xee2f('0x39')]){_0x4d8398[_0xee2f('0x3a')]=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x4d8398);})[_0xee2f('0x1c')](function(_0x5e12b7){_0x52e1fa['rows']=_0x5e12b7;return _0x52e1fa;})[_0xee2f('0x1c')](respondWithFilteredResult(_0x3737fd,_0x4d8398))[_0xee2f('0x3b')](handleError(_0x3737fd,null));};exports[_0xee2f('0x3c')]=function(_0x54130b,_0x3bc173){var _0x27c447={'raw':![],'where':{'id':_0x54130b['params']['id']}},_0x19bd4d={};_0x19bd4d['model']=_[_0xee2f('0x27')](db[_0xee2f('0x23')][_0xee2f('0x24')]);_0x19bd4d[_0xee2f('0x28')]=_['keys'](_0x54130b[_0xee2f('0x28')]);_0x19bd4d[_0xee2f('0x33')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],_0x19bd4d[_0xee2f('0x28')]);_0x27c447[_0xee2f('0x2c')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],qs[_0xee2f('0x2b')](_0x54130b[_0xee2f('0x28')]['fields']));_0x27c447['attributes']=_0x27c447['attributes']['length']?_0x27c447[_0xee2f('0x2c')]:_0x19bd4d[_0xee2f('0x2a')];if(_0x54130b[_0xee2f('0x28')][_0xee2f('0x39')]){_0x27c447[_0xee2f('0x3a')]=[{'all':!![]}];}_0x27c447=_['merge']({},_0x27c447,_0x54130b[_0xee2f('0x38')]);return db[_0xee2f('0x23')][_0xee2f('0x3d')](_0x27c447)[_0xee2f('0x1c')](handleEntityNotFound(_0x3bc173,null))['then'](respondWithResult(_0x3bc173,null))['catch'](handleError(_0x3bc173,null));};exports['create']=function(_0x1609f0,_0x54cc44){return db['UserProfileResource']['create'](_0x1609f0['body'],{})[_0xee2f('0x1c')](respondWithResult(_0x54cc44,0xc9))[_0xee2f('0x3b')](handleError(_0x54cc44,null));};exports[_0xee2f('0x1b')]=function(_0x584383,_0x22506e){if(_0x584383['body']['id']){delete _0x584383[_0xee2f('0x3e')]['id'];}return db[_0xee2f('0x23')][_0xee2f('0x3d')]({'where':{'id':_0x584383[_0xee2f('0x3f')]['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x22506e,null))['then'](saveUpdates(_0x584383['body'],null))[_0xee2f('0x1c')](respondWithResult(_0x22506e,null))['catch'](handleError(_0x22506e,null));};exports[_0xee2f('0x1d')]=function(_0x282e89,_0x1928f8){return db[_0xee2f('0x23')]['find']({'where':{'id':_0x282e89['params']['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x1928f8,null))[_0xee2f('0x1c')](removeEntity(_0x1928f8,null))[_0xee2f('0x3b')](handleError(_0x1928f8,null));};exports[_0xee2f('0x40')]=function(_0x3acae6,_0x2a450f){return db[_0xee2f('0x23')][_0xee2f('0x40')]()[_0xee2f('0x1c')](respondWithResult(_0x2a450f,null))[_0xee2f('0x3b')](handleError(_0x2a450f,null));}; \ No newline at end of file +var _0x4975=['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','UserProfileResource','count','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x48f431,_0x5c31c9){var _0x35c1c4=function(_0x1d0b76){while(--_0x1d0b76){_0x48f431['push'](_0x48f431['shift']());}};_0x35c1c4(++_0x5c31c9);}(_0x4975,0x86));var _0x5497=function(_0x1e2c52,_0xc4f659){_0x1e2c52=_0x1e2c52-0x0;var _0x87892f=_0x4975[_0x1e2c52];return _0x87892f;};'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['UserProfileResource']['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['UserProfileResource'][_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')]['create'](_0xc78abe[_0x5497('0x46')],{})[_0x5497('0x24')](respondWithResult(_0x466287,0xc9))[_0x5497('0x40')](handleError(_0x466287,null));};exports['update']=function(_0x3e4da2,_0x530475){if(_0x3e4da2[_0x5497('0x46')]['id']){delete _0x3e4da2[_0x5497('0x46')]['id'];}return db[_0x5497('0x3b')]['find']({'where':{'id':_0x3e4da2[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x530475,null))['then'](saveUpdates(_0x3e4da2[_0x5497('0x46')],null))['then'](respondWithResult(_0x530475,null))[_0x5497('0x40')](handleError(_0x530475,null));};exports['destroy']=function(_0x416f76,_0x400860){return db[_0x5497('0x3b')][_0x5497('0x44')]({'where':{'id':_0x416f76[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x400860,null))[_0x5497('0x24')](removeEntity(_0x400860,null))[_0x5497('0x40')](handleError(_0x400860,null));};exports['describe']=function(_0x1f73eb,_0x5b2c22){return db['UserProfileResource'][_0x5497('0x47')]()[_0x5497('0x24')](respondWithResult(_0x5b2c22,null))['catch'](handleError(_0x5b2c22,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 7628e05..d8f99d9 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 _0x5124=['define','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x34bd77,_0x1758c6){var _0x11064f=function(_0x5c9d26){while(--_0x5c9d26){_0x34bd77['push'](_0x34bd77['shift']());}};_0x11064f(++_0x1758c6);}(_0x5124,0x164));var _0x4512=function(_0x15d58a,_0xe0cc58){_0x15d58a=_0x15d58a-0x0;var _0x32bd9d=_0x5124[_0x15d58a];return _0x32bd9d;};'use strict';var _=require(_0x4512('0x0'));var util=require(_0x4512('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4512('0x2'));var BPromise=require(_0x4512('0x3'));var rp=require(_0x4512('0x4'));var fs=require('fs');var path=require(_0x4512('0x5'));var rimraf=require(_0x4512('0x6'));var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module[_0x4512('0x7')]=function(_0x4afb73,_0x4af356){return _0x4afb73[_0x4512('0x8')]('UserProfileResource',attributes,{'tableName':_0x4512('0x9'),'paranoid':![],'indexes':[{'name':_0x4512('0xa'),'fields':[_0x4512('0xb'),_0x4512('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x262c=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','user_profile_has_resources'];(function(_0x3c3b8a,_0x3abfa9){var _0x11bea0=function(_0x2149bb){while(--_0x2149bb){_0x3c3b8a['push'](_0x3c3b8a['shift']());}};_0x11bea0(++_0x3abfa9);}(_0x262c,0x138));var _0xc262=function(_0x3f6565,_0x12a8bb){_0x3f6565=_0x3f6565-0x0;var _0x4abd23=_0x262c[_0x3f6565];return _0x4abd23;};'use strict';var _=require('lodash');var util=require(_0xc262('0x0'));var logger=require(_0xc262('0x1'))(_0xc262('0x2'));var moment=require(_0xc262('0x3'));var BPromise=require(_0xc262('0x4'));var rp=require(_0xc262('0x5'));var fs=require('fs');var path=require(_0xc262('0x6'));var rimraf=require('rimraf');var config=require(_0xc262('0x7'));var attributes=require(_0xc262('0x8'));module[_0xc262('0x9')]=function(_0x3e5213,_0x5ae641){return _0x3e5213['define'](_0xc262('0xa'),attributes,{'tableName':_0xc262('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','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 9ab3263..2d22fe9 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 _0xdf1d=['request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xdf1d,0xe6));var _0xddf1=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xdf1d[_0x23e7c1];return _0x1add43;};'use strict';var _=require('lodash');var util=require(_0xddf1('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xddf1('0x1'));var fs=require('fs');var Redis=require(_0xddf1('0x2'));var db=require(_0xddf1('0x3'))['db'];var utils=require(_0xddf1('0x4'));var logger=require(_0xddf1('0x5'))(_0xddf1('0x6'));var config=require(_0xddf1('0x7'));var jayson=require(_0xddf1('0x8'));var client=jayson['client'][_0xddf1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x311ca4,_0x403190,_0x5e70d9){return new BPromise(function(_0x51f6b9,_0xafe071){return client[_0xddf1('0xa')](_0x311ca4,_0x5e70d9)[_0xddf1('0xb')](function(_0x3cdf6a){logger[_0xddf1('0xc')](_0xddf1('0xd'),_0x403190,_0xddf1('0xe'));logger['debug']('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x403190,_0xddf1('0xe'),JSON[_0xddf1('0xf')](_0x3cdf6a));if(_0x3cdf6a[_0xddf1('0x10')]){if(_0x3cdf6a[_0xddf1('0x10')]['code']===0x1f4){logger[_0xddf1('0x10')](_0xddf1('0xd'),_0x403190,_0x3cdf6a[_0xddf1('0x10')][_0xddf1('0x11')]);return _0xafe071(_0x3cdf6a[_0xddf1('0x10')][_0xddf1('0x11')]);}logger[_0xddf1('0x10')](_0xddf1('0xd'),_0x403190,_0x3cdf6a['error'][_0xddf1('0x11')]);return _0x51f6b9(_0x3cdf6a['error'][_0xddf1('0x11')]);}else{logger[_0xddf1('0xc')](_0xddf1('0xd'),_0x403190,_0xddf1('0xe'));_0x51f6b9(_0x3cdf6a[_0xddf1('0x12')]['message']);}})[_0xddf1('0x13')](function(_0xb4c207){logger[_0xddf1('0x10')](_0xddf1('0xd'),_0x403190,_0xb4c207);_0xafe071(_0xb4c207);});});} \ No newline at end of file +var _0x8bab=['request\x20sent','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','UserProfileResource,\x20%s,\x20%s','debug'];(function(_0x4f89ff,_0x5e466b){var _0x42f34c=function(_0x2806d6){while(--_0x2806d6){_0x4f89ff['push'](_0x4f89ff['shift']());}};_0x42f34c(++_0x5e466b);}(_0x8bab,0x17b));var _0xb8ba=function(_0x36292d,_0x2b478f){_0x36292d=_0x36292d-0x0;var _0x586e45=_0x8bab[_0x36292d];return _0x586e45;};'use strict';var _=require(_0xb8ba('0x0'));var util=require(_0xb8ba('0x1'));var moment=require(_0xb8ba('0x2'));var BPromise=require(_0xb8ba('0x3'));var rs=require(_0xb8ba('0x4'));var fs=require('fs');var Redis=require(_0xb8ba('0x5'));var db=require(_0xb8ba('0x6'))['db'];var utils=require(_0xb8ba('0x7'));var logger=require('../../config/logger')(_0xb8ba('0x8'));var config=require(_0xb8ba('0x9'));var jayson=require(_0xb8ba('0xa'));var client=jayson[_0xb8ba('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x349f83,_0x13130d,_0x5b0a98){return new BPromise(function(_0x46242f,_0x2b0cf4){return client[_0xb8ba('0xc')](_0x349f83,_0x5b0a98)[_0xb8ba('0xd')](function(_0x413a5c){logger[_0xb8ba('0xe')](_0xb8ba('0xf'),_0x13130d,'request\x20sent');logger[_0xb8ba('0x10')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x13130d,_0xb8ba('0x11'),JSON['stringify'](_0x413a5c));if(_0x413a5c[_0xb8ba('0x12')]){if(_0x413a5c['error'][_0xb8ba('0x13')]===0x1f4){logger[_0xb8ba('0x12')](_0xb8ba('0xf'),_0x13130d,_0x413a5c[_0xb8ba('0x12')][_0xb8ba('0x14')]);return _0x2b0cf4(_0x413a5c[_0xb8ba('0x12')][_0xb8ba('0x14')]);}logger[_0xb8ba('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x13130d,_0x413a5c['error'][_0xb8ba('0x14')]);return _0x46242f(_0x413a5c['error'][_0xb8ba('0x14')]);}else{logger['info'](_0xb8ba('0xf'),_0x13130d,_0xb8ba('0x11'));_0x46242f(_0x413a5c[_0xb8ba('0x15')][_0xb8ba('0x14')]);}})['catch'](function(_0x1f3185){logger[_0xb8ba('0x12')](_0xb8ba('0xf'),_0x13130d,_0x1f3185);_0x2b0cf4(_0x1f3185);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 35828f6..fa103d9 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 _0x756f=['isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileSection.controller','get'];(function(_0x57cb0c,_0x68623){var _0x57241b=function(_0x5b844d){while(--_0x5b844d){_0x57cb0c['push'](_0x57cb0c['shift']());}};_0x57241b(++_0x68623);}(_0x756f,0x114));var _0xf756=function(_0x27591e,_0x34b0ad){_0x27591e=_0x27591e-0x0;var _0xeb941d=_0x756f[_0x27591e];return _0xeb941d;};'use strict';var multer=require('multer');var util=require(_0xf756('0x0'));var path=require(_0xf756('0x1'));var timeout=require(_0xf756('0x2'));var express=require('express');var router=express[_0xf756('0x3')]();var fs_extra=require(_0xf756('0x4'));var auth=require(_0xf756('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf756('0x6'));var controller=require(_0xf756('0x7'));router[_0xf756('0x8')]('/',auth[_0xf756('0x9')](),controller[_0xf756('0xa')]);router['get'](_0xf756('0xb'),auth[_0xf756('0x9')](),controller[_0xf756('0xc')]);router[_0xf756('0x8')](_0xf756('0xd'),auth[_0xf756('0x9')](),controller[_0xf756('0xe')]);router['post']('/',auth[_0xf756('0x9')](),controller[_0xf756('0xf')]);router['put'](_0xf756('0xd'),auth[_0xf756('0x9')](),controller[_0xf756('0x10')]);router[_0xf756('0x11')](_0xf756('0xd'),auth[_0xf756('0x9')](),controller['destroy']);module[_0xf756('0x12')]=router; \ No newline at end of file +var _0xd61a=['put','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd61a,0xca));var _0xad61=function(_0x479143,_0x4e798d){_0x479143=_0x479143-0x0;var _0x3a47f5=_0xd61a[_0x479143];return _0x3a47f5;};'use strict';var multer=require(_0xad61('0x0'));var util=require(_0xad61('0x1'));var path=require(_0xad61('0x2'));var timeout=require(_0xad61('0x3'));var express=require(_0xad61('0x4'));var router=express[_0xad61('0x5')]();var fs_extra=require(_0xad61('0x6'));var auth=require(_0xad61('0x7'));var interaction=require(_0xad61('0x8'));var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router[_0xad61('0x9')]('/',auth[_0xad61('0xa')](),controller[_0xad61('0xb')]);router[_0xad61('0x9')](_0xad61('0xc'),auth[_0xad61('0xa')](),controller[_0xad61('0xd')]);router['get'](_0xad61('0xe'),auth['isAuthenticated'](),controller[_0xad61('0xf')]);router[_0xad61('0x10')]('/',auth[_0xad61('0xa')](),controller[_0xad61('0x11')]);router[_0xad61('0x12')](_0xad61('0xe'),auth[_0xad61('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xad61('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 9359fd8..cef4d86 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 _0xe5b5=['exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','sequelize'];(function(_0x89fffe,_0x1ef3ba){var _0x4a9fad=function(_0x8690eb){while(--_0x8690eb){_0x89fffe['push'](_0x89fffe['shift']());}};_0x4a9fad(++_0x1ef3ba);}(_0xe5b5,0x12b));var _0x5e5b=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xe5b5[_0xf71120];return _0xbe2fd3;};'use strict';var Sequelize=require(_0x5e5b('0x0'));module[_0x5e5b('0x1')]={'name':{'type':Sequelize[_0x5e5b('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x5e5b('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x5e5b('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x5e5b('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x5e5b('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x5e5b('0x2')],'set':function(_0xf20c6a){this[_0x5e5b('0x5')](_0x5e5b('0x6'),_0xf20c6a?_0xf20c6a[_0x5e5b('0x7')](''):[]);},'get':function(){return this[_0x5e5b('0x8')](_0x5e5b('0x6'))?this[_0x5e5b('0x8')](_0x5e5b('0x6'))[_0x5e5b('0x9')](''):[];}}}; \ No newline at end of file +var _0xb62e=['STRING','BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb62e,0x1de));var _0xeb62=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xb62e[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require(_0xeb62('0x0'));module[_0xeb62('0x1')]={'name':{'type':Sequelize[_0xeb62('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xeb62('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0xeb62('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xeb62('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xeb62('0x2')],'set':function(_0x929329){this[_0xeb62('0x4')](_0xeb62('0x5'),_0x929329?_0x929329['join'](''):[]);},'get':function(){return this[_0xeb62('0x6')](_0xeb62('0x5'))?this[_0xeb62('0x6')]('crudPermissions')[_0xeb62('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 0983ac3..ccc05f9 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 _0x88be=['create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','where','merge','VIRTUAL','options','includeAll','include','rows','catch','params'];(function(_0x335201,_0x314d57){var _0x39b053=function(_0x22d774){while(--_0x22d774){_0x335201['push'](_0x335201['shift']());}};_0x39b053(++_0x314d57);}(_0x88be,0x138));var _0xe88b=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x88be[_0x40bffc];return _0x3007e9;};'use strict';var emlformat=require(_0xe88b('0x0'));var rimraf=require(_0xe88b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe88b('0x2'));var rp=require(_0xe88b('0x3'));var moment=require(_0xe88b('0x4'));var BPromise=require(_0xe88b('0x5'));var Mustache=require(_0xe88b('0x6'));var util=require(_0xe88b('0x7'));var path=require(_0xe88b('0x8'));var sox=require(_0xe88b('0x9'));var csv=require(_0xe88b('0xa'));var ejs=require(_0xe88b('0xb'));var fs=require('fs');var fs_extra=require(_0xe88b('0xc'));var _=require(_0xe88b('0xd'));var squel=require(_0xe88b('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe88b('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe88b('0x10'));var Papa=require(_0xe88b('0x11'));var Redis=require(_0xe88b('0x12'));var authService=require(_0xe88b('0x13'));var qs=require(_0xe88b('0x14'));var as=require(_0xe88b('0x15'));var hardwareService=require(_0xe88b('0x16'));var logger=require(_0xe88b('0x17'))(_0xe88b('0x18'));var utils=require('../../config/utils');var config=require(_0xe88b('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xe88b('0x1a'))['db'];function respondWithStatusCode(_0x32e029,_0x42557c){_0x42557c=_0x42557c||0xcc;return function(_0x3bfe35){if(_0x3bfe35){return _0x32e029[_0xe88b('0x1b')](_0x42557c);}return _0x32e029[_0xe88b('0x1c')](_0x42557c)['end']();};}function respondWithResult(_0x5f00ee,_0x22405e){_0x22405e=_0x22405e||0xc8;return function(_0x3cc2f1){if(_0x3cc2f1){return _0x5f00ee[_0xe88b('0x1c')](_0x22405e)['json'](_0x3cc2f1);}};}function respondWithFilteredResult(_0x450ab1,_0x40b97b){return function(_0x2f8b9d){if(_0x2f8b9d){var _0x201e04=typeof _0x40b97b[_0xe88b('0x1d')]==='undefined'&&typeof _0x40b97b[_0xe88b('0x1e')]===_0xe88b('0x1f');var _0xb9bbc6=_0x2f8b9d[_0xe88b('0x20')];var _0x288200=_0x201e04?0x0:_0x40b97b[_0xe88b('0x1d')];var _0xef336d=_0x201e04?_0x2f8b9d[_0xe88b('0x20')]:_0x40b97b[_0xe88b('0x1d')]+_0x40b97b['limit'];var _0x11cb92;if(_0xef336d>=_0xb9bbc6){_0xef336d=_0xb9bbc6;_0x11cb92=0xc8;}else{_0x11cb92=0xce;}_0x450ab1[_0xe88b('0x1c')](_0x11cb92);return _0x450ab1[_0xe88b('0x21')](_0xe88b('0x22'),_0x288200+'-'+_0xef336d+'/'+_0xb9bbc6)[_0xe88b('0x23')](_0x2f8b9d);}return null;};}function patchUpdates(_0x61771d){return function(_0x5ec1a3){try{jsonpatch[_0xe88b('0x24')](_0x5ec1a3,_0x61771d,!![]);}catch(_0xc44f0d){return BPromise[_0xe88b('0x25')](_0xc44f0d);}return _0x5ec1a3[_0xe88b('0x26')]();};}function saveUpdates(_0x53094a,_0x1c28c2){return function(_0xfba5d1){if(_0xfba5d1){return _0xfba5d1[_0xe88b('0x27')](_0x53094a)[_0xe88b('0x28')](function(_0x38ff83){return _0x38ff83;});}return null;};}function removeEntity(_0x32329e,_0x47cc5e){return function(_0x5c2498){if(_0x5c2498){return _0x5c2498[_0xe88b('0x29')]()['then'](function(){_0x32329e['status'](0xcc)[_0xe88b('0x2a')]();});}};}function handleEntityNotFound(_0x1778cd,_0x3c8e81){return function(_0x19b843){if(!_0x19b843){_0x1778cd[_0xe88b('0x1b')](0x194);}return _0x19b843;};}function handleError(_0x94cd9b,_0x30c046){_0x30c046=_0x30c046||0x1f4;return function(_0x4a62e6){logger[_0xe88b('0x2b')](_0x4a62e6[_0xe88b('0x2c')]);if(_0x4a62e6[_0xe88b('0x2d')]){delete _0x4a62e6['name'];}_0x94cd9b[_0xe88b('0x1c')](_0x30c046)[_0xe88b('0x2e')](_0x4a62e6);};}exports[_0xe88b('0x2f')]=function(_0x4607c6,_0x341513){var _0x370b42={},_0x45ecfe={},_0x10533f={'count':0x0,'rows':[]};var _0x211dd6=_[_0xe88b('0x30')](db[_0xe88b('0x31')][_0xe88b('0x32')],function(_0x31df74){return{'name':_0x31df74[_0xe88b('0x33')],'type':_0x31df74[_0xe88b('0x34')][_0xe88b('0x35')]};});_0x45ecfe[_0xe88b('0x36')]=_[_0xe88b('0x30')](_0x211dd6,_0xe88b('0x2d'));_0x45ecfe[_0xe88b('0x37')]=_[_0xe88b('0x38')](_0x4607c6[_0xe88b('0x37')]);_0x45ecfe[_0xe88b('0x39')]=_[_0xe88b('0x3a')](_0x45ecfe[_0xe88b('0x36')],_0x45ecfe['query']);_0x370b42[_0xe88b('0x3b')]=_[_0xe88b('0x3a')](_0x45ecfe[_0xe88b('0x36')],qs['fields'](_0x4607c6[_0xe88b('0x37')]['fields']));_0x370b42[_0xe88b('0x3b')]=_0x370b42['attributes'][_0xe88b('0x3c')]?_0x370b42[_0xe88b('0x3b')]:_0x45ecfe[_0xe88b('0x36')];if(!_0x4607c6[_0xe88b('0x37')][_0xe88b('0x3d')](_0xe88b('0x3e'))){_0x370b42['limit']=qs[_0xe88b('0x1e')](_0x4607c6[_0xe88b('0x37')]['limit']);_0x370b42[_0xe88b('0x1d')]=qs['offset'](_0x4607c6[_0xe88b('0x37')][_0xe88b('0x1d')]);}_0x370b42[_0xe88b('0x3f')]=qs['sort'](_0x4607c6[_0xe88b('0x37')]['sort']);_0x370b42[_0xe88b('0x40')]=qs['filters'](_['pick'](_0x4607c6[_0xe88b('0x37')],_0x45ecfe[_0xe88b('0x39')]),_0x211dd6);if(_0x4607c6['query']['filter']){_0x370b42[_0xe88b('0x40')]=_[_0xe88b('0x41')](_0x370b42[_0xe88b('0x40')],{'$or':_[_0xe88b('0x30')](_0x211dd6,function(_0x1ab081){if(_0x1ab081[_0xe88b('0x34')]!==_0xe88b('0x42')){var _0x111a6e={};_0x111a6e[_0x1ab081[_0xe88b('0x2d')]]={'$like':'%'+_0x4607c6[_0xe88b('0x37')]['filter']+'%'};return _0x111a6e;}})});}_0x370b42=_['merge']({},_0x370b42,_0x4607c6[_0xe88b('0x43')]);var _0x28edfd={'where':_0x370b42['where']};return db[_0xe88b('0x31')]['count'](_0x28edfd)[_0xe88b('0x28')](function(_0x4fa4b9){_0x10533f[_0xe88b('0x20')]=_0x4fa4b9;if(_0x4607c6['query'][_0xe88b('0x44')]){_0x370b42[_0xe88b('0x45')]=[{'all':!![]}];}return db[_0xe88b('0x31')]['findAll'](_0x370b42);})[_0xe88b('0x28')](function(_0x149d9b){_0x10533f[_0xe88b('0x46')]=_0x149d9b;return _0x10533f;})[_0xe88b('0x28')](respondWithFilteredResult(_0x341513,_0x370b42))[_0xe88b('0x47')](handleError(_0x341513,null));};exports['show']=function(_0x2da82e,_0x467433){var _0x28aafe={'raw':![],'where':{'id':_0x2da82e[_0xe88b('0x48')]['id']}},_0x425368={};_0x425368[_0xe88b('0x36')]=_[_0xe88b('0x38')](db[_0xe88b('0x31')]['rawAttributes']);_0x425368['query']=_['keys'](_0x2da82e[_0xe88b('0x37')]);_0x425368[_0xe88b('0x39')]=_[_0xe88b('0x3a')](_0x425368[_0xe88b('0x36')],_0x425368[_0xe88b('0x37')]);_0x28aafe[_0xe88b('0x3b')]=_[_0xe88b('0x3a')](_0x425368[_0xe88b('0x36')],qs['fields'](_0x2da82e[_0xe88b('0x37')]['fields']));_0x28aafe[_0xe88b('0x3b')]=_0x28aafe[_0xe88b('0x3b')][_0xe88b('0x3c')]?_0x28aafe[_0xe88b('0x3b')]:_0x425368['model'];if(_0x2da82e[_0xe88b('0x37')]['includeAll']){_0x28aafe[_0xe88b('0x45')]=[{'all':!![]}];}_0x28aafe=_[_0xe88b('0x41')]({},_0x28aafe,_0x2da82e[_0xe88b('0x43')]);return db['UserProfileSection']['find'](_0x28aafe)[_0xe88b('0x28')](handleEntityNotFound(_0x467433,null))[_0xe88b('0x28')](respondWithResult(_0x467433,null))[_0xe88b('0x47')](handleError(_0x467433,null));};exports[_0xe88b('0x49')]=function(_0x9e08a8,_0x34f411){return db[_0xe88b('0x31')]['create'](_0x9e08a8[_0xe88b('0x4a')],{})[_0xe88b('0x28')](respondWithResult(_0x34f411,0xc9))[_0xe88b('0x47')](handleError(_0x34f411,null));};exports[_0xe88b('0x27')]=function(_0x26572f,_0x3c65be){if(_0x26572f['body']['id']){delete _0x26572f[_0xe88b('0x4a')]['id'];}return db[_0xe88b('0x31')][_0xe88b('0x4b')]({'where':{'id':_0x26572f['params']['id']}})[_0xe88b('0x28')](handleEntityNotFound(_0x3c65be,null))[_0xe88b('0x28')](saveUpdates(_0x26572f['body'],null))[_0xe88b('0x28')](respondWithResult(_0x3c65be,null))[_0xe88b('0x47')](handleError(_0x3c65be,null));};exports[_0xe88b('0x29')]=function(_0x3463bc,_0x47a016){return db['UserProfileSection'][_0xe88b('0x4b')]({'where':{'id':_0x3463bc[_0xe88b('0x48')]['id']}})[_0xe88b('0x28')](handleEntityNotFound(_0x47a016,null))['then'](removeEntity(_0x47a016,null))[_0xe88b('0x47')](handleError(_0x47a016,null));};exports[_0xe88b('0x4c')]=function(_0x430f6c,_0x1ca835){return db[_0xe88b('0x31')][_0xe88b('0x4c')]()['then'](respondWithResult(_0x1ca835,null))[_0xe88b('0x47')](handleError(_0x1ca835,null));}; \ No newline at end of file +var _0xb4b6=['Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','UserProfileSection','include','findAll','catch','show','includeAll','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','bluebird','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set'];(function(_0x17b943,_0x2aaf1c){var _0x15d5da=function(_0x35eb4e){while(--_0x35eb4e){_0x17b943['push'](_0x17b943['shift']());}};_0x15d5da(++_0x2aaf1c);}(_0xb4b6,0xff));var _0x6b4b=function(_0x459310,_0x4b0729){_0x459310=_0x459310-0x0;var _0x107928=_0xb4b6[_0x459310];return _0x107928;};'use strict';var emlformat=require(_0x6b4b('0x0'));var rimraf=require(_0x6b4b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6b4b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6b4b('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x6b4b('0x4'));var csv=require(_0x6b4b('0x5'));var ejs=require(_0x6b4b('0x6'));var fs=require('fs');var fs_extra=require(_0x6b4b('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6b4b('0x8'));var jsforce=require(_0x6b4b('0x9'));var deskjs=require(_0x6b4b('0xa'));var toCsv=require(_0x6b4b('0x5'));var querystring=require(_0x6b4b('0xb'));var Papa=require('papaparse');var Redis=require(_0x6b4b('0xc'));var authService=require(_0x6b4b('0xd'));var qs=require(_0x6b4b('0xe'));var as=require(_0x6b4b('0xf'));var hardwareService=require(_0x6b4b('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x6b4b('0x11'));var licenseUtil=require(_0x6b4b('0x12'));var db=require(_0x6b4b('0x13'))['db'];function respondWithStatusCode(_0xaefe44,_0x44ce15){_0x44ce15=_0x44ce15||0xcc;return function(_0x41275f){if(_0x41275f){return _0xaefe44[_0x6b4b('0x14')](_0x44ce15);}return _0xaefe44[_0x6b4b('0x15')](_0x44ce15)[_0x6b4b('0x16')]();};}function respondWithResult(_0x907076,_0x2415c3){_0x2415c3=_0x2415c3||0xc8;return function(_0x1bdc47){if(_0x1bdc47){return _0x907076[_0x6b4b('0x15')](_0x2415c3)[_0x6b4b('0x17')](_0x1bdc47);}};}function respondWithFilteredResult(_0x42e03c,_0x222ddd){return function(_0x3adea3){if(_0x3adea3){var _0x4fb90c=typeof _0x222ddd[_0x6b4b('0x18')]==='undefined'&&typeof _0x222ddd[_0x6b4b('0x19')]===_0x6b4b('0x1a');var _0x5f510e=_0x3adea3['count'];var _0xbfbe4e=_0x4fb90c?0x0:_0x222ddd[_0x6b4b('0x18')];var _0x378662=_0x4fb90c?_0x3adea3[_0x6b4b('0x1b')]:_0x222ddd[_0x6b4b('0x18')]+_0x222ddd['limit'];var _0x458524;if(_0x378662>=_0x5f510e){_0x378662=_0x5f510e;_0x458524=0xc8;}else{_0x458524=0xce;}_0x42e03c['status'](_0x458524);return _0x42e03c[_0x6b4b('0x1c')](_0x6b4b('0x1d'),_0xbfbe4e+'-'+_0x378662+'/'+_0x5f510e)[_0x6b4b('0x17')](_0x3adea3);}return null;};}function patchUpdates(_0x122d60){return function(_0x2c3905){try{jsonpatch[_0x6b4b('0x1e')](_0x2c3905,_0x122d60,!![]);}catch(_0x374522){return BPromise[_0x6b4b('0x1f')](_0x374522);}return _0x2c3905[_0x6b4b('0x20')]();};}function saveUpdates(_0x3c3f1b,_0xae56ab){return function(_0x2404df){if(_0x2404df){return _0x2404df[_0x6b4b('0x21')](_0x3c3f1b)[_0x6b4b('0x22')](function(_0x3fe76e){return _0x3fe76e;});}return null;};}function removeEntity(_0x52845f,_0x5cbc51){return function(_0x2c413e){if(_0x2c413e){return _0x2c413e[_0x6b4b('0x23')]()['then'](function(){_0x52845f[_0x6b4b('0x15')](0xcc)[_0x6b4b('0x16')]();});}};}function handleEntityNotFound(_0x495d02,_0x584660){return function(_0x2f01e3){if(!_0x2f01e3){_0x495d02[_0x6b4b('0x14')](0x194);}return _0x2f01e3;};}function handleError(_0x28df2a,_0x430409){_0x430409=_0x430409||0x1f4;return function(_0x5c1a39){logger[_0x6b4b('0x24')](_0x5c1a39[_0x6b4b('0x25')]);if(_0x5c1a39[_0x6b4b('0x26')]){delete _0x5c1a39[_0x6b4b('0x26')];}_0x28df2a['status'](_0x430409)[_0x6b4b('0x27')](_0x5c1a39);};}exports[_0x6b4b('0x28')]=function(_0x7f6ebd,_0x88d64a){var _0x72b0d5={},_0x2c1b6a={},_0x302bd2={'count':0x0,'rows':[]};var _0x3a210a=_[_0x6b4b('0x29')](db['UserProfileSection'][_0x6b4b('0x2a')],function(_0x3217e7){return{'name':_0x3217e7[_0x6b4b('0x2b')],'type':_0x3217e7[_0x6b4b('0x2c')]['key']};});_0x2c1b6a[_0x6b4b('0x2d')]=_[_0x6b4b('0x29')](_0x3a210a,'name');_0x2c1b6a[_0x6b4b('0x2e')]=_[_0x6b4b('0x2f')](_0x7f6ebd[_0x6b4b('0x2e')]);_0x2c1b6a[_0x6b4b('0x30')]=_['intersection'](_0x2c1b6a[_0x6b4b('0x2d')],_0x2c1b6a[_0x6b4b('0x2e')]);_0x72b0d5[_0x6b4b('0x31')]=_[_0x6b4b('0x32')](_0x2c1b6a[_0x6b4b('0x2d')],qs[_0x6b4b('0x33')](_0x7f6ebd[_0x6b4b('0x2e')][_0x6b4b('0x33')]));_0x72b0d5[_0x6b4b('0x31')]=_0x72b0d5[_0x6b4b('0x31')][_0x6b4b('0x34')]?_0x72b0d5[_0x6b4b('0x31')]:_0x2c1b6a[_0x6b4b('0x2d')];if(!_0x7f6ebd['query']['hasOwnProperty'](_0x6b4b('0x35'))){_0x72b0d5['limit']=qs[_0x6b4b('0x19')](_0x7f6ebd[_0x6b4b('0x2e')][_0x6b4b('0x19')]);_0x72b0d5[_0x6b4b('0x18')]=qs[_0x6b4b('0x18')](_0x7f6ebd[_0x6b4b('0x2e')][_0x6b4b('0x18')]);}_0x72b0d5['order']=qs[_0x6b4b('0x36')](_0x7f6ebd[_0x6b4b('0x2e')][_0x6b4b('0x36')]);_0x72b0d5[_0x6b4b('0x37')]=qs[_0x6b4b('0x30')](_['pick'](_0x7f6ebd[_0x6b4b('0x2e')],_0x2c1b6a['filters']),_0x3a210a);if(_0x7f6ebd[_0x6b4b('0x2e')][_0x6b4b('0x38')]){_0x72b0d5[_0x6b4b('0x37')]=_[_0x6b4b('0x39')](_0x72b0d5[_0x6b4b('0x37')],{'$or':_[_0x6b4b('0x29')](_0x3a210a,function(_0xd1f30d){if(_0xd1f30d[_0x6b4b('0x2c')]!==_0x6b4b('0x3a')){var _0x528f51={};_0x528f51[_0xd1f30d[_0x6b4b('0x26')]]={'$like':'%'+_0x7f6ebd[_0x6b4b('0x2e')][_0x6b4b('0x38')]+'%'};return _0x528f51;}})});}_0x72b0d5=_[_0x6b4b('0x39')]({},_0x72b0d5,_0x7f6ebd[_0x6b4b('0x3b')]);var _0x55f7cb={'where':_0x72b0d5[_0x6b4b('0x37')]};return db[_0x6b4b('0x3c')][_0x6b4b('0x1b')](_0x55f7cb)[_0x6b4b('0x22')](function(_0x2005bb){_0x302bd2['count']=_0x2005bb;if(_0x7f6ebd[_0x6b4b('0x2e')]['includeAll']){_0x72b0d5[_0x6b4b('0x3d')]=[{'all':!![]}];}return db['UserProfileSection'][_0x6b4b('0x3e')](_0x72b0d5);})['then'](function(_0x5987a8){_0x302bd2['rows']=_0x5987a8;return _0x302bd2;})[_0x6b4b('0x22')](respondWithFilteredResult(_0x88d64a,_0x72b0d5))[_0x6b4b('0x3f')](handleError(_0x88d64a,null));};exports[_0x6b4b('0x40')]=function(_0xf1dbb6,_0x51eb23){var _0x230fae={'raw':![],'where':{'id':_0xf1dbb6['params']['id']}},_0x5851ea={};_0x5851ea[_0x6b4b('0x2d')]=_[_0x6b4b('0x2f')](db[_0x6b4b('0x3c')][_0x6b4b('0x2a')]);_0x5851ea[_0x6b4b('0x2e')]=_['keys'](_0xf1dbb6['query']);_0x5851ea[_0x6b4b('0x30')]=_['intersection'](_0x5851ea[_0x6b4b('0x2d')],_0x5851ea['query']);_0x230fae[_0x6b4b('0x31')]=_[_0x6b4b('0x32')](_0x5851ea[_0x6b4b('0x2d')],qs[_0x6b4b('0x33')](_0xf1dbb6['query'][_0x6b4b('0x33')]));_0x230fae[_0x6b4b('0x31')]=_0x230fae[_0x6b4b('0x31')][_0x6b4b('0x34')]?_0x230fae[_0x6b4b('0x31')]:_0x5851ea[_0x6b4b('0x2d')];if(_0xf1dbb6['query'][_0x6b4b('0x41')]){_0x230fae[_0x6b4b('0x3d')]=[{'all':!![]}];}_0x230fae=_[_0x6b4b('0x39')]({},_0x230fae,_0xf1dbb6['options']);return db[_0x6b4b('0x3c')][_0x6b4b('0x42')](_0x230fae)[_0x6b4b('0x22')](handleEntityNotFound(_0x51eb23,null))[_0x6b4b('0x22')](respondWithResult(_0x51eb23,null))[_0x6b4b('0x3f')](handleError(_0x51eb23,null));};exports[_0x6b4b('0x43')]=function(_0x5e6b85,_0x14dcf3){return db['UserProfileSection'][_0x6b4b('0x43')](_0x5e6b85['body'],{})[_0x6b4b('0x22')](respondWithResult(_0x14dcf3,0xc9))[_0x6b4b('0x3f')](handleError(_0x14dcf3,null));};exports[_0x6b4b('0x21')]=function(_0x13f530,_0x8ff4f2){if(_0x13f530[_0x6b4b('0x44')]['id']){delete _0x13f530['body']['id'];}return db[_0x6b4b('0x3c')][_0x6b4b('0x42')]({'where':{'id':_0x13f530['params']['id']}})[_0x6b4b('0x22')](handleEntityNotFound(_0x8ff4f2,null))[_0x6b4b('0x22')](saveUpdates(_0x13f530[_0x6b4b('0x44')],null))[_0x6b4b('0x22')](respondWithResult(_0x8ff4f2,null))[_0x6b4b('0x3f')](handleError(_0x8ff4f2,null));};exports[_0x6b4b('0x23')]=function(_0x4f0700,_0x406fbe){return db['UserProfileSection'][_0x6b4b('0x42')]({'where':{'id':_0x4f0700[_0x6b4b('0x45')]['id']}})[_0x6b4b('0x22')](handleEntityNotFound(_0x406fbe,null))[_0x6b4b('0x22')](removeEntity(_0x406fbe,null))[_0x6b4b('0x3f')](handleError(_0x406fbe,null));};exports[_0x6b4b('0x46')]=function(_0x14b108,_0x306959){return db[_0x6b4b('0x3c')]['describe']()[_0x6b4b('0x22')](respondWithResult(_0x306959,null))[_0x6b4b('0x3f')](handleError(_0x306959,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index a119c2c..d2ef6a1 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 _0x8270=['moment','bluebird','path','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','util','api'];(function(_0x4bf9aa,_0xafa1ec){var _0x1db38a=function(_0x44540e){while(--_0x44540e){_0x4bf9aa['push'](_0x4bf9aa['shift']());}};_0x1db38a(++_0xafa1ec);}(_0x8270,0xb4));var _0x0827=function(_0x1e279b,_0x10a409){_0x1e279b=_0x1e279b-0x0;var _0x117303=_0x8270[_0x1e279b];return _0x117303;};'use strict';var _=require('lodash');var util=require(_0x0827('0x0'));var logger=require('../../config/logger')(_0x0827('0x1'));var moment=require(_0x0827('0x2'));var BPromise=require(_0x0827('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0827('0x4'));var rimraf=require('rimraf');var config=require(_0x0827('0x5'));var attributes=require(_0x0827('0x6'));module[_0x0827('0x7')]=function(_0x4219fa,_0x5db768){return _0x4219fa[_0x0827('0x8')](_0x0827('0x9'),attributes,{'tableName':_0x0827('0xa'),'paranoid':![],'indexes':[{'name':_0x0827('0xb'),'fields':[_0x0827('0xc'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6faf=['sectionId','userProfileId','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./userProfileSection.attributes','define','UserProfileSection','user_profile_has_sections'];(function(_0x5c9d1b,_0x2e22a1){var _0x2730d4=function(_0xd74c3f){while(--_0xd74c3f){_0x5c9d1b['push'](_0x5c9d1b['shift']());}};_0x2730d4(++_0x2e22a1);}(_0x6faf,0xf9));var _0xf6fa=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6faf[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xf6fa('0x0'));var logger=require(_0xf6fa('0x1'))(_0xf6fa('0x2'));var moment=require(_0xf6fa('0x3'));var BPromise=require(_0xf6fa('0x4'));var rp=require(_0xf6fa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf6fa('0x6'));var config=require('../../config/environment');var attributes=require(_0xf6fa('0x7'));module['exports']=function(_0xe883dd,_0x3c91fc){return _0xe883dd[_0xf6fa('0x8')](_0xf6fa('0x9'),attributes,{'tableName':_0xf6fa('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xf6fa('0xb'),_0xf6fa('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 4435aab..ef6d51a 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 _0xfead=['../../config/logger','../../config/environment','jayson/promise','http','request','then','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x8560d3,_0x26a504){var _0x33b1b5=function(_0x3a2cad){while(--_0x3a2cad){_0x8560d3['push'](_0x8560d3['shift']());}};_0x33b1b5(++_0x26a504);}(_0xfead,0x1d8));var _0xdfea=function(_0x5a101a,_0x5908bd){_0x5a101a=_0x5a101a-0x0;var _0x49f13c=_0xfead[_0x5a101a];return _0x49f13c;};'use strict';var _=require(_0xdfea('0x0'));var util=require(_0xdfea('0x1'));var moment=require(_0xdfea('0x2'));var BPromise=require(_0xdfea('0x3'));var rs=require(_0xdfea('0x4'));var fs=require('fs');var Redis=require(_0xdfea('0x5'));var db=require(_0xdfea('0x6'))['db'];var utils=require(_0xdfea('0x7'));var logger=require(_0xdfea('0x8'))('rpc');var config=require(_0xdfea('0x9'));var jayson=require(_0xdfea('0xa'));var client=jayson['client'][_0xdfea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a4c7a,_0x3c538f,_0x3235ae){return new BPromise(function(_0x201463,_0x5f279b){return client[_0xdfea('0xc')](_0x5a4c7a,_0x3235ae)[_0xdfea('0xd')](function(_0x22ff95){logger['info'](_0xdfea('0xe'),_0x3c538f,'request\x20sent');logger[_0xdfea('0xf')](_0xdfea('0x10'),_0x3c538f,_0xdfea('0x11'),JSON['stringify'](_0x22ff95));if(_0x22ff95[_0xdfea('0x12')]){if(_0x22ff95['error'][_0xdfea('0x13')]===0x1f4){logger['error'](_0xdfea('0xe'),_0x3c538f,_0x22ff95[_0xdfea('0x12')][_0xdfea('0x14')]);return _0x5f279b(_0x22ff95[_0xdfea('0x12')]['message']);}logger['error'](_0xdfea('0xe'),_0x3c538f,_0x22ff95[_0xdfea('0x12')]['message']);return _0x201463(_0x22ff95[_0xdfea('0x12')]['message']);}else{logger[_0xdfea('0x15')](_0xdfea('0xe'),_0x3c538f,'request\x20sent');_0x201463(_0x22ff95[_0xdfea('0x16')][_0xdfea('0x14')]);}})[_0xdfea('0x17')](function(_0x190364){logger[_0xdfea('0x12')](_0xdfea('0xe'),_0x3c538f,_0x190364);_0x5f279b(_0x190364);});});} \ No newline at end of file +var _0x0c9c=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','UserProfileSection,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x2e419f,_0x15b156){var _0x53eabc=function(_0x19d707){while(--_0x19d707){_0x2e419f['push'](_0x2e419f['shift']());}};_0x53eabc(++_0x15b156);}(_0x0c9c,0x188));var _0xc0c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c9c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc0c9('0x0'));var util=require(_0xc0c9('0x1'));var moment=require(_0xc0c9('0x2'));var BPromise=require(_0xc0c9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc0c9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc0c9('0x5'));var logger=require(_0xc0c9('0x6'))(_0xc0c9('0x7'));var config=require(_0xc0c9('0x8'));var jayson=require(_0xc0c9('0x9'));var client=jayson[_0xc0c9('0xa')][_0xc0c9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42a744,_0x3091c7,_0x23d607){return new BPromise(function(_0x785bba,_0x5a4d3e){return client[_0xc0c9('0xc')](_0x42a744,_0x23d607)[_0xc0c9('0xd')](function(_0x1c8f16){logger[_0xc0c9('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x3091c7,_0xc0c9('0xf'));logger[_0xc0c9('0x10')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x3091c7,_0xc0c9('0xf'),JSON['stringify'](_0x1c8f16));if(_0x1c8f16[_0xc0c9('0x11')]){if(_0x1c8f16[_0xc0c9('0x11')]['code']===0x1f4){logger['error'](_0xc0c9('0x12'),_0x3091c7,_0x1c8f16[_0xc0c9('0x11')][_0xc0c9('0x13')]);return _0x5a4d3e(_0x1c8f16[_0xc0c9('0x11')][_0xc0c9('0x13')]);}logger[_0xc0c9('0x11')](_0xc0c9('0x12'),_0x3091c7,_0x1c8f16[_0xc0c9('0x11')]['message']);return _0x785bba(_0x1c8f16['error'][_0xc0c9('0x13')]);}else{logger[_0xc0c9('0xe')](_0xc0c9('0x12'),_0x3091c7,_0xc0c9('0xf'));_0x785bba(_0x1c8f16['result'][_0xc0c9('0x13')]);}})[_0xc0c9('0x14')](function(_0x9786eb){logger[_0xc0c9('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x3091c7,_0x9786eb);_0x5a4d3e(_0x9786eb);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index c628eeb..4eb7bdb 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x487702,_0x49f5d4){var _0x5e7150=function(_0x2b2b29){while(--_0x2b2b29){_0x487702['push'](_0x487702['shift']());}};_0x5e7150(++_0x49f5d4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x2f214c,_0x3f235c){var _0x19a07c=function(_0x1f430d){while(--_0x1f430d){_0x2f214c['push'](_0x2f214c['shift']());}};_0x19a07c(++_0x3f235c);}(_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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 2fe04cd..364f71a 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 _0x0fcf=['INTEGER','exports'];(function(_0x566bae,_0x230fbd){var _0x637da9=function(_0x2fec91){while(--_0x2fec91){_0x566bae['push'](_0x566bae['shift']());}};_0x637da9(++_0x230fbd);}(_0x0fcf,0xc7));var _0xf0fc=function(_0x51241c,_0x394196){_0x51241c=_0x51241c-0x0;var _0x213220=_0x0fcf[_0x51241c];return _0x213220;};'use strict';var Sequelize=require('sequelize');module[_0xf0fc('0x0')]={'penalty':{'type':Sequelize[_0xf0fc('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2ede=['exports','INTEGER'];(function(_0xfc7de7,_0x10ddf7){var _0x56be64=function(_0x49a717){while(--_0x49a717){_0xfc7de7['push'](_0xfc7de7['shift']());}};_0x56be64(++_0x10ddf7);}(_0x2ede,0x7a));var _0xe2ed=function(_0x8f2b78,_0x9caff1){_0x8f2b78=_0x8f2b78-0x0;var _0x382b05=_0x2ede[_0x8f2b78];return _0x382b05;};'use strict';var Sequelize=require('sequelize');module[_0xe2ed('0x0')]={'penalty':{'type':Sequelize[_0xe2ed('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 58ff414..4ee7569 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 _0xc359=['user_has_sms_queues','util','api','moment','bluebird','path','../../config/environment','exports'];(function(_0x3a32e0,_0x69a2f1){var _0x43ae59=function(_0x234f2e){while(--_0x234f2e){_0x3a32e0['push'](_0x3a32e0['shift']());}};_0x43ae59(++_0x69a2f1);}(_0xc359,0x1d9));var _0x9c35=function(_0x4e0c31,_0x208e9f){_0x4e0c31=_0x4e0c31-0x0;var _0x3fd7df=_0xc359[_0x4e0c31];return _0x3fd7df;};'use strict';var _=require('lodash');var util=require(_0x9c35('0x0'));var logger=require('../../config/logger')(_0x9c35('0x1'));var moment=require(_0x9c35('0x2'));var BPromise=require(_0x9c35('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c35('0x4'));var rimraf=require('rimraf');var config=require(_0x9c35('0x5'));var attributes=require('./userSmsQueue.attributes');module[_0x9c35('0x6')]=function(_0x5b3ada,_0x490409){return _0x5b3ada['define']('UserSmsQueue',attributes,{'tableName':_0x9c35('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5af=['exports','UserSmsQueue','user_has_sms_queues','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x386192,_0x4ef3b4){var _0x316c98=function(_0x4ac021){while(--_0x4ac021){_0x386192['push'](_0x386192['shift']());}};_0x316c98(++_0x4ef3b4);}(_0xe5af,0x9c));var _0xfe5a=function(_0x7e6399,_0x1ed9d3){_0x7e6399=_0x7e6399-0x0;var _0x5b6648=_0xe5af[_0x7e6399];return _0x5b6648;};'use strict';var _=require('lodash');var util=require(_0xfe5a('0x0'));var logger=require(_0xfe5a('0x1'))('api');var moment=require(_0xfe5a('0x2'));var BPromise=require(_0xfe5a('0x3'));var rp=require(_0xfe5a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfe5a('0x5'));var config=require('../../config/environment');var attributes=require('./userSmsQueue.attributes');module[_0xfe5a('0x6')]=function(_0x2039cd,_0x4e418f){return _0x2039cd['define'](_0xfe5a('0x7'),attributes,{'tableName':_0xfe5a('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 788c606..f752c2c 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 _0xb35b=['UserSmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','moment','bluebird','randomstring','../../mysqldb','jayson/promise','http','then'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xb35b,0xd9));var _0xbb35=function(_0x2706da,_0x3856f5){_0x2706da=_0x2706da-0x0;var _0x3ba87e=_0xb35b[_0x2706da];return _0x3ba87e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbb35('0x0'));var BPromise=require(_0xbb35('0x1'));var rs=require(_0xbb35('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb35('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xbb35('0x4'));var client=jayson['client'][_0xbb35('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x3e425c,_0x33d3f0,_0x1336a7){return new BPromise(function(_0x56a85b,_0x5aea4b){return client['request'](_0x3e425c,_0x1336a7)[_0xbb35('0x6')](function(_0x207900){logger['info'](_0xbb35('0x7'),_0x33d3f0,_0xbb35('0x8'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x33d3f0,_0xbb35('0x8'),JSON[_0xbb35('0x9')](_0x207900));if(_0x207900[_0xbb35('0xa')]){if(_0x207900[_0xbb35('0xa')][_0xbb35('0xb')]===0x1f4){logger[_0xbb35('0xa')]('UserSmsQueue,\x20%s,\x20%s',_0x33d3f0,_0x207900[_0xbb35('0xa')][_0xbb35('0xc')]);return _0x5aea4b(_0x207900[_0xbb35('0xa')][_0xbb35('0xc')]);}logger[_0xbb35('0xa')](_0xbb35('0x7'),_0x33d3f0,_0x207900[_0xbb35('0xa')][_0xbb35('0xc')]);return _0x56a85b(_0x207900[_0xbb35('0xa')][_0xbb35('0xc')]);}else{logger[_0xbb35('0xd')](_0xbb35('0x7'),_0x33d3f0,_0xbb35('0x8'));_0x56a85b(_0x207900['result'][_0xbb35('0xc')]);}})['catch'](function(_0x388a6b){logger['error'](_0xbb35('0x7'),_0x33d3f0,_0x388a6b);_0x5aea4b(_0x388a6b);});});} \ No newline at end of file +var _0xfdd0=['then','info','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','UserSmsQueue,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfdd0,0x87));var _0x0fdd=function(_0x5cf6eb,_0x5be218){_0x5cf6eb=_0x5cf6eb-0x0;var _0x5489c2=_0xfdd0[_0x5cf6eb];return _0x5489c2;};'use strict';var _=require(_0x0fdd('0x0'));var util=require(_0x0fdd('0x1'));var moment=require(_0x0fdd('0x2'));var BPromise=require(_0x0fdd('0x3'));var rs=require(_0x0fdd('0x4'));var fs=require('fs');var Redis=require(_0x0fdd('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0fdd('0x6'))(_0x0fdd('0x7'));var config=require(_0x0fdd('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0fdd('0x9')][_0x0fdd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x594e92,_0x5da3f7,_0x507186){return new BPromise(function(_0x23a51d,_0x20a033){return client[_0x0fdd('0xb')](_0x594e92,_0x507186)[_0x0fdd('0xc')](function(_0x40ff4b){logger[_0x0fdd('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x5da3f7,_0x0fdd('0xe'));logger[_0x0fdd('0xf')](_0x0fdd('0x10'),_0x5da3f7,'request\x20sent',JSON['stringify'](_0x40ff4b));if(_0x40ff4b[_0x0fdd('0x11')]){if(_0x40ff4b[_0x0fdd('0x11')][_0x0fdd('0x12')]===0x1f4){logger[_0x0fdd('0x11')](_0x0fdd('0x13'),_0x5da3f7,_0x40ff4b[_0x0fdd('0x11')][_0x0fdd('0x14')]);return _0x20a033(_0x40ff4b['error'][_0x0fdd('0x14')]);}logger['error'](_0x0fdd('0x13'),_0x5da3f7,_0x40ff4b[_0x0fdd('0x11')]['message']);return _0x23a51d(_0x40ff4b[_0x0fdd('0x11')][_0x0fdd('0x14')]);}else{logger['info'](_0x0fdd('0x13'),_0x5da3f7,_0x0fdd('0xe'));_0x23a51d(_0x40ff4b['result'][_0x0fdd('0x14')]);}})['catch'](function(_0x173755){logger['error'](_0x0fdd('0x13'),_0x5da3f7,_0x173755);_0x20a033(_0x173755);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index ee08c76..56a1ef8 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 _0xe255=['sequelize','exports','INTEGER'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xe255,0x114));var _0x5e25=function(_0x55a2b2,_0x187eb6){_0x55a2b2=_0x55a2b2-0x0;var _0x78c2e=_0xe255[_0x55a2b2];return _0x78c2e;};'use strict';var Sequelize=require(_0x5e25('0x0'));module[_0x5e25('0x1')]={'UserId':{'type':Sequelize[_0x5e25('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x351b=['exports','INTEGER','sequelize'];(function(_0x506d83,_0x1899e9){var _0x335e8b=function(_0x4a7044){while(--_0x4a7044){_0x506d83['push'](_0x506d83['shift']());}};_0x335e8b(++_0x1899e9);}(_0x351b,0x8c));var _0xb351=function(_0x51c40b,_0x40b057){_0x51c40b=_0x51c40b-0x0;var _0x144912=_0x351b[_0x51c40b];return _0x144912;};'use strict';var Sequelize=require(_0xb351('0x0'));module[_0xb351('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xb351('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index f2e98b2..5148d60 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(_0x3abb99,_0x5d3a7f){var _0x4b6f70=function(_0xf64435){while(--_0xf64435){_0x3abb99['push'](_0x3abb99['shift']());}};_0x4b6f70(++_0x5d3a7f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x420a4e,_0x46fcc3){var _0xee0533=function(_0xcd44d3){while(--_0xcd44d3){_0x420a4e['push'](_0x420a4e['shift']());}};_0xee0533(++_0x46fcc3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 8f4a6b7..152a800 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2338fa,_0x80579a){var _0x42df9b=function(_0x13fe56){while(--_0x13fe56){_0x2338fa['push'](_0x2338fa['shift']());}};_0x42df9b(++_0x80579a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x53fd5a,_0x383a19){var _0x12fa4e=function(_0x4540f4){while(--_0x4540f4){_0x53fd5a['push'](_0x53fd5a['shift']());}};_0x12fa4e(++_0x383a19);}(_0x70e0,0x17b));var _0x070e=function(_0x13907f,_0xf2503d){_0x13907f=_0x13907f-0x0;var _0x4f75db=_0x70e0[_0x13907f];return _0x4f75db;};'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 31cba92..d6b7073 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 _0x53ce=['exports','INTEGER'];(function(_0x4a0d0a,_0x932606){var _0x3cebb8=function(_0x4de048){while(--_0x4de048){_0x4a0d0a['push'](_0x4a0d0a['shift']());}};_0x3cebb8(++_0x932606);}(_0x53ce,0x7a));var _0xe53c=function(_0x2dcb9b,_0x5ec489){_0x2dcb9b=_0x2dcb9b-0x0;var _0x15480f=_0x53ce[_0x2dcb9b];return _0x15480f;};'use strict';var Sequelize=require('sequelize');module[_0xe53c('0x0')]={'penalty':{'type':Sequelize[_0xe53c('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd102=['sequelize'];(function(_0x5c44cd,_0x5be010){var _0x140b42=function(_0x32d196){while(--_0x32d196){_0x5c44cd['push'](_0x5c44cd['shift']());}};_0x140b42(++_0x5be010);}(_0xd102,0xb6));var _0x2d10=function(_0x13e0c1,_0x642299){_0x13e0c1=_0x13e0c1-0x0;var _0x56e10d=_0xd102[_0x13e0c1];return _0x56e10d;};'use strict';var Sequelize=require(_0x2d10('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'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 2ee9e45..3586211 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 _0x56f1=['exports','define','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes'];(function(_0x2fdb40,_0x3ec0ea){var _0x330079=function(_0x4ccd00){while(--_0x4ccd00){_0x2fdb40['push'](_0x2fdb40['shift']());}};_0x330079(++_0x3ec0ea);}(_0x56f1,0xf2));var _0x156f=function(_0x3dcd73,_0x2aa972){_0x3dcd73=_0x3dcd73-0x0;var _0x3b0e7c=_0x56f1[_0x3dcd73];return _0x3b0e7c;};'use strict';var _=require(_0x156f('0x0'));var util=require(_0x156f('0x1'));var logger=require(_0x156f('0x2'))(_0x156f('0x3'));var moment=require('moment');var BPromise=require(_0x156f('0x4'));var rp=require(_0x156f('0x5'));var fs=require('fs');var path=require(_0x156f('0x6'));var rimraf=require(_0x156f('0x7'));var config=require(_0x156f('0x8'));var attributes=require(_0x156f('0x9'));module[_0x156f('0xa')]=function(_0x3b11a3,_0x9d6165){return _0x3b11a3[_0x156f('0xb')]('UserVoiceQueue',attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b35=['define','UserVoiceQueue','user_has_voice_queues','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports'];(function(_0x2c929b,_0x4bb025){var _0x5dd12a=function(_0x408485){while(--_0x408485){_0x2c929b['push'](_0x2c929b['shift']());}};_0x5dd12a(++_0x4bb025);}(_0x6b35,0x121));var _0x56b3=function(_0x2bab6e,_0x5216c6){_0x2bab6e=_0x2bab6e-0x0;var _0x19c707=_0x6b35[_0x2bab6e];return _0x19c707;};'use strict';var _=require(_0x56b3('0x0'));var util=require(_0x56b3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x56b3('0x2'));var BPromise=require(_0x56b3('0x3'));var rp=require(_0x56b3('0x4'));var fs=require('fs');var path=require(_0x56b3('0x5'));var rimraf=require(_0x56b3('0x6'));var config=require(_0x56b3('0x7'));var attributes=require(_0x56b3('0x8'));module[_0x56b3('0x9')]=function(_0x1058a2,_0x337a02){return _0x1058a2[_0x56b3('0xa')](_0x56b3('0xb'),attributes,{'tableName':_0x56b3('0xc'),'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 d3851a7..d4edcea 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 _0xe315=['message','info','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x515afd,_0x1a1e91){var _0x536d53=function(_0x1d3a89){while(--_0x1d3a89){_0x515afd['push'](_0x515afd['shift']());}};_0x536d53(++_0x1a1e91);}(_0xe315,0xb3));var _0x5e31=function(_0x356dfd,_0x530bd2){_0x356dfd=_0x356dfd-0x0;var _0x156915=_0xe315[_0x356dfd];return _0x156915;};'use strict';var _=require(_0x5e31('0x0'));var util=require(_0x5e31('0x1'));var moment=require('moment');var BPromise=require(_0x5e31('0x2'));var rs=require(_0x5e31('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5e31('0x4'))['db'];var utils=require(_0x5e31('0x5'));var logger=require(_0x5e31('0x6'))(_0x5e31('0x7'));var config=require(_0x5e31('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5e31('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2870ae,_0x54c0c0,_0x921a6d){return new BPromise(function(_0x16ba1e,_0x7a01bb){return client[_0x5e31('0xa')](_0x2870ae,_0x921a6d)[_0x5e31('0xb')](function(_0x5dba4d){logger['info'](_0x5e31('0xc'),_0x54c0c0,_0x5e31('0xd'));logger[_0x5e31('0xe')](_0x5e31('0xf'),_0x54c0c0,_0x5e31('0xd'),JSON[_0x5e31('0x10')](_0x5dba4d));if(_0x5dba4d[_0x5e31('0x11')]){if(_0x5dba4d[_0x5e31('0x11')][_0x5e31('0x12')]===0x1f4){logger[_0x5e31('0x11')](_0x5e31('0xc'),_0x54c0c0,_0x5dba4d[_0x5e31('0x11')][_0x5e31('0x13')]);return _0x7a01bb(_0x5dba4d[_0x5e31('0x11')][_0x5e31('0x13')]);}logger[_0x5e31('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x54c0c0,_0x5dba4d[_0x5e31('0x11')]['message']);return _0x16ba1e(_0x5dba4d[_0x5e31('0x11')][_0x5e31('0x13')]);}else{logger[_0x5e31('0x14')]('UserVoiceQueue,\x20%s,\x20%s',_0x54c0c0,'request\x20sent');_0x16ba1e(_0x5dba4d[_0x5e31('0x15')][_0x5e31('0x13')]);}})['catch'](function(_0x5849bd){logger[_0x5e31('0x11')](_0x5e31('0xc'),_0x54c0c0,_0x5849bd);_0x7a01bb(_0x5849bd);});});} \ No newline at end of file +var _0x9ebd=['message','result','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x477fe5,_0x37c213){var _0x5c536c=function(_0x10fe68){while(--_0x10fe68){_0x477fe5['push'](_0x477fe5['shift']());}};_0x5c536c(++_0x37c213);}(_0x9ebd,0x132));var _0xd9eb=function(_0x365135,_0x21d6cd){_0x365135=_0x365135-0x0;var _0x5b00c0=_0x9ebd[_0x365135];return _0x5b00c0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xd9eb('0x0'));var rs=require(_0xd9eb('0x1'));var fs=require('fs');var Redis=require(_0xd9eb('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xd9eb('0x3'));var logger=require('../../config/logger')(_0xd9eb('0x4'));var config=require(_0xd9eb('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xd9eb('0x6')][_0xd9eb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4cbd8a,_0xfd5e60,_0xfc4be8){return new BPromise(function(_0xc845e9,_0x1e5021){return client[_0xd9eb('0x8')](_0x4cbd8a,_0xfc4be8)[_0xd9eb('0x9')](function(_0x32c2fd){logger[_0xd9eb('0xa')](_0xd9eb('0xb'),_0xfd5e60,_0xd9eb('0xc'));logger[_0xd9eb('0xd')](_0xd9eb('0xe'),_0xfd5e60,'request\x20sent',JSON['stringify'](_0x32c2fd));if(_0x32c2fd[_0xd9eb('0xf')]){if(_0x32c2fd['error'][_0xd9eb('0x10')]===0x1f4){logger[_0xd9eb('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0xfd5e60,_0x32c2fd[_0xd9eb('0xf')]['message']);return _0x1e5021(_0x32c2fd['error']['message']);}logger[_0xd9eb('0xf')](_0xd9eb('0xb'),_0xfd5e60,_0x32c2fd['error'][_0xd9eb('0x11')]);return _0xc845e9(_0x32c2fd['error'][_0xd9eb('0x11')]);}else{logger[_0xd9eb('0xa')](_0xd9eb('0xb'),_0xfd5e60,_0xd9eb('0xc'));_0xc845e9(_0x32c2fd[_0xd9eb('0x12')]['message']);}})['catch'](function(_0x112291){logger[_0xd9eb('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0xfd5e60,_0x112291);_0x1e5021(_0x112291);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 6f550dc..a0069cd 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x31702f,_0x2a4781){var _0x38d08f=function(_0x2e314c){while(--_0x2e314c){_0x31702f['push'](_0x31702f['shift']());}};_0x38d08f(++_0x2a4781);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xcb91[_0x2064e5];return _0x21a233;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x16c979,_0x3c2ccc){var _0xa0616c=function(_0x15d450){while(--_0x15d450){_0x16c979['push'](_0x16c979['shift']());}};_0xa0616c(++_0x3c2ccc);}(_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 b2ba40b..a6fdda9 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 _0x814b=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports'];(function(_0x506704,_0x6a2187){var _0x35c656=function(_0x430631){while(--_0x430631){_0x506704['push'](_0x506704['shift']());}};_0x35c656(++_0x6a2187);}(_0x814b,0x1a2));var _0xb814=function(_0x39e15b,_0x555185){_0x39e15b=_0x39e15b-0x0;var _0x4e5766=_0x814b[_0x39e15b];return _0x4e5766;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'uniqueid':{'type':Sequelize[_0xb814('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xb814('0x3')},'membername':{'type':Sequelize[_0xb814('0x4')],'allowNull':![],'comment':_0xb814('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xb814('0x4')],'allowNull':![],'unique':_0xb814('0x5'),'comment':_0xb814('0x3')},'VoiceQueueId':{'type':Sequelize[_0xb814('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xb814('0x4')],'allowNull':![],'unique':_0xb814('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0xb814('0x2')](0xb),'defaultValue':0x0,'comment':_0xb814('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xb814('0x3')}}; \ No newline at end of file +var _0xb8f1=['STRING','queue_interface','INTEGER','sequelize','exports','Required\x20by\x20Asterisk'];(function(_0x5414fd,_0x31974f){var _0x4e7bcf=function(_0x79ac34){while(--_0x79ac34){_0x5414fd['push'](_0x5414fd['shift']());}};_0x4e7bcf(++_0x31974f);}(_0xb8f1,0x15f));var _0x1b8f=function(_0x44db81,_0x35ca33){_0x44db81=_0x44db81-0x0;var _0x45291b=_0xb8f1[_0x44db81];return _0x45291b;};'use strict';var Sequelize=require(_0x1b8f('0x0'));module[_0x1b8f('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x1b8f('0x2')},'membername':{'type':Sequelize[_0x1b8f('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x1b8f('0x3')],'allowNull':![],'unique':_0x1b8f('0x4'),'comment':_0x1b8f('0x2')},'VoiceQueueId':{'type':Sequelize[_0x1b8f('0x5')],'allowNull':![]},'interface':{'type':Sequelize[_0x1b8f('0x3')],'allowNull':![],'unique':_0x1b8f('0x4'),'comment':_0x1b8f('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x1b8f('0x5')](0xb),'defaultValue':0x0,'comment':_0x1b8f('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 158e848..0fe930c 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 _0x3aa7=['hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','remove','emit'];(function(_0x157d49,_0x3f4a03){var _0x2c3fbd=function(_0x7426c){while(--_0x7426c){_0x157d49['push'](_0x157d49['shift']());}};_0x2c3fbd(++_0x3f4a03);}(_0x3aa7,0x16b));var _0x73aa=function(_0x29c4e8,_0x2b8627){_0x29c4e8=_0x29c4e8-0x0;var _0x8764d3=_0x3aa7[_0x29c4e8];return _0x8764d3;};'use strict';var EventEmitter=require(_0x73aa('0x0'));var UserVoiceQueueRt=require(_0x73aa('0x1'))['db'][_0x73aa('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x73aa('0x3')](0x0);var events={'afterCreate':_0x73aa('0x4'),'afterUpdate':'update','afterDestroy':_0x73aa('0x5')};function emitEvent(_0x15a886){return function(_0x4ffdda,_0x421602,_0x378ea1){UserVoiceQueueRtEvents[_0x73aa('0x6')](_0x15a886+':'+_0x4ffdda['id'],_0x4ffdda);UserVoiceQueueRtEvents[_0x73aa('0x6')](_0x15a886,_0x4ffdda);_0x378ea1(null);};}for(var e in events){if(events[_0x73aa('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x73aa('0x8')](e,emitEvent(event));}}module[_0x73aa('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xdacc=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update'];(function(_0x4c23bb,_0x2df33c){var _0x30dbb5=function(_0x8c7cb1){while(--_0x8c7cb1){_0x4c23bb['push'](_0x4c23bb['shift']());}};_0x30dbb5(++_0x2df33c);}(_0xdacc,0x15a));var _0xcdac=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdacc[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xcdac('0x0'));var UserVoiceQueueRt=require(_0xcdac('0x1'))['db'][_0xcdac('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xcdac('0x3')](0x0);var events={'afterCreate':_0xcdac('0x4'),'afterUpdate':_0xcdac('0x5'),'afterDestroy':_0xcdac('0x6')};function emitEvent(_0x4f4f34){return function(_0x34a536,_0x26a0d6,_0xd6100e){UserVoiceQueueRtEvents[_0xcdac('0x7')](_0x4f4f34+':'+_0x34a536['id'],_0x34a536);UserVoiceQueueRtEvents[_0xcdac('0x7')](_0x4f4f34,_0x34a536);_0xd6100e(null);};}for(var e in events){if(events[_0xcdac('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0xcdac('0x9')](e,emitEvent(event));}}module[_0xcdac('0xa')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index a8ddd64..8917675 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 _0xed1d=['path','rimraf','./userVoiceQueueRt.attributes','exports','define','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x4dd2fa,_0x1eb350){var _0x16db27=function(_0x4812db){while(--_0x4812db){_0x4dd2fa['push'](_0x4dd2fa['shift']());}};_0x16db27(++_0x1eb350);}(_0xed1d,0xd2));var _0xded1=function(_0x3df84e,_0x273636){_0x3df84e=_0x3df84e-0x0;var _0x20b031=_0xed1d[_0x3df84e];return _0x20b031;};'use strict';var _=require(_0xded1('0x0'));var util=require(_0xded1('0x1'));var logger=require(_0xded1('0x2'))(_0xded1('0x3'));var moment=require(_0xded1('0x4'));var BPromise=require('bluebird');var rp=require(_0xded1('0x5'));var fs=require('fs');var path=require(_0xded1('0x6'));var rimraf=require(_0xded1('0x7'));var config=require('../../config/environment');var attributes=require(_0xded1('0x8'));module[_0xded1('0x9')]=function(_0x5df886,_0x49b85f){return _0x5df886[_0xded1('0xa')]('UserVoiceQueueRt',attributes,{'tableName':_0xded1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5637=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','UserVoiceQueueRt','user_has_voice_queues_rt'];(function(_0x36a5d0,_0x477b0f){var _0x2b0076=function(_0x4f78d0){while(--_0x4f78d0){_0x36a5d0['push'](_0x36a5d0['shift']());}};_0x2b0076(++_0x477b0f);}(_0x5637,0xd8));var _0x7563=function(_0x44ff1e,_0x490472){_0x44ff1e=_0x44ff1e-0x0;var _0x8feb1b=_0x5637[_0x44ff1e];return _0x8feb1b;};'use strict';var _=require(_0x7563('0x0'));var util=require('util');var logger=require(_0x7563('0x1'))(_0x7563('0x2'));var moment=require(_0x7563('0x3'));var BPromise=require(_0x7563('0x4'));var rp=require(_0x7563('0x5'));var fs=require('fs');var path=require(_0x7563('0x6'));var rimraf=require(_0x7563('0x7'));var config=require(_0x7563('0x8'));var attributes=require(_0x7563('0x9'));module['exports']=function(_0x59b8fe,_0x25ec64){return _0x59b8fe['define'](_0x7563('0xa'),attributes,{'tableName':_0x7563('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 201efdc..143c933 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 _0xb4e5=['rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x301bb8,_0x2692b9){var _0x34b24f=function(_0xfd7140){while(--_0xfd7140){_0x301bb8['push'](_0x301bb8['shift']());}};_0x34b24f(++_0x2692b9);}(_0xb4e5,0x17a));var _0x5b4e=function(_0x17e3c7,_0x1cfc59){_0x17e3c7=_0x17e3c7-0x0;var _0x4e0af9=_0xb4e5[_0x17e3c7];return _0x4e0af9;};'use strict';var _=require('lodash');var util=require(_0x5b4e('0x0'));var moment=require(_0x5b4e('0x1'));var BPromise=require(_0x5b4e('0x2'));var rs=require(_0x5b4e('0x3'));var fs=require('fs');var Redis=require(_0x5b4e('0x4'));var db=require(_0x5b4e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5b4e('0x6'))(_0x5b4e('0x7'));var config=require(_0x5b4e('0x8'));var jayson=require(_0x5b4e('0x9'));var client=jayson[_0x5b4e('0xa')]['http']({'port':0x232a});config[_0x5b4e('0xb')]=_[_0x5b4e('0xc')](config[_0x5b4e('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x5b4e('0xd'))(new Redis(config[_0x5b4e('0xb')]));require('./userVoiceQueueRt.socket')[_0x5b4e('0xe')](socket);function respondWithRpcPromise(_0x4a1abf,_0x5501b2,_0x1b2e0c){return new BPromise(function(_0x12b231,_0x211e17){return client[_0x5b4e('0xf')](_0x4a1abf,_0x1b2e0c)[_0x5b4e('0x10')](function(_0x2e6ec3){logger[_0x5b4e('0x11')](_0x5b4e('0x12'),_0x5501b2,_0x5b4e('0x13'));logger['debug'](_0x5b4e('0x14'),_0x5501b2,_0x5b4e('0x13'),JSON[_0x5b4e('0x15')](_0x2e6ec3));if(_0x2e6ec3['error']){if(_0x2e6ec3[_0x5b4e('0x16')]['code']===0x1f4){logger['error'](_0x5b4e('0x12'),_0x5501b2,_0x2e6ec3['error'][_0x5b4e('0x17')]);return _0x211e17(_0x2e6ec3[_0x5b4e('0x16')]['message']);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x5501b2,_0x2e6ec3[_0x5b4e('0x16')][_0x5b4e('0x17')]);return _0x12b231(_0x2e6ec3['error'][_0x5b4e('0x17')]);}else{logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x5501b2,'request\x20sent');_0x12b231(_0x2e6ec3[_0x5b4e('0x18')][_0x5b4e('0x17')]);}})['catch'](function(_0x1c693e){logger[_0x5b4e('0x16')](_0x5b4e('0x12'),_0x5501b2,_0x1c693e);_0x211e17(_0x1c693e);});});}exports[_0x5b4e('0x19')]=function(_0x2c1514){var _0x3d8176=this;return new Promise(function(_0x310bdd,_0x1e5dda){return db[_0x5b4e('0x1a')][_0x5b4e('0x1b')]({'raw':_0x2c1514[_0x5b4e('0x1c')]?_0x2c1514[_0x5b4e('0x1c')][_0x5b4e('0x1d')]===undefined?!![]:![]:!![],'where':_0x2c1514[_0x5b4e('0x1c')]?_0x2c1514[_0x5b4e('0x1c')][_0x5b4e('0x1e')]||null:null,'attributes':[[db[_0x5b4e('0x1f')]['fn'](_0x5b4e('0x20'),db[_0x5b4e('0x1f')]['fn']('IF',db[_0x5b4e('0x1f')]['literal'](_0x5b4e('0x21')))),'outboundQueuePauses']]})['then'](function(_0x4095ea){logger[_0x5b4e('0x11')](_0x5b4e('0x19'),_0x2c1514);logger[_0x5b4e('0x22')](_0x5b4e('0x19'),_0x2c1514,JSON['stringify'](_0x4095ea));_0x310bdd(_0x4095ea);})['catch'](function(_0x45f07c){logger[_0x5b4e('0x16')]('GetVoiceQueueRtPauses',_0x45f07c[_0x5b4e('0x17')],_0x2c1514);_0x1e5dda(_0x3d8176[_0x5b4e('0x16')](0x1f4,_0x45f07c['message']));});});}; \ No newline at end of file +var _0xf9a1=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','lodash','moment','randomstring','ioredis'];(function(_0x419785,_0x379469){var _0x25abb9=function(_0xa8870f){while(--_0xa8870f){_0x419785['push'](_0x419785['shift']());}};_0x25abb9(++_0x379469);}(_0xf9a1,0xe3));var _0x1f9a=function(_0xc49943,_0x2efb03){_0xc49943=_0xc49943-0x0;var _0x3ee596=_0xf9a1[_0xc49943];return _0x3ee596;};'use strict';var _=require(_0x1f9a('0x0'));var util=require('util');var moment=require(_0x1f9a('0x1'));var BPromise=require('bluebird');var rs=require(_0x1f9a('0x2'));var fs=require('fs');var Redis=require(_0x1f9a('0x3'));var db=require(_0x1f9a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1f9a('0x5'))('rpc');var config=require(_0x1f9a('0x6'));var jayson=require(_0x1f9a('0x7'));var client=jayson['client'][_0x1f9a('0x8')]({'port':0x232a});config[_0x1f9a('0x9')]=_[_0x1f9a('0xa')](config[_0x1f9a('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1f9a('0x9')]));require(_0x1f9a('0xb'))[_0x1f9a('0xc')](socket);function respondWithRpcPromise(_0x1be254,_0x455ca8,_0x1e09a2){return new BPromise(function(_0x474f06,_0x147c9d){return client[_0x1f9a('0xd')](_0x1be254,_0x1e09a2)[_0x1f9a('0xe')](function(_0x4f122c){logger[_0x1f9a('0xf')](_0x1f9a('0x10'),_0x455ca8,'request\x20sent');logger[_0x1f9a('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x455ca8,_0x1f9a('0x12'),JSON[_0x1f9a('0x13')](_0x4f122c));if(_0x4f122c[_0x1f9a('0x14')]){if(_0x4f122c[_0x1f9a('0x14')][_0x1f9a('0x15')]===0x1f4){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x455ca8,_0x4f122c[_0x1f9a('0x14')][_0x1f9a('0x16')]);return _0x147c9d(_0x4f122c['error']['message']);}logger[_0x1f9a('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x455ca8,_0x4f122c[_0x1f9a('0x14')][_0x1f9a('0x16')]);return _0x474f06(_0x4f122c['error'][_0x1f9a('0x16')]);}else{logger[_0x1f9a('0xf')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x455ca8,'request\x20sent');_0x474f06(_0x4f122c[_0x1f9a('0x17')][_0x1f9a('0x16')]);}})[_0x1f9a('0x18')](function(_0x1521b5){logger[_0x1f9a('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x455ca8,_0x1521b5);_0x147c9d(_0x1521b5);});});}exports[_0x1f9a('0x19')]=function(_0x33d82b){var _0x4be7af=this;return new Promise(function(_0x2209f9,_0x582130){return db[_0x1f9a('0x1a')]['findAll']({'raw':_0x33d82b[_0x1f9a('0x1b')]?_0x33d82b['options']['raw']===undefined?!![]:![]:!![],'where':_0x33d82b[_0x1f9a('0x1b')]?_0x33d82b['options'][_0x1f9a('0x1c')]||null:null,'attributes':[[db[_0x1f9a('0x1d')]['fn'](_0x1f9a('0x1e'),db[_0x1f9a('0x1d')]['fn']('IF',db[_0x1f9a('0x1d')][_0x1f9a('0x1f')](_0x1f9a('0x20')))),'outboundQueuePauses']]})[_0x1f9a('0xe')](function(_0x1442c1){logger[_0x1f9a('0xf')](_0x1f9a('0x19'),_0x33d82b);logger[_0x1f9a('0x11')](_0x1f9a('0x19'),_0x33d82b,JSON[_0x1f9a('0x13')](_0x1442c1));_0x2209f9(_0x1442c1);})[_0x1f9a('0x18')](function(_0x30235f){logger[_0x1f9a('0x14')]('GetVoiceQueueRtPauses',_0x30235f['message'],_0x33d82b);_0x582130(_0x4be7af[_0x1f9a('0x14')](0x1f4,_0x30235f['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 9f2d655..689de12 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 _0x1c9a=['register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1c9a,0x1a7));var _0xa1c9=function(_0x50b6ab,_0xfb52f5){_0x50b6ab=_0x50b6ab-0x0;var _0x28caa4=_0x1c9a[_0x50b6ab];return _0x28caa4;};'use strict';var UserVoiceQueueRtEvents=require(_0xa1c9('0x0'));var events=[_0xa1c9('0x1'),'remove',_0xa1c9('0x2')];function createListener(_0x867bbb,_0x38c48f){return function(_0x408418){_0x38c48f[_0xa1c9('0x3')](_0x867bbb,_0x408418);};}function removeListener(_0x4a0d3d,_0x2f883c){return function(){UserVoiceQueueRtEvents['removeListener'](_0x4a0d3d,_0x2f883c);};}exports[_0xa1c9('0x4')]=function(_0xdd22bf){for(var _0x237862=0x0,_0x2b0c89=events[_0xa1c9('0x5')];_0x237862<_0x2b0c89;_0x237862++){var _0x46b19a=events[_0x237862];var _0x3b1a2c=createListener(_0xa1c9('0x6')+_0x46b19a,_0xdd22bf);UserVoiceQueueRtEvents['on'](_0x46b19a,_0x3b1a2c);}}; \ No newline at end of file +var _0x7c09=['save','remove','emit','removeListener','length','userVoiceQueueRt:'];(function(_0x39ad37,_0x34f987){var _0x4c1eae=function(_0x5e5235){while(--_0x5e5235){_0x39ad37['push'](_0x39ad37['shift']());}};_0x4c1eae(++_0x34f987);}(_0x7c09,0x102));var _0x97c0=function(_0x2b4430,_0x2bf664){_0x2b4430=_0x2b4430-0x0;var _0x2b1da6=_0x7c09[_0x2b4430];return _0x2b1da6;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x97c0('0x0'),_0x97c0('0x1'),'update'];function createListener(_0xfbf689,_0x7d8f6f){return function(_0x2d04b9){_0x7d8f6f[_0x97c0('0x2')](_0xfbf689,_0x2d04b9);};}function removeListener(_0x12eb6d,_0x99bf54){return function(){UserVoiceQueueRtEvents[_0x97c0('0x3')](_0x12eb6d,_0x99bf54);};}exports['register']=function(_0x4b2f81){for(var _0x590368=0x0,_0x46fdd9=events[_0x97c0('0x4')];_0x590368<_0x46fdd9;_0x590368++){var _0x2c19fa=events[_0x590368];var _0x109bc8=createListener(_0x97c0('0x5')+_0x2c19fa,_0x4b2f81);UserVoiceQueueRtEvents['on'](_0x2c19fa,_0x109bc8);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 9c78c7c..a256e15 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1024e4,_0x67a93c){var _0x145c57=function(_0x4d7c20){while(--_0x4d7c20){_0x1024e4['push'](_0x1024e4['shift']());}};_0x145c57(++_0x67a93c);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x309515,_0x55f470){var _0x51f8bd=function(_0x4cd1ee){while(--_0x4cd1ee){_0x309515['push'](_0x309515['shift']());}};_0x51f8bd(++_0x55f470);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index b6483d6..be319c0 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 _0x2933=['INTEGER','sequelize','exports'];(function(_0x2d994d,_0x168a27){var _0xd54be4=function(_0x1db925){while(--_0x1db925){_0x2d994d['push'](_0x2d994d['shift']());}};_0xd54be4(++_0x168a27);}(_0x2933,0x1b4));var _0x3293=function(_0x9b0be4,_0x49921e){_0x9b0be4=_0x9b0be4-0x0;var _0x477b34=_0x2933[_0x9b0be4];return _0x477b34;};'use strict';var Sequelize=require(_0x3293('0x0'));module[_0x3293('0x1')]={'penalty':{'type':Sequelize[_0x3293('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x011c=['INTEGER','sequelize','exports'];(function(_0x30b2dc,_0x1d1d8a){var _0x402e40=function(_0x1e085d){while(--_0x1e085d){_0x30b2dc['push'](_0x30b2dc['shift']());}};_0x402e40(++_0x1d1d8a);}(_0x011c,0x8e));var _0xc011=function(_0x1d14d5,_0x58692e){_0x1d14d5=_0x1d14d5-0x0;var _0xfd9d2c=_0x011c[_0x1d14d5];return _0xfd9d2c;};'use strict';var Sequelize=require(_0xc011('0x0'));module[_0xc011('0x1')]={'penalty':{'type':Sequelize[_0xc011('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index fc8d7c5..0e3058e 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 _0x2cbb=['bluebird','path','./userWhatsappQueue.attributes','define','UserWhatsappQueue','user_has_whatsapp_queues','util','../../config/logger','api','moment'];(function(_0x2d460c,_0x4f08c0){var _0xf6fc4c=function(_0x4fb81c){while(--_0x4fb81c){_0x2d460c['push'](_0x2d460c['shift']());}};_0xf6fc4c(++_0x4f08c0);}(_0x2cbb,0x13c));var _0xb2cb=function(_0x1df9f4,_0x27c693){_0x1df9f4=_0x1df9f4-0x0;var _0x29f9c5=_0x2cbb[_0x1df9f4];return _0x29f9c5;};'use strict';var _=require('lodash');var util=require(_0xb2cb('0x0'));var logger=require(_0xb2cb('0x1'))(_0xb2cb('0x2'));var moment=require(_0xb2cb('0x3'));var BPromise=require(_0xb2cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb2cb('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb2cb('0x6'));module['exports']=function(_0x12f00e,_0x3b15c0){return _0x12f00e[_0xb2cb('0x7')](_0xb2cb('0x8'),attributes,{'tableName':_0xb2cb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8720=['UserWhatsappQueue','user_has_whatsapp_queues','lodash','api','moment','request-promise','../../config/environment','./userWhatsappQueue.attributes','exports'];(function(_0x3b6f57,_0x4ad14d){var _0x44e42f=function(_0x3f197b){while(--_0x3f197b){_0x3b6f57['push'](_0x3b6f57['shift']());}};_0x44e42f(++_0x4ad14d);}(_0x8720,0x1df));var _0x0872=function(_0x2d86e2,_0x589de6){_0x2d86e2=_0x2d86e2-0x0;var _0x134b97=_0x8720[_0x2d86e2];return _0x134b97;};'use strict';var _=require(_0x0872('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0872('0x1'));var moment=require(_0x0872('0x2'));var BPromise=require('bluebird');var rp=require(_0x0872('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0872('0x4'));var attributes=require(_0x0872('0x5'));module[_0x0872('0x6')]=function(_0x3f6aa9,_0x222852){return _0x3f6aa9['define'](_0x0872('0x7'),attributes,{'tableName':_0x0872('0x8'),'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 4ef0125..111bc3a 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 _0xc3e9=['rpc','jayson/promise','client','http','request','then','info','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xc3e9,0x120));var _0x9c3e=function(_0x344ab9,_0x5896f6){_0x344ab9=_0x344ab9-0x0;var _0x43bdbe=_0xc3e9[_0x344ab9];return _0x43bdbe;};'use strict';var _=require(_0x9c3e('0x0'));var util=require(_0x9c3e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9c3e('0x2'));var fs=require('fs');var Redis=require(_0x9c3e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c3e('0x4'));var logger=require(_0x9c3e('0x5'))(_0x9c3e('0x6'));var config=require('../../config/environment');var jayson=require(_0x9c3e('0x7'));var client=jayson[_0x9c3e('0x8')][_0x9c3e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e49e0,_0xf22f9d,_0x26908d){return new BPromise(function(_0x3aa2bf,_0x31cfdb){return client[_0x9c3e('0xa')](_0x5e49e0,_0x26908d)[_0x9c3e('0xb')](function(_0x882c32){logger[_0x9c3e('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0xf22f9d,_0x9c3e('0xd'));logger['debug'](_0x9c3e('0xe'),_0xf22f9d,_0x9c3e('0xd'),JSON['stringify'](_0x882c32));if(_0x882c32[_0x9c3e('0xf')]){if(_0x882c32[_0x9c3e('0xf')][_0x9c3e('0x10')]===0x1f4){logger[_0x9c3e('0xf')](_0x9c3e('0x11'),_0xf22f9d,_0x882c32[_0x9c3e('0xf')]['message']);return _0x31cfdb(_0x882c32[_0x9c3e('0xf')][_0x9c3e('0x12')]);}logger[_0x9c3e('0xf')](_0x9c3e('0x11'),_0xf22f9d,_0x882c32[_0x9c3e('0xf')][_0x9c3e('0x12')]);return _0x3aa2bf(_0x882c32['error']['message']);}else{logger[_0x9c3e('0xc')](_0x9c3e('0x11'),_0xf22f9d,'request\x20sent');_0x3aa2bf(_0x882c32[_0x9c3e('0x13')][_0x9c3e('0x12')]);}})[_0x9c3e('0x14')](function(_0x35904e){logger[_0x9c3e('0xf')](_0x9c3e('0x11'),_0xf22f9d,_0x35904e);_0x31cfdb(_0x35904e);});});} \ No newline at end of file +var _0x16df=['then','info','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserWhatsappQueue,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','request'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x16df,0x1d7));var _0xf16d=function(_0x50ac0d,_0x534307){_0x50ac0d=_0x50ac0d-0x0;var _0x387df0=_0x16df[_0x50ac0d];return _0x387df0;};'use strict';var _=require('lodash');var util=require(_0xf16d('0x0'));var moment=require(_0xf16d('0x1'));var BPromise=require(_0xf16d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf16d('0x3'));var db=require(_0xf16d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf16d('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf16d('0x6'));var client=jayson[_0xf16d('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2afc4f,_0x38c6ca,_0x1a2ed6){return new BPromise(function(_0x55dc15,_0x48a036){return client[_0xf16d('0x8')](_0x2afc4f,_0x1a2ed6)[_0xf16d('0x9')](function(_0x468472){logger[_0xf16d('0xa')]('UserWhatsappQueue,\x20%s,\x20%s',_0x38c6ca,_0xf16d('0xb'));logger[_0xf16d('0xc')](_0xf16d('0xd'),_0x38c6ca,_0xf16d('0xb'),JSON[_0xf16d('0xe')](_0x468472));if(_0x468472[_0xf16d('0xf')]){if(_0x468472[_0xf16d('0xf')]['code']===0x1f4){logger[_0xf16d('0xf')](_0xf16d('0x10'),_0x38c6ca,_0x468472[_0xf16d('0xf')][_0xf16d('0x11')]);return _0x48a036(_0x468472['error'][_0xf16d('0x11')]);}logger[_0xf16d('0xf')](_0xf16d('0x10'),_0x38c6ca,_0x468472['error'][_0xf16d('0x11')]);return _0x55dc15(_0x468472[_0xf16d('0xf')][_0xf16d('0x11')]);}else{logger['info'](_0xf16d('0x10'),_0x38c6ca,_0xf16d('0xb'));_0x55dc15(_0x468472[_0xf16d('0x12')]['message']);}})[_0xf16d('0x13')](function(_0x154dec){logger[_0xf16d('0xf')](_0xf16d('0x10'),_0x38c6ca,_0x154dec);_0x48a036(_0x154dec);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 0688670..c39a39b 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 _0x639d=['show','post','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id'];(function(_0x27c1c5,_0x2f03de){var _0x4b85a7=function(_0x552eb2){while(--_0x552eb2){_0x27c1c5['push'](_0x27c1c5['shift']());}};_0x4b85a7(++_0x2f03de);}(_0x639d,0xbb));var _0xd639=function(_0x3b398f,_0x2811d6){_0x3b398f=_0x3b398f-0x0;var _0x24ddfa=_0x639d[_0x3b398f];return _0x24ddfa;};'use strict';var multer=require(_0xd639('0x0'));var util=require(_0xd639('0x1'));var path=require(_0xd639('0x2'));var timeout=require('connect-timeout');var express=require(_0xd639('0x3'));var router=express[_0xd639('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd639('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd639('0x6'));var controller=require('./variable.controller');router['get']('/',auth[_0xd639('0x7')](),controller[_0xd639('0x8')]);router[_0xd639('0x9')](_0xd639('0xa'),auth[_0xd639('0x7')](),controller[_0xd639('0xb')]);router[_0xd639('0xc')]('/',auth[_0xd639('0x7')](),controller['create']);router[_0xd639('0xd')](_0xd639('0xa'),auth[_0xd639('0x7')](),controller[_0xd639('0xe')]);router[_0xd639('0xf')](_0xd639('0xa'),auth[_0xd639('0x7')](),controller[_0xd639('0x10')]);module[_0xd639('0x11')]=router; \ No newline at end of file +var _0x6898=['fs-extra','../../components/auth/service','../../components/interaction/service','./variable.controller','get','isAuthenticated','/:id','show','post','delete','exports','multer','path','connect-timeout','express','Router'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0x6898,0x11b));var _0x8689=function(_0x192067,_0x3c77ce){_0x192067=_0x192067-0x0;var _0x5d326c=_0x6898[_0x192067];return _0x5d326c;};'use strict';var multer=require(_0x8689('0x0'));var util=require('util');var path=require(_0x8689('0x1'));var timeout=require(_0x8689('0x2'));var express=require(_0x8689('0x3'));var router=express[_0x8689('0x4')]();var fs_extra=require(_0x8689('0x5'));var auth=require(_0x8689('0x6'));var interaction=require(_0x8689('0x7'));var config=require('../../config/environment');var controller=require(_0x8689('0x8'));router[_0x8689('0x9')]('/',auth[_0x8689('0xa')](),controller['index']);router[_0x8689('0x9')](_0x8689('0xb'),auth[_0x8689('0xa')](),controller[_0x8689('0xc')]);router[_0x8689('0xd')]('/',auth[_0x8689('0xa')](),controller['create']);router['put']('/:id',auth[_0x8689('0xa')](),controller['update']);router[_0x8689('0xe')](_0x8689('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x8689('0xf')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 1c86d7a..c5b064c 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 _0xb3db=['exports','STRING','name'];(function(_0x402954,_0x285347){var _0x35931f=function(_0x4e2cb7){while(--_0x4e2cb7){_0x402954['push'](_0x402954['shift']());}};_0x35931f(++_0x285347);}(_0xb3db,0x159));var _0xbb3d=function(_0xd4636c,_0x34dbf6){_0xd4636c=_0xd4636c-0x0;var _0x5ee17d=_0xb3db[_0xd4636c];return _0x5ee17d;};'use strict';var Sequelize=require('sequelize');module[_0xbb3d('0x0')]={'name':{'type':Sequelize[_0xbb3d('0x1')],'unique':_0xbb3d('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xbb3d('0x1')]}}; \ No newline at end of file +var _0xae46=['name','exports','STRING'];(function(_0x221923,_0x14f781){var _0x4eadfb=function(_0x498be6){while(--_0x498be6){_0x221923['push'](_0x221923['shift']());}};_0x4eadfb(++_0x14f781);}(_0xae46,0x127));var _0x6ae4=function(_0x24b576,_0xfd6cbf){_0x24b576=_0x24b576-0x0;var _0x13a029=_0xae46[_0x24b576];return _0x13a029;};'use strict';var Sequelize=require('sequelize');module[_0x6ae4('0x0')]={'name':{'type':Sequelize[_0x6ae4('0x1')],'unique':_0x6ae4('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6ae4('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 88abd36..2399260 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 _0x5158=['type','VIRTUAL','options','includeAll','findAll','show','params','keys','rawAttributes','catch','create','body','user','role','UserProfileSection','userProfileId','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','Variables','UserProfileResource','destroy','end','sendStatus','error','stack','name','index','Variable','fieldName','key','map','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x217a3f,_0x4139c9){var _0xfafdc7=function(_0x540d5d){while(--_0x540d5d){_0x217a3f['push'](_0x217a3f['shift']());}};_0xfafdc7(++_0x4139c9);}(_0x5158,0xb7));var _0x8515=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x5158[_0x172747];return _0x509692;};'use strict';var emlformat=require(_0x8515('0x0'));var rimraf=require(_0x8515('0x1'));var zipdir=require(_0x8515('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8515('0x3'));var moment=require(_0x8515('0x4'));var BPromise=require(_0x8515('0x5'));var Mustache=require(_0x8515('0x6'));var util=require(_0x8515('0x7'));var path=require('path');var sox=require(_0x8515('0x8'));var csv=require(_0x8515('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8515('0xa'));var _=require(_0x8515('0xb'));var squel=require(_0x8515('0xc'));var crypto=require(_0x8515('0xd'));var jsforce=require(_0x8515('0xe'));var deskjs=require(_0x8515('0xf'));var toCsv=require(_0x8515('0x9'));var querystring=require('querystring');var Papa=require(_0x8515('0x10'));var Redis=require(_0x8515('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8515('0x12'));var logger=require(_0x8515('0x13'))(_0x8515('0x14'));var utils=require(_0x8515('0x15'));var config=require(_0x8515('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8515('0x17'))['db'];function respondWithStatusCode(_0x18ca37,_0x1303ca){_0x1303ca=_0x1303ca||0xcc;return function(_0x217464){if(_0x217464){return _0x18ca37['sendStatus'](_0x1303ca);}return _0x18ca37[_0x8515('0x18')](_0x1303ca)['end']();};}function respondWithResult(_0xfe5aa3,_0x249062){_0x249062=_0x249062||0xc8;return function(_0x53b5b2){if(_0x53b5b2){return _0xfe5aa3[_0x8515('0x18')](_0x249062)[_0x8515('0x19')](_0x53b5b2);}};}function respondWithFilteredResult(_0x2b6f76,_0x639b21){return function(_0x16e442){if(_0x16e442){var _0x348b0d=typeof _0x639b21[_0x8515('0x1a')]==='undefined'&&typeof _0x639b21[_0x8515('0x1b')]===_0x8515('0x1c');var _0x5300ab=_0x16e442[_0x8515('0x1d')];var _0x3dd9ec=_0x348b0d?0x0:_0x639b21['offset'];var _0x85ed4=_0x348b0d?_0x16e442[_0x8515('0x1d')]:_0x639b21[_0x8515('0x1a')]+_0x639b21['limit'];var _0x3c4356;if(_0x85ed4>=_0x5300ab){_0x85ed4=_0x5300ab;_0x3c4356=0xc8;}else{_0x3c4356=0xce;}_0x2b6f76[_0x8515('0x18')](_0x3c4356);return _0x2b6f76[_0x8515('0x1e')](_0x8515('0x1f'),_0x3dd9ec+'-'+_0x85ed4+'/'+_0x5300ab)[_0x8515('0x19')](_0x16e442);}return null;};}function patchUpdates(_0x3fc22c){return function(_0x1c6738){try{jsonpatch[_0x8515('0x20')](_0x1c6738,_0x3fc22c,!![]);}catch(_0x4e4b48){return BPromise[_0x8515('0x21')](_0x4e4b48);}return _0x1c6738[_0x8515('0x22')]();};}function saveUpdates(_0xf3dac,_0x11d913){return function(_0x3d4d55){if(_0x3d4d55){return _0x3d4d55[_0x8515('0x23')](_0xf3dac)[_0x8515('0x24')](function(_0x331862){return _0x331862;});}return null;};}function removeEntity(_0x20539c,_0x34d408){return function(_0x22d878){if(_0x22d878){return _0x22d878['destroy']()['then'](function(){var _0x1c9884=_0x22d878[_0x8515('0x25')]({'plain':!![]});var _0x241794=_0x8515('0x26');return db[_0x8515('0x27')][_0x8515('0x28')]({'where':{'type':_0x241794,'resourceId':_0x1c9884['id']}})['then'](function(){return _0x22d878;});})['then'](function(){_0x20539c[_0x8515('0x18')](0xcc)[_0x8515('0x29')]();});}};}function handleEntityNotFound(_0x382266,_0x5f32f7){return function(_0x118f2d){if(!_0x118f2d){_0x382266[_0x8515('0x2a')](0x194);}return _0x118f2d;};}function handleError(_0xcd1d7d,_0x40e5c1){_0x40e5c1=_0x40e5c1||0x1f4;return function(_0x363bf0){logger[_0x8515('0x2b')](_0x363bf0[_0x8515('0x2c')]);if(_0x363bf0[_0x8515('0x2d')]){delete _0x363bf0[_0x8515('0x2d')];}_0xcd1d7d[_0x8515('0x18')](_0x40e5c1)['send'](_0x363bf0);};}exports[_0x8515('0x2e')]=function(_0x5b6e12,_0x4a7ecf){var _0x539851={},_0x18e750={},_0x5ef4d8={'count':0x0,'rows':[]};var _0x3e185b=_['map'](db[_0x8515('0x2f')]['rawAttributes'],function(_0x4d60fa){return{'name':_0x4d60fa[_0x8515('0x30')],'type':_0x4d60fa['type'][_0x8515('0x31')]};});_0x18e750['model']=_[_0x8515('0x32')](_0x3e185b,_0x8515('0x2d'));_0x18e750[_0x8515('0x33')]=_['keys'](_0x5b6e12[_0x8515('0x33')]);_0x18e750[_0x8515('0x34')]=_[_0x8515('0x35')](_0x18e750['model'],_0x18e750[_0x8515('0x33')]);_0x539851[_0x8515('0x36')]=_[_0x8515('0x35')](_0x18e750[_0x8515('0x37')],qs['fields'](_0x5b6e12[_0x8515('0x33')][_0x8515('0x38')]));_0x539851[_0x8515('0x36')]=_0x539851[_0x8515('0x36')][_0x8515('0x39')]?_0x539851[_0x8515('0x36')]:_0x18e750[_0x8515('0x37')];if(!_0x5b6e12['query'][_0x8515('0x3a')](_0x8515('0x3b'))){_0x539851[_0x8515('0x1b')]=qs[_0x8515('0x1b')](_0x5b6e12[_0x8515('0x33')]['limit']);_0x539851[_0x8515('0x1a')]=qs[_0x8515('0x1a')](_0x5b6e12[_0x8515('0x33')][_0x8515('0x1a')]);}_0x539851[_0x8515('0x3c')]=qs[_0x8515('0x3d')](_0x5b6e12['query'][_0x8515('0x3d')]);_0x539851[_0x8515('0x3e')]=qs[_0x8515('0x34')](_[_0x8515('0x3f')](_0x5b6e12[_0x8515('0x33')],_0x18e750[_0x8515('0x34')]),_0x3e185b);if(_0x5b6e12[_0x8515('0x33')][_0x8515('0x40')]){_0x539851[_0x8515('0x3e')]=_[_0x8515('0x41')](_0x539851[_0x8515('0x3e')],{'$or':_[_0x8515('0x32')](_0x3e185b,function(_0x54acce){if(_0x54acce[_0x8515('0x42')]!==_0x8515('0x43')){var _0x5e6411={};_0x5e6411[_0x54acce['name']]={'$like':'%'+_0x5b6e12[_0x8515('0x33')][_0x8515('0x40')]+'%'};return _0x5e6411;}})});}_0x539851=_[_0x8515('0x41')]({},_0x539851,_0x5b6e12[_0x8515('0x44')]);var _0x34363c={'where':_0x539851[_0x8515('0x3e')]};return db[_0x8515('0x2f')][_0x8515('0x1d')](_0x34363c)[_0x8515('0x24')](function(_0xbbf248){_0x5ef4d8['count']=_0xbbf248;if(_0x5b6e12[_0x8515('0x33')][_0x8515('0x45')]){_0x539851['include']=[{'all':!![]}];}return db[_0x8515('0x2f')][_0x8515('0x46')](_0x539851);})[_0x8515('0x24')](function(_0x35234d){_0x5ef4d8['rows']=_0x35234d;return _0x5ef4d8;})[_0x8515('0x24')](respondWithFilteredResult(_0x4a7ecf,_0x539851))['catch'](handleError(_0x4a7ecf,null));};exports[_0x8515('0x47')]=function(_0x1b438a,_0x2aba5a){var _0x46ea03={'raw':!![],'where':{'id':_0x1b438a[_0x8515('0x48')]['id']}},_0x2b4a22={};_0x2b4a22['model']=_[_0x8515('0x49')](db['Variable'][_0x8515('0x4a')]);_0x2b4a22['query']=_['keys'](_0x1b438a[_0x8515('0x33')]);_0x2b4a22[_0x8515('0x34')]=_[_0x8515('0x35')](_0x2b4a22[_0x8515('0x37')],_0x2b4a22[_0x8515('0x33')]);_0x46ea03[_0x8515('0x36')]=_[_0x8515('0x35')](_0x2b4a22[_0x8515('0x37')],qs[_0x8515('0x38')](_0x1b438a['query'][_0x8515('0x38')]));_0x46ea03[_0x8515('0x36')]=_0x46ea03[_0x8515('0x36')][_0x8515('0x39')]?_0x46ea03['attributes']:_0x2b4a22[_0x8515('0x37')];if(_0x1b438a[_0x8515('0x33')][_0x8515('0x45')]){_0x46ea03['include']=[{'all':!![]}];}_0x46ea03=_[_0x8515('0x41')]({},_0x46ea03,_0x1b438a['options']);return db[_0x8515('0x2f')]['find'](_0x46ea03)[_0x8515('0x24')](handleEntityNotFound(_0x2aba5a,null))['then'](respondWithResult(_0x2aba5a,null))[_0x8515('0x4b')](handleError(_0x2aba5a,null));};exports[_0x8515('0x4c')]=function(_0x38bc95,_0x474eb7){return db['Variable'][_0x8515('0x4c')](_0x38bc95[_0x8515('0x4d')],{})[_0x8515('0x24')](function(_0x8492f5){var _0x115a86=_0x38bc95[_0x8515('0x4e')][_0x8515('0x25')]({'plain':!![]});if(!_0x115a86)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x115a86[_0x8515('0x4f')]==='user'){var _0xec3fb9=_0x8492f5[_0x8515('0x25')]({'plain':!![]});var _0x1d6c91=_0x8515('0x26');return db[_0x8515('0x50')]['find']({'where':{'name':_0x1d6c91,'userProfileId':_0x115a86[_0x8515('0x51')]},'raw':!![]})[_0x8515('0x24')](function(_0x83a709){if(_0x83a709&&_0x83a709['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xec3fb9[_0x8515('0x2d')],'resourceId':_0xec3fb9['id'],'type':_0x83a709[_0x8515('0x2d')],'sectionId':_0x83a709['id']},{})[_0x8515('0x24')](function(){return _0x8492f5;});}else{return _0x8492f5;}})[_0x8515('0x4b')](function(_0x1635a0){logger[_0x8515('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1635a0);throw _0x1635a0;});}return _0x8492f5;})[_0x8515('0x24')](respondWithResult(_0x474eb7,0xc9))['catch'](handleError(_0x474eb7,null));};exports[_0x8515('0x23')]=function(_0x53569e,_0x34f221){if(_0x53569e[_0x8515('0x4d')]['id']){delete _0x53569e[_0x8515('0x4d')]['id'];}return db['Variable'][_0x8515('0x52')]({'where':{'id':_0x53569e[_0x8515('0x48')]['id']}})[_0x8515('0x24')](handleEntityNotFound(_0x34f221,null))[_0x8515('0x24')](saveUpdates(_0x53569e[_0x8515('0x4d')],null))[_0x8515('0x24')](respondWithResult(_0x34f221,null))[_0x8515('0x4b')](handleError(_0x34f221,null));};exports[_0x8515('0x28')]=function(_0x4a020c,_0x4acc3d){return db[_0x8515('0x2f')][_0x8515('0x52')]({'where':{'id':_0x4a020c[_0x8515('0x48')]['id']}})[_0x8515('0x24')](handleEntityNotFound(_0x4acc3d,null))[_0x8515('0x24')](removeEntity(_0x4acc3d,null))[_0x8515('0x4b')](handleError(_0x4acc3d,null));}; \ No newline at end of file +var _0x89a2=['destroy','error','stack','name','send','index','rawAttributes','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','merge','filter','Variable','includeAll','include','catch','show','params','keys','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','update','then','get','Variables'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x89a2,0x154));var _0x289a=function(_0x3d8776,_0x5305dc){_0x3d8776=_0x3d8776-0x0;var _0x51d331=_0x89a2[_0x3d8776];return _0x51d331;};'use strict';var emlformat=require(_0x289a('0x0'));var rimraf=require(_0x289a('0x1'));var zipdir=require(_0x289a('0x2'));var jsonpatch=require(_0x289a('0x3'));var rp=require(_0x289a('0x4'));var moment=require(_0x289a('0x5'));var BPromise=require(_0x289a('0x6'));var Mustache=require('mustache');var util=require(_0x289a('0x7'));var path=require(_0x289a('0x8'));var sox=require(_0x289a('0x9'));var csv=require(_0x289a('0xa'));var ejs=require(_0x289a('0xb'));var fs=require('fs');var fs_extra=require(_0x289a('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x289a('0xd'));var jsforce=require(_0x289a('0xe'));var deskjs=require(_0x289a('0xf'));var toCsv=require(_0x289a('0xa'));var querystring=require(_0x289a('0x10'));var Papa=require(_0x289a('0x11'));var Redis=require(_0x289a('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x289a('0x13'));var hardwareService=require(_0x289a('0x14'));var logger=require('../../config/logger')(_0x289a('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x289a('0x16'))['db'];function respondWithStatusCode(_0x54cafb,_0x34d46a){_0x34d46a=_0x34d46a||0xcc;return function(_0xcaf56d){if(_0xcaf56d){return _0x54cafb[_0x289a('0x17')](_0x34d46a);}return _0x54cafb[_0x289a('0x18')](_0x34d46a)[_0x289a('0x19')]();};}function respondWithResult(_0x119558,_0x24695b){_0x24695b=_0x24695b||0xc8;return function(_0x42d305){if(_0x42d305){return _0x119558[_0x289a('0x18')](_0x24695b)[_0x289a('0x1a')](_0x42d305);}};}function respondWithFilteredResult(_0x2ee930,_0x1d6286){return function(_0x1e6808){if(_0x1e6808){var _0x564073=typeof _0x1d6286['offset']==='undefined'&&typeof _0x1d6286[_0x289a('0x1b')]===_0x289a('0x1c');var _0x528953=_0x1e6808[_0x289a('0x1d')];var _0x2eafa6=_0x564073?0x0:_0x1d6286[_0x289a('0x1e')];var _0x413d3f=_0x564073?_0x1e6808['count']:_0x1d6286[_0x289a('0x1e')]+_0x1d6286[_0x289a('0x1b')];var _0x2bd434;if(_0x413d3f>=_0x528953){_0x413d3f=_0x528953;_0x2bd434=0xc8;}else{_0x2bd434=0xce;}_0x2ee930[_0x289a('0x18')](_0x2bd434);return _0x2ee930['set']('Content-Range',_0x2eafa6+'-'+_0x413d3f+'/'+_0x528953)[_0x289a('0x1a')](_0x1e6808);}return null;};}function patchUpdates(_0x30adcc){return function(_0x2b89fd){try{jsonpatch['apply'](_0x2b89fd,_0x30adcc,!![]);}catch(_0xf23ada){return BPromise['reject'](_0xf23ada);}return _0x2b89fd['save']();};}function saveUpdates(_0x43d53d,_0x33e118){return function(_0x1f901f){if(_0x1f901f){return _0x1f901f[_0x289a('0x1f')](_0x43d53d)[_0x289a('0x20')](function(_0x2458e4){return _0x2458e4;});}return null;};}function removeEntity(_0x2dce40,_0x200b3b){return function(_0x32f785){if(_0x32f785){return _0x32f785['destroy']()['then'](function(){var _0x2bed75=_0x32f785[_0x289a('0x21')]({'plain':!![]});var _0xd2a9ce=_0x289a('0x22');return db['UserProfileResource'][_0x289a('0x23')]({'where':{'type':_0xd2a9ce,'resourceId':_0x2bed75['id']}})[_0x289a('0x20')](function(){return _0x32f785;});})[_0x289a('0x20')](function(){_0x2dce40[_0x289a('0x18')](0xcc)[_0x289a('0x19')]();});}};}function handleEntityNotFound(_0x24ff82,_0x4492e1){return function(_0x31d359){if(!_0x31d359){_0x24ff82[_0x289a('0x17')](0x194);}return _0x31d359;};}function handleError(_0x5302bf,_0xd1f535){_0xd1f535=_0xd1f535||0x1f4;return function(_0x46e544){logger[_0x289a('0x24')](_0x46e544[_0x289a('0x25')]);if(_0x46e544[_0x289a('0x26')]){delete _0x46e544[_0x289a('0x26')];}_0x5302bf[_0x289a('0x18')](_0xd1f535)[_0x289a('0x27')](_0x46e544);};}exports[_0x289a('0x28')]=function(_0x515b8f,_0x40fb5d){var _0x3f6955={},_0x5476c2={},_0x87cabc={'count':0x0,'rows':[]};var _0x45d937=_['map'](db['Variable'][_0x289a('0x29')],function(_0x3c2a26){return{'name':_0x3c2a26['fieldName'],'type':_0x3c2a26[_0x289a('0x2a')][_0x289a('0x2b')]};});_0x5476c2['model']=_[_0x289a('0x2c')](_0x45d937,_0x289a('0x26'));_0x5476c2[_0x289a('0x2d')]=_['keys'](_0x515b8f[_0x289a('0x2d')]);_0x5476c2[_0x289a('0x2e')]=_[_0x289a('0x2f')](_0x5476c2[_0x289a('0x30')],_0x5476c2[_0x289a('0x2d')]);_0x3f6955[_0x289a('0x31')]=_[_0x289a('0x2f')](_0x5476c2['model'],qs[_0x289a('0x32')](_0x515b8f['query'][_0x289a('0x32')]));_0x3f6955[_0x289a('0x31')]=_0x3f6955['attributes'][_0x289a('0x33')]?_0x3f6955['attributes']:_0x5476c2[_0x289a('0x30')];if(!_0x515b8f[_0x289a('0x2d')][_0x289a('0x34')]('nolimit')){_0x3f6955[_0x289a('0x1b')]=qs[_0x289a('0x1b')](_0x515b8f['query'][_0x289a('0x1b')]);_0x3f6955[_0x289a('0x1e')]=qs[_0x289a('0x1e')](_0x515b8f[_0x289a('0x2d')][_0x289a('0x1e')]);}_0x3f6955[_0x289a('0x35')]=qs[_0x289a('0x36')](_0x515b8f[_0x289a('0x2d')]['sort']);_0x3f6955[_0x289a('0x37')]=qs[_0x289a('0x2e')](_['pick'](_0x515b8f[_0x289a('0x2d')],_0x5476c2['filters']),_0x45d937);if(_0x515b8f['query']['filter']){_0x3f6955[_0x289a('0x37')]=_[_0x289a('0x38')](_0x3f6955[_0x289a('0x37')],{'$or':_[_0x289a('0x2c')](_0x45d937,function(_0x2a4be8){if(_0x2a4be8[_0x289a('0x2a')]!=='VIRTUAL'){var _0x2dfa0b={};_0x2dfa0b[_0x2a4be8[_0x289a('0x26')]]={'$like':'%'+_0x515b8f[_0x289a('0x2d')][_0x289a('0x39')]+'%'};return _0x2dfa0b;}})});}_0x3f6955=_[_0x289a('0x38')]({},_0x3f6955,_0x515b8f['options']);var _0x3c83b5={'where':_0x3f6955[_0x289a('0x37')]};return db[_0x289a('0x3a')][_0x289a('0x1d')](_0x3c83b5)[_0x289a('0x20')](function(_0x166131){_0x87cabc[_0x289a('0x1d')]=_0x166131;if(_0x515b8f[_0x289a('0x2d')][_0x289a('0x3b')]){_0x3f6955[_0x289a('0x3c')]=[{'all':!![]}];}return db[_0x289a('0x3a')]['findAll'](_0x3f6955);})['then'](function(_0x4c7f3c){_0x87cabc['rows']=_0x4c7f3c;return _0x87cabc;})[_0x289a('0x20')](respondWithFilteredResult(_0x40fb5d,_0x3f6955))[_0x289a('0x3d')](handleError(_0x40fb5d,null));};exports[_0x289a('0x3e')]=function(_0x480ca2,_0x45ab25){var _0x3809cf={'raw':!![],'where':{'id':_0x480ca2[_0x289a('0x3f')]['id']}},_0x4d41e7={};_0x4d41e7['model']=_[_0x289a('0x40')](db[_0x289a('0x3a')][_0x289a('0x29')]);_0x4d41e7[_0x289a('0x2d')]=_[_0x289a('0x40')](_0x480ca2[_0x289a('0x2d')]);_0x4d41e7[_0x289a('0x2e')]=_['intersection'](_0x4d41e7[_0x289a('0x30')],_0x4d41e7[_0x289a('0x2d')]);_0x3809cf['attributes']=_[_0x289a('0x2f')](_0x4d41e7['model'],qs[_0x289a('0x32')](_0x480ca2[_0x289a('0x2d')]['fields']));_0x3809cf[_0x289a('0x31')]=_0x3809cf[_0x289a('0x31')][_0x289a('0x33')]?_0x3809cf[_0x289a('0x31')]:_0x4d41e7[_0x289a('0x30')];if(_0x480ca2[_0x289a('0x2d')]['includeAll']){_0x3809cf[_0x289a('0x3c')]=[{'all':!![]}];}_0x3809cf=_['merge']({},_0x3809cf,_0x480ca2[_0x289a('0x41')]);return db[_0x289a('0x3a')][_0x289a('0x42')](_0x3809cf)[_0x289a('0x20')](handleEntityNotFound(_0x45ab25,null))[_0x289a('0x20')](respondWithResult(_0x45ab25,null))[_0x289a('0x3d')](handleError(_0x45ab25,null));};exports['create']=function(_0x31b34c,_0x4dfef9){return db[_0x289a('0x3a')]['create'](_0x31b34c[_0x289a('0x43')],{})['then'](function(_0x36676f){var _0x18c291=_0x31b34c[_0x289a('0x44')][_0x289a('0x21')]({'plain':!![]});if(!_0x18c291)throw new Error(_0x289a('0x45'));if(_0x18c291[_0x289a('0x46')]===_0x289a('0x44')){var _0x5e6654=_0x36676f[_0x289a('0x21')]({'plain':!![]});var _0x5cf644='Variables';return db[_0x289a('0x47')][_0x289a('0x42')]({'where':{'name':_0x5cf644,'userProfileId':_0x18c291[_0x289a('0x48')]},'raw':!![]})[_0x289a('0x20')](function(_0x449871){if(_0x449871&&_0x449871['autoAssociation']===0x0){return db[_0x289a('0x49')]['create']({'name':_0x5e6654[_0x289a('0x26')],'resourceId':_0x5e6654['id'],'type':_0x449871['name'],'sectionId':_0x449871['id']},{})[_0x289a('0x20')](function(){return _0x36676f;});}else{return _0x36676f;}})[_0x289a('0x3d')](function(_0x2e702b){logger[_0x289a('0x24')](_0x289a('0x4a'),_0x2e702b);throw _0x2e702b;});}return _0x36676f;})['then'](respondWithResult(_0x4dfef9,0xc9))[_0x289a('0x3d')](handleError(_0x4dfef9,null));};exports['update']=function(_0x5d94c5,_0x2f3ac6){if(_0x5d94c5[_0x289a('0x43')]['id']){delete _0x5d94c5[_0x289a('0x43')]['id'];}return db[_0x289a('0x3a')]['find']({'where':{'id':_0x5d94c5['params']['id']}})['then'](handleEntityNotFound(_0x2f3ac6,null))['then'](saveUpdates(_0x5d94c5[_0x289a('0x43')],null))['then'](respondWithResult(_0x2f3ac6,null))[_0x289a('0x3d')](handleError(_0x2f3ac6,null));};exports[_0x289a('0x23')]=function(_0x4c6a52,_0x2e437d){return db[_0x289a('0x3a')][_0x289a('0x42')]({'where':{'id':_0x4c6a52[_0x289a('0x3f')]['id']}})[_0x289a('0x20')](handleEntityNotFound(_0x2e437d,null))[_0x289a('0x20')](removeEntity(_0x2e437d,null))['catch'](handleError(_0x2e437d,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 47004b4..cc1a97b 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 _0xf29f=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./variable.attributes','define','tools_variables','lodash','util'];(function(_0x36b6b4,_0x48813c){var _0x44f801=function(_0x369a62){while(--_0x369a62){_0x36b6b4['push'](_0x36b6b4['shift']());}};_0x44f801(++_0x48813c);}(_0xf29f,0xee));var _0xff29=function(_0x3e6a8f,_0x27984b){_0x3e6a8f=_0x3e6a8f-0x0;var _0x276412=_0xf29f[_0x3e6a8f];return _0x276412;};'use strict';var _=require(_0xff29('0x0'));var util=require(_0xff29('0x1'));var logger=require(_0xff29('0x2'))(_0xff29('0x3'));var moment=require(_0xff29('0x4'));var BPromise=require(_0xff29('0x5'));var rp=require(_0xff29('0x6'));var fs=require('fs');var path=require(_0xff29('0x7'));var rimraf=require(_0xff29('0x8'));var config=require('../../config/environment');var attributes=require(_0xff29('0x9'));module['exports']=function(_0x180db9,_0x3f86a9){return _0x180db9[_0xff29('0xa')]('Variable',attributes,{'tableName':_0xff29('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee9d=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','define','Variable','tools_variables','util','../../config/logger'];(function(_0x209635,_0x71da56){var _0x25c097=function(_0x4f179e){while(--_0x4f179e){_0x209635['push'](_0x209635['shift']());}};_0x25c097(++_0x71da56);}(_0xee9d,0x1c5));var _0xdee9=function(_0x266c09,_0x34ca33){_0x266c09=_0x266c09-0x0;var _0x2afcfb=_0xee9d[_0x266c09];return _0x2afcfb;};'use strict';var _=require('lodash');var util=require(_0xdee9('0x0'));var logger=require(_0xdee9('0x1'))(_0xdee9('0x2'));var moment=require(_0xdee9('0x3'));var BPromise=require(_0xdee9('0x4'));var rp=require(_0xdee9('0x5'));var fs=require('fs');var path=require(_0xdee9('0x6'));var rimraf=require(_0xdee9('0x7'));var config=require(_0xdee9('0x8'));var attributes=require(_0xdee9('0x9'));module['exports']=function(_0x50125e,_0x29f2bc){return _0x50125e[_0xdee9('0xa')](_0xdee9('0xb'),attributes,{'tableName':_0xdee9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index c383d38..8a70948 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 _0x814b=['model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowVariable','options','where','include','map','attributes'];(function(_0x1a4ba8,_0x30314c){var _0x1343dc=function(_0x37d9cb){while(--_0x37d9cb){_0x1a4ba8['push'](_0x1a4ba8['shift']());}};_0x1343dc(++_0x30314c);}(_0x814b,0x1a2));var _0xb814=function(_0xe480f0,_0x4c0dc1){_0xe480f0=_0xe480f0-0x0;var _0x57b198=_0x814b[_0xe480f0];return _0x57b198;};'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')]('Variable,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});}exports[_0xb814('0x18')]=function(_0x55ba16){var _0x270598=this;return new Promise(function(_0xfac75b,_0x4c3007){return db['Variable']['find']({'raw':_0x55ba16[_0xb814('0x19')]?_0x55ba16['options']['raw']===undefined?!![]:![]:!![],'where':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1a')]||null:null,'attributes':_0x55ba16['options']?_0x55ba16[_0xb814('0x19')]['attributes']||null:null,'include':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')],function(_0x1f5d40){return{'model':db[_0x1f5d40['model']],'as':_0x1f5d40['as'],'attributes':_0x1f5d40[_0xb814('0x1d')],'include':_0x1f5d40['include']?_[_0xb814('0x1c')](_0x1f5d40[_0xb814('0x1b')],function(_0x31c7ec){return{'model':db[_0x31c7ec[_0xb814('0x1e')]],'as':_0x31c7ec['as'],'attributes':_0x31c7ec[_0xb814('0x1d')],'include':_0x31c7ec[_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x31c7ec['include'],function(_0x392222){return{'model':db[_0x392222[_0xb814('0x1e')]],'as':_0x392222['as'],'attributes':_0x392222[_0xb814('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb814('0xd')](function(_0x32ed56){logger[_0xb814('0xe')](_0xb814('0x18'),_0x55ba16);logger[_0xb814('0x11')]('ShowVariable',_0x55ba16,JSON[_0xb814('0x1f')](_0x32ed56));_0xfac75b(_0x32ed56);})[_0xb814('0x17')](function(_0x52ed64){logger[_0xb814('0x13')](_0xb814('0x18'),_0x52ed64[_0xb814('0x15')],_0x55ba16);_0x4c3007(_0x270598['error'](0x1f4,_0x52ed64[_0xb814('0x15')]));});});}; \ No newline at end of file +var _0x6aa7=['include','model','attributes','map','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowVariable','find','options','raw','where'];(function(_0x29f095,_0x5c23ac){var _0x180061=function(_0x49c12d){while(--_0x49c12d){_0x29f095['push'](_0x29f095['shift']());}};_0x180061(++_0x5c23ac);}(_0x6aa7,0x178));var _0x76aa=function(_0x163997,_0x484234){_0x163997=_0x163997-0x0;var _0x37921d=_0x6aa7[_0x163997];return _0x37921d;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});}exports[_0x76aa('0x16')]=function(_0x21c16d){var _0xa1bc7=this;return new Promise(function(_0x3ead3f,_0x496902){return db['Variable'][_0x76aa('0x17')]({'raw':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x19')]===undefined?!![]:![]:!![],'where':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1a')]||null:null,'attributes':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')]['attributes']||null:null,'include':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')]?_['map'](_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')],function(_0x31252f){return{'model':db[_0x31252f[_0x76aa('0x1c')]],'as':_0x31252f['as'],'attributes':_0x31252f[_0x76aa('0x1d')],'include':_0x31252f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x31252f[_0x76aa('0x1b')],function(_0x32bf9f){return{'model':db[_0x32bf9f[_0x76aa('0x1c')]],'as':_0x32bf9f['as'],'attributes':_0x32bf9f[_0x76aa('0x1d')],'include':_0x32bf9f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x32bf9f['include'],function(_0xb5e8a9){return{'model':db[_0xb5e8a9[_0x76aa('0x1c')]],'as':_0xb5e8a9['as'],'attributes':_0xb5e8a9[_0x76aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x76aa('0xa')](function(_0xa1e6){logger[_0x76aa('0xb')](_0x76aa('0x16'),_0x21c16d);logger[_0x76aa('0xe')](_0x76aa('0x16'),_0x21c16d,JSON[_0x76aa('0x10')](_0xa1e6));_0x3ead3f(_0xa1e6);})['catch'](function(_0x3fcb7f){logger['error'](_0x76aa('0x16'),_0x3fcb7f[_0x76aa('0x13')],_0x21c16d);_0x496902(_0xa1bc7[_0x76aa('0x11')](0x1f4,_0x3fcb7f[_0x76aa('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 0f61552..149f336 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 _0x56b8=['fetch','/reset','reset','/restart','restart','/migrations','exports','express','Router','./version.controller','get','/fetch','isAuthenticated','canUpdate'];(function(_0x43d79c,_0x531a55){var _0x4866b0=function(_0x847a){while(--_0x847a){_0x43d79c['push'](_0x43d79c['shift']());}};_0x4866b0(++_0x531a55);}(_0x56b8,0xaf));var _0x856b=function(_0x54d301,_0x4fa59d){_0x54d301=_0x54d301-0x0;var _0x16f50c=_0x56b8[_0x54d301];return _0x16f50c;};'use strict';var express=require(_0x856b('0x0'));var router=express[_0x856b('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x856b('0x2'));router[_0x856b('0x3')]('/',controller['index']);router[_0x856b('0x3')](_0x856b('0x4'),auth[_0x856b('0x5')](),auth[_0x856b('0x6')](),controller[_0x856b('0x7')]);router[_0x856b('0x3')](_0x856b('0x8'),auth['isAuthenticated'](),auth[_0x856b('0x6')](),controller[_0x856b('0x9')]);router[_0x856b('0x3')]('/pull',auth[_0x856b('0x5')](),auth[_0x856b('0x6')](),controller['pull']);router[_0x856b('0x3')](_0x856b('0xa'),auth[_0x856b('0x5')](),controller[_0x856b('0xb')]);router['get'](_0x856b('0xc'),controller['migrations']);module[_0x856b('0xd')]=router; \ No newline at end of file +var _0x2637=['/restart','restart','/migrations','migrations','express','Router','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull'];(function(_0x58547b,_0x4b89c2){var _0x1d3fd2=function(_0x4ac500){while(--_0x4ac500){_0x58547b['push'](_0x58547b['shift']());}};_0x1d3fd2(++_0x4b89c2);}(_0x2637,0xe4));var _0x7263=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0x2637[_0x5a79e2];return _0x266c45;};'use strict';var express=require(_0x7263('0x0'));var router=express[_0x7263('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x7263('0x2'));router[_0x7263('0x3')]('/',controller[_0x7263('0x4')]);router[_0x7263('0x3')](_0x7263('0x5'),auth[_0x7263('0x6')](),auth[_0x7263('0x7')](),controller[_0x7263('0x8')]);router[_0x7263('0x3')](_0x7263('0x9'),auth[_0x7263('0x6')](),auth[_0x7263('0x7')](),controller[_0x7263('0xa')]);router['get'](_0x7263('0xb'),auth[_0x7263('0x6')](),auth['canUpdate'](),controller['pull']);router[_0x7263('0x3')](_0x7263('0xc'),auth[_0x7263('0x6')](),controller[_0x7263('0xd')]);router[_0x7263('0x3')](_0x7263('0xe'),controller[_0x7263('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index acaffa3..7a20369 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 _0x3be9=['latest','tags','status','json','fetch','origin','error','info','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','join','server','migrations','length','replace','.js','sort','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','child_process','exec','../../mysqldb','../../config/logger','update','simple-git','root','exports','query'];(function(_0x221f8b,_0x183eef){var _0x1f702d=function(_0x28003f){while(--_0x28003f){_0x221f8b['push'](_0x221f8b['shift']());}};_0x1f702d(++_0x183eef);}(_0x3be9,0x182));var _0x93be=function(_0x7185f7,_0x37065){_0x7185f7=_0x7185f7-0x0;var _0x182e45=_0x3be9[_0x7185f7];return _0x182e45;};'use strict';var Umzug=require(_0x93be('0x0'));var path=require(_0x93be('0x1'));var fs=require('fs');var _=require(_0x93be('0x2'));var pkginfo=require(_0x93be('0x3'))(module,_0x93be('0x4'));var compareVersions=require('compare-versions');var exec=require(_0x93be('0x5'))[_0x93be('0x6')];var db=require(_0x93be('0x7'))['db'];var config=require('../../config/environment');var pm2=require('../../config/pm2');var logger=require(_0x93be('0x8'))(_0x93be('0x9'));var git=require(_0x93be('0xa'))(config[_0x93be('0xb')]);exports['index']=function(_0x51f7f1,_0x2a852a){var _0x507e25={'current':module[_0x93be('0xc')][_0x93be('0x4')],'phonebar':0x2};if(_0x51f7f1[_0x93be('0xd')]&&_0x51f7f1[_0x93be('0xd')][_0x93be('0xe')]){return git['fetch']()[_0x93be('0xf')](function(_0xa62af1,_0x172e31){_0x507e25['latest']=(_0xa62af1?module[_0x93be('0xc')][_0x93be('0x4')]:_0x172e31[_0x93be('0xe')])||'2.0.0';return _0x2a852a[_0x93be('0x10')](0xc8)[_0x93be('0x11')](_0x507e25);});}else{return _0x2a852a['status'](0xc8)[_0x93be('0x11')](_0x507e25);}};exports['fetch']=function(_0x5984db,_0x4d9327){return git[_0x93be('0x12')]([_0x93be('0x13'),'master'],function(_0x48a248){if(_0x48a248){logger[_0x93be('0x14')](_0x48a248);return _0x4d9327[_0x93be('0x10')](0x1f4)['json'](_0x48a248);}logger[_0x93be('0x15')]('git\x20fetch');return _0x4d9327[_0x93be('0x10')](0xc8)[_0x93be('0x11')]({'output':_0x93be('0x16')});});};exports[_0x93be('0x17')]=function(_0x5e140,_0x8221a0){return git[_0x93be('0x17')]([_0x93be('0x18'),_0x93be('0x19')],function(_0x105b3f){if(_0x105b3f){logger[_0x93be('0x14')](_0x105b3f);return _0x8221a0[_0x93be('0x10')](0x1f4)[_0x93be('0x11')](_0x105b3f);}logger[_0x93be('0x15')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x8221a0[_0x93be('0x10')](0xc8)[_0x93be('0x11')]({'output':'git\x20reset\x20--hard'});});};exports[_0x93be('0x1a')]=function(_0x4aa533,_0x2ee348){exec(_0x93be('0x1b'),function(_0x525827,_0x130a58,_0x3dac08){logger['info'](_0x130a58);logger['info'](_0x3dac08);if(_0x525827){logger['error'](_0x525827);return _0x2ee348['status'](0x1f4)[_0x93be('0x11')](_0x525827);}return _0x2ee348['status'](0xc8)[_0x93be('0x11')]({'output':_0x130a58});});};exports[_0x93be('0x1c')]=function(_0x4d1aa3,_0x2f4dcf){return pm2[_0x93be('0x1c')](_0x93be('0x1d'))[_0x93be('0x1e')](function(_0x2fc45f){logger['info'](_0x93be('0x1f'),_0x2fc45f);return _0x2f4dcf[_0x93be('0x10')](0xc8)['json']({'output':_0x93be('0x20')});})[_0x93be('0x21')](function(_0x510d6e){logger[_0x93be('0x14')](_0x510d6e);return _0x2f4dcf[_0x93be('0x10')](0x1f4)[_0x93be('0x11')](_0x510d6e);});};exports['migrations']=function(_0x124b24,_0x130cb5){var _0x52b983=fs['readdirSync'](path[_0x93be('0x22')](config[_0x93be('0xb')],_0x93be('0x23'),_0x93be('0x24')));var _0xc8c049=[];for(var _0x14c601=0x0;_0x14c601<_0x52b983[_0x93be('0x25')];_0x14c601++){var _0x390bc2=_0x52b983[_0x14c601][_0x93be('0x26')](_0x93be('0x27'),'');if(compareVersions(module['exports'][_0x93be('0x4')],_0x390bc2)===-0x1){_0xc8c049['push'](_0x390bc2);}}if(_0xc8c049['length']){var _0x2bfb3e=_0xc8c049[_0x93be('0x28')](compareVersions);var _0x2192c0=new Umzug({'storage':_0x93be('0x29'),'storageOptions':{'model':db[_0x93be('0x2a')],'modelName':_0x93be('0x2a'),'columnName':'version'},'migrations':{'params':[db[_0x93be('0x29')]['getQueryInterface'](),db[_0x93be('0x29')][_0x93be('0x2b')],function(){throw new Error(_0x93be('0x2c'));}],'path':path['join'](config[_0x93be('0xb')],_0x93be('0x23'),_0x93be('0x24')),'pattern':/\.js$/}});_0x2192c0['up']({'migrations':_[_0x93be('0x2d')](_0x2bfb3e,function(_0x3305e0){return _0x3305e0+'.js';})})[_0x93be('0x1e')](function(){return _0x130cb5[_0x93be('0x10')](0xc8)[_0x93be('0x11')]({'output':_0x93be('0x2e')+module[_0x93be('0xc')][_0x93be('0x4')]+'\x20to\x20'+_[_0x93be('0x2f')](_0x2bfb3e),'migrations':_[_0x93be('0x22')](_0x2bfb3e)});})[_0x93be('0x21')](function(_0x70bdf1){if(_0x70bdf1 instanceof db['sequelize'][_0x93be('0x30')]){return _0x130cb5[_0x93be('0x10')](0xc8)[_0x93be('0x11')]({'output':_0x93be('0x31')});}else{return _0x130cb5['status'](0x1f4)[_0x93be('0x11')](_0x70bdf1);}});}else{return _0x130cb5['status'](0xc8)[_0x93be('0x11')]({'output':_0x93be('0x31')});}}; \ No newline at end of file +var _0x0a75=['Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','join','server','length','replace','.js','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.','map','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','root','index','exports','query','latest','fetch','tags','status','json','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','restart','pm2\x20restart\x20motion\x20%s'];(function(_0x4b84c1,_0x2a697e){var _0x3f926e=function(_0x46c15c){while(--_0x46c15c){_0x4b84c1['push'](_0x4b84c1['shift']());}};_0x3f926e(++_0x2a697e);}(_0x0a75,0x1e8));var _0x50a7=function(_0x908934,_0x4fd55d){_0x908934=_0x908934-0x0;var _0x20ff50=_0x0a75[_0x908934];return _0x20ff50;};'use strict';var Umzug=require(_0x50a7('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x50a7('0x1'));var pkginfo=require('pkginfo')(module,_0x50a7('0x2'));var compareVersions=require(_0x50a7('0x3'));var exec=require(_0x50a7('0x4'))[_0x50a7('0x5')];var db=require(_0x50a7('0x6'))['db'];var config=require(_0x50a7('0x7'));var pm2=require(_0x50a7('0x8'));var logger=require(_0x50a7('0x9'))('update');var git=require('simple-git')(config[_0x50a7('0xa')]);exports[_0x50a7('0xb')]=function(_0x44e679,_0x1da1d8){var _0x1363d9={'current':module[_0x50a7('0xc')][_0x50a7('0x2')],'phonebar':0x2};if(_0x44e679['query']&&_0x44e679[_0x50a7('0xd')][_0x50a7('0xe')]){return git[_0x50a7('0xf')]()[_0x50a7('0x10')](function(_0x5c4d51,_0x595895){_0x1363d9[_0x50a7('0xe')]=(_0x5c4d51?module['exports']['version']:_0x595895[_0x50a7('0xe')])||'2.0.0';return _0x1da1d8[_0x50a7('0x11')](0xc8)[_0x50a7('0x12')](_0x1363d9);});}else{return _0x1da1d8['status'](0xc8)['json'](_0x1363d9);}};exports[_0x50a7('0xf')]=function(_0x5a819a,_0x2ce656){return git[_0x50a7('0xf')]([_0x50a7('0x13'),_0x50a7('0x14')],function(_0x7f010b){if(_0x7f010b){logger[_0x50a7('0x15')](_0x7f010b);return _0x2ce656[_0x50a7('0x11')](0x1f4)[_0x50a7('0x12')](_0x7f010b);}logger[_0x50a7('0x16')](_0x50a7('0x17'));return _0x2ce656['status'](0xc8)[_0x50a7('0x12')]({'output':_0x50a7('0x18')});});};exports[_0x50a7('0x19')]=function(_0x58303,_0x2ac3bf){return git['reset']([_0x50a7('0x1a'),_0x50a7('0x1b')],function(_0x5f0ea1){if(_0x5f0ea1){logger[_0x50a7('0x15')](_0x5f0ea1);return _0x2ac3bf[_0x50a7('0x11')](0x1f4)[_0x50a7('0x12')](_0x5f0ea1);}logger[_0x50a7('0x16')](_0x50a7('0x1c'));return _0x2ac3bf[_0x50a7('0x11')](0xc8)[_0x50a7('0x12')]({'output':_0x50a7('0x1d')});});};exports['pull']=function(_0x491877,_0x50221e){exec('npm\x20install\x20--production',function(_0x5d4c7a,_0x2089b1,_0x585850){logger[_0x50a7('0x16')](_0x2089b1);logger[_0x50a7('0x16')](_0x585850);if(_0x5d4c7a){logger['error'](_0x5d4c7a);return _0x50221e[_0x50a7('0x11')](0x1f4)[_0x50a7('0x12')](_0x5d4c7a);}return _0x50221e['status'](0xc8)[_0x50a7('0x12')]({'output':_0x2089b1});});};exports[_0x50a7('0x1e')]=function(_0x1d118c,_0x320d6b){return pm2[_0x50a7('0x1e')]('motion2')['then'](function(_0x1c3459){logger['info'](_0x50a7('0x1f'),_0x1c3459);return _0x320d6b['status'](0xc8)['json']({'output':_0x50a7('0x20')});})[_0x50a7('0x21')](function(_0x416968){logger[_0x50a7('0x15')](_0x416968);return _0x320d6b[_0x50a7('0x11')](0x1f4)[_0x50a7('0x12')](_0x416968);});};exports[_0x50a7('0x22')]=function(_0x39f7fd,_0x3263e9){var _0x2b0f41=fs['readdirSync'](path[_0x50a7('0x23')](config[_0x50a7('0xa')],_0x50a7('0x24'),_0x50a7('0x22')));var _0x41e0a7=[];for(var _0xda4edf=0x0;_0xda4edf<_0x2b0f41[_0x50a7('0x25')];_0xda4edf++){var _0x393427=_0x2b0f41[_0xda4edf][_0x50a7('0x26')](_0x50a7('0x27'),'');if(compareVersions(module[_0x50a7('0xc')][_0x50a7('0x2')],_0x393427)===-0x1){_0x41e0a7['push'](_0x393427);}}if(_0x41e0a7[_0x50a7('0x25')]){var _0x51f042=_0x41e0a7[_0x50a7('0x28')](compareVersions);var _0x26aa2a=new Umzug({'storage':_0x50a7('0x29'),'storageOptions':{'model':db[_0x50a7('0x2a')],'modelName':_0x50a7('0x2a'),'columnName':_0x50a7('0x2')},'migrations':{'params':[db['sequelize'][_0x50a7('0x2b')](),db[_0x50a7('0x29')]['constructor'],function(){throw new Error(_0x50a7('0x2c'));}],'path':path[_0x50a7('0x23')](config[_0x50a7('0xa')],_0x50a7('0x24'),'migrations'),'pattern':/\.js$/}});_0x26aa2a['up']({'migrations':_[_0x50a7('0x2d')](_0x51f042,function(_0x5ed2ab){return _0x5ed2ab+_0x50a7('0x27');})})[_0x50a7('0x2e')](function(){return _0x3263e9[_0x50a7('0x11')](0xc8)[_0x50a7('0x12')]({'output':_0x50a7('0x2f')+module['exports'][_0x50a7('0x2')]+_0x50a7('0x30')+_[_0x50a7('0x31')](_0x51f042),'migrations':_[_0x50a7('0x23')](_0x51f042)});})['catch'](function(_0x1e9b0d){if(_0x1e9b0d instanceof db[_0x50a7('0x29')][_0x50a7('0x32')]){return _0x3263e9['status'](0xc8)[_0x50a7('0x12')]({'output':_0x50a7('0x33')});}else{return _0x3263e9[_0x50a7('0x11')](0x1f4)['json'](_0x1e9b0d);}});}else{return _0x3263e9[_0x50a7('0x11')](0xc8)[_0x50a7('0x12')]({'output':_0x50a7('0x33')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index f19d8f0..ba4b68d 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 _0xc1e2=['describe','/:id','create','put','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','isAuthenticated','index','get'];(function(_0x30cf2d,_0x2943e0){var _0x5641d6=function(_0x59b413){while(--_0x59b413){_0x30cf2d['push'](_0x30cf2d['shift']());}};_0x5641d6(++_0x2943e0);}(_0xc1e2,0x18c));var _0x2c1e=function(_0x592af0,_0x6c7240){_0x592af0=_0x592af0-0x0;var _0x24ead5=_0xc1e2[_0x592af0];return _0x24ead5;};'use strict';var multer=require(_0x2c1e('0x0'));var util=require(_0x2c1e('0x1'));var path=require(_0x2c1e('0x2'));var timeout=require('connect-timeout');var express=require(_0x2c1e('0x3'));var router=express[_0x2c1e('0x4')]();var fs_extra=require(_0x2c1e('0x5'));var auth=require(_0x2c1e('0x6'));var interaction=require(_0x2c1e('0x7'));var config=require('../../config/environment');var controller=require(_0x2c1e('0x8'));router['get']('/',auth[_0x2c1e('0x9')](),controller[_0x2c1e('0xa')]);router[_0x2c1e('0xb')]('/describe',auth[_0x2c1e('0x9')](),controller[_0x2c1e('0xc')]);router[_0x2c1e('0xb')](_0x2c1e('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x2c1e('0xe')]);router[_0x2c1e('0xf')]('/:id',auth[_0x2c1e('0x9')](),controller['update']);router['delete']('/:id',auth[_0x2c1e('0x9')](),controller[_0x2c1e('0x10')]);module['exports']=router; \ No newline at end of file +var _0xd932=['/describe','get','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','isAuthenticated','index'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0xd932,0x1c2));var _0x2d93=function(_0x30eada,_0xdbc8b7){_0x30eada=_0x30eada-0x0;var _0x5b5967=_0xd932[_0x30eada];return _0x5b5967;};'use strict';var multer=require('multer');var util=require(_0x2d93('0x0'));var path=require(_0x2d93('0x1'));var timeout=require(_0x2d93('0x2'));var express=require(_0x2d93('0x3'));var router=express[_0x2d93('0x4')]();var fs_extra=require(_0x2d93('0x5'));var auth=require(_0x2d93('0x6'));var interaction=require(_0x2d93('0x7'));var config=require(_0x2d93('0x8'));var controller=require(_0x2d93('0x9'));router['get']('/',auth[_0x2d93('0xa')](),controller[_0x2d93('0xb')]);router['get'](_0x2d93('0xc'),auth[_0x2d93('0xa')](),controller['describe']);router[_0x2d93('0xd')](_0x2d93('0xe'),auth[_0x2d93('0xa')](),controller[_0x2d93('0xf')]);router[_0x2d93('0x10')]('/',auth[_0x2d93('0xa')](),controller[_0x2d93('0x11')]);router[_0x2d93('0x12')](_0x2d93('0xe'),auth['isAuthenticated'](),controller[_0x2d93('0x13')]);router[_0x2d93('0x14')](_0x2d93('0xe'),auth[_0x2d93('0xa')](),controller['destroy']);module[_0x2d93('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 7f342fd..aa7000a 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 _0x0570=['DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING'];(function(_0x38a202,_0x14056d){var _0x54503f=function(_0x75e0e9){while(--_0x75e0e9){_0x38a202['push'](_0x38a202['shift']());}};_0x54503f(++_0x14056d);}(_0x0570,0x172));var _0x0057=function(_0xda1402,_0x4c4f58){_0xda1402=_0xda1402-0x0;var _0x508436=_0x0570[_0xda1402];return _0x508436;};'use strict';var Sequelize=require('sequelize');module[_0x0057('0x0')]={'type':{'type':Sequelize[_0x0057('0x1')]},'uniqueid':{'type':Sequelize[_0x0057('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0057('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x0057('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x0057('0x2')]},'agentconnectAt':{'type':Sequelize[_0x0057('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x0057('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x0057('0x2')]},'agentdumpAt':{'type':Sequelize[_0x0057('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x0057('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x0057('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x0057('0x4')]},'agentacw':{'type':Sequelize[_0x0057('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x0057('0x4')]},'reason':{'type':Sequelize[_0x0057('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0057('0x1')]},'channelstate':{'type':Sequelize[_0x0057('0x4')]},'channelstatedesc':{'type':Sequelize[_0x0057('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x0057('0x1')]},'language':{'type':Sequelize[_0x0057('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x0057('0x1')]},'priority':{'type':Sequelize[_0x0057('0x1')]},'destchannel':{'type':Sequelize[_0x0057('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x0057('0x1')]},'destcalleridnum':{'type':Sequelize[_0x0057('0x1')]},'destcalleridname':{'type':Sequelize[_0x0057('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x0057('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x0057('0x1')]},'destaccountcode':{'type':Sequelize[_0x0057('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x0057('0x1')]},'destpriority':{'type':Sequelize[_0x0057('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x0057('0x1')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x0057('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x0057('0x5')},'transferexten':{'type':Sequelize[_0x0057('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x4024=['DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING'];(function(_0x263f9f,_0x148df7){var _0x3d1124=function(_0x3c322b){while(--_0x3c322b){_0x263f9f['push'](_0x263f9f['shift']());}};_0x3d1124(++_0x148df7);}(_0x4024,0x89));var _0x4402=function(_0x1e9c40,_0x4c051e){_0x1e9c40=_0x1e9c40-0x0;var _0x1c0d64=_0x4024[_0x1e9c40];return _0x1c0d64;};'use strict';var Sequelize=require(_0x4402('0x0'));module[_0x4402('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4402('0x2')]},'calleridnum':{'type':Sequelize[_0x4402('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x4402('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x4402('0x2')]},'agentcalledAt':{'type':Sequelize[_0x4402('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x4402('0x3')]},'agentdumpAt':{'type':Sequelize[_0x4402('0x3')]},'holdtime':{'type':Sequelize[_0x4402('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x4402('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x4402('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x4402('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x4402('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x4402('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x4402('0x2')]},'accountcode':{'type':Sequelize[_0x4402('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x4402('0x2')]},'priority':{'type':Sequelize[_0x4402('0x2')]},'destchannel':{'type':Sequelize[_0x4402('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x4402('0x2')]},'destcalleridnum':{'type':Sequelize[_0x4402('0x2')]},'destcalleridname':{'type':Sequelize[_0x4402('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x4402('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x4402('0x2')]},'destlanguage':{'type':Sequelize[_0x4402('0x2')]},'destaccountcode':{'type':Sequelize[_0x4402('0x2')]},'destcontext':{'type':Sequelize[_0x4402('0x2')]},'destexten':{'type':Sequelize[_0x4402('0x2')]},'destpriority':{'type':Sequelize[_0x4402('0x2')]},'destuniqueid':{'type':Sequelize[_0x4402('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x4402('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x4402('0x2')]},'transfer':{'type':Sequelize[_0x4402('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4402('0x2')],'comment':_0x4402('0x6')},'transferexten':{'type':Sequelize[_0x4402('0x2')]},'transferuniqueid':{'type':Sequelize[_0x4402('0x2')]},'agententerreason':{'type':Sequelize[_0x4402('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index fef64d2..0d96d0b 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(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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 8c98067..e1f16b2 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 _0x1a28=['api','moment','bluebird','rimraf','../../config/environment','./voiceAgentReport.attributes','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger'];(function(_0x4767fb,_0x3842f7){var _0x3f9248=function(_0xb57694){while(--_0xb57694){_0x4767fb['push'](_0x4767fb['shift']());}};_0x3f9248(++_0x3842f7);}(_0x1a28,0x10e));var _0x81a2=function(_0x2cfb48,_0x24b83b){_0x2cfb48=_0x2cfb48-0x0;var _0xc4594f=_0x1a28[_0x2cfb48];return _0xc4594f;};'use strict';var _=require(_0x81a2('0x0'));var util=require(_0x81a2('0x1'));var logger=require(_0x81a2('0x2'))(_0x81a2('0x3'));var moment=require(_0x81a2('0x4'));var BPromise=require(_0x81a2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x81a2('0x6'));var config=require(_0x81a2('0x7'));var attributes=require(_0x81a2('0x8'));module['exports']=function(_0x4188d7,_0x20dcd4){return _0x4188d7['define'](_0x81a2('0x9'),attributes,{'tableName':_0x81a2('0xa'),'paranoid':![],'indexes':[{'fields':[_0x81a2('0xb'),_0x81a2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9f5a=['../../config/environment','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x9a341c,_0x447be6){var _0x1b6717=function(_0x3c424c){while(--_0x3c424c){_0x9a341c['push'](_0x9a341c['shift']());}};_0x1b6717(++_0x447be6);}(_0x9f5a,0xbd));var _0xa9f5=function(_0x25217e,_0x40d3c9){_0x25217e=_0x25217e-0x0;var _0x3fc4a4=_0x9f5a[_0x25217e];return _0x3fc4a4;};'use strict';var _=require(_0xa9f5('0x0'));var util=require(_0xa9f5('0x1'));var logger=require(_0xa9f5('0x2'))(_0xa9f5('0x3'));var moment=require('moment');var BPromise=require(_0xa9f5('0x4'));var rp=require(_0xa9f5('0x5'));var fs=require('fs');var path=require(_0xa9f5('0x6'));var rimraf=require('rimraf');var config=require(_0xa9f5('0x7'));var attributes=require('./voiceAgentReport.attributes');module[_0xa9f5('0x8')]=function(_0x219e89,_0x49e337){return _0x219e89[_0xa9f5('0x9')](_0xa9f5('0xa'),attributes,{'tableName':_0xa9f5('0xb'),'paranoid':![],'indexes':[{'fields':[_0xa9f5('0xc'),_0xa9f5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index a4357c6..827915f 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 _0x57cc=['options','VoiceAgentReport','update','raw','attributes','limit','UpdateVoiceAgentReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateVoiceAgentReport','create','body'];(function(_0x436acb,_0x21422d){var _0x467185=function(_0x22d2ad){while(--_0x22d2ad){_0x436acb['push'](_0x436acb['shift']());}};_0x467185(++_0x21422d);}(_0x57cc,0x1b4));var _0xc57c=function(_0x489b87,_0xd51c93){_0x489b87=_0x489b87-0x0;var _0x1823b6=_0x57cc[_0x489b87];return _0x1823b6;};'use strict';var _=require(_0xc57c('0x0'));var util=require(_0xc57c('0x1'));var moment=require(_0xc57c('0x2'));var BPromise=require(_0xc57c('0x3'));var rs=require(_0xc57c('0x4'));var fs=require('fs');var Redis=require(_0xc57c('0x5'));var db=require(_0xc57c('0x6'))['db'];var utils=require(_0xc57c('0x7'));var logger=require(_0xc57c('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc57c('0x9'));var client=jayson['client'][_0xc57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c4442,_0xbd4f7e,_0x330b50){return new BPromise(function(_0x579975,_0x3d36e3){return client[_0xc57c('0xb')](_0x2c4442,_0x330b50)[_0xc57c('0xc')](function(_0x12467c){logger[_0xc57c('0xd')](_0xc57c('0xe'),_0xbd4f7e,_0xc57c('0xf'));logger[_0xc57c('0x10')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0xbd4f7e,_0xc57c('0xf'),JSON[_0xc57c('0x11')](_0x12467c));if(_0x12467c[_0xc57c('0x12')]){if(_0x12467c[_0xc57c('0x12')][_0xc57c('0x13')]===0x1f4){logger[_0xc57c('0x12')](_0xc57c('0xe'),_0xbd4f7e,_0x12467c[_0xc57c('0x12')][_0xc57c('0x14')]);return _0x3d36e3(_0x12467c['error'][_0xc57c('0x14')]);}logger[_0xc57c('0x12')](_0xc57c('0xe'),_0xbd4f7e,_0x12467c[_0xc57c('0x12')][_0xc57c('0x14')]);return _0x579975(_0x12467c[_0xc57c('0x12')][_0xc57c('0x14')]);}else{logger[_0xc57c('0xd')](_0xc57c('0xe'),_0xbd4f7e,_0xc57c('0xf'));_0x579975(_0x12467c[_0xc57c('0x15')][_0xc57c('0x14')]);}})[_0xc57c('0x16')](function(_0x450c76){logger[_0xc57c('0x12')](_0xc57c('0xe'),_0xbd4f7e,_0x450c76);_0x3d36e3(_0x450c76);});});}exports[_0xc57c('0x17')]=function(_0x3d4dac){var _0x3f12d4=this;return new Promise(function(_0x2475d8,_0x4b6bf4){return db['VoiceAgentReport'][_0xc57c('0x18')](_0x3d4dac[_0xc57c('0x19')],{'raw':_0x3d4dac['options']?_0x3d4dac[_0xc57c('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x55e1e2){logger[_0xc57c('0xd')](_0xc57c('0x17'),_0x3d4dac);logger[_0xc57c('0x10')](_0xc57c('0x17'),_0x3d4dac,JSON['stringify'](_0x55e1e2));_0x2475d8(_0x55e1e2);})[_0xc57c('0x16')](function(_0x24b236){logger[_0xc57c('0x12')](_0xc57c('0x17'),_0x24b236[_0xc57c('0x14')],_0x3d4dac);_0x4b6bf4(_0x3f12d4[_0xc57c('0x12')](0x1f4,_0x24b236[_0xc57c('0x14')]));});});};exports['UpdateVoiceAgentReport']=function(_0x5e72d5){var _0x439c8c=this;return new Promise(function(_0x137d18,_0x551832){return db[_0xc57c('0x1b')][_0xc57c('0x1c')](_0x5e72d5[_0xc57c('0x19')],{'raw':_0x5e72d5[_0xc57c('0x1a')]?_0x5e72d5[_0xc57c('0x1a')][_0xc57c('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e72d5['options']?_0x5e72d5[_0xc57c('0x1a')]['where']||null:null,'attributes':_0x5e72d5[_0xc57c('0x1a')]?_0x5e72d5[_0xc57c('0x1a')][_0xc57c('0x1e')]||null:null,'limit':_0x5e72d5[_0xc57c('0x1a')]?_0x5e72d5[_0xc57c('0x1a')][_0xc57c('0x1f')]||null:null})['then'](function(_0x3609df){logger[_0xc57c('0xd')](_0xc57c('0x20'),_0x5e72d5);logger['debug'](_0xc57c('0x20'),_0x5e72d5,JSON[_0xc57c('0x11')](_0x3609df));_0x137d18(_0x3609df);})['catch'](function(_0x34df87){logger[_0xc57c('0x12')](_0xc57c('0x20'),_0x34df87[_0xc57c('0x14')],_0x5e72d5);_0x551832(_0x439c8c[_0xc57c('0x12')](0x1f4,_0x34df87[_0xc57c('0x14')]));});});}; \ No newline at end of file +var _0x9d9d=['message','result','CreateVoiceAgentReport','create','catch','VoiceAgentReport','update','body','options','raw','where','attributes','limit','UpdateVoiceAgentReport','lodash','util','moment','randomstring','../../config/utils','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x22da61,_0x237ba9){var _0x40b728=function(_0x24db93){while(--_0x24db93){_0x22da61['push'](_0x22da61['shift']());}};_0x40b728(++_0x237ba9);}(_0x9d9d,0x1ee));var _0xd9d9=function(_0x42b71c,_0x43567d){_0x42b71c=_0x42b71c-0x0;var _0x4d7439=_0x9d9d[_0x42b71c];return _0x4d7439;};'use strict';var _=require(_0xd9d9('0x0'));var util=require(_0xd9d9('0x1'));var moment=require(_0xd9d9('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9d9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd9d9('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xd9d9('0x5'));var client=jayson[_0xd9d9('0x6')][_0xd9d9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xddd2b1,_0x5c2fd7,_0x24d794){return new BPromise(function(_0x2cb9a4,_0x51a4ce){return client[_0xd9d9('0x8')](_0xddd2b1,_0x24d794)[_0xd9d9('0x9')](function(_0x17d98d){logger[_0xd9d9('0xa')](_0xd9d9('0xb'),_0x5c2fd7,'request\x20sent');logger[_0xd9d9('0xc')](_0xd9d9('0xd'),_0x5c2fd7,'request\x20sent',JSON[_0xd9d9('0xe')](_0x17d98d));if(_0x17d98d[_0xd9d9('0xf')]){if(_0x17d98d[_0xd9d9('0xf')]['code']===0x1f4){logger[_0xd9d9('0xf')](_0xd9d9('0xb'),_0x5c2fd7,_0x17d98d[_0xd9d9('0xf')][_0xd9d9('0x10')]);return _0x51a4ce(_0x17d98d[_0xd9d9('0xf')]['message']);}logger[_0xd9d9('0xf')](_0xd9d9('0xb'),_0x5c2fd7,_0x17d98d[_0xd9d9('0xf')][_0xd9d9('0x10')]);return _0x2cb9a4(_0x17d98d[_0xd9d9('0xf')]['message']);}else{logger[_0xd9d9('0xa')](_0xd9d9('0xb'),_0x5c2fd7,'request\x20sent');_0x2cb9a4(_0x17d98d[_0xd9d9('0x11')]['message']);}})['catch'](function(_0xf3abb4){logger[_0xd9d9('0xf')](_0xd9d9('0xb'),_0x5c2fd7,_0xf3abb4);_0x51a4ce(_0xf3abb4);});});}exports[_0xd9d9('0x12')]=function(_0x40bc9e){var _0x2f5074=this;return new Promise(function(_0x5584a1,_0x1bd9b0){return db['VoiceAgentReport'][_0xd9d9('0x13')](_0x40bc9e['body'],{'raw':_0x40bc9e['options']?_0x40bc9e['options']['raw']===undefined?!![]:![]:!![]})[_0xd9d9('0x9')](function(_0x4b91d0){logger[_0xd9d9('0xa')](_0xd9d9('0x12'),_0x40bc9e);logger['debug'](_0xd9d9('0x12'),_0x40bc9e,JSON[_0xd9d9('0xe')](_0x4b91d0));_0x5584a1(_0x4b91d0);})[_0xd9d9('0x14')](function(_0x225ae0){logger['error']('CreateVoiceAgentReport',_0x225ae0['message'],_0x40bc9e);_0x1bd9b0(_0x2f5074[_0xd9d9('0xf')](0x1f4,_0x225ae0[_0xd9d9('0x10')]));});});};exports['UpdateVoiceAgentReport']=function(_0x5cdb5f){var _0x771905=this;return new Promise(function(_0x50377f,_0xf0507b){return db[_0xd9d9('0x15')][_0xd9d9('0x16')](_0x5cdb5f[_0xd9d9('0x17')],{'raw':_0x5cdb5f[_0xd9d9('0x18')]?_0x5cdb5f[_0xd9d9('0x18')][_0xd9d9('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5cdb5f[_0xd9d9('0x18')]?_0x5cdb5f[_0xd9d9('0x18')][_0xd9d9('0x1a')]||null:null,'attributes':_0x5cdb5f[_0xd9d9('0x18')]?_0x5cdb5f['options'][_0xd9d9('0x1b')]||null:null,'limit':_0x5cdb5f[_0xd9d9('0x18')]?_0x5cdb5f['options'][_0xd9d9('0x1c')]||null:null})[_0xd9d9('0x9')](function(_0x40285a){logger[_0xd9d9('0xa')](_0xd9d9('0x1d'),_0x5cdb5f);logger['debug'](_0xd9d9('0x1d'),_0x5cdb5f,JSON[_0xd9d9('0xe')](_0x40285a));_0x50377f(_0x40285a);})[_0xd9d9('0x14')](function(_0x3b0498){logger[_0xd9d9('0xf')]('UpdateVoiceAgentReport',_0x3b0498[_0xd9d9('0x10')],_0x5cdb5f);_0xf0507b(_0x771905[_0xd9d9('0xf')](0x1f4,_0x3b0498['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index ff487fd..59b71c5 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 _0x5075=['get','isAuthenticated','describe','show','post','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','index'];(function(_0x46e122,_0x2ce6d6){var _0x152639=function(_0x22068a){while(--_0x22068a){_0x46e122['push'](_0x46e122['shift']());}};_0x152639(++_0x2ce6d6);}(_0x5075,0x73));var _0x5507=function(_0x30631b,_0x50799b){_0x30631b=_0x30631b-0x0;var _0x3d57c6=_0x5075[_0x30631b];return _0x3d57c6;};'use strict';var multer=require(_0x5507('0x0'));var util=require(_0x5507('0x1'));var path=require(_0x5507('0x2'));var timeout=require(_0x5507('0x3'));var express=require(_0x5507('0x4'));var router=express[_0x5507('0x5')]();var fs_extra=require(_0x5507('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5507('0x7'));var config=require(_0x5507('0x8'));var controller=require(_0x5507('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x5507('0xa')]);router[_0x5507('0xb')]('/describe',auth[_0x5507('0xc')](),controller[_0x5507('0xd')]);router[_0x5507('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x5507('0xe')]);router[_0x5507('0xf')]('/',auth[_0x5507('0xc')](),controller[_0x5507('0x10')]);router['put'](_0x5507('0x11'),auth[_0x5507('0xc')](),controller['update']);router[_0x5507('0x12')](_0x5507('0x11'),auth['isAuthenticated'](),controller[_0x5507('0x13')]);module[_0x5507('0x14')]=router; \ No newline at end of file +var _0x950a=['/:id','isAuthenticated','show','post','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','index','describe'];(function(_0x2ab1e4,_0x4c28e4){var _0x53a600=function(_0x13b203){while(--_0x13b203){_0x2ab1e4['push'](_0x2ab1e4['shift']());}};_0x53a600(++_0x4c28e4);}(_0x950a,0x111));var _0xa950=function(_0x17de49,_0xfcc99){_0x17de49=_0x17de49-0x0;var _0x3e2bd6=_0x950a[_0x17de49];return _0x3e2bd6;};'use strict';var multer=require(_0xa950('0x0'));var util=require(_0xa950('0x1'));var path=require(_0xa950('0x2'));var timeout=require(_0xa950('0x3'));var express=require('express');var router=express[_0xa950('0x4')]();var fs_extra=require(_0xa950('0x5'));var auth=require(_0xa950('0x6'));var interaction=require(_0xa950('0x7'));var config=require('../../config/environment');var controller=require(_0xa950('0x8'));router[_0xa950('0x9')]('/',auth['isAuthenticated'](),controller[_0xa950('0xa')]);router[_0xa950('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xa950('0xb')]);router[_0xa950('0x9')](_0xa950('0xc'),auth[_0xa950('0xd')](),controller[_0xa950('0xe')]);router[_0xa950('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa950('0xc'),auth['isAuthenticated'](),controller[_0xa950('0x10')]);router[_0xa950('0x11')](_0xa950('0xc'),auth['isAuthenticated'](),controller[_0xa950('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 6002445..a80d40e 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 _0xaf33=['sequelize','exports','STRING','ENUM','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER'];(function(_0x303310,_0x3d6211){var _0x1e4370=function(_0x1d648){while(--_0x1d648){_0x303310['push'](_0x303310['shift']());}};_0x1e4370(++_0x3d6211);}(_0xaf33,0x12c));var _0x3af3=function(_0x16d08a,_0x111329){_0x16d08a=_0x16d08a-0x0;var _0x22c62e=_0xaf33[_0x16d08a];return _0x22c62e;};'use strict';var Sequelize=require(_0x3af3('0x0'));module[_0x3af3('0x1')]={'uniqueid':{'type':Sequelize[_0x3af3('0x2')]},'type':{'type':Sequelize[_0x3af3('0x3')]('inbound',_0x3af3('0x4'),_0x3af3('0x5'),_0x3af3('0x6'),_0x3af3('0x7'),_0x3af3('0x8'))},'tag':{'type':Sequelize[_0x3af3('0x2')]},'accountcode':{'type':Sequelize[_0x3af3('0x2')]},'source':{'type':Sequelize[_0x3af3('0x2')]},'destination':{'type':Sequelize[_0x3af3('0x2')]},'destinationcontext':{'type':Sequelize[_0x3af3('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x3af3('0x2')]},'destinationchannel':{'type':Sequelize[_0x3af3('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x3af3('0x9')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x3af3('0xa')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x3af3('0xa')]},'duration':{'type':Sequelize[_0x3af3('0xb')]},'billableseconds':{'type':Sequelize[_0x3af3('0xb')]},'mohtime':{'type':Sequelize[_0x3af3('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x3af3('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x3af3('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x3af3('0x2')]},'note':{'type':Sequelize[_0x3af3('0x2')]},'prefix':{'type':Sequelize[_0x3af3('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x3af3('0x2')]}}; \ No newline at end of file +var _0x2752=['DATE','INTEGER','sequelize','exports','STRING','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT'];(function(_0xdfd4ad,_0x5c80e8){var _0x302dfb=function(_0x7fddf2){while(--_0x7fddf2){_0xdfd4ad['push'](_0xdfd4ad['shift']());}};_0x302dfb(++_0x5c80e8);}(_0x2752,0x199));var _0x2275=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2752[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2275('0x0'));module[_0x2275('0x1')]={'uniqueid':{'type':Sequelize[_0x2275('0x2')]},'type':{'type':Sequelize['ENUM']('inbound',_0x2275('0x3'),_0x2275('0x4'),_0x2275('0x5'),_0x2275('0x6'),_0x2275('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x2275('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x2275('0x2')]},'callerid':{'type':Sequelize[_0x2275('0x2')]},'channel':{'type':Sequelize[_0x2275('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x2275('0x8')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x2275('0x9')]},'answertime':{'type':Sequelize[_0x2275('0x9')]},'endtime':{'type':Sequelize[_0x2275('0x9')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x2275('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x2275('0x2')]},'userfield':{'type':Sequelize[_0x2275('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x2275('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x2275('0x2')]},'note':{'type':Sequelize[_0x2275('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x2275('0xa')]},'sipcallid':{'type':Sequelize[_0x2275('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index c01b4fb..f95432b 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x360820,_0x44cf02){_0x360820=_0x360820-0x0;var _0x581c7f=_0x2032[_0x360820];return _0x581c7f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file +var _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x3bab09,_0x217c29){var _0x164376=function(_0x277730){while(--_0x277730){_0x3bab09['push'](_0x3bab09['shift']());}};_0x164376(++_0x217c29);}(_0x2ef3,0xba));var _0x32ef=function(_0x95c929,_0x5ad698){_0x95c929=_0x95c929-0x0;var _0x533435=_0x2ef3[_0x95c929];return _0x533435;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['VoiceCallReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 52da6a5..fc87129 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 _0x502a=['moment','bluebird','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api'];(function(_0x5d89df,_0x43711e){var _0x57d216=function(_0x582ba2){while(--_0x582ba2){_0x5d89df['push'](_0x5d89df['shift']());}};_0x57d216(++_0x43711e);}(_0x502a,0xbf));var _0xa502=function(_0x38500e,_0x569086){_0x38500e=_0x38500e-0x0;var _0x8a572f=_0x502a[_0x38500e];return _0x8a572f;};'use strict';var _=require(_0xa502('0x0'));var util=require(_0xa502('0x1'));var logger=require(_0xa502('0x2'))(_0xa502('0x3'));var moment=require(_0xa502('0x4'));var BPromise=require(_0xa502('0x5'));var rp=require(_0xa502('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa502('0x7'));var config=require(_0xa502('0x8'));var attributes=require(_0xa502('0x9'));module[_0xa502('0xa')]=function(_0x122e6d,_0x202234){return _0x122e6d[_0xa502('0xb')](_0xa502('0xc'),attributes,{'tableName':_0xa502('0xd'),'paranoid':![],'indexes':[{'fields':[_0xa502('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x90f7=['report_call','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceCallReport.attributes','exports','define','VoiceCallReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x90f7,0x187));var _0x790f=function(_0xd6ddab,_0x3f700e){_0xd6ddab=_0xd6ddab-0x0;var _0x81549e=_0x90f7[_0xd6ddab];return _0x81549e;};'use strict';var _=require('lodash');var util=require(_0x790f('0x0'));var logger=require(_0x790f('0x1'))(_0x790f('0x2'));var moment=require(_0x790f('0x3'));var BPromise=require(_0x790f('0x4'));var rp=require(_0x790f('0x5'));var fs=require('fs');var path=require(_0x790f('0x6'));var rimraf=require(_0x790f('0x7'));var config=require('../../config/environment');var attributes=require(_0x790f('0x8'));module[_0x790f('0x9')]=function(_0x35590a,_0x39b091){return _0x35590a[_0x790f('0xa')](_0x790f('0xb'),attributes,{'tableName':_0x790f('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index c28b9db..6544174 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 _0x0806=['catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','map','include','model','debug','CreateVoiceCallReport','create','body','update','UpdateVoiceCallReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceCallReport,\x20%s,\x20%s','result'];(function(_0x46b52b,_0x54b4da){var _0x5b0e6b=function(_0x49896d){while(--_0x49896d){_0x46b52b['push'](_0x46b52b['shift']());}};_0x5b0e6b(++_0x54b4da);}(_0x0806,0x86));var _0x6080=function(_0x3154c0,_0x4bc60){_0x3154c0=_0x3154c0-0x0;var _0x119c20=_0x0806[_0x3154c0];return _0x119c20;};'use strict';var _=require(_0x6080('0x0'));var util=require(_0x6080('0x1'));var moment=require(_0x6080('0x2'));var BPromise=require(_0x6080('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6080('0x4'));var db=require(_0x6080('0x5'))['db'];var utils=require(_0x6080('0x6'));var logger=require(_0x6080('0x7'))(_0x6080('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6080('0x9')][_0x6080('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3838dd,_0x47ed7b,_0x565712){return new BPromise(function(_0x431c4c,_0x1e6fc2){return client[_0x6080('0xb')](_0x3838dd,_0x565712)[_0x6080('0xc')](function(_0x257df7){logger[_0x6080('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x47ed7b,_0x6080('0xe'));logger['debug'](_0x6080('0xf'),_0x47ed7b,_0x6080('0xe'),JSON[_0x6080('0x10')](_0x257df7));if(_0x257df7[_0x6080('0x11')]){if(_0x257df7[_0x6080('0x11')][_0x6080('0x12')]===0x1f4){logger[_0x6080('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x47ed7b,_0x257df7[_0x6080('0x11')][_0x6080('0x13')]);return _0x1e6fc2(_0x257df7[_0x6080('0x11')]['message']);}logger['error'](_0x6080('0x14'),_0x47ed7b,_0x257df7[_0x6080('0x11')][_0x6080('0x13')]);return _0x431c4c(_0x257df7['error']['message']);}else{logger[_0x6080('0xd')](_0x6080('0x14'),_0x47ed7b,_0x6080('0xe'));_0x431c4c(_0x257df7[_0x6080('0x15')][_0x6080('0x13')]);}})[_0x6080('0x16')](function(_0x45b5ae){logger[_0x6080('0x11')](_0x6080('0x14'),_0x47ed7b,_0x45b5ae);_0x1e6fc2(_0x45b5ae);});});}exports[_0x6080('0x17')]=function(_0xdd3066){var _0x2598da=this;return new Promise(function(_0x4ba41a,_0x509610){return db[_0x6080('0x18')][_0x6080('0x19')]({'raw':_0xdd3066[_0x6080('0x1a')]?_0xdd3066[_0x6080('0x1a')][_0x6080('0x1b')]===undefined?!![]:![]:!![],'where':_0xdd3066[_0x6080('0x1a')]?_0xdd3066[_0x6080('0x1a')][_0x6080('0x1c')]||null:null,'attributes':_0xdd3066[_0x6080('0x1a')]?_0xdd3066[_0x6080('0x1a')][_0x6080('0x1d')]||null:null,'limit':_0xdd3066[_0x6080('0x1a')]?_0xdd3066[_0x6080('0x1a')]['limit']||null:null,'include':_0xdd3066[_0x6080('0x1a')]?_0xdd3066[_0x6080('0x1a')]['include']?_[_0x6080('0x1e')](_0xdd3066['options'][_0x6080('0x1f')],function(_0x535886){return{'model':db[_0x535886[_0x6080('0x20')]],'as':_0x535886['as'],'attributes':_0x535886[_0x6080('0x1d')],'include':_0x535886[_0x6080('0x1f')]?_['map'](_0x535886[_0x6080('0x1f')],function(_0x3af1c7){return{'model':db[_0x3af1c7[_0x6080('0x20')]],'as':_0x3af1c7['as'],'attributes':_0x3af1c7[_0x6080('0x1d')],'include':_0x3af1c7['include']?_[_0x6080('0x1e')](_0x3af1c7['include'],function(_0x458f55){return{'model':db[_0x458f55[_0x6080('0x20')]],'as':_0x458f55['as'],'attributes':_0x458f55[_0x6080('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x145578){logger['info'](_0x6080('0x17'),_0xdd3066);logger[_0x6080('0x21')](_0x6080('0x17'),_0xdd3066,JSON['stringify'](_0x145578));_0x4ba41a(_0x145578);})[_0x6080('0x16')](function(_0x1e306b){logger['error'](_0x6080('0x17'),_0x1e306b[_0x6080('0x13')],_0xdd3066);_0x509610(_0x2598da[_0x6080('0x11')](0x1f4,_0x1e306b[_0x6080('0x13')]));});});};exports[_0x6080('0x22')]=function(_0x310279){var _0x2b7539=this;return new Promise(function(_0x37b153,_0x3acfa5){return db[_0x6080('0x18')][_0x6080('0x23')](_0x310279[_0x6080('0x24')],{'raw':_0x310279[_0x6080('0x1a')]?_0x310279[_0x6080('0x1a')][_0x6080('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x25e563){logger[_0x6080('0xd')]('CreateVoiceCallReport',_0x310279);logger[_0x6080('0x21')](_0x6080('0x22'),_0x310279,JSON[_0x6080('0x10')](_0x25e563));_0x37b153(_0x25e563);})['catch'](function(_0x1aa30d){logger[_0x6080('0x11')](_0x6080('0x22'),_0x1aa30d[_0x6080('0x13')],_0x310279);_0x3acfa5(_0x2b7539[_0x6080('0x11')](0x1f4,_0x1aa30d['message']));});});};exports['UpdateVoiceCallReport']=function(_0x470f2e){var _0x5b79a9=this;return new Promise(function(_0x5afb91,_0x167099){return db['VoiceCallReport'][_0x6080('0x25')](_0x470f2e[_0x6080('0x24')],{'raw':_0x470f2e['options']?_0x470f2e[_0x6080('0x1a')][_0x6080('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x470f2e['options']?_0x470f2e['options']['where']||null:null,'attributes':_0x470f2e[_0x6080('0x1a')]?_0x470f2e['options'][_0x6080('0x1d')]||null:null,'limit':_0x470f2e[_0x6080('0x1a')]?_0x470f2e[_0x6080('0x1a')]['limit']||null:null})['then'](function(_0x3e6d92){logger[_0x6080('0xd')](_0x6080('0x26'),_0x470f2e);logger[_0x6080('0x21')](_0x6080('0x26'),_0x470f2e,JSON[_0x6080('0x10')](_0x3e6d92));_0x5afb91(_0x3e6d92);})[_0x6080('0x16')](function(_0x20356c){logger[_0x6080('0x11')]('UpdateVoiceCallReport',_0x20356c[_0x6080('0x13')],_0x470f2e);_0x167099(_0x5b79a9[_0x6080('0x11')](0x1f4,_0x20356c[_0x6080('0x13')]));});});}; \ No newline at end of file +var _0xf616=['../../config/environment','client','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','include','map','model','catch','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xd16c5d,_0xe46d01){var _0x510593=function(_0x4ef145){while(--_0x4ef145){_0xd16c5d['push'](_0xd16c5d['shift']());}};_0x510593(++_0xe46d01);}(_0xf616,0x174));var _0x6f61=function(_0x462ce0,_0x46988d){_0x462ce0=_0x462ce0-0x0;var _0x1d5089=_0xf616[_0x462ce0];return _0x1d5089;};'use strict';var _=require(_0x6f61('0x0'));var util=require(_0x6f61('0x1'));var moment=require('moment');var BPromise=require(_0x6f61('0x2'));var rs=require(_0x6f61('0x3'));var fs=require('fs');var Redis=require(_0x6f61('0x4'));var db=require(_0x6f61('0x5'))['db'];var utils=require(_0x6f61('0x6'));var logger=require(_0x6f61('0x7'))('rpc');var config=require(_0x6f61('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6f61('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37edf7,_0x253732,_0x25810b){return new BPromise(function(_0x1965d6,_0x43dbd1){return client[_0x6f61('0xa')](_0x37edf7,_0x25810b)[_0x6f61('0xb')](function(_0x3bb4fb){logger[_0x6f61('0xc')](_0x6f61('0xd'),_0x253732,_0x6f61('0xe'));logger[_0x6f61('0xf')](_0x6f61('0x10'),_0x253732,_0x6f61('0xe'),JSON[_0x6f61('0x11')](_0x3bb4fb));if(_0x3bb4fb[_0x6f61('0x12')]){if(_0x3bb4fb[_0x6f61('0x12')][_0x6f61('0x13')]===0x1f4){logger['error'](_0x6f61('0xd'),_0x253732,_0x3bb4fb['error']['message']);return _0x43dbd1(_0x3bb4fb[_0x6f61('0x12')]['message']);}logger[_0x6f61('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x253732,_0x3bb4fb[_0x6f61('0x12')][_0x6f61('0x14')]);return _0x1965d6(_0x3bb4fb['error']['message']);}else{logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x253732,_0x6f61('0xe'));_0x1965d6(_0x3bb4fb[_0x6f61('0x15')]['message']);}})['catch'](function(_0x1dd530){logger[_0x6f61('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x253732,_0x1dd530);_0x43dbd1(_0x1dd530);});});}exports[_0x6f61('0x16')]=function(_0x5119f0){var _0x1c8d1a=this;return new Promise(function(_0x14c032,_0x2a6ab5){return db[_0x6f61('0x17')][_0x6f61('0x18')]({'raw':_0x5119f0[_0x6f61('0x19')]?_0x5119f0[_0x6f61('0x19')][_0x6f61('0x1a')]===undefined?!![]:![]:!![],'where':_0x5119f0[_0x6f61('0x19')]?_0x5119f0[_0x6f61('0x19')][_0x6f61('0x1b')]||null:null,'attributes':_0x5119f0['options']?_0x5119f0[_0x6f61('0x19')][_0x6f61('0x1c')]||null:null,'limit':_0x5119f0[_0x6f61('0x19')]?_0x5119f0[_0x6f61('0x19')]['limit']||null:null,'include':_0x5119f0['options']?_0x5119f0['options'][_0x6f61('0x1d')]?_[_0x6f61('0x1e')](_0x5119f0[_0x6f61('0x19')][_0x6f61('0x1d')],function(_0x53f814){return{'model':db[_0x53f814['model']],'as':_0x53f814['as'],'attributes':_0x53f814[_0x6f61('0x1c')],'include':_0x53f814[_0x6f61('0x1d')]?_[_0x6f61('0x1e')](_0x53f814[_0x6f61('0x1d')],function(_0x29d01d){return{'model':db[_0x29d01d['model']],'as':_0x29d01d['as'],'attributes':_0x29d01d[_0x6f61('0x1c')],'include':_0x29d01d[_0x6f61('0x1d')]?_['map'](_0x29d01d[_0x6f61('0x1d')],function(_0x280d05){return{'model':db[_0x280d05[_0x6f61('0x1f')]],'as':_0x280d05['as'],'attributes':_0x280d05['attributes']};}):[]};}):[]};}):[]:[]})[_0x6f61('0xb')](function(_0x4709e4){logger[_0x6f61('0xc')](_0x6f61('0x16'),_0x5119f0);logger[_0x6f61('0xf')](_0x6f61('0x16'),_0x5119f0,JSON[_0x6f61('0x11')](_0x4709e4));_0x14c032(_0x4709e4);})[_0x6f61('0x20')](function(_0xd6cbbb){logger[_0x6f61('0x12')](_0x6f61('0x16'),_0xd6cbbb[_0x6f61('0x14')],_0x5119f0);_0x2a6ab5(_0x1c8d1a['error'](0x1f4,_0xd6cbbb[_0x6f61('0x14')]));});});};exports[_0x6f61('0x21')]=function(_0x296a6b){var _0x177ae4=this;return new Promise(function(_0x50fe02,_0x11a093){return db[_0x6f61('0x17')][_0x6f61('0x22')](_0x296a6b[_0x6f61('0x23')],{'raw':_0x296a6b[_0x6f61('0x19')]?_0x296a6b['options'][_0x6f61('0x1a')]===undefined?!![]:![]:!![]})[_0x6f61('0xb')](function(_0x454050){logger['info'](_0x6f61('0x21'),_0x296a6b);logger['debug'](_0x6f61('0x21'),_0x296a6b,JSON[_0x6f61('0x11')](_0x454050));_0x50fe02(_0x454050);})['catch'](function(_0x4704f1){logger[_0x6f61('0x12')](_0x6f61('0x21'),_0x4704f1['message'],_0x296a6b);_0x11a093(_0x177ae4[_0x6f61('0x12')](0x1f4,_0x4704f1[_0x6f61('0x14')]));});});};exports[_0x6f61('0x24')]=function(_0x1361b8){var _0xab19f6=this;return new Promise(function(_0x155975,_0xac3a4c){return db[_0x6f61('0x17')][_0x6f61('0x25')](_0x1361b8[_0x6f61('0x23')],{'raw':_0x1361b8['options']?_0x1361b8['options'][_0x6f61('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1361b8['options']?_0x1361b8[_0x6f61('0x19')][_0x6f61('0x1b')]||null:null,'attributes':_0x1361b8[_0x6f61('0x19')]?_0x1361b8['options'][_0x6f61('0x1c')]||null:null,'limit':_0x1361b8['options']?_0x1361b8[_0x6f61('0x19')]['limit']||null:null})[_0x6f61('0xb')](function(_0x5b6dab){logger['info'](_0x6f61('0x24'),_0x1361b8);logger[_0x6f61('0xf')](_0x6f61('0x24'),_0x1361b8,JSON['stringify'](_0x5b6dab));_0x155975(_0x5b6dab);})[_0x6f61('0x20')](function(_0x22d162){logger[_0x6f61('0x12')](_0x6f61('0x24'),_0x22d162[_0x6f61('0x14')],_0x1361b8);_0xac3a4c(_0xab19f6['error'](0x1f4,_0x22d162[_0x6f61('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index d239a3f..bd61088 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 _0xe5ff=['show','post','create','update','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe5ff,0x1a4));var _0xfe5f=function(_0x1b880d,_0x271eff){_0x1b880d=_0x1b880d-0x0;var _0x4d85d1=_0xe5ff[_0x1b880d];return _0x4d85d1;};'use strict';var multer=require(_0xfe5f('0x0'));var util=require(_0xfe5f('0x1'));var path=require(_0xfe5f('0x2'));var timeout=require(_0xfe5f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xfe5f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfe5f('0x5'));var config=require(_0xfe5f('0x6'));var controller=require(_0xfe5f('0x7'));router[_0xfe5f('0x8')]('/',auth[_0xfe5f('0x9')](),controller[_0xfe5f('0xa')]);router[_0xfe5f('0x8')](_0xfe5f('0xb'),auth['isAuthenticated'](),controller[_0xfe5f('0xc')]);router[_0xfe5f('0xd')]('/',auth[_0xfe5f('0x9')](),controller[_0xfe5f('0xe')]);router['put'](_0xfe5f('0xb'),auth['isAuthenticated'](),controller[_0xfe5f('0xf')]);router['delete']('/:id',auth[_0xfe5f('0x9')](),controller[_0xfe5f('0x10')]);module[_0xfe5f('0x11')]=router; \ No newline at end of file +var _0x9af2=['Router','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','/:id','show','post','create','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x50c96f,_0x2ee009){var _0x38fcf2=function(_0x299a4d){while(--_0x299a4d){_0x50c96f['push'](_0x50c96f['shift']());}};_0x38fcf2(++_0x2ee009);}(_0x9af2,0x1e1));var _0x29af=function(_0x53c075,_0x46935a){_0x53c075=_0x53c075-0x0;var _0x5ba685=_0x9af2[_0x53c075];return _0x5ba685;};'use strict';var multer=require(_0x29af('0x0'));var util=require(_0x29af('0x1'));var path=require(_0x29af('0x2'));var timeout=require(_0x29af('0x3'));var express=require(_0x29af('0x4'));var router=express[_0x29af('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x29af('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x29af('0x7'));var controller=require(_0x29af('0x8'));router[_0x29af('0x9')]('/',auth[_0x29af('0xa')](),controller['index']);router['get'](_0x29af('0xb'),auth['isAuthenticated'](),controller[_0x29af('0xc')]);router[_0x29af('0xd')]('/',auth[_0x29af('0xa')](),controller[_0x29af('0xe')]);router['put'](_0x29af('0xb'),auth[_0x29af('0xa')](),controller[_0x29af('0xf')]);router['delete'](_0x29af('0xb'),auth[_0x29af('0xa')](),controller[_0x29af('0x10')]);module[_0x29af('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index e268d52..bad51bb 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 _0xb293=['split','BOOLEAN','exports','STRING','name','setDataValue','options','getDataValue'];(function(_0x10a951,_0x5da875){var _0x6da0d=function(_0x249416){while(--_0x249416){_0x10a951['push'](_0x10a951['shift']());}};_0x6da0d(++_0x5da875);}(_0xb293,0x1a2));var _0x3b29=function(_0x36c230,_0x1c7cfd){_0x36c230=_0x36c230-0x0;var _0x321e0e=_0xb293[_0x36c230];return _0x321e0e;};'use strict';var Sequelize=require('sequelize');module[_0x3b29('0x0')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x3b29('0x1')],'unique':_0x3b29('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x3b29('0x1')],'set':function(_0x404c75){this[_0x3b29('0x3')](_0x3b29('0x4'),_0x404c75?_0x404c75['join'](''):[]);},'get':function(){return this[_0x3b29('0x5')]('options')?this['getDataValue'](_0x3b29('0x4'))[_0x3b29('0x6')](''):[];}},'auth':{'type':Sequelize[_0x3b29('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x3b29('0x1')]},'record':{'type':Sequelize[_0x3b29('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x3b29('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa8d2=['name','STRING','setDataValue','join','getDataValue','options','BOOLEAN','sequelize','exports'];(function(_0x1c9ffe,_0x3330ac){var _0x3a44d8=function(_0x3d3daa){while(--_0x3d3daa){_0x1c9ffe['push'](_0x1c9ffe['shift']());}};_0x3a44d8(++_0x3330ac);}(_0xa8d2,0x127));var _0x2a8d=function(_0x295de7,_0x170cb2){_0x295de7=_0x295de7-0x0;var _0x1f7afa=_0xa8d2[_0x295de7];return _0x1f7afa;};'use strict';var Sequelize=require(_0x2a8d('0x0'));module[_0x2a8d('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0x2a8d('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x2a8d('0x3')],'set':function(_0x152d85){this[_0x2a8d('0x4')]('options',_0x152d85?_0x152d85[_0x2a8d('0x5')](''):[]);},'get':function(){return this[_0x2a8d('0x6')](_0x2a8d('0x7'))?this[_0x2a8d('0x6')](_0x2a8d('0x7'))['split'](''):[];}},'auth':{'type':Sequelize[_0x2a8d('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x2a8d('0x3')]},'record':{'type':Sequelize[_0x2a8d('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x2a8d('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index d4877db..bf4cc64 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 _0xcab6=['json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','sendStatus','stack','name','index','map','VoiceChanSpy','fieldName','type','key','model','query','keys','attributes','fields','length','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','intersection','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','end','status'];(function(_0x3d9368,_0x1cf078){var _0x1e9c4b=function(_0xe59cb2){while(--_0xe59cb2){_0x3d9368['push'](_0x3d9368['shift']());}};_0x1e9c4b(++_0x1cf078);}(_0xcab6,0xd4));var _0x6cab=function(_0x468425,_0x4247fd){_0x468425=_0x468425-0x0;var _0x4c2122=_0xcab6[_0x468425];return _0x4c2122;};'use strict';var emlformat=require(_0x6cab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6cab('0x1'));var jsonpatch=require(_0x6cab('0x2'));var rp=require(_0x6cab('0x3'));var moment=require(_0x6cab('0x4'));var BPromise=require(_0x6cab('0x5'));var Mustache=require(_0x6cab('0x6'));var util=require('util');var path=require(_0x6cab('0x7'));var sox=require('sox');var csv=require(_0x6cab('0x8'));var ejs=require(_0x6cab('0x9'));var fs=require('fs');var fs_extra=require(_0x6cab('0xa'));var _=require('lodash');var squel=require(_0x6cab('0xb'));var crypto=require(_0x6cab('0xc'));var jsforce=require(_0x6cab('0xd'));var deskjs=require(_0x6cab('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6cab('0xf'));var Redis=require(_0x6cab('0x10'));var authService=require(_0x6cab('0x11'));var qs=require(_0x6cab('0x12'));var as=require(_0x6cab('0x13'));var hardwareService=require(_0x6cab('0x14'));var logger=require('../../config/logger')(_0x6cab('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6cab('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b8609,_0x5a4033){_0x5a4033=_0x5a4033||0xcc;return function(_0x4f5067){if(_0x4f5067){return _0x3b8609['sendStatus'](_0x5a4033);}return _0x3b8609['status'](_0x5a4033)[_0x6cab('0x17')]();};}function respondWithResult(_0x971a60,_0x278be9){_0x278be9=_0x278be9||0xc8;return function(_0x30474f){if(_0x30474f){return _0x971a60[_0x6cab('0x18')](_0x278be9)[_0x6cab('0x19')](_0x30474f);}};}function respondWithFilteredResult(_0x256dbc,_0x22ea54){return function(_0x36f5e9){if(_0x36f5e9){var _0x1fc3e8=typeof _0x22ea54[_0x6cab('0x1a')]===_0x6cab('0x1b')&&typeof _0x22ea54[_0x6cab('0x1c')]==='undefined';var _0x1ff3c6=_0x36f5e9[_0x6cab('0x1d')];var _0x4e9bcb=_0x1fc3e8?0x0:_0x22ea54[_0x6cab('0x1a')];var _0x5240c1=_0x1fc3e8?_0x36f5e9[_0x6cab('0x1d')]:_0x22ea54[_0x6cab('0x1a')]+_0x22ea54['limit'];var _0x4b009c;if(_0x5240c1>=_0x1ff3c6){_0x5240c1=_0x1ff3c6;_0x4b009c=0xc8;}else{_0x4b009c=0xce;}_0x256dbc[_0x6cab('0x18')](_0x4b009c);return _0x256dbc[_0x6cab('0x1e')](_0x6cab('0x1f'),_0x4e9bcb+'-'+_0x5240c1+'/'+_0x1ff3c6)[_0x6cab('0x19')](_0x36f5e9);}return null;};}function patchUpdates(_0xa36dad){return function(_0x565a51){try{jsonpatch['apply'](_0x565a51,_0xa36dad,!![]);}catch(_0x3bbf68){return BPromise['reject'](_0x3bbf68);}return _0x565a51[_0x6cab('0x20')]();};}function saveUpdates(_0x3f8516,_0x4784a0){return function(_0x22c401){if(_0x22c401){return _0x22c401[_0x6cab('0x21')](_0x3f8516)[_0x6cab('0x22')](function(_0x163680){return _0x163680;});}return null;};}function removeEntity(_0x6efcb8,_0xd1698a){return function(_0xe6a99e){if(_0xe6a99e){return _0xe6a99e[_0x6cab('0x23')]()[_0x6cab('0x22')](function(){var _0xbfbeca=_0xe6a99e['get']({'plain':!![]});var _0x59acf4='ChanSpies';return db['UserProfileResource']['destroy']({'where':{'type':_0x59acf4,'resourceId':_0xbfbeca['id']}})[_0x6cab('0x22')](function(){return _0xe6a99e;});})[_0x6cab('0x22')](function(){_0x6efcb8[_0x6cab('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ae4e7,_0x3e7041){return function(_0x1f1729){if(!_0x1f1729){_0x2ae4e7[_0x6cab('0x24')](0x194);}return _0x1f1729;};}function handleError(_0x5ed564,_0x3b2690){_0x3b2690=_0x3b2690||0x1f4;return function(_0x3c5de1){logger['error'](_0x3c5de1[_0x6cab('0x25')]);if(_0x3c5de1['name']){delete _0x3c5de1[_0x6cab('0x26')];}_0x5ed564['status'](_0x3b2690)['send'](_0x3c5de1);};}exports[_0x6cab('0x27')]=function(_0x586dac,_0x1c3319){var _0xd983ea={},_0x5c48cd={},_0x5af167={'count':0x0,'rows':[]};var _0x70a8ef=_[_0x6cab('0x28')](db[_0x6cab('0x29')]['rawAttributes'],function(_0x52ed72){return{'name':_0x52ed72[_0x6cab('0x2a')],'type':_0x52ed72[_0x6cab('0x2b')][_0x6cab('0x2c')]};});_0x5c48cd[_0x6cab('0x2d')]=_[_0x6cab('0x28')](_0x70a8ef,_0x6cab('0x26'));_0x5c48cd[_0x6cab('0x2e')]=_[_0x6cab('0x2f')](_0x586dac['query']);_0x5c48cd['filters']=_['intersection'](_0x5c48cd[_0x6cab('0x2d')],_0x5c48cd[_0x6cab('0x2e')]);_0xd983ea[_0x6cab('0x30')]=_['intersection'](_0x5c48cd[_0x6cab('0x2d')],qs[_0x6cab('0x31')](_0x586dac[_0x6cab('0x2e')]['fields']));_0xd983ea[_0x6cab('0x30')]=_0xd983ea[_0x6cab('0x30')][_0x6cab('0x32')]?_0xd983ea['attributes']:_0x5c48cd[_0x6cab('0x2d')];if(!_0x586dac['query']['hasOwnProperty']('nolimit')){_0xd983ea[_0x6cab('0x1c')]=qs[_0x6cab('0x1c')](_0x586dac['query'][_0x6cab('0x1c')]);_0xd983ea[_0x6cab('0x1a')]=qs[_0x6cab('0x1a')](_0x586dac[_0x6cab('0x2e')][_0x6cab('0x1a')]);}_0xd983ea[_0x6cab('0x33')]=qs[_0x6cab('0x34')](_0x586dac[_0x6cab('0x2e')][_0x6cab('0x34')]);_0xd983ea[_0x6cab('0x35')]=qs['filters'](_[_0x6cab('0x36')](_0x586dac['query'],_0x5c48cd[_0x6cab('0x37')]),_0x70a8ef);if(_0x586dac['query'][_0x6cab('0x38')]){_0xd983ea[_0x6cab('0x35')]=_[_0x6cab('0x39')](_0xd983ea['where'],{'$or':_[_0x6cab('0x28')](_0x70a8ef,function(_0x452f19){if(_0x452f19[_0x6cab('0x2b')]!==_0x6cab('0x3a')){var _0xe3ca3b={};_0xe3ca3b[_0x452f19['name']]={'$like':'%'+_0x586dac[_0x6cab('0x2e')][_0x6cab('0x38')]+'%'};return _0xe3ca3b;}})});}_0xd983ea=_[_0x6cab('0x39')]({},_0xd983ea,_0x586dac[_0x6cab('0x3b')]);var _0x1e210a={'where':_0xd983ea[_0x6cab('0x35')]};return db[_0x6cab('0x29')][_0x6cab('0x1d')](_0x1e210a)[_0x6cab('0x22')](function(_0x4c33c8){_0x5af167['count']=_0x4c33c8;if(_0x586dac[_0x6cab('0x2e')][_0x6cab('0x3c')]){_0xd983ea[_0x6cab('0x3d')]=[{'all':!![]}];}return db[_0x6cab('0x29')][_0x6cab('0x3e')](_0xd983ea);})[_0x6cab('0x22')](function(_0x35ccd1){_0x5af167[_0x6cab('0x3f')]=_0x35ccd1;return _0x5af167;})[_0x6cab('0x22')](respondWithFilteredResult(_0x1c3319,_0xd983ea))['catch'](handleError(_0x1c3319,null));};exports[_0x6cab('0x40')]=function(_0x26ce12,_0x55aa26){var _0x33a4dc={'raw':![],'where':{'id':_0x26ce12[_0x6cab('0x41')]['id']}},_0x27dc1c={};_0x27dc1c['model']=_[_0x6cab('0x2f')](db['VoiceChanSpy']['rawAttributes']);_0x27dc1c['query']=_[_0x6cab('0x2f')](_0x26ce12['query']);_0x27dc1c[_0x6cab('0x37')]=_[_0x6cab('0x42')](_0x27dc1c['model'],_0x27dc1c[_0x6cab('0x2e')]);_0x33a4dc[_0x6cab('0x30')]=_['intersection'](_0x27dc1c[_0x6cab('0x2d')],qs[_0x6cab('0x31')](_0x26ce12[_0x6cab('0x2e')]['fields']));_0x33a4dc[_0x6cab('0x30')]=_0x33a4dc[_0x6cab('0x30')][_0x6cab('0x32')]?_0x33a4dc[_0x6cab('0x30')]:_0x27dc1c[_0x6cab('0x2d')];if(_0x26ce12[_0x6cab('0x2e')][_0x6cab('0x3c')]){_0x33a4dc[_0x6cab('0x3d')]=[{'all':!![]}];}_0x33a4dc=_[_0x6cab('0x39')]({},_0x33a4dc,_0x26ce12[_0x6cab('0x3b')]);return db[_0x6cab('0x29')][_0x6cab('0x43')](_0x33a4dc)[_0x6cab('0x22')](handleEntityNotFound(_0x55aa26,null))['then'](respondWithResult(_0x55aa26,null))[_0x6cab('0x44')](handleError(_0x55aa26,null));};exports['create']=function(_0x41a889,_0x110985){return db['VoiceChanSpy'][_0x6cab('0x45')](_0x41a889[_0x6cab('0x46')],{})[_0x6cab('0x22')](function(_0x1ccd7d){var _0x32a906=_0x41a889[_0x6cab('0x47')][_0x6cab('0x48')]({'plain':!![]});if(!_0x32a906)throw new Error(_0x6cab('0x49'));if(_0x32a906['role']===_0x6cab('0x47')){var _0x4fbd61=_0x1ccd7d[_0x6cab('0x48')]({'plain':!![]});var _0x1d58d9='ChanSpies';return db[_0x6cab('0x4a')]['find']({'where':{'name':_0x1d58d9,'userProfileId':_0x32a906[_0x6cab('0x4b')]},'raw':!![]})[_0x6cab('0x22')](function(_0xd36abd){if(_0xd36abd&&_0xd36abd[_0x6cab('0x4c')]===0x0){return db['UserProfileResource'][_0x6cab('0x45')]({'name':_0x4fbd61[_0x6cab('0x26')],'resourceId':_0x4fbd61['id'],'type':_0xd36abd[_0x6cab('0x26')],'sectionId':_0xd36abd['id']},{})[_0x6cab('0x22')](function(){return _0x1ccd7d;});}else{return _0x1ccd7d;}})['catch'](function(_0x2ce26c){logger[_0x6cab('0x4d')](_0x6cab('0x4e'),_0x2ce26c);throw _0x2ce26c;});}return _0x1ccd7d;})[_0x6cab('0x22')](respondWithResult(_0x110985,0xc9))[_0x6cab('0x44')](handleError(_0x110985,null));};exports['update']=function(_0x4acda7,_0x4aceed){if(_0x4acda7[_0x6cab('0x46')]['id']){delete _0x4acda7['body']['id'];}return db[_0x6cab('0x29')][_0x6cab('0x43')]({'where':{'id':_0x4acda7[_0x6cab('0x41')]['id']}})[_0x6cab('0x22')](handleEntityNotFound(_0x4aceed,null))[_0x6cab('0x22')](saveUpdates(_0x4acda7[_0x6cab('0x46')],null))[_0x6cab('0x22')](respondWithResult(_0x4aceed,null))[_0x6cab('0x44')](handleError(_0x4aceed,null));};exports[_0x6cab('0x23')]=function(_0x22dda1,_0xe2a5bf){return db[_0x6cab('0x29')][_0x6cab('0x43')]({'where':{'id':_0x22dda1[_0x6cab('0x41')]['id']}})[_0x6cab('0x22')](handleEntityNotFound(_0xe2a5bf,null))['then'](removeEntity(_0xe2a5bf,null))[_0x6cab('0x44')](handleError(_0xe2a5bf,null));}; \ No newline at end of file +var _0xda55=['filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','role','user','ChanSpies','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','destroy','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','then','get','error','stack','name','send','index','map','VoiceChanSpy','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x217c2e,_0x358f06){var _0x22b7d8=function(_0x111c48){while(--_0x111c48){_0x217c2e['push'](_0x217c2e['shift']());}};_0x22b7d8(++_0x358f06);}(_0xda55,0x6d));var _0x5da5=function(_0x586e64,_0x4e6f01){_0x586e64=_0x586e64-0x0;var _0x3e237c=_0xda55[_0x586e64];return _0x3e237c;};'use strict';var emlformat=require(_0x5da5('0x0'));var rimraf=require(_0x5da5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5da5('0x2'));var moment=require(_0x5da5('0x3'));var BPromise=require(_0x5da5('0x4'));var Mustache=require(_0x5da5('0x5'));var util=require(_0x5da5('0x6'));var path=require('path');var sox=require(_0x5da5('0x7'));var csv=require('to-csv');var ejs=require(_0x5da5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5da5('0x9'));var squel=require(_0x5da5('0xa'));var crypto=require(_0x5da5('0xb'));var jsforce=require(_0x5da5('0xc'));var deskjs=require(_0x5da5('0xd'));var toCsv=require(_0x5da5('0xe'));var querystring=require(_0x5da5('0xf'));var Papa=require(_0x5da5('0x10'));var Redis=require('ioredis');var authService=require(_0x5da5('0x11'));var qs=require(_0x5da5('0x12'));var as=require(_0x5da5('0x13'));var hardwareService=require(_0x5da5('0x14'));var logger=require(_0x5da5('0x15'))(_0x5da5('0x16'));var utils=require(_0x5da5('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x5da5('0x18'));var db=require(_0x5da5('0x19'))['db'];function respondWithStatusCode(_0x4f813b,_0x37aeb0){_0x37aeb0=_0x37aeb0||0xcc;return function(_0x31366e){if(_0x31366e){return _0x4f813b[_0x5da5('0x1a')](_0x37aeb0);}return _0x4f813b[_0x5da5('0x1b')](_0x37aeb0)[_0x5da5('0x1c')]();};}function respondWithResult(_0x440b8f,_0x481562){_0x481562=_0x481562||0xc8;return function(_0x489b60){if(_0x489b60){return _0x440b8f['status'](_0x481562)[_0x5da5('0x1d')](_0x489b60);}};}function respondWithFilteredResult(_0x126fc8,_0x13c701){return function(_0x665ce8){if(_0x665ce8){var _0x11bd3=typeof _0x13c701[_0x5da5('0x1e')]===_0x5da5('0x1f')&&typeof _0x13c701['limit']===_0x5da5('0x1f');var _0x290136=_0x665ce8[_0x5da5('0x20')];var _0x16b11f=_0x11bd3?0x0:_0x13c701[_0x5da5('0x1e')];var _0x428b07=_0x11bd3?_0x665ce8['count']:_0x13c701[_0x5da5('0x1e')]+_0x13c701[_0x5da5('0x21')];var _0x3d3d26;if(_0x428b07>=_0x290136){_0x428b07=_0x290136;_0x3d3d26=0xc8;}else{_0x3d3d26=0xce;}_0x126fc8[_0x5da5('0x1b')](_0x3d3d26);return _0x126fc8[_0x5da5('0x22')]('Content-Range',_0x16b11f+'-'+_0x428b07+'/'+_0x290136)[_0x5da5('0x1d')](_0x665ce8);}return null;};}function patchUpdates(_0x3372fc){return function(_0x42a3cb){try{jsonpatch['apply'](_0x42a3cb,_0x3372fc,!![]);}catch(_0x3e0b28){return BPromise[_0x5da5('0x23')](_0x3e0b28);}return _0x42a3cb[_0x5da5('0x24')]();};}function saveUpdates(_0x2e68d5,_0xec69f2){return function(_0x436960){if(_0x436960){return _0x436960['update'](_0x2e68d5)[_0x5da5('0x25')](function(_0x568ddf){return _0x568ddf;});}return null;};}function removeEntity(_0x1b67c4,_0x716ab7){return function(_0x2dd138){if(_0x2dd138){return _0x2dd138['destroy']()[_0x5da5('0x25')](function(){var _0x236bf3=_0x2dd138[_0x5da5('0x26')]({'plain':!![]});var _0x21e795='ChanSpies';return db['UserProfileResource']['destroy']({'where':{'type':_0x21e795,'resourceId':_0x236bf3['id']}})[_0x5da5('0x25')](function(){return _0x2dd138;});})['then'](function(){_0x1b67c4['status'](0xcc)[_0x5da5('0x1c')]();});}};}function handleEntityNotFound(_0x3974d8,_0x5740a7){return function(_0x1798ae){if(!_0x1798ae){_0x3974d8[_0x5da5('0x1a')](0x194);}return _0x1798ae;};}function handleError(_0x558b12,_0x3b815e){_0x3b815e=_0x3b815e||0x1f4;return function(_0x27de55){logger[_0x5da5('0x27')](_0x27de55[_0x5da5('0x28')]);if(_0x27de55[_0x5da5('0x29')]){delete _0x27de55['name'];}_0x558b12[_0x5da5('0x1b')](_0x3b815e)[_0x5da5('0x2a')](_0x27de55);};}exports[_0x5da5('0x2b')]=function(_0x15a0c0,_0x55e2bf){var _0x5ee7f2={},_0x4cb022={},_0x245273={'count':0x0,'rows':[]};var _0x27ed41=_[_0x5da5('0x2c')](db[_0x5da5('0x2d')]['rawAttributes'],function(_0x585298){return{'name':_0x585298[_0x5da5('0x2e')],'type':_0x585298['type']['key']};});_0x4cb022[_0x5da5('0x2f')]=_['map'](_0x27ed41,_0x5da5('0x29'));_0x4cb022[_0x5da5('0x30')]=_[_0x5da5('0x31')](_0x15a0c0[_0x5da5('0x30')]);_0x4cb022[_0x5da5('0x32')]=_[_0x5da5('0x33')](_0x4cb022[_0x5da5('0x2f')],_0x4cb022[_0x5da5('0x30')]);_0x5ee7f2['attributes']=_[_0x5da5('0x33')](_0x4cb022['model'],qs[_0x5da5('0x34')](_0x15a0c0[_0x5da5('0x30')][_0x5da5('0x34')]));_0x5ee7f2[_0x5da5('0x35')]=_0x5ee7f2[_0x5da5('0x35')][_0x5da5('0x36')]?_0x5ee7f2[_0x5da5('0x35')]:_0x4cb022[_0x5da5('0x2f')];if(!_0x15a0c0[_0x5da5('0x30')][_0x5da5('0x37')](_0x5da5('0x38'))){_0x5ee7f2[_0x5da5('0x21')]=qs[_0x5da5('0x21')](_0x15a0c0['query'][_0x5da5('0x21')]);_0x5ee7f2['offset']=qs[_0x5da5('0x1e')](_0x15a0c0[_0x5da5('0x30')][_0x5da5('0x1e')]);}_0x5ee7f2[_0x5da5('0x39')]=qs['sort'](_0x15a0c0[_0x5da5('0x30')][_0x5da5('0x3a')]);_0x5ee7f2[_0x5da5('0x3b')]=qs['filters'](_[_0x5da5('0x3c')](_0x15a0c0[_0x5da5('0x30')],_0x4cb022['filters']),_0x27ed41);if(_0x15a0c0[_0x5da5('0x30')][_0x5da5('0x3d')]){_0x5ee7f2[_0x5da5('0x3b')]=_[_0x5da5('0x3e')](_0x5ee7f2[_0x5da5('0x3b')],{'$or':_[_0x5da5('0x2c')](_0x27ed41,function(_0x52a902){if(_0x52a902[_0x5da5('0x3f')]!==_0x5da5('0x40')){var _0x14c3f5={};_0x14c3f5[_0x52a902[_0x5da5('0x29')]]={'$like':'%'+_0x15a0c0[_0x5da5('0x30')]['filter']+'%'};return _0x14c3f5;}})});}_0x5ee7f2=_[_0x5da5('0x3e')]({},_0x5ee7f2,_0x15a0c0[_0x5da5('0x41')]);var _0x5a189e={'where':_0x5ee7f2[_0x5da5('0x3b')]};return db['VoiceChanSpy']['count'](_0x5a189e)[_0x5da5('0x25')](function(_0x21c579){_0x245273[_0x5da5('0x20')]=_0x21c579;if(_0x15a0c0[_0x5da5('0x30')][_0x5da5('0x42')]){_0x5ee7f2[_0x5da5('0x43')]=[{'all':!![]}];}return db[_0x5da5('0x2d')][_0x5da5('0x44')](_0x5ee7f2);})[_0x5da5('0x25')](function(_0x2a2814){_0x245273[_0x5da5('0x45')]=_0x2a2814;return _0x245273;})[_0x5da5('0x25')](respondWithFilteredResult(_0x55e2bf,_0x5ee7f2))[_0x5da5('0x46')](handleError(_0x55e2bf,null));};exports[_0x5da5('0x47')]=function(_0x284d40,_0x30be40){var _0x1fc965={'raw':![],'where':{'id':_0x284d40[_0x5da5('0x48')]['id']}},_0x4464a7={};_0x4464a7[_0x5da5('0x2f')]=_['keys'](db['VoiceChanSpy'][_0x5da5('0x49')]);_0x4464a7[_0x5da5('0x30')]=_['keys'](_0x284d40[_0x5da5('0x30')]);_0x4464a7[_0x5da5('0x32')]=_[_0x5da5('0x33')](_0x4464a7[_0x5da5('0x2f')],_0x4464a7[_0x5da5('0x30')]);_0x1fc965[_0x5da5('0x35')]=_[_0x5da5('0x33')](_0x4464a7[_0x5da5('0x2f')],qs[_0x5da5('0x34')](_0x284d40[_0x5da5('0x30')]['fields']));_0x1fc965[_0x5da5('0x35')]=_0x1fc965['attributes']['length']?_0x1fc965[_0x5da5('0x35')]:_0x4464a7[_0x5da5('0x2f')];if(_0x284d40[_0x5da5('0x30')][_0x5da5('0x42')]){_0x1fc965[_0x5da5('0x43')]=[{'all':!![]}];}_0x1fc965=_[_0x5da5('0x3e')]({},_0x1fc965,_0x284d40['options']);return db[_0x5da5('0x2d')]['find'](_0x1fc965)['then'](handleEntityNotFound(_0x30be40,null))[_0x5da5('0x25')](respondWithResult(_0x30be40,null))[_0x5da5('0x46')](handleError(_0x30be40,null));};exports['create']=function(_0x419d74,_0x322b08){return db[_0x5da5('0x2d')][_0x5da5('0x4a')](_0x419d74[_0x5da5('0x4b')],{})['then'](function(_0x225792){var _0x5277bc=_0x419d74['user'][_0x5da5('0x26')]({'plain':!![]});if(!_0x5277bc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5277bc[_0x5da5('0x4c')]===_0x5da5('0x4d')){var _0x17581a=_0x225792[_0x5da5('0x26')]({'plain':!![]});var _0x2cc43f=_0x5da5('0x4e');return db['UserProfileSection']['find']({'where':{'name':_0x2cc43f,'userProfileId':_0x5277bc[_0x5da5('0x4f')]},'raw':!![]})[_0x5da5('0x25')](function(_0x520830){if(_0x520830&&_0x520830['autoAssociation']===0x0){return db[_0x5da5('0x50')]['create']({'name':_0x17581a[_0x5da5('0x29')],'resourceId':_0x17581a['id'],'type':_0x520830['name'],'sectionId':_0x520830['id']},{})['then'](function(){return _0x225792;});}else{return _0x225792;}})[_0x5da5('0x46')](function(_0x323655){logger[_0x5da5('0x27')](_0x5da5('0x51'),_0x323655);throw _0x323655;});}return _0x225792;})['then'](respondWithResult(_0x322b08,0xc9))[_0x5da5('0x46')](handleError(_0x322b08,null));};exports[_0x5da5('0x52')]=function(_0xa1d591,_0x56523b){if(_0xa1d591[_0x5da5('0x4b')]['id']){delete _0xa1d591[_0x5da5('0x4b')]['id'];}return db[_0x5da5('0x2d')][_0x5da5('0x53')]({'where':{'id':_0xa1d591[_0x5da5('0x48')]['id']}})[_0x5da5('0x25')](handleEntityNotFound(_0x56523b,null))[_0x5da5('0x25')](saveUpdates(_0xa1d591[_0x5da5('0x4b')],null))[_0x5da5('0x25')](respondWithResult(_0x56523b,null))[_0x5da5('0x46')](handleError(_0x56523b,null));};exports[_0x5da5('0x54')]=function(_0x283ba5,_0x211b80){return db[_0x5da5('0x2d')][_0x5da5('0x53')]({'where':{'id':_0x283ba5[_0x5da5('0x48')]['id']}})[_0x5da5('0x25')](handleEntityNotFound(_0x211b80,null))[_0x5da5('0x25')](removeEntity(_0x211b80,null))[_0x5da5('0x46')](handleError(_0x211b80,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 59d1eeb..6850ed3 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 _0x702e=['lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','%s%s','system','merge','Set','format','record','MixMonitor','${UNIQUEID}.%s,a','auth','SIP/%s,%s','name','options','StopMixMonitor','concat','internal','User','findAll','agent','then','catch','exports','define','voice_chanspy','length','VoiceExtension','bulkCreate','destroy'];(function(_0x4245f2,_0x25f5a6){var _0x5745df=function(_0x25ccf4){while(--_0x25ccf4){_0x4245f2['push'](_0x4245f2['shift']());}};_0x5745df(++_0x25f5a6);}(_0x702e,0xe7));var _0xe702=function(_0x46531a,_0x486f23){_0x46531a=_0x46531a-0x0;var _0x53f492=_0x702e[_0x46531a];return _0x53f492;};'use strict';var _=require(_0xe702('0x0'));var util=require(_0xe702('0x1'));var BPromise=require(_0xe702('0x2'));var attributes=require(_0xe702('0x3'));var getUserApplications=function(_0x1201f9,_0x16e9dd,_0xa02da9){var _0x4f7734=0x1;var _0x12b1fd=[];var _0x4be5e3={'context':_0x16e9dd[_0xe702('0x4')]||_0xe702('0x5'),'exten':util['format'](_0xe702('0x6'),_0x1201f9['prefix'],_0xa02da9),'type':_0xe702('0x7'),'isApp':![],'ChanSpyId':_0x1201f9['id'],'UserId':_0x16e9dd['id']};_0x12b1fd['push'](_[_0xe702('0x8')]({'app':_0xe702('0x9'),'appdata':util[_0xe702('0xa')]('CDR(type)=%s','chanspy'),'priority':_0x4f7734++},_0x4be5e3));if(_0x1201f9[_0xe702('0xb')]){_0x12b1fd['push'](_[_0xe702('0x8')]({'app':_0xe702('0xc'),'appdata':util[_0xe702('0xa')](_0xe702('0xd'),_0x1201f9['recordingFormat']),'priority':_0x4f7734++},_0x4be5e3));}if(_0x1201f9[_0xe702('0xe')]){_0x12b1fd['push'](_[_0xe702('0x8')]({'app':'Authenticate','appdata':_0x1201f9['password'],'priority':_0x4f7734++},_0x4be5e3));}_0x12b1fd['push'](_[_0xe702('0x8')]({'app':'ChanSpy','appdata':util['format'](_0xe702('0xf'),_0x16e9dd[_0xe702('0x10')],_0x1201f9[_0xe702('0x11')]?_0x1201f9[_0xe702('0x11')]['join'](''):''),'priority':_0x4f7734++},_0x4be5e3));if(_0x1201f9[_0xe702('0xb')]){_0x12b1fd['push'](_[_0xe702('0x8')]({'app':_0xe702('0x12'),'priority':_0x4f7734++},_0x4be5e3));}return _0x12b1fd;};var getChanSpyApplications=function(_0x301be8,_0xba8224){var _0x591b3f=[];for(var _0xb20cf5=0x0,_0x5b69aa=0x1;_0xb20cf5<_0xba8224['length'];_0xb20cf5++,_0x5b69aa=0x1){_0x591b3f=_0x591b3f[_0xe702('0x13')](getUserApplications(_0x301be8,_0xba8224[_0xb20cf5],_0xba8224[_0xb20cf5][_0xe702('0x14')]));if(_0xba8224[_0xb20cf5][_0xe702('0x14')]!=_0xba8224[_0xb20cf5][_0xe702('0x10')]){_0x591b3f=_0x591b3f[_0xe702('0x13')](getUserApplications(_0x301be8,_0xba8224[_0xb20cf5],_0xba8224[_0xb20cf5][_0xe702('0x10')]));}}return _0x591b3f;};var getChanSpyPromise=function(_0x5d1163,_0x5ea2ec){return new BPromise(function(_0xabb48b,_0x42ef50){return _0x5d1163[_0xe702('0x15')][_0xe702('0x16')]({'attributes':['id','name','internal'],'where':{'role':_0xe702('0x17'),'chanspy':!![]},'raw':!![]})[_0xe702('0x18')](function(_0x159fca){if(_0x159fca){return _0xabb48b(getChanSpyApplications(_0x5ea2ec,_0x159fca));}return _0xabb48b([]);})[_0xe702('0x19')](function(_0x1aef4c){_0x42ef50(_0x1aef4c);});});};module[_0xe702('0x1a')]=function(_0x32743c,_0x3f3226){var _0x1d2719=_0x32743c['models'];return _0x32743c[_0xe702('0x1b')]('VoiceChanSpy',attributes,{'tableName':_0xe702('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x994c1,_0x1208aa,_0x1c0f6e){return getChanSpyPromise(_0x1d2719,_0x994c1)[_0xe702('0x18')](function(_0x59244a){if(_0x59244a&&_0x59244a[_0xe702('0x1d')]){return _0x1d2719[_0xe702('0x1e')][_0xe702('0x1f')](_0x59244a);}})[_0xe702('0x18')](function(){_0x1c0f6e();})[_0xe702('0x19')](function(_0x29bbef){_0x1c0f6e(_0x29bbef);});},'afterUpdate':function(_0x476149,_0x55ab55,_0x1166c6){return _0x1d2719[_0xe702('0x1e')][_0xe702('0x20')]({'where':{'ChanSpyId':_0x476149['id']}})['then'](function(){return getChanSpyPromise(_0x1d2719,_0x476149);})[_0xe702('0x18')](function(_0x2174c2){if(_0x2174c2&&_0x2174c2[_0xe702('0x1d')]){return _0x1d2719[_0xe702('0x1e')][_0xe702('0x1f')](_0x2174c2);}})[_0xe702('0x18')](function(){_0x1166c6();})[_0xe702('0x19')](function(_0x51219c){_0x1166c6(_0x51219c);});},'afterDestroy':function(_0x540cd3,_0x398b3a,_0x1275ce){return _0x1d2719['VoiceExtension'][_0xe702('0x20')]({'where':{'ChanSpyId':_0x540cd3['id']}})[_0xe702('0x18')](function(){_0x1275ce();})['catch'](function(_0x415325){_0x1275ce(_0x415325);});}}});}; \ No newline at end of file +var _0x36bf=['agent','then','exports','voice_chanspy','length','bulkCreate','catch','VoiceExtension','util','bluebird','./voiceChanSpy.attributes','%s%s','merge','Set','format','CDR(type)=%s','record','push','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','concat','internal','User','findAll'];(function(_0xa23cf3,_0x4a3b9c){var _0x538535=function(_0x22e588){while(--_0x22e588){_0xa23cf3['push'](_0xa23cf3['shift']());}};_0x538535(++_0x4a3b9c);}(_0x36bf,0x131));var _0xf36b=function(_0x294592,_0xc266da){_0x294592=_0x294592-0x0;var _0x29de58=_0x36bf[_0x294592];return _0x29de58;};'use strict';var _=require('lodash');var util=require(_0xf36b('0x0'));var BPromise=require(_0xf36b('0x1'));var attributes=require(_0xf36b('0x2'));var getUserApplications=function(_0x4afa32,_0x25d7fc,_0x13765d){var _0x189328=0x1;var _0x343fb0=[];var _0x3986c2={'context':_0x25d7fc['context']||'from-sip','exten':util['format'](_0xf36b('0x3'),_0x4afa32['prefix'],_0x13765d),'type':'system','isApp':![],'ChanSpyId':_0x4afa32['id'],'UserId':_0x25d7fc['id']};_0x343fb0['push'](_[_0xf36b('0x4')]({'app':_0xf36b('0x5'),'appdata':util[_0xf36b('0x6')](_0xf36b('0x7'),'chanspy'),'priority':_0x189328++},_0x3986c2));if(_0x4afa32[_0xf36b('0x8')]){_0x343fb0[_0xf36b('0x9')](_[_0xf36b('0x4')]({'app':_0xf36b('0xa'),'appdata':util[_0xf36b('0x6')](_0xf36b('0xb'),_0x4afa32[_0xf36b('0xc')]),'priority':_0x189328++},_0x3986c2));}if(_0x4afa32['auth']){_0x343fb0['push'](_[_0xf36b('0x4')]({'app':_0xf36b('0xd'),'appdata':_0x4afa32[_0xf36b('0xe')],'priority':_0x189328++},_0x3986c2));}_0x343fb0[_0xf36b('0x9')](_[_0xf36b('0x4')]({'app':_0xf36b('0xf'),'appdata':util['format'](_0xf36b('0x10'),_0x25d7fc[_0xf36b('0x11')],_0x4afa32['options']?_0x4afa32[_0xf36b('0x12')][_0xf36b('0x13')](''):''),'priority':_0x189328++},_0x3986c2));if(_0x4afa32['record']){_0x343fb0[_0xf36b('0x9')](_['merge']({'app':_0xf36b('0x14'),'priority':_0x189328++},_0x3986c2));}return _0x343fb0;};var getChanSpyApplications=function(_0x4513e9,_0x23ba21){var _0x251692=[];for(var _0x560dde=0x0,_0x295e78=0x1;_0x560dde<_0x23ba21['length'];_0x560dde++,_0x295e78=0x1){_0x251692=_0x251692[_0xf36b('0x15')](getUserApplications(_0x4513e9,_0x23ba21[_0x560dde],_0x23ba21[_0x560dde][_0xf36b('0x16')]));if(_0x23ba21[_0x560dde][_0xf36b('0x16')]!=_0x23ba21[_0x560dde][_0xf36b('0x11')]){_0x251692=_0x251692[_0xf36b('0x15')](getUserApplications(_0x4513e9,_0x23ba21[_0x560dde],_0x23ba21[_0x560dde][_0xf36b('0x11')]));}}return _0x251692;};var getChanSpyPromise=function(_0x5dbb03,_0x43632d){return new BPromise(function(_0x57949e,_0x2a504a){return _0x5dbb03[_0xf36b('0x17')][_0xf36b('0x18')]({'attributes':['id','name',_0xf36b('0x16')],'where':{'role':_0xf36b('0x19'),'chanspy':!![]},'raw':!![]})[_0xf36b('0x1a')](function(_0x396161){if(_0x396161){return _0x57949e(getChanSpyApplications(_0x43632d,_0x396161));}return _0x57949e([]);})['catch'](function(_0x206254){_0x2a504a(_0x206254);});});};module[_0xf36b('0x1b')]=function(_0x19ea01,_0x535ab5){var _0x1149e2=_0x19ea01['models'];return _0x19ea01['define']('VoiceChanSpy',attributes,{'tableName':_0xf36b('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x8f6908,_0x462747,_0x5c7f5f){return getChanSpyPromise(_0x1149e2,_0x8f6908)[_0xf36b('0x1a')](function(_0x54a1fb){if(_0x54a1fb&&_0x54a1fb[_0xf36b('0x1d')]){return _0x1149e2['VoiceExtension'][_0xf36b('0x1e')](_0x54a1fb);}})[_0xf36b('0x1a')](function(){_0x5c7f5f();})[_0xf36b('0x1f')](function(_0x243a9a){_0x5c7f5f(_0x243a9a);});},'afterUpdate':function(_0x3c6881,_0x14be9c,_0xc5af4b){return _0x1149e2[_0xf36b('0x20')]['destroy']({'where':{'ChanSpyId':_0x3c6881['id']}})[_0xf36b('0x1a')](function(){return getChanSpyPromise(_0x1149e2,_0x3c6881);})['then'](function(_0x418980){if(_0x418980&&_0x418980[_0xf36b('0x1d')]){return _0x1149e2['VoiceExtension']['bulkCreate'](_0x418980);}})[_0xf36b('0x1a')](function(){_0xc5af4b();})[_0xf36b('0x1f')](function(_0x1115d0){_0xc5af4b(_0x1115d0);});},'afterDestroy':function(_0x11a07e,_0x4ae041,_0x37dcd0){return _0x1149e2['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x11a07e['id']}})[_0xf36b('0x1a')](function(){_0x37dcd0();})[_0xf36b('0x1f')](function(_0x4a1808){_0x37dcd0(_0x4a1808);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index ac0dc16..9a9a031 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 _0x0624=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x592426,_0x23e948){var _0x3854eb=function(_0x5cbe9b){while(--_0x5cbe9b){_0x592426['push'](_0x592426['shift']());}};_0x3854eb(++_0x23e948);}(_0x0624,0x132));var _0x4062=function(_0x4b7a6f,_0x4ab35f){_0x4b7a6f=_0x4b7a6f-0x0;var _0x483af0=_0x0624[_0x4b7a6f];return _0x483af0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4062('0x0'));var fs=require('fs');var Redis=require(_0x4062('0x1'));var db=require(_0x4062('0x2'))['db'];var utils=require(_0x4062('0x3'));var logger=require(_0x4062('0x4'))(_0x4062('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4062('0x6')][_0x4062('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2f4928,_0xdff88c,_0x27794b){return new BPromise(function(_0x5d19e8,_0x75ce4e){return client['request'](_0x2f4928,_0x27794b)[_0x4062('0x8')](function(_0x35663b){logger[_0x4062('0x9')](_0x4062('0xa'),_0xdff88c,_0x4062('0xb'));logger[_0x4062('0xc')](_0x4062('0xd'),_0xdff88c,'request\x20sent',JSON[_0x4062('0xe')](_0x35663b));if(_0x35663b['error']){if(_0x35663b[_0x4062('0xf')][_0x4062('0x10')]===0x1f4){logger[_0x4062('0xf')](_0x4062('0xa'),_0xdff88c,_0x35663b[_0x4062('0xf')]['message']);return _0x75ce4e(_0x35663b[_0x4062('0xf')][_0x4062('0x11')]);}logger['error'](_0x4062('0xa'),_0xdff88c,_0x35663b[_0x4062('0xf')][_0x4062('0x11')]);return _0x5d19e8(_0x35663b['error']['message']);}else{logger[_0x4062('0x9')](_0x4062('0xa'),_0xdff88c,'request\x20sent');_0x5d19e8(_0x35663b['result']['message']);}})['catch'](function(_0x437432){logger['error'](_0x4062('0xa'),_0xdff88c,_0x437432);_0x75ce4e(_0x437432);});});} \ No newline at end of file +var _0x4876=['stringify','error','code','message','result','catch','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x221476,_0xb95187){var _0x1811d0=function(_0xc54332){while(--_0xc54332){_0x221476['push'](_0x221476['shift']());}};_0x1811d0(++_0xb95187);}(_0x4876,0x84));var _0x6487=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4876[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6487('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6487('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x6487('0x2'));var logger=require(_0x6487('0x3'))(_0x6487('0x4'));var config=require(_0x6487('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x6487('0x6')][_0x6487('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x52177e,_0x289918,_0x14d6d8){return new BPromise(function(_0x2df3c1,_0x3f237a){return client[_0x6487('0x8')](_0x52177e,_0x14d6d8)[_0x6487('0x9')](function(_0x84bd9f){logger[_0x6487('0xa')](_0x6487('0xb'),_0x289918,'request\x20sent');logger[_0x6487('0xc')](_0x6487('0xd'),_0x289918,_0x6487('0xe'),JSON[_0x6487('0xf')](_0x84bd9f));if(_0x84bd9f[_0x6487('0x10')]){if(_0x84bd9f[_0x6487('0x10')][_0x6487('0x11')]===0x1f4){logger[_0x6487('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x289918,_0x84bd9f[_0x6487('0x10')][_0x6487('0x12')]);return _0x3f237a(_0x84bd9f[_0x6487('0x10')][_0x6487('0x12')]);}logger['error'](_0x6487('0xb'),_0x289918,_0x84bd9f[_0x6487('0x10')][_0x6487('0x12')]);return _0x2df3c1(_0x84bd9f[_0x6487('0x10')]['message']);}else{logger['info'](_0x6487('0xb'),_0x289918,'request\x20sent');_0x2df3c1(_0x84bd9f[_0x6487('0x13')]['message']);}})[_0x6487('0x14')](function(_0x3e7560){logger[_0x6487('0x10')](_0x6487('0xb'),_0x289918,_0x3e7560);_0x3f237a(_0x3e7560);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index d54ceb1..5c31974 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 _0x6cd5=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x39e9a7,_0x155bae){var _0x1c611b=function(_0x1c6864){while(--_0x1c6864){_0x39e9a7['push'](_0x39e9a7['shift']());}};_0x1c611b(++_0x155bae);}(_0x6cd5,0x118));var _0x56cd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6cd5[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x56cd('0x0'));var util=require(_0x56cd('0x1'));var path=require(_0x56cd('0x2'));var timeout=require(_0x56cd('0x3'));var express=require(_0x56cd('0x4'));var router=express[_0x56cd('0x5')]();var fs_extra=require(_0x56cd('0x6'));var auth=require(_0x56cd('0x7'));var interaction=require(_0x56cd('0x8'));var config=require(_0x56cd('0x9'));var controller=require(_0x56cd('0xa'));router[_0x56cd('0xb')]('/',auth[_0x56cd('0xc')](),controller[_0x56cd('0xd')]);router[_0x56cd('0xb')](_0x56cd('0xe'),auth[_0x56cd('0xc')](),controller['show']);router[_0x56cd('0xf')]('/',auth['isAuthenticated'](),controller[_0x56cd('0x10')]);router[_0x56cd('0x11')]('/:id',auth[_0x56cd('0xc')](),controller[_0x56cd('0x12')]);router[_0x56cd('0x13')](_0x56cd('0xe'),auth[_0x56cd('0xc')](),controller[_0x56cd('0x14')]);module[_0x56cd('0x15')]=router; \ No newline at end of file +var _0xca5d=['create','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','index','get','/:id','isAuthenticated','show'];(function(_0x138096,_0x2a0154){var _0x26ba9e=function(_0x364e76){while(--_0x364e76){_0x138096['push'](_0x138096['shift']());}};_0x26ba9e(++_0x2a0154);}(_0xca5d,0x101));var _0xdca5=function(_0x35b311,_0x25682f){_0x35b311=_0x35b311-0x0;var _0x5edb58=_0xca5d[_0x35b311];return _0x5edb58;};'use strict';var multer=require(_0xdca5('0x0'));var util=require(_0xdca5('0x1'));var path=require(_0xdca5('0x2'));var timeout=require('connect-timeout');var express=require(_0xdca5('0x3'));var router=express[_0xdca5('0x4')]();var fs_extra=require(_0xdca5('0x5'));var auth=require(_0xdca5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdca5('0x7'));var controller=require('./voiceContext.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xdca5('0x8')]);router[_0xdca5('0x9')](_0xdca5('0xa'),auth[_0xdca5('0xb')](),controller[_0xdca5('0xc')]);router['post']('/',auth[_0xdca5('0xb')](),controller[_0xdca5('0xd')]);router[_0xdca5('0xe')](_0xdca5('0xa'),auth['isAuthenticated'](),controller[_0xdca5('0xf')]);router[_0xdca5('0x10')](_0xdca5('0xa'),auth[_0xdca5('0xb')](),controller[_0xdca5('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 82e06e7..6d5b187 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 _0xf515=['exports','STRING','name'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0xf515,0x1bf));var _0x5f51=function(_0x15cc70,_0x412679){_0x15cc70=_0x15cc70-0x0;var _0x34cca0=_0xf515[_0x15cc70];return _0x34cca0;};'use strict';var Sequelize=require('sequelize');module[_0x5f51('0x0')]={'name':{'type':Sequelize[_0x5f51('0x1')],'unique':_0x5f51('0x2')},'description':{'type':Sequelize[_0x5f51('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x2efd=['BOOLEAN','sequelize','exports','STRING','name'];(function(_0x1af00c,_0x475953){var _0x10c803=function(_0x2c6d62){while(--_0x2c6d62){_0x1af00c['push'](_0x1af00c['shift']());}};_0x10c803(++_0x475953);}(_0x2efd,0xa1));var _0xd2ef=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2efd[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xd2ef('0x0'));module[_0xd2ef('0x1')]={'name':{'type':Sequelize[_0xd2ef('0x2')],'unique':_0xd2ef('0x3')},'description':{'type':Sequelize[_0xd2ef('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xd2ef('0x4')],'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 a924721..ed8e821 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 _0xea94=['merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','keys','length','find','create','body','join','server/files/templates/context.ejs','writeFileSync','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','readFileSync','root','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','utf8','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','http','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','get','Contexts','UserProfileResource','stack','name','send','map','VoiceContext','rawAttributes','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','sort','filters','pick','where'];(function(_0x463387,_0x97f411){var _0x47b2d6=function(_0x5d83ad){while(--_0x5d83ad){_0x463387['push'](_0x463387['shift']());}};_0x47b2d6(++_0x97f411);}(_0xea94,0xea));var _0x4ea9=function(_0x1ec586,_0x331aba){_0x1ec586=_0x1ec586-0x0;var _0x39b0f0=_0xea94[_0x1ec586];return _0x39b0f0;};'use strict';var emlformat=require(_0x4ea9('0x0'));var rimraf=require(_0x4ea9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4ea9('0x2'));var rp=require(_0x4ea9('0x3'));var moment=require(_0x4ea9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4ea9('0x5'));var util=require(_0x4ea9('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x4ea9('0x7'));var ejs=require(_0x4ea9('0x8'));var fs=require('fs');var fs_extra=require(_0x4ea9('0x9'));var _=require(_0x4ea9('0xa'));var squel=require(_0x4ea9('0xb'));var crypto=require(_0x4ea9('0xc'));var jsforce=require(_0x4ea9('0xd'));var deskjs=require(_0x4ea9('0xe'));var toCsv=require(_0x4ea9('0x7'));var querystring=require('querystring');var Papa=require(_0x4ea9('0xf'));var Redis=require(_0x4ea9('0x10'));var authService=require(_0x4ea9('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4ea9('0x12'));var logger=require('../../config/logger')(_0x4ea9('0x13'));var utils=require('../../config/utils');var config=require(_0x4ea9('0x14'));var licenseUtil=require(_0x4ea9('0x15'));var db=require(_0x4ea9('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x4ea9('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x41d84a,_0x4b0fef,_0x5e23b0,_0x4dac26){return new BPromise(function(_0x3921ba,_0x41069b){var _0x44b71b=_0x4dac26||client;return _0x44b71b['request'](_0x41d84a,_0x5e23b0)['then'](function(_0x980e5b){logger['info'](_0x4ea9('0x18'),_0x4b0fef,_0x4ea9('0x19'));logger['debug'](_0x4ea9('0x1a'),_0x4b0fef,_0x4ea9('0x19'),JSON[_0x4ea9('0x1b')](_0x980e5b));if(_0x980e5b['error']){if(_0x980e5b[_0x4ea9('0x1c')][_0x4ea9('0x1d')]===0x1f4){logger['error'](_0x4ea9('0x18'),_0x4b0fef,_0x980e5b[_0x4ea9('0x1c')][_0x4ea9('0x1e')]);return _0x41069b(_0x980e5b[_0x4ea9('0x1c')][_0x4ea9('0x1e')]);}logger[_0x4ea9('0x1c')](_0x4ea9('0x18'),_0x4b0fef,_0x980e5b[_0x4ea9('0x1c')][_0x4ea9('0x1e')]);return _0x3921ba(_0x980e5b['error'][_0x4ea9('0x1e')]);}else{logger[_0x4ea9('0x1f')](_0x4ea9('0x18'),_0x4b0fef,_0x4ea9('0x19'));_0x3921ba(_0x980e5b[_0x4ea9('0x20')][_0x4ea9('0x1e')]);}})['catch'](function(_0x16778d){logger[_0x4ea9('0x1c')](_0x4ea9('0x18'),_0x4b0fef,_0x16778d);_0x41069b(_0x16778d);});});}function respondWithStatusCode(_0x2394d9,_0x52422b){_0x52422b=_0x52422b||0xcc;return function(_0x3701d4){if(_0x3701d4){return _0x2394d9[_0x4ea9('0x21')](_0x52422b);}return _0x2394d9[_0x4ea9('0x22')](_0x52422b)[_0x4ea9('0x23')]();};}function respondWithResult(_0x11232f,_0x15e299){_0x15e299=_0x15e299||0xc8;return function(_0x55e718){if(_0x55e718){return _0x11232f[_0x4ea9('0x22')](_0x15e299)[_0x4ea9('0x24')](_0x55e718);}};}function respondWithFilteredResult(_0x2b9067,_0x4a3b71){return function(_0x2fa821){if(_0x2fa821){var _0x308c04=typeof _0x4a3b71[_0x4ea9('0x25')]===_0x4ea9('0x26')&&typeof _0x4a3b71[_0x4ea9('0x27')]==='undefined';var _0x29deeb=_0x2fa821[_0x4ea9('0x28')];var _0x22da16=_0x308c04?0x0:_0x4a3b71[_0x4ea9('0x25')];var _0x1ad64=_0x308c04?_0x2fa821[_0x4ea9('0x28')]:_0x4a3b71[_0x4ea9('0x25')]+_0x4a3b71[_0x4ea9('0x27')];var _0x4b9274;if(_0x1ad64>=_0x29deeb){_0x1ad64=_0x29deeb;_0x4b9274=0xc8;}else{_0x4b9274=0xce;}_0x2b9067[_0x4ea9('0x22')](_0x4b9274);return _0x2b9067[_0x4ea9('0x29')](_0x4ea9('0x2a'),_0x22da16+'-'+_0x1ad64+'/'+_0x29deeb)[_0x4ea9('0x24')](_0x2fa821);}return null;};}function patchUpdates(_0x8090a5){return function(_0x178c20){try{jsonpatch['apply'](_0x178c20,_0x8090a5,!![]);}catch(_0xbd482c){return BPromise[_0x4ea9('0x2b')](_0xbd482c);}return _0x178c20[_0x4ea9('0x2c')]();};}function saveUpdates(_0x5a89ea,_0x2db3d1){return function(_0x186c98){if(_0x186c98){return _0x186c98['update'](_0x5a89ea)[_0x4ea9('0x2d')](function(_0x175384){return _0x175384;});}return null;};}function removeEntity(_0x4fb7f4,_0x18a0ee){return function(_0x4aeecc){if(_0x4aeecc){return _0x4aeecc[_0x4ea9('0x2e')]()['then'](function(){var _0xa81eac=_0x4aeecc[_0x4ea9('0x2f')]({'plain':!![]});var _0x3e0a1=_0x4ea9('0x30');return db[_0x4ea9('0x31')]['destroy']({'where':{'type':_0x3e0a1,'resourceId':_0xa81eac['id']}})['then'](function(){return _0x4aeecc;});})[_0x4ea9('0x2d')](function(){_0x4fb7f4[_0x4ea9('0x22')](0xcc)[_0x4ea9('0x23')]();});}};}function handleEntityNotFound(_0x19c186,_0x37eba1){return function(_0x464945){if(!_0x464945){_0x19c186[_0x4ea9('0x21')](0x194);}return _0x464945;};}function handleError(_0x4caa24,_0x3cb60b){_0x3cb60b=_0x3cb60b||0x1f4;return function(_0xf63336){logger[_0x4ea9('0x1c')](_0xf63336[_0x4ea9('0x32')]);if(_0xf63336['name']){delete _0xf63336[_0x4ea9('0x33')];}_0x4caa24[_0x4ea9('0x22')](_0x3cb60b)[_0x4ea9('0x34')](_0xf63336);};}exports['index']=function(_0x41695c,_0x2ff371){var _0x58a06a={},_0x29dcc1={},_0x39c4d3={'count':0x0,'rows':[]};var _0x50dbeb=_[_0x4ea9('0x35')](db[_0x4ea9('0x36')][_0x4ea9('0x37')],function(_0x570fb7){return{'name':_0x570fb7['fieldName'],'type':_0x570fb7[_0x4ea9('0x38')][_0x4ea9('0x39')]};});_0x29dcc1[_0x4ea9('0x3a')]=_[_0x4ea9('0x35')](_0x50dbeb,_0x4ea9('0x33'));_0x29dcc1[_0x4ea9('0x3b')]=_['keys'](_0x41695c[_0x4ea9('0x3b')]);_0x29dcc1['filters']=_[_0x4ea9('0x3c')](_0x29dcc1[_0x4ea9('0x3a')],_0x29dcc1[_0x4ea9('0x3b')]);_0x58a06a['attributes']=_[_0x4ea9('0x3c')](_0x29dcc1[_0x4ea9('0x3a')],qs[_0x4ea9('0x3d')](_0x41695c[_0x4ea9('0x3b')][_0x4ea9('0x3d')]));_0x58a06a['attributes']=_0x58a06a[_0x4ea9('0x3e')]['length']?_0x58a06a[_0x4ea9('0x3e')]:_0x29dcc1[_0x4ea9('0x3a')];if(!_0x41695c[_0x4ea9('0x3b')][_0x4ea9('0x3f')](_0x4ea9('0x40'))){_0x58a06a[_0x4ea9('0x27')]=qs[_0x4ea9('0x27')](_0x41695c[_0x4ea9('0x3b')][_0x4ea9('0x27')]);_0x58a06a[_0x4ea9('0x25')]=qs['offset'](_0x41695c['query'][_0x4ea9('0x25')]);}_0x58a06a['order']=qs[_0x4ea9('0x41')](_0x41695c['query'][_0x4ea9('0x41')]);_0x58a06a['where']=qs[_0x4ea9('0x42')](_[_0x4ea9('0x43')](_0x41695c[_0x4ea9('0x3b')],_0x29dcc1['filters']),_0x50dbeb);if(_0x41695c[_0x4ea9('0x3b')]['filter']){_0x58a06a[_0x4ea9('0x44')]=_[_0x4ea9('0x45')](_0x58a06a[_0x4ea9('0x44')],{'$or':_[_0x4ea9('0x35')](_0x50dbeb,function(_0x54cad6){if(_0x54cad6['type']!==_0x4ea9('0x46')){var _0x5124e4={};_0x5124e4[_0x54cad6[_0x4ea9('0x33')]]={'$like':'%'+_0x41695c['query'][_0x4ea9('0x47')]+'%'};return _0x5124e4;}})});}_0x58a06a=_[_0x4ea9('0x45')]({},_0x58a06a,_0x41695c[_0x4ea9('0x48')]);var _0x1de162={'where':_0x58a06a[_0x4ea9('0x44')]};return db[_0x4ea9('0x36')][_0x4ea9('0x28')](_0x1de162)[_0x4ea9('0x2d')](function(_0x563a13){_0x39c4d3['count']=_0x563a13;if(_0x41695c[_0x4ea9('0x3b')][_0x4ea9('0x49')]){_0x58a06a[_0x4ea9('0x4a')]=[{'all':!![]}];}return db[_0x4ea9('0x36')][_0x4ea9('0x4b')](_0x58a06a);})[_0x4ea9('0x2d')](function(_0x5c2e09){_0x39c4d3[_0x4ea9('0x4c')]=_0x5c2e09;return _0x39c4d3;})[_0x4ea9('0x2d')](respondWithFilteredResult(_0x2ff371,_0x58a06a))[_0x4ea9('0x4d')](handleError(_0x2ff371,null));};exports['show']=function(_0x22f3f9,_0x15e8e4){var _0x5ea339={'raw':![],'where':{'id':_0x22f3f9['params']['id']}},_0x3860a0={};_0x3860a0[_0x4ea9('0x3a')]=_[_0x4ea9('0x4e')](db[_0x4ea9('0x36')]['rawAttributes']);_0x3860a0[_0x4ea9('0x3b')]=_[_0x4ea9('0x4e')](_0x22f3f9[_0x4ea9('0x3b')]);_0x3860a0[_0x4ea9('0x42')]=_[_0x4ea9('0x3c')](_0x3860a0[_0x4ea9('0x3a')],_0x3860a0[_0x4ea9('0x3b')]);_0x5ea339[_0x4ea9('0x3e')]=_[_0x4ea9('0x3c')](_0x3860a0[_0x4ea9('0x3a')],qs[_0x4ea9('0x3d')](_0x22f3f9['query']['fields']));_0x5ea339[_0x4ea9('0x3e')]=_0x5ea339['attributes'][_0x4ea9('0x4f')]?_0x5ea339[_0x4ea9('0x3e')]:_0x3860a0[_0x4ea9('0x3a')];if(_0x22f3f9[_0x4ea9('0x3b')][_0x4ea9('0x49')]){_0x5ea339[_0x4ea9('0x4a')]=[{'all':!![]}];}_0x5ea339=_['merge']({},_0x5ea339,_0x22f3f9[_0x4ea9('0x48')]);return db[_0x4ea9('0x36')][_0x4ea9('0x50')](_0x5ea339)[_0x4ea9('0x2d')](handleEntityNotFound(_0x15e8e4,null))[_0x4ea9('0x2d')](respondWithResult(_0x15e8e4,null))[_0x4ea9('0x4d')](handleError(_0x15e8e4,null));};exports[_0x4ea9('0x51')]=function(_0x131ad5,_0x12452b,_0x280884){var _0x414f4c;return db[_0x4ea9('0x36')][_0x4ea9('0x51')](_0x131ad5[_0x4ea9('0x52')],{'raw':!![]})[_0x4ea9('0x2d')](function(_0xca0bac){_0x414f4c=_0xca0bac;return db['VoiceContext']['findAll']({'raw':!![]});})[_0x4ea9('0x2d')](function(_0x3cad41){var _0x3de9f0=fs['readFileSync'](path[_0x4ea9('0x53')](config['root'],_0x4ea9('0x54')),'utf8');var _0x197cf1=ejs['render'](_0x3de9f0,{'contexts':_0x3cad41||[]});fs[_0x4ea9('0x55')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x197cf1);})['then'](function(){return respondWithRpcPromise('Reload',_0x4ea9('0x51'),{'module':_0x4ea9('0x56')});})[_0x4ea9('0x2d')](function(){var _0x18ae47=_0x131ad5[_0x4ea9('0x57')]['get']({'plain':!![]});if(!_0x18ae47)throw new Error(_0x4ea9('0x58'));if(_0x18ae47[_0x4ea9('0x59')]===_0x4ea9('0x57')){var _0x3ae237=_0x414f4c[_0x4ea9('0x2f')]({'plain':!![]});return db[_0x4ea9('0x5a')][_0x4ea9('0x50')]({'where':{'name':_0x4ea9('0x30'),'userProfileId':_0x18ae47['userProfileId']},'raw':!![]})[_0x4ea9('0x2d')](function(_0x1c32c0){if(_0x1c32c0&&_0x1c32c0[_0x4ea9('0x5b')]===0x0){return db[_0x4ea9('0x31')][_0x4ea9('0x51')]({'name':_0x3ae237['name'],'resourceId':_0x3ae237['id'],'type':_0x1c32c0[_0x4ea9('0x33')],'sectionId':_0x1c32c0['id']},{})['then'](function(){return _0x414f4c;});}else{return _0x414f4c;}})[_0x4ea9('0x4d')](function(_0x54f8b8){logger[_0x4ea9('0x1c')](_0x4ea9('0x5c'),_0x54f8b8);throw _0x54f8b8;});}return _0x414f4c;})[_0x4ea9('0x2d')](respondWithResult(_0x12452b,0xc9))[_0x4ea9('0x4d')](handleError(_0x12452b,null));};exports[_0x4ea9('0x5d')]=function(_0x37a072,_0x1e29c4,_0x2e6cdd){var _0x58997c;return db['VoiceContext']['find']({'where':{'id':_0x37a072[_0x4ea9('0x5e')]['id']}})[_0x4ea9('0x2d')](handleEntityNotFound(_0x1e29c4,null))[_0x4ea9('0x2d')](saveUpdates(_0x37a072['body'],null))[_0x4ea9('0x2d')](function(_0x4dc07a){if(_0x4dc07a){_0x58997c=_0x4dc07a;return db[_0x4ea9('0x36')][_0x4ea9('0x4b')]({'raw':!![]});}})[_0x4ea9('0x2d')](function(_0x51fae9){var _0x1d7a95=fs[_0x4ea9('0x5f')](path[_0x4ea9('0x53')](config[_0x4ea9('0x60')],_0x4ea9('0x54')),'utf8');var _0x14efa5=ejs[_0x4ea9('0x61')](_0x1d7a95,{'contexts':_0x51fae9||[]});fs[_0x4ea9('0x55')](_0x4ea9('0x62'),_0x14efa5);})[_0x4ea9('0x2d')](function(){return respondWithRpcPromise(_0x4ea9('0x63'),_0x4ea9('0x5d'),{'module':_0x4ea9('0x56')});})[_0x4ea9('0x2d')](function(){return _0x58997c;})[_0x4ea9('0x2d')](respondWithResult(_0x1e29c4,null))['catch'](handleError(_0x1e29c4,null));};exports[_0x4ea9('0x2e')]=function(_0x5e2d98,_0x1387c2,_0x3565dd){var _0x23c2e4;return db[_0x4ea9('0x36')][_0x4ea9('0x50')]({'where':{'id':_0x5e2d98[_0x4ea9('0x5e')]['id']}})[_0x4ea9('0x2d')](handleEntityNotFound(_0x1387c2,null))[_0x4ea9('0x2d')](removeEntity(_0x1387c2,null))[_0x4ea9('0x2d')](function(){return db['VoiceContext'][_0x4ea9('0x4b')]({'raw':!![]});})['then'](function(_0x15b092){var _0xa84dea=fs[_0x4ea9('0x5f')](path[_0x4ea9('0x53')](config[_0x4ea9('0x60')],_0x4ea9('0x54')),_0x4ea9('0x64'));var _0x571d84=ejs[_0x4ea9('0x61')](_0xa84dea,{'contexts':_0x15b092});fs[_0x4ea9('0x55')](_0x4ea9('0x62'),_0x571d84);return respondWithRpcPromise(_0x4ea9('0x63'),_0x4ea9('0x2e'),{'module':_0x4ea9('0x56')});})[_0x4ea9('0x4d')](handleError(_0x1387c2,null));}; \ No newline at end of file +var _0x69f4=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','params','find','create','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','zip-dir','request-promise','bluebird','mustache','util','sox','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','get','Contexts','destroy','name','send','index','map','VoiceContext','rawAttributes','fieldName'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x69f4,0x150));var _0x469f=function(_0x3ed528,_0x52481c){_0x3ed528=_0x3ed528-0x0;var _0x3ac7fb=_0x69f4[_0x3ed528];return _0x3ac7fb;};'use strict';var emlformat=require(_0x469f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x469f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x469f('0x2'));var moment=require('moment');var BPromise=require(_0x469f('0x3'));var Mustache=require(_0x469f('0x4'));var util=require(_0x469f('0x5'));var path=require('path');var sox=require(_0x469f('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x469f('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x469f('0x8'));var deskjs=require(_0x469f('0x9'));var toCsv=require(_0x469f('0xa'));var querystring=require(_0x469f('0xb'));var Papa=require(_0x469f('0xc'));var Redis=require(_0x469f('0xd'));var authService=require(_0x469f('0xe'));var qs=require(_0x469f('0xf'));var as=require(_0x469f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x469f('0x11'));var config=require(_0x469f('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x469f('0x13')][_0x469f('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x4cd941,_0xbe50ee,_0x2ad83a,_0x4979dd){return new BPromise(function(_0x39f6bd,_0x3bce2f){var _0x5e993c=_0x4979dd||client;return _0x5e993c[_0x469f('0x15')](_0x4cd941,_0x2ad83a)[_0x469f('0x16')](function(_0x1bd1e8){logger[_0x469f('0x17')](_0x469f('0x18'),_0xbe50ee,'request\x20sent');logger[_0x469f('0x19')](_0x469f('0x1a'),_0xbe50ee,_0x469f('0x1b'),JSON['stringify'](_0x1bd1e8));if(_0x1bd1e8[_0x469f('0x1c')]){if(_0x1bd1e8[_0x469f('0x1c')][_0x469f('0x1d')]===0x1f4){logger['error'](_0x469f('0x18'),_0xbe50ee,_0x1bd1e8['error'][_0x469f('0x1e')]);return _0x3bce2f(_0x1bd1e8[_0x469f('0x1c')][_0x469f('0x1e')]);}logger[_0x469f('0x1c')](_0x469f('0x18'),_0xbe50ee,_0x1bd1e8[_0x469f('0x1c')][_0x469f('0x1e')]);return _0x39f6bd(_0x1bd1e8[_0x469f('0x1c')]['message']);}else{logger[_0x469f('0x17')](_0x469f('0x18'),_0xbe50ee,_0x469f('0x1b'));_0x39f6bd(_0x1bd1e8[_0x469f('0x1f')][_0x469f('0x1e')]);}})[_0x469f('0x20')](function(_0x180edb){logger['error'](_0x469f('0x18'),_0xbe50ee,_0x180edb);_0x3bce2f(_0x180edb);});});}function respondWithStatusCode(_0x46acb6,_0x4bd3b8){_0x4bd3b8=_0x4bd3b8||0xcc;return function(_0x27b921){if(_0x27b921){return _0x46acb6[_0x469f('0x21')](_0x4bd3b8);}return _0x46acb6[_0x469f('0x22')](_0x4bd3b8)[_0x469f('0x23')]();};}function respondWithResult(_0x4ec3b4,_0x133b74){_0x133b74=_0x133b74||0xc8;return function(_0x3a7633){if(_0x3a7633){return _0x4ec3b4[_0x469f('0x22')](_0x133b74)[_0x469f('0x24')](_0x3a7633);}};}function respondWithFilteredResult(_0x324970,_0xeac3b8){return function(_0x476efe){if(_0x476efe){var _0x1ae5f6=typeof _0xeac3b8[_0x469f('0x25')]===_0x469f('0x26')&&typeof _0xeac3b8['limit']===_0x469f('0x26');var _0x13c8ba=_0x476efe[_0x469f('0x27')];var _0x30f954=_0x1ae5f6?0x0:_0xeac3b8[_0x469f('0x25')];var _0x3e4f96=_0x1ae5f6?_0x476efe[_0x469f('0x27')]:_0xeac3b8['offset']+_0xeac3b8[_0x469f('0x28')];var _0x1d60d9;if(_0x3e4f96>=_0x13c8ba){_0x3e4f96=_0x13c8ba;_0x1d60d9=0xc8;}else{_0x1d60d9=0xce;}_0x324970['status'](_0x1d60d9);return _0x324970[_0x469f('0x29')](_0x469f('0x2a'),_0x30f954+'-'+_0x3e4f96+'/'+_0x13c8ba)[_0x469f('0x24')](_0x476efe);}return null;};}function patchUpdates(_0x481c18){return function(_0x3d7f31){try{jsonpatch[_0x469f('0x2b')](_0x3d7f31,_0x481c18,!![]);}catch(_0x26aaf1){return BPromise[_0x469f('0x2c')](_0x26aaf1);}return _0x3d7f31[_0x469f('0x2d')]();};}function saveUpdates(_0x14fe8b,_0x56e3ca){return function(_0x529794){if(_0x529794){return _0x529794['update'](_0x14fe8b)[_0x469f('0x16')](function(_0x2a45b6){return _0x2a45b6;});}return null;};}function removeEntity(_0x3ac3b7,_0x295240){return function(_0x143a7b){if(_0x143a7b){return _0x143a7b['destroy']()[_0x469f('0x16')](function(){var _0xc8ff58=_0x143a7b[_0x469f('0x2e')]({'plain':!![]});var _0x140c74=_0x469f('0x2f');return db['UserProfileResource'][_0x469f('0x30')]({'where':{'type':_0x140c74,'resourceId':_0xc8ff58['id']}})[_0x469f('0x16')](function(){return _0x143a7b;});})['then'](function(){_0x3ac3b7[_0x469f('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e6506,_0x3d8cf9){return function(_0x485513){if(!_0x485513){_0x2e6506[_0x469f('0x21')](0x194);}return _0x485513;};}function handleError(_0x12abbf,_0x54d64d){_0x54d64d=_0x54d64d||0x1f4;return function(_0x4c4b93){logger[_0x469f('0x1c')](_0x4c4b93['stack']);if(_0x4c4b93['name']){delete _0x4c4b93[_0x469f('0x31')];}_0x12abbf[_0x469f('0x22')](_0x54d64d)[_0x469f('0x32')](_0x4c4b93);};}exports[_0x469f('0x33')]=function(_0x353527,_0x56e115){var _0x1c2260={},_0x5bd976={},_0x2aa313={'count':0x0,'rows':[]};var _0x18f551=_[_0x469f('0x34')](db[_0x469f('0x35')][_0x469f('0x36')],function(_0x1ed26e){return{'name':_0x1ed26e[_0x469f('0x37')],'type':_0x1ed26e[_0x469f('0x38')][_0x469f('0x39')]};});_0x5bd976[_0x469f('0x3a')]=_[_0x469f('0x34')](_0x18f551,_0x469f('0x31'));_0x5bd976[_0x469f('0x3b')]=_[_0x469f('0x3c')](_0x353527[_0x469f('0x3b')]);_0x5bd976[_0x469f('0x3d')]=_[_0x469f('0x3e')](_0x5bd976['model'],_0x5bd976[_0x469f('0x3b')]);_0x1c2260[_0x469f('0x3f')]=_['intersection'](_0x5bd976[_0x469f('0x3a')],qs[_0x469f('0x40')](_0x353527[_0x469f('0x3b')][_0x469f('0x40')]));_0x1c2260[_0x469f('0x3f')]=_0x1c2260[_0x469f('0x3f')][_0x469f('0x41')]?_0x1c2260['attributes']:_0x5bd976[_0x469f('0x3a')];if(!_0x353527[_0x469f('0x3b')][_0x469f('0x42')](_0x469f('0x43'))){_0x1c2260['limit']=qs[_0x469f('0x28')](_0x353527[_0x469f('0x3b')][_0x469f('0x28')]);_0x1c2260[_0x469f('0x25')]=qs['offset'](_0x353527[_0x469f('0x3b')][_0x469f('0x25')]);}_0x1c2260[_0x469f('0x44')]=qs[_0x469f('0x45')](_0x353527['query'][_0x469f('0x45')]);_0x1c2260[_0x469f('0x46')]=qs[_0x469f('0x3d')](_['pick'](_0x353527[_0x469f('0x3b')],_0x5bd976[_0x469f('0x3d')]),_0x18f551);if(_0x353527[_0x469f('0x3b')][_0x469f('0x47')]){_0x1c2260[_0x469f('0x46')]=_['merge'](_0x1c2260[_0x469f('0x46')],{'$or':_[_0x469f('0x34')](_0x18f551,function(_0x1544db){if(_0x1544db[_0x469f('0x38')]!=='VIRTUAL'){var _0x2099d7={};_0x2099d7[_0x1544db[_0x469f('0x31')]]={'$like':'%'+_0x353527[_0x469f('0x3b')]['filter']+'%'};return _0x2099d7;}})});}_0x1c2260=_[_0x469f('0x48')]({},_0x1c2260,_0x353527['options']);var _0x59399a={'where':_0x1c2260['where']};return db[_0x469f('0x35')][_0x469f('0x27')](_0x59399a)[_0x469f('0x16')](function(_0x4d4edc){_0x2aa313[_0x469f('0x27')]=_0x4d4edc;if(_0x353527['query'][_0x469f('0x49')]){_0x1c2260[_0x469f('0x4a')]=[{'all':!![]}];}return db[_0x469f('0x35')][_0x469f('0x4b')](_0x1c2260);})['then'](function(_0x4b9ba2){_0x2aa313['rows']=_0x4b9ba2;return _0x2aa313;})['then'](respondWithFilteredResult(_0x56e115,_0x1c2260))[_0x469f('0x20')](handleError(_0x56e115,null));};exports['show']=function(_0x59197e,_0x59c0f5){var _0x4b6487={'raw':![],'where':{'id':_0x59197e[_0x469f('0x4c')]['id']}},_0x149c5b={};_0x149c5b['model']=_[_0x469f('0x3c')](db[_0x469f('0x35')]['rawAttributes']);_0x149c5b[_0x469f('0x3b')]=_['keys'](_0x59197e[_0x469f('0x3b')]);_0x149c5b[_0x469f('0x3d')]=_[_0x469f('0x3e')](_0x149c5b['model'],_0x149c5b[_0x469f('0x3b')]);_0x4b6487[_0x469f('0x3f')]=_[_0x469f('0x3e')](_0x149c5b[_0x469f('0x3a')],qs[_0x469f('0x40')](_0x59197e[_0x469f('0x3b')]['fields']));_0x4b6487['attributes']=_0x4b6487[_0x469f('0x3f')][_0x469f('0x41')]?_0x4b6487[_0x469f('0x3f')]:_0x149c5b['model'];if(_0x59197e[_0x469f('0x3b')][_0x469f('0x49')]){_0x4b6487['include']=[{'all':!![]}];}_0x4b6487=_[_0x469f('0x48')]({},_0x4b6487,_0x59197e['options']);return db[_0x469f('0x35')][_0x469f('0x4d')](_0x4b6487)[_0x469f('0x16')](handleEntityNotFound(_0x59c0f5,null))[_0x469f('0x16')](respondWithResult(_0x59c0f5,null))[_0x469f('0x20')](handleError(_0x59c0f5,null));};exports[_0x469f('0x4e')]=function(_0x23c327,_0x3f48ae,_0x168d4d){var _0x505f65;return db['VoiceContext'][_0x469f('0x4e')](_0x23c327['body'],{'raw':!![]})[_0x469f('0x16')](function(_0xad3580){_0x505f65=_0xad3580;return db[_0x469f('0x35')][_0x469f('0x4b')]({'raw':!![]});})['then'](function(_0x24ee65){var _0x50ce1c=fs[_0x469f('0x4f')](path[_0x469f('0x50')](config[_0x469f('0x51')],_0x469f('0x52')),_0x469f('0x53'));var _0xf28201=ejs[_0x469f('0x54')](_0x50ce1c,{'contexts':_0x24ee65||[]});fs[_0x469f('0x55')](_0x469f('0x56'),_0xf28201);})[_0x469f('0x16')](function(){return respondWithRpcPromise(_0x469f('0x57'),'create',{'module':_0x469f('0x58')});})[_0x469f('0x16')](function(){var _0x515a81=_0x23c327['user'][_0x469f('0x2e')]({'plain':!![]});if(!_0x515a81)throw new Error(_0x469f('0x59'));if(_0x515a81[_0x469f('0x5a')]==='user'){var _0x21bf9f=_0x505f65[_0x469f('0x2e')]({'plain':!![]});return db[_0x469f('0x5b')]['find']({'where':{'name':'Contexts','userProfileId':_0x515a81[_0x469f('0x5c')]},'raw':!![]})[_0x469f('0x16')](function(_0x2c7562){if(_0x2c7562&&_0x2c7562[_0x469f('0x5d')]===0x0){return db[_0x469f('0x5e')][_0x469f('0x4e')]({'name':_0x21bf9f[_0x469f('0x31')],'resourceId':_0x21bf9f['id'],'type':_0x2c7562[_0x469f('0x31')],'sectionId':_0x2c7562['id']},{})[_0x469f('0x16')](function(){return _0x505f65;});}else{return _0x505f65;}})[_0x469f('0x20')](function(_0x5f13a4){logger[_0x469f('0x1c')](_0x469f('0x5f'),_0x5f13a4);throw _0x5f13a4;});}return _0x505f65;})[_0x469f('0x16')](respondWithResult(_0x3f48ae,0xc9))[_0x469f('0x20')](handleError(_0x3f48ae,null));};exports[_0x469f('0x60')]=function(_0x39d509,_0x25ceea,_0x150bfa){var _0x3e65da;return db[_0x469f('0x35')][_0x469f('0x4d')]({'where':{'id':_0x39d509[_0x469f('0x4c')]['id']}})[_0x469f('0x16')](handleEntityNotFound(_0x25ceea,null))['then'](saveUpdates(_0x39d509[_0x469f('0x61')],null))[_0x469f('0x16')](function(_0x1677b7){if(_0x1677b7){_0x3e65da=_0x1677b7;return db[_0x469f('0x35')][_0x469f('0x4b')]({'raw':!![]});}})[_0x469f('0x16')](function(_0x3986a8){var _0x33f59e=fs['readFileSync'](path[_0x469f('0x50')](config['root'],'server/files/templates/context.ejs'),'utf8');var _0x328d56=ejs[_0x469f('0x54')](_0x33f59e,{'contexts':_0x3986a8||[]});fs[_0x469f('0x55')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x328d56);})[_0x469f('0x16')](function(){return respondWithRpcPromise('Reload',_0x469f('0x60'),{'module':_0x469f('0x58')});})[_0x469f('0x16')](function(){return _0x3e65da;})[_0x469f('0x16')](respondWithResult(_0x25ceea,null))[_0x469f('0x20')](handleError(_0x25ceea,null));};exports[_0x469f('0x30')]=function(_0x526515,_0x635980,_0x13b003){var _0xcfd3b;return db[_0x469f('0x35')]['find']({'where':{'id':_0x526515[_0x469f('0x4c')]['id']}})[_0x469f('0x16')](handleEntityNotFound(_0x635980,null))[_0x469f('0x16')](removeEntity(_0x635980,null))[_0x469f('0x16')](function(){return db[_0x469f('0x35')]['findAll']({'raw':!![]});})[_0x469f('0x16')](function(_0x494b43){var _0x3fd70d=fs['readFileSync'](path[_0x469f('0x50')](config[_0x469f('0x51')],_0x469f('0x52')),_0x469f('0x53'));var _0x4db174=ejs[_0x469f('0x54')](_0x3fd70d,{'contexts':_0x494b43});fs[_0x469f('0x55')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x4db174);return respondWithRpcPromise('Reload',_0x469f('0x30'),{'module':_0x469f('0x58')});})[_0x469f('0x20')](handleError(_0x635980,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index c18893e..af860ff 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 _0x10b3=['../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','moment','bluebird','request-promise','rimraf'];(function(_0x6186a8,_0x5385c4){var _0xf72248=function(_0x2cc46a){while(--_0x2cc46a){_0x6186a8['push'](_0x6186a8['shift']());}};_0xf72248(++_0x5385c4);}(_0x10b3,0xd8));var _0x310b=function(_0x5d4da9,_0x26d19f){_0x5d4da9=_0x5d4da9-0x0;var _0x30d641=_0x10b3[_0x5d4da9];return _0x30d641;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x310b('0x0'));var BPromise=require(_0x310b('0x1'));var rp=require(_0x310b('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x310b('0x3'));var config=require(_0x310b('0x4'));var attributes=require(_0x310b('0x5'));module[_0x310b('0x6')]=function(_0x4aa9bb,_0x2bc981){return _0x4aa9bb[_0x310b('0x7')](_0x310b('0x8'),attributes,{'tableName':_0x310b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe992=['VoiceContext','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./voiceContext.attributes'];(function(_0x4e8742,_0xb21f87){var _0x23afc5=function(_0x32760a){while(--_0x32760a){_0x4e8742['push'](_0x4e8742['shift']());}};_0x23afc5(++_0xb21f87);}(_0xe992,0xf1));var _0x2e99=function(_0x2c41c9,_0x49ea3){_0x2c41c9=_0x2c41c9-0x0;var _0x468382=_0xe992[_0x2c41c9];return _0x468382;};'use strict';var _=require(_0x2e99('0x0'));var util=require(_0x2e99('0x1'));var logger=require(_0x2e99('0x2'))(_0x2e99('0x3'));var moment=require('moment');var BPromise=require(_0x2e99('0x4'));var rp=require(_0x2e99('0x5'));var fs=require('fs');var path=require(_0x2e99('0x6'));var rimraf=require('rimraf');var config=require(_0x2e99('0x7'));var attributes=require(_0x2e99('0x8'));module['exports']=function(_0x4bc8a1,_0x34ea83){return _0x4bc8a1['define'](_0x2e99('0x9'),attributes,{'tableName':'voice_contexts','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 d6ed5ae..87ebc21 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 _0x0de3=['request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x407a37,_0x52d037){var _0x5aacc2=function(_0xfab65c){while(--_0xfab65c){_0x407a37['push'](_0x407a37['shift']());}};_0x5aacc2(++_0x52d037);}(_0x0de3,0x184));var _0x30de=function(_0x49ec16,_0x692a3f){_0x49ec16=_0x49ec16-0x0;var _0x5d16e9=_0x0de3[_0x49ec16];return _0x5d16e9;};'use strict';var _=require(_0x30de('0x0'));var util=require(_0x30de('0x1'));var moment=require('moment');var BPromise=require(_0x30de('0x2'));var rs=require(_0x30de('0x3'));var fs=require('fs');var Redis=require(_0x30de('0x4'));var db=require(_0x30de('0x5'))['db'];var utils=require(_0x30de('0x6'));var logger=require(_0x30de('0x7'))(_0x30de('0x8'));var config=require(_0x30de('0x9'));var jayson=require(_0x30de('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x281b9c,_0x57975e,_0x508d29){return new BPromise(function(_0x4c7de3,_0x2761c2){return client[_0x30de('0xb')](_0x281b9c,_0x508d29)[_0x30de('0xc')](function(_0x929e61){logger['info'](_0x30de('0xd'),_0x57975e,_0x30de('0xe'));logger[_0x30de('0xf')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x57975e,_0x30de('0xe'),JSON[_0x30de('0x10')](_0x929e61));if(_0x929e61[_0x30de('0x11')]){if(_0x929e61[_0x30de('0x11')][_0x30de('0x12')]===0x1f4){logger[_0x30de('0x11')](_0x30de('0xd'),_0x57975e,_0x929e61[_0x30de('0x11')][_0x30de('0x13')]);return _0x2761c2(_0x929e61[_0x30de('0x11')][_0x30de('0x13')]);}logger['error'](_0x30de('0xd'),_0x57975e,_0x929e61[_0x30de('0x11')][_0x30de('0x13')]);return _0x4c7de3(_0x929e61[_0x30de('0x11')]['message']);}else{logger['info'](_0x30de('0xd'),_0x57975e,_0x30de('0xe'));_0x4c7de3(_0x929e61[_0x30de('0x14')]['message']);}})['catch'](function(_0x4a18af){logger[_0x30de('0x11')](_0x30de('0xd'),_0x57975e,_0x4a18af);_0x2761c2(_0x4a18af);});});} \ No newline at end of file +var _0x20df=['debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','VoiceContext,\x20%s,\x20%s'];(function(_0x131acc,_0x10004b){var _0x56edf7=function(_0x42bf8d){while(--_0x42bf8d){_0x131acc['push'](_0x131acc['shift']());}};_0x56edf7(++_0x10004b);}(_0x20df,0x7c));var _0xf20d=function(_0x4ded65,_0xc8d7c1){_0x4ded65=_0x4ded65-0x0;var _0x5864fb=_0x20df[_0x4ded65];return _0x5864fb;};'use strict';var _=require(_0xf20d('0x0'));var util=require(_0xf20d('0x1'));var moment=require(_0xf20d('0x2'));var BPromise=require(_0xf20d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf20d('0x4'));var db=require(_0xf20d('0x5'))['db'];var utils=require(_0xf20d('0x6'));var logger=require(_0xf20d('0x7'))(_0xf20d('0x8'));var config=require('../../config/environment');var jayson=require(_0xf20d('0x9'));var client=jayson['client'][_0xf20d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41d0da,_0x53a7b5,_0x184c8d){return new BPromise(function(_0x5f0353,_0x4f36d1){return client['request'](_0x41d0da,_0x184c8d)[_0xf20d('0xb')](function(_0x22b427){logger[_0xf20d('0xc')](_0xf20d('0xd'),_0x53a7b5,'request\x20sent');logger[_0xf20d('0xe')](_0xf20d('0xf'),_0x53a7b5,_0xf20d('0x10'),JSON[_0xf20d('0x11')](_0x22b427));if(_0x22b427[_0xf20d('0x12')]){if(_0x22b427[_0xf20d('0x12')][_0xf20d('0x13')]===0x1f4){logger[_0xf20d('0x12')]('VoiceContext,\x20%s,\x20%s',_0x53a7b5,_0x22b427[_0xf20d('0x12')]['message']);return _0x4f36d1(_0x22b427[_0xf20d('0x12')][_0xf20d('0x14')]);}logger['error'](_0xf20d('0xd'),_0x53a7b5,_0x22b427[_0xf20d('0x12')][_0xf20d('0x14')]);return _0x5f0353(_0x22b427[_0xf20d('0x12')][_0xf20d('0x14')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x53a7b5,_0xf20d('0x10'));_0x5f0353(_0x22b427[_0xf20d('0x15')][_0xf20d('0x14')]);}})[_0xf20d('0x16')](function(_0x53c164){logger[_0xf20d('0x12')]('VoiceContext,\x20%s,\x20%s',_0x53a7b5,_0x53c164);_0x4f36d1(_0x53c164);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 22f7ffc..86010fd 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 _0xeae7=['put','update','delete','destroy','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xeae7,0xfb));var _0x7eae=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xeae7[_0x5f09c5];return _0x426ad9;};'use strict';var multer=require('multer');var util=require(_0x7eae('0x0'));var path=require('path');var timeout=require(_0x7eae('0x1'));var express=require('express');var router=express[_0x7eae('0x2')]();var fs_extra=require(_0x7eae('0x3'));var auth=require(_0x7eae('0x4'));var interaction=require(_0x7eae('0x5'));var config=require(_0x7eae('0x6'));var controller=require(_0x7eae('0x7'));router[_0x7eae('0x8')]('/',auth[_0x7eae('0x9')](),controller[_0x7eae('0xa')]);router[_0x7eae('0x8')](_0x7eae('0xb'),auth[_0x7eae('0x9')](),controller[_0x7eae('0xc')]);router[_0x7eae('0x8')](_0x7eae('0xd'),auth[_0x7eae('0x9')](),controller[_0x7eae('0xe')]);router['post']('/',auth[_0x7eae('0x9')](),controller['create']);router[_0x7eae('0xf')](_0x7eae('0xd'),auth[_0x7eae('0x9')](),controller[_0x7eae('0x10')]);router[_0x7eae('0x11')](_0x7eae('0xd'),auth[_0x7eae('0x9')](),controller[_0x7eae('0x12')]);module['exports']=router; \ No newline at end of file +var _0x12dc=['multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','index','/describe','isAuthenticated','describe','get','post','create','put','delete','/:id','destroy','exports'];(function(_0x34d8b8,_0x1dd029){var _0x167ad2=function(_0x5a0ed1){while(--_0x5a0ed1){_0x34d8b8['push'](_0x34d8b8['shift']());}};_0x167ad2(++_0x1dd029);}(_0x12dc,0xab));var _0xc12d=function(_0x5d84e7,_0x1d2ac0){_0x5d84e7=_0x5d84e7-0x0;var _0x2e8779=_0x12dc[_0x5d84e7];return _0x2e8779;};'use strict';var multer=require(_0xc12d('0x0'));var util=require(_0xc12d('0x1'));var path=require('path');var timeout=require(_0xc12d('0x2'));var express=require('express');var router=express[_0xc12d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc12d('0x4'));var interaction=require(_0xc12d('0x5'));var config=require('../../config/environment');var controller=require(_0xc12d('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xc12d('0x7')]);router['get'](_0xc12d('0x8'),auth[_0xc12d('0x9')](),controller[_0xc12d('0xa')]);router[_0xc12d('0xb')]('/:id',auth[_0xc12d('0x9')](),controller['show']);router[_0xc12d('0xc')]('/',auth[_0xc12d('0x9')](),controller[_0xc12d('0xd')]);router[_0xc12d('0xe')]('/:id',auth[_0xc12d('0x9')](),controller['update']);router[_0xc12d('0xf')](_0xc12d('0x10'),auth[_0xc12d('0x9')](),controller[_0xc12d('0x11')]);module[_0xc12d('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index b116760..0319c03 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 _0x34e8=['sequelize','exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x2a3a01,_0x444b03){var _0x34a4c7=function(_0x586bf8){while(--_0x586bf8){_0x2a3a01['push'](_0x2a3a01['shift']());}};_0x34a4c7(++_0x444b03);}(_0x34e8,0x12c));var _0x834e=function(_0x20c1bb,_0x547c15){_0x20c1bb=_0x20c1bb-0x0;var _0x29bde3=_0x34e8[_0x20c1bb];return _0x29bde3;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'privilege':{'type':Sequelize[_0x834e('0x2')]},'channel':{'type':Sequelize[_0x834e('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x834e('0x2')]},'calleridnum':{'type':Sequelize[_0x834e('0x2')]},'calleridname':{'type':Sequelize[_0x834e('0x2')]},'connectedlinenum':{'type':Sequelize[_0x834e('0x2')]},'connectedlinename':{'type':Sequelize[_0x834e('0x2')]},'language':{'type':Sequelize[_0x834e('0x2')]},'accountcode':{'type':Sequelize[_0x834e('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x834e('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x834e('0x2')]},'linkedid':{'type':Sequelize[_0x834e('0x2')]},'destchannel':{'type':Sequelize[_0x834e('0x2')]},'destchannelstate':{'type':Sequelize[_0x834e('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x834e('0x2')]},'destcalleridnum':{'type':Sequelize[_0x834e('0x2')]},'destcalleridname':{'type':Sequelize[_0x834e('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x834e('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x834e('0x2')]},'destlanguage':{'type':Sequelize[_0x834e('0x2')]},'destaccountcode':{'type':Sequelize[_0x834e('0x2')]},'destcontext':{'type':Sequelize[_0x834e('0x2')]},'destexten':{'type':Sequelize[_0x834e('0x2')]},'destpriority':{'type':Sequelize[_0x834e('0x3')]},'destuniqueid':{'type':Sequelize[_0x834e('0x2')]},'destlinkedid':{'type':Sequelize[_0x834e('0x2')]},'dialstring':{'type':Sequelize[_0x834e('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x834e('0x4')]},'answertime':{'type':Sequelize[_0x834e('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x834e('0x2')],'comment':_0x834e('0x5')},'routeId':{'type':Sequelize[_0x834e('0x3')]},'duration':{'type':Sequelize[_0x834e('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x834e('0x3')]}}; \ No newline at end of file +var _0xa41a=['exports','STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x18ba4e,_0x3f133b){var _0x42e476=function(_0x3c5083){while(--_0x3c5083){_0x18ba4e['push'](_0x18ba4e['shift']());}};_0x42e476(++_0x3f133b);}(_0xa41a,0x6b));var _0xaa41=function(_0x406d91,_0x24abbc){_0x406d91=_0x406d91-0x0;var _0x1ced0b=_0xa41a[_0x406d91];return _0x1ced0b;};'use strict';var Sequelize=require(_0xaa41('0x0'));module[_0xaa41('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xaa41('0x2')]},'channelstate':{'type':Sequelize[_0xaa41('0x3')]},'channelstatedesc':{'type':Sequelize[_0xaa41('0x2')]},'calleridnum':{'type':Sequelize[_0xaa41('0x2')]},'calleridname':{'type':Sequelize[_0xaa41('0x2')]},'connectedlinenum':{'type':Sequelize[_0xaa41('0x2')]},'connectedlinename':{'type':Sequelize[_0xaa41('0x2')]},'language':{'type':Sequelize[_0xaa41('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xaa41('0x2')]},'exten':{'type':Sequelize[_0xaa41('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xaa41('0x2')]},'destchannel':{'type':Sequelize[_0xaa41('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xaa41('0x2')]},'destcalleridnum':{'type':Sequelize[_0xaa41('0x2')]},'destcalleridname':{'type':Sequelize[_0xaa41('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xaa41('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xaa41('0x2')]},'destlanguage':{'type':Sequelize[_0xaa41('0x2')]},'destaccountcode':{'type':Sequelize[_0xaa41('0x2')]},'destcontext':{'type':Sequelize[_0xaa41('0x2')]},'destexten':{'type':Sequelize[_0xaa41('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xaa41('0x2')]},'destlinkedid':{'type':Sequelize[_0xaa41('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xaa41('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xaa41('0x4')]},'lastevent':{'type':Sequelize[_0xaa41('0x2')],'comment':_0xaa41('0x5')},'routeId':{'type':Sequelize[_0xaa41('0x3')]},'duration':{'type':Sequelize[_0xaa41('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xaa41('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 9848788..453b72c 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 _0x55ce=['params','keys','rawAttributes','find','create','body','catch','describe','eml-format','rimraf','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','name','send','map','VoiceDialReport','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','type','options','includeAll','include','findAll','show'];(function(_0x3da4d4,_0x43fde6){var _0x5be727=function(_0x59b2f3){while(--_0x59b2f3){_0x3da4d4['push'](_0x3da4d4['shift']());}};_0x5be727(++_0x43fde6);}(_0x55ce,0x1b8));var _0xe55c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x55ce[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xe55c('0x0'));var rimraf=require(_0xe55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe55c('0x2'));var moment=require('moment');var BPromise=require(_0xe55c('0x3'));var Mustache=require(_0xe55c('0x4'));var util=require(_0xe55c('0x5'));var path=require('path');var sox=require(_0xe55c('0x6'));var csv=require('to-csv');var ejs=require(_0xe55c('0x7'));var fs=require('fs');var fs_extra=require(_0xe55c('0x8'));var _=require(_0xe55c('0x9'));var squel=require(_0xe55c('0xa'));var crypto=require(_0xe55c('0xb'));var jsforce=require(_0xe55c('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe55c('0xd'));var Redis=require('ioredis');var authService=require(_0xe55c('0xe'));var qs=require(_0xe55c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe55c('0x10'));var logger=require(_0xe55c('0x11'))(_0xe55c('0x12'));var utils=require(_0xe55c('0x13'));var config=require(_0xe55c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xe55c('0x15'))['db'];function respondWithStatusCode(_0x439237,_0x3d3dbb){_0x3d3dbb=_0x3d3dbb||0xcc;return function(_0x4be8ca){if(_0x4be8ca){return _0x439237[_0xe55c('0x16')](_0x3d3dbb);}return _0x439237[_0xe55c('0x17')](_0x3d3dbb)[_0xe55c('0x18')]();};}function respondWithResult(_0x13e21d,_0x22dab1){_0x22dab1=_0x22dab1||0xc8;return function(_0x115490){if(_0x115490){return _0x13e21d['status'](_0x22dab1)[_0xe55c('0x19')](_0x115490);}};}function respondWithFilteredResult(_0x1a41ae,_0x327944){return function(_0x4f34c7){if(_0x4f34c7){var _0x439a75=typeof _0x327944[_0xe55c('0x1a')]===_0xe55c('0x1b')&&typeof _0x327944[_0xe55c('0x1c')]===_0xe55c('0x1b');var _0x4a85bc=_0x4f34c7[_0xe55c('0x1d')];var _0x318c4f=_0x439a75?0x0:_0x327944['offset'];var _0x43d8b8=_0x439a75?_0x4f34c7[_0xe55c('0x1d')]:_0x327944[_0xe55c('0x1a')]+_0x327944[_0xe55c('0x1c')];var _0x1da21a;if(_0x43d8b8>=_0x4a85bc){_0x43d8b8=_0x4a85bc;_0x1da21a=0xc8;}else{_0x1da21a=0xce;}_0x1a41ae[_0xe55c('0x17')](_0x1da21a);return _0x1a41ae[_0xe55c('0x1e')]('Content-Range',_0x318c4f+'-'+_0x43d8b8+'/'+_0x4a85bc)[_0xe55c('0x19')](_0x4f34c7);}return null;};}function patchUpdates(_0xb7c370){return function(_0x3f3592){try{jsonpatch[_0xe55c('0x1f')](_0x3f3592,_0xb7c370,!![]);}catch(_0xf63d39){return BPromise[_0xe55c('0x20')](_0xf63d39);}return _0x3f3592[_0xe55c('0x21')]();};}function saveUpdates(_0x4edba0,_0x31094c){return function(_0x5d0ebb){if(_0x5d0ebb){return _0x5d0ebb[_0xe55c('0x22')](_0x4edba0)['then'](function(_0x508859){return _0x508859;});}return null;};}function removeEntity(_0x553091,_0x2180fc){return function(_0xa71334){if(_0xa71334){return _0xa71334[_0xe55c('0x23')]()[_0xe55c('0x24')](function(){_0x553091[_0xe55c('0x17')](0xcc)[_0xe55c('0x18')]();});}};}function handleEntityNotFound(_0x195ac0,_0x1c2aaa){return function(_0x31cf5d){if(!_0x31cf5d){_0x195ac0[_0xe55c('0x16')](0x194);}return _0x31cf5d;};}function handleError(_0x3b69c8,_0x22b847){_0x22b847=_0x22b847||0x1f4;return function(_0x241bad){logger[_0xe55c('0x25')](_0x241bad['stack']);if(_0x241bad[_0xe55c('0x26')]){delete _0x241bad[_0xe55c('0x26')];}_0x3b69c8['status'](_0x22b847)[_0xe55c('0x27')](_0x241bad);};}exports['index']=function(_0x515aaf,_0x479c47){var _0x239a5f={},_0x3f37e2={},_0x5bc9a7={'count':0x0,'rows':[]};var _0x3fcaf9=_[_0xe55c('0x28')](db[_0xe55c('0x29')]['rawAttributes'],function(_0x2a6e01){return{'name':_0x2a6e01[_0xe55c('0x2a')],'type':_0x2a6e01['type'][_0xe55c('0x2b')]};});_0x3f37e2[_0xe55c('0x2c')]=_[_0xe55c('0x28')](_0x3fcaf9,_0xe55c('0x26'));_0x3f37e2[_0xe55c('0x2d')]=_['keys'](_0x515aaf[_0xe55c('0x2d')]);_0x3f37e2['filters']=_[_0xe55c('0x2e')](_0x3f37e2[_0xe55c('0x2c')],_0x3f37e2['query']);_0x239a5f[_0xe55c('0x2f')]=_[_0xe55c('0x2e')](_0x3f37e2[_0xe55c('0x2c')],qs[_0xe55c('0x30')](_0x515aaf[_0xe55c('0x2d')]['fields']));_0x239a5f['attributes']=_0x239a5f[_0xe55c('0x2f')][_0xe55c('0x31')]?_0x239a5f[_0xe55c('0x2f')]:_0x3f37e2[_0xe55c('0x2c')];if(!_0x515aaf[_0xe55c('0x2d')][_0xe55c('0x32')]('nolimit')){_0x239a5f[_0xe55c('0x1c')]=qs['limit'](_0x515aaf[_0xe55c('0x2d')][_0xe55c('0x1c')]);_0x239a5f[_0xe55c('0x1a')]=qs[_0xe55c('0x1a')](_0x515aaf[_0xe55c('0x2d')][_0xe55c('0x1a')]);}_0x239a5f[_0xe55c('0x33')]=qs[_0xe55c('0x34')](_0x515aaf[_0xe55c('0x2d')][_0xe55c('0x34')]);_0x239a5f[_0xe55c('0x35')]=qs['filters'](_[_0xe55c('0x36')](_0x515aaf[_0xe55c('0x2d')],_0x3f37e2[_0xe55c('0x37')]),_0x3fcaf9);if(_0x515aaf['query'][_0xe55c('0x38')]){_0x239a5f[_0xe55c('0x35')]=_[_0xe55c('0x39')](_0x239a5f[_0xe55c('0x35')],{'$or':_['map'](_0x3fcaf9,function(_0x37811f){if(_0x37811f[_0xe55c('0x3a')]!=='VIRTUAL'){var _0x39efa3={};_0x39efa3[_0x37811f[_0xe55c('0x26')]]={'$like':'%'+_0x515aaf[_0xe55c('0x2d')]['filter']+'%'};return _0x39efa3;}})});}_0x239a5f=_[_0xe55c('0x39')]({},_0x239a5f,_0x515aaf[_0xe55c('0x3b')]);var _0x5dbcbd={'where':_0x239a5f[_0xe55c('0x35')]};return db[_0xe55c('0x29')][_0xe55c('0x1d')](_0x5dbcbd)[_0xe55c('0x24')](function(_0x1b26de){_0x5bc9a7['count']=_0x1b26de;if(_0x515aaf['query'][_0xe55c('0x3c')]){_0x239a5f[_0xe55c('0x3d')]=[{'all':!![]}];}return db[_0xe55c('0x29')][_0xe55c('0x3e')](_0x239a5f);})[_0xe55c('0x24')](function(_0x35a09b){_0x5bc9a7['rows']=_0x35a09b;return _0x5bc9a7;})[_0xe55c('0x24')](respondWithFilteredResult(_0x479c47,_0x239a5f))['catch'](handleError(_0x479c47,null));};exports[_0xe55c('0x3f')]=function(_0x147708,_0x56cfa4){var _0x397551={'raw':!![],'where':{'id':_0x147708[_0xe55c('0x40')]['id']}},_0x4aefc6={};_0x4aefc6[_0xe55c('0x2c')]=_[_0xe55c('0x41')](db[_0xe55c('0x29')][_0xe55c('0x42')]);_0x4aefc6[_0xe55c('0x2d')]=_[_0xe55c('0x41')](_0x147708[_0xe55c('0x2d')]);_0x4aefc6[_0xe55c('0x37')]=_[_0xe55c('0x2e')](_0x4aefc6[_0xe55c('0x2c')],_0x4aefc6[_0xe55c('0x2d')]);_0x397551['attributes']=_[_0xe55c('0x2e')](_0x4aefc6[_0xe55c('0x2c')],qs[_0xe55c('0x30')](_0x147708[_0xe55c('0x2d')][_0xe55c('0x30')]));_0x397551[_0xe55c('0x2f')]=_0x397551[_0xe55c('0x2f')][_0xe55c('0x31')]?_0x397551[_0xe55c('0x2f')]:_0x4aefc6[_0xe55c('0x2c')];if(_0x147708[_0xe55c('0x2d')][_0xe55c('0x3c')]){_0x397551[_0xe55c('0x3d')]=[{'all':!![]}];}_0x397551=_[_0xe55c('0x39')]({},_0x397551,_0x147708['options']);return db[_0xe55c('0x29')][_0xe55c('0x43')](_0x397551)[_0xe55c('0x24')](handleEntityNotFound(_0x56cfa4,null))['then'](respondWithResult(_0x56cfa4,null))['catch'](handleError(_0x56cfa4,null));};exports[_0xe55c('0x44')]=function(_0x188ee9,_0x396541){return db['VoiceDialReport'][_0xe55c('0x44')](_0x188ee9[_0xe55c('0x45')],{})[_0xe55c('0x24')](respondWithResult(_0x396541,0xc9))[_0xe55c('0x46')](handleError(_0x396541,null));};exports[_0xe55c('0x22')]=function(_0x2acea7,_0x493999){if(_0x2acea7[_0xe55c('0x45')]['id']){delete _0x2acea7[_0xe55c('0x45')]['id'];}return db['VoiceDialReport'][_0xe55c('0x43')]({'where':{'id':_0x2acea7[_0xe55c('0x40')]['id']}})['then'](handleEntityNotFound(_0x493999,null))['then'](saveUpdates(_0x2acea7[_0xe55c('0x45')],null))['then'](respondWithResult(_0x493999,null))['catch'](handleError(_0x493999,null));};exports['destroy']=function(_0xdd42b4,_0x1e4f0e){return db[_0xe55c('0x29')][_0xe55c('0x43')]({'where':{'id':_0xdd42b4[_0xe55c('0x40')]['id']}})[_0xe55c('0x24')](handleEntityNotFound(_0x1e4f0e,null))[_0xe55c('0x24')](removeEntity(_0x1e4f0e,null))['catch'](handleError(_0x1e4f0e,null));};exports[_0xe55c('0x47')]=function(_0x1c42e8,_0x3c9a64){return db[_0xe55c('0x29')][_0xe55c('0x47')]()['then'](respondWithResult(_0x3c9a64,null))['catch'](handleError(_0x3c9a64,null));}; \ No newline at end of file +var _0xb183=['set','reject','save','then','destroy','error','stack','name','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','filters','filter','where','merge','map','options','includeAll','include','VoiceDialReport','findAll','rows','catch','show','params','find','create','update','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','offset','limit','count'];(function(_0x2d2b20,_0x3ade9a){var _0x574236=function(_0x45db68){while(--_0x45db68){_0x2d2b20['push'](_0x2d2b20['shift']());}};_0x574236(++_0x3ade9a);}(_0xb183,0xb4));var _0x3b18=function(_0x140838,_0x580157){_0x140838=_0x140838-0x0;var _0xd2c0ab=_0xb183[_0x140838];return _0xd2c0ab;};'use strict';var emlformat=require(_0x3b18('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3b18('0x1'));var jsonpatch=require(_0x3b18('0x2'));var rp=require(_0x3b18('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3b18('0x4'));var util=require(_0x3b18('0x5'));var path=require(_0x3b18('0x6'));var sox=require(_0x3b18('0x7'));var csv=require(_0x3b18('0x8'));var ejs=require(_0x3b18('0x9'));var fs=require('fs');var fs_extra=require(_0x3b18('0xa'));var _=require(_0x3b18('0xb'));var squel=require(_0x3b18('0xc'));var crypto=require(_0x3b18('0xd'));var jsforce=require(_0x3b18('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3b18('0x8'));var querystring=require(_0x3b18('0xf'));var Papa=require('papaparse');var Redis=require(_0x3b18('0x10'));var authService=require(_0x3b18('0x11'));var qs=require(_0x3b18('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3b18('0x13'));var logger=require(_0x3b18('0x14'))(_0x3b18('0x15'));var utils=require(_0x3b18('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3b18('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29fe83,_0x325ec8){_0x325ec8=_0x325ec8||0xcc;return function(_0x40ce52){if(_0x40ce52){return _0x29fe83[_0x3b18('0x18')](_0x325ec8);}return _0x29fe83['status'](_0x325ec8)[_0x3b18('0x19')]();};}function respondWithResult(_0x5679d3,_0x545b60){_0x545b60=_0x545b60||0xc8;return function(_0x5b23b2){if(_0x5b23b2){return _0x5679d3[_0x3b18('0x1a')](_0x545b60)['json'](_0x5b23b2);}};}function respondWithFilteredResult(_0x5a6608,_0x36b738){return function(_0x3d8e6b){if(_0x3d8e6b){var _0x70564b=typeof _0x36b738[_0x3b18('0x1b')]==='undefined'&&typeof _0x36b738[_0x3b18('0x1c')]==='undefined';var _0x1dda8e=_0x3d8e6b[_0x3b18('0x1d')];var _0x36bae6=_0x70564b?0x0:_0x36b738[_0x3b18('0x1b')];var _0xd92b82=_0x70564b?_0x3d8e6b['count']:_0x36b738['offset']+_0x36b738[_0x3b18('0x1c')];var _0x123e0a;if(_0xd92b82>=_0x1dda8e){_0xd92b82=_0x1dda8e;_0x123e0a=0xc8;}else{_0x123e0a=0xce;}_0x5a6608['status'](_0x123e0a);return _0x5a6608[_0x3b18('0x1e')]('Content-Range',_0x36bae6+'-'+_0xd92b82+'/'+_0x1dda8e)['json'](_0x3d8e6b);}return null;};}function patchUpdates(_0x204ef0){return function(_0x46d265){try{jsonpatch['apply'](_0x46d265,_0x204ef0,!![]);}catch(_0x2c191e){return BPromise[_0x3b18('0x1f')](_0x2c191e);}return _0x46d265[_0x3b18('0x20')]();};}function saveUpdates(_0x54e30a,_0x30f58a){return function(_0x387273){if(_0x387273){return _0x387273['update'](_0x54e30a)[_0x3b18('0x21')](function(_0xcb4bf8){return _0xcb4bf8;});}return null;};}function removeEntity(_0xc72b7e,_0x4426b7){return function(_0x5b34c6){if(_0x5b34c6){return _0x5b34c6[_0x3b18('0x22')]()['then'](function(){_0xc72b7e['status'](0xcc)[_0x3b18('0x19')]();});}};}function handleEntityNotFound(_0x4d5a10,_0x3cdf55){return function(_0x5f4cf2){if(!_0x5f4cf2){_0x4d5a10[_0x3b18('0x18')](0x194);}return _0x5f4cf2;};}function handleError(_0x246b16,_0x22ce48){_0x22ce48=_0x22ce48||0x1f4;return function(_0x1d2cda){logger[_0x3b18('0x23')](_0x1d2cda[_0x3b18('0x24')]);if(_0x1d2cda[_0x3b18('0x25')]){delete _0x1d2cda[_0x3b18('0x25')];}_0x246b16[_0x3b18('0x1a')](_0x22ce48)['send'](_0x1d2cda);};}exports['index']=function(_0x5583e8,_0x4b5f57){var _0x3fb73a={},_0xf69c8f={},_0x3cb75d={'count':0x0,'rows':[]};var _0x15ffbe=_['map'](db['VoiceDialReport'][_0x3b18('0x26')],function(_0x4c0e8d){return{'name':_0x4c0e8d[_0x3b18('0x27')],'type':_0x4c0e8d[_0x3b18('0x28')][_0x3b18('0x29')]};});_0xf69c8f['model']=_['map'](_0x15ffbe,_0x3b18('0x25'));_0xf69c8f[_0x3b18('0x2a')]=_[_0x3b18('0x2b')](_0x5583e8[_0x3b18('0x2a')]);_0xf69c8f['filters']=_[_0x3b18('0x2c')](_0xf69c8f[_0x3b18('0x2d')],_0xf69c8f[_0x3b18('0x2a')]);_0x3fb73a[_0x3b18('0x2e')]=_['intersection'](_0xf69c8f[_0x3b18('0x2d')],qs[_0x3b18('0x2f')](_0x5583e8[_0x3b18('0x2a')][_0x3b18('0x2f')]));_0x3fb73a['attributes']=_0x3fb73a['attributes'][_0x3b18('0x30')]?_0x3fb73a[_0x3b18('0x2e')]:_0xf69c8f[_0x3b18('0x2d')];if(!_0x5583e8[_0x3b18('0x2a')][_0x3b18('0x31')](_0x3b18('0x32'))){_0x3fb73a['limit']=qs[_0x3b18('0x1c')](_0x5583e8[_0x3b18('0x2a')][_0x3b18('0x1c')]);_0x3fb73a[_0x3b18('0x1b')]=qs[_0x3b18('0x1b')](_0x5583e8['query'][_0x3b18('0x1b')]);}_0x3fb73a['order']=qs['sort'](_0x5583e8[_0x3b18('0x2a')]['sort']);_0x3fb73a['where']=qs['filters'](_['pick'](_0x5583e8[_0x3b18('0x2a')],_0xf69c8f[_0x3b18('0x33')]),_0x15ffbe);if(_0x5583e8[_0x3b18('0x2a')][_0x3b18('0x34')]){_0x3fb73a[_0x3b18('0x35')]=_[_0x3b18('0x36')](_0x3fb73a['where'],{'$or':_[_0x3b18('0x37')](_0x15ffbe,function(_0x114133){if(_0x114133['type']!=='VIRTUAL'){var _0x520eab={};_0x520eab[_0x114133['name']]={'$like':'%'+_0x5583e8['query'][_0x3b18('0x34')]+'%'};return _0x520eab;}})});}_0x3fb73a=_['merge']({},_0x3fb73a,_0x5583e8[_0x3b18('0x38')]);var _0x3e5460={'where':_0x3fb73a[_0x3b18('0x35')]};return db['VoiceDialReport'][_0x3b18('0x1d')](_0x3e5460)['then'](function(_0xfaf205){_0x3cb75d[_0x3b18('0x1d')]=_0xfaf205;if(_0x5583e8[_0x3b18('0x2a')][_0x3b18('0x39')]){_0x3fb73a[_0x3b18('0x3a')]=[{'all':!![]}];}return db[_0x3b18('0x3b')][_0x3b18('0x3c')](_0x3fb73a);})[_0x3b18('0x21')](function(_0x1b648b){_0x3cb75d[_0x3b18('0x3d')]=_0x1b648b;return _0x3cb75d;})[_0x3b18('0x21')](respondWithFilteredResult(_0x4b5f57,_0x3fb73a))[_0x3b18('0x3e')](handleError(_0x4b5f57,null));};exports[_0x3b18('0x3f')]=function(_0x222c0a,_0x1fe7ae){var _0x1146c9={'raw':!![],'where':{'id':_0x222c0a[_0x3b18('0x40')]['id']}},_0x16784a={};_0x16784a['model']=_[_0x3b18('0x2b')](db['VoiceDialReport'][_0x3b18('0x26')]);_0x16784a['query']=_[_0x3b18('0x2b')](_0x222c0a[_0x3b18('0x2a')]);_0x16784a[_0x3b18('0x33')]=_[_0x3b18('0x2c')](_0x16784a['model'],_0x16784a['query']);_0x1146c9[_0x3b18('0x2e')]=_['intersection'](_0x16784a[_0x3b18('0x2d')],qs[_0x3b18('0x2f')](_0x222c0a[_0x3b18('0x2a')]['fields']));_0x1146c9[_0x3b18('0x2e')]=_0x1146c9[_0x3b18('0x2e')][_0x3b18('0x30')]?_0x1146c9[_0x3b18('0x2e')]:_0x16784a[_0x3b18('0x2d')];if(_0x222c0a[_0x3b18('0x2a')][_0x3b18('0x39')]){_0x1146c9[_0x3b18('0x3a')]=[{'all':!![]}];}_0x1146c9=_[_0x3b18('0x36')]({},_0x1146c9,_0x222c0a[_0x3b18('0x38')]);return db['VoiceDialReport'][_0x3b18('0x41')](_0x1146c9)[_0x3b18('0x21')](handleEntityNotFound(_0x1fe7ae,null))['then'](respondWithResult(_0x1fe7ae,null))[_0x3b18('0x3e')](handleError(_0x1fe7ae,null));};exports[_0x3b18('0x42')]=function(_0x368f6c,_0x1f7422){return db[_0x3b18('0x3b')][_0x3b18('0x42')](_0x368f6c['body'],{})['then'](respondWithResult(_0x1f7422,0xc9))['catch'](handleError(_0x1f7422,null));};exports[_0x3b18('0x43')]=function(_0x48dcc9,_0x2ebc05){if(_0x48dcc9[_0x3b18('0x44')]['id']){delete _0x48dcc9[_0x3b18('0x44')]['id'];}return db['VoiceDialReport'][_0x3b18('0x41')]({'where':{'id':_0x48dcc9[_0x3b18('0x40')]['id']}})[_0x3b18('0x21')](handleEntityNotFound(_0x2ebc05,null))[_0x3b18('0x21')](saveUpdates(_0x48dcc9[_0x3b18('0x44')],null))[_0x3b18('0x21')](respondWithResult(_0x2ebc05,null))[_0x3b18('0x3e')](handleError(_0x2ebc05,null));};exports['destroy']=function(_0x138d7e,_0x43318f){return db[_0x3b18('0x3b')]['find']({'where':{'id':_0x138d7e[_0x3b18('0x40')]['id']}})[_0x3b18('0x21')](handleEntityNotFound(_0x43318f,null))[_0x3b18('0x21')](removeEntity(_0x43318f,null))['catch'](handleError(_0x43318f,null));};exports[_0x3b18('0x45')]=function(_0x4edc2d,_0x4b35c1){return db[_0x3b18('0x3b')]['describe']()[_0x3b18('0x21')](respondWithResult(_0x4b35c1,null))[_0x3b18('0x3e')](handleError(_0x4b35c1,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index c8f0231..01a6400 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 _0x372b=['report_dial','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./voiceDialReport.attributes','exports','define','VoiceDialReport'];(function(_0x18b826,_0x1bedc1){var _0x18c535=function(_0x45ea6d){while(--_0x45ea6d){_0x18b826['push'](_0x18b826['shift']());}};_0x18c535(++_0x1bedc1);}(_0x372b,0x18a));var _0xb372=function(_0x1f2835,_0x197147){_0x1f2835=_0x1f2835-0x0;var _0x249d15=_0x372b[_0x1f2835];return _0x249d15;};'use strict';var _=require(_0xb372('0x0'));var util=require(_0xb372('0x1'));var logger=require('../../config/logger')(_0xb372('0x2'));var moment=require(_0xb372('0x3'));var BPromise=require(_0xb372('0x4'));var rp=require(_0xb372('0x5'));var fs=require('fs');var path=require(_0xb372('0x6'));var rimraf=require(_0xb372('0x7'));var config=require('../../config/environment');var attributes=require(_0xb372('0x8'));module[_0xb372('0x9')]=function(_0xa1eefa,_0x5c8510){return _0xa1eefa[_0xb372('0xa')](_0xb372('0xb'),attributes,{'tableName':_0xb372('0xc'),'paranoid':![],'indexes':[{'fields':[_0xb372('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x138c=['define','VoiceDialReport','report_dial','uniqueid','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes'];(function(_0x13022d,_0x48314b){var _0x516a78=function(_0x390757){while(--_0x390757){_0x13022d['push'](_0x13022d['shift']());}};_0x516a78(++_0x48314b);}(_0x138c,0x13c));var _0xc138=function(_0x5f1d4e,_0x49e073){_0x5f1d4e=_0x5f1d4e-0x0;var _0x5f2e8b=_0x138c[_0x5f1d4e];return _0x5f2e8b;};'use strict';var _=require('lodash');var util=require(_0xc138('0x0'));var logger=require(_0xc138('0x1'))(_0xc138('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc138('0x3'));var fs=require('fs');var path=require(_0xc138('0x4'));var rimraf=require(_0xc138('0x5'));var config=require(_0xc138('0x6'));var attributes=require(_0xc138('0x7'));module['exports']=function(_0x2b92dd,_0x25dfc9){return _0x2b92dd[_0xc138('0x8')](_0xc138('0x9'),attributes,{'tableName':_0xc138('0xa'),'paranoid':![],'indexes':[{'fields':[_0xc138('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 32d230d..f263d0e 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 _0x622d=['error','code','VoiceDialReport,\x20%s,\x20%s','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','UpdateVoiceDialReport','update','raw','where','limit','stringify','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s'];(function(_0x38fd0b,_0x156f8a){var _0x3a53b9=function(_0x399a59){while(--_0x399a59){_0x38fd0b['push'](_0x38fd0b['shift']());}};_0x3a53b9(++_0x156f8a);}(_0x622d,0x1f1));var _0xd622=function(_0x8739f5,_0x55a924){_0x8739f5=_0x8739f5-0x0;var _0x403a42=_0x622d[_0x8739f5];return _0x403a42;};'use strict';var _=require(_0xd622('0x0'));var util=require(_0xd622('0x1'));var moment=require(_0xd622('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd622('0x3'));var db=require(_0xd622('0x4'))['db'];var utils=require(_0xd622('0x5'));var logger=require(_0xd622('0x6'))('rpc');var config=require(_0xd622('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd622('0x8')][_0xd622('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xacfa1c,_0x307270,_0x3518be){return new BPromise(function(_0x472265,_0x4e6979){return client['request'](_0xacfa1c,_0x3518be)[_0xd622('0xa')](function(_0x1ce629){logger[_0xd622('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x307270,_0xd622('0xc'));logger[_0xd622('0xd')](_0xd622('0xe'),_0x307270,'request\x20sent',JSON['stringify'](_0x1ce629));if(_0x1ce629[_0xd622('0xf')]){if(_0x1ce629[_0xd622('0xf')][_0xd622('0x10')]===0x1f4){logger[_0xd622('0xf')](_0xd622('0x11'),_0x307270,_0x1ce629[_0xd622('0xf')][_0xd622('0x12')]);return _0x4e6979(_0x1ce629['error'][_0xd622('0x12')]);}logger[_0xd622('0xf')](_0xd622('0x11'),_0x307270,_0x1ce629[_0xd622('0xf')][_0xd622('0x12')]);return _0x472265(_0x1ce629[_0xd622('0xf')][_0xd622('0x12')]);}else{logger[_0xd622('0xb')](_0xd622('0x11'),_0x307270,_0xd622('0xc'));_0x472265(_0x1ce629[_0xd622('0x13')][_0xd622('0x12')]);}})[_0xd622('0x14')](function(_0x11bd30){logger[_0xd622('0xf')](_0xd622('0x11'),_0x307270,_0x11bd30);_0x4e6979(_0x11bd30);});});}exports[_0xd622('0x15')]=function(_0x562439){var _0x347964=this;return new Promise(function(_0xd52d6,_0x1866b7){return db[_0xd622('0x16')][_0xd622('0x17')](_0x562439[_0xd622('0x18')],{'raw':_0x562439['options']?_0x562439[_0xd622('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xd622('0xa')](function(_0x33e45e){logger['info']('CreateVoiceDialReport',_0x562439);logger['debug'](_0xd622('0x15'),_0x562439,JSON['stringify'](_0x33e45e));_0xd52d6(_0x33e45e);})[_0xd622('0x14')](function(_0x189a26){logger[_0xd622('0xf')]('CreateVoiceDialReport',_0x189a26[_0xd622('0x12')],_0x562439);_0x1866b7(_0x347964[_0xd622('0xf')](0x1f4,_0x189a26['message']));});});};exports[_0xd622('0x1a')]=function(_0xc5982f){var _0x2248e2=this;return new Promise(function(_0x5a1368,_0x44c6f5){return db[_0xd622('0x16')][_0xd622('0x1b')](_0xc5982f[_0xd622('0x18')],{'raw':_0xc5982f[_0xd622('0x19')]?_0xc5982f['options'][_0xd622('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc5982f[_0xd622('0x19')]?_0xc5982f[_0xd622('0x19')][_0xd622('0x1d')]||null:null,'attributes':_0xc5982f['options']?_0xc5982f[_0xd622('0x19')]['attributes']||null:null,'limit':_0xc5982f['options']?_0xc5982f[_0xd622('0x19')][_0xd622('0x1e')]||null:null})[_0xd622('0xa')](function(_0x5e9ab){logger[_0xd622('0xb')](_0xd622('0x1a'),_0xc5982f);logger[_0xd622('0xd')]('UpdateVoiceDialReport',_0xc5982f,JSON[_0xd622('0x1f')](_0x5e9ab));_0x5a1368(_0x5e9ab);})[_0xd622('0x14')](function(_0x11b26b){logger[_0xd622('0xf')](_0xd622('0x1a'),_0x11b26b['message'],_0xc5982f);_0x44c6f5(_0x2248e2[_0xd622('0xf')](0x1f4,_0x11b26b[_0xd622('0x12')]));});});}; \ No newline at end of file +var _0xeb5f=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','UpdateVoiceDialReport','update','raw','where','attributes','limit','lodash'];(function(_0x1614c2,_0x1fccfc){var _0x182c4c=function(_0x19c361){while(--_0x19c361){_0x1614c2['push'](_0x1614c2['shift']());}};_0x182c4c(++_0x1fccfc);}(_0xeb5f,0x143));var _0xfeb5=function(_0x2caf72,_0x3c9bdd){_0x2caf72=_0x2caf72-0x0;var _0x1b71a2=_0xeb5f[_0x2caf72];return _0x1b71a2;};'use strict';var _=require(_0xfeb5('0x0'));var util=require(_0xfeb5('0x1'));var moment=require(_0xfeb5('0x2'));var BPromise=require('bluebird');var rs=require(_0xfeb5('0x3'));var fs=require('fs');var Redis=require(_0xfeb5('0x4'));var db=require(_0xfeb5('0x5'))['db'];var utils=require(_0xfeb5('0x6'));var logger=require(_0xfeb5('0x7'))(_0xfeb5('0x8'));var config=require(_0xfeb5('0x9'));var jayson=require(_0xfeb5('0xa'));var client=jayson[_0xfeb5('0xb')][_0xfeb5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x26874e,_0x3b764c,_0x16b429){return new BPromise(function(_0x50e6b1,_0x5b38c1){return client[_0xfeb5('0xd')](_0x26874e,_0x16b429)[_0xfeb5('0xe')](function(_0x502fab){logger[_0xfeb5('0xf')](_0xfeb5('0x10'),_0x3b764c,_0xfeb5('0x11'));logger[_0xfeb5('0x12')](_0xfeb5('0x13'),_0x3b764c,_0xfeb5('0x11'),JSON[_0xfeb5('0x14')](_0x502fab));if(_0x502fab[_0xfeb5('0x15')]){if(_0x502fab[_0xfeb5('0x15')][_0xfeb5('0x16')]===0x1f4){logger[_0xfeb5('0x15')](_0xfeb5('0x10'),_0x3b764c,_0x502fab['error'][_0xfeb5('0x17')]);return _0x5b38c1(_0x502fab[_0xfeb5('0x15')][_0xfeb5('0x17')]);}logger[_0xfeb5('0x15')]('VoiceDialReport,\x20%s,\x20%s',_0x3b764c,_0x502fab[_0xfeb5('0x15')][_0xfeb5('0x17')]);return _0x50e6b1(_0x502fab[_0xfeb5('0x15')][_0xfeb5('0x17')]);}else{logger[_0xfeb5('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x3b764c,'request\x20sent');_0x50e6b1(_0x502fab['result'][_0xfeb5('0x17')]);}})[_0xfeb5('0x18')](function(_0x3ec7f3){logger[_0xfeb5('0x15')](_0xfeb5('0x10'),_0x3b764c,_0x3ec7f3);_0x5b38c1(_0x3ec7f3);});});}exports[_0xfeb5('0x19')]=function(_0x38d9e3){var _0x4662ae=this;return new Promise(function(_0xd19b3b,_0x2a22da){return db[_0xfeb5('0x1a')][_0xfeb5('0x1b')](_0x38d9e3[_0xfeb5('0x1c')],{'raw':_0x38d9e3[_0xfeb5('0x1d')]?_0x38d9e3[_0xfeb5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xfeb5('0xe')](function(_0x29be8b){logger[_0xfeb5('0xf')](_0xfeb5('0x19'),_0x38d9e3);logger[_0xfeb5('0x12')](_0xfeb5('0x19'),_0x38d9e3,JSON[_0xfeb5('0x14')](_0x29be8b));_0xd19b3b(_0x29be8b);})[_0xfeb5('0x18')](function(_0x44b26f){logger[_0xfeb5('0x15')](_0xfeb5('0x19'),_0x44b26f[_0xfeb5('0x17')],_0x38d9e3);_0x2a22da(_0x4662ae[_0xfeb5('0x15')](0x1f4,_0x44b26f[_0xfeb5('0x17')]));});});};exports[_0xfeb5('0x1e')]=function(_0x2e8f20){var _0xd339b8=this;return new Promise(function(_0x283abd,_0xbc6b8c){return db[_0xfeb5('0x1a')][_0xfeb5('0x1f')](_0x2e8f20[_0xfeb5('0x1c')],{'raw':_0x2e8f20[_0xfeb5('0x1d')]?_0x2e8f20[_0xfeb5('0x1d')][_0xfeb5('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e8f20[_0xfeb5('0x1d')]?_0x2e8f20[_0xfeb5('0x1d')][_0xfeb5('0x21')]||null:null,'attributes':_0x2e8f20[_0xfeb5('0x1d')]?_0x2e8f20['options'][_0xfeb5('0x22')]||null:null,'limit':_0x2e8f20[_0xfeb5('0x1d')]?_0x2e8f20[_0xfeb5('0x1d')][_0xfeb5('0x23')]||null:null})[_0xfeb5('0xe')](function(_0x4b9865){logger['info'](_0xfeb5('0x1e'),_0x2e8f20);logger[_0xfeb5('0x12')](_0xfeb5('0x1e'),_0x2e8f20,JSON['stringify'](_0x4b9865));_0x283abd(_0x4b9865);})[_0xfeb5('0x18')](function(_0x55d280){logger[_0xfeb5('0x15')]('UpdateVoiceDialReport',_0x55d280[_0xfeb5('0x17')],_0x2e8f20);_0xbc6b8c(_0xd339b8[_0xfeb5('0x15')](0x1f4,_0x55d280[_0xfeb5('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 46e8db6..f262a7a 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 _0xa993=['/:id','isAuthenticated','show','post','create','/:id/applications','addApplications','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get'];(function(_0x1be002,_0x5e6a32){var _0x5b7137=function(_0x36df15){while(--_0x36df15){_0x1be002['push'](_0x1be002['shift']());}};_0x5b7137(++_0x5e6a32);}(_0xa993,0x90));var _0x3a99=function(_0x5533a4,_0x3df7b5){_0x5533a4=_0x5533a4-0x0;var _0x28136a=_0xa993[_0x5533a4];return _0x28136a;};'use strict';var multer=require(_0x3a99('0x0'));var util=require(_0x3a99('0x1'));var path=require('path');var timeout=require(_0x3a99('0x2'));var express=require(_0x3a99('0x3'));var router=express[_0x3a99('0x4')]();var fs_extra=require(_0x3a99('0x5'));var auth=require(_0x3a99('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3a99('0x7'));var controller=require('./voiceExtension.controller');router[_0x3a99('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3a99('0x8')](_0x3a99('0x9'),auth[_0x3a99('0xa')](),controller[_0x3a99('0xb')]);router[_0x3a99('0xc')]('/',auth[_0x3a99('0xa')](),controller[_0x3a99('0xd')]);router['post'](_0x3a99('0xe'),auth[_0x3a99('0xa')](),controller[_0x3a99('0xf')]);router['put'](_0x3a99('0x9'),auth[_0x3a99('0xa')](),controller['update']);router['delete'](_0x3a99('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x3a99('0x10')]=router; \ No newline at end of file +var _0x9aab=['show','post','/:id/applications','addApplications','delete','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id'];(function(_0x3d8243,_0x431106){var _0x140fb4=function(_0x1bde1f){while(--_0x1bde1f){_0x3d8243['push'](_0x3d8243['shift']());}};_0x140fb4(++_0x431106);}(_0x9aab,0x1b6));var _0xb9aa=function(_0x3117f9,_0x28684b){_0x3117f9=_0x3117f9-0x0;var _0x1ff84a=_0x9aab[_0x3117f9];return _0x1ff84a;};'use strict';var multer=require('multer');var util=require(_0xb9aa('0x0'));var path=require(_0xb9aa('0x1'));var timeout=require(_0xb9aa('0x2'));var express=require('express');var router=express[_0xb9aa('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb9aa('0x4'));var interaction=require(_0xb9aa('0x5'));var config=require(_0xb9aa('0x6'));var controller=require(_0xb9aa('0x7'));router[_0xb9aa('0x8')]('/',auth[_0xb9aa('0x9')](),controller[_0xb9aa('0xa')]);router['get'](_0xb9aa('0xb'),auth['isAuthenticated'](),controller[_0xb9aa('0xc')]);router[_0xb9aa('0xd')]('/',auth[_0xb9aa('0x9')](),controller['create']);router['post'](_0xb9aa('0xe'),auth[_0xb9aa('0x9')](),controller[_0xb9aa('0xf')]);router['put'](_0xb9aa('0xb'),auth[_0xb9aa('0x9')](),controller['update']);router[_0xb9aa('0x10')](_0xb9aa('0xb'),auth[_0xb9aa('0x9')](),controller['destroy']);module[_0xb9aa('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index d448a09..09b3acb 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 _0x7eff=['outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','getDataValue','sequelize','exports','STRING','compositeIndex','inbound'];(function(_0x440be5,_0x4a1e3b){var _0x15c5d1=function(_0x2ca913){while(--_0x2ca913){_0x440be5['push'](_0x440be5['shift']());}};_0x15c5d1(++_0x4a1e3b);}(_0x7eff,0xbe));var _0xf7ef=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7eff[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xf7ef('0x0'));module[_0xf7ef('0x1')]={'context':{'type':Sequelize[_0xf7ef('0x2')],'allowNull':![],'unique':_0xf7ef('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf7ef('0x3')},'priority':{'type':Sequelize[_0xf7ef('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xf7ef('0x3')},'tag':{'type':Sequelize[_0xf7ef('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xf7ef('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0xf7ef('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0xf7ef('0x4'),_0xf7ef('0x5'),_0xf7ef('0x6'),_0xf7ef('0x7'),_0xf7ef('0x8'),_0xf7ef('0x9'),_0xf7ef('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0xf7ef('0x2')]},'interval':{'type':Sequelize[_0xf7ef('0x2')],'allowNull':![],'defaultValue':_0xf7ef('0xb')},'IntervalId':{'type':Sequelize[_0xf7ef('0xc')]},'isApp':{'type':Sequelize[_0xf7ef('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xf7ef('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xf7ef('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xf7ef('0xc')]},'recordingFormat':{'type':Sequelize[_0xf7ef('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x46d021){return this[_0xf7ef('0xe')]('exten');}},'alias':{'type':Sequelize[_0xf7ef('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x01fc=['inbound-fax','system','INTEGER','BOOLEAN','VIRTUAL','sequelize','exports','STRING','compositeIndex','ENUM','inbound','outbound','internal'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x01fc,0x1f3));var _0xc01f=function(_0x44e3c0,_0x4ff8c7){_0x44e3c0=_0x44e3c0-0x0;var _0x128821=_0x01fc[_0x44e3c0];return _0x128821;};'use strict';var Sequelize=require(_0xc01f('0x0'));module[_0xc01f('0x1')]={'context':{'type':Sequelize[_0xc01f('0x2')],'allowNull':![],'unique':_0xc01f('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc01f('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0xc01f('0x3')},'tag':{'type':Sequelize[_0xc01f('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xc01f('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0xc01f('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xc01f('0x4')](_0xc01f('0x5'),_0xc01f('0x6'),_0xc01f('0x7'),_0xc01f('0x8'),'outbound-fax',_0xc01f('0x9'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0xc01f('0x2')]},'interval':{'type':Sequelize[_0xc01f('0x2')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0xc01f('0xa')]},'isApp':{'type':Sequelize[_0xc01f('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xc01f('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xc01f('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xc01f('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xc01f('0xa')]},'recordingFormat':{'type':Sequelize[_0xc01f('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0xc01f('0xc')],'get':function(_0x50eff6){return this['getDataValue']('exten');}},'alias':{'type':Sequelize[_0xc01f('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 0328a24..ac4ec30 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 _0x390a=['limit','undefined','count','set','Content-Range','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','value','type','name','destroy','then','sendStatus','error','stack','send','index','map','VoiceExtension','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','startsWith','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','defaults','redis','localhost','socket.io-emitter','register','status','end','json','offset'];(function(_0x5b2220,_0x3556eb){var _0x2ec884=function(_0x29c50c){while(--_0x29c50c){_0x5b2220['push'](_0x5b2220['shift']());}};_0x2ec884(++_0x3556eb);}(_0x390a,0x1c3));var _0xa390=function(_0x4be41a,_0x4d5dc1){_0x4be41a=_0x4be41a-0x0;var _0x2f34f3=_0x390a[_0x4be41a];return _0x2f34f3;};'use strict';var _=require(_0xa390('0x0'));var Redis=require(_0xa390('0x1'));var qs=require(_0xa390('0x2'));var logger=require(_0xa390('0x3'))('api');var config=require(_0xa390('0x4'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xa390('0x5')](config[_0xa390('0x6')],{'host':_0xa390('0x7'),'port':0x18eb});var socket=require(_0xa390('0x8'))(new Redis(config[_0xa390('0x6')]));require('./voiceExtension.socket')[_0xa390('0x9')](socket);function respondWithStatusCode(_0x3043ea,_0x10f8c9){_0x10f8c9=_0x10f8c9||0xcc;return function(_0x298a1a){if(_0x298a1a){return _0x3043ea['sendStatus'](_0x10f8c9);}return _0x3043ea[_0xa390('0xa')](_0x10f8c9)[_0xa390('0xb')]();};}function respondWithResult(_0x56f8d6,_0x571f63){_0x571f63=_0x571f63||0xc8;return function(_0x2d8bca){if(_0x2d8bca){return _0x56f8d6['status'](_0x571f63)[_0xa390('0xc')](_0x2d8bca);}};}function respondWithFilteredResult(_0x9bf300,_0x6d2109){return function(_0x2f3fe){if(_0x2f3fe){var _0x49ddfe=typeof _0x6d2109[_0xa390('0xd')]==='undefined'&&typeof _0x6d2109[_0xa390('0xe')]===_0xa390('0xf');var _0x569c0c=_0x2f3fe[_0xa390('0x10')];var _0x3ff623=_0x49ddfe?0x0:_0x6d2109[_0xa390('0xd')];var _0x54d0d5=_0x49ddfe?_0x2f3fe['count']:_0x6d2109[_0xa390('0xd')]+_0x6d2109['limit'];var _0x76cc7c;if(_0x54d0d5>=_0x569c0c){_0x54d0d5=_0x569c0c;_0x76cc7c=0xc8;}else{_0x76cc7c=0xce;}_0x9bf300[_0xa390('0xa')](_0x76cc7c);return _0x9bf300[_0xa390('0x11')](_0xa390('0x12'),_0x3ff623+'-'+_0x54d0d5+'/'+_0x569c0c)['json'](_0x2f3fe);}return null;};}function removeEntity(_0x4b8deb){return function(_0x19558b){if(_0x19558b){return _0x19558b['destroy']()['then'](function(){var _0x213608=_0x19558b[_0xa390('0x13')]({'plain':!![]});var _0xe11589=[{'name':_0xa390('0x14'),'value':_0xa390('0x15'),'ignore':![]},{'name':_0xa390('0x16'),'value':_0xa390('0x17'),'ignore':![]},{'name':_0xa390('0x18'),'value':_0xa390('0x19'),'ignore':![]}];var _0x499448=_(_0xe11589)[_0xa390('0x1a')]('ignore')['map'](_0xa390('0x1b'))[_0xa390('0x1b')]();if(_['includes'](_0x499448,_0x213608[_0xa390('0x1c')])){return;}var _0x202885=_['find'](_0xe11589,[_0xa390('0x1b'),_0x213608['type']])[_0xa390('0x1d')];return db['UserProfileResource'][_0xa390('0x1e')]({'where':{'type':_0x202885,'resourceId':_0x213608['id']}})['then'](function(){return _0x19558b;});})[_0xa390('0x1f')](function(){_0x4b8deb[_0xa390('0xa')](0xcc)[_0xa390('0xb')]();});}};}function handleEntityNotFound(_0x56cb22){return function(_0x1691f0){if(!_0x1691f0){_0x56cb22[_0xa390('0x20')](0x194);}return _0x1691f0;};}function handleError(_0x11bbb9,_0x244eb5){_0x244eb5=_0x244eb5||0x1f4;return function(_0xa4af01){logger[_0xa390('0x21')](_0xa4af01[_0xa390('0x22')]);if(_0xa4af01['name']){delete _0xa4af01[_0xa390('0x1d')];}_0x11bbb9[_0xa390('0xa')](_0x244eb5)[_0xa390('0x23')](_0xa4af01);};}exports[_0xa390('0x24')]=function(_0x346612,_0x4bf442){var _0x106da5={},_0x3cbc6d={},_0x36d031={'count':0x0,'rows':[]};var _0x3af329=_[_0xa390('0x25')](db[_0xa390('0x26')][_0xa390('0x27')],function(_0x56f6e9){return{'name':_0x56f6e9[_0xa390('0x28')],'type':_0x56f6e9[_0xa390('0x1c')][_0xa390('0x29')]};});_0x3cbc6d[_0xa390('0x2a')]=_[_0xa390('0x25')](_0x3af329,_0xa390('0x1d'));_0x3cbc6d[_0xa390('0x2b')]=_['keys'](_0x346612[_0xa390('0x2b')]);_0x3cbc6d[_0xa390('0x2c')]=_[_0xa390('0x2d')](_0x3cbc6d[_0xa390('0x2a')],_0x3cbc6d[_0xa390('0x2b')]);_0x106da5[_0xa390('0x2e')]=_['intersection'](_0x3cbc6d[_0xa390('0x2a')],qs['fields'](_0x346612[_0xa390('0x2b')][_0xa390('0x2f')]));_0x106da5['attributes']=_0x106da5[_0xa390('0x2e')][_0xa390('0x30')]?_0x106da5[_0xa390('0x2e')]:_0x3cbc6d[_0xa390('0x2a')];if(!_0x346612[_0xa390('0x2b')][_0xa390('0x31')](_0xa390('0x32'))){_0x106da5['limit']=qs['limit'](_0x346612[_0xa390('0x2b')]['limit']);_0x106da5[_0xa390('0xd')]=qs['offset'](_0x346612[_0xa390('0x2b')][_0xa390('0xd')]);}_0x106da5[_0xa390('0x33')]=qs[_0xa390('0x34')](_0x346612[_0xa390('0x2b')][_0xa390('0x34')]);_0x106da5[_0xa390('0x35')]=qs[_0xa390('0x2c')](_[_0xa390('0x36')](_0x346612[_0xa390('0x2b')],_0x3cbc6d[_0xa390('0x2c')]),_0x3af329);if(_0x346612[_0xa390('0x2b')][_0xa390('0x1a')]){_0x106da5[_0xa390('0x35')]=_[_0xa390('0x37')](_0x106da5[_0xa390('0x35')],{'$or':_[_0xa390('0x25')](_0x3af329,function(_0x3a7e42){if(_0x3a7e42[_0xa390('0x1c')]!=='VIRTUAL'){var _0x55fbb3={};_0x55fbb3[_0x3a7e42['name']]={'$like':'%'+_0x346612[_0xa390('0x2b')][_0xa390('0x1a')]+'%'};return _0x55fbb3;}})});}_0x106da5=_[_0xa390('0x37')]({},_0x106da5,_0x346612[_0xa390('0x38')]);var _0x44849f={'where':_0x106da5['where']};return db[_0xa390('0x26')][_0xa390('0x10')](_0x44849f)[_0xa390('0x1f')](function(_0x379045){_0x36d031[_0xa390('0x10')]=_0x379045;if(_0x346612[_0xa390('0x2b')][_0xa390('0x39')]){_0x106da5['include']=[{'all':!![]}];}return db[_0xa390('0x26')][_0xa390('0x3a')](_0x106da5);})[_0xa390('0x1f')](function(_0x2f93c1){_0x36d031[_0xa390('0x3b')]=_0x2f93c1;return _0x36d031;})[_0xa390('0x1f')](respondWithFilteredResult(_0x4bf442,_0x106da5))[_0xa390('0x3c')](handleError(_0x4bf442,null));};exports[_0xa390('0x3d')]=function(_0x23574c,_0x1a9cb2){var _0x5b553a={'raw':![],'where':{'id':_0x23574c[_0xa390('0x3e')]['id']}},_0x2b4e13={};_0x2b4e13[_0xa390('0x2a')]=_[_0xa390('0x3f')](db[_0xa390('0x26')][_0xa390('0x27')]);_0x2b4e13[_0xa390('0x2b')]=_[_0xa390('0x3f')](_0x23574c[_0xa390('0x2b')]);_0x2b4e13['filters']=_[_0xa390('0x2d')](_0x2b4e13[_0xa390('0x2a')],_0x2b4e13['query']);_0x5b553a['attributes']=_[_0xa390('0x2d')](_0x2b4e13[_0xa390('0x2a')],qs['fields'](_0x23574c[_0xa390('0x2b')][_0xa390('0x2f')]));_0x5b553a[_0xa390('0x2e')]=_0x5b553a[_0xa390('0x2e')]['length']?_0x5b553a['attributes']:_0x2b4e13[_0xa390('0x2a')];if(_0x23574c['query']['includeAll']){_0x5b553a[_0xa390('0x40')]=[{'all':!![]}];}_0x5b553a=_[_0xa390('0x37')]({},_0x5b553a,_0x23574c[_0xa390('0x38')]);return db[_0xa390('0x26')]['find'](_0x5b553a)['then'](handleEntityNotFound(_0x1a9cb2,null))[_0xa390('0x1f')](respondWithResult(_0x1a9cb2,null))[_0xa390('0x3c')](handleError(_0x1a9cb2,null));};exports['destroy']=function(_0x18c122,_0x5855f5){return db[_0xa390('0x26')][_0xa390('0x41')]({'where':{'id':_0x18c122['params']['id']}})[_0xa390('0x1f')](handleEntityNotFound(_0x5855f5,null))[_0xa390('0x1f')](removeEntity(_0x5855f5,null))[_0xa390('0x3c')](handleError(_0x5855f5,null));};exports[_0xa390('0x42')]=function(_0x25bc6f,_0x41a596){if(_0x25bc6f['body'][_0xa390('0x1c')]==='outbound'&&!_[_0xa390('0x43')](_0x25bc6f[_0xa390('0x44')][_0xa390('0x45')],'_')){_0x25bc6f[_0xa390('0x44')]['exten']='_'[_0xa390('0x46')](_0x25bc6f[_0xa390('0x44')][_0xa390('0x45')]);}return db['VoiceExtension'][_0xa390('0x42')](_0x25bc6f['body'],{'raw':![]})[_0xa390('0x1f')](function(_0x554c0a){var _0x25784d=_0x25bc6f[_0xa390('0x47')]['get']({'plain':!![]});if(!_0x25784d)throw new Error(_0xa390('0x48'));if(_0x25784d[_0xa390('0x49')]===_0xa390('0x47')){var _0x1ea133=_0x554c0a['get']({'plain':!![]});var _0x2fbeca=[{'name':_0xa390('0x14'),'value':_0xa390('0x15')},{'name':_0xa390('0x16'),'value':_0xa390('0x17')},{'name':_0xa390('0x18'),'value':_0xa390('0x19')}];var _0x332ae9=_[_0xa390('0x41')](_0x2fbeca,[_0xa390('0x1b'),_0x1ea133[_0xa390('0x1c')]])[_0xa390('0x1d')];return db[_0xa390('0x4a')][_0xa390('0x41')]({'where':{'name':_0x332ae9,'userProfileId':_0x25784d['userProfileId']},'raw':!![]})[_0xa390('0x1f')](function(_0x437cf9){if(_0x437cf9&&_0x437cf9[_0xa390('0x4b')]===0x0){return db[_0xa390('0x4c')][_0xa390('0x42')]({'name':_0x1ea133[_0xa390('0x1d')],'resourceId':_0x1ea133['id'],'type':_0x437cf9[_0xa390('0x1d')],'sectionId':_0x437cf9['id']},{})['then'](function(){return _0x554c0a;});}else{return _0x554c0a;}})[_0xa390('0x3c')](function(_0x22f73e){logger[_0xa390('0x21')](_0xa390('0x4d'),_0x22f73e);throw _0x22f73e;});}return _0x554c0a;})[_0xa390('0x1f')](respondWithResult(_0x41a596,0xc9))[_0xa390('0x3c')](handleError(_0x41a596,null));};exports['update']=function(_0xe9422d,_0x343d99){if(_0xe9422d[_0xa390('0x44')]['id']){delete _0xe9422d[_0xa390('0x44')]['id'];}return db[_0xa390('0x26')][_0xa390('0x41')]({'where':{'id':_0xe9422d[_0xa390('0x3e')]['id']}})[_0xa390('0x1f')](handleEntityNotFound(_0x343d99,null))[_0xa390('0x1f')](function(_0x288be5){if(_0x288be5){return db[_0xa390('0x26')][_0xa390('0x4e')](_[_0xa390('0x36')](_0xe9422d[_0xa390('0x44')],[_0xa390('0x45'),_0xa390('0x4f'),'description','recordingFormat',_0xa390('0x50'),_0xa390('0x51'),_0xa390('0x52')]),{'where':{'context':_0x288be5[_0xa390('0x4f')],'exten':_0x288be5[_0xa390('0x45')]},'individualHooks':!![]})[_0xa390('0x1f')](function(_0x108205){return _0x108205;});}return null;})[_0xa390('0x1f')](respondWithStatusCode(_0x343d99,null))[_0xa390('0x3c')](handleError(_0x343d99,null));};exports[_0xa390('0x53')]=function(_0x3e2175,_0x56638d){var _0x292d5b=_0x3e2175['params']['id'];var _0x54c8bf=_0x3e2175[_0xa390('0x44')];var _0x5f53f7=0xc8;var _0x2d24f7=null;return db[_0xa390('0x54')][_0xa390('0x55')]({'isolationLevel':db['sequelize'][_0xa390('0x56')]['ISOLATION_LEVELS'][_0xa390('0x57')]},function(_0x4b2a9f){return db[_0xa390('0x26')][_0xa390('0x58')]({'where':{'id':_0x292d5b},'transaction':_0x4b2a9f})[_0xa390('0x1f')](function(_0x35c553){if(_0x35c553){return db[_0xa390('0x26')][_0xa390('0x1e')]({'where':{'VoiceExtensionId':_0x292d5b},'transaction':_0x4b2a9f})['then'](function(){var _0xd0e8ab=_[_0xa390('0x25')](_0x54c8bf,function(_0x326970){_0x326970[_0xa390('0x59')]=_0x292d5b;_0x326970[_0xa390('0x5a')]=!![];return _0x326970;});return _0x35c553[_0xa390('0x5b')](_0xd0e8ab);})[_0xa390('0x1f')](function(_0x3dfd25){return db[_0xa390('0x26')]['bulkCreate'](_0x3dfd25,{'transaction':_0x4b2a9f});});}else{_0x5f53f7=0x194;_0x2d24f7=[];}});})[_0xa390('0x1f')](function(){if(_0x5f53f7!==0x194){return db[_0xa390('0x26')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x292d5b},'order':'cast(priority\x20as\x20unsigned)'})['then'](function(_0x30f50a){_0x2d24f7=_0x30f50a;});}})[_0xa390('0x3c')](function(_0x446a1d){_0x5f53f7=0x1f4;logger['error'](_0x446a1d[_0xa390('0x22')]);if(_0x446a1d[_0xa390('0x1d')]){delete _0x446a1d['name'];}_0x2d24f7=_0x446a1d;})[_0xa390('0x5c')](function(){if(_0x2d24f7===null){_0x56638d['sendStatus'](_0x5f53f7);}else{if(_0x5f53f7===0x1f4){_0x56638d['status'](_0x5f53f7)['send'](_0x2d24f7);}else{_0x56638d[_0xa390('0xa')](_0x5f53f7)[_0xa390('0xc')](_0x2d24f7);}}});}; \ No newline at end of file +var _0x7c26=['description','recordingFormat','cutdigits','alias','context','sequelize','transaction','Transaction','READ_COMMITTED','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','get','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','internal','filter','map','value','includes','type','find','name','UserProfileResource','then','error','stack','send','index','VoiceExtension','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','VIRTUAL','merge','options','includeAll','include','rows','catch','params','rawAttributes','create','body','startsWith','exten','concat','user','role','outbound','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick'];(function(_0x307fd8,_0x25d8ac){var _0xd3f818=function(_0x2eba75){while(--_0x2eba75){_0x307fd8['push'](_0x307fd8['shift']());}};_0xd3f818(++_0x25d8ac);}(_0x7c26,0x12a));var _0x67c2=function(_0x12d760,_0x3ed881){_0x12d760=_0x12d760-0x0;var _0x5651a3=_0x7c26[_0x12d760];return _0x5651a3;};'use strict';var _=require(_0x67c2('0x0'));var Redis=require(_0x67c2('0x1'));var qs=require(_0x67c2('0x2'));var logger=require(_0x67c2('0x3'))(_0x67c2('0x4'));var config=require(_0x67c2('0x5'));var db=require('../../mysqldb')['db'];config[_0x67c2('0x6')]=_['defaults'](config['redis'],{'host':_0x67c2('0x7'),'port':0x18eb});var socket=require(_0x67c2('0x8'))(new Redis(config[_0x67c2('0x6')]));require(_0x67c2('0x9'))[_0x67c2('0xa')](socket);function respondWithStatusCode(_0x32b697,_0xe52f87){_0xe52f87=_0xe52f87||0xcc;return function(_0x1abce5){if(_0x1abce5){return _0x32b697[_0x67c2('0xb')](_0xe52f87);}return _0x32b697[_0x67c2('0xc')](_0xe52f87)[_0x67c2('0xd')]();};}function respondWithResult(_0x225c58,_0x5a229e){_0x5a229e=_0x5a229e||0xc8;return function(_0x5a2613){if(_0x5a2613){return _0x225c58[_0x67c2('0xc')](_0x5a229e)[_0x67c2('0xe')](_0x5a2613);}};}function respondWithFilteredResult(_0x4cbc65,_0x116e17){return function(_0x3d2205){if(_0x3d2205){var _0x2b3f07=typeof _0x116e17[_0x67c2('0xf')]===_0x67c2('0x10')&&typeof _0x116e17[_0x67c2('0x11')]==='undefined';var _0x47f18=_0x3d2205[_0x67c2('0x12')];var _0x42d414=_0x2b3f07?0x0:_0x116e17[_0x67c2('0xf')];var _0x192e1b=_0x2b3f07?_0x3d2205[_0x67c2('0x12')]:_0x116e17[_0x67c2('0xf')]+_0x116e17[_0x67c2('0x11')];var _0x20fce7;if(_0x192e1b>=_0x47f18){_0x192e1b=_0x47f18;_0x20fce7=0xc8;}else{_0x20fce7=0xce;}_0x4cbc65[_0x67c2('0xc')](_0x20fce7);return _0x4cbc65[_0x67c2('0x13')](_0x67c2('0x14'),_0x42d414+'-'+_0x192e1b+'/'+_0x47f18)[_0x67c2('0xe')](_0x3d2205);}return null;};}function removeEntity(_0x38356f){return function(_0x5e0219){if(_0x5e0219){return _0x5e0219[_0x67c2('0x15')]()['then'](function(){var _0xac0695=_0x5e0219[_0x67c2('0x16')]({'plain':!![]});var _0x2c0c13=[{'name':_0x67c2('0x17'),'value':_0x67c2('0x18'),'ignore':![]},{'name':_0x67c2('0x19'),'value':'outbound','ignore':![]},{'name':_0x67c2('0x1a'),'value':_0x67c2('0x1b'),'ignore':![]}];var _0x1a58f0=_(_0x2c0c13)[_0x67c2('0x1c')]('ignore')[_0x67c2('0x1d')](_0x67c2('0x1e'))[_0x67c2('0x1e')]();if(_[_0x67c2('0x1f')](_0x1a58f0,_0xac0695[_0x67c2('0x20')])){return;}var _0x5609ac=_[_0x67c2('0x21')](_0x2c0c13,[_0x67c2('0x1e'),_0xac0695[_0x67c2('0x20')]])[_0x67c2('0x22')];return db[_0x67c2('0x23')][_0x67c2('0x15')]({'where':{'type':_0x5609ac,'resourceId':_0xac0695['id']}})[_0x67c2('0x24')](function(){return _0x5e0219;});})['then'](function(){_0x38356f[_0x67c2('0xc')](0xcc)[_0x67c2('0xd')]();});}};}function handleEntityNotFound(_0x2eee4f){return function(_0xdf1d48){if(!_0xdf1d48){_0x2eee4f['sendStatus'](0x194);}return _0xdf1d48;};}function handleError(_0x280a38,_0x541805){_0x541805=_0x541805||0x1f4;return function(_0x50aba6){logger[_0x67c2('0x25')](_0x50aba6[_0x67c2('0x26')]);if(_0x50aba6['name']){delete _0x50aba6[_0x67c2('0x22')];}_0x280a38[_0x67c2('0xc')](_0x541805)[_0x67c2('0x27')](_0x50aba6);};}exports[_0x67c2('0x28')]=function(_0x54bc45,_0x5dd8a8){var _0x2c45e5={},_0x5a2ca9={},_0x77211f={'count':0x0,'rows':[]};var _0x230549=_[_0x67c2('0x1d')](db[_0x67c2('0x29')]['rawAttributes'],function(_0x5bd4f9){return{'name':_0x5bd4f9[_0x67c2('0x2a')],'type':_0x5bd4f9[_0x67c2('0x20')][_0x67c2('0x2b')]};});_0x5a2ca9[_0x67c2('0x2c')]=_[_0x67c2('0x1d')](_0x230549,_0x67c2('0x22'));_0x5a2ca9['query']=_[_0x67c2('0x2d')](_0x54bc45[_0x67c2('0x2e')]);_0x5a2ca9[_0x67c2('0x2f')]=_[_0x67c2('0x30')](_0x5a2ca9['model'],_0x5a2ca9[_0x67c2('0x2e')]);_0x2c45e5[_0x67c2('0x31')]=_[_0x67c2('0x30')](_0x5a2ca9['model'],qs[_0x67c2('0x32')](_0x54bc45[_0x67c2('0x2e')][_0x67c2('0x32')]));_0x2c45e5[_0x67c2('0x31')]=_0x2c45e5[_0x67c2('0x31')][_0x67c2('0x33')]?_0x2c45e5['attributes']:_0x5a2ca9['model'];if(!_0x54bc45[_0x67c2('0x2e')]['hasOwnProperty'](_0x67c2('0x34'))){_0x2c45e5[_0x67c2('0x11')]=qs[_0x67c2('0x11')](_0x54bc45[_0x67c2('0x2e')]['limit']);_0x2c45e5[_0x67c2('0xf')]=qs[_0x67c2('0xf')](_0x54bc45[_0x67c2('0x2e')][_0x67c2('0xf')]);}_0x2c45e5[_0x67c2('0x35')]=qs['sort'](_0x54bc45[_0x67c2('0x2e')][_0x67c2('0x36')]);_0x2c45e5[_0x67c2('0x37')]=qs[_0x67c2('0x2f')](_['pick'](_0x54bc45[_0x67c2('0x2e')],_0x5a2ca9[_0x67c2('0x2f')]),_0x230549);if(_0x54bc45[_0x67c2('0x2e')][_0x67c2('0x1c')]){_0x2c45e5['where']=_['merge'](_0x2c45e5[_0x67c2('0x37')],{'$or':_['map'](_0x230549,function(_0x28a11d){if(_0x28a11d[_0x67c2('0x20')]!==_0x67c2('0x38')){var _0x159c45={};_0x159c45[_0x28a11d[_0x67c2('0x22')]]={'$like':'%'+_0x54bc45[_0x67c2('0x2e')]['filter']+'%'};return _0x159c45;}})});}_0x2c45e5=_[_0x67c2('0x39')]({},_0x2c45e5,_0x54bc45[_0x67c2('0x3a')]);var _0x1fb2b8={'where':_0x2c45e5[_0x67c2('0x37')]};return db[_0x67c2('0x29')]['count'](_0x1fb2b8)['then'](function(_0xcbe5b5){_0x77211f['count']=_0xcbe5b5;if(_0x54bc45[_0x67c2('0x2e')][_0x67c2('0x3b')]){_0x2c45e5[_0x67c2('0x3c')]=[{'all':!![]}];}return db[_0x67c2('0x29')]['findAll'](_0x2c45e5);})[_0x67c2('0x24')](function(_0x34aca8){_0x77211f[_0x67c2('0x3d')]=_0x34aca8;return _0x77211f;})[_0x67c2('0x24')](respondWithFilteredResult(_0x5dd8a8,_0x2c45e5))[_0x67c2('0x3e')](handleError(_0x5dd8a8,null));};exports['show']=function(_0x3f7e31,_0x2c861a){var _0x2df41d={'raw':![],'where':{'id':_0x3f7e31[_0x67c2('0x3f')]['id']}},_0x574bcd={};_0x574bcd['model']=_[_0x67c2('0x2d')](db[_0x67c2('0x29')][_0x67c2('0x40')]);_0x574bcd['query']=_[_0x67c2('0x2d')](_0x3f7e31[_0x67c2('0x2e')]);_0x574bcd[_0x67c2('0x2f')]=_['intersection'](_0x574bcd['model'],_0x574bcd[_0x67c2('0x2e')]);_0x2df41d[_0x67c2('0x31')]=_[_0x67c2('0x30')](_0x574bcd[_0x67c2('0x2c')],qs[_0x67c2('0x32')](_0x3f7e31[_0x67c2('0x2e')]['fields']));_0x2df41d[_0x67c2('0x31')]=_0x2df41d[_0x67c2('0x31')]['length']?_0x2df41d['attributes']:_0x574bcd[_0x67c2('0x2c')];if(_0x3f7e31[_0x67c2('0x2e')][_0x67c2('0x3b')]){_0x2df41d[_0x67c2('0x3c')]=[{'all':!![]}];}_0x2df41d=_[_0x67c2('0x39')]({},_0x2df41d,_0x3f7e31[_0x67c2('0x3a')]);return db[_0x67c2('0x29')][_0x67c2('0x21')](_0x2df41d)['then'](handleEntityNotFound(_0x2c861a,null))['then'](respondWithResult(_0x2c861a,null))[_0x67c2('0x3e')](handleError(_0x2c861a,null));};exports[_0x67c2('0x15')]=function(_0x3d0e5a,_0x1adbc4){return db[_0x67c2('0x29')][_0x67c2('0x21')]({'where':{'id':_0x3d0e5a[_0x67c2('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1adbc4,null))[_0x67c2('0x24')](removeEntity(_0x1adbc4,null))[_0x67c2('0x3e')](handleError(_0x1adbc4,null));};exports[_0x67c2('0x41')]=function(_0x4d97f3,_0xcae48){if(_0x4d97f3[_0x67c2('0x42')][_0x67c2('0x20')]==='outbound'&&!_[_0x67c2('0x43')](_0x4d97f3[_0x67c2('0x42')]['exten'],'_')){_0x4d97f3['body'][_0x67c2('0x44')]='_'[_0x67c2('0x45')](_0x4d97f3[_0x67c2('0x42')][_0x67c2('0x44')]);}return db[_0x67c2('0x29')]['create'](_0x4d97f3[_0x67c2('0x42')],{'raw':![]})['then'](function(_0x58da6a){var _0x4f2500=_0x4d97f3[_0x67c2('0x46')]['get']({'plain':!![]});if(!_0x4f2500)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f2500[_0x67c2('0x47')]==='user'){var _0x31e720=_0x58da6a[_0x67c2('0x16')]({'plain':!![]});var _0x4189ad=[{'name':_0x67c2('0x17'),'value':'inbound'},{'name':_0x67c2('0x19'),'value':_0x67c2('0x48')},{'name':_0x67c2('0x1a'),'value':_0x67c2('0x1b')}];var _0x253991=_['find'](_0x4189ad,[_0x67c2('0x1e'),_0x31e720[_0x67c2('0x20')]])['name'];return db[_0x67c2('0x49')][_0x67c2('0x21')]({'where':{'name':_0x253991,'userProfileId':_0x4f2500[_0x67c2('0x4a')]},'raw':!![]})['then'](function(_0x49a074){if(_0x49a074&&_0x49a074['autoAssociation']===0x0){return db['UserProfileResource'][_0x67c2('0x41')]({'name':_0x31e720[_0x67c2('0x22')],'resourceId':_0x31e720['id'],'type':_0x49a074[_0x67c2('0x22')],'sectionId':_0x49a074['id']},{})[_0x67c2('0x24')](function(){return _0x58da6a;});}else{return _0x58da6a;}})[_0x67c2('0x3e')](function(_0x45d4d6){logger[_0x67c2('0x25')](_0x67c2('0x4b'),_0x45d4d6);throw _0x45d4d6;});}return _0x58da6a;})[_0x67c2('0x24')](respondWithResult(_0xcae48,0xc9))['catch'](handleError(_0xcae48,null));};exports['update']=function(_0x297ce9,_0x5a3bbb){if(_0x297ce9[_0x67c2('0x42')]['id']){delete _0x297ce9[_0x67c2('0x42')]['id'];}return db[_0x67c2('0x29')]['find']({'where':{'id':_0x297ce9[_0x67c2('0x3f')]['id']}})[_0x67c2('0x24')](handleEntityNotFound(_0x5a3bbb,null))[_0x67c2('0x24')](function(_0x1e4e76){if(_0x1e4e76){return db[_0x67c2('0x29')][_0x67c2('0x4c')](_[_0x67c2('0x4d')](_0x297ce9[_0x67c2('0x42')],[_0x67c2('0x44'),'context',_0x67c2('0x4e'),_0x67c2('0x4f'),_0x67c2('0x50'),'mandatoryDisposition',_0x67c2('0x51')]),{'where':{'context':_0x1e4e76[_0x67c2('0x52')],'exten':_0x1e4e76[_0x67c2('0x44')]},'individualHooks':!![]})[_0x67c2('0x24')](function(_0x22a8ff){return _0x22a8ff;});}return null;})[_0x67c2('0x24')](respondWithStatusCode(_0x5a3bbb,null))[_0x67c2('0x3e')](handleError(_0x5a3bbb,null));};exports['addApplications']=function(_0x521f6a,_0x449cd9){var _0x1da2b6=_0x521f6a[_0x67c2('0x3f')]['id'];var _0x2dac0f=_0x521f6a[_0x67c2('0x42')];var _0x16eb95=0xc8;var _0x48bdee=null;return db[_0x67c2('0x53')][_0x67c2('0x54')]({'isolationLevel':db[_0x67c2('0x53')][_0x67c2('0x55')]['ISOLATION_LEVELS'][_0x67c2('0x56')]},function(_0x2956db){return db[_0x67c2('0x29')]['findOne']({'where':{'id':_0x1da2b6},'transaction':_0x2956db})[_0x67c2('0x24')](function(_0x24aff1){if(_0x24aff1){return db[_0x67c2('0x29')]['destroy']({'where':{'VoiceExtensionId':_0x1da2b6},'transaction':_0x2956db})[_0x67c2('0x24')](function(){var _0x54da85=_[_0x67c2('0x1d')](_0x2dac0f,function(_0x349c2e){_0x349c2e[_0x67c2('0x57')]=_0x1da2b6;_0x349c2e[_0x67c2('0x58')]=!![];return _0x349c2e;});return _0x24aff1[_0x67c2('0x59')](_0x54da85);})[_0x67c2('0x24')](function(_0x57e7ee){return db[_0x67c2('0x29')][_0x67c2('0x5a')](_0x57e7ee,{'transaction':_0x2956db});});}else{_0x16eb95=0x194;_0x48bdee=[];}});})[_0x67c2('0x24')](function(){if(_0x16eb95!==0x194){return db[_0x67c2('0x29')][_0x67c2('0x5b')]({'where':{'isApp':!![],'VoiceExtensionId':_0x1da2b6},'order':_0x67c2('0x5c')})[_0x67c2('0x24')](function(_0x2a1c91){_0x48bdee=_0x2a1c91;});}})[_0x67c2('0x3e')](function(_0x1587e2){_0x16eb95=0x1f4;logger[_0x67c2('0x25')](_0x1587e2[_0x67c2('0x26')]);if(_0x1587e2[_0x67c2('0x22')]){delete _0x1587e2[_0x67c2('0x22')];}_0x48bdee=_0x1587e2;})[_0x67c2('0x5d')](function(){if(_0x48bdee===null){_0x449cd9[_0x67c2('0xb')](_0x16eb95);}else{if(_0x16eb95===0x1f4){_0x449cd9[_0x67c2('0xc')](_0x16eb95)[_0x67c2('0x27')](_0x48bdee);}else{_0x449cd9[_0x67c2('0xc')](_0x16eb95)[_0x67c2('0xe')](_0x48bdee);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 7d6e4be..16da3aa 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 _0x7cfc=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','VoiceExtension'];(function(_0x16e0c8,_0x4861eb){var _0xe4b5af=function(_0x5248bc){while(--_0x5248bc){_0x16e0c8['push'](_0x16e0c8['shift']());}};_0xe4b5af(++_0x4861eb);}(_0x7cfc,0x8e));var _0xc7cf=function(_0x11dd70,_0x7fcb27){_0x11dd70=_0x11dd70-0x0;var _0x4fb490=_0x7cfc[_0x11dd70];return _0x4fb490;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xc7cf('0x0'))['db'][_0xc7cf('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xc7cf('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc7cf('0x3'),'afterDestroy':_0xc7cf('0x4')};function emitEvent(_0x214b40){return function(_0x45015b,_0x3117cb,_0x57ad17){VoiceExtensionEvents['emit'](_0x214b40+':'+_0x45015b['id'],_0x45015b);VoiceExtensionEvents[_0xc7cf('0x5')](_0x214b40,_0x45015b);_0x57ad17(null);};}for(var e in events){if(events[_0xc7cf('0x6')](e)){var event=events[e];VoiceExtension[_0xc7cf('0x7')](e,emitEvent(event));}}module[_0xc7cf('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0xe0ea=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension'];(function(_0x78db5e,_0x3b9804){var _0x250b88=function(_0x20a40f){while(--_0x20a40f){_0x78db5e['push'](_0x78db5e['shift']());}};_0x250b88(++_0x3b9804);}(_0xe0ea,0xa7));var _0xae0e=function(_0x56eaa4,_0x179546){_0x56eaa4=_0x56eaa4-0x0;var _0x568b2f=_0xe0ea[_0x56eaa4];return _0x568b2f;};'use strict';var EventEmitter=require(_0xae0e('0x0'));var VoiceExtension=require(_0xae0e('0x1'))['db'][_0xae0e('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xae0e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xae0e('0x4'),'afterDestroy':_0xae0e('0x5')};function emitEvent(_0xfd6c8b){return function(_0x1bf851,_0x2b703c,_0x23a28f){VoiceExtensionEvents[_0xae0e('0x6')](_0xfd6c8b+':'+_0x1bf851['id'],_0x1bf851);VoiceExtensionEvents[_0xae0e('0x6')](_0xfd6c8b,_0x1bf851);_0x23a28f(null);};}for(var e in events){if(events[_0xae0e('0x7')](e)){var event=events[e];VoiceExtension[_0xae0e('0x8')](e,emitEvent(event));}}module[_0xae0e('0x9')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 17a4a4d..2814205 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 _0xacd0=['Interval','interval','IntervalId','length','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','includes','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appType','appdata','last','priority','VoiceExtension','voice_extensions','get','then','concat','Hangup','lodash','./voiceExtension.attributes','exports','type','Set','CDR(type)=','context','exten','alias','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','CDR(routeid)=','MONITOR_OPTIONS=ab','outbound','NoOp','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','name','param','phone','prefix','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty'];(function(_0xbb9dbf,_0x5dafa4){var _0x30223c=function(_0xaa9ca){while(--_0xaa9ca){_0xbb9dbf['push'](_0xbb9dbf['shift']());}};_0x30223c(++_0x5dafa4);}(_0xacd0,0xc9));var _0x0acd=function(_0x1de0b9,_0xc6f046){_0x1de0b9=_0x1de0b9-0x0;var _0x18edae=_0xacd0[_0x1de0b9];return _0x18edae;};'use strict';var _=require(_0x0acd('0x0'));var attributes=require(_0x0acd('0x1'));module[_0x0acd('0x2')]=function(_0x4bd438){var _0x42fa2d=_0x4bd438['models'];function _0x1e95fd(_0x569f93){var _0x147d6d=0x2;var _0x586d60=[{'type':_0x569f93[_0x0acd('0x3')],'app':_0x0acd('0x4'),'appdata':_0x0acd('0x5')+_0x569f93[_0x0acd('0x3')],'context':_0x569f93[_0x0acd('0x6')],'exten':_0x569f93[_0x0acd('0x7')],'priority':_0x147d6d++,'VoiceExtensionId':_0x569f93['id']},{'type':_0x569f93['type'],'app':_0x569f93['alias']?_0x0acd('0x4'):'NoOp','appdata':_0x569f93[_0x0acd('0x8')]?_0x0acd('0x9')+_0x569f93['alias']:_0x0acd('0xa'),'context':_0x569f93[_0x0acd('0x6')],'exten':_0x569f93[_0x0acd('0x7')],'priority':_0x147d6d++,'VoiceExtensionId':_0x569f93['id']}];if(_0x569f93[_0x0acd('0x3')]===_0x0acd('0xb')){_0x586d60[_0x0acd('0xc')]({'type':'inbound','app':_0x0acd('0x4'),'appdata':_0x0acd('0xd')+_0x569f93['id'],'context':_0x569f93[_0x0acd('0x6')],'exten':_0x569f93[_0x0acd('0x7')],'priority':_0x147d6d++,'VoiceExtensionId':_0x569f93['id']});}_0x586d60['push']({'type':_0x569f93[_0x0acd('0x3')],'app':_0x0acd('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x569f93[_0x0acd('0x6')],'exten':_0x569f93[_0x0acd('0x7')],'priority':_0x147d6d++,'VoiceExtensionId':_0x569f93['id']},{'type':_0x569f93[_0x0acd('0x3')],'app':_0x0acd('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x569f93['context'],'exten':_0x569f93[_0x0acd('0x7')],'priority':_0x147d6d++,'VoiceExtensionId':_0x569f93['id']},{'type':_0x569f93[_0x0acd('0x3')],'app':_0x0acd('0x4'),'appdata':_0x0acd('0xe'),'context':_0x569f93[_0x0acd('0x6')],'exten':_0x569f93[_0x0acd('0x7')],'priority':_0x147d6d++,'VoiceExtensionId':_0x569f93['id']});return _0x586d60;}function _0x9ae857(_0x419059){var _0x48329a=0x2;var _0x4b137a=[{'type':_0x0acd('0xf'),'app':'Set','appdata':'CDR(type)=outbound','context':_0x419059[_0x0acd('0x6')],'exten':_0x419059[_0x0acd('0x7')],'priority':_0x48329a++,'VoiceExtensionId':_0x419059['id']},{'type':_0x0acd('0xf'),'app':_0x419059[_0x0acd('0x8')]?'Set':_0x0acd('0x10'),'appdata':_0x419059[_0x0acd('0x8')]?'CDR(routeAlias)='+_0x419059['alias']:_0x0acd('0xa'),'context':_0x419059[_0x0acd('0x6')],'exten':_0x419059[_0x0acd('0x7')],'priority':_0x48329a++,'VoiceExtensionId':_0x419059['id']},{'type':_0x0acd('0xf'),'app':_0x0acd('0x4'),'appdata':_0x0acd('0x11')+(_0x419059[_0x0acd('0x12')]?_0x0acd('0x13')+_0x419059[_0x0acd('0x12')]+'}':'${EXTEN}'),'context':_0x419059[_0x0acd('0x6')],'exten':_0x419059[_0x0acd('0x7')],'priority':_0x48329a++,'VoiceExtensionId':_0x419059['id']},{'type':_0x0acd('0xf'),'app':_0x0acd('0x4'),'appdata':_0x0acd('0xd')+_0x419059['id'],'context':_0x419059[_0x0acd('0x6')],'exten':_0x419059[_0x0acd('0x7')],'priority':_0x48329a++,'VoiceExtensionId':_0x419059['id']},{'type':_0x0acd('0xf'),'app':_0x0acd('0x14'),'appdata':_0x0acd('0x15')+(_0x48329a+0x2)+_0x0acd('0x16')+(_0x48329a+0x1)+')','context':_0x419059[_0x0acd('0x6')],'exten':_0x419059['exten'],'priority':_0x48329a++,'VoiceExtensionId':_0x419059['id']},{'type':_0x0acd('0xf'),'app':_0x0acd('0x4'),'appdata':_0x419059[_0x0acd('0x12')]?'CDR(prefix)=${EXTEN:0:'+_0x419059['cutdigits']+'}':_0x0acd('0x17'),'context':_0x419059['context'],'exten':_0x419059[_0x0acd('0x7')],'priority':_0x48329a++,'VoiceExtensionId':_0x419059['id']},{'type':'outbound','app':_0x0acd('0x4'),'appdata':_0x0acd('0x18'),'context':_0x419059['context'],'exten':_0x419059[_0x0acd('0x7')],'priority':_0x48329a++,'VoiceExtensionId':_0x419059['id']},{'type':_0x0acd('0xf'),'app':_0x0acd('0x4'),'appdata':_0x0acd('0x19'),'context':_0x419059[_0x0acd('0x6')],'exten':_0x419059[_0x0acd('0x7')],'priority':_0x48329a++,'VoiceExtensionId':_0x419059['id']},{'type':_0x0acd('0xf'),'app':_0x0acd('0x4'),'appdata':_0x0acd('0xe'),'context':_0x419059['context'],'exten':_0x419059[_0x0acd('0x7')],'priority':_0x48329a++,'VoiceExtensionId':_0x419059['id']},{'type':'outbound','app':_0x0acd('0x4'),'appdata':_0x0acd('0x1a')+_0x419059['id'],'context':_0x419059[_0x0acd('0x6')],'exten':_0x419059[_0x0acd('0x7')],'priority':_0x48329a++,'VoiceExtensionId':_0x419059['id']}];if(_0x419059[_0x0acd('0x1b')](_0x0acd('0x1c'))&&_0x419059[_0x0acd('0x1c')]!==_0x0acd('0x1d')){_0x4b137a[_0x0acd('0xc')]({'type':'outbound','app':_0x0acd('0x4'),'appdata':_0x0acd('0x1e'),'context':_0x419059['context'],'exten':_0x419059[_0x0acd('0x7')],'priority':_0x48329a++,'VoiceExtensionId':_0x419059['id']},{'type':_0x0acd('0xf'),'app':_0x0acd('0x4'),'appdata':_0x0acd('0x1f')+_0x419059[_0x0acd('0x1c')]||_0x0acd('0x20'),'context':_0x419059['context'],'exten':_0x419059[_0x0acd('0x7')],'priority':_0x48329a++,'VoiceExtensionId':_0x419059['id']});}return _0x4b137a;}function _0x1c335c(_0x4dd81a,_0x3a52af){var _0x458bf5=[{'name':_0x0acd('0x21'),'param':0x0},{'name':_0x0acd('0x22'),'param':0x1},{'name':_0x0acd('0x23'),'param':0x2},{'name':_0x0acd('0x24'),'param':0x3}];var _0x1cec0e={};var _0x5ab344=_0x3a52af[_0x0acd('0x25')](',');var _0x546e90=[];for(var _0x8eaa8d=0x0;_0x8eaa8d<_0x458bf5['length'];_0x8eaa8d++){switch(_0x458bf5[_0x8eaa8d][_0x0acd('0x26')]){case _0x0acd('0x21'):_0x1cec0e[_0x0acd('0x21')]=_0x5ab344[_0x458bf5[_0x8eaa8d][_0x0acd('0x27')]]['split']('/')[0x1];_0x1cec0e[_0x0acd('0x28')]=_0x5ab344[_0x458bf5[_0x8eaa8d][_0x0acd('0x27')]]['split']('/')[0x2];_0x1cec0e[_0x0acd('0x29')]=_0x1cec0e[_0x0acd('0x28')]?_0x1cec0e[_0x0acd('0x28')]['split']('$')[0x0]:undefined;_0x1cec0e[_0x0acd('0x28')]=_0x4dd81a['cutdigits']?(_0x1cec0e['prefix']||'')+_0x0acd('0x13')+_0x4dd81a[_0x0acd('0x12')]+'}':(_0x1cec0e[_0x0acd('0x29')]||'')+'${EXTEN}';_0x546e90[_0x458bf5[_0x8eaa8d]['param']]=[_0x0acd('0x2a'),_0x1cec0e['trunk'],_0x1cec0e[_0x0acd('0x28')]][_0x0acd('0x2b')]('/');break;case _0x0acd('0x23'):_0x1cec0e[_0x0acd('0x23')]=_0x5ab344[_0x458bf5[_0x8eaa8d][_0x0acd('0x27')]];if(_0x4dd81a[_0x0acd('0x1c')]!==_0x0acd('0x1d')){if(_0x1cec0e['options'][_0x0acd('0x2c')](_0x0acd('0x2d'))<0x0){_0x1cec0e[_0x0acd('0x23')]+=_0x0acd('0x2d');}}else{_0x1cec0e[_0x0acd('0x23')]=_0x1cec0e['options'][_0x0acd('0x2e')](_0x0acd('0x2d'),'');}_0x546e90[_0x458bf5[_0x8eaa8d][_0x0acd('0x27')]]=_0x1cec0e['options'];break;default:_0x546e90[_0x458bf5[_0x8eaa8d][_0x0acd('0x27')]]=_0x5ab344[_0x458bf5[_0x8eaa8d]['param']];}}return _0x546e90[_0x0acd('0x2b')](',');}function _0x4c9d9f(_0x44673e,_0x5a86f6,_0x3949f2){return new Promise(function(_0x470eba,_0x3f015c){var _0x4922ca=[];if(_[_0x0acd('0x2f')](_0x5a86f6))return _0x470eba(_0x4922ca);_0x42fa2d[_0x0acd('0x30')]['findAll']({'attributes':['id',_0x0acd('0x31'),_0x0acd('0x32')],'raw':!![]})['then'](function(_0x2de8ff){for(var _0x4ff471=0x0,_0x5421b5=0x0;_0x4ff471<_0x5a86f6[_0x0acd('0x33')];_0x4ff471++,_0x5421b5=0x0){var _0x2b611e=_0x5a86f6[_0x4ff471];var _0xd81b95=[];var _0x2ca39e=[];delete _0x2b611e['id'];if(_0x2b611e['interval']!==_0x0acd('0x34')){_0x2b611e[_0x0acd('0x35')]=[_0x2b611e[_0x0acd('0x31')]];}else{_0x2b611e[_0x0acd('0x35')]=_0x2b611e[_0x0acd('0x32')]?_[_0x0acd('0x36')](_[_0x0acd('0x37')](_0x2de8ff,{'IntervalId':_0x2b611e['IntervalId']}),_0x0acd('0x31')):[];}_0x2b611e[_0x0acd('0x6')]=_0x44673e[_0x0acd('0x6')];_0x2b611e[_0x0acd('0x7')]=_0x44673e[_0x0acd('0x7')];if(_0x2b611e['type'])_0x2b611e[_0x0acd('0x3')]=_0x2b611e['type'][_0x0acd('0x38')]();if(_0x44673e[_0x0acd('0x3')]===_0x0acd('0xf')){if(_0x2b611e[_0x0acd('0x1b')]('tag')&&_0x2b611e[_0x0acd('0x39')]&&_0x2b611e['tag']!=='--'){_0xd81b95[_0x0acd('0xc')]({'type':_0x2b611e[_0x0acd('0x3')][_0x0acd('0x38')](),'app':_0x0acd('0x4'),'appdata':_0x0acd('0x3a')+_0x2b611e[_0x0acd('0x39')],'context':_0x44673e[_0x0acd('0x6')],'exten':_0x44673e[_0x0acd('0x7')],'priority':_0x2b611e[_0x0acd('0x35')][_0x0acd('0x33')]+_0x3949f2+_0x5421b5++,'VoiceExtensionId':_0x44673e['id']});}_0xd81b95[_0x0acd('0xc')]({'type':_0x2b611e[_0x0acd('0x3')][_0x0acd('0x38')](),'app':'ExecIf','appdata':_0x0acd('0x3b')+(_0x2b611e[_0x0acd('0x3c')]?'Set(CALLERID(all)='+_0x2b611e[_0x0acd('0x3c')]+')':_0x0acd('0x3d')),'context':_0x44673e[_0x0acd('0x6')],'exten':_0x44673e[_0x0acd('0x7')],'priority':_0x2b611e[_0x0acd('0x35')][_0x0acd('0x33')]+_0x3949f2+_0x5421b5++,'VoiceExtensionId':_0x44673e['id']});}else{if(_0x2b611e[_0x0acd('0x1b')](_0x0acd('0x3e'))){if(['queue','playback'][_0x0acd('0x3f')](_0x2b611e[_0x0acd('0x40')][_0x0acd('0x38')]())&&_0x2b611e['appType']!==_0x0acd('0x41')){if(_0x2b611e[_0x0acd('0x3e')]){_0xd81b95[_0x0acd('0xc')]({'type':_0x2b611e['type']['toLowerCase'](),'app':_0x0acd('0x14'),'appdata':_0x0acd('0x42'),'context':_0x44673e[_0x0acd('0x6')],'exten':_0x44673e[_0x0acd('0x7')],'priority':_0x2b611e['intervals'][_0x0acd('0x33')]+_0x3949f2+_0x5421b5++,'VoiceExtensionId':_0x44673e['id']});_0xd81b95[_0x0acd('0xc')]({'type':_0x2b611e[_0x0acd('0x3')][_0x0acd('0x38')](),'app':_0x0acd('0x4'),'appdata':_0x0acd('0x43'),'context':_0x44673e[_0x0acd('0x6')],'exten':_0x44673e['exten'],'priority':_0x2b611e[_0x0acd('0x35')]['length']+_0x3949f2+_0x5421b5++,'VoiceExtensionId':_0x44673e['id']});}else{_0xd81b95[_0x0acd('0xc')]({'type':_0x2b611e[_0x0acd('0x3')]['toLowerCase'](),'app':_0x0acd('0x14'),'appdata':_0x0acd('0x44'),'context':_0x44673e[_0x0acd('0x6')],'exten':_0x44673e[_0x0acd('0x7')],'priority':_0x2b611e[_0x0acd('0x35')]['length']+_0x3949f2+_0x5421b5++,'VoiceExtensionId':_0x44673e['id']});_0xd81b95['push']({'type':_0x2b611e[_0x0acd('0x3')]['toLowerCase'](),'app':_0x0acd('0x4'),'appdata':_0x0acd('0x45'),'context':_0x44673e[_0x0acd('0x6')],'exten':_0x44673e['exten'],'priority':_0x2b611e['intervals'][_0x0acd('0x33')]+_0x3949f2+_0x5421b5++,'VoiceExtensionId':_0x44673e['id']});}}}}for(var _0x9345c0=0x0;_0x9345c0<_0x2b611e[_0x0acd('0x35')][_0x0acd('0x33')];_0x9345c0++){var _0x1b175c=_0x3949f2+_0x2b611e[_0x0acd('0x35')][_0x0acd('0x33')];var _0x1983c8=_0x9345c0===_0x2b611e['intervals'][_0x0acd('0x33')]-0x1?_0x3949f2+_0xd81b95[_0x0acd('0x33')]+_0x2ca39e[_0x0acd('0x33')]+0x2:_0x3949f2+_0x9345c0+0x1;_0xd81b95[_0x0acd('0x46')](_0x9345c0,0x0,{'type':_0x44673e[_0x0acd('0x3')],'app':_0x0acd('0x47'),'appdata':_0x2b611e[_0x0acd('0x35')][_0x9345c0]+'?'+_0x44673e[_0x0acd('0x6')]+_0x0acd('0x48')+_0x1b175c+':'+_0x44673e[_0x0acd('0x6')]+_0x0acd('0x48')+_0x1983c8,'exten':_0x44673e['exten'],'context':_0x44673e[_0x0acd('0x6')],'priority':_0x3949f2+_0x9345c0,'VoiceExtensionId':_0x44673e['id']});}if(_0x2b611e[_0x0acd('0x49')]==='outboundDial')_0x2b611e[_0x0acd('0x4a')]=_0x1c335c(_0x44673e,_0x2b611e[_0x0acd('0x4a')]);_0x2b611e['priority']=_0xd81b95[_0x0acd('0x33')]?_[_0x0acd('0x4b')](_0xd81b95)[_0x0acd('0x4c')]+0x1:_0x3949f2;_0x4922ca=_['concat'](_0x4922ca,_0xd81b95,[_0x2b611e],_0x2ca39e);_0x3949f2=_[_0x0acd('0x4b')](_0x4922ca)['priority']+0x1;}return _0x470eba(_0x4922ca);})['catch'](function(_0x2a8589){_0x3f015c(_0x2a8589);});});}return _0x4bd438['define'](_0x0acd('0x4d'),attributes,{'tableName':_0x0acd('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x44307b){var _0x5af26a=this[_0x0acd('0x4f')]({'plain':!![]});var _0x25382a=_0x5af26a[_0x0acd('0x3')]===_0x0acd('0xf')?_0x9ae857(_0x5af26a):_0x1e95fd(_0x5af26a);return _0x4c9d9f(_0x5af26a,_0x44307b,_[_0x0acd('0x4b')](_0x25382a)[_0x0acd('0x4c')]+0x1)[_0x0acd('0x50')](function(_0x253f2e){var _0xbcfe11=_[_0x0acd('0x51')](_0x25382a,_0x253f2e);_0xbcfe11[_0x0acd('0xc')]({'type':_0x5af26a[_0x0acd('0x3')],'app':_0x0acd('0x52'),'exten':_0x5af26a[_0x0acd('0x7')],'context':_0x5af26a[_0x0acd('0x6')],'priority':_[_0x0acd('0x4b')](_0xbcfe11)[_0x0acd('0x4c')]+0x1,'VoiceExtensionId':_0x5af26a['id']});return _0xbcfe11;});}}});}; \ No newline at end of file +var _0x49f8=['callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','queue','includes','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','concat','catch','define','VoiceExtension','voice_extensions','last','Hangup','lodash','./voiceExtension.attributes','models','type','Set','CDR(type)=','context','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','CDR(routeid)=','exten','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','timeout','options','url','length','param','split','phone','prefix','SIP','U(xcally-mixmonitor-context)','replace','join','Interval','interval','IntervalId','then','*,*,*,*','intervals','map','filter','toLowerCase','hasOwnProperty','tag','CDR(tag)='];(function(_0x252cbe,_0x54f1a1){var _0xf72165=function(_0x548288){while(--_0x548288){_0x252cbe['push'](_0x252cbe['shift']());}};_0xf72165(++_0x54f1a1);}(_0x49f8,0x105));var _0x849f=function(_0x5c6244,_0x112ab8){_0x5c6244=_0x5c6244-0x0;var _0x5800ce=_0x49f8[_0x5c6244];return _0x5800ce;};'use strict';var _=require(_0x849f('0x0'));var attributes=require(_0x849f('0x1'));module['exports']=function(_0x5a4c98){var _0x45d0ec=_0x5a4c98[_0x849f('0x2')];function _0x1bc1f6(_0x4a8e0a){var _0x50f17a=0x2;var _0x4a72fa=[{'type':_0x4a8e0a[_0x849f('0x3')],'app':_0x849f('0x4'),'appdata':_0x849f('0x5')+_0x4a8e0a[_0x849f('0x3')],'context':_0x4a8e0a[_0x849f('0x6')],'exten':_0x4a8e0a['exten'],'priority':_0x50f17a++,'VoiceExtensionId':_0x4a8e0a['id']},{'type':_0x4a8e0a['type'],'app':_0x4a8e0a[_0x849f('0x7')]?_0x849f('0x4'):_0x849f('0x8'),'appdata':_0x4a8e0a['alias']?_0x849f('0x9')+_0x4a8e0a[_0x849f('0x7')]:_0x849f('0xa'),'context':_0x4a8e0a['context'],'exten':_0x4a8e0a['exten'],'priority':_0x50f17a++,'VoiceExtensionId':_0x4a8e0a['id']}];if(_0x4a8e0a[_0x849f('0x3')]===_0x849f('0xb')){_0x4a72fa[_0x849f('0xc')]({'type':_0x849f('0xb'),'app':_0x849f('0x4'),'appdata':_0x849f('0xd')+_0x4a8e0a['id'],'context':_0x4a8e0a['context'],'exten':_0x4a8e0a[_0x849f('0xe')],'priority':_0x50f17a++,'VoiceExtensionId':_0x4a8e0a['id']});}_0x4a72fa['push']({'type':_0x4a8e0a['type'],'app':_0x849f('0x4'),'appdata':_0x849f('0xf'),'context':_0x4a8e0a[_0x849f('0x6')],'exten':_0x4a8e0a['exten'],'priority':_0x50f17a++,'VoiceExtensionId':_0x4a8e0a['id']},{'type':_0x4a8e0a[_0x849f('0x3')],'app':_0x849f('0x4'),'appdata':_0x849f('0x10'),'context':_0x4a8e0a[_0x849f('0x6')],'exten':_0x4a8e0a[_0x849f('0xe')],'priority':_0x50f17a++,'VoiceExtensionId':_0x4a8e0a['id']},{'type':_0x4a8e0a[_0x849f('0x3')],'app':_0x849f('0x4'),'appdata':_0x849f('0x11'),'context':_0x4a8e0a[_0x849f('0x6')],'exten':_0x4a8e0a[_0x849f('0xe')],'priority':_0x50f17a++,'VoiceExtensionId':_0x4a8e0a['id']});return _0x4a72fa;}function _0x51ea1b(_0x44f21f){var _0x4a0f3e=0x2;var _0x3e7127=[{'type':'outbound','app':_0x849f('0x4'),'appdata':'CDR(type)=outbound','context':_0x44f21f['context'],'exten':_0x44f21f[_0x849f('0xe')],'priority':_0x4a0f3e++,'VoiceExtensionId':_0x44f21f['id']},{'type':_0x849f('0x12'),'app':_0x44f21f[_0x849f('0x7')]?'Set':_0x849f('0x8'),'appdata':_0x44f21f[_0x849f('0x7')]?'CDR(routeAlias)='+_0x44f21f[_0x849f('0x7')]:_0x849f('0xa'),'context':_0x44f21f[_0x849f('0x6')],'exten':_0x44f21f[_0x849f('0xe')],'priority':_0x4a0f3e++,'VoiceExtensionId':_0x44f21f['id']},{'type':_0x849f('0x12'),'app':_0x849f('0x4'),'appdata':'CDR(destination)='+(_0x44f21f[_0x849f('0x13')]?_0x849f('0x14')+_0x44f21f['cutdigits']+'}':_0x849f('0x15')),'context':_0x44f21f[_0x849f('0x6')],'exten':_0x44f21f[_0x849f('0xe')],'priority':_0x4a0f3e++,'VoiceExtensionId':_0x44f21f['id']},{'type':_0x849f('0x12'),'app':_0x849f('0x4'),'appdata':_0x849f('0xd')+_0x44f21f['id'],'context':_0x44f21f[_0x849f('0x6')],'exten':_0x44f21f[_0x849f('0xe')],'priority':_0x4a0f3e++,'VoiceExtensionId':_0x44f21f['id']},{'type':_0x849f('0x12'),'app':_0x849f('0x16'),'appdata':_0x849f('0x17')+(_0x4a0f3e+0x2)+'):Goto('+(_0x4a0f3e+0x1)+')','context':_0x44f21f['context'],'exten':_0x44f21f[_0x849f('0xe')],'priority':_0x4a0f3e++,'VoiceExtensionId':_0x44f21f['id']},{'type':'outbound','app':_0x849f('0x4'),'appdata':_0x44f21f[_0x849f('0x13')]?_0x849f('0x18')+_0x44f21f[_0x849f('0x13')]+'}':_0x849f('0x19'),'context':_0x44f21f['context'],'exten':_0x44f21f[_0x849f('0xe')],'priority':_0x4a0f3e++,'VoiceExtensionId':_0x44f21f['id']},{'type':_0x849f('0x12'),'app':_0x849f('0x4'),'appdata':_0x849f('0xf'),'context':_0x44f21f['context'],'exten':_0x44f21f[_0x849f('0xe')],'priority':_0x4a0f3e++,'VoiceExtensionId':_0x44f21f['id']},{'type':_0x849f('0x12'),'app':_0x849f('0x4'),'appdata':_0x849f('0x10'),'context':_0x44f21f[_0x849f('0x6')],'exten':_0x44f21f[_0x849f('0xe')],'priority':_0x4a0f3e++,'VoiceExtensionId':_0x44f21f['id']},{'type':'outbound','app':'Set','appdata':_0x849f('0x11'),'context':_0x44f21f[_0x849f('0x6')],'exten':_0x44f21f[_0x849f('0xe')],'priority':_0x4a0f3e++,'VoiceExtensionId':_0x44f21f['id']},{'type':'outbound','app':_0x849f('0x4'),'appdata':'outboundrouteid='+_0x44f21f['id'],'context':_0x44f21f['context'],'exten':_0x44f21f[_0x849f('0xe')],'priority':_0x4a0f3e++,'VoiceExtensionId':_0x44f21f['id']}];if(_0x44f21f['hasOwnProperty'](_0x849f('0x1a'))&&_0x44f21f['recordingFormat']!==_0x849f('0x1b')){_0x3e7127[_0x849f('0xc')]({'type':_0x849f('0x12'),'app':_0x849f('0x4'),'appdata':_0x849f('0x1c'),'context':_0x44f21f['context'],'exten':_0x44f21f[_0x849f('0xe')],'priority':_0x4a0f3e++,'VoiceExtensionId':_0x44f21f['id']},{'type':_0x849f('0x12'),'app':_0x849f('0x4'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x44f21f['recordingFormat']||_0x849f('0x1d'),'context':_0x44f21f[_0x849f('0x6')],'exten':_0x44f21f['exten'],'priority':_0x4a0f3e++,'VoiceExtensionId':_0x44f21f['id']});}return _0x3e7127;}function _0x402e65(_0xc5403c,_0x183de4){var _0x375457=[{'name':_0x849f('0x1e'),'param':0x0},{'name':_0x849f('0x1f'),'param':0x1},{'name':_0x849f('0x20'),'param':0x2},{'name':_0x849f('0x21'),'param':0x3}];var _0x4227f1={};var _0x116453=_0x183de4['split'](',');var _0x23bedd=[];for(var _0x4e3c87=0x0;_0x4e3c87<_0x375457[_0x849f('0x22')];_0x4e3c87++){switch(_0x375457[_0x4e3c87]['name']){case'trunk':_0x4227f1[_0x849f('0x1e')]=_0x116453[_0x375457[_0x4e3c87][_0x849f('0x23')]][_0x849f('0x24')]('/')[0x1];_0x4227f1[_0x849f('0x25')]=_0x116453[_0x375457[_0x4e3c87][_0x849f('0x23')]][_0x849f('0x24')]('/')[0x2];_0x4227f1['prefix']=_0x4227f1['phone']?_0x4227f1[_0x849f('0x25')][_0x849f('0x24')]('$')[0x0]:undefined;_0x4227f1['phone']=_0xc5403c[_0x849f('0x13')]?(_0x4227f1[_0x849f('0x26')]||'')+'${EXTEN:'+_0xc5403c[_0x849f('0x13')]+'}':(_0x4227f1[_0x849f('0x26')]||'')+_0x849f('0x15');_0x23bedd[_0x375457[_0x4e3c87][_0x849f('0x23')]]=[_0x849f('0x27'),_0x4227f1[_0x849f('0x1e')],_0x4227f1['phone']]['join']('/');break;case _0x849f('0x20'):_0x4227f1[_0x849f('0x20')]=_0x116453[_0x375457[_0x4e3c87][_0x849f('0x23')]];if(_0xc5403c[_0x849f('0x1a')]!==_0x849f('0x1b')){if(_0x4227f1[_0x849f('0x20')]['indexOf'](_0x849f('0x28'))<0x0){_0x4227f1['options']+=_0x849f('0x28');}}else{_0x4227f1[_0x849f('0x20')]=_0x4227f1[_0x849f('0x20')][_0x849f('0x29')](_0x849f('0x28'),'');}_0x23bedd[_0x375457[_0x4e3c87][_0x849f('0x23')]]=_0x4227f1[_0x849f('0x20')];break;default:_0x23bedd[_0x375457[_0x4e3c87][_0x849f('0x23')]]=_0x116453[_0x375457[_0x4e3c87][_0x849f('0x23')]];}}return _0x23bedd[_0x849f('0x2a')](',');}function _0x398768(_0x3a3583,_0x1277fa,_0x78fcaf){return new Promise(function(_0x366c1a,_0x5d955b){var _0x1a81eb=[];if(_['isEmpty'](_0x1277fa))return _0x366c1a(_0x1a81eb);_0x45d0ec[_0x849f('0x2b')]['findAll']({'attributes':['id',_0x849f('0x2c'),_0x849f('0x2d')],'raw':!![]})[_0x849f('0x2e')](function(_0x25d02b){for(var _0x543ce1=0x0,_0x16a7ea=0x0;_0x543ce1<_0x1277fa[_0x849f('0x22')];_0x543ce1++,_0x16a7ea=0x0){var _0x4e0345=_0x1277fa[_0x543ce1];var _0x39236c=[];var _0x23b655=[];delete _0x4e0345['id'];if(_0x4e0345[_0x849f('0x2c')]!==_0x849f('0x2f')){_0x4e0345[_0x849f('0x30')]=[_0x4e0345[_0x849f('0x2c')]];}else{_0x4e0345[_0x849f('0x30')]=_0x4e0345[_0x849f('0x2d')]?_[_0x849f('0x31')](_[_0x849f('0x32')](_0x25d02b,{'IntervalId':_0x4e0345[_0x849f('0x2d')]}),_0x849f('0x2c')):[];}_0x4e0345['context']=_0x3a3583['context'];_0x4e0345[_0x849f('0xe')]=_0x3a3583[_0x849f('0xe')];if(_0x4e0345[_0x849f('0x3')])_0x4e0345[_0x849f('0x3')]=_0x4e0345[_0x849f('0x3')][_0x849f('0x33')]();if(_0x3a3583['type']===_0x849f('0x12')){if(_0x4e0345[_0x849f('0x34')](_0x849f('0x35'))&&_0x4e0345[_0x849f('0x35')]&&_0x4e0345[_0x849f('0x35')]!=='--'){_0x39236c[_0x849f('0xc')]({'type':_0x4e0345[_0x849f('0x3')]['toLowerCase'](),'app':_0x849f('0x4'),'appdata':_0x849f('0x36')+_0x4e0345[_0x849f('0x35')],'context':_0x3a3583['context'],'exten':_0x3a3583[_0x849f('0xe')],'priority':_0x4e0345[_0x849f('0x30')][_0x849f('0x22')]+_0x78fcaf+_0x16a7ea++,'VoiceExtensionId':_0x3a3583['id']});}_0x39236c[_0x849f('0xc')]({'type':_0x4e0345[_0x849f('0x3')][_0x849f('0x33')](),'app':_0x849f('0x16'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x4e0345[_0x849f('0x37')]?_0x849f('0x38')+_0x4e0345['callerID']+')':_0x849f('0x39')),'context':_0x3a3583[_0x849f('0x6')],'exten':_0x3a3583['exten'],'priority':_0x4e0345['intervals']['length']+_0x78fcaf+_0x16a7ea++,'VoiceExtensionId':_0x3a3583['id']});}else{if(_0x4e0345[_0x849f('0x34')]('answer')){if([_0x849f('0x3a'),'playback'][_0x849f('0x3b')](_0x4e0345[_0x849f('0x3c')][_0x849f('0x33')]())&&_0x4e0345[_0x849f('0x3d')]!=='custom'){if(_0x4e0345['answer']){_0x39236c[_0x849f('0xc')]({'type':_0x4e0345[_0x849f('0x3')][_0x849f('0x33')](),'app':'ExecIf','appdata':_0x849f('0x3e'),'context':_0x3a3583[_0x849f('0x6')],'exten':_0x3a3583[_0x849f('0xe')],'priority':_0x4e0345[_0x849f('0x30')][_0x849f('0x22')]+_0x78fcaf+_0x16a7ea++,'VoiceExtensionId':_0x3a3583['id']});_0x39236c[_0x849f('0xc')]({'type':_0x4e0345[_0x849f('0x3')][_0x849f('0x33')](),'app':_0x849f('0x4'),'appdata':_0x849f('0x3f'),'context':_0x3a3583[_0x849f('0x6')],'exten':_0x3a3583[_0x849f('0xe')],'priority':_0x4e0345[_0x849f('0x30')][_0x849f('0x22')]+_0x78fcaf+_0x16a7ea++,'VoiceExtensionId':_0x3a3583['id']});}else{_0x39236c[_0x849f('0xc')]({'type':_0x4e0345['type']['toLowerCase'](),'app':'ExecIf','appdata':_0x849f('0x40'),'context':_0x3a3583[_0x849f('0x6')],'exten':_0x3a3583['exten'],'priority':_0x4e0345['intervals'][_0x849f('0x22')]+_0x78fcaf+_0x16a7ea++,'VoiceExtensionId':_0x3a3583['id']});_0x39236c[_0x849f('0xc')]({'type':_0x4e0345[_0x849f('0x3')]['toLowerCase'](),'app':_0x849f('0x4'),'appdata':_0x849f('0x41'),'context':_0x3a3583[_0x849f('0x6')],'exten':_0x3a3583['exten'],'priority':_0x4e0345['intervals']['length']+_0x78fcaf+_0x16a7ea++,'VoiceExtensionId':_0x3a3583['id']});}}}}for(var _0x1458a9=0x0;_0x1458a9<_0x4e0345[_0x849f('0x30')][_0x849f('0x22')];_0x1458a9++){var _0x22ae90=_0x78fcaf+_0x4e0345[_0x849f('0x30')][_0x849f('0x22')];var _0x51319a=_0x1458a9===_0x4e0345[_0x849f('0x30')][_0x849f('0x22')]-0x1?_0x78fcaf+_0x39236c[_0x849f('0x22')]+_0x23b655['length']+0x2:_0x78fcaf+_0x1458a9+0x1;_0x39236c[_0x849f('0x42')](_0x1458a9,0x0,{'type':_0x3a3583[_0x849f('0x3')],'app':_0x849f('0x43'),'appdata':_0x4e0345[_0x849f('0x30')][_0x1458a9]+'?'+_0x3a3583[_0x849f('0x6')]+_0x849f('0x44')+_0x22ae90+':'+_0x3a3583[_0x849f('0x6')]+_0x849f('0x44')+_0x51319a,'exten':_0x3a3583[_0x849f('0xe')],'context':_0x3a3583[_0x849f('0x6')],'priority':_0x78fcaf+_0x1458a9,'VoiceExtensionId':_0x3a3583['id']});}if(_0x4e0345[_0x849f('0x3d')]===_0x849f('0x45'))_0x4e0345[_0x849f('0x46')]=_0x402e65(_0x3a3583,_0x4e0345[_0x849f('0x46')]);_0x4e0345[_0x849f('0x47')]=_0x39236c[_0x849f('0x22')]?_['last'](_0x39236c)['priority']+0x1:_0x78fcaf;_0x1a81eb=_[_0x849f('0x48')](_0x1a81eb,_0x39236c,[_0x4e0345],_0x23b655);_0x78fcaf=_['last'](_0x1a81eb)[_0x849f('0x47')]+0x1;}return _0x366c1a(_0x1a81eb);})[_0x849f('0x49')](function(_0x54506c){_0x5d955b(_0x54506c);});});}return _0x5a4c98[_0x849f('0x4a')](_0x849f('0x4b'),attributes,{'tableName':_0x849f('0x4c'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x8850c2){var _0x26a41e=this['get']({'plain':!![]});var _0x5a19a=_0x26a41e[_0x849f('0x3')]===_0x849f('0x12')?_0x51ea1b(_0x26a41e):_0x1bc1f6(_0x26a41e);return _0x398768(_0x26a41e,_0x8850c2,_[_0x849f('0x4d')](_0x5a19a)['priority']+0x1)[_0x849f('0x2e')](function(_0x437b19){var _0x160d3=_[_0x849f('0x48')](_0x5a19a,_0x437b19);_0x160d3[_0x849f('0xc')]({'type':_0x26a41e['type'],'app':_0x849f('0x4e'),'exten':_0x26a41e[_0x849f('0xe')],'context':_0x26a41e['context'],'priority':_['last'](_0x160d3)[_0x849f('0x47')]+0x1,'VoiceExtensionId':_0x26a41e['id']});return _0x160d3;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index e70815c..f6dd5c5 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 _0x398a=['attributes','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','limit','include','map','model'];(function(_0x276f91,_0x8282da){var _0x310f0c=function(_0x189a1d){while(--_0x189a1d){_0x276f91['push'](_0x276f91['shift']());}};_0x310f0c(++_0x8282da);}(_0x398a,0x11a));var _0xa398=function(_0x1fec50,_0x3063f3){_0x1fec50=_0x1fec50-0x0;var _0x1f5d00=_0x398a[_0x1fec50];return _0x1f5d00;};'use strict';var _=require(_0xa398('0x0'));var util=require(_0xa398('0x1'));var moment=require(_0xa398('0x2'));var BPromise=require(_0xa398('0x3'));var rs=require(_0xa398('0x4'));var fs=require('fs');var Redis=require(_0xa398('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa398('0x6'));var config=require(_0xa398('0x7'));var jayson=require(_0xa398('0x8'));var client=jayson[_0xa398('0x9')][_0xa398('0xa')]({'port':0x232a});config[_0xa398('0xb')]=_[_0xa398('0xc')](config[_0xa398('0xb')],{'host':_0xa398('0xd'),'port':0x18eb});var socket=require(_0xa398('0xe'))(new Redis(config['redis']));require(_0xa398('0xf'))[_0xa398('0x10')](socket);function respondWithRpcPromise(_0x3a6762,_0x111da8,_0x1025c8){return new BPromise(function(_0xf248f5,_0x3ccd2c){return client['request'](_0x3a6762,_0x1025c8)[_0xa398('0x11')](function(_0x35fc22){logger[_0xa398('0x12')](_0xa398('0x13'),_0x111da8,_0xa398('0x14'));logger[_0xa398('0x15')](_0xa398('0x16'),_0x111da8,_0xa398('0x14'),JSON['stringify'](_0x35fc22));if(_0x35fc22[_0xa398('0x17')]){if(_0x35fc22[_0xa398('0x17')][_0xa398('0x18')]===0x1f4){logger[_0xa398('0x17')](_0xa398('0x13'),_0x111da8,_0x35fc22[_0xa398('0x17')][_0xa398('0x19')]);return _0x3ccd2c(_0x35fc22[_0xa398('0x17')]['message']);}logger[_0xa398('0x17')](_0xa398('0x13'),_0x111da8,_0x35fc22['error'][_0xa398('0x19')]);return _0xf248f5(_0x35fc22[_0xa398('0x17')][_0xa398('0x19')]);}else{logger[_0xa398('0x12')](_0xa398('0x13'),_0x111da8,_0xa398('0x14'));_0xf248f5(_0x35fc22[_0xa398('0x1a')][_0xa398('0x19')]);}})[_0xa398('0x1b')](function(_0xddf9e4){logger['error'](_0xa398('0x13'),_0x111da8,_0xddf9e4);_0x3ccd2c(_0xddf9e4);});});}exports[_0xa398('0x1c')]=function(_0x5e1ccf){var _0x4967ba=this;return new Promise(function(_0x62bee8,_0x4e21bc){return db[_0xa398('0x1d')][_0xa398('0x1e')]({'raw':_0x5e1ccf[_0xa398('0x1f')]?_0x5e1ccf[_0xa398('0x1f')][_0xa398('0x20')]===undefined?!![]:![]:!![],'where':_0x5e1ccf['options']?_0x5e1ccf[_0xa398('0x1f')][_0xa398('0x21')]||null:null,'attributes':_0x5e1ccf['options']?_0x5e1ccf['options']['attributes']||null:null,'limit':_0x5e1ccf[_0xa398('0x1f')]?_0x5e1ccf[_0xa398('0x1f')][_0xa398('0x22')]||null:null,'include':_0x5e1ccf['options']?_0x5e1ccf[_0xa398('0x1f')][_0xa398('0x23')]?_[_0xa398('0x24')](_0x5e1ccf[_0xa398('0x1f')]['include'],function(_0x311a77){return{'model':db[_0x311a77[_0xa398('0x25')]],'as':_0x311a77['as'],'attributes':_0x311a77[_0xa398('0x26')],'include':_0x311a77[_0xa398('0x23')]?_[_0xa398('0x24')](_0x311a77[_0xa398('0x23')],function(_0x3005fd){return{'model':db[_0x3005fd[_0xa398('0x25')]],'as':_0x3005fd['as'],'attributes':_0x3005fd[_0xa398('0x26')],'include':_0x3005fd['include']?_[_0xa398('0x24')](_0x3005fd[_0xa398('0x23')],function(_0x215ca6){return{'model':db[_0x215ca6[_0xa398('0x25')]],'as':_0x215ca6['as'],'attributes':_0x215ca6[_0xa398('0x26')]};}):[]};}):[]};}):[]:[]})[_0xa398('0x11')](function(_0x598851){logger[_0xa398('0x12')]('GetVoiceExtension',_0x5e1ccf);logger[_0xa398('0x15')]('GetVoiceExtension',_0x5e1ccf,JSON[_0xa398('0x27')](_0x598851));_0x62bee8(_0x598851);})[_0xa398('0x1b')](function(_0x4674d9){logger[_0xa398('0x17')](_0xa398('0x1c'),_0x4674d9[_0xa398('0x19')],_0x5e1ccf);_0x4e21bc(_0x4967ba['error'](0x1f4,_0x4674d9[_0xa398('0x19')]));});});}; \ No newline at end of file +var _0xbb67=['GetVoiceExtension','stringify','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','message','result','catch','VoiceExtension','findAll','options','raw','attributes','limit','include','map','model'];(function(_0x1892f1,_0x10767b){var _0x51e13d=function(_0x5174f1){while(--_0x5174f1){_0x1892f1['push'](_0x1892f1['shift']());}};_0x51e13d(++_0x10767b);}(_0xbb67,0x161));var _0x7bb6=function(_0x1ce215,_0x2badb3){_0x1ce215=_0x1ce215-0x0;var _0x347d73=_0xbb67[_0x1ce215];return _0x347d73;};'use strict';var _=require('lodash');var util=require(_0x7bb6('0x0'));var moment=require(_0x7bb6('0x1'));var BPromise=require(_0x7bb6('0x2'));var rs=require(_0x7bb6('0x3'));var fs=require('fs');var Redis=require(_0x7bb6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7bb6('0x5'));var logger=require(_0x7bb6('0x6'))(_0x7bb6('0x7'));var config=require(_0x7bb6('0x8'));var jayson=require(_0x7bb6('0x9'));var client=jayson[_0x7bb6('0xa')][_0x7bb6('0xb')]({'port':0x232a});config[_0x7bb6('0xc')]=_['defaults'](config[_0x7bb6('0xc')],{'host':_0x7bb6('0xd'),'port':0x18eb});var socket=require(_0x7bb6('0xe'))(new Redis(config[_0x7bb6('0xc')]));require(_0x7bb6('0xf'))[_0x7bb6('0x10')](socket);function respondWithRpcPromise(_0x2ffdaa,_0x17eee7,_0x14a6af){return new BPromise(function(_0x4fce9e,_0x3dc93c){return client[_0x7bb6('0x11')](_0x2ffdaa,_0x14a6af)[_0x7bb6('0x12')](function(_0x46be82){logger[_0x7bb6('0x13')](_0x7bb6('0x14'),_0x17eee7,_0x7bb6('0x15'));logger[_0x7bb6('0x16')](_0x7bb6('0x17'),_0x17eee7,'request\x20sent',JSON['stringify'](_0x46be82));if(_0x46be82[_0x7bb6('0x18')]){if(_0x46be82[_0x7bb6('0x18')]['code']===0x1f4){logger[_0x7bb6('0x18')](_0x7bb6('0x14'),_0x17eee7,_0x46be82[_0x7bb6('0x18')][_0x7bb6('0x19')]);return _0x3dc93c(_0x46be82[_0x7bb6('0x18')][_0x7bb6('0x19')]);}logger['error'](_0x7bb6('0x14'),_0x17eee7,_0x46be82[_0x7bb6('0x18')][_0x7bb6('0x19')]);return _0x4fce9e(_0x46be82[_0x7bb6('0x18')][_0x7bb6('0x19')]);}else{logger[_0x7bb6('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x17eee7,_0x7bb6('0x15'));_0x4fce9e(_0x46be82[_0x7bb6('0x1a')][_0x7bb6('0x19')]);}})[_0x7bb6('0x1b')](function(_0x392a00){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x17eee7,_0x392a00);_0x3dc93c(_0x392a00);});});}exports['GetVoiceExtension']=function(_0x15eafb){var _0x88e054=this;return new Promise(function(_0x118e9e,_0x30eb86){return db[_0x7bb6('0x1c')][_0x7bb6('0x1d')]({'raw':_0x15eafb['options']?_0x15eafb[_0x7bb6('0x1e')][_0x7bb6('0x1f')]===undefined?!![]:![]:!![],'where':_0x15eafb['options']?_0x15eafb['options']['where']||null:null,'attributes':_0x15eafb[_0x7bb6('0x1e')]?_0x15eafb[_0x7bb6('0x1e')][_0x7bb6('0x20')]||null:null,'limit':_0x15eafb['options']?_0x15eafb[_0x7bb6('0x1e')][_0x7bb6('0x21')]||null:null,'include':_0x15eafb[_0x7bb6('0x1e')]?_0x15eafb[_0x7bb6('0x1e')][_0x7bb6('0x22')]?_[_0x7bb6('0x23')](_0x15eafb['options'][_0x7bb6('0x22')],function(_0x515091){return{'model':db[_0x515091[_0x7bb6('0x24')]],'as':_0x515091['as'],'attributes':_0x515091[_0x7bb6('0x20')],'include':_0x515091['include']?_[_0x7bb6('0x23')](_0x515091[_0x7bb6('0x22')],function(_0x3896ba){return{'model':db[_0x3896ba['model']],'as':_0x3896ba['as'],'attributes':_0x3896ba[_0x7bb6('0x20')],'include':_0x3896ba['include']?_['map'](_0x3896ba[_0x7bb6('0x22')],function(_0x13fad0){return{'model':db[_0x13fad0[_0x7bb6('0x24')]],'as':_0x13fad0['as'],'attributes':_0x13fad0[_0x7bb6('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7bb6('0x12')](function(_0x3684eb){logger['info'](_0x7bb6('0x25'),_0x15eafb);logger['debug'](_0x7bb6('0x25'),_0x15eafb,JSON[_0x7bb6('0x26')](_0x3684eb));_0x118e9e(_0x3684eb);})[_0x7bb6('0x1b')](function(_0x4f3763){logger[_0x7bb6('0x18')](_0x7bb6('0x25'),_0x4f3763[_0x7bb6('0x19')],_0x15eafb);_0x30eb86(_0x88e054[_0x7bb6('0x18')](0x1f4,_0x4f3763['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index c2bf0ce..7549635 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['remove','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x540e55,_0x5c8fe4){var _0x4386da=function(_0x3ee574){while(--_0x3ee574){_0x540e55['push'](_0x540e55['shift']());}};_0x4386da(++_0x5c8fe4);}(_0x7a54,0x106));var _0x47a5=function(_0x4d5a90,_0x36e5d8){_0x4d5a90=_0x4d5a90-0x0;var _0x998697=_0x7a54[_0x4d5a90];return _0x998697;};'use strict';var VoiceExtensionEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){VoiceExtensionEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);VoiceExtensionEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file +var _0x1cb9=['update','emit','removeListener','register','length','./voiceExtension.events','remove'];(function(_0x247fa1,_0x4ec37c){var _0x244f35=function(_0xfb98be){while(--_0xfb98be){_0x247fa1['push'](_0x247fa1['shift']());}};_0x244f35(++_0x4ec37c);}(_0x1cb9,0x14e));var _0x91cb=function(_0x46f394,_0x1ba6ff){_0x46f394=_0x46f394-0x0;var _0x3e9e2e=_0x1cb9[_0x46f394];return _0x3e9e2e;};'use strict';var VoiceExtensionEvents=require(_0x91cb('0x0'));var events=['save',_0x91cb('0x1'),_0x91cb('0x2')];function createListener(_0x2b1894,_0x351bdb){return function(_0x57ea48){_0x351bdb[_0x91cb('0x3')](_0x2b1894,_0x57ea48);};}function removeListener(_0x2b7314,_0x5652cd){return function(){VoiceExtensionEvents[_0x91cb('0x4')](_0x2b7314,_0x5652cd);};}exports[_0x91cb('0x5')]=function(_0x186dc3){for(var _0x28543e=0x0,_0x3b9d98=events[_0x91cb('0x6')];_0x28543e<_0x3b9d98;_0x28543e++){var _0x4c1f56=events[_0x28543e];var _0x15c517=createListener('voiceExtension:'+_0x4c1f56,_0x186dc3);VoiceExtensionEvents['on'](_0x4c1f56,_0x15c517);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 71269fe..0baa5ec 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 _0x0424=['delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','./voiceMail.controller','get','isAuthenticated','index','/:id','/:id/messages','getMessages','create','put','update'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x0424,0x159));var _0x4042=function(_0x273987,_0x44056f){_0x273987=_0x273987-0x0;var _0x50ebc7=_0x0424[_0x273987];return _0x50ebc7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4042('0x0'));var timeout=require(_0x4042('0x1'));var express=require(_0x4042('0x2'));var router=express[_0x4042('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4042('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4042('0x5'));router[_0x4042('0x6')]('/',auth[_0x4042('0x7')](),controller[_0x4042('0x8')]);router[_0x4042('0x6')](_0x4042('0x9'),auth[_0x4042('0x7')](),controller['show']);router['get'](_0x4042('0xa'),auth[_0x4042('0x7')](),controller[_0x4042('0xb')]);router['post']('/',auth[_0x4042('0x7')](),controller[_0x4042('0xc')]);router[_0x4042('0xd')](_0x4042('0x9'),auth[_0x4042('0x7')](),controller[_0x4042('0xe')]);router[_0x4042('0xf')](_0x4042('0x9'),auth['isAuthenticated'](),controller[_0x4042('0x10')]);module[_0x4042('0x11')]=router; \ No newline at end of file +var _0x958a=['Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','getMessages','post','create','put','update','delete','destroy','multer','util','connect-timeout','express'];(function(_0x4e14d1,_0x2608b8){var _0x156a6c=function(_0x3f0eda){while(--_0x3f0eda){_0x4e14d1['push'](_0x4e14d1['shift']());}};_0x156a6c(++_0x2608b8);}(_0x958a,0x128));var _0xa958=function(_0x26b474,_0xb0f478){_0x26b474=_0x26b474-0x0;var _0x2cc468=_0x958a[_0x26b474];return _0x2cc468;};'use strict';var multer=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var path=require('path');var timeout=require(_0xa958('0x2'));var express=require(_0xa958('0x3'));var router=express[_0xa958('0x4')]();var fs_extra=require(_0xa958('0x5'));var auth=require(_0xa958('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa958('0x7'));var controller=require('./voiceMail.controller');router[_0xa958('0x8')]('/',auth[_0xa958('0x9')](),controller[_0xa958('0xa')]);router[_0xa958('0x8')](_0xa958('0xb'),auth[_0xa958('0x9')](),controller[_0xa958('0xc')]);router['get']('/:id/messages',auth[_0xa958('0x9')](),controller[_0xa958('0xd')]);router[_0xa958('0xe')]('/',auth[_0xa958('0x9')](),controller[_0xa958('0xf')]);router[_0xa958('0x10')](_0xa958('0xb'),auth[_0xa958('0x9')](),controller[_0xa958('0x11')]);router[_0xa958('0x12')](_0xa958('0xb'),auth[_0xa958('0x9')](),controller[_0xa958('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index a5699b1..1281f2a 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 _0x4a3e=['email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','\x20-\x20','sequelize','from-voicemail','contest_mailbox','STRING','setDataValue'];(function(_0x37bcf9,_0x4d1a77){var _0x5049d3=function(_0x1a14c7){while(--_0x1a14c7){_0x37bcf9['push'](_0x37bcf9['shift']());}};_0x5049d3(++_0x4d1a77);}(_0x4a3e,0x15b));var _0xe4a3=function(_0x4de834,_0x54c229){_0x4de834=_0x4de834-0x0;var _0x169d97=_0x4a3e[_0x4de834];return _0x169d97;};'use strict';var Sequelize=require(_0xe4a3('0x0'));module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING'],'defaultValue':_0xe4a3('0x1'),'unique':_0xe4a3('0x2')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0xe4a3('0x2')},'password':{'type':Sequelize[_0xe4a3('0x3')]},'fullname':{'type':Sequelize[_0xe4a3('0x3')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x497d4f){this[_0xe4a3('0x4')](_0xe4a3('0x5'),typeof _0x497d4f===_0xe4a3('0x6')&&_0x497d4f[_0xe4a3('0x7')]()?_0x497d4f[_0xe4a3('0x7')]():null);}},'pager':{'type':Sequelize[_0xe4a3('0x3')]},'tz':{'type':Sequelize[_0xe4a3('0x3')],'defaultValue':_0xe4a3('0x8')},'attach':{'type':Sequelize[_0xe4a3('0x9')]('yes','no'),'defaultValue':_0xe4a3('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0xe4a3('0x9')](_0xe4a3('0xa'),'no'),'defaultValue':_0xe4a3('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0xe4a3('0x3')]},'callback':{'type':Sequelize[_0xe4a3('0x3')]},'review':{'type':Sequelize[_0xe4a3('0x9')](_0xe4a3('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xe4a3('0x9')](_0xe4a3('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0xe4a3('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xe4a3('0x9')](_0xe4a3('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xe4a3('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0xe4a3('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xe4a3('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xe4a3('0x9')](_0xe4a3('0xa'),'no'),'defaultValue':_0xe4a3('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0xe4a3('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xe4a3('0x9')](_0xe4a3('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xe4a3('0x9')](_0xe4a3('0xa'),'no'),'defaultValue':_0xe4a3('0xa'),'allowNull':![]},'stamp':{'type':_0xe4a3('0xc')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0xe4a3('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xe4a3('0xe')]('fullname')+_0xe4a3('0xf')+this['getDataValue']('mailbox');}}}; \ No newline at end of file +var _0x5c28=['INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue','mailbox','sequelize','exports','STRING','from-voicemail','email','trim','central','ENUM','yes','TIMESTAMP'];(function(_0x3f9241,_0x46ec7f){var _0x40a146=function(_0x47c456){while(--_0x47c456){_0x3f9241['push'](_0x3f9241['shift']());}};_0x40a146(++_0x46ec7f);}(_0x5c28,0xd6));var _0x85c2=function(_0x3d2324,_0x23ca33){_0x3d2324=_0x3d2324-0x0;var _0x2ae194=_0x5c28[_0x3d2324];return _0x2ae194;};'use strict';var Sequelize=require(_0x85c2('0x0'));module[_0x85c2('0x1')]={'customer_id':{'type':Sequelize[_0x85c2('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x85c2('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x85c2('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x85c2('0x2')]},'fullname':{'type':Sequelize[_0x85c2('0x2')]},'email':{'type':Sequelize[_0x85c2('0x2')],'validate':{'isEmail':!![]},'set':function(_0x29b9f6){this['setDataValue'](_0x85c2('0x4'),typeof _0x29b9f6==='string'&&_0x29b9f6[_0x85c2('0x5')]()?_0x29b9f6[_0x85c2('0x5')]():null);}},'pager':{'type':Sequelize[_0x85c2('0x2')]},'tz':{'type':Sequelize[_0x85c2('0x2')],'defaultValue':_0x85c2('0x6')},'attach':{'type':Sequelize[_0x85c2('0x7')]('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x85c2('0x7')]('yes','no'),'defaultValue':_0x85c2('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x85c2('0x2')]},'callback':{'type':Sequelize[_0x85c2('0x2')]},'review':{'type':Sequelize[_0x85c2('0x7')](_0x85c2('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x85c2('0x7')](_0x85c2('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x85c2('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x85c2('0x7')](_0x85c2('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x85c2('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x85c2('0x7')](_0x85c2('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x85c2('0x8'),'no'),'defaultValue':_0x85c2('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x85c2('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x85c2('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x85c2('0x7')]('yes','no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x85c2('0x9')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x85c2('0x2')]},'maxsecs':{'type':Sequelize[_0x85c2('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x85c2('0xb')],'get':function(){return this['getDataValue'](_0x85c2('0xc'))+_0x85c2('0xd')+this[_0x85c2('0xe')](_0x85c2('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 9fa8fab..22a5727 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 _0xab40=['intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','VoiceMail','count','include','findAll','rows','catch','show','params','length','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','mailbox','VoiceMailMessage','findAndCountAll','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','apply','reject','save','then','get','UserProfileResource','destroy','error','stack','name','rawAttributes','fieldName','model','query','keys','filters'];(function(_0x18ef43,_0x24ad45){var _0x499363=function(_0x3c3742){while(--_0x3c3742){_0x18ef43['push'](_0x18ef43['shift']());}};_0x499363(++_0x24ad45);}(_0xab40,0xcd));var _0x0ab4=function(_0x3b9eb8,_0x518e43){_0x3b9eb8=_0x3b9eb8-0x0;var _0x48b2bd=_0xab40[_0x3b9eb8];return _0x48b2bd;};'use strict';var emlformat=require(_0x0ab4('0x0'));var rimraf=require(_0x0ab4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0ab4('0x2'));var BPromise=require(_0x0ab4('0x3'));var Mustache=require(_0x0ab4('0x4'));var util=require(_0x0ab4('0x5'));var path=require(_0x0ab4('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0ab4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ab4('0x8'));var squel=require(_0x0ab4('0x9'));var crypto=require(_0x0ab4('0xa'));var jsforce=require(_0x0ab4('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0ab4('0xc'));var Redis=require(_0x0ab4('0xd'));var authService=require(_0x0ab4('0xe'));var qs=require(_0x0ab4('0xf'));var as=require(_0x0ab4('0x10'));var hardwareService=require(_0x0ab4('0x11'));var logger=require(_0x0ab4('0x12'))(_0x0ab4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0ab4('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x249dc3,_0x45e6fd){_0x45e6fd=_0x45e6fd||0xcc;return function(_0x1e7555){if(_0x1e7555){return _0x249dc3[_0x0ab4('0x15')](_0x45e6fd);}return _0x249dc3[_0x0ab4('0x16')](_0x45e6fd)[_0x0ab4('0x17')]();};}function respondWithResult(_0x112162,_0x2cc644){_0x2cc644=_0x2cc644||0xc8;return function(_0x3cb1df){if(_0x3cb1df){return _0x112162[_0x0ab4('0x16')](_0x2cc644)[_0x0ab4('0x18')](_0x3cb1df);}};}function respondWithFilteredResult(_0x36d246,_0x293e20){return function(_0x45fad1){if(_0x45fad1){var _0x2a83a8=typeof _0x293e20[_0x0ab4('0x19')]===_0x0ab4('0x1a')&&typeof _0x293e20[_0x0ab4('0x1b')]==='undefined';var _0x5000d4=_0x45fad1['count'];var _0x17422f=_0x2a83a8?0x0:_0x293e20[_0x0ab4('0x19')];var _0x2f50d2=_0x2a83a8?_0x45fad1['count']:_0x293e20[_0x0ab4('0x19')]+_0x293e20[_0x0ab4('0x1b')];var _0x212ebd;if(_0x2f50d2>=_0x5000d4){_0x2f50d2=_0x5000d4;_0x212ebd=0xc8;}else{_0x212ebd=0xce;}_0x36d246[_0x0ab4('0x16')](_0x212ebd);return _0x36d246['set']('Content-Range',_0x17422f+'-'+_0x2f50d2+'/'+_0x5000d4)[_0x0ab4('0x18')](_0x45fad1);}return null;};}function patchUpdates(_0x5b1ed5){return function(_0x2b0e29){try{jsonpatch[_0x0ab4('0x1c')](_0x2b0e29,_0x5b1ed5,!![]);}catch(_0x5bb1d0){return BPromise[_0x0ab4('0x1d')](_0x5bb1d0);}return _0x2b0e29[_0x0ab4('0x1e')]();};}function saveUpdates(_0x2c55b3,_0x1d5c14){return function(_0x12d06d){if(_0x12d06d){return _0x12d06d['update'](_0x2c55b3)['then'](function(_0x24b929){return _0x24b929;});}return null;};}function removeEntity(_0x14087f,_0x392afe){return function(_0x13c882){if(_0x13c882){return _0x13c882['destroy']()[_0x0ab4('0x1f')](function(){var _0x3caa9d=_0x13c882[_0x0ab4('0x20')]({'plain':!![]});var _0x4ea9aa='Voicemails';return db[_0x0ab4('0x21')][_0x0ab4('0x22')]({'where':{'type':_0x4ea9aa,'resourceId':_0x3caa9d['id']}})[_0x0ab4('0x1f')](function(){return _0x13c882;});})['then'](function(){_0x14087f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x19ecc6,_0x5ba3a2){return function(_0x3bf844){if(!_0x3bf844){_0x19ecc6[_0x0ab4('0x15')](0x194);}return _0x3bf844;};}function handleError(_0x4f1aeb,_0x4bd747){_0x4bd747=_0x4bd747||0x1f4;return function(_0x4d0cc1){logger[_0x0ab4('0x23')](_0x4d0cc1[_0x0ab4('0x24')]);if(_0x4d0cc1[_0x0ab4('0x25')]){delete _0x4d0cc1[_0x0ab4('0x25')];}_0x4f1aeb[_0x0ab4('0x16')](_0x4bd747)['send'](_0x4d0cc1);};}exports['index']=function(_0x580d56,_0x2e7a97){var _0x2b66d5={},_0x155d96={},_0x182bbe={'count':0x0,'rows':[]};var _0x46eda7=_['map'](db['VoiceMail'][_0x0ab4('0x26')],function(_0xe6682){return{'name':_0xe6682[_0x0ab4('0x27')],'type':_0xe6682['type']['key']};});_0x155d96[_0x0ab4('0x28')]=_['map'](_0x46eda7,_0x0ab4('0x25'));_0x155d96[_0x0ab4('0x29')]=_[_0x0ab4('0x2a')](_0x580d56[_0x0ab4('0x29')]);_0x155d96[_0x0ab4('0x2b')]=_[_0x0ab4('0x2c')](_0x155d96['model'],_0x155d96[_0x0ab4('0x29')]);_0x2b66d5[_0x0ab4('0x2d')]=_[_0x0ab4('0x2c')](_0x155d96[_0x0ab4('0x28')],qs['fields'](_0x580d56['query'][_0x0ab4('0x2e')]));_0x2b66d5[_0x0ab4('0x2d')]=_0x2b66d5[_0x0ab4('0x2d')]['length']?_0x2b66d5['attributes']:_0x155d96['model'];if(!_0x580d56[_0x0ab4('0x29')][_0x0ab4('0x2f')](_0x0ab4('0x30'))){_0x2b66d5['limit']=qs['limit'](_0x580d56['query'][_0x0ab4('0x1b')]);_0x2b66d5[_0x0ab4('0x19')]=qs[_0x0ab4('0x19')](_0x580d56[_0x0ab4('0x29')][_0x0ab4('0x19')]);}_0x2b66d5[_0x0ab4('0x31')]=qs[_0x0ab4('0x32')](_0x580d56[_0x0ab4('0x29')][_0x0ab4('0x32')]);_0x2b66d5[_0x0ab4('0x33')]=qs['filters'](_[_0x0ab4('0x34')](_0x580d56[_0x0ab4('0x29')],_0x155d96[_0x0ab4('0x2b')]),_0x46eda7);if(_0x580d56[_0x0ab4('0x29')][_0x0ab4('0x35')]){_0x2b66d5[_0x0ab4('0x33')]=_[_0x0ab4('0x36')](_0x2b66d5[_0x0ab4('0x33')],{'$or':_[_0x0ab4('0x37')](_0x46eda7,function(_0x3774ca){if(_0x3774ca[_0x0ab4('0x38')]!==_0x0ab4('0x39')){var _0x4a05c4={};_0x4a05c4[_0x3774ca[_0x0ab4('0x25')]]={'$like':'%'+_0x580d56[_0x0ab4('0x29')][_0x0ab4('0x35')]+'%'};return _0x4a05c4;}})});}_0x2b66d5=_[_0x0ab4('0x36')]({},_0x2b66d5,_0x580d56['options']);var _0x42bece={'where':_0x2b66d5['where']};return db[_0x0ab4('0x3a')][_0x0ab4('0x3b')](_0x42bece)[_0x0ab4('0x1f')](function(_0x245021){_0x182bbe[_0x0ab4('0x3b')]=_0x245021;if(_0x580d56[_0x0ab4('0x29')]['includeAll']){_0x2b66d5[_0x0ab4('0x3c')]=[{'all':!![]}];}return db[_0x0ab4('0x3a')][_0x0ab4('0x3d')](_0x2b66d5);})['then'](function(_0x395e0b){_0x182bbe[_0x0ab4('0x3e')]=_0x395e0b;return _0x182bbe;})[_0x0ab4('0x1f')](respondWithFilteredResult(_0x2e7a97,_0x2b66d5))[_0x0ab4('0x3f')](handleError(_0x2e7a97,null));};exports[_0x0ab4('0x40')]=function(_0x5aa047,_0x5d70eb){var _0x498845={'raw':!![],'where':{'id':_0x5aa047[_0x0ab4('0x41')]['id']}},_0x2f54dd={};_0x2f54dd['model']=_[_0x0ab4('0x2a')](db['VoiceMail'][_0x0ab4('0x26')]);_0x2f54dd['query']=_[_0x0ab4('0x2a')](_0x5aa047[_0x0ab4('0x29')]);_0x2f54dd[_0x0ab4('0x2b')]=_[_0x0ab4('0x2c')](_0x2f54dd[_0x0ab4('0x28')],_0x2f54dd[_0x0ab4('0x29')]);_0x498845['attributes']=_[_0x0ab4('0x2c')](_0x2f54dd[_0x0ab4('0x28')],qs[_0x0ab4('0x2e')](_0x5aa047[_0x0ab4('0x29')][_0x0ab4('0x2e')]));_0x498845[_0x0ab4('0x2d')]=_0x498845['attributes'][_0x0ab4('0x42')]?_0x498845['attributes']:_0x2f54dd[_0x0ab4('0x28')];if(_0x5aa047[_0x0ab4('0x29')][_0x0ab4('0x43')]){_0x498845['include']=[{'all':!![]}];}_0x498845=_[_0x0ab4('0x36')]({},_0x498845,_0x5aa047[_0x0ab4('0x44')]);return db[_0x0ab4('0x3a')][_0x0ab4('0x45')](_0x498845)[_0x0ab4('0x1f')](handleEntityNotFound(_0x5d70eb,null))[_0x0ab4('0x1f')](respondWithResult(_0x5d70eb,null))['catch'](handleError(_0x5d70eb,null));};exports[_0x0ab4('0x46')]=function(_0xdcc118,_0x302894){return db[_0x0ab4('0x3a')][_0x0ab4('0x46')](_0xdcc118[_0x0ab4('0x47')],{})[_0x0ab4('0x1f')](function(_0x356bc9){var _0x22402e=_0xdcc118[_0x0ab4('0x48')][_0x0ab4('0x20')]({'plain':!![]});if(!_0x22402e)throw new Error(_0x0ab4('0x49'));if(_0x22402e[_0x0ab4('0x4a')]==='user'){var _0x2c3a0a=_0x356bc9[_0x0ab4('0x20')]({'plain':!![]});var _0x5800cc=_0x0ab4('0x4b');return db['UserProfileSection']['find']({'where':{'name':_0x5800cc,'userProfileId':_0x22402e[_0x0ab4('0x4c')]},'raw':!![]})[_0x0ab4('0x1f')](function(_0x156e22){if(_0x156e22&&_0x156e22['autoAssociation']===0x0){return db[_0x0ab4('0x21')][_0x0ab4('0x46')]({'name':_0x2c3a0a[_0x0ab4('0x25')],'resourceId':_0x2c3a0a['id'],'type':_0x156e22[_0x0ab4('0x25')],'sectionId':_0x156e22['id']},{})[_0x0ab4('0x1f')](function(){return _0x356bc9;});}else{return _0x356bc9;}})[_0x0ab4('0x3f')](function(_0x1eea3b){logger['error'](_0x0ab4('0x4d'),_0x1eea3b);throw _0x1eea3b;});}return _0x356bc9;})['then'](respondWithResult(_0x302894,0xc9))[_0x0ab4('0x3f')](handleError(_0x302894,null));};exports['update']=function(_0x2597f2,_0x5550ff){if(_0x2597f2['body']['id']){delete _0x2597f2[_0x0ab4('0x47')]['id'];}return db[_0x0ab4('0x3a')][_0x0ab4('0x45')]({'where':{'id':_0x2597f2[_0x0ab4('0x41')]['id']}})['then'](handleEntityNotFound(_0x5550ff,null))[_0x0ab4('0x1f')](saveUpdates(_0x2597f2[_0x0ab4('0x47')],null))[_0x0ab4('0x1f')](respondWithResult(_0x5550ff,null))[_0x0ab4('0x3f')](handleError(_0x5550ff,null));};exports[_0x0ab4('0x22')]=function(_0x2354fa,_0x134437){return db[_0x0ab4('0x3a')][_0x0ab4('0x45')]({'where':{'id':_0x2354fa[_0x0ab4('0x41')]['id']}})[_0x0ab4('0x1f')](handleEntityNotFound(_0x134437,null))[_0x0ab4('0x1f')](removeEntity(_0x134437,null))[_0x0ab4('0x3f')](handleError(_0x134437,null));};exports[_0x0ab4('0x4e')]=function(_0x438f38,_0x1e5635,_0x340558){return db[_0x0ab4('0x3a')][_0x0ab4('0x4f')]({'where':{'id':_0x438f38['params']['id']}})[_0x0ab4('0x1f')](handleEntityNotFound(_0x1e5635,null))[_0x0ab4('0x1f')](function(_0x3eba1e){var _0x308f7a;var _0x32e38c={},_0x3bcb90={};_0x3bcb90[_0x0ab4('0x28')]=_[_0x0ab4('0x2a')](db['VoiceMailMessage'][_0x0ab4('0x26')]);_0x3bcb90[_0x0ab4('0x29')]=_['keys'](_0x438f38['query']);_0x3bcb90[_0x0ab4('0x2b')]=_[_0x0ab4('0x2c')](_0x3bcb90['model'],_0x3bcb90['query']);_0x32e38c[_0x0ab4('0x2d')]=_['intersection'](_0x3bcb90['model'],qs[_0x0ab4('0x2e')](_0x438f38[_0x0ab4('0x29')][_0x0ab4('0x2e')]));_0x32e38c[_0x0ab4('0x2d')]=_0x32e38c[_0x0ab4('0x2d')][_0x0ab4('0x42')]?_0x32e38c[_0x0ab4('0x2d')]:_0x3bcb90['model'];if(!_0x438f38[_0x0ab4('0x29')][_0x0ab4('0x2f')](_0x0ab4('0x30'))){_0x32e38c[_0x0ab4('0x1b')]=qs[_0x0ab4('0x1b')](_0x438f38[_0x0ab4('0x29')]['limit']);_0x32e38c[_0x0ab4('0x19')]=qs[_0x0ab4('0x19')](_0x438f38['query'][_0x0ab4('0x19')]);}_0x32e38c['order']=qs[_0x0ab4('0x32')](_0x438f38['query'][_0x0ab4('0x32')]);_0x32e38c[_0x0ab4('0x33')]=qs[_0x0ab4('0x2b')](_[_0x0ab4('0x34')](_0x438f38['query'],_0x3bcb90['filters']));if(_0x438f38[_0x0ab4('0x29')][_0x0ab4('0x35')]){_0x32e38c['where']=_[_0x0ab4('0x36')](_0x32e38c[_0x0ab4('0x33')],{'$or':_[_0x0ab4('0x37')](_0x32e38c['attributes'],function(_0x295490){var _0xd3fb04={};_0xd3fb04[_0x295490]={'$like':'%'+_0x438f38[_0x0ab4('0x29')][_0x0ab4('0x35')]+'%'};return _0xd3fb04;})});}_0x32e38c[_0x0ab4('0x33')]=_[_0x0ab4('0x36')](_0x32e38c[_0x0ab4('0x33')],{'mailboxuser':_0x3eba1e[_0x0ab4('0x50')]});_0x32e38c=_['merge']({},_0x32e38c,_0x438f38['options']);return db[_0x0ab4('0x51')][_0x0ab4('0x52')](_0x32e38c)[_0x0ab4('0x1f')](respondWithFilteredResult(_0x1e5635,_0x32e38c));})[_0x0ab4('0x3f')](handleError(_0x1e5635,null));}; \ No newline at end of file +var _0xefda=['sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','Voicemails','UserProfileResource','error','stack','name','send','map','VoiceMail','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','length','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','getMessages','VoiceMailMessage','mailbox','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x17d45b,_0x41abad){var _0x2755ca=function(_0x45879d){while(--_0x45879d){_0x17d45b['push'](_0x17d45b['shift']());}};_0x2755ca(++_0x41abad);}(_0xefda,0x96));var _0xaefd=function(_0x518239,_0x55b1d8){_0x518239=_0x518239-0x0;var _0x3f6d66=_0xefda[_0x518239];return _0x3f6d66;};'use strict';var emlformat=require(_0xaefd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaefd('0x1'));var rp=require(_0xaefd('0x2'));var moment=require('moment');var BPromise=require(_0xaefd('0x3'));var Mustache=require(_0xaefd('0x4'));var util=require(_0xaefd('0x5'));var path=require(_0xaefd('0x6'));var sox=require(_0xaefd('0x7'));var csv=require(_0xaefd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaefd('0x9'));var _=require(_0xaefd('0xa'));var squel=require(_0xaefd('0xb'));var crypto=require(_0xaefd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xaefd('0xd'));var toCsv=require(_0xaefd('0x8'));var querystring=require(_0xaefd('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaefd('0xf'));var as=require(_0xaefd('0x10'));var hardwareService=require(_0xaefd('0x11'));var logger=require(_0xaefd('0x12'))(_0xaefd('0x13'));var utils=require(_0xaefd('0x14'));var config=require(_0xaefd('0x15'));var licenseUtil=require(_0xaefd('0x16'));var db=require(_0xaefd('0x17'))['db'];function respondWithStatusCode(_0x382983,_0x2a310c){_0x2a310c=_0x2a310c||0xcc;return function(_0x4b2b5c){if(_0x4b2b5c){return _0x382983[_0xaefd('0x18')](_0x2a310c);}return _0x382983['status'](_0x2a310c)[_0xaefd('0x19')]();};}function respondWithResult(_0x1725af,_0x9dfdf6){_0x9dfdf6=_0x9dfdf6||0xc8;return function(_0x43b82a){if(_0x43b82a){return _0x1725af['status'](_0x9dfdf6)[_0xaefd('0x1a')](_0x43b82a);}};}function respondWithFilteredResult(_0x13492c,_0x41f345){return function(_0x411701){if(_0x411701){var _0x10ee28=typeof _0x41f345[_0xaefd('0x1b')]===_0xaefd('0x1c')&&typeof _0x41f345[_0xaefd('0x1d')]==='undefined';var _0x9d9c29=_0x411701[_0xaefd('0x1e')];var _0x9748f4=_0x10ee28?0x0:_0x41f345[_0xaefd('0x1b')];var _0x2db61b=_0x10ee28?_0x411701[_0xaefd('0x1e')]:_0x41f345['offset']+_0x41f345[_0xaefd('0x1d')];var _0x182f9a;if(_0x2db61b>=_0x9d9c29){_0x2db61b=_0x9d9c29;_0x182f9a=0xc8;}else{_0x182f9a=0xce;}_0x13492c[_0xaefd('0x1f')](_0x182f9a);return _0x13492c[_0xaefd('0x20')](_0xaefd('0x21'),_0x9748f4+'-'+_0x2db61b+'/'+_0x9d9c29)[_0xaefd('0x1a')](_0x411701);}return null;};}function patchUpdates(_0x5282ed){return function(_0x463d48){try{jsonpatch[_0xaefd('0x22')](_0x463d48,_0x5282ed,!![]);}catch(_0x2dcdd8){return BPromise[_0xaefd('0x23')](_0x2dcdd8);}return _0x463d48[_0xaefd('0x24')]();};}function saveUpdates(_0x577fb7,_0x479486){return function(_0x5b9967){if(_0x5b9967){return _0x5b9967[_0xaefd('0x25')](_0x577fb7)[_0xaefd('0x26')](function(_0x313a6f){return _0x313a6f;});}return null;};}function removeEntity(_0x5a44ed,_0x23060f){return function(_0x4cd9b2){if(_0x4cd9b2){return _0x4cd9b2[_0xaefd('0x27')]()[_0xaefd('0x26')](function(){var _0x1a05eb=_0x4cd9b2['get']({'plain':!![]});var _0x435413=_0xaefd('0x28');return db[_0xaefd('0x29')][_0xaefd('0x27')]({'where':{'type':_0x435413,'resourceId':_0x1a05eb['id']}})[_0xaefd('0x26')](function(){return _0x4cd9b2;});})['then'](function(){_0x5a44ed[_0xaefd('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x810bf,_0x16f10f){return function(_0x5470bd){if(!_0x5470bd){_0x810bf[_0xaefd('0x18')](0x194);}return _0x5470bd;};}function handleError(_0x2a8fa8,_0x521839){_0x521839=_0x521839||0x1f4;return function(_0xbeb1b8){logger[_0xaefd('0x2a')](_0xbeb1b8[_0xaefd('0x2b')]);if(_0xbeb1b8['name']){delete _0xbeb1b8[_0xaefd('0x2c')];}_0x2a8fa8['status'](_0x521839)[_0xaefd('0x2d')](_0xbeb1b8);};}exports['index']=function(_0x4a1acb,_0x1d89c4){var _0x1b470c={},_0x4a032d={},_0x578378={'count':0x0,'rows':[]};var _0x4ee0c1=_[_0xaefd('0x2e')](db[_0xaefd('0x2f')]['rawAttributes'],function(_0x5503d0){return{'name':_0x5503d0[_0xaefd('0x30')],'type':_0x5503d0[_0xaefd('0x31')][_0xaefd('0x32')]};});_0x4a032d[_0xaefd('0x33')]=_['map'](_0x4ee0c1,_0xaefd('0x2c'));_0x4a032d[_0xaefd('0x34')]=_[_0xaefd('0x35')](_0x4a1acb[_0xaefd('0x34')]);_0x4a032d[_0xaefd('0x36')]=_[_0xaefd('0x37')](_0x4a032d[_0xaefd('0x33')],_0x4a032d[_0xaefd('0x34')]);_0x1b470c[_0xaefd('0x38')]=_[_0xaefd('0x37')](_0x4a032d[_0xaefd('0x33')],qs[_0xaefd('0x39')](_0x4a1acb[_0xaefd('0x34')][_0xaefd('0x39')]));_0x1b470c[_0xaefd('0x38')]=_0x1b470c[_0xaefd('0x38')]['length']?_0x1b470c[_0xaefd('0x38')]:_0x4a032d[_0xaefd('0x33')];if(!_0x4a1acb[_0xaefd('0x34')]['hasOwnProperty'](_0xaefd('0x3a'))){_0x1b470c['limit']=qs[_0xaefd('0x1d')](_0x4a1acb[_0xaefd('0x34')][_0xaefd('0x1d')]);_0x1b470c[_0xaefd('0x1b')]=qs[_0xaefd('0x1b')](_0x4a1acb[_0xaefd('0x34')][_0xaefd('0x1b')]);}_0x1b470c[_0xaefd('0x3b')]=qs[_0xaefd('0x3c')](_0x4a1acb[_0xaefd('0x34')][_0xaefd('0x3c')]);_0x1b470c[_0xaefd('0x3d')]=qs[_0xaefd('0x36')](_[_0xaefd('0x3e')](_0x4a1acb['query'],_0x4a032d[_0xaefd('0x36')]),_0x4ee0c1);if(_0x4a1acb['query'][_0xaefd('0x3f')]){_0x1b470c[_0xaefd('0x3d')]=_[_0xaefd('0x40')](_0x1b470c[_0xaefd('0x3d')],{'$or':_[_0xaefd('0x2e')](_0x4ee0c1,function(_0x3c9331){if(_0x3c9331[_0xaefd('0x31')]!==_0xaefd('0x41')){var _0x3c7022={};_0x3c7022[_0x3c9331[_0xaefd('0x2c')]]={'$like':'%'+_0x4a1acb['query'][_0xaefd('0x3f')]+'%'};return _0x3c7022;}})});}_0x1b470c=_[_0xaefd('0x40')]({},_0x1b470c,_0x4a1acb['options']);var _0x427f00={'where':_0x1b470c[_0xaefd('0x3d')]};return db[_0xaefd('0x2f')]['count'](_0x427f00)['then'](function(_0x43b6a6){_0x578378[_0xaefd('0x1e')]=_0x43b6a6;if(_0x4a1acb[_0xaefd('0x34')][_0xaefd('0x42')]){_0x1b470c[_0xaefd('0x43')]=[{'all':!![]}];}return db[_0xaefd('0x2f')][_0xaefd('0x44')](_0x1b470c);})[_0xaefd('0x26')](function(_0x48a7af){_0x578378[_0xaefd('0x45')]=_0x48a7af;return _0x578378;})[_0xaefd('0x26')](respondWithFilteredResult(_0x1d89c4,_0x1b470c))[_0xaefd('0x46')](handleError(_0x1d89c4,null));};exports[_0xaefd('0x47')]=function(_0x20d5fd,_0x197f3f){var _0x3633ec={'raw':!![],'where':{'id':_0x20d5fd['params']['id']}},_0x1f4a15={};_0x1f4a15['model']=_[_0xaefd('0x35')](db[_0xaefd('0x2f')]['rawAttributes']);_0x1f4a15['query']=_[_0xaefd('0x35')](_0x20d5fd[_0xaefd('0x34')]);_0x1f4a15[_0xaefd('0x36')]=_[_0xaefd('0x37')](_0x1f4a15[_0xaefd('0x33')],_0x1f4a15[_0xaefd('0x34')]);_0x3633ec[_0xaefd('0x38')]=_[_0xaefd('0x37')](_0x1f4a15[_0xaefd('0x33')],qs['fields'](_0x20d5fd[_0xaefd('0x34')][_0xaefd('0x39')]));_0x3633ec[_0xaefd('0x38')]=_0x3633ec[_0xaefd('0x38')][_0xaefd('0x48')]?_0x3633ec[_0xaefd('0x38')]:_0x1f4a15[_0xaefd('0x33')];if(_0x20d5fd['query'][_0xaefd('0x42')]){_0x3633ec['include']=[{'all':!![]}];}_0x3633ec=_[_0xaefd('0x40')]({},_0x3633ec,_0x20d5fd[_0xaefd('0x49')]);return db[_0xaefd('0x2f')][_0xaefd('0x4a')](_0x3633ec)['then'](handleEntityNotFound(_0x197f3f,null))['then'](respondWithResult(_0x197f3f,null))[_0xaefd('0x46')](handleError(_0x197f3f,null));};exports[_0xaefd('0x4b')]=function(_0x179b8b,_0x4eeb56){return db[_0xaefd('0x2f')][_0xaefd('0x4b')](_0x179b8b['body'],{})[_0xaefd('0x26')](function(_0xf2783d){var _0x3c6a3e=_0x179b8b[_0xaefd('0x4c')][_0xaefd('0x4d')]({'plain':!![]});if(!_0x3c6a3e)throw new Error(_0xaefd('0x4e'));if(_0x3c6a3e[_0xaefd('0x4f')]===_0xaefd('0x4c')){var _0x4dc674=_0xf2783d['get']({'plain':!![]});var _0x1406b8=_0xaefd('0x28');return db['UserProfileSection'][_0xaefd('0x4a')]({'where':{'name':_0x1406b8,'userProfileId':_0x3c6a3e['userProfileId']},'raw':!![]})[_0xaefd('0x26')](function(_0x47296d){if(_0x47296d&&_0x47296d[_0xaefd('0x50')]===0x0){return db[_0xaefd('0x29')][_0xaefd('0x4b')]({'name':_0x4dc674[_0xaefd('0x2c')],'resourceId':_0x4dc674['id'],'type':_0x47296d['name'],'sectionId':_0x47296d['id']},{})['then'](function(){return _0xf2783d;});}else{return _0xf2783d;}})[_0xaefd('0x46')](function(_0x338823){logger['error'](_0xaefd('0x51'),_0x338823);throw _0x338823;});}return _0xf2783d;})[_0xaefd('0x26')](respondWithResult(_0x4eeb56,0xc9))[_0xaefd('0x46')](handleError(_0x4eeb56,null));};exports[_0xaefd('0x25')]=function(_0x4a883b,_0x583caa){if(_0x4a883b[_0xaefd('0x52')]['id']){delete _0x4a883b[_0xaefd('0x52')]['id'];}return db[_0xaefd('0x2f')][_0xaefd('0x4a')]({'where':{'id':_0x4a883b[_0xaefd('0x53')]['id']}})['then'](handleEntityNotFound(_0x583caa,null))[_0xaefd('0x26')](saveUpdates(_0x4a883b[_0xaefd('0x52')],null))['then'](respondWithResult(_0x583caa,null))[_0xaefd('0x46')](handleError(_0x583caa,null));};exports[_0xaefd('0x27')]=function(_0x5f2925,_0x108e35){return db[_0xaefd('0x2f')][_0xaefd('0x4a')]({'where':{'id':_0x5f2925['params']['id']}})[_0xaefd('0x26')](handleEntityNotFound(_0x108e35,null))[_0xaefd('0x26')](removeEntity(_0x108e35,null))['catch'](handleError(_0x108e35,null));};exports[_0xaefd('0x54')]=function(_0x21b65c,_0x14b472,_0x2dd1ee){return db['VoiceMail']['findOne']({'where':{'id':_0x21b65c[_0xaefd('0x53')]['id']}})[_0xaefd('0x26')](handleEntityNotFound(_0x14b472,null))[_0xaefd('0x26')](function(_0x3e1673){var _0x4189c4;var _0x8ab9e7={},_0x314660={};_0x314660[_0xaefd('0x33')]=_[_0xaefd('0x35')](db[_0xaefd('0x55')]['rawAttributes']);_0x314660['query']=_[_0xaefd('0x35')](_0x21b65c[_0xaefd('0x34')]);_0x314660[_0xaefd('0x36')]=_[_0xaefd('0x37')](_0x314660['model'],_0x314660[_0xaefd('0x34')]);_0x8ab9e7[_0xaefd('0x38')]=_[_0xaefd('0x37')](_0x314660[_0xaefd('0x33')],qs[_0xaefd('0x39')](_0x21b65c[_0xaefd('0x34')][_0xaefd('0x39')]));_0x8ab9e7[_0xaefd('0x38')]=_0x8ab9e7['attributes'][_0xaefd('0x48')]?_0x8ab9e7[_0xaefd('0x38')]:_0x314660[_0xaefd('0x33')];if(!_0x21b65c[_0xaefd('0x34')]['hasOwnProperty'](_0xaefd('0x3a'))){_0x8ab9e7['limit']=qs[_0xaefd('0x1d')](_0x21b65c[_0xaefd('0x34')]['limit']);_0x8ab9e7['offset']=qs[_0xaefd('0x1b')](_0x21b65c['query']['offset']);}_0x8ab9e7['order']=qs[_0xaefd('0x3c')](_0x21b65c[_0xaefd('0x34')][_0xaefd('0x3c')]);_0x8ab9e7[_0xaefd('0x3d')]=qs[_0xaefd('0x36')](_[_0xaefd('0x3e')](_0x21b65c['query'],_0x314660['filters']));if(_0x21b65c['query']['filter']){_0x8ab9e7[_0xaefd('0x3d')]=_['merge'](_0x8ab9e7[_0xaefd('0x3d')],{'$or':_['map'](_0x8ab9e7[_0xaefd('0x38')],function(_0x32dc0d){var _0x416241={};_0x416241[_0x32dc0d]={'$like':'%'+_0x21b65c[_0xaefd('0x34')][_0xaefd('0x3f')]+'%'};return _0x416241;})});}_0x8ab9e7[_0xaefd('0x3d')]=_[_0xaefd('0x40')](_0x8ab9e7['where'],{'mailboxuser':_0x3e1673[_0xaefd('0x56')]});_0x8ab9e7=_[_0xaefd('0x40')]({},_0x8ab9e7,_0x21b65c[_0xaefd('0x49')]);return db[_0xaefd('0x55')]['findAndCountAll'](_0x8ab9e7)[_0xaefd('0x26')](respondWithFilteredResult(_0x14b472,_0x8ab9e7));})['catch'](handleError(_0x14b472,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 1333d18..597e9cb 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 _0x5d9b=['context','../../config/logger','api','moment','request-promise','path','rimraf','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox'];(function(_0x4cdc7e,_0x5d2257){var _0x3718ea=function(_0x2ffcd9){while(--_0x2ffcd9){_0x4cdc7e['push'](_0x4cdc7e['shift']());}};_0x3718ea(++_0x5d2257);}(_0x5d9b,0x119));var _0xb5d9=function(_0x24acf2,_0x5ef162){_0x24acf2=_0x24acf2-0x0;var _0x16fef7=_0x5d9b[_0x24acf2];return _0x16fef7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb5d9('0x0'))(_0xb5d9('0x1'));var moment=require(_0xb5d9('0x2'));var BPromise=require('bluebird');var rp=require(_0xb5d9('0x3'));var fs=require('fs');var path=require(_0xb5d9('0x4'));var rimraf=require(_0xb5d9('0x5'));var config=require('../../config/environment');var attributes=require(_0xb5d9('0x6'));module[_0xb5d9('0x7')]=function(_0x552589,_0x256137){return _0x552589[_0xb5d9('0x8')](_0xb5d9('0x9'),attributes,{'tableName':_0xb5d9('0xa'),'paranoid':![],'indexes':[{'name':_0xb5d9('0xb'),'fields':[_0xb5d9('0xc'),_0xb5d9('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x647e=['request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','VoiceMail','context','util','api','moment'];(function(_0x1b4a12,_0x2be253){var _0x2b9694=function(_0x941088){while(--_0x941088){_0x1b4a12['push'](_0x1b4a12['shift']());}};_0x2b9694(++_0x2be253);}(_0x647e,0x110));var _0xe647=function(_0x159eee,_0x4fd0a9){_0x159eee=_0x159eee-0x0;var _0x19c234=_0x647e[_0x159eee];return _0x19c234;};'use strict';var _=require('lodash');var util=require(_0xe647('0x0'));var logger=require('../../config/logger')(_0xe647('0x1'));var moment=require(_0xe647('0x2'));var BPromise=require('bluebird');var rp=require(_0xe647('0x3'));var fs=require('fs');var path=require(_0xe647('0x4'));var rimraf=require(_0xe647('0x5'));var config=require(_0xe647('0x6'));var attributes=require(_0xe647('0x7'));module[_0xe647('0x8')]=function(_0x5b6588,_0x1308fc){return _0x5b6588['define'](_0xe647('0x9'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox',_0xe647('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index db385e4..e971cbb 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 _0x9ad6=['http','request','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x44045f,_0x40fb95){var _0xd9fe42=function(_0x1f4471){while(--_0x1f4471){_0x44045f['push'](_0x44045f['shift']());}};_0xd9fe42(++_0x40fb95);}(_0x9ad6,0xfc));var _0x69ad=function(_0x30f6fd,_0x21ffdf){_0x30f6fd=_0x30f6fd-0x0;var _0xfa2c6e=_0x9ad6[_0x30f6fd];return _0xfa2c6e;};'use strict';var _=require(_0x69ad('0x0'));var util=require(_0x69ad('0x1'));var moment=require('moment');var BPromise=require(_0x69ad('0x2'));var rs=require(_0x69ad('0x3'));var fs=require('fs');var Redis=require(_0x69ad('0x4'));var db=require(_0x69ad('0x5'))['db'];var utils=require(_0x69ad('0x6'));var logger=require(_0x69ad('0x7'))(_0x69ad('0x8'));var config=require(_0x69ad('0x9'));var jayson=require(_0x69ad('0xa'));var client=jayson[_0x69ad('0xb')][_0x69ad('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36bd7f,_0x5b002e,_0x352fbc){return new BPromise(function(_0x5443bb,_0x195771){return client[_0x69ad('0xd')](_0x36bd7f,_0x352fbc)['then'](function(_0x3fa5b6){logger[_0x69ad('0xe')]('VoiceMail,\x20%s,\x20%s',_0x5b002e,_0x69ad('0xf'));logger[_0x69ad('0x10')](_0x69ad('0x11'),_0x5b002e,_0x69ad('0xf'),JSON[_0x69ad('0x12')](_0x3fa5b6));if(_0x3fa5b6[_0x69ad('0x13')]){if(_0x3fa5b6[_0x69ad('0x13')][_0x69ad('0x14')]===0x1f4){logger[_0x69ad('0x13')](_0x69ad('0x15'),_0x5b002e,_0x3fa5b6[_0x69ad('0x13')]['message']);return _0x195771(_0x3fa5b6[_0x69ad('0x13')][_0x69ad('0x16')]);}logger[_0x69ad('0x13')](_0x69ad('0x15'),_0x5b002e,_0x3fa5b6[_0x69ad('0x13')][_0x69ad('0x16')]);return _0x5443bb(_0x3fa5b6['error'][_0x69ad('0x16')]);}else{logger[_0x69ad('0xe')](_0x69ad('0x15'),_0x5b002e,_0x69ad('0xf'));_0x5443bb(_0x3fa5b6[_0x69ad('0x17')][_0x69ad('0x16')]);}})['catch'](function(_0x27ac36){logger[_0x69ad('0x13')](_0x69ad('0x15'),_0x5b002e,_0x27ac36);_0x195771(_0x27ac36);});});} \ No newline at end of file +var _0x757a=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','lodash','util','bluebird'];(function(_0x1fdeb4,_0x354b6b){var _0x1e99e8=function(_0x351cc3){while(--_0x351cc3){_0x1fdeb4['push'](_0x1fdeb4['shift']());}};_0x1e99e8(++_0x354b6b);}(_0x757a,0xb1));var _0xa757=function(_0x1887a5,_0x2ce578){_0x1887a5=_0x1887a5-0x0;var _0x1a98a8=_0x757a[_0x1887a5];return _0x1a98a8;};'use strict';var _=require(_0xa757('0x0'));var util=require(_0xa757('0x1'));var moment=require('moment');var BPromise=require(_0xa757('0x2'));var rs=require(_0xa757('0x3'));var fs=require('fs');var Redis=require(_0xa757('0x4'));var db=require(_0xa757('0x5'))['db'];var utils=require(_0xa757('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xa757('0x7'));var jayson=require(_0xa757('0x8'));var client=jayson[_0xa757('0x9')][_0xa757('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2af2e9,_0x46b21c,_0x18a5b8){return new BPromise(function(_0x407b24,_0x5850fe){return client['request'](_0x2af2e9,_0x18a5b8)[_0xa757('0xb')](function(_0x2f7594){logger['info'](_0xa757('0xc'),_0x46b21c,_0xa757('0xd'));logger[_0xa757('0xe')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x46b21c,_0xa757('0xd'),JSON[_0xa757('0xf')](_0x2f7594));if(_0x2f7594[_0xa757('0x10')]){if(_0x2f7594[_0xa757('0x10')]['code']===0x1f4){logger[_0xa757('0x10')](_0xa757('0xc'),_0x46b21c,_0x2f7594[_0xa757('0x10')][_0xa757('0x11')]);return _0x5850fe(_0x2f7594[_0xa757('0x10')][_0xa757('0x11')]);}logger[_0xa757('0x10')]('VoiceMail,\x20%s,\x20%s',_0x46b21c,_0x2f7594['error']['message']);return _0x407b24(_0x2f7594[_0xa757('0x10')][_0xa757('0x11')]);}else{logger['info'](_0xa757('0xc'),_0x46b21c,_0xa757('0xd'));_0x407b24(_0x2f7594['result'][_0xa757('0x11')]);}})['catch'](function(_0x15bb15){logger[_0xa757('0x10')](_0xa757('0xc'),_0x46b21c,_0x15bb15);_0x5850fe(_0x15bb15);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 1a5764c..739ee11 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 _0x97a7=['get','isAuthenticated','/:id','download','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./voiceMailMessage.controller'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x97a7,0x1f0));var _0x797a=function(_0x2baec6,_0x493893){_0x2baec6=_0x2baec6-0x0;var _0xb2c874=_0x97a7[_0x2baec6];return _0xb2c874;};'use strict';var multer=require(_0x797a('0x0'));var util=require(_0x797a('0x1'));var path=require(_0x797a('0x2'));var timeout=require(_0x797a('0x3'));var express=require(_0x797a('0x4'));var router=express[_0x797a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x797a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x797a('0x7'));router[_0x797a('0x8')]('/',auth[_0x797a('0x9')](),controller['index']);router[_0x797a('0x8')](_0x797a('0xa'),auth[_0x797a('0x9')](),controller['show']);router[_0x797a('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x797a('0xb')]);router[_0x797a('0xc')]('/',auth[_0x797a('0x9')](),controller[_0x797a('0xd')]);router[_0x797a('0xe')](_0x797a('0xa'),auth[_0x797a('0x9')](),controller[_0x797a('0xf')]);router[_0x797a('0x10')](_0x797a('0xa'),auth[_0x797a('0x9')](),controller['destroy']);module[_0x797a('0x11')]=router; \ No newline at end of file +var _0xa290=['Router','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','express'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0xa290,0xfe));var _0x0a29=function(_0x10ac8f,_0x47ce8e){_0x10ac8f=_0x10ac8f-0x0;var _0x3e928c=_0xa290[_0x10ac8f];return _0x3e928c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a29('0x0'));var router=express[_0x0a29('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0a29('0x2'));var controller=require(_0x0a29('0x3'));router[_0x0a29('0x4')]('/',auth[_0x0a29('0x5')](),controller[_0x0a29('0x6')]);router[_0x0a29('0x4')](_0x0a29('0x7'),auth[_0x0a29('0x5')](),controller[_0x0a29('0x8')]);router[_0x0a29('0x4')](_0x0a29('0x9'),auth[_0x0a29('0x5')](),controller[_0x0a29('0xa')]);router[_0x0a29('0xb')]('/',auth[_0x0a29('0x5')](),controller[_0x0a29('0xc')]);router[_0x0a29('0xd')](_0x0a29('0x7'),auth[_0x0a29('0x5')](),controller[_0x0a29('0xe')]);router[_0x0a29('0xf')]('/:id',auth[_0x0a29('0x5')](),controller[_0x0a29('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index e36b495..ba8b99f 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 _0xb3e8=['exports','VIRTUAL','INTEGER','STRING','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xb3e8,0x179));var _0x8b3e=function(_0xb60674,_0xa4e08a){_0xb60674=_0xb60674-0x0;var _0x2514a0=_0xb3e8[_0xb60674];return _0x2514a0;};'use strict';var Sequelize=require(_0x8b3e('0x0'));module[_0x8b3e('0x1')]={'name':{'type':Sequelize[_0x8b3e('0x2')],'get':function(_0x5a09f9){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x8b3e('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x8b3e('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x8b3e('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x8b3e('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x8b3e('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x8b3e('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x8b3e('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x8b3e('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB']('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x8b3e('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x8b3e('0x4')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0x8b3e('0x5')](_0x8b3e('0x6'))}}; \ No newline at end of file +var _0xdc45=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','INTEGER','STRING','BLOB'];(function(_0x40e91d,_0x1f5d73){var _0x1bd593=function(_0x135dce){while(--_0x135dce){_0x40e91d['push'](_0x40e91d['shift']());}};_0x1bd593(++_0x1f5d73);}(_0xdc45,0xf1));var _0x5dc4=function(_0x25a1b3,_0x2986bf){_0x25a1b3=_0x25a1b3-0x0;var _0x45e4f7=_0xdc45[_0x25a1b3];return _0x45e4f7;};'use strict';var Sequelize=require(_0x5dc4('0x0'));module[_0x5dc4('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x18ce29){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x5dc4('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x5dc4('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x5dc4('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x5dc4('0x3')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x5dc4('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x5dc4('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x5dc4('0x4')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x5dc4('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize['literal'](_0x5dc4('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index dc1a296..2707d54 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 _0x7cf6=['limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','catch','show','params','includeAll','include','options','create','body','find','download','recording','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','msg_id','Content-Disposition','send','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x7cf6,0x8c));var _0x67cf=function(_0x373522,_0x2437db){_0x373522=_0x373522-0x0;var _0x31c3c4=_0x7cf6[_0x373522];return _0x31c3c4;};'use strict';var emlformat=require(_0x67cf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x67cf('0x1'));var jsonpatch=require(_0x67cf('0x2'));var rp=require(_0x67cf('0x3'));var moment=require(_0x67cf('0x4'));var BPromise=require(_0x67cf('0x5'));var Mustache=require(_0x67cf('0x6'));var util=require(_0x67cf('0x7'));var path=require('path');var sox=require(_0x67cf('0x8'));var csv=require('to-csv');var ejs=require(_0x67cf('0x9'));var fs=require('fs');var fs_extra=require(_0x67cf('0xa'));var _=require(_0x67cf('0xb'));var squel=require(_0x67cf('0xc'));var crypto=require(_0x67cf('0xd'));var jsforce=require(_0x67cf('0xe'));var deskjs=require(_0x67cf('0xf'));var toCsv=require(_0x67cf('0x10'));var querystring=require(_0x67cf('0x11'));var Papa=require(_0x67cf('0x12'));var Redis=require(_0x67cf('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x67cf('0x14'));var as=require(_0x67cf('0x15'));var hardwareService=require(_0x67cf('0x16'));var logger=require('../../config/logger')(_0x67cf('0x17'));var utils=require(_0x67cf('0x18'));var config=require(_0x67cf('0x19'));var licenseUtil=require(_0x67cf('0x1a'));var db=require(_0x67cf('0x1b'))['db'];function respondWithStatusCode(_0x3e27d5,_0xed1e8a){_0xed1e8a=_0xed1e8a||0xcc;return function(_0x59a805){if(_0x59a805){return _0x3e27d5[_0x67cf('0x1c')](_0xed1e8a);}return _0x3e27d5['status'](_0xed1e8a)[_0x67cf('0x1d')]();};}function respondWithResult(_0x431d09,_0x313785){_0x313785=_0x313785||0xc8;return function(_0x1ba54b){if(_0x1ba54b){return _0x431d09[_0x67cf('0x1e')](_0x313785)[_0x67cf('0x1f')](_0x1ba54b);}};}function respondWithFilteredResult(_0x2f3c9a,_0x50c43c){return function(_0x898223){if(_0x898223){var _0x4448bf=typeof _0x50c43c[_0x67cf('0x20')]===_0x67cf('0x21')&&typeof _0x50c43c[_0x67cf('0x22')]===_0x67cf('0x21');var _0x502ec3=_0x898223[_0x67cf('0x23')];var _0x4da0be=_0x4448bf?0x0:_0x50c43c[_0x67cf('0x20')];var _0x25127e=_0x4448bf?_0x898223[_0x67cf('0x23')]:_0x50c43c[_0x67cf('0x20')]+_0x50c43c['limit'];var _0x1db93d;if(_0x25127e>=_0x502ec3){_0x25127e=_0x502ec3;_0x1db93d=0xc8;}else{_0x1db93d=0xce;}_0x2f3c9a['status'](_0x1db93d);return _0x2f3c9a[_0x67cf('0x24')](_0x67cf('0x25'),_0x4da0be+'-'+_0x25127e+'/'+_0x502ec3)[_0x67cf('0x1f')](_0x898223);}return null;};}function patchUpdates(_0x118568){return function(_0x4762f1){try{jsonpatch[_0x67cf('0x26')](_0x4762f1,_0x118568,!![]);}catch(_0x2d464c){return BPromise['reject'](_0x2d464c);}return _0x4762f1[_0x67cf('0x27')]();};}function saveUpdates(_0x1319ce,_0x1c2d4a){return function(_0x548bcb){if(_0x548bcb){return _0x548bcb[_0x67cf('0x28')](_0x1319ce)[_0x67cf('0x29')](function(_0x52d2a6){return _0x52d2a6;});}return null;};}function removeEntity(_0x459d1f,_0x3740a8){return function(_0x40a8ba){if(_0x40a8ba){return _0x40a8ba[_0x67cf('0x2a')]()['then'](function(){_0x459d1f[_0x67cf('0x1e')](0xcc)[_0x67cf('0x1d')]();});}};}function handleEntityNotFound(_0x10c0ec,_0x47feee){return function(_0x201438){if(!_0x201438){_0x10c0ec[_0x67cf('0x1c')](0x194);}return _0x201438;};}function handleError(_0x246b5e,_0x45a1b9){_0x45a1b9=_0x45a1b9||0x1f4;return function(_0x4dea1a){logger[_0x67cf('0x2b')](_0x4dea1a[_0x67cf('0x2c')]);if(_0x4dea1a[_0x67cf('0x2d')]){delete _0x4dea1a[_0x67cf('0x2d')];}_0x246b5e[_0x67cf('0x1e')](_0x45a1b9)['send'](_0x4dea1a);};}exports['index']=function(_0x390a51,_0x442f15){var _0x31eac9={},_0x3f16c8={},_0x62b0ac={'count':0x0,'rows':[]};var _0x16fccc=_['map'](db[_0x67cf('0x2e')][_0x67cf('0x2f')],function(_0x17a961){return{'name':_0x17a961[_0x67cf('0x30')],'type':_0x17a961[_0x67cf('0x31')][_0x67cf('0x32')]};});_0x3f16c8[_0x67cf('0x33')]=_[_0x67cf('0x34')](_[_0x67cf('0x35')](_0x16fccc,'name'),[_0x67cf('0x2d')]);_0x3f16c8['query']=_[_0x67cf('0x36')](_0x390a51[_0x67cf('0x37')]);_0x3f16c8[_0x67cf('0x38')]=_[_0x67cf('0x39')](_0x3f16c8[_0x67cf('0x33')],_0x3f16c8[_0x67cf('0x37')]);_0x31eac9['attributes']=_[_0x67cf('0x39')](_0x3f16c8[_0x67cf('0x33')],qs[_0x67cf('0x3a')](_0x390a51[_0x67cf('0x37')][_0x67cf('0x3a')]));_0x31eac9[_0x67cf('0x3b')]=_0x31eac9['attributes'][_0x67cf('0x3c')]?_0x31eac9[_0x67cf('0x3b')]:_0x3f16c8[_0x67cf('0x33')];if(!_0x390a51[_0x67cf('0x37')][_0x67cf('0x3d')](_0x67cf('0x3e'))){_0x31eac9[_0x67cf('0x22')]=qs['limit'](_0x390a51['query']['limit']);_0x31eac9[_0x67cf('0x20')]=qs[_0x67cf('0x20')](_0x390a51[_0x67cf('0x37')]['offset']);}_0x31eac9[_0x67cf('0x3f')]=qs[_0x67cf('0x40')](_0x390a51['query'][_0x67cf('0x40')]);_0x31eac9['where']=qs[_0x67cf('0x38')](_[_0x67cf('0x41')](_0x390a51[_0x67cf('0x37')],_0x3f16c8[_0x67cf('0x38')]),_0x16fccc);if(_0x390a51[_0x67cf('0x37')]['filter']){_0x31eac9[_0x67cf('0x42')]=_[_0x67cf('0x43')](_0x31eac9[_0x67cf('0x42')],{'$or':_[_0x67cf('0x35')](_0x16fccc,function(_0xe407dd){if(_0xe407dd[_0x67cf('0x31')]!==_0x67cf('0x44')){var _0x4444ad={};_0x4444ad[_0xe407dd[_0x67cf('0x2d')]]={'$like':'%'+_0x390a51[_0x67cf('0x37')]['filter']+'%'};return _0x4444ad;}})});}_0x31eac9=_[_0x67cf('0x43')]({},_0x31eac9,_0x390a51['options']);var _0x49baa2={'where':_0x31eac9[_0x67cf('0x42')]};return db[_0x67cf('0x2e')][_0x67cf('0x23')](_0x49baa2)['then'](function(_0x2b78ca){_0x62b0ac[_0x67cf('0x23')]=_0x2b78ca;if(_0x390a51[_0x67cf('0x37')]['includeAll']){_0x31eac9['include']=[{'all':!![]}];}return db['VoiceMailMessage']['findAll'](_0x31eac9);})[_0x67cf('0x29')](function(_0x1ce376){_0x62b0ac['rows']=_0x1ce376;return _0x62b0ac;})[_0x67cf('0x29')](respondWithFilteredResult(_0x442f15,_0x31eac9))[_0x67cf('0x45')](handleError(_0x442f15,null));};exports[_0x67cf('0x46')]=function(_0x152c1e,_0x94ba2f){var _0x4784d9={'raw':!![],'where':{'id':_0x152c1e[_0x67cf('0x47')]['id']}},_0x1b4000={};_0x1b4000[_0x67cf('0x33')]=_['keys'](db[_0x67cf('0x2e')][_0x67cf('0x2f')]);_0x1b4000['query']=_[_0x67cf('0x36')](_0x152c1e[_0x67cf('0x37')]);_0x1b4000['filters']=_['intersection'](_0x1b4000['model'],_0x1b4000[_0x67cf('0x37')]);_0x4784d9['attributes']=_[_0x67cf('0x39')](_0x1b4000['model'],qs[_0x67cf('0x3a')](_0x152c1e[_0x67cf('0x37')][_0x67cf('0x3a')]));_0x4784d9[_0x67cf('0x3b')]=_0x4784d9['attributes'][_0x67cf('0x3c')]?_0x4784d9[_0x67cf('0x3b')]:_0x1b4000[_0x67cf('0x33')];if(_0x152c1e['query'][_0x67cf('0x48')]){_0x4784d9[_0x67cf('0x49')]=[{'all':!![]}];}_0x4784d9=_[_0x67cf('0x43')]({},_0x4784d9,_0x152c1e[_0x67cf('0x4a')]);return db[_0x67cf('0x2e')]['find'](_0x4784d9)['then'](handleEntityNotFound(_0x94ba2f,null))[_0x67cf('0x29')](respondWithResult(_0x94ba2f,null))[_0x67cf('0x45')](handleError(_0x94ba2f,null));};exports[_0x67cf('0x4b')]=function(_0x4a9a43,_0x48fde6){return db[_0x67cf('0x2e')]['create'](_0x4a9a43['body'],{})[_0x67cf('0x29')](respondWithResult(_0x48fde6,0xc9))[_0x67cf('0x45')](handleError(_0x48fde6,null));};exports[_0x67cf('0x28')]=function(_0x4a9723,_0x382b4a){if(_0x4a9723[_0x67cf('0x4c')]['id']){delete _0x4a9723[_0x67cf('0x4c')]['id'];}return db['VoiceMailMessage'][_0x67cf('0x4d')]({'where':{'id':_0x4a9723[_0x67cf('0x47')]['id']}})[_0x67cf('0x29')](handleEntityNotFound(_0x382b4a,null))[_0x67cf('0x29')](saveUpdates(_0x4a9723[_0x67cf('0x4c')],null))[_0x67cf('0x29')](respondWithResult(_0x382b4a,null))[_0x67cf('0x45')](handleError(_0x382b4a,null));};exports[_0x67cf('0x2a')]=function(_0x4bcfc3,_0x2f949f){return db[_0x67cf('0x2e')][_0x67cf('0x4d')]({'where':{'id':_0x4bcfc3[_0x67cf('0x47')]['id']}})[_0x67cf('0x29')](handleEntityNotFound(_0x2f949f,null))[_0x67cf('0x29')](removeEntity(_0x2f949f,null))[_0x67cf('0x45')](handleError(_0x2f949f,null));};exports[_0x67cf('0x4e')]=function(_0x4c4de9,_0x49fc43,_0x1918b8){return db[_0x67cf('0x2e')][_0x67cf('0x4d')]({'where':{'id':_0x4c4de9[_0x67cf('0x47')]['id']},'attributes':['id',_0x67cf('0x4f'),'msg_id']})[_0x67cf('0x29')](handleEntityNotFound(_0x49fc43,null))[_0x67cf('0x29')](function(_0x11332f){if(_0x11332f){if(!_0x11332f[_0x67cf('0x4f')]){throw new db['Sequelize'][(_0x67cf('0x50'))](_0x67cf('0x51'));}var _0x4d0788={'Content-Type':_0x67cf('0x52'),'Content-Disposition':_0x67cf('0x53')};if(_0x11332f[_0x67cf('0x54')]){_0x4d0788[_0x67cf('0x55')]='attachment;\x20filename=\x22'+_0x11332f[_0x67cf('0x54')]+'.wav\x22';}_0x49fc43[_0x67cf('0x24')](_0x4d0788);return _0x49fc43[_0x67cf('0x56')](new Buffer(_0x11332f[_0x67cf('0x4f')]));}})[_0x67cf('0x45')](handleError(_0x49fc43,null));}; \ No newline at end of file +var _0xc372=['create','body','recording','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','msg_id','attachment;\x20filename=\x22','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceMailMessage','fieldName','type','model','differenceBy','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','show','params','rawAttributes','length','includeAll','include','find','catch'];(function(_0x4a532d,_0x3c53ce){var _0xea75f2=function(_0x5c3eb0){while(--_0x5c3eb0){_0x4a532d['push'](_0x4a532d['shift']());}};_0xea75f2(++_0x3c53ce);}(_0xc372,0x1a8));var _0x2c37=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc372[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2c37('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2c37('0x1'));var rp=require(_0x2c37('0x2'));var moment=require(_0x2c37('0x3'));var BPromise=require(_0x2c37('0x4'));var Mustache=require(_0x2c37('0x5'));var util=require(_0x2c37('0x6'));var path=require(_0x2c37('0x7'));var sox=require(_0x2c37('0x8'));var csv=require(_0x2c37('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2c37('0xa'));var _=require(_0x2c37('0xb'));var squel=require(_0x2c37('0xc'));var crypto=require(_0x2c37('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2c37('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2c37('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2c37('0x10'));var qs=require(_0x2c37('0x11'));var as=require(_0x2c37('0x12'));var hardwareService=require(_0x2c37('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x2c37('0x14'));var config=require(_0x2c37('0x15'));var licenseUtil=require(_0x2c37('0x16'));var db=require(_0x2c37('0x17'))['db'];function respondWithStatusCode(_0x29dac3,_0x5d7e88){_0x5d7e88=_0x5d7e88||0xcc;return function(_0xc93008){if(_0xc93008){return _0x29dac3[_0x2c37('0x18')](_0x5d7e88);}return _0x29dac3[_0x2c37('0x19')](_0x5d7e88)[_0x2c37('0x1a')]();};}function respondWithResult(_0x4e5a5e,_0x48766d){_0x48766d=_0x48766d||0xc8;return function(_0x3b6e7c){if(_0x3b6e7c){return _0x4e5a5e['status'](_0x48766d)[_0x2c37('0x1b')](_0x3b6e7c);}};}function respondWithFilteredResult(_0x2d5c75,_0x36e9e2){return function(_0x46c1a0){if(_0x46c1a0){var _0xc965dc=typeof _0x36e9e2[_0x2c37('0x1c')]===_0x2c37('0x1d')&&typeof _0x36e9e2['limit']===_0x2c37('0x1d');var _0x1601bd=_0x46c1a0['count'];var _0x3932d2=_0xc965dc?0x0:_0x36e9e2[_0x2c37('0x1c')];var _0x41f363=_0xc965dc?_0x46c1a0[_0x2c37('0x1e')]:_0x36e9e2['offset']+_0x36e9e2[_0x2c37('0x1f')];var _0xb8c071;if(_0x41f363>=_0x1601bd){_0x41f363=_0x1601bd;_0xb8c071=0xc8;}else{_0xb8c071=0xce;}_0x2d5c75[_0x2c37('0x19')](_0xb8c071);return _0x2d5c75[_0x2c37('0x20')]('Content-Range',_0x3932d2+'-'+_0x41f363+'/'+_0x1601bd)['json'](_0x46c1a0);}return null;};}function patchUpdates(_0x4fa43d){return function(_0x4663ce){try{jsonpatch[_0x2c37('0x21')](_0x4663ce,_0x4fa43d,!![]);}catch(_0x1fd059){return BPromise[_0x2c37('0x22')](_0x1fd059);}return _0x4663ce[_0x2c37('0x23')]();};}function saveUpdates(_0x17b755,_0x14480b){return function(_0x20076c){if(_0x20076c){return _0x20076c[_0x2c37('0x24')](_0x17b755)[_0x2c37('0x25')](function(_0x2c08b8){return _0x2c08b8;});}return null;};}function removeEntity(_0x2b7145,_0x5e9a88){return function(_0x3a4722){if(_0x3a4722){return _0x3a4722[_0x2c37('0x26')]()[_0x2c37('0x25')](function(){_0x2b7145[_0x2c37('0x19')](0xcc)[_0x2c37('0x1a')]();});}};}function handleEntityNotFound(_0x4e1d06,_0x4bfe84){return function(_0x1a3d19){if(!_0x1a3d19){_0x4e1d06[_0x2c37('0x18')](0x194);}return _0x1a3d19;};}function handleError(_0x59a44c,_0x2d7e2e){_0x2d7e2e=_0x2d7e2e||0x1f4;return function(_0x31b914){logger[_0x2c37('0x27')](_0x31b914[_0x2c37('0x28')]);if(_0x31b914[_0x2c37('0x29')]){delete _0x31b914['name'];}_0x59a44c['status'](_0x2d7e2e)[_0x2c37('0x2a')](_0x31b914);};}exports[_0x2c37('0x2b')]=function(_0x18dd96,_0x55e1f3){var _0x3e1b9c={},_0x382d6a={},_0x28cf90={'count':0x0,'rows':[]};var _0x2da14f=_[_0x2c37('0x2c')](db[_0x2c37('0x2d')]['rawAttributes'],function(_0x46a711){return{'name':_0x46a711[_0x2c37('0x2e')],'type':_0x46a711[_0x2c37('0x2f')]['key']};});_0x382d6a[_0x2c37('0x30')]=_[_0x2c37('0x31')](_['map'](_0x2da14f,_0x2c37('0x29')),[_0x2c37('0x29')]);_0x382d6a[_0x2c37('0x32')]=_[_0x2c37('0x33')](_0x18dd96['query']);_0x382d6a[_0x2c37('0x34')]=_[_0x2c37('0x35')](_0x382d6a['model'],_0x382d6a[_0x2c37('0x32')]);_0x3e1b9c[_0x2c37('0x36')]=_[_0x2c37('0x35')](_0x382d6a[_0x2c37('0x30')],qs[_0x2c37('0x37')](_0x18dd96[_0x2c37('0x32')][_0x2c37('0x37')]));_0x3e1b9c['attributes']=_0x3e1b9c['attributes']['length']?_0x3e1b9c[_0x2c37('0x36')]:_0x382d6a[_0x2c37('0x30')];if(!_0x18dd96[_0x2c37('0x32')][_0x2c37('0x38')]('nolimit')){_0x3e1b9c['limit']=qs['limit'](_0x18dd96[_0x2c37('0x32')][_0x2c37('0x1f')]);_0x3e1b9c[_0x2c37('0x1c')]=qs['offset'](_0x18dd96[_0x2c37('0x32')][_0x2c37('0x1c')]);}_0x3e1b9c[_0x2c37('0x39')]=qs[_0x2c37('0x3a')](_0x18dd96[_0x2c37('0x32')]['sort']);_0x3e1b9c[_0x2c37('0x3b')]=qs['filters'](_[_0x2c37('0x3c')](_0x18dd96[_0x2c37('0x32')],_0x382d6a[_0x2c37('0x34')]),_0x2da14f);if(_0x18dd96[_0x2c37('0x32')][_0x2c37('0x3d')]){_0x3e1b9c[_0x2c37('0x3b')]=_[_0x2c37('0x3e')](_0x3e1b9c[_0x2c37('0x3b')],{'$or':_[_0x2c37('0x2c')](_0x2da14f,function(_0x144962){if(_0x144962[_0x2c37('0x2f')]!==_0x2c37('0x3f')){var _0x22d942={};_0x22d942[_0x144962[_0x2c37('0x29')]]={'$like':'%'+_0x18dd96[_0x2c37('0x32')][_0x2c37('0x3d')]+'%'};return _0x22d942;}})});}_0x3e1b9c=_[_0x2c37('0x3e')]({},_0x3e1b9c,_0x18dd96[_0x2c37('0x40')]);var _0x18e08a={'where':_0x3e1b9c['where']};return db[_0x2c37('0x2d')]['count'](_0x18e08a)['then'](function(_0x5ecc9b){_0x28cf90['count']=_0x5ecc9b;if(_0x18dd96[_0x2c37('0x32')]['includeAll']){_0x3e1b9c['include']=[{'all':!![]}];}return db['VoiceMailMessage'][_0x2c37('0x41')](_0x3e1b9c);})[_0x2c37('0x25')](function(_0x1d5c52){_0x28cf90['rows']=_0x1d5c52;return _0x28cf90;})[_0x2c37('0x25')](respondWithFilteredResult(_0x55e1f3,_0x3e1b9c))['catch'](handleError(_0x55e1f3,null));};exports[_0x2c37('0x42')]=function(_0x37cf2c,_0x1ef7f0){var _0x3fd1a4={'raw':!![],'where':{'id':_0x37cf2c[_0x2c37('0x43')]['id']}},_0x227913={};_0x227913['model']=_['keys'](db['VoiceMailMessage'][_0x2c37('0x44')]);_0x227913[_0x2c37('0x32')]=_[_0x2c37('0x33')](_0x37cf2c[_0x2c37('0x32')]);_0x227913['filters']=_[_0x2c37('0x35')](_0x227913[_0x2c37('0x30')],_0x227913[_0x2c37('0x32')]);_0x3fd1a4[_0x2c37('0x36')]=_[_0x2c37('0x35')](_0x227913[_0x2c37('0x30')],qs['fields'](_0x37cf2c[_0x2c37('0x32')][_0x2c37('0x37')]));_0x3fd1a4[_0x2c37('0x36')]=_0x3fd1a4[_0x2c37('0x36')][_0x2c37('0x45')]?_0x3fd1a4[_0x2c37('0x36')]:_0x227913[_0x2c37('0x30')];if(_0x37cf2c[_0x2c37('0x32')][_0x2c37('0x46')]){_0x3fd1a4[_0x2c37('0x47')]=[{'all':!![]}];}_0x3fd1a4=_[_0x2c37('0x3e')]({},_0x3fd1a4,_0x37cf2c[_0x2c37('0x40')]);return db[_0x2c37('0x2d')][_0x2c37('0x48')](_0x3fd1a4)[_0x2c37('0x25')](handleEntityNotFound(_0x1ef7f0,null))['then'](respondWithResult(_0x1ef7f0,null))[_0x2c37('0x49')](handleError(_0x1ef7f0,null));};exports['create']=function(_0x43c9bc,_0x441246){return db[_0x2c37('0x2d')][_0x2c37('0x4a')](_0x43c9bc['body'],{})['then'](respondWithResult(_0x441246,0xc9))[_0x2c37('0x49')](handleError(_0x441246,null));};exports[_0x2c37('0x24')]=function(_0x3e47bd,_0x1594c3){if(_0x3e47bd[_0x2c37('0x4b')]['id']){delete _0x3e47bd['body']['id'];}return db[_0x2c37('0x2d')]['find']({'where':{'id':_0x3e47bd[_0x2c37('0x43')]['id']}})['then'](handleEntityNotFound(_0x1594c3,null))[_0x2c37('0x25')](saveUpdates(_0x3e47bd['body'],null))[_0x2c37('0x25')](respondWithResult(_0x1594c3,null))[_0x2c37('0x49')](handleError(_0x1594c3,null));};exports[_0x2c37('0x26')]=function(_0x51823c,_0x39a2dc){return db[_0x2c37('0x2d')][_0x2c37('0x48')]({'where':{'id':_0x51823c[_0x2c37('0x43')]['id']}})[_0x2c37('0x25')](handleEntityNotFound(_0x39a2dc,null))[_0x2c37('0x25')](removeEntity(_0x39a2dc,null))[_0x2c37('0x49')](handleError(_0x39a2dc,null));};exports['download']=function(_0x53e29d,_0x245c18,_0x5041f4){return db['VoiceMailMessage']['find']({'where':{'id':_0x53e29d[_0x2c37('0x43')]['id']},'attributes':['id',_0x2c37('0x4c'),'msg_id']})[_0x2c37('0x25')](handleEntityNotFound(_0x245c18,null))['then'](function(_0x29d4e2){if(_0x29d4e2){if(!_0x29d4e2[_0x2c37('0x4c')]){throw new db['Sequelize'][(_0x2c37('0x4d'))](_0x2c37('0x4e'));}var _0x3dc8ea={'Content-Type':_0x2c37('0x4f'),'Content-Disposition':_0x2c37('0x50')};if(_0x29d4e2[_0x2c37('0x51')]){_0x3dc8ea['Content-Disposition']=_0x2c37('0x52')+_0x29d4e2['msg_id']+'.wav\x22';}_0x245c18[_0x2c37('0x20')](_0x3dc8ea);return _0x245c18['send'](new Buffer(_0x29d4e2['recording']));}})['catch'](handleError(_0x245c18,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 8db0ccc..e43afad 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 _0xdda4=['define','VoiceMailMessage','voice_voicemail_messages','dir','util','moment','bluebird','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports'];(function(_0x1499c4,_0x57c5c3){var _0x3cf45a=function(_0x4bb7cb){while(--_0x4bb7cb){_0x1499c4['push'](_0x1499c4['shift']());}};_0x3cf45a(++_0x57c5c3);}(_0xdda4,0x160));var _0x4dda=function(_0x56f7e2,_0x145392){_0x56f7e2=_0x56f7e2-0x0;var _0x36240b=_0xdda4[_0x56f7e2];return _0x36240b;};'use strict';var _=require('lodash');var util=require(_0x4dda('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x4dda('0x1'));var BPromise=require(_0x4dda('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4dda('0x3'));var rimraf=require(_0x4dda('0x4'));var config=require(_0x4dda('0x5'));var attributes=require(_0x4dda('0x6'));module[_0x4dda('0x7')]=function(_0x2740e6,_0x463013){return _0x2740e6[_0x4dda('0x8')](_0x4dda('0x9'),attributes,{'tableName':_0x4dda('0xa'),'paranoid':![],'indexes':[{'name':_0x4dda('0xb'),'fields':[_0x4dda('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x0207=['../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x53cf65,_0x2371cd){var _0x17dbb2=function(_0x43c1d1){while(--_0x43c1d1){_0x53cf65['push'](_0x53cf65['shift']());}};_0x17dbb2(++_0x2371cd);}(_0x0207,0x117));var _0x7020=function(_0x4d1406,_0x5c7a2c){_0x4d1406=_0x4d1406-0x0;var _0x2858e9=_0x0207[_0x4d1406];return _0x2858e9;};'use strict';var _=require(_0x7020('0x0'));var util=require(_0x7020('0x1'));var logger=require(_0x7020('0x2'))(_0x7020('0x3'));var moment=require(_0x7020('0x4'));var BPromise=require(_0x7020('0x5'));var rp=require(_0x7020('0x6'));var fs=require('fs');var path=require(_0x7020('0x7'));var rimraf=require(_0x7020('0x8'));var config=require(_0x7020('0x9'));var attributes=require(_0x7020('0xa'));module[_0x7020('0xb')]=function(_0x1ef7ac,_0x5aa0d2){return _0x1ef7ac[_0x7020('0xc')](_0x7020('0xd'),attributes,{'tableName':_0x7020('0xe'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x7020('0xf')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 10c8a34..7194ac5 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 _0x0266=['then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0xbaf01f,_0x4e73be){var _0x5a1ccf=function(_0x2d9ba5){while(--_0x2d9ba5){_0xbaf01f['push'](_0xbaf01f['shift']());}};_0x5a1ccf(++_0x4e73be);}(_0x0266,0x14d));var _0x6026=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x0266[_0x1b2ff7];return _0x31656a;};'use strict';var _=require(_0x6026('0x0'));var util=require(_0x6026('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6026('0x2'));var fs=require('fs');var Redis=require(_0x6026('0x3'));var db=require(_0x6026('0x4'))['db'];var utils=require(_0x6026('0x5'));var logger=require('../../config/logger')(_0x6026('0x6'));var config=require(_0x6026('0x7'));var jayson=require(_0x6026('0x8'));var client=jayson[_0x6026('0x9')][_0x6026('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4dee0d,_0x7c47dd,_0x45a7a0){return new BPromise(function(_0xb37381,_0x8cdf38){return client[_0x6026('0xb')](_0x4dee0d,_0x45a7a0)[_0x6026('0xc')](function(_0x4b05a1){logger[_0x6026('0xd')](_0x6026('0xe'),_0x7c47dd,_0x6026('0xf'));logger['debug'](_0x6026('0x10'),_0x7c47dd,'request\x20sent',JSON[_0x6026('0x11')](_0x4b05a1));if(_0x4b05a1[_0x6026('0x12')]){if(_0x4b05a1[_0x6026('0x12')][_0x6026('0x13')]===0x1f4){logger[_0x6026('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x7c47dd,_0x4b05a1[_0x6026('0x12')][_0x6026('0x14')]);return _0x8cdf38(_0x4b05a1[_0x6026('0x12')][_0x6026('0x14')]);}logger['error'](_0x6026('0xe'),_0x7c47dd,_0x4b05a1[_0x6026('0x12')][_0x6026('0x14')]);return _0xb37381(_0x4b05a1[_0x6026('0x12')][_0x6026('0x14')]);}else{logger[_0x6026('0xd')](_0x6026('0xe'),_0x7c47dd,_0x6026('0xf'));_0xb37381(_0x4b05a1[_0x6026('0x15')]['message']);}})[_0x6026('0x16')](function(_0x40766f){logger[_0x6026('0x12')](_0x6026('0xe'),_0x7c47dd,_0x40766f);_0x8cdf38(_0x40766f);});});} \ No newline at end of file +var _0xbb35=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','VoiceMailMessage,\x20%s,\x20%s','result','catch','util','moment'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xbb35,0x71));var _0x5bb3=function(_0xa074d1,_0xcaf874){_0xa074d1=_0xa074d1-0x0;var _0x251912=_0xbb35[_0xa074d1];return _0x251912;};'use strict';var _=require('lodash');var util=require(_0x5bb3('0x0'));var moment=require(_0x5bb3('0x1'));var BPromise=require(_0x5bb3('0x2'));var rs=require(_0x5bb3('0x3'));var fs=require('fs');var Redis=require(_0x5bb3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5bb3('0x5'));var logger=require(_0x5bb3('0x6'))(_0x5bb3('0x7'));var config=require('../../config/environment');var jayson=require(_0x5bb3('0x8'));var client=jayson[_0x5bb3('0x9')][_0x5bb3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27854c,_0x51b6cd,_0x2deb5d){return new BPromise(function(_0x1e5b42,_0x4a9863){return client['request'](_0x27854c,_0x2deb5d)[_0x5bb3('0xb')](function(_0xce2e51){logger[_0x5bb3('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x51b6cd,'request\x20sent');logger[_0x5bb3('0xd')](_0x5bb3('0xe'),_0x51b6cd,_0x5bb3('0xf'),JSON[_0x5bb3('0x10')](_0xce2e51));if(_0xce2e51[_0x5bb3('0x11')]){if(_0xce2e51[_0x5bb3('0x11')][_0x5bb3('0x12')]===0x1f4){logger[_0x5bb3('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x51b6cd,_0xce2e51[_0x5bb3('0x11')][_0x5bb3('0x13')]);return _0x4a9863(_0xce2e51[_0x5bb3('0x11')][_0x5bb3('0x13')]);}logger[_0x5bb3('0x11')](_0x5bb3('0x14'),_0x51b6cd,_0xce2e51[_0x5bb3('0x11')][_0x5bb3('0x13')]);return _0x1e5b42(_0xce2e51[_0x5bb3('0x11')][_0x5bb3('0x13')]);}else{logger['info'](_0x5bb3('0x14'),_0x51b6cd,_0x5bb3('0xf'));_0x1e5b42(_0xce2e51[_0x5bb3('0x15')]['message']);}})[_0x5bb3('0x16')](function(_0x36f9ab){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x51b6cd,_0x36f9ab);_0x4a9863(_0x36f9ab);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 9adc313..fce25c4 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 _0xfff4=['/:id/sounds/:id2','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','/:id','show','getSounds','post','create','/:id/sounds','put','update','destroy','delete'];(function(_0x3d1ffd,_0x223fb0){var _0x1f664b=function(_0x1417e9){while(--_0x1417e9){_0x3d1ffd['push'](_0x3d1ffd['shift']());}};_0x1f664b(++_0x223fb0);}(_0xfff4,0xf4));var _0x4fff=function(_0x2d6dc4,_0x5e2d29){_0x2d6dc4=_0x2d6dc4-0x0;var _0x52991e=_0xfff4[_0x2d6dc4];return _0x52991e;};'use strict';var multer=require(_0x4fff('0x0'));var util=require(_0x4fff('0x1'));var path=require('path');var timeout=require(_0x4fff('0x2'));var express=require('express');var router=express[_0x4fff('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4fff('0x4'));var interaction=require(_0x4fff('0x5'));var config=require(_0x4fff('0x6'));var controller=require(_0x4fff('0x7'));router[_0x4fff('0x8')]('/',auth[_0x4fff('0x9')](),controller['index']);router[_0x4fff('0x8')](_0x4fff('0xa'),auth['isAuthenticated'](),controller[_0x4fff('0xb')]);router[_0x4fff('0x8')]('/:id/sounds',auth['isAuthenticated'](),controller[_0x4fff('0xc')]);router[_0x4fff('0xd')]('/',auth[_0x4fff('0x9')](),controller[_0x4fff('0xe')]);router[_0x4fff('0xd')](_0x4fff('0xf'),auth[_0x4fff('0x9')](),controller['addSound']);router[_0x4fff('0x10')]('/:id',auth[_0x4fff('0x9')](),controller[_0x4fff('0x11')]);router['delete'](_0x4fff('0xa'),auth[_0x4fff('0x9')](),controller[_0x4fff('0x12')]);router[_0x4fff('0x13')](_0x4fff('0x14'),auth['isAuthenticated'](),controller['removeSound']);module[_0x4fff('0x15')]=router; \ No newline at end of file +var _0xb269=['post','create','addSound','put','delete','destroy','/:id/sounds/:id2','multer','util','path','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds'];(function(_0x4f2231,_0x13f504){var _0x1f8ce7=function(_0x5a575f){while(--_0x5a575f){_0x4f2231['push'](_0x4f2231['shift']());}};_0x1f8ce7(++_0x13f504);}(_0xb269,0xd9));var _0x9b26=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xb269[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0x9b26('0x0'));var util=require(_0x9b26('0x1'));var path=require(_0x9b26('0x2'));var timeout=require(_0x9b26('0x3'));var express=require(_0x9b26('0x4'));var router=express[_0x9b26('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9b26('0x6'));var controller=require('./voiceMusicOnHold.controller');router[_0x9b26('0x7')]('/',auth[_0x9b26('0x8')](),controller[_0x9b26('0x9')]);router['get'](_0x9b26('0xa'),auth['isAuthenticated'](),controller[_0x9b26('0xb')]);router[_0x9b26('0x7')](_0x9b26('0xc'),auth['isAuthenticated'](),controller[_0x9b26('0xd')]);router[_0x9b26('0xe')]('/',auth['isAuthenticated'](),controller[_0x9b26('0xf')]);router[_0x9b26('0xe')](_0x9b26('0xc'),auth[_0x9b26('0x8')](),controller[_0x9b26('0x10')]);router[_0x9b26('0x11')](_0x9b26('0xa'),auth[_0x9b26('0x8')](),controller['update']);router[_0x9b26('0x12')](_0x9b26('0xa'),auth[_0x9b26('0x8')](),controller[_0x9b26('0x13')]);router[_0x9b26('0x12')](_0x9b26('0x14'),auth[_0x9b26('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 56378a0..bf014a0 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 _0x5168=['ENUM','files','mp3nb','quietmp3nb','mp3','alpha','TIMESTAMP','sequelize','STRING','name'];(function(_0x3440a4,_0x5f2897){var _0x5b3901=function(_0xd0549c){while(--_0xd0549c){_0x3440a4['push'](_0x3440a4['shift']());}};_0x5b3901(++_0x5f2897);}(_0x5168,0xd9));var _0x8516=function(_0xbbfc5b,_0x584692){_0xbbfc5b=_0xbbfc5b-0x0;var _0x277521=_0x5168[_0xbbfc5b];return _0x277521;};'use strict';var Sequelize=require(_0x8516('0x0'));module['exports']={'name':{'type':Sequelize[_0x8516('0x1')],'allowNull':![],'unique':_0x8516('0x2')},'mode':{'type':Sequelize[_0x8516('0x3')]('custom',_0x8516('0x4'),_0x8516('0x5'),_0x8516('0x6'),'quietmp3',_0x8516('0x7')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x8516('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x8516('0x1')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x8516('0x1')],'allowNull':!![],'defaultValue':_0x8516('0x8')},'format':{'type':Sequelize[_0x8516('0x1')],'allowNull':!![]},'stamp':{'type':_0x8516('0x9')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x378f=['ENUM','custom','files','quietmp3','mp3','alpha','BOOLEAN','sequelize','STRING','name'];(function(_0x2d393f,_0x18357a){var _0x4f9ccb=function(_0x1bc7aa){while(--_0x1bc7aa){_0x2d393f['push'](_0x2d393f['shift']());}};_0x4f9ccb(++_0x18357a);}(_0x378f,0xd9));var _0xf378=function(_0x459717,_0x57131e){_0x459717=_0x459717-0x0;var _0x264ab8=_0x378f[_0x459717];return _0x264ab8;};'use strict';var Sequelize=require(_0xf378('0x0'));module['exports']={'name':{'type':Sequelize[_0xf378('0x1')],'allowNull':![],'unique':_0xf378('0x2')},'mode':{'type':Sequelize[_0xf378('0x3')](_0xf378('0x4'),_0xf378('0x5'),'mp3nb','quietmp3nb',_0xf378('0x6'),_0xf378('0x7')),'allowNull':!![],'defaultValue':_0xf378('0x5')},'directory':{'type':Sequelize[_0xf378('0x1')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xf378('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0xf378('0x1')],'allowNull':!![],'defaultValue':_0xf378('0x8')},'format':{'type':Sequelize[_0xf378('0x1')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0xf378('0x9')],'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 8ab7333..fbfd94e 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 _0x8858=['forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','basename','extname','format','%s.%s','symlinkSync','removeSound','id2','getSounds','hasOwnProperty','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','end','error','stack','name','send','index','map','VoiceMusicOnHold','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','nolimit','limit','offset','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','body','create','transaction','mode','files','directory','join','root','server/files/moh','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','readdirSync'];(function(_0x3fe600,_0x33b665){var _0x4c66dc=function(_0xb1da8c){while(--_0xb1da8c){_0x3fe600['push'](_0x3fe600['shift']());}};_0x4c66dc(++_0x33b665);}(_0x8858,0x172));var _0x8885=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x8858[_0x376b45];return _0x2341b3;};'use strict';var emlformat=require(_0x8885('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8885('0x1'));var jsonpatch=require(_0x8885('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8885('0x3'));var Mustache=require(_0x8885('0x4'));var util=require(_0x8885('0x5'));var path=require(_0x8885('0x6'));var sox=require(_0x8885('0x7'));var csv=require(_0x8885('0x8'));var ejs=require(_0x8885('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8885('0xa'));var crypto=require(_0x8885('0xb'));var jsforce=require(_0x8885('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8885('0x8'));var querystring=require('querystring');var Papa=require(_0x8885('0xd'));var Redis=require(_0x8885('0xe'));var authService=require(_0x8885('0xf'));var qs=require(_0x8885('0x10'));var as=require(_0x8885('0x11'));var hardwareService=require(_0x8885('0x12'));var logger=require(_0x8885('0x13'))('api');var utils=require(_0x8885('0x14'));var config=require(_0x8885('0x15'));var licenseUtil=require(_0x8885('0x16'));var db=require(_0x8885('0x17'))['db'];function respondWithStatusCode(_0x5a27f9,_0x3211ea){_0x3211ea=_0x3211ea||0xcc;return function(_0x2c7059){if(_0x2c7059){return _0x5a27f9['sendStatus'](_0x3211ea);}return _0x5a27f9['status'](_0x3211ea)['end']();};}function respondWithResult(_0x5576ff,_0x295345){_0x295345=_0x295345||0xc8;return function(_0x485bc4){if(_0x485bc4){return _0x5576ff[_0x8885('0x18')](_0x295345)['json'](_0x485bc4);}};}function respondWithFilteredResult(_0x48a348,_0x2e23e2){return function(_0xf48a3){if(_0xf48a3){var _0x53d8c4=typeof _0x2e23e2['offset']===_0x8885('0x19')&&typeof _0x2e23e2['limit']===_0x8885('0x19');var _0x4aa840=_0xf48a3['count'];var _0x22d316=_0x53d8c4?0x0:_0x2e23e2['offset'];var _0x3ad1c9=_0x53d8c4?_0xf48a3[_0x8885('0x1a')]:_0x2e23e2['offset']+_0x2e23e2['limit'];var _0x5208c9;if(_0x3ad1c9>=_0x4aa840){_0x3ad1c9=_0x4aa840;_0x5208c9=0xc8;}else{_0x5208c9=0xce;}_0x48a348[_0x8885('0x18')](_0x5208c9);return _0x48a348[_0x8885('0x1b')](_0x8885('0x1c'),_0x22d316+'-'+_0x3ad1c9+'/'+_0x4aa840)[_0x8885('0x1d')](_0xf48a3);}return null;};}function patchUpdates(_0x55ee4b){return function(_0x2a1fd2){try{jsonpatch[_0x8885('0x1e')](_0x2a1fd2,_0x55ee4b,!![]);}catch(_0xb0d1c5){return BPromise[_0x8885('0x1f')](_0xb0d1c5);}return _0x2a1fd2[_0x8885('0x20')]();};}function saveUpdates(_0x351cae,_0x534b8d){return function(_0x2e3a36){if(_0x2e3a36){return _0x2e3a36[_0x8885('0x21')](_0x351cae)[_0x8885('0x22')](function(_0x57d804){return _0x57d804;});}return null;};}function removeEntity(_0x2200a4,_0x435208){return function(_0x71cd1c){if(_0x71cd1c){return _0x71cd1c[_0x8885('0x23')]()[_0x8885('0x22')](function(){var _0x2361a1=_0x71cd1c[_0x8885('0x24')]({'plain':!![]});var _0x16d1ec=_0x8885('0x25');return db[_0x8885('0x26')][_0x8885('0x23')]({'where':{'type':_0x16d1ec,'resourceId':_0x2361a1['id']}})[_0x8885('0x22')](function(){return _0x71cd1c;});})[_0x8885('0x22')](function(){_0x2200a4[_0x8885('0x18')](0xcc)[_0x8885('0x27')]();});}};}function handleEntityNotFound(_0x4892ea,_0x15e2a7){return function(_0x5c9166){if(!_0x5c9166){_0x4892ea['sendStatus'](0x194);}return _0x5c9166;};}function handleError(_0x8febaa,_0x4b39a2){_0x4b39a2=_0x4b39a2||0x1f4;return function(_0x34c3c8){logger[_0x8885('0x28')](_0x34c3c8[_0x8885('0x29')]);if(_0x34c3c8[_0x8885('0x2a')]){delete _0x34c3c8[_0x8885('0x2a')];}_0x8febaa[_0x8885('0x18')](_0x4b39a2)[_0x8885('0x2b')](_0x34c3c8);};}exports[_0x8885('0x2c')]=function(_0x3ff613,_0x288c0e){var _0x5ca6a1={},_0x32b12c={},_0x4a453a={'count':0x0,'rows':[]};var _0x2b92df=_[_0x8885('0x2d')](db[_0x8885('0x2e')]['rawAttributes'],function(_0x35b32d){return{'name':_0x35b32d[_0x8885('0x2f')],'type':_0x35b32d[_0x8885('0x30')][_0x8885('0x31')]};});_0x32b12c['model']=_['map'](_0x2b92df,'name');_0x32b12c['query']=_[_0x8885('0x32')](_0x3ff613[_0x8885('0x33')]);_0x32b12c[_0x8885('0x34')]=_[_0x8885('0x35')](_0x32b12c['model'],_0x32b12c[_0x8885('0x33')]);_0x5ca6a1['attributes']=_[_0x8885('0x35')](_0x32b12c[_0x8885('0x36')],qs[_0x8885('0x37')](_0x3ff613[_0x8885('0x33')]['fields']));_0x5ca6a1['attributes']=_0x5ca6a1[_0x8885('0x38')][_0x8885('0x39')]?_0x5ca6a1[_0x8885('0x38')]:_0x32b12c[_0x8885('0x36')];if(!_0x3ff613[_0x8885('0x33')]['hasOwnProperty'](_0x8885('0x3a'))){_0x5ca6a1[_0x8885('0x3b')]=qs[_0x8885('0x3b')](_0x3ff613[_0x8885('0x33')][_0x8885('0x3b')]);_0x5ca6a1[_0x8885('0x3c')]=qs[_0x8885('0x3c')](_0x3ff613[_0x8885('0x33')]['offset']);}_0x5ca6a1[_0x8885('0x3d')]=qs[_0x8885('0x3e')](_0x3ff613[_0x8885('0x33')]['sort']);delete _0x3ff613[_0x8885('0x33')][_0x8885('0x3e')];_0x5ca6a1['where']=qs['filters'](_[_0x8885('0x3f')](_0x3ff613[_0x8885('0x33')],_0x32b12c[_0x8885('0x34')]),_0x2b92df);if(_0x3ff613['query'][_0x8885('0x40')]){_0x5ca6a1[_0x8885('0x41')]=_[_0x8885('0x42')](_0x5ca6a1['where'],{'$or':_[_0x8885('0x2d')](_0x2b92df,function(_0x17e6e3){if(_0x17e6e3[_0x8885('0x30')]!==_0x8885('0x43')){var _0x2780d9={};_0x2780d9[_0x17e6e3[_0x8885('0x2a')]]={'$like':'%'+_0x3ff613[_0x8885('0x33')][_0x8885('0x40')]+'%'};return _0x2780d9;}})});}_0x5ca6a1=_[_0x8885('0x42')]({},_0x5ca6a1,_0x3ff613[_0x8885('0x44')]);var _0x3db8f2={'where':_0x5ca6a1[_0x8885('0x41')]};return db[_0x8885('0x2e')]['count'](_0x3db8f2)[_0x8885('0x22')](function(_0x1ee47f){_0x4a453a[_0x8885('0x1a')]=_0x1ee47f;if(_0x3ff613['query'][_0x8885('0x45')]){_0x5ca6a1[_0x8885('0x46')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x8885('0x47')](_0x5ca6a1);})[_0x8885('0x22')](function(_0x17d73b){_0x4a453a['rows']=_0x17d73b;return _0x4a453a;})[_0x8885('0x22')](respondWithFilteredResult(_0x288c0e,_0x5ca6a1))[_0x8885('0x48')](handleError(_0x288c0e,null));};exports[_0x8885('0x49')]=function(_0x4d8f80,_0x41879a){var _0x355e52={'raw':![],'where':{'id':_0x4d8f80[_0x8885('0x4a')]['id']}},_0x425610={};_0x425610[_0x8885('0x36')]=_['keys'](db[_0x8885('0x2e')][_0x8885('0x4b')]);_0x425610[_0x8885('0x33')]=_['keys'](_0x4d8f80['query']);_0x425610[_0x8885('0x34')]=_[_0x8885('0x35')](_0x425610[_0x8885('0x36')],_0x425610[_0x8885('0x33')]);_0x355e52[_0x8885('0x38')]=_['intersection'](_0x425610[_0x8885('0x36')],qs[_0x8885('0x37')](_0x4d8f80['query'][_0x8885('0x37')]));_0x355e52['attributes']=_0x355e52[_0x8885('0x38')][_0x8885('0x39')]?_0x355e52[_0x8885('0x38')]:_0x425610[_0x8885('0x36')];if(_0x4d8f80[_0x8885('0x33')]['includeAll']){_0x355e52['include']=[{'all':!![]}];}_0x355e52=_[_0x8885('0x42')]({},_0x355e52,_0x4d8f80[_0x8885('0x44')]);return db[_0x8885('0x2e')][_0x8885('0x4c')](_0x355e52)['then'](handleEntityNotFound(_0x41879a,null))[_0x8885('0x22')](respondWithResult(_0x41879a,null))[_0x8885('0x48')](handleError(_0x41879a,null));};exports['update']=function(_0x9ad252,_0x4b10b9){if(_0x9ad252['body']['id']){delete _0x9ad252[_0x8885('0x4d')]['id'];}return db['VoiceMusicOnHold']['find']({'where':{'id':_0x9ad252[_0x8885('0x4a')]['id']}})[_0x8885('0x22')](handleEntityNotFound(_0x4b10b9,null))[_0x8885('0x22')](saveUpdates(_0x9ad252[_0x8885('0x4d')],null))[_0x8885('0x22')](respondWithResult(_0x4b10b9,null))[_0x8885('0x48')](handleError(_0x4b10b9,null));};exports[_0x8885('0x4e')]=function(_0x399c94,_0x360009,_0x5b7d4b){return db['sequelize'][_0x8885('0x4f')](function(_0x397c78){if(_0x399c94[_0x8885('0x4d')][_0x8885('0x50')]===_0x8885('0x51')){_0x399c94['body'][_0x8885('0x52')]=path[_0x8885('0x53')](config[_0x8885('0x54')],_0x8885('0x55'),_0x399c94[_0x8885('0x4d')][_0x8885('0x2a')]);}return db[_0x8885('0x2e')]['create'](_0x399c94['body'],{'transaction':_0x397c78})[_0x8885('0x22')](function(_0x57b5b3){if(_0x399c94[_0x8885('0x4d')][_0x8885('0x50')]===_0x8885('0x51')){fs['mkdirSync'](_0x57b5b3[_0x8885('0x52')],parseInt(_0x8885('0x56'),0x8));}var _0xe13a26=_0x399c94[_0x8885('0x57')][_0x8885('0x24')]({'plain':!![]});if(!_0xe13a26)throw new Error(_0x8885('0x58'));if(_0xe13a26['role']===_0x8885('0x57')){var _0x4d7e52=_0x57b5b3[_0x8885('0x24')]({'plain':!![]});return db['UserProfileSection'][_0x8885('0x4c')]({'where':{'name':_0x8885('0x25'),'userProfileId':_0xe13a26[_0x8885('0x59')]},'raw':!![]})['then'](function(_0x79adf1){if(_0x79adf1&&_0x79adf1[_0x8885('0x5a')]===0x0){return db[_0x8885('0x26')]['create']({'name':_0x4d7e52[_0x8885('0x2a')],'resourceId':_0x4d7e52['id'],'type':_0x79adf1[_0x8885('0x2a')],'sectionId':_0x79adf1['id']},{})[_0x8885('0x22')](function(){return _0x57b5b3;});}else{return _0x57b5b3;}})[_0x8885('0x48')](function(_0x246e5e){logger['error'](_0x8885('0x5b'),_0x246e5e);});}return _0x57b5b3;});})[_0x8885('0x22')](respondWithResult(_0x360009,0xc9))[_0x8885('0x48')](handleError(_0x360009,null));};exports['destroy']=function(_0x38debf,_0x34d3b1,_0x49354a){var _0x19895e;return db[_0x8885('0x2e')]['find']({'where':{'id':_0x38debf['params']['id']}})[_0x8885('0x22')](function(_0x26f1fe){if(_0x26f1fe){return db[_0x8885('0x5c')]['transaction'](function(_0x5531bd){return _0x26f1fe[_0x8885('0x23')]({'transaction':_0x5531bd,'raw':!![]})[_0x8885('0x22')](function(_0x3bc9b7){if(_0x3bc9b7['directory']){fs[_0x8885('0x5d')](_0x3bc9b7[_0x8885('0x52')])[_0x8885('0x5e')](function(_0x26edbc){fs[_0x8885('0x5f')](path[_0x8885('0x53')](_0x3bc9b7[_0x8885('0x52')],_0x26edbc));});fs[_0x8885('0x60')](_0x3bc9b7[_0x8885('0x52')]);}return _0x3bc9b7;});})[_0x8885('0x48')](function(_0x28ccb6){throw new db[(_0x8885('0x61'))][(_0x8885('0x62'))](_0x28ccb6[_0x8885('0x63')]);});}})[_0x8885('0x22')](handleEntityNotFound(_0x34d3b1,null))[_0x8885('0x22')](removeEntity(_0x34d3b1,null))['catch'](handleError(_0x34d3b1,null));};exports[_0x8885('0x64')]=function(_0x385f4d,_0x5dd206,_0x566a18){return db[_0x8885('0x5c')][_0x8885('0x4f')](function(_0x578e70){var _0x1eb49d;return db[_0x8885('0x2e')][_0x8885('0x4c')]({'where':{'id':_0x385f4d[_0x8885('0x4a')]['id']}})[_0x8885('0x22')](function(_0x13aec6){if(_0x13aec6){_0x1eb49d=_0x13aec6;return _0x13aec6['addSound'](_0x385f4d[_0x8885('0x4d')]['id'],{'transaction':_0x578e70});}})['then'](function(_0x534eea){if(_0x534eea){return db[_0x8885('0x65')][_0x8885('0x66')]({'where':{'id':_0x385f4d['body']['id']},'attributes':['id',_0x8885('0x2a'),_0x8885('0x67'),_0x8885('0x68'),_0x8885('0x69')],'raw':!![]});}})['then'](function(_0x5629ec){if(_0x5629ec){var _0x1ee12c=path[_0x8885('0x53')](config[_0x8885('0x54')],_0x8885('0x6a'),util['format']('%s.%s',path[_0x8885('0x6b')](_0x5629ec[_0x8885('0x67')],path[_0x8885('0x6c')](_0x5629ec[_0x8885('0x67')])),_0x5629ec['converted_format']));var _0x5ecc97=path[_0x8885('0x53')](config[_0x8885('0x54')],_0x8885('0x55'),_0x1eb49d['name'],util[_0x8885('0x6d')](_0x8885('0x6e'),_0x5629ec[_0x8885('0x2a')],_0x5629ec[_0x8885('0x68')]));fs[_0x8885('0x6f')](_0x1ee12c,_0x5ecc97);return _0x5629ec;}})['catch'](function(_0x214aba){throw new db[(_0x8885('0x61'))]['ValidationError'](_0x214aba[_0x8885('0x63')]);});})['then'](handleEntityNotFound(_0x5dd206,null))['then'](respondWithResult(_0x5dd206,0xc9))[_0x8885('0x48')](handleError(_0x5dd206,null));};exports[_0x8885('0x70')]=function(_0x2e6bc2,_0x4365b7,_0x46bbae){return db['sequelize'][_0x8885('0x4f')](function(_0x5049d3){var _0x8c73f3;return db[_0x8885('0x2e')][_0x8885('0x66')]({'where':{'id':_0x2e6bc2['params']['id']}})['then'](handleEntityNotFound(_0x4365b7,null))[_0x8885('0x22')](function(_0x2214a5){if(_0x2214a5){_0x8c73f3=_0x2214a5;return _0x2214a5[_0x8885('0x70')](_0x2e6bc2[_0x8885('0x4a')][_0x8885('0x71')]);}})[_0x8885('0x22')](function(_0x5d97c7){if(_0x5d97c7){return db[_0x8885('0x65')]['findOne']({'where':{'id':_0x2e6bc2[_0x8885('0x4a')]['id2']},'attributes':['id',_0x8885('0x2a'),_0x8885('0x67'),'converted_format','createdAt'],'raw':!![]});}})[_0x8885('0x22')](function(_0x1900bf){if(_0x1900bf){fs[_0x8885('0x5f')](path['join'](_0x8c73f3[_0x8885('0x52')],util[_0x8885('0x6d')](_0x8885('0x6e'),_0x1900bf[_0x8885('0x2a')],_0x1900bf['converted_format'])));return _0x1900bf;}})[_0x8885('0x48')](function(_0x2de176){throw new db['Sequelize'][(_0x8885('0x62'))](_0x2de176[_0x8885('0x63')]);});})[_0x8885('0x22')](handleEntityNotFound(_0x4365b7,null))[_0x8885('0x22')](respondWithStatusCode(_0x4365b7,0xcc))['catch'](handleError(_0x4365b7,null));};exports[_0x8885('0x72')]=function(_0x63103f,_0x4abeb2,_0x2bff7f){var _0x383746={};var _0xd44e83={};var _0x2fec94;var _0x5e7eec;return db[_0x8885('0x2e')]['findOne']({'where':{'id':_0x63103f['params']['id']}})['then'](handleEntityNotFound(_0x4abeb2,null))[_0x8885('0x22')](function(_0x8a9da){if(_0x8a9da){_0x2fec94=_0x8a9da;_0xd44e83[_0x8885('0x36')]=_['keys'](db[_0x8885('0x65')]['rawAttributes']);_0xd44e83[_0x8885('0x33')]=_[_0x8885('0x32')](_0x63103f[_0x8885('0x33')]);_0xd44e83[_0x8885('0x34')]=_['intersection'](_0xd44e83[_0x8885('0x36')],_0xd44e83[_0x8885('0x33')]);_0x383746[_0x8885('0x38')]=_[_0x8885('0x35')](_0xd44e83[_0x8885('0x36')],qs[_0x8885('0x37')](_0x63103f[_0x8885('0x33')][_0x8885('0x37')]));_0x383746[_0x8885('0x38')]=_0x383746[_0x8885('0x38')][_0x8885('0x39')]?_0x383746[_0x8885('0x38')]:_0xd44e83[_0x8885('0x36')];_0x383746['order']=qs['sort'](_0x63103f[_0x8885('0x33')][_0x8885('0x3e')]);_0x383746[_0x8885('0x41')]=qs[_0x8885('0x34')](_[_0x8885('0x3f')](_0x63103f[_0x8885('0x33')],_0xd44e83[_0x8885('0x34')]));if(_0x63103f[_0x8885('0x33')][_0x8885('0x40')]){_0x383746[_0x8885('0x41')]=_[_0x8885('0x42')](_0x383746['where'],{'$or':_['map'](_0x383746[_0x8885('0x38')],function(_0x3c0bc2){var _0x23f81f={};_0x23f81f[_0x3c0bc2]={'$like':'%'+_0x63103f[_0x8885('0x33')][_0x8885('0x40')]+'%'};return _0x23f81f;})});}_0x383746=_[_0x8885('0x42')]({},_0x383746,_0x63103f[_0x8885('0x44')]);return _0x2fec94[_0x8885('0x72')](_0x383746);}})[_0x8885('0x22')](function(_0x2ca9dc){if(_0x2ca9dc){_0x5e7eec=_0x2ca9dc[_0x8885('0x39')];if(!_0x63103f['query'][_0x8885('0x73')]('nolimit')){_0x383746[_0x8885('0x3b')]=qs[_0x8885('0x3b')](_0x63103f['query'][_0x8885('0x3b')]);_0x383746['offset']=qs[_0x8885('0x3c')](_0x63103f['query'][_0x8885('0x3c')]);}return _0x2fec94[_0x8885('0x72')](_0x383746);}})[_0x8885('0x22')](function(_0xf677e9){if(_0xf677e9){return _0xf677e9?{'count':_0x5e7eec,'rows':_0xf677e9}:null;}})[_0x8885('0x22')](respondWithResult(_0x4abeb2,null))[_0x8885('0x48')](handleError(_0x4abeb2,null));}; \ No newline at end of file +var _0x4870=['autoAssociation','transaction','readdirSync','forEach','rmdirSync','Sequelize','addSound','converted_format','createdAt','format','%s.%s','save_name','symlinkSync','ValidationError','removeSound','id2','Sound','findOne','unlinkSync','message','getSounds','order','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','MusicOnHolds','UserProfileResource','destroy','error','name','send','index','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','nolimit','sort','where','merge','map','VIRTUAL','filter','VoiceMusicOnHold','includeAll','include','findAll','catch','show','keys','length','options','find','body','params','create','sequelize','mode','files','join','root','server/files/moh','mkdirSync','directory','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId'];(function(_0x53e7e1,_0x29aa89){var _0x23100e=function(_0x36b0c7){while(--_0x36b0c7){_0x53e7e1['push'](_0x53e7e1['shift']());}};_0x23100e(++_0x29aa89);}(_0x4870,0x89));var _0x0487=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x4870[_0x2c7618];return _0x5ce3f0;};'use strict';var emlformat=require(_0x0487('0x0'));var rimraf=require(_0x0487('0x1'));var zipdir=require(_0x0487('0x2'));var jsonpatch=require(_0x0487('0x3'));var rp=require(_0x0487('0x4'));var moment=require(_0x0487('0x5'));var BPromise=require(_0x0487('0x6'));var Mustache=require(_0x0487('0x7'));var util=require(_0x0487('0x8'));var path=require(_0x0487('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0487('0xa'));var fs=require('fs');var fs_extra=require(_0x0487('0xb'));var _=require(_0x0487('0xc'));var squel=require(_0x0487('0xd'));var crypto=require(_0x0487('0xe'));var jsforce=require(_0x0487('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0487('0x10'));var querystring=require(_0x0487('0x11'));var Papa=require(_0x0487('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0487('0x13'));var logger=require(_0x0487('0x14'))(_0x0487('0x15'));var utils=require(_0x0487('0x16'));var config=require(_0x0487('0x17'));var licenseUtil=require(_0x0487('0x18'));var db=require(_0x0487('0x19'))['db'];function respondWithStatusCode(_0x56daf4,_0xa2919){_0xa2919=_0xa2919||0xcc;return function(_0xf3dddf){if(_0xf3dddf){return _0x56daf4[_0x0487('0x1a')](_0xa2919);}return _0x56daf4['status'](_0xa2919)[_0x0487('0x1b')]();};}function respondWithResult(_0x41d58a,_0x32ce62){_0x32ce62=_0x32ce62||0xc8;return function(_0x1aacde){if(_0x1aacde){return _0x41d58a[_0x0487('0x1c')](_0x32ce62)[_0x0487('0x1d')](_0x1aacde);}};}function respondWithFilteredResult(_0x39387d,_0x56e8ec){return function(_0x1b8b26){if(_0x1b8b26){var _0x458cfe=typeof _0x56e8ec[_0x0487('0x1e')]===_0x0487('0x1f')&&typeof _0x56e8ec['limit']===_0x0487('0x1f');var _0x3adf4f=_0x1b8b26[_0x0487('0x20')];var _0x2a990f=_0x458cfe?0x0:_0x56e8ec[_0x0487('0x1e')];var _0x40b17a=_0x458cfe?_0x1b8b26[_0x0487('0x20')]:_0x56e8ec[_0x0487('0x1e')]+_0x56e8ec[_0x0487('0x21')];var _0xd6e07e;if(_0x40b17a>=_0x3adf4f){_0x40b17a=_0x3adf4f;_0xd6e07e=0xc8;}else{_0xd6e07e=0xce;}_0x39387d[_0x0487('0x1c')](_0xd6e07e);return _0x39387d[_0x0487('0x22')](_0x0487('0x23'),_0x2a990f+'-'+_0x40b17a+'/'+_0x3adf4f)[_0x0487('0x1d')](_0x1b8b26);}return null;};}function patchUpdates(_0x235713){return function(_0x59accd){try{jsonpatch[_0x0487('0x24')](_0x59accd,_0x235713,!![]);}catch(_0x2b059d){return BPromise[_0x0487('0x25')](_0x2b059d);}return _0x59accd[_0x0487('0x26')]();};}function saveUpdates(_0x31511d,_0x21058e){return function(_0x5d084e){if(_0x5d084e){return _0x5d084e[_0x0487('0x27')](_0x31511d)[_0x0487('0x28')](function(_0x57be46){return _0x57be46;});}return null;};}function removeEntity(_0x4e841b,_0x5d284e){return function(_0x5bd44f){if(_0x5bd44f){return _0x5bd44f['destroy']()['then'](function(){var _0x28dec6=_0x5bd44f['get']({'plain':!![]});var _0x9d6859=_0x0487('0x29');return db[_0x0487('0x2a')][_0x0487('0x2b')]({'where':{'type':_0x9d6859,'resourceId':_0x28dec6['id']}})[_0x0487('0x28')](function(){return _0x5bd44f;});})['then'](function(){_0x4e841b[_0x0487('0x1c')](0xcc)[_0x0487('0x1b')]();});}};}function handleEntityNotFound(_0x27242a,_0x5dc0ae){return function(_0x2a797e){if(!_0x2a797e){_0x27242a[_0x0487('0x1a')](0x194);}return _0x2a797e;};}function handleError(_0x3be3b7,_0x5160d0){_0x5160d0=_0x5160d0||0x1f4;return function(_0x26133a){logger[_0x0487('0x2c')](_0x26133a['stack']);if(_0x26133a[_0x0487('0x2d')]){delete _0x26133a[_0x0487('0x2d')];}_0x3be3b7[_0x0487('0x1c')](_0x5160d0)[_0x0487('0x2e')](_0x26133a);};}exports[_0x0487('0x2f')]=function(_0x2394f2,_0x29a8ab){var _0x3c1431={},_0x4d1fd4={},_0x59d388={'count':0x0,'rows':[]};var _0x6256c0=_['map'](db['VoiceMusicOnHold'][_0x0487('0x30')],function(_0x4f2d76){return{'name':_0x4f2d76['fieldName'],'type':_0x4f2d76[_0x0487('0x31')][_0x0487('0x32')]};});_0x4d1fd4[_0x0487('0x33')]=_['map'](_0x6256c0,'name');_0x4d1fd4[_0x0487('0x34')]=_['keys'](_0x2394f2['query']);_0x4d1fd4[_0x0487('0x35')]=_['intersection'](_0x4d1fd4[_0x0487('0x33')],_0x4d1fd4[_0x0487('0x34')]);_0x3c1431[_0x0487('0x36')]=_[_0x0487('0x37')](_0x4d1fd4['model'],qs['fields'](_0x2394f2[_0x0487('0x34')][_0x0487('0x38')]));_0x3c1431[_0x0487('0x36')]=_0x3c1431[_0x0487('0x36')]['length']?_0x3c1431[_0x0487('0x36')]:_0x4d1fd4[_0x0487('0x33')];if(!_0x2394f2[_0x0487('0x34')]['hasOwnProperty'](_0x0487('0x39'))){_0x3c1431['limit']=qs[_0x0487('0x21')](_0x2394f2[_0x0487('0x34')][_0x0487('0x21')]);_0x3c1431[_0x0487('0x1e')]=qs['offset'](_0x2394f2['query'][_0x0487('0x1e')]);}_0x3c1431['order']=qs[_0x0487('0x3a')](_0x2394f2[_0x0487('0x34')][_0x0487('0x3a')]);delete _0x2394f2[_0x0487('0x34')][_0x0487('0x3a')];_0x3c1431[_0x0487('0x3b')]=qs[_0x0487('0x35')](_['pick'](_0x2394f2[_0x0487('0x34')],_0x4d1fd4[_0x0487('0x35')]),_0x6256c0);if(_0x2394f2[_0x0487('0x34')]['filter']){_0x3c1431[_0x0487('0x3b')]=_[_0x0487('0x3c')](_0x3c1431[_0x0487('0x3b')],{'$or':_[_0x0487('0x3d')](_0x6256c0,function(_0x1c8b4b){if(_0x1c8b4b['type']!==_0x0487('0x3e')){var _0x5503cc={};_0x5503cc[_0x1c8b4b['name']]={'$like':'%'+_0x2394f2[_0x0487('0x34')][_0x0487('0x3f')]+'%'};return _0x5503cc;}})});}_0x3c1431=_[_0x0487('0x3c')]({},_0x3c1431,_0x2394f2['options']);var _0x22e939={'where':_0x3c1431[_0x0487('0x3b')]};return db[_0x0487('0x40')][_0x0487('0x20')](_0x22e939)[_0x0487('0x28')](function(_0x48b178){_0x59d388['count']=_0x48b178;if(_0x2394f2[_0x0487('0x34')][_0x0487('0x41')]){_0x3c1431[_0x0487('0x42')]=[{'all':!![]}];}return db[_0x0487('0x40')][_0x0487('0x43')](_0x3c1431);})['then'](function(_0x274266){_0x59d388['rows']=_0x274266;return _0x59d388;})[_0x0487('0x28')](respondWithFilteredResult(_0x29a8ab,_0x3c1431))[_0x0487('0x44')](handleError(_0x29a8ab,null));};exports[_0x0487('0x45')]=function(_0x26d964,_0x3deaee){var _0x244a3e={'raw':![],'where':{'id':_0x26d964['params']['id']}},_0x3c97dc={};_0x3c97dc['model']=_[_0x0487('0x46')](db[_0x0487('0x40')]['rawAttributes']);_0x3c97dc[_0x0487('0x34')]=_[_0x0487('0x46')](_0x26d964['query']);_0x3c97dc[_0x0487('0x35')]=_[_0x0487('0x37')](_0x3c97dc['model'],_0x3c97dc[_0x0487('0x34')]);_0x244a3e[_0x0487('0x36')]=_[_0x0487('0x37')](_0x3c97dc['model'],qs['fields'](_0x26d964[_0x0487('0x34')][_0x0487('0x38')]));_0x244a3e[_0x0487('0x36')]=_0x244a3e['attributes'][_0x0487('0x47')]?_0x244a3e[_0x0487('0x36')]:_0x3c97dc['model'];if(_0x26d964['query'][_0x0487('0x41')]){_0x244a3e[_0x0487('0x42')]=[{'all':!![]}];}_0x244a3e=_[_0x0487('0x3c')]({},_0x244a3e,_0x26d964[_0x0487('0x48')]);return db[_0x0487('0x40')][_0x0487('0x49')](_0x244a3e)[_0x0487('0x28')](handleEntityNotFound(_0x3deaee,null))[_0x0487('0x28')](respondWithResult(_0x3deaee,null))['catch'](handleError(_0x3deaee,null));};exports['update']=function(_0x42b4bb,_0x283bbc){if(_0x42b4bb[_0x0487('0x4a')]['id']){delete _0x42b4bb[_0x0487('0x4a')]['id'];}return db['VoiceMusicOnHold'][_0x0487('0x49')]({'where':{'id':_0x42b4bb[_0x0487('0x4b')]['id']}})[_0x0487('0x28')](handleEntityNotFound(_0x283bbc,null))[_0x0487('0x28')](saveUpdates(_0x42b4bb[_0x0487('0x4a')],null))[_0x0487('0x28')](respondWithResult(_0x283bbc,null))[_0x0487('0x44')](handleError(_0x283bbc,null));};exports[_0x0487('0x4c')]=function(_0x399fb0,_0x37aa70,_0x4344cc){return db[_0x0487('0x4d')]['transaction'](function(_0x35565b){if(_0x399fb0[_0x0487('0x4a')][_0x0487('0x4e')]===_0x0487('0x4f')){_0x399fb0[_0x0487('0x4a')]['directory']=path[_0x0487('0x50')](config[_0x0487('0x51')],_0x0487('0x52'),_0x399fb0['body'][_0x0487('0x2d')]);}return db['VoiceMusicOnHold'][_0x0487('0x4c')](_0x399fb0['body'],{'transaction':_0x35565b})[_0x0487('0x28')](function(_0x56e365){if(_0x399fb0[_0x0487('0x4a')][_0x0487('0x4e')]==='files'){fs[_0x0487('0x53')](_0x56e365[_0x0487('0x54')],parseInt(_0x0487('0x55'),0x8));}var _0x19a96a=_0x399fb0['user']['get']({'plain':!![]});if(!_0x19a96a)throw new Error(_0x0487('0x56'));if(_0x19a96a[_0x0487('0x57')]==='user'){var _0x6214f7=_0x56e365[_0x0487('0x58')]({'plain':!![]});return db[_0x0487('0x59')][_0x0487('0x49')]({'where':{'name':'MusicOnHolds','userProfileId':_0x19a96a[_0x0487('0x5a')]},'raw':!![]})['then'](function(_0xaf06d5){if(_0xaf06d5&&_0xaf06d5[_0x0487('0x5b')]===0x0){return db[_0x0487('0x2a')][_0x0487('0x4c')]({'name':_0x6214f7[_0x0487('0x2d')],'resourceId':_0x6214f7['id'],'type':_0xaf06d5[_0x0487('0x2d')],'sectionId':_0xaf06d5['id']},{})[_0x0487('0x28')](function(){return _0x56e365;});}else{return _0x56e365;}})[_0x0487('0x44')](function(_0x590a1d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x590a1d);});}return _0x56e365;});})[_0x0487('0x28')](respondWithResult(_0x37aa70,0xc9))[_0x0487('0x44')](handleError(_0x37aa70,null));};exports[_0x0487('0x2b')]=function(_0x2ec305,_0x309047,_0xd2cf73){var _0x527fdc;return db['VoiceMusicOnHold'][_0x0487('0x49')]({'where':{'id':_0x2ec305[_0x0487('0x4b')]['id']}})[_0x0487('0x28')](function(_0x464aa2){if(_0x464aa2){return db[_0x0487('0x4d')][_0x0487('0x5c')](function(_0x42297a){return _0x464aa2[_0x0487('0x2b')]({'transaction':_0x42297a,'raw':!![]})[_0x0487('0x28')](function(_0x5a4521){if(_0x5a4521['directory']){fs[_0x0487('0x5d')](_0x5a4521[_0x0487('0x54')])[_0x0487('0x5e')](function(_0x4997d1){fs['unlinkSync'](path[_0x0487('0x50')](_0x5a4521[_0x0487('0x54')],_0x4997d1));});fs[_0x0487('0x5f')](_0x5a4521[_0x0487('0x54')]);}return _0x5a4521;});})[_0x0487('0x44')](function(_0x1bd64a){throw new db[(_0x0487('0x60'))]['ValidationError'](_0x1bd64a['message']);});}})[_0x0487('0x28')](handleEntityNotFound(_0x309047,null))[_0x0487('0x28')](removeEntity(_0x309047,null))[_0x0487('0x44')](handleError(_0x309047,null));};exports['addSound']=function(_0x18efe8,_0x3f2dfe,_0x46d5a3){return db[_0x0487('0x4d')][_0x0487('0x5c')](function(_0x58d989){var _0x37e4ee;return db[_0x0487('0x40')][_0x0487('0x49')]({'where':{'id':_0x18efe8['params']['id']}})['then'](function(_0x557945){if(_0x557945){_0x37e4ee=_0x557945;return _0x557945[_0x0487('0x61')](_0x18efe8['body']['id'],{'transaction':_0x58d989});}})[_0x0487('0x28')](function(_0x2078e7){if(_0x2078e7){return db['Sound']['findOne']({'where':{'id':_0x18efe8[_0x0487('0x4a')]['id']},'attributes':['id',_0x0487('0x2d'),'save_name',_0x0487('0x62'),_0x0487('0x63')],'raw':!![]});}})[_0x0487('0x28')](function(_0x451a96){if(_0x451a96){var _0x5bbaa0=path[_0x0487('0x50')](config[_0x0487('0x51')],'server/files/sounds/converted',util[_0x0487('0x64')](_0x0487('0x65'),path['basename'](_0x451a96['save_name'],path['extname'](_0x451a96[_0x0487('0x66')])),_0x451a96[_0x0487('0x62')]));var _0x23b38f=path[_0x0487('0x50')](config[_0x0487('0x51')],_0x0487('0x52'),_0x37e4ee['name'],util['format'](_0x0487('0x65'),_0x451a96['name'],_0x451a96[_0x0487('0x62')]));fs[_0x0487('0x67')](_0x5bbaa0,_0x23b38f);return _0x451a96;}})['catch'](function(_0x463ef2){throw new db['Sequelize'][(_0x0487('0x68'))](_0x463ef2['message']);});})[_0x0487('0x28')](handleEntityNotFound(_0x3f2dfe,null))['then'](respondWithResult(_0x3f2dfe,0xc9))['catch'](handleError(_0x3f2dfe,null));};exports[_0x0487('0x69')]=function(_0x3dcc69,_0x17832f,_0x5d9d16){return db[_0x0487('0x4d')][_0x0487('0x5c')](function(_0x44269c){var _0x3f4f89;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x3dcc69[_0x0487('0x4b')]['id']}})[_0x0487('0x28')](handleEntityNotFound(_0x17832f,null))[_0x0487('0x28')](function(_0xcf57d){if(_0xcf57d){_0x3f4f89=_0xcf57d;return _0xcf57d['removeSound'](_0x3dcc69[_0x0487('0x4b')][_0x0487('0x6a')]);}})[_0x0487('0x28')](function(_0x3d210c){if(_0x3d210c){return db[_0x0487('0x6b')][_0x0487('0x6c')]({'where':{'id':_0x3dcc69['params']['id2']},'attributes':['id',_0x0487('0x2d'),_0x0487('0x66'),'converted_format','createdAt'],'raw':!![]});}})[_0x0487('0x28')](function(_0x5594f4){if(_0x5594f4){fs[_0x0487('0x6d')](path['join'](_0x3f4f89[_0x0487('0x54')],util[_0x0487('0x64')](_0x0487('0x65'),_0x5594f4['name'],_0x5594f4[_0x0487('0x62')])));return _0x5594f4;}})[_0x0487('0x44')](function(_0x27dc23){throw new db[(_0x0487('0x60'))][(_0x0487('0x68'))](_0x27dc23[_0x0487('0x6e')]);});})[_0x0487('0x28')](handleEntityNotFound(_0x17832f,null))[_0x0487('0x28')](respondWithStatusCode(_0x17832f,0xcc))[_0x0487('0x44')](handleError(_0x17832f,null));};exports[_0x0487('0x6f')]=function(_0x202cf8,_0x2dcc3d,_0xa914ba){var _0xae8a32={};var _0x411250={};var _0x4da0c0;var _0x4729d1;return db[_0x0487('0x40')][_0x0487('0x6c')]({'where':{'id':_0x202cf8[_0x0487('0x4b')]['id']}})[_0x0487('0x28')](handleEntityNotFound(_0x2dcc3d,null))[_0x0487('0x28')](function(_0x313d05){if(_0x313d05){_0x4da0c0=_0x313d05;_0x411250[_0x0487('0x33')]=_['keys'](db[_0x0487('0x6b')][_0x0487('0x30')]);_0x411250[_0x0487('0x34')]=_[_0x0487('0x46')](_0x202cf8[_0x0487('0x34')]);_0x411250['filters']=_[_0x0487('0x37')](_0x411250['model'],_0x411250[_0x0487('0x34')]);_0xae8a32[_0x0487('0x36')]=_[_0x0487('0x37')](_0x411250[_0x0487('0x33')],qs[_0x0487('0x38')](_0x202cf8[_0x0487('0x34')][_0x0487('0x38')]));_0xae8a32[_0x0487('0x36')]=_0xae8a32[_0x0487('0x36')][_0x0487('0x47')]?_0xae8a32[_0x0487('0x36')]:_0x411250[_0x0487('0x33')];_0xae8a32[_0x0487('0x70')]=qs['sort'](_0x202cf8[_0x0487('0x34')][_0x0487('0x3a')]);_0xae8a32[_0x0487('0x3b')]=qs[_0x0487('0x35')](_[_0x0487('0x71')](_0x202cf8[_0x0487('0x34')],_0x411250[_0x0487('0x35')]));if(_0x202cf8[_0x0487('0x34')]['filter']){_0xae8a32[_0x0487('0x3b')]=_[_0x0487('0x3c')](_0xae8a32[_0x0487('0x3b')],{'$or':_[_0x0487('0x3d')](_0xae8a32[_0x0487('0x36')],function(_0x45fead){var _0x2190c8={};_0x2190c8[_0x45fead]={'$like':'%'+_0x202cf8[_0x0487('0x34')][_0x0487('0x3f')]+'%'};return _0x2190c8;})});}_0xae8a32=_['merge']({},_0xae8a32,_0x202cf8['options']);return _0x4da0c0['getSounds'](_0xae8a32);}})['then'](function(_0x2b231a){if(_0x2b231a){_0x4729d1=_0x2b231a['length'];if(!_0x202cf8[_0x0487('0x34')]['hasOwnProperty'](_0x0487('0x39'))){_0xae8a32['limit']=qs['limit'](_0x202cf8[_0x0487('0x34')]['limit']);_0xae8a32[_0x0487('0x1e')]=qs['offset'](_0x202cf8['query'][_0x0487('0x1e')]);}return _0x4da0c0['getSounds'](_0xae8a32);}})[_0x0487('0x28')](function(_0x2bb432){if(_0x2bb432){return _0x2bb432?{'count':_0x4729d1,'rows':_0x2bb432}:null;}})[_0x0487('0x28')](respondWithResult(_0x2dcc3d,null))[_0x0487('0x44')](handleError(_0x2dcc3d,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 4212cd9..6c53ab2 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 _0x4b68=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold'];(function(_0x4c01a9,_0x439a04){var _0x26c36e=function(_0x3abe0d){while(--_0x3abe0d){_0x4c01a9['push'](_0x4c01a9['shift']());}};_0x26c36e(++_0x439a04);}(_0x4b68,0x104));var _0x84b6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4b68[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x84b6('0x0'));var util=require('util');var logger=require(_0x84b6('0x1'))(_0x84b6('0x2'));var moment=require(_0x84b6('0x3'));var BPromise=require(_0x84b6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x84b6('0x5'));var rimraf=require(_0x84b6('0x6'));var config=require(_0x84b6('0x7'));var attributes=require(_0x84b6('0x8'));module[_0x84b6('0x9')]=function(_0xb7a325,_0x132d94){return _0xb7a325[_0x84b6('0xa')](_0x84b6('0xb'),attributes,{'tableName':_0x84b6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x114c=['exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMusicOnHold.attributes'];(function(_0x15a3d3,_0x1fe368){var _0x1fa778=function(_0x3ad80a){while(--_0x3ad80a){_0x15a3d3['push'](_0x15a3d3['shift']());}};_0x1fa778(++_0x1fe368);}(_0x114c,0x154));var _0xc114=function(_0x803806,_0x24afee){_0x803806=_0x803806-0x0;var _0x2eb618=_0x114c[_0x803806];return _0x2eb618;};'use strict';var _=require(_0xc114('0x0'));var util=require(_0xc114('0x1'));var logger=require(_0xc114('0x2'))(_0xc114('0x3'));var moment=require(_0xc114('0x4'));var BPromise=require(_0xc114('0x5'));var rp=require(_0xc114('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc114('0x7'));var config=require(_0xc114('0x8'));var attributes=require(_0xc114('0x9'));module[_0xc114('0xa')]=function(_0x28290f,_0x277efd){return _0x28290f[_0xc114('0xb')](_0xc114('0xc'),attributes,{'tableName':_0xc114('0xd'),'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 e679415..f7a9ef2 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 _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(_0x524767,_0x137d53){var _0x415bc4=function(_0x2e4061){while(--_0x2e4061){_0x524767['push'](_0x524767['shift']());}};_0x415bc4(++_0x137d53);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4b5813,_0x5769de){_0x4b5813=_0x4b5813-0x0;var _0x423465=_0xcb91[_0x4b5813];return _0x423465;};'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 +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(_0x4654f9,_0x19ce28){var _0x1124c3=function(_0x1c36cb){while(--_0x1c36cb){_0x4654f9['push'](_0x4654f9['shift']());}};_0x1124c3(++_0x19ce28);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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/voicePrefix/index.js b/server/api/voicePrefix/index.js index 397e9d2..4a76c3b 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 _0x88d5=['../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','describe','/:id','getAgents','/:id/teams','getTeams','create','/:id/users','addAgents','post','put','delete','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x88d5,0x76));var _0x588d=function(_0x5dff5b,_0x600c5d){_0x5dff5b=_0x5dff5b-0x0;var _0x34dd83=_0x88d5[_0x5dff5b];return _0x34dd83;};'use strict';var multer=require(_0x588d('0x0'));var util=require(_0x588d('0x1'));var path=require(_0x588d('0x2'));var timeout=require(_0x588d('0x3'));var express=require(_0x588d('0x4'));var router=express['Router']();var fs_extra=require(_0x588d('0x5'));var auth=require(_0x588d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x588d('0x7'));var controller=require(_0x588d('0x8'));router[_0x588d('0x9')]('/',auth[_0x588d('0xa')](),controller[_0x588d('0xb')]);router[_0x588d('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x588d('0xc')]);router[_0x588d('0x9')](_0x588d('0xd'),auth[_0x588d('0xa')](),controller['show']);router[_0x588d('0x9')]('/:id/users',auth[_0x588d('0xa')](),controller[_0x588d('0xe')]);router['get'](_0x588d('0xf'),auth[_0x588d('0xa')](),controller[_0x588d('0x10')]);router['post']('/',auth[_0x588d('0xa')](),controller[_0x588d('0x11')]);router['post'](_0x588d('0x12'),auth[_0x588d('0xa')](),controller[_0x588d('0x13')]);router[_0x588d('0x14')](_0x588d('0xf'),auth['isAuthenticated'](),controller['addTeams']);router[_0x588d('0x15')](_0x588d('0xd'),auth[_0x588d('0xa')](),controller['update']);router['delete'](_0x588d('0xd'),auth[_0x588d('0xa')](),controller['destroy']);router[_0x588d('0x16')](_0x588d('0x12'),auth[_0x588d('0xa')](),controller[_0x588d('0x17')]);router['delete'](_0x588d('0xf'),auth[_0x588d('0xa')](),controller['removeTeams']);module[_0x588d('0x18')]=router; \ No newline at end of file +var _0xb1a3=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','show','getTeams','post','create','/:id/users','addAgents','addTeams','put','/:id','update','delete','destroy','removeAgents','/:id/teams','removeTeams','exports','multer','util','path','express'];(function(_0x1d067e,_0x3b48d1){var _0x3a164e=function(_0x19545c){while(--_0x19545c){_0x1d067e['push'](_0x1d067e['shift']());}};_0x3a164e(++_0x3b48d1);}(_0xb1a3,0x1cc));var _0x3b1a=function(_0x602ca8,_0x568e82){_0x602ca8=_0x602ca8-0x0;var _0x26e8ab=_0xb1a3[_0x602ca8];return _0x26e8ab;};'use strict';var multer=require(_0x3b1a('0x0'));var util=require(_0x3b1a('0x1'));var path=require(_0x3b1a('0x2'));var timeout=require('connect-timeout');var express=require(_0x3b1a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3b1a('0x4'));var interaction=require(_0x3b1a('0x5'));var config=require(_0x3b1a('0x6'));var controller=require(_0x3b1a('0x7'));router[_0x3b1a('0x8')]('/',auth[_0x3b1a('0x9')](),controller[_0x3b1a('0xa')]);router['get'](_0x3b1a('0xb'),auth[_0x3b1a('0x9')](),controller[_0x3b1a('0xc')]);router[_0x3b1a('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x3b1a('0xd')]);router[_0x3b1a('0x8')]('/:id/users',auth[_0x3b1a('0x9')](),controller['getAgents']);router[_0x3b1a('0x8')]('/:id/teams',auth[_0x3b1a('0x9')](),controller[_0x3b1a('0xe')]);router[_0x3b1a('0xf')]('/',auth[_0x3b1a('0x9')](),controller[_0x3b1a('0x10')]);router[_0x3b1a('0xf')](_0x3b1a('0x11'),auth[_0x3b1a('0x9')](),controller[_0x3b1a('0x12')]);router['post']('/:id/teams',auth[_0x3b1a('0x9')](),controller[_0x3b1a('0x13')]);router[_0x3b1a('0x14')](_0x3b1a('0x15'),auth['isAuthenticated'](),controller[_0x3b1a('0x16')]);router[_0x3b1a('0x17')]('/:id',auth[_0x3b1a('0x9')](),controller[_0x3b1a('0x18')]);router[_0x3b1a('0x17')](_0x3b1a('0x11'),auth[_0x3b1a('0x9')](),controller[_0x3b1a('0x19')]);router[_0x3b1a('0x17')](_0x3b1a('0x1a'),auth['isAuthenticated'](),controller[_0x3b1a('0x1b')]);module[_0x3b1a('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 5086f36..8363aa0 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 _0xbc37=['STRING','name','VIRTUAL','system-','INTEGER','sequelize'];(function(_0x4e0e8b,_0x33b0c1){var _0x1b63f1=function(_0x454c39){while(--_0x454c39){_0x4e0e8b['push'](_0x4e0e8b['shift']());}};_0x1b63f1(++_0x33b0c1);}(_0xbc37,0x16d));var _0x7bc3=function(_0x4e22d6,_0x5a40b1){_0x4e22d6=_0x4e22d6-0x0;var _0x511d3f=_0xbc37[_0x4e22d6];return _0x511d3f;};'use strict';var Sequelize=require(_0x7bc3('0x0'));module['exports']={'name':{'type':Sequelize[_0x7bc3('0x1')],'allowNull':![],'unique':_0x7bc3('0x2')},'prefix':{'type':Sequelize[_0x7bc3('0x3')],'get':function(_0x2ed29b){return _0x7bc3('0x4')+this['getDataValue']('name')+'-';}},'description':{'type':Sequelize[_0x7bc3('0x1')]},'callerIdAll':{'type':Sequelize[_0x7bc3('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x7bc3('0x5')]}}; \ No newline at end of file +var _0x6443=['getDataValue','name','INTEGER','sequelize','exports','STRING','VIRTUAL','system-'];(function(_0xa44e39,_0x216157){var _0x295ff1=function(_0x55dc8b){while(--_0x55dc8b){_0xa44e39['push'](_0xa44e39['shift']());}};_0x295ff1(++_0x216157);}(_0x6443,0x163));var _0x3644=function(_0x220afa,_0xf5f6cc){_0x220afa=_0x220afa-0x0;var _0x1b79d1=_0x6443[_0x220afa];return _0x1b79d1;};'use strict';var Sequelize=require(_0x3644('0x0'));module[_0x3644('0x1')]={'name':{'type':Sequelize[_0x3644('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x3644('0x3')],'get':function(_0x1f78d3){return _0x3644('0x4')+this[_0x3644('0x5')](_0x3644('0x6'))+'-';}},'description':{'type':Sequelize[_0x3644('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x3644('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 24efb59..340bced 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 _0xc900=['voicePause','interface','each','TeamVoicePrefix','upsert','UserVoicePrefix','forEach','removeTeams','tq.TeamId','from','join','user_has_teams','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','union','compact','value','isEmpty','removeAgents','zip-dir','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/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','get','VoicePrefixes','UserProfileResource','end','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VoicePrefix','includeAll','include','findAll','show','params','options','catch','destroy','find','describe','create','transaction','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','context','exten','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoiceExtension','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','goto','${EXTEN:','update','system-','sequelize','findById','addAgents','omit','ids','spread','emit','userVoicePrefix:save','isArray','userVoicePrefix:remove','getAgents','findOne','User','hasOwnProperty','Team','getTeams','addTeams','Agents'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0xc900,0xb3));var _0x0c90=function(_0x55c512,_0x361df5){_0x55c512=_0x55c512-0x0;var _0x31d2a3=_0xc900[_0x55c512];return _0x31d2a3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0c90('0x0'));var jsonpatch=require(_0x0c90('0x1'));var rp=require(_0x0c90('0x2'));var moment=require('moment');var BPromise=require(_0x0c90('0x3'));var Mustache=require(_0x0c90('0x4'));var util=require('util');var path=require(_0x0c90('0x5'));var sox=require(_0x0c90('0x6'));var csv=require(_0x0c90('0x7'));var ejs=require(_0x0c90('0x8'));var fs=require('fs');var fs_extra=require(_0x0c90('0x9'));var _=require(_0x0c90('0xa'));var squel=require('squel');var crypto=require(_0x0c90('0xb'));var jsforce=require(_0x0c90('0xc'));var deskjs=require(_0x0c90('0xd'));var toCsv=require(_0x0c90('0x7'));var querystring=require(_0x0c90('0xe'));var Papa=require(_0x0c90('0xf'));var Redis=require(_0x0c90('0x10'));var authService=require(_0x0c90('0x11'));var qs=require(_0x0c90('0x12'));var as=require(_0x0c90('0x13'));var hardwareService=require(_0x0c90('0x14'));var logger=require(_0x0c90('0x15'))(_0x0c90('0x16'));var utils=require('../../config/utils');var config=require(_0x0c90('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c90('0x18'))['db'];config['redis']=_[_0x0c90('0x19')](config[_0x0c90('0x1a')],{'host':_0x0c90('0x1b'),'port':0x18eb});var socket=require(_0x0c90('0x1c'))(new Redis(config[_0x0c90('0x1a')]));require('./voicePrefix.socket')[_0x0c90('0x1d')](socket);function respondWithStatusCode(_0x4451e0,_0x4f35f4){_0x4f35f4=_0x4f35f4||0xcc;return function(_0x2c82a4){if(_0x2c82a4){return _0x4451e0[_0x0c90('0x1e')](_0x4f35f4);}return _0x4451e0[_0x0c90('0x1f')](_0x4f35f4)['end']();};}function respondWithResult(_0x5daeb7,_0x412635){_0x412635=_0x412635||0xc8;return function(_0x15ca42){if(_0x15ca42){return _0x5daeb7[_0x0c90('0x1f')](_0x412635)[_0x0c90('0x20')](_0x15ca42);}};}function respondWithFilteredResult(_0x276b92,_0x2cab22){return function(_0x42321a){if(_0x42321a){var _0x57b9a6=typeof _0x2cab22[_0x0c90('0x21')]===_0x0c90('0x22')&&typeof _0x2cab22[_0x0c90('0x23')]===_0x0c90('0x22');var _0x594267=_0x42321a[_0x0c90('0x24')];var _0xd129ca=_0x57b9a6?0x0:_0x2cab22[_0x0c90('0x21')];var _0x1241a9=_0x57b9a6?_0x42321a[_0x0c90('0x24')]:_0x2cab22[_0x0c90('0x21')]+_0x2cab22['limit'];var _0x365a42;if(_0x1241a9>=_0x594267){_0x1241a9=_0x594267;_0x365a42=0xc8;}else{_0x365a42=0xce;}_0x276b92['status'](_0x365a42);return _0x276b92[_0x0c90('0x25')](_0x0c90('0x26'),_0xd129ca+'-'+_0x1241a9+'/'+_0x594267)['json'](_0x42321a);}return null;};}function patchUpdates(_0x2a053a){return function(_0x43ddc3){try{jsonpatch[_0x0c90('0x27')](_0x43ddc3,_0x2a053a,!![]);}catch(_0x86dee){return BPromise[_0x0c90('0x28')](_0x86dee);}return _0x43ddc3[_0x0c90('0x29')]();};}function saveUpdates(_0x4dfbc3,_0x26f0a3){return function(_0x12f22c){if(_0x12f22c){return _0x12f22c['update'](_0x4dfbc3)['then'](function(_0x28d005){return _0x28d005;});}return null;};}function removeEntity(_0x3ea861,_0x35c243){return function(_0x109a5f){if(_0x109a5f){return _0x109a5f['destroy']()[_0x0c90('0x2a')](function(){var _0x438652=_0x109a5f[_0x0c90('0x2b')]({'plain':!![]});var _0x277d4a=_0x0c90('0x2c');return db[_0x0c90('0x2d')]['destroy']({'where':{'type':_0x277d4a,'resourceId':_0x438652['id']}})[_0x0c90('0x2a')](function(){return _0x109a5f;});})[_0x0c90('0x2a')](function(){_0x3ea861[_0x0c90('0x1f')](0xcc)[_0x0c90('0x2e')]();});}};}function handleEntityNotFound(_0x52d28d,_0x4c8603){return function(_0x1f27f1){if(!_0x1f27f1){_0x52d28d[_0x0c90('0x1e')](0x194);}return _0x1f27f1;};}function handleError(_0x3bff04,_0x122a4f){_0x122a4f=_0x122a4f||0x1f4;return function(_0x119e09){logger['error'](_0x119e09[_0x0c90('0x2f')]);if(_0x119e09[_0x0c90('0x30')]){delete _0x119e09[_0x0c90('0x30')];}_0x3bff04['status'](_0x122a4f)[_0x0c90('0x31')](_0x119e09);};}exports['index']=function(_0x54a3f5,_0x886634){var _0x5071b={},_0x2f0835={},_0x41189f={'count':0x0,'rows':[]};var _0x58c01a=_[_0x0c90('0x32')](db['VoicePrefix'][_0x0c90('0x33')],function(_0x5a0e75){return{'name':_0x5a0e75[_0x0c90('0x34')],'type':_0x5a0e75[_0x0c90('0x35')]['key']};});_0x2f0835[_0x0c90('0x36')]=_[_0x0c90('0x32')](_0x58c01a,_0x0c90('0x30'));_0x2f0835[_0x0c90('0x37')]=_[_0x0c90('0x38')](_0x54a3f5[_0x0c90('0x37')]);_0x2f0835[_0x0c90('0x39')]=_[_0x0c90('0x3a')](_0x2f0835['model'],_0x2f0835[_0x0c90('0x37')]);_0x5071b[_0x0c90('0x3b')]=_[_0x0c90('0x3a')](_0x2f0835[_0x0c90('0x36')],qs['fields'](_0x54a3f5[_0x0c90('0x37')][_0x0c90('0x3c')]));_0x5071b[_0x0c90('0x3b')]=_0x5071b[_0x0c90('0x3b')][_0x0c90('0x3d')]?_0x5071b[_0x0c90('0x3b')]:_0x2f0835[_0x0c90('0x36')];if(!_0x54a3f5[_0x0c90('0x37')]['hasOwnProperty'](_0x0c90('0x3e'))){_0x5071b[_0x0c90('0x23')]=qs['limit'](_0x54a3f5[_0x0c90('0x37')][_0x0c90('0x23')]);_0x5071b[_0x0c90('0x21')]=qs[_0x0c90('0x21')](_0x54a3f5[_0x0c90('0x37')]['offset']);}_0x5071b[_0x0c90('0x3f')]=qs[_0x0c90('0x40')](_0x54a3f5[_0x0c90('0x37')][_0x0c90('0x40')]);_0x5071b[_0x0c90('0x41')]=qs[_0x0c90('0x39')](_[_0x0c90('0x42')](_0x54a3f5[_0x0c90('0x37')],_0x2f0835[_0x0c90('0x39')]),_0x58c01a);if(_0x54a3f5['query'][_0x0c90('0x43')]){_0x5071b['where']=_[_0x0c90('0x44')](_0x5071b['where'],{'$or':_[_0x0c90('0x32')](_0x58c01a,function(_0x62e316){if(_0x62e316['type']!=='VIRTUAL'){var _0x27ef6f={};_0x27ef6f[_0x62e316['name']]={'$like':'%'+_0x54a3f5[_0x0c90('0x37')][_0x0c90('0x43')]+'%'};return _0x27ef6f;}})});}_0x5071b=_[_0x0c90('0x44')]({},_0x5071b,_0x54a3f5['options']);var _0x2ad8eb={'where':_0x5071b[_0x0c90('0x41')]};return db[_0x0c90('0x45')][_0x0c90('0x24')](_0x2ad8eb)[_0x0c90('0x2a')](function(_0x1184c4){_0x41189f['count']=_0x1184c4;if(_0x54a3f5[_0x0c90('0x37')][_0x0c90('0x46')]){_0x5071b[_0x0c90('0x47')]=[{'all':!![]}];}return db[_0x0c90('0x45')][_0x0c90('0x48')](_0x5071b);})[_0x0c90('0x2a')](function(_0x30b9df){_0x41189f['rows']=_0x30b9df;return _0x41189f;})[_0x0c90('0x2a')](respondWithFilteredResult(_0x886634,_0x5071b))['catch'](handleError(_0x886634,null));};exports[_0x0c90('0x49')]=function(_0x2470ce,_0x1a7a36){var _0x1179b0={'raw':![],'where':{'id':_0x2470ce[_0x0c90('0x4a')]['id']}},_0x38842c={};_0x38842c[_0x0c90('0x36')]=_[_0x0c90('0x38')](db[_0x0c90('0x45')][_0x0c90('0x33')]);_0x38842c[_0x0c90('0x37')]=_[_0x0c90('0x38')](_0x2470ce[_0x0c90('0x37')]);_0x38842c[_0x0c90('0x39')]=_[_0x0c90('0x3a')](_0x38842c['model'],_0x38842c[_0x0c90('0x37')]);_0x1179b0[_0x0c90('0x3b')]=_[_0x0c90('0x3a')](_0x38842c[_0x0c90('0x36')],qs[_0x0c90('0x3c')](_0x2470ce[_0x0c90('0x37')][_0x0c90('0x3c')]));_0x1179b0[_0x0c90('0x3b')]=_0x1179b0[_0x0c90('0x3b')][_0x0c90('0x3d')]?_0x1179b0[_0x0c90('0x3b')]:_0x38842c[_0x0c90('0x36')];if(_0x2470ce[_0x0c90('0x37')][_0x0c90('0x46')]){_0x1179b0['include']=[{'all':!![]}];}_0x1179b0=_[_0x0c90('0x44')]({},_0x1179b0,_0x2470ce[_0x0c90('0x4b')]);return db['VoicePrefix']['find'](_0x1179b0)['then'](handleEntityNotFound(_0x1a7a36,null))[_0x0c90('0x2a')](respondWithResult(_0x1a7a36,null))[_0x0c90('0x4c')](handleError(_0x1a7a36,null));};exports[_0x0c90('0x4d')]=function(_0x3fbdfc,_0x11d2de){return db['VoicePrefix'][_0x0c90('0x4e')]({'where':{'id':_0x3fbdfc[_0x0c90('0x4a')]['id']}})[_0x0c90('0x2a')](handleEntityNotFound(_0x11d2de,null))['then'](removeEntity(_0x11d2de,null))[_0x0c90('0x4c')](handleError(_0x11d2de,null));};exports[_0x0c90('0x4f')]=function(_0xd639a1,_0xb483e7){return db[_0x0c90('0x45')][_0x0c90('0x4f')]()[_0x0c90('0x2a')](respondWithResult(_0xb483e7,null))[_0x0c90('0x4c')](handleError(_0xb483e7,null));};exports[_0x0c90('0x50')]=function(_0xeeee3b,_0x5e288e){var _0xac80b2;return db['sequelize'][_0x0c90('0x51')](function(_0x67539d){return db[_0x0c90('0x45')][_0x0c90('0x50')](_0xeeee3b[_0x0c90('0x52')],{'transaction':_0x67539d})[_0x0c90('0x2a')](function(_0x58dcfc){_0xac80b2=_0x58dcfc['get']({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0xac80b2[_0x0c90('0x53')]},'raw':!![]})[_0x0c90('0x2a')](function(_0x3bf5de){return createVoicePrefixExtensions(_0xac80b2,_0x3bf5de,_0x67539d);});});})['then'](function(){var _0x202666=_0xeeee3b[_0x0c90('0x54')]['get']({'plain':!![]});if(!_0x202666)throw new Error(_0x0c90('0x55'));if(_0x202666['role']===_0x0c90('0x54')){var _0x8951f2=_0xac80b2;return db[_0x0c90('0x56')][_0x0c90('0x4e')]({'where':{'name':'VoicePrefixes','userProfileId':_0x202666[_0x0c90('0x57')]},'raw':!![]})['then'](function(_0x344613){if(_0x344613&&_0x344613[_0x0c90('0x58')]===0x0){return db['UserProfileResource']['create']({'name':_0x8951f2['name'],'resourceId':_0x8951f2['id'],'type':_0x344613[_0x0c90('0x30')],'sectionId':_0x344613['id']},{})[_0x0c90('0x2a')](function(){return _0xac80b2;});}else{return _0xac80b2;}})[_0x0c90('0x4c')](function(_0x2f61cb){logger[_0x0c90('0x59')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f61cb);throw _0x2f61cb;});}return _0xac80b2;})[_0x0c90('0x2a')](respondWithResult(_0x5e288e,null))[_0x0c90('0x4c')](handleError(_0x5e288e,null));};function Extension(_0x5ee971,_0x3eb725,_0x5a11e5,_0x24326b){this[_0x0c90('0x5a')]='from-sip';this[_0x0c90('0x5b')]=_0x5ee971;this['app']=_0x5a11e5;this['type']='system';this[_0x0c90('0x5c')]=_0x0c90('0x5d');this[_0x0c90('0x5e')]=_0x3eb725;this[_0x0c90('0x5f')]=_0x24326b;}function createVoicePrefixExtensions(_0x536a26,_0x5b385b,_0x426f65){return new BPromise(function(_0xd982c5,_0x120b88){var _0x4c4e5a=new Extension(formatPrefixName(_0x536a26[_0x0c90('0x60')]),0x1,_0x0c90('0x61'),_0x0c90('0x62'));_0x4c4e5a['VoicePrefixId']=_0x536a26['id'];return db[_0x0c90('0x63')][_0x0c90('0x50')](_0x4c4e5a,{'transaction':_0x426f65})[_0x0c90('0x2a')](function(_0x521436){var _0x31343b=_0x521436[_0x0c90('0x2b')]({'plain':!![]});var _0x1a198b=_[_0x0c90('0x32')](addVoicePrefixExtensions(_0x536a26,_0x5b385b),function(_0xf58a25){_0xf58a25[_0x0c90('0x53')]=_0x31343b['id'];_0xf58a25[_0x0c90('0x64')]=_0x536a26['id'];return _0xf58a25;});return db[_0x0c90('0x63')][_0x0c90('0x65')](_0x1a198b,{'transaction':_0x426f65})['then'](function(_0x530bbe){if(!_0x530bbe){return _0x120b88(_0x0c90('0x66'));}else{return _0xd982c5(_0x530bbe);}})[_0x0c90('0x4c')](function(_0x3a44df){return _0x120b88(_0x3a44df);});});;});};function addVoicePrefixExtensions(_0x2faf14,_0x19dae5){var _0x2dad30=[];var _0x2f1459=formatPrefixName(_0x2faf14[_0x0c90('0x60')]);_0x2dad30[_0x0c90('0x67')](new Extension(_0x2f1459,0x2,_0x0c90('0x68'),_0x0c90('0x69')+_0x2faf14[_0x0c90('0x30')]));if(_0x2faf14[_0x0c90('0x6a')]){_0x2dad30[_0x0c90('0x67')](new Extension(_0x2f1459,0x3,_0x0c90('0x68'),'PREFIX-CALLERIDALL='+_0x2faf14[_0x0c90('0x6a')]));}else{_0x2dad30[_0x0c90('0x67')](new Extension(_0x2f1459,0x3,_0x0c90('0x61'),'No\x20callerid\x20available'));}_0x2dad30['push'](new Extension(_0x2f1459,0x4,_0x0c90('0x6b'),_0x19dae5['context']+','+_0x0c90('0x6c')+(0x8+_0x2faf14[_0x0c90('0x30')]['length'])+'}'+','+0x1));return _0x2dad30;}function formatPrefixName(_0x2c64e0){var _0x3f4819='_';for(var _0x25ef97=0x0;_0x25ef97<_0x2c64e0[_0x0c90('0x3d')];_0x25ef97++){if(_0x2c64e0['charAt'](_0x25ef97)=='-'){_0x3f4819+=_0x2c64e0['charAt'](_0x25ef97);}else{_0x3f4819+='['+_0x2c64e0['charAt'](_0x25ef97)+']';}}_0x3f4819+='.';return _0x3f4819;}exports[_0x0c90('0x6d')]=function(_0x2d3287,_0x3bc90d,_0x2d5fe3){var _0x4a801f=_0x2d3287[_0x0c90('0x52')];_0x4a801f['prefix']=_0x0c90('0x6e')+_0x4a801f[_0x0c90('0x30')]+'-';return db[_0x0c90('0x6f')]['transaction'](function(_0x10f686){return db[_0x0c90('0x45')][_0x0c90('0x6d')](_0x4a801f,{'where':{'id':_0x4a801f['id']},'transaction':_0x10f686})[_0x0c90('0x2a')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x4a801f['id']},'transaction':_0x10f686})[_0x0c90('0x2a')](function(){return db['VoiceExtension'][_0x0c90('0x4e')]({'where':{'id':_0x4a801f[_0x0c90('0x53')]},'raw':!![]})[_0x0c90('0x2a')](function(_0x4a59b5){return createVoicePrefixExtensions(_0x4a801f,_0x4a59b5,_0x10f686);});});});})[_0x0c90('0x2a')](function(){return db[_0x0c90('0x45')][_0x0c90('0x70')](_0x4a801f['id']);})[_0x0c90('0x2a')](respondWithResult(_0x3bc90d,null))[_0x0c90('0x4c')](handleError(_0x3bc90d,null));};exports[_0x0c90('0x71')]=function(_0x53779b,_0x28a2f0,_0x431828){return db[_0x0c90('0x45')][_0x0c90('0x4e')]({'where':{'id':_0x53779b[_0x0c90('0x4a')]['id']}})[_0x0c90('0x2a')](handleEntityNotFound(_0x28a2f0,null))[_0x0c90('0x2a')](function(_0x1777ac){if(_0x1777ac){return _0x1777ac[_0x0c90('0x71')](_0x53779b[_0x0c90('0x52')]['ids'],_[_0x0c90('0x72')](_0x53779b[_0x0c90('0x52')],[_0x0c90('0x73'),'id'])||{})[_0x0c90('0x74')](function(_0x4e8330){for(var _0x2e68ea=0x0;_0x2e68ea<_0x53779b[_0x0c90('0x52')][_0x0c90('0x73')]['length'];_0x2e68ea+=0x1){socket[_0x0c90('0x75')](_0x0c90('0x76'),{'UserId':Number(_0x53779b['body'][_0x0c90('0x73')][_0x2e68ea]),'VoicePrefixId':Number(_0x53779b['params']['id'])});}return _0x4e8330;});}})[_0x0c90('0x2a')](respondWithResult(_0x28a2f0,null))['catch'](handleError(_0x28a2f0,null));};exports['removeAgents']=function(_0x42e76a,_0x137c30,_0x56a38b){return db['VoicePrefix'][_0x0c90('0x4e')]({'where':{'id':_0x42e76a[_0x0c90('0x4a')]['id']}})['then'](handleEntityNotFound(_0x137c30,null))['then'](function(_0x250d41){if(_0x250d41){return _0x250d41['removeAgents'](_0x42e76a[_0x0c90('0x37')][_0x0c90('0x73')])[_0x0c90('0x2a')](function(){if(_[_0x0c90('0x77')](_0x42e76a[_0x0c90('0x37')]['ids'])){for(var _0x471caa=0x0;_0x471caa<_0x42e76a[_0x0c90('0x37')][_0x0c90('0x73')]['length'];_0x471caa+=0x1){socket['emit'](_0x0c90('0x78'),{'UserId':Number(_0x42e76a[_0x0c90('0x37')][_0x0c90('0x73')][_0x471caa]),'VoicePrefixId':Number(_0x42e76a['params']['id'])});}}else{socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x42e76a[_0x0c90('0x37')]['ids']),'VoicePrefixId':Number(_0x42e76a['params']['id'])});}});}})['then'](respondWithStatusCode(_0x137c30,null))['catch'](handleError(_0x137c30,null));};exports[_0x0c90('0x79')]=function(_0x2ca017,_0x1bf6e0,_0x29ede1){var _0x16c383={};var _0x56a3bc={};var _0x5562cc;var _0x57eab8;return db[_0x0c90('0x45')][_0x0c90('0x7a')]({'where':{'id':_0x2ca017[_0x0c90('0x4a')]['id']}})[_0x0c90('0x2a')](handleEntityNotFound(_0x1bf6e0,null))[_0x0c90('0x2a')](function(_0x3d5521){if(_0x3d5521){_0x5562cc=_0x3d5521;_0x56a3bc['model']=_[_0x0c90('0x38')](db[_0x0c90('0x7b')][_0x0c90('0x33')]);_0x56a3bc[_0x0c90('0x37')]=_[_0x0c90('0x38')](_0x2ca017[_0x0c90('0x37')]);_0x56a3bc[_0x0c90('0x39')]=_[_0x0c90('0x3a')](_0x56a3bc[_0x0c90('0x36')],_0x56a3bc[_0x0c90('0x37')]);_0x16c383[_0x0c90('0x3b')]=_[_0x0c90('0x3a')](_0x56a3bc['model'],qs[_0x0c90('0x3c')](_0x2ca017['query'][_0x0c90('0x3c')]));_0x16c383['attributes']=_0x16c383[_0x0c90('0x3b')][_0x0c90('0x3d')]?_0x16c383[_0x0c90('0x3b')]:_0x56a3bc[_0x0c90('0x36')];_0x16c383['order']=qs['sort'](_0x2ca017[_0x0c90('0x37')][_0x0c90('0x40')]);_0x16c383['where']=qs[_0x0c90('0x39')](_[_0x0c90('0x42')](_0x2ca017['query'],_0x56a3bc[_0x0c90('0x39')]));if(_0x2ca017[_0x0c90('0x37')]['filter']){_0x16c383[_0x0c90('0x41')]=_['merge'](_0x16c383[_0x0c90('0x41')],{'$or':_[_0x0c90('0x32')](_0x16c383[_0x0c90('0x3b')],function(_0x1b95db){var _0x519f74={};_0x519f74[_0x1b95db]={'$like':'%'+_0x2ca017[_0x0c90('0x37')]['filter']+'%'};return _0x519f74;})});}_0x16c383=_[_0x0c90('0x44')]({},_0x16c383,_0x2ca017[_0x0c90('0x4b')]);return _0x5562cc[_0x0c90('0x79')](_0x16c383);}})[_0x0c90('0x2a')](function(_0x1306bb){if(_0x1306bb){_0x57eab8=_0x1306bb['length'];if(!_0x2ca017[_0x0c90('0x37')][_0x0c90('0x7c')](_0x0c90('0x3e'))){_0x16c383[_0x0c90('0x23')]=qs[_0x0c90('0x23')](_0x2ca017[_0x0c90('0x37')]['limit']);_0x16c383[_0x0c90('0x21')]=qs[_0x0c90('0x21')](_0x2ca017['query'][_0x0c90('0x21')]);}return _0x5562cc[_0x0c90('0x79')](_0x16c383);}})['then'](function(_0x199d05){if(_0x199d05){return _0x199d05?{'count':_0x57eab8,'rows':_0x199d05}:null;}})[_0x0c90('0x2a')](respondWithResult(_0x1bf6e0,null))['catch'](handleError(_0x1bf6e0,null));};exports['getTeams']=function(_0x13c69c,_0x407c6e,_0x4859e9){var _0x391e3f={};var _0x4fee0e={};var _0x37d1d5;var _0x4c142b;return db['VoicePrefix'][_0x0c90('0x7a')]({'where':{'id':_0x13c69c[_0x0c90('0x4a')]['id']}})[_0x0c90('0x2a')](handleEntityNotFound(_0x407c6e,null))['then'](function(_0x54846c){if(_0x54846c){_0x37d1d5=_0x54846c;_0x4fee0e[_0x0c90('0x36')]=_[_0x0c90('0x38')](db[_0x0c90('0x7d')][_0x0c90('0x33')]);_0x4fee0e[_0x0c90('0x37')]=_['keys'](_0x13c69c[_0x0c90('0x37')]);_0x4fee0e['filters']=_[_0x0c90('0x3a')](_0x4fee0e[_0x0c90('0x36')],_0x4fee0e[_0x0c90('0x37')]);_0x391e3f[_0x0c90('0x3b')]=_[_0x0c90('0x3a')](_0x4fee0e[_0x0c90('0x36')],qs[_0x0c90('0x3c')](_0x13c69c['query']['fields']));_0x391e3f[_0x0c90('0x3b')]=_0x391e3f[_0x0c90('0x3b')][_0x0c90('0x3d')]?_0x391e3f[_0x0c90('0x3b')]:_0x4fee0e[_0x0c90('0x36')];_0x391e3f[_0x0c90('0x3f')]=qs[_0x0c90('0x40')](_0x13c69c[_0x0c90('0x37')]['sort']);_0x391e3f[_0x0c90('0x41')]=qs['filters'](_[_0x0c90('0x42')](_0x13c69c[_0x0c90('0x37')],_0x4fee0e[_0x0c90('0x39')]));if(_0x13c69c[_0x0c90('0x37')][_0x0c90('0x43')]){_0x391e3f[_0x0c90('0x41')]=_[_0x0c90('0x44')](_0x391e3f['where'],{'$or':_['map'](_0x391e3f[_0x0c90('0x3b')],function(_0x4a001d){var _0x2204fe={};_0x2204fe[_0x4a001d]={'$like':'%'+_0x13c69c[_0x0c90('0x37')][_0x0c90('0x43')]+'%'};return _0x2204fe;})});}_0x391e3f=_['merge']({},_0x391e3f,_0x13c69c[_0x0c90('0x4b')]);return _0x37d1d5[_0x0c90('0x7e')](_0x391e3f);}})[_0x0c90('0x2a')](function(_0x30be13){if(_0x30be13){_0x4c142b=_0x30be13[_0x0c90('0x3d')];if(!_0x13c69c['query']['hasOwnProperty'](_0x0c90('0x3e'))){_0x391e3f[_0x0c90('0x23')]=qs[_0x0c90('0x23')](_0x13c69c[_0x0c90('0x37')][_0x0c90('0x23')]);_0x391e3f[_0x0c90('0x21')]=qs['offset'](_0x13c69c[_0x0c90('0x37')][_0x0c90('0x21')]);}return _0x37d1d5[_0x0c90('0x7e')](_0x391e3f);}})[_0x0c90('0x2a')](function(_0x5103ae){if(_0x5103ae){return _0x5103ae?{'count':_0x4c142b,'rows':_0x5103ae}:null;}})['then'](respondWithResult(_0x407c6e,null))[_0x0c90('0x4c')](handleError(_0x407c6e,null));};exports[_0x0c90('0x7f')]=function(_0x59e8d9,_0x9bed36,_0x379a0e){var _0x19a144=_0x59e8d9[_0x0c90('0x52')][_0x0c90('0x73')];var _0x5379bc;return db[_0x0c90('0x7d')]['findAll']({'where':{'id':_0x19a144},'attributes':['id'],'include':[{'model':db[_0x0c90('0x7b')],'as':_0x0c90('0x80'),'attributes':['id',_0x0c90('0x30'),'online',_0x0c90('0x81'),_0x0c90('0x82')],'raw':!![]}]})[_0x0c90('0x2a')](function(_0x5f295e){if(_0x5f295e){_0x5379bc=_0x5f295e;var _0x5a2961=_['flatMap'](_0x5f295e,function(_0x4930cd){var _0x2858a9=_0x4930cd[_0x0c90('0x2b')]({'plain':!![]});return _0x2858a9['Agents'];});return db['VoicePrefix'][_0x0c90('0x4e')]({'where':{'id':_0x59e8d9['params']['id']}})[_0x0c90('0x2a')](function(_0x13c0f2){return db[_0x0c90('0x6f')][_0x0c90('0x51')](function(_0x1091fb){return _0x13c0f2['addTeams'](_0x19a144,{'transaction':_0x1091fb})[_0x0c90('0x2a')](function(){return BPromise[_0x0c90('0x83')](_0x5379bc,function(_0x35ee25){return db[_0x0c90('0x84')][_0x0c90('0x85')]({'TeamId':_0x35ee25['id'],'VoicePrefixId':_0x59e8d9[_0x0c90('0x4a')]['id']},{'transaction':_0x1091fb});});})[_0x0c90('0x2a')](function(){return BPromise[_0x0c90('0x83')](_0x5a2961,function(_0x3614d1){return db[_0x0c90('0x86')]['findOrCreate']({'where':{'UserId':_0x3614d1['id'],'VoicePrefixId':_0x59e8d9[_0x0c90('0x4a')]['id']},'transaction':_0x1091fb});});})['then'](function(){_0x5a2961[_0x0c90('0x87')](function(_0x40dd25){socket[_0x0c90('0x75')]('userVoicePrefix:save',{'UserId':_0x40dd25['id'],'VoicePrefixId':_0x13c0f2['id']});});});});});}})[_0x0c90('0x2a')](respondWithStatusCode(_0x9bed36,null))['catch'](handleError(_0x9bed36,null));};exports[_0x0c90('0x88')]=function(_0x1c2814,_0x2f542b,_0x3f3787){return db[_0x0c90('0x7d')][_0x0c90('0x48')]({'where':{'id':_0x1c2814[_0x0c90('0x37')][_0x0c90('0x73')]},'attributes':['id'],'include':[{'model':db[_0x0c90('0x7b')],'as':_0x0c90('0x80'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2f542b,null))[_0x0c90('0x2a')](function(_0x31dde9){var _0x37acdc=_['map'](_0x31dde9,'id');var _0x5f431d=[];var _0x2dabe6=[];var _0x28736e=squel['select']();_0x28736e['field'](_0x0c90('0x89'))[_0x0c90('0x8a')]('team_has_voice_prefixes','tq')[_0x0c90('0x8b')](_0x0c90('0x8c'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0c90('0x41')](_0x0c90('0x8d'),_0x1c2814['params']['id']);for(var _0x1fb55a=0x0;_0x1fb55a<_0x31dde9['length'];_0x1fb55a+=0x1){let _0x5aa532=_0x31dde9[_0x1fb55a];for(var _0x8e8e30=0x0;_0x8e8e30<_0x5aa532[_0x0c90('0x80')]['length'];_0x8e8e30+=0x1){let _0x5c942d=_0x5aa532[_0x0c90('0x80')][_0x8e8e30];var _0x155915=_0x28736e[_0x0c90('0x8e')]();_0x155915[_0x0c90('0x41')](_0x0c90('0x8f'),_0x5c942d['id']);_0x2dabe6['push'](db[_0x0c90('0x6f')][_0x0c90('0x37')](_0x155915[_0x0c90('0x90')](),{'type':db[_0x0c90('0x6f')][_0x0c90('0x91')][_0x0c90('0x92')]})['then'](function(_0x18cc89){if(_0x18cc89['length']===0x1){return _0x5c942d['id'];}else{var _0x5e6e8f=_['every'](_[_0x0c90('0x32')](_0x18cc89,_0x0c90('0x93')),function(_0x53c760){return _[_0x0c90('0x94')](_0x37acdc,_0x53c760);});if(_0x5e6e8f){return _0x5c942d['id'];}}}));}}return BPromise['all'](_0x2dabe6)['then'](function(_0x22b3df){_0x5f431d=_(_0x5f431d)[_0x0c90('0x95')](_0x22b3df)[_0x0c90('0x96')]()[_0x0c90('0x97')]();return db[_0x0c90('0x45')][_0x0c90('0x4e')]({'where':{'id':_0x1c2814[_0x0c90('0x4a')]['id']}})['then'](function(_0x2eece9){return db[_0x0c90('0x6f')][_0x0c90('0x51')](function(_0x3817a4){return _0x2eece9[_0x0c90('0x88')](_0x1c2814[_0x0c90('0x37')][_0x0c90('0x73')],{'transaction':_0x3817a4})[_0x0c90('0x2a')](function(){if(!_[_0x0c90('0x98')](_0x5f431d)){return _0x2eece9[_0x0c90('0x99')](_0x5f431d,{'transaction':_0x3817a4});}})[_0x0c90('0x2a')](function(){_0x5f431d[_0x0c90('0x87')](function(_0x9187af){socket[_0x0c90('0x75')]('userVoicePrefix:remove',{'UserId':_0x9187af,'VoicePrefixId':_0x2eece9['id']});});});});});});})[_0x0c90('0x2a')](respondWithStatusCode(_0x2f542b,null))[_0x0c90('0x4c')](handleError(_0x2f542b,null));}; \ No newline at end of file +var _0xdd4f=['lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','get','VoicePrefixes','UserProfileResource','destroy','error','stack','name','send','map','VoicePrefix','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','describe','create','transaction','body','VoiceExtension','find','VoiceExtensionId','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','callerIdAll','push','PREFIX-CALLERIDALL=','No\x20callerid\x20available','charAt','update','system-','sequelize','findById','addAgents','spread','ids','emit','userVoicePrefix:save','removeAgents','isArray','getAgents','findOne','rawAttributes','order','getTeams','Team','nolimit','findAll','User','Agents','online','voicePause','interface','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','select','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','removeTeams','userVoicePrefix:remove','eml-format','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra'];(function(_0x509e81,_0x7674ff){var _0x40b541=function(_0x188e59){while(--_0x188e59){_0x509e81['push'](_0x509e81['shift']());}};_0x40b541(++_0x7674ff);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x24ee22,_0x2e6715){_0x24ee22=_0x24ee22-0x0;var _0x25bed1=_0xdd4f[_0x24ee22];return _0x25bed1;};'use strict';var emlformat=require(_0xfdd4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfdd4('0x1'));var moment=require(_0xfdd4('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xfdd4('0x3'));var util=require(_0xfdd4('0x4'));var path=require(_0xfdd4('0x5'));var sox=require('sox');var csv=require(_0xfdd4('0x6'));var ejs=require(_0xfdd4('0x7'));var fs=require('fs');var fs_extra=require(_0xfdd4('0x8'));var _=require(_0xfdd4('0x9'));var squel=require(_0xfdd4('0xa'));var crypto=require('crypto');var jsforce=require(_0xfdd4('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfdd4('0x6'));var querystring=require(_0xfdd4('0xc'));var Papa=require(_0xfdd4('0xd'));var Redis=require('ioredis');var authService=require(_0xfdd4('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xfdd4('0xf'));var hardwareService=require(_0xfdd4('0x10'));var logger=require(_0xfdd4('0x11'))(_0xfdd4('0x12'));var utils=require(_0xfdd4('0x13'));var config=require(_0xfdd4('0x14'));var licenseUtil=require(_0xfdd4('0x15'));var db=require(_0xfdd4('0x16'))['db'];config[_0xfdd4('0x17')]=_[_0xfdd4('0x18')](config[_0xfdd4('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xfdd4('0x19'))(new Redis(config[_0xfdd4('0x17')]));require(_0xfdd4('0x1a'))['register'](socket);function respondWithStatusCode(_0x1b7da1,_0x4aaeee){_0x4aaeee=_0x4aaeee||0xcc;return function(_0x467824){if(_0x467824){return _0x1b7da1[_0xfdd4('0x1b')](_0x4aaeee);}return _0x1b7da1[_0xfdd4('0x1c')](_0x4aaeee)[_0xfdd4('0x1d')]();};}function respondWithResult(_0x37b05f,_0x52cf2c){_0x52cf2c=_0x52cf2c||0xc8;return function(_0x47ed1d){if(_0x47ed1d){return _0x37b05f['status'](_0x52cf2c)[_0xfdd4('0x1e')](_0x47ed1d);}};}function respondWithFilteredResult(_0x216c7e,_0x2eb174){return function(_0x2ccc88){if(_0x2ccc88){var _0x32b5f7=typeof _0x2eb174[_0xfdd4('0x1f')]===_0xfdd4('0x20')&&typeof _0x2eb174[_0xfdd4('0x21')]===_0xfdd4('0x20');var _0x52ce34=_0x2ccc88[_0xfdd4('0x22')];var _0x3e8eac=_0x32b5f7?0x0:_0x2eb174[_0xfdd4('0x1f')];var _0x36e611=_0x32b5f7?_0x2ccc88[_0xfdd4('0x22')]:_0x2eb174[_0xfdd4('0x1f')]+_0x2eb174[_0xfdd4('0x21')];var _0x34dfa8;if(_0x36e611>=_0x52ce34){_0x36e611=_0x52ce34;_0x34dfa8=0xc8;}else{_0x34dfa8=0xce;}_0x216c7e['status'](_0x34dfa8);return _0x216c7e[_0xfdd4('0x23')](_0xfdd4('0x24'),_0x3e8eac+'-'+_0x36e611+'/'+_0x52ce34)[_0xfdd4('0x1e')](_0x2ccc88);}return null;};}function patchUpdates(_0x16e81b){return function(_0xb7856d){try{jsonpatch[_0xfdd4('0x25')](_0xb7856d,_0x16e81b,!![]);}catch(_0x451767){return BPromise[_0xfdd4('0x26')](_0x451767);}return _0xb7856d['save']();};}function saveUpdates(_0x1e14da,_0x1112e8){return function(_0x4397a3){if(_0x4397a3){return _0x4397a3['update'](_0x1e14da)[_0xfdd4('0x27')](function(_0x39b712){return _0x39b712;});}return null;};}function removeEntity(_0xf9c346,_0x2f8268){return function(_0x1ade42){if(_0x1ade42){return _0x1ade42['destroy']()[_0xfdd4('0x27')](function(){var _0x2c88ad=_0x1ade42[_0xfdd4('0x28')]({'plain':!![]});var _0x31e053=_0xfdd4('0x29');return db[_0xfdd4('0x2a')][_0xfdd4('0x2b')]({'where':{'type':_0x31e053,'resourceId':_0x2c88ad['id']}})[_0xfdd4('0x27')](function(){return _0x1ade42;});})['then'](function(){_0xf9c346[_0xfdd4('0x1c')](0xcc)[_0xfdd4('0x1d')]();});}};}function handleEntityNotFound(_0x385a68,_0xef012e){return function(_0x2207ae){if(!_0x2207ae){_0x385a68['sendStatus'](0x194);}return _0x2207ae;};}function handleError(_0xd127b1,_0x3372d2){_0x3372d2=_0x3372d2||0x1f4;return function(_0xbf38b4){logger[_0xfdd4('0x2c')](_0xbf38b4[_0xfdd4('0x2d')]);if(_0xbf38b4['name']){delete _0xbf38b4[_0xfdd4('0x2e')];}_0xd127b1[_0xfdd4('0x1c')](_0x3372d2)[_0xfdd4('0x2f')](_0xbf38b4);};}exports['index']=function(_0x3fd07a,_0x502776){var _0x2a65c8={},_0x2b22f9={},_0x4aa4f2={'count':0x0,'rows':[]};var _0x50b748=_[_0xfdd4('0x30')](db[_0xfdd4('0x31')]['rawAttributes'],function(_0x557d7b){return{'name':_0x557d7b[_0xfdd4('0x32')],'type':_0x557d7b[_0xfdd4('0x33')][_0xfdd4('0x34')]};});_0x2b22f9[_0xfdd4('0x35')]=_[_0xfdd4('0x30')](_0x50b748,_0xfdd4('0x2e'));_0x2b22f9[_0xfdd4('0x36')]=_[_0xfdd4('0x37')](_0x3fd07a[_0xfdd4('0x36')]);_0x2b22f9[_0xfdd4('0x38')]=_[_0xfdd4('0x39')](_0x2b22f9[_0xfdd4('0x35')],_0x2b22f9[_0xfdd4('0x36')]);_0x2a65c8[_0xfdd4('0x3a')]=_[_0xfdd4('0x39')](_0x2b22f9[_0xfdd4('0x35')],qs[_0xfdd4('0x3b')](_0x3fd07a[_0xfdd4('0x36')][_0xfdd4('0x3b')]));_0x2a65c8[_0xfdd4('0x3a')]=_0x2a65c8[_0xfdd4('0x3a')][_0xfdd4('0x3c')]?_0x2a65c8[_0xfdd4('0x3a')]:_0x2b22f9[_0xfdd4('0x35')];if(!_0x3fd07a[_0xfdd4('0x36')][_0xfdd4('0x3d')]('nolimit')){_0x2a65c8[_0xfdd4('0x21')]=qs[_0xfdd4('0x21')](_0x3fd07a[_0xfdd4('0x36')][_0xfdd4('0x21')]);_0x2a65c8[_0xfdd4('0x1f')]=qs[_0xfdd4('0x1f')](_0x3fd07a['query'][_0xfdd4('0x1f')]);}_0x2a65c8['order']=qs[_0xfdd4('0x3e')](_0x3fd07a[_0xfdd4('0x36')][_0xfdd4('0x3e')]);_0x2a65c8[_0xfdd4('0x3f')]=qs['filters'](_[_0xfdd4('0x40')](_0x3fd07a[_0xfdd4('0x36')],_0x2b22f9[_0xfdd4('0x38')]),_0x50b748);if(_0x3fd07a[_0xfdd4('0x36')][_0xfdd4('0x41')]){_0x2a65c8[_0xfdd4('0x3f')]=_[_0xfdd4('0x42')](_0x2a65c8[_0xfdd4('0x3f')],{'$or':_[_0xfdd4('0x30')](_0x50b748,function(_0x83673d){if(_0x83673d['type']!==_0xfdd4('0x43')){var _0x2196f={};_0x2196f[_0x83673d[_0xfdd4('0x2e')]]={'$like':'%'+_0x3fd07a[_0xfdd4('0x36')]['filter']+'%'};return _0x2196f;}})});}_0x2a65c8=_[_0xfdd4('0x42')]({},_0x2a65c8,_0x3fd07a[_0xfdd4('0x44')]);var _0x30524f={'where':_0x2a65c8[_0xfdd4('0x3f')]};return db[_0xfdd4('0x31')]['count'](_0x30524f)[_0xfdd4('0x27')](function(_0x23af2a){_0x4aa4f2[_0xfdd4('0x22')]=_0x23af2a;if(_0x3fd07a[_0xfdd4('0x36')][_0xfdd4('0x45')]){_0x2a65c8[_0xfdd4('0x46')]=[{'all':!![]}];}return db[_0xfdd4('0x31')]['findAll'](_0x2a65c8);})[_0xfdd4('0x27')](function(_0x586713){_0x4aa4f2[_0xfdd4('0x47')]=_0x586713;return _0x4aa4f2;})[_0xfdd4('0x27')](respondWithFilteredResult(_0x502776,_0x2a65c8))[_0xfdd4('0x48')](handleError(_0x502776,null));};exports[_0xfdd4('0x49')]=function(_0x5367aa,_0x419578){var _0x11e90a={'raw':![],'where':{'id':_0x5367aa[_0xfdd4('0x4a')]['id']}},_0x4d1dfe={};_0x4d1dfe[_0xfdd4('0x35')]=_['keys'](db[_0xfdd4('0x31')]['rawAttributes']);_0x4d1dfe['query']=_['keys'](_0x5367aa[_0xfdd4('0x36')]);_0x4d1dfe[_0xfdd4('0x38')]=_[_0xfdd4('0x39')](_0x4d1dfe['model'],_0x4d1dfe[_0xfdd4('0x36')]);_0x11e90a[_0xfdd4('0x3a')]=_['intersection'](_0x4d1dfe[_0xfdd4('0x35')],qs[_0xfdd4('0x3b')](_0x5367aa[_0xfdd4('0x36')][_0xfdd4('0x3b')]));_0x11e90a[_0xfdd4('0x3a')]=_0x11e90a[_0xfdd4('0x3a')][_0xfdd4('0x3c')]?_0x11e90a[_0xfdd4('0x3a')]:_0x4d1dfe[_0xfdd4('0x35')];if(_0x5367aa[_0xfdd4('0x36')][_0xfdd4('0x45')]){_0x11e90a[_0xfdd4('0x46')]=[{'all':!![]}];}_0x11e90a=_[_0xfdd4('0x42')]({},_0x11e90a,_0x5367aa[_0xfdd4('0x44')]);return db['VoicePrefix']['find'](_0x11e90a)[_0xfdd4('0x27')](handleEntityNotFound(_0x419578,null))[_0xfdd4('0x27')](respondWithResult(_0x419578,null))[_0xfdd4('0x48')](handleError(_0x419578,null));};exports[_0xfdd4('0x2b')]=function(_0x507bf5,_0x3c6828){return db[_0xfdd4('0x31')]['find']({'where':{'id':_0x507bf5['params']['id']}})['then'](handleEntityNotFound(_0x3c6828,null))['then'](removeEntity(_0x3c6828,null))['catch'](handleError(_0x3c6828,null));};exports[_0xfdd4('0x4b')]=function(_0x88e9ef,_0x3a4202){return db[_0xfdd4('0x31')][_0xfdd4('0x4b')]()[_0xfdd4('0x27')](respondWithResult(_0x3a4202,null))['catch'](handleError(_0x3a4202,null));};exports[_0xfdd4('0x4c')]=function(_0x1f521a,_0x1dd417){var _0x2355b5;return db['sequelize'][_0xfdd4('0x4d')](function(_0x8aa0ea){return db['VoicePrefix'][_0xfdd4('0x4c')](_0x1f521a[_0xfdd4('0x4e')],{'transaction':_0x8aa0ea})['then'](function(_0x5467d1){_0x2355b5=_0x5467d1[_0xfdd4('0x28')]({'plain':!![]});return db[_0xfdd4('0x4f')][_0xfdd4('0x50')]({'where':{'id':_0x2355b5[_0xfdd4('0x51')]},'raw':!![]})[_0xfdd4('0x27')](function(_0x1b9979){return createVoicePrefixExtensions(_0x2355b5,_0x1b9979,_0x8aa0ea);});});})[_0xfdd4('0x27')](function(){var _0x3de4fd=_0x1f521a['user'][_0xfdd4('0x28')]({'plain':!![]});if(!_0x3de4fd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3de4fd['role']===_0xfdd4('0x52')){var _0x1d9a8d=_0x2355b5;return db['UserProfileSection']['find']({'where':{'name':'VoicePrefixes','userProfileId':_0x3de4fd[_0xfdd4('0x53')]},'raw':!![]})[_0xfdd4('0x27')](function(_0x4dc113){if(_0x4dc113&&_0x4dc113[_0xfdd4('0x54')]===0x0){return db[_0xfdd4('0x2a')][_0xfdd4('0x4c')]({'name':_0x1d9a8d[_0xfdd4('0x2e')],'resourceId':_0x1d9a8d['id'],'type':_0x4dc113[_0xfdd4('0x2e')],'sectionId':_0x4dc113['id']},{})['then'](function(){return _0x2355b5;});}else{return _0x2355b5;}})['catch'](function(_0x483942){logger['error'](_0xfdd4('0x55'),_0x483942);throw _0x483942;});}return _0x2355b5;})[_0xfdd4('0x27')](respondWithResult(_0x1dd417,null))['catch'](handleError(_0x1dd417,null));};function Extension(_0x1eee3d,_0x2abe50,_0x4d4304,_0x45dcc8){this[_0xfdd4('0x56')]='from-sip';this[_0xfdd4('0x57')]=_0x1eee3d;this[_0xfdd4('0x58')]=_0x4d4304;this[_0xfdd4('0x33')]='system';this[_0xfdd4('0x59')]=_0xfdd4('0x5a');this[_0xfdd4('0x5b')]=_0x2abe50;this[_0xfdd4('0x5c')]=_0x45dcc8;}function createVoicePrefixExtensions(_0x5c7be,_0x562417,_0x2cc3e2){return new BPromise(function(_0x2ee4b6,_0x3be4d5){var _0x202124=new Extension(formatPrefixName(_0x5c7be[_0xfdd4('0x5d')]),0x1,_0xfdd4('0x5e'),_0xfdd4('0x5f'));_0x202124[_0xfdd4('0x60')]=_0x5c7be['id'];return db[_0xfdd4('0x4f')]['create'](_0x202124,{'transaction':_0x2cc3e2})[_0xfdd4('0x27')](function(_0x2799b2){var _0x4483e1=_0x2799b2[_0xfdd4('0x28')]({'plain':!![]});var _0x3096fa=_['map'](addVoicePrefixExtensions(_0x5c7be,_0x562417),function(_0x46e7eb){_0x46e7eb[_0xfdd4('0x51')]=_0x4483e1['id'];_0x46e7eb[_0xfdd4('0x60')]=_0x5c7be['id'];return _0x46e7eb;});return db[_0xfdd4('0x4f')][_0xfdd4('0x61')](_0x3096fa,{'transaction':_0x2cc3e2})[_0xfdd4('0x27')](function(_0x180ad9){if(!_0x180ad9){return _0x3be4d5(_0xfdd4('0x62'));}else{return _0x2ee4b6(_0x180ad9);}})[_0xfdd4('0x48')](function(_0x2a0dd8){return _0x3be4d5(_0x2a0dd8);});});;});};function addVoicePrefixExtensions(_0x2fff30,_0x2792c4){var _0x1205b8=[];var _0x527068=formatPrefixName(_0x2fff30[_0xfdd4('0x5d')]);_0x1205b8['push'](new Extension(_0x527068,0x2,_0xfdd4('0x63'),_0xfdd4('0x64')+_0x2fff30[_0xfdd4('0x2e')]));if(_0x2fff30[_0xfdd4('0x65')]){_0x1205b8[_0xfdd4('0x66')](new Extension(_0x527068,0x3,_0xfdd4('0x63'),_0xfdd4('0x67')+_0x2fff30[_0xfdd4('0x65')]));}else{_0x1205b8[_0xfdd4('0x66')](new Extension(_0x527068,0x3,_0xfdd4('0x5e'),_0xfdd4('0x68')));}_0x1205b8[_0xfdd4('0x66')](new Extension(_0x527068,0x4,'goto',_0x2792c4['context']+','+'${EXTEN:'+(0x8+_0x2fff30[_0xfdd4('0x2e')][_0xfdd4('0x3c')])+'}'+','+0x1));return _0x1205b8;}function formatPrefixName(_0x4bb18b){var _0x3a367c='_';for(var _0x3f027b=0x0;_0x3f027b<_0x4bb18b[_0xfdd4('0x3c')];_0x3f027b++){if(_0x4bb18b[_0xfdd4('0x69')](_0x3f027b)=='-'){_0x3a367c+=_0x4bb18b[_0xfdd4('0x69')](_0x3f027b);}else{_0x3a367c+='['+_0x4bb18b['charAt'](_0x3f027b)+']';}}_0x3a367c+='.';return _0x3a367c;}exports[_0xfdd4('0x6a')]=function(_0x297432,_0x3958cd,_0x523085){var _0x366f1c=_0x297432['body'];_0x366f1c[_0xfdd4('0x5d')]=_0xfdd4('0x6b')+_0x366f1c[_0xfdd4('0x2e')]+'-';return db[_0xfdd4('0x6c')]['transaction'](function(_0x2351b6){return db[_0xfdd4('0x31')]['update'](_0x366f1c,{'where':{'id':_0x366f1c['id']},'transaction':_0x2351b6})[_0xfdd4('0x27')](function(){return db[_0xfdd4('0x4f')][_0xfdd4('0x2b')]({'where':{'VoicePrefixId':_0x366f1c['id']},'transaction':_0x2351b6})['then'](function(){return db[_0xfdd4('0x4f')][_0xfdd4('0x50')]({'where':{'id':_0x366f1c[_0xfdd4('0x51')]},'raw':!![]})['then'](function(_0x3f4337){return createVoicePrefixExtensions(_0x366f1c,_0x3f4337,_0x2351b6);});});});})[_0xfdd4('0x27')](function(){return db[_0xfdd4('0x31')][_0xfdd4('0x6d')](_0x366f1c['id']);})[_0xfdd4('0x27')](respondWithResult(_0x3958cd,null))[_0xfdd4('0x48')](handleError(_0x3958cd,null));};exports[_0xfdd4('0x6e')]=function(_0x539d3b,_0x147d54,_0x36b615){return db[_0xfdd4('0x31')][_0xfdd4('0x50')]({'where':{'id':_0x539d3b[_0xfdd4('0x4a')]['id']}})[_0xfdd4('0x27')](handleEntityNotFound(_0x147d54,null))[_0xfdd4('0x27')](function(_0x4987d6){if(_0x4987d6){return _0x4987d6['addAgents'](_0x539d3b[_0xfdd4('0x4e')]['ids'],_['omit'](_0x539d3b[_0xfdd4('0x4e')],['ids','id'])||{})[_0xfdd4('0x6f')](function(_0x51711a){for(var _0x4576ce=0x0;_0x4576ce<_0x539d3b[_0xfdd4('0x4e')][_0xfdd4('0x70')][_0xfdd4('0x3c')];_0x4576ce+=0x1){socket[_0xfdd4('0x71')](_0xfdd4('0x72'),{'UserId':Number(_0x539d3b[_0xfdd4('0x4e')]['ids'][_0x4576ce]),'VoicePrefixId':Number(_0x539d3b['params']['id'])});}return _0x51711a;});}})[_0xfdd4('0x27')](respondWithResult(_0x147d54,null))['catch'](handleError(_0x147d54,null));};exports[_0xfdd4('0x73')]=function(_0x1a82ee,_0x3b205f,_0x1d57f8){return db[_0xfdd4('0x31')][_0xfdd4('0x50')]({'where':{'id':_0x1a82ee[_0xfdd4('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3b205f,null))['then'](function(_0x37a342){if(_0x37a342){return _0x37a342[_0xfdd4('0x73')](_0x1a82ee[_0xfdd4('0x36')][_0xfdd4('0x70')])[_0xfdd4('0x27')](function(){if(_[_0xfdd4('0x74')](_0x1a82ee[_0xfdd4('0x36')][_0xfdd4('0x70')])){for(var _0xf78c69=0x0;_0xf78c69<_0x1a82ee[_0xfdd4('0x36')][_0xfdd4('0x70')][_0xfdd4('0x3c')];_0xf78c69+=0x1){socket[_0xfdd4('0x71')]('userVoicePrefix:remove',{'UserId':Number(_0x1a82ee['query'][_0xfdd4('0x70')][_0xf78c69]),'VoicePrefixId':Number(_0x1a82ee[_0xfdd4('0x4a')]['id'])});}}else{socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x1a82ee[_0xfdd4('0x36')][_0xfdd4('0x70')]),'VoicePrefixId':Number(_0x1a82ee['params']['id'])});}});}})[_0xfdd4('0x27')](respondWithStatusCode(_0x3b205f,null))[_0xfdd4('0x48')](handleError(_0x3b205f,null));};exports[_0xfdd4('0x75')]=function(_0x11db43,_0x5ec62b,_0x25c078){var _0x5d356c={};var _0x3924c7={};var _0x2f65d7;var _0x4783b9;return db[_0xfdd4('0x31')][_0xfdd4('0x76')]({'where':{'id':_0x11db43[_0xfdd4('0x4a')]['id']}})[_0xfdd4('0x27')](handleEntityNotFound(_0x5ec62b,null))[_0xfdd4('0x27')](function(_0x575bc2){if(_0x575bc2){_0x2f65d7=_0x575bc2;_0x3924c7['model']=_[_0xfdd4('0x37')](db['User'][_0xfdd4('0x77')]);_0x3924c7[_0xfdd4('0x36')]=_[_0xfdd4('0x37')](_0x11db43[_0xfdd4('0x36')]);_0x3924c7[_0xfdd4('0x38')]=_['intersection'](_0x3924c7['model'],_0x3924c7[_0xfdd4('0x36')]);_0x5d356c['attributes']=_[_0xfdd4('0x39')](_0x3924c7['model'],qs[_0xfdd4('0x3b')](_0x11db43[_0xfdd4('0x36')][_0xfdd4('0x3b')]));_0x5d356c[_0xfdd4('0x3a')]=_0x5d356c[_0xfdd4('0x3a')][_0xfdd4('0x3c')]?_0x5d356c[_0xfdd4('0x3a')]:_0x3924c7[_0xfdd4('0x35')];_0x5d356c[_0xfdd4('0x78')]=qs[_0xfdd4('0x3e')](_0x11db43[_0xfdd4('0x36')]['sort']);_0x5d356c[_0xfdd4('0x3f')]=qs[_0xfdd4('0x38')](_[_0xfdd4('0x40')](_0x11db43[_0xfdd4('0x36')],_0x3924c7[_0xfdd4('0x38')]));if(_0x11db43[_0xfdd4('0x36')][_0xfdd4('0x41')]){_0x5d356c[_0xfdd4('0x3f')]=_[_0xfdd4('0x42')](_0x5d356c['where'],{'$or':_['map'](_0x5d356c[_0xfdd4('0x3a')],function(_0x244d6d){var _0x30bd32={};_0x30bd32[_0x244d6d]={'$like':'%'+_0x11db43['query'][_0xfdd4('0x41')]+'%'};return _0x30bd32;})});}_0x5d356c=_[_0xfdd4('0x42')]({},_0x5d356c,_0x11db43[_0xfdd4('0x44')]);return _0x2f65d7[_0xfdd4('0x75')](_0x5d356c);}})['then'](function(_0x5868e6){if(_0x5868e6){_0x4783b9=_0x5868e6[_0xfdd4('0x3c')];if(!_0x11db43[_0xfdd4('0x36')][_0xfdd4('0x3d')]('nolimit')){_0x5d356c[_0xfdd4('0x21')]=qs[_0xfdd4('0x21')](_0x11db43[_0xfdd4('0x36')][_0xfdd4('0x21')]);_0x5d356c[_0xfdd4('0x1f')]=qs[_0xfdd4('0x1f')](_0x11db43['query']['offset']);}return _0x2f65d7[_0xfdd4('0x75')](_0x5d356c);}})[_0xfdd4('0x27')](function(_0x6a1410){if(_0x6a1410){return _0x6a1410?{'count':_0x4783b9,'rows':_0x6a1410}:null;}})[_0xfdd4('0x27')](respondWithResult(_0x5ec62b,null))[_0xfdd4('0x48')](handleError(_0x5ec62b,null));};exports[_0xfdd4('0x79')]=function(_0x46edc9,_0x2a4366,_0x5d1a3f){var _0x218d83={};var _0x547c4c={};var _0x464eb0;var _0x1871d6;return db['VoicePrefix'][_0xfdd4('0x76')]({'where':{'id':_0x46edc9[_0xfdd4('0x4a')]['id']}})[_0xfdd4('0x27')](handleEntityNotFound(_0x2a4366,null))[_0xfdd4('0x27')](function(_0x3cd7ae){if(_0x3cd7ae){_0x464eb0=_0x3cd7ae;_0x547c4c[_0xfdd4('0x35')]=_[_0xfdd4('0x37')](db[_0xfdd4('0x7a')][_0xfdd4('0x77')]);_0x547c4c['query']=_[_0xfdd4('0x37')](_0x46edc9['query']);_0x547c4c[_0xfdd4('0x38')]=_['intersection'](_0x547c4c['model'],_0x547c4c[_0xfdd4('0x36')]);_0x218d83[_0xfdd4('0x3a')]=_[_0xfdd4('0x39')](_0x547c4c[_0xfdd4('0x35')],qs[_0xfdd4('0x3b')](_0x46edc9['query'][_0xfdd4('0x3b')]));_0x218d83[_0xfdd4('0x3a')]=_0x218d83[_0xfdd4('0x3a')][_0xfdd4('0x3c')]?_0x218d83[_0xfdd4('0x3a')]:_0x547c4c[_0xfdd4('0x35')];_0x218d83['order']=qs[_0xfdd4('0x3e')](_0x46edc9[_0xfdd4('0x36')]['sort']);_0x218d83['where']=qs[_0xfdd4('0x38')](_[_0xfdd4('0x40')](_0x46edc9[_0xfdd4('0x36')],_0x547c4c['filters']));if(_0x46edc9['query'][_0xfdd4('0x41')]){_0x218d83[_0xfdd4('0x3f')]=_[_0xfdd4('0x42')](_0x218d83['where'],{'$or':_['map'](_0x218d83[_0xfdd4('0x3a')],function(_0xd6eb47){var _0x1927ed={};_0x1927ed[_0xd6eb47]={'$like':'%'+_0x46edc9['query'][_0xfdd4('0x41')]+'%'};return _0x1927ed;})});}_0x218d83=_['merge']({},_0x218d83,_0x46edc9[_0xfdd4('0x44')]);return _0x464eb0[_0xfdd4('0x79')](_0x218d83);}})[_0xfdd4('0x27')](function(_0x4e1dbc){if(_0x4e1dbc){_0x1871d6=_0x4e1dbc[_0xfdd4('0x3c')];if(!_0x46edc9[_0xfdd4('0x36')][_0xfdd4('0x3d')](_0xfdd4('0x7b'))){_0x218d83[_0xfdd4('0x21')]=qs['limit'](_0x46edc9[_0xfdd4('0x36')][_0xfdd4('0x21')]);_0x218d83[_0xfdd4('0x1f')]=qs['offset'](_0x46edc9[_0xfdd4('0x36')][_0xfdd4('0x1f')]);}return _0x464eb0[_0xfdd4('0x79')](_0x218d83);}})[_0xfdd4('0x27')](function(_0x56e5d3){if(_0x56e5d3){return _0x56e5d3?{'count':_0x1871d6,'rows':_0x56e5d3}:null;}})[_0xfdd4('0x27')](respondWithResult(_0x2a4366,null))['catch'](handleError(_0x2a4366,null));};exports['addTeams']=function(_0x528004,_0x206a59,_0x545475){var _0x5e5362=_0x528004['body'][_0xfdd4('0x70')];var _0x728e25;return db[_0xfdd4('0x7a')][_0xfdd4('0x7c')]({'where':{'id':_0x5e5362},'attributes':['id'],'include':[{'model':db[_0xfdd4('0x7d')],'as':_0xfdd4('0x7e'),'attributes':['id',_0xfdd4('0x2e'),_0xfdd4('0x7f'),_0xfdd4('0x80'),_0xfdd4('0x81')],'raw':!![]}]})[_0xfdd4('0x27')](function(_0x2911ca){if(_0x2911ca){_0x728e25=_0x2911ca;var _0x31303f=_[_0xfdd4('0x82')](_0x2911ca,function(_0x46b927){var _0x450c67=_0x46b927[_0xfdd4('0x28')]({'plain':!![]});return _0x450c67[_0xfdd4('0x7e')];});return db[_0xfdd4('0x31')][_0xfdd4('0x50')]({'where':{'id':_0x528004[_0xfdd4('0x4a')]['id']}})[_0xfdd4('0x27')](function(_0x189baf){return db[_0xfdd4('0x6c')][_0xfdd4('0x4d')](function(_0x22f93b){return _0x189baf['addTeams'](_0x5e5362,{'transaction':_0x22f93b})[_0xfdd4('0x27')](function(){return BPromise[_0xfdd4('0x83')](_0x728e25,function(_0xaef5e2){return db[_0xfdd4('0x84')][_0xfdd4('0x85')]({'TeamId':_0xaef5e2['id'],'VoicePrefixId':_0x528004['params']['id']},{'transaction':_0x22f93b});});})[_0xfdd4('0x27')](function(){return BPromise[_0xfdd4('0x83')](_0x31303f,function(_0x19b679){return db[_0xfdd4('0x86')][_0xfdd4('0x87')]({'where':{'UserId':_0x19b679['id'],'VoicePrefixId':_0x528004[_0xfdd4('0x4a')]['id']},'transaction':_0x22f93b});});})['then'](function(){_0x31303f[_0xfdd4('0x88')](function(_0x1a9e62){socket[_0xfdd4('0x71')](_0xfdd4('0x72'),{'UserId':_0x1a9e62['id'],'VoicePrefixId':_0x189baf['id']});});});});});}})[_0xfdd4('0x27')](respondWithStatusCode(_0x206a59,null))[_0xfdd4('0x48')](handleError(_0x206a59,null));};exports['removeTeams']=function(_0x2a6a0d,_0x3d82d1,_0x17d272){return db['Team'][_0xfdd4('0x7c')]({'where':{'id':_0x2a6a0d[_0xfdd4('0x36')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfdd4('0x7e'),'attributes':['id'],'raw':!![]}]})[_0xfdd4('0x27')](handleEntityNotFound(_0x3d82d1,null))[_0xfdd4('0x27')](function(_0xd07645){var _0x5a3249=_[_0xfdd4('0x30')](_0xd07645,'id');var _0x5b22b1=[];var _0xc9955e=[];var _0x42204a=squel[_0xfdd4('0x89')]();_0x42204a[_0xfdd4('0x8a')](_0xfdd4('0x8b'))[_0xfdd4('0x8c')](_0xfdd4('0x8d'),'tq')[_0xfdd4('0x8e')](_0xfdd4('0x8f'),'ut',_0xfdd4('0x90'))[_0xfdd4('0x3f')]('VoicePrefixId\x20=\x20?',_0x2a6a0d[_0xfdd4('0x4a')]['id']);for(var _0x42a3dc=0x0;_0x42a3dc<_0xd07645[_0xfdd4('0x3c')];_0x42a3dc+=0x1){let _0x26316c=_0xd07645[_0x42a3dc];for(var _0x1e7bbb=0x0;_0x1e7bbb<_0x26316c[_0xfdd4('0x7e')]['length'];_0x1e7bbb+=0x1){let _0xfd0c1=_0x26316c[_0xfdd4('0x7e')][_0x1e7bbb];var _0x2ae92=_0x42204a[_0xfdd4('0x91')]();_0x2ae92['where'](_0xfdd4('0x92'),_0xfd0c1['id']);_0xc9955e[_0xfdd4('0x66')](db['sequelize'][_0xfdd4('0x36')](_0x2ae92[_0xfdd4('0x93')](),{'type':db[_0xfdd4('0x6c')][_0xfdd4('0x94')][_0xfdd4('0x95')]})[_0xfdd4('0x27')](function(_0x191ab6){if(_0x191ab6[_0xfdd4('0x3c')]===0x1){return _0xfd0c1['id'];}else{var _0x1d460f=_[_0xfdd4('0x96')](_[_0xfdd4('0x30')](_0x191ab6,_0xfdd4('0x97')),function(_0x25c508){return _[_0xfdd4('0x98')](_0x5a3249,_0x25c508);});if(_0x1d460f){return _0xfd0c1['id'];}}}));}}return BPromise['all'](_0xc9955e)[_0xfdd4('0x27')](function(_0x349fc6){_0x5b22b1=_(_0x5b22b1)[_0xfdd4('0x99')](_0x349fc6)[_0xfdd4('0x9a')]()['value']();return db[_0xfdd4('0x31')][_0xfdd4('0x50')]({'where':{'id':_0x2a6a0d['params']['id']}})[_0xfdd4('0x27')](function(_0x401681){return db[_0xfdd4('0x6c')][_0xfdd4('0x4d')](function(_0x5a7c85){return _0x401681[_0xfdd4('0x9b')](_0x2a6a0d['query'][_0xfdd4('0x70')],{'transaction':_0x5a7c85})[_0xfdd4('0x27')](function(){if(!_['isEmpty'](_0x5b22b1)){return _0x401681[_0xfdd4('0x73')](_0x5b22b1,{'transaction':_0x5a7c85});}})['then'](function(){_0x5b22b1['forEach'](function(_0x10a396){socket[_0xfdd4('0x71')](_0xfdd4('0x9c'),{'UserId':_0x10a396,'VoicePrefixId':_0x401681['id']});});});});});});})[_0xfdd4('0x27')](respondWithStatusCode(_0x3d82d1,null))['catch'](handleError(_0x3d82d1,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 22feb43..98aed58 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 _0xd358=['emit','hasOwnProperty','hook','../../mysqldb','VoicePrefix','setMaxListeners','update','remove'];(function(_0xc23380,_0x18e158){var _0x4b1b26=function(_0x11796b){while(--_0x11796b){_0xc23380['push'](_0xc23380['shift']());}};_0x4b1b26(++_0x18e158);}(_0xd358,0xab));var _0x8d35=function(_0x22e0c7,_0x2d615d){_0x22e0c7=_0x22e0c7-0x0;var _0x5097fe=_0xd358[_0x22e0c7];return _0x5097fe;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x8d35('0x0'))['db'][_0x8d35('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x8d35('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8d35('0x3'),'afterDestroy':_0x8d35('0x4')};function emitEvent(_0x29f613){return function(_0x2e8a05,_0x15d003,_0x5e0670){VoicePrefixEvents[_0x8d35('0x5')](_0x29f613+':'+_0x2e8a05['id'],_0x2e8a05);VoicePrefixEvents[_0x8d35('0x5')](_0x29f613,_0x2e8a05);_0x5e0670(null);};}for(var e in events){if(events[_0x8d35('0x6')](e)){var event=events[e];VoicePrefix[_0x8d35('0x7')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x74d7=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove'];(function(_0x2e4c33,_0xc20e33){var _0x2f7a87=function(_0x43cbef){while(--_0x43cbef){_0x2e4c33['push'](_0x2e4c33['shift']());}};_0x2f7a87(++_0xc20e33);}(_0x74d7,0xf6));var _0x774d=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x74d7[_0x432682];return _0x463d05;};'use strict';var EventEmitter=require(_0x774d('0x0'));var VoicePrefix=require(_0x774d('0x1'))['db'][_0x774d('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x774d('0x3')](0x0);var events={'afterCreate':_0x774d('0x4'),'afterUpdate':_0x774d('0x5'),'afterDestroy':_0x774d('0x6')};function emitEvent(_0x41ef83){return function(_0x59cd1e,_0x7cffc6,_0x451dd7){VoicePrefixEvents[_0x774d('0x7')](_0x41ef83+':'+_0x59cd1e['id'],_0x59cd1e);VoicePrefixEvents['emit'](_0x41ef83,_0x59cd1e);_0x451dd7(null);};}for(var e in events){if(events[_0x774d('0x8')](e)){var event=events[e];VoicePrefix[_0x774d('0x9')](e,emitEvent(event));}}module[_0x774d('0xa')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index e108d38..ae92e3f 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 _0xdf87=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./voicePrefix.attributes','exports','define'];(function(_0x12fb65,_0x116cd9){var _0x179501=function(_0x18b42a){while(--_0x18b42a){_0x12fb65['push'](_0x12fb65['shift']());}};_0x179501(++_0x116cd9);}(_0xdf87,0xd2));var _0x7df8=function(_0xa1b128,_0x911aa6){_0xa1b128=_0xa1b128-0x0;var _0x5830ab=_0xdf87[_0xa1b128];return _0x5830ab;};'use strict';var _=require('lodash');var util=require(_0x7df8('0x0'));var logger=require(_0x7df8('0x1'))(_0x7df8('0x2'));var moment=require(_0x7df8('0x3'));var BPromise=require('bluebird');var rp=require(_0x7df8('0x4'));var fs=require('fs');var path=require(_0x7df8('0x5'));var rimraf=require('rimraf');var config=require(_0x7df8('0x6'));var attributes=require(_0x7df8('0x7'));module[_0x7df8('0x8')]=function(_0x24c2ec,_0x31029f){return _0x24c2ec[_0x7df8('0x9')]('VoicePrefix',attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe7de=['define','VoicePrefix','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports'];(function(_0x51db6d,_0x39dfbe){var _0x18f0df=function(_0x170c06){while(--_0x170c06){_0x51db6d['push'](_0x51db6d['shift']());}};_0x18f0df(++_0x39dfbe);}(_0xe7de,0xde));var _0xee7d=function(_0x3192ef,_0xf37150){_0x3192ef=_0x3192ef-0x0;var _0x4cf45e=_0xe7de[_0x3192ef];return _0x4cf45e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xee7d('0x0'));var moment=require(_0xee7d('0x1'));var BPromise=require(_0xee7d('0x2'));var rp=require(_0xee7d('0x3'));var fs=require('fs');var path=require(_0xee7d('0x4'));var rimraf=require(_0xee7d('0x5'));var config=require(_0xee7d('0x6'));var attributes=require(_0xee7d('0x7'));module[_0xee7d('0x8')]=function(_0x4fd7ff,_0x5dfd7d){return _0x4fd7ff[_0xee7d('0x9')](_0xee7d('0xa'),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 6080237..8122246 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 _0x225b=['socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x317003,_0x3f5784){var _0x4abb30=function(_0x544b1d){while(--_0x544b1d){_0x317003['push'](_0x317003['shift']());}};_0x4abb30(++_0x3f5784);}(_0x225b,0xb1));var _0xb225=function(_0x5b7bf5,_0x2a305f){_0x5b7bf5=_0x5b7bf5-0x0;var _0x2ecd90=_0x225b[_0x5b7bf5];return _0x2ecd90;};'use strict';var _=require(_0xb225('0x0'));var util=require(_0xb225('0x1'));var moment=require('moment');var BPromise=require(_0xb225('0x2'));var rs=require(_0xb225('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb225('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb225('0x5'))('rpc');var config=require(_0xb225('0x6'));var jayson=require(_0xb225('0x7'));var client=jayson[_0xb225('0x8')][_0xb225('0x9')]({'port':0x232a});config[_0xb225('0xa')]=_[_0xb225('0xb')](config[_0xb225('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xb225('0xc'))(new Redis(config[_0xb225('0xa')]));require(_0xb225('0xd'))[_0xb225('0xe')](socket);function respondWithRpcPromise(_0x5c5591,_0x21db8c,_0x26fa66){return new BPromise(function(_0x28c709,_0x594075){return client[_0xb225('0xf')](_0x5c5591,_0x26fa66)[_0xb225('0x10')](function(_0x3bd3e3){logger[_0xb225('0x11')](_0xb225('0x12'),_0x21db8c,'request\x20sent');logger[_0xb225('0x13')](_0xb225('0x14'),_0x21db8c,_0xb225('0x15'),JSON[_0xb225('0x16')](_0x3bd3e3));if(_0x3bd3e3[_0xb225('0x17')]){if(_0x3bd3e3['error']['code']===0x1f4){logger[_0xb225('0x17')](_0xb225('0x12'),_0x21db8c,_0x3bd3e3[_0xb225('0x17')][_0xb225('0x18')]);return _0x594075(_0x3bd3e3[_0xb225('0x17')][_0xb225('0x18')]);}logger[_0xb225('0x17')](_0xb225('0x12'),_0x21db8c,_0x3bd3e3[_0xb225('0x17')][_0xb225('0x18')]);return _0x28c709(_0x3bd3e3[_0xb225('0x17')][_0xb225('0x18')]);}else{logger['info'](_0xb225('0x12'),_0x21db8c,_0xb225('0x15'));_0x28c709(_0x3bd3e3[_0xb225('0x19')][_0xb225('0x18')]);}})[_0xb225('0x1a')](function(_0x38b22d){logger[_0xb225('0x17')](_0xb225('0x12'),_0x21db8c,_0x38b22d);_0x594075(_0x38b22d);});});} \ No newline at end of file +var _0x2581=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x2581,0xcb));var _0x1258=function(_0x73eb59,_0x22a4ec){_0x73eb59=_0x73eb59-0x0;var _0x1ecaa5=_0x2581[_0x73eb59];return _0x1ecaa5;};'use strict';var _=require(_0x1258('0x0'));var util=require(_0x1258('0x1'));var moment=require(_0x1258('0x2'));var BPromise=require(_0x1258('0x3'));var rs=require(_0x1258('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1258('0x5'))['db'];var utils=require(_0x1258('0x6'));var logger=require(_0x1258('0x7'))(_0x1258('0x8'));var config=require(_0x1258('0x9'));var jayson=require(_0x1258('0xa'));var client=jayson[_0x1258('0xb')][_0x1258('0xc')]({'port':0x232a});config['redis']=_[_0x1258('0xd')](config[_0x1258('0xe')],{'host':_0x1258('0xf'),'port':0x18eb});var socket=require(_0x1258('0x10'))(new Redis(config[_0x1258('0xe')]));require(_0x1258('0x11'))[_0x1258('0x12')](socket);function respondWithRpcPromise(_0x5b5d76,_0x4c35f9,_0x431c06){return new BPromise(function(_0x570fc9,_0x15eea2){return client[_0x1258('0x13')](_0x5b5d76,_0x431c06)['then'](function(_0xe0aa84){logger[_0x1258('0x14')](_0x1258('0x15'),_0x4c35f9,_0x1258('0x16'));logger['debug'](_0x1258('0x17'),_0x4c35f9,_0x1258('0x16'),JSON[_0x1258('0x18')](_0xe0aa84));if(_0xe0aa84[_0x1258('0x19')]){if(_0xe0aa84[_0x1258('0x19')][_0x1258('0x1a')]===0x1f4){logger[_0x1258('0x19')]('VoicePrefix,\x20%s,\x20%s',_0x4c35f9,_0xe0aa84[_0x1258('0x19')]['message']);return _0x15eea2(_0xe0aa84[_0x1258('0x19')][_0x1258('0x1b')]);}logger[_0x1258('0x19')](_0x1258('0x15'),_0x4c35f9,_0xe0aa84[_0x1258('0x19')]['message']);return _0x570fc9(_0xe0aa84[_0x1258('0x19')][_0x1258('0x1b')]);}else{logger[_0x1258('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x4c35f9,_0x1258('0x16'));_0x570fc9(_0xe0aa84[_0x1258('0x1c')]['message']);}})[_0x1258('0x1d')](function(_0x2432b2){logger[_0x1258('0x19')](_0x1258('0x15'),_0x4c35f9,_0x2432b2);_0x15eea2(_0x2432b2);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index c50834c..c8b7e1a 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 _0x132f=['register','voicePrefix:','./voicePrefix.events','save','remove','update','emit','removeListener'];(function(_0x1852d4,_0x2a773e){var _0x17f2d5=function(_0x25f0f7){while(--_0x25f0f7){_0x1852d4['push'](_0x1852d4['shift']());}};_0x17f2d5(++_0x2a773e);}(_0x132f,0x182));var _0xf132=function(_0x3b76f7,_0x566c53){_0x3b76f7=_0x3b76f7-0x0;var _0x43984e=_0x132f[_0x3b76f7];return _0x43984e;};'use strict';var VoicePrefixEvents=require(_0xf132('0x0'));var events=[_0xf132('0x1'),_0xf132('0x2'),_0xf132('0x3')];function createListener(_0x2d22a3,_0x424c89){return function(_0x54a037){_0x424c89[_0xf132('0x4')](_0x2d22a3,_0x54a037);};}function removeListener(_0xaf9ce5,_0x852318){return function(){VoicePrefixEvents[_0xf132('0x5')](_0xaf9ce5,_0x852318);};}exports[_0xf132('0x6')]=function(_0x5e0f2b){for(var _0x925b1a=0x0,_0x280c1f=events['length'];_0x925b1a<_0x280c1f;_0x925b1a++){var _0xbbfdc7=events[_0x925b1a];var _0x58cdf9=createListener(_0xf132('0x7')+_0xbbfdc7,_0x5e0f2b);VoicePrefixEvents['on'](_0xbbfdc7,_0x58cdf9);}}; \ No newline at end of file +var _0xfa68=['voicePrefix:','./voicePrefix.events','save','remove','removeListener','register','length'];(function(_0x15a3f1,_0x445606){var _0x2fa096=function(_0x1fe98f){while(--_0x1fe98f){_0x15a3f1['push'](_0x15a3f1['shift']());}};_0x2fa096(++_0x445606);}(_0xfa68,0x86));var _0x8fa6=function(_0x52c64b,_0x496aa6){_0x52c64b=_0x52c64b-0x0;var _0x3b4799=_0xfa68[_0x52c64b];return _0x3b4799;};'use strict';var VoicePrefixEvents=require(_0x8fa6('0x0'));var events=[_0x8fa6('0x1'),_0x8fa6('0x2'),'update'];function createListener(_0x16029c,_0x3debfe){return function(_0x3cb0da){_0x3debfe['emit'](_0x16029c,_0x3cb0da);};}function removeListener(_0x1fba3b,_0x2a63d9){return function(){VoicePrefixEvents[_0x8fa6('0x3')](_0x1fba3b,_0x2a63d9);};}exports[_0x8fa6('0x4')]=function(_0x3d75c1){for(var _0x4f68b4=0x0,_0x1ab645=events[_0x8fa6('0x5')];_0x4f68b4<_0x1ab645;_0x4f68b4++){var _0x523f62=events[_0x4f68b4];var _0x1cdf94=createListener(_0x8fa6('0x6')+_0x523f62,_0x3d75c1);VoicePrefixEvents['on'](_0x523f62,_0x1cdf94);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 8f22a74..3fce4bf 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(_0x349b5c,_0x55e5fa){var _0x3efcac=function(_0x27832d){while(--_0x27832d){_0x349b5c['push'](_0x349b5c['shift']());}};_0x3efcac(++_0x55e5fa);}(_0xb10b,0x12a));var _0xbb10=function(_0x259aaf,_0x5dbec1){_0x259aaf=_0x259aaf-0x0;var _0x366663=_0xb10b[_0x259aaf];return _0x366663;};'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(_0x187aa8,_0x4412db){var _0x43eeb5=function(_0x52d7fe){while(--_0x52d7fe){_0x187aa8['push'](_0x187aa8['shift']());}};_0x43eeb5(++_0x4412db);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 9a9aa55..2bec922 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 _0x1d13=['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)','#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','sequelize','exports','STRING','name','ENUM','inbound','default','ringall','leastrecent','fewestcalls','random','linear','wrandom','rrordered','setDataValue','rrmemory','getDataValue','dialMethod','strategy','booked','roundrobin','progressive','predictive','power','INTEGER','yes','once','TEXT','join','joinempty','split','leavewhenempty','acw','wrapuptime','BOOLEAN','preview','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.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC'];(function(_0x335907,_0x1e9086){var _0x24550e=function(_0x2eef54){while(--_0x2eef54){_0x335907['push'](_0x335907['shift']());}};_0x24550e(++_0x1e9086);}(_0x1d13,0xa9));var _0x31d1=function(_0x243f90,_0x2f5796){_0x243f90=_0x243f90-0x0;var _0x299e4c=_0x1d13[_0x243f90];return _0x299e4c;};'use strict';var Sequelize=require(_0x31d1('0x0'));module[_0x31d1('0x1')]={'name':{'type':Sequelize[_0x31d1('0x2')],'allowNull':![],'unique':_0x31d1('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x31d1('0x4')](_0x31d1('0x5'),'outbound'),'allowNull':![],'defaultValue':_0x31d1('0x5')},'musiconhold':{'type':Sequelize[_0x31d1('0x2')],'defaultValue':_0x31d1('0x6')},'announce':{'type':Sequelize[_0x31d1('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x31d1('0x7'),_0x31d1('0x8'),_0x31d1('0x9'),_0x31d1('0xa'),'rrmemory',_0x31d1('0xb'),_0x31d1('0xc'),_0x31d1('0xd')),'allowNull':![],'defaultValue':_0x31d1('0x7'),'set':function(_0x2a9b94){this[_0x31d1('0xe')]('strategy',_0x2a9b94?_0x2a9b94:_0x31d1('0xf'));},'get':function(){var _0xd8af5d=this[_0x31d1('0x10')]('type');var _0x4dfab4=this['getDataValue'](_0x31d1('0x11'));var _0x57bdf7=this[_0x31d1('0x10')](_0x31d1('0x12'));if(_0xd8af5d===_0x31d1('0x5')){return _0x57bdf7;}if(_0x4dfab4===_0x31d1('0x13')&&_0x57bdf7===_0x31d1('0xf')||_0x4dfab4===_0x31d1('0x13')&&_0x57bdf7===_0x31d1('0x14')){return _0x57bdf7;}if(_0x4dfab4===_0x31d1('0x15')||_0x4dfab4===_0x31d1('0x16')||_0x4dfab4===_0x31d1('0x17')){return _0x57bdf7;}return null;}},'servicelevel':{'type':Sequelize[_0x31d1('0x18')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x31d1('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x31d1('0x18')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x31d1('0x18')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x31d1('0x2')]},'weight':{'type':Sequelize[_0x31d1('0x18')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x31d1('0x18')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x31d1('0x4')](_0x31d1('0x19'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize['ENUM']('yes','no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x31d1('0x4')](_0x31d1('0x19'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x31d1('0x4')](_0x31d1('0x19'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x31d1('0x4')](_0x31d1('0x19'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x31d1('0x4')](_0x31d1('0x19'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x31d1('0x4')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x31d1('0x4')](_0x31d1('0x19'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x31d1('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x31d1('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x31d1('0x18')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x31d1('0x18')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x31d1('0x19'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x31d1('0x4')]('yes','no'),'defaultValue':_0x31d1('0x19')},'announce_holdtime':{'type':Sequelize[_0x31d1('0x4')]('yes','no',_0x31d1('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x31d1('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x31d1('0x19'),'no')},'announce_position_limit':{'type':Sequelize[_0x31d1('0x18')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x31d1('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x31d1('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x31d1('0x2')]},'queue_youarenext':{'type':Sequelize[_0x31d1('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x31d1('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x31d1('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x31d1('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x31d1('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x31d1('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x31d1('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x31d1('0x2')]},'queue_less_than':{'type':Sequelize[_0x31d1('0x2')]},'periodic_announce':{'type':Sequelize[_0x31d1('0x1b')],'set':function(_0x58968f){this[_0x31d1('0xe')]('periodic_announce',_0x58968f?_0x58968f[_0x31d1('0x1c')](','):[]);},'get':function(){return this[_0x31d1('0x10')]('periodic_announce')?this['getDataValue']('periodic_announce')['split'](','):[];}},'joinempty':{'type':Sequelize[_0x31d1('0x2')],'defaultValue':_0x31d1('0x19'),'set':function(_0x1beca1){this[_0x31d1('0xe')](_0x31d1('0x1d'),_0x1beca1?_0x1beca1['join'](','):undefined);},'get':function(){return this[_0x31d1('0x10')](_0x31d1('0x1d'))?this[_0x31d1('0x10')](_0x31d1('0x1d'))[_0x31d1('0x1e')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x31d1('0x2')],'defaultValue':'no','set':function(_0xbc0f65){this[_0x31d1('0xe')](_0x31d1('0x1f'),_0xbc0f65?_0xbc0f65[_0x31d1('0x1c')](','):undefined);},'get':function(){return this[_0x31d1('0x10')](_0x31d1('0x1f'))?this[_0x31d1('0x10')](_0x31d1('0x1f'))[_0x31d1('0x1e')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x31d1('0x4')](_0x31d1('0x19'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x31d1('0x19'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x31d1('0x18')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x31d1('0x4')](_0x31d1('0x19'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x31d1('0x2')]},'description':{'type':Sequelize[_0x31d1('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x16f15f){this[_0x31d1('0xe')](_0x31d1('0x20'),_0x16f15f);if(_0x16f15f){if(this['getDataValue'](_0x31d1('0x21'))<0x2){this['setDataValue'](_0x31d1('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x31d1('0x18')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x31d1('0x22')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x31d1('0x4')](_0x31d1('0x23'),_0x31d1('0x15'),'power','predictive','booked'),'defaultValue':_0x31d1('0x15'),'comment':_0x31d1('0x24')},'dialLimitChannel':{'type':Sequelize[_0x31d1('0x18')](0x4)[_0x31d1('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x31d1('0x26')},'dialLimitQueue':{'type':Sequelize[_0x31d1('0x18')](0x4)[_0x31d1('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x31d1('0x27')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x31d1('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x31d1('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0x31d1('0x4')](_0x31d1('0x29'),_0x31d1('0x2a')),'defaultValue':_0x31d1('0x2a'),'comment':_0x31d1('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x31d1('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x31d1('0x2c')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x31d1('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x31d1('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x31d1('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x31d1('0x18')](0x3)[_0x31d1('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x31d1('0x2')],'defaultValue':_0x31d1('0x2e'),'comment':_0x31d1('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0x31d1('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x31d1('0x30')},'dialQueueProject':{'type':Sequelize[_0x31d1('0x2')],'comment':_0x31d1('0x31')},'dialCongestionMaxRetry':{'type':Sequelize[_0x31d1('0x18')](0x3)[_0x31d1('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x31d1('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x31d1('0x32')},'dialBusyMaxRetry':{'type':Sequelize[_0x31d1('0x18')](0x3)[_0x31d1('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x31d1('0x33')},'dialBusyRetryFrequency':{'type':Sequelize[_0x31d1('0x18')](0x5)[_0x31d1('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x31d1('0x34')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x31d1('0x18')](0x3)[_0x31d1('0x25')],'defaultValue':0x3,'comment':_0x31d1('0x35')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x31d1('0x18')](0x5)[_0x31d1('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x31d1('0x18')](0x3)[_0x31d1('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x31d1('0x36')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x31d1('0x37')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x31d1('0x4')](_0x31d1('0x38'),'never',_0x31d1('0x39')),'defaultValue':_0x31d1('0x38')},'dialAMDActive':{'type':Sequelize[_0x31d1('0x22')],'defaultValue':0x0,'comment':_0x31d1('0x3a')},'dialAMDInitialSilence':{'type':Sequelize[_0x31d1('0x18')](0x9)[_0x31d1('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x31d1('0x3b')},'dialAMDGreeting':{'type':Sequelize[_0x31d1('0x18')](0x9)[_0x31d1('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x31d1('0x3c')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x31d1('0x18')](0x9)[_0x31d1('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x31d1('0x18')](0x9)[_0x31d1('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x31d1('0x3d')},'dialAMDMinWordLength':{'type':Sequelize[_0x31d1('0x18')](0x9)[_0x31d1('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x31d1('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x31d1('0x18')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x31d1('0x3f')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x31d1('0x18')](0x9)[_0x31d1('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x31d1('0x40')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x31d1('0x18')](0x5)[_0x31d1('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x31d1('0x18')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0x31d1('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x31d1('0x41')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x31d1('0x42')},'dialOrderByScheduledAt':{'type':Sequelize[_0x31d1('0x4')](_0x31d1('0x43'),'ASC'),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x31d1('0x31')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x31d1('0x22')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x31d1('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x31d1('0x44')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x31d1('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x31d1('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x31d1('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x31d1('0x18')](0x5)[_0x31d1('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x31d1('0x18')](0x3)[_0x31d1('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x31d1('0x47')},'dialDropRetryFrequency':{'type':Sequelize[_0x31d1('0x18')](0x5)[_0x31d1('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x31d1('0x48')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x31d1('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x31d1('0x18')](0x5)[_0x31d1('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x31d1('0x49')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x31d1('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x31d1('0x18')](0x5)[_0x31d1('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x31d1('0x18')](0x3)[_0x31d1('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x31d1('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x31d1('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x31d1('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x31d1('0x18')],'allowNull':!![],'comment':_0x31d1('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0x31d1('0x22')],'defaultValue':![],'comment':_0x31d1('0x4d'),'set':function(_0x2285dc){if(!_0x2285dc)this[_0x31d1('0xe')](_0x31d1('0x4e'),null);this[_0x31d1('0xe')]('mandatoryDisposition',_0x2285dc);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x31d1('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x31d1('0x22')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x31d1('0x22')],'defaultValue':![]}}; \ No newline at end of file +var _0x093d=['ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','strategy','getDataValue','type','booked','roundrobin','progressive','predictive','power','INTEGER','yes','once','setDataValue','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','Queue\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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','default'];(function(_0x45ebe0,_0x4c8960){var _0x94bd2b=function(_0x736e86){while(--_0x736e86){_0x45ebe0['push'](_0x45ebe0['shift']());}};_0x94bd2b(++_0x4c8960);}(_0x093d,0x1ab));var _0xd093=function(_0x134448,_0x591d7b){_0x134448=_0x134448-0x0;var _0x2d52a1=_0x093d[_0x134448];return _0x2d52a1;};'use strict';var Sequelize=require(_0xd093('0x0'));module[_0xd093('0x1')]={'name':{'type':Sequelize[_0xd093('0x2')],'allowNull':![],'unique':_0xd093('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xd093('0x4')](_0xd093('0x5'),_0xd093('0x6')),'allowNull':![],'defaultValue':_0xd093('0x5')},'musiconhold':{'type':Sequelize[_0xd093('0x2')],'defaultValue':_0xd093('0x7')},'announce':{'type':Sequelize[_0xd093('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0xd093('0x4')]('rr',_0xd093('0x8'),_0xd093('0x9'),_0xd093('0xa'),_0xd093('0xb'),_0xd093('0xc'),_0xd093('0xd'),_0xd093('0xe'),_0xd093('0xf')),'allowNull':![],'defaultValue':_0xd093('0x8'),'set':function(_0x15e985){this['setDataValue'](_0xd093('0x10'),_0x15e985?_0x15e985:_0xd093('0xc'));},'get':function(){var _0x1092d6=this[_0xd093('0x11')](_0xd093('0x12'));var _0xf25d7c=this[_0xd093('0x11')]('dialMethod');var _0x337e15=this[_0xd093('0x11')](_0xd093('0x10'));if(_0x1092d6===_0xd093('0x5')){return _0x337e15;}if(_0xf25d7c==='booked'&&_0x337e15==='rrmemory'||_0xf25d7c===_0xd093('0x13')&&_0x337e15===_0xd093('0x14')){return _0x337e15;}if(_0xf25d7c===_0xd093('0x15')||_0xf25d7c===_0xd093('0x16')||_0xf25d7c===_0xd093('0x17')){return _0x337e15;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0xd093('0x18')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xd093('0x18')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xd093('0x2')]},'weight':{'type':Sequelize[_0xd093('0x18')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xd093('0x18')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xd093('0x4')]('yes','no'),'defaultValue':_0xd093('0x19')},'autopause':{'type':Sequelize[_0xd093('0x4')](_0xd093('0x19'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xd093('0x18')](0xb)},'autopausebusy':{'type':Sequelize[_0xd093('0x4')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xd093('0x4')](_0xd093('0x19'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xd093('0x18')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xd093('0x4')](_0xd093('0x19'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xd093('0x4')](_0xd093('0x19'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xd093('0x4')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xd093('0x4')](_0xd093('0x19'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xd093('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xd093('0x18')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xd093('0x18')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xd093('0x4')](_0xd093('0x19'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0xd093('0x19'),'no'),'defaultValue':_0xd093('0x19')},'announce_holdtime':{'type':Sequelize[_0xd093('0x4')](_0xd093('0x19'),'no',_0xd093('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xd093('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xd093('0x4')](_0xd093('0x19'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0xd093('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xd093('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0xd093('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xd093('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xd093('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xd093('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0xd093('0x2')]},'queue_quantity2':{'type':Sequelize[_0xd093('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0xd093('0x2')]},'queue_less_than':{'type':Sequelize[_0xd093('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0xab4921){this[_0xd093('0x1b')](_0xd093('0x1c'),_0xab4921?_0xab4921[_0xd093('0x1d')](','):[]);},'get':function(){return this[_0xd093('0x11')]('periodic_announce')?this['getDataValue']('periodic_announce')[_0xd093('0x1e')](','):[];}},'joinempty':{'type':Sequelize[_0xd093('0x2')],'defaultValue':_0xd093('0x19'),'set':function(_0x47f394){this[_0xd093('0x1b')](_0xd093('0x1f'),_0x47f394?_0x47f394[_0xd093('0x1d')](','):undefined);},'get':function(){return this[_0xd093('0x11')](_0xd093('0x1f'))?this[_0xd093('0x11')](_0xd093('0x1f'))[_0xd093('0x1e')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xd093('0x2')],'defaultValue':'no','set':function(_0x42e428){this[_0xd093('0x1b')]('leavewhenempty',_0x42e428?_0x42e428['join'](','):undefined);},'get':function(){return this[_0xd093('0x11')](_0xd093('0x20'))?this[_0xd093('0x11')](_0xd093('0x20'))[_0xd093('0x1e')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xd093('0x4')](_0xd093('0x19'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xd093('0x4')](_0xd093('0x19'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xd093('0x18')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xd093('0x4')](_0xd093('0x19'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xd093('0x2')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x39209c){this[_0xd093('0x1b')](_0xd093('0x21'),_0x39209c);if(_0x39209c){if(this[_0xd093('0x11')](_0xd093('0x22'))<0x2){this[_0xd093('0x1b')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xd093('0x23')],'defaultValue':0x0,'comment':_0xd093('0x24')},'dialMethod':{'type':Sequelize[_0xd093('0x4')](_0xd093('0x25'),_0xd093('0x15'),_0xd093('0x17'),_0xd093('0x16'),_0xd093('0x13')),'defaultValue':_0xd093('0x15'),'comment':_0xd093('0x26')},'dialLimitChannel':{'type':Sequelize[_0xd093('0x18')](0x4)[_0xd093('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0xd093('0x18')](0x4)[_0xd093('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0xd093('0x28')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xd093('0x29')},'dialPredictiveOptimization':{'type':Sequelize[_0xd093('0x4')](_0xd093('0x2a'),_0xd093('0x2b')),'defaultValue':'dropRate','comment':_0xd093('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xd093('0x28')](0x2)[_0xd093('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xd093('0x2d')},'dialPredictiveInterval':{'type':Sequelize[_0xd093('0x18')](0x3)[_0xd093('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xd093('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xd093('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xd093('0x18')](0x3)[_0xd093('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0xd093('0x2')],'defaultValue':_0xd093('0x2f'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xd093('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd093('0x30')},'dialQueueProject':{'type':Sequelize[_0xd093('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xd093('0x18')](0x3)[_0xd093('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd093('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd093('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd093('0x32')},'dialBusyMaxRetry':{'type':Sequelize[_0xd093('0x18')](0x3)[_0xd093('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xd093('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd093('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xd093('0x18')](0x3)[_0xd093('0x27')],'defaultValue':0x3,'comment':_0xd093('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd093('0x35')},'dialGlobalMaxRetry':{'type':Sequelize[_0xd093('0x18')](0x3)[_0xd093('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xd093('0x36')},'dialTimezone':{'type':Sequelize[_0xd093('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xd093('0x37')},'dialPrefix':{'type':Sequelize[_0xd093('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always',_0xd093('0x38'),_0xd093('0x39')),'defaultValue':_0xd093('0x3a')},'dialAMDActive':{'type':Sequelize[_0xd093('0x23')],'defaultValue':0x0,'comment':_0xd093('0x3b')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xd093('0x3c')},'dialAMDGreeting':{'type':Sequelize[_0xd093('0x18')](0x9)[_0xd093('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xd093('0x3d')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xd093('0x18')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xd093('0x3e')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xd093('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd093('0x3f')},'dialAMDMinWordLength':{'type':Sequelize[_0xd093('0x18')](0x9)[_0xd093('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xd093('0x40')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xd093('0x18')](0x9)[_0xd093('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xd093('0x41')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xd093('0x18')](0x9)[_0xd093('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xd093('0x42')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xd093('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xd093('0x18')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd093('0x43')},'dialRecallMeTimeout':{'type':Sequelize[_0xd093('0x18')](0x5)[_0xd093('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xd093('0x44')},'dialRecallInQueue':{'type':Sequelize[_0xd093('0x23')],'defaultValue':0x0,'comment':_0xd093('0x45')},'dialOrderByScheduledAt':{'type':Sequelize[_0xd093('0x4')](_0xd093('0x46'),_0xd093('0x47')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0xd093('0x48')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xd093('0x23')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xd093('0x18')](0x3)[_0xd093('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd093('0x49')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xd093('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd093('0x4a')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xd093('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd093('0x4b')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xd093('0x18')](0x5)[_0xd093('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd093('0x4c')},'dialDropMaxRetry':{'type':Sequelize[_0xd093('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd093('0x4d')},'dialDropRetryFrequency':{'type':Sequelize[_0xd093('0x18')](0x5)[_0xd093('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd093('0x4e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xd093('0x18')](0x3)[_0xd093('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd093('0x4f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xd093('0x18')](0x5)[_0xd093('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd093('0x50')},'dialMachineMaxRetry':{'type':Sequelize[_0xd093('0x18')](0x3)[_0xd093('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xd093('0x18')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd093('0x51')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xd093('0x18')](0x3)[_0xd093('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd093('0x52')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xd093('0x18')](0x5)[_0xd093('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd093('0x53')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd093('0x18')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xd093('0x54'),'set':function(_0x1107cf){if(!_0x1107cf)this[_0xd093('0x1b')](_0xd093('0x55'),null);this[_0xd093('0x1b')](_0xd093('0x56'),_0x1107cf);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xd093('0x18')](0x3)[_0xd093('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xd093('0x18')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xd093('0x23')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xd093('0x23')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 3427361..c5b1dc5 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 _0x353b=['end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','VoiceQueues','inbound','outbound','ignore','map','value','includes','UserProfileResource','sendStatus','stack','name','index','VoiceQueue','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','include','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','QueueCampaigns','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','role','CmHopper','pick','VoiceQueueId','getHopperHistories','findOne','CmHopperHistory','findAll','getHopperFinals','CmHopperFinal','nolimit','CmHopperBlack','getTeams','Team','addTeams','teams','User','online','Agents','forEach','penalty','sequelize','transaction','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','interface','format','SIP/%s','userVoiceQueue:save','ids','select','field','tq.TeamId','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','compact','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','emit','voicePause','isNil','isArray','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','cm_hopper','phone','scheduledAt','ListId','updatedAt','ContactId','NOW()','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','onlyIfOpen','into','fromQuery','cm_contacts','insert','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','status'];(function(_0x3b1c4d,_0x5b9bd4){var _0x14f1d2=function(_0x2343d8){while(--_0x2343d8){_0x3b1c4d['push'](_0x3b1c4d['shift']());}};_0x14f1d2(++_0x5b9bd4);}(_0x353b,0x99));var _0xb353=function(_0x314ee0,_0x2c854d){_0x314ee0=_0x314ee0-0x0;var _0x2c618a=_0x353b[_0x314ee0];return _0x2c618a;};'use strict';var emlformat=require(_0xb353('0x0'));var rimraf=require(_0xb353('0x1'));var zipdir=require(_0xb353('0x2'));var jsonpatch=require(_0xb353('0x3'));var rp=require(_0xb353('0x4'));var moment=require(_0xb353('0x5'));var BPromise=require(_0xb353('0x6'));var Mustache=require(_0xb353('0x7'));var util=require(_0xb353('0x8'));var path=require(_0xb353('0x9'));var sox=require('sox');var csv=require(_0xb353('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb353('0xb'));var squel=require('squel');var crypto=require(_0xb353('0xc'));var jsforce=require(_0xb353('0xd'));var deskjs=require(_0xb353('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb353('0xf'));var Papa=require(_0xb353('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb353('0x11'));var as=require(_0xb353('0x12'));var hardwareService=require(_0xb353('0x13'));var logger=require(_0xb353('0x14'))(_0xb353('0x15'));var utils=require(_0xb353('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb353('0x17'));var db=require(_0xb353('0x18'))['db'];config[_0xb353('0x19')]=_[_0xb353('0x1a')](config[_0xb353('0x19')],{'host':_0xb353('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb353('0x19')]));require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0x2dcfb4,_0x2882db){_0x2882db=_0x2882db||0xcc;return function(_0x5e1468){if(_0x5e1468){return _0x2dcfb4['sendStatus'](_0x2882db);}return _0x2dcfb4[_0xb353('0x1c')](_0x2882db)[_0xb353('0x1d')]();};}function respondWithResult(_0x165862,_0x12a999){_0x12a999=_0x12a999||0xc8;return function(_0x3785a0){if(_0x3785a0){return _0x165862[_0xb353('0x1c')](_0x12a999)['json'](_0x3785a0);}};}function respondWithFilteredResult(_0xbf6cce,_0x4aa414){return function(_0xbb02a5){if(_0xbb02a5){var _0x282819=typeof _0x4aa414[_0xb353('0x1e')]===_0xb353('0x1f')&&typeof _0x4aa414[_0xb353('0x20')]===_0xb353('0x1f');var _0x353953=_0xbb02a5[_0xb353('0x21')];var _0x569670=_0x282819?0x0:_0x4aa414[_0xb353('0x1e')];var _0x3ff5f5=_0x282819?_0xbb02a5[_0xb353('0x21')]:_0x4aa414[_0xb353('0x1e')]+_0x4aa414[_0xb353('0x20')];var _0xf51645;if(_0x3ff5f5>=_0x353953){_0x3ff5f5=_0x353953;_0xf51645=0xc8;}else{_0xf51645=0xce;}_0xbf6cce[_0xb353('0x1c')](_0xf51645);return _0xbf6cce[_0xb353('0x22')](_0xb353('0x23'),_0x569670+'-'+_0x3ff5f5+'/'+_0x353953)['json'](_0xbb02a5);}return null;};}function patchUpdates(_0x409cba){return function(_0x4d7930){try{jsonpatch[_0xb353('0x24')](_0x4d7930,_0x409cba,!![]);}catch(_0x2e96e7){return BPromise[_0xb353('0x25')](_0x2e96e7);}return _0x4d7930[_0xb353('0x26')]();};}function saveUpdates(_0x3c536f,_0x10fbe6){return function(_0x1697ba){if(_0x1697ba){return _0x1697ba[_0xb353('0x27')](_0x3c536f)['then'](function(_0x4a834f){return _0x4a834f;});}return null;};}function removeEntity(_0x582af0,_0x47ca11){return function(_0xcfe1f5){if(_0xcfe1f5){return _0xcfe1f5[_0xb353('0x28')]()[_0xb353('0x29')](function(){var _0x8198ed=_0xcfe1f5['get']({'plain':!![]});var _0x166abb=[{'name':_0xb353('0x2a'),'value':_0xb353('0x2b'),'ignore':![]},{'name':'QueueCampaigns','value':_0xb353('0x2c'),'ignore':![]}];var _0x491423=_(_0x166abb)['filter'](_0xb353('0x2d'))[_0xb353('0x2e')](_0xb353('0x2f'))[_0xb353('0x2f')]();if(_[_0xb353('0x30')](_0x491423,_0x8198ed['type'])){return;}var _0x55023f=_['find'](_0x166abb,[_0xb353('0x2f'),_0x8198ed['type']])['name'];return db[_0xb353('0x31')][_0xb353('0x28')]({'where':{'type':_0x55023f,'resourceId':_0x8198ed['id']}})['then'](function(){return _0xcfe1f5;});})[_0xb353('0x29')](function(){_0x582af0[_0xb353('0x1c')](0xcc)[_0xb353('0x1d')]();});}};}function handleEntityNotFound(_0x11b2f5,_0x174823){return function(_0x4b65c5){if(!_0x4b65c5){_0x11b2f5[_0xb353('0x32')](0x194);}return _0x4b65c5;};}function handleError(_0x29bb69,_0x17240b){_0x17240b=_0x17240b||0x1f4;return function(_0x2da962){logger['error'](_0x2da962[_0xb353('0x33')]);if(_0x2da962[_0xb353('0x34')]){delete _0x2da962[_0xb353('0x34')];}_0x29bb69[_0xb353('0x1c')](_0x17240b)['send'](_0x2da962);};}exports[_0xb353('0x35')]=function(_0x244601,_0x3bbae8){var _0xe9af5f={},_0x12c915={},_0x7de7a1={'count':0x0,'rows':[]};var _0x14eb18=_[_0xb353('0x2e')](db[_0xb353('0x36')][_0xb353('0x37')],function(_0x145d55){return{'name':_0x145d55[_0xb353('0x38')],'type':_0x145d55[_0xb353('0x39')]['key']};});_0x12c915[_0xb353('0x3a')]=_[_0xb353('0x2e')](_0x14eb18,_0xb353('0x34'));_0x12c915['query']=_[_0xb353('0x3b')](_0x244601[_0xb353('0x3c')]);_0x12c915[_0xb353('0x3d')]=_[_0xb353('0x3e')](_0x12c915['model'],_0x12c915[_0xb353('0x3c')]);_0xe9af5f[_0xb353('0x3f')]=_[_0xb353('0x3e')](_0x12c915[_0xb353('0x3a')],qs[_0xb353('0x40')](_0x244601[_0xb353('0x3c')][_0xb353('0x40')]));_0xe9af5f[_0xb353('0x3f')]=_0xe9af5f[_0xb353('0x3f')][_0xb353('0x41')]?_0xe9af5f[_0xb353('0x3f')]:_0x12c915[_0xb353('0x3a')];if(!_0x244601[_0xb353('0x3c')][_0xb353('0x42')]('nolimit')){_0xe9af5f[_0xb353('0x20')]=qs['limit'](_0x244601['query'][_0xb353('0x20')]);_0xe9af5f['offset']=qs[_0xb353('0x1e')](_0x244601[_0xb353('0x3c')][_0xb353('0x1e')]);}_0xe9af5f[_0xb353('0x43')]=qs['sort'](_0x244601[_0xb353('0x3c')][_0xb353('0x44')]);_0xe9af5f[_0xb353('0x45')]=qs[_0xb353('0x3d')](_['pick'](_0x244601['query'],_0x12c915[_0xb353('0x3d')]),_0x14eb18);if(_0x244601[_0xb353('0x3c')][_0xb353('0x46')]){_0xe9af5f[_0xb353('0x45')]=_['merge'](_0xe9af5f[_0xb353('0x45')],{'$or':_[_0xb353('0x2e')](_0x14eb18,function(_0x416c80){if(_0x416c80[_0xb353('0x39')]!==_0xb353('0x47')){var _0x9c78b2={};_0x9c78b2[_0x416c80[_0xb353('0x34')]]={'$like':'%'+_0x244601['query']['filter']+'%'};return _0x9c78b2;}})});}_0xe9af5f=_[_0xb353('0x48')]({},_0xe9af5f,_0x244601[_0xb353('0x49')]);var _0x36e056={'where':_0xe9af5f['where']};return db[_0xb353('0x36')][_0xb353('0x21')](_0x36e056)[_0xb353('0x29')](function(_0x15c20f){_0x7de7a1[_0xb353('0x21')]=_0x15c20f;if(_0x244601[_0xb353('0x3c')]['includeAll']){_0xe9af5f[_0xb353('0x4a')]=[{'all':!![]}];}return db[_0xb353('0x36')]['findAll'](_0xe9af5f);})[_0xb353('0x29')](function(_0x1cf6b2){_0x7de7a1[_0xb353('0x4b')]=_0x1cf6b2;return _0x7de7a1;})[_0xb353('0x29')](respondWithFilteredResult(_0x3bbae8,_0xe9af5f))[_0xb353('0x4c')](handleError(_0x3bbae8,null));};exports[_0xb353('0x4d')]=function(_0x92213e,_0x14808c){var _0xab661b={'raw':![],'where':{'id':_0x92213e[_0xb353('0x4e')]['id']}},_0x1ba8c7={};_0x1ba8c7['model']=_[_0xb353('0x3b')](db[_0xb353('0x36')][_0xb353('0x37')]);_0x1ba8c7[_0xb353('0x3c')]=_[_0xb353('0x3b')](_0x92213e['query']);_0x1ba8c7[_0xb353('0x3d')]=_['intersection'](_0x1ba8c7[_0xb353('0x3a')],_0x1ba8c7[_0xb353('0x3c')]);_0xab661b[_0xb353('0x3f')]=_[_0xb353('0x3e')](_0x1ba8c7[_0xb353('0x3a')],qs['fields'](_0x92213e[_0xb353('0x3c')]['fields']));_0xab661b[_0xb353('0x3f')]=_0xab661b[_0xb353('0x3f')]['length']?_0xab661b[_0xb353('0x3f')]:_0x1ba8c7[_0xb353('0x3a')];if(_0x92213e[_0xb353('0x3c')][_0xb353('0x4f')]){_0xab661b[_0xb353('0x4a')]=[{'all':!![]}];}_0xab661b=_[_0xb353('0x48')]({},_0xab661b,_0x92213e[_0xb353('0x49')]);return db['VoiceQueue'][_0xb353('0x50')](_0xab661b)['then'](handleEntityNotFound(_0x14808c,null))[_0xb353('0x29')](respondWithResult(_0x14808c,null))[_0xb353('0x4c')](handleError(_0x14808c,null));};exports[_0xb353('0x51')]=function(_0x1780a5,_0x70dcb5){return db['VoiceQueue'][_0xb353('0x51')](_0x1780a5[_0xb353('0x52')],{})['then'](function(_0x56d136){var _0x451f2a=_0x1780a5[_0xb353('0x53')]['get']({'plain':!![]});if(!_0x451f2a)throw new Error(_0xb353('0x54'));if(_0x451f2a['role']==='user'){var _0x378505=_0x56d136[_0xb353('0x55')]({'plain':!![]});var _0x36ce8c=[{'name':_0xb353('0x2a'),'value':'inbound'},{'name':_0xb353('0x56'),'value':_0xb353('0x2c')}];var _0x2fbb05=_['find'](_0x36ce8c,['value',_0x378505[_0xb353('0x39')]])['name'];return db[_0xb353('0x57')][_0xb353('0x50')]({'where':{'name':_0x2fbb05,'userProfileId':_0x451f2a['userProfileId']},'raw':!![]})[_0xb353('0x29')](function(_0x3520a7){if(_0x3520a7&&_0x3520a7['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x378505[_0xb353('0x34')],'resourceId':_0x378505['id'],'type':_0x3520a7[_0xb353('0x34')],'sectionId':_0x3520a7['id']},{})[_0xb353('0x29')](function(){return _0x56d136;});}else{return _0x56d136;}})[_0xb353('0x4c')](function(_0x1ca3ac){logger[_0xb353('0x58')](_0xb353('0x59'),_0x1ca3ac);throw _0x1ca3ac;});}return _0x56d136;})[_0xb353('0x29')](respondWithResult(_0x70dcb5,0xc9))[_0xb353('0x4c')](handleError(_0x70dcb5,null));};exports[_0xb353('0x5a')]=function(_0x4392be,_0x42c043){var _0x26826a={'where':{'id':_0x4392be['params']['id']}},_0x7df8d1={};_0x7df8d1[_0xb353('0x3a')]=_[_0xb353('0x3b')](db[_0xb353('0x36')][_0xb353('0x37')]);_0x26826a[_0xb353('0x3f')]=_[_0xb353('0x3e')](_0x7df8d1['model'],qs[_0xb353('0x40')](_0x4392be[_0xb353('0x3c')][_0xb353('0x40')]));_0x26826a[_0xb353('0x3f')]=_0x26826a[_0xb353('0x3f')][_0xb353('0x41')]?_0x26826a[_0xb353('0x3f')]:_0x7df8d1['model'];if(_0x4392be['query'][_0xb353('0x4f')]){_0x26826a['include']=[{'all':!![]}];}_0x26826a=_[_0xb353('0x48')]({},_0x26826a,_0x4392be[_0xb353('0x49')]);return db['VoiceQueue']['find'](_0x26826a)[_0xb353('0x29')](handleEntityNotFound(_0x42c043,null))['then'](function(_0xebfb66){if(_0xebfb66){var _0x375d5c=_0xebfb66[_0xb353('0x55')]({'plain':!![]});_0x375d5c=qs[_0xb353('0x5b')](_0x375d5c,['id',_0xb353('0x5c'),'updatedAt']);_0x4392be[_0xb353('0x52')]=_[_0xb353('0x5b')](_0x4392be[_0xb353('0x52')],['id',_0xb353('0x5c'),'updatedAt']);return db[_0xb353('0x36')][_0xb353('0x51')](_[_0xb353('0x48')](_0x375d5c,_0x4392be[_0xb353('0x52')]),{'include':_0x4392be['query'][_0xb353('0x4f')]?[{'all':!![]}]:undefined})['then'](function(_0x3bb695){var _0x1a97b9=_0x4392be[_0xb353('0x53')][_0xb353('0x55')]({'plain':!![]});if(!_0x1a97b9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a97b9[_0xb353('0x5d')]===_0xb353('0x53')){var _0x4cab3d=_0x3bb695['get']({'plain':!![]});var _0x7b3f3b=[{'name':'VoiceQueues','value':_0xb353('0x2b')},{'name':_0xb353('0x56'),'value':'outbound'}];var _0x303345=_[_0xb353('0x50')](_0x7b3f3b,[_0xb353('0x2f'),_0x4cab3d[_0xb353('0x39')]])[_0xb353('0x34')];return db[_0xb353('0x57')]['find']({'where':{'name':_0x303345,'userProfileId':_0x1a97b9['userProfileId']},'raw':!![]})[_0xb353('0x29')](function(_0x44f2e1){if(_0x44f2e1&&_0x44f2e1['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x4cab3d[_0xb353('0x34')],'resourceId':_0x4cab3d['id'],'type':_0x44f2e1[_0xb353('0x34')],'sectionId':_0x44f2e1['id']},{})['then'](function(){return _0x3bb695;});}else{return _0x3bb695;}})[_0xb353('0x4c')](function(_0x2823d0){logger[_0xb353('0x58')](_0xb353('0x59'),_0x2823d0);throw _0x2823d0;});}return _0x3bb695;});}})[_0xb353('0x29')](respondWithResult(_0x42c043,0xc9))['catch'](handleError(_0x42c043,null));};exports[_0xb353('0x27')]=function(_0x5569a2,_0x146e19){if(_0x5569a2[_0xb353('0x52')]['id']){delete _0x5569a2[_0xb353('0x52')]['id'];}return db[_0xb353('0x36')][_0xb353('0x50')]({'where':{'id':_0x5569a2[_0xb353('0x4e')]['id']}})[_0xb353('0x29')](handleEntityNotFound(_0x146e19,null))[_0xb353('0x29')](saveUpdates(_0x5569a2[_0xb353('0x52')],null))[_0xb353('0x29')](respondWithResult(_0x146e19,null))[_0xb353('0x4c')](handleError(_0x146e19,null));};exports[_0xb353('0x28')]=function(_0x37936e,_0x5e2d1e){return db[_0xb353('0x36')][_0xb353('0x50')]({'where':{'id':_0x37936e['params']['id']}})[_0xb353('0x29')](handleEntityNotFound(_0x5e2d1e,null))[_0xb353('0x29')](removeEntity(_0x5e2d1e,null))[_0xb353('0x4c')](handleError(_0x5e2d1e,null));};exports['getHoppers']=function(_0x4a6c2d,_0x4ae74a,_0x504396){var _0x58cb00={'raw':![],'where':{}};var _0x26178b={};var _0x44facd={'count':0x0,'rows':[]};return db[_0xb353('0x36')]['findOne']({'where':{'id':_0x4a6c2d[_0xb353('0x4e')]['id']}})[_0xb353('0x29')](handleEntityNotFound(_0x4ae74a,null))['then'](function(_0x170894){if(_0x170894){_0x26178b[_0xb353('0x3a')]=_[_0xb353('0x3b')](db[_0xb353('0x5e')]['rawAttributes']);_0x26178b[_0xb353('0x3c')]=_[_0xb353('0x3b')](_0x4a6c2d[_0xb353('0x3c')]);_0x26178b[_0xb353('0x3d')]=_[_0xb353('0x3e')](_0x26178b[_0xb353('0x3a')],_0x26178b[_0xb353('0x3c')]);_0x58cb00[_0xb353('0x3f')]=_['intersection'](_0x26178b['model'],qs[_0xb353('0x40')](_0x4a6c2d[_0xb353('0x3c')][_0xb353('0x40')]));_0x58cb00[_0xb353('0x3f')]=_0x58cb00[_0xb353('0x3f')][_0xb353('0x41')]?_0x58cb00[_0xb353('0x3f')]:_0x26178b['model'];if(!_0x4a6c2d[_0xb353('0x3c')][_0xb353('0x42')]('nolimit')){_0x58cb00['limit']=qs['limit'](_0x4a6c2d[_0xb353('0x3c')][_0xb353('0x20')]);_0x58cb00[_0xb353('0x1e')]=qs[_0xb353('0x1e')](_0x4a6c2d['query']['offset']);}_0x58cb00[_0xb353('0x43')]=qs[_0xb353('0x44')](_0x4a6c2d[_0xb353('0x3c')]['sort']);_0x58cb00[_0xb353('0x45')]=qs[_0xb353('0x3d')](_[_0xb353('0x5f')](_0x4a6c2d['query'],_0x26178b[_0xb353('0x3d')]));_0x58cb00[_0xb353('0x45')][_0xb353('0x60')]=_0x170894['id'];if(_0x4a6c2d[_0xb353('0x3c')][_0xb353('0x46')]){_0x58cb00[_0xb353('0x45')]=_[_0xb353('0x48')](_0x58cb00[_0xb353('0x45')],{'$or':_[_0xb353('0x2e')](_0x58cb00[_0xb353('0x3f')],function(_0x2993ea){var _0x7b4c92={};_0x7b4c92[_0x2993ea]={'$like':'%'+_0x4a6c2d[_0xb353('0x3c')][_0xb353('0x46')]+'%'};return _0x7b4c92;})});}_0x58cb00=_[_0xb353('0x48')]({},_0x58cb00,_0x4a6c2d['options']);return db[_0xb353('0x5e')][_0xb353('0x21')]({'where':_0x58cb00[_0xb353('0x45')]})[_0xb353('0x29')](function(_0x232424){_0x44facd[_0xb353('0x21')]=_0x232424;if(_0x4a6c2d[_0xb353('0x3c')]['includeAll']){_0x58cb00[_0xb353('0x4a')]=[{'all':!![]}];}return db[_0xb353('0x5e')]['findAll'](_0x58cb00);})[_0xb353('0x29')](function(_0x233414){_0x44facd[_0xb353('0x4b')]=_0x233414;return _0x44facd;});}})[_0xb353('0x29')](respondWithFilteredResult(_0x4ae74a,_0x58cb00))[_0xb353('0x4c')](handleError(_0x4ae74a,null));};exports[_0xb353('0x61')]=function(_0x2ae219,_0x49bc46,_0x26aed9){var _0x47e91d={'raw':!![],'where':{}};var _0xa681f9={};var _0xa7a5fa={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xb353('0x62')]({'where':{'id':_0x2ae219[_0xb353('0x4e')]['id']}})[_0xb353('0x29')](handleEntityNotFound(_0x49bc46,null))['then'](function(_0x1e1f01){if(_0x1e1f01){_0xa681f9[_0xb353('0x3a')]=_[_0xb353('0x3b')](db[_0xb353('0x63')][_0xb353('0x37')]);_0xa681f9['query']=_[_0xb353('0x3b')](_0x2ae219['query']);_0xa681f9[_0xb353('0x3d')]=_[_0xb353('0x3e')](_0xa681f9[_0xb353('0x3a')],_0xa681f9[_0xb353('0x3c')]);_0x47e91d[_0xb353('0x3f')]=_[_0xb353('0x3e')](_0xa681f9[_0xb353('0x3a')],qs['fields'](_0x2ae219['query']['fields']));_0x47e91d[_0xb353('0x3f')]=_0x47e91d['attributes'][_0xb353('0x41')]?_0x47e91d[_0xb353('0x3f')]:_0xa681f9['model'];if(!_0x2ae219[_0xb353('0x3c')][_0xb353('0x42')]('nolimit')){_0x47e91d[_0xb353('0x20')]=qs['limit'](_0x2ae219['query'][_0xb353('0x20')]);_0x47e91d[_0xb353('0x1e')]=qs[_0xb353('0x1e')](_0x2ae219[_0xb353('0x3c')]['offset']);}_0x47e91d[_0xb353('0x43')]=qs[_0xb353('0x44')](_0x2ae219[_0xb353('0x3c')][_0xb353('0x44')]);_0x47e91d[_0xb353('0x45')]=qs['filters'](_[_0xb353('0x5f')](_0x2ae219['query'],_0xa681f9['filters']));_0x47e91d[_0xb353('0x45')][_0xb353('0x60')]=_0x1e1f01['id'];if(_0x2ae219['query'][_0xb353('0x46')]){_0x47e91d[_0xb353('0x45')]=_[_0xb353('0x48')](_0x47e91d[_0xb353('0x45')],{'$or':_[_0xb353('0x2e')](_0x47e91d[_0xb353('0x3f')],function(_0x18a93b){var _0x1d492a={};_0x1d492a[_0x18a93b]={'$like':'%'+_0x2ae219[_0xb353('0x3c')][_0xb353('0x46')]+'%'};return _0x1d492a;})});}_0x47e91d=_['merge']({},_0x47e91d,_0x2ae219[_0xb353('0x49')]);return db['CmHopperHistory'][_0xb353('0x21')]({'where':_0x47e91d[_0xb353('0x45')]})[_0xb353('0x29')](function(_0x1bfab6){_0xa7a5fa[_0xb353('0x21')]=_0x1bfab6;if(_0x2ae219[_0xb353('0x3c')][_0xb353('0x4f')]){_0x47e91d[_0xb353('0x4a')]=[{'all':!![]}];}return db[_0xb353('0x63')][_0xb353('0x64')](_0x47e91d);})[_0xb353('0x29')](function(_0x5204e6){_0xa7a5fa[_0xb353('0x4b')]=_0x5204e6;return _0xa7a5fa;});}})[_0xb353('0x29')](respondWithFilteredResult(_0x49bc46,_0x47e91d))[_0xb353('0x4c')](handleError(_0x49bc46,null));};exports[_0xb353('0x65')]=function(_0x2c05e2,_0x7ed295,_0x859fba){var _0xdc763e={'raw':!![],'where':{}};var _0x2b0ad7={};var _0x107576={'count':0x0,'rows':[]};return db[_0xb353('0x36')]['findOne']({'where':{'id':_0x2c05e2['params']['id']}})['then'](handleEntityNotFound(_0x7ed295,null))[_0xb353('0x29')](function(_0x1df6ed){if(_0x1df6ed){_0x2b0ad7[_0xb353('0x3a')]=_[_0xb353('0x3b')](db[_0xb353('0x66')][_0xb353('0x37')]);_0x2b0ad7[_0xb353('0x3c')]=_[_0xb353('0x3b')](_0x2c05e2['query']);_0x2b0ad7['filters']=_['intersection'](_0x2b0ad7[_0xb353('0x3a')],_0x2b0ad7['query']);_0xdc763e['attributes']=_[_0xb353('0x3e')](_0x2b0ad7[_0xb353('0x3a')],qs['fields'](_0x2c05e2[_0xb353('0x3c')][_0xb353('0x40')]));_0xdc763e[_0xb353('0x3f')]=_0xdc763e[_0xb353('0x3f')][_0xb353('0x41')]?_0xdc763e['attributes']:_0x2b0ad7['model'];if(!_0x2c05e2[_0xb353('0x3c')][_0xb353('0x42')](_0xb353('0x67'))){_0xdc763e[_0xb353('0x20')]=qs[_0xb353('0x20')](_0x2c05e2[_0xb353('0x3c')]['limit']);_0xdc763e[_0xb353('0x1e')]=qs[_0xb353('0x1e')](_0x2c05e2[_0xb353('0x3c')][_0xb353('0x1e')]);}_0xdc763e[_0xb353('0x43')]=qs[_0xb353('0x44')](_0x2c05e2[_0xb353('0x3c')][_0xb353('0x44')]);_0xdc763e['where']=qs[_0xb353('0x3d')](_[_0xb353('0x5f')](_0x2c05e2[_0xb353('0x3c')],_0x2b0ad7['filters']));_0xdc763e[_0xb353('0x45')][_0xb353('0x60')]=_0x1df6ed['id'];if(_0x2c05e2[_0xb353('0x3c')][_0xb353('0x46')]){_0xdc763e[_0xb353('0x45')]=_['merge'](_0xdc763e['where'],{'$or':_[_0xb353('0x2e')](_0xdc763e['attributes'],function(_0x365893){var _0x20ab2d={};_0x20ab2d[_0x365893]={'$like':'%'+_0x2c05e2['query']['filter']+'%'};return _0x20ab2d;})});}_0xdc763e=_[_0xb353('0x48')]({},_0xdc763e,_0x2c05e2[_0xb353('0x49')]);return db['CmHopperFinal']['count']({'where':_0xdc763e[_0xb353('0x45')]})[_0xb353('0x29')](function(_0x54a226){_0x107576['count']=_0x54a226;if(_0x2c05e2[_0xb353('0x3c')][_0xb353('0x4f')]){_0xdc763e['include']=[{'all':!![]}];}return db[_0xb353('0x66')][_0xb353('0x64')](_0xdc763e);})[_0xb353('0x29')](function(_0x580429){_0x107576[_0xb353('0x4b')]=_0x580429;return _0x107576;});}})[_0xb353('0x29')](respondWithFilteredResult(_0x7ed295,_0xdc763e))['catch'](handleError(_0x7ed295,null));};exports['getHopperBlacks']=function(_0xe6cec4,_0x275e32,_0x220d97){var _0x26111d={'raw':!![],'where':{}};var _0x495516={};var _0x4a1e6b={'count':0x0,'rows':[]};return db[_0xb353('0x36')][_0xb353('0x62')]({'where':{'id':_0xe6cec4[_0xb353('0x4e')]['id']}})[_0xb353('0x29')](handleEntityNotFound(_0x275e32,null))[_0xb353('0x29')](function(_0x258de4){if(_0x258de4){_0x495516[_0xb353('0x3a')]=_[_0xb353('0x3b')](db[_0xb353('0x68')]['rawAttributes']);_0x495516[_0xb353('0x3c')]=_[_0xb353('0x3b')](_0xe6cec4[_0xb353('0x3c')]);_0x495516[_0xb353('0x3d')]=_['intersection'](_0x495516[_0xb353('0x3a')],_0x495516['query']);_0x26111d['attributes']=_['intersection'](_0x495516[_0xb353('0x3a')],qs[_0xb353('0x40')](_0xe6cec4[_0xb353('0x3c')]['fields']));_0x26111d[_0xb353('0x3f')]=_0x26111d['attributes']['length']?_0x26111d[_0xb353('0x3f')]:_0x495516[_0xb353('0x3a')];if(!_0xe6cec4[_0xb353('0x3c')][_0xb353('0x42')]('nolimit')){_0x26111d['limit']=qs[_0xb353('0x20')](_0xe6cec4[_0xb353('0x3c')][_0xb353('0x20')]);_0x26111d[_0xb353('0x1e')]=qs[_0xb353('0x1e')](_0xe6cec4[_0xb353('0x3c')][_0xb353('0x1e')]);}_0x26111d[_0xb353('0x43')]=qs[_0xb353('0x44')](_0xe6cec4[_0xb353('0x3c')][_0xb353('0x44')]);_0x26111d[_0xb353('0x45')]=qs[_0xb353('0x3d')](_[_0xb353('0x5f')](_0xe6cec4[_0xb353('0x3c')],_0x495516[_0xb353('0x3d')]));_0x26111d[_0xb353('0x45')][_0xb353('0x60')]=_0x258de4['id'];if(_0xe6cec4[_0xb353('0x3c')][_0xb353('0x46')]){_0x26111d[_0xb353('0x45')]=_[_0xb353('0x48')](_0x26111d['where'],{'$or':_[_0xb353('0x2e')](_0x26111d[_0xb353('0x3f')],function(_0x20ec65){var _0x138e4b={};_0x138e4b[_0x20ec65]={'$like':'%'+_0xe6cec4[_0xb353('0x3c')][_0xb353('0x46')]+'%'};return _0x138e4b;})});}_0x26111d=_['merge']({},_0x26111d,_0xe6cec4[_0xb353('0x49')]);return db['CmHopperBlack'][_0xb353('0x21')]({'where':_0x26111d['where']})[_0xb353('0x29')](function(_0x2a5189){_0x4a1e6b[_0xb353('0x21')]=_0x2a5189;if(_0xe6cec4['query'][_0xb353('0x4f')]){_0x26111d[_0xb353('0x4a')]=[{'all':!![]}];}return db[_0xb353('0x68')]['findAll'](_0x26111d);})[_0xb353('0x29')](function(_0x1f278d){_0x4a1e6b[_0xb353('0x4b')]=_0x1f278d;return _0x4a1e6b;});}})['then'](respondWithFilteredResult(_0x275e32,_0x26111d))[_0xb353('0x4c')](handleError(_0x275e32,null));};exports[_0xb353('0x69')]=function(_0x5698c4,_0x3038b2,_0x4ec85b){var _0x262a12={};var _0x42769f={};var _0x143c11;var _0xdb4501;return db['VoiceQueue']['findOne']({'where':{'id':_0x5698c4[_0xb353('0x4e')]['id']}})[_0xb353('0x29')](handleEntityNotFound(_0x3038b2,null))[_0xb353('0x29')](function(_0x27cf47){if(_0x27cf47){_0x143c11=_0x27cf47;_0x42769f['model']=_[_0xb353('0x3b')](db[_0xb353('0x6a')][_0xb353('0x37')]);_0x42769f[_0xb353('0x3c')]=_[_0xb353('0x3b')](_0x5698c4['query']);_0x42769f[_0xb353('0x3d')]=_['intersection'](_0x42769f[_0xb353('0x3a')],_0x42769f[_0xb353('0x3c')]);_0x262a12['attributes']=_[_0xb353('0x3e')](_0x42769f[_0xb353('0x3a')],qs[_0xb353('0x40')](_0x5698c4['query'][_0xb353('0x40')]));_0x262a12['attributes']=_0x262a12['attributes'][_0xb353('0x41')]?_0x262a12['attributes']:_0x42769f['model'];_0x262a12['order']=qs[_0xb353('0x44')](_0x5698c4[_0xb353('0x3c')][_0xb353('0x44')]);_0x262a12['where']=qs[_0xb353('0x3d')](_[_0xb353('0x5f')](_0x5698c4['query'],_0x42769f[_0xb353('0x3d')]));if(_0x5698c4[_0xb353('0x3c')][_0xb353('0x46')]){_0x262a12[_0xb353('0x45')]=_[_0xb353('0x48')](_0x262a12[_0xb353('0x45')],{'$or':_[_0xb353('0x2e')](_0x262a12['attributes'],function(_0x3b40a4){var _0x245740={};_0x245740[_0x3b40a4]={'$like':'%'+_0x5698c4['query'][_0xb353('0x46')]+'%'};return _0x245740;})});}_0x262a12=_[_0xb353('0x48')]({},_0x262a12,_0x5698c4[_0xb353('0x49')]);return _0x143c11[_0xb353('0x69')](_0x262a12);}})[_0xb353('0x29')](function(_0x26d44f){if(_0x26d44f){_0xdb4501=_0x26d44f[_0xb353('0x41')];if(!_0x5698c4['query'][_0xb353('0x42')](_0xb353('0x67'))){_0x262a12[_0xb353('0x20')]=qs[_0xb353('0x20')](_0x5698c4['query'][_0xb353('0x20')]);_0x262a12[_0xb353('0x1e')]=qs['offset'](_0x5698c4['query'][_0xb353('0x1e')]);}return _0x143c11[_0xb353('0x69')](_0x262a12);}})[_0xb353('0x29')](function(_0x5e9780){if(_0x5e9780){return _0x5e9780?{'count':_0xdb4501,'rows':_0x5e9780}:null;}})[_0xb353('0x29')](respondWithResult(_0x3038b2,null))[_0xb353('0x4c')](handleError(_0x3038b2,null));};exports[_0xb353('0x6b')]=function(_0x1d5726,_0x4d463c,_0x5288ca){var _0x25cc59=_0x1d5726[_0xb353('0x52')][_0xb353('0x6c')];var _0x1a2059=_[_0xb353('0x2e')](_0x25cc59,'id');return db['Team']['findAll']({'where':{'id':_0x1a2059},'attributes':['id'],'include':[{'model':db[_0xb353('0x6d')],'as':'Agents','attributes':['id','name',_0xb353('0x6e'),'voicePause','interface'],'raw':!![]}]})[_0xb353('0x29')](function(_0x5d2de7){if(_0x5d2de7){var _0x497053=_['flatMap'](_0x5d2de7,function(_0x359252){var _0x186d8c=_0x359252['get']({'plain':!![]});_0x186d8c[_0xb353('0x6f')][_0xb353('0x70')](function(_0x112171){_0x112171[_0xb353('0x71')]=_[_0xb353('0x50')](_0x25cc59,{'id':_0x186d8c['id']})['penalty'];});return _0x186d8c[_0xb353('0x6f')];});return db[_0xb353('0x36')]['find']({'where':{'id':_0x1d5726[_0xb353('0x4e')]['id']}})[_0xb353('0x29')](function(_0xcf8e68){return db[_0xb353('0x72')][_0xb353('0x73')](function(_0x564256){return _0xcf8e68[_0xb353('0x6b')](_0x1a2059,{'transaction':_0x564256})['then'](function(){return BPromise['each'](_0x25cc59,function(_0x126716){return db[_0xb353('0x74')][_0xb353('0x75')]({'TeamId':_0x126716['id'],'VoiceQueueId':_0x1d5726[_0xb353('0x4e')]['id'],'penalty':_0x126716['penalty']},{'transaction':_0x564256});});})[_0xb353('0x29')](function(){return BPromise['each'](_0x497053,function(_0x288ffa){return db['UserVoiceQueue'][_0xb353('0x76')]({'where':{'UserId':_0x288ffa['id'],'VoiceQueueId':_0x1d5726['params']['id']},'defaults':{'penalty':_0x288ffa[_0xb353('0x71')]},'transaction':_0x564256});});})['then'](function(){return BPromise['each'](_[_0xb353('0x46')](_0x497053,{'online':!![]}),function(_0x5da9ea){return db[_0xb353('0x77')]['upsert']({'membername':_0x5da9ea['name'],'UserId':_0x5da9ea['id'],'queue_name':_0xcf8e68[_0xb353('0x34')],'VoiceQueueId':_0xcf8e68['id'],'interface':_['isNil'](_0x5da9ea[_0xb353('0x78')])?util[_0xb353('0x79')](_0xb353('0x7a'),_0x5da9ea['name']):_0x5da9ea[_0xb353('0x78')],'paused':_0x5da9ea['voicePause']||![],'penalty':_0x5da9ea['penalty']},{'transaction':_0x564256});});})[_0xb353('0x29')](function(){_0x497053[_0xb353('0x70')](function(_0x25fa25){socket['emit'](_0xb353('0x7b'),{'UserId':_0x25fa25['id'],'VoiceQueueId':_0xcf8e68['id']});});});});});}})[_0xb353('0x29')](respondWithStatusCode(_0x4d463c,null))[_0xb353('0x4c')](handleError(_0x4d463c,null));};exports['removeTeams']=function(_0x15b99b,_0x5bf6f4,_0x57c680){return db['Team'][_0xb353('0x64')]({'where':{'id':_0x15b99b['query'][_0xb353('0x7c')]},'attributes':['id'],'include':[{'model':db[_0xb353('0x6d')],'as':_0xb353('0x6f'),'attributes':['id'],'raw':!![]}]})[_0xb353('0x29')](handleEntityNotFound(_0x5bf6f4,null))[_0xb353('0x29')](function(_0x2d01e9){var _0x277e8f=_[_0xb353('0x2e')](_0x2d01e9,'id');var _0x5523ab=[];var _0x3864c1=[];var _0x3c9561=squel[_0xb353('0x7d')]();_0x3c9561[_0xb353('0x7e')](_0xb353('0x7f'))['from'](_0xb353('0x80'),'tq')[_0xb353('0x81')](_0xb353('0x82'),'ut',_0xb353('0x83'))['where'](_0xb353('0x84'),_0x15b99b[_0xb353('0x4e')]['id']);for(var _0x1fbe89=0x0;_0x1fbe89<_0x2d01e9[_0xb353('0x41')];_0x1fbe89+=0x1){let _0x3bf943=_0x2d01e9[_0x1fbe89];for(var _0x12041c=0x0;_0x12041c<_0x3bf943['Agents']['length'];_0x12041c+=0x1){let _0x557a3f=_0x3bf943[_0xb353('0x6f')][_0x12041c];var _0x5ac116=_0x3c9561[_0xb353('0x5a')]();_0x5ac116[_0xb353('0x45')](_0xb353('0x85'),_0x557a3f['id']);_0x3864c1[_0xb353('0x86')](db[_0xb353('0x72')][_0xb353('0x3c')](_0x5ac116[_0xb353('0x87')](),{'type':db[_0xb353('0x72')][_0xb353('0x88')][_0xb353('0x89')]})[_0xb353('0x29')](function(_0xed1e85){if(_0xed1e85[_0xb353('0x41')]===0x1){return _0x557a3f['id'];}else{var _0x433bf7=_['every'](_[_0xb353('0x2e')](_0xed1e85,_0xb353('0x8a')),function(_0x40ea77){return _['includes'](_0x277e8f,_0x40ea77);});if(_0x433bf7){return _0x557a3f['id'];}}}));}}return BPromise[_0xb353('0x8b')](_0x3864c1)[_0xb353('0x29')](function(_0x5aefa9){_0x5523ab=_(_0x5523ab)['union'](_0x5aefa9)[_0xb353('0x8c')]()[_0xb353('0x2f')]();return db['VoiceQueue'][_0xb353('0x50')]({'where':{'id':_0x15b99b[_0xb353('0x4e')]['id']}})[_0xb353('0x29')](function(_0x65918c){return db['sequelize'][_0xb353('0x73')](function(_0x5b8a33){return _0x65918c[_0xb353('0x8d')](_0x15b99b['query'][_0xb353('0x7c')],{'transaction':_0x5b8a33})[_0xb353('0x29')](function(){if(!_[_0xb353('0x8e')](_0x5523ab)){return _0x65918c[_0xb353('0x8f')](_0x5523ab,{'transaction':_0x5b8a33})['then'](function(){return db[_0xb353('0x77')][_0xb353('0x28')]({'where':{'VoiceQueueId':_0x15b99b[_0xb353('0x4e')]['id'],'UserId':_0x5523ab},'transaction':_0x5b8a33});});}})['then'](function(){_0x5523ab[_0xb353('0x70')](function(_0x5bc38b){socket['emit'](_0xb353('0x90'),{'UserId':_0x5bc38b,'VoiceQueueId':_0x65918c['id']});});});});});});})[_0xb353('0x29')](respondWithStatusCode(_0x5bf6f4,null))[_0xb353('0x4c')](handleError(_0x5bf6f4,null));};exports['addAgents']=function(_0x5af725,_0x21c544,_0x5ad232){var _0x2690a5,_0x45bee5;return db['VoiceQueue']['find']({'where':{'id':_0x5af725['params']['id']}})['then'](handleEntityNotFound(_0x21c544,null))['then'](function(_0x3bc657){if(_0x3bc657){_0x45bee5=_0x3bc657;return _0x3bc657[_0xb353('0x91')](_0x5af725[_0xb353('0x52')][_0xb353('0x7c')],_[_0xb353('0x5b')](_0x5af725['body'],['ids','id'])||{})[_0xb353('0x92')](function(_0x3f5254){for(var _0x3069b5=0x0;_0x3069b5<_0x5af725['body'][_0xb353('0x7c')]['length'];_0x3069b5+=0x1){socket[_0xb353('0x93')]('userVoiceQueue:save',{'UserId':Number(_0x5af725[_0xb353('0x52')][_0xb353('0x7c')][_0x3069b5]),'VoiceQueueId':Number(_0x5af725[_0xb353('0x4e')]['id'])});}return _0x3f5254;});}})[_0xb353('0x29')](function(_0x30e927){_0x2690a5=_0x30e927||[];if(_0x45bee5){return db['User'][_0xb353('0x64')]({'where':{'id':_0x5af725[_0xb353('0x52')][_0xb353('0x7c')]},'attributes':['id',_0xb353('0x34'),_0xb353('0x6e'),_0xb353('0x94'),'interface'],'raw':!![]});}})[_0xb353('0x29')](function(_0x43d4e0){if(!_[_0xb353('0x8e')](_0x43d4e0)){var _0x3f2cdf=[];for(var _0x24cbf1=0x0;_0x24cbf1<_0x43d4e0['length'];_0x24cbf1++){if(_0x43d4e0[_0x24cbf1][_0xb353('0x6e')]){_0x3f2cdf[_0xb353('0x86')](db[_0xb353('0x77')][_0xb353('0x75')]({'membername':_0x43d4e0[_0x24cbf1][_0xb353('0x34')],'UserId':_0x43d4e0[_0x24cbf1]['id'],'queue_name':_0x45bee5[_0xb353('0x34')],'VoiceQueueId':_0x45bee5['id'],'interface':_[_0xb353('0x95')](_0x43d4e0[_0x24cbf1][_0xb353('0x78')])?util[_0xb353('0x79')]('SIP/%s',_0x43d4e0[_0x24cbf1][_0xb353('0x34')]):_0x43d4e0[_0x24cbf1][_0xb353('0x78')],'paused':_0x43d4e0[_0x24cbf1][_0xb353('0x94')]||![],'penalty':_0x5af725[_0xb353('0x52')][_0xb353('0x71')]||0x0}));}}return BPromise['all'](_0x3f2cdf);}})['then'](function(){return _0x2690a5;})[_0xb353('0x29')](respondWithResult(_0x21c544,null))[_0xb353('0x4c')](handleError(_0x21c544,null));};exports[_0xb353('0x8f')]=function(_0x1a5588,_0x11d82f,_0x1dc9bd){return db['VoiceQueue'][_0xb353('0x50')]({'where':{'id':_0x1a5588[_0xb353('0x4e')]['id']}})['then'](handleEntityNotFound(_0x11d82f,null))[_0xb353('0x29')](function(_0x3a0c58){if(_0x3a0c58){return _0x3a0c58[_0xb353('0x8f')](_0x1a5588[_0xb353('0x3c')][_0xb353('0x7c')])[_0xb353('0x29')](function(){if(_[_0xb353('0x96')](_0x1a5588['query'][_0xb353('0x7c')])){for(var _0x4e648a=0x0;_0x4e648a<_0x1a5588[_0xb353('0x3c')]['ids'][_0xb353('0x41')];_0x4e648a+=0x1){socket[_0xb353('0x93')](_0xb353('0x90'),{'UserId':Number(_0x1a5588['query'][_0xb353('0x7c')][_0x4e648a]),'VoiceQueueId':Number(_0x1a5588['params']['id'])});}}else{socket[_0xb353('0x93')](_0xb353('0x90'),{'UserId':Number(_0x1a5588[_0xb353('0x3c')][_0xb353('0x7c')]),'VoiceQueueId':Number(_0x1a5588['params']['id'])});}});}})[_0xb353('0x29')](function(_0x28c5f0){return db['UserVoiceQueueRt'][_0xb353('0x28')]({'where':{'VoiceQueueId':_0x1a5588[_0xb353('0x4e')]['id'],'UserId':_0x1a5588[_0xb353('0x3c')][_0xb353('0x7c')]}})['then'](function(){return _0x28c5f0;});})[_0xb353('0x29')](respondWithStatusCode(_0x11d82f,null))['catch'](handleError(_0x11d82f,null));};exports['getAgents']=function(_0x5eb1d2,_0x25c686,_0x461601){var _0x2fa8ff={};var _0x191770={};var _0x3aba89;var _0x5a4125;return db['VoiceQueue'][_0xb353('0x62')]({'where':{'id':_0x5eb1d2[_0xb353('0x4e')]['id']}})[_0xb353('0x29')](handleEntityNotFound(_0x25c686,null))[_0xb353('0x29')](function(_0x413b27){if(_0x413b27){_0x3aba89=_0x413b27;_0x191770['model']=_[_0xb353('0x3b')](db[_0xb353('0x6d')][_0xb353('0x37')]);_0x191770[_0xb353('0x3c')]=_['keys'](_0x5eb1d2['query']);_0x191770[_0xb353('0x3d')]=_['intersection'](_0x191770[_0xb353('0x3a')],_0x191770[_0xb353('0x3c')]);_0x2fa8ff[_0xb353('0x3f')]=_[_0xb353('0x3e')](_0x191770['model'],qs['fields'](_0x5eb1d2[_0xb353('0x3c')][_0xb353('0x40')]));_0x2fa8ff[_0xb353('0x3f')]=_0x2fa8ff[_0xb353('0x3f')][_0xb353('0x41')]?_0x2fa8ff['attributes']:_0x191770['model'];_0x2fa8ff[_0xb353('0x43')]=qs['sort'](_0x5eb1d2['query'][_0xb353('0x44')]);_0x2fa8ff[_0xb353('0x45')]=qs[_0xb353('0x3d')](_[_0xb353('0x5f')](_0x5eb1d2[_0xb353('0x3c')],_0x191770['filters']));if(_0x5eb1d2[_0xb353('0x3c')][_0xb353('0x46')]){_0x2fa8ff[_0xb353('0x45')]=_[_0xb353('0x48')](_0x2fa8ff[_0xb353('0x45')],{'$or':_[_0xb353('0x2e')](_0x2fa8ff[_0xb353('0x3f')],function(_0x30ac97){var _0x30bdc9={};_0x30bdc9[_0x30ac97]={'$like':'%'+_0x5eb1d2['query']['filter']+'%'};return _0x30bdc9;})});}_0x2fa8ff=_[_0xb353('0x48')]({},_0x2fa8ff,_0x5eb1d2[_0xb353('0x49')]);return _0x3aba89['getAgents'](_0x2fa8ff);}})[_0xb353('0x29')](function(_0x470aef){if(_0x470aef){_0x5a4125=_0x470aef[_0xb353('0x41')];if(!_0x5eb1d2[_0xb353('0x3c')][_0xb353('0x42')](_0xb353('0x67'))){_0x2fa8ff['limit']=qs['limit'](_0x5eb1d2['query'][_0xb353('0x20')]);_0x2fa8ff[_0xb353('0x1e')]=qs[_0xb353('0x1e')](_0x5eb1d2['query']['offset']);}return _0x3aba89[_0xb353('0x97')](_0x2fa8ff);}})[_0xb353('0x29')](function(_0x5c5b51){if(_0x5c5b51){return _0x5c5b51?{'count':_0x5a4125,'rows':_0x5c5b51}:null;}})[_0xb353('0x29')](respondWithResult(_0x25c686,null))['catch'](handleError(_0x25c686,null));};exports[_0xb353('0x98')]=function(_0x2a12d5,_0x4c40fe,_0x1f3147){var _0xd7d5b9={};var _0x12765b={};var _0x21d2ec;var _0x197d0d;return db['VoiceQueue'][_0xb353('0x62')]({'where':{'id':_0x2a12d5[_0xb353('0x4e')]['id']}})[_0xb353('0x29')](handleEntityNotFound(_0x4c40fe,null))[_0xb353('0x29')](function(_0x1a16d9){if(_0x1a16d9){_0x21d2ec=_0x1a16d9;_0x12765b[_0xb353('0x3a')]=_[_0xb353('0x3b')](db['UserVoiceQueueRt'][_0xb353('0x37')]);_0x12765b[_0xb353('0x3c')]=_[_0xb353('0x3b')](_0x2a12d5[_0xb353('0x3c')]);_0x12765b[_0xb353('0x3d')]=_[_0xb353('0x3e')](_0x12765b[_0xb353('0x3a')],_0x12765b[_0xb353('0x3c')]);_0xd7d5b9['attributes']=_[_0xb353('0x3e')](_0x12765b[_0xb353('0x3a')],qs[_0xb353('0x40')](_0x2a12d5[_0xb353('0x3c')]['fields']));_0xd7d5b9['attributes']=_0xd7d5b9[_0xb353('0x3f')][_0xb353('0x41')]?_0xd7d5b9[_0xb353('0x3f')]:_0x12765b['model'];_0xd7d5b9[_0xb353('0x43')]=qs['sort'](_0x2a12d5[_0xb353('0x3c')][_0xb353('0x44')]);_0xd7d5b9[_0xb353('0x45')]=qs[_0xb353('0x3d')](_[_0xb353('0x5f')](_0x2a12d5[_0xb353('0x3c')],_0x12765b['filters']));if(_0x2a12d5[_0xb353('0x3c')][_0xb353('0x46')]){_0xd7d5b9[_0xb353('0x45')]=_[_0xb353('0x48')](_0xd7d5b9['where'],{'$or':_[_0xb353('0x2e')](_0xd7d5b9[_0xb353('0x3f')],function(_0x3adc08){var _0x437cc3={};_0x437cc3[_0x3adc08]={'$like':'%'+_0x2a12d5[_0xb353('0x3c')][_0xb353('0x46')]+'%'};return _0x437cc3;})});}_0xd7d5b9=_[_0xb353('0x48')]({},_0xd7d5b9,_0x2a12d5[_0xb353('0x49')]);return _0x21d2ec[_0xb353('0x98')](_0xd7d5b9);}})[_0xb353('0x29')](function(_0x5b6a4d){if(_0x5b6a4d){_0x197d0d=_0x5b6a4d[_0xb353('0x41')];if(!_0x2a12d5[_0xb353('0x3c')][_0xb353('0x42')]('nolimit')){_0xd7d5b9[_0xb353('0x20')]=qs['limit'](_0x2a12d5[_0xb353('0x3c')][_0xb353('0x20')]);_0xd7d5b9[_0xb353('0x1e')]=qs['offset'](_0x2a12d5[_0xb353('0x3c')][_0xb353('0x1e')]);}return _0x21d2ec['getMembers'](_0xd7d5b9);}})[_0xb353('0x29')](function(_0x363b2e){return _0x363b2e?{'count':_0x197d0d,'rows':_0x363b2e}:null;})['then'](respondWithResult(_0x4c40fe,null))[_0xb353('0x4c')](handleError(_0x4c40fe,null));};exports[_0xb353('0x99')]=function(_0x3cf372,_0x151bf7,_0x39ac2f){var _0x1b76b5={};var _0x395cd7={};var _0x442d41;var _0x33b761;return db[_0xb353('0x36')][_0xb353('0x62')]({'where':{'id':_0x3cf372[_0xb353('0x4e')]['id']}})[_0xb353('0x29')](handleEntityNotFound(_0x151bf7,null))[_0xb353('0x29')](function(_0x212a00){if(_0x212a00){_0x442d41=_0x212a00;_0x395cd7[_0xb353('0x3a')]=_[_0xb353('0x3b')](db['CmList'][_0xb353('0x37')]);_0x395cd7[_0xb353('0x3c')]=_['keys'](_0x3cf372[_0xb353('0x3c')]);_0x395cd7[_0xb353('0x3d')]=_[_0xb353('0x3e')](_0x395cd7[_0xb353('0x3a')],_0x395cd7[_0xb353('0x3c')]);_0x1b76b5['attributes']=_[_0xb353('0x3e')](_0x395cd7['model'],qs['fields'](_0x3cf372['query'][_0xb353('0x40')]));_0x1b76b5[_0xb353('0x3f')]=_0x1b76b5[_0xb353('0x3f')]['length']?_0x1b76b5[_0xb353('0x3f')]:_0x395cd7[_0xb353('0x3a')];_0x1b76b5[_0xb353('0x43')]=qs[_0xb353('0x44')](_0x3cf372['query']['sort']);_0x1b76b5[_0xb353('0x45')]=qs['filters'](_[_0xb353('0x5f')](_0x3cf372[_0xb353('0x3c')],_0x395cd7[_0xb353('0x3d')]));if(_0x3cf372[_0xb353('0x3c')][_0xb353('0x46')]){_0x1b76b5[_0xb353('0x45')]=_[_0xb353('0x48')](_0x1b76b5[_0xb353('0x45')],{'$or':_[_0xb353('0x2e')](_0x1b76b5['attributes'],function(_0x336bbd){var _0x5bb91f={};_0x5bb91f[_0x336bbd]={'$like':'%'+_0x3cf372[_0xb353('0x3c')]['filter']+'%'};return _0x5bb91f;})});}_0x1b76b5=_[_0xb353('0x48')]({},_0x1b76b5,_0x3cf372[_0xb353('0x49')]);return _0x442d41[_0xb353('0x99')](_0x1b76b5);}})[_0xb353('0x29')](function(_0x236f8b){if(_0x236f8b){_0x33b761=_0x236f8b[_0xb353('0x41')];if(!_0x3cf372[_0xb353('0x3c')][_0xb353('0x42')](_0xb353('0x67'))){_0x1b76b5[_0xb353('0x20')]=qs[_0xb353('0x20')](_0x3cf372['query']['limit']);_0x1b76b5[_0xb353('0x1e')]=qs[_0xb353('0x1e')](_0x3cf372[_0xb353('0x3c')]['offset']);}return _0x442d41[_0xb353('0x99')](_0x1b76b5);}})['then'](function(_0x4acd6e){if(_0x4acd6e){return _0x4acd6e?{'count':_0x33b761,'rows':_0x4acd6e}:null;}})['then'](respondWithResult(_0x151bf7,null))[_0xb353('0x4c')](handleError(_0x151bf7,null));};exports[_0xb353('0x9a')]=function(_0x203303,_0x5bab7a,_0x4bfcb8){var _0x4199e5,_0x49880d;return db[_0xb353('0x36')][_0xb353('0x50')]({'where':{'id':_0x203303[_0xb353('0x4e')]['id']}})[_0xb353('0x29')](handleEntityNotFound(_0x5bab7a,null))[_0xb353('0x29')](function(_0x3c9ce9){if(_0x3c9ce9){_0x49880d=_0x3c9ce9;return _0x3c9ce9[_0xb353('0x9a')](_0x203303[_0xb353('0x52')][_0xb353('0x7c')],_[_0xb353('0x5b')](_0x203303[_0xb353('0x52')],[_0xb353('0x7c'),'id'])||{});}return null;})[_0xb353('0x92')](function(_0xd8e4ee){var _0x54116b;_0x4199e5=_0xd8e4ee||[];var _0x472186=[];if(_0xd8e4ee){for(var _0x2ec4ac=0x0;_0x2ec4ac<_0xd8e4ee['length'];_0x2ec4ac+=0x1){var _0x121177=_0xd8e4ee[_0x2ec4ac][_0xb353('0x55')]({'plain':!![]});_0x49880d[_0xb353('0x9b')]=_0x203303[_0xb353('0x52')][_0xb353('0x9b')]?_0x203303[_0xb353('0x52')][_0xb353('0x9b')]:_0x49880d[_0xb353('0x9b')];switch(_0x49880d[_0xb353('0x9b')]){case _0xb353('0x9c'):_0x54116b=squel['insert']()['into'](_0xb353('0x9d'))['fromQuery']([_0xb353('0x9e'),_0xb353('0x9f'),'ContactId',_0xb353('0xa0'),_0xb353('0x60'),_0xb353('0x5c'),_0xb353('0xa1')],squel[_0xb353('0x7d')]()[_0xb353('0x7e')](_0xb353('0x9e'),'phone')[_0xb353('0x7e')]('NOW()',_0xb353('0x9f'))['field']('id',_0xb353('0xa2'))[_0xb353('0x7e')](_0x121177['CmListId'][_0xb353('0x87')](),'ListId')[_0xb353('0x7e')](_0x203303[_0xb353('0x4e')]['id']['toString'](),_0xb353('0x60'))[_0xb353('0x7e')](_0xb353('0xa3'),_0xb353('0x5c'))['field'](_0xb353('0xa3'),'updatedAt')[_0xb353('0xa4')]('cm_contacts')[_0xb353('0x45')](_0xb353('0xa5'))[_0xb353('0x45')](_0xb353('0xa6'),_0x121177[_0xb353('0xa7')][_0xb353('0x87')]())[_0xb353('0x45')](_0xb353('0xa8'))[_0xb353('0x45')](_0xb353('0xa9'),squel[_0xb353('0x7d')]()[_0xb353('0x7e')](_0xb353('0xaa'))[_0xb353('0xa4')]('cm_hopper_final')[_0xb353('0x45')]('VoiceQueueId\x20=\x20?',_0x203303[_0xb353('0x4e')]['id'][_0xb353('0x87')]()))['where'](_0xb353('0xa9'),squel[_0xb353('0x7d')]()[_0xb353('0x7e')](_0xb353('0xab'))[_0xb353('0xa4')](_0xb353('0x9d'))[_0xb353('0x45')](_0xb353('0x84'),_0x203303[_0xb353('0x4e')]['id'][_0xb353('0x87')]())))[_0xb353('0x87')]();break;case _0xb353('0xac'):_0x54116b=squel['insert']()[_0xb353('0xad')](_0xb353('0x9d'))[_0xb353('0xae')]([_0xb353('0x9e'),_0xb353('0x9f'),_0xb353('0xa2'),'ListId',_0xb353('0x60'),'createdAt','updatedAt'],squel[_0xb353('0x7d')]()[_0xb353('0x7e')]('phone','phone')[_0xb353('0x7e')]('NOW()',_0xb353('0x9f'))['field']('id',_0xb353('0xa2'))[_0xb353('0x7e')](_0x121177[_0xb353('0xa7')][_0xb353('0x87')](),_0xb353('0xa0'))[_0xb353('0x7e')](_0x203303['params']['id'][_0xb353('0x87')](),_0xb353('0x60'))[_0xb353('0x7e')]('NOW()',_0xb353('0x5c'))[_0xb353('0x7e')](_0xb353('0xa3'),'updatedAt')[_0xb353('0xa4')](_0xb353('0xaf'))['where'](_0xb353('0xa5'))[_0xb353('0x45')](_0xb353('0xa6'),_0x121177[_0xb353('0xa7')][_0xb353('0x87')]())[_0xb353('0x45')](_0xb353('0xa8'))['where'](_0xb353('0xa9'),squel[_0xb353('0x7d')]()[_0xb353('0x7e')](_0xb353('0xab'))[_0xb353('0xa4')](_0xb353('0x9d'))['where']('VoiceQueueId\x20=\x20?',_0x203303[_0xb353('0x4e')]['id'][_0xb353('0x87')]())))['toString']();break;default:_0x54116b=squel[_0xb353('0xb0')]()['into'](_0xb353('0x9d'))[_0xb353('0xae')]([_0xb353('0x9e'),_0xb353('0x9f'),_0xb353('0xa2'),_0xb353('0xa0'),_0xb353('0x60'),'createdAt',_0xb353('0xa1')],squel[_0xb353('0x7d')]()[_0xb353('0x7e')](_0xb353('0x9e'),'phone')[_0xb353('0x7e')](_0xb353('0xa3'),_0xb353('0x9f'))[_0xb353('0x7e')]('id',_0xb353('0xa2'))[_0xb353('0x7e')](_0x121177[_0xb353('0xa7')][_0xb353('0x87')](),_0xb353('0xa0'))['field'](_0x203303[_0xb353('0x4e')]['id'][_0xb353('0x87')](),_0xb353('0x60'))[_0xb353('0x7e')]('NOW()',_0xb353('0x5c'))['field'](_0xb353('0xa3'),'updatedAt')[_0xb353('0xa4')](_0xb353('0xaf'))['where'](_0xb353('0xa5'))[_0xb353('0x45')](_0xb353('0xa6'),_0x121177[_0xb353('0xa7')][_0xb353('0x87')]())['where'](_0xb353('0xa8')))[_0xb353('0x87')]();}_0x472186[_0xb353('0x86')](db[_0xb353('0x72')]['query'](_0x54116b));}return BPromise['all'](_0x472186);}})[_0xb353('0x29')](function(){return _0x4199e5;})[_0xb353('0x29')](respondWithResult(_0x5bab7a,null))[_0xb353('0x4c')](handleError(_0x5bab7a,null));};exports[_0xb353('0xb1')]=function(_0x3a6fed,_0x84fd78,_0x94cad4){return db[_0xb353('0x36')][_0xb353('0x50')]({'where':{'id':_0x3a6fed[_0xb353('0x4e')]['id']}})[_0xb353('0x29')](handleEntityNotFound(_0x84fd78,null))[_0xb353('0x29')](function(_0x3c26ce){if(_0x3c26ce){return _0x3c26ce[_0xb353('0xb1')](_0x3a6fed[_0xb353('0x3c')][_0xb353('0x7c')]);}})[_0xb353('0x29')](function(_0x38f7b1){if(_0x38f7b1){return db[_0xb353('0x5e')][_0xb353('0x28')]({'where':{'ListId':_0x3a6fed[_0xb353('0x3c')][_0xb353('0x7c')],'VoiceQueueId':_0x3a6fed[_0xb353('0x4e')]['id']}})['then'](function(){return _0x38f7b1;});}})[_0xb353('0x29')](respondWithStatusCode(_0x84fd78,null))[_0xb353('0x4c')](handleError(_0x84fd78,null));};exports[_0xb353('0xb2')]=function(_0x5e99b6,_0x1821c7,_0x534a00){var _0x1d80eb={};var _0xc40528={};var _0x40e77b;var _0x69beb3;return db[_0xb353('0x36')][_0xb353('0x62')]({'where':{'id':_0x5e99b6['params']['id']}})[_0xb353('0x29')](handleEntityNotFound(_0x1821c7,null))[_0xb353('0x29')](function(_0x2d5034){if(_0x2d5034){_0x40e77b=_0x2d5034;_0xc40528[_0xb353('0x3a')]=_['keys'](db['CmList'][_0xb353('0x37')]);_0xc40528[_0xb353('0x3c')]=_[_0xb353('0x3b')](_0x5e99b6[_0xb353('0x3c')]);_0xc40528[_0xb353('0x3d')]=_[_0xb353('0x3e')](_0xc40528['model'],_0xc40528[_0xb353('0x3c')]);_0x1d80eb[_0xb353('0x3f')]=_[_0xb353('0x3e')](_0xc40528[_0xb353('0x3a')],qs[_0xb353('0x40')](_0x5e99b6[_0xb353('0x3c')][_0xb353('0x40')]));_0x1d80eb[_0xb353('0x3f')]=_0x1d80eb[_0xb353('0x3f')]['length']?_0x1d80eb['attributes']:_0xc40528[_0xb353('0x3a')];_0x1d80eb[_0xb353('0x43')]=qs['sort'](_0x5e99b6[_0xb353('0x3c')][_0xb353('0x44')]);_0x1d80eb['where']=qs[_0xb353('0x3d')](_['pick'](_0x5e99b6['query'],_0xc40528[_0xb353('0x3d')]));if(_0x5e99b6[_0xb353('0x3c')][_0xb353('0x46')]){_0x1d80eb['where']=_[_0xb353('0x48')](_0x1d80eb[_0xb353('0x45')],{'$or':_[_0xb353('0x2e')](_0x1d80eb['attributes'],function(_0x2aeaac){var _0x514096={};_0x514096[_0x2aeaac]={'$like':'%'+_0x5e99b6[_0xb353('0x3c')][_0xb353('0x46')]+'%'};return _0x514096;})});}_0x1d80eb=_[_0xb353('0x48')]({},_0x1d80eb,_0x5e99b6[_0xb353('0x49')]);return _0x40e77b[_0xb353('0xb2')](_0x1d80eb);}})[_0xb353('0x29')](function(_0x3c485e){if(_0x3c485e){_0x69beb3=_0x3c485e['length'];if(!_0x5e99b6['query'][_0xb353('0x42')](_0xb353('0x67'))){_0x1d80eb[_0xb353('0x20')]=qs[_0xb353('0x20')](_0x5e99b6[_0xb353('0x3c')][_0xb353('0x20')]);_0x1d80eb[_0xb353('0x1e')]=qs[_0xb353('0x1e')](_0x5e99b6[_0xb353('0x3c')][_0xb353('0x1e')]);}return _0x40e77b[_0xb353('0xb2')](_0x1d80eb);}})[_0xb353('0x29')](function(_0x252efc){if(_0x252efc){return _0x252efc?{'count':_0x69beb3,'rows':_0x252efc}:null;}})['then'](respondWithResult(_0x1821c7,null))[_0xb353('0x4c')](handleError(_0x1821c7,null));};exports['addBlackLists']=function(_0x4d29ea,_0x54a18d,_0x220966){var _0x2aa288,_0x234a58;return db['VoiceQueue'][_0xb353('0x50')]({'where':{'id':_0x4d29ea[_0xb353('0x4e')]['id']}})[_0xb353('0x29')](handleEntityNotFound(_0x54a18d,null))['then'](function(_0x52420e){if(_0x52420e){_0x234a58=_0x52420e;return _0x52420e[_0xb353('0xb3')](_0x4d29ea[_0xb353('0x52')][_0xb353('0x7c')],_[_0xb353('0x5b')](_0x4d29ea[_0xb353('0x52')],[_0xb353('0x7c'),'id'])||{});}return null;})[_0xb353('0x92')](function(_0x205cc2){var _0x1596b4;_0x2aa288=_0x205cc2||[];var _0x5c88f4=[];if(_0x205cc2){for(var _0x5344ae=0x0;_0x5344ae<_0x205cc2[_0xb353('0x41')];_0x5344ae+=0x1){var _0x4bdc47=_0x205cc2[_0x5344ae][_0xb353('0x55')]({'plain':!![]});_0x1596b4=squel[_0xb353('0xb0')]()[_0xb353('0xad')](_0xb353('0xb4'))[_0xb353('0xae')]([_0xb353('0x9e'),_0xb353('0xa2'),_0xb353('0xa0'),_0xb353('0x60'),_0xb353('0x5c'),_0xb353('0xa1')],squel[_0xb353('0x7d')]()[_0xb353('0x7e')](_0xb353('0x9e'),_0xb353('0x9e'))['field']('id',_0xb353('0xa2'))['field'](_0x4bdc47[_0xb353('0xa7')][_0xb353('0x87')](),_0xb353('0xa0'))[_0xb353('0x7e')](_0x4d29ea[_0xb353('0x4e')]['id'][_0xb353('0x87')](),_0xb353('0x60'))[_0xb353('0x7e')](_0xb353('0xa3'),_0xb353('0x5c'))['field'](_0xb353('0xa3'),_0xb353('0xa1'))[_0xb353('0xa4')](_0xb353('0xaf'))[_0xb353('0x45')](_0xb353('0xa5'))[_0xb353('0x45')](_0xb353('0xa6'),_0x4bdc47[_0xb353('0xa7')][_0xb353('0x87')]())[_0xb353('0x45')](_0xb353('0xa8')))['toString']();_0x5c88f4[_0xb353('0x86')](db[_0xb353('0x72')]['query'](_0x1596b4));}return BPromise[_0xb353('0x8b')](_0x5c88f4);}})[_0xb353('0x29')](function(){return _0x2aa288;})[_0xb353('0x29')](respondWithResult(_0x54a18d,null))[_0xb353('0x4c')](handleError(_0x54a18d,null));};exports[_0xb353('0xb5')]=function(_0xd2f245,_0x2f0c5c,_0x524b01){return db[_0xb353('0x36')][_0xb353('0x50')]({'where':{'id':_0xd2f245['params']['id']}})['then'](handleEntityNotFound(_0x2f0c5c,null))[_0xb353('0x29')](function(_0x2bf69b){if(_0x2bf69b){return _0x2bf69b[_0xb353('0xb5')](_0xd2f245[_0xb353('0x3c')][_0xb353('0x7c')]);}})[_0xb353('0x29')](function(_0x5949f0){if(_0x5949f0){return db[_0xb353('0x68')]['destroy']({'where':{'ListId':_0xd2f245[_0xb353('0x3c')][_0xb353('0x7c')],'VoiceQueueId':_0xd2f245[_0xb353('0x4e')]['id']}})['then'](function(){return _0x5949f0;});}})[_0xb353('0x29')](respondWithStatusCode(_0x2f0c5c,null))[_0xb353('0x4c')](handleError(_0x2f0c5c,null));}; \ No newline at end of file +var _0x2e26=['ids','User','select','field','tq.TeamId','from','team_has_voice_queues','join','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','union','compact','removeTeams','isEmpty','addAgents','isNil','format','SIP/%s','removeAgents','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','insert','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(?)','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','onlyIfOpen','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','status','end','json','undefined','limit','count','Content-Range','apply','update','destroy','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','name','UserProfileResource','sendStatus','error','stack','send','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','where','merge','VIRTUAL','findAll','catch','show','params','include','body','user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','options','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','findOne','CmHopper','sort','pick','VoiceQueueId','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','Agents','online','voicePause','interface','flatMap','penalty','sequelize','transaction','TeamVoiceQueue','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','emit'];(function(_0x2397a7,_0x39bfe2){var _0x5e87b9=function(_0x4f8dbb){while(--_0x4f8dbb){_0x2397a7['push'](_0x2397a7['shift']());}};_0x5e87b9(++_0x39bfe2);}(_0x2e26,0x1b2));var _0x62e2=function(_0x395be8,_0x285479){_0x395be8=_0x395be8-0x0;var _0x5ceb20=_0x2e26[_0x395be8];return _0x5ceb20;};'use strict';var emlformat=require(_0x62e2('0x0'));var rimraf=require(_0x62e2('0x1'));var zipdir=require(_0x62e2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x62e2('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x62e2('0x4'));var path=require(_0x62e2('0x5'));var sox=require(_0x62e2('0x6'));var csv=require(_0x62e2('0x7'));var ejs=require(_0x62e2('0x8'));var fs=require('fs');var fs_extra=require(_0x62e2('0x9'));var _=require(_0x62e2('0xa'));var squel=require('squel');var crypto=require(_0x62e2('0xb'));var jsforce=require(_0x62e2('0xc'));var deskjs=require(_0x62e2('0xd'));var toCsv=require(_0x62e2('0x7'));var querystring=require(_0x62e2('0xe'));var Papa=require(_0x62e2('0xf'));var Redis=require(_0x62e2('0x10'));var authService=require(_0x62e2('0x11'));var qs=require(_0x62e2('0x12'));var as=require(_0x62e2('0x13'));var hardwareService=require(_0x62e2('0x14'));var logger=require(_0x62e2('0x15'))(_0x62e2('0x16'));var utils=require('../../config/utils');var config=require(_0x62e2('0x17'));var licenseUtil=require(_0x62e2('0x18'));var db=require('../../mysqldb')['db'];config[_0x62e2('0x19')]=_[_0x62e2('0x1a')](config[_0x62e2('0x19')],{'host':_0x62e2('0x1b'),'port':0x18eb});var socket=require(_0x62e2('0x1c'))(new Redis(config[_0x62e2('0x19')]));require('./voiceQueue.socket')[_0x62e2('0x1d')](socket);function respondWithStatusCode(_0x4a1446,_0x4175dd){_0x4175dd=_0x4175dd||0xcc;return function(_0x5abcc4){if(_0x5abcc4){return _0x4a1446['sendStatus'](_0x4175dd);}return _0x4a1446[_0x62e2('0x1e')](_0x4175dd)[_0x62e2('0x1f')]();};}function respondWithResult(_0x459c8f,_0x2e0d2f){_0x2e0d2f=_0x2e0d2f||0xc8;return function(_0x5a991a){if(_0x5a991a){return _0x459c8f[_0x62e2('0x1e')](_0x2e0d2f)[_0x62e2('0x20')](_0x5a991a);}};}function respondWithFilteredResult(_0x4e0c22,_0x24e0f0){return function(_0x405e9e){if(_0x405e9e){var _0x358a8c=typeof _0x24e0f0['offset']===_0x62e2('0x21')&&typeof _0x24e0f0[_0x62e2('0x22')]===_0x62e2('0x21');var _0x163d33=_0x405e9e[_0x62e2('0x23')];var _0x1bd829=_0x358a8c?0x0:_0x24e0f0['offset'];var _0x33d682=_0x358a8c?_0x405e9e[_0x62e2('0x23')]:_0x24e0f0['offset']+_0x24e0f0[_0x62e2('0x22')];var _0x5402d1;if(_0x33d682>=_0x163d33){_0x33d682=_0x163d33;_0x5402d1=0xc8;}else{_0x5402d1=0xce;}_0x4e0c22[_0x62e2('0x1e')](_0x5402d1);return _0x4e0c22['set'](_0x62e2('0x24'),_0x1bd829+'-'+_0x33d682+'/'+_0x163d33)[_0x62e2('0x20')](_0x405e9e);}return null;};}function patchUpdates(_0x32ab39){return function(_0x124702){try{jsonpatch[_0x62e2('0x25')](_0x124702,_0x32ab39,!![]);}catch(_0xc0af00){return BPromise['reject'](_0xc0af00);}return _0x124702['save']();};}function saveUpdates(_0x3e2f66,_0x4803da){return function(_0x334eab){if(_0x334eab){return _0x334eab[_0x62e2('0x26')](_0x3e2f66)['then'](function(_0x495bca){return _0x495bca;});}return null;};}function removeEntity(_0x4833e0,_0x34a493){return function(_0x2384f0){if(_0x2384f0){return _0x2384f0[_0x62e2('0x27')]()[_0x62e2('0x28')](function(){var _0x3b06c0=_0x2384f0[_0x62e2('0x29')]({'plain':!![]});var _0x278ea0=[{'name':_0x62e2('0x2a'),'value':_0x62e2('0x2b'),'ignore':![]},{'name':_0x62e2('0x2c'),'value':_0x62e2('0x2d'),'ignore':![]}];var _0x58ea3d=_(_0x278ea0)[_0x62e2('0x2e')](_0x62e2('0x2f'))[_0x62e2('0x30')](_0x62e2('0x31'))[_0x62e2('0x31')]();if(_[_0x62e2('0x32')](_0x58ea3d,_0x3b06c0[_0x62e2('0x33')])){return;}var _0x2a3860=_[_0x62e2('0x34')](_0x278ea0,['value',_0x3b06c0[_0x62e2('0x33')]])[_0x62e2('0x35')];return db[_0x62e2('0x36')][_0x62e2('0x27')]({'where':{'type':_0x2a3860,'resourceId':_0x3b06c0['id']}})[_0x62e2('0x28')](function(){return _0x2384f0;});})[_0x62e2('0x28')](function(){_0x4833e0[_0x62e2('0x1e')](0xcc)[_0x62e2('0x1f')]();});}};}function handleEntityNotFound(_0x25ce98,_0x7c12f1){return function(_0xc45c5e){if(!_0xc45c5e){_0x25ce98[_0x62e2('0x37')](0x194);}return _0xc45c5e;};}function handleError(_0x315751,_0x304c3f){_0x304c3f=_0x304c3f||0x1f4;return function(_0x501f7e){logger[_0x62e2('0x38')](_0x501f7e[_0x62e2('0x39')]);if(_0x501f7e['name']){delete _0x501f7e[_0x62e2('0x35')];}_0x315751['status'](_0x304c3f)[_0x62e2('0x3a')](_0x501f7e);};}exports['index']=function(_0x22dc24,_0x378646){var _0x40103e={},_0x150e56={},_0x4281bb={'count':0x0,'rows':[]};var _0x582da1=_['map'](db[_0x62e2('0x3b')][_0x62e2('0x3c')],function(_0x4d70d7){return{'name':_0x4d70d7[_0x62e2('0x3d')],'type':_0x4d70d7[_0x62e2('0x33')][_0x62e2('0x3e')]};});_0x150e56[_0x62e2('0x3f')]=_[_0x62e2('0x30')](_0x582da1,'name');_0x150e56[_0x62e2('0x40')]=_[_0x62e2('0x41')](_0x22dc24[_0x62e2('0x40')]);_0x150e56[_0x62e2('0x42')]=_['intersection'](_0x150e56[_0x62e2('0x3f')],_0x150e56['query']);_0x40103e[_0x62e2('0x43')]=_[_0x62e2('0x44')](_0x150e56['model'],qs[_0x62e2('0x45')](_0x22dc24[_0x62e2('0x40')][_0x62e2('0x45')]));_0x40103e[_0x62e2('0x43')]=_0x40103e['attributes'][_0x62e2('0x46')]?_0x40103e[_0x62e2('0x43')]:_0x150e56['model'];if(!_0x22dc24[_0x62e2('0x40')][_0x62e2('0x47')](_0x62e2('0x48'))){_0x40103e['limit']=qs[_0x62e2('0x22')](_0x22dc24[_0x62e2('0x40')][_0x62e2('0x22')]);_0x40103e['offset']=qs[_0x62e2('0x49')](_0x22dc24['query'][_0x62e2('0x49')]);}_0x40103e[_0x62e2('0x4a')]=qs['sort'](_0x22dc24[_0x62e2('0x40')]['sort']);_0x40103e[_0x62e2('0x4b')]=qs[_0x62e2('0x42')](_['pick'](_0x22dc24['query'],_0x150e56[_0x62e2('0x42')]),_0x582da1);if(_0x22dc24[_0x62e2('0x40')][_0x62e2('0x2e')]){_0x40103e[_0x62e2('0x4b')]=_[_0x62e2('0x4c')](_0x40103e[_0x62e2('0x4b')],{'$or':_['map'](_0x582da1,function(_0x266361){if(_0x266361['type']!==_0x62e2('0x4d')){var _0x59b53a={};_0x59b53a[_0x266361[_0x62e2('0x35')]]={'$like':'%'+_0x22dc24[_0x62e2('0x40')][_0x62e2('0x2e')]+'%'};return _0x59b53a;}})});}_0x40103e=_[_0x62e2('0x4c')]({},_0x40103e,_0x22dc24['options']);var _0x2befc0={'where':_0x40103e[_0x62e2('0x4b')]};return db['VoiceQueue'][_0x62e2('0x23')](_0x2befc0)[_0x62e2('0x28')](function(_0x2e6cc7){_0x4281bb[_0x62e2('0x23')]=_0x2e6cc7;if(_0x22dc24[_0x62e2('0x40')]['includeAll']){_0x40103e['include']=[{'all':!![]}];}return db[_0x62e2('0x3b')][_0x62e2('0x4e')](_0x40103e);})[_0x62e2('0x28')](function(_0x16b3e5){_0x4281bb['rows']=_0x16b3e5;return _0x4281bb;})['then'](respondWithFilteredResult(_0x378646,_0x40103e))[_0x62e2('0x4f')](handleError(_0x378646,null));};exports[_0x62e2('0x50')]=function(_0x4775e9,_0x5093d7){var _0x24be6f={'raw':![],'where':{'id':_0x4775e9[_0x62e2('0x51')]['id']}},_0x1e61ad={};_0x1e61ad[_0x62e2('0x3f')]=_['keys'](db[_0x62e2('0x3b')]['rawAttributes']);_0x1e61ad['query']=_[_0x62e2('0x41')](_0x4775e9[_0x62e2('0x40')]);_0x1e61ad[_0x62e2('0x42')]=_[_0x62e2('0x44')](_0x1e61ad[_0x62e2('0x3f')],_0x1e61ad['query']);_0x24be6f[_0x62e2('0x43')]=_[_0x62e2('0x44')](_0x1e61ad[_0x62e2('0x3f')],qs[_0x62e2('0x45')](_0x4775e9[_0x62e2('0x40')][_0x62e2('0x45')]));_0x24be6f[_0x62e2('0x43')]=_0x24be6f[_0x62e2('0x43')][_0x62e2('0x46')]?_0x24be6f['attributes']:_0x1e61ad[_0x62e2('0x3f')];if(_0x4775e9['query']['includeAll']){_0x24be6f[_0x62e2('0x52')]=[{'all':!![]}];}_0x24be6f=_[_0x62e2('0x4c')]({},_0x24be6f,_0x4775e9['options']);return db[_0x62e2('0x3b')][_0x62e2('0x34')](_0x24be6f)[_0x62e2('0x28')](handleEntityNotFound(_0x5093d7,null))[_0x62e2('0x28')](respondWithResult(_0x5093d7,null))[_0x62e2('0x4f')](handleError(_0x5093d7,null));};exports['create']=function(_0x28ec1d,_0x578b1e){return db['VoiceQueue']['create'](_0x28ec1d[_0x62e2('0x53')],{})[_0x62e2('0x28')](function(_0x201481){var _0x2e49af=_0x28ec1d[_0x62e2('0x54')][_0x62e2('0x29')]({'plain':!![]});if(!_0x2e49af)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e49af[_0x62e2('0x55')]===_0x62e2('0x54')){var _0x3fabc1=_0x201481[_0x62e2('0x29')]({'plain':!![]});var _0x4a196f=[{'name':_0x62e2('0x2a'),'value':_0x62e2('0x2b')},{'name':_0x62e2('0x2c'),'value':_0x62e2('0x2d')}];var _0x4983f9=_[_0x62e2('0x34')](_0x4a196f,[_0x62e2('0x31'),_0x3fabc1[_0x62e2('0x33')]])[_0x62e2('0x35')];return db[_0x62e2('0x56')][_0x62e2('0x34')]({'where':{'name':_0x4983f9,'userProfileId':_0x2e49af[_0x62e2('0x57')]},'raw':!![]})[_0x62e2('0x28')](function(_0x58876f){if(_0x58876f&&_0x58876f[_0x62e2('0x58')]===0x0){return db[_0x62e2('0x36')][_0x62e2('0x59')]({'name':_0x3fabc1[_0x62e2('0x35')],'resourceId':_0x3fabc1['id'],'type':_0x58876f[_0x62e2('0x35')],'sectionId':_0x58876f['id']},{})['then'](function(){return _0x201481;});}else{return _0x201481;}})[_0x62e2('0x4f')](function(_0x38d983){logger[_0x62e2('0x38')](_0x62e2('0x5a'),_0x38d983);throw _0x38d983;});}return _0x201481;})[_0x62e2('0x28')](respondWithResult(_0x578b1e,0xc9))['catch'](handleError(_0x578b1e,null));};exports[_0x62e2('0x5b')]=function(_0x2e7d01,_0x5163a1){var _0x4537a0={'where':{'id':_0x2e7d01['params']['id']}},_0x197712={};_0x197712[_0x62e2('0x3f')]=_[_0x62e2('0x41')](db[_0x62e2('0x3b')][_0x62e2('0x3c')]);_0x4537a0[_0x62e2('0x43')]=_['intersection'](_0x197712[_0x62e2('0x3f')],qs[_0x62e2('0x45')](_0x2e7d01['query']['fields']));_0x4537a0[_0x62e2('0x43')]=_0x4537a0[_0x62e2('0x43')]['length']?_0x4537a0[_0x62e2('0x43')]:_0x197712[_0x62e2('0x3f')];if(_0x2e7d01[_0x62e2('0x40')][_0x62e2('0x5c')]){_0x4537a0[_0x62e2('0x52')]=[{'all':!![]}];}_0x4537a0=_[_0x62e2('0x4c')]({},_0x4537a0,_0x2e7d01[_0x62e2('0x5d')]);return db[_0x62e2('0x3b')][_0x62e2('0x34')](_0x4537a0)[_0x62e2('0x28')](handleEntityNotFound(_0x5163a1,null))[_0x62e2('0x28')](function(_0x4be2cd){if(_0x4be2cd){var _0x63844e=_0x4be2cd['get']({'plain':!![]});_0x63844e=qs[_0x62e2('0x5e')](_0x63844e,['id',_0x62e2('0x5f'),_0x62e2('0x60')]);_0x2e7d01['body']=_['omit'](_0x2e7d01[_0x62e2('0x53')],['id',_0x62e2('0x5f'),_0x62e2('0x60')]);return db[_0x62e2('0x3b')][_0x62e2('0x59')](_['merge'](_0x63844e,_0x2e7d01[_0x62e2('0x53')]),{'include':_0x2e7d01['query'][_0x62e2('0x5c')]?[{'all':!![]}]:undefined})[_0x62e2('0x28')](function(_0x1e395b){var _0x44e6eb=_0x2e7d01[_0x62e2('0x54')]['get']({'plain':!![]});if(!_0x44e6eb)throw new Error(_0x62e2('0x61'));if(_0x44e6eb[_0x62e2('0x55')]===_0x62e2('0x54')){var _0x537726=_0x1e395b[_0x62e2('0x29')]({'plain':!![]});var _0x18e43a=[{'name':_0x62e2('0x2a'),'value':'inbound'},{'name':_0x62e2('0x2c'),'value':_0x62e2('0x2d')}];var _0x53d852=_[_0x62e2('0x34')](_0x18e43a,[_0x62e2('0x31'),_0x537726[_0x62e2('0x33')]])[_0x62e2('0x35')];return db[_0x62e2('0x56')][_0x62e2('0x34')]({'where':{'name':_0x53d852,'userProfileId':_0x44e6eb['userProfileId']},'raw':!![]})[_0x62e2('0x28')](function(_0x413fe9){if(_0x413fe9&&_0x413fe9[_0x62e2('0x58')]===0x0){return db[_0x62e2('0x36')][_0x62e2('0x59')]({'name':_0x537726['name'],'resourceId':_0x537726['id'],'type':_0x413fe9[_0x62e2('0x35')],'sectionId':_0x413fe9['id']},{})['then'](function(){return _0x1e395b;});}else{return _0x1e395b;}})[_0x62e2('0x4f')](function(_0xaaf705){logger['error'](_0x62e2('0x5a'),_0xaaf705);throw _0xaaf705;});}return _0x1e395b;});}})[_0x62e2('0x28')](respondWithResult(_0x5163a1,0xc9))[_0x62e2('0x4f')](handleError(_0x5163a1,null));};exports[_0x62e2('0x26')]=function(_0x3ae6e5,_0x5cb233){if(_0x3ae6e5['body']['id']){delete _0x3ae6e5[_0x62e2('0x53')]['id'];}return db['VoiceQueue'][_0x62e2('0x34')]({'where':{'id':_0x3ae6e5[_0x62e2('0x51')]['id']}})[_0x62e2('0x28')](handleEntityNotFound(_0x5cb233,null))[_0x62e2('0x28')](saveUpdates(_0x3ae6e5['body'],null))[_0x62e2('0x28')](respondWithResult(_0x5cb233,null))[_0x62e2('0x4f')](handleError(_0x5cb233,null));};exports['destroy']=function(_0x5ebcbf,_0x286ed5){return db[_0x62e2('0x3b')][_0x62e2('0x34')]({'where':{'id':_0x5ebcbf['params']['id']}})[_0x62e2('0x28')](handleEntityNotFound(_0x286ed5,null))[_0x62e2('0x28')](removeEntity(_0x286ed5,null))[_0x62e2('0x4f')](handleError(_0x286ed5,null));};exports[_0x62e2('0x62')]=function(_0x398dbf,_0x6bedc8,_0x3d4009){var _0x195908={'raw':![],'where':{}};var _0x3c8bd7={};var _0x20e5d8={'count':0x0,'rows':[]};return db[_0x62e2('0x3b')][_0x62e2('0x63')]({'where':{'id':_0x398dbf[_0x62e2('0x51')]['id']}})[_0x62e2('0x28')](handleEntityNotFound(_0x6bedc8,null))[_0x62e2('0x28')](function(_0x4d4ddf){if(_0x4d4ddf){_0x3c8bd7[_0x62e2('0x3f')]=_[_0x62e2('0x41')](db[_0x62e2('0x64')][_0x62e2('0x3c')]);_0x3c8bd7['query']=_[_0x62e2('0x41')](_0x398dbf[_0x62e2('0x40')]);_0x3c8bd7[_0x62e2('0x42')]=_['intersection'](_0x3c8bd7[_0x62e2('0x3f')],_0x3c8bd7[_0x62e2('0x40')]);_0x195908[_0x62e2('0x43')]=_[_0x62e2('0x44')](_0x3c8bd7[_0x62e2('0x3f')],qs[_0x62e2('0x45')](_0x398dbf['query']['fields']));_0x195908[_0x62e2('0x43')]=_0x195908[_0x62e2('0x43')][_0x62e2('0x46')]?_0x195908[_0x62e2('0x43')]:_0x3c8bd7[_0x62e2('0x3f')];if(!_0x398dbf[_0x62e2('0x40')]['hasOwnProperty'](_0x62e2('0x48'))){_0x195908[_0x62e2('0x22')]=qs['limit'](_0x398dbf[_0x62e2('0x40')]['limit']);_0x195908['offset']=qs[_0x62e2('0x49')](_0x398dbf['query'][_0x62e2('0x49')]);}_0x195908[_0x62e2('0x4a')]=qs[_0x62e2('0x65')](_0x398dbf[_0x62e2('0x40')][_0x62e2('0x65')]);_0x195908[_0x62e2('0x4b')]=qs[_0x62e2('0x42')](_[_0x62e2('0x66')](_0x398dbf[_0x62e2('0x40')],_0x3c8bd7[_0x62e2('0x42')]));_0x195908[_0x62e2('0x4b')][_0x62e2('0x67')]=_0x4d4ddf['id'];if(_0x398dbf[_0x62e2('0x40')][_0x62e2('0x2e')]){_0x195908[_0x62e2('0x4b')]=_[_0x62e2('0x4c')](_0x195908[_0x62e2('0x4b')],{'$or':_[_0x62e2('0x30')](_0x195908[_0x62e2('0x43')],function(_0x1522f2){var _0x4978a0={};_0x4978a0[_0x1522f2]={'$like':'%'+_0x398dbf[_0x62e2('0x40')][_0x62e2('0x2e')]+'%'};return _0x4978a0;})});}_0x195908=_[_0x62e2('0x4c')]({},_0x195908,_0x398dbf[_0x62e2('0x5d')]);return db['CmHopper'][_0x62e2('0x23')]({'where':_0x195908[_0x62e2('0x4b')]})[_0x62e2('0x28')](function(_0x515b6){_0x20e5d8['count']=_0x515b6;if(_0x398dbf[_0x62e2('0x40')][_0x62e2('0x5c')]){_0x195908[_0x62e2('0x52')]=[{'all':!![]}];}return db[_0x62e2('0x64')]['findAll'](_0x195908);})['then'](function(_0x3905fb){_0x20e5d8[_0x62e2('0x68')]=_0x3905fb;return _0x20e5d8;});}})[_0x62e2('0x28')](respondWithFilteredResult(_0x6bedc8,_0x195908))[_0x62e2('0x4f')](handleError(_0x6bedc8,null));};exports[_0x62e2('0x69')]=function(_0x248547,_0x586d8c,_0x96b21e){var _0x4e495e={'raw':!![],'where':{}};var _0x53b1f5={};var _0x3ce9f0={'count':0x0,'rows':[]};return db[_0x62e2('0x3b')]['findOne']({'where':{'id':_0x248547[_0x62e2('0x51')]['id']}})[_0x62e2('0x28')](handleEntityNotFound(_0x586d8c,null))[_0x62e2('0x28')](function(_0x452ed9){if(_0x452ed9){_0x53b1f5[_0x62e2('0x3f')]=_[_0x62e2('0x41')](db[_0x62e2('0x6a')]['rawAttributes']);_0x53b1f5[_0x62e2('0x40')]=_[_0x62e2('0x41')](_0x248547[_0x62e2('0x40')]);_0x53b1f5[_0x62e2('0x42')]=_[_0x62e2('0x44')](_0x53b1f5[_0x62e2('0x3f')],_0x53b1f5[_0x62e2('0x40')]);_0x4e495e[_0x62e2('0x43')]=_[_0x62e2('0x44')](_0x53b1f5[_0x62e2('0x3f')],qs[_0x62e2('0x45')](_0x248547[_0x62e2('0x40')][_0x62e2('0x45')]));_0x4e495e['attributes']=_0x4e495e['attributes']['length']?_0x4e495e[_0x62e2('0x43')]:_0x53b1f5[_0x62e2('0x3f')];if(!_0x248547['query'][_0x62e2('0x47')](_0x62e2('0x48'))){_0x4e495e[_0x62e2('0x22')]=qs['limit'](_0x248547[_0x62e2('0x40')][_0x62e2('0x22')]);_0x4e495e[_0x62e2('0x49')]=qs[_0x62e2('0x49')](_0x248547['query'][_0x62e2('0x49')]);}_0x4e495e[_0x62e2('0x4a')]=qs[_0x62e2('0x65')](_0x248547['query']['sort']);_0x4e495e['where']=qs['filters'](_[_0x62e2('0x66')](_0x248547[_0x62e2('0x40')],_0x53b1f5['filters']));_0x4e495e[_0x62e2('0x4b')][_0x62e2('0x67')]=_0x452ed9['id'];if(_0x248547[_0x62e2('0x40')]['filter']){_0x4e495e[_0x62e2('0x4b')]=_[_0x62e2('0x4c')](_0x4e495e['where'],{'$or':_['map'](_0x4e495e[_0x62e2('0x43')],function(_0x2e4d1c){var _0x9d5f25={};_0x9d5f25[_0x2e4d1c]={'$like':'%'+_0x248547[_0x62e2('0x40')][_0x62e2('0x2e')]+'%'};return _0x9d5f25;})});}_0x4e495e=_[_0x62e2('0x4c')]({},_0x4e495e,_0x248547[_0x62e2('0x5d')]);return db['CmHopperHistory'][_0x62e2('0x23')]({'where':_0x4e495e['where']})[_0x62e2('0x28')](function(_0xb934a4){_0x3ce9f0[_0x62e2('0x23')]=_0xb934a4;if(_0x248547[_0x62e2('0x40')]['includeAll']){_0x4e495e[_0x62e2('0x52')]=[{'all':!![]}];}return db[_0x62e2('0x6a')][_0x62e2('0x4e')](_0x4e495e);})[_0x62e2('0x28')](function(_0x20e710){_0x3ce9f0[_0x62e2('0x68')]=_0x20e710;return _0x3ce9f0;});}})[_0x62e2('0x28')](respondWithFilteredResult(_0x586d8c,_0x4e495e))[_0x62e2('0x4f')](handleError(_0x586d8c,null));};exports[_0x62e2('0x6b')]=function(_0x427727,_0x14d219,_0x4a5bc3){var _0x2cadc2={'raw':!![],'where':{}};var _0xe8e311={};var _0x14bf2e={'count':0x0,'rows':[]};return db[_0x62e2('0x3b')][_0x62e2('0x63')]({'where':{'id':_0x427727[_0x62e2('0x51')]['id']}})['then'](handleEntityNotFound(_0x14d219,null))[_0x62e2('0x28')](function(_0x26b9d0){if(_0x26b9d0){_0xe8e311[_0x62e2('0x3f')]=_[_0x62e2('0x41')](db[_0x62e2('0x6c')][_0x62e2('0x3c')]);_0xe8e311[_0x62e2('0x40')]=_[_0x62e2('0x41')](_0x427727[_0x62e2('0x40')]);_0xe8e311['filters']=_[_0x62e2('0x44')](_0xe8e311[_0x62e2('0x3f')],_0xe8e311[_0x62e2('0x40')]);_0x2cadc2[_0x62e2('0x43')]=_[_0x62e2('0x44')](_0xe8e311[_0x62e2('0x3f')],qs[_0x62e2('0x45')](_0x427727[_0x62e2('0x40')][_0x62e2('0x45')]));_0x2cadc2[_0x62e2('0x43')]=_0x2cadc2[_0x62e2('0x43')]['length']?_0x2cadc2[_0x62e2('0x43')]:_0xe8e311[_0x62e2('0x3f')];if(!_0x427727[_0x62e2('0x40')][_0x62e2('0x47')](_0x62e2('0x48'))){_0x2cadc2[_0x62e2('0x22')]=qs[_0x62e2('0x22')](_0x427727[_0x62e2('0x40')]['limit']);_0x2cadc2[_0x62e2('0x49')]=qs[_0x62e2('0x49')](_0x427727[_0x62e2('0x40')][_0x62e2('0x49')]);}_0x2cadc2['order']=qs[_0x62e2('0x65')](_0x427727[_0x62e2('0x40')][_0x62e2('0x65')]);_0x2cadc2[_0x62e2('0x4b')]=qs[_0x62e2('0x42')](_['pick'](_0x427727[_0x62e2('0x40')],_0xe8e311[_0x62e2('0x42')]));_0x2cadc2[_0x62e2('0x4b')][_0x62e2('0x67')]=_0x26b9d0['id'];if(_0x427727[_0x62e2('0x40')]['filter']){_0x2cadc2[_0x62e2('0x4b')]=_[_0x62e2('0x4c')](_0x2cadc2[_0x62e2('0x4b')],{'$or':_[_0x62e2('0x30')](_0x2cadc2[_0x62e2('0x43')],function(_0x5d41c4){var _0x3e3d21={};_0x3e3d21[_0x5d41c4]={'$like':'%'+_0x427727['query']['filter']+'%'};return _0x3e3d21;})});}_0x2cadc2=_[_0x62e2('0x4c')]({},_0x2cadc2,_0x427727[_0x62e2('0x5d')]);return db[_0x62e2('0x6c')]['count']({'where':_0x2cadc2[_0x62e2('0x4b')]})[_0x62e2('0x28')](function(_0x48e6e5){_0x14bf2e[_0x62e2('0x23')]=_0x48e6e5;if(_0x427727[_0x62e2('0x40')][_0x62e2('0x5c')]){_0x2cadc2['include']=[{'all':!![]}];}return db[_0x62e2('0x6c')][_0x62e2('0x4e')](_0x2cadc2);})[_0x62e2('0x28')](function(_0x247928){_0x14bf2e[_0x62e2('0x68')]=_0x247928;return _0x14bf2e;});}})[_0x62e2('0x28')](respondWithFilteredResult(_0x14d219,_0x2cadc2))[_0x62e2('0x4f')](handleError(_0x14d219,null));};exports[_0x62e2('0x6d')]=function(_0x214506,_0x51f2e5,_0x355d15){var _0x475efd={'raw':!![],'where':{}};var _0x365841={};var _0x41592f={'count':0x0,'rows':[]};return db[_0x62e2('0x3b')]['findOne']({'where':{'id':_0x214506[_0x62e2('0x51')]['id']}})[_0x62e2('0x28')](handleEntityNotFound(_0x51f2e5,null))[_0x62e2('0x28')](function(_0x42ac9d){if(_0x42ac9d){_0x365841[_0x62e2('0x3f')]=_[_0x62e2('0x41')](db[_0x62e2('0x6e')][_0x62e2('0x3c')]);_0x365841[_0x62e2('0x40')]=_[_0x62e2('0x41')](_0x214506[_0x62e2('0x40')]);_0x365841[_0x62e2('0x42')]=_[_0x62e2('0x44')](_0x365841[_0x62e2('0x3f')],_0x365841['query']);_0x475efd['attributes']=_[_0x62e2('0x44')](_0x365841['model'],qs['fields'](_0x214506[_0x62e2('0x40')][_0x62e2('0x45')]));_0x475efd[_0x62e2('0x43')]=_0x475efd[_0x62e2('0x43')][_0x62e2('0x46')]?_0x475efd[_0x62e2('0x43')]:_0x365841['model'];if(!_0x214506[_0x62e2('0x40')][_0x62e2('0x47')]('nolimit')){_0x475efd[_0x62e2('0x22')]=qs['limit'](_0x214506[_0x62e2('0x40')]['limit']);_0x475efd['offset']=qs[_0x62e2('0x49')](_0x214506['query'][_0x62e2('0x49')]);}_0x475efd['order']=qs[_0x62e2('0x65')](_0x214506[_0x62e2('0x40')]['sort']);_0x475efd['where']=qs[_0x62e2('0x42')](_[_0x62e2('0x66')](_0x214506[_0x62e2('0x40')],_0x365841[_0x62e2('0x42')]));_0x475efd['where']['VoiceQueueId']=_0x42ac9d['id'];if(_0x214506['query'][_0x62e2('0x2e')]){_0x475efd[_0x62e2('0x4b')]=_[_0x62e2('0x4c')](_0x475efd[_0x62e2('0x4b')],{'$or':_['map'](_0x475efd['attributes'],function(_0x11a938){var _0xb2a77f={};_0xb2a77f[_0x11a938]={'$like':'%'+_0x214506[_0x62e2('0x40')][_0x62e2('0x2e')]+'%'};return _0xb2a77f;})});}_0x475efd=_[_0x62e2('0x4c')]({},_0x475efd,_0x214506['options']);return db['CmHopperBlack'][_0x62e2('0x23')]({'where':_0x475efd[_0x62e2('0x4b')]})[_0x62e2('0x28')](function(_0x1e521c){_0x41592f[_0x62e2('0x23')]=_0x1e521c;if(_0x214506['query'][_0x62e2('0x5c')]){_0x475efd[_0x62e2('0x52')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x62e2('0x4e')](_0x475efd);})[_0x62e2('0x28')](function(_0xbba44f){_0x41592f[_0x62e2('0x68')]=_0xbba44f;return _0x41592f;});}})[_0x62e2('0x28')](respondWithFilteredResult(_0x51f2e5,_0x475efd))[_0x62e2('0x4f')](handleError(_0x51f2e5,null));};exports['getTeams']=function(_0x2e9103,_0x580fe7,_0x67efbf){var _0x460b67={};var _0x4e75d8={};var _0x21e989;var _0x3d3ca7;return db[_0x62e2('0x3b')][_0x62e2('0x63')]({'where':{'id':_0x2e9103['params']['id']}})[_0x62e2('0x28')](handleEntityNotFound(_0x580fe7,null))[_0x62e2('0x28')](function(_0x2af6ba){if(_0x2af6ba){_0x21e989=_0x2af6ba;_0x4e75d8['model']=_['keys'](db['Team'][_0x62e2('0x3c')]);_0x4e75d8[_0x62e2('0x40')]=_[_0x62e2('0x41')](_0x2e9103[_0x62e2('0x40')]);_0x4e75d8[_0x62e2('0x42')]=_[_0x62e2('0x44')](_0x4e75d8[_0x62e2('0x3f')],_0x4e75d8[_0x62e2('0x40')]);_0x460b67[_0x62e2('0x43')]=_[_0x62e2('0x44')](_0x4e75d8[_0x62e2('0x3f')],qs[_0x62e2('0x45')](_0x2e9103[_0x62e2('0x40')][_0x62e2('0x45')]));_0x460b67[_0x62e2('0x43')]=_0x460b67[_0x62e2('0x43')][_0x62e2('0x46')]?_0x460b67['attributes']:_0x4e75d8[_0x62e2('0x3f')];_0x460b67[_0x62e2('0x4a')]=qs[_0x62e2('0x65')](_0x2e9103[_0x62e2('0x40')][_0x62e2('0x65')]);_0x460b67[_0x62e2('0x4b')]=qs[_0x62e2('0x42')](_['pick'](_0x2e9103[_0x62e2('0x40')],_0x4e75d8[_0x62e2('0x42')]));if(_0x2e9103[_0x62e2('0x40')][_0x62e2('0x2e')]){_0x460b67['where']=_[_0x62e2('0x4c')](_0x460b67['where'],{'$or':_[_0x62e2('0x30')](_0x460b67['attributes'],function(_0x5a814e){var _0x1bbf46={};_0x1bbf46[_0x5a814e]={'$like':'%'+_0x2e9103['query'][_0x62e2('0x2e')]+'%'};return _0x1bbf46;})});}_0x460b67=_[_0x62e2('0x4c')]({},_0x460b67,_0x2e9103[_0x62e2('0x5d')]);return _0x21e989[_0x62e2('0x6f')](_0x460b67);}})[_0x62e2('0x28')](function(_0x35edd3){if(_0x35edd3){_0x3d3ca7=_0x35edd3[_0x62e2('0x46')];if(!_0x2e9103['query'][_0x62e2('0x47')](_0x62e2('0x48'))){_0x460b67[_0x62e2('0x22')]=qs[_0x62e2('0x22')](_0x2e9103[_0x62e2('0x40')][_0x62e2('0x22')]);_0x460b67[_0x62e2('0x49')]=qs[_0x62e2('0x49')](_0x2e9103['query'][_0x62e2('0x49')]);}return _0x21e989[_0x62e2('0x6f')](_0x460b67);}})[_0x62e2('0x28')](function(_0x27063b){if(_0x27063b){return _0x27063b?{'count':_0x3d3ca7,'rows':_0x27063b}:null;}})[_0x62e2('0x28')](respondWithResult(_0x580fe7,null))[_0x62e2('0x4f')](handleError(_0x580fe7,null));};exports[_0x62e2('0x70')]=function(_0x2b0042,_0x31c33e,_0x4a04f0){var _0x387d0b=_0x2b0042[_0x62e2('0x53')][_0x62e2('0x71')];var _0x43e01a=_[_0x62e2('0x30')](_0x387d0b,'id');return db[_0x62e2('0x72')][_0x62e2('0x4e')]({'where':{'id':_0x43e01a},'attributes':['id'],'include':[{'model':db['User'],'as':_0x62e2('0x73'),'attributes':['id',_0x62e2('0x35'),_0x62e2('0x74'),_0x62e2('0x75'),_0x62e2('0x76')],'raw':!![]}]})[_0x62e2('0x28')](function(_0x40db30){if(_0x40db30){var _0x590045=_[_0x62e2('0x77')](_0x40db30,function(_0x564698){var _0x15c9cb=_0x564698[_0x62e2('0x29')]({'plain':!![]});_0x15c9cb[_0x62e2('0x73')]['forEach'](function(_0x49cb52){_0x49cb52[_0x62e2('0x78')]=_['find'](_0x387d0b,{'id':_0x15c9cb['id']})[_0x62e2('0x78')];});return _0x15c9cb[_0x62e2('0x73')];});return db['VoiceQueue']['find']({'where':{'id':_0x2b0042[_0x62e2('0x51')]['id']}})[_0x62e2('0x28')](function(_0x45d087){return db[_0x62e2('0x79')][_0x62e2('0x7a')](function(_0x252668){return _0x45d087[_0x62e2('0x70')](_0x43e01a,{'transaction':_0x252668})[_0x62e2('0x28')](function(){return BPromise['each'](_0x387d0b,function(_0x507baa){return db[_0x62e2('0x7b')]['upsert']({'TeamId':_0x507baa['id'],'VoiceQueueId':_0x2b0042[_0x62e2('0x51')]['id'],'penalty':_0x507baa[_0x62e2('0x78')]},{'transaction':_0x252668});});})[_0x62e2('0x28')](function(){return BPromise[_0x62e2('0x7c')](_0x590045,function(_0x644050){return db[_0x62e2('0x7d')][_0x62e2('0x7e')]({'where':{'UserId':_0x644050['id'],'VoiceQueueId':_0x2b0042['params']['id']},'defaults':{'penalty':_0x644050[_0x62e2('0x78')]},'transaction':_0x252668});});})[_0x62e2('0x28')](function(){return BPromise[_0x62e2('0x7c')](_[_0x62e2('0x2e')](_0x590045,{'online':!![]}),function(_0x148603){return db[_0x62e2('0x7f')][_0x62e2('0x80')]({'membername':_0x148603[_0x62e2('0x35')],'UserId':_0x148603['id'],'queue_name':_0x45d087[_0x62e2('0x35')],'VoiceQueueId':_0x45d087['id'],'interface':_['isNil'](_0x148603[_0x62e2('0x76')])?util['format']('SIP/%s',_0x148603[_0x62e2('0x35')]):_0x148603[_0x62e2('0x76')],'paused':_0x148603[_0x62e2('0x75')]||![],'penalty':_0x148603[_0x62e2('0x78')]},{'transaction':_0x252668});});})[_0x62e2('0x28')](function(){_0x590045['forEach'](function(_0x8cf2ed){socket[_0x62e2('0x81')]('userVoiceQueue:save',{'UserId':_0x8cf2ed['id'],'VoiceQueueId':_0x45d087['id']});});});});});}})[_0x62e2('0x28')](respondWithStatusCode(_0x31c33e,null))['catch'](handleError(_0x31c33e,null));};exports['removeTeams']=function(_0x1fb846,_0x455d49,_0x3b6413){return db[_0x62e2('0x72')][_0x62e2('0x4e')]({'where':{'id':_0x1fb846[_0x62e2('0x40')][_0x62e2('0x82')]},'attributes':['id'],'include':[{'model':db[_0x62e2('0x83')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x62e2('0x28')](handleEntityNotFound(_0x455d49,null))[_0x62e2('0x28')](function(_0x5a136d){var _0x3435a5=_[_0x62e2('0x30')](_0x5a136d,'id');var _0x13fda6=[];var _0x3e5be3=[];var _0x865e84=squel[_0x62e2('0x84')]();_0x865e84[_0x62e2('0x85')](_0x62e2('0x86'))[_0x62e2('0x87')](_0x62e2('0x88'),'tq')[_0x62e2('0x89')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x62e2('0x4b')](_0x62e2('0x8a'),_0x1fb846[_0x62e2('0x51')]['id']);for(var _0x5a689e=0x0;_0x5a689e<_0x5a136d[_0x62e2('0x46')];_0x5a689e+=0x1){let _0x234522=_0x5a136d[_0x5a689e];for(var _0x7c9a8a=0x0;_0x7c9a8a<_0x234522[_0x62e2('0x73')][_0x62e2('0x46')];_0x7c9a8a+=0x1){let _0x175871=_0x234522['Agents'][_0x7c9a8a];var _0x1bcda8=_0x865e84[_0x62e2('0x5b')]();_0x1bcda8[_0x62e2('0x4b')](_0x62e2('0x8b'),_0x175871['id']);_0x3e5be3[_0x62e2('0x8c')](db['sequelize']['query'](_0x1bcda8[_0x62e2('0x8d')](),{'type':db['sequelize'][_0x62e2('0x8e')]['SELECT']})[_0x62e2('0x28')](function(_0x3c60a7){if(_0x3c60a7[_0x62e2('0x46')]===0x1){return _0x175871['id'];}else{var _0x403c60=_[_0x62e2('0x8f')](_[_0x62e2('0x30')](_0x3c60a7,_0x62e2('0x90')),function(_0x57ce04){return _[_0x62e2('0x32')](_0x3435a5,_0x57ce04);});if(_0x403c60){return _0x175871['id'];}}}));}}return BPromise['all'](_0x3e5be3)[_0x62e2('0x28')](function(_0x470734){_0x13fda6=_(_0x13fda6)[_0x62e2('0x91')](_0x470734)[_0x62e2('0x92')]()['value']();return db[_0x62e2('0x3b')][_0x62e2('0x34')]({'where':{'id':_0x1fb846['params']['id']}})[_0x62e2('0x28')](function(_0x174c48){return db[_0x62e2('0x79')][_0x62e2('0x7a')](function(_0x302dee){return _0x174c48[_0x62e2('0x93')](_0x1fb846['query'][_0x62e2('0x82')],{'transaction':_0x302dee})[_0x62e2('0x28')](function(){if(!_[_0x62e2('0x94')](_0x13fda6)){return _0x174c48['removeAgents'](_0x13fda6,{'transaction':_0x302dee})[_0x62e2('0x28')](function(){return db['UserVoiceQueueRt'][_0x62e2('0x27')]({'where':{'VoiceQueueId':_0x1fb846[_0x62e2('0x51')]['id'],'UserId':_0x13fda6},'transaction':_0x302dee});});}})[_0x62e2('0x28')](function(){_0x13fda6['forEach'](function(_0x59a49f){socket[_0x62e2('0x81')]('userVoiceQueue:remove',{'UserId':_0x59a49f,'VoiceQueueId':_0x174c48['id']});});});});});});})[_0x62e2('0x28')](respondWithStatusCode(_0x455d49,null))['catch'](handleError(_0x455d49,null));};exports[_0x62e2('0x95')]=function(_0x4166a6,_0x582caa,_0x3c443d){var _0x1fbdc1,_0x2933fc;return db[_0x62e2('0x3b')][_0x62e2('0x34')]({'where':{'id':_0x4166a6[_0x62e2('0x51')]['id']}})[_0x62e2('0x28')](handleEntityNotFound(_0x582caa,null))[_0x62e2('0x28')](function(_0x4cea53){if(_0x4cea53){_0x2933fc=_0x4cea53;return _0x4cea53[_0x62e2('0x95')](_0x4166a6[_0x62e2('0x53')][_0x62e2('0x82')],_['omit'](_0x4166a6[_0x62e2('0x53')],['ids','id'])||{})['spread'](function(_0x4098fe){for(var _0x1604a9=0x0;_0x1604a9<_0x4166a6[_0x62e2('0x53')][_0x62e2('0x82')][_0x62e2('0x46')];_0x1604a9+=0x1){socket[_0x62e2('0x81')]('userVoiceQueue:save',{'UserId':Number(_0x4166a6[_0x62e2('0x53')][_0x62e2('0x82')][_0x1604a9]),'VoiceQueueId':Number(_0x4166a6[_0x62e2('0x51')]['id'])});}return _0x4098fe;});}})[_0x62e2('0x28')](function(_0x805236){_0x1fbdc1=_0x805236||[];if(_0x2933fc){return db[_0x62e2('0x83')][_0x62e2('0x4e')]({'where':{'id':_0x4166a6['body']['ids']},'attributes':['id',_0x62e2('0x35'),_0x62e2('0x74'),'voicePause','interface'],'raw':!![]});}})['then'](function(_0xa9ded5){if(!_[_0x62e2('0x94')](_0xa9ded5)){var _0x1ca625=[];for(var _0x3a0f02=0x0;_0x3a0f02<_0xa9ded5[_0x62e2('0x46')];_0x3a0f02++){if(_0xa9ded5[_0x3a0f02]['online']){_0x1ca625[_0x62e2('0x8c')](db[_0x62e2('0x7f')][_0x62e2('0x80')]({'membername':_0xa9ded5[_0x3a0f02][_0x62e2('0x35')],'UserId':_0xa9ded5[_0x3a0f02]['id'],'queue_name':_0x2933fc[_0x62e2('0x35')],'VoiceQueueId':_0x2933fc['id'],'interface':_[_0x62e2('0x96')](_0xa9ded5[_0x3a0f02][_0x62e2('0x76')])?util[_0x62e2('0x97')](_0x62e2('0x98'),_0xa9ded5[_0x3a0f02][_0x62e2('0x35')]):_0xa9ded5[_0x3a0f02][_0x62e2('0x76')],'paused':_0xa9ded5[_0x3a0f02][_0x62e2('0x75')]||![],'penalty':_0x4166a6[_0x62e2('0x53')][_0x62e2('0x78')]||0x0}));}}return BPromise['all'](_0x1ca625);}})[_0x62e2('0x28')](function(){return _0x1fbdc1;})[_0x62e2('0x28')](respondWithResult(_0x582caa,null))[_0x62e2('0x4f')](handleError(_0x582caa,null));};exports[_0x62e2('0x99')]=function(_0x3f23e5,_0x570398,_0x27d499){return db[_0x62e2('0x3b')][_0x62e2('0x34')]({'where':{'id':_0x3f23e5[_0x62e2('0x51')]['id']}})[_0x62e2('0x28')](handleEntityNotFound(_0x570398,null))[_0x62e2('0x28')](function(_0xe5b8b0){if(_0xe5b8b0){return _0xe5b8b0[_0x62e2('0x99')](_0x3f23e5[_0x62e2('0x40')]['ids'])[_0x62e2('0x28')](function(){if(_[_0x62e2('0x9a')](_0x3f23e5[_0x62e2('0x40')][_0x62e2('0x82')])){for(var _0x187939=0x0;_0x187939<_0x3f23e5[_0x62e2('0x40')][_0x62e2('0x82')][_0x62e2('0x46')];_0x187939+=0x1){socket[_0x62e2('0x81')]('userVoiceQueue:remove',{'UserId':Number(_0x3f23e5[_0x62e2('0x40')][_0x62e2('0x82')][_0x187939]),'VoiceQueueId':Number(_0x3f23e5[_0x62e2('0x51')]['id'])});}}else{socket['emit'](_0x62e2('0x9b'),{'UserId':Number(_0x3f23e5[_0x62e2('0x40')][_0x62e2('0x82')]),'VoiceQueueId':Number(_0x3f23e5[_0x62e2('0x51')]['id'])});}});}})[_0x62e2('0x28')](function(_0x25a9b0){return db[_0x62e2('0x7f')][_0x62e2('0x27')]({'where':{'VoiceQueueId':_0x3f23e5['params']['id'],'UserId':_0x3f23e5['query'][_0x62e2('0x82')]}})[_0x62e2('0x28')](function(){return _0x25a9b0;});})[_0x62e2('0x28')](respondWithStatusCode(_0x570398,null))[_0x62e2('0x4f')](handleError(_0x570398,null));};exports['getAgents']=function(_0x4ec8b3,_0xb13301,_0x428259){var _0x1ee80d={};var _0x243bc9={};var _0x43cd07;var _0x2552b6;return db[_0x62e2('0x3b')][_0x62e2('0x63')]({'where':{'id':_0x4ec8b3['params']['id']}})[_0x62e2('0x28')](handleEntityNotFound(_0xb13301,null))['then'](function(_0x2585dc){if(_0x2585dc){_0x43cd07=_0x2585dc;_0x243bc9['model']=_[_0x62e2('0x41')](db[_0x62e2('0x83')][_0x62e2('0x3c')]);_0x243bc9[_0x62e2('0x40')]=_[_0x62e2('0x41')](_0x4ec8b3[_0x62e2('0x40')]);_0x243bc9[_0x62e2('0x42')]=_[_0x62e2('0x44')](_0x243bc9[_0x62e2('0x3f')],_0x243bc9[_0x62e2('0x40')]);_0x1ee80d[_0x62e2('0x43')]=_[_0x62e2('0x44')](_0x243bc9[_0x62e2('0x3f')],qs['fields'](_0x4ec8b3['query'][_0x62e2('0x45')]));_0x1ee80d[_0x62e2('0x43')]=_0x1ee80d[_0x62e2('0x43')][_0x62e2('0x46')]?_0x1ee80d[_0x62e2('0x43')]:_0x243bc9[_0x62e2('0x3f')];_0x1ee80d[_0x62e2('0x4a')]=qs[_0x62e2('0x65')](_0x4ec8b3[_0x62e2('0x40')][_0x62e2('0x65')]);_0x1ee80d[_0x62e2('0x4b')]=qs[_0x62e2('0x42')](_['pick'](_0x4ec8b3['query'],_0x243bc9[_0x62e2('0x42')]));if(_0x4ec8b3[_0x62e2('0x40')]['filter']){_0x1ee80d[_0x62e2('0x4b')]=_[_0x62e2('0x4c')](_0x1ee80d[_0x62e2('0x4b')],{'$or':_['map'](_0x1ee80d[_0x62e2('0x43')],function(_0x244c44){var _0x237d04={};_0x237d04[_0x244c44]={'$like':'%'+_0x4ec8b3[_0x62e2('0x40')]['filter']+'%'};return _0x237d04;})});}_0x1ee80d=_[_0x62e2('0x4c')]({},_0x1ee80d,_0x4ec8b3[_0x62e2('0x5d')]);return _0x43cd07[_0x62e2('0x9c')](_0x1ee80d);}})[_0x62e2('0x28')](function(_0x511f5a){if(_0x511f5a){_0x2552b6=_0x511f5a['length'];if(!_0x4ec8b3[_0x62e2('0x40')][_0x62e2('0x47')](_0x62e2('0x48'))){_0x1ee80d[_0x62e2('0x22')]=qs[_0x62e2('0x22')](_0x4ec8b3[_0x62e2('0x40')]['limit']);_0x1ee80d['offset']=qs[_0x62e2('0x49')](_0x4ec8b3[_0x62e2('0x40')][_0x62e2('0x49')]);}return _0x43cd07[_0x62e2('0x9c')](_0x1ee80d);}})['then'](function(_0x545621){if(_0x545621){return _0x545621?{'count':_0x2552b6,'rows':_0x545621}:null;}})[_0x62e2('0x28')](respondWithResult(_0xb13301,null))[_0x62e2('0x4f')](handleError(_0xb13301,null));};exports[_0x62e2('0x9d')]=function(_0x3cf8b4,_0x5e96d0,_0x41d333){var _0xa45d80={};var _0x50acdc={};var _0x1c6f53;var _0x15b863;return db[_0x62e2('0x3b')][_0x62e2('0x63')]({'where':{'id':_0x3cf8b4[_0x62e2('0x51')]['id']}})[_0x62e2('0x28')](handleEntityNotFound(_0x5e96d0,null))[_0x62e2('0x28')](function(_0x1bc0a7){if(_0x1bc0a7){_0x1c6f53=_0x1bc0a7;_0x50acdc[_0x62e2('0x3f')]=_['keys'](db[_0x62e2('0x7f')]['rawAttributes']);_0x50acdc[_0x62e2('0x40')]=_[_0x62e2('0x41')](_0x3cf8b4[_0x62e2('0x40')]);_0x50acdc['filters']=_['intersection'](_0x50acdc[_0x62e2('0x3f')],_0x50acdc[_0x62e2('0x40')]);_0xa45d80[_0x62e2('0x43')]=_['intersection'](_0x50acdc[_0x62e2('0x3f')],qs[_0x62e2('0x45')](_0x3cf8b4[_0x62e2('0x40')][_0x62e2('0x45')]));_0xa45d80[_0x62e2('0x43')]=_0xa45d80['attributes'][_0x62e2('0x46')]?_0xa45d80[_0x62e2('0x43')]:_0x50acdc[_0x62e2('0x3f')];_0xa45d80[_0x62e2('0x4a')]=qs['sort'](_0x3cf8b4[_0x62e2('0x40')][_0x62e2('0x65')]);_0xa45d80[_0x62e2('0x4b')]=qs[_0x62e2('0x42')](_[_0x62e2('0x66')](_0x3cf8b4[_0x62e2('0x40')],_0x50acdc[_0x62e2('0x42')]));if(_0x3cf8b4['query'][_0x62e2('0x2e')]){_0xa45d80['where']=_[_0x62e2('0x4c')](_0xa45d80[_0x62e2('0x4b')],{'$or':_[_0x62e2('0x30')](_0xa45d80['attributes'],function(_0x4c57a2){var _0x3a0f34={};_0x3a0f34[_0x4c57a2]={'$like':'%'+_0x3cf8b4[_0x62e2('0x40')][_0x62e2('0x2e')]+'%'};return _0x3a0f34;})});}_0xa45d80=_[_0x62e2('0x4c')]({},_0xa45d80,_0x3cf8b4[_0x62e2('0x5d')]);return _0x1c6f53[_0x62e2('0x9d')](_0xa45d80);}})[_0x62e2('0x28')](function(_0xc86340){if(_0xc86340){_0x15b863=_0xc86340['length'];if(!_0x3cf8b4[_0x62e2('0x40')][_0x62e2('0x47')]('nolimit')){_0xa45d80[_0x62e2('0x22')]=qs[_0x62e2('0x22')](_0x3cf8b4[_0x62e2('0x40')][_0x62e2('0x22')]);_0xa45d80[_0x62e2('0x49')]=qs[_0x62e2('0x49')](_0x3cf8b4['query'][_0x62e2('0x49')]);}return _0x1c6f53[_0x62e2('0x9d')](_0xa45d80);}})[_0x62e2('0x28')](function(_0x20f205){return _0x20f205?{'count':_0x15b863,'rows':_0x20f205}:null;})['then'](respondWithResult(_0x5e96d0,null))[_0x62e2('0x4f')](handleError(_0x5e96d0,null));};exports[_0x62e2('0x9e')]=function(_0x5483fb,_0x11820f,_0xe4b93c){var _0x42d0f1={};var _0x3d70cf={};var _0x587590;var _0x4565dd;return db[_0x62e2('0x3b')][_0x62e2('0x63')]({'where':{'id':_0x5483fb[_0x62e2('0x51')]['id']}})[_0x62e2('0x28')](handleEntityNotFound(_0x11820f,null))['then'](function(_0x333e5a){if(_0x333e5a){_0x587590=_0x333e5a;_0x3d70cf[_0x62e2('0x3f')]=_[_0x62e2('0x41')](db[_0x62e2('0x9f')]['rawAttributes']);_0x3d70cf[_0x62e2('0x40')]=_[_0x62e2('0x41')](_0x5483fb[_0x62e2('0x40')]);_0x3d70cf[_0x62e2('0x42')]=_[_0x62e2('0x44')](_0x3d70cf[_0x62e2('0x3f')],_0x3d70cf[_0x62e2('0x40')]);_0x42d0f1[_0x62e2('0x43')]=_[_0x62e2('0x44')](_0x3d70cf[_0x62e2('0x3f')],qs[_0x62e2('0x45')](_0x5483fb['query'][_0x62e2('0x45')]));_0x42d0f1[_0x62e2('0x43')]=_0x42d0f1[_0x62e2('0x43')][_0x62e2('0x46')]?_0x42d0f1[_0x62e2('0x43')]:_0x3d70cf['model'];_0x42d0f1['order']=qs['sort'](_0x5483fb[_0x62e2('0x40')][_0x62e2('0x65')]);_0x42d0f1[_0x62e2('0x4b')]=qs[_0x62e2('0x42')](_[_0x62e2('0x66')](_0x5483fb[_0x62e2('0x40')],_0x3d70cf[_0x62e2('0x42')]));if(_0x5483fb['query'][_0x62e2('0x2e')]){_0x42d0f1[_0x62e2('0x4b')]=_[_0x62e2('0x4c')](_0x42d0f1['where'],{'$or':_[_0x62e2('0x30')](_0x42d0f1['attributes'],function(_0x249be0){var _0xa44417={};_0xa44417[_0x249be0]={'$like':'%'+_0x5483fb[_0x62e2('0x40')]['filter']+'%'};return _0xa44417;})});}_0x42d0f1=_[_0x62e2('0x4c')]({},_0x42d0f1,_0x5483fb['options']);return _0x587590[_0x62e2('0x9e')](_0x42d0f1);}})['then'](function(_0x4dfebe){if(_0x4dfebe){_0x4565dd=_0x4dfebe[_0x62e2('0x46')];if(!_0x5483fb[_0x62e2('0x40')][_0x62e2('0x47')]('nolimit')){_0x42d0f1[_0x62e2('0x22')]=qs[_0x62e2('0x22')](_0x5483fb[_0x62e2('0x40')][_0x62e2('0x22')]);_0x42d0f1[_0x62e2('0x49')]=qs[_0x62e2('0x49')](_0x5483fb['query'][_0x62e2('0x49')]);}return _0x587590[_0x62e2('0x9e')](_0x42d0f1);}})[_0x62e2('0x28')](function(_0x338cc6){if(_0x338cc6){return _0x338cc6?{'count':_0x4565dd,'rows':_0x338cc6}:null;}})[_0x62e2('0x28')](respondWithResult(_0x11820f,null))[_0x62e2('0x4f')](handleError(_0x11820f,null));};exports['addLists']=function(_0x515c73,_0x1128ee,_0xc50222){var _0x607357,_0x4624eb;return db[_0x62e2('0x3b')][_0x62e2('0x34')]({'where':{'id':_0x515c73[_0x62e2('0x51')]['id']}})['then'](handleEntityNotFound(_0x1128ee,null))[_0x62e2('0x28')](function(_0x34653f){if(_0x34653f){_0x4624eb=_0x34653f;return _0x34653f[_0x62e2('0xa0')](_0x515c73[_0x62e2('0x53')][_0x62e2('0x82')],_['omit'](_0x515c73[_0x62e2('0x53')],[_0x62e2('0x82'),'id'])||{});}return null;})[_0x62e2('0xa1')](function(_0x27ffff){var _0x364c89;_0x607357=_0x27ffff||[];var _0x314054=[];if(_0x27ffff){for(var _0x1e0fa7=0x0;_0x1e0fa7<_0x27ffff[_0x62e2('0x46')];_0x1e0fa7+=0x1){var _0x114adb=_0x27ffff[_0x1e0fa7][_0x62e2('0x29')]({'plain':!![]});_0x4624eb['dialCheckDuplicateType']=_0x515c73[_0x62e2('0x53')][_0x62e2('0xa2')]?_0x515c73[_0x62e2('0x53')][_0x62e2('0xa2')]:_0x4624eb[_0x62e2('0xa2')];switch(_0x4624eb[_0x62e2('0xa2')]){case _0x62e2('0xa3'):_0x364c89=squel[_0x62e2('0xa4')]()[_0x62e2('0xa5')](_0x62e2('0xa6'))[_0x62e2('0xa7')]([_0x62e2('0xa8'),_0x62e2('0xa9'),_0x62e2('0xaa'),_0x62e2('0xab'),_0x62e2('0x67'),'createdAt',_0x62e2('0x60')],squel['select']()[_0x62e2('0x85')](_0x62e2('0xa8'),'phone')[_0x62e2('0x85')](_0x62e2('0xac'),_0x62e2('0xa9'))[_0x62e2('0x85')]('id',_0x62e2('0xaa'))['field'](_0x114adb[_0x62e2('0xad')][_0x62e2('0x8d')](),'ListId')[_0x62e2('0x85')](_0x515c73[_0x62e2('0x51')]['id']['toString'](),_0x62e2('0x67'))[_0x62e2('0x85')](_0x62e2('0xac'),_0x62e2('0x5f'))[_0x62e2('0x85')](_0x62e2('0xac'),'updatedAt')[_0x62e2('0x87')](_0x62e2('0xae'))[_0x62e2('0x4b')](_0x62e2('0xaf'))[_0x62e2('0x4b')](_0x62e2('0xb0'),_0x114adb[_0x62e2('0xad')]['toString']())[_0x62e2('0x4b')](_0x62e2('0xb1'))['where'](_0x62e2('0xb2'),squel['select']()[_0x62e2('0x85')](_0x62e2('0xb3'))[_0x62e2('0x87')]('cm_hopper_final')[_0x62e2('0x4b')](_0x62e2('0x8a'),_0x515c73[_0x62e2('0x51')]['id'][_0x62e2('0x8d')]()))[_0x62e2('0x4b')](_0x62e2('0xb2'),squel[_0x62e2('0x84')]()['field'](_0x62e2('0xb4'))[_0x62e2('0x87')](_0x62e2('0xa6'))['where'](_0x62e2('0x8a'),_0x515c73[_0x62e2('0x51')]['id'][_0x62e2('0x8d')]())))['toString']();break;case _0x62e2('0xb5'):_0x364c89=squel[_0x62e2('0xa4')]()[_0x62e2('0xa5')]('cm_hopper')[_0x62e2('0xa7')]([_0x62e2('0xa8'),_0x62e2('0xa9'),_0x62e2('0xaa'),_0x62e2('0xab'),_0x62e2('0x67'),_0x62e2('0x5f'),'updatedAt'],squel[_0x62e2('0x84')]()[_0x62e2('0x85')](_0x62e2('0xa8'),'phone')[_0x62e2('0x85')](_0x62e2('0xac'),_0x62e2('0xa9'))[_0x62e2('0x85')]('id','ContactId')[_0x62e2('0x85')](_0x114adb[_0x62e2('0xad')][_0x62e2('0x8d')](),'ListId')[_0x62e2('0x85')](_0x515c73[_0x62e2('0x51')]['id'][_0x62e2('0x8d')](),_0x62e2('0x67'))[_0x62e2('0x85')](_0x62e2('0xac'),_0x62e2('0x5f'))[_0x62e2('0x85')](_0x62e2('0xac'),'updatedAt')[_0x62e2('0x87')](_0x62e2('0xae'))[_0x62e2('0x4b')](_0x62e2('0xaf'))[_0x62e2('0x4b')]('ListId\x20=\x20?',_0x114adb[_0x62e2('0xad')][_0x62e2('0x8d')]())[_0x62e2('0x4b')](_0x62e2('0xb1'))[_0x62e2('0x4b')](_0x62e2('0xb2'),squel[_0x62e2('0x84')]()['field'](_0x62e2('0xb4'))['from'](_0x62e2('0xa6'))[_0x62e2('0x4b')](_0x62e2('0x8a'),_0x515c73[_0x62e2('0x51')]['id']['toString']())))[_0x62e2('0x8d')]();break;default:_0x364c89=squel[_0x62e2('0xa4')]()[_0x62e2('0xa5')](_0x62e2('0xa6'))['fromQuery']([_0x62e2('0xa8'),_0x62e2('0xa9'),'ContactId',_0x62e2('0xab'),_0x62e2('0x67'),_0x62e2('0x5f'),_0x62e2('0x60')],squel[_0x62e2('0x84')]()[_0x62e2('0x85')]('phone','phone')[_0x62e2('0x85')](_0x62e2('0xac'),'scheduledAt')['field']('id',_0x62e2('0xaa'))[_0x62e2('0x85')](_0x114adb[_0x62e2('0xad')][_0x62e2('0x8d')](),'ListId')[_0x62e2('0x85')](_0x515c73[_0x62e2('0x51')]['id'][_0x62e2('0x8d')](),_0x62e2('0x67'))[_0x62e2('0x85')](_0x62e2('0xac'),_0x62e2('0x5f'))[_0x62e2('0x85')]('NOW()',_0x62e2('0x60'))[_0x62e2('0x87')]('cm_contacts')[_0x62e2('0x4b')]('deletedAt\x20IS\x20NULL')[_0x62e2('0x4b')](_0x62e2('0xb0'),_0x114adb[_0x62e2('0xad')][_0x62e2('0x8d')]())[_0x62e2('0x4b')](_0x62e2('0xb1')))[_0x62e2('0x8d')]();}_0x314054[_0x62e2('0x8c')](db[_0x62e2('0x79')][_0x62e2('0x40')](_0x364c89));}return BPromise[_0x62e2('0xb6')](_0x314054);}})[_0x62e2('0x28')](function(){return _0x607357;})[_0x62e2('0x28')](respondWithResult(_0x1128ee,null))[_0x62e2('0x4f')](handleError(_0x1128ee,null));};exports[_0x62e2('0xb7')]=function(_0x221696,_0x2dab9b,_0x174671){return db['VoiceQueue'][_0x62e2('0x34')]({'where':{'id':_0x221696['params']['id']}})[_0x62e2('0x28')](handleEntityNotFound(_0x2dab9b,null))['then'](function(_0xb11eee){if(_0xb11eee){return _0xb11eee[_0x62e2('0xb7')](_0x221696[_0x62e2('0x40')]['ids']);}})[_0x62e2('0x28')](function(_0x370a3b){if(_0x370a3b){return db[_0x62e2('0x64')][_0x62e2('0x27')]({'where':{'ListId':_0x221696[_0x62e2('0x40')][_0x62e2('0x82')],'VoiceQueueId':_0x221696['params']['id']}})[_0x62e2('0x28')](function(){return _0x370a3b;});}})[_0x62e2('0x28')](respondWithStatusCode(_0x2dab9b,null))[_0x62e2('0x4f')](handleError(_0x2dab9b,null));};exports[_0x62e2('0xb8')]=function(_0x38ba31,_0x26994e,_0x3ea4ad){var _0x40b11a={};var _0x2f7b72={};var _0x54eafb;var _0x4cda48;return db[_0x62e2('0x3b')]['findOne']({'where':{'id':_0x38ba31[_0x62e2('0x51')]['id']}})[_0x62e2('0x28')](handleEntityNotFound(_0x26994e,null))['then'](function(_0x5d8af8){if(_0x5d8af8){_0x54eafb=_0x5d8af8;_0x2f7b72[_0x62e2('0x3f')]=_[_0x62e2('0x41')](db[_0x62e2('0x9f')][_0x62e2('0x3c')]);_0x2f7b72[_0x62e2('0x40')]=_[_0x62e2('0x41')](_0x38ba31['query']);_0x2f7b72['filters']=_['intersection'](_0x2f7b72['model'],_0x2f7b72[_0x62e2('0x40')]);_0x40b11a['attributes']=_[_0x62e2('0x44')](_0x2f7b72[_0x62e2('0x3f')],qs[_0x62e2('0x45')](_0x38ba31[_0x62e2('0x40')][_0x62e2('0x45')]));_0x40b11a['attributes']=_0x40b11a[_0x62e2('0x43')][_0x62e2('0x46')]?_0x40b11a['attributes']:_0x2f7b72[_0x62e2('0x3f')];_0x40b11a['order']=qs[_0x62e2('0x65')](_0x38ba31[_0x62e2('0x40')][_0x62e2('0x65')]);_0x40b11a[_0x62e2('0x4b')]=qs[_0x62e2('0x42')](_[_0x62e2('0x66')](_0x38ba31[_0x62e2('0x40')],_0x2f7b72[_0x62e2('0x42')]));if(_0x38ba31['query'][_0x62e2('0x2e')]){_0x40b11a['where']=_['merge'](_0x40b11a[_0x62e2('0x4b')],{'$or':_[_0x62e2('0x30')](_0x40b11a[_0x62e2('0x43')],function(_0x2f9d24){var _0x3ad959={};_0x3ad959[_0x2f9d24]={'$like':'%'+_0x38ba31[_0x62e2('0x40')]['filter']+'%'};return _0x3ad959;})});}_0x40b11a=_[_0x62e2('0x4c')]({},_0x40b11a,_0x38ba31[_0x62e2('0x5d')]);return _0x54eafb[_0x62e2('0xb8')](_0x40b11a);}})['then'](function(_0x25fe69){if(_0x25fe69){_0x4cda48=_0x25fe69[_0x62e2('0x46')];if(!_0x38ba31[_0x62e2('0x40')][_0x62e2('0x47')](_0x62e2('0x48'))){_0x40b11a[_0x62e2('0x22')]=qs[_0x62e2('0x22')](_0x38ba31[_0x62e2('0x40')][_0x62e2('0x22')]);_0x40b11a[_0x62e2('0x49')]=qs[_0x62e2('0x49')](_0x38ba31[_0x62e2('0x40')][_0x62e2('0x49')]);}return _0x54eafb[_0x62e2('0xb8')](_0x40b11a);}})[_0x62e2('0x28')](function(_0x32d5ce){if(_0x32d5ce){return _0x32d5ce?{'count':_0x4cda48,'rows':_0x32d5ce}:null;}})[_0x62e2('0x28')](respondWithResult(_0x26994e,null))[_0x62e2('0x4f')](handleError(_0x26994e,null));};exports[_0x62e2('0xb9')]=function(_0x15881e,_0x215386,_0xa2fab9){var _0x779e1d,_0x4805ae;return db['VoiceQueue']['find']({'where':{'id':_0x15881e[_0x62e2('0x51')]['id']}})[_0x62e2('0x28')](handleEntityNotFound(_0x215386,null))[_0x62e2('0x28')](function(_0x285999){if(_0x285999){_0x4805ae=_0x285999;return _0x285999[_0x62e2('0xb9')](_0x15881e['body']['ids'],_[_0x62e2('0x5e')](_0x15881e[_0x62e2('0x53')],[_0x62e2('0x82'),'id'])||{});}return null;})['spread'](function(_0x2da65a){var _0x59bd0d;_0x779e1d=_0x2da65a||[];var _0x5ecf86=[];if(_0x2da65a){for(var _0x35276e=0x0;_0x35276e<_0x2da65a[_0x62e2('0x46')];_0x35276e+=0x1){var _0x15594c=_0x2da65a[_0x35276e]['get']({'plain':!![]});_0x59bd0d=squel[_0x62e2('0xa4')]()[_0x62e2('0xa5')](_0x62e2('0xba'))[_0x62e2('0xa7')]([_0x62e2('0xa8'),_0x62e2('0xaa'),'ListId',_0x62e2('0x67'),_0x62e2('0x5f'),_0x62e2('0x60')],squel[_0x62e2('0x84')]()[_0x62e2('0x85')]('phone','phone')[_0x62e2('0x85')]('id','ContactId')[_0x62e2('0x85')](_0x15594c['CmListId'][_0x62e2('0x8d')](),_0x62e2('0xab'))['field'](_0x15881e['params']['id'][_0x62e2('0x8d')](),'VoiceQueueId')[_0x62e2('0x85')](_0x62e2('0xac'),'createdAt')[_0x62e2('0x85')](_0x62e2('0xac'),_0x62e2('0x60'))[_0x62e2('0x87')](_0x62e2('0xae'))[_0x62e2('0x4b')]('deletedAt\x20IS\x20NULL')[_0x62e2('0x4b')](_0x62e2('0xb0'),_0x15594c[_0x62e2('0xad')][_0x62e2('0x8d')]())[_0x62e2('0x4b')]('phone\x20IS\x20NOT\x20NULL'))[_0x62e2('0x8d')]();_0x5ecf86[_0x62e2('0x8c')](db[_0x62e2('0x79')]['query'](_0x59bd0d));}return BPromise['all'](_0x5ecf86);}})['then'](function(){return _0x779e1d;})[_0x62e2('0x28')](respondWithResult(_0x215386,null))['catch'](handleError(_0x215386,null));};exports[_0x62e2('0xbb')]=function(_0x4a24f3,_0x1027d8,_0x1a1c48){return db['VoiceQueue']['find']({'where':{'id':_0x4a24f3[_0x62e2('0x51')]['id']}})[_0x62e2('0x28')](handleEntityNotFound(_0x1027d8,null))[_0x62e2('0x28')](function(_0x4016c6){if(_0x4016c6){return _0x4016c6[_0x62e2('0xbb')](_0x4a24f3[_0x62e2('0x40')][_0x62e2('0x82')]);}})[_0x62e2('0x28')](function(_0x394dd4){if(_0x394dd4){return db['CmHopperBlack'][_0x62e2('0x27')]({'where':{'ListId':_0x4a24f3[_0x62e2('0x40')][_0x62e2('0x82')],'VoiceQueueId':_0x4a24f3[_0x62e2('0x51')]['id']}})[_0x62e2('0x28')](function(){return _0x394dd4;});}})[_0x62e2('0x28')](respondWithStatusCode(_0x1027d8,null))[_0x62e2('0x4f')](handleError(_0x1027d8,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 8d93098..7f14246 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 _0xf57a=['hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x1fa11f,_0x570268){var _0x2cc96c=function(_0x259df5){while(--_0x259df5){_0x1fa11f['push'](_0x1fa11f['shift']());}};_0x2cc96c(++_0x570268);}(_0xf57a,0x1ca));var _0xaf57=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xf57a[_0x51020b];return _0x371e47;};'use strict';var EventEmitter=require(_0xaf57('0x0'));var VoiceQueue=require(_0xaf57('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xaf57('0x2')](0x0);var events={'afterCreate':_0xaf57('0x3'),'afterUpdate':_0xaf57('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2a5b41){return function(_0x54544a,_0x15b74e,_0x385686){VoiceQueueEvents[_0xaf57('0x5')](_0x2a5b41+':'+_0x54544a['id'],_0x54544a);VoiceQueueEvents[_0xaf57('0x5')](_0x2a5b41,_0x54544a);_0x385686(null);};}for(var e in events){if(events[_0xaf57('0x6')](e)){var event=events[e];VoiceQueue[_0xaf57('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x0a1a=['../../mysqldb','setMaxListeners','emit','hasOwnProperty','hook','exports','events'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x0a1a,0x172));var _0xa0a1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0a1a[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xa0a1('0x0'));var VoiceQueue=require(_0xa0a1('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xa0a1('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2a2b1b){return function(_0x358ceb,_0xbc3841,_0x142ef5){VoiceQueueEvents[_0xa0a1('0x3')](_0x2a2b1b+':'+_0x358ceb['id'],_0x358ceb);VoiceQueueEvents[_0xa0a1('0x3')](_0x2a2b1b,_0x358ceb);_0x142ef5(null);};}for(var e in events){if(events[_0xa0a1('0x4')](e)){var event=events[e];VoiceQueue[_0xa0a1('0x5')](e,emitEvent(event));}}module[_0xa0a1('0x6')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index c23c6c3..e671bfb 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(_0x5e4931,_0x5768dc){var _0x1eb815=function(_0x3d7666){while(--_0x3d7666){_0x5e4931['push'](_0x5e4931['shift']());}};_0x1eb815(++_0x5768dc);}(_0x70e0,0x17b));var _0x070e=function(_0xfe0523,_0x286083){_0xfe0523=_0xfe0523-0x0;var _0x345853=_0x70e0[_0xfe0523];return _0x345853;};'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 _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x1a69f8,_0x3d46dc){var _0x41a323=function(_0x22a546){while(--_0x22a546){_0x1a69f8['push'](_0x1a69f8['shift']());}};_0x41a323(++_0x3d46dc);}(_0x9c44,0x178));var _0x49c4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9c44[_0x422905];return _0x33dc6c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index b77f2ea..f27c41d 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 _0xd3c1=['../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetVoiceQueue','VoiceQueue','options','raw','where','attributes','limit','include','map','model','ShowVoiceQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x54b062,_0x264bb5){var _0x255e41=function(_0x3c7e6f){while(--_0x3c7e6f){_0x54b062['push'](_0x54b062['shift']());}};_0x255e41(++_0x264bb5);}(_0xd3c1,0x162));var _0x1d3c=function(_0x3b7ac6,_0x501f60){_0x3b7ac6=_0x3b7ac6-0x0;var _0x45a3f0=_0xd3c1[_0x3b7ac6];return _0x45a3f0;};'use strict';var _=require(_0x1d3c('0x0'));var util=require(_0x1d3c('0x1'));var moment=require(_0x1d3c('0x2'));var BPromise=require('bluebird');var rs=require(_0x1d3c('0x3'));var fs=require('fs');var Redis=require(_0x1d3c('0x4'));var db=require(_0x1d3c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1d3c('0x6'))('rpc');var config=require(_0x1d3c('0x7'));var jayson=require(_0x1d3c('0x8'));var client=jayson[_0x1d3c('0x9')][_0x1d3c('0xa')]({'port':0x232a});config[_0x1d3c('0xb')]=_[_0x1d3c('0xc')](config[_0x1d3c('0xb')],{'host':_0x1d3c('0xd'),'port':0x18eb});var socket=require(_0x1d3c('0xe'))(new Redis(config['redis']));require(_0x1d3c('0xf'))[_0x1d3c('0x10')](socket);function respondWithRpcPromise(_0x2b35ee,_0x4a6883,_0x53d684){return new BPromise(function(_0x5185af,_0x7a1a85){return client[_0x1d3c('0x11')](_0x2b35ee,_0x53d684)[_0x1d3c('0x12')](function(_0x3226ef){logger[_0x1d3c('0x13')](_0x1d3c('0x14'),_0x4a6883,_0x1d3c('0x15'));logger[_0x1d3c('0x16')](_0x1d3c('0x17'),_0x4a6883,_0x1d3c('0x15'),JSON[_0x1d3c('0x18')](_0x3226ef));if(_0x3226ef[_0x1d3c('0x19')]){if(_0x3226ef['error']['code']===0x1f4){logger[_0x1d3c('0x19')]('VoiceQueue,\x20%s,\x20%s',_0x4a6883,_0x3226ef[_0x1d3c('0x19')][_0x1d3c('0x1a')]);return _0x7a1a85(_0x3226ef[_0x1d3c('0x19')][_0x1d3c('0x1a')]);}logger[_0x1d3c('0x19')](_0x1d3c('0x14'),_0x4a6883,_0x3226ef[_0x1d3c('0x19')][_0x1d3c('0x1a')]);return _0x5185af(_0x3226ef[_0x1d3c('0x19')][_0x1d3c('0x1a')]);}else{logger[_0x1d3c('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x4a6883,_0x1d3c('0x15'));_0x5185af(_0x3226ef['result'][_0x1d3c('0x1a')]);}})[_0x1d3c('0x1b')](function(_0x46d8c3){logger['error'](_0x1d3c('0x14'),_0x4a6883,_0x46d8c3);_0x7a1a85(_0x46d8c3);});});}exports[_0x1d3c('0x1c')]=function(_0x22825f){var _0x4dea0e=this;return new Promise(function(_0x33ee40,_0x18b647){return db[_0x1d3c('0x1d')]['findAll']({'raw':_0x22825f[_0x1d3c('0x1e')]?_0x22825f[_0x1d3c('0x1e')][_0x1d3c('0x1f')]===undefined?!![]:![]:!![],'where':_0x22825f[_0x1d3c('0x1e')]?_0x22825f[_0x1d3c('0x1e')][_0x1d3c('0x20')]||null:null,'attributes':_0x22825f['options']?_0x22825f[_0x1d3c('0x1e')][_0x1d3c('0x21')]||null:null,'limit':_0x22825f[_0x1d3c('0x1e')]?_0x22825f[_0x1d3c('0x1e')][_0x1d3c('0x22')]||null:null,'include':_0x22825f[_0x1d3c('0x1e')]?_0x22825f[_0x1d3c('0x1e')][_0x1d3c('0x23')]?_['map'](_0x22825f['options'][_0x1d3c('0x23')],function(_0x4724c6){return{'model':db[_0x4724c6['model']],'as':_0x4724c6['as'],'attributes':_0x4724c6[_0x1d3c('0x21')],'include':_0x4724c6['include']?_[_0x1d3c('0x24')](_0x4724c6[_0x1d3c('0x23')],function(_0x51987e){return{'model':db[_0x51987e[_0x1d3c('0x25')]],'as':_0x51987e['as'],'attributes':_0x51987e[_0x1d3c('0x21')],'include':_0x51987e[_0x1d3c('0x23')]?_['map'](_0x51987e['include'],function(_0x1f5ab6){return{'model':db[_0x1f5ab6[_0x1d3c('0x25')]],'as':_0x1f5ab6['as'],'attributes':_0x1f5ab6[_0x1d3c('0x21')]};}):[]};}):[]};}):[]:[]})[_0x1d3c('0x12')](function(_0x3be2bf){logger[_0x1d3c('0x13')]('GetVoiceQueue',_0x22825f);logger[_0x1d3c('0x16')](_0x1d3c('0x1c'),_0x22825f,JSON[_0x1d3c('0x18')](_0x3be2bf));_0x33ee40(_0x3be2bf);})['catch'](function(_0x32f601){logger[_0x1d3c('0x19')](_0x1d3c('0x1c'),_0x32f601[_0x1d3c('0x1a')],_0x22825f);_0x18b647(_0x4dea0e[_0x1d3c('0x19')](0x1f4,_0x32f601[_0x1d3c('0x1a')]));});});};exports[_0x1d3c('0x26')]=function(_0x5c91b9){var _0x1d8db0=this;return new Promise(function(_0x3ccbf9,_0x208ded){return db['VoiceQueue'][_0x1d3c('0x27')]({'raw':_0x5c91b9[_0x1d3c('0x1e')]?_0x5c91b9[_0x1d3c('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x5c91b9[_0x1d3c('0x1e')]?_0x5c91b9['options'][_0x1d3c('0x20')]||null:null,'attributes':_0x5c91b9[_0x1d3c('0x1e')]?_0x5c91b9[_0x1d3c('0x1e')][_0x1d3c('0x21')]||null:null,'include':_0x5c91b9[_0x1d3c('0x1e')]?_0x5c91b9[_0x1d3c('0x1e')][_0x1d3c('0x23')]?_[_0x1d3c('0x24')](_0x5c91b9[_0x1d3c('0x1e')][_0x1d3c('0x23')],function(_0x2e545b){return{'model':db[_0x2e545b[_0x1d3c('0x25')]],'as':_0x2e545b['as'],'attributes':_0x2e545b[_0x1d3c('0x21')],'include':_0x2e545b[_0x1d3c('0x23')]?_[_0x1d3c('0x24')](_0x2e545b[_0x1d3c('0x23')],function(_0x3aeadd){return{'model':db[_0x3aeadd[_0x1d3c('0x25')]],'as':_0x3aeadd['as'],'attributes':_0x3aeadd[_0x1d3c('0x21')],'include':_0x3aeadd['include']?_[_0x1d3c('0x24')](_0x3aeadd[_0x1d3c('0x23')],function(_0x4c7600){return{'model':db[_0x4c7600[_0x1d3c('0x25')]],'as':_0x4c7600['as'],'attributes':_0x4c7600[_0x1d3c('0x21')]};}):[]};}):[]};}):[]:[]})[_0x1d3c('0x12')](function(_0x1bb224){logger['info'](_0x1d3c('0x26'),_0x5c91b9);logger['debug']('ShowVoiceQueue',_0x5c91b9,JSON['stringify'](_0x1bb224));_0x3ccbf9(_0x1bb224);})[_0x1d3c('0x1b')](function(_0x5ba8d9){logger[_0x1d3c('0x19')](_0x1d3c('0x26'),_0x5ba8d9['message'],_0x5c91b9);_0x208ded(_0x1d8db0['error'](0x1f4,_0x5ba8d9[_0x1d3c('0x1a')]));});});}; \ No newline at end of file +var _0x68b9=['GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowVoiceQueue','find','stringify','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceQueue.socket','request','then','info','VoiceQueue,\x20%s,\x20%s','debug','error','code','message','result','catch'];(function(_0x5841d1,_0x29557e){var _0xe33368=function(_0x227bf0){while(--_0x227bf0){_0x5841d1['push'](_0x5841d1['shift']());}};_0xe33368(++_0x29557e);}(_0x68b9,0xfe));var _0x968b=function(_0x326e79,_0x33dc91){_0x326e79=_0x326e79-0x0;var _0x37eb89=_0x68b9[_0x326e79];return _0x37eb89;};'use strict';var _=require(_0x968b('0x0'));var util=require('util');var moment=require(_0x968b('0x1'));var BPromise=require(_0x968b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x968b('0x3'));var db=require(_0x968b('0x4'))['db'];var utils=require(_0x968b('0x5'));var logger=require(_0x968b('0x6'))(_0x968b('0x7'));var config=require(_0x968b('0x8'));var jayson=require(_0x968b('0x9'));var client=jayson[_0x968b('0xa')][_0x968b('0xb')]({'port':0x232a});config[_0x968b('0xc')]=_['defaults'](config[_0x968b('0xc')],{'host':_0x968b('0xd'),'port':0x18eb});var socket=require(_0x968b('0xe'))(new Redis(config['redis']));require(_0x968b('0xf'))['register'](socket);function respondWithRpcPromise(_0x4fa30b,_0x1b708d,_0x1875c3){return new BPromise(function(_0x52d312,_0x527045){return client[_0x968b('0x10')](_0x4fa30b,_0x1875c3)[_0x968b('0x11')](function(_0x56a551){logger[_0x968b('0x12')](_0x968b('0x13'),_0x1b708d,'request\x20sent');logger[_0x968b('0x14')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x1b708d,'request\x20sent',JSON['stringify'](_0x56a551));if(_0x56a551[_0x968b('0x15')]){if(_0x56a551[_0x968b('0x15')][_0x968b('0x16')]===0x1f4){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x1b708d,_0x56a551['error']['message']);return _0x527045(_0x56a551[_0x968b('0x15')][_0x968b('0x17')]);}logger[_0x968b('0x15')](_0x968b('0x13'),_0x1b708d,_0x56a551[_0x968b('0x15')][_0x968b('0x17')]);return _0x52d312(_0x56a551[_0x968b('0x15')][_0x968b('0x17')]);}else{logger[_0x968b('0x12')](_0x968b('0x13'),_0x1b708d,'request\x20sent');_0x52d312(_0x56a551[_0x968b('0x18')][_0x968b('0x17')]);}})[_0x968b('0x19')](function(_0x3d23da){logger[_0x968b('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x1b708d,_0x3d23da);_0x527045(_0x3d23da);});});}exports[_0x968b('0x1a')]=function(_0x21cb96){var _0x1f56ff=this;return new Promise(function(_0x280509,_0x7f8b08){return db[_0x968b('0x1b')][_0x968b('0x1c')]({'raw':_0x21cb96[_0x968b('0x1d')]?_0x21cb96['options'][_0x968b('0x1e')]===undefined?!![]:![]:!![],'where':_0x21cb96[_0x968b('0x1d')]?_0x21cb96['options'][_0x968b('0x1f')]||null:null,'attributes':_0x21cb96[_0x968b('0x1d')]?_0x21cb96[_0x968b('0x1d')][_0x968b('0x20')]||null:null,'limit':_0x21cb96[_0x968b('0x1d')]?_0x21cb96['options'][_0x968b('0x21')]||null:null,'include':_0x21cb96['options']?_0x21cb96['options'][_0x968b('0x22')]?_[_0x968b('0x23')](_0x21cb96[_0x968b('0x1d')][_0x968b('0x22')],function(_0x35d9f8){return{'model':db[_0x35d9f8[_0x968b('0x24')]],'as':_0x35d9f8['as'],'attributes':_0x35d9f8['attributes'],'include':_0x35d9f8[_0x968b('0x22')]?_[_0x968b('0x23')](_0x35d9f8[_0x968b('0x22')],function(_0x375f64){return{'model':db[_0x375f64[_0x968b('0x24')]],'as':_0x375f64['as'],'attributes':_0x375f64[_0x968b('0x20')],'include':_0x375f64['include']?_['map'](_0x375f64[_0x968b('0x22')],function(_0x53b17b){return{'model':db[_0x53b17b[_0x968b('0x24')]],'as':_0x53b17b['as'],'attributes':_0x53b17b[_0x968b('0x20')]};}):[]};}):[]};}):[]:[]})[_0x968b('0x11')](function(_0x5ca7cb){logger[_0x968b('0x12')](_0x968b('0x1a'),_0x21cb96);logger[_0x968b('0x14')]('GetVoiceQueue',_0x21cb96,JSON['stringify'](_0x5ca7cb));_0x280509(_0x5ca7cb);})[_0x968b('0x19')](function(_0x41dbbd){logger[_0x968b('0x15')]('GetVoiceQueue',_0x41dbbd[_0x968b('0x17')],_0x21cb96);_0x7f8b08(_0x1f56ff[_0x968b('0x15')](0x1f4,_0x41dbbd[_0x968b('0x17')]));});});};exports[_0x968b('0x25')]=function(_0xfee9d7){var _0x48d325=this;return new Promise(function(_0xc9597a,_0x1a5f62){return db[_0x968b('0x1b')][_0x968b('0x26')]({'raw':_0xfee9d7[_0x968b('0x1d')]?_0xfee9d7[_0x968b('0x1d')][_0x968b('0x1e')]===undefined?!![]:![]:!![],'where':_0xfee9d7[_0x968b('0x1d')]?_0xfee9d7[_0x968b('0x1d')][_0x968b('0x1f')]||null:null,'attributes':_0xfee9d7[_0x968b('0x1d')]?_0xfee9d7[_0x968b('0x1d')][_0x968b('0x20')]||null:null,'include':_0xfee9d7['options']?_0xfee9d7['options'][_0x968b('0x22')]?_[_0x968b('0x23')](_0xfee9d7[_0x968b('0x1d')]['include'],function(_0xb21baf){return{'model':db[_0xb21baf[_0x968b('0x24')]],'as':_0xb21baf['as'],'attributes':_0xb21baf[_0x968b('0x20')],'include':_0xb21baf[_0x968b('0x22')]?_[_0x968b('0x23')](_0xb21baf[_0x968b('0x22')],function(_0x3c279c){return{'model':db[_0x3c279c[_0x968b('0x24')]],'as':_0x3c279c['as'],'attributes':_0x3c279c[_0x968b('0x20')],'include':_0x3c279c['include']?_[_0x968b('0x23')](_0x3c279c[_0x968b('0x22')],function(_0x146e71){return{'model':db[_0x146e71[_0x968b('0x24')]],'as':_0x146e71['as'],'attributes':_0x146e71[_0x968b('0x20')]};}):[]};}):[]};}):[]:[]})[_0x968b('0x11')](function(_0x1bc35c){logger[_0x968b('0x12')]('ShowVoiceQueue',_0xfee9d7);logger[_0x968b('0x14')](_0x968b('0x25'),_0xfee9d7,JSON[_0x968b('0x27')](_0x1bc35c));_0xc9597a(_0x1bc35c);})[_0x968b('0x19')](function(_0x5dc81c){logger[_0x968b('0x15')](_0x968b('0x25'),_0x5dc81c['message'],_0xfee9d7);_0x1a5f62(_0x48d325[_0x968b('0x15')](0x1f4,_0x5dc81c[_0x968b('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index ef26d37..1e9f45f 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 _0xd2dc=['length','voiceQueue:','./voiceQueue.events','remove','update','emit','removeListener','register'];(function(_0x3520df,_0x202122){var _0x42fadb=function(_0x45b064){while(--_0x45b064){_0x3520df['push'](_0x3520df['shift']());}};_0x42fadb(++_0x202122);}(_0xd2dc,0x192));var _0xcd2d=function(_0x104ced,_0x5395a8){_0x104ced=_0x104ced-0x0;var _0x2b2757=_0xd2dc[_0x104ced];return _0x2b2757;};'use strict';var VoiceQueueEvents=require(_0xcd2d('0x0'));var events=['save',_0xcd2d('0x1'),_0xcd2d('0x2')];function createListener(_0xe7d234,_0x226030){return function(_0x458f32){_0x226030[_0xcd2d('0x3')](_0xe7d234,_0x458f32);};}function removeListener(_0x2ac60d,_0x24b2d1){return function(){VoiceQueueEvents[_0xcd2d('0x4')](_0x2ac60d,_0x24b2d1);};}exports[_0xcd2d('0x5')]=function(_0x30cbd6){for(var _0x5140f3=0x0,_0x407cd5=events[_0xcd2d('0x6')];_0x5140f3<_0x407cd5;_0x5140f3++){var _0x3b9745=events[_0x5140f3];var _0x4ccd63=createListener(_0xcd2d('0x7')+_0x3b9745,_0x30cbd6);VoiceQueueEvents['on'](_0x3b9745,_0x4ccd63);}}; \ No newline at end of file +var _0x0f52=['emit','register','length','./voiceQueue.events','save','update'];(function(_0x2a9926,_0x1b42f4){var _0x499a72=function(_0x3451b0){while(--_0x3451b0){_0x2a9926['push'](_0x2a9926['shift']());}};_0x499a72(++_0x1b42f4);}(_0x0f52,0x105));var _0x20f5=function(_0x2b70bd,_0x2e39d2){_0x2b70bd=_0x2b70bd-0x0;var _0x4cd986=_0x0f52[_0x2b70bd];return _0x4cd986;};'use strict';var VoiceQueueEvents=require(_0x20f5('0x0'));var events=[_0x20f5('0x1'),'remove',_0x20f5('0x2')];function createListener(_0x88d9ee,_0x10b358){return function(_0x56a622){_0x10b358[_0x20f5('0x3')](_0x88d9ee,_0x56a622);};}function removeListener(_0x4a8bda,_0x51855c){return function(){VoiceQueueEvents['removeListener'](_0x4a8bda,_0x51855c);};}exports[_0x20f5('0x4')]=function(_0x279950){for(var _0x55b3ca=0x0,_0x982801=events[_0x20f5('0x5')];_0x55b3ca<_0x982801;_0x55b3ca++){var _0x2705a2=events[_0x55b3ca];var _0x3063cf=createListener('voiceQueue:'+_0x2705a2,_0x279950);VoiceQueueEvents['on'](_0x2705a2,_0x3063cf);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 50e6c87..128005c 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 _0x2f72=['/index','getVoiceQueuesReport','post','create','put','/:id','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','/describe','describe'];(function(_0x131bda,_0x50885d){var _0x542b8e=function(_0x4e0702){while(--_0x4e0702){_0x131bda['push'](_0x131bda['shift']());}};_0x542b8e(++_0x50885d);}(_0x2f72,0x103));var _0x22f7=function(_0x10e8fa,_0x5da82a){_0x10e8fa=_0x10e8fa-0x0;var _0x3a78a=_0x2f72[_0x10e8fa];return _0x3a78a;};'use strict';var multer=require(_0x22f7('0x0'));var util=require(_0x22f7('0x1'));var path=require(_0x22f7('0x2'));var timeout=require(_0x22f7('0x3'));var express=require(_0x22f7('0x4'));var router=express[_0x22f7('0x5')]();var fs_extra=require(_0x22f7('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x22f7('0x7'));var config=require(_0x22f7('0x8'));var controller=require(_0x22f7('0x9'));router[_0x22f7('0xa')]('/',auth[_0x22f7('0xb')](),controller['index']);router[_0x22f7('0xa')](_0x22f7('0xc'),auth[_0x22f7('0xb')](),controller[_0x22f7('0xd')]);router[_0x22f7('0xa')](_0x22f7('0xe'),auth[_0x22f7('0xb')](),controller[_0x22f7('0xf')]);router[_0x22f7('0xa')]('/:id',auth[_0x22f7('0xb')](),controller['show']);router[_0x22f7('0x10')]('/',auth[_0x22f7('0xb')](),controller[_0x22f7('0x11')]);router[_0x22f7('0x12')](_0x22f7('0x13'),auth[_0x22f7('0xb')](),controller['update']);router[_0x22f7('0x14')](_0x22f7('0x13'),auth[_0x22f7('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x428e=['get','isAuthenticated','index','describe','getVoiceQueuesReport','/:id','show','create','put','update','destroy','exports','multer','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x428e,0x1a4));var _0xe428=function(_0x28e2cd,_0x153b42){_0x28e2cd=_0x28e2cd-0x0;var _0x11fd46=_0x428e[_0x28e2cd];return _0x11fd46;};'use strict';var multer=require(_0xe428('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe428('0x1'));var router=express[_0xe428('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe428('0x3'));var config=require(_0xe428('0x4'));var controller=require('./voiceQueueReport.controller');router[_0xe428('0x5')]('/',auth[_0xe428('0x6')](),controller[_0xe428('0x7')]);router[_0xe428('0x5')]('/describe',auth[_0xe428('0x6')](),controller[_0xe428('0x8')]);router[_0xe428('0x5')]('/index',auth[_0xe428('0x6')](),controller[_0xe428('0x9')]);router['get'](_0xe428('0xa'),auth[_0xe428('0x6')](),controller[_0xe428('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe428('0xc')]);router[_0xe428('0xd')](_0xe428('0xa'),auth[_0xe428('0x6')](),controller[_0xe428('0xe')]);router['delete'](_0xe428('0xa'),auth[_0xe428('0x6')](),controller[_0xe428('0xf')]);module[_0xe428('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 a47581c..c39061b 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 _0x5234=['sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x3434d7,_0x4d4eb0){var _0x51eebd=function(_0x37161c){while(--_0x37161c){_0x3434d7['push'](_0x3434d7['shift']());}};_0x51eebd(++_0x4d4eb0);}(_0x5234,0x168));var _0x4523=function(_0x208a3a,_0x2cf1b7){_0x208a3a=_0x208a3a-0x0;var _0x25f796=_0x5234[_0x208a3a];return _0x25f796;};'use strict';var Sequelize=require(_0x4523('0x0'));var moment=require(_0x4523('0x1'));module[_0x4523('0x2')]={'type':{'type':Sequelize[_0x4523('0x3')]},'uniqueid':{'type':Sequelize[_0x4523('0x3')]},'calleridnum':{'type':Sequelize[_0x4523('0x3')]},'calleridname':{'type':Sequelize[_0x4523('0x3')]},'queue':{'type':Sequelize[_0x4523('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x4523('0x4')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x357ca1){var _0x2a2234=moment(_0x357ca1);var _0x7c76d1=moment(this[_0x4523('0x5')](_0x4523('0x6')))['format'](_0x4523('0x7'));var _0x243a1e=_0x2a2234['diff'](_0x7c76d1,_0x4523('0x8'));this[_0x4523('0x9')](_0x4523('0xa'),_0x357ca1);this[_0x4523('0x9')](_0x4523('0xb'),_0x243a1e||null);}},'position':{'type':Sequelize[_0x4523('0xc')]},'count':{'type':Sequelize[_0x4523('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x4523('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x4523('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x4523('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x4523('0x4')]},'queuecallerexit':{'type':Sequelize[_0x4523('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x4523('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x4523('0x3')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4523('0x3')]},'context':{'type':Sequelize[_0x4523('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x4523('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x4523('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x4523('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x4523('0x3')]},'transfer':{'type':Sequelize[_0x4523('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4523('0x3')],'comment':_0x4523('0xe')},'transferexten':{'type':Sequelize[_0x4523('0x3')]},'transferuniqueid':{'type':Sequelize[_0x4523('0x3')]},'disposition':{'type':Sequelize[_0x4523('0x3')]},'secondDisposition':{'type':Sequelize[_0x4523('0x3')]},'thirdDisposition':{'type':Sequelize[_0x4523('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x1fae=['holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt'];(function(_0x2ed6ce,_0x48875c){var _0x537266=function(_0x2972e7){while(--_0x2972e7){_0x2ed6ce['push'](_0x2ed6ce['shift']());}};_0x537266(++_0x48875c);}(_0x1fae,0xc4));var _0xe1fa=function(_0x17d581,_0x55ec2a){_0x17d581=_0x17d581-0x0;var _0x137ab8=_0x1fae[_0x17d581];return _0x137ab8;};'use strict';var Sequelize=require(_0xe1fa('0x0'));var moment=require(_0xe1fa('0x1'));module['exports']={'type':{'type':Sequelize[_0xe1fa('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe1fa('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xe1fa('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xe1fa('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x5eed22){var _0x2628c9=moment(_0x5eed22);var _0x4eb347=moment(this[_0xe1fa('0x4')](_0xe1fa('0x5')))[_0xe1fa('0x6')](_0xe1fa('0x7'));var _0x1a8492=_0x2628c9[_0xe1fa('0x8')](_0x4eb347,_0xe1fa('0x9'));this[_0xe1fa('0xa')](_0xe1fa('0xb'),_0x5eed22);this['setDataValue'](_0xe1fa('0xc'),_0x1a8492||null);}},'position':{'type':Sequelize[_0xe1fa('0xd')]},'count':{'type':Sequelize[_0xe1fa('0xd')]},'queuecallerabandon':{'type':Sequelize[_0xe1fa('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xe1fa('0x3')]},'queuecallercomplete':{'type':Sequelize[_0xe1fa('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xe1fa('0x3')]},'queuecallerexit':{'type':Sequelize[_0xe1fa('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xe1fa('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0xe1fa('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0xe1fa('0xd')]},'channel':{'type':Sequelize[_0xe1fa('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xe1fa('0x2')]},'accountcode':{'type':Sequelize[_0xe1fa('0x2')]},'context':{'type':Sequelize[_0xe1fa('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xe1fa('0x2')]},'holdtime':{'type':Sequelize[_0xe1fa('0xd')]},'mohtime':{'type':Sequelize[_0xe1fa('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xe1fa('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xe1fa('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xe1fa('0x2')],'comment':_0xe1fa('0xf')},'transferexten':{'type':Sequelize[_0xe1fa('0x2')]},'transferuniqueid':{'type':Sequelize[_0xe1fa('0x2')]},'disposition':{'type':Sequelize[_0xe1fa('0x2')]},'secondDisposition':{'type':Sequelize[_0xe1fa('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0xe1fa('0xd')],'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 8a69463..f93d30c 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 _0x2cf5=['filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','keys','fields','options','find','create','body','catch','update','params','destroy','describe','getVoiceQueuesReport','rawAttributes','pick','filter','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','undefined','limit','offset','count','Content-Range','json','apply','save','then','error','stack','name','index','map','VoiceQueueReport','fieldName','type','key','model','query'];(function(_0x479774,_0x393894){var _0x5f4e5c=function(_0x59f7d2){while(--_0x59f7d2){_0x479774['push'](_0x479774['shift']());}};_0x5f4e5c(++_0x393894);}(_0x2cf5,0xcf));var _0x52cf=function(_0x1fcf4b,_0x350862){_0x1fcf4b=_0x1fcf4b-0x0;var _0x188d70=_0x2cf5[_0x1fcf4b];return _0x188d70;};'use strict';var emlformat=require(_0x52cf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x52cf('0x1'));var jsonpatch=require(_0x52cf('0x2'));var rp=require(_0x52cf('0x3'));var moment=require('moment');var BPromise=require(_0x52cf('0x4'));var Mustache=require(_0x52cf('0x5'));var util=require(_0x52cf('0x6'));var path=require(_0x52cf('0x7'));var sox=require(_0x52cf('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x52cf('0x9'));var squel=require(_0x52cf('0xa'));var crypto=require(_0x52cf('0xb'));var jsforce=require(_0x52cf('0xc'));var deskjs=require(_0x52cf('0xd'));var toCsv=require(_0x52cf('0xe'));var querystring=require(_0x52cf('0xf'));var Papa=require(_0x52cf('0x10'));var Redis=require(_0x52cf('0x11'));var authService=require(_0x52cf('0x12'));var qs=require(_0x52cf('0x13'));var as=require(_0x52cf('0x14'));var hardwareService=require(_0x52cf('0x15'));var logger=require(_0x52cf('0x16'))(_0x52cf('0x17'));var utils=require(_0x52cf('0x18'));var config=require(_0x52cf('0x19'));var licenseUtil=require(_0x52cf('0x1a'));var db=require(_0x52cf('0x1b'))['db'];config[_0x52cf('0x1c')]=_[_0x52cf('0x1d')](config[_0x52cf('0x1c')],{'host':_0x52cf('0x1e'),'port':0x18eb});var socket=require(_0x52cf('0x1f'))(new Redis(config[_0x52cf('0x1c')]));require(_0x52cf('0x20'))[_0x52cf('0x21')](socket);function respondWithStatusCode(_0x4d35f4,_0x1bee77){_0x1bee77=_0x1bee77||0xcc;return function(_0x3d443e){if(_0x3d443e){return _0x4d35f4[_0x52cf('0x22')](_0x1bee77);}return _0x4d35f4[_0x52cf('0x23')](_0x1bee77)[_0x52cf('0x24')]();};}function respondWithResult(_0x515b43,_0x2ed933){_0x2ed933=_0x2ed933||0xc8;return function(_0x18fb45){if(_0x18fb45){return _0x515b43[_0x52cf('0x23')](_0x2ed933)['json'](_0x18fb45);}};}function respondWithFilteredResult(_0xcc868d,_0x4ebd8d){return function(_0x106d3f){if(_0x106d3f){var _0x3aba09=typeof _0x4ebd8d['offset']===_0x52cf('0x25')&&typeof _0x4ebd8d[_0x52cf('0x26')]===_0x52cf('0x25');var _0x2983a6=_0x106d3f['count'];var _0x36c035=_0x3aba09?0x0:_0x4ebd8d[_0x52cf('0x27')];var _0xd227f9=_0x3aba09?_0x106d3f[_0x52cf('0x28')]:_0x4ebd8d[_0x52cf('0x27')]+_0x4ebd8d['limit'];var _0x29bc32;if(_0xd227f9>=_0x2983a6){_0xd227f9=_0x2983a6;_0x29bc32=0xc8;}else{_0x29bc32=0xce;}_0xcc868d[_0x52cf('0x23')](_0x29bc32);return _0xcc868d['set'](_0x52cf('0x29'),_0x36c035+'-'+_0xd227f9+'/'+_0x2983a6)[_0x52cf('0x2a')](_0x106d3f);}return null;};}function patchUpdates(_0x8f989d){return function(_0x548eb1){try{jsonpatch[_0x52cf('0x2b')](_0x548eb1,_0x8f989d,!![]);}catch(_0x53311b){return BPromise['reject'](_0x53311b);}return _0x548eb1[_0x52cf('0x2c')]();};}function saveUpdates(_0x58acdc,_0x5bd1bb){return function(_0x4bf1d5){if(_0x4bf1d5){return _0x4bf1d5['update'](_0x58acdc)[_0x52cf('0x2d')](function(_0x57ea68){return _0x57ea68;});}return null;};}function removeEntity(_0xffa72b,_0x40de8d){return function(_0x17ba0e){if(_0x17ba0e){return _0x17ba0e['destroy']()[_0x52cf('0x2d')](function(){_0xffa72b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a3eee,_0x2b15b9){return function(_0x3215bd){if(!_0x3215bd){_0x2a3eee['sendStatus'](0x194);}return _0x3215bd;};}function handleError(_0x45dbb3,_0x5a8828){_0x5a8828=_0x5a8828||0x1f4;return function(_0x51b654){logger[_0x52cf('0x2e')](_0x51b654[_0x52cf('0x2f')]);if(_0x51b654[_0x52cf('0x30')]){delete _0x51b654[_0x52cf('0x30')];}_0x45dbb3[_0x52cf('0x23')](_0x5a8828)['send'](_0x51b654);};}exports[_0x52cf('0x31')]=function(_0x4472cd,_0x454cd5){var _0x2f573f={},_0x1c5304={},_0x45fd2d={'count':0x0,'rows':[]};var _0x30b474=_[_0x52cf('0x32')](db[_0x52cf('0x33')]['rawAttributes'],function(_0x5f4bb7){return{'name':_0x5f4bb7[_0x52cf('0x34')],'type':_0x5f4bb7[_0x52cf('0x35')][_0x52cf('0x36')]};});_0x1c5304[_0x52cf('0x37')]=_[_0x52cf('0x32')](_0x30b474,_0x52cf('0x30'));_0x1c5304['query']=_['keys'](_0x4472cd[_0x52cf('0x38')]);_0x1c5304[_0x52cf('0x39')]=_[_0x52cf('0x3a')](_0x1c5304[_0x52cf('0x37')],_0x1c5304['query']);_0x2f573f[_0x52cf('0x3b')]=_[_0x52cf('0x3a')](_0x1c5304['model'],qs['fields'](_0x4472cd['query']['fields']));_0x2f573f['attributes']=_0x2f573f[_0x52cf('0x3b')][_0x52cf('0x3c')]?_0x2f573f[_0x52cf('0x3b')]:_0x1c5304['model'];if(!_0x4472cd['query'][_0x52cf('0x3d')](_0x52cf('0x3e'))){_0x2f573f[_0x52cf('0x26')]=qs[_0x52cf('0x26')](_0x4472cd['query']['limit']);_0x2f573f[_0x52cf('0x27')]=qs['offset'](_0x4472cd[_0x52cf('0x38')]['offset']);}_0x2f573f[_0x52cf('0x3f')]=qs[_0x52cf('0x40')](_0x4472cd[_0x52cf('0x38')][_0x52cf('0x40')]);_0x2f573f['where']=qs[_0x52cf('0x39')](_['pick'](_0x4472cd[_0x52cf('0x38')],_0x1c5304[_0x52cf('0x39')]),_0x30b474);if(_0x4472cd[_0x52cf('0x38')]['filter']){_0x2f573f[_0x52cf('0x41')]=_[_0x52cf('0x42')](_0x2f573f[_0x52cf('0x41')],{'$or':_[_0x52cf('0x32')](_0x30b474,function(_0x15672c){if(_0x15672c['type']!==_0x52cf('0x43')){var _0x4d31e0={};_0x4d31e0[_0x15672c[_0x52cf('0x30')]]={'$like':'%'+_0x4472cd[_0x52cf('0x38')]['filter']+'%'};return _0x4d31e0;}})});}_0x2f573f=_[_0x52cf('0x42')]({},_0x2f573f,_0x4472cd['options']);var _0x1f9b81={'where':_0x2f573f[_0x52cf('0x41')]};return db[_0x52cf('0x33')][_0x52cf('0x28')](_0x1f9b81)[_0x52cf('0x2d')](function(_0x55ab2c){_0x45fd2d[_0x52cf('0x28')]=_0x55ab2c;if(_0x4472cd[_0x52cf('0x38')][_0x52cf('0x44')]){_0x2f573f[_0x52cf('0x45')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x52cf('0x46')](_0x2f573f);})[_0x52cf('0x2d')](function(_0x5a5bbb){_0x45fd2d[_0x52cf('0x47')]=_0x5a5bbb;return _0x45fd2d;})[_0x52cf('0x2d')](respondWithFilteredResult(_0x454cd5,_0x2f573f))['catch'](handleError(_0x454cd5,null));};exports[_0x52cf('0x48')]=function(_0x1aaf49,_0x3a20a0){var _0x4cf2e4={'raw':![],'where':{'id':_0x1aaf49['params']['id']}},_0x4db67b={};_0x4db67b['model']=_['keys'](db[_0x52cf('0x33')]['rawAttributes']);_0x4db67b['query']=_[_0x52cf('0x49')](_0x1aaf49[_0x52cf('0x38')]);_0x4db67b['filters']=_[_0x52cf('0x3a')](_0x4db67b[_0x52cf('0x37')],_0x4db67b[_0x52cf('0x38')]);_0x4cf2e4[_0x52cf('0x3b')]=_[_0x52cf('0x3a')](_0x4db67b[_0x52cf('0x37')],qs[_0x52cf('0x4a')](_0x1aaf49['query'][_0x52cf('0x4a')]));_0x4cf2e4[_0x52cf('0x3b')]=_0x4cf2e4[_0x52cf('0x3b')][_0x52cf('0x3c')]?_0x4cf2e4[_0x52cf('0x3b')]:_0x4db67b[_0x52cf('0x37')];if(_0x1aaf49['query'][_0x52cf('0x44')]){_0x4cf2e4[_0x52cf('0x45')]=[{'all':!![]}];}_0x4cf2e4=_[_0x52cf('0x42')]({},_0x4cf2e4,_0x1aaf49[_0x52cf('0x4b')]);return db[_0x52cf('0x33')][_0x52cf('0x4c')](_0x4cf2e4)[_0x52cf('0x2d')](handleEntityNotFound(_0x3a20a0,null))[_0x52cf('0x2d')](respondWithResult(_0x3a20a0,null))['catch'](handleError(_0x3a20a0,null));};exports[_0x52cf('0x4d')]=function(_0x4f32c6,_0x3216d1){return db['VoiceQueueReport'][_0x52cf('0x4d')](_0x4f32c6[_0x52cf('0x4e')],{})['then'](respondWithResult(_0x3216d1,0xc9))[_0x52cf('0x4f')](handleError(_0x3216d1,null));};exports[_0x52cf('0x50')]=function(_0x390eaa,_0x568e76){if(_0x390eaa[_0x52cf('0x4e')]['id']){delete _0x390eaa[_0x52cf('0x4e')]['id'];}return db['VoiceQueueReport']['find']({'where':{'id':_0x390eaa[_0x52cf('0x51')]['id']}})[_0x52cf('0x2d')](handleEntityNotFound(_0x568e76,null))[_0x52cf('0x2d')](saveUpdates(_0x390eaa[_0x52cf('0x4e')],null))[_0x52cf('0x2d')](respondWithResult(_0x568e76,null))[_0x52cf('0x4f')](handleError(_0x568e76,null));};exports[_0x52cf('0x52')]=function(_0x5a32a1,_0x262022){return db[_0x52cf('0x33')][_0x52cf('0x4c')]({'where':{'id':_0x5a32a1[_0x52cf('0x51')]['id']}})[_0x52cf('0x2d')](handleEntityNotFound(_0x262022,null))['then'](removeEntity(_0x262022,null))[_0x52cf('0x4f')](handleError(_0x262022,null));};exports['describe']=function(_0x25c38e,_0x6ea2c3){return db['VoiceQueueReport'][_0x52cf('0x53')]()['then'](respondWithResult(_0x6ea2c3,null))[_0x52cf('0x4f')](handleError(_0x6ea2c3,null));};exports[_0x52cf('0x54')]=function(_0x37f1e6,_0x10ea30){var _0x1dc6b1={},_0x443279={},_0x21097a={'count':0x0,'rows':[]};_0x443279['model']=_['keys'](db[_0x52cf('0x33')][_0x52cf('0x55')]);_0x443279[_0x52cf('0x38')]=_[_0x52cf('0x49')](_0x37f1e6[_0x52cf('0x38')]);_0x443279['filters']=_[_0x52cf('0x3a')](_0x443279[_0x52cf('0x37')],_0x443279[_0x52cf('0x38')]);_0x1dc6b1[_0x52cf('0x3b')]=_[_0x52cf('0x3a')](_0x443279[_0x52cf('0x37')],qs[_0x52cf('0x4a')](_0x37f1e6[_0x52cf('0x38')][_0x52cf('0x4a')]));_0x1dc6b1['attributes']=_0x1dc6b1[_0x52cf('0x3b')][_0x52cf('0x3c')]?_0x1dc6b1[_0x52cf('0x3b')]:_0x443279['model'];if(!_0x37f1e6[_0x52cf('0x38')]['hasOwnProperty'](_0x52cf('0x3e'))){_0x1dc6b1['limit']=qs['limit'](_0x37f1e6[_0x52cf('0x38')][_0x52cf('0x26')]);_0x1dc6b1[_0x52cf('0x27')]=qs[_0x52cf('0x27')](_0x37f1e6['query'][_0x52cf('0x27')]);}_0x1dc6b1[_0x52cf('0x3f')]=qs[_0x52cf('0x40')](_0x37f1e6[_0x52cf('0x38')]['sort']);_0x1dc6b1['where']=qs['filters'](_[_0x52cf('0x56')](_0x37f1e6[_0x52cf('0x38')],_0x443279[_0x52cf('0x39')]));if(_0x37f1e6[_0x52cf('0x38')]['filter']){_0x1dc6b1[_0x52cf('0x41')]=_[_0x52cf('0x42')](_0x1dc6b1['where'],{'$or':_[_0x52cf('0x32')](_0x1dc6b1[_0x52cf('0x3b')],function(_0x14a690){var _0x2bbd52={};_0x2bbd52[_0x14a690]={'$like':'%'+_0x37f1e6['query'][_0x52cf('0x57')]+'%'};return _0x2bbd52;})});}_0x1dc6b1=_[_0x52cf('0x42')]({},_0x1dc6b1,_0x37f1e6[_0x52cf('0x4b')]);var _0x1df310={'where':_0x1dc6b1[_0x52cf('0x41')]};return db[_0x52cf('0x33')]['count'](_0x1df310)[_0x52cf('0x2d')](function(_0x1ae6a7){_0x21097a[_0x52cf('0x28')]=_0x1ae6a7;if(_0x37f1e6[_0x52cf('0x38')][_0x52cf('0x44')]){_0x1dc6b1['include']=[{'all':!![]}];}return db[_0x52cf('0x33')][_0x52cf('0x46')](_0x1dc6b1);})['then'](function(_0x40fec2){_0x21097a[_0x52cf('0x47')]=_0x40fec2;return _0x21097a;})[_0x52cf('0x2d')](respondWithFilteredResult(_0x10ea30,_0x1dc6b1,_0x52cf('0x54')))['catch'](handleError(_0x10ea30,null,_0x52cf('0x54')));}; \ No newline at end of file +var _0x7ecc=['request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','defaults','localhost','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','include','findAll','rows','catch','options','find','create','body','params','describe','getVoiceQueuesReport','includeAll','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x15feec,_0x3ea062){var _0x20fe9f=function(_0x149946){while(--_0x149946){_0x15feec['push'](_0x15feec['shift']());}};_0x20fe9f(++_0x3ea062);}(_0x7ecc,0x1e8));var _0xc7ec=function(_0x19b351,_0x24aa5d){_0x19b351=_0x19b351-0x0;var _0x8c1982=_0x7ecc[_0x19b351];return _0x8c1982;};'use strict';var emlformat=require(_0xc7ec('0x0'));var rimraf=require(_0xc7ec('0x1'));var zipdir=require(_0xc7ec('0x2'));var jsonpatch=require(_0xc7ec('0x3'));var rp=require(_0xc7ec('0x4'));var moment=require(_0xc7ec('0x5'));var BPromise=require(_0xc7ec('0x6'));var Mustache=require(_0xc7ec('0x7'));var util=require(_0xc7ec('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xc7ec('0x9'));var ejs=require(_0xc7ec('0xa'));var fs=require('fs');var fs_extra=require(_0xc7ec('0xb'));var _=require(_0xc7ec('0xc'));var squel=require(_0xc7ec('0xd'));var crypto=require('crypto');var jsforce=require(_0xc7ec('0xe'));var deskjs=require(_0xc7ec('0xf'));var toCsv=require(_0xc7ec('0x9'));var querystring=require('querystring');var Papa=require(_0xc7ec('0x10'));var Redis=require(_0xc7ec('0x11'));var authService=require(_0xc7ec('0x12'));var qs=require(_0xc7ec('0x13'));var as=require(_0xc7ec('0x14'));var hardwareService=require(_0xc7ec('0x15'));var logger=require(_0xc7ec('0x16'))('api');var utils=require(_0xc7ec('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc7ec('0x18'));var db=require('../../mysqldb')['db'];config[_0xc7ec('0x19')]=_[_0xc7ec('0x1a')](config[_0xc7ec('0x19')],{'host':_0xc7ec('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc7ec('0x19')]));require(_0xc7ec('0x1c'))[_0xc7ec('0x1d')](socket);function respondWithStatusCode(_0x16e844,_0x106098){_0x106098=_0x106098||0xcc;return function(_0x5be03f){if(_0x5be03f){return _0x16e844[_0xc7ec('0x1e')](_0x106098);}return _0x16e844[_0xc7ec('0x1f')](_0x106098)[_0xc7ec('0x20')]();};}function respondWithResult(_0x49e1ab,_0x1bac30){_0x1bac30=_0x1bac30||0xc8;return function(_0x14ae7e){if(_0x14ae7e){return _0x49e1ab[_0xc7ec('0x1f')](_0x1bac30)[_0xc7ec('0x21')](_0x14ae7e);}};}function respondWithFilteredResult(_0x398e42,_0x546f45){return function(_0x15826e){if(_0x15826e){var _0x32fbdc=typeof _0x546f45[_0xc7ec('0x22')]===_0xc7ec('0x23')&&typeof _0x546f45[_0xc7ec('0x24')]===_0xc7ec('0x23');var _0x348381=_0x15826e[_0xc7ec('0x25')];var _0x169d1d=_0x32fbdc?0x0:_0x546f45[_0xc7ec('0x22')];var _0x5e0228=_0x32fbdc?_0x15826e[_0xc7ec('0x25')]:_0x546f45[_0xc7ec('0x22')]+_0x546f45[_0xc7ec('0x24')];var _0x2bab51;if(_0x5e0228>=_0x348381){_0x5e0228=_0x348381;_0x2bab51=0xc8;}else{_0x2bab51=0xce;}_0x398e42['status'](_0x2bab51);return _0x398e42['set'](_0xc7ec('0x26'),_0x169d1d+'-'+_0x5e0228+'/'+_0x348381)[_0xc7ec('0x21')](_0x15826e);}return null;};}function patchUpdates(_0x2e0bd3){return function(_0x465afe){try{jsonpatch[_0xc7ec('0x27')](_0x465afe,_0x2e0bd3,!![]);}catch(_0x3ca03e){return BPromise[_0xc7ec('0x28')](_0x3ca03e);}return _0x465afe['save']();};}function saveUpdates(_0x4693f6,_0x4a6d2d){return function(_0xc4a77b){if(_0xc4a77b){return _0xc4a77b[_0xc7ec('0x29')](_0x4693f6)[_0xc7ec('0x2a')](function(_0x33c04a){return _0x33c04a;});}return null;};}function removeEntity(_0x542e31,_0x1557f1){return function(_0xdd64ed){if(_0xdd64ed){return _0xdd64ed[_0xc7ec('0x2b')]()[_0xc7ec('0x2a')](function(){_0x542e31[_0xc7ec('0x1f')](0xcc)[_0xc7ec('0x20')]();});}};}function handleEntityNotFound(_0x29187a,_0x2ac525){return function(_0x38fbef){if(!_0x38fbef){_0x29187a[_0xc7ec('0x1e')](0x194);}return _0x38fbef;};}function handleError(_0x4dd1b8,_0x361c6f){_0x361c6f=_0x361c6f||0x1f4;return function(_0x1bf17f){logger[_0xc7ec('0x2c')](_0x1bf17f[_0xc7ec('0x2d')]);if(_0x1bf17f[_0xc7ec('0x2e')]){delete _0x1bf17f['name'];}_0x4dd1b8['status'](_0x361c6f)[_0xc7ec('0x2f')](_0x1bf17f);};}exports[_0xc7ec('0x30')]=function(_0x5a464e,_0x4deb36){var _0x4bb2ca={},_0x2e09d3={},_0x271e2e={'count':0x0,'rows':[]};var _0x223d4e=_[_0xc7ec('0x31')](db[_0xc7ec('0x32')][_0xc7ec('0x33')],function(_0x130d2c){return{'name':_0x130d2c[_0xc7ec('0x34')],'type':_0x130d2c[_0xc7ec('0x35')][_0xc7ec('0x36')]};});_0x2e09d3[_0xc7ec('0x37')]=_[_0xc7ec('0x31')](_0x223d4e,_0xc7ec('0x2e'));_0x2e09d3['query']=_[_0xc7ec('0x38')](_0x5a464e['query']);_0x2e09d3[_0xc7ec('0x39')]=_[_0xc7ec('0x3a')](_0x2e09d3[_0xc7ec('0x37')],_0x2e09d3[_0xc7ec('0x3b')]);_0x4bb2ca[_0xc7ec('0x3c')]=_[_0xc7ec('0x3a')](_0x2e09d3[_0xc7ec('0x37')],qs['fields'](_0x5a464e[_0xc7ec('0x3b')][_0xc7ec('0x3d')]));_0x4bb2ca[_0xc7ec('0x3c')]=_0x4bb2ca['attributes'][_0xc7ec('0x3e')]?_0x4bb2ca[_0xc7ec('0x3c')]:_0x2e09d3['model'];if(!_0x5a464e[_0xc7ec('0x3b')][_0xc7ec('0x3f')]('nolimit')){_0x4bb2ca[_0xc7ec('0x24')]=qs[_0xc7ec('0x24')](_0x5a464e[_0xc7ec('0x3b')][_0xc7ec('0x24')]);_0x4bb2ca[_0xc7ec('0x22')]=qs[_0xc7ec('0x22')](_0x5a464e[_0xc7ec('0x3b')][_0xc7ec('0x22')]);}_0x4bb2ca[_0xc7ec('0x40')]=qs[_0xc7ec('0x41')](_0x5a464e[_0xc7ec('0x3b')][_0xc7ec('0x41')]);_0x4bb2ca[_0xc7ec('0x42')]=qs[_0xc7ec('0x39')](_[_0xc7ec('0x43')](_0x5a464e[_0xc7ec('0x3b')],_0x2e09d3[_0xc7ec('0x39')]),_0x223d4e);if(_0x5a464e[_0xc7ec('0x3b')][_0xc7ec('0x44')]){_0x4bb2ca['where']=_['merge'](_0x4bb2ca[_0xc7ec('0x42')],{'$or':_['map'](_0x223d4e,function(_0x533970){if(_0x533970['type']!=='VIRTUAL'){var _0x598b62={};_0x598b62[_0x533970[_0xc7ec('0x2e')]]={'$like':'%'+_0x5a464e[_0xc7ec('0x3b')][_0xc7ec('0x44')]+'%'};return _0x598b62;}})});}_0x4bb2ca=_[_0xc7ec('0x45')]({},_0x4bb2ca,_0x5a464e['options']);var _0xe7358a={'where':_0x4bb2ca[_0xc7ec('0x42')]};return db[_0xc7ec('0x32')][_0xc7ec('0x25')](_0xe7358a)[_0xc7ec('0x2a')](function(_0x21ce13){_0x271e2e[_0xc7ec('0x25')]=_0x21ce13;if(_0x5a464e[_0xc7ec('0x3b')]['includeAll']){_0x4bb2ca[_0xc7ec('0x46')]=[{'all':!![]}];}return db[_0xc7ec('0x32')][_0xc7ec('0x47')](_0x4bb2ca);})[_0xc7ec('0x2a')](function(_0x3c12cc){_0x271e2e[_0xc7ec('0x48')]=_0x3c12cc;return _0x271e2e;})[_0xc7ec('0x2a')](respondWithFilteredResult(_0x4deb36,_0x4bb2ca))[_0xc7ec('0x49')](handleError(_0x4deb36,null));};exports['show']=function(_0x303981,_0x4622b7){var _0x3807e5={'raw':![],'where':{'id':_0x303981['params']['id']}},_0x342fb5={};_0x342fb5['model']=_[_0xc7ec('0x38')](db[_0xc7ec('0x32')]['rawAttributes']);_0x342fb5[_0xc7ec('0x3b')]=_['keys'](_0x303981['query']);_0x342fb5[_0xc7ec('0x39')]=_[_0xc7ec('0x3a')](_0x342fb5[_0xc7ec('0x37')],_0x342fb5[_0xc7ec('0x3b')]);_0x3807e5[_0xc7ec('0x3c')]=_[_0xc7ec('0x3a')](_0x342fb5['model'],qs[_0xc7ec('0x3d')](_0x303981[_0xc7ec('0x3b')][_0xc7ec('0x3d')]));_0x3807e5[_0xc7ec('0x3c')]=_0x3807e5['attributes'][_0xc7ec('0x3e')]?_0x3807e5[_0xc7ec('0x3c')]:_0x342fb5[_0xc7ec('0x37')];if(_0x303981[_0xc7ec('0x3b')]['includeAll']){_0x3807e5[_0xc7ec('0x46')]=[{'all':!![]}];}_0x3807e5=_['merge']({},_0x3807e5,_0x303981[_0xc7ec('0x4a')]);return db['VoiceQueueReport'][_0xc7ec('0x4b')](_0x3807e5)[_0xc7ec('0x2a')](handleEntityNotFound(_0x4622b7,null))['then'](respondWithResult(_0x4622b7,null))[_0xc7ec('0x49')](handleError(_0x4622b7,null));};exports[_0xc7ec('0x4c')]=function(_0x65d5ee,_0x495ec3){return db[_0xc7ec('0x32')][_0xc7ec('0x4c')](_0x65d5ee[_0xc7ec('0x4d')],{})[_0xc7ec('0x2a')](respondWithResult(_0x495ec3,0xc9))[_0xc7ec('0x49')](handleError(_0x495ec3,null));};exports['update']=function(_0x5d3cc5,_0x515ae2){if(_0x5d3cc5[_0xc7ec('0x4d')]['id']){delete _0x5d3cc5[_0xc7ec('0x4d')]['id'];}return db[_0xc7ec('0x32')][_0xc7ec('0x4b')]({'where':{'id':_0x5d3cc5[_0xc7ec('0x4e')]['id']}})[_0xc7ec('0x2a')](handleEntityNotFound(_0x515ae2,null))[_0xc7ec('0x2a')](saveUpdates(_0x5d3cc5['body'],null))['then'](respondWithResult(_0x515ae2,null))['catch'](handleError(_0x515ae2,null));};exports[_0xc7ec('0x2b')]=function(_0x2fdb2d,_0x3a35fd){return db[_0xc7ec('0x32')][_0xc7ec('0x4b')]({'where':{'id':_0x2fdb2d[_0xc7ec('0x4e')]['id']}})[_0xc7ec('0x2a')](handleEntityNotFound(_0x3a35fd,null))[_0xc7ec('0x2a')](removeEntity(_0x3a35fd,null))[_0xc7ec('0x49')](handleError(_0x3a35fd,null));};exports['describe']=function(_0x14478c,_0x414e5b){return db[_0xc7ec('0x32')][_0xc7ec('0x4f')]()[_0xc7ec('0x2a')](respondWithResult(_0x414e5b,null))[_0xc7ec('0x49')](handleError(_0x414e5b,null));};exports[_0xc7ec('0x50')]=function(_0xace8fb,_0x59b7c4){var _0x3d33c0={},_0x3b95c9={},_0x249e51={'count':0x0,'rows':[]};_0x3b95c9[_0xc7ec('0x37')]=_[_0xc7ec('0x38')](db['VoiceQueueReport'][_0xc7ec('0x33')]);_0x3b95c9[_0xc7ec('0x3b')]=_[_0xc7ec('0x38')](_0xace8fb[_0xc7ec('0x3b')]);_0x3b95c9[_0xc7ec('0x39')]=_[_0xc7ec('0x3a')](_0x3b95c9[_0xc7ec('0x37')],_0x3b95c9['query']);_0x3d33c0['attributes']=_[_0xc7ec('0x3a')](_0x3b95c9['model'],qs[_0xc7ec('0x3d')](_0xace8fb['query'][_0xc7ec('0x3d')]));_0x3d33c0[_0xc7ec('0x3c')]=_0x3d33c0['attributes']['length']?_0x3d33c0[_0xc7ec('0x3c')]:_0x3b95c9[_0xc7ec('0x37')];if(!_0xace8fb['query'][_0xc7ec('0x3f')]('nolimit')){_0x3d33c0['limit']=qs[_0xc7ec('0x24')](_0xace8fb[_0xc7ec('0x3b')][_0xc7ec('0x24')]);_0x3d33c0[_0xc7ec('0x22')]=qs[_0xc7ec('0x22')](_0xace8fb[_0xc7ec('0x3b')][_0xc7ec('0x22')]);}_0x3d33c0[_0xc7ec('0x40')]=qs['sort'](_0xace8fb['query'][_0xc7ec('0x41')]);_0x3d33c0[_0xc7ec('0x42')]=qs['filters'](_[_0xc7ec('0x43')](_0xace8fb[_0xc7ec('0x3b')],_0x3b95c9[_0xc7ec('0x39')]));if(_0xace8fb[_0xc7ec('0x3b')][_0xc7ec('0x44')]){_0x3d33c0[_0xc7ec('0x42')]=_[_0xc7ec('0x45')](_0x3d33c0[_0xc7ec('0x42')],{'$or':_[_0xc7ec('0x31')](_0x3d33c0[_0xc7ec('0x3c')],function(_0x4e08b2){var _0x4a8132={};_0x4a8132[_0x4e08b2]={'$like':'%'+_0xace8fb['query']['filter']+'%'};return _0x4a8132;})});}_0x3d33c0=_[_0xc7ec('0x45')]({},_0x3d33c0,_0xace8fb[_0xc7ec('0x4a')]);var _0x14698f={'where':_0x3d33c0['where']};return db[_0xc7ec('0x32')][_0xc7ec('0x25')](_0x14698f)['then'](function(_0x4e7af4){_0x249e51[_0xc7ec('0x25')]=_0x4e7af4;if(_0xace8fb[_0xc7ec('0x3b')][_0xc7ec('0x51')]){_0x3d33c0[_0xc7ec('0x46')]=[{'all':!![]}];}return db[_0xc7ec('0x32')]['findAll'](_0x3d33c0);})['then'](function(_0x4f547b){_0x249e51['rows']=_0x4f547b;return _0x249e51;})[_0xc7ec('0x2a')](respondWithFilteredResult(_0x59b7c4,_0x3d33c0,_0xc7ec('0x50')))[_0xc7ec('0x49')](handleError(_0x59b7c4,null,_0xc7ec('0x50')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index d643d5d..2e7eabe 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 _0x1b1f=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save'];(function(_0x4c8695,_0x2e959b){var _0x3e9382=function(_0x18407f){while(--_0x18407f){_0x4c8695['push'](_0x4c8695['shift']());}};_0x3e9382(++_0x2e959b);}(_0x1b1f,0xc3));var _0xf1b1=function(_0x263f9d,_0x2fa449){_0x263f9d=_0x263f9d-0x0;var _0x2abead=_0x1b1f[_0x263f9d];return _0x2abead;};'use strict';var EventEmitter=require(_0xf1b1('0x0'));var VoiceQueueReport=require(_0xf1b1('0x1'))['db'][_0xf1b1('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xf1b1('0x3')](0x0);var events={'afterCreate':_0xf1b1('0x4'),'afterUpdate':_0xf1b1('0x5'),'afterDestroy':'remove'};function emitEvent(_0x420348){return function(_0x239f7e,_0x35552b,_0x40d17e){VoiceQueueReportEvents[_0xf1b1('0x6')](_0x420348+':'+_0x239f7e['id'],_0x239f7e);VoiceQueueReportEvents[_0xf1b1('0x6')](_0x420348,_0x239f7e);_0x40d17e(null);};}for(var e in events){if(events[_0xf1b1('0x7')](e)){var event=events[e];VoiceQueueReport[_0xf1b1('0x8')](e,emitEvent(event));}}module[_0xf1b1('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xd63f=['emit','hasOwnProperty','exports','../../mysqldb','VoiceQueueReport','setMaxListeners','update'];(function(_0x1a9e9d,_0x4e21bf){var _0x12bf3d=function(_0x200083){while(--_0x200083){_0x1a9e9d['push'](_0x1a9e9d['shift']());}};_0x12bf3d(++_0x4e21bf);}(_0xd63f,0xf8));var _0xfd63=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd63f[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xfd63('0x0'))['db'][_0xfd63('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xfd63('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfd63('0x3'),'afterDestroy':'remove'};function emitEvent(_0x31abf5){return function(_0x1573dd,_0x4d02d7,_0x359cdf){VoiceQueueReportEvents[_0xfd63('0x4')](_0x31abf5+':'+_0x1573dd['id'],_0x1573dd);VoiceQueueReportEvents[_0xfd63('0x4')](_0x31abf5,_0x1573dd);_0x359cdf(null);};}for(var e in events){if(events[_0xfd63('0x5')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0xfd63('0x6')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 669ad07..40648ce 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 _0xcbe4=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash'];(function(_0x56ff20,_0x458941){var _0x4870ef=function(_0x505a01){while(--_0x505a01){_0x56ff20['push'](_0x56ff20['shift']());}};_0x4870ef(++_0x458941);}(_0xcbe4,0xef));var _0x4cbe=function(_0x5b0cca,_0x3736f7){_0x5b0cca=_0x5b0cca-0x0;var _0x55de28=_0xcbe4[_0x5b0cca];return _0x55de28;};'use strict';var _=require(_0x4cbe('0x0'));var util=require('util');var logger=require(_0x4cbe('0x1'))(_0x4cbe('0x2'));var moment=require(_0x4cbe('0x3'));var BPromise=require(_0x4cbe('0x4'));var rp=require(_0x4cbe('0x5'));var fs=require('fs');var path=require(_0x4cbe('0x6'));var rimraf=require(_0x4cbe('0x7'));var config=require(_0x4cbe('0x8'));var attributes=require(_0x4cbe('0x9'));module[_0x4cbe('0xa')]=function(_0xb5be56,_0x1f5dee){return _0xb5be56[_0x4cbe('0xb')](_0x4cbe('0xc'),attributes,{'tableName':_0x4cbe('0xd'),'paranoid':![],'indexes':[{'fields':[_0x4cbe('0xe')]},{'fields':[_0x4cbe('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xce9b=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','uniqueid','calleridnum','lodash'];(function(_0xf51002,_0xf6d406){var _0x4aeed8=function(_0x25ab0f){while(--_0x25ab0f){_0xf51002['push'](_0xf51002['shift']());}};_0x4aeed8(++_0xf6d406);}(_0xce9b,0xed));var _0xbce9=function(_0x2a96a1,_0x49fa12){_0x2a96a1=_0x2a96a1-0x0;var _0x265d5b=_0xce9b[_0x2a96a1];return _0x265d5b;};'use strict';var _=require(_0xbce9('0x0'));var util=require(_0xbce9('0x1'));var logger=require(_0xbce9('0x2'))('api');var moment=require(_0xbce9('0x3'));var BPromise=require(_0xbce9('0x4'));var rp=require(_0xbce9('0x5'));var fs=require('fs');var path=require(_0xbce9('0x6'));var rimraf=require(_0xbce9('0x7'));var config=require('../../config/environment');var attributes=require(_0xbce9('0x8'));module[_0xbce9('0x9')]=function(_0x348df9,_0x5e32ff){return _0x348df9[_0xbce9('0xa')](_0xbce9('0xb'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xbce9('0xc')]},{'fields':[_0xbce9('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index b61d26f..d760062 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 _0xa48e=['then','GetVoiceQueueReport','create','body','raw','CreateVoiceQueueReport','catch','UpdateVoiceQueueReport','update','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceQueueReport','options','where','limit','map','include','model','attributes'];(function(_0x4ec993,_0x5ca9d6){var _0x59f534=function(_0xfdd516){while(--_0xfdd516){_0x4ec993['push'](_0x4ec993['shift']());}};_0x59f534(++_0x5ca9d6);}(_0xa48e,0x141));var _0xea48=function(_0x553c71,_0x1715c8){_0x553c71=_0x553c71-0x0;var _0x84732d=_0xa48e[_0x553c71];return _0x84732d;};'use strict';var _=require(_0xea48('0x0'));var util=require('util');var moment=require(_0xea48('0x1'));var BPromise=require(_0xea48('0x2'));var rs=require(_0xea48('0x3'));var fs=require('fs');var Redis=require(_0xea48('0x4'));var db=require(_0xea48('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xea48('0x6'))(_0xea48('0x7'));var config=require('../../config/environment');var jayson=require(_0xea48('0x8'));var client=jayson['client'][_0xea48('0x9')]({'port':0x232a});config['redis']=_[_0xea48('0xa')](config[_0xea48('0xb')],{'host':_0xea48('0xc'),'port':0x18eb});var socket=require(_0xea48('0xd'))(new Redis(config['redis']));require('./voiceQueueReport.socket')['register'](socket);function respondWithRpcPromise(_0x138440,_0x21c8f9,_0x1ca582){return new BPromise(function(_0x2a3631,_0x62a472){return client['request'](_0x138440,_0x1ca582)['then'](function(_0x54aa7c){logger[_0xea48('0xe')](_0xea48('0xf'),_0x21c8f9,_0xea48('0x10'));logger[_0xea48('0x11')](_0xea48('0x12'),_0x21c8f9,_0xea48('0x10'),JSON[_0xea48('0x13')](_0x54aa7c));if(_0x54aa7c[_0xea48('0x14')]){if(_0x54aa7c[_0xea48('0x14')]['code']===0x1f4){logger[_0xea48('0x14')](_0xea48('0xf'),_0x21c8f9,_0x54aa7c[_0xea48('0x14')]['message']);return _0x62a472(_0x54aa7c[_0xea48('0x14')]['message']);}logger['error'](_0xea48('0xf'),_0x21c8f9,_0x54aa7c['error'][_0xea48('0x15')]);return _0x2a3631(_0x54aa7c[_0xea48('0x14')][_0xea48('0x15')]);}else{logger[_0xea48('0xe')](_0xea48('0xf'),_0x21c8f9,_0xea48('0x10'));_0x2a3631(_0x54aa7c['result']['message']);}})['catch'](function(_0x4a1962){logger['error'](_0xea48('0xf'),_0x21c8f9,_0x4a1962);_0x62a472(_0x4a1962);});});}exports['GetVoiceQueueReport']=function(_0x22ec2a){var _0x1b9835=this;return new Promise(function(_0x44ff26,_0x133daf){return db[_0xea48('0x16')]['findAll']({'raw':_0x22ec2a[_0xea48('0x17')]?_0x22ec2a['options']['raw']===undefined?!![]:![]:!![],'where':_0x22ec2a[_0xea48('0x17')]?_0x22ec2a[_0xea48('0x17')][_0xea48('0x18')]||null:null,'attributes':_0x22ec2a[_0xea48('0x17')]?_0x22ec2a[_0xea48('0x17')]['attributes']||null:null,'limit':_0x22ec2a[_0xea48('0x17')]?_0x22ec2a[_0xea48('0x17')][_0xea48('0x19')]||null:null,'include':_0x22ec2a[_0xea48('0x17')]?_0x22ec2a[_0xea48('0x17')]['include']?_[_0xea48('0x1a')](_0x22ec2a[_0xea48('0x17')][_0xea48('0x1b')],function(_0x3d83c7){return{'model':db[_0x3d83c7[_0xea48('0x1c')]],'as':_0x3d83c7['as'],'attributes':_0x3d83c7[_0xea48('0x1d')],'include':_0x3d83c7[_0xea48('0x1b')]?_['map'](_0x3d83c7[_0xea48('0x1b')],function(_0x12b9f5){return{'model':db[_0x12b9f5[_0xea48('0x1c')]],'as':_0x12b9f5['as'],'attributes':_0x12b9f5[_0xea48('0x1d')],'include':_0x12b9f5[_0xea48('0x1b')]?_[_0xea48('0x1a')](_0x12b9f5[_0xea48('0x1b')],function(_0x2bdd71){return{'model':db[_0x2bdd71[_0xea48('0x1c')]],'as':_0x2bdd71['as'],'attributes':_0x2bdd71[_0xea48('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xea48('0x1e')](function(_0x2dfdb8){logger['info']('GetVoiceQueueReport',_0x22ec2a);logger[_0xea48('0x11')](_0xea48('0x1f'),_0x22ec2a,JSON['stringify'](_0x2dfdb8));_0x44ff26(_0x2dfdb8);})['catch'](function(_0x185420){logger[_0xea48('0x14')](_0xea48('0x1f'),_0x185420['message'],_0x22ec2a);_0x133daf(_0x1b9835[_0xea48('0x14')](0x1f4,_0x185420[_0xea48('0x15')]));});});};exports['CreateVoiceQueueReport']=function(_0x26f62c){var _0x25ea08=this;return new Promise(function(_0x2e42b3,_0x569f43){return db[_0xea48('0x16')][_0xea48('0x20')](_0x26f62c[_0xea48('0x21')],{'raw':_0x26f62c[_0xea48('0x17')]?_0x26f62c['options'][_0xea48('0x22')]===undefined?!![]:![]:!![]})[_0xea48('0x1e')](function(_0x85ee38){logger[_0xea48('0xe')](_0xea48('0x23'),_0x26f62c);logger[_0xea48('0x11')](_0xea48('0x23'),_0x26f62c,JSON['stringify'](_0x85ee38));_0x2e42b3(_0x85ee38);})[_0xea48('0x24')](function(_0x31fe3d){logger['error'](_0xea48('0x23'),_0x31fe3d[_0xea48('0x15')],_0x26f62c);_0x569f43(_0x25ea08[_0xea48('0x14')](0x1f4,_0x31fe3d['message']));});});};exports[_0xea48('0x25')]=function(_0x1f10cc){var _0x22c8a4=this;return new Promise(function(_0x2ab33c,_0x22eef1){return db['VoiceQueueReport'][_0xea48('0x26')](_0x1f10cc['body'],{'raw':_0x1f10cc[_0xea48('0x17')]?_0x1f10cc[_0xea48('0x17')][_0xea48('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f10cc[_0xea48('0x17')]?_0x1f10cc[_0xea48('0x17')][_0xea48('0x18')]||null:null,'attributes':_0x1f10cc[_0xea48('0x17')]?_0x1f10cc[_0xea48('0x17')]['attributes']||null:null,'limit':_0x1f10cc[_0xea48('0x17')]?_0x1f10cc[_0xea48('0x17')][_0xea48('0x19')]||null:null})[_0xea48('0x1e')](function(_0x10e965){logger['info'](_0xea48('0x25'),_0x1f10cc);logger['debug'](_0xea48('0x25'),_0x1f10cc,JSON[_0xea48('0x13')](_0x10e965));_0x2ab33c(_0x10e965);})[_0xea48('0x24')](function(_0x8216d1){logger[_0xea48('0x14')]('UpdateVoiceQueueReport',_0x8216d1['message'],_0x1f10cc);_0x22eef1(_0x22c8a4[_0xea48('0x14')](0x1f4,_0x8216d1[_0xea48('0x15')]));});});}; \ No newline at end of file +var _0xcc42=['code','message','result','VoiceQueueReport','findAll','options','attributes','limit','map','model','include','GetVoiceQueueReport','catch','CreateVoiceQueueReport','create','raw','debug','UpdateVoiceQueueReport','update','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','request','then','info','VoiceQueueReport,\x20%s,\x20%s','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x582d5a,_0x3b57c0){var _0x5625ef=function(_0x509d83){while(--_0x509d83){_0x582d5a['push'](_0x582d5a['shift']());}};_0x5625ef(++_0x3b57c0);}(_0xcc42,0xc4));var _0x2cc4=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xcc42[_0x68c979];return _0x4f0001;};'use strict';var _=require('lodash');var util=require(_0x2cc4('0x0'));var moment=require(_0x2cc4('0x1'));var BPromise=require(_0x2cc4('0x2'));var rs=require(_0x2cc4('0x3'));var fs=require('fs');var Redis=require(_0x2cc4('0x4'));var db=require(_0x2cc4('0x5'))['db'];var utils=require(_0x2cc4('0x6'));var logger=require(_0x2cc4('0x7'))(_0x2cc4('0x8'));var config=require('../../config/environment');var jayson=require(_0x2cc4('0x9'));var client=jayson[_0x2cc4('0xa')][_0x2cc4('0xb')]({'port':0x232a});config[_0x2cc4('0xc')]=_['defaults'](config[_0x2cc4('0xc')],{'host':_0x2cc4('0xd'),'port':0x18eb});var socket=require(_0x2cc4('0xe'))(new Redis(config[_0x2cc4('0xc')]));require(_0x2cc4('0xf'))['register'](socket);function respondWithRpcPromise(_0x440aa0,_0x267582,_0x38b1c1){return new BPromise(function(_0x294d14,_0x12030f){return client[_0x2cc4('0x10')](_0x440aa0,_0x38b1c1)[_0x2cc4('0x11')](function(_0x286a50){logger[_0x2cc4('0x12')](_0x2cc4('0x13'),_0x267582,'request\x20sent');logger['debug'](_0x2cc4('0x14'),_0x267582,_0x2cc4('0x15'),JSON[_0x2cc4('0x16')](_0x286a50));if(_0x286a50[_0x2cc4('0x17')]){if(_0x286a50[_0x2cc4('0x17')][_0x2cc4('0x18')]===0x1f4){logger['error'](_0x2cc4('0x13'),_0x267582,_0x286a50[_0x2cc4('0x17')][_0x2cc4('0x19')]);return _0x12030f(_0x286a50['error'][_0x2cc4('0x19')]);}logger[_0x2cc4('0x17')](_0x2cc4('0x13'),_0x267582,_0x286a50[_0x2cc4('0x17')][_0x2cc4('0x19')]);return _0x294d14(_0x286a50[_0x2cc4('0x17')]['message']);}else{logger[_0x2cc4('0x12')](_0x2cc4('0x13'),_0x267582,_0x2cc4('0x15'));_0x294d14(_0x286a50[_0x2cc4('0x1a')][_0x2cc4('0x19')]);}})['catch'](function(_0x5d5093){logger[_0x2cc4('0x17')](_0x2cc4('0x13'),_0x267582,_0x5d5093);_0x12030f(_0x5d5093);});});}exports['GetVoiceQueueReport']=function(_0x18c10b){var _0x379ca4=this;return new Promise(function(_0x4ccd71,_0x48591e){return db[_0x2cc4('0x1b')][_0x2cc4('0x1c')]({'raw':_0x18c10b[_0x2cc4('0x1d')]?_0x18c10b[_0x2cc4('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x18c10b['options']?_0x18c10b[_0x2cc4('0x1d')]['where']||null:null,'attributes':_0x18c10b[_0x2cc4('0x1d')]?_0x18c10b[_0x2cc4('0x1d')][_0x2cc4('0x1e')]||null:null,'limit':_0x18c10b['options']?_0x18c10b[_0x2cc4('0x1d')][_0x2cc4('0x1f')]||null:null,'include':_0x18c10b[_0x2cc4('0x1d')]?_0x18c10b[_0x2cc4('0x1d')]['include']?_[_0x2cc4('0x20')](_0x18c10b[_0x2cc4('0x1d')]['include'],function(_0x33098d){return{'model':db[_0x33098d[_0x2cc4('0x21')]],'as':_0x33098d['as'],'attributes':_0x33098d[_0x2cc4('0x1e')],'include':_0x33098d['include']?_[_0x2cc4('0x20')](_0x33098d[_0x2cc4('0x22')],function(_0x5ebe13){return{'model':db[_0x5ebe13[_0x2cc4('0x21')]],'as':_0x5ebe13['as'],'attributes':_0x5ebe13[_0x2cc4('0x1e')],'include':_0x5ebe13[_0x2cc4('0x22')]?_[_0x2cc4('0x20')](_0x5ebe13['include'],function(_0x341919){return{'model':db[_0x341919[_0x2cc4('0x21')]],'as':_0x341919['as'],'attributes':_0x341919[_0x2cc4('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9cb2ec){logger[_0x2cc4('0x12')]('GetVoiceQueueReport',_0x18c10b);logger['debug'](_0x2cc4('0x23'),_0x18c10b,JSON[_0x2cc4('0x16')](_0x9cb2ec));_0x4ccd71(_0x9cb2ec);})[_0x2cc4('0x24')](function(_0x4a5503){logger[_0x2cc4('0x17')](_0x2cc4('0x23'),_0x4a5503[_0x2cc4('0x19')],_0x18c10b);_0x48591e(_0x379ca4[_0x2cc4('0x17')](0x1f4,_0x4a5503['message']));});});};exports[_0x2cc4('0x25')]=function(_0x32d968){var _0x361f17=this;return new Promise(function(_0x24c9b6,_0x2071a6){return db[_0x2cc4('0x1b')][_0x2cc4('0x26')](_0x32d968['body'],{'raw':_0x32d968[_0x2cc4('0x1d')]?_0x32d968['options'][_0x2cc4('0x27')]===undefined?!![]:![]:!![]})['then'](function(_0xf64c9b){logger[_0x2cc4('0x12')](_0x2cc4('0x25'),_0x32d968);logger[_0x2cc4('0x28')](_0x2cc4('0x25'),_0x32d968,JSON[_0x2cc4('0x16')](_0xf64c9b));_0x24c9b6(_0xf64c9b);})[_0x2cc4('0x24')](function(_0x1568de){logger['error'](_0x2cc4('0x25'),_0x1568de[_0x2cc4('0x19')],_0x32d968);_0x2071a6(_0x361f17[_0x2cc4('0x17')](0x1f4,_0x1568de['message']));});});};exports[_0x2cc4('0x29')]=function(_0x55f6fd){var _0x290ed6=this;return new Promise(function(_0x5037ad,_0x208803){return db[_0x2cc4('0x1b')][_0x2cc4('0x2a')](_0x55f6fd['body'],{'raw':_0x55f6fd[_0x2cc4('0x1d')]?_0x55f6fd[_0x2cc4('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55f6fd['options']?_0x55f6fd[_0x2cc4('0x1d')][_0x2cc4('0x2b')]||null:null,'attributes':_0x55f6fd[_0x2cc4('0x1d')]?_0x55f6fd['options'][_0x2cc4('0x1e')]||null:null,'limit':_0x55f6fd[_0x2cc4('0x1d')]?_0x55f6fd['options'][_0x2cc4('0x1f')]||null:null})[_0x2cc4('0x11')](function(_0x5bf7cf){logger[_0x2cc4('0x12')](_0x2cc4('0x29'),_0x55f6fd);logger[_0x2cc4('0x28')](_0x2cc4('0x29'),_0x55f6fd,JSON[_0x2cc4('0x16')](_0x5bf7cf));_0x5037ad(_0x5bf7cf);})[_0x2cc4('0x24')](function(_0x36899e){logger['error'](_0x2cc4('0x29'),_0x36899e[_0x2cc4('0x19')],_0x55f6fd);_0x208803(_0x290ed6['error'](0x1f4,_0x36899e[_0x2cc4('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 9ffe08c..fca271a 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 _0x18d6=['update','register','voiceQueueReport:','./voiceQueueReport.events','save'];(function(_0x38b8c6,_0x541f91){var _0x3104d6=function(_0x4215ee){while(--_0x4215ee){_0x38b8c6['push'](_0x38b8c6['shift']());}};_0x3104d6(++_0x541f91);}(_0x18d6,0x166));var _0x618d=function(_0x4d3187,_0x267c51){_0x4d3187=_0x4d3187-0x0;var _0x107906=_0x18d6[_0x4d3187];return _0x107906;};'use strict';var VoiceQueueReportEvents=require(_0x618d('0x0'));var events=[_0x618d('0x1'),'remove',_0x618d('0x2')];function createListener(_0x1b9feb,_0x2a5bc1){return function(_0x3b0d41){_0x2a5bc1['emit'](_0x1b9feb,_0x3b0d41);};}function removeListener(_0x3151de,_0x1a7716){return function(){VoiceQueueReportEvents['removeListener'](_0x3151de,_0x1a7716);};}exports[_0x618d('0x3')]=function(_0x55caad){for(var _0xa89cff=0x0,_0x2d3dbf=events['length'];_0xa89cff<_0x2d3dbf;_0xa89cff++){var _0x41ca65=events[_0xa89cff];var _0x45d2d3=createListener(_0x618d('0x4')+_0x41ca65,_0x55caad);VoiceQueueReportEvents['on'](_0x41ca65,_0x45d2d3);}}; \ No newline at end of file +var _0x1b69=['removeListener','register','length','voiceQueueReport:','update'];(function(_0x270f69,_0x3306d6){var _0x3b1ff8=function(_0x964db5){while(--_0x964db5){_0x270f69['push'](_0x270f69['shift']());}};_0x3b1ff8(++_0x3306d6);}(_0x1b69,0x1d0));var _0x91b6=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x1b69[_0x4d07cc];return _0x42de3b;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=['save','remove',_0x91b6('0x0')];function createListener(_0x34734d,_0x214c3e){return function(_0x373b98){_0x214c3e['emit'](_0x34734d,_0x373b98);};}function removeListener(_0x120ecb,_0x4627f7){return function(){VoiceQueueReportEvents[_0x91b6('0x1')](_0x120ecb,_0x4627f7);};}exports[_0x91b6('0x2')]=function(_0x1c4412){for(var _0xa67563=0x0,_0x2e920e=events[_0x91b6('0x3')];_0xa67563<_0x2e920e;_0xa67563++){var _0x2ddd9c=events[_0xa67563];var _0x8c93f7=createListener(_0x91b6('0x4')+_0x2ddd9c,_0x1c4412);VoiceQueueReportEvents['on'](_0x2ddd9c,_0x8c93f7);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 444b2bc..226d5ca 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 _0x665a=['isAuthenticated','show','post','create','put','update','delete','destroy','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','index','/:id'];(function(_0x120900,_0x1b16c7){var _0x356528=function(_0x3f938b){while(--_0x3f938b){_0x120900['push'](_0x120900['shift']());}};_0x356528(++_0x1b16c7);}(_0x665a,0xbc));var _0xa665=function(_0x4ba2d2,_0x9f2ef){_0x4ba2d2=_0x4ba2d2-0x0;var _0x179cc9=_0x665a[_0x4ba2d2];return _0x179cc9;};'use strict';var multer=require('multer');var util=require(_0xa665('0x0'));var path=require('path');var timeout=require(_0xa665('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa665('0x2'));var auth=require(_0xa665('0x3'));var interaction=require(_0xa665('0x4'));var config=require(_0xa665('0x5'));var controller=require(_0xa665('0x6'));router[_0xa665('0x7')]('/',auth['isAuthenticated'](),controller[_0xa665('0x8')]);router[_0xa665('0x7')](_0xa665('0x9'),auth[_0xa665('0xa')](),controller[_0xa665('0xb')]);router[_0xa665('0xc')]('/',auth['isAuthenticated'](),controller[_0xa665('0xd')]);router[_0xa665('0xe')](_0xa665('0x9'),auth['isAuthenticated'](),controller[_0xa665('0xf')]);router[_0xa665('0x10')](_0xa665('0x9'),auth['isAuthenticated'](),controller[_0xa665('0x11')]);module['exports']=router; \ No newline at end of file +var _0x3d82=['get','isAuthenticated','index','/:id','create','put','update','delete','destroy','multer','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller'];(function(_0x1a80af,_0x359695){var _0x430e96=function(_0x43617c){while(--_0x43617c){_0x1a80af['push'](_0x1a80af['shift']());}};_0x430e96(++_0x359695);}(_0x3d82,0x117));var _0x23d8=function(_0x17e7ad,_0x3112ac){_0x17e7ad=_0x17e7ad-0x0;var _0x234946=_0x3d82[_0x17e7ad];return _0x234946;};'use strict';var multer=require(_0x23d8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x23d8('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x23d8('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x23d8('0x3'));var config=require(_0x23d8('0x4'));var controller=require(_0x23d8('0x5'));router[_0x23d8('0x6')]('/',auth[_0x23d8('0x7')](),controller[_0x23d8('0x8')]);router['get'](_0x23d8('0x9'),auth[_0x23d8('0x7')](),controller['show']);router['post']('/',auth[_0x23d8('0x7')](),controller[_0x23d8('0xa')]);router[_0x23d8('0xb')](_0x23d8('0x9'),auth[_0x23d8('0x7')](),controller[_0x23d8('0xc')]);router[_0x23d8('0xd')](_0x23d8('0x9'),auth[_0x23d8('0x7')](),controller[_0x23d8('0xe')]);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 5500cd3..e9a0449 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 _0x33ac=['format','YYYY-MM-DD\x20HH:mm:ss','moment','STRING'];(function(_0x463721,_0x265d3f){var _0x55cc9c=function(_0xb1f4e){while(--_0xb1f4e){_0x463721['push'](_0x463721['shift']());}};_0x55cc9c(++_0x265d3f);}(_0x33ac,0x1f2));var _0xc33a=function(_0x3b0257,_0x58a6bb){_0x3b0257=_0x3b0257-0x0;var _0x10bc4c=_0x33ac[_0x3b0257];return _0x10bc4c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc33a('0x0'));module['exports']={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xc33a('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xc33a('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xc33a('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xc33a('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xc33a('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xc33a('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xc33a('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xc33a('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xc33a('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0xc33a('0x2')](_0xc33a('0x3'))}}; \ No newline at end of file +var _0xe182=['moment','exports','STRING','DATE'];(function(_0x3c5289,_0x310672){var _0x447f1d=function(_0x4b09b8){while(--_0x4b09b8){_0x3c5289['push'](_0x3c5289['shift']());}};_0x447f1d(++_0x310672);}(_0xe182,0xf8));var _0x2e18=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xe182[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2e18('0x0'));module[_0x2e18('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x2e18('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x2e18('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x2e18('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x2e18('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x2e18('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x2e18('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x2e18('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x2e18('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x2e18('0x3')],'allowNull':![],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index f2adffc..6f22c9f 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 _0x7464=['pick','filter','merge','VIRTUAL','options','include','show','params','keys','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','update','then','destroy','error','stack','name','send','index','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters'];(function(_0x59c046,_0x14aa68){var _0x2f5645=function(_0x1184f1){while(--_0x1184f1){_0x59c046['push'](_0x59c046['shift']());}};_0x2f5645(++_0x14aa68);}(_0x7464,0x1c9));var _0x4746=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7464[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x4746('0x0'));var rimraf=require(_0x4746('0x1'));var zipdir=require(_0x4746('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4746('0x3'));var moment=require('moment');var BPromise=require(_0x4746('0x4'));var Mustache=require(_0x4746('0x5'));var util=require(_0x4746('0x6'));var path=require(_0x4746('0x7'));var sox=require('sox');var csv=require(_0x4746('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4746('0x9'));var _=require(_0x4746('0xa'));var squel=require(_0x4746('0xb'));var crypto=require(_0x4746('0xc'));var jsforce=require(_0x4746('0xd'));var deskjs=require(_0x4746('0xe'));var toCsv=require(_0x4746('0x8'));var querystring=require(_0x4746('0xf'));var Papa=require(_0x4746('0x10'));var Redis=require(_0x4746('0x11'));var authService=require(_0x4746('0x12'));var qs=require(_0x4746('0x13'));var as=require(_0x4746('0x14'));var hardwareService=require(_0x4746('0x15'));var logger=require(_0x4746('0x16'))('api');var utils=require(_0x4746('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4746('0x18'));var db=require(_0x4746('0x19'))['db'];function respondWithStatusCode(_0x1d5430,_0x351607){_0x351607=_0x351607||0xcc;return function(_0x459b3c){if(_0x459b3c){return _0x1d5430[_0x4746('0x1a')](_0x351607);}return _0x1d5430[_0x4746('0x1b')](_0x351607)[_0x4746('0x1c')]();};}function respondWithResult(_0x1283a9,_0x43055a){_0x43055a=_0x43055a||0xc8;return function(_0x376097){if(_0x376097){return _0x1283a9['status'](_0x43055a)[_0x4746('0x1d')](_0x376097);}};}function respondWithFilteredResult(_0x2527d6,_0x5d4602){return function(_0x3025ef){if(_0x3025ef){var _0x4edf4f=typeof _0x5d4602[_0x4746('0x1e')]===_0x4746('0x1f')&&typeof _0x5d4602['limit']===_0x4746('0x1f');var _0x3a3612=_0x3025ef['count'];var _0x3d34f6=_0x4edf4f?0x0:_0x5d4602[_0x4746('0x1e')];var _0x1c2041=_0x4edf4f?_0x3025ef[_0x4746('0x20')]:_0x5d4602[_0x4746('0x1e')]+_0x5d4602[_0x4746('0x21')];var _0xd4d914;if(_0x1c2041>=_0x3a3612){_0x1c2041=_0x3a3612;_0xd4d914=0xc8;}else{_0xd4d914=0xce;}_0x2527d6[_0x4746('0x1b')](_0xd4d914);return _0x2527d6[_0x4746('0x22')]('Content-Range',_0x3d34f6+'-'+_0x1c2041+'/'+_0x3a3612)['json'](_0x3025ef);}return null;};}function patchUpdates(_0x37a8a5){return function(_0x5d9a30){try{jsonpatch[_0x4746('0x23')](_0x5d9a30,_0x37a8a5,!![]);}catch(_0x3049e1){return BPromise['reject'](_0x3049e1);}return _0x5d9a30['save']();};}function saveUpdates(_0x10e96e,_0x406126){return function(_0x3fa8f3){if(_0x3fa8f3){return _0x3fa8f3[_0x4746('0x24')](_0x10e96e)[_0x4746('0x25')](function(_0x47886f){return _0x47886f;});}return null;};}function removeEntity(_0x1b607b,_0x4a42ee){return function(_0x1271ec){if(_0x1271ec){return _0x1271ec[_0x4746('0x26')]()[_0x4746('0x25')](function(){_0x1b607b[_0x4746('0x1b')](0xcc)[_0x4746('0x1c')]();});}};}function handleEntityNotFound(_0x15146b,_0x374881){return function(_0x592d7e){if(!_0x592d7e){_0x15146b[_0x4746('0x1a')](0x194);}return _0x592d7e;};}function handleError(_0x4fd8b5,_0xd1f7c2){_0xd1f7c2=_0xd1f7c2||0x1f4;return function(_0x53d200){logger[_0x4746('0x27')](_0x53d200[_0x4746('0x28')]);if(_0x53d200[_0x4746('0x29')]){delete _0x53d200[_0x4746('0x29')];}_0x4fd8b5[_0x4746('0x1b')](_0xd1f7c2)[_0x4746('0x2a')](_0x53d200);};}exports[_0x4746('0x2b')]=function(_0x3f789e,_0x4506af){var _0x29db42={},_0x39fa7a={},_0x485ab4={'count':0x0,'rows':[]};var _0x29c34e=_['map'](db[_0x4746('0x2c')][_0x4746('0x2d')],function(_0x24dafd){return{'name':_0x24dafd[_0x4746('0x2e')],'type':_0x24dafd[_0x4746('0x2f')][_0x4746('0x30')]};});_0x39fa7a[_0x4746('0x31')]=_[_0x4746('0x32')](_0x29c34e,'name');_0x39fa7a['query']=_['keys'](_0x3f789e[_0x4746('0x33')]);_0x39fa7a['filters']=_[_0x4746('0x34')](_0x39fa7a[_0x4746('0x31')],_0x39fa7a[_0x4746('0x33')]);_0x29db42[_0x4746('0x35')]=_[_0x4746('0x34')](_0x39fa7a[_0x4746('0x31')],qs[_0x4746('0x36')](_0x3f789e['query'][_0x4746('0x36')]));_0x29db42['attributes']=_0x29db42[_0x4746('0x35')][_0x4746('0x37')]?_0x29db42[_0x4746('0x35')]:_0x39fa7a[_0x4746('0x31')];if(!_0x3f789e['query'][_0x4746('0x38')](_0x4746('0x39'))){_0x29db42[_0x4746('0x21')]=qs[_0x4746('0x21')](_0x3f789e['query']['limit']);_0x29db42[_0x4746('0x1e')]=qs[_0x4746('0x1e')](_0x3f789e[_0x4746('0x33')][_0x4746('0x1e')]);}_0x29db42['order']=qs[_0x4746('0x3a')](_0x3f789e['query'][_0x4746('0x3a')]);_0x29db42[_0x4746('0x3b')]=qs[_0x4746('0x3c')](_[_0x4746('0x3d')](_0x3f789e[_0x4746('0x33')],_0x39fa7a[_0x4746('0x3c')]),_0x29c34e);if(_0x3f789e['query'][_0x4746('0x3e')]){_0x29db42[_0x4746('0x3b')]=_[_0x4746('0x3f')](_0x29db42['where'],{'$or':_['map'](_0x29c34e,function(_0x227384){if(_0x227384[_0x4746('0x2f')]!==_0x4746('0x40')){var _0x41b025={};_0x41b025[_0x227384['name']]={'$like':'%'+_0x3f789e[_0x4746('0x33')][_0x4746('0x3e')]+'%'};return _0x41b025;}})});}_0x29db42=_[_0x4746('0x3f')]({},_0x29db42,_0x3f789e[_0x4746('0x41')]);var _0x40b932={'where':_0x29db42[_0x4746('0x3b')]};return db[_0x4746('0x2c')][_0x4746('0x20')](_0x40b932)[_0x4746('0x25')](function(_0x1b3245){_0x485ab4[_0x4746('0x20')]=_0x1b3245;if(_0x3f789e[_0x4746('0x33')]['includeAll']){_0x29db42[_0x4746('0x42')]=[{'all':!![]}];}return db['VoiceQueuesLog']['findAll'](_0x29db42);})['then'](function(_0x23c823){_0x485ab4['rows']=_0x23c823;return _0x485ab4;})[_0x4746('0x25')](respondWithFilteredResult(_0x4506af,_0x29db42))['catch'](handleError(_0x4506af,null));};exports[_0x4746('0x43')]=function(_0x1571fc,_0xf0c6a7){var _0x519e8f={'raw':!![],'where':{'id':_0x1571fc[_0x4746('0x44')]['id']}},_0x20c540={};_0x20c540[_0x4746('0x31')]=_[_0x4746('0x45')](db[_0x4746('0x2c')][_0x4746('0x2d')]);_0x20c540['query']=_['keys'](_0x1571fc[_0x4746('0x33')]);_0x20c540[_0x4746('0x3c')]=_['intersection'](_0x20c540[_0x4746('0x31')],_0x20c540[_0x4746('0x33')]);_0x519e8f[_0x4746('0x35')]=_[_0x4746('0x34')](_0x20c540[_0x4746('0x31')],qs['fields'](_0x1571fc[_0x4746('0x33')]['fields']));_0x519e8f['attributes']=_0x519e8f[_0x4746('0x35')][_0x4746('0x37')]?_0x519e8f[_0x4746('0x35')]:_0x20c540['model'];if(_0x1571fc[_0x4746('0x33')]['includeAll']){_0x519e8f['include']=[{'all':!![]}];}_0x519e8f=_[_0x4746('0x3f')]({},_0x519e8f,_0x1571fc['options']);return db['VoiceQueuesLog'][_0x4746('0x46')](_0x519e8f)[_0x4746('0x25')](handleEntityNotFound(_0xf0c6a7,null))[_0x4746('0x25')](respondWithResult(_0xf0c6a7,null))[_0x4746('0x47')](handleError(_0xf0c6a7,null));};exports[_0x4746('0x48')]=function(_0x4e9a20,_0x13d4f4){return db[_0x4746('0x2c')][_0x4746('0x48')](_0x4e9a20[_0x4746('0x49')],{})[_0x4746('0x25')](respondWithResult(_0x13d4f4,0xc9))['catch'](handleError(_0x13d4f4,null));};exports[_0x4746('0x24')]=function(_0x386f46,_0x33af25){if(_0x386f46[_0x4746('0x49')]['id']){delete _0x386f46[_0x4746('0x49')]['id'];}return db['VoiceQueuesLog'][_0x4746('0x46')]({'where':{'id':_0x386f46[_0x4746('0x44')]['id']}})['then'](handleEntityNotFound(_0x33af25,null))['then'](saveUpdates(_0x386f46['body'],null))['then'](respondWithResult(_0x33af25,null))['catch'](handleError(_0x33af25,null));};exports[_0x4746('0x26')]=function(_0x28c654,_0x4535e8){return db[_0x4746('0x2c')][_0x4746('0x46')]({'where':{'id':_0x28c654[_0x4746('0x44')]['id']}})[_0x4746('0x25')](handleEntityNotFound(_0x4535e8,null))[_0x4746('0x25')](removeEntity(_0x4535e8,null))[_0x4746('0x47')](handleError(_0x4535e8,null));}; \ No newline at end of file +var _0xa779=['reject','destroy','then','stack','name','send','map','VoiceQueuesLog','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','catch','show','keys','length','include','find','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply'];(function(_0x20acdb,_0x210c8e){var _0x383b0d=function(_0x5d0919){while(--_0x5d0919){_0x20acdb['push'](_0x20acdb['shift']());}};_0x383b0d(++_0x210c8e);}(_0xa779,0x117));var _0x9a77=function(_0x3a381b,_0x4246c7){_0x3a381b=_0x3a381b-0x0;var _0x58fe49=_0xa779[_0x3a381b];return _0x58fe49;};'use strict';var emlformat=require(_0x9a77('0x0'));var rimraf=require(_0x9a77('0x1'));var zipdir=require(_0x9a77('0x2'));var jsonpatch=require(_0x9a77('0x3'));var rp=require(_0x9a77('0x4'));var moment=require(_0x9a77('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9a77('0x6'));var util=require(_0x9a77('0x7'));var path=require(_0x9a77('0x8'));var sox=require(_0x9a77('0x9'));var csv=require(_0x9a77('0xa'));var ejs=require(_0x9a77('0xb'));var fs=require('fs');var fs_extra=require(_0x9a77('0xc'));var _=require(_0x9a77('0xd'));var squel=require(_0x9a77('0xe'));var crypto=require(_0x9a77('0xf'));var jsforce=require(_0x9a77('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x9a77('0xa'));var querystring=require(_0x9a77('0x11'));var Papa=require(_0x9a77('0x12'));var Redis=require(_0x9a77('0x13'));var authService=require(_0x9a77('0x14'));var qs=require(_0x9a77('0x15'));var as=require(_0x9a77('0x16'));var hardwareService=require(_0x9a77('0x17'));var logger=require(_0x9a77('0x18'))(_0x9a77('0x19'));var utils=require(_0x9a77('0x1a'));var config=require(_0x9a77('0x1b'));var licenseUtil=require(_0x9a77('0x1c'));var db=require(_0x9a77('0x1d'))['db'];function respondWithStatusCode(_0x5be652,_0xa18a59){_0xa18a59=_0xa18a59||0xcc;return function(_0x5f56bd){if(_0x5f56bd){return _0x5be652[_0x9a77('0x1e')](_0xa18a59);}return _0x5be652[_0x9a77('0x1f')](_0xa18a59)[_0x9a77('0x20')]();};}function respondWithResult(_0x2d7f15,_0x50e17d){_0x50e17d=_0x50e17d||0xc8;return function(_0xdd5e28){if(_0xdd5e28){return _0x2d7f15[_0x9a77('0x1f')](_0x50e17d)[_0x9a77('0x21')](_0xdd5e28);}};}function respondWithFilteredResult(_0x3055d5,_0x3da9ca){return function(_0x3b942a){if(_0x3b942a){var _0x2745a4=typeof _0x3da9ca[_0x9a77('0x22')]===_0x9a77('0x23')&&typeof _0x3da9ca['limit']==='undefined';var _0x58bde0=_0x3b942a[_0x9a77('0x24')];var _0x47ba66=_0x2745a4?0x0:_0x3da9ca['offset'];var _0x49745c=_0x2745a4?_0x3b942a[_0x9a77('0x24')]:_0x3da9ca[_0x9a77('0x22')]+_0x3da9ca[_0x9a77('0x25')];var _0x12b157;if(_0x49745c>=_0x58bde0){_0x49745c=_0x58bde0;_0x12b157=0xc8;}else{_0x12b157=0xce;}_0x3055d5[_0x9a77('0x1f')](_0x12b157);return _0x3055d5[_0x9a77('0x26')](_0x9a77('0x27'),_0x47ba66+'-'+_0x49745c+'/'+_0x58bde0)[_0x9a77('0x21')](_0x3b942a);}return null;};}function patchUpdates(_0x59eb4f){return function(_0x2a27aa){try{jsonpatch[_0x9a77('0x28')](_0x2a27aa,_0x59eb4f,!![]);}catch(_0x44366a){return BPromise[_0x9a77('0x29')](_0x44366a);}return _0x2a27aa['save']();};}function saveUpdates(_0x20476c,_0x6e8236){return function(_0x4d56fb){if(_0x4d56fb){return _0x4d56fb['update'](_0x20476c)['then'](function(_0x183a46){return _0x183a46;});}return null;};}function removeEntity(_0x44aca5,_0x4d9467){return function(_0xe28e22){if(_0xe28e22){return _0xe28e22[_0x9a77('0x2a')]()[_0x9a77('0x2b')](function(){_0x44aca5[_0x9a77('0x1f')](0xcc)[_0x9a77('0x20')]();});}};}function handleEntityNotFound(_0x5cc5ec,_0x209f7c){return function(_0x740a0b){if(!_0x740a0b){_0x5cc5ec[_0x9a77('0x1e')](0x194);}return _0x740a0b;};}function handleError(_0x2053a5,_0x4b0b15){_0x4b0b15=_0x4b0b15||0x1f4;return function(_0x339b13){logger['error'](_0x339b13[_0x9a77('0x2c')]);if(_0x339b13[_0x9a77('0x2d')]){delete _0x339b13[_0x9a77('0x2d')];}_0x2053a5[_0x9a77('0x1f')](_0x4b0b15)[_0x9a77('0x2e')](_0x339b13);};}exports['index']=function(_0xd95ea8,_0x350791){var _0x1b5db3={},_0x45e152={},_0x188e49={'count':0x0,'rows':[]};var _0xf5db5e=_[_0x9a77('0x2f')](db[_0x9a77('0x30')][_0x9a77('0x31')],function(_0x1d95a4){return{'name':_0x1d95a4['fieldName'],'type':_0x1d95a4[_0x9a77('0x32')][_0x9a77('0x33')]};});_0x45e152[_0x9a77('0x34')]=_[_0x9a77('0x2f')](_0xf5db5e,'name');_0x45e152[_0x9a77('0x35')]=_['keys'](_0xd95ea8[_0x9a77('0x35')]);_0x45e152[_0x9a77('0x36')]=_[_0x9a77('0x37')](_0x45e152[_0x9a77('0x34')],_0x45e152['query']);_0x1b5db3[_0x9a77('0x38')]=_[_0x9a77('0x37')](_0x45e152[_0x9a77('0x34')],qs[_0x9a77('0x39')](_0xd95ea8[_0x9a77('0x35')][_0x9a77('0x39')]));_0x1b5db3[_0x9a77('0x38')]=_0x1b5db3['attributes']['length']?_0x1b5db3[_0x9a77('0x38')]:_0x45e152['model'];if(!_0xd95ea8[_0x9a77('0x35')][_0x9a77('0x3a')](_0x9a77('0x3b'))){_0x1b5db3[_0x9a77('0x25')]=qs[_0x9a77('0x25')](_0xd95ea8[_0x9a77('0x35')][_0x9a77('0x25')]);_0x1b5db3[_0x9a77('0x22')]=qs[_0x9a77('0x22')](_0xd95ea8['query'][_0x9a77('0x22')]);}_0x1b5db3[_0x9a77('0x3c')]=qs[_0x9a77('0x3d')](_0xd95ea8[_0x9a77('0x35')][_0x9a77('0x3d')]);_0x1b5db3['where']=qs[_0x9a77('0x36')](_[_0x9a77('0x3e')](_0xd95ea8[_0x9a77('0x35')],_0x45e152['filters']),_0xf5db5e);if(_0xd95ea8[_0x9a77('0x35')][_0x9a77('0x3f')]){_0x1b5db3[_0x9a77('0x40')]=_[_0x9a77('0x41')](_0x1b5db3[_0x9a77('0x40')],{'$or':_[_0x9a77('0x2f')](_0xf5db5e,function(_0xa3cba0){if(_0xa3cba0[_0x9a77('0x32')]!==_0x9a77('0x42')){var _0x8ed6b3={};_0x8ed6b3[_0xa3cba0[_0x9a77('0x2d')]]={'$like':'%'+_0xd95ea8[_0x9a77('0x35')][_0x9a77('0x3f')]+'%'};return _0x8ed6b3;}})});}_0x1b5db3=_['merge']({},_0x1b5db3,_0xd95ea8[_0x9a77('0x43')]);var _0x3e6ff1={'where':_0x1b5db3[_0x9a77('0x40')]};return db['VoiceQueuesLog'][_0x9a77('0x24')](_0x3e6ff1)[_0x9a77('0x2b')](function(_0x1c121d){_0x188e49[_0x9a77('0x24')]=_0x1c121d;if(_0xd95ea8['query'][_0x9a77('0x44')]){_0x1b5db3['include']=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x9a77('0x45')](_0x1b5db3);})[_0x9a77('0x2b')](function(_0x1825d0){_0x188e49['rows']=_0x1825d0;return _0x188e49;})['then'](respondWithFilteredResult(_0x350791,_0x1b5db3))[_0x9a77('0x46')](handleError(_0x350791,null));};exports[_0x9a77('0x47')]=function(_0x3485f7,_0x127370){var _0x5dc5b0={'raw':!![],'where':{'id':_0x3485f7['params']['id']}},_0x5e4d59={};_0x5e4d59[_0x9a77('0x34')]=_[_0x9a77('0x48')](db[_0x9a77('0x30')][_0x9a77('0x31')]);_0x5e4d59[_0x9a77('0x35')]=_[_0x9a77('0x48')](_0x3485f7[_0x9a77('0x35')]);_0x5e4d59[_0x9a77('0x36')]=_[_0x9a77('0x37')](_0x5e4d59[_0x9a77('0x34')],_0x5e4d59[_0x9a77('0x35')]);_0x5dc5b0[_0x9a77('0x38')]=_[_0x9a77('0x37')](_0x5e4d59['model'],qs[_0x9a77('0x39')](_0x3485f7[_0x9a77('0x35')][_0x9a77('0x39')]));_0x5dc5b0[_0x9a77('0x38')]=_0x5dc5b0['attributes'][_0x9a77('0x49')]?_0x5dc5b0[_0x9a77('0x38')]:_0x5e4d59['model'];if(_0x3485f7[_0x9a77('0x35')][_0x9a77('0x44')]){_0x5dc5b0[_0x9a77('0x4a')]=[{'all':!![]}];}_0x5dc5b0=_[_0x9a77('0x41')]({},_0x5dc5b0,_0x3485f7[_0x9a77('0x43')]);return db[_0x9a77('0x30')][_0x9a77('0x4b')](_0x5dc5b0)[_0x9a77('0x2b')](handleEntityNotFound(_0x127370,null))[_0x9a77('0x2b')](respondWithResult(_0x127370,null))['catch'](handleError(_0x127370,null));};exports[_0x9a77('0x4c')]=function(_0x33404a,_0xb8597a){return db['VoiceQueuesLog'][_0x9a77('0x4c')](_0x33404a[_0x9a77('0x4d')],{})[_0x9a77('0x2b')](respondWithResult(_0xb8597a,0xc9))['catch'](handleError(_0xb8597a,null));};exports[_0x9a77('0x4e')]=function(_0x59ccc4,_0x79431d){if(_0x59ccc4[_0x9a77('0x4d')]['id']){delete _0x59ccc4[_0x9a77('0x4d')]['id'];}return db['VoiceQueuesLog'][_0x9a77('0x4b')]({'where':{'id':_0x59ccc4[_0x9a77('0x4f')]['id']}})[_0x9a77('0x2b')](handleEntityNotFound(_0x79431d,null))['then'](saveUpdates(_0x59ccc4[_0x9a77('0x4d')],null))[_0x9a77('0x2b')](respondWithResult(_0x79431d,null))[_0x9a77('0x46')](handleError(_0x79431d,null));};exports['destroy']=function(_0x28e8f7,_0x22dfb3){return db[_0x9a77('0x30')][_0x9a77('0x4b')]({'where':{'id':_0x28e8f7[_0x9a77('0x4f')]['id']}})[_0x9a77('0x2b')](handleEntityNotFound(_0x22dfb3,null))['then'](removeEntity(_0x22dfb3,null))[_0x9a77('0x46')](handleError(_0x22dfb3,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 2e716cc..b62b813 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 _0x39d6=['event_dtm','event','dtm','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','VoiceQueuesLog'];(function(_0x43a403,_0x586486){var _0xabc27e=function(_0x332e68){while(--_0x332e68){_0x43a403['push'](_0x43a403['shift']());}};_0xabc27e(++_0x586486);}(_0x39d6,0x8a));var _0x639d=function(_0x319e1c,_0x3b4634){_0x319e1c=_0x319e1c-0x0;var _0x49c88d=_0x39d6[_0x319e1c];return _0x49c88d;};'use strict';var _=require(_0x639d('0x0'));var util=require(_0x639d('0x1'));var logger=require(_0x639d('0x2'))(_0x639d('0x3'));var moment=require(_0x639d('0x4'));var BPromise=require(_0x639d('0x5'));var rp=require(_0x639d('0x6'));var fs=require('fs');var path=require(_0x639d('0x7'));var rimraf=require(_0x639d('0x8'));var config=require(_0x639d('0x9'));var attributes=require('./voiceQueuesLog.attributes');module[_0x639d('0xa')]=function(_0x391187,_0x524578){return _0x391187['define'](_0x639d('0xb'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x639d('0xc'),'fields':[_0x639d('0xd'),_0x639d('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0xb31a=['../../config/environment','./voiceQueuesLog.attributes','exports','define','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4a5c09,_0x2c766c){var _0x3ed03b=function(_0x29f39f){while(--_0x29f39f){_0x4a5c09['push'](_0x4a5c09['shift']());}};_0x3ed03b(++_0x2c766c);}(_0xb31a,0xd4));var _0xab31=function(_0x5767e1,_0x8c5d18){_0x5767e1=_0x5767e1-0x0;var _0x3dd067=_0xb31a[_0x5767e1];return _0x3dd067;};'use strict';var _=require(_0xab31('0x0'));var util=require(_0xab31('0x1'));var logger=require(_0xab31('0x2'))(_0xab31('0x3'));var moment=require(_0xab31('0x4'));var BPromise=require(_0xab31('0x5'));var rp=require(_0xab31('0x6'));var fs=require('fs');var path=require(_0xab31('0x7'));var rimraf=require(_0xab31('0x8'));var config=require(_0xab31('0x9'));var attributes=require(_0xab31('0xa'));module[_0xab31('0xb')]=function(_0x9c6740,_0x2c336b){return _0x9c6740[_0xab31('0xc')]('VoiceQueuesLog',attributes,{'tableName':_0xab31('0xd'),'paranoid':![],'indexes':[{'name':_0xab31('0xe'),'fields':[_0xab31('0xf'),_0xab31('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 442839e..7a6f37d 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 _0x86d7=['catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','info','request\x20sent','error','VoiceQueuesLog,\x20%s,\x20%s','message','result'];(function(_0x2c7356,_0x1608f5){var _0x4d4bb9=function(_0x43e59d){while(--_0x43e59d){_0x2c7356['push'](_0x2c7356['shift']());}};_0x4d4bb9(++_0x1608f5);}(_0x86d7,0xab));var _0x786d=function(_0x59505a,_0x5cd62c){_0x59505a=_0x59505a-0x0;var _0xeaf197=_0x86d7[_0x59505a];return _0xeaf197;};'use strict';var _=require('lodash');var util=require(_0x786d('0x0'));var moment=require('moment');var BPromise=require(_0x786d('0x1'));var rs=require(_0x786d('0x2'));var fs=require('fs');var Redis=require(_0x786d('0x3'));var db=require(_0x786d('0x4'))['db'];var utils=require(_0x786d('0x5'));var logger=require('../../config/logger')(_0x786d('0x6'));var config=require('../../config/environment');var jayson=require(_0x786d('0x7'));var client=jayson['client'][_0x786d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x289ff8,_0x33465a,_0x380285){return new BPromise(function(_0x877191,_0x42eb4e){return client['request'](_0x289ff8,_0x380285)[_0x786d('0x9')](function(_0x5e0da1){logger[_0x786d('0xa')]('VoiceQueuesLog,\x20%s,\x20%s',_0x33465a,_0x786d('0xb'));logger['debug']('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x33465a,_0x786d('0xb'),JSON['stringify'](_0x5e0da1));if(_0x5e0da1[_0x786d('0xc')]){if(_0x5e0da1['error']['code']===0x1f4){logger['error'](_0x786d('0xd'),_0x33465a,_0x5e0da1[_0x786d('0xc')][_0x786d('0xe')]);return _0x42eb4e(_0x5e0da1[_0x786d('0xc')][_0x786d('0xe')]);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x33465a,_0x5e0da1[_0x786d('0xc')][_0x786d('0xe')]);return _0x877191(_0x5e0da1['error'][_0x786d('0xe')]);}else{logger[_0x786d('0xa')](_0x786d('0xd'),_0x33465a,_0x786d('0xb'));_0x877191(_0x5e0da1[_0x786d('0xf')][_0x786d('0xe')]);}})[_0x786d('0x10')](function(_0x5406f9){logger[_0x786d('0xc')](_0x786d('0xd'),_0x33465a,_0x5406f9);_0x42eb4e(_0x5406f9);});});} \ No newline at end of file +var _0xf123=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x219d87,_0x1cb6f7){var _0x22823d=function(_0x5357bf){while(--_0x5357bf){_0x219d87['push'](_0x219d87['shift']());}};_0x22823d(++_0x1cb6f7);}(_0xf123,0x134));var _0x3f12=function(_0xd22d95,_0xc59f8f){_0xd22d95=_0xd22d95-0x0;var _0x15d7a3=_0xf123[_0xd22d95];return _0x15d7a3;};'use strict';var _=require('lodash');var util=require(_0x3f12('0x0'));var moment=require('moment');var BPromise=require(_0x3f12('0x1'));var rs=require(_0x3f12('0x2'));var fs=require('fs');var Redis=require(_0x3f12('0x3'));var db=require(_0x3f12('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3f12('0x5'))(_0x3f12('0x6'));var config=require('../../config/environment');var jayson=require(_0x3f12('0x7'));var client=jayson[_0x3f12('0x8')][_0x3f12('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x589443,_0x102c59,_0x4952b3){return new BPromise(function(_0x405186,_0x456ea3){return client[_0x3f12('0xa')](_0x589443,_0x4952b3)[_0x3f12('0xb')](function(_0xacff21){logger[_0x3f12('0xc')](_0x3f12('0xd'),_0x102c59,_0x3f12('0xe'));logger[_0x3f12('0xf')](_0x3f12('0x10'),_0x102c59,'request\x20sent',JSON[_0x3f12('0x11')](_0xacff21));if(_0xacff21[_0x3f12('0x12')]){if(_0xacff21['error'][_0x3f12('0x13')]===0x1f4){logger[_0x3f12('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x102c59,_0xacff21[_0x3f12('0x12')][_0x3f12('0x14')]);return _0x456ea3(_0xacff21['error']['message']);}logger[_0x3f12('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x102c59,_0xacff21['error'][_0x3f12('0x14')]);return _0x405186(_0xacff21[_0x3f12('0x12')]['message']);}else{logger[_0x3f12('0xc')](_0x3f12('0xd'),_0x102c59,'request\x20sent');_0x405186(_0xacff21['result'][_0x3f12('0x14')]);}})[_0x3f12('0x15')](function(_0x185f4b){logger[_0x3f12('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x102c59,_0x185f4b);_0x456ea3(_0x185f4b);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index e983575..533b191 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 _0xeb9a=['../../config/environment','./voiceRecording.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/download','download','/:id/downloads','/:id/transcribe','downloadTranscribe','create','post','update','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4b6685,_0x54583e){var _0x13b570=function(_0x324893){while(--_0x324893){_0x4b6685['push'](_0x4b6685['shift']());}};_0x13b570(++_0x54583e);}(_0xeb9a,0x13e));var _0xaeb9=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xeb9a[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xaeb9('0x0'));var util=require(_0xaeb9('0x1'));var path=require(_0xaeb9('0x2'));var timeout=require(_0xaeb9('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xaeb9('0x4'));var auth=require(_0xaeb9('0x5'));var interaction=require(_0xaeb9('0x6'));var config=require(_0xaeb9('0x7'));var controller=require(_0xaeb9('0x8'));router[_0xaeb9('0x9')]('/',auth['isAuthenticated'](),controller[_0xaeb9('0xa')]);router[_0xaeb9('0x9')](_0xaeb9('0xb'),auth[_0xaeb9('0xc')](),controller[_0xaeb9('0xd')]);router[_0xaeb9('0x9')](_0xaeb9('0xe'),auth[_0xaeb9('0xc')](),controller['show']);router['get'](_0xaeb9('0xf'),auth[_0xaeb9('0xc')](),controller[_0xaeb9('0x10')]);router[_0xaeb9('0x9')](_0xaeb9('0x11'),controller['downloads']);router[_0xaeb9('0x9')](_0xaeb9('0x12'),auth[_0xaeb9('0xc')](),controller[_0xaeb9('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaeb9('0x14')]);router[_0xaeb9('0x15')](_0xaeb9('0x12'),auth[_0xaeb9('0xc')](),controller['runTranscribe']);router['put'](_0xaeb9('0xe'),auth[_0xaeb9('0xc')](),controller[_0xaeb9('0x16')]);router['delete'](_0xaeb9('0xe'),auth[_0xaeb9('0xc')](),controller[_0xaeb9('0x17')]);module[_0xaeb9('0x18')]=router; \ No newline at end of file +var _0x8a19=['show','/:id/download','download','/:id/downloads','/:id/transcribe','downloadTranscribe','post','create','update','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x55de53,_0x5da3e7){var _0x362fbe=function(_0x3ed4fd){while(--_0x3ed4fd){_0x55de53['push'](_0x55de53['shift']());}};_0x362fbe(++_0x5da3e7);}(_0x8a19,0xfa));var _0x98a1=function(_0x2fa7d8,_0x43fb4d){_0x2fa7d8=_0x2fa7d8-0x0;var _0x1aa7a4=_0x8a19[_0x2fa7d8];return _0x1aa7a4;};'use strict';var multer=require('multer');var util=require(_0x98a1('0x0'));var path=require(_0x98a1('0x1'));var timeout=require(_0x98a1('0x2'));var express=require('express');var router=express[_0x98a1('0x3')]();var fs_extra=require(_0x98a1('0x4'));var auth=require(_0x98a1('0x5'));var interaction=require(_0x98a1('0x6'));var config=require('../../config/environment');var controller=require(_0x98a1('0x7'));router[_0x98a1('0x8')]('/',auth[_0x98a1('0x9')](),controller[_0x98a1('0xa')]);router[_0x98a1('0x8')](_0x98a1('0xb'),auth[_0x98a1('0x9')](),controller[_0x98a1('0xc')]);router['get'](_0x98a1('0xd'),auth[_0x98a1('0x9')](),controller[_0x98a1('0xe')]);router['get'](_0x98a1('0xf'),auth['isAuthenticated'](),controller[_0x98a1('0x10')]);router[_0x98a1('0x8')](_0x98a1('0x11'),controller['downloads']);router[_0x98a1('0x8')](_0x98a1('0x12'),auth[_0x98a1('0x9')](),controller[_0x98a1('0x13')]);router[_0x98a1('0x14')]('/',auth[_0x98a1('0x9')](),controller[_0x98a1('0x15')]);router[_0x98a1('0x14')](_0x98a1('0x12'),auth[_0x98a1('0x9')](),controller['runTranscribe']);router['put'](_0x98a1('0xd'),auth[_0x98a1('0x9')](),controller[_0x98a1('0x16')]);router['delete']('/:id',auth[_0x98a1('0x9')](),controller['destroy']);module[_0x98a1('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 901a84b..d661388 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(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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 cb09311..c86b126 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 _0xf91c=['Setting','transcribe','transcribeRegion','language','bucket','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','writeFile','fileText','root','eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','apply','reject','save','destroy','then','end','error','stack','name','index','rawAttributes','fieldName','type','model','differenceBy','map','query','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','merge','VIRTUAL','options','VoiceRecording','include','findAll','rows','catch','show','params','keys','includeAll','create','body','update','find','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','push','format','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','findOne','Voice\x20Recording\x20not\x20found'];(function(_0x1db251,_0xf0443d){var _0x56685a=function(_0x6ec6b7){while(--_0x6ec6b7){_0x1db251['push'](_0x1db251['shift']());}};_0x56685a(++_0xf0443d);}(_0xf91c,0xaf));var _0xcf91=function(_0x158988,_0x30addd){_0x158988=_0x158988-0x0;var _0x2bd5cd=_0xf91c[_0x158988];return _0x2bd5cd;};'use strict';var emlformat=require(_0xcf91('0x0'));var rimraf=require(_0xcf91('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcf91('0x2'));var moment=require('moment');var BPromise=require(_0xcf91('0x3'));var Mustache=require(_0xcf91('0x4'));var util=require(_0xcf91('0x5'));var path=require(_0xcf91('0x6'));var sox=require('sox');var csv=require(_0xcf91('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcf91('0x8'));var squel=require(_0xcf91('0x9'));var crypto=require(_0xcf91('0xa'));var jsforce=require(_0xcf91('0xb'));var deskjs=require(_0xcf91('0xc'));var toCsv=require(_0xcf91('0x7'));var querystring=require(_0xcf91('0xd'));var Papa=require('papaparse');var AWS=require(_0xcf91('0xe'));var uuidv4=require(_0xcf91('0xf'));var Redis=require('ioredis');var authService=require(_0xcf91('0x10'));var qs=require(_0xcf91('0x11'));var as=require(_0xcf91('0x12'));var hardwareService=require(_0xcf91('0x13'));var logger=require(_0xcf91('0x14'))(_0xcf91('0x15'));var utils=require(_0xcf91('0x16'));var config=require(_0xcf91('0x17'));var licenseUtil=require(_0xcf91('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x224af,_0x11b005){_0x11b005=_0x11b005||0xcc;return function(_0x54bfd1){if(_0x54bfd1){return _0x224af[_0xcf91('0x19')](_0x11b005);}return _0x224af[_0xcf91('0x1a')](_0x11b005)['end']();};}function respondWithResult(_0x180d4b,_0x15cfdc){_0x15cfdc=_0x15cfdc||0xc8;return function(_0x49aba0){if(_0x49aba0){return _0x180d4b['status'](_0x15cfdc)[_0xcf91('0x1b')](_0x49aba0);}};}function respondWithFilteredResult(_0x5e5e1d,_0x2f2a5a){return function(_0x5822af){if(_0x5822af){var _0x5bc7db=typeof _0x2f2a5a[_0xcf91('0x1c')]==='undefined'&&typeof _0x2f2a5a['limit']===_0xcf91('0x1d');var _0x6a8df2=_0x5822af[_0xcf91('0x1e')];var _0x2ec242=_0x5bc7db?0x0:_0x2f2a5a[_0xcf91('0x1c')];var _0x474183=_0x5bc7db?_0x5822af[_0xcf91('0x1e')]:_0x2f2a5a[_0xcf91('0x1c')]+_0x2f2a5a['limit'];var _0x433378;if(_0x474183>=_0x6a8df2){_0x474183=_0x6a8df2;_0x433378=0xc8;}else{_0x433378=0xce;}_0x5e5e1d['status'](_0x433378);return _0x5e5e1d['set']('Content-Range',_0x2ec242+'-'+_0x474183+'/'+_0x6a8df2)[_0xcf91('0x1b')](_0x5822af);}return null;};}function patchUpdates(_0x19cf5e){return function(_0xf12bd4){try{jsonpatch[_0xcf91('0x1f')](_0xf12bd4,_0x19cf5e,!![]);}catch(_0x4e2e4b){return BPromise[_0xcf91('0x20')](_0x4e2e4b);}return _0xf12bd4[_0xcf91('0x21')]();};}function saveUpdates(_0xd2e09d,_0x358e31){return function(_0x4838c0){if(_0x4838c0){return _0x4838c0['update'](_0xd2e09d)['then'](function(_0x375d03){return _0x375d03;});}return null;};}function removeEntity(_0x2661a2,_0x5316d3){return function(_0x34e5a2){if(_0x34e5a2){return _0x34e5a2[_0xcf91('0x22')]()[_0xcf91('0x23')](function(){_0x2661a2[_0xcf91('0x1a')](0xcc)[_0xcf91('0x24')]();});}};}function handleEntityNotFound(_0x4b025d,_0x3a8468){return function(_0x3e4ea8){if(!_0x3e4ea8){_0x4b025d[_0xcf91('0x19')](0x194);}return _0x3e4ea8;};}function handleError(_0x1e5559,_0x36ffda){_0x36ffda=_0x36ffda||0x1f4;return function(_0x44650b){logger[_0xcf91('0x25')](_0x44650b[_0xcf91('0x26')]);if(_0x44650b[_0xcf91('0x27')]){delete _0x44650b[_0xcf91('0x27')];}_0x1e5559['status'](_0x36ffda)['send'](_0x44650b);};}exports[_0xcf91('0x28')]=function(_0x474ac4,_0xdc7059){var _0x5d4680={},_0x198283={},_0x5f1ddc={'count':0x0,'rows':[]};var _0x123b1f=_['map'](db['VoiceRecording'][_0xcf91('0x29')],function(_0x5e98ac){return{'name':_0x5e98ac[_0xcf91('0x2a')],'type':_0x5e98ac[_0xcf91('0x2b')]['key']};});_0x198283[_0xcf91('0x2c')]=_[_0xcf91('0x2d')](_[_0xcf91('0x2e')](_0x123b1f,_0xcf91('0x27')),['format']);_0x198283['query']=_['keys'](_0x474ac4[_0xcf91('0x2f')]);_0x198283[_0xcf91('0x30')]=_[_0xcf91('0x31')](_0x198283['model'],_0x198283[_0xcf91('0x2f')]);_0x5d4680[_0xcf91('0x32')]=_[_0xcf91('0x31')](_0x198283[_0xcf91('0x2c')],qs['fields'](_0x474ac4[_0xcf91('0x2f')][_0xcf91('0x33')]));_0x5d4680['attributes']=_0x5d4680[_0xcf91('0x32')][_0xcf91('0x34')]?_0x5d4680[_0xcf91('0x32')]:_0x198283[_0xcf91('0x2c')];if(!_0x474ac4[_0xcf91('0x2f')]['hasOwnProperty'](_0xcf91('0x35'))){_0x5d4680[_0xcf91('0x36')]=qs[_0xcf91('0x36')](_0x474ac4[_0xcf91('0x2f')][_0xcf91('0x36')]);_0x5d4680[_0xcf91('0x1c')]=qs['offset'](_0x474ac4[_0xcf91('0x2f')][_0xcf91('0x1c')]);}_0x5d4680['order']=qs[_0xcf91('0x37')](_0x474ac4[_0xcf91('0x2f')]['sort']);_0x5d4680[_0xcf91('0x38')]=qs[_0xcf91('0x30')](_['pick'](_0x474ac4[_0xcf91('0x2f')],_0x198283[_0xcf91('0x30')]),_0x123b1f);if(_0x474ac4['query']['filter']){_0x5d4680['where']=_[_0xcf91('0x39')](_0x5d4680[_0xcf91('0x38')],{'$or':_['map'](_0x123b1f,function(_0x619f1c){if(_0x619f1c[_0xcf91('0x2b')]!==_0xcf91('0x3a')){var _0x225cb7={};_0x225cb7[_0x619f1c['name']]={'$like':'%'+_0x474ac4[_0xcf91('0x2f')]['filter']+'%'};return _0x225cb7;}})});}_0x5d4680=_[_0xcf91('0x39')]({},_0x5d4680,_0x474ac4[_0xcf91('0x3b')]);var _0x287200={'where':_0x5d4680[_0xcf91('0x38')]};return db[_0xcf91('0x3c')][_0xcf91('0x1e')](_0x287200)[_0xcf91('0x23')](function(_0x540707){_0x5f1ddc['count']=_0x540707;if(_0x474ac4[_0xcf91('0x2f')]['includeAll']){_0x5d4680[_0xcf91('0x3d')]=[{'all':!![]}];}return db[_0xcf91('0x3c')][_0xcf91('0x3e')](_0x5d4680);})['then'](function(_0x5060bd){_0x5f1ddc[_0xcf91('0x3f')]=_0x5060bd;return _0x5f1ddc;})[_0xcf91('0x23')](respondWithFilteredResult(_0xdc7059,_0x5d4680))[_0xcf91('0x40')](handleError(_0xdc7059,null));};exports[_0xcf91('0x41')]=function(_0x299340,_0x203ece){var _0x4c1474={'raw':![],'where':{'id':_0x299340[_0xcf91('0x42')]['id']}},_0x4fe3a6={};_0x4fe3a6['model']=_[_0xcf91('0x43')](db[_0xcf91('0x3c')][_0xcf91('0x29')]);_0x4fe3a6['query']=_[_0xcf91('0x43')](_0x299340[_0xcf91('0x2f')]);_0x4fe3a6[_0xcf91('0x30')]=_['intersection'](_0x4fe3a6[_0xcf91('0x2c')],_0x4fe3a6[_0xcf91('0x2f')]);_0x4c1474[_0xcf91('0x32')]=_[_0xcf91('0x31')](_0x4fe3a6[_0xcf91('0x2c')],qs[_0xcf91('0x33')](_0x299340[_0xcf91('0x2f')][_0xcf91('0x33')]));_0x4c1474[_0xcf91('0x32')]=_0x4c1474[_0xcf91('0x32')][_0xcf91('0x34')]?_0x4c1474[_0xcf91('0x32')]:_0x4fe3a6['model'];if(_0x299340[_0xcf91('0x2f')][_0xcf91('0x44')]){_0x4c1474[_0xcf91('0x3d')]=[{'all':!![]}];}_0x4c1474=_[_0xcf91('0x39')]({},_0x4c1474,_0x299340[_0xcf91('0x3b')]);return db[_0xcf91('0x3c')]['find'](_0x4c1474)[_0xcf91('0x23')](handleEntityNotFound(_0x203ece,null))[_0xcf91('0x23')](respondWithResult(_0x203ece,null))[_0xcf91('0x40')](handleError(_0x203ece,null));};exports[_0xcf91('0x45')]=function(_0x45aad4,_0x3daa81){return db[_0xcf91('0x3c')]['create'](_0x45aad4[_0xcf91('0x46')],{})[_0xcf91('0x23')](respondWithResult(_0x3daa81,0xc9))['catch'](handleError(_0x3daa81,null));};exports[_0xcf91('0x47')]=function(_0x6eb1e6,_0x55bdcc){if(_0x6eb1e6[_0xcf91('0x46')]['id']){delete _0x6eb1e6[_0xcf91('0x46')]['id'];}return db[_0xcf91('0x3c')][_0xcf91('0x48')]({'where':{'id':_0x6eb1e6[_0xcf91('0x42')]['id']}})[_0xcf91('0x23')](handleEntityNotFound(_0x55bdcc,null))['then'](saveUpdates(_0x6eb1e6[_0xcf91('0x46')],null))[_0xcf91('0x23')](respondWithResult(_0x55bdcc,null))[_0xcf91('0x40')](handleError(_0x55bdcc,null));};exports[_0xcf91('0x49')]=function(_0x560a59,_0x4df22f){return db[_0xcf91('0x3c')][_0xcf91('0x49')]()[_0xcf91('0x23')](respondWithResult(_0x4df22f,null))[_0xcf91('0x40')](handleError(_0x4df22f,null));};exports[_0xcf91('0x4a')]=function(_0xf523e5,_0x53f9b3,_0x50940f){var _0x32cd48=require(_0xcf91('0x4b'));var _0x4e7792=![];var _0x4804b4={};if(_0xf523e5['query'][_0xcf91('0x2b')]&&_0xf523e5[_0xcf91('0x2f')][_0xcf91('0x2b')]===_0xcf91('0x4c')){_0x4804b4[_0xcf91('0x4c')]=_0xf523e5[_0xcf91('0x42')]['id'];}else{_0x4804b4['id']=_0xf523e5[_0xcf91('0x42')]['id'];}return db['VoiceRecording'][_0xcf91('0x48')]({'where':_0x4804b4,'attributes':['id',_0xcf91('0x4d')],'raw':!![]})[_0xcf91('0x23')](handleEntityNotFound(_0x53f9b3,null))[_0xcf91('0x23')](function(_0x262504){if(_0x262504){var _0x2d6075=_0x262504[_0xcf91('0x4d')];var _0x474736=util['format'](_0xcf91('0x4e'),_0x2d6075);if(fs[_0xcf91('0x4f')](_0x474736)){_0x4e7792=!![];return _0x32cd48[_0xcf91('0x50')](_0x474736,_0x2d6075,config[_0xcf91('0x51')][_0xcf91('0x52')])[_0xcf91('0x23')](function(){return _0x262504;});}return _0x262504;}})[_0xcf91('0x23')](function(_0x916965){if(_0x916965){var _0x2655cc=_0x916965['value'];if(!fs[_0xcf91('0x4f')](_0x2655cc)){throw new db[(_0xcf91('0x53'))][(_0xcf91('0x54'))](_0xcf91('0x55'));}if(_0x916965[_0xcf91('0x56')]){return _0x53f9b3[_0xcf91('0x4a')](_0x2655cc,_0x916965[_0xcf91('0x56')]+path[_0xcf91('0x57')](_0x2655cc),function(){if(_0x4e7792){fs['unlink'](_0x2655cc);}});}else{return _0x53f9b3[_0xcf91('0x4a')](_0x2655cc,function(_0x3ee65e){if(_0x4e7792){fs[_0xcf91('0x58')](_0x2655cc);}});}}})[_0xcf91('0x40')](function(_0x5e5735){if(_0x5e5735[_0xcf91('0x59')]===_0xcf91('0x55')){_0x53f9b3[_0xcf91('0x1a')](0x194)['send'](_0xcf91('0x5a'));}else{return handleError(_0x53f9b3,null);}});};exports[_0xcf91('0x5b')]=function(_0x21df4d,_0x1f291a,_0x11c1a9){var _0x2c43ba=require('../../components/encryptor');var _0x1dc992=![];var _0x20ee6f={'$and':[db[_0xcf91('0x5c')][_0xcf91('0x38')](db[_0xcf91('0x5c')]['fn'](_0xcf91('0x5d'),db[_0xcf91('0x5c')][_0xcf91('0x5e')](_0xcf91('0x4c'))),_0x21df4d[_0xcf91('0x2f')][_0xcf91('0x5f')])]};if(_0x21df4d[_0xcf91('0x2f')][_0xcf91('0x2b')]&&_0x21df4d[_0xcf91('0x2f')]['type']===_0xcf91('0x4c')){_0x20ee6f['$and'][_0xcf91('0x60')]({'uniqueid':_0x21df4d[_0xcf91('0x42')]['id']});}else{_0x20ee6f['$and'][_0xcf91('0x60')]({'id':_0x21df4d[_0xcf91('0x42')]['id']});}return db[_0xcf91('0x3c')][_0xcf91('0x48')]({'where':_0x20ee6f,'attributes':['id','value'],'raw':!![]})[_0xcf91('0x23')](handleEntityNotFound(_0x1f291a,null))[_0xcf91('0x23')](function(_0x46bdd6){if(_0x46bdd6){var _0x48f721=util[_0xcf91('0x61')]('%s.cypher',_0x46bdd6[_0xcf91('0x4d')]);if(fs['existsSync'](_0x48f721)){_0x1dc992=!![];return _0x2c43ba[_0xcf91('0x50')](_0x48f721,_0x46bdd6[_0xcf91('0x4d')],config[_0xcf91('0x51')][_0xcf91('0x52')])['then'](function(){return _0x46bdd6;});}return _0x46bdd6;}})[_0xcf91('0x23')](function(_0x2b7b4f){if(_0x2b7b4f){if(!fs['existsSync'](_0x2b7b4f[_0xcf91('0x4d')])){throw new db[(_0xcf91('0x53'))]['ValidationError'](_0xcf91('0x55'));}if(_0x2b7b4f[_0xcf91('0x56')]){return _0x1f291a['download'](_0x2b7b4f[_0xcf91('0x4d')],_0x2b7b4f[_0xcf91('0x56')]+path[_0xcf91('0x57')](_0x2b7b4f['value']),function(){if(_0x1dc992){fs['unlink'](_0x2b7b4f[_0xcf91('0x4d')]);}});}else{return _0x1f291a[_0xcf91('0x4a')](_0x2b7b4f['value'],function(_0x57088f){if(_0x1dc992){fs[_0xcf91('0x58')](_0x2b7b4f[_0xcf91('0x4d')]);}});}}})['catch'](handleError(_0x1f291a,null));};exports[_0xcf91('0x22')]=function(_0x1d68f3,_0xccabea){return db[_0xcf91('0x3c')]['find']({'where':{'id':_0x1d68f3[_0xcf91('0x42')]['id']}})['then'](function(_0x259775){if(_[_0xcf91('0x62')](_0x259775)){throw new ReferenceError(_0xcf91('0x63'));}return _0x259775;})[_0xcf91('0x23')](function(_0xca8486){var _0x23f727=_0xca8486[_0xcf91('0x4d')];logger[_0xcf91('0x64')](_0xcf91('0x65'),_0x23f727);if(!_[_0xcf91('0x62')](_0xca8486[_0xcf91('0x4d')])&&fs['existsSync'](_0x23f727)){logger['info'](_0xcf91('0x66')+_0x23f727+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xcf91('0x67')](_0x23f727);}_0x23f727=_0x23f727+_0xcf91('0x68');if(!_[_0xcf91('0x62')](_0xca8486['value'])&&fs[_0xcf91('0x4f')](_0x23f727)){logger[_0xcf91('0x64')](_0xcf91('0x66')+_0x23f727+_0xcf91('0x69'));fs['unlinkSync'](_0x23f727);}return _0xca8486;})[_0xcf91('0x23')](function(_0x3c5c8b){if(!_0x3c5c8b)throw new InternalError();return _0x3c5c8b['destroy']();})['then'](function(){_0xccabea[_0xcf91('0x1a')](0xcc)[_0xcf91('0x24')]();})[_0xcf91('0x40')](handleError(_0xccabea,null));};function getBucketslist(_0x234b1e,_0x329e04,_0x596a25){return new Promise(function(_0x3722b4,_0x5790e4){var _0x230784=new AWS['S3']({'accessKeyId':_0x329e04,'secretAccessKey':_0x234b1e,'region':_0x596a25});_0x230784[_0xcf91('0x6a')]({},function(_0x25e9b2,_0xcab055){if(_0x25e9b2){return _0x5790e4(_0x25e9b2);}else{return _0x3722b4(_0xcab055);}});});}function createBucket(_0x1eac55,_0x2df2ab,_0x45b5f4,_0xc0b510){return new Promise(function(_0x4d9a83,_0x1e2895){var _0x1b58f0=new AWS['S3']({'accessKeyId':_0x2df2ab,'secretAccessKey':_0x1eac55,'region':_0x45b5f4});_0x1b58f0[_0xcf91('0x6b')]({'Bucket':_0xc0b510},function(_0x59c67a,_0x5e3dec){if(_0x59c67a){return _0x1e2895(_0x59c67a);}else{return _0x4d9a83(_0x5e3dec);}});});}function uploadFile(_0x37b917,_0x25db12,_0x47f9e0,_0x507ed7,_0x468ab2,_0x1683b8){return new Promise(function(_0x30ae92,_0x2297dc){var _0x5e2b46=new AWS['S3']({'accessKeyId':_0x25db12,'secretAccessKey':_0x37b917,'region':_0x47f9e0});_0x5e2b46[_0xcf91('0x6c')]({'Bucket':_0x507ed7,'Key':_0x468ab2,'Body':_0x1683b8},function(_0x304679,_0x2171a0){if(_0x304679){return _0x2297dc(_0x304679);}else{return _0x30ae92(_0x2171a0);}});});}function startTranscribe(_0x221db7,_0xf87d43,_0x19a72c,_0x5b5474,_0x11d519,_0x436f3b){return new Promise(function(_0x48a1ed,_0x4efb00){var _0x13a030=new AWS[(_0xcf91('0x6d'))]({'accessKeyId':_0xf87d43,'secretAccessKey':_0x221db7,'region':_0x19a72c});_0x13a030[_0xcf91('0x6e')]({'TranscriptionJobName':_0x5b5474,'LanguageCode':_0x11d519,'Media':{'MediaFileUri':_0x436f3b}},function(_0x1c5000,_0x5eb399){if(_0x1c5000){return _0x4efb00(_0x1c5000);}else{return _0x48a1ed(_0x5eb399);}});});}function transcribe(_0x10dbb1,_0x483720,_0x534322,_0x100ca4,_0x5bdee9,_0x3c49e2,_0x5b41d8){return new Promise(function(_0x7744b6,_0x2c681b){var _0x350ce6={};logger[_0xcf91('0x64')](util[_0xcf91('0x61')](_0xcf91('0x6f'),_0x10dbb1,_0x5bdee9));return uploadFile(_0x483720,_0x534322,_0x100ca4,_0x5bdee9,path[_0xcf91('0x70')](_0x3c49e2),fs[_0xcf91('0x71')](_0x3c49e2))[_0xcf91('0x23')](function(_0x21dd0c){logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x10dbb1,_0x5bdee9,_0x21dd0c[_0xcf91('0x72')]));_0x350ce6['bucket']=_0x21dd0c[_0xcf91('0x73')];_0x350ce6[_0xcf91('0x74')]=_0x21dd0c[_0xcf91('0x72')];logger[_0xcf91('0x64')](util[_0xcf91('0x61')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x10dbb1));return startTranscribe(_0x483720,_0x534322,_0x100ca4,uuidv4(),_0x5b41d8,_0x21dd0c[_0xcf91('0x72')]);})['then'](function(_0x194c2b){logger['info'](util[_0xcf91('0x61')](_0xcf91('0x75'),_0x10dbb1,_0x194c2b[_0xcf91('0x76')][_0xcf91('0x77')]));_0x350ce6[_0xcf91('0x78')]=_0x194c2b[_0xcf91('0x76')][_0xcf91('0x77')];_0x350ce6['transcribeStatus']=_0x194c2b['TranscriptionJob']['TranscriptionJobStatus'];return _0x7744b6(_0x350ce6);})[_0xcf91('0x40')](function(_0x24cade){return _0x2c681b(_0x24cade);});});}exports['runTranscribe']=function(_0xd572d9,_0x8fe4b1,_0x35ecdb){var _0x1501f1;var _0x559511;var _0x567e0e;var _0x1a257e=require(_0xcf91('0x4b'));return db[_0xcf91('0x3c')][_0xcf91('0x79')]({'where':{'id':_0xd572d9[_0xcf91('0x42')]['id']}})[_0xcf91('0x23')](function(_0x5a4e6a){if(_0x5a4e6a){var _0x127e2c=util[_0xcf91('0x61')]('%s.cypher',_0x5a4e6a[_0xcf91('0x4d')]);if(fs[_0xcf91('0x4f')](_0x127e2c)){cypher=!![];return _0x1a257e[_0xcf91('0x50')](_0x127e2c,_0x5a4e6a[_0xcf91('0x4d')],config[_0xcf91('0x51')][_0xcf91('0x52')])[_0xcf91('0x23')](function(){return _0x5a4e6a;});}return _0x5a4e6a;}})[_0xcf91('0x23')](function(_0xcd35ef){if(!_0xcd35ef){throw new db[(_0xcf91('0x53'))][(_0xcf91('0x54'))](_0xcf91('0x7a'));}_0x559511=_0xcd35ef;return db[_0xcf91('0x7b')][_0xcf91('0x79')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x8fe4b1,null))[_0xcf91('0x23')](function(_0x1cb221){if(_0x1cb221){_0x1501f1=_0x1cb221;if(!_0x1501f1[_0xcf91('0x7c')]||!_0x1501f1['transcribeAccountId']||!_0x1501f1[_0xcf91('0x7d')]||!_0x1501f1[_0xcf91('0x7e')]||!_0x1501f1[_0xcf91('0x7f')]){throw new db[(_0xcf91('0x53'))]['ValidationError'](_0xcf91('0x80'));}if(_0xd572d9['body'][_0xcf91('0x81')]&&(!_0x1501f1[_0xcf91('0x82')]||!_0x1501f1[_0xcf91('0x83')]||!_0x1501f1['sentimentRegion']||!_0x1501f1[_0xcf91('0x7e')]||!_0x1501f1[_0xcf91('0x7f')])){throw new db[(_0xcf91('0x53'))][(_0xcf91('0x54'))](_0xcf91('0x84'));}return db[_0xcf91('0x85')][_0xcf91('0x79')]({'where':{'id':_0x1501f1[_0xcf91('0x86')]}});}})['then'](function(_0x49702f){if(!_0x49702f){throw new db['Sequelize'][(_0xcf91('0x54'))](_0xcf91('0x87'));}if(!_0x49702f[_0xcf91('0x88')]||!_0x49702f[_0xcf91('0x89')]){throw new db[(_0xcf91('0x53'))][(_0xcf91('0x54'))](_0xcf91('0x8a'));}_0x567e0e=_0x49702f;return getBucketslist(_0x567e0e['data1'],_0x567e0e[_0xcf91('0x89')],_0x1501f1[_0xcf91('0x7d')]);})['then'](function(_0x5b82cc){if(_0x5b82cc&&_0x5b82cc[_0xcf91('0x8b')]){var _0x239c5b=_[_0xcf91('0x48')](_0x5b82cc[_0xcf91('0x8b')],function(_0x380690){return _0x380690[_0xcf91('0x8c')]===_0x1501f1[_0xcf91('0x7f')];});if(!_0x239c5b){logger[_0xcf91('0x64')](util[_0xcf91('0x61')](_0xcf91('0x8d'),_0xd572d9[_0xcf91('0x42')]['id'],_0x1501f1[_0xcf91('0x7f')]));return createBucket(_0x567e0e['data1'],_0x567e0e[_0xcf91('0x89')],_0x1501f1[_0xcf91('0x7d')],_0x1501f1['bucket']);}logger[_0xcf91('0x64')](util[_0xcf91('0x61')](_0xcf91('0x8e'),_0xd572d9[_0xcf91('0x42')]['id'],_0x1501f1[_0xcf91('0x7f')]));return;}})[_0xcf91('0x23')](function(_0x31a1b2){if(_0x559511[_0xcf91('0x8f')]==='NEW'){return transcribe(_0xd572d9[_0xcf91('0x42')]['id'],_0x567e0e[_0xcf91('0x88')],_0x567e0e[_0xcf91('0x89')],_0x1501f1[_0xcf91('0x7d')],_0x1501f1['bucket'],_0x559511[_0xcf91('0x4d')],_0x1501f1[_0xcf91('0x7e')]);}else{logger[_0xcf91('0x64')](util[_0xcf91('0x61')](_0xcf91('0x90'),_0xd572d9[_0xcf91('0x42')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0xcf91('0x23')](function(_0x566cc4){if(_0x566cc4){_0x566cc4[_0xcf91('0x91')]=_0xd572d9['body'][_0xcf91('0x81')];return _0x559511['updateAttributes'](_0x566cc4);}})['then'](respondWithResult(_0x8fe4b1,null))[_0xcf91('0x40')](handleError(_0x8fe4b1,null));};function writeFile(_0x234f9e,_0x43e5fe){return new Promise(function(_0x1908f8,_0x32db5f){fs[_0xcf91('0x92')](_0x43e5fe,_0x234f9e,function(_0x15c4b5,_0x49378a){if(_0x15c4b5){return _0x32db5f(_0x15c4b5);}else{return _0x1908f8(_0x49378a);}});});}exports['downloadTranscribe']=function(_0x441770,_0xd8eec6,_0x244d4f){return db[_0xcf91('0x3c')][_0xcf91('0x79')]({'where':{'id':_0x441770['params']['id']}})[_0xcf91('0x23')](handleEntityNotFound(_0xd8eec6))['then'](function(_0x3da141){if(_0x3da141&&_0x3da141[_0xcf91('0x93')]){var _0x208c86=_0x3da141[_0xcf91('0x93')];var _0x568037=config[_0xcf91('0x94')]+'/server/files/transcribes/transcribe_'+_0x3da141['id']+'.txt';if(fs[_0xcf91('0x4f')](_0x568037)){return _0x568037;}return writeFile(_0x208c86,_0x568037)['then'](function(){return _0x568037;});}else{throw new db[(_0xcf91('0x53'))][(_0xcf91('0x54'))]('Transcript\x20not\x20available');}})[_0xcf91('0x23')](function(_0xf3c9e3){return _0xd8eec6[_0xcf91('0x4a')](_0xf3c9e3);})[_0xcf91('0x40')](handleError(_0xd8eec6));}; \ No newline at end of file +var _0xc7a5=['save','update','then','destroy','end','sendStatus','stack','name','index','map','VoiceRecording','fieldName','key','model','differenceBy','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','create','body','find','describe','download','../../components/encryptor','uniqueid','value','format','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','filename','extname','message','send','Not\x20found','downloads','sequelize','MD5','col','push','$and','unlink','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','upload','basename','Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe','Setting','findOne','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','CloudProvider','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','IN_PROGRESS','tempSentiment','updateAttributes','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject'];(function(_0x2ae0bf,_0x41bd97){var _0x41480c=function(_0x2d4da1){while(--_0x2d4da1){_0x2ae0bf['push'](_0x2ae0bf['shift']());}};_0x41480c(++_0x41bd97);}(_0xc7a5,0x105));var _0x5c7a=function(_0x1a0704,_0x4fd121){_0x1a0704=_0x1a0704-0x0;var _0x1b13a5=_0xc7a5[_0x1a0704];return _0x1b13a5;};'use strict';var emlformat=require(_0x5c7a('0x0'));var rimraf=require(_0x5c7a('0x1'));var zipdir=require(_0x5c7a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5c7a('0x3'));var moment=require(_0x5c7a('0x4'));var BPromise=require(_0x5c7a('0x5'));var Mustache=require(_0x5c7a('0x6'));var util=require(_0x5c7a('0x7'));var path=require(_0x5c7a('0x8'));var sox=require(_0x5c7a('0x9'));var csv=require(_0x5c7a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5c7a('0xb'));var _=require('lodash');var squel=require(_0x5c7a('0xc'));var crypto=require('crypto');var jsforce=require(_0x5c7a('0xd'));var deskjs=require(_0x5c7a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5c7a('0xf'));var Papa=require(_0x5c7a('0x10'));var AWS=require(_0x5c7a('0x11'));var uuidv4=require(_0x5c7a('0x12'));var Redis=require(_0x5c7a('0x13'));var authService=require(_0x5c7a('0x14'));var qs=require(_0x5c7a('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5c7a('0x16'));var logger=require(_0x5c7a('0x17'))('api');var utils=require(_0x5c7a('0x18'));var config=require(_0x5c7a('0x19'));var licenseUtil=require(_0x5c7a('0x1a'));var db=require(_0x5c7a('0x1b'))['db'];function respondWithStatusCode(_0x4265b1,_0xdf128f){_0xdf128f=_0xdf128f||0xcc;return function(_0x19bac8){if(_0x19bac8){return _0x4265b1['sendStatus'](_0xdf128f);}return _0x4265b1[_0x5c7a('0x1c')](_0xdf128f)['end']();};}function respondWithResult(_0x1fc4a0,_0x2c3ee0){_0x2c3ee0=_0x2c3ee0||0xc8;return function(_0x15b2b9){if(_0x15b2b9){return _0x1fc4a0['status'](_0x2c3ee0)[_0x5c7a('0x1d')](_0x15b2b9);}};}function respondWithFilteredResult(_0x4711c5,_0x1d9060){return function(_0xf97cab){if(_0xf97cab){var _0x28899d=typeof _0x1d9060[_0x5c7a('0x1e')]===_0x5c7a('0x1f')&&typeof _0x1d9060[_0x5c7a('0x20')]===_0x5c7a('0x1f');var _0x472dcc=_0xf97cab[_0x5c7a('0x21')];var _0x521957=_0x28899d?0x0:_0x1d9060[_0x5c7a('0x1e')];var _0x31bad6=_0x28899d?_0xf97cab[_0x5c7a('0x21')]:_0x1d9060[_0x5c7a('0x1e')]+_0x1d9060['limit'];var _0x54d412;if(_0x31bad6>=_0x472dcc){_0x31bad6=_0x472dcc;_0x54d412=0xc8;}else{_0x54d412=0xce;}_0x4711c5[_0x5c7a('0x1c')](_0x54d412);return _0x4711c5[_0x5c7a('0x22')]('Content-Range',_0x521957+'-'+_0x31bad6+'/'+_0x472dcc)[_0x5c7a('0x1d')](_0xf97cab);}return null;};}function patchUpdates(_0x2b1a1a){return function(_0x49dca2){try{jsonpatch[_0x5c7a('0x23')](_0x49dca2,_0x2b1a1a,!![]);}catch(_0x11b086){return BPromise[_0x5c7a('0x24')](_0x11b086);}return _0x49dca2[_0x5c7a('0x25')]();};}function saveUpdates(_0x499f8a,_0x51cc6b){return function(_0x7bb3b3){if(_0x7bb3b3){return _0x7bb3b3[_0x5c7a('0x26')](_0x499f8a)[_0x5c7a('0x27')](function(_0x5ec48c){return _0x5ec48c;});}return null;};}function removeEntity(_0x2f3b9f,_0x522e02){return function(_0x16f2bd){if(_0x16f2bd){return _0x16f2bd[_0x5c7a('0x28')]()[_0x5c7a('0x27')](function(){_0x2f3b9f['status'](0xcc)[_0x5c7a('0x29')]();});}};}function handleEntityNotFound(_0x5b36fa,_0x404d2f){return function(_0xf54b59){if(!_0xf54b59){_0x5b36fa[_0x5c7a('0x2a')](0x194);}return _0xf54b59;};}function handleError(_0x116fcb,_0x59cf96){_0x59cf96=_0x59cf96||0x1f4;return function(_0x55ec1f){logger['error'](_0x55ec1f[_0x5c7a('0x2b')]);if(_0x55ec1f[_0x5c7a('0x2c')]){delete _0x55ec1f[_0x5c7a('0x2c')];}_0x116fcb['status'](_0x59cf96)['send'](_0x55ec1f);};}exports[_0x5c7a('0x2d')]=function(_0x3cafba,_0x448472){var _0x4cfa0d={},_0x24fbc5={},_0x4b7682={'count':0x0,'rows':[]};var _0x591570=_[_0x5c7a('0x2e')](db[_0x5c7a('0x2f')]['rawAttributes'],function(_0x2150f5){return{'name':_0x2150f5[_0x5c7a('0x30')],'type':_0x2150f5['type'][_0x5c7a('0x31')]};});_0x24fbc5[_0x5c7a('0x32')]=_[_0x5c7a('0x33')](_[_0x5c7a('0x2e')](_0x591570,_0x5c7a('0x2c')),['format']);_0x24fbc5['query']=_[_0x5c7a('0x34')](_0x3cafba[_0x5c7a('0x35')]);_0x24fbc5[_0x5c7a('0x36')]=_[_0x5c7a('0x37')](_0x24fbc5[_0x5c7a('0x32')],_0x24fbc5[_0x5c7a('0x35')]);_0x4cfa0d[_0x5c7a('0x38')]=_['intersection'](_0x24fbc5['model'],qs[_0x5c7a('0x39')](_0x3cafba[_0x5c7a('0x35')]['fields']));_0x4cfa0d[_0x5c7a('0x38')]=_0x4cfa0d[_0x5c7a('0x38')][_0x5c7a('0x3a')]?_0x4cfa0d[_0x5c7a('0x38')]:_0x24fbc5['model'];if(!_0x3cafba['query'][_0x5c7a('0x3b')](_0x5c7a('0x3c'))){_0x4cfa0d[_0x5c7a('0x20')]=qs[_0x5c7a('0x20')](_0x3cafba[_0x5c7a('0x35')][_0x5c7a('0x20')]);_0x4cfa0d[_0x5c7a('0x1e')]=qs[_0x5c7a('0x1e')](_0x3cafba[_0x5c7a('0x35')]['offset']);}_0x4cfa0d[_0x5c7a('0x3d')]=qs['sort'](_0x3cafba[_0x5c7a('0x35')]['sort']);_0x4cfa0d['where']=qs['filters'](_[_0x5c7a('0x3e')](_0x3cafba[_0x5c7a('0x35')],_0x24fbc5[_0x5c7a('0x36')]),_0x591570);if(_0x3cafba[_0x5c7a('0x35')][_0x5c7a('0x3f')]){_0x4cfa0d[_0x5c7a('0x40')]=_[_0x5c7a('0x41')](_0x4cfa0d[_0x5c7a('0x40')],{'$or':_[_0x5c7a('0x2e')](_0x591570,function(_0x1f36bc){if(_0x1f36bc[_0x5c7a('0x42')]!==_0x5c7a('0x43')){var _0x1566b5={};_0x1566b5[_0x1f36bc[_0x5c7a('0x2c')]]={'$like':'%'+_0x3cafba[_0x5c7a('0x35')][_0x5c7a('0x3f')]+'%'};return _0x1566b5;}})});}_0x4cfa0d=_['merge']({},_0x4cfa0d,_0x3cafba[_0x5c7a('0x44')]);var _0xceb786={'where':_0x4cfa0d[_0x5c7a('0x40')]};return db[_0x5c7a('0x2f')]['count'](_0xceb786)[_0x5c7a('0x27')](function(_0x30a916){_0x4b7682[_0x5c7a('0x21')]=_0x30a916;if(_0x3cafba[_0x5c7a('0x35')][_0x5c7a('0x45')]){_0x4cfa0d['include']=[{'all':!![]}];}return db[_0x5c7a('0x2f')][_0x5c7a('0x46')](_0x4cfa0d);})[_0x5c7a('0x27')](function(_0x39a555){_0x4b7682[_0x5c7a('0x47')]=_0x39a555;return _0x4b7682;})[_0x5c7a('0x27')](respondWithFilteredResult(_0x448472,_0x4cfa0d))[_0x5c7a('0x48')](handleError(_0x448472,null));};exports[_0x5c7a('0x49')]=function(_0x3c6a9b,_0x4600a5){var _0x414e68={'raw':![],'where':{'id':_0x3c6a9b[_0x5c7a('0x4a')]['id']}},_0x15c811={};_0x15c811[_0x5c7a('0x32')]=_[_0x5c7a('0x34')](db[_0x5c7a('0x2f')]['rawAttributes']);_0x15c811[_0x5c7a('0x35')]=_[_0x5c7a('0x34')](_0x3c6a9b['query']);_0x15c811[_0x5c7a('0x36')]=_[_0x5c7a('0x37')](_0x15c811[_0x5c7a('0x32')],_0x15c811[_0x5c7a('0x35')]);_0x414e68['attributes']=_['intersection'](_0x15c811[_0x5c7a('0x32')],qs[_0x5c7a('0x39')](_0x3c6a9b[_0x5c7a('0x35')][_0x5c7a('0x39')]));_0x414e68[_0x5c7a('0x38')]=_0x414e68['attributes']['length']?_0x414e68['attributes']:_0x15c811[_0x5c7a('0x32')];if(_0x3c6a9b[_0x5c7a('0x35')][_0x5c7a('0x45')]){_0x414e68[_0x5c7a('0x4b')]=[{'all':!![]}];}_0x414e68=_[_0x5c7a('0x41')]({},_0x414e68,_0x3c6a9b[_0x5c7a('0x44')]);return db[_0x5c7a('0x2f')]['find'](_0x414e68)['then'](handleEntityNotFound(_0x4600a5,null))['then'](respondWithResult(_0x4600a5,null))['catch'](handleError(_0x4600a5,null));};exports[_0x5c7a('0x4c')]=function(_0x31233e,_0x2117cf){return db['VoiceRecording']['create'](_0x31233e[_0x5c7a('0x4d')],{})[_0x5c7a('0x27')](respondWithResult(_0x2117cf,0xc9))[_0x5c7a('0x48')](handleError(_0x2117cf,null));};exports[_0x5c7a('0x26')]=function(_0x58c7a7,_0x380801){if(_0x58c7a7['body']['id']){delete _0x58c7a7[_0x5c7a('0x4d')]['id'];}return db[_0x5c7a('0x2f')][_0x5c7a('0x4e')]({'where':{'id':_0x58c7a7['params']['id']}})[_0x5c7a('0x27')](handleEntityNotFound(_0x380801,null))[_0x5c7a('0x27')](saveUpdates(_0x58c7a7['body'],null))['then'](respondWithResult(_0x380801,null))[_0x5c7a('0x48')](handleError(_0x380801,null));};exports['describe']=function(_0x406782,_0x161e3a){return db['VoiceRecording'][_0x5c7a('0x4f')]()['then'](respondWithResult(_0x161e3a,null))['catch'](handleError(_0x161e3a,null));};exports[_0x5c7a('0x50')]=function(_0x518e7b,_0x2f8def,_0x26ded8){var _0xd1be97=require(_0x5c7a('0x51'));var _0x1fb290=![];var _0x2ca88f={};if(_0x518e7b[_0x5c7a('0x35')][_0x5c7a('0x42')]&&_0x518e7b['query'][_0x5c7a('0x42')]===_0x5c7a('0x52')){_0x2ca88f[_0x5c7a('0x52')]=_0x518e7b[_0x5c7a('0x4a')]['id'];}else{_0x2ca88f['id']=_0x518e7b[_0x5c7a('0x4a')]['id'];}return db[_0x5c7a('0x2f')][_0x5c7a('0x4e')]({'where':_0x2ca88f,'attributes':['id',_0x5c7a('0x53')],'raw':!![]})[_0x5c7a('0x27')](handleEntityNotFound(_0x2f8def,null))[_0x5c7a('0x27')](function(_0x512d57){if(_0x512d57){var _0x1776a2=_0x512d57[_0x5c7a('0x53')];var _0x13b4f3=util[_0x5c7a('0x54')](_0x5c7a('0x55'),_0x1776a2);if(fs['existsSync'](_0x13b4f3)){_0x1fb290=!![];return _0xd1be97[_0x5c7a('0x56')](_0x13b4f3,_0x1776a2,config[_0x5c7a('0x57')][_0x5c7a('0x58')])[_0x5c7a('0x27')](function(){return _0x512d57;});}return _0x512d57;}})[_0x5c7a('0x27')](function(_0x6a4609){if(_0x6a4609){var _0x4f8a11=_0x6a4609[_0x5c7a('0x53')];if(!fs[_0x5c7a('0x59')](_0x4f8a11)){throw new db[(_0x5c7a('0x5a'))][(_0x5c7a('0x5b'))]('VoiceRecording\x20not\x20found');}if(_0x6a4609[_0x5c7a('0x5c')]){return _0x2f8def[_0x5c7a('0x50')](_0x4f8a11,_0x6a4609[_0x5c7a('0x5c')]+path[_0x5c7a('0x5d')](_0x4f8a11),function(){if(_0x1fb290){fs['unlink'](_0x4f8a11);}});}else{return _0x2f8def[_0x5c7a('0x50')](_0x4f8a11,function(_0x42c113){if(_0x1fb290){fs['unlink'](_0x4f8a11);}});}}})[_0x5c7a('0x48')](function(_0x4dc6eb){if(_0x4dc6eb[_0x5c7a('0x5e')]==='VoiceRecording\x20not\x20found'){_0x2f8def[_0x5c7a('0x1c')](0x194)[_0x5c7a('0x5f')](_0x5c7a('0x60'));}else{return handleError(_0x2f8def,null);}});};exports[_0x5c7a('0x61')]=function(_0x11d442,_0x21a14d,_0x4b6d25){var _0x5ff0b5=require(_0x5c7a('0x51'));var _0x10e5a0=![];var _0x135e8e={'$and':[db[_0x5c7a('0x62')][_0x5c7a('0x40')](db['sequelize']['fn'](_0x5c7a('0x63'),db[_0x5c7a('0x62')][_0x5c7a('0x64')]('uniqueid')),_0x11d442[_0x5c7a('0x35')]['token'])]};if(_0x11d442[_0x5c7a('0x35')][_0x5c7a('0x42')]&&_0x11d442[_0x5c7a('0x35')][_0x5c7a('0x42')]===_0x5c7a('0x52')){_0x135e8e['$and'][_0x5c7a('0x65')]({'uniqueid':_0x11d442[_0x5c7a('0x4a')]['id']});}else{_0x135e8e[_0x5c7a('0x66')][_0x5c7a('0x65')]({'id':_0x11d442[_0x5c7a('0x4a')]['id']});}return db['VoiceRecording'][_0x5c7a('0x4e')]({'where':_0x135e8e,'attributes':['id',_0x5c7a('0x53')],'raw':!![]})[_0x5c7a('0x27')](handleEntityNotFound(_0x21a14d,null))[_0x5c7a('0x27')](function(_0x34f902){if(_0x34f902){var _0xabfa1=util[_0x5c7a('0x54')](_0x5c7a('0x55'),_0x34f902[_0x5c7a('0x53')]);if(fs[_0x5c7a('0x59')](_0xabfa1)){_0x10e5a0=!![];return _0x5ff0b5[_0x5c7a('0x56')](_0xabfa1,_0x34f902[_0x5c7a('0x53')],config[_0x5c7a('0x57')][_0x5c7a('0x58')])[_0x5c7a('0x27')](function(){return _0x34f902;});}return _0x34f902;}})[_0x5c7a('0x27')](function(_0x42b56b){if(_0x42b56b){if(!fs[_0x5c7a('0x59')](_0x42b56b[_0x5c7a('0x53')])){throw new db[(_0x5c7a('0x5a'))][(_0x5c7a('0x5b'))]('VoiceRecording\x20not\x20found');}if(_0x42b56b[_0x5c7a('0x5c')]){return _0x21a14d[_0x5c7a('0x50')](_0x42b56b[_0x5c7a('0x53')],_0x42b56b['filename']+path[_0x5c7a('0x5d')](_0x42b56b[_0x5c7a('0x53')]),function(){if(_0x10e5a0){fs[_0x5c7a('0x67')](_0x42b56b[_0x5c7a('0x53')]);}});}else{return _0x21a14d['download'](_0x42b56b[_0x5c7a('0x53')],function(_0x3d2389){if(_0x10e5a0){fs['unlink'](_0x42b56b[_0x5c7a('0x53')]);}});}}})[_0x5c7a('0x48')](handleError(_0x21a14d,null));};exports[_0x5c7a('0x28')]=function(_0x3b621a,_0x5eee70){return db[_0x5c7a('0x2f')][_0x5c7a('0x4e')]({'where':{'id':_0x3b621a['params']['id']}})[_0x5c7a('0x27')](function(_0xf01298){if(_[_0x5c7a('0x68')](_0xf01298)){throw new ReferenceError(_0x5c7a('0x69'));}return _0xf01298;})[_0x5c7a('0x27')](function(_0x4aed3f){var _0x4f6387=_0x4aed3f[_0x5c7a('0x53')];logger[_0x5c7a('0x6a')]('cancellazione\x20fisica\x20documento\x20%s',_0x4f6387);if(!_[_0x5c7a('0x68')](_0x4aed3f[_0x5c7a('0x53')])&&fs[_0x5c7a('0x59')](_0x4f6387)){logger[_0x5c7a('0x6a')](_0x5c7a('0x6b')+_0x4f6387+_0x5c7a('0x6c'));fs[_0x5c7a('0x6d')](_0x4f6387);}_0x4f6387=_0x4f6387+'.cypher';if(!_[_0x5c7a('0x68')](_0x4aed3f[_0x5c7a('0x53')])&&fs[_0x5c7a('0x59')](_0x4f6387)){logger[_0x5c7a('0x6a')](_0x5c7a('0x6b')+_0x4f6387+_0x5c7a('0x6c'));fs[_0x5c7a('0x6d')](_0x4f6387);}return _0x4aed3f;})['then'](function(_0x41f206){if(!_0x41f206)throw new InternalError();return _0x41f206[_0x5c7a('0x28')]();})[_0x5c7a('0x27')](function(){_0x5eee70[_0x5c7a('0x1c')](0xcc)[_0x5c7a('0x29')]();})[_0x5c7a('0x48')](handleError(_0x5eee70,null));};function getBucketslist(_0x3f996f,_0x21090e,_0x3622ac){return new Promise(function(_0x2002d6,_0x294aff){var _0xafa33e=new AWS['S3']({'accessKeyId':_0x21090e,'secretAccessKey':_0x3f996f,'region':_0x3622ac});_0xafa33e[_0x5c7a('0x6e')]({},function(_0x28874,_0x8ce306){if(_0x28874){return _0x294aff(_0x28874);}else{return _0x2002d6(_0x8ce306);}});});}function createBucket(_0x510e8e,_0x1fbee5,_0x38171a,_0x43ae69){return new Promise(function(_0x25579b,_0xdea054){var _0x7c2c19=new AWS['S3']({'accessKeyId':_0x1fbee5,'secretAccessKey':_0x510e8e,'region':_0x38171a});_0x7c2c19[_0x5c7a('0x6f')]({'Bucket':_0x43ae69},function(_0x2d35d8,_0x2a15df){if(_0x2d35d8){return _0xdea054(_0x2d35d8);}else{return _0x25579b(_0x2a15df);}});});}function uploadFile(_0x190fba,_0x2f7a65,_0x5df298,_0xeca508,_0x3c6eb2,_0x17e1d4){return new Promise(function(_0x1f0b45,_0x1d4f03){var _0x2b5f48=new AWS['S3']({'accessKeyId':_0x2f7a65,'secretAccessKey':_0x190fba,'region':_0x5df298});_0x2b5f48[_0x5c7a('0x70')]({'Bucket':_0xeca508,'Key':_0x3c6eb2,'Body':_0x17e1d4},function(_0x2e2245,_0x19fc2c){if(_0x2e2245){return _0x1d4f03(_0x2e2245);}else{return _0x1f0b45(_0x19fc2c);}});});}function startTranscribe(_0x2486ec,_0x13fdf4,_0x5533f3,_0x26f5b2,_0x3e44ce,_0x204a27){return new Promise(function(_0x33f409,_0x1621d5){var _0x20f7da=new AWS['TranscribeService']({'accessKeyId':_0x13fdf4,'secretAccessKey':_0x2486ec,'region':_0x5533f3});_0x20f7da['startTranscriptionJob']({'TranscriptionJobName':_0x26f5b2,'LanguageCode':_0x3e44ce,'Media':{'MediaFileUri':_0x204a27}},function(_0x3f1bc9,_0xab8584){if(_0x3f1bc9){return _0x1621d5(_0x3f1bc9);}else{return _0x33f409(_0xab8584);}});});}function transcribe(_0x4605ed,_0x2c8d33,_0x581b99,_0x5f4010,_0x376d6c,_0x272e67,_0x487025){return new Promise(function(_0x958d92,_0x343337){var _0x4026d0={};logger[_0x5c7a('0x6a')](util[_0x5c7a('0x54')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x4605ed,_0x376d6c));return uploadFile(_0x2c8d33,_0x581b99,_0x5f4010,_0x376d6c,path[_0x5c7a('0x71')](_0x272e67),fs['readFileSync'](_0x272e67))[_0x5c7a('0x27')](function(_0x130dae){logger[_0x5c7a('0x6a')](util[_0x5c7a('0x54')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x4605ed,_0x376d6c,_0x130dae[_0x5c7a('0x72')]));_0x4026d0[_0x5c7a('0x73')]=_0x130dae[_0x5c7a('0x74')];_0x4026d0['location']=_0x130dae['Location'];logger['info'](util[_0x5c7a('0x54')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x4605ed));return startTranscribe(_0x2c8d33,_0x581b99,_0x5f4010,uuidv4(),_0x487025,_0x130dae[_0x5c7a('0x72')]);})[_0x5c7a('0x27')](function(_0x42aec8){logger[_0x5c7a('0x6a')](util[_0x5c7a('0x54')](_0x5c7a('0x75'),_0x4605ed,_0x42aec8['TranscriptionJob'][_0x5c7a('0x76')]));_0x4026d0[_0x5c7a('0x77')]=_0x42aec8[_0x5c7a('0x78')][_0x5c7a('0x76')];_0x4026d0[_0x5c7a('0x79')]=_0x42aec8[_0x5c7a('0x78')][_0x5c7a('0x7a')];return _0x958d92(_0x4026d0);})['catch'](function(_0x79fd98){return _0x343337(_0x79fd98);});});}exports[_0x5c7a('0x7b')]=function(_0x1edae4,_0x5f060e,_0x436589){var _0x16acb8;var _0x1ccc3f;var _0x358c6f;var _0x10cfe8=require('../../components/encryptor');return db[_0x5c7a('0x2f')]['findOne']({'where':{'id':_0x1edae4[_0x5c7a('0x4a')]['id']}})[_0x5c7a('0x27')](function(_0x266527){if(_0x266527){var _0x1ba4da=util[_0x5c7a('0x54')](_0x5c7a('0x55'),_0x266527['value']);if(fs[_0x5c7a('0x59')](_0x1ba4da)){cypher=!![];return _0x10cfe8['decryptFile'](_0x1ba4da,_0x266527[_0x5c7a('0x53')],config['secrets'][_0x5c7a('0x58')])[_0x5c7a('0x27')](function(){return _0x266527;});}return _0x266527;}})[_0x5c7a('0x27')](function(_0x1172c2){if(!_0x1172c2){throw new db[(_0x5c7a('0x5a'))][(_0x5c7a('0x5b'))]('Voice\x20Recording\x20not\x20found');}_0x1ccc3f=_0x1172c2;return db[_0x5c7a('0x7c')][_0x5c7a('0x7d')]({'where':{'id':0x1}});})[_0x5c7a('0x27')](handleEntityNotFound(_0x5f060e,null))[_0x5c7a('0x27')](function(_0x20f011){if(_0x20f011){_0x16acb8=_0x20f011;if(!_0x16acb8[_0x5c7a('0x7e')]||!_0x16acb8[_0x5c7a('0x7f')]||!_0x16acb8[_0x5c7a('0x80')]||!_0x16acb8[_0x5c7a('0x81')]||!_0x16acb8[_0x5c7a('0x73')]){throw new db[(_0x5c7a('0x5a'))][(_0x5c7a('0x5b'))](_0x5c7a('0x82'));}if(_0x1edae4[_0x5c7a('0x4d')][_0x5c7a('0x83')]&&(!_0x16acb8[_0x5c7a('0x84')]||!_0x16acb8[_0x5c7a('0x85')]||!_0x16acb8[_0x5c7a('0x86')]||!_0x16acb8[_0x5c7a('0x81')]||!_0x16acb8[_0x5c7a('0x73')])){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x5c7a('0x87')]['findOne']({'where':{'id':_0x16acb8['transcribeAccountId']}});}})['then'](function(_0x217f1a){if(!_0x217f1a){throw new db[(_0x5c7a('0x5a'))][(_0x5c7a('0x5b'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x217f1a[_0x5c7a('0x88')]||!_0x217f1a[_0x5c7a('0x89')]){throw new db['Sequelize'][(_0x5c7a('0x5b'))](_0x5c7a('0x8a'));}_0x358c6f=_0x217f1a;return getBucketslist(_0x358c6f[_0x5c7a('0x88')],_0x358c6f[_0x5c7a('0x89')],_0x16acb8['transcribeRegion']);})[_0x5c7a('0x27')](function(_0x327f83){if(_0x327f83&&_0x327f83['Buckets']){var _0xf7390=_['find'](_0x327f83[_0x5c7a('0x8b')],function(_0x1fd22f){return _0x1fd22f['Name']===_0x16acb8['bucket'];});if(!_0xf7390){logger[_0x5c7a('0x6a')](util[_0x5c7a('0x54')](_0x5c7a('0x8c'),_0x1edae4['params']['id'],_0x16acb8[_0x5c7a('0x73')]));return createBucket(_0x358c6f[_0x5c7a('0x88')],_0x358c6f['data2'],_0x16acb8['transcribeRegion'],_0x16acb8[_0x5c7a('0x73')]);}logger[_0x5c7a('0x6a')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x1edae4[_0x5c7a('0x4a')]['id'],_0x16acb8['bucket']));return;}})['then'](function(_0x53af98){if(_0x1ccc3f[_0x5c7a('0x79')]==='NEW'){return transcribe(_0x1edae4[_0x5c7a('0x4a')]['id'],_0x358c6f[_0x5c7a('0x88')],_0x358c6f['data2'],_0x16acb8['transcribeRegion'],_0x16acb8[_0x5c7a('0x73')],_0x1ccc3f[_0x5c7a('0x53')],_0x16acb8[_0x5c7a('0x81')]);}else{logger[_0x5c7a('0x6a')](util[_0x5c7a('0x54')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x1edae4['params']['id']));return{'transcribeStatus':_0x5c7a('0x8d')};}})['then'](function(_0x15e415){if(_0x15e415){_0x15e415[_0x5c7a('0x8e')]=_0x1edae4[_0x5c7a('0x4d')][_0x5c7a('0x83')];return _0x1ccc3f[_0x5c7a('0x8f')](_0x15e415);}})[_0x5c7a('0x27')](respondWithResult(_0x5f060e,null))[_0x5c7a('0x48')](handleError(_0x5f060e,null));};function writeFile(_0x34ee1e,_0x29aca8){return new Promise(function(_0x4798cc,_0x366874){fs['writeFile'](_0x29aca8,_0x34ee1e,function(_0x4f75d2,_0x3414a8){if(_0x4f75d2){return _0x366874(_0x4f75d2);}else{return _0x4798cc(_0x3414a8);}});});}exports['downloadTranscribe']=function(_0x2f1d08,_0x1817bd,_0x4b2d87){return db['VoiceRecording'][_0x5c7a('0x7d')]({'where':{'id':_0x2f1d08[_0x5c7a('0x4a')]['id']}})[_0x5c7a('0x27')](handleEntityNotFound(_0x1817bd))['then'](function(_0x13a060){if(_0x13a060&&_0x13a060[_0x5c7a('0x90')]){var _0xbfb8bc=_0x13a060[_0x5c7a('0x90')];var _0x2dc5e8=config[_0x5c7a('0x91')]+_0x5c7a('0x92')+_0x13a060['id']+_0x5c7a('0x93');if(fs['existsSync'](_0x2dc5e8)){return _0x2dc5e8;}return writeFile(_0xbfb8bc,_0x2dc5e8)[_0x5c7a('0x27')](function(){return _0x2dc5e8;});}else{throw new db[(_0x5c7a('0x5a'))][(_0x5c7a('0x5b'))](_0x5c7a('0x94'));}})['then'](function(_0x560c79){return _0x1817bd['download'](_0x560c79);})['catch'](handleError(_0x1817bd));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index b7b30a5..35b57ea 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 _0x16e4=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','VoiceRecording','voice_recordings','uniqueid'];(function(_0x29d751,_0x17fa95){var _0x5e0da7=function(_0x38d63c){while(--_0x38d63c){_0x29d751['push'](_0x29d751['shift']());}};_0x5e0da7(++_0x17fa95);}(_0x16e4,0xc3));var _0x416e=function(_0x3242e1,_0x5c714b){_0x3242e1=_0x3242e1-0x0;var _0x3b8a11=_0x16e4[_0x3242e1];return _0x3b8a11;};'use strict';var _=require(_0x416e('0x0'));var util=require(_0x416e('0x1'));var logger=require(_0x416e('0x2'))(_0x416e('0x3'));var moment=require('moment');var BPromise=require(_0x416e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x416e('0x5'));var rimraf=require(_0x416e('0x6'));var config=require(_0x416e('0x7'));var attributes=require(_0x416e('0x8'));module[_0x416e('0x9')]=function(_0x405d05,_0x34f641){return _0x405d05['define'](_0x416e('0xa'),attributes,{'tableName':_0x416e('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x416e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x312b=['rimraf','../../config/environment','./voiceRecording.attributes','exports','define','voice_recordings','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x18348d,_0x7b62d6){var _0x4f7aa2=function(_0x4b6c3f){while(--_0x4b6c3f){_0x18348d['push'](_0x18348d['shift']());}};_0x4f7aa2(++_0x7b62d6);}(_0x312b,0x1ab));var _0xb312=function(_0x24676d,_0x5d519a){_0x24676d=_0x24676d-0x0;var _0x336c0d=_0x312b[_0x24676d];return _0x336c0d;};'use strict';var _=require(_0xb312('0x0'));var util=require('util');var logger=require(_0xb312('0x1'))(_0xb312('0x2'));var moment=require(_0xb312('0x3'));var BPromise=require(_0xb312('0x4'));var rp=require(_0xb312('0x5'));var fs=require('fs');var path=require(_0xb312('0x6'));var rimraf=require(_0xb312('0x7'));var config=require(_0xb312('0x8'));var attributes=require(_0xb312('0x9'));module[_0xb312('0xa')]=function(_0x5394ed,_0x398153){return _0x5394ed[_0xb312('0xb')]('VoiceRecording',attributes,{'tableName':_0xb312('0xc'),'paranoid':![],'indexes':[{'name':_0xb312('0xd'),'fields':[_0xb312('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 73d55cd..d819615 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 _0xd943=['info','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','VoiceRecording,\x20%s,\x20%s','message','result','catch','UpdateVoiceRecording','VoiceRecording','body','options','raw','where','attributes','debug','stringify','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','value','format','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then'];(function(_0x5bb736,_0x32c198){var _0x483aad=function(_0x426b8e){while(--_0x426b8e){_0x5bb736['push'](_0x5bb736['shift']());}};_0x483aad(++_0x32c198);}(_0xd943,0x15d));var _0x3d94=function(_0xe20b77,_0x2b433d){_0xe20b77=_0xe20b77-0x0;var _0x11b880=_0xd943[_0xe20b77];return _0x11b880;};'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')]('VoiceRecording,\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')]['update'](_0x2acee3[_0x3d94('0x16')],{'raw':_0x2acee3['options']?_0x2acee3[_0x3d94('0x17')][_0x3d94('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2acee3[_0x3d94('0x17')]?_0x2acee3[_0x3d94('0x17')][_0x3d94('0x19')]||null:null,'attributes':_0x2acee3['options']?_0x2acee3['options'][_0x3d94('0x1a')]||null:null,'limit':_0x2acee3[_0x3d94('0x17')]?_0x2acee3[_0x3d94('0x17')]['limit']||null:null})[_0x3d94('0xa')](function(_0x2e8c91){logger[_0x3d94('0xb')](_0x3d94('0x14'),_0x2acee3);logger[_0x3d94('0x1b')](_0x3d94('0x14'),_0x2acee3,JSON[_0x3d94('0x1c')](_0x2e8c91));_0x4afc92(_0x2e8c91);})[_0x3d94('0x13')](function(_0xee7b8d){logger[_0x3d94('0xe')](_0x3d94('0x14'),_0xee7b8d[_0x3d94('0x11')],_0x2acee3);_0x3ca0e3(_0x1c35a8[_0x3d94('0xe')](0x1f4,_0xee7b8d[_0x3d94('0x11')]));});});};exports[_0x3d94('0x1d')]=function(_0x5b3b31){var _0x123183=this;return new Promise(function(_0x558fd2,_0x28a698){var _0x1d0a7a=require(_0x3d94('0x1e'));var _0x439173;return db[_0x3d94('0x1f')][_0x3d94('0x20')]({'attributes':['id',_0x3d94('0x21')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x584c4a){_0x439173=_0x584c4a;return db[_0x3d94('0x15')]['create'](_0x5b3b31['body']);})[_0x3d94('0xa')](function(_0x58c0d0){if(_0x439173[_0x3d94('0x21')]&&fs[_0x3d94('0x22')](_0x58c0d0[_0x3d94('0x23')])){var _0x4cef9c=util[_0x3d94('0x24')]('%s.cypher',_0x58c0d0[_0x3d94('0x23')]);return _0x1d0a7a['encryptFile'](_0x58c0d0[_0x3d94('0x23')],_0x4cef9c,config[_0x3d94('0x25')][_0x3d94('0x26')])[_0x3d94('0xa')](function(){fs['unlink'](_0x58c0d0[_0x3d94('0x23')]);logger['info'](_0x3d94('0x27'));return _0x58c0d0;});}return _0x58c0d0;})[_0x3d94('0xa')](function(_0x51d308){logger['info'](_0x3d94('0x1d'),_0x5b3b31);logger[_0x3d94('0x1b')](_0x3d94('0x1d'),_0x5b3b31,JSON['stringify'](_0x51d308));_0x558fd2(_0x51d308);})[_0x3d94('0x13')](function(_0x3d29fd){logger['error'](_0x3d94('0x1d'),_0x3d29fd[_0x3d94('0x11')],_0x5b3b31);_0x28a698(_0x123183[_0x3d94('0xe')](0x1f4,_0x3d29fd[_0x3d94('0x11')]));});});}; \ No newline at end of file +var _0xb016=['options','raw','attributes','limit','debug','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','value','format','encryptFile','secrets','recording','unlink','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xb016,0x159));var _0x6b01=function(_0x547604,_0x3b7826){_0x547604=_0x547604-0x0;var _0x332e0e=_0xb016[_0x547604];return _0x332e0e;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6b01('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b01('0x3'))['db'];var utils=require(_0x6b01('0x4'));var logger=require(_0x6b01('0x5'))(_0x6b01('0x6'));var config=require('../../config/environment');var jayson=require(_0x6b01('0x7'));var client=jayson[_0x6b01('0x8')][_0x6b01('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5759a1,_0x5c5bfb,_0x374aab){return new BPromise(function(_0x39f9fa,_0x526a7d){return client['request'](_0x5759a1,_0x374aab)[_0x6b01('0xa')](function(_0x1cb3a6){logger[_0x6b01('0xb')](_0x6b01('0xc'),_0x5c5bfb,_0x6b01('0xd'));logger['debug']('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x5c5bfb,_0x6b01('0xd'),JSON[_0x6b01('0xe')](_0x1cb3a6));if(_0x1cb3a6[_0x6b01('0xf')]){if(_0x1cb3a6['error'][_0x6b01('0x10')]===0x1f4){logger['error']('VoiceRecording,\x20%s,\x20%s',_0x5c5bfb,_0x1cb3a6[_0x6b01('0xf')]['message']);return _0x526a7d(_0x1cb3a6[_0x6b01('0xf')][_0x6b01('0x11')]);}logger['error'](_0x6b01('0xc'),_0x5c5bfb,_0x1cb3a6['error']['message']);return _0x39f9fa(_0x1cb3a6['error'][_0x6b01('0x11')]);}else{logger['info']('VoiceRecording,\x20%s,\x20%s',_0x5c5bfb,_0x6b01('0xd'));_0x39f9fa(_0x1cb3a6[_0x6b01('0x12')][_0x6b01('0x11')]);}})[_0x6b01('0x13')](function(_0x3d7045){logger[_0x6b01('0xf')](_0x6b01('0xc'),_0x5c5bfb,_0x3d7045);_0x526a7d(_0x3d7045);});});}exports[_0x6b01('0x14')]=function(_0x9c6571){var _0xc4e1b1=this;return new Promise(function(_0x18f336,_0x4f2d08){return db[_0x6b01('0x15')][_0x6b01('0x16')](_0x9c6571[_0x6b01('0x17')],{'raw':_0x9c6571[_0x6b01('0x18')]?_0x9c6571[_0x6b01('0x18')][_0x6b01('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9c6571[_0x6b01('0x18')]?_0x9c6571[_0x6b01('0x18')]['where']||null:null,'attributes':_0x9c6571[_0x6b01('0x18')]?_0x9c6571[_0x6b01('0x18')][_0x6b01('0x1a')]||null:null,'limit':_0x9c6571[_0x6b01('0x18')]?_0x9c6571[_0x6b01('0x18')][_0x6b01('0x1b')]||null:null})[_0x6b01('0xa')](function(_0x542fab){logger[_0x6b01('0xb')](_0x6b01('0x14'),_0x9c6571);logger[_0x6b01('0x1c')]('UpdateVoiceRecording',_0x9c6571,JSON[_0x6b01('0xe')](_0x542fab));_0x18f336(_0x542fab);})[_0x6b01('0x13')](function(_0x304393){logger[_0x6b01('0xf')](_0x6b01('0x14'),_0x304393[_0x6b01('0x11')],_0x9c6571);_0x4f2d08(_0xc4e1b1[_0x6b01('0xf')](0x1f4,_0x304393[_0x6b01('0x11')]));});});};exports[_0x6b01('0x1d')]=function(_0x152dda){var _0x3c0607=this;return new Promise(function(_0xa846d8,_0x154dfc){var _0x55ca4b=require(_0x6b01('0x1e'));var _0x220efb;return db[_0x6b01('0x1f')][_0x6b01('0x20')]({'attributes':['id',_0x6b01('0x21')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x54f030){_0x220efb=_0x54f030;return db[_0x6b01('0x15')][_0x6b01('0x22')](_0x152dda[_0x6b01('0x17')]);})[_0x6b01('0xa')](function(_0x2a894e){if(_0x220efb[_0x6b01('0x21')]&&fs['existsSync'](_0x2a894e[_0x6b01('0x23')])){var _0x5482a8=util[_0x6b01('0x24')]('%s.cypher',_0x2a894e[_0x6b01('0x23')]);return _0x55ca4b[_0x6b01('0x25')](_0x2a894e[_0x6b01('0x23')],_0x5482a8,config[_0x6b01('0x26')][_0x6b01('0x27')])['then'](function(){fs[_0x6b01('0x28')](_0x2a894e[_0x6b01('0x23')]);logger[_0x6b01('0xb')]('CreateVoiceRecording\x20file\x20encrypted');return _0x2a894e;});}return _0x2a894e;})['then'](function(_0x3578ef){logger['info'](_0x6b01('0x1d'),_0x152dda);logger[_0x6b01('0x1c')](_0x6b01('0x1d'),_0x152dda,JSON['stringify'](_0x3578ef));_0xa846d8(_0x3578ef);})[_0x6b01('0x13')](function(_0x42d5f7){logger[_0x6b01('0xf')]('CreateVoiceRecording',_0x42d5f7[_0x6b01('0x11')],_0x152dda);_0x154dfc(_0x3c0607[_0x6b01('0xf')](0x1f4,_0x42d5f7[_0x6b01('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index a903698..baaa29d 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 _0x858b=['../../config/environment','get','isAuthenticated','index','/describe','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xa18dad,_0x3cb434){var _0x3573bd=function(_0x1c0851){while(--_0x1c0851){_0xa18dad['push'](_0xa18dad['shift']());}};_0x3573bd(++_0x3cb434);}(_0x858b,0xd3));var _0xb858=function(_0x1a7550,_0x1edace){_0x1a7550=_0x1a7550-0x0;var _0x426e22=_0x858b[_0x1a7550];return _0x426e22;};'use strict';var multer=require(_0xb858('0x0'));var util=require(_0xb858('0x1'));var path=require(_0xb858('0x2'));var timeout=require(_0xb858('0x3'));var express=require(_0xb858('0x4'));var router=express[_0xb858('0x5')]();var fs_extra=require(_0xb858('0x6'));var auth=require(_0xb858('0x7'));var interaction=require(_0xb858('0x8'));var config=require(_0xb858('0x9'));var controller=require('./voiceTransferReport.controller');router[_0xb858('0xa')]('/',auth[_0xb858('0xb')](),controller[_0xb858('0xc')]);router[_0xb858('0xa')](_0xb858('0xd'),auth[_0xb858('0xb')](),controller['describe']);router[_0xb858('0xa')]('/:id',auth[_0xb858('0xb')](),controller[_0xb858('0xe')]);router[_0xb858('0xf')]('/',auth[_0xb858('0xb')](),controller[_0xb858('0x10')]);router[_0xb858('0x11')](_0xb858('0x12'),auth[_0xb858('0xb')](),controller['update']);router[_0xb858('0x13')](_0xb858('0x12'),auth['isAuthenticated'](),controller[_0xb858('0x14')]);module[_0xb858('0x15')]=router; \ No newline at end of file +var _0xe8eb=['/:id','show','create','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','./voiceTransferReport.controller','get','isAuthenticated','/describe','describe'];(function(_0x12d4fe,_0xfd7ad5){var _0x53ed17=function(_0x555242){while(--_0x555242){_0x12d4fe['push'](_0x12d4fe['shift']());}};_0x53ed17(++_0xfd7ad5);}(_0xe8eb,0x18d));var _0xbe8e=function(_0x1120a7,_0x45c4ca){_0x1120a7=_0x1120a7-0x0;var _0x4cec94=_0xe8eb[_0x1120a7];return _0x4cec94;};'use strict';var multer=require(_0xbe8e('0x0'));var util=require('util');var path=require(_0xbe8e('0x1'));var timeout=require(_0xbe8e('0x2'));var express=require(_0xbe8e('0x3'));var router=express[_0xbe8e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbe8e('0x5'));var config=require('../../config/environment');var controller=require(_0xbe8e('0x6'));router[_0xbe8e('0x7')]('/',auth[_0xbe8e('0x8')](),controller['index']);router[_0xbe8e('0x7')](_0xbe8e('0x9'),auth[_0xbe8e('0x8')](),controller[_0xbe8e('0xa')]);router[_0xbe8e('0x7')](_0xbe8e('0xb'),auth['isAuthenticated'](),controller[_0xbe8e('0xc')]);router['post']('/',auth[_0xbe8e('0x8')](),controller[_0xbe8e('0xd')]);router['put'](_0xbe8e('0xb'),auth[_0xbe8e('0x8')](),controller[_0xbe8e('0xe')]);router['delete'](_0xbe8e('0xb'),auth['isAuthenticated'](),controller[_0xbe8e('0xf')]);module[_0xbe8e('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index b2032ca..ac19347 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 _0x4d1e=['moment','exports','ENUM','blind','attended','STRING','Yes'];(function(_0x2f0fff,_0x1ce2af){var _0x5f2ab1=function(_0x2158e0){while(--_0x2158e0){_0x2f0fff['push'](_0x2f0fff['shift']());}};_0x5f2ab1(++_0x1ce2af);}(_0x4d1e,0x1f1));var _0xe4d1=function(_0xabfec4,_0x35076e){_0xabfec4=_0xabfec4-0x0;var _0x7bafa2=_0x4d1e[_0xabfec4];return _0x7bafa2;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe4d1('0x0'));module[_0xe4d1('0x1')]={'type':{'type':Sequelize[_0xe4d1('0x2')](_0xe4d1('0x3'),_0xe4d1('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xe4d1('0x5')]},'transferercalleridname':{'type':Sequelize[_0xe4d1('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xe4d1('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xe4d1('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xe4d1('0x5')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xe4d1('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xe4d1('0x5')]},'transfereechannel':{'type':Sequelize[_0xe4d1('0x5')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xe4d1('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xe4d1('0x5')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xe4d1('0x5')]},'isexternal':{'type':Sequelize[_0xe4d1('0x2')](_0xe4d1('0x6'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xe4d1('0x5')]}}; \ No newline at end of file +var _0xa44a=['ENUM','Yes','sequelize','moment','exports','blind','STRING'];(function(_0x39bc22,_0x127dac){var _0x15f298=function(_0x206137){while(--_0x206137){_0x39bc22['push'](_0x39bc22['shift']());}};_0x15f298(++_0x127dac);}(_0xa44a,0x1c9));var _0xaa44=function(_0xebc949,_0xe30bd6){_0xebc949=_0xebc949-0x0;var _0x476bef=_0xa44a[_0xebc949];return _0x476bef;};'use strict';var Sequelize=require(_0xaa44('0x0'));var moment=require(_0xaa44('0x1'));module[_0xaa44('0x2')]={'type':{'type':Sequelize['ENUM'](_0xaa44('0x3'),'attended')},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xaa44('0x4')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xaa44('0x4')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xaa44('0x4')]},'transfererexten':{'type':Sequelize[_0xaa44('0x4')]},'transfererlinkedid':{'type':Sequelize[_0xaa44('0x4')]},'transfereechannel':{'type':Sequelize[_0xaa44('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0xaa44('0x4')]},'transfereecalleridname':{'type':Sequelize[_0xaa44('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xaa44('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0xaa44('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0xaa44('0x4')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xaa44('0x4')]},'transfereelinkedid':{'type':Sequelize[_0xaa44('0x4')]},'isexternal':{'type':Sequelize[_0xaa44('0x5')](_0xaa44('0x6'),'No')},'context':{'type':Sequelize[_0xaa44('0x4')]},'extension':{'type':Sequelize[_0xaa44('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 7a978d8..59125a1 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 _0xfb8f=['count','includeAll','include','findAll','catch','show','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','end','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','status','sendStatus','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','type','VIRTUAL','filter','merge','options'];(function(_0x54a5bf,_0x5d240c){var _0x2cf3d8=function(_0x2398f0){while(--_0x2398f0){_0x54a5bf['push'](_0x54a5bf['shift']());}};_0x2cf3d8(++_0x5d240c);}(_0xfb8f,0x9d));var _0xffb8=function(_0x4c85e4,_0x24d438){_0x4c85e4=_0x4c85e4-0x0;var _0x424be6=_0xfb8f[_0x4c85e4];return _0x424be6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xffb8('0x0'));var zipdir=require(_0xffb8('0x1'));var jsonpatch=require(_0xffb8('0x2'));var rp=require(_0xffb8('0x3'));var moment=require(_0xffb8('0x4'));var BPromise=require(_0xffb8('0x5'));var Mustache=require(_0xffb8('0x6'));var util=require(_0xffb8('0x7'));var path=require(_0xffb8('0x8'));var sox=require('sox');var csv=require(_0xffb8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xffb8('0xa'));var _=require('lodash');var squel=require(_0xffb8('0xb'));var crypto=require(_0xffb8('0xc'));var jsforce=require(_0xffb8('0xd'));var deskjs=require(_0xffb8('0xe'));var toCsv=require(_0xffb8('0x9'));var querystring=require(_0xffb8('0xf'));var Papa=require('papaparse');var Redis=require(_0xffb8('0x10'));var authService=require(_0xffb8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xffb8('0x12'));var hardwareService=require(_0xffb8('0x13'));var logger=require('../../config/logger')(_0xffb8('0x14'));var utils=require('../../config/utils');var config=require(_0xffb8('0x15'));var licenseUtil=require(_0xffb8('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58b6d3,_0x1881b6){_0x1881b6=_0x1881b6||0xcc;return function(_0x264d56){if(_0x264d56){return _0x58b6d3['sendStatus'](_0x1881b6);}return _0x58b6d3['status'](_0x1881b6)[_0xffb8('0x17')]();};}function respondWithResult(_0x2e63c4,_0x16e8c0){_0x16e8c0=_0x16e8c0||0xc8;return function(_0x549735){if(_0x549735){return _0x2e63c4['status'](_0x16e8c0)['json'](_0x549735);}};}function respondWithFilteredResult(_0x270c3e,_0x14e3c2){return function(_0x4defbb){if(_0x4defbb){var _0x56a97d=typeof _0x14e3c2[_0xffb8('0x18')]===_0xffb8('0x19')&&typeof _0x14e3c2[_0xffb8('0x1a')]===_0xffb8('0x19');var _0x229278=_0x4defbb['count'];var _0x19ac18=_0x56a97d?0x0:_0x14e3c2[_0xffb8('0x18')];var _0x2d5856=_0x56a97d?_0x4defbb['count']:_0x14e3c2[_0xffb8('0x18')]+_0x14e3c2[_0xffb8('0x1a')];var _0x2f05d8;if(_0x2d5856>=_0x229278){_0x2d5856=_0x229278;_0x2f05d8=0xc8;}else{_0x2f05d8=0xce;}_0x270c3e['status'](_0x2f05d8);return _0x270c3e[_0xffb8('0x1b')](_0xffb8('0x1c'),_0x19ac18+'-'+_0x2d5856+'/'+_0x229278)['json'](_0x4defbb);}return null;};}function patchUpdates(_0x5cc06d){return function(_0xd85794){try{jsonpatch[_0xffb8('0x1d')](_0xd85794,_0x5cc06d,!![]);}catch(_0x1ba145){return BPromise[_0xffb8('0x1e')](_0x1ba145);}return _0xd85794[_0xffb8('0x1f')]();};}function saveUpdates(_0x54edbc,_0x56c3c6){return function(_0x20769a){if(_0x20769a){return _0x20769a[_0xffb8('0x20')](_0x54edbc)[_0xffb8('0x21')](function(_0x5f31e0){return _0x5f31e0;});}return null;};}function removeEntity(_0x561d14,_0x5e0f5c){return function(_0x26ebc7){if(_0x26ebc7){return _0x26ebc7[_0xffb8('0x22')]()['then'](function(){_0x561d14[_0xffb8('0x23')](0xcc)[_0xffb8('0x17')]();});}};}function handleEntityNotFound(_0x3428fa,_0x172af5){return function(_0x2cad8c){if(!_0x2cad8c){_0x3428fa[_0xffb8('0x24')](0x194);}return _0x2cad8c;};}function handleError(_0x395f9a,_0x442dbb){_0x442dbb=_0x442dbb||0x1f4;return function(_0x4beed8){logger[_0xffb8('0x25')](_0x4beed8[_0xffb8('0x26')]);if(_0x4beed8['name']){delete _0x4beed8[_0xffb8('0x27')];}_0x395f9a[_0xffb8('0x23')](_0x442dbb)[_0xffb8('0x28')](_0x4beed8);};}exports[_0xffb8('0x29')]=function(_0x43e821,_0xf85d08){var _0x8dd146={},_0x237ab8={},_0x54ae58={'count':0x0,'rows':[]};var _0x3cf733=_[_0xffb8('0x2a')](db[_0xffb8('0x2b')][_0xffb8('0x2c')],function(_0x489ef1){return{'name':_0x489ef1[_0xffb8('0x2d')],'type':_0x489ef1['type']['key']};});_0x237ab8[_0xffb8('0x2e')]=_['map'](_0x3cf733,'name');_0x237ab8[_0xffb8('0x2f')]=_[_0xffb8('0x30')](_0x43e821[_0xffb8('0x2f')]);_0x237ab8[_0xffb8('0x31')]=_[_0xffb8('0x32')](_0x237ab8[_0xffb8('0x2e')],_0x237ab8[_0xffb8('0x2f')]);_0x8dd146['attributes']=_[_0xffb8('0x32')](_0x237ab8['model'],qs['fields'](_0x43e821[_0xffb8('0x2f')][_0xffb8('0x33')]));_0x8dd146[_0xffb8('0x34')]=_0x8dd146[_0xffb8('0x34')]['length']?_0x8dd146[_0xffb8('0x34')]:_0x237ab8[_0xffb8('0x2e')];if(!_0x43e821['query']['hasOwnProperty'](_0xffb8('0x35'))){_0x8dd146['limit']=qs[_0xffb8('0x1a')](_0x43e821['query'][_0xffb8('0x1a')]);_0x8dd146[_0xffb8('0x18')]=qs[_0xffb8('0x18')](_0x43e821[_0xffb8('0x2f')][_0xffb8('0x18')]);}_0x8dd146[_0xffb8('0x36')]=qs[_0xffb8('0x37')](_0x43e821[_0xffb8('0x2f')]['sort']);_0x8dd146[_0xffb8('0x38')]=qs[_0xffb8('0x31')](_['pick'](_0x43e821[_0xffb8('0x2f')],_0x237ab8[_0xffb8('0x31')]),_0x3cf733);if(_0x43e821[_0xffb8('0x2f')]['filter']){_0x8dd146[_0xffb8('0x38')]=_['merge'](_0x8dd146[_0xffb8('0x38')],{'$or':_[_0xffb8('0x2a')](_0x3cf733,function(_0x4d99c2){if(_0x4d99c2[_0xffb8('0x39')]!==_0xffb8('0x3a')){var _0x3362e4={};_0x3362e4[_0x4d99c2[_0xffb8('0x27')]]={'$like':'%'+_0x43e821[_0xffb8('0x2f')][_0xffb8('0x3b')]+'%'};return _0x3362e4;}})});}_0x8dd146=_[_0xffb8('0x3c')]({},_0x8dd146,_0x43e821[_0xffb8('0x3d')]);var _0x48ab17={'where':_0x8dd146[_0xffb8('0x38')]};return db[_0xffb8('0x2b')][_0xffb8('0x3e')](_0x48ab17)[_0xffb8('0x21')](function(_0x13db0b){_0x54ae58[_0xffb8('0x3e')]=_0x13db0b;if(_0x43e821['query'][_0xffb8('0x3f')]){_0x8dd146[_0xffb8('0x40')]=[{'all':!![]}];}return db[_0xffb8('0x2b')][_0xffb8('0x41')](_0x8dd146);})[_0xffb8('0x21')](function(_0x12d443){_0x54ae58['rows']=_0x12d443;return _0x54ae58;})[_0xffb8('0x21')](respondWithFilteredResult(_0xf85d08,_0x8dd146))[_0xffb8('0x42')](handleError(_0xf85d08,null));};exports[_0xffb8('0x43')]=function(_0x39ce82,_0x479cd6){var _0x15c0e8={'raw':!![],'where':{'id':_0x39ce82[_0xffb8('0x44')]['id']}},_0x2cd617={};_0x2cd617[_0xffb8('0x2e')]=_[_0xffb8('0x30')](db['VoiceTransferReport']['rawAttributes']);_0x2cd617['query']=_[_0xffb8('0x30')](_0x39ce82[_0xffb8('0x2f')]);_0x2cd617[_0xffb8('0x31')]=_[_0xffb8('0x32')](_0x2cd617['model'],_0x2cd617['query']);_0x15c0e8[_0xffb8('0x34')]=_['intersection'](_0x2cd617[_0xffb8('0x2e')],qs[_0xffb8('0x33')](_0x39ce82[_0xffb8('0x2f')][_0xffb8('0x33')]));_0x15c0e8[_0xffb8('0x34')]=_0x15c0e8[_0xffb8('0x34')]['length']?_0x15c0e8[_0xffb8('0x34')]:_0x2cd617[_0xffb8('0x2e')];if(_0x39ce82[_0xffb8('0x2f')]['includeAll']){_0x15c0e8['include']=[{'all':!![]}];}_0x15c0e8=_['merge']({},_0x15c0e8,_0x39ce82[_0xffb8('0x3d')]);return db[_0xffb8('0x2b')][_0xffb8('0x45')](_0x15c0e8)[_0xffb8('0x21')](handleEntityNotFound(_0x479cd6,null))[_0xffb8('0x21')](respondWithResult(_0x479cd6,null))['catch'](handleError(_0x479cd6,null));};exports['create']=function(_0x3a752c,_0x5dbf21){return db['VoiceTransferReport'][_0xffb8('0x46')](_0x3a752c['body'],{})[_0xffb8('0x21')](respondWithResult(_0x5dbf21,0xc9))[_0xffb8('0x42')](handleError(_0x5dbf21,null));};exports[_0xffb8('0x20')]=function(_0x4b60cb,_0x31d61c){if(_0x4b60cb['body']['id']){delete _0x4b60cb[_0xffb8('0x47')]['id'];}return db[_0xffb8('0x2b')]['find']({'where':{'id':_0x4b60cb[_0xffb8('0x44')]['id']}})[_0xffb8('0x21')](handleEntityNotFound(_0x31d61c,null))['then'](saveUpdates(_0x4b60cb['body'],null))[_0xffb8('0x21')](respondWithResult(_0x31d61c,null))[_0xffb8('0x42')](handleError(_0x31d61c,null));};exports[_0xffb8('0x22')]=function(_0x441c0d,_0x1c0e7f){return db[_0xffb8('0x2b')]['find']({'where':{'id':_0x441c0d['params']['id']}})[_0xffb8('0x21')](handleEntityNotFound(_0x1c0e7f,null))['then'](removeEntity(_0x1c0e7f,null))[_0xffb8('0x42')](handleError(_0x1c0e7f,null));};exports[_0xffb8('0x48')]=function(_0xd74db3,_0x55cd9b){return db[_0xffb8('0x2b')][_0xffb8('0x48')]()[_0xffb8('0x21')](respondWithResult(_0x55cd9b,null))[_0xffb8('0x42')](handleError(_0x55cd9b,null));}; \ No newline at end of file +var _0xa258=['status','set','Content-Range','apply','reject','update','then','destroy','name','index','map','VoiceTransferReport','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','rawAttributes','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','offset','undefined','limit','count'];(function(_0x4e7c01,_0x41284f){var _0x6ab786=function(_0x2130a8){while(--_0x2130a8){_0x4e7c01['push'](_0x4e7c01['shift']());}};_0x6ab786(++_0x41284f);}(_0xa258,0x70));var _0x8a25=function(_0x2de9de,_0xd46ad){_0x2de9de=_0x2de9de-0x0;var _0x34be8c=_0xa258[_0x2de9de];return _0x34be8c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8a25('0x0'));var zipdir=require(_0x8a25('0x1'));var jsonpatch=require(_0x8a25('0x2'));var rp=require(_0x8a25('0x3'));var moment=require('moment');var BPromise=require(_0x8a25('0x4'));var Mustache=require(_0x8a25('0x5'));var util=require('util');var path=require('path');var sox=require(_0x8a25('0x6'));var csv=require(_0x8a25('0x7'));var ejs=require(_0x8a25('0x8'));var fs=require('fs');var fs_extra=require(_0x8a25('0x9'));var _=require('lodash');var squel=require(_0x8a25('0xa'));var crypto=require(_0x8a25('0xb'));var jsforce=require(_0x8a25('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8a25('0x7'));var querystring=require(_0x8a25('0xd'));var Papa=require(_0x8a25('0xe'));var Redis=require(_0x8a25('0xf'));var authService=require(_0x8a25('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8a25('0x11'));var hardwareService=require(_0x8a25('0x12'));var logger=require(_0x8a25('0x13'))(_0x8a25('0x14'));var utils=require(_0x8a25('0x15'));var config=require(_0x8a25('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8a25('0x17'))['db'];function respondWithStatusCode(_0x39102f,_0x3dfe8c){_0x3dfe8c=_0x3dfe8c||0xcc;return function(_0x15ea2c){if(_0x15ea2c){return _0x39102f[_0x8a25('0x18')](_0x3dfe8c);}return _0x39102f['status'](_0x3dfe8c)[_0x8a25('0x19')]();};}function respondWithResult(_0x8939aa,_0x11cc5e){_0x11cc5e=_0x11cc5e||0xc8;return function(_0x855f99){if(_0x855f99){return _0x8939aa['status'](_0x11cc5e)['json'](_0x855f99);}};}function respondWithFilteredResult(_0x1074e4,_0x3c328a){return function(_0x5beed5){if(_0x5beed5){var _0x3e6251=typeof _0x3c328a[_0x8a25('0x1a')]===_0x8a25('0x1b')&&typeof _0x3c328a[_0x8a25('0x1c')]===_0x8a25('0x1b');var _0x8a36ac=_0x5beed5[_0x8a25('0x1d')];var _0x56d452=_0x3e6251?0x0:_0x3c328a['offset'];var _0x379917=_0x3e6251?_0x5beed5[_0x8a25('0x1d')]:_0x3c328a[_0x8a25('0x1a')]+_0x3c328a[_0x8a25('0x1c')];var _0x27817b;if(_0x379917>=_0x8a36ac){_0x379917=_0x8a36ac;_0x27817b=0xc8;}else{_0x27817b=0xce;}_0x1074e4[_0x8a25('0x1e')](_0x27817b);return _0x1074e4[_0x8a25('0x1f')](_0x8a25('0x20'),_0x56d452+'-'+_0x379917+'/'+_0x8a36ac)['json'](_0x5beed5);}return null;};}function patchUpdates(_0x3479c4){return function(_0x20bbb5){try{jsonpatch[_0x8a25('0x21')](_0x20bbb5,_0x3479c4,!![]);}catch(_0x4ea2d6){return BPromise[_0x8a25('0x22')](_0x4ea2d6);}return _0x20bbb5['save']();};}function saveUpdates(_0x169079,_0x476615){return function(_0x259a56){if(_0x259a56){return _0x259a56[_0x8a25('0x23')](_0x169079)[_0x8a25('0x24')](function(_0x306749){return _0x306749;});}return null;};}function removeEntity(_0x47b0b7,_0x20ffb0){return function(_0xc46dc6){if(_0xc46dc6){return _0xc46dc6[_0x8a25('0x25')]()[_0x8a25('0x24')](function(){_0x47b0b7['status'](0xcc)[_0x8a25('0x19')]();});}};}function handleEntityNotFound(_0x57d8de,_0x454a32){return function(_0x47f894){if(!_0x47f894){_0x57d8de[_0x8a25('0x18')](0x194);}return _0x47f894;};}function handleError(_0x1bd9c3,_0x19e699){_0x19e699=_0x19e699||0x1f4;return function(_0x1e8a9e){logger['error'](_0x1e8a9e['stack']);if(_0x1e8a9e[_0x8a25('0x26')]){delete _0x1e8a9e['name'];}_0x1bd9c3['status'](_0x19e699)['send'](_0x1e8a9e);};}exports[_0x8a25('0x27')]=function(_0x4fee5f,_0x1d2451){var _0x547edb={},_0x3557a8={},_0x5f2126={'count':0x0,'rows':[]};var _0x5d6166=_[_0x8a25('0x28')](db[_0x8a25('0x29')]['rawAttributes'],function(_0x8534fe){return{'name':_0x8534fe[_0x8a25('0x2a')],'type':_0x8534fe[_0x8a25('0x2b')]['key']};});_0x3557a8[_0x8a25('0x2c')]=_[_0x8a25('0x28')](_0x5d6166,_0x8a25('0x26'));_0x3557a8['query']=_[_0x8a25('0x2d')](_0x4fee5f[_0x8a25('0x2e')]);_0x3557a8[_0x8a25('0x2f')]=_[_0x8a25('0x30')](_0x3557a8[_0x8a25('0x2c')],_0x3557a8[_0x8a25('0x2e')]);_0x547edb[_0x8a25('0x31')]=_[_0x8a25('0x30')](_0x3557a8[_0x8a25('0x2c')],qs[_0x8a25('0x32')](_0x4fee5f[_0x8a25('0x2e')]['fields']));_0x547edb[_0x8a25('0x31')]=_0x547edb[_0x8a25('0x31')]['length']?_0x547edb['attributes']:_0x3557a8[_0x8a25('0x2c')];if(!_0x4fee5f[_0x8a25('0x2e')][_0x8a25('0x33')](_0x8a25('0x34'))){_0x547edb['limit']=qs[_0x8a25('0x1c')](_0x4fee5f['query'][_0x8a25('0x1c')]);_0x547edb['offset']=qs[_0x8a25('0x1a')](_0x4fee5f[_0x8a25('0x2e')][_0x8a25('0x1a')]);}_0x547edb[_0x8a25('0x35')]=qs[_0x8a25('0x36')](_0x4fee5f[_0x8a25('0x2e')][_0x8a25('0x36')]);_0x547edb[_0x8a25('0x37')]=qs[_0x8a25('0x2f')](_[_0x8a25('0x38')](_0x4fee5f[_0x8a25('0x2e')],_0x3557a8[_0x8a25('0x2f')]),_0x5d6166);if(_0x4fee5f[_0x8a25('0x2e')][_0x8a25('0x39')]){_0x547edb[_0x8a25('0x37')]=_[_0x8a25('0x3a')](_0x547edb[_0x8a25('0x37')],{'$or':_[_0x8a25('0x28')](_0x5d6166,function(_0x10fb10){if(_0x10fb10['type']!==_0x8a25('0x3b')){var _0x478c75={};_0x478c75[_0x10fb10[_0x8a25('0x26')]]={'$like':'%'+_0x4fee5f[_0x8a25('0x2e')][_0x8a25('0x39')]+'%'};return _0x478c75;}})});}_0x547edb=_[_0x8a25('0x3a')]({},_0x547edb,_0x4fee5f[_0x8a25('0x3c')]);var _0x3c6183={'where':_0x547edb[_0x8a25('0x37')]};return db[_0x8a25('0x29')][_0x8a25('0x1d')](_0x3c6183)['then'](function(_0x3a22fb){_0x5f2126['count']=_0x3a22fb;if(_0x4fee5f[_0x8a25('0x2e')][_0x8a25('0x3d')]){_0x547edb[_0x8a25('0x3e')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x8a25('0x3f')](_0x547edb);})[_0x8a25('0x24')](function(_0x265a1b){_0x5f2126['rows']=_0x265a1b;return _0x5f2126;})['then'](respondWithFilteredResult(_0x1d2451,_0x547edb))[_0x8a25('0x40')](handleError(_0x1d2451,null));};exports['show']=function(_0x5f34fd,_0x15d5d6){var _0x46a9e1={'raw':!![],'where':{'id':_0x5f34fd[_0x8a25('0x41')]['id']}},_0x1a81b8={};_0x1a81b8[_0x8a25('0x2c')]=_[_0x8a25('0x2d')](db[_0x8a25('0x29')][_0x8a25('0x42')]);_0x1a81b8['query']=_[_0x8a25('0x2d')](_0x5f34fd[_0x8a25('0x2e')]);_0x1a81b8[_0x8a25('0x2f')]=_['intersection'](_0x1a81b8['model'],_0x1a81b8[_0x8a25('0x2e')]);_0x46a9e1[_0x8a25('0x31')]=_[_0x8a25('0x30')](_0x1a81b8[_0x8a25('0x2c')],qs[_0x8a25('0x32')](_0x5f34fd[_0x8a25('0x2e')]['fields']));_0x46a9e1[_0x8a25('0x31')]=_0x46a9e1['attributes']['length']?_0x46a9e1[_0x8a25('0x31')]:_0x1a81b8[_0x8a25('0x2c')];if(_0x5f34fd[_0x8a25('0x2e')][_0x8a25('0x3d')]){_0x46a9e1[_0x8a25('0x3e')]=[{'all':!![]}];}_0x46a9e1=_['merge']({},_0x46a9e1,_0x5f34fd['options']);return db[_0x8a25('0x29')]['find'](_0x46a9e1)['then'](handleEntityNotFound(_0x15d5d6,null))['then'](respondWithResult(_0x15d5d6,null))[_0x8a25('0x40')](handleError(_0x15d5d6,null));};exports['create']=function(_0x358c8d,_0x3abf40){return db[_0x8a25('0x29')][_0x8a25('0x43')](_0x358c8d[_0x8a25('0x44')],{})['then'](respondWithResult(_0x3abf40,0xc9))[_0x8a25('0x40')](handleError(_0x3abf40,null));};exports[_0x8a25('0x23')]=function(_0x1df215,_0x35b0c1){if(_0x1df215[_0x8a25('0x44')]['id']){delete _0x1df215[_0x8a25('0x44')]['id'];}return db[_0x8a25('0x29')][_0x8a25('0x45')]({'where':{'id':_0x1df215['params']['id']}})['then'](handleEntityNotFound(_0x35b0c1,null))[_0x8a25('0x24')](saveUpdates(_0x1df215['body'],null))['then'](respondWithResult(_0x35b0c1,null))[_0x8a25('0x40')](handleError(_0x35b0c1,null));};exports[_0x8a25('0x25')]=function(_0xebe93e,_0x24ed5d){return db[_0x8a25('0x29')][_0x8a25('0x45')]({'where':{'id':_0xebe93e[_0x8a25('0x41')]['id']}})[_0x8a25('0x24')](handleEntityNotFound(_0x24ed5d,null))[_0x8a25('0x24')](removeEntity(_0x24ed5d,null))[_0x8a25('0x40')](handleError(_0x24ed5d,null));};exports[_0x8a25('0x46')]=function(_0x561d6a,_0x3272c9){return db[_0x8a25('0x29')][_0x8a25('0x46')]()['then'](respondWithResult(_0x3272c9,null))[_0x8a25('0x40')](handleError(_0x3272c9,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index d07f4df..5b9a03a 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 _0x08ea=['moment','bluebird','../../config/environment','./voiceTransferReport.attributes','exports','report_call_transfer','lodash','api'];(function(_0x478689,_0x257f1a){var _0x9e4bf1=function(_0x4d9467){while(--_0x4d9467){_0x478689['push'](_0x478689['shift']());}};_0x9e4bf1(++_0x257f1a);}(_0x08ea,0x1a6));var _0xa08e=function(_0x469f69,_0x52c2de){_0x469f69=_0x469f69-0x0;var _0x414b7c=_0x08ea[_0x469f69];return _0x414b7c;};'use strict';var _=require(_0xa08e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa08e('0x1'));var moment=require(_0xa08e('0x2'));var BPromise=require(_0xa08e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa08e('0x4'));var attributes=require(_0xa08e('0x5'));module[_0xa08e('0x6')]=function(_0x44113b,_0x3b7892){return _0x44113b['define']('VoiceTransferReport',attributes,{'tableName':_0xa08e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c07=['define','VoiceTransferReport','report_call_transfer','lodash','api','bluebird','rimraf','./voiceTransferReport.attributes','exports'];(function(_0x1cdaad,_0x582369){var _0xecaaa4=function(_0x7acd48){while(--_0x7acd48){_0x1cdaad['push'](_0x1cdaad['shift']());}};_0xecaaa4(++_0x582369);}(_0x6c07,0x1b3));var _0x76c0=function(_0x2d715c,_0x4ad714){_0x2d715c=_0x2d715c-0x0;var _0x446580=_0x6c07[_0x2d715c];return _0x446580;};'use strict';var _=require(_0x76c0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x76c0('0x1'));var moment=require('moment');var BPromise=require(_0x76c0('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x76c0('0x3'));var config=require('../../config/environment');var attributes=require(_0x76c0('0x4'));module[_0x76c0('0x5')]=function(_0x589cbd,_0x3b56e7){return _0x589cbd[_0x76c0('0x6')](_0x76c0('0x7'),attributes,{'tableName':_0x76c0('0x8'),'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 4c2bf55..7bb5f02 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 _0x6c7e=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateVoiceTransferReport','VoiceTransferReport','body','options','raw','then','catch','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6c7e,0x103));var _0xe6c7=function(_0x2ee790,_0x5a8661){_0x2ee790=_0x2ee790-0x0;var _0x5a54a5=_0x6c7e[_0x2ee790];return _0x5a54a5;};'use strict';var _=require(_0xe6c7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe6c7('0x1'));var rs=require(_0xe6c7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe6c7('0x3'))['db'];var utils=require(_0xe6c7('0x4'));var logger=require(_0xe6c7('0x5'))('rpc');var config=require(_0xe6c7('0x6'));var jayson=require(_0xe6c7('0x7'));var client=jayson[_0xe6c7('0x8')][_0xe6c7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16dfc6,_0x181a89,_0x46a05e){return new BPromise(function(_0x2e1e9a,_0x35ea1c){return client[_0xe6c7('0xa')](_0x16dfc6,_0x46a05e)['then'](function(_0x4bc519){logger[_0xe6c7('0xb')](_0xe6c7('0xc'),_0x181a89,_0xe6c7('0xd'));logger['debug'](_0xe6c7('0xe'),_0x181a89,_0xe6c7('0xd'),JSON[_0xe6c7('0xf')](_0x4bc519));if(_0x4bc519[_0xe6c7('0x10')]){if(_0x4bc519[_0xe6c7('0x10')][_0xe6c7('0x11')]===0x1f4){logger[_0xe6c7('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x181a89,_0x4bc519['error'][_0xe6c7('0x12')]);return _0x35ea1c(_0x4bc519[_0xe6c7('0x10')][_0xe6c7('0x12')]);}logger['error'](_0xe6c7('0xc'),_0x181a89,_0x4bc519[_0xe6c7('0x10')]['message']);return _0x2e1e9a(_0x4bc519[_0xe6c7('0x10')][_0xe6c7('0x12')]);}else{logger['info'](_0xe6c7('0xc'),_0x181a89,_0xe6c7('0xd'));_0x2e1e9a(_0x4bc519['result'][_0xe6c7('0x12')]);}})['catch'](function(_0x18e722){logger[_0xe6c7('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x181a89,_0x18e722);_0x35ea1c(_0x18e722);});});}exports[_0xe6c7('0x13')]=function(_0x15f355){var _0x280637=this;return new Promise(function(_0x17027d,_0x58916a){return db[_0xe6c7('0x14')]['create'](_0x15f355[_0xe6c7('0x15')],{'raw':_0x15f355[_0xe6c7('0x16')]?_0x15f355[_0xe6c7('0x16')][_0xe6c7('0x17')]===undefined?!![]:![]:!![]})[_0xe6c7('0x18')](function(_0xea89d4){logger[_0xe6c7('0xb')](_0xe6c7('0x13'),_0x15f355);logger['debug'](_0xe6c7('0x13'),_0x15f355,JSON[_0xe6c7('0xf')](_0xea89d4));_0x17027d(_0xea89d4);})[_0xe6c7('0x19')](function(_0x5489f8){logger[_0xe6c7('0x10')](_0xe6c7('0x13'),_0x5489f8['message'],_0x15f355);_0x58916a(_0x280637[_0xe6c7('0x10')](0x1f4,_0x5489f8[_0xe6c7('0x12')]));});});}; \ No newline at end of file +var _0x8276=['CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','VoiceTransferReport,\x20%s,\x20%s','message','result','catch'];(function(_0x5fc1ac,_0x422418){var _0xce7874=function(_0x5ee804){while(--_0x5ee804){_0x5fc1ac['push'](_0x5fc1ac['shift']());}};_0xce7874(++_0x422418);}(_0x8276,0x9e));var _0x6827=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8276[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6827('0x0'));var util=require(_0x6827('0x1'));var moment=require(_0x6827('0x2'));var BPromise=require(_0x6827('0x3'));var rs=require(_0x6827('0x4'));var fs=require('fs');var Redis=require(_0x6827('0x5'));var db=require(_0x6827('0x6'))['db'];var utils=require(_0x6827('0x7'));var logger=require(_0x6827('0x8'))(_0x6827('0x9'));var config=require(_0x6827('0xa'));var jayson=require(_0x6827('0xb'));var client=jayson[_0x6827('0xc')][_0x6827('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x29b20c,_0x56e74b,_0x4a5521){return new BPromise(function(_0x1be671,_0x442a0d){return client['request'](_0x29b20c,_0x4a5521)['then'](function(_0x6c9ad8){logger[_0x6827('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x56e74b,'request\x20sent');logger['debug'](_0x6827('0xf'),_0x56e74b,'request\x20sent',JSON['stringify'](_0x6c9ad8));if(_0x6c9ad8[_0x6827('0x10')]){if(_0x6c9ad8[_0x6827('0x10')][_0x6827('0x11')]===0x1f4){logger[_0x6827('0x10')](_0x6827('0x12'),_0x56e74b,_0x6c9ad8[_0x6827('0x10')][_0x6827('0x13')]);return _0x442a0d(_0x6c9ad8['error']['message']);}logger[_0x6827('0x10')](_0x6827('0x12'),_0x56e74b,_0x6c9ad8[_0x6827('0x10')][_0x6827('0x13')]);return _0x1be671(_0x6c9ad8['error'][_0x6827('0x13')]);}else{logger[_0x6827('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x56e74b,'request\x20sent');_0x1be671(_0x6c9ad8[_0x6827('0x14')][_0x6827('0x13')]);}})[_0x6827('0x15')](function(_0xb6b41a){logger[_0x6827('0x10')](_0x6827('0x12'),_0x56e74b,_0xb6b41a);_0x442a0d(_0xb6b41a);});});}exports[_0x6827('0x16')]=function(_0x5a4ce8){var _0x57c5a3=this;return new Promise(function(_0x34e7ef,_0x5d8638){return db[_0x6827('0x17')][_0x6827('0x18')](_0x5a4ce8[_0x6827('0x19')],{'raw':_0x5a4ce8[_0x6827('0x1a')]?_0x5a4ce8['options'][_0x6827('0x1b')]===undefined?!![]:![]:!![]})[_0x6827('0x1c')](function(_0x1a11c1){logger[_0x6827('0xe')](_0x6827('0x16'),_0x5a4ce8);logger[_0x6827('0x1d')]('CreateVoiceTransferReport',_0x5a4ce8,JSON['stringify'](_0x1a11c1));_0x34e7ef(_0x1a11c1);})[_0x6827('0x15')](function(_0x4415c3){logger[_0x6827('0x10')]('CreateVoiceTransferReport',_0x4415c3[_0x6827('0x13')],_0x5a4ce8);_0x5d8638(_0x57c5a3[_0x6827('0x10')](0x1f4,_0x4415c3['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index c30b5cf..cc6d387 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 _0x153f=['hold','/unhold','unhold','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','originate','/hangup','isWebrtcLicence','hangup','answer','/hold'];(function(_0x4b4f24,_0x5654a8){var _0x1c13d4=function(_0x4940bf){while(--_0x4940bf){_0x4b4f24['push'](_0x4b4f24['shift']());}};_0x1c13d4(++_0x5654a8);}(_0x153f,0x15b));var _0xf153=function(_0x307173,_0x1232fe){_0x307173=_0x307173-0x0;var _0x444ab6=_0x153f[_0x307173];return _0x444ab6;};'use strict';var express=require(_0xf153('0x0'));var router=express[_0xf153('0x1')]();var auth=require(_0xf153('0x2'));var controller=require(_0xf153('0x3'));router[_0xf153('0x4')](_0xf153('0x5'),auth[_0xf153('0x6')](),auth['isWebrtcLicence'](),controller[_0xf153('0x7')]);router['post'](_0xf153('0x8'),auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0xa')]);router[_0xf153('0x4')]('/answer',auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0xb')]);router[_0xf153('0x4')](_0xf153('0xc'),auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0xd')]);router[_0xf153('0x4')](_0xf153('0xe'),auth['isAuthenticated'](),auth[_0xf153('0x9')](),controller[_0xf153('0xf')]);router[_0xf153('0x4')]('/calls',auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0x10')]);router[_0xf153('0x4')](_0xf153('0x11'),auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0x12')]);module[_0xf153('0x13')]=router; \ No newline at end of file +var _0xb821=['/unhold','unhold','/calls','calls','/transfer','Router','../../components/auth/service','/originate','originate','post','/hangup','isAuthenticated','hangup','/answer','isWebrtcLicence','answer','/hold','hold'];(function(_0x5b11e0,_0x48afdf){var _0x40256b=function(_0x565609){while(--_0x565609){_0x5b11e0['push'](_0x5b11e0['shift']());}};_0x40256b(++_0x48afdf);}(_0xb821,0xa7));var _0x1b82=function(_0x35427e,_0x23f03f){_0x35427e=_0x35427e-0x0;var _0x531191=_0xb821[_0x35427e];return _0x531191;};'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 diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 069ebc2..5cb9969 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 _0x3e5c=['../../mysqldb','../../config/environment','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','stringify','emit','log','handleError:','stack','name','status','send','request','then','error','code','message','result','findOne','agent','rows','UserId','sessionId','length','sessionId\x20','originate','info','originate\x20fired:','body','userId','callNumber','entityFound:','user:%s','webbar:originate','json','catch','hangup\x20fired:','format','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls\x20fired:','VoiceChannels','all','filter','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash'];(function(_0x4de5b9,_0x2873aa){var _0x413984=function(_0x175842){while(--_0x175842){_0x4de5b9['push'](_0x4de5b9['shift']());}};_0x413984(++_0x2873aa);}(_0x3e5c,0x9a));var _0xc3e5=function(_0x178311,_0x5174d1){_0x178311=_0x178311-0x0;var _0x58ecc4=_0x3e5c[_0x178311];return _0x58ecc4;};'use strict';var path=require(_0xc3e5('0x0'));var fs=require('fs');var _=require(_0xc3e5('0x1'));var db=require(_0xc3e5('0x2'))['db'];var config=require(_0xc3e5('0x3'));var util=require('util');var BPromise=require(_0xc3e5('0x4'));var jayson=require(_0xc3e5('0x5'));var amiClient=jayson[_0xc3e5('0x6')][_0xc3e5('0x7')]({'port':0x232a});var logger=require(_0xc3e5('0x8'))(_0xc3e5('0x9'));var Redis=require('ioredis');config[_0xc3e5('0xa')]=_[_0xc3e5('0xb')](config[_0xc3e5('0xa')],{'host':_0xc3e5('0xc'),'port':0x18eb});var io=require(_0xc3e5('0xd'))(new Redis(config['redis']));var Schema=require(_0xc3e5('0xe'));var originateValidation=new Schema({'userId':{'type':_0xc3e5('0xf'),'required':[!![],_0xc3e5('0x10')]},'callNumber':{'type':_0xc3e5('0x11'),'required':[!![],_0xc3e5('0x12')]},'callerId':{'type':_0xc3e5('0x11')},'callbackUrl':{'type':_0xc3e5('0x11')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xc3e5('0x10')]},'sessionId':{'type':_0xc3e5('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xc3e5('0xf'),'required':[!![],_0xc3e5('0x10')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xc3e5('0xf'),'required':[!![],_0xc3e5('0x10')]},'sessionId':{'type':_0xc3e5('0x11'),'required':[!![],_0xc3e5('0x13')]},'transferNumber':{'type':_0xc3e5('0x11'),'required':[!![],_0xc3e5('0x14')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xc3e5('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xc3e5('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xc3e5('0xf'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0xc3e5('0xf'),'required':[!![],_0xc3e5('0x10')]}});function emit(_0x2cc476,_0x1829f9,_0x43abef){logger['info'](_0x2cc476,_0x1829f9,JSON[_0xc3e5('0x15')](_0x43abef));io['to'](_0x2cc476)[_0xc3e5('0x16')](_0x1829f9,_0x43abef);}function handleError(_0xa7357b){return function(_0xa33d84){console[_0xc3e5('0x17')](_0xc3e5('0x18'),_0xa33d84,_0xa33d84 instanceof RangeError);logger['error'](_0xa33d84[_0xc3e5('0x19')]);if(_0xa33d84 instanceof RangeError){if(_0xa33d84[_0xc3e5('0x1a')]){delete _0xa33d84['name'];}_0xa7357b[_0xc3e5('0x1b')](0x194)['send'](_0xa33d84);}else{if(_0xa33d84[_0xc3e5('0x1a')]){delete _0xa33d84[_0xc3e5('0x1a')];}_0xa7357b[_0xc3e5('0x1b')](0x1f4)[_0xc3e5('0x1c')](_0xa33d84);}};}function checkError(){return function(_0x26d31c){if(!_0x26d31c){throw new RangeError('NotFound');}return _0x26d31c;};}function respondWithRpcPromise(_0x161ee1,_0x3051a5){return new BPromise(function(_0x2d8c6f,_0x3eb513){var _0x414ba9=amiClient;return _0x414ba9[_0xc3e5('0x1d')](_0x161ee1,_0x3051a5)[_0xc3e5('0x1e')](function(_0x47f344){if(_0x47f344[_0xc3e5('0x1f')]){if(_0x47f344[_0xc3e5('0x1f')][_0xc3e5('0x20')]===0x1f4){return _0x3eb513(_0x47f344[_0xc3e5('0x1f')][_0xc3e5('0x21')]);}return _0x2d8c6f(_0x47f344[_0xc3e5('0x1f')][_0xc3e5('0x21')]);}else{_0x2d8c6f(_0x47f344[_0xc3e5('0x22')]);}})['catch'](function(_0x25d3a3){_0x3eb513(_0x25d3a3);});});}function getAgent(_0x4c33d9){return db['User'][_0xc3e5('0x23')]({'where':{'id':_0x4c33d9,'role':_0xc3e5('0x24')}})[_0xc3e5('0x1e')](checkError());}function getAgentCheckSession(_0x59dcff,_0x31f49b){return new BPromise(function(_0x38a961,_0x2d3702){var _0x3ad580=respondWithRpcPromise('VoiceChannels');var _0xa6766d=getAgent(_0x59dcff);Promise['all']([_0x3ad580,_0xa6766d])[_0xc3e5('0x1e')](function(_0xc0e6e7){var _0xc58f2b=_0xc0e6e7[0x0];var _0x5a2d41=_0xc0e6e7[0x1];var _0x5ada1c=_['filter'](_0xc58f2b[_0xc3e5('0x25')],function(_0x45cd9c){return _0x45cd9c[_0xc3e5('0x26')]==_0x5a2d41['id']&&_0x45cd9c[_0xc3e5('0x27')]==_0x31f49b;});if(_0x5ada1c[_0xc3e5('0x28')]==0x1){_0x38a961(_0x5a2d41);}else{_0x2d3702(new RangeError(_0xc3e5('0x29')+_0x31f49b+'\x20not\x20found!'));}});});}exports[_0xc3e5('0x2a')]=function(_0x2ecda2,_0x440617){logger[_0xc3e5('0x2b')](_0xc3e5('0x2c'),_0x2ecda2[_0xc3e5('0x2d')]);var _0x471317=originateValidation[_0xc3e5('0xe')](_0x2ecda2[_0xc3e5('0x2d')]);if(_0x471317[_0xc3e5('0x28')]>0x0){return _0x440617[_0xc3e5('0x1b')](0x190)['json'](_0x471317);}var _0x3d7b87=_0x2ecda2['body'][_0xc3e5('0x2e')];var _0x1b310a=_0x2ecda2[_0xc3e5('0x2d')][_0xc3e5('0x2f')];var _0x5af959=_0x2ecda2[_0xc3e5('0x2d')]['callerId'];var _0x54f79b=_0x2ecda2[_0xc3e5('0x2d')]['callbackUrl'];return getAgent(_0x3d7b87)[_0xc3e5('0x1e')](function(_0x3952dd){logger[_0xc3e5('0x2b')](_0xc3e5('0x30'),_0x3952dd[_0xc3e5('0x1a')]);emit(util['format'](_0xc3e5('0x31'),_0x3952dd[_0xc3e5('0x1a')]),_0xc3e5('0x32'),{'callNumber':_0x1b310a,'callerId':_0x5af959,'callbackUrl':_0x54f79b});return _0x440617[_0xc3e5('0x1b')](0xc8)[_0xc3e5('0x33')]({'error':![],'message':'originate\x20executed!'});})[_0xc3e5('0x34')](handleError(_0x440617));};exports['hangup']=function(_0x219ca5,_0x29ea43){logger['info'](_0xc3e5('0x35'),_0x219ca5['body']);var _0xd2b224=hangupValidation[_0xc3e5('0xe')](_0x219ca5[_0xc3e5('0x2d')]);if(_0xd2b224['length']>0x0){return _0x29ea43[_0xc3e5('0x1b')](0x190)[_0xc3e5('0x33')](_0xd2b224);}var _0xc410aa=_0x219ca5[_0xc3e5('0x2d')][_0xc3e5('0x2e')];var _0x5eb2d2=_0x219ca5['body']['sessionId'];return getAgent(_0xc410aa)[_0xc3e5('0x1e')](function(_0x383ced){logger['info'](_0xc3e5('0x30'),_0x383ced['name']);emit(util[_0xc3e5('0x36')]('user:%s',_0x383ced[_0xc3e5('0x1a')]),'webbar:hangup',{'sessionId':_0x5eb2d2});return _0x29ea43[_0xc3e5('0x1b')](0xc8)[_0xc3e5('0x33')]({'error':![],'message':_0xc3e5('0x37')});})[_0xc3e5('0x34')](handleError(_0x29ea43));};exports[_0xc3e5('0x38')]=function(_0x260ab4,_0x5dd895){logger['info'](_0xc3e5('0x39'),_0x260ab4['body']);var _0x3f0887=answerValidation[_0xc3e5('0xe')](_0x260ab4[_0xc3e5('0x2d')]);if(_0x3f0887[_0xc3e5('0x28')]>0x0){return _0x5dd895[_0xc3e5('0x1b')](0x190)[_0xc3e5('0x33')](_0x3f0887);}var _0x49b123=_0x260ab4[_0xc3e5('0x2d')][_0xc3e5('0x2e')];var _0xbbfcad=_0x260ab4[_0xc3e5('0x2d')][_0xc3e5('0x27')];return getAgent(_0x49b123)[_0xc3e5('0x1e')](function(_0x2d98fd){logger[_0xc3e5('0x2b')](_0xc3e5('0x30'),_0x2d98fd[_0xc3e5('0x1a')]);emit(util['format']('user:%s',_0x2d98fd['name']),_0xc3e5('0x3a'),{'sessionId':_0xbbfcad});return _0x5dd895['status'](0xc8)[_0xc3e5('0x33')]({'error':![],'message':_0xc3e5('0x3b')});})[_0xc3e5('0x34')](handleError(_0x5dd895));};exports[_0xc3e5('0x3c')]=function(_0x49d5d9,_0x432574){logger[_0xc3e5('0x2b')](_0xc3e5('0x3d'),_0x49d5d9[_0xc3e5('0x2d')]);var _0x55ab15=holdValidation['validate'](_0x49d5d9[_0xc3e5('0x2d')]);if(_0x55ab15[_0xc3e5('0x28')]>0x0){return _0x432574['status'](0x190)[_0xc3e5('0x33')](_0x55ab15);}var _0x4c9b0b=_0x49d5d9[_0xc3e5('0x2d')]['userId'];var _0x17e12f=_0x49d5d9['body']['sessionId'];return getAgent(_0x4c9b0b)['then'](function(_0x87855d){logger[_0xc3e5('0x2b')](_0xc3e5('0x30'),_0x87855d['name']);emit(util['format'](_0xc3e5('0x31'),_0x87855d['name']),_0xc3e5('0x3e'),{'sessionId':_0x17e12f});return _0x432574[_0xc3e5('0x1b')](0xc8)[_0xc3e5('0x33')]({'error':![],'message':_0xc3e5('0x3f')});})[_0xc3e5('0x34')](handleError(_0x432574));};exports[_0xc3e5('0x40')]=function(_0x5cd31c,_0x27924f){logger['info']('unhold\x20fired:',_0x5cd31c[_0xc3e5('0x2d')]);var _0x5c7fc8=unholdValidation[_0xc3e5('0xe')](_0x5cd31c['body']);if(_0x5c7fc8['length']>0x0){return _0x27924f[_0xc3e5('0x1b')](0x190)[_0xc3e5('0x33')](_0x5c7fc8);}var _0x525e5a=_0x5cd31c['body'][_0xc3e5('0x2e')];var _0x38e722=_0x5cd31c['body'][_0xc3e5('0x27')];return getAgent(_0x525e5a)[_0xc3e5('0x1e')](function(_0xbae80a){logger[_0xc3e5('0x2b')](_0xc3e5('0x30'),_0xbae80a[_0xc3e5('0x1a')]);emit(util[_0xc3e5('0x36')]('user:%s',_0xbae80a[_0xc3e5('0x1a')]),_0xc3e5('0x41'),{'sessionId':_0x38e722});return _0x27924f['status'](0xc8)['json']({'error':![],'message':_0xc3e5('0x42')});})[_0xc3e5('0x34')](handleError(_0x27924f));};exports['calls']=function(_0x50f6b7,_0x566ed0){logger['info'](_0xc3e5('0x43'),_0x566ed0[_0xc3e5('0x2d')]);var _0x474891=callsValidation[_0xc3e5('0xe')](_0x50f6b7[_0xc3e5('0x2d')]);if(_0x474891['length']>0x0){return _0x566ed0[_0xc3e5('0x1b')](0x190)[_0xc3e5('0x33')](_0x474891);}var _0x2d62b7=_0x50f6b7['body'][_0xc3e5('0x2e')];var _0x4079ef=respondWithRpcPromise(_0xc3e5('0x44'));var _0x1f32ee=getAgent(_0x2d62b7);return Promise[_0xc3e5('0x45')]([_0x4079ef,_0x1f32ee])['then'](function(_0x52be13){var _0x2a4396=_0x52be13[0x0];var _0x2efe19=_0x52be13[0x1];var _0x5c0f97=_[_0xc3e5('0x46')](_0x2a4396[_0xc3e5('0x25')],function(_0x5c8060){return _0x5c8060[_0xc3e5('0x26')]==_0x2efe19['id'];});return _0x566ed0[_0xc3e5('0x1b')](0xc8)[_0xc3e5('0x33')]({'count':_0x5c0f97[_0xc3e5('0x28')],'rows':_0x5c0f97});})[_0xc3e5('0x34')](handleError(_0x566ed0));};exports[_0xc3e5('0x47')]=function(_0x1fe284,_0xb132b4){logger['info'](_0xc3e5('0x48'),_0x1fe284[_0xc3e5('0x2d')]);var _0x3db9ac=conferenceValidation['validate'](_0x1fe284['body']);if(_0x3db9ac[_0xc3e5('0x28')]>0x0){return _0xb132b4[_0xc3e5('0x1b')](0x190)[_0xc3e5('0x33')](_0x3db9ac);}var _0x27157c=_0x1fe284[_0xc3e5('0x2d')][_0xc3e5('0x2e')];return getAgent(_0x27157c)['then'](function(_0x3876a5){logger['info'](_0xc3e5('0x30'),_0x3876a5[_0xc3e5('0x1a')]);emit(util[_0xc3e5('0x36')](_0xc3e5('0x31'),_0x3876a5[_0xc3e5('0x1a')]),_0xc3e5('0x49'));return _0xb132b4[_0xc3e5('0x1b')](0xc8)[_0xc3e5('0x33')]({'error':![],'message':_0xc3e5('0x4a')});})[_0xc3e5('0x34')](handleError(_0xb132b4));};exports['transfer']=function(_0x5ee3f6,_0x281415){logger[_0xc3e5('0x2b')](_0xc3e5('0x4b'),_0x5ee3f6[_0xc3e5('0x2d')]);var _0x198e90=transferValidation[_0xc3e5('0xe')](_0x5ee3f6[_0xc3e5('0x2d')]);if(_0x198e90[_0xc3e5('0x28')]>0x0){return _0x281415[_0xc3e5('0x1b')](0x190)['json'](_0x198e90);}var _0x5f2a1f=_0x5ee3f6[_0xc3e5('0x2d')][_0xc3e5('0x2e')];var _0x44bf4f=_0x5ee3f6[_0xc3e5('0x2d')]['sessionId'];var _0x2d184a=_0x5ee3f6[_0xc3e5('0x2d')]['transferNumber'];return getAgent(_0x5f2a1f)[_0xc3e5('0x1e')](function(_0x447bdc){logger[_0xc3e5('0x2b')](_0xc3e5('0x30'),_0x447bdc['name']);emit(util[_0xc3e5('0x36')](_0xc3e5('0x31'),_0x447bdc['name']),_0xc3e5('0x4c'),{'sessionId':_0x44bf4f,'transferNumber':_0x2d184a});return _0x281415[_0xc3e5('0x1b')](0xc8)[_0xc3e5('0x33')]({'error':![],'message':_0xc3e5('0x4d')});})[_0xc3e5('0x34')](handleError(_0x281415));}; \ No newline at end of file +var _0xd87e=['transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../config/environment','util','bluebird','client','../../config/logger','webbarapi','redis','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','transferNumber\x20is\x20required','info','emit','log','error','stack','name','status','send','then','code','message','result','catch','User','findOne','agent','all','rows','UserId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','userId','callNumber','callerId','entityFound:','format','user:%s','webbar:originate','json','originate\x20executed!','sessionId','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','filter','conference','conference\x20fired:','conference\x20executed!','transfer\x20fired:'];(function(_0x13a275,_0x3959a5){var _0x45919a=function(_0x56cb70){while(--_0x56cb70){_0x13a275['push'](_0x13a275['shift']());}};_0x45919a(++_0x3959a5);}(_0xd87e,0x1bf));var _0xed87=function(_0x29cce4,_0x379f7c){_0x29cce4=_0x29cce4-0x0;var _0x1a6616=_0xd87e[_0x29cce4];return _0x1a6616;};'use strict';var path=require(_0xed87('0x0'));var fs=require('fs');var _=require(_0xed87('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0xed87('0x2'));var util=require(_0xed87('0x3'));var BPromise=require(_0xed87('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0xed87('0x5')]['http']({'port':0x232a});var logger=require(_0xed87('0x6'))(_0xed87('0x7'));var Redis=require('ioredis');config[_0xed87('0x8')]=_['defaults'](config['redis'],{'host':_0xed87('0x9'),'port':0x18eb});var io=require(_0xed87('0xa'))(new Redis(config[_0xed87('0x8')]));var Schema=require(_0xed87('0xb'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0xed87('0xc')]},'callNumber':{'type':_0xed87('0xd'),'required':[!![],_0xed87('0xe')]},'callerId':{'type':_0xed87('0xd')},'callbackUrl':{'type':_0xed87('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0xed87('0xf'),'required':[!![],_0xed87('0xc')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xed87('0xf'),'required':[!![],_0xed87('0xc')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xed87('0xf'),'required':[!![],_0xed87('0xc')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xed87('0xd'),'required':[!![],_0xed87('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0xed87('0xf'),'required':[!![],_0xed87('0xc')]},'sessionId':{'type':_0xed87('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xed87('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xed87('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xed87('0xf'),'required':[!![],_0xed87('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':_0xed87('0xf'),'required':[!![],_0xed87('0xc')]}});function emit(_0xd34e0e,_0x173413,_0x2563e4){logger[_0xed87('0x11')](_0xd34e0e,_0x173413,JSON['stringify'](_0x2563e4));io['to'](_0xd34e0e)[_0xed87('0x12')](_0x173413,_0x2563e4);}function handleError(_0x18ab7d){return function(_0x2c386a){console[_0xed87('0x13')]('handleError:',_0x2c386a,_0x2c386a instanceof RangeError);logger[_0xed87('0x14')](_0x2c386a[_0xed87('0x15')]);if(_0x2c386a instanceof RangeError){if(_0x2c386a[_0xed87('0x16')]){delete _0x2c386a[_0xed87('0x16')];}_0x18ab7d[_0xed87('0x17')](0x194)[_0xed87('0x18')](_0x2c386a);}else{if(_0x2c386a[_0xed87('0x16')]){delete _0x2c386a[_0xed87('0x16')];}_0x18ab7d[_0xed87('0x17')](0x1f4)['send'](_0x2c386a);}};}function checkError(){return function(_0x5a7329){if(!_0x5a7329){throw new RangeError('NotFound');}return _0x5a7329;};}function respondWithRpcPromise(_0x47c121,_0x42609e){return new BPromise(function(_0x5d3ec8,_0x4191a7){var _0x2b0b98=amiClient;return _0x2b0b98['request'](_0x47c121,_0x42609e)[_0xed87('0x19')](function(_0x505733){if(_0x505733[_0xed87('0x14')]){if(_0x505733[_0xed87('0x14')][_0xed87('0x1a')]===0x1f4){return _0x4191a7(_0x505733[_0xed87('0x14')][_0xed87('0x1b')]);}return _0x5d3ec8(_0x505733['error'][_0xed87('0x1b')]);}else{_0x5d3ec8(_0x505733[_0xed87('0x1c')]);}})[_0xed87('0x1d')](function(_0x320bcc){_0x4191a7(_0x320bcc);});});}function getAgent(_0x31c600){return db[_0xed87('0x1e')][_0xed87('0x1f')]({'where':{'id':_0x31c600,'role':_0xed87('0x20')}})[_0xed87('0x19')](checkError());}function getAgentCheckSession(_0x38f5c,_0x469181){return new BPromise(function(_0x341a35,_0x16a541){var _0x2b86e2=respondWithRpcPromise('VoiceChannels');var _0xb32b1c=getAgent(_0x38f5c);Promise[_0xed87('0x21')]([_0x2b86e2,_0xb32b1c])['then'](function(_0x3dff74){var _0x33c367=_0x3dff74[0x0];var _0x21c93b=_0x3dff74[0x1];var _0x4b259e=_['filter'](_0x33c367[_0xed87('0x22')],function(_0x428b75){return _0x428b75[_0xed87('0x23')]==_0x21c93b['id']&&_0x428b75['sessionId']==_0x469181;});if(_0x4b259e[_0xed87('0x24')]==0x1){_0x341a35(_0x21c93b);}else{_0x16a541(new RangeError(_0xed87('0x25')+_0x469181+_0xed87('0x26')));}});});}exports[_0xed87('0x27')]=function(_0x114e60,_0x46b9f9){logger[_0xed87('0x11')](_0xed87('0x28'),_0x114e60[_0xed87('0x29')]);var _0x4c0bc0=originateValidation[_0xed87('0xb')](_0x114e60[_0xed87('0x29')]);if(_0x4c0bc0['length']>0x0){return _0x46b9f9[_0xed87('0x17')](0x190)['json'](_0x4c0bc0);}var _0x4430aa=_0x114e60[_0xed87('0x29')][_0xed87('0x2a')];var _0x46b41b=_0x114e60[_0xed87('0x29')][_0xed87('0x2b')];var _0xbd7b69=_0x114e60[_0xed87('0x29')][_0xed87('0x2c')];var _0x6f7b23=_0x114e60[_0xed87('0x29')]['callbackUrl'];return getAgent(_0x4430aa)[_0xed87('0x19')](function(_0x167de8){logger['info'](_0xed87('0x2d'),_0x167de8['name']);emit(util[_0xed87('0x2e')](_0xed87('0x2f'),_0x167de8['name']),_0xed87('0x30'),{'callNumber':_0x46b41b,'callerId':_0xbd7b69,'callbackUrl':_0x6f7b23});return _0x46b9f9[_0xed87('0x17')](0xc8)[_0xed87('0x31')]({'error':![],'message':_0xed87('0x32')});})[_0xed87('0x1d')](handleError(_0x46b9f9));};exports['hangup']=function(_0x1ca26d,_0x525a11){logger[_0xed87('0x11')]('hangup\x20fired:',_0x1ca26d[_0xed87('0x29')]);var _0xb6fe59=hangupValidation[_0xed87('0xb')](_0x1ca26d[_0xed87('0x29')]);if(_0xb6fe59[_0xed87('0x24')]>0x0){return _0x525a11[_0xed87('0x17')](0x190)[_0xed87('0x31')](_0xb6fe59);}var _0x161491=_0x1ca26d[_0xed87('0x29')]['userId'];var _0x4b49f8=_0x1ca26d[_0xed87('0x29')][_0xed87('0x33')];return getAgent(_0x161491)[_0xed87('0x19')](function(_0x325112){logger[_0xed87('0x11')](_0xed87('0x2d'),_0x325112['name']);emit(util[_0xed87('0x2e')](_0xed87('0x2f'),_0x325112[_0xed87('0x16')]),'webbar:hangup',{'sessionId':_0x4b49f8});return _0x525a11[_0xed87('0x17')](0xc8)[_0xed87('0x31')]({'error':![],'message':_0xed87('0x34')});})[_0xed87('0x1d')](handleError(_0x525a11));};exports[_0xed87('0x35')]=function(_0x151179,_0x315e13){logger[_0xed87('0x11')](_0xed87('0x36'),_0x151179[_0xed87('0x29')]);var _0x5c6925=answerValidation[_0xed87('0xb')](_0x151179[_0xed87('0x29')]);if(_0x5c6925[_0xed87('0x24')]>0x0){return _0x315e13['status'](0x190)['json'](_0x5c6925);}var _0xa31eec=_0x151179[_0xed87('0x29')][_0xed87('0x2a')];var _0x41a658=_0x151179['body'][_0xed87('0x33')];return getAgent(_0xa31eec)[_0xed87('0x19')](function(_0x57fa19){logger[_0xed87('0x11')](_0xed87('0x2d'),_0x57fa19[_0xed87('0x16')]);emit(util[_0xed87('0x2e')](_0xed87('0x2f'),_0x57fa19[_0xed87('0x16')]),_0xed87('0x37'),{'sessionId':_0x41a658});return _0x315e13[_0xed87('0x17')](0xc8)[_0xed87('0x31')]({'error':![],'message':_0xed87('0x38')});})[_0xed87('0x1d')](handleError(_0x315e13));};exports['hold']=function(_0x168d7a,_0x122369){logger[_0xed87('0x11')](_0xed87('0x39'),_0x168d7a[_0xed87('0x29')]);var _0x1d3f37=holdValidation[_0xed87('0xb')](_0x168d7a[_0xed87('0x29')]);if(_0x1d3f37[_0xed87('0x24')]>0x0){return _0x122369[_0xed87('0x17')](0x190)[_0xed87('0x31')](_0x1d3f37);}var _0x26c8f4=_0x168d7a[_0xed87('0x29')][_0xed87('0x2a')];var _0x2ed9c3=_0x168d7a[_0xed87('0x29')][_0xed87('0x33')];return getAgent(_0x26c8f4)['then'](function(_0x2c7bef){logger[_0xed87('0x11')](_0xed87('0x2d'),_0x2c7bef['name']);emit(util[_0xed87('0x2e')](_0xed87('0x2f'),_0x2c7bef['name']),_0xed87('0x3a'),{'sessionId':_0x2ed9c3});return _0x122369[_0xed87('0x17')](0xc8)[_0xed87('0x31')]({'error':![],'message':_0xed87('0x3b')});})['catch'](handleError(_0x122369));};exports[_0xed87('0x3c')]=function(_0x436e15,_0x3ca34c){logger[_0xed87('0x11')](_0xed87('0x3d'),_0x436e15[_0xed87('0x29')]);var _0x242b57=unholdValidation[_0xed87('0xb')](_0x436e15[_0xed87('0x29')]);if(_0x242b57[_0xed87('0x24')]>0x0){return _0x3ca34c[_0xed87('0x17')](0x190)[_0xed87('0x31')](_0x242b57);}var _0x2e5a9f=_0x436e15['body'][_0xed87('0x2a')];var _0x4ea4e3=_0x436e15[_0xed87('0x29')][_0xed87('0x33')];return getAgent(_0x2e5a9f)[_0xed87('0x19')](function(_0x27ad77){logger[_0xed87('0x11')](_0xed87('0x2d'),_0x27ad77[_0xed87('0x16')]);emit(util[_0xed87('0x2e')](_0xed87('0x2f'),_0x27ad77[_0xed87('0x16')]),'webbar:unhold',{'sessionId':_0x4ea4e3});return _0x3ca34c[_0xed87('0x17')](0xc8)[_0xed87('0x31')]({'error':![],'message':_0xed87('0x3e')});})[_0xed87('0x1d')](handleError(_0x3ca34c));};exports[_0xed87('0x3f')]=function(_0x44b176,_0x1dbadc){logger[_0xed87('0x11')](_0xed87('0x40'),_0x1dbadc[_0xed87('0x29')]);var _0x32db1f=callsValidation['validate'](_0x44b176['body']);if(_0x32db1f[_0xed87('0x24')]>0x0){return _0x1dbadc[_0xed87('0x17')](0x190)[_0xed87('0x31')](_0x32db1f);}var _0x2ef4a9=_0x44b176[_0xed87('0x29')]['userId'];var _0x7e6738=respondWithRpcPromise(_0xed87('0x41'));var _0x184e99=getAgent(_0x2ef4a9);return Promise[_0xed87('0x21')]([_0x7e6738,_0x184e99])[_0xed87('0x19')](function(_0x43034f){var _0x15e3bc=_0x43034f[0x0];var _0x1391a2=_0x43034f[0x1];var _0x2ffffa=_[_0xed87('0x42')](_0x15e3bc[_0xed87('0x22')],function(_0x227d19){return _0x227d19[_0xed87('0x23')]==_0x1391a2['id'];});return _0x1dbadc[_0xed87('0x17')](0xc8)['json']({'count':_0x2ffffa[_0xed87('0x24')],'rows':_0x2ffffa});})[_0xed87('0x1d')](handleError(_0x1dbadc));};exports[_0xed87('0x43')]=function(_0x423076,_0x1c6578){logger[_0xed87('0x11')](_0xed87('0x44'),_0x423076[_0xed87('0x29')]);var _0x4b1cc5=conferenceValidation[_0xed87('0xb')](_0x423076[_0xed87('0x29')]);if(_0x4b1cc5[_0xed87('0x24')]>0x0){return _0x1c6578[_0xed87('0x17')](0x190)[_0xed87('0x31')](_0x4b1cc5);}var _0x306d9a=_0x423076['body']['userId'];return getAgent(_0x306d9a)[_0xed87('0x19')](function(_0x176bc4){logger[_0xed87('0x11')](_0xed87('0x2d'),_0x176bc4[_0xed87('0x16')]);emit(util[_0xed87('0x2e')](_0xed87('0x2f'),_0x176bc4[_0xed87('0x16')]),'webbar:conference');return _0x1c6578[_0xed87('0x17')](0xc8)['json']({'error':![],'message':_0xed87('0x45')});})[_0xed87('0x1d')](handleError(_0x1c6578));};exports['transfer']=function(_0x11b3a8,_0x30f9d0){logger['info'](_0xed87('0x46'),_0x11b3a8[_0xed87('0x29')]);var _0x2dd1e8=transferValidation[_0xed87('0xb')](_0x11b3a8[_0xed87('0x29')]);if(_0x2dd1e8['length']>0x0){return _0x30f9d0[_0xed87('0x17')](0x190)[_0xed87('0x31')](_0x2dd1e8);}var _0x263810=_0x11b3a8[_0xed87('0x29')]['userId'];var _0x58279a=_0x11b3a8[_0xed87('0x29')][_0xed87('0x33')];var _0x52b53f=_0x11b3a8[_0xed87('0x29')][_0xed87('0x47')];return getAgent(_0x263810)[_0xed87('0x19')](function(_0xa1c262){logger[_0xed87('0x11')](_0xed87('0x2d'),_0xa1c262[_0xed87('0x16')]);emit(util[_0xed87('0x2e')](_0xed87('0x2f'),_0xa1c262[_0xed87('0x16')]),_0xed87('0x48'),{'sessionId':_0x58279a,'transferNumber':_0x52b53f});return _0x30f9d0[_0xed87('0x17')](0xc8)[_0xed87('0x31')]({'error':![],'message':_0xed87('0x49')});})['catch'](handleError(_0x30f9d0));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index ed676f9..e2a9b5a 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 _0x7708=['../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addAgents','/:id/notify','notify','/:id/send','put','update','destroy','delete','removeDispositions','removeAnswers','exports','multer','util','connect-timeout','../../components/interaction/service'];(function(_0x177fef,_0x17137b){var _0x2c762d=function(_0x139351){while(--_0x139351){_0x177fef['push'](_0x177fef['shift']());}};_0x2c762d(++_0x17137b);}(_0x7708,0x188));var _0x8770=function(_0x4404ff,_0x13d7a9){_0x4404ff=_0x4404ff-0x0;var _0x5e7b19=_0x7708[_0x4404ff];return _0x5e7b19;};'use strict';var multer=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var path=require('path');var timeout=require(_0x8770('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8770('0x3'));var config=require(_0x8770('0x4'));var controller=require('./whatsappAccount.controller');router[_0x8770('0x5')]('/',auth['isAuthenticated'](),controller[_0x8770('0x6')]);router[_0x8770('0x5')](_0x8770('0x7'),auth[_0x8770('0x8')](),controller[_0x8770('0x9')]);router[_0x8770('0x5')](_0x8770('0xa'),auth['isAuthenticated'](),controller[_0x8770('0xb')]);router[_0x8770('0x5')](_0x8770('0xc'),auth['isAuthenticated'](),controller[_0x8770('0xd')]);router[_0x8770('0x5')](_0x8770('0xe'),auth[_0x8770('0x8')](),controller['getAnswers']);router[_0x8770('0x5')](_0x8770('0xf'),auth[_0x8770('0x8')](),controller['getAgents']);router[_0x8770('0x5')](_0x8770('0x10'),auth[_0x8770('0x8')](),controller[_0x8770('0x11')]);router[_0x8770('0x12')]('/',auth[_0x8770('0x8')](),controller[_0x8770('0x13')]);router[_0x8770('0x12')]('/:id/dispositions',auth[_0x8770('0x8')](),controller[_0x8770('0x14')]);router['post'](_0x8770('0xe'),auth['isAuthenticated'](),controller[_0x8770('0x15')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x8770('0x16')]);router[_0x8770('0x12')](_0x8770('0x10'),auth[_0x8770('0x8')](),controller['addApplications']);router['post'](_0x8770('0x17'),controller[_0x8770('0x18')]);router[_0x8770('0x12')](_0x8770('0x19'),auth[_0x8770('0x8')](),controller['send']);router[_0x8770('0x1a')](_0x8770('0xa'),auth[_0x8770('0x8')](),controller[_0x8770('0x1b')]);router['delete']('/:id',auth[_0x8770('0x8')](),controller[_0x8770('0x1c')]);router[_0x8770('0x1d')](_0x8770('0xc'),auth[_0x8770('0x8')](),controller[_0x8770('0x1e')]);router['delete'](_0x8770('0xe'),auth[_0x8770('0x8')](),controller[_0x8770('0x1f')]);router[_0x8770('0x1d')]('/:id/users',auth[_0x8770('0x8')](),controller['removeAgents']);module[_0x8770('0x20')]=router; \ No newline at end of file +var _0xb016=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','getApplications','addAnswer','post','addAgents','/:id/applications','addApplications','/:id/notify','notify','/:id/send','send','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','express','fs-extra','../../components/auth/service'];(function(_0x31063d,_0x2459e1){var _0x10bdfd=function(_0x135c87){while(--_0x135c87){_0x31063d['push'](_0x31063d['shift']());}};_0x10bdfd(++_0x2459e1);}(_0xb016,0x159));var _0x6b01=function(_0x1cf3cf,_0x402849){_0x1cf3cf=_0x1cf3cf-0x0;var _0x7e2415=_0xb016[_0x1cf3cf];return _0x7e2415;};'use strict';var multer=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6b01('0x2'));var router=express['Router']();var fs_extra=require(_0x6b01('0x3'));var auth=require(_0x6b01('0x4'));var interaction=require(_0x6b01('0x5'));var config=require(_0x6b01('0x6'));var controller=require('./whatsappAccount.controller');router[_0x6b01('0x7')]('/',auth[_0x6b01('0x8')](),controller[_0x6b01('0x9')]);router['get']('/describe',auth[_0x6b01('0x8')](),controller[_0x6b01('0xa')]);router['get']('/:id',auth[_0x6b01('0x8')](),controller[_0x6b01('0xb')]);router[_0x6b01('0x7')](_0x6b01('0xc'),auth[_0x6b01('0x8')](),controller['getDispositions']);router['get'](_0x6b01('0xd'),auth[_0x6b01('0x8')](),controller[_0x6b01('0xe')]);router['get'](_0x6b01('0xf'),auth['isAuthenticated'](),controller['getAgents']);router[_0x6b01('0x7')]('/:id/applications',auth[_0x6b01('0x8')](),controller[_0x6b01('0x10')]);router['post']('/',auth[_0x6b01('0x8')](),controller['create']);router['post']('/:id/dispositions',auth[_0x6b01('0x8')](),controller['addDisposition']);router['post'](_0x6b01('0xd'),auth[_0x6b01('0x8')](),controller[_0x6b01('0x11')]);router[_0x6b01('0x12')](_0x6b01('0xf'),auth[_0x6b01('0x8')](),controller[_0x6b01('0x13')]);router[_0x6b01('0x12')](_0x6b01('0x14'),auth[_0x6b01('0x8')](),controller[_0x6b01('0x15')]);router['post'](_0x6b01('0x16'),controller[_0x6b01('0x17')]);router[_0x6b01('0x12')](_0x6b01('0x18'),auth[_0x6b01('0x8')](),controller[_0x6b01('0x19')]);router[_0x6b01('0x1a')](_0x6b01('0x1b'),auth['isAuthenticated'](),controller[_0x6b01('0x1c')]);router[_0x6b01('0x1d')](_0x6b01('0x1b'),auth[_0x6b01('0x8')](),controller[_0x6b01('0x1e')]);router[_0x6b01('0x1d')](_0x6b01('0xc'),auth['isAuthenticated'](),controller[_0x6b01('0x1f')]);router[_0x6b01('0x1d')](_0x6b01('0xd'),auth['isAuthenticated'](),controller[_0x6b01('0x20')]);router[_0x6b01('0x1d')](_0x6b01('0xf'),auth[_0x6b01('0x8')](),controller[_0x6b01('0x21')]);module[_0x6b01('0x22')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index b0a712c..fa0a544 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 _0xa1dc=['randomstring','exports','STRING','name','generate','twilio','sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x36a59e,_0x3296ba){var _0x3f310e=function(_0x2c88b8){while(--_0x2c88b8){_0x36a59e['push'](_0x36a59e['shift']());}};_0x3f310e(++_0x3296ba);}(_0xa1dc,0x125));var _0xca1d=function(_0x4c1559,_0x2cddd3){_0x4c1559=_0x4c1559-0x0;var _0x569a26=_0xa1dc[_0x4c1559];return _0x569a26;};'use strict';var Sequelize=require(_0xca1d('0x0'));var rs=require(_0xca1d('0x1'));module[_0xca1d('0x2')]={'name':{'type':Sequelize[_0xca1d('0x3')],'unique':_0xca1d('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xca1d('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xca1d('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xca1d('0x5')]();}},'phone':{'type':Sequelize[_0xca1d('0x3')]},'type':{'type':Sequelize['ENUM'](_0xca1d('0x6'),_0xca1d('0x7'))},'accountSid':{'type':Sequelize[_0xca1d('0x3')]},'baseUrl':{'type':Sequelize[_0xca1d('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xca1d('0x8');}},'notificationSound':{'type':Sequelize[_0xca1d('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xca1d('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xca1d('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xca1d('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xca1d('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xca1d('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xca1d('0xa')],'comment':_0xca1d('0xb')},'mandatoryDisposition':{'type':Sequelize[_0xca1d('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5e929e){if(!_0x5e929e){this['setDataValue'](_0xca1d('0xc'),null);}this['setDataValue'](_0xca1d('0xd'),_0x5e929e);}},'description':{'type':Sequelize[_0xca1d('0x3')]}}; \ No newline at end of file +var _0xc2d3=['STRING','generate','ENUM','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','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','name'];(function(_0x11a422,_0x5907a5){var _0x547177=function(_0x55ec90){while(--_0x55ec90){_0x11a422['push'](_0x11a422['shift']());}};_0x547177(++_0x5907a5);}(_0xc2d3,0xb8));var _0x3c2d=function(_0x28e1ee,_0x4760c3){_0x28e1ee=_0x28e1ee-0x0;var _0x4e741c=_0xc2d3[_0x28e1ee];return _0x4e741c;};'use strict';var Sequelize=require(_0x3c2d('0x0'));var rs=require(_0x3c2d('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x3c2d('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x3c2d('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x3c2d('0x3')],'defaultValue':function(){return rs[_0x3c2d('0x4')]();}},'phone':{'type':Sequelize[_0x3c2d('0x3')]},'type':{'type':Sequelize[_0x3c2d('0x5')](_0x3c2d('0x6'),_0x3c2d('0x7'))},'accountSid':{'type':Sequelize[_0x3c2d('0x3')]},'baseUrl':{'type':Sequelize[_0x3c2d('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x3c2d('0x8')],'defaultValue':function(){return _0x3c2d('0x9');}},'notificationSound':{'type':Sequelize[_0x3c2d('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x3c2d('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3c2d('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3c2d('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3c2d('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3c2d('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3c2d('0xb')],'comment':_0x3c2d('0xc')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x3c2d('0xd'),'set':function(_0x68a6bf){if(!_0x68a6bf){this[_0x3c2d('0xe')](_0x3c2d('0xf'),null);}this[_0x3c2d('0xe')](_0x3c2d('0x10'),_0x68a6bf);}},'description':{'type':Sequelize[_0x3c2d('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 7a2812e..e303864 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 _0xc0f1=['account','sinch','statuses','read','WhatsappMessage','timestamp','message_id','applications','priority','CmContact','describe','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','notifications','isNil','ValidationError','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','CmList','list','Contacts','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','AttachmentId','UserId','unshift','agent','*,*,*,*','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','json','to\x20is\x20mandatory','DESC','List','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappAccount.socket','jayson/promise','client','http','request','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','end','offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','update','then','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','include','findAll','catch','params','keys','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','addDisposition','WhatsappAccountId','Disposition','findOne','nolimit','order','rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','finally','getApplications','notify','Applications'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc0f1,0x1c3));var _0x1c0f=function(_0x3c8b46,_0x34e053){_0x3c8b46=_0x3c8b46-0x0;var _0x4bf0a8=_0xc0f1[_0x3c8b46];return _0x4bf0a8;};'use strict';var emlformat=require(_0x1c0f('0x0'));var rimraf=require(_0x1c0f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1c0f('0x2'));var rp=require(_0x1c0f('0x3'));var moment=require(_0x1c0f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1c0f('0x5'));var path=require(_0x1c0f('0x6'));var sox=require(_0x1c0f('0x7'));var csv=require(_0x1c0f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1c0f('0x9'));var squel=require(_0x1c0f('0xa'));var crypto=require('crypto');var jsforce=require(_0x1c0f('0xb'));var deskjs=require(_0x1c0f('0xc'));var toCsv=require(_0x1c0f('0x8'));var querystring=require(_0x1c0f('0xd'));var Papa=require(_0x1c0f('0xe'));var Redis=require(_0x1c0f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1c0f('0x10'));var as=require(_0x1c0f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1c0f('0x12'))(_0x1c0f('0x13'));var utils=require(_0x1c0f('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1c0f('0x15'));var db=require(_0x1c0f('0x16'))['db'];config[_0x1c0f('0x17')]=_[_0x1c0f('0x18')](config[_0x1c0f('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x1c0f('0x19'))(new Redis(config['redis']));require(_0x1c0f('0x1a'))['register'](socket);var jayson=require(_0x1c0f('0x1b'));var client=jayson[_0x1c0f('0x1c')][_0x1c0f('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x11edf0,_0x2c825b,_0x463a89,_0x55eb1d){return new BPromise(function(_0x580ebd,_0x179b56){var _0x460473=_0x55eb1d||client;return _0x460473[_0x1c0f('0x1e')](_0x11edf0,_0x463a89)['then'](function(_0x501083){logger[_0x1c0f('0x1f')](_0x1c0f('0x20'),_0x2c825b,'request\x20sent');logger[_0x1c0f('0x21')](_0x1c0f('0x22'),_0x2c825b,_0x1c0f('0x23'),JSON[_0x1c0f('0x24')](_0x501083));if(_0x501083[_0x1c0f('0x25')]){if(_0x501083[_0x1c0f('0x25')]['code']===0x1f4){logger[_0x1c0f('0x25')](_0x1c0f('0x20'),_0x2c825b,_0x501083[_0x1c0f('0x25')][_0x1c0f('0x26')]);return _0x179b56(_0x501083[_0x1c0f('0x25')]['message']);}logger[_0x1c0f('0x25')](_0x1c0f('0x20'),_0x2c825b,_0x501083[_0x1c0f('0x25')][_0x1c0f('0x26')]);return _0x580ebd(_0x501083['error'][_0x1c0f('0x26')]);}else{logger[_0x1c0f('0x1f')](_0x1c0f('0x20'),_0x2c825b,_0x1c0f('0x23'));_0x580ebd(_0x501083[_0x1c0f('0x27')]['message']);}})['catch'](function(_0x1c97d8){logger['error'](_0x1c0f('0x20'),_0x2c825b,_0x1c97d8);_0x179b56(_0x1c97d8);});});}function respondWithStatusCode(_0x366f65,_0xdd2ad5){_0xdd2ad5=_0xdd2ad5||0xcc;return function(_0x357d28){if(_0x357d28){return _0x366f65[_0x1c0f('0x28')](_0xdd2ad5);}return _0x366f65['status'](_0xdd2ad5)[_0x1c0f('0x29')]();};}function respondWithResult(_0x37fd6b,_0x2d5a19){_0x2d5a19=_0x2d5a19||0xc8;return function(_0x903a7b){if(_0x903a7b){return _0x37fd6b['status'](_0x2d5a19)['json'](_0x903a7b);}};}function respondWithFilteredResult(_0x5889e4,_0x220e4c){return function(_0x2feaa7){if(_0x2feaa7){var _0x1d0479=typeof _0x220e4c[_0x1c0f('0x2a')]==='undefined'&&typeof _0x220e4c[_0x1c0f('0x2b')]===_0x1c0f('0x2c');var _0x384d78=_0x2feaa7[_0x1c0f('0x2d')];var _0x30171d=_0x1d0479?0x0:_0x220e4c[_0x1c0f('0x2a')];var _0x77a2fd=_0x1d0479?_0x2feaa7[_0x1c0f('0x2d')]:_0x220e4c['offset']+_0x220e4c[_0x1c0f('0x2b')];var _0x931454;if(_0x77a2fd>=_0x384d78){_0x77a2fd=_0x384d78;_0x931454=0xc8;}else{_0x931454=0xce;}_0x5889e4[_0x1c0f('0x2e')](_0x931454);return _0x5889e4[_0x1c0f('0x2f')](_0x1c0f('0x30'),_0x30171d+'-'+_0x77a2fd+'/'+_0x384d78)['json'](_0x2feaa7);}return null;};}function patchUpdates(_0x49c639){return function(_0x1da018){try{jsonpatch[_0x1c0f('0x31')](_0x1da018,_0x49c639,!![]);}catch(_0xa8c802){return BPromise[_0x1c0f('0x32')](_0xa8c802);}return _0x1da018[_0x1c0f('0x33')]();};}function saveUpdates(_0x1ac54a,_0x337ac0){return function(_0x5102da){if(_0x5102da){return _0x5102da[_0x1c0f('0x34')](_0x1ac54a)[_0x1c0f('0x35')](function(_0x137ae3){return _0x137ae3;});}return null;};}function removeEntity(_0x306d3f,_0x29b55e){return function(_0x15b4f3){if(_0x15b4f3){return _0x15b4f3[_0x1c0f('0x36')]()['then'](function(){var _0x37f21b=_0x15b4f3[_0x1c0f('0x37')]({'plain':!![]});var _0x1c8324=_0x1c0f('0x38');return db[_0x1c0f('0x39')][_0x1c0f('0x36')]({'where':{'type':_0x1c8324,'resourceId':_0x37f21b['id']}})[_0x1c0f('0x35')](function(){return _0x15b4f3;});})[_0x1c0f('0x35')](function(){_0x306d3f[_0x1c0f('0x2e')](0xcc)[_0x1c0f('0x29')]();});}};}function handleEntityNotFound(_0x37d2f1,_0x514003){return function(_0x5a0590){if(!_0x5a0590){_0x37d2f1['sendStatus'](0x194);}return _0x5a0590;};}function handleError(_0x53d9ba,_0x1d0c22){_0x1d0c22=_0x1d0c22||0x1f4;return function(_0x362717){logger['error'](_0x362717[_0x1c0f('0x3a')]);if(_0x362717[_0x1c0f('0x3b')]){delete _0x362717[_0x1c0f('0x3b')];}_0x53d9ba[_0x1c0f('0x2e')](_0x1d0c22)[_0x1c0f('0x3c')](_0x362717);};}exports[_0x1c0f('0x3d')]=function(_0x23764c,_0x35129f){var _0x4b5528={'include':[{'model':db[_0x1c0f('0x3e')],'as':_0x1c0f('0x3f')}]},_0x243cfa={},_0x3246d7={'count':0x0,'rows':[]};var _0xfbcb27=_['map'](db[_0x1c0f('0x40')][_0x1c0f('0x41')],function(_0x2df5b9){return{'name':_0x2df5b9[_0x1c0f('0x42')],'type':_0x2df5b9[_0x1c0f('0x43')][_0x1c0f('0x44')]};});_0x243cfa[_0x1c0f('0x45')]=_[_0x1c0f('0x46')](_0xfbcb27,_0x1c0f('0x3b'));_0x243cfa[_0x1c0f('0x47')]=_['keys'](_0x23764c[_0x1c0f('0x47')]);_0x243cfa[_0x1c0f('0x48')]=_[_0x1c0f('0x49')](_0x243cfa[_0x1c0f('0x45')],_0x243cfa['query']);_0x4b5528[_0x1c0f('0x4a')]=_[_0x1c0f('0x49')](_0x243cfa[_0x1c0f('0x45')],qs[_0x1c0f('0x4b')](_0x23764c[_0x1c0f('0x47')]['fields']));_0x4b5528['attributes']=_0x4b5528[_0x1c0f('0x4a')][_0x1c0f('0x4c')]?_0x4b5528[_0x1c0f('0x4a')]:_0x243cfa[_0x1c0f('0x45')];if(!_0x23764c[_0x1c0f('0x47')][_0x1c0f('0x4d')]('nolimit')){_0x4b5528[_0x1c0f('0x2b')]=qs[_0x1c0f('0x2b')](_0x23764c[_0x1c0f('0x47')]['limit']);_0x4b5528[_0x1c0f('0x2a')]=qs[_0x1c0f('0x2a')](_0x23764c['query'][_0x1c0f('0x2a')]);}_0x4b5528['order']=qs[_0x1c0f('0x4e')](_0x23764c[_0x1c0f('0x47')][_0x1c0f('0x4e')]);_0x4b5528[_0x1c0f('0x4f')]=qs[_0x1c0f('0x48')](_[_0x1c0f('0x50')](_0x23764c[_0x1c0f('0x47')],_0x243cfa['filters']),_0xfbcb27);if(_0x23764c[_0x1c0f('0x47')]['filter']){_0x4b5528[_0x1c0f('0x4f')]=_['merge'](_0x4b5528['where'],{'$or':_['map'](_0xfbcb27,function(_0x4df30a){if(_0x4df30a[_0x1c0f('0x43')]!=='VIRTUAL'){var _0x4f85ae={};_0x4f85ae[_0x4df30a[_0x1c0f('0x3b')]]={'$like':'%'+_0x23764c['query'][_0x1c0f('0x51')]+'%'};return _0x4f85ae;}})});}_0x4b5528=_[_0x1c0f('0x52')]({},_0x4b5528,_0x23764c[_0x1c0f('0x53')]);var _0x4ade95={'where':_0x4b5528[_0x1c0f('0x4f')]};return db[_0x1c0f('0x40')][_0x1c0f('0x2d')](_0x4ade95)[_0x1c0f('0x35')](function(_0x1ffb4a){_0x3246d7[_0x1c0f('0x2d')]=_0x1ffb4a;if(_0x23764c[_0x1c0f('0x47')]['includeAll']){_0x4b5528[_0x1c0f('0x54')]=[{'all':!![]}];}return db[_0x1c0f('0x40')][_0x1c0f('0x55')](_0x4b5528);})[_0x1c0f('0x35')](function(_0x3376a3){_0x3246d7['rows']=_0x3376a3;return _0x3246d7;})['then'](respondWithFilteredResult(_0x35129f,_0x4b5528))[_0x1c0f('0x56')](handleError(_0x35129f,null));};exports['show']=function(_0x31de48,_0x13d75c){var _0x33dae3={'raw':![],'where':{'id':_0x31de48[_0x1c0f('0x57')]['id']},'include':[{'model':db[_0x1c0f('0x3e')],'as':_0x1c0f('0x3f')}]},_0x22d024={};_0x22d024[_0x1c0f('0x45')]=_[_0x1c0f('0x58')](db[_0x1c0f('0x40')]['rawAttributes']);_0x22d024[_0x1c0f('0x47')]=_[_0x1c0f('0x58')](_0x31de48['query']);_0x22d024[_0x1c0f('0x48')]=_['intersection'](_0x22d024[_0x1c0f('0x45')],_0x22d024[_0x1c0f('0x47')]);_0x33dae3[_0x1c0f('0x4a')]=_['intersection'](_0x22d024[_0x1c0f('0x45')],qs[_0x1c0f('0x4b')](_0x31de48[_0x1c0f('0x47')][_0x1c0f('0x4b')]));_0x33dae3['attributes']=_0x33dae3[_0x1c0f('0x4a')][_0x1c0f('0x4c')]?_0x33dae3[_0x1c0f('0x4a')]:_0x22d024[_0x1c0f('0x45')];if(_0x31de48[_0x1c0f('0x47')][_0x1c0f('0x59')]){_0x33dae3[_0x1c0f('0x54')]=[{'all':!![]}];}_0x33dae3=_[_0x1c0f('0x52')]({},_0x33dae3,_0x31de48[_0x1c0f('0x53')]);return db[_0x1c0f('0x40')][_0x1c0f('0x5a')](_0x33dae3)['then'](handleEntityNotFound(_0x13d75c,null))['then'](respondWithResult(_0x13d75c,null))['catch'](handleError(_0x13d75c,null));};exports[_0x1c0f('0x5b')]=function(_0x562f92,_0x154b9e){return db['WhatsappAccount'][_0x1c0f('0x5b')](_0x562f92[_0x1c0f('0x5c')],{})[_0x1c0f('0x35')](function(_0x5d690b){var _0x485377=_0x562f92['user'][_0x1c0f('0x37')]({'plain':!![]});if(!_0x485377)throw new Error(_0x1c0f('0x5d'));if(_0x485377[_0x1c0f('0x5e')]===_0x1c0f('0x5f')){var _0x18589b=_0x5d690b[_0x1c0f('0x37')]({'plain':!![]});var _0x303612='WhatsappAccounts';return db[_0x1c0f('0x60')][_0x1c0f('0x5a')]({'where':{'name':_0x303612,'userProfileId':_0x485377['userProfileId']},'raw':!![]})[_0x1c0f('0x35')](function(_0x482f98){if(_0x482f98&&_0x482f98['autoAssociation']===0x0){return db[_0x1c0f('0x39')][_0x1c0f('0x5b')]({'name':_0x18589b['name'],'resourceId':_0x18589b['id'],'type':_0x482f98[_0x1c0f('0x3b')],'sectionId':_0x482f98['id']},{})[_0x1c0f('0x35')](function(){return _0x5d690b;});}else{return _0x5d690b;}})[_0x1c0f('0x56')](function(_0x1c43bf){logger[_0x1c0f('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c43bf);throw _0x1c43bf;});}return _0x5d690b;})[_0x1c0f('0x35')](respondWithResult(_0x154b9e,0xc9))[_0x1c0f('0x56')](handleError(_0x154b9e,null));};exports[_0x1c0f('0x34')]=function(_0x447d41,_0x96fbb5){if(_0x447d41[_0x1c0f('0x5c')]['id']){delete _0x447d41[_0x1c0f('0x5c')]['id'];}return db['WhatsappAccount'][_0x1c0f('0x5a')]({'where':{'id':_0x447d41['params']['id']},'include':[{'model':db['Pause'],'as':_0x1c0f('0x3f')}]})[_0x1c0f('0x35')](handleEntityNotFound(_0x96fbb5,null))[_0x1c0f('0x35')](saveUpdates(_0x447d41['body'],null))[_0x1c0f('0x35')](respondWithResult(_0x96fbb5,null))[_0x1c0f('0x56')](handleError(_0x96fbb5,null));};exports[_0x1c0f('0x36')]=function(_0xb0b297,_0x180cdb){return db[_0x1c0f('0x40')][_0x1c0f('0x5a')]({'where':{'id':_0xb0b297['params']['id']}})[_0x1c0f('0x35')](handleEntityNotFound(_0x180cdb,null))[_0x1c0f('0x35')](removeEntity(_0x180cdb,null))['catch'](handleError(_0x180cdb,null));};exports['describe']=function(_0x41af67,_0x55288b){return db[_0x1c0f('0x40')]['describe']()[_0x1c0f('0x35')](respondWithResult(_0x55288b,null))[_0x1c0f('0x56')](handleError(_0x55288b,null));};exports[_0x1c0f('0x61')]=function(_0x20ddfb,_0x1806ba,_0x434dda){if(_0x20ddfb[_0x1c0f('0x5c')]['id']){delete _0x20ddfb[_0x1c0f('0x5c')]['id'];}return db['WhatsappAccount'][_0x1c0f('0x5a')]({'where':{'id':_0x20ddfb['params']['id']}})[_0x1c0f('0x35')](handleEntityNotFound(_0x1806ba,null))[_0x1c0f('0x35')](function(_0x38363f){if(_0x38363f){_0x20ddfb['body'][_0x1c0f('0x62')]=_0x38363f['id'];return db[_0x1c0f('0x63')][_0x1c0f('0x5b')](_0x20ddfb['body']);}})[_0x1c0f('0x35')](respondWithResult(_0x1806ba,null))['catch'](handleError(_0x1806ba,null));};exports['getDispositions']=function(_0xfe3451,_0x2a3b88,_0x3e78c5){var _0x21cf56={'raw':![],'where':{}};var _0x20dff4={};var _0x442fe4={'count':0x0,'rows':[]};return db[_0x1c0f('0x40')][_0x1c0f('0x64')]({'where':{'id':_0xfe3451['params']['id']}})[_0x1c0f('0x35')](handleEntityNotFound(_0x2a3b88,null))[_0x1c0f('0x35')](function(_0x37b300){if(_0x37b300){_0x20dff4[_0x1c0f('0x45')]=_[_0x1c0f('0x58')](db[_0x1c0f('0x63')][_0x1c0f('0x41')]);_0x20dff4['query']=_[_0x1c0f('0x58')](_0xfe3451[_0x1c0f('0x47')]);_0x20dff4['filters']=_[_0x1c0f('0x49')](_0x20dff4[_0x1c0f('0x45')],_0x20dff4['query']);_0x21cf56[_0x1c0f('0x4a')]=_[_0x1c0f('0x49')](_0x20dff4['model'],qs[_0x1c0f('0x4b')](_0xfe3451['query'][_0x1c0f('0x4b')]));_0x21cf56[_0x1c0f('0x4a')]=_0x21cf56[_0x1c0f('0x4a')]['length']?_0x21cf56[_0x1c0f('0x4a')]:_0x20dff4[_0x1c0f('0x45')];if(!_0xfe3451['query']['hasOwnProperty'](_0x1c0f('0x65'))){_0x21cf56[_0x1c0f('0x2b')]=qs[_0x1c0f('0x2b')](_0xfe3451[_0x1c0f('0x47')][_0x1c0f('0x2b')]);_0x21cf56['offset']=qs['offset'](_0xfe3451[_0x1c0f('0x47')][_0x1c0f('0x2a')]);}_0x21cf56[_0x1c0f('0x66')]=qs['sort'](_0xfe3451['query']['sort']);_0x21cf56['where']=qs[_0x1c0f('0x48')](_['pick'](_0xfe3451[_0x1c0f('0x47')],_0x20dff4['filters']));_0x21cf56['where'][_0x1c0f('0x62')]=_0x37b300['id'];if(_0xfe3451[_0x1c0f('0x47')][_0x1c0f('0x51')]){_0x21cf56[_0x1c0f('0x4f')]=_[_0x1c0f('0x52')](_0x21cf56[_0x1c0f('0x4f')],{'$or':_[_0x1c0f('0x46')](_0x21cf56[_0x1c0f('0x4a')],function(_0x38d00f){var _0x3c69e2={};_0x3c69e2[_0x38d00f]={'$like':'%'+_0xfe3451['query']['filter']+'%'};return _0x3c69e2;})});}_0x21cf56=_[_0x1c0f('0x52')]({},_0x21cf56,_0xfe3451[_0x1c0f('0x53')]);return db[_0x1c0f('0x63')]['count']({'where':_0x21cf56[_0x1c0f('0x4f')]})[_0x1c0f('0x35')](function(_0x580d45){_0x442fe4[_0x1c0f('0x2d')]=_0x580d45;if(_0xfe3451[_0x1c0f('0x47')][_0x1c0f('0x59')]){_0x21cf56[_0x1c0f('0x54')]=[{'all':!![]}];}return db[_0x1c0f('0x63')]['findAll'](_0x21cf56);})[_0x1c0f('0x35')](function(_0x407319){_0x442fe4[_0x1c0f('0x67')]=_0x407319;return _0x442fe4;});}})[_0x1c0f('0x35')](respondWithFilteredResult(_0x2a3b88,_0x21cf56))[_0x1c0f('0x56')](handleError(_0x2a3b88,null));};exports['removeDispositions']=function(_0x59d0a5,_0xb64ec,_0x352a6b){return db['WhatsappAccount']['find']({'where':{'id':_0x59d0a5['params']['id']}})['then'](handleEntityNotFound(_0xb64ec,null))[_0x1c0f('0x35')](function(_0x5ba516){if(_0x5ba516){return _0x5ba516[_0x1c0f('0x68')](_0x59d0a5[_0x1c0f('0x47')][_0x1c0f('0x69')]);}})[_0x1c0f('0x35')](respondWithStatusCode(_0xb64ec,null))[_0x1c0f('0x56')](handleError(_0xb64ec,null));};exports[_0x1c0f('0x6a')]=function(_0x30a1e5,_0x18c96c,_0x4f810d){if(_0x30a1e5[_0x1c0f('0x5c')]['id']){delete _0x30a1e5[_0x1c0f('0x5c')]['id'];}return db['WhatsappAccount'][_0x1c0f('0x5a')]({'where':{'id':_0x30a1e5[_0x1c0f('0x57')]['id']}})['then'](handleEntityNotFound(_0x18c96c,null))[_0x1c0f('0x35')](function(_0x4f78f8){if(_0x4f78f8){_0x30a1e5['body'][_0x1c0f('0x62')]=_0x4f78f8['id'];return db['CannedAnswer'][_0x1c0f('0x5b')](_0x30a1e5['body']);}})[_0x1c0f('0x35')](respondWithResult(_0x18c96c,null))[_0x1c0f('0x56')](handleError(_0x18c96c,null));};exports[_0x1c0f('0x6b')]=function(_0x7f8672,_0x406a0d,_0x23710c){var _0x44fc44={'raw':![],'where':{}};var _0x263d78={};var _0xfa4d2e={'count':0x0,'rows':[]};return db[_0x1c0f('0x40')][_0x1c0f('0x64')]({'where':{'id':_0x7f8672[_0x1c0f('0x57')]['id']}})[_0x1c0f('0x35')](handleEntityNotFound(_0x406a0d,null))['then'](function(_0x257d51){if(_0x257d51){_0x263d78['model']=_['keys'](db[_0x1c0f('0x6c')][_0x1c0f('0x41')]);_0x263d78['query']=_[_0x1c0f('0x58')](_0x7f8672[_0x1c0f('0x47')]);_0x263d78[_0x1c0f('0x48')]=_[_0x1c0f('0x49')](_0x263d78[_0x1c0f('0x45')],_0x263d78['query']);_0x44fc44[_0x1c0f('0x4a')]=_['intersection'](_0x263d78['model'],qs[_0x1c0f('0x4b')](_0x7f8672[_0x1c0f('0x47')][_0x1c0f('0x4b')]));_0x44fc44['attributes']=_0x44fc44[_0x1c0f('0x4a')][_0x1c0f('0x4c')]?_0x44fc44['attributes']:_0x263d78[_0x1c0f('0x45')];if(!_0x7f8672['query'][_0x1c0f('0x4d')](_0x1c0f('0x65'))){_0x44fc44[_0x1c0f('0x2b')]=qs[_0x1c0f('0x2b')](_0x7f8672[_0x1c0f('0x47')][_0x1c0f('0x2b')]);_0x44fc44[_0x1c0f('0x2a')]=qs[_0x1c0f('0x2a')](_0x7f8672[_0x1c0f('0x47')][_0x1c0f('0x2a')]);}_0x44fc44[_0x1c0f('0x66')]=qs[_0x1c0f('0x4e')](_0x7f8672['query']['sort']);_0x44fc44['where']=qs[_0x1c0f('0x48')](_[_0x1c0f('0x50')](_0x7f8672[_0x1c0f('0x47')],_0x263d78[_0x1c0f('0x48')]));_0x44fc44[_0x1c0f('0x4f')][_0x1c0f('0x62')]=_0x257d51['id'];if(_0x7f8672['query'][_0x1c0f('0x51')]){_0x44fc44['where']=_[_0x1c0f('0x52')](_0x44fc44['where'],{'$or':_[_0x1c0f('0x46')](_0x44fc44[_0x1c0f('0x4a')],function(_0x4a7b64){var _0x28efcf={};_0x28efcf[_0x4a7b64]={'$like':'%'+_0x7f8672['query'][_0x1c0f('0x51')]+'%'};return _0x28efcf;})});}_0x44fc44=_[_0x1c0f('0x52')]({},_0x44fc44,_0x7f8672[_0x1c0f('0x53')]);return db[_0x1c0f('0x6c')][_0x1c0f('0x2d')]({'where':_0x44fc44[_0x1c0f('0x4f')]})[_0x1c0f('0x35')](function(_0x3c5bd0){_0xfa4d2e['count']=_0x3c5bd0;if(_0x7f8672['query']['includeAll']){_0x44fc44[_0x1c0f('0x54')]=[{'all':!![]}];}return db[_0x1c0f('0x6c')][_0x1c0f('0x55')](_0x44fc44);})[_0x1c0f('0x35')](function(_0x3cd182){_0xfa4d2e[_0x1c0f('0x67')]=_0x3cd182;return _0xfa4d2e;});}})[_0x1c0f('0x35')](respondWithFilteredResult(_0x406a0d,_0x44fc44))[_0x1c0f('0x56')](handleError(_0x406a0d,null));};exports[_0x1c0f('0x6d')]=function(_0x126815,_0x1f8adf,_0x50be51){return db[_0x1c0f('0x40')][_0x1c0f('0x5a')]({'where':{'id':_0x126815['params']['id']}})[_0x1c0f('0x35')](handleEntityNotFound(_0x1f8adf,null))['then'](function(_0x565830){if(_0x565830){return _0x565830[_0x1c0f('0x6d')](_0x126815[_0x1c0f('0x47')]['ids']);}})[_0x1c0f('0x35')](respondWithStatusCode(_0x1f8adf,null))[_0x1c0f('0x56')](handleError(_0x1f8adf,null));};exports[_0x1c0f('0x6e')]=function(_0xb2067f,_0x5d5b67,_0x287b6d){return db['WhatsappAccount']['find']({'where':{'id':_0xb2067f[_0x1c0f('0x57')]['id']}})[_0x1c0f('0x35')](handleEntityNotFound(_0x5d5b67,null))[_0x1c0f('0x35')](function(_0x16b67c){if(_0x16b67c){return _0x16b67c['addAgents'](_0xb2067f[_0x1c0f('0x5c')][_0x1c0f('0x69')],_[_0x1c0f('0x6f')](_0xb2067f[_0x1c0f('0x5c')],['ids','id'])||{})[_0x1c0f('0x70')](function(_0x5e24ef){for(var _0x17b842=0x0;_0x17b842<_0xb2067f[_0x1c0f('0x5c')][_0x1c0f('0x69')][_0x1c0f('0x4c')];_0x17b842+=0x1){socket[_0x1c0f('0x71')]('userWhatsappAccount:save',{'UserId':Number(_0xb2067f[_0x1c0f('0x5c')][_0x1c0f('0x69')][_0x17b842]),'WhatsappAccountId':Number(_0xb2067f['params']['id'])});}return _0x5e24ef;});}})['then'](respondWithResult(_0x5d5b67,null))['catch'](handleError(_0x5d5b67,null));};exports[_0x1c0f('0x72')]=function(_0x2b9f5c,_0x4e37dd,_0x2746b3){return db[_0x1c0f('0x40')][_0x1c0f('0x5a')]({'where':{'id':_0x2b9f5c[_0x1c0f('0x57')]['id']}})[_0x1c0f('0x35')](handleEntityNotFound(_0x4e37dd,null))[_0x1c0f('0x35')](function(_0x5cefb3){if(_0x5cefb3){return _0x5cefb3[_0x1c0f('0x72')](_0x2b9f5c[_0x1c0f('0x47')][_0x1c0f('0x69')])[_0x1c0f('0x35')](function(){if(_[_0x1c0f('0x73')](_0x2b9f5c['query'][_0x1c0f('0x69')])){for(var _0x46257a=0x0;_0x46257a<_0x2b9f5c['query'][_0x1c0f('0x69')][_0x1c0f('0x4c')];_0x46257a+=0x1){socket[_0x1c0f('0x71')]('userWhatsappAccount:remove',{'UserId':Number(_0x2b9f5c['query'][_0x1c0f('0x69')][_0x46257a]),'WhatsappAccountId':Number(_0x2b9f5c['params']['id'])});}}else{socket['emit'](_0x1c0f('0x74'),{'UserId':Number(_0x2b9f5c[_0x1c0f('0x47')]['ids']),'WhatsappAccountId':Number(_0x2b9f5c[_0x1c0f('0x57')]['id'])});}});}})[_0x1c0f('0x35')](respondWithStatusCode(_0x4e37dd,null))[_0x1c0f('0x56')](handleError(_0x4e37dd,null));};exports['getAgents']=function(_0x4887ef,_0x3cfa61,_0x3332b3){var _0x2a1d68={};var _0x5bb8fd={};var _0x594c52;var _0x72e2b1;return db[_0x1c0f('0x40')][_0x1c0f('0x64')]({'where':{'id':_0x4887ef[_0x1c0f('0x57')]['id']}})[_0x1c0f('0x35')](handleEntityNotFound(_0x3cfa61,null))[_0x1c0f('0x35')](function(_0x3a1d93){if(_0x3a1d93){_0x594c52=_0x3a1d93;_0x5bb8fd[_0x1c0f('0x45')]=_['keys'](db[_0x1c0f('0x75')][_0x1c0f('0x41')]);_0x5bb8fd[_0x1c0f('0x47')]=_[_0x1c0f('0x58')](_0x4887ef['query']);_0x5bb8fd[_0x1c0f('0x48')]=_[_0x1c0f('0x49')](_0x5bb8fd[_0x1c0f('0x45')],_0x5bb8fd[_0x1c0f('0x47')]);_0x2a1d68[_0x1c0f('0x4a')]=_[_0x1c0f('0x49')](_0x5bb8fd[_0x1c0f('0x45')],qs[_0x1c0f('0x4b')](_0x4887ef[_0x1c0f('0x47')]['fields']));_0x2a1d68['attributes']=_0x2a1d68[_0x1c0f('0x4a')][_0x1c0f('0x4c')]?_0x2a1d68[_0x1c0f('0x4a')]:_0x5bb8fd[_0x1c0f('0x45')];_0x2a1d68[_0x1c0f('0x66')]=qs[_0x1c0f('0x4e')](_0x4887ef[_0x1c0f('0x47')][_0x1c0f('0x4e')]);_0x2a1d68[_0x1c0f('0x4f')]=qs[_0x1c0f('0x48')](_['pick'](_0x4887ef[_0x1c0f('0x47')],_0x5bb8fd[_0x1c0f('0x48')]));if(_0x4887ef['query'][_0x1c0f('0x51')]){_0x2a1d68[_0x1c0f('0x4f')]=_['merge'](_0x2a1d68[_0x1c0f('0x4f')],{'$or':_[_0x1c0f('0x46')](_0x2a1d68['attributes'],function(_0x5b1e48){var _0x2be68b={};_0x2be68b[_0x5b1e48]={'$like':'%'+_0x4887ef['query'][_0x1c0f('0x51')]+'%'};return _0x2be68b;})});}_0x2a1d68=_[_0x1c0f('0x52')]({},_0x2a1d68,_0x4887ef[_0x1c0f('0x53')]);return _0x594c52[_0x1c0f('0x76')](_0x2a1d68);}})[_0x1c0f('0x35')](function(_0x2b6c43){if(_0x2b6c43){_0x72e2b1=_0x2b6c43[_0x1c0f('0x4c')];if(!_0x4887ef[_0x1c0f('0x47')][_0x1c0f('0x4d')](_0x1c0f('0x65'))){_0x2a1d68[_0x1c0f('0x2b')]=qs[_0x1c0f('0x2b')](_0x4887ef[_0x1c0f('0x47')]['limit']);_0x2a1d68['offset']=qs[_0x1c0f('0x2a')](_0x4887ef[_0x1c0f('0x47')]['offset']);}return _0x594c52[_0x1c0f('0x76')](_0x2a1d68);}})['then'](function(_0x56195c){if(_0x56195c){return _0x56195c?{'count':_0x72e2b1,'rows':_0x56195c}:null;}})[_0x1c0f('0x35')](respondWithResult(_0x3cfa61,null))[_0x1c0f('0x56')](handleError(_0x3cfa61,null));};exports[_0x1c0f('0x77')]=function(_0x1c6762,_0x32fec3){var _0x48c42e=_0x1c6762[_0x1c0f('0x57')]['id'];var _0x5a7501=_0x1c6762[_0x1c0f('0x5c')];var _0x27754c=0xc8;var _0x2b970c=null;return db['sequelize'][_0x1c0f('0x78')]({'isolationLevel':db[_0x1c0f('0x79')][_0x1c0f('0x7a')][_0x1c0f('0x7b')][_0x1c0f('0x7c')]},function(_0xefa1){return db[_0x1c0f('0x40')][_0x1c0f('0x64')]({'where':{'id':_0x48c42e},'transaction':_0xefa1})['then'](function(_0x2fc0f0){if(_0x2fc0f0){return db['WhatsappApplication'][_0x1c0f('0x36')]({'where':{'WhatsappAccountId':_0x48c42e},'transaction':_0xefa1})[_0x1c0f('0x35')](function(){var _0x4f057e=_['map'](_0x5a7501,function(_0x355367){_0x355367[_0x1c0f('0x62')]=_0x48c42e;return _0x355367;});return db[_0x1c0f('0x7d')]['bulkCreate'](_0x4f057e,{'transaction':_0xefa1});});}else{_0x27754c=0x194;_0x2b970c=[];}});})[_0x1c0f('0x35')](function(){if(_0x27754c!==0x194){return db[_0x1c0f('0x7d')][_0x1c0f('0x7e')]({'where':{'WhatsappAccountId':_0x48c42e},'order':'priority'})['then'](function(_0x1a4428){_0x2b970c=_0x1a4428;});}})['catch'](function(_0x73756d){_0x27754c=0x1f4;logger['error'](_0x73756d[_0x1c0f('0x3a')]);if(_0x73756d[_0x1c0f('0x3b')]){delete _0x73756d[_0x1c0f('0x3b')];}_0x2b970c=_0x73756d;})[_0x1c0f('0x7f')](function(){if(_0x2b970c===null){_0x32fec3['sendStatus'](_0x27754c);}else{if(_0x27754c===0x1f4){_0x32fec3[_0x1c0f('0x2e')](_0x27754c)['send'](_0x2b970c);}else{_0x32fec3['status'](_0x27754c)['json'](_0x2b970c);}}});};exports[_0x1c0f('0x80')]=function(_0x1653fe,_0x4fd142,_0x4b0a37){var _0x2e4802={};var _0x2bf17e={};var _0x5e7cf1;var _0x3acbf5;return db[_0x1c0f('0x40')][_0x1c0f('0x64')]({'where':{'id':_0x1653fe[_0x1c0f('0x57')]['id']}})['then'](handleEntityNotFound(_0x4fd142,null))[_0x1c0f('0x35')](function(_0x391dca){if(_0x391dca){_0x5e7cf1=_0x391dca;_0x2bf17e[_0x1c0f('0x45')]=_[_0x1c0f('0x58')](db[_0x1c0f('0x7d')][_0x1c0f('0x41')]);_0x2bf17e[_0x1c0f('0x47')]=_[_0x1c0f('0x58')](_0x1653fe[_0x1c0f('0x47')]);_0x2bf17e[_0x1c0f('0x48')]=_[_0x1c0f('0x49')](_0x2bf17e['model'],_0x2bf17e['query']);_0x2e4802['attributes']=_[_0x1c0f('0x49')](_0x2bf17e[_0x1c0f('0x45')],qs[_0x1c0f('0x4b')](_0x1653fe[_0x1c0f('0x47')]['fields']));_0x2e4802[_0x1c0f('0x4a')]=_0x2e4802['attributes'][_0x1c0f('0x4c')]?_0x2e4802['attributes']:_0x2bf17e[_0x1c0f('0x45')];_0x2e4802['order']=qs['sort'](_0x1653fe['query'][_0x1c0f('0x4e')]);_0x2e4802['where']=qs[_0x1c0f('0x48')](_['pick'](_0x1653fe['query'],_0x2bf17e['filters']));if(_0x1653fe[_0x1c0f('0x47')]['filter']){_0x2e4802['where']=_[_0x1c0f('0x52')](_0x2e4802[_0x1c0f('0x4f')],{'$or':_[_0x1c0f('0x46')](_0x2e4802[_0x1c0f('0x4a')],function(_0x4d5354){var _0x38b279={};_0x38b279[_0x4d5354]={'$like':'%'+_0x1653fe['query'][_0x1c0f('0x51')]+'%'};return _0x38b279;})});}_0x2e4802=_[_0x1c0f('0x52')]({},_0x2e4802,_0x1653fe[_0x1c0f('0x53')]);return _0x5e7cf1[_0x1c0f('0x80')](_0x2e4802);}})[_0x1c0f('0x35')](function(_0x1db590){if(_0x1db590){_0x3acbf5=_0x1db590[_0x1c0f('0x4c')];if(!_0x1653fe[_0x1c0f('0x47')]['hasOwnProperty'](_0x1c0f('0x65'))){_0x2e4802[_0x1c0f('0x2b')]=qs['limit'](_0x1653fe[_0x1c0f('0x47')][_0x1c0f('0x2b')]);_0x2e4802[_0x1c0f('0x2a')]=qs[_0x1c0f('0x2a')](_0x1653fe[_0x1c0f('0x47')][_0x1c0f('0x2a')]);}return _0x5e7cf1[_0x1c0f('0x80')](_0x2e4802);}})[_0x1c0f('0x35')](function(_0x3a6b7e){if(_0x3a6b7e){return _0x3a6b7e?{'count':_0x3acbf5,'rows':_0x3a6b7e}:null;}})[_0x1c0f('0x35')](respondWithResult(_0x4fd142,null))[_0x1c0f('0x56')](handleError(_0x4fd142,null));};exports[_0x1c0f('0x81')]=function(_0x28d259,_0x18d50d,_0x45027e){var _0x32a124={'channel':'whatsapp'};var _0x2787df=[];var _0x2e5061=[];var _0x4842f2={};return db[_0x1c0f('0x40')][_0x1c0f('0x5a')]({'where':{'id':_0x28d259[_0x1c0f('0x57')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x1c0f('0x82')}]})[_0x1c0f('0x35')](handleEntityNotFound(_0x18d50d,null))[_0x1c0f('0x35')](function(_0x2e8e5f){_0x32a124[_0x1c0f('0x83')]=_0x2e8e5f;if(_0x32a124[_0x1c0f('0x83')]&&_0x32a124[_0x1c0f('0x83')]['type']===_0x1c0f('0x84')&&_0x28d259[_0x1c0f('0x5c')][_0x1c0f('0x85')]){if(_0x28d259[_0x1c0f('0x5c')][_0x1c0f('0x85')]['length']===0x0)return;if(_0x28d259['body']['statuses'][0x0]['state']!==_0x1c0f('0x86'))return;return db[_0x1c0f('0x87')][_0x1c0f('0x34')]({'read':!![],'readAt':_0x28d259[_0x1c0f('0x5c')][_0x1c0f('0x85')][0x0][_0x1c0f('0x88')]},{'where':{'messageId':_0x28d259[_0x1c0f('0x5c')]['statuses'][0x0][_0x1c0f('0x89')]},'individualHooks':!![]})[_0x1c0f('0x35')](function(_0x55ed57){return _0x18d50d[_0x1c0f('0x2e')](0xc8)['json'](_0x55ed57);});}_0x32a124[_0x1c0f('0x8a')]=_['orderBy'](_0x2e8e5f['Applications'],[_0x1c0f('0x8b')],['asc']);if(_0x32a124[_0x1c0f('0x83')][_0x1c0f('0x82')]){delete _0x32a124[_0x1c0f('0x83')]['Applications'];}return db[_0x1c0f('0x8c')][_0x1c0f('0x8d')]()[_0x1c0f('0x35')](function(_0x40c262){if(!_0x40c262){throw new db[(_0x1c0f('0x8e'))]['ValidationError']('no\x20available\x20attributes');}_0x2787df=_[_0x1c0f('0x8f')](_[_0x1c0f('0x58')](_0x40c262),[_0x1c0f('0x90'),_0x1c0f('0x91')]);_0x2e5061=_['difference'](_['keys'](_0x40c262),[_0x1c0f('0x90'),'updatedAt',_0x1c0f('0x92'),_0x1c0f('0x93')]);_0x32a124[_0x1c0f('0x5c')]={'mapKey':_0x1c0f('0x94')};if(_0x32a124[_0x1c0f('0x83')]&&_0x32a124[_0x1c0f('0x83')][_0x1c0f('0x43')]===_0x1c0f('0x95')){_0x32a124[_0x1c0f('0x5c')][_0x1c0f('0x96')]=_0x28d259[_0x1c0f('0x5c')][_0x1c0f('0x97')][_0x1c0f('0x98')](_0x1c0f('0x99'),'');_0x32a124[_0x1c0f('0x5c')]['body']=_0x28d259[_0x1c0f('0x5c')][_0x1c0f('0x9a')];_0x32a124[_0x1c0f('0x5c')][_0x1c0f('0x9b')]=_0x28d259[_0x1c0f('0x5c')][_0x1c0f('0x9c')];}if(_0x32a124['account']&&_0x32a124[_0x1c0f('0x83')][_0x1c0f('0x43')]==='sinch'){_0x32a124[_0x1c0f('0x5c')][_0x1c0f('0x96')]=_0x28d259[_0x1c0f('0x5c')]['notifications'][0x0]['from'];_0x32a124[_0x1c0f('0x5c')][_0x1c0f('0x5c')]=_0x28d259[_0x1c0f('0x5c')][_0x1c0f('0x9d')][0x0][_0x1c0f('0x26')][_0x1c0f('0x5c')];_0x32a124[_0x1c0f('0x5c')][_0x1c0f('0x9b')]=_0x28d259['body'][_0x1c0f('0x9d')][0x0]['message_id'];}if(_0x32a124['body']['id']){delete _0x32a124[_0x1c0f('0x5c')]['id'];}if(_[_0x1c0f('0x9e')](_0x32a124['body'][_0x1c0f('0x96')])){throw new db[(_0x1c0f('0x8e'))][(_0x1c0f('0x9f'))](_0x1c0f('0xa0'));}if(_[_0x1c0f('0x9e')](_0x32a124['body']['body'])||_0x32a124['body'][_0x1c0f('0x5c')]===''){throw new db['Sequelize'][(_0x1c0f('0x9f'))](_0x1c0f('0xa1'));}if(_[_0x1c0f('0x9e')](_0x32a124[_0x1c0f('0x5c')][_0x1c0f('0xa2')])){throw new db[(_0x1c0f('0x8e'))][(_0x1c0f('0x9f'))](_0x1c0f('0xa3')+_0x2e5061);}if(!_['includes'](_0x2e5061,_0x32a124[_0x1c0f('0x5c')][_0x1c0f('0xa2')])){throw new db[(_0x1c0f('0x8e'))][(_0x1c0f('0x9f'))](_0x1c0f('0xa4')+_0x2e5061);}_0x4842f2[_0x32a124[_0x1c0f('0x5c')][_0x1c0f('0xa2')]]=_0x32a124['body']['from'];return db[_0x1c0f('0xa5')][_0x1c0f('0x5a')]({'where':{'id':_0x32a124[_0x1c0f('0x83')]['ListId']},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x4842f2,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0x1c0f('0x35')](handleEntityNotFound(_0x18d50d,null))['then'](function(_0x4c26f4){if(_0x4c26f4){_0x32a124[_0x1c0f('0xa6')]=_[_0x1c0f('0x6f')](_0x4c26f4,['Contacts']);if(_0x4c26f4[_0x1c0f('0xa7')][_0x1c0f('0x4c')]){return _0x4c26f4[_0x1c0f('0xa7')][0x0];}var _0x4616c3=_[_0x1c0f('0x18')](_0x32a124[_0x1c0f('0x5c')],{'firstName':_0x32a124[_0x1c0f('0x5c')][_0x1c0f('0x96')],'ListId':_0x4c26f4['id']});_0x4616c3[_0x32a124[_0x1c0f('0x5c')][_0x1c0f('0xa2')]]=_0x32a124[_0x1c0f('0x5c')]['from'];return db[_0x1c0f('0x8c')][_0x1c0f('0x5b')](_0x4616c3,{'fields':_0x2787df,'raw':!![]});}})[_0x1c0f('0x35')](handleEntityNotFound(_0x18d50d,null))[_0x1c0f('0x35')](function(_0x4e5dda){if(_0x4e5dda){_0x32a124[_0x1c0f('0xa8')]=_0x4e5dda;var _0x563808={'ContactId':_0x4e5dda['id'],'phone':_0x32a124[_0x1c0f('0x5c')]['from'],'WhatsappAccountId':_0x28d259[_0x1c0f('0x57')]['id']};var _0x22191c={'ContactId':_0x4e5dda['id'],'WhatsappAccountId':_0x28d259[_0x1c0f('0x57')]['id'],'closed':![]};return db[_0x1c0f('0xa9')][_0x1c0f('0x5a')]({'where':_0x22191c})['then'](function(_0xfff2ac){if(_0xfff2ac){return[_0xfff2ac,![]];}return db['WhatsappInteraction'][_0x1c0f('0x5b')](_0x563808)[_0x1c0f('0x35')](function(_0x278d3b){return[_0x278d3b,!![]];});});}})[_0x1c0f('0x70')](function(_0x27fd18,_0xea076e){_0x32a124[_0x1c0f('0xaa')]=_0x27fd18['get']({'plain':!![]});_0x32a124[_0x1c0f('0xaa')][_0x1c0f('0xab')]=![];if(_0xea076e){if(_0x32a124['account'][_0x1c0f('0xac')]){_0x32a124['applications'][_0x1c0f('0xad')]({'id':0x0,'priority':_0x32a124[_0x1c0f('0x8a')][_0x1c0f('0x4c')]+0x1,'app':_0x1c0f('0xae'),'appdata':_0x1c0f('0xaf'),'interval':'*,*,*,*'});}_0x32a124[_0x1c0f('0xaa')]['created']=!![];}return db['WhatsappMessage'][_0x1c0f('0x5b')]({'phone':_0x32a124['body']['from'],'messageId':_0x32a124['body'][_0x1c0f('0x9b')],'body':_0x32a124[_0x1c0f('0x5c')][_0x1c0f('0x5c')],'WhatsappAccountId':_0x28d259[_0x1c0f('0x57')]['id'],'WhatsappInteractionId':_0x27fd18['id'],'direction':'in','ContactId':_0x27fd18['ContactId'],'AttachmentId':_0x32a124[_0x1c0f('0x5c')][_0x1c0f('0xb0')]});})['then'](function(_0x5a935c){_0x32a124[_0x1c0f('0x26')]=_0x5a935c;if(_0x32a124[_0x1c0f('0xaa')]['UserId']){return db['User'][_0x1c0f('0x5a')]({'attributes':['id',_0x1c0f('0x3b')],'where':{'id':_0x32a124[_0x1c0f('0xaa')][_0x1c0f('0xb1')]}})[_0x1c0f('0x35')](function(_0x4ba42e){if(_0x4ba42e){_0x32a124[_0x1c0f('0x8a')][_0x1c0f('0xb2')]({'id':0x0,'priority':0x0,'app':_0x1c0f('0xb3'),'appdata':_0x4ba42e[_0x1c0f('0x3b')]+','+(_0x32a124['account']['waitForTheAssignedAgent']||0xa),'interval':_0x1c0f('0xb4')});}return respondWithRpcPromise('Start','startRouting',_0x32a124);});}return respondWithRpcPromise(_0x1c0f('0xb5'),_0x1c0f('0xb6'),_0x32a124);})[_0x1c0f('0x35')](function(_0x517f7c){if(_0x517f7c){var _0x549db9=0xc8;var _0x35f98f=_0x1c0f('0xb7');logger['info'](_0x1c0f('0x22'),_0x35f98f,_0x549db9,'entity\x20found');logger[_0x1c0f('0x21')](_0x1c0f('0xb8'),_0x35f98f,_0x549db9,'entity\x20found',JSON[_0x1c0f('0x24')](_0x517f7c));if(_0x32a124['account'][_0x1c0f('0x43')]==='twilio'){return _0x18d50d[_0x1c0f('0x2e')](_0x549db9)['set'](_0x1c0f('0xb9'),_0x1c0f('0xba'))[_0x1c0f('0x3c')]('\x0a');}else{return _0x18d50d[_0x1c0f('0x2e')](_0x549db9)[_0x1c0f('0xbb')](_0x517f7c);}}});})[_0x1c0f('0x56')](handleError(_0x18d50d,null));};exports[_0x1c0f('0x3c')]=function(_0x5f3984,_0x5df9b1,_0x348dd2){var _0x1e1a0b,_0x559a27,_0x5760f9;if(_[_0x1c0f('0x9e')](_0x5f3984[_0x1c0f('0x5c')][_0x1c0f('0x5c')])||_0x5f3984[_0x1c0f('0x5c')][_0x1c0f('0x5c')]===''){throw new db[(_0x1c0f('0x8e'))][(_0x1c0f('0x9f'))](_0x1c0f('0xa1'));}if(_[_0x1c0f('0x9e')](_0x5f3984[_0x1c0f('0x5c')]['to'])){throw new db[(_0x1c0f('0x8e'))][(_0x1c0f('0x9f'))](_0x1c0f('0xbc'));}_0x1e1a0b=_0x5f3984[_0x1c0f('0x5c')]['to'];return db[_0x1c0f('0x40')][_0x1c0f('0x5a')]({'where':{'id':_0x5f3984['params']['id']},'include':[{'model':db[_0x1c0f('0xa5')],'as':'List','include':[{'model':db['CmContact'],'as':_0x1c0f('0xa7'),'where':{'mobile':_0x1e1a0b},'limit':0x1,'order':[[_0x1c0f('0x91'),_0x1c0f('0xbd')]]}]}]})[_0x1c0f('0x35')](handleEntityNotFound(_0x5df9b1,null))['then'](function(_0x833b74){if(_0x833b74&&_0x833b74['List']){_0x559a27=_0x833b74[_0x1c0f('0x37')]({'plain':!![]});if(_0x559a27[_0x1c0f('0xbe')]&&_0x559a27[_0x1c0f('0xbe')][_0x1c0f('0xa7')][_0x1c0f('0x4c')]){return _0x559a27[_0x1c0f('0xbe')]['Contacts'][0x0];}return db[_0x1c0f('0x8c')][_0x1c0f('0x5b')](_[_0x1c0f('0x18')](_0x5f3984[_0x1c0f('0x5c')],{'firstName':_0x1e1a0b,'mobile':_0x1e1a0b,'phone':_0x1e1a0b,'ListId':_0x559a27[_0x1c0f('0x93')]}));}})[_0x1c0f('0x35')](handleEntityNotFound(_0x5df9b1,null))[_0x1c0f('0x35')](function(_0x23bd5a){if(_0x23bd5a){_0x5760f9=_0x23bd5a;return db[_0x1c0f('0xa9')][_0x1c0f('0x5a')]({'where':{'ContactId':_0x5760f9['id'],'closed':![],'WhatsappAccountId':_0x559a27['id']}})['then'](function(_0x4e96ea){if(_0x4e96ea){return[_0x4e96ea,![]];}return db['WhatsappInteraction'][_0x1c0f('0x5b')]({'UserId':_0x5f3984[_0x1c0f('0x5f')]['id'],'ContactId':_0x5760f9['id'],'WhatsappAccountId':_0x559a27['id'],'phone':_0x1e1a0b,'firstMsgDirection':_0x1c0f('0xbf'),'Messages':[_[_0x1c0f('0x52')](_0x5f3984[_0x1c0f('0x5c')],{'read':![],'body':_0x5f3984['body'][_0x1c0f('0x5c')],'phone':_0x1e1a0b,'WhatsappAccountId':_0x559a27['id'],'UserId':_0x5f3984[_0x1c0f('0x5f')]['id'],'ContactId':_0x5760f9['id']})]},{'include':[{'model':db[_0x1c0f('0x87')],'as':_0x1c0f('0xc0')}]})[_0x1c0f('0x35')](function(_0x5b1917){return[_0x5b1917,!![]];});});}})[_0x1c0f('0x70')](function(_0x2b77d5,_0x14164d){if(_0x14164d){return _0x2b77d5;}return db['WhatsappMessage'][_0x1c0f('0x5b')](_[_0x1c0f('0x52')](_0x5f3984['body'],{'read':![],'body':_0x5f3984[_0x1c0f('0x5c')][_0x1c0f('0x5c')],'phone':_0x1e1a0b,'WhatsappAccountId':_0x559a27['id'],'WhatsappInteractionId':_0x2b77d5['id'],'UserId':_0x5f3984['user']['id'],'ContactId':_0x5760f9['id']}))[_0x1c0f('0x35')](function(_0x426f83){_0x2b77d5[_0x1c0f('0xc1')][_0x1c0f('0xc0')]=[];_0x2b77d5['dataValues'][_0x1c0f('0xc0')][_0x1c0f('0xad')](_0x426f83[_0x1c0f('0xc1')]);return _0x2b77d5;});})[_0x1c0f('0x35')](respondWithResult(_0x5df9b1,null))[_0x1c0f('0x56')](handleError(_0x5df9b1,null));}; \ No newline at end of file +var _0xdb69=['transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','destroy','bulkCreate','priority','getApplications','whatsapp','Applications','account','statuses','state','read','WhatsappMessage','applications','orderBy','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','twilio','from','From','replace','whatsapp:','Body','messageId','sinch','notifications','message_id','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','list','defaults','contact','WhatsappInteraction','interaction','created','autoclose','push','*,*,*,*','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','Start','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','DESC','out','Messages','spread','dataValues','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/license/util','../../mysqldb','redis','localhost','jayson/promise','client','http','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','WhatsappAccount,\x20%s,\x20%s','info','catch','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','then','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','fieldName','type','model','map','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','WhatsappAccount','includeAll','include','findAll','rows','show','mandatoryDispositionPause','rawAttributes','fields','options','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','find','params','Pause','describe','WhatsappAccountId','Disposition','getDispositions','findOne','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize'];(function(_0x4509c3,_0x7a5ac8){var _0x44012e=function(_0x577412){while(--_0x577412){_0x4509c3['push'](_0x4509c3['shift']());}};_0x44012e(++_0x7a5ac8);}(_0xdb69,0x1ca));var _0x9db6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdb69[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9db6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9db6('0x1'));var rp=require(_0x9db6('0x2'));var moment=require(_0x9db6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9db6('0x4'));var util=require(_0x9db6('0x5'));var path=require(_0x9db6('0x6'));var sox=require(_0x9db6('0x7'));var csv=require(_0x9db6('0x8'));var ejs=require(_0x9db6('0x9'));var fs=require('fs');var fs_extra=require(_0x9db6('0xa'));var _=require('lodash');var squel=require(_0x9db6('0xb'));var crypto=require(_0x9db6('0xc'));var jsforce=require(_0x9db6('0xd'));var deskjs=require(_0x9db6('0xe'));var toCsv=require(_0x9db6('0x8'));var querystring=require(_0x9db6('0xf'));var Papa=require('papaparse');var Redis=require(_0x9db6('0x10'));var authService=require(_0x9db6('0x11'));var qs=require(_0x9db6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9db6('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9db6('0x14'));var db=require(_0x9db6('0x15'))['db'];config[_0x9db6('0x16')]=_['defaults'](config[_0x9db6('0x16')],{'host':_0x9db6('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9db6('0x16')]));require('./whatsappAccount.socket')['register'](socket);var jayson=require(_0x9db6('0x18'));var client=jayson[_0x9db6('0x19')][_0x9db6('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0xdb2322,_0x353f64,_0x34aaec,_0x4de1df){return new BPromise(function(_0x2cb979,_0x4bc005){var _0x5f0793=_0x4de1df||client;return _0x5f0793['request'](_0xdb2322,_0x34aaec)['then'](function(_0x4357e6){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x353f64,_0x9db6('0x1b'));logger[_0x9db6('0x1c')](_0x9db6('0x1d'),_0x353f64,_0x9db6('0x1b'),JSON[_0x9db6('0x1e')](_0x4357e6));if(_0x4357e6['error']){if(_0x4357e6[_0x9db6('0x1f')]['code']===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x353f64,_0x4357e6[_0x9db6('0x1f')][_0x9db6('0x20')]);return _0x4bc005(_0x4357e6[_0x9db6('0x1f')][_0x9db6('0x20')]);}logger['error'](_0x9db6('0x21'),_0x353f64,_0x4357e6[_0x9db6('0x1f')][_0x9db6('0x20')]);return _0x2cb979(_0x4357e6['error']['message']);}else{logger[_0x9db6('0x22')](_0x9db6('0x21'),_0x353f64,'request\x20sent');_0x2cb979(_0x4357e6['result'][_0x9db6('0x20')]);}})[_0x9db6('0x23')](function(_0x8f5dc6){logger['error'](_0x9db6('0x21'),_0x353f64,_0x8f5dc6);_0x4bc005(_0x8f5dc6);});});}function respondWithStatusCode(_0x45d23a,_0xdd5e7a){_0xdd5e7a=_0xdd5e7a||0xcc;return function(_0x297f2e){if(_0x297f2e){return _0x45d23a[_0x9db6('0x24')](_0xdd5e7a);}return _0x45d23a[_0x9db6('0x25')](_0xdd5e7a)[_0x9db6('0x26')]();};}function respondWithResult(_0x44be99,_0x355540){_0x355540=_0x355540||0xc8;return function(_0x3cb64a){if(_0x3cb64a){return _0x44be99['status'](_0x355540)[_0x9db6('0x27')](_0x3cb64a);}};}function respondWithFilteredResult(_0xea2f94,_0x5867d7){return function(_0x43f204){if(_0x43f204){var _0x1c888d=typeof _0x5867d7[_0x9db6('0x28')]===_0x9db6('0x29')&&typeof _0x5867d7[_0x9db6('0x2a')]===_0x9db6('0x29');var _0x13b323=_0x43f204[_0x9db6('0x2b')];var _0x3ba393=_0x1c888d?0x0:_0x5867d7[_0x9db6('0x28')];var _0x47bdeb=_0x1c888d?_0x43f204[_0x9db6('0x2b')]:_0x5867d7['offset']+_0x5867d7[_0x9db6('0x2a')];var _0x44977e;if(_0x47bdeb>=_0x13b323){_0x47bdeb=_0x13b323;_0x44977e=0xc8;}else{_0x44977e=0xce;}_0xea2f94['status'](_0x44977e);return _0xea2f94['set']('Content-Range',_0x3ba393+'-'+_0x47bdeb+'/'+_0x13b323)[_0x9db6('0x27')](_0x43f204);}return null;};}function patchUpdates(_0x45f203){return function(_0x215548){try{jsonpatch[_0x9db6('0x2c')](_0x215548,_0x45f203,!![]);}catch(_0x53f1a7){return BPromise[_0x9db6('0x2d')](_0x53f1a7);}return _0x215548[_0x9db6('0x2e')]();};}function saveUpdates(_0x43344c,_0x4761f3){return function(_0x4cd663){if(_0x4cd663){return _0x4cd663['update'](_0x43344c)[_0x9db6('0x2f')](function(_0x3de71a){return _0x3de71a;});}return null;};}function removeEntity(_0x79df5b,_0x5d2877){return function(_0x5aa2fa){if(_0x5aa2fa){return _0x5aa2fa['destroy']()[_0x9db6('0x2f')](function(){var _0x2799ac=_0x5aa2fa[_0x9db6('0x30')]({'plain':!![]});var _0x6429eb=_0x9db6('0x31');return db[_0x9db6('0x32')]['destroy']({'where':{'type':_0x6429eb,'resourceId':_0x2799ac['id']}})[_0x9db6('0x2f')](function(){return _0x5aa2fa;});})[_0x9db6('0x2f')](function(){_0x79df5b[_0x9db6('0x25')](0xcc)[_0x9db6('0x26')]();});}};}function handleEntityNotFound(_0x1ba795,_0xe368ae){return function(_0x444440){if(!_0x444440){_0x1ba795[_0x9db6('0x24')](0x194);}return _0x444440;};}function handleError(_0xfb2d26,_0x597f48){_0x597f48=_0x597f48||0x1f4;return function(_0x4a03e2){logger['error'](_0x4a03e2[_0x9db6('0x33')]);if(_0x4a03e2[_0x9db6('0x34')]){delete _0x4a03e2[_0x9db6('0x34')];}_0xfb2d26['status'](_0x597f48)[_0x9db6('0x35')](_0x4a03e2);};}exports[_0x9db6('0x36')]=function(_0x10579c,_0xa14b29){var _0xfe8776={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2002e4={},_0x545c9d={'count':0x0,'rows':[]};var _0x126daa=_['map'](db['WhatsappAccount']['rawAttributes'],function(_0x50b21a){return{'name':_0x50b21a[_0x9db6('0x37')],'type':_0x50b21a[_0x9db6('0x38')]['key']};});_0x2002e4[_0x9db6('0x39')]=_[_0x9db6('0x3a')](_0x126daa,_0x9db6('0x34'));_0x2002e4[_0x9db6('0x3b')]=_[_0x9db6('0x3c')](_0x10579c[_0x9db6('0x3b')]);_0x2002e4['filters']=_[_0x9db6('0x3d')](_0x2002e4[_0x9db6('0x39')],_0x2002e4[_0x9db6('0x3b')]);_0xfe8776['attributes']=_[_0x9db6('0x3d')](_0x2002e4['model'],qs['fields'](_0x10579c[_0x9db6('0x3b')]['fields']));_0xfe8776['attributes']=_0xfe8776[_0x9db6('0x3e')][_0x9db6('0x3f')]?_0xfe8776[_0x9db6('0x3e')]:_0x2002e4['model'];if(!_0x10579c[_0x9db6('0x3b')][_0x9db6('0x40')](_0x9db6('0x41'))){_0xfe8776[_0x9db6('0x2a')]=qs[_0x9db6('0x2a')](_0x10579c[_0x9db6('0x3b')][_0x9db6('0x2a')]);_0xfe8776[_0x9db6('0x28')]=qs['offset'](_0x10579c[_0x9db6('0x3b')][_0x9db6('0x28')]);}_0xfe8776[_0x9db6('0x42')]=qs[_0x9db6('0x43')](_0x10579c[_0x9db6('0x3b')][_0x9db6('0x43')]);_0xfe8776['where']=qs[_0x9db6('0x44')](_[_0x9db6('0x45')](_0x10579c[_0x9db6('0x3b')],_0x2002e4[_0x9db6('0x44')]),_0x126daa);if(_0x10579c[_0x9db6('0x3b')][_0x9db6('0x46')]){_0xfe8776[_0x9db6('0x47')]=_[_0x9db6('0x48')](_0xfe8776[_0x9db6('0x47')],{'$or':_[_0x9db6('0x3a')](_0x126daa,function(_0x10b18c){if(_0x10b18c['type']!==_0x9db6('0x49')){var _0x3c5445={};_0x3c5445[_0x10b18c[_0x9db6('0x34')]]={'$like':'%'+_0x10579c[_0x9db6('0x3b')][_0x9db6('0x46')]+'%'};return _0x3c5445;}})});}_0xfe8776=_[_0x9db6('0x48')]({},_0xfe8776,_0x10579c['options']);var _0xeaddd9={'where':_0xfe8776['where']};return db[_0x9db6('0x4a')][_0x9db6('0x2b')](_0xeaddd9)[_0x9db6('0x2f')](function(_0x4a8523){_0x545c9d[_0x9db6('0x2b')]=_0x4a8523;if(_0x10579c['query'][_0x9db6('0x4b')]){_0xfe8776[_0x9db6('0x4c')]=[{'all':!![]}];}return db[_0x9db6('0x4a')][_0x9db6('0x4d')](_0xfe8776);})['then'](function(_0x90278e){_0x545c9d[_0x9db6('0x4e')]=_0x90278e;return _0x545c9d;})[_0x9db6('0x2f')](respondWithFilteredResult(_0xa14b29,_0xfe8776))[_0x9db6('0x23')](handleError(_0xa14b29,null));};exports[_0x9db6('0x4f')]=function(_0x4cce6a,_0x27fa56){var _0x28c558={'raw':![],'where':{'id':_0x4cce6a['params']['id']},'include':[{'model':db['Pause'],'as':_0x9db6('0x50')}]},_0xee1c29={};_0xee1c29[_0x9db6('0x39')]=_[_0x9db6('0x3c')](db[_0x9db6('0x4a')][_0x9db6('0x51')]);_0xee1c29[_0x9db6('0x3b')]=_[_0x9db6('0x3c')](_0x4cce6a[_0x9db6('0x3b')]);_0xee1c29['filters']=_['intersection'](_0xee1c29[_0x9db6('0x39')],_0xee1c29[_0x9db6('0x3b')]);_0x28c558[_0x9db6('0x3e')]=_[_0x9db6('0x3d')](_0xee1c29[_0x9db6('0x39')],qs[_0x9db6('0x52')](_0x4cce6a['query'][_0x9db6('0x52')]));_0x28c558[_0x9db6('0x3e')]=_0x28c558[_0x9db6('0x3e')][_0x9db6('0x3f')]?_0x28c558[_0x9db6('0x3e')]:_0xee1c29[_0x9db6('0x39')];if(_0x4cce6a['query'][_0x9db6('0x4b')]){_0x28c558[_0x9db6('0x4c')]=[{'all':!![]}];}_0x28c558=_[_0x9db6('0x48')]({},_0x28c558,_0x4cce6a[_0x9db6('0x53')]);return db[_0x9db6('0x4a')]['find'](_0x28c558)[_0x9db6('0x2f')](handleEntityNotFound(_0x27fa56,null))[_0x9db6('0x2f')](respondWithResult(_0x27fa56,null))[_0x9db6('0x23')](handleError(_0x27fa56,null));};exports['create']=function(_0x29ab17,_0x238fee){return db[_0x9db6('0x4a')][_0x9db6('0x54')](_0x29ab17['body'],{})[_0x9db6('0x2f')](function(_0x5c0de2){var _0x38bcf8=_0x29ab17['user'][_0x9db6('0x30')]({'plain':!![]});if(!_0x38bcf8)throw new Error(_0x9db6('0x55'));if(_0x38bcf8[_0x9db6('0x56')]===_0x9db6('0x57')){var _0x533717=_0x5c0de2[_0x9db6('0x30')]({'plain':!![]});var _0x1e18fe=_0x9db6('0x31');return db['UserProfileSection']['find']({'where':{'name':_0x1e18fe,'userProfileId':_0x38bcf8[_0x9db6('0x58')]},'raw':!![]})['then'](function(_0x40453d){if(_0x40453d&&_0x40453d[_0x9db6('0x59')]===0x0){return db[_0x9db6('0x32')]['create']({'name':_0x533717[_0x9db6('0x34')],'resourceId':_0x533717['id'],'type':_0x40453d[_0x9db6('0x34')],'sectionId':_0x40453d['id']},{})[_0x9db6('0x2f')](function(){return _0x5c0de2;});}else{return _0x5c0de2;}})['catch'](function(_0x5e5ec1){logger[_0x9db6('0x1f')](_0x9db6('0x5a'),_0x5e5ec1);throw _0x5e5ec1;});}return _0x5c0de2;})[_0x9db6('0x2f')](respondWithResult(_0x238fee,0xc9))[_0x9db6('0x23')](handleError(_0x238fee,null));};exports[_0x9db6('0x5b')]=function(_0x33d326,_0x5861b8){if(_0x33d326[_0x9db6('0x5c')]['id']){delete _0x33d326['body']['id'];}return db['WhatsappAccount'][_0x9db6('0x5d')]({'where':{'id':_0x33d326[_0x9db6('0x5e')]['id']},'include':[{'model':db[_0x9db6('0x5f')],'as':_0x9db6('0x50')}]})['then'](handleEntityNotFound(_0x5861b8,null))['then'](saveUpdates(_0x33d326[_0x9db6('0x5c')],null))['then'](respondWithResult(_0x5861b8,null))[_0x9db6('0x23')](handleError(_0x5861b8,null));};exports['destroy']=function(_0xb55f38,_0x4875b0){return db[_0x9db6('0x4a')][_0x9db6('0x5d')]({'where':{'id':_0xb55f38['params']['id']}})['then'](handleEntityNotFound(_0x4875b0,null))[_0x9db6('0x2f')](removeEntity(_0x4875b0,null))[_0x9db6('0x23')](handleError(_0x4875b0,null));};exports[_0x9db6('0x60')]=function(_0x15db41,_0x43c5e9){return db[_0x9db6('0x4a')][_0x9db6('0x60')]()[_0x9db6('0x2f')](respondWithResult(_0x43c5e9,null))[_0x9db6('0x23')](handleError(_0x43c5e9,null));};exports['addDisposition']=function(_0x3d6bac,_0x14a4a4,_0x59b204){if(_0x3d6bac['body']['id']){delete _0x3d6bac[_0x9db6('0x5c')]['id'];}return db[_0x9db6('0x4a')][_0x9db6('0x5d')]({'where':{'id':_0x3d6bac['params']['id']}})['then'](handleEntityNotFound(_0x14a4a4,null))[_0x9db6('0x2f')](function(_0x1fb7c0){if(_0x1fb7c0){_0x3d6bac[_0x9db6('0x5c')][_0x9db6('0x61')]=_0x1fb7c0['id'];return db[_0x9db6('0x62')][_0x9db6('0x54')](_0x3d6bac[_0x9db6('0x5c')]);}})[_0x9db6('0x2f')](respondWithResult(_0x14a4a4,null))[_0x9db6('0x23')](handleError(_0x14a4a4,null));};exports[_0x9db6('0x63')]=function(_0x5bb04e,_0x94b06a,_0x1c64e9){var _0xae2e3={'raw':![],'where':{}};var _0x281288={};var _0x3cc466={'count':0x0,'rows':[]};return db[_0x9db6('0x4a')][_0x9db6('0x64')]({'where':{'id':_0x5bb04e[_0x9db6('0x5e')]['id']}})[_0x9db6('0x2f')](handleEntityNotFound(_0x94b06a,null))[_0x9db6('0x2f')](function(_0x4439df){if(_0x4439df){_0x281288[_0x9db6('0x39')]=_[_0x9db6('0x3c')](db['Disposition'][_0x9db6('0x51')]);_0x281288[_0x9db6('0x3b')]=_[_0x9db6('0x3c')](_0x5bb04e[_0x9db6('0x3b')]);_0x281288['filters']=_[_0x9db6('0x3d')](_0x281288[_0x9db6('0x39')],_0x281288['query']);_0xae2e3[_0x9db6('0x3e')]=_[_0x9db6('0x3d')](_0x281288[_0x9db6('0x39')],qs['fields'](_0x5bb04e[_0x9db6('0x3b')][_0x9db6('0x52')]));_0xae2e3[_0x9db6('0x3e')]=_0xae2e3[_0x9db6('0x3e')][_0x9db6('0x3f')]?_0xae2e3['attributes']:_0x281288['model'];if(!_0x5bb04e[_0x9db6('0x3b')][_0x9db6('0x40')]('nolimit')){_0xae2e3[_0x9db6('0x2a')]=qs[_0x9db6('0x2a')](_0x5bb04e[_0x9db6('0x3b')][_0x9db6('0x2a')]);_0xae2e3[_0x9db6('0x28')]=qs[_0x9db6('0x28')](_0x5bb04e['query']['offset']);}_0xae2e3[_0x9db6('0x42')]=qs[_0x9db6('0x43')](_0x5bb04e[_0x9db6('0x3b')][_0x9db6('0x43')]);_0xae2e3[_0x9db6('0x47')]=qs[_0x9db6('0x44')](_[_0x9db6('0x45')](_0x5bb04e[_0x9db6('0x3b')],_0x281288[_0x9db6('0x44')]));_0xae2e3[_0x9db6('0x47')][_0x9db6('0x61')]=_0x4439df['id'];if(_0x5bb04e['query']['filter']){_0xae2e3['where']=_['merge'](_0xae2e3[_0x9db6('0x47')],{'$or':_[_0x9db6('0x3a')](_0xae2e3[_0x9db6('0x3e')],function(_0x2f1105){var _0x44d2b5={};_0x44d2b5[_0x2f1105]={'$like':'%'+_0x5bb04e[_0x9db6('0x3b')][_0x9db6('0x46')]+'%'};return _0x44d2b5;})});}_0xae2e3=_['merge']({},_0xae2e3,_0x5bb04e['options']);return db['Disposition'][_0x9db6('0x2b')]({'where':_0xae2e3[_0x9db6('0x47')]})['then'](function(_0x4b9bcf){_0x3cc466[_0x9db6('0x2b')]=_0x4b9bcf;if(_0x5bb04e[_0x9db6('0x3b')][_0x9db6('0x4b')]){_0xae2e3[_0x9db6('0x4c')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0xae2e3);})['then'](function(_0x3764f6){_0x3cc466[_0x9db6('0x4e')]=_0x3764f6;return _0x3cc466;});}})[_0x9db6('0x2f')](respondWithFilteredResult(_0x94b06a,_0xae2e3))[_0x9db6('0x23')](handleError(_0x94b06a,null));};exports['removeDispositions']=function(_0x4b71c0,_0x31ebf4,_0x4f5451){return db[_0x9db6('0x4a')]['find']({'where':{'id':_0x4b71c0[_0x9db6('0x5e')]['id']}})[_0x9db6('0x2f')](handleEntityNotFound(_0x31ebf4,null))[_0x9db6('0x2f')](function(_0x3c5387){if(_0x3c5387){return _0x3c5387['removeDispositions'](_0x4b71c0[_0x9db6('0x3b')][_0x9db6('0x65')]);}})[_0x9db6('0x2f')](respondWithStatusCode(_0x31ebf4,null))['catch'](handleError(_0x31ebf4,null));};exports[_0x9db6('0x66')]=function(_0x32835e,_0x2fc177,_0x13f7e5){if(_0x32835e[_0x9db6('0x5c')]['id']){delete _0x32835e[_0x9db6('0x5c')]['id'];}return db['WhatsappAccount'][_0x9db6('0x5d')]({'where':{'id':_0x32835e[_0x9db6('0x5e')]['id']}})[_0x9db6('0x2f')](handleEntityNotFound(_0x2fc177,null))[_0x9db6('0x2f')](function(_0x453626){if(_0x453626){_0x32835e[_0x9db6('0x5c')][_0x9db6('0x61')]=_0x453626['id'];return db[_0x9db6('0x67')][_0x9db6('0x54')](_0x32835e[_0x9db6('0x5c')]);}})[_0x9db6('0x2f')](respondWithResult(_0x2fc177,null))['catch'](handleError(_0x2fc177,null));};exports[_0x9db6('0x68')]=function(_0x3be6b0,_0x5a2dd4,_0x51e21d){var _0x4286d4={'raw':![],'where':{}};var _0x1c9f74={};var _0x5c5e7d={'count':0x0,'rows':[]};return db[_0x9db6('0x4a')][_0x9db6('0x64')]({'where':{'id':_0x3be6b0[_0x9db6('0x5e')]['id']}})[_0x9db6('0x2f')](handleEntityNotFound(_0x5a2dd4,null))[_0x9db6('0x2f')](function(_0x12eb1e){if(_0x12eb1e){_0x1c9f74['model']=_[_0x9db6('0x3c')](db['CannedAnswer'][_0x9db6('0x51')]);_0x1c9f74['query']=_[_0x9db6('0x3c')](_0x3be6b0[_0x9db6('0x3b')]);_0x1c9f74[_0x9db6('0x44')]=_[_0x9db6('0x3d')](_0x1c9f74[_0x9db6('0x39')],_0x1c9f74[_0x9db6('0x3b')]);_0x4286d4[_0x9db6('0x3e')]=_[_0x9db6('0x3d')](_0x1c9f74[_0x9db6('0x39')],qs[_0x9db6('0x52')](_0x3be6b0[_0x9db6('0x3b')]['fields']));_0x4286d4[_0x9db6('0x3e')]=_0x4286d4['attributes'][_0x9db6('0x3f')]?_0x4286d4[_0x9db6('0x3e')]:_0x1c9f74[_0x9db6('0x39')];if(!_0x3be6b0[_0x9db6('0x3b')][_0x9db6('0x40')](_0x9db6('0x41'))){_0x4286d4[_0x9db6('0x2a')]=qs[_0x9db6('0x2a')](_0x3be6b0['query']['limit']);_0x4286d4[_0x9db6('0x28')]=qs[_0x9db6('0x28')](_0x3be6b0[_0x9db6('0x3b')][_0x9db6('0x28')]);}_0x4286d4[_0x9db6('0x42')]=qs['sort'](_0x3be6b0[_0x9db6('0x3b')][_0x9db6('0x43')]);_0x4286d4[_0x9db6('0x47')]=qs['filters'](_[_0x9db6('0x45')](_0x3be6b0[_0x9db6('0x3b')],_0x1c9f74['filters']));_0x4286d4[_0x9db6('0x47')][_0x9db6('0x61')]=_0x12eb1e['id'];if(_0x3be6b0[_0x9db6('0x3b')][_0x9db6('0x46')]){_0x4286d4[_0x9db6('0x47')]=_['merge'](_0x4286d4['where'],{'$or':_[_0x9db6('0x3a')](_0x4286d4[_0x9db6('0x3e')],function(_0x2da926){var _0x1d7ec5={};_0x1d7ec5[_0x2da926]={'$like':'%'+_0x3be6b0['query']['filter']+'%'};return _0x1d7ec5;})});}_0x4286d4=_['merge']({},_0x4286d4,_0x3be6b0['options']);return db[_0x9db6('0x67')][_0x9db6('0x2b')]({'where':_0x4286d4[_0x9db6('0x47')]})[_0x9db6('0x2f')](function(_0x1fefad){_0x5c5e7d[_0x9db6('0x2b')]=_0x1fefad;if(_0x3be6b0[_0x9db6('0x3b')][_0x9db6('0x4b')]){_0x4286d4[_0x9db6('0x4c')]=[{'all':!![]}];}return db[_0x9db6('0x67')][_0x9db6('0x4d')](_0x4286d4);})[_0x9db6('0x2f')](function(_0x5c1e71){_0x5c5e7d[_0x9db6('0x4e')]=_0x5c1e71;return _0x5c5e7d;});}})['then'](respondWithFilteredResult(_0x5a2dd4,_0x4286d4))[_0x9db6('0x23')](handleError(_0x5a2dd4,null));};exports[_0x9db6('0x69')]=function(_0x254d2c,_0x5b6ca8,_0x1351a7){return db[_0x9db6('0x4a')][_0x9db6('0x5d')]({'where':{'id':_0x254d2c[_0x9db6('0x5e')]['id']}})[_0x9db6('0x2f')](handleEntityNotFound(_0x5b6ca8,null))[_0x9db6('0x2f')](function(_0x156280){if(_0x156280){return _0x156280[_0x9db6('0x69')](_0x254d2c[_0x9db6('0x3b')][_0x9db6('0x65')]);}})[_0x9db6('0x2f')](respondWithStatusCode(_0x5b6ca8,null))['catch'](handleError(_0x5b6ca8,null));};exports[_0x9db6('0x6a')]=function(_0x51ea5d,_0x31de8d,_0x19c1de){return db[_0x9db6('0x4a')][_0x9db6('0x5d')]({'where':{'id':_0x51ea5d['params']['id']}})[_0x9db6('0x2f')](handleEntityNotFound(_0x31de8d,null))[_0x9db6('0x2f')](function(_0x58af56){if(_0x58af56){return _0x58af56[_0x9db6('0x6a')](_0x51ea5d[_0x9db6('0x5c')][_0x9db6('0x65')],_[_0x9db6('0x6b')](_0x51ea5d[_0x9db6('0x5c')],[_0x9db6('0x65'),'id'])||{})['spread'](function(_0x38866a){for(var _0x30c064=0x0;_0x30c064<_0x51ea5d[_0x9db6('0x5c')][_0x9db6('0x65')]['length'];_0x30c064+=0x1){socket[_0x9db6('0x6c')]('userWhatsappAccount:save',{'UserId':Number(_0x51ea5d[_0x9db6('0x5c')][_0x9db6('0x65')][_0x30c064]),'WhatsappAccountId':Number(_0x51ea5d[_0x9db6('0x5e')]['id'])});}return _0x38866a;});}})[_0x9db6('0x2f')](respondWithResult(_0x31de8d,null))[_0x9db6('0x23')](handleError(_0x31de8d,null));};exports[_0x9db6('0x6d')]=function(_0x120060,_0x1c69e9,_0x5c2ecf){return db[_0x9db6('0x4a')][_0x9db6('0x5d')]({'where':{'id':_0x120060[_0x9db6('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1c69e9,null))[_0x9db6('0x2f')](function(_0x245618){if(_0x245618){return _0x245618[_0x9db6('0x6d')](_0x120060['query'][_0x9db6('0x65')])[_0x9db6('0x2f')](function(){if(_[_0x9db6('0x6e')](_0x120060[_0x9db6('0x3b')][_0x9db6('0x65')])){for(var _0x157eb9=0x0;_0x157eb9<_0x120060['query'][_0x9db6('0x65')][_0x9db6('0x3f')];_0x157eb9+=0x1){socket[_0x9db6('0x6c')](_0x9db6('0x6f'),{'UserId':Number(_0x120060[_0x9db6('0x3b')][_0x9db6('0x65')][_0x157eb9]),'WhatsappAccountId':Number(_0x120060['params']['id'])});}}else{socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x120060[_0x9db6('0x3b')][_0x9db6('0x65')]),'WhatsappAccountId':Number(_0x120060[_0x9db6('0x5e')]['id'])});}});}})[_0x9db6('0x2f')](respondWithStatusCode(_0x1c69e9,null))['catch'](handleError(_0x1c69e9,null));};exports[_0x9db6('0x70')]=function(_0x4beddd,_0x114835,_0x345c86){var _0x2956ec={};var _0x7844f={};var _0x2939bb;var _0x59731d;return db['WhatsappAccount'][_0x9db6('0x64')]({'where':{'id':_0x4beddd[_0x9db6('0x5e')]['id']}})[_0x9db6('0x2f')](handleEntityNotFound(_0x114835,null))[_0x9db6('0x2f')](function(_0x544d80){if(_0x544d80){_0x2939bb=_0x544d80;_0x7844f[_0x9db6('0x39')]=_[_0x9db6('0x3c')](db['User']['rawAttributes']);_0x7844f[_0x9db6('0x3b')]=_[_0x9db6('0x3c')](_0x4beddd[_0x9db6('0x3b')]);_0x7844f[_0x9db6('0x44')]=_[_0x9db6('0x3d')](_0x7844f['model'],_0x7844f[_0x9db6('0x3b')]);_0x2956ec[_0x9db6('0x3e')]=_[_0x9db6('0x3d')](_0x7844f['model'],qs[_0x9db6('0x52')](_0x4beddd['query'][_0x9db6('0x52')]));_0x2956ec[_0x9db6('0x3e')]=_0x2956ec[_0x9db6('0x3e')]['length']?_0x2956ec[_0x9db6('0x3e')]:_0x7844f['model'];_0x2956ec[_0x9db6('0x42')]=qs[_0x9db6('0x43')](_0x4beddd[_0x9db6('0x3b')][_0x9db6('0x43')]);_0x2956ec[_0x9db6('0x47')]=qs[_0x9db6('0x44')](_['pick'](_0x4beddd[_0x9db6('0x3b')],_0x7844f['filters']));if(_0x4beddd[_0x9db6('0x3b')][_0x9db6('0x46')]){_0x2956ec[_0x9db6('0x47')]=_[_0x9db6('0x48')](_0x2956ec[_0x9db6('0x47')],{'$or':_[_0x9db6('0x3a')](_0x2956ec[_0x9db6('0x3e')],function(_0x8f73ee){var _0x539265={};_0x539265[_0x8f73ee]={'$like':'%'+_0x4beddd[_0x9db6('0x3b')][_0x9db6('0x46')]+'%'};return _0x539265;})});}_0x2956ec=_['merge']({},_0x2956ec,_0x4beddd[_0x9db6('0x53')]);return _0x2939bb[_0x9db6('0x70')](_0x2956ec);}})[_0x9db6('0x2f')](function(_0x360862){if(_0x360862){_0x59731d=_0x360862[_0x9db6('0x3f')];if(!_0x4beddd[_0x9db6('0x3b')][_0x9db6('0x40')](_0x9db6('0x41'))){_0x2956ec[_0x9db6('0x2a')]=qs[_0x9db6('0x2a')](_0x4beddd[_0x9db6('0x3b')][_0x9db6('0x2a')]);_0x2956ec[_0x9db6('0x28')]=qs[_0x9db6('0x28')](_0x4beddd[_0x9db6('0x3b')][_0x9db6('0x28')]);}return _0x2939bb[_0x9db6('0x70')](_0x2956ec);}})[_0x9db6('0x2f')](function(_0x3a2a60){if(_0x3a2a60){return _0x3a2a60?{'count':_0x59731d,'rows':_0x3a2a60}:null;}})['then'](respondWithResult(_0x114835,null))[_0x9db6('0x23')](handleError(_0x114835,null));};exports[_0x9db6('0x71')]=function(_0x124a24,_0x1e59cf){var _0x40451f=_0x124a24[_0x9db6('0x5e')]['id'];var _0x331188=_0x124a24[_0x9db6('0x5c')];var _0x45db32=0xc8;var _0x3460ba=null;return db[_0x9db6('0x72')][_0x9db6('0x73')]({'isolationLevel':db[_0x9db6('0x72')][_0x9db6('0x74')][_0x9db6('0x75')][_0x9db6('0x76')]},function(_0x2e580e){return db['WhatsappAccount']['findOne']({'where':{'id':_0x40451f},'transaction':_0x2e580e})[_0x9db6('0x2f')](function(_0x4d2898){if(_0x4d2898){return db[_0x9db6('0x77')][_0x9db6('0x78')]({'where':{'WhatsappAccountId':_0x40451f},'transaction':_0x2e580e})[_0x9db6('0x2f')](function(){var _0x43888e=_[_0x9db6('0x3a')](_0x331188,function(_0x1cbab8){_0x1cbab8[_0x9db6('0x61')]=_0x40451f;return _0x1cbab8;});return db['WhatsappApplication'][_0x9db6('0x79')](_0x43888e,{'transaction':_0x2e580e});});}else{_0x45db32=0x194;_0x3460ba=[];}});})[_0x9db6('0x2f')](function(){if(_0x45db32!==0x194){return db['WhatsappApplication']['findAndCountAll']({'where':{'WhatsappAccountId':_0x40451f},'order':_0x9db6('0x7a')})[_0x9db6('0x2f')](function(_0x24e15f){_0x3460ba=_0x24e15f;});}})[_0x9db6('0x23')](function(_0x13ce07){_0x45db32=0x1f4;logger[_0x9db6('0x1f')](_0x13ce07['stack']);if(_0x13ce07[_0x9db6('0x34')]){delete _0x13ce07[_0x9db6('0x34')];}_0x3460ba=_0x13ce07;})['finally'](function(){if(_0x3460ba===null){_0x1e59cf[_0x9db6('0x24')](_0x45db32);}else{if(_0x45db32===0x1f4){_0x1e59cf[_0x9db6('0x25')](_0x45db32)[_0x9db6('0x35')](_0x3460ba);}else{_0x1e59cf['status'](_0x45db32)['json'](_0x3460ba);}}});};exports[_0x9db6('0x7b')]=function(_0x2bf305,_0x51e8f5,_0x43b8cd){var _0x39703f={};var _0x268291={};var _0xf5a975;var _0x446cd8;return db['WhatsappAccount'][_0x9db6('0x64')]({'where':{'id':_0x2bf305[_0x9db6('0x5e')]['id']}})[_0x9db6('0x2f')](handleEntityNotFound(_0x51e8f5,null))[_0x9db6('0x2f')](function(_0x18f2dd){if(_0x18f2dd){_0xf5a975=_0x18f2dd;_0x268291[_0x9db6('0x39')]=_[_0x9db6('0x3c')](db['WhatsappApplication'][_0x9db6('0x51')]);_0x268291[_0x9db6('0x3b')]=_[_0x9db6('0x3c')](_0x2bf305[_0x9db6('0x3b')]);_0x268291[_0x9db6('0x44')]=_['intersection'](_0x268291['model'],_0x268291[_0x9db6('0x3b')]);_0x39703f[_0x9db6('0x3e')]=_['intersection'](_0x268291[_0x9db6('0x39')],qs[_0x9db6('0x52')](_0x2bf305['query'][_0x9db6('0x52')]));_0x39703f['attributes']=_0x39703f[_0x9db6('0x3e')][_0x9db6('0x3f')]?_0x39703f[_0x9db6('0x3e')]:_0x268291[_0x9db6('0x39')];_0x39703f[_0x9db6('0x42')]=qs[_0x9db6('0x43')](_0x2bf305['query'][_0x9db6('0x43')]);_0x39703f[_0x9db6('0x47')]=qs[_0x9db6('0x44')](_[_0x9db6('0x45')](_0x2bf305['query'],_0x268291['filters']));if(_0x2bf305[_0x9db6('0x3b')][_0x9db6('0x46')]){_0x39703f[_0x9db6('0x47')]=_[_0x9db6('0x48')](_0x39703f[_0x9db6('0x47')],{'$or':_[_0x9db6('0x3a')](_0x39703f['attributes'],function(_0x46668f){var _0x21977a={};_0x21977a[_0x46668f]={'$like':'%'+_0x2bf305[_0x9db6('0x3b')][_0x9db6('0x46')]+'%'};return _0x21977a;})});}_0x39703f=_[_0x9db6('0x48')]({},_0x39703f,_0x2bf305[_0x9db6('0x53')]);return _0xf5a975[_0x9db6('0x7b')](_0x39703f);}})[_0x9db6('0x2f')](function(_0x1eb60c){if(_0x1eb60c){_0x446cd8=_0x1eb60c[_0x9db6('0x3f')];if(!_0x2bf305[_0x9db6('0x3b')][_0x9db6('0x40')](_0x9db6('0x41'))){_0x39703f[_0x9db6('0x2a')]=qs[_0x9db6('0x2a')](_0x2bf305[_0x9db6('0x3b')][_0x9db6('0x2a')]);_0x39703f[_0x9db6('0x28')]=qs[_0x9db6('0x28')](_0x2bf305[_0x9db6('0x3b')][_0x9db6('0x28')]);}return _0xf5a975['getApplications'](_0x39703f);}})[_0x9db6('0x2f')](function(_0x1ca21f){if(_0x1ca21f){return _0x1ca21f?{'count':_0x446cd8,'rows':_0x1ca21f}:null;}})[_0x9db6('0x2f')](respondWithResult(_0x51e8f5,null))[_0x9db6('0x23')](handleError(_0x51e8f5,null));};exports['notify']=function(_0x4da8fa,_0x150fb0,_0x260e25){var _0x39383d={'channel':_0x9db6('0x7c')};var _0x48d2b9=[];var _0x471b77=[];var _0xb9f128={};return db[_0x9db6('0x4a')][_0x9db6('0x5d')]({'where':{'id':_0x4da8fa[_0x9db6('0x5e')]['id']},'include':[{'model':db[_0x9db6('0x77')],'as':_0x9db6('0x7d')}]})[_0x9db6('0x2f')](handleEntityNotFound(_0x150fb0,null))[_0x9db6('0x2f')](function(_0x56dd10){_0x39383d['account']=_0x56dd10;if(_0x39383d[_0x9db6('0x7e')]&&_0x39383d[_0x9db6('0x7e')][_0x9db6('0x38')]==='sinch'&&_0x4da8fa[_0x9db6('0x5c')][_0x9db6('0x7f')]){if(_0x4da8fa[_0x9db6('0x5c')][_0x9db6('0x7f')][_0x9db6('0x3f')]===0x0)return;if(_0x4da8fa['body'][_0x9db6('0x7f')][0x0][_0x9db6('0x80')]!==_0x9db6('0x81'))return;return db[_0x9db6('0x82')][_0x9db6('0x5b')]({'read':!![],'readAt':_0x4da8fa[_0x9db6('0x5c')][_0x9db6('0x7f')][0x0]['timestamp']},{'where':{'messageId':_0x4da8fa[_0x9db6('0x5c')]['statuses'][0x0]['message_id']},'individualHooks':!![]})[_0x9db6('0x2f')](function(_0x3ffe67){return _0x150fb0[_0x9db6('0x25')](0xc8)[_0x9db6('0x27')](_0x3ffe67);});}_0x39383d[_0x9db6('0x83')]=_[_0x9db6('0x84')](_0x56dd10[_0x9db6('0x7d')],['priority'],[_0x9db6('0x85')]);if(_0x39383d[_0x9db6('0x7e')][_0x9db6('0x7d')]){delete _0x39383d[_0x9db6('0x7e')][_0x9db6('0x7d')];}return db['CmContact']['describe']()[_0x9db6('0x2f')](function(_0x32ca6c){if(!_0x32ca6c){throw new db[(_0x9db6('0x86'))][(_0x9db6('0x87'))](_0x9db6('0x88'));}_0x48d2b9=_[_0x9db6('0x89')](_[_0x9db6('0x3c')](_0x32ca6c),[_0x9db6('0x8a'),_0x9db6('0x8b')]);_0x471b77=_[_0x9db6('0x89')](_['keys'](_0x32ca6c),[_0x9db6('0x8a'),_0x9db6('0x8b'),'CompanyId',_0x9db6('0x8c')]);_0x39383d[_0x9db6('0x5c')]={'mapKey':'mobile'};if(_0x39383d[_0x9db6('0x7e')]&&_0x39383d[_0x9db6('0x7e')][_0x9db6('0x38')]===_0x9db6('0x8d')){_0x39383d[_0x9db6('0x5c')][_0x9db6('0x8e')]=_0x4da8fa[_0x9db6('0x5c')][_0x9db6('0x8f')][_0x9db6('0x90')](_0x9db6('0x91'),'');_0x39383d['body'][_0x9db6('0x5c')]=_0x4da8fa[_0x9db6('0x5c')][_0x9db6('0x92')];_0x39383d['body'][_0x9db6('0x93')]=_0x4da8fa[_0x9db6('0x5c')]['MessageSid'];}if(_0x39383d[_0x9db6('0x7e')]&&_0x39383d['account'][_0x9db6('0x38')]===_0x9db6('0x94')){_0x39383d[_0x9db6('0x5c')]['from']=_0x4da8fa[_0x9db6('0x5c')][_0x9db6('0x95')][0x0]['from'];_0x39383d[_0x9db6('0x5c')][_0x9db6('0x5c')]=_0x4da8fa['body'][_0x9db6('0x95')][0x0]['message']['body'];_0x39383d[_0x9db6('0x5c')][_0x9db6('0x93')]=_0x4da8fa[_0x9db6('0x5c')][_0x9db6('0x95')][0x0][_0x9db6('0x96')];}if(_0x39383d[_0x9db6('0x5c')]['id']){delete _0x39383d[_0x9db6('0x5c')]['id'];}if(_[_0x9db6('0x97')](_0x39383d[_0x9db6('0x5c')][_0x9db6('0x8e')])){throw new db[(_0x9db6('0x86'))][(_0x9db6('0x87'))](_0x9db6('0x98'));}if(_['isNil'](_0x39383d['body']['body'])||_0x39383d[_0x9db6('0x5c')][_0x9db6('0x5c')]===''){throw new db['Sequelize']['ValidationError'](_0x9db6('0x99'));}if(_[_0x9db6('0x97')](_0x39383d[_0x9db6('0x5c')]['mapKey'])){throw new db['Sequelize'][(_0x9db6('0x87'))](_0x9db6('0x9a')+_0x471b77);}if(!_[_0x9db6('0x9b')](_0x471b77,_0x39383d[_0x9db6('0x5c')][_0x9db6('0x9c')])){throw new db[(_0x9db6('0x86'))][(_0x9db6('0x87'))](_0x9db6('0x9d')+_0x471b77);}_0xb9f128[_0x39383d[_0x9db6('0x5c')][_0x9db6('0x9c')]]=_0x39383d[_0x9db6('0x5c')][_0x9db6('0x8e')];return db[_0x9db6('0x9e')]['find']({'where':{'id':_0x39383d['account'][_0x9db6('0x8c')]},'include':[{'model':db[_0x9db6('0x9f')],'as':_0x9db6('0xa0'),'where':_0xb9f128,'limit':0x1,'order':[[_0x9db6('0x8b'),'DESC']]}]});})[_0x9db6('0x2f')](handleEntityNotFound(_0x150fb0,null))[_0x9db6('0x2f')](function(_0x330015){if(_0x330015){_0x39383d[_0x9db6('0xa1')]=_['omit'](_0x330015,[_0x9db6('0xa0')]);if(_0x330015[_0x9db6('0xa0')][_0x9db6('0x3f')]){return _0x330015[_0x9db6('0xa0')][0x0];}var _0x50e986=_[_0x9db6('0xa2')](_0x39383d['body'],{'firstName':_0x39383d['body'][_0x9db6('0x8e')],'ListId':_0x330015['id']});_0x50e986[_0x39383d[_0x9db6('0x5c')]['mapKey']]=_0x39383d[_0x9db6('0x5c')][_0x9db6('0x8e')];return db[_0x9db6('0x9f')]['create'](_0x50e986,{'fields':_0x48d2b9,'raw':!![]});}})['then'](handleEntityNotFound(_0x150fb0,null))[_0x9db6('0x2f')](function(_0x5d7e0e){if(_0x5d7e0e){_0x39383d[_0x9db6('0xa3')]=_0x5d7e0e;var _0xe42cfd={'ContactId':_0x5d7e0e['id'],'phone':_0x39383d[_0x9db6('0x5c')]['from'],'WhatsappAccountId':_0x4da8fa['params']['id']};var _0x3a7b7d={'ContactId':_0x5d7e0e['id'],'WhatsappAccountId':_0x4da8fa[_0x9db6('0x5e')]['id'],'closed':![]};return db[_0x9db6('0xa4')][_0x9db6('0x5d')]({'where':_0x3a7b7d})['then'](function(_0x24e983){if(_0x24e983){return[_0x24e983,![]];}return db['WhatsappInteraction'][_0x9db6('0x54')](_0xe42cfd)[_0x9db6('0x2f')](function(_0x2a4732){return[_0x2a4732,!![]];});});}})['spread'](function(_0x3d13ec,_0xf9ab46){_0x39383d[_0x9db6('0xa5')]=_0x3d13ec[_0x9db6('0x30')]({'plain':!![]});_0x39383d[_0x9db6('0xa5')][_0x9db6('0xa6')]=![];if(_0xf9ab46){if(_0x39383d[_0x9db6('0x7e')][_0x9db6('0xa7')]){_0x39383d[_0x9db6('0x83')][_0x9db6('0xa8')]({'id':0x0,'priority':_0x39383d[_0x9db6('0x83')][_0x9db6('0x3f')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x9db6('0xa9')});}_0x39383d[_0x9db6('0xa5')][_0x9db6('0xa6')]=!![];}return db['WhatsappMessage'][_0x9db6('0x54')]({'phone':_0x39383d[_0x9db6('0x5c')][_0x9db6('0x8e')],'messageId':_0x39383d[_0x9db6('0x5c')][_0x9db6('0x93')],'body':_0x39383d[_0x9db6('0x5c')][_0x9db6('0x5c')],'WhatsappAccountId':_0x4da8fa[_0x9db6('0x5e')]['id'],'WhatsappInteractionId':_0x3d13ec['id'],'direction':'in','ContactId':_0x3d13ec['ContactId'],'AttachmentId':_0x39383d[_0x9db6('0x5c')][_0x9db6('0xaa')]});})['then'](function(_0x3bfe24){_0x39383d[_0x9db6('0x20')]=_0x3bfe24;if(_0x39383d[_0x9db6('0xa5')]['UserId']){return db[_0x9db6('0xab')][_0x9db6('0x5d')]({'attributes':['id','name'],'where':{'id':_0x39383d[_0x9db6('0xa5')][_0x9db6('0xac')]}})[_0x9db6('0x2f')](function(_0x2886c0){if(_0x2886c0){_0x39383d[_0x9db6('0x83')][_0x9db6('0xad')]({'id':0x0,'priority':0x0,'app':_0x9db6('0xae'),'appdata':_0x2886c0[_0x9db6('0x34')]+','+(_0x39383d['account'][_0x9db6('0xaf')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x9db6('0xb0'),'startRouting',_0x39383d);});}return respondWithRpcPromise(_0x9db6('0xb0'),'startRouting',_0x39383d);})['then'](function(_0x590f73){if(_0x590f73){var _0x1407db=0xc8;var _0x75a505=_0x9db6('0xb1');logger[_0x9db6('0x22')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x75a505,_0x1407db,_0x9db6('0xb2'));logger['debug'](_0x9db6('0xb3'),_0x75a505,_0x1407db,_0x9db6('0xb2'),JSON[_0x9db6('0x1e')](_0x590f73));if(_0x39383d[_0x9db6('0x7e')][_0x9db6('0x38')]===_0x9db6('0x8d')){return _0x150fb0[_0x9db6('0x25')](_0x1407db)[_0x9db6('0xb4')](_0x9db6('0xb5'),_0x9db6('0xb6'))[_0x9db6('0x35')](_0x9db6('0xb7'));}else{return _0x150fb0[_0x9db6('0x25')](_0x1407db)[_0x9db6('0x27')](_0x590f73);}}});})[_0x9db6('0x23')](handleError(_0x150fb0,null));};exports[_0x9db6('0x35')]=function(_0x3cbef5,_0x1bd36f,_0x5dfcfb){var _0x53a2fb,_0x3909e4,_0x5cde12;if(_[_0x9db6('0x97')](_0x3cbef5[_0x9db6('0x5c')][_0x9db6('0x5c')])||_0x3cbef5[_0x9db6('0x5c')]['body']===''){throw new db[(_0x9db6('0x86'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x9db6('0x97')](_0x3cbef5['body']['to'])){throw new db[(_0x9db6('0x86'))][(_0x9db6('0x87'))](_0x9db6('0xb8'));}_0x53a2fb=_0x3cbef5['body']['to'];return db[_0x9db6('0x4a')][_0x9db6('0x5d')]({'where':{'id':_0x3cbef5[_0x9db6('0x5e')]['id']},'include':[{'model':db[_0x9db6('0x9e')],'as':_0x9db6('0xb9'),'include':[{'model':db[_0x9db6('0x9f')],'as':_0x9db6('0xa0'),'where':{'mobile':_0x53a2fb},'limit':0x1,'order':[[_0x9db6('0x8b'),_0x9db6('0xba')]]}]}]})[_0x9db6('0x2f')](handleEntityNotFound(_0x1bd36f,null))[_0x9db6('0x2f')](function(_0x128f2b){if(_0x128f2b&&_0x128f2b[_0x9db6('0xb9')]){_0x3909e4=_0x128f2b['get']({'plain':!![]});if(_0x3909e4['List']&&_0x3909e4['List'][_0x9db6('0xa0')][_0x9db6('0x3f')]){return _0x3909e4['List'][_0x9db6('0xa0')][0x0];}return db[_0x9db6('0x9f')][_0x9db6('0x54')](_['defaults'](_0x3cbef5[_0x9db6('0x5c')],{'firstName':_0x53a2fb,'mobile':_0x53a2fb,'phone':_0x53a2fb,'ListId':_0x3909e4[_0x9db6('0x8c')]}));}})[_0x9db6('0x2f')](handleEntityNotFound(_0x1bd36f,null))['then'](function(_0x2d94e6){if(_0x2d94e6){_0x5cde12=_0x2d94e6;return db['WhatsappInteraction'][_0x9db6('0x5d')]({'where':{'ContactId':_0x5cde12['id'],'closed':![],'WhatsappAccountId':_0x3909e4['id']}})['then'](function(_0x168e99){if(_0x168e99){return[_0x168e99,![]];}return db[_0x9db6('0xa4')][_0x9db6('0x54')]({'UserId':_0x3cbef5[_0x9db6('0x57')]['id'],'ContactId':_0x5cde12['id'],'WhatsappAccountId':_0x3909e4['id'],'phone':_0x53a2fb,'firstMsgDirection':_0x9db6('0xbb'),'Messages':[_['merge'](_0x3cbef5['body'],{'read':![],'body':_0x3cbef5['body'][_0x9db6('0x5c')],'phone':_0x53a2fb,'WhatsappAccountId':_0x3909e4['id'],'UserId':_0x3cbef5[_0x9db6('0x57')]['id'],'ContactId':_0x5cde12['id']})]},{'include':[{'model':db[_0x9db6('0x82')],'as':_0x9db6('0xbc')}]})[_0x9db6('0x2f')](function(_0x30aba3){return[_0x30aba3,!![]];});});}})[_0x9db6('0xbd')](function(_0x526043,_0x411631){if(_0x411631){return _0x526043;}return db[_0x9db6('0x82')][_0x9db6('0x54')](_[_0x9db6('0x48')](_0x3cbef5[_0x9db6('0x5c')],{'read':![],'body':_0x3cbef5['body']['body'],'phone':_0x53a2fb,'WhatsappAccountId':_0x3909e4['id'],'WhatsappInteractionId':_0x526043['id'],'UserId':_0x3cbef5[_0x9db6('0x57')]['id'],'ContactId':_0x5cde12['id']}))[_0x9db6('0x2f')](function(_0x933761){_0x526043[_0x9db6('0xbe')][_0x9db6('0xbc')]=[];_0x526043[_0x9db6('0xbe')][_0x9db6('0xbc')]['push'](_0x933761['dataValues']);return _0x526043;});})[_0x9db6('0x2f')](respondWithResult(_0x1bd36f,null))['catch'](handleError(_0x1bd36f,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index db27541..2f46538 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 _0xa3ed=['exports','../../mysqldb','WhatsappAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x14f7ef,_0x464f9a){var _0x239b12=function(_0x117e0c){while(--_0x117e0c){_0x14f7ef['push'](_0x14f7ef['shift']());}};_0x239b12(++_0x464f9a);}(_0xa3ed,0xd9));var _0xda3e=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xa3ed[_0x4b369d];return _0x571a98;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xda3e('0x0'))['db'][_0xda3e('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xda3e('0x2')](0x0);var events={'afterCreate':_0xda3e('0x3'),'afterUpdate':'update','afterDestroy':_0xda3e('0x4')};function emitEvent(_0x3f39e8){return function(_0x47eb58,_0xef25c8,_0x55b3c5){WhatsappAccountEvents[_0xda3e('0x5')](_0x3f39e8+':'+_0x47eb58['id'],_0x47eb58);WhatsappAccountEvents[_0xda3e('0x5')](_0x3f39e8,_0x47eb58);_0x55b3c5(null);};}for(var e in events){if(events[_0xda3e('0x6')](e)){var event=events[e];WhatsappAccount[_0xda3e('0x7')](e,emitEvent(event));}}module[_0xda3e('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0xb551=['exports','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x51cccb,_0x285b64){var _0x3492a2=function(_0x3dd78f){while(--_0x3dd78f){_0x51cccb['push'](_0x51cccb['shift']());}};_0x3492a2(++_0x285b64);}(_0xb551,0x1cf));var _0x1b55=function(_0x260a53,_0x3ca098){_0x260a53=_0x260a53-0x0;var _0x5b92da=_0xb551[_0x260a53];return _0x5b92da;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x1b55('0x0'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x1b55('0x1')](0x0);var events={'afterCreate':_0x1b55('0x2'),'afterUpdate':_0x1b55('0x3'),'afterDestroy':'remove'};function emitEvent(_0x44a53a){return function(_0x1b6d59,_0x3e5780,_0x13f27f){WhatsappAccountEvents[_0x1b55('0x4')](_0x44a53a+':'+_0x1b6d59['id'],_0x1b6d59);WhatsappAccountEvents['emit'](_0x44a53a,_0x1b6d59);_0x13f27f(null);};}for(var e in events){if(events[_0x1b55('0x5')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x1b55('0x6')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 15d66a2..a2281ff 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 _0x9a18=['moment','request-promise','path','rimraf','../../config/environment','define','lodash','util','../../config/logger','api'];(function(_0x5ebe93,_0xee36e9){var _0x524a9f=function(_0x4d3f0b){while(--_0x4d3f0b){_0x5ebe93['push'](_0x5ebe93['shift']());}};_0x524a9f(++_0xee36e9);}(_0x9a18,0x10a));var _0x89a1=function(_0x49f084,_0x1d31a4){_0x49f084=_0x49f084-0x0;var _0xeca8bc=_0x9a18[_0x49f084];return _0xeca8bc;};'use strict';var _=require(_0x89a1('0x0'));var util=require(_0x89a1('0x1'));var logger=require(_0x89a1('0x2'))(_0x89a1('0x3'));var moment=require(_0x89a1('0x4'));var BPromise=require('bluebird');var rp=require(_0x89a1('0x5'));var fs=require('fs');var path=require(_0x89a1('0x6'));var rimraf=require(_0x89a1('0x7'));var config=require(_0x89a1('0x8'));var attributes=require('./whatsappAccount.attributes');module['exports']=function(_0x237336,_0x5999a3){return _0x237336[_0x89a1('0x9')]('WhatsappAccount',attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c23=['path','../../config/environment','./whatsappAccount.attributes','WhatsappAccount','whatsapp_accounts','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5e37da,_0x19833b){var _0x48b99f=function(_0x4f5649){while(--_0x4f5649){_0x5e37da['push'](_0x5e37da['shift']());}};_0x48b99f(++_0x19833b);}(_0x1c23,0xaa));var _0x31c2=function(_0x5dec5a,_0x2049b0){_0x5dec5a=_0x5dec5a-0x0;var _0x13863f=_0x1c23[_0x5dec5a];return _0x13863f;};'use strict';var _=require('lodash');var util=require(_0x31c2('0x0'));var logger=require(_0x31c2('0x1'))(_0x31c2('0x2'));var moment=require(_0x31c2('0x3'));var BPromise=require(_0x31c2('0x4'));var rp=require(_0x31c2('0x5'));var fs=require('fs');var path=require(_0x31c2('0x6'));var rimraf=require('rimraf');var config=require(_0x31c2('0x7'));var attributes=require(_0x31c2('0x8'));module['exports']=function(_0x5b3c33,_0x305932){return _0x5b3c33['define'](_0x31c2('0x9'),attributes,{'tableName':_0x31c2('0xa'),'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 a44a448..305eddf 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 _0xe6a1=['jayson/promise','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','attributes','include','map','model','then','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x3a7634,_0x2db384){var _0x23bbe9=function(_0x226734){while(--_0x226734){_0x3a7634['push'](_0x3a7634['shift']());}};_0x23bbe9(++_0x2db384);}(_0xe6a1,0x111));var _0x1e6a=function(_0x58e055,_0x2a5f75){_0x58e055=_0x58e055-0x0;var _0xf1661=_0xe6a1[_0x58e055];return _0xf1661;};'use strict';var _=require('lodash');var util=require(_0x1e6a('0x0'));var moment=require(_0x1e6a('0x1'));var BPromise=require('bluebird');var rs=require(_0x1e6a('0x2'));var fs=require('fs');var Redis=require(_0x1e6a('0x3'));var db=require(_0x1e6a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1e6a('0x5'));var config=require(_0x1e6a('0x6'));var jayson=require(_0x1e6a('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x1e6a('0x8')]=_[_0x1e6a('0x9')](config[_0x1e6a('0x8')],{'host':_0x1e6a('0xa'),'port':0x18eb});var socket=require(_0x1e6a('0xb'))(new Redis(config[_0x1e6a('0x8')]));require(_0x1e6a('0xc'))[_0x1e6a('0xd')](socket);function respondWithRpcPromise(_0xef37f5,_0x238a4a,_0x3cee37){return new BPromise(function(_0x24db27,_0xa28f89){return client['request'](_0xef37f5,_0x3cee37)['then'](function(_0xd38eaa){logger[_0x1e6a('0xe')](_0x1e6a('0xf'),_0x238a4a,_0x1e6a('0x10'));logger[_0x1e6a('0x11')](_0x1e6a('0x12'),_0x238a4a,_0x1e6a('0x10'),JSON[_0x1e6a('0x13')](_0xd38eaa));if(_0xd38eaa[_0x1e6a('0x14')]){if(_0xd38eaa['error'][_0x1e6a('0x15')]===0x1f4){logger[_0x1e6a('0x14')](_0x1e6a('0xf'),_0x238a4a,_0xd38eaa[_0x1e6a('0x14')][_0x1e6a('0x16')]);return _0xa28f89(_0xd38eaa[_0x1e6a('0x14')][_0x1e6a('0x16')]);}logger[_0x1e6a('0x14')](_0x1e6a('0xf'),_0x238a4a,_0xd38eaa[_0x1e6a('0x14')]['message']);return _0x24db27(_0xd38eaa[_0x1e6a('0x14')]['message']);}else{logger[_0x1e6a('0xe')]('WhatsappAccount,\x20%s,\x20%s',_0x238a4a,'request\x20sent');_0x24db27(_0xd38eaa[_0x1e6a('0x17')]['message']);}})[_0x1e6a('0x18')](function(_0x257d80){logger[_0x1e6a('0x14')](_0x1e6a('0xf'),_0x238a4a,_0x257d80);_0xa28f89(_0x257d80);});});}exports[_0x1e6a('0x19')]=function(_0x1d6a34){var _0x39f64b=this;return new Promise(function(_0x2dec19,_0x1b871d){return db[_0x1e6a('0x1a')][_0x1e6a('0x1b')]({'raw':_0x1d6a34[_0x1e6a('0x1c')]?_0x1d6a34[_0x1e6a('0x1c')][_0x1e6a('0x1d')]===undefined?!![]:![]:!![],'where':_0x1d6a34['options']?_0x1d6a34['options']['where']||null:null,'attributes':_0x1d6a34[_0x1e6a('0x1c')]?_0x1d6a34[_0x1e6a('0x1c')][_0x1e6a('0x1e')]||null:null,'include':_0x1d6a34[_0x1e6a('0x1c')]?_0x1d6a34[_0x1e6a('0x1c')][_0x1e6a('0x1f')]?_[_0x1e6a('0x20')](_0x1d6a34['options'][_0x1e6a('0x1f')],function(_0x891097){return{'model':db[_0x891097[_0x1e6a('0x21')]],'as':_0x891097['as'],'attributes':_0x891097['attributes'],'include':_0x891097['include']?_[_0x1e6a('0x20')](_0x891097[_0x1e6a('0x1f')],function(_0x9f944e){return{'model':db[_0x9f944e[_0x1e6a('0x21')]],'as':_0x9f944e['as'],'attributes':_0x9f944e['attributes'],'include':_0x9f944e[_0x1e6a('0x1f')]?_[_0x1e6a('0x20')](_0x9f944e[_0x1e6a('0x1f')],function(_0x19b155){return{'model':db[_0x19b155[_0x1e6a('0x21')]],'as':_0x19b155['as'],'attributes':_0x19b155[_0x1e6a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1e6a('0x22')](function(_0xc5fe0e){logger['info']('ShowWhatsappAccount',_0x1d6a34);logger[_0x1e6a('0x11')](_0x1e6a('0x19'),_0x1d6a34,JSON['stringify'](_0xc5fe0e));_0x2dec19(_0xc5fe0e);})[_0x1e6a('0x18')](function(_0x200a3c){logger['error']('ShowWhatsappAccount',_0x200a3c[_0x1e6a('0x16')],_0x1d6a34);_0x1b871d(_0x39f64b['error'](0x1f4,_0x200a3c[_0x1e6a('0x16')]));});});}; \ No newline at end of file +var _0x6799=['raw','where','options','map','include','model','attributes','ShowWhatsappAccount','stringify','lodash','util','moment','bluebird','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch'];(function(_0x306fa2,_0x433f04){var _0x188926=function(_0x2c372b){while(--_0x2c372b){_0x306fa2['push'](_0x306fa2['shift']());}};_0x188926(++_0x433f04);}(_0x6799,0x1bb));var _0x9679=function(_0x31b565,_0x872b0e){_0x31b565=_0x31b565-0x0;var _0xd444cd=_0x6799[_0x31b565];return _0xd444cd;};'use strict';var _=require(_0x9679('0x0'));var util=require(_0x9679('0x1'));var moment=require(_0x9679('0x2'));var BPromise=require(_0x9679('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9679('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x9679('0x5'));var jayson=require(_0x9679('0x6'));var client=jayson[_0x9679('0x7')][_0x9679('0x8')]({'port':0x232a});config[_0x9679('0x9')]=_['defaults'](config[_0x9679('0x9')],{'host':_0x9679('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9679('0x9')]));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0xa58b69,_0x42502e,_0x56fdd0){return new BPromise(function(_0x1296ce,_0x53ff24){return client[_0x9679('0xb')](_0xa58b69,_0x56fdd0)[_0x9679('0xc')](function(_0x5cbc0e){logger[_0x9679('0xd')](_0x9679('0xe'),_0x42502e,_0x9679('0xf'));logger[_0x9679('0x10')](_0x9679('0x11'),_0x42502e,_0x9679('0xf'),JSON['stringify'](_0x5cbc0e));if(_0x5cbc0e[_0x9679('0x12')]){if(_0x5cbc0e[_0x9679('0x12')]['code']===0x1f4){logger[_0x9679('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x42502e,_0x5cbc0e['error']['message']);return _0x53ff24(_0x5cbc0e[_0x9679('0x12')][_0x9679('0x13')]);}logger[_0x9679('0x12')](_0x9679('0xe'),_0x42502e,_0x5cbc0e[_0x9679('0x12')][_0x9679('0x13')]);return _0x1296ce(_0x5cbc0e['error'][_0x9679('0x13')]);}else{logger[_0x9679('0xd')](_0x9679('0xe'),_0x42502e,_0x9679('0xf'));_0x1296ce(_0x5cbc0e[_0x9679('0x14')][_0x9679('0x13')]);}})[_0x9679('0x15')](function(_0x292213){logger['error'](_0x9679('0xe'),_0x42502e,_0x292213);_0x53ff24(_0x292213);});});}exports['ShowWhatsappAccount']=function(_0x13853b){var _0x18ebcd=this;return new Promise(function(_0x5947ab,_0x4f92e7){return db['WhatsappAccount']['find']({'raw':_0x13853b['options']?_0x13853b['options'][_0x9679('0x16')]===undefined?!![]:![]:!![],'where':_0x13853b['options']?_0x13853b['options'][_0x9679('0x17')]||null:null,'attributes':_0x13853b['options']?_0x13853b[_0x9679('0x18')]['attributes']||null:null,'include':_0x13853b[_0x9679('0x18')]?_0x13853b['options']['include']?_[_0x9679('0x19')](_0x13853b['options'][_0x9679('0x1a')],function(_0x3113ca){return{'model':db[_0x3113ca[_0x9679('0x1b')]],'as':_0x3113ca['as'],'attributes':_0x3113ca[_0x9679('0x1c')],'include':_0x3113ca[_0x9679('0x1a')]?_[_0x9679('0x19')](_0x3113ca[_0x9679('0x1a')],function(_0x52739a){return{'model':db[_0x52739a[_0x9679('0x1b')]],'as':_0x52739a['as'],'attributes':_0x52739a[_0x9679('0x1c')],'include':_0x52739a[_0x9679('0x1a')]?_[_0x9679('0x19')](_0x52739a[_0x9679('0x1a')],function(_0x5b94fa){return{'model':db[_0x5b94fa[_0x9679('0x1b')]],'as':_0x5b94fa['as'],'attributes':_0x5b94fa[_0x9679('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9679('0xc')](function(_0x499f95){logger[_0x9679('0xd')](_0x9679('0x1d'),_0x13853b);logger[_0x9679('0x10')](_0x9679('0x1d'),_0x13853b,JSON[_0x9679('0x1e')](_0x499f95));_0x5947ab(_0x499f95);})[_0x9679('0x15')](function(_0x3b94f4){logger['error'](_0x9679('0x1d'),_0x3b94f4['message'],_0x13853b);_0x4f92e7(_0x18ebcd['error'](0x1f4,_0x3b94f4[_0x9679('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 1d4f701..859711d 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 _0x2a9a=['length','whatsappAccount:','remove','emit','removeListener'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2a9a,0x142));var _0xa2a9=function(_0x2cd7cd,_0x492702){_0x2cd7cd=_0x2cd7cd-0x0;var _0xa3be76=_0x2a9a[_0x2cd7cd];return _0xa3be76;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=['save',_0xa2a9('0x0'),'update'];function createListener(_0x6f6481,_0x3f0ea5){return function(_0x2a0aa0){_0x3f0ea5[_0xa2a9('0x1')](_0x6f6481,_0x2a0aa0);};}function removeListener(_0x36698e,_0x3a0274){return function(){WhatsappAccountEvents[_0xa2a9('0x2')](_0x36698e,_0x3a0274);};}exports['register']=function(_0x2dff26){for(var _0x5eaaff=0x0,_0x579469=events[_0xa2a9('0x3')];_0x5eaaff<_0x579469;_0x5eaaff++){var _0x49ab72=events[_0x5eaaff];var _0x402b9a=createListener(_0xa2a9('0x4')+_0x49ab72,_0x2dff26);WhatsappAccountEvents['on'](_0x49ab72,_0x402b9a);}}; \ No newline at end of file +var _0xf998=['./whatsappAccount.events','remove','update','removeListener','register','whatsappAccount:'];(function(_0x4ea413,_0x51ff3a){var _0x51cf25=function(_0x3c6456){while(--_0x3c6456){_0x4ea413['push'](_0x4ea413['shift']());}};_0x51cf25(++_0x51ff3a);}(_0xf998,0x1ce));var _0x8f99=function(_0x14e8d3,_0x67e3a){_0x14e8d3=_0x14e8d3-0x0;var _0x1f565b=_0xf998[_0x14e8d3];return _0x1f565b;};'use strict';var WhatsappAccountEvents=require(_0x8f99('0x0'));var events=['save',_0x8f99('0x1'),_0x8f99('0x2')];function createListener(_0xc8923e,_0x3c8c37){return function(_0x526936){_0x3c8c37['emit'](_0xc8923e,_0x526936);};}function removeListener(_0x5b2558,_0x4de4cb){return function(){WhatsappAccountEvents[_0x8f99('0x3')](_0x5b2558,_0x4de4cb);};}exports[_0x8f99('0x4')]=function(_0x3772f0){for(var _0x28afb0=0x0,_0x5d36e7=events['length'];_0x28afb0<_0x5d36e7;_0x28afb0++){var _0x24d402=events[_0x28afb0];var _0x44ad14=createListener(_0x8f99('0x5')+_0x24d402,_0x3772f0);WhatsappAccountEvents['on'](_0x24d402,_0x44ad14);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 062d475..83bc670 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 _0xdfda=['create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','post'];(function(_0x54f192,_0x2b713b){var _0x3c7d1d=function(_0x396290){while(--_0x396290){_0x54f192['push'](_0x54f192['shift']());}};_0x3c7d1d(++_0x2b713b);}(_0xdfda,0x79));var _0xadfd=function(_0x2a7f29,_0x2c89dc){_0x2a7f29=_0x2a7f29-0x0;var _0x38924b=_0xdfda[_0x2a7f29];return _0x38924b;};'use strict';var multer=require(_0xadfd('0x0'));var util=require(_0xadfd('0x1'));var path=require('path');var timeout=require(_0xadfd('0x2'));var express=require('express');var router=express[_0xadfd('0x3')]();var fs_extra=require(_0xadfd('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xadfd('0x5'));var config=require(_0xadfd('0x6'));var controller=require(_0xadfd('0x7'));router[_0xadfd('0x8')]('/',auth[_0xadfd('0x9')](),controller[_0xadfd('0xa')]);router[_0xadfd('0x8')]('/:id',auth[_0xadfd('0x9')](),controller['show']);router[_0xadfd('0xb')]('/',auth[_0xadfd('0x9')](),controller[_0xadfd('0xc')]);router[_0xadfd('0xd')](_0xadfd('0xe'),auth[_0xadfd('0x9')](),controller[_0xadfd('0xf')]);router[_0xadfd('0x10')](_0xadfd('0xe'),auth[_0xadfd('0x9')](),controller[_0xadfd('0x11')]);module[_0xadfd('0x12')]=router; \ No newline at end of file +var _0x0434=['fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0xb77d35,_0x291854){var _0x5389a8=function(_0x52b4d2){while(--_0x52b4d2){_0xb77d35['push'](_0xb77d35['shift']());}};_0x5389a8(++_0x291854);}(_0x0434,0x8e));var _0x4043=function(_0xf26c2e,_0x56c3ea){_0xf26c2e=_0xf26c2e-0x0;var _0x46ecb4=_0x0434[_0xf26c2e];return _0x46ecb4;};'use strict';var multer=require(_0x4043('0x0'));var util=require(_0x4043('0x1'));var path=require(_0x4043('0x2'));var timeout=require('connect-timeout');var express=require(_0x4043('0x3'));var router=express[_0x4043('0x4')]();var fs_extra=require(_0x4043('0x5'));var auth=require(_0x4043('0x6'));var interaction=require(_0x4043('0x7'));var config=require('../../config/environment');var controller=require(_0x4043('0x8'));router['get']('/',auth[_0x4043('0x9')](),controller[_0x4043('0xa')]);router[_0x4043('0xb')](_0x4043('0xc'),auth[_0x4043('0x9')](),controller[_0x4043('0xd')]);router[_0x4043('0xe')]('/',auth[_0x4043('0x9')](),controller[_0x4043('0xf')]);router[_0x4043('0x10')](_0x4043('0xc'),auth[_0x4043('0x9')](),controller[_0x4043('0x11')]);router[_0x4043('0x12')](_0x4043('0xc'),auth[_0x4043('0x9')](),controller[_0x4043('0x13')]);module[_0x4043('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index d1acfb8..65b09b5 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 _0x05a7=['exports','INTEGER','STRING','TEXT','*,*,*,*','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x05a7,0xa1));var _0x705a=function(_0x280820,_0xce9bc7){_0x280820=_0x280820-0x0;var _0x474787=_0x05a7[_0x280820];return _0x474787;};'use strict';var Sequelize=require(_0x705a('0x0'));module[_0x705a('0x1')]={'priority':{'type':Sequelize[_0x705a('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x705a('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x705a('0x4')]()},'description':{'type':Sequelize[_0x705a('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x705a('0x5')}}; \ No newline at end of file +var _0xde05=['*,*,*,*','sequelize','exports','STRING','noop','TEXT'];(function(_0x4a599b,_0x1d2125){var _0x2d53d3=function(_0x5e7982){while(--_0x5e7982){_0x4a599b['push'](_0x4a599b['shift']());}};_0x2d53d3(++_0x1d2125);}(_0xde05,0xe5));var _0x5de0=function(_0xf1a864,_0x4ef342){_0xf1a864=_0xf1a864-0x0;var _0x5b2bef=_0xde05[_0xf1a864];return _0x5b2bef;};'use strict';var Sequelize=require(_0x5de0('0x0'));module[_0x5de0('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x5de0('0x2')],'allowNull':![],'defaultValue':_0x5de0('0x3')},'appdata':{'type':Sequelize[_0x5de0('0x4')]()},'description':{'type':Sequelize[_0x5de0('0x2')]},'interval':{'type':Sequelize[_0x5de0('0x2')],'defaultValue':_0x5de0('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index d94034d..92b67c2 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 _0xfba8=['nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','catch','show','params','rawAttributes','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','map','WhatsappApplication','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfba8,0x1d6));var _0x8fba=function(_0xf4fffc,_0x52b317){_0xf4fffc=_0xf4fffc-0x0;var _0x3a5f43=_0xfba8[_0xf4fffc];return _0x3a5f43;};'use strict';var emlformat=require(_0x8fba('0x0'));var rimraf=require(_0x8fba('0x1'));var zipdir=require(_0x8fba('0x2'));var jsonpatch=require(_0x8fba('0x3'));var rp=require(_0x8fba('0x4'));var moment=require(_0x8fba('0x5'));var BPromise=require(_0x8fba('0x6'));var Mustache=require(_0x8fba('0x7'));var util=require(_0x8fba('0x8'));var path=require('path');var sox=require(_0x8fba('0x9'));var csv=require('to-csv');var ejs=require(_0x8fba('0xa'));var fs=require('fs');var fs_extra=require(_0x8fba('0xb'));var _=require(_0x8fba('0xc'));var squel=require(_0x8fba('0xd'));var crypto=require(_0x8fba('0xe'));var jsforce=require(_0x8fba('0xf'));var deskjs=require(_0x8fba('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8fba('0x11'));var Papa=require('papaparse');var Redis=require(_0x8fba('0x12'));var authService=require(_0x8fba('0x13'));var qs=require(_0x8fba('0x14'));var as=require(_0x8fba('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8fba('0x16'))(_0x8fba('0x17'));var utils=require('../../config/utils');var config=require(_0x8fba('0x18'));var licenseUtil=require(_0x8fba('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e9b9f,_0x468ba7){_0x468ba7=_0x468ba7||0xcc;return function(_0x5b98f7){if(_0x5b98f7){return _0x5e9b9f[_0x8fba('0x1a')](_0x468ba7);}return _0x5e9b9f[_0x8fba('0x1b')](_0x468ba7)[_0x8fba('0x1c')]();};}function respondWithResult(_0x745513,_0x41f4cc){_0x41f4cc=_0x41f4cc||0xc8;return function(_0x3029c4){if(_0x3029c4){return _0x745513['status'](_0x41f4cc)['json'](_0x3029c4);}};}function respondWithFilteredResult(_0x307b94,_0xbd4229){return function(_0x2fa3ed){if(_0x2fa3ed){var _0x56cc5=typeof _0xbd4229[_0x8fba('0x1d')]===_0x8fba('0x1e')&&typeof _0xbd4229['limit']===_0x8fba('0x1e');var _0x389d8a=_0x2fa3ed[_0x8fba('0x1f')];var _0x3194e7=_0x56cc5?0x0:_0xbd4229[_0x8fba('0x1d')];var _0x3aba78=_0x56cc5?_0x2fa3ed[_0x8fba('0x1f')]:_0xbd4229[_0x8fba('0x1d')]+_0xbd4229['limit'];var _0x2564cc;if(_0x3aba78>=_0x389d8a){_0x3aba78=_0x389d8a;_0x2564cc=0xc8;}else{_0x2564cc=0xce;}_0x307b94[_0x8fba('0x1b')](_0x2564cc);return _0x307b94[_0x8fba('0x20')](_0x8fba('0x21'),_0x3194e7+'-'+_0x3aba78+'/'+_0x389d8a)[_0x8fba('0x22')](_0x2fa3ed);}return null;};}function patchUpdates(_0x5a2406){return function(_0xf2aab7){try{jsonpatch[_0x8fba('0x23')](_0xf2aab7,_0x5a2406,!![]);}catch(_0x532406){return BPromise[_0x8fba('0x24')](_0x532406);}return _0xf2aab7['save']();};}function saveUpdates(_0x525c86,_0x38a46e){return function(_0x5bc97a){if(_0x5bc97a){return _0x5bc97a[_0x8fba('0x25')](_0x525c86)[_0x8fba('0x26')](function(_0x393f24){return _0x393f24;});}return null;};}function removeEntity(_0x2f3225,_0x52eebd){return function(_0x31eaee){if(_0x31eaee){return _0x31eaee[_0x8fba('0x27')]()[_0x8fba('0x26')](function(){_0x2f3225['status'](0xcc)[_0x8fba('0x1c')]();});}};}function handleEntityNotFound(_0x5030c4,_0x35e22e){return function(_0x11bcd6){if(!_0x11bcd6){_0x5030c4[_0x8fba('0x1a')](0x194);}return _0x11bcd6;};}function handleError(_0x4c644d,_0x52eea9){_0x52eea9=_0x52eea9||0x1f4;return function(_0x38ad81){logger[_0x8fba('0x28')](_0x38ad81[_0x8fba('0x29')]);if(_0x38ad81[_0x8fba('0x2a')]){delete _0x38ad81[_0x8fba('0x2a')];}_0x4c644d[_0x8fba('0x1b')](_0x52eea9)['send'](_0x38ad81);};}exports['index']=function(_0x877157,_0x434e9e){var _0x3f0c26={},_0x20fd52={},_0xddc9f6={'count':0x0,'rows':[]};var _0x118a1e=_[_0x8fba('0x2b')](db[_0x8fba('0x2c')]['rawAttributes'],function(_0x16baa3){return{'name':_0x16baa3['fieldName'],'type':_0x16baa3[_0x8fba('0x2d')][_0x8fba('0x2e')]};});_0x20fd52[_0x8fba('0x2f')]=_[_0x8fba('0x2b')](_0x118a1e,_0x8fba('0x2a'));_0x20fd52[_0x8fba('0x30')]=_[_0x8fba('0x31')](_0x877157['query']);_0x20fd52['filters']=_[_0x8fba('0x32')](_0x20fd52[_0x8fba('0x2f')],_0x20fd52[_0x8fba('0x30')]);_0x3f0c26[_0x8fba('0x33')]=_['intersection'](_0x20fd52[_0x8fba('0x2f')],qs[_0x8fba('0x34')](_0x877157[_0x8fba('0x30')][_0x8fba('0x34')]));_0x3f0c26[_0x8fba('0x33')]=_0x3f0c26[_0x8fba('0x33')][_0x8fba('0x35')]?_0x3f0c26[_0x8fba('0x33')]:_0x20fd52[_0x8fba('0x2f')];if(!_0x877157[_0x8fba('0x30')][_0x8fba('0x36')](_0x8fba('0x37'))){_0x3f0c26[_0x8fba('0x38')]=qs[_0x8fba('0x38')](_0x877157[_0x8fba('0x30')][_0x8fba('0x38')]);_0x3f0c26['offset']=qs[_0x8fba('0x1d')](_0x877157[_0x8fba('0x30')][_0x8fba('0x1d')]);}_0x3f0c26[_0x8fba('0x39')]=qs[_0x8fba('0x3a')](_0x877157['query'][_0x8fba('0x3a')]);_0x3f0c26[_0x8fba('0x3b')]=qs[_0x8fba('0x3c')](_[_0x8fba('0x3d')](_0x877157['query'],_0x20fd52[_0x8fba('0x3c')]),_0x118a1e);if(_0x877157['query'][_0x8fba('0x3e')]){_0x3f0c26[_0x8fba('0x3b')]=_[_0x8fba('0x3f')](_0x3f0c26[_0x8fba('0x3b')],{'$or':_[_0x8fba('0x2b')](_0x118a1e,function(_0x33fd3f){if(_0x33fd3f['type']!==_0x8fba('0x40')){var _0x3057c8={};_0x3057c8[_0x33fd3f[_0x8fba('0x2a')]]={'$like':'%'+_0x877157[_0x8fba('0x30')][_0x8fba('0x3e')]+'%'};return _0x3057c8;}})});}_0x3f0c26=_[_0x8fba('0x3f')]({},_0x3f0c26,_0x877157[_0x8fba('0x41')]);var _0x9ed192={'where':_0x3f0c26[_0x8fba('0x3b')]};return db[_0x8fba('0x2c')][_0x8fba('0x1f')](_0x9ed192)[_0x8fba('0x26')](function(_0x17d9e3){_0xddc9f6[_0x8fba('0x1f')]=_0x17d9e3;if(_0x877157[_0x8fba('0x30')]['includeAll']){_0x3f0c26['include']=[{'all':!![]}];}return db[_0x8fba('0x2c')][_0x8fba('0x42')](_0x3f0c26);})['then'](function(_0x1b7478){_0xddc9f6['rows']=_0x1b7478;return _0xddc9f6;})['then'](respondWithFilteredResult(_0x434e9e,_0x3f0c26))[_0x8fba('0x43')](handleError(_0x434e9e,null));};exports[_0x8fba('0x44')]=function(_0xb30023,_0x35605c){var _0x572538={'raw':!![],'where':{'id':_0xb30023[_0x8fba('0x45')]['id']}},_0x6140ca={};_0x6140ca[_0x8fba('0x2f')]=_[_0x8fba('0x31')](db['WhatsappApplication'][_0x8fba('0x46')]);_0x6140ca[_0x8fba('0x30')]=_[_0x8fba('0x31')](_0xb30023[_0x8fba('0x30')]);_0x6140ca[_0x8fba('0x3c')]=_['intersection'](_0x6140ca[_0x8fba('0x2f')],_0x6140ca[_0x8fba('0x30')]);_0x572538[_0x8fba('0x33')]=_['intersection'](_0x6140ca[_0x8fba('0x2f')],qs['fields'](_0xb30023[_0x8fba('0x30')][_0x8fba('0x34')]));_0x572538[_0x8fba('0x33')]=_0x572538[_0x8fba('0x33')][_0x8fba('0x35')]?_0x572538[_0x8fba('0x33')]:_0x6140ca[_0x8fba('0x2f')];if(_0xb30023[_0x8fba('0x30')][_0x8fba('0x47')]){_0x572538['include']=[{'all':!![]}];}_0x572538=_[_0x8fba('0x3f')]({},_0x572538,_0xb30023['options']);return db[_0x8fba('0x2c')][_0x8fba('0x48')](_0x572538)[_0x8fba('0x26')](handleEntityNotFound(_0x35605c,null))['then'](respondWithResult(_0x35605c,null))[_0x8fba('0x43')](handleError(_0x35605c,null));};exports[_0x8fba('0x49')]=function(_0x2102bc,_0xce6a3){return db[_0x8fba('0x2c')][_0x8fba('0x49')](_0x2102bc['body'],{})['then'](respondWithResult(_0xce6a3,0xc9))['catch'](handleError(_0xce6a3,null));};exports[_0x8fba('0x25')]=function(_0x311776,_0x482b13){if(_0x311776['body']['id']){delete _0x311776['body']['id'];}return db['WhatsappApplication'][_0x8fba('0x48')]({'where':{'id':_0x311776[_0x8fba('0x45')]['id']}})[_0x8fba('0x26')](handleEntityNotFound(_0x482b13,null))['then'](saveUpdates(_0x311776[_0x8fba('0x4a')],null))['then'](respondWithResult(_0x482b13,null))[_0x8fba('0x43')](handleError(_0x482b13,null));};exports[_0x8fba('0x27')]=function(_0x1ef167,_0x13701a){return db[_0x8fba('0x2c')][_0x8fba('0x48')]({'where':{'id':_0x1ef167[_0x8fba('0x45')]['id']}})[_0x8fba('0x26')](handleEntityNotFound(_0x13701a,null))['then'](removeEntity(_0x13701a,null))['catch'](handleError(_0x13701a,null));}; \ No newline at end of file +var _0x1f92=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','WhatsappApplication','include','findAll','rows','catch','show','params','includeAll','options','create','body','find','destroy','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x462178,_0x462844){var _0x345c86=function(_0x49a945){while(--_0x49a945){_0x462178['push'](_0x462178['shift']());}};_0x345c86(++_0x462844);}(_0x1f92,0x1ad));var _0x21f9=function(_0x31865f,_0x419a18){_0x31865f=_0x31865f-0x0;var _0x2517fb=_0x1f92[_0x31865f];return _0x2517fb;};'use strict';var emlformat=require(_0x21f9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x21f9('0x1'));var jsonpatch=require(_0x21f9('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x21f9('0x3'));var Mustache=require(_0x21f9('0x4'));var util=require(_0x21f9('0x5'));var path=require(_0x21f9('0x6'));var sox=require(_0x21f9('0x7'));var csv=require(_0x21f9('0x8'));var ejs=require(_0x21f9('0x9'));var fs=require('fs');var fs_extra=require(_0x21f9('0xa'));var _=require(_0x21f9('0xb'));var squel=require(_0x21f9('0xc'));var crypto=require(_0x21f9('0xd'));var jsforce=require(_0x21f9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x21f9('0x8'));var querystring=require(_0x21f9('0xf'));var Papa=require(_0x21f9('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x21f9('0x11'));var as=require(_0x21f9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x21f9('0x13'))(_0x21f9('0x14'));var utils=require(_0x21f9('0x15'));var config=require(_0x21f9('0x16'));var licenseUtil=require(_0x21f9('0x17'));var db=require(_0x21f9('0x18'))['db'];function respondWithStatusCode(_0x18792d,_0x1cc83a){_0x1cc83a=_0x1cc83a||0xcc;return function(_0x2c47ac){if(_0x2c47ac){return _0x18792d['sendStatus'](_0x1cc83a);}return _0x18792d['status'](_0x1cc83a)[_0x21f9('0x19')]();};}function respondWithResult(_0x484a74,_0x3eae30){_0x3eae30=_0x3eae30||0xc8;return function(_0x2f550a){if(_0x2f550a){return _0x484a74[_0x21f9('0x1a')](_0x3eae30)[_0x21f9('0x1b')](_0x2f550a);}};}function respondWithFilteredResult(_0x337c0c,_0x292c43){return function(_0x12b70c){if(_0x12b70c){var _0x4c1fb6=typeof _0x292c43[_0x21f9('0x1c')]===_0x21f9('0x1d')&&typeof _0x292c43[_0x21f9('0x1e')]===_0x21f9('0x1d');var _0x5284e9=_0x12b70c[_0x21f9('0x1f')];var _0x219bf5=_0x4c1fb6?0x0:_0x292c43[_0x21f9('0x1c')];var _0x1ad569=_0x4c1fb6?_0x12b70c[_0x21f9('0x1f')]:_0x292c43[_0x21f9('0x1c')]+_0x292c43[_0x21f9('0x1e')];var _0x250964;if(_0x1ad569>=_0x5284e9){_0x1ad569=_0x5284e9;_0x250964=0xc8;}else{_0x250964=0xce;}_0x337c0c[_0x21f9('0x1a')](_0x250964);return _0x337c0c[_0x21f9('0x20')](_0x21f9('0x21'),_0x219bf5+'-'+_0x1ad569+'/'+_0x5284e9)[_0x21f9('0x1b')](_0x12b70c);}return null;};}function patchUpdates(_0x14080){return function(_0x3e9cc6){try{jsonpatch['apply'](_0x3e9cc6,_0x14080,!![]);}catch(_0x4011c2){return BPromise[_0x21f9('0x22')](_0x4011c2);}return _0x3e9cc6[_0x21f9('0x23')]();};}function saveUpdates(_0x51151f,_0x57427f){return function(_0xdb64b8){if(_0xdb64b8){return _0xdb64b8[_0x21f9('0x24')](_0x51151f)[_0x21f9('0x25')](function(_0x5a65a7){return _0x5a65a7;});}return null;};}function removeEntity(_0x2d6992,_0x264d0c){return function(_0x270fa5){if(_0x270fa5){return _0x270fa5['destroy']()[_0x21f9('0x25')](function(){_0x2d6992[_0x21f9('0x1a')](0xcc)[_0x21f9('0x19')]();});}};}function handleEntityNotFound(_0x57bd4d,_0x115f72){return function(_0x3bff9d){if(!_0x3bff9d){_0x57bd4d['sendStatus'](0x194);}return _0x3bff9d;};}function handleError(_0x18e259,_0x62e29f){_0x62e29f=_0x62e29f||0x1f4;return function(_0x14731e){logger[_0x21f9('0x26')](_0x14731e[_0x21f9('0x27')]);if(_0x14731e[_0x21f9('0x28')]){delete _0x14731e[_0x21f9('0x28')];}_0x18e259['status'](_0x62e29f)['send'](_0x14731e);};}exports[_0x21f9('0x29')]=function(_0x3bae65,_0x4a451b){var _0x5a2767={},_0x4527e4={},_0x3d98f2={'count':0x0,'rows':[]};var _0x19de8d=_[_0x21f9('0x2a')](db['WhatsappApplication'][_0x21f9('0x2b')],function(_0x5f4b31){return{'name':_0x5f4b31[_0x21f9('0x2c')],'type':_0x5f4b31[_0x21f9('0x2d')][_0x21f9('0x2e')]};});_0x4527e4[_0x21f9('0x2f')]=_[_0x21f9('0x2a')](_0x19de8d,_0x21f9('0x28'));_0x4527e4[_0x21f9('0x30')]=_[_0x21f9('0x31')](_0x3bae65[_0x21f9('0x30')]);_0x4527e4[_0x21f9('0x32')]=_['intersection'](_0x4527e4[_0x21f9('0x2f')],_0x4527e4[_0x21f9('0x30')]);_0x5a2767[_0x21f9('0x33')]=_[_0x21f9('0x34')](_0x4527e4[_0x21f9('0x2f')],qs[_0x21f9('0x35')](_0x3bae65[_0x21f9('0x30')]['fields']));_0x5a2767[_0x21f9('0x33')]=_0x5a2767['attributes'][_0x21f9('0x36')]?_0x5a2767[_0x21f9('0x33')]:_0x4527e4['model'];if(!_0x3bae65[_0x21f9('0x30')][_0x21f9('0x37')]('nolimit')){_0x5a2767[_0x21f9('0x1e')]=qs[_0x21f9('0x1e')](_0x3bae65[_0x21f9('0x30')][_0x21f9('0x1e')]);_0x5a2767[_0x21f9('0x1c')]=qs[_0x21f9('0x1c')](_0x3bae65['query'][_0x21f9('0x1c')]);}_0x5a2767['order']=qs[_0x21f9('0x38')](_0x3bae65['query'][_0x21f9('0x38')]);_0x5a2767['where']=qs[_0x21f9('0x32')](_[_0x21f9('0x39')](_0x3bae65[_0x21f9('0x30')],_0x4527e4[_0x21f9('0x32')]),_0x19de8d);if(_0x3bae65[_0x21f9('0x30')][_0x21f9('0x3a')]){_0x5a2767[_0x21f9('0x3b')]=_[_0x21f9('0x3c')](_0x5a2767[_0x21f9('0x3b')],{'$or':_[_0x21f9('0x2a')](_0x19de8d,function(_0x41f4ec){if(_0x41f4ec['type']!==_0x21f9('0x3d')){var _0x3303ad={};_0x3303ad[_0x41f4ec[_0x21f9('0x28')]]={'$like':'%'+_0x3bae65['query'][_0x21f9('0x3a')]+'%'};return _0x3303ad;}})});}_0x5a2767=_['merge']({},_0x5a2767,_0x3bae65['options']);var _0x277821={'where':_0x5a2767[_0x21f9('0x3b')]};return db[_0x21f9('0x3e')][_0x21f9('0x1f')](_0x277821)[_0x21f9('0x25')](function(_0x2275d4){_0x3d98f2['count']=_0x2275d4;if(_0x3bae65[_0x21f9('0x30')]['includeAll']){_0x5a2767[_0x21f9('0x3f')]=[{'all':!![]}];}return db[_0x21f9('0x3e')][_0x21f9('0x40')](_0x5a2767);})['then'](function(_0xce7516){_0x3d98f2[_0x21f9('0x41')]=_0xce7516;return _0x3d98f2;})['then'](respondWithFilteredResult(_0x4a451b,_0x5a2767))[_0x21f9('0x42')](handleError(_0x4a451b,null));};exports[_0x21f9('0x43')]=function(_0x38d0ba,_0x456dcf){var _0x401a87={'raw':!![],'where':{'id':_0x38d0ba[_0x21f9('0x44')]['id']}},_0x3f84c2={};_0x3f84c2[_0x21f9('0x2f')]=_[_0x21f9('0x31')](db[_0x21f9('0x3e')]['rawAttributes']);_0x3f84c2[_0x21f9('0x30')]=_[_0x21f9('0x31')](_0x38d0ba['query']);_0x3f84c2[_0x21f9('0x32')]=_['intersection'](_0x3f84c2['model'],_0x3f84c2[_0x21f9('0x30')]);_0x401a87[_0x21f9('0x33')]=_[_0x21f9('0x34')](_0x3f84c2[_0x21f9('0x2f')],qs[_0x21f9('0x35')](_0x38d0ba[_0x21f9('0x30')][_0x21f9('0x35')]));_0x401a87[_0x21f9('0x33')]=_0x401a87[_0x21f9('0x33')][_0x21f9('0x36')]?_0x401a87[_0x21f9('0x33')]:_0x3f84c2[_0x21f9('0x2f')];if(_0x38d0ba[_0x21f9('0x30')][_0x21f9('0x45')]){_0x401a87[_0x21f9('0x3f')]=[{'all':!![]}];}_0x401a87=_[_0x21f9('0x3c')]({},_0x401a87,_0x38d0ba[_0x21f9('0x46')]);return db[_0x21f9('0x3e')]['find'](_0x401a87)[_0x21f9('0x25')](handleEntityNotFound(_0x456dcf,null))['then'](respondWithResult(_0x456dcf,null))[_0x21f9('0x42')](handleError(_0x456dcf,null));};exports[_0x21f9('0x47')]=function(_0x2a93a5,_0x5af822){return db[_0x21f9('0x3e')][_0x21f9('0x47')](_0x2a93a5[_0x21f9('0x48')],{})[_0x21f9('0x25')](respondWithResult(_0x5af822,0xc9))[_0x21f9('0x42')](handleError(_0x5af822,null));};exports[_0x21f9('0x24')]=function(_0x43d800,_0x51f7bf){if(_0x43d800[_0x21f9('0x48')]['id']){delete _0x43d800['body']['id'];}return db[_0x21f9('0x3e')][_0x21f9('0x49')]({'where':{'id':_0x43d800['params']['id']}})[_0x21f9('0x25')](handleEntityNotFound(_0x51f7bf,null))[_0x21f9('0x25')](saveUpdates(_0x43d800[_0x21f9('0x48')],null))[_0x21f9('0x25')](respondWithResult(_0x51f7bf,null))[_0x21f9('0x42')](handleError(_0x51f7bf,null));};exports[_0x21f9('0x4a')]=function(_0x5b592c,_0xcb5cfc){return db[_0x21f9('0x3e')][_0x21f9('0x49')]({'where':{'id':_0x5b592c[_0x21f9('0x44')]['id']}})[_0x21f9('0x25')](handleEntityNotFound(_0xcb5cfc,null))['then'](removeEntity(_0xcb5cfc,null))[_0x21f9('0x42')](handleError(_0xcb5cfc,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 1f603a7..bfb2e92 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 _0xfd2f=['lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./whatsappApplication.attributes','define','WhatsappApplication','utf8mb4'];(function(_0x32d9b4,_0x3910da){var _0x365287=function(_0x5393dc){while(--_0x5393dc){_0x32d9b4['push'](_0x32d9b4['shift']());}};_0x365287(++_0x3910da);}(_0xfd2f,0x14a));var _0xffd2=function(_0x96f17e,_0xcaa2ba){_0x96f17e=_0x96f17e-0x0;var _0x378b0d=_0xfd2f[_0x96f17e];return _0x378b0d;};'use strict';var _=require(_0xffd2('0x0'));var util=require(_0xffd2('0x1'));var logger=require(_0xffd2('0x2'))('api');var moment=require(_0xffd2('0x3'));var BPromise=require('bluebird');var rp=require(_0xffd2('0x4'));var fs=require('fs');var path=require(_0xffd2('0x5'));var rimraf=require('rimraf');var config=require(_0xffd2('0x6'));var attributes=require(_0xffd2('0x7'));module['exports']=function(_0x5955d2,_0x490a28){return _0x5955d2[_0xffd2('0x8')](_0xffd2('0x9'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xffd2('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf021=['moment','request-promise','rimraf','../../config/environment','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x53ad58,_0x3fb489){var _0x554b03=function(_0x5769ba){while(--_0x5769ba){_0x53ad58['push'](_0x53ad58['shift']());}};_0x554b03(++_0x3fb489);}(_0xf021,0x18f));var _0x1f02=function(_0x1bfe44,_0x4e410e){_0x1bfe44=_0x1bfe44-0x0;var _0x1103cb=_0xf021[_0x1bfe44];return _0x1103cb;};'use strict';var _=require(_0x1f02('0x0'));var util=require(_0x1f02('0x1'));var logger=require(_0x1f02('0x2'))(_0x1f02('0x3'));var moment=require(_0x1f02('0x4'));var BPromise=require('bluebird');var rp=require(_0x1f02('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f02('0x6'));var config=require(_0x1f02('0x7'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x84a8f0,_0x56b275){return _0x84a8f0[_0x1f02('0x8')](_0x1f02('0x9'),attributes,{'tableName':_0x1f02('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1f02('0xb'),'collate':_0x1f02('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 352868f..aaa0770 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 _0xd6d6=['WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5dc37e,_0x1dbe62){var _0x309df9=function(_0x4b4a61){while(--_0x4b4a61){_0x5dc37e['push'](_0x5dc37e['shift']());}};_0x309df9(++_0x1dbe62);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x35063d,_0x4d03f3){_0x35063d=_0x35063d-0x0;var _0x20d55d=_0xd6d6[_0x35063d];return _0x20d55d;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var moment=require(_0x6d6d('0x2'));var BPromise=require(_0x6d6d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d6d('0x4'));var db=require(_0x6d6d('0x5'))['db'];var utils=require(_0x6d6d('0x6'));var logger=require(_0x6d6d('0x7'))(_0x6d6d('0x8'));var config=require(_0x6d6d('0x9'));var jayson=require(_0x6d6d('0xa'));var client=jayson['client'][_0x6d6d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bf731,_0x44f83d,_0x18f824){return new BPromise(function(_0xd49f57,_0x408f88){return client[_0x6d6d('0xc')](_0x1bf731,_0x18f824)['then'](function(_0x51dd38){logger[_0x6d6d('0xd')](_0x6d6d('0xe'),_0x44f83d,_0x6d6d('0xf'));logger[_0x6d6d('0x10')](_0x6d6d('0x11'),_0x44f83d,'request\x20sent',JSON[_0x6d6d('0x12')](_0x51dd38));if(_0x51dd38[_0x6d6d('0x13')]){if(_0x51dd38['error']['code']===0x1f4){logger[_0x6d6d('0x13')](_0x6d6d('0xe'),_0x44f83d,_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);return _0x408f88(_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);}logger[_0x6d6d('0x13')](_0x6d6d('0xe'),_0x44f83d,_0x51dd38['error'][_0x6d6d('0x14')]);return _0xd49f57(_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);}else{logger[_0x6d6d('0xd')](_0x6d6d('0xe'),_0x44f83d,'request\x20sent');_0xd49f57(_0x51dd38[_0x6d6d('0x15')]['message']);}})[_0x6d6d('0x16')](function(_0x2cbc86){logger[_0x6d6d('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x44f83d,_0x2cbc86);_0x408f88(_0x2cbc86);});});} \ No newline at end of file +var _0x54ef=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x133a93,_0x556f65){var _0x2b7240=function(_0x138a65){while(--_0x138a65){_0x133a93['push'](_0x133a93['shift']());}};_0x2b7240(++_0x556f65);}(_0x54ef,0x112));var _0xf54e=function(_0x37ae56,_0x2414bc){_0x37ae56=_0x37ae56-0x0;var _0x5ce697=_0x54ef[_0x37ae56];return _0x5ce697;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x99cf9,_0x2464ae,_0x561870){return new BPromise(function(_0x27e69b,_0x57a1ce){return client[_0xf54e('0xb')](_0x99cf9,_0x561870)[_0xf54e('0xc')](function(_0x47c5e1){logger[_0xf54e('0xd')](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));logger[_0xf54e('0x10')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x2464ae,_0xf54e('0xf'),JSON[_0xf54e('0x11')](_0x47c5e1));if(_0x47c5e1[_0xf54e('0x12')]){if(_0x47c5e1[_0xf54e('0x12')]['code']===0x1f4){logger[_0xf54e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2464ae,_0x47c5e1['error'][_0xf54e('0x13')]);return _0x57a1ce(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}logger[_0xf54e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2464ae,_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);return _0x27e69b(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}else{logger['info'](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));_0x27e69b(_0x47c5e1[_0xf54e('0x14')]['message']);}})['catch'](function(_0xd87020){logger[_0xf54e('0x12')](_0xf54e('0xe'),_0x2464ae,_0xd87020);_0x57a1ce(_0xd87020);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 6a39c39..9a9e160 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 _0x5fc3=['whatsapp','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','removeTags','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','describe','/:id','show','getMessages','/:id/download','post','/:id/messages','addMessage','/:id/tags','tracked'];(function(_0x477d8d,_0x7c8f3f){var _0xb40319=function(_0x2631df){while(--_0x2631df){_0x477d8d['push'](_0x477d8d['shift']());}};_0xb40319(++_0x7c8f3f);}(_0x5fc3,0xa8));var _0x35fc=function(_0x7b173,_0x539d7f){_0x7b173=_0x7b173-0x0;var _0x1c598c=_0x5fc3[_0x7b173];return _0x1c598c;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/messages',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['download']);router[_0x35fc('0x10')]('/',auth[_0x35fc('0xa')](),controller['create']);router['post'](_0x35fc('0x11'),auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x10')](_0x35fc('0x13'),auth[_0x35fc('0xa')](),interaction[_0x35fc('0x14')]('whatsapp','whatsappinteraction:addtags'),controller['addTags']);router['put'](_0x35fc('0xc'),auth[_0x35fc('0xa')](),interaction[_0x35fc('0x14')](_0x35fc('0x15'),_0x35fc('0x16')),controller[_0x35fc('0x17')]);router['delete'](_0x35fc('0xc'),auth[_0x35fc('0xa')](),interaction['tracked'](_0x35fc('0x15'),_0x35fc('0x18')),controller[_0x35fc('0x19')]);router['delete'](_0x35fc('0x13'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xc9c3=['../../config/environment','./whatsappInteraction.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','post','create','whatsapp','addTags','put','tracked','whatsappinteraction:destroy','destroy','delete','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2afbbb,_0x3d8dbf){var _0x9fe2ac=function(_0x45fd8f){while(--_0x45fd8f){_0x2afbbb['push'](_0x2afbbb['shift']());}};_0x9fe2ac(++_0x3d8dbf);}(_0xc9c3,0x96));var _0x3c9c=function(_0x2ffc71,_0x5c4a24){_0x2ffc71=_0x2ffc71-0x0;var _0x10136b=_0xc9c3[_0x2ffc71];return _0x10136b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3c9c('0x0'));var timeout=require('connect-timeout');var express=require(_0x3c9c('0x1'));var router=express[_0x3c9c('0x2')]();var fs_extra=require(_0x3c9c('0x3'));var auth=require(_0x3c9c('0x4'));var interaction=require(_0x3c9c('0x5'));var config=require(_0x3c9c('0x6'));var controller=require(_0x3c9c('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x3c9c('0x8')](_0x3c9c('0x9'),auth[_0x3c9c('0xa')](),controller[_0x3c9c('0xb')]);router[_0x3c9c('0x8')](_0x3c9c('0xc'),auth[_0x3c9c('0xa')](),controller[_0x3c9c('0xd')]);router[_0x3c9c('0x8')](_0x3c9c('0xe'),auth['isAuthenticated'](),controller[_0x3c9c('0xf')]);router[_0x3c9c('0x8')]('/:id/download',auth[_0x3c9c('0xa')](),controller['download']);router[_0x3c9c('0x10')]('/',auth[_0x3c9c('0xa')](),controller[_0x3c9c('0x11')]);router[_0x3c9c('0x10')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0x3c9c('0x10')]('/:id/tags',auth['isAuthenticated'](),interaction['tracked'](_0x3c9c('0x12'),'whatsappinteraction:addtags'),controller[_0x3c9c('0x13')]);router[_0x3c9c('0x14')](_0x3c9c('0xc'),auth[_0x3c9c('0xa')](),interaction['tracked'](_0x3c9c('0x12'),'whatsappinteraction:update'),controller['update']);router['delete'](_0x3c9c('0xc'),auth[_0x3c9c('0xa')](),interaction[_0x3c9c('0x15')](_0x3c9c('0x12'),_0x3c9c('0x16')),controller[_0x3c9c('0x17')]);router[_0x3c9c('0x18')]('/:id/tags',auth[_0x3c9c('0xa')](),controller['removeTags']);module[_0x3c9c('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 1adb14d..b4cb0bf 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 _0x0967=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x23a5bb,_0x170533){var _0x363dc5=function(_0x72e90b){while(--_0x72e90b){_0x23a5bb['push'](_0x23a5bb['shift']());}};_0x363dc5(++_0x170533);}(_0x0967,0x100));var _0x7096=function(_0x26fd39,_0x4bd16d){_0x26fd39=_0x26fd39-0x0;var _0x1bf88b=_0x0967[_0x26fd39];return _0x1bf88b;};'use strict';var Sequelize=require(_0x7096('0x0'));var moment=require('moment');module[_0x7096('0x1')]={'closed':{'type':Sequelize[_0x7096('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7096('0x3')]},'disposition':{'type':Sequelize[_0x7096('0x4')]},'secondDisposition':{'type':Sequelize[_0x7096('0x4')]},'thirdDisposition':{'type':Sequelize[_0x7096('0x4')]},'note':{'type':Sequelize[_0x7096('0x4')]},'phone':{'type':Sequelize[_0x7096('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x7096('0x5')]('in',_0x7096('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7096('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x7096('0x5')]('in',_0x7096('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x7096('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xba18=['ENUM','out','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x412497,_0x4a42f3){var _0x1024d4=function(_0x18496f){while(--_0x18496f){_0x412497['push'](_0x412497['shift']());}};_0x1024d4(++_0x4a42f3);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8ba1('0x0'));var moment=require(_0x8ba1('0x1'));module[_0x8ba1('0x2')]={'closed':{'type':Sequelize[_0x8ba1('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8ba1('0x4')]},'disposition':{'type':Sequelize[_0x8ba1('0x5')]},'secondDisposition':{'type':Sequelize[_0x8ba1('0x5')]},'thirdDisposition':{'type':Sequelize[_0x8ba1('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x8ba1('0x5')]},'read1stAt':{'type':Sequelize[_0x8ba1('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x8ba1('0x6')]('in',_0x8ba1('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8ba1('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x8ba1('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8ba1('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 2dd07df..f6a4f95 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 _0xfb0b=['cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','expr','search','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','some','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','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','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','user','toString','sequelize','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.email','c.phone','c.mobile','Contact.mobile','Contact.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','WhatsappInteractionId','all','rows','params','includeAll','include','options','create','body','update','describe','addMessage','ids','omit','getMessages','findOne','WhatsappMessage','nolimit','filter','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','whatsappInteractionTags:save','removeTags','download','unix','root','server','tmp','files','attachments','join','transcript-%d-%s.zip','User','CmContact','firstName','lastName','Attachment','Messages','direction','secret','Account','Owner','get','mkdirSync','N.A.','closedAt','basename','existsSync','pipe','createWriteStream','out','System','renderFile','views','downloadInteraction.ejs','transcript-','Whatsapp','createPdfFromHTML','log','err','eml-format','rimraf','zip-dir','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','save','destroy','error','stack','name','send','Users','map','fullname','split','forEach','Tags','push','TagIds','then','catch','waiting','talking','answered','unmanaged','total','closed','UserId','WhatsappInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId'];(function(_0x524300,_0x2ec98a){var _0x307f20=function(_0x2d57b4){while(--_0x2d57b4){_0x524300['push'](_0x524300['shift']());}};_0x307f20(++_0x2ec98a);}(_0xfb0b,0x94));var _0xbfb0=function(_0x1909e8,_0x54156f){_0x1909e8=_0x1909e8-0x0;var _0x519993=_0xfb0b[_0x1909e8];return _0x519993;};'use strict';var emlformat=require(_0xbfb0('0x0'));var rimraf=require(_0xbfb0('0x1'));var zipdir=require(_0xbfb0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbfb0('0x3'));var moment=require(_0xbfb0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbfb0('0x5'));var path=require('path');var sox=require(_0xbfb0('0x6'));var csv=require(_0xbfb0('0x7'));var ejs=require(_0xbfb0('0x8'));var fs=require('fs');var fs_extra=require(_0xbfb0('0x9'));var _=require(_0xbfb0('0xa'));var squel=require(_0xbfb0('0xb'));var crypto=require('crypto');var jsforce=require(_0xbfb0('0xc'));var deskjs=require(_0xbfb0('0xd'));var toCsv=require(_0xbfb0('0x7'));var querystring=require(_0xbfb0('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbfb0('0xf'));var pdf=require(_0xbfb0('0x10'));var hardwareService=require(_0xbfb0('0x11'));var logger=require('../../config/logger')(_0xbfb0('0x12'));var utils=require('../../config/utils');var config=require(_0xbfb0('0x13'));var licenseUtil=require(_0xbfb0('0x14'));var db=require(_0xbfb0('0x15'))['db'];config[_0xbfb0('0x16')]=_[_0xbfb0('0x17')](config[_0xbfb0('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xbfb0('0x18'))(new Redis(config['redis']));require('./whatsappInteraction.socket')['register'](socket);function respondWithStatusCode(_0x141e62,_0x2c9768){_0x2c9768=_0x2c9768||0xcc;return function(_0x198001){if(_0x198001){return _0x141e62[_0xbfb0('0x19')](_0x2c9768);}return _0x141e62[_0xbfb0('0x1a')](_0x2c9768)[_0xbfb0('0x1b')]();};}function respondWithResult(_0x2470cf,_0x2d8773){_0x2d8773=_0x2d8773||0xc8;return function(_0x315b80){if(_0x315b80){return _0x2470cf[_0xbfb0('0x1a')](_0x2d8773)[_0xbfb0('0x1c')](_0x315b80);}};}function respondWithFilteredResult(_0x4e48b1,_0x5c8a1e){return function(_0x3319a1){if(_0x3319a1){var _0x3b0a50=typeof _0x5c8a1e['offset']===_0xbfb0('0x1d')&&typeof _0x5c8a1e[_0xbfb0('0x1e')]==='undefined';var _0x3834a6=_0x3319a1['count'];var _0x5172c5=_0x3b0a50?0x0:_0x5c8a1e[_0xbfb0('0x1f')];var _0xf52bd5=_0x3b0a50?_0x3319a1[_0xbfb0('0x20')]:_0x5c8a1e['offset']+_0x5c8a1e[_0xbfb0('0x1e')];var _0x5219c3;if(_0xf52bd5>=_0x3834a6){_0xf52bd5=_0x3834a6;_0x5219c3=0xc8;}else{_0x5219c3=0xce;}_0x4e48b1[_0xbfb0('0x1a')](_0x5219c3);return _0x4e48b1['set'](_0xbfb0('0x21'),_0x5172c5+'-'+_0xf52bd5+'/'+_0x3834a6)['json'](_0x3319a1);}return null;};}function patchUpdates(_0x2fe191){return function(_0x4f5626){try{jsonpatch[_0xbfb0('0x22')](_0x4f5626,_0x2fe191,!![]);}catch(_0x19e16d){return BPromise[_0xbfb0('0x23')](_0x19e16d);}return _0x4f5626[_0xbfb0('0x24')]();};}function saveUpdates(_0x515d0f,_0x2efb2a){return function(_0x17f46c){if(_0x17f46c){return _0x17f46c['update'](_0x515d0f)['then'](function(_0x1625e3){return _0x1625e3;});}return null;};}function removeEntity(_0x1e4a2e,_0x39c5f8){return function(_0x52e7e5){if(_0x52e7e5){return _0x52e7e5[_0xbfb0('0x25')]()['then'](function(){_0x1e4a2e[_0xbfb0('0x1a')](0xcc)[_0xbfb0('0x1b')]();});}};}function handleEntityNotFound(_0x250ce8,_0x402db3){return function(_0x1ecd46){if(!_0x1ecd46){_0x250ce8[_0xbfb0('0x19')](0x194);}return _0x1ecd46;};}function handleError(_0xb41263,_0x57ab45){_0x57ab45=_0x57ab45||0x1f4;return function(_0xb2a68d){logger[_0xbfb0('0x26')](_0xb2a68d[_0xbfb0('0x27')]);if(_0xb2a68d[_0xbfb0('0x28')]){delete _0xb2a68d['name'];}_0xb41263[_0xbfb0('0x1a')](_0x57ab45)[_0xbfb0('0x29')](_0xb2a68d);};}function getInteractionUsers(_0x4e511c,_0x188c90){return new BPromise(function(_0x6ba12c,_0x41ad24){try{if(_0x188c90[_0x4e511c['id']]){_0x4e511c[_0xbfb0('0x2a')]=_[_0xbfb0('0x2b')](_0x188c90[_0x4e511c['id']],function(_0x43c59f){return{'id':_0x43c59f['id'],'fullname':_0x43c59f[_0xbfb0('0x2c')]};});}}catch(_0x1a9fe2){_0x41ad24(_0x1a9fe2);}_0x6ba12c(_0x4e511c);});}function getInteractionTags(_0x3f7353,_0x21fd7f){return new BPromise(function(_0x949810,_0x258423){try{if(_0x3f7353['TagIds']){_0x3f7353['Tags']=[];_0x3f7353['TagIds'][_0xbfb0('0x2d')](',')[_0xbfb0('0x2e')](function(_0x464c87){_0x3f7353[_0xbfb0('0x2f')][_0xbfb0('0x30')](_0x21fd7f[_0x464c87]);});}delete _0x3f7353[_0xbfb0('0x31')];}catch(_0xa85f10){_0x258423(_0xa85f10);}_0x949810(_0x3f7353);});}function updateWhatsappInteraction(_0x3ddc06,_0x4aa181,_0x586537){return new BPromise(function(_0x54fb48,_0x1f4ba7){return getInteractionUsers(_0x3ddc06,_0x586537)[_0xbfb0('0x32')](function(_0x6deeee){return getInteractionTags(_0x6deeee,_0x4aa181);})[_0xbfb0('0x32')](function(_0x2c0e0c){return getStateInteraction(_0x2c0e0c);})['then'](function(_0x4ccaf4){_0x54fb48(_0x4ccaf4);})[_0xbfb0('0x33')](function(_0x3e18e5){_0x1f4ba7(_0x3e18e5);});});}function getStateInteraction(_0x3f22d9){return new BPromise(function(_0x330638){_0x3f22d9[_0xbfb0('0x34')]=0x0;_0x3f22d9[_0xbfb0('0x35')]=0x0;_0x3f22d9[_0xbfb0('0x36')]=0x0;_0x3f22d9[_0xbfb0('0x37')]=0x0;_0x3f22d9[_0xbfb0('0x38')]=0x0;if(!_0x3f22d9[_0xbfb0('0x39')]&&!_0x3f22d9['UserId']){_0x3f22d9['waiting']+=0x1;}if(!_0x3f22d9[_0xbfb0('0x39')]&&_0x3f22d9[_0xbfb0('0x3a')]){_0x3f22d9['talking']+=0x1;if(_0x3f22d9[_0xbfb0('0x34')]){_0x3f22d9['waiting']-=0x1;}}if(_0x3f22d9[_0xbfb0('0x39')]&&_0x3f22d9[_0xbfb0('0x3a')]){_0x3f22d9['answered']+=0x1;if(_0x3f22d9['talking']){_0x3f22d9[_0xbfb0('0x35')]-=0x1;}}if(_0x3f22d9[_0xbfb0('0x39')]&&!_0x3f22d9['UserId']){_0x3f22d9[_0xbfb0('0x37')]+=0x1;if(_0x3f22d9['waiting']){_0x3f22d9[_0xbfb0('0x34')]-=0x1;}}_0x3f22d9['total']+=0x1;_0x330638(_0x3f22d9);});}exports['index']=function(_0x1af0a0,_0x446046){var _0xca5b07={},_0x15848d={},_0x45702d={'count':0x0,'rows':[]};var _0x58fa70=_[_0xbfb0('0x2b')](db[_0xbfb0('0x3b')][_0xbfb0('0x3c')],function(_0x3958c8){return{'name':_0x3958c8[_0xbfb0('0x3d')],'type':_0x3958c8[_0xbfb0('0x3e')][_0xbfb0('0x3f')]};});_0x15848d[_0xbfb0('0x40')]=_[_0xbfb0('0x2b')](_0x58fa70,_0xbfb0('0x28'));_0x15848d[_0xbfb0('0x41')]=_[_0xbfb0('0x42')](_0x1af0a0[_0xbfb0('0x41')]);_0x15848d[_0xbfb0('0x43')]=_[_0xbfb0('0x44')](_0x15848d[_0xbfb0('0x40')],_0x15848d[_0xbfb0('0x41')]);_0xca5b07[_0xbfb0('0x45')]=_['intersection'](_0x15848d[_0xbfb0('0x40')],qs[_0xbfb0('0x46')](_0x1af0a0[_0xbfb0('0x41')][_0xbfb0('0x46')]));_0xca5b07[_0xbfb0('0x45')]=_0xca5b07[_0xbfb0('0x45')][_0xbfb0('0x47')]?_0xca5b07[_0xbfb0('0x45')]:_0x15848d[_0xbfb0('0x40')];if(!_0x1af0a0[_0xbfb0('0x41')]['hasOwnProperty']('nolimit')){_0xca5b07[_0xbfb0('0x1e')]=qs[_0xbfb0('0x1e')](_0x1af0a0['query']['limit']);_0xca5b07[_0xbfb0('0x1f')]=qs[_0xbfb0('0x1f')](_0x1af0a0[_0xbfb0('0x41')][_0xbfb0('0x1f')]);}_0xca5b07[_0xbfb0('0x48')]=qs[_0xbfb0('0x49')](_0x1af0a0['query'][_0xbfb0('0x49')]);_0xca5b07[_0xbfb0('0x4a')]=qs[_0xbfb0('0x43')](_[_0xbfb0('0x4b')](_0x1af0a0[_0xbfb0('0x41')],_0x15848d[_0xbfb0('0x43')]),_0x58fa70);var _0xa7aecb=[];var _0x8887b0=squel[_0xbfb0('0x4c')]()[_0xbfb0('0x4d')]('id')[_0xbfb0('0x4d')](_0xbfb0('0x28'))[_0xbfb0('0x4d')](_0xbfb0('0x4e'))[_0xbfb0('0x4f')](_0xbfb0('0x50'));var _0x1b2c03=squel[_0xbfb0('0x4c')]()[_0xbfb0('0x4d')](_0xbfb0('0x51'))[_0xbfb0('0x4d')](_0xbfb0('0x52'))[_0xbfb0('0x4d')](_0xbfb0('0x53'))['from'](_0xbfb0('0x54'),'ui')[_0xbfb0('0x55')](_0xbfb0('0x56'),'u',_0xbfb0('0x57'));var _0x3e1e23=squel[_0xbfb0('0x4c')]()[_0xbfb0('0x4f')]('whatsapp_interactions','i')[_0xbfb0('0x55')](_0xbfb0('0x58'),'c',_0xbfb0('0x59'))['left_join'](_0xbfb0('0x56'),'o','o.id\x20=\x20i.UserId')[_0xbfb0('0x55')](_0xbfb0('0x5a'),'a',_0xbfb0('0x5b'))[_0xbfb0('0x55')]('whatsapp_messages','me',_0xbfb0('0x5c'))[_0xbfb0('0x55')]('whatsapp_interaction_has_tags','it',_0xbfb0('0x5d'))[_0xbfb0('0x55')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x531726=squel[_0xbfb0('0x5e')]();var _0x2213b7=[];var _0x53d8e8=squel[_0xbfb0('0x5e')]();var _0x1f5f6d;if(_0x1af0a0[_0xbfb0('0x41')][_0xbfb0('0x5f')]){_0x1f5f6d=as['parseSearch'](_0x1af0a0[_0xbfb0('0x41')][_0xbfb0('0x5f')]);var _0x473309=_0x1f5f6d['sqlOperator'];for(var _0x4e7d22=0x0;_0x4e7d22<_0x1f5f6d['conditions']['length'];_0x4e7d22++){var _0xd0a7aa=_0x1f5f6d[_0xbfb0('0x60')][_0x4e7d22];var _0x1dbe39='i';var _0x348e93=_[_0xbfb0('0x61')](_0x58fa70,[_0xbfb0('0x28'),_0xd0a7aa[_0xbfb0('0x4d')]]);if(!_0x348e93){switch(_0xd0a7aa['field']){case _0xbfb0('0x62'):if(_0xd0a7aa[_0xbfb0('0x63')]==0x1){_0x3e1e23[_0xbfb0('0x64')]('`'+_0xd0a7aa[_0xbfb0('0x4d')]+_0xbfb0('0x65'));}else{_0x3e1e23[_0xbfb0('0x64')]('`'+_0xd0a7aa['field']+_0xbfb0('0x66'));}break;case _0xbfb0('0x67'):if(_0xd0a7aa['operator']===_0xbfb0('0x68')){if(_0xd0a7aa[_0xbfb0('0x63')][_0xbfb0('0x2d')]('\x20')[_0xbfb0('0x47')]>0x1){_0x531726[_0x473309]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xbfb0('0x69')](_0xd0a7aa[_0xbfb0('0x63')]),null);}else{var _0xd10ab9='%'+_0xd0a7aa[_0xbfb0('0x63')]+'%';_0x531726[_0x473309](_0xbfb0('0x6a'),_0xd10ab9,_0xd10ab9,_0xd10ab9);}}else{_0x348e93=_[_0xbfb0('0x61')](_0x58fa70,['name',_0xbfb0('0x6b')]);_0xd0a7aa[_0xbfb0('0x4d')]=_0xbfb0('0x6b');_0x29e1d6=as[_0xbfb0('0x6c')](_0x1dbe39,_0x348e93[_0xbfb0('0x3e')],_0xd0a7aa);_0x531726[_0x473309](_0x29e1d6['text'],_0x29e1d6[_0xbfb0('0x63')][_0xbfb0('0x6d')],_0x29e1d6[_0xbfb0('0x63')]['end']);}break;case _0xbfb0('0x6e'):var _0x5a2518=_0xd0a7aa[_0xbfb0('0x63')][_0xbfb0('0x2d')](',')['map'](function(_0x22a70f){return Number(_0x22a70f);});_0x5a2518[_0xbfb0('0x2e')](function(_0x497e59){_0x53d8e8['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x497e59+',%');});_0x2213b7=_[_0xbfb0('0x6f')](_0x2213b7,_0x5a2518);break;case'User':if(_0xd0a7aa['operator']===_0xbfb0('0x68')){_0x531726[_0x473309](_0xbfb0('0x70'),'%'+_0xd0a7aa[_0xbfb0('0x63')]+'%',null);}else{_0x348e93=_[_0xbfb0('0x61')](_0x58fa70,['name','UserId']);_0xd0a7aa[_0xbfb0('0x4d')]='UserId';_0x29e1d6=as['buildExpression'](_0x1dbe39,_0x348e93[_0xbfb0('0x3e')],_0xd0a7aa);_0x531726[_0x473309](_0x29e1d6[_0xbfb0('0x71')],_0x29e1d6[_0xbfb0('0x63')][_0xbfb0('0x6d')],_0x29e1d6[_0xbfb0('0x63')][_0xbfb0('0x1b')]);}break;case'body':_0x29e1d6=as[_0xbfb0('0x6c')]('me',null,_0xd0a7aa);_0x531726[_0x473309](_0x29e1d6[_0xbfb0('0x71')],_0x29e1d6[_0xbfb0('0x63')][_0xbfb0('0x6d')],_0x29e1d6[_0xbfb0('0x63')][_0xbfb0('0x1b')]);break;}}else{var _0x29e1d6=as['buildExpression'](_0x1dbe39,_0x348e93[_0xbfb0('0x3e')],_0xd0a7aa);_0x531726[_0x473309](_0x29e1d6[_0xbfb0('0x71')],_0x29e1d6[_0xbfb0('0x63')]['start'],_0x29e1d6[_0xbfb0('0x63')][_0xbfb0('0x1b')]);}}}else{var _0x39405f=_(_0x1af0a0[_0xbfb0('0x41')])[_0xbfb0('0x42')]()['map'](function(_0xa3db83){return _[_0xbfb0('0x72')](_0x58fa70,['name',_0xa3db83])?_0xa3db83:undefined;})['compact']()['value']();if(!_[_0xbfb0('0x73')](_0x39405f)){_0x39405f[_0xbfb0('0x2e')](function(_0x3e01c8){if(_0x3e01c8===_0xbfb0('0x74')){_0x3e1e23['where'](_0xbfb0('0x75'),[][_0xbfb0('0x76')](_0x1af0a0[_0xbfb0('0x41')][_0x3e01c8]));}else if(_0x3e01c8===_0xbfb0('0x77')){var _0x324584=JSON[_0xbfb0('0x78')](_0x1af0a0[_0xbfb0('0x41')][_0x3e01c8])[_0xbfb0('0x79')];var _0x342f24=JSON[_0xbfb0('0x78')](_0x1af0a0[_0xbfb0('0x41')][_0x3e01c8])[_0xbfb0('0x7a')];_0x3e1e23[_0xbfb0('0x4a')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x324584,_0x342f24);}else{if(_0x1af0a0[_0xbfb0('0x41')][_0x3e01c8]===_0xbfb0('0x7b')){_0x3e1e23[_0xbfb0('0x4a')]('i.'+_0x3e01c8+_0xbfb0('0x7c'));}else{_0x3e1e23['where']('i.'+_0x3e01c8+_0xbfb0('0x7d'),_0x1af0a0['query'][_0x3e01c8]);}}});}if(_0x1af0a0[_0xbfb0('0x41')][_0xbfb0('0x7e')]){if(_0x1af0a0[_0xbfb0('0x41')]['read']==0x1){_0x3e1e23[_0xbfb0('0x64')](_0xbfb0('0x7f'));}else{_0x3e1e23[_0xbfb0('0x64')](_0xbfb0('0x80'));}}if(_0x1af0a0['query'][_0xbfb0('0x81')]){_0x2213b7=_[_0xbfb0('0x82')](_0x1af0a0['query'][_0xbfb0('0x81')])?_0x1af0a0[_0xbfb0('0x41')][_0xbfb0('0x81')]:new Array(_0x1af0a0[_0xbfb0('0x41')]['tag']);_0x2213b7['forEach'](function(_0x373ecc){_0x53d8e8['or'](_0xbfb0('0x83'),'%,'+_0x373ecc+',%');});}if(_0x1af0a0[_0xbfb0('0x41')]['filter']){var _0xaa737a=_0x1af0a0[_0xbfb0('0x41')]['filter'][_0xbfb0('0x84')]('\x5c','\x5c\x5c')[_0xbfb0('0x84')](/'/g,'\x27\x27');if(qs[_0xbfb0('0x85')](_0xaa737a)){_0x531726['or'](_0xbfb0('0x86'),_0xaa737a+'%')['or'](_0xbfb0('0x87'),_0xaa737a+'%');}else{_0x531726['or'](_0xbfb0('0x88'),qs[_0xbfb0('0x69')](_0xaa737a))['or'](_0xbfb0('0x89'),_0xaa737a+'%');}}}_0x3e1e23['where'](_0x531726);_0x3e1e23[_0xbfb0('0x8a')](_0xbfb0('0x8b'));var _0x1c0f2b={'type':db[_0xbfb0('0x8c')][_0xbfb0('0x8d')]['SELECT'],'raw':!![]};var _0x35f9ac=_0x3e1e23[_0xbfb0('0x8e')]();_0x35f9ac[_0xbfb0('0x4d')](_0xbfb0('0x8b'));_0x35f9ac[_0xbfb0('0x4d')](_0xbfb0('0x8f'),_0xbfb0('0x62'));if(_0xca5b07['order']){_0xca5b07[_0xbfb0('0x48')][_0xbfb0('0x2e')](function(_0x34ffa3){var _0x44e942=_0x34ffa3[0x0]==='contactName'?_0x34ffa3[0x0]:'i.'+_0x34ffa3[0x0];_0x3e1e23[_0xbfb0('0x48')](_0x44e942,_0x34ffa3[0x1]===_0xbfb0('0x90')?![]:!![]);});}if(!_['isEmpty'](_0x2213b7)){_0x3e1e23['having'](_0x53d8e8);_0x35f9ac['where']('t.id\x20IN\x20?',_0x2213b7);}BPromise[_0xbfb0('0x91')]()['then'](function(){if(!_0x1f5f6d){if(_0x1af0a0['query'][_0xbfb0('0x74')])return;_0x35f9ac['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x3e1e23[_0xbfb0('0x4a')](_0xbfb0('0x92'));return;}if(_0x1af0a0['user'][_0xbfb0('0x93')]!==_0xbfb0('0x94'))return;return _0x1af0a0['user'][_0xbfb0('0x95')]({'attributes':['id'],'raw':!![]})[_0xbfb0('0x32')](function(_0x59f1f2){if(_[_0xbfb0('0x73')](_0x59f1f2)){_0x35f9ac[_0xbfb0('0x4a')](_0xbfb0('0x96'));_0x3e1e23[_0xbfb0('0x4a')](_0xbfb0('0x96'));}else{_0x35f9ac['where'](_0xbfb0('0x75'),_[_0xbfb0('0x2b')](_0x59f1f2,'id'));_0x3e1e23['where'](_0xbfb0('0x75'),_[_0xbfb0('0x2b')](_0x59f1f2,'id'));}});})[_0xbfb0('0x32')](function(){if(_0x1af0a0[_0xbfb0('0x97')][_0xbfb0('0x93')]===_0xbfb0('0x94')&&!_0x1f5f6d&&!_0x1af0a0[_0xbfb0('0x41')]['WhatsappAccountId'])return[];return db['sequelize'][_0xbfb0('0x41')](_0x35f9ac[_0xbfb0('0x98')](),_0x1c0f2b);})['then'](function(_0x32a7e5){_0x45702d['count']=_0x32a7e5['length'];if(_0x45702d[_0xbfb0('0x20')]===0x0)return[];return db[_0xbfb0('0x99')][_0xbfb0('0x41')](_0x8887b0[_0xbfb0('0x98')](),_0x1c0f2b)[_0xbfb0('0x32')](function(_0x44b3e1){_0xa7aecb=_[_0xbfb0('0x9a')](_0x44b3e1,'id');_0x1c0f2b=_[_0xbfb0('0x9b')](_0x1c0f2b,{'model':db[_0xbfb0('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1af0a0[_0xbfb0('0x41')][_0xbfb0('0x46')]){_0xca5b07[_0xbfb0('0x45')][_0xbfb0('0x2e')](function(_0x551937){_0x3e1e23[_0xbfb0('0x4d')]('i.'+_0x551937);});}else{_0x3e1e23[_0xbfb0('0x4d')](_0xbfb0('0x8f'),_0xbfb0('0x62'));_0x3e1e23[_0xbfb0('0x4d')](_0xbfb0('0x9c'),_0xbfb0('0x9d'));_0x3e1e23[_0xbfb0('0x4d')]('a.mandatoryDisposition',_0xbfb0('0x9e'));_0x3e1e23['field'](_0xbfb0('0x9f'),_0xbfb0('0xa0'));_0x3e1e23[_0xbfb0('0x4d')](_0xbfb0('0xa1'));_0x3e1e23[_0xbfb0('0x4d')](_0xbfb0('0xa2'),_0xbfb0('0xa3'));_0x3e1e23[_0xbfb0('0x4d')](_0xbfb0('0xa4'),'Contact.lastName');_0x3e1e23[_0xbfb0('0x4d')]('c.email',_0xbfb0('0xa5'));_0x3e1e23[_0xbfb0('0x4d')](_0xbfb0('0xa6'),'Contact.phone');_0x3e1e23['field'](_0xbfb0('0xa7'),_0xbfb0('0xa8'));_0x3e1e23[_0xbfb0('0x4d')]('c.fax',_0xbfb0('0xa9'));_0x3e1e23[_0xbfb0('0x4d')]('o.fullname',_0xbfb0('0xaa'));_0x3e1e23['field']('o.internal',_0xbfb0('0xab'));_0x3e1e23['field'](_0xbfb0('0xac'),_0xbfb0('0x31'));}if(_0xca5b07[_0xbfb0('0x1e')])_0x3e1e23[_0xbfb0('0x1e')](_0xca5b07[_0xbfb0('0x1e')]);if(_0xca5b07[_0xbfb0('0x1f')])_0x3e1e23['offset'](_0xca5b07[_0xbfb0('0x1f')]);return db[_0xbfb0('0x99')]['query'](_0x3e1e23[_0xbfb0('0x98')](),_0x1c0f2b);})['then'](function(_0x17e22a){if(_0x17e22a[_0xbfb0('0x47')]>0x0)_0x1b2c03[_0xbfb0('0x4a')](_0xbfb0('0xad'),_[_0xbfb0('0x2b')](_0x17e22a,'id'));return db[_0xbfb0('0x99')][_0xbfb0('0x41')](_0x1b2c03[_0xbfb0('0x98')](),_0x1c0f2b)['then'](function(_0x4d0fac){var _0x5cf9d4=_['groupBy'](_0x4d0fac,_0xbfb0('0xae'));var _0x49bf72=[];_0x17e22a[_0xbfb0('0x2e')](function(_0x14a961){_0x49bf72[_0xbfb0('0x30')](updateWhatsappInteraction(_0x14a961,_0xa7aecb,_0x5cf9d4));});return BPromise[_0xbfb0('0xaf')](_0x49bf72);});});})['then'](function(_0x26694f){_0x45702d[_0xbfb0('0xb0')]=_0x26694f;return _0x45702d;})[_0xbfb0('0x32')](respondWithFilteredResult(_0x446046,_0xca5b07))[_0xbfb0('0x33')](handleError(_0x446046,null));};exports['show']=function(_0x324443,_0x4cd4d6){var _0xa107c7={'raw':![],'where':{'id':_0x324443[_0xbfb0('0xb1')]['id']}},_0x193bf1={};_0x193bf1['model']=_[_0xbfb0('0x42')](db[_0xbfb0('0x3b')]['rawAttributes']);_0x193bf1[_0xbfb0('0x41')]=_['keys'](_0x324443[_0xbfb0('0x41')]);_0x193bf1[_0xbfb0('0x43')]=_[_0xbfb0('0x44')](_0x193bf1[_0xbfb0('0x40')],_0x193bf1['query']);_0xa107c7[_0xbfb0('0x45')]=_[_0xbfb0('0x44')](_0x193bf1[_0xbfb0('0x40')],qs['fields'](_0x324443['query'][_0xbfb0('0x46')]));_0xa107c7[_0xbfb0('0x45')]=_0xa107c7[_0xbfb0('0x45')][_0xbfb0('0x47')]?_0xa107c7['attributes']:_0x193bf1[_0xbfb0('0x40')];if(_0x324443[_0xbfb0('0x41')][_0xbfb0('0xb2')]){_0xa107c7[_0xbfb0('0xb3')]=[{'all':!![]}];}_0xa107c7=_[_0xbfb0('0x9b')]({},_0xa107c7,_0x324443[_0xbfb0('0xb4')]);return db[_0xbfb0('0x3b')][_0xbfb0('0x61')](_0xa107c7)[_0xbfb0('0x32')](handleEntityNotFound(_0x4cd4d6,null))['then'](respondWithResult(_0x4cd4d6,null))[_0xbfb0('0x33')](handleError(_0x4cd4d6,null));};exports[_0xbfb0('0xb5')]=function(_0x4c6cb1,_0x2a0cb2){return db[_0xbfb0('0x3b')][_0xbfb0('0xb5')](_0x4c6cb1[_0xbfb0('0xb6')],{})[_0xbfb0('0x32')](respondWithResult(_0x2a0cb2,0xc9))[_0xbfb0('0x33')](handleError(_0x2a0cb2,null));};exports[_0xbfb0('0xb7')]=function(_0x2ca36a,_0x5e77bf){if(_0x2ca36a['body']['id']){delete _0x2ca36a[_0xbfb0('0xb6')]['id'];}return db['WhatsappInteraction'][_0xbfb0('0x61')]({'where':{'id':_0x2ca36a['params']['id']}})['then'](handleEntityNotFound(_0x5e77bf,null))[_0xbfb0('0x32')](saveUpdates(_0x2ca36a[_0xbfb0('0xb6')],null))[_0xbfb0('0x32')](respondWithResult(_0x5e77bf,null))[_0xbfb0('0x33')](handleError(_0x5e77bf,null));};exports['destroy']=function(_0x2489c9,_0x587f9b){return db['WhatsappInteraction'][_0xbfb0('0x61')]({'where':{'id':_0x2489c9[_0xbfb0('0xb1')]['id']}})[_0xbfb0('0x32')](handleEntityNotFound(_0x587f9b,null))['then'](removeEntity(_0x587f9b,null))[_0xbfb0('0x33')](handleError(_0x587f9b,null));};exports[_0xbfb0('0xb8')]=function(_0xfbd5e7,_0x50e801){return db[_0xbfb0('0x3b')][_0xbfb0('0xb8')]()[_0xbfb0('0x32')](respondWithResult(_0x50e801,null))[_0xbfb0('0x33')](handleError(_0x50e801,null));};exports[_0xbfb0('0xb9')]=function(_0x127b60,_0x18ccca,_0x4e7724){return db['WhatsappMessage'][_0xbfb0('0x61')]({'where':{'id':_0x127b60[_0xbfb0('0xb1')]['id']}})[_0xbfb0('0x32')](handleEntityNotFound(_0x18ccca,null))[_0xbfb0('0x32')](function(_0x174fce){if(_0x174fce){return _0x174fce['addMessage'](_0x127b60[_0xbfb0('0xb6')][_0xbfb0('0xba')],_[_0xbfb0('0xbb')](_0x127b60[_0xbfb0('0xb6')],[_0xbfb0('0xba'),'id'])||{});}})[_0xbfb0('0x32')](respondWithResult(_0x18ccca,null))[_0xbfb0('0x33')](handleError(_0x18ccca,null));};exports[_0xbfb0('0xbc')]=function(_0x1b5fcb,_0x5eaf1f,_0x32e4b0){var _0x5338bb={'raw':![],'where':{}};var _0x155a97={};var _0x2e73cb={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xbfb0('0xbd')]({'where':{'id':_0x1b5fcb[_0xbfb0('0xb1')]['id']}})[_0xbfb0('0x32')](handleEntityNotFound(_0x5eaf1f,null))[_0xbfb0('0x32')](function(_0x4532bd){if(_0x4532bd){_0x155a97[_0xbfb0('0x40')]=_['keys'](db[_0xbfb0('0xbe')][_0xbfb0('0x3c')]);_0x155a97[_0xbfb0('0x41')]=_[_0xbfb0('0x42')](_0x1b5fcb[_0xbfb0('0x41')]);_0x155a97['filters']=_[_0xbfb0('0x44')](_0x155a97['model'],_0x155a97[_0xbfb0('0x41')]);_0x5338bb['attributes']=_[_0xbfb0('0x44')](_0x155a97['model'],qs['fields'](_0x1b5fcb[_0xbfb0('0x41')][_0xbfb0('0x46')]));_0x5338bb[_0xbfb0('0x45')]=_0x5338bb[_0xbfb0('0x45')][_0xbfb0('0x47')]?_0x5338bb[_0xbfb0('0x45')]:_0x155a97['model'];if(!_0x1b5fcb[_0xbfb0('0x41')]['hasOwnProperty'](_0xbfb0('0xbf'))){_0x5338bb[_0xbfb0('0x1e')]=qs[_0xbfb0('0x1e')](_0x1b5fcb[_0xbfb0('0x41')][_0xbfb0('0x1e')]);_0x5338bb[_0xbfb0('0x1f')]=qs[_0xbfb0('0x1f')](_0x1b5fcb[_0xbfb0('0x41')][_0xbfb0('0x1f')]);}_0x5338bb['order']=qs[_0xbfb0('0x49')](_0x1b5fcb[_0xbfb0('0x41')][_0xbfb0('0x49')]);_0x5338bb[_0xbfb0('0x4a')]=qs[_0xbfb0('0x43')](_[_0xbfb0('0x4b')](_0x1b5fcb[_0xbfb0('0x41')],_0x155a97['filters']));_0x5338bb[_0xbfb0('0x4a')][_0xbfb0('0xae')]=_0x4532bd['id'];if(_0x1b5fcb[_0xbfb0('0x41')][_0xbfb0('0xc0')]){_0x5338bb[_0xbfb0('0x4a')]=_['merge'](_0x5338bb[_0xbfb0('0x4a')],{'$or':_[_0xbfb0('0x2b')](_0x5338bb[_0xbfb0('0x45')],function(_0x856ec3){var _0x3dfc2e={};_0x3dfc2e[_0x856ec3]={'$like':'%'+_0x1b5fcb[_0xbfb0('0x41')][_0xbfb0('0xc0')]+'%'};return _0x3dfc2e;})});}if(_0x1b5fcb['query']['$gte']){var _0x33d7f4=_0x1b5fcb['query'][_0xbfb0('0x79')][_0xbfb0('0x2d')](',');var _0xde52f={};_0xde52f[_0x33d7f4[0x0]]={'$gte':moment(_0x33d7f4[0x1])[_0xbfb0('0xc1')](_0xbfb0('0xc2'))};_0x5338bb['where']=_[_0xbfb0('0x9b')](_0x5338bb['where'],_0xde52f);}_0x5338bb=_[_0xbfb0('0x9b')]({},_0x5338bb,_0x1b5fcb['options']);return db[_0xbfb0('0xbe')][_0xbfb0('0x20')]({'where':_0x5338bb['where']})[_0xbfb0('0x32')](function(_0x13309f){_0x2e73cb['count']=_0x13309f;if(_0x1b5fcb['query'][_0xbfb0('0xb2')]){_0x5338bb[_0xbfb0('0xb3')]=[{'all':!![]}];}return db[_0xbfb0('0xbe')][_0xbfb0('0xc3')](_0x5338bb);})[_0xbfb0('0x32')](function(_0x22f1c7){_0x2e73cb[_0xbfb0('0xb0')]=_0x22f1c7;return _0x2e73cb;});}})[_0xbfb0('0x32')](respondWithFilteredResult(_0x5eaf1f,_0x5338bb))[_0xbfb0('0x33')](handleError(_0x5eaf1f,null));};exports['addTags']=function(_0x397d2d,_0x469259,_0x578743){return db[_0xbfb0('0x3b')]['find']({'where':{'id':_0x397d2d['params']['id']}})['then'](handleEntityNotFound(_0x469259,null))[_0xbfb0('0x32')](function(_0x7f5bd4){if(_0x7f5bd4){return _0x7f5bd4[_0xbfb0('0xc4')](_0x397d2d[_0xbfb0('0xb6')][_0xbfb0('0xba')],_[_0xbfb0('0xbb')](_0x397d2d[_0xbfb0('0xb6')],[_0xbfb0('0xba'),'id'])||{})['spread'](function(){return db[_0xbfb0('0x6e')][_0xbfb0('0xc3')]({'attributes':['id',_0xbfb0('0x28'),_0xbfb0('0x4e')],'where':{'id':_0x397d2d[_0xbfb0('0xb6')]['ids']}});})['then'](function(_0xca1c49){socket['emit'](_0xbfb0('0xc5'),{'id':Number(_0x397d2d['params']['id']),'tags':_0xca1c49||[]});return{'id':Number(_0x397d2d[_0xbfb0('0xb1')]['id']),'tags':_0xca1c49||[]};});}})[_0xbfb0('0x32')](respondWithResult(_0x469259,null))[_0xbfb0('0x33')](handleError(_0x469259,null));};exports[_0xbfb0('0xc6')]=function(_0x3c91cf,_0x5b34cb,_0x40c544){return db[_0xbfb0('0x3b')][_0xbfb0('0x61')]({'where':{'id':_0x3c91cf['params']['id']}})['then'](handleEntityNotFound(_0x5b34cb,null))['then'](function(_0x56ceee){if(_0x56ceee){return _0x56ceee[_0xbfb0('0xc6')](_0x3c91cf['query'][_0xbfb0('0xba')]);}})[_0xbfb0('0x32')](respondWithStatusCode(_0x5b34cb,null))[_0xbfb0('0x33')](handleError(_0x5b34cb,null));};exports[_0xbfb0('0xc7')]=function(_0x277d60,_0x25f750){var _0x5c8c21=moment()[_0xbfb0('0xc8')]()[_0xbfb0('0x98')]();var _0x476135=path['join'](config[_0xbfb0('0xc9')],_0xbfb0('0xca'),'files',_0xbfb0('0xcb'));var _0x33dba2=path['join'](config['root'],_0xbfb0('0xca'),_0xbfb0('0xcc'),_0xbfb0('0xcd'));var _0x2e6c92=path[_0xbfb0('0xce')](_0x476135,_0x5c8c21);var _0x243012=util['format'](_0xbfb0('0xcf'),_0x277d60[_0xbfb0('0xb1')]['id'],_0x5c8c21);var _0x4d4eaf=path[_0xbfb0('0xce')](_0x476135,_0x243012);var _0x4fddc7=[];_0x4fddc7['push']({'model':db['User'],'as':_0xbfb0('0xd0'),'attributes':['id',_0xbfb0('0x2c')],'raw':!![]});_0x4fddc7['push']({'model':db[_0xbfb0('0xd1')],'as':'Contact','attributes':['id',_0xbfb0('0xd2'),_0xbfb0('0xd3')],'raw':!![]});if(_0x277d60[_0xbfb0('0x41')][_0xbfb0('0xcd')]){_0x4fddc7[_0xbfb0('0x30')]({'model':db[_0xbfb0('0xd4')],'as':_0xbfb0('0xd4'),'raw':!![]});}var _0x2af523=[{'model':db['WhatsappMessage'],'as':_0xbfb0('0xd5'),'attributes':['id','body',_0xbfb0('0x77'),_0xbfb0('0xd6'),_0xbfb0('0xd7'),'read'],'include':_0x4fddc7}];_0x2af523[_0xbfb0('0x30')]({'model':db['WhatsappAccount'],'as':_0xbfb0('0xd8'),'attributes':['id',_0xbfb0('0x28')]});_0x2af523[_0xbfb0('0x30')]({'model':db[_0xbfb0('0xd0')],'as':_0xbfb0('0xd9'),'attributes':['id',_0xbfb0('0x2c')]});return db[_0xbfb0('0x3b')][_0xbfb0('0x61')]({'where':{'id':_0x277d60['params']['id']},'include':_0x2af523})[_0xbfb0('0x32')](handleEntityNotFound(_0x25f750,null))[_0xbfb0('0x32')](function(_0x32b12b){if(_0x32b12b){var _0x239287=_0x32b12b[_0xbfb0('0xda')]({'plain':!![]});fs[_0xbfb0('0xdb')](_0x2e6c92);var _0x493a01={'channel':'Whatsapp','account':_0x239287[_0xbfb0('0xd8')][_0xbfb0('0x28')],'agent':_0x239287[_0xbfb0('0xd9')]?_0x239287[_0xbfb0('0xd9')]['fullname']:_0xbfb0('0xdc'),'createdAt':moment(_0x239287[_0xbfb0('0x77')])['format'](_0xbfb0('0xc2'))[_0xbfb0('0x98')](),'closedAt':_0x239287[_0xbfb0('0x39')]?moment(_0x239287[_0xbfb0('0xdd')])[_0xbfb0('0xc1')](_0xbfb0('0xc2'))[_0xbfb0('0x98')]():'','disposition':_0x239287['disposition'],'messages':_(_0x239287['Messages'])['filter']({'secret':![]})[_0xbfb0('0x2b')](function(_0x48939f){if(_0x48939f[_0xbfb0('0xd4')]){var _0x55e560=path['join'](_0x33dba2,_0x48939f[_0xbfb0('0xd4')][_0xbfb0('0xde')]);if(fs[_0xbfb0('0xdf')](_0x55e560)){fs['createReadStream'](_0x55e560)[_0xbfb0('0xe0')](fs[_0xbfb0('0xe1')](path[_0xbfb0('0xce')](_0x2e6c92,_0x48939f[_0xbfb0('0xd4')][_0xbfb0('0xde')])));}}return{'date':moment(_0x48939f['createdAt'])[_0xbfb0('0xc1')](_0xbfb0('0xc2'))[_0xbfb0('0x98')](),'sender':_0x48939f[_0xbfb0('0xd6')]===_0xbfb0('0xe2')?_0x48939f[_0xbfb0('0xd0')]?_0x48939f[_0xbfb0('0xd0')][_0xbfb0('0x2c')]:_0xbfb0('0xe3'):_0x48939f[_0xbfb0('0x67')]['firstName']+(_0x48939f[_0xbfb0('0x67')][_0xbfb0('0xd3')]?'\x20'+_0x48939f[_0xbfb0('0x67')][_0xbfb0('0xd3')]:''),'body':_0x48939f[_0xbfb0('0xd4')]?_0x48939f['Attachment'][_0xbfb0('0xde')]:_0x48939f['body'],'direction':_0x48939f[_0xbfb0('0xd6')]===_0xbfb0('0xe2')?'A':'C','secret':_0x48939f[_0xbfb0('0xd7')],'read':_0x48939f[_0xbfb0('0x7e')],'attachment':_0x48939f[_0xbfb0('0xd4')]};})['value']()};return ejs[_0xbfb0('0xe4')](path[_0xbfb0('0xce')](config[_0xbfb0('0xc9')],_0xbfb0('0xca'),_0xbfb0('0xe5'),_0xbfb0('0xe6')),{'interaction':_0x493a01})[_0xbfb0('0x32')](function(_0x2cb6ac){var _0x2f45fa=path[_0xbfb0('0xce')](_0x2e6c92,_0xbfb0('0xe7')+_0x239287['id']+'-'+_0x5c8c21+'.pdf');var _0x454713={'path':_0x2f45fa,'channel':_0xbfb0('0xe8'),'interactionId':_0x239287['id']};return pdf[_0xbfb0('0xe9')](_0x2cb6ac,_0x454713);})[_0xbfb0('0x32')](function(){return new BPromise(function(_0x5a034d,_0x361baf){zipdir(_0x2e6c92,{'saveTo':_0x4d4eaf},function(_0x510ee3,_0x1cb8e9){if(_0x510ee3)return _0x361baf(_0x510ee3);return _0x5a034d(_0x1cb8e9);});})[_0xbfb0('0x32')](function(){return new BPromise(function(_0x1c210e,_0x1c37dd){rimraf(_0x2e6c92,function(_0x4d5aaf){if(_0x4d5aaf)_0x1c37dd(_0x4d5aaf);return _0x1c210e();});});})[_0xbfb0('0x32')](function(){return _0x25f750['download'](_0x4d4eaf,_0x243012,function(_0x4ff731){if(_0x4ff731){console[_0xbfb0('0xea')](_0xbfb0('0xeb'),_0x4ff731);}else{fs['unlinkSync'](_0x4d4eaf);}});});});}else{return _0x25f750[_0xbfb0('0x19')](0xc8);}})['catch'](handleError(_0x25f750,null));}; \ No newline at end of file +var _0x48ac=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./whatsappInteraction.socket','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','name','send','Users','fullname','TagIds','split','forEach','Tags','push','catch','waiting','answered','total','closed','talking','unmanaged','index','map','WhatsappInteraction','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','field','from','tools_tags','select','u.fullname','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','value','`\x20=\x200','having','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','some','compact','isEmpty','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','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','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','WhatsappAccountId','user','role','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','agent','toString','sequelize','merge','unreadMessages','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.*','Contact.firstName','c.lastName','Contact.lastName','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','WhatsappInteractionId','all','rows','show','params','include','options','create','body','describe','addMessage','WhatsappMessage','ids','omit','getMessages','format','includeAll','findAll','addTags','color','emit','removeTags','download','unix','root','server','files','tmp','join','attachments','CmContact','Contact','firstName','lastName','WhatsappAccount','Account','get','mkdirSync','Whatsapp','Owner','N.A.','createdAt','closedAt','YYYY-MM-DD\x20HH:mm:ss','disposition','Attachment','basename','createReadStream','pipe','createWriteStream','direction','System','secret','renderFile','downloadInteraction.ejs','transcript-','.pdf','err','unlinkSync','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x389ee8,_0x41bf7d){var _0x1cc6e6=function(_0x2c0ce5){while(--_0x2c0ce5){_0x389ee8['push'](_0x389ee8['shift']());}};_0x1cc6e6(++_0x41bf7d);}(_0x48ac,0xe0));var _0xc48a=function(_0x4471af,_0x957d4e){_0x4471af=_0x4471af-0x0;var _0xa9b644=_0x48ac[_0x4471af];return _0xa9b644;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc48a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc48a('0x1'));var rp=require(_0xc48a('0x2'));var moment=require(_0xc48a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc48a('0x4'));var util=require(_0xc48a('0x5'));var path=require(_0xc48a('0x6'));var sox=require(_0xc48a('0x7'));var csv=require(_0xc48a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc48a('0x9'));var jsforce=require(_0xc48a('0xa'));var deskjs=require(_0xc48a('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc48a('0xc'));var Papa=require(_0xc48a('0xd'));var Redis=require(_0xc48a('0xe'));var authService=require(_0xc48a('0xf'));var qs=require(_0xc48a('0x10'));var as=require(_0xc48a('0x11'));var pdf=require(_0xc48a('0x12'));var hardwareService=require(_0xc48a('0x13'));var logger=require(_0xc48a('0x14'))(_0xc48a('0x15'));var utils=require(_0xc48a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc48a('0x17'));var db=require(_0xc48a('0x18'))['db'];config[_0xc48a('0x19')]=_['defaults'](config[_0xc48a('0x19')],{'host':_0xc48a('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc48a('0x19')]));require(_0xc48a('0x1b'))[_0xc48a('0x1c')](socket);function respondWithStatusCode(_0x4e0d3c,_0x2e2bb0){_0x2e2bb0=_0x2e2bb0||0xcc;return function(_0x70c92f){if(_0x70c92f){return _0x4e0d3c[_0xc48a('0x1d')](_0x2e2bb0);}return _0x4e0d3c['status'](_0x2e2bb0)[_0xc48a('0x1e')]();};}function respondWithResult(_0x2172f5,_0x53bfc3){_0x53bfc3=_0x53bfc3||0xc8;return function(_0x5c319b){if(_0x5c319b){return _0x2172f5[_0xc48a('0x1f')](_0x53bfc3)['json'](_0x5c319b);}};}function respondWithFilteredResult(_0x632d0c,_0x29a1ad){return function(_0x188549){if(_0x188549){var _0x462102=typeof _0x29a1ad[_0xc48a('0x20')]===_0xc48a('0x21')&&typeof _0x29a1ad[_0xc48a('0x22')]==='undefined';var _0x308703=_0x188549[_0xc48a('0x23')];var _0x5b750c=_0x462102?0x0:_0x29a1ad[_0xc48a('0x20')];var _0x4e6e15=_0x462102?_0x188549[_0xc48a('0x23')]:_0x29a1ad['offset']+_0x29a1ad[_0xc48a('0x22')];var _0x382f69;if(_0x4e6e15>=_0x308703){_0x4e6e15=_0x308703;_0x382f69=0xc8;}else{_0x382f69=0xce;}_0x632d0c[_0xc48a('0x1f')](_0x382f69);return _0x632d0c[_0xc48a('0x24')](_0xc48a('0x25'),_0x5b750c+'-'+_0x4e6e15+'/'+_0x308703)[_0xc48a('0x26')](_0x188549);}return null;};}function patchUpdates(_0x248fdd){return function(_0x409ca0){try{jsonpatch[_0xc48a('0x27')](_0x409ca0,_0x248fdd,!![]);}catch(_0x3201bc){return BPromise[_0xc48a('0x28')](_0x3201bc);}return _0x409ca0['save']();};}function saveUpdates(_0x53fab0,_0x351b72){return function(_0x16d41a){if(_0x16d41a){return _0x16d41a[_0xc48a('0x29')](_0x53fab0)[_0xc48a('0x2a')](function(_0x5b63aa){return _0x5b63aa;});}return null;};}function removeEntity(_0x5c5d61,_0x34cad3){return function(_0xa8c195){if(_0xa8c195){return _0xa8c195[_0xc48a('0x2b')]()['then'](function(){_0x5c5d61[_0xc48a('0x1f')](0xcc)[_0xc48a('0x1e')]();});}};}function handleEntityNotFound(_0x23aa60,_0x281100){return function(_0x2516f3){if(!_0x2516f3){_0x23aa60[_0xc48a('0x1d')](0x194);}return _0x2516f3;};}function handleError(_0x1a2b28,_0x335532){_0x335532=_0x335532||0x1f4;return function(_0x3b75db){logger[_0xc48a('0x2c')](_0x3b75db['stack']);if(_0x3b75db['name']){delete _0x3b75db[_0xc48a('0x2d')];}_0x1a2b28['status'](_0x335532)[_0xc48a('0x2e')](_0x3b75db);};}function getInteractionUsers(_0x10e450,_0x5ae94f){return new BPromise(function(_0x2f69c7,_0x2ab3e1){try{if(_0x5ae94f[_0x10e450['id']]){_0x10e450[_0xc48a('0x2f')]=_['map'](_0x5ae94f[_0x10e450['id']],function(_0x81cd6e){return{'id':_0x81cd6e['id'],'fullname':_0x81cd6e[_0xc48a('0x30')]};});}}catch(_0x5da25c){_0x2ab3e1(_0x5da25c);}_0x2f69c7(_0x10e450);});}function getInteractionTags(_0x361d18,_0x3f1bef){return new BPromise(function(_0x14bdfc,_0x4db7e2){try{if(_0x361d18[_0xc48a('0x31')]){_0x361d18['Tags']=[];_0x361d18[_0xc48a('0x31')][_0xc48a('0x32')](',')[_0xc48a('0x33')](function(_0x2ad597){_0x361d18[_0xc48a('0x34')][_0xc48a('0x35')](_0x3f1bef[_0x2ad597]);});}delete _0x361d18[_0xc48a('0x31')];}catch(_0x26483b){_0x4db7e2(_0x26483b);}_0x14bdfc(_0x361d18);});}function updateWhatsappInteraction(_0x57d803,_0x44c7b3,_0x341b51){return new BPromise(function(_0x38ad22,_0x47c6e8){return getInteractionUsers(_0x57d803,_0x341b51)[_0xc48a('0x2a')](function(_0x35c259){return getInteractionTags(_0x35c259,_0x44c7b3);})[_0xc48a('0x2a')](function(_0x52b449){return getStateInteraction(_0x52b449);})[_0xc48a('0x2a')](function(_0xa26b55){_0x38ad22(_0xa26b55);})[_0xc48a('0x36')](function(_0x2288ce){_0x47c6e8(_0x2288ce);});});}function getStateInteraction(_0x5473c1){return new BPromise(function(_0x36378a){_0x5473c1[_0xc48a('0x37')]=0x0;_0x5473c1['talking']=0x0;_0x5473c1[_0xc48a('0x38')]=0x0;_0x5473c1['unmanaged']=0x0;_0x5473c1[_0xc48a('0x39')]=0x0;if(!_0x5473c1['closed']&&!_0x5473c1['UserId']){_0x5473c1[_0xc48a('0x37')]+=0x1;}if(!_0x5473c1[_0xc48a('0x3a')]&&_0x5473c1['UserId']){_0x5473c1[_0xc48a('0x3b')]+=0x1;if(_0x5473c1[_0xc48a('0x37')]){_0x5473c1[_0xc48a('0x37')]-=0x1;}}if(_0x5473c1[_0xc48a('0x3a')]&&_0x5473c1['UserId']){_0x5473c1[_0xc48a('0x38')]+=0x1;if(_0x5473c1[_0xc48a('0x3b')]){_0x5473c1[_0xc48a('0x3b')]-=0x1;}}if(_0x5473c1[_0xc48a('0x3a')]&&!_0x5473c1['UserId']){_0x5473c1[_0xc48a('0x3c')]+=0x1;if(_0x5473c1['waiting']){_0x5473c1[_0xc48a('0x37')]-=0x1;}}_0x5473c1[_0xc48a('0x39')]+=0x1;_0x36378a(_0x5473c1);});}exports[_0xc48a('0x3d')]=function(_0x17fe53,_0x249409){var _0x1daadb={},_0x536476={},_0x2a7e42={'count':0x0,'rows':[]};var _0x1a04a6=_[_0xc48a('0x3e')](db[_0xc48a('0x3f')][_0xc48a('0x40')],function(_0x4f9dbe){return{'name':_0x4f9dbe[_0xc48a('0x41')],'type':_0x4f9dbe[_0xc48a('0x42')][_0xc48a('0x43')]};});_0x536476['model']=_[_0xc48a('0x3e')](_0x1a04a6,'name');_0x536476['query']=_[_0xc48a('0x44')](_0x17fe53[_0xc48a('0x45')]);_0x536476[_0xc48a('0x46')]=_[_0xc48a('0x47')](_0x536476[_0xc48a('0x48')],_0x536476[_0xc48a('0x45')]);_0x1daadb[_0xc48a('0x49')]=_['intersection'](_0x536476['model'],qs['fields'](_0x17fe53[_0xc48a('0x45')][_0xc48a('0x4a')]));_0x1daadb[_0xc48a('0x49')]=_0x1daadb[_0xc48a('0x49')][_0xc48a('0x4b')]?_0x1daadb[_0xc48a('0x49')]:_0x536476[_0xc48a('0x48')];if(!_0x17fe53[_0xc48a('0x45')][_0xc48a('0x4c')](_0xc48a('0x4d'))){_0x1daadb[_0xc48a('0x22')]=qs['limit'](_0x17fe53[_0xc48a('0x45')][_0xc48a('0x22')]);_0x1daadb[_0xc48a('0x20')]=qs[_0xc48a('0x20')](_0x17fe53[_0xc48a('0x45')][_0xc48a('0x20')]);}_0x1daadb[_0xc48a('0x4e')]=qs[_0xc48a('0x4f')](_0x17fe53[_0xc48a('0x45')]['sort']);_0x1daadb[_0xc48a('0x50')]=qs[_0xc48a('0x46')](_[_0xc48a('0x51')](_0x17fe53[_0xc48a('0x45')],_0x536476['filters']),_0x1a04a6);var _0x303414=[];var _0x3610d6=squel['select']()[_0xc48a('0x52')]('id')[_0xc48a('0x52')](_0xc48a('0x2d'))[_0xc48a('0x52')]('color')[_0xc48a('0x53')](_0xc48a('0x54'));var _0x2fdb9c=squel[_0xc48a('0x55')]()['field']('u.id')['field'](_0xc48a('0x56'))[_0xc48a('0x52')]('ui.WhatsappInteractionId')[_0xc48a('0x53')]('user_has_whatsapp_interactions','ui')[_0xc48a('0x57')](_0xc48a('0x58'),'u',_0xc48a('0x59'));var _0x1a96d9=squel[_0xc48a('0x55')]()[_0xc48a('0x53')](_0xc48a('0x5a'),'i')[_0xc48a('0x57')](_0xc48a('0x5b'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xc48a('0x57')]('users','o',_0xc48a('0x5c'))[_0xc48a('0x57')](_0xc48a('0x5d'),'a',_0xc48a('0x5e'))[_0xc48a('0x57')]('whatsapp_messages','me',_0xc48a('0x5f'))['left_join'](_0xc48a('0x60'),'it',_0xc48a('0x61'))[_0xc48a('0x57')](_0xc48a('0x54'),'t',_0xc48a('0x62'));var _0x338977=squel['expr']();var _0x1fb17e=[];var _0x46ef22=squel[_0xc48a('0x63')]();var _0x5bfe3e;if(_0x17fe53[_0xc48a('0x45')][_0xc48a('0x64')]){_0x5bfe3e=as[_0xc48a('0x65')](_0x17fe53['query'][_0xc48a('0x64')]);var _0x4ab81c=_0x5bfe3e[_0xc48a('0x66')];for(var _0x58d8a5=0x0;_0x58d8a5<_0x5bfe3e[_0xc48a('0x67')][_0xc48a('0x4b')];_0x58d8a5++){var _0x2e4224=_0x5bfe3e[_0xc48a('0x67')][_0x58d8a5];var _0xb9930c='i';var _0x42fabc=_[_0xc48a('0x68')](_0x1a04a6,[_0xc48a('0x2d'),_0x2e4224[_0xc48a('0x52')]]);if(!_0x42fabc){switch(_0x2e4224['field']){case'unreadMessages':if(_0x2e4224[_0xc48a('0x69')]==0x1){_0x1a96d9['having']('`'+_0x2e4224[_0xc48a('0x52')]+_0xc48a('0x6a'));}else{_0x1a96d9[_0xc48a('0x6b')]('`'+_0x2e4224[_0xc48a('0x52')]+'`\x20>\x200');}break;case'Contact':if(_0x2e4224[_0xc48a('0x6c')]===_0xc48a('0x6d')){if(_0x2e4224[_0xc48a('0x69')][_0xc48a('0x32')]('\x20')['length']>0x1){_0x338977[_0x4ab81c](_0xc48a('0x6e'),qs[_0xc48a('0x6f')](_0x2e4224['value']),null);}else{var _0x11b099='%'+_0x2e4224[_0xc48a('0x69')]+'%';_0x338977[_0x4ab81c](_0xc48a('0x70'),_0x11b099,_0x11b099,_0x11b099);}}else{_0x42fabc=_[_0xc48a('0x68')](_0x1a04a6,[_0xc48a('0x2d'),_0xc48a('0x71')]);_0x2e4224[_0xc48a('0x52')]=_0xc48a('0x71');_0x2edc9a=as[_0xc48a('0x72')](_0xb9930c,_0x42fabc['type'],_0x2e4224);_0x338977[_0x4ab81c](_0x2edc9a['text'],_0x2edc9a[_0xc48a('0x69')][_0xc48a('0x73')],_0x2edc9a[_0xc48a('0x69')][_0xc48a('0x1e')]);}break;case _0xc48a('0x74'):var _0x2786b3=_0x2e4224[_0xc48a('0x69')]['split'](',')[_0xc48a('0x3e')](function(_0x192cd3){return Number(_0x192cd3);});_0x2786b3[_0xc48a('0x33')](function(_0x42a5ec){_0x46ef22['or'](_0xc48a('0x75'),'%,'+_0x42a5ec+',%');});_0x1fb17e=_[_0xc48a('0x76')](_0x1fb17e,_0x2786b3);break;case _0xc48a('0x77'):if(_0x2e4224['operator']===_0xc48a('0x6d')){_0x338977[_0x4ab81c](_0xc48a('0x78'),'%'+_0x2e4224['value']+'%',null);}else{_0x42fabc=_[_0xc48a('0x68')](_0x1a04a6,[_0xc48a('0x2d'),_0xc48a('0x79')]);_0x2e4224[_0xc48a('0x52')]='UserId';_0x2edc9a=as[_0xc48a('0x72')](_0xb9930c,_0x42fabc[_0xc48a('0x42')],_0x2e4224);_0x338977[_0x4ab81c](_0x2edc9a[_0xc48a('0x7a')],_0x2edc9a[_0xc48a('0x69')][_0xc48a('0x73')],_0x2edc9a[_0xc48a('0x69')][_0xc48a('0x1e')]);}break;case'body':_0x2edc9a=as[_0xc48a('0x72')]('me',null,_0x2e4224);_0x338977[_0x4ab81c](_0x2edc9a[_0xc48a('0x7a')],_0x2edc9a[_0xc48a('0x69')][_0xc48a('0x73')],_0x2edc9a[_0xc48a('0x69')]['end']);break;}}else{var _0x2edc9a=as[_0xc48a('0x72')](_0xb9930c,_0x42fabc['type'],_0x2e4224);_0x338977[_0x4ab81c](_0x2edc9a[_0xc48a('0x7a')],_0x2edc9a['value'][_0xc48a('0x73')],_0x2edc9a[_0xc48a('0x69')][_0xc48a('0x1e')]);}}}else{var _0x11fb19=_(_0x17fe53[_0xc48a('0x45')])[_0xc48a('0x44')]()['map'](function(_0x54c06e){return _[_0xc48a('0x7b')](_0x1a04a6,['name',_0x54c06e])?_0x54c06e:undefined;})[_0xc48a('0x7c')]()[_0xc48a('0x69')]();if(!_[_0xc48a('0x7d')](_0x11fb19)){_0x11fb19[_0xc48a('0x33')](function(_0x4f40e2){if(_0x4f40e2==='WhatsappAccountId'){_0x1a96d9['where']('i.WhatsappAccountId\x20IN\x20?',[]['concat'](_0x17fe53[_0xc48a('0x45')][_0x4f40e2]));}else if(_0x4f40e2==='createdAt'){var _0xe275c1=JSON[_0xc48a('0x7e')](_0x17fe53[_0xc48a('0x45')][_0x4f40e2])[_0xc48a('0x7f')];var _0x5fc232=JSON[_0xc48a('0x7e')](_0x17fe53[_0xc48a('0x45')][_0x4f40e2])[_0xc48a('0x80')];_0x1a96d9[_0xc48a('0x50')](_0xc48a('0x81'),_0xe275c1,_0x5fc232);}else{if(_0x17fe53[_0xc48a('0x45')][_0x4f40e2]===_0xc48a('0x82')){_0x1a96d9[_0xc48a('0x50')]('i.'+_0x4f40e2+_0xc48a('0x83'));}else{_0x1a96d9[_0xc48a('0x50')]('i.'+_0x4f40e2+_0xc48a('0x84'),_0x17fe53[_0xc48a('0x45')][_0x4f40e2]);}}});}if(_0x17fe53[_0xc48a('0x45')][_0xc48a('0x85')]){if(_0x17fe53[_0xc48a('0x45')][_0xc48a('0x85')]==0x1){_0x1a96d9[_0xc48a('0x6b')](_0xc48a('0x86'));}else{_0x1a96d9[_0xc48a('0x6b')](_0xc48a('0x87'));}}if(_0x17fe53['query']['tag']){_0x1fb17e=_[_0xc48a('0x88')](_0x17fe53[_0xc48a('0x45')]['tag'])?_0x17fe53[_0xc48a('0x45')]['tag']:new Array(_0x17fe53[_0xc48a('0x45')][_0xc48a('0x89')]);_0x1fb17e[_0xc48a('0x33')](function(_0x1084a3){_0x46ef22['or'](_0xc48a('0x75'),'%,'+_0x1084a3+',%');});}if(_0x17fe53[_0xc48a('0x45')][_0xc48a('0x8a')]){var _0x1c3bfc=_0x17fe53['query'][_0xc48a('0x8a')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x1c3bfc)){_0x338977['or']('i.id\x20LIKE\x20?',_0x1c3bfc+'%')['or'](_0xc48a('0x8b'),_0x1c3bfc+'%');}else{_0x338977['or'](_0xc48a('0x8c'),qs[_0xc48a('0x6f')](_0x1c3bfc))['or'](_0xc48a('0x8d'),_0x1c3bfc+'%');}}}_0x1a96d9[_0xc48a('0x50')](_0x338977);_0x1a96d9[_0xc48a('0x8e')]('i.id');var _0x5daf15={'type':db[_0xc48a('0x8f')][_0xc48a('0x90')][_0xc48a('0x91')],'raw':!![]};var _0x1d9762=_0x1a96d9[_0xc48a('0x92')]();_0x1d9762['field'](_0xc48a('0x93'));_0x1d9762[_0xc48a('0x52')](_0xc48a('0x94'),'unreadMessages');if(_0x1daadb[_0xc48a('0x4e')]){_0x1daadb[_0xc48a('0x4e')][_0xc48a('0x33')](function(_0x1acb61){var _0x5e4574=_0x1acb61[0x0]===_0xc48a('0x95')?_0x1acb61[0x0]:'i.'+_0x1acb61[0x0];_0x1a96d9[_0xc48a('0x4e')](_0x5e4574,_0x1acb61[0x1]===_0xc48a('0x96')?![]:!![]);});}if(!_[_0xc48a('0x7d')](_0x1fb17e)){_0x1a96d9[_0xc48a('0x6b')](_0x46ef22);_0x1d9762[_0xc48a('0x50')](_0xc48a('0x97'),_0x1fb17e);}BPromise[_0xc48a('0x98')]()[_0xc48a('0x2a')](function(){if(!_0x5bfe3e){if(_0x17fe53[_0xc48a('0x45')][_0xc48a('0x99')])return;_0x1d9762[_0xc48a('0x50')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x1a96d9[_0xc48a('0x50')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x17fe53[_0xc48a('0x9a')][_0xc48a('0x9b')]!=='agent')return;return _0x17fe53['user'][_0xc48a('0x9c')]({'attributes':['id'],'raw':!![]})[_0xc48a('0x2a')](function(_0x553552){if(_[_0xc48a('0x7d')](_0x553552)){_0x1d9762[_0xc48a('0x50')](_0xc48a('0x9d'));_0x1a96d9[_0xc48a('0x50')](_0xc48a('0x9d'));}else{_0x1d9762['where'](_0xc48a('0x9e'),_[_0xc48a('0x3e')](_0x553552,'id'));_0x1a96d9['where'](_0xc48a('0x9e'),_[_0xc48a('0x3e')](_0x553552,'id'));}});})[_0xc48a('0x2a')](function(){if(_0x17fe53[_0xc48a('0x9a')][_0xc48a('0x9b')]===_0xc48a('0x9f')&&!_0x5bfe3e&&!_0x17fe53[_0xc48a('0x45')]['WhatsappAccountId'])return[];return db['sequelize'][_0xc48a('0x45')](_0x1d9762[_0xc48a('0xa0')](),_0x5daf15);})[_0xc48a('0x2a')](function(_0x1dc87a){_0x2a7e42[_0xc48a('0x23')]=_0x1dc87a['length'];if(_0x2a7e42['count']===0x0)return[];return db[_0xc48a('0xa1')]['query'](_0x3610d6['toString'](),_0x5daf15)['then'](function(_0x55a785){_0x303414=_['keyBy'](_0x55a785,'id');_0x5daf15=_[_0xc48a('0xa2')](_0x5daf15,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x17fe53[_0xc48a('0x45')][_0xc48a('0x4a')]){_0x1daadb[_0xc48a('0x49')][_0xc48a('0x33')](function(_0x480ac7){_0x1a96d9[_0xc48a('0x52')]('i.'+_0x480ac7);});}else{_0x1a96d9['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xc48a('0xa3'));_0x1a96d9[_0xc48a('0x52')](_0xc48a('0xa4'),_0xc48a('0xa5'));_0x1a96d9[_0xc48a('0x52')](_0xc48a('0xa6'),'Account.mandatoryDisposition');_0x1a96d9[_0xc48a('0x52')](_0xc48a('0xa7'),'contactName');_0x1a96d9[_0xc48a('0x52')](_0xc48a('0xa8'));_0x1a96d9['field']('c.firstName',_0xc48a('0xa9'));_0x1a96d9['field'](_0xc48a('0xaa'),_0xc48a('0xab'));_0x1a96d9[_0xc48a('0x52')]('c.email','Contact.email');_0x1a96d9[_0xc48a('0x52')](_0xc48a('0xac'),_0xc48a('0xad'));_0x1a96d9[_0xc48a('0x52')](_0xc48a('0xae'),'Contact.mobile');_0x1a96d9[_0xc48a('0x52')](_0xc48a('0xaf'),_0xc48a('0xb0'));_0x1a96d9[_0xc48a('0x52')]('o.fullname',_0xc48a('0xb1'));_0x1a96d9[_0xc48a('0x52')](_0xc48a('0xb2'),'Owner.internal');_0x1a96d9[_0xc48a('0x52')](_0xc48a('0xb3'),'TagIds');}if(_0x1daadb[_0xc48a('0x22')])_0x1a96d9[_0xc48a('0x22')](_0x1daadb[_0xc48a('0x22')]);if(_0x1daadb[_0xc48a('0x20')])_0x1a96d9[_0xc48a('0x20')](_0x1daadb[_0xc48a('0x20')]);return db['sequelize'][_0xc48a('0x45')](_0x1a96d9[_0xc48a('0xa0')](),_0x5daf15);})['then'](function(_0x2cfa95){if(_0x2cfa95['length']>0x0)_0x2fdb9c[_0xc48a('0x50')]('ui.WhatsappInteractionId\x20IN\x20?',_[_0xc48a('0x3e')](_0x2cfa95,'id'));return db[_0xc48a('0xa1')][_0xc48a('0x45')](_0x2fdb9c['toString'](),_0x5daf15)[_0xc48a('0x2a')](function(_0x45856e){var _0x5a7fa7=_[_0xc48a('0xb4')](_0x45856e,_0xc48a('0xb5'));var _0x4394ea=[];_0x2cfa95['forEach'](function(_0x35ff38){_0x4394ea['push'](updateWhatsappInteraction(_0x35ff38,_0x303414,_0x5a7fa7));});return BPromise[_0xc48a('0xb6')](_0x4394ea);});});})[_0xc48a('0x2a')](function(_0x361da2){_0x2a7e42[_0xc48a('0xb7')]=_0x361da2;return _0x2a7e42;})['then'](respondWithFilteredResult(_0x249409,_0x1daadb))[_0xc48a('0x36')](handleError(_0x249409,null));};exports[_0xc48a('0xb8')]=function(_0x3acf50,_0x4920ac){var _0x54e504={'raw':![],'where':{'id':_0x3acf50[_0xc48a('0xb9')]['id']}},_0x12844b={};_0x12844b[_0xc48a('0x48')]=_['keys'](db[_0xc48a('0x3f')][_0xc48a('0x40')]);_0x12844b[_0xc48a('0x45')]=_[_0xc48a('0x44')](_0x3acf50[_0xc48a('0x45')]);_0x12844b['filters']=_[_0xc48a('0x47')](_0x12844b[_0xc48a('0x48')],_0x12844b['query']);_0x54e504[_0xc48a('0x49')]=_[_0xc48a('0x47')](_0x12844b[_0xc48a('0x48')],qs[_0xc48a('0x4a')](_0x3acf50['query']['fields']));_0x54e504[_0xc48a('0x49')]=_0x54e504['attributes'][_0xc48a('0x4b')]?_0x54e504[_0xc48a('0x49')]:_0x12844b[_0xc48a('0x48')];if(_0x3acf50[_0xc48a('0x45')]['includeAll']){_0x54e504[_0xc48a('0xba')]=[{'all':!![]}];}_0x54e504=_[_0xc48a('0xa2')]({},_0x54e504,_0x3acf50[_0xc48a('0xbb')]);return db['WhatsappInteraction'][_0xc48a('0x68')](_0x54e504)[_0xc48a('0x2a')](handleEntityNotFound(_0x4920ac,null))['then'](respondWithResult(_0x4920ac,null))[_0xc48a('0x36')](handleError(_0x4920ac,null));};exports[_0xc48a('0xbc')]=function(_0x2c211f,_0x2ac467){return db['WhatsappInteraction'][_0xc48a('0xbc')](_0x2c211f['body'],{})[_0xc48a('0x2a')](respondWithResult(_0x2ac467,0xc9))['catch'](handleError(_0x2ac467,null));};exports[_0xc48a('0x29')]=function(_0x57641d,_0x30ce1c){if(_0x57641d['body']['id']){delete _0x57641d['body']['id'];}return db[_0xc48a('0x3f')][_0xc48a('0x68')]({'where':{'id':_0x57641d[_0xc48a('0xb9')]['id']}})[_0xc48a('0x2a')](handleEntityNotFound(_0x30ce1c,null))[_0xc48a('0x2a')](saveUpdates(_0x57641d[_0xc48a('0xbd')],null))[_0xc48a('0x2a')](respondWithResult(_0x30ce1c,null))['catch'](handleError(_0x30ce1c,null));};exports[_0xc48a('0x2b')]=function(_0x2274f9,_0x4c3528){return db[_0xc48a('0x3f')][_0xc48a('0x68')]({'where':{'id':_0x2274f9[_0xc48a('0xb9')]['id']}})[_0xc48a('0x2a')](handleEntityNotFound(_0x4c3528,null))['then'](removeEntity(_0x4c3528,null))['catch'](handleError(_0x4c3528,null));};exports[_0xc48a('0xbe')]=function(_0x567e84,_0x493cf0){return db[_0xc48a('0x3f')][_0xc48a('0xbe')]()[_0xc48a('0x2a')](respondWithResult(_0x493cf0,null))['catch'](handleError(_0x493cf0,null));};exports[_0xc48a('0xbf')]=function(_0x49542e,_0x35b877,_0xb04d48){return db[_0xc48a('0xc0')][_0xc48a('0x68')]({'where':{'id':_0x49542e[_0xc48a('0xb9')]['id']}})[_0xc48a('0x2a')](handleEntityNotFound(_0x35b877,null))[_0xc48a('0x2a')](function(_0x54aaec){if(_0x54aaec){return _0x54aaec[_0xc48a('0xbf')](_0x49542e['body'][_0xc48a('0xc1')],_[_0xc48a('0xc2')](_0x49542e['body'],['ids','id'])||{});}})[_0xc48a('0x2a')](respondWithResult(_0x35b877,null))['catch'](handleError(_0x35b877,null));};exports[_0xc48a('0xc3')]=function(_0x19df2d,_0x145595,_0x33d218){var _0x530a6f={'raw':![],'where':{}};var _0x519bd5={};var _0x19fd1f={'count':0x0,'rows':[]};return db[_0xc48a('0x3f')]['findOne']({'where':{'id':_0x19df2d[_0xc48a('0xb9')]['id']}})[_0xc48a('0x2a')](handleEntityNotFound(_0x145595,null))['then'](function(_0x254c31){if(_0x254c31){_0x519bd5['model']=_['keys'](db[_0xc48a('0xc0')][_0xc48a('0x40')]);_0x519bd5[_0xc48a('0x45')]=_['keys'](_0x19df2d[_0xc48a('0x45')]);_0x519bd5[_0xc48a('0x46')]=_[_0xc48a('0x47')](_0x519bd5[_0xc48a('0x48')],_0x519bd5['query']);_0x530a6f[_0xc48a('0x49')]=_[_0xc48a('0x47')](_0x519bd5['model'],qs[_0xc48a('0x4a')](_0x19df2d[_0xc48a('0x45')][_0xc48a('0x4a')]));_0x530a6f[_0xc48a('0x49')]=_0x530a6f[_0xc48a('0x49')][_0xc48a('0x4b')]?_0x530a6f['attributes']:_0x519bd5[_0xc48a('0x48')];if(!_0x19df2d['query']['hasOwnProperty'](_0xc48a('0x4d'))){_0x530a6f['limit']=qs['limit'](_0x19df2d[_0xc48a('0x45')]['limit']);_0x530a6f[_0xc48a('0x20')]=qs[_0xc48a('0x20')](_0x19df2d['query'][_0xc48a('0x20')]);}_0x530a6f[_0xc48a('0x4e')]=qs[_0xc48a('0x4f')](_0x19df2d[_0xc48a('0x45')][_0xc48a('0x4f')]);_0x530a6f[_0xc48a('0x50')]=qs['filters'](_['pick'](_0x19df2d[_0xc48a('0x45')],_0x519bd5['filters']));_0x530a6f[_0xc48a('0x50')][_0xc48a('0xb5')]=_0x254c31['id'];if(_0x19df2d[_0xc48a('0x45')][_0xc48a('0x8a')]){_0x530a6f[_0xc48a('0x50')]=_[_0xc48a('0xa2')](_0x530a6f['where'],{'$or':_[_0xc48a('0x3e')](_0x530a6f[_0xc48a('0x49')],function(_0x2db11f){var _0x2ef125={};_0x2ef125[_0x2db11f]={'$like':'%'+_0x19df2d[_0xc48a('0x45')][_0xc48a('0x8a')]+'%'};return _0x2ef125;})});}if(_0x19df2d['query'][_0xc48a('0x7f')]){var _0x15b2ee=_0x19df2d[_0xc48a('0x45')]['$gte'][_0xc48a('0x32')](',');var _0x10ab25={};_0x10ab25[_0x15b2ee[0x0]]={'$gte':moment(_0x15b2ee[0x1])[_0xc48a('0xc4')]('YYYY-MM-DD\x20HH:mm:ss')};_0x530a6f[_0xc48a('0x50')]=_['merge'](_0x530a6f[_0xc48a('0x50')],_0x10ab25);}_0x530a6f=_[_0xc48a('0xa2')]({},_0x530a6f,_0x19df2d[_0xc48a('0xbb')]);return db[_0xc48a('0xc0')][_0xc48a('0x23')]({'where':_0x530a6f[_0xc48a('0x50')]})[_0xc48a('0x2a')](function(_0xa4f233){_0x19fd1f[_0xc48a('0x23')]=_0xa4f233;if(_0x19df2d[_0xc48a('0x45')][_0xc48a('0xc5')]){_0x530a6f[_0xc48a('0xba')]=[{'all':!![]}];}return db[_0xc48a('0xc0')][_0xc48a('0xc6')](_0x530a6f);})['then'](function(_0x141a14){_0x19fd1f['rows']=_0x141a14;return _0x19fd1f;});}})[_0xc48a('0x2a')](respondWithFilteredResult(_0x145595,_0x530a6f))[_0xc48a('0x36')](handleError(_0x145595,null));};exports[_0xc48a('0xc7')]=function(_0x5da250,_0x3e5834,_0x1f66bc){return db[_0xc48a('0x3f')]['find']({'where':{'id':_0x5da250['params']['id']}})[_0xc48a('0x2a')](handleEntityNotFound(_0x3e5834,null))[_0xc48a('0x2a')](function(_0x26d968){if(_0x26d968){return _0x26d968['setTags'](_0x5da250[_0xc48a('0xbd')]['ids'],_[_0xc48a('0xc2')](_0x5da250[_0xc48a('0xbd')],[_0xc48a('0xc1'),'id'])||{})['spread'](function(){return db[_0xc48a('0x74')]['findAll']({'attributes':['id','name',_0xc48a('0xc8')],'where':{'id':_0x5da250['body'][_0xc48a('0xc1')]}});})['then'](function(_0x497330){socket[_0xc48a('0xc9')]('whatsappInteractionTags:save',{'id':Number(_0x5da250[_0xc48a('0xb9')]['id']),'tags':_0x497330||[]});return{'id':Number(_0x5da250[_0xc48a('0xb9')]['id']),'tags':_0x497330||[]};});}})[_0xc48a('0x2a')](respondWithResult(_0x3e5834,null))[_0xc48a('0x36')](handleError(_0x3e5834,null));};exports[_0xc48a('0xca')]=function(_0x5b9c9e,_0xbae0a5,_0x533337){return db[_0xc48a('0x3f')][_0xc48a('0x68')]({'where':{'id':_0x5b9c9e[_0xc48a('0xb9')]['id']}})['then'](handleEntityNotFound(_0xbae0a5,null))[_0xc48a('0x2a')](function(_0x100158){if(_0x100158){return _0x100158[_0xc48a('0xca')](_0x5b9c9e['query'][_0xc48a('0xc1')]);}})['then'](respondWithStatusCode(_0xbae0a5,null))[_0xc48a('0x36')](handleError(_0xbae0a5,null));};exports[_0xc48a('0xcb')]=function(_0x3e6cf8,_0x45f853){var _0x587194=moment()[_0xc48a('0xcc')]()[_0xc48a('0xa0')]();var _0x529037=path['join'](config[_0xc48a('0xcd')],_0xc48a('0xce'),_0xc48a('0xcf'),_0xc48a('0xd0'));var _0x5037fe=path[_0xc48a('0xd1')](config[_0xc48a('0xcd')],_0xc48a('0xce'),_0xc48a('0xcf'),_0xc48a('0xd2'));var _0x31ba81=path[_0xc48a('0xd1')](_0x529037,_0x587194);var _0x1707e8=util[_0xc48a('0xc4')]('transcript-%d-%s.zip',_0x3e6cf8['params']['id'],_0x587194);var _0x1aeb66=path['join'](_0x529037,_0x1707e8);var _0xa59af3=[];_0xa59af3[_0xc48a('0x35')]({'model':db[_0xc48a('0x77')],'as':_0xc48a('0x77'),'attributes':['id',_0xc48a('0x30')],'raw':!![]});_0xa59af3[_0xc48a('0x35')]({'model':db[_0xc48a('0xd3')],'as':_0xc48a('0xd4'),'attributes':['id',_0xc48a('0xd5'),_0xc48a('0xd6')],'raw':!![]});if(_0x3e6cf8['query'][_0xc48a('0xd2')]){_0xa59af3[_0xc48a('0x35')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x182c0b=[{'model':db[_0xc48a('0xc0')],'as':'Messages','attributes':['id','body','createdAt','direction','secret','read'],'include':_0xa59af3}];_0x182c0b['push']({'model':db[_0xc48a('0xd7')],'as':_0xc48a('0xd8'),'attributes':['id',_0xc48a('0x2d')]});_0x182c0b[_0xc48a('0x35')]({'model':db[_0xc48a('0x77')],'as':'Owner','attributes':['id','fullname']});return db[_0xc48a('0x3f')][_0xc48a('0x68')]({'where':{'id':_0x3e6cf8[_0xc48a('0xb9')]['id']},'include':_0x182c0b})['then'](handleEntityNotFound(_0x45f853,null))[_0xc48a('0x2a')](function(_0x1eae23){if(_0x1eae23){var _0x3fd15c=_0x1eae23[_0xc48a('0xd9')]({'plain':!![]});fs[_0xc48a('0xda')](_0x31ba81);var _0x2c4102={'channel':_0xc48a('0xdb'),'account':_0x3fd15c[_0xc48a('0xd8')]['name'],'agent':_0x3fd15c[_0xc48a('0xdc')]?_0x3fd15c[_0xc48a('0xdc')][_0xc48a('0x30')]:_0xc48a('0xdd'),'createdAt':moment(_0x3fd15c[_0xc48a('0xde')])[_0xc48a('0xc4')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc48a('0xa0')](),'closedAt':_0x3fd15c[_0xc48a('0x3a')]?moment(_0x3fd15c[_0xc48a('0xdf')])[_0xc48a('0xc4')](_0xc48a('0xe0'))['toString']():'','disposition':_0x3fd15c[_0xc48a('0xe1')],'messages':_(_0x3fd15c['Messages'])[_0xc48a('0x8a')]({'secret':![]})[_0xc48a('0x3e')](function(_0x17f15e){if(_0x17f15e[_0xc48a('0xe2')]){var _0x3190a3=path[_0xc48a('0xd1')](_0x5037fe,_0x17f15e[_0xc48a('0xe2')][_0xc48a('0xe3')]);if(fs['existsSync'](_0x3190a3)){fs[_0xc48a('0xe4')](_0x3190a3)[_0xc48a('0xe5')](fs[_0xc48a('0xe6')](path[_0xc48a('0xd1')](_0x31ba81,_0x17f15e['Attachment'][_0xc48a('0xe3')])));}}return{'date':moment(_0x17f15e[_0xc48a('0xde')])[_0xc48a('0xc4')](_0xc48a('0xe0'))[_0xc48a('0xa0')](),'sender':_0x17f15e[_0xc48a('0xe7')]==='out'?_0x17f15e[_0xc48a('0x77')]?_0x17f15e[_0xc48a('0x77')][_0xc48a('0x30')]:_0xc48a('0xe8'):_0x17f15e[_0xc48a('0xd4')][_0xc48a('0xd5')]+(_0x17f15e[_0xc48a('0xd4')][_0xc48a('0xd6')]?'\x20'+_0x17f15e['Contact'][_0xc48a('0xd6')]:''),'body':_0x17f15e[_0xc48a('0xe2')]?_0x17f15e[_0xc48a('0xe2')]['basename']:_0x17f15e[_0xc48a('0xbd')],'direction':_0x17f15e[_0xc48a('0xe7')]==='out'?'A':'C','secret':_0x17f15e[_0xc48a('0xe9')],'read':_0x17f15e[_0xc48a('0x85')],'attachment':_0x17f15e[_0xc48a('0xe2')]};})[_0xc48a('0x69')]()};return ejs[_0xc48a('0xea')](path['join'](config[_0xc48a('0xcd')],_0xc48a('0xce'),'views',_0xc48a('0xeb')),{'interaction':_0x2c4102})[_0xc48a('0x2a')](function(_0x175611){var _0x557f98=path[_0xc48a('0xd1')](_0x31ba81,_0xc48a('0xec')+_0x3fd15c['id']+'-'+_0x587194+_0xc48a('0xed'));var _0x2f2938={'path':_0x557f98,'channel':'Whatsapp','interactionId':_0x3fd15c['id']};return pdf['createPdfFromHTML'](_0x175611,_0x2f2938);})[_0xc48a('0x2a')](function(){return new BPromise(function(_0x59de99,_0x57fd38){zipdir(_0x31ba81,{'saveTo':_0x1aeb66},function(_0x456cbb,_0x292d78){if(_0x456cbb)return _0x57fd38(_0x456cbb);return _0x59de99(_0x292d78);});})[_0xc48a('0x2a')](function(){return new BPromise(function(_0x5c5397,_0x45e2ef){rimraf(_0x31ba81,function(_0x29d0b8){if(_0x29d0b8)_0x45e2ef(_0x29d0b8);return _0x5c5397();});});})[_0xc48a('0x2a')](function(){return _0x45f853[_0xc48a('0xcb')](_0x1aeb66,_0x1707e8,function(_0x47ede7){if(_0x47ede7){console['log'](_0xc48a('0xee'),_0x47ede7);}else{fs[_0xc48a('0xef')](_0x1aeb66);}});});});}else{return _0x45f853['sendStatus'](0xc8);}})['catch'](handleError(_0x45f853,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 79f7069..1fa798f 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 _0xc125=['getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xc125,0x150));var _0x5c12=function(_0x449e47,_0x4f069b){_0x449e47=_0x449e47-0x0;var _0x30664a=_0xc125[_0x449e47];return _0x30664a;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x5c12('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x5c12('0x0'))['db'][_0x5c12('0x1')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x5c12('0x2')](0x0);var events={'afterCreate':_0x5c12('0x3'),'afterUpdate':_0x5c12('0x4'),'afterDestroy':_0x5c12('0x5')};function emitEvent(_0x31bd53){return function(_0x275ea3,_0x3aa4b7,_0x3f1c8b){_0x275ea3[_0x5c12('0x6')]({'attributes':['id'],'raw':!![]})[_0x5c12('0x7')](function(_0x4cab65){_0x275ea3[_0x5c12('0x8')](_0x5c12('0x9'),_0x4cab65['map'](function(_0x29342a){return{'id':_0x29342a['id']};}));return WhatsappMessage[_0x5c12('0xa')]({'where':{'WhatsappInteractionId':_0x275ea3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5c12('0x7')](function(_0x33f493){_0x275ea3[_0x5c12('0x8')](_0x5c12('0xb'),_0x33f493[_0x5c12('0xc')]);WhatsappInteractionEvents[_0x5c12('0xd')](_0x31bd53+':'+_0x275ea3['id'],_0x275ea3);WhatsappInteractionEvents['emit'](_0x31bd53,_0x275ea3);_0x3f1c8b(null);})[_0x5c12('0xe')](_0x3f1c8b(null));};}for(var e in events){if(events[_0x5c12('0xf')](e)){var event=events[e];WhatsappInteraction[_0x5c12('0x10')](e,emitEvent(event));}}module[_0x5c12('0x11')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x09dd=['exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','then','emit','catch','hasOwnProperty','hook'];(function(_0x420b24,_0x382adc){var _0x4da552=function(_0x4e1623){while(--_0x4e1623){_0x420b24['push'](_0x420b24['shift']());}};_0x4da552(++_0x382adc);}(_0x09dd,0xb7));var _0xd09d=function(_0x511d17,_0x9ad3ba){_0x511d17=_0x511d17-0x0;var _0x4f42e3=_0x09dd[_0x511d17];return _0x4f42e3;};'use strict';var EventEmitter=require(_0xd09d('0x0'));var WhatsappInteraction=require(_0xd09d('0x1'))['db'][_0xd09d('0x2')];var WhatsappMessage=require(_0xd09d('0x1'))['db'][_0xd09d('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xd09d('0x4')](0x0);var events={'afterCreate':_0xd09d('0x5'),'afterUpdate':_0xd09d('0x6'),'afterDestroy':_0xd09d('0x7')};function emitEvent(_0x50d0a5){return function(_0x467211,_0x5c3a69,_0x274db5){_0x467211['getUsers']({'attributes':['id'],'raw':!![]})[_0xd09d('0x8')](function(_0x5e2910){_0x467211['setDataValue']('Users',_0x5e2910['map'](function(_0x66a82){return{'id':_0x66a82['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x467211['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd09d('0x8')](function(_0x2566ce){_0x467211['setDataValue']('unreadMessages',_0x2566ce['length']);WhatsappInteractionEvents[_0xd09d('0x9')](_0x50d0a5+':'+_0x467211['id'],_0x467211);WhatsappInteractionEvents[_0xd09d('0x9')](_0x50d0a5,_0x467211);_0x274db5(null);})[_0xd09d('0xa')](_0x274db5(null));};}for(var e in events){if(events[_0xd09d('0xb')](e)){var event=events[e];WhatsappInteraction[_0xd09d('0xc')](e,emitEvent(event));}}module[_0xd09d('0xd')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index bcabb7e..00ef037 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 _0x4bec=['closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./whatsappInteraction.attributes','WhatsappInteraction','whatsapp_interactions'];(function(_0x3e6729,_0x16d4af){var _0x535bcd=function(_0x5e6c5f){while(--_0x5e6c5f){_0x3e6729['push'](_0x3e6729['shift']());}};_0x535bcd(++_0x16d4af);}(_0x4bec,0xb9));var _0xc4be=function(_0x54401b,_0x2a1936){_0x54401b=_0x54401b-0x0;var _0x487802=_0x4bec[_0x54401b];return _0x487802;};'use strict';var _=require(_0xc4be('0x0'));var util=require(_0xc4be('0x1'));var logger=require(_0xc4be('0x2'))(_0xc4be('0x3'));var moment=require('moment');var BPromise=require(_0xc4be('0x4'));var rp=require(_0xc4be('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc4be('0x6'));var config=require(_0xc4be('0x7'));var attributes=require(_0xc4be('0x8'));module['exports']=function(_0x353a0e,_0x4ab836){return _0x353a0e['define'](_0xc4be('0x9'),attributes,{'tableName':_0xc4be('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1a041e,_0x294b1a,_0x14635c){if(_0x1a041e['changed'](_0xc4be('0xb'))){_0x1a041e[_0xc4be('0xc')]=moment()['format'](_0xc4be('0xd'));}_0x14635c(null,_0x1a041e);}}});}; \ No newline at end of file +var _0x5fd9=['define','WhatsappInteraction','changed','closed','format','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports'];(function(_0x50a19b,_0x80c4d0){var _0x19b42d=function(_0x15a23f){while(--_0x15a23f){_0x50a19b['push'](_0x50a19b['shift']());}};_0x19b42d(++_0x80c4d0);}(_0x5fd9,0x1d9));var _0x95fd=function(_0x199b1f,_0x4ed849){_0x199b1f=_0x199b1f-0x0;var _0x267ac9=_0x5fd9[_0x199b1f];return _0x267ac9;};'use strict';var _=require('lodash');var util=require(_0x95fd('0x0'));var logger=require(_0x95fd('0x1'))(_0x95fd('0x2'));var moment=require(_0x95fd('0x3'));var BPromise=require(_0x95fd('0x4'));var rp=require(_0x95fd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x95fd('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module[_0x95fd('0x7')]=function(_0x5f0fca,_0x516f4f){return _0x5f0fca[_0x95fd('0x8')](_0x95fd('0x9'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x31e2d8,_0x5bcafb,_0x163468){if(_0x31e2d8[_0x95fd('0xa')](_0x95fd('0xb'))){_0x31e2d8['closedAt']=moment()[_0x95fd('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x163468(null,_0x31e2d8);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 6f615ed..7bff0bb 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 _0xb8a4=['where','addTags','ids','omit','spread','AddTags','stringify','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','WhatsappInteraction,\x20%s,\x20%s','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','attributes','limit','debug','AddTagsToWhatsappInteraction','find'];(function(_0x1e9fcd,_0x30b838){var _0x1ab0ec=function(_0x4a58a2){while(--_0x4a58a2){_0x1e9fcd['push'](_0x1e9fcd['shift']());}};_0x1ab0ec(++_0x30b838);}(_0xb8a4,0x85));var _0x4b8a=function(_0x30f2d3,_0x4e3f32){_0x30f2d3=_0x30f2d3-0x0;var _0x1f41c5=_0xb8a4[_0x30f2d3];return _0x1f41c5;};'use strict';var _=require(_0x4b8a('0x0'));var util=require(_0x4b8a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4b8a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b8a('0x3'))['db'];var utils=require(_0x4b8a('0x4'));var logger=require(_0x4b8a('0x5'))(_0x4b8a('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4b8a('0x7')][_0x4b8a('0x8')]({'port':0x232a});config[_0x4b8a('0x9')]=_['defaults'](config[_0x4b8a('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4b8a('0xa'))(new Redis(config[_0x4b8a('0x9')]));require(_0x4b8a('0xb'))[_0x4b8a('0xc')](socket);function respondWithRpcPromise(_0x285952,_0x3c52d2,_0x1ef5d0){return new BPromise(function(_0x5e2ecb,_0x5614c9){return client[_0x4b8a('0xd')](_0x285952,_0x1ef5d0)[_0x4b8a('0xe')](function(_0x3ecc6e){logger[_0x4b8a('0xf')]('WhatsappInteraction,\x20%s,\x20%s',_0x3c52d2,_0x4b8a('0x10'));logger['debug'](_0x4b8a('0x11'),_0x3c52d2,'request\x20sent',JSON['stringify'](_0x3ecc6e));if(_0x3ecc6e[_0x4b8a('0x12')]){if(_0x3ecc6e[_0x4b8a('0x12')][_0x4b8a('0x13')]===0x1f4){logger[_0x4b8a('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x3c52d2,_0x3ecc6e[_0x4b8a('0x12')][_0x4b8a('0x14')]);return _0x5614c9(_0x3ecc6e['error'][_0x4b8a('0x14')]);}logger[_0x4b8a('0x12')](_0x4b8a('0x15'),_0x3c52d2,_0x3ecc6e[_0x4b8a('0x12')]['message']);return _0x5e2ecb(_0x3ecc6e[_0x4b8a('0x12')][_0x4b8a('0x14')]);}else{logger[_0x4b8a('0xf')]('WhatsappInteraction,\x20%s,\x20%s',_0x3c52d2,_0x4b8a('0x10'));_0x5e2ecb(_0x3ecc6e[_0x4b8a('0x16')][_0x4b8a('0x14')]);}})[_0x4b8a('0x17')](function(_0x20e4df){logger[_0x4b8a('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x3c52d2,_0x20e4df);_0x5614c9(_0x20e4df);});});}exports[_0x4b8a('0x18')]=function(_0x4f6c1a){var _0x39c327=this;return new Promise(function(_0x16558c,_0x12badd){return db[_0x4b8a('0x19')][_0x4b8a('0x1a')](_0x4f6c1a[_0x4b8a('0x1b')],{'raw':_0x4f6c1a[_0x4b8a('0x1c')]?_0x4f6c1a[_0x4b8a('0x1c')][_0x4b8a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6c1a[_0x4b8a('0x1c')]?_0x4f6c1a[_0x4b8a('0x1c')]['where']||null:null,'attributes':_0x4f6c1a[_0x4b8a('0x1c')]?_0x4f6c1a[_0x4b8a('0x1c')][_0x4b8a('0x1e')]||null:null,'limit':_0x4f6c1a[_0x4b8a('0x1c')]?_0x4f6c1a['options'][_0x4b8a('0x1f')]||null:null})[_0x4b8a('0xe')](function(_0x910ca2){logger[_0x4b8a('0xf')](_0x4b8a('0x18'),_0x4f6c1a);logger[_0x4b8a('0x20')](_0x4b8a('0x18'),_0x4f6c1a,JSON['stringify'](_0x910ca2));_0x16558c(_0x910ca2);})[_0x4b8a('0x17')](function(_0x4b54b4){logger['error'](_0x4b8a('0x18'),_0x4b54b4[_0x4b8a('0x14')],_0x4f6c1a);_0x12badd(_0x39c327[_0x4b8a('0x12')](0x1f4,_0x4b54b4[_0x4b8a('0x14')]));});});};exports[_0x4b8a('0x21')]=function(_0x506be7){return new Promise(function(_0x419526,_0xc2e441){return db[_0x4b8a('0x19')][_0x4b8a('0x22')]({'where':_0x506be7['options']?_0x506be7[_0x4b8a('0x1c')][_0x4b8a('0x23')]||null:null})[_0x4b8a('0xe')](function(_0x335d64){if(_0x335d64){return _0x335d64[_0x4b8a('0x24')](_0x506be7[_0x4b8a('0x1b')][_0x4b8a('0x25')],_[_0x4b8a('0x26')](_0x506be7[_0x4b8a('0x1b')],['ids','id'])||{});}})[_0x4b8a('0x27')](function(_0x181756){logger['info']('AddTags',_0x506be7);logger[_0x4b8a('0x20')](_0x4b8a('0x28'),_0x506be7,JSON[_0x4b8a('0x29')](_0x181756));_0x419526(_0x181756);})[_0x4b8a('0x17')](function(_0x662cdb){logger[_0x4b8a('0x12')](_0x4b8a('0x28'),_0x662cdb[_0x4b8a('0x14')],_0x506be7);_0xc2e441(_this[_0x4b8a('0x12')](0x1f4,_0x662cdb[_0x4b8a('0x14')]));});});}; \ No newline at end of file +var _0xe38f=['omit','ids','spread','info','AddTags','stringify','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','limit','AddTagsToWhatsappInteraction','find'];(function(_0x483cde,_0x3861b4){var _0x4a17f9=function(_0x2425fd){while(--_0x2425fd){_0x483cde['push'](_0x483cde['shift']());}};_0x4a17f9(++_0x3861b4);}(_0xe38f,0x11e));var _0xfe38=function(_0x3171e4,_0x579b24){_0x3171e4=_0x3171e4-0x0;var _0x460406=_0xe38f[_0x3171e4];return _0x460406;};'use strict';var _=require(_0xfe38('0x0'));var util=require('util');var moment=require(_0xfe38('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfe38('0x2'))['db'];var utils=require(_0xfe38('0x3'));var logger=require(_0xfe38('0x4'))(_0xfe38('0x5'));var config=require(_0xfe38('0x6'));var jayson=require(_0xfe38('0x7'));var client=jayson[_0xfe38('0x8')][_0xfe38('0x9')]({'port':0x232a});config[_0xfe38('0xa')]=_['defaults'](config['redis'],{'host':_0xfe38('0xb'),'port':0x18eb});var socket=require(_0xfe38('0xc'))(new Redis(config[_0xfe38('0xa')]));require(_0xfe38('0xd'))[_0xfe38('0xe')](socket);function respondWithRpcPromise(_0x7c4fc8,_0x3fcc54,_0x1a75e7){return new BPromise(function(_0x1a00b1,_0x133972){return client['request'](_0x7c4fc8,_0x1a75e7)[_0xfe38('0xf')](function(_0x2f5a33){logger['info'](_0xfe38('0x10'),_0x3fcc54,_0xfe38('0x11'));logger[_0xfe38('0x12')](_0xfe38('0x13'),_0x3fcc54,_0xfe38('0x11'),JSON['stringify'](_0x2f5a33));if(_0x2f5a33[_0xfe38('0x14')]){if(_0x2f5a33[_0xfe38('0x14')]['code']===0x1f4){logger['error'](_0xfe38('0x10'),_0x3fcc54,_0x2f5a33[_0xfe38('0x14')][_0xfe38('0x15')]);return _0x133972(_0x2f5a33[_0xfe38('0x14')][_0xfe38('0x15')]);}logger['error'](_0xfe38('0x10'),_0x3fcc54,_0x2f5a33[_0xfe38('0x14')][_0xfe38('0x15')]);return _0x1a00b1(_0x2f5a33[_0xfe38('0x14')][_0xfe38('0x15')]);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x3fcc54,_0xfe38('0x11'));_0x1a00b1(_0x2f5a33[_0xfe38('0x16')][_0xfe38('0x15')]);}})[_0xfe38('0x17')](function(_0x39a36a){logger['error'](_0xfe38('0x10'),_0x3fcc54,_0x39a36a);_0x133972(_0x39a36a);});});}exports[_0xfe38('0x18')]=function(_0x5274eb){var _0x231c0a=this;return new Promise(function(_0x1b298c,_0x58cd9a){return db[_0xfe38('0x19')][_0xfe38('0x1a')](_0x5274eb[_0xfe38('0x1b')],{'raw':_0x5274eb[_0xfe38('0x1c')]?_0x5274eb['options'][_0xfe38('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5274eb[_0xfe38('0x1c')]?_0x5274eb[_0xfe38('0x1c')][_0xfe38('0x1e')]||null:null,'attributes':_0x5274eb[_0xfe38('0x1c')]?_0x5274eb['options']['attributes']||null:null,'limit':_0x5274eb[_0xfe38('0x1c')]?_0x5274eb[_0xfe38('0x1c')][_0xfe38('0x1f')]||null:null})['then'](function(_0x2da3b8){logger['info'](_0xfe38('0x18'),_0x5274eb);logger['debug'](_0xfe38('0x18'),_0x5274eb,JSON['stringify'](_0x2da3b8));_0x1b298c(_0x2da3b8);})['catch'](function(_0x38495a){logger[_0xfe38('0x14')](_0xfe38('0x18'),_0x38495a[_0xfe38('0x15')],_0x5274eb);_0x58cd9a(_0x231c0a[_0xfe38('0x14')](0x1f4,_0x38495a[_0xfe38('0x15')]));});});};exports[_0xfe38('0x20')]=function(_0x278c49){return new Promise(function(_0x4f48a4,_0xa9cce6){return db[_0xfe38('0x19')][_0xfe38('0x21')]({'where':_0x278c49[_0xfe38('0x1c')]?_0x278c49[_0xfe38('0x1c')]['where']||null:null})[_0xfe38('0xf')](function(_0x4ed2fb){if(_0x4ed2fb){return _0x4ed2fb['addTags'](_0x278c49[_0xfe38('0x1b')]['ids'],_[_0xfe38('0x22')](_0x278c49[_0xfe38('0x1b')],[_0xfe38('0x23'),'id'])||{});}})[_0xfe38('0x24')](function(_0x4ee96c){logger[_0xfe38('0x25')]('AddTags',_0x278c49);logger['debug'](_0xfe38('0x26'),_0x278c49,JSON[_0xfe38('0x27')](_0x4ee96c));_0x4f48a4(_0x4ee96c);})[_0xfe38('0x17')](function(_0x1d6ecf){logger[_0xfe38('0x14')](_0xfe38('0x26'),_0x1d6ecf[_0xfe38('0x15')],_0x278c49);_0xa9cce6(_this['error'](0x1f4,_0x1d6ecf[_0xfe38('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 3edcff6..70f5c95 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 _0xc948=['save','update','emit','removeListener','./whatsappInteraction.events'];(function(_0x135467,_0x1651ef){var _0x26ec97=function(_0x257e8a){while(--_0x257e8a){_0x135467['push'](_0x135467['shift']());}};_0x26ec97(++_0x1651ef);}(_0xc948,0x117));var _0x8c94=function(_0x18125b,_0x4f420a){_0x18125b=_0x18125b-0x0;var _0xe7519c=_0xc948[_0x18125b];return _0xe7519c;};'use strict';var WhatsappInteractionEvents=require(_0x8c94('0x0'));var events=[_0x8c94('0x1'),'remove',_0x8c94('0x2')];function createListener(_0x34775b,_0x26db0f){return function(_0x5eb93c){_0x26db0f[_0x8c94('0x3')](_0x34775b,_0x5eb93c);};}function removeListener(_0x450f9d,_0x3d4f54){return function(){WhatsappInteractionEvents[_0x8c94('0x4')](_0x450f9d,_0x3d4f54);};}exports['register']=function(_0x3d7abc){for(var _0xbb77dd=0x0,_0x75bd4=events['length'];_0xbb77dd<_0x75bd4;_0xbb77dd++){var _0x5c09cb=events[_0xbb77dd];var _0x29e960=createListener('whatsappInteraction:'+_0x5c09cb,_0x3d7abc);WhatsappInteractionEvents['on'](_0x5c09cb,_0x29e960);}}; \ No newline at end of file +var _0x96b4=['register','length','whatsappInteraction:','save','remove','update','emit','removeListener'];(function(_0x28ed63,_0xfaaeae){var _0x48d645=function(_0x481ebd){while(--_0x481ebd){_0x28ed63['push'](_0x28ed63['shift']());}};_0x48d645(++_0xfaaeae);}(_0x96b4,0x173));var _0x496b=function(_0x537d3f,_0x2882e0){_0x537d3f=_0x537d3f-0x0;var _0x4c8df5=_0x96b4[_0x537d3f];return _0x4c8df5;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x496b('0x0'),_0x496b('0x1'),_0x496b('0x2')];function createListener(_0x991f82,_0x5295d2){return function(_0x423d38){_0x5295d2[_0x496b('0x3')](_0x991f82,_0x423d38);};}function removeListener(_0x40743b,_0x2a59f0){return function(){WhatsappInteractionEvents[_0x496b('0x4')](_0x40743b,_0x2a59f0);};}exports[_0x496b('0x5')]=function(_0x23bac8){for(var _0x179ef7=0x0,_0x46762c=events[_0x496b('0x6')];_0x179ef7<_0x46762c;_0x179ef7++){var _0xec0d4e=events[_0x179ef7];var _0x141dcd=createListener(_0x496b('0x7')+_0xec0d4e,_0x23bac8);WhatsappInteractionEvents['on'](_0xec0d4e,_0x141dcd);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index f152e3f..a3c5e5d 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 _0x173c=['delete','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','whatsapp','create','/:id/status','status','update','accept','put'];(function(_0x28a0b2,_0xe0932d){var _0x3775ac=function(_0x4befea){while(--_0x4befea){_0x28a0b2['push'](_0x28a0b2['shift']());}};_0x3775ac(++_0xe0932d);}(_0x173c,0x1ca));var _0xc173=function(_0x2b9d75,_0x6b055e){_0x2b9d75=_0x2b9d75-0x0;var _0x43a241=_0x173c[_0x2b9d75];return _0x43a241;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc173('0x0'));var timeout=require(_0xc173('0x1'));var express=require(_0xc173('0x2'));var router=express['Router']();var fs_extra=require(_0xc173('0x3'));var auth=require(_0xc173('0x4'));var interaction=require(_0xc173('0x5'));var config=require('../../config/environment');var controller=require('./whatsappMessage.controller');router[_0xc173('0x6')]('/',auth[_0xc173('0x7')](),controller[_0xc173('0x8')]);router[_0xc173('0x6')](_0xc173('0x9'),auth['isAuthenticated'](),controller[_0xc173('0xa')]);router[_0xc173('0x6')](_0xc173('0xb'),auth[_0xc173('0x7')](),controller[_0xc173('0xc')]);router[_0xc173('0xd')]('/',auth[_0xc173('0x7')](),interaction[_0xc173('0xe')](_0xc173('0xf'),'whatsappmessage:create'),controller[_0xc173('0x10')]);router[_0xc173('0xd')](_0xc173('0x11'),controller[_0xc173('0x12')]);router['put'](_0xc173('0xb'),auth[_0xc173('0x7')](),controller[_0xc173('0x13')]);router['put']('/:id/accept',auth[_0xc173('0x7')](),controller[_0xc173('0x14')]);router[_0xc173('0x15')]('/:id/reject',auth[_0xc173('0x7')](),controller['reject']);router[_0xc173('0x16')](_0xc173('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xc173('0x17')]=router; \ No newline at end of file +var _0x354f=['accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create','/:id/status','status','update','put','/:id/accept'];(function(_0x398244,_0x43da6b){var _0x1e728e=function(_0xac3dd0){while(--_0xac3dd0){_0x398244['push'](_0x398244['shift']());}};_0x1e728e(++_0x43da6b);}(_0x354f,0x171));var _0xf354=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x354f[_0x47aa64];return _0x549c7a;};'use strict';var multer=require(_0xf354('0x0'));var util=require(_0xf354('0x1'));var path=require(_0xf354('0x2'));var timeout=require(_0xf354('0x3'));var express=require(_0xf354('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf354('0x5'));var config=require(_0xf354('0x6'));var controller=require(_0xf354('0x7'));router['get']('/',auth[_0xf354('0x8')](),controller[_0xf354('0x9')]);router[_0xf354('0xa')](_0xf354('0xb'),auth[_0xf354('0x8')](),controller[_0xf354('0xc')]);router[_0xf354('0xa')](_0xf354('0xd'),auth[_0xf354('0x8')](),controller['show']);router[_0xf354('0xe')]('/',auth[_0xf354('0x8')](),interaction['tracked']('whatsapp','whatsappmessage:create'),controller[_0xf354('0xf')]);router[_0xf354('0xe')](_0xf354('0x10'),controller[_0xf354('0x11')]);router['put'](_0xf354('0xd'),auth['isAuthenticated'](),controller[_0xf354('0x12')]);router[_0xf354('0x13')](_0xf354('0x14'),auth[_0xf354('0x8')](),controller[_0xf354('0x15')]);router[_0xf354('0x13')](_0xf354('0x16'),auth[_0xf354('0x8')](),controller[_0xf354('0x17')]);router[_0xf354('0x18')]('/:id',auth[_0xf354('0x8')](),controller[_0xf354('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 868520e..b7dc068 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 _0x798e=['TEXT','medium','BOOLEAN','out','STRING','DATE','sequelize'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x798e,0x187));var _0xe798=function(_0x43215c,_0x2e70c1){_0x43215c=_0x43215c-0x0;var _0x15a751=_0x798e[_0x43215c];return _0x15a751;};'use strict';var Sequelize=require(_0xe798('0x0'));module['exports']={'body':{'type':Sequelize[_0xe798('0x1')](_0xe798('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xe798('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xe798('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xe798('0x5')](0xbe)},'phone':{'type':Sequelize[_0xe798('0x5')]},'readAt':{'type':Sequelize[_0xe798('0x6')]},'secret':{'type':Sequelize[_0xe798('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xe798('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x3b8e=['out','STRING','TEXT','BOOLEAN','ENUM'];(function(_0x52a5bc,_0x319518){var _0x48fb6c=function(_0x2ab3e3){while(--_0x2ab3e3){_0x52a5bc['push'](_0x52a5bc['shift']());}};_0x48fb6c(++_0x319518);}(_0x3b8e,0x10b));var _0xe3b8=function(_0x1ae7b0,_0x2301a2){_0x1ae7b0=_0x1ae7b0-0x0;var _0x2d83dc=_0x3b8e[_0x1ae7b0];return _0x2d83dc;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xe3b8('0x0')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe3b8('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe3b8('0x2')]('in',_0xe3b8('0x3')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xe3b8('0x4')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xe3b8('0x1')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 1578d8b..a7b1b07 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 _0x38ca=['set','Content-Range','reject','save','update','then','destroy','stack','name','index','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','find','create','body','describe','whatsapp-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','User','fullname','internal','channel','motionChannel','EventManager','acceptmessage','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','ContactId','Sequelize','QueryTypes','SELECT','email','interface','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','localhost','./whatsappMessage.socket','client','http','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset'];(function(_0x1e9c8f,_0x126d0f){var _0x3b04af=function(_0xa8b897){while(--_0xa8b897){_0x1e9c8f['push'](_0x1e9c8f['shift']());}};_0x3b04af(++_0x126d0f);}(_0x38ca,0xde));var _0xa38c=function(_0x39c2f4,_0x1b9ee9){_0x39c2f4=_0x39c2f4-0x0;var _0x19c099=_0x38ca[_0x39c2f4];return _0x19c099;};'use strict';var emlformat=require(_0xa38c('0x0'));var rimraf=require(_0xa38c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa38c('0x2'));var moment=require(_0xa38c('0x3'));var BPromise=require(_0xa38c('0x4'));var Mustache=require(_0xa38c('0x5'));var util=require('util');var path=require(_0xa38c('0x6'));var sox=require(_0xa38c('0x7'));var csv=require('to-csv');var ejs=require(_0xa38c('0x8'));var fs=require('fs');var fs_extra=require(_0xa38c('0x9'));var _=require(_0xa38c('0xa'));var squel=require(_0xa38c('0xb'));var crypto=require(_0xa38c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa38c('0xd'));var toCsv=require(_0xa38c('0xe'));var querystring=require(_0xa38c('0xf'));var Papa=require(_0xa38c('0x10'));var Redis=require(_0xa38c('0x11'));var authService=require(_0xa38c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa38c('0x13'));var hardwareService=require(_0xa38c('0x14'));var logger=require(_0xa38c('0x15'))(_0xa38c('0x16'));var utils=require('../../config/utils');var config=require(_0xa38c('0x17'));var licenseUtil=require(_0xa38c('0x18'));var db=require('../../mysqldb')['db'];config[_0xa38c('0x19')]=_['defaults'](config['redis'],{'host':_0xa38c('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa38c('0x1b'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xa38c('0x1c')][_0xa38c('0x1d')]({'port':0x232c});var client9002=jayson[_0xa38c('0x1c')][_0xa38c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x46005c,_0xdb918c,_0x105f7a,_0x398f19){return new BPromise(function(_0x557fee,_0x23dc90){var _0x54d2fa=_0x398f19||client;return _0x54d2fa[_0xa38c('0x1e')](_0x46005c,_0x105f7a)['then'](function(_0x1c9863){logger[_0xa38c('0x1f')](_0xa38c('0x20'),_0xdb918c,_0xa38c('0x21'));logger[_0xa38c('0x22')](_0xa38c('0x23'),_0xdb918c,_0xa38c('0x21'),JSON[_0xa38c('0x24')](_0x1c9863));if(_0x1c9863[_0xa38c('0x25')]){if(_0x1c9863['error'][_0xa38c('0x26')]===0x1f4){logger[_0xa38c('0x25')](_0xa38c('0x20'),_0xdb918c,_0x1c9863[_0xa38c('0x25')][_0xa38c('0x27')]);return _0x23dc90(_0x1c9863[_0xa38c('0x25')][_0xa38c('0x27')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0xdb918c,_0x1c9863[_0xa38c('0x25')][_0xa38c('0x27')]);return _0x557fee(_0x1c9863[_0xa38c('0x25')]['message']);}else{logger[_0xa38c('0x1f')](_0xa38c('0x20'),_0xdb918c,_0xa38c('0x21'));_0x557fee(_0x1c9863[_0xa38c('0x28')][_0xa38c('0x27')]);}})[_0xa38c('0x29')](function(_0x116dbc){logger[_0xa38c('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0xdb918c,_0x116dbc);_0x23dc90(_0x116dbc);});});}function respondWithStatusCode(_0x5493c2,_0x319e0f){_0x319e0f=_0x319e0f||0xcc;return function(_0x26232f){if(_0x26232f){return _0x5493c2[_0xa38c('0x2a')](_0x319e0f);}return _0x5493c2[_0xa38c('0x2b')](_0x319e0f)[_0xa38c('0x2c')]();};}function respondWithResult(_0x22f774,_0x4229cf){_0x4229cf=_0x4229cf||0xc8;return function(_0x491815){if(_0x491815){return _0x22f774[_0xa38c('0x2b')](_0x4229cf)[_0xa38c('0x2d')](_0x491815);}};}function respondWithFilteredResult(_0x2830ec,_0x2fc8b8){return function(_0x2150f9){if(_0x2150f9){var _0x5cdd5e=typeof _0x2fc8b8['offset']===_0xa38c('0x2e')&&typeof _0x2fc8b8[_0xa38c('0x2f')]===_0xa38c('0x2e');var _0x31462b=_0x2150f9[_0xa38c('0x30')];var _0x5c62bf=_0x5cdd5e?0x0:_0x2fc8b8[_0xa38c('0x31')];var _0x2b4a75=_0x5cdd5e?_0x2150f9[_0xa38c('0x30')]:_0x2fc8b8[_0xa38c('0x31')]+_0x2fc8b8[_0xa38c('0x2f')];var _0x5eaf67;if(_0x2b4a75>=_0x31462b){_0x2b4a75=_0x31462b;_0x5eaf67=0xc8;}else{_0x5eaf67=0xce;}_0x2830ec[_0xa38c('0x2b')](_0x5eaf67);return _0x2830ec[_0xa38c('0x32')](_0xa38c('0x33'),_0x5c62bf+'-'+_0x2b4a75+'/'+_0x31462b)[_0xa38c('0x2d')](_0x2150f9);}return null;};}function patchUpdates(_0x28c7b8){return function(_0x4c9cb7){try{jsonpatch['apply'](_0x4c9cb7,_0x28c7b8,!![]);}catch(_0x1174f2){return BPromise[_0xa38c('0x34')](_0x1174f2);}return _0x4c9cb7[_0xa38c('0x35')]();};}function saveUpdates(_0x2ba70c,_0x43185f){return function(_0x254ba5){if(_0x254ba5){return _0x254ba5[_0xa38c('0x36')](_0x2ba70c)[_0xa38c('0x37')](function(_0x22723f){return _0x22723f;});}return null;};}function removeEntity(_0x32b94a,_0x254a76){return function(_0x19a151){if(_0x19a151){return _0x19a151[_0xa38c('0x38')]()[_0xa38c('0x37')](function(){_0x32b94a[_0xa38c('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44ac98,_0x5e2bed){return function(_0x33b5bd){if(!_0x33b5bd){_0x44ac98[_0xa38c('0x2a')](0x194);}return _0x33b5bd;};}function handleError(_0x284022,_0x7f2d28){_0x7f2d28=_0x7f2d28||0x1f4;return function(_0x282a4d){logger[_0xa38c('0x25')](_0x282a4d[_0xa38c('0x39')]);if(_0x282a4d[_0xa38c('0x3a')]){delete _0x282a4d['name'];}_0x284022[_0xa38c('0x2b')](_0x7f2d28)['send'](_0x282a4d);};}exports[_0xa38c('0x3b')]=function(_0x2f9bc9,_0x49d99f){var _0x5468a3={},_0x5f5098={},_0x3eb689={'count':0x0,'rows':[]};var _0xfb14e3=_['map'](db[_0xa38c('0x3c')][_0xa38c('0x3d')],function(_0x15c2d6){return{'name':_0x15c2d6[_0xa38c('0x3e')],'type':_0x15c2d6[_0xa38c('0x3f')][_0xa38c('0x40')]};});_0x5f5098[_0xa38c('0x41')]=_['map'](_0xfb14e3,_0xa38c('0x3a'));_0x5f5098[_0xa38c('0x42')]=_[_0xa38c('0x43')](_0x2f9bc9[_0xa38c('0x42')]);_0x5f5098['filters']=_[_0xa38c('0x44')](_0x5f5098['model'],_0x5f5098[_0xa38c('0x42')]);_0x5468a3[_0xa38c('0x45')]=_[_0xa38c('0x44')](_0x5f5098[_0xa38c('0x41')],qs[_0xa38c('0x46')](_0x2f9bc9[_0xa38c('0x42')][_0xa38c('0x46')]));_0x5468a3['attributes']=_0x5468a3[_0xa38c('0x45')][_0xa38c('0x47')]?_0x5468a3['attributes']:_0x5f5098['model'];if(!_0x2f9bc9[_0xa38c('0x42')][_0xa38c('0x48')]('nolimit')){_0x5468a3[_0xa38c('0x2f')]=qs[_0xa38c('0x2f')](_0x2f9bc9[_0xa38c('0x42')][_0xa38c('0x2f')]);_0x5468a3[_0xa38c('0x31')]=qs['offset'](_0x2f9bc9['query'][_0xa38c('0x31')]);}_0x5468a3[_0xa38c('0x49')]=qs[_0xa38c('0x4a')](_0x2f9bc9[_0xa38c('0x42')][_0xa38c('0x4a')]);_0x5468a3[_0xa38c('0x4b')]=qs['filters'](_[_0xa38c('0x4c')](_0x2f9bc9[_0xa38c('0x42')],_0x5f5098[_0xa38c('0x4d')]),_0xfb14e3);if(_0x2f9bc9[_0xa38c('0x42')][_0xa38c('0x4e')]){_0x5468a3[_0xa38c('0x4b')]=_[_0xa38c('0x4f')](_0x5468a3[_0xa38c('0x4b')],{'$or':_['map'](_0xfb14e3,function(_0x21b127){if(_0x21b127[_0xa38c('0x3f')]!==_0xa38c('0x50')){var _0x2fcc14={};_0x2fcc14[_0x21b127[_0xa38c('0x3a')]]={'$like':'%'+_0x2f9bc9[_0xa38c('0x42')]['filter']+'%'};return _0x2fcc14;}})});}_0x5468a3=_[_0xa38c('0x4f')]({},_0x5468a3,_0x2f9bc9[_0xa38c('0x51')]);var _0x53f6b3={'where':_0x5468a3[_0xa38c('0x4b')]};return db[_0xa38c('0x3c')][_0xa38c('0x30')](_0x53f6b3)[_0xa38c('0x37')](function(_0x596073){_0x3eb689[_0xa38c('0x30')]=_0x596073;if(_0x2f9bc9[_0xa38c('0x42')][_0xa38c('0x52')]){_0x5468a3['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0xa38c('0x53')](_0x5468a3);})[_0xa38c('0x37')](function(_0x2bfcd4){_0x3eb689[_0xa38c('0x54')]=_0x2bfcd4;return _0x3eb689;})[_0xa38c('0x37')](respondWithFilteredResult(_0x49d99f,_0x5468a3))[_0xa38c('0x29')](handleError(_0x49d99f,null));};exports['show']=function(_0x581dfa,_0x414016){var _0x136fd6={'raw':!![],'where':{'id':_0x581dfa[_0xa38c('0x55')]['id']}},_0x4ae94f={};_0x4ae94f[_0xa38c('0x41')]=_[_0xa38c('0x43')](db[_0xa38c('0x3c')]['rawAttributes']);_0x4ae94f[_0xa38c('0x42')]=_[_0xa38c('0x43')](_0x581dfa[_0xa38c('0x42')]);_0x4ae94f[_0xa38c('0x4d')]=_[_0xa38c('0x44')](_0x4ae94f[_0xa38c('0x41')],_0x4ae94f['query']);_0x136fd6[_0xa38c('0x45')]=_[_0xa38c('0x44')](_0x4ae94f[_0xa38c('0x41')],qs['fields'](_0x581dfa['query'][_0xa38c('0x46')]));_0x136fd6[_0xa38c('0x45')]=_0x136fd6[_0xa38c('0x45')][_0xa38c('0x47')]?_0x136fd6[_0xa38c('0x45')]:_0x4ae94f[_0xa38c('0x41')];if(_0x581dfa[_0xa38c('0x42')][_0xa38c('0x52')]){_0x136fd6['include']=[{'all':!![]}];}_0x136fd6=_[_0xa38c('0x4f')]({},_0x136fd6,_0x581dfa[_0xa38c('0x51')]);return db[_0xa38c('0x3c')][_0xa38c('0x56')](_0x136fd6)['then'](handleEntityNotFound(_0x414016,null))['then'](respondWithResult(_0x414016,null))[_0xa38c('0x29')](handleError(_0x414016,null));};exports['create']=function(_0xfa05a7,_0x579da0){return db['WhatsappMessage'][_0xa38c('0x57')](_0xfa05a7[_0xa38c('0x58')],{})[_0xa38c('0x37')](respondWithResult(_0x579da0,0xc9))['catch'](handleError(_0x579da0,null));};exports['update']=function(_0x460600,_0xf301dd){if(_0x460600[_0xa38c('0x58')]['id']){delete _0x460600[_0xa38c('0x58')]['id'];}return db[_0xa38c('0x3c')][_0xa38c('0x56')]({'where':{'id':_0x460600[_0xa38c('0x55')]['id']}})[_0xa38c('0x37')](handleEntityNotFound(_0xf301dd,null))[_0xa38c('0x37')](saveUpdates(_0x460600[_0xa38c('0x58')],null))[_0xa38c('0x37')](respondWithResult(_0xf301dd,null))[_0xa38c('0x29')](handleError(_0xf301dd,null));};exports[_0xa38c('0x38')]=function(_0x49e608,_0x1eec08){return db[_0xa38c('0x3c')]['find']({'where':{'id':_0x49e608[_0xa38c('0x55')]['id']}})[_0xa38c('0x37')](handleEntityNotFound(_0x1eec08,null))[_0xa38c('0x37')](removeEntity(_0x1eec08,null))[_0xa38c('0x29')](handleError(_0x1eec08,null));};exports['describe']=function(_0x3e4c38,_0x42d164){return db[_0xa38c('0x3c')][_0xa38c('0x59')]()[_0xa38c('0x37')](respondWithResult(_0x42d164,null))[_0xa38c('0x29')](handleError(_0x42d164,null));};var interaction_log=require('../../config/logger')(_0xa38c('0x5a'));exports[_0xa38c('0x5b')]=function(_0x35ca24,_0xd31764,_0x183965){var _0x963ff2={'agent':{},'channel':'whatsapp'};if(_0x35ca24[_0xa38c('0x58')]['id']){delete _0x35ca24['body']['id'];}_0x35ca24['body'][_0xa38c('0x5c')]=!![];_0x35ca24[_0xa38c('0x58')][_0xa38c('0x5d')]=moment()[_0xa38c('0x5e')](_0xa38c('0x5f'));_0x35ca24[_0xa38c('0x58')][_0xa38c('0x60')]=_0x35ca24[_0xa38c('0x58')]['UserId']||_0x35ca24['user']['id'];_0x963ff2[_0xa38c('0x61')]['id']=_0x35ca24[_0xa38c('0x58')][_0xa38c('0x60')];return db[_0xa38c('0x3c')][_0xa38c('0x56')]({'where':{'id':_0x35ca24[_0xa38c('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xd31764,null))['then'](saveUpdates(_0x35ca24[_0xa38c('0x58')],null))[_0xa38c('0x37')](function(_0x517fa7){if(_0x517fa7){_0x963ff2[_0xa38c('0x27')]=_0x517fa7[_0xa38c('0x62')]({'plain':!![]});return db['WhatsappInteraction'][_0xa38c('0x56')]({'where':{'id':_0x517fa7['WhatsappInteractionId']}});}return null;})[_0xa38c('0x37')](handleEntityNotFound(_0xd31764,null))[_0xa38c('0x37')](function(_0x2026ed){if(_0x2026ed){return _0x2026ed[_0xa38c('0x36')]({'UserId':_0x35ca24[_0xa38c('0x58')][_0xa38c('0x60')],'read1stAt':_[_0xa38c('0x63')](_0x2026ed[_0xa38c('0x64')])?moment()[_0xa38c('0x5e')](_0xa38c('0x5f')):undefined});}return null;})['then'](function(_0x5bc659){if(_0x5bc659){_0x963ff2[_0xa38c('0x65')]=_0x5bc659[_0xa38c('0x62')]({'plain':!![]});interaction_log[_0xa38c('0x1f')](_0xa38c('0x66'),_0x35ca24[_0xa38c('0x67')]['id'],_0x35ca24[_0xa38c('0x67')][_0xa38c('0x3a')],_0x35ca24[_0xa38c('0x67')][_0xa38c('0x68')],_0x963ff2[_0xa38c('0x65')]['id'],_0x35ca24[_0xa38c('0x58')]?JSON['stringify'](_0x35ca24[_0xa38c('0x58')]):'null');return respondWithRpcPromise(_0xa38c('0x69'),'acceptMessage',_0x963ff2);}return null;})[_0xa38c('0x37')](function(_0x2f172a){var _0x4d69ac=_0xa38c('0x6a')+_0x2f172a[_0xa38c('0x27')]['ContactId'];return db[_0xa38c('0x6b')][_0xa38c('0x42')](_0x4d69ac,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0xa38c('0x37')](function(_0x4a7c46){return _0x4a7c46;});})['then'](function(_0x57cfba){if(_0x57cfba){_0x963ff2[_0xa38c('0x27')]['contact']=_0x57cfba[0x0];if(!_0x35ca24[_0xa38c('0x58')][_0xa38c('0x60')])return;return db[_0xa38c('0x6c')][_0xa38c('0x56')]({'where':{'id':_0x35ca24[_0xa38c('0x58')][_0xa38c('0x60')],'role':'agent'},'attributes':['id',_0xa38c('0x3a'),_0xa38c('0x6d'),'email',_0xa38c('0x6e')],'raw':!![]});}return null;})[_0xa38c('0x37')](function(_0x5cfe23){if(!_0x5cfe23)return null;_0x963ff2[_0xa38c('0x27')][_0xa38c('0x61')]=_0x5cfe23;return _0x963ff2;})[_0xa38c('0x37')](function(_0x11b3ac){if(_0x11b3ac){if(_0x35ca24[_0xa38c('0x58')]['manual']){_0x963ff2[_0xa38c('0x27')]['interface']=util[_0xa38c('0x5e')]('SIP/%s',_0x35ca24[_0xa38c('0x67')][_0xa38c('0x3a')]);_0x963ff2['message']['channel']=_0x963ff2[_0xa38c('0x6f')];_0x963ff2['message'][_0xa38c('0x70')]=_0x963ff2[_0xa38c('0x6f')];_0x963ff2[_0xa38c('0x27')]['event']=_0xa38c('0x5b');return respondWithRpcPromise(_0xa38c('0x71'),_0xa38c('0x71'),{'event':_0xa38c('0x72'),'message':_0x963ff2[_0xa38c('0x27')]},client9002)['then'](function(){return _0x963ff2;});}return _0x963ff2;}return null;})[_0xa38c('0x37')](respondWithResult(_0xd31764,null))['catch'](handleError(_0xd31764,null));};var interaction_log=require(_0xa38c('0x15'))(_0xa38c('0x5a'));exports[_0xa38c('0x34')]=function(_0x2061c5,_0x50630c,_0x57fc58){var _0xc25670={'agent':{},'channel':'whatsapp'};if(_0x2061c5[_0xa38c('0x58')]['id']){delete _0x2061c5[_0xa38c('0x58')]['id'];}_0x2061c5[_0xa38c('0x58')][_0xa38c('0x60')]=_0x2061c5[_0xa38c('0x58')][_0xa38c('0x60')]||_0x2061c5[_0xa38c('0x67')]['id'];_0xc25670[_0xa38c('0x61')]['id']=_0x2061c5[_0xa38c('0x58')][_0xa38c('0x60')];return db[_0xa38c('0x3c')][_0xa38c('0x56')]({'where':{'id':_0x2061c5[_0xa38c('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x50630c,null))['then'](function(_0x48aadd){if(_0x48aadd){_0xc25670[_0xa38c('0x27')]=_0x48aadd[_0xa38c('0x62')]({'plain':!![]});return db[_0xa38c('0x73')][_0xa38c('0x56')]({'where':{'id':_0x48aadd['WhatsappInteractionId']}});}return null;})[_0xa38c('0x37')](handleEntityNotFound(_0x50630c,null))[_0xa38c('0x37')](function(_0xec6bba){if(_0xec6bba){_0xc25670[_0xa38c('0x65')]=_0xec6bba[_0xa38c('0x62')]({'plain':!![]});interaction_log[_0xa38c('0x1f')](_0xa38c('0x74'),_0x2061c5['user']['id'],_0x2061c5[_0xa38c('0x67')]['name'],_0x2061c5[_0xa38c('0x67')][_0xa38c('0x68')],_0xc25670[_0xa38c('0x65')]['id'],_0x2061c5[_0xa38c('0x58')]?JSON[_0xa38c('0x24')](_0x2061c5[_0xa38c('0x58')]):_0xa38c('0x75'));return respondWithRpcPromise(_0xa38c('0x76'),_0xa38c('0x77'),_0xc25670);}return null;})['then'](function(_0x270754){var _0x3780ae=_0xa38c('0x6a')+_0x270754[_0xa38c('0x27')][_0xa38c('0x78')];return db[_0xa38c('0x6b')]['query'](_0x3780ae,{'type':db[_0xa38c('0x79')][_0xa38c('0x7a')][_0xa38c('0x7b')],'raw':!![]})[_0xa38c('0x37')](function(_0x48bd6f){return _0x48bd6f;});})[_0xa38c('0x37')](function(_0x548695){if(_0x548695){_0xc25670[_0xa38c('0x27')]['contact']=_0x548695[0x0];if(!_0x2061c5[_0xa38c('0x58')][_0xa38c('0x60')])return;return db[_0xa38c('0x6c')][_0xa38c('0x56')]({'where':{'id':_0x2061c5[_0xa38c('0x58')]['UserId'],'role':'agent'},'attributes':['id',_0xa38c('0x3a'),'fullname',_0xa38c('0x7c'),_0xa38c('0x6e')],'raw':!![]});}return null;})[_0xa38c('0x37')](function(_0x5205e3){if(!_0x5205e3)return null;_0xc25670[_0xa38c('0x27')][_0xa38c('0x61')]=_0x5205e3;return _0xc25670;})[_0xa38c('0x37')](function(_0x5867ed){if(_0x5867ed){_0x5867ed['message'][_0xa38c('0x7d')]=util['format']('SIP/%s',_0x2061c5['user'][_0xa38c('0x3a')]);_0x5867ed[_0xa38c('0x27')][_0xa38c('0x6f')]=_0xc25670[_0xa38c('0x6f')];_0x5867ed[_0xa38c('0x27')]['motionChannel']=_0xc25670[_0xa38c('0x6f')];_0x5867ed[_0xa38c('0x27')]['event']='reject';respondWithRpcPromise(_0xa38c('0x71'),_0xa38c('0x71'),{'event':_0xa38c('0x7e'),'message':_0x5867ed[_0xa38c('0x27')]},client9002);return _0xc25670;}return null;})[_0xa38c('0x37')](respondWithResult(_0x50630c,null))[_0xa38c('0x29')](handleError(_0x50630c,null));};exports[_0xa38c('0x2b')]=function(_0x4ac562,_0x405af8,_0x18fb64){if(_0x4ac562[_0xa38c('0x58')]['id']){delete _0x4ac562[_0xa38c('0x58')]['id'];}var _0x3e8af6;return db[_0xa38c('0x3c')]['find']({'where':{'id':_0x4ac562[_0xa38c('0x55')]['id']}})[_0xa38c('0x37')](handleEntityNotFound(_0x405af8,null))[_0xa38c('0x37')](function(_0x5ecfe1){if(_0x5ecfe1){_0x3e8af6=_0x5ecfe1;return db[_0xa38c('0x7f')][_0xa38c('0x56')]({'where':{'id':_0x5ecfe1['WhatsappAccountId']}});}})[_0xa38c('0x37')](handleEntityNotFound(_0x405af8,null))['then'](function(_0x3d8bda){if(_0x3d8bda){logger['debug'](_0xa38c('0x80'),_0xa38c('0x2b'),_0xa38c('0x81'),_0x3d8bda['type'],util[_0xa38c('0x82')](_0x4ac562[_0xa38c('0x58')],{'showHidden':![],'depth':null}));switch(_0x3d8bda[_0xa38c('0x3f')]){case _0xa38c('0x83'):if(_0x4ac562[_0xa38c('0x58')][_0xa38c('0x84')]&&_0x4ac562[_0xa38c('0x58')]['MessageSid']===_0x3e8af6[_0xa38c('0x85')]&&_0x4ac562['body'][_0xa38c('0x86')]&&_0x4ac562[_0xa38c('0x58')][_0xa38c('0x86')]===_0xa38c('0x5c')){return _0x3e8af6[_0xa38c('0x36')]({'read':!![]});}else{logger[_0xa38c('0x25')](_0xa38c('0x87'),_0xa38c('0x2b'),_0xa38c('0x83'),util[_0xa38c('0x82')](_0x4ac562[_0xa38c('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x3e8af6;}})['then'](respondWithResult(_0x405af8,null))[_0xa38c('0x29')](handleError(_0x405af8,null));}; \ No newline at end of file +var _0xfed4=['reject','save','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','rows','show','params','length','includeAll','find','create','body','update','describe','whatsapp-interactions','accept','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','interaction','get','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','manual','interface','format','motionChannel','channel','event','EventManager','WhatsappInteraction','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','internal','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','catch','sendStatus','status','end','offset','undefined','limit','count','set'];(function(_0x2599d0,_0x3cc2bb){var _0x3b826f=function(_0x1ae40c){while(--_0x1ae40c){_0x2599d0['push'](_0x2599d0['shift']());}};_0x3b826f(++_0x3cc2bb);}(_0xfed4,0xdd));var _0x4fed=function(_0x11ab5d,_0x494416){_0x11ab5d=_0x11ab5d-0x0;var _0x16569a=_0xfed4[_0x11ab5d];return _0x16569a;};'use strict';var emlformat=require(_0x4fed('0x0'));var rimraf=require(_0x4fed('0x1'));var zipdir=require(_0x4fed('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4fed('0x3'));var BPromise=require(_0x4fed('0x4'));var Mustache=require(_0x4fed('0x5'));var util=require(_0x4fed('0x6'));var path=require('path');var sox=require(_0x4fed('0x7'));var csv=require(_0x4fed('0x8'));var ejs=require(_0x4fed('0x9'));var fs=require('fs');var fs_extra=require(_0x4fed('0xa'));var _=require('lodash');var squel=require(_0x4fed('0xb'));var crypto=require(_0x4fed('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4fed('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4fed('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4fed('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4fed('0x10'));var logger=require(_0x4fed('0x11'))(_0x4fed('0x12'));var utils=require('../../config/utils');var config=require(_0x4fed('0x13'));var licenseUtil=require(_0x4fed('0x14'));var db=require(_0x4fed('0x15'))['db'];config[_0x4fed('0x16')]=_[_0x4fed('0x17')](config[_0x4fed('0x16')],{'host':_0x4fed('0x18'),'port':0x18eb});var socket=require(_0x4fed('0x19'))(new Redis(config[_0x4fed('0x16')]));require(_0x4fed('0x1a'))[_0x4fed('0x1b')](socket);var jayson=require(_0x4fed('0x1c'));var client=jayson[_0x4fed('0x1d')][_0x4fed('0x1e')]({'port':0x232c});var client9002=jayson[_0x4fed('0x1d')][_0x4fed('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2c4759,_0x380c71,_0x2e83eb,_0x1fe559){return new BPromise(function(_0x5d7272,_0x538687){var _0x400e2b=_0x1fe559||client;return _0x400e2b[_0x4fed('0x1f')](_0x2c4759,_0x2e83eb)[_0x4fed('0x20')](function(_0x51e06c){logger[_0x4fed('0x21')]('WhatsappMessage,\x20%s,\x20%s',_0x380c71,'request\x20sent');logger[_0x4fed('0x22')](_0x4fed('0x23'),_0x380c71,_0x4fed('0x24'),JSON[_0x4fed('0x25')](_0x51e06c));if(_0x51e06c[_0x4fed('0x26')]){if(_0x51e06c[_0x4fed('0x26')][_0x4fed('0x27')]===0x1f4){logger[_0x4fed('0x26')](_0x4fed('0x28'),_0x380c71,_0x51e06c[_0x4fed('0x26')][_0x4fed('0x29')]);return _0x538687(_0x51e06c['error'][_0x4fed('0x29')]);}logger[_0x4fed('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x380c71,_0x51e06c['error'][_0x4fed('0x29')]);return _0x5d7272(_0x51e06c[_0x4fed('0x26')][_0x4fed('0x29')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x380c71,_0x4fed('0x24'));_0x5d7272(_0x51e06c['result'][_0x4fed('0x29')]);}})[_0x4fed('0x2a')](function(_0x2fb33e){logger[_0x4fed('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x380c71,_0x2fb33e);_0x538687(_0x2fb33e);});});}function respondWithStatusCode(_0x1534be,_0x58e4a7){_0x58e4a7=_0x58e4a7||0xcc;return function(_0x545147){if(_0x545147){return _0x1534be[_0x4fed('0x2b')](_0x58e4a7);}return _0x1534be[_0x4fed('0x2c')](_0x58e4a7)[_0x4fed('0x2d')]();};}function respondWithResult(_0x1368ad,_0x3829e0){_0x3829e0=_0x3829e0||0xc8;return function(_0x4f6d6e){if(_0x4f6d6e){return _0x1368ad['status'](_0x3829e0)['json'](_0x4f6d6e);}};}function respondWithFilteredResult(_0x4c9f2b,_0x5434f){return function(_0x55a6af){if(_0x55a6af){var _0x732cc3=typeof _0x5434f[_0x4fed('0x2e')]===_0x4fed('0x2f')&&typeof _0x5434f[_0x4fed('0x30')]===_0x4fed('0x2f');var _0x5bf408=_0x55a6af['count'];var _0x3bba48=_0x732cc3?0x0:_0x5434f[_0x4fed('0x2e')];var _0x2e982e=_0x732cc3?_0x55a6af[_0x4fed('0x31')]:_0x5434f[_0x4fed('0x2e')]+_0x5434f[_0x4fed('0x30')];var _0x3b0726;if(_0x2e982e>=_0x5bf408){_0x2e982e=_0x5bf408;_0x3b0726=0xc8;}else{_0x3b0726=0xce;}_0x4c9f2b['status'](_0x3b0726);return _0x4c9f2b[_0x4fed('0x32')]('Content-Range',_0x3bba48+'-'+_0x2e982e+'/'+_0x5bf408)['json'](_0x55a6af);}return null;};}function patchUpdates(_0xd2dc91){return function(_0x2210a9){try{jsonpatch['apply'](_0x2210a9,_0xd2dc91,!![]);}catch(_0x4cfbae){return BPromise[_0x4fed('0x33')](_0x4cfbae);}return _0x2210a9[_0x4fed('0x34')]();};}function saveUpdates(_0x3676fa,_0x207242){return function(_0x418c39){if(_0x418c39){return _0x418c39['update'](_0x3676fa)[_0x4fed('0x20')](function(_0x495916){return _0x495916;});}return null;};}function removeEntity(_0x3bf441,_0x239223){return function(_0x18acfc){if(_0x18acfc){return _0x18acfc[_0x4fed('0x35')]()['then'](function(){_0x3bf441[_0x4fed('0x2c')](0xcc)[_0x4fed('0x2d')]();});}};}function handleEntityNotFound(_0x6c7cae,_0x175fa6){return function(_0x118c42){if(!_0x118c42){_0x6c7cae[_0x4fed('0x2b')](0x194);}return _0x118c42;};}function handleError(_0x2106b1,_0x5e3b4b){_0x5e3b4b=_0x5e3b4b||0x1f4;return function(_0x336c17){logger[_0x4fed('0x26')](_0x336c17[_0x4fed('0x36')]);if(_0x336c17[_0x4fed('0x37')]){delete _0x336c17[_0x4fed('0x37')];}_0x2106b1[_0x4fed('0x2c')](_0x5e3b4b)[_0x4fed('0x38')](_0x336c17);};}exports[_0x4fed('0x39')]=function(_0x2fffb1,_0x388cbf){var _0x181682={},_0x462b29={},_0x45e1ac={'count':0x0,'rows':[]};var _0x2e8331=_[_0x4fed('0x3a')](db[_0x4fed('0x3b')][_0x4fed('0x3c')],function(_0x51c97f){return{'name':_0x51c97f[_0x4fed('0x3d')],'type':_0x51c97f[_0x4fed('0x3e')][_0x4fed('0x3f')]};});_0x462b29[_0x4fed('0x40')]=_[_0x4fed('0x3a')](_0x2e8331,_0x4fed('0x37'));_0x462b29[_0x4fed('0x41')]=_[_0x4fed('0x42')](_0x2fffb1['query']);_0x462b29[_0x4fed('0x43')]=_[_0x4fed('0x44')](_0x462b29['model'],_0x462b29[_0x4fed('0x41')]);_0x181682[_0x4fed('0x45')]=_['intersection'](_0x462b29['model'],qs[_0x4fed('0x46')](_0x2fffb1[_0x4fed('0x41')][_0x4fed('0x46')]));_0x181682[_0x4fed('0x45')]=_0x181682['attributes']['length']?_0x181682[_0x4fed('0x45')]:_0x462b29['model'];if(!_0x2fffb1['query'][_0x4fed('0x47')](_0x4fed('0x48'))){_0x181682[_0x4fed('0x30')]=qs[_0x4fed('0x30')](_0x2fffb1[_0x4fed('0x41')][_0x4fed('0x30')]);_0x181682[_0x4fed('0x2e')]=qs[_0x4fed('0x2e')](_0x2fffb1[_0x4fed('0x41')][_0x4fed('0x2e')]);}_0x181682[_0x4fed('0x49')]=qs[_0x4fed('0x4a')](_0x2fffb1[_0x4fed('0x41')][_0x4fed('0x4a')]);_0x181682[_0x4fed('0x4b')]=qs['filters'](_['pick'](_0x2fffb1[_0x4fed('0x41')],_0x462b29['filters']),_0x2e8331);if(_0x2fffb1[_0x4fed('0x41')][_0x4fed('0x4c')]){_0x181682['where']=_[_0x4fed('0x4d')](_0x181682[_0x4fed('0x4b')],{'$or':_[_0x4fed('0x3a')](_0x2e8331,function(_0xd7e539){if(_0xd7e539[_0x4fed('0x3e')]!==_0x4fed('0x4e')){var _0x450ef7={};_0x450ef7[_0xd7e539['name']]={'$like':'%'+_0x2fffb1[_0x4fed('0x41')][_0x4fed('0x4c')]+'%'};return _0x450ef7;}})});}_0x181682=_[_0x4fed('0x4d')]({},_0x181682,_0x2fffb1[_0x4fed('0x4f')]);var _0x54a721={'where':_0x181682[_0x4fed('0x4b')]};return db['WhatsappMessage'][_0x4fed('0x31')](_0x54a721)[_0x4fed('0x20')](function(_0x2d5599){_0x45e1ac[_0x4fed('0x31')]=_0x2d5599;if(_0x2fffb1[_0x4fed('0x41')]['includeAll']){_0x181682[_0x4fed('0x50')]=[{'all':!![]}];}return db[_0x4fed('0x3b')]['findAll'](_0x181682);})['then'](function(_0x4391ef){_0x45e1ac[_0x4fed('0x51')]=_0x4391ef;return _0x45e1ac;})[_0x4fed('0x20')](respondWithFilteredResult(_0x388cbf,_0x181682))[_0x4fed('0x2a')](handleError(_0x388cbf,null));};exports[_0x4fed('0x52')]=function(_0x2c0df3,_0x250fb1){var _0x120c3f={'raw':!![],'where':{'id':_0x2c0df3[_0x4fed('0x53')]['id']}},_0x30771d={};_0x30771d[_0x4fed('0x40')]=_['keys'](db[_0x4fed('0x3b')]['rawAttributes']);_0x30771d[_0x4fed('0x41')]=_[_0x4fed('0x42')](_0x2c0df3[_0x4fed('0x41')]);_0x30771d[_0x4fed('0x43')]=_[_0x4fed('0x44')](_0x30771d[_0x4fed('0x40')],_0x30771d[_0x4fed('0x41')]);_0x120c3f[_0x4fed('0x45')]=_[_0x4fed('0x44')](_0x30771d['model'],qs[_0x4fed('0x46')](_0x2c0df3[_0x4fed('0x41')]['fields']));_0x120c3f[_0x4fed('0x45')]=_0x120c3f[_0x4fed('0x45')][_0x4fed('0x54')]?_0x120c3f['attributes']:_0x30771d['model'];if(_0x2c0df3[_0x4fed('0x41')][_0x4fed('0x55')]){_0x120c3f[_0x4fed('0x50')]=[{'all':!![]}];}_0x120c3f=_[_0x4fed('0x4d')]({},_0x120c3f,_0x2c0df3[_0x4fed('0x4f')]);return db['WhatsappMessage'][_0x4fed('0x56')](_0x120c3f)[_0x4fed('0x20')](handleEntityNotFound(_0x250fb1,null))['then'](respondWithResult(_0x250fb1,null))[_0x4fed('0x2a')](handleError(_0x250fb1,null));};exports['create']=function(_0x20a8e1,_0x1aa7c1){return db[_0x4fed('0x3b')][_0x4fed('0x57')](_0x20a8e1[_0x4fed('0x58')],{})[_0x4fed('0x20')](respondWithResult(_0x1aa7c1,0xc9))[_0x4fed('0x2a')](handleError(_0x1aa7c1,null));};exports[_0x4fed('0x59')]=function(_0x4b340f,_0x2ede25){if(_0x4b340f[_0x4fed('0x58')]['id']){delete _0x4b340f[_0x4fed('0x58')]['id'];}return db['WhatsappMessage'][_0x4fed('0x56')]({'where':{'id':_0x4b340f[_0x4fed('0x53')]['id']}})['then'](handleEntityNotFound(_0x2ede25,null))[_0x4fed('0x20')](saveUpdates(_0x4b340f['body'],null))['then'](respondWithResult(_0x2ede25,null))['catch'](handleError(_0x2ede25,null));};exports[_0x4fed('0x35')]=function(_0x4e49f5,_0x184a4b){return db[_0x4fed('0x3b')][_0x4fed('0x56')]({'where':{'id':_0x4e49f5['params']['id']}})['then'](handleEntityNotFound(_0x184a4b,null))[_0x4fed('0x20')](removeEntity(_0x184a4b,null))['catch'](handleError(_0x184a4b,null));};exports[_0x4fed('0x5a')]=function(_0x5e0dfc,_0xe09f99){return db[_0x4fed('0x3b')][_0x4fed('0x5a')]()[_0x4fed('0x20')](respondWithResult(_0xe09f99,null))[_0x4fed('0x2a')](handleError(_0xe09f99,null));};var interaction_log=require(_0x4fed('0x11'))(_0x4fed('0x5b'));exports[_0x4fed('0x5c')]=function(_0x89463e,_0x340a4c,_0x2d2f7f){var _0x550280={'agent':{},'channel':_0x4fed('0x5d')};if(_0x89463e[_0x4fed('0x58')]['id']){delete _0x89463e[_0x4fed('0x58')]['id'];}_0x89463e['body'][_0x4fed('0x5e')]=!![];_0x89463e[_0x4fed('0x58')][_0x4fed('0x5f')]=moment()['format'](_0x4fed('0x60'));_0x89463e['body'][_0x4fed('0x61')]=_0x89463e['body']['UserId']||_0x89463e[_0x4fed('0x62')]['id'];_0x550280[_0x4fed('0x63')]['id']=_0x89463e[_0x4fed('0x58')]['UserId'];return db[_0x4fed('0x3b')]['find']({'where':{'id':_0x89463e['params']['id'],'UserId':null}})[_0x4fed('0x20')](handleEntityNotFound(_0x340a4c,null))[_0x4fed('0x20')](saveUpdates(_0x89463e[_0x4fed('0x58')],null))[_0x4fed('0x20')](function(_0x279938){if(_0x279938){_0x550280[_0x4fed('0x29')]=_0x279938['get']({'plain':!![]});return db['WhatsappInteraction'][_0x4fed('0x56')]({'where':{'id':_0x279938['WhatsappInteractionId']}});}return null;})[_0x4fed('0x20')](handleEntityNotFound(_0x340a4c,null))[_0x4fed('0x20')](function(_0x42b89e){if(_0x42b89e){return _0x42b89e['update']({'UserId':_0x89463e[_0x4fed('0x58')]['UserId'],'read1stAt':_['isNil'](_0x42b89e['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x47230e){if(_0x47230e){_0x550280[_0x4fed('0x64')]=_0x47230e[_0x4fed('0x65')]({'plain':!![]});interaction_log[_0x4fed('0x21')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x89463e['user']['id'],_0x89463e[_0x4fed('0x62')][_0x4fed('0x37')],_0x89463e['user'][_0x4fed('0x66')],_0x550280[_0x4fed('0x64')]['id'],_0x89463e['body']?JSON[_0x4fed('0x25')](_0x89463e[_0x4fed('0x58')]):'null');return respondWithRpcPromise(_0x4fed('0x67'),'acceptMessage',_0x550280);}return null;})[_0x4fed('0x20')](function(_0x43ebec){var _0x5690c4=_0x4fed('0x68')+_0x43ebec[_0x4fed('0x29')][_0x4fed('0x69')];return db[_0x4fed('0x6a')][_0x4fed('0x41')](_0x5690c4,{'type':db[_0x4fed('0x6b')][_0x4fed('0x6c')][_0x4fed('0x6d')],'raw':!![]})[_0x4fed('0x20')](function(_0x42c52b){return _0x42c52b;});})['then'](function(_0x63cc73){if(_0x63cc73){_0x550280[_0x4fed('0x29')][_0x4fed('0x6e')]=_0x63cc73[0x0];if(!_0x89463e['body'][_0x4fed('0x61')])return;return db[_0x4fed('0x6f')]['find']({'where':{'id':_0x89463e[_0x4fed('0x58')][_0x4fed('0x61')],'role':_0x4fed('0x63')},'attributes':['id',_0x4fed('0x37'),'fullname',_0x4fed('0x70'),'internal'],'raw':!![]});}return null;})[_0x4fed('0x20')](function(_0x121883){if(!_0x121883)return null;_0x550280[_0x4fed('0x29')][_0x4fed('0x63')]=_0x121883;return _0x550280;})[_0x4fed('0x20')](function(_0x337b06){if(_0x337b06){if(_0x89463e[_0x4fed('0x58')][_0x4fed('0x71')]){_0x550280[_0x4fed('0x29')][_0x4fed('0x72')]=util[_0x4fed('0x73')]('SIP/%s',_0x89463e['user'][_0x4fed('0x37')]);_0x550280['message']['channel']=_0x550280['channel'];_0x550280[_0x4fed('0x29')][_0x4fed('0x74')]=_0x550280[_0x4fed('0x75')];_0x550280[_0x4fed('0x29')][_0x4fed('0x76')]=_0x4fed('0x5c');return respondWithRpcPromise(_0x4fed('0x77'),_0x4fed('0x77'),{'event':'acceptmessage','message':_0x550280[_0x4fed('0x29')]},client9002)[_0x4fed('0x20')](function(){return _0x550280;});}return _0x550280;}return null;})[_0x4fed('0x20')](respondWithResult(_0x340a4c,null))[_0x4fed('0x2a')](handleError(_0x340a4c,null));};var interaction_log=require(_0x4fed('0x11'))(_0x4fed('0x5b'));exports[_0x4fed('0x33')]=function(_0x30e1da,_0x2cc794,_0x5270d3){var _0xf90506={'agent':{},'channel':_0x4fed('0x5d')};if(_0x30e1da[_0x4fed('0x58')]['id']){delete _0x30e1da[_0x4fed('0x58')]['id'];}_0x30e1da[_0x4fed('0x58')][_0x4fed('0x61')]=_0x30e1da[_0x4fed('0x58')][_0x4fed('0x61')]||_0x30e1da[_0x4fed('0x62')]['id'];_0xf90506[_0x4fed('0x63')]['id']=_0x30e1da[_0x4fed('0x58')][_0x4fed('0x61')];return db['WhatsappMessage'][_0x4fed('0x56')]({'where':{'id':_0x30e1da[_0x4fed('0x53')]['id'],'UserId':null}})[_0x4fed('0x20')](handleEntityNotFound(_0x2cc794,null))[_0x4fed('0x20')](function(_0x33a37c){if(_0x33a37c){_0xf90506['message']=_0x33a37c[_0x4fed('0x65')]({'plain':!![]});return db[_0x4fed('0x78')]['find']({'where':{'id':_0x33a37c[_0x4fed('0x79')]}});}return null;})[_0x4fed('0x20')](handleEntityNotFound(_0x2cc794,null))[_0x4fed('0x20')](function(_0x497a7e){if(_0x497a7e){_0xf90506[_0x4fed('0x64')]=_0x497a7e[_0x4fed('0x65')]({'plain':!![]});interaction_log[_0x4fed('0x21')](_0x4fed('0x7a'),_0x30e1da['user']['id'],_0x30e1da['user'][_0x4fed('0x37')],_0x30e1da[_0x4fed('0x62')][_0x4fed('0x66')],_0xf90506[_0x4fed('0x64')]['id'],_0x30e1da[_0x4fed('0x58')]?JSON[_0x4fed('0x25')](_0x30e1da[_0x4fed('0x58')]):_0x4fed('0x7b'));return respondWithRpcPromise(_0x4fed('0x7c'),'rejectMessage',_0xf90506);}return null;})[_0x4fed('0x20')](function(_0x59029a){var _0x2fc806=_0x4fed('0x68')+_0x59029a['message']['ContactId'];return db['sequelize'][_0x4fed('0x41')](_0x2fc806,{'type':db[_0x4fed('0x6b')][_0x4fed('0x6c')][_0x4fed('0x6d')],'raw':!![]})[_0x4fed('0x20')](function(_0x206b46){return _0x206b46;});})['then'](function(_0x4f1149){if(_0x4f1149){_0xf90506[_0x4fed('0x29')][_0x4fed('0x6e')]=_0x4f1149[0x0];if(!_0x30e1da[_0x4fed('0x58')][_0x4fed('0x61')])return;return db[_0x4fed('0x6f')][_0x4fed('0x56')]({'where':{'id':_0x30e1da['body'][_0x4fed('0x61')],'role':_0x4fed('0x63')},'attributes':['id',_0x4fed('0x37'),'fullname',_0x4fed('0x70'),_0x4fed('0x7d')],'raw':!![]});}return null;})[_0x4fed('0x20')](function(_0x58bf0e){if(!_0x58bf0e)return null;_0xf90506[_0x4fed('0x29')]['agent']=_0x58bf0e;return _0xf90506;})[_0x4fed('0x20')](function(_0xd7b652){if(_0xd7b652){_0xd7b652[_0x4fed('0x29')]['interface']=util[_0x4fed('0x73')]('SIP/%s',_0x30e1da[_0x4fed('0x62')][_0x4fed('0x37')]);_0xd7b652[_0x4fed('0x29')]['channel']=_0xf90506[_0x4fed('0x75')];_0xd7b652[_0x4fed('0x29')]['motionChannel']=_0xf90506[_0x4fed('0x75')];_0xd7b652[_0x4fed('0x29')][_0x4fed('0x76')]='reject';respondWithRpcPromise('EventManager',_0x4fed('0x77'),{'event':_0x4fed('0x7e'),'message':_0xd7b652[_0x4fed('0x29')]},client9002);return _0xf90506;}return null;})[_0x4fed('0x20')](respondWithResult(_0x2cc794,null))['catch'](handleError(_0x2cc794,null));};exports[_0x4fed('0x2c')]=function(_0x4bfcf9,_0x23ff60,_0x25b859){if(_0x4bfcf9['body']['id']){delete _0x4bfcf9[_0x4fed('0x58')]['id'];}var _0x40965a;return db[_0x4fed('0x3b')][_0x4fed('0x56')]({'where':{'id':_0x4bfcf9[_0x4fed('0x53')]['id']}})[_0x4fed('0x20')](handleEntityNotFound(_0x23ff60,null))[_0x4fed('0x20')](function(_0x33a7df){if(_0x33a7df){_0x40965a=_0x33a7df;return db[_0x4fed('0x7f')]['find']({'where':{'id':_0x33a7df[_0x4fed('0x80')]}});}})['then'](handleEntityNotFound(_0x23ff60,null))['then'](function(_0x1c038b){if(_0x1c038b){logger[_0x4fed('0x22')](_0x4fed('0x81'),_0x4fed('0x2c'),_0x4fed('0x82'),_0x1c038b[_0x4fed('0x3e')],util['inspect'](_0x4bfcf9['body'],{'showHidden':![],'depth':null}));switch(_0x1c038b[_0x4fed('0x3e')]){case'twilio':if(_0x4bfcf9['body'][_0x4fed('0x83')]&&_0x4bfcf9['body'][_0x4fed('0x83')]===_0x40965a[_0x4fed('0x84')]&&_0x4bfcf9['body']['MessageStatus']&&_0x4bfcf9[_0x4fed('0x58')][_0x4fed('0x85')]===_0x4fed('0x5e')){return _0x40965a[_0x4fed('0x59')]({'read':!![]});}else{logger['error'](_0x4fed('0x86'),'status',_0x4fed('0x87'),util['inspect'](_0x4bfcf9[_0x4fed('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x40965a;}})[_0x4fed('0x20')](respondWithResult(_0x23ff60,null))[_0x4fed('0x2a')](handleError(_0x23ff60,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 6fa778c..0a05ba1 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 _0xeffd=['save','update','remove','emit','hasOwnProperty','hook','exports','events','WhatsappMessage','setMaxListeners'];(function(_0x3875b1,_0x47cf1a){var _0x1e9c55=function(_0xc8e89b){while(--_0xc8e89b){_0x3875b1['push'](_0x3875b1['shift']());}};_0x1e9c55(++_0x47cf1a);}(_0xeffd,0x6b));var _0xdeff=function(_0x46e063,_0x6e5cbd){_0x46e063=_0x46e063-0x0;var _0x341b16=_0xeffd[_0x46e063];return _0x341b16;};'use strict';var EventEmitter=require(_0xdeff('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xdeff('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xdeff('0x2')](0x0);var events={'afterCreate':_0xdeff('0x3'),'afterUpdate':_0xdeff('0x4'),'afterDestroy':_0xdeff('0x5')};function emitEvent(_0x4dac0){return function(_0x298274,_0x2881fd,_0x8315d4){WhatsappMessageEvents[_0xdeff('0x6')](_0x4dac0+':'+_0x298274['id'],_0x298274);WhatsappMessageEvents[_0xdeff('0x6')](_0x4dac0,_0x298274);_0x8315d4(null);};}for(var e in events){if(events[_0xdeff('0x7')](e)){var event=events[e];WhatsappMessage[_0xdeff('0x8')](e,emitEvent(event));}}module[_0xdeff('0x9')]=WhatsappMessageEvents; \ No newline at end of file +var _0x8a5c=['hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x5abba5,_0x2e19a7){var _0x47a2a1=function(_0x2b4c9f){while(--_0x2b4c9f){_0x5abba5['push'](_0x5abba5['shift']());}};_0x47a2a1(++_0x2e19a7);}(_0x8a5c,0x136));var _0xc8a5=function(_0x3ad94c,_0x2082b9){_0x3ad94c=_0x3ad94c-0x0;var _0x453404=_0x8a5c[_0x3ad94c];return _0x453404;};'use strict';var EventEmitter=require(_0xc8a5('0x0'));var WhatsappMessage=require(_0xc8a5('0x1'))['db'][_0xc8a5('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xc8a5('0x3')](0x0);var events={'afterCreate':_0xc8a5('0x4'),'afterUpdate':_0xc8a5('0x5'),'afterDestroy':_0xc8a5('0x6')};function emitEvent(_0x3e2f37){return function(_0x84a3f4,_0x4dd6e0,_0x2b253c){WhatsappMessageEvents[_0xc8a5('0x7')](_0x3e2f37+':'+_0x84a3f4['id'],_0x84a3f4);WhatsappMessageEvents['emit'](_0x3e2f37,_0x84a3f4);_0x2b253c(null);};}for(var e in events){if(events[_0xc8a5('0x8')](e)){var event=events[e];WhatsappMessage[_0xc8a5('0x9')](e,emitEvent(event));}}module[_0xc8a5('0xa')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 3f501ac..6329812 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 _0xde4d=['find','WhatsappAccountId','twilio','accountSid','phone','authToken','messages','whatsapp:','remote','/status?token=','token','sid','update','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','POST','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','then','createdAt','error','WhatsappAccount'];(function(_0xe0bb6c,_0x1a8e53){var _0x2644c1=function(_0x2ad217){while(--_0x2ad217){_0xe0bb6c['push'](_0xe0bb6c['shift']());}};_0x2644c1(++_0x1a8e53);}(_0xde4d,0x17a));var _0xdde4=function(_0x417d17,_0x17bb4f){_0x417d17=_0x417d17-0x0;var _0x3224ac=_0xde4d[_0x417d17];return _0x3224ac;};'use strict';var _=require(_0xdde4('0x0'));var util=require(_0xdde4('0x1'));var logger=require('../../config/logger')(_0xdde4('0x2'));var moment=require(_0xdde4('0x3'));var BPromise=require(_0xdde4('0x4'));var rp=require(_0xdde4('0x5'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0xdde4('0x6'));var rimraf=require('rimraf');var config=require(_0xdde4('0x7'));var attributes=require('./whatsappMessage.attributes');module[_0xdde4('0x8')]=function(_0x299d39,_0x31a2bd){return _0x299d39[_0xdde4('0x9')](_0xdde4('0xa'),attributes,{'tableName':_0xdde4('0xb'),'paranoid':![],'indexes':[{'name':_0xdde4('0xc'),'fields':[_0xdde4('0xc')]},{'name':_0xdde4('0xd'),'fields':[_0xdde4('0xe')],'type':_0xdde4('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2dec60,_0x694e,_0x2612e5){var _0x207047=_0x299d39['models'];var _0x5f20af=_0x2dec60['get']({'plain':!![]});if(_0x5f20af[_0xdde4('0x10')][_0xdde4('0x11')]()==='in'||_0x5f20af['direction'][_0xdde4('0x11')]()===_0xdde4('0x12')&&!_0x5f20af[_0xdde4('0x13')]&&!_[_0xdde4('0x14')](_0x5f20af[_0xdde4('0x15')])){_0x207047[_0xdde4('0x16')]['findOne']({'where':{'id':_0x5f20af[_0xdde4('0x17')]}})[_0xdde4('0x18')](function(_0x1ed920){if(_0x1ed920){_0x1ed920['update']({'lastMsgAt':_0x5f20af[_0xdde4('0x19')],'lastMsgDirection':_0x5f20af['direction'][_0xdde4('0x11')]()});}})['catch'](function(_0x335405){console[_0xdde4('0x1a')](_0x335405);});}if(_0x5f20af[_0xdde4('0x10')]===_0xdde4('0x12')&&!_0x5f20af['secret']){var _0x5f4b5d;_0x207047[_0xdde4('0x1b')][_0xdde4('0x1c')]({'where':{'id':_0x5f20af[_0xdde4('0x1d')]},'raw':!![]})['then'](function(_0x34ae8a){_0x5f4b5d=_0x34ae8a;if(_0x5f4b5d&&_0x5f4b5d['type']){switch(_0x5f4b5d['type']){case _0xdde4('0x1e'):var _0x25ac8e=require(_0xdde4('0x1e'));if(_0x5f4b5d[_0xdde4('0x1f')]&&_0x5f4b5d['authToken']&&_0x5f4b5d[_0xdde4('0x20')]){var _0x5dd252=new _0x25ac8e(_0x5f4b5d['accountSid'],_0x5f4b5d[_0xdde4('0x21')]);_0x5dd252[_0xdde4('0x22')]['create']({'body':_0x5f20af['body'],'to':_0xdde4('0x23')+_0x5f20af['phone'],'from':_0xdde4('0x23')+_0x5f4b5d[_0xdde4('0x20')],'statusCallback':_0x5f4b5d[_0xdde4('0x24')]+'/api/whatsapp/messages/'+_0x5f20af['id']+_0xdde4('0x25')+_0x5f4b5d[_0xdde4('0x26')]})[_0xdde4('0x18')](function(_0x298472){if(_0x298472[_0xdde4('0x27')]){return _0x2dec60[_0xdde4('0x28')]({'messageId':_0x298472[_0xdde4('0x27')]});}})[_0xdde4('0x29')](function(_0x3616ab){logger[_0xdde4('0x1a')](_0xdde4('0x2a'),_0xdde4('0x2b'),_0xdde4('0x1e'),util[_0xdde4('0x2c')](_0x3616ab,{'showHidden':![],'depth':null}));});}else{logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xdde4('0x2b'),'twilio',_0xdde4('0x2d'));}break;case _0xdde4('0x2e'):var _0x1e831c=_0x5f4b5d[_0xdde4('0x1f')];var _0x260636=_0x5f4b5d['authToken'];var _0x53ed6e=_0x5f4b5d[_0xdde4('0x2f')]+_0xdde4('0x30')+_0x1e831c+'/messages/';var _0x5c5bfc={'to':[_0x5f20af['phone']],'message':{'type':'text','text':_0x5f20af[_0xdde4('0xe')]}};var _0x836b5b={'method':_0xdde4('0x31'),'uri':_0x53ed6e,'headers':{'Authorization':'Bearer\x20'+_0x260636,'Content-Type':_0xdde4('0x32')},'body':_0x5c5bfc,'json':!![]};rp(_0x836b5b)[_0xdde4('0x18')](function(_0x18055e){if(_0x18055e[_0xdde4('0x33')][0x0]['message_id']){return _0x2dec60[_0xdde4('0x28')]({'messageId':_0x18055e[_0xdde4('0x33')][0x0][_0xdde4('0x34')]});}})[_0xdde4('0x29')](function(_0x1b9be9){logger[_0xdde4('0x35')](_0xdde4('0x36'),_0x1b9be9);});break;}}})[_0xdde4('0x37')](function(){_0x2612e5();});}else{_0x2612e5();}}},'charset':_0xdde4('0x38'),'collate':_0xdde4('0x39')});}; \ No newline at end of file +var _0xa8fd=['type','twilio','authToken','phone','accountSid','body','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','then','statuses','message_id','update','err','WhatsappMessage,\x20%s','finally','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','./whatsappMessage.attributes','exports','messageId','fti_whatsapp_messages','FULLTEXT','models','get','direction','out','secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','createdAt','toLowerCase','catch','error','WhatsappAccount','WhatsappAccountId'];(function(_0x1fe5e5,_0x21ebfb){var _0x4ae506=function(_0x29eb4f){while(--_0x29eb4f){_0x1fe5e5['push'](_0x1fe5e5['shift']());}};_0x4ae506(++_0x21ebfb);}(_0xa8fd,0x17a));var _0xda8f=function(_0x4dc695,_0x465524){_0x4dc695=_0x4dc695-0x0;var _0x342d71=_0xa8fd[_0x4dc695];return _0x342d71;};'use strict';var _=require('lodash');var util=require(_0xda8f('0x0'));var logger=require(_0xda8f('0x1'))(_0xda8f('0x2'));var moment=require(_0xda8f('0x3'));var BPromise=require(_0xda8f('0x4'));var rp=require(_0xda8f('0x5'));var fetch=require(_0xda8f('0x6'));var fs=require('fs');var path=require(_0xda8f('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xda8f('0x8'));module[_0xda8f('0x9')]=function(_0x3ff34b,_0x5e9bf2){return _0x3ff34b['define']('WhatsappMessage',attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xda8f('0xa'),'fields':[_0xda8f('0xa')]},{'name':_0xda8f('0xb'),'fields':['body'],'type':_0xda8f('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3fec00,_0x770eeb,_0x5e3a1e){var _0x5afb02=_0x3ff34b[_0xda8f('0xd')];var _0x5109b9=_0x3fec00[_0xda8f('0xe')]({'plain':!![]});if(_0x5109b9[_0xda8f('0xf')]['toLowerCase']()==='in'||_0x5109b9[_0xda8f('0xf')]['toLowerCase']()===_0xda8f('0x10')&&!_0x5109b9[_0xda8f('0x11')]&&!_[_0xda8f('0x12')](_0x5109b9[_0xda8f('0x13')])){_0x5afb02[_0xda8f('0x14')]['findOne']({'where':{'id':_0x5109b9[_0xda8f('0x15')]}})['then'](function(_0x38b198){if(_0x38b198){_0x38b198['update']({'lastMsgAt':_0x5109b9[_0xda8f('0x16')],'lastMsgDirection':_0x5109b9[_0xda8f('0xf')][_0xda8f('0x17')]()});}})[_0xda8f('0x18')](function(_0x9dba31){console[_0xda8f('0x19')](_0x9dba31);});}if(_0x5109b9[_0xda8f('0xf')]===_0xda8f('0x10')&&!_0x5109b9[_0xda8f('0x11')]){var _0x22bc5f;_0x5afb02[_0xda8f('0x1a')]['find']({'where':{'id':_0x5109b9[_0xda8f('0x1b')]},'raw':!![]})['then'](function(_0xdb5670){_0x22bc5f=_0xdb5670;if(_0x22bc5f&&_0x22bc5f[_0xda8f('0x1c')]){switch(_0x22bc5f[_0xda8f('0x1c')]){case _0xda8f('0x1d'):var _0x486dc0=require(_0xda8f('0x1d'));if(_0x22bc5f['accountSid']&&_0x22bc5f[_0xda8f('0x1e')]&&_0x22bc5f[_0xda8f('0x1f')]){var _0x5f405d=new _0x486dc0(_0x22bc5f[_0xda8f('0x20')],_0x22bc5f[_0xda8f('0x1e')]);_0x5f405d['messages']['create']({'body':_0x5109b9[_0xda8f('0x21')],'to':_0xda8f('0x22')+_0x5109b9[_0xda8f('0x1f')],'from':_0xda8f('0x22')+_0x22bc5f[_0xda8f('0x1f')],'statusCallback':_0x22bc5f[_0xda8f('0x23')]+_0xda8f('0x24')+_0x5109b9['id']+_0xda8f('0x25')+_0x22bc5f[_0xda8f('0x26')]})['then'](function(_0x3a683c){if(_0x3a683c[_0xda8f('0x27')]){return _0x3fec00['update']({'messageId':_0x3a683c[_0xda8f('0x27')]});}})[_0xda8f('0x18')](function(_0x275408){logger['error'](_0xda8f('0x28'),_0xda8f('0x29'),_0xda8f('0x1d'),util[_0xda8f('0x2a')](_0x275408,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xda8f('0x28'),_0xda8f('0x29'),_0xda8f('0x1d'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xda8f('0x2b'):var _0x33b8b7=_0x22bc5f['accountSid'];var _0x30682c=_0x22bc5f[_0xda8f('0x1e')];var _0x287a9c=_0x22bc5f[_0xda8f('0x2c')]+_0xda8f('0x2d')+_0x33b8b7+_0xda8f('0x2e');var _0x1806dc={'to':[_0x5109b9['phone']],'message':{'type':_0xda8f('0x2f'),'text':_0x5109b9[_0xda8f('0x21')]}};var _0x4ab15b={'method':_0xda8f('0x30'),'uri':_0x287a9c,'headers':{'Authorization':_0xda8f('0x31')+_0x30682c,'Content-Type':'application/json'},'body':_0x1806dc,'json':!![]};rp(_0x4ab15b)[_0xda8f('0x32')](function(_0x59874d){if(_0x59874d[_0xda8f('0x33')][0x0][_0xda8f('0x34')]){return _0x3fec00[_0xda8f('0x35')]({'messageId':_0x59874d[_0xda8f('0x33')][0x0]['message_id']});}})[_0xda8f('0x18')](function(_0x3945aa){logger[_0xda8f('0x36')](_0xda8f('0x37'),_0x3945aa);});break;}}})[_0xda8f('0x38')](function(){_0x5e3a1e();});}else{_0x5e3a1e();}}},'charset':_0xda8f('0x39'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 0ba8ce0..baf79c1 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 _0xa940=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./whatsappMessage.socket','request','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','info','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','debug'];(function(_0xe27035,_0x1f4876){var _0x3745bc=function(_0xfa83f4){while(--_0xfa83f4){_0xe27035['push'](_0xe27035['shift']());}};_0x3745bc(++_0x1f4876);}(_0xa940,0xd2));var _0x0a94=function(_0x41a4c4,_0x2f88bf){_0x41a4c4=_0x41a4c4-0x0;var _0x19a89d=_0xa940[_0x41a4c4];return _0x19a89d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0a94('0x0'));var BPromise=require(_0x0a94('0x1'));var rs=require(_0x0a94('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0a94('0x3'))['db'];var utils=require(_0x0a94('0x4'));var logger=require(_0x0a94('0x5'))(_0x0a94('0x6'));var config=require(_0x0a94('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0a94('0x8')][_0x0a94('0x9')]({'port':0x232a});config[_0x0a94('0xa')]=_['defaults'](config['redis'],{'host':_0x0a94('0xb'),'port':0x18eb});var socket=require(_0x0a94('0xc'))(new Redis(config[_0x0a94('0xa')]));require(_0x0a94('0xd'))['register'](socket);function respondWithRpcPromise(_0x1f4ed3,_0x2ecc5a,_0x222320){return new BPromise(function(_0x1db312,_0x574057){return client[_0x0a94('0xe')](_0x1f4ed3,_0x222320)['then'](function(_0x2b8a17){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x2ecc5a,'request\x20sent');logger['debug'](_0x0a94('0xf'),_0x2ecc5a,'request\x20sent',JSON[_0x0a94('0x10')](_0x2b8a17));if(_0x2b8a17['error']){if(_0x2b8a17['error']['code']===0x1f4){logger[_0x0a94('0x11')](_0x0a94('0x12'),_0x2ecc5a,_0x2b8a17[_0x0a94('0x11')][_0x0a94('0x13')]);return _0x574057(_0x2b8a17['error'][_0x0a94('0x13')]);}logger[_0x0a94('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x2ecc5a,_0x2b8a17[_0x0a94('0x11')][_0x0a94('0x13')]);return _0x1db312(_0x2b8a17[_0x0a94('0x11')][_0x0a94('0x13')]);}else{logger[_0x0a94('0x14')](_0x0a94('0x12'),_0x2ecc5a,'request\x20sent');_0x1db312(_0x2b8a17[_0x0a94('0x15')][_0x0a94('0x13')]);}})[_0x0a94('0x16')](function(_0x439e2b){logger[_0x0a94('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x2ecc5a,_0x439e2b);_0x574057(_0x439e2b);});});}exports[_0x0a94('0x17')]=function(_0x507c3d){var _0x2b90ad=this;return new Promise(function(_0x39e881,_0xa5180e){return db[_0x0a94('0x18')][_0x0a94('0x19')](_0x507c3d[_0x0a94('0x1a')],{'raw':_0x507c3d[_0x0a94('0x1b')]?_0x507c3d[_0x0a94('0x1b')][_0x0a94('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x4e238a){logger[_0x0a94('0x14')](_0x0a94('0x17'),_0x507c3d);logger[_0x0a94('0x1d')](_0x0a94('0x17'),_0x507c3d,JSON[_0x0a94('0x10')](_0x4e238a));_0x39e881(_0x4e238a);})['catch'](function(_0x4dc2cc){logger[_0x0a94('0x11')]('CreateWhatsappMessage',_0x4dc2cc[_0x0a94('0x13')],_0x507c3d);_0xa5180e(_0x2b90ad['error'](0x1f4,_0x4dc2cc[_0x0a94('0x13')]));});});}; \ No newline at end of file +var _0xe7b9=['message','CreateWhatsappMessage','body','options','then','debug','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','info','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s'];(function(_0x3984b6,_0x2b5510){var _0x333c63=function(_0x2ecf92){while(--_0x2ecf92){_0x3984b6['push'](_0x3984b6['shift']());}};_0x333c63(++_0x2b5510);}(_0xe7b9,0x13b));var _0x9e7b=function(_0x1322f7,_0x32fb1f){_0x1322f7=_0x1322f7-0x0;var _0x3d6808=_0xe7b9[_0x1322f7];return _0x3d6808;};'use strict';var _=require(_0x9e7b('0x0'));var util=require(_0x9e7b('0x1'));var moment=require(_0x9e7b('0x2'));var BPromise=require('bluebird');var rs=require(_0x9e7b('0x3'));var fs=require('fs');var Redis=require(_0x9e7b('0x4'));var db=require(_0x9e7b('0x5'))['db'];var utils=require(_0x9e7b('0x6'));var logger=require(_0x9e7b('0x7'))(_0x9e7b('0x8'));var config=require(_0x9e7b('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9e7b('0xa')]({'port':0x232a});config[_0x9e7b('0xb')]=_[_0x9e7b('0xc')](config[_0x9e7b('0xb')],{'host':_0x9e7b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9e7b('0xb')]));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0x353da2,_0x2c31bd,_0x33c226){return new BPromise(function(_0xae1cd1,_0x31b985){return client['request'](_0x353da2,_0x33c226)['then'](function(_0x2b6be9){logger[_0x9e7b('0xe')]('WhatsappMessage,\x20%s,\x20%s',_0x2c31bd,_0x9e7b('0xf'));logger['debug'](_0x9e7b('0x10'),_0x2c31bd,_0x9e7b('0xf'),JSON[_0x9e7b('0x11')](_0x2b6be9));if(_0x2b6be9['error']){if(_0x2b6be9[_0x9e7b('0x12')][_0x9e7b('0x13')]===0x1f4){logger[_0x9e7b('0x12')](_0x9e7b('0x14'),_0x2c31bd,_0x2b6be9['error'][_0x9e7b('0x15')]);return _0x31b985(_0x2b6be9[_0x9e7b('0x12')][_0x9e7b('0x15')]);}logger['error'](_0x9e7b('0x14'),_0x2c31bd,_0x2b6be9[_0x9e7b('0x12')][_0x9e7b('0x15')]);return _0xae1cd1(_0x2b6be9[_0x9e7b('0x12')]['message']);}else{logger[_0x9e7b('0xe')](_0x9e7b('0x14'),_0x2c31bd,'request\x20sent');_0xae1cd1(_0x2b6be9['result'][_0x9e7b('0x15')]);}})['catch'](function(_0x8f00f2){logger[_0x9e7b('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x2c31bd,_0x8f00f2);_0x31b985(_0x8f00f2);});});}exports[_0x9e7b('0x16')]=function(_0x436ee8){var _0x5583a6=this;return new Promise(function(_0x11df27,_0x4ffd08){return db['WhatsappMessage']['create'](_0x436ee8[_0x9e7b('0x17')],{'raw':_0x436ee8['options']?_0x436ee8[_0x9e7b('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x9e7b('0x19')](function(_0x495998){logger[_0x9e7b('0xe')](_0x9e7b('0x16'),_0x436ee8);logger[_0x9e7b('0x1a')](_0x9e7b('0x16'),_0x436ee8,JSON['stringify'](_0x495998));_0x11df27(_0x495998);})[_0x9e7b('0x1b')](function(_0xe6ce4d){logger[_0x9e7b('0x12')](_0x9e7b('0x16'),_0xe6ce4d[_0x9e7b('0x15')],_0x436ee8);_0x4ffd08(_0x5583a6['error'](0x1f4,_0xe6ce4d['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index bad4147..1e5c786 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 _0x77b1=['removeListener','length','whatsappMessage:','./whatsappMessage.events','update'];(function(_0x4383e9,_0xa4b307){var _0x355405=function(_0x545b5b){while(--_0x545b5b){_0x4383e9['push'](_0x4383e9['shift']());}};_0x355405(++_0xa4b307);}(_0x77b1,0x8f));var _0x177b=function(_0x576a2f,_0x23f10f){_0x576a2f=_0x576a2f-0x0;var _0x20d53e=_0x77b1[_0x576a2f];return _0x20d53e;};'use strict';var WhatsappMessageEvents=require(_0x177b('0x0'));var events=['save','remove',_0x177b('0x1')];function createListener(_0xe3bc4e,_0x17281a){return function(_0x194c82){_0x17281a['emit'](_0xe3bc4e,_0x194c82);};}function removeListener(_0x8d2e0d,_0x34c7e3){return function(){WhatsappMessageEvents[_0x177b('0x2')](_0x8d2e0d,_0x34c7e3);};}exports['register']=function(_0x5cebbc){for(var _0x1446a9=0x0,_0x3852f3=events[_0x177b('0x3')];_0x1446a9<_0x3852f3;_0x1446a9++){var _0x328581=events[_0x1446a9];var _0x18ce75=createListener(_0x177b('0x4')+_0x328581,_0x5cebbc);WhatsappMessageEvents['on'](_0x328581,_0x18ce75);}}; \ No newline at end of file +var _0x907c=['removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save','remove','update','emit'];(function(_0x1a911e,_0x3a2639){var _0x57fada=function(_0x495e70){while(--_0x495e70){_0x1a911e['push'](_0x1a911e['shift']());}};_0x57fada(++_0x3a2639);}(_0x907c,0x190));var _0xc907=function(_0x1d5ed3,_0x4c9a15){_0x1d5ed3=_0x1d5ed3-0x0;var _0x54942a=_0x907c[_0x1d5ed3];return _0x54942a;};'use strict';var WhatsappMessageEvents=require(_0xc907('0x0'));var events=[_0xc907('0x1'),_0xc907('0x2'),_0xc907('0x3')];function createListener(_0x360602,_0x4cdca2){return function(_0x57f184){_0x4cdca2[_0xc907('0x4')](_0x360602,_0x57f184);};}function removeListener(_0x461f6f,_0x12ea47){return function(){WhatsappMessageEvents[_0xc907('0x5')](_0x461f6f,_0x12ea47);};}exports[_0xc907('0x6')]=function(_0x4f5564){for(var _0x5d8a6f=0x0,_0x51dcae=events[_0xc907('0x7')];_0x5d8a6f<_0x51dcae;_0x5d8a6f++){var _0x5b97ce=events[_0x5d8a6f];var _0x2557a3=createListener(_0xc907('0x8')+_0x5b97ce,_0x4f5564);WhatsappMessageEvents['on'](_0x5b97ce,_0x2557a3);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 0d4b305..a7db87a 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 _0xf17e=['describe','/:id','show','/:id/members','getTeams','/:id/users','post','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated'];(function(_0x28cf60,_0x2fe9d9){var _0x2b61e5=function(_0x28b6ba){while(--_0x28b6ba){_0x28cf60['push'](_0x28cf60['shift']());}};_0x2b61e5(++_0x2fe9d9);}(_0xf17e,0xb8));var _0xef17=function(_0x1cb23d,_0x382840){_0x1cb23d=_0x1cb23d-0x0;var _0x59b169=_0xf17e[_0x1cb23d];return _0x59b169;};'use strict';var multer=require(_0xef17('0x0'));var util=require(_0xef17('0x1'));var path=require('path');var timeout=require(_0xef17('0x2'));var express=require(_0xef17('0x3'));var router=express[_0xef17('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xef17('0x5'));var interaction=require(_0xef17('0x6'));var config=require(_0xef17('0x7'));var controller=require('./whatsappQueue.controller');router[_0xef17('0x8')]('/',auth['isAuthenticated'](),controller[_0xef17('0x9')]);router[_0xef17('0x8')](_0xef17('0xa'),auth[_0xef17('0xb')](),controller[_0xef17('0xc')]);router[_0xef17('0x8')](_0xef17('0xd'),auth[_0xef17('0xb')](),controller[_0xef17('0xe')]);router[_0xef17('0x8')](_0xef17('0xf'),auth[_0xef17('0xb')](),controller['getMembers']);router[_0xef17('0x8')]('/:id/teams',auth[_0xef17('0xb')](),controller[_0xef17('0x10')]);router[_0xef17('0x8')](_0xef17('0x11'),auth[_0xef17('0xb')](),controller['getAgents']);router[_0xef17('0x12')]('/',auth[_0xef17('0xb')](),controller['create']);router[_0xef17('0x12')](_0xef17('0x13'),auth['isAuthenticated'](),controller[_0xef17('0x14')]);router[_0xef17('0x12')](_0xef17('0x11'),auth[_0xef17('0xb')](),controller[_0xef17('0x15')]);router[_0xef17('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xef17('0x17')]);router[_0xef17('0x18')](_0xef17('0xd'),auth[_0xef17('0xb')](),controller[_0xef17('0x19')]);router[_0xef17('0x18')](_0xef17('0x13'),auth[_0xef17('0xb')](),controller[_0xef17('0x1a')]);router[_0xef17('0x18')](_0xef17('0x11'),auth[_0xef17('0xb')](),controller['removeAgents']);module[_0xef17('0x1b')]=router; \ No newline at end of file +var _0x4c48=['getTeams','/:id/users','post','create','addTeams','addAgents','delete','removeTeams','removeAgents','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','/:id','/:id/members','/:id/teams'];(function(_0x1282a0,_0x58b2f9){var _0x18af0c=function(_0x5ac73f){while(--_0x5ac73f){_0x1282a0['push'](_0x1282a0['shift']());}};_0x18af0c(++_0x58b2f9);}(_0x4c48,0x129));var _0x84c4=function(_0x290fa6,_0x16d017){_0x290fa6=_0x290fa6-0x0;var _0x47f1f3=_0x4c48[_0x290fa6];return _0x47f1f3;};'use strict';var multer=require(_0x84c4('0x0'));var util=require(_0x84c4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x84c4('0x2'));var router=express[_0x84c4('0x3')]();var fs_extra=require(_0x84c4('0x4'));var auth=require(_0x84c4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x84c4('0x6'));var controller=require(_0x84c4('0x7'));router[_0x84c4('0x8')]('/',auth[_0x84c4('0x9')](),controller[_0x84c4('0xa')]);router[_0x84c4('0x8')](_0x84c4('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x84c4('0xc'),auth[_0x84c4('0x9')](),controller['show']);router[_0x84c4('0x8')](_0x84c4('0xd'),auth[_0x84c4('0x9')](),controller['getMembers']);router[_0x84c4('0x8')](_0x84c4('0xe'),auth['isAuthenticated'](),controller[_0x84c4('0xf')]);router[_0x84c4('0x8')](_0x84c4('0x10'),auth[_0x84c4('0x9')](),controller['getAgents']);router[_0x84c4('0x11')]('/',auth[_0x84c4('0x9')](),controller[_0x84c4('0x12')]);router[_0x84c4('0x11')](_0x84c4('0xe'),auth['isAuthenticated'](),controller[_0x84c4('0x13')]);router['post'](_0x84c4('0x10'),auth[_0x84c4('0x9')](),controller[_0x84c4('0x14')]);router['put'](_0x84c4('0xc'),auth[_0x84c4('0x9')](),controller['update']);router[_0x84c4('0x15')]('/:id',auth[_0x84c4('0x9')](),controller['destroy']);router[_0x84c4('0x15')](_0x84c4('0xe'),auth[_0x84c4('0x9')](),controller[_0x84c4('0x16')]);router[_0x84c4('0x15')](_0x84c4('0x10'),auth[_0x84c4('0x9')](),controller[_0x84c4('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 260af1c..df124c3 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 _0x2917=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x2689fe,_0x1299df){var _0x323f30=function(_0x1fe61a){while(--_0x1fe61a){_0x2689fe['push'](_0x2689fe['shift']());}};_0x323f30(++_0x1299df);}(_0x2917,0x142));var _0x7291=function(_0x18afca,_0x4219d9){_0x18afca=_0x18afca-0x0;var _0x11603f=_0x2917[_0x18afca];return _0x11603f;};'use strict';var Sequelize=require(_0x7291('0x0'));module[_0x7291('0x1')]={'name':{'type':Sequelize[_0x7291('0x2')],'unique':_0x7291('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x7291('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7291('0x5')](_0x7291('0x6'),'beepall','roundrobin')},'description':{'type':Sequelize[_0x7291('0x2')]}}; \ No newline at end of file +var _0xa4de=['ENUM','rrmemory','beepall','roundrobin','STRING','sequelize','name','INTEGER'];(function(_0x172ed7,_0x3d08fd){var _0xfa8f61=function(_0xe07a21){while(--_0xe07a21){_0x172ed7['push'](_0x172ed7['shift']());}};_0xfa8f61(++_0x3d08fd);}(_0xa4de,0x10d));var _0xea4d=function(_0x40aa58,_0x5b22fc){_0x40aa58=_0x40aa58-0x0;var _0x532346=_0xa4de[_0x40aa58];return _0x532346;};'use strict';var Sequelize=require(_0xea4d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xea4d('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xea4d('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xea4d('0x3')](_0xea4d('0x4'),_0xea4d('0x5'),_0xea4d('0x6'))},'description':{'type':Sequelize[_0xea4d('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 9058151..2d6a528 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 _0x0985=['update','destroy','then','get','WhatsappQueues','UserProfileResource','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','limit','sort','pick','filter','merge','where','includeAll','rows','catch','show','params','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','order','User','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','ids','findAll','Agents','online','voicePause','sequelize','transaction','each','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','includes','all','compact','value','isEmpty','emit','userWhatsappQueue:remove','addAgents','omit','spread','removeAgents','getAgents','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','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./whatsappQueue.socket','register','sendStatus','status','json','offset','undefined','count','apply','reject'];(function(_0x4c1cd8,_0xcfdede){var _0x34ff5a=function(_0x200405){while(--_0x200405){_0x4c1cd8['push'](_0x4c1cd8['shift']());}};_0x34ff5a(++_0xcfdede);}(_0x0985,0xf6));var _0x5098=function(_0x37fb7d,_0x5b768a){_0x37fb7d=_0x37fb7d-0x0;var _0x323313=_0x0985[_0x37fb7d];return _0x323313;};'use strict';var emlformat=require(_0x5098('0x0'));var rimraf=require(_0x5098('0x1'));var zipdir=require(_0x5098('0x2'));var jsonpatch=require(_0x5098('0x3'));var rp=require(_0x5098('0x4'));var moment=require(_0x5098('0x5'));var BPromise=require(_0x5098('0x6'));var Mustache=require(_0x5098('0x7'));var util=require(_0x5098('0x8'));var path=require(_0x5098('0x9'));var sox=require(_0x5098('0xa'));var csv=require(_0x5098('0xb'));var ejs=require(_0x5098('0xc'));var fs=require('fs');var fs_extra=require(_0x5098('0xd'));var _=require(_0x5098('0xe'));var squel=require(_0x5098('0xf'));var crypto=require(_0x5098('0x10'));var jsforce=require(_0x5098('0x11'));var deskjs=require(_0x5098('0x12'));var toCsv=require('to-csv');var querystring=require(_0x5098('0x13'));var Papa=require(_0x5098('0x14'));var Redis=require(_0x5098('0x15'));var authService=require(_0x5098('0x16'));var qs=require(_0x5098('0x17'));var as=require(_0x5098('0x18'));var hardwareService=require(_0x5098('0x19'));var logger=require('../../config/logger')(_0x5098('0x1a'));var utils=require(_0x5098('0x1b'));var config=require(_0x5098('0x1c'));var licenseUtil=require(_0x5098('0x1d'));var db=require(_0x5098('0x1e'))['db'];config['redis']=_[_0x5098('0x1f')](config[_0x5098('0x20')],{'host':_0x5098('0x21'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5098('0x20')]));require(_0x5098('0x22'))[_0x5098('0x23')](socket);function respondWithStatusCode(_0x382a4e,_0x145989){_0x145989=_0x145989||0xcc;return function(_0x1c835e){if(_0x1c835e){return _0x382a4e[_0x5098('0x24')](_0x145989);}return _0x382a4e['status'](_0x145989)['end']();};}function respondWithResult(_0x27012b,_0x2a45d5){_0x2a45d5=_0x2a45d5||0xc8;return function(_0x51f05f){if(_0x51f05f){return _0x27012b[_0x5098('0x25')](_0x2a45d5)[_0x5098('0x26')](_0x51f05f);}};}function respondWithFilteredResult(_0xd64dfd,_0x151355){return function(_0x20f56b){if(_0x20f56b){var _0x20ae67=typeof _0x151355[_0x5098('0x27')]===_0x5098('0x28')&&typeof _0x151355['limit']===_0x5098('0x28');var _0x3f3bab=_0x20f56b[_0x5098('0x29')];var _0x5dd435=_0x20ae67?0x0:_0x151355['offset'];var _0x2ad573=_0x20ae67?_0x20f56b[_0x5098('0x29')]:_0x151355[_0x5098('0x27')]+_0x151355['limit'];var _0x18fc7a;if(_0x2ad573>=_0x3f3bab){_0x2ad573=_0x3f3bab;_0x18fc7a=0xc8;}else{_0x18fc7a=0xce;}_0xd64dfd[_0x5098('0x25')](_0x18fc7a);return _0xd64dfd['set']('Content-Range',_0x5dd435+'-'+_0x2ad573+'/'+_0x3f3bab)[_0x5098('0x26')](_0x20f56b);}return null;};}function patchUpdates(_0x3e793f){return function(_0x16dd67){try{jsonpatch[_0x5098('0x2a')](_0x16dd67,_0x3e793f,!![]);}catch(_0x572141){return BPromise[_0x5098('0x2b')](_0x572141);}return _0x16dd67['save']();};}function saveUpdates(_0x1e20b0,_0x54adcf){return function(_0x1f00e5){if(_0x1f00e5){return _0x1f00e5[_0x5098('0x2c')](_0x1e20b0)['then'](function(_0x50d903){return _0x50d903;});}return null;};}function removeEntity(_0x4757c5,_0x3e92d4){return function(_0x38be8c){if(_0x38be8c){return _0x38be8c[_0x5098('0x2d')]()[_0x5098('0x2e')](function(){var _0x12c3f6=_0x38be8c[_0x5098('0x2f')]({'plain':!![]});var _0x10eba6=_0x5098('0x30');return db[_0x5098('0x31')][_0x5098('0x2d')]({'where':{'type':_0x10eba6,'resourceId':_0x12c3f6['id']}})[_0x5098('0x2e')](function(){return _0x38be8c;});})[_0x5098('0x2e')](function(){_0x4757c5[_0x5098('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cf3e5,_0x5dd48e){return function(_0x50f381){if(!_0x50f381){_0x2cf3e5[_0x5098('0x24')](0x194);}return _0x50f381;};}function handleError(_0x4c4a0d,_0x5036d7){_0x5036d7=_0x5036d7||0x1f4;return function(_0x57c70f){logger['error'](_0x57c70f['stack']);if(_0x57c70f[_0x5098('0x32')]){delete _0x57c70f[_0x5098('0x32')];}_0x4c4a0d[_0x5098('0x25')](_0x5036d7)[_0x5098('0x33')](_0x57c70f);};}exports[_0x5098('0x34')]=function(_0x30a978,_0x29e87a){var _0x5619bd={},_0x5194e3={},_0xef3c93={'count':0x0,'rows':[]};var _0x4b980c=_[_0x5098('0x35')](db[_0x5098('0x36')][_0x5098('0x37')],function(_0x5d1e6d){return{'name':_0x5d1e6d[_0x5098('0x38')],'type':_0x5d1e6d[_0x5098('0x39')][_0x5098('0x3a')]};});_0x5194e3['model']=_['map'](_0x4b980c,_0x5098('0x32'));_0x5194e3[_0x5098('0x3b')]=_[_0x5098('0x3c')](_0x30a978['query']);_0x5194e3[_0x5098('0x3d')]=_[_0x5098('0x3e')](_0x5194e3[_0x5098('0x3f')],_0x5194e3[_0x5098('0x3b')]);_0x5619bd['attributes']=_['intersection'](_0x5194e3['model'],qs[_0x5098('0x40')](_0x30a978[_0x5098('0x3b')][_0x5098('0x40')]));_0x5619bd[_0x5098('0x41')]=_0x5619bd[_0x5098('0x41')][_0x5098('0x42')]?_0x5619bd[_0x5098('0x41')]:_0x5194e3['model'];if(!_0x30a978[_0x5098('0x3b')]['hasOwnProperty'](_0x5098('0x43'))){_0x5619bd[_0x5098('0x44')]=qs[_0x5098('0x44')](_0x30a978[_0x5098('0x3b')][_0x5098('0x44')]);_0x5619bd['offset']=qs[_0x5098('0x27')](_0x30a978[_0x5098('0x3b')][_0x5098('0x27')]);}_0x5619bd['order']=qs[_0x5098('0x45')](_0x30a978[_0x5098('0x3b')][_0x5098('0x45')]);_0x5619bd['where']=qs[_0x5098('0x3d')](_[_0x5098('0x46')](_0x30a978['query'],_0x5194e3[_0x5098('0x3d')]),_0x4b980c);if(_0x30a978[_0x5098('0x3b')][_0x5098('0x47')]){_0x5619bd['where']=_[_0x5098('0x48')](_0x5619bd[_0x5098('0x49')],{'$or':_[_0x5098('0x35')](_0x4b980c,function(_0xdfface){if(_0xdfface[_0x5098('0x39')]!=='VIRTUAL'){var _0x5812ca={};_0x5812ca[_0xdfface['name']]={'$like':'%'+_0x30a978[_0x5098('0x3b')][_0x5098('0x47')]+'%'};return _0x5812ca;}})});}_0x5619bd=_['merge']({},_0x5619bd,_0x30a978['options']);var _0x3ea2d6={'where':_0x5619bd[_0x5098('0x49')]};return db[_0x5098('0x36')][_0x5098('0x29')](_0x3ea2d6)[_0x5098('0x2e')](function(_0x32bc64){_0xef3c93[_0x5098('0x29')]=_0x32bc64;if(_0x30a978[_0x5098('0x3b')][_0x5098('0x4a')]){_0x5619bd['include']=[{'all':!![]}];}return db['WhatsappQueue']['findAll'](_0x5619bd);})[_0x5098('0x2e')](function(_0x8589a0){_0xef3c93[_0x5098('0x4b')]=_0x8589a0;return _0xef3c93;})[_0x5098('0x2e')](respondWithFilteredResult(_0x29e87a,_0x5619bd))[_0x5098('0x4c')](handleError(_0x29e87a,null));};exports[_0x5098('0x4d')]=function(_0x46579f,_0x19a0fb){var _0x57736d={'raw':!![],'where':{'id':_0x46579f[_0x5098('0x4e')]['id']}},_0x436d5f={};_0x436d5f[_0x5098('0x3f')]=_[_0x5098('0x3c')](db[_0x5098('0x36')]['rawAttributes']);_0x436d5f['query']=_['keys'](_0x46579f[_0x5098('0x3b')]);_0x436d5f[_0x5098('0x3d')]=_[_0x5098('0x3e')](_0x436d5f[_0x5098('0x3f')],_0x436d5f[_0x5098('0x3b')]);_0x57736d[_0x5098('0x41')]=_[_0x5098('0x3e')](_0x436d5f[_0x5098('0x3f')],qs[_0x5098('0x40')](_0x46579f[_0x5098('0x3b')][_0x5098('0x40')]));_0x57736d[_0x5098('0x41')]=_0x57736d[_0x5098('0x41')][_0x5098('0x42')]?_0x57736d[_0x5098('0x41')]:_0x436d5f[_0x5098('0x3f')];if(_0x46579f[_0x5098('0x3b')][_0x5098('0x4a')]){_0x57736d[_0x5098('0x4f')]=[{'all':!![]}];}_0x57736d=_[_0x5098('0x48')]({},_0x57736d,_0x46579f[_0x5098('0x50')]);return db['WhatsappQueue'][_0x5098('0x51')](_0x57736d)[_0x5098('0x2e')](handleEntityNotFound(_0x19a0fb,null))['then'](respondWithResult(_0x19a0fb,null))[_0x5098('0x4c')](handleError(_0x19a0fb,null));};exports[_0x5098('0x52')]=function(_0x14856e,_0x3fbaae){return db['WhatsappQueue'][_0x5098('0x52')](_0x14856e[_0x5098('0x53')],{})[_0x5098('0x2e')](function(_0xf5431e){var _0x9ae9ef=_0x14856e[_0x5098('0x54')][_0x5098('0x2f')]({'plain':!![]});if(!_0x9ae9ef)throw new Error(_0x5098('0x55'));if(_0x9ae9ef['role']===_0x5098('0x54')){var _0x29dec6=_0xf5431e['get']({'plain':!![]});var _0x557374=_0x5098('0x30');return db[_0x5098('0x56')][_0x5098('0x51')]({'where':{'name':_0x557374,'userProfileId':_0x9ae9ef[_0x5098('0x57')]},'raw':!![]})[_0x5098('0x2e')](function(_0x208610){if(_0x208610&&_0x208610[_0x5098('0x58')]===0x0){return db[_0x5098('0x31')][_0x5098('0x52')]({'name':_0x29dec6['name'],'resourceId':_0x29dec6['id'],'type':_0x208610[_0x5098('0x32')],'sectionId':_0x208610['id']},{})[_0x5098('0x2e')](function(){return _0xf5431e;});}else{return _0xf5431e;}})[_0x5098('0x4c')](function(_0x3a9f29){logger[_0x5098('0x59')](_0x5098('0x5a'),_0x3a9f29);throw _0x3a9f29;});}return _0xf5431e;})[_0x5098('0x2e')](respondWithResult(_0x3fbaae,0xc9))[_0x5098('0x4c')](handleError(_0x3fbaae,null));};exports[_0x5098('0x2c')]=function(_0x2390d2,_0x572871){if(_0x2390d2[_0x5098('0x53')]['id']){delete _0x2390d2[_0x5098('0x53')]['id'];}return db[_0x5098('0x36')]['find']({'where':{'id':_0x2390d2[_0x5098('0x4e')]['id']}})['then'](handleEntityNotFound(_0x572871,null))[_0x5098('0x2e')](saveUpdates(_0x2390d2['body'],null))[_0x5098('0x2e')](respondWithResult(_0x572871,null))['catch'](handleError(_0x572871,null));};exports[_0x5098('0x2d')]=function(_0x1930af,_0x250cc1){return db['WhatsappQueue']['find']({'where':{'id':_0x1930af['params']['id']}})[_0x5098('0x2e')](handleEntityNotFound(_0x250cc1,null))[_0x5098('0x2e')](removeEntity(_0x250cc1,null))['catch'](handleError(_0x250cc1,null));};exports[_0x5098('0x5b')]=function(_0x15e0e0,_0x45fd7a){return db[_0x5098('0x36')][_0x5098('0x5b')]()['then'](respondWithResult(_0x45fd7a,null))['catch'](handleError(_0x45fd7a,null));};exports[_0x5098('0x5c')]=function(_0x3453e7,_0x1004e7,_0x1a1edf){var _0x2468da={'raw':!![],'where':{}},_0x3fb132={},_0x38d9e0;return db[_0x5098('0x36')][_0x5098('0x5d')]({'where':{'id':_0x3453e7[_0x5098('0x4e')]['id']}})[_0x5098('0x2e')](handleEntityNotFound(_0x1004e7,null))[_0x5098('0x2e')](function(_0xf6b0e6){if(_0xf6b0e6){_0x38d9e0=_0xf6b0e6['get']({'plain':!![]});_0x3fb132[_0x5098('0x3f')]=_[_0x5098('0x3c')](db[_0x5098('0x5e')]['rawAttributes']);_0x3fb132[_0x5098('0x3b')]=_[_0x5098('0x3c')](_0x3453e7[_0x5098('0x3b')]);_0x3fb132['filters']=_[_0x5098('0x3e')](_0x3fb132[_0x5098('0x3f')],_0x3fb132['query']);_0x2468da[_0x5098('0x41')]=_['intersection'](_0x3fb132['model'],qs['fields'](_0x3453e7[_0x5098('0x3b')][_0x5098('0x40')]));_0x2468da[_0x5098('0x41')]=_0x2468da['attributes'][_0x5098('0x42')]?_0x2468da[_0x5098('0x41')]:_0x3fb132[_0x5098('0x3f')];if(!_0x3453e7['query'][_0x5098('0x5f')](_0x5098('0x43'))){_0x2468da[_0x5098('0x44')]=qs[_0x5098('0x44')](_0x3453e7['query'][_0x5098('0x44')]);_0x2468da[_0x5098('0x27')]=qs[_0x5098('0x27')](_0x3453e7[_0x5098('0x3b')][_0x5098('0x27')]);}_0x2468da[_0x5098('0x60')]=qs[_0x5098('0x45')](_0x3453e7[_0x5098('0x3b')][_0x5098('0x45')]);_0x2468da[_0x5098('0x49')]=qs[_0x5098('0x3d')](_[_0x5098('0x46')](_0x3453e7[_0x5098('0x3b')],_0x3fb132[_0x5098('0x3d')]));_0x2468da[_0x5098('0x49')]['WhatsappQueueId']=_0xf6b0e6['id'];if(_0x3453e7[_0x5098('0x3b')][_0x5098('0x47')]){_0x2468da['where']=_[_0x5098('0x48')](_0x2468da[_0x5098('0x49')],{'$or':_[_0x5098('0x35')](_0x2468da[_0x5098('0x41')],function(_0x1d2105){var _0x1e1bb7={};_0x1e1bb7[_0x1d2105]={'$like':'%'+_0x3453e7['query'][_0x5098('0x47')]+'%'};return _0x1e1bb7;})});}_0x2468da=_[_0x5098('0x48')]({},_0x2468da,_0x3453e7['options']);return db[_0x5098('0x5e')]['findAll'](_0x2468da);}})[_0x5098('0x2e')](function(_0x41b5db){if(_0x41b5db){return db[_0x5098('0x61')]['findAndCountAll']({'where':{'id':_['map'](_0x41b5db,_0x5098('0x62')),'role':_0x5098('0x63')},'attributes':['id','name',_0x5098('0x64'),_0x5098('0x65'),_0x5098('0x66')]});}})['then'](function(_0x3b4838){if(_0x3b4838){return{'count':_0x3b4838[_0x5098('0x29')],'rows':_[_0x5098('0x35')](_0x3b4838[_0x5098('0x4b')],function(_0x5720c9){return{'membername':_0x5720c9[_0x5098('0x32')],'UserId':_0x5720c9['id'],'queue_name':_0x38d9e0[_0x5098('0x32')],'WhatsappQueueId':_0x38d9e0['id'],'interface':util[_0x5098('0x67')](_0x5098('0x68'),'SIP',_0x5720c9[_0x5098('0x32')]),'penalty':0x0,'paused':_0x5720c9[_0x5098('0x64')],'createdAt':_0x5720c9[_0x5098('0x66')],'updatedAt':_0x5720c9[_0x5098('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5098('0x2e')](respondWithFilteredResult(_0x1004e7,_0x2468da))['catch'](handleError(_0x1004e7,null));};exports[_0x5098('0x69')]=function(_0x51c906,_0xdfec9e,_0x4b61bc){var _0x2e130a={};var _0x2c0c41={};var _0x5ceb96;var _0x2c8afe;return db['WhatsappQueue'][_0x5098('0x5d')]({'where':{'id':_0x51c906['params']['id']}})[_0x5098('0x2e')](handleEntityNotFound(_0xdfec9e,null))[_0x5098('0x2e')](function(_0x1ce317){if(_0x1ce317){_0x5ceb96=_0x1ce317;_0x2c0c41[_0x5098('0x3f')]=_['keys'](db[_0x5098('0x6a')]['rawAttributes']);_0x2c0c41['query']=_[_0x5098('0x3c')](_0x51c906['query']);_0x2c0c41['filters']=_[_0x5098('0x3e')](_0x2c0c41[_0x5098('0x3f')],_0x2c0c41['query']);_0x2e130a['attributes']=_[_0x5098('0x3e')](_0x2c0c41['model'],qs[_0x5098('0x40')](_0x51c906[_0x5098('0x3b')][_0x5098('0x40')]));_0x2e130a['attributes']=_0x2e130a[_0x5098('0x41')][_0x5098('0x42')]?_0x2e130a[_0x5098('0x41')]:_0x2c0c41[_0x5098('0x3f')];_0x2e130a[_0x5098('0x60')]=qs['sort'](_0x51c906[_0x5098('0x3b')][_0x5098('0x45')]);_0x2e130a[_0x5098('0x49')]=qs['filters'](_[_0x5098('0x46')](_0x51c906['query'],_0x2c0c41[_0x5098('0x3d')]));if(_0x51c906[_0x5098('0x3b')][_0x5098('0x47')]){_0x2e130a[_0x5098('0x49')]=_[_0x5098('0x48')](_0x2e130a[_0x5098('0x49')],{'$or':_[_0x5098('0x35')](_0x2e130a['attributes'],function(_0xecb9a9){var _0xc5726a={};_0xc5726a[_0xecb9a9]={'$like':'%'+_0x51c906['query']['filter']+'%'};return _0xc5726a;})});}_0x2e130a=_['merge']({},_0x2e130a,_0x51c906[_0x5098('0x50')]);return _0x5ceb96[_0x5098('0x69')](_0x2e130a);}})['then'](function(_0x227e65){if(_0x227e65){_0x2c8afe=_0x227e65[_0x5098('0x42')];if(!_0x51c906[_0x5098('0x3b')][_0x5098('0x5f')](_0x5098('0x43'))){_0x2e130a[_0x5098('0x44')]=qs[_0x5098('0x44')](_0x51c906[_0x5098('0x3b')][_0x5098('0x44')]);_0x2e130a['offset']=qs[_0x5098('0x27')](_0x51c906[_0x5098('0x3b')][_0x5098('0x27')]);}return _0x5ceb96['getTeams'](_0x2e130a);}})[_0x5098('0x2e')](function(_0x5ebef2){if(_0x5ebef2){return _0x5ebef2?{'count':_0x2c8afe,'rows':_0x5ebef2}:null;}})[_0x5098('0x2e')](respondWithResult(_0xdfec9e,null))[_0x5098('0x4c')](handleError(_0xdfec9e,null));};exports[_0x5098('0x6b')]=function(_0x9a69a3,_0x3ade9f,_0x368ce8){var _0x3a553a=_0x9a69a3[_0x5098('0x53')][_0x5098('0x6c')];return db[_0x5098('0x6a')][_0x5098('0x6d')]({'where':{'id':_0x3a553a},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5098('0x6e'),'attributes':['id',_0x5098('0x32'),_0x5098('0x6f'),_0x5098('0x70'),'interface'],'raw':!![]}]})[_0x5098('0x2e')](function(_0x3416d6){if(_0x3416d6){var _0x76346f=_['flatMap'](_0x3416d6,function(_0x35e631){var _0x38f0ae=_0x35e631[_0x5098('0x2f')]({'plain':!![]});return _0x38f0ae[_0x5098('0x6e')];});return db[_0x5098('0x36')]['find']({'where':{'id':_0x9a69a3[_0x5098('0x4e')]['id']}})['then'](function(_0x29301b){return db[_0x5098('0x71')][_0x5098('0x72')](function(_0x1d8773){return _0x29301b['addTeams'](_0x3a553a,{'transaction':_0x1d8773})[_0x5098('0x2e')](function(){return BPromise[_0x5098('0x73')](_0x76346f,function(_0x217d82){return db[_0x5098('0x5e')][_0x5098('0x74')]({'where':{'UserId':_0x217d82['id'],'WhatsappQueueId':_0x9a69a3[_0x5098('0x4e')]['id']},'transaction':_0x1d8773});});})[_0x5098('0x2e')](function(){_0x76346f[_0x5098('0x75')](function(_0x2b8499){socket['emit'](_0x5098('0x76'),{'UserId':_0x2b8499['id'],'WhatsappQueueId':_0x29301b['id']});});});});});}})[_0x5098('0x2e')](respondWithStatusCode(_0x3ade9f,null))[_0x5098('0x4c')](handleError(_0x3ade9f,null));};exports[_0x5098('0x77')]=function(_0x43d082,_0x2d9697,_0x2bc500){return db['Team'][_0x5098('0x6d')]({'where':{'id':_0x43d082[_0x5098('0x3b')][_0x5098('0x6c')]},'attributes':['id'],'include':[{'model':db[_0x5098('0x61')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2d9697,null))['then'](function(_0x4984dc){var _0x18a790=_[_0x5098('0x35')](_0x4984dc,'id');var _0x318bd3=[];var _0x3dcc46=[];var _0x262e79=squel[_0x5098('0x78')]();_0x262e79[_0x5098('0x79')](_0x5098('0x7a'))['from'](_0x5098('0x7b'),'tq')[_0x5098('0x7c')](_0x5098('0x7d'),'ut',_0x5098('0x7e'))[_0x5098('0x49')](_0x5098('0x7f'),_0x43d082[_0x5098('0x4e')]['id']);for(var _0x60115f=0x0;_0x60115f<_0x4984dc[_0x5098('0x42')];_0x60115f+=0x1){let _0x434a00=_0x4984dc[_0x60115f];for(var _0x5513e6=0x0;_0x5513e6<_0x434a00[_0x5098('0x6e')]['length'];_0x5513e6+=0x1){let _0x51713c=_0x434a00[_0x5098('0x6e')][_0x5513e6];var _0x40908d=_0x262e79['clone']();_0x40908d['where'](_0x5098('0x80'),_0x51713c['id']);_0x3dcc46[_0x5098('0x81')](db[_0x5098('0x71')][_0x5098('0x3b')](_0x40908d[_0x5098('0x82')](),{'type':db[_0x5098('0x71')][_0x5098('0x83')]['SELECT']})[_0x5098('0x2e')](function(_0x267ed6){if(_0x267ed6[_0x5098('0x42')]===0x1){return _0x51713c['id'];}else{var _0x227ade=_['every'](_[_0x5098('0x35')](_0x267ed6,_0x5098('0x84')),function(_0x5de3cb){return _[_0x5098('0x85')](_0x18a790,_0x5de3cb);});if(_0x227ade){return _0x51713c['id'];}}}));}}return BPromise[_0x5098('0x86')](_0x3dcc46)[_0x5098('0x2e')](function(_0x4c9861){_0x318bd3=_(_0x318bd3)['union'](_0x4c9861)[_0x5098('0x87')]()[_0x5098('0x88')]();return db[_0x5098('0x36')][_0x5098('0x51')]({'where':{'id':_0x43d082['params']['id']}})['then'](function(_0x3d2580){return db['sequelize'][_0x5098('0x72')](function(_0x11bfda){return _0x3d2580['removeTeams'](_0x43d082[_0x5098('0x3b')]['ids'],{'transaction':_0x11bfda})['then'](function(){if(!_[_0x5098('0x89')](_0x318bd3)){return _0x3d2580['removeAgents'](_0x318bd3,{'transaction':_0x11bfda});}})[_0x5098('0x2e')](function(){_0x318bd3['forEach'](function(_0x408831){socket[_0x5098('0x8a')](_0x5098('0x8b'),{'UserId':_0x408831,'WhatsappQueueId':_0x3d2580['id']});});});});});});})[_0x5098('0x2e')](respondWithStatusCode(_0x2d9697,null))[_0x5098('0x4c')](handleError(_0x2d9697,null));};exports[_0x5098('0x8c')]=function(_0x373f47,_0x4f9fcb,_0x120c0e){return db[_0x5098('0x36')]['find']({'where':{'id':_0x373f47['params']['id']}})['then'](handleEntityNotFound(_0x4f9fcb,null))[_0x5098('0x2e')](function(_0x216a13){if(_0x216a13){return _0x216a13['addAgents'](_0x373f47[_0x5098('0x53')][_0x5098('0x6c')],_[_0x5098('0x8d')](_0x373f47[_0x5098('0x53')],[_0x5098('0x6c'),'id'])||{})[_0x5098('0x8e')](function(_0x1ca44e){for(var _0x21677f=0x0;_0x21677f<_0x373f47[_0x5098('0x53')][_0x5098('0x6c')][_0x5098('0x42')];_0x21677f+=0x1){socket[_0x5098('0x8a')](_0x5098('0x76'),{'UserId':Number(_0x373f47[_0x5098('0x53')]['ids'][_0x21677f]),'WhatsappQueueId':Number(_0x373f47['params']['id'])});}return _0x1ca44e;});}})['then'](respondWithResult(_0x4f9fcb,null))[_0x5098('0x4c')](handleError(_0x4f9fcb,null));};exports['removeAgents']=function(_0x4bea33,_0x47737a,_0x3c2ae6){return db[_0x5098('0x36')][_0x5098('0x51')]({'where':{'id':_0x4bea33['params']['id']}})[_0x5098('0x2e')](handleEntityNotFound(_0x47737a,null))[_0x5098('0x2e')](function(_0x3b1fdc){if(_0x3b1fdc){return _0x3b1fdc[_0x5098('0x8f')](_0x4bea33[_0x5098('0x3b')][_0x5098('0x6c')])[_0x5098('0x2e')](function(){if(_['isArray'](_0x4bea33[_0x5098('0x3b')]['ids'])){for(var _0x2dd139=0x0;_0x2dd139<_0x4bea33[_0x5098('0x3b')][_0x5098('0x6c')][_0x5098('0x42')];_0x2dd139+=0x1){socket[_0x5098('0x8a')](_0x5098('0x8b'),{'UserId':Number(_0x4bea33[_0x5098('0x3b')][_0x5098('0x6c')][_0x2dd139]),'WhatsappQueueId':Number(_0x4bea33[_0x5098('0x4e')]['id'])});}}else{socket[_0x5098('0x8a')]('userWhatsappQueue:remove',{'UserId':Number(_0x4bea33[_0x5098('0x3b')][_0x5098('0x6c')]),'WhatsappQueueId':Number(_0x4bea33[_0x5098('0x4e')]['id'])});}});}})[_0x5098('0x2e')](respondWithStatusCode(_0x47737a,null))['catch'](handleError(_0x47737a,null));};exports[_0x5098('0x90')]=function(_0x1364cc,_0x151b92,_0x5ae0d5){var _0x4407d3={};var _0x28ed8a={};var _0x4c3985;var _0x182a7a;return db[_0x5098('0x36')]['findOne']({'where':{'id':_0x1364cc['params']['id']}})[_0x5098('0x2e')](handleEntityNotFound(_0x151b92,null))[_0x5098('0x2e')](function(_0x58bff3){if(_0x58bff3){_0x4c3985=_0x58bff3;_0x28ed8a['model']=_['keys'](db[_0x5098('0x61')]['rawAttributes']);_0x28ed8a['query']=_['keys'](_0x1364cc[_0x5098('0x3b')]);_0x28ed8a[_0x5098('0x3d')]=_[_0x5098('0x3e')](_0x28ed8a[_0x5098('0x3f')],_0x28ed8a[_0x5098('0x3b')]);_0x4407d3[_0x5098('0x41')]=_['intersection'](_0x28ed8a[_0x5098('0x3f')],qs[_0x5098('0x40')](_0x1364cc[_0x5098('0x3b')][_0x5098('0x40')]));_0x4407d3['attributes']=_0x4407d3[_0x5098('0x41')][_0x5098('0x42')]?_0x4407d3['attributes']:_0x28ed8a[_0x5098('0x3f')];_0x4407d3[_0x5098('0x60')]=qs['sort'](_0x1364cc[_0x5098('0x3b')][_0x5098('0x45')]);_0x4407d3['where']=qs[_0x5098('0x3d')](_['pick'](_0x1364cc[_0x5098('0x3b')],_0x28ed8a[_0x5098('0x3d')]));if(_0x1364cc['query'][_0x5098('0x47')]){_0x4407d3[_0x5098('0x49')]=_[_0x5098('0x48')](_0x4407d3['where'],{'$or':_['map'](_0x4407d3['attributes'],function(_0x2c761e){var _0x16c973={};_0x16c973[_0x2c761e]={'$like':'%'+_0x1364cc[_0x5098('0x3b')]['filter']+'%'};return _0x16c973;})});}_0x4407d3=_[_0x5098('0x48')]({},_0x4407d3,_0x1364cc['options']);return _0x4c3985[_0x5098('0x90')](_0x4407d3);}})[_0x5098('0x2e')](function(_0x1ca9da){if(_0x1ca9da){_0x182a7a=_0x1ca9da['length'];if(!_0x1364cc['query']['hasOwnProperty'](_0x5098('0x43'))){_0x4407d3['limit']=qs[_0x5098('0x44')](_0x1364cc[_0x5098('0x3b')][_0x5098('0x44')]);_0x4407d3[_0x5098('0x27')]=qs[_0x5098('0x27')](_0x1364cc[_0x5098('0x3b')]['offset']);}return _0x4c3985[_0x5098('0x90')](_0x4407d3);}})[_0x5098('0x2e')](function(_0x2ce6d3){if(_0x2ce6d3){return _0x2ce6d3?{'count':_0x182a7a,'rows':_0x2ce6d3}:null;}})[_0x5098('0x2e')](respondWithResult(_0x151b92,null))[_0x5098('0x4c')](handleError(_0x151b92,null));}; \ No newline at end of file +var _0xfc97=['isArray','getAgents','eml-format','rimraf','zip-dir','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','sendStatus','json','undefined','limit','offset','status','set','Content-Range','apply','save','update','then','destroy','get','WhatsappQueues','end','error','stack','name','send','index','map','WhatsappQueue','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','options','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','length','filter','findAndCountAll','UserId','whatsappPause','format','SIP','updatedAt','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','field','tq.TeamId','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','includes','all','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread'];(function(_0xa00816,_0xcc03c0){var _0x48e505=function(_0x4ffb8e){while(--_0x4ffb8e){_0xa00816['push'](_0xa00816['shift']());}};_0x48e505(++_0xcc03c0);}(_0xfc97,0x1ac));var _0x7fc9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfc97[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x7fc9('0x0'));var rimraf=require(_0x7fc9('0x1'));var zipdir=require(_0x7fc9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7fc9('0x3'));var util=require('util');var path=require(_0x7fc9('0x4'));var sox=require(_0x7fc9('0x5'));var csv=require(_0x7fc9('0x6'));var ejs=require(_0x7fc9('0x7'));var fs=require('fs');var fs_extra=require(_0x7fc9('0x8'));var _=require(_0x7fc9('0x9'));var squel=require(_0x7fc9('0xa'));var crypto=require(_0x7fc9('0xb'));var jsforce=require(_0x7fc9('0xc'));var deskjs=require(_0x7fc9('0xd'));var toCsv=require(_0x7fc9('0x6'));var querystring=require(_0x7fc9('0xe'));var Papa=require(_0x7fc9('0xf'));var Redis=require(_0x7fc9('0x10'));var authService=require(_0x7fc9('0x11'));var qs=require(_0x7fc9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7fc9('0x13'));var logger=require(_0x7fc9('0x14'))(_0x7fc9('0x15'));var utils=require(_0x7fc9('0x16'));var config=require(_0x7fc9('0x17'));var licenseUtil=require(_0x7fc9('0x18'));var db=require(_0x7fc9('0x19'))['db'];config['redis']=_[_0x7fc9('0x1a')](config['redis'],{'host':_0x7fc9('0x1b'),'port':0x18eb});var socket=require(_0x7fc9('0x1c'))(new Redis(config[_0x7fc9('0x1d')]));require('./whatsappQueue.socket')[_0x7fc9('0x1e')](socket);function respondWithStatusCode(_0x2ae0ca,_0x5d1f0b){_0x5d1f0b=_0x5d1f0b||0xcc;return function(_0x5e13e2){if(_0x5e13e2){return _0x2ae0ca[_0x7fc9('0x1f')](_0x5d1f0b);}return _0x2ae0ca['status'](_0x5d1f0b)['end']();};}function respondWithResult(_0x5064ad,_0x54e2a6){_0x54e2a6=_0x54e2a6||0xc8;return function(_0x83b765){if(_0x83b765){return _0x5064ad['status'](_0x54e2a6)[_0x7fc9('0x20')](_0x83b765);}};}function respondWithFilteredResult(_0x18ae46,_0x546be9){return function(_0x2626e0){if(_0x2626e0){var _0x5fa627=typeof _0x546be9['offset']===_0x7fc9('0x21')&&typeof _0x546be9[_0x7fc9('0x22')]==='undefined';var _0x3016de=_0x2626e0['count'];var _0x6cc9b5=_0x5fa627?0x0:_0x546be9['offset'];var _0x33b9ed=_0x5fa627?_0x2626e0['count']:_0x546be9[_0x7fc9('0x23')]+_0x546be9[_0x7fc9('0x22')];var _0x51e0e9;if(_0x33b9ed>=_0x3016de){_0x33b9ed=_0x3016de;_0x51e0e9=0xc8;}else{_0x51e0e9=0xce;}_0x18ae46[_0x7fc9('0x24')](_0x51e0e9);return _0x18ae46[_0x7fc9('0x25')](_0x7fc9('0x26'),_0x6cc9b5+'-'+_0x33b9ed+'/'+_0x3016de)[_0x7fc9('0x20')](_0x2626e0);}return null;};}function patchUpdates(_0x46cf90){return function(_0x28a90d){try{jsonpatch[_0x7fc9('0x27')](_0x28a90d,_0x46cf90,!![]);}catch(_0xc147fd){return BPromise['reject'](_0xc147fd);}return _0x28a90d[_0x7fc9('0x28')]();};}function saveUpdates(_0x1e6676,_0x2b226c){return function(_0x25919e){if(_0x25919e){return _0x25919e[_0x7fc9('0x29')](_0x1e6676)[_0x7fc9('0x2a')](function(_0x19298a){return _0x19298a;});}return null;};}function removeEntity(_0x203aeb,_0x3f089e){return function(_0x2cf59f){if(_0x2cf59f){return _0x2cf59f[_0x7fc9('0x2b')]()[_0x7fc9('0x2a')](function(){var _0x57219f=_0x2cf59f[_0x7fc9('0x2c')]({'plain':!![]});var _0x32a83d=_0x7fc9('0x2d');return db['UserProfileResource'][_0x7fc9('0x2b')]({'where':{'type':_0x32a83d,'resourceId':_0x57219f['id']}})[_0x7fc9('0x2a')](function(){return _0x2cf59f;});})['then'](function(){_0x203aeb['status'](0xcc)[_0x7fc9('0x2e')]();});}};}function handleEntityNotFound(_0x2bc440,_0x3a44e6){return function(_0x322191){if(!_0x322191){_0x2bc440[_0x7fc9('0x1f')](0x194);}return _0x322191;};}function handleError(_0x1dfdf7,_0x1facc6){_0x1facc6=_0x1facc6||0x1f4;return function(_0x4502ac){logger[_0x7fc9('0x2f')](_0x4502ac[_0x7fc9('0x30')]);if(_0x4502ac['name']){delete _0x4502ac[_0x7fc9('0x31')];}_0x1dfdf7[_0x7fc9('0x24')](_0x1facc6)[_0x7fc9('0x32')](_0x4502ac);};}exports[_0x7fc9('0x33')]=function(_0x441293,_0x3bb93b){var _0x316673={},_0x2a34c6={},_0x422860={'count':0x0,'rows':[]};var _0x308226=_[_0x7fc9('0x34')](db[_0x7fc9('0x35')]['rawAttributes'],function(_0x2ce09d){return{'name':_0x2ce09d['fieldName'],'type':_0x2ce09d[_0x7fc9('0x36')][_0x7fc9('0x37')]};});_0x2a34c6[_0x7fc9('0x38')]=_[_0x7fc9('0x34')](_0x308226,_0x7fc9('0x31'));_0x2a34c6['query']=_['keys'](_0x441293[_0x7fc9('0x39')]);_0x2a34c6[_0x7fc9('0x3a')]=_[_0x7fc9('0x3b')](_0x2a34c6['model'],_0x2a34c6[_0x7fc9('0x39')]);_0x316673[_0x7fc9('0x3c')]=_[_0x7fc9('0x3b')](_0x2a34c6['model'],qs['fields'](_0x441293[_0x7fc9('0x39')][_0x7fc9('0x3d')]));_0x316673[_0x7fc9('0x3c')]=_0x316673['attributes']['length']?_0x316673['attributes']:_0x2a34c6[_0x7fc9('0x38')];if(!_0x441293[_0x7fc9('0x39')][_0x7fc9('0x3e')](_0x7fc9('0x3f'))){_0x316673['limit']=qs[_0x7fc9('0x22')](_0x441293[_0x7fc9('0x39')][_0x7fc9('0x22')]);_0x316673[_0x7fc9('0x23')]=qs[_0x7fc9('0x23')](_0x441293['query'][_0x7fc9('0x23')]);}_0x316673[_0x7fc9('0x40')]=qs['sort'](_0x441293['query'][_0x7fc9('0x41')]);_0x316673[_0x7fc9('0x42')]=qs[_0x7fc9('0x3a')](_[_0x7fc9('0x43')](_0x441293[_0x7fc9('0x39')],_0x2a34c6[_0x7fc9('0x3a')]),_0x308226);if(_0x441293[_0x7fc9('0x39')]['filter']){_0x316673[_0x7fc9('0x42')]=_[_0x7fc9('0x44')](_0x316673[_0x7fc9('0x42')],{'$or':_[_0x7fc9('0x34')](_0x308226,function(_0x4abfb4){if(_0x4abfb4[_0x7fc9('0x36')]!==_0x7fc9('0x45')){var _0x589c56={};_0x589c56[_0x4abfb4[_0x7fc9('0x31')]]={'$like':'%'+_0x441293[_0x7fc9('0x39')]['filter']+'%'};return _0x589c56;}})});}_0x316673=_[_0x7fc9('0x44')]({},_0x316673,_0x441293['options']);var _0x50d3c1={'where':_0x316673[_0x7fc9('0x42')]};return db['WhatsappQueue'][_0x7fc9('0x46')](_0x50d3c1)['then'](function(_0xa74f09){_0x422860[_0x7fc9('0x46')]=_0xa74f09;if(_0x441293[_0x7fc9('0x39')][_0x7fc9('0x47')]){_0x316673[_0x7fc9('0x48')]=[{'all':!![]}];}return db[_0x7fc9('0x35')][_0x7fc9('0x49')](_0x316673);})[_0x7fc9('0x2a')](function(_0x400494){_0x422860[_0x7fc9('0x4a')]=_0x400494;return _0x422860;})[_0x7fc9('0x2a')](respondWithFilteredResult(_0x3bb93b,_0x316673))[_0x7fc9('0x4b')](handleError(_0x3bb93b,null));};exports[_0x7fc9('0x4c')]=function(_0x31c230,_0x94de1f){var _0x2e3bd3={'raw':!![],'where':{'id':_0x31c230[_0x7fc9('0x4d')]['id']}},_0x5d4a25={};_0x5d4a25[_0x7fc9('0x38')]=_['keys'](db[_0x7fc9('0x35')][_0x7fc9('0x4e')]);_0x5d4a25[_0x7fc9('0x39')]=_[_0x7fc9('0x4f')](_0x31c230['query']);_0x5d4a25[_0x7fc9('0x3a')]=_['intersection'](_0x5d4a25[_0x7fc9('0x38')],_0x5d4a25[_0x7fc9('0x39')]);_0x2e3bd3[_0x7fc9('0x3c')]=_[_0x7fc9('0x3b')](_0x5d4a25[_0x7fc9('0x38')],qs[_0x7fc9('0x3d')](_0x31c230[_0x7fc9('0x39')][_0x7fc9('0x3d')]));_0x2e3bd3[_0x7fc9('0x3c')]=_0x2e3bd3[_0x7fc9('0x3c')]['length']?_0x2e3bd3[_0x7fc9('0x3c')]:_0x5d4a25[_0x7fc9('0x38')];if(_0x31c230['query'][_0x7fc9('0x47')]){_0x2e3bd3[_0x7fc9('0x48')]=[{'all':!![]}];}_0x2e3bd3=_[_0x7fc9('0x44')]({},_0x2e3bd3,_0x31c230[_0x7fc9('0x50')]);return db['WhatsappQueue'][_0x7fc9('0x51')](_0x2e3bd3)[_0x7fc9('0x2a')](handleEntityNotFound(_0x94de1f,null))[_0x7fc9('0x2a')](respondWithResult(_0x94de1f,null))[_0x7fc9('0x4b')](handleError(_0x94de1f,null));};exports[_0x7fc9('0x52')]=function(_0x4ecbe4,_0xd2eab3){return db[_0x7fc9('0x35')][_0x7fc9('0x52')](_0x4ecbe4[_0x7fc9('0x53')],{})[_0x7fc9('0x2a')](function(_0x5f5b00){var _0x102c93=_0x4ecbe4[_0x7fc9('0x54')][_0x7fc9('0x2c')]({'plain':!![]});if(!_0x102c93)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x102c93['role']===_0x7fc9('0x54')){var _0x5d71bb=_0x5f5b00['get']({'plain':!![]});var _0x57a7da=_0x7fc9('0x2d');return db[_0x7fc9('0x55')][_0x7fc9('0x51')]({'where':{'name':_0x57a7da,'userProfileId':_0x102c93[_0x7fc9('0x56')]},'raw':!![]})[_0x7fc9('0x2a')](function(_0x501192){if(_0x501192&&_0x501192[_0x7fc9('0x57')]===0x0){return db[_0x7fc9('0x58')][_0x7fc9('0x52')]({'name':_0x5d71bb[_0x7fc9('0x31')],'resourceId':_0x5d71bb['id'],'type':_0x501192[_0x7fc9('0x31')],'sectionId':_0x501192['id']},{})[_0x7fc9('0x2a')](function(){return _0x5f5b00;});}else{return _0x5f5b00;}})['catch'](function(_0x5125b4){logger[_0x7fc9('0x2f')](_0x7fc9('0x59'),_0x5125b4);throw _0x5125b4;});}return _0x5f5b00;})['then'](respondWithResult(_0xd2eab3,0xc9))[_0x7fc9('0x4b')](handleError(_0xd2eab3,null));};exports[_0x7fc9('0x29')]=function(_0x118e5c,_0x134eef){if(_0x118e5c[_0x7fc9('0x53')]['id']){delete _0x118e5c[_0x7fc9('0x53')]['id'];}return db['WhatsappQueue'][_0x7fc9('0x51')]({'where':{'id':_0x118e5c[_0x7fc9('0x4d')]['id']}})[_0x7fc9('0x2a')](handleEntityNotFound(_0x134eef,null))[_0x7fc9('0x2a')](saveUpdates(_0x118e5c[_0x7fc9('0x53')],null))[_0x7fc9('0x2a')](respondWithResult(_0x134eef,null))[_0x7fc9('0x4b')](handleError(_0x134eef,null));};exports['destroy']=function(_0x438799,_0xd27bd3){return db[_0x7fc9('0x35')]['find']({'where':{'id':_0x438799['params']['id']}})['then'](handleEntityNotFound(_0xd27bd3,null))[_0x7fc9('0x2a')](removeEntity(_0xd27bd3,null))['catch'](handleError(_0xd27bd3,null));};exports[_0x7fc9('0x5a')]=function(_0x5c3194,_0x1cd2cf){return db['WhatsappQueue']['describe']()[_0x7fc9('0x2a')](respondWithResult(_0x1cd2cf,null))['catch'](handleError(_0x1cd2cf,null));};exports[_0x7fc9('0x5b')]=function(_0x4aad69,_0x3e968d,_0x550983){var _0x481fdd={'raw':!![],'where':{}},_0x464ab1={},_0x42799d;return db[_0x7fc9('0x35')][_0x7fc9('0x5c')]({'where':{'id':_0x4aad69[_0x7fc9('0x4d')]['id']}})[_0x7fc9('0x2a')](handleEntityNotFound(_0x3e968d,null))[_0x7fc9('0x2a')](function(_0x5bc3f2){if(_0x5bc3f2){_0x42799d=_0x5bc3f2[_0x7fc9('0x2c')]({'plain':!![]});_0x464ab1['model']=_[_0x7fc9('0x4f')](db[_0x7fc9('0x5d')]['rawAttributes']);_0x464ab1['query']=_[_0x7fc9('0x4f')](_0x4aad69[_0x7fc9('0x39')]);_0x464ab1['filters']=_[_0x7fc9('0x3b')](_0x464ab1[_0x7fc9('0x38')],_0x464ab1['query']);_0x481fdd['attributes']=_['intersection'](_0x464ab1['model'],qs['fields'](_0x4aad69[_0x7fc9('0x39')][_0x7fc9('0x3d')]));_0x481fdd[_0x7fc9('0x3c')]=_0x481fdd['attributes'][_0x7fc9('0x5e')]?_0x481fdd[_0x7fc9('0x3c')]:_0x464ab1[_0x7fc9('0x38')];if(!_0x4aad69[_0x7fc9('0x39')][_0x7fc9('0x3e')](_0x7fc9('0x3f'))){_0x481fdd[_0x7fc9('0x22')]=qs[_0x7fc9('0x22')](_0x4aad69['query'][_0x7fc9('0x22')]);_0x481fdd['offset']=qs[_0x7fc9('0x23')](_0x4aad69[_0x7fc9('0x39')][_0x7fc9('0x23')]);}_0x481fdd['order']=qs[_0x7fc9('0x41')](_0x4aad69[_0x7fc9('0x39')][_0x7fc9('0x41')]);_0x481fdd[_0x7fc9('0x42')]=qs['filters'](_[_0x7fc9('0x43')](_0x4aad69[_0x7fc9('0x39')],_0x464ab1[_0x7fc9('0x3a')]));_0x481fdd[_0x7fc9('0x42')]['WhatsappQueueId']=_0x5bc3f2['id'];if(_0x4aad69['query']['filter']){_0x481fdd[_0x7fc9('0x42')]=_[_0x7fc9('0x44')](_0x481fdd[_0x7fc9('0x42')],{'$or':_[_0x7fc9('0x34')](_0x481fdd[_0x7fc9('0x3c')],function(_0x298857){var _0x1db72c={};_0x1db72c[_0x298857]={'$like':'%'+_0x4aad69[_0x7fc9('0x39')][_0x7fc9('0x5f')]+'%'};return _0x1db72c;})});}_0x481fdd=_[_0x7fc9('0x44')]({},_0x481fdd,_0x4aad69[_0x7fc9('0x50')]);return db[_0x7fc9('0x5d')][_0x7fc9('0x49')](_0x481fdd);}})[_0x7fc9('0x2a')](function(_0x154c80){if(_0x154c80){return db['User'][_0x7fc9('0x60')]({'where':{'id':_[_0x7fc9('0x34')](_0x154c80,_0x7fc9('0x61')),'role':'agent'},'attributes':['id',_0x7fc9('0x31'),_0x7fc9('0x62'),'updatedAt','createdAt']});}})[_0x7fc9('0x2a')](function(_0x3a2bd9){if(_0x3a2bd9){return{'count':_0x3a2bd9[_0x7fc9('0x46')],'rows':_['map'](_0x3a2bd9[_0x7fc9('0x4a')],function(_0x40b7c2){return{'membername':_0x40b7c2[_0x7fc9('0x31')],'UserId':_0x40b7c2['id'],'queue_name':_0x42799d['name'],'WhatsappQueueId':_0x42799d['id'],'interface':util[_0x7fc9('0x63')]('%s/%s',_0x7fc9('0x64'),_0x40b7c2[_0x7fc9('0x31')]),'penalty':0x0,'paused':_0x40b7c2[_0x7fc9('0x62')],'createdAt':_0x40b7c2['createdAt'],'updatedAt':_0x40b7c2[_0x7fc9('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7fc9('0x2a')](respondWithFilteredResult(_0x3e968d,_0x481fdd))[_0x7fc9('0x4b')](handleError(_0x3e968d,null));};exports[_0x7fc9('0x66')]=function(_0x2043f7,_0x409ea1,_0x7ca077){var _0x50f558={};var _0x13785e={};var _0x21b0c7;var _0x2d0183;return db[_0x7fc9('0x35')][_0x7fc9('0x5c')]({'where':{'id':_0x2043f7[_0x7fc9('0x4d')]['id']}})['then'](handleEntityNotFound(_0x409ea1,null))[_0x7fc9('0x2a')](function(_0x3c517c){if(_0x3c517c){_0x21b0c7=_0x3c517c;_0x13785e['model']=_['keys'](db[_0x7fc9('0x67')][_0x7fc9('0x4e')]);_0x13785e['query']=_[_0x7fc9('0x4f')](_0x2043f7[_0x7fc9('0x39')]);_0x13785e[_0x7fc9('0x3a')]=_[_0x7fc9('0x3b')](_0x13785e[_0x7fc9('0x38')],_0x13785e['query']);_0x50f558[_0x7fc9('0x3c')]=_[_0x7fc9('0x3b')](_0x13785e[_0x7fc9('0x38')],qs['fields'](_0x2043f7[_0x7fc9('0x39')][_0x7fc9('0x3d')]));_0x50f558[_0x7fc9('0x3c')]=_0x50f558[_0x7fc9('0x3c')][_0x7fc9('0x5e')]?_0x50f558[_0x7fc9('0x3c')]:_0x13785e[_0x7fc9('0x38')];_0x50f558[_0x7fc9('0x40')]=qs['sort'](_0x2043f7[_0x7fc9('0x39')][_0x7fc9('0x41')]);_0x50f558[_0x7fc9('0x42')]=qs[_0x7fc9('0x3a')](_[_0x7fc9('0x43')](_0x2043f7['query'],_0x13785e[_0x7fc9('0x3a')]));if(_0x2043f7['query']['filter']){_0x50f558['where']=_[_0x7fc9('0x44')](_0x50f558['where'],{'$or':_[_0x7fc9('0x34')](_0x50f558[_0x7fc9('0x3c')],function(_0x4c60c4){var _0x5ab7b1={};_0x5ab7b1[_0x4c60c4]={'$like':'%'+_0x2043f7[_0x7fc9('0x39')][_0x7fc9('0x5f')]+'%'};return _0x5ab7b1;})});}_0x50f558=_[_0x7fc9('0x44')]({},_0x50f558,_0x2043f7['options']);return _0x21b0c7[_0x7fc9('0x66')](_0x50f558);}})[_0x7fc9('0x2a')](function(_0x1ffc60){if(_0x1ffc60){_0x2d0183=_0x1ffc60[_0x7fc9('0x5e')];if(!_0x2043f7['query'][_0x7fc9('0x3e')](_0x7fc9('0x3f'))){_0x50f558[_0x7fc9('0x22')]=qs[_0x7fc9('0x22')](_0x2043f7[_0x7fc9('0x39')][_0x7fc9('0x22')]);_0x50f558[_0x7fc9('0x23')]=qs['offset'](_0x2043f7[_0x7fc9('0x39')][_0x7fc9('0x23')]);}return _0x21b0c7[_0x7fc9('0x66')](_0x50f558);}})[_0x7fc9('0x2a')](function(_0x288704){if(_0x288704){return _0x288704?{'count':_0x2d0183,'rows':_0x288704}:null;}})['then'](respondWithResult(_0x409ea1,null))[_0x7fc9('0x4b')](handleError(_0x409ea1,null));};exports[_0x7fc9('0x68')]=function(_0x449324,_0x513969,_0x21fefe){var _0x33c2d7=_0x449324['body'][_0x7fc9('0x69')];return db['Team'][_0x7fc9('0x49')]({'where':{'id':_0x33c2d7},'attributes':['id'],'include':[{'model':db[_0x7fc9('0x6a')],'as':_0x7fc9('0x6b'),'attributes':['id','name',_0x7fc9('0x6c'),_0x7fc9('0x6d'),_0x7fc9('0x6e')],'raw':!![]}]})['then'](function(_0x2d9eba){if(_0x2d9eba){var _0x4054f6=_['flatMap'](_0x2d9eba,function(_0x38297d){var _0x1899b4=_0x38297d['get']({'plain':!![]});return _0x1899b4['Agents'];});return db[_0x7fc9('0x35')][_0x7fc9('0x51')]({'where':{'id':_0x449324['params']['id']}})[_0x7fc9('0x2a')](function(_0x144a59){return db[_0x7fc9('0x6f')][_0x7fc9('0x70')](function(_0x200837){return _0x144a59[_0x7fc9('0x68')](_0x33c2d7,{'transaction':_0x200837})[_0x7fc9('0x2a')](function(){return BPromise[_0x7fc9('0x71')](_0x4054f6,function(_0x51a088){return db[_0x7fc9('0x5d')][_0x7fc9('0x72')]({'where':{'UserId':_0x51a088['id'],'WhatsappQueueId':_0x449324[_0x7fc9('0x4d')]['id']},'transaction':_0x200837});});})[_0x7fc9('0x2a')](function(){_0x4054f6[_0x7fc9('0x73')](function(_0x13a2fc){socket[_0x7fc9('0x74')](_0x7fc9('0x75'),{'UserId':_0x13a2fc['id'],'WhatsappQueueId':_0x144a59['id']});});});});});}})[_0x7fc9('0x2a')](respondWithStatusCode(_0x513969,null))[_0x7fc9('0x4b')](handleError(_0x513969,null));};exports[_0x7fc9('0x76')]=function(_0x4caf3b,_0x2a1b50,_0x369d7b){return db[_0x7fc9('0x67')][_0x7fc9('0x49')]({'where':{'id':_0x4caf3b[_0x7fc9('0x39')][_0x7fc9('0x69')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x7fc9('0x2a')](handleEntityNotFound(_0x2a1b50,null))[_0x7fc9('0x2a')](function(_0x35a2d2){var _0x4da1f7=_['map'](_0x35a2d2,'id');var _0x28d3ea=[];var _0x140036=[];var _0xb72619=squel['select']();_0xb72619[_0x7fc9('0x77')](_0x7fc9('0x78'))['from'](_0x7fc9('0x79'),'tq')[_0x7fc9('0x7a')](_0x7fc9('0x7b'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x7fc9('0x42')](_0x7fc9('0x7c'),_0x4caf3b[_0x7fc9('0x4d')]['id']);for(var _0x38ed3b=0x0;_0x38ed3b<_0x35a2d2[_0x7fc9('0x5e')];_0x38ed3b+=0x1){let _0x164d6f=_0x35a2d2[_0x38ed3b];for(var _0x1aaf97=0x0;_0x1aaf97<_0x164d6f[_0x7fc9('0x6b')][_0x7fc9('0x5e')];_0x1aaf97+=0x1){let _0x162041=_0x164d6f['Agents'][_0x1aaf97];var _0x31880d=_0xb72619[_0x7fc9('0x7d')]();_0x31880d[_0x7fc9('0x42')](_0x7fc9('0x7e'),_0x162041['id']);_0x140036[_0x7fc9('0x7f')](db['sequelize'][_0x7fc9('0x39')](_0x31880d['toString'](),{'type':db[_0x7fc9('0x6f')][_0x7fc9('0x80')]['SELECT']})[_0x7fc9('0x2a')](function(_0x44f434){if(_0x44f434[_0x7fc9('0x5e')]===0x1){return _0x162041['id'];}else{var _0x3492a3=_[_0x7fc9('0x81')](_[_0x7fc9('0x34')](_0x44f434,_0x7fc9('0x82')),function(_0x4c0b68){return _[_0x7fc9('0x83')](_0x4da1f7,_0x4c0b68);});if(_0x3492a3){return _0x162041['id'];}}}));}}return BPromise[_0x7fc9('0x84')](_0x140036)[_0x7fc9('0x2a')](function(_0x5e337c){_0x28d3ea=_(_0x28d3ea)['union'](_0x5e337c)['compact']()[_0x7fc9('0x85')]();return db[_0x7fc9('0x35')][_0x7fc9('0x51')]({'where':{'id':_0x4caf3b[_0x7fc9('0x4d')]['id']}})[_0x7fc9('0x2a')](function(_0x42f797){return db[_0x7fc9('0x6f')][_0x7fc9('0x70')](function(_0x5b3a7d){return _0x42f797['removeTeams'](_0x4caf3b['query']['ids'],{'transaction':_0x5b3a7d})[_0x7fc9('0x2a')](function(){if(!_[_0x7fc9('0x86')](_0x28d3ea)){return _0x42f797[_0x7fc9('0x87')](_0x28d3ea,{'transaction':_0x5b3a7d});}})[_0x7fc9('0x2a')](function(){_0x28d3ea['forEach'](function(_0x48544b){socket[_0x7fc9('0x74')](_0x7fc9('0x88'),{'UserId':_0x48544b,'WhatsappQueueId':_0x42f797['id']});});});});});});})[_0x7fc9('0x2a')](respondWithStatusCode(_0x2a1b50,null))[_0x7fc9('0x4b')](handleError(_0x2a1b50,null));};exports[_0x7fc9('0x89')]=function(_0x53c318,_0x5cffd4,_0x2d45da){return db[_0x7fc9('0x35')][_0x7fc9('0x51')]({'where':{'id':_0x53c318[_0x7fc9('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5cffd4,null))[_0x7fc9('0x2a')](function(_0x24bf60){if(_0x24bf60){return _0x24bf60['addAgents'](_0x53c318[_0x7fc9('0x53')][_0x7fc9('0x69')],_[_0x7fc9('0x8a')](_0x53c318[_0x7fc9('0x53')],[_0x7fc9('0x69'),'id'])||{})[_0x7fc9('0x8b')](function(_0x15b3d8){for(var _0x4eade7=0x0;_0x4eade7<_0x53c318[_0x7fc9('0x53')][_0x7fc9('0x69')][_0x7fc9('0x5e')];_0x4eade7+=0x1){socket[_0x7fc9('0x74')]('userWhatsappQueue:save',{'UserId':Number(_0x53c318['body'][_0x7fc9('0x69')][_0x4eade7]),'WhatsappQueueId':Number(_0x53c318[_0x7fc9('0x4d')]['id'])});}return _0x15b3d8;});}})[_0x7fc9('0x2a')](respondWithResult(_0x5cffd4,null))[_0x7fc9('0x4b')](handleError(_0x5cffd4,null));};exports[_0x7fc9('0x87')]=function(_0x212569,_0x21586a,_0x1e84cc){return db[_0x7fc9('0x35')][_0x7fc9('0x51')]({'where':{'id':_0x212569[_0x7fc9('0x4d')]['id']}})[_0x7fc9('0x2a')](handleEntityNotFound(_0x21586a,null))[_0x7fc9('0x2a')](function(_0x567a26){if(_0x567a26){return _0x567a26['removeAgents'](_0x212569[_0x7fc9('0x39')][_0x7fc9('0x69')])['then'](function(){if(_[_0x7fc9('0x8c')](_0x212569['query'][_0x7fc9('0x69')])){for(var _0x57a2a9=0x0;_0x57a2a9<_0x212569['query'][_0x7fc9('0x69')][_0x7fc9('0x5e')];_0x57a2a9+=0x1){socket[_0x7fc9('0x74')]('userWhatsappQueue:remove',{'UserId':Number(_0x212569[_0x7fc9('0x39')]['ids'][_0x57a2a9]),'WhatsappQueueId':Number(_0x212569[_0x7fc9('0x4d')]['id'])});}}else{socket[_0x7fc9('0x74')]('userWhatsappQueue:remove',{'UserId':Number(_0x212569[_0x7fc9('0x39')][_0x7fc9('0x69')]),'WhatsappQueueId':Number(_0x212569[_0x7fc9('0x4d')]['id'])});}});}})[_0x7fc9('0x2a')](respondWithStatusCode(_0x21586a,null))['catch'](handleError(_0x21586a,null));};exports['getAgents']=function(_0x295f35,_0x11e987,_0x3f1b8b){var _0x5e7c0e={};var _0x18848e={};var _0x2e06dc;var _0x5608d5;return db[_0x7fc9('0x35')]['findOne']({'where':{'id':_0x295f35['params']['id']}})['then'](handleEntityNotFound(_0x11e987,null))['then'](function(_0x3a7766){if(_0x3a7766){_0x2e06dc=_0x3a7766;_0x18848e['model']=_['keys'](db[_0x7fc9('0x6a')][_0x7fc9('0x4e')]);_0x18848e[_0x7fc9('0x39')]=_[_0x7fc9('0x4f')](_0x295f35[_0x7fc9('0x39')]);_0x18848e[_0x7fc9('0x3a')]=_[_0x7fc9('0x3b')](_0x18848e[_0x7fc9('0x38')],_0x18848e[_0x7fc9('0x39')]);_0x5e7c0e[_0x7fc9('0x3c')]=_['intersection'](_0x18848e[_0x7fc9('0x38')],qs[_0x7fc9('0x3d')](_0x295f35[_0x7fc9('0x39')][_0x7fc9('0x3d')]));_0x5e7c0e['attributes']=_0x5e7c0e[_0x7fc9('0x3c')]['length']?_0x5e7c0e['attributes']:_0x18848e[_0x7fc9('0x38')];_0x5e7c0e[_0x7fc9('0x40')]=qs['sort'](_0x295f35[_0x7fc9('0x39')]['sort']);_0x5e7c0e[_0x7fc9('0x42')]=qs[_0x7fc9('0x3a')](_[_0x7fc9('0x43')](_0x295f35['query'],_0x18848e['filters']));if(_0x295f35['query']['filter']){_0x5e7c0e[_0x7fc9('0x42')]=_['merge'](_0x5e7c0e['where'],{'$or':_[_0x7fc9('0x34')](_0x5e7c0e[_0x7fc9('0x3c')],function(_0x551310){var _0x285c14={};_0x285c14[_0x551310]={'$like':'%'+_0x295f35[_0x7fc9('0x39')][_0x7fc9('0x5f')]+'%'};return _0x285c14;})});}_0x5e7c0e=_['merge']({},_0x5e7c0e,_0x295f35['options']);return _0x2e06dc[_0x7fc9('0x8d')](_0x5e7c0e);}})['then'](function(_0x3d4031){if(_0x3d4031){_0x5608d5=_0x3d4031[_0x7fc9('0x5e')];if(!_0x295f35[_0x7fc9('0x39')]['hasOwnProperty']('nolimit')){_0x5e7c0e[_0x7fc9('0x22')]=qs['limit'](_0x295f35['query']['limit']);_0x5e7c0e[_0x7fc9('0x23')]=qs['offset'](_0x295f35['query']['offset']);}return _0x2e06dc[_0x7fc9('0x8d')](_0x5e7c0e);}})[_0x7fc9('0x2a')](function(_0x5e72b9){if(_0x5e72b9){return _0x5e72b9?{'count':_0x5608d5,'rows':_0x5e72b9}:null;}})['then'](respondWithResult(_0x11e987,null))[_0x7fc9('0x4b')](handleError(_0x11e987,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 43e98ab..54a6545 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 _0x7390=['events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x7390,0x1a4));var _0x0739=function(_0x51f95d,_0x4888e9){_0x51f95d=_0x51f95d-0x0;var _0x341612=_0x7390[_0x51f95d];return _0x341612;};'use strict';var EventEmitter=require(_0x0739('0x0'));var WhatsappQueue=require(_0x0739('0x1'))['db'][_0x0739('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x0739('0x3')](0x0);var events={'afterCreate':_0x0739('0x4'),'afterUpdate':_0x0739('0x5'),'afterDestroy':_0x0739('0x6')};function emitEvent(_0x10da3a){return function(_0x2d5997,_0x39a4ad,_0x2c15b9){WhatsappQueueEvents[_0x0739('0x7')](_0x10da3a+':'+_0x2d5997['id'],_0x2d5997);WhatsappQueueEvents['emit'](_0x10da3a,_0x2d5997);_0x2c15b9(null);};}for(var e in events){if(events[_0x0739('0x8')](e)){var event=events[e];WhatsappQueue[_0x0739('0x9')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0xa998=['update','emit','hook','exports','events','../../mysqldb','WhatsappQueue','save'];(function(_0xe175a1,_0x5a5399){var _0x419b49=function(_0x5a166a){while(--_0x5a166a){_0xe175a1['push'](_0xe175a1['shift']());}};_0x419b49(++_0x5a5399);}(_0xa998,0x174));var _0x8a99=function(_0x16e559,_0x431f9e){_0x16e559=_0x16e559-0x0;var _0x885cd5=_0xa998[_0x16e559];return _0x885cd5;};'use strict';var EventEmitter=require(_0x8a99('0x0'));var WhatsappQueue=require(_0x8a99('0x1'))['db'][_0x8a99('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8a99('0x3'),'afterUpdate':_0x8a99('0x4'),'afterDestroy':'remove'};function emitEvent(_0x28ce73){return function(_0x47d593,_0x11e043,_0x1acbbc){WhatsappQueueEvents[_0x8a99('0x5')](_0x28ce73+':'+_0x47d593['id'],_0x47d593);WhatsappQueueEvents['emit'](_0x28ce73,_0x47d593);_0x1acbbc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x8a99('0x6')](e,emitEvent(event));}}module[_0x8a99('0x7')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index d8edaa2..1f1d0c1 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 _0x3178=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./whatsappQueue.attributes','WhatsappQueue','whatsapp_queues'];(function(_0x29ac1a,_0x5019af){var _0xf2cc33=function(_0x3e700d){while(--_0x3e700d){_0x29ac1a['push'](_0x29ac1a['shift']());}};_0xf2cc33(++_0x5019af);}(_0x3178,0xfd));var _0x8317=function(_0x1328fe,_0x48f346){_0x1328fe=_0x1328fe-0x0;var _0x5b36dd=_0x3178[_0x1328fe];return _0x5b36dd;};'use strict';var _=require(_0x8317('0x0'));var util=require(_0x8317('0x1'));var logger=require(_0x8317('0x2'))(_0x8317('0x3'));var moment=require(_0x8317('0x4'));var BPromise=require(_0x8317('0x5'));var rp=require(_0x8317('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8317('0x7'));var config=require('../../config/environment');var attributes=require(_0x8317('0x8'));module['exports']=function(_0x1478b2,_0x48cb9f){return _0x1478b2['define'](_0x8317('0x9'),attributes,{'tableName':_0x8317('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2fd0=['define','WhatsappQueue','whatsapp_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports'];(function(_0x560cfc,_0x2c21b0){var _0x52ea41=function(_0x48824f){while(--_0x48824f){_0x560cfc['push'](_0x560cfc['shift']());}};_0x52ea41(++_0x2c21b0);}(_0x2fd0,0x18b));var _0x02fd=function(_0x50bcf4,_0x1c23cf){_0x50bcf4=_0x50bcf4-0x0;var _0xd99f7=_0x2fd0[_0x50bcf4];return _0xd99f7;};'use strict';var _=require('lodash');var util=require(_0x02fd('0x0'));var logger=require(_0x02fd('0x1'))(_0x02fd('0x2'));var moment=require(_0x02fd('0x3'));var BPromise=require(_0x02fd('0x4'));var rp=require(_0x02fd('0x5'));var fs=require('fs');var path=require(_0x02fd('0x6'));var rimraf=require(_0x02fd('0x7'));var config=require(_0x02fd('0x8'));var attributes=require(_0x02fd('0x9'));module[_0x02fd('0xa')]=function(_0xcbd99f,_0x4c09c5){return _0xcbd99f[_0x02fd('0xb')](_0x02fd('0xc'),attributes,{'tableName':_0x02fd('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 9a19582..5569522 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 _0xbee2=['register','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetWhatsappQueue','WhatsappQueue','options','raw','where','limit','map','include','model','attributes','find','ShowWhatsappQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','./whatsappQueue.socket'];(function(_0x3e78e3,_0x204fff){var _0x2d61fe=function(_0x28efc3){while(--_0x28efc3){_0x3e78e3['push'](_0x3e78e3['shift']());}};_0x2d61fe(++_0x204fff);}(_0xbee2,0x138));var _0x2bee=function(_0x497948,_0x4ca60c){_0x497948=_0x497948-0x0;var _0x39bb36=_0xbee2[_0x497948];return _0x39bb36;};'use strict';var _=require(_0x2bee('0x0'));var util=require(_0x2bee('0x1'));var moment=require(_0x2bee('0x2'));var BPromise=require('bluebird');var rs=require(_0x2bee('0x3'));var fs=require('fs');var Redis=require(_0x2bee('0x4'));var db=require(_0x2bee('0x5'))['db'];var utils=require(_0x2bee('0x6'));var logger=require(_0x2bee('0x7'))(_0x2bee('0x8'));var config=require('../../config/environment');var jayson=require(_0x2bee('0x9'));var client=jayson[_0x2bee('0xa')][_0x2bee('0xb')]({'port':0x232a});config['redis']=_[_0x2bee('0xc')](config[_0x2bee('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x2bee('0xe'))(new Redis(config[_0x2bee('0xd')]));require(_0x2bee('0xf'))[_0x2bee('0x10')](socket);function respondWithRpcPromise(_0x28aefc,_0x5f2504,_0x5ad973){return new BPromise(function(_0xa20dbe,_0x47df7b){return client['request'](_0x28aefc,_0x5ad973)[_0x2bee('0x11')](function(_0x30bdb4){logger['info'](_0x2bee('0x12'),_0x5f2504,_0x2bee('0x13'));logger[_0x2bee('0x14')](_0x2bee('0x15'),_0x5f2504,'request\x20sent',JSON[_0x2bee('0x16')](_0x30bdb4));if(_0x30bdb4['error']){if(_0x30bdb4[_0x2bee('0x17')][_0x2bee('0x18')]===0x1f4){logger[_0x2bee('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x5f2504,_0x30bdb4[_0x2bee('0x17')][_0x2bee('0x19')]);return _0x47df7b(_0x30bdb4[_0x2bee('0x17')][_0x2bee('0x19')]);}logger[_0x2bee('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x5f2504,_0x30bdb4[_0x2bee('0x17')][_0x2bee('0x19')]);return _0xa20dbe(_0x30bdb4[_0x2bee('0x17')]['message']);}else{logger[_0x2bee('0x1a')](_0x2bee('0x12'),_0x5f2504,_0x2bee('0x13'));_0xa20dbe(_0x30bdb4[_0x2bee('0x1b')]['message']);}})[_0x2bee('0x1c')](function(_0x24e513){logger[_0x2bee('0x17')](_0x2bee('0x12'),_0x5f2504,_0x24e513);_0x47df7b(_0x24e513);});});}exports[_0x2bee('0x1d')]=function(_0xe92eed){var _0x231fae=this;return new Promise(function(_0x735c76,_0x1f145e){return db[_0x2bee('0x1e')]['findAll']({'raw':_0xe92eed[_0x2bee('0x1f')]?_0xe92eed[_0x2bee('0x1f')][_0x2bee('0x20')]===undefined?!![]:![]:!![],'where':_0xe92eed[_0x2bee('0x1f')]?_0xe92eed['options'][_0x2bee('0x21')]||null:null,'attributes':_0xe92eed[_0x2bee('0x1f')]?_0xe92eed[_0x2bee('0x1f')]['attributes']||null:null,'limit':_0xe92eed[_0x2bee('0x1f')]?_0xe92eed['options'][_0x2bee('0x22')]||null:null,'include':_0xe92eed[_0x2bee('0x1f')]?_0xe92eed[_0x2bee('0x1f')]['include']?_[_0x2bee('0x23')](_0xe92eed['options'][_0x2bee('0x24')],function(_0x1c44d3){return{'model':db[_0x1c44d3[_0x2bee('0x25')]],'as':_0x1c44d3['as'],'attributes':_0x1c44d3[_0x2bee('0x26')],'include':_0x1c44d3[_0x2bee('0x24')]?_[_0x2bee('0x23')](_0x1c44d3[_0x2bee('0x24')],function(_0x927561){return{'model':db[_0x927561[_0x2bee('0x25')]],'as':_0x927561['as'],'attributes':_0x927561[_0x2bee('0x26')],'include':_0x927561[_0x2bee('0x24')]?_['map'](_0x927561['include'],function(_0x344e8a){return{'model':db[_0x344e8a['model']],'as':_0x344e8a['as'],'attributes':_0x344e8a['attributes']};}):[]};}):[]};}):[]:[]})[_0x2bee('0x11')](function(_0x475cb2){logger['info'](_0x2bee('0x1d'),_0xe92eed);logger[_0x2bee('0x14')](_0x2bee('0x1d'),_0xe92eed,JSON[_0x2bee('0x16')](_0x475cb2));_0x735c76(_0x475cb2);})[_0x2bee('0x1c')](function(_0x3f202c){logger['error'](_0x2bee('0x1d'),_0x3f202c[_0x2bee('0x19')],_0xe92eed);_0x1f145e(_0x231fae[_0x2bee('0x17')](0x1f4,_0x3f202c[_0x2bee('0x19')]));});});};exports['ShowWhatsappQueue']=function(_0x259be2){var _0x234861=this;return new Promise(function(_0x464967,_0x3724dd){return db[_0x2bee('0x1e')][_0x2bee('0x27')]({'raw':_0x259be2[_0x2bee('0x1f')]?_0x259be2['options'][_0x2bee('0x20')]===undefined?!![]:![]:!![],'where':_0x259be2[_0x2bee('0x1f')]?_0x259be2['options']['where']||null:null,'attributes':_0x259be2[_0x2bee('0x1f')]?_0x259be2[_0x2bee('0x1f')][_0x2bee('0x26')]||null:null,'include':_0x259be2[_0x2bee('0x1f')]?_0x259be2[_0x2bee('0x1f')]['include']?_[_0x2bee('0x23')](_0x259be2['options']['include'],function(_0x51322a){return{'model':db[_0x51322a['model']],'as':_0x51322a['as'],'attributes':_0x51322a[_0x2bee('0x26')],'include':_0x51322a[_0x2bee('0x24')]?_[_0x2bee('0x23')](_0x51322a[_0x2bee('0x24')],function(_0x1cffa4){return{'model':db[_0x1cffa4['model']],'as':_0x1cffa4['as'],'attributes':_0x1cffa4[_0x2bee('0x26')],'include':_0x1cffa4['include']?_[_0x2bee('0x23')](_0x1cffa4[_0x2bee('0x24')],function(_0xe6b380){return{'model':db[_0xe6b380[_0x2bee('0x25')]],'as':_0xe6b380['as'],'attributes':_0xe6b380['attributes']};}):[]};}):[]};}):[]:[]})[_0x2bee('0x11')](function(_0x4331b3){logger[_0x2bee('0x1a')]('ShowWhatsappQueue',_0x259be2);logger[_0x2bee('0x14')](_0x2bee('0x28'),_0x259be2,JSON['stringify'](_0x4331b3));_0x464967(_0x4331b3);})[_0x2bee('0x1c')](function(_0x5d7728){logger[_0x2bee('0x17')](_0x2bee('0x28'),_0x5d7728[_0x2bee('0x19')],_0x259be2);_0x3724dd(_0x234861['error'](0x1f4,_0x5d7728['message']));});});}; \ No newline at end of file +var _0x79cd=['localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','GetWhatsappQueue','WhatsappQueue','options','where','attributes','limit','model','include','map','stringify','catch','ShowWhatsappQueue','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis'];(function(_0x207f3d,_0x1d3afe){var _0x5798a5=function(_0x55e9aa){while(--_0x55e9aa){_0x207f3d['push'](_0x207f3d['shift']());}};_0x5798a5(++_0x1d3afe);}(_0x79cd,0xe9));var _0xd79c=function(_0x303c59,_0x5f20f5){_0x303c59=_0x303c59-0x0;var _0xd5d52b=_0x79cd[_0x303c59];return _0xd5d52b;};'use strict';var _=require(_0xd79c('0x0'));var util=require(_0xd79c('0x1'));var moment=require(_0xd79c('0x2'));var BPromise=require(_0xd79c('0x3'));var rs=require(_0xd79c('0x4'));var fs=require('fs');var Redis=require(_0xd79c('0x5'));var db=require(_0xd79c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd79c('0x7'))('rpc');var config=require(_0xd79c('0x8'));var jayson=require(_0xd79c('0x9'));var client=jayson[_0xd79c('0xa')][_0xd79c('0xb')]({'port':0x232a});config[_0xd79c('0xc')]=_['defaults'](config[_0xd79c('0xc')],{'host':_0xd79c('0xd'),'port':0x18eb});var socket=require(_0xd79c('0xe'))(new Redis(config[_0xd79c('0xc')]));require(_0xd79c('0xf'))[_0xd79c('0x10')](socket);function respondWithRpcPromise(_0x4dad48,_0x342764,_0x32a20f){return new BPromise(function(_0xc4c1cf,_0x4c08bf){return client[_0xd79c('0x11')](_0x4dad48,_0x32a20f)[_0xd79c('0x12')](function(_0xba0dd9){logger[_0xd79c('0x13')](_0xd79c('0x14'),_0x342764,_0xd79c('0x15'));logger[_0xd79c('0x16')](_0xd79c('0x17'),_0x342764,_0xd79c('0x15'),JSON['stringify'](_0xba0dd9));if(_0xba0dd9[_0xd79c('0x18')]){if(_0xba0dd9[_0xd79c('0x18')][_0xd79c('0x19')]===0x1f4){logger[_0xd79c('0x18')](_0xd79c('0x14'),_0x342764,_0xba0dd9[_0xd79c('0x18')]['message']);return _0x4c08bf(_0xba0dd9[_0xd79c('0x18')]['message']);}logger['error'](_0xd79c('0x14'),_0x342764,_0xba0dd9[_0xd79c('0x18')]['message']);return _0xc4c1cf(_0xba0dd9[_0xd79c('0x18')][_0xd79c('0x1a')]);}else{logger['info'](_0xd79c('0x14'),_0x342764,_0xd79c('0x15'));_0xc4c1cf(_0xba0dd9['result'][_0xd79c('0x1a')]);}})['catch'](function(_0x5212bf){logger['error'](_0xd79c('0x14'),_0x342764,_0x5212bf);_0x4c08bf(_0x5212bf);});});}exports[_0xd79c('0x1b')]=function(_0x399ab2){var _0x4956fd=this;return new Promise(function(_0x2c297f,_0x8a719f){return db[_0xd79c('0x1c')]['findAll']({'raw':_0x399ab2['options']?_0x399ab2[_0xd79c('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x399ab2[_0xd79c('0x1d')]?_0x399ab2[_0xd79c('0x1d')][_0xd79c('0x1e')]||null:null,'attributes':_0x399ab2[_0xd79c('0x1d')]?_0x399ab2[_0xd79c('0x1d')][_0xd79c('0x1f')]||null:null,'limit':_0x399ab2[_0xd79c('0x1d')]?_0x399ab2[_0xd79c('0x1d')][_0xd79c('0x20')]||null:null,'include':_0x399ab2[_0xd79c('0x1d')]?_0x399ab2['options']['include']?_['map'](_0x399ab2['options']['include'],function(_0xd140b5){return{'model':db[_0xd140b5[_0xd79c('0x21')]],'as':_0xd140b5['as'],'attributes':_0xd140b5[_0xd79c('0x1f')],'include':_0xd140b5[_0xd79c('0x22')]?_[_0xd79c('0x23')](_0xd140b5['include'],function(_0x8aff9d){return{'model':db[_0x8aff9d['model']],'as':_0x8aff9d['as'],'attributes':_0x8aff9d['attributes'],'include':_0x8aff9d[_0xd79c('0x22')]?_[_0xd79c('0x23')](_0x8aff9d[_0xd79c('0x22')],function(_0x239eea){return{'model':db[_0x239eea['model']],'as':_0x239eea['as'],'attributes':_0x239eea[_0xd79c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd79c('0x12')](function(_0x52ff2c){logger['info'](_0xd79c('0x1b'),_0x399ab2);logger[_0xd79c('0x16')]('GetWhatsappQueue',_0x399ab2,JSON[_0xd79c('0x24')](_0x52ff2c));_0x2c297f(_0x52ff2c);})[_0xd79c('0x25')](function(_0x410cbc){logger[_0xd79c('0x18')]('GetWhatsappQueue',_0x410cbc[_0xd79c('0x1a')],_0x399ab2);_0x8a719f(_0x4956fd[_0xd79c('0x18')](0x1f4,_0x410cbc[_0xd79c('0x1a')]));});});};exports[_0xd79c('0x26')]=function(_0x4cf5f3){var _0x372915=this;return new Promise(function(_0x469cd6,_0x4f785f){return db[_0xd79c('0x1c')][_0xd79c('0x27')]({'raw':_0x4cf5f3[_0xd79c('0x1d')]?_0x4cf5f3[_0xd79c('0x1d')][_0xd79c('0x28')]===undefined?!![]:![]:!![],'where':_0x4cf5f3['options']?_0x4cf5f3['options'][_0xd79c('0x1e')]||null:null,'attributes':_0x4cf5f3[_0xd79c('0x1d')]?_0x4cf5f3[_0xd79c('0x1d')][_0xd79c('0x1f')]||null:null,'include':_0x4cf5f3[_0xd79c('0x1d')]?_0x4cf5f3[_0xd79c('0x1d')]['include']?_[_0xd79c('0x23')](_0x4cf5f3[_0xd79c('0x1d')][_0xd79c('0x22')],function(_0x344275){return{'model':db[_0x344275['model']],'as':_0x344275['as'],'attributes':_0x344275[_0xd79c('0x1f')],'include':_0x344275[_0xd79c('0x22')]?_[_0xd79c('0x23')](_0x344275['include'],function(_0x3f3a4){return{'model':db[_0x3f3a4[_0xd79c('0x21')]],'as':_0x3f3a4['as'],'attributes':_0x3f3a4[_0xd79c('0x1f')],'include':_0x3f3a4[_0xd79c('0x22')]?_[_0xd79c('0x23')](_0x3f3a4[_0xd79c('0x22')],function(_0x247a1f){return{'model':db[_0x247a1f[_0xd79c('0x21')]],'as':_0x247a1f['as'],'attributes':_0x247a1f[_0xd79c('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x595188){logger['info']('ShowWhatsappQueue',_0x4cf5f3);logger[_0xd79c('0x16')](_0xd79c('0x26'),_0x4cf5f3,JSON[_0xd79c('0x24')](_0x595188));_0x469cd6(_0x595188);})[_0xd79c('0x25')](function(_0x5f2ab0){logger[_0xd79c('0x18')]('ShowWhatsappQueue',_0x5f2ab0[_0xd79c('0x1a')],_0x4cf5f3);_0x4f785f(_0x372915[_0xd79c('0x18')](0x1f4,_0x5f2ab0['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index bea04eb..b5b9259 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 _0x87c9=['./whatsappQueue.events','save','remove','update','emit','register'];(function(_0x30b159,_0x3fbb50){var _0x23c3f9=function(_0xa21305){while(--_0xa21305){_0x30b159['push'](_0x30b159['shift']());}};_0x23c3f9(++_0x3fbb50);}(_0x87c9,0x10e));var _0x987c=function(_0x124efd,_0x16e5cb){_0x124efd=_0x124efd-0x0;var _0x2a77ef=_0x87c9[_0x124efd];return _0x2a77ef;};'use strict';var WhatsappQueueEvents=require(_0x987c('0x0'));var events=[_0x987c('0x1'),_0x987c('0x2'),_0x987c('0x3')];function createListener(_0x38d5dd,_0x67699e){return function(_0xe06e02){_0x67699e[_0x987c('0x4')](_0x38d5dd,_0xe06e02);};}function removeListener(_0x2ddf6f,_0x3f72c2){return function(){WhatsappQueueEvents['removeListener'](_0x2ddf6f,_0x3f72c2);};}exports[_0x987c('0x5')]=function(_0x1d6478){for(var _0x43cede=0x0,_0x5b128e=events['length'];_0x43cede<_0x5b128e;_0x43cede++){var _0x2cdff2=events[_0x43cede];var _0x3c15f2=createListener('whatsappQueue:'+_0x2cdff2,_0x1d6478);WhatsappQueueEvents['on'](_0x2cdff2,_0x3c15f2);}}; \ No newline at end of file +var _0x593f=['length','./whatsappQueue.events','remove','update','emit','removeListener'];(function(_0x5dea91,_0x152c3f){var _0x5ac3ba=function(_0xe30828){while(--_0xe30828){_0x5dea91['push'](_0x5dea91['shift']());}};_0x5ac3ba(++_0x152c3f);}(_0x593f,0x67));var _0xf593=function(_0x2984d0,_0x1a7211){_0x2984d0=_0x2984d0-0x0;var _0x2885f2=_0x593f[_0x2984d0];return _0x2885f2;};'use strict';var WhatsappQueueEvents=require(_0xf593('0x0'));var events=['save',_0xf593('0x1'),_0xf593('0x2')];function createListener(_0x37d578,_0x4e9ebb){return function(_0x206879){_0x4e9ebb[_0xf593('0x3')](_0x37d578,_0x206879);};}function removeListener(_0x46b78f,_0x3429be){return function(){WhatsappQueueEvents[_0xf593('0x4')](_0x46b78f,_0x3429be);};}exports['register']=function(_0x4b70e9){for(var _0x271b3f=0x0,_0x38a0f3=events[_0xf593('0x5')];_0x271b3f<_0x38a0f3;_0x271b3f++){var _0x449567=events[_0x271b3f];var _0x70b676=createListener('whatsappQueue:'+_0x449567,_0x4b70e9);WhatsappQueueEvents['on'](_0x449567,_0x70b676);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 8621f94..e138bc1 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 _0x3e22=['multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x3e22,0x114));var _0x23e2=function(_0x53d05e,_0x3ec9c6){_0x53d05e=_0x53d05e-0x0;var _0x106788=_0x3e22[_0x53d05e];return _0x106788;};'use strict';var multer=require(_0x23e2('0x0'));var util=require(_0x23e2('0x1'));var path=require(_0x23e2('0x2'));var timeout=require(_0x23e2('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x23e2('0x4'));var auth=require(_0x23e2('0x5'));var interaction=require(_0x23e2('0x6'));var config=require(_0x23e2('0x7'));var controller=require(_0x23e2('0x8'));router[_0x23e2('0x9')]('/',auth['isAuthenticated'](),controller[_0x23e2('0xa')]);router[_0x23e2('0x9')](_0x23e2('0xb'),auth[_0x23e2('0xc')](),controller[_0x23e2('0xd')]);router[_0x23e2('0x9')](_0x23e2('0xe'),auth[_0x23e2('0xc')](),controller[_0x23e2('0xf')]);router[_0x23e2('0x10')]('/',auth[_0x23e2('0xc')](),controller[_0x23e2('0x11')]);router[_0x23e2('0x12')](_0x23e2('0xe'),auth[_0x23e2('0xc')](),controller[_0x23e2('0x13')]);router[_0x23e2('0x14')](_0x23e2('0xe'),auth[_0x23e2('0xc')](),controller[_0x23e2('0x15')]);module[_0x23e2('0x16')]=router; \ No newline at end of file +var _0xe6a3=['exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','get','index','/describe','isAuthenticated','show','post','put','/:id','update','destroy'];(function(_0x2ca9d4,_0x51d5c6){var _0x258956=function(_0x47a0e5){while(--_0x47a0e5){_0x2ca9d4['push'](_0x2ca9d4['shift']());}};_0x258956(++_0x51d5c6);}(_0xe6a3,0x11e));var _0x3e6a=function(_0x2de020,_0x252df0){_0x2de020=_0x2de020-0x0;var _0x182b7c=_0xe6a3[_0x2de020];return _0x182b7c;};'use strict';var multer=require(_0x3e6a('0x0'));var util=require(_0x3e6a('0x1'));var path=require(_0x3e6a('0x2'));var timeout=require(_0x3e6a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3e6a('0x4'));var auth=require(_0x3e6a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3e6a('0x6'));var controller=require(_0x3e6a('0x7'));router[_0x3e6a('0x8')]('/',auth['isAuthenticated'](),controller[_0x3e6a('0x9')]);router['get'](_0x3e6a('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x3e6a('0x8')]('/:id',auth[_0x3e6a('0xb')](),controller[_0x3e6a('0xc')]);router[_0x3e6a('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3e6a('0xe')](_0x3e6a('0xf'),auth[_0x3e6a('0xb')](),controller[_0x3e6a('0x10')]);router['delete'](_0x3e6a('0xf'),auth['isAuthenticated'](),controller[_0x3e6a('0x11')]);module[_0x3e6a('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 3d5be2f..ada3105 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(_0x3fae0d,_0x2df259){var _0x516b5b=function(_0x4c55df){while(--_0x4c55df){_0x3fae0d['push'](_0x3fae0d['shift']());}};_0x516b5b(++_0x2df259);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x785436,_0x405fba){var _0x9a142c=function(_0x34b07a){while(--_0x34b07a){_0x785436['push'](_0x785436['shift']());}};_0x9a142c(++_0x405fba);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 17a3d93..4ac0d3e 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 _0x3423=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','catch','show','params','keys','include','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x558c8c,_0x3e70ae){var _0x115da3=function(_0x1b7ed9){while(--_0x1b7ed9){_0x558c8c['push'](_0x558c8c['shift']());}};_0x115da3(++_0x3e70ae);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3342('0x0'));var jsonpatch=require(_0x3342('0x1'));var rp=require(_0x3342('0x2'));var moment=require(_0x3342('0x3'));var BPromise=require(_0x3342('0x4'));var Mustache=require(_0x3342('0x5'));var util=require(_0x3342('0x6'));var path=require(_0x3342('0x7'));var sox=require(_0x3342('0x8'));var csv=require(_0x3342('0x9'));var ejs=require(_0x3342('0xa'));var fs=require('fs');var fs_extra=require(_0x3342('0xb'));var _=require(_0x3342('0xc'));var squel=require(_0x3342('0xd'));var crypto=require(_0x3342('0xe'));var jsforce=require(_0x3342('0xf'));var deskjs=require(_0x3342('0x10'));var toCsv=require(_0x3342('0x9'));var querystring=require(_0x3342('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3342('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3342('0x13'));var utils=require(_0x3342('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3342('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x716d80,_0x36e1f4){_0x36e1f4=_0x36e1f4||0xcc;return function(_0x592ba8){if(_0x592ba8){return _0x716d80[_0x3342('0x16')](_0x36e1f4);}return _0x716d80[_0x3342('0x17')](_0x36e1f4)[_0x3342('0x18')]();};}function respondWithResult(_0xe4689e,_0x61fcc0){_0x61fcc0=_0x61fcc0||0xc8;return function(_0x104077){if(_0x104077){return _0xe4689e[_0x3342('0x17')](_0x61fcc0)['json'](_0x104077);}};}function respondWithFilteredResult(_0x3e44f3,_0x19bd71){return function(_0x49afe3){if(_0x49afe3){var _0x40d609=typeof _0x19bd71[_0x3342('0x19')]==='undefined'&&typeof _0x19bd71['limit']===_0x3342('0x1a');var _0x143cf1=_0x49afe3[_0x3342('0x1b')];var _0x2075cb=_0x40d609?0x0:_0x19bd71[_0x3342('0x19')];var _0x156c24=_0x40d609?_0x49afe3[_0x3342('0x1b')]:_0x19bd71[_0x3342('0x19')]+_0x19bd71[_0x3342('0x1c')];var _0x4f4c2a;if(_0x156c24>=_0x143cf1){_0x156c24=_0x143cf1;_0x4f4c2a=0xc8;}else{_0x4f4c2a=0xce;}_0x3e44f3[_0x3342('0x17')](_0x4f4c2a);return _0x3e44f3[_0x3342('0x1d')](_0x3342('0x1e'),_0x2075cb+'-'+_0x156c24+'/'+_0x143cf1)['json'](_0x49afe3);}return null;};}function patchUpdates(_0x3cb86f){return function(_0x463324){try{jsonpatch['apply'](_0x463324,_0x3cb86f,!![]);}catch(_0xe774b7){return BPromise[_0x3342('0x1f')](_0xe774b7);}return _0x463324['save']();};}function saveUpdates(_0x4e1b19,_0x5a0658){return function(_0x3f271c){if(_0x3f271c){return _0x3f271c[_0x3342('0x20')](_0x4e1b19)[_0x3342('0x21')](function(_0x2dbad1){return _0x2dbad1;});}return null;};}function removeEntity(_0xd2b87d,_0x2925a2){return function(_0x26eb87){if(_0x26eb87){return _0x26eb87[_0x3342('0x22')]()['then'](function(){_0xd2b87d[_0x3342('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51cf45,_0x986ab0){return function(_0x52ba65){if(!_0x52ba65){_0x51cf45['sendStatus'](0x194);}return _0x52ba65;};}function handleError(_0x247ee4,_0x58f0f5){_0x58f0f5=_0x58f0f5||0x1f4;return function(_0x37df78){logger['error'](_0x37df78['stack']);if(_0x37df78['name']){delete _0x37df78[_0x3342('0x23')];}_0x247ee4[_0x3342('0x17')](_0x58f0f5)[_0x3342('0x24')](_0x37df78);};}exports['index']=function(_0xc275a1,_0x1275e2){var _0x1cc542={},_0x272a52={},_0x4fbfb7={'count':0x0,'rows':[]};var _0x27e25b=_[_0x3342('0x25')](db[_0x3342('0x26')][_0x3342('0x27')],function(_0xf82530){return{'name':_0xf82530[_0x3342('0x28')],'type':_0xf82530[_0x3342('0x29')]['key']};});_0x272a52[_0x3342('0x2a')]=_['map'](_0x27e25b,_0x3342('0x23'));_0x272a52[_0x3342('0x2b')]=_['keys'](_0xc275a1[_0x3342('0x2b')]);_0x272a52[_0x3342('0x2c')]=_[_0x3342('0x2d')](_0x272a52[_0x3342('0x2a')],_0x272a52['query']);_0x1cc542[_0x3342('0x2e')]=_[_0x3342('0x2d')](_0x272a52[_0x3342('0x2a')],qs[_0x3342('0x2f')](_0xc275a1[_0x3342('0x2b')][_0x3342('0x2f')]));_0x1cc542[_0x3342('0x2e')]=_0x1cc542[_0x3342('0x2e')][_0x3342('0x30')]?_0x1cc542[_0x3342('0x2e')]:_0x272a52[_0x3342('0x2a')];if(!_0xc275a1[_0x3342('0x2b')]['hasOwnProperty']('nolimit')){_0x1cc542[_0x3342('0x1c')]=qs['limit'](_0xc275a1[_0x3342('0x2b')][_0x3342('0x1c')]);_0x1cc542[_0x3342('0x19')]=qs[_0x3342('0x19')](_0xc275a1[_0x3342('0x2b')][_0x3342('0x19')]);}_0x1cc542[_0x3342('0x31')]=qs['sort'](_0xc275a1[_0x3342('0x2b')][_0x3342('0x32')]);_0x1cc542[_0x3342('0x33')]=qs[_0x3342('0x2c')](_[_0x3342('0x34')](_0xc275a1['query'],_0x272a52[_0x3342('0x2c')]),_0x27e25b);if(_0xc275a1['query'][_0x3342('0x35')]){_0x1cc542[_0x3342('0x33')]=_[_0x3342('0x36')](_0x1cc542[_0x3342('0x33')],{'$or':_['map'](_0x27e25b,function(_0x370cfa){if(_0x370cfa['type']!==_0x3342('0x37')){var _0x128657={};_0x128657[_0x370cfa[_0x3342('0x23')]]={'$like':'%'+_0xc275a1[_0x3342('0x2b')][_0x3342('0x35')]+'%'};return _0x128657;}})});}_0x1cc542=_[_0x3342('0x36')]({},_0x1cc542,_0xc275a1[_0x3342('0x38')]);var _0x52cdc0={'where':_0x1cc542[_0x3342('0x33')]};return db[_0x3342('0x26')]['count'](_0x52cdc0)[_0x3342('0x21')](function(_0x1f336c){_0x4fbfb7['count']=_0x1f336c;if(_0xc275a1[_0x3342('0x2b')][_0x3342('0x39')]){_0x1cc542['include']=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x1cc542);})[_0x3342('0x21')](function(_0x41e727){_0x4fbfb7['rows']=_0x41e727;return _0x4fbfb7;})[_0x3342('0x21')](respondWithFilteredResult(_0x1275e2,_0x1cc542))[_0x3342('0x3a')](handleError(_0x1275e2,null));};exports[_0x3342('0x3b')]=function(_0x17fd01,_0x126ee4){var _0x308363={'raw':!![],'where':{'id':_0x17fd01[_0x3342('0x3c')]['id']}},_0x34de7b={};_0x34de7b['model']=_['keys'](db[_0x3342('0x26')][_0x3342('0x27')]);_0x34de7b[_0x3342('0x2b')]=_[_0x3342('0x3d')](_0x17fd01[_0x3342('0x2b')]);_0x34de7b[_0x3342('0x2c')]=_['intersection'](_0x34de7b[_0x3342('0x2a')],_0x34de7b[_0x3342('0x2b')]);_0x308363[_0x3342('0x2e')]=_[_0x3342('0x2d')](_0x34de7b[_0x3342('0x2a')],qs[_0x3342('0x2f')](_0x17fd01['query'][_0x3342('0x2f')]));_0x308363['attributes']=_0x308363[_0x3342('0x2e')][_0x3342('0x30')]?_0x308363[_0x3342('0x2e')]:_0x34de7b[_0x3342('0x2a')];if(_0x17fd01['query'][_0x3342('0x39')]){_0x308363[_0x3342('0x3e')]=[{'all':!![]}];}_0x308363=_['merge']({},_0x308363,_0x17fd01[_0x3342('0x38')]);return db[_0x3342('0x26')][_0x3342('0x3f')](_0x308363)[_0x3342('0x21')](handleEntityNotFound(_0x126ee4,null))['then'](respondWithResult(_0x126ee4,null))[_0x3342('0x3a')](handleError(_0x126ee4,null));};exports[_0x3342('0x40')]=function(_0x56b465,_0x1fc491){return db['WhatsappQueueReport']['create'](_0x56b465[_0x3342('0x41')],{})[_0x3342('0x21')](respondWithResult(_0x1fc491,0xc9))[_0x3342('0x3a')](handleError(_0x1fc491,null));};exports[_0x3342('0x20')]=function(_0x23925e,_0x171387){if(_0x23925e[_0x3342('0x41')]['id']){delete _0x23925e['body']['id'];}return db['WhatsappQueueReport'][_0x3342('0x3f')]({'where':{'id':_0x23925e['params']['id']}})[_0x3342('0x21')](handleEntityNotFound(_0x171387,null))['then'](saveUpdates(_0x23925e['body'],null))['then'](respondWithResult(_0x171387,null))[_0x3342('0x3a')](handleError(_0x171387,null));};exports[_0x3342('0x22')]=function(_0x29ccb6,_0x186a2a){return db['WhatsappQueueReport'][_0x3342('0x3f')]({'where':{'id':_0x29ccb6[_0x3342('0x3c')]['id']}})['then'](handleEntityNotFound(_0x186a2a,null))[_0x3342('0x21')](removeEntity(_0x186a2a,null))[_0x3342('0x3a')](handleError(_0x186a2a,null));};exports[_0x3342('0x42')]=function(_0x4c0dc0,_0x189b68){return db[_0x3342('0x26')][_0x3342('0x42')]()[_0x3342('0x21')](respondWithResult(_0x189b68,null))[_0x3342('0x3a')](handleError(_0x189b68,null));}; \ No newline at end of file +var _0x236c=['model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','map','WhatsappQueueReport','fieldName','key','query','filters','intersection'];(function(_0x57f0e2,_0x7aab4c){var _0x4f4c35=function(_0x1b7409){while(--_0x1b7409){_0x57f0e2['push'](_0x57f0e2['shift']());}};_0x4f4c35(++_0x7aab4c);}(_0x236c,0x155));var _0xc236=function(_0x46906f,_0x2e0943){_0x46906f=_0x46906f-0x0;var _0x173c0c=_0x236c[_0x46906f];return _0x173c0c;};'use strict';var emlformat=require(_0xc236('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc236('0x1'));var jsonpatch=require(_0xc236('0x2'));var rp=require(_0xc236('0x3'));var moment=require(_0xc236('0x4'));var BPromise=require(_0xc236('0x5'));var Mustache=require('mustache');var util=require(_0xc236('0x6'));var path=require(_0xc236('0x7'));var sox=require(_0xc236('0x8'));var csv=require(_0xc236('0x9'));var ejs=require(_0xc236('0xa'));var fs=require('fs');var fs_extra=require(_0xc236('0xb'));var _=require('lodash');var squel=require(_0xc236('0xc'));var crypto=require(_0xc236('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc236('0xe'));var Papa=require('papaparse');var Redis=require(_0xc236('0xf'));var authService=require(_0xc236('0x10'));var qs=require(_0xc236('0x11'));var as=require(_0xc236('0x12'));var hardwareService=require(_0xc236('0x13'));var logger=require('../../config/logger')(_0xc236('0x14'));var utils=require(_0xc236('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc236('0x16'));var db=require(_0xc236('0x17'))['db'];function respondWithStatusCode(_0x5ee3a5,_0x5b9638){_0x5b9638=_0x5b9638||0xcc;return function(_0x5bce83){if(_0x5bce83){return _0x5ee3a5['sendStatus'](_0x5b9638);}return _0x5ee3a5[_0xc236('0x18')](_0x5b9638)[_0xc236('0x19')]();};}function respondWithResult(_0x2184c9,_0x71bce2){_0x71bce2=_0x71bce2||0xc8;return function(_0x5052db){if(_0x5052db){return _0x2184c9[_0xc236('0x18')](_0x71bce2)['json'](_0x5052db);}};}function respondWithFilteredResult(_0x5221bf,_0x9a65e8){return function(_0x32f2fd){if(_0x32f2fd){var _0x443a46=typeof _0x9a65e8[_0xc236('0x1a')]===_0xc236('0x1b')&&typeof _0x9a65e8['limit']==='undefined';var _0x57355b=_0x32f2fd[_0xc236('0x1c')];var _0x76f45=_0x443a46?0x0:_0x9a65e8[_0xc236('0x1a')];var _0x541a20=_0x443a46?_0x32f2fd[_0xc236('0x1c')]:_0x9a65e8['offset']+_0x9a65e8['limit'];var _0x1eafba;if(_0x541a20>=_0x57355b){_0x541a20=_0x57355b;_0x1eafba=0xc8;}else{_0x1eafba=0xce;}_0x5221bf[_0xc236('0x18')](_0x1eafba);return _0x5221bf[_0xc236('0x1d')](_0xc236('0x1e'),_0x76f45+'-'+_0x541a20+'/'+_0x57355b)[_0xc236('0x1f')](_0x32f2fd);}return null;};}function patchUpdates(_0x27c6ab){return function(_0x3f0e2f){try{jsonpatch[_0xc236('0x20')](_0x3f0e2f,_0x27c6ab,!![]);}catch(_0x54ffac){return BPromise[_0xc236('0x21')](_0x54ffac);}return _0x3f0e2f[_0xc236('0x22')]();};}function saveUpdates(_0x4a9006,_0x208c3f){return function(_0x34d73a){if(_0x34d73a){return _0x34d73a[_0xc236('0x23')](_0x4a9006)[_0xc236('0x24')](function(_0x27afba){return _0x27afba;});}return null;};}function removeEntity(_0x21fab8,_0x3a315b){return function(_0xf921e6){if(_0xf921e6){return _0xf921e6[_0xc236('0x25')]()[_0xc236('0x24')](function(){_0x21fab8[_0xc236('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x308cd6,_0x21d78f){return function(_0x356042){if(!_0x356042){_0x308cd6[_0xc236('0x26')](0x194);}return _0x356042;};}function handleError(_0x561da1,_0x42f248){_0x42f248=_0x42f248||0x1f4;return function(_0x5da4b2){logger['error'](_0x5da4b2[_0xc236('0x27')]);if(_0x5da4b2['name']){delete _0x5da4b2[_0xc236('0x28')];}_0x561da1['status'](_0x42f248)[_0xc236('0x29')](_0x5da4b2);};}exports['index']=function(_0x423842,_0x1d144b){var _0x4f5175={},_0x5a61b5={},_0x265c8d={'count':0x0,'rows':[]};var _0x1fd31d=_[_0xc236('0x2a')](db[_0xc236('0x2b')]['rawAttributes'],function(_0x4e3262){return{'name':_0x4e3262[_0xc236('0x2c')],'type':_0x4e3262['type'][_0xc236('0x2d')]};});_0x5a61b5['model']=_[_0xc236('0x2a')](_0x1fd31d,_0xc236('0x28'));_0x5a61b5['query']=_['keys'](_0x423842[_0xc236('0x2e')]);_0x5a61b5[_0xc236('0x2f')]=_[_0xc236('0x30')](_0x5a61b5[_0xc236('0x31')],_0x5a61b5[_0xc236('0x2e')]);_0x4f5175[_0xc236('0x32')]=_[_0xc236('0x30')](_0x5a61b5[_0xc236('0x31')],qs[_0xc236('0x33')](_0x423842['query']['fields']));_0x4f5175['attributes']=_0x4f5175[_0xc236('0x32')][_0xc236('0x34')]?_0x4f5175[_0xc236('0x32')]:_0x5a61b5[_0xc236('0x31')];if(!_0x423842[_0xc236('0x2e')][_0xc236('0x35')](_0xc236('0x36'))){_0x4f5175['limit']=qs[_0xc236('0x37')](_0x423842[_0xc236('0x2e')][_0xc236('0x37')]);_0x4f5175['offset']=qs[_0xc236('0x1a')](_0x423842[_0xc236('0x2e')][_0xc236('0x1a')]);}_0x4f5175[_0xc236('0x38')]=qs['sort'](_0x423842[_0xc236('0x2e')][_0xc236('0x39')]);_0x4f5175[_0xc236('0x3a')]=qs[_0xc236('0x2f')](_[_0xc236('0x3b')](_0x423842[_0xc236('0x2e')],_0x5a61b5[_0xc236('0x2f')]),_0x1fd31d);if(_0x423842[_0xc236('0x2e')][_0xc236('0x3c')]){_0x4f5175[_0xc236('0x3a')]=_[_0xc236('0x3d')](_0x4f5175[_0xc236('0x3a')],{'$or':_[_0xc236('0x2a')](_0x1fd31d,function(_0x237193){if(_0x237193[_0xc236('0x3e')]!==_0xc236('0x3f')){var _0x46db5a={};_0x46db5a[_0x237193['name']]={'$like':'%'+_0x423842['query']['filter']+'%'};return _0x46db5a;}})});}_0x4f5175=_['merge']({},_0x4f5175,_0x423842[_0xc236('0x40')]);var _0x5c4739={'where':_0x4f5175[_0xc236('0x3a')]};return db[_0xc236('0x2b')][_0xc236('0x1c')](_0x5c4739)[_0xc236('0x24')](function(_0xdf7897){_0x265c8d[_0xc236('0x1c')]=_0xdf7897;if(_0x423842[_0xc236('0x2e')][_0xc236('0x41')]){_0x4f5175[_0xc236('0x42')]=[{'all':!![]}];}return db[_0xc236('0x2b')][_0xc236('0x43')](_0x4f5175);})[_0xc236('0x24')](function(_0x3b2f2f){_0x265c8d[_0xc236('0x44')]=_0x3b2f2f;return _0x265c8d;})[_0xc236('0x24')](respondWithFilteredResult(_0x1d144b,_0x4f5175))['catch'](handleError(_0x1d144b,null));};exports[_0xc236('0x45')]=function(_0x24b851,_0x506ba0){var _0xb90a83={'raw':!![],'where':{'id':_0x24b851[_0xc236('0x46')]['id']}},_0x5b0bc5={};_0x5b0bc5['model']=_[_0xc236('0x47')](db[_0xc236('0x2b')][_0xc236('0x48')]);_0x5b0bc5['query']=_[_0xc236('0x47')](_0x24b851[_0xc236('0x2e')]);_0x5b0bc5[_0xc236('0x2f')]=_['intersection'](_0x5b0bc5[_0xc236('0x31')],_0x5b0bc5[_0xc236('0x2e')]);_0xb90a83[_0xc236('0x32')]=_[_0xc236('0x30')](_0x5b0bc5[_0xc236('0x31')],qs[_0xc236('0x33')](_0x24b851['query'][_0xc236('0x33')]));_0xb90a83['attributes']=_0xb90a83[_0xc236('0x32')][_0xc236('0x34')]?_0xb90a83[_0xc236('0x32')]:_0x5b0bc5[_0xc236('0x31')];if(_0x24b851[_0xc236('0x2e')][_0xc236('0x41')]){_0xb90a83[_0xc236('0x42')]=[{'all':!![]}];}_0xb90a83=_['merge']({},_0xb90a83,_0x24b851[_0xc236('0x40')]);return db['WhatsappQueueReport'][_0xc236('0x49')](_0xb90a83)[_0xc236('0x24')](handleEntityNotFound(_0x506ba0,null))['then'](respondWithResult(_0x506ba0,null))[_0xc236('0x4a')](handleError(_0x506ba0,null));};exports[_0xc236('0x4b')]=function(_0x3c1c5c,_0x161890){return db[_0xc236('0x2b')][_0xc236('0x4b')](_0x3c1c5c[_0xc236('0x4c')],{})['then'](respondWithResult(_0x161890,0xc9))['catch'](handleError(_0x161890,null));};exports[_0xc236('0x23')]=function(_0x2afed2,_0x510f7f){if(_0x2afed2[_0xc236('0x4c')]['id']){delete _0x2afed2[_0xc236('0x4c')]['id'];}return db[_0xc236('0x2b')][_0xc236('0x49')]({'where':{'id':_0x2afed2[_0xc236('0x46')]['id']}})[_0xc236('0x24')](handleEntityNotFound(_0x510f7f,null))[_0xc236('0x24')](saveUpdates(_0x2afed2[_0xc236('0x4c')],null))[_0xc236('0x24')](respondWithResult(_0x510f7f,null))['catch'](handleError(_0x510f7f,null));};exports[_0xc236('0x25')]=function(_0x307663,_0x41b7d5){return db[_0xc236('0x2b')][_0xc236('0x49')]({'where':{'id':_0x307663[_0xc236('0x46')]['id']}})[_0xc236('0x24')](handleEntityNotFound(_0x41b7d5,null))['then'](removeEntity(_0x41b7d5,null))[_0xc236('0x4a')](handleError(_0x41b7d5,null));};exports[_0xc236('0x4d')]=function(_0x17c86b,_0x16ff63){return db['WhatsappQueueReport'][_0xc236('0x4d')]()[_0xc236('0x24')](respondWithResult(_0x16ff63,null))[_0xc236('0x4a')](handleError(_0x16ff63,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index e05513d..afad135 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 _0xe75f=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','WhatsappQueueReport','uniqueid','lodash'];(function(_0x5b4c14,_0x4d8a49){var _0x4108e8=function(_0x4a4f98){while(--_0x4a4f98){_0x5b4c14['push'](_0x5b4c14['shift']());}};_0x4108e8(++_0x4d8a49);}(_0xe75f,0x173));var _0xfe75=function(_0xee0cc1,_0x2cca3b){_0xee0cc1=_0xee0cc1-0x0;var _0x5346a0=_0xe75f[_0xee0cc1];return _0x5346a0;};'use strict';var _=require(_0xfe75('0x0'));var util=require(_0xfe75('0x1'));var logger=require(_0xfe75('0x2'))(_0xfe75('0x3'));var moment=require('moment');var BPromise=require(_0xfe75('0x4'));var rp=require(_0xfe75('0x5'));var fs=require('fs');var path=require(_0xfe75('0x6'));var rimraf=require(_0xfe75('0x7'));var config=require(_0xfe75('0x8'));var attributes=require('./whatsappQueueReport.attributes');module['exports']=function(_0x19e357,_0x294ce9){return _0x19e357[_0xfe75('0x9')](_0xfe75('0xa'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0xfe75('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbc66=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport','uniqueid','lodash','util'];(function(_0x45c0da,_0x4f9492){var _0x51efff=function(_0x53b3b2){while(--_0x53b3b2){_0x45c0da['push'](_0x45c0da['shift']());}};_0x51efff(++_0x4f9492);}(_0xbc66,0x1d2));var _0x6bc6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xbc66[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x6bc6('0x0'));var util=require(_0x6bc6('0x1'));var logger=require(_0x6bc6('0x2'))(_0x6bc6('0x3'));var moment=require(_0x6bc6('0x4'));var BPromise=require(_0x6bc6('0x5'));var rp=require(_0x6bc6('0x6'));var fs=require('fs');var path=require(_0x6bc6('0x7'));var rimraf=require('rimraf');var config=require(_0x6bc6('0x8'));var attributes=require(_0x6bc6('0x9'));module['exports']=function(_0x1e2699,_0x3474da){return _0x1e2699[_0x6bc6('0xa')](_0x6bc6('0xb'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x6bc6('0xc'),'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 21df685..8bcbfd2 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 _0xac5f=['limit','UpdateWhatsappQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','WhatsappQueueReport','body','options','raw','CreateWhatsappQueueReport','update','attributes'];(function(_0xf067b3,_0x1822ef){var _0x3b54dd=function(_0x74dd88){while(--_0x74dd88){_0xf067b3['push'](_0xf067b3['shift']());}};_0x3b54dd(++_0x1822ef);}(_0xac5f,0x12b));var _0xfac5=function(_0x49c32d,_0x26d57e){_0x49c32d=_0x49c32d-0x0;var _0x1d668b=_0xac5f[_0x49c32d];return _0x1d668b;};'use strict';var _=require(_0xfac5('0x0'));var util=require(_0xfac5('0x1'));var moment=require(_0xfac5('0x2'));var BPromise=require(_0xfac5('0x3'));var rs=require(_0xfac5('0x4'));var fs=require('fs');var Redis=require(_0xfac5('0x5'));var db=require(_0xfac5('0x6'))['db'];var utils=require(_0xfac5('0x7'));var logger=require(_0xfac5('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfac5('0x9'));var client=jayson[_0xfac5('0xa')][_0xfac5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13d8a2,_0x18d50a,_0x19173d){return new BPromise(function(_0x38fd92,_0x208aae){return client[_0xfac5('0xc')](_0x13d8a2,_0x19173d)[_0xfac5('0xd')](function(_0x2b4d76){logger[_0xfac5('0xe')](_0xfac5('0xf'),_0x18d50a,_0xfac5('0x10'));logger[_0xfac5('0x11')](_0xfac5('0x12'),_0x18d50a,_0xfac5('0x10'),JSON[_0xfac5('0x13')](_0x2b4d76));if(_0x2b4d76[_0xfac5('0x14')]){if(_0x2b4d76[_0xfac5('0x14')]['code']===0x1f4){logger[_0xfac5('0x14')](_0xfac5('0xf'),_0x18d50a,_0x2b4d76[_0xfac5('0x14')][_0xfac5('0x15')]);return _0x208aae(_0x2b4d76[_0xfac5('0x14')][_0xfac5('0x15')]);}logger[_0xfac5('0x14')]('WhatsappQueueReport,\x20%s,\x20%s',_0x18d50a,_0x2b4d76['error'][_0xfac5('0x15')]);return _0x38fd92(_0x2b4d76[_0xfac5('0x14')]['message']);}else{logger[_0xfac5('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x18d50a,_0xfac5('0x10'));_0x38fd92(_0x2b4d76[_0xfac5('0x16')][_0xfac5('0x15')]);}})[_0xfac5('0x17')](function(_0x13b161){logger[_0xfac5('0x14')]('WhatsappQueueReport,\x20%s,\x20%s',_0x18d50a,_0x13b161);_0x208aae(_0x13b161);});});}exports['CreateWhatsappQueueReport']=function(_0x38186d){var _0x170435=this;return new Promise(function(_0x483d02,_0x12b399){return db[_0xfac5('0x18')]['create'](_0x38186d[_0xfac5('0x19')],{'raw':_0x38186d[_0xfac5('0x1a')]?_0x38186d[_0xfac5('0x1a')][_0xfac5('0x1b')]===undefined?!![]:![]:!![]})[_0xfac5('0xd')](function(_0x5af6ec){logger[_0xfac5('0xe')](_0xfac5('0x1c'),_0x38186d);logger[_0xfac5('0x11')](_0xfac5('0x1c'),_0x38186d,JSON[_0xfac5('0x13')](_0x5af6ec));_0x483d02(_0x5af6ec);})[_0xfac5('0x17')](function(_0x53c439){logger['error']('CreateWhatsappQueueReport',_0x53c439[_0xfac5('0x15')],_0x38186d);_0x12b399(_0x170435[_0xfac5('0x14')](0x1f4,_0x53c439[_0xfac5('0x15')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x4f27b5){var _0x10da27=this;return new Promise(function(_0xdaf954,_0x150ac2){return db[_0xfac5('0x18')][_0xfac5('0x1d')](_0x4f27b5[_0xfac5('0x19')],{'raw':_0x4f27b5[_0xfac5('0x1a')]?_0x4f27b5[_0xfac5('0x1a')][_0xfac5('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f27b5[_0xfac5('0x1a')]?_0x4f27b5[_0xfac5('0x1a')]['where']||null:null,'attributes':_0x4f27b5[_0xfac5('0x1a')]?_0x4f27b5[_0xfac5('0x1a')][_0xfac5('0x1e')]||null:null,'limit':_0x4f27b5[_0xfac5('0x1a')]?_0x4f27b5[_0xfac5('0x1a')][_0xfac5('0x1f')]||null:null})[_0xfac5('0xd')](function(_0x3fd895){logger[_0xfac5('0xe')](_0xfac5('0x20'),_0x4f27b5);logger[_0xfac5('0x11')](_0xfac5('0x20'),_0x4f27b5,JSON[_0xfac5('0x13')](_0x3fd895));_0xdaf954(_0x3fd895);})[_0xfac5('0x17')](function(_0x58cc8d){logger[_0xfac5('0x14')]('UpdateWhatsappQueueReport',_0x58cc8d[_0xfac5('0x15')],_0x4f27b5);_0x150ac2(_0x10da27[_0xfac5('0x14')](0x1f4,_0x58cc8d[_0xfac5('0x15')]));});});}; \ No newline at end of file +var _0xf5cd=['rpc','jayson/promise','client','http','info','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','catch','update','attributes','limit','then','UpdateWhatsappQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0xf5cd,0x121));var _0xdf5c=function(_0x4ad871,_0x4343f3){_0x4ad871=_0x4ad871-0x0;var _0x20344f=_0xf5cd[_0x4ad871];return _0x20344f;};'use strict';var _=require(_0xdf5c('0x0'));var util=require(_0xdf5c('0x1'));var moment=require(_0xdf5c('0x2'));var BPromise=require(_0xdf5c('0x3'));var rs=require(_0xdf5c('0x4'));var fs=require('fs');var Redis=require(_0xdf5c('0x5'));var db=require(_0xdf5c('0x6'))['db'];var utils=require(_0xdf5c('0x7'));var logger=require('../../config/logger')(_0xdf5c('0x8'));var config=require('../../config/environment');var jayson=require(_0xdf5c('0x9'));var client=jayson[_0xdf5c('0xa')][_0xdf5c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53be87,_0x46fda6,_0x3ccf90){return new BPromise(function(_0x3c6011,_0xd048c1){return client['request'](_0x53be87,_0x3ccf90)['then'](function(_0x5d5d77){logger[_0xdf5c('0xc')](_0xdf5c('0xd'),_0x46fda6,'request\x20sent');logger[_0xdf5c('0xe')](_0xdf5c('0xf'),_0x46fda6,_0xdf5c('0x10'),JSON[_0xdf5c('0x11')](_0x5d5d77));if(_0x5d5d77[_0xdf5c('0x12')]){if(_0x5d5d77[_0xdf5c('0x12')][_0xdf5c('0x13')]===0x1f4){logger[_0xdf5c('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x46fda6,_0x5d5d77[_0xdf5c('0x12')][_0xdf5c('0x14')]);return _0xd048c1(_0x5d5d77['error'][_0xdf5c('0x14')]);}logger[_0xdf5c('0x12')](_0xdf5c('0xd'),_0x46fda6,_0x5d5d77[_0xdf5c('0x12')][_0xdf5c('0x14')]);return _0x3c6011(_0x5d5d77[_0xdf5c('0x12')][_0xdf5c('0x14')]);}else{logger[_0xdf5c('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0x46fda6,_0xdf5c('0x10'));_0x3c6011(_0x5d5d77['result'][_0xdf5c('0x14')]);}})['catch'](function(_0x20b968){logger[_0xdf5c('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x46fda6,_0x20b968);_0xd048c1(_0x20b968);});});}exports[_0xdf5c('0x15')]=function(_0x549bd0){var _0x316b56=this;return new Promise(function(_0x421505,_0x3c1818){return db[_0xdf5c('0x16')][_0xdf5c('0x17')](_0x549bd0[_0xdf5c('0x18')],{'raw':_0x549bd0[_0xdf5c('0x19')]?_0x549bd0['options'][_0xdf5c('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x490085){logger['info'](_0xdf5c('0x15'),_0x549bd0);logger['debug'](_0xdf5c('0x15'),_0x549bd0,JSON['stringify'](_0x490085));_0x421505(_0x490085);})[_0xdf5c('0x1b')](function(_0x9a8f2f){logger['error'](_0xdf5c('0x15'),_0x9a8f2f[_0xdf5c('0x14')],_0x549bd0);_0x3c1818(_0x316b56['error'](0x1f4,_0x9a8f2f[_0xdf5c('0x14')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x1ec462){var _0x4dff9d=this;return new Promise(function(_0x20d0f2,_0xc6a309){return db[_0xdf5c('0x16')][_0xdf5c('0x1c')](_0x1ec462[_0xdf5c('0x18')],{'raw':_0x1ec462[_0xdf5c('0x19')]?_0x1ec462[_0xdf5c('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ec462[_0xdf5c('0x19')]?_0x1ec462['options']['where']||null:null,'attributes':_0x1ec462[_0xdf5c('0x19')]?_0x1ec462[_0xdf5c('0x19')][_0xdf5c('0x1d')]||null:null,'limit':_0x1ec462[_0xdf5c('0x19')]?_0x1ec462[_0xdf5c('0x19')][_0xdf5c('0x1e')]||null:null})[_0xdf5c('0x1f')](function(_0x1d8574){logger[_0xdf5c('0xc')](_0xdf5c('0x20'),_0x1ec462);logger[_0xdf5c('0xe')](_0xdf5c('0x20'),_0x1ec462,JSON[_0xdf5c('0x11')](_0x1d8574));_0x20d0f2(_0x1d8574);})[_0xdf5c('0x1b')](function(_0x100fab){logger[_0xdf5c('0x12')](_0xdf5c('0x20'),_0x100fab[_0xdf5c('0x14')],_0x1ec462);_0xc6a309(_0x4dff9d[_0xdf5c('0x12')](0x1f4,_0x100fab[_0xdf5c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index a7a3cfc..8335bf0 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 _0x4c8a=['multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','/describe','describe','/:id','isAuthenticated','post','put','delete','destroy','exports'];(function(_0x211129,_0x529048){var _0x163369=function(_0x309aaa){while(--_0x309aaa){_0x211129['push'](_0x211129['shift']());}};_0x163369(++_0x529048);}(_0x4c8a,0x17c));var _0xa4c8=function(_0x120939,_0x422d83){_0x120939=_0x120939-0x0;var _0x44726b=_0x4c8a[_0x120939];return _0x44726b;};'use strict';var multer=require(_0xa4c8('0x0'));var util=require('util');var path=require(_0xa4c8('0x1'));var timeout=require(_0xa4c8('0x2'));var express=require('express');var router=express[_0xa4c8('0x3')]();var fs_extra=require(_0xa4c8('0x4'));var auth=require(_0xa4c8('0x5'));var interaction=require(_0xa4c8('0x6'));var config=require(_0xa4c8('0x7'));var controller=require(_0xa4c8('0x8'));router[_0xa4c8('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa4c8('0x9')](_0xa4c8('0xa'),auth['isAuthenticated'](),controller[_0xa4c8('0xb')]);router[_0xa4c8('0x9')](_0xa4c8('0xc'),auth[_0xa4c8('0xd')](),controller['show']);router[_0xa4c8('0xe')]('/',auth[_0xa4c8('0xd')](),controller['create']);router[_0xa4c8('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xa4c8('0x10')](_0xa4c8('0xc'),auth['isAuthenticated'](),controller[_0xa4c8('0x11')]);module[_0xa4c8('0x12')]=router; \ No newline at end of file +var _0x617d=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','put','update','delete','destroy','exports','multer','path'];(function(_0xf80b3,_0x25d5f3){var _0x10c489=function(_0x3c5aee){while(--_0x3c5aee){_0xf80b3['push'](_0xf80b3['shift']());}};_0x10c489(++_0x25d5f3);}(_0x617d,0xee));var _0xd617=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x617d[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xd617('0x0'));var util=require('util');var path=require(_0xd617('0x1'));var timeout=require(_0xd617('0x2'));var express=require(_0xd617('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd617('0x4'));var interaction=require(_0xd617('0x5'));var config=require(_0xd617('0x6'));var controller=require(_0xd617('0x7'));router[_0xd617('0x8')]('/',auth[_0xd617('0x9')](),controller[_0xd617('0xa')]);router[_0xd617('0x8')](_0xd617('0xb'),auth[_0xd617('0x9')](),controller['describe']);router[_0xd617('0x8')](_0xd617('0xc'),auth[_0xd617('0x9')](),controller[_0xd617('0xd')]);router[_0xd617('0xe')]('/',auth[_0xd617('0x9')](),controller['create']);router[_0xd617('0xf')](_0xd617('0xc'),auth[_0xd617('0x9')](),controller[_0xd617('0x10')]);router[_0xd617('0x11')](_0xd617('0xc'),auth[_0xd617('0x9')](),controller[_0xd617('0x12')]);module[_0xd617('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 5805514..fb8c512 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 _0xd943=['exports','STRING','ENUM','agent','queue','DATE','sequelize'];(function(_0x5192ac,_0x3b8fda){var _0x2b76d5=function(_0xd6de36){while(--_0xd6de36){_0x5192ac['push'](_0x5192ac['shift']());}};_0x2b76d5(++_0x3b8fda);}(_0xd943,0x15d));var _0x3d94=function(_0x48da3f,_0x5b97ff){_0x48da3f=_0x48da3f-0x0;var _0x416bd9=_0xd943[_0x48da3f];return _0x416bd9;};'use strict';var Sequelize=require(_0x3d94('0x0'));module[_0x3d94('0x1')]={'uniqueid':{'type':Sequelize[_0x3d94('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3d94('0x3')]('account',_0x3d94('0x4'),_0x3d94('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x3d94('0x6')]}}; \ No newline at end of file +var _0x536f=['sequelize','agent','queue','DATE'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x536f,0x70));var _0xf536=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x536f[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xf536('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0xf536('0x1'),_0xf536('0x2')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xf536('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 09e3b34..79a88ea 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 _0x160f=['sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','rawAttributes','type','key','map','intersection','model','query','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','WhatsappTransferReport','include','findAll','rows','show','params','keys','fields','includeAll','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x444c20,_0x30c5a8){var _0x2c9b64=function(_0xd1fc0f){while(--_0xd1fc0f){_0x444c20['push'](_0x444c20['shift']());}};_0x2c9b64(++_0x30c5a8);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf160('0x0'));var rimraf=require(_0xf160('0x1'));var zipdir=require(_0xf160('0x2'));var jsonpatch=require(_0xf160('0x3'));var rp=require('request-promise');var moment=require(_0xf160('0x4'));var BPromise=require(_0xf160('0x5'));var Mustache=require(_0xf160('0x6'));var util=require(_0xf160('0x7'));var path=require(_0xf160('0x8'));var sox=require(_0xf160('0x9'));var csv=require('to-csv');var ejs=require(_0xf160('0xa'));var fs=require('fs');var fs_extra=require(_0xf160('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf160('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf160('0xd'));var Papa=require(_0xf160('0xe'));var Redis=require(_0xf160('0xf'));var authService=require(_0xf160('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf160('0x11'));var logger=require(_0xf160('0x12'))(_0xf160('0x13'));var utils=require('../../config/utils');var config=require(_0xf160('0x14'));var licenseUtil=require(_0xf160('0x15'));var db=require(_0xf160('0x16'))['db'];function respondWithStatusCode(_0x3b09ea,_0x2d8854){_0x2d8854=_0x2d8854||0xcc;return function(_0x523af5){if(_0x523af5){return _0x3b09ea[_0xf160('0x17')](_0x2d8854);}return _0x3b09ea['status'](_0x2d8854)[_0xf160('0x18')]();};}function respondWithResult(_0x26951a,_0x12549a){_0x12549a=_0x12549a||0xc8;return function(_0x2bb6c7){if(_0x2bb6c7){return _0x26951a[_0xf160('0x19')](_0x12549a)[_0xf160('0x1a')](_0x2bb6c7);}};}function respondWithFilteredResult(_0x2643ba,_0x172337){return function(_0x1396ba){if(_0x1396ba){var _0x59ac02=typeof _0x172337[_0xf160('0x1b')]===_0xf160('0x1c')&&typeof _0x172337[_0xf160('0x1d')]===_0xf160('0x1c');var _0x51824b=_0x1396ba[_0xf160('0x1e')];var _0x4b8185=_0x59ac02?0x0:_0x172337[_0xf160('0x1b')];var _0x1cf6ba=_0x59ac02?_0x1396ba[_0xf160('0x1e')]:_0x172337[_0xf160('0x1b')]+_0x172337[_0xf160('0x1d')];var _0x205afa;if(_0x1cf6ba>=_0x51824b){_0x1cf6ba=_0x51824b;_0x205afa=0xc8;}else{_0x205afa=0xce;}_0x2643ba[_0xf160('0x19')](_0x205afa);return _0x2643ba[_0xf160('0x1f')](_0xf160('0x20'),_0x4b8185+'-'+_0x1cf6ba+'/'+_0x51824b)['json'](_0x1396ba);}return null;};}function patchUpdates(_0x40ccf0){return function(_0xa20d5a){try{jsonpatch[_0xf160('0x21')](_0xa20d5a,_0x40ccf0,!![]);}catch(_0x5ad173){return BPromise[_0xf160('0x22')](_0x5ad173);}return _0xa20d5a[_0xf160('0x23')]();};}function saveUpdates(_0x454e63,_0x36d0cb){return function(_0x2e03c8){if(_0x2e03c8){return _0x2e03c8[_0xf160('0x24')](_0x454e63)[_0xf160('0x25')](function(_0x5a72d1){return _0x5a72d1;});}return null;};}function removeEntity(_0x3d1f6c,_0x28bf27){return function(_0x305f6a){if(_0x305f6a){return _0x305f6a[_0xf160('0x26')]()['then'](function(){_0x3d1f6c[_0xf160('0x19')](0xcc)[_0xf160('0x18')]();});}};}function handleEntityNotFound(_0x4a8003,_0x487c0c){return function(_0x168a09){if(!_0x168a09){_0x4a8003[_0xf160('0x17')](0x194);}return _0x168a09;};}function handleError(_0x39c0e3,_0x4c0c51){_0x4c0c51=_0x4c0c51||0x1f4;return function(_0xcfa9bd){logger[_0xf160('0x27')](_0xcfa9bd[_0xf160('0x28')]);if(_0xcfa9bd[_0xf160('0x29')]){delete _0xcfa9bd[_0xf160('0x29')];}_0x39c0e3[_0xf160('0x19')](_0x4c0c51)['send'](_0xcfa9bd);};}exports['index']=function(_0x48145e,_0x26e7b9){var _0x16a5fa={},_0xcaab39={},_0x26e06b={'count':0x0,'rows':[]};var _0x399cce=_['map'](db['WhatsappTransferReport'][_0xf160('0x2a')],function(_0x558596){return{'name':_0x558596['fieldName'],'type':_0x558596[_0xf160('0x2b')][_0xf160('0x2c')]};});_0xcaab39['model']=_[_0xf160('0x2d')](_0x399cce,_0xf160('0x29'));_0xcaab39['query']=_['keys'](_0x48145e['query']);_0xcaab39['filters']=_[_0xf160('0x2e')](_0xcaab39[_0xf160('0x2f')],_0xcaab39[_0xf160('0x30')]);_0x16a5fa[_0xf160('0x31')]=_[_0xf160('0x2e')](_0xcaab39[_0xf160('0x2f')],qs['fields'](_0x48145e['query']['fields']));_0x16a5fa[_0xf160('0x31')]=_0x16a5fa['attributes']['length']?_0x16a5fa[_0xf160('0x31')]:_0xcaab39[_0xf160('0x2f')];if(!_0x48145e['query'][_0xf160('0x32')](_0xf160('0x33'))){_0x16a5fa[_0xf160('0x1d')]=qs[_0xf160('0x1d')](_0x48145e[_0xf160('0x30')]['limit']);_0x16a5fa[_0xf160('0x1b')]=qs[_0xf160('0x1b')](_0x48145e[_0xf160('0x30')]['offset']);}_0x16a5fa[_0xf160('0x34')]=qs[_0xf160('0x35')](_0x48145e[_0xf160('0x30')][_0xf160('0x35')]);_0x16a5fa[_0xf160('0x36')]=qs[_0xf160('0x37')](_['pick'](_0x48145e['query'],_0xcaab39[_0xf160('0x37')]),_0x399cce);if(_0x48145e[_0xf160('0x30')][_0xf160('0x38')]){_0x16a5fa[_0xf160('0x36')]=_[_0xf160('0x39')](_0x16a5fa[_0xf160('0x36')],{'$or':_[_0xf160('0x2d')](_0x399cce,function(_0x38a33e){if(_0x38a33e[_0xf160('0x2b')]!==_0xf160('0x3a')){var _0x1e65d4={};_0x1e65d4[_0x38a33e[_0xf160('0x29')]]={'$like':'%'+_0x48145e[_0xf160('0x30')][_0xf160('0x38')]+'%'};return _0x1e65d4;}})});}_0x16a5fa=_[_0xf160('0x39')]({},_0x16a5fa,_0x48145e[_0xf160('0x3b')]);var _0x161f06={'where':_0x16a5fa[_0xf160('0x36')]};return db[_0xf160('0x3c')][_0xf160('0x1e')](_0x161f06)[_0xf160('0x25')](function(_0x8fe1de){_0x26e06b[_0xf160('0x1e')]=_0x8fe1de;if(_0x48145e[_0xf160('0x30')]['includeAll']){_0x16a5fa[_0xf160('0x3d')]=[{'all':!![]}];}return db[_0xf160('0x3c')][_0xf160('0x3e')](_0x16a5fa);})[_0xf160('0x25')](function(_0x3d273d){_0x26e06b[_0xf160('0x3f')]=_0x3d273d;return _0x26e06b;})[_0xf160('0x25')](respondWithFilteredResult(_0x26e7b9,_0x16a5fa))['catch'](handleError(_0x26e7b9,null));};exports[_0xf160('0x40')]=function(_0x5be7ce,_0xa80a5f){var _0x477ded={'raw':!![],'where':{'id':_0x5be7ce[_0xf160('0x41')]['id']}},_0x530fc5={};_0x530fc5[_0xf160('0x2f')]=_[_0xf160('0x42')](db[_0xf160('0x3c')][_0xf160('0x2a')]);_0x530fc5[_0xf160('0x30')]=_[_0xf160('0x42')](_0x5be7ce['query']);_0x530fc5[_0xf160('0x37')]=_[_0xf160('0x2e')](_0x530fc5[_0xf160('0x2f')],_0x530fc5[_0xf160('0x30')]);_0x477ded[_0xf160('0x31')]=_[_0xf160('0x2e')](_0x530fc5[_0xf160('0x2f')],qs[_0xf160('0x43')](_0x5be7ce[_0xf160('0x30')][_0xf160('0x43')]));_0x477ded[_0xf160('0x31')]=_0x477ded['attributes']['length']?_0x477ded[_0xf160('0x31')]:_0x530fc5[_0xf160('0x2f')];if(_0x5be7ce[_0xf160('0x30')][_0xf160('0x44')]){_0x477ded[_0xf160('0x3d')]=[{'all':!![]}];}_0x477ded=_[_0xf160('0x39')]({},_0x477ded,_0x5be7ce['options']);return db[_0xf160('0x3c')]['find'](_0x477ded)['then'](handleEntityNotFound(_0xa80a5f,null))[_0xf160('0x25')](respondWithResult(_0xa80a5f,null))[_0xf160('0x45')](handleError(_0xa80a5f,null));};exports['create']=function(_0x5ea49d,_0x2f1648){return db[_0xf160('0x3c')][_0xf160('0x46')](_0x5ea49d[_0xf160('0x47')],{})['then'](respondWithResult(_0x2f1648,0xc9))['catch'](handleError(_0x2f1648,null));};exports['update']=function(_0x50a97d,_0x406494){if(_0x50a97d['body']['id']){delete _0x50a97d[_0xf160('0x47')]['id'];}return db[_0xf160('0x3c')][_0xf160('0x48')]({'where':{'id':_0x50a97d[_0xf160('0x41')]['id']}})['then'](handleEntityNotFound(_0x406494,null))[_0xf160('0x25')](saveUpdates(_0x50a97d[_0xf160('0x47')],null))[_0xf160('0x25')](respondWithResult(_0x406494,null))['catch'](handleError(_0x406494,null));};exports[_0xf160('0x26')]=function(_0x40f855,_0x87ad7e){return db['WhatsappTransferReport'][_0xf160('0x48')]({'where':{'id':_0x40f855[_0xf160('0x41')]['id']}})[_0xf160('0x25')](handleEntityNotFound(_0x87ad7e,null))[_0xf160('0x25')](removeEntity(_0x87ad7e,null))[_0xf160('0x45')](handleError(_0x87ad7e,null));};exports['describe']=function(_0x4c90ab,_0x3c8765){return db['WhatsappTransferReport'][_0xf160('0x49')]()[_0xf160('0x25')](respondWithResult(_0x3c8765,null))['catch'](handleError(_0x3c8765,null));}; \ No newline at end of file +var _0x1267=['rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','merge','map','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','WhatsappTransferReport'];(function(_0xde9a3d,_0x5208f7){var _0x4ddf27=function(_0x30b875){while(--_0x30b875){_0xde9a3d['push'](_0xde9a3d['shift']());}};_0x4ddf27(++_0x5208f7);}(_0x1267,0xb5));var _0x7126=function(_0x83e3ed,_0x4945c8){_0x83e3ed=_0x83e3ed-0x0;var _0x4d880c=_0x1267[_0x83e3ed];return _0x4d880c;};'use strict';var emlformat=require(_0x7126('0x0'));var rimraf=require(_0x7126('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7126('0x2'));var moment=require(_0x7126('0x3'));var BPromise=require(_0x7126('0x4'));var Mustache=require(_0x7126('0x5'));var util=require(_0x7126('0x6'));var path=require(_0x7126('0x7'));var sox=require(_0x7126('0x8'));var csv=require('to-csv');var ejs=require(_0x7126('0x9'));var fs=require('fs');var fs_extra=require(_0x7126('0xa'));var _=require(_0x7126('0xb'));var squel=require(_0x7126('0xc'));var crypto=require('crypto');var jsforce=require(_0x7126('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7126('0xe'));var querystring=require('querystring');var Papa=require(_0x7126('0xf'));var Redis=require(_0x7126('0x10'));var authService=require(_0x7126('0x11'));var qs=require(_0x7126('0x12'));var as=require(_0x7126('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7126('0x14'));var utils=require(_0x7126('0x15'));var config=require(_0x7126('0x16'));var licenseUtil=require(_0x7126('0x17'));var db=require(_0x7126('0x18'))['db'];function respondWithStatusCode(_0x318019,_0x555966){_0x555966=_0x555966||0xcc;return function(_0x5eb253){if(_0x5eb253){return _0x318019[_0x7126('0x19')](_0x555966);}return _0x318019[_0x7126('0x1a')](_0x555966)['end']();};}function respondWithResult(_0x509005,_0x33dc18){_0x33dc18=_0x33dc18||0xc8;return function(_0x4776b1){if(_0x4776b1){return _0x509005['status'](_0x33dc18)[_0x7126('0x1b')](_0x4776b1);}};}function respondWithFilteredResult(_0x52866f,_0xf0bfc4){return function(_0x18fc4a){if(_0x18fc4a){var _0x5ebe78=typeof _0xf0bfc4['offset']===_0x7126('0x1c')&&typeof _0xf0bfc4['limit']===_0x7126('0x1c');var _0x24e14b=_0x18fc4a[_0x7126('0x1d')];var _0x2795e0=_0x5ebe78?0x0:_0xf0bfc4[_0x7126('0x1e')];var _0x68dbf2=_0x5ebe78?_0x18fc4a[_0x7126('0x1d')]:_0xf0bfc4['offset']+_0xf0bfc4[_0x7126('0x1f')];var _0x369f8f;if(_0x68dbf2>=_0x24e14b){_0x68dbf2=_0x24e14b;_0x369f8f=0xc8;}else{_0x369f8f=0xce;}_0x52866f['status'](_0x369f8f);return _0x52866f[_0x7126('0x20')](_0x7126('0x21'),_0x2795e0+'-'+_0x68dbf2+'/'+_0x24e14b)['json'](_0x18fc4a);}return null;};}function patchUpdates(_0x3e20f3){return function(_0x57e826){try{jsonpatch['apply'](_0x57e826,_0x3e20f3,!![]);}catch(_0x8a1298){return BPromise[_0x7126('0x22')](_0x8a1298);}return _0x57e826[_0x7126('0x23')]();};}function saveUpdates(_0x263629,_0x10c648){return function(_0x58ac80){if(_0x58ac80){return _0x58ac80[_0x7126('0x24')](_0x263629)[_0x7126('0x25')](function(_0x226ade){return _0x226ade;});}return null;};}function removeEntity(_0x387133,_0x39a51c){return function(_0x37ce12){if(_0x37ce12){return _0x37ce12[_0x7126('0x26')]()[_0x7126('0x25')](function(){_0x387133['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d718d,_0x382941){return function(_0x4b0d9f){if(!_0x4b0d9f){_0x5d718d[_0x7126('0x19')](0x194);}return _0x4b0d9f;};}function handleError(_0x17c060,_0x25ae08){_0x25ae08=_0x25ae08||0x1f4;return function(_0x9b43b4){logger['error'](_0x9b43b4[_0x7126('0x27')]);if(_0x9b43b4['name']){delete _0x9b43b4[_0x7126('0x28')];}_0x17c060['status'](_0x25ae08)[_0x7126('0x29')](_0x9b43b4);};}exports[_0x7126('0x2a')]=function(_0x5e954d,_0x53624e){var _0x512334={},_0x5c56eb={},_0x2e9a73={'count':0x0,'rows':[]};var _0x4a74c4=_['map'](db[_0x7126('0x2b')][_0x7126('0x2c')],function(_0x8f0e73){return{'name':_0x8f0e73[_0x7126('0x2d')],'type':_0x8f0e73[_0x7126('0x2e')][_0x7126('0x2f')]};});_0x5c56eb[_0x7126('0x30')]=_['map'](_0x4a74c4,_0x7126('0x28'));_0x5c56eb['query']=_['keys'](_0x5e954d[_0x7126('0x31')]);_0x5c56eb[_0x7126('0x32')]=_[_0x7126('0x33')](_0x5c56eb[_0x7126('0x30')],_0x5c56eb['query']);_0x512334[_0x7126('0x34')]=_[_0x7126('0x33')](_0x5c56eb[_0x7126('0x30')],qs['fields'](_0x5e954d['query'][_0x7126('0x35')]));_0x512334[_0x7126('0x34')]=_0x512334[_0x7126('0x34')][_0x7126('0x36')]?_0x512334[_0x7126('0x34')]:_0x5c56eb['model'];if(!_0x5e954d[_0x7126('0x31')][_0x7126('0x37')](_0x7126('0x38'))){_0x512334[_0x7126('0x1f')]=qs[_0x7126('0x1f')](_0x5e954d['query']['limit']);_0x512334[_0x7126('0x1e')]=qs[_0x7126('0x1e')](_0x5e954d[_0x7126('0x31')][_0x7126('0x1e')]);}_0x512334[_0x7126('0x39')]=qs['sort'](_0x5e954d[_0x7126('0x31')]['sort']);_0x512334[_0x7126('0x3a')]=qs[_0x7126('0x32')](_['pick'](_0x5e954d[_0x7126('0x31')],_0x5c56eb[_0x7126('0x32')]),_0x4a74c4);if(_0x5e954d[_0x7126('0x31')]['filter']){_0x512334[_0x7126('0x3a')]=_[_0x7126('0x3b')](_0x512334['where'],{'$or':_[_0x7126('0x3c')](_0x4a74c4,function(_0x305d1a){if(_0x305d1a[_0x7126('0x2e')]!=='VIRTUAL'){var _0x2f6122={};_0x2f6122[_0x305d1a['name']]={'$like':'%'+_0x5e954d[_0x7126('0x31')][_0x7126('0x3d')]+'%'};return _0x2f6122;}})});}_0x512334=_['merge']({},_0x512334,_0x5e954d[_0x7126('0x3e')]);var _0x153c44={'where':_0x512334[_0x7126('0x3a')]};return db[_0x7126('0x2b')][_0x7126('0x1d')](_0x153c44)[_0x7126('0x25')](function(_0x3fdbfa){_0x2e9a73['count']=_0x3fdbfa;if(_0x5e954d[_0x7126('0x31')][_0x7126('0x3f')]){_0x512334[_0x7126('0x40')]=[{'all':!![]}];}return db[_0x7126('0x2b')][_0x7126('0x41')](_0x512334);})[_0x7126('0x25')](function(_0x1790ea){_0x2e9a73[_0x7126('0x42')]=_0x1790ea;return _0x2e9a73;})[_0x7126('0x25')](respondWithFilteredResult(_0x53624e,_0x512334))[_0x7126('0x43')](handleError(_0x53624e,null));};exports[_0x7126('0x44')]=function(_0x59bdaa,_0x18bdef){var _0x1a05e4={'raw':!![],'where':{'id':_0x59bdaa[_0x7126('0x45')]['id']}},_0x2859dd={};_0x2859dd[_0x7126('0x30')]=_[_0x7126('0x46')](db[_0x7126('0x2b')][_0x7126('0x2c')]);_0x2859dd['query']=_[_0x7126('0x46')](_0x59bdaa['query']);_0x2859dd[_0x7126('0x32')]=_[_0x7126('0x33')](_0x2859dd[_0x7126('0x30')],_0x2859dd[_0x7126('0x31')]);_0x1a05e4[_0x7126('0x34')]=_[_0x7126('0x33')](_0x2859dd[_0x7126('0x30')],qs['fields'](_0x59bdaa[_0x7126('0x31')][_0x7126('0x35')]));_0x1a05e4[_0x7126('0x34')]=_0x1a05e4['attributes'][_0x7126('0x36')]?_0x1a05e4[_0x7126('0x34')]:_0x2859dd['model'];if(_0x59bdaa[_0x7126('0x31')][_0x7126('0x3f')]){_0x1a05e4['include']=[{'all':!![]}];}_0x1a05e4=_[_0x7126('0x3b')]({},_0x1a05e4,_0x59bdaa[_0x7126('0x3e')]);return db[_0x7126('0x2b')][_0x7126('0x47')](_0x1a05e4)[_0x7126('0x25')](handleEntityNotFound(_0x18bdef,null))[_0x7126('0x25')](respondWithResult(_0x18bdef,null))[_0x7126('0x43')](handleError(_0x18bdef,null));};exports[_0x7126('0x48')]=function(_0x1ccfeb,_0x3ab107){return db[_0x7126('0x2b')][_0x7126('0x48')](_0x1ccfeb['body'],{})[_0x7126('0x25')](respondWithResult(_0x3ab107,0xc9))[_0x7126('0x43')](handleError(_0x3ab107,null));};exports['update']=function(_0x1d1717,_0x498911){if(_0x1d1717[_0x7126('0x49')]['id']){delete _0x1d1717[_0x7126('0x49')]['id'];}return db[_0x7126('0x2b')][_0x7126('0x47')]({'where':{'id':_0x1d1717[_0x7126('0x45')]['id']}})[_0x7126('0x25')](handleEntityNotFound(_0x498911,null))[_0x7126('0x25')](saveUpdates(_0x1d1717[_0x7126('0x49')],null))[_0x7126('0x25')](respondWithResult(_0x498911,null))[_0x7126('0x43')](handleError(_0x498911,null));};exports[_0x7126('0x26')]=function(_0x209ed3,_0x17e123){return db[_0x7126('0x2b')][_0x7126('0x47')]({'where':{'id':_0x209ed3[_0x7126('0x45')]['id']}})[_0x7126('0x25')](handleEntityNotFound(_0x17e123,null))['then'](removeEntity(_0x17e123,null))['catch'](handleError(_0x17e123,null));};exports[_0x7126('0x4a')]=function(_0x50b781,_0x57f942){return db[_0x7126('0x2b')][_0x7126('0x4a')]()['then'](respondWithResult(_0x57f942,null))['catch'](handleError(_0x57f942,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 6ea13c0..de10279 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 _0xe31a=['bluebird','request-promise','../../config/environment','./whatsappTransferReport.attributes','exports','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','../../config/logger','api'];(function(_0x277107,_0x3420dc){var _0x1da046=function(_0x47122d){while(--_0x47122d){_0x277107['push'](_0x277107['shift']());}};_0x1da046(++_0x3420dc);}(_0xe31a,0xb8));var _0xae31=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xe31a[_0x2be8c2];return _0x97f531;};'use strict';var _=require('lodash');var util=require(_0xae31('0x0'));var logger=require(_0xae31('0x1'))(_0xae31('0x2'));var moment=require('moment');var BPromise=require(_0xae31('0x3'));var rp=require(_0xae31('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xae31('0x5'));var attributes=require(_0xae31('0x6'));module[_0xae31('0x7')]=function(_0x52e737,_0x5d374b){return _0x52e737['define'](_0xae31('0x8'),attributes,{'tableName':_0xae31('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xae31('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4b1c=['rimraf','../../config/environment','exports','define','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','moment','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b1c,0x8a));var _0xc4b1=function(_0x1188f2,_0x531547){_0x1188f2=_0x1188f2-0x0;var _0xb1e43c=_0x4b1c[_0x1188f2];return _0xb1e43c;};'use strict';var _=require(_0xc4b1('0x0'));var util=require(_0xc4b1('0x1'));var logger=require(_0xc4b1('0x2'))('api');var moment=require(_0xc4b1('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc4b1('0x4'));var rimraf=require(_0xc4b1('0x5'));var config=require(_0xc4b1('0x6'));var attributes=require('./whatsappTransferReport.attributes');module[_0xc4b1('0x7')]=function(_0x2c70a4,_0x44d5cb){return _0x2c70a4[_0xc4b1('0x8')]('WhatsappTransferReport',attributes,{'tableName':_0xc4b1('0x9'),'paranoid':![],'indexes':[{'name':_0xc4b1('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 6877b57..21b2f38 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 _0xb6d3=['WhatsappTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3f09f5,_0x50cf7a){var _0x420f34=function(_0x51e268){while(--_0x51e268){_0x3f09f5['push'](_0x3f09f5['shift']());}};_0x420f34(++_0x50cf7a);}(_0xb6d3,0x9b));var _0x3b6d=function(_0x25920b,_0x1870f5){_0x25920b=_0x25920b-0x0;var _0x7d2116=_0xb6d3[_0x25920b];return _0x7d2116;};'use strict';var _=require(_0x3b6d('0x0'));var util=require('util');var moment=require(_0x3b6d('0x1'));var BPromise=require(_0x3b6d('0x2'));var rs=require(_0x3b6d('0x3'));var fs=require('fs');var Redis=require(_0x3b6d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3b6d('0x5'))('rpc');var config=require(_0x3b6d('0x6'));var jayson=require(_0x3b6d('0x7'));var client=jayson[_0x3b6d('0x8')][_0x3b6d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb4322a,_0x4caa9d,_0xcd2d12){return new BPromise(function(_0x271533,_0x3d68c2){return client[_0x3b6d('0xa')](_0xb4322a,_0xcd2d12)[_0x3b6d('0xb')](function(_0x20fc11){logger[_0x3b6d('0xc')](_0x3b6d('0xd'),_0x4caa9d,'request\x20sent');logger[_0x3b6d('0xe')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x4caa9d,_0x3b6d('0xf'),JSON[_0x3b6d('0x10')](_0x20fc11));if(_0x20fc11['error']){if(_0x20fc11[_0x3b6d('0x11')][_0x3b6d('0x12')]===0x1f4){logger[_0x3b6d('0x11')](_0x3b6d('0xd'),_0x4caa9d,_0x20fc11[_0x3b6d('0x11')][_0x3b6d('0x13')]);return _0x3d68c2(_0x20fc11[_0x3b6d('0x11')][_0x3b6d('0x13')]);}logger['error'](_0x3b6d('0xd'),_0x4caa9d,_0x20fc11[_0x3b6d('0x11')][_0x3b6d('0x13')]);return _0x271533(_0x20fc11[_0x3b6d('0x11')][_0x3b6d('0x13')]);}else{logger[_0x3b6d('0xc')](_0x3b6d('0xd'),_0x4caa9d,_0x3b6d('0xf'));_0x271533(_0x20fc11[_0x3b6d('0x14')][_0x3b6d('0x13')]);}})['catch'](function(_0x29c35b){logger[_0x3b6d('0x11')](_0x3b6d('0xd'),_0x4caa9d,_0x29c35b);_0x3d68c2(_0x29c35b);});});} \ No newline at end of file +var _0x4d0a=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','randomstring'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x4d0a,0x176));var _0xa4d0=function(_0x2bd05e,_0x4059d4){_0x2bd05e=_0x2bd05e-0x0;var _0x596ac1=_0x4d0a[_0x2bd05e];return _0x596ac1;};'use strict';var _=require(_0xa4d0('0x0'));var util=require(_0xa4d0('0x1'));var moment=require(_0xa4d0('0x2'));var BPromise=require('bluebird');var rs=require(_0xa4d0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa4d0('0x4'));var logger=require(_0xa4d0('0x5'))(_0xa4d0('0x6'));var config=require(_0xa4d0('0x7'));var jayson=require(_0xa4d0('0x8'));var client=jayson[_0xa4d0('0x9')][_0xa4d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3241f9,_0x651319,_0xa93428){return new BPromise(function(_0x204662,_0xd68746){return client['request'](_0x3241f9,_0xa93428)[_0xa4d0('0xb')](function(_0x4661b3){logger[_0xa4d0('0xc')](_0xa4d0('0xd'),_0x651319,_0xa4d0('0xe'));logger[_0xa4d0('0xf')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x651319,_0xa4d0('0xe'),JSON[_0xa4d0('0x10')](_0x4661b3));if(_0x4661b3[_0xa4d0('0x11')]){if(_0x4661b3[_0xa4d0('0x11')][_0xa4d0('0x12')]===0x1f4){logger[_0xa4d0('0x11')]('WhatsappTransferReport,\x20%s,\x20%s',_0x651319,_0x4661b3[_0xa4d0('0x11')][_0xa4d0('0x13')]);return _0xd68746(_0x4661b3['error'][_0xa4d0('0x13')]);}logger[_0xa4d0('0x11')](_0xa4d0('0xd'),_0x651319,_0x4661b3[_0xa4d0('0x11')]['message']);return _0x204662(_0x4661b3[_0xa4d0('0x11')][_0xa4d0('0x13')]);}else{logger[_0xa4d0('0xc')](_0xa4d0('0xd'),_0x651319,_0xa4d0('0xe'));_0x204662(_0x4661b3['result']['message']);}})[_0xa4d0('0x14')](function(_0x1c27c0){logger['error'](_0xa4d0('0xd'),_0x651319,_0x1c27c0);_0xd68746(_0x1c27c0);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 9590932..ae1b2a2 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6726=['./config/environment','app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','start','info','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','name','Online\x20apps:','online','join','Offline\x20apps:','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/seedDB','./rpc'];(function(_0x5b40c9,_0x1448ca){var _0x1ed72d=function(_0xc6ac75){while(--_0xc6ac75){_0x5b40c9['push'](_0x5b40c9['shift']());}};_0x1ed72d(++_0x1448ca);}(_0x6726,0xdb));var _0x6672=function(_0x228641,_0x25d636){_0x228641=_0x228641-0x0;var _0x5d5d78=_0x6726[_0x228641];return _0x5d5d78;};'use strict';var _=require('lodash');var db=require(_0x6672('0x0'))['db'];var seedDb=require(_0x6672('0x1'));var checkLicense=require('./config/license');var rpc=require(_0x6672('0x2'));var config=require(_0x6672('0x3'));var logger=require('./config/logger')(_0x6672('0x4'));var pm2=require('./config/pm2');var pm2Config=require(_0x6672('0x5'));var schedule=require(_0x6672('0x6'));var chat=require(_0x6672('0x7'));var whatsapp=require(_0x6672('0x8'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0x6672('0x9'));function main(){return db[_0x6672('0xa')][_0x6672('0xb')]()[_0x6672('0xc')](function(){if(config[_0x6672('0xd')]){return seedDb[_0x6672('0xe')]();}})[_0x6672('0xc')](function(){return checkLicense[_0x6672('0xe')]();})[_0x6672('0xc')](function(){return rpc['listen']();})[_0x6672('0xc')](function(_0x327c71){logger['info'](_0x327c71);return chat[_0x6672('0xf')]();})[_0x6672('0xc')](function(){return whatsapp[_0x6672('0xf')]();})[_0x6672('0xc')](function(){return schedule[_0x6672('0xf')]();})[_0x6672('0xc')](function(){return transcribe[_0x6672('0xf')]();})[_0x6672('0xc')](function(){return provider[_0x6672('0xf')]();})['then'](function(_0x28ffad){logger[_0x6672('0x10')](_0x28ffad);return pm2[_0x6672('0xf')](pm2Config);})[_0x6672('0xc')](function(_0x1e3eb0){var _0x1446b3=_0x1e3eb0[_0x6672('0x11')](function(_0x514097){return typeof _0x514097[_0x6672('0x12')]===_0x6672('0x13')&&_0x514097[_0x6672('0x12')]>=0x0;});if(_0x1446b3[_0x6672('0x14')]>0x0){throw new Error(_0x1446b3[_0x6672('0x14')]+_0x6672('0x15')+_[_0x6672('0x16')](_0x1446b3,function(_0x184a79){return'\x22'+_0x184a79['pm2_env'][_0x6672('0x17')]+'\x22';}));}logger[_0x6672('0x10')](_0x6672('0x18'),_[_0x6672('0x16')](_['filter'](_0x1e3eb0,{'status':_0x6672('0x19')}),'name')[_0x6672('0x1a')]());logger['info'](_0x6672('0x1b'),_[_0x6672('0x16')](_['filter'](_0x1e3eb0,function(_0x636fed){return _0x636fed[_0x6672('0x1c')]!==_0x6672('0x19');}),'name')['join']()||_0x6672('0x1d'));console[_0x6672('0x1e')](_0x6672('0x1f'));})[_0x6672('0x20')](function(_0x357dea){console[_0x6672('0x1e')](_0x6672('0x21'),_0x357dea);logger[_0x6672('0x22')](_0x6672('0x23'),_0x357dea);process[_0x6672('0x24')](0x1);});}main(); \ No newline at end of file +var _0x4d61=['./config/logger','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','seedDB','then','listen','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','pm2_env','name','Online\x20apps:','map','online','join','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment'];(function(_0x445b74,_0x4ce650){var _0x292355=function(_0xf785bb){while(--_0xf785bb){_0x445b74['push'](_0x445b74['shift']());}};_0x292355(++_0x4ce650);}(_0x4d61,0x147));var _0x14d6=function(_0x1c1a14,_0x1d917f){_0x1c1a14=_0x1c1a14-0x0;var _0x559834=_0x4d61[_0x1c1a14];return _0x559834;};'use strict';var _=require(_0x14d6('0x0'));var db=require(_0x14d6('0x1'))['db'];var seedDb=require(_0x14d6('0x2'));var checkLicense=require(_0x14d6('0x3'));var rpc=require(_0x14d6('0x4'));var config=require(_0x14d6('0x5'));var logger=require(_0x14d6('0x6'))(_0x14d6('0x7'));var pm2=require(_0x14d6('0x8'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x14d6('0x9'));var chat=require(_0x14d6('0xa'));var whatsapp=require(_0x14d6('0xb'));var transcribe=require(_0x14d6('0xc'));var provider=require(_0x14d6('0xd'));function main(){return db[_0x14d6('0xe')][_0x14d6('0xf')]()['then'](function(){if(config[_0x14d6('0x10')]){return seedDb['default']();}})[_0x14d6('0x11')](function(){return checkLicense['default']();})[_0x14d6('0x11')](function(){return rpc[_0x14d6('0x12')]();})['then'](function(_0x16db02){logger[_0x14d6('0x13')](_0x16db02);return chat[_0x14d6('0x14')]();})[_0x14d6('0x11')](function(){return whatsapp[_0x14d6('0x14')]();})[_0x14d6('0x11')](function(){return schedule[_0x14d6('0x14')]();})[_0x14d6('0x11')](function(){return transcribe[_0x14d6('0x14')]();})[_0x14d6('0x11')](function(){return provider[_0x14d6('0x14')]();})['then'](function(_0x3047ee){logger[_0x14d6('0x13')](_0x3047ee);return pm2[_0x14d6('0x14')](pm2Config);})[_0x14d6('0x11')](function(_0x2c7e3a){var _0x494fe5=_0x2c7e3a[_0x14d6('0x15')](function(_0x3b42d5){return typeof _0x3b42d5[_0x14d6('0x16')]===_0x14d6('0x17')&&_0x3b42d5['exitCode']>=0x0;});if(_0x494fe5[_0x14d6('0x18')]>0x0){throw new Error(_0x494fe5[_0x14d6('0x18')]+_0x14d6('0x19')+_['map'](_0x494fe5,function(_0x463487){return'\x22'+_0x463487[_0x14d6('0x1a')][_0x14d6('0x1b')]+'\x22';}));}logger[_0x14d6('0x13')](_0x14d6('0x1c'),_[_0x14d6('0x1d')](_[_0x14d6('0x15')](_0x2c7e3a,{'status':_0x14d6('0x1e')}),_0x14d6('0x1b'))[_0x14d6('0x1f')]());logger[_0x14d6('0x13')]('Offline\x20apps:',_[_0x14d6('0x1d')](_[_0x14d6('0x15')](_0x2c7e3a,function(_0x10c210){return _0x10c210['status']!==_0x14d6('0x1e');}),_0x14d6('0x1b'))['join']()||'None');console[_0x14d6('0x20')]('App\x20Ready!');})['catch'](function(_0x2293f1){console[_0x14d6('0x20')](_0x14d6('0x21'),_0x2293f1);logger[_0x14d6('0x22')](_0x14d6('0x23'),_0x2293f1);process[_0x14d6('0x24')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index d19bd83..a348c1e 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 _0x2e3d=['voicePause','chatPause','faxPause','smsPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','hotdesk','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','isChatInteractionAuthorized','isAuthenticated','use','ChatInteraction','params','disposition','closed','status','unmanaged','json','Unmanaged.','Forbidden.','headers','authorization','startsWith','Basic','User','find','then','authenticate','pass','Wrong\x20credentials.','user','catch','query','apikey','Setting','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','canUpdate','Forbidden','getLicense','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','getUuid','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','splice','unshift','join','promisify','sign','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/license/hardware','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','util','moment','session','role','fullname','name','internal','email','userpic','md5secret'];(function(_0x1f7664,_0x491de2){var _0x3439ff=function(_0x1f0b59){while(--_0x1f0b59){_0x1f7664['push'](_0x1f7664['shift']());}};_0x3439ff(++_0x491de2);}(_0x2e3d,0x158));var _0xd2e3=function(_0x55d973,_0x34d949){_0x55d973=_0x55d973-0x0;var _0x3844e7=_0x2e3d[_0x55d973];return _0x3844e7;};'use strict';var db=require(_0xd2e3('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0xd2e3('0x1'));var licenseUtil=require(_0xd2e3('0x2'));var encryptor=require(_0xd2e3('0x3'));var _=require('lodash');var jwt=require(_0xd2e3('0x4'));var expressJwt=require(_0xd2e3('0x5'));var compose=require(_0xd2e3('0x6'));var basicAuth=require(_0xd2e3('0x7'));var crypto=require(_0xd2e3('0x8'));var BPromise=require('bluebird');var util=require(_0xd2e3('0x9'));var moment=require(_0xd2e3('0xa'));var validateJwt=expressJwt({'secret':config['secrets'][_0xd2e3('0xb')]});var userAttributes=['id',_0xd2e3('0xc'),_0xd2e3('0xd'),_0xd2e3('0xe'),_0xd2e3('0xf'),_0xd2e3('0x10'),_0xd2e3('0x11'),'permissions',_0xd2e3('0x12'),_0xd2e3('0x13'),_0xd2e3('0x14'),'mailPause',_0xd2e3('0x15'),_0xd2e3('0x16'),_0xd2e3('0x17'),_0xd2e3('0x18'),'showWebBar',_0xd2e3('0x19'),_0xd2e3('0x1a'),'crudPermissions',_0xd2e3('0x1b'),_0xd2e3('0x1c'),_0xd2e3('0x1d'),_0xd2e3('0x1e'),_0xd2e3('0x1f'),_0xd2e3('0x20'),_0xd2e3('0x21'),_0xd2e3('0x22'),_0xd2e3('0x23'),_0xd2e3('0x24'),'phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort',_0xd2e3('0x25'),'interface','userProfileId',_0xd2e3('0x26'),'settingsEnabled',_0xd2e3('0x27'),_0xd2e3('0x28'),_0xd2e3('0x29'),_0xd2e3('0x2a'),_0xd2e3('0x2b'),_0xd2e3('0x2c')];exports[_0xd2e3('0x2d')]=function(){return this[_0xd2e3('0x2e')](!![])[_0xd2e3('0x2f')](function(_0x39f449,_0x4366ec,_0x7da53b){if(_0x39f449['user']){_0x7da53b();}else{return db[_0xd2e3('0x30')]['findOne']({'where':{'id':_0x39f449[_0xd2e3('0x31')]['id']},'attributes':['id','closed',_0xd2e3('0x32')],'raw':!![]})['then'](function(_0x38cdf3){if(_0x38cdf3&&_0x38cdf3[_0xd2e3('0x33')]){return _0x4366ec[_0xd2e3('0x34')](_0x38cdf3[_0xd2e3('0x32')]===_0xd2e3('0x35')?0x195:0x193)[_0xd2e3('0x36')]({'message':_0x38cdf3['disposition']===_0xd2e3('0x35')?_0xd2e3('0x37'):_0xd2e3('0x38')});}else{_0x7da53b();}})['catch'](function(_0x36bd84){_0x7da53b(_0x36bd84);});}});};exports[_0xd2e3('0x2e')]=function isAuthenticated(_0x16cd8c){return compose()[_0xd2e3('0x2f')](function(_0x5d24d1,_0x18eabb,_0x4bdba9){var _0x258c1c;if(_0x5d24d1[_0xd2e3('0x39')][_0xd2e3('0x3a')]){if(_[_0xd2e3('0x3b')](_0x5d24d1[_0xd2e3('0x39')]['authorization'],_0xd2e3('0x3c'))){var _0x326f22=basicAuth(_0x5d24d1);db[_0xd2e3('0x3d')][_0xd2e3('0x3e')]({'where':{'name':_0x326f22[_0xd2e3('0xe')]}})[_0xd2e3('0x3f')](function(_0x99f266){if(!_0x99f266||!_0x99f266[_0xd2e3('0x40')](_0x326f22[_0xd2e3('0x41')])){return _0x18eabb[_0xd2e3('0x34')](0x191)[_0xd2e3('0x36')]({'message':_0xd2e3('0x42')});}_0x5d24d1[_0xd2e3('0x43')]={'id':_0x99f266['id']};_0x4bdba9();})[_0xd2e3('0x44')](function(_0x5a93da){_0x4bdba9(_0x5a93da);});}else if(_[_0xd2e3('0x3b')](_0x5d24d1[_0xd2e3('0x39')][_0xd2e3('0x3a')],'Bearer')){validateJwt(_0x5d24d1,_0x18eabb,_0x4bdba9);}else{if(_0x16cd8c){_0x4bdba9();}else{return _0x18eabb[_0xd2e3('0x34')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x5d24d1[_0xd2e3('0x45')]['apikey']){try{var _0x4762dc={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x5d24d1[_0xd2e3('0x45')][_0xd2e3('0x46')],_0x4762dc)['then'](function(_0x34b47a){return db[_0xd2e3('0x3d')][_0xd2e3('0x3e')]({'where':{'id':_0x34b47a['sub']}})[_0xd2e3('0x3f')](function(_0x1e25cd){_0x258c1c=_0x1e25cd;return db[_0xd2e3('0x47')]['findOne']({'where':{'id':0x1},'attributes':[_0xd2e3('0x48'),_0xd2e3('0x49')],'raw':!![]});})[_0xd2e3('0x3f')](function(_0xf09a2e){if(!_0x258c1c||!_['isEqual'](_0x258c1c[_0xd2e3('0x4a')],_0x34b47a[_0xd2e3('0x4b')])){return _0x18eabb['status'](0x191)[_0xd2e3('0x36')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x258c1c[_0xd2e3('0x4c')]){return _0x18eabb[_0xd2e3('0x34')](0x191)[_0xd2e3('0x36')]({'message':_0xd2e3('0x4d')});}if(_0x258c1c[_0xd2e3('0x4e')]){if(_0xf09a2e[_0xd2e3('0x49')]>0x0){if(moment(_0x258c1c[_0xd2e3('0x4f')])[_0xd2e3('0x50')](_0xf09a2e[_0xd2e3('0x49')],_0xd2e3('0x51'))>moment()){return _0x18eabb[_0xd2e3('0x34')](0x191)[_0xd2e3('0x36')]({'message':_0xd2e3('0x4d')});}}else{return _0x18eabb[_0xd2e3('0x34')](0x191)[_0xd2e3('0x36')]({'message':_0xd2e3('0x4d')});}}_0x5d24d1['user']={'id':_0x258c1c['id']};_0x4bdba9();});})['catch'](function(){return _0x18eabb[_0xd2e3('0x34')](0x191)[_0xd2e3('0x36')]({'message':_0xd2e3('0x4d')});});}catch(_0x2db38e){_0x4bdba9(_0x2db38e);}}else if(_0x16cd8c){_0x4bdba9();}else{return _0x18eabb[_0xd2e3('0x34')](0x193)[_0xd2e3('0x36')]({'message':'Unknown\x20authorization\x20format'});}})['use'](function(_0x366c7b,_0x57fea4,_0x430c3e){if(_0x366c7b['user']){db[_0xd2e3('0x3d')]['find']({'where':{'id':_0x366c7b[_0xd2e3('0x43')]['id']},'attributes':userAttributes})[_0xd2e3('0x3f')](function(_0x169dff){if(!_0x169dff){return _0x57fea4['status'](0x194)['json']({'message':'User\x20not\x20found.'});}_0x366c7b[_0xd2e3('0x43')]=_0x169dff;_0x430c3e();})[_0xd2e3('0x44')](function(_0x5b8894){_0x430c3e(_0x5b8894);});}else if(_0x16cd8c){_0x430c3e();}else{return _0x57fea4['status'](0x194)[_0xd2e3('0x36')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xd2e3('0x52')]=function canUpdate(){return compose()['use'](function(_0x3e861b,_0x1b8340,_0x592b0f){return licenseUtil['getLicense']()[_0xd2e3('0x3f')](function(_0x246319){if(_0x246319['update']){_0x592b0f();}else{return _0x1b8340[_0xd2e3('0x34')](0x193)['json']({'message':_0xd2e3('0x53')});}})[_0xd2e3('0x44')](function(_0x50927f){_0x592b0f(_0x50927f);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0xd2e3('0x2f')](function(_0x42d79f,_0x10ad18,_0x3b7cf3){return licenseUtil[_0xd2e3('0x54')]()[_0xd2e3('0x3f')](function(_0x11b661){if(_0x11b661[_0xd2e3('0x55')]){_0x3b7cf3();}else{return _0x10ad18[_0xd2e3('0x34')](0x193)['json']({'message':'Forbidden'});}})[_0xd2e3('0x44')](function(_0x426c40){_0x3b7cf3(_0x426c40);});});};exports[_0xd2e3('0x56')]=function(_0xa1f69a,_0x242396,_0x145c47){_0xa1f69a[_0xd2e3('0x56')]=!![];return _0x145c47();};exports[_0xd2e3('0x57')]=function signToken(_0x4e178a){return signJwt(_0x4e178a);};exports[_0xd2e3('0x58')]=function(_0x4bb3ee,_0x3e5265){if(!_0x4bb3ee['user']){return _0x3e5265[_0xd2e3('0x34')](0x194)['json']({'message':_0xd2e3('0x59')});}var _0x25e6cb={'payload':{'id':_0x4bb3ee[_0xd2e3('0x43')]['id'],'role':_0x4bb3ee[_0xd2e3('0x43')][_0xd2e3('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x25e6cb)[_0xd2e3('0x3f')](function(_0x3d1d56){_0x3e5265[_0xd2e3('0x5a')](_0xd2e3('0x5b'),_0x3d1d56);_0x3e5265[_0xd2e3('0x5c')]('/dashboards/general');})[_0xd2e3('0x44')](function(_0x5de628){return _0x3e5265[_0xd2e3('0x34')](0x1f4)['send'](_0x5de628);});};exports[_0xd2e3('0x5d')]=function(_0x142f4f){if(_['isNil'](_0x142f4f['apiKeyNonce'])||_[_0xd2e3('0x5e')](_0x142f4f['apiKeyIat'])){return null;}else{return createJwt(_0x142f4f);}};exports['generateApiKey']=function(_0x487e64){_0x487e64[_0xd2e3('0x4a')]=generateNonce();_0x487e64[_0xd2e3('0x5f')]=generateIssuedAt();return createJwt(_0x487e64);};exports[_0xd2e3('0x60')]=function(_0x568e46,_0x18ffaf){var _0x528772=_0x568e46[_0xd2e3('0x45')][_0xd2e3('0x46')];if(_0x528772){var _0x55c55a={'nonce':_0x18ffaf[_0xd2e3('0x4a')],'iat':_0x18ffaf[_0xd2e3('0x5f')],'audience':hardwareConf[_0xd2e3('0x61')](),'issuer':hardwareConf[_0xd2e3('0x61')]()};return verifyJwt(_0x528772,_0x55c55a)[_0xd2e3('0x3f')](function(){return generateApiKey(_0x18ffaf);});}else{throw{'message':_0xd2e3('0x62')};}};exports[_0xd2e3('0x63')]=function(_0x4fd1a6){var _0x81b28f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x81b28f[_0xd2e3('0x64')](_0x4fd1a6))throw new db[(_0xd2e3('0x65'))][(_0xd2e3('0x66'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0xd2e3('0x67')]=function(_0x518491,_0x1e5450,_0x347057){var _0x26d955=encryptor[_0xd2e3('0x68')](_0x1e5450)[_0xd2e3('0x69')](',');for(var _0x132034=0x0;_0x132034<_0x347057;_0x132034++){if(!_0x26d955[_0x132034])break;if(_0x518491['toLowerCase']()===_0x26d955[_0x132034]['toLowerCase']()){var _0x14d0f7=util[_0xd2e3('0x6a')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x347057);if(_0x347057===0x1){_0x14d0f7=_0xd2e3('0x6b');}throw new db[(_0xd2e3('0x65'))][(_0xd2e3('0x66'))](_0x14d0f7);}}return;};exports['updatePasswordsHistory']=function(_0x2772e6,_0x4ad2e1){var _0x1183ba=_0x4ad2e1?encryptor[_0xd2e3('0x68')](_0x4ad2e1)[_0xd2e3('0x69')](','):[];if(_0x1183ba['length']===0x5){_0x1183ba[_0xd2e3('0x6c')](-0x1,0x1);}_0x1183ba[_0xd2e3('0x6d')](_0x2772e6);return encryptor['encryptString'](_0x1183ba[_0xd2e3('0x6e')](','));};function signJwt(_0x3ea6ed){var _0x2a9ff5=BPromise[_0xd2e3('0x6f')](jwt[_0xd2e3('0x70')],{'context':jwt});var _0x15740f=_0x3ea6ed['secret']||config['secrets'][_0xd2e3('0xb')];return new BPromise(function(_0x327500,_0x408bce){_0x2a9ff5(_0x3ea6ed['payload'],_0x15740f,_0x3ea6ed[_0xd2e3('0x71')])[_0xd2e3('0x3f')](function(_0x58fdd5){_0x327500(_0x58fdd5);})[_0xd2e3('0x44')](function(_0x11b227){_0x408bce(_0x11b227);});});}function verifyJwt(_0xf998dd,_0x31168a,_0x350e30){var _0x265e65=BPromise[_0xd2e3('0x6f')](jwt[_0xd2e3('0x72')],{'context':jwt});var _0x36bcf2=_0x350e30||config['secrets'][_0xd2e3('0xb')];return new BPromise(function(_0x43cf47,_0x1196a5){_0x265e65(_0xf998dd,_0x36bcf2,_0x31168a)[_0xd2e3('0x3f')](function(_0x540c89){_0x43cf47(_0x540c89);})[_0xd2e3('0x44')](function(_0x389ea0){_0x1196a5(_0x389ea0);});});}function generateNonce(){return crypto[_0xd2e3('0x73')](0x10)[_0xd2e3('0x74')](_0xd2e3('0x75'));}function generateIssuedAt(){return Math[_0xd2e3('0x76')](Date[_0xd2e3('0x77')]()/0x3e8)['toString']();}function createJwt(_0x573220){var _0x18ba7b={'payload':{'iat':_0x573220[_0xd2e3('0x5f')],'nonce':_0x573220[_0xd2e3('0x4a')]},'options':{'algorithm':_0xd2e3('0x78'),'subject':_0x573220['id']['toString'](),'issuer':hardwareConf[_0xd2e3('0x61')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x18ba7b)['then'](function(_0x55d1e2){return{'iat':_0x573220[_0xd2e3('0x5f')],'nonce':_0x573220['apiKeyNonce'],'token':_0x55d1e2};});} \ No newline at end of file +var _0xea4f=['signToken','cookie','motion.token','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','getUuid','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','Sequelize','ValidationError','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','encryptString','join','session','payload','options','promisify','verify','secrets','randomBytes','toString','HS512','../../mysqldb','../../config/license/util','../encryptor','lodash','express-jwt','basic-auth','crypto','bluebird','util','moment','role','userpic','permissions','md5secret','chatPause','mailPause','smsPause','openchannelPause','pauseType','showWebBar','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableSettings','phoneBarRemoteControl','hotdesk','interface','userProfileId','privacyEnabled','wssPort','downloadOmnichannelInteractions','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','user','findOne','closed','disposition','then','unmanaged','json','Unmanaged.','Forbidden.','catch','use','headers','authorization','startsWith','Basic','User','find','name','authenticate','pass','Bearer','status','Unknown\x20authorization\x20format','query','apikey','sub','allowedLoginAttempts','blockDuration','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','add','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','Forbidden','isWebrtcLicence','isMiddleware'];(function(_0x12633c,_0x1f3ee9){var _0x5a9084=function(_0x5c8917){while(--_0x5c8917){_0x12633c['push'](_0x12633c['shift']());}};_0x5a9084(++_0x1f3ee9);}(_0xea4f,0x167));var _0xfea4=function(_0x46e4f0,_0x40b64a){_0x46e4f0=_0x46e4f0-0x0;var _0x303714=_0xea4f[_0x46e4f0];return _0x303714;};'use strict';var db=require(_0xfea4('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xfea4('0x1'));var encryptor=require(_0xfea4('0x2'));var _=require(_0xfea4('0x3'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xfea4('0x4'));var compose=require('composable-middleware');var basicAuth=require(_0xfea4('0x5'));var crypto=require(_0xfea4('0x6'));var BPromise=require(_0xfea4('0x7'));var util=require(_0xfea4('0x8'));var moment=require(_0xfea4('0x9'));var validateJwt=expressJwt({'secret':config['secrets']['session']});var userAttributes=['id',_0xfea4('0xa'),'fullname','name','internal','email',_0xfea4('0xb'),_0xfea4('0xc'),_0xfea4('0xd'),'voicePause',_0xfea4('0xe'),_0xfea4('0xf'),'faxPause',_0xfea4('0x10'),_0xfea4('0x11'),_0xfea4('0x12'),_0xfea4('0x13'),'lastLoginAt','lastPauseAt',_0xfea4('0x14'),_0xfea4('0x15'),_0xfea4('0x16'),'alias',_0xfea4('0x17'),_0xfea4('0x18'),_0xfea4('0x19'),'phoneBarEnableRecording','phoneBarEnableDtmfTone',_0xfea4('0x1a'),'phoneBarExpires','phoneBarPrefixRequired',_0xfea4('0x1b'),'phoneBarRemoteControlPort',_0xfea4('0x1c'),_0xfea4('0x1d'),_0xfea4('0x1e'),_0xfea4('0x1f'),'settingsEnabled',_0xfea4('0x20'),'downloadVoiceRecordings',_0xfea4('0x21'),_0xfea4('0x22'),'ignorePauseForPreviewCalls','selectRecallMeCampaign'];exports[_0xfea4('0x23')]=function(){return this[_0xfea4('0x24')](!![])['use'](function(_0x511fc5,_0x509d64,_0x1e079f){if(_0x511fc5[_0xfea4('0x25')]){_0x1e079f();}else{return db['ChatInteraction'][_0xfea4('0x26')]({'where':{'id':_0x511fc5['params']['id']},'attributes':['id',_0xfea4('0x27'),_0xfea4('0x28')],'raw':!![]})[_0xfea4('0x29')](function(_0x29a435){if(_0x29a435&&_0x29a435[_0xfea4('0x27')]){return _0x509d64['status'](_0x29a435[_0xfea4('0x28')]===_0xfea4('0x2a')?0x195:0x193)[_0xfea4('0x2b')]({'message':_0x29a435[_0xfea4('0x28')]==='unmanaged'?_0xfea4('0x2c'):_0xfea4('0x2d')});}else{_0x1e079f();}})[_0xfea4('0x2e')](function(_0x43ad45){_0x1e079f(_0x43ad45);});}});};exports[_0xfea4('0x24')]=function isAuthenticated(_0x560c27){return compose()[_0xfea4('0x2f')](function(_0x27205f,_0x60c316,_0x31830a){var _0x1c125f;if(_0x27205f[_0xfea4('0x30')][_0xfea4('0x31')]){if(_[_0xfea4('0x32')](_0x27205f[_0xfea4('0x30')][_0xfea4('0x31')],_0xfea4('0x33'))){var _0x136b93=basicAuth(_0x27205f);db[_0xfea4('0x34')][_0xfea4('0x35')]({'where':{'name':_0x136b93[_0xfea4('0x36')]}})[_0xfea4('0x29')](function(_0x119267){if(!_0x119267||!_0x119267[_0xfea4('0x37')](_0x136b93[_0xfea4('0x38')])){return _0x60c316['status'](0x191)['json']({'message':'Wrong\x20credentials.'});}_0x27205f[_0xfea4('0x25')]={'id':_0x119267['id']};_0x31830a();})['catch'](function(_0xd49769){_0x31830a(_0xd49769);});}else if(_[_0xfea4('0x32')](_0x27205f['headers'][_0xfea4('0x31')],_0xfea4('0x39'))){validateJwt(_0x27205f,_0x60c316,_0x31830a);}else{if(_0x560c27){_0x31830a();}else{return _0x60c316[_0xfea4('0x3a')](0x193)[_0xfea4('0x2b')]({'message':_0xfea4('0x3b')});}}}else if(_0x27205f[_0xfea4('0x3c')][_0xfea4('0x3d')]){try{var _0x4d7ab0={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x27205f[_0xfea4('0x3c')][_0xfea4('0x3d')],_0x4d7ab0)[_0xfea4('0x29')](function(_0x2dd264){return db[_0xfea4('0x34')][_0xfea4('0x35')]({'where':{'id':_0x2dd264[_0xfea4('0x3e')]}})['then'](function(_0x4e015a){_0x1c125f=_0x4e015a;return db['Setting'][_0xfea4('0x26')]({'where':{'id':0x1},'attributes':[_0xfea4('0x3f'),_0xfea4('0x40')],'raw':!![]});})['then'](function(_0x40c4e1){if(!_0x1c125f||!_['isEqual'](_0x1c125f[_0xfea4('0x41')],_0x2dd264['nonce'])){return _0x60c316['status'](0x191)[_0xfea4('0x2b')]({'message':_0xfea4('0x42')});}if(_0x1c125f[_0xfea4('0x43')]){return _0x60c316[_0xfea4('0x3a')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}if(_0x1c125f[_0xfea4('0x44')]){if(_0x40c4e1['blockDuration']>0x0){if(moment(_0x1c125f['blockedAt'])[_0xfea4('0x45')](_0x40c4e1[_0xfea4('0x40')],'minutes')>moment()){return _0x60c316[_0xfea4('0x3a')](0x191)[_0xfea4('0x2b')]({'message':_0xfea4('0x46')});}}else{return _0x60c316[_0xfea4('0x3a')](0x191)[_0xfea4('0x2b')]({'message':_0xfea4('0x46')});}}_0x27205f['user']={'id':_0x1c125f['id']};_0x31830a();});})[_0xfea4('0x2e')](function(){return _0x60c316['status'](0x191)[_0xfea4('0x2b')]({'message':_0xfea4('0x46')});});}catch(_0x3cd431){_0x31830a(_0x3cd431);}}else if(_0x560c27){_0x31830a();}else{return _0x60c316[_0xfea4('0x3a')](0x193)[_0xfea4('0x2b')]({'message':_0xfea4('0x3b')});}})['use'](function(_0x2235ae,_0x32d054,_0x2ad4bc){if(_0x2235ae[_0xfea4('0x25')]){db[_0xfea4('0x34')]['find']({'where':{'id':_0x2235ae[_0xfea4('0x25')]['id']},'attributes':userAttributes})[_0xfea4('0x29')](function(_0x3b7161){if(!_0x3b7161){return _0x32d054[_0xfea4('0x3a')](0x194)[_0xfea4('0x2b')]({'message':_0xfea4('0x47')});}_0x2235ae['user']=_0x3b7161;_0x2ad4bc();})[_0xfea4('0x2e')](function(_0x27c1d5){_0x2ad4bc(_0x27c1d5);});}else if(_0x560c27){_0x2ad4bc();}else{return _0x32d054[_0xfea4('0x3a')](0x194)[_0xfea4('0x2b')]({'message':_0xfea4('0x48')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xfea4('0x2f')](function(_0x2f49d8,_0xec6726,_0xe69c9c){return licenseUtil[_0xfea4('0x49')]()[_0xfea4('0x29')](function(_0x83bfe2){if(_0x83bfe2['update']){_0xe69c9c();}else{return _0xec6726['status'](0x193)[_0xfea4('0x2b')]({'message':_0xfea4('0x4a')});}})['catch'](function(_0x3f67e2){_0xe69c9c(_0x3f67e2);});});};exports[_0xfea4('0x4b')]=function isWebrtcLicence(){return compose()['use'](function(_0x564706,_0x2cc2dd,_0x4b3ed9){return licenseUtil[_0xfea4('0x49')]()['then'](function(_0x2b058c){if(_0x2b058c['webrtc']){_0x4b3ed9();}else{return _0x2cc2dd[_0xfea4('0x3a')](0x193)[_0xfea4('0x2b')]({'message':'Forbidden'});}})[_0xfea4('0x2e')](function(_0x4d9b7c){_0x4b3ed9(_0x4d9b7c);});});};exports['isMiddleware']=function(_0x3a6b1f,_0x1c5f0e,_0x108d4d){_0x3a6b1f[_0xfea4('0x4c')]=!![];return _0x108d4d();};exports[_0xfea4('0x4d')]=function signToken(_0x4fbb51){return signJwt(_0x4fbb51);};exports['setTokenCookie']=function(_0x3db8bd,_0xd824d2){if(!_0x3db8bd[_0xfea4('0x25')]){return _0xd824d2['status'](0x194)[_0xfea4('0x2b')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x4dc746={'payload':{'id':_0x3db8bd[_0xfea4('0x25')]['id'],'role':_0x3db8bd[_0xfea4('0x25')][_0xfea4('0xa')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4dc746)[_0xfea4('0x29')](function(_0xf027ba){_0xd824d2[_0xfea4('0x4e')](_0xfea4('0x4f'),_0xf027ba);_0xd824d2['redirect'](_0xfea4('0x50'));})['catch'](function(_0x1f02ee){return _0xd824d2[_0xfea4('0x3a')](0x1f4)[_0xfea4('0x51')](_0x1f02ee);});};exports[_0xfea4('0x52')]=function(_0x5d621d){if(_[_0xfea4('0x53')](_0x5d621d[_0xfea4('0x41')])||_[_0xfea4('0x53')](_0x5d621d[_0xfea4('0x54')])){return null;}else{return createJwt(_0x5d621d);}};exports['generateApiKey']=function(_0x22a1e3){_0x22a1e3[_0xfea4('0x41')]=generateNonce();_0x22a1e3[_0xfea4('0x54')]=generateIssuedAt();return createJwt(_0x22a1e3);};exports['regenerateApiKey']=function(_0x382482,_0x2c96f8){var _0x3fe1a9=_0x382482[_0xfea4('0x3c')][_0xfea4('0x3d')];if(_0x3fe1a9){var _0x1547f2={'nonce':_0x2c96f8[_0xfea4('0x41')],'iat':_0x2c96f8[_0xfea4('0x54')],'audience':hardwareConf[_0xfea4('0x55')](),'issuer':hardwareConf[_0xfea4('0x55')]()};return verifyJwt(_0x3fe1a9,_0x1547f2)[_0xfea4('0x29')](function(){return generateApiKey(_0x2c96f8);});}else{throw{'message':_0xfea4('0x56')};}};exports['validatePasswordPattern']=function(_0x500a93){var _0x793bb5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x793bb5[_0xfea4('0x57')](_0x500a93))throw new db[(_0xfea4('0x58'))][(_0xfea4('0x59'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports['validatePasswordHistory']=function(_0x139779,_0x31e842,_0x3f0ba0){var _0x555a3c=encryptor[_0xfea4('0x5a')](_0x31e842)[_0xfea4('0x5b')](',');for(var _0x12aba8=0x0;_0x12aba8<_0x3f0ba0;_0x12aba8++){if(!_0x555a3c[_0x12aba8])break;if(_0x139779['toLowerCase']()===_0x555a3c[_0x12aba8][_0xfea4('0x5c')]()){var _0x959512=util[_0xfea4('0x5d')](_0xfea4('0x5e'),_0x3f0ba0);if(_0x3f0ba0===0x1){_0x959512=_0xfea4('0x5f');}throw new db[(_0xfea4('0x58'))]['ValidationError'](_0x959512);}}return;};exports[_0xfea4('0x60')]=function(_0x1fe8a2,_0x5e9c57){var _0x3cc37f=_0x5e9c57?encryptor[_0xfea4('0x5a')](_0x5e9c57)['split'](','):[];if(_0x3cc37f[_0xfea4('0x61')]===0x5){_0x3cc37f['splice'](-0x1,0x1);}_0x3cc37f['unshift'](_0x1fe8a2);return encryptor[_0xfea4('0x62')](_0x3cc37f[_0xfea4('0x63')](','));};function signJwt(_0x25b0c1){var _0x55ac58=BPromise['promisify'](jwt['sign'],{'context':jwt});var _0x36d8ab=_0x25b0c1['secret']||config['secrets'][_0xfea4('0x64')];return new BPromise(function(_0x5a6f3a,_0x3f97fc){_0x55ac58(_0x25b0c1[_0xfea4('0x65')],_0x36d8ab,_0x25b0c1[_0xfea4('0x66')])['then'](function(_0x30d849){_0x5a6f3a(_0x30d849);})[_0xfea4('0x2e')](function(_0x1c5e94){_0x3f97fc(_0x1c5e94);});});}function verifyJwt(_0x5b8cc4,_0x44997b,_0x27cde2){var _0x46ede2=BPromise[_0xfea4('0x67')](jwt[_0xfea4('0x68')],{'context':jwt});var _0x50aa4e=_0x27cde2||config[_0xfea4('0x69')][_0xfea4('0x64')];return new BPromise(function(_0x35cb9d,_0x49e99b){_0x46ede2(_0x5b8cc4,_0x50aa4e,_0x44997b)[_0xfea4('0x29')](function(_0x1de6e5){_0x35cb9d(_0x1de6e5);})[_0xfea4('0x2e')](function(_0x253919){_0x49e99b(_0x253919);});});}function generateNonce(){return crypto[_0xfea4('0x6a')](0x10)['toString']('hex');}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0xfea4('0x6b')]();}function createJwt(_0x4c97ae){var _0x2c6093={'payload':{'iat':_0x4c97ae[_0xfea4('0x54')],'nonce':_0x4c97ae[_0xfea4('0x41')]},'options':{'algorithm':_0xfea4('0x6c'),'subject':_0x4c97ae['id'][_0xfea4('0x6b')](),'issuer':hardwareConf[_0xfea4('0x55')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x2c6093)['then'](function(_0x498580){return{'iat':_0x4c97ae[_0xfea4('0x54')],'nonce':_0x4c97ae[_0xfea4('0x41')],'token':_0x498580};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index bf34485..0836636 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 _0x0bf8=['../../config/logger','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','test','getCiphers','filter','indexOf','hasOwnProperty','createReadStream','createWriteStream','createCipher','data','update','binary','write','end','final','close','decryptFile','unlink','encryptString','secret','utf8','base64','createDecipher','crypto','bluebird','lodash','../../config/environment'];(function(_0x22086f,_0x39b182){var _0x5f5c66=function(_0x1d9263){while(--_0x1d9263){_0x22086f['push'](_0x22086f['shift']());}};_0x5f5c66(++_0x39b182);}(_0x0bf8,0xea));var _0x80bf=function(_0x184ae4,_0x511d97){_0x184ae4=_0x184ae4-0x0;var _0x5bb118=_0x0bf8[_0x184ae4];return _0x5bb118;};'use strict';var crypto=require(_0x80bf('0x0'));var fs=require('fs');var BPromise=require(_0x80bf('0x1'));var _=require(_0x80bf('0x2'));var config=require(_0x80bf('0x3'));var logger=require(_0x80bf('0x4'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x80bf('0x5')][_0x80bf('0x6')],'algorithm':_0x80bf('0x7')};const fileOptions={'algorithm':_0x80bf('0x8')};if(config[_0x80bf('0x9')]&&config['encrypt'][_0x80bf('0xa')]){var isSupported=isAlgorithmSupported(config[_0x80bf('0x9')][_0x80bf('0xa')]);if(isSupported){fileOptions[_0x80bf('0xa')]=config['encrypt'][_0x80bf('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x80bf('0xb')](',\x20');logger['error'](config[_0x80bf('0x9')]['algorithm'],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x5bf9e2){return AES_SUPPORTED_RX[_0x80bf('0xc')](_0x5bf9e2);}function getSupportedCiphers(){return crypto[_0x80bf('0xd')]()[_0x80bf('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x1668c7){return getSupportedCiphers()[_0x80bf('0xf')](_0x1668c7)>-0x1;}function combineOptions(_0x23473a){var _0x96d258={};for(var _0x4033fb in fileOptions){if(fileOptions[_0x80bf('0x10')](_0x4033fb)){_0x96d258[_0x4033fb]=fileOptions[_0x4033fb];}}if(_0x23473a){for(var _0x5d1083 in _0x23473a){if(_0x23473a['hasOwnProperty'](_0x5d1083)){_0x96d258[_0x5d1083]=_0x23473a[_0x5d1083];}}}return _0x96d258;}exports['encryptFile']=function(_0x1b6abb,_0x403aa6,_0x3b4792,_0x7f7fd){return new BPromise(function(_0x2783b8,_0x2a7f7c){_0x7f7fd=combineOptions(_0x7f7fd);var _0x85e049=new Buffer(_0x3b4792);var _0x505e23=fs[_0x80bf('0x11')](_0x1b6abb);var _0x749fc8=fs[_0x80bf('0x12')](_0x403aa6);var _0x1def60=crypto[_0x80bf('0x13')](_0x7f7fd[_0x80bf('0xa')],_0x85e049);_0x505e23['on'](_0x80bf('0x14'),function(_0x26d717){var _0x352fac=new Buffer(_0x1def60[_0x80bf('0x15')](_0x26d717),_0x80bf('0x16'));_0x749fc8[_0x80bf('0x17')](_0x352fac);});_0x505e23['on'](_0x80bf('0x18'),function(){try{var _0x2154ce=new Buffer(_0x1def60[_0x80bf('0x19')](_0x80bf('0x16')),_0x80bf('0x16'));_0x749fc8[_0x80bf('0x17')](_0x2154ce);_0x749fc8[_0x80bf('0x18')]();_0x749fc8['on'](_0x80bf('0x1a'),function(){return _0x2783b8(_0x403aa6);});}catch(_0x4269e1){fs['unlink'](_0x403aa6);return _0x2a7f7c(_0x4269e1);}});});};exports[_0x80bf('0x1b')]=function(_0x463ea1,_0x10748e,_0x3adf5e,_0x20333e){return new BPromise(function(_0x515ba8,_0x5ebf4d){_0x20333e=combineOptions(_0x20333e);var _0x38514e=new Buffer(_0x3adf5e);var _0x111b65=fs[_0x80bf('0x11')](_0x463ea1);var _0x550e78=fs[_0x80bf('0x12')](_0x10748e);var _0x17fa62=crypto['createDecipher'](_0x20333e[_0x80bf('0xa')],_0x38514e);_0x111b65['on']('data',function(_0x18412a){var _0x541e14=new Buffer(_0x17fa62[_0x80bf('0x15')](_0x18412a),'binary');_0x550e78['write'](_0x541e14);});_0x111b65['on'](_0x80bf('0x18'),function(){try{var _0x47edb4=new Buffer(_0x17fa62[_0x80bf('0x19')](_0x80bf('0x16')),_0x80bf('0x16'));_0x550e78[_0x80bf('0x17')](_0x47edb4);_0x550e78['end']();_0x550e78['on'](_0x80bf('0x1a'),function(){return _0x515ba8(_0x10748e);});}catch(_0x479ee6){fs[_0x80bf('0x1c')](_0x10748e);return _0x5ebf4d(_0x479ee6);}});});};exports[_0x80bf('0x1d')]=function(_0x427df7,_0x1290cf,_0x520c6c){var _0x55e3d5=_0x520c6c||stringOptions['algorithm'];var _0x1ec700=_0x1290cf||stringOptions[_0x80bf('0x1e')];var _0x5a3342=crypto[_0x80bf('0x13')](_0x55e3d5,_0x1ec700);var _0x42bf79=_0x5a3342['update'](_0x427df7,_0x80bf('0x1f'),_0x80bf('0x20'));_0x42bf79+=_0x5a3342[_0x80bf('0x19')](_0x80bf('0x20'));return _0x42bf79;};exports['decryptString']=function(_0x432c9d,_0x370801,_0xfa1657){var _0x518581=_0xfa1657||stringOptions[_0x80bf('0xa')];var _0x32a245=_0x370801||stringOptions[_0x80bf('0x1e')];var _0x54b3af=crypto[_0x80bf('0x21')](_0x518581,_0x32a245);var _0x1d6788=_0x54b3af[_0x80bf('0x15')](_0x432c9d,'base64','utf8');_0x1d6788+=_0x54b3af[_0x80bf('0x19')](_0x80bf('0x1f'));return _0x1d6788;}; \ No newline at end of file +var _0x8b54=['../../config/logger','app','secrets','session','aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','indexOf','hasOwnProperty','encryptFile','createWriteStream','createCipher','data','update','binary','write','final','close','unlink','decryptFile','createReadStream','createDecipher','end','encryptString','secret','utf8','base64','crypto','bluebird','../../config/environment'];(function(_0x50ac2e,_0x316214){var _0x1c7984=function(_0x3ab94c){while(--_0x3ab94c){_0x50ac2e['push'](_0x50ac2e['shift']());}};_0x1c7984(++_0x316214);}(_0x8b54,0x1aa));var _0x48b5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8b54[_0x321bb2];return _0x9c12ed;};'use strict';var crypto=require(_0x48b5('0x0'));var fs=require('fs');var BPromise=require(_0x48b5('0x1'));var _=require('lodash');var config=require(_0x48b5('0x2'));var logger=require(_0x48b5('0x3'))(_0x48b5('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x48b5('0x5')][_0x48b5('0x6')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x48b5('0x7')};if(config['encrypt']&&config[_0x48b5('0x8')][_0x48b5('0x9')]){var isSupported=isAlgorithmSupported(config[_0x48b5('0x8')][_0x48b5('0x9')]);if(isSupported){fileOptions[_0x48b5('0x9')]=config[_0x48b5('0x8')][_0x48b5('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x48b5('0xa')](',\x20');logger['error'](config[_0x48b5('0x8')][_0x48b5('0x9')],_0x48b5('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x262afb){return AES_SUPPORTED_RX['test'](_0x262afb);}function getSupportedCiphers(){return crypto[_0x48b5('0xc')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x48f357){return getSupportedCiphers()[_0x48b5('0xd')](_0x48f357)>-0x1;}function combineOptions(_0x707a32){var _0x224636={};for(var _0x2e4be8 in fileOptions){if(fileOptions['hasOwnProperty'](_0x2e4be8)){_0x224636[_0x2e4be8]=fileOptions[_0x2e4be8];}}if(_0x707a32){for(var _0x3f1428 in _0x707a32){if(_0x707a32[_0x48b5('0xe')](_0x3f1428)){_0x224636[_0x3f1428]=_0x707a32[_0x3f1428];}}}return _0x224636;}exports[_0x48b5('0xf')]=function(_0xe056cd,_0x37e3d1,_0x478125,_0x249dec){return new BPromise(function(_0x2ad9ab,_0x67649c){_0x249dec=combineOptions(_0x249dec);var _0x35673e=new Buffer(_0x478125);var _0x48c40f=fs['createReadStream'](_0xe056cd);var _0x456adc=fs[_0x48b5('0x10')](_0x37e3d1);var _0x33c6bb=crypto[_0x48b5('0x11')](_0x249dec[_0x48b5('0x9')],_0x35673e);_0x48c40f['on'](_0x48b5('0x12'),function(_0x5ca8c9){var _0x14d37e=new Buffer(_0x33c6bb[_0x48b5('0x13')](_0x5ca8c9),_0x48b5('0x14'));_0x456adc[_0x48b5('0x15')](_0x14d37e);});_0x48c40f['on']('end',function(){try{var _0x295edc=new Buffer(_0x33c6bb[_0x48b5('0x16')](_0x48b5('0x14')),_0x48b5('0x14'));_0x456adc[_0x48b5('0x15')](_0x295edc);_0x456adc['end']();_0x456adc['on'](_0x48b5('0x17'),function(){return _0x2ad9ab(_0x37e3d1);});}catch(_0xfb7380){fs[_0x48b5('0x18')](_0x37e3d1);return _0x67649c(_0xfb7380);}});});};exports[_0x48b5('0x19')]=function(_0x190c17,_0x3dd148,_0xfbf9ba,_0x54eea9){return new BPromise(function(_0x36e686,_0x601e1d){_0x54eea9=combineOptions(_0x54eea9);var _0x222174=new Buffer(_0xfbf9ba);var _0x154fea=fs[_0x48b5('0x1a')](_0x190c17);var _0x4b050f=fs[_0x48b5('0x10')](_0x3dd148);var _0x3a4aa3=crypto[_0x48b5('0x1b')](_0x54eea9['algorithm'],_0x222174);_0x154fea['on']('data',function(_0x4adeb6){var _0x30ee22=new Buffer(_0x3a4aa3['update'](_0x4adeb6),_0x48b5('0x14'));_0x4b050f[_0x48b5('0x15')](_0x30ee22);});_0x154fea['on'](_0x48b5('0x1c'),function(){try{var _0x5cb188=new Buffer(_0x3a4aa3[_0x48b5('0x16')](_0x48b5('0x14')),'binary');_0x4b050f[_0x48b5('0x15')](_0x5cb188);_0x4b050f[_0x48b5('0x1c')]();_0x4b050f['on']('close',function(){return _0x36e686(_0x3dd148);});}catch(_0x223595){fs[_0x48b5('0x18')](_0x3dd148);return _0x601e1d(_0x223595);}});});};exports[_0x48b5('0x1d')]=function(_0x999f69,_0x471d3b,_0x43aa0c){var _0x42cc90=_0x43aa0c||stringOptions['algorithm'];var _0xb771cf=_0x471d3b||stringOptions[_0x48b5('0x1e')];var _0x3cf1da=crypto[_0x48b5('0x11')](_0x42cc90,_0xb771cf);var _0x2be16e=_0x3cf1da[_0x48b5('0x13')](_0x999f69,_0x48b5('0x1f'),'base64');_0x2be16e+=_0x3cf1da[_0x48b5('0x16')](_0x48b5('0x20'));return _0x2be16e;};exports['decryptString']=function(_0x239f81,_0x29dba2,_0xa46b2a){var _0x357884=_0xa46b2a||stringOptions['algorithm'];var _0x3a7f46=_0x29dba2||stringOptions[_0x48b5('0x1e')];var _0x3d4c68=crypto[_0x48b5('0x1b')](_0x357884,_0x3a7f46);var _0x267f22=_0x3d4c68['update'](_0x239f81,_0x48b5('0x20'),'utf8');_0x267f22+=_0x3d4c68[_0x48b5('0x16')](_0x48b5('0x1f'));return _0x267f22;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index c923bbc..a0c8d09 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 _0x0156=['isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','CSV','Setting','then','splitSizeCsv','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','split','length','range'];(function(_0x5a4d71,_0x2926dc){var _0x26bdf0=function(_0x305147){while(--_0x305147){_0x5a4d71['push'](_0x5a4d71['shift']());}};_0x26bdf0(++_0x2926dc);}(_0x0156,0x1b5));var _0x6015=function(_0xa52d2a,_0xc089ca){_0xa52d2a=_0xa52d2a-0x0;var _0x29f463=_0x0156[_0xa52d2a];return _0x29f463;};'use strict';var util=require(_0x6015('0x0'));var path=require(_0x6015('0x1'));var _=require(_0x6015('0x2'));var csv=require(_0x6015('0x3'));var fs=require('fs');var BPromise=require(_0x6015('0x4'));var zipdir=require(_0x6015('0x5'));var rimraf=require(_0x6015('0x6'));var db=require(_0x6015('0x7'))['db'];var dbH=require(_0x6015('0x7'))[_0x6015('0x8')];var logger=require(_0x6015('0x9'))(_0x6015('0xa'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x6015('0xb')][0x3];var PATH=process[_0x6015('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3e900c,_0x509379){var _0x473c98={'status':_0x3e900c};var _0x115587={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x509379){_0x473c98[_0x6015('0xc')]=_0x509379;}return db[_0x6015('0xd')][_0x6015('0xe')](_0x473c98,_0x115587);}function main(){var _0x3954e5=0x1388;var _0x50ea28;logger[_0x6015('0xf')](util[_0x6015('0x10')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x6015('0x11')));return db[_0x6015('0x12')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeCsv']})[_0x6015('0x13')](function(_0x5abd95){if(_0x5abd95){_0x50ea28=_0x5abd95;_0x3954e5=_0x50ea28[_0x6015('0x14')]||0x1388;}})[_0x6015('0x13')](function(){return dbH[_0x6015('0x15')][_0x6015('0x16')](util[_0x6015('0x10')](_0x6015('0x17'),QUERY),{'type':dbH[_0x6015('0x15')][_0x6015('0x18')][_0x6015('0x19')]});})[_0x6015('0x13')](function(_0x337b40){if(!_0x337b40[0x0][_0x6015('0x1a')]){return analyticExtractedReport(_0x6015('0x1b'));}var _0x5cc2e0=[];var _0x1e6ac6=0x0;if(_0x50ea28[_0x6015('0x1c')]){if(_0x337b40&&_0x337b40[_0x6015('0x1d')]){var _0x247209=_[_0x6015('0x1e')](_0x337b40[0x0][_0x6015('0x1a')]/_0x3954e5);var _0x2637d4=Number[_0x6015('0x1f')](_0x337b40[0x0][_0x6015('0x1a')]/_0x3954e5)?_0x337b40[0x0][_0x6015('0x1a')]%_0x3954e5:0x0;_0x247209[_0x6015('0x20')](function(_0x411e78){if(_0x411e78>0x0){_0x1e6ac6+=_0x3954e5;}_0x5cc2e0[_0x6015('0x21')](dbH['sequelize']['query'](util['format'](_0x6015('0x22'),QUERY,_0x3954e5,_0x1e6ac6),{'type':dbH[_0x6015('0x15')][_0x6015('0x18')][_0x6015('0x19')]}));});if(_0x2637d4>0x0){_0x1e6ac6+=_0x3954e5;_0x5cc2e0[_0x6015('0x21')](dbH['sequelize']['query'](util[_0x6015('0x10')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2637d4,_0x1e6ac6),{'type':dbH['sequelize'][_0x6015('0x18')]['SELECT']}));}}}else{_0x5cc2e0[_0x6015('0x21')](dbH[_0x6015('0x15')][_0x6015('0x16')](QUERY,{'type':dbH[_0x6015('0x15')]['QueryTypes']['SELECT']}));}var _0x149b8c=path[_0x6015('0x23')](PATH);var _0x4cce68=path[_0x6015('0x24')](PATH,'.csv');var _0x2c6c3a=_0x50ea28[_0x6015('0x1c')]&&_0x5cc2e0[_0x6015('0x1d')]>0x1;var _0x263375=[];if(!fs['existsSync'](path[_0x6015('0x25')](_0x149b8c,_0x4cce68))&&_0x2c6c3a){fs[_0x6015('0x26')](path[_0x6015('0x25')](_0x149b8c,_0x4cce68));}return BPromise[_0x6015('0x27')](_0x5cc2e0,function(_0x5956e6){_0x263375[_0x6015('0x21')](_0x5956e6);})[_0x6015('0x13')](function(){for(var _0x3edfab=0x0;_0x3edfab<_0x263375[_0x6015('0x1d')];_0x3edfab+=0x1){var _0x5c3a12;var _0xac0b0f=_0x263375[_0x3edfab];if(_0x2c6c3a){_0x5c3a12=path[_0x6015('0x25')](_0x149b8c,_0x4cce68,util[_0x6015('0x10')](_0x6015('0x28'),_0x4cce68,_0x3edfab,_0x6015('0x29')));}else{_0x5c3a12=path['join'](_0x149b8c,util[_0x6015('0x10')](_0x6015('0x2a'),_0x4cce68,_0x6015('0x29')));}fs[_0x6015('0x2b')](_0x5c3a12,csv(_0xac0b0f));}})['then'](function(){if(_0x2c6c3a){return new Promise(function(_0x5dea92){zipdir(path['join'](_0x149b8c,_0x4cce68),{'saveTo':path[_0x6015('0x25')](_0x149b8c,util['format'](_0x6015('0x2a'),_0x4cce68,_0x6015('0x2c')))},function(_0x4a606d,_0x52ab31){rimraf(path[_0x6015('0x25')](_0x149b8c,_0x4cce68),function(){});_0x5dea92(_0x6015('0x2d'));});});}})[_0x6015('0x13')](function(){logger[_0x6015('0xf')](util['format'](_0x6015('0x2e'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x2c6c3a?util[_0x6015('0x10')](_0x6015('0x2a'),_0x4cce68,_0x2c6c3a?_0x6015('0x2c'):_0x6015('0x29')):null);});})[_0x6015('0x2f')](function(_0x2ac9a0){logger['info'](util[_0x6015('0x10')](_0x6015('0x30'),EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x2ac9a0,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6015('0x31'));})[_0x6015('0x32')](function(){process[_0x6015('0x33')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x0ca9=['dirname','.csv','split','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','splitSizeCsv','then','sequelize','query','QueryTypes','SELECT','num','Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d'];(function(_0x256999,_0x227454){var _0x4768e3=function(_0x1260ff){while(--_0x1260ff){_0x256999['push'](_0x256999['shift']());}};_0x4768e3(++_0x227454);}(_0x0ca9,0x186));var _0x90ca=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0ca9[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x90ca('0x0'));var path=require(_0x90ca('0x1'));var _=require(_0x90ca('0x2'));var csv=require(_0x90ca('0x3'));var fs=require('fs');var BPromise=require(_0x90ca('0x4'));var zipdir=require(_0x90ca('0x5'));var rimraf=require(_0x90ca('0x6'));var db=require('../../mysqldb')['db'];var dbH=require(_0x90ca('0x7'))[_0x90ca('0x8')];var logger=require(_0x90ca('0x9'))(_0x90ca('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x90ca('0xb')][0x2]);var QUERY=process[_0x90ca('0xb')][0x3];var PATH=process[_0x90ca('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x51566b,_0x4b5e9c){var _0x3250f8={'status':_0x51566b};var _0x1b21c9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4b5e9c){_0x3250f8[_0x90ca('0xc')]=_0x4b5e9c;}return db[_0x90ca('0xd')]['update'](_0x3250f8,_0x1b21c9);}function main(){var _0x270dd4=0x1388;var _0x29ab8c;logger[_0x90ca('0xe')](util[_0x90ca('0xf')](_0x90ca('0x10'),EXTRACTED_REPORT_ID,_0x90ca('0x11')));return db['Setting'][_0x90ca('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x90ca('0x13')]})[_0x90ca('0x14')](function(_0x2270bf){if(_0x2270bf){_0x29ab8c=_0x2270bf;_0x270dd4=_0x29ab8c[_0x90ca('0x13')]||0x1388;}})[_0x90ca('0x14')](function(){return dbH[_0x90ca('0x15')][_0x90ca('0x16')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0x90ca('0x17')][_0x90ca('0x18')]});})['then'](function(_0x34ffa3){if(!_0x34ffa3[0x0][_0x90ca('0x19')]){return analyticExtractedReport(_0x90ca('0x1a'));}var _0x423866=[];var _0x2effa8=0x0;if(_0x29ab8c['split']){if(_0x34ffa3&&_0x34ffa3[_0x90ca('0x1b')]){var _0x13f851=_[_0x90ca('0x1c')](_0x34ffa3[0x0]['num']/_0x270dd4);var _0x185fc3=Number[_0x90ca('0x1d')](_0x34ffa3[0x0][_0x90ca('0x19')]/_0x270dd4)?_0x34ffa3[0x0][_0x90ca('0x19')]%_0x270dd4:0x0;_0x13f851[_0x90ca('0x1e')](function(_0x81ca7f){if(_0x81ca7f>0x0){_0x2effa8+=_0x270dd4;}_0x423866[_0x90ca('0x1f')](dbH[_0x90ca('0x15')][_0x90ca('0x16')](util[_0x90ca('0xf')](_0x90ca('0x20'),QUERY,_0x270dd4,_0x2effa8),{'type':dbH[_0x90ca('0x15')]['QueryTypes'][_0x90ca('0x18')]}));});if(_0x185fc3>0x0){_0x2effa8+=_0x270dd4;_0x423866[_0x90ca('0x1f')](dbH[_0x90ca('0x15')][_0x90ca('0x16')](util[_0x90ca('0xf')](_0x90ca('0x20'),QUERY,_0x185fc3,_0x2effa8),{'type':dbH[_0x90ca('0x15')][_0x90ca('0x17')][_0x90ca('0x18')]}));}}}else{_0x423866[_0x90ca('0x1f')](dbH[_0x90ca('0x15')][_0x90ca('0x16')](QUERY,{'type':dbH[_0x90ca('0x15')][_0x90ca('0x17')][_0x90ca('0x18')]}));}var _0x10cce7=path[_0x90ca('0x21')](PATH);var _0x56a45e=path['basename'](PATH,_0x90ca('0x22'));var _0xbad073=_0x29ab8c[_0x90ca('0x23')]&&_0x423866[_0x90ca('0x1b')]>0x1;var _0x1d2e45=[];if(!fs['existsSync'](path[_0x90ca('0x24')](_0x10cce7,_0x56a45e))&&_0xbad073){fs['mkdirSync'](path[_0x90ca('0x24')](_0x10cce7,_0x56a45e));}return BPromise[_0x90ca('0x25')](_0x423866,function(_0x5bdde1){_0x1d2e45[_0x90ca('0x1f')](_0x5bdde1);})[_0x90ca('0x14')](function(){for(var _0x37fdd2=0x0;_0x37fdd2<_0x1d2e45[_0x90ca('0x1b')];_0x37fdd2+=0x1){var _0x23fb1c;var _0x21445f=_0x1d2e45[_0x37fdd2];if(_0xbad073){_0x23fb1c=path['join'](_0x10cce7,_0x56a45e,util[_0x90ca('0xf')](_0x90ca('0x26'),_0x56a45e,_0x37fdd2,_0x90ca('0x27')));}else{_0x23fb1c=path['join'](_0x10cce7,util[_0x90ca('0xf')](_0x90ca('0x28'),_0x56a45e,'csv'));}fs[_0x90ca('0x29')](_0x23fb1c,csv(_0x21445f));}})[_0x90ca('0x14')](function(){if(_0xbad073){return new Promise(function(_0x16ad71){zipdir(path[_0x90ca('0x24')](_0x10cce7,_0x56a45e),{'saveTo':path['join'](_0x10cce7,util[_0x90ca('0xf')]('%s.%s',_0x56a45e,_0x90ca('0x2a')))},function(_0x31aee2,_0x1e2a92){rimraf(path[_0x90ca('0x24')](_0x10cce7,_0x56a45e),function(){});_0x16ad71('zip\x20finished');});});}})['then'](function(){logger[_0x90ca('0xe')](util[_0x90ca('0xf')](_0x90ca('0x2b'),EXTRACTED_REPORT_ID,_0x90ca('0x11')));return analyticExtractedReport('Completed',_0xbad073?util['format']('%s.%s',_0x56a45e,_0xbad073?_0x90ca('0x2a'):_0x90ca('0x27')):null);});})[_0x90ca('0x2c')](function(_0xc325f7){logger[_0x90ca('0xe')](util[_0x90ca('0xf')](_0x90ca('0x2d'),EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0xc325f7,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x90ca('0x2e'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 510b544..fb21f46 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 _0x296e=['mkdirSync','createPdfKitDocument','%s%d.%s','%s.%s','pdf','all','zip','zip\x20finished','info','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','toString','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','createWriteStream','finish','error','util','path','moment','html-to-pdfmake','pdfmake/src/printer','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','tableHeader','map','fill','length','body','push','concat','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','header','pageBreak','before','landscape','\x20/\x20','Arial','black','num','Empty','Setting','find','split','then','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','dirname','basename','.pdf','existsSync','join'];(function(_0x2aceb6,_0x4179b8){var _0x7515aa=function(_0x76cebc){while(--_0x76cebc){_0x2aceb6['push'](_0x2aceb6['shift']());}};_0x7515aa(++_0x4179b8);}(_0x296e,0x1db));var _0xe296=function(_0xef4af6,_0x57629a){_0xef4af6=_0xef4af6-0x0;var _0x5848fe=_0x296e[_0xef4af6];return _0x5848fe;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0xe296('0x0'));var path=require(_0xe296('0x1'));var moment=require(_0xe296('0x2'));var htmlToPdfmake=require(_0xe296('0x3'));var PdfPrinter=require(_0xe296('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0xe296('0x5'));var JSDOM=require(_0xe296('0x6'))[_0xe296('0x7')];var window=new JSDOM('')[_0xe296('0x8')];var BPromise=require(_0xe296('0x9'));var db=require(_0xe296('0xa'))['db'];var dbH=require(_0xe296('0xa'))[_0xe296('0xb')];var logger=require(_0xe296('0xc'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xe296('0xd')][0x2]);var QUERY=process[_0xe296('0xd')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xe296('0xd')][0x5];var FORMAT=_0xe296('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x30ff7e,_0x3d5275){var _0x15269b={'status':_0x30ff7e};var _0x34a0b9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3d5275){_0x15269b[_0xe296('0xf')]=_0x3d5275;}return db['AnalyticExtractedReport']['update'](_0x15269b,_0x34a0b9);}function getHeaders(_0x54a55b){return _['map'](_0x54a55b,function(_0x276621){return{'text':_0x276621,'style':_0xe296('0x10')};});}function getRows(_0x23b096,_0x45a83a){return _[_0xe296('0x11')](_0x45a83a,function(_0x3e1530){return _(_0x3e1530)['pick'](_0x23b096)[_0xe296('0x11')](function(_0x501209){return _0x501209?_['toString'](_0x501209):'';})['value']();});}function createTable(_0x11cf70,_0x4121e1){var _0xe70e7a={'widths':_[_0xe296('0x12')](Array(_0x11cf70[_0xe296('0x13')]),0x91),'heights':function(_0x40b480){return _0x40b480===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x34cd99=getHeaders(_0x11cf70);_0xe70e7a[_0xe296('0x14')][_0xe296('0x15')](_0x34cd99);var _0x3b551d=getRows(_0x11cf70,_0x4121e1);_0xe70e7a[_0xe296('0x14')]=_0xe70e7a[_0xe296('0x14')][_0xe296('0x16')](_0x3b551d);return _0xe70e7a;}function createTables(_0xa08512){var _0xeaf50f=[];var _0x186c0e=_['chunk'](Object[_0xe296('0x17')](_0xa08512[0x0]),0x5);_0x186c0e[_0xe296('0x18')](function(_0x3d51e2){_0xeaf50f[_0xe296('0x15')](createTable(_0x3d51e2,_0xa08512));});return _0xeaf50f;}function getPDFDocDefinition(_0x3ca1c8){var _0xf2d6af=util[_0xe296('0x19')](_0xe296('0x1a'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0xe296('0x1b')])[_0xe296('0x19')](FORMAT),moment(EXTRACTED_REPORT[_0xe296('0x1c')])[_0xe296('0x19')](FORMAT));var _0x5802a4=[];for(var _0x239bbe=0x0;_0x239bbe<_0x3ca1c8['length'];_0x239bbe++){var _0x52b7cc=[];if(_0x239bbe===0x0){_0x52b7cc[_0xe296('0x15')]({'text':_0xf2d6af,'style':_0xe296('0x1d')});}var _0x5146ec={'table':_0x3ca1c8[_0x239bbe]};if(_0x239bbe>0x0){_0x5146ec[_0xe296('0x1e')]=_0xe296('0x1f');_0x5146ec['margin']=[0x0,0x46,0x0,0x0];}_0x52b7cc[_0xe296('0x15')](_0x5146ec);_0x5802a4[_0xe296('0x15')](_0x52b7cc);}return{'pageSize':'A4','pageOrientation':_0xe296('0x20'),'content':_0x5802a4,'footer':function(_0xb5da86,_0x4bb5e0){return{'text':_0xb5da86['toString']()+_0xe296('0x21')+_0x4bb5e0,'style':'footer'};},'defaultStyle':{'font':_0xe296('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xe296('0x23')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0xa46bcb){var _0x5dda51=0x1388;var _0x47e23a;if(!_0xa46bcb[0x0][_0xe296('0x24')]){return analyticExtractedReport(_0xe296('0x25'));}return db[_0xe296('0x26')][_0xe296('0x27')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe296('0x28'),'splitSizePdf']})[_0xe296('0x29')](function(_0x537841){if(_0x537841){_0x47e23a=_0x537841;_0x5dda51=_0x47e23a['splitSizePdf']||0x3e8;}})[_0xe296('0x29')](function(){var _0x45b4bb=[];var _0x513480=0x0;if(_0x47e23a['split']){if(_0xa46bcb&&_0xa46bcb[_0xe296('0x13')]){var _0x1cbf09=_['range'](_0xa46bcb[0x0][_0xe296('0x24')]/_0x5dda51);var _0xc15885=Number[_0xe296('0x2a')](_0xa46bcb[0x0][_0xe296('0x24')]/_0x5dda51)?_0xa46bcb[0x0][_0xe296('0x24')]%_0x5dda51:0x0;_0x1cbf09[_0xe296('0x18')](function(_0x3ca915){if(_0x3ca915>0x0){_0x513480+=_0x5dda51;}_0x45b4bb[_0xe296('0x15')](dbH[_0xe296('0x2b')][_0xe296('0x2c')](util['format'](_0xe296('0x2d'),QUERY,_0x5dda51,_0x513480),{'type':dbH[_0xe296('0x2b')]['QueryTypes'][_0xe296('0x2e')]}));});if(_0xc15885>0x0){_0x513480+=_0x5dda51;_0x45b4bb['push'](dbH['sequelize'][_0xe296('0x2c')](util[_0xe296('0x19')](_0xe296('0x2d'),QUERY,_0xc15885,_0x513480),{'type':dbH[_0xe296('0x2b')][_0xe296('0x2f')][_0xe296('0x2e')]}));}}}else{_0x45b4bb[_0xe296('0x15')](dbH[_0xe296('0x2b')]['query'](QUERY,{'type':dbH[_0xe296('0x2b')][_0xe296('0x2f')][_0xe296('0x2e')]}));}var _0x175033=path[_0xe296('0x30')](PATH);var _0x5c2416=path[_0xe296('0x31')](PATH,_0xe296('0x32'));var _0x1cdcaa=_0x47e23a['split']&&_0x45b4bb[_0xe296('0x13')]>0x1;var _0x1dd7cd=[];if(!fs[_0xe296('0x33')](path[_0xe296('0x34')](_0x175033,_0x5c2416))&&_0x1cdcaa){fs[_0xe296('0x35')](path[_0xe296('0x34')](_0x175033,_0x5c2416));}return BPromise['each'](_0x45b4bb,function(_0x55862e){_0x1dd7cd[_0xe296('0x15')](_0x55862e);})[_0xe296('0x29')](function(){var _0x23105b=[];for(var _0x8ccd6c=0x0;_0x8ccd6c<_0x1dd7cd[_0xe296('0x13')];_0x8ccd6c+=0x1){var _0x215433=_0x1dd7cd[_0x8ccd6c];var _0x3c4161=createTables(_['flatten'](_0x215433));var _0xe8b843;var _0x5c3471=getPDFDocDefinition(_0x3c4161);var _0x233a98=getPDFPrinter();var _0x1697f3=_0x233a98[_0xe296('0x36')](_0x5c3471);if(_0x1cdcaa){_0xe8b843=path[_0xe296('0x34')](_0x175033,_0x5c2416,util[_0xe296('0x19')](_0xe296('0x37'),_0x5c2416,_0x8ccd6c,'pdf'));}else{_0xe8b843=path[_0xe296('0x34')](_0x175033,util['format'](_0xe296('0x38'),_0x5c2416,_0xe296('0x39')));}_0x23105b[_0xe296('0x15')](writePDFDocument(_0x1697f3,_0xe8b843));}return Promise[_0xe296('0x3a')](_0x23105b);})[_0xe296('0x29')](function(){if(_0x1cdcaa){return new Promise(function(_0x2c3e0d){zipdir(path[_0xe296('0x34')](_0x175033,_0x5c2416),{'saveTo':path[_0xe296('0x34')](_0x175033,util[_0xe296('0x19')](_0xe296('0x38'),_0x5c2416,_0xe296('0x3b')))},function(){rimraf(path[_0xe296('0x34')](_0x175033,_0x5c2416),function(){});_0x2c3e0d(_0xe296('0x3c'));});});}})['then'](function(){if(!_0x1cdcaa)return;rimraf(path[_0xe296('0x34')](_0x175033,_0x5c2416),function(){});})['then'](function(){logger[_0xe296('0x3d')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xe296('0x3e')));return analyticExtractedReport(_0xe296('0x3f'),_0x1cdcaa?util[_0xe296('0x19')]('%s.%s',_0x5c2416,_0x1cdcaa?_0xe296('0x3b'):_0xe296('0x39')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xe296('0x3d')](util[_0xe296('0x19')](_0xe296('0x40'),EXTRACTED_REPORT_ID,_0xe296('0x3e')));return db[_0xe296('0x41')][_0xe296('0x42')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xe296('0x29')](function(_0x4b0997){EXTRACTED_REPORT=_0x4b0997;return dbH['sequelize'][_0xe296('0x2c')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0xe296('0x2f')][_0xe296('0x2e')]});})[_0xe296('0x29')](extractReport)[_0xe296('0x43')](function(_0x57124c){logger[_0xe296('0x3d')](util[_0xe296('0x19')](_0xe296('0x44'),EXTRACTED_REPORT_ID,_0xe296('0x3e')),util[_0xe296('0x45')](_0x57124c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xe296('0x46')](function(){process[_0xe296('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x11b84e=new PdfPrinter({'Arial':{'normal':__dirname+_0xe296('0x48'),'bold':__dirname+_0xe296('0x49'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0xe296('0x4a')}});return _0x11b84e;}function getPDFDocDefinitionFromHTML(_0x2ebfa6,_0x32b521){var _0xf80424=util[_0xe296('0x19')](_0xe296('0x4b'),_0x32b521[_0xe296('0x4c')],_0x32b521[_0xe296('0x4d')]);var _0xc23272=moment()[_0xe296('0x19')](_0xe296('0x4e'))[_0xe296('0x4f')]();var _0x3390ce=htmlToPdfmake(_0x2ebfa6,{'window':window,'tableAutoSize':!![]});return{'content':[_0x3390ce],'defaultStyle':{'font':_0xe296('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xe296('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xe296('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xe296('0x50')}},'header':function(){return[{'text':_0xe296('0x51'),'style':_0xe296('0x1d')}];},'footer':function(_0x159531,_0x19d511){return[{'text':util[_0xe296('0x19')](_0xe296('0x52'),_0xf80424,_0x159531,_0x19d511,_0xc23272),'style':_0xe296('0x53')}];}};}function writePDFDocument(_0x2a1da2,_0x2ac60d){return new Promise(function(_0x4f8fde,_0x5c3325){var _0x53efcf=_0x2a1da2[_0xe296('0x54')](fs[_0xe296('0x55')](_0x2ac60d));_0x53efcf['on'](_0xe296('0x56'),function(){_0x4f8fde('finish');});_0x53efcf['on'](_0xe296('0x57'),function(_0x3654f7){_0x5c3325(_0x3654f7);});_0x2a1da2['end']();});}exports['createPdfFromHTML']=function(_0x2fa13e,_0x432d09){var _0x3b4dab=getPDFPrinter();var _0x1e6674=getPDFDocDefinitionFromHTML(_0x2fa13e,_0x432d09);var _0xf62ee5=_0x3b4dab[_0xe296('0x36')](_0x1e6674);return writePDFDocument(_0xf62ee5,_0x432d09[_0xe296('0x1')])[_0xe296('0x43')](function(_0x35c30a){throw _0x35c30a;});}; \ No newline at end of file +var _0x1884=['zip','zip\x20finished','info','PDF','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','path','moment','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','pick','toString','value','fill','length','push','body','concat','chunk','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','header','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','black','num','Empty','Setting','find','split','splitSizePdf','isInteger','sequelize','query','QueryTypes','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.pdf','join','each','then','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all'];(function(_0x29df9a,_0x42aff3){var _0x3a8e96=function(_0x70fbe7){while(--_0x70fbe7){_0x29df9a['push'](_0x29df9a['shift']());}};_0x3a8e96(++_0x42aff3);}(_0x1884,0x186));var _0x4188=function(_0x35dd6d,_0x52758f){_0x35dd6d=_0x35dd6d-0x0;var _0x4a1b91=_0x1884[_0x35dd6d];return _0x4a1b91;};'use strict';var _=require(_0x4188('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x4188('0x1'));var moment=require(_0x4188('0x2'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x4188('0x3'));var zipdir=require(_0x4188('0x4'));var rimraf=require(_0x4188('0x5'));var JSDOM=require(_0x4188('0x6'))[_0x4188('0x7')];var window=new JSDOM('')[_0x4188('0x8')];var BPromise=require('bluebird');var db=require(_0x4188('0x9'))['db'];var dbH=require(_0x4188('0x9'))[_0x4188('0xa')];var logger=require('../../config/logger')(_0x4188('0xb'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x4188('0xc')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x4188('0xc')][0x5];var FORMAT=_0x4188('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x3eebce,_0x3b4672){var _0x2eb5af={'status':_0x3eebce};var _0x41b7d6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3b4672){_0x2eb5af[_0x4188('0xe')]=_0x3b4672;}return db[_0x4188('0xf')][_0x4188('0x10')](_0x2eb5af,_0x41b7d6);}function getHeaders(_0x4bd828){return _[_0x4188('0x11')](_0x4bd828,function(_0x530720){return{'text':_0x530720,'style':'tableHeader'};});}function getRows(_0x584a64,_0x55375e){return _['map'](_0x55375e,function(_0x471383){return _(_0x471383)[_0x4188('0x12')](_0x584a64)[_0x4188('0x11')](function(_0x539ad1){return _0x539ad1?_[_0x4188('0x13')](_0x539ad1):'';})[_0x4188('0x14')]();});}function createTable(_0x5e2067,_0x332eb8){var _0x454ba2={'widths':_[_0x4188('0x15')](Array(_0x5e2067[_0x4188('0x16')]),0x91),'heights':function(_0x2f44cd){return _0x2f44cd===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x23e1ca=getHeaders(_0x5e2067);_0x454ba2['body'][_0x4188('0x17')](_0x23e1ca);var _0x25527d=getRows(_0x5e2067,_0x332eb8);_0x454ba2[_0x4188('0x18')]=_0x454ba2['body'][_0x4188('0x19')](_0x25527d);return _0x454ba2;}function createTables(_0x50f310){var _0x3c4ac3=[];var _0x5a8ccb=_[_0x4188('0x1a')](Object['keys'](_0x50f310[0x0]),0x5);_0x5a8ccb[_0x4188('0x1b')](function(_0x16b596){_0x3c4ac3[_0x4188('0x17')](createTable(_0x16b596,_0x50f310));});return _0x3c4ac3;}function getPDFDocDefinition(_0x458ce6){var _0xb6ed96=util[_0x4188('0x1c')](_0x4188('0x1d'),NAME,EXTRACTED_REPORT[_0x4188('0x1e')],moment(EXTRACTED_REPORT[_0x4188('0x1f')])[_0x4188('0x1c')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x4188('0x1c')](FORMAT));var _0x2bdad3=[];for(var _0x5f1efe=0x0;_0x5f1efe<_0x458ce6[_0x4188('0x16')];_0x5f1efe++){var _0x2627dd=[];if(_0x5f1efe===0x0){_0x2627dd['push']({'text':_0xb6ed96,'style':_0x4188('0x20')});}var _0x39fa2f={'table':_0x458ce6[_0x5f1efe]};if(_0x5f1efe>0x0){_0x39fa2f[_0x4188('0x21')]=_0x4188('0x22');_0x39fa2f[_0x4188('0x23')]=[0x0,0x46,0x0,0x0];}_0x2627dd[_0x4188('0x17')](_0x39fa2f);_0x2bdad3[_0x4188('0x17')](_0x2627dd);}return{'pageSize':'A4','pageOrientation':_0x4188('0x24'),'content':_0x2bdad3,'footer':function(_0x5381e8,_0x29c235){return{'text':_0x5381e8[_0x4188('0x13')]()+_0x4188('0x25')+_0x29c235,'style':_0x4188('0x26')};},'defaultStyle':{'font':_0x4188('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x4188('0x28')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x4e03ed){var _0x1a9306=0x1388;var _0xa8c8cc;if(!_0x4e03ed[0x0][_0x4188('0x29')]){return analyticExtractedReport(_0x4188('0x2a'));}return db[_0x4188('0x2b')][_0x4188('0x2c')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4188('0x2d'),'splitSizePdf']})['then'](function(_0x2bd268){if(_0x2bd268){_0xa8c8cc=_0x2bd268;_0x1a9306=_0xa8c8cc[_0x4188('0x2e')]||0x3e8;}})['then'](function(){var _0x2c38bc=[];var _0x46794c=0x0;if(_0xa8c8cc[_0x4188('0x2d')]){if(_0x4e03ed&&_0x4e03ed[_0x4188('0x16')]){var _0x5b8554=_['range'](_0x4e03ed[0x0][_0x4188('0x29')]/_0x1a9306);var _0x430c9b=Number[_0x4188('0x2f')](_0x4e03ed[0x0][_0x4188('0x29')]/_0x1a9306)?_0x4e03ed[0x0][_0x4188('0x29')]%_0x1a9306:0x0;_0x5b8554['forEach'](function(_0x58c3ca){if(_0x58c3ca>0x0){_0x46794c+=_0x1a9306;}_0x2c38bc['push'](dbH[_0x4188('0x30')][_0x4188('0x31')](util[_0x4188('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1a9306,_0x46794c),{'type':dbH[_0x4188('0x30')][_0x4188('0x32')]['SELECT']}));});if(_0x430c9b>0x0){_0x46794c+=_0x1a9306;_0x2c38bc[_0x4188('0x17')](dbH[_0x4188('0x30')][_0x4188('0x31')](util[_0x4188('0x1c')](_0x4188('0x33'),QUERY,_0x430c9b,_0x46794c),{'type':dbH[_0x4188('0x30')][_0x4188('0x32')][_0x4188('0x34')]}));}}}else{_0x2c38bc[_0x4188('0x17')](dbH[_0x4188('0x30')][_0x4188('0x31')](QUERY,{'type':dbH[_0x4188('0x30')][_0x4188('0x32')]['SELECT']}));}var _0x93245=path[_0x4188('0x35')](PATH);var _0xbe1583=path[_0x4188('0x36')](PATH,_0x4188('0x37'));var _0x2978a5=_0xa8c8cc['split']&&_0x2c38bc[_0x4188('0x16')]>0x1;var _0xd0f9ca=[];if(!fs['existsSync'](path[_0x4188('0x38')](_0x93245,_0xbe1583))&&_0x2978a5){fs['mkdirSync'](path['join'](_0x93245,_0xbe1583));}return BPromise[_0x4188('0x39')](_0x2c38bc,function(_0x5a111a){_0xd0f9ca[_0x4188('0x17')](_0x5a111a);})[_0x4188('0x3a')](function(){var _0x221d90=[];for(var _0x3af185=0x0;_0x3af185<_0xd0f9ca[_0x4188('0x16')];_0x3af185+=0x1){var _0x1f41f8=_0xd0f9ca[_0x3af185];var _0x448ede=createTables(_[_0x4188('0x3b')](_0x1f41f8));var _0x51547f;var _0x4c13d8=getPDFDocDefinition(_0x448ede);var _0xf8c470=getPDFPrinter();var _0x27c398=_0xf8c470[_0x4188('0x3c')](_0x4c13d8);if(_0x2978a5){_0x51547f=path[_0x4188('0x38')](_0x93245,_0xbe1583,util['format'](_0x4188('0x3d'),_0xbe1583,_0x3af185,_0x4188('0x3e')));}else{_0x51547f=path[_0x4188('0x38')](_0x93245,util[_0x4188('0x1c')](_0x4188('0x3f'),_0xbe1583,'pdf'));}_0x221d90[_0x4188('0x17')](writePDFDocument(_0x27c398,_0x51547f));}return Promise[_0x4188('0x40')](_0x221d90);})[_0x4188('0x3a')](function(){if(_0x2978a5){return new Promise(function(_0xa096ca){zipdir(path[_0x4188('0x38')](_0x93245,_0xbe1583),{'saveTo':path['join'](_0x93245,util[_0x4188('0x1c')]('%s.%s',_0xbe1583,_0x4188('0x41')))},function(){rimraf(path['join'](_0x93245,_0xbe1583),function(){});_0xa096ca(_0x4188('0x42'));});});}})[_0x4188('0x3a')](function(){if(!_0x2978a5)return;rimraf(path[_0x4188('0x38')](_0x93245,_0xbe1583),function(){});})[_0x4188('0x3a')](function(){logger[_0x4188('0x43')](util[_0x4188('0x1c')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x4188('0x44')));return analyticExtractedReport('Completed',_0x2978a5?util['format']('%s.%s',_0xbe1583,_0x2978a5?_0x4188('0x41'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x4188('0x43')](util[_0x4188('0x1c')](_0x4188('0x45'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x4188('0xf')][_0x4188('0x46')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x4188('0x3a')](function(_0x3c8189){EXTRACTED_REPORT=_0x3c8189;return dbH[_0x4188('0x30')][_0x4188('0x31')](util[_0x4188('0x1c')](_0x4188('0x47'),QUERY),{'type':dbH[_0x4188('0x30')]['QueryTypes'][_0x4188('0x34')]});})['then'](extractReport)[_0x4188('0x48')](function(_0xa1ad0a){logger['info'](util[_0x4188('0x1c')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x4188('0x44')),util['inspect'](_0xa1ad0a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4188('0x49'));})[_0x4188('0x4a')](function(){process[_0x4188('0x4b')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x1df462=new PdfPrinter({'Arial':{'normal':__dirname+_0x4188('0x4c'),'bold':__dirname+_0x4188('0x4d'),'italics':__dirname+_0x4188('0x4e'),'bolditalics':__dirname+_0x4188('0x4f')}});return _0x1df462;}function getPDFDocDefinitionFromHTML(_0x42b78d,_0x37c0c8){var _0x3a9a7f=util[_0x4188('0x1c')](_0x4188('0x50'),_0x37c0c8[_0x4188('0x51')],_0x37c0c8[_0x4188('0x52')]);var _0x143304=moment()['format'](_0x4188('0x53'))[_0x4188('0x13')]();var _0x1962d3=htmlToPdfmake(_0x42b78d,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1962d3],'defaultStyle':{'font':_0x4188('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x4188('0x54'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x4188('0x54'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x4188('0x54')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x4188('0x20')}];},'footer':function(_0x5091e3,_0x2bc89d){return[{'text':util[_0x4188('0x1c')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x3a9a7f,_0x5091e3,_0x2bc89d,_0x143304),'style':_0x4188('0x26')}];}};}function writePDFDocument(_0x1d3683,_0x2c8c95){return new Promise(function(_0x86919e,_0x5c1596){var _0x4f9f80=_0x1d3683[_0x4188('0x55')](fs[_0x4188('0x56')](_0x2c8c95));_0x4f9f80['on'](_0x4188('0x57'),function(){_0x86919e('finish');});_0x4f9f80['on'](_0x4188('0x58'),function(_0x54002e){_0x5c1596(_0x54002e);});_0x1d3683[_0x4188('0x59')]();});}exports[_0x4188('0x5a')]=function(_0x1e69be,_0x4e9dd2){var _0x468f1e=getPDFPrinter();var _0x3c2172=getPDFDocDefinitionFromHTML(_0x1e69be,_0x4e9dd2);var _0x4e436e=_0x468f1e[_0x4188('0x3c')](_0x3c2172);return writePDFDocument(_0x4e436e,_0x4e9dd2[_0x4188('0x1')])[_0x4188('0x48')](function(_0x4484c8){throw _0x4484c8;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 91c72cb..1a2cae7 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 _0xa63a=['mkdirSync','each','xlsx','%s.%s','binary','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','finally','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeXlsx','then','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','length','isInteger','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','join'];(function(_0x4087d4,_0x469ec3){var _0x397e7d=function(_0x5db947){while(--_0x5db947){_0x4087d4['push'](_0x4087d4['shift']());}};_0x397e7d(++_0x469ec3);}(_0xa63a,0x154));var _0xaa63=function(_0x6eb02d,_0x20bdf5){_0x6eb02d=_0x6eb02d-0x0;var _0xb756de=_0xa63a[_0x6eb02d];return _0xb756de;};'use strict';var util=require('util');var path=require(_0xaa63('0x0'));var _=require(_0xaa63('0x1'));var fs=require('fs');var json2xls=require(_0xaa63('0x2'));var BPromise=require(_0xaa63('0x3'));var zipdir=require(_0xaa63('0x4'));var rimraf=require(_0xaa63('0x5'));var db=require(_0xaa63('0x6'))['db'];var dbH=require(_0xaa63('0x6'))[_0xaa63('0x7')];var logger=require(_0xaa63('0x8'))(_0xaa63('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x43e4e3,_0x53e524){var _0x42f55d={'status':_0x43e4e3};var _0x37abe2={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x53e524){_0x42f55d['savename']=_0x53e524;}return db[_0xaa63('0xa')][_0xaa63('0xb')](_0x42f55d,_0x37abe2);}function main(){var _0x1ac54f=0x1388;var _0x2e0dcf;logger[_0xaa63('0xc')](util[_0xaa63('0xd')](_0xaa63('0xe'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0xaa63('0xf')][_0xaa63('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xaa63('0x11'),_0xaa63('0x12')]})[_0xaa63('0x13')](function(_0x3ee6cc){if(_0x3ee6cc){_0x2e0dcf=_0x3ee6cc;_0x1ac54f=_0x2e0dcf['splitSizeXlsx']||0x1388;}})['then'](function(){return dbH['sequelize']['query'](util[_0xaa63('0xd')](_0xaa63('0x14'),QUERY),{'type':dbH[_0xaa63('0x15')][_0xaa63('0x16')][_0xaa63('0x17')]});})[_0xaa63('0x13')](function(_0x338c23){if(!_0x338c23[0x0][_0xaa63('0x18')]){return analyticExtractedReport('Empty');}var _0x20c3d1=[];var _0x115ba9=0x0;if(_0x2e0dcf[_0xaa63('0x11')]){if(_0x338c23&&_0x338c23[_0xaa63('0x19')]){var _0x35ef77=_['range'](_0x338c23[0x0]['num']/_0x1ac54f);var _0x277ec2=Number[_0xaa63('0x1a')](_0x338c23[0x0][_0xaa63('0x18')]/_0x1ac54f)?_0x338c23[0x0][_0xaa63('0x18')]%_0x1ac54f:0x0;_0x35ef77[_0xaa63('0x1b')](function(_0xa300c7){if(_0xa300c7>0x0){_0x115ba9+=_0x1ac54f;}_0x20c3d1[_0xaa63('0x1c')](dbH[_0xaa63('0x15')][_0xaa63('0x1d')](util['format'](_0xaa63('0x1e'),QUERY,_0x1ac54f,_0x115ba9),{'type':dbH['sequelize'][_0xaa63('0x16')][_0xaa63('0x17')]}));});if(_0x277ec2>0x0){_0x115ba9+=_0x1ac54f;_0x20c3d1[_0xaa63('0x1c')](dbH[_0xaa63('0x15')][_0xaa63('0x1d')](util[_0xaa63('0xd')](_0xaa63('0x1e'),QUERY,_0x277ec2,_0x115ba9),{'type':dbH[_0xaa63('0x15')][_0xaa63('0x16')][_0xaa63('0x17')]}));}}}else{_0x20c3d1['push'](dbH[_0xaa63('0x15')][_0xaa63('0x1d')](QUERY,{'type':dbH[_0xaa63('0x15')][_0xaa63('0x16')]['SELECT']}));}var _0x245e21=path[_0xaa63('0x1f')](PATH);var _0x450072=path[_0xaa63('0x20')](PATH,_0xaa63('0x21'));var _0x5251ed=_0x2e0dcf[_0xaa63('0x11')]&&_0x20c3d1[_0xaa63('0x19')]>0x1;var _0xf3a544=[];if(!fs[_0xaa63('0x22')](path[_0xaa63('0x23')](_0x245e21,_0x450072))&&_0x5251ed){fs[_0xaa63('0x24')](path['join'](_0x245e21,_0x450072));}return BPromise[_0xaa63('0x25')](_0x20c3d1,function(_0x17ffa3){_0xf3a544['push'](_0x17ffa3);})[_0xaa63('0x13')](function(){for(var _0xb3a3=0x0;_0xb3a3<_0xf3a544[_0xaa63('0x19')];_0xb3a3+=0x1){var _0x129233;var _0xa3ff02=_0xf3a544[_0xb3a3];if(_0x5251ed){_0x129233=path[_0xaa63('0x23')](_0x245e21,_0x450072,util[_0xaa63('0xd')]('%s%d.%s',_0x450072,_0xb3a3,_0xaa63('0x26')));}else{_0x129233=path['join'](_0x245e21,util[_0xaa63('0xd')](_0xaa63('0x27'),_0x450072,_0xaa63('0x26')));}fs['writeFileSync'](_0x129233,json2xls(_0xa3ff02),_0xaa63('0x28'));}})[_0xaa63('0x13')](function(){if(_0x5251ed){return new Promise(function(_0x7b7aa8){zipdir(path[_0xaa63('0x23')](_0x245e21,_0x450072),{'saveTo':path[_0xaa63('0x23')](_0x245e21,util[_0xaa63('0xd')](_0xaa63('0x27'),_0x450072,'zip'))},function(_0x5d0a9a,_0x4ef2a7){rimraf(path[_0xaa63('0x23')](_0x245e21,_0x450072),function(){});_0x7b7aa8(_0xaa63('0x29'));});});}})[_0xaa63('0x13')](function(){logger[_0xaa63('0xc')](util[_0xaa63('0xd')](_0xaa63('0x2a'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport('Completed',_0x5251ed?util[_0xaa63('0xd')](_0xaa63('0x27'),_0x450072,_0x5251ed?'zip':_0xaa63('0x26')):null);});})[_0xaa63('0x2b')](function(_0x3cfb9c){logger[_0xaa63('0xc')](util[_0xaa63('0xd')](_0xaa63('0x2c'),EXTRACTED_REPORT_ID,_0xaa63('0x2d')),util['inspect'](_0x3cfb9c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xaa63('0x2e')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xd023=['xlsx','%s.%s','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Failed','finally','exit','util','lodash','json2xls','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','split','splitSizeXlsx','then','sequelize','query','QueryTypes','SELECT','num','Empty','length','range','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','.xlsx','existsSync','mkdirSync','join','each','%s%d.%s'];(function(_0x24619c,_0x182d88){var _0x3baf2f=function(_0x3df78c){while(--_0x3df78c){_0x24619c['push'](_0x24619c['shift']());}};_0x3baf2f(++_0x182d88);}(_0xd023,0x94));var _0x3d02=function(_0x3bae28,_0x5ca4f5){_0x3bae28=_0x3bae28-0x0;var _0xb431b=_0xd023[_0x3bae28];return _0xb431b;};'use strict';var util=require(_0x3d02('0x0'));var path=require('path');var _=require(_0x3d02('0x1'));var fs=require('fs');var json2xls=require(_0x3d02('0x2'));var BPromise=require('bluebird');var zipdir=require(_0x3d02('0x3'));var rimraf=require(_0x3d02('0x4'));var db=require(_0x3d02('0x5'))['db'];var dbH=require('../../mysqldb')[_0x3d02('0x6')];var logger=require(_0x3d02('0x7'))(_0x3d02('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x3d02('0x9')][0x2]);var QUERY=process[_0x3d02('0x9')][0x3];var PATH=process[_0x3d02('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x53dc99,_0xb4443){var _0x2b371f={'status':_0x53dc99};var _0x574d70={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xb4443){_0x2b371f[_0x3d02('0xa')]=_0xb4443;}return db[_0x3d02('0xb')]['update'](_0x2b371f,_0x574d70);}function main(){var _0x4b90f5=0x1388;var _0x1bdc77;logger[_0x3d02('0xc')](util[_0x3d02('0xd')](_0x3d02('0xe'),EXTRACTED_REPORT_ID,_0x3d02('0xf')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3d02('0x10'),_0x3d02('0x11')]})[_0x3d02('0x12')](function(_0x169da1){if(_0x169da1){_0x1bdc77=_0x169da1;_0x4b90f5=_0x1bdc77[_0x3d02('0x11')]||0x1388;}})[_0x3d02('0x12')](function(){return dbH[_0x3d02('0x13')][_0x3d02('0x14')](util[_0x3d02('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x3d02('0x13')][_0x3d02('0x15')][_0x3d02('0x16')]});})[_0x3d02('0x12')](function(_0x2d8ac0){if(!_0x2d8ac0[0x0][_0x3d02('0x17')]){return analyticExtractedReport(_0x3d02('0x18'));}var _0x306668=[];var _0x325efe=0x0;if(_0x1bdc77[_0x3d02('0x10')]){if(_0x2d8ac0&&_0x2d8ac0[_0x3d02('0x19')]){var _0x312ab0=_[_0x3d02('0x1a')](_0x2d8ac0[0x0][_0x3d02('0x17')]/_0x4b90f5);var _0xa0442e=Number['isInteger'](_0x2d8ac0[0x0][_0x3d02('0x17')]/_0x4b90f5)?_0x2d8ac0[0x0][_0x3d02('0x17')]%_0x4b90f5:0x0;_0x312ab0['forEach'](function(_0x570833){if(_0x570833>0x0){_0x325efe+=_0x4b90f5;}_0x306668['push'](dbH[_0x3d02('0x13')][_0x3d02('0x14')](util['format'](_0x3d02('0x1b'),QUERY,_0x4b90f5,_0x325efe),{'type':dbH[_0x3d02('0x13')][_0x3d02('0x15')]['SELECT']}));});if(_0xa0442e>0x0){_0x325efe+=_0x4b90f5;_0x306668[_0x3d02('0x1c')](dbH['sequelize']['query'](util[_0x3d02('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xa0442e,_0x325efe),{'type':dbH[_0x3d02('0x13')][_0x3d02('0x15')][_0x3d02('0x16')]}));}}}else{_0x306668['push'](dbH[_0x3d02('0x13')][_0x3d02('0x14')](QUERY,{'type':dbH[_0x3d02('0x13')][_0x3d02('0x15')][_0x3d02('0x16')]}));}var _0x529793=path[_0x3d02('0x1d')](PATH);var _0x26689e=path['basename'](PATH,_0x3d02('0x1e'));var _0x300fc6=_0x1bdc77[_0x3d02('0x10')]&&_0x306668['length']>0x1;var _0x29167a=[];if(!fs[_0x3d02('0x1f')](path['join'](_0x529793,_0x26689e))&&_0x300fc6){fs[_0x3d02('0x20')](path[_0x3d02('0x21')](_0x529793,_0x26689e));}return BPromise[_0x3d02('0x22')](_0x306668,function(_0x328670){_0x29167a['push'](_0x328670);})[_0x3d02('0x12')](function(){for(var _0x317238=0x0;_0x317238<_0x29167a[_0x3d02('0x19')];_0x317238+=0x1){var _0xbac16c;var _0x590050=_0x29167a[_0x317238];if(_0x300fc6){_0xbac16c=path['join'](_0x529793,_0x26689e,util['format'](_0x3d02('0x23'),_0x26689e,_0x317238,_0x3d02('0x24')));}else{_0xbac16c=path[_0x3d02('0x21')](_0x529793,util[_0x3d02('0xd')](_0x3d02('0x25'),_0x26689e,'xlsx'));}fs['writeFileSync'](_0xbac16c,json2xls(_0x590050),_0x3d02('0x26'));}})['then'](function(){if(_0x300fc6){return new Promise(function(_0x39e86b){zipdir(path[_0x3d02('0x21')](_0x529793,_0x26689e),{'saveTo':path[_0x3d02('0x21')](_0x529793,util['format'](_0x3d02('0x25'),_0x26689e,_0x3d02('0x27')))},function(_0x3c28ab,_0x4a3ce3){rimraf(path['join'](_0x529793,_0x26689e),function(){});_0x39e86b(_0x3d02('0x28'));});});}})[_0x3d02('0x12')](function(){logger[_0x3d02('0xc')](util[_0x3d02('0xd')](_0x3d02('0x29'),EXTRACTED_REPORT_ID,_0x3d02('0xf')));return analyticExtractedReport('Completed',_0x300fc6?util['format'](_0x3d02('0x25'),_0x26689e,_0x300fc6?_0x3d02('0x27'):_0x3d02('0x24')):null);});})[_0x3d02('0x2a')](function(_0x2ac28d){logger[_0x3d02('0xc')](util[_0x3d02('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x3d02('0xf')),util['inspect'](_0x2ac28d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x3d02('0x2b'));})[_0x3d02('0x2c')](function(){process[_0x3d02('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 276d076..d3503c0 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 _0xec82=['context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','CDR(destination)=','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','cutdigits','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','createdAt','interval','*,*,*,*','tag','callerID','length','answer','app','toLowerCase','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','bulkCreate','sortBy','catch','error','models','Interval','findAll','intervals','VoiceExtension','IntervalId','then','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','filter','exten','playback','hasOwnProperty','priority','extensions','extension','find','push','Set','format','CDR(type)=%s','type'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0xec82,0xb2));var _0x2ec8=function(_0x1966db,_0x2438f0){_0x1966db=_0x1966db-0x0;var _0x1b351e=_0xec82[_0x1966db];return _0x1b351e;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0x12d646,_0x3bafe2){var _0x21e42b=this;return _0x12d646[_0x2ec8('0x0')][_0x2ec8('0x1')][_0x2ec8('0x2')]({'raw':!![]})['then'](function(_0x5db350){_0x21e42b[_0x2ec8('0x3')]=_0x5db350;return _0x12d646[_0x2ec8('0x0')][_0x2ec8('0x4')]['findAll']({'where':{'IntervalId':_0x3bafe2[_0x2ec8('0x5')]},'raw':!![]});})[_0x2ec8('0x6')](function(_0x1f072a){return _0x12d646[_0x2ec8('0x0')]['VoiceExtension'][_0x2ec8('0x2')]({'where':{'exten':{'$in':_[_0x2ec8('0x7')](_[_0x2ec8('0x8')](_0x1f072a,'exten'))}},'order':[{'raw':_0x2ec8('0x9')}],'raw':!![]});})[_0x2ec8('0x6')](function(_0x347135){var _0x2f5c61=_[_0x2ec8('0xa')](_0x347135,{'priority':'1'});var _0x46303e=_[_0x2ec8('0xa')](_0x347135,{'isApp':0x1});var _0x3d199f=_['groupBy'](_0x46303e,_0x2ec8('0xb'));var _0x166674=['queue',_0x2ec8('0xc')];var _0x4a14a8=[];var _0x4dc23c=[];for(var _0x595f8a in _0x3d199f){if(_0x3d199f[_0x2ec8('0xd')](_0x595f8a)){_0x21e42b[_0x2ec8('0xe')]=0x2;_0x21e42b[_0x2ec8('0xf')]=[];_0x21e42b[_0x2ec8('0x10')]=_[_0x2ec8('0x11')](_0x2f5c61,{'exten':_0x3d199f[_0x595f8a][0x0]['exten']});_0x21e42b[_0x2ec8('0xf')][_0x2ec8('0x12')]({'type':_0x3d199f[_0x595f8a][0x0]['type'],'app':_0x2ec8('0x13'),'appdata':util[_0x2ec8('0x14')](_0x2ec8('0x15'),_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x16')]),'context':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x17')],'exten':_0x3d199f[_0x595f8a][0x0]['exten'],'priority':_0x21e42b[_0x2ec8('0xe')]++,'VoiceExtensionId':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x18')]});if(_0x3d199f[_0x595f8a][0x0]['type']===_0x2ec8('0x19')){_0x21e42b[_0x2ec8('0xf')][_0x2ec8('0x12')]({'type':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x16')],'app':'Set','appdata':_0x2ec8('0x1a')+_0x3d199f[_0x595f8a][0x0]['VoiceExtensionId'],'context':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x17')],'exten':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0xb')],'priority':_0x21e42b[_0x2ec8('0xe')]++,'VoiceExtensionId':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x18')]});}else if(_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x16')]===_0x2ec8('0x1b')){if(_0x21e42b['extension']){_0x21e42b[_0x2ec8('0xf')][_0x2ec8('0x12')]({'type':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x16')],'app':_0x2ec8('0x13'),'appdata':_0x2ec8('0x1c')+(_0x21e42b[_0x2ec8('0x10')]['cutdigits']?_0x2ec8('0x1d')+_0x21e42b[_0x2ec8('0x10')]['cutdigits']+'}':'${EXTEN}'),'context':_0x3d199f[_0x595f8a][0x0]['context'],'exten':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0xb')],'priority':_0x21e42b[_0x2ec8('0xe')]++,'VoiceExtensionId':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x18')]});}_0x21e42b[_0x2ec8('0xf')]['push']({'type':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x16')],'app':_0x2ec8('0x13'),'appdata':_0x2ec8('0x1a')+_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x18')],'context':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x17')],'exten':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0xb')],'priority':_0x21e42b[_0x2ec8('0xe')]++,'VoiceExtensionId':_0x3d199f[_0x595f8a][0x0]['VoiceExtensionId']});var _0x435629=_0x21e42b['priority']++;_0x21e42b['extensions']['push']({'type':_0x3d199f[_0x595f8a][0x0]['type'],'app':_0x2ec8('0x1e'),'appdata':_0x2ec8('0x1f')+(_0x435629+0x2)+_0x2ec8('0x20')+(_0x435629+0x1)+')','context':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x17')],'exten':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0xb')],'priority':_0x435629,'VoiceExtensionId':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x18')]});if(_0x21e42b['extension']){_0x21e42b[_0x2ec8('0xf')][_0x2ec8('0x12')]({'type':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x16')],'app':_0x2ec8('0x13'),'appdata':_0x21e42b[_0x2ec8('0x10')][_0x2ec8('0x21')]?_0x2ec8('0x22')+_0x21e42b[_0x2ec8('0x10')][_0x2ec8('0x21')]+'}':_0x2ec8('0x23'),'context':_0x3d199f[_0x595f8a][0x0]['context'],'exten':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0xb')],'priority':_0x21e42b['priority']++,'VoiceExtensionId':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x18')]});}_0x21e42b[_0x2ec8('0xf')][_0x2ec8('0x12')]({'type':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x16')],'app':'Set','appdata':_0x2ec8('0x24')+_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x18')],'context':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x17')],'exten':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0xb')],'priority':_0x21e42b['priority']++,'VoiceExtensionId':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x18')]});if(_0x21e42b['extension']&&_0x21e42b[_0x2ec8('0x10')][_0x2ec8('0xd')](_0x2ec8('0x25'))&&_0x21e42b[_0x2ec8('0x10')]['recordingFormat']!=='none'){_0x21e42b[_0x2ec8('0xf')][_0x2ec8('0x12')]({'type':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x16')],'app':_0x2ec8('0x13'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x17')],'exten':_0x3d199f[_0x595f8a][0x0]['exten'],'priority':_0x21e42b[_0x2ec8('0xe')]++,'VoiceExtensionId':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x18')]});_0x21e42b[_0x2ec8('0xf')][_0x2ec8('0x12')]({'type':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x16')],'app':_0x2ec8('0x13'),'appdata':_0x2ec8('0x26')+_0x21e42b[_0x2ec8('0x10')][_0x2ec8('0x25')]||_0x2ec8('0x27'),'context':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x17')],'exten':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0xb')],'priority':_0x21e42b['priority']++,'VoiceExtensionId':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x18')]});}}_0x21e42b[_0x2ec8('0xf')][_0x2ec8('0x12')]({'type':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x16')],'app':_0x2ec8('0x13'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x17')],'exten':_0x3d199f[_0x595f8a][0x0]['exten'],'priority':_0x21e42b[_0x2ec8('0xe')]++,'VoiceExtensionId':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x18')]});_0x21e42b['extensions'][_0x2ec8('0x12')]({'type':_0x3d199f[_0x595f8a][0x0]['type'],'app':_0x2ec8('0x13'),'appdata':_0x2ec8('0x28'),'context':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x17')],'exten':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0xb')],'priority':_0x21e42b[_0x2ec8('0xe')]++,'VoiceExtensionId':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x18')]});_0x21e42b[_0x2ec8('0xf')][_0x2ec8('0x12')]({'type':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x16')],'app':_0x2ec8('0x13'),'appdata':_0x2ec8('0x29'),'context':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x17')],'exten':_0x3d199f[_0x595f8a][0x0]['exten'],'priority':_0x21e42b[_0x2ec8('0xe')]++,'VoiceExtensionId':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x18')]});for(var _0x4a8335=0x0,_0x3d83fc=0x0;_0x4a8335<_0x3d199f[_0x595f8a]['length'];_0x4a8335+=0x1,_0x3d83fc=0x0){var _0x4afd2a=_0x3d199f[_0x595f8a][_0x4a8335];if(_0x4afd2a[_0x2ec8('0x16')]){_0x4afd2a[_0x2ec8('0x16')]=_0x4afd2a['type']['toLowerCase']();}var _0x335ebb=[];var _0x161ed1=[];delete _0x4afd2a['id'];delete _0x4afd2a[_0x2ec8('0x2a')];delete _0x4afd2a['updatedAt'];var _0x19825f=_0x4afd2a[_0x2ec8('0x2b')]!==_0x2ec8('0x2c')?[_0x4afd2a[_0x2ec8('0x2b')]]:_0x4afd2a[_0x2ec8('0x5')]?_[_0x2ec8('0x8')](_[_0x2ec8('0xa')](_0x21e42b['intervals'],{'IntervalId':_0x4afd2a[_0x2ec8('0x5')]}),_0x2ec8('0x2b')):[];if(_0x4afd2a['hasOwnProperty'](_0x2ec8('0x2d'))){if(_0x4afd2a[_0x2ec8('0x2d')]&&_0x4afd2a[_0x2ec8('0x2d')]!=='--'){_0x335ebb[_0x2ec8('0x12')]({'type':_0x4afd2a[_0x2ec8('0x16')],'app':_0x2ec8('0x13'),'appdata':'CDR(tag)='+_0x4afd2a[_0x2ec8('0x2d')],'context':_0x4afd2a[_0x2ec8('0x17')],'exten':_0x4afd2a[_0x2ec8('0xb')],'priority':_0x19825f['length']+_0x21e42b[_0x2ec8('0xe')]+_0x3d83fc++,'VoiceExtensionId':_0x4afd2a[_0x2ec8('0x18')]});}}if(_0x4afd2a[_0x2ec8('0x16')]===_0x2ec8('0x1b')&&_0x4afd2a[_0x2ec8('0xd')](_0x2ec8('0x2e'))){if(_0x4afd2a[_0x2ec8('0x2e')]){_0x335ebb['push']({'type':_0x4afd2a[_0x2ec8('0x16')],'app':_0x2ec8('0x1e'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x4afd2a[_0x2ec8('0x2e')]+')','context':_0x4afd2a[_0x2ec8('0x17')],'exten':_0x4afd2a[_0x2ec8('0xb')],'priority':_0x19825f[_0x2ec8('0x2f')]+_0x21e42b[_0x2ec8('0xe')]+_0x3d83fc++,'VoiceExtensionId':_0x4afd2a[_0x2ec8('0x18')]});}else{_0x335ebb[_0x2ec8('0x12')]({'type':_0x4afd2a[_0x2ec8('0x16')],'app':_0x2ec8('0x1e'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x4afd2a['context'],'exten':_0x4afd2a[_0x2ec8('0xb')],'priority':_0x19825f[_0x2ec8('0x2f')]+_0x21e42b[_0x2ec8('0xe')]+_0x3d83fc++,'VoiceExtensionId':_0x4afd2a[_0x2ec8('0x18')]});}}if(_0x4afd2a[_0x2ec8('0xd')](_0x2ec8('0x30'))){if(_0x166674['indexOf'](_0x4afd2a[_0x2ec8('0x31')][_0x2ec8('0x32')]())>=0x0&&_0x4afd2a[_0x2ec8('0x33')]!==_0x2ec8('0x34')){if(_0x4afd2a[_0x2ec8('0x30')]){_0x335ebb[_0x2ec8('0x12')]({'type':_0x4afd2a[_0x2ec8('0x16')],'app':'ExecIf','appdata':_0x2ec8('0x35'),'context':_0x4afd2a['context'],'exten':_0x4afd2a[_0x2ec8('0xb')],'priority':_0x19825f['length']+_0x21e42b[_0x2ec8('0xe')]+_0x3d83fc++,'VoiceExtensionId':_0x4afd2a['VoiceExtensionId']});_0x335ebb['push']({'type':_0x4afd2a['type'],'app':_0x2ec8('0x13'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x4afd2a[_0x2ec8('0x17')],'exten':_0x4afd2a[_0x2ec8('0xb')],'priority':_0x19825f[_0x2ec8('0x2f')]+_0x21e42b[_0x2ec8('0xe')]+_0x3d83fc++,'VoiceExtensionId':_0x4afd2a[_0x2ec8('0x18')]});}else{_0x335ebb[_0x2ec8('0x12')]({'type':_0x4afd2a['type'],'app':_0x2ec8('0x1e'),'appdata':_0x2ec8('0x36'),'context':_0x4afd2a[_0x2ec8('0x17')],'exten':_0x4afd2a[_0x2ec8('0xb')],'priority':_0x19825f[_0x2ec8('0x2f')]+_0x21e42b[_0x2ec8('0xe')]+_0x3d83fc++,'VoiceExtensionId':_0x4afd2a['VoiceExtensionId']});_0x335ebb[_0x2ec8('0x12')]({'type':_0x4afd2a[_0x2ec8('0x16')],'app':_0x2ec8('0x13'),'appdata':_0x2ec8('0x37'),'context':_0x4afd2a[_0x2ec8('0x17')],'exten':_0x4afd2a['exten'],'priority':_0x19825f[_0x2ec8('0x2f')]+_0x21e42b['priority']+_0x3d83fc++,'VoiceExtensionId':_0x4afd2a[_0x2ec8('0x18')]});}}}for(var _0x226fd8=0x0;_0x226fd8<_0x19825f[_0x2ec8('0x2f')];_0x226fd8+=0x1){var _0x153d06=_0x21e42b[_0x2ec8('0xe')]+_0x19825f['length'];var _0x27c53d=_0x226fd8===_0x19825f[_0x2ec8('0x2f')]-0x1?_0x21e42b[_0x2ec8('0xe')]+_0x335ebb['length']+_0x161ed1['length']+0x2:_0x21e42b[_0x2ec8('0xe')]+_0x226fd8+0x1;_0x335ebb[_0x2ec8('0x38')](_0x226fd8,0x0,{'type':_0x4afd2a[_0x2ec8('0x16')],'app':_0x2ec8('0x39'),'appdata':_0x19825f[_0x226fd8]+'?'+_0x4afd2a[_0x2ec8('0x17')]+',${EXTEN},'+_0x153d06+':'+_0x4afd2a[_0x2ec8('0x17')]+_0x2ec8('0x3a')+_0x27c53d,'exten':_0x4afd2a[_0x2ec8('0xb')],'context':_0x4afd2a[_0x2ec8('0x17')],'priority':_0x21e42b[_0x2ec8('0xe')]+_0x226fd8,'VoiceExtensionId':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x18')]});}_0x4afd2a[_0x2ec8('0xe')]=_0x335ebb[_0x2ec8('0x2f')]?_[_0x2ec8('0x3b')](_0x335ebb)[_0x2ec8('0xe')]+0x1:_0x21e42b[_0x2ec8('0xe')];_0x21e42b[_0x2ec8('0xe')]=(_0x161ed1[_0x2ec8('0x2f')]?_[_0x2ec8('0x3b')](_0x161ed1)[_0x2ec8('0xe')]:_0x4afd2a['priority'])+0x1;_0x21e42b[_0x2ec8('0xf')]=_[_0x2ec8('0x3c')](_0x21e42b[_0x2ec8('0xf')],_0x335ebb,[_0x4afd2a],_0x161ed1);}_0x21e42b[_0x2ec8('0xf')][_0x2ec8('0x12')]({'type':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x16')],'app':_0x2ec8('0x3d'),'exten':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0xb')],'context':_0x3d199f[_0x595f8a][0x0]['context'],'priority':_0x21e42b[_0x2ec8('0xe')],'VoiceExtensionId':_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x18')]});_0x4a14a8['push'](_0x3d199f[_0x595f8a][0x0][_0x2ec8('0x18')]);_0x4dc23c=_[_0x2ec8('0x3c')](_0x4dc23c,_0x21e42b[_0x2ec8('0xf')]);}}return _0x12d646[_0x2ec8('0x3e')](function(_0x14e6b9){return _0x12d646[_0x2ec8('0x0')][_0x2ec8('0x4')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x4a14a8}},'transaction':_0x14e6b9})[_0x2ec8('0x6')](function(_0x5047a1){return _0x12d646['models'][_0x2ec8('0x4')][_0x2ec8('0x3f')](_[_0x2ec8('0x40')](_0x4dc23c,'priority'),{'transaction':_0x14e6b9});});});})[_0x2ec8('0x41')](function(_0x59129){console[_0x2ec8('0x42')](_0x59129);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0x423d=['):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','length','updatedAt','interval','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','toLowerCase','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','hasOwnProperty','extensions','extension','find','push','type','format','CDR(type)=%s','priority','VoiceExtensionId','inbound','Set','CDR(routeid)=','context','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('];(function(_0x464e73,_0x588c98){var _0x5b84d0=function(_0x4f924a){while(--_0x4f924a){_0x464e73['push'](_0x464e73['shift']());}};_0x5b84d0(++_0x588c98);}(_0x423d,0x174));var _0xd423=function(_0x60797f,_0xd6659b){_0x60797f=_0x60797f-0x0;var _0x1186cd=_0x423d[_0x60797f];return _0x1186cd;};'use strict';var _=require(_0xd423('0x0'));var util=require(_0xd423('0x1'));function rewrite(_0x58a58a,_0x37d34b){var _0x3ad5bd=this;return _0x58a58a[_0xd423('0x2')][_0xd423('0x3')][_0xd423('0x4')]({'raw':!![]})[_0xd423('0x5')](function(_0x425c0d){_0x3ad5bd[_0xd423('0x6')]=_0x425c0d;return _0x58a58a[_0xd423('0x2')][_0xd423('0x7')][_0xd423('0x4')]({'where':{'IntervalId':_0x37d34b[_0xd423('0x8')]},'raw':!![]});})[_0xd423('0x5')](function(_0x2662a5){return _0x58a58a[_0xd423('0x2')]['VoiceExtension'][_0xd423('0x4')]({'where':{'exten':{'$in':_[_0xd423('0x9')](_[_0xd423('0xa')](_0x2662a5,_0xd423('0xb')))}},'order':[{'raw':_0xd423('0xc')}],'raw':!![]});})['then'](function(_0x2b6cce){var _0x44caf3=_[_0xd423('0xd')](_0x2b6cce,{'priority':'1'});var _0x130dd4=_[_0xd423('0xd')](_0x2b6cce,{'isApp':0x1});var _0x3425d6=_[_0xd423('0xe')](_0x130dd4,_0xd423('0xb'));var _0x3b6e6c=['queue','playback'];var _0x5be8ed=[];var _0x55babd=[];for(var _0xe9ebc7 in _0x3425d6){if(_0x3425d6[_0xd423('0xf')](_0xe9ebc7)){_0x3ad5bd['priority']=0x2;_0x3ad5bd[_0xd423('0x10')]=[];_0x3ad5bd[_0xd423('0x11')]=_[_0xd423('0x12')](_0x44caf3,{'exten':_0x3425d6[_0xe9ebc7][0x0]['exten']});_0x3ad5bd[_0xd423('0x10')][_0xd423('0x13')]({'type':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0x14')],'app':'Set','appdata':util[_0xd423('0x15')](_0xd423('0x16'),_0x3425d6[_0xe9ebc7][0x0][_0xd423('0x14')]),'context':_0x3425d6[_0xe9ebc7][0x0]['context'],'exten':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0xb')],'priority':_0x3ad5bd[_0xd423('0x17')]++,'VoiceExtensionId':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0x18')]});if(_0x3425d6[_0xe9ebc7][0x0][_0xd423('0x14')]===_0xd423('0x19')){_0x3ad5bd['extensions'][_0xd423('0x13')]({'type':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0x14')],'app':_0xd423('0x1a'),'appdata':_0xd423('0x1b')+_0x3425d6[_0xe9ebc7][0x0][_0xd423('0x18')],'context':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0x1c')],'exten':_0x3425d6[_0xe9ebc7][0x0]['exten'],'priority':_0x3ad5bd[_0xd423('0x17')]++,'VoiceExtensionId':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0x18')]});}else if(_0x3425d6[_0xe9ebc7][0x0]['type']===_0xd423('0x1d')){if(_0x3ad5bd['extension']){_0x3ad5bd[_0xd423('0x10')][_0xd423('0x13')]({'type':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0x14')],'app':_0xd423('0x1a'),'appdata':_0xd423('0x1e')+(_0x3ad5bd[_0xd423('0x11')][_0xd423('0x1f')]?_0xd423('0x20')+_0x3ad5bd[_0xd423('0x11')][_0xd423('0x1f')]+'}':_0xd423('0x21')),'context':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0x1c')],'exten':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0xb')],'priority':_0x3ad5bd[_0xd423('0x17')]++,'VoiceExtensionId':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0x18')]});}_0x3ad5bd[_0xd423('0x10')][_0xd423('0x13')]({'type':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0x14')],'app':_0xd423('0x1a'),'appdata':_0xd423('0x1b')+_0x3425d6[_0xe9ebc7][0x0][_0xd423('0x18')],'context':_0x3425d6[_0xe9ebc7][0x0]['context'],'exten':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0xb')],'priority':_0x3ad5bd[_0xd423('0x17')]++,'VoiceExtensionId':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0x18')]});var _0x276112=_0x3ad5bd[_0xd423('0x17')]++;_0x3ad5bd[_0xd423('0x10')]['push']({'type':_0x3425d6[_0xe9ebc7][0x0]['type'],'app':_0xd423('0x22'),'appdata':_0xd423('0x23')+(_0x276112+0x2)+_0xd423('0x24')+(_0x276112+0x1)+')','context':_0x3425d6[_0xe9ebc7][0x0]['context'],'exten':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0xb')],'priority':_0x276112,'VoiceExtensionId':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0x18')]});if(_0x3ad5bd[_0xd423('0x11')]){_0x3ad5bd[_0xd423('0x10')][_0xd423('0x13')]({'type':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0x14')],'app':'Set','appdata':_0x3ad5bd['extension'][_0xd423('0x1f')]?_0xd423('0x25')+_0x3ad5bd[_0xd423('0x11')]['cutdigits']+'}':_0xd423('0x26'),'context':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0x1c')],'exten':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0xb')],'priority':_0x3ad5bd[_0xd423('0x17')]++,'VoiceExtensionId':_0x3425d6[_0xe9ebc7][0x0]['VoiceExtensionId']});}_0x3ad5bd[_0xd423('0x10')]['push']({'type':_0x3425d6[_0xe9ebc7][0x0]['type'],'app':_0xd423('0x1a'),'appdata':_0xd423('0x27')+_0x3425d6[_0xe9ebc7][0x0][_0xd423('0x18')],'context':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0x1c')],'exten':_0x3425d6[_0xe9ebc7][0x0]['exten'],'priority':_0x3ad5bd[_0xd423('0x17')]++,'VoiceExtensionId':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0x18')]});if(_0x3ad5bd[_0xd423('0x11')]&&_0x3ad5bd['extension'][_0xd423('0xf')](_0xd423('0x28'))&&_0x3ad5bd['extension']['recordingFormat']!=='none'){_0x3ad5bd[_0xd423('0x10')][_0xd423('0x13')]({'type':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0x14')],'app':_0xd423('0x1a'),'appdata':_0xd423('0x29'),'context':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0x1c')],'exten':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0xb')],'priority':_0x3ad5bd[_0xd423('0x17')]++,'VoiceExtensionId':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0x18')]});_0x3ad5bd[_0xd423('0x10')][_0xd423('0x13')]({'type':_0x3425d6[_0xe9ebc7][0x0]['type'],'app':_0xd423('0x1a'),'appdata':_0xd423('0x2a')+_0x3ad5bd['extension'][_0xd423('0x28')]||'wav','context':_0x3425d6[_0xe9ebc7][0x0]['context'],'exten':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0xb')],'priority':_0x3ad5bd['priority']++,'VoiceExtensionId':_0x3425d6[_0xe9ebc7][0x0]['VoiceExtensionId']});}}_0x3ad5bd[_0xd423('0x10')][_0xd423('0x13')]({'type':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0x14')],'app':_0xd423('0x1a'),'appdata':_0xd423('0x2b'),'context':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0x1c')],'exten':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0xb')],'priority':_0x3ad5bd[_0xd423('0x17')]++,'VoiceExtensionId':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0x18')]});_0x3ad5bd['extensions'][_0xd423('0x13')]({'type':_0x3425d6[_0xe9ebc7][0x0]['type'],'app':_0xd423('0x1a'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0x1c')],'exten':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0xb')],'priority':_0x3ad5bd['priority']++,'VoiceExtensionId':_0x3425d6[_0xe9ebc7][0x0]['VoiceExtensionId']});_0x3ad5bd[_0xd423('0x10')][_0xd423('0x13')]({'type':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0x14')],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0x1c')],'exten':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0xb')],'priority':_0x3ad5bd['priority']++,'VoiceExtensionId':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0x18')]});for(var _0x4baebc=0x0,_0x129bcf=0x0;_0x4baebc<_0x3425d6[_0xe9ebc7][_0xd423('0x2c')];_0x4baebc+=0x1,_0x129bcf=0x0){var _0x39c2d4=_0x3425d6[_0xe9ebc7][_0x4baebc];if(_0x39c2d4[_0xd423('0x14')]){_0x39c2d4[_0xd423('0x14')]=_0x39c2d4[_0xd423('0x14')]['toLowerCase']();}var _0x3f5f5c=[];var _0x5b9673=[];delete _0x39c2d4['id'];delete _0x39c2d4['createdAt'];delete _0x39c2d4[_0xd423('0x2d')];var _0x194b86=_0x39c2d4['interval']!=='*,*,*,*'?[_0x39c2d4[_0xd423('0x2e')]]:_0x39c2d4[_0xd423('0x8')]?_['map'](_['filter'](_0x3ad5bd[_0xd423('0x6')],{'IntervalId':_0x39c2d4[_0xd423('0x8')]}),_0xd423('0x2e')):[];if(_0x39c2d4[_0xd423('0xf')](_0xd423('0x2f'))){if(_0x39c2d4[_0xd423('0x2f')]&&_0x39c2d4['tag']!=='--'){_0x3f5f5c['push']({'type':_0x39c2d4[_0xd423('0x14')],'app':_0xd423('0x1a'),'appdata':'CDR(tag)='+_0x39c2d4[_0xd423('0x2f')],'context':_0x39c2d4['context'],'exten':_0x39c2d4[_0xd423('0xb')],'priority':_0x194b86[_0xd423('0x2c')]+_0x3ad5bd['priority']+_0x129bcf++,'VoiceExtensionId':_0x39c2d4['VoiceExtensionId']});}}if(_0x39c2d4['type']===_0xd423('0x1d')&&_0x39c2d4[_0xd423('0xf')](_0xd423('0x30'))){if(_0x39c2d4[_0xd423('0x30')]){_0x3f5f5c[_0xd423('0x13')]({'type':_0x39c2d4[_0xd423('0x14')],'app':_0xd423('0x22'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x39c2d4[_0xd423('0x30')]+')','context':_0x39c2d4[_0xd423('0x1c')],'exten':_0x39c2d4[_0xd423('0xb')],'priority':_0x194b86[_0xd423('0x2c')]+_0x3ad5bd['priority']+_0x129bcf++,'VoiceExtensionId':_0x39c2d4[_0xd423('0x18')]});}else{_0x3f5f5c[_0xd423('0x13')]({'type':_0x39c2d4[_0xd423('0x14')],'app':'ExecIf','appdata':_0xd423('0x31'),'context':_0x39c2d4[_0xd423('0x1c')],'exten':_0x39c2d4[_0xd423('0xb')],'priority':_0x194b86[_0xd423('0x2c')]+_0x3ad5bd[_0xd423('0x17')]+_0x129bcf++,'VoiceExtensionId':_0x39c2d4[_0xd423('0x18')]});}}if(_0x39c2d4[_0xd423('0xf')]('answer')){if(_0x3b6e6c[_0xd423('0x32')](_0x39c2d4[_0xd423('0x33')][_0xd423('0x34')]())>=0x0&&_0x39c2d4['appType']!=='custom'){if(_0x39c2d4[_0xd423('0x35')]){_0x3f5f5c[_0xd423('0x13')]({'type':_0x39c2d4['type'],'app':'ExecIf','appdata':_0xd423('0x36'),'context':_0x39c2d4[_0xd423('0x1c')],'exten':_0x39c2d4['exten'],'priority':_0x194b86[_0xd423('0x2c')]+_0x3ad5bd[_0xd423('0x17')]+_0x129bcf++,'VoiceExtensionId':_0x39c2d4[_0xd423('0x18')]});_0x3f5f5c[_0xd423('0x13')]({'type':_0x39c2d4['type'],'app':_0xd423('0x1a'),'appdata':_0xd423('0x37'),'context':_0x39c2d4[_0xd423('0x1c')],'exten':_0x39c2d4[_0xd423('0xb')],'priority':_0x194b86[_0xd423('0x2c')]+_0x3ad5bd[_0xd423('0x17')]+_0x129bcf++,'VoiceExtensionId':_0x39c2d4[_0xd423('0x18')]});}else{_0x3f5f5c[_0xd423('0x13')]({'type':_0x39c2d4[_0xd423('0x14')],'app':_0xd423('0x22'),'appdata':_0xd423('0x38'),'context':_0x39c2d4[_0xd423('0x1c')],'exten':_0x39c2d4[_0xd423('0xb')],'priority':_0x194b86[_0xd423('0x2c')]+_0x3ad5bd[_0xd423('0x17')]+_0x129bcf++,'VoiceExtensionId':_0x39c2d4[_0xd423('0x18')]});_0x3f5f5c[_0xd423('0x13')]({'type':_0x39c2d4[_0xd423('0x14')],'app':_0xd423('0x1a'),'appdata':_0xd423('0x39'),'context':_0x39c2d4[_0xd423('0x1c')],'exten':_0x39c2d4[_0xd423('0xb')],'priority':_0x194b86['length']+_0x3ad5bd['priority']+_0x129bcf++,'VoiceExtensionId':_0x39c2d4[_0xd423('0x18')]});}}}for(var _0x506a3b=0x0;_0x506a3b<_0x194b86[_0xd423('0x2c')];_0x506a3b+=0x1){var _0x4d1fbc=_0x3ad5bd[_0xd423('0x17')]+_0x194b86[_0xd423('0x2c')];var _0x4eecb2=_0x506a3b===_0x194b86[_0xd423('0x2c')]-0x1?_0x3ad5bd['priority']+_0x3f5f5c[_0xd423('0x2c')]+_0x5b9673[_0xd423('0x2c')]+0x2:_0x3ad5bd[_0xd423('0x17')]+_0x506a3b+0x1;_0x3f5f5c['splice'](_0x506a3b,0x0,{'type':_0x39c2d4[_0xd423('0x14')],'app':'GotoIfTime','appdata':_0x194b86[_0x506a3b]+'?'+_0x39c2d4[_0xd423('0x1c')]+',${EXTEN},'+_0x4d1fbc+':'+_0x39c2d4[_0xd423('0x1c')]+_0xd423('0x3a')+_0x4eecb2,'exten':_0x39c2d4[_0xd423('0xb')],'context':_0x39c2d4[_0xd423('0x1c')],'priority':_0x3ad5bd[_0xd423('0x17')]+_0x506a3b,'VoiceExtensionId':_0x3425d6[_0xe9ebc7][0x0]['VoiceExtensionId']});}_0x39c2d4['priority']=_0x3f5f5c['length']?_[_0xd423('0x3b')](_0x3f5f5c)[_0xd423('0x17')]+0x1:_0x3ad5bd[_0xd423('0x17')];_0x3ad5bd[_0xd423('0x17')]=(_0x5b9673['length']?_[_0xd423('0x3b')](_0x5b9673)[_0xd423('0x17')]:_0x39c2d4[_0xd423('0x17')])+0x1;_0x3ad5bd['extensions']=_[_0xd423('0x3c')](_0x3ad5bd['extensions'],_0x3f5f5c,[_0x39c2d4],_0x5b9673);}_0x3ad5bd[_0xd423('0x10')][_0xd423('0x13')]({'type':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0x14')],'app':_0xd423('0x3d'),'exten':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0xb')],'context':_0x3425d6[_0xe9ebc7][0x0][_0xd423('0x1c')],'priority':_0x3ad5bd[_0xd423('0x17')],'VoiceExtensionId':_0x3425d6[_0xe9ebc7][0x0]['VoiceExtensionId']});_0x5be8ed['push'](_0x3425d6[_0xe9ebc7][0x0][_0xd423('0x18')]);_0x55babd=_[_0xd423('0x3c')](_0x55babd,_0x3ad5bd[_0xd423('0x10')]);}}return _0x58a58a[_0xd423('0x3e')](function(_0x2e87ec){return _0x58a58a[_0xd423('0x2')][_0xd423('0x7')][_0xd423('0x3f')]({'where':{'VoiceExtensionId':{'$in':_0x5be8ed}},'transaction':_0x2e87ec})[_0xd423('0x5')](function(_0x563022){return _0x58a58a[_0xd423('0x2')][_0xd423('0x7')][_0xd423('0x40')](_[_0xd423('0x41')](_0x55babd,_0xd423('0x17')),{'transaction':_0x2e87ec});});});})[_0xd423('0x42')](function(_0x32903b){console['error'](_0x32903b);});}exports[_0xd423('0x43')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index c9c5472..9193a8b 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 _0x4e13=['squel','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','null','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','data','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','updatedAt','field','NOW()','toString','from','cm_contacts','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper','\x20=\x20?','deletedAt\x20IS\x20NULL','str','calleridnum','cm_hopper_final','cm_hopper_black','id\x20IN\x20?','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','sequelize','query','onlyIfOpen','VoiceQueueId','Campaign','always','CampaignId','all','BlackLists','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','util','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4e13,0xd6));var _0x34e1=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x4e13[_0x47a349];return _0x18ab75;};'use strict';var BPromise=require('bluebird');var util=require(_0x34e1('0x0'));var _=require(_0x34e1('0x1'));var fs=require('fs');var squel=require(_0x34e1('0x2'));var Papa=require('papaparse');var Redis=require(_0x34e1('0x3'));var db=require(_0x34e1('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0x34e1('0x5'))(_0x34e1('0x6'));config[_0x34e1('0x7')]=_[_0x34e1('0x8')](config[_0x34e1('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x34e1('0x9'))(new Redis(config[_0x34e1('0x7')]));require(_0x34e1('0xa'))['register'](socket);try{if(!process['argv'][0x2]||process[_0x34e1('0xb')][0x2]==='undefined'||process[_0x34e1('0xb')][0x2]===_0x34e1('0xc')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x34e1('0xb')][0x2];if(!process[_0x34e1('0xb')][0x3]||process['argv'][0x3]===_0x34e1('0xd')||process[_0x34e1('0xb')][0x3]===_0x34e1('0xc')||!process[_0x34e1('0xb')][0x4]||process[_0x34e1('0xb')][0x4]===_0x34e1('0xd')||process[_0x34e1('0xb')][0x4]==='null'){throw new Error(_0x34e1('0xe'));}var FIELDS=_[_0x34e1('0xf')](process[_0x34e1('0xb')][0x3][_0x34e1('0x10')](','),process['argv'][0x4][_0x34e1('0x10')](','));if(!process[_0x34e1('0xb')][0x5]||process[_0x34e1('0xb')][0x5]==='undefined'||process[_0x34e1('0xb')][0x5]===_0x34e1('0xc')){throw new Error(_0x34e1('0x11'));}var LISTID=process[_0x34e1('0xb')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x34e1('0xb')][0x6]!==_0x34e1('0xd')&&process['argv'][0x6]!==_0x34e1('0xc')?process[_0x34e1('0xb')][0x6]:null;var DUPLICATES=process[_0x34e1('0xb')][0x7]&&process[_0x34e1('0xb')][0x7]!==_0x34e1('0xd')&&process[_0x34e1('0xb')][0x7]!==_0x34e1('0xc')?process[_0x34e1('0xb')][0x7]:null;if(!process[_0x34e1('0xb')][0x8]||process[_0x34e1('0xb')][0x8]==='undefined'||process['argv'][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0xb52fb2){logger[_0x34e1('0x12')](_0xb52fb2);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(_0x1cf52d,_0x3cedc2,_0x65f503,_0x3ff83a){var _0x212c02={'message':_0x3cedc2};_0x212c02[_0x1cf52d]=!![];if(_0x65f503){_0x212c02[_0x34e1('0x13')]=_0x65f503;}if(_0x3ff83a){_0x212c02[_0x34e1('0x14')]=_0x3ff83a;}return _0x212c02;}function isEmail(_0xeca7a4){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))*$/[_0x34e1('0x15')](_0xeca7a4);}function checkRow(_0x4be314,_0x5d0fae,_0x147729){return new BPromise(function(_0x4fb954,_0x2ff5ac){if(_[_0x34e1('0x16')](_0x4be314)){return _0x2ff5ac(handleCheckRowError(_0x34e1('0x12'),_0x34e1('0x17'),null,_0x147729));}if(_0x4be314[_0x34e1('0x18')]&&_0x4be314['errors'][_0x34e1('0x19')]){var _0x1dd0ca=_[_0x34e1('0x1a')](_0x4be314[_0x34e1('0x18')],_0x34e1('0x1b'))[_0x34e1('0x1c')](';');return _0x2ff5ac(handleCheckRowError(_0x34e1('0x12'),_0x1dd0ca,null,_0x147729));}var _0x82b003={};for(var _0x5686da in FIELDS){if(FIELDS['hasOwnProperty'](_0x5686da)&&FIELDS[_0x5686da]){_0x82b003[_0x5686da]=_0x4be314[_0x34e1('0x1d')][0x0][FIELDS[_0x5686da]]||_0x4be314['data'][0x0]['\ufeff'+FIELDS[_0x5686da]];}}if(!_0x82b003['firstName']){return _0x2ff5ac(handleCheckRowError('error','firstName\x20not\x20specified!',null,_0x147729));}if(!_0x82b003['phone']){return _0x2ff5ac(handleCheckRowError(_0x34e1('0x12'),_0x34e1('0x1e'),null,_0x147729));}if(_0x82b003[_0x34e1('0x1f')]){var _0x4bb45f=moment(_0x82b003[_0x34e1('0x1f')],_0x34e1('0x20'));if(!_0x4bb45f[_0x34e1('0x21')]()){return _0x2ff5ac(handleCheckRowError(_0x34e1('0x12'),_0x34e1('0x22'),null,_0x147729));}}if(_0x82b003[_0x34e1('0x23')]){if(!isEmail(_0x82b003[_0x34e1('0x23')])){return _0x2ff5ac(handleCheckRowError('error',_0x34e1('0x24'),null,_0x147729));}}_0x82b003['ListId']=LISTID;_0x82b003[_0x34e1('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x5d0fae){var _0x3dc377={};for(var _0x5daa13=0x0,_0x1e9166=DUPLICATES[_0x34e1('0x19')];_0x5daa13<_0x1e9166;_0x5daa13+=0x1){_0x3dc377[DUPLICATES[_0x5daa13]]=_0x82b003[DUPLICATES[_0x5daa13]];}var _0x5a837c=_[_0x34e1('0x26')](_0x5d0fae,_0x3dc377);if(_0x5a837c){return _0x2ff5ac(handleCheckRowError(_0x34e1('0x27'),_0x34e1('0x28'),_0x5a837c,_0x147729));}}return db[_0x34e1('0x29')][_0x34e1('0x2a')](_0x82b003,{'raw':!![],'hooks':![],'fields':_[_0x34e1('0x2b')](_0x82b003)})[_0x34e1('0x2c')](function(_0x5dfff7){if(DUPLICATES&&DUPLICATES[_0x34e1('0x19')]&&_0x5d0fae){_0x5d0fae[_0x34e1('0x2d')](_[_0x34e1('0x2e')](_0x82b003,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x5dfff7['id'];return _0x4fb954();})[_0x34e1('0x2f')](function(_0x2dca3e){return _0x2ff5ac(handleCheckRowError(_0x34e1('0x12'),_0x34e1('0x30')+(_0x2dca3e[_0x34e1('0x1b')]||JSON[_0x34e1('0x31')](_0x2dca3e)),null,_0x147729));});});}function checkHopper(){function _0xa48953(){return function(_0x4388c3){logger[_0x34e1('0x12')](_0x34e1('0x32'),'checkHopper',util['inspect'](_0x4388c3,{'showHidden':![],'depth':null}));};}var _0x8ea2d7=function(_0x2f2cfe,_0x4970c6){var _0x2278aa=squel[_0x34e1('0x33')]()[_0x34e1('0x34')]('cm_hopper')[_0x34e1('0x35')]([_0x34e1('0x36'),_0x34e1('0x37'),_0x34e1('0x38'),_0x34e1('0x39'),_0x4970c6,_0x34e1('0x3a'),_0x34e1('0x3b')],squel['select']()['field'](_0x34e1('0x36'),_0x34e1('0x36'))[_0x34e1('0x3c')](_0x34e1('0x3d'),_0x34e1('0x37'))[_0x34e1('0x3c')]('id',_0x34e1('0x38'))[_0x34e1('0x3c')](LISTID[_0x34e1('0x3e')](),_0x34e1('0x39'))[_0x34e1('0x3c')](_0x2f2cfe['id'][_0x34e1('0x3e')](),_0x4970c6)[_0x34e1('0x3c')](_0x34e1('0x3d'),_0x34e1('0x3a'))['field'](_0x34e1('0x3d'),_0x34e1('0x3b'))[_0x34e1('0x3f')](_0x34e1('0x40'))[_0x34e1('0x41')]('deletedAt\x20IS\x20NULL')[_0x34e1('0x41')](_0x34e1('0x42'),LISTID[_0x34e1('0x3e')]())[_0x34e1('0x41')](_0x34e1('0x43'))[_0x34e1('0x41')](_0x34e1('0x44'),squel[_0x34e1('0x45')]()[_0x34e1('0x3c')](_0x34e1('0x36'))['from'](_0x34e1('0x46'))[_0x34e1('0x41')](_0x4970c6+_0x34e1('0x47'),_0x2f2cfe['id']['toString']())))[_0x34e1('0x3e')]();return _0x2278aa;};var _0x524d17=function(_0x942765,_0x20917e){var _0x112d7c=squel['insert']()['into'](_0x34e1('0x46'))['fromQuery']([_0x34e1('0x36'),_0x34e1('0x37'),'ContactId','ListId',_0x20917e,_0x34e1('0x3a'),_0x34e1('0x3b')],squel[_0x34e1('0x45')]()[_0x34e1('0x3c')](_0x34e1('0x36'),'phone')[_0x34e1('0x3c')]('NOW()',_0x34e1('0x37'))['field']('id',_0x34e1('0x38'))[_0x34e1('0x3c')](LISTID[_0x34e1('0x3e')](),_0x34e1('0x39'))[_0x34e1('0x3c')](_0x942765['id'][_0x34e1('0x3e')](),_0x20917e)['field'](_0x34e1('0x3d'),_0x34e1('0x3a'))[_0x34e1('0x3c')](_0x34e1('0x3d'),_0x34e1('0x3b'))[_0x34e1('0x3f')](_0x34e1('0x40'))[_0x34e1('0x41')](_0x34e1('0x48'))[_0x34e1('0x41')]('ListId\x20=\x20?',LISTID[_0x34e1('0x3e')]())[_0x34e1('0x41')]('id\x20IN\x20?',squel[_0x34e1('0x49')](hopperContacts))[_0x34e1('0x41')](_0x34e1('0x43'))[_0x34e1('0x41')](_0x34e1('0x44'),squel['select']()[_0x34e1('0x3c')](_0x34e1('0x4a'))[_0x34e1('0x3f')](_0x34e1('0x4b'))[_0x34e1('0x41')](_0x20917e+'\x20=\x20?',_0x942765['id'][_0x34e1('0x3e')]()))['where'](_0x34e1('0x44'),squel[_0x34e1('0x45')]()['field'](_0x34e1('0x36'))[_0x34e1('0x3f')](_0x34e1('0x46'))['where'](_0x20917e+_0x34e1('0x47'),_0x942765['id'][_0x34e1('0x3e')]())))['toString']();return _0x112d7c;};function _0x57482c(_0x30f4b9,_0x2d6678){var _0x5f3eba=squel['insert']()[_0x34e1('0x34')]('cm_hopper')[_0x34e1('0x35')]([_0x34e1('0x36'),_0x34e1('0x37'),_0x34e1('0x38'),'ListId',_0x2d6678,_0x34e1('0x3a'),_0x34e1('0x3b')],squel[_0x34e1('0x45')]()[_0x34e1('0x3c')]('phone',_0x34e1('0x36'))[_0x34e1('0x3c')]('NOW()',_0x34e1('0x37'))['field']('id',_0x34e1('0x38'))['field'](LISTID[_0x34e1('0x3e')](),_0x34e1('0x39'))['field'](_0x30f4b9['id'][_0x34e1('0x3e')](),_0x2d6678)['field'](_0x34e1('0x3d'),'createdAt')['field'](_0x34e1('0x3d'),_0x34e1('0x3b'))[_0x34e1('0x3f')](_0x34e1('0x40'))[_0x34e1('0x41')](_0x34e1('0x48'))[_0x34e1('0x41')]('ListId\x20=\x20?',LISTID[_0x34e1('0x3e')]())[_0x34e1('0x41')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x34e1('0x41')](_0x34e1('0x43')))[_0x34e1('0x3e')]();return _0x5f3eba;}function _0x502373(_0x169e13,_0x4ec034){var _0x13c358=squel[_0x34e1('0x33')]()[_0x34e1('0x34')](_0x34e1('0x4c'))[_0x34e1('0x35')]([_0x34e1('0x36'),_0x34e1('0x38'),_0x34e1('0x39'),_0x4ec034,_0x34e1('0x3a'),_0x34e1('0x3b')],squel[_0x34e1('0x45')]()['field'](_0x34e1('0x36'),_0x34e1('0x36'))['field']('id',_0x34e1('0x38'))[_0x34e1('0x3c')](LISTID[_0x34e1('0x3e')](),_0x34e1('0x39'))['field'](_0x169e13['id'][_0x34e1('0x3e')](),_0x4ec034)['field'](_0x34e1('0x3d'),_0x34e1('0x3a'))[_0x34e1('0x3c')](_0x34e1('0x3d'),_0x34e1('0x3b'))[_0x34e1('0x3f')](_0x34e1('0x40'))[_0x34e1('0x41')]('deletedAt\x20IS\x20NULL')['where'](_0x34e1('0x42'),LISTID[_0x34e1('0x3e')]())[_0x34e1('0x41')](_0x34e1('0x4d'),squel[_0x34e1('0x49')](hopperContacts))[_0x34e1('0x41')]('phone\x20IS\x20NOT\x20NULL'))[_0x34e1('0x3e')]();return _0x13c358;}return db[_0x34e1('0x4e')][_0x34e1('0x4f')]({'where':{'type':_0x34e1('0x50')},'attributes':['id',_0x34e1('0x51')],'include':[{'model':db[_0x34e1('0x52')],'as':_0x34e1('0x53'),'where':{'id':LISTID}}]})['then'](function(_0x55b368){var _0x2e3cc2=[];if(_0x55b368){var _0x53975b;for(var _0xe98ebb=0x0,_0x548c07;_0xe98ebb<_0x55b368[_0x34e1('0x19')];_0xe98ebb+=0x1){_0x548c07=_0x55b368[_0xe98ebb][_0x34e1('0x54')]({'plain':!![]});switch(_0x548c07[_0x34e1('0x51')]){case'always':_0x2e3cc2['push'](db[_0x34e1('0x55')][_0x34e1('0x56')](_0x524d17(_0x548c07,'VoiceQueueId'))['then'](function(){})[_0x34e1('0x2f')](_0xa48953()));break;case _0x34e1('0x57'):_0x2e3cc2[_0x34e1('0x2d')](db[_0x34e1('0x55')]['query'](_0x8ea2d7(_0x548c07,'VoiceQueueId'))['then'](function(){})['catch'](_0xa48953()));break;default:_0x2e3cc2[_0x34e1('0x2d')](db[_0x34e1('0x55')][_0x34e1('0x56')](_0x57482c(_0x548c07,_0x34e1('0x58')))['then'](function(){})[_0x34e1('0x2f')](_0xa48953()));}}}return _0x2e3cc2;})['all']()[_0x34e1('0x2c')](function(){return db[_0x34e1('0x4e')]['findAll']({'where':{'type':_0x34e1('0x50')},'attributes':['id'],'include':[{'model':db[_0x34e1('0x52')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x34e1('0x2c')](function(_0x25c949){var _0xbe10d2=[];if(_0x25c949){var _0x2b8e1d;for(var _0x318780=0x0,_0xd091ea;_0x318780<_0x25c949['length'];_0x318780+=0x1){_0xd091ea=_0x25c949[_0x318780]['get']({'plain':!![]});_0xbe10d2['push'](db[_0x34e1('0x55')][_0x34e1('0x56')](_0x502373(_0xd091ea,_0x34e1('0x58')))[_0x34e1('0x2c')](function(){})[_0x34e1('0x2f')](_0xa48953()));}}return _0xbe10d2;})['all']();})[_0x34e1('0x2c')](function(){return db[_0x34e1('0x59')][_0x34e1('0x4f')]({'attributes':['id',_0x34e1('0x51')],'include':[{'model':db[_0x34e1('0x52')],'as':_0x34e1('0x53'),'where':{'id':LISTID}}]})['then'](function(_0xc7963d){var _0xe30727=[];if(_0xc7963d){for(var _0x3d4e08=0x0,_0x4648d7;_0x3d4e08<_0xc7963d[_0x34e1('0x19')];_0x3d4e08+=0x1){_0x4648d7=_0xc7963d[_0x3d4e08][_0x34e1('0x54')]({'plain':!![]});switch(_0x4648d7[_0x34e1('0x51')]){case _0x34e1('0x5a'):_0xe30727[_0x34e1('0x2d')](db[_0x34e1('0x55')][_0x34e1('0x56')](_0x524d17(_0x4648d7,'CampaignId'))[_0x34e1('0x2c')](function(){})[_0x34e1('0x2f')](_0xa48953()));break;case _0x34e1('0x57'):_0xe30727['push'](db[_0x34e1('0x55')][_0x34e1('0x56')](_0x8ea2d7(_0x4648d7,_0x34e1('0x5b')))[_0x34e1('0x2c')](function(){})[_0x34e1('0x2f')](_0xa48953()));break;default:_0xe30727[_0x34e1('0x2d')](db[_0x34e1('0x55')]['query'](_0x57482c(_0x4648d7,_0x34e1('0x5b')))[_0x34e1('0x2c')](function(){})['catch'](_0xa48953()));}}}return _0xe30727;})[_0x34e1('0x5c')]();})[_0x34e1('0x2c')](function(){return db['Campaign'][_0x34e1('0x4f')]({'attributes':['id'],'include':[{'model':db[_0x34e1('0x52')],'as':_0x34e1('0x5d'),'where':{'id':LISTID}}]})['then'](function(_0x169c89){var _0x530cef=[];if(_0x169c89){for(var _0x5c7278=0x0,_0x71c994;_0x5c7278<_0x169c89[_0x34e1('0x19')];_0x5c7278+=0x1){_0x71c994=_0x169c89[_0x5c7278][_0x34e1('0x54')]({'plain':!![]});_0x530cef[_0x34e1('0x2d')](db[_0x34e1('0x55')][_0x34e1('0x56')](_0x502373(_0x71c994,_0x34e1('0x5b')))[_0x34e1('0x2c')](function(){})[_0x34e1('0x2f')](_0xa48953()));}}return _0x530cef;})[_0x34e1('0x5c')]();})[_0x34e1('0x2f')](function(_0x101e7b){logger['error']('cmContact,\x20%s,\x20%s',_0x34e1('0x5e'),_0x101e7b[_0x34e1('0x1b')]);});}var processPromises=function(_0x30ec37){return BPromise[_0x34e1('0x5c')](promises)['then'](function(_0x348df4){})[_0x34e1('0x2f')](function(_0x57003c){logger[_0x34e1('0x12')](_0x34e1('0x5f'),JSON['stringify'](_0x57003c));})[_0x34e1('0x60')](function(){socket[_0x34e1('0x61')](_0x34e1('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x30ec37){return _0x30ec37[_0x34e1('0x63')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x34e1('0x2c')](function(){if(hopperContacts){return checkHopper();}})[_0x34e1('0x2c')](function(){socket[_0x34e1('0x61')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x2f80fc){logger[_0x34e1('0x12')](_0x34e1('0x64'),JSON['stringify'](_0x2f80fc));}finally{process['exit'](0x0);}});};process['on'](_0x34e1('0x65'),function(){logger['info'](_0x34e1('0x66'));endCsv();});function main(){return BPromise[_0x34e1('0x67')]()[_0x34e1('0x2c')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x34e1('0x10')](',');return db[_0x34e1('0x29')][_0x34e1('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0xcb26a5){var _0x1acc64=fs[_0x34e1('0x68')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x1acc64,{'header':!![],'skipEmptyLines':!![],'step':function(_0x487180,_0x8a495f){total+=0x1;var _0x32eabf=total;promises['push'](checkRow(_0x487180,_0xcb26a5,_0x32eabf)['then'](function(){success+=0x1;})['catch'](function(_0x5b66d4){if(_0x5b66d4[_0x34e1('0x12')]){errors+=0x1;delete _0x5b66d4['error'];}else if(_0x5b66d4['duplicate']){duplicates+=0x1;delete _0x5b66d4[_0x34e1('0x27')];}rows['push'](_0x5b66d4);}));if(total%0xc8===0x0){_0x8a495f['pause']();return processPromises(_0x8a495f);}},'complete':function(){return processPromises()[_0x34e1('0x2c')](function(){logger[_0x34e1('0x69')](_0x34e1('0x6a'));endCsv();});},'error':function(_0x1630f5,_0x2646a6){logger[_0x34e1('0x69')](_0x34e1('0x6b'),JSON['stringify'](_0x1630f5));endCsv();}});})[_0x34e1('0x2f')](function(_0xd582a5){logger[_0x34e1('0x12')]('Error\x20executing\x20contact\x20csv\x20import:',JSON['stringify'](_0xd582a5));});}main(); \ No newline at end of file +var _0x02da=['CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','zipObject','split','Missing\x20ListId\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','phone','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','into','cm_hopper','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','from','where','deletedAt\x20IS\x20NULL','toString','phone\x20IS\x20NOT\x20NULL','\x20=\x20?','cm_contacts','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','insert','ListId\x20=\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','query','VoiceQueueId','catch','onlyIfOpen','all','BlackLists','Campaign'];(function(_0x50f112,_0xd38e53){var _0x4ecf28=function(_0x62b75){while(--_0x62b75){_0x50f112['push'](_0x50f112['shift']());}};_0x4ecf28(++_0xd38e53);}(_0x02da,0x8a));var _0xa02d=function(_0x274118,_0x5860c1){_0x274118=_0x274118-0x0;var _0x2da583=_0x02da[_0x274118];return _0x2da583;};'use strict';var BPromise=require(_0xa02d('0x0'));var util=require('util');var _=require(_0xa02d('0x1'));var fs=require('fs');var squel=require(_0xa02d('0x2'));var Papa=require(_0xa02d('0x3'));var Redis=require(_0xa02d('0x4'));var db=require(_0xa02d('0x5'))['db'];var config=require(_0xa02d('0x6'));var logger=require(_0xa02d('0x7'))(_0xa02d('0x8'));config[_0xa02d('0x9')]=_[_0xa02d('0xa')](config[_0xa02d('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xa02d('0xb'))(new Redis(config[_0xa02d('0x9')]));require(_0xa02d('0xc'))[_0xa02d('0xd')](socket);try{if(!process[_0xa02d('0xe')][0x2]||process[_0xa02d('0xe')][0x2]===_0xa02d('0xf')||process[_0xa02d('0xe')][0x2]===_0xa02d('0x10')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0xa02d('0xe')][0x2];if(!process[_0xa02d('0xe')][0x3]||process[_0xa02d('0xe')][0x3]===_0xa02d('0xf')||process['argv'][0x3]===_0xa02d('0x10')||!process[_0xa02d('0xe')][0x4]||process['argv'][0x4]===_0xa02d('0xf')||process[_0xa02d('0xe')][0x4]===_0xa02d('0x10')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0xa02d('0x11')](process[_0xa02d('0xe')][0x3][_0xa02d('0x12')](','),process[_0xa02d('0xe')][0x4]['split'](','));if(!process[_0xa02d('0xe')][0x5]||process[_0xa02d('0xe')][0x5]===_0xa02d('0xf')||process['argv'][0x5]===_0xa02d('0x10')){throw new Error(_0xa02d('0x13'));}var LISTID=process[_0xa02d('0xe')][0x5];var COMPANYID=process[_0xa02d('0xe')][0x6]&&process[_0xa02d('0xe')][0x6]!==_0xa02d('0xf')&&process[_0xa02d('0xe')][0x6]!==_0xa02d('0x10')?process['argv'][0x6]:null;var DUPLICATES=process[_0xa02d('0xe')][0x7]&&process[_0xa02d('0xe')][0x7]!==_0xa02d('0xf')&&process[_0xa02d('0xe')][0x7]!=='null'?process['argv'][0x7]:null;if(!process[_0xa02d('0xe')][0x8]||process[_0xa02d('0xe')][0x8]===_0xa02d('0xf')||process[_0xa02d('0xe')][0x8]===_0xa02d('0x10')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x13cffa){logger[_0xa02d('0x14')](_0x13cffa);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(_0x200067,_0xebe9ee,_0x51bd5e,_0x473fb1){var _0x156c72={'message':_0xebe9ee};_0x156c72[_0x200067]=!![];if(_0x51bd5e){_0x156c72[_0xa02d('0x15')]=_0x51bd5e;}if(_0x473fb1){_0x156c72[_0xa02d('0x16')]=_0x473fb1;}return _0x156c72;}function isEmail(_0x33bd99){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))*$/[_0xa02d('0x17')](_0x33bd99);}function checkRow(_0x34c69c,_0x172b33,_0xd5b31d){return new BPromise(function(_0x4658fe,_0x38e82e){if(_[_0xa02d('0x18')](_0x34c69c)){return _0x38e82e(handleCheckRowError('error',_0xa02d('0x19'),null,_0xd5b31d));}if(_0x34c69c[_0xa02d('0x1a')]&&_0x34c69c[_0xa02d('0x1a')][_0xa02d('0x1b')]){var _0x565dee=_[_0xa02d('0x1c')](_0x34c69c[_0xa02d('0x1a')],_0xa02d('0x1d'))[_0xa02d('0x1e')](';');return _0x38e82e(handleCheckRowError(_0xa02d('0x14'),_0x565dee,null,_0xd5b31d));}var _0x2b6405={};for(var _0x1e9cf8 in FIELDS){if(FIELDS[_0xa02d('0x1f')](_0x1e9cf8)&&FIELDS[_0x1e9cf8]){_0x2b6405[_0x1e9cf8]=_0x34c69c['data'][0x0][FIELDS[_0x1e9cf8]]||_0x34c69c[_0xa02d('0x20')][0x0]['\ufeff'+FIELDS[_0x1e9cf8]];}}if(!_0x2b6405[_0xa02d('0x21')]){return _0x38e82e(handleCheckRowError(_0xa02d('0x14'),'firstName\x20not\x20specified!',null,_0xd5b31d));}if(!_0x2b6405[_0xa02d('0x22')]){return _0x38e82e(handleCheckRowError('error','phone\x20not\x20specified!',null,_0xd5b31d));}if(_0x2b6405[_0xa02d('0x23')]){var _0x263d76=moment(_0x2b6405[_0xa02d('0x23')],_0xa02d('0x24'));if(!_0x263d76[_0xa02d('0x25')]()){return _0x38e82e(handleCheckRowError(_0xa02d('0x14'),_0xa02d('0x26'),null,_0xd5b31d));}}if(_0x2b6405[_0xa02d('0x27')]){if(!isEmail(_0x2b6405[_0xa02d('0x27')])){return _0x38e82e(handleCheckRowError(_0xa02d('0x14'),_0xa02d('0x28'),null,_0xd5b31d));}}_0x2b6405[_0xa02d('0x29')]=LISTID;_0x2b6405[_0xa02d('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x172b33){var _0x4b811e={};for(var _0x3b97cb=0x0,_0x278b6a=DUPLICATES['length'];_0x3b97cb<_0x278b6a;_0x3b97cb+=0x1){_0x4b811e[DUPLICATES[_0x3b97cb]]=_0x2b6405[DUPLICATES[_0x3b97cb]];}var _0x5a9b76=_[_0xa02d('0x2b')](_0x172b33,_0x4b811e);if(_0x5a9b76){return _0x38e82e(handleCheckRowError(_0xa02d('0x2c'),_0xa02d('0x2d'),_0x5a9b76,_0xd5b31d));}}return db[_0xa02d('0x2e')][_0xa02d('0x2f')](_0x2b6405,{'raw':!![],'hooks':![],'fields':_[_0xa02d('0x30')](_0x2b6405)})[_0xa02d('0x31')](function(_0xc96809){if(DUPLICATES&&DUPLICATES[_0xa02d('0x1b')]&&_0x172b33){_0x172b33[_0xa02d('0x32')](_[_0xa02d('0x33')](_0x2b6405,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xc96809['id'];return _0x4658fe();})['catch'](function(_0x42b8d4){return _0x38e82e(handleCheckRowError('error',_0xa02d('0x34')+(_0x42b8d4[_0xa02d('0x1d')]||JSON[_0xa02d('0x35')](_0x42b8d4)),null,_0xd5b31d));});});}function checkHopper(){function _0x49adf3(){return function(_0x306b3d){logger['error']('cmContact',_0xa02d('0x36'),util[_0xa02d('0x37')](_0x306b3d,{'showHidden':![],'depth':null}));};}var _0x237eab=function(_0x2e70d8,_0x56651e){var _0x141ebb=squel['insert']()[_0xa02d('0x38')](_0xa02d('0x39'))['fromQuery']([_0xa02d('0x22'),_0xa02d('0x3a'),_0xa02d('0x3b'),_0xa02d('0x29'),_0x56651e,_0xa02d('0x3c'),_0xa02d('0x3d')],squel[_0xa02d('0x3e')]()[_0xa02d('0x3f')](_0xa02d('0x22'),_0xa02d('0x22'))[_0xa02d('0x3f')](_0xa02d('0x40'),_0xa02d('0x3a'))[_0xa02d('0x3f')]('id','ContactId')[_0xa02d('0x3f')](LISTID['toString'](),_0xa02d('0x29'))[_0xa02d('0x3f')](_0x2e70d8['id']['toString'](),_0x56651e)['field'](_0xa02d('0x40'),_0xa02d('0x3c'))['field'](_0xa02d('0x40'),_0xa02d('0x3d'))[_0xa02d('0x41')]('cm_contacts')[_0xa02d('0x42')](_0xa02d('0x43'))[_0xa02d('0x42')]('ListId\x20=\x20?',LISTID[_0xa02d('0x44')]())[_0xa02d('0x42')](_0xa02d('0x45'))[_0xa02d('0x42')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xa02d('0x3f')](_0xa02d('0x22'))[_0xa02d('0x41')](_0xa02d('0x39'))['where'](_0x56651e+_0xa02d('0x46'),_0x2e70d8['id'][_0xa02d('0x44')]())))[_0xa02d('0x44')]();return _0x141ebb;};var _0x51cb6c=function(_0x4f174d,_0x1cb2cd){var _0x622b57=squel['insert']()[_0xa02d('0x38')](_0xa02d('0x39'))['fromQuery']([_0xa02d('0x22'),_0xa02d('0x3a'),'ContactId',_0xa02d('0x29'),_0x1cb2cd,'createdAt',_0xa02d('0x3d')],squel[_0xa02d('0x3e')]()[_0xa02d('0x3f')](_0xa02d('0x22'),_0xa02d('0x22'))[_0xa02d('0x3f')](_0xa02d('0x40'),'scheduledAt')['field']('id',_0xa02d('0x3b'))[_0xa02d('0x3f')](LISTID[_0xa02d('0x44')](),'ListId')[_0xa02d('0x3f')](_0x4f174d['id']['toString'](),_0x1cb2cd)[_0xa02d('0x3f')](_0xa02d('0x40'),_0xa02d('0x3c'))[_0xa02d('0x3f')](_0xa02d('0x40'),'updatedAt')[_0xa02d('0x41')](_0xa02d('0x47'))[_0xa02d('0x42')](_0xa02d('0x43'))['where']('ListId\x20=\x20?',LISTID['toString']())[_0xa02d('0x42')](_0xa02d('0x48'),squel[_0xa02d('0x49')](hopperContacts))['where'](_0xa02d('0x45'))[_0xa02d('0x42')](_0xa02d('0x4a'),squel[_0xa02d('0x3e')]()[_0xa02d('0x3f')](_0xa02d('0x4b'))[_0xa02d('0x41')](_0xa02d('0x4c'))['where'](_0x1cb2cd+_0xa02d('0x46'),_0x4f174d['id']['toString']()))[_0xa02d('0x42')](_0xa02d('0x4a'),squel[_0xa02d('0x3e')]()['field'](_0xa02d('0x22'))['from'](_0xa02d('0x39'))[_0xa02d('0x42')](_0x1cb2cd+_0xa02d('0x46'),_0x4f174d['id'][_0xa02d('0x44')]())))['toString']();return _0x622b57;};function _0x43f965(_0x2a183e,_0x576ee3){var _0x1d9258=squel[_0xa02d('0x4d')]()[_0xa02d('0x38')](_0xa02d('0x39'))['fromQuery']([_0xa02d('0x22'),_0xa02d('0x3a'),'ContactId',_0xa02d('0x29'),_0x576ee3,_0xa02d('0x3c'),_0xa02d('0x3d')],squel[_0xa02d('0x3e')]()[_0xa02d('0x3f')]('phone','phone')[_0xa02d('0x3f')](_0xa02d('0x40'),_0xa02d('0x3a'))['field']('id',_0xa02d('0x3b'))[_0xa02d('0x3f')](LISTID[_0xa02d('0x44')](),_0xa02d('0x29'))[_0xa02d('0x3f')](_0x2a183e['id'][_0xa02d('0x44')](),_0x576ee3)['field'](_0xa02d('0x40'),_0xa02d('0x3c'))[_0xa02d('0x3f')]('NOW()',_0xa02d('0x3d'))['from'](_0xa02d('0x47'))[_0xa02d('0x42')](_0xa02d('0x43'))['where'](_0xa02d('0x4e'),LISTID[_0xa02d('0x44')]())[_0xa02d('0x42')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0xa02d('0x42')](_0xa02d('0x45')))[_0xa02d('0x44')]();return _0x1d9258;}function _0x1720a2(_0x30a56f,_0x1b1b18){var _0xb4d209=squel[_0xa02d('0x4d')]()[_0xa02d('0x38')](_0xa02d('0x4f'))['fromQuery']([_0xa02d('0x22'),_0xa02d('0x3b'),_0xa02d('0x29'),_0x1b1b18,'createdAt','updatedAt'],squel['select']()[_0xa02d('0x3f')]('phone',_0xa02d('0x22'))['field']('id','ContactId')[_0xa02d('0x3f')](LISTID[_0xa02d('0x44')](),_0xa02d('0x29'))[_0xa02d('0x3f')](_0x30a56f['id'][_0xa02d('0x44')](),_0x1b1b18)[_0xa02d('0x3f')](_0xa02d('0x40'),_0xa02d('0x3c'))[_0xa02d('0x3f')](_0xa02d('0x40'),'updatedAt')[_0xa02d('0x41')](_0xa02d('0x47'))[_0xa02d('0x42')]('deletedAt\x20IS\x20NULL')[_0xa02d('0x42')](_0xa02d('0x4e'),LISTID[_0xa02d('0x44')]())[_0xa02d('0x42')](_0xa02d('0x48'),squel['str'](hopperContacts))[_0xa02d('0x42')]('phone\x20IS\x20NOT\x20NULL'))[_0xa02d('0x44')]();return _0xb4d209;}return db[_0xa02d('0x50')][_0xa02d('0x51')]({'where':{'type':_0xa02d('0x52')},'attributes':['id',_0xa02d('0x53')],'include':[{'model':db[_0xa02d('0x54')],'as':_0xa02d('0x55'),'where':{'id':LISTID}}]})[_0xa02d('0x31')](function(_0xf8d68a){var _0x384871=[];if(_0xf8d68a){var _0x2ccadd;for(var _0x278f59=0x0,_0x58d5c5;_0x278f59<_0xf8d68a[_0xa02d('0x1b')];_0x278f59+=0x1){_0x58d5c5=_0xf8d68a[_0x278f59][_0xa02d('0x56')]({'plain':!![]});switch(_0x58d5c5[_0xa02d('0x53')]){case _0xa02d('0x57'):_0x384871[_0xa02d('0x32')](db[_0xa02d('0x58')][_0xa02d('0x59')](_0x51cb6c(_0x58d5c5,_0xa02d('0x5a')))['then'](function(){})[_0xa02d('0x5b')](_0x49adf3()));break;case _0xa02d('0x5c'):_0x384871[_0xa02d('0x32')](db[_0xa02d('0x58')][_0xa02d('0x59')](_0x237eab(_0x58d5c5,_0xa02d('0x5a')))[_0xa02d('0x31')](function(){})[_0xa02d('0x5b')](_0x49adf3()));break;default:_0x384871[_0xa02d('0x32')](db[_0xa02d('0x58')][_0xa02d('0x59')](_0x43f965(_0x58d5c5,_0xa02d('0x5a')))[_0xa02d('0x31')](function(){})[_0xa02d('0x5b')](_0x49adf3()));}}}return _0x384871;})[_0xa02d('0x5d')]()['then'](function(){return db[_0xa02d('0x50')][_0xa02d('0x51')]({'where':{'type':_0xa02d('0x52')},'attributes':['id'],'include':[{'model':db[_0xa02d('0x54')],'as':_0xa02d('0x5e'),'where':{'id':LISTID}}]})[_0xa02d('0x31')](function(_0x424c91){var _0x118821=[];if(_0x424c91){var _0x26e9fe;for(var _0x8b98d=0x0,_0x3c0899;_0x8b98d<_0x424c91['length'];_0x8b98d+=0x1){_0x3c0899=_0x424c91[_0x8b98d][_0xa02d('0x56')]({'plain':!![]});_0x118821[_0xa02d('0x32')](db[_0xa02d('0x58')][_0xa02d('0x59')](_0x1720a2(_0x3c0899,_0xa02d('0x5a')))['then'](function(){})[_0xa02d('0x5b')](_0x49adf3()));}}return _0x118821;})[_0xa02d('0x5d')]();})[_0xa02d('0x31')](function(){return db[_0xa02d('0x5f')]['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0xa02d('0x55'),'where':{'id':LISTID}}]})[_0xa02d('0x31')](function(_0x3c59ed){var _0x2b3ea5=[];if(_0x3c59ed){for(var _0x234913=0x0,_0x5b3414;_0x234913<_0x3c59ed[_0xa02d('0x1b')];_0x234913+=0x1){_0x5b3414=_0x3c59ed[_0x234913][_0xa02d('0x56')]({'plain':!![]});switch(_0x5b3414[_0xa02d('0x53')]){case _0xa02d('0x57'):_0x2b3ea5[_0xa02d('0x32')](db['sequelize'][_0xa02d('0x59')](_0x51cb6c(_0x5b3414,_0xa02d('0x60')))[_0xa02d('0x31')](function(){})[_0xa02d('0x5b')](_0x49adf3()));break;case _0xa02d('0x5c'):_0x2b3ea5[_0xa02d('0x32')](db[_0xa02d('0x58')][_0xa02d('0x59')](_0x237eab(_0x5b3414,_0xa02d('0x60')))[_0xa02d('0x31')](function(){})[_0xa02d('0x5b')](_0x49adf3()));break;default:_0x2b3ea5['push'](db['sequelize'][_0xa02d('0x59')](_0x43f965(_0x5b3414,_0xa02d('0x60')))['then'](function(){})['catch'](_0x49adf3()));}}}return _0x2b3ea5;})['all']();})[_0xa02d('0x31')](function(){return db[_0xa02d('0x5f')][_0xa02d('0x51')]({'attributes':['id'],'include':[{'model':db[_0xa02d('0x54')],'as':_0xa02d('0x5e'),'where':{'id':LISTID}}]})[_0xa02d('0x31')](function(_0x318432){var _0x8fc5e1=[];if(_0x318432){for(var _0x43092b=0x0,_0x12c446;_0x43092b<_0x318432[_0xa02d('0x1b')];_0x43092b+=0x1){_0x12c446=_0x318432[_0x43092b][_0xa02d('0x56')]({'plain':!![]});_0x8fc5e1[_0xa02d('0x32')](db[_0xa02d('0x58')][_0xa02d('0x59')](_0x1720a2(_0x12c446,_0xa02d('0x60')))[_0xa02d('0x31')](function(){})[_0xa02d('0x5b')](_0x49adf3()));}}return _0x8fc5e1;})['all']();})[_0xa02d('0x5b')](function(_0xaa2ab7){logger[_0xa02d('0x14')](_0xa02d('0x61'),_0xa02d('0x62'),_0xaa2ab7['message']);});}var processPromises=function(_0x1c1434){return BPromise[_0xa02d('0x5d')](promises)[_0xa02d('0x31')](function(_0x55fb8b){})['catch'](function(_0x120244){logger[_0xa02d('0x14')](_0xa02d('0x63'),JSON['stringify'](_0x120244));})[_0xa02d('0x64')](function(){socket[_0xa02d('0x65')](_0xa02d('0x66')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1c1434){return _0x1c1434[_0xa02d('0x67')]();}});};var endCsv=function(){return BPromise[_0xa02d('0x68')]()[_0xa02d('0x31')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket['emit'](_0xa02d('0x66')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xa02d('0x69')](FILEPATH);}catch(_0x473d04){logger[_0xa02d('0x14')](_0xa02d('0x6a'),JSON['stringify'](_0x473d04));}finally{process[_0xa02d('0x6b')](0x0);}});};process['on'](_0xa02d('0x6c'),function(){logger['info'](_0xa02d('0x6d'));endCsv();});function main(){return BPromise[_0xa02d('0x68')]()[_0xa02d('0x31')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xa02d('0x12')](',');return db[_0xa02d('0x2e')][_0xa02d('0x51')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xa02d('0x31')](function(_0x27827e){var _0x32988f=fs[_0xa02d('0x6e')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xa02d('0x6f')](_0x32988f,{'header':!![],'skipEmptyLines':!![],'step':function(_0x50086f,_0x1c7058){total+=0x1;var _0x50f4de=total;promises[_0xa02d('0x32')](checkRow(_0x50086f,_0x27827e,_0x50f4de)[_0xa02d('0x31')](function(){success+=0x1;})[_0xa02d('0x5b')](function(_0x3ed086){if(_0x3ed086[_0xa02d('0x14')]){errors+=0x1;delete _0x3ed086[_0xa02d('0x14')];}else if(_0x3ed086[_0xa02d('0x2c')]){duplicates+=0x1;delete _0x3ed086[_0xa02d('0x2c')];}rows[_0xa02d('0x32')](_0x3ed086);}));if(total%0xc8===0x0){_0x1c7058[_0xa02d('0x70')]();return processPromises(_0x1c7058);}},'complete':function(){return processPromises()[_0xa02d('0x31')](function(){logger[_0xa02d('0x71')](_0xa02d('0x72'));endCsv();});},'error':function(_0x2e32b4,_0x37912b){logger[_0xa02d('0x71')](_0xa02d('0x73'),JSON['stringify'](_0x2e32b4));endCsv();}});})[_0xa02d('0x5b')](function(_0x500f3){logger[_0xa02d('0x14')](_0xa02d('0x74'),JSON[_0xa02d('0x35')](_0x500f3));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 564c56e..b956228 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 _0x5715=['fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','toString','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','updatedAt','cm_hopper_black','\x20=\x20?','.offset-cm_contacts.utcOffset\x20minute)','priority','UserId','recallme','.CmListId\x20=\x20?','ListId\x20=\x20?','keys',')\x20NOT\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','push','sequelize','spread','campaigns.id','campaigns.dialTimezone','campaigns_has_cm_lists','campaigns_has_cm_lists.CmListId=','length','all','then','catch','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','timezones','dialTimezone','set','offset','query','main','stringify','send','start','socket_timestamp','root','server/files/tmp','.csv','includes','header',',utcOffset','parse','createReadStream','data','rows','errors','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','isNil','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','abort','SystemError','step','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','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','CompanyId','duplicates','DROP\x20TABLE\x20','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','campaigns','finish','affectedRows','unlink','exit','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','path','lodash','papaparse','util','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','defaults','redis','socket.io-emitter','format','select','field','phone','from','.id\x20=\x20','where','\x20=\x20','join','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt'];(function(_0x489c95,_0x53159c){var _0x10e7a7=function(_0xcb4342){while(--_0xcb4342){_0x489c95['push'](_0x489c95['shift']());}};_0x10e7a7(++_0x53159c);}(_0x5715,0x111));var _0x5571=function(_0x455150,_0x274121){_0x455150=_0x455150-0x0;var _0x12ca9c=_0x5715[_0x455150];return _0x12ca9c;};'use strict';var fs=require('fs');var path=require(_0x5571('0x0'));var _=require(_0x5571('0x1'));var Papa=require(_0x5571('0x2'));var util=require(_0x5571('0x3'));var BPromise=require(_0x5571('0x4'));var moment=require('moment');var squel=require(_0x5571('0x5'));var Redis=require(_0x5571('0x6'));var db=require(_0x5571('0x7'))['db'];var config=require(_0x5571('0x8'));var shared=require('../../../config/environment/shared');var logger=require(_0x5571('0x9'))(_0x5571('0xa'));config['redis']=_[_0x5571('0xb')](config[_0x5571('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x5571('0xd'))(new Redis(config[_0x5571('0xc')]));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()[_0x5571('0xe')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x36567e){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'](_0x36567e);}function selectNotIn(_0x14c699,_0x417721,_0x1c019f,_0x2d9a4b,_0x50442d){return squel[_0x5571('0xf')]()[_0x5571('0x10')](_0x5571('0x11'))[_0x5571('0x12')](_0x2d9a4b)['join'](_0x417721,null,_0x417721+_0x5571('0x13')+_0x2d9a4b+'.'+_0x1c019f)[_0x5571('0x14')](_0x2d9a4b+'.'+_0x1c019f+_0x5571('0x15')+_0x14c699+'.'+_0x1c019f)[_0x5571('0x14')](_0x417721+'.dialCheckDuplicateType\x20IN\x20('+_0x50442d[_0x5571('0x16')]()+')');}function insertCmHopper(_0x3b488a,_0x532319,_0x175173,_0x127d22,_0x810e42){var _0x49d9ed=[_0x5571('0x17'),_0x5571('0x18'),'cm_contacts.id','cm_contacts.ListId',_0x532319+'.'+_0x127d22,'cm_contacts.createdAt','cm_contacts.updatedAt',_0x5571('0x19'),_0x5571('0x1a'),'\x22'+_0x810e42+'\x22'];return squel[_0x5571('0x1b')]()[_0x5571('0x1c')](_0x5571('0x1d'))[_0x5571('0x1e')]([_0x5571('0x11'),_0x5571('0x1f'),_0x5571('0x20'),_0x5571('0x21'),_0x127d22,_0x5571('0x22'),'updatedAt','priority','UserId','recallme'],squel[_0x5571('0xf')]()[_0x5571('0x23')](_0x49d9ed)['from'](_0x532319)[_0x5571('0x16')](_0x5571('0x24'),null,_0x5571('0x25')+_0x532319+_0x5571('0x26'))[_0x5571('0x16')](_0x175173,null,_0x175173+_0x5571('0x13')+_0x532319+'.'+_0x127d22)[_0x5571('0x14')](_0x532319+'.CmListId\x20=\x20?',_0x3b488a)['where'](_0x5571('0x27'),NOW)[_0x5571('0x14')](_0x5571('0x28'),selectNotIn(_0x532319,_0x175173,_0x127d22,'cm_hopper',['\x22always\x22',_0x5571('0x29')]))['where'](_0x5571('0x28'),selectNotIn(_0x532319,_0x175173,_0x127d22,_0x5571('0x1d'),[_0x5571('0x2a')])))[_0x5571('0x2b')]();}function insertCmHopperBlack(_0x2a9442,_0xed3b2e,_0x25d2d6,_0xf4e4d3){var _0xf6e220=[_0x5571('0x17'),_0x5571('0x2c'),_0x5571('0x2d'),_0xed3b2e+'.'+_0xf4e4d3,_0x5571('0x2e'),_0x5571('0x2f')];return squel[_0x5571('0x1b')]()[_0x5571('0x1c')]('cm_hopper_black')[_0x5571('0x1e')]([_0x5571('0x11'),_0x5571('0x20'),'ListId',_0xf4e4d3,'createdAt',_0x5571('0x30')],squel['select']()[_0x5571('0x23')](_0xf6e220)[_0x5571('0x12')](_0xed3b2e)[_0x5571('0x16')](_0x5571('0x24'),null,'cm_contacts.ListId\x20=\x20'+_0xed3b2e+'.CmListId')[_0x5571('0x16')](_0x25d2d6,null,_0x25d2d6+'.id\x20=\x20'+_0xed3b2e+'.'+_0xf4e4d3)[_0x5571('0x14')](_0xed3b2e+'.CmListId\x20=\x20?',_0x2a9442)[_0x5571('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x5571('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x5571('0xf')]()[_0x5571('0x10')](_0x5571('0x11'))[_0x5571('0x12')](_0x5571('0x31'))['where']('ListId\x20=\x20?',_0x2a9442)[_0x5571('0x14')](_0xf4e4d3+_0x5571('0x32'),_0xed3b2e+'.'+_0xf4e4d3)))['toString']();}function insertTzCmHopper(_0x4312f9,_0x50f934,_0x56d287,_0xf61022,_0x1d4862,_0x47254f){var _0x79447a=[_0x5571('0x17'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x47254f+_0x5571('0x33'),_0x5571('0x2c'),'cm_contacts.ListId',_0x50f934+'.'+_0xf61022,'cm_contacts.createdAt',_0x5571('0x2f'),_0x5571('0x19'),_0x5571('0x1a'),'\x22'+_0x1d4862+'\x22'];var _0x5a3f0c=squel[_0x5571('0x1b')]()[_0x5571('0x1c')](_0x5571('0x1d'))[_0x5571('0x1e')]([_0x5571('0x11'),_0x5571('0x1f'),_0x5571('0x20'),_0x5571('0x21'),_0xf61022,_0x5571('0x22'),_0x5571('0x30'),_0x5571('0x34'),_0x5571('0x35'),_0x5571('0x36')],squel[_0x5571('0xf')]()['fields'](_0x79447a)['from'](_0x50f934)[_0x5571('0x16')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x50f934+_0x5571('0x26'))[_0x5571('0x16')](_0x56d287,null,_0x56d287+_0x5571('0x13')+_0x50f934+'.'+_0xf61022)[_0x5571('0x16')](_0x47254f,null,_0x47254f+_0x5571('0x13')+_0x50f934+'.'+_0xf61022)[_0x5571('0x14')](_0x50f934+_0x5571('0x37'),_0x4312f9)[_0x5571('0x14')](_0x5571('0x27'),NOW)['where'](_0x5571('0x28'),selectNotIn(_0x50f934,_0x56d287,_0xf61022,_0x5571('0x1d'),[_0x5571('0x2a'),_0x5571('0x29')]))[_0x5571('0x14')](_0x5571('0x28'),selectNotIn(_0x50f934,_0x56d287,_0xf61022,_0x5571('0x1d'),['\x22always\x22'])))[_0x5571('0x2b')]();return _0x5a3f0c;}function insertTzCmHopperBlack(_0xe34b18,_0x4d919a,_0x2c5026,_0x3cc4fc){var _0x17422c=[_0x5571('0x17'),_0x5571('0x2c'),'cm_contacts.ListId',_0x4d919a+'.'+_0x3cc4fc,_0x5571('0x2e'),'cm_contacts.updatedAt'];return squel[_0x5571('0x1b')]()[_0x5571('0x1c')]('cm_hopper_black')[_0x5571('0x1e')](['phone',_0x5571('0x20'),_0x5571('0x21'),_0x3cc4fc,_0x5571('0x22'),_0x5571('0x30')],squel[_0x5571('0xf')]()['fields'](_0x17422c)[_0x5571('0x12')](_0x4d919a)[_0x5571('0x16')](_0x5571('0x24'),null,'cm_contacts.ListId\x20=\x20'+_0x4d919a+_0x5571('0x26'))[_0x5571('0x16')](_0x2c5026,null,_0x2c5026+_0x5571('0x13')+_0x4d919a+'.'+_0x3cc4fc)[_0x5571('0x14')](_0x4d919a+_0x5571('0x37'),_0xe34b18)[_0x5571('0x14')](_0x5571('0x27'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x5571('0xf')]()[_0x5571('0x10')](_0x5571('0x11'))[_0x5571('0x12')](_0x5571('0x31'))[_0x5571('0x14')](_0x5571('0x38'),_0xe34b18)[_0x5571('0x14')](_0x3cc4fc+_0x5571('0x32'),_0x4d919a+'.'+_0x3cc4fc)))[_0x5571('0x2b')]();}function insertCmContact(_0x784420,_0x6bed6a,_0x26b69e,_0x4d5a27){var _0x23a3f4=_['concat'](_[_0x5571('0x39')](_0x4d5a27),[_0x5571('0x21'),'CompanyId','createdAt',_0x5571('0x30')]);return squel['insert']()[_0x5571('0x1c')](_0x5571('0x24'))[_0x5571('0x1e')](_0x23a3f4,squel[_0x5571('0xf')]()[_0x5571('0x23')](_0x23a3f4)[_0x5571('0x12')](_0x6bed6a)[_0x5571('0x14')]('('+_0x26b69e[_0x5571('0x16')](',')+_0x5571('0x3a'),squel[_0x5571('0xf')]()[_0x5571('0x23')](_0x26b69e)[_0x5571('0x12')](_0x5571('0x24'))[_0x5571('0x14')](_0x5571('0x38'),_0x784420)[_0x5571('0x14')]('deletedAt\x20IS\x20NULL'))[_0x5571('0x14')]('id\x20IN\x20?',squel[_0x5571('0xf')]()[_0x5571('0x10')](_0x5571('0x3b'),_0x5571('0x3c'))['from'](_0x6bed6a)[_0x5571('0x3d')](_0x26b69e[_0x5571('0x16')](','))))['toString']();}function handleStop(){logger[_0x5571('0x3e')](_0x5571('0x3f'));stopped=!![];}function handleUncaughtException(_0x51fb72){logger[_0x5571('0x40')](_0x51fb72[_0x5571('0x41')]);process['exit'](0x1);}function handleError(_0x58b7b4,_0x485817){stats['errors'][_0x5571('0x42')]({'name':_0x485817['code'],'message':_0x485817[_0x5571('0x41')],'row':_0x58b7b4});}function handleQuery(_0x9f943f){logger[_0x5571('0x3e')](_0x9f943f);return db[_0x5571('0x43')]['query'](_0x9f943f)[_0x5571('0x44')](function(_0x85deef){results[_0x5571('0x42')](_0x85deef);})['catch'](function(_0xc38526){logger[_0x5571('0x40')](_0xc38526[_0x5571('0x41')]);});}function updateTzCampaigns(_0x5f167c){return new Promise(function(_0x2650d4,_0x441d59){var _0x390c70=squel[_0x5571('0xf')]()[_0x5571('0x23')]([_0x5571('0x45'),_0x5571('0x46')])[_0x5571('0x12')]('campaigns')[_0x5571('0x16')](_0x5571('0x47'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')['where'](_0x5571('0x48')+_0x5f167c);db['sequelize']['query'](_0x390c70[_0x5571('0x2b')]())[_0x5571('0x44')](function(_0x4996b1){var _0x1ebf76=[];for(var _0x1d93b6=0x0;_0x1d93b6<_0x4996b1[_0x5571('0x49')];_0x1d93b6++){_0x1ebf76[_0x5571('0x42')](getTimezoneData(_0x4996b1[_0x1d93b6],tmp_campaigns));}BPromise[_0x5571('0x4a')](_0x1ebf76)[_0x5571('0x4b')](function(){_0x2650d4({'val':0x1});});})[_0x5571('0x4c')](function(_0x37e998){logger[_0x5571('0x40')](_0x37e998['message']);_0x2650d4({'val':0x0});});});}function updateTzVoiceQueues(_0x2deec7){return new Promise(function(_0x2fe10b,_0x4f3baf){var _0x38ec21=squel[_0x5571('0xf')]()[_0x5571('0x23')]([_0x5571('0x4d'),_0x5571('0x4e')])[_0x5571('0x12')](_0x5571('0x4f'))[_0x5571('0x16')](_0x5571('0x50'),null,_0x5571('0x51'))[_0x5571('0x14')]('voice_queues_has_cm_lists.CmListId='+_0x2deec7);db[_0x5571('0x43')]['query'](_0x38ec21['toString']())[_0x5571('0x44')](function(_0x558bd4){var _0x3e8a9a=[];for(var _0x7304e5=0x0;_0x7304e5<_0x558bd4[_0x5571('0x49')];_0x7304e5++){_0x3e8a9a[_0x5571('0x42')](getTimezoneData(_0x558bd4[_0x7304e5],tmp_voice_queues));}BPromise[_0x5571('0x4a')](_0x3e8a9a)[_0x5571('0x4b')](function(){_0x2fe10b({'val':0x1});});})[_0x5571('0x4c')](function(_0x130b73){logger['error'](_0x130b73['message']);_0x2fe10b({'val':0x0});});});}function getTimezoneData(_0x6eb9cc,_0x306344){return new Promise(function(_0x4e4c5b,_0x376468){var _0xed01ac=shared[_0x5571('0x52')];var _0x14b852=_0xed01ac[_0x6eb9cc[_0x5571('0x53')]];if(_['isNil'](_0x14b852)){_0x4e4c5b({'ret':0x1});}else{var _0x510325=_0x14b852['utcOffset'];var _0x3553a5=squel[_0x5571('0x1b')]()['into'](_0x306344)[_0x5571('0x54')]('id',_0x6eb9cc['id'])[_0x5571('0x54')](_0x5571('0x55'),_0x510325)[_0x5571('0x54')](_0x5571('0x53'),_0x6eb9cc[_0x5571('0x53')])['toString']();return db[_0x5571('0x43')][_0x5571('0x56')](_0x3553a5)[_0x5571('0x44')](function(_0x33f078){_0x4e4c5b({'ret':0x1});})[_0x5571('0x4c')](function(_0x26aa56){logger[_0x5571('0x40')](_0x26aa56[_0x5571('0x41')]);_0x376468({'ret':0x1});});}});}function handleTZQuery(_0x427116){logger[_0x5571('0x3e')](_0x427116);return db[_0x5571('0x43')][_0x5571('0x56')](_0x427116)[_0x5571('0x44')](function(_0x19fa86){})['catch'](function(_0x204f65){logger[_0x5571('0x40')](_0x204f65[_0x5571('0x41')]);});}function main(_0x2f6800,_0x3a6e36,_0x490855,_0x2dce6f){logger[_0x5571('0x3e')](_0x5571('0x57'),_0x2f6800,JSON[_0x5571('0x58')](_0x3a6e36));process[_0x5571('0x59')](_0x5571('0x5a'));var _0x43fd8d=_0x3a6e36['binding'];var _0x43bb5b=_0x3a6e36[_0x5571('0x5b')];var _0x3e3099=path[_0x5571('0x16')](config[_0x5571('0x5c')],_0x5571('0x5d'),_0x43bb5b+_0x5571('0x5e'));hasTZ=_['keys'](_0x43fd8d)[_0x5571('0x5f')](_0x5571('0x53'));var _0x137fb1=_[_0x5571('0x39')](_0x43fd8d)[_0x5571('0x16')]();logger['info'](_0x5571('0x60'),_0x137fb1);if(hasTZ)_0x137fb1+=_0x5571('0x61');fs['writeFileSync'](_0x3e3099,_0x137fb1+'\x0a');Papa[_0x5571('0x62')](fs[_0x5571('0x63')](_0x2f6800),{'header':!![],'skipEmptyLines':!![],'step':function(_0xb65b65,_0xd3c8b3){try{for(var _0x512107=0x0,_0x1aa342=[];_0x512107<_0xb65b65[_0x5571('0x64')]['length'];_0x512107++){stats[_0x5571('0x65')]+=0x1;if(_0xb65b65[_0x5571('0x66')][_0x512107]){handleError(_0xb65b65[_0x5571('0x64')][_0x512107],_0xb65b65[_0x5571('0x66')][_0x512107]);}else{var _0x122b5a=[];for(var _0x1d38da in _0x43fd8d){if(_0x43fd8d[_0x5571('0x67')](_0x1d38da)){if(_0xb65b65[_0x5571('0x64')][_0x512107][_0x43fd8d[_0x1d38da]]){var _0x49450c=_[_0x5571('0x68')](_0xb65b65[_0x5571('0x64')][_0x512107][_0x43fd8d[_0x1d38da]][_0x5571('0x69')](/"/g,'\x27'));switch(_0x1d38da){case _0x5571('0x1f'):var _0x4c79e8=moment(_0x49450c,_0x5571('0x6a'),!![]);if(_0x4c79e8['isValid']()){_0x1aa342['push']('\x22'+_0x49450c+'\x22');}else{_0x122b5a[_0x5571('0x42')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x3d6582=parseInt(_0x49450c);_0x49450c=_[_0x5571('0x6b')](_0x3d6582)||_0x3d6582<0x0||_0x3d6582>0x4?_0x2dce6f?0x3:0x2:_0x3d6582;_0x1aa342[_0x5571('0x42')]('\x22'+_0x49450c+'\x22');break;case'UserId':var _0x3d6ac2=parseInt(_0x49450c);if(_[_0x5571('0x6c')](_0x3d6ac2)&&_[_0x5571('0x5f')](_0x490855,_0x3d6ac2)){_0x1aa342['push']('\x22'+_0x3d6ac2+'\x22');}else{_0x122b5a[_0x5571('0x42')](_0x5571('0x6d'));}break;case _0x5571('0x6e'):if(isEmail(_0x49450c)){_0x1aa342[_0x5571('0x42')]('\x22'+_0x49450c+'\x22');}else{_0x122b5a[_0x5571('0x42')](_0x5571('0x6f'));}break;case _0x5571('0x70'):var _0x4288a7=moment(_0x49450c,_0x5571('0x71'),!![]);if(_0x4288a7['isValid']()){_0x1aa342[_0x5571('0x42')]('\x22'+_0x49450c+'\x22');}else{_0x122b5a['push'](_0x5571('0x72'));}break;case _0x5571('0x53'):var _0x4014ec=shared[_0x5571('0x52')];var _0x4b83a=_0x4014ec[_0x49450c];if(!_[_0x5571('0x73')](_0x4b83a)){var _0x1f4f6f=_0x4b83a['utcOffset'];_0x1aa342[_0x5571('0x42')]('\x22'+_0x49450c+'\x22');_0x1aa342[_0x5571('0x42')]('\x22'+_0x1f4f6f+'\x22');}break;default:_0x1aa342[_0x5571('0x42')]('\x22'+_0x49450c+'\x22');}}else{switch(_0x1d38da){case _0x5571('0x74'):case _0x5571('0x11'):_0x122b5a[_0x5571('0x42')](_0x1d38da+_0x5571('0x75'));break;default:_0x1aa342['push']('\x22\x22');}}}}if(_0x122b5a['length']){handleError(_0xb65b65[_0x5571('0x64')][_0x512107],{'code':_0x5571('0x76'),'message':_0x122b5a['join']()});}else{fs[_0x5571('0x77')](_0x3e3099,_0x1aa342[_0x5571('0x16')]()+'\x0a');}_0x1aa342=[];}if(!(stats[_0x5571('0x65')]%0xc8)){socket[_0x5571('0x78')]('contact:import:'+_0x43bb5b,stats);stats['errors']=[];}}if(stopped){logger[_0x5571('0x3e')]('Abort\x20parser');_0xd3c8b3[_0x5571('0x79')]();}}catch(_0x49d1d6){handleError(_0xb65b65[_0x5571('0x64')][_0x512107],{'code':_0x5571('0x7a'),'message':_0x49d1d6[_0x5571('0x41')]});logger[_0x5571('0x40')](_0x5571('0x7b'),_0x49d1d6[_0x5571('0x41')]);}},'complete':function(){try{var _0x4886b8=[];var _0x52072a=[];var _0xbfef5b=_0x5571('0x24');if(_0x3a6e36['duplicates']&&_0x3a6e36['duplicates'][_0x5571('0x49')]){_0xbfef5b=_0x5571('0x7c')+_0x43bb5b;_0x4886b8[_0x5571('0x42')](_0x5571('0x7d')+_0xbfef5b+_0x5571('0x7e'));}tmp_campaigns=_0x5571('0x7f')+_0x43bb5b;tmp_voice_queues=_0x5571('0x80')+_0x43bb5b;_0x52072a[_0x5571('0x42')]('CREATE\x20TABLE\x20'+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x52072a[_0x5571('0x42')](_0x5571('0x7d')+tmp_voice_queues+_0x5571('0x81'));BPromise[_0x5571('0x82')](_0x52072a,handleTZQuery)['then'](function(_0x3db9c6){updateTzCampaigns(_0x3a6e36['ListId'])[_0x5571('0x4b')](function(_0x403386){updateTzVoiceQueues(_0x3a6e36[_0x5571('0x21')])['then'](function(_0x27d9e5){var _0x187152=util[_0x5571('0xe')](_0x5571('0x83'),_0x3e3099,_0xbfef5b,_0x137fb1,_0x3a6e36['ListId'],_0x3a6e36[_0x5571('0x84')]||null,NOW,NOW);if(_[_0x5571('0x73')](_0x43fd8d[_0x5571('0x1f')])){_0x187152+=',\x20scheduledAt\x20=\x20NOW()';}_0x4886b8[_0x5571('0x42')](_0x187152);if(_0x3a6e36[_0x5571('0x85')]&&_0x3a6e36[_0x5571('0x85')][_0x5571('0x49')]){_0x4886b8[_0x5571('0x42')](insertCmContact(_0x3a6e36[_0x5571('0x21')],_0xbfef5b,_0x3a6e36[_0x5571('0x85')],_0x43fd8d));_0x4886b8['push'](_0x5571('0x86')+_0xbfef5b+';');}if(hasTZ){_0x4886b8[_0x5571('0x42')](insertTzCmHopper(_0x3a6e36[_0x5571('0x21')],'voice_queues_has_cm_lists','voice_queues',_0x5571('0x87'),_0x2dce6f,tmp_voice_queues));_0x4886b8[_0x5571('0x42')](insertTzCmHopperBlack(_0x3a6e36[_0x5571('0x21')],_0x5571('0x88'),_0x5571('0x4f'),_0x5571('0x87')));_0x4886b8[_0x5571('0x42')](insertTzCmHopper(_0x3a6e36[_0x5571('0x21')],'campaigns_has_cm_lists','campaigns',_0x5571('0x89'),_0x2dce6f,tmp_campaigns));_0x4886b8[_0x5571('0x42')](insertTzCmHopperBlack(_0x3a6e36[_0x5571('0x21')],_0x5571('0x8a'),'campaigns',_0x5571('0x89')));}else{_0x4886b8[_0x5571('0x42')](insertCmHopper(_0x3a6e36[_0x5571('0x21')],'voice_queues_has_cm_lists',_0x5571('0x4f'),'VoiceQueueId',_0x2dce6f));_0x4886b8[_0x5571('0x42')](insertCmHopperBlack(_0x3a6e36[_0x5571('0x21')],'voice_queues_has_cm_blacklists','voice_queues',_0x5571('0x87')));_0x4886b8['push'](insertCmHopper(_0x3a6e36[_0x5571('0x21')],_0x5571('0x47'),_0x5571('0x8b'),_0x5571('0x89'),_0x2dce6f));_0x4886b8[_0x5571('0x42')](insertCmHopperBlack(_0x3a6e36[_0x5571('0x21')],'campaigns_has_cm_blacklists',_0x5571('0x8b'),'CampaignId'));}_0x4886b8[_0x5571('0x42')](_0x5571('0x86')+tmp_campaigns+';');_0x4886b8[_0x5571('0x42')](_0x5571('0x86')+tmp_voice_queues+';');BPromise[_0x5571('0x82')](_0x4886b8,handleQuery)[_0x5571('0x4b')](function(_0x1dec56){stats[_0x5571('0x8c')]=!![];stats[_0x5571('0x8d')]=_0x3a6e36['duplicates']&&_0x3a6e36[_0x5571('0x85')]['length']?results[0x2]['affectedRows']:results[0x0][_0x5571('0x8d')];socket[_0x5571('0x78')]('contact:import:'+_0x43bb5b,stats);fs[_0x5571('0x8e')](_0x2f6800);fs[_0x5571('0x8e')](_0x3e3099);process[_0x5571('0x8f')](0x0);})[_0x5571('0x4c')](function(_0x5f28da){logger[_0x5571('0x40')](_0x5f28da[_0x5571('0x41')]);process[_0x5571('0x8f')](0x1);});});});});}catch(_0x119766){logger[_0x5571('0x40')](_0x5571('0x90'),_0x119766[_0x5571('0x41')]);process[_0x5571('0x8f')](0x1);}},'error':function(_0x22e4c6,_0x5ae48b,_0xfc4f9,_0xe7e990){throw new Error(_0xe7e990);}});}function validate(){if(process['argv']&&process[_0x5571('0x91')][_0x5571('0x49')]<0x4){throw new Error(_0x5571('0x92'));}var _0x2b0072=path[_0x5571('0x16')](config[_0x5571('0x5c')],_0x5571('0x5d'),process[_0x5571('0x91')][0x2]);if(!fs['existsSync'](_0x2b0072)){throw new Error(_0x5571('0x93'));}var _0x24b69c={};try{_0x24b69c=JSON['parse'](process['argv'][0x3]);if(!_0x24b69c[_0x5571('0x94')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x24b69c['binding'][_0x5571('0x11')]){throw new Error(_0x5571('0x95'));}if(!_0x24b69c['binding'][_0x5571('0x74')]){throw new Error(_0x5571('0x96'));}var _0x24b745=0x0;if(_0x24b69c[_0x5571('0x94')][_0x5571('0x35')]){_0x24b745=0x1;}if(!_0x24b69c[_0x5571('0x21')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x4bf825){throw new Error(_0x5571('0x97'));}var _0x12baaa=[];try{_0x12baaa=_[_0x5571('0x98')](JSON[_0x5571('0x62')](process[_0x5571('0x91')][0x4]),'id');}catch(_0xa53fe2){logger[_0x5571('0x3e')]('No\x20agent\x20available');}main(_0x2b0072,_0x24b69c,_0x12baaa,_0x24b745);}validate();process['on'](_0x5571('0x99'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0xc24d=['offset','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','includes','header',',utcOffset','writeFileSync','rows','data','hasOwnProperty','trim','isValid','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','isNil','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','DROP\x20TABLE\x20','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_blacklists','CampaignId','affectedRows','unlink','complete','argv','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','parse','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','defaults','redis','localhost','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','join','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ListId','createdAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.id\x20=\x20','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_hopper_black','ContactId','updatedAt','from','ListId\x20=\x20?','\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','.CmListId','.CmListId\x20=\x20?','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','error','exit','errors','push','code','message','sequelize','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','length','all','then','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','dialTimezone','utcOffset','set'];(function(_0x509c83,_0x511882){var _0x534626=function(_0x9d21cf){while(--_0x9d21cf){_0x509c83['push'](_0x509c83['shift']());}};_0x534626(++_0x511882);}(_0xc24d,0xd9));var _0xdc24=function(_0x3e91a9,_0x53c466){_0x3e91a9=_0x3e91a9-0x0;var _0x25c9ad=_0xc24d[_0x3e91a9];return _0x25c9ad;};'use strict';var fs=require('fs');var path=require(_0xdc24('0x0'));var _=require(_0xdc24('0x1'));var Papa=require(_0xdc24('0x2'));var util=require(_0xdc24('0x3'));var BPromise=require(_0xdc24('0x4'));var moment=require(_0xdc24('0x5'));var squel=require(_0xdc24('0x6'));var Redis=require(_0xdc24('0x7'));var db=require('../../../mysqldb')['db'];var config=require(_0xdc24('0x8'));var shared=require(_0xdc24('0x9'));var logger=require(_0xdc24('0xa'))(_0xdc24('0xb'));config['redis']=_[_0xdc24('0xc')](config[_0xdc24('0xd')],{'host':_0xdc24('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdc24('0xd')]));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()[_0xdc24('0xf')](_0xdc24('0x10'));function isEmail(_0xd43f47){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'](_0xd43f47);}function selectNotIn(_0x44572e,_0xe2eb0e,_0x366193,_0x491122,_0xb62226){return squel[_0xdc24('0x11')]()[_0xdc24('0x12')](_0xdc24('0x13'))['from'](_0x491122)[_0xdc24('0x14')](_0xe2eb0e,null,_0xe2eb0e+'.id\x20=\x20'+_0x491122+'.'+_0x366193)[_0xdc24('0x15')](_0x491122+'.'+_0x366193+_0xdc24('0x16')+_0x44572e+'.'+_0x366193)['where'](_0xe2eb0e+_0xdc24('0x17')+_0xb62226[_0xdc24('0x14')]()+')');}function insertCmHopper(_0x3615e4,_0x5b2261,_0x188fc5,_0x10cb15,_0x43ed38){var _0x24f0a5=[_0xdc24('0x18'),_0xdc24('0x19'),'cm_contacts.id','cm_contacts.ListId',_0x5b2261+'.'+_0x10cb15,'cm_contacts.createdAt',_0xdc24('0x1a'),_0xdc24('0x1b'),_0xdc24('0x1c'),'\x22'+_0x43ed38+'\x22'];return squel[_0xdc24('0x1d')]()[_0xdc24('0x1e')](_0xdc24('0x1f'))[_0xdc24('0x20')]([_0xdc24('0x13'),_0xdc24('0x21'),'ContactId',_0xdc24('0x22'),_0x10cb15,_0xdc24('0x23'),'updatedAt',_0xdc24('0x24'),_0xdc24('0x25'),_0xdc24('0x26')],squel[_0xdc24('0x11')]()[_0xdc24('0x27')](_0x24f0a5)['from'](_0x5b2261)[_0xdc24('0x14')](_0xdc24('0x28'),null,_0xdc24('0x29')+_0x5b2261+'.CmListId')['join'](_0x188fc5,null,_0x188fc5+_0xdc24('0x2a')+_0x5b2261+'.'+_0x10cb15)[_0xdc24('0x15')](_0x5b2261+'.CmListId\x20=\x20?',_0x3615e4)[_0xdc24('0x15')](_0xdc24('0x2b'),NOW)[_0xdc24('0x15')](_0xdc24('0x2c'),selectNotIn(_0x5b2261,_0x188fc5,_0x10cb15,_0xdc24('0x1f'),[_0xdc24('0x2d'),_0xdc24('0x2e')]))[_0xdc24('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5b2261,_0x188fc5,_0x10cb15,_0xdc24('0x1f'),[_0xdc24('0x2d')])))[_0xdc24('0x2f')]();}function insertCmHopperBlack(_0x9292b7,_0x4bc2e6,_0x45cd39,_0xe08d5){var _0x150cd3=[_0xdc24('0x18'),_0xdc24('0x30'),_0xdc24('0x31'),_0x4bc2e6+'.'+_0xe08d5,_0xdc24('0x32'),_0xdc24('0x1a')];return squel[_0xdc24('0x1d')]()[_0xdc24('0x1e')](_0xdc24('0x33'))[_0xdc24('0x20')]([_0xdc24('0x13'),_0xdc24('0x34'),_0xdc24('0x22'),_0xe08d5,_0xdc24('0x23'),_0xdc24('0x35')],squel[_0xdc24('0x11')]()[_0xdc24('0x27')](_0x150cd3)[_0xdc24('0x36')](_0x4bc2e6)[_0xdc24('0x14')](_0xdc24('0x28'),null,_0xdc24('0x29')+_0x4bc2e6+'.CmListId')[_0xdc24('0x14')](_0x45cd39,null,_0x45cd39+_0xdc24('0x2a')+_0x4bc2e6+'.'+_0xe08d5)[_0xdc24('0x15')](_0x4bc2e6+'.CmListId\x20=\x20?',_0x9292b7)[_0xdc24('0x15')](_0xdc24('0x2b'),NOW)[_0xdc24('0x15')](_0xdc24('0x2c'),squel['select']()[_0xdc24('0x12')](_0xdc24('0x13'))[_0xdc24('0x36')](_0xdc24('0x33'))[_0xdc24('0x15')](_0xdc24('0x37'),_0x9292b7)[_0xdc24('0x15')](_0xe08d5+_0xdc24('0x38'),_0x4bc2e6+'.'+_0xe08d5)))[_0xdc24('0x2f')]();}function insertTzCmHopper(_0x18806d,_0x1bac99,_0x310cd8,_0x16ddce,_0x35da2e,_0xbe64fd){var _0x5a6db7=[_0xdc24('0x18'),_0xdc24('0x39')+_0xbe64fd+_0xdc24('0x3a'),_0xdc24('0x30'),'cm_contacts.ListId',_0x1bac99+'.'+_0x16ddce,_0xdc24('0x32'),_0xdc24('0x1a'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x35da2e+'\x22'];var _0x649e85=squel[_0xdc24('0x1d')]()[_0xdc24('0x1e')](_0xdc24('0x1f'))[_0xdc24('0x20')]([_0xdc24('0x13'),'scheduledat',_0xdc24('0x34'),'ListId',_0x16ddce,'createdAt',_0xdc24('0x35'),_0xdc24('0x24'),'UserId',_0xdc24('0x26')],squel['select']()['fields'](_0x5a6db7)[_0xdc24('0x36')](_0x1bac99)[_0xdc24('0x14')](_0xdc24('0x28'),null,_0xdc24('0x29')+_0x1bac99+_0xdc24('0x3b'))[_0xdc24('0x14')](_0x310cd8,null,_0x310cd8+_0xdc24('0x2a')+_0x1bac99+'.'+_0x16ddce)[_0xdc24('0x14')](_0xbe64fd,null,_0xbe64fd+_0xdc24('0x2a')+_0x1bac99+'.'+_0x16ddce)['where'](_0x1bac99+_0xdc24('0x3c'),_0x18806d)[_0xdc24('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xdc24('0x15')](_0xdc24('0x2c'),selectNotIn(_0x1bac99,_0x310cd8,_0x16ddce,_0xdc24('0x1f'),[_0xdc24('0x2d'),_0xdc24('0x2e')]))[_0xdc24('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1bac99,_0x310cd8,_0x16ddce,_0xdc24('0x1f'),[_0xdc24('0x2d')])))['toString']();return _0x649e85;}function insertTzCmHopperBlack(_0x50a118,_0x49fcc3,_0xa79604,_0x2a803c){var _0x260baf=[_0xdc24('0x18'),_0xdc24('0x30'),_0xdc24('0x31'),_0x49fcc3+'.'+_0x2a803c,_0xdc24('0x32'),_0xdc24('0x1a')];return squel['insert']()[_0xdc24('0x1e')](_0xdc24('0x33'))[_0xdc24('0x20')]([_0xdc24('0x13'),_0xdc24('0x34'),_0xdc24('0x22'),_0x2a803c,_0xdc24('0x23'),_0xdc24('0x35')],squel[_0xdc24('0x11')]()['fields'](_0x260baf)[_0xdc24('0x36')](_0x49fcc3)[_0xdc24('0x14')](_0xdc24('0x28'),null,_0xdc24('0x29')+_0x49fcc3+_0xdc24('0x3b'))[_0xdc24('0x14')](_0xa79604,null,_0xa79604+_0xdc24('0x2a')+_0x49fcc3+'.'+_0x2a803c)[_0xdc24('0x15')](_0x49fcc3+_0xdc24('0x3c'),_0x50a118)[_0xdc24('0x15')](_0xdc24('0x2b'),NOW)[_0xdc24('0x15')](_0xdc24('0x2c'),squel[_0xdc24('0x11')]()[_0xdc24('0x12')]('phone')['from'](_0xdc24('0x33'))[_0xdc24('0x15')]('ListId\x20=\x20?',_0x50a118)[_0xdc24('0x15')](_0x2a803c+_0xdc24('0x38'),_0x49fcc3+'.'+_0x2a803c)))[_0xdc24('0x2f')]();}function insertCmContact(_0x1d13f5,_0x37867a,_0x58931c,_0x4072d3){var _0x25feb9=_['concat'](_[_0xdc24('0x3d')](_0x4072d3),[_0xdc24('0x22'),_0xdc24('0x3e'),'createdAt',_0xdc24('0x35')]);return squel[_0xdc24('0x1d')]()[_0xdc24('0x1e')](_0xdc24('0x28'))[_0xdc24('0x20')](_0x25feb9,squel['select']()[_0xdc24('0x27')](_0x25feb9)[_0xdc24('0x36')](_0x37867a)[_0xdc24('0x15')]('('+_0x58931c[_0xdc24('0x14')](',')+_0xdc24('0x3f'),squel[_0xdc24('0x11')]()[_0xdc24('0x27')](_0x58931c)[_0xdc24('0x36')](_0xdc24('0x28'))[_0xdc24('0x15')](_0xdc24('0x37'),_0x1d13f5)['where']('deletedAt\x20IS\x20NULL'))[_0xdc24('0x15')](_0xdc24('0x40'),squel[_0xdc24('0x11')]()[_0xdc24('0x12')]('MIN(id)',_0xdc24('0x41'))[_0xdc24('0x36')](_0x37867a)[_0xdc24('0x42')](_0x58931c[_0xdc24('0x14')](','))))[_0xdc24('0x2f')]();}function handleStop(){logger[_0xdc24('0x43')](_0xdc24('0x44'));stopped=!![];}function handleUncaughtException(_0x3d0c90){logger[_0xdc24('0x45')](_0x3d0c90['message']);process[_0xdc24('0x46')](0x1);}function handleError(_0x31c325,_0x315180){stats[_0xdc24('0x47')][_0xdc24('0x48')]({'name':_0x315180[_0xdc24('0x49')],'message':_0x315180[_0xdc24('0x4a')],'row':_0x31c325});}function handleQuery(_0xf82987){logger[_0xdc24('0x43')](_0xf82987);return db[_0xdc24('0x4b')][_0xdc24('0x4c')](_0xf82987)[_0xdc24('0x4d')](function(_0xca53f4){results['push'](_0xca53f4);})[_0xdc24('0x4e')](function(_0x50fd40){logger[_0xdc24('0x45')](_0x50fd40[_0xdc24('0x4a')]);});}function updateTzCampaigns(_0xf2c731){return new Promise(function(_0x9613c9,_0x42f04d){var _0x4689de=squel[_0xdc24('0x11')]()['fields']([_0xdc24('0x4f'),_0xdc24('0x50')])['from'](_0xdc24('0x51'))['join'](_0xdc24('0x52'),null,_0xdc24('0x53'))[_0xdc24('0x15')]('campaigns_has_cm_lists.CmListId='+_0xf2c731);db['sequelize'][_0xdc24('0x4c')](_0x4689de[_0xdc24('0x2f')]())[_0xdc24('0x4d')](function(_0x57e4bc){var _0xba0636=[];for(var _0x555cc8=0x0;_0x555cc8<_0x57e4bc[_0xdc24('0x54')];_0x555cc8++){_0xba0636[_0xdc24('0x48')](getTimezoneData(_0x57e4bc[_0x555cc8],tmp_campaigns));}BPromise[_0xdc24('0x55')](_0xba0636)[_0xdc24('0x56')](function(){_0x9613c9({'val':0x1});});})[_0xdc24('0x4e')](function(_0x3a0946){logger[_0xdc24('0x45')](_0x3a0946[_0xdc24('0x4a')]);_0x9613c9({'val':0x0});});});}function updateTzVoiceQueues(_0x3ff572){return new Promise(function(_0x538717,_0x2c798b){var _0x55c0cb=squel[_0xdc24('0x11')]()[_0xdc24('0x27')]([_0xdc24('0x57'),_0xdc24('0x58')])[_0xdc24('0x36')](_0xdc24('0x59'))['join'](_0xdc24('0x5a'),null,_0xdc24('0x5b'))['where']('voice_queues_has_cm_lists.CmListId='+_0x3ff572);db[_0xdc24('0x4b')][_0xdc24('0x4c')](_0x55c0cb[_0xdc24('0x2f')]())['spread'](function(_0x1d698e){var _0xeba97e=[];for(var _0x5439cd=0x0;_0x5439cd<_0x1d698e[_0xdc24('0x54')];_0x5439cd++){_0xeba97e[_0xdc24('0x48')](getTimezoneData(_0x1d698e[_0x5439cd],tmp_voice_queues));}BPromise['all'](_0xeba97e)[_0xdc24('0x56')](function(){_0x538717({'val':0x1});});})['catch'](function(_0x517f67){logger[_0xdc24('0x45')](_0x517f67['message']);_0x538717({'val':0x0});});});}function getTimezoneData(_0x114e99,_0x34c5c1){return new Promise(function(_0x36ab7e,_0xc8ec12){var _0x215a2a=shared['timezones'];var _0x28877f=_0x215a2a[_0x114e99[_0xdc24('0x5c')]];if(_['isNil'](_0x28877f)){_0x36ab7e({'ret':0x1});}else{var _0x1e9a83=_0x28877f[_0xdc24('0x5d')];var _0x4f51ac=squel[_0xdc24('0x1d')]()[_0xdc24('0x1e')](_0x34c5c1)['set']('id',_0x114e99['id'])[_0xdc24('0x5e')](_0xdc24('0x5f'),_0x1e9a83)[_0xdc24('0x5e')](_0xdc24('0x5c'),_0x114e99[_0xdc24('0x5c')])[_0xdc24('0x2f')]();return db[_0xdc24('0x4b')]['query'](_0x4f51ac)['spread'](function(_0x356aed){_0x36ab7e({'ret':0x1});})[_0xdc24('0x4e')](function(_0x5ea62d){logger[_0xdc24('0x45')](_0x5ea62d[_0xdc24('0x4a')]);_0xc8ec12({'ret':0x1});});}});}function handleTZQuery(_0xf6384f){logger['info'](_0xf6384f);return db[_0xdc24('0x4b')]['query'](_0xf6384f)[_0xdc24('0x4d')](function(_0x3111a4){})['catch'](function(_0x29522d){logger[_0xdc24('0x45')](_0x29522d['message']);});}function main(_0x32ec5b,_0x4ac9c7,_0x137668,_0x54b51e){logger['info']('main',_0x32ec5b,JSON[_0xdc24('0x60')](_0x4ac9c7));process[_0xdc24('0x61')](_0xdc24('0x62'));var _0x2df2b9=_0x4ac9c7[_0xdc24('0x63')];var _0x4ca80e=_0x4ac9c7[_0xdc24('0x64')];var _0x41c3f0=path[_0xdc24('0x14')](config[_0xdc24('0x65')],_0xdc24('0x66'),_0x4ca80e+_0xdc24('0x67'));hasTZ=_[_0xdc24('0x3d')](_0x2df2b9)[_0xdc24('0x68')]('dialTimezone');var _0x3f6e75=_[_0xdc24('0x3d')](_0x2df2b9)[_0xdc24('0x14')]();logger[_0xdc24('0x43')](_0xdc24('0x69'),_0x3f6e75);if(hasTZ)_0x3f6e75+=_0xdc24('0x6a');fs[_0xdc24('0x6b')](_0x41c3f0,_0x3f6e75+'\x0a');Papa['parse'](fs['createReadStream'](_0x32ec5b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x586d33,_0xfb27e1){try{for(var _0x2e074b=0x0,_0x16b6c7=[];_0x2e074b<_0x586d33['data']['length'];_0x2e074b++){stats[_0xdc24('0x6c')]+=0x1;if(_0x586d33['errors'][_0x2e074b]){handleError(_0x586d33[_0xdc24('0x6d')][_0x2e074b],_0x586d33['errors'][_0x2e074b]);}else{var _0x5af4df=[];for(var _0x1bb03a in _0x2df2b9){if(_0x2df2b9[_0xdc24('0x6e')](_0x1bb03a)){if(_0x586d33[_0xdc24('0x6d')][_0x2e074b][_0x2df2b9[_0x1bb03a]]){var _0x3f6f07=_[_0xdc24('0x6f')](_0x586d33[_0xdc24('0x6d')][_0x2e074b][_0x2df2b9[_0x1bb03a]]['replace'](/"/g,'\x27'));switch(_0x1bb03a){case _0xdc24('0x21'):var _0xf79c73=moment(_0x3f6f07,_0xdc24('0x10'),!![]);if(_0xf79c73[_0xdc24('0x70')]()){_0x16b6c7['push']('\x22'+_0x3f6f07+'\x22');}else{_0x5af4df['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xdc24('0x24'):var _0x5aadfb=parseInt(_0x3f6f07);_0x3f6f07=_[_0xdc24('0x71')](_0x5aadfb)||_0x5aadfb<0x0||_0x5aadfb>0x4?_0x54b51e?0x3:0x2:_0x5aadfb;_0x16b6c7['push']('\x22'+_0x3f6f07+'\x22');break;case'UserId':var _0x4d0694=parseInt(_0x3f6f07);if(_[_0xdc24('0x72')](_0x4d0694)&&_['includes'](_0x137668,_0x4d0694)){_0x16b6c7[_0xdc24('0x48')]('\x22'+_0x4d0694+'\x22');}else{_0x5af4df[_0xdc24('0x48')](_0xdc24('0x73'));}break;case _0xdc24('0x74'):if(isEmail(_0x3f6f07)){_0x16b6c7[_0xdc24('0x48')]('\x22'+_0x3f6f07+'\x22');}else{_0x5af4df[_0xdc24('0x48')](_0xdc24('0x75'));}break;case _0xdc24('0x76'):var _0x8596fa=moment(_0x3f6f07,_0xdc24('0x77'),!![]);if(_0x8596fa[_0xdc24('0x70')]()){_0x16b6c7[_0xdc24('0x48')]('\x22'+_0x3f6f07+'\x22');}else{_0x5af4df[_0xdc24('0x48')](_0xdc24('0x78'));}break;case'dialTimezone':var _0x4c4f92=shared['timezones'];var _0x3bb832=_0x4c4f92[_0x3f6f07];if(!_[_0xdc24('0x79')](_0x3bb832)){var _0x30db3d=_0x3bb832['utcOffset'];_0x16b6c7[_0xdc24('0x48')]('\x22'+_0x3f6f07+'\x22');_0x16b6c7['push']('\x22'+_0x30db3d+'\x22');}break;default:_0x16b6c7[_0xdc24('0x48')]('\x22'+_0x3f6f07+'\x22');}}else{switch(_0x1bb03a){case _0xdc24('0x7a'):case _0xdc24('0x13'):_0x5af4df[_0xdc24('0x48')](_0x1bb03a+_0xdc24('0x7b'));break;default:_0x16b6c7[_0xdc24('0x48')]('\x22\x22');}}}}if(_0x5af4df['length']){handleError(_0x586d33[_0xdc24('0x6d')][_0x2e074b],{'code':_0xdc24('0x7c'),'message':_0x5af4df['join']()});}else{fs[_0xdc24('0x7d')](_0x41c3f0,_0x16b6c7[_0xdc24('0x14')]()+'\x0a');}_0x16b6c7=[];}if(!(stats[_0xdc24('0x6c')]%0xc8)){socket[_0xdc24('0x7e')](_0xdc24('0x7f')+_0x4ca80e,stats);stats[_0xdc24('0x47')]=[];}}if(stopped){logger[_0xdc24('0x43')](_0xdc24('0x80'));_0xfb27e1['abort']();}}catch(_0x45a166){handleError(_0x586d33[_0xdc24('0x6d')][_0x2e074b],{'code':'SystemError','message':_0x45a166['message']});logger[_0xdc24('0x45')]('step',_0x45a166['message']);}},'complete':function(){try{var _0x3761e5=[];var _0x1fbdf6=[];var _0x4e5f97=_0xdc24('0x28');if(_0x4ac9c7['duplicates']&&_0x4ac9c7[_0xdc24('0x81')][_0xdc24('0x54')]){_0x4e5f97=_0xdc24('0x82')+_0x4ca80e;_0x3761e5[_0xdc24('0x48')](_0xdc24('0x83')+_0x4e5f97+_0xdc24('0x84'));}tmp_campaigns=_0xdc24('0x85')+_0x4ca80e;tmp_voice_queues=_0xdc24('0x86')+_0x4ca80e;_0x1fbdf6[_0xdc24('0x48')](_0xdc24('0x83')+tmp_campaigns+_0xdc24('0x87'));_0x1fbdf6['push'](_0xdc24('0x83')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0xdc24('0x88')](_0x1fbdf6,handleTZQuery)[_0xdc24('0x56')](function(_0x343237){updateTzCampaigns(_0x4ac9c7['ListId'])[_0xdc24('0x56')](function(_0x155ff1){updateTzVoiceQueues(_0x4ac9c7[_0xdc24('0x22')])[_0xdc24('0x56')](function(_0xa5bdee){var _0x4e53fb=util[_0xdc24('0xf')]('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',_0x41c3f0,_0x4e5f97,_0x3f6e75,_0x4ac9c7[_0xdc24('0x22')],_0x4ac9c7['CompanyId']||null,NOW,NOW);if(_[_0xdc24('0x79')](_0x2df2b9[_0xdc24('0x21')])){_0x4e53fb+=',\x20scheduledAt\x20=\x20NOW()';}_0x3761e5[_0xdc24('0x48')](_0x4e53fb);if(_0x4ac9c7[_0xdc24('0x81')]&&_0x4ac9c7[_0xdc24('0x81')]['length']){_0x3761e5[_0xdc24('0x48')](insertCmContact(_0x4ac9c7[_0xdc24('0x22')],_0x4e5f97,_0x4ac9c7['duplicates'],_0x2df2b9));_0x3761e5[_0xdc24('0x48')](_0xdc24('0x89')+_0x4e5f97+';');}if(hasTZ){_0x3761e5[_0xdc24('0x48')](insertTzCmHopper(_0x4ac9c7[_0xdc24('0x22')],_0xdc24('0x5a'),_0xdc24('0x59'),_0xdc24('0x8a'),_0x54b51e,tmp_voice_queues));_0x3761e5['push'](insertTzCmHopperBlack(_0x4ac9c7[_0xdc24('0x22')],_0xdc24('0x8b'),_0xdc24('0x59'),_0xdc24('0x8a')));_0x3761e5[_0xdc24('0x48')](insertTzCmHopper(_0x4ac9c7[_0xdc24('0x22')],_0xdc24('0x52'),_0xdc24('0x51'),'CampaignId',_0x54b51e,tmp_campaigns));_0x3761e5['push'](insertTzCmHopperBlack(_0x4ac9c7[_0xdc24('0x22')],_0xdc24('0x8c'),_0xdc24('0x51'),_0xdc24('0x8d')));}else{_0x3761e5[_0xdc24('0x48')](insertCmHopper(_0x4ac9c7[_0xdc24('0x22')],'voice_queues_has_cm_lists',_0xdc24('0x59'),_0xdc24('0x8a'),_0x54b51e));_0x3761e5[_0xdc24('0x48')](insertCmHopperBlack(_0x4ac9c7[_0xdc24('0x22')],_0xdc24('0x8b'),'voice_queues',_0xdc24('0x8a')));_0x3761e5[_0xdc24('0x48')](insertCmHopper(_0x4ac9c7[_0xdc24('0x22')],_0xdc24('0x52'),_0xdc24('0x51'),'CampaignId',_0x54b51e));_0x3761e5[_0xdc24('0x48')](insertCmHopperBlack(_0x4ac9c7[_0xdc24('0x22')],_0xdc24('0x8c'),_0xdc24('0x51'),_0xdc24('0x8d')));}_0x3761e5['push'](_0xdc24('0x89')+tmp_campaigns+';');_0x3761e5[_0xdc24('0x48')]('DROP\x20TABLE\x20'+tmp_voice_queues+';');BPromise['each'](_0x3761e5,handleQuery)[_0xdc24('0x56')](function(_0x349f0e){stats['finish']=!![];stats[_0xdc24('0x8e')]=_0x4ac9c7[_0xdc24('0x81')]&&_0x4ac9c7[_0xdc24('0x81')]['length']?results[0x2][_0xdc24('0x8e')]:results[0x0]['affectedRows'];socket[_0xdc24('0x7e')]('contact:import:'+_0x4ca80e,stats);fs['unlink'](_0x32ec5b);fs[_0xdc24('0x8f')](_0x41c3f0);process[_0xdc24('0x46')](0x0);})[_0xdc24('0x4e')](function(_0x2d6ddd){logger['error'](_0x2d6ddd[_0xdc24('0x4a')]);process[_0xdc24('0x46')](0x1);});});});});}catch(_0x2c5f4e){logger[_0xdc24('0x45')](_0xdc24('0x90'),_0x2c5f4e[_0xdc24('0x4a')]);process[_0xdc24('0x46')](0x1);}},'error':function(_0x56a0fe,_0xebdbe9,_0x1eaba5,_0x20b64b){throw new Error(_0x20b64b);}});}function validate(){if(process[_0xdc24('0x91')]&&process[_0xdc24('0x91')]['length']<0x4){throw new Error('arguments\x20\x20\x20');}var _0x120355=path[_0xdc24('0x14')](config[_0xdc24('0x65')],'server/files/tmp',process[_0xdc24('0x91')][0x2]);if(!fs['existsSync'](_0x120355)){throw new Error(_0xdc24('0x92'));}var _0x27df59={};try{_0x27df59=JSON['parse'](process[_0xdc24('0x91')][0x3]);if(!_0x27df59[_0xdc24('0x63')]){throw new Error(_0xdc24('0x93'));}if(!_0x27df59['binding'][_0xdc24('0x13')]){throw new Error(_0xdc24('0x94'));}if(!_0x27df59[_0xdc24('0x63')]['firstName']){throw new Error(_0xdc24('0x95'));}var _0x113e8b=0x0;if(_0x27df59['binding'][_0xdc24('0x25')]){_0x113e8b=0x1;}if(!_0x27df59[_0xdc24('0x22')]){throw new Error(_0xdc24('0x96'));}}catch(_0x1694ec){throw new Error(_0xdc24('0x97'));}var _0x2838c0=[];try{_0x2838c0=_['map'](JSON[_0xdc24('0x98')](process[_0xdc24('0x91')][0x4]),'id');}catch(_0x4f6c98){logger[_0xdc24('0x43')](_0xdc24('0x99'));}main(_0x120355,_0x27df59,_0x2838c0,_0x113e8b);}validate();process['on'](_0xdc24('0x9a'),handleStop);process['on'](_0xdc24('0x9b'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 822a1c9..b2f7241 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 _0x0d9b=['queue','push','variable','calleridnum','outbound','Outbound\x20Call','getDescriptions','inbound','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','UniqueId','Date','agentcalledAt','***\x20Agent\x20Info\x20***','destcalleridname','Agent\x20Number','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Complete','agentcompleteAt','Hold\x20Time','Talk\x20Time','talktime','Called\x20Number','uniqueid','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice'];(function(_0x41521f,_0x3809ba){var _0x4c91a3=function(_0x25386e){while(--_0x25386e){_0x41521f['push'](_0x41521f['shift']());}};_0x4c91a3(++_0x3809ba);}(_0x0d9b,0xa3));var _0xb0d9=function(_0x43c47a,_0x4e549c){_0x43c47a=_0x43c47a-0x0;var _0x23f2c2=_0x0d9b[_0x43c47a];return _0x23f2c2;};'use strict';exports[_0xb0d9('0x0')]=function(_0x2cb962,_0x175833){var _0x1bb268=[{'type':_0xb0d9('0x1'),'content':_0xb0d9('0x2'),'variableName':null}];switch(_0x2cb962[_0xb0d9('0x3')]()){case _0xb0d9('0x4'):switch(_0x175833[_0xb0d9('0x3')]()){case'inbound':_0x1bb268['push']({'type':'variable','content':'','variableName':_0xb0d9('0x5')});_0x1bb268[_0xb0d9('0x6')]({'type':_0xb0d9('0x7'),'content':'','variableName':_0xb0d9('0x8')});break;case _0xb0d9('0x9'):_0x1bb268[_0xb0d9('0x6')]({'type':'string','content':_0xb0d9('0xa'),'variableName':null});_0x1bb268[_0xb0d9('0x6')]({'type':_0xb0d9('0x7'),'content':'','variableName':'destcalleridnum'});break;}}return _0x1bb268;};exports[_0xb0d9('0xb')]=function(_0x2a25b0,_0x5cba7b){var _0x4b99a5=[];switch(_0x2a25b0[_0xb0d9('0x3')]()){case'voice':switch(_0x5cba7b[_0xb0d9('0x3')]()){case _0xb0d9('0xc'):_0x4b99a5=[{'type':_0xb0d9('0x1'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xb0d9('0xd'),'content':'','key':_0xb0d9('0xe'),'keyType':_0xb0d9('0x7'),'variableName':_0xb0d9('0x8')},{'type':_0xb0d9('0xd'),'content':'','key':_0xb0d9('0xf'),'keyType':_0xb0d9('0x7'),'variableName':_0xb0d9('0x10')},{'type':_0xb0d9('0xd'),'content':'','key':_0xb0d9('0x11'),'keyType':_0xb0d9('0x7'),'variableName':_0xb0d9('0x12')},{'type':_0xb0d9('0xd'),'content':'','key':_0xb0d9('0x13'),'keyType':_0xb0d9('0x7'),'variableName':_0xb0d9('0x5')},{'type':_0xb0d9('0xd'),'content':'','key':_0xb0d9('0x14'),'keyType':_0xb0d9('0x7'),'variableName':'uniqueid'},{'type':_0xb0d9('0xd'),'content':'','key':_0xb0d9('0x15'),'keyType':_0xb0d9('0x7'),'variableName':_0xb0d9('0x16')},{'type':'string','content':_0xb0d9('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0xb0d9('0xd'),'content':'','key':'Agent\x20Name','keyType':_0xb0d9('0x7'),'variableName':_0xb0d9('0x18')},{'type':'keyValue','content':'','key':_0xb0d9('0x19'),'keyType':_0xb0d9('0x7'),'variableName':_0xb0d9('0x1a')},{'type':_0xb0d9('0x1'),'content':_0xb0d9('0x1b'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Ring','keyType':_0xb0d9('0x7'),'variableName':_0xb0d9('0x16')},{'type':'keyValue','content':'','key':'Agent\x20Connect','keyType':_0xb0d9('0x7'),'variableName':'agentconnectAt'},{'type':_0xb0d9('0xd'),'content':'','key':_0xb0d9('0x1c'),'keyType':'variable','variableName':_0xb0d9('0x1d')},{'type':_0xb0d9('0xd'),'content':'','key':_0xb0d9('0x1e'),'keyType':'variable','variableName':'holdtime'},{'type':_0xb0d9('0xd'),'content':'','key':_0xb0d9('0x1f'),'keyType':_0xb0d9('0x7'),'variableName':_0xb0d9('0x20')}];break;case _0xb0d9('0x9'):_0x4b99a5=[{'type':'string','content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0xb0d9('0xd'),'content':'','key':_0xb0d9('0x21'),'keyType':'variable','keyContent':'','variableName':'destcalleridnum'},{'type':_0xb0d9('0xd'),'content':'','key':'Member\x20Name','keyType':_0xb0d9('0x7'),'keyContent':'','variableName':'membername'},{'type':_0xb0d9('0xd'),'content':'','key':_0xb0d9('0x14'),'keyType':_0xb0d9('0x7'),'keyContent':'','variableName':_0xb0d9('0x22')},{'type':'keyValue','content':'','key':_0xb0d9('0x15'),'keyType':_0xb0d9('0x7'),'keyContent':'','variableName':_0xb0d9('0x23')},{'type':'string','content':'***\x20Time\x20Info\x20***'},{'type':_0xb0d9('0xd'),'content':'','key':_0xb0d9('0x24'),'keyType':_0xb0d9('0x7'),'keyContent':'','variableName':_0xb0d9('0x25')},{'type':_0xb0d9('0xd'),'content':'','key':_0xb0d9('0x26'),'keyType':'variable','keyContent':'','variableName':_0xb0d9('0x27')},{'type':_0xb0d9('0xd'),'content':'','key':'Duration','keyType':_0xb0d9('0x7'),'keyContent':'','variableName':'duration'},{'type':'keyValue','content':'','key':_0xb0d9('0x28'),'keyType':'variable','keyContent':'','variableName':_0xb0d9('0x29')}];break;}}return _0x4b99a5;}; \ No newline at end of file +var _0x1fda=['variable','queue','calleridnum','Outbound\x20Call','destcalleridnum','getDescriptions','voice','string','***\x20Call\x20Info\x20***','Caller\x20Number','keyValue','Caller\x20Name','calleridname','Call\x20To','Queue','UniqueId','agentcalledAt','Agent\x20Name','destcalleridname','Agent\x20Number','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','outbound','Called\x20Number','Member\x20Name','Date','***\x20Time\x20Info\x20***','answertime','Complete\x20Time','endtime','Duration','duration','getSubjects','toLowerCase','inbound','push'];(function(_0xb6d32c,_0x2a0b60){var _0x1a2e10=function(_0x280594){while(--_0x280594){_0xb6d32c['push'](_0xb6d32c['shift']());}};_0x1a2e10(++_0x2a0b60);}(_0x1fda,0x9c));var _0xa1fd=function(_0x3d66f0,_0x3f4e63){_0x3d66f0=_0x3d66f0-0x0;var _0x4164f3=_0x1fda[_0x3d66f0];return _0x4164f3;};'use strict';exports[_0xa1fd('0x0')]=function(_0x1c83ac,_0x2b1bad){var _0x32c5ef=[{'type':'string','content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x1c83ac[_0xa1fd('0x1')]()){case'voice':switch(_0x2b1bad[_0xa1fd('0x1')]()){case _0xa1fd('0x2'):_0x32c5ef[_0xa1fd('0x3')]({'type':_0xa1fd('0x4'),'content':'','variableName':_0xa1fd('0x5')});_0x32c5ef['push']({'type':_0xa1fd('0x4'),'content':'','variableName':_0xa1fd('0x6')});break;case'outbound':_0x32c5ef[_0xa1fd('0x3')]({'type':'string','content':_0xa1fd('0x7'),'variableName':null});_0x32c5ef[_0xa1fd('0x3')]({'type':_0xa1fd('0x4'),'content':'','variableName':_0xa1fd('0x8')});break;}}return _0x32c5ef;};exports[_0xa1fd('0x9')]=function(_0x12234d,_0x46d395){var _0x53cea1=[];switch(_0x12234d['toLowerCase']()){case _0xa1fd('0xa'):switch(_0x46d395['toLowerCase']()){case'inbound':_0x53cea1=[{'type':_0xa1fd('0xb'),'content':_0xa1fd('0xc'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xa1fd('0xd'),'keyType':'variable','variableName':'calleridnum'},{'type':_0xa1fd('0xe'),'content':'','key':_0xa1fd('0xf'),'keyType':'variable','variableName':_0xa1fd('0x10')},{'type':'keyValue','content':'','key':_0xa1fd('0x11'),'keyType':_0xa1fd('0x4'),'variableName':'destexten'},{'type':_0xa1fd('0xe'),'content':'','key':_0xa1fd('0x12'),'keyType':_0xa1fd('0x4'),'variableName':_0xa1fd('0x5')},{'type':_0xa1fd('0xe'),'content':'','key':_0xa1fd('0x13'),'keyType':'variable','variableName':'uniqueid'},{'type':_0xa1fd('0xe'),'content':'','key':'Date','keyType':_0xa1fd('0x4'),'variableName':_0xa1fd('0x14')},{'type':_0xa1fd('0xb'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xa1fd('0xe'),'content':'','key':_0xa1fd('0x15'),'keyType':_0xa1fd('0x4'),'variableName':_0xa1fd('0x16')},{'type':_0xa1fd('0xe'),'content':'','key':_0xa1fd('0x17'),'keyType':_0xa1fd('0x4'),'variableName':_0xa1fd('0x8')},{'type':_0xa1fd('0xb'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xa1fd('0xe'),'content':'','key':'Agent\x20Ring','keyType':_0xa1fd('0x4'),'variableName':_0xa1fd('0x14')},{'type':_0xa1fd('0xe'),'content':'','key':'Agent\x20Connect','keyType':'variable','variableName':_0xa1fd('0x18')},{'type':_0xa1fd('0xe'),'content':'','key':_0xa1fd('0x19'),'keyType':_0xa1fd('0x4'),'variableName':_0xa1fd('0x1a')},{'type':_0xa1fd('0xe'),'content':'','key':_0xa1fd('0x1b'),'keyType':'variable','variableName':_0xa1fd('0x1c')},{'type':_0xa1fd('0xe'),'content':'','key':_0xa1fd('0x1d'),'keyType':'variable','variableName':'talktime'}];break;case _0xa1fd('0x1e'):_0x53cea1=[{'type':'string','content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0xa1fd('0xe'),'content':'','key':_0xa1fd('0x1f'),'keyType':_0xa1fd('0x4'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0xa1fd('0xe'),'content':'','key':_0xa1fd('0x20'),'keyType':_0xa1fd('0x4'),'keyContent':'','variableName':'membername'},{'type':'keyValue','content':'','key':_0xa1fd('0x13'),'keyType':_0xa1fd('0x4'),'keyContent':'','variableName':'uniqueid'},{'type':_0xa1fd('0xe'),'content':'','key':_0xa1fd('0x21'),'keyType':_0xa1fd('0x4'),'keyContent':'','variableName':'starttime'},{'type':'string','content':_0xa1fd('0x22')},{'type':_0xa1fd('0xe'),'content':'','key':'Answer\x20Time','keyType':_0xa1fd('0x4'),'keyContent':'','variableName':_0xa1fd('0x23')},{'type':_0xa1fd('0xe'),'content':'','key':_0xa1fd('0x24'),'keyType':'variable','keyContent':'','variableName':_0xa1fd('0x25')},{'type':_0xa1fd('0xe'),'content':'','key':_0xa1fd('0x26'),'keyType':'variable','keyContent':'','variableName':_0xa1fd('0x27')},{'type':_0xa1fd('0xe'),'content':'','key':'Billable\x20Time','keyType':'variable','keyContent':'','variableName':'billableseconds'}];break;}}return _0x53cea1;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 794bdf3..c35a830 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 _0xe051=['../../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','name','role','stringify','null','findOne','then','catch','tracked','user','query','clone','body','html','phone','fax','mobile','lodash'];(function(_0x29a175,_0x569b23){var _0x1dd327=function(_0x262656){while(--_0x262656){_0x29a175['push'](_0x29a175['shift']());}};_0x1dd327(++_0x569b23);}(_0xe051,0x8b));var _0x1e05=function(_0x1db641,_0x3adb74){_0x1db641=_0x1db641-0x0;var _0x1b5a0f=_0xe051[_0x1db641];return _0x1b5a0f;};'use strict';var _=require(_0x1e05('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require('../../config/logger')('openchannel-interactions'),'mail':require(_0x1e05('0x1'))(_0x1e05('0x2')),'fax':require(_0x1e05('0x1'))(_0x1e05('0x3')),'sms':require('../../config/logger')(_0x1e05('0x4')),'chat':require('../../config/logger')(_0x1e05('0x5')),'whatsapp':require(_0x1e05('0x1'))(_0x1e05('0x6'))};function getInteractionId(_0x674cdf,_0x164d83,_0x32c655){if(_0x674cdf&&_0x674cdf[_[_0x1e05('0x7')](_0x32c655)+_0x1e05('0x8')]){return _0x674cdf[_['upperFirst'](_0x32c655)+_0x1e05('0x8')];}else if(_0x674cdf&&_0x674cdf['id']){return _0x674cdf['id'];}else if(_0x164d83&&_0x164d83['id']){return _0x164d83['id'];}else{return _0x1e05('0x9');}}function log(_0x5c063f,_0x2572ed,_0x586c4a,_0x2a3d2b,_0x1a66b0,_0x1ecae8){loggers[_0x1a66b0[_0x1e05('0xa')]()][_0x5c063f](_0x1e05('0xb'),_0x1ecae8['toUpperCase'](),_0x2572ed?_0x2572ed['id']:null,_0x2572ed?_0x2572ed[_0x1e05('0xc')]:null,_0x2572ed?_0x2572ed[_0x1e05('0xd')]:null,getInteractionId(_0x586c4a,_0x2a3d2b,_0x1a66b0),_0x586c4a?JSON[_0x1e05('0xe')](_0x586c4a):_0x1e05('0xf'));}function updateUser(_0x25ed4c,_0xd25faa,_0x223a3f,_0x4d7252,_0x4329f9){db[_['upperFirst'](_0x4d7252)+'Interaction'][_0x1e05('0x10')]({'where':{'id':getInteractionId(_0xd25faa,_0x223a3f,_0x4d7252)}})['then'](function(_0x467c76){if(_0x467c76){return _0x467c76['update']({'UserId':_0x25ed4c?_0x25ed4c['id']:null});}})[_0x1e05('0x11')](function(_0x5e5604){if(_0x5e5604){log('info',_0x25ed4c,_0xd25faa,_0x223a3f,_0x4d7252,_0x4329f9);}})[_0x1e05('0x12')](function(){log('error',_0x25ed4c,_0xd25faa,_0x223a3f,_0x4d7252,_0x4329f9);});}exports[_0x1e05('0x13')]=function(_0x536a1a,_0x5f1fdd){return function(_0x503ec4,_0xdfdcf,_0x3538f3){var _0x537fd6=_0x503ec4[_0x1e05('0x14')];var _0x4a04f1={};var _0x323624=_0x503ec4[_0x1e05('0x15')];if(_0x4a04f1){_0x4a04f1=_[_0x1e05('0x16')](_0x503ec4[_0x1e05('0x17')]);_0x4a04f1=_['omit'](_0x4a04f1,['body',_0x1e05('0x18'),_0x1e05('0x19'),_0x1e05('0x1a'),_0x1e05('0x1b')]);}updateUser(_0x537fd6,_0x4a04f1,_0x323624,_0x536a1a,_0x5f1fdd);_0x3538f3(null);};}; \ No newline at end of file +var _0xd27f=['upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','null','findOne','then','info','catch','error','tracked','user','query','clone','body','omit','html','phone','fax','../../config/logger','openchannel-interactions','sms-interactions','chat-interactions','whatsapp-interactions'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xd27f,0xdb));var _0xfd27=function(_0x46c4ff,_0x36a6b9){_0x46c4ff=_0x46c4ff-0x0;var _0x31c7c8=_0xd27f[_0x46c4ff];return _0x31c7c8;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0xfd27('0x0'))(_0xfd27('0x1')),'mail':require(_0xfd27('0x0'))('mail-interactions'),'fax':require(_0xfd27('0x0'))('fax-interactions'),'sms':require(_0xfd27('0x0'))(_0xfd27('0x2')),'chat':require(_0xfd27('0x0'))(_0xfd27('0x3')),'whatsapp':require(_0xfd27('0x0'))(_0xfd27('0x4'))};function getInteractionId(_0x5d6079,_0x171373,_0x483a70){if(_0x5d6079&&_0x5d6079[_[_0xfd27('0x5')](_0x483a70)+_0xfd27('0x6')]){return _0x5d6079[_['upperFirst'](_0x483a70)+'InteractionId'];}else if(_0x5d6079&&_0x5d6079['id']){return _0x5d6079['id'];}else if(_0x171373&&_0x171373['id']){return _0x171373['id'];}else{return _0xfd27('0x7');}}function log(_0x4bd63b,_0x5e813a,_0x56c7eb,_0x5a2893,_0x1b2734,_0x50417b){loggers[_0x1b2734[_0xfd27('0x8')]()][_0x4bd63b](_0xfd27('0x9'),_0x50417b[_0xfd27('0xa')](),_0x5e813a?_0x5e813a['id']:null,_0x5e813a?_0x5e813a[_0xfd27('0xb')]:null,_0x5e813a?_0x5e813a[_0xfd27('0xc')]:null,getInteractionId(_0x56c7eb,_0x5a2893,_0x1b2734),_0x56c7eb?JSON['stringify'](_0x56c7eb):_0xfd27('0xd'));}function updateUser(_0x77ceaf,_0x660927,_0xfa71e6,_0x340056,_0x5f06c8){db[_[_0xfd27('0x5')](_0x340056)+'Interaction'][_0xfd27('0xe')]({'where':{'id':getInteractionId(_0x660927,_0xfa71e6,_0x340056)}})[_0xfd27('0xf')](function(_0xff489c){if(_0xff489c){return _0xff489c['update']({'UserId':_0x77ceaf?_0x77ceaf['id']:null});}})[_0xfd27('0xf')](function(_0x153184){if(_0x153184){log(_0xfd27('0x10'),_0x77ceaf,_0x660927,_0xfa71e6,_0x340056,_0x5f06c8);}})[_0xfd27('0x11')](function(){log(_0xfd27('0x12'),_0x77ceaf,_0x660927,_0xfa71e6,_0x340056,_0x5f06c8);});}exports[_0xfd27('0x13')]=function(_0x2172c5,_0x23abf0){return function(_0x199a15,_0x672086,_0x412134){var _0x456548=_0x199a15[_0xfd27('0x14')];var _0x594476={};var _0x15bbf5=_0x199a15[_0xfd27('0x15')];if(_0x594476){_0x594476=_[_0xfd27('0x16')](_0x199a15[_0xfd27('0x17')]);_0x594476=_[_0xfd27('0x18')](_0x594476,[_0xfd27('0x17'),_0xfd27('0x19'),_0xfd27('0x1a'),_0xfd27('0x1b'),'mobile']);}updateUser(_0x456548,_0x594476,_0x15bbf5,_0x2172c5,_0x23abf0);_0x412134(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index f50a038..c910065 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 _0x3289=['format','%s:%s:%s','update','utf8','final','parse','hasOwnProperty','use','findOne','then','count','Maximum\x20%s\x20limit\x20have\x20been\x20reached','User','admin','user','isUserLimit','crypto','composable-middleware','../../mysqldb','../../config/environment','data1','license','split'];(function(_0x3c6ec9,_0x40e417){var _0x178f0c=function(_0x280a1e){while(--_0x280a1e){_0x3c6ec9['push'](_0x3c6ec9['shift']());}};_0x178f0c(++_0x40e417);}(_0x3289,0x10d));var _0x9328=function(_0x4e3d4e,_0x9e749e){_0x4e3d4e=_0x4e3d4e-0x0;var _0x57ab5a=_0x3289[_0x4e3d4e];return _0x57ab5a;};'use strict';var crypto=require(_0x9328('0x0'));var util=require('util');var compose=require(_0x9328('0x1'));var db=require(_0x9328('0x2'))['db'];var config=require(_0x9328('0x3'));function getValueFromLicense(_0x4b610a,_0x5d75b4){if(_0x4b610a&&_0x5d75b4){if(_0x5d75b4[_0x9328('0x4')]&&_0x5d75b4[_0x9328('0x5')]){var _0xf3559c=_0x5d75b4[_0x9328('0x4')];var _0x35e99a=_0x5d75b4[_0x9328('0x5')];var _0x4a6eb6=_0xf3559c[_0x9328('0x6')]('-')[0x4];var _0x5daf43=_0xf3559c[_0x9328('0x6')]('-')[0x0];var _0x4b4321=crypto['createDecipher']('aes-256-ctr',util[_0x9328('0x7')](_0x9328('0x8'),_0x4a6eb6,_0xf3559c,_0x5daf43));var _0x490b82=_0x4b4321[_0x9328('0x9')](_0x35e99a,'base64',_0x9328('0xa'));_0x490b82+=_0x4b4321[_0x9328('0xb')](_0x9328('0xa'));var _0x179034=JSON[_0x9328('0xc')](_0x490b82);return _0x179034[_0x9328('0xd')](_0x4b610a)?_0x179034[_0x4b610a]:null;}}return null;}function isLimit(_0x3cad10,_0x3ffb67,_0x339c31,_0x1fa10b){var _0x43ae8a=_0x3ffb67;return compose()[_0x9328('0xe')](function(_0x550310,_0x57fc2c,_0x3c6d55){return db['License'][_0x9328('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x9328('0x10')](function(_0x5a6a6f){var _0x33700c=getValueFromLicense(_0x3cad10,_0x5a6a6f);return _0x33700c?_0x33700c:_0x43ae8a;})[_0x9328('0x10')](function(_0x138f26){_0x43ae8a=_0x138f26;return _0x339c31[_0x9328('0x11')](_0x1fa10b);})[_0x9328('0x10')](function(_0x44bd50){if(_0x44bd50>=_0x43ae8a){return _0x57fc2c['status'](0x193)['json']({'message':util[_0x9328('0x7')](_0x9328('0x12'),_0x3cad10)});}_0x3c6d55();})['catch'](function(_0x228dde){_0x3c6d55(_0x228dde);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x9328('0x13')],{'where':{'$or':[{'role':_0x9328('0x14')},{'role':_0x9328('0x15')}]}});}exports[_0x9328('0x16')]=isUserLimit; \ No newline at end of file +var _0x2f53=['aes-256-ctr','format','%s:%s:%s','parse','hasOwnProperty','use','License','then','count','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin','user','crypto','util','composable-middleware','../../config/environment','data1','license','split','createDecipher'];(function(_0x1d010b,_0x1fb422){var _0x5a8f08=function(_0x351ae6){while(--_0x351ae6){_0x1d010b['push'](_0x1d010b['shift']());}};_0x5a8f08(++_0x1fb422);}(_0x2f53,0x196));var _0x32f5=function(_0x38c1d6,_0x3089ff){_0x38c1d6=_0x38c1d6-0x0;var _0x42d065=_0x2f53[_0x38c1d6];return _0x42d065;};'use strict';var crypto=require(_0x32f5('0x0'));var util=require(_0x32f5('0x1'));var compose=require(_0x32f5('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x32f5('0x3'));function getValueFromLicense(_0x3e5475,_0x440ac7){if(_0x3e5475&&_0x440ac7){if(_0x440ac7[_0x32f5('0x4')]&&_0x440ac7[_0x32f5('0x5')]){var _0x599ef6=_0x440ac7[_0x32f5('0x4')];var _0x2cb420=_0x440ac7['license'];var _0x309ec0=_0x599ef6[_0x32f5('0x6')]('-')[0x4];var _0x595a93=_0x599ef6[_0x32f5('0x6')]('-')[0x0];var _0x30d43e=crypto[_0x32f5('0x7')](_0x32f5('0x8'),util[_0x32f5('0x9')](_0x32f5('0xa'),_0x309ec0,_0x599ef6,_0x595a93));var _0x288ddc=_0x30d43e['update'](_0x2cb420,'base64','utf8');_0x288ddc+=_0x30d43e['final']('utf8');var _0x10bfc6=JSON[_0x32f5('0xb')](_0x288ddc);return _0x10bfc6[_0x32f5('0xc')](_0x3e5475)?_0x10bfc6[_0x3e5475]:null;}}return null;}function isLimit(_0x3e3d0f,_0x2ad75e,_0x3a79c6,_0x3073e9){var _0x4f69d7=_0x2ad75e;return compose()[_0x32f5('0xd')](function(_0x2010c6,_0x49312e,_0x181c24){return db[_0x32f5('0xe')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x32f5('0xf')](function(_0x4946ce){var _0x36f5fc=getValueFromLicense(_0x3e3d0f,_0x4946ce);return _0x36f5fc?_0x36f5fc:_0x4f69d7;})[_0x32f5('0xf')](function(_0x1fd6e4){_0x4f69d7=_0x1fd6e4;return _0x3a79c6[_0x32f5('0x10')](_0x3073e9);})['then'](function(_0x5a7bbd){if(_0x5a7bbd>=_0x4f69d7){return _0x49312e[_0x32f5('0x11')](0x193)['json']({'message':util[_0x32f5('0x9')](_0x32f5('0x12'),_0x3e3d0f)});}_0x181c24();})[_0x32f5('0x13')](function(_0xc2fd46){_0x181c24(_0xc2fd46);});});}function isUserLimit(){return isLimit(_0x32f5('0x14'),0x1,db['User'],{'where':{'$or':[{'role':_0x32f5('0x15')},{'role':_0x32f5('0x16')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 67c35d1..79ed67b 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 _0x9ae8=['[$or]','replace','[$and]','length','split','slice','match','forEach','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','\x20AS\x20','field','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','LIKE\x20?','$lt','<\x20?','<=\x20?','$in','start','$endsWith','pop','utcOffset','hours','minutes','seconds','lodash'];(function(_0x101b5e,_0x11b27c){var _0x3f0b65=function(_0x266e0e){while(--_0x266e0e){_0x101b5e['push'](_0x101b5e['shift']());}};_0x3f0b65(++_0x11b27c);}(_0x9ae8,0x6b));var _0x89ae=function(_0x1cd4a5,_0x4e7a10){_0x1cd4a5=_0x1cd4a5-0x0;var _0xfdc569=_0x9ae8[_0x1cd4a5];return _0xfdc569;};'use strict';var _=require(_0x89ae('0x0'));var moment=require('moment');exports['parseSearch']=function(_0x12a03d){var _0x258e63={'conditions':[]};_0x258e63['sqlOperator']=_['startsWith'](_0x12a03d,_0x89ae('0x1'))?'or':'and';var _0x3c3c8a=_0x12a03d[_0x89ae('0x2')](_0x89ae('0x3'),'')[_0x89ae('0x2')](_0x89ae('0x1'),'')['split']('||');for(var _0x58a807=0x0;_0x58a807<_0x3c3c8a[_0x89ae('0x4')];_0x58a807++){var _0x49fd40=_0x3c3c8a[_0x58a807][_0x89ae('0x5')](':=');var _0x19920d=_0x49fd40[0x0];var _0x13ffa6=_0x49fd40[_0x89ae('0x6')](0x1);_0x13ffa6['forEach'](function(_0x568496){var _0x7bc98f=_0x568496[_0x89ae('0x5')]('[')['shift']();var _0x179644=_0x568496[_0x89ae('0x7')](/\[(.*?)\]/g);_0x179644[_0x89ae('0x8')](function(_0x744549){var _0x37d562=_0x744549[_0x89ae('0x5')]('[')[_0x89ae('0x9')](function(_0xfefcd2){return _0xfefcd2[_0x89ae('0xa')](']')>-0x1;})[_0x89ae('0xb')](function(_0x34f011){return _0x34f011[_0x89ae('0x5')](']')[0x0];})[0x0];_0x258e63[_0x89ae('0xc')][_0x89ae('0xd')]({'field':_0x19920d,'operator':_0x7bc98f,'value':_0x37d562});});});}return _0x258e63;};exports[_0x89ae('0xe')]=function(_0x3abdd8,_0x1354db,_0x4cb5de){var _0x43b9be={};if(_0x1354db===_0x89ae('0xf')){if(_0x4cb5de[_0x89ae('0x10')]===_0x89ae('0x11')){_0x4cb5de[_0x89ae('0x10')]=_0x89ae('0x12');_0x4cb5de[_0x89ae('0x13')]+=','+_0x4cb5de[_0x89ae('0x13')];}else if(_[_0x89ae('0x14')]([_0x89ae('0x15'),_0x89ae('0x16')],_0x4cb5de[_0x89ae('0x10')])){_0x4cb5de[_0x89ae('0x13')]=moment(_0x4cb5de[_0x89ae('0x13')])[_0x89ae('0x17')](0x1,_0x89ae('0x18'))[_0x89ae('0x19')](_0x89ae('0x1a'));}}if(_0x4cb5de[_0x89ae('0x1b')]){_0x1354db=_0x4cb5de[_0x89ae('0x1b')];_0x43b9be[_0x89ae('0x1c')]=_0x89ae('0x1d')+_0x3abdd8+'.'+_0x4cb5de['field']+_0x89ae('0x1e')+_0x4cb5de['castTo']+')\x20'+parseOperator(_0x4cb5de[_0x89ae('0x10')]);}else{_0x43b9be['text']=_0x3abdd8+'.'+_0x4cb5de[_0x89ae('0x1f')]+'\x20'+parseOperator(_0x4cb5de['operator']);}if(_['includes']([_0x89ae('0x20'),_0x89ae('0x21')],_0x4cb5de[_0x89ae('0x10')]))_0x43b9be[_0x89ae('0x1c')]='('+_0x43b9be['text']+_0x89ae('0x22')+_0x3abdd8+'.'+_0x4cb5de[_0x89ae('0x1f')]+_0x89ae('0x23');_0x43b9be[_0x89ae('0x13')]=parseValue(_0x1354db,_0x4cb5de[_0x89ae('0x10')],_0x4cb5de[_0x89ae('0x13')]);return _0x43b9be;};function parseOperator(_0x57f032){var _0x199891;switch(_0x57f032){case'$in':_0x199891=_0x89ae('0x24');break;case _0x89ae('0x21'):_0x199891=_0x89ae('0x25');break;case'$eq':_0x199891=_0x89ae('0x26');break;case _0x89ae('0x20'):_0x199891=_0x89ae('0x27');break;case _0x89ae('0x28'):case _0x89ae('0x29'):case'$endsWith':_0x199891=_0x89ae('0x2a');break;case _0x89ae('0x2b'):_0x199891=_0x89ae('0x2c');break;case _0x89ae('0x15'):_0x199891='>\x20?';break;case _0x89ae('0x16'):_0x199891=_0x89ae('0x2d');break;case'$gte':_0x199891='>=\x20?';break;case _0x89ae('0x12'):_0x199891='BETWEEN\x20?\x20AND\x20?';break;}return _0x199891;}function parseValue(_0x25f955,_0x343699,_0x1553e6){var _0x4f3214={'start':undefined,'end':undefined};switch(_0x343699){case _0x89ae('0x2e'):case _0x89ae('0x21'):_0x4f3214[_0x89ae('0x2f')]=_0x1553e6[_0x89ae('0x5')](',');break;case _0x89ae('0x28'):_0x4f3214[_0x89ae('0x2f')]='%'+_0x1553e6+'%';break;case'$startsWith':_0x4f3214[_0x89ae('0x2f')]=_0x1553e6+'%';break;case _0x89ae('0x30'):_0x4f3214[_0x89ae('0x2f')]='%'+_0x1553e6;break;case _0x89ae('0x12'):var _0xd53255=_0x1553e6[_0x89ae('0x5')](',');var _0x1553e6=_0xd53255['shift']();var _0x50a7d7=_0xd53255[_0x89ae('0x31')]();if(_0x25f955==='DATE'){_0x1553e6=moment(_0x1553e6)[_0x89ae('0x32')](0x0,!![])[_0x89ae('0x19')]();_0x50a7d7=moment(_0x50a7d7)[_0x89ae('0x32')](0x0,!![])[_0x89ae('0x17')](0x17,_0x89ae('0x33'))[_0x89ae('0x17')](0x3b,_0x89ae('0x34'))[_0x89ae('0x17')](0x3b,_0x89ae('0x35'))[_0x89ae('0x19')]();}_0x4f3214={'start':_0x1553e6,'end':_0x50a7d7};break;default:_0x4f3214[_0x89ae('0x2f')]=_0x1553e6;break;}return _0x4f3214;} \ No newline at end of file +var _0xa3bd=['castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','$in','IN\x20?','=\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','hours','add','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','slice','forEach','shift','match','filter','map','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','days','format'];(function(_0x3ff150,_0x228f06){var _0xb6ac18=function(_0x468382){while(--_0x468382){_0x3ff150['push'](_0x3ff150['shift']());}};_0xb6ac18(++_0x228f06);}(_0xa3bd,0x12e));var _0xda3b=function(_0x25658d,_0x1a2f77){_0x25658d=_0x25658d-0x0;var _0x12ca9e=_0xa3bd[_0x25658d];return _0x12ca9e;};'use strict';var _=require(_0xda3b('0x0'));var moment=require(_0xda3b('0x1'));exports[_0xda3b('0x2')]=function(_0x443063){var _0x5c4273={'conditions':[]};_0x5c4273[_0xda3b('0x3')]=_[_0xda3b('0x4')](_0x443063,_0xda3b('0x5'))?'or':_0xda3b('0x6');var _0x4297ca=_0x443063[_0xda3b('0x7')](_0xda3b('0x8'),'')['replace'](_0xda3b('0x5'),'')['split']('||');for(var _0x556aa3=0x0;_0x556aa3<_0x4297ca['length'];_0x556aa3++){var _0x451b8=_0x4297ca[_0x556aa3][_0xda3b('0x9')](':=');var _0xc0987e=_0x451b8[0x0];var _0x194555=_0x451b8[_0xda3b('0xa')](0x1);_0x194555[_0xda3b('0xb')](function(_0x43bef){var _0x4b340a=_0x43bef[_0xda3b('0x9')]('[')[_0xda3b('0xc')]();var _0x271502=_0x43bef[_0xda3b('0xd')](/\[(.*?)\]/g);_0x271502['forEach'](function(_0x397455){var _0x5241a0=_0x397455['split']('[')[_0xda3b('0xe')](function(_0x547be3){return _0x547be3['indexOf'](']')>-0x1;})[_0xda3b('0xf')](function(_0x3e0124){return _0x3e0124[_0xda3b('0x9')](']')[0x0];})[0x0];_0x5c4273['conditions'][_0xda3b('0x10')]({'field':_0xc0987e,'operator':_0x4b340a,'value':_0x5241a0});});});}return _0x5c4273;};exports[_0xda3b('0x11')]=function(_0x4c3ea6,_0x3a4891,_0x17966b){var _0x6bc7cd={};if(_0x3a4891===_0xda3b('0x12')){if(_0x17966b[_0xda3b('0x13')]===_0xda3b('0x14')){_0x17966b['operator']=_0xda3b('0x15');_0x17966b[_0xda3b('0x16')]+=','+_0x17966b['value'];}else if(_[_0xda3b('0x17')]([_0xda3b('0x18'),_0xda3b('0x19')],_0x17966b[_0xda3b('0x13')])){_0x17966b[_0xda3b('0x16')]=moment(_0x17966b['value'])['add'](0x1,_0xda3b('0x1a'))[_0xda3b('0x1b')]('YYYY-MM-DD');}}if(_0x17966b[_0xda3b('0x1c')]){_0x3a4891=_0x17966b[_0xda3b('0x1c')];_0x6bc7cd[_0xda3b('0x1d')]=_0xda3b('0x1e')+_0x4c3ea6+'.'+_0x17966b[_0xda3b('0x1f')]+_0xda3b('0x20')+_0x17966b[_0xda3b('0x1c')]+')\x20'+parseOperator(_0x17966b[_0xda3b('0x13')]);}else{_0x6bc7cd['text']=_0x4c3ea6+'.'+_0x17966b[_0xda3b('0x1f')]+'\x20'+parseOperator(_0x17966b[_0xda3b('0x13')]);}if(_[_0xda3b('0x17')]([_0xda3b('0x21'),_0xda3b('0x22')],_0x17966b[_0xda3b('0x13')]))_0x6bc7cd[_0xda3b('0x1d')]='('+_0x6bc7cd[_0xda3b('0x1d')]+_0xda3b('0x23')+_0x4c3ea6+'.'+_0x17966b[_0xda3b('0x1f')]+'\x20IS\x20NULL)';_0x6bc7cd[_0xda3b('0x16')]=parseValue(_0x3a4891,_0x17966b[_0xda3b('0x13')],_0x17966b[_0xda3b('0x16')]);return _0x6bc7cd;};function parseOperator(_0x290747){var _0x56c0e2;switch(_0x290747){case _0xda3b('0x24'):_0x56c0e2=_0xda3b('0x25');break;case'$notIn':_0x56c0e2='NOT\x20IN\x20?';break;case _0xda3b('0x14'):_0x56c0e2=_0xda3b('0x26');break;case _0xda3b('0x21'):_0x56c0e2='<>\x20?';break;case _0xda3b('0x27'):case _0xda3b('0x28'):case _0xda3b('0x29'):_0x56c0e2=_0xda3b('0x2a');break;case _0xda3b('0x2b'):_0x56c0e2='<\x20?';break;case _0xda3b('0x18'):_0x56c0e2='>\x20?';break;case _0xda3b('0x19'):_0x56c0e2=_0xda3b('0x2c');break;case _0xda3b('0x2d'):_0x56c0e2=_0xda3b('0x2e');break;case _0xda3b('0x15'):_0x56c0e2=_0xda3b('0x2f');break;}return _0x56c0e2;}function parseValue(_0x53b8f6,_0x526eba,_0x53aa41){var _0x54cc62={'start':undefined,'end':undefined};switch(_0x526eba){case'$in':case _0xda3b('0x22'):_0x54cc62[_0xda3b('0x30')]=_0x53aa41[_0xda3b('0x9')](',');break;case _0xda3b('0x27'):_0x54cc62[_0xda3b('0x30')]='%'+_0x53aa41+'%';break;case _0xda3b('0x28'):_0x54cc62[_0xda3b('0x30')]=_0x53aa41+'%';break;case _0xda3b('0x29'):_0x54cc62[_0xda3b('0x30')]='%'+_0x53aa41;break;case _0xda3b('0x15'):var _0x5acd2b=_0x53aa41[_0xda3b('0x9')](',');var _0x53aa41=_0x5acd2b[_0xda3b('0xc')]();var _0xb82299=_0x5acd2b[_0xda3b('0x31')]();if(_0x53b8f6===_0xda3b('0x12')){_0x53aa41=moment(_0x53aa41)[_0xda3b('0x32')](0x0,!![])['format']();_0xb82299=moment(_0xb82299)[_0xda3b('0x32')](0x0,!![])['add'](0x17,_0xda3b('0x33'))[_0xda3b('0x34')](0x3b,_0xda3b('0x35'))[_0xda3b('0x34')](0x3b,_0xda3b('0x36'))[_0xda3b('0x1b')]();}_0x54cc62={'start':_0x53aa41,'end':_0xb82299};break;default:_0x54cc62[_0xda3b('0x30')]=_0x53aa41;break;}return _0x54cc62;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 1ef0146..e2998eb 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 _0x56a4=['intersection','model','attributes','nolimit','order','sort','filter','columns','name','where','merge','lower','options','lodash','sequelize','keys','includes','parse','fields','split','isEmpty','forOwn','find','type','DATE','$gte','format','YYYY-MM-DD','utc','$lte','subtract','uniqueid','isArray','limit','offset','map','col','priority','unsigned','DESC','ASC','omit','isString','length','unset','hasOwnProperty','isNumeric','match','forEach','push','getOptions','query','$id','filters'];(function(_0x45aa7a,_0x1164a1){var _0x26e48f=function(_0x3d63be){while(--_0x3d63be){_0x45aa7a['push'](_0x45aa7a['shift']());}};_0x26e48f(++_0x1164a1);}(_0x56a4,0x11b));var _0x456a=function(_0x15de7b,_0x1f9e4e){_0x15de7b=_0x15de7b-0x0;var _0x1456c4=_0x56a4[_0x15de7b];return _0x1456c4;};'use strict';var _=require(_0x456a('0x0'));var sequelize=require(_0x456a('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1a164f){var _0x93d98f=['ne'];try{var _0x5f3fe1=JSON['parse'](_0x1a164f);var _0x26a7c6=Object[_0x456a('0x2')](_0x5f3fe1)[0x0];return _0x93d98f[_0x456a('0x3')](_0x26a7c6);}catch(_0x1c904){return![];}}function getOperatorValue(_0x4773f0){var _0x4b8eec=JSON[_0x456a('0x4')](_0x4773f0);var _0x52b38d=Object['keys'](_0x4b8eec)[0x0];var _0x2b6329=_0x4b8eec[_0x52b38d];return{['$'+_0x52b38d]:_0x2b6329};}exports[_0x456a('0x5')]=function(_0x37f1b4){var _0x4c4e05=null;if(_0x37f1b4){_0x4c4e05=_0x37f1b4[_0x456a('0x6')](',');}return _0x4c4e05;};exports['filters']=function(_0xb56df,_0x29073f){var _0x3bb712={};if(!_[_0x456a('0x7')](_0xb56df)){_[_0x456a('0x8')](_0xb56df,function(_0x1ef6b6,_0x1179fa){try{if(_0x29073f){var _0xe60506=_[_0x456a('0x9')](_0x29073f,{'name':_0x1179fa})||{};if(hasSequelizeOperator(_0x1ef6b6)){_0x3bb712[_0x1179fa]=getOperatorValue(_0x1ef6b6);}else if(_0xe60506[_0x456a('0xa')]===_0x456a('0xb')&&_['isPlainObject'](_0x1ef6b6)){var _0x2f4b75=JSON['parse'](_0x1ef6b6);var _0x5aad13={'$gte':moment(moment(_0x2f4b75[_0x456a('0xc')])[_0x456a('0xd')](_0x456a('0xe')))[_0x456a('0xf')]()['format'](),'$lte':moment(moment(_0x2f4b75[_0x456a('0x10')])[_0x456a('0xd')](_0x456a('0xe')))[_0x456a('0xf')]()[_0x456a('0x11')](0x1,'s')[_0x456a('0xd')]()};_0x3bb712[_0x1179fa]=_0x5aad13;}else if(_0xe60506['name']===_0x456a('0x12')){_0x3bb712[_0x1179fa]=_0x1ef6b6;}else{_0x3bb712[_0x1179fa]=_[_0x456a('0x13')](_0x1ef6b6)?_0x1ef6b6:JSON[_0x456a('0x4')](_0x1ef6b6);}}else{_0x3bb712[_0x1179fa]=_[_0x456a('0x13')](_0x1ef6b6)?_0x1ef6b6:JSON['parse'](_0x1ef6b6);}}catch(_0x200eda){_0x3bb712[_0x1179fa]=_0x1ef6b6[_0x456a('0x6')](',');}});}return _0x3bb712;};exports[_0x456a('0x14')]=function(_0x599c2e){_0x599c2e=parseInt(_0x599c2e,0xa);if(!_0x599c2e||_0x599c2e<0x0){_0x599c2e=LIMIT_VALUE;}return _0x599c2e;};exports[_0x456a('0x15')]=function(_0x520f2f){_0x520f2f=parseInt(_0x520f2f,0xa);if(!_0x520f2f||_0x520f2f<0x0){_0x520f2f=0x0;}return _0x520f2f;};exports['sort']=function(_0x33be50){var _0x562cfa,_0x44d79a=null;if(_0x33be50){_0x562cfa=_0x33be50['split'](',');_0x44d79a=_[_0x456a('0x16')](_0x562cfa,function(_0x17d0ae){if(_0x17d0ae['indexOf']('-')===0x0){return[_0x17d0ae==='priority'?sequelize['cast'](sequelize[_0x456a('0x17')](_0x456a('0x18')),_0x456a('0x19')):_0x17d0ae['substr'](0x1),_0x456a('0x1a')];}else{return[_0x17d0ae==='priority'?sequelize['cast'](sequelize['col'](_0x456a('0x18')),_0x456a('0x19')):_0x17d0ae,_0x456a('0x1b')];}});}return _0x44d79a;};exports['omit']=function(_0x45ea0c,_0x360b42){if(_['isEmpty'](_0x45ea0c)){return _0x45ea0c;}if(_[_0x456a('0x13')](_0x45ea0c)){for(var _0x561097=0x0;_0x561097<_0x45ea0c['length'];_0x561097+=0x1){_0x45ea0c[_0x561097]=this[_0x456a('0x1c')](_0x45ea0c[_0x561097],_0x360b42);}return _0x45ea0c;}if(!_['isObject'](_0x45ea0c)){return _0x45ea0c;}if(_[_0x456a('0x1d')](_0x360b42)){_0x360b42=[_0x360b42];}if(!_['isArray'](_0x360b42)){return _0x45ea0c;}for(var _0x1ee212=0x0;_0x1ee212<_0x360b42[_0x456a('0x1e')];_0x1ee212+=0x1){_[_0x456a('0x1f')](_0x45ea0c,_0x360b42[_0x1ee212]);}for(var _0x2e8005 in _0x45ea0c){if(_0x45ea0c[_0x456a('0x20')](_0x2e8005)){_0x45ea0c[_0x2e8005]=this[_0x456a('0x1c')](_0x45ea0c[_0x2e8005],_0x360b42);}}return _0x45ea0c;};exports[_0x456a('0x21')]=function(_0x25da31){return _0x25da31['match'](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports['isEmail']=function(_0x38912b){return _0x38912b[_0x456a('0x22')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x28437d){var _0x374149=[];_0x28437d[_0x456a('0x6')](/[ ,]+/)[_0x456a('0x23')](function(_0x257d18){_0x257d18=_0x257d18['replace'](/([^:]")"+/g,'$1');_0x257d18='+'+_0x257d18+'*';var _0x41efdc=/[ `!@#$%^&*()_\-?~]/;if(_0x257d18[_0x456a('0x22')](_0x41efdc))_0x257d18='\x22'+_0x257d18+'\x22';_0x374149[_0x456a('0x24')](_0x257d18);});return _0x374149['join']('\x20');};exports[_0x456a('0x25')]=function(_0x342c76,_0x4f4693,_0x18d035){var _0x24efbc={},_0xd5c0f0={};if(_0x4f4693[_0x456a('0x26')][_0x456a('0x27')]){_0x4f4693['query']['id']=_0x4f4693[_0x456a('0x26')][_0x456a('0x27')];delete _0x4f4693[_0x456a('0x26')]['$id'];}_0x24efbc['model']=_[_0x456a('0x16')](_0x342c76,'name');_0x24efbc['query']=_['keys'](_0x4f4693[_0x456a('0x26')]);_0x24efbc[_0x456a('0x28')]=_[_0x456a('0x29')](_0x24efbc[_0x456a('0x2a')],_0x24efbc['query']);_0xd5c0f0[_0x456a('0x2b')]=_[_0x456a('0x29')](_0x24efbc['model'],this[_0x456a('0x5')](_0x4f4693[_0x456a('0x26')][_0x456a('0x5')]));_0xd5c0f0[_0x456a('0x2b')]=_0xd5c0f0[_0x456a('0x2b')]['length']?_0xd5c0f0[_0x456a('0x2b')]:_0x24efbc[_0x456a('0x2a')];if(!_0x4f4693['query'][_0x456a('0x20')](_0x456a('0x2c'))){_0xd5c0f0[_0x456a('0x14')]=this[_0x456a('0x14')](_0x4f4693[_0x456a('0x26')][_0x456a('0x14')]);_0xd5c0f0[_0x456a('0x15')]=this[_0x456a('0x15')](_0x4f4693['query'][_0x456a('0x15')]);}_0xd5c0f0[_0x456a('0x2d')]=this[_0x456a('0x2e')](_0x4f4693[_0x456a('0x26')][_0x456a('0x2e')]);_0xd5c0f0['where']=this[_0x456a('0x28')](_['pick'](_0x4f4693[_0x456a('0x26')],_0x24efbc[_0x456a('0x28')]),_0x342c76);if(_0x4f4693['query'][_0x456a('0x2f')]){var _0x3515f5=_0x342c76;var _0x23e67f=_0x4f4693['query'][_0x456a('0x2f')];if(typeof _0x23e67f==='object'){_0x3515f5=_['filter'](_0x342c76,function(_0x4421ad){return _['includes'](_0x23e67f[_0x456a('0x30')],_0x4421ad[_0x456a('0x31')]);});_0x23e67f=_0x23e67f['value'];}_0xd5c0f0[_0x456a('0x32')]=_[_0x456a('0x33')](_0xd5c0f0[_0x456a('0x32')],{'$or':_[_0x456a('0x16')](_0x3515f5,function(_0x355ae8){if(_0x355ae8[_0x456a('0xa')]!=='VIRTUAL'){if(_0x18d035){return sequelize[_0x456a('0x32')](sequelize['fn']('lower',sequelize[_0x456a('0x17')](_0x355ae8[_0x456a('0x31')])),{'$like':sequelize['fn'](_0x456a('0x34'),'%'+_0x4f4693[_0x456a('0x26')][_0x456a('0x2f')]+'%')});}else{var _0x58ee37={};_0x58ee37[_0x355ae8[_0x456a('0x31')]]={'$like':'%'+_0x4f4693[_0x456a('0x26')][_0x456a('0x2f')]+'%'};return _0x58ee37;}}})});}_0xd5c0f0=_[_0x456a('0x33')]({},_0xd5c0f0,_0x4f4693[_0x456a('0x35')]);return _0xd5c0f0;}; \ No newline at end of file +var _0x9c5a=['YYYY-MM-DD','utc','$lte','subtract','uniqueid','isArray','limit','offset','sort','indexOf','col','priority','unsigned','substr','DESC','omit','isEmpty','length','isString','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','replace','push','join','getOptions','query','$id','name','intersection','model','attributes','nolimit','order','filter','object','columns','value','where','VIRTUAL','lower','merge','options','lodash','sequelize','parse','keys','includes','fields','split','filters','find','type','DATE','isPlainObject','format'];(function(_0xde95fe,_0x1f4c12){var _0x275163=function(_0x3c1704){while(--_0x3c1704){_0xde95fe['push'](_0xde95fe['shift']());}};_0x275163(++_0x1f4c12);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x1a63bf,_0x7177f9){_0x1a63bf=_0x1a63bf-0x0;var _0x184a16=_0x9c5a[_0x1a63bf];return _0x184a16;};'use strict';var _=require(_0xa9c5('0x0'));var sequelize=require(_0xa9c5('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x32ab4d){var _0x1cd14d=['ne'];try{var _0x1d0ee9=JSON[_0xa9c5('0x2')](_0x32ab4d);var _0x4f5552=Object[_0xa9c5('0x3')](_0x1d0ee9)[0x0];return _0x1cd14d[_0xa9c5('0x4')](_0x4f5552);}catch(_0x4e9403){return![];}}function getOperatorValue(_0x1e3c83){var _0x4d9c7a=JSON[_0xa9c5('0x2')](_0x1e3c83);var _0x3df556=Object['keys'](_0x4d9c7a)[0x0];var _0x4b6db6=_0x4d9c7a[_0x3df556];return{['$'+_0x3df556]:_0x4b6db6};}exports[_0xa9c5('0x5')]=function(_0x16f331){var _0x52afb2=null;if(_0x16f331){_0x52afb2=_0x16f331[_0xa9c5('0x6')](',');}return _0x52afb2;};exports[_0xa9c5('0x7')]=function(_0x51c14c,_0x2e4f45){var _0x40a79d={};if(!_['isEmpty'](_0x51c14c)){_['forOwn'](_0x51c14c,function(_0x38e106,_0x11421c){try{if(_0x2e4f45){var _0x45f8d8=_[_0xa9c5('0x8')](_0x2e4f45,{'name':_0x11421c})||{};if(hasSequelizeOperator(_0x38e106)){_0x40a79d[_0x11421c]=getOperatorValue(_0x38e106);}else if(_0x45f8d8[_0xa9c5('0x9')]===_0xa9c5('0xa')&&_[_0xa9c5('0xb')](_0x38e106)){var _0x42d5cf=JSON[_0xa9c5('0x2')](_0x38e106);var _0x1ea48={'$gte':moment(moment(_0x42d5cf['$gte'])[_0xa9c5('0xc')](_0xa9c5('0xd')))[_0xa9c5('0xe')]()[_0xa9c5('0xc')](),'$lte':moment(moment(_0x42d5cf[_0xa9c5('0xf')])[_0xa9c5('0xc')](_0xa9c5('0xd')))[_0xa9c5('0xe')]()[_0xa9c5('0x10')](0x1,'s')[_0xa9c5('0xc')]()};_0x40a79d[_0x11421c]=_0x1ea48;}else if(_0x45f8d8['name']===_0xa9c5('0x11')){_0x40a79d[_0x11421c]=_0x38e106;}else{_0x40a79d[_0x11421c]=_[_0xa9c5('0x12')](_0x38e106)?_0x38e106:JSON[_0xa9c5('0x2')](_0x38e106);}}else{_0x40a79d[_0x11421c]=_['isArray'](_0x38e106)?_0x38e106:JSON[_0xa9c5('0x2')](_0x38e106);}}catch(_0x1142d9){_0x40a79d[_0x11421c]=_0x38e106[_0xa9c5('0x6')](',');}});}return _0x40a79d;};exports[_0xa9c5('0x13')]=function(_0x452a9b){_0x452a9b=parseInt(_0x452a9b,0xa);if(!_0x452a9b||_0x452a9b<0x0){_0x452a9b=LIMIT_VALUE;}return _0x452a9b;};exports[_0xa9c5('0x14')]=function(_0x3b8d4d){_0x3b8d4d=parseInt(_0x3b8d4d,0xa);if(!_0x3b8d4d||_0x3b8d4d<0x0){_0x3b8d4d=0x0;}return _0x3b8d4d;};exports[_0xa9c5('0x15')]=function(_0x2c7cd5){var _0x36c486,_0x113c8f=null;if(_0x2c7cd5){_0x36c486=_0x2c7cd5[_0xa9c5('0x6')](',');_0x113c8f=_['map'](_0x36c486,function(_0x1115ad){if(_0x1115ad[_0xa9c5('0x16')]('-')===0x0){return[_0x1115ad==='priority'?sequelize['cast'](sequelize[_0xa9c5('0x17')](_0xa9c5('0x18')),_0xa9c5('0x19')):_0x1115ad[_0xa9c5('0x1a')](0x1),_0xa9c5('0x1b')];}else{return[_0x1115ad===_0xa9c5('0x18')?sequelize['cast'](sequelize['col'](_0xa9c5('0x18')),_0xa9c5('0x19')):_0x1115ad,'ASC'];}});}return _0x113c8f;};exports[_0xa9c5('0x1c')]=function(_0x424b4c,_0x306c9b){if(_[_0xa9c5('0x1d')](_0x424b4c)){return _0x424b4c;}if(_[_0xa9c5('0x12')](_0x424b4c)){for(var _0x40f08b=0x0;_0x40f08b<_0x424b4c[_0xa9c5('0x1e')];_0x40f08b+=0x1){_0x424b4c[_0x40f08b]=this['omit'](_0x424b4c[_0x40f08b],_0x306c9b);}return _0x424b4c;}if(!_['isObject'](_0x424b4c)){return _0x424b4c;}if(_[_0xa9c5('0x1f')](_0x306c9b)){_0x306c9b=[_0x306c9b];}if(!_['isArray'](_0x306c9b)){return _0x424b4c;}for(var _0x1762ac=0x0;_0x1762ac<_0x306c9b[_0xa9c5('0x1e')];_0x1762ac+=0x1){_['unset'](_0x424b4c,_0x306c9b[_0x1762ac]);}for(var _0x11a723 in _0x424b4c){if(_0x424b4c[_0xa9c5('0x20')](_0x11a723)){_0x424b4c[_0x11a723]=this['omit'](_0x424b4c[_0x11a723],_0x306c9b);}}return _0x424b4c;};exports[_0xa9c5('0x21')]=function(_0x32baf9){return _0x32baf9[_0xa9c5('0x22')](RegExp(_0xa9c5('0x23')))?!![]:![];};exports[_0xa9c5('0x24')]=function(_0x4f6e70){return _0x4f6e70[_0xa9c5('0x22')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x3c3da7){var _0x1ef388=[];_0x3c3da7[_0xa9c5('0x6')](/[ ,]+/)['forEach'](function(_0xc6d0c1){_0xc6d0c1=_0xc6d0c1[_0xa9c5('0x25')](/([^:]")"+/g,'$1');_0xc6d0c1='+'+_0xc6d0c1+'*';var _0x5bc9bb=/[ `!@#$%^&*()_\-?~]/;if(_0xc6d0c1[_0xa9c5('0x22')](_0x5bc9bb))_0xc6d0c1='\x22'+_0xc6d0c1+'\x22';_0x1ef388[_0xa9c5('0x26')](_0xc6d0c1);});return _0x1ef388[_0xa9c5('0x27')]('\x20');};exports[_0xa9c5('0x28')]=function(_0x22ee21,_0x3392d0,_0x3a66d8){var _0x4b9104={},_0x452330={};if(_0x3392d0[_0xa9c5('0x29')][_0xa9c5('0x2a')]){_0x3392d0[_0xa9c5('0x29')]['id']=_0x3392d0[_0xa9c5('0x29')][_0xa9c5('0x2a')];delete _0x3392d0[_0xa9c5('0x29')][_0xa9c5('0x2a')];}_0x4b9104['model']=_['map'](_0x22ee21,_0xa9c5('0x2b'));_0x4b9104[_0xa9c5('0x29')]=_[_0xa9c5('0x3')](_0x3392d0[_0xa9c5('0x29')]);_0x4b9104[_0xa9c5('0x7')]=_[_0xa9c5('0x2c')](_0x4b9104['model'],_0x4b9104['query']);_0x452330['attributes']=_[_0xa9c5('0x2c')](_0x4b9104[_0xa9c5('0x2d')],this['fields'](_0x3392d0[_0xa9c5('0x29')]['fields']));_0x452330[_0xa9c5('0x2e')]=_0x452330[_0xa9c5('0x2e')][_0xa9c5('0x1e')]?_0x452330[_0xa9c5('0x2e')]:_0x4b9104['model'];if(!_0x3392d0[_0xa9c5('0x29')][_0xa9c5('0x20')](_0xa9c5('0x2f'))){_0x452330[_0xa9c5('0x13')]=this[_0xa9c5('0x13')](_0x3392d0[_0xa9c5('0x29')][_0xa9c5('0x13')]);_0x452330[_0xa9c5('0x14')]=this['offset'](_0x3392d0[_0xa9c5('0x29')][_0xa9c5('0x14')]);}_0x452330[_0xa9c5('0x30')]=this[_0xa9c5('0x15')](_0x3392d0[_0xa9c5('0x29')][_0xa9c5('0x15')]);_0x452330['where']=this[_0xa9c5('0x7')](_['pick'](_0x3392d0[_0xa9c5('0x29')],_0x4b9104['filters']),_0x22ee21);if(_0x3392d0[_0xa9c5('0x29')][_0xa9c5('0x31')]){var _0x37fb1b=_0x22ee21;var _0x5d09c5=_0x3392d0[_0xa9c5('0x29')][_0xa9c5('0x31')];if(typeof _0x5d09c5===_0xa9c5('0x32')){_0x37fb1b=_[_0xa9c5('0x31')](_0x22ee21,function(_0x5914d2){return _[_0xa9c5('0x4')](_0x5d09c5[_0xa9c5('0x33')],_0x5914d2[_0xa9c5('0x2b')]);});_0x5d09c5=_0x5d09c5[_0xa9c5('0x34')];}_0x452330[_0xa9c5('0x35')]=_['merge'](_0x452330[_0xa9c5('0x35')],{'$or':_['map'](_0x37fb1b,function(_0x1de605){if(_0x1de605[_0xa9c5('0x9')]!==_0xa9c5('0x36')){if(_0x3a66d8){return sequelize[_0xa9c5('0x35')](sequelize['fn'](_0xa9c5('0x37'),sequelize[_0xa9c5('0x17')](_0x1de605[_0xa9c5('0x2b')])),{'$like':sequelize['fn'](_0xa9c5('0x37'),'%'+_0x3392d0[_0xa9c5('0x29')][_0xa9c5('0x31')]+'%')});}else{var _0x4aa4dd={};_0x4aa4dd[_0x1de605[_0xa9c5('0x2b')]]={'$like':'%'+_0x3392d0[_0xa9c5('0x29')][_0xa9c5('0x31')]+'%'};return _0x4aa4dd;}}})});}_0x452330=_[_0xa9c5('0x38')]({},_0x452330,_0x3392d0[_0xa9c5('0x39')]);return _0x452330;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index f7cdc2b..800c41e 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(_0x126860,_0x35b557){var _0x19555b=function(_0x5a0d1a){while(--_0x5a0d1a){_0x126860['push'](_0x126860['shift']());}};_0x19555b(++_0x35b557);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _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(_0x3b7b8a,_0x52c3b0){var _0x441206=function(_0x5d34d3){while(--_0x5d34d3){_0x3b7b8a['push'](_0x3b7b8a['shift']());}};_0x441206(++_0x52c3b0);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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 5fa5dde..4c9b64d 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 _0xf7d3=['dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress','ipAddress','update','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','filter','family','IPv4','concat','00:00:00:00:00:00','address','127.0.0.1','cpus','map','model','createHash','md5','digest','hex','getUuid','platform','licenseToken'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xf7d3,0x10f));var _0x3f7d=function(_0x51e8c6,_0x46b751){_0x51e8c6=_0x51e8c6-0x0;var _0x397415=_0xf7d3[_0x51e8c6];return _0x397415;};'use strict';var _=require(_0x3f7d('0x0'));var os=require('os');var crypto=require(_0x3f7d('0x1'));var machine=require(_0x3f7d('0x2'));var exec=require(_0x3f7d('0x3'))[_0x3f7d('0x4')];var config=require(_0x3f7d('0x5'));function getInterfaces(){var _0x2e641a=[];var _0x1304ad=os[_0x3f7d('0x6')]();var _0x33b39b=_[_0x3f7d('0x7')](_[_0x3f7d('0x8')](_0x1304ad));for(var _0x21c717=0x0;_0x21c717<_0x33b39b['length'];_0x21c717++){var _0x17182f=_0x1304ad[_0x33b39b[_0x21c717]][_0x3f7d('0x9')](function(_0xc7275d){return _0xc7275d[_0x3f7d('0xa')]===_0x3f7d('0xb')&&_0xc7275d['internal']===![];});_0x2e641a=_0x2e641a[_0x3f7d('0xc')](_0x17182f);}return _0x2e641a;}function getFirstInterface(){var _0x302f21=_['head'](getInterfaces());return{'macAddress':_0x302f21&&_0x302f21['mac']?_0x302f21['mac']:_0x3f7d('0xd'),'ipAddress':_0x302f21&&_0x302f21[_0x3f7d('0xe')]?_0x302f21[_0x3f7d('0xe')]:_0x3f7d('0xf')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x3c0a95=_[_0x3f7d('0x7')](os[_0x3f7d('0x10')]()[_0x3f7d('0x11')](function(_0x5e107f){return _0x5e107f[_0x3f7d('0x12')];}))['join'](':');return crypto[_0x3f7d('0x13')](_0x3f7d('0x14'))['update'](_0x3c0a95)[_0x3f7d('0x15')](_0x3f7d('0x16'));}exports[_0x3f7d('0x17')]=function(){var _0x516c67=os[_0x3f7d('0x18')]();var _0x1f4284=/[0-9a-f-]{36}/;if(config[_0x3f7d('0x19')]&&_0x1f4284['test'](config[_0x3f7d('0x19')])){return config[_0x3f7d('0x19')];}else if(_0x516c67==='win32'){return exec(_0x3f7d('0x1a'),{'encoding':_0x3f7d('0x1b')})['replace']('\x0d\x0a','');}else{var _0x221870=getFirstInterface();var _0x184df6=getCPUhash();var _0x196729=_0x184df6+'|'+os[_0x3f7d('0x1c')]()+'|'+_0x221870[_0x3f7d('0x1d')]+'|'+_0x221870[_0x3f7d('0x1e')];var _0x495c3f=crypto[_0x3f7d('0x13')]('md5')[_0x3f7d('0x1f')](_0x196729)[_0x3f7d('0x15')](_0x3f7d('0x16'));return _0x495c3f[_0x3f7d('0x20')](0x0,0x8)+'-'+_0x495c3f[_0x3f7d('0x20')](0x8,0xc)+'-'+_0x495c3f[_0x3f7d('0x20')](0xc,0x10)+'-'+_0x495c3f['substring'](0x10,0x14)+'-'+_0x495c3f[_0x3f7d('0x20')](0x14);}}; \ No newline at end of file +var _0xfa6e=['update','digest','hex','getUuid','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','utf8','replace','substring','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','length','filter','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','cpus','model','join','createHash','md5'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xfa6e,0x17f));var _0xefa6=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xfa6e[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xefa6('0x0'));var machine=require(_0xefa6('0x1'));var exec=require(_0xefa6('0x2'))[_0xefa6('0x3')];var config=require(_0xefa6('0x4'));function getInterfaces(){var _0x4c3a76=[];var _0x5e91b0=os[_0xefa6('0x5')]();var _0xe5a9e8=_[_0xefa6('0x6')](_['keys'](_0x5e91b0));for(var _0x4120d5=0x0;_0x4120d5<_0xe5a9e8[_0xefa6('0x7')];_0x4120d5++){var _0x39b2be=_0x5e91b0[_0xe5a9e8[_0x4120d5]][_0xefa6('0x8')](function(_0x5b62a2){return _0x5b62a2['family']==='IPv4'&&_0x5b62a2['internal']===![];});_0x4c3a76=_0x4c3a76[_0xefa6('0x9')](_0x39b2be);}return _0x4c3a76;}function getFirstInterface(){var _0x3a2529=_[_0xefa6('0xa')](getInterfaces());return{'macAddress':_0x3a2529&&_0x3a2529[_0xefa6('0xb')]?_0x3a2529[_0xefa6('0xb')]:_0xefa6('0xc'),'ipAddress':_0x3a2529&&_0x3a2529[_0xefa6('0xd')]?_0x3a2529[_0xefa6('0xd')]:_0xefa6('0xe')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x4ea1e1=_['orderBy'](os[_0xefa6('0xf')]()['map'](function(_0x533545){return _0x533545[_0xefa6('0x10')];}))[_0xefa6('0x11')](':');return crypto[_0xefa6('0x12')](_0xefa6('0x13'))[_0xefa6('0x14')](_0x4ea1e1)[_0xefa6('0x15')](_0xefa6('0x16'));}exports[_0xefa6('0x17')]=function(){var _0x25265f=os[_0xefa6('0x18')]();var _0x44740f=/[0-9a-f-]{36}/;if(config[_0xefa6('0x19')]&&_0x44740f[_0xefa6('0x1a')](config['licenseToken'])){return config[_0xefa6('0x19')];}else if(_0x25265f==='win32'){return exec(_0xefa6('0x1b'),{'encoding':_0xefa6('0x1c')})[_0xefa6('0x1d')]('\x0d\x0a','');}else{var _0x43cf84=getFirstInterface();var _0x104add=getCPUhash();var _0x586547=_0x104add+'|'+os['hostname']()+'|'+_0x43cf84['macAddress']+'|'+_0x43cf84['ipAddress'];var _0x2f4582=crypto[_0xefa6('0x12')]('md5')['update'](_0x586547)['digest']('hex');return _0x2f4582[_0xefa6('0x1e')](0x0,0x8)+'-'+_0x2f4582[_0xefa6('0x1e')](0x8,0xc)+'-'+_0x2f4582['substring'](0xc,0x10)+'-'+_0x2f4582[_0xefa6('0x1e')](0x10,0x14)+'-'+_0x2f4582['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 63f31af..276e1e7 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 _0x6e50=['update','encryptString','diff','days','DEMO\x20START\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','error','message','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','pkginfo','../../mysqldb','../../components/encryptor','./hardware','license','%s/api/servers/%s/check?version=%s','exports','version','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','catch','get','data1','data2','then','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase'];(function(_0x372ca0,_0x5d47e9){var _0x189a65=function(_0x1ecec8){while(--_0x1ecec8){_0x372ca0['push'](_0x372ca0['shift']());}};_0x189a65(++_0x5d47e9);}(_0x6e50,0xdb));var _0x06e5=function(_0x2833cb,_0x2f98a3){_0x2833cb=_0x2833cb-0x0;var _0x5af5ba=_0x6e50[_0x2833cb];return _0x5af5ba;};'use strict';var util=require(_0x06e5('0x0'));var moment=require(_0x06e5('0x1'));var rp=require(_0x06e5('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0x06e5('0x3'))(module,'version');var db=require(_0x06e5('0x4'))['db'];var encryptor=require(_0x06e5('0x5'));var hardware=require(_0x06e5('0x6'));var logger=require('../logger')(_0x06e5('0x7'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x159199){return new BPromise(function(_0x2f0bf2,_0x202e7b){var _0x518820=util['format'](_0x06e5('0x8'),HOST,_0x159199,module[_0x06e5('0x9')][_0x06e5('0xa')]);if(oldToken){_0x518820=util[_0x06e5('0xb')](_0x06e5('0xc'),HOST,_0x159199,module[_0x06e5('0x9')][_0x06e5('0xa')],oldToken);}var _0x10b16a={'uri':_0x518820,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x10b16a)['then'](function(_0x5200ba){_0x2f0bf2(_0x5200ba);})[_0x06e5('0xd')](function(_0x123263){_0x202e7b(_0x123263);});});}function manageLicense(_0x3c5787,_0x4edfbe){var _0x5722c7=_0x4edfbe[_0x06e5('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x5722c7[_0x06e5('0xf')]!==_0x3c5787&&!_0x5722c7[_0x06e5('0x10')]){oldToken=_0x5722c7['data1'];}httpRequest(_0x3c5787)[_0x06e5('0x11')](function(_0x266466){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x266466[_0x06e5('0x12')]){isOldTokenSent=![];if(!_0x5722c7[_0x06e5('0x7')]&&_0x5722c7[_0x06e5('0x7')]!=_0x266466['license']||_0x5722c7[_0x06e5('0x7')]&&_0x5722c7[_0x06e5('0x10')]){logger[_0x06e5('0x13')](_0x06e5('0x14'));}if(_0x5722c7['license']&&!_0x5722c7[_0x06e5('0x10')]&&_0x5722c7['license']!=_0x266466[_0x06e5('0x7')]){logger[_0x06e5('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x5722c7['license']&&!_0x5722c7[_0x06e5('0x10')]&&_0x5722c7[_0x06e5('0x7')]==_0x266466[_0x06e5('0x7')]){return _0x4edfbe;}return _0x4edfbe['update']({'data1':_0x3c5787,'data2':null,'license':_0x266466[_0x06e5('0x7')]});}else{if(_0x266466[_0x06e5('0x7')]||_0x5722c7['license']){if(!_0x5722c7[_0x06e5('0x10')]){if(_0x5722c7[_0x06e5('0xf')]==_0x3c5787){GRAY_PERIOD_REASON=_0x06e5('0x15');logger[_0x06e5('0x13')](_0x06e5('0x16'));}else{GRAY_PERIOD_REASON=_0x06e5('0x17');logger['info'](_0x06e5('0x18'),_0x5722c7[_0x06e5('0xf')],_0x3c5787);}logger[_0x06e5('0x13')](_0x06e5('0x19'),GRAY_PERIOD_REASON[_0x06e5('0x1a')](),moment()[_0x06e5('0xb')]('YYYY-MM-DD\x20HH:mm'));return _0x4edfbe[_0x06e5('0x1b')]({'data2':encryptor[_0x06e5('0x1c')](moment()['format']('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x06e5('0x1d')](encryptor['decryptString'](_0x5722c7['data2']),_0x06e5('0x1e'))>DAYS){logger[_0x06e5('0x13')](_0x06e5('0x1f'),moment()[_0x06e5('0xb')](_0x06e5('0x20')));isOldTokenSent=![];return _0x4edfbe[_0x06e5('0x1b')]({'data1':_0x3c5787,'data2':null,'license':null});}}}else{if(_0x5722c7[_0x06e5('0xf')]!=_0x3c5787){logger[_0x06e5('0x13')](_0x06e5('0x18'),_0x5722c7[_0x06e5('0xf')],_0x3c5787);return _0x4edfbe[_0x06e5('0x1b')]({'data1':_0x3c5787,'data2':null,'license':null});}}}return _0x4edfbe;})[_0x06e5('0x11')](function(_0x30531a){_0x4edfbe=_0x30531a;})[_0x06e5('0xd')](function(_0x4e48db){logger[_0x06e5('0x21')](_0x4e48db[_0x06e5('0x22')]);})[_0x06e5('0x23')](function(){setTimeout(function(){manageLicense(hardware[_0x06e5('0x24')](),_0x4edfbe);},TIME);});}function defaultLicense(){var _0x2cdfc2=hardware['getUuid']();if(_0x2cdfc2){return db[_0x06e5('0x25')][_0x06e5('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0x2cdfc2}})['spread'](function(_0x3be239,_0x438dbc){logger[_0x06e5('0x13')](_0x06e5('0x27'),_0x2cdfc2);manageLicense(_0x2cdfc2,_0x3be239);})[_0x06e5('0xd')](function(_0x77c551){logger[_0x06e5('0x21')](_0x77c551[_0x06e5('0x22')]);});}}exports[_0x06e5('0x28')]=defaultLicense; \ No newline at end of file +var _0x467a=['version','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','catch','message','finally','getUuid','License','findOrCreate','error','default','util','moment','request-promise','bluebird','pkginfo','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports'];(function(_0x3f3b8d,_0x2773d5){var _0x1ee8f3=function(_0x3db45c){while(--_0x3db45c){_0x3f3b8d['push'](_0x3f3b8d['shift']());}};_0x1ee8f3(++_0x2773d5);}(_0x467a,0xa3));var _0xa467=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x467a[_0x2dafbe];return _0x58a45a;};'use strict';var util=require(_0xa467('0x0'));var moment=require(_0xa467('0x1'));var rp=require(_0xa467('0x2'));var BPromise=require(_0xa467('0x3'));var pkginfo=require(_0xa467('0x4'))(module,'version');var db=require(_0xa467('0x5'))['db'];var encryptor=require(_0xa467('0x6'));var hardware=require(_0xa467('0x7'));var logger=require(_0xa467('0x8'))(_0xa467('0x9'));var HOST=_0xa467('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x5ecc4e){return new BPromise(function(_0x7252f5,_0xfbdd05){var _0x1e632f=util['format'](_0xa467('0xb'),HOST,_0x5ecc4e,module[_0xa467('0xc')][_0xa467('0xd')]);if(oldToken){_0x1e632f=util[_0xa467('0xe')](_0xa467('0xf'),HOST,_0x5ecc4e,module[_0xa467('0xc')]['version'],oldToken);}var _0x1a85fc={'uri':_0x1e632f,'method':_0xa467('0x10'),'timeout':0xea60,'json':!![]};return rp(_0x1a85fc)[_0xa467('0x11')](function(_0x22456b){_0x7252f5(_0x22456b);})['catch'](function(_0x313cc6){_0xfbdd05(_0x313cc6);});});}function manageLicense(_0x1e90bb,_0x562e7c){var _0x402622=_0x562e7c[_0xa467('0x12')]({'plain':!![]});if(!isOldTokenSent&&_0x402622[_0xa467('0x13')]!==_0x1e90bb&&!_0x402622[_0xa467('0x14')]){oldToken=_0x402622[_0xa467('0x13')];}httpRequest(_0x1e90bb)[_0xa467('0x11')](function(_0x25f567){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x25f567[_0xa467('0x15')]){isOldTokenSent=![];if(!_0x402622[_0xa467('0x9')]&&_0x402622[_0xa467('0x9')]!=_0x25f567[_0xa467('0x9')]||_0x402622['license']&&_0x402622['data2']){logger[_0xa467('0x16')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x402622[_0xa467('0x9')]&&!_0x402622[_0xa467('0x14')]&&_0x402622['license']!=_0x25f567[_0xa467('0x9')]){logger[_0xa467('0x16')](_0xa467('0x17'));}if(_0x402622[_0xa467('0x9')]&&!_0x402622[_0xa467('0x14')]&&_0x402622[_0xa467('0x9')]==_0x25f567[_0xa467('0x9')]){return _0x562e7c;}return _0x562e7c[_0xa467('0x18')]({'data1':_0x1e90bb,'data2':null,'license':_0x25f567[_0xa467('0x9')]});}else{if(_0x25f567['license']||_0x402622[_0xa467('0x9')]){if(!_0x402622[_0xa467('0x14')]){if(_0x402622[_0xa467('0x13')]==_0x1e90bb){GRAY_PERIOD_REASON=_0xa467('0x19');logger[_0xa467('0x16')](_0xa467('0x1a'));}else{GRAY_PERIOD_REASON=_0xa467('0x1b');logger[_0xa467('0x16')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x402622[_0xa467('0x13')],_0x1e90bb);}logger[_0xa467('0x16')](_0xa467('0x1c'),GRAY_PERIOD_REASON[_0xa467('0x1d')](),moment()[_0xa467('0xe')](_0xa467('0x1e')));return _0x562e7c[_0xa467('0x18')]({'data2':encryptor[_0xa467('0x1f')](moment()[_0xa467('0xe')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0xa467('0x20')](encryptor['decryptString'](_0x402622['data2']),_0xa467('0x21'))>DAYS){logger['info'](_0xa467('0x22'),moment()[_0xa467('0xe')](_0xa467('0x1e')));isOldTokenSent=![];return _0x562e7c[_0xa467('0x18')]({'data1':_0x1e90bb,'data2':null,'license':null});}}}else{if(_0x402622[_0xa467('0x13')]!=_0x1e90bb){logger[_0xa467('0x16')](_0xa467('0x23'),_0x402622['data1'],_0x1e90bb);return _0x562e7c[_0xa467('0x18')]({'data1':_0x1e90bb,'data2':null,'license':null});}}}return _0x562e7c;})[_0xa467('0x11')](function(_0x256533){_0x562e7c=_0x256533;})[_0xa467('0x24')](function(_0x196b9c){logger['error'](_0x196b9c[_0xa467('0x25')]);})[_0xa467('0x26')](function(){setTimeout(function(){manageLicense(hardware[_0xa467('0x27')](),_0x562e7c);},TIME);});}function defaultLicense(){var _0x36e7f5=hardware['getUuid']();if(_0x36e7f5){return db[_0xa467('0x28')][_0xa467('0x29')]({'where':{'id':0x1},'defaults':{'data1':_0x36e7f5}})['spread'](function(_0x1fb6c6,_0x3b0217){logger[_0xa467('0x16')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x36e7f5);manageLicense(_0x36e7f5,_0x1fb6c6);})[_0xa467('0x24')](function(_0x15b093){logger[_0xa467('0x2a')](_0x15b093[_0xa467('0x25')]);});}}exports[_0xa467('0x2b')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 6999ea4..b311cc3 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 _0x689e=['disabled','message','findAll','role','COUNT','sequelize','col','count','admin','user','users','forEach','pick','countBy','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','demo','uuid','machineUuid','gray','deadline','add','days','grayReason','changed'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x689e,0x1d4));var _0xe689=function(_0x58f644,_0x42efdc){_0x58f644=_0x58f644-0x0;var _0xf9ff14=_0x689e[_0x58f644];return _0xf9ff14;};'use strict';var util=require(_0xe689('0x0'));var _=require(_0xe689('0x1'));var moment=require(_0xe689('0x2'));var BPromise=require(_0xe689('0x3'));var hardware=require(_0xe689('0x4'));var encryptor=require(_0xe689('0x5'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xe689('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xe689('0x7'),'machineUuid':hardware[_0xe689('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xe689('0x9'),'machineUuid':hardware[_0xe689('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0xf6752b){return new BPromise(function(_0x3519b3,_0x537d6e){return db[_0xe689('0xa')][_0xe689('0xb')](_[_0xe689('0xc')](_0xf6752b,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x77cc4f){return checkLicense(_0x77cc4f,null);})[_0xe689('0xd')](function(_0xb371bf){_0x3519b3(_0xb371bf);return;})[_0xe689('0xe')](function(_0x175cca){_0x537d6e(_0x175cca);});});}function checkLicense(_0x2b069e,_0x2bd931){if(!_0x2b069e){demoLicense['uuid']=_0x2b069e[_0xe689('0xf')];return demoLicense;}try{var _0x13ec8d=_0x2bd931||_0x2b069e[_0xe689('0x10')];if(_[_0xe689('0x11')](_0x13ec8d)){throw new Error(_0xe689('0x12'));}var _0x2a7c89=_0x2b069e['data1'];var _0x4371d4=_0x2b069e[_0xe689('0x13')];var _0x571810=_0x2a7c89[_0xe689('0x14')]('-')[0x4];var _0x1a915c=_0x2a7c89[_0xe689('0x14')]('-')[0x0];var _0x290e2f=encryptor[_0xe689('0x15')](_0x13ec8d,util[_0xe689('0x16')]('%s:%s:%s',_0x571810,_0x2a7c89,_0x1a915c));var _0x498806=JSON['parse'](_0x290e2f);_0x498806[_0xe689('0x17')]=![];_0x498806[_0xe689('0x18')]=_0x2a7c89;_0x498806[_0xe689('0x19')]=hardware[_0xe689('0x8')]();if(_0x4371d4){var _0x45a66a=encryptor['decryptString'](_0x4371d4);_0x498806[_0xe689('0x1a')]=_0x45a66a;_0x498806[_0xe689('0x1b')]=moment(_0x45a66a)[_0xe689('0x1c')](0x7,_0xe689('0x1d'))['format']();_0x498806[_0xe689('0x1e')]=_0x498806['uuid']!=_0x498806[_0xe689('0x19')]?_0xe689('0x1f'):_0xe689('0x20');}return _0x498806;}catch(_0x5b9c30){breakingLicense[_0xe689('0x18')]=_0x2b069e[_0xe689('0xf')];breakingLicense[_0xe689('0x21')]=_0x5b9c30[_0xe689('0x21')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x56b5e6,_0x1fb54b){getLicense()[_0xe689('0xd')](function(_0x3bee94){return db['User'][_0xe689('0x22')]({'attributes':[_0xe689('0x23'),[db['sequelize']['fn'](_0xe689('0x24'),db[_0xe689('0x25')][_0xe689('0x26')](_0xe689('0x23'))),_0xe689('0x27')]],'group':_0xe689('0x23'),'where':{'role':{'$or':[_0xe689('0x28'),_0xe689('0x29'),'telephone']}},'raw':!![]})[_0xe689('0xd')](function(_0xa1ac11){var _0x2ef7be={'user':_0x3bee94[_0xe689('0x2a')]||0x0,'telephone':_0x3bee94['telephones']||0x0};_0xa1ac11[_0xe689('0x2b')](function(_0x35dbb9){var _0xa093bf=_0x35dbb9['role']===_0xe689('0x28')?_0xe689('0x29'):_0x35dbb9['role'];_0x2ef7be[_0xa093bf]-=_0x35dbb9[_0xe689('0x27')];if(_0x2ef7be[_0xa093bf]<0x0)_0x2ef7be[_0xa093bf]=0x0;});_0x56b5e6(_0x2ef7be);return;});})[_0xe689('0xe')](function(_0x7611db){_0x1fb54b(_0x7611db);});});}function checkUserLimits(_0xabe478){return new BPromise(function(_0x7e811c,_0x82e202){getLimits()[_0xe689('0xd')](function(_0x14f4ea){var _0x59d637=_[_0xe689('0x2c')](_[_0xe689('0x2d')](_0xabe478,_0xe689('0x23')),[_0xe689('0x28'),_0xe689('0x29'),_0xe689('0x2e')]);var _0x2e8800=(_0x59d637[_0xe689('0x28')]||0x0)+(_0x59d637['user']||0x0);var _0x5ef2cf=_0x59d637[_0xe689('0x2e')]||0x0;if(_0x2e8800>_0x14f4ea[_0xe689('0x29')])return _0x82e202(_0xe689('0x2f'));if(_0x5ef2cf>_0x14f4ea[_0xe689('0x2e')])return _0x82e202(_0xe689('0x30'));return _0x7e811c();})[_0xe689('0xe')](function(_0x300a63){_0x82e202(_0x300a63);});});}module[_0xe689('0x31')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x2fbd=['exports','lodash','moment','bluebird','./hardware','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','defaults','then','catch','uuid','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','decryptString','format','%s:%s:%s','demo','machineUuid','gray','days','changed','disabled','message','User','findAll','role','sequelize','count','user','telephone','users','telephones','forEach','countBy','admin','License\x20limit\x20reached\x20for\x20users'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2fbd,0x7f));var _0xd2fb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x2fbd[_0x2641f9];return _0x585741;};'use strict';var util=require('util');var _=require(_0xd2fb('0x0'));var moment=require(_0xd2fb('0x1'));var BPromise=require(_0xd2fb('0x2'));var hardware=require(_0xd2fb('0x3'));var encryptor=require('../../components/encryptor');var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd2fb('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xd2fb('0x5'),'machineUuid':hardware[_0xd2fb('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd2fb('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xd2fb('0x7'),'machineUuid':hardware[_0xd2fb('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x576a7a){return new BPromise(function(_0x27ca42,_0x2abeeb){return db['License']['find'](_[_0xd2fb('0x8')](_0x576a7a,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x5d52be){return checkLicense(_0x5d52be,null);})[_0xd2fb('0x9')](function(_0x31567d){_0x27ca42(_0x31567d);return;})[_0xd2fb('0xa')](function(_0x47d5b2){_0x2abeeb(_0x47d5b2);});});}function checkLicense(_0x37a1bd,_0x26830a){if(!_0x37a1bd){demoLicense[_0xd2fb('0xb')]=_0x37a1bd['data1'];return demoLicense;}try{var _0x951f8b=_0x26830a||_0x37a1bd[_0xd2fb('0xc')];if(_[_0xd2fb('0xd')](_0x951f8b)){throw new Error(_0xd2fb('0xe'));}var _0x5d374d=_0x37a1bd[_0xd2fb('0xf')];var _0x3a5cd4=_0x37a1bd[_0xd2fb('0x10')];var _0x2b6a5d=_0x5d374d[_0xd2fb('0x11')]('-')[0x4];var _0x25ae8d=_0x5d374d[_0xd2fb('0x11')]('-')[0x0];var _0x25ae95=encryptor[_0xd2fb('0x12')](_0x951f8b,util[_0xd2fb('0x13')](_0xd2fb('0x14'),_0x2b6a5d,_0x5d374d,_0x25ae8d));var _0x375763=JSON['parse'](_0x25ae95);_0x375763[_0xd2fb('0x15')]=![];_0x375763[_0xd2fb('0xb')]=_0x5d374d;_0x375763[_0xd2fb('0x16')]=hardware[_0xd2fb('0x6')]();if(_0x3a5cd4){var _0xd7a013=encryptor[_0xd2fb('0x12')](_0x3a5cd4);_0x375763[_0xd2fb('0x17')]=_0xd7a013;_0x375763['deadline']=moment(_0xd7a013)['add'](0x7,_0xd2fb('0x18'))[_0xd2fb('0x13')]();_0x375763['grayReason']=_0x375763['uuid']!=_0x375763['machineUuid']?_0xd2fb('0x19'):_0xd2fb('0x1a');}return _0x375763;}catch(_0x25d66e){breakingLicense[_0xd2fb('0xb')]=_0x37a1bd['data1'];breakingLicense[_0xd2fb('0x1b')]=_0x25d66e['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2cc50b,_0x42b1a2){getLicense()[_0xd2fb('0x9')](function(_0x252967){return db[_0xd2fb('0x1c')][_0xd2fb('0x1d')]({'attributes':[_0xd2fb('0x1e'),[db[_0xd2fb('0x1f')]['fn']('COUNT',db[_0xd2fb('0x1f')]['col'](_0xd2fb('0x1e'))),_0xd2fb('0x20')]],'group':'role','where':{'role':{'$or':['admin',_0xd2fb('0x21'),_0xd2fb('0x22')]}},'raw':!![]})[_0xd2fb('0x9')](function(_0x4acda2){var _0x238296={'user':_0x252967[_0xd2fb('0x23')]||0x0,'telephone':_0x252967[_0xd2fb('0x24')]||0x0};_0x4acda2[_0xd2fb('0x25')](function(_0x41cbbe){var _0x56096f=_0x41cbbe['role']==='admin'?_0xd2fb('0x21'):_0x41cbbe[_0xd2fb('0x1e')];_0x238296[_0x56096f]-=_0x41cbbe[_0xd2fb('0x20')];if(_0x238296[_0x56096f]<0x0)_0x238296[_0x56096f]=0x0;});_0x2cc50b(_0x238296);return;});})[_0xd2fb('0xa')](function(_0x457497){_0x42b1a2(_0x457497);});});}function checkUserLimits(_0x3b5d2b){return new BPromise(function(_0x50ff90,_0x19bdff){getLimits()[_0xd2fb('0x9')](function(_0x4386f0){var _0xbbd362=_['pick'](_[_0xd2fb('0x26')](_0x3b5d2b,_0xd2fb('0x1e')),[_0xd2fb('0x27'),_0xd2fb('0x21'),_0xd2fb('0x22')]);var _0x49a0c0=(_0xbbd362[_0xd2fb('0x27')]||0x0)+(_0xbbd362[_0xd2fb('0x21')]||0x0);var _0x342bd9=_0xbbd362[_0xd2fb('0x22')]||0x0;if(_0x49a0c0>_0x4386f0[_0xd2fb('0x21')])return _0x19bdff(_0xd2fb('0x28'));if(_0x342bd9>_0x4386f0[_0xd2fb('0x22')])return _0x19bdff('License\x20limit\x20reached\x20for\x20telephones');return _0x50ff90();})[_0xd2fb('0xa')](function(_0x39e365){_0x19bdff(_0x39e365);});});}module[_0xd2fb('0x29')]={'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 bb54f9a..de9bfac 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 _0xcf66=['secret','exports','http://localhost:9000','myappanuglar-secret'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xcf66,0x71));var _0x6cf6=function(_0xebb69,_0x4ab96c){_0xebb69=_0xebb69-0x0;var _0x3072aa=_0xcf66[_0xebb69];return _0x3072aa;};'use strict';module[_0x6cf6('0x0')]={'DOMAIN':_0x6cf6('0x1'),'SESSION_SECRET':_0x6cf6('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0x6cf6('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x8aad=['http://localhost:9000','app-id','exports'];(function(_0x4c5664,_0x170d12){var _0x380651=function(_0x3b3834){while(--_0x3b3834){_0x4c5664['push'](_0x4c5664['shift']());}};_0x380651(++_0x170d12);}(_0x8aad,0x146));var _0xd8aa=function(_0x20e1e5,_0x394cfb){_0x20e1e5=_0x20e1e5-0x0;var _0x53ca5b=_0x8aad[_0x20e1e5];return _0x53ca5b;};'use strict';module[_0xd8aa('0x0')]={'DOMAIN':_0xd8aa('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xd8aa('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 7a8a31f..1c931ab 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdacf=['exports','../utils/loggers','fileLogger'];(function(_0x283893,_0x29604e){var _0xdeb9db=function(_0x2a5d0c){while(--_0x2a5d0c){_0x283893['push'](_0x283893['shift']());}};_0xdeb9db(++_0x29604e);}(_0xdacf,0x70));var _0xfdac=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xdacf[_0x40a045];return _0x1a687c;};'use strict';var fileLogger=require(_0xfdac('0x0'))[_0xfdac('0x1')];module[_0xfdac('0x2')]=fileLogger; \ No newline at end of file +var _0x8020=['../utils/loggers','fileLogger','exports'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x8020,0x11a));var _0x0802=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x8020[_0x550d12];return _0x12103d;};'use strict';var fileLogger=require(_0x0802('0x0'))[_0x0802('0x1')];module[_0x0802('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 6fbe811..de10689 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 _0x2153=['../../services/routing/index.js','xdr','../../services/xdr/index.js','path','../../services/express/index.js','ami','join','agi','../../services/agi/index.js','email','routing'];(function(_0x235338,_0x4ad8cb){var _0x538d19=function(_0x1bc5fd){while(--_0x1bc5fd){_0x235338['push'](_0x235338['shift']());}};_0x538d19(++_0x4ad8cb);}(_0x2153,0x1f2));var _0x3215=function(_0x3b8799,_0x269cf2){_0x3b8799=_0x3b8799-0x0;var _0x9fbc33=_0x2153[_0x3b8799];return _0x9fbc33;};'use strict';var path=require(_0x3215('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path['join'](__dirname,_0x3215('0x1'))},{'name':_0x3215('0x2'),'script':path[_0x3215('0x3')](__dirname,'../../services/ami/index.js')},{'name':_0x3215('0x4'),'script':path[_0x3215('0x3')](__dirname,_0x3215('0x5'))},{'name':_0x3215('0x6'),'script':path['join'](__dirname,'../../services/email/index.js')},{'name':_0x3215('0x7'),'script':path[_0x3215('0x3')](__dirname,_0x3215('0x8'))},{'name':_0x3215('0x9'),'script':path[_0x3215('0x3')](__dirname,_0x3215('0xa'))}]};module['exports']=config; \ No newline at end of file +var _0x3485=['../../services/routing/index.js','xdr','../../services/xdr/index.js','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi'];(function(_0x38b0ce,_0x1ac7a5){var _0x52f0c7=function(_0x43b750){while(--_0x43b750){_0x38b0ce['push'](_0x38b0ce['shift']());}};_0x52f0c7(++_0x1ac7a5);}(_0x3485,0x17f));var _0x5348=function(_0x2dc78c,_0x269456){_0x2dc78c=_0x2dc78c-0x0;var _0x2ac2eb=_0x3485[_0x2dc78c];return _0x2ac2eb;};'use strict';var path=require(_0x5348('0x0'));var os=require('os');var config={'apps':[{'name':_0x5348('0x1'),'script':path[_0x5348('0x2')](__dirname,_0x5348('0x3'))},{'name':_0x5348('0x4'),'script':path['join'](__dirname,_0x5348('0x5'))},{'name':_0x5348('0x6'),'script':path[_0x5348('0x2')](__dirname,'../../services/agi/index.js')},{'name':'email','script':path[_0x5348('0x2')](__dirname,'../../services/email/index.js')},{'name':'routing','script':path['join'](__dirname,_0x5348('0x7'))},{'name':_0x5348('0x8'),'script':path[_0x5348('0x2')](__dirname,_0x5348('0x9'))}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 0cc0e57..e803a25 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 _0x57ab=['start','then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connect','connected'];(function(_0x4afa80,_0x17f511){var _0x435929=function(_0x3f19f0){while(--_0x3f19f0){_0x4afa80['push'](_0x4afa80['shift']());}};_0x435929(++_0x17f511);}(_0x57ab,0x145));var _0xb57a=function(_0x3c4856,_0x98f049){_0x3c4856=_0x3c4856-0x0;var _0xba2cac=_0x57ab[_0x3c4856];return _0xba2cac;};'use strict';var pm2=require(_0xb57a('0x0'));var BPromise=require(_0xb57a('0x1'));var config=require(_0xb57a('0x2'));function connect(){return new BPromise(function(_0x22a6a2,_0x54840e){return pm2[_0xb57a('0x3')](function(_0x41c789){if(_0x41c789){return _0x54840e(_0x41c789);}return _0x22a6a2(_0xb57a('0x4'));});});};exports[_0xb57a('0x5')]=function(_0x2ea2b7){return connect()[_0xb57a('0x6')](function(){return new BPromise(function(_0x3b8a33,_0x2f0c9d){return pm2[_0xb57a('0x5')](_0x2ea2b7,function(_0x58be07,_0x235ca3){if(_0x58be07){return _0x2f0c9d(_0x58be07);}pm2[_0xb57a('0x7')]();return _0x3b8a33(_0x235ca3);});});});};exports['stop']=function(_0x4cf974){return connect()['then'](function(){return new BPromise(function(_0x1441e9,_0x2bca62){return pm2[_0xb57a('0x8')](_0x4cf974,function(_0x1a6dab,_0x458cdd){if(_0x1a6dab){return _0x2bca62(_0x1a6dab);}pm2[_0xb57a('0x7')]();return _0x1441e9(_0x458cdd);});});});};exports[_0xb57a('0x9')]=function(_0x305ada){return connect()['then'](function(){return new BPromise(function(_0x2cab7e,_0x2ab54a){return pm2[_0xb57a('0x9')](_0x305ada,function(_0x248883,_0x44f4bd){if(_0x248883){return _0x2ab54a(_0x248883);}pm2['disconnect']();return _0x2cab7e(_0x44f4bd);});});});};exports[_0xb57a('0xa')]=function(){return connect()[_0xb57a('0x6')](function(){return new BPromise(function(_0x5dae25,_0x3a188c){return pm2[_0xb57a('0xa')](function(_0x3dbbdf,_0x17cd02){if(_0x3dbbdf){return _0x3a188c(_0x3dbbdf);}pm2['disconnect']();return _0x5dae25(_0x17cd02);});});});};exports[_0xb57a('0xb')]=function(_0x1fa7d6){return connect()[_0xb57a('0x6')](function(){return new BPromise(function(_0x114a96,_0x2279a0){return pm2[_0xb57a('0xb')](_0x1fa7d6,function(_0x59e9a1,_0x2e73cc){if(_0x59e9a1){return _0x2279a0(_0x59e9a1);}pm2['disconnect']();return _0x114a96(_0x2e73cc);});});});};exports[_0xb57a('0xc')]=function(_0x288de3){return connect()['then'](function(){return new BPromise(function(_0x1546ee,_0x393934){return pm2[_0xb57a('0xc')](_0x288de3,function(_0xe33458,_0xf5e6ef){if(_0xe33458){return _0x393934(_0xe33458);}pm2[_0xb57a('0x7')]();return _0x1546ee(_0xf5e6ef);});});});};exports[_0xb57a('0xd')]=function(){return connect()['then'](function(){return new BPromise(function(_0x313452,_0x19c8c4){return pm2[_0xb57a('0xd')](function(_0xb5747b){if(_0xb5747b){return _0x19c8c4(_0xb5747b);}return _0x313452(_0xb57a('0xe'));});});});}; \ No newline at end of file +var _0xb280=['saved','pm2','bluebird','connect','connected','start','then','disconnect','stop','restart','list','describe','delete','dump'];(function(_0x45c172,_0x3e7746){var _0x5675ec=function(_0x130826){while(--_0x130826){_0x45c172['push'](_0x45c172['shift']());}};_0x5675ec(++_0x3e7746);}(_0xb280,0x197));var _0x0b28=function(_0x35963f,_0x2880fe){_0x35963f=_0x35963f-0x0;var _0x27d179=_0xb280[_0x35963f];return _0x27d179;};'use strict';var pm2=require(_0x0b28('0x0'));var BPromise=require(_0x0b28('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x1619b3,_0xdabe13){return pm2[_0x0b28('0x2')](function(_0x40fd4d){if(_0x40fd4d){return _0xdabe13(_0x40fd4d);}return _0x1619b3(_0x0b28('0x3'));});});};exports[_0x0b28('0x4')]=function(_0x1b831a){return connect()[_0x0b28('0x5')](function(){return new BPromise(function(_0x428bc3,_0x188a9d){return pm2['start'](_0x1b831a,function(_0x347b08,_0x54a90a){if(_0x347b08){return _0x188a9d(_0x347b08);}pm2[_0x0b28('0x6')]();return _0x428bc3(_0x54a90a);});});});};exports['stop']=function(_0x192477){return connect()['then'](function(){return new BPromise(function(_0x14bd7,_0x74e0ce){return pm2[_0x0b28('0x7')](_0x192477,function(_0x357d65,_0x5e091c){if(_0x357d65){return _0x74e0ce(_0x357d65);}pm2['disconnect']();return _0x14bd7(_0x5e091c);});});});};exports['restart']=function(_0xeefe45){return connect()[_0x0b28('0x5')](function(){return new BPromise(function(_0x11ba26,_0x6967a){return pm2[_0x0b28('0x8')](_0xeefe45,function(_0x3aa833,_0x1dae95){if(_0x3aa833){return _0x6967a(_0x3aa833);}pm2[_0x0b28('0x6')]();return _0x11ba26(_0x1dae95);});});});};exports[_0x0b28('0x9')]=function(){return connect()[_0x0b28('0x5')](function(){return new BPromise(function(_0x17f159,_0x428ff5){return pm2['list'](function(_0x1ee40e,_0x2cbb23){if(_0x1ee40e){return _0x428ff5(_0x1ee40e);}pm2[_0x0b28('0x6')]();return _0x17f159(_0x2cbb23);});});});};exports[_0x0b28('0xa')]=function(_0x198e2d){return connect()[_0x0b28('0x5')](function(){return new BPromise(function(_0x30ca8e,_0x1935bb){return pm2[_0x0b28('0xa')](_0x198e2d,function(_0x5bb37a,_0x35f091){if(_0x5bb37a){return _0x1935bb(_0x5bb37a);}pm2[_0x0b28('0x6')]();return _0x30ca8e(_0x35f091);});});});};exports[_0x0b28('0xb')]=function(_0x29dde2){return connect()['then'](function(){return new BPromise(function(_0x363d5c,_0x5dec81){return pm2[_0x0b28('0xb')](_0x29dde2,function(_0x47ddfa,_0x4a0c5b){if(_0x47ddfa){return _0x5dec81(_0x47ddfa);}pm2[_0x0b28('0x6')]();return _0x363d5c(_0x4a0c5b);});});});};exports[_0x0b28('0xc')]=function(){return connect()[_0x0b28('0x5')](function(){return new BPromise(function(_0x571030,_0x135297){return pm2[_0x0b28('0xc')](function(_0x2e9329){if(_0x2e9329){return _0x135297(_0x2e9329);}return _0x571030(_0x0b28('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 34c74a4..877a78d 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 _0x481d=['../../mysqldb','../logger','schedule','localhost','redis','Setting','find','chatTimeout','then','ChatInteraction','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','chatInteraction:update','catch','error','start','moment','ioredis','util'];(function(_0x123932,_0xd27ea5){var _0x200155=function(_0x241fa4){while(--_0x241fa4){_0x123932['push'](_0x123932['shift']());}};_0x200155(++_0xd27ea5);}(_0x481d,0x1bd));var _0xd481=function(_0x3a4f18,_0x1af741){_0x3a4f18=_0x3a4f18-0x0;var _0x4c20fc=_0x481d[_0x3a4f18];return _0x4c20fc;};'use strict';var _=require('lodash');var moment=require(_0xd481('0x0'));var Redis=require(_0xd481('0x1'));var util=require(_0xd481('0x2'));var config=require('../../config/environment');var db=require(_0xd481('0x3'))['db'];var logger=require(_0xd481('0x4'))(_0xd481('0x5'));config['redis']=_['defaults'](config['redis'],{'host':_0xd481('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd481('0x7')]));function closeInteractions(){var _0x4040b3=0x0;var _0x5f46a1=[];return db[_0xd481('0x8')][_0xd481('0x9')]({'raw':!![],'attributes':['id',_0xd481('0xa')],'where':{'id':0x1}})[_0xd481('0xb')](function(_0x3ae703){_0x4040b3=_0x3ae703[_0xd481('0xa')];if(_0x4040b3){return db[_0xd481('0xc')]['findAll']({'raw':!![],'attributes':['id',_0xd481('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xd481('0xe')](_0x3ae703[_0xd481('0xa')],_0xd481('0xf'))}}});}else{return[];}})['then'](function(_0xc48edf){if(_0xc48edf&&_0xc48edf[_0xd481('0x10')]){_0x5f46a1=_[_0xd481('0x11')](_0xc48edf||[],'id');logger[_0xd481('0x12')](_0xd481('0x13'),_0x5f46a1['join']());return db[_0xd481('0xc')][_0xd481('0x14')]({'closeReason':_0xd481('0x15'),'disposition':_0xd481('0x16'),'closed':!![],'closedAt':moment()[_0xd481('0x17')](_0xd481('0x18'))},{'where':{'id':_0x5f46a1}});}})[_0xd481('0xb')](function(){if(_0x5f46a1&&_0x5f46a1[_0xd481('0x10')]){logger[_0xd481('0x12')](_0xd481('0x19'),_0x5f46a1[_0xd481('0x1a')]());for(var _0x26e2c0=0x0;_0x26e2c0<_0x5f46a1['length'];_0x26e2c0++){io[_0xd481('0x1b')](_0xd481('0x1c'),{'id':_0x5f46a1[_0x26e2c0],'closed':!![]});}}})[_0xd481('0x1d')](function(_0x4e8b7d){logger[_0xd481('0x1e')]('[CHAT]\x20Error\x20closing\x20interactions',_0x4e8b7d?util['inspect'](_0x4e8b7d,{'showHidden':![],'depth':null}):'');});}exports[_0xd481('0x1f')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x44a7=['emit','chatInteraction:update','catch','[CHAT]\x20Error\x20closing\x20interactions','inspect','moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:'];(function(_0x1c7407,_0x4aa2af){var _0x411447=function(_0x20ae02){while(--_0x20ae02){_0x1c7407['push'](_0x1c7407['shift']());}};_0x411447(++_0x4aa2af);}(_0x44a7,0x191));var _0x744a=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x44a7[_0xd09668];return _0x68726;};'use strict';var _=require('lodash');var moment=require(_0x744a('0x0'));var Redis=require(_0x744a('0x1'));var util=require('util');var config=require(_0x744a('0x2'));var db=require(_0x744a('0x3'))['db'];var logger=require(_0x744a('0x4'))(_0x744a('0x5'));config[_0x744a('0x6')]=_['defaults'](config[_0x744a('0x6')],{'host':_0x744a('0x7'),'port':0x18eb});var io=require(_0x744a('0x8'))(new Redis(config[_0x744a('0x6')]));function closeInteractions(){var _0x27a5d0=0x0;var _0x354d7c=[];return db['Setting'][_0x744a('0x9')]({'raw':!![],'attributes':['id',_0x744a('0xa')],'where':{'id':0x1}})[_0x744a('0xb')](function(_0x5c2e09){_0x27a5d0=_0x5c2e09[_0x744a('0xa')];if(_0x27a5d0){return db[_0x744a('0xc')][_0x744a('0xd')]({'raw':!![],'attributes':['id',_0x744a('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x744a('0xf')](_0x5c2e09[_0x744a('0xa')],_0x744a('0x10'))}}});}else{return[];}})['then'](function(_0x41511a){if(_0x41511a&&_0x41511a['length']){_0x354d7c=_[_0x744a('0x11')](_0x41511a||[],'id');logger[_0x744a('0x12')](_0x744a('0x13'),_0x354d7c[_0x744a('0x14')]());return db[_0x744a('0xc')][_0x744a('0x15')]({'closeReason':_0x744a('0x16'),'disposition':_0x744a('0x17'),'closed':!![],'closedAt':moment()[_0x744a('0x18')](_0x744a('0x19'))},{'where':{'id':_0x354d7c}});}})[_0x744a('0xb')](function(){if(_0x354d7c&&_0x354d7c[_0x744a('0x1a')]){logger[_0x744a('0x12')](_0x744a('0x1b'),_0x354d7c[_0x744a('0x14')]());for(var _0x48192e=0x0;_0x48192e<_0x354d7c[_0x744a('0x1a')];_0x48192e++){io[_0x744a('0x1c')](_0x744a('0x1d'),{'id':_0x354d7c[_0x48192e],'closed':!![]});}}})[_0x744a('0x1e')](function(_0x2138a7){logger['error'](_0x744a('0x1f'),_0x2138a7?util[_0x744a('0x20')](_0x2138a7,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 7b60630..230c7e1 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3bc3=['startAllRefreshIntervals','exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x1677a2,_0x2b0755){var _0x357f82=function(_0x2a2fad){while(--_0x2a2fad){_0x1677a2['push'](_0x1677a2['shift']());}};_0x357f82(++_0x2b0755);}(_0x3bc3,0x176));var _0x33bc=function(_0x27d5b3,_0x534c2e){_0x27d5b3=_0x27d5b3-0x0;var _0x169876=_0x3bc3[_0x27d5b3];return _0x169876;};'use strict';function start(){var _0x45c073=require(_0x33bc('0x0'));return _0x45c073[_0x33bc('0x1')]();}module[_0x33bc('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x49ac=['startAllRefreshIntervals','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x447722,_0x10edc7){var _0x28c286=function(_0x1f81df){while(--_0x1f81df){_0x447722['push'](_0x447722['shift']());}};_0x28c286(++_0x10edc7);}(_0x49ac,0xbd));var _0xc49a=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x49ac[_0x35da42];return _0x370035;};'use strict';function start(){var _0x4bb0e7=require(_0xc49a('0x0'));return _0x4bb0e7[_0xc49a('0x1')]();}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 d78f3e0..39d242b 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 _0xa3a0=['subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','status','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','stringify','existsSync','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','SendMail','then','error','email\x20sent','catch','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','toString','keyBy','difference','intersection','length','deleteJob','delete\x20cron','toRun','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','add','start','add\x20cron','exists','endAt','stop\x20cron','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','service','MailAccount','Smtp','host','port','secure','authentication','auth','pass','format','\x22%s\x22\x20<%s>','user','bcc','Report\x20%s\x20last\x20%s\x20%s','name'];(function(_0x5add54,_0x522284){var _0x420dbd=function(_0x404f1a){while(--_0x404f1a){_0x5add54['push'](_0x5add54['shift']());}};_0x420dbd(++_0x522284);}(_0xa3a0,0x19b));var _0x0a3a=function(_0x55b3c9,_0x14d109){_0x55b3c9=_0x55b3c9-0x0;var _0x4dbb6e=_0xa3a0[_0x55b3c9];return _0x4dbb6e;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x0a3a('0x0'));var _=require(_0x0a3a('0x1'));var moment=require(_0x0a3a('0x2'));var CronJobManager=require(_0x0a3a('0x3'));var jayson=require(_0x0a3a('0x4'));var BPromise=require(_0x0a3a('0x5'));var logger=require(_0x0a3a('0x6'))('schedule');var db=require(_0x0a3a('0x7'))['db'];var analyticCustomReportController=require(_0x0a3a('0x8'));var analyticDefaultReportController=require(_0x0a3a('0x9'));var client=jayson['client'][_0x0a3a('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2e222b,_0x59af9e){return function(){logger[_0x0a3a('0xb')](_0x0a3a('0xc'),_0x2e222b[_0x0a3a('0xd')]);var _0x51c511=!![];var _0x1fe7d6={'tls':{'rejectUnauthorized':![]}};if(_0x2e222b['MailAccount']['Smtp'][_0x0a3a('0xe')]){_0x1fe7d6[_0x0a3a('0xe')]=_0x2e222b[_0x0a3a('0xf')][_0x0a3a('0x10')][_0x0a3a('0xe')];}else{_0x1fe7d6[_0x0a3a('0x11')]=_0x2e222b[_0x0a3a('0xf')][_0x0a3a('0x10')]['host'];_0x1fe7d6[_0x0a3a('0x12')]=_0x2e222b[_0x0a3a('0xf')][_0x0a3a('0x10')][_0x0a3a('0x12')];_0x1fe7d6[_0x0a3a('0x13')]=_0x2e222b['MailAccount'][_0x0a3a('0x10')][_0x0a3a('0x13')];}if(_0x2e222b['MailAccount'][_0x0a3a('0x10')][_0x0a3a('0x14')]){_0x1fe7d6[_0x0a3a('0x15')]={'user':_0x2e222b['MailAccount'][_0x0a3a('0x10')]['user'],'pass':_0x2e222b[_0x0a3a('0xf')]['Smtp'][_0x0a3a('0x16')]};}var _0x3fafa6={'account':_0x1fe7d6,'message':{'from':util[_0x0a3a('0x17')](_0x0a3a('0x18'),_0x2e222b['MailAccount']['name'],_0x2e222b[_0x0a3a('0xf')][_0x0a3a('0xd')]||_0x2e222b[_0x0a3a('0xf')]['Smtp'][_0x0a3a('0x19')]),'to':_0x2e222b[_0x0a3a('0xd')],'cc':_0x2e222b['cc'],'bcc':_0x2e222b[_0x0a3a('0x1a')],'subject':util[_0x0a3a('0x17')](_0x0a3a('0x1b'),_0x59af9e[_0x0a3a('0x1c')],_0x2e222b[_0x0a3a('0x1d')],_0x2e222b[_0x0a3a('0x1e')])}};var _0x4f6fcc=path[_0x0a3a('0x1f')](__dirname,_0x0a3a('0x20'));var _0x58d722=_0x59af9e[_0x0a3a('0x21')];var _0x4b4094=util[_0x0a3a('0x17')](_0x0a3a('0x22'),path[_0x0a3a('0x23')](_0x59af9e[_0x0a3a('0x21')],path[_0x0a3a('0x24')](_0x59af9e['savename'])),'zip');var _0x10193b=path[_0x0a3a('0x1f')](_0x4f6fcc,_0x58d722);var _0x71339a=path['join'](_0x4f6fcc,_0x4b4094);if(fs['existsSync'](_0x10193b)){_0x59af9e[_0x0a3a('0x25')]=_0x0a3a('0x26');_0x3fafa6[_0x0a3a('0x27')][_0x0a3a('0x28')]=[{'filename':_0x58d722,'path':_0x10193b}];_0x3fafa6[_0x0a3a('0x27')][_0x0a3a('0x29')]=util['format'](_0x0a3a('0x2a'),JSON[_0x0a3a('0x2b')](_0x59af9e,null,0x2));}else if(fs[_0x0a3a('0x2c')](_0x71339a)){_0x59af9e[_0x0a3a('0x25')]=_0x0a3a('0x26');_0x3fafa6[_0x0a3a('0x27')][_0x0a3a('0x28')]=[{'filename':_0x4b4094,'path':_0x71339a}];}else{_0x3fafa6[_0x0a3a('0x27')][_0x0a3a('0x29')]=_0x0a3a('0x2d');if(!_0x2e222b[_0x0a3a('0x2e')]){_0x51c511=![];logger[_0x0a3a('0xb')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x51c511){return client['request'](_0x0a3a('0x2f'),_0x3fafa6)[_0x0a3a('0x30')](function(_0x3f4928){if(_0x3f4928[_0x0a3a('0x31')]){return logger[_0x0a3a('0x31')]('error\x20mail',JSON[_0x0a3a('0x2b')](_0x3f4928));}return logger[_0x0a3a('0xb')](_0x0a3a('0x32'));})[_0x0a3a('0x33')](function(_0x23b972){return logger[_0x0a3a('0x31')](_0x0a3a('0x34'),JSON[_0x0a3a('0x2b')](_0x23b972));});}};}function handleError(){return function(_0x33828b){return logger[_0x0a3a('0x31')](JSON[_0x0a3a('0x2b')](_0x33828b));};}function handleResult(_0x5d4246){return function(_0x322c10){logger[_0x0a3a('0xb')](_0x0a3a('0x35'),JSON[_0x0a3a('0x2b')](_0x322c10));if(_0x5d4246[_0x0a3a('0xf')]&&_0x5d4246[_0x0a3a('0xf')]['Smtp']&&!_[_0x0a3a('0x36')](_0x5d4246[_0x0a3a('0xd')])){setTimeout(handleSendEmail(_0x5d4246,_0x322c10),0x3c*0x3e8);}};}function handleJob(_0x45ebd0){return function(){try{if(_[_0x0a3a('0x36')](_0x45ebd0['subtractNumber'])){return logger[_0x0a3a('0xb')](_0x0a3a('0x37'));}if(_[_0x0a3a('0x36')](_0x45ebd0[_0x0a3a('0x1e')])){return logger[_0x0a3a('0xb')]('subtractUnit\x20null\x20or\x20undefined');}var _0x1b1291={'startDate':moment()['subtract'](_0x45ebd0[_0x0a3a('0x1d')],_0x45ebd0[_0x0a3a('0x1e')])[_0x0a3a('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format'](_0x0a3a('0x38')),'type':_0x0a3a('0x39'),'output':_0x45ebd0[_0x0a3a('0x3a')],'name':_0x45ebd0[_0x0a3a('0x1c')]};if(!_['isNil'](_0x45ebd0[_0x0a3a('0x3b')])){logger[_0x0a3a('0xb')]('exec\x20defaul\x20report\x20id:%s',_0x45ebd0[_0x0a3a('0x3b')]);return analyticDefaultReportController['runReport']({'id':_0x45ebd0[_0x0a3a('0x3b')]},_0x1b1291)[_0x0a3a('0x30')](handleResult(_0x45ebd0))[_0x0a3a('0x33')](handleError());}if(!_[_0x0a3a('0x36')](_0x45ebd0[_0x0a3a('0x3c')])){logger[_0x0a3a('0xb')](_0x0a3a('0x3d'),_0x45ebd0[_0x0a3a('0x3c')]);return analyticCustomReportController['runReport']({'id':_0x45ebd0[_0x0a3a('0x3c')]},_0x1b1291)['then'](handleResult(_0x45ebd0))[_0x0a3a('0x33')](handleError());}}catch(_0x445ef6){logger[_0x0a3a('0x31')](JSON[_0x0a3a('0x2b')](_0x445ef6));}return logger[_0x0a3a('0xb')](_0x0a3a('0x3e'));};}function getJobs(_0xe2f53e){var _0x536667={};if(_0xe2f53e){_0x536667['id']=_0xe2f53e;}return db[_0x0a3a('0x3f')][_0x0a3a('0x40')]({'where':_0x536667,'include':[{'model':db['MailAccount'],'attributes':['id',_0x0a3a('0x1c'),_0x0a3a('0xd')],'include':[{'model':db[_0x0a3a('0x41')],'as':_0x0a3a('0x10')}]}]})[_0x0a3a('0x30')](function(_0x1008ed){var _0x56ebc8=_[_0x0a3a('0x42')](manager['jobs']);var _0x2f5844=_['map'](_0x1008ed,function(_0x58e8d4){return _0x58e8d4['id'][_0x0a3a('0x43')]();});var _0x12e708=_[_0x0a3a('0x44')](_0x1008ed,function(_0x2cc8c1){return _0x2cc8c1['id'][_0x0a3a('0x43')]();});var _0x51dcc0=_0xe2f53e?_0x2f5844:_[_0x0a3a('0x45')](_0x2f5844,_0x56ebc8);var _0x257b65=_[_0x0a3a('0x46')](_0x2f5844,_0x56ebc8);var _0x82c6f5=_[_0x0a3a('0x45')](_0x56ebc8,_0x2f5844);var _0xa8bfce;var _0x5301a3;for(_0xa8bfce=0x0;_0xa8bfce<_0x82c6f5[_0x0a3a('0x47')]&&!_0xe2f53e;_0xa8bfce+=0x1){_0x5301a3=_0x82c6f5[_0xa8bfce][_0x0a3a('0x43')]();if(manager['exists'](_0x5301a3)){manager['stop'](_0x5301a3);manager[_0x0a3a('0x48')](_0x5301a3);logger[_0x0a3a('0xb')](_0x0a3a('0x49'),_0x5301a3);}}logger[_0x0a3a('0xb')](_0x0a3a('0x4a'),JSON[_0x0a3a('0x2b')](_0x51dcc0));for(_0xa8bfce=0x0;_0xa8bfce<_0x51dcc0['length'];_0xa8bfce+=0x1){_0x5301a3=_0x51dcc0[_0xa8bfce][_0x0a3a('0x43')]();logger[_0x0a3a('0xb')]('index',_0x5301a3);if(_0xe2f53e){logger['info'](_0x0a3a('0x4b'),_0xe2f53e);logger[_0x0a3a('0xb')](JSON[_0x0a3a('0x2b')](_0x12e708[_0x5301a3]));BPromise[_0x0a3a('0x4c')]()[_0x0a3a('0x30')](handleJob(_0x12e708[_0x5301a3]));logger[_0x0a3a('0xb')](_0x0a3a('0x4d'),_0x12e708[_0x5301a3]['name'],_0x12e708[_0x5301a3][_0x0a3a('0x4e')]);}else if(_0x12e708[_0x5301a3][_0x0a3a('0x4e')]&&_0x12e708[_0x5301a3][_0x0a3a('0x4f')]&&moment()[_0x0a3a('0x50')](_0x12e708[_0x5301a3][_0x0a3a('0x51')],_0x12e708[_0x5301a3]['endAt'])){manager[_0x0a3a('0x52')](_0x5301a3,_0x12e708[_0x5301a3][_0x0a3a('0x4e')],handleJob(_0x12e708[_0x5301a3]));manager[_0x0a3a('0x53')](_0x5301a3);logger[_0x0a3a('0xb')](_0x0a3a('0x54'),_0x12e708[_0x5301a3][_0x0a3a('0x1c')],_0x12e708[_0x5301a3]['cron']);}else if(manager[_0x0a3a('0x55')](_0x5301a3)){manager['stop'](_0x5301a3);manager['deleteJob'](_0x5301a3);logger[_0x0a3a('0xb')]('stop\x20cron',_0x12e708[_0x5301a3][_0x0a3a('0x1c')],_0x12e708[_0x5301a3]['cron']);}}for(_0xa8bfce=0x0,_0x5301a3;_0xa8bfce<_0x257b65['length']&&!_0xe2f53e;_0xa8bfce+=0x1){_0x5301a3=_0x257b65[_0xa8bfce][_0x0a3a('0x43')]();if(manager[_0x0a3a('0x55')](_0x5301a3)){if(_0x12e708[_0x5301a3][_0x0a3a('0x4e')]&&_0x12e708[_0x5301a3][_0x0a3a('0x4f')]&&moment()[_0x0a3a('0x50')](_0x12e708[_0x5301a3][_0x0a3a('0x51')],_0x12e708[_0x5301a3][_0x0a3a('0x56')])){manager['update'](_0x5301a3,_0x12e708[_0x5301a3][_0x0a3a('0x4e')],handleJob(_0x12e708[_0x5301a3]));logger[_0x0a3a('0xb')]('update\x20cron',_0x12e708[_0x5301a3][_0x0a3a('0x1c')],_0x12e708[_0x5301a3]['cron']);}else{manager['stop'](_0x5301a3);manager[_0x0a3a('0x48')](_0x5301a3);logger[_0x0a3a('0xb')](_0x0a3a('0x57'),_0x12e708[_0x5301a3]['name'],_0x12e708[_0x5301a3][_0x0a3a('0x4e')]);}}}})['catch'](function(_0x4c4933){logger[_0x0a3a('0x31')](JSON['stringify'](_0x4c4933));});}exports['run']=function(_0x8e1cf2){return getJobs(_0x8e1cf2);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x9e4f=['run\x20job','cron','active','isBetween','startAt','endAt','add','stop\x20cron','update','deleteJob','run','start','util','path','lodash','moment','cron-job-manager','jayson/promise','../logger','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','service','Smtp','host','port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','subtractUnit','join','../../files/reports','%s.%s','savename','extname','existsSync','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','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','SendMail','then','error','stringify','email\x20sent','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','runReport','DefaultReportId','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','MailServerOut','keys','jobs','toString','keyBy','difference','intersection','length','exists','stop','delete\x20cron','toRun','index','my\x20id'];(function(_0x349367,_0x1cede2){var _0x14179b=function(_0x38a191){while(--_0x38a191){_0x349367['push'](_0x349367['shift']());}};_0x14179b(++_0x1cede2);}(_0x9e4f,0x168));var _0xf9e4=function(_0x1a4930,_0x39ec85){_0x1a4930=_0x1a4930-0x0;var _0x3e982e=_0x9e4f[_0x1a4930];return _0x3e982e;};'use strict';var fs=require('fs');var util=require(_0xf9e4('0x0'));var path=require(_0xf9e4('0x1'));var _=require(_0xf9e4('0x2'));var moment=require(_0xf9e4('0x3'));var CronJobManager=require(_0xf9e4('0x4'));var jayson=require(_0xf9e4('0x5'));var BPromise=require('bluebird');var logger=require(_0xf9e4('0x6'))('schedule');var db=require('../../mysqldb')['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xf9e4('0x7')][_0xf9e4('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4e99f0,_0xfc194c){return function(){logger[_0xf9e4('0x9')](_0xf9e4('0xa'),_0x4e99f0[_0xf9e4('0xb')]);var _0x1eafff=!![];var _0x265008={'tls':{'rejectUnauthorized':![]}};if(_0x4e99f0[_0xf9e4('0xc')]['Smtp'][_0xf9e4('0xd')]){_0x265008[_0xf9e4('0xd')]=_0x4e99f0[_0xf9e4('0xc')][_0xf9e4('0xe')][_0xf9e4('0xd')];}else{_0x265008[_0xf9e4('0xf')]=_0x4e99f0[_0xf9e4('0xc')][_0xf9e4('0xe')][_0xf9e4('0xf')];_0x265008['port']=_0x4e99f0[_0xf9e4('0xc')][_0xf9e4('0xe')][_0xf9e4('0x10')];_0x265008[_0xf9e4('0x11')]=_0x4e99f0[_0xf9e4('0xc')]['Smtp'][_0xf9e4('0x11')];}if(_0x4e99f0['MailAccount']['Smtp'][_0xf9e4('0x12')]){_0x265008[_0xf9e4('0x13')]={'user':_0x4e99f0['MailAccount']['Smtp'][_0xf9e4('0x14')],'pass':_0x4e99f0[_0xf9e4('0xc')][_0xf9e4('0xe')][_0xf9e4('0x15')]};}var _0x4b94db={'account':_0x265008,'message':{'from':util[_0xf9e4('0x16')](_0xf9e4('0x17'),_0x4e99f0[_0xf9e4('0xc')]['name'],_0x4e99f0[_0xf9e4('0xc')]['email']||_0x4e99f0[_0xf9e4('0xc')][_0xf9e4('0xe')][_0xf9e4('0x14')]),'to':_0x4e99f0[_0xf9e4('0xb')],'cc':_0x4e99f0['cc'],'bcc':_0x4e99f0[_0xf9e4('0x18')],'subject':util[_0xf9e4('0x16')](_0xf9e4('0x19'),_0xfc194c[_0xf9e4('0x1a')],_0x4e99f0[_0xf9e4('0x1b')],_0x4e99f0[_0xf9e4('0x1c')])}};var _0x300879=path[_0xf9e4('0x1d')](__dirname,_0xf9e4('0x1e'));var _0x4163e8=_0xfc194c['savename'];var _0x2cf187=util[_0xf9e4('0x16')](_0xf9e4('0x1f'),path['basename'](_0xfc194c[_0xf9e4('0x20')],path[_0xf9e4('0x21')](_0xfc194c[_0xf9e4('0x20')])),'zip');var _0xca419=path[_0xf9e4('0x1d')](_0x300879,_0x4163e8);var _0x4791f5=path[_0xf9e4('0x1d')](_0x300879,_0x2cf187);if(fs[_0xf9e4('0x22')](_0xca419)){_0xfc194c['status']='Sent';_0x4b94db['message'][_0xf9e4('0x23')]=[{'filename':_0x4163e8,'path':_0xca419}];_0x4b94db[_0xf9e4('0x24')][_0xf9e4('0x25')]=util['format'](_0xf9e4('0x26'),JSON['stringify'](_0xfc194c,null,0x2));}else if(fs[_0xf9e4('0x22')](_0x4791f5)){_0xfc194c['status']=_0xf9e4('0x27');_0x4b94db[_0xf9e4('0x24')][_0xf9e4('0x23')]=[{'filename':_0x2cf187,'path':_0x4791f5}];}else{_0x4b94db[_0xf9e4('0x24')][_0xf9e4('0x25')]=_0xf9e4('0x28');if(!_0x4e99f0[_0xf9e4('0x29')]){_0x1eafff=![];logger[_0xf9e4('0x9')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x1eafff){return client[_0xf9e4('0x2a')](_0xf9e4('0x2b'),_0x4b94db)[_0xf9e4('0x2c')](function(_0x59b9ca){if(_0x59b9ca[_0xf9e4('0x2d')]){return logger['error']('error\x20mail',JSON[_0xf9e4('0x2e')](_0x59b9ca));}return logger['info'](_0xf9e4('0x2f'));})['catch'](function(_0x106679){return logger[_0xf9e4('0x2d')]('error\x20mail',JSON['stringify'](_0x106679));});}};}function handleError(){return function(_0x5d5af4){return logger[_0xf9e4('0x2d')](JSON['stringify'](_0x5d5af4));};}function handleResult(_0xd6f0){return function(_0x4a635a){logger[_0xf9e4('0x9')]('data',JSON[_0xf9e4('0x2e')](_0x4a635a));if(_0xd6f0[_0xf9e4('0xc')]&&_0xd6f0[_0xf9e4('0xc')][_0xf9e4('0xe')]&&!_[_0xf9e4('0x30')](_0xd6f0[_0xf9e4('0xb')])){setTimeout(handleSendEmail(_0xd6f0,_0x4a635a),0x3c*0x3e8);}};}function handleJob(_0x153d3b){return function(){try{if(_[_0xf9e4('0x30')](_0x153d3b[_0xf9e4('0x1b')])){return logger[_0xf9e4('0x9')](_0xf9e4('0x31'));}if(_['isNil'](_0x153d3b[_0xf9e4('0x1c')])){return logger[_0xf9e4('0x9')](_0xf9e4('0x32'));}var _0x2e9998={'startDate':moment()['subtract'](_0x153d3b[_0xf9e4('0x1b')],_0x153d3b[_0xf9e4('0x1c')])[_0xf9e4('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xf9e4('0x16')](_0xf9e4('0x33')),'type':_0xf9e4('0x34'),'output':_0x153d3b[_0xf9e4('0x35')],'name':_0x153d3b[_0xf9e4('0x1a')]};if(!_[_0xf9e4('0x30')](_0x153d3b['DefaultReportId'])){logger[_0xf9e4('0x9')](_0xf9e4('0x36'),_0x153d3b['DefaultReportId']);return analyticDefaultReportController[_0xf9e4('0x37')]({'id':_0x153d3b[_0xf9e4('0x38')]},_0x2e9998)[_0xf9e4('0x2c')](handleResult(_0x153d3b))[_0xf9e4('0x39')](handleError());}if(!_[_0xf9e4('0x30')](_0x153d3b[_0xf9e4('0x3a')])){logger[_0xf9e4('0x9')](_0xf9e4('0x3b'),_0x153d3b[_0xf9e4('0x3a')]);return analyticCustomReportController[_0xf9e4('0x37')]({'id':_0x153d3b[_0xf9e4('0x3a')]},_0x2e9998)['then'](handleResult(_0x153d3b))[_0xf9e4('0x39')](handleError());}}catch(_0x4b7397){logger[_0xf9e4('0x2d')](JSON['stringify'](_0x4b7397));}return logger[_0xf9e4('0x9')](_0xf9e4('0x3c'));};}function getJobs(_0x531a7c){var _0x197cfe={};if(_0x531a7c){_0x197cfe['id']=_0x531a7c;}return db['Schedule']['findAll']({'where':_0x197cfe,'include':[{'model':db[_0xf9e4('0xc')],'attributes':['id',_0xf9e4('0x1a'),_0xf9e4('0xb')],'include':[{'model':db[_0xf9e4('0x3d')],'as':_0xf9e4('0xe')}]}]})['then'](function(_0x554873){var _0x48950c=_[_0xf9e4('0x3e')](manager[_0xf9e4('0x3f')]);var _0xf8d414=_['map'](_0x554873,function(_0x33b528){return _0x33b528['id'][_0xf9e4('0x40')]();});var _0x21bc63=_[_0xf9e4('0x41')](_0x554873,function(_0x4bab92){return _0x4bab92['id'][_0xf9e4('0x40')]();});var _0x538450=_0x531a7c?_0xf8d414:_[_0xf9e4('0x42')](_0xf8d414,_0x48950c);var _0x356e42=_[_0xf9e4('0x43')](_0xf8d414,_0x48950c);var _0x2e1000=_['difference'](_0x48950c,_0xf8d414);var _0x583b43;var _0x3f2122;for(_0x583b43=0x0;_0x583b43<_0x2e1000[_0xf9e4('0x44')]&&!_0x531a7c;_0x583b43+=0x1){_0x3f2122=_0x2e1000[_0x583b43][_0xf9e4('0x40')]();if(manager[_0xf9e4('0x45')](_0x3f2122)){manager[_0xf9e4('0x46')](_0x3f2122);manager['deleteJob'](_0x3f2122);logger[_0xf9e4('0x9')](_0xf9e4('0x47'),_0x3f2122);}}logger[_0xf9e4('0x9')](_0xf9e4('0x48'),JSON['stringify'](_0x538450));for(_0x583b43=0x0;_0x583b43<_0x538450[_0xf9e4('0x44')];_0x583b43+=0x1){_0x3f2122=_0x538450[_0x583b43]['toString']();logger[_0xf9e4('0x9')](_0xf9e4('0x49'),_0x3f2122);if(_0x531a7c){logger[_0xf9e4('0x9')](_0xf9e4('0x4a'),_0x531a7c);logger[_0xf9e4('0x9')](JSON[_0xf9e4('0x2e')](_0x21bc63[_0x3f2122]));BPromise['resolve']()['then'](handleJob(_0x21bc63[_0x3f2122]));logger['info'](_0xf9e4('0x4b'),_0x21bc63[_0x3f2122][_0xf9e4('0x1a')],_0x21bc63[_0x3f2122][_0xf9e4('0x4c')]);}else if(_0x21bc63[_0x3f2122][_0xf9e4('0x4c')]&&_0x21bc63[_0x3f2122][_0xf9e4('0x4d')]&&moment()[_0xf9e4('0x4e')](_0x21bc63[_0x3f2122][_0xf9e4('0x4f')],_0x21bc63[_0x3f2122][_0xf9e4('0x50')])){manager[_0xf9e4('0x51')](_0x3f2122,_0x21bc63[_0x3f2122]['cron'],handleJob(_0x21bc63[_0x3f2122]));manager['start'](_0x3f2122);logger[_0xf9e4('0x9')]('add\x20cron',_0x21bc63[_0x3f2122][_0xf9e4('0x1a')],_0x21bc63[_0x3f2122][_0xf9e4('0x4c')]);}else if(manager['exists'](_0x3f2122)){manager[_0xf9e4('0x46')](_0x3f2122);manager['deleteJob'](_0x3f2122);logger[_0xf9e4('0x9')](_0xf9e4('0x52'),_0x21bc63[_0x3f2122][_0xf9e4('0x1a')],_0x21bc63[_0x3f2122][_0xf9e4('0x4c')]);}}for(_0x583b43=0x0,_0x3f2122;_0x583b43<_0x356e42[_0xf9e4('0x44')]&&!_0x531a7c;_0x583b43+=0x1){_0x3f2122=_0x356e42[_0x583b43][_0xf9e4('0x40')]();if(manager[_0xf9e4('0x45')](_0x3f2122)){if(_0x21bc63[_0x3f2122][_0xf9e4('0x4c')]&&_0x21bc63[_0x3f2122][_0xf9e4('0x4d')]&&moment()[_0xf9e4('0x4e')](_0x21bc63[_0x3f2122][_0xf9e4('0x4f')],_0x21bc63[_0x3f2122][_0xf9e4('0x50')])){manager[_0xf9e4('0x53')](_0x3f2122,_0x21bc63[_0x3f2122][_0xf9e4('0x4c')],handleJob(_0x21bc63[_0x3f2122]));logger[_0xf9e4('0x9')]('update\x20cron',_0x21bc63[_0x3f2122][_0xf9e4('0x1a')],_0x21bc63[_0x3f2122][_0xf9e4('0x4c')]);}else{manager[_0xf9e4('0x46')](_0x3f2122);manager[_0xf9e4('0x54')](_0x3f2122);logger[_0xf9e4('0x9')]('stop\x20cron',_0x21bc63[_0x3f2122]['name'],_0x21bc63[_0x3f2122][_0xf9e4('0x4c')]);}}}})[_0xf9e4('0x39')](function(_0x266a91){logger[_0xf9e4('0x2d')](JSON[_0xf9e4('0x2e')](_0x266a91));});}exports[_0xf9e4('0x55')]=function(_0x4600e4){return getJobs(_0x4600e4);};exports[_0xf9e4('0x56')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index eb270a1..cacb8cb 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 _0x7af2=['start','aws-sdk','request-promise','util','bluebird','../../config/logger','transcribe','getTranscriptionJob','Comprehend','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','TranscriptionJobStatus','fileText','COMPLETED','TranscriptionJob','TranscriptFileUri','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Negative','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','tempSentiment','Sentiment','Mixed','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','Setting','transcribeAccountId','Transcribe\x20not\x20configured','push','all'];(function(_0x2b86d1,_0x581096){var _0x1bd3f4=function(_0x1e977f){while(--_0x1e977f){_0x2b86d1['push'](_0x2b86d1['shift']());}};_0x1bd3f4(++_0x581096);}(_0x7af2,0x119));var _0x27af=function(_0x159706,_0x2a4f3b){_0x159706=_0x159706-0x0;var _0x5699ef=_0x7af2[_0x159706];return _0x5699ef;};var _=require('lodash');var AWS=require(_0x27af('0x0'));var rp=require(_0x27af('0x1'));var util=require(_0x27af('0x2'));var BPromise=require(_0x27af('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x27af('0x4'))(_0x27af('0x5'));function getTranscriptionJob(_0x709cb6,_0x2a542f,_0x22ae46,_0x418f21){return new Promise(function(_0x350532,_0x184630){var _0x2193c6=new AWS['TranscribeService']({'accessKeyId':_0x2a542f,'secretAccessKey':_0x709cb6,'region':_0x22ae46});_0x2193c6[_0x27af('0x6')]({'TranscriptionJobName':_0x418f21},function(_0x366868,_0x389e97){if(_0x366868){return _0x184630(_0x366868);}else{return _0x350532(_0x389e97);}});});}function sentiment(_0x583db8,_0x369a20,_0xfa1882,_0x5841aa,_0x4e27bf){return new Promise(function(_0x1617c0,_0x582a9e){var _0x4d4729=new AWS[(_0x27af('0x7'))]({'accessKeyId':_0x369a20,'secretAccessKey':_0x583db8,'region':_0xfa1882});_0x4d4729['detectSentiment']({'Text':_0x5841aa,'LanguageCode':_0x4e27bf['substring'](0x0,0x2)},function(_0x184e25,_0x59c073){if(_0x184e25){return _0x582a9e(_0x184e25);}else{return _0x1617c0(_0x59c073);}});});}function checkTranscribeJob(_0x45e212,_0x49a883,_0x406340){var _0x203501;return new BPromise(function(_0x1fd964,_0x23f9ec){logger[_0x27af('0x8')](util[_0x27af('0x9')](_0x27af('0xa'),_0x45e212['id'],_0x45e212[_0x27af('0xb')]));return getTranscriptionJob(_0x406340[_0x27af('0xc')],_0x406340[_0x27af('0xd')],_0x49a883[_0x27af('0xe')],_0x45e212[_0x27af('0xb')])[_0x27af('0xf')](function(_0x3102c4){logger[_0x27af('0x8')](util[_0x27af('0x9')](_0x27af('0x10'),_0x45e212['id'],_0x45e212[_0x27af('0xb')],_0x3102c4['TranscriptionJob'][_0x27af('0x11')]));if(!_0x45e212[_0x27af('0x12')]){switch(_0x3102c4['TranscriptionJob']['TranscriptionJobStatus']){case _0x27af('0x13'):var _0x478572={'transcribeStatus':_0x3102c4[_0x27af('0x14')][_0x27af('0x11')],'fileUri':_0x3102c4[_0x27af('0x14')]['Transcript'][_0x27af('0x15')]};logger[_0x27af('0x8')](util[_0x27af('0x9')]('[RECORDING:%d]\x20Get\x20transcript',_0x45e212['id']));return rp({'uri':_0x3102c4[_0x27af('0x14')][_0x27af('0x16')][_0x27af('0x15')],'json':!![]})['then'](function(_0x2dce2b){logger[_0x27af('0x8')](util[_0x27af('0x9')](_0x27af('0x17'),_0x45e212['id']));if(_0x2dce2b&&_0x2dce2b[_0x27af('0x18')]&&_0x2dce2b[_0x27af('0x18')][_0x27af('0x19')]&&_0x2dce2b[_0x27af('0x18')][_0x27af('0x19')]['length']){_0x478572['fileText']='';for(var _0x4b8fe6=0x0;_0x4b8fe6<_0x2dce2b[_0x27af('0x18')]['transcripts'][_0x27af('0x1a')];_0x4b8fe6++){_0x478572[_0x27af('0x12')]+=_0x2dce2b['results'][_0x27af('0x19')][_0x4b8fe6][_0x27af('0x1b')]+'';}}return _0x45e212[_0x27af('0x1c')](_0x478572);})[_0x27af('0xf')](function(){logger[_0x27af('0x8')](util[_0x27af('0x9')](_0x27af('0x1d'),_0x45e212['id']));if(!_0x45e212['tempSentiment']){throw new db[(_0x27af('0x1e'))][(_0x27af('0x1f'))](_0x27af('0x20'));}if(!_0x49a883[_0x27af('0x21')]||!_0x49a883[_0x27af('0x22')]||!_0x49a883[_0x27af('0x23')]||!_0x49a883[_0x27af('0x24')]||!_0x49a883[_0x27af('0x25')]){throw new db[(_0x27af('0x1e'))][(_0x27af('0x1f'))](_0x27af('0x26'));}if(!_0x478572['fileText']){throw new Error(_0x27af('0x27'));}if(_0x49a883[_0x27af('0x22')]===_0x406340['id']){return _0x406340;}else{return db[_0x27af('0x28')][_0x27af('0x29')]({'where':{'id':_settings[_0x27af('0x22')]}});}})[_0x27af('0xf')](function(_0x5349cd){if(!_0x5349cd){throw new db['Sequelize'][(_0x27af('0x1f'))](_0x27af('0x2a'));}if(!_0x5349cd['data1']||!_0x5349cd[_0x27af('0xd')]){throw new db[(_0x27af('0x1e'))][(_0x27af('0x1f'))](_0x27af('0x2b'));}_0x203501=_0x5349cd;logger[_0x27af('0x8')](util[_0x27af('0x9')](_0x27af('0x2c'),_0x45e212['id']));return sentiment(_0x203501[_0x27af('0xc')],_0x203501[_0x27af('0xd')],_0x49a883[_0x27af('0x23')],_0x478572[_0x27af('0x12')],_0x49a883['language']);})['then'](function(_0x1de1d0){logger[_0x27af('0x8')](util['format'](_0x27af('0x2d'),_0x45e212['id']));return _0x45e212[_0x27af('0x1c')]({'sentiment':_0x1de1d0['Sentiment'],'sPositive':_0x1de1d0[_0x27af('0x2e')][_0x27af('0x2f')],'sNegative':_0x1de1d0[_0x27af('0x2e')][_0x27af('0x30')],'sMixed':_0x1de1d0[_0x27af('0x2e')]['Mixed'],'sNeutral':_0x1de1d0[_0x27af('0x2e')][_0x27af('0x31')]});})['then'](function(){logger['info'](util[_0x27af('0x9')](_0x27af('0x1d'),_0x45e212['id']));_0x1fd964();});case _0x27af('0x32'):return _0x45e212[_0x27af('0x1c')]({'transcribeStatus':_0x27af('0x32'),'failureReason':_0x3102c4[_0x27af('0x14')]['FailureReason']})[_0x27af('0xf')](function(){logger['info'](util[_0x27af('0x9')](_0x27af('0x1d'),_0x45e212['id']));_0x1fd964();});default:logger[_0x27af('0x8')](util[_0x27af('0x9')](_0x27af('0x33'),_0x45e212['id']));break;}}else{return BPromise['resolve']()[_0x27af('0xf')](function(){if(!_0x45e212[_0x27af('0x34')]){throw new db[(_0x27af('0x1e'))][(_0x27af('0x1f'))](_0x27af('0x20'));}if(!_0x49a883[_0x27af('0x21')]||!_0x49a883[_0x27af('0x22')]||!_0x49a883[_0x27af('0x23')]||!_0x49a883[_0x27af('0x24')]||!_0x49a883[_0x27af('0x25')]){throw new db[(_0x27af('0x1e'))][(_0x27af('0x1f'))](_0x27af('0x26'));}if(!_0x45e212[_0x27af('0x12')]){throw new Error('Transcript\x20not\x20available');}if(_0x49a883[_0x27af('0x22')]===_0x406340['id']){return _0x406340;}else{return db[_0x27af('0x28')][_0x27af('0x29')]({'where':{'id':_settings[_0x27af('0x22')]}});}})['then'](function(_0x134819){if(!_0x134819){throw new db['Sequelize']['ValidationError'](_0x27af('0x2a'));}if(!_0x134819[_0x27af('0xc')]||!_0x134819[_0x27af('0xd')]){throw new db[(_0x27af('0x1e'))][(_0x27af('0x1f'))](_0x27af('0x2b'));}_0x203501=_0x134819;logger[_0x27af('0x8')](util[_0x27af('0x9')](_0x27af('0x2c'),_0x45e212['id']));return sentiment(_0x203501[_0x27af('0xc')],_0x203501[_0x27af('0xd')],_0x49a883[_0x27af('0x23')],_0x45e212['fileText'],_0x49a883[_0x27af('0x24')]);})[_0x27af('0xf')](function(_0x527a36){logger['info'](util[_0x27af('0x9')](_0x27af('0x2d'),_0x45e212['id']));return _0x45e212[_0x27af('0x1c')]({'sentiment':_0x527a36[_0x27af('0x35')],'sPositive':_0x527a36[_0x27af('0x2e')]['Positive'],'sNegative':_0x527a36[_0x27af('0x2e')]['Negative'],'sMixed':_0x527a36[_0x27af('0x2e')][_0x27af('0x36')],'sNeutral':_0x527a36[_0x27af('0x2e')][_0x27af('0x31')],'transcribeStatus':_0x27af('0x13')});})[_0x27af('0xf')](function(){logger[_0x27af('0x8')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x45e212['id']));_0x1fd964();});}})[_0x27af('0x37')](function(_0x5ce06e){if(_0x5ce06e){if(!_0x5ce06e[_0x27af('0x38')]||_0x5ce06e[_0x27af('0x38')]!==_0x27af('0x39')){logger[_0x27af('0x3a')](util[_0x27af('0x9')](_0x27af('0x3b'),_0x45e212['id']),util[_0x27af('0x3c')](_0x5ce06e,{'showHidden':![],'depth':null}));}}_0x1fd964();});});}function checkTranscribe(){var _0x5d4e9e;var _0x3fdf3b;var _0xc7e2a8;return db[_0x27af('0x3d')][_0x27af('0x3e')]({'where':{'transcribeStatus':_0x27af('0x3f')}})['then'](function(_0x2b7f9d){if(!_0x2b7f9d||!_0x2b7f9d[_0x27af('0x1a')]){throw new db[(_0x27af('0x1e'))]['ValidationError']('No\x20transcribe\x20job\x20to\x20check');}_0x5d4e9e=_0x2b7f9d;return db[_0x27af('0x40')][_0x27af('0x29')]({'where':{'id':0x1}});})[_0x27af('0xf')](function(_0x5be44f){if(!_0x5be44f){throw new db['Sequelize'][(_0x27af('0x1f'))]('Settings\x20not\x20available');}_0x3fdf3b=_0x5be44f;if(!_0x3fdf3b[_0x27af('0x5')]||!_0x3fdf3b[_0x27af('0x41')]||!_0x3fdf3b[_0x27af('0xe')]||!_0x3fdf3b[_0x27af('0x24')]||!_0x3fdf3b[_0x27af('0x25')]){throw new db[(_0x27af('0x1e'))][(_0x27af('0x1f'))](_0x27af('0x42'));}return db[_0x27af('0x28')][_0x27af('0x29')]({'where':{'id':_0x3fdf3b[_0x27af('0x41')]}});})['then'](function(_0x76ed78){if(!_0x76ed78){throw new db[(_0x27af('0x1e'))][(_0x27af('0x1f'))](_0x27af('0x2a'));}if(!_0x76ed78[_0x27af('0xc')]||!_0x76ed78[_0x27af('0xd')]){throw new db[(_0x27af('0x1e'))][(_0x27af('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0xc7e2a8=_0x76ed78;var _0x2e7b34=[];_0x5d4e9e['forEach'](function(_0x424dff){_0x2e7b34[_0x27af('0x43')](checkTranscribeJob(_0x424dff,_0x3fdf3b,_0xc7e2a8));});return BPromise[_0x27af('0x44')](_0x2e7b34);})['catch'](function(_0x44a21e){if(_0x44a21e){if(!_0x44a21e['name']||_0x44a21e[_0x27af('0x38')]!==_0x27af('0x39')){logger[_0x27af('0x3a')](util['inspect'](_0x44a21e,{'showHidden':![],'depth':null}));}}});}exports[_0x27af('0x45')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x1516=['data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Mixed','Neutral','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','Sentiment','Negative','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','forEach','start','lodash','aws-sdk','request-promise','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','COMPLETED','TranscriptionJobStatus','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available'];(function(_0x5ea5db,_0x5d65d8){var _0xbec763=function(_0x2f7d52){while(--_0x2f7d52){_0x5ea5db['push'](_0x5ea5db['shift']());}};_0xbec763(++_0x5d65d8);}(_0x1516,0xb0));var _0x6151=function(_0x2c64ba,_0x5a5044){_0x2c64ba=_0x2c64ba-0x0;var _0x48b472=_0x1516[_0x2c64ba];return _0x48b472;};var _=require(_0x6151('0x0'));var AWS=require(_0x6151('0x1'));var rp=require(_0x6151('0x2'));var util=require('util');var BPromise=require(_0x6151('0x3'));var db=require(_0x6151('0x4'))['db'];var logger=require(_0x6151('0x5'))(_0x6151('0x6'));function getTranscriptionJob(_0x122679,_0x59bdaf,_0x198e1d,_0x52ab35){return new Promise(function(_0x69f924,_0x2585cd){var _0x319164=new AWS[(_0x6151('0x7'))]({'accessKeyId':_0x59bdaf,'secretAccessKey':_0x122679,'region':_0x198e1d});_0x319164[_0x6151('0x8')]({'TranscriptionJobName':_0x52ab35},function(_0x43513c,_0x44cc85){if(_0x43513c){return _0x2585cd(_0x43513c);}else{return _0x69f924(_0x44cc85);}});});}function sentiment(_0x2dfed8,_0x6349d9,_0x5c5b55,_0x5d2278,_0x13c0a8){return new Promise(function(_0x22ff2d,_0xb9019b){var _0x469a87=new AWS[(_0x6151('0x9'))]({'accessKeyId':_0x6349d9,'secretAccessKey':_0x2dfed8,'region':_0x5c5b55});_0x469a87[_0x6151('0xa')]({'Text':_0x5d2278,'LanguageCode':_0x13c0a8[_0x6151('0xb')](0x0,0x2)},function(_0x181946,_0x8306aa){if(_0x181946){return _0xb9019b(_0x181946);}else{return _0x22ff2d(_0x8306aa);}});});}function checkTranscribeJob(_0x573f0f,_0x55b225,_0x314156){var _0xb88b77;return new BPromise(function(_0x219873,_0x5752bb){logger[_0x6151('0xc')](util[_0x6151('0xd')](_0x6151('0xe'),_0x573f0f['id'],_0x573f0f[_0x6151('0xf')]));return getTranscriptionJob(_0x314156['data1'],_0x314156[_0x6151('0x10')],_0x55b225['transcribeRegion'],_0x573f0f[_0x6151('0xf')])[_0x6151('0x11')](function(_0x34d111){logger[_0x6151('0xc')](util[_0x6151('0xd')](_0x6151('0x12'),_0x573f0f['id'],_0x573f0f[_0x6151('0xf')],_0x34d111[_0x6151('0x13')]['TranscriptionJobStatus']));if(!_0x573f0f[_0x6151('0x14')]){switch(_0x34d111[_0x6151('0x13')]['TranscriptionJobStatus']){case _0x6151('0x15'):var _0x24bfbd={'transcribeStatus':_0x34d111[_0x6151('0x13')][_0x6151('0x16')],'fileUri':_0x34d111[_0x6151('0x13')][_0x6151('0x17')][_0x6151('0x18')]};logger[_0x6151('0xc')](util[_0x6151('0xd')](_0x6151('0x19'),_0x573f0f['id']));return rp({'uri':_0x34d111[_0x6151('0x13')][_0x6151('0x17')][_0x6151('0x18')],'json':!![]})[_0x6151('0x11')](function(_0x452035){logger['info'](util[_0x6151('0xd')](_0x6151('0x1a'),_0x573f0f['id']));if(_0x452035&&_0x452035['results']&&_0x452035[_0x6151('0x1b')][_0x6151('0x1c')]&&_0x452035[_0x6151('0x1b')]['transcripts'][_0x6151('0x1d')]){_0x24bfbd[_0x6151('0x14')]='';for(var _0x4810dd=0x0;_0x4810dd<_0x452035[_0x6151('0x1b')][_0x6151('0x1c')][_0x6151('0x1d')];_0x4810dd++){_0x24bfbd[_0x6151('0x14')]+=_0x452035['results'][_0x6151('0x1c')][_0x4810dd][_0x6151('0x1e')]+'';}}return _0x573f0f[_0x6151('0x1f')](_0x24bfbd);})[_0x6151('0x11')](function(){logger['info'](util[_0x6151('0xd')](_0x6151('0x20'),_0x573f0f['id']));if(!_0x573f0f[_0x6151('0x21')]){throw new db['Sequelize'][(_0x6151('0x22'))](_0x6151('0x23'));}if(!_0x55b225['sentiment']||!_0x55b225[_0x6151('0x24')]||!_0x55b225[_0x6151('0x25')]||!_0x55b225[_0x6151('0x26')]||!_0x55b225[_0x6151('0x27')]){throw new db[(_0x6151('0x28'))][(_0x6151('0x22'))](_0x6151('0x29'));}if(!_0x24bfbd[_0x6151('0x14')]){throw new Error(_0x6151('0x2a'));}if(_0x55b225[_0x6151('0x24')]===_0x314156['id']){return _0x314156;}else{return db[_0x6151('0x2b')][_0x6151('0x2c')]({'where':{'id':_settings[_0x6151('0x24')]}});}})[_0x6151('0x11')](function(_0x459970){if(!_0x459970){throw new db[(_0x6151('0x28'))][(_0x6151('0x22'))](_0x6151('0x2d'));}if(!_0x459970[_0x6151('0x2e')]||!_0x459970[_0x6151('0x10')]){throw new db[(_0x6151('0x28'))]['ValidationError'](_0x6151('0x2f'));}_0xb88b77=_0x459970;logger['info'](util[_0x6151('0xd')](_0x6151('0x30'),_0x573f0f['id']));return sentiment(_0xb88b77['data1'],_0xb88b77[_0x6151('0x10')],_0x55b225['sentimentRegion'],_0x24bfbd[_0x6151('0x14')],_0x55b225[_0x6151('0x26')]);})[_0x6151('0x11')](function(_0x4525f9){logger['info'](util[_0x6151('0xd')](_0x6151('0x31'),_0x573f0f['id']));return _0x573f0f[_0x6151('0x1f')]({'sentiment':_0x4525f9['Sentiment'],'sPositive':_0x4525f9[_0x6151('0x32')][_0x6151('0x33')],'sNegative':_0x4525f9[_0x6151('0x32')]['Negative'],'sMixed':_0x4525f9[_0x6151('0x32')][_0x6151('0x34')],'sNeutral':_0x4525f9['SentimentScore'][_0x6151('0x35')]});})[_0x6151('0x11')](function(){logger[_0x6151('0xc')](util[_0x6151('0xd')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x573f0f['id']));_0x219873();});case'FAILED':return _0x573f0f[_0x6151('0x1f')]({'transcribeStatus':'FAILED','failureReason':_0x34d111[_0x6151('0x13')][_0x6151('0x36')]})[_0x6151('0x11')](function(){logger[_0x6151('0xc')](util[_0x6151('0xd')](_0x6151('0x20'),_0x573f0f['id']));_0x219873();});default:logger['info'](util[_0x6151('0xd')](_0x6151('0x37'),_0x573f0f['id']));break;}}else{return BPromise[_0x6151('0x38')]()[_0x6151('0x11')](function(){if(!_0x573f0f[_0x6151('0x21')]){throw new db[(_0x6151('0x28'))][(_0x6151('0x22'))](_0x6151('0x23'));}if(!_0x55b225[_0x6151('0x39')]||!_0x55b225[_0x6151('0x24')]||!_0x55b225[_0x6151('0x25')]||!_0x55b225['language']||!_0x55b225['bucket']){throw new db[(_0x6151('0x28'))][(_0x6151('0x22'))](_0x6151('0x29'));}if(!_0x573f0f[_0x6151('0x14')]){throw new Error(_0x6151('0x2a'));}if(_0x55b225['sentimentAccountId']===_0x314156['id']){return _0x314156;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0x6151('0x11')](function(_0x10513a){if(!_0x10513a){throw new db[(_0x6151('0x28'))][(_0x6151('0x22'))](_0x6151('0x2d'));}if(!_0x10513a[_0x6151('0x2e')]||!_0x10513a[_0x6151('0x10')]){throw new db['Sequelize'][(_0x6151('0x22'))](_0x6151('0x2f'));}_0xb88b77=_0x10513a;logger[_0x6151('0xc')](util[_0x6151('0xd')](_0x6151('0x30'),_0x573f0f['id']));return sentiment(_0xb88b77[_0x6151('0x2e')],_0xb88b77['data2'],_0x55b225[_0x6151('0x25')],_0x573f0f['fileText'],_0x55b225[_0x6151('0x26')]);})[_0x6151('0x11')](function(_0x554118){logger[_0x6151('0xc')](util['format'](_0x6151('0x31'),_0x573f0f['id']));return _0x573f0f['update']({'sentiment':_0x554118[_0x6151('0x3a')],'sPositive':_0x554118[_0x6151('0x32')][_0x6151('0x33')],'sNegative':_0x554118[_0x6151('0x32')][_0x6151('0x3b')],'sMixed':_0x554118['SentimentScore']['Mixed'],'sNeutral':_0x554118[_0x6151('0x32')][_0x6151('0x35')],'transcribeStatus':_0x6151('0x15')});})[_0x6151('0x11')](function(){logger['info'](util[_0x6151('0xd')](_0x6151('0x20'),_0x573f0f['id']));_0x219873();});}})[_0x6151('0x3c')](function(_0x172911){if(_0x172911){if(!_0x172911[_0x6151('0x3d')]||_0x172911[_0x6151('0x3d')]!==_0x6151('0x3e')){logger[_0x6151('0x3f')](util[_0x6151('0xd')](_0x6151('0x40'),_0x573f0f['id']),util[_0x6151('0x41')](_0x172911,{'showHidden':![],'depth':null}));}}_0x219873();});});}function checkTranscribe(){var _0x301791;var _0x2fcc9d;var _0x599f3a;return db['VoiceRecording']['findAll']({'where':{'transcribeStatus':_0x6151('0x42')}})[_0x6151('0x11')](function(_0x42c441){if(!_0x42c441||!_0x42c441[_0x6151('0x1d')]){throw new db[(_0x6151('0x28'))][(_0x6151('0x22'))]('No\x20transcribe\x20job\x20to\x20check');}_0x301791=_0x42c441;return db[_0x6151('0x43')][_0x6151('0x2c')]({'where':{'id':0x1}});})[_0x6151('0x11')](function(_0x45d5aa){if(!_0x45d5aa){throw new db['Sequelize'][(_0x6151('0x22'))](_0x6151('0x44'));}_0x2fcc9d=_0x45d5aa;if(!_0x2fcc9d['transcribe']||!_0x2fcc9d[_0x6151('0x45')]||!_0x2fcc9d[_0x6151('0x46')]||!_0x2fcc9d[_0x6151('0x26')]||!_0x2fcc9d[_0x6151('0x27')]){throw new db[(_0x6151('0x28'))][(_0x6151('0x22'))](_0x6151('0x47'));}return db[_0x6151('0x2b')][_0x6151('0x2c')]({'where':{'id':_0x2fcc9d[_0x6151('0x45')]}});})['then'](function(_0x552622){if(!_0x552622){throw new db[(_0x6151('0x28'))][(_0x6151('0x22'))](_0x6151('0x2d'));}if(!_0x552622[_0x6151('0x2e')]||!_0x552622[_0x6151('0x10')]){throw new db['Sequelize'][(_0x6151('0x22'))](_0x6151('0x2f'));}_0x599f3a=_0x552622;var _0x10bb54=[];_0x301791[_0x6151('0x48')](function(_0x408d6e){_0x10bb54['push'](checkTranscribeJob(_0x408d6e,_0x2fcc9d,_0x599f3a));});return BPromise['all'](_0x10bb54);})[_0x6151('0x3c')](function(_0xefd27){if(_0xefd27){if(!_0xefd27[_0x6151('0x3d')]||_0xefd27[_0x6151('0x3d')]!==_0x6151('0x3e')){logger['error'](util['inspect'](_0xefd27,{'showHidden':![],'depth':null}));}}});}exports[_0x6151('0x49')]=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 b9eb61c..4bf0255 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 _0x0d59=['socket.io-emitter','redis','WhatsappInteraction','lastMsgAt','subtract','hours','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','defaults','localhost'];(function(_0xfebe36,_0x4ec3be){var _0x5aee6c=function(_0x52aa65){while(--_0x52aa65){_0xfebe36['push'](_0xfebe36['shift']());}};_0x5aee6c(++_0x4ec3be);}(_0x0d59,0x1e6));var _0x90d5=function(_0x593752,_0xfc3827){_0x593752=_0x593752-0x0;var _0x4612be=_0x0d59[_0x593752];return _0x4612be;};'use strict';var _=require('lodash');var moment=require(_0x90d5('0x0'));var Redis=require(_0x90d5('0x1'));var util=require(_0x90d5('0x2'));var config=require(_0x90d5('0x3'));var db=require(_0x90d5('0x4'))['db'];var logger=require(_0x90d5('0x5'))(_0x90d5('0x6'));config['redis']=_[_0x90d5('0x7')](config['redis'],{'host':_0x90d5('0x8'),'port':0x18eb});var io=require(_0x90d5('0x9'))(new Redis(config[_0x90d5('0xa')]));function closeInteractions(){var _0x576282=[];return db[_0x90d5('0xb')]['findAll']({'raw':!![],'attributes':['id',_0x90d5('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x90d5('0xd')](0x18,_0x90d5('0xe'))}}})[_0x90d5('0xf')](function(_0x9296e2){if(_0x9296e2&&_0x9296e2[_0x90d5('0x10')]){_0x576282=_[_0x90d5('0x11')](_0x9296e2||[],'id');logger['info'](_0x90d5('0x12'),_0x576282[_0x90d5('0x13')]());return db['WhatsappInteraction'][_0x90d5('0x14')]({'closeReason':_0x90d5('0x15'),'disposition':_0x90d5('0x16'),'closed':!![],'closedAt':moment()[_0x90d5('0x17')](_0x90d5('0x18'))},{'where':{'id':_0x576282}});}})[_0x90d5('0xf')](function(){if(_0x576282&&_0x576282[_0x90d5('0x10')]){logger[_0x90d5('0x19')](_0x90d5('0x1a'),_0x576282[_0x90d5('0x13')]());for(var _0x43534e=0x0;_0x43534e<_0x576282[_0x90d5('0x10')];_0x43534e++){io[_0x90d5('0x1b')](_0x90d5('0x1c'),{'id':_0x576282[_0x43534e],'closed':!![]});}}})[_0x90d5('0x1d')](function(_0x5da393){logger[_0x90d5('0x1e')](_0x90d5('0x1f'),_0x5da393?util[_0x90d5('0x20')](_0x5da393,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x37c2=['join','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','../../config/environment','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','format'];(function(_0x1d4640,_0x1d6de1){var _0x138775=function(_0x1b1c9d){while(--_0x1b1c9d){_0x1d4640['push'](_0x1d4640['shift']());}};_0x138775(++_0x1d6de1);}(_0x37c2,0x129));var _0x237c=function(_0x5938a6,_0x2d5b61){_0x5938a6=_0x5938a6-0x0;var _0x507cc4=_0x37c2[_0x5938a6];return _0x507cc4;};'use strict';var _=require(_0x237c('0x0'));var moment=require(_0x237c('0x1'));var Redis=require(_0x237c('0x2'));var util=require(_0x237c('0x3'));var config=require(_0x237c('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x237c('0x5'))(_0x237c('0x6'));config[_0x237c('0x7')]=_[_0x237c('0x8')](config['redis'],{'host':_0x237c('0x9'),'port':0x18eb});var io=require(_0x237c('0xa'))(new Redis(config[_0x237c('0x7')]));function closeInteractions(){var _0x39facb=[];return db[_0x237c('0xb')][_0x237c('0xc')]({'raw':!![],'attributes':['id',_0x237c('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x237c('0xe')](0x18,_0x237c('0xf'))}}})[_0x237c('0x10')](function(_0x3f0841){if(_0x3f0841&&_0x3f0841[_0x237c('0x11')]){_0x39facb=_[_0x237c('0x12')](_0x3f0841||[],'id');logger[_0x237c('0x13')](_0x237c('0x14'),_0x39facb['join']());return db[_0x237c('0xb')]['update']({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0x237c('0x15')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x39facb}});}})[_0x237c('0x10')](function(){if(_0x39facb&&_0x39facb[_0x237c('0x11')]){logger[_0x237c('0x13')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x39facb[_0x237c('0x16')]());for(var _0x205d5f=0x0;_0x205d5f<_0x39facb[_0x237c('0x11')];_0x205d5f++){io[_0x237c('0x17')](_0x237c('0x18'),{'id':_0x39facb[_0x205d5f],'closed':!![]});}}})[_0x237c('0x19')](function(_0x5b9358){logger[_0x237c('0x1a')](_0x237c('0x1b'),_0x5b9358?util[_0x237c('0x1c')](_0x5b9358,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 9cef9df..6008038 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd941=['push','CmContact','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','destroy','contacts2','catch','../mysqldb','Innocenzo','Biondo','@xcally.com','now'];(function(_0x19ac6e,_0x435862){var _0x1cdcf3=function(_0x23151c){while(--_0x23151c){_0x19ac6e['push'](_0x19ac6e['shift']());}};_0x1cdcf3(++_0x435862);}(_0xd941,0x1ab));var _0x1d94=function(_0x4327fe,_0x4f8040){_0x4327fe=_0x4327fe-0x0;var _0x138651=_0xd941[_0x4327fe];return _0x138651;};'use strict';var util=require('util');var db=require(_0x1d94('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x1d94('0x1')+i,'lastName':_0x1d94('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x1d94('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'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[_0x1d94('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x1d94('0x5')]({'id':i,'firstName':_0x1d94('0x1')+i,'lastName':_0x1d94('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x1d94('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x1d94('0x5')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x1d94('0x4')](),'updatedAt':Date[_0x1d94('0x4')]()});}db[_0x1d94('0x6')]['destroy']({'where':{}})[_0x1d94('0x7')](function(){return db[_0x1d94('0x6')][_0x1d94('0x8')](contacts);})[_0x1d94('0x7')](function(){console[_0x1d94('0x9')](_0x1d94('0xa'),_0x1d94('0xb'));return db[_0x1d94('0xc')][_0x1d94('0xd')]({'where':{}});})['then'](function(){return db[_0x1d94('0xc')][_0x1d94('0x8')](hopper);})[_0x1d94('0x7')](function(){console[_0x1d94('0x9')](_0x1d94('0xa'),'hopper1');return db[_0x1d94('0x6')][_0x1d94('0x8')](contacts2);})['then'](function(){console[_0x1d94('0x9')]('finished\x20populating',_0x1d94('0xe'));return db[_0x1d94('0xc')]['bulkCreate'](hopper2);})[_0x1d94('0x7')](function(){console[_0x1d94('0x9')]('finished\x20populating','hopper2');})[_0x1d94('0xf')](function(_0x391037){console[_0x1d94('0x9')](_0x391037);}); \ No newline at end of file +var _0x28dc=['../mysqldb','push','Innocenzo','innocenzo.biondo','@xcally.com','now','Biondo','CmContact','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2','catch','util'];(function(_0x9d1180,_0x2f71fb){var _0x155274=function(_0x1867c1){while(--_0x1867c1){_0x9d1180['push'](_0x9d1180['shift']());}};_0x155274(++_0x2f71fb);}(_0x28dc,0xe3));var _0xc28d=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x28dc[_0x3c8e9a];return _0x2d4c57;};'use strict';var util=require(_0xc28d('0x0'));var db=require(_0xc28d('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xc28d('0x2')]({'id':i,'firstName':_0xc28d('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xc28d('0x4')+i+_0xc28d('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xc28d('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xc28d('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xc28d('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xc28d('0x3')+i,'lastName':_0xc28d('0x7')+i,'phone':0xf879fb460+i,'email':_0xc28d('0x4')+i+_0xc28d('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xc28d('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xc28d('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc28d('0x6')](),'updatedAt':Date['now']()});}db[_0xc28d('0x8')]['destroy']({'where':{}})[_0xc28d('0x9')](function(){return db[_0xc28d('0x8')][_0xc28d('0xa')](contacts);})[_0xc28d('0x9')](function(){console[_0xc28d('0xb')](_0xc28d('0xc'),_0xc28d('0xd'));return db[_0xc28d('0xe')]['destroy']({'where':{}});})[_0xc28d('0x9')](function(){return db[_0xc28d('0xe')][_0xc28d('0xa')](hopper);})[_0xc28d('0x9')](function(){console[_0xc28d('0xb')](_0xc28d('0xc'),_0xc28d('0xf'));return db[_0xc28d('0x8')]['bulkCreate'](contacts2);})['then'](function(){console['log'](_0xc28d('0xc'),_0xc28d('0x10'));return db['CmHopper'][_0xc28d('0xa')](hopper2);})[_0xc28d('0x9')](function(){console[_0xc28d('0xb')](_0xc28d('0xc'),_0xc28d('0x11'));})[_0xc28d('0x12')](function(_0x5c71fb){console['log'](_0x5c71fb);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 3eafd7b..850dc63 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa3f1=['\x22%s\x22\x20<%s>','User','bulkCreate','add\x20user','catch','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','wss','all','ulaw','yes','actpass'];(function(_0x342773,_0x386fd7){var _0x4f023e=function(_0x4d50f5){while(--_0x4d50f5){_0x342773['push'](_0x342773['shift']());}};_0x4f023e(++_0x386fd7);}(_0xa3f1,0x16a));var _0x1a3f=function(_0x3af484,_0x254f36){_0x3af484=_0x3af484-0x0;var _0x55bcf3=_0xa3f1[_0x3af484];return _0x55bcf3;};'use strict';var util=require('util');var db=require(_0x1a3f('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x1a3f('0x1')]({'name':util[_0x1a3f('0x2')](_0x1a3f('0x3'),_0x1a3f('0x4'),i),'fullname':util['format'](_0x1a3f('0x3'),_0x1a3f('0x4'),i),'email':util[_0x1a3f('0x2')](_0x1a3f('0x5'),_0x1a3f('0x4'),i),'role':_0x1a3f('0x4'),'password':_0x1a3f('0x6'),'internal':0xfa0+i,'type':'friend','transport':['udp','ws',_0x1a3f('0x7')],'disallow':[_0x1a3f('0x8')],'allow':[_0x1a3f('0x9')],'defaultuser':util[_0x1a3f('0x2')](_0x1a3f('0x3'),'agent',i),'encryption':'yes','avpf':_0x1a3f('0xa'),'force_avp':'yes','icesupport':'yes','dtlsenable':_0x1a3f('0xa'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x1a3f('0xb'),'callerid':util['format'](_0x1a3f('0xc'),util[_0x1a3f('0x2')](_0x1a3f('0x3'),'agent',i),0xfa0+i)});}db[_0x1a3f('0xd')][_0x1a3f('0xe')](users)['then'](function(){console['log'](_0x1a3f('0xf'));})[_0x1a3f('0x10')](function(_0x17a604){console['log'](_0x17a604);}); \ No newline at end of file +var _0xc5da=['actpass','\x22%s\x22\x20<%s>','bulkCreate','then','add\x20user','catch','log','util','../mysqldb','push','format','agent','%s%s','%s%s@xcally.com','password','friend','wss','yes','/etc/pki/tls/private/motion.key'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc5da,0x124));var _0xac5d=function(_0x6c4ac0,_0x2d4d5f){_0x6c4ac0=_0x6c4ac0-0x0;var _0x1800e9=_0xc5da[_0x6c4ac0];return _0x1800e9;};'use strict';var util=require(_0xac5d('0x0'));var db=require(_0xac5d('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xac5d('0x2')]({'name':util[_0xac5d('0x3')]('%s%s',_0xac5d('0x4'),i),'fullname':util[_0xac5d('0x3')](_0xac5d('0x5'),'agent',i),'email':util['format'](_0xac5d('0x6'),'agent',i),'role':'agent','password':_0xac5d('0x7'),'internal':0xfa0+i,'type':_0xac5d('0x8'),'transport':['udp','ws',_0xac5d('0x9')],'disallow':['all'],'allow':['ulaw'],'defaultuser':util[_0xac5d('0x3')](_0xac5d('0x5'),_0xac5d('0x4'),i),'encryption':_0xac5d('0xa'),'avpf':_0xac5d('0xa'),'force_avp':'yes','icesupport':_0xac5d('0xa'),'dtlsenable':_0xac5d('0xa'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xac5d('0xb'),'dtlssetup':_0xac5d('0xc'),'callerid':util[_0xac5d('0x3')](_0xac5d('0xd'),util[_0xac5d('0x3')](_0xac5d('0x5'),_0xac5d('0x4'),i),0xfa0+i)});}db['User'][_0xac5d('0xe')](users)[_0xac5d('0xf')](function(){console['log'](_0xac5d('0x10'));})[_0xac5d('0x11')](function(_0x47337f){console[_0xac5d('0x12')](_0x47337f);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 3af12ea..03ae11d 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcdc2=['mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','map','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','disconnect','DISCONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','type','ivr','findOne','autoAssociation','ChatQueues','FaxQueues','SmsQueues','findAll','Trunks','IvrCampaigns','resourceId','then','where','telephone','%s:queue:%s','length','format','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','MailQueue','WhatsappQueue','Campaign','user','VoiceQueue','SmsQueue','MailQueues','OpenchannelQueue','WhatsappQueues','Telephones','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','chat','fax','sms'];(function(_0x54ad4c,_0x2ec6ab){var _0x530e00=function(_0x40c850){while(--_0x40c850){_0x54ad4c['push'](_0x54ad4c['shift']());}};_0x530e00(++_0x2ec6ab);}(_0xcdc2,0x19d));var _0x2cdc=function(_0x525790,_0x4785f6){_0x525790=_0x525790-0x0;var _0x3f0df2=_0xcdc2[_0x525790];return _0x3f0df2;};'use strict';var _=require(_0x2cdc('0x0'));var util=require(_0x2cdc('0x1'));var BPromise=require(_0x2cdc('0x2'));var db=require(_0x2cdc('0x3'))['db'];var config=require(_0x2cdc('0x4'));var queryQueues={'attributes':['id',_0x2cdc('0x5')],'include':[{'as':_0x2cdc('0x6'),'model':db[_0x2cdc('0x7')],'attributes':['id',_0x2cdc('0x5'),_0x2cdc('0x8')],'raw':!![],'where':{'role':_0x2cdc('0x9')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x2cdc('0x5')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x2cdc('0x5')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x2cdc('0x5'),_0x2cdc('0xa')],'where':{'type':_0x2cdc('0xb')}};function getAssociatedResources(_0x4a0bac,_0x185996,_0x51e6e7){return db['UserProfileSection'][_0x2cdc('0xc')]({'where':{'name':_0x4a0bac,'userProfileId':_0x185996},'raw':!![]})['then'](function(_0x4d162d){if(_0x4d162d){if(_0x4d162d[_0x2cdc('0xd')]){switch(_0x4a0bac){case'VoiceQueues':case _0x2cdc('0xe'):case _0x2cdc('0xf'):case _0x2cdc('0x10'):case'MailQueues':case'OpenchannelQueues':case'WhatsappQueues':return db[_0x51e6e7]['findAll'](queryQueues);case'Telephones':return db[_0x51e6e7][_0x2cdc('0x11')](queryTelephones);case _0x2cdc('0x12'):return db[_0x51e6e7][_0x2cdc('0x11')](queryTrunks);case _0x2cdc('0x13'):return db[_0x51e6e7]['findAll'](queryCampaigns);}}else{return db['UserProfileResource'][_0x2cdc('0x11')]({'attributes':[_0x2cdc('0x14')],'where':{'sectionId':_0x4d162d['id']},'raw':!![]})[_0x2cdc('0x15')](function(_0x3715be){if(_0x3715be){var _0x590fb4={'where':{'id':_['map'](_0x3715be,_0x2cdc('0x14'))},'raw':!![]};switch(_0x51e6e7){case _0x2cdc('0x7'):_0x590fb4[_0x2cdc('0x16')][_0x2cdc('0x8')]=_0x2cdc('0x17');break;case'Campaign':_0x590fb4[_0x2cdc('0x16')][_0x2cdc('0xa')]='ivr';break;}return db[_0x51e6e7][_0x2cdc('0x11')](_0x590fb4);}else{return[];}});}}else{return[];}})[_0x2cdc('0x15')](function(_0x3bb39d){return _0x3bb39d;});}function joinOrLeaveQueues(_0xa33fe6,_0x41e8bb,_0x302baa,_0x5a9316){_0xa33fe6[_0x41e8bb](util['format'](_0x2cdc('0x18'),_0x302baa,_0x5a9316['name']));if(_0x5a9316['Agents']){for(var _0x3ff658=0x0;_0x3ff658<_0x5a9316[_0x2cdc('0x6')][_0x2cdc('0x19')];_0x3ff658+=0x1){_0xa33fe6[_0x41e8bb](util[_0x2cdc('0x1a')](_0x2cdc('0x1b'),_0x5a9316[_0x2cdc('0x6')][_0x3ff658]['name']));}}}function joinOrLeave(_0x4a17b4,_0x19f1d6,_0x2ea200){var _0x4bdb4d;if(_0x4a17b4[_0x2cdc('0x1c')][_0x2cdc('0x1d')]['id']){db[_0x2cdc('0x7')][_0x2cdc('0x1e')]({'attributes':['id',_0x2cdc('0x5'),'role',_0x2cdc('0x1f')],'where':{'id':_0x4a17b4[_0x2cdc('0x1c')][_0x2cdc('0x1d')]['id']},'include':[{'model':db[_0x2cdc('0x20')],'as':_0x2cdc('0x21'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x2cdc('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x2cdc('0x23')],'as':_0x2cdc('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x2cdc('0x25')],'as':_0x2cdc('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x2cdc('0x27')],'as':_0x2cdc('0x28'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x154761){if(_0x154761){_0x4bdb4d=_0x154761;_0x4a17b4[_0x19f1d6](util['format'](_0x2cdc('0x1b'),_0x154761['name']));var _0x5cca2c=[];switch(_0x154761[_0x2cdc('0x8')]){case _0x2cdc('0x29'):_0x4a17b4[_0x19f1d6](_0x2cdc('0x2a'));_0x4a17b4[_0x19f1d6](_0x2cdc('0x2b'));if(queryQueues[_0x2cdc('0x2c')](_0x2cdc('0x2d'))){delete queryQueues['include'];}_0x5cca2c[_0x2cdc('0x2e')](db['VoiceQueue'][_0x2cdc('0x11')](queryQueues));_0x5cca2c['push'](db[_0x2cdc('0x2f')][_0x2cdc('0x11')](queryQueues));_0x5cca2c[_0x2cdc('0x2e')](db['FaxQueue'][_0x2cdc('0x11')](queryQueues));_0x5cca2c[_0x2cdc('0x2e')](db['SmsQueue']['findAll'](queryQueues));_0x5cca2c['push'](db[_0x2cdc('0x30')][_0x2cdc('0x11')](queryQueues));_0x5cca2c[_0x2cdc('0x2e')](db['OpenchannelQueue'][_0x2cdc('0x11')](queryQueues));_0x5cca2c['push'](db[_0x2cdc('0x31')][_0x2cdc('0x11')](queryQueues));_0x5cca2c['push'](db[_0x2cdc('0x7')][_0x2cdc('0x11')](queryTelephones));_0x5cca2c[_0x2cdc('0x2e')](db['Trunk'][_0x2cdc('0x11')](queryTrunks));_0x5cca2c['push'](db[_0x2cdc('0x32')][_0x2cdc('0x11')](queryCampaigns));_0x5cca2c[_0x2cdc('0x2e')](db[_0x2cdc('0x7')]['findAll'](queryAgents));break;case _0x2cdc('0x33'):_0x4a17b4[_0x19f1d6]('voice:inbound');_0x4a17b4[_0x19f1d6](_0x2cdc('0x2b'));_0x5cca2c['push'](getAssociatedResources('VoiceQueues',_0x154761[_0x2cdc('0x1f')],_0x2cdc('0x34')));_0x5cca2c[_0x2cdc('0x2e')](getAssociatedResources(_0x2cdc('0xe'),_0x154761[_0x2cdc('0x1f')],_0x2cdc('0x2f')));_0x5cca2c[_0x2cdc('0x2e')](getAssociatedResources('FaxQueues',_0x154761[_0x2cdc('0x1f')],'FaxQueue'));_0x5cca2c[_0x2cdc('0x2e')](getAssociatedResources(_0x2cdc('0x10'),_0x154761['userProfileId'],_0x2cdc('0x35')));_0x5cca2c[_0x2cdc('0x2e')](getAssociatedResources(_0x2cdc('0x36'),_0x154761[_0x2cdc('0x1f')],_0x2cdc('0x30')));_0x5cca2c[_0x2cdc('0x2e')](getAssociatedResources('OpenchannelQueues',_0x154761['userProfileId'],_0x2cdc('0x37')));_0x5cca2c['push'](getAssociatedResources(_0x2cdc('0x38'),_0x154761[_0x2cdc('0x1f')],_0x2cdc('0x31')));_0x5cca2c[_0x2cdc('0x2e')](getAssociatedResources(_0x2cdc('0x39'),_0x154761[_0x2cdc('0x1f')],_0x2cdc('0x7')));_0x5cca2c[_0x2cdc('0x2e')](getAssociatedResources('Trunks',_0x154761[_0x2cdc('0x1f')],'Trunk'));_0x5cca2c[_0x2cdc('0x2e')](getAssociatedResources(_0x2cdc('0x13'),_0x154761['userProfileId'],'Campaign'));_0x5cca2c[_0x2cdc('0x2e')](db['User'][_0x2cdc('0x11')](queryAgents));break;case'agent':_0x4a17b4[_0x19f1d6](_0x2cdc('0x2a'));_0x4a17b4[_0x19f1d6](_0x2cdc('0x2b'));_0x5cca2c[_0x2cdc('0x2e')](_0x154761['getVoiceQueues']({'attributes':['id',_0x2cdc('0x5')]}));_0x5cca2c['push'](_0x154761[_0x2cdc('0x3a')]({'attributes':['id','name']}));_0x5cca2c[_0x2cdc('0x2e')](_0x154761[_0x2cdc('0x3b')]({'attributes':['id',_0x2cdc('0x5')]}));_0x5cca2c[_0x2cdc('0x2e')](_0x154761['getSmsQueues']({'attributes':['id',_0x2cdc('0x5')]}));_0x5cca2c['push'](_0x154761[_0x2cdc('0x3c')]({'attributes':['id','name']}));_0x5cca2c[_0x2cdc('0x2e')](_0x154761[_0x2cdc('0x3d')]({'attributes':['id',_0x2cdc('0x5')]}));_0x5cca2c[_0x2cdc('0x2e')](_0x154761[_0x2cdc('0x3e')]({'attributes':['id','name']}));break;}return BPromise[_0x2cdc('0x3f')](_0x5cca2c);}})[_0x2cdc('0x15')](function(_0x58145d){if(_0x58145d&&_0x58145d[_0x2cdc('0x19')]){for(var _0x569b86=0x0;_0x569b86<_0x58145d[_0x2cdc('0x19')];_0x569b86+=0x1){for(var _0x3e5fa0=0x0;_0x3e5fa0<_0x58145d[_0x569b86][_0x2cdc('0x19')];_0x3e5fa0+=0x1){switch(_0x569b86){case 0x0:joinOrLeaveQueues(_0x4a17b4,_0x19f1d6,'voice',_0x58145d[_0x569b86][_0x3e5fa0]);break;case 0x1:joinOrLeaveQueues(_0x4a17b4,_0x19f1d6,_0x2cdc('0x40'),_0x58145d[_0x569b86][_0x3e5fa0]);break;case 0x2:joinOrLeaveQueues(_0x4a17b4,_0x19f1d6,_0x2cdc('0x41'),_0x58145d[_0x569b86][_0x3e5fa0]);break;case 0x3:joinOrLeaveQueues(_0x4a17b4,_0x19f1d6,_0x2cdc('0x42'),_0x58145d[_0x569b86][_0x3e5fa0]);break;case 0x4:joinOrLeaveQueues(_0x4a17b4,_0x19f1d6,_0x2cdc('0x43'),_0x58145d[_0x569b86][_0x3e5fa0]);break;case 0x5:joinOrLeaveQueues(_0x4a17b4,_0x19f1d6,_0x2cdc('0x44'),_0x58145d[_0x569b86][_0x3e5fa0]);break;case 0x6:joinOrLeaveQueues(_0x4a17b4,_0x19f1d6,_0x2cdc('0x45'),_0x58145d[_0x569b86][_0x3e5fa0]);break;case 0x7:if(_0x4bdb4d[_0x2cdc('0x8')]!==_0x2cdc('0x9'))_0x4a17b4[_0x19f1d6](util[_0x2cdc('0x1a')](_0x2cdc('0x46'),_0x58145d[_0x569b86][_0x3e5fa0]['name']));break;case 0x8:if(_0x4bdb4d[_0x2cdc('0x8')]!==_0x2cdc('0x9'))_0x4a17b4[_0x19f1d6](util[_0x2cdc('0x1a')](_0x2cdc('0x47'),_0x58145d[_0x569b86][_0x3e5fa0][_0x2cdc('0x5')]));break;case 0x9:if(_0x4bdb4d['role']!==_0x2cdc('0x9'))_0x4a17b4[_0x19f1d6](util[_0x2cdc('0x1a')](_0x2cdc('0x48'),_0x58145d[_0x569b86][_0x3e5fa0]['type'],_0x58145d[_0x569b86][_0x3e5fa0]['name']));break;case 0xa:_0x4a17b4[_0x19f1d6](util[_0x2cdc('0x1a')](_0x2cdc('0x1b'),_0x58145d[_0x569b86][_0x3e5fa0][_0x2cdc('0x5')]));break;}}}}})['then'](function(){if(_0x19f1d6===_0x2cdc('0x49')){var _0x2ebf27=_[_0x2cdc('0x4a')](_0x4bdb4d[_0x2cdc('0x21')],'id');return _0x4bdb4d[_0x2cdc('0x4b')](_0x2ebf27)[_0x2cdc('0x15')](function(){for(var _0x228521=0x0;_0x228521<_0x2ebf27[_0x2cdc('0x19')];_0x228521+=0x1){_0x2ea200[_0x2cdc('0x4c')](_0x2cdc('0x4d'),{'ChatInteractionId':Number(_0x2ebf27[_0x228521]),'UserId':Number(_0x4bdb4d['id'])});}});}})['then'](function(){if(_0x19f1d6===_0x2cdc('0x49')){var _0xefcfdf=_[_0x2cdc('0x4a')](_0x4bdb4d['MailInteractions'],'id');return _0x4bdb4d[_0x2cdc('0x4e')](_0xefcfdf)['then'](function(){for(var _0x173bde=0x0;_0x173bde<_0xefcfdf['length'];_0x173bde+=0x1){_0x2ea200[_0x2cdc('0x4c')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0xefcfdf[_0x173bde]),'UserId':Number(_0x4bdb4d['id'])});}});}})[_0x2cdc('0x15')](function(){if(_0x19f1d6===_0x2cdc('0x49')){var _0x2904f2=_['map'](_0x4bdb4d[_0x2cdc('0x22')],'id');return _0x4bdb4d[_0x2cdc('0x4f')](_0x2904f2)[_0x2cdc('0x15')](function(){for(var _0xc11e8f=0x0;_0xc11e8f<_0x2904f2[_0x2cdc('0x19')];_0xc11e8f+=0x1){_0x2ea200[_0x2cdc('0x4c')](_0x2cdc('0x50'),{'FaxInteractionId':Number(_0x2904f2[_0xc11e8f]),'UserId':Number(_0x4bdb4d['id'])});}});}})[_0x2cdc('0x15')](function(){if(_0x19f1d6===_0x2cdc('0x49')){var _0x567abb=_[_0x2cdc('0x4a')](_0x4bdb4d[_0x2cdc('0x24')],'id');return _0x4bdb4d[_0x2cdc('0x51')](_0x567abb)[_0x2cdc('0x15')](function(){for(var _0x1e3160=0x0;_0x1e3160<_0x567abb['length'];_0x1e3160+=0x1){_0x2ea200[_0x2cdc('0x4c')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x567abb[_0x1e3160]),'UserId':Number(_0x4bdb4d['id'])});}});}})[_0x2cdc('0x15')](function(){if(_0x19f1d6===_0x2cdc('0x49')){var _0x419519=_['map'](_0x4bdb4d[_0x2cdc('0x26')],'id');return _0x4bdb4d['removeOpenchannelInteractions'](_0x419519)['then'](function(){for(var _0x29c4d0=0x0;_0x29c4d0<_0x419519[_0x2cdc('0x19')];_0x29c4d0+=0x1){_0x2ea200['emit'](_0x2cdc('0x52'),{'OpenchannelInteractionId':Number(_0x419519[_0x29c4d0]),'UserId':Number(_0x4bdb4d['id'])});}});}})[_0x2cdc('0x15')](function(){if(_0x19f1d6===_0x2cdc('0x49')){var _0x881d32=_[_0x2cdc('0x4a')](_0x4bdb4d[_0x2cdc('0x28')],'id');return _0x4bdb4d[_0x2cdc('0x53')](_0x881d32)[_0x2cdc('0x15')](function(){for(var _0x159fa9=0x0;_0x159fa9<_0x881d32[_0x2cdc('0x19')];_0x159fa9+=0x1){_0x2ea200[_0x2cdc('0x4c')](_0x2cdc('0x54'),{'WhatsappInteractionId':Number(_0x881d32[_0x159fa9]),'UserId':Number(_0x4bdb4d['id'])});}});}})['catch'](function(_0x5ca0a3){_0x4a17b4['log'](_0x5ca0a3);});}}function onDisconnect(_0x258d89,_0x2bd489){joinOrLeave(_0x258d89,'leave',_0x2bd489);}function onConnect(_0x18d8fc){joinOrLeave(_0x18d8fc,'join');}exports['default']=function(_0xc9f37d){_0xc9f37d['on'](_0x2cdc('0x55'),function(_0x410129){_0x410129[_0x2cdc('0x56')](0x0);_0x410129[_0x2cdc('0x57')]=_0x410129[_0x2cdc('0x58')][_0x2cdc('0x55')][_0x2cdc('0x59')]+':'+_0x410129[_0x2cdc('0x58')][_0x2cdc('0x55')][_0x2cdc('0x5a')];_0x410129[_0x2cdc('0x5b')]=new Date();_0x410129[_0x2cdc('0x5c')]=function(_0x109811){console['log'](_0x2cdc('0x5d')+_0x410129['nsp'][_0x2cdc('0x5')]+'['+_0x410129[_0x2cdc('0x57')]+']',_0x109811);};_0x410129['on'](_0x2cdc('0x5e'),function(){onDisconnect(_0x410129,_0xc9f37d);_0x410129[_0x2cdc('0x5c')](_0x2cdc('0x5f'));});onConnect(_0x410129);_0x410129[_0x2cdc('0x5c')]('CONNECTED');});}; \ No newline at end of file +var _0xcb22=['disconnect','DISCONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','telephone','ivr','UserProfileSection','findOne','then','autoAssociation','FaxQueues','SmsQueues','WhatsappQueues','Telephones','Trunks','findAll','UserProfileResource','map','where','Campaign','format','%s:queue:%s','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:outbound','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','WhatsappQueue','Trunk','user','voice:inbound','VoiceQueues','ChatQueues','MailQueues','IvrCampaigns','getVoiceQueues','getWhatsappQueues','all','voice','chat','fax','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','type','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','default','connection','setMaxListeners','request','connectedAt','SocketIO\x20'];(function(_0x477830,_0x5dffbf){var _0x1069bf=function(_0x40676d){while(--_0x40676d){_0x477830['push'](_0x477830['shift']());}};_0x1069bf(++_0x5dffbf);}(_0xcb22,0xc8));var _0x2cb2=function(_0x5f09e3,_0x2053af){_0x5f09e3=_0x5f09e3-0x0;var _0x4f7d59=_0xcb22[_0x5f09e3];return _0x4f7d59;};'use strict';var _=require(_0x2cb2('0x0'));var util=require(_0x2cb2('0x1'));var BPromise=require(_0x2cb2('0x2'));var db=require(_0x2cb2('0x3'))['db'];var config=require(_0x2cb2('0x4'));var queryQueues={'attributes':['id',_0x2cb2('0x5')],'include':[{'as':_0x2cb2('0x6'),'model':db[_0x2cb2('0x7')],'attributes':['id',_0x2cb2('0x5'),_0x2cb2('0x8')],'raw':!![],'where':{'role':_0x2cb2('0x9')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x2cb2('0xa')}};var queryTrunks={'raw':!![],'attributes':['id',_0x2cb2('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x2cb2('0x5')],'where':{'role':_0x2cb2('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x2cb2('0x5'),'type'],'where':{'type':_0x2cb2('0xb')}};function getAssociatedResources(_0x3120f4,_0x5b677d,_0x16b59d){return db[_0x2cb2('0xc')][_0x2cb2('0xd')]({'where':{'name':_0x3120f4,'userProfileId':_0x5b677d},'raw':!![]})[_0x2cb2('0xe')](function(_0x16f6fe){if(_0x16f6fe){if(_0x16f6fe[_0x2cb2('0xf')]){switch(_0x3120f4){case'VoiceQueues':case'ChatQueues':case _0x2cb2('0x10'):case _0x2cb2('0x11'):case'MailQueues':case'OpenchannelQueues':case _0x2cb2('0x12'):return db[_0x16b59d]['findAll'](queryQueues);case _0x2cb2('0x13'):return db[_0x16b59d]['findAll'](queryTelephones);case _0x2cb2('0x14'):return db[_0x16b59d][_0x2cb2('0x15')](queryTrunks);case'IvrCampaigns':return db[_0x16b59d][_0x2cb2('0x15')](queryCampaigns);}}else{return db[_0x2cb2('0x16')][_0x2cb2('0x15')]({'attributes':['resourceId'],'where':{'sectionId':_0x16f6fe['id']},'raw':!![]})[_0x2cb2('0xe')](function(_0x62121){if(_0x62121){var _0x58d9b4={'where':{'id':_[_0x2cb2('0x17')](_0x62121,'resourceId')},'raw':!![]};switch(_0x16b59d){case _0x2cb2('0x7'):_0x58d9b4[_0x2cb2('0x18')][_0x2cb2('0x8')]=_0x2cb2('0xa');break;case _0x2cb2('0x19'):_0x58d9b4[_0x2cb2('0x18')]['type']='ivr';break;}return db[_0x16b59d]['findAll'](_0x58d9b4);}else{return[];}});}}else{return[];}})['then'](function(_0x15708b){return _0x15708b;});}function joinOrLeaveQueues(_0x46ba55,_0x2674d3,_0x64d13e,_0x4d72a2){_0x46ba55[_0x2674d3](util[_0x2cb2('0x1a')](_0x2cb2('0x1b'),_0x64d13e,_0x4d72a2[_0x2cb2('0x5')]));if(_0x4d72a2['Agents']){for(var _0x3d64c5=0x0;_0x3d64c5<_0x4d72a2[_0x2cb2('0x6')][_0x2cb2('0x1c')];_0x3d64c5+=0x1){_0x46ba55[_0x2674d3](util[_0x2cb2('0x1a')](_0x2cb2('0x1d'),_0x4d72a2[_0x2cb2('0x6')][_0x3d64c5]['name']));}}}function joinOrLeave(_0xaacf9e,_0x312bab,_0x2ebb59){var _0x3f43bd;if(_0xaacf9e[_0x2cb2('0x1e')][_0x2cb2('0x1f')]['id']){db[_0x2cb2('0x7')][_0x2cb2('0x20')]({'attributes':['id','name',_0x2cb2('0x8'),_0x2cb2('0x21')],'where':{'id':_0xaacf9e[_0x2cb2('0x1e')][_0x2cb2('0x1f')]['id']},'include':[{'model':db[_0x2cb2('0x22')],'as':_0x2cb2('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x2cb2('0x24')],'as':_0x2cb2('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x2cb2('0x26')],'as':_0x2cb2('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x2cb2('0x28')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x2cb2('0x29')],'as':_0x2cb2('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x2cb2('0x2b')],'as':_0x2cb2('0x2c'),'attributes':['id'],'raw':!![]}]})[_0x2cb2('0xe')](function(_0x200067){if(_0x200067){_0x3f43bd=_0x200067;_0xaacf9e[_0x312bab](util[_0x2cb2('0x1a')](_0x2cb2('0x1d'),_0x200067[_0x2cb2('0x5')]));var _0x4cb0ff=[];switch(_0x200067['role']){case _0x2cb2('0x2d'):_0xaacf9e[_0x312bab]('voice:inbound');_0xaacf9e[_0x312bab](_0x2cb2('0x2e'));if(queryQueues['hasOwnProperty']('include')){delete queryQueues[_0x2cb2('0x2f')];}_0x4cb0ff[_0x2cb2('0x30')](db[_0x2cb2('0x31')][_0x2cb2('0x15')](queryQueues));_0x4cb0ff[_0x2cb2('0x30')](db[_0x2cb2('0x32')][_0x2cb2('0x15')](queryQueues));_0x4cb0ff[_0x2cb2('0x30')](db[_0x2cb2('0x33')]['findAll'](queryQueues));_0x4cb0ff[_0x2cb2('0x30')](db[_0x2cb2('0x34')]['findAll'](queryQueues));_0x4cb0ff[_0x2cb2('0x30')](db[_0x2cb2('0x35')][_0x2cb2('0x15')](queryQueues));_0x4cb0ff['push'](db['OpenchannelQueue'][_0x2cb2('0x15')](queryQueues));_0x4cb0ff[_0x2cb2('0x30')](db[_0x2cb2('0x36')]['findAll'](queryQueues));_0x4cb0ff[_0x2cb2('0x30')](db[_0x2cb2('0x7')]['findAll'](queryTelephones));_0x4cb0ff['push'](db[_0x2cb2('0x37')][_0x2cb2('0x15')](queryTrunks));_0x4cb0ff[_0x2cb2('0x30')](db['Campaign']['findAll'](queryCampaigns));_0x4cb0ff[_0x2cb2('0x30')](db[_0x2cb2('0x7')][_0x2cb2('0x15')](queryAgents));break;case _0x2cb2('0x38'):_0xaacf9e[_0x312bab](_0x2cb2('0x39'));_0xaacf9e[_0x312bab]('voice:outbound');_0x4cb0ff[_0x2cb2('0x30')](getAssociatedResources(_0x2cb2('0x3a'),_0x200067[_0x2cb2('0x21')],'VoiceQueue'));_0x4cb0ff['push'](getAssociatedResources(_0x2cb2('0x3b'),_0x200067[_0x2cb2('0x21')],_0x2cb2('0x32')));_0x4cb0ff[_0x2cb2('0x30')](getAssociatedResources(_0x2cb2('0x10'),_0x200067[_0x2cb2('0x21')],'FaxQueue'));_0x4cb0ff[_0x2cb2('0x30')](getAssociatedResources(_0x2cb2('0x11'),_0x200067[_0x2cb2('0x21')],_0x2cb2('0x34')));_0x4cb0ff[_0x2cb2('0x30')](getAssociatedResources(_0x2cb2('0x3c'),_0x200067[_0x2cb2('0x21')],_0x2cb2('0x35')));_0x4cb0ff[_0x2cb2('0x30')](getAssociatedResources('OpenchannelQueues',_0x200067[_0x2cb2('0x21')],'OpenchannelQueue'));_0x4cb0ff[_0x2cb2('0x30')](getAssociatedResources('WhatsappQueues',_0x200067[_0x2cb2('0x21')],_0x2cb2('0x36')));_0x4cb0ff[_0x2cb2('0x30')](getAssociatedResources('Telephones',_0x200067[_0x2cb2('0x21')],_0x2cb2('0x7')));_0x4cb0ff[_0x2cb2('0x30')](getAssociatedResources(_0x2cb2('0x14'),_0x200067[_0x2cb2('0x21')],_0x2cb2('0x37')));_0x4cb0ff[_0x2cb2('0x30')](getAssociatedResources(_0x2cb2('0x3d'),_0x200067[_0x2cb2('0x21')],'Campaign'));_0x4cb0ff[_0x2cb2('0x30')](db[_0x2cb2('0x7')]['findAll'](queryAgents));break;case'agent':_0xaacf9e[_0x312bab](_0x2cb2('0x39'));_0xaacf9e[_0x312bab](_0x2cb2('0x2e'));_0x4cb0ff['push'](_0x200067[_0x2cb2('0x3e')]({'attributes':['id',_0x2cb2('0x5')]}));_0x4cb0ff['push'](_0x200067['getChatQueues']({'attributes':['id',_0x2cb2('0x5')]}));_0x4cb0ff[_0x2cb2('0x30')](_0x200067['getFaxQueues']({'attributes':['id',_0x2cb2('0x5')]}));_0x4cb0ff[_0x2cb2('0x30')](_0x200067['getSmsQueues']({'attributes':['id','name']}));_0x4cb0ff['push'](_0x200067['getMailQueues']({'attributes':['id',_0x2cb2('0x5')]}));_0x4cb0ff[_0x2cb2('0x30')](_0x200067['getOpenchannelQueues']({'attributes':['id',_0x2cb2('0x5')]}));_0x4cb0ff[_0x2cb2('0x30')](_0x200067[_0x2cb2('0x3f')]({'attributes':['id',_0x2cb2('0x5')]}));break;}return BPromise[_0x2cb2('0x40')](_0x4cb0ff);}})['then'](function(_0x27d883){if(_0x27d883&&_0x27d883['length']){for(var _0x4ffe6e=0x0;_0x4ffe6e<_0x27d883['length'];_0x4ffe6e+=0x1){for(var _0x4ed068=0x0;_0x4ed068<_0x27d883[_0x4ffe6e][_0x2cb2('0x1c')];_0x4ed068+=0x1){switch(_0x4ffe6e){case 0x0:joinOrLeaveQueues(_0xaacf9e,_0x312bab,_0x2cb2('0x41'),_0x27d883[_0x4ffe6e][_0x4ed068]);break;case 0x1:joinOrLeaveQueues(_0xaacf9e,_0x312bab,_0x2cb2('0x42'),_0x27d883[_0x4ffe6e][_0x4ed068]);break;case 0x2:joinOrLeaveQueues(_0xaacf9e,_0x312bab,_0x2cb2('0x43'),_0x27d883[_0x4ffe6e][_0x4ed068]);break;case 0x3:joinOrLeaveQueues(_0xaacf9e,_0x312bab,'sms',_0x27d883[_0x4ffe6e][_0x4ed068]);break;case 0x4:joinOrLeaveQueues(_0xaacf9e,_0x312bab,_0x2cb2('0x44'),_0x27d883[_0x4ffe6e][_0x4ed068]);break;case 0x5:joinOrLeaveQueues(_0xaacf9e,_0x312bab,_0x2cb2('0x45'),_0x27d883[_0x4ffe6e][_0x4ed068]);break;case 0x6:joinOrLeaveQueues(_0xaacf9e,_0x312bab,_0x2cb2('0x46'),_0x27d883[_0x4ffe6e][_0x4ed068]);break;case 0x7:if(_0x3f43bd[_0x2cb2('0x8')]!=='agent')_0xaacf9e[_0x312bab](util[_0x2cb2('0x1a')](_0x2cb2('0x47'),_0x27d883[_0x4ffe6e][_0x4ed068]['name']));break;case 0x8:if(_0x3f43bd['role']!==_0x2cb2('0x9'))_0xaacf9e[_0x312bab](util[_0x2cb2('0x1a')](_0x2cb2('0x48'),_0x27d883[_0x4ffe6e][_0x4ed068][_0x2cb2('0x5')]));break;case 0x9:if(_0x3f43bd['role']!=='agent')_0xaacf9e[_0x312bab](util[_0x2cb2('0x1a')](_0x2cb2('0x49'),_0x27d883[_0x4ffe6e][_0x4ed068][_0x2cb2('0x4a')],_0x27d883[_0x4ffe6e][_0x4ed068][_0x2cb2('0x5')]));break;case 0xa:_0xaacf9e[_0x312bab](util[_0x2cb2('0x1a')](_0x2cb2('0x1d'),_0x27d883[_0x4ffe6e][_0x4ed068][_0x2cb2('0x5')]));break;}}}}})[_0x2cb2('0xe')](function(){if(_0x312bab===_0x2cb2('0x4b')){var _0x2157c2=_[_0x2cb2('0x17')](_0x3f43bd[_0x2cb2('0x23')],'id');return _0x3f43bd[_0x2cb2('0x4c')](_0x2157c2)['then'](function(){for(var _0x35f6bd=0x0;_0x35f6bd<_0x2157c2['length'];_0x35f6bd+=0x1){_0x2ebb59[_0x2cb2('0x4d')](_0x2cb2('0x4e'),{'ChatInteractionId':Number(_0x2157c2[_0x35f6bd]),'UserId':Number(_0x3f43bd['id'])});}});}})[_0x2cb2('0xe')](function(){if(_0x312bab==='leave'){var _0x21ea63=_[_0x2cb2('0x17')](_0x3f43bd[_0x2cb2('0x25')],'id');return _0x3f43bd[_0x2cb2('0x4f')](_0x21ea63)[_0x2cb2('0xe')](function(){for(var _0x220401=0x0;_0x220401<_0x21ea63[_0x2cb2('0x1c')];_0x220401+=0x1){_0x2ebb59['emit'](_0x2cb2('0x50'),{'MailInteractionId':Number(_0x21ea63[_0x220401]),'UserId':Number(_0x3f43bd['id'])});}});}})[_0x2cb2('0xe')](function(){if(_0x312bab==='leave'){var _0xec11ba=_[_0x2cb2('0x17')](_0x3f43bd['FaxInteractions'],'id');return _0x3f43bd[_0x2cb2('0x51')](_0xec11ba)[_0x2cb2('0xe')](function(){for(var _0xdfb7ef=0x0;_0xdfb7ef<_0xec11ba[_0x2cb2('0x1c')];_0xdfb7ef+=0x1){_0x2ebb59[_0x2cb2('0x4d')](_0x2cb2('0x52'),{'FaxInteractionId':Number(_0xec11ba[_0xdfb7ef]),'UserId':Number(_0x3f43bd['id'])});}});}})[_0x2cb2('0xe')](function(){if(_0x312bab===_0x2cb2('0x4b')){var _0x3ace8e=_['map'](_0x3f43bd[_0x2cb2('0x53')],'id');return _0x3f43bd[_0x2cb2('0x54')](_0x3ace8e)[_0x2cb2('0xe')](function(){for(var _0xc47399=0x0;_0xc47399<_0x3ace8e[_0x2cb2('0x1c')];_0xc47399+=0x1){_0x2ebb59['emit']('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x3ace8e[_0xc47399]),'UserId':Number(_0x3f43bd['id'])});}});}})['then'](function(){if(_0x312bab==='leave'){var _0x4d70dc=_[_0x2cb2('0x17')](_0x3f43bd['OpenchannelInteractions'],'id');return _0x3f43bd[_0x2cb2('0x55')](_0x4d70dc)[_0x2cb2('0xe')](function(){for(var _0x3a64f9=0x0;_0x3a64f9<_0x4d70dc[_0x2cb2('0x1c')];_0x3a64f9+=0x1){_0x2ebb59['emit'](_0x2cb2('0x56'),{'OpenchannelInteractionId':Number(_0x4d70dc[_0x3a64f9]),'UserId':Number(_0x3f43bd['id'])});}});}})['then'](function(){if(_0x312bab===_0x2cb2('0x4b')){var _0x261a24=_[_0x2cb2('0x17')](_0x3f43bd[_0x2cb2('0x2c')],'id');return _0x3f43bd[_0x2cb2('0x57')](_0x261a24)[_0x2cb2('0xe')](function(){for(var _0x3438a3=0x0;_0x3438a3<_0x261a24[_0x2cb2('0x1c')];_0x3438a3+=0x1){_0x2ebb59['emit'](_0x2cb2('0x58'),{'WhatsappInteractionId':Number(_0x261a24[_0x3438a3]),'UserId':Number(_0x3f43bd['id'])});}});}})[_0x2cb2('0x59')](function(_0x5814bf){_0xaacf9e[_0x2cb2('0x5a')](_0x5814bf);});}}function onDisconnect(_0x51ab48,_0x484122){joinOrLeave(_0x51ab48,_0x2cb2('0x4b'),_0x484122);}function onConnect(_0x494b18){joinOrLeave(_0x494b18,'join');}exports[_0x2cb2('0x5b')]=function(_0x26a61e){_0x26a61e['on'](_0x2cb2('0x5c'),function(_0x40b07a){_0x40b07a[_0x2cb2('0x5d')](0x0);_0x40b07a['address']=_0x40b07a['request'][_0x2cb2('0x5c')]['remoteAddress']+':'+_0x40b07a[_0x2cb2('0x5e')][_0x2cb2('0x5c')]['remotePort'];_0x40b07a[_0x2cb2('0x5f')]=new Date();_0x40b07a[_0x2cb2('0x5a')]=function(_0x1cd845){console[_0x2cb2('0x5a')](_0x2cb2('0x60')+_0x40b07a['nsp'][_0x2cb2('0x5')]+'['+_0x40b07a['address']+']',_0x1cd845);};_0x40b07a['on'](_0x2cb2('0x61'),function(){onDisconnect(_0x40b07a,_0x26a61e);_0x40b07a[_0x2cb2('0x5a')](_0x2cb2('0x62'));});onConnect(_0x40b07a);_0x40b07a[_0x2cb2('0x5a')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 9e99ef7..471dab2 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 _0x31a2=['../logger','client','Chat','afterCreate','newinteraction','ChatInteraction','afterUpdate','closedinteraction','ChatOfflineMessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','newmessage','Fax','FaxInteraction','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','catch','get','motionChannel','event','direction','resolve','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','query','Sequelize','QueryTypes','UserId','interface','format','SIP/%s','name','channel','incomingmessage','outgoingmessage','AfterCreateMessage','opened','sequelize','SELECT','contact','agent','AfterCreate','closed','changed','substatus','User','find','fullname','email','default','length','model','callback','toLowerCase','condition','util','../../mysqldb'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x31a2,0xd6));var _0x231a=function(_0x547222,_0x3f286e){_0x547222=_0x547222-0x0;var _0x212e0b=_0x31a2[_0x547222];return _0x212e0b;};'use strict';var util=require(_0x231a('0x0'));var db=require(_0x231a('0x1'))['db'];var jayson=require('jayson/promise');var logger=require(_0x231a('0x2'))('triggers');var client=jayson[_0x231a('0x3')]['http']({'port':0x232a});var triggers=[{'channel':_0x231a('0x4'),'model':'ChatInteraction','event':_0x231a('0x5'),'condition':_0x231a('0x6'),'callback':afterCreate},{'channel':_0x231a('0x4'),'model':_0x231a('0x7'),'event':_0x231a('0x8'),'condition':_0x231a('0x9'),'callback':afterUpdate},{'channel':_0x231a('0x4'),'model':'ChatMessage','event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':'Chat','model':_0x231a('0xa'),'event':'afterCreate','condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':_0x231a('0xb'),'model':_0x231a('0xc'),'event':'afterCreate','condition':_0x231a('0x6'),'callback':afterCreate},{'channel':_0x231a('0xb'),'model':_0x231a('0xc'),'event':_0x231a('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x231a('0xb'),'model':_0x231a('0xd'),'event':_0x231a('0x5'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x231a('0xe'),'model':_0x231a('0xf'),'event':_0x231a('0x5'),'condition':_0x231a('0x6'),'callback':afterCreate},{'channel':_0x231a('0xe'),'model':_0x231a('0xf'),'event':_0x231a('0x8'),'condition':_0x231a('0x9'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0x231a('0x10'),'event':_0x231a('0x5'),'condition':_0x231a('0x11'),'callback':afterCreateMessage},{'channel':_0x231a('0x12'),'model':'FaxInteraction','event':_0x231a('0x5'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x231a('0x12'),'model':_0x231a('0x13'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x231a('0x12'),'model':'FaxMessage','event':_0x231a('0x5'),'condition':_0x231a('0x11'),'callback':afterCreateMessage},{'channel':_0x231a('0x14'),'model':_0x231a('0x15'),'event':_0x231a('0x5'),'condition':_0x231a('0x6'),'callback':afterCreate},{'channel':'Mail','model':_0x231a('0x15'),'event':_0x231a('0x8'),'condition':_0x231a('0x9'),'callback':afterUpdate},{'channel':'Mail','model':_0x231a('0x16'),'event':_0x231a('0x5'),'condition':_0x231a('0x11'),'callback':afterCreateMessage},{'channel':_0x231a('0x17'),'model':_0x231a('0x18'),'event':_0x231a('0x5'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x231a('0x17'),'model':_0x231a('0x18'),'event':_0x231a('0x8'),'condition':_0x231a('0x9'),'callback':afterUpdate},{'channel':'Openchannel','model':_0x231a('0x19'),'event':_0x231a('0x5'),'condition':_0x231a('0x11'),'callback':afterCreateMessage}];function request(_0x29e6e2){return client[_0x231a('0x1a')](_0x231a('0x1b'),_0x29e6e2)[_0x231a('0x1c')](function(_0x2171a5){logger[_0x231a('0x1d')](_0x231a('0x1e'),'EventManager',_0x2171a5);if(_0x2171a5[_0x231a('0x1f')]){if(_0x2171a5[_0x231a('0x1f')]['code']===0x1f4){logger['error'](_0x231a('0x1e'),'EventManager',_0x2171a5[_0x231a('0x1f')]);}}})[_0x231a('0x20')](function(_0x4f65da){logger[_0x231a('0x1f')](_0x231a('0x1e'),'EventManager',_0x4f65da);});}function afterCreateMessage(_0x386a5b){return function(_0x4e957a){_0x4e957a=_0x4e957a[_0x231a('0x21')]({'plain':!![]});_0x4e957a['channel']=_0x386a5b;_0x4e957a[_0x231a('0x22')]=_0x386a5b;_0x4e957a[_0x231a('0x23')]=_0x4e957a[_0x231a('0x24')];Promise[_0x231a('0x25')]()[_0x231a('0x1c')](function(){if(typeof _0x4e957a['ContactId']===_0x231a('0x26'))return null;var _0x189993=_0x231a('0x27')+_0x4e957a[_0x231a('0x28')];return db['sequelize'][_0x231a('0x29')](_0x189993,{'type':db[_0x231a('0x2a')][_0x231a('0x2b')]['SELECT'],'raw':!![]});})[_0x231a('0x1c')](function(_0x226b09){if(_0x226b09){_0x4e957a['contact']=_0x226b09[0x0];}if(typeof _0x4e957a[_0x231a('0x2c')]==='undefined')return;return getAgent(_0x4e957a[_0x231a('0x2c')]);})[_0x231a('0x1c')](function(_0x4355cc){if(_0x4355cc){_0x4e957a[_0x231a('0x2d')]=util[_0x231a('0x2e')](_0x231a('0x2f'),_0x4355cc[_0x231a('0x30')]);_0x4e957a['agent']=_0x4355cc;_0x4e957a[_0x231a('0x31')]=_0x386a5b;return request({'event':_0x231a('0x32'),'message':_0x4e957a});}else{return request({'event':_0x231a('0x33'),'message':_0x4e957a});}})['catch'](function(_0x3c9c5a){logger[_0x231a('0x1f')](_0x231a('0x1e'),_0x231a('0x34'),_0x3c9c5a);});};}function afterCreateOfflineMessage(_0x234154){return function(_0x7b8ba5){_0x7b8ba5=_0x7b8ba5[_0x231a('0x21')]({'plain':!![]});_0x7b8ba5[_0x231a('0x31')]=_0x234154;_0x7b8ba5[_0x231a('0x22')]=_0x234154;_0x7b8ba5[_0x231a('0x23')]='offlineMessage';return request({'event':_0x7b8ba5[_0x231a('0x23')],'message':_0x7b8ba5});};}function afterCreate(_0x4944c4,_0x26aab7){return function(_0x45c63f){_0x45c63f=_0x45c63f[_0x231a('0x21')]({'plain':!![]});_0x45c63f[_0x231a('0x31')]=_0x4944c4;_0x45c63f['motionChannel']=_0x4944c4;_0x45c63f[_0x231a('0x23')]=_0x231a('0x35');Promise[_0x231a('0x25')]()[_0x231a('0x1c')](function(){var _0x3ad5b6='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x45c63f['ContactId'];return db[_0x231a('0x36')][_0x231a('0x29')](_0x3ad5b6,{'type':db[_0x231a('0x2a')][_0x231a('0x2b')][_0x231a('0x37')],'raw':!![]});})[_0x231a('0x1c')](function(_0x1bf25d){if(_0x1bf25d){_0x45c63f[_0x231a('0x38')]=_0x1bf25d[0x0];}if(typeof _0x45c63f[_0x231a('0x2c')]===_0x231a('0x26'))return;return getAgent(_0x45c63f[_0x231a('0x2c')]);})[_0x231a('0x1c')](function(_0x1a4a2a){if(_0x1a4a2a){_0x45c63f[_0x231a('0x2d')]=util[_0x231a('0x2e')]('SIP/%s',_0x1a4a2a['name']);_0x45c63f[_0x231a('0x39')]=_0x1a4a2a;}return request({'event':_0x26aab7,'message':_0x45c63f});})[_0x231a('0x20')](function(_0x28b8df){logger[_0x231a('0x1f')](_0x231a('0x1e'),_0x231a('0x3a'),_0x28b8df);});};}function afterUpdate(_0x27aff8){return function(_0x486b39){var _0x48fade=_0x486b39['changed'](_0x231a('0x3b'))&&_0x486b39['closed'];var _0x5277f5=_0x486b39[_0x231a('0x3c')](_0x231a('0x3d'));if(_0x48fade||_0x5277f5){var _0x46a8cb=_0x48fade?_0x231a('0x9'):_0x231a('0x3d');var _0x4f4a98=_0x486b39[_0x231a('0x21')]({'plain':!![]});_0x4f4a98[_0x231a('0x31')]=_0x27aff8;_0x4f4a98[_0x231a('0x22')]=_0x27aff8;_0x4f4a98[_0x231a('0x23')]=_0x48fade?_0x231a('0x3b'):_0x231a('0x3d');var _0xb78f10=_0x231a('0x27')+_0x4f4a98[_0x231a('0x28')];return db[_0x231a('0x36')][_0x231a('0x29')](_0xb78f10,{'type':db[_0x231a('0x2a')][_0x231a('0x2b')][_0x231a('0x37')],'raw':!![]})[_0x231a('0x1c')](function(_0x2479d7){if(_0x2479d7){_0x4f4a98[_0x231a('0x38')]=_0x2479d7[0x0];}if(typeof _0x4f4a98[_0x231a('0x2c')]===_0x231a('0x26'))return;return getAgent(_0x4f4a98[_0x231a('0x2c')]);})[_0x231a('0x1c')](function(_0x1aecf1){if(_0x1aecf1){_0x4f4a98['interface']=util[_0x231a('0x2e')](_0x231a('0x2f'),_0x1aecf1[_0x231a('0x30')]);_0x4f4a98[_0x231a('0x39')]=_0x1aecf1;}return request({'event':_0x46a8cb,'message':_0x4f4a98});})[_0x231a('0x20')](function(_0x1ef4e0){logger[_0x231a('0x1f')]('Trigger,\x20%s','AfterUpdate',_0x1ef4e0);});}};}function getAgent(_0x486321){return db[_0x231a('0x3e')][_0x231a('0x3f')]({'where':{'id':_0x486321},'attributes':['id',_0x231a('0x30'),_0x231a('0x40'),_0x231a('0x41'),'internal'],'raw':!![]})['then'](function(_0x5e41b9){return _0x5e41b9;});}exports[_0x231a('0x42')]=function(){for(var _0x2a086d=0x0;_0x2a086d=_0xcd2883['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x1635f9(_0x473ad3);})['catch'](function(_0x128651){_0x3f7aaf(_0x128651);});});}; \ No newline at end of file +var _0x1b83=['bluebird','../mysqldb','./license/util','voice','mail','chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','role','agent','User','then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','catch'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x1b83,0x1e0));var _0x31b8=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x1b83[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var BPromise=require(_0x31b8('0x0'));var db=require(_0x31b8('0x1'))['db'];var util=require(_0x31b8('0x2'));var channels=[_0x31b8('0x3'),_0x31b8('0x4'),_0x31b8('0x5'),_0x31b8('0x6'),_0x31b8('0x7'),_0x31b8('0x8'),_0x31b8('0x9')];exports[_0x31b8('0xa')]=function(){return channels;};exports[_0x31b8('0xb')]=function(_0x162b44){_0x162b44=_0x162b44[_0x31b8('0xc')]();return _[_0x31b8('0xd')](channels,_0x162b44);};exports[_0x31b8('0xe')]=function(_0xd24192,_0x384080,_0x42e43d,_0x3ec267){var _0x5171c9={'loginAttempts':_0x384080,'blocked':_0x42e43d};if(!_[_0x31b8('0xf')](_0x3ec267)){_0x5171c9['blockedAt']=_0x3ec267;}return _0xd24192['updateAttributes'](_0x5171c9);};exports['getLicense']=function(_0x1407b7){return new BPromise(function(_0x51a555,_0x240b02){var _0x2031df=0x0;if(_0x1407b7[_0x31b8('0x10')]!==_0x31b8('0x11')){_0x51a555(_0x1407b7);}db[_0x31b8('0x12')]['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x1407b7['id']}}})[_0x31b8('0x13')](function(_0x202ac7){_0x2031df=_0x202ac7;return util[_0x31b8('0x14')]();})['then'](function(_0x55e47e){if(_0x55e47e&&_0x55e47e['agents']&&_0x2031df>=_0x55e47e[_0x31b8('0x15')]){throw Error(_0x31b8('0x16'));}_0x51a555(_0x1407b7);})[_0x31b8('0x17')](function(_0xa680be){_0x240b02(_0xa680be);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 422bff7..ec28812 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7c87=['render','json','send','exports','404','status'];(function(_0x3656b0,_0x60526e){var _0x2f9d07=function(_0x3c92da){while(--_0x3c92da){_0x3656b0['push'](_0x3656b0['shift']());}};_0x2f9d07(++_0x60526e);}(_0x7c87,0x1a1));var _0x77c8=function(_0x344a4f,_0x477e6a){_0x344a4f=_0x344a4f-0x0;var _0x9450c4=_0x7c87[_0x344a4f];return _0x9450c4;};'use strict';module[_0x77c8('0x0')][0x194]=function pageNotFound(_0x35611a,_0x35987b){var _0x3692d0=_0x77c8('0x1');var _0x4ee6c1=0x194;var _0x43f22a={'status':_0x4ee6c1};_0x35987b['status'](_0x43f22a[_0x77c8('0x2')]);_0x35987b[_0x77c8('0x3')](_0x3692d0,{},function(_0x446cd4,_0x2e26b8){if(_0x446cd4){return _0x35987b['status'](_0x43f22a[_0x77c8('0x2')])[_0x77c8('0x4')](_0x43f22a);}_0x35987b[_0x77c8('0x5')](_0x2e26b8);});}; \ No newline at end of file +var _0x8581=['404','status','render','json','send'];(function(_0xc813fa,_0x4764bb){var _0x536523=function(_0x5fb745){while(--_0x5fb745){_0xc813fa['push'](_0xc813fa['shift']());}};_0x536523(++_0x4764bb);}(_0x8581,0x163));var _0x1858=function(_0x2b395a,_0x35db69){_0x2b395a=_0x2b395a-0x0;var _0x1beba0=_0x8581[_0x2b395a];return _0x1beba0;};'use strict';module['exports'][0x194]=function pageNotFound(_0x8f1095,_0x2667d0){var _0x47aab6=_0x1858('0x0');var _0x82ac2a=0x194;var _0x102658={'status':_0x82ac2a};_0x2667d0[_0x1858('0x1')](_0x102658[_0x1858('0x1')]);_0x2667d0[_0x1858('0x2')](_0x47aab6,{},function(_0xa394fd,_0x228190){if(_0xa394fd){return _0x2667d0[_0x1858('0x1')](_0x102658[_0x1858('0x1')])[_0x1858('0x3')](_0x102658);}_0x2667d0[_0x1858('0x4')](_0x228190);});}; \ No newline at end of file diff --git a/server/migrations/2.5.44.js b/server/migrations/2.5.44.js index f1e9f3b..27ec7ad 100644 --- a/server/migrations/2.5.44.js +++ b/server/migrations/2.5.44.js @@ -158,6 +158,7 @@ module.exports = { ' `id` int(11) NOT NULL AUTO_INCREMENT,' + ' `clientSideLoggingLevel` enum(\'error\',\'warning\',\'info\',\'debug\') NOT NULL DEFAULT \'error\',' + ' `clientSideLoggingEnabled` tinyint(1) DEFAULT \'0\',' + + ' `clientSideLoggingScopes` text,' + ' `clientSideLoggingEnabledSince` datetime DEFAULT NULL,' + ' `createdAt` datetime NOT NULL,' + ' `updatedAt` datetime NOT NULL,' + diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index f363301..b85fb16 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x51f2=['username','options','User','import','VoiceChanSpy','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../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/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmContact','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','Template','../api/template/template.model','../api/trigger/trigger.model','Variable','Integration','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/attachment/attachment.model','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','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','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','UserId','userSetting','hasMany','VoiceQueuesRt','cascade','HopperFinals','HopperHistory','ChatInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','CmList','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','OpenchannelInteractions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','MailQueues','FaxQueues','UserFaxQueue','SmsQueues','OpenchannelQueues','WhatsappQueue','WhatsappQueues','ChatWebsite','ChatWebsites','FaxAccounts','MailAccounts','user_has_mail_accounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','VoiceExtension','Applications','moh_has_sounds','Members','VoiceQueueId','CmHopperHistory','HopperHistories','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Teams','BlackLists','ScreenRecording','mailboxuser','mailbox','QueueCalls','uniqueid','VoiceAgentReport','Contact','ContactId','MailAccountId','CloudProviderId','restrict','MailServerOut','Imap','Smtp','Dispositions','CannedAnswer','Interactions','List','ListId','TemplateId','Agents','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Attachment','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','TagId','MailQueueReport','DashboardItem','FaxAccountId','FaxApplication','user_has_fax_accounts','Messages','FaxInteractionId','fax_interaction_has_tags','Users','AttachmentId','FaxQueueReport','SmsAccountId','Answers','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','OpenchannelAccountId','OpenchannelApplication','user_has_openchannel_accounts','IntervalId','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','ProactiveActions','ChatApplication','user_has_chat_websites','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','Website','CmCompany','CompanyId','Hoppers','Company','cm_contact_has_tags','CampaignId','OwnerId','All','AutomationAllId','OneAny','AutomationAnyId','Actions','Intervals','Extensions','MailApplications','FaxApplications','Schedule','DefaultReportId','CustomReportId','VoiceMusicOnHold','Mohs','whatsapp_interaction_has_tags','Trigger','Condition','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','AnalyticDefaultReport','AnalyticMetric','MetricId','Configurations','Subjects','SubjectId','SalesforceField','DescriptionId','FieldId','SalesforceAccount','AccountId','Subject','Description','Field','VariableId','Descriptions','DeskConfiguration','int_desk_configuration_has_tags','ZohoAccount','ZendeskAccount','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','FromId','ToId','ProjectId','ChatQueues','team_has_fax_queues','team_has_sms_queues','team_has_openchannel_queues','HopperBlacks','SquareProjectId','FromAccount','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToAgent','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','UserVoicePrefix','userProfileId','UserProfileSections','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappMessage','WhatsappTransferReport','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','user','exports','lodash','determine','defaultsDeep','sequelize','motion2','xcall','xC@LL1234','mysql','name','utf8','sequelizeHistory','127.0.0.1','utf8mb4','utf8_general_ci','database'];(function(_0x13f3af,_0x2ac326){var _0xda3c9f=function(_0x5d96e9){while(--_0x5d96e9){_0x13f3af['push'](_0x13f3af['shift']());}};_0xda3c9f(++_0x2ac326);}(_0x51f2,0x1ef));var _0x251f=function(_0x338af8,_0x35b601){_0x338af8=_0x338af8-0x0;var _0x2c8cb5=_0x51f2[_0x338af8];return _0x2c8cb5;};'use strict';var config=require('../config/environment');var Sequelize=require('sequelize');var _=require(_0x251f('0x0'));var jstz=require('jstz');var timezone=jstz[_0x251f('0x1')]();config['sequelize']=_[_0x251f('0x2')](config[_0x251f('0x3')],{'database':_0x251f('0x4'),'username':_0x251f('0x5'),'password':_0x251f('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x251f('0x7'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x251f('0x8')](),'define':{'charset':_0x251f('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x251f('0x2')](config[_0x251f('0xa')],{'database':_0x251f('0x4'),'username':'xcall','password':'xC@LL1234','options':{'host':_0x251f('0xb'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x251f('0xc')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x251f('0x9'),'collate':_0x251f('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x251f('0x3')][_0x251f('0xe')],config[_0x251f('0x3')][_0x251f('0xf')],config['sequelize']['password'],config[_0x251f('0x3')][_0x251f('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x251f('0xe')],config['sequelizeHistory'][_0x251f('0xf')],config[_0x251f('0xa')]['password'],config[_0x251f('0xa')]['options'])};db[_0x251f('0x11')]=db[_0x251f('0x3')][_0x251f('0x12')]('../api/user/user.model');db[_0x251f('0x13')]=db['sequelize'][_0x251f('0x12')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x251f('0x14')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x15'));db['VoiceExtension']=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x16'));db['VoiceMusicOnHold']=db['sequelize'][_0x251f('0x12')](_0x251f('0x17'));db[_0x251f('0x18')]=db[_0x251f('0x3')]['import'](_0x251f('0x19'));db[_0x251f('0x1a')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x1b'));db['ScreenRecording']=db['sequelize'][_0x251f('0x12')](_0x251f('0x1c'));db[_0x251f('0x1d')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x1e'));db[_0x251f('0x1f')]=db[_0x251f('0x3')][_0x251f('0x12')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x251f('0x20')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x21'));db[_0x251f('0x22')]=db['sequelize'][_0x251f('0x12')](_0x251f('0x23'));db['VoiceAgentReport']=db[_0x251f('0x3')]['import'](_0x251f('0x24'));db[_0x251f('0x25')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x26'));db[_0x251f('0x27')]=db['sequelize'][_0x251f('0x12')](_0x251f('0x28'));db[_0x251f('0x29')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x2a'));db[_0x251f('0x2b')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x2c'));db[_0x251f('0x2d')]=db[_0x251f('0x3')]['import'](_0x251f('0x2e'));db[_0x251f('0x2f')]=db[_0x251f('0x3')][_0x251f('0x12')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x251f('0x30')]=db['sequelize'][_0x251f('0x12')](_0x251f('0x31'));db[_0x251f('0x32')]=db[_0x251f('0x3')]['import'](_0x251f('0x33'));db['UserFaxQueue']=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x34'));db[_0x251f('0x35')]=db['sequelize']['import'](_0x251f('0x36'));db['UserOpenchannelQueue']=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x37'));db[_0x251f('0x38')]=db['sequelize']['import'](_0x251f('0x39'));db[_0x251f('0x3a')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x3b'));db['MailServerOut']=db[_0x251f('0x3')]['import'](_0x251f('0x3c'));db[_0x251f('0x3d')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x3e'));db[_0x251f('0x3f')]=db[_0x251f('0x3')]['import'](_0x251f('0x40'));db[_0x251f('0x41')]=db[_0x251f('0x3')][_0x251f('0x12')]('../api/mailSubstatus/mailSubstatus.model');db[_0x251f('0x42')]=db[_0x251f('0x3')][_0x251f('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x251f('0x43')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x44'));db[_0x251f('0x45')]=db[_0x251f('0x3')][_0x251f('0x12')]('../api/mailApplication/mailApplication.model');db['MailQueueReport']=db['sequelize'][_0x251f('0x12')](_0x251f('0x46'));db[_0x251f('0x47')]=db[_0x251f('0x3')][_0x251f('0x12')]('../api/dashboard/dashboard.model');db['DashboardItem']=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x48'));db[_0x251f('0x49')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x4a'));db['FaxApplication']=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x4b'));db[_0x251f('0x4c')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x4d'));db[_0x251f('0x4e')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x4f'));db[_0x251f('0x50')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x51'));db['FaxQueueReport']=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x52'));db[_0x251f('0x53')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x54'));db[_0x251f('0x55')]=db['sequelize'][_0x251f('0x12')](_0x251f('0x56'));db[_0x251f('0x57')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x58'));db[_0x251f('0x59')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x5a'));db[_0x251f('0x5b')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x5c'));db[_0x251f('0x5d')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x5e'));db['OpenchannelApplication']=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x5f'));db[_0x251f('0x60')]=db['sequelize'][_0x251f('0x12')](_0x251f('0x61'));db[_0x251f('0x62')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x63'));db[_0x251f('0x64')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x65'));db['ChatWebsite']=db['sequelize'][_0x251f('0x12')](_0x251f('0x66'));db[_0x251f('0x67')]=db[_0x251f('0x3')]['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db['ChatApplication']=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x68'));db[_0x251f('0x69')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x6a'));db[_0x251f('0x6b')]=db[_0x251f('0x3')]['import'](_0x251f('0x6c'));db['ChatOfflineMessage']=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x6d'));db[_0x251f('0x6e')]=db['sequelize'][_0x251f('0x12')]('../api/chatQueue/chatQueue.model');db[_0x251f('0x6f')]=db[_0x251f('0x3')]['import'](_0x251f('0x70'));db[_0x251f('0x71')]=db['sequelize'][_0x251f('0x12')](_0x251f('0x72'));db['CmCompany']=db[_0x251f('0x3')]['import']('../api/cmCompany/cmCompany.model');db[_0x251f('0x73')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x74'));db[_0x251f('0x75')]=db[_0x251f('0x3')][_0x251f('0x12')]('../api/cmHopper/cmHopper.model');db[_0x251f('0x76')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x77'));db[_0x251f('0x78')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x79'));db['CmHopperHistory']=db[_0x251f('0x3')]['import'](_0x251f('0x7a'));db[_0x251f('0x7b')]=db[_0x251f('0x3')][_0x251f('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x251f('0x7c')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x7d'));db[_0x251f('0x7e')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x7f'));db[_0x251f('0x80')]=db['sequelize'][_0x251f('0x12')](_0x251f('0x81'));db['CannedAnswer']=db['sequelize'][_0x251f('0x12')](_0x251f('0x82'));db[_0x251f('0x83')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x84'));db['Condition']=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x85'));db[_0x251f('0x86')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x87'));db[_0x251f('0x88')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x89'));db[_0x251f('0x8a')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x8b'));db[_0x251f('0x8c')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x8d'));db['Schedule']=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x8e'));db[_0x251f('0x8f')]=db[_0x251f('0x3')]['import'](_0x251f('0x90'));db[_0x251f('0x91')]=db[_0x251f('0x3')]['import']('../api/tag/tag.model');db[_0x251f('0x92')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x93'));db['Trigger']=db['sequelize'][_0x251f('0x12')](_0x251f('0x94'));db[_0x251f('0x95')]=db[_0x251f('0x3')][_0x251f('0x12')]('../api/variable/variable.model');db[_0x251f('0x96')]=db['sequelize']['import']('../api/integration/integration.model');db['IntegrationReport']=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x97'));db[_0x251f('0x98')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x99'));db['AnalyticDefaultReport']=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x9a'));db[_0x251f('0x9b')]=db['sequelize']['import']('../api/analyticExtractedReport/analyticExtractedReport.model');db['AnalyticMetric']=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x9c'));db[_0x251f('0x9d')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x9e'));db['AnalyticTreeReport']=db[_0x251f('0x3')]['import']('../api/analyticTreeReport/analyticTreeReport.model');db['SalesforceAccount']=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x9f'));db[_0x251f('0xa0')]=db[_0x251f('0x3')][_0x251f('0x12')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db['SalesforceField']=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0xa1'));db[_0x251f('0xa2')]=db['sequelize'][_0x251f('0x12')](_0x251f('0xa3'));db[_0x251f('0xa4')]=db[_0x251f('0x3')]['import'](_0x251f('0xa5'));db[_0x251f('0xa6')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0xa7'));db[_0x251f('0xa8')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0xa9'));db['DeskConfiguration']=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0xaa'));db[_0x251f('0xab')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0xac'));db['ZohoAccount']=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0xad'));db[_0x251f('0xae')]=db['sequelize'][_0x251f('0x12')](_0x251f('0xaf'));db[_0x251f('0xb0')]=db['sequelize'][_0x251f('0x12')](_0x251f('0xb1'));db['ZendeskAccount']=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0xb2'));db[_0x251f('0xb3')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0xb4'));db[_0x251f('0xb5')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0xb6'));db[_0x251f('0xb7')]=db['sequelize'][_0x251f('0x12')](_0x251f('0xb8'));db['FreshdeskConfiguration']=db['sequelize'][_0x251f('0x12')](_0x251f('0xb9'));db[_0x251f('0xba')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0xbb'));db[_0x251f('0xbc')]=db[_0x251f('0x3')][_0x251f('0x12')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x251f('0xbd')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0xbe'));db[_0x251f('0xbf')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0xc0'));db[_0x251f('0xc1')]=db[_0x251f('0x3')]['import'](_0x251f('0xc2'));db[_0x251f('0xc3')]=db['sequelize'][_0x251f('0x12')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x251f('0xc4')]=db['sequelize'][_0x251f('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x251f('0xc5')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0xc6'));db[_0x251f('0xc7')]=db[_0x251f('0x3')]['import'](_0x251f('0xc8'));db[_0x251f('0xc9')]=db[_0x251f('0x3')][_0x251f('0x12')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x251f('0xca')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0xcb'));db[_0x251f('0xcc')]=db[_0x251f('0x3')]['import'](_0x251f('0xcd'));db[_0x251f('0xce')]=db[_0x251f('0x3')]['import']('../api/intFreshsalesField/intFreshsalesField.model');db['Integration']=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0xcf'));db[_0x251f('0xd0')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0xd1'));db[_0x251f('0xd2')]=db[_0x251f('0x3')]['import'](_0x251f('0xd3'));db[_0x251f('0xd4')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0xd5'));db[_0x251f('0xd6')]=db[_0x251f('0x3')][_0x251f('0x12')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x251f('0xd7')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0xd8'));db[_0x251f('0xd9')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0xda'));db[_0x251f('0xdb')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0xdc'));db[_0x251f('0xdd')]=db[_0x251f('0x3')]['import'](_0x251f('0xde'));db[_0x251f('0xdf')]=db[_0x251f('0x3')][_0x251f('0x12')]('../api/squareReportDetail/squareReportDetail.model');db[_0x251f('0xe0')]=db[_0x251f('0x3')]['import'](_0x251f('0xe1'));db[_0x251f('0xe2')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0xe3'));db[_0x251f('0xe4')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0xe5'));db[_0x251f('0xe6')]=db['sequelize'][_0x251f('0x12')](_0x251f('0xe7'));db[_0x251f('0xe8')]=db['sequelize'][_0x251f('0x12')](_0x251f('0xe9'));db['SquareMessage']=db['sequelize'][_0x251f('0x12')]('../api/squareMessage/squareMessage.model');db[_0x251f('0xea')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0xeb'));db[_0x251f('0xec')]=db[_0x251f('0x3')]['import'](_0x251f('0xed'));db[_0x251f('0xee')]=db['sequelize']['import'](_0x251f('0xef'));db[_0x251f('0xf0')]=db[_0x251f('0x3')][_0x251f('0x12')]('../api/migration/migration.model');db['Attachment']=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0xf1'));db[_0x251f('0xf2')]=db[_0x251f('0x3')][_0x251f('0x12')]('../api/plugin/plugin.model');db[_0x251f('0xf3')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0xf4'));db[_0x251f('0xf5')]=db['sequelize'][_0x251f('0x12')](_0x251f('0xf6'));db[_0x251f('0xf7')]=db['sequelize'][_0x251f('0x12')](_0x251f('0xf8'));db[_0x251f('0xf9')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0xfa'));db[_0x251f('0xfb')]=db['sequelize']['import']('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db[_0x251f('0x3')]['import'](_0x251f('0xfc'));db[_0x251f('0xfd')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0xfe'));db[_0x251f('0xff')]=db[_0x251f('0x3')][_0x251f('0x12')]('../api/userProfile/userProfile.model');db[_0x251f('0x100')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x101'));db[_0x251f('0x102')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x103'));db[_0x251f('0x104')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x105'));db[_0x251f('0x106')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x107'));db[_0x251f('0x108')]=db[_0x251f('0x3')]['import'](_0x251f('0x109'));db[_0x251f('0x10a')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x10b'));db['WhatsappMessage']=db['sequelize'][_0x251f('0x12')](_0x251f('0x10c'));db[_0x251f('0x10d')]=db[_0x251f('0x3')]['import'](_0x251f('0x10e'));db['WhatsappTransferReport']=db[_0x251f('0x3')]['import'](_0x251f('0x10f'));db['WhatsappQueue']=db['sequelize']['import'](_0x251f('0x110'));db[_0x251f('0x111')]=db['sequelize']['import']('../api/cloudProvider/cloudProvider.model');db[_0x251f('0x112')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x113'));db[_0x251f('0x114')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x115'));db['UserVoicePrefix']=db[_0x251f('0x3')][_0x251f('0x12')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0x251f('0x116')]=db[_0x251f('0x3')][_0x251f('0x12')](_0x251f('0x117'));db['User'][_0x251f('0x118')](db['VoiceMail'],{'as':_0x251f('0x1d'),'onDelete':'cascade','foreignKey':_0x251f('0x119')});db[_0x251f('0x11')][_0x251f('0x118')](db[_0x251f('0x116')],{'as':_0x251f('0x11a'),'onDelete':'cascade','foreignKey':_0x251f('0x119')});db['User'][_0x251f('0x11b')](db[_0x251f('0x1a')],{'as':'Recordings','foreignKey':_0x251f('0x119')});db[_0x251f('0x11')]['hasMany'](db['UserVoiceQueueRt'],{'as':_0x251f('0x11c'),'foreignKey':_0x251f('0x119')});db[_0x251f('0x11')][_0x251f('0x11b')](db['VoiceExtension'],{'as':'Extensions','onDelete':_0x251f('0x11d'),'hooks':!![]});db[_0x251f('0x11')]['hasMany'](db[_0x251f('0x78')],{'as':_0x251f('0x11e'),'foreignKey':_0x251f('0x119')});db['User'][_0x251f('0x11b')](db['CmHopperHistory'],{'as':_0x251f('0x11f'),'foreignKey':_0x251f('0x119')});db[_0x251f('0x11')]['hasMany'](db[_0x251f('0x7b')],{'as':_0x251f('0x7b'),'foreignKey':_0x251f('0x119')});db[_0x251f('0x11')][_0x251f('0x11b')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':_0x251f('0x119')});db[_0x251f('0x11')][_0x251f('0x11b')](db['ChatInteraction'],{'as':_0x251f('0x120'),'foreignKey':_0x251f('0x119')});db['User']['hasMany'](db[_0x251f('0x57')],{'as':'SmsInteractions','foreignKey':'UserId'});db[_0x251f('0x11')][_0x251f('0x11b')](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':_0x251f('0x119')});db['User'][_0x251f('0x11b')](db[_0x251f('0x42')],{'as':_0x251f('0x121'),'foreignKey':_0x251f('0x119')});db['User']['hasMany'](db['WhatsappInteraction'],{'as':_0x251f('0x122'),'foreignKey':_0x251f('0x119')});db[_0x251f('0x11')][_0x251f('0x11b')](db[_0x251f('0x104')],{'as':_0x251f('0x123'),'foreignKey':_0x251f('0x124')});db[_0x251f('0x11')][_0x251f('0x125')](db['UserProfile'],{'as':_0x251f('0xff'),'foreignKey':'userProfileId'});db['User'][_0x251f('0x126')](db[_0x251f('0x6f')],{'as':_0x251f('0x127'),'through':_0x251f('0x128')});db[_0x251f('0x11')][_0x251f('0x126')](db[_0x251f('0x73')],{'as':_0x251f('0x129'),'through':_0x251f('0x12a')});db['User'][_0x251f('0x126')](db[_0x251f('0x12b')],{'as':'Lists','through':_0x251f('0x12c')});db[_0x251f('0x11')][_0x251f('0x126')](db[_0x251f('0xea')],{'through':_0x251f('0x12d')});db['User'][_0x251f('0x126')](db[_0x251f('0x42')],{'as':_0x251f('0x121'),'through':_0x251f('0x12e')});db[_0x251f('0x11')][_0x251f('0x126')](db[_0x251f('0x69')],{'as':_0x251f('0x120'),'through':_0x251f('0x12f')});db[_0x251f('0x11')][_0x251f('0x126')](db[_0x251f('0x4c')],{'as':_0x251f('0x130'),'through':_0x251f('0x131')});db[_0x251f('0x11')][_0x251f('0x126')](db[_0x251f('0x57')],{'as':'SmsInteractions','through':'user_has_sms_interactions'});db[_0x251f('0x11')][_0x251f('0x126')](db[_0x251f('0x60')],{'as':_0x251f('0x132'),'through':_0x251f('0x133')});db[_0x251f('0x11')][_0x251f('0x126')](db[_0x251f('0x10a')],{'as':_0x251f('0x122'),'through':_0x251f('0x134')});db[_0x251f('0x11')][_0x251f('0x126')](db['VoiceQueue'],{'as':_0x251f('0x135'),'through':'UserVoiceQueue','required':![]});db[_0x251f('0x11')][_0x251f('0x126')](db[_0x251f('0xfd')],{'as':'VoicePrefixes','through':'UserVoicePrefix','required':![]});db['User']['belongsToMany'](db[_0x251f('0x3f')],{'as':_0x251f('0x136'),'through':_0x251f('0x32'),'required':![]});db[_0x251f('0x11')][_0x251f('0x126')](db[_0x251f('0x6e')],{'as':'ChatQueues','through':'UserChatQueue','required':![],'hooks':!![]});db['User']['belongsToMany'](db[_0x251f('0x50')],{'as':_0x251f('0x137'),'through':_0x251f('0x138'),'required':![]});db['User'][_0x251f('0x126')](db[_0x251f('0x5b')],{'as':_0x251f('0x139'),'through':_0x251f('0x35'),'required':![]});db[_0x251f('0x11')]['belongsToMany'](db[_0x251f('0x64')],{'as':_0x251f('0x13a'),'through':'UserOpenchannelQueue','required':![]});db[_0x251f('0x11')][_0x251f('0x126')](db[_0x251f('0x13b')],{'as':_0x251f('0x13c'),'through':_0x251f('0x38'),'required':![]});db[_0x251f('0x11')][_0x251f('0x126')](db[_0x251f('0x12b')],{'through':'cm_user_has_lists'});db['User'][_0x251f('0x126')](db[_0x251f('0x13d')],{'as':_0x251f('0x13e'),'through':'user_has_chat_websites'});db[_0x251f('0x11')][_0x251f('0x126')](db[_0x251f('0x49')],{'as':_0x251f('0x13f'),'through':'user_has_fax_accounts'});db[_0x251f('0x11')][_0x251f('0x126')](db[_0x251f('0x3d')],{'as':_0x251f('0x140'),'through':_0x251f('0x141')});db[_0x251f('0x11')][_0x251f('0x126')](db[_0x251f('0x5d')],{'as':'OpenchannelAccounts','through':'user_has_openchannel_accounts'});db[_0x251f('0x11')][_0x251f('0x126')](db[_0x251f('0x53')],{'as':'SmsAccounts','through':_0x251f('0x142')});db[_0x251f('0x11')]['belongsToMany'](db['WhatsappAccount'],{'as':_0x251f('0x143'),'through':_0x251f('0x144')});db[_0x251f('0x11')][_0x251f('0x126')](db['SquareProject'],{'as':_0x251f('0x145'),'through':_0x251f('0x146')});db['VoiceChanSpy'][_0x251f('0x11b')](db['VoiceExtension'],{'as':_0x251f('0x147'),'onDelete':_0x251f('0x11d'),'foreignKey':_0x251f('0x148')});db[_0x251f('0x14')][_0x251f('0x11b')](db[_0x251f('0x149')],{'onDelete':_0x251f('0x11d')});db[_0x251f('0x149')][_0x251f('0x11b')](db[_0x251f('0x149')],{'as':_0x251f('0x14a'),'onDelete':_0x251f('0x11d')});db['VoiceMusicOnHold'][_0x251f('0x126')](db[_0x251f('0x8f')],{'as':'Sounds','through':_0x251f('0x14b')});db[_0x251f('0x18')][_0x251f('0x11b')](db['UserVoiceQueueRt'],{'as':_0x251f('0x14c'),'foreignKey':_0x251f('0x14d')});db[_0x251f('0x18')][_0x251f('0x11b')](db[_0x251f('0x75')],{'as':'Hoppers','foreignKey':_0x251f('0x14d')});db[_0x251f('0x18')][_0x251f('0x11b')](db[_0x251f('0x78')],{'as':_0x251f('0x11e'),'foreignKey':_0x251f('0x14d')});db[_0x251f('0x18')][_0x251f('0x11b')](db[_0x251f('0x14e')],{'as':_0x251f('0x14f'),'foreignKey':_0x251f('0x14d')});db[_0x251f('0x18')][_0x251f('0x11b')](db[_0x251f('0x7b')],{'as':'ReportAgentPreview','foreignKey':'VoiceQueueId'});db[_0x251f('0x18')][_0x251f('0x11b')](db[_0x251f('0x76')],{'as':'HopperBlacks','foreignKey':_0x251f('0x14d')});db[_0x251f('0x18')][_0x251f('0x11b')](db[_0x251f('0xd9')],{'as':_0x251f('0x150'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x251f('0x125')](db['Trunk'],{'as':_0x251f('0x29'),'foreignKey':_0x251f('0x151')});db[_0x251f('0x18')]['belongsTo'](db['Trunk'],{'as':_0x251f('0x152'),'foreignKey':_0x251f('0x153')});db[_0x251f('0x18')]['belongsTo'](db['Interval'],{'as':_0x251f('0x86'),'foreignKey':'IntervalId'});db[_0x251f('0x18')][_0x251f('0x125')](db[_0x251f('0x88')],{'as':_0x251f('0x154'),'foreignKey':_0x251f('0x155')});db[_0x251f('0x18')][_0x251f('0x126')](db[_0x251f('0x12b')],{'as':_0x251f('0x156'),'through':_0x251f('0x157')});db[_0x251f('0x18')]['belongsToMany'](db[_0x251f('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db['VoiceQueue'][_0x251f('0x126')](db[_0x251f('0xea')],{'as':_0x251f('0x158'),'through':_0x251f('0x112')});db[_0x251f('0x18')]['belongsToMany'](db[_0x251f('0x12b')],{'as':_0x251f('0x159'),'through':'voice_queues_has_cm_blacklists'});db['VoiceRecording'][_0x251f('0x125')](db[_0x251f('0x11')],{'as':'User','foreignKey':_0x251f('0x119')});db[_0x251f('0x15a')][_0x251f('0x125')](db[_0x251f('0x11')],{'as':_0x251f('0x11'),'foreignKey':_0x251f('0x119')});db['VoiceMail'][_0x251f('0x11b')](db['VoiceMailMessage'],{'as':'Messages','onDelete':_0x251f('0x11d'),'foreignKey':_0x251f('0x15b'),'sourceKey':_0x251f('0x15c')});db[_0x251f('0x1f')][_0x251f('0x125')](db['VoiceMail'],{'foreignKey':_0x251f('0x15b'),'targetKey':_0x251f('0x15c')});db[_0x251f('0x20')][_0x251f('0x11b')](db['VoiceQueueReport'],{'as':_0x251f('0x15d'),'foreignKey':_0x251f('0x15e'),'constraints':![]});db[_0x251f('0x20')][_0x251f('0x11b')](db[_0x251f('0x15f')],{'as':'AgentReports','foreignKey':_0x251f('0x15e'),'constraints':![]});db['VoiceCallReport'][_0x251f('0x125')](db[_0x251f('0x11')],{'as':_0x251f('0x11'),'foreignKey':_0x251f('0x119')});db[_0x251f('0x20')][_0x251f('0x125')](db[_0x251f('0x73')],{'as':_0x251f('0x160'),'foreignKey':_0x251f('0x161')});db[_0x251f('0x3a')][_0x251f('0x125')](db[_0x251f('0x3d')],{'as':_0x251f('0x3d'),'foreignKey':_0x251f('0x162')});db[_0x251f('0x3a')]['belongsTo'](db[_0x251f('0x111')],{'as':_0x251f('0x111'),'foreignKey':_0x251f('0x163'),'onDelete':_0x251f('0x164')});db[_0x251f('0x165')][_0x251f('0x125')](db[_0x251f('0x3d')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x251f('0x165')][_0x251f('0x125')](db['CloudProvider'],{'as':_0x251f('0x111'),'foreignKey':_0x251f('0x163'),'onDelete':'restrict'});db[_0x251f('0x3d')][_0x251f('0x118')](db['MailServerIn'],{'as':_0x251f('0x166'),'onDelete':_0x251f('0x11d')});db[_0x251f('0x3d')]['hasOne'](db['MailServerOut'],{'as':_0x251f('0x167'),'onDelete':_0x251f('0x11d')});db[_0x251f('0x3d')][_0x251f('0x11b')](db['Disposition'],{'as':_0x251f('0x168'),'foreignKey':_0x251f('0x162'),'onDelete':_0x251f('0x11d')});db['MailAccount'][_0x251f('0x11b')](db[_0x251f('0x169')],{'as':'Answers','foreignKey':_0x251f('0x162')});db[_0x251f('0x3d')][_0x251f('0x11b')](db['MailMessage'],{'as':'Messages','foreignKey':_0x251f('0x162')});db[_0x251f('0x3d')]['hasMany'](db['MailInteraction'],{'as':_0x251f('0x16a')});db[_0x251f('0x3d')][_0x251f('0x11b')](db[_0x251f('0x45')],{'as':_0x251f('0x14a')});db['MailAccount']['belongsTo'](db[_0x251f('0x12b')],{'as':_0x251f('0x16b'),'foreignKey':_0x251f('0x16c')});db[_0x251f('0x3d')][_0x251f('0x125')](db[_0x251f('0x92')],{'as':'Template','foreignKey':_0x251f('0x16d')});db[_0x251f('0x3d')][_0x251f('0x125')](db[_0x251f('0x88')],{'as':_0x251f('0x154'),'foreignKey':_0x251f('0x155')});db[_0x251f('0x3d')][_0x251f('0x126')](db[_0x251f('0x11')],{'as':_0x251f('0x16e'),'through':_0x251f('0x141')});db[_0x251f('0x3f')][_0x251f('0x126')](db[_0x251f('0x11')],{'as':_0x251f('0x16e'),'through':_0x251f('0x32')});db[_0x251f('0x3f')]['belongsToMany'](db[_0x251f('0xea')],{'through':_0x251f('0x16f'),'as':_0x251f('0x158')});db['MailInteraction'][_0x251f('0x11b')](db[_0x251f('0x43')],{'as':'Messages','onDelete':_0x251f('0x11d'),'foreignKey':_0x251f('0x170')});db[_0x251f('0x42')][_0x251f('0x125')](db[_0x251f('0x3d')],{'as':_0x251f('0x171'),'foreignKey':_0x251f('0x162')});db['MailInteraction'][_0x251f('0x125')](db[_0x251f('0x73')],{'as':_0x251f('0x160'),'foreignKey':_0x251f('0x161')});db[_0x251f('0x42')][_0x251f('0x125')](db[_0x251f('0x11')],{'as':_0x251f('0x172'),'foreignKey':_0x251f('0x119')});db[_0x251f('0x42')][_0x251f('0x126')](db[_0x251f('0x91')],{'through':_0x251f('0x173'),'as':_0x251f('0x174')});db[_0x251f('0x42')][_0x251f('0x126')](db['Tag'],{'through':_0x251f('0x173'),'as':_0x251f('0x175')});db['MailInteraction'][_0x251f('0x126')](db[_0x251f('0x11')],{'as':'Users','through':_0x251f('0x12e'),'foreignKey':_0x251f('0x170')});db[_0x251f('0x43')][_0x251f('0x11b')](db[_0x251f('0x176')],{'as':_0x251f('0x177'),'onDelete':_0x251f('0x11d')});db['MailMessage'][_0x251f('0x125')](db['User'],{'as':_0x251f('0x11')});db[_0x251f('0x43')]['belongsTo'](db[_0x251f('0x73')],{'onDelete':_0x251f('0x11d'),'as':'Contact'});db[_0x251f('0x43')][_0x251f('0x125')](db['MailInteraction'],{'as':_0x251f('0x178'),'foreignKey':_0x251f('0x170')});db[_0x251f('0x43')]['belongsTo'](db[_0x251f('0x3d')],{'as':_0x251f('0x171'),'foreignKey':_0x251f('0x162')});db[_0x251f('0x43')][_0x251f('0x125')](db[_0x251f('0x13d')],{'as':'ChatWebsite','foreignKey':_0x251f('0x179')});db[_0x251f('0x43')]['belongsTo'](db['ChatOfflineMessage'],{'as':_0x251f('0x17a'),'foreignKey':_0x251f('0x17b')});db[_0x251f('0x45')][_0x251f('0x125')](db['User'],{'onDelete':_0x251f('0x164')});db[_0x251f('0x45')][_0x251f('0x125')](db[_0x251f('0x3f')],{'onDelete':_0x251f('0x164')});db[_0x251f('0x45')][_0x251f('0x125')](db['MailAccount'],{'onDelete':_0x251f('0x164')});db[_0x251f('0x45')]['belongsTo'](db[_0x251f('0x86')],{'onDelete':_0x251f('0x164'),'foreignKey':'IntervalId'});db[_0x251f('0x45')][_0x251f('0x125')](db[_0x251f('0x91')],{'onDelete':_0x251f('0x164'),'foreignKey':_0x251f('0x17c')});db[_0x251f('0x17d')][_0x251f('0x125')](db[_0x251f('0x3d')],{});db['MailQueueReport'][_0x251f('0x125')](db[_0x251f('0x12b')],{'as':'List','foreignKey':_0x251f('0x16c')});db[_0x251f('0x17d')][_0x251f('0x125')](db[_0x251f('0x73')],{'as':_0x251f('0x160'),'foreignKey':_0x251f('0x161')});db['MailQueueReport'][_0x251f('0x125')](db[_0x251f('0x42')],{});db[_0x251f('0x17d')][_0x251f('0x125')](db['MailMessage'],{});db[_0x251f('0x17d')][_0x251f('0x125')](db[_0x251f('0x11')],{});db[_0x251f('0x17d')][_0x251f('0x125')](db['MailQueue'],{});db[_0x251f('0x47')][_0x251f('0x11b')](db[_0x251f('0x17e')],{'as':'Items','onDelete':_0x251f('0x11d')});db[_0x251f('0x49')]['hasMany'](db[_0x251f('0x83')],{'as':'Dispositions','foreignKey':_0x251f('0x17f'),'onDelete':'cascade'});db['FaxAccount'][_0x251f('0x11b')](db[_0x251f('0x169')],{'as':'Answers','foreignKey':'FaxAccountId'});db[_0x251f('0x49')][_0x251f('0x11b')](db['FaxInteraction'],{'as':_0x251f('0x16a')});db[_0x251f('0x49')][_0x251f('0x11b')](db[_0x251f('0x180')],{'as':_0x251f('0x14a')});db[_0x251f('0x49')][_0x251f('0x11b')](db[_0x251f('0x149')],{'as':'Exntensions','onDelete':_0x251f('0x11d')});db['FaxAccount'][_0x251f('0x11b')](db['FaxMessage'],{'as':'Messages'});db[_0x251f('0x49')][_0x251f('0x125')](db[_0x251f('0x29')],{'as':'Trunk'});db[_0x251f('0x49')][_0x251f('0x125')](db[_0x251f('0x12b')],{'as':_0x251f('0x16b'),'foreignKey':'ListId'});db[_0x251f('0x49')][_0x251f('0x125')](db[_0x251f('0x88')],{'as':'mandatoryDispositionPause','foreignKey':_0x251f('0x155')});db[_0x251f('0x49')][_0x251f('0x126')](db['User'],{'as':_0x251f('0x16e'),'through':_0x251f('0x181')});db[_0x251f('0x180')][_0x251f('0x125')](db['User'],{'onDelete':_0x251f('0x164')});db[_0x251f('0x180')][_0x251f('0x125')](db[_0x251f('0x50')],{'onDelete':_0x251f('0x164')});db[_0x251f('0x180')][_0x251f('0x125')](db[_0x251f('0x49')],{'onDelete':_0x251f('0x164')});db['FaxApplication'][_0x251f('0x125')](db['Tag'],{'onDelete':_0x251f('0x164'),'foreignKey':_0x251f('0x17c')});db[_0x251f('0x4c')][_0x251f('0x11b')](db[_0x251f('0x4e')],{'as':_0x251f('0x182'),'onDelete':_0x251f('0x11d'),'foreignKey':_0x251f('0x183')});db[_0x251f('0x4c')][_0x251f('0x125')](db[_0x251f('0x49')],{'as':_0x251f('0x171'),'foreignKey':_0x251f('0x17f')});db[_0x251f('0x4c')]['belongsTo'](db[_0x251f('0x73')],{'as':_0x251f('0x160'),'foreignKey':'ContactId'});db[_0x251f('0x4c')][_0x251f('0x125')](db[_0x251f('0x11')],{'as':'Owner','foreignKey':_0x251f('0x119')});db[_0x251f('0x4c')][_0x251f('0x126')](db[_0x251f('0x91')],{'through':_0x251f('0x184'),'as':_0x251f('0x174')});db[_0x251f('0x4c')][_0x251f('0x126')](db[_0x251f('0x91')],{'through':_0x251f('0x184'),'as':'ThroughTags'});db[_0x251f('0x4c')][_0x251f('0x126')](db[_0x251f('0x11')],{'as':_0x251f('0x185'),'through':'user_has_fax_interactions','foreignKey':_0x251f('0x183')});db['FaxMessage']['belongsTo'](db['User'],{'onDelete':_0x251f('0x11d'),'as':_0x251f('0x11')});db['FaxMessage'][_0x251f('0x125')](db[_0x251f('0x4c')],{'as':_0x251f('0x178'),'foreignKey':_0x251f('0x183')});db[_0x251f('0x4e')][_0x251f('0x125')](db[_0x251f('0x73')],{'onDelete':_0x251f('0x11d'),'as':_0x251f('0x160')});db[_0x251f('0x4e')][_0x251f('0x125')](db[_0x251f('0x176')],{'as':_0x251f('0x176'),'foreignKey':_0x251f('0x186')});db[_0x251f('0x4e')][_0x251f('0x125')](db['FaxAccount'],{'as':_0x251f('0x171'),'foreignKey':_0x251f('0x17f')});db[_0x251f('0x50')]['belongsToMany'](db[_0x251f('0x11')],{'as':_0x251f('0x16e'),'through':_0x251f('0x138')});db[_0x251f('0x50')][_0x251f('0x126')](db['Team'],{'through':'team_has_fax_queues','as':_0x251f('0x158')});db[_0x251f('0x187')][_0x251f('0x125')](db[_0x251f('0x49')],{});db[_0x251f('0x187')][_0x251f('0x125')](db['CmList'],{'as':'List','foreignKey':_0x251f('0x16c')});db[_0x251f('0x187')][_0x251f('0x125')](db[_0x251f('0x73')],{'as':_0x251f('0x160'),'foreignKey':'ContactId'});db['FaxQueueReport'][_0x251f('0x125')](db[_0x251f('0x4c')],{});db[_0x251f('0x187')][_0x251f('0x125')](db[_0x251f('0x4e')],{});db[_0x251f('0x187')][_0x251f('0x125')](db[_0x251f('0x11')],{});db[_0x251f('0x187')][_0x251f('0x125')](db[_0x251f('0x50')],{});db[_0x251f('0x53')][_0x251f('0x11b')](db['Disposition'],{'as':_0x251f('0x168'),'foreignKey':_0x251f('0x188'),'onDelete':'cascade'});db[_0x251f('0x53')][_0x251f('0x11b')](db[_0x251f('0x169')],{'as':_0x251f('0x189'),'foreignKey':'SmsAccountId'});db[_0x251f('0x53')]['hasMany'](db[_0x251f('0x59')],{'as':'Messages','foreignKey':_0x251f('0x188')});db['SmsAccount'][_0x251f('0x11b')](db['SmsInteraction'],{'as':_0x251f('0x16a')});db[_0x251f('0x53')][_0x251f('0x11b')](db['SmsApplication'],{'as':_0x251f('0x14a')});db[_0x251f('0x53')][_0x251f('0x125')](db[_0x251f('0x12b')],{'as':_0x251f('0x16b'),'foreignKey':_0x251f('0x16c')});db['SmsAccount'][_0x251f('0x125')](db[_0x251f('0x88')],{'as':_0x251f('0x154'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x251f('0x53')]['belongsToMany'](db[_0x251f('0x11')],{'as':_0x251f('0x16e'),'through':_0x251f('0x142')});db[_0x251f('0x55')][_0x251f('0x125')](db[_0x251f('0x11')],{'onDelete':_0x251f('0x164')});db[_0x251f('0x55')]['belongsTo'](db[_0x251f('0x5b')],{'onDelete':_0x251f('0x164')});db[_0x251f('0x55')]['belongsTo'](db[_0x251f('0x53')],{'onDelete':_0x251f('0x164')});db[_0x251f('0x55')][_0x251f('0x125')](db[_0x251f('0x86')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x251f('0x55')][_0x251f('0x125')](db[_0x251f('0x91')],{'onDelete':'restrict','foreignKey':'TagId'});db['SmsInteraction'][_0x251f('0x11b')](db['SmsMessage'],{'as':_0x251f('0x182'),'onDelete':_0x251f('0x11d'),'foreignKey':_0x251f('0x18a')});db[_0x251f('0x57')]['belongsTo'](db['SmsAccount'],{'as':'Account','foreignKey':_0x251f('0x188')});db[_0x251f('0x57')][_0x251f('0x125')](db[_0x251f('0x73')],{'as':_0x251f('0x160'),'foreignKey':_0x251f('0x161')});db['SmsInteraction'][_0x251f('0x125')](db['User'],{'as':_0x251f('0x172'),'foreignKey':_0x251f('0x119')});db[_0x251f('0x57')][_0x251f('0x126')](db[_0x251f('0x91')],{'through':_0x251f('0x18b'),'as':_0x251f('0x174')});db[_0x251f('0x57')][_0x251f('0x126')](db[_0x251f('0x91')],{'through':_0x251f('0x18b'),'as':_0x251f('0x175')});db[_0x251f('0x57')][_0x251f('0x126')](db[_0x251f('0x11')],{'as':_0x251f('0x185'),'through':'user_has_sms_interactions','foreignKey':'SmsInteractionId'});db['SmsMessage'][_0x251f('0x125')](db[_0x251f('0x11')],{'as':_0x251f('0x11')});db[_0x251f('0x59')][_0x251f('0x125')](db[_0x251f('0x73')],{'onDelete':'cascade','as':'Contact'});db[_0x251f('0x59')]['belongsTo'](db[_0x251f('0x57')],{'onDelete':_0x251f('0x11d'),'as':_0x251f('0x178'),'foreignKey':_0x251f('0x18a')});db[_0x251f('0x59')][_0x251f('0x125')](db['SmsAccount'],{'as':_0x251f('0x171'),'foreignKey':_0x251f('0x188')});db[_0x251f('0x5b')]['belongsToMany'](db[_0x251f('0x11')],{'as':_0x251f('0x16e'),'through':_0x251f('0x35'),'foreignKey':_0x251f('0x18c')});db[_0x251f('0x5b')][_0x251f('0x126')](db[_0x251f('0xea')],{'through':'team_has_sms_queues','as':_0x251f('0x158')});db[_0x251f('0x5d')][_0x251f('0x11b')](db[_0x251f('0x83')],{'as':_0x251f('0x168'),'foreignKey':'OpenchannelAccountId','onDelete':_0x251f('0x11d')});db['OpenchannelAccount']['hasMany'](db[_0x251f('0x169')],{'as':_0x251f('0x189'),'foreignKey':_0x251f('0x18d')});db[_0x251f('0x5d')][_0x251f('0x11b')](db[_0x251f('0x60')],{'as':_0x251f('0x16a'),'foreignKey':_0x251f('0x18d')});db[_0x251f('0x5d')][_0x251f('0x11b')](db[_0x251f('0x62')],{'as':_0x251f('0x182'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x251f('0x11b')](db[_0x251f('0x18e')],{'as':_0x251f('0x14a'),'foreignKey':_0x251f('0x18d')});db[_0x251f('0x5d')][_0x251f('0x125')](db['CmList'],{'as':_0x251f('0x16b'),'foreignKey':_0x251f('0x16c')});db[_0x251f('0x5d')][_0x251f('0x125')](db[_0x251f('0x88')],{'as':'mandatoryDispositionPause','foreignKey':_0x251f('0x155')});db[_0x251f('0x5d')][_0x251f('0x126')](db['User'],{'as':_0x251f('0x16e'),'through':_0x251f('0x18f')});db[_0x251f('0x18e')]['belongsTo'](db[_0x251f('0x11')],{'onDelete':'restrict'});db[_0x251f('0x18e')]['belongsTo'](db[_0x251f('0x64')],{'onDelete':_0x251f('0x164'),'foreignKey':'OpenchannelQueueId'});db['OpenchannelApplication'][_0x251f('0x125')](db[_0x251f('0x5d')],{'onDelete':_0x251f('0x164'),'foreignKey':'OpenchannelAccountId'});db[_0x251f('0x18e')]['belongsTo'](db['Interval'],{'onDelete':_0x251f('0x164'),'foreignKey':_0x251f('0x190')});db[_0x251f('0x18e')][_0x251f('0x125')](db[_0x251f('0x91')],{'onDelete':_0x251f('0x164'),'foreignKey':_0x251f('0x17c')});db['OpenchannelInteraction'][_0x251f('0x11b')](db[_0x251f('0x62')],{'as':'Messages','onDelete':_0x251f('0x11d'),'foreignKey':_0x251f('0x191')});db[_0x251f('0x60')][_0x251f('0x125')](db[_0x251f('0x5d')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0x251f('0x60')]['belongsTo'](db[_0x251f('0x73')],{'as':_0x251f('0x160'),'foreignKey':_0x251f('0x161')});db[_0x251f('0x60')][_0x251f('0x125')](db[_0x251f('0x11')],{'as':_0x251f('0x172'),'foreignKey':_0x251f('0x119')});db['OpenchannelInteraction'][_0x251f('0x126')](db[_0x251f('0x91')],{'through':_0x251f('0x192'),'as':_0x251f('0x174')});db[_0x251f('0x60')][_0x251f('0x126')](db[_0x251f('0x91')],{'through':_0x251f('0x192'),'as':'ThroughTags'});db[_0x251f('0x60')][_0x251f('0x126')](db[_0x251f('0x11')],{'as':_0x251f('0x185'),'through':'user_has_openchannel_interactions','foreignKey':_0x251f('0x191')});db[_0x251f('0x62')][_0x251f('0x125')](db[_0x251f('0x11')],{'onDelete':_0x251f('0x11d'),'as':_0x251f('0x11')});db[_0x251f('0x62')][_0x251f('0x125')](db['CmContact'],{'onDelete':_0x251f('0x11d'),'as':_0x251f('0x160')});db[_0x251f('0x62')]['belongsTo'](db[_0x251f('0x60')],{'onDelete':_0x251f('0x11d'),'as':_0x251f('0x178'),'foreignKey':_0x251f('0x191')});db['OpenchannelMessage'][_0x251f('0x125')](db['Attachment'],{'as':_0x251f('0x176'),'foreignKey':_0x251f('0x186')});db['OpenchannelMessage'][_0x251f('0x125')](db[_0x251f('0x5d')],{'as':'Account','foreignKey':_0x251f('0x18d')});db[_0x251f('0x64')]['belongsToMany'](db['User'],{'as':_0x251f('0x16e'),'through':'UserOpenchannelQueue','foreignKey':_0x251f('0x193')});db[_0x251f('0x64')][_0x251f('0x126')](db[_0x251f('0xea')],{'through':'team_has_openchannel_queues','as':_0x251f('0x158')});db[_0x251f('0x13d')]['hasMany'](db[_0x251f('0x83')],{'as':'Dispositions','foreignKey':_0x251f('0x179'),'onDelete':_0x251f('0x11d')});db['ChatWebsite'][_0x251f('0x11b')](db[_0x251f('0x169')],{'as':'Answers','foreignKey':_0x251f('0x179')});db[_0x251f('0x13d')][_0x251f('0x11b')](db['ChatProactiveAction'],{'as':_0x251f('0x194')});db[_0x251f('0x13d')]['hasMany'](db['ChatInteraction'],{'as':'Interactions'});db['ChatWebsite'][_0x251f('0x11b')](db[_0x251f('0x195')],{'as':_0x251f('0x14a')});db[_0x251f('0x13d')][_0x251f('0x11b')](db[_0x251f('0x6b')],{'as':_0x251f('0x182')});db[_0x251f('0x13d')][_0x251f('0x125')](db['CmList'],{'as':_0x251f('0x16b'),'foreignKey':'ListId'});db[_0x251f('0x13d')]['belongsTo'](db[_0x251f('0x86')],{'as':_0x251f('0x86'),'foreignKey':'IntervalId'});db[_0x251f('0x13d')]['belongsTo'](db[_0x251f('0x3d')],{'as':_0x251f('0x3d'),'foreignKey':_0x251f('0x162')});db[_0x251f('0x13d')]['belongsTo'](db['Pause'],{'as':_0x251f('0x154'),'foreignKey':_0x251f('0x155')});db[_0x251f('0x13d')][_0x251f('0x126')](db['User'],{'as':_0x251f('0x16e'),'through':_0x251f('0x196')});db[_0x251f('0x67')][_0x251f('0x125')](db[_0x251f('0x5d')],{});db[_0x251f('0x67')][_0x251f('0x125')](db[_0x251f('0x12b')],{'as':_0x251f('0x16b'),'foreignKey':_0x251f('0x16c')});db['OpenchannelQueueReport']['belongsTo'](db[_0x251f('0x73')],{'as':_0x251f('0x160'),'foreignKey':_0x251f('0x161')});db[_0x251f('0x67')][_0x251f('0x125')](db['OpenchannelInteraction'],{});db[_0x251f('0x67')][_0x251f('0x125')](db['OpenchannelMessage'],{});db['OpenchannelQueueReport'][_0x251f('0x125')](db['User'],{});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelQueue'],{});db[_0x251f('0x195')][_0x251f('0x125')](db[_0x251f('0x11')],{'as':_0x251f('0x197'),'foreignKey':_0x251f('0x119'),'onDelete':_0x251f('0x164')});db[_0x251f('0x195')][_0x251f('0x125')](db['ChatQueue'],{'as':_0x251f('0x198'),'foreignKey':_0x251f('0x199'),'onDelete':_0x251f('0x164')});db[_0x251f('0x195')][_0x251f('0x125')](db[_0x251f('0x13d')],{'as':'Website','foreignKey':_0x251f('0x179'),'onDelete':_0x251f('0x164')});db[_0x251f('0x195')][_0x251f('0x125')](db[_0x251f('0x91')],{'onDelete':'restrict','foreignKey':_0x251f('0x17c')});db['ChatInteraction']['hasMany'](db[_0x251f('0x6b')],{'as':_0x251f('0x182'),'onDelete':_0x251f('0x11d'),'foreignKey':_0x251f('0x19a')});db[_0x251f('0x69')][_0x251f('0x125')](db[_0x251f('0x13d')],{'as':_0x251f('0x171'),'foreignKey':'ChatWebsiteId'});db['ChatInteraction']['belongsTo'](db[_0x251f('0x73')],{'as':_0x251f('0x160'),'foreignKey':_0x251f('0x161')});db[_0x251f('0x69')][_0x251f('0x125')](db[_0x251f('0x11')],{'as':_0x251f('0x172'),'foreignKey':'UserId'});db[_0x251f('0x69')][_0x251f('0x126')](db[_0x251f('0x91')],{'through':'chat_interaction_has_tags','as':_0x251f('0x174')});db[_0x251f('0x69')]['belongsToMany'](db[_0x251f('0x91')],{'through':_0x251f('0x19b'),'as':_0x251f('0x175')});db[_0x251f('0x69')][_0x251f('0x126')](db['User'],{'as':_0x251f('0x185'),'through':_0x251f('0x12f'),'foreignKey':_0x251f('0x19a')});db[_0x251f('0x6b')][_0x251f('0x125')](db[_0x251f('0x11')],{'onDelete':'cascade','as':_0x251f('0x11')});db[_0x251f('0x6b')][_0x251f('0x125')](db[_0x251f('0x73')],{'onDelete':_0x251f('0x11d'),'as':_0x251f('0x160'),'foreignKey':_0x251f('0x161')});db[_0x251f('0x6b')]['belongsTo'](db['ChatInteraction'],{'onDelete':'cascade','as':_0x251f('0x178'),'foreignKey':'ChatInteractionId'});db[_0x251f('0x6b')][_0x251f('0x125')](db[_0x251f('0x176')],{'as':_0x251f('0x176'),'foreignKey':_0x251f('0x186')});db[_0x251f('0x6b')][_0x251f('0x125')](db[_0x251f('0x13d')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x251f('0x17a')][_0x251f('0x11b')](db['Attachment'],{'as':_0x251f('0x177'),'foreignKey':_0x251f('0x17b'),'onDelete':_0x251f('0x11d'),'hooks':!![]});db[_0x251f('0x17a')][_0x251f('0x125')](db[_0x251f('0x73')],{'onDelete':_0x251f('0x11d'),'as':_0x251f('0x160'),'foreignKey':_0x251f('0x161')});db['ChatOfflineMessage']['belongsTo'](db[_0x251f('0x13d')],{'as':_0x251f('0x171'),'foreignKey':'ChatWebsiteId'});db[_0x251f('0x6e')]['belongsToMany'](db[_0x251f('0x11')],{'as':_0x251f('0x16e'),'through':_0x251f('0x30'),'hooks':!![]});db['ChatQueue'][_0x251f('0x126')](db[_0x251f('0xea')],{'through':_0x251f('0x19c'),'as':_0x251f('0x158')});db[_0x251f('0x6f')][_0x251f('0x11b')](db['ChatInternalMessage'],{'as':_0x251f('0x182'),'foreignKey':'ChatGroupId','onDelete':_0x251f('0x11d')});db[_0x251f('0x6f')][_0x251f('0x126')](db[_0x251f('0x11')],{'as':'Members','through':_0x251f('0x128')});db['ChatProactiveAction'][_0x251f('0x125')](db[_0x251f('0x13d')],{'as':_0x251f('0x19d'),'foreignKey':_0x251f('0x179')});db[_0x251f('0x19e')][_0x251f('0x11b')](db[_0x251f('0x73')],{'as':'Contacts','foreignKey':_0x251f('0x19f')});db[_0x251f('0x73')][_0x251f('0x11b')](db[_0x251f('0x75')],{'as':_0x251f('0x1a0'),'foreignKey':_0x251f('0x161')});db[_0x251f('0x73')][_0x251f('0x11b')](db[_0x251f('0x78')],{'as':'HopperFinals','foreignKey':_0x251f('0x161')});db[_0x251f('0x73')]['hasMany'](db[_0x251f('0x14e')],{'as':'HopperHistories','foreignKey':_0x251f('0x161')});db['CmContact'][_0x251f('0x11b')](db['ReportAgentPreview'],{'as':_0x251f('0x7b'),'foreignKey':_0x251f('0x161')});db[_0x251f('0x73')][_0x251f('0x11b')](db[_0x251f('0xd9')],{'as':_0x251f('0x150'),'foreignKey':_0x251f('0x161')});db[_0x251f('0x73')][_0x251f('0x11b')](db[_0x251f('0x60')],{'as':_0x251f('0x132'),'foreignKey':'ContactId','onDelete':'restrict'});db['CmContact'][_0x251f('0x11b')](db[_0x251f('0x69')],{'as':_0x251f('0x120'),'foreignKey':_0x251f('0x161'),'onDelete':_0x251f('0x164')});db[_0x251f('0x73')][_0x251f('0x11b')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x251f('0x161'),'onDelete':_0x251f('0x164')});db[_0x251f('0x73')][_0x251f('0x11b')](db[_0x251f('0x4c')],{'as':'FaxInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0x251f('0x73')][_0x251f('0x11b')](db[_0x251f('0x42')],{'as':'MailInteractions','foreignKey':_0x251f('0x161'),'onDelete':_0x251f('0x164')});db[_0x251f('0x73')][_0x251f('0x125')](db[_0x251f('0x19e')],{'as':_0x251f('0x1a1'),'foreignKey':_0x251f('0x19f')});db['CmContact'][_0x251f('0x125')](db[_0x251f('0x12b')],{'as':_0x251f('0x16b'),'foreignKey':_0x251f('0x16c'),'onDelete':_0x251f('0x11d')});db[_0x251f('0x73')][_0x251f('0x126')](db[_0x251f('0x11')],{'as':'Users','through':_0x251f('0x12a')});db['CmContact'][_0x251f('0x126')](db[_0x251f('0x91')],{'as':_0x251f('0x174'),'through':'cm_contact_has_tags'});db[_0x251f('0x73')]['belongsToMany'](db[_0x251f('0x91')],{'through':_0x251f('0x1a2'),'as':_0x251f('0x175')});db['CmHopper']['belongsTo'](db[_0x251f('0x73')],{'as':_0x251f('0x160'),'foreignKey':_0x251f('0x161'),'onDelete':_0x251f('0x11d')});db[_0x251f('0x75')][_0x251f('0x125')](db['CmList'],{'as':_0x251f('0x16b'),'foreignKey':_0x251f('0x16c'),'onDelete':_0x251f('0x11d')});db[_0x251f('0x75')][_0x251f('0x125')](db[_0x251f('0x11')],{'as':_0x251f('0x197'),'foreignKey':_0x251f('0x119')});db[_0x251f('0x75')][_0x251f('0x125')](db[_0x251f('0x18')],{'as':'Queue','foreignKey':_0x251f('0x14d'),'onDelete':_0x251f('0x11d')});db[_0x251f('0x75')]['belongsTo'](db[_0x251f('0xee')],{'as':_0x251f('0xee'),'foreignKey':_0x251f('0x1a3'),'onDelete':_0x251f('0x11d')});db[_0x251f('0x75')][_0x251f('0x125')](db[_0x251f('0x11')],{'as':_0x251f('0x172'),'foreignKey':_0x251f('0x1a4')});db[_0x251f('0x76')]['belongsTo'](db[_0x251f('0x73')],{'as':'Contact','foreignKey':_0x251f('0x161'),'onDelete':'cascade'});db[_0x251f('0x76')][_0x251f('0x125')](db['CmList'],{'as':_0x251f('0x16b'),'foreignKey':_0x251f('0x16c'),'onDelete':_0x251f('0x11d')});db['CmHopperBlack'][_0x251f('0x125')](db[_0x251f('0x18')],{'as':_0x251f('0x198'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x251f('0x76')][_0x251f('0x125')](db[_0x251f('0xee')],{'as':_0x251f('0xee'),'foreignKey':_0x251f('0x1a3'),'onDelete':_0x251f('0x11d')});db['Automation']['hasMany'](db['Condition'],{'as':{'plural':_0x251f('0x1a5'),'singular':'OneAll'},'foreignKey':_0x251f('0x1a6'),'onDelete':_0x251f('0x11d'),'hooks':!![]});db[_0x251f('0x80')]['hasMany'](db['Condition'],{'as':{'plural':'Any','singular':_0x251f('0x1a7')},'foreignKey':_0x251f('0x1a8'),'onDelete':_0x251f('0x11d'),'hooks':!![]});db[_0x251f('0x80')][_0x251f('0x11b')](db[_0x251f('0x7e')],{'as':_0x251f('0x1a9'),'foreignKey':'AutomationId','onDelete':_0x251f('0x11d'),'hooks':!![]});db['Disposition'][_0x251f('0x11b')](db[_0x251f('0x83')],{'as':'Dispositions','foreignKey':'ParentId','onDelete':'cascade'});db[_0x251f('0x86')][_0x251f('0x11b')](db['Interval'],{'as':_0x251f('0x1aa'),'foreignKey':_0x251f('0x190'),'onDelete':_0x251f('0x11d'),'hooks':!![],'required':![]});db[_0x251f('0x86')][_0x251f('0x11b')](db[_0x251f('0x149')],{'as':_0x251f('0x1ab'),'foreignKey':'IntervalId','onDelete':_0x251f('0x164')});db[_0x251f('0x86')]['hasMany'](db[_0x251f('0x45')],{'as':_0x251f('0x1ac'),'foreignKey':_0x251f('0x190')});db[_0x251f('0x86')][_0x251f('0x11b')](db['ChatApplication'],{'as':'ChatApplications','foreignKey':_0x251f('0x190')});db[_0x251f('0x86')]['hasMany'](db[_0x251f('0x180')],{'as':_0x251f('0x1ad'),'foreignKey':_0x251f('0x190')});db['Interval'][_0x251f('0x11b')](db[_0x251f('0x55')],{'as':'SmsApplications','foreignKey':_0x251f('0x190')});db[_0x251f('0x1ae')][_0x251f('0x125')](db[_0x251f('0x3d')],{});db[_0x251f('0x1ae')][_0x251f('0x125')](db['AnalyticDefaultReport'],{'foreignKey':_0x251f('0x1af')});db['Schedule'][_0x251f('0x125')](db[_0x251f('0x98')],{'foreignKey':_0x251f('0x1b0')});db[_0x251f('0x8f')]['belongsToMany'](db[_0x251f('0x1b1')],{'as':_0x251f('0x1b2'),'through':_0x251f('0x14b'),'onDelete':_0x251f('0x164')});db[_0x251f('0x91')][_0x251f('0x126')](db['CmContact'],{'through':_0x251f('0x1a2')});db[_0x251f('0x91')]['belongsToMany'](db[_0x251f('0x69')],{'through':_0x251f('0x19b')});db[_0x251f('0x91')]['belongsToMany'](db['MailInteraction'],{'through':_0x251f('0x173')});db['Tag'][_0x251f('0x126')](db[_0x251f('0x57')],{'through':_0x251f('0x18b')});db[_0x251f('0x91')]['belongsToMany'](db['FaxInteraction'],{'through':_0x251f('0x184')});db[_0x251f('0x91')][_0x251f('0x126')](db[_0x251f('0x60')],{'through':'openchannel_interaction_has_tags'});db[_0x251f('0x91')][_0x251f('0x126')](db[_0x251f('0x10a')],{'through':_0x251f('0x1b3')});db[_0x251f('0x1b4')]['hasMany'](db[_0x251f('0x1b5')],{'as':{'plural':_0x251f('0x1b6'),'singular':_0x251f('0x1b7')},'foreignKey':_0x251f('0x1b8'),'onDelete':_0x251f('0x11d'),'hooks':!![]});db[_0x251f('0x1b4')][_0x251f('0x11b')](db[_0x251f('0x1b5')],{'as':{'plural':_0x251f('0x1b9'),'singular':_0x251f('0x1ba')},'foreignKey':_0x251f('0x1bb'),'onDelete':_0x251f('0x11d'),'hooks':!![]});db['Trigger']['hasMany'](db[_0x251f('0x7e')],{'as':_0x251f('0x1a9'),'foreignKey':_0x251f('0x1bc'),'onDelete':'cascade','hooks':!![]});db[_0x251f('0x98')]['hasMany'](db['AnalyticFieldReport'],{'as':_0x251f('0x1bd'),'onDelete':_0x251f('0x11d'),'foreignKey':_0x251f('0x1b0'),'hooks':!![]});db[_0x251f('0x1be')][_0x251f('0x11b')](db[_0x251f('0x9d')],{'as':_0x251f('0x1bd'),'onDelete':_0x251f('0x11d'),'foreignKey':'DefaultReportId'});db[_0x251f('0x1bf')][_0x251f('0x11b')](db[_0x251f('0x9d')],{'as':'Fields','onDelete':_0x251f('0x11d'),'foreignKey':_0x251f('0x1c0')});db[_0x251f('0x9d')][_0x251f('0x125')](db[_0x251f('0x1bf')],{'foreignKey':_0x251f('0x1c0')});db['SalesforceAccount'][_0x251f('0x11b')](db[_0x251f('0xa0')],{'as':_0x251f('0x1c1'),'onDelete':_0x251f('0x11d'),'foreignKey':'AccountId'});db[_0x251f('0xa0')]['hasMany'](db['SalesforceField'],{'as':_0x251f('0x1c2'),'onDelete':'cascade','foreignKey':_0x251f('0x1c3')});db[_0x251f('0xa0')][_0x251f('0x11b')](db[_0x251f('0x1c4')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x251f('0x1c5')});db[_0x251f('0xa0')][_0x251f('0x11b')](db[_0x251f('0x1c4')],{'as':'Fields','onDelete':_0x251f('0x11d'),'foreignKey':_0x251f('0x1c6')});db[_0x251f('0xa0')][_0x251f('0x125')](db[_0x251f('0x1c7')],{'as':_0x251f('0x171'),'foreignKey':_0x251f('0x1c8')});db['SalesforceField'][_0x251f('0x11b')](db[_0x251f('0x1c4')],{'as':_0x251f('0x1c9'),'foreignKey':_0x251f('0x1c3')});db[_0x251f('0x1c4')]['hasMany'](db[_0x251f('0x1c4')],{'as':_0x251f('0x1ca'),'foreignKey':'DescriptionId'});db[_0x251f('0x1c4')][_0x251f('0x11b')](db[_0x251f('0x1c4')],{'as':_0x251f('0x1cb'),'foreignKey':_0x251f('0x1c6')});db[_0x251f('0x1c4')][_0x251f('0x125')](db[_0x251f('0x95')],{'as':'Variable','foreignKey':_0x251f('0x1cc')});db[_0x251f('0xa2')][_0x251f('0x11b')](db[_0x251f('0xa4')],{'as':_0x251f('0x1c1'),'onDelete':_0x251f('0x11d'),'foreignKey':'AccountId'});db[_0x251f('0xa4')]['hasMany'](db[_0x251f('0xa6')],{'as':'Subjects','onDelete':_0x251f('0x11d'),'foreignKey':_0x251f('0x1c3')});db['SugarcrmConfiguration'][_0x251f('0x11b')](db[_0x251f('0xa6')],{'as':_0x251f('0x1cd'),'onDelete':_0x251f('0x11d'),'foreignKey':_0x251f('0x1c5')});db['SugarcrmConfiguration']['hasMany'](db[_0x251f('0xa6')],{'as':_0x251f('0x1bd'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x251f('0xa4')][_0x251f('0x125')](db[_0x251f('0xa2')],{'as':_0x251f('0x171'),'foreignKey':_0x251f('0x1c8')});db[_0x251f('0xa6')][_0x251f('0x11b')](db[_0x251f('0xa6')],{'as':_0x251f('0x1c9'),'foreignKey':_0x251f('0x1c3')});db[_0x251f('0xa6')][_0x251f('0x11b')](db['SugarcrmField'],{'as':_0x251f('0x1ca'),'foreignKey':_0x251f('0x1c5')});db['SugarcrmField'][_0x251f('0x11b')](db[_0x251f('0xa6')],{'as':'Field','foreignKey':'FieldId'});db['SugarcrmField'][_0x251f('0x125')](db[_0x251f('0x95')],{'as':_0x251f('0x95'),'foreignKey':_0x251f('0x1cc')});db['DeskAccount'][_0x251f('0x11b')](db[_0x251f('0x1ce')],{'as':_0x251f('0x1c1'),'onDelete':_0x251f('0x11d'),'foreignKey':_0x251f('0x1c8')});db[_0x251f('0x1ce')][_0x251f('0x11b')](db[_0x251f('0xab')],{'as':'Subjects','onDelete':_0x251f('0x11d'),'foreignKey':_0x251f('0x1c3')});db[_0x251f('0x1ce')]['hasMany'](db[_0x251f('0xab')],{'as':_0x251f('0x1cd'),'onDelete':_0x251f('0x11d'),'foreignKey':'DescriptionId'});db[_0x251f('0x1ce')][_0x251f('0x11b')](db[_0x251f('0xab')],{'as':_0x251f('0x1bd'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x251f('0x1ce')]['belongsTo'](db[_0x251f('0xa8')],{'as':_0x251f('0x171'),'foreignKey':_0x251f('0x1c8')});db['DeskConfiguration'][_0x251f('0x126')](db['Tag'],{'through':_0x251f('0x1cf')});db[_0x251f('0xab')][_0x251f('0x11b')](db[_0x251f('0xab')],{'as':_0x251f('0x1c9'),'foreignKey':_0x251f('0x1c3')});db['DeskField'][_0x251f('0x11b')](db['DeskField'],{'as':'Description','foreignKey':_0x251f('0x1c5')});db['DeskField'][_0x251f('0x11b')](db['DeskField'],{'as':'Field','foreignKey':_0x251f('0x1c6')});db[_0x251f('0xab')][_0x251f('0x125')](db['Variable'],{'as':_0x251f('0x95'),'foreignKey':_0x251f('0x1cc')});db['ZohoAccount']['hasMany'](db[_0x251f('0xae')],{'as':'Configurations','onDelete':_0x251f('0x11d'),'foreignKey':_0x251f('0x1c8')});db['ZohoConfiguration']['hasMany'](db[_0x251f('0xb0')],{'as':_0x251f('0x1c2'),'onDelete':_0x251f('0x11d'),'foreignKey':_0x251f('0x1c3')});db[_0x251f('0xae')]['hasMany'](db['ZohoField'],{'as':'Descriptions','onDelete':_0x251f('0x11d'),'foreignKey':'DescriptionId'});db[_0x251f('0xae')][_0x251f('0x11b')](db[_0x251f('0xb0')],{'as':_0x251f('0x1bd'),'onDelete':'cascade','foreignKey':'FieldId'});db['ZohoConfiguration']['belongsTo'](db[_0x251f('0x1d0')],{'as':_0x251f('0x171'),'foreignKey':_0x251f('0x1c8')});db[_0x251f('0xb0')][_0x251f('0x11b')](db[_0x251f('0xb0')],{'as':_0x251f('0x1c9'),'foreignKey':_0x251f('0x1c3')});db[_0x251f('0xb0')][_0x251f('0x11b')](db[_0x251f('0xb0')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x251f('0xb0')][_0x251f('0x11b')](db[_0x251f('0xb0')],{'as':_0x251f('0x1cb'),'foreignKey':'FieldId'});db[_0x251f('0xb0')][_0x251f('0x125')](db[_0x251f('0x95')],{'as':'Variable','foreignKey':_0x251f('0x1cc')});db[_0x251f('0x1d1')][_0x251f('0x11b')](db[_0x251f('0xb3')],{'as':'Configurations','onDelete':_0x251f('0x11d'),'foreignKey':_0x251f('0x1c8')});db[_0x251f('0xb3')][_0x251f('0x11b')](db['ZendeskField'],{'as':_0x251f('0x1c2'),'foreignKey':_0x251f('0x1c3')});db['ZendeskConfiguration']['hasMany'](db[_0x251f('0xb5')],{'as':'Descriptions','foreignKey':_0x251f('0x1c5')});db[_0x251f('0xb3')][_0x251f('0x11b')](db[_0x251f('0xb5')],{'as':_0x251f('0x1bd'),'foreignKey':_0x251f('0x1c6')});db['ZendeskConfiguration']['belongsTo'](db[_0x251f('0x1d1')],{'as':_0x251f('0x171'),'foreignKey':_0x251f('0x1c8')});db[_0x251f('0xb3')][_0x251f('0x126')](db[_0x251f('0x91')],{'through':_0x251f('0x1d2')});db[_0x251f('0xb5')][_0x251f('0x11b')](db[_0x251f('0xb5')],{'as':_0x251f('0x1c9'),'foreignKey':'SubjectId'});db[_0x251f('0xb5')][_0x251f('0x11b')](db[_0x251f('0xb5')],{'as':_0x251f('0x1ca'),'foreignKey':_0x251f('0x1c5')});db[_0x251f('0xb5')][_0x251f('0x11b')](db[_0x251f('0xb5')],{'as':_0x251f('0x1cb'),'foreignKey':'FieldId'});db[_0x251f('0xb5')][_0x251f('0x125')](db[_0x251f('0x95')],{'as':'Variable','foreignKey':_0x251f('0x1cc')});db[_0x251f('0xb7')][_0x251f('0x11b')](db['FreshdeskConfiguration'],{'as':_0x251f('0x1c1'),'onDelete':_0x251f('0x11d'),'foreignKey':_0x251f('0x1c8')});db['FreshdeskConfiguration'][_0x251f('0x11b')](db['FreshdeskField'],{'as':'Subjects','onDelete':_0x251f('0x11d'),'foreignKey':_0x251f('0x1c3')});db[_0x251f('0x1d3')]['hasMany'](db[_0x251f('0xba')],{'as':_0x251f('0x1cd'),'onDelete':_0x251f('0x11d'),'foreignKey':_0x251f('0x1c5')});db[_0x251f('0x1d3')][_0x251f('0x11b')](db[_0x251f('0xba')],{'as':'Fields','onDelete':_0x251f('0x11d'),'foreignKey':_0x251f('0x1c6')});db['FreshdeskConfiguration'][_0x251f('0x125')](db[_0x251f('0xb7')],{'as':_0x251f('0x171'),'foreignKey':_0x251f('0x1c8')});db[_0x251f('0x1d3')][_0x251f('0x126')](db['Tag'],{'through':_0x251f('0x1d4')});db['FreshdeskField'][_0x251f('0x11b')](db['FreshdeskField'],{'as':_0x251f('0x1c9'),'foreignKey':_0x251f('0x1c3')});db[_0x251f('0xba')][_0x251f('0x11b')](db[_0x251f('0xba')],{'as':_0x251f('0x1ca'),'foreignKey':_0x251f('0x1c5')});db['FreshdeskField'][_0x251f('0x11b')](db[_0x251f('0xba')],{'as':'Field','foreignKey':_0x251f('0x1c6')});db[_0x251f('0xba')]['belongsTo'](db[_0x251f('0x95')],{'as':_0x251f('0x95'),'foreignKey':_0x251f('0x1cc')});db[_0x251f('0xbc')][_0x251f('0x11b')](db[_0x251f('0xbd')],{'as':_0x251f('0x1c1'),'onDelete':'cascade','foreignKey':'AccountId'});db['VtigerConfiguration'][_0x251f('0x11b')](db[_0x251f('0xbf')],{'as':_0x251f('0x1c2'),'foreignKey':_0x251f('0x1c3')});db['VtigerConfiguration'][_0x251f('0x11b')](db[_0x251f('0xbf')],{'as':'Descriptions','foreignKey':_0x251f('0x1c5')});db[_0x251f('0xbd')][_0x251f('0x11b')](db[_0x251f('0xbf')],{'as':'Fields','foreignKey':_0x251f('0x1c6')});db['VtigerConfiguration'][_0x251f('0x125')](db[_0x251f('0xbc')],{'as':_0x251f('0x171'),'foreignKey':_0x251f('0x1c8')});db[_0x251f('0xbf')][_0x251f('0x11b')](db[_0x251f('0xbf')],{'as':'Subject','foreignKey':_0x251f('0x1c3')});db[_0x251f('0xbf')][_0x251f('0x11b')](db[_0x251f('0xbf')],{'as':_0x251f('0x1ca'),'foreignKey':_0x251f('0x1c5')});db[_0x251f('0xbf')][_0x251f('0x11b')](db['VtigerField'],{'as':_0x251f('0x1cb'),'foreignKey':_0x251f('0x1c6')});db[_0x251f('0xbf')][_0x251f('0x125')](db[_0x251f('0x95')],{'as':_0x251f('0x95'),'foreignKey':_0x251f('0x1cc')});db['ServicenowAccount'][_0x251f('0x11b')](db[_0x251f('0xc3')],{'as':_0x251f('0x1c1'),'onDelete':_0x251f('0x11d'),'foreignKey':_0x251f('0x1c8')});db['ServicenowConfiguration'][_0x251f('0x11b')](db[_0x251f('0xc4')],{'as':_0x251f('0x1c2'),'foreignKey':_0x251f('0x1c3')});db[_0x251f('0xc3')]['hasMany'](db[_0x251f('0xc4')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x251f('0xc3')][_0x251f('0x11b')](db[_0x251f('0xc4')],{'as':_0x251f('0x1bd'),'foreignKey':'FieldId'});db['ServicenowConfiguration']['belongsTo'](db[_0x251f('0xc1')],{'as':_0x251f('0x171'),'foreignKey':_0x251f('0x1c8')});db[_0x251f('0xc4')][_0x251f('0x11b')](db[_0x251f('0xc4')],{'as':_0x251f('0x1c9'),'foreignKey':_0x251f('0x1c3')});db[_0x251f('0xc4')][_0x251f('0x11b')](db[_0x251f('0xc4')],{'as':_0x251f('0x1ca'),'foreignKey':_0x251f('0x1c5')});db['ServicenowField']['hasMany'](db[_0x251f('0xc4')],{'as':_0x251f('0x1cb'),'foreignKey':_0x251f('0x1c6')});db[_0x251f('0xc4')][_0x251f('0x125')](db[_0x251f('0x95')],{'as':_0x251f('0x95'),'foreignKey':_0x251f('0x1cc')});db[_0x251f('0xc5')][_0x251f('0x11b')](db[_0x251f('0xc7')],{'as':_0x251f('0x1c1'),'onDelete':_0x251f('0x11d'),'foreignKey':_0x251f('0x1c8')});db['Dynamics365Account']['belongsTo'](db[_0x251f('0x111')],{'as':'CloudProvider','foreignKey':'CloudProviderId'});db[_0x251f('0xc7')]['hasMany'](db[_0x251f('0xc9')],{'as':_0x251f('0x1c2'),'onDelete':_0x251f('0x11d'),'foreignKey':_0x251f('0x1c3')});db['Dynamics365Configuration'][_0x251f('0x11b')](db[_0x251f('0xc9')],{'as':'Descriptions','onDelete':_0x251f('0x11d'),'foreignKey':'DescriptionId'});db['Dynamics365Configuration'][_0x251f('0x11b')](db[_0x251f('0xc9')],{'as':_0x251f('0x1bd'),'onDelete':_0x251f('0x11d'),'foreignKey':'FieldId'});db[_0x251f('0xc7')][_0x251f('0x125')](db[_0x251f('0xc5')],{'as':_0x251f('0x171'),'foreignKey':_0x251f('0x1c8')});db['Dynamics365Field'][_0x251f('0x11b')](db[_0x251f('0xc9')],{'as':_0x251f('0x1c9'),'foreignKey':_0x251f('0x1c3')});db[_0x251f('0xc9')]['hasMany'](db[_0x251f('0xc9')],{'as':_0x251f('0x1ca'),'foreignKey':_0x251f('0x1c5')});db[_0x251f('0xc9')][_0x251f('0x11b')](db[_0x251f('0xc9')],{'as':_0x251f('0x1cb'),'foreignKey':_0x251f('0x1c6')});db[_0x251f('0xc9')][_0x251f('0x125')](db[_0x251f('0x95')],{'as':_0x251f('0x95'),'foreignKey':'VariableId'});db[_0x251f('0xca')][_0x251f('0x11b')](db[_0x251f('0xcc')],{'as':_0x251f('0x1c1'),'onDelete':_0x251f('0x11d'),'foreignKey':'AccountId'});db[_0x251f('0xcc')][_0x251f('0x11b')](db[_0x251f('0xce')],{'as':'Subjects','foreignKey':_0x251f('0x1c3')});db['FreshsalesConfiguration'][_0x251f('0x11b')](db[_0x251f('0xce')],{'as':_0x251f('0x1cd'),'foreignKey':_0x251f('0x1c5')});db[_0x251f('0xcc')][_0x251f('0x11b')](db[_0x251f('0xce')],{'as':_0x251f('0x1bd'),'foreignKey':_0x251f('0x1c6')});db['FreshsalesConfiguration']['belongsTo'](db[_0x251f('0xca')],{'as':_0x251f('0x171'),'foreignKey':_0x251f('0x1c8')});db[_0x251f('0xce')][_0x251f('0x11b')](db[_0x251f('0xce')],{'as':_0x251f('0x1c9'),'foreignKey':_0x251f('0x1c3')});db[_0x251f('0xce')][_0x251f('0x11b')](db['FreshsalesField'],{'as':_0x251f('0x1ca'),'foreignKey':_0x251f('0x1c5')});db['FreshsalesField']['hasMany'](db['FreshsalesField'],{'as':_0x251f('0x1cb'),'foreignKey':'FieldId'});db[_0x251f('0xce')][_0x251f('0x125')](db[_0x251f('0x95')],{'as':_0x251f('0x95'),'foreignKey':'VariableId'});db['ChatQueueReport'][_0x251f('0x125')](db[_0x251f('0x13d')],{});db[_0x251f('0xd2')]['belongsTo'](db[_0x251f('0x12b')],{'as':'List','foreignKey':_0x251f('0x16c')});db[_0x251f('0xd2')]['belongsTo'](db['CmContact'],{'as':_0x251f('0x160'),'foreignKey':_0x251f('0x161')});db[_0x251f('0xd2')][_0x251f('0x125')](db['ChatInteraction'],{});db['ChatQueueReport'][_0x251f('0x125')](db[_0x251f('0x6b')],{});db['ChatQueueReport'][_0x251f('0x125')](db[_0x251f('0x11')],{});db[_0x251f('0xd2')][_0x251f('0x125')](db[_0x251f('0x6e')],{});db[_0x251f('0xd4')][_0x251f('0x125')](db['User'],{'onDelete':'cascade','foreignKey':_0x251f('0x1d5')});db[_0x251f('0xd4')][_0x251f('0x125')](db[_0x251f('0x11')],{'onDelete':_0x251f('0x11d'),'foreignKey':_0x251f('0x1d6')});db[_0x251f('0xd9')][_0x251f('0x11b')](db[_0x251f('0xd7')],{'foreignKey':'SessionId','onDelete':'cascade'});db['JscriptySessionReport'][_0x251f('0x11b')](db[_0x251f('0xd6')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x251f('0xdb')][_0x251f('0x125')](db[_0x251f('0x53')],{});db[_0x251f('0xdb')][_0x251f('0x125')](db['CmList'],{'as':'List','foreignKey':_0x251f('0x16c')});db[_0x251f('0xdb')]['belongsTo'](db['CmContact'],{'as':_0x251f('0x160'),'foreignKey':_0x251f('0x161')});db[_0x251f('0xdb')][_0x251f('0x125')](db[_0x251f('0x57')],{});db[_0x251f('0xdb')][_0x251f('0x125')](db[_0x251f('0x59')],{});db['SmsQueueReport'][_0x251f('0x125')](db[_0x251f('0x11')],{});db[_0x251f('0xdb')][_0x251f('0x125')](db[_0x251f('0x5b')],{});db[_0x251f('0xe0')][_0x251f('0x11b')](db[_0x251f('0xd9')],{'foreignKey':_0x251f('0x1d7')});db[_0x251f('0xe0')][_0x251f('0x11b')](db[_0x251f('0xd7')],{'foreignKey':_0x251f('0x1d7')});db[_0x251f('0xe0')]['hasMany'](db[_0x251f('0xd6')],{'foreignKey':_0x251f('0x1d7')});db[_0x251f('0xe6')][_0x251f('0x126')](db[_0x251f('0x11')],{'as':_0x251f('0x185'),'through':_0x251f('0x146')});db['Team'][_0x251f('0x126')](db[_0x251f('0x11')],{'as':'Agents','through':'user_has_teams'});db['Team'][_0x251f('0x126')](db[_0x251f('0x18')],{'through':_0x251f('0x112'),'as':_0x251f('0x135')});db[_0x251f('0xea')][_0x251f('0x126')](db[_0x251f('0x3f')],{'through':_0x251f('0x16f'),'as':_0x251f('0x136')});db[_0x251f('0xea')][_0x251f('0x126')](db[_0x251f('0x6e')],{'through':_0x251f('0x19c'),'as':_0x251f('0x1d8')});db[_0x251f('0xea')][_0x251f('0x126')](db['FaxQueue'],{'through':_0x251f('0x1d9'),'as':'FaxQueues'});db['Team']['belongsToMany'](db[_0x251f('0x5b')],{'through':_0x251f('0x1da'),'as':_0x251f('0x139')});db[_0x251f('0xea')]['belongsToMany'](db[_0x251f('0x64')],{'through':_0x251f('0x1db'),'as':_0x251f('0x13a')});db[_0x251f('0xea')][_0x251f('0x126')](db[_0x251f('0x13b')],{'through':'team_has_whatsapp_queues','as':_0x251f('0x13c')});db[_0x251f('0xea')][_0x251f('0x126')](db[_0x251f('0xfd')],{'through':'TeamVoicePrefix','as':'VoicePrefixes'});db[_0x251f('0xee')][_0x251f('0x11b')](db[_0x251f('0x75')],{'as':_0x251f('0x1a0'),'foreignKey':_0x251f('0x1a3')});db['Campaign']['hasMany'](db[_0x251f('0x78')],{'as':_0x251f('0x11e'),'foreignKey':_0x251f('0x1a3')});db[_0x251f('0xee')][_0x251f('0x11b')](db[_0x251f('0x14e')],{'as':_0x251f('0x14f'),'foreignKey':_0x251f('0x1a3')});db[_0x251f('0xee')][_0x251f('0x11b')](db[_0x251f('0x76')],{'as':_0x251f('0x1dc'),'foreignKey':_0x251f('0x1a3')});db[_0x251f('0xee')]['belongsTo'](db['Trunk'],{'as':_0x251f('0x29'),'foreignKey':_0x251f('0x151')});db['Campaign'][_0x251f('0x125')](db[_0x251f('0x29')],{'as':_0x251f('0x152'),'foreignKey':'TrunkBackupId'});db[_0x251f('0xee')][_0x251f('0x125')](db[_0x251f('0x86')],{'as':_0x251f('0x86'),'foreignKey':'IntervalId'});db['Campaign'][_0x251f('0x125')](db[_0x251f('0xe6')],{'as':_0x251f('0xe6'),'foreignKey':_0x251f('0x1dd')});db[_0x251f('0xee')][_0x251f('0x126')](db[_0x251f('0x12b')],{'as':_0x251f('0x156'),'through':'campaigns_has_cm_lists'});db[_0x251f('0xee')][_0x251f('0x126')](db['CmList'],{'as':'BlackLists','through':'campaigns_has_cm_blacklists'});db[_0x251f('0x176')][_0x251f('0x125')](db[_0x251f('0x17a')],{'as':_0x251f('0x17a'),'foreignKey':'ChatOfflineMessageId'});db[_0x251f('0xf3')][_0x251f('0x125')](db[_0x251f('0x43')],{});db['MailTransferReport']['belongsTo'](db[_0x251f('0x42')],{});db[_0x251f('0xf3')]['belongsTo'](db[_0x251f('0x3d')],{'foreignKey':'FromMailAccountId','as':_0x251f('0x1de')});db[_0x251f('0xf3')][_0x251f('0x125')](db[_0x251f('0x11')],{'foreignKey':_0x251f('0x1df'),'as':_0x251f('0x1e0')});db['MailTransferReport'][_0x251f('0x125')](db[_0x251f('0x11')],{'foreignKey':_0x251f('0x1e1'),'as':'ToAgent'});db[_0x251f('0xf3')][_0x251f('0x125')](db[_0x251f('0x3f')],{'foreignKey':_0x251f('0x1e2'),'as':_0x251f('0x1e3')});db[_0x251f('0xf3')][_0x251f('0x125')](db[_0x251f('0x3d')],{'foreignKey':_0x251f('0x1e4'),'as':_0x251f('0x1e5')});db[_0x251f('0xf5')][_0x251f('0x125')](db[_0x251f('0x6b')],{});db[_0x251f('0xf5')][_0x251f('0x125')](db[_0x251f('0x69')],{});db[_0x251f('0xf5')][_0x251f('0x125')](db[_0x251f('0x13d')],{'foreignKey':_0x251f('0x1e6'),'as':'FromAccount'});db[_0x251f('0xf5')][_0x251f('0x125')](db[_0x251f('0x11')],{'foreignKey':'FromUserId','as':_0x251f('0x1e0')});db[_0x251f('0xf5')][_0x251f('0x125')](db[_0x251f('0x11')],{'foreignKey':'ToUserId','as':_0x251f('0x1e7')});db[_0x251f('0xf5')][_0x251f('0x125')](db[_0x251f('0x6e')],{'foreignKey':_0x251f('0x1e8'),'as':'ToQueue'});db[_0x251f('0xf5')]['belongsTo'](db[_0x251f('0x13d')],{'foreignKey':_0x251f('0x1e9'),'as':_0x251f('0x1e5')});db[_0x251f('0xf7')][_0x251f('0x125')](db['FaxMessage'],{});db['FaxTransferReport'][_0x251f('0x125')](db['FaxInteraction'],{});db[_0x251f('0xf7')]['belongsTo'](db[_0x251f('0x49')],{'foreignKey':_0x251f('0x1ea'),'as':_0x251f('0x1de')});db[_0x251f('0xf7')][_0x251f('0x125')](db[_0x251f('0x11')],{'foreignKey':_0x251f('0x1df'),'as':_0x251f('0x1e0')});db[_0x251f('0xf7')][_0x251f('0x125')](db[_0x251f('0x11')],{'foreignKey':_0x251f('0x1e1'),'as':'ToAgent'});db[_0x251f('0xf7')][_0x251f('0x125')](db['FaxQueue'],{'foreignKey':_0x251f('0x1eb'),'as':_0x251f('0x1e3')});db[_0x251f('0xf7')][_0x251f('0x125')](db[_0x251f('0x49')],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db['OpenchannelTransferReport'][_0x251f('0x125')](db[_0x251f('0x62')],{});db[_0x251f('0xf9')]['belongsTo'](db[_0x251f('0x60')],{});db['OpenchannelTransferReport'][_0x251f('0x125')](db[_0x251f('0x5d')],{'foreignKey':'FromOpenchannelAccountId','as':'FromAccount'});db['OpenchannelTransferReport'][_0x251f('0x125')](db[_0x251f('0x11')],{'foreignKey':_0x251f('0x1df'),'as':_0x251f('0x1e0')});db['OpenchannelTransferReport'][_0x251f('0x125')](db[_0x251f('0x11')],{'foreignKey':_0x251f('0x1e1'),'as':_0x251f('0x1e7')});db[_0x251f('0xf9')]['belongsTo'](db[_0x251f('0x64')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x251f('0xf9')][_0x251f('0x125')](db[_0x251f('0x5d')],{'foreignKey':_0x251f('0x1ec'),'as':_0x251f('0x1e5')});db[_0x251f('0xfb')][_0x251f('0x125')](db[_0x251f('0x59')],{});db[_0x251f('0xfb')]['belongsTo'](db[_0x251f('0x57')],{});db[_0x251f('0xfb')][_0x251f('0x125')](db[_0x251f('0x53')],{'foreignKey':_0x251f('0x1ed'),'as':_0x251f('0x1de')});db[_0x251f('0xfb')][_0x251f('0x125')](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x251f('0xfb')][_0x251f('0x125')](db[_0x251f('0x11')],{'foreignKey':_0x251f('0x1e1'),'as':'ToAgent'});db[_0x251f('0xfb')][_0x251f('0x125')](db[_0x251f('0x5b')],{'foreignKey':_0x251f('0x1ee'),'as':'ToQueue'});db['SmsTransferReport'][_0x251f('0x125')](db[_0x251f('0x53')],{'foreignKey':'ToSmsAccountId','as':_0x251f('0x1e5')});db[_0x251f('0x12b')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0x251f('0x16c'),'onDelete':_0x251f('0x11d')});db[_0x251f('0x12b')][_0x251f('0x11b')](db[_0x251f('0x7c')],{'as':_0x251f('0x1ef'),'foreignKey':_0x251f('0x16c')});db[_0x251f('0x12b')]['hasMany'](db[_0x251f('0x73')],{'as':_0x251f('0x129'),'onDelete':'cascade','foreignKey':_0x251f('0x16c')});db['CmList']['hasMany'](db[_0x251f('0x78')],{'as':_0x251f('0x11e'),'foreignKey':_0x251f('0x16c')});db[_0x251f('0x12b')][_0x251f('0x11b')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0x251f('0x16c')});db[_0x251f('0x12b')]['hasMany'](db[_0x251f('0x7b')],{'as':_0x251f('0x7b'),'foreignKey':'ListId'});db[_0x251f('0x12b')][_0x251f('0x126')](db['VoiceQueue'],{'as':'Queues','through':_0x251f('0x157')});db['CmList']['belongsToMany'](db[_0x251f('0x11')],{'as':_0x251f('0x16e'),'through':_0x251f('0x12c')});db[_0x251f('0xfd')][_0x251f('0x11b')](db[_0x251f('0x149')],{'as':'Extensions','onDelete':_0x251f('0x11d')});db[_0x251f('0xfd')][_0x251f('0x126')](db['User'],{'as':_0x251f('0x16e'),'through':_0x251f('0x1f0')});db[_0x251f('0xfd')][_0x251f('0x126')](db[_0x251f('0xea')],{'through':_0x251f('0x114'),'as':'Teams'});db[_0x251f('0xff')]['hasMany'](db['User'],{'as':_0x251f('0x185'),'foreignKey':_0x251f('0x1f1')});db[_0x251f('0xff')][_0x251f('0x11b')](db[_0x251f('0x100')],{'as':_0x251f('0x1f2'),'foreignKey':'userProfileId','onDelete':_0x251f('0x11d')});db[_0x251f('0x100')][_0x251f('0x11b')](db[_0x251f('0x102')],{'as':'Resources','foreignKey':_0x251f('0x1f3'),'onDelete':_0x251f('0x11d')});db[_0x251f('0x106')][_0x251f('0x11b')](db[_0x251f('0x83')],{'as':_0x251f('0x168'),'foreignKey':_0x251f('0x1f4'),'onDelete':_0x251f('0x11d')});db['WhatsappAccount'][_0x251f('0x11b')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x251f('0x1f4')});db[_0x251f('0x106')][_0x251f('0x11b')](db['WhatsappMessage'],{'as':_0x251f('0x182'),'foreignKey':'WhatsappAccountId'});db[_0x251f('0x106')][_0x251f('0x11b')](db[_0x251f('0x10a')],{'as':'Interactions'});db[_0x251f('0x106')][_0x251f('0x11b')](db[_0x251f('0x108')],{'as':_0x251f('0x14a')});db[_0x251f('0x106')][_0x251f('0x125')](db[_0x251f('0x12b')],{'as':_0x251f('0x16b'),'foreignKey':_0x251f('0x16c')});db[_0x251f('0x106')][_0x251f('0x125')](db['Pause'],{'as':_0x251f('0x154'),'foreignKey':_0x251f('0x155')});db[_0x251f('0x106')][_0x251f('0x126')](db[_0x251f('0x11')],{'as':_0x251f('0x16e'),'through':_0x251f('0x144')});db[_0x251f('0x108')][_0x251f('0x125')](db['User'],{'onDelete':_0x251f('0x164')});db['WhatsappApplication']['belongsTo'](db[_0x251f('0x13b')],{'onDelete':_0x251f('0x164')});db['WhatsappApplication']['belongsTo'](db[_0x251f('0x106')],{'onDelete':_0x251f('0x164')});db[_0x251f('0x108')][_0x251f('0x125')](db[_0x251f('0x86')],{'onDelete':_0x251f('0x164'),'foreignKey':_0x251f('0x190')});db[_0x251f('0x108')][_0x251f('0x125')](db[_0x251f('0x91')],{'onDelete':_0x251f('0x164'),'foreignKey':_0x251f('0x17c')});db['WhatsappInteraction'][_0x251f('0x11b')](db['WhatsappMessage'],{'as':_0x251f('0x182'),'onDelete':_0x251f('0x11d'),'foreignKey':_0x251f('0x1f5')});db['WhatsappInteraction'][_0x251f('0x125')](db[_0x251f('0x106')],{'as':_0x251f('0x171'),'foreignKey':'WhatsappAccountId'});db[_0x251f('0x10a')][_0x251f('0x125')](db[_0x251f('0x73')],{'as':_0x251f('0x160'),'foreignKey':_0x251f('0x161')});db['WhatsappInteraction']['belongsTo'](db['User'],{'as':_0x251f('0x172'),'foreignKey':'UserId'});db[_0x251f('0x10a')][_0x251f('0x126')](db[_0x251f('0x91')],{'through':'whatsapp_interaction_has_tags','as':'Tags'});db[_0x251f('0x10a')][_0x251f('0x126')](db[_0x251f('0x91')],{'through':_0x251f('0x1b3'),'as':_0x251f('0x175')});db[_0x251f('0x10a')][_0x251f('0x126')](db[_0x251f('0x11')],{'as':_0x251f('0x185'),'through':_0x251f('0x134'),'foreignKey':_0x251f('0x1f5')});db[_0x251f('0x1f6')]['belongsTo'](db[_0x251f('0x11')],{'as':'User'});db[_0x251f('0x1f6')][_0x251f('0x125')](db[_0x251f('0x73')],{'onDelete':_0x251f('0x11d'),'as':_0x251f('0x160')});db[_0x251f('0x1f6')][_0x251f('0x125')](db[_0x251f('0x10a')],{'onDelete':'cascade','as':'Interaction','foreignKey':'WhatsappInteractionId'});db[_0x251f('0x1f6')][_0x251f('0x125')](db[_0x251f('0x106')],{'as':_0x251f('0x171'),'foreignKey':'WhatsappAccountId'});db[_0x251f('0x10d')][_0x251f('0x125')](db[_0x251f('0x106')],{});db[_0x251f('0x10d')][_0x251f('0x125')](db[_0x251f('0x12b')],{'as':'List','foreignKey':_0x251f('0x16c')});db[_0x251f('0x10d')][_0x251f('0x125')](db[_0x251f('0x73')],{'as':_0x251f('0x160'),'foreignKey':_0x251f('0x161')});db['WhatsappQueueReport'][_0x251f('0x125')](db[_0x251f('0x10a')],{});db[_0x251f('0x10d')][_0x251f('0x125')](db['WhatsappQueue'],{});db[_0x251f('0x10d')][_0x251f('0x125')](db[_0x251f('0x1f6')],{});db[_0x251f('0x10d')]['belongsTo'](db[_0x251f('0x11')],{});db[_0x251f('0x1f7')]['belongsTo'](db[_0x251f('0x1f6')],{});db[_0x251f('0x1f7')][_0x251f('0x125')](db[_0x251f('0x10a')],{});db[_0x251f('0x1f7')][_0x251f('0x125')](db['WhatsappAccount'],{'foreignKey':'FromWhatsappAccountId','as':_0x251f('0x1de')});db[_0x251f('0x1f7')][_0x251f('0x125')](db[_0x251f('0x106')],{'foreignKey':_0x251f('0x1f8'),'as':_0x251f('0x1e5')});db[_0x251f('0x1f7')][_0x251f('0x125')](db[_0x251f('0x13b')],{'foreignKey':_0x251f('0x1f9'),'as':'ToQueue'});db['WhatsappTransferReport'][_0x251f('0x125')](db['User'],{'foreignKey':'FromUserId','as':_0x251f('0x1e0')});db['WhatsappTransferReport']['belongsTo'](db[_0x251f('0x11')],{'foreignKey':'ToUserId','as':_0x251f('0x1e7')});db[_0x251f('0x13b')][_0x251f('0x126')](db[_0x251f('0x11')],{'as':'Agents','through':_0x251f('0x38'),'foreignKey':_0x251f('0x1fa')});db['WhatsappQueue']['belongsToMany'](db['Team'],{'through':_0x251f('0x1fb'),'as':_0x251f('0x158')});db[_0x251f('0x116')][_0x251f('0x125')](db[_0x251f('0x11')],{'as':_0x251f('0x1fc'),'foreignKey':_0x251f('0x119'),'onDelete':_0x251f('0x11d'),'hooks':!![]});db[_0x251f('0x111')][_0x251f('0x118')](db['Dynamics365Account'],{'as':_0x251f('0xc5'),'onDelete':_0x251f('0x164')});db[_0x251f('0x111')][_0x251f('0x118')](db[_0x251f('0x3a')],{'as':_0x251f('0x166'),'onDelete':_0x251f('0x164')});db[_0x251f('0x111')][_0x251f('0x118')](db[_0x251f('0x165')],{'as':_0x251f('0x167'),'onDelete':_0x251f('0x164')});module[_0x251f('0x1fd')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xb87f=['Agents','Teams','BlackLists','ScreenRecording','Messages','mailbox','mailboxuser','VoiceCallReport','VoiceQueueReport','QueueCalls','AgentReports','uniqueid','Contact','ContactId','MailServerIn','MailAccountId','CloudProvider','CloudProviderId','restrict','Imap','Dispositions','CannedAnswer','Answers','Interactions','Applications','List','team_has_mail_queues','MailInteractionId','Owner','mail_interaction_has_tags','Tags','ThroughTags','Attachments','Interaction','Account','ChatWebsiteId','TagId','ListId','DashboardItem','Disposition','FaxAccountId','FaxApplication','Exntensions','FaxInteractionId','fax_interaction_has_tags','Users','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','AttachmentId','ProactiveActions','OpenchannelQueueReport','Agent','Queue','Website','chat_interaction_has_tags','ChatInteractionId','ChatOfflineMessageId','team_has_chat_queues','CompanyId','Company','cm_user_has_contacts','cm_contact_has_tags','CampaignId','Automation','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','MailApplications','ChatApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Action','TriggerId','AnalyticFieldReport','Fields','MetricId','AccountId','SalesforceConfiguration','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Description','Field','VariableId','Subject','DeskConfiguration','Configurations','DeskField','int_desk_configuration_has_tags','ZendeskAccount','int_zendesk_configuration_has_tags','FreshdeskAccount','int_freshdesk_configuration_has_tags','ServicenowAccount','Dynamics365Account','Dynamics365Field','FromId','JscriptyQuestionReport','SessionId','ProjectId','TeamVoiceQueue','ChatQueues','team_has_sms_queues','team_has_openchannel_queues','team_has_whatsapp_queues','HopperFinals','TrunkId','campaigns_has_cm_lists','MailTransferReport','FromMailAccountId','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','FromChatWebsiteId','FromAccount','ToQueue','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','ToAccount','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','CustomFields','Queues','UserProfileSections','userProfileId','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','Smtp','exports','lodash','jstz','determine','sequelize','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','defaultsDeep','database','password','options','username','User','../api/user/user.model','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMailMessage','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','Interval','Pause','../api/pause/pause.model','Cdr','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.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','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','VoiceMail','UserId','hasOne','userSetting','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','cascade','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','UserProfile','belongsToMany','Groups','chat_group_has_users','Contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoicePrefixes','MailQueues','FaxQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','VoiceContext','VoiceMusicOnHold','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','Trunk','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists'];(function(_0x5c04b6,_0x4c245b){var _0x3cd91c=function(_0x504bd8){while(--_0x504bd8){_0x5c04b6['push'](_0x5c04b6['shift']());}};_0x3cd91c(++_0x4c245b);}(_0xb87f,0xa7));var _0xfb87=function(_0x889b61,_0x5b643d){_0x889b61=_0x889b61-0x0;var _0x22555a=_0xb87f[_0x889b61];return _0x22555a;};'use strict';var config=require('../config/environment');var Sequelize=require('sequelize');var _=require(_0xfb87('0x0'));var jstz=require(_0xfb87('0x1'));var timezone=jstz[_0xfb87('0x2')]();config[_0xfb87('0x3')]=_['defaultsDeep'](config[_0xfb87('0x3')],{'database':_0xfb87('0x4'),'username':_0xfb87('0x5'),'password':_0xfb87('0x6'),'options':{'host':_0xfb87('0x7'),'port':0xcea,'dialect':_0xfb87('0x8'),'dialectOptions':{'charset':_0xfb87('0x9')},'logging':![],'timezone':timezone[_0xfb87('0xa')](),'define':{'charset':_0xfb87('0xb'),'collate':_0xfb87('0xc')}}});config[_0xfb87('0xd')]=_[_0xfb87('0xe')](config[_0xfb87('0xd')],{'database':'motion2','username':_0xfb87('0x5'),'password':_0xfb87('0x6'),'options':{'host':_0xfb87('0x7'),'port':0xcea,'dialect':_0xfb87('0x8'),'dialectOptions':{'charset':_0xfb87('0x9')},'logging':![],'timezone':timezone[_0xfb87('0xa')](),'define':{'charset':_0xfb87('0xb'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xfb87('0x3')][_0xfb87('0xf')],config[_0xfb87('0x3')]['username'],config[_0xfb87('0x3')][_0xfb87('0x10')],config[_0xfb87('0x3')][_0xfb87('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xfb87('0xd')][_0xfb87('0xf')],config[_0xfb87('0xd')][_0xfb87('0x12')],config[_0xfb87('0xd')]['password'],config[_0xfb87('0xd')][_0xfb87('0x11')])};db[_0xfb87('0x13')]=db[_0xfb87('0x3')]['import'](_0xfb87('0x14'));db[_0xfb87('0x15')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0x17'));db['VoiceContext']=db[_0xfb87('0x3')]['import'](_0xfb87('0x18'));db[_0xfb87('0x19')]=db['sequelize']['import'](_0xfb87('0x1a'));db['VoiceMusicOnHold']=db[_0xfb87('0x3')]['import'](_0xfb87('0x1b'));db[_0xfb87('0x1c')]=db[_0xfb87('0x3')]['import']('../api/voiceQueue/voiceQueue.model');db['VoiceRecording']=db['sequelize'][_0xfb87('0x16')](_0xfb87('0x1d'));db['ScreenRecording']=db[_0xfb87('0x3')]['import'](_0xfb87('0x1e'));db['VoiceMail']=db['sequelize'][_0xfb87('0x16')]('../api/voiceMail/voiceMail.model');db[_0xfb87('0x1f')]=db[_0xfb87('0x3')][_0xfb87('0x16')]('../api/voiceMailMessage/voiceMailMessage.model');db['VoiceCallReport']=db['sequelize']['import'](_0xfb87('0x20'));db['VoiceDialReport']=db['sequelize']['import'](_0xfb87('0x21'));db[_0xfb87('0x22')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0x23'));db['VoiceQueueReport']=db[_0xfb87('0x3')][_0xfb87('0x16')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0xfb87('0x24')]=db['sequelize'][_0xfb87('0x16')](_0xfb87('0x25'));db['Trunk']=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0x26'));db[_0xfb87('0x27')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0x28'));db[_0xfb87('0x29')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0x2a'));db[_0xfb87('0x2b')]=db['sequelize'][_0xfb87('0x16')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0xfb87('0x2c')]=db['sequelize']['import'](_0xfb87('0x2d'));db[_0xfb87('0x2e')]=db[_0xfb87('0x3')]['import']('../api/userMailQueue/userMailQueue.model');db[_0xfb87('0x2f')]=db[_0xfb87('0x3')][_0xfb87('0x16')]('../api/userFaxQueue/userFaxQueue.model');db['UserSmsQueue']=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0x30'));db[_0xfb87('0x31')]=db['sequelize'][_0xfb87('0x16')](_0xfb87('0x32'));db[_0xfb87('0x33')]=db['sequelize'][_0xfb87('0x16')]('../api/userWhatsappQueue/userWhatsappQueue.model');db['MailServerIn']=db['sequelize'][_0xfb87('0x16')](_0xfb87('0x34'));db[_0xfb87('0x35')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0x36'));db[_0xfb87('0x37')]=db[_0xfb87('0x3')][_0xfb87('0x16')]('../api/mailAccount/mailAccount.model');db[_0xfb87('0x38')]=db['sequelize'][_0xfb87('0x16')](_0xfb87('0x39'));db[_0xfb87('0x3a')]=db[_0xfb87('0x3')][_0xfb87('0x16')]('../api/mailSubstatus/mailSubstatus.model');db[_0xfb87('0x3b')]=db[_0xfb87('0x3')]['import'](_0xfb87('0x3c'));db[_0xfb87('0x3d')]=db[_0xfb87('0x3')]['import'](_0xfb87('0x3e'));db[_0xfb87('0x3f')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0x40'));db[_0xfb87('0x41')]=db[_0xfb87('0x3')][_0xfb87('0x16')]('../api/mailQueueReport/mailQueueReport.model');db['Dashboard']=db[_0xfb87('0x3')]['import'](_0xfb87('0x42'));db['DashboardItem']=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0x43'));db['FaxAccount']=db['sequelize']['import']('../api/faxAccount/faxAccount.model');db['FaxApplication']=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0x44'));db[_0xfb87('0x45')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0x46'));db[_0xfb87('0x47')]=db['sequelize']['import']('../api/faxMessage/faxMessage.model');db[_0xfb87('0x48')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0x49'));db['FaxQueueReport']=db[_0xfb87('0x3')]['import'](_0xfb87('0x4a'));db[_0xfb87('0x4b')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0x4c'));db[_0xfb87('0x4d')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0x4e'));db[_0xfb87('0x4f')]=db['sequelize'][_0xfb87('0x16')](_0xfb87('0x50'));db[_0xfb87('0x51')]=db['sequelize'][_0xfb87('0x16')](_0xfb87('0x52'));db[_0xfb87('0x53')]=db[_0xfb87('0x3')][_0xfb87('0x16')]('../api/smsQueue/smsQueue.model');db[_0xfb87('0x54')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0x55'));db[_0xfb87('0x56')]=db[_0xfb87('0x3')]['import'](_0xfb87('0x57'));db[_0xfb87('0x58')]=db[_0xfb87('0x3')]['import']('../api/openchannelInteraction/openchannelInteraction.model');db[_0xfb87('0x59')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0x5a'));db[_0xfb87('0x5b')]=db[_0xfb87('0x3')]['import'](_0xfb87('0x5c'));db[_0xfb87('0x5d')]=db['sequelize'][_0xfb87('0x16')](_0xfb87('0x5e'));db['OpenchannelQueueReport']=db['sequelize']['import'](_0xfb87('0x5f'));db[_0xfb87('0x60')]=db[_0xfb87('0x3')][_0xfb87('0x16')]('../api/chatApplication/chatApplication.model');db[_0xfb87('0x61')]=db['sequelize'][_0xfb87('0x16')](_0xfb87('0x62'));db[_0xfb87('0x63')]=db[_0xfb87('0x3')]['import']('../api/chatMessage/chatMessage.model');db[_0xfb87('0x64')]=db['sequelize']['import'](_0xfb87('0x65'));db[_0xfb87('0x66')]=db['sequelize'][_0xfb87('0x16')](_0xfb87('0x67'));db[_0xfb87('0x68')]=db['sequelize'][_0xfb87('0x16')](_0xfb87('0x69'));db[_0xfb87('0x6a')]=db['sequelize'][_0xfb87('0x16')](_0xfb87('0x6b'));db[_0xfb87('0x6c')]=db[_0xfb87('0x3')]['import'](_0xfb87('0x6d'));db[_0xfb87('0x6e')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0x6f'));db[_0xfb87('0x70')]=db[_0xfb87('0x3')][_0xfb87('0x16')]('../api/cmHopper/cmHopper.model');db[_0xfb87('0x71')]=db['sequelize'][_0xfb87('0x16')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0xfb87('0x72')]=db[_0xfb87('0x3')]['import'](_0xfb87('0x73'));db['CmHopperHistory']=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0x74'));db[_0xfb87('0x75')]=db[_0xfb87('0x3')]['import'](_0xfb87('0x76'));db[_0xfb87('0x77')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0x78'));db['Action']=db[_0xfb87('0x3')][_0xfb87('0x16')]('../api/action/action.model');db['Automation']=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0x79'));db['CannedAnswer']=db['sequelize']['import'](_0xfb87('0x7a'));db['Disposition']=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0x7b'));db[_0xfb87('0x7c')]=db[_0xfb87('0x3')][_0xfb87('0x16')]('../api/condition/condition.model');db[_0xfb87('0x7d')]=db[_0xfb87('0x3')][_0xfb87('0x16')]('../api/interval/interval.model');db[_0xfb87('0x7e')]=db['sequelize'][_0xfb87('0x16')](_0xfb87('0x7f'));db[_0xfb87('0x80')]=db[_0xfb87('0x3')][_0xfb87('0x16')]('../api/cdr/cdr.model');db['VoiceQueuesLog']=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0x81'));db[_0xfb87('0x82')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0x83'));db[_0xfb87('0x84')]=db[_0xfb87('0x3')]['import'](_0xfb87('0x85'));db[_0xfb87('0x86')]=db[_0xfb87('0x3')]['import']('../api/tag/tag.model');db[_0xfb87('0x87')]=db['sequelize'][_0xfb87('0x16')](_0xfb87('0x88'));db[_0xfb87('0x89')]=db[_0xfb87('0x3')][_0xfb87('0x16')]('../api/trigger/trigger.model');db[_0xfb87('0x8a')]=db[_0xfb87('0x3')]['import'](_0xfb87('0x8b'));db['Integration']=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0x8c'));db[_0xfb87('0x8d')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0x8e'));db[_0xfb87('0x8f')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0x90'));db[_0xfb87('0x91')]=db['sequelize']['import']('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0xfb87('0x92')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0x93'));db[_0xfb87('0x94')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0x95'));db['AnalyticFieldReport']=db[_0xfb87('0x3')]['import'](_0xfb87('0x96'));db[_0xfb87('0x97')]=db[_0xfb87('0x3')]['import'](_0xfb87('0x98'));db[_0xfb87('0x99')]=db[_0xfb87('0x3')]['import'](_0xfb87('0x9a'));db['SalesforceConfiguration']=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0x9b'));db[_0xfb87('0x9c')]=db['sequelize']['import'](_0xfb87('0x9d'));db[_0xfb87('0x9e')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0x9f'));db[_0xfb87('0xa0')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0xa1'));db[_0xfb87('0xa2')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0xa3'));db[_0xfb87('0xa4')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0xa5'));db['DeskConfiguration']=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0xa6'));db['DeskField']=db['sequelize'][_0xfb87('0x16')](_0xfb87('0xa7'));db['ZohoAccount']=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0xa8'));db[_0xfb87('0xa9')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0xaa'));db[_0xfb87('0xab')]=db['sequelize'][_0xfb87('0x16')](_0xfb87('0xac'));db['ZendeskAccount']=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0xad'));db[_0xfb87('0xae')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0xaf'));db[_0xfb87('0xb0')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0xb1'));db['FreshdeskAccount']=db['sequelize'][_0xfb87('0x16')](_0xfb87('0xb2'));db[_0xfb87('0xb3')]=db[_0xfb87('0x3')]['import']('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0xfb87('0xb4')]=db[_0xfb87('0x3')][_0xfb87('0x16')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0xfb87('0xb5')]=db[_0xfb87('0x3')]['import']('../api/intVtigerAccount/intVtigerAccount.model');db[_0xfb87('0xb6')]=db[_0xfb87('0x3')]['import'](_0xfb87('0xb7'));db[_0xfb87('0xb8')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0xb9'));db['ServicenowAccount']=db[_0xfb87('0x3')]['import'](_0xfb87('0xba'));db[_0xfb87('0xbb')]=db['sequelize'][_0xfb87('0x16')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0xfb87('0xbc')]=db[_0xfb87('0x3')]['import']('../api/intServicenowField/intServicenowField.model');db['Dynamics365Account']=db[_0xfb87('0x3')]['import'](_0xfb87('0xbd'));db[_0xfb87('0xbe')]=db[_0xfb87('0x3')][_0xfb87('0x16')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db['Dynamics365Field']=db[_0xfb87('0x3')][_0xfb87('0x16')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0xfb87('0xbf')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0xc0'));db[_0xfb87('0xc1')]=db['sequelize'][_0xfb87('0x16')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0xfb87('0xc2')]=db[_0xfb87('0x3')]['import'](_0xfb87('0xc3'));db['Integration']=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0x8c'));db[_0xfb87('0xc4')]=db['sequelize'][_0xfb87('0x16')](_0xfb87('0xc5'));db[_0xfb87('0xc6')]=db[_0xfb87('0x3')]['import']('../api/chatQueueReport/chatQueueReport.model');db[_0xfb87('0xc7')]=db['sequelize'][_0xfb87('0x16')](_0xfb87('0xc8'));db[_0xfb87('0xc9')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0xca'));db['JscriptyQuestionReport']=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0xcb'));db[_0xfb87('0xcc')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0xcd'));db[_0xfb87('0xce')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0xcf'));db[_0xfb87('0xd0')]=db[_0xfb87('0x3')][_0xfb87('0x16')]('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0xd1'));db[_0xfb87('0xd2')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0xd3'));db[_0xfb87('0xd4')]=db['sequelize'][_0xfb87('0x16')](_0xfb87('0xd5'));db['SquareOdbc']=db[_0xfb87('0x3')]['import'](_0xfb87('0xd6'));db[_0xfb87('0xd7')]=db[_0xfb87('0x3')][_0xfb87('0x16')]('../api/squareProject/squareProject.model');db[_0xfb87('0xd8')]=db['sequelize'][_0xfb87('0x16')]('../api/squareRecording/squareRecording.model');db[_0xfb87('0xd9')]=db['sequelize'][_0xfb87('0x16')](_0xfb87('0xda'));db[_0xfb87('0xdb')]=db[_0xfb87('0x3')]['import'](_0xfb87('0xdc'));db[_0xfb87('0xdd')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0xde'));db[_0xfb87('0xdf')]=db[_0xfb87('0x3')]['import']('../api/campaign/campaign.model');db[_0xfb87('0xe0')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0xe1'));db[_0xfb87('0xe2')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0xe3'));db[_0xfb87('0xe4')]=db[_0xfb87('0x3')][_0xfb87('0x16')]('../api/plugin/plugin.model');db['MailTransferReport']=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0xe5'));db[_0xfb87('0xe6')]=db['sequelize']['import'](_0xfb87('0xe7'));db[_0xfb87('0xe8')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0xe9'));db[_0xfb87('0xea')]=db[_0xfb87('0x3')][_0xfb87('0x16')]('../api/openchannelTransferReport/openchannelTransferReport.model');db['SmsTransferReport']=db['sequelize'][_0xfb87('0x16')](_0xfb87('0xeb'));db[_0xfb87('0xec')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0xed'));db[_0xfb87('0xee')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0xef'));db['UserProfile']=db[_0xfb87('0x3')][_0xfb87('0x16')]('../api/userProfile/userProfile.model');db[_0xfb87('0xf0')]=db['sequelize'][_0xfb87('0x16')](_0xfb87('0xf1'));db[_0xfb87('0xf2')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0xf3'));db[_0xfb87('0xf4')]=db['sequelize'][_0xfb87('0x16')](_0xfb87('0xf5'));db[_0xfb87('0xf6')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0xf7'));db[_0xfb87('0xf8')]=db[_0xfb87('0x3')]['import'](_0xfb87('0xf9'));db[_0xfb87('0xfa')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0xfb'));db[_0xfb87('0xfc')]=db['sequelize'][_0xfb87('0x16')](_0xfb87('0xfd'));db[_0xfb87('0xfe')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0xff'));db[_0xfb87('0x100')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0x101'));db[_0xfb87('0x102')]=db['sequelize'][_0xfb87('0x16')](_0xfb87('0x103'));db['CloudProvider']=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0x104'));db['TeamVoiceQueue']=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0x105'));db[_0xfb87('0x106')]=db[_0xfb87('0x3')]['import'](_0xfb87('0x107'));db[_0xfb87('0x108')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0x109'));db[_0xfb87('0x10a')]=db[_0xfb87('0x3')][_0xfb87('0x16')](_0xfb87('0x10b'));db[_0xfb87('0x13')]['hasOne'](db[_0xfb87('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':_0xfb87('0x10d')});db[_0xfb87('0x13')][_0xfb87('0x10e')](db['UserSetting'],{'as':_0xfb87('0x10f'),'onDelete':'cascade','foreignKey':_0xfb87('0x10d')});db[_0xfb87('0x13')][_0xfb87('0x110')](db[_0xfb87('0x111')],{'as':_0xfb87('0x112'),'foreignKey':_0xfb87('0x10d')});db['User'][_0xfb87('0x110')](db['UserVoiceQueueRt'],{'as':_0xfb87('0x113'),'foreignKey':'UserId'});db[_0xfb87('0x13')][_0xfb87('0x110')](db['VoiceExtension'],{'as':_0xfb87('0x114'),'onDelete':_0xfb87('0x115'),'hooks':!![]});db[_0xfb87('0x13')][_0xfb87('0x110')](db[_0xfb87('0x72')],{'as':'HopperFinals','foreignKey':_0xfb87('0x10d')});db[_0xfb87('0x13')][_0xfb87('0x110')](db[_0xfb87('0x116')],{'as':_0xfb87('0x117'),'foreignKey':_0xfb87('0x10d')});db['User']['hasMany'](db[_0xfb87('0x75')],{'as':'ReportAgentPreview','foreignKey':_0xfb87('0x10d')});db[_0xfb87('0x13')][_0xfb87('0x110')](db[_0xfb87('0x58')],{'as':_0xfb87('0x118'),'foreignKey':_0xfb87('0x10d')});db[_0xfb87('0x13')]['hasMany'](db[_0xfb87('0x61')],{'as':_0xfb87('0x119'),'foreignKey':_0xfb87('0x10d')});db[_0xfb87('0x13')][_0xfb87('0x110')](db[_0xfb87('0x4f')],{'as':'SmsInteractions','foreignKey':'UserId'});db[_0xfb87('0x13')][_0xfb87('0x110')](db[_0xfb87('0x45')],{'as':_0xfb87('0x11a'),'foreignKey':_0xfb87('0x10d')});db[_0xfb87('0x13')]['hasMany'](db[_0xfb87('0x3b')],{'as':_0xfb87('0x11b'),'foreignKey':_0xfb87('0x10d')});db[_0xfb87('0x13')]['hasMany'](db['WhatsappInteraction'],{'as':_0xfb87('0x11c'),'foreignKey':_0xfb87('0x10d')});db['User'][_0xfb87('0x110')](db[_0xfb87('0xf4')],{'as':_0xfb87('0x11d'),'foreignKey':_0xfb87('0x11e')});db[_0xfb87('0x13')][_0xfb87('0x11f')](db['UserProfile'],{'as':_0xfb87('0x120'),'foreignKey':'userProfileId'});db[_0xfb87('0x13')][_0xfb87('0x121')](db[_0xfb87('0x68')],{'as':_0xfb87('0x122'),'through':_0xfb87('0x123')});db['User']['belongsToMany'](db[_0xfb87('0x6e')],{'as':_0xfb87('0x124'),'through':'cm_user_has_contacts'});db[_0xfb87('0x13')][_0xfb87('0x121')](db[_0xfb87('0xec')],{'as':_0xfb87('0x125'),'through':_0xfb87('0x126')});db[_0xfb87('0x13')][_0xfb87('0x121')](db[_0xfb87('0xdb')],{'through':_0xfb87('0x127')});db[_0xfb87('0x13')]['belongsToMany'](db[_0xfb87('0x3b')],{'as':_0xfb87('0x11b'),'through':_0xfb87('0x128')});db['User'][_0xfb87('0x121')](db[_0xfb87('0x61')],{'as':_0xfb87('0x119'),'through':_0xfb87('0x129')});db[_0xfb87('0x13')][_0xfb87('0x121')](db['FaxInteraction'],{'as':_0xfb87('0x11a'),'through':_0xfb87('0x12a')});db['User']['belongsToMany'](db[_0xfb87('0x4f')],{'as':_0xfb87('0x12b'),'through':_0xfb87('0x12c')});db['User'][_0xfb87('0x121')](db[_0xfb87('0x58')],{'as':_0xfb87('0x118'),'through':_0xfb87('0x12d')});db['User']['belongsToMany'](db[_0xfb87('0xfa')],{'as':_0xfb87('0x11c'),'through':_0xfb87('0x12e')});db['User']['belongsToMany'](db['VoiceQueue'],{'as':'VoiceQueues','through':_0xfb87('0x2b'),'required':![]});db[_0xfb87('0x13')]['belongsToMany'](db[_0xfb87('0xee')],{'as':_0xfb87('0x12f'),'through':_0xfb87('0x108'),'required':![]});db['User'][_0xfb87('0x121')](db[_0xfb87('0x38')],{'as':_0xfb87('0x130'),'through':_0xfb87('0x2e'),'required':![]});db[_0xfb87('0x13')][_0xfb87('0x121')](db[_0xfb87('0x66')],{'as':'ChatQueues','through':_0xfb87('0x2c'),'required':![],'hooks':!![]});db[_0xfb87('0x13')][_0xfb87('0x121')](db['FaxQueue'],{'as':_0xfb87('0x131'),'through':_0xfb87('0x2f'),'required':![]});db['User'][_0xfb87('0x121')](db['SmsQueue'],{'as':'SmsQueues','through':_0xfb87('0x132'),'required':![]});db[_0xfb87('0x13')]['belongsToMany'](db['OpenchannelQueue'],{'as':_0xfb87('0x133'),'through':_0xfb87('0x31'),'required':![]});db[_0xfb87('0x13')]['belongsToMany'](db['WhatsappQueue'],{'as':_0xfb87('0x134'),'through':'UserWhatsappQueue','required':![]});db[_0xfb87('0x13')]['belongsToMany'](db[_0xfb87('0xec')],{'through':_0xfb87('0x126')});db[_0xfb87('0x13')]['belongsToMany'](db['ChatWebsite'],{'as':_0xfb87('0x135'),'through':_0xfb87('0x136')});db[_0xfb87('0x13')]['belongsToMany'](db[_0xfb87('0x137')],{'as':_0xfb87('0x138'),'through':_0xfb87('0x139')});db[_0xfb87('0x13')][_0xfb87('0x121')](db['MailAccount'],{'as':_0xfb87('0x13a'),'through':_0xfb87('0x13b')});db[_0xfb87('0x13')]['belongsToMany'](db[_0xfb87('0x54')],{'as':'OpenchannelAccounts','through':_0xfb87('0x13c')});db[_0xfb87('0x13')]['belongsToMany'](db[_0xfb87('0x4b')],{'as':_0xfb87('0x13d'),'through':_0xfb87('0x13e')});db[_0xfb87('0x13')][_0xfb87('0x121')](db[_0xfb87('0xf6')],{'as':_0xfb87('0x13f'),'through':'user_has_whatsapp_accounts'});db[_0xfb87('0x13')][_0xfb87('0x121')](db['SquareProject'],{'as':_0xfb87('0x140'),'through':_0xfb87('0x141')});db[_0xfb87('0x15')][_0xfb87('0x110')](db[_0xfb87('0x19')],{'as':_0xfb87('0x142'),'onDelete':_0xfb87('0x115'),'foreignKey':_0xfb87('0x143')});db[_0xfb87('0x144')][_0xfb87('0x110')](db[_0xfb87('0x19')],{'onDelete':_0xfb87('0x115')});db[_0xfb87('0x19')][_0xfb87('0x110')](db[_0xfb87('0x19')],{'as':'Applications','onDelete':_0xfb87('0x115')});db[_0xfb87('0x145')][_0xfb87('0x121')](db['Sound'],{'as':_0xfb87('0x146'),'through':_0xfb87('0x147')});db[_0xfb87('0x1c')][_0xfb87('0x110')](db[_0xfb87('0x29')],{'as':_0xfb87('0x148'),'foreignKey':_0xfb87('0x149')});db[_0xfb87('0x1c')]['hasMany'](db[_0xfb87('0x70')],{'as':_0xfb87('0x14a'),'foreignKey':_0xfb87('0x149')});db[_0xfb87('0x1c')][_0xfb87('0x110')](db[_0xfb87('0x72')],{'as':'HopperFinals','foreignKey':'VoiceQueueId'});db[_0xfb87('0x1c')][_0xfb87('0x110')](db[_0xfb87('0x116')],{'as':_0xfb87('0x14b'),'foreignKey':_0xfb87('0x149')});db[_0xfb87('0x1c')][_0xfb87('0x110')](db[_0xfb87('0x75')],{'as':_0xfb87('0x75'),'foreignKey':_0xfb87('0x149')});db[_0xfb87('0x1c')][_0xfb87('0x110')](db['CmHopperBlack'],{'as':_0xfb87('0x14c'),'foreignKey':_0xfb87('0x149')});db[_0xfb87('0x1c')][_0xfb87('0x110')](db[_0xfb87('0xcc')],{'as':_0xfb87('0x14d'),'foreignKey':_0xfb87('0x149')});db[_0xfb87('0x1c')][_0xfb87('0x11f')](db[_0xfb87('0x14e')],{'as':_0xfb87('0x14e'),'foreignKey':'TrunkId'});db[_0xfb87('0x1c')]['belongsTo'](db[_0xfb87('0x14e')],{'as':_0xfb87('0x14f'),'foreignKey':_0xfb87('0x150')});db[_0xfb87('0x1c')][_0xfb87('0x11f')](db[_0xfb87('0x7d')],{'as':'Interval','foreignKey':_0xfb87('0x151')});db[_0xfb87('0x1c')][_0xfb87('0x11f')](db[_0xfb87('0x7e')],{'as':_0xfb87('0x152'),'foreignKey':_0xfb87('0x153')});db[_0xfb87('0x1c')][_0xfb87('0x121')](db[_0xfb87('0xec')],{'as':_0xfb87('0x125'),'through':_0xfb87('0x154')});db[_0xfb87('0x1c')][_0xfb87('0x121')](db[_0xfb87('0x13')],{'as':_0xfb87('0x155'),'through':_0xfb87('0x2b')});db[_0xfb87('0x1c')][_0xfb87('0x121')](db[_0xfb87('0xdb')],{'as':_0xfb87('0x156'),'through':'TeamVoiceQueue'});db[_0xfb87('0x1c')][_0xfb87('0x121')](db[_0xfb87('0xec')],{'as':_0xfb87('0x157'),'through':'voice_queues_has_cm_blacklists'});db[_0xfb87('0x111')][_0xfb87('0x11f')](db[_0xfb87('0x13')],{'as':_0xfb87('0x13'),'foreignKey':'UserId'});db[_0xfb87('0x158')]['belongsTo'](db[_0xfb87('0x13')],{'as':_0xfb87('0x13'),'foreignKey':_0xfb87('0x10d')});db['VoiceMail'][_0xfb87('0x110')](db['VoiceMailMessage'],{'as':_0xfb87('0x159'),'onDelete':_0xfb87('0x115'),'foreignKey':'mailboxuser','sourceKey':_0xfb87('0x15a')});db[_0xfb87('0x1f')]['belongsTo'](db[_0xfb87('0x10c')],{'foreignKey':_0xfb87('0x15b'),'targetKey':_0xfb87('0x15a')});db[_0xfb87('0x15c')]['hasMany'](db[_0xfb87('0x15d')],{'as':_0xfb87('0x15e'),'foreignKey':'uniqueid','constraints':![]});db[_0xfb87('0x15c')][_0xfb87('0x110')](db[_0xfb87('0x22')],{'as':_0xfb87('0x15f'),'foreignKey':_0xfb87('0x160'),'constraints':![]});db[_0xfb87('0x15c')]['belongsTo'](db[_0xfb87('0x13')],{'as':_0xfb87('0x13'),'foreignKey':_0xfb87('0x10d')});db[_0xfb87('0x15c')][_0xfb87('0x11f')](db[_0xfb87('0x6e')],{'as':_0xfb87('0x161'),'foreignKey':_0xfb87('0x162')});db[_0xfb87('0x163')][_0xfb87('0x11f')](db[_0xfb87('0x37')],{'as':_0xfb87('0x37'),'foreignKey':_0xfb87('0x164')});db['MailServerIn'][_0xfb87('0x11f')](db[_0xfb87('0x165')],{'as':_0xfb87('0x165'),'foreignKey':_0xfb87('0x166'),'onDelete':_0xfb87('0x167')});db[_0xfb87('0x35')]['belongsTo'](db[_0xfb87('0x37')],{'as':_0xfb87('0x37'),'foreignKey':_0xfb87('0x164')});db[_0xfb87('0x35')]['belongsTo'](db[_0xfb87('0x165')],{'as':_0xfb87('0x165'),'foreignKey':_0xfb87('0x166'),'onDelete':_0xfb87('0x167')});db[_0xfb87('0x37')][_0xfb87('0x10e')](db['MailServerIn'],{'as':_0xfb87('0x168'),'onDelete':_0xfb87('0x115')});db['MailAccount']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0xfb87('0x115')});db[_0xfb87('0x37')][_0xfb87('0x110')](db['Disposition'],{'as':_0xfb87('0x169'),'foreignKey':_0xfb87('0x164'),'onDelete':_0xfb87('0x115')});db[_0xfb87('0x37')][_0xfb87('0x110')](db[_0xfb87('0x16a')],{'as':_0xfb87('0x16b'),'foreignKey':_0xfb87('0x164')});db[_0xfb87('0x37')][_0xfb87('0x110')](db[_0xfb87('0x3d')],{'as':_0xfb87('0x159'),'foreignKey':_0xfb87('0x164')});db[_0xfb87('0x37')][_0xfb87('0x110')](db[_0xfb87('0x3b')],{'as':_0xfb87('0x16c')});db[_0xfb87('0x37')][_0xfb87('0x110')](db[_0xfb87('0x3f')],{'as':_0xfb87('0x16d')});db[_0xfb87('0x37')]['belongsTo'](db[_0xfb87('0xec')],{'as':_0xfb87('0x16e'),'foreignKey':'ListId'});db[_0xfb87('0x37')][_0xfb87('0x11f')](db['Template'],{'as':_0xfb87('0x87'),'foreignKey':'TemplateId'});db['MailAccount'][_0xfb87('0x11f')](db['Pause'],{'as':_0xfb87('0x152'),'foreignKey':_0xfb87('0x153')});db[_0xfb87('0x37')][_0xfb87('0x121')](db[_0xfb87('0x13')],{'as':_0xfb87('0x155'),'through':'user_has_mail_accounts'});db[_0xfb87('0x38')][_0xfb87('0x121')](db[_0xfb87('0x13')],{'as':_0xfb87('0x155'),'through':_0xfb87('0x2e')});db['MailQueue']['belongsToMany'](db[_0xfb87('0xdb')],{'through':_0xfb87('0x16f'),'as':_0xfb87('0x156')});db[_0xfb87('0x3b')][_0xfb87('0x110')](db[_0xfb87('0x3d')],{'as':_0xfb87('0x159'),'onDelete':_0xfb87('0x115'),'foreignKey':_0xfb87('0x170')});db[_0xfb87('0x3b')][_0xfb87('0x11f')](db[_0xfb87('0x37')],{'as':'Account','foreignKey':_0xfb87('0x164')});db['MailInteraction'][_0xfb87('0x11f')](db[_0xfb87('0x6e')],{'as':'Contact','foreignKey':_0xfb87('0x162')});db[_0xfb87('0x3b')]['belongsTo'](db[_0xfb87('0x13')],{'as':_0xfb87('0x171'),'foreignKey':_0xfb87('0x10d')});db['MailInteraction'][_0xfb87('0x121')](db['Tag'],{'through':_0xfb87('0x172'),'as':_0xfb87('0x173')});db['MailInteraction']['belongsToMany'](db[_0xfb87('0x86')],{'through':_0xfb87('0x172'),'as':_0xfb87('0x174')});db['MailInteraction']['belongsToMany'](db[_0xfb87('0x13')],{'as':'Users','through':'user_has_mail_interactions','foreignKey':_0xfb87('0x170')});db[_0xfb87('0x3d')][_0xfb87('0x110')](db[_0xfb87('0xe2')],{'as':_0xfb87('0x175'),'onDelete':_0xfb87('0x115')});db[_0xfb87('0x3d')]['belongsTo'](db['User'],{'as':_0xfb87('0x13')});db['MailMessage']['belongsTo'](db['CmContact'],{'onDelete':_0xfb87('0x115'),'as':_0xfb87('0x161')});db[_0xfb87('0x3d')][_0xfb87('0x11f')](db[_0xfb87('0x3b')],{'as':_0xfb87('0x176'),'foreignKey':_0xfb87('0x170')});db[_0xfb87('0x3d')]['belongsTo'](db[_0xfb87('0x37')],{'as':_0xfb87('0x177'),'foreignKey':'MailAccountId'});db['MailMessage'][_0xfb87('0x11f')](db[_0xfb87('0x5d')],{'as':_0xfb87('0x5d'),'foreignKey':_0xfb87('0x178')});db[_0xfb87('0x3d')][_0xfb87('0x11f')](db[_0xfb87('0x64')],{'as':_0xfb87('0x64'),'foreignKey':'ChatOfflineMessageId'});db['MailApplication'][_0xfb87('0x11f')](db[_0xfb87('0x13')],{'onDelete':_0xfb87('0x167')});db['MailApplication'][_0xfb87('0x11f')](db[_0xfb87('0x38')],{'onDelete':_0xfb87('0x167')});db[_0xfb87('0x3f')][_0xfb87('0x11f')](db[_0xfb87('0x37')],{'onDelete':_0xfb87('0x167')});db['MailApplication']['belongsTo'](db[_0xfb87('0x7d')],{'onDelete':_0xfb87('0x167'),'foreignKey':_0xfb87('0x151')});db[_0xfb87('0x3f')][_0xfb87('0x11f')](db[_0xfb87('0x86')],{'onDelete':'restrict','foreignKey':_0xfb87('0x179')});db[_0xfb87('0x41')][_0xfb87('0x11f')](db['MailAccount'],{});db['MailQueueReport']['belongsTo'](db[_0xfb87('0xec')],{'as':'List','foreignKey':_0xfb87('0x17a')});db[_0xfb87('0x41')][_0xfb87('0x11f')](db[_0xfb87('0x6e')],{'as':_0xfb87('0x161'),'foreignKey':'ContactId'});db[_0xfb87('0x41')][_0xfb87('0x11f')](db['MailInteraction'],{});db[_0xfb87('0x41')][_0xfb87('0x11f')](db[_0xfb87('0x3d')],{});db[_0xfb87('0x41')][_0xfb87('0x11f')](db[_0xfb87('0x13')],{});db['MailQueueReport']['belongsTo'](db[_0xfb87('0x38')],{});db['Dashboard'][_0xfb87('0x110')](db[_0xfb87('0x17b')],{'as':'Items','onDelete':_0xfb87('0x115')});db[_0xfb87('0x137')][_0xfb87('0x110')](db[_0xfb87('0x17c')],{'as':'Dispositions','foreignKey':'FaxAccountId','onDelete':'cascade'});db[_0xfb87('0x137')][_0xfb87('0x110')](db[_0xfb87('0x16a')],{'as':_0xfb87('0x16b'),'foreignKey':_0xfb87('0x17d')});db[_0xfb87('0x137')][_0xfb87('0x110')](db[_0xfb87('0x45')],{'as':_0xfb87('0x16c')});db[_0xfb87('0x137')][_0xfb87('0x110')](db[_0xfb87('0x17e')],{'as':'Applications'});db['FaxAccount'][_0xfb87('0x110')](db[_0xfb87('0x19')],{'as':_0xfb87('0x17f'),'onDelete':_0xfb87('0x115')});db[_0xfb87('0x137')][_0xfb87('0x110')](db[_0xfb87('0x47')],{'as':'Messages'});db['FaxAccount'][_0xfb87('0x11f')](db[_0xfb87('0x14e')],{'as':_0xfb87('0x14e')});db['FaxAccount'][_0xfb87('0x11f')](db['CmList'],{'as':'List','foreignKey':_0xfb87('0x17a')});db['FaxAccount'][_0xfb87('0x11f')](db[_0xfb87('0x7e')],{'as':_0xfb87('0x152'),'foreignKey':_0xfb87('0x153')});db[_0xfb87('0x137')]['belongsToMany'](db[_0xfb87('0x13')],{'as':'Agents','through':'user_has_fax_accounts'});db[_0xfb87('0x17e')]['belongsTo'](db['User'],{'onDelete':_0xfb87('0x167')});db[_0xfb87('0x17e')][_0xfb87('0x11f')](db[_0xfb87('0x48')],{'onDelete':_0xfb87('0x167')});db[_0xfb87('0x17e')][_0xfb87('0x11f')](db[_0xfb87('0x137')],{'onDelete':_0xfb87('0x167')});db[_0xfb87('0x17e')][_0xfb87('0x11f')](db[_0xfb87('0x86')],{'onDelete':_0xfb87('0x167'),'foreignKey':'TagId'});db[_0xfb87('0x45')][_0xfb87('0x110')](db[_0xfb87('0x47')],{'as':_0xfb87('0x159'),'onDelete':_0xfb87('0x115'),'foreignKey':_0xfb87('0x180')});db[_0xfb87('0x45')]['belongsTo'](db[_0xfb87('0x137')],{'as':_0xfb87('0x177'),'foreignKey':_0xfb87('0x17d')});db[_0xfb87('0x45')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xfb87('0x162')});db[_0xfb87('0x45')][_0xfb87('0x11f')](db[_0xfb87('0x13')],{'as':_0xfb87('0x171'),'foreignKey':'UserId'});db[_0xfb87('0x45')][_0xfb87('0x121')](db[_0xfb87('0x86')],{'through':_0xfb87('0x181'),'as':_0xfb87('0x173')});db[_0xfb87('0x45')][_0xfb87('0x121')](db[_0xfb87('0x86')],{'through':_0xfb87('0x181'),'as':_0xfb87('0x174')});db[_0xfb87('0x45')][_0xfb87('0x121')](db[_0xfb87('0x13')],{'as':_0xfb87('0x182'),'through':_0xfb87('0x12a'),'foreignKey':_0xfb87('0x180')});db[_0xfb87('0x47')]['belongsTo'](db[_0xfb87('0x13')],{'onDelete':_0xfb87('0x115'),'as':_0xfb87('0x13')});db['FaxMessage']['belongsTo'](db[_0xfb87('0x45')],{'as':'Interaction','foreignKey':_0xfb87('0x180')});db[_0xfb87('0x47')]['belongsTo'](db[_0xfb87('0x6e')],{'onDelete':_0xfb87('0x115'),'as':_0xfb87('0x161')});db[_0xfb87('0x47')][_0xfb87('0x11f')](db[_0xfb87('0xe2')],{'as':_0xfb87('0xe2'),'foreignKey':'AttachmentId'});db[_0xfb87('0x47')]['belongsTo'](db[_0xfb87('0x137')],{'as':_0xfb87('0x177'),'foreignKey':_0xfb87('0x17d')});db[_0xfb87('0x48')][_0xfb87('0x121')](db[_0xfb87('0x13')],{'as':_0xfb87('0x155'),'through':_0xfb87('0x2f')});db[_0xfb87('0x48')]['belongsToMany'](db['Team'],{'through':_0xfb87('0x183'),'as':_0xfb87('0x156')});db[_0xfb87('0x184')][_0xfb87('0x11f')](db[_0xfb87('0x137')],{});db[_0xfb87('0x184')]['belongsTo'](db[_0xfb87('0xec')],{'as':_0xfb87('0x16e'),'foreignKey':'ListId'});db[_0xfb87('0x184')]['belongsTo'](db[_0xfb87('0x6e')],{'as':_0xfb87('0x161'),'foreignKey':_0xfb87('0x162')});db['FaxQueueReport'][_0xfb87('0x11f')](db['FaxInteraction'],{});db[_0xfb87('0x184')][_0xfb87('0x11f')](db[_0xfb87('0x47')],{});db[_0xfb87('0x184')][_0xfb87('0x11f')](db[_0xfb87('0x13')],{});db[_0xfb87('0x184')][_0xfb87('0x11f')](db[_0xfb87('0x48')],{});db[_0xfb87('0x4b')][_0xfb87('0x110')](db[_0xfb87('0x17c')],{'as':_0xfb87('0x169'),'foreignKey':_0xfb87('0x185'),'onDelete':'cascade'});db[_0xfb87('0x4b')][_0xfb87('0x110')](db[_0xfb87('0x16a')],{'as':_0xfb87('0x16b'),'foreignKey':_0xfb87('0x185')});db[_0xfb87('0x4b')][_0xfb87('0x110')](db[_0xfb87('0x51')],{'as':_0xfb87('0x159'),'foreignKey':_0xfb87('0x185')});db[_0xfb87('0x4b')][_0xfb87('0x110')](db[_0xfb87('0x4f')],{'as':_0xfb87('0x16c')});db[_0xfb87('0x4b')][_0xfb87('0x110')](db['SmsApplication'],{'as':_0xfb87('0x16d')});db[_0xfb87('0x4b')][_0xfb87('0x11f')](db[_0xfb87('0xec')],{'as':_0xfb87('0x16e'),'foreignKey':_0xfb87('0x17a')});db[_0xfb87('0x4b')][_0xfb87('0x11f')](db[_0xfb87('0x7e')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xfb87('0x4b')][_0xfb87('0x121')](db[_0xfb87('0x13')],{'as':_0xfb87('0x155'),'through':'user_has_sms_accounts'});db[_0xfb87('0x4d')][_0xfb87('0x11f')](db[_0xfb87('0x13')],{'onDelete':_0xfb87('0x167')});db[_0xfb87('0x4d')][_0xfb87('0x11f')](db[_0xfb87('0x53')],{'onDelete':_0xfb87('0x167')});db[_0xfb87('0x4d')][_0xfb87('0x11f')](db[_0xfb87('0x4b')],{'onDelete':_0xfb87('0x167')});db['SmsApplication'][_0xfb87('0x11f')](db[_0xfb87('0x7d')],{'onDelete':_0xfb87('0x167'),'foreignKey':_0xfb87('0x151')});db[_0xfb87('0x4d')][_0xfb87('0x11f')](db[_0xfb87('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['SmsInteraction']['hasMany'](db[_0xfb87('0x51')],{'as':'Messages','onDelete':_0xfb87('0x115'),'foreignKey':_0xfb87('0x186')});db[_0xfb87('0x4f')][_0xfb87('0x11f')](db[_0xfb87('0x4b')],{'as':_0xfb87('0x177'),'foreignKey':_0xfb87('0x185')});db[_0xfb87('0x4f')][_0xfb87('0x11f')](db[_0xfb87('0x6e')],{'as':_0xfb87('0x161'),'foreignKey':_0xfb87('0x162')});db[_0xfb87('0x4f')][_0xfb87('0x11f')](db[_0xfb87('0x13')],{'as':_0xfb87('0x171'),'foreignKey':_0xfb87('0x10d')});db[_0xfb87('0x4f')][_0xfb87('0x121')](db[_0xfb87('0x86')],{'through':_0xfb87('0x187'),'as':_0xfb87('0x173')});db[_0xfb87('0x4f')][_0xfb87('0x121')](db[_0xfb87('0x86')],{'through':'sms_interaction_has_tags','as':_0xfb87('0x174')});db[_0xfb87('0x4f')][_0xfb87('0x121')](db[_0xfb87('0x13')],{'as':_0xfb87('0x182'),'through':_0xfb87('0x12c'),'foreignKey':_0xfb87('0x186')});db[_0xfb87('0x51')][_0xfb87('0x11f')](db[_0xfb87('0x13')],{'as':_0xfb87('0x13')});db[_0xfb87('0x51')][_0xfb87('0x11f')](db[_0xfb87('0x6e')],{'onDelete':'cascade','as':_0xfb87('0x161')});db[_0xfb87('0x51')][_0xfb87('0x11f')](db['SmsInteraction'],{'onDelete':'cascade','as':_0xfb87('0x176'),'foreignKey':'SmsInteractionId'});db['SmsMessage'][_0xfb87('0x11f')](db[_0xfb87('0x4b')],{'as':_0xfb87('0x177'),'foreignKey':_0xfb87('0x185')});db[_0xfb87('0x53')][_0xfb87('0x121')](db[_0xfb87('0x13')],{'as':_0xfb87('0x155'),'through':_0xfb87('0x132'),'foreignKey':'SmsQueueId'});db[_0xfb87('0x53')][_0xfb87('0x121')](db['Team'],{'through':'team_has_sms_queues','as':_0xfb87('0x156')});db[_0xfb87('0x54')][_0xfb87('0x110')](db[_0xfb87('0x17c')],{'as':'Dispositions','foreignKey':'OpenchannelAccountId','onDelete':_0xfb87('0x115')});db[_0xfb87('0x54')]['hasMany'](db[_0xfb87('0x16a')],{'as':'Answers','foreignKey':_0xfb87('0x188')});db[_0xfb87('0x54')]['hasMany'](db['OpenchannelInteraction'],{'as':'Interactions','foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xfb87('0x110')](db[_0xfb87('0x59')],{'as':_0xfb87('0x159'),'foreignKey':_0xfb87('0x188')});db[_0xfb87('0x54')][_0xfb87('0x110')](db[_0xfb87('0x56')],{'as':_0xfb87('0x16d'),'foreignKey':_0xfb87('0x188')});db[_0xfb87('0x54')]['belongsTo'](db[_0xfb87('0xec')],{'as':_0xfb87('0x16e'),'foreignKey':_0xfb87('0x17a')});db['OpenchannelAccount'][_0xfb87('0x11f')](db[_0xfb87('0x7e')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xfb87('0x54')][_0xfb87('0x121')](db['User'],{'as':_0xfb87('0x155'),'through':_0xfb87('0x13c')});db[_0xfb87('0x56')]['belongsTo'](db[_0xfb87('0x13')],{'onDelete':'restrict'});db[_0xfb87('0x56')][_0xfb87('0x11f')](db[_0xfb87('0x5b')],{'onDelete':_0xfb87('0x167'),'foreignKey':_0xfb87('0x189')});db[_0xfb87('0x56')][_0xfb87('0x11f')](db['OpenchannelAccount'],{'onDelete':_0xfb87('0x167'),'foreignKey':_0xfb87('0x188')});db['OpenchannelApplication']['belongsTo'](db[_0xfb87('0x7d')],{'onDelete':_0xfb87('0x167'),'foreignKey':_0xfb87('0x151')});db[_0xfb87('0x56')][_0xfb87('0x11f')](db[_0xfb87('0x86')],{'onDelete':_0xfb87('0x167'),'foreignKey':_0xfb87('0x179')});db['OpenchannelInteraction'][_0xfb87('0x110')](db[_0xfb87('0x59')],{'as':'Messages','onDelete':_0xfb87('0x115'),'foreignKey':_0xfb87('0x18a')});db[_0xfb87('0x58')][_0xfb87('0x11f')](db[_0xfb87('0x54')],{'as':_0xfb87('0x177'),'foreignKey':_0xfb87('0x188')});db[_0xfb87('0x58')][_0xfb87('0x11f')](db[_0xfb87('0x6e')],{'as':_0xfb87('0x161'),'foreignKey':_0xfb87('0x162')});db['OpenchannelInteraction'][_0xfb87('0x11f')](db[_0xfb87('0x13')],{'as':_0xfb87('0x171'),'foreignKey':_0xfb87('0x10d')});db[_0xfb87('0x58')][_0xfb87('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0xfb87('0x173')});db[_0xfb87('0x58')][_0xfb87('0x121')](db[_0xfb87('0x86')],{'through':_0xfb87('0x18b'),'as':_0xfb87('0x174')});db[_0xfb87('0x58')][_0xfb87('0x121')](db['User'],{'as':_0xfb87('0x182'),'through':_0xfb87('0x12d'),'foreignKey':_0xfb87('0x18a')});db['OpenchannelMessage'][_0xfb87('0x11f')](db[_0xfb87('0x13')],{'onDelete':_0xfb87('0x115'),'as':_0xfb87('0x13')});db['OpenchannelMessage'][_0xfb87('0x11f')](db[_0xfb87('0x6e')],{'onDelete':_0xfb87('0x115'),'as':_0xfb87('0x161')});db[_0xfb87('0x59')][_0xfb87('0x11f')](db[_0xfb87('0x58')],{'onDelete':'cascade','as':_0xfb87('0x176'),'foreignKey':'OpenchannelInteractionId'});db[_0xfb87('0x59')][_0xfb87('0x11f')](db[_0xfb87('0xe2')],{'as':_0xfb87('0xe2'),'foreignKey':_0xfb87('0x18c')});db[_0xfb87('0x59')][_0xfb87('0x11f')](db['OpenchannelAccount'],{'as':_0xfb87('0x177'),'foreignKey':_0xfb87('0x188')});db['OpenchannelQueue']['belongsToMany'](db[_0xfb87('0x13')],{'as':_0xfb87('0x155'),'through':_0xfb87('0x31'),'foreignKey':_0xfb87('0x189')});db[_0xfb87('0x5b')]['belongsToMany'](db[_0xfb87('0xdb')],{'through':'team_has_openchannel_queues','as':'Teams'});db[_0xfb87('0x5d')][_0xfb87('0x110')](db[_0xfb87('0x17c')],{'as':_0xfb87('0x169'),'foreignKey':_0xfb87('0x178'),'onDelete':'cascade'});db[_0xfb87('0x5d')]['hasMany'](db[_0xfb87('0x16a')],{'as':_0xfb87('0x16b'),'foreignKey':_0xfb87('0x178')});db['ChatWebsite']['hasMany'](db['ChatProactiveAction'],{'as':_0xfb87('0x18d')});db['ChatWebsite'][_0xfb87('0x110')](db['ChatInteraction'],{'as':_0xfb87('0x16c')});db['ChatWebsite'][_0xfb87('0x110')](db[_0xfb87('0x60')],{'as':_0xfb87('0x16d')});db[_0xfb87('0x5d')]['hasMany'](db['ChatMessage'],{'as':_0xfb87('0x159')});db[_0xfb87('0x5d')][_0xfb87('0x11f')](db[_0xfb87('0xec')],{'as':'List','foreignKey':'ListId'});db['ChatWebsite'][_0xfb87('0x11f')](db[_0xfb87('0x7d')],{'as':'Interval','foreignKey':_0xfb87('0x151')});db[_0xfb87('0x5d')][_0xfb87('0x11f')](db[_0xfb87('0x37')],{'as':_0xfb87('0x37'),'foreignKey':_0xfb87('0x164')});db['ChatWebsite'][_0xfb87('0x11f')](db[_0xfb87('0x7e')],{'as':_0xfb87('0x152'),'foreignKey':_0xfb87('0x153')});db['ChatWebsite'][_0xfb87('0x121')](db[_0xfb87('0x13')],{'as':_0xfb87('0x155'),'through':_0xfb87('0x136')});db[_0xfb87('0x18e')]['belongsTo'](db[_0xfb87('0x54')],{});db[_0xfb87('0x18e')][_0xfb87('0x11f')](db[_0xfb87('0xec')],{'as':_0xfb87('0x16e'),'foreignKey':_0xfb87('0x17a')});db[_0xfb87('0x18e')][_0xfb87('0x11f')](db[_0xfb87('0x6e')],{'as':_0xfb87('0x161'),'foreignKey':_0xfb87('0x162')});db[_0xfb87('0x18e')][_0xfb87('0x11f')](db['OpenchannelInteraction'],{});db[_0xfb87('0x18e')][_0xfb87('0x11f')](db[_0xfb87('0x59')],{});db[_0xfb87('0x18e')][_0xfb87('0x11f')](db[_0xfb87('0x13')],{});db[_0xfb87('0x18e')][_0xfb87('0x11f')](db[_0xfb87('0x5b')],{});db[_0xfb87('0x60')][_0xfb87('0x11f')](db[_0xfb87('0x13')],{'as':_0xfb87('0x18f'),'foreignKey':'UserId','onDelete':'restrict'});db[_0xfb87('0x60')][_0xfb87('0x11f')](db['ChatQueue'],{'as':_0xfb87('0x190'),'foreignKey':'ChatQueueId','onDelete':_0xfb87('0x167')});db[_0xfb87('0x60')][_0xfb87('0x11f')](db['ChatWebsite'],{'as':_0xfb87('0x191'),'foreignKey':_0xfb87('0x178'),'onDelete':_0xfb87('0x167')});db[_0xfb87('0x60')][_0xfb87('0x11f')](db[_0xfb87('0x86')],{'onDelete':'restrict','foreignKey':_0xfb87('0x179')});db[_0xfb87('0x61')][_0xfb87('0x110')](db[_0xfb87('0x63')],{'as':'Messages','onDelete':_0xfb87('0x115'),'foreignKey':'ChatInteractionId'});db[_0xfb87('0x61')]['belongsTo'](db[_0xfb87('0x5d')],{'as':_0xfb87('0x177'),'foreignKey':_0xfb87('0x178')});db[_0xfb87('0x61')][_0xfb87('0x11f')](db[_0xfb87('0x6e')],{'as':_0xfb87('0x161'),'foreignKey':'ContactId'});db[_0xfb87('0x61')][_0xfb87('0x11f')](db['User'],{'as':_0xfb87('0x171'),'foreignKey':_0xfb87('0x10d')});db[_0xfb87('0x61')][_0xfb87('0x121')](db['Tag'],{'through':_0xfb87('0x192'),'as':_0xfb87('0x173')});db['ChatInteraction'][_0xfb87('0x121')](db[_0xfb87('0x86')],{'through':'chat_interaction_has_tags','as':_0xfb87('0x174')});db['ChatInteraction'][_0xfb87('0x121')](db['User'],{'as':'Users','through':_0xfb87('0x129'),'foreignKey':_0xfb87('0x193')});db[_0xfb87('0x63')][_0xfb87('0x11f')](db[_0xfb87('0x13')],{'onDelete':'cascade','as':_0xfb87('0x13')});db[_0xfb87('0x63')][_0xfb87('0x11f')](db[_0xfb87('0x6e')],{'onDelete':_0xfb87('0x115'),'as':_0xfb87('0x161'),'foreignKey':_0xfb87('0x162')});db[_0xfb87('0x63')][_0xfb87('0x11f')](db[_0xfb87('0x61')],{'onDelete':_0xfb87('0x115'),'as':'Interaction','foreignKey':_0xfb87('0x193')});db[_0xfb87('0x63')][_0xfb87('0x11f')](db[_0xfb87('0xe2')],{'as':'Attachment','foreignKey':_0xfb87('0x18c')});db['ChatMessage'][_0xfb87('0x11f')](db[_0xfb87('0x5d')],{'as':'Account','foreignKey':_0xfb87('0x178')});db[_0xfb87('0x64')][_0xfb87('0x110')](db[_0xfb87('0xe2')],{'as':_0xfb87('0x175'),'foreignKey':_0xfb87('0x194'),'onDelete':'cascade','hooks':!![]});db[_0xfb87('0x64')][_0xfb87('0x11f')](db[_0xfb87('0x6e')],{'onDelete':_0xfb87('0x115'),'as':_0xfb87('0x161'),'foreignKey':'ContactId'});db[_0xfb87('0x64')][_0xfb87('0x11f')](db[_0xfb87('0x5d')],{'as':_0xfb87('0x177'),'foreignKey':_0xfb87('0x178')});db[_0xfb87('0x66')][_0xfb87('0x121')](db['User'],{'as':_0xfb87('0x155'),'through':_0xfb87('0x2c'),'hooks':!![]});db[_0xfb87('0x66')][_0xfb87('0x121')](db[_0xfb87('0xdb')],{'through':_0xfb87('0x195'),'as':_0xfb87('0x156')});db[_0xfb87('0x68')]['hasMany'](db[_0xfb87('0xc7')],{'as':_0xfb87('0x159'),'foreignKey':'ChatGroupId','onDelete':_0xfb87('0x115')});db[_0xfb87('0x68')]['belongsToMany'](db['User'],{'as':_0xfb87('0x148'),'through':'chat_group_has_users'});db[_0xfb87('0x6a')][_0xfb87('0x11f')](db[_0xfb87('0x5d')],{'as':_0xfb87('0x191'),'foreignKey':_0xfb87('0x178')});db['CmCompany']['hasMany'](db['CmContact'],{'as':'Contacts','foreignKey':_0xfb87('0x196')});db[_0xfb87('0x6e')][_0xfb87('0x110')](db[_0xfb87('0x70')],{'as':'Hoppers','foreignKey':'ContactId'});db[_0xfb87('0x6e')][_0xfb87('0x110')](db[_0xfb87('0x72')],{'as':'HopperFinals','foreignKey':_0xfb87('0x162')});db[_0xfb87('0x6e')]['hasMany'](db[_0xfb87('0x116')],{'as':_0xfb87('0x14b'),'foreignKey':_0xfb87('0x162')});db[_0xfb87('0x6e')][_0xfb87('0x110')](db[_0xfb87('0x75')],{'as':_0xfb87('0x75'),'foreignKey':_0xfb87('0x162')});db[_0xfb87('0x6e')]['hasMany'](db[_0xfb87('0xcc')],{'as':_0xfb87('0x14d'),'foreignKey':_0xfb87('0x162')});db[_0xfb87('0x6e')][_0xfb87('0x110')](db[_0xfb87('0x58')],{'as':_0xfb87('0x118'),'foreignKey':_0xfb87('0x162'),'onDelete':_0xfb87('0x167')});db[_0xfb87('0x6e')]['hasMany'](db[_0xfb87('0x61')],{'as':_0xfb87('0x119'),'foreignKey':'ContactId','onDelete':_0xfb87('0x167')});db[_0xfb87('0x6e')][_0xfb87('0x110')](db['SmsInteraction'],{'as':_0xfb87('0x12b'),'foreignKey':_0xfb87('0x162'),'onDelete':_0xfb87('0x167')});db[_0xfb87('0x6e')][_0xfb87('0x110')](db[_0xfb87('0x45')],{'as':_0xfb87('0x11a'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0xfb87('0x6e')][_0xfb87('0x110')](db['MailInteraction'],{'as':_0xfb87('0x11b'),'foreignKey':_0xfb87('0x162'),'onDelete':_0xfb87('0x167')});db[_0xfb87('0x6e')][_0xfb87('0x11f')](db['CmCompany'],{'as':_0xfb87('0x197'),'foreignKey':_0xfb87('0x196')});db[_0xfb87('0x6e')][_0xfb87('0x11f')](db[_0xfb87('0xec')],{'as':_0xfb87('0x16e'),'foreignKey':_0xfb87('0x17a'),'onDelete':_0xfb87('0x115')});db['CmContact'][_0xfb87('0x121')](db[_0xfb87('0x13')],{'as':_0xfb87('0x182'),'through':_0xfb87('0x198')});db['CmContact'][_0xfb87('0x121')](db['Tag'],{'as':_0xfb87('0x173'),'through':'cm_contact_has_tags'});db[_0xfb87('0x6e')][_0xfb87('0x121')](db[_0xfb87('0x86')],{'through':_0xfb87('0x199'),'as':_0xfb87('0x174')});db[_0xfb87('0x70')]['belongsTo'](db['CmContact'],{'as':_0xfb87('0x161'),'foreignKey':_0xfb87('0x162'),'onDelete':'cascade'});db[_0xfb87('0x70')]['belongsTo'](db[_0xfb87('0xec')],{'as':_0xfb87('0x16e'),'foreignKey':'ListId','onDelete':_0xfb87('0x115')});db[_0xfb87('0x70')]['belongsTo'](db['User'],{'as':_0xfb87('0x18f'),'foreignKey':_0xfb87('0x10d')});db[_0xfb87('0x70')]['belongsTo'](db['VoiceQueue'],{'as':_0xfb87('0x190'),'foreignKey':_0xfb87('0x149'),'onDelete':_0xfb87('0x115')});db[_0xfb87('0x70')]['belongsTo'](db[_0xfb87('0xdf')],{'as':_0xfb87('0xdf'),'foreignKey':_0xfb87('0x19a'),'onDelete':_0xfb87('0x115')});db[_0xfb87('0x70')][_0xfb87('0x11f')](db[_0xfb87('0x13')],{'as':_0xfb87('0x171'),'foreignKey':'OwnerId'});db['CmHopperBlack']['belongsTo'](db[_0xfb87('0x6e')],{'as':'Contact','foreignKey':_0xfb87('0x162'),'onDelete':_0xfb87('0x115')});db[_0xfb87('0x71')][_0xfb87('0x11f')](db[_0xfb87('0xec')],{'as':_0xfb87('0x16e'),'foreignKey':_0xfb87('0x17a'),'onDelete':'cascade'});db[_0xfb87('0x71')][_0xfb87('0x11f')](db[_0xfb87('0x1c')],{'as':'Queue','foreignKey':_0xfb87('0x149'),'onDelete':_0xfb87('0x115')});db['CmHopperBlack'][_0xfb87('0x11f')](db[_0xfb87('0xdf')],{'as':_0xfb87('0xdf'),'foreignKey':_0xfb87('0x19a'),'onDelete':_0xfb87('0x115')});db[_0xfb87('0x19b')][_0xfb87('0x110')](db[_0xfb87('0x7c')],{'as':{'plural':_0xfb87('0x19c'),'singular':_0xfb87('0x19d')},'foreignKey':_0xfb87('0x19e'),'onDelete':_0xfb87('0x115'),'hooks':!![]});db[_0xfb87('0x19b')][_0xfb87('0x110')](db['Condition'],{'as':{'plural':_0xfb87('0x19f'),'singular':_0xfb87('0x1a0')},'foreignKey':_0xfb87('0x1a1'),'onDelete':'cascade','hooks':!![]});db[_0xfb87('0x19b')][_0xfb87('0x110')](db['Action'],{'as':_0xfb87('0x1a2'),'foreignKey':_0xfb87('0x1a3'),'onDelete':_0xfb87('0x115'),'hooks':!![]});db['Disposition'][_0xfb87('0x110')](db[_0xfb87('0x17c')],{'as':'Dispositions','foreignKey':_0xfb87('0x1a4'),'onDelete':_0xfb87('0x115')});db['Interval'][_0xfb87('0x110')](db[_0xfb87('0x7d')],{'as':'Intervals','foreignKey':_0xfb87('0x151'),'onDelete':_0xfb87('0x115'),'hooks':!![],'required':![]});db['Interval'][_0xfb87('0x110')](db['VoiceExtension'],{'as':_0xfb87('0x114'),'foreignKey':_0xfb87('0x151'),'onDelete':_0xfb87('0x167')});db[_0xfb87('0x7d')]['hasMany'](db['MailApplication'],{'as':_0xfb87('0x1a5'),'foreignKey':'IntervalId'});db['Interval'][_0xfb87('0x110')](db['ChatApplication'],{'as':_0xfb87('0x1a6'),'foreignKey':_0xfb87('0x151')});db[_0xfb87('0x7d')]['hasMany'](db[_0xfb87('0x17e')],{'as':'FaxApplications','foreignKey':_0xfb87('0x151')});db['Interval'][_0xfb87('0x110')](db[_0xfb87('0x4d')],{'as':_0xfb87('0x1a7'),'foreignKey':_0xfb87('0x151')});db['Schedule'][_0xfb87('0x11f')](db[_0xfb87('0x37')],{});db[_0xfb87('0x82')]['belongsTo'](db[_0xfb87('0x91')],{'foreignKey':_0xfb87('0x1a8')});db[_0xfb87('0x82')][_0xfb87('0x11f')](db[_0xfb87('0x8f')],{'foreignKey':_0xfb87('0x1a9')});db[_0xfb87('0x84')][_0xfb87('0x121')](db[_0xfb87('0x145')],{'as':_0xfb87('0x1aa'),'through':_0xfb87('0x147'),'onDelete':_0xfb87('0x167')});db[_0xfb87('0x86')][_0xfb87('0x121')](db[_0xfb87('0x6e')],{'through':_0xfb87('0x199')});db[_0xfb87('0x86')][_0xfb87('0x121')](db[_0xfb87('0x61')],{'through':'chat_interaction_has_tags'});db['Tag']['belongsToMany'](db['MailInteraction'],{'through':_0xfb87('0x172')});db[_0xfb87('0x86')][_0xfb87('0x121')](db[_0xfb87('0x4f')],{'through':_0xfb87('0x187')});db[_0xfb87('0x86')]['belongsToMany'](db[_0xfb87('0x45')],{'through':_0xfb87('0x181')});db[_0xfb87('0x86')][_0xfb87('0x121')](db[_0xfb87('0x58')],{'through':_0xfb87('0x18b')});db[_0xfb87('0x86')]['belongsToMany'](db[_0xfb87('0xfa')],{'through':_0xfb87('0x1ab')});db['Trigger']['hasMany'](db[_0xfb87('0x7c')],{'as':{'plural':_0xfb87('0x1ac'),'singular':_0xfb87('0x1ad')},'foreignKey':_0xfb87('0x1ae'),'onDelete':_0xfb87('0x115'),'hooks':!![]});db[_0xfb87('0x89')][_0xfb87('0x110')](db[_0xfb87('0x7c')],{'as':{'plural':_0xfb87('0x1af'),'singular':_0xfb87('0x1b0')},'foreignKey':_0xfb87('0x1b1'),'onDelete':_0xfb87('0x115'),'hooks':!![]});db[_0xfb87('0x89')][_0xfb87('0x110')](db[_0xfb87('0x1b2')],{'as':'Actions','foreignKey':_0xfb87('0x1b3'),'onDelete':_0xfb87('0x115'),'hooks':!![]});db[_0xfb87('0x8f')]['hasMany'](db[_0xfb87('0x1b4')],{'as':'Fields','onDelete':_0xfb87('0x115'),'foreignKey':_0xfb87('0x1a9'),'hooks':!![]});db[_0xfb87('0x91')]['hasMany'](db[_0xfb87('0x1b4')],{'as':'Fields','onDelete':_0xfb87('0x115'),'foreignKey':_0xfb87('0x1a8')});db['AnalyticMetric']['hasMany'](db[_0xfb87('0x1b4')],{'as':_0xfb87('0x1b5'),'onDelete':'cascade','foreignKey':_0xfb87('0x1b6')});db[_0xfb87('0x1b4')][_0xfb87('0x11f')](db['AnalyticMetric'],{'foreignKey':_0xfb87('0x1b6')});db[_0xfb87('0x99')][_0xfb87('0x110')](db['SalesforceConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xfb87('0x1b7')});db[_0xfb87('0x1b8')]['hasMany'](db[_0xfb87('0x9c')],{'as':_0xfb87('0x1b9'),'onDelete':'cascade','foreignKey':_0xfb87('0x1ba')});db[_0xfb87('0x1b8')][_0xfb87('0x110')](db['SalesforceField'],{'as':_0xfb87('0x1bb'),'onDelete':_0xfb87('0x115'),'foreignKey':_0xfb87('0x1bc')});db[_0xfb87('0x1b8')][_0xfb87('0x110')](db['SalesforceField'],{'as':'Fields','onDelete':_0xfb87('0x115'),'foreignKey':_0xfb87('0x1bd')});db[_0xfb87('0x1b8')][_0xfb87('0x11f')](db['SalesforceAccount'],{'as':_0xfb87('0x177'),'foreignKey':_0xfb87('0x1b7')});db[_0xfb87('0x9c')][_0xfb87('0x110')](db[_0xfb87('0x9c')],{'as':'Subject','foreignKey':_0xfb87('0x1ba')});db[_0xfb87('0x9c')][_0xfb87('0x110')](db['SalesforceField'],{'as':_0xfb87('0x1be'),'foreignKey':_0xfb87('0x1bc')});db[_0xfb87('0x9c')][_0xfb87('0x110')](db[_0xfb87('0x9c')],{'as':_0xfb87('0x1bf'),'foreignKey':_0xfb87('0x1bd')});db[_0xfb87('0x9c')][_0xfb87('0x11f')](db['Variable'],{'as':_0xfb87('0x8a'),'foreignKey':_0xfb87('0x1c0')});db[_0xfb87('0x9e')]['hasMany'](db[_0xfb87('0xa0')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xfb87('0x1b7')});db['SugarcrmConfiguration'][_0xfb87('0x110')](db['SugarcrmField'],{'as':'Subjects','onDelete':_0xfb87('0x115'),'foreignKey':_0xfb87('0x1ba')});db['SugarcrmConfiguration'][_0xfb87('0x110')](db[_0xfb87('0xa2')],{'as':_0xfb87('0x1bb'),'onDelete':_0xfb87('0x115'),'foreignKey':_0xfb87('0x1bc')});db[_0xfb87('0xa0')][_0xfb87('0x110')](db[_0xfb87('0xa2')],{'as':_0xfb87('0x1b5'),'onDelete':_0xfb87('0x115'),'foreignKey':_0xfb87('0x1bd')});db['SugarcrmConfiguration'][_0xfb87('0x11f')](db[_0xfb87('0x9e')],{'as':_0xfb87('0x177'),'foreignKey':'AccountId'});db[_0xfb87('0xa2')][_0xfb87('0x110')](db[_0xfb87('0xa2')],{'as':_0xfb87('0x1c1'),'foreignKey':_0xfb87('0x1ba')});db['SugarcrmField'][_0xfb87('0x110')](db[_0xfb87('0xa2')],{'as':_0xfb87('0x1be'),'foreignKey':_0xfb87('0x1bc')});db[_0xfb87('0xa2')]['hasMany'](db[_0xfb87('0xa2')],{'as':_0xfb87('0x1bf'),'foreignKey':_0xfb87('0x1bd')});db['SugarcrmField'][_0xfb87('0x11f')](db[_0xfb87('0x8a')],{'as':'Variable','foreignKey':_0xfb87('0x1c0')});db['DeskAccount'][_0xfb87('0x110')](db[_0xfb87('0x1c2')],{'as':_0xfb87('0x1c3'),'onDelete':_0xfb87('0x115'),'foreignKey':_0xfb87('0x1b7')});db[_0xfb87('0x1c2')][_0xfb87('0x110')](db['DeskField'],{'as':'Subjects','onDelete':_0xfb87('0x115'),'foreignKey':_0xfb87('0x1ba')});db[_0xfb87('0x1c2')][_0xfb87('0x110')](db[_0xfb87('0x1c4')],{'as':_0xfb87('0x1bb'),'onDelete':_0xfb87('0x115'),'foreignKey':_0xfb87('0x1bc')});db[_0xfb87('0x1c2')][_0xfb87('0x110')](db[_0xfb87('0x1c4')],{'as':_0xfb87('0x1b5'),'onDelete':'cascade','foreignKey':_0xfb87('0x1bd')});db[_0xfb87('0x1c2')]['belongsTo'](db['DeskAccount'],{'as':_0xfb87('0x177'),'foreignKey':_0xfb87('0x1b7')});db[_0xfb87('0x1c2')]['belongsToMany'](db['Tag'],{'through':_0xfb87('0x1c5')});db[_0xfb87('0x1c4')][_0xfb87('0x110')](db[_0xfb87('0x1c4')],{'as':_0xfb87('0x1c1'),'foreignKey':_0xfb87('0x1ba')});db[_0xfb87('0x1c4')]['hasMany'](db[_0xfb87('0x1c4')],{'as':_0xfb87('0x1be'),'foreignKey':'DescriptionId'});db[_0xfb87('0x1c4')][_0xfb87('0x110')](db['DeskField'],{'as':'Field','foreignKey':_0xfb87('0x1bd')});db[_0xfb87('0x1c4')]['belongsTo'](db[_0xfb87('0x8a')],{'as':_0xfb87('0x8a'),'foreignKey':_0xfb87('0x1c0')});db['ZohoAccount'][_0xfb87('0x110')](db['ZohoConfiguration'],{'as':_0xfb87('0x1c3'),'onDelete':_0xfb87('0x115'),'foreignKey':_0xfb87('0x1b7')});db[_0xfb87('0xa9')][_0xfb87('0x110')](db[_0xfb87('0xab')],{'as':'Subjects','onDelete':_0xfb87('0x115'),'foreignKey':'SubjectId'});db[_0xfb87('0xa9')][_0xfb87('0x110')](db[_0xfb87('0xab')],{'as':_0xfb87('0x1bb'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xfb87('0xa9')]['hasMany'](db[_0xfb87('0xab')],{'as':'Fields','onDelete':_0xfb87('0x115'),'foreignKey':_0xfb87('0x1bd')});db[_0xfb87('0xa9')]['belongsTo'](db['ZohoAccount'],{'as':_0xfb87('0x177'),'foreignKey':_0xfb87('0x1b7')});db['ZohoField'][_0xfb87('0x110')](db[_0xfb87('0xab')],{'as':'Subject','foreignKey':_0xfb87('0x1ba')});db[_0xfb87('0xab')][_0xfb87('0x110')](db[_0xfb87('0xab')],{'as':_0xfb87('0x1be'),'foreignKey':'DescriptionId'});db[_0xfb87('0xab')]['hasMany'](db[_0xfb87('0xab')],{'as':_0xfb87('0x1bf'),'foreignKey':_0xfb87('0x1bd')});db['ZohoField'][_0xfb87('0x11f')](db['Variable'],{'as':_0xfb87('0x8a'),'foreignKey':_0xfb87('0x1c0')});db[_0xfb87('0x1c6')]['hasMany'](db[_0xfb87('0xae')],{'as':_0xfb87('0x1c3'),'onDelete':_0xfb87('0x115'),'foreignKey':'AccountId'});db[_0xfb87('0xae')][_0xfb87('0x110')](db[_0xfb87('0xb0')],{'as':_0xfb87('0x1b9'),'foreignKey':_0xfb87('0x1ba')});db[_0xfb87('0xae')][_0xfb87('0x110')](db[_0xfb87('0xb0')],{'as':_0xfb87('0x1bb'),'foreignKey':_0xfb87('0x1bc')});db[_0xfb87('0xae')][_0xfb87('0x110')](db[_0xfb87('0xb0')],{'as':_0xfb87('0x1b5'),'foreignKey':_0xfb87('0x1bd')});db[_0xfb87('0xae')][_0xfb87('0x11f')](db[_0xfb87('0x1c6')],{'as':_0xfb87('0x177'),'foreignKey':_0xfb87('0x1b7')});db[_0xfb87('0xae')]['belongsToMany'](db[_0xfb87('0x86')],{'through':_0xfb87('0x1c7')});db[_0xfb87('0xb0')][_0xfb87('0x110')](db[_0xfb87('0xb0')],{'as':_0xfb87('0x1c1'),'foreignKey':'SubjectId'});db[_0xfb87('0xb0')]['hasMany'](db['ZendeskField'],{'as':_0xfb87('0x1be'),'foreignKey':_0xfb87('0x1bc')});db[_0xfb87('0xb0')]['hasMany'](db[_0xfb87('0xb0')],{'as':'Field','foreignKey':_0xfb87('0x1bd')});db[_0xfb87('0xb0')][_0xfb87('0x11f')](db[_0xfb87('0x8a')],{'as':_0xfb87('0x8a'),'foreignKey':_0xfb87('0x1c0')});db[_0xfb87('0x1c8')][_0xfb87('0x110')](db[_0xfb87('0xb3')],{'as':'Configurations','onDelete':_0xfb87('0x115'),'foreignKey':_0xfb87('0x1b7')});db['FreshdeskConfiguration'][_0xfb87('0x110')](db[_0xfb87('0xb4')],{'as':_0xfb87('0x1b9'),'onDelete':_0xfb87('0x115'),'foreignKey':_0xfb87('0x1ba')});db[_0xfb87('0xb3')]['hasMany'](db[_0xfb87('0xb4')],{'as':'Descriptions','onDelete':_0xfb87('0x115'),'foreignKey':_0xfb87('0x1bc')});db['FreshdeskConfiguration'][_0xfb87('0x110')](db[_0xfb87('0xb4')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xfb87('0x1bd')});db[_0xfb87('0xb3')][_0xfb87('0x11f')](db[_0xfb87('0x1c8')],{'as':_0xfb87('0x177'),'foreignKey':_0xfb87('0x1b7')});db[_0xfb87('0xb3')][_0xfb87('0x121')](db['Tag'],{'through':_0xfb87('0x1c9')});db[_0xfb87('0xb4')][_0xfb87('0x110')](db[_0xfb87('0xb4')],{'as':_0xfb87('0x1c1'),'foreignKey':_0xfb87('0x1ba')});db['FreshdeskField'][_0xfb87('0x110')](db['FreshdeskField'],{'as':_0xfb87('0x1be'),'foreignKey':_0xfb87('0x1bc')});db['FreshdeskField']['hasMany'](db[_0xfb87('0xb4')],{'as':'Field','foreignKey':_0xfb87('0x1bd')});db[_0xfb87('0xb4')]['belongsTo'](db[_0xfb87('0x8a')],{'as':_0xfb87('0x8a'),'foreignKey':_0xfb87('0x1c0')});db['VtigerAccount']['hasMany'](db[_0xfb87('0xb6')],{'as':_0xfb87('0x1c3'),'onDelete':'cascade','foreignKey':_0xfb87('0x1b7')});db['VtigerConfiguration']['hasMany'](db[_0xfb87('0xb8')],{'as':_0xfb87('0x1b9'),'foreignKey':_0xfb87('0x1ba')});db['VtigerConfiguration'][_0xfb87('0x110')](db[_0xfb87('0xb8')],{'as':_0xfb87('0x1bb'),'foreignKey':_0xfb87('0x1bc')});db[_0xfb87('0xb6')][_0xfb87('0x110')](db[_0xfb87('0xb8')],{'as':_0xfb87('0x1b5'),'foreignKey':_0xfb87('0x1bd')});db[_0xfb87('0xb6')]['belongsTo'](db['VtigerAccount'],{'as':'Account','foreignKey':_0xfb87('0x1b7')});db[_0xfb87('0xb8')][_0xfb87('0x110')](db[_0xfb87('0xb8')],{'as':_0xfb87('0x1c1'),'foreignKey':'SubjectId'});db[_0xfb87('0xb8')]['hasMany'](db['VtigerField'],{'as':_0xfb87('0x1be'),'foreignKey':_0xfb87('0x1bc')});db[_0xfb87('0xb8')][_0xfb87('0x110')](db[_0xfb87('0xb8')],{'as':_0xfb87('0x1bf'),'foreignKey':'FieldId'});db['VtigerField'][_0xfb87('0x11f')](db['Variable'],{'as':_0xfb87('0x8a'),'foreignKey':_0xfb87('0x1c0')});db[_0xfb87('0x1ca')][_0xfb87('0x110')](db['ServicenowConfiguration'],{'as':_0xfb87('0x1c3'),'onDelete':_0xfb87('0x115'),'foreignKey':_0xfb87('0x1b7')});db[_0xfb87('0xbb')][_0xfb87('0x110')](db['ServicenowField'],{'as':_0xfb87('0x1b9'),'foreignKey':_0xfb87('0x1ba')});db[_0xfb87('0xbb')][_0xfb87('0x110')](db[_0xfb87('0xbc')],{'as':_0xfb87('0x1bb'),'foreignKey':_0xfb87('0x1bc')});db['ServicenowConfiguration'][_0xfb87('0x110')](db[_0xfb87('0xbc')],{'as':_0xfb87('0x1b5'),'foreignKey':_0xfb87('0x1bd')});db[_0xfb87('0xbb')][_0xfb87('0x11f')](db[_0xfb87('0x1ca')],{'as':_0xfb87('0x177'),'foreignKey':_0xfb87('0x1b7')});db['ServicenowField'][_0xfb87('0x110')](db[_0xfb87('0xbc')],{'as':_0xfb87('0x1c1'),'foreignKey':_0xfb87('0x1ba')});db[_0xfb87('0xbc')]['hasMany'](db[_0xfb87('0xbc')],{'as':_0xfb87('0x1be'),'foreignKey':_0xfb87('0x1bc')});db[_0xfb87('0xbc')]['hasMany'](db[_0xfb87('0xbc')],{'as':_0xfb87('0x1bf'),'foreignKey':_0xfb87('0x1bd')});db[_0xfb87('0xbc')][_0xfb87('0x11f')](db[_0xfb87('0x8a')],{'as':_0xfb87('0x8a'),'foreignKey':_0xfb87('0x1c0')});db[_0xfb87('0x1cb')][_0xfb87('0x110')](db[_0xfb87('0xbe')],{'as':'Configurations','onDelete':_0xfb87('0x115'),'foreignKey':_0xfb87('0x1b7')});db[_0xfb87('0x1cb')][_0xfb87('0x11f')](db['CloudProvider'],{'as':'CloudProvider','foreignKey':'CloudProviderId'});db['Dynamics365Configuration']['hasMany'](db[_0xfb87('0x1cc')],{'as':'Subjects','onDelete':_0xfb87('0x115'),'foreignKey':_0xfb87('0x1ba')});db[_0xfb87('0xbe')]['hasMany'](db[_0xfb87('0x1cc')],{'as':'Descriptions','onDelete':_0xfb87('0x115'),'foreignKey':'DescriptionId'});db[_0xfb87('0xbe')]['hasMany'](db[_0xfb87('0x1cc')],{'as':_0xfb87('0x1b5'),'onDelete':_0xfb87('0x115'),'foreignKey':_0xfb87('0x1bd')});db['Dynamics365Configuration'][_0xfb87('0x11f')](db[_0xfb87('0x1cb')],{'as':_0xfb87('0x177'),'foreignKey':_0xfb87('0x1b7')});db[_0xfb87('0x1cc')][_0xfb87('0x110')](db[_0xfb87('0x1cc')],{'as':_0xfb87('0x1c1'),'foreignKey':'SubjectId'});db['Dynamics365Field'][_0xfb87('0x110')](db[_0xfb87('0x1cc')],{'as':'Description','foreignKey':_0xfb87('0x1bc')});db['Dynamics365Field']['hasMany'](db[_0xfb87('0x1cc')],{'as':_0xfb87('0x1bf'),'foreignKey':'FieldId'});db[_0xfb87('0x1cc')][_0xfb87('0x11f')](db[_0xfb87('0x8a')],{'as':_0xfb87('0x8a'),'foreignKey':_0xfb87('0x1c0')});db[_0xfb87('0xbf')]['hasMany'](db['FreshsalesConfiguration'],{'as':'Configurations','onDelete':_0xfb87('0x115'),'foreignKey':_0xfb87('0x1b7')});db[_0xfb87('0xc1')][_0xfb87('0x110')](db[_0xfb87('0xc2')],{'as':_0xfb87('0x1b9'),'foreignKey':_0xfb87('0x1ba')});db[_0xfb87('0xc1')]['hasMany'](db[_0xfb87('0xc2')],{'as':'Descriptions','foreignKey':_0xfb87('0x1bc')});db['FreshsalesConfiguration'][_0xfb87('0x110')](db[_0xfb87('0xc2')],{'as':_0xfb87('0x1b5'),'foreignKey':_0xfb87('0x1bd')});db[_0xfb87('0xc1')][_0xfb87('0x11f')](db['FreshsalesAccount'],{'as':_0xfb87('0x177'),'foreignKey':_0xfb87('0x1b7')});db[_0xfb87('0xc2')][_0xfb87('0x110')](db[_0xfb87('0xc2')],{'as':_0xfb87('0x1c1'),'foreignKey':_0xfb87('0x1ba')});db[_0xfb87('0xc2')][_0xfb87('0x110')](db[_0xfb87('0xc2')],{'as':'Description','foreignKey':_0xfb87('0x1bc')});db['FreshsalesField'][_0xfb87('0x110')](db['FreshsalesField'],{'as':'Field','foreignKey':_0xfb87('0x1bd')});db[_0xfb87('0xc2')][_0xfb87('0x11f')](db[_0xfb87('0x8a')],{'as':_0xfb87('0x8a'),'foreignKey':_0xfb87('0x1c0')});db['ChatQueueReport'][_0xfb87('0x11f')](db['ChatWebsite'],{});db['ChatQueueReport']['belongsTo'](db['CmList'],{'as':_0xfb87('0x16e'),'foreignKey':_0xfb87('0x17a')});db[_0xfb87('0xc6')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xfb87('0x162')});db[_0xfb87('0xc6')]['belongsTo'](db[_0xfb87('0x61')],{});db['ChatQueueReport']['belongsTo'](db[_0xfb87('0x63')],{});db[_0xfb87('0xc6')][_0xfb87('0x11f')](db['User'],{});db[_0xfb87('0xc6')][_0xfb87('0x11f')](db['ChatQueue'],{});db[_0xfb87('0xc7')][_0xfb87('0x11f')](db[_0xfb87('0x13')],{'onDelete':_0xfb87('0x115'),'foreignKey':_0xfb87('0x1cd')});db[_0xfb87('0xc7')][_0xfb87('0x11f')](db[_0xfb87('0x13')],{'onDelete':_0xfb87('0x115'),'foreignKey':'ToId'});db['JscriptySessionReport'][_0xfb87('0x110')](db[_0xfb87('0x1ce')],{'foreignKey':'SessionId','onDelete':_0xfb87('0x115')});db[_0xfb87('0xcc')][_0xfb87('0x110')](db[_0xfb87('0xc9')],{'foreignKey':_0xfb87('0x1cf'),'onDelete':'cascade'});db[_0xfb87('0xce')][_0xfb87('0x11f')](db[_0xfb87('0x4b')],{});db[_0xfb87('0xce')]['belongsTo'](db[_0xfb87('0xec')],{'as':_0xfb87('0x16e'),'foreignKey':_0xfb87('0x17a')});db[_0xfb87('0xce')][_0xfb87('0x11f')](db['CmContact'],{'as':_0xfb87('0x161'),'foreignKey':'ContactId'});db[_0xfb87('0xce')]['belongsTo'](db['SmsInteraction'],{});db[_0xfb87('0xce')][_0xfb87('0x11f')](db[_0xfb87('0x51')],{});db[_0xfb87('0xce')][_0xfb87('0x11f')](db[_0xfb87('0x13')],{});db[_0xfb87('0xce')]['belongsTo'](db['SmsQueue'],{});db['JscriptyProject']['hasMany'](db[_0xfb87('0xcc')],{'foreignKey':_0xfb87('0x1d0')});db[_0xfb87('0xd2')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':_0xfb87('0x1d0')});db[_0xfb87('0xd2')][_0xfb87('0x110')](db[_0xfb87('0xc9')],{'foreignKey':_0xfb87('0x1d0')});db[_0xfb87('0xd7')]['belongsToMany'](db[_0xfb87('0x13')],{'as':_0xfb87('0x182'),'through':_0xfb87('0x141')});db[_0xfb87('0xdb')]['belongsToMany'](db[_0xfb87('0x13')],{'as':_0xfb87('0x155'),'through':_0xfb87('0x127')});db[_0xfb87('0xdb')]['belongsToMany'](db[_0xfb87('0x1c')],{'through':_0xfb87('0x1d1'),'as':'VoiceQueues'});db['Team']['belongsToMany'](db[_0xfb87('0x38')],{'through':_0xfb87('0x16f'),'as':_0xfb87('0x130')});db[_0xfb87('0xdb')][_0xfb87('0x121')](db[_0xfb87('0x66')],{'through':'team_has_chat_queues','as':_0xfb87('0x1d2')});db[_0xfb87('0xdb')]['belongsToMany'](db['FaxQueue'],{'through':'team_has_fax_queues','as':'FaxQueues'});db['Team'][_0xfb87('0x121')](db['SmsQueue'],{'through':_0xfb87('0x1d3'),'as':'SmsQueues'});db[_0xfb87('0xdb')]['belongsToMany'](db[_0xfb87('0x5b')],{'through':_0xfb87('0x1d4'),'as':'OpenchannelQueues'});db[_0xfb87('0xdb')][_0xfb87('0x121')](db[_0xfb87('0x102')],{'through':_0xfb87('0x1d5'),'as':'WhatsappQueues'});db['Team'][_0xfb87('0x121')](db['VoicePrefix'],{'through':_0xfb87('0x106'),'as':'VoicePrefixes'});db[_0xfb87('0xdf')][_0xfb87('0x110')](db[_0xfb87('0x70')],{'as':'Hoppers','foreignKey':_0xfb87('0x19a')});db[_0xfb87('0xdf')][_0xfb87('0x110')](db[_0xfb87('0x72')],{'as':_0xfb87('0x1d6'),'foreignKey':_0xfb87('0x19a')});db[_0xfb87('0xdf')][_0xfb87('0x110')](db[_0xfb87('0x116')],{'as':_0xfb87('0x14b'),'foreignKey':_0xfb87('0x19a')});db[_0xfb87('0xdf')][_0xfb87('0x110')](db[_0xfb87('0x71')],{'as':_0xfb87('0x14c'),'foreignKey':_0xfb87('0x19a')});db[_0xfb87('0xdf')]['belongsTo'](db[_0xfb87('0x14e')],{'as':'Trunk','foreignKey':_0xfb87('0x1d7')});db[_0xfb87('0xdf')][_0xfb87('0x11f')](db[_0xfb87('0x14e')],{'as':_0xfb87('0x14f'),'foreignKey':'TrunkBackupId'});db[_0xfb87('0xdf')][_0xfb87('0x11f')](db[_0xfb87('0x7d')],{'as':_0xfb87('0x7d'),'foreignKey':'IntervalId'});db[_0xfb87('0xdf')][_0xfb87('0x11f')](db[_0xfb87('0xd7')],{'as':'SquareProject','foreignKey':'SquareProjectId'});db[_0xfb87('0xdf')][_0xfb87('0x121')](db[_0xfb87('0xec')],{'as':_0xfb87('0x125'),'through':_0xfb87('0x1d8')});db[_0xfb87('0xdf')][_0xfb87('0x121')](db[_0xfb87('0xec')],{'as':_0xfb87('0x157'),'through':'campaigns_has_cm_blacklists'});db[_0xfb87('0xe2')][_0xfb87('0x11f')](db[_0xfb87('0x64')],{'as':_0xfb87('0x64'),'foreignKey':_0xfb87('0x194')});db[_0xfb87('0x1d9')][_0xfb87('0x11f')](db[_0xfb87('0x3d')],{});db[_0xfb87('0x1d9')][_0xfb87('0x11f')](db[_0xfb87('0x3b')],{});db['MailTransferReport'][_0xfb87('0x11f')](db[_0xfb87('0x37')],{'foreignKey':_0xfb87('0x1da'),'as':'FromAccount'});db[_0xfb87('0x1d9')]['belongsTo'](db[_0xfb87('0x13')],{'foreignKey':_0xfb87('0x1db'),'as':_0xfb87('0x1dc')});db[_0xfb87('0x1d9')][_0xfb87('0x11f')](db['User'],{'foreignKey':_0xfb87('0x1dd'),'as':_0xfb87('0x1de')});db[_0xfb87('0x1d9')][_0xfb87('0x11f')](db[_0xfb87('0x38')],{'foreignKey':_0xfb87('0x1df'),'as':'ToQueue'});db[_0xfb87('0x1d9')][_0xfb87('0x11f')](db['MailAccount'],{'foreignKey':'ToMailAccountId','as':'ToAccount'});db[_0xfb87('0xe6')][_0xfb87('0x11f')](db[_0xfb87('0x63')],{});db[_0xfb87('0xe6')][_0xfb87('0x11f')](db[_0xfb87('0x61')],{});db['ChatTransferReport'][_0xfb87('0x11f')](db['ChatWebsite'],{'foreignKey':_0xfb87('0x1e0'),'as':_0xfb87('0x1e1')});db[_0xfb87('0xe6')][_0xfb87('0x11f')](db[_0xfb87('0x13')],{'foreignKey':_0xfb87('0x1db'),'as':_0xfb87('0x1dc')});db[_0xfb87('0xe6')]['belongsTo'](db[_0xfb87('0x13')],{'foreignKey':'ToUserId','as':_0xfb87('0x1de')});db[_0xfb87('0xe6')][_0xfb87('0x11f')](db[_0xfb87('0x66')],{'foreignKey':'ToChatQueueId','as':_0xfb87('0x1e2')});db[_0xfb87('0xe6')][_0xfb87('0x11f')](db[_0xfb87('0x5d')],{'foreignKey':_0xfb87('0x1e3'),'as':'ToAccount'});db['FaxTransferReport'][_0xfb87('0x11f')](db[_0xfb87('0x47')],{});db[_0xfb87('0xe8')][_0xfb87('0x11f')](db[_0xfb87('0x45')],{});db[_0xfb87('0xe8')]['belongsTo'](db[_0xfb87('0x137')],{'foreignKey':_0xfb87('0x1e4'),'as':_0xfb87('0x1e1')});db[_0xfb87('0xe8')][_0xfb87('0x11f')](db['User'],{'foreignKey':'FromUserId','as':_0xfb87('0x1dc')});db['FaxTransferReport'][_0xfb87('0x11f')](db[_0xfb87('0x13')],{'foreignKey':'ToUserId','as':_0xfb87('0x1de')});db['FaxTransferReport'][_0xfb87('0x11f')](db[_0xfb87('0x48')],{'foreignKey':_0xfb87('0x1e5'),'as':_0xfb87('0x1e2')});db[_0xfb87('0xe8')][_0xfb87('0x11f')](db[_0xfb87('0x137')],{'foreignKey':_0xfb87('0x1e6'),'as':_0xfb87('0x1e7')});db['OpenchannelTransferReport'][_0xfb87('0x11f')](db[_0xfb87('0x59')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport'][_0xfb87('0x11f')](db[_0xfb87('0x54')],{'foreignKey':_0xfb87('0x1e8'),'as':_0xfb87('0x1e1')});db[_0xfb87('0xea')]['belongsTo'](db[_0xfb87('0x13')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xfb87('0xea')]['belongsTo'](db[_0xfb87('0x13')],{'foreignKey':_0xfb87('0x1dd'),'as':'ToAgent'});db[_0xfb87('0xea')]['belongsTo'](db[_0xfb87('0x5b')],{'foreignKey':_0xfb87('0x1e9'),'as':_0xfb87('0x1e2')});db[_0xfb87('0xea')][_0xfb87('0x11f')](db[_0xfb87('0x54')],{'foreignKey':_0xfb87('0x1ea'),'as':_0xfb87('0x1e7')});db[_0xfb87('0x1eb')][_0xfb87('0x11f')](db[_0xfb87('0x51')],{});db['SmsTransferReport'][_0xfb87('0x11f')](db[_0xfb87('0x4f')],{});db[_0xfb87('0x1eb')][_0xfb87('0x11f')](db[_0xfb87('0x4b')],{'foreignKey':_0xfb87('0x1ec'),'as':_0xfb87('0x1e1')});db['SmsTransferReport'][_0xfb87('0x11f')](db[_0xfb87('0x13')],{'foreignKey':_0xfb87('0x1db'),'as':_0xfb87('0x1dc')});db[_0xfb87('0x1eb')][_0xfb87('0x11f')](db[_0xfb87('0x13')],{'foreignKey':_0xfb87('0x1dd'),'as':_0xfb87('0x1de')});db[_0xfb87('0x1eb')][_0xfb87('0x11f')](db[_0xfb87('0x53')],{'foreignKey':_0xfb87('0x1ed'),'as':_0xfb87('0x1e2')});db[_0xfb87('0x1eb')][_0xfb87('0x11f')](db['SmsAccount'],{'foreignKey':'ToSmsAccountId','as':_0xfb87('0x1e7')});db[_0xfb87('0xec')]['hasMany'](db[_0xfb87('0x17c')],{'as':'Dispositions','foreignKey':_0xfb87('0x17a'),'onDelete':_0xfb87('0x115')});db[_0xfb87('0xec')][_0xfb87('0x110')](db[_0xfb87('0x77')],{'as':_0xfb87('0x1ee'),'foreignKey':_0xfb87('0x17a')});db['CmList'][_0xfb87('0x110')](db[_0xfb87('0x6e')],{'as':'Contacts','onDelete':'cascade','foreignKey':_0xfb87('0x17a')});db[_0xfb87('0xec')][_0xfb87('0x110')](db[_0xfb87('0x72')],{'as':'HopperFinals','foreignKey':_0xfb87('0x17a')});db[_0xfb87('0xec')][_0xfb87('0x110')](db['CmHopperHistory'],{'as':_0xfb87('0x117'),'foreignKey':'ListId'});db[_0xfb87('0xec')][_0xfb87('0x110')](db[_0xfb87('0x75')],{'as':_0xfb87('0x75'),'foreignKey':_0xfb87('0x17a')});db[_0xfb87('0xec')]['belongsToMany'](db[_0xfb87('0x1c')],{'as':_0xfb87('0x1ef'),'through':'voice_queues_has_cm_lists'});db[_0xfb87('0xec')][_0xfb87('0x121')](db[_0xfb87('0x13')],{'as':_0xfb87('0x155'),'through':_0xfb87('0x126')});db[_0xfb87('0xee')][_0xfb87('0x110')](db[_0xfb87('0x19')],{'as':_0xfb87('0x114'),'onDelete':'cascade'});db[_0xfb87('0xee')][_0xfb87('0x121')](db['User'],{'as':_0xfb87('0x155'),'through':_0xfb87('0x108')});db['VoicePrefix'][_0xfb87('0x121')](db[_0xfb87('0xdb')],{'through':'TeamVoicePrefix','as':_0xfb87('0x156')});db['UserProfile'][_0xfb87('0x110')](db[_0xfb87('0x13')],{'as':_0xfb87('0x182'),'foreignKey':'userProfileId'});db['UserProfile']['hasMany'](db['UserProfileSection'],{'as':_0xfb87('0x1f0'),'foreignKey':_0xfb87('0x1f1'),'onDelete':'cascade'});db[_0xfb87('0xf0')][_0xfb87('0x110')](db['UserProfileResource'],{'as':_0xfb87('0x1f2'),'foreignKey':_0xfb87('0x1f3'),'onDelete':_0xfb87('0x115')});db['WhatsappAccount'][_0xfb87('0x110')](db['Disposition'],{'as':_0xfb87('0x169'),'foreignKey':_0xfb87('0x1f4'),'onDelete':_0xfb87('0x115')});db[_0xfb87('0xf6')][_0xfb87('0x110')](db[_0xfb87('0x16a')],{'as':'Answers','foreignKey':_0xfb87('0x1f4')});db[_0xfb87('0xf6')]['hasMany'](db[_0xfb87('0xfc')],{'as':_0xfb87('0x159'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0xfb87('0x110')](db['WhatsappInteraction'],{'as':_0xfb87('0x16c')});db[_0xfb87('0xf6')][_0xfb87('0x110')](db['WhatsappApplication'],{'as':'Applications'});db[_0xfb87('0xf6')][_0xfb87('0x11f')](db[_0xfb87('0xec')],{'as':_0xfb87('0x16e'),'foreignKey':_0xfb87('0x17a')});db['WhatsappAccount'][_0xfb87('0x11f')](db[_0xfb87('0x7e')],{'as':'mandatoryDispositionPause','foreignKey':_0xfb87('0x153')});db['WhatsappAccount'][_0xfb87('0x121')](db[_0xfb87('0x13')],{'as':_0xfb87('0x155'),'through':_0xfb87('0x1f5')});db[_0xfb87('0xf8')][_0xfb87('0x11f')](db[_0xfb87('0x13')],{'onDelete':_0xfb87('0x167')});db[_0xfb87('0xf8')][_0xfb87('0x11f')](db['WhatsappQueue'],{'onDelete':'restrict'});db[_0xfb87('0xf8')][_0xfb87('0x11f')](db[_0xfb87('0xf6')],{'onDelete':_0xfb87('0x167')});db['WhatsappApplication']['belongsTo'](db[_0xfb87('0x7d')],{'onDelete':_0xfb87('0x167'),'foreignKey':_0xfb87('0x151')});db[_0xfb87('0xf8')]['belongsTo'](db['Tag'],{'onDelete':'restrict','foreignKey':_0xfb87('0x179')});db[_0xfb87('0xfa')]['hasMany'](db[_0xfb87('0xfc')],{'as':_0xfb87('0x159'),'onDelete':_0xfb87('0x115'),'foreignKey':_0xfb87('0x1f6')});db[_0xfb87('0xfa')][_0xfb87('0x11f')](db[_0xfb87('0xf6')],{'as':_0xfb87('0x177'),'foreignKey':_0xfb87('0x1f4')});db['WhatsappInteraction'][_0xfb87('0x11f')](db[_0xfb87('0x6e')],{'as':'Contact','foreignKey':_0xfb87('0x162')});db[_0xfb87('0xfa')]['belongsTo'](db[_0xfb87('0x13')],{'as':'Owner','foreignKey':_0xfb87('0x10d')});db[_0xfb87('0xfa')][_0xfb87('0x121')](db[_0xfb87('0x86')],{'through':_0xfb87('0x1ab'),'as':'Tags'});db[_0xfb87('0xfa')][_0xfb87('0x121')](db[_0xfb87('0x86')],{'through':'whatsapp_interaction_has_tags','as':_0xfb87('0x174')});db['WhatsappInteraction'][_0xfb87('0x121')](db['User'],{'as':_0xfb87('0x182'),'through':_0xfb87('0x12e'),'foreignKey':'WhatsappInteractionId'});db[_0xfb87('0xfc')][_0xfb87('0x11f')](db[_0xfb87('0x13')],{'as':_0xfb87('0x13')});db[_0xfb87('0xfc')][_0xfb87('0x11f')](db[_0xfb87('0x6e')],{'onDelete':'cascade','as':_0xfb87('0x161')});db[_0xfb87('0xfc')][_0xfb87('0x11f')](db['WhatsappInteraction'],{'onDelete':_0xfb87('0x115'),'as':_0xfb87('0x176'),'foreignKey':_0xfb87('0x1f6')});db[_0xfb87('0xfc')][_0xfb87('0x11f')](db['WhatsappAccount'],{'as':_0xfb87('0x177'),'foreignKey':'WhatsappAccountId'});db[_0xfb87('0xfe')][_0xfb87('0x11f')](db['WhatsappAccount'],{});db[_0xfb87('0xfe')][_0xfb87('0x11f')](db['CmList'],{'as':_0xfb87('0x16e'),'foreignKey':_0xfb87('0x17a')});db['WhatsappQueueReport']['belongsTo'](db[_0xfb87('0x6e')],{'as':_0xfb87('0x161'),'foreignKey':_0xfb87('0x162')});db['WhatsappQueueReport'][_0xfb87('0x11f')](db['WhatsappInteraction'],{});db[_0xfb87('0xfe')][_0xfb87('0x11f')](db[_0xfb87('0x102')],{});db['WhatsappQueueReport'][_0xfb87('0x11f')](db[_0xfb87('0xfc')],{});db[_0xfb87('0xfe')][_0xfb87('0x11f')](db[_0xfb87('0x13')],{});db[_0xfb87('0x100')][_0xfb87('0x11f')](db[_0xfb87('0xfc')],{});db[_0xfb87('0x100')][_0xfb87('0x11f')](db[_0xfb87('0xfa')],{});db[_0xfb87('0x100')][_0xfb87('0x11f')](db['WhatsappAccount'],{'foreignKey':_0xfb87('0x1f7'),'as':_0xfb87('0x1e1')});db['WhatsappTransferReport'][_0xfb87('0x11f')](db['WhatsappAccount'],{'foreignKey':_0xfb87('0x1f8'),'as':_0xfb87('0x1e7')});db[_0xfb87('0x100')][_0xfb87('0x11f')](db['WhatsappQueue'],{'foreignKey':'ToQueueId','as':_0xfb87('0x1e2')});db['WhatsappTransferReport'][_0xfb87('0x11f')](db[_0xfb87('0x13')],{'foreignKey':'FromUserId','as':_0xfb87('0x1dc')});db['WhatsappTransferReport'][_0xfb87('0x11f')](db[_0xfb87('0x13')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xfb87('0x102')][_0xfb87('0x121')](db['User'],{'as':'Agents','through':'UserWhatsappQueue','foreignKey':_0xfb87('0x1f9')});db['WhatsappQueue'][_0xfb87('0x121')](db[_0xfb87('0xdb')],{'through':_0xfb87('0x1d5'),'as':_0xfb87('0x156')});db[_0xfb87('0x10a')]['belongsTo'](db[_0xfb87('0x13')],{'as':'user','foreignKey':'UserId','onDelete':_0xfb87('0x115'),'hooks':!![]});db[_0xfb87('0x165')][_0xfb87('0x10e')](db['Dynamics365Account'],{'as':'Dynamics365Account','onDelete':_0xfb87('0x167')});db[_0xfb87('0x165')]['hasOne'](db[_0xfb87('0x163')],{'as':'Imap','onDelete':'restrict'});db[_0xfb87('0x165')][_0xfb87('0x10e')](db[_0xfb87('0x35')],{'as':_0xfb87('0x1fa'),'onDelete':'restrict'});module[_0xfb87('0x1fb')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index c00922c..fb72377 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5075=['./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','/api/license','./api/migration','/api/attachments','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','./api/rpc','/api/version','./api/version','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','/www','root','/demo','3.0.0','/plugins','/server/files/plugins','route','get','resolve','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','then','use','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboardItem','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/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/dispositions','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts'];(function(_0x225492,_0x53fe93){var _0x559c30=function(_0x1072ab){while(--_0x1072ab){_0x225492['push'](_0x225492['shift']());}};_0x559c30(++_0x53fe93);}(_0x5075,0x73));var _0x5507=function(_0x554b96,_0xa7f28){_0x554b96=_0x554b96-0x0;var _0xe445a8=_0x5075[_0x554b96];return _0xe445a8;};'use strict';var path=require(_0x5507('0x0'));var express=require(_0x5507('0x1'));var errors=require(_0x5507('0x2'));var config=require(_0x5507('0x3'));var setupLoggers=require(_0x5507('0x4'))[_0x5507('0x5')];var clientSideLogs=require(_0x5507('0x6'));exports['default']=function(_0x3e96ee){return setupLoggers(_0x3e96ee)[_0x5507('0x7')](function(){_0x3e96ee[_0x5507('0x8')]('/api/users',require('./api/user'));_0x3e96ee[_0x5507('0x8')](_0x5507('0x9'),require('./api/voiceChanSpy'));_0x3e96ee[_0x5507('0x8')](_0x5507('0xa'),require(_0x5507('0xb')));_0x3e96ee['use']('/api/voice/extensions',require(_0x5507('0xc')));_0x3e96ee[_0x5507('0x8')](_0x5507('0xd'),require(_0x5507('0xe')));_0x3e96ee['use'](_0x5507('0xf'),require(_0x5507('0x10')));_0x3e96ee['use'](_0x5507('0x11'),require(_0x5507('0x12')));_0x3e96ee['use'](_0x5507('0x13'),require(_0x5507('0x14')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x15'),require(_0x5507('0x16')));_0x3e96ee[_0x5507('0x8')]('/api/voice/mails/messages',require(_0x5507('0x17')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x18'),require(_0x5507('0x19')));_0x3e96ee['use'](_0x5507('0x1a'),require(_0x5507('0x1b')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x1c'),require(_0x5507('0x1d')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x1e'),require(_0x5507('0x1f')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x20'),require(_0x5507('0x21')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x22'),require('./api/trunk'));_0x3e96ee[_0x5507('0x8')](_0x5507('0x23'),require(_0x5507('0x24')));_0x3e96ee[_0x5507('0x8')]('/api/mail/out_servers',require(_0x5507('0x25')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x26'),require(_0x5507('0x27')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x28'),require('./api/mailQueue'));_0x3e96ee[_0x5507('0x8')](_0x5507('0x29'),require(_0x5507('0x2a')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x2b'),require(_0x5507('0x2c')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x2d'),require(_0x5507('0x2e')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x2f'),require(_0x5507('0x30')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x31'),require(_0x5507('0x32')));_0x3e96ee['use'](_0x5507('0x33'),require('./api/dashboard'));_0x3e96ee[_0x5507('0x8')]('/api/dashboards/items',require(_0x5507('0x34')));_0x3e96ee[_0x5507('0x8')]('/api/fax/accounts',require('./api/faxAccount'));_0x3e96ee[_0x5507('0x8')](_0x5507('0x35'),require('./api/faxApplication'));_0x3e96ee[_0x5507('0x8')](_0x5507('0x36'),require(_0x5507('0x37')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x38'),require(_0x5507('0x39')));_0x3e96ee['use'](_0x5507('0x3a'),require(_0x5507('0x3b')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x3c'),require(_0x5507('0x3d')));_0x3e96ee['use']('/api/sms/accounts',require(_0x5507('0x3e')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x3f'),require(_0x5507('0x40')));_0x3e96ee['use'](_0x5507('0x41'),require(_0x5507('0x42')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x43'),require(_0x5507('0x44')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x45'),require(_0x5507('0x46')));_0x3e96ee['use'](_0x5507('0x47'),require(_0x5507('0x48')));_0x3e96ee[_0x5507('0x8')]('/api/openchannel/applications',require('./api/openchannelApplication'));_0x3e96ee[_0x5507('0x8')](_0x5507('0x49'),require(_0x5507('0x4a')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x4b'),require('./api/openchannelMessage'));_0x3e96ee['use'](_0x5507('0x4c'),require(_0x5507('0x4d')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x4e'),require('./api/chatWebsite'));_0x3e96ee['use'](_0x5507('0x4f'),require('./api/openchannelQueueReport'));_0x3e96ee[_0x5507('0x8')](_0x5507('0x50'),require(_0x5507('0x51')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x52'),require(_0x5507('0x53')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x54'),require(_0x5507('0x55')));_0x3e96ee[_0x5507('0x8')]('/api/chat/offline_messages',require('./api/chatOfflineMessage'));_0x3e96ee['use']('/api/chat/queues',require(_0x5507('0x56')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x57'),require(_0x5507('0x58')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x59'),require(_0x5507('0x5a')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x5b'),require(_0x5507('0x5c')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x5d'),require(_0x5507('0x5e')));_0x3e96ee[_0x5507('0x8')]('/api/cm/hopper',require('./api/cmHopper'));_0x3e96ee['use'](_0x5507('0x5f'),require(_0x5507('0x60')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x61'),require(_0x5507('0x62')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x63'),require(_0x5507('0x64')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x65'),require(_0x5507('0x66')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x67'),require(_0x5507('0x68')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x69'),require(_0x5507('0x6a')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x6b'),require('./api/cannedAnswer'));_0x3e96ee[_0x5507('0x8')](_0x5507('0x6c'),require('./api/disposition'));_0x3e96ee['use'](_0x5507('0x6d'),require(_0x5507('0x6e')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x6f'),require(_0x5507('0x70')));_0x3e96ee['use'](_0x5507('0x71'),require(_0x5507('0x72')));_0x3e96ee[_0x5507('0x8')]('/api/cdr',require(_0x5507('0x73')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x74'),require(_0x5507('0x75')));_0x3e96ee[_0x5507('0x8')]('/api/schedules',require(_0x5507('0x76')));_0x3e96ee['use'](_0x5507('0x77'),require(_0x5507('0x78')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x79'),require(_0x5507('0x7a')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x7b'),require(_0x5507('0x7c')));_0x3e96ee['use'](_0x5507('0x7d'),require(_0x5507('0x7e')));_0x3e96ee['use']('/api/variables',require('./api/variable'));_0x3e96ee[_0x5507('0x8')]('/api/integrations',require(_0x5507('0x7f')));_0x3e96ee['use'](_0x5507('0x80'),require('./api/integrationReport'));_0x3e96ee['use'](_0x5507('0x81'),require(_0x5507('0x82')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x83'),require(_0x5507('0x84')));_0x3e96ee[_0x5507('0x8')]('/api/analytics/extracted_reports',require(_0x5507('0x85')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x86'),require('./api/analyticMetric'));_0x3e96ee[_0x5507('0x8')](_0x5507('0x87'),require(_0x5507('0x88')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x89'),require(_0x5507('0x8a')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x8b'),require(_0x5507('0x8c')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x8d'),require('./api/intSalesforceConfiguration'));_0x3e96ee['use'](_0x5507('0x8e'),require(_0x5507('0x8f')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x90'),require(_0x5507('0x91')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x92'),require(_0x5507('0x93')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x94'),require(_0x5507('0x95')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x96'),require(_0x5507('0x97')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x98'),require('./api/intDeskConfiguration'));_0x3e96ee[_0x5507('0x8')]('/api/integrations/desk/fields',require('./api/intDeskField'));_0x3e96ee[_0x5507('0x8')](_0x5507('0x99'),require(_0x5507('0x9a')));_0x3e96ee[_0x5507('0x8')]('/api/integrations/zoho/configurations',require(_0x5507('0x9b')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x9c'),require(_0x5507('0x9d')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x9e'),require('./api/intZendeskAccount'));_0x3e96ee[_0x5507('0x8')](_0x5507('0x9f'),require(_0x5507('0xa0')));_0x3e96ee['use']('/api/integrations/zendesk/fields',require(_0x5507('0xa1')));_0x3e96ee['use'](_0x5507('0xa2'),require(_0x5507('0xa3')));_0x3e96ee['use'](_0x5507('0xa4'),require(_0x5507('0xa5')));_0x3e96ee[_0x5507('0x8')](_0x5507('0xa6'),require(_0x5507('0xa7')));_0x3e96ee[_0x5507('0x8')](_0x5507('0xa8'),require(_0x5507('0xa9')));_0x3e96ee[_0x5507('0x8')](_0x5507('0xaa'),require(_0x5507('0xab')));_0x3e96ee[_0x5507('0x8')]('/api/integrations/vtiger/fields',require(_0x5507('0xac')));_0x3e96ee[_0x5507('0x8')](_0x5507('0xad'),require(_0x5507('0xae')));_0x3e96ee[_0x5507('0x8')]('/api/integrations/servicenow/configurations',require(_0x5507('0xaf')));_0x3e96ee['use'](_0x5507('0xb0'),require(_0x5507('0xb1')));_0x3e96ee[_0x5507('0x8')]('/api/integrations/dynamics365/accounts',require(_0x5507('0xb2')));_0x3e96ee[_0x5507('0x8')](_0x5507('0xb3'),require('./api/intDynamics365Configuration'));_0x3e96ee[_0x5507('0x8')]('/api/integrations/dynamics365/fields',require(_0x5507('0xb4')));_0x3e96ee['use']('/api/integrations/freshsales/accounts',require(_0x5507('0xb5')));_0x3e96ee[_0x5507('0x8')](_0x5507('0xb6'),require(_0x5507('0xb7')));_0x3e96ee[_0x5507('0x8')](_0x5507('0xb8'),require('./api/intFreshsalesField'));_0x3e96ee['use'](_0x5507('0xb9'),require(_0x5507('0xba')));_0x3e96ee[_0x5507('0x8')](_0x5507('0xbb'),require('./api/chatQueueReport'));_0x3e96ee[_0x5507('0x8')](_0x5507('0xbc'),require(_0x5507('0xbd')));_0x3e96ee[_0x5507('0x8')](_0x5507('0xbe'),require(_0x5507('0xbf')));_0x3e96ee[_0x5507('0x8')]('/api/jscripty/questions/reports',require(_0x5507('0xc0')));_0x3e96ee[_0x5507('0x8')](_0x5507('0xc1'),require('./api/jscriptySessionReport'));_0x3e96ee[_0x5507('0x8')]('/api/sms/reports/queue',require('./api/smsQueueReport'));_0x3e96ee['use'](_0x5507('0xc2'),require(_0x5507('0xc3')));_0x3e96ee[_0x5507('0x8')](_0x5507('0xc4'),require(_0x5507('0xc5')));_0x3e96ee[_0x5507('0x8')](_0x5507('0xc6'),require('./api/jscriptyProject'));_0x3e96ee[_0x5507('0x8')]('/api/settings',require(_0x5507('0xc7')));_0x3e96ee[_0x5507('0x8')](_0x5507('0xc8'),require(_0x5507('0xc9')));_0x3e96ee[_0x5507('0x8')](_0x5507('0xca'),require(_0x5507('0xcb')));_0x3e96ee[_0x5507('0x8')](_0x5507('0xcc'),require(_0x5507('0xcd')));_0x3e96ee[_0x5507('0x8')]('/api/square/messages',require(_0x5507('0xce')));_0x3e96ee[_0x5507('0x8')](_0x5507('0xcf'),require('./api/team'));_0x3e96ee[_0x5507('0x8')](_0x5507('0xd0'),require('./api/license'));_0x3e96ee[_0x5507('0x8')]('/api/campaigns',require('./api/campaign'));_0x3e96ee[_0x5507('0x8')]('/api/migrations',require(_0x5507('0xd1')));_0x3e96ee[_0x5507('0x8')](_0x5507('0xd2'),require(_0x5507('0xd3')));_0x3e96ee[_0x5507('0x8')](_0x5507('0xd4'),require('./api/plugin'));_0x3e96ee[_0x5507('0x8')](_0x5507('0xd5'),require(_0x5507('0xd6')));_0x3e96ee[_0x5507('0x8')](_0x5507('0xd7'),require(_0x5507('0xd8')));_0x3e96ee[_0x5507('0x8')](_0x5507('0xd9'),require(_0x5507('0xda')));_0x3e96ee[_0x5507('0x8')](_0x5507('0xdb'),require(_0x5507('0xdc')));_0x3e96ee['use'](_0x5507('0xdd'),require(_0x5507('0xde')));_0x3e96ee[_0x5507('0x8')](_0x5507('0xdf'),require(_0x5507('0xe0')));_0x3e96ee[_0x5507('0x8')]('/api/voice/prefixes',require(_0x5507('0xe1')));_0x3e96ee['use'](_0x5507('0xe2'),require('./api/userProfile'));_0x3e96ee['use'](_0x5507('0xe3'),require(_0x5507('0xe4')));_0x3e96ee[_0x5507('0x8')](_0x5507('0xe5'),require(_0x5507('0xe6')));_0x3e96ee['use'](_0x5507('0xe7'),require('./api/userNotification'));_0x3e96ee[_0x5507('0x8')](_0x5507('0xe8'),require(_0x5507('0xe9')));_0x3e96ee[_0x5507('0x8')]('/api/whatsapp/applications',require(_0x5507('0xea')));_0x3e96ee[_0x5507('0x8')](_0x5507('0xeb'),require('./api/whatsappInteraction'));_0x3e96ee['use'](_0x5507('0xec'),require(_0x5507('0xed')));_0x3e96ee[_0x5507('0x8')](_0x5507('0xee'),require(_0x5507('0xef')));_0x3e96ee[_0x5507('0x8')](_0x5507('0xf0'),require(_0x5507('0xf1')));_0x3e96ee[_0x5507('0x8')](_0x5507('0xf2'),require(_0x5507('0xf3')));_0x3e96ee[_0x5507('0x8')]('/api/cloudProviders',require(_0x5507('0xf4')));_0x3e96ee[_0x5507('0x8')](_0x5507('0xf5'),require(_0x5507('0xf6')));_0x3e96ee[_0x5507('0x8')](_0x5507('0xf7'),require(_0x5507('0xf8')));_0x3e96ee['use'](_0x5507('0xf9'),require(_0x5507('0xfa')));_0x3e96ee[_0x5507('0x8')](_0x5507('0xfb'),require('./api/authGoogle'));_0x3e96ee[_0x5507('0x8')](_0x5507('0xfc'),require(_0x5507('0xfd')));_0x3e96ee[_0x5507('0x8')](_0x5507('0xfe'),require(_0x5507('0xff')));_0x3e96ee[_0x5507('0x8')]('/api/rpc',require(_0x5507('0x100')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x101'),require(_0x5507('0x102')));_0x3e96ee[_0x5507('0x8')]('/api/system',require(_0x5507('0x103')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x104'),require(_0x5507('0x105')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x106'),require(_0x5507('0x107')));_0x3e96ee[_0x5507('0x8')](_0x5507('0x108'),clientSideLogs);_0x3e96ee[_0x5507('0x8')](_0x5507('0x109'),express[_0x5507('0x10a')](path[_0x5507('0x10b')](config['root'],'/apidoc')));_0x3e96ee['use'](_0x5507('0x10c'),express[_0x5507('0x10a')](path[_0x5507('0x10b')](config[_0x5507('0x10d')],_0x5507('0x10c'))));_0x3e96ee['use'](_0x5507('0x10e'),express[_0x5507('0x10a')](path[_0x5507('0x10b')](config['root'],_0x5507('0x10e'))));_0x3e96ee['use']('/snippet',express[_0x5507('0x10a')](path['join'](config[_0x5507('0x10d')],'snippet',_0x5507('0x10f'))));_0x3e96ee[_0x5507('0x8')](_0x5507('0x110'),express['static'](path['join'](config[_0x5507('0x10d')],_0x5507('0x111'))));_0x3e96ee[_0x5507('0x112')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x5507('0x113')](errors[0x194]);_0x3e96ee[_0x5507('0x112')]('/*')[_0x5507('0x113')](function(_0x8291cd,_0x513ea0){_0x513ea0['sendFile'](path[_0x5507('0x114')](_0x3e96ee[_0x5507('0x113')]('appPath')+_0x5507('0x115')));});return _0x3e96ee;});}; \ No newline at end of file +var _0x2d17=['/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./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/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptySessionReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/squareOdbc','./api/squareProject','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/license','./api/license','/api/campaigns','./api/campaign','./api/migration','/api/attachments','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/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/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','/api/rpc','./api/rpc','./api/version','./api/system','/api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/demo','snippet','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','/index.html','path','express','./config/environment','./utils/client-side-logger','./api/client-side-logs','default','then','/api/users','use','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceQueueReport','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/faxAccount','/api/fax/applications','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','./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/custom_fields','./api/cmCustomField','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/condition','/api/intervals','./api/interval','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','./api/trigger','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./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'];(function(_0xf39390,_0x4c1fd7){var _0x9c5a9f=function(_0x202e5e){while(--_0x202e5e){_0xf39390['push'](_0xf39390['shift']());}};_0x9c5a9f(++_0x4c1fd7);}(_0x2d17,0x17e));var _0x72d1=function(_0x475369,_0x5af0a5){_0x475369=_0x475369-0x0;var _0x415342=_0x2d17[_0x475369];return _0x415342;};'use strict';var path=require(_0x72d1('0x0'));var express=require(_0x72d1('0x1'));var errors=require('./errors');var config=require(_0x72d1('0x2'));var setupLoggers=require(_0x72d1('0x3'))['setupLoggers'];var clientSideLogs=require(_0x72d1('0x4'));exports[_0x72d1('0x5')]=function(_0x55b722){return setupLoggers(_0x55b722)[_0x72d1('0x6')](function(){_0x55b722['use'](_0x72d1('0x7'),require('./api/user'));_0x55b722[_0x72d1('0x8')](_0x72d1('0x9'),require('./api/voiceChanSpy'));_0x55b722[_0x72d1('0x8')](_0x72d1('0xa'),require(_0x72d1('0xb')));_0x55b722['use'](_0x72d1('0xc'),require(_0x72d1('0xd')));_0x55b722[_0x72d1('0x8')]('/api/voice/mohs',require(_0x72d1('0xe')));_0x55b722[_0x72d1('0x8')](_0x72d1('0xf'),require(_0x72d1('0x10')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x11'),require(_0x72d1('0x12')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x13'),require(_0x72d1('0x14')));_0x55b722['use'](_0x72d1('0x15'),require(_0x72d1('0x16')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x17'),require(_0x72d1('0x18')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x19'),require(_0x72d1('0x1a')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x1b'),require(_0x72d1('0x1c')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x1d'),require('./api/voiceAgentReport'));_0x55b722[_0x72d1('0x8')]('/api/voice/queues/reports',require(_0x72d1('0x1e')));_0x55b722[_0x72d1('0x8')]('/api/members/reports',require(_0x72d1('0x1f')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x20'),require('./api/trunk'));_0x55b722['use'](_0x72d1('0x21'),require(_0x72d1('0x22')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x23'),require(_0x72d1('0x24')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x25'),require('./api/mailAccount'));_0x55b722[_0x72d1('0x8')]('/api/mail/queues',require('./api/mailQueue'));_0x55b722['use']('/api/mail/substatuses',require(_0x72d1('0x26')));_0x55b722[_0x72d1('0x8')]('/api/mail/interactions',require(_0x72d1('0x27')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x28'),require(_0x72d1('0x29')));_0x55b722[_0x72d1('0x8')]('/api/mail/applications',require('./api/mailApplication'));_0x55b722[_0x72d1('0x8')](_0x72d1('0x2a'),require(_0x72d1('0x2b')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x2c'),require(_0x72d1('0x2d')));_0x55b722[_0x72d1('0x8')]('/api/dashboards/items',require('./api/dashboardItem'));_0x55b722[_0x72d1('0x8')]('/api/fax/accounts',require(_0x72d1('0x2e')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x2f'),require('./api/faxApplication'));_0x55b722[_0x72d1('0x8')]('/api/fax/interactions',require(_0x72d1('0x30')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x31'),require(_0x72d1('0x32')));_0x55b722['use'](_0x72d1('0x33'),require('./api/faxQueue'));_0x55b722[_0x72d1('0x8')](_0x72d1('0x34'),require('./api/faxQueueReport'));_0x55b722[_0x72d1('0x8')](_0x72d1('0x35'),require(_0x72d1('0x36')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x37'),require('./api/smsApplication'));_0x55b722[_0x72d1('0x8')](_0x72d1('0x38'),require(_0x72d1('0x39')));_0x55b722['use'](_0x72d1('0x3a'),require(_0x72d1('0x3b')));_0x55b722['use'](_0x72d1('0x3c'),require(_0x72d1('0x3d')));_0x55b722[_0x72d1('0x8')]('/api/openchannel/accounts',require(_0x72d1('0x3e')));_0x55b722['use'](_0x72d1('0x3f'),require(_0x72d1('0x40')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x41'),require(_0x72d1('0x42')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x43'),require(_0x72d1('0x44')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x45'),require(_0x72d1('0x46')));_0x55b722['use'](_0x72d1('0x47'),require(_0x72d1('0x48')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x49'),require('./api/openchannelQueueReport'));_0x55b722[_0x72d1('0x8')](_0x72d1('0x4a'),require(_0x72d1('0x4b')));_0x55b722['use'](_0x72d1('0x4c'),require(_0x72d1('0x4d')));_0x55b722[_0x72d1('0x8')]('/api/chat/messages',require(_0x72d1('0x4e')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x4f'),require('./api/chatOfflineMessage'));_0x55b722[_0x72d1('0x8')](_0x72d1('0x50'),require(_0x72d1('0x51')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x52'),require(_0x72d1('0x53')));_0x55b722[_0x72d1('0x8')]('/api/chat/proactive_actions',require(_0x72d1('0x54')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x55'),require(_0x72d1('0x56')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x57'),require(_0x72d1('0x58')));_0x55b722[_0x72d1('0x8')]('/api/cm/hopper',require(_0x72d1('0x59')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x5a'),require(_0x72d1('0x5b')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x5c'),require(_0x72d1('0x5d')));_0x55b722[_0x72d1('0x8')]('/api/cm/hopper_history',require('./api/cmHopperHistory'));_0x55b722[_0x72d1('0x8')](_0x72d1('0x5e'),require(_0x72d1('0x5f')));_0x55b722[_0x72d1('0x8')]('/api/actions',require(_0x72d1('0x60')));_0x55b722[_0x72d1('0x8')]('/api/automations',require(_0x72d1('0x61')));_0x55b722['use'](_0x72d1('0x62'),require(_0x72d1('0x63')));_0x55b722['use'](_0x72d1('0x64'),require('./api/disposition'));_0x55b722['use']('/api/conditions',require(_0x72d1('0x65')));_0x55b722['use'](_0x72d1('0x66'),require(_0x72d1('0x67')));_0x55b722[_0x72d1('0x8')]('/api/pauses',require('./api/pause'));_0x55b722[_0x72d1('0x8')]('/api/cdr',require('./api/cdr'));_0x55b722[_0x72d1('0x8')](_0x72d1('0x68'),require(_0x72d1('0x69')));_0x55b722['use']('/api/schedules',require('./api/schedule'));_0x55b722['use'](_0x72d1('0x6a'),require(_0x72d1('0x6b')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x6c'),require(_0x72d1('0x6d')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x6e'),require(_0x72d1('0x6f')));_0x55b722[_0x72d1('0x8')]('/api/triggers',require(_0x72d1('0x70')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x71'),require('./api/variable'));_0x55b722[_0x72d1('0x8')](_0x72d1('0x72'),require(_0x72d1('0x73')));_0x55b722['use'](_0x72d1('0x74'),require(_0x72d1('0x75')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x76'),require('./api/analyticCustomReport'));_0x55b722['use'](_0x72d1('0x77'),require(_0x72d1('0x78')));_0x55b722[_0x72d1('0x8')]('/api/analytics/extracted_reports',require(_0x72d1('0x79')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x7a'),require(_0x72d1('0x7b')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x7c'),require(_0x72d1('0x7d')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x7e'),require(_0x72d1('0x7f')));_0x55b722[_0x72d1('0x8')]('/api/integrations/salesforce/accounts',require(_0x72d1('0x80')));_0x55b722['use']('/api/integrations/salesforce/configurations',require(_0x72d1('0x81')));_0x55b722['use'](_0x72d1('0x82'),require(_0x72d1('0x83')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x84'),require(_0x72d1('0x85')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x86'),require(_0x72d1('0x87')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x88'),require(_0x72d1('0x89')));_0x55b722['use'](_0x72d1('0x8a'),require(_0x72d1('0x8b')));_0x55b722[_0x72d1('0x8')]('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x55b722[_0x72d1('0x8')](_0x72d1('0x8c'),require(_0x72d1('0x8d')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x8e'),require('./api/intZohoAccount'));_0x55b722[_0x72d1('0x8')]('/api/integrations/zoho/configurations',require(_0x72d1('0x8f')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x90'),require(_0x72d1('0x91')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x92'),require(_0x72d1('0x93')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x94'),require(_0x72d1('0x95')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x96'),require(_0x72d1('0x97')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x98'),require(_0x72d1('0x99')));_0x55b722[_0x72d1('0x8')]('/api/integrations/freshdesk/configurations',require(_0x72d1('0x9a')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x9b'),require(_0x72d1('0x9c')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x9d'),require('./api/intVtigerAccount'));_0x55b722[_0x72d1('0x8')](_0x72d1('0x9e'),require(_0x72d1('0x9f')));_0x55b722['use']('/api/integrations/vtiger/fields',require(_0x72d1('0xa0')));_0x55b722['use'](_0x72d1('0xa1'),require(_0x72d1('0xa2')));_0x55b722[_0x72d1('0x8')](_0x72d1('0xa3'),require(_0x72d1('0xa4')));_0x55b722[_0x72d1('0x8')](_0x72d1('0xa5'),require(_0x72d1('0xa6')));_0x55b722[_0x72d1('0x8')]('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x55b722[_0x72d1('0x8')](_0x72d1('0xa7'),require(_0x72d1('0xa8')));_0x55b722['use'](_0x72d1('0xa9'),require(_0x72d1('0xaa')));_0x55b722['use'](_0x72d1('0xab'),require(_0x72d1('0xac')));_0x55b722[_0x72d1('0x8')](_0x72d1('0xad'),require(_0x72d1('0xae')));_0x55b722[_0x72d1('0x8')](_0x72d1('0xaf'),require(_0x72d1('0xb0')));_0x55b722[_0x72d1('0x8')](_0x72d1('0xb1'),require(_0x72d1('0xb2')));_0x55b722[_0x72d1('0x8')]('/api/chat/reports/queue',require('./api/chatQueueReport'));_0x55b722[_0x72d1('0x8')](_0x72d1('0xb3'),require(_0x72d1('0xb4')));_0x55b722[_0x72d1('0x8')](_0x72d1('0xb5'),require(_0x72d1('0xb6')));_0x55b722[_0x72d1('0x8')](_0x72d1('0xb7'),require('./api/jscriptyQuestionReport'));_0x55b722[_0x72d1('0x8')]('/api/jscripty/sessions/reports',require(_0x72d1('0xb8')));_0x55b722[_0x72d1('0x8')]('/api/sms/reports/queue',require('./api/smsQueueReport'));_0x55b722[_0x72d1('0x8')](_0x72d1('0xb9'),require(_0x72d1('0xba')));_0x55b722[_0x72d1('0x8')](_0x72d1('0xbb'),require(_0x72d1('0xbc')));_0x55b722[_0x72d1('0x8')]('/api/jscripty/projects',require(_0x72d1('0xbd')));_0x55b722[_0x72d1('0x8')](_0x72d1('0xbe'),require('./api/setting'));_0x55b722[_0x72d1('0x8')]('/api/square/odbc',require(_0x72d1('0xbf')));_0x55b722[_0x72d1('0x8')]('/api/square/projects',require(_0x72d1('0xc0')));_0x55b722[_0x72d1('0x8')]('/api/square/recordings',require(_0x72d1('0xc1')));_0x55b722[_0x72d1('0x8')](_0x72d1('0xc2'),require(_0x72d1('0xc3')));_0x55b722['use']('/api/teams',require('./api/team'));_0x55b722[_0x72d1('0x8')](_0x72d1('0xc4'),require(_0x72d1('0xc5')));_0x55b722[_0x72d1('0x8')](_0x72d1('0xc6'),require(_0x72d1('0xc7')));_0x55b722['use']('/api/migrations',require(_0x72d1('0xc8')));_0x55b722[_0x72d1('0x8')](_0x72d1('0xc9'),require(_0x72d1('0xca')));_0x55b722[_0x72d1('0x8')](_0x72d1('0xcb'),require('./api/plugin'));_0x55b722[_0x72d1('0x8')](_0x72d1('0xcc'),require(_0x72d1('0xcd')));_0x55b722['use'](_0x72d1('0xce'),require(_0x72d1('0xcf')));_0x55b722[_0x72d1('0x8')](_0x72d1('0xd0'),require(_0x72d1('0xd1')));_0x55b722[_0x72d1('0x8')](_0x72d1('0xd2'),require(_0x72d1('0xd3')));_0x55b722['use'](_0x72d1('0xd4'),require(_0x72d1('0xd5')));_0x55b722[_0x72d1('0x8')](_0x72d1('0xd6'),require('./api/cmList'));_0x55b722['use'](_0x72d1('0xd7'),require(_0x72d1('0xd8')));_0x55b722['use'](_0x72d1('0xd9'),require(_0x72d1('0xda')));_0x55b722[_0x72d1('0x8')](_0x72d1('0xdb'),require(_0x72d1('0xdc')));_0x55b722[_0x72d1('0x8')](_0x72d1('0xdd'),require(_0x72d1('0xde')));_0x55b722['use'](_0x72d1('0xdf'),require(_0x72d1('0xe0')));_0x55b722[_0x72d1('0x8')](_0x72d1('0xe1'),require(_0x72d1('0xe2')));_0x55b722[_0x72d1('0x8')](_0x72d1('0xe3'),require(_0x72d1('0xe4')));_0x55b722['use'](_0x72d1('0xe5'),require(_0x72d1('0xe6')));_0x55b722[_0x72d1('0x8')](_0x72d1('0xe7'),require(_0x72d1('0xe8')));_0x55b722[_0x72d1('0x8')]('/api/whatsapp/reports/queue',require(_0x72d1('0xe9')));_0x55b722[_0x72d1('0x8')]('/api/whatsapp/reports/transfer',require(_0x72d1('0xea')));_0x55b722[_0x72d1('0x8')](_0x72d1('0xeb'),require(_0x72d1('0xec')));_0x55b722[_0x72d1('0x8')](_0x72d1('0xed'),require('./api/cloudProvider'));_0x55b722[_0x72d1('0x8')](_0x72d1('0xee'),require('./api/realtime'));_0x55b722['use'](_0x72d1('0xef'),require(_0x72d1('0xf0')));_0x55b722[_0x72d1('0x8')](_0x72d1('0xf1'),require('./api/authLocal'));_0x55b722[_0x72d1('0x8')](_0x72d1('0xf2'),require(_0x72d1('0xf3')));_0x55b722[_0x72d1('0x8')](_0x72d1('0xf4'),require(_0x72d1('0xf5')));_0x55b722[_0x72d1('0x8')](_0x72d1('0xf6'),require('./api/jira'));_0x55b722[_0x72d1('0x8')](_0x72d1('0xf7'),require(_0x72d1('0xf8')));_0x55b722[_0x72d1('0x8')]('/api/version',require(_0x72d1('0xf9')));_0x55b722[_0x72d1('0x8')]('/api/system',require(_0x72d1('0xfa')));_0x55b722['use'](_0x72d1('0xfb'),require('./api/pm2'));_0x55b722[_0x72d1('0x8')](_0x72d1('0xfc'),require(_0x72d1('0xfd')));_0x55b722[_0x72d1('0x8')](_0x72d1('0xfe'),clientSideLogs);_0x55b722['use'](_0x72d1('0xff'),express[_0x72d1('0x100')](path[_0x72d1('0x101')](config['root'],_0x72d1('0xff'))));_0x55b722[_0x72d1('0x8')]('/www',express[_0x72d1('0x100')](path[_0x72d1('0x101')](config[_0x72d1('0x102')],'/www')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x103'),express[_0x72d1('0x100')](path['join'](config[_0x72d1('0x102')],'/demo')));_0x55b722[_0x72d1('0x8')]('/snippet',express[_0x72d1('0x100')](path[_0x72d1('0x101')](config[_0x72d1('0x102')],_0x72d1('0x104'),'3.0.0')));_0x55b722[_0x72d1('0x8')](_0x72d1('0x105'),express[_0x72d1('0x100')](path[_0x72d1('0x101')](config['root'],_0x72d1('0x106'))));_0x55b722[_0x72d1('0x107')](_0x72d1('0x108'))[_0x72d1('0x109')](errors[0x194]);_0x55b722[_0x72d1('0x107')]('/*')[_0x72d1('0x109')](function(_0x3258d6,_0x5317be){_0x5317be['sendFile'](path['resolve'](_0x55b722[_0x72d1('0x109')]('appPath')+_0x72d1('0x10a')));});return _0x55b722;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 3d98cc0..93a437d 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x03eb=['../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','rpc','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/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/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc'];(function(_0x4a05f8,_0x50d60d){var _0x26ae1e=function(_0xfb023e){while(--_0xfb023e){_0x4a05f8['push'](_0x4a05f8['shift']());}};_0x26ae1e(++_0x50d60d);}(_0x03eb,0x19c));var _0xb03e=function(_0x560e64,_0x3b0905){_0x560e64=_0x560e64-0x0;var _0x5a9701=_0x03eb[_0x560e64];return _0x5a9701;};'use strict';var jayson=require(_0xb03e('0x0'));var _=require('lodash');var config=require('../config/environment');exports[_0xb03e('0x1')]=function(){return new Promise(function(_0x32f7ba,_0x2dacae){var _0x27e5be={};_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0x3')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require('../api/voiceExtension/voiceExtension.rpc'));_0x27e5be=_['merge'](_0x27e5be,require(_0xb03e('0x4')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0x5')));_0x27e5be=_['merge'](_0x27e5be,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0x6')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0x7')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0x8')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0x9')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0xa')));_0x27e5be=_['merge'](_0x27e5be,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0xb')));_0x27e5be=_['merge'](_0x27e5be,require(_0xb03e('0xc')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require('../api/mailQueue/mailQueue.rpc'));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0xd')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0xe')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0xf')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0x10')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require('../api/faxAccount/faxAccount.rpc'));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0x11')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0x12')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0x13')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0x14')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0x15')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0x16')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0x17')));_0x27e5be=_['merge'](_0x27e5be,require(_0xb03e('0x18')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0x19')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0x1a')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0x1b')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0x1c')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x27e5be=_['merge'](_0x27e5be,require(_0xb03e('0x1d')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0x1e')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0x1f')));_0x27e5be=_['merge'](_0x27e5be,require(_0xb03e('0x20')));_0x27e5be=_['merge'](_0x27e5be,require(_0xb03e('0x21')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0x22')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0x23')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x27e5be=_['merge'](_0x27e5be,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require('../api/interval/interval.rpc'));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require('../api/pause/pause.rpc'));_0x27e5be=_['merge'](_0x27e5be,require(_0xb03e('0x24')));_0x27e5be=_['merge'](_0x27e5be,require(_0xb03e('0x25')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0x26')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0x27')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0x28')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0x29')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0x2a')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x27e5be=_['merge'](_0x27e5be,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0x2b')));_0x27e5be=_['merge'](_0x27e5be,require(_0xb03e('0x2c')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0x2d')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0x2e')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require('../api/squareReport/squareReport.rpc'));_0x27e5be=_['merge'](_0x27e5be,require(_0xb03e('0x2f')));_0x27e5be=_['merge'](_0x27e5be,require('../api/setting/setting.rpc'));_0x27e5be=_['merge'](_0x27e5be,require(_0xb03e('0x30')));_0x27e5be=_['merge'](_0x27e5be,require(_0xb03e('0x31')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0x32')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require('../api/squareMessage/squareMessage.rpc'));_0x27e5be=_['merge'](_0x27e5be,require(_0xb03e('0x33')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0x34')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0x35')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0x36')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0x37')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require(_0xb03e('0x38')));_0x27e5be=_['merge'](_0x27e5be,require(_0xb03e('0x39')));_0x27e5be=_[_0xb03e('0x2')](_0x27e5be,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x409ec8=jayson[_0xb03e('0x3a')](_0x27e5be)[_0xb03e('0x3b')]();var _0x3ab833=config[_0xb03e('0x3c')]['port']||config['port']+0x1;var _0x22b61f=config[_0xb03e('0x3c')]['ip']||_0xb03e('0x3d');_0x409ec8['on'](_0xb03e('0x3e'),function(_0x18b20e){return _0x2dacae(_0x18b20e);});_0x409ec8[_0xb03e('0x1')](_0x3ab833,_0x22b61f,function(){console['log'](_0xb03e('0x3f'),_0x22b61f,_0x3ab833);require(_0xb03e('0x40'))['default']();return _0x32f7ba(_0xb03e('0x41')+_0x22b61f+':'+_0x3ab833);});});}; \ No newline at end of file +var _0x0c12=['../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','error','../config/triggers','default','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/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/trigger/trigger.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc'];(function(_0x1cb339,_0x43db94){var _0x3beeb2=function(_0x56d726){while(--_0x56d726){_0x1cb339['push'](_0x1cb339['shift']());}};_0x3beeb2(++_0x43db94);}(_0x0c12,0x17e));var _0x20c1=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x0c12[_0x4a9fb1];return _0x348672;};'use strict';var jayson=require(_0x20c1('0x0'));var _=require(_0x20c1('0x1'));var config=require(_0x20c1('0x2'));exports[_0x20c1('0x3')]=function(){return new Promise(function(_0x23ce2e,_0x2b5cb2){var _0x2b5d6a={};_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0x5')));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0x6')));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0x7')));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0x8')));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0x9')));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0xa')));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0xb')));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0xc')));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require('../api/memberReport/memberReport.rpc'));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require('../api/trunk/trunk.rpc'));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x2b5d6a=_['merge'](_0x2b5d6a,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require('../api/mailServerIn/mailServerIn.rpc'));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0xd')));_0x2b5d6a=_['merge'](_0x2b5d6a,require(_0x20c1('0xe')));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0xf')));_0x2b5d6a=_['merge'](_0x2b5d6a,require('../api/mailMessage/mailMessage.rpc'));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require('../api/mailApplication/mailApplication.rpc'));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0x10')));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require('../api/faxAccount/faxAccount.rpc'));_0x2b5d6a=_['merge'](_0x2b5d6a,require(_0x20c1('0x11')));_0x2b5d6a=_['merge'](_0x2b5d6a,require(_0x20c1('0x12')));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0x13')));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require('../api/faxQueue/faxQueue.rpc'));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0x14')));_0x2b5d6a=_['merge'](_0x2b5d6a,require(_0x20c1('0x15')));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0x16')));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0x17')));_0x2b5d6a=_['merge'](_0x2b5d6a,require(_0x20c1('0x18')));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x2b5d6a=_['merge'](_0x2b5d6a,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0x19')));_0x2b5d6a=_['merge'](_0x2b5d6a,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0x1a')));_0x2b5d6a=_['merge'](_0x2b5d6a,require('../api/chatInteraction/chatInteraction.rpc'));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0x1b')));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0x1c')));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require('../api/cmContact/cmContact.rpc'));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0x1d')));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0x1e')));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0x1f')));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0x20')));_0x2b5d6a=_['merge'](_0x2b5d6a,require('../api/interval/interval.rpc'));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0x21')));_0x2b5d6a=_['merge'](_0x2b5d6a,require('../api/sound/sound.rpc'));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require('../api/template/template.rpc'));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0x22')));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require('../api/variable/variable.rpc'));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0x23')));_0x2b5d6a=_['merge'](_0x2b5d6a,require(_0x20c1('0x24')));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0x25')));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0x26')));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0x27')));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0x28')));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0x29')));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0x2a')));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0x2b')));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0x2c')));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0x2d')));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0x2e')));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0x2f')));_0x2b5d6a=_['merge'](_0x2b5d6a,require('../api/squareOdbc/squareOdbc.rpc'));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0x30')));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require('../api/squareRecording/squareRecording.rpc'));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0x31')));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0x32')));_0x2b5d6a=_['merge'](_0x2b5d6a,require(_0x20c1('0x33')));_0x2b5d6a=_['merge'](_0x2b5d6a,require('../api/plugin/plugin.rpc'));_0x2b5d6a=_['merge'](_0x2b5d6a,require(_0x20c1('0x34')));_0x2b5d6a=_['merge'](_0x2b5d6a,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x2b5d6a=_['merge'](_0x2b5d6a,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x2b5d6a=_[_0x20c1('0x4')](_0x2b5d6a,require(_0x20c1('0x35')));var _0x35b0a0=jayson[_0x20c1('0x36')](_0x2b5d6a)[_0x20c1('0x37')]();var _0x5075d5=config[_0x20c1('0x38')][_0x20c1('0x39')]||config[_0x20c1('0x39')]+0x1;var _0x327796=config[_0x20c1('0x38')]['ip']||'localhost';_0x35b0a0['on'](_0x20c1('0x3a'),function(_0x4591a9){return _0x2b5cb2(_0x4591a9);});_0x35b0a0[_0x20c1('0x3')](_0x5075d5,_0x327796,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x327796,_0x5075d5);require(_0x20c1('0x3b'))[_0x20c1('0x3c')]();return _0x23ce2e('RPC\x20listening\x20on\x20'+_0x327796+':'+_0x5075d5);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 266f08e..1b9e2a1 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 _0xc82d=['GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','WAIT','error','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./error','call','setEncoding','utf8','headers','ready','toLowerCase','hangup','emit','520-Invalid','search','520\x20End\x20of\x20proper','function','substring','no\x20code','replace','result=','indexOf','split','length','match','E_AGI_SOCKET_ERROR','code','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','close','sendRequest','prototype','answer','ANSWER','getData','beep','format'];(function(_0x52849b,_0x190993){var _0x2413f8=function(_0x206e38){while(--_0x206e38){_0x52849b['push'](_0x52849b['shift']());}};_0x2413f8(++_0x190993);}(_0xc82d,0x7a));var _0xdc82=function(_0x28e502,_0x3e36c5){_0x28e502=_0x28e502-0x0;var _0x2fd662=_0xc82d[_0x28e502];return _0x2fd662;};'use strict';var util=require(_0xdc82('0x0'));var _=require(_0xdc82('0x1'));var EventEmitter=require(_0xdc82('0x2'))[_0xdc82('0x3')];var AGIReply=require('./reply');var AGIError=require(_0xdc82('0x4'));function AGIChannel(_0x26b615){var _0x463f21=this,_0x432b82=new AGIReply(),_0x542b33=![],_0x5ebe42={};EventEmitter[_0xdc82('0x5')](_0x463f21);_0x26b615[_0xdc82('0x6')](_0xdc82('0x7'));_0x26b615['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x432b82[_0xdc82('0x6')](_0xdc82('0x7'));_0x432b82['on'](_0xdc82('0x8'),function(_0x74d749){for(var _0x33f463 in _0x74d749){_0x463f21[_0x33f463]=_0x74d749[_0x33f463];}_0x463f21['emit'](_0xdc82('0x9'));});_0x432b82['on']('line',function(_0x312071){if(_0x312071[_0xdc82('0xa')]()==_0xdc82('0xb')){_0x463f21[_0xdc82('0xc')]('hangup');return;}if(_0x312071['substring'](0x0,0xb)==_0xdc82('0xd')){_0x542b33=!![];}if(_0x542b33){_0x5ebe42['rx']+=_0x312071+'\x0a';if(_0x312071[_0xdc82('0xe')](_0xdc82('0xf'))!=-0x1){_0x542b33=![];}}else{_0x5ebe42['rx']=_0x312071;}if(_0x542b33){return;}if(typeof _0x5ebe42['cb']==_0xdc82('0x10')){var _0x1b7a0a=_0x5ebe42['rx'][_0xdc82('0x11')](0x0,0x3),_0x49d126=null,_0xfaf0cb=null;_0x1b7a0a=parseInt(_0x1b7a0a);if(isNaN(_0x1b7a0a)){_0x5ebe42['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xdc82('0x12')});return;}if(_0x1b7a0a!=0xc8){_0x5ebe42['cb'](null,{'code':_0x1b7a0a,'result':-0x1,'extra':'KO'});return;}_0x49d126=_0x5ebe42['rx'][_0xdc82('0x11')](0x4)[_0xdc82('0x13')](_0xdc82('0x14'),'');if(_0x49d126[_0xdc82('0x15')]('\x20')!=-0x1){_0x49d126=_0x49d126['substr'](0x0,_0x49d126[_0xdc82('0x15')]('\x20'));}if(_['startsWith'](_0x49d126,'-1')){_0x49d126=parseInt(_0x49d126);}_0xfaf0cb=_0x5ebe42['rx'][_0xdc82('0x16')]('\x20');if(_0xfaf0cb['length']==0x3){_0xfaf0cb=_0xfaf0cb[0x2]['substring'](0x1,_0xfaf0cb[0x2][_0xdc82('0x17')]-0x1);}else if(_0xfaf0cb[_0xdc82('0x17')]>0x3){var _0x89d431=/\((.+)\)/;var _0x240080=_0x5ebe42['rx'][_0xdc82('0x18')](_0x89d431);if(_0x240080){_0xfaf0cb=_0x240080[0x1];}else{_0xfaf0cb=null;}}else{_0xfaf0cb=null;}_0x5ebe42['cb'](null,{'code':_0x1b7a0a,'result':_0x49d126,'extra':_0xfaf0cb});}});_0x26b615['on']('error',function(_0x2d0ac9){_0x463f21['emit']('error',new AGIError(_0xdc82('0x19'),_0x2d0ac9[_0xdc82('0x1a')]));});_0x26b615['on']('close',function(){_0x463f21[_0xdc82('0xc')]('close',new AGIError(_0xdc82('0x1b')));});_0x26b615['on'](_0xdc82('0x1c'),function(){_0x463f21[_0xdc82('0xc')](_0xdc82('0x1c'),new AGIError(_0xdc82('0x1d')));_0x26b615[_0xdc82('0x1e')]();});_0x26b615[_0xdc82('0x1f')](_0x432b82);this[_0xdc82('0x20')]=function(_0x4e36a1,_0x271a63){var _0x4e36a1=_0x4e36a1||'',_0x271a63=typeof _0x271a63==_0xdc82('0x10')?_0x271a63:new Function();_0x5ebe42={'tx':_0x4e36a1,'rx':'','cb':_0x271a63};_0x26b615[_0xdc82('0x21')](_0x4e36a1+'\x0a');},this[_0xdc82('0x22')]=function(){_0x26b615[_0xdc82('0x1e')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype'][_0xdc82('0x23')]=function(_0x4902d5){return this[_0xdc82('0x20')]['sync'](this,_0x4902d5);};AGIChannel[_0xdc82('0x24')][_0xdc82('0x25')]=function(){return this[_0xdc82('0x23')](_0xdc82('0x26'));};AGIChannel[_0xdc82('0x24')][_0xdc82('0x27')]=function(_0x318c0c,_0x2dc99d,_0x47164e){_0x318c0c=_0x318c0c===undefined?_0xdc82('0x28'):_0x318c0c;_0x2dc99d=_0x2dc99d===undefined?'5':_0x2dc99d;_0x47164e=_0x47164e===undefined?'1':_0x47164e;return this[_0xdc82('0x23')](util[_0xdc82('0x29')](_0xdc82('0x2a'),_0x318c0c,_0x2dc99d*0x3e8,_0x47164e));};AGIChannel[_0xdc82('0x24')][_0xdc82('0x2b')]=function(_0x589ff7){_0x589ff7=_0x589ff7||'NO\x20MESSAGE';return this['sendRequest'](util[_0xdc82('0x29')](_0xdc82('0x2c'),_0x589ff7));};AGIChannel[_0xdc82('0x24')][_0xdc82('0x2d')]=function(_0x26e775,_0x239897){if(_['isArray'](_0x239897)){return this['sendRequest'](util[_0xdc82('0x29')](_0xdc82('0x2e'),_0x26e775,_0x239897[_0xdc82('0x2f')](',')));}return this[_0xdc82('0x23')](util[_0xdc82('0x29')](_0xdc82('0x2e'),_0x26e775,_0x239897));};AGIChannel['prototype'][_0xdc82('0x30')]=function(_0x192a81){return this[_0xdc82('0x23')](util[_0xdc82('0x29')](_0xdc82('0x31'),_0x192a81));};AGIChannel['prototype'][_0xdc82('0x32')]=function(_0x2bee2f){return this[_0xdc82('0x23')](util[_0xdc82('0x29')](_0xdc82('0x33'),_0x2bee2f));};AGIChannel[_0xdc82('0x24')][_0xdc82('0x34')]=function(_0x3c0df9){return this[_0xdc82('0x23')](util['format'](_0xdc82('0x35'),_0x3c0df9));};AGIChannel['prototype'][_0xdc82('0xb')]=function(){return this[_0xdc82('0x23')](_0xdc82('0x36'));};AGIChannel[_0xdc82('0x24')][_0xdc82('0x37')]=function(_0x68641c,_0xdbc9c2){var _0x2cac61=_[_0xdc82('0x38')](_0xdbc9c2)||_['isNumber'](_0xdbc9c2)?_0xdbc9c2[_0xdc82('0x39')]():_0xdbc9c2;return this['sendRequest'](util['format'](_0xdc82('0x3a'),_0x68641c,_0x2cac61?_0x2cac61[_0xdc82('0x39')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xdc82('0x24')][_0xdc82('0x3b')]=function(_0x37d40b,_0x3e2e8b){return this[_0xdc82('0x23')](util[_0xdc82('0x29')](_0xdc82('0x3c'),_0x37d40b,_0x3e2e8b));};AGIChannel[_0xdc82('0x24')][_0xdc82('0x3d')]=function(_0x8c3590,_0x5bfb36){return this['sendRequest'](util[_0xdc82('0x29')](_0xdc82('0x3e'),_0x8c3590,_0x5bfb36));};AGIChannel[_0xdc82('0x24')][_0xdc82('0x3f')]=function(_0x5b3635,_0xd92aef){return this[_0xdc82('0x23')](util[_0xdc82('0x29')](_0xdc82('0x40'),_0x5b3635,_0xd92aef));};AGIChannel['prototype'][_0xdc82('0x41')]=function(_0x4c9ade,_0x3a299d,_0x4f4615){_0x3a299d=_0x3a299d||this[_0xdc82('0x42')];_0x4f4615=_0x4f4615||0x1;this[_0xdc82('0x30')](_0x4c9ade);this[_0xdc82('0x32')](_0x3a299d);this['setPriority'](_0x4f4615);return this[_0xdc82('0x2b')](util[_0xdc82('0x29')](_0xdc82('0x43'),_0x4c9ade,_0x3a299d,_0x4f4615));};AGIChannel[_0xdc82('0x24')][_0xdc82('0x44')]=function(_0x47ebd4){return this[_0xdc82('0x23')](util[_0xdc82('0x29')](_0xdc82('0x45'),_0x47ebd4));};AGIChannel[_0xdc82('0x24')][_0xdc82('0x46')]=function(_0x257c1f,_0x27d83c,_0x2c0ca3,_0x5158b6,_0x5a2494,_0x2ee7fb){_0x27d83c=_0x27d83c||_0xdc82('0x47');_0x2c0ca3=_0x2c0ca3||'';_0x5158b6=_0x5158b6===undefined?-0x1:_0x5158b6==='-1'?-0x1:_0x5158b6*0x3e8;_0x5a2494=_0x5a2494===undefined?'':'s='+_0x5a2494;_0x2ee7fb=_0x2ee7fb?_0xdc82('0x48'):'';return this['sendRequest'](util[_0xdc82('0x29')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x257c1f,_0x27d83c,_0x2c0ca3,_0x5158b6,_0x2ee7fb,_0x5a2494));};AGIChannel[_0xdc82('0x24')][_0xdc82('0x49')]=function(_0x10e964,_0x14e61a){_0x14e61a=_0x14e61a||'';return this[_0xdc82('0x23')](util['format'](_0xdc82('0x4a'),_0x10e964,_0x14e61a));};AGIChannel['prototype'][_0xdc82('0x4b')]=function(_0x54711a){return this[_0xdc82('0x2d')](_0xdc82('0x4c'),_0x54711a);};AGIChannel[_0xdc82('0x24')]['wait']=function(_0x410b2c){return this['exec'](_0xdc82('0x4d'),_0x410b2c);};AGIChannel['prototype'][_0xdc82('0x4e')]=function(_0x2e2ca2,_0x20eead){this[_0xdc82('0x2b')](util[_0xdc82('0x29')](_0xdc82('0x4f'),_0x2e2ca2['id'],_0x2e2ca2[_0xdc82('0x50')],_0x20eead));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xdc82('0x51')]=AGIChannel; \ No newline at end of file +var _0x1c3a=['exports','util','lodash','events','./reply','./error','call','utf8','setTimeout','setEncoding','headers','ready','line','toLowerCase','hangup','emit','substring','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','pipe','write','destroy','inherits','prototype','sendRequest','command','sync','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','join','setContext','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','AGI','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label'];(function(_0x1233d9,_0x3ca200){var _0x44b5d3=function(_0x35f3bd){while(--_0x35f3bd){_0x1233d9['push'](_0x1233d9['shift']());}};_0x44b5d3(++_0x3ca200);}(_0x1c3a,0x9d));var _0xa1c3=function(_0xe4ee1e,_0xea8b9b){_0xe4ee1e=_0xe4ee1e-0x0;var _0x22f903=_0x1c3a[_0xe4ee1e];return _0x22f903;};'use strict';var util=require(_0xa1c3('0x0'));var _=require(_0xa1c3('0x1'));var EventEmitter=require(_0xa1c3('0x2'))['EventEmitter'];var AGIReply=require(_0xa1c3('0x3'));var AGIError=require(_0xa1c3('0x4'));function AGIChannel(_0x20b8b5){var _0xf9a98b=this,_0x5ee23f=new AGIReply(),_0xfca3d=![],_0x5d08c7={};EventEmitter[_0xa1c3('0x5')](_0xf9a98b);_0x20b8b5['setEncoding'](_0xa1c3('0x6'));_0x20b8b5[_0xa1c3('0x7')](0x8*0x3c*0x3c*0x3e8);_0x5ee23f[_0xa1c3('0x8')](_0xa1c3('0x6'));_0x5ee23f['on'](_0xa1c3('0x9'),function(_0x23a8dc){for(var _0x208c73 in _0x23a8dc){_0xf9a98b[_0x208c73]=_0x23a8dc[_0x208c73];}_0xf9a98b['emit'](_0xa1c3('0xa'));});_0x5ee23f['on'](_0xa1c3('0xb'),function(_0xfb31b6){if(_0xfb31b6[_0xa1c3('0xc')]()==_0xa1c3('0xd')){_0xf9a98b[_0xa1c3('0xe')](_0xa1c3('0xd'));return;}if(_0xfb31b6[_0xa1c3('0xf')](0x0,0xb)=='520-Invalid'){_0xfca3d=!![];}if(_0xfca3d){_0x5d08c7['rx']+=_0xfb31b6+'\x0a';if(_0xfb31b6['search'](_0xa1c3('0x10'))!=-0x1){_0xfca3d=![];}}else{_0x5d08c7['rx']=_0xfb31b6;}if(_0xfca3d){return;}if(typeof _0x5d08c7['cb']==_0xa1c3('0x11')){var _0x545854=_0x5d08c7['rx']['substring'](0x0,0x3),_0x869c36=null,_0x4f1aa0=null;_0x545854=parseInt(_0x545854);if(isNaN(_0x545854)){_0x5d08c7['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xa1c3('0x12')});return;}if(_0x545854!=0xc8){_0x5d08c7['cb'](null,{'code':_0x545854,'result':-0x1,'extra':'KO'});return;}_0x869c36=_0x5d08c7['rx'][_0xa1c3('0xf')](0x4)[_0xa1c3('0x13')](_0xa1c3('0x14'),'');if(_0x869c36[_0xa1c3('0x15')]('\x20')!=-0x1){_0x869c36=_0x869c36[_0xa1c3('0x16')](0x0,_0x869c36[_0xa1c3('0x15')]('\x20'));}if(_[_0xa1c3('0x17')](_0x869c36,'-1')){_0x869c36=parseInt(_0x869c36);}_0x4f1aa0=_0x5d08c7['rx'][_0xa1c3('0x18')]('\x20');if(_0x4f1aa0[_0xa1c3('0x19')]==0x3){_0x4f1aa0=_0x4f1aa0[0x2][_0xa1c3('0xf')](0x1,_0x4f1aa0[0x2]['length']-0x1);}else if(_0x4f1aa0[_0xa1c3('0x19')]>0x3){var _0x51acce=/\((.+)\)/;var _0x3500f8=_0x5d08c7['rx'][_0xa1c3('0x1a')](_0x51acce);if(_0x3500f8){_0x4f1aa0=_0x3500f8[0x1];}else{_0x4f1aa0=null;}}else{_0x4f1aa0=null;}_0x5d08c7['cb'](null,{'code':_0x545854,'result':_0x869c36,'extra':_0x4f1aa0});}});_0x20b8b5['on']('error',function(_0x282d52){_0xf9a98b[_0xa1c3('0xe')](_0xa1c3('0x1b'),new AGIError(_0xa1c3('0x1c'),_0x282d52[_0xa1c3('0x1d')]));});_0x20b8b5['on'](_0xa1c3('0x1e'),function(){_0xf9a98b[_0xa1c3('0xe')](_0xa1c3('0x1e'),new AGIError(_0xa1c3('0x1f')));});_0x20b8b5['on']('timeout',function(){_0xf9a98b[_0xa1c3('0xe')]('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x20b8b5['destroy']();});_0x20b8b5[_0xa1c3('0x20')](_0x5ee23f);this['command']=function(_0x11aa29,_0x3246df){var _0x11aa29=_0x11aa29||'',_0x3246df=typeof _0x3246df==_0xa1c3('0x11')?_0x3246df:new Function();_0x5d08c7={'tx':_0x11aa29,'rx':'','cb':_0x3246df};_0x20b8b5[_0xa1c3('0x21')](_0x11aa29+'\x0a');},this[_0xa1c3('0x1e')]=function(){_0x20b8b5[_0xa1c3('0x22')]();};}util[_0xa1c3('0x23')](AGIChannel,EventEmitter);AGIChannel[_0xa1c3('0x24')][_0xa1c3('0x25')]=function(_0x3451fb){return this[_0xa1c3('0x26')][_0xa1c3('0x27')](this,_0x3451fb);};AGIChannel[_0xa1c3('0x24')]['answer']=function(){return this[_0xa1c3('0x25')](_0xa1c3('0x28'));};AGIChannel[_0xa1c3('0x24')][_0xa1c3('0x29')]=function(_0x2e731c,_0x46308e,_0x4568d6){_0x2e731c=_0x2e731c===undefined?_0xa1c3('0x2a'):_0x2e731c;_0x46308e=_0x46308e===undefined?'5':_0x46308e;_0x4568d6=_0x4568d6===undefined?'1':_0x4568d6;return this[_0xa1c3('0x25')](util[_0xa1c3('0x2b')](_0xa1c3('0x2c'),_0x2e731c,_0x46308e*0x3e8,_0x4568d6));};AGIChannel['prototype'][_0xa1c3('0x2d')]=function(_0x266771){_0x266771=_0x266771||_0xa1c3('0x2e');return this[_0xa1c3('0x25')](util[_0xa1c3('0x2b')](_0xa1c3('0x2f'),_0x266771));};AGIChannel[_0xa1c3('0x24')][_0xa1c3('0x30')]=function(_0x18f981,_0x4903be){if(_['isArray'](_0x4903be)){return this[_0xa1c3('0x25')](util[_0xa1c3('0x2b')](_0xa1c3('0x31'),_0x18f981,_0x4903be[_0xa1c3('0x32')](',')));}return this[_0xa1c3('0x25')](util['format'](_0xa1c3('0x31'),_0x18f981,_0x4903be));};AGIChannel[_0xa1c3('0x24')][_0xa1c3('0x33')]=function(_0x4472c6){return this[_0xa1c3('0x25')](util[_0xa1c3('0x2b')]('SET\x20CONTEXT\x20%s',_0x4472c6));};AGIChannel['prototype'][_0xa1c3('0x34')]=function(_0x49b589){return this[_0xa1c3('0x25')](util[_0xa1c3('0x2b')]('SET\x20EXTENSION\x20%s',_0x49b589));};AGIChannel['prototype'][_0xa1c3('0x35')]=function(_0x6fd33e){return this['sendRequest'](util[_0xa1c3('0x2b')](_0xa1c3('0x36'),_0x6fd33e));};AGIChannel['prototype'][_0xa1c3('0xd')]=function(){return this[_0xa1c3('0x25')](_0xa1c3('0x37'));};AGIChannel[_0xa1c3('0x24')][_0xa1c3('0x38')]=function(_0x3af2cf,_0x540363){var _0x20c968=_[_0xa1c3('0x39')](_0x540363)||_[_0xa1c3('0x3a')](_0x540363)?_0x540363[_0xa1c3('0x3b')]():_0x540363;return this[_0xa1c3('0x25')](util['format'](_0xa1c3('0x3c'),_0x3af2cf,_0x20c968?_0x20c968[_0xa1c3('0x3b')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xa1c3('0x24')][_0xa1c3('0x3d')]=function(_0x4cf884,_0x4970a6){return this[_0xa1c3('0x25')](util[_0xa1c3('0x2b')](_0xa1c3('0x3e'),_0x4cf884,_0x4970a6));};AGIChannel['prototype'][_0xa1c3('0x3f')]=function(_0x1fb2ad,_0x3925a9){return this[_0xa1c3('0x25')](util['format']('SAY\x20DIGITS\x20%s\x20%s',_0x1fb2ad,_0x3925a9));};AGIChannel[_0xa1c3('0x24')]['sayPhonetic']=function(_0x1312b5,_0x2fa2c8){return this['sendRequest'](util['format'](_0xa1c3('0x40'),_0x1312b5,_0x2fa2c8));};AGIChannel[_0xa1c3('0x24')][_0xa1c3('0x41')]=function(_0x1b9c27,_0x20d828,_0x468837){_0x20d828=_0x20d828||this[_0xa1c3('0x42')];_0x468837=_0x468837||0x1;this[_0xa1c3('0x33')](_0x1b9c27);this[_0xa1c3('0x34')](_0x20d828);this[_0xa1c3('0x35')](_0x468837);return this[_0xa1c3('0x2d')](util[_0xa1c3('0x2b')](_0xa1c3('0x43'),_0x1b9c27,_0x20d828,_0x468837));};AGIChannel['prototype'][_0xa1c3('0x44')]=function(_0x2a0565){return this[_0xa1c3('0x25')](util[_0xa1c3('0x2b')]('GET\x20VARIABLE\x20\x22%s\x22',_0x2a0565));};AGIChannel['prototype'][_0xa1c3('0x45')]=function(_0x5bbaa9,_0x436307,_0x110fe1,_0x95e9c8,_0x2e7422,_0x1789b9){_0x436307=_0x436307||_0xa1c3('0x46');_0x110fe1=_0x110fe1||'';_0x95e9c8=_0x95e9c8===undefined?-0x1:_0x95e9c8==='-1'?-0x1:_0x95e9c8*0x3e8;_0x2e7422=_0x2e7422===undefined?'':'s='+_0x2e7422;_0x1789b9=_0x1789b9?_0xa1c3('0x47'):'';return this[_0xa1c3('0x25')](util[_0xa1c3('0x2b')](_0xa1c3('0x48'),_0x5bbaa9,_0x436307,_0x110fe1,_0x95e9c8,_0x1789b9,_0x2e7422));};AGIChannel[_0xa1c3('0x24')][_0xa1c3('0x49')]=function(_0x4087e8,_0x2db568){_0x2db568=_0x2db568||'';return this[_0xa1c3('0x25')](util[_0xa1c3('0x2b')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x4087e8,_0x2db568));};AGIChannel[_0xa1c3('0x24')]['agi']=function(_0x684aaf){return this[_0xa1c3('0x30')](_0xa1c3('0x4a'),_0x684aaf);};AGIChannel[_0xa1c3('0x24')]['wait']=function(_0xf6facf){return this['exec']('WAIT',_0xf6facf);};AGIChannel[_0xa1c3('0x24')]['error']=function(_0x3cfbb7,_0x3a3b80){this[_0xa1c3('0x2d')](util[_0xa1c3('0x2b')](_0xa1c3('0x4b'),_0x3cfbb7['id'],_0x3cfbb7[_0xa1c3('0x4c')],_0x3a3b80));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xa1c3('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index bd7d9d3..be72c4d 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 _0xef68=['Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','apply','message','name','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.'];(function(_0x53c1a1,_0x1f401c){var _0x4f2ddf=function(_0x2b26e1){while(--_0x2b26e1){_0x53c1a1['push'](_0x53c1a1['shift']());}};_0x4f2ddf(++_0x1f401c);}(_0xef68,0x140));var _0x8ef6=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xef68[_0x32f7d7];return _0x133d09;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x8ef6('0x0'),'E_AGI_ARGUMENT_PORT':_0x8ef6('0x1'),'E_AGI_SERVER_ERROR':_0x8ef6('0x2'),'E_AGI_SERVER_CLOSE':_0x8ef6('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x8ef6('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x8ef6('0x5'),'E_AGI_SOCKET_ERROR':_0x8ef6('0x6'),'E_AGI_SOCKET_CLOSE':_0x8ef6('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x8ef6('0x8'),'E_AGI_COMMAND_EMPTY':_0x8ef6('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x8ef6('0xa'),'E_AGI_IVR_ENTRY':_0x8ef6('0xb')};function AGIError(_0x42b4bf){var _0x42b4bf=_0x42b4bf||null,_0x1f6887=_0x1f6887||[],_0x45f479=0x1,_0x2c9462='';if(!error[_0x42b4bf]){_0x42b4bf='E_AGI_UNDEFINED';}_0x1f6887[_0x8ef6('0xc')](error[_0x42b4bf]);while(arguments[_0x45f479]){_0x1f6887[_0x8ef6('0xc')](arguments[_0x45f479]);_0x45f479++;}_0x2c9462=util['format'][_0x8ef6('0xd')](util,_0x1f6887);this[_0x8ef6('0xe')]=_0x2c9462;this[_0x8ef6('0xf')]=_0x42b4bf;}module[_0x8ef6('0x10')]=AGIError; \ No newline at end of file +var _0x5237=['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.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message','name','exports','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.'];(function(_0x59bd64,_0x237f2b){var _0x378c0e=function(_0x24e2be){while(--_0x24e2be){_0x59bd64['push'](_0x59bd64['shift']());}};_0x378c0e(++_0x237f2b);}(_0x5237,0x131));var _0x7523=function(_0x589229,_0x5c69e4){_0x589229=_0x589229-0x0;var _0x3945fe=_0x5237[_0x589229];return _0x3945fe;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x7523('0x0'),'E_AGI_SERVER_ERROR':_0x7523('0x1'),'E_AGI_SERVER_CLOSE':_0x7523('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x7523('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x7523('0x4'),'E_AGI_SOCKET_ERROR':_0x7523('0x5'),'E_AGI_SOCKET_CLOSE':_0x7523('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x7523('0x7'),'E_AGI_COMMAND_EMPTY':_0x7523('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x7523('0x9'),'E_AGI_IVR_ENTRY':_0x7523('0xa')};function AGIError(_0x32cc46){var _0x32cc46=_0x32cc46||null,_0x10adcf=_0x10adcf||[],_0x266d71=0x1,_0x373775='';if(!error[_0x32cc46]){_0x32cc46='E_AGI_UNDEFINED';}_0x10adcf[_0x7523('0xb')](error[_0x32cc46]);while(arguments[_0x266d71]){_0x10adcf[_0x7523('0xb')](arguments[_0x266d71]);_0x266d71++;}_0x373775=util[_0x7523('0xc')][_0x7523('0xd')](util,_0x10adcf);this[_0x7523('0xe')]=_0x373775;this[_0x7523('0xf')]=_0x32cc46;}module[_0x7523('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 0d2dd62..eac1250 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 _0xf54e=['invalid','agicommand','includes','condition\x20not\x20found','exports','../../../config/logger','agi','menu','getsecretdigits','vertices','numberOfEdges','prototype','addVertex','edges','addEdge','push','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','vswitch','default','target'];(function(_0x2fff83,_0x29d5fe){var _0xa2a722=function(_0x18b6b0){while(--_0x18b6b0){_0x2fff83['push'](_0x2fff83['shift']());}};_0xa2a722(++_0x29d5fe);}(_0xf54e,0xf5));var _0xef54=function(_0xc5a279,_0x155360){_0xc5a279=_0xc5a279-0x0;var _0xc755d3=_0xf54e[_0xc5a279];return _0xc755d3;};'use strict';var _=require('lodash');var logger=require(_0xef54('0x0'))(_0xef54('0x1'));var verticesWithRetry=[_0xef54('0x2'),'getdigits',_0xef54('0x3')];var Graph=function(){this[_0xef54('0x4')]={};this['edges']={};this[_0xef54('0x5')]=0x0;};Graph[_0xef54('0x6')][_0xef54('0x7')]=function(_0x3a3d97){this[_0xef54('0x4')][_0x3a3d97['id']]=_0x3a3d97;this[_0xef54('0x8')][_0x3a3d97['id']]=[];};Graph[_0xef54('0x6')][_0xef54('0x9')]=function(_0xbd440b,_0x23560c,_0x3fbbda){this[_0xef54('0x8')][_0xbd440b][_0xef54('0xa')]({'target':_0x23560c,'condition':_0x3fbbda});this[_0xef54('0x5')]+=0x1;};Graph[_0xef54('0x6')][_0xef54('0xb')]=function(){return _[_0xef54('0xb')](this[_0xef54('0x4')]);};Graph[_0xef54('0x6')][_0xef54('0xc')]=function(){return this[_0xef54('0x5')];};Graph[_0xef54('0x6')][_0xef54('0xd')]=function(_0x42f69a){return this[_0xef54('0x4')][_0x42f69a];};Graph[_0xef54('0x6')][_0xef54('0xe')]=function(_0x28f051,_0x37b9df){if(!this['vertices'][_0x28f051]){return logger[_0xef54('0xf')](_0xef54('0x10'));}var _0x1cf2f2=_0x37b9df(this['vertices'][_0x28f051]);if(!_0x1cf2f2){return logger['info'](_0xef54('0x11'));}if(this[_0xef54('0x8')][_0x28f051][_0xef54('0x12')]===0x0){return logger[_0xef54('0xf')](_0xef54('0x13'));}for(var _0x4db027=0x0,_0xd0a4ce=[],_0x369102=![];_0x4db027\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','Project\x20%s\x20not\x20published','continueAt','Project\x20%s\x20not\x20found','getLicense','then','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','./server','listening','connection','xml2json','syncho','util','moment','agi','../../config/license/util','./mailRpc','./vertices','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','name','message','error','[%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','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','root','agicommand','retry','maxRetry','addVertex','omit','mxCell','hasOwnProperty','isArray','length','target','addEdge','source','value','getSquareProject','catch','indexOf','agi_','substring','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','production','start','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','clear','gotoc','context','extension','priority','code','result','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','vertex'];(function(_0x5ac84c,_0x287781){var _0x3c53d2=function(_0x40cde0){while(--_0x40cde0){_0x5ac84c['push'](_0x5ac84c['shift']());}};_0x3c53d2(++_0x287781);}(_0x84fe,0x1d2));var _0xe84f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x84fe[_0x122ef9];return _0x42fba0;};'use strict';var parser=require(_0xe84f('0x0'));var _=require('lodash');var syncho=require(_0xe84f('0x1'));var util=require(_0xe84f('0x2'));var moment=require(_0xe84f('0x3'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0xe84f('0x4'));var utilLicense=require(_0xe84f('0x5'));var rpc=require('./rpc');var mailRpc=require(_0xe84f('0x6'));var Graph=require('./graph');var Vertices=require(_0xe84f('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xe84f('0x4')]=_['defaults'](config['agi'],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x11eca3){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x11eca3);agiHandler(_0x11eca3);}catch(_0x593aa6){logger['error'](_0x593aa6[_0xe84f('0x8')]);}});});}function listeningHandler(){console[_0xe84f('0x9')](_0xe84f('0xa'),config[_0xe84f('0x4')]['port']);logger[_0xe84f('0xb')](util[_0xe84f('0xc')](_0xe84f('0xd'),config['agi']['ip'],config['agi'][_0xe84f('0xe')]));}function errorHandler(_0x2fd44b){if(_0x2fd44b&&_0x2fd44b[_0xe84f('0xf')]&&_0x2fd44b[_0xe84f('0x10')]){logger[_0xe84f('0x11')](util[_0xe84f('0xc')](_0xe84f('0x12'),_0x2fd44b[_0xe84f('0xf')],_0x2fd44b[_0xe84f('0x10')]));}else{logger['error'](util[_0xe84f('0xc')](_0xe84f('0x13'),_0x2fd44b[_0xe84f('0x8')]));}}function closeHandler(){logger[_0xe84f('0xb')](util['format'](_0xe84f('0x14'),this[_0xe84f('0x15')],this['calleridname'],this['callerid'],this[_0xe84f('0x16')],this[_0xe84f('0x17')]));try{createSquareReport(this);}catch(_0x544e61){logger['error'](_0x544e61[_0xe84f('0x8')]);}}function timeoutHandler(){logger['info'](util[_0xe84f('0xc')](_0xe84f('0x18'),this[_0xe84f('0x15')],this[_0xe84f('0x19')],this[_0xe84f('0x1a')],this[_0xe84f('0x16')],this['uniqueid']));}function hangupHandler(){logger['info'](util[_0xe84f('0xc')](_0xe84f('0x1b'),this[_0xe84f('0x15')],this[_0xe84f('0x19')],this[_0xe84f('0x1a')],this['dnid'],this['uniqueid']));this[_0xe84f('0x1c')]=!![];}function getRoot(_0xe0c9a4){return parser[_0xe84f('0x1d')](_0xe0c9a4,{'object':!![]})['mxGraphModel'][_0xe84f('0x1e')];}function addVertex(_0x45574b,_0x1ebd69,_0x7ff888){_0x1ebd69[_0xe84f('0x1f')]=_0x7ff888;if(_0x1ebd69['hasOwnProperty'](_0xe84f('0x20'))){_0x1ebd69[_0xe84f('0x21')]=parseInt(_0x1ebd69[_0xe84f('0x20')],0xa);}_0x45574b[_0xe84f('0x22')](_[_0xe84f('0x23')](_0x1ebd69,_0xe84f('0x24')));}function initGraph(_0x5d0cb7,_0x910a98){var _0x1ddf6a=new Graph();for(var _0x289b5d in _0x5d0cb7){if(_0x5d0cb7[_0xe84f('0x25')](_0x289b5d)){if(_[_0xe84f('0x26')](_0x5d0cb7[_0x289b5d])){for(var _0x4ecf9a=0x0;_0x4ecf9a<_0x5d0cb7[_0x289b5d][_0xe84f('0x27')];_0x4ecf9a+=0x1){addVertex(_0x1ddf6a,_0x5d0cb7[_0x289b5d][_0x4ecf9a],_0x289b5d);}}else{addVertex(_0x1ddf6a,_0x5d0cb7[_0x289b5d],_0x289b5d);}}}for(var _0x5a8e63=0x0;_0x5a8e63<_0x910a98[_0xe84f('0x27')];_0x5a8e63+=0x1){if(_0x910a98[_0x5a8e63]['source']&&_0x910a98[_0x5a8e63][_0xe84f('0x28')]){_0x1ddf6a[_0xe84f('0x29')](_0x910a98[_0x5a8e63][_0xe84f('0x2a')],_0x910a98[_0x5a8e63][_0xe84f('0x28')],_0x910a98[_0x5a8e63][_0xe84f('0x2b')]);}}return _0x1ddf6a;}function getSquareProject(_0x14bf64,_0x570d5e){rpc[_0xe84f('0x2c')](_0x14bf64)['then'](function(_0xee89f4){_0x570d5e(null,_0xee89f4);})['catch'](function(_0x26bd48){_0x570d5e(null,_0x26bd48);});}function createSquareReport(_0x36f234,_0x557a52){rpc['createSquareReport'](_0x36f234)['then'](function(_0x3b141b){if(_0x557a52){_0x557a52(null,_0x3b141b);}})[_0xe84f('0x2d')](function(_0xfa9e61){if(_0x557a52){_0x557a52(null,_0xfa9e61);}});}function setChannelVariables(_0xd11d18){for(var _0x402908 in _0xd11d18){if(_0xd11d18[_0xe84f('0x25')](_0x402908)){if(_0x402908[_0xe84f('0x2e')](_0xe84f('0x2f'))===0x0){_0xd11d18[_0x402908[_0xe84f('0x30')](0x4)]=_0xd11d18[_0x402908];delete _0xd11d18[_0x402908];}}}}function getLogFromObject(_0x472872){return util['inspect'](_0x472872,{'showHidden':![],'depth':null});}function agiHandler(_0x3514d4){var _0x298489,_0x4c4b07,_0x5e6ccb,_0x2184f9,_0x1468cb;logger[_0xe84f('0x31')](_0xe84f('0x32'),JSON['stringify'](_0x3514d4,null,0x2));logger[_0xe84f('0xb')](util[_0xe84f('0xc')](_0xe84f('0x33'),_0x3514d4['arg_1'],_0x3514d4['calleridname'],_0x3514d4[_0xe84f('0x1a')],_0x3514d4['dnid'],_0x3514d4[_0xe84f('0x17')]));_0x3514d4['on'](_0xe84f('0x11'),errorHandler);_0x3514d4['on'](_0xe84f('0x34'),closeHandler);_0x3514d4['on'](_0xe84f('0x35'),timeoutHandler);_0x3514d4[_0xe84f('0x1c')]=![];_0x3514d4['on'](_0xe84f('0x36'),hangupHandler);var _0x513823=getSquareProject['sync'](null,_0x3514d4['arg_1']);if(_0x513823){if(_0x513823[_0xe84f('0x37')]){_0x298489=getRoot(_0x513823[_0xe84f('0x37')]);if(_0x298489&&_0x298489[_0xe84f('0x38')]){logger['debug'](_0xe84f('0x1e'),JSON[_0xe84f('0x39')](_0x298489,null,0x2));_0x3514d4[_0xe84f('0x3a')]=moment()['format'](_0xe84f('0x3b'));_0x4c4b07=initGraph(_['omit'](_0x298489,_0xe84f('0x24')),_0x298489['mxCell']);_0x5e6ccb=new Vertices(_0x3514d4,rpc,mailRpc);logger[_0xe84f('0xb')](util[_0xe84f('0xc')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3514d4[_0xe84f('0x15')],_0x3514d4[_0xe84f('0x19')],_0x3514d4[_0xe84f('0x1a')],_0x3514d4[_0xe84f('0x16')],_0x3514d4[_0xe84f('0x17')]));_0x4c4b07['traverseBFS'](_0x298489[_0xe84f('0x38')]['id'],function(_0x3aefe8){try{_0x3aefe8=_0x5e6ccb[_0xe84f('0x3c')](_0x3aefe8);logger[_0xe84f('0x31')]('vertex',JSON[_0xe84f('0x39')](_0x3aefe8,null,0x2));if(_0x3aefe8[_0xe84f('0x1f')]===_0xe84f('0x3d')){logger[_0xe84f('0xb')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x3514d4[_0xe84f('0x3e')]=_0x3aefe8['context']||_0x3514d4['context'];_0x3514d4[_0xe84f('0x3f')]=_0x3aefe8[_0xe84f('0x3f')];_0x3514d4['priority']=_0x3aefe8[_0xe84f('0x40')]?_0x3aefe8['priority']-0x1:0x1;return null;}else if(_0x3aefe8&&_0x5e6ccb[_0x3aefe8[_0xe84f('0x1f')]]){_0x1468cb=_0x5e6ccb[_0x3aefe8['agicommand']](_0x3aefe8);logger[_0xe84f('0xb')]('response',JSON[_0xe84f('0x39')](_0x1468cb,null,0x2));if(_0x1468cb&&_0x1468cb[_0xe84f('0x41')]===AGI_CODE_SUCCESS&&_0x1468cb[_0xe84f('0x42')]!==AGI_RESULT_ERROR&&!_0x3514d4[_0xe84f('0x1c')]){logger[_0xe84f('0x31')]('response',getLogFromObject(_0x1468cb));return _[_0xe84f('0x43')](_0x1468cb[_0xe84f('0x42')])?null:_0x1468cb['result'][_0xe84f('0x44')]();}else{logger[_0xe84f('0x11')]('response',getLogFromObject(_0x1468cb));return null;}}else{logger[_0xe84f('0x11')](_0xe84f('0x45'));return null;}}catch(_0x1eeebf){logger[_0xe84f('0x11')](_0x1eeebf[_0xe84f('0x8')]);return null;}});if(_0x298489[_0xe84f('0x46')]){logger['info'](util[_0xe84f('0xc')](_0xe84f('0x47'),_0x3514d4['arg_1'],_0x3514d4[_0xe84f('0x19')],_0x3514d4[_0xe84f('0x1a')],_0x3514d4[_0xe84f('0x16')],_0x3514d4[_0xe84f('0x17')]));_0x4c4b07[_0xe84f('0x48')](_0x298489['finally']['id'],function(_0x356962){try{_0x356962=_0x5e6ccb[_0xe84f('0x3c')](_0x356962);logger[_0xe84f('0x31')](_0xe84f('0x49'),JSON['stringify'](_0x356962,null,0x2));if(_0x356962&&_0x5e6ccb[_0x356962[_0xe84f('0x1f')]]){_0x1468cb=_0x5e6ccb[_0x356962[_0xe84f('0x1f')]](_0x356962);if(_0x1468cb){logger['debug'](_0xe84f('0x4a'),getLogFromObject(_0x1468cb));return _[_0xe84f('0x43')](_0x1468cb[_0xe84f('0x42')])?null:_0x1468cb[_0xe84f('0x42')][_0xe84f('0x44')]();}else{logger[_0xe84f('0x11')](_0xe84f('0x4a'),getLogFromObject(_0x1468cb));return null;}}else{logger[_0xe84f('0x11')](_0xe84f('0x45'));return null;}}catch(_0x2835d9){logger[_0xe84f('0x11')](_0x2835d9[_0xe84f('0x8')]);return null;}});}logger[_0xe84f('0xb')](util['format'](_0xe84f('0x4b'),_0x3514d4[_0xe84f('0x15')],_0x3514d4[_0xe84f('0x19')],_0x3514d4[_0xe84f('0x1a')],_0x3514d4[_0xe84f('0x16')],_0x3514d4[_0xe84f('0x17')]));logger[_0xe84f('0xb')](util[_0xe84f('0xc')](_0xe84f('0x4c'),_0x3514d4[_0xe84f('0x3e')],_0x3514d4['extension'],parseInt(_0x3514d4[_0xe84f('0x40')],0xa)+0x1));_0x3514d4['continueAt'](_0x3514d4[_0xe84f('0x3e')],_0x3514d4[_0xe84f('0x3f')],parseInt(_0x3514d4[_0xe84f('0x40')],0xa)+0x1);_0x3514d4[_0xe84f('0x34')]();}}else{logger['error'](util[_0xe84f('0xc')](_0xe84f('0x4d'),_0x3514d4['arg_1']));_0x3514d4[_0xe84f('0x4e')](_0x3514d4['context'],_0x3514d4[_0xe84f('0x3f')],parseInt(_0x3514d4[_0xe84f('0x40')],0xa)+0x1);_0x3514d4[_0xe84f('0x34')]();}}else{logger[_0xe84f('0x11')](util[_0xe84f('0xc')](_0xe84f('0x4f'),_0x3514d4[_0xe84f('0x15')]));_0x3514d4['continueAt'](_0x3514d4['context'],_0x3514d4[_0xe84f('0x3f')],parseInt(_0x3514d4['priority'],0xa)+0x1);_0x3514d4[_0xe84f('0x34')]();}}function main(){var _0x9ec382;return utilLicense[_0xe84f('0x50')]()[_0xe84f('0x51')](function(_0x25e498){if(_0x25e498){if(_0x25e498[_0xe84f('0x52')]){if(_0x25e498[_0xe84f('0x53')]&&_0x25e498['callysquare']>0x0){logger[_0xe84f('0xb')](util[_0xe84f('0xc')](_0xe84f('0x54'),_0x25e498[_0xe84f('0x53')]));_0x9ec382=_0x25e498['callysquare'];}else{logger[_0xe84f('0xb')](_0xe84f('0x55'));}}else{logger[_0xe84f('0xb')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x9ec382=-0x1;}}})[_0xe84f('0x2d')](function(_0x4ce1cb){logger[_0xe84f('0x11')](_0xe84f('0x56'),_0x4ce1cb['stack']);})[_0xe84f('0x46')](function(){var _0x3ba01a=require(_0xe84f('0x57'))(config[_0xe84f('0x4')][_0xe84f('0xe')],config[_0xe84f('0x4')]['ip'],_0x9ec382);_0x3ba01a['on'](_0xe84f('0x11'),errorHandler);_0x3ba01a['on'](_0xe84f('0x58'),listeningHandler);_0x3ba01a['on'](_0xe84f('0x59'),connectionHandler);_0x3ba01a['on'](_0xe84f('0x34'),closeHandler);});}main(); \ No newline at end of file +var _0xc2a4=['then','createSquareReport','catch','agi_','substring','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','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','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','isUndefined','result','toString','finally','traverseBFS','vertex','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','lodash','util','moment','../../config/environment','../../config/license/util','./rpc','./mailRpc','./graph','agi','defaults','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','name','message','[%s]\x20%s','[ERROR]\x20%s','stack','arg_1','calleridname','callerid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','uniqueid','[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','addVertex','omit','mxCell','isArray','length','source','target','value','getSquareProject'];(function(_0x192b57,_0x52f206){var _0x5db17d=function(_0x1af5b1){while(--_0x1af5b1){_0x192b57['push'](_0x192b57['shift']());}};_0x5db17d(++_0x52f206);}(_0xc2a4,0x1ef));var _0x4c2a=function(_0x4da2af,_0x4d959c){_0x4da2af=_0x4da2af-0x0;var _0xb9b9b4=_0xc2a4[_0x4da2af];return _0xb9b9b4;};'use strict';var parser=require(_0x4c2a('0x0'));var _=require(_0x4c2a('0x1'));var syncho=require('syncho');var util=require(_0x4c2a('0x2'));var moment=require(_0x4c2a('0x3'));var config=require(_0x4c2a('0x4'));var logger=require('../../config/logger')('agi');var utilLicense=require(_0x4c2a('0x5'));var rpc=require(_0x4c2a('0x6'));var mailRpc=require(_0x4c2a('0x7'));var Graph=require(_0x4c2a('0x8'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x4c2a('0x9')]=_[_0x4c2a('0xa')](config[_0x4c2a('0x9')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x169489){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x169489);agiHandler(_0x169489);}catch(_0x1b7ffa){logger[_0x4c2a('0xb')](_0x1b7ffa['stack']);}});});}function listeningHandler(){console[_0x4c2a('0xc')](_0x4c2a('0xd'),config[_0x4c2a('0x9')][_0x4c2a('0xe')]);logger[_0x4c2a('0xf')](util[_0x4c2a('0x10')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x4c2a('0x9')]['ip'],config[_0x4c2a('0x9')][_0x4c2a('0xe')]));}function errorHandler(_0x161b60){if(_0x161b60&&_0x161b60[_0x4c2a('0x11')]&&_0x161b60[_0x4c2a('0x12')]){logger['error'](util[_0x4c2a('0x10')](_0x4c2a('0x13'),_0x161b60[_0x4c2a('0x11')],_0x161b60[_0x4c2a('0x12')]));}else{logger[_0x4c2a('0xb')](util[_0x4c2a('0x10')](_0x4c2a('0x14'),_0x161b60[_0x4c2a('0x15')]));}}function closeHandler(){logger[_0x4c2a('0xf')](util[_0x4c2a('0x10')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x4c2a('0x16')],this[_0x4c2a('0x17')],this[_0x4c2a('0x18')],this['dnid'],this['uniqueid']));try{createSquareReport(this);}catch(_0x360c1d){logger[_0x4c2a('0xb')](_0x360c1d['stack']);}}function timeoutHandler(){logger['info'](util[_0x4c2a('0x10')](_0x4c2a('0x19'),this[_0x4c2a('0x16')],this[_0x4c2a('0x17')],this['callerid'],this[_0x4c2a('0x1a')],this[_0x4c2a('0x1b')]));}function hangupHandler(){logger[_0x4c2a('0xf')](util[_0x4c2a('0x10')](_0x4c2a('0x1c'),this[_0x4c2a('0x16')],this[_0x4c2a('0x17')],this[_0x4c2a('0x18')],this[_0x4c2a('0x1a')],this[_0x4c2a('0x1b')]));this[_0x4c2a('0x1d')]=!![];}function getRoot(_0x398dd4){return parser[_0x4c2a('0x1e')](_0x398dd4,{'object':!![]})[_0x4c2a('0x1f')][_0x4c2a('0x20')];}function addVertex(_0x34db31,_0x2bab84,_0x3dde32){_0x2bab84['agicommand']=_0x3dde32;if(_0x2bab84[_0x4c2a('0x21')](_0x4c2a('0x22'))){_0x2bab84[_0x4c2a('0x23')]=parseInt(_0x2bab84[_0x4c2a('0x22')],0xa);}_0x34db31[_0x4c2a('0x24')](_[_0x4c2a('0x25')](_0x2bab84,_0x4c2a('0x26')));}function initGraph(_0x560c66,_0x428fdb){var _0x492500=new Graph();for(var _0x8a672 in _0x560c66){if(_0x560c66['hasOwnProperty'](_0x8a672)){if(_[_0x4c2a('0x27')](_0x560c66[_0x8a672])){for(var _0x25f11d=0x0;_0x25f11d<_0x560c66[_0x8a672]['length'];_0x25f11d+=0x1){addVertex(_0x492500,_0x560c66[_0x8a672][_0x25f11d],_0x8a672);}}else{addVertex(_0x492500,_0x560c66[_0x8a672],_0x8a672);}}}for(var _0x9e5f7d=0x0;_0x9e5f7d<_0x428fdb[_0x4c2a('0x28')];_0x9e5f7d+=0x1){if(_0x428fdb[_0x9e5f7d][_0x4c2a('0x29')]&&_0x428fdb[_0x9e5f7d][_0x4c2a('0x2a')]){_0x492500['addEdge'](_0x428fdb[_0x9e5f7d][_0x4c2a('0x29')],_0x428fdb[_0x9e5f7d][_0x4c2a('0x2a')],_0x428fdb[_0x9e5f7d][_0x4c2a('0x2b')]);}}return _0x492500;}function getSquareProject(_0x25b5a7,_0x514db3){rpc[_0x4c2a('0x2c')](_0x25b5a7)[_0x4c2a('0x2d')](function(_0x262bf8){_0x514db3(null,_0x262bf8);})['catch'](function(_0x3e518e){_0x514db3(null,_0x3e518e);});}function createSquareReport(_0x569964,_0x58b775){rpc[_0x4c2a('0x2e')](_0x569964)['then'](function(_0x282384){if(_0x58b775){_0x58b775(null,_0x282384);}})[_0x4c2a('0x2f')](function(_0x2fac1e){if(_0x58b775){_0x58b775(null,_0x2fac1e);}});}function setChannelVariables(_0x5dfcd7){for(var _0xb72128 in _0x5dfcd7){if(_0x5dfcd7[_0x4c2a('0x21')](_0xb72128)){if(_0xb72128['indexOf'](_0x4c2a('0x30'))===0x0){_0x5dfcd7[_0xb72128[_0x4c2a('0x31')](0x4)]=_0x5dfcd7[_0xb72128];delete _0x5dfcd7[_0xb72128];}}}}function getLogFromObject(_0x4890f7){return util[_0x4c2a('0x32')](_0x4890f7,{'showHidden':![],'depth':null});}function agiHandler(_0x512d76){var _0x4fb4ae,_0x25a820,_0x3495b8,_0x47c569,_0x38c933;logger[_0x4c2a('0x33')](_0x4c2a('0x34'),JSON[_0x4c2a('0x35')](_0x512d76,null,0x2));logger['info'](util['format'](_0x4c2a('0x36'),_0x512d76[_0x4c2a('0x16')],_0x512d76['calleridname'],_0x512d76['callerid'],_0x512d76[_0x4c2a('0x1a')],_0x512d76[_0x4c2a('0x1b')]));_0x512d76['on'](_0x4c2a('0xb'),errorHandler);_0x512d76['on'](_0x4c2a('0x37'),closeHandler);_0x512d76['on'](_0x4c2a('0x38'),timeoutHandler);_0x512d76[_0x4c2a('0x1d')]=![];_0x512d76['on'](_0x4c2a('0x39'),hangupHandler);var _0x4fc01a=getSquareProject['sync'](null,_0x512d76['arg_1']);if(_0x4fc01a){if(_0x4fc01a[_0x4c2a('0x3a')]){_0x4fb4ae=getRoot(_0x4fc01a['production']);if(_0x4fb4ae&&_0x4fb4ae[_0x4c2a('0x3b')]){logger[_0x4c2a('0x33')](_0x4c2a('0x20'),JSON[_0x4c2a('0x35')](_0x4fb4ae,null,0x2));_0x512d76[_0x4c2a('0x3c')]=moment()[_0x4c2a('0x10')](_0x4c2a('0x3d'));_0x25a820=initGraph(_[_0x4c2a('0x25')](_0x4fb4ae,_0x4c2a('0x26')),_0x4fb4ae[_0x4c2a('0x26')]);_0x3495b8=new Vertices(_0x512d76,rpc,mailRpc);logger[_0x4c2a('0xf')](util[_0x4c2a('0x10')](_0x4c2a('0x3e'),_0x512d76['arg_1'],_0x512d76[_0x4c2a('0x17')],_0x512d76['callerid'],_0x512d76[_0x4c2a('0x1a')],_0x512d76[_0x4c2a('0x1b')]));_0x25a820['traverseBFS'](_0x4fb4ae[_0x4c2a('0x3b')]['id'],function(_0x656fe9){try{_0x656fe9=_0x3495b8['clear'](_0x656fe9);logger['debug']('vertex',JSON['stringify'](_0x656fe9,null,0x2));if(_0x656fe9[_0x4c2a('0x3f')]===_0x4c2a('0x40')){logger[_0x4c2a('0xf')](_0x4c2a('0x41'));_0x512d76[_0x4c2a('0x42')]=_0x656fe9[_0x4c2a('0x42')]||_0x512d76[_0x4c2a('0x42')];_0x512d76[_0x4c2a('0x43')]=_0x656fe9[_0x4c2a('0x43')];_0x512d76[_0x4c2a('0x44')]=_0x656fe9[_0x4c2a('0x44')]?_0x656fe9[_0x4c2a('0x44')]-0x1:0x1;return null;}else if(_0x656fe9&&_0x3495b8[_0x656fe9[_0x4c2a('0x3f')]]){_0x38c933=_0x3495b8[_0x656fe9[_0x4c2a('0x3f')]](_0x656fe9);logger[_0x4c2a('0xf')](_0x4c2a('0x45'),JSON[_0x4c2a('0x35')](_0x38c933,null,0x2));if(_0x38c933&&_0x38c933[_0x4c2a('0x46')]===AGI_CODE_SUCCESS&&_0x38c933['result']!==AGI_RESULT_ERROR&&!_0x512d76[_0x4c2a('0x1d')]){logger[_0x4c2a('0x33')](_0x4c2a('0x45'),getLogFromObject(_0x38c933));return _[_0x4c2a('0x47')](_0x38c933[_0x4c2a('0x48')])?null:_0x38c933[_0x4c2a('0x48')][_0x4c2a('0x49')]();}else{logger[_0x4c2a('0xb')](_0x4c2a('0x45'),getLogFromObject(_0x38c933));return null;}}else{logger[_0x4c2a('0xb')]('agicommand\x20not\x20found');return null;}}catch(_0x457531){logger[_0x4c2a('0xb')](_0x457531[_0x4c2a('0x15')]);return null;}});if(_0x4fb4ae[_0x4c2a('0x4a')]){logger['info'](util[_0x4c2a('0x10')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x512d76[_0x4c2a('0x16')],_0x512d76[_0x4c2a('0x17')],_0x512d76['callerid'],_0x512d76[_0x4c2a('0x1a')],_0x512d76[_0x4c2a('0x1b')]));_0x25a820[_0x4c2a('0x4b')](_0x4fb4ae['finally']['id'],function(_0xd399cc){try{_0xd399cc=_0x3495b8['clear'](_0xd399cc);logger[_0x4c2a('0x33')](_0x4c2a('0x4c'),JSON[_0x4c2a('0x35')](_0xd399cc,null,0x2));if(_0xd399cc&&_0x3495b8[_0xd399cc[_0x4c2a('0x3f')]]){_0x38c933=_0x3495b8[_0xd399cc[_0x4c2a('0x3f')]](_0xd399cc);if(_0x38c933){logger[_0x4c2a('0x33')](_0x4c2a('0x45'),getLogFromObject(_0x38c933));return _[_0x4c2a('0x47')](_0x38c933[_0x4c2a('0x48')])?null:_0x38c933['result'][_0x4c2a('0x49')]();}else{logger[_0x4c2a('0xb')](_0x4c2a('0x45'),getLogFromObject(_0x38c933));return null;}}else{logger[_0x4c2a('0xb')]('agicommand\x20not\x20found');return null;}}catch(_0x43a211){logger['error'](_0x43a211[_0x4c2a('0x15')]);return null;}});}logger[_0x4c2a('0xf')](util[_0x4c2a('0x10')](_0x4c2a('0x4d'),_0x512d76['arg_1'],_0x512d76['calleridname'],_0x512d76['callerid'],_0x512d76[_0x4c2a('0x1a')],_0x512d76['uniqueid']));logger[_0x4c2a('0xf')](util[_0x4c2a('0x10')](_0x4c2a('0x4e'),_0x512d76[_0x4c2a('0x42')],_0x512d76[_0x4c2a('0x43')],parseInt(_0x512d76[_0x4c2a('0x44')],0xa)+0x1));_0x512d76[_0x4c2a('0x4f')](_0x512d76[_0x4c2a('0x42')],_0x512d76[_0x4c2a('0x43')],parseInt(_0x512d76[_0x4c2a('0x44')],0xa)+0x1);_0x512d76[_0x4c2a('0x37')]();}}else{logger['error'](util[_0x4c2a('0x10')]('Project\x20%s\x20not\x20published',_0x512d76[_0x4c2a('0x16')]));_0x512d76[_0x4c2a('0x4f')](_0x512d76[_0x4c2a('0x42')],_0x512d76[_0x4c2a('0x43')],parseInt(_0x512d76[_0x4c2a('0x44')],0xa)+0x1);_0x512d76[_0x4c2a('0x37')]();}}else{logger['error'](util['format'](_0x4c2a('0x50'),_0x512d76[_0x4c2a('0x16')]));_0x512d76[_0x4c2a('0x4f')](_0x512d76['context'],_0x512d76[_0x4c2a('0x43')],parseInt(_0x512d76['priority'],0xa)+0x1);_0x512d76[_0x4c2a('0x37')]();}}function main(){var _0x4ace23;return utilLicense[_0x4c2a('0x51')]()[_0x4c2a('0x2d')](function(_0x33c0c1){if(_0x33c0c1){if(_0x33c0c1['voice']){if(_0x33c0c1['callysquare']&&_0x33c0c1[_0x4c2a('0x52')]>0x0){logger['info'](util[_0x4c2a('0x10')](_0x4c2a('0x53'),_0x33c0c1[_0x4c2a('0x52')]));_0x4ace23=_0x33c0c1[_0x4c2a('0x52')];}else{logger[_0x4c2a('0xf')](_0x4c2a('0x54'));}}else{logger['info'](_0x4c2a('0x55'));_0x4ace23=-0x1;}}})[_0x4c2a('0x2f')](function(_0x34547a){logger[_0x4c2a('0xb')](_0x4c2a('0x56'),_0x34547a[_0x4c2a('0x15')]);})[_0x4c2a('0x4a')](function(){var _0x34d262=require(_0x4c2a('0x57'))(config['agi']['port'],config[_0x4c2a('0x9')]['ip'],_0x4ace23);_0x34d262['on'](_0x4c2a('0xb'),errorHandler);_0x34d262['on'](_0x4c2a('0x58'),listeningHandler);_0x34d262['on'](_0x4c2a('0x59'),connectionHandler);_0x34d262['on'](_0x4c2a('0x37'),closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index ed237a3..78e96e6 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 _0x46e0=['then','error','message','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','http','request'];(function(_0xbf5684,_0x273b73){var _0x4dbb45=function(_0x1c03f8){while(--_0x1c03f8){_0xbf5684['push'](_0xbf5684['shift']());}};_0x4dbb45(++_0x273b73);}(_0x46e0,0x17d));var _0x046e=function(_0xca6e8c,_0x1aee65){_0xca6e8c=_0xca6e8c-0x0;var _0x366399=_0x46e0[_0xca6e8c];return _0x366399;};'use strict';var BPromise=require(_0x046e('0x0'));var jayson=require(_0x046e('0x1'));var client=jayson['client'][_0x046e('0x2')]({'port':0x232b});function request(_0x3b2768,_0x55e2c9){return new BPromise(function(_0x495529,_0x2bc429){return client[_0x046e('0x3')](_0x3b2768,_0x55e2c9)[_0x046e('0x4')](function(_0x48eefb){if(_0x48eefb['error']){return _0x2bc429(_0x48eefb[_0x046e('0x5')][_0x046e('0x6')]);}else{return _0x495529(_0x48eefb[_0x046e('0x7')]);}})[_0x046e('0x8')](function(_0x25a848){return _0x2bc429(_0x25a848);});});}exports[_0x046e('0x9')]=function(_0x35777d,_0x1acf89){return request(_0x046e('0xa'),{'account':_0x35777d,'message':_0x1acf89});}; \ No newline at end of file +var _0x183d=['request','then','error','message','result','catch','sendMailMessage','bluebird','jayson/promise','client','http'];(function(_0x2432c9,_0xefd23){var _0x25bd14=function(_0x3d8c6c){while(--_0x3d8c6c){_0x2432c9['push'](_0x2432c9['shift']());}};_0x25bd14(++_0xefd23);}(_0x183d,0xac));var _0xd183=function(_0x132edb,_0x54e052){_0x132edb=_0x132edb-0x0;var _0x294aab=_0x183d[_0x132edb];return _0x294aab;};'use strict';var BPromise=require(_0xd183('0x0'));var jayson=require(_0xd183('0x1'));var client=jayson[_0xd183('0x2')][_0xd183('0x3')]({'port':0x232b});function request(_0x13d536,_0x178c4a){return new BPromise(function(_0x49a632,_0x6752dd){return client[_0xd183('0x4')](_0x13d536,_0x178c4a)[_0xd183('0x5')](function(_0x107107){if(_0x107107['error']){return _0x6752dd(_0x107107[_0xd183('0x6')][_0xd183('0x7')]);}else{return _0x49a632(_0x107107[_0xd183('0x8')]);}})[_0xd183('0x9')](function(_0x41e11f){return _0x6752dd(_0x41e11f);});});}exports[_0xd183('0xa')]=function(_0x197907,_0x3728d6){return request('SendMail',{'account':_0x197907,'message':_0x3728d6});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 56042ad..d50387b 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 _0xe6b0=['emit','headers','line','exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','indexOf','substring','length','split','slice'];(function(_0x3c0d05,_0x18b8ad){var _0x9743d2=function(_0x33100e){while(--_0x33100e){_0x3c0d05['push'](_0x3c0d05['shift']());}};_0x9743d2(++_0x18b8ad);}(_0xe6b0,0x15a));var _0x0e6b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe6b0[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x0e6b('0x0'));var Transform=require(_0x0e6b('0x1'))[_0x0e6b('0x2')];function AGIReply(_0x38a997){Transform[_0x0e6b('0x3')](this,_0x38a997);this[_0x0e6b('0x4')]='';this[_0x0e6b('0x5')]=![];}util[_0x0e6b('0x6')](AGIReply,Transform);AGIReply[_0x0e6b('0x7')][_0x0e6b('0x8')]=function(_0x5be194,_0x143192,_0x5618da){var _0x78f8a0='\x0a',_0x248079=['\x0a\x0a',_0x0e6b('0x9')],_0x43e8a7=-0x1,_0xb4380c=-0x1,_0x190768='',_0x44eba9=0x0,_0x45e222='',_0x511257='';this[_0x0e6b('0x4')]+=_0x5be194['toString']();_0x45e222=this[_0x0e6b('0x4')];if(!this['_inBody']){_0x44eba9=0x0;while(_0x248079[_0x44eba9]){while((_0xb4380c=_0x45e222[_0x0e6b('0xa')](_0x248079[_0x44eba9]))!=-0x1){_0x190768=_0x248079[_0x44eba9];_0x511257=_0x45e222[_0x0e6b('0xb')](0x0,_0xb4380c);_0x45e222=_0x45e222[_0x0e6b('0xb')](_0xb4380c+_0x190768[_0x0e6b('0xc')]);var _0x11f21c=_0x511257[_0x0e6b('0xd')](_0x78f8a0),_0x265ba2=0x0,_0x4f33d0={},_0x1090d9='',_0x361043='',_0x520a38=-0x1;while(_0x11f21c[_0x265ba2]){_0x520a38=_0x11f21c[_0x265ba2][_0x0e6b('0xa')](':');if(_0x520a38!=-0x1){_0x1090d9=_0x11f21c[_0x265ba2]['slice'](0x0,_0x520a38)['trim']();_0x361043=_0x11f21c[_0x265ba2][_0x0e6b('0xe')](_0x520a38+0x1)['trim']();if(_0x1090d9[_0x0e6b('0xc')]>0x0){_0x4f33d0[_0x1090d9]=_0x361043;}}else{}_0x265ba2++;}this[_0x0e6b('0xf')](_0x0e6b('0x10'),_0x4f33d0);this[_0x0e6b('0x5')]=!![];}_0x44eba9++;}this['_localBuffer']=_0x45e222;}else{while((_0x43e8a7=_0x45e222[_0x0e6b('0xa')](_0x78f8a0))!=-0x1){_0x511257=_0x45e222[_0x0e6b('0xb')](0x0,_0x43e8a7);this['emit'](_0x0e6b('0x11'),_0x511257);_0x45e222=_0x45e222[_0x0e6b('0xb')](_0x43e8a7+_0x78f8a0[_0x0e6b('0xc')]);}this['_localBuffer']=_0x45e222;}_0x5618da();};module[_0x0e6b('0x12')]=AGIReply; \ No newline at end of file +var _0xf81b=['indexOf','substring','length','split','slice','trim','emit','headers','_localBuffer','line','exports','util','Transform','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','_inBody'];(function(_0x146837,_0x2aa6a2){var _0x3d7e60=function(_0x1301ac){while(--_0x1301ac){_0x146837['push'](_0x146837['shift']());}};_0x3d7e60(++_0x2aa6a2);}(_0xf81b,0xdc));var _0xbf81=function(_0x3250fb,_0x20d3e0){_0x3250fb=_0x3250fb-0x0;var _0x449a5e=_0xf81b[_0x3250fb];return _0x449a5e;};'use strict';var util=require(_0xbf81('0x0'));var Transform=require('stream')[_0xbf81('0x1')];function AGIReply(_0x1e558c){Transform['call'](this,_0x1e558c);this['_localBuffer']='';this['_inBody']=![];}util[_0xbf81('0x2')](AGIReply,Transform);AGIReply[_0xbf81('0x3')][_0xbf81('0x4')]=function(_0x29cbb5,_0x4cff81,_0x1749af){var _0x300716='\x0a',_0x5773d6=['\x0a\x0a',_0xbf81('0x5')],_0x25928d=-0x1,_0x36a57a=-0x1,_0x5a99e4='',_0x20c24d=0x0,_0x4ae815='',_0xd33ab0='';this['_localBuffer']+=_0x29cbb5[_0xbf81('0x6')]();_0x4ae815=this['_localBuffer'];if(!this[_0xbf81('0x7')]){_0x20c24d=0x0;while(_0x5773d6[_0x20c24d]){while((_0x36a57a=_0x4ae815[_0xbf81('0x8')](_0x5773d6[_0x20c24d]))!=-0x1){_0x5a99e4=_0x5773d6[_0x20c24d];_0xd33ab0=_0x4ae815[_0xbf81('0x9')](0x0,_0x36a57a);_0x4ae815=_0x4ae815[_0xbf81('0x9')](_0x36a57a+_0x5a99e4[_0xbf81('0xa')]);var _0x5ade0e=_0xd33ab0[_0xbf81('0xb')](_0x300716),_0x2b99cf=0x0,_0xe79143={},_0x3d3ee3='',_0x55c8c7='',_0x4ad04b=-0x1;while(_0x5ade0e[_0x2b99cf]){_0x4ad04b=_0x5ade0e[_0x2b99cf][_0xbf81('0x8')](':');if(_0x4ad04b!=-0x1){_0x3d3ee3=_0x5ade0e[_0x2b99cf][_0xbf81('0xc')](0x0,_0x4ad04b)[_0xbf81('0xd')]();_0x55c8c7=_0x5ade0e[_0x2b99cf]['slice'](_0x4ad04b+0x1)[_0xbf81('0xd')]();if(_0x3d3ee3[_0xbf81('0xa')]>0x0){_0xe79143[_0x3d3ee3]=_0x55c8c7;}}else{}_0x2b99cf++;}this[_0xbf81('0xe')](_0xbf81('0xf'),_0xe79143);this['_inBody']=!![];}_0x20c24d++;}this[_0xbf81('0x10')]=_0x4ae815;}else{while((_0x25928d=_0x4ae815[_0xbf81('0x8')](_0x300716))!=-0x1){_0xd33ab0=_0x4ae815[_0xbf81('0x9')](0x0,_0x25928d);this['emit'](_0xbf81('0x11'),_0xd33ab0);_0x4ae815=_0x4ae815[_0xbf81('0x9')](_0x25928d+_0x300716[_0xbf81('0xa')]);}this[_0xbf81('0x10')]=_0x4ae815;}_0x1749af();};module[_0xbf81('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 5db6f0b..2614af5 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 _0x95f4=['LogoutUser','bluebird','moment','lodash','client','http','request','error','result','catch','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','ListId','then','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout'];(function(_0x12ad2b,_0x11ef50){var _0x15f472=function(_0x4e27e0){while(--_0x4e27e0){_0x12ad2b['push'](_0x12ad2b['shift']());}};_0x15f472(++_0x11ef50);}(_0x95f4,0xf1));var _0x495f=function(_0x246b1a,_0xaf7c){_0x246b1a=_0x246b1a-0x0;var _0x38fb56=_0x95f4[_0x246b1a];return _0x38fb56;};'use strict';var BPromise=require(_0x495f('0x0'));var moment=require(_0x495f('0x1'));var _=require(_0x495f('0x2'));var util=require('util');var jayson=require('jayson/promise');var client=jayson[_0x495f('0x3')][_0x495f('0x4')]({'port':0x2329});function request(_0x5edb36,_0x501377){return new BPromise(function(_0x87cc22,_0x22465d){return client[_0x495f('0x5')](_0x5edb36,_0x501377)['then'](function(_0x704a46){if(_0x704a46[_0x495f('0x6')]){return _0x22465d(_0x704a46[_0x495f('0x6')]['message']);}else{return _0x87cc22(_0x704a46[_0x495f('0x7')]);}})[_0x495f('0x8')](function(_0x380828){return _0x22465d(_0x380828);});});}exports['getSquareProject']=function(_0x55dc23){return request(_0x495f('0x9'),{'options':{'raw':![],'where':{'name':_0x55dc23},'attributes':['production']}});};exports[_0x495f('0xa')]=function(_0x508c3d){return request(_0x495f('0xb'),{'options':{'raw':![],'where':{'id':_0x508c3d},'include':[{'model':_0x495f('0xc'),'as':_0x495f('0xd')}],'attributes':['id',_0x495f('0xe'),'email']}});};exports[_0x495f('0xf')]=function(_0x2a3fbe){return request(_0x495f('0x9'),{'options':{'where':{'id':_0x2a3fbe},'attributes':[_0x495f('0xe')]}});};exports[_0x495f('0x10')]=function(_0x4d71bb){return request(_0x495f('0x11'),{'options':{'where':{'id':_0x4d71bb},'attributes':[_0x495f('0xe')]}});};exports[_0x495f('0x12')]=function(_0x3ce068){return request(_0x495f('0x13'),{'options':{'where':{'id':_0x3ce068},'attributes':[_0x495f('0xe')]}});};exports[_0x495f('0x14')]=function(_0x5ad821){return request(_0x495f('0x15'),{'options':{'where':{'id':_0x5ad821},'attributes':[_0x495f('0x16')]}});};exports[_0x495f('0x17')]=function(_0x135ebd){return request('ShowUser',{'options':{'where':{'id':_0x135ebd},'attributes':[_0x495f('0xe')]}});};exports[_0x495f('0x18')]=function(_0x4a0f0f){return request(_0x495f('0x19'),{'options':{'where':{'phone':_0x4a0f0f[_0x495f('0x1a')]},'attributes':['id']}});};exports[_0x495f('0x1b')]=function(_0x58bcc9){return request(_0x495f('0x1c'),{'options':{'where':{'id':_0x58bcc9},'attributes':[_0x495f('0xe')]}});};exports[_0x495f('0x1d')]=function(_0x427c0f){return request('ShowSound',{'options':{'where':{'id':_0x427c0f},'attributes':[_0x495f('0x1e')]}});};exports[_0x495f('0x1f')]=function(_0x5f2530){return request(_0x495f('0x20'),{'options':{'raw':![],'where':{'id':_0x5f2530},'include':[{'model':'Interval','as':_0x495f('0x21')}]}});};exports[_0x495f('0x22')]=function(_0x224860){return request(_0x495f('0x23'),{'options':{'where':{'id':_0x224860},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x75d4de){return request('CreateSmsMessage',{'body':_0x75d4de});};exports[_0x495f('0x24')]=function(_0x1bb86c){return request('CreateSquareDetailsReport',{'body':_0x1bb86c});};exports[_0x495f('0x25')]=function(_0x68ceb2){return request(_0x495f('0x26'),{'body':_[_0x495f('0x27')](_0x68ceb2,{'project_name':_0x68ceb2[_0x495f('0x28')],'prev_project_name':_0x68ceb2[_0x495f('0x29')]||'','is_subproject':_0x68ceb2['arg_2']?!![]:![],'leaveAt':moment()['format'](_0x495f('0x2a'))})});};exports[_0x495f('0x2b')]=function(_0x436fbd){return request(_0x495f('0x2c'),{'body':_0x436fbd});};exports[_0x495f('0x2d')]=function(_0x3850c3){return request('CreateSquareMessage',{'body':_0x3850c3});};exports[_0x495f('0x2e')]=function(_0x26acf9){return request(_0x495f('0x2f'),{'options':{'raw':![],'where':{'phone':_0x26acf9[_0x495f('0x1a')],'ListId':_0x26acf9[_0x495f('0x30')]}}})[_0x495f('0x31')](function(_0x161b4a){if(_0x161b4a){return _0x161b4a;}return request('CreateCmContact',{'body':_0x26acf9});});};exports[_0x495f('0x32')]=function(_0x19711e){return request(_0x495f('0x33'),{'options':{'where':{'id':_0x19711e},'attributes':[_0x495f('0xe')]}});};exports[_0x495f('0x34')]=function(_0x3b8f0f,_0x193224){return request(_0x495f('0x35'),{'body':{'interface':_0x193224},'options':{'where':_0x3b8f0f}});};exports[_0x495f('0x36')]=function(_0x1933cf,_0x1e88ea,_0x56fa74){return request(_0x495f('0x37'),{'body':{'type':_0x1e88ea,'uniqueid':_0x56fa74},'options':{'where':_0x1933cf}});};exports[_0x495f('0x38')]=function(_0x2be0ab){return request(_0x495f('0x39'),{'body':{},'options':{'where':_0x2be0ab}});};exports[_0x495f('0x3a')]=function(_0x4facbf){return request(_0x495f('0x3b'),{'body':{},'options':{'where':_0x4facbf}});}; \ No newline at end of file +var _0x5aaa=['CreateCmContact','agentLogin','PauseUser','UnpauseUser','LogoutUser','bluebird','http','request','error','message','getSquareProject','MailServerOut','Smtp','name','email','getSquareProjectById','ShowSquareProject','getVoiceQueueById','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper'];(function(_0x145b1a,_0xf5e389){var _0x48d44b=function(_0x540feb){while(--_0x540feb){_0x145b1a['push'](_0x145b1a['shift']());}};_0x48d44b(++_0xf5e389);}(_0x5aaa,0xff));var _0xa5aa=function(_0x27f47f,_0x3ddf33){_0x27f47f=_0x27f47f-0x0;var _0x451dad=_0x5aaa[_0x27f47f];return _0x451dad;};'use strict';var BPromise=require(_0xa5aa('0x0'));var moment=require('moment');var _=require('lodash');var util=require('util');var jayson=require('jayson/promise');var client=jayson['client'][_0xa5aa('0x1')]({'port':0x2329});function request(_0x21f5d9,_0x473061){return new BPromise(function(_0x54ca19,_0x24f2bf){return client[_0xa5aa('0x2')](_0x21f5d9,_0x473061)['then'](function(_0x21d216){if(_0x21d216[_0xa5aa('0x3')]){return _0x24f2bf(_0x21d216[_0xa5aa('0x3')][_0xa5aa('0x4')]);}else{return _0x54ca19(_0x21d216['result']);}})['catch'](function(_0x2f079b){return _0x24f2bf(_0x2f079b);});});}exports[_0xa5aa('0x5')]=function(_0x19e12a){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x19e12a},'attributes':['production']}});};exports['getMailAccountById']=function(_0x119692){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x119692},'include':[{'model':_0xa5aa('0x6'),'as':_0xa5aa('0x7')}],'attributes':['id',_0xa5aa('0x8'),_0xa5aa('0x9')]}});};exports[_0xa5aa('0xa')]=function(_0x534576){return request(_0xa5aa('0xb'),{'options':{'where':{'id':_0x534576},'attributes':[_0xa5aa('0x8')]}});};exports[_0xa5aa('0xc')]=function(_0x16787e){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x16787e},'attributes':[_0xa5aa('0x8')]}});};exports[_0xa5aa('0xd')]=function(_0x666788){return request('ShowVariable',{'options':{'where':{'id':_0x666788},'attributes':[_0xa5aa('0x8')]}});};exports[_0xa5aa('0xe')]=function(_0x42bed9){return request(_0xa5aa('0xf'),{'options':{'where':{'id':_0x42bed9},'attributes':[_0xa5aa('0x10')]}});};exports[_0xa5aa('0x11')]=function(_0x2a1c4f){return request('ShowUser',{'options':{'where':{'id':_0x2a1c4f},'attributes':[_0xa5aa('0x8')]}});};exports['getContactByPhone']=function(_0x5bb59d){return request(_0xa5aa('0x12'),{'options':{'where':{'phone':_0x5bb59d[_0xa5aa('0x13')]},'attributes':['id']}});};exports[_0xa5aa('0x14')]=function(_0x2748e1){return request(_0xa5aa('0x15'),{'options':{'where':{'id':_0x2748e1},'attributes':[_0xa5aa('0x8')]}});};exports[_0xa5aa('0x16')]=function(_0x2dcd29){return request('ShowSound',{'options':{'where':{'id':_0x2dcd29},'attributes':[_0xa5aa('0x17')]}});};exports[_0xa5aa('0x18')]=function(_0x554433){return request(_0xa5aa('0x19'),{'options':{'raw':![],'where':{'id':_0x554433},'include':[{'model':_0xa5aa('0x1a'),'as':'Intervals'}]}});};exports[_0xa5aa('0x1b')]=function(_0xe5ee59){return request(_0xa5aa('0x1c'),{'options':{'where':{'id':_0xe5ee59},'attributes':['id',_0xa5aa('0x8')]}});};exports[_0xa5aa('0x1d')]=function(_0x3bdd81){return request(_0xa5aa('0x1e'),{'body':_0x3bdd81});};exports[_0xa5aa('0x1f')]=function(_0x1ebb54){return request(_0xa5aa('0x20'),{'body':_0x1ebb54});};exports['createSquareReport']=function(_0x2d6302){return request(_0xa5aa('0x21'),{'body':_[_0xa5aa('0x22')](_0x2d6302,{'project_name':_0x2d6302[_0xa5aa('0x23')],'prev_project_name':_0x2d6302[_0xa5aa('0x24')]||'','is_subproject':_0x2d6302[_0xa5aa('0x24')]?!![]:![],'leaveAt':moment()[_0xa5aa('0x25')](_0xa5aa('0x26'))})});};exports[_0xa5aa('0x27')]=function(_0x1bf73a){return request(_0xa5aa('0x28'),{'body':_0x1bf73a});};exports[_0xa5aa('0x29')]=function(_0x2088ac){return request(_0xa5aa('0x2a'),{'body':_0x2088ac});};exports[_0xa5aa('0x2b')]=function(_0x3f8819){return request(_0xa5aa('0x2c'),{'options':{'raw':![],'where':{'phone':_0x3f8819['phone'],'ListId':_0x3f8819['ListId']}}})['then'](function(_0x4caaf1){if(_0x4caaf1){return _0x4caaf1;}return request(_0xa5aa('0x2d'),{'body':_0x3f8819});});};exports['getPauseById']=function(_0x4bb923){return request('ShowPause',{'options':{'where':{'id':_0x4bb923},'attributes':[_0xa5aa('0x8')]}});};exports[_0xa5aa('0x2e')]=function(_0x1ec691,_0x503771){return request('LoginUser',{'body':{'interface':_0x503771},'options':{'where':_0x1ec691}});};exports['agentPause']=function(_0x4248c8,_0x49e3f1,_0x167b04){return request(_0xa5aa('0x2f'),{'body':{'type':_0x49e3f1,'uniqueid':_0x167b04},'options':{'where':_0x4248c8}});};exports['agentUnpause']=function(_0x5201c9){return request(_0xa5aa('0x30'),{'body':{},'options':{'where':_0x5201c9}});};exports['agentLogout']=function(_0x6e0696){return request(_0xa5aa('0x31'),{'body':{},'options':{'where':_0x6e0696}});}; \ 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 d2df890..a49be87 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 _0x103f=['./polly','./lex','exports'];(function(_0x2c7e33,_0x13d8d6){var _0xb29ca9=function(_0x50f5ae){while(--_0x50f5ae){_0x2c7e33['push'](_0x2c7e33['shift']());}};_0xb29ca9(++_0x13d8d6);}(_0x103f,0x13e));var _0xf103=function(_0x16fca4,_0x4a4e1e){_0x16fca4=_0x16fca4-0x0;var _0x1e053d=_0x103f[_0x16fca4];return _0x1e053d;};var polly=require(_0xf103('0x0'));var lex=require(_0xf103('0x1'));module[_0xf103('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x22e3=['./polly','./lex','exports'];(function(_0x48e4d6,_0x499fc4){var _0x381211=function(_0x4e2395){while(--_0x4e2395){_0x48e4d6['push'](_0x48e4d6['shift']());}};_0x381211(++_0x499fc4);}(_0x22e3,0xf3));var _0x322e=function(_0x1565f4,_0xa50678){_0x1565f4=_0x1565f4-0x0;var _0x1ef82b=_0x22e3[_0x1565f4];return _0x1ef82b;};var polly=require(_0x322e('0x0'));var lex=require(_0x322e('0x1'));module[_0x322e('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 c7252ee..f3a9268 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(_0x3c97e3,_0x321677){var _0x9bb0ed=function(_0x3a0cb6){while(--_0x3a0cb6){_0x3c97e3['push'](_0x3c97e3['shift']());}};_0x9bb0ed(++_0x321677);}(_0xa571,0x107));var _0x1a57=function(_0xc2869e,_0x105457){_0xc2869e=_0xc2869e-0x0;var _0x243be2=_0xa571[_0xc2869e];return _0x243be2;};'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 _0xf109=['./lib/api','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xf109,0xce));var _0x9f10=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xf109[_0x35885a];return _0xe86249;};'use strict';var lex=require(_0x9f10('0x0'));module[_0x9f10('0x1')]=function(_0x44c4f2,_0x5d2950,_0x5b381d,_0x4cbc7a,_0x3659ce,_0x74f517){return lex(_0x44c4f2,_0x5d2950,_0x5b381d,_0x4cbc7a,_0x3659ce,_0x74f517);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index cef17ba..4b4099d 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(_0x32bdc6,_0x4b629f){var _0x440ab2=function(_0x4c7b00){while(--_0x4c7b00){_0x32bdc6['push'](_0x32bdc6['shift']());}};_0x440ab2(++_0x4b629f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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(_0x2f84ce,_0x38986c){var _0x27c865=function(_0x15cbcc){while(--_0x15cbcc){_0x2f84ce['push'](_0x2f84ce['shift']());}};_0x27c865(++_0x38986c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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 9d4baa9..cf60e09 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 _0xbd57=['./lib/api','exports'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0xbd57,0x8a));var _0x7bd5=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbd57[_0x5ddb1c];return _0x354adc;};'use strict';var polly=require(_0x7bd5('0x0'));module[_0x7bd5('0x1')]=function(_0x3810c1,_0x859ce3,_0x235a17,_0x8948bf,_0x2402f2,_0x23cc3e,_0x37702c){return polly(_0x3810c1,_0x859ce3,_0x235a17,_0x8948bf,_0x2402f2,_0x23cc3e,_0x37702c);}; \ No newline at end of file +var _0xf3ef=['exports'];(function(_0x1dd44e,_0x2a0e17){var _0x5b7fe4=function(_0x537875){while(--_0x537875){_0x1dd44e['push'](_0x1dd44e['shift']());}};_0x5b7fe4(++_0x2a0e17);}(_0xf3ef,0xb5));var _0xff3e=function(_0x1325b5,_0x20c67e){_0x1325b5=_0x1325b5-0x0;var _0x49e29c=_0xf3ef[_0x1325b5];return _0x49e29c;};'use strict';var polly=require('./lib/api');module[_0xff3e('0x0')]=function(_0x6f033a,_0x1484fb,_0x23c256,_0x388b58,_0x25ebfd,_0x1d1358,_0x3286c8){return polly(_0x6f033a,_0x1484fb,_0x23c256,_0x388b58,_0x25ebfd,_0x1d1358,_0x3286c8);}; \ 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 270be42..7ac6c4f 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 _0x0f1c=['bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly'];(function(_0x415305,_0x3328f3){var _0x7d55a4=function(_0x4e0fa5){while(--_0x4e0fa5){_0x415305['push'](_0x415305['shift']());}};_0x7d55a4(++_0x3328f3);}(_0x0f1c,0x1e0));var _0xc0f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f1c[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xc0f1('0x0'));var rs=require(_0xc0f1('0x1'));var AWS=require(_0xc0f1('0x2'));function pollyResult(_0x146bc6,_0x2d1210,_0x2eb4a7){return new BPromise(function(_0x1862d9,_0x49ab8e){_0x146bc6[_0xc0f1('0x3')](_0x2d1210,function(_0x71addf,_0x33d1a6){if(_0x71addf){_0x49ab8e(_0x71addf);}else if(_0x33d1a6){if(_0x33d1a6[_0xc0f1('0x4')]instanceof Buffer){fs[_0xc0f1('0x5')](_0x2eb4a7,_0x33d1a6['AudioStream'],function(_0x52946c){if(_0x52946c){_0x49ab8e(_0x52946c);}else{_0x1862d9();}});}else{_0x49ab8e(new Error(_0xc0f1('0x6')));}}else{_0x49ab8e(new Error(_0xc0f1('0x7')));}});});}module[_0xc0f1('0x8')]=function(_0x224f8f,_0x1357ad,_0x3a5f66,_0x2fe4e6,_0x3bc91e,_0x40027c,_0x4ad500){var _0x4fb25b=new AWS[(_0xc0f1('0x9'))]({'accessKeyId':_0x224f8f,'secretAccessKey':_0x1357ad,'region':_0x3a5f66});var _0x54c3d3={'Text':_0x3bc91e,'TextType':_0x40027c||'text','OutputFormat':'mp3','VoiceId':_0x2fe4e6};return pollyResult(_0x4fb25b,_0x54c3d3,_0x4ad500);}; \ No newline at end of file +var _0x5091=['writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','mp3','bluebird','aws-sdk','synthesizeSpeech'];(function(_0x208cf0,_0x486665){var _0x372d0d=function(_0x293e01){while(--_0x293e01){_0x208cf0['push'](_0x208cf0['shift']());}};_0x372d0d(++_0x486665);}(_0x5091,0x125));var _0x1509=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5091[_0x20a584];return _0x4b41a8;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x1509('0x0'));var rs=require('randomstring');var AWS=require(_0x1509('0x1'));function pollyResult(_0x4d2431,_0x36ae25,_0xd4c0bd){return new BPromise(function(_0x5cac8c,_0x210692){_0x4d2431[_0x1509('0x2')](_0x36ae25,function(_0x3a2359,_0x31c95f){if(_0x3a2359){_0x210692(_0x3a2359);}else if(_0x31c95f){if(_0x31c95f['AudioStream']instanceof Buffer){fs[_0x1509('0x3')](_0xd4c0bd,_0x31c95f['AudioStream'],function(_0x58680e){if(_0x58680e){_0x210692(_0x58680e);}else{_0x5cac8c();}});}else{_0x210692(new Error(_0x1509('0x4')));}}else{_0x210692(new Error(_0x1509('0x5')));}});});}module['exports']=function(_0x50dff7,_0x4966bc,_0x4c3a4e,_0x1534bb,_0x48930f,_0x3f0174,_0x524938){var _0x58f858=new AWS[(_0x1509('0x6'))]({'accessKeyId':_0x50dff7,'secretAccessKey':_0x4966bc,'region':_0x4c3a4e});var _0x32d0ef={'Text':_0x48930f,'TextType':_0x3f0174||'text','OutputFormat':_0x1509('0x7'),'VoiceId':_0x1534bb};return pollyResult(_0x58f858,_0x32d0ef,_0x524938);}; \ 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 e5a386a..dfdf7eb 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 _0x5e4d=['./lib/api','exports'];(function(_0x22bcb5,_0x72449a){var _0x443ad9=function(_0x16c820){while(--_0x16c820){_0x22bcb5['push'](_0x22bcb5['shift']());}};_0x443ad9(++_0x72449a);}(_0x5e4d,0x1bc));var _0xd5e4=function(_0x573d46,_0xd4b23c){_0x573d46=_0x573d46-0x0;var _0xc417e3=_0x5e4d[_0x573d46];return _0xc417e3;};'use strict';var asr=require(_0xd5e4('0x0'));module[_0xd5e4('0x1')]=function(_0x4366ae,_0x1fef53,_0x334483,_0x24504f){return asr(_0x4366ae,_0x1fef53,_0x334483);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0x48bcf0,_0x568177,_0x23da05,_0x5ee740){return asr(_0x48bcf0,_0x568177,_0x23da05);}; \ 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 2b4b337..1fa526e 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 _0x9b9b=['8000','bluebird','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','base64','POST','LINEAR16'];(function(_0xe6e1e8,_0xd07451){var _0x2cd649=function(_0x1c2073){while(--_0x1c2073){_0xe6e1e8['push'](_0xe6e1e8['shift']());}};_0x2cd649(++_0xd07451);}(_0x9b9b,0x114));var _0xb9b9=function(_0x2c9d22,_0x28f65a){_0x2c9d22=_0x2c9d22-0x0;var _0x160346=_0x9b9b[_0x2c9d22];return _0x160346;};'use strict';var url=require('url');var BPromise=require(_0xb9b9('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module['exports']=function(_0x2ae8a0,_0x153734,_0x1adf50){return new BPromise(function(_0x1f6fea,_0x1d6ab6){var _0x43c8ff;if(typeof _0x2ae8a0!==_0xb9b9('0x1')||_0x2ae8a0[_0xb9b9('0x2')]===0x0){return _0x1d6ab6(_0xb9b9('0x3'));}if(typeof _0x153734!==_0xb9b9('0x1')||_0x153734[_0xb9b9('0x2')]===0x0){return _0x1d6ab6(_0xb9b9('0x4'));}if(typeof _0x1adf50!==_0xb9b9('0x5')&&(typeof _0x1adf50!==_0xb9b9('0x1')||_0x1adf50[_0xb9b9('0x2')]===0x0)){return _0x1d6ab6(_0xb9b9('0x6'));}try{_0x43c8ff=fs['readFileSync'](_0x2ae8a0)['toString'](_0xb9b9('0x7'));}catch(_0x139301){return _0x1d6ab6(_0x139301);}return _0x1f6fea({'method':_0xb9b9('0x8'),'uri':host+'/v1/speech:recognize?key='+_0x153734,'body':{'config':{'encoding':_0xb9b9('0x9'),'sampleRateHertz':_0xb9b9('0xa'),'languageCode':_0x1adf50},'audio':{'content':_0x43c8ff}},'json':!![]});});}; \ No newline at end of file +var _0x87f8=['length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','toString','POST','/v1/speech:recognize?key=','LINEAR16','exports','string'];(function(_0x450b2a,_0x174591){var _0x37a7ff=function(_0x259a26){while(--_0x259a26){_0x450b2a['push'](_0x450b2a['shift']());}};_0x37a7ff(++_0x174591);}(_0x87f8,0x152));var _0x887f=function(_0x53fe05,_0x17c66b){_0x53fe05=_0x53fe05-0x0;var _0x1b1e2d=_0x87f8[_0x53fe05];return _0x1b1e2d;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host='https://speech.googleapis.com';module[_0x887f('0x0')]=function(_0x13309f,_0x5be12b,_0x28ce3c){return new BPromise(function(_0x591ca0,_0x46a51e){var _0x3ce88c;if(typeof _0x13309f!==_0x887f('0x1')||_0x13309f[_0x887f('0x2')]===0x0){return _0x46a51e('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x5be12b!==_0x887f('0x1')||_0x5be12b[_0x887f('0x2')]===0x0){return _0x46a51e(_0x887f('0x3'));}if(typeof _0x28ce3c!==_0x887f('0x4')&&(typeof _0x28ce3c!==_0x887f('0x1')||_0x28ce3c[_0x887f('0x2')]===0x0)){return _0x46a51e(_0x887f('0x5'));}try{_0x3ce88c=fs['readFileSync'](_0x13309f)[_0x887f('0x6')]('base64');}catch(_0x130293){return _0x46a51e(_0x130293);}return _0x591ca0({'method':_0x887f('0x7'),'uri':host+_0x887f('0x8')+_0x5be12b,'body':{'config':{'encoding':_0x887f('0x9'),'sampleRateHertz':'8000','languageCode':_0x28ce3c},'audio':{'content':_0x3ce88c}},'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 7bd8cb5..aaba0d2 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 _0x8cff=['./asr'];(function(_0x32b85a,_0x320de3){var _0x34f30a=function(_0x59c0fe){while(--_0x59c0fe){_0x32b85a['push'](_0x32b85a['shift']());}};_0x34f30a(++_0x320de3);}(_0x8cff,0x11d));var _0xf8cf=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x8cff[_0x2dafbe];return _0x58a45a;};var asr=require(_0xf8cf('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x1e14=['./asr','exports'];(function(_0xfd495c,_0x4a3c1a){var _0x561dd8=function(_0x83e915){while(--_0x83e915){_0xfd495c['push'](_0xfd495c['shift']());}};_0x561dd8(++_0x4a3c1a);}(_0x1e14,0x10c));var _0x41e1=function(_0x3200b5,_0x587e63){_0x3200b5=_0x3200b5-0x0;var _0x14ccb9=_0x1e14[_0x3200b5];return _0x14ccb9;};var asr=require(_0x41e1('0x0'));module[_0x41e1('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 0c9cc9e..a77edf1 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 _0x5d48=['./tilde','../../../config/logger','agi','https:','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','close','unlink','pipe','end','protocol','host','data','wav','finish\x20to\x20convert','generate','.wav','writeFileSync','base64','then','777','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','resolve','tmp','.mp3','from','audioContent','chmodSync','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','slice','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','asr','uri','alternatives','transcript','join','results','map','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','result','source','resolvedQuery','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','SessionsClient','sessionPath','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','name','displayName','isFallback','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','confidence','awsPolly','polly','awsLex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','randomstring','url','parse','util','./aws','./google','./sestek'];(function(_0x4d217f,_0x1fa540){var _0x119a90=function(_0x503c79){while(--_0x503c79){_0x4d217f['push'](_0x4d217f['shift']());}};_0x119a90(++_0x1fa540);}(_0x5d48,0x10e));var _0x85d4=function(_0x4bd59b,_0x1e4fce){_0x4bd59b=_0x4bd59b-0x0;var _0x3acc1c=_0x5d48[_0x4bd59b];return _0x3acc1c;};'use strict';var apiai=require(_0x85d4('0x0'));var BPromise=require(_0x85d4('0x1'));var dialogflow=require(_0x85d4('0x2'));var fs=require('fs');var http=require(_0x85d4('0x3'));var https=require(_0x85d4('0x4'));var md5=require(_0x85d4('0x5'));var path=require(_0x85d4('0x6'));var querystring=require(_0x85d4('0x7'));var rp=require(_0x85d4('0x8'));var rs=require(_0x85d4('0x9'));var sox=require('sox');var tts=require('google-tts-api');var urlParse=require(_0x85d4('0xa'))[_0x85d4('0xb')];var util=require(_0x85d4('0xc'));var aws=require(_0x85d4('0xd'));var google=require(_0x85d4('0xe'));var sestek=require(_0x85d4('0xf'));var tilde=require(_0x85d4('0x10'));var logger=require(_0x85d4('0x11'))(_0x85d4('0x12'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x43740d,_0x4c6471){return new BPromise(function(_0x5b2a58,_0x3af0ce){var _0x4c7940=urlParse(_0x43740d);var _0x504adb=_0x4c7940['protocol']===_0x85d4('0x13')?https:http;var _0xce9c78={'host':_0x4c7940['host'],'path':_0x4c7940[_0x85d4('0x6')],'headers':{'user-agent':_0x85d4('0x14')}};_0x504adb[_0x85d4('0x15')](_0xce9c78,function(_0x201e30){if(_0x201e30[_0x85d4('0x16')]!==0xc8){logger[_0x85d4('0x17')](_0x85d4('0x18')+_0x43740d+_0x85d4('0x19')+_0x201e30[_0x85d4('0x16')]+'\x20('+_0x201e30['statusMessage']+')');_0x3af0ce(new Error(_0x85d4('0x18')+_0x43740d+_0x85d4('0x19')+_0x201e30[_0x85d4('0x16')]+'\x20('+_0x201e30[_0x85d4('0x1a')]+')'));return;}var _0xe3d20e=fs[_0x85d4('0x1b')](_0x4c6471);_0xe3d20e['on'](_0x85d4('0x1c'),function(){logger[_0x85d4('0x1d')]('finish\x20download\x20file');_0xe3d20e[_0x85d4('0x1e')](_0x5b2a58);});_0xe3d20e['on'](_0x85d4('0x17'),function(_0x4faa59){fs[_0x85d4('0x1f')](_0x4c6471);logger[_0x85d4('0x17')]('download\x20error',_0x4faa59);_0x3af0ce(_0x4faa59);});_0x201e30[_0x85d4('0x20')](_0xe3d20e);})['on'](_0x85d4('0x17'),function(_0x322dc3){logger[_0x85d4('0x17')](_0x322dc3);_0x3af0ce(_0x322dc3);})[_0x85d4('0x21')]();});}function uploadFile(_0x45f43c){return new BPromise(function(_0x1a1f2d,_0x39ac63){var _0x56259c=urlParse(_0x45f43c);var _0x496bc5=_0x56259c[_0x85d4('0x22')]==='https:'?https:http;var _0x54f3c5={'host':_0x56259c[_0x85d4('0x23')],'path':_0x56259c['path'],'headers':{'user-agent':_0x85d4('0x14')}};_0x496bc5['get'](_0x54f3c5,function(_0x1d973b){if(_0x1d973b['statusCode']!==0xc8){_0x39ac63(new Error(_0x85d4('0x18')+_0x45f43c+_0x85d4('0x19')+_0x1d973b[_0x85d4('0x16')]+'\x20('+_0x1d973b[_0x85d4('0x1a')]+')'));return;}var _0x17f3e0='';_0x1d973b['on'](_0x85d4('0x24'),function(_0xdc2f3e){_0x17f3e0+=_0xdc2f3e;});_0x1d973b['on'](_0x85d4('0x21'),function(){_0x1a1f2d(_0x17f3e0);});})['on']('error',function(_0x35e3a9){_0x39ac63(_0x35e3a9);})[_0x85d4('0x21')]();});}function convertFile(_0x4a76bd,_0x448043){return new BPromise(function(_0x392c8a,_0x5f258c){var _0x174c6b=sox['transcode'](_0x4a76bd,_0x448043,{'sampleRate':0x1f40,'format':_0x85d4('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x174c6b['on'](_0x85d4('0x17'),function(_0x8338ae){logger['error']('error\x20convert',_0x8338ae);_0x5f258c(_0x8338ae);});_0x174c6b['on']('end',function(){logger[_0x85d4('0x1d')](_0x85d4('0x26'));_0x392c8a();});_0x174c6b['start']();});}function base64Decode(_0x78bc5a,_0x66753d){var _0x1adb56=path['resolve'](__dirname,'tmp',rs[_0x85d4('0x27')](0x4)+_0x85d4('0x28'));fs[_0x85d4('0x29')](_0x1adb56,_0x78bc5a,_0x85d4('0x2a'));return convertFile(_0x1adb56,_0x66753d)[_0x85d4('0x2b')](function(){try{fs[_0x85d4('0x1f')](_0x1adb56);fs['chmodSync'](_0x66753d,_0x85d4('0x2c'));}catch(_0x57f29d){logger[_0x85d4('0x17')](_0x57f29d);}return _0x66753d['split']('.')[0x0];});}function base64Encode(_0x1bc30b){var _0x23ffbc=fs[_0x85d4('0x2d')](_0x1bc30b);return new Buffer(_0x23ffbc)[_0x85d4('0x2e')]('base64');}exports[_0x85d4('0x2f')]=function(_0xccc2d8,_0x4ccf18,_0x5f12c7,_0x3b56c6,_0x37e6f8,_0x9da7ec){var _0x4df1c8,_0x339f85;var _0x5e67e9=_0x85d4('0x30');var _0x3c810c=_0x85d4('0x31')+_0xccc2d8;var _0x1469f1={};if(_0x4ccf18===_0x85d4('0x32')){_0x1469f1['input']={'ssml':_0x5f12c7};}else{_0x1469f1[_0x85d4('0x33')]={'text':_0x5f12c7};};_0x1469f1[_0x85d4('0x34')]={'languageCode':_0x3b56c6,'ssmlGender':_0x37e6f8};_0x1469f1[_0x85d4('0x35')]={'audioEncoding':_0x85d4('0x36'),'sampleRateHertz':0x1f40};var _0x37efdb={'url':_0x5e67e9+_0x85d4('0x37')+_0x3c810c,'method':_0x85d4('0x38'),'json':!![],'body':_0x1469f1};return rp(_0x37efdb)[_0x85d4('0x2b')](function(_0x55dc7d){return new BPromise(function(_0x248793,_0x287a46){_0x4df1c8=path[_0x85d4('0x39')](__dirname,_0x85d4('0x3a'),rs[_0x85d4('0x27')](0x4)+_0x85d4('0x3b'));var _0xc1b9ff=Buffer[_0x85d4('0x3c')](_0x55dc7d[_0x85d4('0x3d')],_0x85d4('0x2a'));return fs['writeFile'](_0x4df1c8,_0xc1b9ff,function(_0x27beb1){_0x287a46(_0x27beb1);},function(_0x207fd9){fs[_0x85d4('0x3e')](_0x4df1c8,_0x85d4('0x2c'));_0x248793(_0x207fd9);});});})[_0x85d4('0x2b')](function(_0x380082){_0x339f85=path[_0x85d4('0x39')](__dirname,_0x85d4('0x3a'),rs[_0x85d4('0x27')](0x4)+_0x85d4('0x28'));return convertFile(_0x4df1c8,_0x339f85);})[_0x85d4('0x2b')](function(){try{fs[_0x85d4('0x1f')](_0x4df1c8);fs[_0x85d4('0x3e')](_0x339f85,'777');}catch(_0x3e9a3c){logger[_0x85d4('0x17')](_0x3e9a3c);}logger['info']('googleCloudTTS\x20path',_0x339f85['split']('.')[0x0]);return _0x339f85[_0x85d4('0x3f')]('.')[0x0];});};exports[_0x85d4('0x40')]=function(_0x53d45e,_0x103906){var _0x56d8aa=_0x85d4('0x41');var _0x34674b,_0x46d8c4;var _0x9772e2;var _0x71296c={'encoding':_0x85d4('0x42'),'method':_0x85d4('0x38'),'timeout':0x2710,'url':_0x56d8aa,'headers':{'Content-Type':_0x85d4('0x43')},'body':_0x85d4('0x44')+encodeURIComponent(JSON[_0x85d4('0x45')]([[[_0x85d4('0x46'),JSON[_0x85d4('0x45')]([_0x53d45e,_0x103906||'en',![],_0x85d4('0x47')]),null,'generic']]]))};return rp(_0x71296c)[_0x85d4('0x2b')](function(_0x293f31){try{_0x9772e2=eval(_0x293f31[_0x85d4('0x48')](0x5))[0x0][0x2];}catch(_0x5c9603){throw new Error('parse\x20response\x20failed:\x0a'+_0x293f31['data']);}if(!_0x9772e2){if(_0x53d45e[_0x85d4('0x49')]>0xc8){throw new Error(_0x85d4('0x4a'));}else{throw new Error(_0x85d4('0x4b')+_0x103906+_0x85d4('0x4c'));}}try{_0x9772e2=eval(_0x9772e2)[0x0];}catch(_0x539c2b){throw new Error(_0x85d4('0x4d')+res[_0x85d4('0x24')]);}const _0x3955eb=_0x9772e2;_0x34674b=path[_0x85d4('0x39')](__dirname,'tmp',rs[_0x85d4('0x27')](0x4)+'.mp3');fs[_0x85d4('0x29')](_0x34674b,_0x9772e2,{'encoding':_0x85d4('0x2a')});_0x46d8c4=path['resolve'](__dirname,_0x85d4('0x3a'),rs[_0x85d4('0x27')](0x4)+_0x85d4('0x28'));return convertFile(_0x34674b,_0x46d8c4);})[_0x85d4('0x2b')](function(){try{fs['unlink'](_0x34674b);fs['chmodSync'](_0x46d8c4,_0x85d4('0x2c'));}catch(_0x6bcb01){logger[_0x85d4('0x17')](_0x6bcb01);}logger[_0x85d4('0x1d')]('goggleTTS\x20path',_0x46d8c4[_0x85d4('0x3f')]('.')[0x0]);return _0x46d8c4['split']('.')[0x0];});};exports['googleASR']=function(_0x40df4e,_0x42380e,_0x430cd2){return google[_0x85d4('0x4e')](_0x40df4e,_0x42380e,_0x430cd2)[_0x85d4('0x2b')](function(_0x35c3f8){logger['info'](_0x35c3f8[_0x85d4('0x4f')]);return rp(_0x35c3f8);})[_0x85d4('0x2b')](function(_0x45d2dd){var _0x5aab37='';var _0x42d6a=0x0;try{fs[_0x85d4('0x1f')](_0x40df4e);}catch(_0x2329b5){logger[_0x85d4('0x17')](_0x2329b5);}if(_0x45d2dd&&_0x45d2dd['results']){_0x5aab37=_0x45d2dd['results']['map'](function(_0x441f0b){return _0x441f0b&&_0x441f0b[_0x85d4('0x50')][0x0]&&_0x441f0b[_0x85d4('0x50')][0x0][_0x85d4('0x51')]?_0x441f0b[_0x85d4('0x50')][0x0][_0x85d4('0x51')]:'';})[_0x85d4('0x52')]('\x0a');_0x42d6a=_0x45d2dd[_0x85d4('0x53')][_0x85d4('0x54')](function(_0x512509){return _0x512509&&_0x512509[_0x85d4('0x50')][0x0]&&_0x512509[_0x85d4('0x50')][0x0]['confidence']?_0x512509['alternatives'][0x0]['confidence']:0x0;})[_0x85d4('0x52')]('\x0a');}logger[_0x85d4('0x1d')](_0x85d4('0x55'),_0x5aab37);logger[_0x85d4('0x1d')](_0x85d4('0x56'),_0x42d6a);return{'transcript':_0x5aab37,'confidence':_0x42d6a};})[_0x85d4('0x57')](function(_0x8b9327){logger['error'](_0x85d4('0x58'),_0x8b9327['statusCode'],_0x8b9327['name'],_0x8b9327[_0x85d4('0x59')]);});};exports[_0x85d4('0x5a')]=function(_0x25983b,_0x5964c9,_0x3d296e,_0x57d97c){var _0xeeacbf=apiai(_0x5964c9,{'language':_0x57d97c||'en'});return _0xeeacbf[_0x85d4('0x5b')](_0x3d296e,{'sessionId':md5(_0x25983b)})[_0x85d4('0x2b')](function(_0x3b4b74){logger['info'](JSON[_0x85d4('0x45')](_0x3b4b74));return{'source':_0x3b4b74[_0x85d4('0x5c')][_0x85d4('0x5d')],'resolvedQuery':_0x3b4b74[_0x85d4('0x5c')][_0x85d4('0x5e')],'action':_0x3b4b74['result']['action'],'actionIncomplete':_0x3b4b74[_0x85d4('0x5c')][_0x85d4('0x5f')],'speech':_0x3b4b74[_0x85d4('0x5c')][_0x85d4('0x60')][_0x85d4('0x61')],'score':_0x3b4b74[_0x85d4('0x5c')][_0x85d4('0x62')],'statusCode':_0x3b4b74[_0x85d4('0x63')][_0x85d4('0x64')],'endConversation':_0x3b4b74[_0x85d4('0x5c')][_0x85d4('0x65')][_0x85d4('0x66')]||![],'isFallbackIntent':_0x3b4b74[_0x85d4('0x5c')]['metadata'][_0x85d4('0x67')]};});};exports['googleDialogflowV2']=function(_0x5e977e,_0x3ea73d,_0x569f0c,_0x428ecb,_0x1fc5e2,_0x5b7eff){var _0x26d0a1=_0x428ecb['replace'](/\\n/g,'\x0a');var _0x514de9={'credentials':{'private_key':_0x26d0a1,'client_email':_0x569f0c}};var _0x4e18fc=new dialogflow[(_0x85d4('0x68'))](_0x514de9);var _0x5c6018=_0x4e18fc[_0x85d4('0x69')](_0x3ea73d,md5(_0x5e977e));var _0x2216eb={'session':_0x5c6018,'queryInput':{'text':{'text':_0x1fc5e2,'languageCode':_0x5b7eff}}};return _0x4e18fc['detectIntent'](_0x2216eb)['then'](function(_0x13f39d){if(_0x13f39d&&_0x13f39d['length']){logger[_0x85d4('0x1d')]('Dialogflow\x20V2\x20response:',JSON[_0x85d4('0x45')](_0x13f39d));var _0x554b6c=_0x13f39d[0x0];if(_0x554b6c){var _0x3a49b1={'action':_0x554b6c[_0x85d4('0x6a')][_0x85d4('0x6b')],'allRequiredParamsPresent':_0x554b6c[_0x85d4('0x6a')][_0x85d4('0x6c')],'endConversation':_0x554b6c[_0x85d4('0x6a')][_0x85d4('0x6d')]&&_0x554b6c[_0x85d4('0x6a')][_0x85d4('0x6d')]['fields']?_0x554b6c['queryResult']['diagnosticInfo'][_0x85d4('0x6e')][_0x85d4('0x6f')][_0x85d4('0x70')]:![],'fulfillmentText':_0x554b6c['queryResult'][_0x85d4('0x71')],'intentName':_0x554b6c[_0x85d4('0x6a')][_0x85d4('0x72')][_0x85d4('0x73')],'intentDisplayName':_0x554b6c[_0x85d4('0x6a')][_0x85d4('0x72')][_0x85d4('0x74')],'isFallbackIntent':_0x554b6c[_0x85d4('0x6a')][_0x85d4('0x72')][_0x85d4('0x75')],'languageCode':_0x554b6c[_0x85d4('0x6a')]['languageCode'],'queryText':_0x554b6c[_0x85d4('0x6a')][_0x85d4('0x76')],'responseId':_0x554b6c[_0x85d4('0x77')],'score':_0x554b6c['queryResult'][_0x85d4('0x78')],'speech':_0x554b6c[_0x85d4('0x6a')][_0x85d4('0x71')],'providerResponse':JSON[_0x85d4('0x45')](_0x13f39d)};return _0x3a49b1;}}});};exports[_0x85d4('0x79')]=function(_0x34ec32,_0x2d37f9,_0x1bf62a,_0xffb2be){return tilde[_0x85d4('0x4e')](_0x34ec32,_0x2d37f9,_0x1bf62a,_0xffb2be)[_0x85d4('0x2b')](function(_0x280b2b){try{fs['unlink'](_0x34ec32);}catch(_0x48e0f2){logger[_0x85d4('0x17')](_0x48e0f2);}logger[_0x85d4('0x1d')](_0x85d4('0x7a'),_0x280b2b[_0x85d4('0x51')]);logger[_0x85d4('0x1d')](_0x85d4('0x7b'),_0x280b2b[_0x85d4('0x7c')]);return _0x280b2b;});};exports[_0x85d4('0x7d')]=function(_0x9a1946,_0x2c66b0,_0x40ae34,_0x47ca87,_0x14d2d3,_0x5c5ed1){var _0xd892c2=path[_0x85d4('0x39')](__dirname,_0x85d4('0x3a'),rs['generate'](0x4)+_0x85d4('0x3b'));var _0x5d57d9;return aws[_0x85d4('0x7e')](_0x9a1946,_0x2c66b0,_0x40ae34,_0x47ca87,_0x14d2d3,_0x5c5ed1,_0xd892c2)[_0x85d4('0x2b')](function(){_0x5d57d9=path[_0x85d4('0x39')](__dirname,'tmp',rs[_0x85d4('0x27')](0x4)+_0x85d4('0x28'));return convertFile(_0xd892c2,_0x5d57d9);})['then'](function(){try{fs[_0x85d4('0x1f')](_0xd892c2);fs[_0x85d4('0x3e')](_0x5d57d9,_0x85d4('0x2c'));}catch(_0x1abab3){logger[_0x85d4('0x17')](_0x1abab3);}return _0x5d57d9[_0x85d4('0x3f')]('.')[0x0];});};exports[_0x85d4('0x7f')]=function(_0x98c6c7,_0x41d150,_0x31438d,_0xc79ec,_0x34fed3,_0x5cd6e4){return aws['lex'](_0x98c6c7,_0x41d150,_0x31438d,_0xc79ec,_0x34fed3,_0x5cd6e4)[_0x85d4('0x2b')](function(_0x3fef9d){logger[_0x85d4('0x1d')](JSON['stringify'](_0x3fef9d));return _0x3fef9d;});};exports[_0x85d4('0x80')]=function(_0x2d4d73,_0x2ce89d,_0x3a55df,_0x5404ce){var _0xc40dc6=util[_0x85d4('0x81')](_0x85d4('0x82'),ISPEECH_API,_0x2d4d73,encodeURIComponent(_0x2ce89d),_0x3a55df,_0x5404ce);var _0x13c94f=path[_0x85d4('0x39')](__dirname,_0x85d4('0x3a'),rs[_0x85d4('0x27')](0x4)+'.mp3');var _0x186075;return downloadFile(_0xc40dc6,_0x13c94f)[_0x85d4('0x2b')](function(){_0x186075=path[_0x85d4('0x39')](__dirname,_0x85d4('0x3a'),rs[_0x85d4('0x27')](0x4)+_0x85d4('0x28'));return convertFile(_0x13c94f,_0x186075);})[_0x85d4('0x2b')](function(){try{fs[_0x85d4('0x1f')](_0x13c94f);fs[_0x85d4('0x3e')](_0x186075,'777');}catch(_0x483cdb){logger['error'](_0x483cdb);}return _0x186075[_0x85d4('0x3f')]('.')[0x0];});};exports[_0x85d4('0x83')]=function(_0x39cfcb,_0x1f403c,_0x1f0a2f,_0x557031){var _0x142e12=util[_0x85d4('0x81')](_0x85d4('0x84'),ISPEECH_API,_0x1f403c,_0x1f0a2f,base64Encode(_0x39cfcb),_0x557031?util[_0x85d4('0x81')](_0x85d4('0x85'),encodeURIComponent(_0x557031)):'freeform=3');return uploadFile(_0x142e12)[_0x85d4('0x2b')](function(_0x319109){return querystring['parse'](_0x319109);});};exports[_0x85d4('0x86')]=function(_0x538e44,_0xeaaed7){return sestek[_0x85d4('0x87')](_0x538e44,_0xeaaed7)[_0x85d4('0x2b')](function(_0x585d9d){logger[_0x85d4('0x1d')](JSON[_0x85d4('0x45')](_0x585d9d));var _0x880781={'speech':_0x585d9d['text'],'action':_0x585d9d[_0x85d4('0x88')]?_0x585d9d[_0x85d4('0x88')][_0x85d4('0x89')]:undefined,'actiondata':_0x585d9d[_0x85d4('0x88')]?_0x585d9d[_0x85d4('0x88')][_0x85d4('0x8a')]:undefined};if(_0x585d9d[_0x85d4('0x88')]&&_0x585d9d['channelData'][_0x85d4('0x8b')]){return base64Decode(_0x585d9d[_0x85d4('0x88')][_0x85d4('0x8b')][_0x85d4('0x8c')],path['resolve'](__dirname,_0x85d4('0x3a'),rs['generate'](0x4)+_0x85d4('0x28')))[_0x85d4('0x2b')](function(_0x599720){_0x880781[_0x85d4('0x8d')]=_0x599720;return _0x880781;});}return _0x880781;});};exports[_0x85d4('0x8e')]=function(){return __dirname;}; \ No newline at end of file +var _0xb1cd=['text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','.mp3','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','result','source','resolvedQuery','actionIncomplete','fulfillment','code','metadata','replace','detectIntent','Dialogflow\x20V2\x20response:','queryResult','action','diagnosticInfo','fields','boolValue','fulfillmentText','intent','name','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','apiai-promise','bluebird','dialogflow','http','https','md5','path','request-promise','sox','google-tts-api','parse','./aws','./google','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','https:','get','data','end','wav','error\x20convert','start','resolve','tmp','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig','MP3','POST','from','generate','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','parse\x20response\x20failed:\x0a','length'];(function(_0x5b8ce5,_0x533cd6){var _0x30343c=function(_0xb31971){while(--_0xb31971){_0x5b8ce5['push'](_0x5b8ce5['shift']());}};_0x30343c(++_0x533cd6);}(_0xb1cd,0xc0));var _0xdb1c=function(_0x46be02,_0x46f5fb){_0x46be02=_0x46be02-0x0;var _0x4b1c95=_0xb1cd[_0x46be02];return _0x4b1c95;};'use strict';var apiai=require(_0xdb1c('0x0'));var BPromise=require(_0xdb1c('0x1'));var dialogflow=require(_0xdb1c('0x2'));var fs=require('fs');var http=require(_0xdb1c('0x3'));var https=require(_0xdb1c('0x4'));var md5=require(_0xdb1c('0x5'));var path=require(_0xdb1c('0x6'));var querystring=require('querystring');var rp=require(_0xdb1c('0x7'));var rs=require('randomstring');var sox=require(_0xdb1c('0x8'));var tts=require(_0xdb1c('0x9'));var urlParse=require('url')[_0xdb1c('0xa')];var util=require('util');var aws=require(_0xdb1c('0xb'));var google=require(_0xdb1c('0xc'));var sestek=require('./sestek');var tilde=require(_0xdb1c('0xd'));var logger=require(_0xdb1c('0xe'))(_0xdb1c('0xf'));var ISPEECH_API=_0xdb1c('0x10');function downloadFile(_0x412b77,_0x4b0425){return new BPromise(function(_0x3b7e88,_0x3fb822){var _0x24a7c3=urlParse(_0x412b77);var _0xd92aa3=_0x24a7c3[_0xdb1c('0x11')]==='https:'?https:http;var _0x1d1021={'host':_0x24a7c3[_0xdb1c('0x12')],'path':_0x24a7c3[_0xdb1c('0x6')],'headers':{'user-agent':_0xdb1c('0x13')}};_0xd92aa3['get'](_0x1d1021,function(_0x35710c){if(_0x35710c['statusCode']!==0xc8){logger[_0xdb1c('0x14')](_0xdb1c('0x15')+_0x412b77+_0xdb1c('0x16')+_0x35710c[_0xdb1c('0x17')]+'\x20('+_0x35710c[_0xdb1c('0x18')]+')');_0x3fb822(new Error(_0xdb1c('0x15')+_0x412b77+_0xdb1c('0x16')+_0x35710c['statusCode']+'\x20('+_0x35710c[_0xdb1c('0x18')]+')'));return;}var _0x3fa2b7=fs['createWriteStream'](_0x4b0425);_0x3fa2b7['on'](_0xdb1c('0x19'),function(){logger[_0xdb1c('0x1a')](_0xdb1c('0x1b'));_0x3fa2b7[_0xdb1c('0x1c')](_0x3b7e88);});_0x3fa2b7['on'](_0xdb1c('0x14'),function(_0x5e991f){fs[_0xdb1c('0x1d')](_0x4b0425);logger[_0xdb1c('0x14')](_0xdb1c('0x1e'),_0x5e991f);_0x3fb822(_0x5e991f);});_0x35710c[_0xdb1c('0x1f')](_0x3fa2b7);})['on'](_0xdb1c('0x14'),function(_0x34f859){logger[_0xdb1c('0x14')](_0x34f859);_0x3fb822(_0x34f859);})['end']();});}function uploadFile(_0x3b9d21){return new BPromise(function(_0x2bf6b7,_0x4313ee){var _0x20baf2=urlParse(_0x3b9d21);var _0x3fe12d=_0x20baf2['protocol']===_0xdb1c('0x20')?https:http;var _0x10d564={'host':_0x20baf2[_0xdb1c('0x12')],'path':_0x20baf2[_0xdb1c('0x6')],'headers':{'user-agent':_0xdb1c('0x13')}};_0x3fe12d[_0xdb1c('0x21')](_0x10d564,function(_0x1cbb2b){if(_0x1cbb2b[_0xdb1c('0x17')]!==0xc8){_0x4313ee(new Error(_0xdb1c('0x15')+_0x3b9d21+_0xdb1c('0x16')+_0x1cbb2b[_0xdb1c('0x17')]+'\x20('+_0x1cbb2b[_0xdb1c('0x18')]+')'));return;}var _0x53da1d='';_0x1cbb2b['on'](_0xdb1c('0x22'),function(_0x347c28){_0x53da1d+=_0x347c28;});_0x1cbb2b['on'](_0xdb1c('0x23'),function(){_0x2bf6b7(_0x53da1d);});})['on'](_0xdb1c('0x14'),function(_0x3b7ad5){_0x4313ee(_0x3b7ad5);})[_0xdb1c('0x23')]();});}function convertFile(_0xf2b64,_0x55a3ca){return new BPromise(function(_0x4f4262,_0x4b2268){var _0x2e4198=sox['transcode'](_0xf2b64,_0x55a3ca,{'sampleRate':0x1f40,'format':_0xdb1c('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2e4198['on'](_0xdb1c('0x14'),function(_0x563245){logger['error'](_0xdb1c('0x25'),_0x563245);_0x4b2268(_0x563245);});_0x2e4198['on'](_0xdb1c('0x23'),function(){logger[_0xdb1c('0x1a')]('finish\x20to\x20convert');_0x4f4262();});_0x2e4198[_0xdb1c('0x26')]();});}function base64Decode(_0x29d613,_0x59c519){var _0x205315=path[_0xdb1c('0x27')](__dirname,_0xdb1c('0x28'),rs['generate'](0x4)+_0xdb1c('0x29'));fs[_0xdb1c('0x2a')](_0x205315,_0x29d613,_0xdb1c('0x2b'));return convertFile(_0x205315,_0x59c519)[_0xdb1c('0x2c')](function(){try{fs[_0xdb1c('0x1d')](_0x205315);fs[_0xdb1c('0x2d')](_0x59c519,_0xdb1c('0x2e'));}catch(_0x555697){logger[_0xdb1c('0x14')](_0x555697);}return _0x59c519[_0xdb1c('0x2f')]('.')[0x0];});}function base64Encode(_0x1afd12){var _0x3eda5a=fs[_0xdb1c('0x30')](_0x1afd12);return new Buffer(_0x3eda5a)[_0xdb1c('0x31')](_0xdb1c('0x2b'));}exports[_0xdb1c('0x32')]=function(_0x482ac3,_0x51cf9e,_0x355d15,_0x3c88a5,_0x50c196,_0x160c14){var _0x4c35bf,_0x403c57;var _0x4ec0c2=_0xdb1c('0x33');var _0x40541c=_0xdb1c('0x34')+_0x482ac3;var _0x411a81={};if(_0x51cf9e==='ssml'){_0x411a81['input']={'ssml':_0x355d15};}else{_0x411a81[_0xdb1c('0x35')]={'text':_0x355d15};};_0x411a81[_0xdb1c('0x36')]={'languageCode':_0x3c88a5,'ssmlGender':_0x50c196};_0x411a81[_0xdb1c('0x37')]={'audioEncoding':_0xdb1c('0x38'),'sampleRateHertz':0x1f40};var _0x50de8e={'url':_0x4ec0c2+'text:synthesize'+_0x40541c,'method':_0xdb1c('0x39'),'json':!![],'body':_0x411a81};return rp(_0x50de8e)[_0xdb1c('0x2c')](function(_0x2eedce){return new BPromise(function(_0x18e907,_0x2dac03){_0x4c35bf=path[_0xdb1c('0x27')](__dirname,_0xdb1c('0x28'),rs['generate'](0x4)+'.mp3');var _0x2f6a63=Buffer[_0xdb1c('0x3a')](_0x2eedce['audioContent'],_0xdb1c('0x2b'));return fs['writeFile'](_0x4c35bf,_0x2f6a63,function(_0x198df5){_0x2dac03(_0x198df5);},function(_0x16dbe4){fs['chmodSync'](_0x4c35bf,_0xdb1c('0x2e'));_0x18e907(_0x16dbe4);});});})[_0xdb1c('0x2c')](function(_0x3da939){_0x403c57=path['resolve'](__dirname,_0xdb1c('0x28'),rs[_0xdb1c('0x3b')](0x4)+_0xdb1c('0x29'));return convertFile(_0x4c35bf,_0x403c57);})[_0xdb1c('0x2c')](function(){try{fs[_0xdb1c('0x1d')](_0x4c35bf);fs['chmodSync'](_0x403c57,_0xdb1c('0x2e'));}catch(_0x28729b){logger['error'](_0x28729b);}logger['info'](_0xdb1c('0x3c'),_0x403c57[_0xdb1c('0x2f')]('.')[0x0]);return _0x403c57[_0xdb1c('0x2f')]('.')[0x0];});};exports[_0xdb1c('0x3d')]=function(_0x4d1166,_0x226290){var _0x4c2c79=_0xdb1c('0x3e');var _0x5e1e12,_0x40140d;var _0x182ef0;var _0x39402a={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x4c2c79,'headers':{'Content-Type':_0xdb1c('0x3f')},'body':_0xdb1c('0x40')+encodeURIComponent(JSON[_0xdb1c('0x41')]([[[_0xdb1c('0x42'),JSON[_0xdb1c('0x41')]([_0x4d1166,_0x226290||'en',![],_0xdb1c('0x43')]),null,'generic']]]))};return rp(_0x39402a)[_0xdb1c('0x2c')](function(_0x432d93){try{_0x182ef0=eval(_0x432d93['slice'](0x5))[0x0][0x2];}catch(_0x4ad3e0){throw new Error(_0xdb1c('0x44')+_0x432d93[_0xdb1c('0x22')]);}if(!_0x182ef0){if(_0x4d1166[_0xdb1c('0x45')]>0xc8){throw new Error(_0xdb1c('0x46'));}else{throw new Error('lang\x20\x22'+_0x226290+_0xdb1c('0x47'));}}try{_0x182ef0=eval(_0x182ef0)[0x0];}catch(_0x1c1859){throw new Error(_0xdb1c('0x44')+res[_0xdb1c('0x22')]);}const _0x59aab0=_0x182ef0;_0x5e1e12=path[_0xdb1c('0x27')](__dirname,_0xdb1c('0x28'),rs[_0xdb1c('0x3b')](0x4)+_0xdb1c('0x48'));fs[_0xdb1c('0x2a')](_0x5e1e12,_0x182ef0,{'encoding':_0xdb1c('0x2b')});_0x40140d=path[_0xdb1c('0x27')](__dirname,_0xdb1c('0x28'),rs[_0xdb1c('0x3b')](0x4)+_0xdb1c('0x29'));return convertFile(_0x5e1e12,_0x40140d);})['then'](function(){try{fs[_0xdb1c('0x1d')](_0x5e1e12);fs[_0xdb1c('0x2d')](_0x40140d,_0xdb1c('0x2e'));}catch(_0x3dde1c){logger['error'](_0x3dde1c);}logger['info'](_0xdb1c('0x49'),_0x40140d[_0xdb1c('0x2f')]('.')[0x0]);return _0x40140d[_0xdb1c('0x2f')]('.')[0x0];});};exports[_0xdb1c('0x4a')]=function(_0x335cb9,_0x227f12,_0x355b8e){return google[_0xdb1c('0x4b')](_0x335cb9,_0x227f12,_0x355b8e)[_0xdb1c('0x2c')](function(_0x2c290a){logger[_0xdb1c('0x1a')](_0x2c290a[_0xdb1c('0x4c')]);return rp(_0x2c290a);})[_0xdb1c('0x2c')](function(_0xed77e0){var _0x5b00ed='';var _0x1c7128=0x0;try{fs[_0xdb1c('0x1d')](_0x335cb9);}catch(_0x40f767){logger['error'](_0x40f767);}if(_0xed77e0&&_0xed77e0['results']){_0x5b00ed=_0xed77e0[_0xdb1c('0x4d')][_0xdb1c('0x4e')](function(_0x33190f){return _0x33190f&&_0x33190f[_0xdb1c('0x4f')][0x0]&&_0x33190f[_0xdb1c('0x4f')][0x0][_0xdb1c('0x50')]?_0x33190f['alternatives'][0x0][_0xdb1c('0x50')]:'';})['join']('\x0a');_0x1c7128=_0xed77e0[_0xdb1c('0x4d')]['map'](function(_0x471f12){return _0x471f12&&_0x471f12['alternatives'][0x0]&&_0x471f12[_0xdb1c('0x4f')][0x0][_0xdb1c('0x51')]?_0x471f12[_0xdb1c('0x4f')][0x0][_0xdb1c('0x51')]:0x0;})['join']('\x0a');}logger['info'](_0xdb1c('0x52'),_0x5b00ed);logger[_0xdb1c('0x1a')]('googleASR\x20confidence',_0x1c7128);return{'transcript':_0x5b00ed,'confidence':_0x1c7128};})[_0xdb1c('0x53')](function(_0x1f5718){logger[_0xdb1c('0x14')](_0xdb1c('0x54'),_0x1f5718['statusCode'],_0x1f5718['name'],_0x1f5718[_0xdb1c('0x55')]);});};exports[_0xdb1c('0x56')]=function(_0x466f3f,_0x1a3d2f,_0x595a68,_0x51eb6e){var _0x5a88b6=apiai(_0x1a3d2f,{'language':_0x51eb6e||'en'});return _0x5a88b6[_0xdb1c('0x57')](_0x595a68,{'sessionId':md5(_0x466f3f)})[_0xdb1c('0x2c')](function(_0x3fd2b4){logger[_0xdb1c('0x1a')](JSON[_0xdb1c('0x41')](_0x3fd2b4));return{'source':_0x3fd2b4[_0xdb1c('0x58')][_0xdb1c('0x59')],'resolvedQuery':_0x3fd2b4[_0xdb1c('0x58')][_0xdb1c('0x5a')],'action':_0x3fd2b4['result']['action'],'actionIncomplete':_0x3fd2b4['result'][_0xdb1c('0x5b')],'speech':_0x3fd2b4[_0xdb1c('0x58')][_0xdb1c('0x5c')]['speech'],'score':_0x3fd2b4[_0xdb1c('0x58')]['score'],'statusCode':_0x3fd2b4['status'][_0xdb1c('0x5d')],'endConversation':_0x3fd2b4[_0xdb1c('0x58')][_0xdb1c('0x5e')]['endConversation']||![],'isFallbackIntent':_0x3fd2b4[_0xdb1c('0x58')][_0xdb1c('0x5e')]['isFallbackIntent']};});};exports['googleDialogflowV2']=function(_0x4575b0,_0x169a84,_0x1bb457,_0x4c1330,_0x27b3e1,_0x51643b){var _0x37e971=_0x4c1330[_0xdb1c('0x5f')](/\\n/g,'\x0a');var _0x242826={'credentials':{'private_key':_0x37e971,'client_email':_0x1bb457}};var _0x18f777=new dialogflow['SessionsClient'](_0x242826);var _0x54aaf7=_0x18f777['sessionPath'](_0x169a84,md5(_0x4575b0));var _0x1a149c={'session':_0x54aaf7,'queryInput':{'text':{'text':_0x27b3e1,'languageCode':_0x51643b}}};return _0x18f777[_0xdb1c('0x60')](_0x1a149c)[_0xdb1c('0x2c')](function(_0x41277c){if(_0x41277c&&_0x41277c[_0xdb1c('0x45')]){logger[_0xdb1c('0x1a')](_0xdb1c('0x61'),JSON['stringify'](_0x41277c));var _0x32d4d3=_0x41277c[0x0];if(_0x32d4d3){var _0x3a4a4c={'action':_0x32d4d3[_0xdb1c('0x62')][_0xdb1c('0x63')],'allRequiredParamsPresent':_0x32d4d3['queryResult']['allRequiredParamsPresent'],'endConversation':_0x32d4d3['queryResult']['diagnosticInfo']&&_0x32d4d3[_0xdb1c('0x62')][_0xdb1c('0x64')][_0xdb1c('0x65')]?_0x32d4d3[_0xdb1c('0x62')][_0xdb1c('0x64')][_0xdb1c('0x65')]['end_conversation'][_0xdb1c('0x66')]:![],'fulfillmentText':_0x32d4d3['queryResult'][_0xdb1c('0x67')],'intentName':_0x32d4d3[_0xdb1c('0x62')][_0xdb1c('0x68')][_0xdb1c('0x69')],'intentDisplayName':_0x32d4d3[_0xdb1c('0x62')][_0xdb1c('0x68')][_0xdb1c('0x6a')],'isFallbackIntent':_0x32d4d3[_0xdb1c('0x62')]['intent'][_0xdb1c('0x6b')],'languageCode':_0x32d4d3[_0xdb1c('0x62')][_0xdb1c('0x6c')],'queryText':_0x32d4d3[_0xdb1c('0x62')][_0xdb1c('0x6d')],'responseId':_0x32d4d3[_0xdb1c('0x6e')],'score':_0x32d4d3[_0xdb1c('0x62')][_0xdb1c('0x6f')],'speech':_0x32d4d3[_0xdb1c('0x62')]['fulfillmentText'],'providerResponse':JSON[_0xdb1c('0x41')](_0x41277c)};return _0x3a4a4c;}}});};exports[_0xdb1c('0x70')]=function(_0x4484a6,_0x43f5bc,_0x409c3e,_0x12fdf4){return tilde['asr'](_0x4484a6,_0x43f5bc,_0x409c3e,_0x12fdf4)[_0xdb1c('0x2c')](function(_0x4eb290){try{fs[_0xdb1c('0x1d')](_0x4484a6);}catch(_0xc93001){logger['error'](_0xc93001);}logger[_0xdb1c('0x1a')](_0xdb1c('0x71'),_0x4eb290[_0xdb1c('0x50')]);logger[_0xdb1c('0x1a')](_0xdb1c('0x72'),_0x4eb290[_0xdb1c('0x51')]);return _0x4eb290;});};exports[_0xdb1c('0x73')]=function(_0xb6eb92,_0x5c33b9,_0x175959,_0x799903,_0x7b47ae,_0x3f3e94){var _0x369f3a=path[_0xdb1c('0x27')](__dirname,'tmp',rs[_0xdb1c('0x3b')](0x4)+_0xdb1c('0x48'));var _0x29954a;return aws[_0xdb1c('0x74')](_0xb6eb92,_0x5c33b9,_0x175959,_0x799903,_0x7b47ae,_0x3f3e94,_0x369f3a)[_0xdb1c('0x2c')](function(){_0x29954a=path['resolve'](__dirname,_0xdb1c('0x28'),rs['generate'](0x4)+'.wav');return convertFile(_0x369f3a,_0x29954a);})['then'](function(){try{fs['unlink'](_0x369f3a);fs[_0xdb1c('0x2d')](_0x29954a,_0xdb1c('0x2e'));}catch(_0x2c077e){logger[_0xdb1c('0x14')](_0x2c077e);}return _0x29954a['split']('.')[0x0];});};exports[_0xdb1c('0x75')]=function(_0x51c9aa,_0x1994b0,_0x21a70e,_0x437c30,_0x36310f,_0x18cb48){return aws['lex'](_0x51c9aa,_0x1994b0,_0x21a70e,_0x437c30,_0x36310f,_0x18cb48)[_0xdb1c('0x2c')](function(_0x5c58ce){logger['info'](JSON[_0xdb1c('0x41')](_0x5c58ce));return _0x5c58ce;});};exports[_0xdb1c('0x76')]=function(_0x53c5ae,_0x39ce57,_0xa5785e,_0x5ccfce){var _0x1937d9=util['format'](_0xdb1c('0x77'),ISPEECH_API,_0x53c5ae,encodeURIComponent(_0x39ce57),_0xa5785e,_0x5ccfce);var _0x242376=path['resolve'](__dirname,_0xdb1c('0x28'),rs['generate'](0x4)+_0xdb1c('0x48'));var _0x30f49d;return downloadFile(_0x1937d9,_0x242376)[_0xdb1c('0x2c')](function(){_0x30f49d=path[_0xdb1c('0x27')](__dirname,'tmp',rs[_0xdb1c('0x3b')](0x4)+_0xdb1c('0x29'));return convertFile(_0x242376,_0x30f49d);})['then'](function(){try{fs[_0xdb1c('0x1d')](_0x242376);fs[_0xdb1c('0x2d')](_0x30f49d,'777');}catch(_0x1b2835){logger[_0xdb1c('0x14')](_0x1b2835);}return _0x30f49d[_0xdb1c('0x2f')]('.')[0x0];});};exports[_0xdb1c('0x78')]=function(_0x41e570,_0x588f8e,_0x3651cc,_0x2037eb){var _0x36ab21=util[_0xdb1c('0x79')](_0xdb1c('0x7a'),ISPEECH_API,_0x588f8e,_0x3651cc,base64Encode(_0x41e570),_0x2037eb?util['format'](_0xdb1c('0x7b'),encodeURIComponent(_0x2037eb)):'freeform=3');return uploadFile(_0x36ab21)['then'](function(_0x4ab9b0){return querystring[_0xdb1c('0xa')](_0x4ab9b0);});};exports['sestekNDA']=function(_0x1883c9,_0x1e4e2a){return sestek[_0xdb1c('0x7c')](_0x1883c9,_0x1e4e2a)[_0xdb1c('0x2c')](function(_0x25a92c){logger[_0xdb1c('0x1a')](JSON[_0xdb1c('0x41')](_0x25a92c));var _0x3e1be8={'speech':_0x25a92c[_0xdb1c('0x7d')],'action':_0x25a92c[_0xdb1c('0x7e')]?_0x25a92c[_0xdb1c('0x7e')][_0xdb1c('0x7f')]:undefined,'actiondata':_0x25a92c[_0xdb1c('0x7e')]?_0x25a92c[_0xdb1c('0x7e')][_0xdb1c('0x80')]:undefined};if(_0x25a92c[_0xdb1c('0x7e')]&&_0x25a92c['channelData'][_0xdb1c('0x81')]){return base64Decode(_0x25a92c['channelData'][_0xdb1c('0x81')][_0xdb1c('0x82')],path[_0xdb1c('0x27')](__dirname,_0xdb1c('0x28'),rs[_0xdb1c('0x3b')](0x4)+_0xdb1c('0x29')))['then'](function(_0x38f021){_0x3e1be8['audiofile']=_0x38f021;return _0x3e1be8;});}return _0x3e1be8;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index d75d82a..03352b0 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 _0x0e66=['exports','./nda'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0e66,0xa1));var _0x60e6=function(_0x2afbb0,_0x44f16d){_0x2afbb0=_0x2afbb0-0x0;var _0x411ff2=_0x0e66[_0x2afbb0];return _0x411ff2;};var nda=require(_0x60e6('0x0'));module[_0x60e6('0x1')]={'nda':nda}; \ No newline at end of file +var _0x7d83=['./nda'];(function(_0x2254ac,_0x4cbe28){var _0x3b0a4e=function(_0x139c57){while(--_0x139c57){_0x2254ac['push'](_0x2254ac['shift']());}};_0x3b0a4e(++_0x4cbe28);}(_0x7d83,0x192));var _0x37d8=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x7d83[_0x501510];return _0x1e6ee5;};var nda=require(_0x37d8('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 a1e922f..2273598 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 _0xae60=['request-promise','url','../../../../../config/logger','exports','POST','resolve','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify'];(function(_0x4a44e4,_0x201c58){var _0x3b96c7=function(_0x3b93f8){while(--_0x3b93f8){_0x4a44e4['push'](_0x4a44e4['shift']());}};_0x3b96c7(++_0x201c58);}(_0xae60,0x1c7));var _0x0ae6=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xae60[_0x35885a];return _0xe86249;};'use strict';var rp=require(_0x0ae6('0x0'));var url=require(_0x0ae6('0x1'));var logger=require(_0x0ae6('0x2'))('agi');module[_0x0ae6('0x3')]=function(_0x46c07f,_0x2d388d){var _0x568a7f={'method':_0x0ae6('0x4'),'uri':url[_0x0ae6('0x5')](_0x2d388d['ndauth_url'],_0x0ae6('0x6')),'form':{'grant_type':_0x0ae6('0x7'),'username':_0x2d388d[_0x0ae6('0x8')],'password':_0x2d388d[_0x0ae6('0x7')]},'json':!![]};return rp(_0x568a7f)[_0x0ae6('0x9')](function(_0x447a1d){var _0x120910={'method':_0x0ae6('0x4'),'uri':url['resolve'](_0x2d388d[_0x0ae6('0xa')],_0x0ae6('0xb')),'body':{'type':_0x2d388d[_0x0ae6('0xc')]||_0x0ae6('0xd'),'channelId':'Nda','conversation':{'id':_0x46c07f[_0x0ae6('0xe')]},'from':{'id':_0x46c07f[_0x0ae6('0xf')],'name':_0x46c07f[_0x0ae6('0x10')]},'recipient':{'id':_0x46c07f[_0x0ae6('0x11')],'name':_0x46c07f[_0x0ae6('0x12')]},'text':_0x2d388d[_0x0ae6('0x13')],'channelData':{}},'headers':{'Authorization':_0x0ae6('0x14')+_0x447a1d[_0x0ae6('0x15')]},'json':!![]};if(_0x2d388d[_0x0ae6('0x16')]){_0x120910[_0x0ae6('0x17')][_0x0ae6('0x18')][_0x0ae6('0x19')]=_0x2d388d[_0x0ae6('0x16')];}if(_0x2d388d[_0x0ae6('0x1a')]=='1'){_0x120910['body'][_0x0ae6('0x18')][_0x0ae6('0x1b')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x0ae6('0x1c')};}if(_0x2d388d[_0x0ae6('0x1d')]){_0x120910[_0x0ae6('0x17')][_0x0ae6('0x18')][_0x0ae6('0x1e')]=_0x2d388d[_0x0ae6('0x1d')];if(_0x2d388d[_0x0ae6('0x1f')]){_0x120910[_0x0ae6('0x17')][_0x0ae6('0x18')][_0x0ae6('0x20')]=_0x2d388d[_0x0ae6('0x1f')];}}logger[_0x0ae6('0x21')](JSON[_0x0ae6('0x22')](_0x120910));return rp(_0x120910);});}; \ No newline at end of file +var _0x292e=['username','password','then','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','callerid','calleridname','extension','text','Bearer\x20','access_token','project','body','ProjectName','ndagenerate_audio','channelData','AudioOutputSettings','audio/wav','custom_action_data','CustomActionData','info','request-promise','url','../../../../../config/logger','agi','POST','resolve','/token'];(function(_0x2c92d8,_0x447f0c){var _0x1b2095=function(_0x51cf29){while(--_0x51cf29){_0x2c92d8['push'](_0x2c92d8['shift']());}};_0x1b2095(++_0x447f0c);}(_0x292e,0xcb));var _0xe292=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x292e[_0x19e35c];return _0x3e1fe8;};'use strict';var rp=require(_0xe292('0x0'));var url=require(_0xe292('0x1'));var logger=require(_0xe292('0x2'))(_0xe292('0x3'));module['exports']=function(_0x5d19a5,_0x2652b3){var _0x343aee={'method':_0xe292('0x4'),'uri':url[_0xe292('0x5')](_0x2652b3['ndauth_url'],_0xe292('0x6')),'form':{'grant_type':'password','username':_0x2652b3[_0xe292('0x7')],'password':_0x2652b3[_0xe292('0x8')]},'json':!![]};return rp(_0x343aee)[_0xe292('0x9')](function(_0x11fd14){var _0x26b4de={'method':_0xe292('0x4'),'uri':url['resolve'](_0x2652b3['ndassistant_url'],_0xe292('0xa')),'body':{'type':_0x2652b3[_0xe292('0xb')]||_0xe292('0xc'),'channelId':_0xe292('0xd'),'conversation':{'id':_0x5d19a5['uniqueid']},'from':{'id':_0x5d19a5[_0xe292('0xe')],'name':_0x5d19a5[_0xe292('0xf')]},'recipient':{'id':_0x5d19a5['dnid'],'name':_0x5d19a5[_0xe292('0x10')]},'text':_0x2652b3[_0xe292('0x11')],'channelData':{}},'headers':{'Authorization':_0xe292('0x12')+_0x11fd14[_0xe292('0x13')]},'json':!![]};if(_0x2652b3[_0xe292('0x14')]){_0x26b4de[_0xe292('0x15')]['channelData'][_0xe292('0x16')]=_0x2652b3[_0xe292('0x14')];}if(_0x2652b3[_0xe292('0x17')]=='1'){_0x26b4de[_0xe292('0x15')][_0xe292('0x18')][_0xe292('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xe292('0x1a')};}if(_0x2652b3['custom_action']){_0x26b4de[_0xe292('0x15')][_0xe292('0x18')]['CustomAction']=_0x2652b3['custom_action'];if(_0x2652b3[_0xe292('0x1b')]){_0x26b4de[_0xe292('0x15')][_0xe292('0x18')][_0xe292('0x1c')]=_0x2652b3['custom_action_data'];}}logger[_0xe292('0x1d')](JSON['stringify'](_0x26b4de));return rp(_0x26b4de);});}; \ 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 650c2ee..322e6f6 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 _0x720e=['./lib/api','exports'];(function(_0x1f5227,_0x3bdc1e){var _0x1cfa99=function(_0x31a13d){while(--_0x31a13d){_0x1f5227['push'](_0x1f5227['shift']());}};_0x1cfa99(++_0x3bdc1e);}(_0x720e,0xec));var _0xe720=function(_0x88eed3,_0x1741d7){_0x88eed3=_0x88eed3-0x0;var _0xf8b3a6=_0x720e[_0x88eed3];return _0xf8b3a6;};'use strict';var asr=require(_0xe720('0x0'));module[_0xe720('0x1')]=function(_0x17a358,_0xff9f46,_0x2c7967,_0x543a46){return asr(_0x17a358,_0xff9f46,_0x2c7967,_0x543a46);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0x38f5c5,_0x11c5c3,_0x529468,_0x2d0ec5){return asr(_0x38f5c5,_0x11c5c3,_0x529468,_0x2d0ec5);}; \ 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 9d68ab2..df328b4 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 _0xfc0c=['Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','lodash','moment','crypto','../../../../../../config/logger','agi','exports','Tilde\x20URI','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','hex','info','unix','send','data','close','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.'];(function(_0x10139d,_0x1d2d2b){var _0x2d5e45=function(_0x574912){while(--_0x574912){_0x10139d['push'](_0x10139d['shift']());}};_0x2d5e45(++_0x1d2d2b);}(_0xfc0c,0x9e));var _0xcfc0=function(_0x2a8a37,_0x1c900f){_0x2a8a37=_0x2a8a37-0x0;var _0x379084=_0xfc0c[_0x2a8a37];return _0x379084;};'use strict';var BPromise=require('bluebird');var _=require(_0xcfc0('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xcfc0('0x1'));var crypto=require(_0xcfc0('0x2'));var logger=require(_0xcfc0('0x3'))(_0xcfc0('0x4'));module[_0xcfc0('0x5')]=function(_0x5b3078,_0xab462b,_0x15f88e,_0x111394){return new BPromise(function(_0x2ed2f4,_0x38322b){logger['info'](_0xcfc0('0x6'),_0x111394||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x4aaba4=new WebSocket(_0x111394||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x4f75fd='';var _0x2046a2='0';var _0x264c04='1';var _0x4dcc81=_0xcfc0('0x7');function _0x440a1f(_0x3485aa){var _0x488e28=crypto['createHash'](_0xcfc0('0x8'));_0x488e28[_0xcfc0('0x9')](_0x3485aa);return _0x488e28[_0xcfc0('0xa')](_0xcfc0('0xb'));}function _0x10f8b1(){try{logger[_0xcfc0('0xc')]('Open\x20Tilde\x20ASR\x20socket');var _0x84c5d=moment()[_0xcfc0('0xd')]();var _0x482719=_0x440a1f(_0x84c5d+_0xab462b+_0x15f88e);_0x4aaba4[_0xcfc0('0xe')](JSON['stringify']({'appID':_0xab462b,'timestamp':_0x84c5d,'appKey':_0x482719}));var _0x1fad47=fs['createReadStream'](_0x5b3078);_0x1fad47['on'](_0xcfc0('0xf'),function(_0x89b736){_0x4aaba4[_0xcfc0('0xe')](_0x89b736);});_0x1fad47['on'](_0xcfc0('0x10'),function(){_0x4aaba4['send']('EOS');});}catch(_0x2517ce){logger[_0xcfc0('0x11')](_0xcfc0('0x12'),JSON[_0xcfc0('0x13')](_0x2517ce));_0x4aaba4[_0xcfc0('0x14')]();}}function _0x2a625a(_0x252337){try{if(_0x252337){var _0x47907f=JSON[_0xcfc0('0x15')](_0x252337);switch(_0x47907f[_0xcfc0('0x16')]){case 0x0:if(_0x47907f[_0xcfc0('0x17')]){if(_0x47907f['result']['final']){logger[_0xcfc0('0xc')](_0xcfc0('0x18'),JSON[_0xcfc0('0x13')](_0x47907f[_0xcfc0('0x17')][_0xcfc0('0x19')]));_0x4f75fd=_0x47907f[_0xcfc0('0x17')][_0xcfc0('0x19')][0x0]['transcript'];_0x2046a2=_0x47907f[_0xcfc0('0x17')][_0xcfc0('0x19')][0x0][_0xcfc0('0x1a')];_0x264c04='0';_0x4dcc81=_0xcfc0('0x1b');_0x4aaba4['terminate']();}}break;case 0x1:logger[_0xcfc0('0xc')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x264c04='1';_0x4dcc81='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xcfc0('0xc')](_0xcfc0('0x1c'));_0x264c04='2';_0x4dcc81=_0xcfc0('0x1c');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x264c04='9';_0x4dcc81=_0xcfc0('0x1d');break;case 0xa:logger[_0xcfc0('0xc')](_0xcfc0('0x1e'));_0x264c04='10';_0x4dcc81=_0xcfc0('0x1e');break;case 0xb:logger['info'](_0xcfc0('0x1f'));_0x264c04='11';_0x4dcc81=_0xcfc0('0x1f');}}}catch(_0x48207d){logger[_0xcfc0('0x11')](_0xcfc0('0x20'),JSON[_0xcfc0('0x13')](_0x48207d));_0x4aaba4[_0xcfc0('0x14')]();}}function _0x4a2b74(){logger[_0xcfc0('0xc')]('Close\x20Tilde\x20ASR\x20socket');_0x2ed2f4({'transcript':_0x4f75fd,'confidence':_0x2046a2,'status':_0x264c04,'status_message':_0x4dcc81});}function _0x5d303e(_0x45f32e){logger[_0xcfc0('0x11')](_0xcfc0('0x21'));if(!_[_0xcfc0('0x22')](_0x45f32e)){logger[_0xcfc0('0x11')](_[_0xcfc0('0x23')](_0x45f32e)?JSON[_0xcfc0('0x13')](_0x45f32e):_0x45f32e);}}_0x4aaba4['on'](_0xcfc0('0x24'),_0x10f8b1);_0x4aaba4['on'](_0xcfc0('0x25'),_0x2a625a);_0x4aaba4['on'](_0xcfc0('0x10'),_0x4a2b74);_0x4aaba4['on'](_0xcfc0('0x11'),_0x5d303e);});}; \ No newline at end of file +var _0x2190=['send','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','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','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','info','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','stringify','createReadStream'];(function(_0x1a051d,_0x3a017a){var _0x275ccb=function(_0x1290ba){while(--_0x1290ba){_0x1a051d['push'](_0x1a051d['shift']());}};_0x275ccb(++_0x3a017a);}(_0x2190,0x69));var _0x0219=function(_0x5c18cf,_0x21e920){_0x5c18cf=_0x5c18cf-0x0;var _0x26f627=_0x2190[_0x5c18cf];return _0x26f627;};'use strict';var BPromise=require(_0x0219('0x0'));var _=require(_0x0219('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x0219('0x2'));var crypto=require(_0x0219('0x3'));var logger=require(_0x0219('0x4'))('agi');module['exports']=function(_0x1c0c05,_0x1aee89,_0x24e924,_0x184dde){return new BPromise(function(_0x3a4498,_0x3c0e3b){logger[_0x0219('0x5')]('Tilde\x20URI',_0x184dde||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x485457=new WebSocket(_0x184dde||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x84281='';var _0x47d2de='0';var _0x801b4b='1';var _0x103ae8=_0x0219('0x6');function _0x37027b(_0x309132){var _0x31ce79=crypto[_0x0219('0x7')]('sha1');_0x31ce79[_0x0219('0x8')](_0x309132);return _0x31ce79[_0x0219('0x9')](_0x0219('0xa'));}function _0x3c3fa1(){try{logger[_0x0219('0x5')](_0x0219('0xb'));var _0x3fe615=moment()[_0x0219('0xc')]();var _0x505f46=_0x37027b(_0x3fe615+_0x1aee89+_0x24e924);_0x485457['send'](JSON[_0x0219('0xd')]({'appID':_0x1aee89,'timestamp':_0x3fe615,'appKey':_0x505f46}));var _0x439a49=fs[_0x0219('0xe')](_0x1c0c05);_0x439a49['on']('data',function(_0x3f2efb){_0x485457[_0x0219('0xf')](_0x3f2efb);});_0x439a49['on'](_0x0219('0x10'),function(){_0x485457[_0x0219('0xf')](_0x0219('0x11'));});}catch(_0x5f029f){logger[_0x0219('0x12')](_0x0219('0x13'),JSON[_0x0219('0xd')](_0x5f029f));_0x485457[_0x0219('0x14')]();}}function _0x583481(_0x236a8f){try{if(_0x236a8f){var _0x983b5c=JSON[_0x0219('0x15')](_0x236a8f);switch(_0x983b5c[_0x0219('0x16')]){case 0x0:if(_0x983b5c[_0x0219('0x17')]){if(_0x983b5c[_0x0219('0x17')][_0x0219('0x18')]){logger[_0x0219('0x5')](_0x0219('0x19'),JSON[_0x0219('0xd')](_0x983b5c[_0x0219('0x17')][_0x0219('0x1a')]));_0x84281=_0x983b5c[_0x0219('0x17')][_0x0219('0x1a')][0x0][_0x0219('0x1b')];_0x47d2de=_0x983b5c[_0x0219('0x17')]['hypotheses'][0x0][_0x0219('0x1c')];_0x801b4b='0';_0x103ae8=_0x0219('0x1d');_0x485457[_0x0219('0x14')]();}}break;case 0x1:logger[_0x0219('0x5')](_0x0219('0x6'));_0x801b4b='1';_0x103ae8=_0x0219('0x6');break;case 0x2:logger[_0x0219('0x5')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x801b4b='2';_0x103ae8=_0x0219('0x1e');break;case 0x9:logger[_0x0219('0x5')](_0x0219('0x1f'));_0x801b4b='9';_0x103ae8=_0x0219('0x1f');break;case 0xa:logger[_0x0219('0x5')](_0x0219('0x20'));_0x801b4b='10';_0x103ae8=_0x0219('0x20');break;case 0xb:logger['info'](_0x0219('0x21'));_0x801b4b='11';_0x103ae8=_0x0219('0x21');}}}catch(_0x401dcd){logger[_0x0219('0x12')](_0x0219('0x22'),JSON[_0x0219('0xd')](_0x401dcd));_0x485457['terminate']();}}function _0x294a1e(){logger['info']('Close\x20Tilde\x20ASR\x20socket');_0x3a4498({'transcript':_0x84281,'confidence':_0x47d2de,'status':_0x801b4b,'status_message':_0x103ae8});}function _0x476b3f(_0x512477){logger[_0x0219('0x12')](_0x0219('0x23'));if(!_[_0x0219('0x24')](_0x512477)){logger['error'](_[_0x0219('0x25')](_0x512477)?JSON[_0x0219('0xd')](_0x512477):_0x512477);}}_0x485457['on'](_0x0219('0x26'),_0x3c3fa1);_0x485457['on'](_0x0219('0x27'),_0x583481);_0x485457['on']('close',_0x294a1e);_0x485457['on'](_0x0219('0x12'),_0x476b3f);});}; \ 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 cc796f8..6106fac 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 _0x5f27=['exports','./asr'];(function(_0x14dca7,_0x22d98b){var _0x1e2230=function(_0x3a0019){while(--_0x3a0019){_0x14dca7['push'](_0x14dca7['shift']());}};_0x1e2230(++_0x22d98b);}(_0x5f27,0x9d));var _0x75f2=function(_0x299219,_0x5361ca){_0x299219=_0x299219-0x0;var _0x325914=_0x5f27[_0x299219];return _0x325914;};var asr=require(_0x75f2('0x0'));module[_0x75f2('0x1')]={'asr':asr}; \ No newline at end of file +var _0x57e3=['exports','./asr'];(function(_0x497bd0,_0x183809){var _0x364835=function(_0x1b114f){while(--_0x1b114f){_0x497bd0['push'](_0x497bd0['shift']());}};_0x364835(++_0x183809);}(_0x57e3,0xff));var _0x357e=function(_0x521ca9,_0x47d210){_0x521ca9=_0x521ca9-0x0;var _0x166006=_0x57e3[_0x521ca9];return _0x166006;};var asr=require(_0x357e('0x0'));module[_0x357e('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index df9b24d..ad44ba3 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 _0xbf96=['events','EventEmitter','./channel','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','net'];(function(_0x5b2e3d,_0x2d7f7b){var _0x35a13c=function(_0x831acc){while(--_0x831acc){_0x5b2e3d['push'](_0x5b2e3d['shift']());}};_0x35a13c(++_0x2d7f7b);}(_0xbf96,0xdb));var _0x6bf9=function(_0x469e53,_0x1b0034){_0x469e53=_0x469e53-0x0;var _0x1bf91b=_0xbf96[_0x469e53];return _0x1bf91b;};'use strict';var util=require('util');var net=require(_0x6bf9('0x0'));var EventEmitter=require(_0x6bf9('0x1'))[_0x6bf9('0x2')];var AGIError=require('./error');var AGIChannel=require(_0x6bf9('0x3'));var AGIServer=function(_0x22f1ff,_0x3aaa41,_0x1e11bd){var _0x3b5f8e=this,_0x22f1ff=_0x22f1ff||0x11dd,_0x3aaa41=_0x3aaa41||'127.0.0.1',_0x37da1a=null,_0x4659b2=0x0;EventEmitter['call'](_0x3b5f8e);function _0x240b7c(){if(!_0x22f1ff){_0x3b5f8e[_0x6bf9('0x4')](_0x6bf9('0x5'),new AGIError(_0x6bf9('0x6')));return![];}_0x37da1a=net[_0x6bf9('0x7')]();_0x37da1a[_0x6bf9('0x8')](_0x22f1ff,_0x3aaa41);_0x37da1a['on'](_0x6bf9('0x9'),function(){_0x3b5f8e[_0x6bf9('0x4')]('listening');});_0x37da1a['on'](_0x6bf9('0xa'),function(_0x3e4e80){_0x37da1a[_0x6bf9('0xb')](function(_0x3def91,_0x22ea6a){if(_0x3def91){_0x3b5f8e[_0x6bf9('0x4')](_0x6bf9('0x5'),new AGIError(_0x6bf9('0xc'),_0x3def91));}else if(_0x1e11bd&&_0x1e11bd<0x0){_0x3b5f8e[_0x6bf9('0x4')](_0x6bf9('0x5'),new AGIError(_0x6bf9('0xd')));_0x3e4e80[_0x6bf9('0xe')]();}else if(_0x1e11bd&&_0x1e11bd>0x0&&_0x1e11bd<_0x22ea6a){_0x4659b2+=0x1;_0x3b5f8e[_0x6bf9('0x4')](_0x6bf9('0x5'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x4659b2));_0x3e4e80[_0x6bf9('0xe')]();}else{var _0x150a5b=new AGIChannel(_0x3e4e80);_0x150a5b['on']('ready',function(){_0x3b5f8e[_0x6bf9('0x4')](_0x6bf9('0xa'),_0x150a5b);});}});});_0x37da1a['on']('error',function(_0x216e8c){_0x3b5f8e[_0x6bf9('0x4')]('error',new AGIError(_0x6bf9('0xc'),_0x216e8c['code']));});_0x37da1a['on'](_0x6bf9('0xf'),function(){_0x3b5f8e['emit'](_0x6bf9('0xf'),new AGIError(_0x6bf9('0x10')));});}process[_0x6bf9('0x11')](function(){_0x240b7c();});};util[_0x6bf9('0x12')](AGIServer,EventEmitter);module[_0x6bf9('0x13')]=function(_0x1aeac5,_0x57ba23,_0x3d0e4a){return new AGIServer(_0x1aeac5,_0x57ba23,_0x3d0e4a);}; \ No newline at end of file +var _0x67d4=['exports','util','net','EventEmitter','./error','./channel','127.0.0.1','call','emit','error','createServer','listening','connection','getConnections','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits'];(function(_0x1db1c3,_0x295a91){var _0x4a1284=function(_0x19388c){while(--_0x19388c){_0x1db1c3['push'](_0x1db1c3['shift']());}};_0x4a1284(++_0x295a91);}(_0x67d4,0x151));var _0x467d=function(_0x25e5e0,_0x254be1){_0x25e5e0=_0x25e5e0-0x0;var _0x3705f5=_0x67d4[_0x25e5e0];return _0x3705f5;};'use strict';var util=require(_0x467d('0x0'));var net=require(_0x467d('0x1'));var EventEmitter=require('events')[_0x467d('0x2')];var AGIError=require(_0x467d('0x3'));var AGIChannel=require(_0x467d('0x4'));var AGIServer=function(_0x377e82,_0x264f58,_0x342691){var _0x37b35c=this,_0x377e82=_0x377e82||0x11dd,_0x264f58=_0x264f58||_0x467d('0x5'),_0xbac768=null,_0x1dd77a=0x0;EventEmitter[_0x467d('0x6')](_0x37b35c);function _0x39850a(){if(!_0x377e82){_0x37b35c[_0x467d('0x7')](_0x467d('0x8'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0xbac768=net[_0x467d('0x9')]();_0xbac768['listen'](_0x377e82,_0x264f58);_0xbac768['on'](_0x467d('0xa'),function(){_0x37b35c[_0x467d('0x7')](_0x467d('0xa'));});_0xbac768['on'](_0x467d('0xb'),function(_0x3bde73){_0xbac768[_0x467d('0xc')](function(_0x1579b0,_0x5d34ea){if(_0x1579b0){_0x37b35c[_0x467d('0x7')](_0x467d('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x1579b0));}else if(_0x342691&&_0x342691<0x0){_0x37b35c[_0x467d('0x7')](_0x467d('0x8'),new AGIError(_0x467d('0xd')));_0x3bde73[_0x467d('0xe')]();}else if(_0x342691&&_0x342691>0x0&&_0x342691<_0x5d34ea){_0x1dd77a+=0x1;_0x37b35c[_0x467d('0x7')](_0x467d('0x8'),new AGIError(_0x467d('0xf'),_0x1dd77a));_0x3bde73[_0x467d('0xe')]();}else{var _0x134aa0=new AGIChannel(_0x3bde73);_0x134aa0['on'](_0x467d('0x10'),function(){_0x37b35c[_0x467d('0x7')]('connection',_0x134aa0);});}});});_0xbac768['on'](_0x467d('0x8'),function(_0x526851){_0x37b35c[_0x467d('0x7')](_0x467d('0x8'),new AGIError(_0x467d('0x11'),_0x526851[_0x467d('0x12')]));});_0xbac768['on'](_0x467d('0x13'),function(){_0x37b35c[_0x467d('0x7')]('close',new AGIError(_0x467d('0x14')));});}process[_0x467d('0x15')](function(){_0x39850a();});};util[_0x467d('0x16')](AGIServer,EventEmitter);module[_0x467d('0x17')]=function(_0xbeb50a,_0x5bcf53,_0x175b05){return new AGIServer(_0xbeb50a,_0x5bcf53,_0x175b05);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index fb16324..bd046c3 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 _0x3248=['sendMailMessage','getIntervalById','interval','map','Intervals','getSoundPath','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','isNil','phone','list_id','scheduledAt','callback','toString','callback_priority','dialTimezone','CALLERID(dialTimezone)','getContactByPhone','timezones','scheduledat','add','insertContact','utcOffset','minutes','getPause','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','LOCAL','shellCommand','exec','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','languageCode','en-US','ssmlGender','audioEncoding','MP3','googleTTS','text','google_tts_language','restAPI','method','timeout','number','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','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','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','Amy','aws_text_type','awsLex','aws_access_key_id','googleASR','tildeASR','appid','appsecret','clear','clone','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','isPlainObject','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','no\x20text\x20configured','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','hasOwnProperty','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','bot','Trying\x20DialogflowV2:\x20%s','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','password','no\x20password\x20configured','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','opts','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','extension','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','operation','%s[%s]','menu','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','pause_id','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','url','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','authentication','auth','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','util','lodash','shelljs','odbc','randomstring','moment','../../config/logger','agi','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','channel','rpc','mailRpc','getVariable','getVariableById','then','name','prototype','getSquareProject','catch','getSquareOdbc','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','save_name','getMailAccount','getMailAccountById'];(function(_0x23880d,_0x265047){var _0x5e5f71=function(_0x3fa3e5){while(--_0x3fa3e5){_0x23880d['push'](_0x23880d['shift']());}};_0x5e5f71(++_0x265047);}(_0x3248,0x1b0));var _0x8324=function(_0x4632cc,_0x15ac5a){_0x4632cc=_0x4632cc-0x0;var _0x241f2f=_0x3248[_0x4632cc];return _0x241f2f;};'use strict';var fs=require('fs');var path=require(_0x8324('0x0'));var util=require(_0x8324('0x1'));var _=require(_0x8324('0x2'));var sh=require(_0x8324('0x3'));var odbc=require(_0x8324('0x4'))();var rs=require(_0x8324('0x5'));var moment=require(_0x8324('0x6'));var Mustache=require('mustache');var rp=require('request-promise');var logger=require(_0x8324('0x7'))(_0x8324('0x8'));var config=require('../../config/environment');var shared=require(_0x8324('0x9'));var scripts=require(_0x8324('0xa'));var FILES_PATH=_0x8324('0xb');var recursiveMapAttributes=[_0x8324('0xc'),_0x8324('0xd')];var verticesWithRetry=['menu',_0x8324('0xe'),_0x8324('0xf')];var AGIVertices=function(_0x423b3f,_0x52b5f2,_0x55e1d2){this[_0x8324('0x10')]=_0x423b3f;this[_0x8324('0x11')]=_0x52b5f2;this[_0x8324('0x12')]=_0x55e1d2;};AGIVertices['prototype'][_0x8324('0x13')]=function(_0x1caa56,_0x9191a4){this[_0x8324('0x11')][_0x8324('0x14')](_0x1caa56)[_0x8324('0x15')](function(_0x4f000e){_0x9191a4(null,_0x4f000e?_0x4f000e['name']:![]);})['catch'](function(_0xf3c3e1){_0x9191a4(_0xf3c3e1);});};AGIVertices['prototype']['getVoiceQueue']=function(_0x3bb793,_0xdd6c0e){this[_0x8324('0x11')]['getVoiceQueueById'](_0x3bb793)[_0x8324('0x15')](function(_0x1ab2eb){_0xdd6c0e(null,_0x1ab2eb?_0x1ab2eb[_0x8324('0x16')]:![]);})['catch'](function(_0x297035){_0xdd6c0e(_0x297035);});};AGIVertices[_0x8324('0x17')][_0x8324('0x18')]=function(_0x9cfe5,_0x434761){this[_0x8324('0x11')]['getSquareProjectById'](_0x9cfe5)['then'](function(_0x25bc03){_0x434761(null,_0x25bc03?_0x25bc03[_0x8324('0x16')]:![]);})[_0x8324('0x19')](function(_0x5d0abc){_0x434761(_0x5d0abc);});};AGIVertices[_0x8324('0x17')][_0x8324('0x1a')]=function(_0x43df53,_0x3162d8){this[_0x8324('0x11')]['getSquareOdbcById'](_0x43df53)[_0x8324('0x15')](function(_0x5e07b5){_0x3162d8(null,_0x5e07b5?_0x5e07b5[_0x8324('0x1b')]:![]);})['catch'](function(_0x34e80a){_0x3162d8(_0x34e80a);});};AGIVertices['prototype'][_0x8324('0x1c')]=function(_0xb31584,_0xb248c6){this[_0x8324('0x11')][_0x8324('0x1d')](_0xb31584)[_0x8324('0x15')](function(_0x44042f){_0xb248c6(null,_0x44042f?_0x44042f[_0x8324('0x16')]:![]);})[_0x8324('0x19')](function(_0x25bcc9){_0xb248c6(_0x25bcc9);});};AGIVertices[_0x8324('0x17')][_0x8324('0x1e')]=function(_0x3e8102,_0x38a09a){this[_0x8324('0x11')][_0x8324('0x1f')](_0x3e8102)[_0x8324('0x15')](function(_0x32510a){_0x38a09a(null,_0x32510a?_0x32510a[_0x8324('0x16')]:![]);})[_0x8324('0x19')](function(_0x353ee9){_0x38a09a(_0x353ee9);});};AGIVertices[_0x8324('0x17')][_0x8324('0x20')]=function(_0x3ee7bd,_0x45fadf){var _0x4e022b=this;this[_0x8324('0x11')][_0x8324('0x21')](_0x3ee7bd)[_0x8324('0x15')](function(_0x17bda7){_0x45fadf(null,_0x17bda7?_0x4e022b['getSoundPath'](_0x17bda7[_0x8324('0x22')]):![]);})[_0x8324('0x19')](function(_0x437b4e){_0x45fadf(_0x437b4e);});};AGIVertices[_0x8324('0x17')][_0x8324('0x23')]=function(_0x7dc4c9,_0x43a8f){this['rpc'][_0x8324('0x24')](_0x7dc4c9)[_0x8324('0x15')](function(_0x4768b3){_0x43a8f(null,_0x4768b3?_0x4768b3:![]);})[_0x8324('0x19')](function(_0x27b46d){_0x43a8f(_0x27b46d);});};AGIVertices[_0x8324('0x17')]['sendMailMessage']=function(_0x39f37,_0x27c920,_0x4d866f){this[_0x8324('0x12')][_0x8324('0x25')](_0x39f37,_0x27c920)[_0x8324('0x15')](function(){_0x4d866f(null);})['catch'](function(_0x4cb8e8){_0x4d866f(_0x4cb8e8);});};AGIVertices[_0x8324('0x17')]['getIntervals']=function(_0x4dfbce,_0x25761c){this[_0x8324('0x11')][_0x8324('0x26')](_0x4dfbce)['then'](function(_0x5d8c62){if(_0x5d8c62){if(_0x5d8c62['IntervalId']){_0x25761c(null,[_0x5d8c62[_0x8324('0x27')]]);}else{_0x25761c(null,_[_0x8324('0x28')](_0x5d8c62[_0x8324('0x29')],_0x8324('0x27')));}}else{_0x25761c(null,![]);}})['catch'](function(_0x13f2ef){_0x25761c(_0x13f2ef);});};AGIVertices[_0x8324('0x17')][_0x8324('0x2a')]=function(_0xca3b4d){return util['format'](_0x8324('0x2b'),FILES_PATH,_0xca3b4d);};AGIVertices[_0x8324('0x17')][_0x8324('0x2c')]=function(_0x3484fc,_0x515f1d,_0x375116){odbc[_0x8324('0x2d')](_0x3484fc,function(_0xde725){if(_0xde725){logger[_0x8324('0x2e')](_0x8324('0x2f'),_0xde725);_0x375116(_0xde725);}else{logger[_0x8324('0x30')](_0x8324('0x31'));odbc[_0x8324('0x32')](_0x515f1d,function(_0x26eff6,_0x50097f){if(_0x26eff6){logger['info']('Error\x20executing\x20query\x20%s',_0x515f1d);_0x375116(_0x26eff6);}else{logger[_0x8324('0x30')](_0x8324('0x33'),_0x515f1d);odbc[_0x8324('0x34')](function(_0x36546e){if(_0x36546e){logger['error'](_0x8324('0x35'),_0x36546e);}_0x375116(null,_0x50097f);});}});}});};AGIVertices['prototype'][_0x8324('0x36')]=function(_0x1c6547,_0x59ad42){this[_0x8324('0x11')][_0x8324('0x37')](_0x1c6547)[_0x8324('0x15')](function(_0x391ee6){_0x59ad42(null,_0x391ee6?_0x391ee6:![]);})[_0x8324('0x19')](function(_0x3c2401){_0x59ad42(_0x3c2401);});};AGIVertices[_0x8324('0x17')][_0x8324('0x38')]=function(_0x31f622,_0x145b52){this[_0x8324('0x11')][_0x8324('0x38')](_0x31f622)[_0x8324('0x15')](function(_0x5ac4fb){_0x145b52(null,_0x5ac4fb);})[_0x8324('0x19')](function(_0x270e95){_0x145b52(_0x270e95);});};AGIVertices['prototype'][_0x8324('0x39')]=function(_0x4d4216,_0x2ca5,_0x50ec06){this[_0x8324('0x11')][_0x8324('0x39')]({'uniqueid':this[_0x8324('0x10')][_0x8324('0x3a')],'node':_0x4d4216[_0x8324('0x3b')],'application':_0x4d4216['agicommand'],'data':_0x2ca5||null,'project_name':this['channel'][_0x8324('0x3c')],'callerid':this[_0x8324('0x10')][_0x8324('0x3d')]})[_0x8324('0x15')](function(_0x4b1b39){if(_0x50ec06){_0x50ec06(null,_0x4b1b39);}})[_0x8324('0x19')](function(_0x4eb919){if(_0x50ec06){_0x50ec06(_0x4eb919);}});};AGIVertices[_0x8324('0x17')][_0x8324('0x3e')]=function(_0x2894ca,_0x38c03c,_0x5823bf,_0x2d7730){this['rpc'][_0x8324('0x3e')]({'uniqueid':this[_0x8324('0x10')][_0x8324('0x3a')],'callerid':this[_0x8324('0x10')]['callerid'],'calleridname':this[_0x8324('0x10')][_0x8324('0x3f')],'context':this[_0x8324('0x10')]['context'],'extension':this[_0x8324('0x10')]['extension'],'priority':this[_0x8324('0x10')][_0x8324('0x40')],'accountcode':this[_0x8324('0x10')][_0x8324('0x41')],'dnid':this['channel'][_0x8324('0x42')],'projectName':this[_0x8324('0x10')][_0x8324('0x3c')],'saveName':_0x38c03c,'filename':_0x2894ca[_0x8324('0x43')]||_0x38c03c,'savePath':_0x5823bf})[_0x8324('0x15')](function(_0x51cf35){_0x2d7730(null,_0x51cf35);})[_0x8324('0x19')](function(_0xddba62){_0x2d7730(_0xddba62);});};AGIVertices['prototype']['createSquareMessage']=function(_0x280be7,_0x51411b,_0x529f44,_0x2bafed,_0x1409ca){this['rpc'][_0x8324('0x44')]({'uniqueid':this['channel']['uniqueid'],'body':_0x280be7,'direction':_0x51411b,'providerName':_0x529f44,'providerResponse':_0x2bafed})[_0x8324('0x15')](function(_0x58ec7e){if(_0x1409ca){_0x1409ca(null,_0x58ec7e);}})[_0x8324('0x19')](function(_0x9ac697){if(_0x1409ca){_0x1409ca(_0x9ac697);}});};AGIVertices[_0x8324('0x17')][_0x8324('0x45')]=function(_0x4c2b56,_0x45aa4c){var _0x17459e=this;var _0x25850c=0x0;var _0x2808d4={'firstName':_[_0x8324('0x46')](_0x4c2b56[_0x8324('0x16')])||_['isNil'](_0x4c2b56['name'])?_0x8324('0x47')+Math[_0x8324('0x48')]():_0x4c2b56[_0x8324('0x16')],'lastName':_[_0x8324('0x46')](_0x4c2b56[_0x8324('0x49')])||_[_0x8324('0x4a')](_0x4c2b56['lastName'])?null:_0x4c2b56[_0x8324('0x49')],'phone':_0x4c2b56[_0x8324('0x4b')],'ListId':_0x4c2b56[_0x8324('0x4c')],'scheduledat':_0x4c2b56[_0x8324('0x4d')],'callbackUniqueid':this[_0x8324('0x10')][_0x8324('0x3a')],'tags':_0x8324('0x4e'),'description':'Callback\x20scheduled\x20at\x20'+_0x4c2b56[_0x8324('0x4d')][_0x8324('0x4f')](),'priority':_0x4c2b56[_0x8324('0x50')]};if(_['has'](_0x4c2b56,_0x8324('0x51'))){if(!_['isNil'](_0x4c2b56[_0x8324('0x51')])){var _0xf5fd1e=_0x4c2b56[_0x8324('0x51')];if(_0x4c2b56[_0x8324('0x51')]==_0x8324('0x52')){this['rpc'][_0x8324('0x53')]({'phone':_0x4c2b56[_0x8324('0x4b')]})[_0x8324('0x15')](function(_0x3e9fda){if(!_[_0x8324('0x4a')](_0x3e9fda)){var _0x237ad2=_0x3e9fda['dialTimezone'];if(!_[_0x8324('0x4a')](_0x237ad2)){var _0x3d75a5=shared[_0x8324('0x54')][_0x237ad2];if(!_[_0x8324('0x4a')](_0x3d75a5)){var _0x5400d8=-0x1*_0x3d75a5['utcOffset'];_0x2808d4['scheduledat']=moment(_0x4c2b56[_0x8324('0x55')])[_0x8324('0x56')](_0x5400d8,'minutes');_0x17459e['insertContact'](_0x2808d4,_0x4c2b56,_0x45aa4c);}else{_0x17459e[_0x8324('0x57')](_0x2808d4,_0x4c2b56,_0x45aa4c);}}else{_0x17459e[_0x8324('0x57')](_0x2808d4,_0x4c2b56,_0x45aa4c);}}else{_0x17459e[_0x8324('0x57')](_0x2808d4,_0x4c2b56,_0x45aa4c);}});}else{var _0x25850c=shared[_0x8324('0x54')][_0xf5fd1e];if(!_[_0x8324('0x4a')](_0x25850c)){var _0x4defd9=-0x1*_0x25850c[_0x8324('0x58')];_0x2808d4[_0x8324('0x55')]=moment(_0x4c2b56[_0x8324('0x55')])[_0x8324('0x56')](_0x4defd9,_0x8324('0x59'));_0x17459e[_0x8324('0x57')](_0x2808d4,_0x4c2b56,_0x45aa4c);}else{_0x17459e[_0x8324('0x57')](_0x2808d4,_0x4c2b56,_0x45aa4c);}}}else{_0x17459e[_0x8324('0x57')](_0x2808d4,_0x4c2b56,_0x45aa4c);}}else{_0x17459e[_0x8324('0x57')](_0x2808d4,_0x4c2b56,_0x45aa4c);}};AGIVertices[_0x8324('0x17')][_0x8324('0x5a')]=function(_0x186eb7,_0x5766f4){this[_0x8324('0x11')]['getPauseById'](_0x186eb7)[_0x8324('0x15')](function(_0x8c616f){_0x5766f4(null,_0x8c616f?_0x8c616f['name']:![]);})['catch'](function(_0x2ca786){_0x5766f4(_0x2ca786);});};AGIVertices[_0x8324('0x17')][_0x8324('0x5b')]=function(_0x361d21,_0x42fae7,_0x47b3f9){var _0x5d5f99={'role':_0x8324('0x5c')};_0x5d5f99[_0x361d21]=this['channel'][_0x8324('0x3d')];this['rpc'][_0x8324('0x5b')](_0x5d5f99,_0x42fae7,this[_0x8324('0x10')][_0x8324('0x3a')])[_0x8324('0x15')](function(_0x70021f){_0x47b3f9(null,_['isNil'](_0x70021f)?![]:!![]);})[_0x8324('0x19')](function(_0x12ae7b){logger['error'](_0x12ae7b);_0x47b3f9(null,![]);});};AGIVertices[_0x8324('0x17')]['agentUnpause']=function(_0x2e6475,_0x47a320){var _0x40f878={'role':_0x8324('0x5c')};_0x40f878[_0x2e6475]=this[_0x8324('0x10')][_0x8324('0x3d')];this[_0x8324('0x11')][_0x8324('0x5d')](_0x40f878)['then'](function(_0x396b77){_0x47a320(null,_[_0x8324('0x4a')](_0x396b77)?![]:!![]);})[_0x8324('0x19')](function(_0x50155d){logger[_0x8324('0x2e')](_0x50155d);_0x47a320(null,![]);});};AGIVertices[_0x8324('0x17')][_0x8324('0x5e')]=function(_0x3b9718,_0x420c90){var _0x1f3594={'role':_0x8324('0x5c')};_0x1f3594[_0x3b9718]=this['channel'][_0x8324('0x3d')];this[_0x8324('0x11')][_0x8324('0x5e')](_0x1f3594)[_0x8324('0x15')](function(_0x4e04ad){_0x420c90(null,_[_0x8324('0x4a')](_0x4e04ad)?![]:!![]);})[_0x8324('0x19')](function(_0x3051da){logger['error'](_0x3051da);_0x420c90(null,![]);});};AGIVertices['prototype'][_0x8324('0x5f')]=function(_0x43216b,_0x2fe3a1){var _0x358eb7={'role':_0x8324('0x5c')};_0x358eb7[_0x43216b]=this[_0x8324('0x10')][_0x8324('0x3d')];var _0x536329=_0x43216b!=_0x8324('0x60')?util[_0x8324('0x61')]('%s/%s@from-sip/n',_0x8324('0x62'),this[_0x8324('0x10')][_0x8324('0x3d')]):undefined;this[_0x8324('0x11')][_0x8324('0x5f')](_0x358eb7,_0x536329)[_0x8324('0x15')](function(_0x248d6d){_0x2fe3a1(null,_[_0x8324('0x4a')](_0x248d6d)?![]:!![]);})['catch'](function(_0x4b1172){logger[_0x8324('0x2e')](_0x4b1172);_0x2fe3a1(null,![]);});};AGIVertices[_0x8324('0x17')][_0x8324('0x63')]=function(_0x3f0312,_0x595ddd){sh[_0x8324('0x64')](_['trim'](_0x3f0312),function(_0x5875b7,_0x3942d1){var _0x169172=_0x3942d1[_0x8324('0x65')](/(\r\n|\n|\r)/gm,'');_0x595ddd(null,_0x169172);});};AGIVertices[_0x8324('0x17')]['googleCloudTTS']=function(_0x185417,_0x4c0e76){scripts[_0x8324('0x66')](_0x185417[_0x8324('0x67')],_0x185417[_0x8324('0x68')]||'text',_0x185417['text'],_0x185417[_0x8324('0x69')]||_0x8324('0x6a'),_0x185417[_0x8324('0x6b')]||'MALE',_0x185417[_0x8324('0x6c')]||_0x8324('0x6d'))[_0x8324('0x15')](function(_0x19dc3f){_0x4c0e76(null,_0x19dc3f);})['catch'](function(_0x4a382d){_0x4c0e76(_0x4a382d);});};AGIVertices[_0x8324('0x17')][_0x8324('0x6e')]=function(_0x23c675,_0x4ec128){scripts[_0x8324('0x6e')](_0x23c675[_0x8324('0x6f')],_0x23c675[_0x8324('0x70')]||'en',0x1)[_0x8324('0x15')](function(_0x420922){_0x4ec128(null,_0x420922);})[_0x8324('0x19')](function(_0x57600d){_0x4ec128(_0x57600d);});};AGIVertices['prototype'][_0x8324('0x71')]=function(_0x3625b6,_0x4a5996){var _0x55648c={'uri':_0x3625b6['url'],'method':_0x3625b6[_0x8324('0x72')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x3625b6[_0x8324('0x73')])===_0x8324('0x74')&&parseInt(_0x3625b6[_0x8324('0x73')])>=0x1?parseInt(_0x3625b6[_0x8324('0x73')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x8324('0x75'),_0x8324('0x76')],_0x55648c[_0x8324('0x72')][_0x8324('0x77')]())){try{_0x55648c[_0x8324('0x78')]=_0x3625b6['rawBody']?JSON[_0x8324('0x79')](_0x3625b6['rawBody']):{};}catch(_0x4584a7){logger[_0x8324('0x2e')](_0x8324('0x7a'),_0x4584a7);}}try{_0x55648c[_0x8324('0x7b')]=_0x3625b6['rawHeaders']?JSON[_0x8324('0x79')](_0x3625b6['rawHeaders']):{};}catch(_0x1c87d3){logger[_0x8324('0x2e')](_0x8324('0x7c'),_0x1c87d3);}if(_0x3625b6[_0x8324('0x7d')]){try{var _0x2a588d=require(_0x3625b6[_0x8324('0x7d')])[_0x8324('0x7e')](this,_0x55648c);_0x55648c[_0x8324('0x7f')]=Mustache[_0x8324('0x80')](_0x3625b6['url'],_0x2a588d,{},['$$','$$']);if(_0x55648c[_0x8324('0x7b')]){_0x55648c[_0x8324('0x7b')]=JSON['parse'](Mustache[_0x8324('0x80')](JSON[_0x8324('0x81')](_0x55648c['headers']),_0x2a588d,{},['$$','$$']));}if(_0x55648c['body']){_0x55648c[_0x8324('0x78')]=JSON[_0x8324('0x79')](Mustache[_0x8324('0x80')](JSON['stringify'](_0x55648c[_0x8324('0x78')]),_0x2a588d,{},['$$','$$']));}}catch(_0x5a13c6){logger[_0x8324('0x2e')](_0x8324('0x82'),_0x5a13c6);}}rp(_0x55648c)['then'](function(_0x261438){var _0x495638={'statusCode':_0x261438[_0x8324('0x83')]||0xc8,'statusMessage':_0x261438[_0x8324('0x84')]||'OK','headers':_0x261438[_0x8324('0x7b')]||{},'body':_0x261438[_0x8324('0x78')]||{}};_0x4a5996(null,_0x495638);})[_0x8324('0x19')](function(_0x59d4fa){var _0x58c5d6={'statusCode':_0x59d4fa[_0x8324('0x83')]||0x1f4,'statusMessage':_0x59d4fa[_0x8324('0x85')]||_0x8324('0x86'),'headers':_0x59d4fa[_0x8324('0x87')][_0x8324('0x7b')]||{},'body':_0x59d4fa['options'][_0x8324('0x78')]||{}};_0x4a5996(null,_0x58c5d6);});};AGIVertices[_0x8324('0x17')][_0x8324('0x88')]=function(_0x3f364f,_0x575bee){scripts[_0x8324('0x88')](this[_0x8324('0x10')][_0x8324('0x3a')],_0x3f364f[_0x8324('0x89')],_0x3f364f['text'],_0x3f364f['dialogflow_language']||'en')['then'](function(_0x6f6810){_0x575bee(null,_0x6f6810);})[_0x8324('0x19')](function(_0xde1545){_0x575bee(_0xde1545);});};AGIVertices[_0x8324('0x17')][_0x8324('0x8a')]=function(_0x412c24,_0x40e614){scripts[_0x8324('0x8a')](this[_0x8324('0x10')][_0x8324('0x3a')],_0x412c24['dialogflowV2_project_id'],_0x412c24[_0x8324('0x8b')],_0x412c24[_0x8324('0x8c')],_0x412c24['text'],_0x412c24[_0x8324('0x8d')]||'en')[_0x8324('0x15')](function(_0x545532){_0x40e614(null,_0x545532);})[_0x8324('0x19')](function(_0x1ed34c){_0x40e614(_0x1ed34c);});};AGIVertices[_0x8324('0x17')][_0x8324('0x8e')]=function(_0x3eeb6f,_0x2c48f0){scripts[_0x8324('0x8e')](this['channel'],_0x3eeb6f)[_0x8324('0x15')](function(_0x528f67){_0x2c48f0(null,_0x528f67);})[_0x8324('0x19')](function(_0x586066){_0x2c48f0(_0x586066);});};AGIVertices[_0x8324('0x17')][_0x8324('0x8f')]=function(_0x5d0985,_0x47a87c){scripts[_0x8324('0x8f')](_0x5d0985[_0x8324('0x89')],_0x5d0985['text'],_0x5d0985[_0x8324('0x90')]||_0x8324('0x6a'),_0x5d0985[_0x8324('0x91')])[_0x8324('0x15')](function(_0x16a344){_0x47a87c(null,_0x16a344);})[_0x8324('0x19')](function(_0x5b78b3){_0x47a87c(_0x5b78b3);});};AGIVertices[_0x8324('0x17')][_0x8324('0x92')]=function(_0x47e917,_0x487604,_0x239029){scripts[_0x8324('0x92')](_0x487604,_0x47e917[_0x8324('0x89')],_0x47e917['ispeech_asr_language']||_0x8324('0x6a'),this[_0x8324('0x93')](_0x47e917[_0x8324('0x94')])?_0x47e917[_0x8324('0x94')]:undefined)['then'](function(_0x1a8645){_0x239029(null,_0x1a8645);})[_0x8324('0x19')](function(_0x42911b){_0x239029(_0x42911b);});};AGIVertices['prototype'][_0x8324('0x95')]=function(_0x564c31,_0x421659){scripts['awsPolly'](_0x564c31['aws_access_key_id'],_0x564c31[_0x8324('0x96')],_0x564c31[_0x8324('0x97')],_0x564c31['aws_polly_voice']||_0x8324('0x98'),_0x564c31['text'],_0x564c31[_0x8324('0x99')]||_0x8324('0x6f'))[_0x8324('0x15')](function(_0x139a9a){_0x421659(null,_0x139a9a);})[_0x8324('0x19')](function(_0x2a0c40){_0x421659(_0x2a0c40);});};AGIVertices[_0x8324('0x17')][_0x8324('0x9a')]=function(_0x73384b,_0x20eeaa){scripts[_0x8324('0x9a')](this[_0x8324('0x10')][_0x8324('0x3a')],_0x73384b[_0x8324('0x9b')],_0x73384b[_0x8324('0x96')],_0x73384b['aws_lex_region'],_0x73384b[_0x8324('0x6f')],_0x73384b['aws_bot_name'])['then'](function(_0x3bf44e){_0x20eeaa(null,_0x3bf44e);})[_0x8324('0x19')](function(_0x52c1ef){_0x20eeaa(_0x52c1ef);});};AGIVertices[_0x8324('0x17')]['googleASR']=function(_0x3aad6e,_0xf235f6,_0x5da58f){scripts[_0x8324('0x9c')](_0xf235f6,_0x3aad6e['key'],_0x3aad6e['google_asr_language']||'en-US')['then'](function(_0x3ce518){_0x5da58f(null,_0x3ce518);})[_0x8324('0x19')](function(_0x194f34){_0x5da58f(_0x194f34);});};AGIVertices['prototype']['tildeASR']=function(_0x5c90f5,_0x3a47f1,_0x5b547b){scripts[_0x8324('0x9d')](_0x3a47f1,_0x5c90f5[_0x8324('0x9e')],_0x5c90f5[_0x8324('0x9f')],_0x5c90f5[_0x8324('0x7f')])['then'](function(_0xf59d2f){_0x5b547b(null,_0xf59d2f);})[_0x8324('0x19')](function(_0x351fd7){_0x5b547b(_0x351fd7);});};AGIVertices[_0x8324('0x17')][_0x8324('0xa0')]=function(_0x13c47c){var _0x42e1dd=_['includes'](verticesWithRetry,_0x13c47c['agicommand'])?_0x13c47c:_[_0x8324('0xa1')](_0x13c47c);for(var _0x429992 in _0x42e1dd){if(_0x42e1dd['hasOwnProperty'](_0x429992)){if(_0x42e1dd[_0x429992]&&_[_0x8324('0xa2')](_0x42e1dd[_0x429992])){if(_['includes'](recursiveMapAttributes,_0x429992)){_0x42e1dd[_0x429992]=this[_0x8324('0xa3')](_0x42e1dd[_0x429992]);}else{_0x42e1dd[_0x429992]=this[_0x8324('0xa4')](_0x42e1dd[_0x429992]);}}}}return _0x42e1dd;};AGIVertices['prototype'][_0x8324('0xa5')]=function(_0x501275){for(var _0x44c9da in _0x501275){if(_0x501275['hasOwnProperty'](_0x44c9da)){if(_['isPlainObject'](_0x501275[_0x44c9da])){this['recursiveNodeIndex'](_0x501275[_0x44c9da]);}else if(_[_0x8324('0xa6')](_0x501275[_0x44c9da])){for(var _0xb8a171=0x0;_0xb8a171<_0x501275[_0x44c9da]['length'];_0xb8a171++){this[_0x8324('0xa5')](_0x501275[_0x44c9da][_0xb8a171]);}}else if(_[_0x8324('0xa2')](_0x501275[_0x44c9da])){_0x501275[_0x44c9da]=this['replaceAllVariables'](_0x501275[_0x44c9da]);}}}};AGIVertices[_0x8324('0x17')]['saveRestApiResult']=function(_0x2e2196,_0x20e047){for(var _0x2321eb in _0x2e2196){if(_0x2e2196['hasOwnProperty'](_0x2321eb)){if(_[_0x8324('0xa7')](_0x2e2196[_0x2321eb])){if(!_[_0x8324('0x46')](_0x2e2196[_0x2321eb])){this['saveRestApiResult'](_0x2e2196[_0x2321eb],util[_0x8324('0x61')]('%s.%s',_0x20e047,_0x2321eb));}}else if(_[_0x8324('0xa6')](_0x2e2196[_0x2321eb])){for(var _0xc9f71c=0x0;_0xc9f71c<_0x2e2196[_0x2321eb][_0x8324('0xa8')];_0xc9f71c++){this[_0x8324('0xa9')](_0x2e2196[_0x2321eb][_0xc9f71c],util[_0x8324('0x61')](_0x8324('0xaa'),_0x20e047,_0x2321eb+'['+_0xc9f71c+']'));}}else{if(!_[_0x8324('0x4a')](_0x2e2196[_0x2321eb])){this[_0x8324('0x10')][_0x8324('0xab')](util[_0x8324('0x61')](_0x8324('0xaa'),_0x20e047,_0x2321eb),_0x2e2196[_0x2321eb]);}}}}};AGIVertices[_0x8324('0x17')][_0x8324('0xa3')]=function(_0x1cd3a0){try{var _0x3ef6e0=JSON['parse'](_0x1cd3a0);this[_0x8324('0xa5')](_0x3ef6e0);return JSON[_0x8324('0x81')](_0x3ef6e0);}catch(_0x1e733d){return this[_0x8324('0xa4')](_0x1cd3a0);}};AGIVertices[_0x8324('0x17')][_0x8324('0xa4')]=function(_0x22d387){var _0x106a56=_0x22d387[_0x8324('0xac')]('{');for(var _0x38421b=0x1;_0x38421b<_0x106a56['length'];_0x38421b+=0x1){var _0x40d514=_0x106a56[_0x38421b]['split']('}');if(_0x40d514[_0x8324('0xa8')]>0x1){_0x22d387=_0x22d387[_0x8324('0xad')]('{'+_0x40d514[0x0]+'}',this['channel'][_0x8324('0x13')](_0x40d514[0x0])[_0x8324('0xae')]||_0x40d514[0x0]);}}if(_0x106a56['length']===0x1){return _0x22d387[_0x8324('0x4f')]();}return this[_0x8324('0xa4')](_0x22d387);};AGIVertices[_0x8324('0x17')][_0x8324('0xaf')]=function(_0x26bf55,_0x325f2f){var _0x3c470c=this[_0x8324('0x10')]['getVariable'](_0x26bf55);if(_0x3c470c[_0x8324('0xb0')]===-0x1){return _0x3c470c;}logger[_0x8324('0x30')](util[_0x8324('0x61')](_0x8324('0xb1'),_0x325f2f,_0x3c470c[_0x8324('0xae')]));return this['channel'][_0x8324('0xab')](_0x325f2f,_0x3c470c[_0x8324('0xae')]);};AGIVertices[_0x8324('0x17')][_0x8324('0x93')]=function(_0x1c33dc){return _0x1c33dc&&_0x1c33dc!=='0'&&_0x1c33dc!=='-1'&&_0x1c33dc!=='';};AGIVertices[_0x8324('0x17')][_0x8324('0xb2')]=function(_0x19215b){this[_0x8324('0x39')][_0x8324('0x7e')](this,_0x19215b,'-');_0x19215b[_0x8324('0xb3')]=_0x19215b[_0x8324('0xb2')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x8324('0x17')][_0x8324('0xb4')]=function(_0x53a3d8){logger[_0x8324('0x30')](util['format'](_0x8324('0xb5'),_0x53a3d8['label']));if(!this[_0x8324('0x93')](_0x53a3d8[_0x8324('0x6f')])){return this[_0x8324('0x10')]['noop']('no\x20text\x20configured');}var _0x33b09b='\x22'+_0x53a3d8['text']+'\x22';if(this[_0x8324('0x93')](_0x53a3d8[_0x8324('0x87')])){_0x33b09b+=','+_0x53a3d8[_0x8324('0x87')];}var _0x3449da=this[_0x8324('0x10')][_0x8324('0x64')](_0x8324('0xb6'),_0x33b09b);if(_0x3449da[_0x8324('0xb0')]===-0x1){return _0x3449da;}return this['channel'][_0x8324('0xb7')](util[_0x8324('0x61')](_0x8324('0xb8'),_0x33b09b));};AGIVertices[_0x8324('0x17')]['mrcprecog']=function(_0x1072c2){logger[_0x8324('0x30')](util[_0x8324('0x61')](_0x8324('0xb9'),_0x1072c2[_0x8324('0x3b')]));if(!this['isConfigured'](_0x1072c2[_0x8324('0xba')])){return this[_0x8324('0x10')][_0x8324('0xb7')](_0x8324('0xbb'));}var _0x578325=_0x1072c2['grammar'];if(this['isConfigured'](_0x1072c2[_0x8324('0x87')])){_0x578325+=','+_0x1072c2[_0x8324('0x87')];}var _0x16f5a1=this['channel'][_0x8324('0x64')](_0x8324('0xbc'),_0x578325);if(_0x16f5a1['result']===-0x1){return _0x16f5a1;}var _0x2ce7ef=this['getAndSetVariable'](_0x8324('0xbd'),_0x8324('0xbe'));if(_0x2ce7ef[_0x8324('0xb0')]===-0x1){return _0x2ce7ef;}var _0x255bbe=this['getAndSetVariable'](_0x8324('0xbf'),_0x8324('0xc0'));if(_0x255bbe['result']===-0x1){return _0x255bbe;}var _0x4cc944=this[_0x8324('0xaf')]('RECOG_INSTANCE()',_0x8324('0xc1'));if(_0x4cc944[_0x8324('0xb0')]===-0x1){return _0x4cc944;}return this['channel']['noop'](util[_0x8324('0x61')](_0x8324('0xc2'),_0x578325));};AGIVertices['prototype'][_0x8324('0x8')]=function(_0x268f8a){logger[_0x8324('0x30')](util[_0x8324('0x61')](_0x8324('0xc3'),_0x268f8a[_0x8324('0x3b')]));return this[_0x8324('0x10')]['agi']([_0x268f8a['command'],_0x268f8a[_0x8324('0xc4')]]);};AGIVertices[_0x8324('0x17')][_0x8324('0xc5')]=function(_0x28478d){logger[_0x8324('0x30')](util[_0x8324('0x61')](_0x8324('0xc6'),_0x28478d['label']));if(this[_0x8324('0x93')](_0x28478d['timeout'])){logger[_0x8324('0x30')](util[_0x8324('0x61')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x28478d[_0x8324('0x73')]));var _0x58d281=this[_0x8324('0x10')][_0x8324('0xc7')](_0x28478d[_0x8324('0x73')]);if(_0x58d281[_0x8324('0xb0')]===-0x1){return _0x58d281;}}return this[_0x8324('0x10')][_0x8324('0xc5')]();};AGIVertices[_0x8324('0x17')]['callback']=function(_0x434840){logger['info'](util[_0x8324('0x61')](_0x8324('0xc8'),_0x434840['label']));if(!this[_0x8324('0x93')](_0x434840['list_id'])){return this['channel'][_0x8324('0x2e')](_0x434840,'no\x20list\x20selected');}_0x434840[_0x8324('0x4d')]=moment();if(this[_0x8324('0x93')](_0x434840[_0x8324('0xc9')])){_0x434840[_0x8324('0x4d')]=moment()[_0x8324('0x56')](_0x434840[_0x8324('0xc9')],_0x8324('0x59'));}if(!this['isConfigured'](_0x434840[_0x8324('0x50')])){_0x434840['callback_priority']=0x2;}this['createCmContact'][_0x8324('0x7e')](this,_0x434840);return this[_0x8324('0x10')][_0x8324('0xb7')](util[_0x8324('0x61')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x434840[_0x8324('0x4b')],_0x434840['list_id'],_0x434840['scheduledAt']));};AGIVertices[_0x8324('0x17')]['custom_app']=function(_0x19e966){logger[_0x8324('0x30')](util['format'](_0x8324('0xca'),_0x19e966[_0x8324('0x3b')]));var _0x4945b4=this[_0x8324('0x10')][_0x8324('0x64')](_0x19e966['application'],_0x19e966[_0x8324('0x87')]);if(_0x4945b4[_0x8324('0xb0')]===-0x1){return _0x4945b4;}return this[_0x8324('0x10')][_0x8324('0xb7')](util[_0x8324('0x61')](_0x8324('0xcb'),_0x19e966[_0x8324('0xcc')],_0x19e966[_0x8324('0x87')]));};AGIVertices[_0x8324('0x17')][_0x8324('0xcd')]=function(_0x5b6d20){logger[_0x8324('0x30')](util[_0x8324('0x61')](_0x8324('0xce'),_0x5b6d20[_0x8324('0x3b')]));if(!this['isConfigured'](_0x5b6d20[_0x8324('0x6f')])){return this[_0x8324('0x10')][_0x8324('0xb7')]('no\x20text\x20configured');}var _0x4947ee='\x22'+_0x5b6d20[_0x8324('0x6f')]+'\x22';if(this[_0x8324('0x93')](_0x5b6d20['options'])){_0x4947ee+=','+_0x5b6d20[_0x8324('0x87')];}var _0x567541=this['channel'][_0x8324('0x64')]('MRCPSynth',_0x4947ee);if(_0x567541[_0x8324('0xb0')]===-0x1){return _0x567541;}return this[_0x8324('0x10')][_0x8324('0xb7')](util['format'](_0x8324('0xb8'),_0x4947ee));};AGIVertices[_0x8324('0x17')][_0x8324('0xcf')]=function(_0x10397a){logger[_0x8324('0x30')](util[_0x8324('0x61')](_0x8324('0xd0'),_0x10397a[_0x8324('0x3b')]));if(!this[_0x8324('0x93')](_0x10397a[_0x8324('0x6f')])){return this['channel'][_0x8324('0xb7')](_0x8324('0xd1'));}var _0x340e6c='\x22'+_0x10397a['text']+'\x22';if(this[_0x8324('0x93')](_0x10397a[_0x8324('0x87')])){_0x340e6c+=','+_0x10397a['options'];}var _0x22bd18=this[_0x8324('0x10')][_0x8324('0x64')](_0x8324('0xb6'),_0x340e6c);if(_0x22bd18[_0x8324('0xb0')]===-0x1){return _0x22bd18;}return this[_0x8324('0x10')][_0x8324('0xb7')](util[_0x8324('0x61')]('Executed\x20command\x20MRCPSynth\x20%s',_0x340e6c));};AGIVertices[_0x8324('0x17')][_0x8324('0xd2')]=function(_0x3f5e19){logger[_0x8324('0x30')](util['format']('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x3f5e19['label']));if(!this[_0x8324('0x93')](_0x3f5e19[_0x8324('0xba')])){return this[_0x8324('0x10')][_0x8324('0xb7')]('no\x20grammar\x20configured');}var _0x4277ee=_0x3f5e19[_0x8324('0xba')];if(this['isConfigured'](_0x3f5e19[_0x8324('0x87')])){_0x4277ee+=','+_0x3f5e19['options'];}var _0x1cf3ef=this[_0x8324('0x10')][_0x8324('0x64')](_0x8324('0xbc'),_0x4277ee);if(_0x1cf3ef[_0x8324('0xb0')]===-0x1){return _0x1cf3ef;}var _0x4e6ed1=this[_0x8324('0xaf')](_0x8324('0xbd'),_0x8324('0xd3'));if(_0x4e6ed1['result']===-0x1){return _0x4e6ed1;}var _0x593a4b=this[_0x8324('0xaf')](_0x8324('0xbf'),_0x8324('0xd4'));if(_0x593a4b[_0x8324('0xb0')]===-0x1){return _0x593a4b;}var _0x12db0b=this[_0x8324('0xaf')](_0x8324('0xd5'),_0x8324('0xd6'));if(_0x12db0b[_0x8324('0xb0')]===-0x1){return _0x12db0b;}return this[_0x8324('0x10')][_0x8324('0xb7')](util[_0x8324('0x61')]('Executed\x20command\x20MRCPRecog\x20%s',_0x4277ee));};AGIVertices[_0x8324('0x17')]['sestekasr']=function(_0x4a2d34){logger[_0x8324('0x30')](util[_0x8324('0x61')](_0x8324('0xd7'),_0x4a2d34['label']));if(!this[_0x8324('0x93')](_0x4a2d34['grammar'])){return this['channel'][_0x8324('0xb7')](_0x8324('0xbb'));}var _0x1b263f=_0x4a2d34['grammar'];if(this['isConfigured'](_0x4a2d34[_0x8324('0x87')])){_0x1b263f+=','+_0x4a2d34['options'];}var _0x365b4e=this['channel'][_0x8324('0x64')](_0x8324('0xbc'),_0x1b263f);if(_0x365b4e[_0x8324('0xb0')]===-0x1){return _0x365b4e;}var _0xe4a5d2=this[_0x8324('0xaf')]('RECOG_CONFIDENCE()',_0x8324('0xd8'));if(_0xe4a5d2[_0x8324('0xb0')]===-0x1){return _0xe4a5d2;}var _0x9d306d=this[_0x8324('0xaf')](_0x8324('0xbf'),'SESTEK_ASR_TRANSCRIPT');if(_0x9d306d[_0x8324('0xb0')]===-0x1){return _0x9d306d;}var _0x54cbb0=this[_0x8324('0xaf')](_0x8324('0xd5'),'SESTEK_ASR_INSTANCE');if(_0x54cbb0[_0x8324('0xb0')]===-0x1){return _0x54cbb0;}return this[_0x8324('0x10')][_0x8324('0xb7')](util[_0x8324('0x61')](_0x8324('0xc2'),_0x1b263f));};AGIVertices[_0x8324('0x17')][_0x8324('0xd9')]=function(_0x3fea0b){logger[_0x8324('0x30')](util[_0x8324('0x61')](_0x8324('0xda'),_0x3fea0b[_0x8324('0x3b')]));if(!this[_0x8324('0x93')](_0x3fea0b['odbc_id'])){return this['channel']['error'](_0x3fea0b,_0x8324('0xdb'));}var _0x480758=this[_0x8324('0x1a')]['sync'](this,_0x3fea0b[_0x8324('0xdc')]);if(!_0x480758){return this[_0x8324('0x10')][_0x8324('0x2e')](_0x3fea0b,_0x8324('0xdd'));}if(!this[_0x8324('0x93')](_0x3fea0b['query'])){return this[_0x8324('0x10')]['error'](_0x3fea0b,_0x8324('0xde'));}var _0xba0383=_0x3fea0b['query'][_0x8324('0x65')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x8324('0xb7')](util[_0x8324('0x61')](_0x8324('0xdf'),_0xba0383));var _0x1acbd3=this[_0x8324('0x2c')][_0x8324('0x7e')](this,_0x480758,_0xba0383);this['createSquareDetailsReport'][_0x8324('0x7e')](this,_0x3fea0b,_0xba0383);if(!this[_0x8324('0x93')](_0x3fea0b['variable_id'])){return this['channel'][_0x8324('0xb7')](_0x8324('0xe0'));}var _0x59daf4=this['getVariable'][_0x8324('0x7e')](this,_0x3fea0b[_0x8324('0xe1')]);if(!_0x59daf4){return this[_0x8324('0x10')][_0x8324('0x2e')](_0x3fea0b,_0x8324('0xe2'));}var _0x32024c=this;_0x1acbd3[_0x8324('0xe3')](function(_0x5621f7,_0x307c11){Object[_0x8324('0xe4')](_0x5621f7)['forEach'](function(_0x154b9f){_0x32024c[_0x8324('0x10')][_0x8324('0xab')](util[_0x8324('0x61')](_0x8324('0xe5'),_0x59daf4,_0x307c11,_0x154b9f),_0x5621f7[_0x154b9f]);});});this[_0x8324('0x10')][_0x8324('0xab')](util['format'](_0x8324('0xe6'),_0x59daf4),_0x1acbd3[_0x8324('0xa8')]);return this[_0x8324('0x10')][_0x8324('0xb7')](util['format'](_0x8324('0xe7'),_0x59daf4));};AGIVertices[_0x8324('0x17')][_0x8324('0xe8')]=function(_0x40fefa){logger[_0x8324('0xe9')](util[_0x8324('0x61')](_0x8324('0xea'),_0x40fefa[_0x8324('0x3b')]));if(!this[_0x8324('0x93')](_0x40fefa[_0x8324('0xeb')])){return this[_0x8324('0x10')][_0x8324('0x2e')](_0x40fefa,_0x8324('0xec'));}var _0x358b0e=this['getUser'][_0x8324('0x7e')](this,_0x40fefa[_0x8324('0xeb')]);if(!_0x358b0e){return this['channel'][_0x8324('0x2e')](_0x40fefa,_0x8324('0xed'));}var _0x2ff03a=this[_0x8324('0x10')][_0x8324('0x64')]('DIAL',[util[_0x8324('0x61')]('SIP/%s',_0x358b0e),_0x40fefa[_0x8324('0x73')],_0x40fefa['opts'],_0x40fefa['url']]);if(_0x2ff03a[_0x8324('0xb0')]===-0x1){return _0x2ff03a;}return this['channel']['noop'](util['format'](_0x8324('0xee'),_0x8324('0xef')));};AGIVertices[_0x8324('0x17')][_0x8324('0xf0')]=function(_0xc77939){logger[_0x8324('0x30')](util[_0x8324('0x61')](_0x8324('0xf1'),_0xc77939[_0x8324('0x3b')]));if(!this[_0x8324('0x93')](_0xc77939[_0x8324('0x89')])){return this[_0x8324('0x10')][_0x8324('0xb7')](_0x8324('0xf2'));}if(!this[_0x8324('0x93')](_0xc77939['text'])){return this['channel'][_0x8324('0xb7')](_0x8324('0xd1'));}this[_0x8324('0x10')]['bot']=!![];this[_0x8324('0x39')](_0xc77939);this[_0x8324('0x44')](_0xc77939['text'],'in','','');this[_0x8324('0x10')][_0x8324('0xb7')](util[_0x8324('0x61')](_0x8324('0xf3'),_0xc77939['text']));var _0xf3ae7e=this[_0x8324('0x88')][_0x8324('0x7e')](this,_0xc77939);if(_0xf3ae7e){for(var _0x42cce3 in _0xf3ae7e){if(_0xf3ae7e[_0x8324('0xf4')](_0x42cce3)){this[_0x8324('0x10')]['setVariable'](util[_0x8324('0x61')](_0x8324('0xf5'),_0x42cce3[_0x8324('0x77')]()),_0xf3ae7e[_0x42cce3]);}}this[_0x8324('0x44')](_0xf3ae7e[_0x8324('0xf6')],_0x8324('0xf7'),_0x8324('0xf0'),'');return this[_0x8324('0x10')]['noop'](util[_0x8324('0x61')](_0x8324('0xf8'),_0xf3ae7e[_0x8324('0xf6')]));}return this['channel'][_0x8324('0x2e')](_0xc77939,_0x8324('0xf9'));};AGIVertices[_0x8324('0x17')][_0x8324('0xfa')]=function(_0x4f8d4b){logger[_0x8324('0x30')](util[_0x8324('0x61')](_0x8324('0xfb'),_0x4f8d4b[_0x8324('0x3b')]));if(!this[_0x8324('0x93')](_0x4f8d4b[_0x8324('0xfc')])){return this['channel'][_0x8324('0xb7')](_0x8324('0xfd'));}if(!this['isConfigured'](_0x4f8d4b['client_email'])){return this[_0x8324('0x10')][_0x8324('0xb7')](_0x8324('0xfe'));}if(!this[_0x8324('0x93')](_0x4f8d4b['private_key'])){return this[_0x8324('0x10')][_0x8324('0xb7')](_0x8324('0xff'));}if(!this[_0x8324('0x93')](_0x4f8d4b[_0x8324('0x8d')])){return this[_0x8324('0x10')]['noop'](_0x8324('0x100'));}if(!this['isConfigured'](_0x4f8d4b['text'])){return this[_0x8324('0x10')]['noop'](_0x8324('0xd1'));}this[_0x8324('0x10')][_0x8324('0x101')]=!![];this[_0x8324('0x39')](_0x4f8d4b);this[_0x8324('0x44')](_0x4f8d4b[_0x8324('0x6f')],'in','','');this[_0x8324('0x10')][_0x8324('0xb7')](util[_0x8324('0x61')](_0x8324('0x102'),_0x4f8d4b[_0x8324('0x6f')]));var _0x38fbf6=this['googleDialogflowV2'][_0x8324('0x7e')](this,_0x4f8d4b);if(_0x38fbf6){for(var _0x4230d7 in _0x38fbf6){if(_0x38fbf6[_0x8324('0xf4')](_0x4230d7)){if(_0x4230d7!=='providerResponse'){this[_0x8324('0x10')][_0x8324('0xab')](util['format'](_0x8324('0xf5'),_0x4230d7[_0x8324('0x77')]()),_0x38fbf6[_0x4230d7]);}}}this['createSquareMessage'](_0x38fbf6['speech'],_0x8324('0xf7'),_0x8324('0xfa'),_0x38fbf6['providerResponse']);return this[_0x8324('0x10')][_0x8324('0xb7')](util[_0x8324('0x61')](_0x8324('0x103'),_0x38fbf6[_0x8324('0xf6')]));}return this[_0x8324('0x10')]['error'](_0x4f8d4b,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x8324('0x17')][_0x8324('0x104')]=function(_0x27d634){logger[_0x8324('0x30')](util[_0x8324('0x61')](_0x8324('0x105'),_0x27d634[_0x8324('0x3b')]));if(!this['isConfigured'](_0x27d634[_0x8324('0x106')])){return this[_0x8324('0x10')][_0x8324('0xb7')]('no\x20ndauth\x20url\x20configured');}if(!this['isConfigured'](_0x27d634['username'])){return this[_0x8324('0x10')][_0x8324('0xb7')]('no\x20username\x20configured');}if(!this[_0x8324('0x93')](_0x27d634[_0x8324('0x107')])){return this[_0x8324('0x10')][_0x8324('0xb7')](_0x8324('0x108'));}if(!this[_0x8324('0x93')](_0x27d634['ndassistant_url'])){return this[_0x8324('0x10')]['noop'](_0x8324('0xd1'));}this[_0x8324('0x10')][_0x8324('0x101')]=!![];this[_0x8324('0x39')](_0x27d634);this[_0x8324('0x44')](_0x27d634[_0x8324('0x6f')],'in','','');this[_0x8324('0x10')]['noop'](util[_0x8324('0x61')]('Trying\x20SestekNDA:\x20%s',_0x27d634[_0x8324('0x6f')]));var _0x2d9a91=this[_0x8324('0x8e')][_0x8324('0x7e')](this,_0x27d634);if(_0x2d9a91){for(var _0xb7d943 in _0x2d9a91){if(_0x2d9a91[_0x8324('0xf4')](_0xb7d943)){this[_0x8324('0x10')][_0x8324('0xab')](util[_0x8324('0x61')](_0x8324('0x109'),_0xb7d943[_0x8324('0x77')]()),_0x2d9a91[_0xb7d943]);}}this[_0x8324('0x44')](_0x2d9a91[_0x8324('0xf6')],_0x8324('0xf7'),_0x8324('0x104'),'');if(_0x2d9a91[_0x8324('0x10a')]){this[_0x8324('0x10')][_0x8324('0xb7')](util[_0x8324('0x61')](_0x8324('0x10b'),_0x2d9a91[_0x8324('0x10a')]));var _0x40d0c8=this['channel'][_0x8324('0x10c')](_0x2d9a91[_0x8324('0x10a')]);try{fs[_0x8324('0x10d')](_0x2d9a91[_0x8324('0x10a')]+_0x8324('0x10e'));}catch(_0x589074){logger[_0x8324('0x2e')](_0x589074);}return _0x40d0c8;}else{return this[_0x8324('0x10')][_0x8324('0xb7')](util[_0x8324('0x61')](_0x8324('0x10f'),_0x2d9a91[_0x8324('0xf6')]));}}return this[_0x8324('0x10')][_0x8324('0x2e')](_0x27d634,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x8324('0x17')]['end']=function(_0x2f3772){logger[_0x8324('0x30')](util['format'](_0x8324('0x110'),_0x2f3772['label']));return this['channel'][_0x8324('0xb7')]('end');};AGIVertices['prototype'][_0x8324('0x111')]=function(_0x472699){logger['info'](util['format'](_0x8324('0x112'),_0x472699[_0x8324('0x3b')]));var _0x2776ad='';if(_0x472699[_0x8324('0x113')]){if(!this[_0x8324('0x93')](_0x472699['trunk_id'])){return this['channel']['error'](_0x472699,_0x8324('0x114'));}else{var _0x4229ac=parseInt(_0x472699[_0x8324('0x113')],0xa);if(isNaN(_0x4229ac)){_0x2776ad=_0x472699['trunk_id'];}else{_0x2776ad=this[_0x8324('0x1e')][_0x8324('0x7e')](this,_0x472699[_0x8324('0x113')]);if(!_0x2776ad){return this[_0x8324('0x10')][_0x8324('0x2e')](_0x472699,_0x8324('0x115'));}}}}else if(_0x472699[_0x8324('0x116')]){_0x2776ad=_0x472699[_0x8324('0x116')];}else{return this[_0x8324('0x10')][_0x8324('0x2e')](_0x472699,'no\x20trunk\x20selected');}var _0xd762c4=this[_0x8324('0x10')][_0x8324('0x64')](_0x8324('0xef'),[util[_0x8324('0x61')](_0x8324('0x117'),_0x2776ad,_0x472699[_0x8324('0x4b')]),_0x472699[_0x8324('0x73')],_0x472699[_0x8324('0x118')],_0x472699['url']]);if(_0xd762c4['result']===-0x1){return _0xd762c4;}return this[_0x8324('0x10')][_0x8324('0xb7')](util['format'](_0x8324('0xee'),_0x8324('0xef')));};AGIVertices[_0x8324('0x17')]['finally']=function(_0x50e692){logger[_0x8324('0x30')](util[_0x8324('0x61')](_0x8324('0x119'),_0x50e692['label']));return this[_0x8324('0x10')]['noop']('finally');};AGIVertices[_0x8324('0x17')][_0x8324('0xe')]=function(_0x58baae){logger[_0x8324('0x30')](util[_0x8324('0x61')](_0x8324('0x11a'),_0x58baae['label']));if(_0x58baae[_0x8324('0xb3')]===0x0){return this[_0x8324('0xb2')](_0x58baae);}_0x58baae[_0x8324('0xb3')]-=0x1;if(!this[_0x8324('0x93')](_0x58baae[_0x8324('0x11b')])){return this['channel'][_0x8324('0x2e')](_0x58baae,'no\x20file\x20audio\x20selected');}var _0x5121fe=this[_0x8324('0x20')]['sync'](this,_0x58baae[_0x8324('0x11b')]);if(!_0x5121fe){return this[_0x8324('0x10')][_0x8324('0x2e')](_0x58baae,_0x8324('0x11c'));}if(!this[_0x8324('0x93')](_0x58baae[_0x8324('0xe1')])){return this[_0x8324('0x10')][_0x8324('0x2e')](_0x8324('0xe0'));}var _0x3f24c9=this[_0x8324('0x10')][_0x8324('0x11d')](_0x5121fe,_0x58baae[_0x8324('0x11e')],_0x58baae[_0x8324('0x11f')]);var _0x403162=_0x3f24c9[_0x8324('0xb0')]?_0x3f24c9[_0x8324('0xb0')][_0x8324('0x4f')]():'';logger[_0x8324('0x30')](_0x8324('0x120'),JSON[_0x8324('0x81')](_0x3f24c9));if(_0x3f24c9[_0x8324('0xb0')]===-0x1){this[_0x8324('0x39')][_0x8324('0x7e')](this,_0x58baae,_0x403162);return _0x3f24c9;}else if(_0x3f24c9['extra']===_0x8324('0x73')){_0x3f24c9['result']=_0x403162[_0x8324('0xa8')]>=parseInt(_0x58baae['mindigit'])?'x':'i';}else{_0x3f24c9[_0x8324('0xb0')]=_0x403162[_0x8324('0xa8')]>=parseInt(_0x58baae[_0x8324('0x121')])&&_0x403162[_0x8324('0xa8')]<=parseInt(_0x58baae[_0x8324('0x11f')])?'x':'i';}var _0x1c046c=this[_0x8324('0x13')][_0x8324('0x7e')](this,_0x58baae[_0x8324('0xe1')]);if(!_0x1c046c){return this[_0x8324('0x10')][_0x8324('0x2e')](_0x58baae,_0x8324('0xe2'));}this['channel'][_0x8324('0xab')](_0x1c046c,_0x403162);if(this[_0x8324('0x93')](_0x58baae['hiddendigitsnum'])){var _0x2ecb0e=parseInt(_0x58baae[_0x8324('0x122')],0xa);var _0x18dc17=rs[_0x8324('0x123')]({'charset':'*','length':_0x2ecb0e});var _0x24802b=_0x403162[_0x8324('0xa8')];if(_0x24802b>0x0){if(_0x24802b>_0x2ecb0e){this['createSquareDetailsReport'][_0x8324('0x7e')](this,_0x58baae,_0x58baae[_0x8324('0x124')]==='first'?_0x18dc17+_0x403162[_0x8324('0x125')](_0x2ecb0e):_0x403162['substr'](0x0,_0x24802b-_0x2ecb0e)+_0x18dc17);}else{this[_0x8324('0x39')][_0x8324('0x7e')](this,_0x58baae,rs[_0x8324('0x123')]({'charset':'*','length':_0x24802b}));}}else{this[_0x8324('0x39')][_0x8324('0x7e')](this,_0x58baae,'');}}else{this[_0x8324('0x39')][_0x8324('0x7e')](this,_0x58baae,_0x403162);}return _0x3f24c9;};AGIVertices[_0x8324('0x17')]['getsecretdigits']=function(_0x4ae3ef){logger[_0x8324('0x30')](util['format'](_0x8324('0x126'),_0x4ae3ef[_0x8324('0x3b')]));return this[_0x8324('0xe')](_0x4ae3ef);};AGIVertices[_0x8324('0x17')]['goal']=function(_0x2ef851){logger[_0x8324('0x30')](util['format']('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x2ef851['label']));this[_0x8324('0x39')][_0x8324('0x7e')](this,_0x2ef851,_0x2ef851[_0x8324('0x127')]);return this[_0x8324('0x10')][_0x8324('0xb7')](util[_0x8324('0x61')](_0x8324('0x128'),_0x2ef851[_0x8324('0x127')]));};AGIVertices['prototype'][_0x8324('0x129')]=function(_0x190690){logger[_0x8324('0x30')](util[_0x8324('0x61')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x190690[_0x8324('0x3b')]));if(!this[_0x8324('0x93')](_0x190690[_0x8324('0x9b')])||!this[_0x8324('0x93')](_0x190690[_0x8324('0x96')])){return this[_0x8324('0x10')][_0x8324('0xb7')](_0x8324('0x12a'));}if(!this[_0x8324('0x93')](_0x190690['text'])){return this[_0x8324('0x10')]['noop'](_0x8324('0xd1'));}this['channel'][_0x8324('0xb7')](util[_0x8324('0x61')]('Trying\x20aws\x20Polly\x20%s',_0x190690[_0x8324('0x6f')]));var _0x5a0584=this[_0x8324('0x95')][_0x8324('0x7e')](this,_0x190690);if(_0x5a0584){this[_0x8324('0x10')][_0x8324('0xb7')](util['format'](_0x8324('0x12b'),_0x5a0584));var _0x1f4d71=this['channel']['streamFile'](_0x5a0584);try{fs[_0x8324('0x10d')](_0x5a0584+'.wav');}catch(_0x310f62){logger['error'](_0x310f62);}return _0x1f4d71;}return this[_0x8324('0x10')][_0x8324('0x2e')](_0x190690,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x8324('0x17')][_0x8324('0x12c')]=function(_0x5cd5cb){logger[_0x8324('0x30')](util['format'](_0x8324('0x12d'),_0x5cd5cb[_0x8324('0x3b')]));if(!this['isConfigured'](_0x5cd5cb['aws_access_key_id'])||!this[_0x8324('0x93')](_0x5cd5cb['aws_secret_access_key'])){return this['channel'][_0x8324('0xb7')](_0x8324('0x12a'));}if(!this[_0x8324('0x93')](_0x5cd5cb[_0x8324('0x12e')])){return this['channel']['noop']('no\x20bot\x20name\x20configured');}if(!this[_0x8324('0x93')](_0x5cd5cb[_0x8324('0x6f')])){return this[_0x8324('0x10')]['noop'](_0x8324('0xd1'));}this['channel'][_0x8324('0x101')]=!![];this['createSquareDetailsReport'](_0x5cd5cb);this[_0x8324('0x44')](_0x5cd5cb[_0x8324('0x6f')],'in','','');this['channel']['noop'](util['format'](_0x8324('0x12f'),_0x5cd5cb[_0x8324('0x6f')]));var _0x30e535=this['awsLex'][_0x8324('0x7e')](this,_0x5cd5cb);if(_0x30e535){for(var _0x34bb0b in _0x30e535){if(_0x30e535[_0x8324('0xf4')](_0x34bb0b)&&_[_0x8324('0xa2')](_0x30e535[_0x34bb0b])){this['channel'][_0x8324('0xab')](util[_0x8324('0x61')](_0x8324('0x130'),_0x34bb0b[_0x8324('0x77')]()),_0x30e535[_0x34bb0b]);}}if(_['isNil'](_0x30e535[_0x8324('0x85')])){return this[_0x8324('0x10')][_0x8324('0xb7')](_0x8324('0x131'));}else{this[_0x8324('0x44')](_0x30e535['message'],_0x8324('0xf7'),_0x8324('0x132'),'');return this[_0x8324('0x10')][_0x8324('0xb7')](util[_0x8324('0x61')](_0x8324('0x133'),_0x30e535[_0x8324('0x85')]));}}return this[_0x8324('0x10')][_0x8324('0x2e')](_0x5cd5cb,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x8324('0x17')][_0x8324('0x134')]=function(_0x262ab9){logger['info'](util[_0x8324('0x61')](_0x8324('0x135'),_0x262ab9[_0x8324('0x3b')],_0x262ab9['timeout']));if(!this['isConfigured'](_0x262ab9[_0x8324('0x89')])){return this[_0x8324('0x10')][_0x8324('0xb7')](_0x8324('0xf2'));}var _0x1279fb=_0x8324('0x136');var _0x49d046=util['format']('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x44fcf5=util[_0x8324('0x61')](_0x8324('0xaa'),_0x49d046,_0x1279fb);var _0x3662c1=!![];if(_0x262ab9[_0x8324('0x137')]===_0x8324('0x138')){_0x3662c1=![];}var _0x100034=this['channel'][_0x8324('0x139')](_0x49d046,_0x1279fb,_0x262ab9[_0x8324('0x13a')],_0x262ab9[_0x8324('0x73')],undefined,_0x3662c1);if(_0x100034[_0x8324('0xb0')]!==-0x1){this[_0x8324('0x10')][_0x8324('0xb7')](util['format'](_0x8324('0x13b'),_0x44fcf5));var _0x22b6c3=this['googleASR'][_0x8324('0x7e')](this,_0x262ab9,_0x44fcf5);if(_0x22b6c3){for(var _0x18a351 in _0x22b6c3){if(_0x22b6c3['hasOwnProperty'](_0x18a351)){this[_0x8324('0x10')][_0x8324('0xab')](util[_0x8324('0x61')](_0x8324('0x13c'),_0x18a351[_0x8324('0x77')]()),_0x22b6c3[_0x18a351]);}}return this['channel'][_0x8324('0xb7')](util[_0x8324('0x61')](_0x8324('0x13d'),JSON[_0x8324('0x81')](_0x22b6c3)));}}return _0x100034;};AGIVertices[_0x8324('0x17')]['tildeasr']=function(_0x56ff59){logger[_0x8324('0x30')](util[_0x8324('0x61')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x56ff59[_0x8324('0x3b')]));if(!this[_0x8324('0x93')](_0x56ff59[_0x8324('0x9e')])){return this[_0x8324('0x10')]['noop'](_0x8324('0x13e'));}if(!this[_0x8324('0x93')](_0x56ff59['appsecret'])){return this[_0x8324('0x10')][_0x8324('0xb7')](_0x8324('0x13f'));}var _0x1e0735=_0x8324('0x136');var _0x545213=util[_0x8324('0x61')](_0x8324('0x140'),FILES_PATH,rs['generate'](0x4));var _0x4abaed=util['format'](_0x8324('0xaa'),_0x545213,_0x1e0735);var _0x35d4fa=!![];if(_0x56ff59[_0x8324('0x137')]==='NOBEEP'){_0x35d4fa=![];}var _0x199c5d=this['channel']['recordFile'](_0x545213,_0x1e0735,_0x56ff59[_0x8324('0x13a')],_0x56ff59[_0x8324('0x73')],undefined,_0x35d4fa);if(_0x199c5d[_0x8324('0xb0')]!==-0x1){this['channel'][_0x8324('0xb7')](util[_0x8324('0x61')](_0x8324('0x141'),_0x4abaed));var _0x165f92=this['tildeASR'][_0x8324('0x7e')](this,_0x56ff59,_0x4abaed);if(_0x165f92){for(var _0xfe4d28 in _0x165f92){if(_0x165f92[_0x8324('0xf4')](_0xfe4d28)){this[_0x8324('0x10')]['setVariable'](util[_0x8324('0x61')](_0x8324('0x142'),_0xfe4d28[_0x8324('0x77')]()),_0x165f92[_0xfe4d28]);}}return this['channel'][_0x8324('0xb7')](util[_0x8324('0x61')]('TildeASR\x20Result\x20%s',JSON['stringify'](_0x165f92)));}}return _0x199c5d;};AGIVertices[_0x8324('0x17')]['gotoc']=function(_0x47dd55){logger[_0x8324('0x30')](util[_0x8324('0x61')](_0x8324('0x143'),_0x47dd55[_0x8324('0x3b')]));return this[_0x8324('0x10')][_0x8324('0x144')](_0x47dd55[_0x8324('0x145')],_0x47dd55[_0x8324('0x146')],_0x47dd55[_0x8324('0x40')]);};AGIVertices[_0x8324('0x17')]['gotoif']=function(_0x2c3074){logger[_0x8324('0x30')](util[_0x8324('0x61')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x2c3074[_0x8324('0x3b')]));if(!this['isConfigured'](_0x2c3074[_0x8324('0x147')])){return this[_0x8324('0x10')][_0x8324('0x2e')](_0x2c3074,_0x8324('0x148'));}try{var _0x2794ad=eval(_0x2c3074[_0x8324('0x147')])?_0x8324('0x149'):_0x8324('0x14a');this[_0x8324('0x10')][_0x8324('0xb7')](util['format'](_0x8324('0x14b'),_0x2c3074[_0x8324('0x147')],_0x2794ad));return{'code':0xc8,'result':_0x2794ad};}catch(_0x6d7cc){return{'code':0xc8,'result':_0x8324('0x14a')};}};AGIVertices[_0x8324('0x17')][_0x8324('0x14c')]=function(_0x40011e){logger['info'](util[_0x8324('0x61')](_0x8324('0x14d'),_0x40011e['label']));if(!this[_0x8324('0x93')](_0x40011e[_0x8324('0x14e')])){return this[_0x8324('0x10')][_0x8324('0x2e')](_0x40011e,_0x8324('0x14f'));}var _0x1ac5e7=this[_0x8324('0x150')][_0x8324('0x7e')](this,_0x40011e[_0x8324('0x14e')]);if(!_0x1ac5e7){return this[_0x8324('0x10')][_0x8324('0x2e')](_0x40011e,'no\x20intervals\x20found');}for(var _0x290625=0x0;_0x290625<_0x1ac5e7[_0x8324('0xa8')];_0x290625+=0x1){var _0x58731d=this[_0x8324('0x10')][_0x8324('0x13')](util[_0x8324('0x61')]('IFTIME(%s?true:false)',_0x1ac5e7[_0x290625]));if(_0x58731d[_0x8324('0xb0')]===-0x1){return _0x58731d;}logger[_0x8324('0x30')](util['format'](_0x8324('0x151'),_0x1ac5e7[_0x290625],_0x58731d['extra']));if(_0x58731d['extra']===_0x8324('0x149')){logger[_0x8324('0x30')](util['format'](_0x8324('0x151'),_0x1ac5e7[_0x290625],'true'));this[_0x8324('0x10')][_0x8324('0xb7')](util[_0x8324('0x61')]('IFTIME\x20%s\x20%s',_0x1ac5e7[_0x290625],'true'));return{'code':0xc8,'result':_0x8324('0x149')};}else{logger['info'](util[_0x8324('0x61')](_0x8324('0x151'),_0x1ac5e7[_0x290625],_0x8324('0x14a')));this[_0x8324('0x10')][_0x8324('0xb7')](util['format']('IFTIME\x20%s\x20%s',_0x1ac5e7[_0x290625],_0x8324('0x14a')));}}return{'code':0xc8,'result':_0x8324('0x14a')};};AGIVertices[_0x8324('0x17')][_0x8324('0x152')]=function(_0x7cb0b8){logger['info'](util[_0x8324('0x61')](_0x8324('0x153'),_0x7cb0b8[_0x8324('0x3b')]));return this[_0x8324('0x10')]['hangup']();};AGIVertices['prototype'][_0x8324('0x154')]=function(_0x3af5b1){logger['info'](util[_0x8324('0x61')](_0x8324('0x155'),_0x3af5b1[_0x8324('0x3b')]));if(!this[_0x8324('0x93')](_0x3af5b1[_0x8324('0x89')])){return this[_0x8324('0x10')][_0x8324('0xb7')](_0x8324('0xf2'));}var _0x10eb7f=_0x8324('0x136');var _0x3b4cf3=util[_0x8324('0x61')](_0x8324('0x140'),FILES_PATH,rs[_0x8324('0x123')](0x4));var _0x43d869=util[_0x8324('0x61')](_0x8324('0xaa'),_0x3b4cf3,_0x10eb7f);var _0x5a91ac=!![];if(_0x3af5b1[_0x8324('0x137')]===_0x8324('0x138')){_0x5a91ac=![];}var _0x11d3fe=this[_0x8324('0x10')][_0x8324('0x139')](_0x3b4cf3,_0x10eb7f,_0x3af5b1[_0x8324('0x13a')],_0x3af5b1[_0x8324('0x73')],undefined,_0x5a91ac);if(_0x11d3fe['result']!==-0x1){this[_0x8324('0x10')][_0x8324('0xb7')](util['format'](_0x8324('0x156'),_0x43d869));var _0x16f6ed=this[_0x8324('0x92')][_0x8324('0x7e')](this,_0x3af5b1,_0x43d869);if(_0x16f6ed){for(var _0x187efd in _0x16f6ed){if(_0x16f6ed[_0x8324('0xf4')](_0x187efd)){this['channel'][_0x8324('0xab')](util[_0x8324('0x61')](_0x8324('0x157'),_0x187efd[_0x8324('0x77')]()),_0x16f6ed[_0x187efd]);}}return this['channel'][_0x8324('0xb7')](util[_0x8324('0x61')](_0x8324('0x158'),JSON[_0x8324('0x81')](_0x16f6ed)));}}return _0x11d3fe;};AGIVertices['prototype'][_0x8324('0x159')]=function(_0x37f14a){logger[_0x8324('0x30')](util[_0x8324('0x61')](_0x8324('0x15a'),_0x37f14a['label']));if(!this[_0x8324('0x93')](_0x37f14a[_0x8324('0x89')])){return this[_0x8324('0x10')][_0x8324('0xb7')](_0x8324('0xf2'));}if(!this[_0x8324('0x93')](_0x37f14a['text'])){return this[_0x8324('0x10')][_0x8324('0xb7')]('no\x20text\x20configured');}this[_0x8324('0x10')][_0x8324('0xb7')](util[_0x8324('0x61')](_0x8324('0x15b'),_0x37f14a[_0x8324('0x6f')]));var _0x35befa=this[_0x8324('0x8f')][_0x8324('0x7e')](this,_0x37f14a);if(_0x35befa){this['channel'][_0x8324('0xb7')](util[_0x8324('0x61')](_0x8324('0x156'),_0x35befa));var _0x2a7862=this['channel'][_0x8324('0x10c')](_0x35befa,_0x37f14a[_0x8324('0x13a')]);try{fs[_0x8324('0x10d')](_0x35befa+_0x8324('0x10e'));}catch(_0x5e0a78){logger[_0x8324('0x2e')](_0x5e0a78);}return _0x2a7862;}return this[_0x8324('0x10')][_0x8324('0x2e')](_0x37f14a,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x8324('0x17')][_0x8324('0x15c')]=function(_0x21b1e2){logger[_0x8324('0x30')](util[_0x8324('0x61')](_0x8324('0x15d'),_0x21b1e2[_0x8324('0x3b')]));if(!this[_0x8324('0x93')](_0x21b1e2[_0x8324('0x15e')])){return this[_0x8324('0x10')][_0x8324('0x2e')](_0x21b1e2,_0x8324('0x15f'));}logger[_0x8324('0x30')](util[_0x8324('0x61')](_0x8324('0x160'),this[_0x8324('0x10')][_0x8324('0x3d')],_0x21b1e2['findBy']));var _0x28951c=this['agentLogin'][_0x8324('0x7e')](this,_0x21b1e2['findBy']);if(_0x28951c){logger[_0x8324('0x30')](util[_0x8324('0x61')](_0x8324('0x161'),this['channel'][_0x8324('0x3d')],_0x21b1e2[_0x8324('0x15e')]));this[_0x8324('0x10')][_0x8324('0xb7')](util['format'](_0x8324('0x161'),this[_0x8324('0x10')][_0x8324('0x3d')],_0x21b1e2['findBy']));return{'code':0xc8,'result':_0x8324('0x162')};}else{logger[_0x8324('0x30')](util[_0x8324('0x61')](_0x8324('0x163'),this[_0x8324('0x10')]['callerid'],_0x21b1e2[_0x8324('0x15e')]));this[_0x8324('0x10')][_0x8324('0xb7')](util[_0x8324('0x61')](_0x8324('0x163'),this[_0x8324('0x10')][_0x8324('0x3d')],_0x21b1e2['findBy']));return{'code':0xc8,'result':_0x8324('0x164')};}};AGIVertices['prototype']['logout']=function(_0xaa1302){logger[_0x8324('0x30')](util[_0x8324('0x61')](_0x8324('0x165'),_0xaa1302[_0x8324('0x3b')]));if(!this[_0x8324('0x93')](_0xaa1302['findBy'])){return this['channel']['error'](_0xaa1302,_0x8324('0x15f'));}logger[_0x8324('0x30')](util[_0x8324('0x61')](_0x8324('0x160'),this[_0x8324('0x10')][_0x8324('0x3d')],_0xaa1302[_0x8324('0x15e')]));var _0x501ea0=this[_0x8324('0x5e')]['sync'](this,_0xaa1302[_0x8324('0x15e')]);if(_0x501ea0){logger[_0x8324('0x30')](util[_0x8324('0x61')](_0x8324('0x161'),this['channel'][_0x8324('0x3d')],_0xaa1302[_0x8324('0x15e')]));this[_0x8324('0x10')]['noop'](util[_0x8324('0x61')](_0x8324('0x161'),this[_0x8324('0x10')][_0x8324('0x3d')],_0xaa1302[_0x8324('0x15e')]));return{'code':0xc8,'result':_0x8324('0x162')};}else{logger[_0x8324('0x30')](util[_0x8324('0x61')](_0x8324('0x163'),this['channel'][_0x8324('0x3d')],_0xaa1302[_0x8324('0x15e')]));this[_0x8324('0x10')][_0x8324('0xb7')](util[_0x8324('0x61')](_0x8324('0x163'),this[_0x8324('0x10')][_0x8324('0x3d')],_0xaa1302[_0x8324('0x15e')]));return{'code':0xc8,'result':_0x8324('0x164')};}};AGIVertices['prototype'][_0x8324('0x166')]=function(_0x378a37){logger['info'](util[_0x8324('0x61')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x378a37[_0x8324('0x3b')]));if(!this[_0x8324('0x93')](_0x378a37['operation'])){return this[_0x8324('0x10')][_0x8324('0x2e')](_0x378a37,'no\x20operation\x20configured');}this[_0x8324('0x10')]['noop'](util[_0x8324('0x61')]('math\x20%s',_0x378a37[_0x8324('0x167')]));var _0x3edb5b=eval(_0x378a37[_0x8324('0x167')]);if(!this[_0x8324('0x93')](_0x378a37[_0x8324('0xe1')])){return this[_0x8324('0x10')][_0x8324('0xb7')](_0x8324('0xe0'));}var _0x553c61=this[_0x8324('0x13')][_0x8324('0x7e')](this,_0x378a37[_0x8324('0xe1')]);if(!_0x553c61){return this[_0x8324('0x10')]['error'](_0x378a37,'no\x20variable\x20found');}if(_[_0x8324('0xa6')](_0x3edb5b)){var _0x32d45f=this;_0x3edb5b[_0x8324('0xe3')](function(_0x2891fe,_0x317ce8){_0x32d45f['channel']['setVariable'](util[_0x8324('0x61')](_0x8324('0x168'),_0x553c61,_0x317ce8),_0x2891fe);});return this[_0x8324('0x10')][_0x8324('0xb7')](util[_0x8324('0x61')]('variable\x20%s[key]\x20set',_0x553c61));}else{return this[_0x8324('0x10')][_0x8324('0xab')](_0x553c61,_0x3edb5b);}};AGIVertices[_0x8324('0x17')][_0x8324('0x169')]=function(_0x47f7a8){logger[_0x8324('0x30')](util[_0x8324('0x61')](_0x8324('0x16a'),_0x47f7a8['label']));if(_0x47f7a8[_0x8324('0xb3')]===0x0){return this[_0x8324('0xb2')](_0x47f7a8);}_0x47f7a8[_0x8324('0xb3')]-=0x1;if(!this[_0x8324('0x93')](_0x47f7a8[_0x8324('0x11b')])){return this[_0x8324('0x10')]['error'](_0x47f7a8,_0x8324('0x16b'));}var _0x4878e2=this[_0x8324('0x20')][_0x8324('0x7e')](this,_0x47f7a8[_0x8324('0x11b')]);if(!_0x4878e2){return this[_0x8324('0x10')]['error'](_0x47f7a8,_0x8324('0x11c'));}var _0x59cc47=this[_0x8324('0x10')]['getData'](_0x4878e2,_0x47f7a8['response'],_0x47f7a8['digit']);var _0x1512a8=_0x59cc47['result'];if(_0x59cc47[_0x8324('0xb0')]===-0x1){this['createSquareDetailsReport'][_0x8324('0x7e')](this,_0x47f7a8,'-1');return _0x59cc47;}else if(_0x59cc47[_0x8324('0xae')]===_0x8324('0x73')){_0x59cc47[_0x8324('0xb0')]=_0x59cc47[_0x8324('0xb0')]['length']>0x0?_0x59cc47[_0x8324('0xb0')]:'t';}else if(_['isEmpty'](_0x59cc47[_0x8324('0xb0')])){_0x59cc47['result']='#';_0x1512a8='#';}if(!this[_0x8324('0x93')](_0x47f7a8[_0x8324('0xe1')])){this[_0x8324('0x10')][_0x8324('0xb7')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x24977f=this[_0x8324('0x13')][_0x8324('0x7e')](this,_0x47f7a8['variable_id']);if(!_0x24977f){return this['channel'][_0x8324('0x2e')](_0x47f7a8,_0x8324('0xe2'));}this[_0x8324('0x10')]['setVariable'](_0x24977f,_0x1512a8);}this[_0x8324('0x39')][_0x8324('0x7e')](this,_0x47f7a8,_0x1512a8);return _0x59cc47;};AGIVertices[_0x8324('0x17')][_0x8324('0xb7')]=function(_0x4afdc6){logger[_0x8324('0x30')](util['format'](_0x8324('0x16c'),_0x4afdc6['label']));return this[_0x8324('0x10')]['noop'](_0x4afdc6[_0x8324('0x16d')]||_0x4afdc6[_0x8324('0x3b')]);};AGIVertices[_0x8324('0x17')][_0x8324('0x16e')]=function(_0x21a299){logger[_0x8324('0x30')](util[_0x8324('0x61')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x21a299['label']));if(!this[_0x8324('0x93')](_0x21a299[_0x8324('0x15e')])){return this['channel'][_0x8324('0x2e')](_0x21a299,_0x8324('0x15f'));}logger[_0x8324('0x30')](util['format'](_0x8324('0x160'),this[_0x8324('0x10')][_0x8324('0x3d')],_0x21a299[_0x8324('0x15e')]));var _0x4bc6b3=this[_0x8324('0x5a')]['sync'](this,_0x21a299[_0x8324('0x16f')]);var _0xd5b7fd=this[_0x8324('0x5b')][_0x8324('0x7e')](this,_0x21a299['findBy'],_0x4bc6b3);if(_0xd5b7fd){logger['info'](util['format'](_0x8324('0x161'),this[_0x8324('0x10')]['callerid'],_0x21a299[_0x8324('0x15e')]));this[_0x8324('0x10')][_0x8324('0xb7')](util['format'](_0x8324('0x161'),this['channel'][_0x8324('0x3d')],_0x21a299[_0x8324('0x15e')]));return{'code':0xc8,'result':_0x8324('0x162')};}else{logger['info'](util[_0x8324('0x61')](_0x8324('0x163'),this[_0x8324('0x10')][_0x8324('0x3d')],_0x21a299['findBy']));this[_0x8324('0x10')]['noop'](util[_0x8324('0x61')](_0x8324('0x161'),this[_0x8324('0x10')][_0x8324('0x3d')],_0x21a299['findBy']));return{'code':0xc8,'result':_0x8324('0x164')};}};AGIVertices[_0x8324('0x17')]['playback']=function(_0x4293fe){logger['info'](util[_0x8324('0x61')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x4293fe[_0x8324('0x3b')]));if(!this[_0x8324('0x93')](_0x4293fe[_0x8324('0x11b')])){return this[_0x8324('0x10')][_0x8324('0x2e')](_0x4293fe,_0x8324('0x16b'));}var _0x9d9e55=this['getSound']['sync'](this,_0x4293fe['file_id']);if(!_0x9d9e55){return this[_0x8324('0x10')]['error'](_0x4293fe,'no\x20file\x20audio\x20found');}var _0x7d74=this[_0x8324('0x10')][_0x8324('0x64')](_0x8324('0x170'),[_0x9d9e55,_0x4293fe[_0x8324('0x118')]]);if(_0x7d74[_0x8324('0xb0')]===-0x1){return _0x7d74;}return this[_0x8324('0x10')][_0x8324('0xb7')](util[_0x8324('0x61')]('Executed\x20command\x20%s\x20%s',_0x8324('0x170'),_0x9d9e55));};AGIVertices[_0x8324('0x17')][_0x8324('0x171')]=function(_0x2aca65){logger[_0x8324('0x30')](util[_0x8324('0x61')](_0x8324('0x172'),_0x2aca65[_0x8324('0x3b')]));if(!this[_0x8324('0x93')](_0x2aca65[_0x8324('0x173')])){return this[_0x8324('0x10')]['error'](_0x2aca65,'no\x20queue\x20selected');}var _0x127a46='';var _0x45cace=parseInt(_0x2aca65[_0x8324('0x173')],0xa);if(isNaN(_0x45cace)){_0x127a46=_0x2aca65[_0x8324('0x173')];}else{_0x127a46=this[_0x8324('0x174')][_0x8324('0x7e')](this,_0x2aca65['queue_id']);if(!_0x127a46){return this[_0x8324('0x10')]['error'](_0x2aca65,_0x8324('0x175'));}}var _0x1d329e='';if(this[_0x8324('0x93')](_0x2aca65[_0x8324('0x11b')])){var _0x2c52ce=this['getSound']['sync'](this,_0x2aca65['file_id']);if(_0x2c52ce){_0x1d329e=_0x2c52ce;}}this['createSquareDetailsReport'][_0x8324('0x7e')](this,_0x2aca65,_0x127a46);if(_0x2aca65[_0x8324('0x118')][_0x8324('0x176')]('x')<0x0){_0x2aca65[_0x8324('0x118')]+='x';}if(_0x2aca65[_0x8324('0x118')]['indexOf']('X')<0x0){_0x2aca65['opts']+='X';}this[_0x8324('0x10')][_0x8324('0xab')](_0x8324('0x177'),_0x127a46?_0x127a46[_0x8324('0x178')]():'');var _0x2801af=this[_0x8324('0x10')]['exec']('QUEUE',[_0x127a46,_0x2aca65['opts'],_0x2aca65[_0x8324('0x179')],_0x1d329e,_0x2aca65[_0x8324('0x73')],_0x2aca65['agi'],_0x2aca65[_0x8324('0x17a')],_0x2aca65[_0x8324('0x17b')],'',_0x2aca65[_0x8324('0x17c')]]);if(_0x2801af[_0x8324('0xb0')]===-0x1){return _0x2801af;}return this[_0x8324('0x10')][_0x8324('0xb7')](util['format'](_0x8324('0xcb'),'QUEUE',_0x127a46));};AGIVertices[_0x8324('0x17')][_0x8324('0x17d')]=function(_0x13a6ad){logger[_0x8324('0x30')](util['format'](_0x8324('0x17e'),_0x13a6ad['label']));var _0x574bdb=_0x13a6ad[_0x8324('0x17f')]||_0x8324('0x136');var _0x5226ad=util['format'](_0x8324('0x180'),this[_0x8324('0x10')][_0x8324('0x3a')],rs[_0x8324('0x123')](0x5));var _0x5b4128=util[_0x8324('0x61')](_0x8324('0x181'),FILES_PATH,_0x5226ad,_0x574bdb);var _0x2b1e4e=util[_0x8324('0x61')](_0x8324('0x140'),FILES_PATH,_0x5226ad);this['createSquareRecording'][_0x8324('0x7e')](this,_0x13a6ad,_0x5226ad,_0x5b4128);this[_0x8324('0x10')][_0x8324('0xab')](_0x8324('0x182'),_0x5226ad);logger[_0x8324('0x30')](_0x8324('0x183'),_0x2b1e4e,_0x574bdb,_0x13a6ad[_0x8324('0x184')],_0x13a6ad['timeout']);return this[_0x8324('0x10')][_0x8324('0x139')](_0x2b1e4e,_0x574bdb,_0x13a6ad[_0x8324('0x184')],_0x13a6ad[_0x8324('0x73')],undefined,!![]);};AGIVertices[_0x8324('0x17')][_0x8324('0x185')]=function(_0xb0b6da){logger[_0x8324('0x30')](util['format'](_0x8324('0x186'),_0xb0b6da['label']));if(!this[_0x8324('0x93')](_0xb0b6da[_0x8324('0x179')])){return this[_0x8324('0x10')][_0x8324('0xb7')]('no\x20url\x20configured');}var _0x3adca8=this[_0x8324('0x71')]['sync'](this,_0xb0b6da);logger[_0x8324('0x30')](util['format']('Response:',util[_0x8324('0x187')](_0x3adca8,{'showHidden':![],'depth':null})));if(!this[_0x8324('0x93')](_0xb0b6da[_0x8324('0xe1')])){return this['channel']['noop'](_0x8324('0x188'));}var _0x596fbd=this[_0x8324('0x13')][_0x8324('0x7e')](this,_0xb0b6da['variable_id']);if(!_0x596fbd){return this[_0x8324('0x10')][_0x8324('0x2e')](_0xb0b6da,_0x8324('0xe2'));}this['channel']['setVariable'](util[_0x8324('0x61')](_0x8324('0x189'),_0x596fbd),_0x3adca8['statusCode']?_0x3adca8[_0x8324('0x83')]:_0x8324('0x18a'));this[_0x8324('0x10')][_0x8324('0xab')](util['format'](_0x8324('0x18b'),_0x596fbd),_0x3adca8[_0x8324('0x84')]?_0x3adca8['statusMessage']:'OK');if(_0x3adca8[_0x8324('0x78')]){try{this[_0x8324('0xa9')](_0x3adca8['body'],_0x596fbd);}catch(_0x50235d){logger['error'](util[_0x8324('0x61')](_0x8324('0x18c'),_0x596fbd));}}return this['channel']['noop'](util[_0x8324('0x61')](_0x8324('0xe7'),_0x596fbd));};AGIVertices['prototype'][_0x8324('0x18d')]=function(_0x2d9f72){logger[_0x8324('0x30')](util['format']('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x2d9f72['label']));return this[_0x8324('0x10')]['sayDigits'](_0x2d9f72[_0x8324('0x18e')][_0x8324('0x65')](/\s+/g,''),_0x2d9f72['escape_digits']);};AGIVertices[_0x8324('0x17')][_0x8324('0x18f')]=function(_0x2675f6){logger[_0x8324('0x30')](util[_0x8324('0x61')](_0x8324('0x190'),_0x2675f6[_0x8324('0x3b')]));return this[_0x8324('0x10')][_0x8324('0x191')](_0x2675f6[_0x8324('0x74')][_0x8324('0x65')](/\s+/g,''),_0x2675f6[_0x8324('0x184')]);};AGIVertices[_0x8324('0x17')]['sayphonetic']=function(_0x348fce){logger['info'](util[_0x8324('0x61')](_0x8324('0x192'),_0x348fce['label']));return this['channel'][_0x8324('0x193')](_0x348fce[_0x8324('0x6f')],_0x348fce[_0x8324('0x184')]);};AGIVertices[_0x8324('0x17')][_0x8324('0x194')]=function(_0x32e761){logger[_0x8324('0x30')](util['format'](_0x8324('0x195'),_0x32e761[_0x8324('0x3b')]));if(!this[_0x8324('0x93')](_0x32e761['account_id'])){return this[_0x8324('0x10')]['noop'](_0x8324('0x196'));}var _0x184b91=this['getMailAccount'][_0x8324('0x7e')](this,_0x32e761[_0x8324('0x197')]);if(!_0x184b91||!_0x184b91[_0x8324('0x198')]){return this[_0x8324('0x10')][_0x8324('0x2e')](_0x32e761,_0x8324('0x199'));}var _0x3559c1={'from':util[_0x8324('0x61')](_0x8324('0x19a'),_0x184b91['name'],_0x184b91[_0x8324('0x19b')]||_0x184b91[_0x8324('0x198')][_0x8324('0x19c')]),'to':_0x32e761['to']||'','cc':_0x32e761['cc']||'','bcc':_0x32e761[_0x8324('0x19d')]||'','subject':_0x32e761[_0x8324('0x19e')],'html':_0x32e761['text'],'text':_0x32e761[_0x8324('0x6f')]};var _0x50b08f={'tls':{'rejectUnauthorized':![]}};if(_0x184b91[_0x8324('0x198')][_0x8324('0x19f')]){_0x50b08f['service']=_0x184b91[_0x8324('0x198')][_0x8324('0x19f')];}else{_0x50b08f[_0x8324('0x1a0')]=_0x184b91[_0x8324('0x198')][_0x8324('0x1a0')];_0x50b08f['port']=_0x184b91[_0x8324('0x198')][_0x8324('0x1a1')];_0x50b08f[_0x8324('0x1a2')]=_0x184b91[_0x8324('0x198')][_0x8324('0x1a2')];}if(_0x184b91[_0x8324('0x198')][_0x8324('0x1a3')]){_0x50b08f[_0x8324('0x1a4')]={'user':_0x184b91['Smtp']['user'],'pass':_0x184b91[_0x8324('0x198')][_0x8324('0x1a5')]};}if(this['isConfigured'](_0x32e761[_0x8324('0x1a6')])){}logger[_0x8324('0xe9')](_0x8324('0x1a7'),JSON[_0x8324('0x81')](_0x3559c1));this['createSquareDetailsReport'][_0x8324('0x7e')](this,_0x32e761,_0x32e761[_0x8324('0x197')]);this[_0x8324('0x10')]['noop'](util['format'](_0x8324('0x1a8'),_0x184b91[_0x8324('0x16')]));this[_0x8324('0x25')][_0x8324('0x7e')](this,_0x50b08f,_0x3559c1);return this[_0x8324('0x10')][_0x8324('0xb7')](_0x8324('0x1a9'));};AGIVertices[_0x8324('0x17')][_0x8324('0x1aa')]=function(_0x35b274){logger['info'](util[_0x8324('0x61')](_0x8324('0x1ab'),_0x35b274['label']));return this['channel'][_0x8324('0xb7')](_0x8324('0x1ac'));};AGIVertices[_0x8324('0x17')][_0x8324('0x1ad')]=function(_0x2b8bff){logger[_0x8324('0x30')](util['format'](_0x8324('0x1ae'),_0x2b8bff[_0x8324('0x3b')]));if(!this[_0x8324('0x93')](_0x2b8bff['sms_account_id'])){return this['channel'][_0x8324('0xb7')]('no\x20sms\x20account\x20configured');}var _0xba65ae=this[_0x8324('0x36')]['sync'](this,_0x2b8bff[_0x8324('0x1af')]);if(!_0xba65ae){return this['channel']['error'](_0x2b8bff,_0x8324('0x1b0'));}var _0x5e1397={'body':_0x2b8bff[_0x8324('0x1b1')],'phone':_0x2b8bff['to']||'','SmsAccountId':_0xba65ae['id']};logger[_0x8324('0xe9')](_0x8324('0x1b2'),JSON[_0x8324('0x81')](_0x5e1397));this['createSquareDetailsReport'][_0x8324('0x7e')](this,_0x2b8bff,_0x2b8bff['sms_account_id']);this['channel']['noop'](util[_0x8324('0x61')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0xba65ae['name']));this[_0x8324('0x38')][_0x8324('0x7e')](this,_0x5e1397);return this['channel'][_0x8324('0xb7')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x8324('0x17')]['set']=function(_0x26f197){logger[_0x8324('0x30')](util[_0x8324('0x61')](_0x8324('0x1b3'),_0x26f197[_0x8324('0x3b')]));if(!this[_0x8324('0x93')](_0x26f197[_0x8324('0xe1')])){return this[_0x8324('0x10')]['error'](_0x26f197,_0x8324('0x1b4'));}var _0x3c41a0=this['getVariable'][_0x8324('0x7e')](this,_0x26f197[_0x8324('0xe1')]);if(!_0x3c41a0){return this[_0x8324('0x10')][_0x8324('0x2e')](_0x26f197,'no\x20variable\x20found');}return this[_0x8324('0x10')][_0x8324('0xab')](_0x3c41a0,_0x26f197[_0x8324('0x1b5')]);};AGIVertices[_0x8324('0x17')][_0x8324('0x1b6')]=function(_0x253d4e){logger['info'](util[_0x8324('0x61')]('Enter\x20in\x20START\x20(%s)\x20block',_0x253d4e[_0x8324('0x3b')]));this[_0x8324('0x10')][_0x8324('0xb7')]('START\x20CALLY\x20SQUARE');if(_0x253d4e[_0x8324('0xc5')]===_0x8324('0x1b7')){this[_0x8324('0x10')][_0x8324('0xb7')](_0x8324('0x1b8'));return this['channel']['answer']();}return this[_0x8324('0x10')]['noop'](_0x8324('0x1b9'));};AGIVertices[_0x8324('0x17')]['subproject']=function(_0x2d12c8){logger[_0x8324('0x30')](util[_0x8324('0x61')](_0x8324('0x1ba'),_0x2d12c8[_0x8324('0x3b')]));if(!this['isConfigured'](_0x2d12c8[_0x8324('0x1bb')])){return this['channel'][_0x8324('0x2e')](_0x2d12c8,'no\x20subproject\x20selected');}var _0x29b984=this[_0x8324('0x18')][_0x8324('0x7e')](this,_0x2d12c8['project_id']);if(!this[_0x8324('0x93')](_0x29b984)){return this['channel']['error'](_0x2d12c8,util[_0x8324('0x61')](_0x8324('0x1bc'),_0x2d12c8['project_id']));}if(_0x29b984===this[_0x8324('0x10')][_0x8324('0x3c')]){return this[_0x8324('0x10')]['error'](_0x2d12c8,_0x8324('0x1bd'));}this[_0x8324('0x39')]['sync'](this,_0x2d12c8,_0x29b984);var _0x4f4848=this[_0x8324('0x10')][_0x8324('0x64')](_0x8324('0x1be'),util[_0x8324('0x61')](_0x8324('0x1bf'),config[_0x8324('0x8')][_0x8324('0x1a0')]||_0x8324('0x1c0'),_0x29b984,this[_0x8324('0x10')][_0x8324('0x3c')]));if(_0x4f4848[_0x8324('0xb0')]===-0x1){return _0x4f4848;}return this[_0x8324('0x10')][_0x8324('0xb7')](util[_0x8324('0x61')](_0x8324('0xcb'),_0x8324('0x1be'),_0x29b984));};AGIVertices['prototype'][_0x8324('0x1c1')]=function(_0x1cc4d4){logger[_0x8324('0x30')](util[_0x8324('0x61')](_0x8324('0x1c2'),_0x1cc4d4[_0x8324('0x3b')]));var _0x5f119d=this[_0x8324('0x63')]['sync'](this,_0x1cc4d4['command']);this[_0x8324('0x39')]['sync'](this,_0x1cc4d4,_0x1cc4d4['command']);if(this[_0x8324('0x93')](_0x1cc4d4[_0x8324('0xe1')])){var _0x3c30b1=this[_0x8324('0x13')][_0x8324('0x7e')](this,_0x1cc4d4[_0x8324('0xe1')]);if(_0x3c30b1){this[_0x8324('0x10')][_0x8324('0xab')](_0x3c30b1,_0x5f119d);return this['channel']['noop'](util[_0x8324('0x61')](_0x8324('0x1c3'),_0x1cc4d4['command'],_0x3c30b1));}}return this['channel'][_0x8324('0xb7')](util['format'](_0x8324('0x1c4'),_0x1cc4d4['command']));};AGIVertices[_0x8324('0x17')][_0x8324('0x1c5')]=function(_0x4796a2){logger[_0x8324('0x30')](util[_0x8324('0x61')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x4796a2[_0x8324('0x3b')]));_0x4796a2[_0x8324('0x6f')]=_0x4796a2['text'][_0x8324('0x65')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8324('0x93')](_0x4796a2['apiKey'])){return this[_0x8324('0x10')][_0x8324('0xb7')](_0x8324('0x1c6'));}if(!this['isConfigured'](_0x4796a2[_0x8324('0x6f')])){return this[_0x8324('0x10')][_0x8324('0xb7')](_0x8324('0xd1'));}this['channel'][_0x8324('0xb7')](util[_0x8324('0x61')](_0x8324('0x1c7'),_0x4796a2[_0x8324('0x6f')]));var _0x1ed7f4=this[_0x8324('0x66')][_0x8324('0x7e')](this,_0x4796a2);if(_0x1ed7f4){this[_0x8324('0x10')]['noop'](util[_0x8324('0x61')](_0x8324('0x1c8'),_0x1ed7f4));var _0x27b266=this[_0x8324('0x10')][_0x8324('0x10c')](_0x1ed7f4);try{fs['unlink'](_0x1ed7f4+_0x8324('0x10e'));}catch(_0x1e1cd3){logger[_0x8324('0x2e')](_0x1e1cd3);}return _0x27b266;}return this[_0x8324('0x10')][_0x8324('0x2e')](_0x4796a2,_0x8324('0x1c9'));};AGIVertices[_0x8324('0x17')]['tts']=function(_0x3f6412){logger[_0x8324('0x30')](util[_0x8324('0x61')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x3f6412[_0x8324('0x3b')]));_0x3f6412[_0x8324('0x6f')]=_0x3f6412[_0x8324('0x6f')][_0x8324('0x65')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x3f6412[_0x8324('0x6f')])){return this[_0x8324('0x10')][_0x8324('0xb7')](_0x8324('0xd1'));}this['channel'][_0x8324('0xb7')](util[_0x8324('0x61')](_0x8324('0x1ca'),_0x3f6412[_0x8324('0x6f')]));var _0x181e08=this[_0x8324('0x6e')][_0x8324('0x7e')](this,_0x3f6412);if(_0x181e08){this[_0x8324('0x10')][_0x8324('0xb7')](util[_0x8324('0x61')](_0x8324('0x1cb'),_0x181e08));var _0x35aeae=this[_0x8324('0x10')]['streamFile'](_0x181e08);try{fs[_0x8324('0x10d')](_0x181e08+_0x8324('0x10e'));}catch(_0x2835c8){logger[_0x8324('0x2e')](_0x2835c8);}return _0x35aeae;}return this[_0x8324('0x10')][_0x8324('0x2e')](_0x3f6412,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x8324('0x17')][_0x8324('0x1cc')]=function(_0x160a3b){logger[_0x8324('0x30')](util[_0x8324('0x61')](_0x8324('0x1cd'),_0x160a3b[_0x8324('0x3b')]));if(!this[_0x8324('0x93')](_0x160a3b[_0x8324('0x15e')])){return this[_0x8324('0x10')][_0x8324('0x2e')](_0x160a3b,_0x8324('0x15f'));}logger[_0x8324('0x30')](util[_0x8324('0x61')](_0x8324('0x160'),this[_0x8324('0x10')][_0x8324('0x3d')],_0x160a3b['findBy']));var _0x5abb8e=this['agentUnpause'][_0x8324('0x7e')](this,_0x160a3b[_0x8324('0x15e')]);if(_0x5abb8e){logger[_0x8324('0x30')](util[_0x8324('0x61')](_0x8324('0x161'),this[_0x8324('0x10')][_0x8324('0x3d')],_0x160a3b[_0x8324('0x15e')]));this[_0x8324('0x10')][_0x8324('0xb7')](util[_0x8324('0x61')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8324('0x10')][_0x8324('0x3d')],_0x160a3b[_0x8324('0x15e')]));return{'code':0xc8,'result':_0x8324('0x162')};}else{logger[_0x8324('0x30')](util[_0x8324('0x61')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8324('0x10')][_0x8324('0x3d')],_0x160a3b['findBy']));this['channel'][_0x8324('0xb7')](util[_0x8324('0x61')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8324('0x10')]['callerid'],_0x160a3b[_0x8324('0x15e')]));return{'code':0xc8,'result':_0x8324('0x164')};}};AGIVertices['prototype']['voicemail']=function(_0x2808d6){logger[_0x8324('0x30')](util[_0x8324('0x61')](_0x8324('0x1ce'),_0x2808d6[_0x8324('0x3b')]));var _0x12acba=this[_0x8324('0x10')][_0x8324('0x64')](_0x8324('0x1cf'),[_0x2808d6['mailbox'],_0x2808d6[_0x8324('0x87')]]);if(_0x12acba[_0x8324('0xb0')]===-0x1){return _0x12acba;}return this[_0x8324('0x10')][_0x8324('0xb7')](util['format'](_0x8324('0xcb'),'VOICEMAIL',_0x2808d6[_0x8324('0x1d0')]));};AGIVertices[_0x8324('0x17')][_0x8324('0x1d1')]=function(_0x4a3dd7){logger[_0x8324('0x30')](util[_0x8324('0x61')](_0x8324('0x1d2'),_0x4a3dd7['label']));if(!this[_0x8324('0x93')](_0x4a3dd7[_0x8324('0xe1')])){return this[_0x8324('0x10')][_0x8324('0x2e')](_0x4a3dd7,_0x8324('0x1b4'));}var _0x23bd20=this[_0x8324('0x13')][_0x8324('0x7e')](this,_0x4a3dd7[_0x8324('0xe1')]);if(!_0x23bd20){return this[_0x8324('0x10')][_0x8324('0x2e')](_0x4a3dd7,'no\x20variable\x20found');}var _0x579a8c=this['channel']['getVariable'](_0x23bd20);return{'code':0xc8,'result':_0x579a8c[_0x8324('0xae')]?_0x579a8c['extra']:'-'};};String[_0x8324('0x17')][_0x8324('0xad')]=function(_0x2a4908,_0x1e8870){return this[_0x8324('0xac')](_0x2a4908)[_0x8324('0x1d3')](_0x1e8870);};module[_0x8324('0x1d4')]=AGIVertices; \ No newline at end of file +var _0x826a=['query','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','priority','accountcode','dnid','file','isNil','random','isEmpty','lastName','phone','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','has','dialTimezone','CALLERID(dialTimezone)','getContactByPhone','timezones','utcOffset','scheduledat','add','insertContact','minutes','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','format','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','timeout','number','includes','POST','PUT','method','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','url','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','Amy','aws_text_type','awsLex','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','noop','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','createCmContact','list_id','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','sestekasr','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','getSquareOdbc','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','setVariable','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','getUser','no\x20user\x20found','SIP/%s','opts','DIAL','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','createSquareMessage','speech','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','bot','DIALOGFLOW_%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','password','no\x20password\x20configured','ndassistant_url','audiofile','streamFile','unlink','.wav','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','no\x20trunk\x20selected','trunk_id','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Executed\x20command\x20%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','getData','maxdigit','test','mindigit','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','continueAt','context','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','beep','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','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','findBy','no\x20find\x20by\x20configured','agentLogin','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','response','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20found','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','digits','replace','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','getMailAccount','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','service','host','port','secure','authentication','auth','pass','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','getSmsAccount','no\x20sms\x20account\x20found','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','subproject','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','system','command','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','util','shelljs','randomstring','moment','mustache','request-promise','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','getVariable','getVariableById','then','name','catch','prototype','getSquareProject','getSquareProjectById','getSquareOdbcById','getUserById','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully'];(function(_0xaf649a,_0x4620e2){var _0x23f165=function(_0x2a2296){while(--_0x2a2296){_0xaf649a['push'](_0xaf649a['shift']());}};_0x23f165(++_0x4620e2);}(_0x826a,0x1aa));var _0xa826=function(_0x178c21,_0xada9d7){_0x178c21=_0x178c21-0x0;var _0xb2167f=_0x826a[_0x178c21];return _0xb2167f;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0xa826('0x0'));var _=require('lodash');var sh=require(_0xa826('0x1'));var odbc=require('odbc')();var rs=require(_0xa826('0x2'));var moment=require(_0xa826('0x3'));var Mustache=require(_0xa826('0x4'));var rp=require(_0xa826('0x5'));var logger=require('../../config/logger')(_0xa826('0x6'));var config=require(_0xa826('0x7'));var shared=require(_0xa826('0x8'));var scripts=require(_0xa826('0x9'));var FILES_PATH=_0xa826('0xa');var recursiveMapAttributes=[_0xa826('0xb'),_0xa826('0xc')];var verticesWithRetry=[_0xa826('0xd'),_0xa826('0xe'),_0xa826('0xf')];var AGIVertices=function(_0xe662ee,_0x1005e6,_0x2a6f4d){this[_0xa826('0x10')]=_0xe662ee;this[_0xa826('0x11')]=_0x1005e6;this[_0xa826('0x12')]=_0x2a6f4d;};AGIVertices['prototype'][_0xa826('0x13')]=function(_0x4b4caf,_0x18b609){this[_0xa826('0x11')][_0xa826('0x14')](_0x4b4caf)[_0xa826('0x15')](function(_0x212fac){_0x18b609(null,_0x212fac?_0x212fac[_0xa826('0x16')]:![]);})[_0xa826('0x17')](function(_0x528cb8){_0x18b609(_0x528cb8);});};AGIVertices[_0xa826('0x18')]['getVoiceQueue']=function(_0x3e99b0,_0x41c0c2){this['rpc']['getVoiceQueueById'](_0x3e99b0)['then'](function(_0x1b6d16){_0x41c0c2(null,_0x1b6d16?_0x1b6d16['name']:![]);})['catch'](function(_0x9a3788){_0x41c0c2(_0x9a3788);});};AGIVertices[_0xa826('0x18')][_0xa826('0x19')]=function(_0x5832b9,_0x208472){this[_0xa826('0x11')][_0xa826('0x1a')](_0x5832b9)[_0xa826('0x15')](function(_0x90486c){_0x208472(null,_0x90486c?_0x90486c['name']:![]);})[_0xa826('0x17')](function(_0x2938ba){_0x208472(_0x2938ba);});};AGIVertices[_0xa826('0x18')]['getSquareOdbc']=function(_0x5d8161,_0x156127){this[_0xa826('0x11')][_0xa826('0x1b')](_0x5d8161)[_0xa826('0x15')](function(_0x124564){_0x156127(null,_0x124564?_0x124564['dsn']:![]);})[_0xa826('0x17')](function(_0x2e7e90){_0x156127(_0x2e7e90);});};AGIVertices[_0xa826('0x18')]['getUser']=function(_0x5ddeef,_0x361ca5){this[_0xa826('0x11')][_0xa826('0x1c')](_0x5ddeef)['then'](function(_0x1d7adf){_0x361ca5(null,_0x1d7adf?_0x1d7adf[_0xa826('0x16')]:![]);})[_0xa826('0x17')](function(_0x448b4d){_0x361ca5(_0x448b4d);});};AGIVertices[_0xa826('0x18')]['getTrunk']=function(_0x13329a,_0x4fa5db){this[_0xa826('0x11')][_0xa826('0x1d')](_0x13329a)['then'](function(_0xfc0448){_0x4fa5db(null,_0xfc0448?_0xfc0448[_0xa826('0x16')]:![]);})[_0xa826('0x17')](function(_0xf132e0){_0x4fa5db(_0xf132e0);});};AGIVertices[_0xa826('0x18')][_0xa826('0x1e')]=function(_0x14e836,_0x3b9c6d){var _0x36ded2=this;this[_0xa826('0x11')][_0xa826('0x1f')](_0x14e836)[_0xa826('0x15')](function(_0x1f2749){_0x3b9c6d(null,_0x1f2749?_0x36ded2[_0xa826('0x20')](_0x1f2749[_0xa826('0x21')]):![]);})[_0xa826('0x17')](function(_0x55886f){_0x3b9c6d(_0x55886f);});};AGIVertices[_0xa826('0x18')]['getMailAccount']=function(_0x2dd810,_0x1b5160){this[_0xa826('0x11')][_0xa826('0x22')](_0x2dd810)[_0xa826('0x15')](function(_0x5d40f5){_0x1b5160(null,_0x5d40f5?_0x5d40f5:![]);})['catch'](function(_0x41ecbf){_0x1b5160(_0x41ecbf);});};AGIVertices[_0xa826('0x18')][_0xa826('0x23')]=function(_0x45a69e,_0x4cec68,_0x3d210f){this[_0xa826('0x12')]['sendMailMessage'](_0x45a69e,_0x4cec68)[_0xa826('0x15')](function(){_0x3d210f(null);})['catch'](function(_0x189c71){_0x3d210f(_0x189c71);});};AGIVertices[_0xa826('0x18')][_0xa826('0x24')]=function(_0x16700f,_0x24efa7){this['rpc'][_0xa826('0x25')](_0x16700f)[_0xa826('0x15')](function(_0x29404c){if(_0x29404c){if(_0x29404c[_0xa826('0x26')]){_0x24efa7(null,[_0x29404c[_0xa826('0x27')]]);}else{_0x24efa7(null,_[_0xa826('0x28')](_0x29404c[_0xa826('0x29')],_0xa826('0x27')));}}else{_0x24efa7(null,![]);}})[_0xa826('0x17')](function(_0xd2b875){_0x24efa7(_0xd2b875);});};AGIVertices[_0xa826('0x18')]['getSoundPath']=function(_0x46f50e){return util['format'](_0xa826('0x2a'),FILES_PATH,_0x46f50e);};AGIVertices['prototype'][_0xa826('0x2b')]=function(_0x2bae70,_0x31889f,_0x17bef8){odbc[_0xa826('0x2c')](_0x2bae70,function(_0x75f59){if(_0x75f59){logger[_0xa826('0x2d')](_0xa826('0x2e'),_0x75f59);_0x17bef8(_0x75f59);}else{logger[_0xa826('0x2f')](_0xa826('0x30'));odbc[_0xa826('0x31')](_0x31889f,function(_0x207495,_0x5911d3){if(_0x207495){logger[_0xa826('0x2f')](_0xa826('0x32'),_0x31889f);_0x17bef8(_0x207495);}else{logger[_0xa826('0x2f')]('Query\x20executed\x20correctly\x20%s',_0x31889f);odbc[_0xa826('0x33')](function(_0xeeb2d7){if(_0xeeb2d7){logger['error'](_0xa826('0x34'),_0xeeb2d7);}_0x17bef8(null,_0x5911d3);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x4316f9,_0x111a3c){this[_0xa826('0x11')][_0xa826('0x35')](_0x4316f9)[_0xa826('0x15')](function(_0x322187){_0x111a3c(null,_0x322187?_0x322187:![]);})['catch'](function(_0x86f209){_0x111a3c(_0x86f209);});};AGIVertices[_0xa826('0x18')][_0xa826('0x36')]=function(_0x14fc0d,_0x244fd3){this[_0xa826('0x11')]['createSmsMessage'](_0x14fc0d)[_0xa826('0x15')](function(_0x34017e){_0x244fd3(null,_0x34017e);})[_0xa826('0x17')](function(_0x162be1){_0x244fd3(_0x162be1);});};AGIVertices[_0xa826('0x18')]['createSquareDetailsReport']=function(_0x3f7df5,_0x317682,_0x2ea106){this[_0xa826('0x11')][_0xa826('0x37')]({'uniqueid':this[_0xa826('0x10')][_0xa826('0x38')],'node':_0x3f7df5[_0xa826('0x39')],'application':_0x3f7df5[_0xa826('0x3a')],'data':_0x317682||null,'project_name':this[_0xa826('0x10')][_0xa826('0x3b')],'callerid':this[_0xa826('0x10')]['callerid']})[_0xa826('0x15')](function(_0xb2d355){if(_0x2ea106){_0x2ea106(null,_0xb2d355);}})[_0xa826('0x17')](function(_0x487e41){if(_0x2ea106){_0x2ea106(_0x487e41);}});};AGIVertices[_0xa826('0x18')][_0xa826('0x3c')]=function(_0x94fb6f,_0x3e98c2,_0xf35854,_0x58ac74){this[_0xa826('0x11')][_0xa826('0x3c')]({'uniqueid':this[_0xa826('0x10')][_0xa826('0x38')],'callerid':this[_0xa826('0x10')][_0xa826('0x3d')],'calleridname':this[_0xa826('0x10')]['calleridname'],'context':this[_0xa826('0x10')]['context'],'extension':this['channel']['extension'],'priority':this[_0xa826('0x10')][_0xa826('0x3e')],'accountcode':this[_0xa826('0x10')][_0xa826('0x3f')],'dnid':this['channel'][_0xa826('0x40')],'projectName':this['channel']['arg_1'],'saveName':_0x3e98c2,'filename':_0x94fb6f[_0xa826('0x41')]||_0x3e98c2,'savePath':_0xf35854})[_0xa826('0x15')](function(_0x494df9){_0x58ac74(null,_0x494df9);})[_0xa826('0x17')](function(_0x189301){_0x58ac74(_0x189301);});};AGIVertices['prototype']['createSquareMessage']=function(_0x5b238e,_0x4c469a,_0x5782a0,_0x5b531d,_0x4f0b33){this[_0xa826('0x11')]['createSquareMessage']({'uniqueid':this[_0xa826('0x10')]['uniqueid'],'body':_0x5b238e,'direction':_0x4c469a,'providerName':_0x5782a0,'providerResponse':_0x5b531d})[_0xa826('0x15')](function(_0x28d232){if(_0x4f0b33){_0x4f0b33(null,_0x28d232);}})[_0xa826('0x17')](function(_0x302a52){if(_0x4f0b33){_0x4f0b33(_0x302a52);}});};AGIVertices[_0xa826('0x18')]['createCmContact']=function(_0x209704,_0x5a2ebc){var _0x5b0899=this;var _0x1a38f6=0x0;var _0x23478a={'firstName':_['isEmpty'](_0x209704[_0xa826('0x16')])||_[_0xa826('0x42')](_0x209704[_0xa826('0x16')])?'callback_'+Math[_0xa826('0x43')]():_0x209704[_0xa826('0x16')],'lastName':_[_0xa826('0x44')](_0x209704[_0xa826('0x45')])||_[_0xa826('0x42')](_0x209704[_0xa826('0x45')])?null:_0x209704[_0xa826('0x45')],'phone':_0x209704[_0xa826('0x46')],'ListId':_0x209704['list_id'],'scheduledat':_0x209704[_0xa826('0x47')],'callbackUniqueid':this[_0xa826('0x10')][_0xa826('0x38')],'tags':_0xa826('0x48'),'description':_0xa826('0x49')+_0x209704['scheduledAt'][_0xa826('0x4a')](),'priority':_0x209704[_0xa826('0x4b')]};if(_[_0xa826('0x4c')](_0x209704,'dialTimezone')){if(!_[_0xa826('0x42')](_0x209704[_0xa826('0x4d')])){var _0x4d62d0=_0x209704[_0xa826('0x4d')];if(_0x209704[_0xa826('0x4d')]==_0xa826('0x4e')){this[_0xa826('0x11')][_0xa826('0x4f')]({'phone':_0x209704[_0xa826('0x46')]})[_0xa826('0x15')](function(_0x115337){if(!_[_0xa826('0x42')](_0x115337)){var _0x2287ea=_0x115337[_0xa826('0x4d')];if(!_['isNil'](_0x2287ea)){var _0x39132b=shared[_0xa826('0x50')][_0x2287ea];if(!_[_0xa826('0x42')](_0x39132b)){var _0x2c3e11=-0x1*_0x39132b[_0xa826('0x51')];_0x23478a[_0xa826('0x52')]=moment(_0x209704[_0xa826('0x52')])[_0xa826('0x53')](_0x2c3e11,'minutes');_0x5b0899[_0xa826('0x54')](_0x23478a,_0x209704,_0x5a2ebc);}else{_0x5b0899[_0xa826('0x54')](_0x23478a,_0x209704,_0x5a2ebc);}}else{_0x5b0899[_0xa826('0x54')](_0x23478a,_0x209704,_0x5a2ebc);}}else{_0x5b0899['insertContact'](_0x23478a,_0x209704,_0x5a2ebc);}});}else{var _0x1a38f6=shared[_0xa826('0x50')][_0x4d62d0];if(!_[_0xa826('0x42')](_0x1a38f6)){var _0x4c9f11=-0x1*_0x1a38f6['utcOffset'];_0x23478a[_0xa826('0x52')]=moment(_0x209704[_0xa826('0x52')])[_0xa826('0x53')](_0x4c9f11,_0xa826('0x55'));_0x5b0899['insertContact'](_0x23478a,_0x209704,_0x5a2ebc);}else{_0x5b0899[_0xa826('0x54')](_0x23478a,_0x209704,_0x5a2ebc);}}}else{_0x5b0899[_0xa826('0x54')](_0x23478a,_0x209704,_0x5a2ebc);}}else{_0x5b0899[_0xa826('0x54')](_0x23478a,_0x209704,_0x5a2ebc);}};AGIVertices[_0xa826('0x18')][_0xa826('0x56')]=function(_0x46bc53,_0x11c789){this[_0xa826('0x11')][_0xa826('0x57')](_0x46bc53)['then'](function(_0x542806){_0x11c789(null,_0x542806?_0x542806['name']:![]);})['catch'](function(_0x215601){_0x11c789(_0x215601);});};AGIVertices[_0xa826('0x18')][_0xa826('0x58')]=function(_0x176a81,_0x4777fc,_0x23541c){var _0x4eddf0={'role':_0xa826('0x59')};_0x4eddf0[_0x176a81]=this[_0xa826('0x10')][_0xa826('0x3d')];this['rpc'][_0xa826('0x58')](_0x4eddf0,_0x4777fc,this[_0xa826('0x10')][_0xa826('0x38')])[_0xa826('0x15')](function(_0x3e4adb){_0x23541c(null,_[_0xa826('0x42')](_0x3e4adb)?![]:!![]);})[_0xa826('0x17')](function(_0x460cbb){logger[_0xa826('0x2d')](_0x460cbb);_0x23541c(null,![]);});};AGIVertices[_0xa826('0x18')][_0xa826('0x5a')]=function(_0x631f32,_0x400c85){var _0x35cc4e={'role':_0xa826('0x59')};_0x35cc4e[_0x631f32]=this['channel'][_0xa826('0x3d')];this['rpc'][_0xa826('0x5a')](_0x35cc4e)['then'](function(_0x36dd93){_0x400c85(null,_['isNil'](_0x36dd93)?![]:!![]);})[_0xa826('0x17')](function(_0x3036e5){logger[_0xa826('0x2d')](_0x3036e5);_0x400c85(null,![]);});};AGIVertices['prototype']['agentLogout']=function(_0x5ea2d2,_0x16222c){var _0x281f63={'role':_0xa826('0x59')};_0x281f63[_0x5ea2d2]=this['channel'][_0xa826('0x3d')];this[_0xa826('0x11')][_0xa826('0x5b')](_0x281f63)[_0xa826('0x15')](function(_0x594c8d){_0x16222c(null,_[_0xa826('0x42')](_0x594c8d)?![]:!![]);})[_0xa826('0x17')](function(_0x3a9f91){logger[_0xa826('0x2d')](_0x3a9f91);_0x16222c(null,![]);});};AGIVertices[_0xa826('0x18')]['agentLogin']=function(_0x5f0a0a,_0x28a81d){var _0x123031={'role':_0xa826('0x59')};_0x123031[_0x5f0a0a]=this[_0xa826('0x10')][_0xa826('0x3d')];var _0x501d6f=_0x5f0a0a!='internal'?util[_0xa826('0x5c')](_0xa826('0x5d'),_0xa826('0x5e'),this[_0xa826('0x10')][_0xa826('0x3d')]):undefined;this[_0xa826('0x11')]['agentLogin'](_0x123031,_0x501d6f)[_0xa826('0x15')](function(_0x518507){_0x28a81d(null,_[_0xa826('0x42')](_0x518507)?![]:!![]);})[_0xa826('0x17')](function(_0x53b55f){logger[_0xa826('0x2d')](_0x53b55f);_0x28a81d(null,![]);});};AGIVertices['prototype'][_0xa826('0x5f')]=function(_0x4791e2,_0x232b5f){sh[_0xa826('0x60')](_[_0xa826('0x61')](_0x4791e2),function(_0x355235,_0x1fe35d){var _0x2f00dd=_0x1fe35d['replace'](/(\r\n|\n|\r)/gm,'');_0x232b5f(null,_0x2f00dd);});};AGIVertices['prototype'][_0xa826('0x62')]=function(_0x575185,_0x6a2528){scripts[_0xa826('0x62')](_0x575185[_0xa826('0x63')],_0x575185['google_cloud_tts_text_type']||_0xa826('0x64'),_0x575185[_0xa826('0x64')],_0x575185[_0xa826('0x65')]||_0xa826('0x66'),_0x575185[_0xa826('0x67')]||'MALE',_0x575185[_0xa826('0x68')]||_0xa826('0x69'))[_0xa826('0x15')](function(_0xe2dc41){_0x6a2528(null,_0xe2dc41);})[_0xa826('0x17')](function(_0x423bee){_0x6a2528(_0x423bee);});};AGIVertices[_0xa826('0x18')][_0xa826('0x6a')]=function(_0x1b7eaf,_0x1f42f3){scripts['googleTTS'](_0x1b7eaf[_0xa826('0x64')],_0x1b7eaf[_0xa826('0x6b')]||'en',0x1)['then'](function(_0x5e0468){_0x1f42f3(null,_0x5e0468);})[_0xa826('0x17')](function(_0x27bc6e){_0x1f42f3(_0x27bc6e);});};AGIVertices['prototype'][_0xa826('0x6c')]=function(_0x5fc4ad,_0x336ca8){var _0x36a996={'uri':_0x5fc4ad['url'],'method':_0x5fc4ad['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x5fc4ad[_0xa826('0x6d')])===_0xa826('0x6e')&&parseInt(_0x5fc4ad['timeout'])>=0x1?parseInt(_0x5fc4ad[_0xa826('0x6d')])*0x3e8:0x5*0x3e8};if(_[_0xa826('0x6f')]([_0xa826('0x70'),_0xa826('0x71')],_0x36a996[_0xa826('0x72')][_0xa826('0x73')]())){try{_0x36a996[_0xa826('0x74')]=_0x5fc4ad[_0xa826('0xc')]?JSON['parse'](_0x5fc4ad[_0xa826('0xc')]):{};}catch(_0x2dbb78){logger[_0xa826('0x2d')](_0xa826('0x75'),_0x2dbb78);}}try{_0x36a996['headers']=_0x5fc4ad[_0xa826('0xb')]?JSON[_0xa826('0x76')](_0x5fc4ad[_0xa826('0xb')]):{};}catch(_0x3ca5ca){logger[_0xa826('0x2d')](_0xa826('0x77'),_0x3ca5ca);}if(_0x5fc4ad[_0xa826('0x78')]){try{var _0x57cf6d=require(_0x5fc4ad[_0xa826('0x78')])[_0xa826('0x79')](this,_0x36a996);_0x36a996[_0xa826('0x7a')]=Mustache[_0xa826('0x7b')](_0x5fc4ad[_0xa826('0x7c')],_0x57cf6d,{},['$$','$$']);if(_0x36a996[_0xa826('0x7d')]){_0x36a996['headers']=JSON[_0xa826('0x76')](Mustache[_0xa826('0x7b')](JSON[_0xa826('0x7e')](_0x36a996['headers']),_0x57cf6d,{},['$$','$$']));}if(_0x36a996[_0xa826('0x74')]){_0x36a996[_0xa826('0x74')]=JSON[_0xa826('0x76')](Mustache[_0xa826('0x7b')](JSON['stringify'](_0x36a996[_0xa826('0x74')]),_0x57cf6d,{},['$$','$$']));}}catch(_0x354a12){logger['error'](_0xa826('0x7f'),_0x354a12);}}rp(_0x36a996)['then'](function(_0x4546da){var _0x1ecd0a={'statusCode':_0x4546da[_0xa826('0x80')]||0xc8,'statusMessage':_0x4546da[_0xa826('0x81')]||'OK','headers':_0x4546da[_0xa826('0x7d')]||{},'body':_0x4546da[_0xa826('0x74')]||{}};_0x336ca8(null,_0x1ecd0a);})['catch'](function(_0x31cb45){var _0x1d436d={'statusCode':_0x31cb45[_0xa826('0x80')]||0x1f4,'statusMessage':_0x31cb45[_0xa826('0x82')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x31cb45[_0xa826('0x83')][_0xa826('0x7d')]||{},'body':_0x31cb45[_0xa826('0x83')][_0xa826('0x74')]||{}};_0x336ca8(null,_0x1d436d);});};AGIVertices[_0xa826('0x18')][_0xa826('0x84')]=function(_0x3329ce,_0x47cf93){scripts['googleDialogflow'](this['channel'][_0xa826('0x38')],_0x3329ce[_0xa826('0x85')],_0x3329ce[_0xa826('0x64')],_0x3329ce[_0xa826('0x86')]||'en')[_0xa826('0x15')](function(_0x5b5d4e){_0x47cf93(null,_0x5b5d4e);})['catch'](function(_0x197160){_0x47cf93(_0x197160);});};AGIVertices['prototype']['googleDialogflowV2']=function(_0x39d5d8,_0x4755ff){scripts[_0xa826('0x87')](this[_0xa826('0x10')]['uniqueid'],_0x39d5d8['dialogflowV2_project_id'],_0x39d5d8[_0xa826('0x88')],_0x39d5d8[_0xa826('0x89')],_0x39d5d8[_0xa826('0x64')],_0x39d5d8[_0xa826('0x8a')]||'en')[_0xa826('0x15')](function(_0x146c77){_0x4755ff(null,_0x146c77);})['catch'](function(_0x89b7d3){_0x4755ff(_0x89b7d3);});};AGIVertices[_0xa826('0x18')][_0xa826('0x8b')]=function(_0x1f3fa5,_0x2e5e2f){scripts['sestekNDA'](this[_0xa826('0x10')],_0x1f3fa5)['then'](function(_0x10e9ac){_0x2e5e2f(null,_0x10e9ac);})[_0xa826('0x17')](function(_0x37f39a){_0x2e5e2f(_0x37f39a);});};AGIVertices[_0xa826('0x18')][_0xa826('0x8c')]=function(_0x1ff7b8,_0x11790c){scripts[_0xa826('0x8c')](_0x1ff7b8['key'],_0x1ff7b8[_0xa826('0x64')],_0x1ff7b8[_0xa826('0x8d')]||_0xa826('0x66'),_0x1ff7b8[_0xa826('0x8e')])[_0xa826('0x15')](function(_0x3d7b5a){_0x11790c(null,_0x3d7b5a);})[_0xa826('0x17')](function(_0x738b0c){_0x11790c(_0x738b0c);});};AGIVertices[_0xa826('0x18')][_0xa826('0x8f')]=function(_0x2d1d3b,_0x5be015,_0x140106){scripts[_0xa826('0x8f')](_0x5be015,_0x2d1d3b[_0xa826('0x85')],_0x2d1d3b[_0xa826('0x90')]||_0xa826('0x66'),this[_0xa826('0x91')](_0x2d1d3b['model'])?_0x2d1d3b[_0xa826('0x92')]:undefined)[_0xa826('0x15')](function(_0x1201e8){_0x140106(null,_0x1201e8);})['catch'](function(_0x3ae081){_0x140106(_0x3ae081);});};AGIVertices['prototype'][_0xa826('0x93')]=function(_0x28eb15,_0x5f4500){scripts['awsPolly'](_0x28eb15[_0xa826('0x94')],_0x28eb15[_0xa826('0x95')],_0x28eb15['aws_polly_region'],_0x28eb15['aws_polly_voice']||_0xa826('0x96'),_0x28eb15['text'],_0x28eb15[_0xa826('0x97')]||'text')['then'](function(_0x189c1c){_0x5f4500(null,_0x189c1c);})['catch'](function(_0x21a8a4){_0x5f4500(_0x21a8a4);});};AGIVertices['prototype'][_0xa826('0x98')]=function(_0x50f3b6,_0x4eaa94){scripts[_0xa826('0x98')](this[_0xa826('0x10')]['uniqueid'],_0x50f3b6[_0xa826('0x94')],_0x50f3b6['aws_secret_access_key'],_0x50f3b6[_0xa826('0x99')],_0x50f3b6[_0xa826('0x64')],_0x50f3b6['aws_bot_name'])['then'](function(_0x555f0b){_0x4eaa94(null,_0x555f0b);})['catch'](function(_0x390cfe){_0x4eaa94(_0x390cfe);});};AGIVertices['prototype'][_0xa826('0x9a')]=function(_0x2f50f0,_0x15e164,_0x552986){scripts[_0xa826('0x9a')](_0x15e164,_0x2f50f0[_0xa826('0x85')],_0x2f50f0[_0xa826('0x9b')]||_0xa826('0x66'))['then'](function(_0x34a50b){_0x552986(null,_0x34a50b);})['catch'](function(_0x3650b1){_0x552986(_0x3650b1);});};AGIVertices[_0xa826('0x18')][_0xa826('0x9c')]=function(_0x3d73af,_0x12ac0a,_0x130bbf){scripts[_0xa826('0x9c')](_0x12ac0a,_0x3d73af[_0xa826('0x9d')],_0x3d73af[_0xa826('0x9e')],_0x3d73af[_0xa826('0x7a')])[_0xa826('0x15')](function(_0x51f67b){_0x130bbf(null,_0x51f67b);})[_0xa826('0x17')](function(_0x14c416){_0x130bbf(_0x14c416);});};AGIVertices['prototype'][_0xa826('0x9f')]=function(_0x4a29f5){var _0x1c50d0=_[_0xa826('0x6f')](verticesWithRetry,_0x4a29f5[_0xa826('0x3a')])?_0x4a29f5:_[_0xa826('0xa0')](_0x4a29f5);for(var _0x232cad in _0x1c50d0){if(_0x1c50d0[_0xa826('0xa1')](_0x232cad)){if(_0x1c50d0[_0x232cad]&&_[_0xa826('0xa2')](_0x1c50d0[_0x232cad])){if(_[_0xa826('0x6f')](recursiveMapAttributes,_0x232cad)){_0x1c50d0[_0x232cad]=this[_0xa826('0xa3')](_0x1c50d0[_0x232cad]);}else{_0x1c50d0[_0x232cad]=this[_0xa826('0xa4')](_0x1c50d0[_0x232cad]);}}}}return _0x1c50d0;};AGIVertices[_0xa826('0x18')][_0xa826('0xa5')]=function(_0x5b0c10){for(var _0x10fa36 in _0x5b0c10){if(_0x5b0c10[_0xa826('0xa1')](_0x10fa36)){if(_[_0xa826('0xa6')](_0x5b0c10[_0x10fa36])){this['recursiveNodeIndex'](_0x5b0c10[_0x10fa36]);}else if(_[_0xa826('0xa7')](_0x5b0c10[_0x10fa36])){for(var _0x3f34e3=0x0;_0x3f34e3<_0x5b0c10[_0x10fa36][_0xa826('0xa8')];_0x3f34e3++){this['recursiveNodeIndex'](_0x5b0c10[_0x10fa36][_0x3f34e3]);}}else if(_[_0xa826('0xa2')](_0x5b0c10[_0x10fa36])){_0x5b0c10[_0x10fa36]=this[_0xa826('0xa4')](_0x5b0c10[_0x10fa36]);}}}};AGIVertices[_0xa826('0x18')][_0xa826('0xa9')]=function(_0x330b21,_0x197015){for(var _0x4220e7 in _0x330b21){if(_0x330b21['hasOwnProperty'](_0x4220e7)){if(_[_0xa826('0xa6')](_0x330b21[_0x4220e7])){if(!_[_0xa826('0x44')](_0x330b21[_0x4220e7])){this[_0xa826('0xa9')](_0x330b21[_0x4220e7],util[_0xa826('0x5c')](_0xa826('0xaa'),_0x197015,_0x4220e7));}}else if(_[_0xa826('0xa7')](_0x330b21[_0x4220e7])){for(var _0x3d10a6=0x0;_0x3d10a6<_0x330b21[_0x4220e7][_0xa826('0xa8')];_0x3d10a6++){this[_0xa826('0xa9')](_0x330b21[_0x4220e7][_0x3d10a6],util[_0xa826('0x5c')]('%s.%s',_0x197015,_0x4220e7+'['+_0x3d10a6+']'));}}else{if(!_[_0xa826('0x42')](_0x330b21[_0x4220e7])){this[_0xa826('0x10')]['setVariable'](util[_0xa826('0x5c')](_0xa826('0xaa'),_0x197015,_0x4220e7),_0x330b21[_0x4220e7]);}}}}};AGIVertices[_0xa826('0x18')]['replaceObjectAllVariables']=function(_0x3c0826){try{var _0x33d9a1=JSON[_0xa826('0x76')](_0x3c0826);this[_0xa826('0xa5')](_0x33d9a1);return JSON[_0xa826('0x7e')](_0x33d9a1);}catch(_0x1e75d2){return this['replaceAllVariables'](_0x3c0826);}};AGIVertices['prototype']['replaceAllVariables']=function(_0x42348a){var _0x2c9ee5=_0x42348a['split']('{');for(var _0x52f21f=0x1;_0x52f21f<_0x2c9ee5[_0xa826('0xa8')];_0x52f21f+=0x1){var _0x462f3c=_0x2c9ee5[_0x52f21f][_0xa826('0xab')]('}');if(_0x462f3c[_0xa826('0xa8')]>0x1){_0x42348a=_0x42348a[_0xa826('0xac')]('{'+_0x462f3c[0x0]+'}',this[_0xa826('0x10')][_0xa826('0x13')](_0x462f3c[0x0])[_0xa826('0xad')]||_0x462f3c[0x0]);}}if(_0x2c9ee5[_0xa826('0xa8')]===0x1){return _0x42348a['toString']();}return this[_0xa826('0xa4')](_0x42348a);};AGIVertices[_0xa826('0x18')][_0xa826('0xae')]=function(_0xaaa310,_0x6fed86){var _0x4ca894=this['channel'][_0xa826('0x13')](_0xaaa310);if(_0x4ca894[_0xa826('0xaf')]===-0x1){return _0x4ca894;}logger['info'](util[_0xa826('0x5c')](_0xa826('0xb0'),_0x6fed86,_0x4ca894['extra']));return this[_0xa826('0x10')]['setVariable'](_0x6fed86,_0x4ca894['extra']);};AGIVertices['prototype']['isConfigured']=function(_0xfac155){return _0xfac155&&_0xfac155!=='0'&&_0xfac155!=='-1'&&_0xfac155!=='';};AGIVertices[_0xa826('0x18')][_0xa826('0xb1')]=function(_0x27fe9f){this[_0xa826('0x37')]['sync'](this,_0x27fe9f,'-');_0x27fe9f['retry']=_0x27fe9f[_0xa826('0xb1')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xa826('0x18')][_0xa826('0xb2')]=function(_0x4a3821){logger['info'](util[_0xa826('0x5c')](_0xa826('0xb3'),_0x4a3821['label']));if(!this['isConfigured'](_0x4a3821[_0xa826('0x64')])){return this[_0xa826('0x10')]['noop'](_0xa826('0xb4'));}var _0x55e32a='\x22'+_0x4a3821[_0xa826('0x64')]+'\x22';if(this[_0xa826('0x91')](_0x4a3821[_0xa826('0x83')])){_0x55e32a+=','+_0x4a3821['options'];}var _0x3e16dc=this['channel'][_0xa826('0x60')]('MRCPSynth',_0x55e32a);if(_0x3e16dc[_0xa826('0xaf')]===-0x1){return _0x3e16dc;}return this[_0xa826('0x10')]['noop'](util['format'](_0xa826('0xb5'),_0x55e32a));};AGIVertices['prototype'][_0xa826('0xb6')]=function(_0x43d6c9){logger[_0xa826('0x2f')](util[_0xa826('0x5c')](_0xa826('0xb7'),_0x43d6c9[_0xa826('0x39')]));if(!this['isConfigured'](_0x43d6c9[_0xa826('0xb8')])){return this['channel'][_0xa826('0xb9')]('no\x20grammar\x20configured');}var _0x41b8bb=_0x43d6c9[_0xa826('0xb8')];if(this[_0xa826('0x91')](_0x43d6c9[_0xa826('0x83')])){_0x41b8bb+=','+_0x43d6c9[_0xa826('0x83')];}var _0x40cae1=this[_0xa826('0x10')][_0xa826('0x60')](_0xa826('0xba'),_0x41b8bb);if(_0x40cae1[_0xa826('0xaf')]===-0x1){return _0x40cae1;}var _0x333935=this[_0xa826('0xae')](_0xa826('0xbb'),_0xa826('0xbc'));if(_0x333935[_0xa826('0xaf')]===-0x1){return _0x333935;}var _0x26720d=this[_0xa826('0xae')](_0xa826('0xbd'),_0xa826('0xbe'));if(_0x26720d[_0xa826('0xaf')]===-0x1){return _0x26720d;}var _0x2ebe18=this['getAndSetVariable'](_0xa826('0xbf'),_0xa826('0xc0'));if(_0x2ebe18[_0xa826('0xaf')]===-0x1){return _0x2ebe18;}return this[_0xa826('0x10')][_0xa826('0xb9')](util[_0xa826('0x5c')](_0xa826('0xc1'),_0x41b8bb));};AGIVertices[_0xa826('0x18')]['agi']=function(_0x2a22ae){logger[_0xa826('0x2f')](util[_0xa826('0x5c')](_0xa826('0xc2'),_0x2a22ae[_0xa826('0x39')]));return this['channel']['agi']([_0x2a22ae['command'],_0x2a22ae[_0xa826('0xc3')]]);};AGIVertices[_0xa826('0x18')][_0xa826('0xc4')]=function(_0x2ee994){logger['info'](util['format'](_0xa826('0xc5'),_0x2ee994[_0xa826('0x39')]));if(this[_0xa826('0x91')](_0x2ee994['timeout'])){logger[_0xa826('0x2f')](util[_0xa826('0x5c')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x2ee994[_0xa826('0x6d')]));var _0x12e03a=this[_0xa826('0x10')][_0xa826('0xc6')](_0x2ee994[_0xa826('0x6d')]);if(_0x12e03a[_0xa826('0xaf')]===-0x1){return _0x12e03a;}}return this[_0xa826('0x10')][_0xa826('0xc4')]();};AGIVertices[_0xa826('0x18')][_0xa826('0x48')]=function(_0x1bdf75){logger[_0xa826('0x2f')](util[_0xa826('0x5c')](_0xa826('0xc7'),_0x1bdf75[_0xa826('0x39')]));if(!this['isConfigured'](_0x1bdf75['list_id'])){return this[_0xa826('0x10')][_0xa826('0x2d')](_0x1bdf75,_0xa826('0xc8'));}_0x1bdf75['scheduledAt']=moment();if(this[_0xa826('0x91')](_0x1bdf75[_0xa826('0xc9')])){_0x1bdf75['scheduledAt']=moment()[_0xa826('0x53')](_0x1bdf75['delay'],_0xa826('0x55'));}if(!this[_0xa826('0x91')](_0x1bdf75['callback_priority'])){_0x1bdf75[_0xa826('0x4b')]=0x2;}this[_0xa826('0xca')][_0xa826('0x79')](this,_0x1bdf75);return this[_0xa826('0x10')][_0xa826('0xb9')](util['format']('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x1bdf75[_0xa826('0x46')],_0x1bdf75[_0xa826('0xcb')],_0x1bdf75['scheduledAt']));};AGIVertices[_0xa826('0x18')][_0xa826('0xcc')]=function(_0xd7e42b){logger[_0xa826('0x2f')](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0xd7e42b[_0xa826('0x39')]));var _0x46e930=this[_0xa826('0x10')][_0xa826('0x60')](_0xd7e42b[_0xa826('0xcd')],_0xd7e42b[_0xa826('0x83')]);if(_0x46e930[_0xa826('0xaf')]===-0x1){return _0x46e930;}return this[_0xa826('0x10')][_0xa826('0xb9')](util['format'](_0xa826('0xce'),_0xd7e42b[_0xa826('0xcd')],_0xd7e42b[_0xa826('0x83')]));};AGIVertices[_0xa826('0x18')][_0xa826('0xcf')]=function(_0xebb5b1){logger['info'](util[_0xa826('0x5c')](_0xa826('0xd0'),_0xebb5b1[_0xa826('0x39')]));if(!this[_0xa826('0x91')](_0xebb5b1[_0xa826('0x64')])){return this[_0xa826('0x10')]['noop'](_0xa826('0xb4'));}var _0x446123='\x22'+_0xebb5b1[_0xa826('0x64')]+'\x22';if(this[_0xa826('0x91')](_0xebb5b1['options'])){_0x446123+=','+_0xebb5b1['options'];}var _0x4a74e9=this[_0xa826('0x10')][_0xa826('0x60')](_0xa826('0xd1'),_0x446123);if(_0x4a74e9[_0xa826('0xaf')]===-0x1){return _0x4a74e9;}return this['channel'][_0xa826('0xb9')](util[_0xa826('0x5c')]('Executed\x20command\x20MRCPSynth\x20%s',_0x446123));};AGIVertices[_0xa826('0x18')][_0xa826('0xd2')]=function(_0x40e23c){logger[_0xa826('0x2f')](util[_0xa826('0x5c')](_0xa826('0xd3'),_0x40e23c[_0xa826('0x39')]));if(!this[_0xa826('0x91')](_0x40e23c['text'])){return this[_0xa826('0x10')]['noop'](_0xa826('0xb4'));}var _0x116154='\x22'+_0x40e23c[_0xa826('0x64')]+'\x22';if(this[_0xa826('0x91')](_0x40e23c[_0xa826('0x83')])){_0x116154+=','+_0x40e23c[_0xa826('0x83')];}var _0x3160d6=this[_0xa826('0x10')][_0xa826('0x60')]('MRCPSynth',_0x116154);if(_0x3160d6[_0xa826('0xaf')]===-0x1){return _0x3160d6;}return this[_0xa826('0x10')][_0xa826('0xb9')](util[_0xa826('0x5c')]('Executed\x20command\x20MRCPSynth\x20%s',_0x116154));};AGIVertices['prototype']['lumenvoxasr']=function(_0x319a67){logger[_0xa826('0x2f')](util[_0xa826('0x5c')](_0xa826('0xd4'),_0x319a67[_0xa826('0x39')]));if(!this[_0xa826('0x91')](_0x319a67[_0xa826('0xb8')])){return this[_0xa826('0x10')]['noop'](_0xa826('0xd5'));}var _0x5d027c=_0x319a67[_0xa826('0xb8')];if(this['isConfigured'](_0x319a67[_0xa826('0x83')])){_0x5d027c+=','+_0x319a67['options'];}var _0x9b8ec0=this[_0xa826('0x10')]['exec'](_0xa826('0xba'),_0x5d027c);if(_0x9b8ec0['result']===-0x1){return _0x9b8ec0;}var _0x72b3e2=this['getAndSetVariable'](_0xa826('0xbb'),_0xa826('0xd6'));if(_0x72b3e2[_0xa826('0xaf')]===-0x1){return _0x72b3e2;}var _0x2622e0=this[_0xa826('0xae')](_0xa826('0xbd'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x2622e0[_0xa826('0xaf')]===-0x1){return _0x2622e0;}var _0x559a01=this['getAndSetVariable'](_0xa826('0xbf'),'LUMENVOX_ASR_INSTANCE');if(_0x559a01['result']===-0x1){return _0x559a01;}return this['channel'][_0xa826('0xb9')](util[_0xa826('0x5c')](_0xa826('0xc1'),_0x5d027c));};AGIVertices[_0xa826('0x18')][_0xa826('0xd7')]=function(_0x490ec6){logger[_0xa826('0x2f')](util[_0xa826('0x5c')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x490ec6[_0xa826('0x39')]));if(!this[_0xa826('0x91')](_0x490ec6['grammar'])){return this[_0xa826('0x10')][_0xa826('0xb9')](_0xa826('0xd5'));}var _0x3c3ea7=_0x490ec6['grammar'];if(this[_0xa826('0x91')](_0x490ec6[_0xa826('0x83')])){_0x3c3ea7+=','+_0x490ec6[_0xa826('0x83')];}var _0x5122f3=this[_0xa826('0x10')][_0xa826('0x60')](_0xa826('0xba'),_0x3c3ea7);if(_0x5122f3[_0xa826('0xaf')]===-0x1){return _0x5122f3;}var _0x4245e6=this[_0xa826('0xae')](_0xa826('0xbb'),'SESTEK_ASR_CONFIDENCE');if(_0x4245e6['result']===-0x1){return _0x4245e6;}var _0x50b667=this[_0xa826('0xae')](_0xa826('0xbd'),'SESTEK_ASR_TRANSCRIPT');if(_0x50b667[_0xa826('0xaf')]===-0x1){return _0x50b667;}var _0x22eb3d=this[_0xa826('0xae')]('RECOG_INSTANCE()',_0xa826('0xd8'));if(_0x22eb3d[_0xa826('0xaf')]===-0x1){return _0x22eb3d;}return this['channel']['noop'](util[_0xa826('0x5c')](_0xa826('0xc1'),_0x3c3ea7));};AGIVertices['prototype'][_0xa826('0xd9')]=function(_0x149ec5){logger[_0xa826('0x2f')](util[_0xa826('0x5c')](_0xa826('0xda'),_0x149ec5[_0xa826('0x39')]));if(!this[_0xa826('0x91')](_0x149ec5['odbc_id'])){return this[_0xa826('0x10')][_0xa826('0x2d')](_0x149ec5,_0xa826('0xdb'));}var _0x2c7f00=this[_0xa826('0xdc')][_0xa826('0x79')](this,_0x149ec5[_0xa826('0xdd')]);if(!_0x2c7f00){return this['channel'][_0xa826('0x2d')](_0x149ec5,_0xa826('0xde'));}if(!this[_0xa826('0x91')](_0x149ec5[_0xa826('0x31')])){return this['channel']['error'](_0x149ec5,_0xa826('0xdf'));}var _0x2c40ca=_0x149ec5['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xa826('0x10')][_0xa826('0xb9')](util[_0xa826('0x5c')](_0xa826('0xe0'),_0x2c40ca));var _0x4c9375=this[_0xa826('0x2b')][_0xa826('0x79')](this,_0x2c7f00,_0x2c40ca);this[_0xa826('0x37')]['sync'](this,_0x149ec5,_0x2c40ca);if(!this[_0xa826('0x91')](_0x149ec5[_0xa826('0xe1')])){return this[_0xa826('0x10')]['noop'](_0xa826('0xe2'));}var _0x2cd1f6=this[_0xa826('0x13')][_0xa826('0x79')](this,_0x149ec5['variable_id']);if(!_0x2cd1f6){return this[_0xa826('0x10')]['error'](_0x149ec5,_0xa826('0xe3'));}var _0x20ed5f=this;_0x4c9375[_0xa826('0xe4')](function(_0x10c91a,_0x384836){Object[_0xa826('0xe5')](_0x10c91a)[_0xa826('0xe4')](function(_0x24657b){_0x20ed5f[_0xa826('0x10')]['setVariable'](util[_0xa826('0x5c')](_0xa826('0xe6'),_0x2cd1f6,_0x384836,_0x24657b),_0x10c91a[_0x24657b]);});});this[_0xa826('0x10')][_0xa826('0xe7')](util[_0xa826('0x5c')](_0xa826('0xe8'),_0x2cd1f6),_0x4c9375['length']);return this[_0xa826('0x10')][_0xa826('0xb9')](util[_0xa826('0x5c')](_0xa826('0xe9'),_0x2cd1f6));};AGIVertices[_0xa826('0x18')][_0xa826('0xea')]=function(_0x15d7a0){logger[_0xa826('0xeb')](util[_0xa826('0x5c')](_0xa826('0xec'),_0x15d7a0[_0xa826('0x39')]));if(!this[_0xa826('0x91')](_0x15d7a0[_0xa826('0xed')])){return this['channel'][_0xa826('0x2d')](_0x15d7a0,'no\x20user\x20selected');}var _0xca9ee=this[_0xa826('0xee')][_0xa826('0x79')](this,_0x15d7a0['sip_id']);if(!_0xca9ee){return this[_0xa826('0x10')][_0xa826('0x2d')](_0x15d7a0,_0xa826('0xef'));}var _0x11f5f2=this[_0xa826('0x10')][_0xa826('0x60')]('DIAL',[util[_0xa826('0x5c')](_0xa826('0xf0'),_0xca9ee),_0x15d7a0[_0xa826('0x6d')],_0x15d7a0[_0xa826('0xf1')],_0x15d7a0[_0xa826('0x7c')]]);if(_0x11f5f2['result']===-0x1){return _0x11f5f2;}return this[_0xa826('0x10')][_0xa826('0xb9')](util[_0xa826('0x5c')]('Executed\x20command\x20%s',_0xa826('0xf2')));};AGIVertices[_0xa826('0x18')]['dialogflow']=function(_0x14fb82){logger[_0xa826('0x2f')](util[_0xa826('0x5c')](_0xa826('0xf3'),_0x14fb82[_0xa826('0x39')]));if(!this[_0xa826('0x91')](_0x14fb82[_0xa826('0x85')])){return this[_0xa826('0x10')][_0xa826('0xb9')](_0xa826('0xf4'));}if(!this[_0xa826('0x91')](_0x14fb82[_0xa826('0x64')])){return this[_0xa826('0x10')][_0xa826('0xb9')](_0xa826('0xb4'));}this[_0xa826('0x10')]['bot']=!![];this[_0xa826('0x37')](_0x14fb82);this[_0xa826('0xf5')](_0x14fb82['text'],'in','','');this['channel'][_0xa826('0xb9')](util[_0xa826('0x5c')]('Trying\x20Dialogflow:\x20%s',_0x14fb82[_0xa826('0x64')]));var _0x2d4bf7=this['googleDialogflow'][_0xa826('0x79')](this,_0x14fb82);if(_0x2d4bf7){for(var _0x33fff6 in _0x2d4bf7){if(_0x2d4bf7[_0xa826('0xa1')](_0x33fff6)){this[_0xa826('0x10')][_0xa826('0xe7')](util[_0xa826('0x5c')]('DIALOGFLOW_%s',_0x33fff6['toUpperCase']()),_0x2d4bf7[_0x33fff6]);}}this['createSquareMessage'](_0x2d4bf7[_0xa826('0xf6')],_0xa826('0xf7'),_0xa826('0xf8'),'');return this[_0xa826('0x10')]['noop'](util[_0xa826('0x5c')](_0xa826('0xf9'),_0x2d4bf7['speech']));}return this[_0xa826('0x10')][_0xa826('0x2d')](_0x14fb82,_0xa826('0xfa'));};AGIVertices[_0xa826('0x18')][_0xa826('0xfb')]=function(_0x183edb){logger['info'](util[_0xa826('0x5c')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x183edb[_0xa826('0x39')]));if(!this[_0xa826('0x91')](_0x183edb[_0xa826('0xfc')])){return this[_0xa826('0x10')][_0xa826('0xb9')](_0xa826('0xfd'));}if(!this[_0xa826('0x91')](_0x183edb[_0xa826('0x88')])){return this[_0xa826('0x10')][_0xa826('0xb9')](_0xa826('0xfe'));}if(!this[_0xa826('0x91')](_0x183edb[_0xa826('0x89')])){return this[_0xa826('0x10')][_0xa826('0xb9')](_0xa826('0xff'));}if(!this[_0xa826('0x91')](_0x183edb['dialogflowV2_language'])){return this[_0xa826('0x10')][_0xa826('0xb9')](_0xa826('0x100'));}if(!this[_0xa826('0x91')](_0x183edb['text'])){return this[_0xa826('0x10')]['noop'](_0xa826('0xb4'));}this[_0xa826('0x10')][_0xa826('0x101')]=!![];this[_0xa826('0x37')](_0x183edb);this[_0xa826('0xf5')](_0x183edb[_0xa826('0x64')],'in','','');this[_0xa826('0x10')]['noop'](util[_0xa826('0x5c')]('Trying\x20DialogflowV2:\x20%s',_0x183edb['text']));var _0x459924=this[_0xa826('0x87')][_0xa826('0x79')](this,_0x183edb);if(_0x459924){for(var _0x3b11a4 in _0x459924){if(_0x459924['hasOwnProperty'](_0x3b11a4)){if(_0x3b11a4!=='providerResponse'){this['channel'][_0xa826('0xe7')](util['format'](_0xa826('0x102'),_0x3b11a4[_0xa826('0x73')]()),_0x459924[_0x3b11a4]);}}}this['createSquareMessage'](_0x459924[_0xa826('0xf6')],_0xa826('0xf7'),_0xa826('0xfb'),_0x459924[_0xa826('0x103')]);return this['channel'][_0xa826('0xb9')](util['format'](_0xa826('0x104'),_0x459924[_0xa826('0xf6')]));}return this[_0xa826('0x10')][_0xa826('0x2d')](_0x183edb,_0xa826('0x105'));};AGIVertices[_0xa826('0x18')][_0xa826('0x106')]=function(_0x5169f3){logger['info'](util[_0xa826('0x5c')](_0xa826('0x107'),_0x5169f3[_0xa826('0x39')]));if(!this[_0xa826('0x91')](_0x5169f3[_0xa826('0x108')])){return this[_0xa826('0x10')][_0xa826('0xb9')]('no\x20ndauth\x20url\x20configured');}if(!this[_0xa826('0x91')](_0x5169f3[_0xa826('0x109')])){return this[_0xa826('0x10')][_0xa826('0xb9')]('no\x20username\x20configured');}if(!this[_0xa826('0x91')](_0x5169f3[_0xa826('0x10a')])){return this[_0xa826('0x10')]['noop'](_0xa826('0x10b'));}if(!this[_0xa826('0x91')](_0x5169f3[_0xa826('0x10c')])){return this[_0xa826('0x10')][_0xa826('0xb9')](_0xa826('0xb4'));}this[_0xa826('0x10')]['bot']=!![];this[_0xa826('0x37')](_0x5169f3);this[_0xa826('0xf5')](_0x5169f3['text'],'in','','');this[_0xa826('0x10')][_0xa826('0xb9')](util['format']('Trying\x20SestekNDA:\x20%s',_0x5169f3['text']));var _0xc447b6=this[_0xa826('0x8b')]['sync'](this,_0x5169f3);if(_0xc447b6){for(var _0x273b92 in _0xc447b6){if(_0xc447b6[_0xa826('0xa1')](_0x273b92)){this['channel'][_0xa826('0xe7')](util[_0xa826('0x5c')]('SESTEK_NDA_%s',_0x273b92[_0xa826('0x73')]()),_0xc447b6[_0x273b92]);}}this[_0xa826('0xf5')](_0xc447b6[_0xa826('0xf6')],_0xa826('0xf7'),'sesteknda','');if(_0xc447b6['audiofile']){this['channel'][_0xa826('0xb9')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0xc447b6[_0xa826('0x10d')]));var _0x20c96e=this[_0xa826('0x10')][_0xa826('0x10e')](_0xc447b6[_0xa826('0x10d')]);try{fs[_0xa826('0x10f')](_0xc447b6[_0xa826('0x10d')]+_0xa826('0x110'));}catch(_0x285b71){logger['error'](_0x285b71);}return _0x20c96e;}else{return this[_0xa826('0x10')][_0xa826('0xb9')](util['format']('SestekNDA\x20Result\x20%s',_0xc447b6[_0xa826('0xf6')]));}}return this['channel'][_0xa826('0x2d')](_0x5169f3,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xa826('0x18')][_0xa826('0x111')]=function(_0x5d2cf4){logger[_0xa826('0x2f')](util[_0xa826('0x5c')](_0xa826('0x112'),_0x5d2cf4[_0xa826('0x39')]));return this['channel'][_0xa826('0xb9')](_0xa826('0x111'));};AGIVertices[_0xa826('0x18')][_0xa826('0x113')]=function(_0x30eebd){logger['info'](util[_0xa826('0x5c')](_0xa826('0x114'),_0x30eebd[_0xa826('0x39')]));var _0xa57ba2='';if(_0x30eebd['trunk_id']){if(!this[_0xa826('0x91')](_0x30eebd['trunk_id'])){return this[_0xa826('0x10')][_0xa826('0x2d')](_0x30eebd,_0xa826('0x115'));}else{var _0x13edc4=parseInt(_0x30eebd[_0xa826('0x116')],0xa);if(isNaN(_0x13edc4)){_0xa57ba2=_0x30eebd[_0xa826('0x116')];}else{_0xa57ba2=this['getTrunk'][_0xa826('0x79')](this,_0x30eebd[_0xa826('0x116')]);if(!_0xa57ba2){return this[_0xa826('0x10')]['error'](_0x30eebd,_0xa826('0x117'));}}}}else if(_0x30eebd[_0xa826('0x118')]){_0xa57ba2=_0x30eebd[_0xa826('0x118')];}else{return this[_0xa826('0x10')]['error'](_0x30eebd,'no\x20trunk\x20selected');}var _0x5f21a8=this['channel'][_0xa826('0x60')]('DIAL',[util[_0xa826('0x5c')](_0xa826('0x119'),_0xa57ba2,_0x30eebd[_0xa826('0x46')]),_0x30eebd[_0xa826('0x6d')],_0x30eebd[_0xa826('0xf1')],_0x30eebd[_0xa826('0x7c')]]);if(_0x5f21a8[_0xa826('0xaf')]===-0x1){return _0x5f21a8;}return this[_0xa826('0x10')][_0xa826('0xb9')](util[_0xa826('0x5c')](_0xa826('0x11a'),_0xa826('0xf2')));};AGIVertices[_0xa826('0x18')]['finally']=function(_0xf6038){logger['info'](util[_0xa826('0x5c')](_0xa826('0x11b'),_0xf6038[_0xa826('0x39')]));return this[_0xa826('0x10')]['noop']('finally');};AGIVertices['prototype'][_0xa826('0xe')]=function(_0xa0c4a1){logger[_0xa826('0x2f')](util[_0xa826('0x5c')](_0xa826('0x11c'),_0xa0c4a1[_0xa826('0x39')]));if(_0xa0c4a1[_0xa826('0x11d')]===0x0){return this[_0xa826('0xb1')](_0xa0c4a1);}_0xa0c4a1[_0xa826('0x11d')]-=0x1;if(!this[_0xa826('0x91')](_0xa0c4a1[_0xa826('0x11e')])){return this['channel'][_0xa826('0x2d')](_0xa0c4a1,_0xa826('0x11f'));}var _0x11401e=this['getSound']['sync'](this,_0xa0c4a1[_0xa826('0x11e')]);if(!_0x11401e){return this[_0xa826('0x10')][_0xa826('0x2d')](_0xa0c4a1,'no\x20file\x20audio\x20found');}if(!this[_0xa826('0x91')](_0xa0c4a1[_0xa826('0xe1')])){return this[_0xa826('0x10')][_0xa826('0x2d')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x32d674=this[_0xa826('0x10')][_0xa826('0x120')](_0x11401e,_0xa0c4a1['response'],_0xa0c4a1[_0xa826('0x121')]);var _0x48450d=_0x32d674[_0xa826('0xaf')]?_0x32d674[_0xa826('0xaf')]['toString']():'';logger[_0xa826('0x2f')](_0xa826('0x122'),JSON['stringify'](_0x32d674));if(_0x32d674[_0xa826('0xaf')]===-0x1){this[_0xa826('0x37')]['sync'](this,_0xa0c4a1,_0x48450d);return _0x32d674;}else if(_0x32d674[_0xa826('0xad')]==='timeout'){_0x32d674['result']=_0x48450d['length']>=parseInt(_0xa0c4a1[_0xa826('0x123')])?'x':'i';}else{_0x32d674[_0xa826('0xaf')]=_0x48450d[_0xa826('0xa8')]>=parseInt(_0xa0c4a1[_0xa826('0x123')])&&_0x48450d[_0xa826('0xa8')]<=parseInt(_0xa0c4a1[_0xa826('0x121')])?'x':'i';}var _0x4e14c8=this[_0xa826('0x13')][_0xa826('0x79')](this,_0xa0c4a1['variable_id']);if(!_0x4e14c8){return this['channel'][_0xa826('0x2d')](_0xa0c4a1,_0xa826('0xe3'));}this[_0xa826('0x10')][_0xa826('0xe7')](_0x4e14c8,_0x48450d);if(this[_0xa826('0x91')](_0xa0c4a1['hiddendigitsnum'])){var _0x24a3a9=parseInt(_0xa0c4a1['hiddendigitsnum'],0xa);var _0x34ab3f=rs[_0xa826('0x124')]({'charset':'*','length':_0x24a3a9});var _0x5c0d96=_0x48450d[_0xa826('0xa8')];if(_0x5c0d96>0x0){if(_0x5c0d96>_0x24a3a9){this[_0xa826('0x37')][_0xa826('0x79')](this,_0xa0c4a1,_0xa0c4a1[_0xa826('0x125')]==='first'?_0x34ab3f+_0x48450d[_0xa826('0x126')](_0x24a3a9):_0x48450d[_0xa826('0x126')](0x0,_0x5c0d96-_0x24a3a9)+_0x34ab3f);}else{this[_0xa826('0x37')]['sync'](this,_0xa0c4a1,rs[_0xa826('0x124')]({'charset':'*','length':_0x5c0d96}));}}else{this[_0xa826('0x37')]['sync'](this,_0xa0c4a1,'');}}else{this[_0xa826('0x37')][_0xa826('0x79')](this,_0xa0c4a1,_0x48450d);}return _0x32d674;};AGIVertices[_0xa826('0x18')][_0xa826('0xf')]=function(_0x2d182b){logger[_0xa826('0x2f')](util[_0xa826('0x5c')](_0xa826('0x127'),_0x2d182b[_0xa826('0x39')]));return this[_0xa826('0xe')](_0x2d182b);};AGIVertices[_0xa826('0x18')]['goal']=function(_0x14ddcd){logger[_0xa826('0x2f')](util[_0xa826('0x5c')](_0xa826('0x128'),_0x14ddcd[_0xa826('0x39')]));this[_0xa826('0x37')][_0xa826('0x79')](this,_0x14ddcd,_0x14ddcd['goalname']);return this['channel'][_0xa826('0xb9')](util[_0xa826('0x5c')](_0xa826('0x129'),_0x14ddcd[_0xa826('0x12a')]));};AGIVertices[_0xa826('0x18')][_0xa826('0x12b')]=function(_0x4a82cc){logger[_0xa826('0x2f')](util[_0xa826('0x5c')](_0xa826('0x12c'),_0x4a82cc[_0xa826('0x39')]));if(!this['isConfigured'](_0x4a82cc[_0xa826('0x94')])||!this[_0xa826('0x91')](_0x4a82cc['aws_secret_access_key'])){return this[_0xa826('0x10')][_0xa826('0xb9')](_0xa826('0x12d'));}if(!this['isConfigured'](_0x4a82cc['text'])){return this['channel']['noop']('no\x20text\x20configured');}this[_0xa826('0x10')][_0xa826('0xb9')](util[_0xa826('0x5c')](_0xa826('0x12e'),_0x4a82cc[_0xa826('0x64')]));var _0x57f920=this[_0xa826('0x93')][_0xa826('0x79')](this,_0x4a82cc);if(_0x57f920){this['channel'][_0xa826('0xb9')](util[_0xa826('0x5c')](_0xa826('0x12f'),_0x57f920));var _0x12048c=this['channel'][_0xa826('0x10e')](_0x57f920);try{fs[_0xa826('0x10f')](_0x57f920+_0xa826('0x110'));}catch(_0x49d177){logger['error'](_0x49d177);}return _0x12048c;}return this[_0xa826('0x10')][_0xa826('0x2d')](_0x4a82cc,_0xa826('0x130'));};AGIVertices[_0xa826('0x18')][_0xa826('0x131')]=function(_0x52a19f){logger['info'](util[_0xa826('0x5c')](_0xa826('0x132'),_0x52a19f[_0xa826('0x39')]));if(!this[_0xa826('0x91')](_0x52a19f[_0xa826('0x94')])||!this[_0xa826('0x91')](_0x52a19f['aws_secret_access_key'])){return this[_0xa826('0x10')][_0xa826('0xb9')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xa826('0x91')](_0x52a19f[_0xa826('0x133')])){return this[_0xa826('0x10')][_0xa826('0xb9')]('no\x20bot\x20name\x20configured');}if(!this['isConfigured'](_0x52a19f['text'])){return this[_0xa826('0x10')][_0xa826('0xb9')]('no\x20text\x20configured');}this[_0xa826('0x10')][_0xa826('0x101')]=!![];this[_0xa826('0x37')](_0x52a19f);this[_0xa826('0xf5')](_0x52a19f[_0xa826('0x64')],'in','','');this[_0xa826('0x10')][_0xa826('0xb9')](util[_0xa826('0x5c')]('Trying\x20Amazon\x20Lex:\x20%s',_0x52a19f['text']));var _0x5039f2=this[_0xa826('0x98')][_0xa826('0x79')](this,_0x52a19f);if(_0x5039f2){for(var _0x4a5b62 in _0x5039f2){if(_0x5039f2[_0xa826('0xa1')](_0x4a5b62)&&_[_0xa826('0xa2')](_0x5039f2[_0x4a5b62])){this[_0xa826('0x10')][_0xa826('0xe7')](util['format'](_0xa826('0x134'),_0x4a5b62[_0xa826('0x73')]()),_0x5039f2[_0x4a5b62]);}}if(_[_0xa826('0x42')](_0x5039f2[_0xa826('0x82')])){return this['channel'][_0xa826('0xb9')](_0xa826('0x135'));}else{this[_0xa826('0xf5')](_0x5039f2[_0xa826('0x82')],_0xa826('0xf7'),_0xa826('0x136'),'');return this[_0xa826('0x10')][_0xa826('0xb9')](util[_0xa826('0x5c')](_0xa826('0x137'),_0x5039f2['message']));}}return this['channel']['error'](_0x52a19f,_0xa826('0x138'));};AGIVertices[_0xa826('0x18')]['googleasr']=function(_0x266228){logger[_0xa826('0x2f')](util[_0xa826('0x5c')](_0xa826('0x139'),_0x266228[_0xa826('0x39')],_0x266228[_0xa826('0x6d')]));if(!this[_0xa826('0x91')](_0x266228[_0xa826('0x85')])){return this['channel']['noop'](_0xa826('0xf4'));}var _0x4b1630='wav';var _0x8ac32a=util[_0xa826('0x5c')](_0xa826('0x13a'),FILES_PATH,rs[_0xa826('0x124')](0x4));var _0x2beb97=util['format'](_0xa826('0xaa'),_0x8ac32a,_0x4b1630);var _0x38121d=!![];if(_0x266228['beep']===_0xa826('0x13b')){_0x38121d=![];}var _0x39a1e3=this['channel'][_0xa826('0x13c')](_0x8ac32a,_0x4b1630,_0x266228[_0xa826('0x13d')],_0x266228[_0xa826('0x6d')],undefined,_0x38121d);if(_0x39a1e3['result']!==-0x1){this['channel'][_0xa826('0xb9')](util[_0xa826('0x5c')](_0xa826('0x13e'),_0x2beb97));var _0x55283b=this[_0xa826('0x9a')][_0xa826('0x79')](this,_0x266228,_0x2beb97);if(_0x55283b){for(var _0x422fae in _0x55283b){if(_0x55283b[_0xa826('0xa1')](_0x422fae)){this[_0xa826('0x10')]['setVariable'](util[_0xa826('0x5c')](_0xa826('0x13f'),_0x422fae[_0xa826('0x73')]()),_0x55283b[_0x422fae]);}}return this[_0xa826('0x10')][_0xa826('0xb9')](util['format'](_0xa826('0x140'),JSON[_0xa826('0x7e')](_0x55283b)));}}return _0x39a1e3;};AGIVertices[_0xa826('0x18')]['tildeasr']=function(_0xa47b40){logger['info'](util[_0xa826('0x5c')](_0xa826('0x141'),_0xa47b40[_0xa826('0x39')]));if(!this[_0xa826('0x91')](_0xa47b40[_0xa826('0x9d')])){return this[_0xa826('0x10')]['noop'](_0xa826('0x142'));}if(!this['isConfigured'](_0xa47b40[_0xa826('0x9e')])){return this[_0xa826('0x10')]['noop'](_0xa826('0x143'));}var _0x141559=_0xa826('0x144');var _0x232c06=util[_0xa826('0x5c')](_0xa826('0x13a'),FILES_PATH,rs[_0xa826('0x124')](0x4));var _0x136aaa=util[_0xa826('0x5c')](_0xa826('0xaa'),_0x232c06,_0x141559);var _0x5fe7b6=!![];if(_0xa47b40['beep']===_0xa826('0x13b')){_0x5fe7b6=![];}var _0x4524ea=this['channel'][_0xa826('0x13c')](_0x232c06,_0x141559,_0xa47b40[_0xa826('0x13d')],_0xa47b40[_0xa826('0x6d')],undefined,_0x5fe7b6);if(_0x4524ea[_0xa826('0xaf')]!==-0x1){this[_0xa826('0x10')][_0xa826('0xb9')](util['format'](_0xa826('0x145'),_0x136aaa));var _0x474aa7=this[_0xa826('0x9c')][_0xa826('0x79')](this,_0xa47b40,_0x136aaa);if(_0x474aa7){for(var _0x3009fb in _0x474aa7){if(_0x474aa7['hasOwnProperty'](_0x3009fb)){this[_0xa826('0x10')][_0xa826('0xe7')](util[_0xa826('0x5c')](_0xa826('0x146'),_0x3009fb[_0xa826('0x73')]()),_0x474aa7[_0x3009fb]);}}return this[_0xa826('0x10')]['noop'](util[_0xa826('0x5c')](_0xa826('0x147'),JSON['stringify'](_0x474aa7)));}}return _0x4524ea;};AGIVertices[_0xa826('0x18')]['gotoc']=function(_0x2b43d3){logger[_0xa826('0x2f')](util[_0xa826('0x5c')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x2b43d3['label']));return this[_0xa826('0x10')][_0xa826('0x148')](_0x2b43d3[_0xa826('0x149')],_0x2b43d3['extension'],_0x2b43d3[_0xa826('0x3e')]);};AGIVertices['prototype']['gotoif']=function(_0x20e2a5){logger[_0xa826('0x2f')](util[_0xa826('0x5c')](_0xa826('0x14a'),_0x20e2a5[_0xa826('0x39')]));if(!this['isConfigured'](_0x20e2a5[_0xa826('0x14b')])){return this[_0xa826('0x10')]['error'](_0x20e2a5,_0xa826('0x14c'));}try{var _0x1143d9=eval(_0x20e2a5[_0xa826('0x14b')])?_0xa826('0x14d'):_0xa826('0x14e');this[_0xa826('0x10')][_0xa826('0xb9')](util[_0xa826('0x5c')]('EVAL\x20CONDITION\x20%s\x20%s',_0x20e2a5[_0xa826('0x14b')],_0x1143d9));return{'code':0xc8,'result':_0x1143d9};}catch(_0x28e374){return{'code':0xc8,'result':_0xa826('0x14e')};}};AGIVertices['prototype'][_0xa826('0x14f')]=function(_0x498f24){logger['info'](util[_0xa826('0x5c')](_0xa826('0x150'),_0x498f24[_0xa826('0x39')]));if(!this['isConfigured'](_0x498f24[_0xa826('0x151')])){return this['channel'][_0xa826('0x2d')](_0x498f24,_0xa826('0x152'));}var _0x1cbe65=this[_0xa826('0x24')][_0xa826('0x79')](this,_0x498f24[_0xa826('0x151')]);if(!_0x1cbe65){return this[_0xa826('0x10')]['error'](_0x498f24,_0xa826('0x153'));}for(var _0x5e19da=0x0;_0x5e19da<_0x1cbe65['length'];_0x5e19da+=0x1){var _0x883e0f=this[_0xa826('0x10')][_0xa826('0x13')](util[_0xa826('0x5c')](_0xa826('0x154'),_0x1cbe65[_0x5e19da]));if(_0x883e0f[_0xa826('0xaf')]===-0x1){return _0x883e0f;}logger[_0xa826('0x2f')](util[_0xa826('0x5c')](_0xa826('0x155'),_0x1cbe65[_0x5e19da],_0x883e0f['extra']));if(_0x883e0f[_0xa826('0xad')]===_0xa826('0x14d')){logger[_0xa826('0x2f')](util[_0xa826('0x5c')](_0xa826('0x155'),_0x1cbe65[_0x5e19da],_0xa826('0x14d')));this[_0xa826('0x10')][_0xa826('0xb9')](util['format'](_0xa826('0x155'),_0x1cbe65[_0x5e19da],'true'));return{'code':0xc8,'result':_0xa826('0x14d')};}else{logger['info'](util[_0xa826('0x5c')](_0xa826('0x155'),_0x1cbe65[_0x5e19da],_0xa826('0x14e')));this[_0xa826('0x10')][_0xa826('0xb9')](util[_0xa826('0x5c')](_0xa826('0x155'),_0x1cbe65[_0x5e19da],'false'));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0xa826('0x18')]['hangup']=function(_0x5bfe67){logger[_0xa826('0x2f')](util[_0xa826('0x5c')](_0xa826('0x156'),_0x5bfe67['label']));return this[_0xa826('0x10')][_0xa826('0x157')]();};AGIVertices[_0xa826('0x18')][_0xa826('0x158')]=function(_0x150bda){logger[_0xa826('0x2f')](util['format'](_0xa826('0x159'),_0x150bda['label']));if(!this[_0xa826('0x91')](_0x150bda[_0xa826('0x85')])){return this['channel']['noop'](_0xa826('0xf4'));}var _0x4d7f68=_0xa826('0x144');var _0x3fe37d=util['format'](_0xa826('0x13a'),FILES_PATH,rs[_0xa826('0x124')](0x4));var _0x3bf886=util[_0xa826('0x5c')]('%s.%s',_0x3fe37d,_0x4d7f68);var _0x1576c8=!![];if(_0x150bda[_0xa826('0x15a')]===_0xa826('0x13b')){_0x1576c8=![];}var _0x29ef2b=this[_0xa826('0x10')]['recordFile'](_0x3fe37d,_0x4d7f68,_0x150bda[_0xa826('0x13d')],_0x150bda[_0xa826('0x6d')],undefined,_0x1576c8);if(_0x29ef2b[_0xa826('0xaf')]!==-0x1){this[_0xa826('0x10')]['noop'](util[_0xa826('0x5c')]('ispeech\x20%s\x20file\x20created',_0x3bf886));var _0x40c0dd=this[_0xa826('0x8f')]['sync'](this,_0x150bda,_0x3bf886);if(_0x40c0dd){for(var _0x498344 in _0x40c0dd){if(_0x40c0dd[_0xa826('0xa1')](_0x498344)){this[_0xa826('0x10')][_0xa826('0xe7')](util[_0xa826('0x5c')](_0xa826('0x15b'),_0x498344[_0xa826('0x73')]()),_0x40c0dd[_0x498344]);}}return this['channel']['noop'](util[_0xa826('0x5c')](_0xa826('0x15c'),JSON['stringify'](_0x40c0dd)));}}return _0x29ef2b;};AGIVertices[_0xa826('0x18')][_0xa826('0x15d')]=function(_0x28a8dd){logger['info'](util[_0xa826('0x5c')](_0xa826('0x15e'),_0x28a8dd['label']));if(!this[_0xa826('0x91')](_0x28a8dd['key'])){return this[_0xa826('0x10')]['noop'](_0xa826('0xf4'));}if(!this[_0xa826('0x91')](_0x28a8dd[_0xa826('0x64')])){return this[_0xa826('0x10')][_0xa826('0xb9')](_0xa826('0xb4'));}this[_0xa826('0x10')][_0xa826('0xb9')](util[_0xa826('0x5c')](_0xa826('0x15f'),_0x28a8dd['text']));var _0x534d4f=this[_0xa826('0x8c')][_0xa826('0x79')](this,_0x28a8dd);if(_0x534d4f){this[_0xa826('0x10')][_0xa826('0xb9')](util[_0xa826('0x5c')](_0xa826('0x160'),_0x534d4f));var _0x286d8c=this['channel'][_0xa826('0x10e')](_0x534d4f,_0x28a8dd[_0xa826('0x13d')]);try{fs[_0xa826('0x10f')](_0x534d4f+_0xa826('0x110'));}catch(_0x17355a){logger[_0xa826('0x2d')](_0x17355a);}return _0x286d8c;}return this[_0xa826('0x10')][_0xa826('0x2d')](_0x28a8dd,_0xa826('0x161'));};AGIVertices[_0xa826('0x18')][_0xa826('0x162')]=function(_0x581b42){logger[_0xa826('0x2f')](util[_0xa826('0x5c')](_0xa826('0x163'),_0x581b42[_0xa826('0x39')]));if(!this['isConfigured'](_0x581b42[_0xa826('0x164')])){return this[_0xa826('0x10')][_0xa826('0x2d')](_0x581b42,_0xa826('0x165'));}logger[_0xa826('0x2f')](util[_0xa826('0x5c')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xa826('0x3d')],_0x581b42[_0xa826('0x164')]));var _0x21a6d1=this[_0xa826('0x166')]['sync'](this,_0x581b42[_0xa826('0x164')]);if(_0x21a6d1){logger['info'](util[_0xa826('0x5c')](_0xa826('0x167'),this[_0xa826('0x10')][_0xa826('0x3d')],_0x581b42[_0xa826('0x164')]));this['channel'][_0xa826('0xb9')](util[_0xa826('0x5c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa826('0x10')][_0xa826('0x3d')],_0x581b42[_0xa826('0x164')]));return{'code':0xc8,'result':_0xa826('0x168')};}else{logger[_0xa826('0x2f')](util['format'](_0xa826('0x169'),this[_0xa826('0x10')]['callerid'],_0x581b42[_0xa826('0x164')]));this['channel'][_0xa826('0xb9')](util[_0xa826('0x5c')](_0xa826('0x169'),this[_0xa826('0x10')]['callerid'],_0x581b42['findBy']));return{'code':0xc8,'result':_0xa826('0x16a')};}};AGIVertices[_0xa826('0x18')][_0xa826('0x16b')]=function(_0x596118){logger['info'](util[_0xa826('0x5c')](_0xa826('0x16c'),_0x596118[_0xa826('0x39')]));if(!this['isConfigured'](_0x596118[_0xa826('0x164')])){return this[_0xa826('0x10')][_0xa826('0x2d')](_0x596118,_0xa826('0x165'));}logger[_0xa826('0x2f')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xa826('0x3d')],_0x596118[_0xa826('0x164')]));var _0x11da4b=this['agentLogout'][_0xa826('0x79')](this,_0x596118['findBy']);if(_0x11da4b){logger[_0xa826('0x2f')](util[_0xa826('0x5c')](_0xa826('0x167'),this[_0xa826('0x10')][_0xa826('0x3d')],_0x596118[_0xa826('0x164')]));this['channel'][_0xa826('0xb9')](util[_0xa826('0x5c')](_0xa826('0x167'),this[_0xa826('0x10')]['callerid'],_0x596118[_0xa826('0x164')]));return{'code':0xc8,'result':'success'};}else{logger[_0xa826('0x2f')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa826('0x10')][_0xa826('0x3d')],_0x596118[_0xa826('0x164')]));this['channel'][_0xa826('0xb9')](util[_0xa826('0x5c')](_0xa826('0x169'),this[_0xa826('0x10')]['callerid'],_0x596118[_0xa826('0x164')]));return{'code':0xc8,'result':_0xa826('0x16a')};}};AGIVertices[_0xa826('0x18')][_0xa826('0x16d')]=function(_0x381937){logger[_0xa826('0x2f')](util[_0xa826('0x5c')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x381937[_0xa826('0x39')]));if(!this[_0xa826('0x91')](_0x381937[_0xa826('0x16e')])){return this[_0xa826('0x10')][_0xa826('0x2d')](_0x381937,'no\x20operation\x20configured');}this['channel'][_0xa826('0xb9')](util[_0xa826('0x5c')]('math\x20%s',_0x381937['operation']));var _0x7c6ff8=eval(_0x381937[_0xa826('0x16e')]);if(!this[_0xa826('0x91')](_0x381937[_0xa826('0xe1')])){return this[_0xa826('0x10')][_0xa826('0xb9')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x5ccd72=this['getVariable']['sync'](this,_0x381937[_0xa826('0xe1')]);if(!_0x5ccd72){return this[_0xa826('0x10')][_0xa826('0x2d')](_0x381937,_0xa826('0xe3'));}if(_[_0xa826('0xa7')](_0x7c6ff8)){var _0x5d76f9=this;_0x7c6ff8[_0xa826('0xe4')](function(_0x3be2ed,_0x313ea9){_0x5d76f9['channel']['setVariable'](util['format'](_0xa826('0x16f'),_0x5ccd72,_0x313ea9),_0x3be2ed);});return this[_0xa826('0x10')]['noop'](util[_0xa826('0x5c')](_0xa826('0x170'),_0x5ccd72));}else{return this[_0xa826('0x10')][_0xa826('0xe7')](_0x5ccd72,_0x7c6ff8);}};AGIVertices[_0xa826('0x18')][_0xa826('0xd')]=function(_0x3788cc){logger[_0xa826('0x2f')](util[_0xa826('0x5c')](_0xa826('0x171'),_0x3788cc[_0xa826('0x39')]));if(_0x3788cc[_0xa826('0x11d')]===0x0){return this[_0xa826('0xb1')](_0x3788cc);}_0x3788cc[_0xa826('0x11d')]-=0x1;if(!this[_0xa826('0x91')](_0x3788cc[_0xa826('0x11e')])){return this[_0xa826('0x10')][_0xa826('0x2d')](_0x3788cc,_0xa826('0x11f'));}var _0x54c9dc=this[_0xa826('0x1e')][_0xa826('0x79')](this,_0x3788cc['file_id']);if(!_0x54c9dc){return this[_0xa826('0x10')][_0xa826('0x2d')](_0x3788cc,'no\x20file\x20audio\x20found');}var _0x466ab9=this[_0xa826('0x10')]['getData'](_0x54c9dc,_0x3788cc[_0xa826('0x172')],_0x3788cc['digit']);var _0x558d53=_0x466ab9[_0xa826('0xaf')];if(_0x466ab9[_0xa826('0xaf')]===-0x1){this['createSquareDetailsReport'][_0xa826('0x79')](this,_0x3788cc,'-1');return _0x466ab9;}else if(_0x466ab9[_0xa826('0xad')]==='timeout'){_0x466ab9[_0xa826('0xaf')]=_0x466ab9['result'][_0xa826('0xa8')]>0x0?_0x466ab9['result']:'t';}else if(_[_0xa826('0x44')](_0x466ab9['result'])){_0x466ab9[_0xa826('0xaf')]='#';_0x558d53='#';}if(!this[_0xa826('0x91')](_0x3788cc[_0xa826('0xe1')])){this['channel'][_0xa826('0xb9')](_0xa826('0xe2'));}else{var _0x41a42d=this[_0xa826('0x13')][_0xa826('0x79')](this,_0x3788cc['variable_id']);if(!_0x41a42d){return this[_0xa826('0x10')][_0xa826('0x2d')](_0x3788cc,_0xa826('0xe3'));}this[_0xa826('0x10')]['setVariable'](_0x41a42d,_0x558d53);}this[_0xa826('0x37')]['sync'](this,_0x3788cc,_0x558d53);return _0x466ab9;};AGIVertices[_0xa826('0x18')][_0xa826('0xb9')]=function(_0x4e3613){logger['info'](util['format'](_0xa826('0x173'),_0x4e3613[_0xa826('0x39')]));return this[_0xa826('0x10')][_0xa826('0xb9')](_0x4e3613[_0xa826('0x174')]||_0x4e3613[_0xa826('0x39')]);};AGIVertices[_0xa826('0x18')][_0xa826('0x175')]=function(_0x5904c7){logger[_0xa826('0x2f')](util['format'](_0xa826('0x176'),_0x5904c7['label']));if(!this[_0xa826('0x91')](_0x5904c7[_0xa826('0x164')])){return this[_0xa826('0x10')][_0xa826('0x2d')](_0x5904c7,_0xa826('0x165'));}logger['info'](util[_0xa826('0x5c')](_0xa826('0x177'),this[_0xa826('0x10')][_0xa826('0x3d')],_0x5904c7[_0xa826('0x164')]));var _0x155831=this[_0xa826('0x56')][_0xa826('0x79')](this,_0x5904c7[_0xa826('0x178')]);var _0x2d6062=this[_0xa826('0x58')][_0xa826('0x79')](this,_0x5904c7[_0xa826('0x164')],_0x155831);if(_0x2d6062){logger[_0xa826('0x2f')](util[_0xa826('0x5c')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa826('0x10')][_0xa826('0x3d')],_0x5904c7['findBy']));this[_0xa826('0x10')]['noop'](util[_0xa826('0x5c')](_0xa826('0x167'),this[_0xa826('0x10')][_0xa826('0x3d')],_0x5904c7[_0xa826('0x164')]));return{'code':0xc8,'result':_0xa826('0x168')};}else{logger['info'](util[_0xa826('0x5c')](_0xa826('0x169'),this['channel'][_0xa826('0x3d')],_0x5904c7[_0xa826('0x164')]));this[_0xa826('0x10')]['noop'](util[_0xa826('0x5c')](_0xa826('0x167'),this[_0xa826('0x10')][_0xa826('0x3d')],_0x5904c7[_0xa826('0x164')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0xa826('0x179')]=function(_0x4df272){logger[_0xa826('0x2f')](util[_0xa826('0x5c')](_0xa826('0x17a'),_0x4df272[_0xa826('0x39')]));if(!this[_0xa826('0x91')](_0x4df272[_0xa826('0x11e')])){return this['channel'][_0xa826('0x2d')](_0x4df272,_0xa826('0x11f'));}var _0x257bb8=this[_0xa826('0x1e')][_0xa826('0x79')](this,_0x4df272[_0xa826('0x11e')]);if(!_0x257bb8){return this['channel'][_0xa826('0x2d')](_0x4df272,_0xa826('0x17b'));}var _0x54c08d=this[_0xa826('0x10')][_0xa826('0x60')](_0xa826('0x17c'),[_0x257bb8,_0x4df272['opts']]);if(_0x54c08d['result']===-0x1){return _0x54c08d;}return this[_0xa826('0x10')]['noop'](util[_0xa826('0x5c')](_0xa826('0xce'),_0xa826('0x17c'),_0x257bb8));};AGIVertices[_0xa826('0x18')][_0xa826('0x17d')]=function(_0x4a9eab){logger['info'](util[_0xa826('0x5c')](_0xa826('0x17e'),_0x4a9eab[_0xa826('0x39')]));if(!this[_0xa826('0x91')](_0x4a9eab['queue_id'])){return this[_0xa826('0x10')]['error'](_0x4a9eab,_0xa826('0x17f'));}var _0x1d0f34='';var _0x1774fa=parseInt(_0x4a9eab[_0xa826('0x180')],0xa);if(isNaN(_0x1774fa)){_0x1d0f34=_0x4a9eab[_0xa826('0x180')];}else{_0x1d0f34=this[_0xa826('0x181')][_0xa826('0x79')](this,_0x4a9eab[_0xa826('0x180')]);if(!_0x1d0f34){return this[_0xa826('0x10')][_0xa826('0x2d')](_0x4a9eab,_0xa826('0x182'));}}var _0x50732f='';if(this[_0xa826('0x91')](_0x4a9eab[_0xa826('0x11e')])){var _0xfd0802=this[_0xa826('0x1e')][_0xa826('0x79')](this,_0x4a9eab['file_id']);if(_0xfd0802){_0x50732f=_0xfd0802;}}this[_0xa826('0x37')][_0xa826('0x79')](this,_0x4a9eab,_0x1d0f34);if(_0x4a9eab[_0xa826('0xf1')][_0xa826('0x183')]('x')<0x0){_0x4a9eab[_0xa826('0xf1')]+='x';}if(_0x4a9eab[_0xa826('0xf1')][_0xa826('0x183')]('X')<0x0){_0x4a9eab[_0xa826('0xf1')]+='X';}this['channel'][_0xa826('0xe7')](_0xa826('0x184'),_0x1d0f34?_0x1d0f34[_0xa826('0x185')]():'');var _0xc7a9c5=this[_0xa826('0x10')][_0xa826('0x60')](_0xa826('0x186'),[_0x1d0f34,_0x4a9eab[_0xa826('0xf1')],_0x4a9eab[_0xa826('0x7c')],_0x50732f,_0x4a9eab['timeout'],_0x4a9eab['agi'],_0x4a9eab[_0xa826('0x187')],_0x4a9eab[_0xa826('0x188')],'',_0x4a9eab['position']]);if(_0xc7a9c5[_0xa826('0xaf')]===-0x1){return _0xc7a9c5;}return this[_0xa826('0x10')][_0xa826('0xb9')](util[_0xa826('0x5c')](_0xa826('0xce'),'QUEUE',_0x1d0f34));};AGIVertices[_0xa826('0x18')]['record']=function(_0x26d0c6){logger[_0xa826('0x2f')](util[_0xa826('0x5c')](_0xa826('0x189'),_0x26d0c6[_0xa826('0x39')]));var _0x3bf1d3=_0x26d0c6['recordingFormat']||_0xa826('0x144');var _0xc5c93e=util[_0xa826('0x5c')](_0xa826('0x18a'),this['channel'][_0xa826('0x38')],rs[_0xa826('0x124')](0x5));var _0x3abde6=util[_0xa826('0x5c')]('%s/recordings/%s.%s',FILES_PATH,_0xc5c93e,_0x3bf1d3);var _0xb0fef7=util[_0xa826('0x5c')](_0xa826('0x13a'),FILES_PATH,_0xc5c93e);this['createSquareRecording'][_0xa826('0x79')](this,_0x26d0c6,_0xc5c93e,_0x3abde6);this[_0xa826('0x10')]['setVariable'](_0xa826('0x18b'),_0xc5c93e);logger['info'](_0xa826('0x18c'),_0xb0fef7,_0x3bf1d3,_0x26d0c6[_0xa826('0x18d')],_0x26d0c6[_0xa826('0x6d')]);return this[_0xa826('0x10')][_0xa826('0x13c')](_0xb0fef7,_0x3bf1d3,_0x26d0c6[_0xa826('0x18d')],_0x26d0c6[_0xa826('0x6d')],undefined,!![]);};AGIVertices['prototype'][_0xa826('0x18e')]=function(_0x18d9b2){logger[_0xa826('0x2f')](util['format'](_0xa826('0x18f'),_0x18d9b2[_0xa826('0x39')]));if(!this[_0xa826('0x91')](_0x18d9b2[_0xa826('0x7c')])){return this['channel'][_0xa826('0xb9')]('no\x20url\x20configured');}var _0x634eaf=this['restAPI'][_0xa826('0x79')](this,_0x18d9b2);logger[_0xa826('0x2f')](util[_0xa826('0x5c')](_0xa826('0x190'),util[_0xa826('0x191')](_0x634eaf,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x18d9b2[_0xa826('0xe1')])){return this[_0xa826('0x10')][_0xa826('0xb9')](_0xa826('0x192'));}var _0x2328cc=this[_0xa826('0x13')][_0xa826('0x79')](this,_0x18d9b2[_0xa826('0xe1')]);if(!_0x2328cc){return this[_0xa826('0x10')][_0xa826('0x2d')](_0x18d9b2,_0xa826('0xe3'));}this['channel']['setVariable'](util[_0xa826('0x5c')](_0xa826('0x193'),_0x2328cc),_0x634eaf[_0xa826('0x80')]?_0x634eaf[_0xa826('0x80')]:'200');this[_0xa826('0x10')][_0xa826('0xe7')](util[_0xa826('0x5c')](_0xa826('0x194'),_0x2328cc),_0x634eaf[_0xa826('0x81')]?_0x634eaf[_0xa826('0x81')]:'OK');if(_0x634eaf[_0xa826('0x74')]){try{this[_0xa826('0xa9')](_0x634eaf[_0xa826('0x74')],_0x2328cc);}catch(_0x3b9d0b){logger[_0xa826('0x2d')](util['format'](_0xa826('0x195'),_0x2328cc));}}return this[_0xa826('0x10')][_0xa826('0xb9')](util[_0xa826('0x5c')]('variable\x20%s\x20set',_0x2328cc));};AGIVertices['prototype'][_0xa826('0x196')]=function(_0x21045e){logger[_0xa826('0x2f')](util[_0xa826('0x5c')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x21045e[_0xa826('0x39')]));return this[_0xa826('0x10')]['sayDigits'](_0x21045e[_0xa826('0x197')][_0xa826('0x198')](/\s+/g,''),_0x21045e[_0xa826('0x18d')]);};AGIVertices['prototype'][_0xa826('0x199')]=function(_0x3c8c3a){logger[_0xa826('0x2f')](util['format'](_0xa826('0x19a'),_0x3c8c3a[_0xa826('0x39')]));return this['channel'][_0xa826('0x19b')](_0x3c8c3a['number'][_0xa826('0x198')](/\s+/g,''),_0x3c8c3a[_0xa826('0x18d')]);};AGIVertices[_0xa826('0x18')][_0xa826('0x19c')]=function(_0x40241b){logger[_0xa826('0x2f')](util[_0xa826('0x5c')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x40241b['label']));return this[_0xa826('0x10')][_0xa826('0x19d')](_0x40241b[_0xa826('0x64')],_0x40241b['escape_digits']);};AGIVertices[_0xa826('0x18')][_0xa826('0x19e')]=function(_0x536b17){logger['info'](util[_0xa826('0x5c')](_0xa826('0x19f'),_0x536b17[_0xa826('0x39')]));if(!this[_0xa826('0x91')](_0x536b17[_0xa826('0x1a0')])){return this['channel'][_0xa826('0xb9')]('no\x20mail\x20account\x20configured');}var _0x5b5c56=this[_0xa826('0x1a1')][_0xa826('0x79')](this,_0x536b17[_0xa826('0x1a0')]);if(!_0x5b5c56||!_0x5b5c56['Smtp']){return this['channel']['error'](_0x536b17,'no\x20mail\x20account\x20found');}var _0x3d642b={'from':util['format'](_0xa826('0x1a2'),_0x5b5c56['name'],_0x5b5c56[_0xa826('0x1a3')]||_0x5b5c56[_0xa826('0x1a4')][_0xa826('0x1a5')]),'to':_0x536b17['to']||'','cc':_0x536b17['cc']||'','bcc':_0x536b17[_0xa826('0x1a6')]||'','subject':_0x536b17['subject'],'html':_0x536b17[_0xa826('0x64')],'text':_0x536b17[_0xa826('0x64')]};var _0x4d2e01={'tls':{'rejectUnauthorized':![]}};if(_0x5b5c56[_0xa826('0x1a4')][_0xa826('0x1a7')]){_0x4d2e01[_0xa826('0x1a7')]=_0x5b5c56['Smtp'][_0xa826('0x1a7')];}else{_0x4d2e01['host']=_0x5b5c56[_0xa826('0x1a4')][_0xa826('0x1a8')];_0x4d2e01[_0xa826('0x1a9')]=_0x5b5c56[_0xa826('0x1a4')][_0xa826('0x1a9')];_0x4d2e01[_0xa826('0x1aa')]=_0x5b5c56['Smtp']['secure'];}if(_0x5b5c56['Smtp'][_0xa826('0x1ab')]){_0x4d2e01[_0xa826('0x1ac')]={'user':_0x5b5c56[_0xa826('0x1a4')][_0xa826('0x1a5')],'pass':_0x5b5c56[_0xa826('0x1a4')][_0xa826('0x1ad')]};}if(this[_0xa826('0x91')](_0x536b17['template_id'])){}logger[_0xa826('0xeb')](_0xa826('0x1ae'),JSON[_0xa826('0x7e')](_0x3d642b));this[_0xa826('0x37')][_0xa826('0x79')](this,_0x536b17,_0x536b17[_0xa826('0x1a0')]);this['channel'][_0xa826('0xb9')](util[_0xa826('0x5c')](_0xa826('0x1af'),_0x5b5c56[_0xa826('0x16')]));this['sendMailMessage'][_0xa826('0x79')](this,_0x4d2e01,_0x3d642b);return this[_0xa826('0x10')][_0xa826('0xb9')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xa826('0x18')][_0xa826('0x1b0')]=function(_0x28cab4){logger[_0xa826('0x2f')](util[_0xa826('0x5c')](_0xa826('0x1b1'),_0x28cab4[_0xa826('0x39')]));return this[_0xa826('0x10')][_0xa826('0xb9')](_0xa826('0x1b2'));};AGIVertices[_0xa826('0x18')][_0xa826('0x1b3')]=function(_0x2aff10){logger['info'](util[_0xa826('0x5c')](_0xa826('0x1b4'),_0x2aff10[_0xa826('0x39')]));if(!this['isConfigured'](_0x2aff10[_0xa826('0x1b5')])){return this['channel'][_0xa826('0xb9')]('no\x20sms\x20account\x20configured');}var _0x217de9=this[_0xa826('0x1b6')]['sync'](this,_0x2aff10['sms_account_id']);if(!_0x217de9){return this[_0xa826('0x10')][_0xa826('0x2d')](_0x2aff10,_0xa826('0x1b7'));}var _0x2ee812={'body':_0x2aff10[_0xa826('0x1b8')],'phone':_0x2aff10['to']||'','SmsAccountId':_0x217de9['id']};logger['debug']('sendSMS\x20message',JSON[_0xa826('0x7e')](_0x2ee812));this[_0xa826('0x37')]['sync'](this,_0x2aff10,_0x2aff10[_0xa826('0x1b5')]);this[_0xa826('0x10')][_0xa826('0xb9')](util[_0xa826('0x5c')](_0xa826('0x1b9'),_0x217de9[_0xa826('0x16')]));this[_0xa826('0x36')]['sync'](this,_0x2ee812);return this['channel'][_0xa826('0xb9')](_0xa826('0x1ba'));};AGIVertices['prototype']['set']=function(_0x38211f){logger[_0xa826('0x2f')](util[_0xa826('0x5c')](_0xa826('0x1bb'),_0x38211f[_0xa826('0x39')]));if(!this[_0xa826('0x91')](_0x38211f[_0xa826('0xe1')])){return this[_0xa826('0x10')]['error'](_0x38211f,_0xa826('0x1bc'));}var _0x58c6d0=this[_0xa826('0x13')][_0xa826('0x79')](this,_0x38211f[_0xa826('0xe1')]);if(!_0x58c6d0){return this[_0xa826('0x10')]['error'](_0x38211f,'no\x20variable\x20found');}return this['channel'][_0xa826('0xe7')](_0x58c6d0,_0x38211f[_0xa826('0x1bd')]);};AGIVertices[_0xa826('0x18')][_0xa826('0x1be')]=function(_0x5f3b2c){logger['info'](util[_0xa826('0x5c')](_0xa826('0x1bf'),_0x5f3b2c['label']));this[_0xa826('0x10')][_0xa826('0xb9')](_0xa826('0x1c0'));if(_0x5f3b2c[_0xa826('0xc4')]===_0xa826('0x1c1')){this[_0xa826('0x10')]['noop']('Answer');return this[_0xa826('0x10')][_0xa826('0xc4')]();}return this['channel'][_0xa826('0xb9')](_0xa826('0x1c2'));};AGIVertices[_0xa826('0x18')][_0xa826('0x1c3')]=function(_0x9fbad3){logger[_0xa826('0x2f')](util[_0xa826('0x5c')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x9fbad3['label']));if(!this[_0xa826('0x91')](_0x9fbad3[_0xa826('0x1c4')])){return this['channel'][_0xa826('0x2d')](_0x9fbad3,'no\x20subproject\x20selected');}var _0x1f2811=this['getSquareProject'][_0xa826('0x79')](this,_0x9fbad3[_0xa826('0x1c4')]);if(!this[_0xa826('0x91')](_0x1f2811)){return this[_0xa826('0x10')][_0xa826('0x2d')](_0x9fbad3,util[_0xa826('0x5c')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x9fbad3[_0xa826('0x1c4')]));}if(_0x1f2811===this['channel']['arg_1']){return this['channel'][_0xa826('0x2d')](_0x9fbad3,_0xa826('0x1c5'));}this[_0xa826('0x37')][_0xa826('0x79')](this,_0x9fbad3,_0x1f2811);var _0xa9394c=this[_0xa826('0x10')][_0xa826('0x60')](_0xa826('0x1c6'),util['format'](_0xa826('0x1c7'),config[_0xa826('0x6')][_0xa826('0x1a8')]||'127.0.0.1',_0x1f2811,this[_0xa826('0x10')][_0xa826('0x3b')]));if(_0xa9394c[_0xa826('0xaf')]===-0x1){return _0xa9394c;}return this[_0xa826('0x10')][_0xa826('0xb9')](util['format']('Executed\x20command\x20%s\x20%s',_0xa826('0x1c6'),_0x1f2811));};AGIVertices[_0xa826('0x18')][_0xa826('0x1c8')]=function(_0x43954f){logger['info'](util[_0xa826('0x5c')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x43954f['label']));var _0x183af9=this[_0xa826('0x5f')][_0xa826('0x79')](this,_0x43954f[_0xa826('0x1c9')]);this[_0xa826('0x37')]['sync'](this,_0x43954f,_0x43954f[_0xa826('0x1c9')]);if(this[_0xa826('0x91')](_0x43954f[_0xa826('0xe1')])){var _0x2d4148=this[_0xa826('0x13')][_0xa826('0x79')](this,_0x43954f[_0xa826('0xe1')]);if(_0x2d4148){this[_0xa826('0x10')][_0xa826('0xe7')](_0x2d4148,_0x183af9);return this[_0xa826('0x10')][_0xa826('0xb9')](util[_0xa826('0x5c')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x43954f[_0xa826('0x1c9')],_0x2d4148));}}return this['channel'][_0xa826('0xb9')](util[_0xa826('0x5c')](_0xa826('0x1ca'),_0x43954f[_0xa826('0x1c9')]));};AGIVertices['prototype'][_0xa826('0x1cb')]=function(_0x525ce1){logger[_0xa826('0x2f')](util[_0xa826('0x5c')](_0xa826('0x1cc'),_0x525ce1[_0xa826('0x39')]));_0x525ce1[_0xa826('0x64')]=_0x525ce1[_0xa826('0x64')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa826('0x91')](_0x525ce1[_0xa826('0x63')])){return this[_0xa826('0x10')][_0xa826('0xb9')](_0xa826('0x1cd'));}if(!this[_0xa826('0x91')](_0x525ce1['text'])){return this[_0xa826('0x10')][_0xa826('0xb9')](_0xa826('0xb4'));}this[_0xa826('0x10')][_0xa826('0xb9')](util['format'](_0xa826('0x1ce'),_0x525ce1[_0xa826('0x64')]));var _0x8839c0=this[_0xa826('0x62')][_0xa826('0x79')](this,_0x525ce1);if(_0x8839c0){this[_0xa826('0x10')][_0xa826('0xb9')](util[_0xa826('0x5c')](_0xa826('0x1cf'),_0x8839c0));var _0x3a34a2=this[_0xa826('0x10')][_0xa826('0x10e')](_0x8839c0);try{fs['unlink'](_0x8839c0+_0xa826('0x110'));}catch(_0x67061){logger[_0xa826('0x2d')](_0x67061);}return _0x3a34a2;}return this[_0xa826('0x10')][_0xa826('0x2d')](_0x525ce1,_0xa826('0x1d0'));};AGIVertices[_0xa826('0x18')][_0xa826('0x1d1')]=function(_0x59eb7a){logger[_0xa826('0x2f')](util[_0xa826('0x5c')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x59eb7a[_0xa826('0x39')]));_0x59eb7a['text']=_0x59eb7a['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa826('0x91')](_0x59eb7a[_0xa826('0x64')])){return this[_0xa826('0x10')][_0xa826('0xb9')](_0xa826('0xb4'));}this[_0xa826('0x10')][_0xa826('0xb9')](util[_0xa826('0x5c')](_0xa826('0x1d2'),_0x59eb7a[_0xa826('0x64')]));var _0x16fd64=this['googleTTS'][_0xa826('0x79')](this,_0x59eb7a);if(_0x16fd64){this[_0xa826('0x10')][_0xa826('0xb9')](util['format']('Google\x20TTS\x20%s\x20file\x20created',_0x16fd64));var _0x272be5=this[_0xa826('0x10')][_0xa826('0x10e')](_0x16fd64);try{fs[_0xa826('0x10f')](_0x16fd64+_0xa826('0x110'));}catch(_0x306e60){logger[_0xa826('0x2d')](_0x306e60);}return _0x272be5;}return this['channel'][_0xa826('0x2d')](_0x59eb7a,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xa826('0x18')][_0xa826('0x1d3')]=function(_0x1ed1ed){logger['info'](util[_0xa826('0x5c')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x1ed1ed[_0xa826('0x39')]));if(!this[_0xa826('0x91')](_0x1ed1ed[_0xa826('0x164')])){return this[_0xa826('0x10')]['error'](_0x1ed1ed,_0xa826('0x165'));}logger[_0xa826('0x2f')](util[_0xa826('0x5c')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xa826('0x3d')],_0x1ed1ed[_0xa826('0x164')]));var _0x591590=this[_0xa826('0x5a')]['sync'](this,_0x1ed1ed['findBy']);if(_0x591590){logger[_0xa826('0x2f')](util[_0xa826('0x5c')](_0xa826('0x167'),this[_0xa826('0x10')][_0xa826('0x3d')],_0x1ed1ed['findBy']));this['channel'][_0xa826('0xb9')](util['format'](_0xa826('0x167'),this[_0xa826('0x10')][_0xa826('0x3d')],_0x1ed1ed[_0xa826('0x164')]));return{'code':0xc8,'result':_0xa826('0x168')};}else{logger['info'](util['format'](_0xa826('0x169'),this[_0xa826('0x10')][_0xa826('0x3d')],_0x1ed1ed[_0xa826('0x164')]));this[_0xa826('0x10')][_0xa826('0xb9')](util['format'](_0xa826('0x169'),this['channel']['callerid'],_0x1ed1ed['findBy']));return{'code':0xc8,'result':_0xa826('0x16a')};}};AGIVertices[_0xa826('0x18')][_0xa826('0x1d4')]=function(_0x23ce7f){logger['info'](util[_0xa826('0x5c')](_0xa826('0x1d5'),_0x23ce7f[_0xa826('0x39')]));var _0x21d03b=this[_0xa826('0x10')]['exec'](_0xa826('0x1d6'),[_0x23ce7f['mailbox'],_0x23ce7f[_0xa826('0x83')]]);if(_0x21d03b[_0xa826('0xaf')]===-0x1){return _0x21d03b;}return this['channel'][_0xa826('0xb9')](util[_0xa826('0x5c')](_0xa826('0xce'),_0xa826('0x1d6'),_0x23ce7f[_0xa826('0x1d7')]));};AGIVertices[_0xa826('0x18')][_0xa826('0x1d8')]=function(_0x2f888c){logger[_0xa826('0x2f')](util['format'](_0xa826('0x1d9'),_0x2f888c[_0xa826('0x39')]));if(!this[_0xa826('0x91')](_0x2f888c['variable_id'])){return this['channel'][_0xa826('0x2d')](_0x2f888c,_0xa826('0x1bc'));}var _0x49e31b=this[_0xa826('0x13')]['sync'](this,_0x2f888c[_0xa826('0xe1')]);if(!_0x49e31b){return this['channel'][_0xa826('0x2d')](_0x2f888c,_0xa826('0xe3'));}var _0x1a5a4a=this[_0xa826('0x10')][_0xa826('0x13')](_0x49e31b);return{'code':0xc8,'result':_0x1a5a4a[_0xa826('0xad')]?_0x1a5a4a[_0xa826('0xad')]:'-'};};String[_0xa826('0x18')][_0xa826('0xac')]=function(_0x2d9731,_0x4773cc){return this[_0xa826('0xab')](_0x2d9731)[_0xa826('0x1da')](_0x4773cc);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 8e45782..8e8d28a 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 _0xa5f3=['timers','channels','agentconnect','syncAgentConnect','hanguprequest','syncHangupRequest','bind','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw','queue','ACW','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','lastPauseAt','update','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','finally','[ACW][START]\x20%s','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','acw','mandatoryDisposition','interface','[ACW][syncAgentConnect]\x20%s','uniqueid','[ACW][syncAgentConnectPreview]\x20%s','message','isUndefined','attended','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','syncBlindTransfer','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents'];(function(_0x1a6823,_0x5ce89b){var _0x30d5b7=function(_0x362b61){while(--_0x362b61){_0x1a6823['push'](_0x1a6823['shift']());}};_0x30d5b7(++_0x5ce89b);}(_0xa5f3,0x1ad));var _0x3a5f=function(_0x28b2c0,_0xa83337){_0x28b2c0=_0x28b2c0-0x0;var _0x42b275=_0xa5f3[_0x28b2c0];return _0x42b275;};'use strict';var util=require('util');var _=require(_0x3a5f('0x0'));var moment=require('moment');var ami=require('../ami');var logger=require(_0x3a5f('0x1'))('acw');var RpcUser=require(_0x3a5f('0x2'));var RpcVoiceAgentReport=require(_0x3a5f('0x3'));function Acw(_0x52dadc){this[_0x3a5f('0x4')]=_0x52dadc[_0x3a5f('0x4')];this['agents']=_0x52dadc[_0x3a5f('0x5')];this[_0x3a5f('0x6')]=_0x52dadc['timers'];this[_0x3a5f('0x7')]={};ami['on'](_0x3a5f('0x8'),this[_0x3a5f('0x9')]['bind'](this));ami['on'](_0x3a5f('0xa'),this[_0x3a5f('0xb')][_0x3a5f('0xc')](this));ami['on']('hangup',this[_0x3a5f('0xd')][_0x3a5f('0xc')](this));ami['on'](_0x3a5f('0xe'),this[_0x3a5f('0xf')]['bind'](this));ami['on'](_0x3a5f('0x10'),this[_0x3a5f('0x11')]['bind'](this));ami['on'](_0x3a5f('0x12'),this['syncBlindTransfer'][_0x3a5f('0xc')](this));ami['on'](_0x3a5f('0x13'),this[_0x3a5f('0x14')]['bind'](this));}function getDiff(_0x375e31){var _0x515b53=moment()[_0x3a5f('0x15')](0x0);var _0x6c075a=moment(_0x375e31)[_0x3a5f('0x15')](0x0);return _0x515b53['diff'](_0x6c075a,_0x3a5f('0x16'));}Acw[_0x3a5f('0x17')][_0x3a5f('0x18')]=function(_0x5a436d){try{var _0x446ab7=this;var _0x34406c=this[_0x3a5f('0x7')][_0x5a436d]['interface'];var _0x2b0871=this[_0x3a5f('0x7')][_0x5a436d][_0x3a5f('0x19')];var _0x13b4ba=this['voiceQueues'][_0x2b0871];var _0x2ffce1=![];var _0x21b006=_0x3a5f('0x1a');if(_0x13b4ba['mandatoryDisposition']){if(_0x13b4ba[_0x3a5f('0x1b')][_0x3a5f('0x1c')]){_0x2ffce1=!![];_0x21b006=_0x13b4ba[_0x3a5f('0x1b')][_0x3a5f('0x1c')];}}ami[_0x3a5f('0x1d')]({'action':_0x3a5f('0x1e'),'interface':_0x34406c,'paused':!![],'reason':_0x21b006})[_0x3a5f('0x1f')](function(_0xdcf807){if(_0x446ab7[_0x3a5f('0x5')][_0x34406c]){return RpcUser[_0x3a5f('0x20')](_0x446ab7[_0x3a5f('0x5')][_0x34406c]['id'])[_0x3a5f('0x1f')](function(_0x44155e){if(_0x44155e&&!_0x44155e['voicePause']){logger['info'](_0x3a5f('0x21'),_0x5a436d,_0x34406c,_0x2b0871);var _0x22949c=_0x446ab7[_0x3a5f('0x7')][_0x5a436d]['attended']&&_0x446ab7[_0x3a5f('0x7')][_0x5a436d]['destlinkedid']?_0x446ab7[_0x3a5f('0x7')][_0x5a436d][_0x3a5f('0x22')]:_0x5a436d;return RpcUser[_0x3a5f('0x23')](_0x446ab7[_0x3a5f('0x5')][_0x34406c],_0x21b006,_0x22949c)[_0x3a5f('0x1f')](function(_0xfad14e){if(!_0x2ffce1){_0x446ab7[_0x3a5f('0x6')][_0x34406c]={};logger['info'](_0x3a5f('0x24'),_0x5a436d,_0x446ab7[_0x3a5f('0x4')][_0x2b0871][_0x3a5f('0x25')],_0x34406c,_0x2b0871);_0x446ab7[_0x3a5f('0x6')][_0x34406c][_0x3a5f('0x26')]=setTimeout(_0x446ab7[_0x3a5f('0x27')][_0x3a5f('0xc')](_0x446ab7,_0x34406c),_0x446ab7[_0x3a5f('0x4')][_0x2b0871][_0x3a5f('0x25')]*0x3e8);_0x446ab7[_0x3a5f('0x6')][_0x34406c]['lastPauseAt']=moment()[_0x3a5f('0x28')](_0x3a5f('0x29'));_0x446ab7[_0x3a5f('0x6')][_0x34406c]['uniqueid']=_0x5a436d;_0x446ab7[_0x3a5f('0x6')][_0x34406c][_0x3a5f('0x19')]=_0x2b0871;_0x446ab7[_0x3a5f('0x6')][_0x34406c][_0x3a5f('0x2a')]=function(){var _0x175d1f=getDiff(_0x446ab7[_0x3a5f('0x6')][_0x34406c][_0x3a5f('0x2b')]);clearTimeout(_0x446ab7[_0x3a5f('0x6')][_0x34406c][_0x3a5f('0x26')]);_0x446ab7['timers'][_0x34406c][_0x3a5f('0x26')]=![];RpcVoiceAgentReport[_0x3a5f('0x2c')]({'acwtime':_0x175d1f},_0x446ab7[_0x3a5f('0x6')][_0x34406c]['uniqueid'],_0x34406c)[_0x3a5f('0x1f')](function(_0x22b590){logger[_0x3a5f('0x2d')](_0x3a5f('0x2e'),_0x5a436d,_0x175d1f,_0x22b590);})[_0x3a5f('0x2f')](function(_0x26104d){logger[_0x3a5f('0x30')](_0x3a5f('0x31'),_0x5a436d,_0x26104d);});delete _0x446ab7[_0x3a5f('0x6')][_0x34406c];};}});}else{logger[_0x3a5f('0x2d')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x5a436d,_0x34406c,_0x2b0871);}});}})[_0x3a5f('0x2f')](function(_0xa507b6){logger[_0x3a5f('0x30')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x5a436d,_0x446ab7['voiceQueues'][_0x2b0871][_0x3a5f('0x25')],_0x34406c,_0x2b0871);})[_0x3a5f('0x32')](function(){delete _0x446ab7[_0x3a5f('0x7')][_0x5a436d];});}catch(_0x4c91c3){logger['error'](_0x3a5f('0x33'),_0x4c91c3['message']);}};Acw[_0x3a5f('0x17')][_0x3a5f('0x27')]=function(_0x4b5d63){try{var _0xb98da3=this;if(_0xb98da3[_0x3a5f('0x6')][_0x4b5d63]){_0xb98da3['timers'][_0x4b5d63][_0x3a5f('0x26')]=![];var _0x78360a=_0xb98da3[_0x3a5f('0x6')][_0x4b5d63]['uniqueid'];var _0x3fbdb5=_0xb98da3[_0x3a5f('0x6')][_0x4b5d63]['queue'];var _0x4810e9=_0xb98da3['voiceQueues'][_0x3fbdb5][_0x3a5f('0x25')];logger[_0x3a5f('0x2d')]('[%s][TIMER][STOP][AGENT:%s]',_0x78360a,_0x4b5d63);RpcUser[_0x3a5f('0x34')](this[_0x3a5f('0x5')][_0x4b5d63]);RpcVoiceAgentReport['update']({'acwtime':_0x4810e9,'agentacw':!![]},_0x78360a,_0x4b5d63)[_0x3a5f('0x1f')](function(_0x89c179){logger['info'](_0x3a5f('0x2e'),_0x78360a,_0x4810e9,_0x89c179);})[_0x3a5f('0x2f')](function(_0xa16780){logger[_0x3a5f('0x30')](_0x3a5f('0x31'),_0x78360a,_0xa16780);});}else{logger[_0x3a5f('0x30')](_0x3a5f('0x35'),_0x4b5d63);if(_0xb98da3['timers']){logger[_0x3a5f('0x2d')](_0x3a5f('0x36'),JSON[_0x3a5f('0x37')](_0xb98da3[_0x3a5f('0x6')]));}}}catch(_0x522f11){logger[_0x3a5f('0x30')](_0x3a5f('0x38'),_0x522f11['message']);}};Acw[_0x3a5f('0x17')]['syncAgentConnect']=function(_0x2b0c3b){try{if(this[_0x3a5f('0x4')][_0x2b0c3b[_0x3a5f('0x19')]]&&(this[_0x3a5f('0x4')][_0x2b0c3b[_0x3a5f('0x19')]][_0x3a5f('0x39')]||this['voiceQueues'][_0x2b0c3b[_0x3a5f('0x19')]][_0x3a5f('0x3a')])){if(this[_0x3a5f('0x5')][_0x2b0c3b[_0x3a5f('0x3b')]]){this[_0x3a5f('0x7')][_0x2b0c3b['uniqueid']]={'queue':_0x2b0c3b[_0x3a5f('0x19')],'interface':_0x2b0c3b[_0x3a5f('0x3b')],'destlinkedid':_0x2b0c3b['destlinkedid']};}}}catch(_0x4cd59f){logger['error'](_0x3a5f('0x3c'),_0x4cd59f['message']);}};Acw[_0x3a5f('0x17')][_0x3a5f('0x14')]=function(_0x12f088){try{if(this[_0x3a5f('0x4')][_0x12f088[_0x3a5f('0x19')]]&&(this['voiceQueues'][_0x12f088[_0x3a5f('0x19')]][_0x3a5f('0x39')]||this[_0x3a5f('0x4')][_0x12f088['queue']]['mandatoryDisposition'])){if(this[_0x3a5f('0x5')][_0x12f088['interface']]){this['channels'][_0x12f088[_0x3a5f('0x3d')]]={'queue':_0x12f088[_0x3a5f('0x19')],'interface':_0x12f088[_0x3a5f('0x3b')]};}}}catch(_0x57e7e0){logger[_0x3a5f('0x30')](_0x3a5f('0x3e'),_0x57e7e0[_0x3a5f('0x3f')]);}};Acw['prototype']['syncHangupRequest']=function(_0x59ed4a){try{if(this[_0x3a5f('0x7')][_0x59ed4a[_0x3a5f('0x3d')]]&&_[_0x3a5f('0x40')](this[_0x3a5f('0x7')][_0x59ed4a[_0x3a5f('0x3d')]][_0x3a5f('0x41')])){logger[_0x3a5f('0x2d')]('[%s][HANGUP:UNIQUEID]',_0x59ed4a[_0x3a5f('0x3d')]);this[_0x3a5f('0x18')](_0x59ed4a[_0x3a5f('0x3d')]);}else if(this[_0x3a5f('0x7')][_0x59ed4a[_0x3a5f('0x42')]]&&_['isUndefined'](this[_0x3a5f('0x7')][_0x59ed4a['linkedid']]['attended'])){logger['info'](_0x3a5f('0x43'),_0x59ed4a[_0x3a5f('0x42')]);this[_0x3a5f('0x18')](_0x59ed4a['linkedid']);}}catch(_0x2f19f0){logger[_0x3a5f('0x30')]('[ACW][syncHangupRequest]\x20%s',_0x2f19f0[_0x3a5f('0x3f')]);}};Acw['prototype']['syncHangup']=function(_0x55e83e){try{if(this['channels'][_0x55e83e[_0x3a5f('0x3d')]]&&this['channels'][_0x55e83e[_0x3a5f('0x3d')]]['attended']){logger[_0x3a5f('0x2d')](_0x3a5f('0x44'),_0x55e83e[_0x3a5f('0x3d')]);this[_0x3a5f('0x18')](_0x55e83e['uniqueid']);}else if(this[_0x3a5f('0x7')][_0x55e83e[_0x3a5f('0x42')]]&&this[_0x3a5f('0x7')][_0x55e83e['linkedid']]['attended']){logger['info'](_0x3a5f('0x45'),_0x55e83e[_0x3a5f('0x42')]);this[_0x3a5f('0x18')](_0x55e83e[_0x3a5f('0x42')]);}}catch(_0x8e37b6){logger[_0x3a5f('0x30')](_0x3a5f('0x46'),_0x8e37b6[_0x3a5f('0x3f')]);}};Acw[_0x3a5f('0x17')][_0x3a5f('0x11')]=function(_0x372b71){try{if(!_['isNil'](this[_0x3a5f('0x7')][_0x372b71[_0x3a5f('0x47')]])){this['startAcw'](_0x372b71[_0x3a5f('0x47')]);if(this[_0x3a5f('0x7')][_0x372b71[_0x3a5f('0x48')]]){this[_0x3a5f('0x7')][_0x372b71[_0x3a5f('0x48')]][_0x3a5f('0x41')]=!![];this[_0x3a5f('0x7')][_0x372b71[_0x3a5f('0x49')]]=this[_0x3a5f('0x7')][_0x372b71[_0x3a5f('0x48')]];delete this[_0x3a5f('0x7')][_0x372b71['secondtransfereruniqueid']];}}else if(!_[_0x3a5f('0x4a')](this[_0x3a5f('0x7')][_0x372b71['transfertargetuniqueid']])){this[_0x3a5f('0x18')](_0x372b71[_0x3a5f('0x49')]);if(this[_0x3a5f('0x7')][_0x372b71[_0x3a5f('0x4b')]]){this[_0x3a5f('0x7')][_0x372b71[_0x3a5f('0x4b')]][_0x3a5f('0x41')]=!![];this[_0x3a5f('0x7')][_0x372b71[_0x3a5f('0x47')]]=this[_0x3a5f('0x7')][_0x372b71[_0x3a5f('0x4b')]];delete this['channels'][_0x372b71[_0x3a5f('0x4b')]];}}}catch(_0x1e2d84){logger[_0x3a5f('0x30')]('[ACW][syncAttendedTransfer]\x20%s',_0x1e2d84[_0x3a5f('0x3f')]);}};Acw['prototype'][_0x3a5f('0x4c')]=function(_0x320a65){try{if(this[_0x3a5f('0x7')][_0x320a65['transfereruniqueid']]){logger[_0x3a5f('0x2d')](_0x3a5f('0x4d'),JSON[_0x3a5f('0x37')](_0x320a65[_0x3a5f('0x4e')]));this[_0x3a5f('0x18')](_0x320a65[_0x3a5f('0x4e')]);}else if(this['channels'][_0x320a65[_0x3a5f('0x4f')]]){logger[_0x3a5f('0x2d')](_0x3a5f('0x50'),JSON[_0x3a5f('0x37')](_0x320a65['transfererlinkedid']));this['startAcw'](_0x320a65[_0x3a5f('0x4f')]);}}catch(_0x57dbee){logger[_0x3a5f('0x30')](_0x3a5f('0x51'),_0x57dbee[_0x3a5f('0x3f')]);}};Acw[_0x3a5f('0x17')][_0x3a5f('0xf')]=function(_0x22e969){try{if(this[_0x3a5f('0x4')][_0x22e969['queue']]&&this[_0x3a5f('0x4')][_0x22e969[_0x3a5f('0x19')]]['autopause']===_0x3a5f('0x52')){if(this['agents'][_0x22e969['interface']]){logger[_0x3a5f('0x2d')](_0x3a5f('0x53'),_0x22e969[_0x3a5f('0x3d')],_0x22e969['interface'],_0x22e969[_0x3a5f('0x19')]);return RpcUser[_0x3a5f('0x23')](this[_0x3a5f('0x5')][_0x22e969['interface']],_0x3a5f('0x54'),_0x22e969['uniqueid']);}}}catch(_0x30c6e3){logger['error'](_0x3a5f('0x55'),_0x30c6e3['message']);}};module[_0x3a5f('0x56')]=Acw; \ No newline at end of file +var _0xaa31=['syncHangup','agentringnoanswer','syncAgentRingNoAnswer','bind','attendedtransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','then','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','error','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','savePause','Auto-Pause','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','hanguprequest','syncHangupRequest'];(function(_0x2f1c85,_0x5a9c57){var _0x5eaf9b=function(_0x2a5c7c){while(--_0x2a5c7c){_0x2f1c85['push'](_0x2f1c85['shift']());}};_0x5eaf9b(++_0x5a9c57);}(_0xaa31,0x1d7));var _0x1aa3=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0xaa31[_0xbf8ebe];return _0x1e25e8;};'use strict';var util=require(_0x1aa3('0x0'));var _=require(_0x1aa3('0x1'));var moment=require(_0x1aa3('0x2'));var ami=require(_0x1aa3('0x3'));var logger=require(_0x1aa3('0x4'))(_0x1aa3('0x5'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x1aa3('0x6'));function Acw(_0x192bc0){this['voiceQueues']=_0x192bc0[_0x1aa3('0x7')];this['agents']=_0x192bc0[_0x1aa3('0x8')];this['timers']=_0x192bc0[_0x1aa3('0x9')];this[_0x1aa3('0xa')]={};ami['on'](_0x1aa3('0xb'),this[_0x1aa3('0xc')]['bind'](this));ami['on'](_0x1aa3('0xd'),this[_0x1aa3('0xe')]['bind'](this));ami['on']('hangup',this[_0x1aa3('0xf')]['bind'](this));ami['on'](_0x1aa3('0x10'),this[_0x1aa3('0x11')][_0x1aa3('0x12')](this));ami['on'](_0x1aa3('0x13'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0x1aa3('0x14'),this[_0x1aa3('0x15')][_0x1aa3('0x12')](this));ami['on']('custom:agentConnectPreview',this[_0x1aa3('0x16')][_0x1aa3('0x12')](this));}function getDiff(_0x2f910e){var _0x38257d=moment()[_0x1aa3('0x17')](0x0);var _0x1fa311=moment(_0x2f910e)[_0x1aa3('0x17')](0x0);return _0x38257d['diff'](_0x1fa311,_0x1aa3('0x18'));}Acw[_0x1aa3('0x19')][_0x1aa3('0x1a')]=function(_0x5886f2){try{var _0xf78b23=this;var _0x49ff68=this[_0x1aa3('0xa')][_0x5886f2][_0x1aa3('0x1b')];var _0xd88b18=this['channels'][_0x5886f2][_0x1aa3('0x1c')];var _0x2ef3c=this[_0x1aa3('0x7')][_0xd88b18];var _0x3ce113=![];var _0x431a27=_0x1aa3('0x1d');if(_0x2ef3c[_0x1aa3('0x1e')]){if(_0x2ef3c[_0x1aa3('0x1f')][_0x1aa3('0x20')]){_0x3ce113=!![];_0x431a27=_0x2ef3c['mandatoryDispositionPause'][_0x1aa3('0x20')];}}ami['Action']({'action':'QueuePause','interface':_0x49ff68,'paused':!![],'reason':_0x431a27})[_0x1aa3('0x21')](function(_0x18be96){if(_0xf78b23['agents'][_0x49ff68]){return RpcUser['getAgent'](_0xf78b23[_0x1aa3('0x8')][_0x49ff68]['id'])['then'](function(_0x2d89a1){if(_0x2d89a1&&!_0x2d89a1[_0x1aa3('0x22')]){logger['info'](_0x1aa3('0x23'),_0x5886f2,_0x49ff68,_0xd88b18);var _0x5c14de=_0xf78b23[_0x1aa3('0xa')][_0x5886f2][_0x1aa3('0x24')]&&_0xf78b23[_0x1aa3('0xa')][_0x5886f2][_0x1aa3('0x25')]?_0xf78b23[_0x1aa3('0xa')][_0x5886f2][_0x1aa3('0x25')]:_0x5886f2;return RpcUser['savePause'](_0xf78b23[_0x1aa3('0x8')][_0x49ff68],_0x431a27,_0x5c14de)[_0x1aa3('0x21')](function(_0x1668d2){if(!_0x3ce113){_0xf78b23['timers'][_0x49ff68]={};logger[_0x1aa3('0x26')](_0x1aa3('0x27'),_0x5886f2,_0xf78b23['voiceQueues'][_0xd88b18][_0x1aa3('0x28')],_0x49ff68,_0xd88b18);_0xf78b23['timers'][_0x49ff68][_0x1aa3('0x29')]=setTimeout(_0xf78b23[_0x1aa3('0x2a')][_0x1aa3('0x12')](_0xf78b23,_0x49ff68),_0xf78b23[_0x1aa3('0x7')][_0xd88b18][_0x1aa3('0x28')]*0x3e8);_0xf78b23[_0x1aa3('0x9')][_0x49ff68][_0x1aa3('0x2b')]=moment()[_0x1aa3('0x2c')](_0x1aa3('0x2d'));_0xf78b23[_0x1aa3('0x9')][_0x49ff68][_0x1aa3('0x2e')]=_0x5886f2;_0xf78b23[_0x1aa3('0x9')][_0x49ff68][_0x1aa3('0x1c')]=_0xd88b18;_0xf78b23[_0x1aa3('0x9')][_0x49ff68][_0x1aa3('0x2f')]=function(){var _0x3426db=getDiff(_0xf78b23[_0x1aa3('0x9')][_0x49ff68][_0x1aa3('0x2b')]);clearTimeout(_0xf78b23[_0x1aa3('0x9')][_0x49ff68][_0x1aa3('0x29')]);_0xf78b23[_0x1aa3('0x9')][_0x49ff68][_0x1aa3('0x29')]=![];RpcVoiceAgentReport[_0x1aa3('0x30')]({'acwtime':_0x3426db},_0xf78b23[_0x1aa3('0x9')][_0x49ff68][_0x1aa3('0x2e')],_0x49ff68)[_0x1aa3('0x21')](function(_0x215aed){logger[_0x1aa3('0x26')](_0x1aa3('0x31'),_0x5886f2,_0x3426db,_0x215aed);})[_0x1aa3('0x32')](function(_0x392cc2){logger['error'](_0x1aa3('0x33'),_0x5886f2,_0x392cc2);});delete _0xf78b23[_0x1aa3('0x9')][_0x49ff68];};}});}else{logger['info']('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x5886f2,_0x49ff68,_0xd88b18);}});}})[_0x1aa3('0x32')](function(_0x5126b9){logger[_0x1aa3('0x34')](_0x1aa3('0x27'),_0x5886f2,_0xf78b23[_0x1aa3('0x7')][_0xd88b18]['acwTimeout'],_0x49ff68,_0xd88b18);})['finally'](function(){delete _0xf78b23['channels'][_0x5886f2];});}catch(_0x348591){logger['error']('[ACW][START]\x20%s',_0x348591[_0x1aa3('0x35')]);}};Acw[_0x1aa3('0x19')][_0x1aa3('0x2a')]=function(_0x256b18){try{var _0x527878=this;if(_0x527878[_0x1aa3('0x9')][_0x256b18]){_0x527878['timers'][_0x256b18][_0x1aa3('0x29')]=![];var _0x24f29d=_0x527878[_0x1aa3('0x9')][_0x256b18][_0x1aa3('0x2e')];var _0x1a4143=_0x527878['timers'][_0x256b18][_0x1aa3('0x1c')];var _0x418ba3=_0x527878[_0x1aa3('0x7')][_0x1a4143][_0x1aa3('0x28')];logger[_0x1aa3('0x26')](_0x1aa3('0x36'),_0x24f29d,_0x256b18);RpcUser[_0x1aa3('0x37')](this[_0x1aa3('0x8')][_0x256b18]);RpcVoiceAgentReport[_0x1aa3('0x30')]({'acwtime':_0x418ba3,'agentacw':!![]},_0x24f29d,_0x256b18)['then'](function(_0x52442d){logger[_0x1aa3('0x26')](_0x1aa3('0x31'),_0x24f29d,_0x418ba3,_0x52442d);})[_0x1aa3('0x32')](function(_0x5c8c4e){logger[_0x1aa3('0x34')]('[%s][UPDATE][ERRORS:%s]',_0x24f29d,_0x5c8c4e);});}else{logger[_0x1aa3('0x34')](_0x1aa3('0x38'),_0x256b18);if(_0x527878['timers']){logger[_0x1aa3('0x26')]('[ACW][TIMERS]',JSON['stringify'](_0x527878[_0x1aa3('0x9')]));}}}catch(_0x331f52){logger[_0x1aa3('0x34')]('[ACW][STOP]\x20%s',_0x331f52[_0x1aa3('0x35')]);}};Acw[_0x1aa3('0x19')][_0x1aa3('0xc')]=function(_0x297893){try{if(this[_0x1aa3('0x7')][_0x297893[_0x1aa3('0x1c')]]&&(this[_0x1aa3('0x7')][_0x297893[_0x1aa3('0x1c')]][_0x1aa3('0x5')]||this[_0x1aa3('0x7')][_0x297893['queue']][_0x1aa3('0x1e')])){if(this[_0x1aa3('0x8')][_0x297893[_0x1aa3('0x1b')]]){this[_0x1aa3('0xa')][_0x297893[_0x1aa3('0x2e')]]={'queue':_0x297893[_0x1aa3('0x1c')],'interface':_0x297893[_0x1aa3('0x1b')],'destlinkedid':_0x297893[_0x1aa3('0x25')]};}}}catch(_0xe917f2){logger['error'](_0x1aa3('0x39'),_0xe917f2[_0x1aa3('0x35')]);}};Acw[_0x1aa3('0x19')][_0x1aa3('0x16')]=function(_0x17eaeb){try{if(this['voiceQueues'][_0x17eaeb[_0x1aa3('0x1c')]]&&(this[_0x1aa3('0x7')][_0x17eaeb[_0x1aa3('0x1c')]][_0x1aa3('0x5')]||this[_0x1aa3('0x7')][_0x17eaeb[_0x1aa3('0x1c')]][_0x1aa3('0x1e')])){if(this[_0x1aa3('0x8')][_0x17eaeb[_0x1aa3('0x1b')]]){this[_0x1aa3('0xa')][_0x17eaeb[_0x1aa3('0x2e')]]={'queue':_0x17eaeb[_0x1aa3('0x1c')],'interface':_0x17eaeb[_0x1aa3('0x1b')]};}}}catch(_0x49fcff){logger[_0x1aa3('0x34')](_0x1aa3('0x3a'),_0x49fcff[_0x1aa3('0x35')]);}};Acw[_0x1aa3('0x19')]['syncHangupRequest']=function(_0x12625a){try{if(this[_0x1aa3('0xa')][_0x12625a[_0x1aa3('0x2e')]]&&_[_0x1aa3('0x3b')](this[_0x1aa3('0xa')][_0x12625a['uniqueid']]['attended'])){logger['info']('[%s][HANGUP:UNIQUEID]',_0x12625a[_0x1aa3('0x2e')]);this[_0x1aa3('0x1a')](_0x12625a['uniqueid']);}else if(this[_0x1aa3('0xa')][_0x12625a[_0x1aa3('0x3c')]]&&_['isUndefined'](this['channels'][_0x12625a[_0x1aa3('0x3c')]][_0x1aa3('0x24')])){logger[_0x1aa3('0x26')](_0x1aa3('0x3d'),_0x12625a[_0x1aa3('0x3c')]);this[_0x1aa3('0x1a')](_0x12625a[_0x1aa3('0x3c')]);}}catch(_0x36c361){logger['error'](_0x1aa3('0x3e'),_0x36c361['message']);}};Acw['prototype']['syncHangup']=function(_0x50362b){try{if(this['channels'][_0x50362b[_0x1aa3('0x2e')]]&&this[_0x1aa3('0xa')][_0x50362b[_0x1aa3('0x2e')]]['attended']){logger[_0x1aa3('0x26')](_0x1aa3('0x3f'),_0x50362b[_0x1aa3('0x2e')]);this[_0x1aa3('0x1a')](_0x50362b[_0x1aa3('0x2e')]);}else if(this[_0x1aa3('0xa')][_0x50362b[_0x1aa3('0x3c')]]&&this['channels'][_0x50362b[_0x1aa3('0x3c')]]['attended']){logger['info']('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x50362b[_0x1aa3('0x3c')]);this['startAcw'](_0x50362b[_0x1aa3('0x3c')]);}}catch(_0x51fce3){logger[_0x1aa3('0x34')](_0x1aa3('0x40'),_0x51fce3[_0x1aa3('0x35')]);}};Acw[_0x1aa3('0x19')][_0x1aa3('0x41')]=function(_0x1eec7f){try{if(!_['isNil'](this[_0x1aa3('0xa')][_0x1eec7f[_0x1aa3('0x42')]])){this[_0x1aa3('0x1a')](_0x1eec7f[_0x1aa3('0x42')]);if(this[_0x1aa3('0xa')][_0x1eec7f[_0x1aa3('0x43')]]){this['channels'][_0x1eec7f['secondtransfereruniqueid']][_0x1aa3('0x24')]=!![];this[_0x1aa3('0xa')][_0x1eec7f[_0x1aa3('0x44')]]=this[_0x1aa3('0xa')][_0x1eec7f[_0x1aa3('0x43')]];delete this['channels'][_0x1eec7f[_0x1aa3('0x43')]];}}else if(!_[_0x1aa3('0x45')](this[_0x1aa3('0xa')][_0x1eec7f[_0x1aa3('0x44')]])){this[_0x1aa3('0x1a')](_0x1eec7f[_0x1aa3('0x44')]);if(this[_0x1aa3('0xa')][_0x1eec7f[_0x1aa3('0x46')]]){this['channels'][_0x1eec7f[_0x1aa3('0x46')]][_0x1aa3('0x24')]=!![];this[_0x1aa3('0xa')][_0x1eec7f['transfereeuniqueid']]=this[_0x1aa3('0xa')][_0x1eec7f[_0x1aa3('0x46')]];delete this['channels'][_0x1eec7f[_0x1aa3('0x46')]];}}}catch(_0xe8599e){logger[_0x1aa3('0x34')](_0x1aa3('0x47'),_0xe8599e['message']);}};Acw[_0x1aa3('0x19')][_0x1aa3('0x15')]=function(_0xecb2d1){try{if(this['channels'][_0xecb2d1[_0x1aa3('0x48')]]){logger[_0x1aa3('0x26')](_0x1aa3('0x49'),JSON[_0x1aa3('0x4a')](_0xecb2d1[_0x1aa3('0x48')]));this[_0x1aa3('0x1a')](_0xecb2d1[_0x1aa3('0x48')]);}else if(this[_0x1aa3('0xa')][_0xecb2d1[_0x1aa3('0x4b')]]){logger[_0x1aa3('0x26')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x1aa3('0x4a')](_0xecb2d1[_0x1aa3('0x4b')]));this['startAcw'](_0xecb2d1[_0x1aa3('0x4b')]);}}catch(_0x481ae3){logger[_0x1aa3('0x34')](_0x1aa3('0x4c'),_0x481ae3[_0x1aa3('0x35')]);}};Acw[_0x1aa3('0x19')][_0x1aa3('0x11')]=function(_0x1d5319){try{if(this[_0x1aa3('0x7')][_0x1d5319[_0x1aa3('0x1c')]]&&this[_0x1aa3('0x7')][_0x1d5319['queue']][_0x1aa3('0x4d')]===_0x1aa3('0x4e')){if(this[_0x1aa3('0x8')][_0x1d5319[_0x1aa3('0x1b')]]){logger[_0x1aa3('0x26')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x1d5319[_0x1aa3('0x2e')],_0x1d5319[_0x1aa3('0x1b')],_0x1d5319[_0x1aa3('0x1c')]);return RpcUser[_0x1aa3('0x4f')](this[_0x1aa3('0x8')][_0x1d5319['interface']],_0x1aa3('0x50'),_0x1d5319[_0x1aa3('0x2e')]);}}}catch(_0x1cdd63){logger[_0x1aa3('0x34')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x1cdd63[_0x1aa3('0x35')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 9d4d057..6d82144 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 _0x757a=['devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','once','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','[ami.js][fullybooted]','close','exports','bluebird','moment','ami','../../config/environment','asterisk','port','password','Action','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','actionSipShowRegistry','actionDeviceStateList'];(function(_0x45d628,_0x1190fb){var _0x3675ad=function(_0x594c10){while(--_0x594c10){_0x45d628['push'](_0x45d628['shift']());}};_0x3675ad(++_0x1190fb);}(_0x757a,0xde));var _0xa757=function(_0x5640be,_0x513e3e){_0x5640be=_0x5640be-0x0;var _0x59d0fd=_0x757a[_0x5640be];return _0x59d0fd;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var util=require('util');var _=require('lodash');var logger=require('../../config/logger')(_0xa757('0x2'));var config=require(_0xa757('0x3'));var ami=new Manager(config[_0xa757('0x4')][_0xa757('0x5')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')]['username'],config[_0xa757('0x4')][_0xa757('0x6')],!![]);ami['keepConnected']();ami[_0xa757('0x7')]=BPromise[_0xa757('0x8')](ami[_0xa757('0x9')]);function error(_0x1a95ee){logger[_0xa757('0xa')](util['format'](_0xa757('0xb'),config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')],util[_0xa757('0xd')](_0x1a95ee,![],null)));}function close(){logger['error'](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk']['username'],config[_0xa757('0x4')]['ip'],config['asterisk']['port']));}ami[_0xa757('0xe')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0xa757('0xf')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x10')});};};ami[_0xa757('0x11')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x12')});};};ami[_0xa757('0x13')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x14')});};};ami[_0xa757('0x15')]=function(){return function(){return ami['Action']({'action':_0xa757('0x16')});};};function connect(_0x44eab8){logger[_0xa757('0x17')](util['format']('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')]));ami[_0xa757('0x18')]('error',error);ami[_0xa757('0x18')]('close',close);}ami['on'](_0xa757('0x19'),connect);ami['on'](_0xa757('0x1a'),function(_0x14014c){logger[_0xa757('0x17')](util['format']('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')],util[_0xa757('0xd')](_0x14014c,![],null)));});ami['on'](_0xa757('0x1b'),function(_0x21f1af){logger[_0xa757('0x17')](util['format'](_0xa757('0x1c'),config['asterisk'][_0xa757('0xc')],config['asterisk']['ip'],config[_0xa757('0x4')][_0xa757('0x5')]));return BPromise[_0xa757('0x1d')]()['then'](ami[_0xa757('0xe')]())[_0xa757('0x1e')](ami[_0xa757('0xf')]())[_0xa757('0x1e')](ami['actionSipPeerStatus']())[_0xa757('0x1e')](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())['catch'](function(_0xfdf69d){logger['error'](_0xa757('0x1f'),util[_0xa757('0xd')](_0xfdf69d,{'showHidden':![],'depth':null}));});});ami['once'](_0xa757('0xa'),error);ami['once'](_0xa757('0x20'),close);module[_0xa757('0x21')]=ami; \ No newline at end of file +var _0xbaf0=['once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionSipShowRegistry','catch','[ami.js][fullybooted]','exports','bluebird','moment','util','lodash','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s'];(function(_0x277dbf,_0x2a5814){var _0x4949ce=function(_0x4b2fc4){while(--_0x4b2fc4){_0x277dbf['push'](_0x277dbf['shift']());}};_0x4949ce(++_0x2a5814);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var _=require(_0x0baf('0x3'));var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var config=require('../../config/environment');var ami=new Manager(config[_0x0baf('0x6')][_0x0baf('0x7')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')][_0x0baf('0x9')],!![]);ami[_0x0baf('0xa')]();ami[_0x0baf('0xb')]=BPromise['promisify'](ami[_0x0baf('0xc')]);function error(_0x5f20aa){logger[_0x0baf('0xd')](util[_0x0baf('0xe')](_0x0baf('0xf'),config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')],util[_0x0baf('0x10')](_0x5f20aa,![],null)));}function close(){logger[_0x0baf('0xd')](util[_0x0baf('0xe')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk'][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x0baf('0xb')]({'action':'sipshowregistry'});};};ami[_0x0baf('0x11')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x12')});};};ami[_0x0baf('0x13')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x14')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x0baf('0x15')});};};ami[_0x0baf('0x16')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x17')});};};function connect(_0x2cf7da){logger[_0x0baf('0x18')](util['format'](_0x0baf('0x19'),config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));ami['once']('error',error);ami[_0x0baf('0x1a')](_0x0baf('0x1b'),close);}ami['on'](_0x0baf('0x1c'),connect);ami['on'](_0x0baf('0x1d'),function(_0x1fa92b){logger[_0x0baf('0x18')](util[_0x0baf('0xe')](_0x0baf('0x1e'),config[_0x0baf('0x6')][_0x0baf('0x8')],config['asterisk']['ip'],config[_0x0baf('0x6')]['port'],util[_0x0baf('0x10')](_0x1fa92b,![],null)));});ami['on']('fullybooted',function(_0x4de74c){logger[_0x0baf('0x18')](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));return BPromise['resolve']()[_0x0baf('0x1f')](ami[_0x0baf('0x20')]())[_0x0baf('0x1f')](ami[_0x0baf('0x11')]())[_0x0baf('0x1f')](ami[_0x0baf('0x13')]())[_0x0baf('0x1f')](ami['actionQueueSummary']())[_0x0baf('0x1f')](ami[_0x0baf('0x16')]())[_0x0baf('0x21')](function(_0x265915){logger['error'](_0x0baf('0x22'),util[_0x0baf('0x10')](_0x265915,{'showHidden':![],'depth':null}));});});ami['once'](_0x0baf('0xd'),error);ami[_0x0baf('0x1a')](_0x0baf('0x1b'),close);module[_0x0baf('0x23')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 411f556..23a28fa 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 _0xe706=['result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','debug','rpc','memberReport','error','message'];(function(_0x11f249,_0x4ca4a8){var _0x5c3656=function(_0x27c9f8){while(--_0x27c9f8){_0x11f249['push'](_0x11f249['shift']());}};_0x5c3656(++_0x4ca4a8);}(_0xe706,0xa3));var _0x6e70=function(_0x1e41ba,_0x455a21){_0x1e41ba=_0x1e41ba-0x0;var _0x201d61=_0xe706[_0x1e41ba];return _0x201d61;};'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 +var _0xd8b0=['message','result','catch','exports','jayson/promise','bluebird','http','Request','then','debug','memberReport','error','rpc'];(function(_0x195223,_0x121404){var _0x3a62dd=function(_0x3adeda){while(--_0x3adeda){_0x195223['push'](_0x195223['shift']());}};_0x3a62dd(++_0x121404);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var jayson=require(_0x0d8b('0x0'));var BPromise=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('ami');var client=jayson['client'][_0x0d8b('0x2')]({'port':0x2329});client[_0x0d8b('0x3')]=function(_0x43bca1,_0x364286){return new BPromise(function(_0x8196ed,_0x577834){return client['request'](_0x43bca1,_0x364286)[_0x0d8b('0x4')](function(_0x227c63){logger[_0x0d8b('0x5')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x364286,_0x227c63);if(_0x227c63[_0x0d8b('0x7')]){logger['error'](_0x0d8b('0x8'),_0x0d8b('0x6'),_0x43bca1,_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')],_0x364286);return _0x577834(_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')]);}else{return _0x8196ed(_0x227c63[_0x0d8b('0xa')]);}})[_0x0d8b('0xb')](function(_0x48fa16){logger[_0x0d8b('0x7')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x48fa16,_0x364286);return _0x577834(_0x48fa16);});});};module[_0x0d8b('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index adfa629..068ef3f 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 _0x2835=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','getCaller','dialCutDigit','substring','getQueue','exports','lodash','string','voiceQueue','name','phone','firstName','Contact','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x3c9378,_0x33086f){var _0x3c20be=function(_0x53e3fd){while(--_0x53e3fd){_0x3c9378['push'](_0x3c9378['shift']());}};_0x3c20be(++_0x33086f);}(_0x2835,0x8e));var _0x5283=function(_0x1ec7df,_0x48710d){_0x1ec7df=_0x1ec7df-0x0;var _0x800bc3=_0x2835[_0x1ec7df];return _0x800bc3;};'use strict';var util=require('util');var _=require(_0x5283('0x0'));var moment=require('moment');function checkNameSurname(_0x1d07fc,_0x37f455,_0x39de14){var _0x3ab533='';if(!_['isNil'](_0x37f455)&&_0x5283('0x1')===typeof _0x37f455){_0x3ab533+=_0x37f455;}if(!_['isNil'](_0x39de14)&&_0x5283('0x1')===typeof _0x39de14){_0x3ab533+='\x20'+_0x39de14;}if(_0x3ab533!==''){return _0x3ab533;}return _0x1d07fc;}function Action(_0x104998,_0x743551,_0x29c0bc){this[_0x5283('0x2')]=_0x104998;this['uniqueid']=_0x29c0bc||undefined;this[_0x5283('0x3')]=checkNameSurname(_0x743551['Contact'][_0x5283('0x4')],_0x743551['Contact'][_0x5283('0x5')],_0x743551[_0x5283('0x6')][_0x5283('0x7')]);this[_0x5283('0x8')]=_0x743551[_0x5283('0x6')][_0x5283('0x4')];this[_0x5283('0x9')]=_0x104998[_0x5283('0x3')];this['active']=_0x743551[_0x5283('0xa')]||![];this[_0x5283('0xb')]=_0x104998[_0x5283('0xb')];this[_0x5283('0xc')]=_0x104998[_0x5283('0xc')]||0x3;this['scheduledat']=_0x743551[_0x5283('0xd')];this[_0x5283('0xe')]=_0x743551['countbusyretry'];this[_0x5283('0xf')]=_0x743551[_0x5283('0xf')];this[_0x5283('0x10')]=_0x743551[_0x5283('0x10')];this[_0x5283('0x11')]=_0x743551[_0x5283('0x11')];this['countdropretry']=_0x743551[_0x5283('0x12')];this['countabandonedretry']=_0x743551[_0x5283('0x13')];this[_0x5283('0x14')]=_0x743551[_0x5283('0x14')];this[_0x5283('0x15')]=_0x743551[_0x5283('0x15')];this['ContactId']=_0x743551[_0x5283('0x16')];this[_0x5283('0x17')]=_0x743551[_0x5283('0x17')];this[_0x5283('0x18')]=_0x743551['UserId'];this[_0x5283('0x19')]=_0x743551[_0x5283('0x19')];this[_0x5283('0x1a')]=_0x743551[_0x5283('0x1a')];this['idHopper']=_0x743551['id'];this[_0x5283('0x1b')]=_0x743551[_0x5283('0x6')][_0x5283('0x5')]||'';this[_0x5283('0x1c')]=moment()[_0x5283('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x5283('0x1e')]=_0x743551['callback'];this[_0x5283('0x1f')]=_0x743551[_0x5283('0x1f')];this[_0x5283('0x20')]=_0x743551[_0x5283('0x20')];this[_0x5283('0x21')]=_0x743551[_0x5283('0x21')];this['originatecalleridnum']='';this[_0x5283('0x22')]='';}Action[_0x5283('0x23')][_0x5283('0x24')]=function(){return util[_0x5283('0x1d')]('\x22%s\x22\x20<%s>',this[_0x5283('0x3')],this['voiceQueue'][_0x5283('0x25')]>0x0?this[_0x5283('0x8')][_0x5283('0x26')](this[_0x5283('0x2')]['dialCutDigit']):this[_0x5283('0x8')]);};Action[_0x5283('0x23')][_0x5283('0x27')]=function(){return this[_0x5283('0x9')];};module[_0x5283('0x28')]=Action; \ No newline at end of file +var _0x1583=['exports','util','lodash','moment','isNil','string','uniqueid','Contact','firstName','lastName','number','phone','queue','name','type','dialQueueTimeout','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','originatecalleridnum','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','dialCutDigit','substring','voiceQueue','getQueue'];(function(_0x2644f8,_0x40977c){var _0x233fea=function(_0x308f49){while(--_0x308f49){_0x2644f8['push'](_0x2644f8['shift']());}};_0x233fea(++_0x40977c);}(_0x1583,0x18d));var _0x3158=function(_0x45c0e5,_0x2ed027){_0x45c0e5=_0x45c0e5-0x0;var _0x1e144e=_0x1583[_0x45c0e5];return _0x1e144e;};'use strict';var util=require(_0x3158('0x0'));var _=require(_0x3158('0x1'));var moment=require(_0x3158('0x2'));function checkNameSurname(_0x400f4e,_0x5206b5,_0x42a3ee){var _0x367f9c='';if(!_[_0x3158('0x3')](_0x5206b5)&&_0x3158('0x4')===typeof _0x5206b5){_0x367f9c+=_0x5206b5;}if(!_[_0x3158('0x3')](_0x42a3ee)&&_0x3158('0x4')===typeof _0x42a3ee){_0x367f9c+='\x20'+_0x42a3ee;}if(_0x367f9c!==''){return _0x367f9c;}return _0x400f4e;}function Action(_0x545144,_0x1ca6cd,_0x2c483e){this['voiceQueue']=_0x545144;this[_0x3158('0x5')]=_0x2c483e||undefined;this['name']=checkNameSurname(_0x1ca6cd[_0x3158('0x6')]['phone'],_0x1ca6cd[_0x3158('0x6')][_0x3158('0x7')],_0x1ca6cd[_0x3158('0x6')][_0x3158('0x8')]);this[_0x3158('0x9')]=_0x1ca6cd[_0x3158('0x6')][_0x3158('0xa')];this[_0x3158('0xb')]=_0x545144[_0x3158('0xc')];this['active']=_0x1ca6cd['active']||![];this[_0x3158('0xd')]=_0x545144[_0x3158('0xd')];this['dialQueueTimeout']=_0x545144[_0x3158('0xe')]||0x3;this['scheduledat']=_0x1ca6cd['scheduledat'];this[_0x3158('0xf')]=_0x1ca6cd[_0x3158('0xf')];this[_0x3158('0x10')]=_0x1ca6cd[_0x3158('0x10')];this['countnoanswerretry']=_0x1ca6cd[_0x3158('0x11')];this[_0x3158('0x12')]=_0x1ca6cd[_0x3158('0x12')];this[_0x3158('0x13')]=_0x1ca6cd[_0x3158('0x13')];this[_0x3158('0x14')]=_0x1ca6cd[_0x3158('0x14')];this[_0x3158('0x15')]=_0x1ca6cd[_0x3158('0x15')];this[_0x3158('0x16')]=_0x1ca6cd['countagentrejectretry'];this[_0x3158('0x17')]=_0x1ca6cd[_0x3158('0x17')];this[_0x3158('0x18')]=_0x1ca6cd['ListId'];this[_0x3158('0x19')]=_0x1ca6cd['UserId'];this[_0x3158('0x1a')]=_0x1ca6cd[_0x3158('0x1a')];this[_0x3158('0x1b')]=_0x1ca6cd[_0x3158('0x1b')];this['idHopper']=_0x1ca6cd['id'];this['ContactFirstName']=_0x1ca6cd[_0x3158('0x6')][_0x3158('0x7')]||'';this[_0x3158('0x1c')]=moment()['format'](_0x3158('0x1d'));this[_0x3158('0x1e')]=_0x1ca6cd[_0x3158('0x1e')];this[_0x3158('0x1f')]=_0x1ca6cd[_0x3158('0x1f')];this[_0x3158('0x20')]=_0x1ca6cd[_0x3158('0x20')];this['recallme']=_0x1ca6cd['recallme'];this[_0x3158('0x21')]='';this[_0x3158('0x22')]='';}Action[_0x3158('0x23')][_0x3158('0x24')]=function(){return util[_0x3158('0x25')](_0x3158('0x26'),this[_0x3158('0xc')],this['voiceQueue'][_0x3158('0x27')]>0x0?this[_0x3158('0x9')][_0x3158('0x28')](this[_0x3158('0x29')][_0x3158('0x27')]):this[_0x3158('0x9')]);};Action[_0x3158('0x23')][_0x3158('0x2a')]=function(){return this[_0x3158('0xb')];};module[_0x3158('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 7b5e943..5ad3839 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 _0x350e=['talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','diff','seconds','state','scheduledat','type','queue','countcongestionretry','countnoanswerretry','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime'];(function(_0x48c2ae,_0x4cea90){var _0x8f7531=function(_0x126458){while(--_0x126458){_0x48c2ae['push'](_0x48c2ae['shift']());}};_0x8f7531(++_0x4cea90);}(_0x350e,0x1f3));var _0xe350=function(_0x567842,_0x10bb45){_0x567842=_0x567842-0x0;var _0x2778b=_0x350e[_0x567842];return _0x2778b;};'use strict';var util=require('util');var _=require(_0xe350('0x0'));var moment=require('moment');function getSeconds(_0x2e87bb,_0x1392d9){var _0x4b7a7a=moment(_0x2e87bb)[_0xe350('0x1')](0x0);var _0x46d869=moment(_0x1392d9)[_0xe350('0x1')](0x0);return _0x4b7a7a[_0xe350('0x2')](_0x46d869,_0xe350('0x3'));}function AgentComplete(_0x5c41e1,_0x5ba68b){this[_0xe350('0x4')]=0x4;this['statedesc']='Answer';this['scheduledat']=_0x5c41e1[_0xe350('0x5')];this['type']=_0x5c41e1[_0xe350('0x6')];this['campaigntype']=_0x5c41e1[_0xe350('0x6')]==='outbound'?_0xe350('0x7'):_0x5c41e1[_0xe350('0x6')];this['countbusyretry']=_0x5c41e1['countbusyretry'];this[_0xe350('0x8')]=_0x5c41e1[_0xe350('0x8')];this[_0xe350('0x9')]=_0x5c41e1[_0xe350('0x9')];this['countglobal']=_0x5c41e1[_0xe350('0xa')]+_0x5c41e1[_0xe350('0x8')]+_0x5c41e1[_0xe350('0x9')]+_0x5c41e1[_0xe350('0xb')]+_0x5c41e1[_0xe350('0xc')]+_0x5c41e1[_0xe350('0xd')]+_0x5c41e1[_0xe350('0xe')]+_0x5c41e1[_0xe350('0xf')];this[_0xe350('0xb')]=_0x5c41e1[_0xe350('0xb')];this[_0xe350('0xc')]=_0x5c41e1[_0xe350('0xc')];this['countabandonedretry']=_0x5c41e1[_0xe350('0xd')];this['countmachineretry']=_0x5c41e1[_0xe350('0xe')];this[_0xe350('0xf')]=_0x5c41e1['countagentrejectretry'];this['uniqueid']=_0x5ba68b[_0xe350('0x10')];this[_0xe350('0x11')]=_0x5c41e1[_0xe350('0x12')];this[_0xe350('0x13')]=_0x5c41e1[_0xe350('0x14')];this[_0xe350('0x15')]=_0x5c41e1['starttime'];this[_0xe350('0x16')]=_0x5c41e1['responsetime'];this['answertime']=_0x5c41e1[_0xe350('0x17')];this[_0xe350('0x18')]=moment()[_0xe350('0x19')](_0xe350('0x1a'));this[_0xe350('0x1b')]=getSeconds(_0x5c41e1[_0xe350('0x16')],_0x5c41e1['starttime']);this[_0xe350('0x1c')]=getSeconds(_0x5c41e1[_0xe350('0x17')],_0x5c41e1[_0xe350('0x16')]);this[_0xe350('0x1d')]=getSeconds(this[_0xe350('0x18')],_0x5c41e1[_0xe350('0x17')]);this[_0xe350('0x7')]=_0x5ba68b[_0xe350('0x7')];this['membername']=_0x5ba68b[_0xe350('0x1e')];this[_0xe350('0x1f')]=_0x5ba68b[_0xe350('0x1f')];this[_0xe350('0x20')]=_0x5c41e1[_0xe350('0x20')];this[_0xe350('0x21')]=_0x5c41e1[_0xe350('0x21')];this[_0xe350('0x22')]=_0x5c41e1['callbackat'];this[_0xe350('0x23')]=_0x5c41e1[_0xe350('0x23')];this[_0xe350('0x24')]=_0x5c41e1[_0xe350('0x24')];this[_0xe350('0x25')]=_0x5c41e1['ListId'];this[_0xe350('0x26')]=_0x5c41e1[_0xe350('0x26')];this[_0xe350('0x27')]=_0x5c41e1[_0xe350('0x27')];this[_0xe350('0x28')]=_0x5c41e1['CampaignId'];this[_0xe350('0x29')]=_0x5c41e1[_0xe350('0x29')]||'';this[_0xe350('0x2a')]=_0x5c41e1['originatecalleridname']||'';}module[_0xe350('0x2b')]=AgentComplete; \ No newline at end of file +var _0xc273=['originatecalleridname','exports','util','lodash','moment','milliseconds','diff','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','membername','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc273,0x197));var _0x3c27=function(_0x466af7,_0x2f7551){_0x466af7=_0x466af7-0x0;var _0x348c96=_0xc273[_0x466af7];return _0x348c96;};'use strict';var util=require(_0x3c27('0x0'));var _=require(_0x3c27('0x1'));var moment=require(_0x3c27('0x2'));function getSeconds(_0x134bca,_0x16f88e){var _0x1e4f15=moment(_0x134bca)['milliseconds'](0x0);var _0x1ab5f7=moment(_0x16f88e)[_0x3c27('0x3')](0x0);return _0x1e4f15[_0x3c27('0x4')](_0x1ab5f7,'seconds');}function AgentComplete(_0x34fc90,_0x58601a){this[_0x3c27('0x5')]=0x4;this[_0x3c27('0x6')]=_0x3c27('0x7');this[_0x3c27('0x8')]=_0x34fc90[_0x3c27('0x8')];this['type']=_0x34fc90[_0x3c27('0x9')];this[_0x3c27('0xa')]=_0x34fc90['type']===_0x3c27('0xb')?_0x3c27('0xc'):_0x34fc90[_0x3c27('0x9')];this[_0x3c27('0xd')]=_0x34fc90[_0x3c27('0xd')];this['countcongestionretry']=_0x34fc90['countcongestionretry'];this['countnoanswerretry']=_0x34fc90[_0x3c27('0xe')];this[_0x3c27('0xf')]=_0x34fc90[_0x3c27('0xd')]+_0x34fc90['countcongestionretry']+_0x34fc90[_0x3c27('0xe')]+_0x34fc90[_0x3c27('0x10')]+_0x34fc90['countdropretry']+_0x34fc90[_0x3c27('0x11')]+_0x34fc90[_0x3c27('0x12')]+_0x34fc90[_0x3c27('0x13')];this[_0x3c27('0x10')]=_0x34fc90[_0x3c27('0x10')];this[_0x3c27('0x14')]=_0x34fc90['countdropretry'];this[_0x3c27('0x11')]=_0x34fc90[_0x3c27('0x11')];this[_0x3c27('0x12')]=_0x34fc90[_0x3c27('0x12')];this[_0x3c27('0x13')]=_0x34fc90['countagentrejectretry'];this['uniqueid']=_0x58601a[_0x3c27('0x15')];this[_0x3c27('0x16')]=_0x34fc90['name'];this[_0x3c27('0x17')]=_0x34fc90[_0x3c27('0x18')];this[_0x3c27('0x19')]=_0x34fc90['starttime'];this[_0x3c27('0x1a')]=_0x34fc90[_0x3c27('0x1a')];this['answertime']=_0x34fc90[_0x3c27('0x1b')];this[_0x3c27('0x1c')]=moment()['format'](_0x3c27('0x1d'));this['ringtime']=getSeconds(_0x34fc90['responsetime'],_0x34fc90[_0x3c27('0x19')]);this[_0x3c27('0x1e')]=getSeconds(_0x34fc90[_0x3c27('0x1b')],_0x34fc90[_0x3c27('0x1a')]);this[_0x3c27('0x1f')]=getSeconds(this['endtime'],_0x34fc90[_0x3c27('0x1b')]);this[_0x3c27('0xc')]=_0x58601a[_0x3c27('0xc')];this[_0x3c27('0x20')]=_0x58601a[_0x3c27('0x20')];this[_0x3c27('0x21')]=_0x58601a['reason'];this[_0x3c27('0x22')]=_0x34fc90['callback'];this['callbackuniqueid']=_0x34fc90[_0x3c27('0x23')];this['callbackat']=_0x34fc90['callbackat'];this[_0x3c27('0x24')]=_0x34fc90[_0x3c27('0x24')];this[_0x3c27('0x25')]=_0x34fc90[_0x3c27('0x25')];this[_0x3c27('0x26')]=_0x34fc90['ListId'];this[_0x3c27('0x27')]=_0x34fc90['UserId'];this['VoiceQueueId']=_0x34fc90[_0x3c27('0x28')];this['CampaignId']=_0x34fc90[_0x3c27('0x29')];this[_0x3c27('0x2a')]=_0x34fc90[_0x3c27('0x2a')]||'';this[_0x3c27('0x2b')]=_0x34fc90['originatecalleridname']||'';}module[_0x3c27('0x2c')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 385641d..40de0fd 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 _0x3e74=['holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','starttime','responsetime','endtime','ringtime'];(function(_0x31441f,_0x8a9420){var _0x2ece43=function(_0x2bd821){while(--_0x2bd821){_0x31441f['push'](_0x31441f['shift']());}};_0x2ece43(++_0x8a9420);}(_0x3e74,0x175));var _0x43e7=function(_0x2bbd5e,_0x3f43ac){_0x2bbd5e=_0x2bbd5e-0x0;var _0x4bd78=_0x3e74[_0x2bbd5e];return _0x4bd78;};'use strict';var util=require(_0x43e7('0x0'));var _=require('lodash');var moment=require(_0x43e7('0x1'));function getSeconds(_0x287a1d,_0x151ad2){var _0x494e45=moment(_0x287a1d)['milliseconds'](0x0);var _0xc58479=moment(_0x151ad2)['milliseconds'](0x0);return _0x494e45[_0x43e7('0x2')](_0xc58479,_0x43e7('0x3'));}function Final(_0xe78cb7){this[_0x43e7('0x4')]=_0xe78cb7[_0x43e7('0x4')];this['scheduledat']=_0xe78cb7[_0x43e7('0x5')];this[_0x43e7('0x6')]=_0xe78cb7[_0x43e7('0x6')];this[_0x43e7('0x7')]=_0xe78cb7[_0x43e7('0x6')]==='outbound'?_0x43e7('0x8'):_0xe78cb7['type'];this['countbusyretry']=_0xe78cb7[_0x43e7('0x9')];this[_0x43e7('0xa')]=_0xe78cb7['countcongestionretry'];this[_0x43e7('0xb')]=_0xe78cb7['countnoanswerretry'];this[_0x43e7('0xc')]=_0xe78cb7[_0x43e7('0x9')]+_0xe78cb7['countcongestionretry']+_0xe78cb7[_0x43e7('0xb')]+_0xe78cb7[_0x43e7('0xd')]+_0xe78cb7[_0x43e7('0xe')]+_0xe78cb7[_0x43e7('0xf')]+_0xe78cb7['countmachineretry']+_0xe78cb7['countagentrejectretry'];this[_0x43e7('0xd')]=_0xe78cb7[_0x43e7('0xd')];this[_0x43e7('0xe')]=_0xe78cb7['countdropretry'];this['countabandonedretry']=_0xe78cb7[_0x43e7('0xf')];this[_0x43e7('0x10')]=_0xe78cb7[_0x43e7('0x10')];this[_0x43e7('0x11')]=_0xe78cb7['countagentrejectretry'];this['queue']=_0xe78cb7[_0x43e7('0x8')];this[_0x43e7('0x12')]=_0xe78cb7[_0x43e7('0x12')];this['calleridnum']=_0xe78cb7['calleridnum'];this[_0x43e7('0x13')]=_0xe78cb7[_0x43e7('0x13')];this[_0x43e7('0x14')]=_0xe78cb7[_0x43e7('0x14')];this[_0x43e7('0x15')]=_0xe78cb7[_0x43e7('0x14')];this[_0x43e7('0x16')]=_0xe78cb7[_0x43e7('0x16')]||0x0;this[_0x43e7('0x17')]=_0xe78cb7[_0x43e7('0x17')]||0x0;this[_0x43e7('0x18')]=_0xe78cb7[_0x43e7('0x18')]||0x0;this['callback']=_0xe78cb7[_0x43e7('0x19')];this[_0x43e7('0x1a')]=_0xe78cb7['callbackuniqueid'];this[_0x43e7('0x1b')]=_0xe78cb7[_0x43e7('0x1b')];this[_0x43e7('0x1c')]=_0xe78cb7[_0x43e7('0x1c')];this[_0x43e7('0x1d')]=_0xe78cb7[_0x43e7('0x1d')];this['ListId']=_0xe78cb7[_0x43e7('0x1e')];this['UserId']=_0xe78cb7['UserId'];this[_0x43e7('0x1f')]=_0xe78cb7[_0x43e7('0x1f')];this['CampaignId']=_0xe78cb7[_0x43e7('0x20')];this['originatecalleridnum']=_0xe78cb7[_0x43e7('0x21')]||'';this['originatecalleridname']=_0xe78cb7[_0x43e7('0x22')]||'';}module[_0x43e7('0x23')]=Final; \ No newline at end of file +var _0x8819=['holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','diff','seconds','uniqueid','scheduledat','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countdropretry','countmachineretry','countagentrejectretry','calleridnum','starttime','endtime','responsetime','ringtime'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x8819,0x94));var _0x9881=function(_0x166cf7,_0x3496d5){_0x166cf7=_0x166cf7-0x0;var _0x995d02=_0x8819[_0x166cf7];return _0x995d02;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x9881('0x0'));function getSeconds(_0x27a509,_0x317d26){var _0x14cd6c=moment(_0x27a509)[_0x9881('0x1')](0x0);var _0x5e52c5=moment(_0x317d26)[_0x9881('0x1')](0x0);return _0x14cd6c[_0x9881('0x2')](_0x5e52c5,_0x9881('0x3'));}function Final(_0xc9a2e9){this[_0x9881('0x4')]=_0xc9a2e9[_0x9881('0x4')];this['scheduledat']=_0xc9a2e9[_0x9881('0x5')];this['type']=_0xc9a2e9['type'];this[_0x9881('0x6')]=_0xc9a2e9['type']==='outbound'?_0x9881('0x7'):_0xc9a2e9['type'];this[_0x9881('0x8')]=_0xc9a2e9[_0x9881('0x8')];this[_0x9881('0x9')]=_0xc9a2e9['countcongestionretry'];this[_0x9881('0xa')]=_0xc9a2e9[_0x9881('0xa')];this[_0x9881('0xb')]=_0xc9a2e9[_0x9881('0x8')]+_0xc9a2e9['countcongestionretry']+_0xc9a2e9[_0x9881('0xa')]+_0xc9a2e9[_0x9881('0xc')]+_0xc9a2e9['countdropretry']+_0xc9a2e9[_0x9881('0xd')]+_0xc9a2e9['countmachineretry']+_0xc9a2e9['countagentrejectretry'];this['countnosuchnumberretry']=_0xc9a2e9['countnosuchnumberretry'];this[_0x9881('0xe')]=_0xc9a2e9[_0x9881('0xe')];this[_0x9881('0xd')]=_0xc9a2e9[_0x9881('0xd')];this[_0x9881('0xf')]=_0xc9a2e9[_0x9881('0xf')];this['countagentrejectretry']=_0xc9a2e9[_0x9881('0x10')];this[_0x9881('0x7')]=_0xc9a2e9[_0x9881('0x7')];this['calleridname']=_0xc9a2e9['calleridname'];this['calleridnum']=_0xc9a2e9[_0x9881('0x11')];this['starttime']=_0xc9a2e9[_0x9881('0x12')];this['responsetime']=_0xc9a2e9['responsetime'];this[_0x9881('0x13')]=_0xc9a2e9[_0x9881('0x14')];this[_0x9881('0x15')]=_0xc9a2e9[_0x9881('0x15')]||0x0;this[_0x9881('0x16')]=_0xc9a2e9[_0x9881('0x16')]||0x0;this[_0x9881('0x17')]=_0xc9a2e9[_0x9881('0x17')]||0x0;this[_0x9881('0x18')]=_0xc9a2e9[_0x9881('0x18')];this[_0x9881('0x19')]=_0xc9a2e9[_0x9881('0x19')];this[_0x9881('0x1a')]=_0xc9a2e9[_0x9881('0x1a')];this[_0x9881('0x1b')]=_0xc9a2e9['recallme'];this['ContactId']=_0xc9a2e9[_0x9881('0x1c')];this['ListId']=_0xc9a2e9['ListId'];this[_0x9881('0x1d')]=_0xc9a2e9[_0x9881('0x1d')];this['VoiceQueueId']=_0xc9a2e9['VoiceQueueId'];this[_0x9881('0x1e')]=_0xc9a2e9['CampaignId'];this[_0x9881('0x1f')]=_0xc9a2e9[_0x9881('0x1f')]||'';this[_0x9881('0x20')]=_0xc9a2e9[_0x9881('0x20')]||'';}module[_0x9881('0x21')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 48f1787..b3bdf05 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 _0xe196=['responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','reason','cause-txt','callback','callbackuniqueid','callbackat','ContactId','ListId','VoiceQueueId','CampaignId','util','lodash','moment','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','starttime'];(function(_0x1f1a97,_0xadfc15){var _0x29fc6a=function(_0x38c180){while(--_0x38c180){_0x1f1a97['push'](_0x1f1a97['shift']());}};_0x29fc6a(++_0xadfc15);}(_0xe196,0xfe));var _0x6e19=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe196[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x6e19('0x0'));var _=require(_0x6e19('0x1'));var moment=require(_0x6e19('0x2'));function getSeconds(_0x28eb8e,_0x1e15f6){var _0xca1fd9=moment(_0x28eb8e)['milliseconds'](0x0);var _0x354ac9=moment(_0x1e15f6)['milliseconds'](0x0);return _0xca1fd9['diff'](_0x354ac9,_0x6e19('0x3'));}function Hangup(_0x253f47,_0x36118f){this[_0x6e19('0x4')]=0x4;this[_0x6e19('0x5')]=_0x6e19('0x6');this[_0x6e19('0x7')]=_0x253f47['scheduledat'];this[_0x6e19('0x8')]=_0x253f47[_0x6e19('0x8')];this[_0x6e19('0x9')]=_0x253f47[_0x6e19('0x8')]===_0x6e19('0xa')?_0x6e19('0xb'):_0x253f47[_0x6e19('0x8')];this[_0x6e19('0xc')]=_0x253f47['countbusyretry'];this[_0x6e19('0xd')]=_0x253f47['countcongestionretry'];this['countnoanswerretry']=_0x253f47[_0x6e19('0xe')];this[_0x6e19('0xf')]=_0x253f47[_0x6e19('0xc')]+_0x253f47[_0x6e19('0xd')]+_0x253f47[_0x6e19('0xe')]+_0x253f47[_0x6e19('0x10')]+_0x253f47[_0x6e19('0x11')]+_0x253f47[_0x6e19('0x12')]+_0x253f47['countmachineretry']+_0x253f47[_0x6e19('0x13')];this[_0x6e19('0x10')]=_0x253f47['countnosuchnumberretry'];this[_0x6e19('0x11')]=_0x253f47['countdropretry'];this[_0x6e19('0x12')]=_0x253f47[_0x6e19('0x12')];this['countmachineretry']=_0x253f47[_0x6e19('0x14')];this[_0x6e19('0x13')]=_0x253f47['countagentrejectretry'];this[_0x6e19('0x15')]=_0x36118f['uniqueid'];this[_0x6e19('0x16')]=_0x253f47[_0x6e19('0x17')];this[_0x6e19('0x18')]=_0x253f47['number'];this['starttime']=_0x253f47[_0x6e19('0x19')];this[_0x6e19('0x1a')]=_0x253f47[_0x6e19('0x1a')];this['endtime']=moment()[_0x6e19('0x1b')](_0x6e19('0x1c'));this[_0x6e19('0x1d')]=getSeconds(_0x253f47['responsetime'],_0x253f47[_0x6e19('0x19')]);this[_0x6e19('0x1e')]=0x0;this['talktime']=getSeconds(this['endtime'],_0x253f47[_0x6e19('0x1a')]);this['queue']=_0x253f47[_0x6e19('0xb')];this['membername']='IVR';this[_0x6e19('0x1f')]=_0x36118f[_0x6e19('0x20')];this[_0x6e19('0x21')]=_0x253f47[_0x6e19('0x21')];this[_0x6e19('0x22')]=_0x253f47['callbackuniqueid'];this[_0x6e19('0x23')]=_0x253f47[_0x6e19('0x23')];this['recallme']=_0x253f47['recallme'];this['ContactId']=_0x253f47[_0x6e19('0x24')];this[_0x6e19('0x25')]=_0x253f47[_0x6e19('0x25')];this['UserId']=_0x253f47['UserId'];this[_0x6e19('0x26')]=_0x253f47[_0x6e19('0x26')];this[_0x6e19('0x27')]=_0x253f47[_0x6e19('0x27')];}module['exports']=Hangup; \ No newline at end of file +var _0x0d41=['format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime'];(function(_0xd0a38,_0x2ee8b0){var _0x15bc90=function(_0x5dc3aa){while(--_0x5dc3aa){_0xd0a38['push'](_0xd0a38['shift']());}};_0x15bc90(++_0x2ee8b0);}(_0x0d41,0x1af));var _0x10d4=function(_0x340272,_0x44810f){_0x340272=_0x340272-0x0;var _0x351619=_0x0d41[_0x340272];return _0x351619;};'use strict';var util=require(_0x10d4('0x0'));var _=require(_0x10d4('0x1'));var moment=require(_0x10d4('0x2'));function getSeconds(_0x4e5b9d,_0x53ce59){var _0x5d906a=moment(_0x4e5b9d)[_0x10d4('0x3')](0x0);var _0x52b625=moment(_0x53ce59)[_0x10d4('0x3')](0x0);return _0x5d906a[_0x10d4('0x4')](_0x52b625,_0x10d4('0x5'));}function Hangup(_0x3f6b06,_0x90e8d4){this[_0x10d4('0x6')]=0x4;this[_0x10d4('0x7')]='Answer';this[_0x10d4('0x8')]=_0x3f6b06[_0x10d4('0x8')];this[_0x10d4('0x9')]=_0x3f6b06[_0x10d4('0x9')];this['campaigntype']=_0x3f6b06[_0x10d4('0x9')]===_0x10d4('0xa')?_0x10d4('0xb'):_0x3f6b06[_0x10d4('0x9')];this[_0x10d4('0xc')]=_0x3f6b06[_0x10d4('0xc')];this[_0x10d4('0xd')]=_0x3f6b06[_0x10d4('0xd')];this[_0x10d4('0xe')]=_0x3f6b06[_0x10d4('0xe')];this[_0x10d4('0xf')]=_0x3f6b06[_0x10d4('0xc')]+_0x3f6b06[_0x10d4('0xd')]+_0x3f6b06[_0x10d4('0xe')]+_0x3f6b06[_0x10d4('0x10')]+_0x3f6b06[_0x10d4('0x11')]+_0x3f6b06[_0x10d4('0x12')]+_0x3f6b06[_0x10d4('0x13')]+_0x3f6b06[_0x10d4('0x14')];this[_0x10d4('0x10')]=_0x3f6b06[_0x10d4('0x10')];this[_0x10d4('0x11')]=_0x3f6b06[_0x10d4('0x11')];this[_0x10d4('0x12')]=_0x3f6b06[_0x10d4('0x12')];this['countmachineretry']=_0x3f6b06[_0x10d4('0x13')];this['countagentrejectretry']=_0x3f6b06[_0x10d4('0x14')];this[_0x10d4('0x15')]=_0x90e8d4[_0x10d4('0x15')];this[_0x10d4('0x16')]=_0x3f6b06[_0x10d4('0x17')];this[_0x10d4('0x18')]=_0x3f6b06[_0x10d4('0x19')];this[_0x10d4('0x1a')]=_0x3f6b06[_0x10d4('0x1a')];this[_0x10d4('0x1b')]=_0x3f6b06[_0x10d4('0x1b')];this[_0x10d4('0x1c')]=moment()[_0x10d4('0x1d')](_0x10d4('0x1e'));this[_0x10d4('0x1f')]=getSeconds(_0x3f6b06[_0x10d4('0x1b')],_0x3f6b06[_0x10d4('0x1a')]);this[_0x10d4('0x20')]=0x0;this[_0x10d4('0x21')]=getSeconds(this[_0x10d4('0x1c')],_0x3f6b06[_0x10d4('0x1b')]);this[_0x10d4('0xb')]=_0x3f6b06[_0x10d4('0xb')];this['membername']=_0x10d4('0x22');this[_0x10d4('0x23')]=_0x90e8d4[_0x10d4('0x24')];this[_0x10d4('0x25')]=_0x3f6b06[_0x10d4('0x25')];this[_0x10d4('0x26')]=_0x3f6b06[_0x10d4('0x26')];this[_0x10d4('0x27')]=_0x3f6b06['callbackat'];this[_0x10d4('0x28')]=_0x3f6b06[_0x10d4('0x28')];this['ContactId']=_0x3f6b06[_0x10d4('0x29')];this['ListId']=_0x3f6b06['ListId'];this[_0x10d4('0x2a')]=_0x3f6b06['UserId'];this[_0x10d4('0x2b')]=_0x3f6b06[_0x10d4('0x2b')];this[_0x10d4('0x2c')]=_0x3f6b06[_0x10d4('0x2c')];}module[_0x10d4('0x2d')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 2a8ceb5..b40a871 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 _0xcb33=['callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','queue','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback'];(function(_0x125fcd,_0x14a854){var _0x1223c8=function(_0x359e4c){while(--_0x359e4c){_0x125fcd['push'](_0x125fcd['shift']());}};_0x1223c8(++_0x14a854);}(_0xcb33,0xd2));var _0x3cb3=function(_0x38d2f2,_0x4bb2f4){_0x38d2f2=_0x38d2f2-0x0;var _0x898ef8=_0xcb33[_0x38d2f2];return _0x898ef8;};'use strict';var util=require(_0x3cb3('0x0'));var _=require(_0x3cb3('0x1'));var moment=require(_0x3cb3('0x2'));function getSeconds(_0x4ca904,_0x55d740){var _0x48c73d=moment(_0x4ca904)[_0x3cb3('0x3')](0x0);var _0xbf1ff6=moment(_0x55d740)[_0x3cb3('0x3')](0x0);return _0x48c73d[_0x3cb3('0x4')](_0xbf1ff6,'seconds');}function History(_0xa75318){this[_0x3cb3('0x5')]=_0xa75318['uniqueid'];this[_0x3cb3('0x6')]=_0xa75318[_0x3cb3('0x6')]||undefined;this[_0x3cb3('0x7')]=_0xa75318[_0x3cb3('0x7')];this[_0x3cb3('0x8')]=_0xa75318[_0x3cb3('0x7')]===_0x3cb3('0x9')?'queue':_0xa75318[_0x3cb3('0x7')];this[_0x3cb3('0xa')]=_0xa75318[_0x3cb3('0xa')];this[_0x3cb3('0xb')]=_0xa75318[_0x3cb3('0xb')];this[_0x3cb3('0xc')]=_0xa75318[_0x3cb3('0xc')];this['countglobal']=_0xa75318[_0x3cb3('0xa')]+_0xa75318['countcongestionretry']+_0xa75318['countnoanswerretry']+_0xa75318['countnosuchnumberretry']+_0xa75318[_0x3cb3('0xd')]+_0xa75318[_0x3cb3('0xe')]+_0xa75318[_0x3cb3('0xf')]+_0xa75318['countagentrejectretry'];this[_0x3cb3('0x10')]=_0xa75318['countnosuchnumberretry'];this[_0x3cb3('0xd')]=_0xa75318[_0x3cb3('0xd')];this['countabandonedretry']=_0xa75318[_0x3cb3('0xe')];this[_0x3cb3('0xf')]=_0xa75318['countmachineretry'];this['countagentrejectretry']=_0xa75318[_0x3cb3('0x11')];this[_0x3cb3('0x12')]=_0xa75318[_0x3cb3('0x12')];this[_0x3cb3('0x13')]=_0xa75318[_0x3cb3('0x14')];this[_0x3cb3('0x15')]=_0xa75318[_0x3cb3('0x16')];this[_0x3cb3('0x17')]=_0xa75318[_0x3cb3('0x17')];this[_0x3cb3('0x18')]=_0xa75318[_0x3cb3('0x18')];this[_0x3cb3('0x19')]=_0xa75318['responsetime'];this[_0x3cb3('0x1a')]=getSeconds(_0xa75318[_0x3cb3('0x18')],_0xa75318[_0x3cb3('0x17')]);this[_0x3cb3('0x1b')]=0x0;this[_0x3cb3('0x1c')]=0x0;this[_0x3cb3('0x1d')]=_0xa75318['callback'];this[_0x3cb3('0x1e')]=_0xa75318[_0x3cb3('0x1e')];this[_0x3cb3('0x1f')]=_0xa75318[_0x3cb3('0x1f')];this['recallme']=_0xa75318['recallme'];this[_0x3cb3('0x20')]=_0xa75318[_0x3cb3('0x20')];this[_0x3cb3('0x21')]=_0xa75318['ListId'];this[_0x3cb3('0x22')]=_0xa75318[_0x3cb3('0x22')];this[_0x3cb3('0x23')]=_0xa75318[_0x3cb3('0x23')];this[_0x3cb3('0x24')]=_0xa75318['CampaignId'];this['originatecalleridnum']=_0xa75318[_0x3cb3('0x25')]||'';this[_0x3cb3('0x26')]=_0xa75318[_0x3cb3('0x26')]||'';}module[_0x3cb3('0x27')]=History; \ No newline at end of file +var _0x99b6=['util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports'];(function(_0x56f927,_0xdfcfa4){var _0x363231=function(_0x221598){while(--_0x221598){_0x56f927['push'](_0x56f927['shift']());}};_0x363231(++_0xdfcfa4);}(_0x99b6,0x140));var _0x699b=function(_0x445662,_0x1b1af1){_0x445662=_0x445662-0x0;var _0x5a0914=_0x99b6[_0x445662];return _0x5a0914;};'use strict';var util=require(_0x699b('0x0'));var _=require(_0x699b('0x1'));var moment=require(_0x699b('0x2'));function getSeconds(_0x4c62dd,_0x12a83f){var _0x1e8987=moment(_0x4c62dd)['milliseconds'](0x0);var _0x3ff354=moment(_0x12a83f)[_0x699b('0x3')](0x0);return _0x1e8987[_0x699b('0x4')](_0x3ff354,_0x699b('0x5'));}function History(_0x88c7e8){this[_0x699b('0x6')]=_0x88c7e8[_0x699b('0x6')];this[_0x699b('0x7')]=_0x88c7e8[_0x699b('0x7')]||undefined;this['type']=_0x88c7e8[_0x699b('0x8')];this[_0x699b('0x9')]=_0x88c7e8['type']===_0x699b('0xa')?_0x699b('0xb'):_0x88c7e8[_0x699b('0x8')];this[_0x699b('0xc')]=_0x88c7e8[_0x699b('0xc')];this[_0x699b('0xd')]=_0x88c7e8['countcongestionretry'];this[_0x699b('0xe')]=_0x88c7e8['countnoanswerretry'];this['countglobal']=_0x88c7e8[_0x699b('0xc')]+_0x88c7e8[_0x699b('0xd')]+_0x88c7e8[_0x699b('0xe')]+_0x88c7e8[_0x699b('0xf')]+_0x88c7e8[_0x699b('0x10')]+_0x88c7e8['countabandonedretry']+_0x88c7e8[_0x699b('0x11')]+_0x88c7e8[_0x699b('0x12')];this[_0x699b('0xf')]=_0x88c7e8[_0x699b('0xf')];this[_0x699b('0x10')]=_0x88c7e8['countdropretry'];this[_0x699b('0x13')]=_0x88c7e8[_0x699b('0x13')];this[_0x699b('0x11')]=_0x88c7e8[_0x699b('0x11')];this[_0x699b('0x12')]=_0x88c7e8[_0x699b('0x12')];this[_0x699b('0xb')]=_0x88c7e8[_0x699b('0xb')];this['calleridname']=_0x88c7e8[_0x699b('0x14')];this[_0x699b('0x15')]=_0x88c7e8[_0x699b('0x16')];this[_0x699b('0x17')]=_0x88c7e8[_0x699b('0x17')];this[_0x699b('0x18')]=_0x88c7e8[_0x699b('0x18')];this[_0x699b('0x19')]=_0x88c7e8[_0x699b('0x18')];this[_0x699b('0x1a')]=getSeconds(_0x88c7e8[_0x699b('0x18')],_0x88c7e8[_0x699b('0x17')]);this[_0x699b('0x1b')]=0x0;this[_0x699b('0x1c')]=0x0;this[_0x699b('0x1d')]=_0x88c7e8[_0x699b('0x1d')];this[_0x699b('0x1e')]=_0x88c7e8['callbackuniqueid'];this[_0x699b('0x1f')]=_0x88c7e8[_0x699b('0x1f')];this['recallme']=_0x88c7e8[_0x699b('0x20')];this[_0x699b('0x21')]=_0x88c7e8['ContactId'];this['ListId']=_0x88c7e8[_0x699b('0x22')];this['UserId']=_0x88c7e8['UserId'];this[_0x699b('0x23')]=_0x88c7e8['VoiceQueueId'];this[_0x699b('0x24')]=_0x88c7e8['CampaignId'];this[_0x699b('0x25')]=_0x88c7e8[_0x699b('0x25')]||'';this[_0x699b('0x26')]=_0x88c7e8[_0x699b('0x26')]||'';}module[_0x699b('0x27')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 3ffa6ab..41ad0c3 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 _0xf29e=['stateinterface','idHopper','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','roundrobin','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','push','Action','command','interval','content','indexOf','iftime\x20%s,%s','timezones','true','all','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','handlePower','predictive','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','user:%s','launchHandleIvr','dialTimezone','checkDialMethod','[syncQueueSummary]','dialGlobalInterval','[syncCampaigns]','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','NONE','\x22agi://%s/square,%s\x22','dialQueueOptions','dialer','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-CAMPAIGNID','Contact','tags','updatedAt','%s%s','XMD-','toUpper','isTrunkReachable','dialRandomLastDigitCallerIdNumber','TrunkBackup','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','getQueue','response','callProgressDetecting','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','dialCongestionRetryFrequency','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','busyFactor','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','[getDataPredictive]','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','getContactDialerIvr','dialOrderByScheduledAt','[actionOriginate]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','reachable','[countReScheduled]\x20','RUNNING','Contact.phone','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','[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','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','----\x20Agent\x20Busy\x20Factor\x20----','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','bluebird','moment','md5','../../../config/environment/','../../../config/logger','booked','predictiveCalls','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/setting','./action','./final','./agentComplete','./hangup','env','XCALLY_IP_AGI','rrmemory','prototype','enqueue','tail','preview','voiceQueues','campaigns','agents','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startPredictive','startProgressive','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuestatuscomplete','loopCampaigns','getSettings','then','previewRecallmeReminderInterval','isUndefined','message','AGENTS_NOT_LOGGED','name','NOT_ACTIVE','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','Interval','Error','stringify','milliseconds','diff','seconds','emit','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','campaign:save','info','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','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','error','inspect','stack','originated','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','loopClearZombieChannels','clearZombieChannels','[uniqueid]','sequence','isNil','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact]','Success','SIP/%s','trunks','unmonitored','amdstatus','xcally-motion-dialer','value','HANGUP','uniqueid','outboundAnswerCallsDay','HangupInAMD','membername','custom:amd','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','Machine','countmachineretry','countglobal','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','createStateFinal','add','dialMachineRetryFrequency','minutes','[rescheduleContact][Machine]','AMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','YYYY-MM-DD\x20HH:mm:ss','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','Unknow','[syncHangupIvr][createHistory]','reason','agent','agiafterat','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','Drop','dropreason','TIMEOUT','dialQueueProject2','dialDropRetryFrequency','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','actionid','locked','paused'];(function(_0x671369,_0x433da5){var _0x33f2b4=function(_0x2e9db2){while(--_0x2e9db2){_0x671369['push'](_0x671369['shift']());}};_0x33f2b4(++_0x433da5);}(_0xf29e,0xf6));var _0xef29=function(_0x484174,_0x1b6ff5){_0x484174=_0x484174-0x0;var _0x3f2d83=_0xf29e[_0x484174];return _0x3f2d83;};'use strict';var util=require(_0xef29('0x0'));var _=require(_0xef29('0x1'));var BPromise=require(_0xef29('0x2'));var uuid=require('uuid');var moment=require(_0xef29('0x3'));var rr=require('rr');var md5=require(_0xef29('0x4'));var Redis=require('ioredis');var ut=require('../preview/util/util');var config=require(_0xef29('0x5'));var logger=require(_0xef29('0x6'))('dialer');var loggerBooked=require(_0xef29('0x6'))(_0xef29('0x7'));var loggerPredictive=require(_0xef29('0x6'))('predictive');var loggerPredictiveCalls=require(_0xef29('0x6'))(_0xef29('0x8'));var loggerSyncQueueSummary=require('../../../config/logger')(_0xef29('0x9'));var ami=require(_0xef29('0xa'));config[_0xef29('0xb')]=_['defaults'](config[_0xef29('0xb')],{'host':_0xef29('0xc'),'port':0x18eb});var io=require(_0xef29('0xd'))(new Redis(config[_0xef29('0xb')]));var cmHopper=require(_0xef29('0xe'));var cmHopperHistory=require(_0xef29('0xf'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xef29('0x10'));var RpcSetting=require(_0xef29('0x11'));var Action=require(_0xef29('0x12'));var History=require('./history');var Final=require(_0xef29('0x13'));var AgentComplete=require(_0xef29('0x14'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0xef29('0x15'));var ipAgi=process[_0xef29('0x16')][_0xef29('0x17')]||'127.0.0.1';var strategy={'rrmemory':_0xef29('0x18'),'roundrobin':'roundrobin'};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xef29('0x19')][_0xef29('0x1a')]=function(_0x15ff6c){this[_0xef29('0x1b')]=this['tail']?this['tail']['finally'](_0x15ff6c):_0x15ff6c();};function Dialer(_0x1eec65,_0x2cadfb){this['sequence']=new Sequence();this[_0xef29('0x1c')]=_0x2cadfb;this[_0xef29('0x1d')]=_0x1eec65[_0xef29('0x1d')];this[_0xef29('0x1e')]=_0x1eec65[_0xef29('0x1e')];this[_0xef29('0x1f')]=_0x1eec65['agents'];this['trunks']=_0x1eec65['trunks'];this[_0xef29('0x20')]=config['maxNumberOriginate']||0x2;this[_0xef29('0x21')]={};this[_0xef29('0x22')]={};this['contactsId']={};this[_0xef29('0x23')]={};this[_0xef29('0x24')]={};this[_0xef29('0x25')]={};this[_0xef29('0x26')]={};this['ivrOriginated']={};this[_0xef29('0x27')]={};this[_0xef29('0x28')]={};ami['on'](_0xef29('0x29'),this[_0xef29('0x2a')][_0xef29('0x2b')](this));ami['on'](_0xef29('0x2c'),this[_0xef29('0x2d')][_0xef29('0x2b')](this));ami['on']('originateresponse',this[_0xef29('0x2e')][_0xef29('0x2b')](this));ami['on'](_0xef29('0x2f'),this[_0xef29('0x30')][_0xef29('0x2b')](this));ami['on'](_0xef29('0x31'),this[_0xef29('0x9')]['bind'](this));ami['on']('hangup',this[_0xef29('0x32')][_0xef29('0x2b')](this));ami['on'](_0xef29('0x33'),this[_0xef29('0x34')]['bind'](this));ami['on'](_0xef29('0x35'),this[_0xef29('0x36')]['bind'](this));ami['on']('queuemember',this['syncQueueMember']['bind'](this));ami['on'](_0xef29('0x37'),this['syncQueueStatusComplete'][_0xef29('0x2b')](this));this[_0xef29('0x38')]();this['loopClearZombieChannels']();RpcSetting[_0xef29('0x39')]()[_0xef29('0x3a')](function(_0x1673d1){previewRecallmeReminderInterval=_0x1673d1[_0xef29('0x3b')];});}function isNotNull(_0x74d2d8){return _0x74d2d8!==null&&!_[_0xef29('0x3c')](_0x74d2d8);}function checkIsLoggedIn(_0xb9f27c,_0x548eb4){return function(){if(_0x548eb4<=0x0){_0xb9f27c[_0xef29('0x3d')]=_0xef29('0x3e');throw _0xb9f27c[_0xef29('0x3f')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x483d9f){return _0x483d9f;}function checkIsActive(_0x3db8d1,_0x18dd8d){return function(){if(!isActive(_0x18dd8d)){_0x3db8d1[_0xef29('0x3d')]=_0xef29('0x40');throw _0x3db8d1[_0xef29('0x3f')]+_0xef29('0x41');}};}function checkInterval(_0x207581){return function(){if(!isNotNull(_0x207581['Interval'])){_0x207581['message']=_0xef29('0x42');throw _0x207581[_0xef29('0x3f')]+_0xef29('0x43');}if(!isNotNull(_0x207581['Interval'][_0xef29('0x44')])){_0x207581[_0xef29('0x3d')]=_0xef29('0x42');throw _0x207581[_0xef29('0x3f')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0xef29('0x45')](_0x207581[_0xef29('0x46')][_0xef29('0x44')]))){_0x207581['message']=_0xef29('0x42');throw _0x207581[_0xef29('0x3f')]+_0xef29('0x43');}};}function msgResponse(_0x1689b1,_0x523468,_0x599978){return{'action':_0x1689b1,'response':_0x523468,'message':_0x599978,'stack':_0x599978};}function myreject(_0x1b9106){return function(_0xcf7193){return _0x1b9106(msgResponse('[ifTime][Action]',_0xef29('0x47'),JSON[_0xef29('0x48')](_0xcf7193)));};}function getSeconds(_0x2d1826,_0x4704d3){var _0x34b0a5=moment(_0x2d1826)[_0xef29('0x49')](0x0);var _0x753017=moment(_0x4704d3)[_0xef29('0x49')](0x0);return _0x34b0a5[_0xef29('0x4a')](_0x753017,_0xef29('0x4b'));}function emit(_0x2a0522,_0x44bb17,_0x3e0f7c){io['to'](_0x2a0522)[_0xef29('0x4c')](_0x44bb17,_0x3e0f7c);}function emitVoiceQueueSummary(_0x53bea8){if(_0x53bea8['type']===_0xef29('0x4d')){var _0x255176={'id':_0x53bea8['id'],'name':_0x53bea8[_0xef29('0x3f')],'strategy':_0x53bea8[_0xef29('0x4e')],'answered':_0x53bea8[_0xef29('0x4f')],'available':_0x53bea8[_0xef29('0x50')],'loggedIn':_0x53bea8[_0xef29('0x51')],'pTalking':_0x53bea8[_0xef29('0x52')],'sumBillable':_0x53bea8[_0xef29('0x53')],'sumDuration':_0x53bea8[_0xef29('0x54')],'sumHoldTime':_0x53bea8[_0xef29('0x55')]||0x0,'talking':_0x53bea8[_0xef29('0x56')],'total':_0x53bea8[_0xef29('0x57')],'type':_0x53bea8[_0xef29('0x58')],'unmanaged':_0x53bea8[_0xef29('0x59')],'abandoned':_0x53bea8[_0xef29('0x5a')],'waiting':_0x53bea8[_0xef29('0x5b')],'loggedInDb':_0x53bea8[_0xef29('0x5c')],'dialActive':_0x53bea8[_0xef29('0x5d')],'dialMethod':_0x53bea8[_0xef29('0x5e')],'dialOriginateCallerIdName':_0x53bea8[_0xef29('0x5f')],'dialOriginateCallerIdNumber':_0x53bea8[_0xef29('0x60')],'dialOriginateTimeout':_0x53bea8['dialOriginateTimeout'],'dialPrefix':_0x53bea8[_0xef29('0x61')],'outboundAnswerAgiCallsDay':_0x53bea8[_0xef29('0x62')],'outboundAnswerCallsDay':_0x53bea8['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x53bea8['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x53bea8[_0xef29('0x63')],'outboundCongestionCallsDay':_0x53bea8[_0xef29('0x64')],'outboundDropCallsDayACS':_0x53bea8['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x53bea8[_0xef29('0x65')],'outboundDropCallsDayTimeout':_0x53bea8[_0xef29('0x66')],'outboundNoAnswerCallsDay':_0x53bea8['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x53bea8[_0xef29('0x67')],'outboundOriginateFailureCallsDay':_0x53bea8[_0xef29('0x68')],'outboundReCallsDay':_0x53bea8['outboundReCallsDay'],'outboundRejectCallsDay':_0x53bea8['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x53bea8[_0xef29('0x69')],'predictiveIntervalAnsweredCalls':_0x53bea8[_0xef29('0x6a')],'predictiveIntervalAvgHoldtime':_0x53bea8[_0xef29('0x6b')],'predictiveIntervalAvgTalktime':_0x53bea8[_0xef29('0x6c')],'predictiveIntervalDroppedCallsCallersExit':_0x53bea8[_0xef29('0x6d')],'predictiveIntervalDroppedCallsTimeout':_0x53bea8[_0xef29('0x6e')],'predictiveIntervalErlangCalls':_0x53bea8[_0xef29('0x6f')],'predictiveIntervalErlangCallsDroppedCalls':_0x53bea8[_0xef29('0x70')],'predictiveIntervalHitRate':_0x53bea8['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x53bea8['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x53bea8[_0xef29('0x71')],'predictiveIntervalAvailable':_0x53bea8[_0xef29('0x72')],'predictiveIntervalTotalCalls':_0x53bea8[_0xef29('0x73')],'message':_0x53bea8[_0xef29('0x3d')],'originated':_0x53bea8['originated'],'erlangCalls':_0x53bea8[_0xef29('0x74')],'erlangCallToSecond':_0x53bea8[_0xef29('0x75')],'erlangAbandonmentRate':_0x53bea8[_0xef29('0x76')],'erlangBusyFactor':_0x53bea8[_0xef29('0x77')],'startPredictive':_0x53bea8['startPredictive'],'startProgressive':_0x53bea8['startProgressive']};if(_0x53bea8['Trunk']){_0x255176[_0xef29('0x78')]={'id':_0x53bea8[_0xef29('0x78')]['id'],'name':_0x53bea8['Trunk'][_0xef29('0x3f')],'active':_0x53bea8[_0xef29('0x78')][_0xef29('0x79')],'callerid':_0x53bea8['Trunk'][_0xef29('0x7a')]};}if(_0x53bea8['Interval']){_0x255176[_0xef29('0x46')]={'id':_0x53bea8['Interval']['id'],'name':_0x53bea8[_0xef29('0x46')][_0xef29('0x3f')]};}var _0xcf9059=md5(JSON['stringify'](_0x255176));if(_0x53bea8[_0xef29('0x4')]!==_0xcf9059){_0x53bea8[_0xef29('0x4')]=_0xcf9059;emit(util[_0xef29('0x7b')](_0xef29('0x7c'),_0x255176[_0xef29('0x3f')]),_0xef29('0x7d'),_0x255176);}}}function emitCampaignSummary(_0x19e928){if(_0x19e928['type']===_0xef29('0x7e')){emit(util[_0xef29('0x7b')]('campaign:ivr:%s',_0x19e928[_0xef29('0x3f')]),_0xef29('0x7f'),_0x19e928);}}function checkGetDataPredictive(_0x487af2){if(isNotNull(_0x487af2)&&!_[_0xef29('0x45')](_0x487af2)){loggerPredictive[_0xef29('0x80')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0xef29('0x80')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x487af2['predictiveIntervalTotalCalls']);loggerPredictive['info'](_0xef29('0x81'),_0x487af2[_0xef29('0x6a')]);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x487af2[_0xef29('0x6e')]);loggerPredictive[_0xef29('0x80')](_0xef29('0x82'),_0x487af2[_0xef29('0x6d')]);loggerPredictive[_0xef29('0x80')](_0xef29('0x83'),_0x487af2[_0xef29('0x6b')]);loggerPredictive['info'](_0xef29('0x84'),_0x487af2[_0xef29('0x6c')]);loggerPredictive[_0xef29('0x80')]('---------------------------');if(_0x487af2['predictiveIntervalTotalCalls']>0x0){if(!_['isUndefined'](_0x487af2[_0xef29('0x6c')])&&_0x487af2['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive['info'](_0xef29('0x85'));if(!_['isUndefined'](_0x487af2[_0xef29('0x6b')])&&_0x487af2['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive['info']('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0xef29('0x80')](_0xef29('0x86'));}}else{loggerPredictive['info'](_0xef29('0x87'));}return![];}function mergeDataErlangB(_0x4526d6){return function(_0x1697bb){loggerPredictive[_0xef29('0x80')]('---------\x20ErlangB\x20---------');loggerPredictive['info'](_0xef29('0x88'),_0x1697bb[_0xef29('0x74')]);loggerPredictive[_0xef29('0x80')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1697bb[_0xef29('0x75')]);loggerPredictive[_0xef29('0x80')](_0xef29('0x89'),_0x1697bb[_0xef29('0x76')]);loggerPredictive[_0xef29('0x80')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1697bb[_0xef29('0x77')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1697bb['erlangAbandonmentRate']);loggerPredictive[_0xef29('0x80')](_0xef29('0x8a'));_[_0xef29('0x8b')](_0x4526d6,_0x1697bb);};}function getDiff(_0x79253){var _0x4b7d94=moment()[_0xef29('0x49')](0x0);var _0x590c16=moment(_0x79253)[_0xef29('0x49')](0x0);return _0x4b7d94[_0xef29('0x4a')](_0x590c16,_0xef29('0x4b'));}function ifInterval(_0x16d06e,_0x3c00b5){if(_[_0xef29('0x3c')](_0x3c00b5)){return![];}return getDiff(_0x3c00b5)<_0x16d06e*0x3c;}function freeVariablesPredictive(_0x403afd){if(isNotNull(_0x403afd)){if(!_[_0xef29('0x3c')](_0x403afd[_0xef29('0x26')])){_0x403afd[_0xef29('0x26')]=undefined;loggerPredictive[_0xef29('0x80')](_0x403afd[_0xef29('0x3f')],_0xef29('0x8c'));}if(!_['isUndefined'](_0x403afd[_0xef29('0x25')])){_0x403afd[_0xef29('0x25')]=undefined;loggerPredictive[_0xef29('0x80')](_0x403afd[_0xef29('0x3f')],_0xef29('0x8d'));}if(!_[_0xef29('0x3c')](_0x403afd[_0xef29('0x8e')])){clearInterval(_0x403afd[_0xef29('0x8e')]);_0x403afd[_0xef29('0x8e')]=undefined;loggerPredictive[_0xef29('0x80')](_0x403afd[_0xef29('0x3f')],_0xef29('0x8f'));}}}function erlangb(_0x4e696d,_0x56d211){if(_0x56d211===0x0){return 0x0;}var _0x506f46=0x1;for(var _0x526e5a=0x1;_0x526e5a<=_0x56d211;_0x526e5a+=0x1){_0x506f46=0x1+_0x506f46*_0x526e5a/_0x4e696d;}return 0x1/_0x506f46;}function isVoiceQueueOutbound(_0x10ff19){return _0x10ff19===_0xef29('0x4d');}function isNotPreview(_0x3082b2){return _0x3082b2!==_0xef29('0x1c');}function isCampaignIvr(_0x1859bc){return _0x1859bc===_0xef29('0x7e');}function getCallerId(_0x5967e9,_0x1e579b,_0x3d374e){if(!_[_0xef29('0x3c')](_0x3d374e)&&typeof _0x3d374e===_0xef29('0x90')&&!_[_0xef29('0x45')](_0x3d374e)){if(!_[_0xef29('0x3c')](_0x1e579b)&&typeof _0x1e579b==='string'&&!_[_0xef29('0x45')](_0x1e579b)){return util['format'](_0xef29('0x91'),_0x1e579b,_0x3d374e);}return util['format'](_0xef29('0x91'),_0x3d374e,_0x3d374e);}if(!_['isUndefined'](_0x5967e9)&&typeof _0x5967e9===_0xef29('0x90')&&!_['isEmpty'](_0x5967e9)){return _0x5967e9;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x450f67,_0x2ca268){return function(_0x20bbdc){freeVariablesPredictive(_0x2ca268);emitVoiceQueueSummary(_0x2ca268);emitCampaignSummary(_0x2ca268);loggerSyncQueueSummary[_0xef29('0x92')](_0x450f67,util[_0xef29('0x93')](_0x20bbdc,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x44abb0,_0xc1b1e4){return function(_0x496a85){loggerPredictive[_0xef29('0x92')](_0xc1b1e4['name'],_0x44abb0);loggerPredictive[_0xef29('0x92')](_0x496a85[_0xef29('0x94')]);freeVariablesPredictive(_0xc1b1e4);};}function loggerCatch(_0x561fe1){return function(_0x319994){logger[_0xef29('0x92')](_0x561fe1,util[_0xef29('0x93')](_0x319994,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0xfdf94d){return _0xfdf94d&&!_[_0xef29('0x3c')](_0xfdf94d)&&_0xfdf94d['length']>0x0;}function decremetOriginate(_0x462bf9){if(!_[_0xef29('0x3c')](_0x462bf9)&&_0x462bf9!==null){if(typeof _0x462bf9[_0xef29('0x95')]!==_0xef29('0x96')){if(_0x462bf9[_0xef29('0x95')]>0x0){_0x462bf9[_0xef29('0x95')]-=0x1;}else{logger[_0xef29('0x92')](_0xef29('0x97'));}}}else{logger[_0xef29('0x92')](_0xef29('0x98'));}}function checkContactLowerLimitOriginate(_0x37e299,_0x222bbe,_0x31e6e0){if(_0x222bbe>_0x31e6e0){for(var _0x23f13b=0x0;_0x23f13b<_0x222bbe-_0x31e6e0;_0x23f13b+=0x1){decremetOriginate(_0x37e299);}}}function loggerGetContactDialer(_0xe299c9,_0x10dfb0,_0x2f397f){return function(_0x207d73){checkContactLowerLimitOriginate(_0x10dfb0,_0x2f397f,0x0);logger[_0xef29('0x92')](_0xe299c9,util['inspect'](_0x207d73,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2500a8){return function(_0x3ef86f){if(isNotNull(_0x3ef86f)&&isNotNull(_0x3ef86f[0x0])){if(_0x3ef86f[0x0][_0xef29('0x99')]>0x0){_0x2500a8['message']=_0xef29('0x9a');logger[_0xef29('0x80')](_0xef29('0x9b')+_0x2500a8[_0xef29('0x3f')],_0x3ef86f[0x0]['contactsRescheduled'],_0xef29('0x9c'));}else{_0x2500a8['message']=_0xef29('0x9d');logger[_0xef29('0x80')](_0xef29('0x9e')+_0x2500a8[_0xef29('0x3f')]);}}};}function notSendMessagesQueue(_0x429a11){if(_0x429a11[_0xef29('0x9f')]){freeVariablesPredictive(_0x429a11);if(_0x429a11[_0xef29('0x95')]===0x0&&_0x429a11['talking']===0x0&&_0x429a11['waiting']===0x0&&(_0x429a11[_0xef29('0x52')]||0x0)===0x0){_0x429a11['sendMessageOneNotActive']=![];_0x429a11['available']=0x0;_0x429a11[_0xef29('0x3d')]=_0xef29('0x40');loggerSyncQueueSummary['error'](_0xef29('0xa0'),_0x429a11[_0xef29('0x3f')],_0xef29('0xa1'));}else{_0x429a11[_0xef29('0x3d')]=_0xef29('0xa2');loggerSyncQueueSummary[_0xef29('0x92')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x429a11[_0xef29('0x3f')],'is\x20disactive');}emitVoiceQueueSummary(_0x429a11);}}function notSendMessagesCampaign(_0x337051){if(_0x337051[_0xef29('0x9f')]){if(_0x337051[_0xef29('0x95')]===0x0){_0x337051[_0xef29('0x9f')]=![];_0x337051[_0xef29('0x3d')]=_0xef29('0x40');loggerSyncQueueSummary[_0xef29('0x92')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x337051[_0xef29('0x3f')],'is\x20not\x20active');}else{_0x337051[_0xef29('0x3d')]=_0xef29('0xa2');loggerSyncQueueSummary[_0xef29('0x92')](_0xef29('0xa3'),_0x337051[_0xef29('0x3f')],'is\x20disactive');}emitCampaignSummary(_0x337051);}}function createObjHistory(_0x1b03ac,_0x42f5a6,_0x1466de,_0x23fc48,_0x320e65){_0x1b03ac[_0xef29('0x3d')]=_0x1466de;var _0x4dd6fa=new Action(_0x1b03ac,_0x42f5a6);var _0x26d6e8=new History(_0x4dd6fa);_0x26d6e8[_0xef29('0xa4')]=_0x23fc48;_0x26d6e8[_0xef29('0xa5')]=_0x320e65;_0x26d6e8[_0xef29('0xa6')]=_0x4dd6fa['starttime'];return _0x26d6e8;}Dialer[_0xef29('0x19')][_0xef29('0xa7')]=function(){var _0x198abc=this;setInterval(function(){_0x198abc[_0xef29('0xa8')](_0x198abc[_0xef29('0x23')],_0xef29('0xa9'));_0x198abc['clearZombieChannels'](_0x198abc[_0xef29('0x22')],'[actions]');},0x32c8);};Dialer[_0xef29('0x19')][_0xef29('0xa8')]=function(_0x432fda,_0xedb82a){var _0x536422=this;for(var _0x38dc8c in _0x432fda){if(typeof _0x432fda[_0x38dc8c]!==_0xef29('0x96')){this[_0xef29('0xaa')]['enqueue'](function(){if(!_[_0xef29('0xab')](_0x432fda[_0x38dc8c])){return ami['Action']({'action':_0xef29('0xac'),'channel':_0x432fda[_0x38dc8c][_0xef29('0xad')]})[_0xef29('0xae')](function(_0x438270){if(_0x438270[_0xef29('0x3d')]===_0xef29('0xaf')){setTimeout(function(){if(_0x432fda[_0x38dc8c]&&_0x432fda[_0x38dc8c]['type']!==_0xef29('0x7e')){_0x536422[_0xef29('0xb0')](_0x536422[_0xef29('0x1d')][_0x432fda[_0x38dc8c][_0xef29('0xb1')]]);logger['error'](_0xef29('0xb2'),_0xedb82a,_0x38dc8c,_0x432fda[_0x38dc8c][_0xef29('0xb1')]);delete _0x432fda[_0x38dc8c];}if(_0x432fda[_0x38dc8c]&&_0x432fda[_0x38dc8c][_0xef29('0x58')]===_0xef29('0x7e')){_0x536422[_0xef29('0xb0')](_0x536422[_0xef29('0x1e')][_0x432fda[_0x38dc8c][_0xef29('0xb1')]]);logger[_0xef29('0x92')](_0xef29('0xb3'),_0xedb82a,_0x38dc8c,_0x432fda[_0x38dc8c][_0xef29('0xb1')]);delete _0x432fda[_0x38dc8c];}},0x2328);}});}});}}};Dialer['prototype'][_0xef29('0xb4')]=function(_0x4428c0){return BPromise[_0xef29('0xb5')]()[_0xef29('0x3a')](cmHopper[_0xef29('0xb4')](_0x4428c0))[_0xef29('0xae')](loggerCatch('[countReScheduled]\x20'));};Dialer['prototype'][_0xef29('0xb6')]=function(_0x3bdb70){return BPromise[_0xef29('0xb5')]()[_0xef29('0x3a')](cmHopperBlack['checkIsBlackList'](_0x3bdb70))[_0xef29('0xae')](loggerCatch(_0xef29('0xb7')));};Dialer[_0xef29('0x19')]['checkIsBlackListIvr']=function(_0x50c790){return BPromise[_0xef29('0xb5')]()[_0xef29('0x3a')](cmHopperBlack[_0xef29('0xb8')](_0x50c790))[_0xef29('0xae')](loggerCatch(_0xef29('0xb9')));};Dialer[_0xef29('0x19')][_0xef29('0xba')]=function(_0x7d0071){return BPromise['resolve']()[_0xef29('0x3a')](cmHopperHistory['avgHandleTime'](_0x7d0071))[_0xef29('0xae')](loggerCatch(_0xef29('0xbb')));};Dialer[_0xef29('0x19')][_0xef29('0xbc')]=function(_0x5c6756){return BPromise['resolve']()[_0xef29('0x3a')](cmHopper[_0xef29('0xbc')](_0x5c6756))['catch'](loggerCatch(_0xef29('0xbd')));};Dialer['prototype']['unlockContact']=function(_0x499d04,_0x3be50f,_0x1ba81c){return BPromise[_0xef29('0xb5')]()[_0xef29('0x3a')](cmHopper[_0xef29('0xbe')](_0x499d04,_0x3be50f,_0x1ba81c))[_0xef29('0xae')](loggerCatch(_0xef29('0xbf')));};Dialer[_0xef29('0x19')][_0xef29('0xc0')]=function(_0x1cf8b0,_0x26e16a,_0xe35e1e,_0xa61265,_0x39a375){return BPromise[_0xef29('0xb5')]()[_0xef29('0x3a')](cmHopper['getContactDialer'](_0x1cf8b0,_0x26e16a,_0xe35e1e,_0xa61265))['catch'](function(_0x183f20){_0x39a375[_0xef29('0xc1')]-=_0xe35e1e;_0x39a375['temp']=_0x39a375[_0xef29('0xc1')]>0x0?_0x39a375['temp']:0x0;loggerCatch('[getContactDialer]\x20')(_0x183f20);});};Dialer['prototype']['getContactDialerIvr']=function(_0x17e346,_0xb8c630,_0x398efe,_0x3441dc){return BPromise[_0xef29('0xb5')]()[_0xef29('0x3a')](cmHopper['getContactDialerIvr'](_0x17e346,_0xb8c630,_0x398efe))[_0xef29('0xae')](function(_0x441992){_0x3441dc[_0xef29('0xc1')]-=_0xb8c630;_0x3441dc['temp']=_0x3441dc[_0xef29('0xc1')]>0x0?_0x3441dc[_0xef29('0xc1')]:0x0;loggerCatch(_0xef29('0xc2'))(_0x441992);});};Dialer[_0xef29('0x19')][_0xef29('0xc3')]=function(_0x263bbb){return BPromise['resolve']()[_0xef29('0x3a')](voiceQueueRt[_0xef29('0xc3')](_0x263bbb))[_0xef29('0xae')](loggerCatch(_0xef29('0xc4')));};Dialer[_0xef29('0x19')][_0xef29('0xc5')]=function(_0x5cabf4){return BPromise[_0xef29('0xb5')]()[_0xef29('0x3a')](cmHopper[_0xef29('0xc5')](_0x5cabf4))['catch'](loggerCatch(_0xef29('0xc6')));};Dialer['prototype'][_0xef29('0xc7')]=function(_0x4f2c42){return BPromise[_0xef29('0xb5')]()['then'](cmHopperHistory[_0xef29('0xc7')](_0x4f2c42))[_0xef29('0xae')](loggerCatch(_0xef29('0xc8')));};Dialer[_0xef29('0x19')][_0xef29('0xb0')]=function(_0x3aa453){if(!_[_0xef29('0x3c')](_0x3aa453)&&_0x3aa453!==null){if(typeof _0x3aa453[_0xef29('0x95')]!==_0xef29('0x96')){if(_0x3aa453['originated']>0x0){_0x3aa453[_0xef29('0x95')]-=0x1;}else{logger[_0xef29('0x92')](_0xef29('0xc9'));}}}else{logger[_0xef29('0x92')](_0xef29('0xca'));}};Dialer[_0xef29('0x19')][_0xef29('0xcb')]=function(_0x54406c,_0x56cc90){var _0x1db189=this;return function(_0x33c2ee){_0x1db189[_0xef29('0xb0')](_0x56cc90);logger[_0xef29('0x92')](_0x54406c,util[_0xef29('0x93')](_0x33c2ee,{'showHidden':![],'depth':null}));};};Dialer[_0xef29('0x19')][_0xef29('0xcc')]=function(_0x4de96e,_0x22b1ea,_0x24f1b8){var _0x39b332={'state':0x19,'statedesc':_0xef29('0xcd')};this[_0xef29('0xb0')](_0x22b1ea);this[_0xef29('0xce')](_[_0xef29('0x8b')](_0x39b332,_[_0xef29('0xcf')](_0x24f1b8,[_0xef29('0xd0'),_0xef29('0xd1'),_0xef29('0xd2'),_0xef29('0xd3'),_0xef29('0xd4')])),'[emptyContact][createHistory]',_0xef29('0xd5'));logger[_0xef29('0x92')](_0x4de96e);};Dialer[_0xef29('0x19')]['isSuccess']=function(_0x716c62){return _0x716c62===_0xef29('0xd6');};Dialer[_0xef29('0x19')]['isTrunkReachable']=function(_0x1202ec){return!_[_0xef29('0x3c')](_0x1202ec)&&_0x1202ec&&!_[_0xef29('0x3c')](_0x1202ec[_0xef29('0x3f')])&&!_[_0xef29('0x3c')](_0x1202ec['active'])&&_0x1202ec[_0xef29('0x79')]&&(this['trunks'][util[_0xef29('0x7b')](_0xef29('0xd7'),_0x1202ec['name'])][_0xef29('0xac')]==='reachable'||this[_0xef29('0xd8')][util[_0xef29('0x7b')](_0xef29('0xd7'),_0x1202ec[_0xef29('0x3f')])][_0xef29('0xac')]===_0xef29('0xd9'));};Dialer['prototype'][_0xef29('0xce')]=function(_0x39aa4a,_0x57d7c7,_0x2b602c){this[_0xef29('0xc7')](_0x39aa4a)['catch'](loggerCatch(_0x57d7c7));this[_0xef29('0xc5')](_0x39aa4a)['catch'](loggerCatch(_0x2b602c));};Dialer[_0xef29('0x19')][_0xef29('0x36')]=function(_0x56b413){var _0x152ae6=this[_0xef29('0x23')][_0x56b413['uniqueid']];var _0x2914d1;if(!_[_0xef29('0xab')](_0x56b413)&&!_['isNil'](_0x56b413['variable'])&&!_[_0xef29('0xab')](_0x56b413['variable'][_0xef29('0xda')])&&_0x56b413['exten']===_0xef29('0xdb')&&_0x152ae6){if(_0x152ae6[_0xef29('0x58')]!=='ivr'&&this['voiceQueues'][_0x152ae6[_0xef29('0xb1')]]['dialAMDActive']&&_0x56b413[_0xef29('0xdc')]===_0xef29('0xdd')){delete this['uniqueId'][_0x56b413[_0xef29('0xde')]];this[_0xef29('0xb0')](this[_0xef29('0x1d')][_0x152ae6[_0xef29('0xb1')]]);this[_0xef29('0x1d')][_0x152ae6['queue']][_0xef29('0xdf')]+=0x1;this['voiceQueues'][_0x152ae6[_0xef29('0xb1')]][_0xef29('0x62')]+=0x1;_0x2914d1=new Hangup(_0x152ae6,_0x56b413);_0x2914d1[_0xef29('0xa4')]=0x12;_0x2914d1[_0xef29('0xa5')]=_0xef29('0xe0');_0x2914d1[_0xef29('0xe1')]='AMD';ami[_0xef29('0x4c')](_0xef29('0xe2'),ut['buildObj'](_0x2914d1,_0xef29('0xe3')));this[_0xef29('0xce')](_0x2914d1,_0xef29('0xe4'),_0xef29('0xe5'));}if(_0x152ae6['type']!==_0xef29('0x7e')&&this['voiceQueues'][_0x152ae6[_0xef29('0xb1')]][_0xef29('0xe6')]&&_0x56b413[_0xef29('0xdc')]===_0xef29('0xe7')){var _0x454926=this;return new BPromise(function(_0x588504,_0x23525c){delete _0x454926[_0xef29('0x23')][_0x56b413[_0xef29('0xde')]];_0x454926[_0xef29('0xb0')](_0x454926[_0xef29('0x1d')][_0x152ae6[_0xef29('0xb1')]]);_0x454926['voiceQueues'][_0x152ae6['queue']][_0xef29('0xdf')]+=0x1;_0x454926[_0xef29('0x1d')][_0x152ae6[_0xef29('0xb1')]][_0xef29('0x62')]+=0x1;var _0x4de4d6=_0x454926['voiceQueues'][_0x152ae6[_0xef29('0xb1')]];var _0xe576d=new Hangup(_0x152ae6,_0x56b413);_0xe576d['state']=0x13;_0xe576d[_0xef29('0xa5')]=_0xef29('0xe8');_0xe576d['membername']='AMD';_0xe576d[_0xef29('0xe9')]+=0x1;_0xe576d[_0xef29('0xea')]+=0x1;_0xe576d[_0xef29('0xe3')]=!![];ami[_0xef29('0x4c')]('custom:amd',ut[_0xef29('0xeb')](_0xe576d,_0xef29('0xe3')));_0x454926[_0xef29('0xc7')](_0xe576d)[_0xef29('0xae')](loggerCatch(_0xef29('0xec')));if(_0xe576d[_0xef29('0xed')]+_0xe576d[_0xef29('0xee')]+_0xe576d[_0xef29('0xef')]+_0xe576d[_0xef29('0xf0')]+_0xe576d[_0xef29('0xf1')]+_0xe576d[_0xef29('0xf2')]+_0xe576d[_0xef29('0xe9')]+_0xe576d[_0xef29('0xf3')]>=_0x4de4d6[_0xef29('0xf4')]){_0x454926[_0xef29('0xf5')](_0xe576d,_0x588504,_0x23525c,'reason19\x20machine....');}else{if(_0xe576d[_0xef29('0xe9')]>=_0x4de4d6['dialMachineMaxRetry']){_0x454926[_0xef29('0xf6')](_0xe576d,_0x588504,_0x23525c,'reason\x2019\x20machine....');}else{_0x454926[_0xef29('0xbc')]({'active':![],'countmachineretry':_0xe576d[_0xef29('0xe9')],'scheduledat':moment()[_0xef29('0xf7')](_0x4de4d6[_0xef29('0xf8')],_0xef29('0xf9'))[_0xef29('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xe576d[_0xef29('0xd0')],'ListId':_0xe576d[_0xef29('0xd1')],'VoiceQueueId':_0xe576d[_0xef29('0xd3')]||undefined,'CampaignId':_0xe576d[_0xef29('0xd4')]||undefined})[_0xef29('0xae')](loggerCatch(_0xef29('0xfa')));_0x588504({'reschedule':0x1});}}});}if(_0x152ae6[_0xef29('0x58')]===_0xef29('0x7e')&&this[_0xef29('0x1e')][_0x152ae6[_0xef29('0xb1')]][_0xef29('0xe6')]&&_0x56b413[_0xef29('0xdc')]==='HANGUP'){delete this['uniqueId'][_0x56b413[_0xef29('0xde')]];this['updateOriginated'](this['campaigns'][_0x152ae6['queue']]);_0x2914d1=new Hangup(_0x152ae6,_0x56b413);_0x2914d1[_0xef29('0xa4')]=0x12;_0x2914d1[_0xef29('0xa5')]=_0xef29('0xe0');_0x2914d1['membername']=_0xef29('0xfb');ami[_0xef29('0x4c')](_0xef29('0xe2'),ut[_0xef29('0xeb')](_0x2914d1,_0xef29('0xe3')));this[_0xef29('0xce')](_0x2914d1,_0xef29('0xfc'),_0xef29('0xfd'));}if(_0x152ae6[_0xef29('0x58')]===_0xef29('0x7e')&&this[_0xef29('0x1e')][_0x152ae6[_0xef29('0xb1')]][_0xef29('0xe6')]&&_0x56b413[_0xef29('0xdc')]===_0xef29('0xe7')){var _0x454926=this;return new BPromise(function(_0x963500,_0x54c357){delete _0x454926[_0xef29('0x23')][_0x56b413[_0xef29('0xde')]];_0x454926[_0xef29('0xb0')](_0x454926[_0xef29('0x1e')][_0x152ae6[_0xef29('0xb1')]]);_0x454926[_0xef29('0x1e')][_0x152ae6[_0xef29('0xb1')]][_0xef29('0xdf')]+=0x1;_0x454926[_0xef29('0x1e')][_0x152ae6[_0xef29('0xb1')]][_0xef29('0x62')]+=0x1;var _0x4f1418=_0x454926['campaigns'][_0x152ae6[_0xef29('0xb1')]];var _0x39d381=new Hangup(_0x152ae6,_0x56b413);_0x39d381[_0xef29('0xa4')]=0x13;_0x39d381['statedesc']='Machine';_0x39d381[_0xef29('0xe1')]=_0xef29('0xfb');_0x39d381['countmachineretry']+=0x1;_0x39d381[_0xef29('0xea')]+=0x1;_0x39d381[_0xef29('0xe3')]=!![];ami['emit'](_0xef29('0xe2'),ut[_0xef29('0xeb')](_0x39d381,_0xef29('0xe3')));_0x454926[_0xef29('0xc7')](_0x39d381)[_0xef29('0xae')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x39d381[_0xef29('0xed')]+_0x39d381[_0xef29('0xee')]+_0x39d381['countnoanswerretry']+_0x39d381['countnosuchnumberretry']+_0x39d381[_0xef29('0xf1')]+_0x39d381[_0xef29('0xf2')]+_0x39d381[_0xef29('0xe9')]+_0x39d381[_0xef29('0xf3')]>=_0x4f1418['dialGlobalMaxRetry']){_0x454926[_0xef29('0xf5')](_0x39d381,_0x963500,_0x54c357,_0xef29('0xfe'));}else{if(_0x39d381[_0xef29('0xe9')]>=_0x4f1418[_0xef29('0xff')]){_0x454926[_0xef29('0xf6')](_0x39d381,_0x963500,_0x54c357,_0xef29('0x100'));}else{_0x454926[_0xef29('0xbc')]({'active':![],'countmachineretry':_0x39d381[_0xef29('0xe9')],'scheduledat':moment()[_0xef29('0xf7')](_0x4f1418[_0xef29('0xf8')],_0xef29('0xf9'))['format'](_0xef29('0x101')),'ContactId':_0x39d381['ContactId'],'ListId':_0x39d381[_0xef29('0xd1')],'VoiceQueueId':_0x39d381['VoiceQueueId']||undefined,'CampaignId':_0x39d381[_0xef29('0xd4')]||undefined})[_0xef29('0xae')](loggerCatch(_0xef29('0xfa')));_0x963500({'reschedule':0x1});}}});}}};Dialer[_0xef29('0x19')][_0xef29('0x32')]=function(_0x9c8e3f){var _0x4a3a54=this['uniqueId'][_0x9c8e3f[_0xef29('0xde')]];var _0x36d7ca=this;var _0x31b3f1;if(_0x4a3a54&&_0x4a3a54[_0xef29('0x58')]==='ivr'){delete this[_0xef29('0x23')][_0x9c8e3f[_0xef29('0xde')]];this[_0xef29('0xb0')](this[_0xef29('0x1e')][_0x4a3a54[_0xef29('0xb1')]]);this[_0xef29('0x1e')][_0x4a3a54['queue']][_0xef29('0x102')]+=0x1;_0x31b3f1=new Hangup(_0x4a3a54,_0x9c8e3f);this[_0xef29('0xc7')](_0x31b3f1)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x31b3f1)[_0xef29('0xae')](loggerCatch(_0xef29('0x103')));}if(_0x4a3a54&&_0x4a3a54[_0xef29('0x58')]!==_0xef29('0x7e')&&isNotNull(this['voiceQueues'][_0x4a3a54[_0xef29('0xb1')]][_0xef29('0x104')])){delete this['uniqueId'][_0x9c8e3f[_0xef29('0xde')]];this[_0xef29('0xb0')](this[_0xef29('0x1d')][_0x4a3a54['queue']]);this[_0xef29('0x1d')][_0x4a3a54[_0xef29('0xb1')]][_0xef29('0xdf')]+=0x1;this[_0xef29('0x1d')][_0x4a3a54[_0xef29('0xb1')]][_0xef29('0x62')]+=0x1;_0x31b3f1=new Hangup(_0x4a3a54,_0x9c8e3f);_0x31b3f1[_0xef29('0xa4')]=0x10;_0x31b3f1['statedesc']=_0xef29('0x105');_0x31b3f1[_0xef29('0xe1')]=_0xef29('0x106');this[_0xef29('0xc7')](_0x31b3f1)[_0xef29('0xae')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x31b3f1)['catch'](loggerCatch(_0xef29('0x103')));}if(_0x4a3a54&&_0x4a3a54[_0xef29('0x58')]!==_0xef29('0x7e')&&!isNotNull(this[_0xef29('0x1d')][_0x4a3a54[_0xef29('0xb1')]]['dialQueueProject'])){delete this[_0xef29('0x23')][_0x9c8e3f['uniqueid']];this[_0xef29('0xb0')](this[_0xef29('0x1d')][_0x4a3a54[_0xef29('0xb1')]]);this[_0xef29('0x1d')][_0x4a3a54[_0xef29('0xb1')]][_0xef29('0x69')]+=0x1;_0x31b3f1=new Hangup(_0x4a3a54,_0x9c8e3f);_0x31b3f1['state']=0xc;_0x31b3f1[_0xef29('0xa5')]=_0x9c8e3f['cause-txt'];_0x31b3f1[_0xef29('0xe1')]=_0xef29('0x107');this[_0xef29('0xc7')](_0x31b3f1)[_0xef29('0xae')](loggerCatch(_0xef29('0x108')));this[_0xef29('0xc5')](_0x31b3f1)['catch'](loggerCatch(_0xef29('0x103')));}};Dialer[_0xef29('0x19')]['syncAgentComplete']=function(_0x5c9041){var _0x54b92a=this['uniqueId'][_0x5c9041[_0xef29('0xde')]];var _0x48b200=this;if(this[_0xef29('0x1d')][_0x5c9041[_0xef29('0xb1')]]){if(_0x54b92a&&_0x54b92a['type']!=='ivr'){delete this[_0xef29('0x23')][_0x5c9041[_0xef29('0xde')]];this['voiceQueues'][_0x5c9041['queue']]['outboundAnswerCallsDay']+=0x1;var _0x49eac4=new AgentComplete(_0x54b92a,_0x5c9041);if(_0x5c9041[_0xef29('0x109')]===_0xef29('0x10a')){_0x49eac4[_0xef29('0x10b')]=this[_0xef29('0x1d')][_0x5c9041[_0xef29('0xb1')]]['dialQueueProject2']&&this[_0xef29('0x1d')][_0x5c9041[_0xef29('0xb1')]][_0xef29('0x10c')]?moment()[_0xef29('0x7b')](_0xef29('0x101')):undefined;}this[_0xef29('0xc7')](_0x49eac4)[_0xef29('0xae')](loggerCatch(_0xef29('0x10d')));this['moveContactManagedDialer'](_0x49eac4)[_0xef29('0xae')](loggerCatch('[syncAgentComplete]'));}}};Dialer['prototype'][_0xef29('0x2a')]=function(_0x1d957d){if(this[_0xef29('0x1d')][_0x1d957d['queue']]){if(this[_0xef29('0x23')][_0x1d957d['uniqueid']]&&this[_0xef29('0x23')][_0x1d957d[_0xef29('0xde')]]['type']!=='ivr'){this[_0xef29('0xb0')](this[_0xef29('0x1d')][_0x1d957d[_0xef29('0xb1')]]);this[_0xef29('0x23')][_0x1d957d[_0xef29('0xde')]]['answertime']=moment()['format'](_0xef29('0x101'));}}};Dialer[_0xef29('0x19')][_0xef29('0x10e')]=function(_0x504c7c){this[_0xef29('0xc7')](_0x504c7c)[_0xef29('0xae')](loggerCatch(_0xef29('0x10d')));this[_0xef29('0xc5')](_0x504c7c)[_0xef29('0xae')](loggerCatch(_0xef29('0x10f')));};Dialer['prototype']['syncQueueCallerAbandon']=function(_0x285f21){var _0x21798e=this[_0xef29('0x23')][_0x285f21[_0xef29('0xde')]];var _0x3cb2ca=this;if(this[_0xef29('0x1d')][_0x285f21[_0xef29('0xb1')]]){if(_0x21798e&&_0x21798e[_0xef29('0x58')]!==_0xef29('0x7e')){delete this[_0xef29('0x23')][_0x285f21[_0xef29('0xde')]];this['updateOriginated'](this['voiceQueues'][_0x285f21[_0xef29('0xb1')]]);_0x21798e[_0xef29('0x110')]=moment()[_0xef29('0x7b')]('YYYY-MM-DD\x20HH:mm:ss');var _0x711098=new QueueCallerAbandon(_0x21798e,_0x285f21);if(getSeconds(_0x21798e['droptime'],_0x21798e[_0xef29('0x111')])>=_0x21798e['dialQueueTimeout']){this[_0xef29('0x1d')][_0x285f21[_0xef29('0xb1')]][_0xef29('0x6e')]+=0x1;this[_0xef29('0x1d')][_0x285f21[_0xef29('0xb1')]]['outboundDropCallsDayTimeout']+=0x1;this[_0xef29('0x1d')][_0x285f21[_0xef29('0xb1')]][_0xef29('0x70')]+=0x1;_0x711098['state']=0xa;_0x711098[_0xef29('0xa5')]=_0xef29('0x112');_0x711098[_0xef29('0x113')]=_0xef29('0x114');_0x711098['agiafterat']=this['voiceQueues'][_0x285f21[_0xef29('0xb1')]][_0xef29('0x115')]?moment()['format'](_0xef29('0x101')):undefined;_0x711098[_0xef29('0xf1')]+=0x1;_0x711098[_0xef29('0xea')]+=0x1;if(_0x711098[_0xef29('0xf1')]>=this[_0xef29('0x1d')][_0x285f21[_0xef29('0xb1')]]['dialDropMaxRetry']){this['queueCallerAbandonCreateState'](_0x711098);}else{this[_0xef29('0xbc')]({'active':![],'countdropretry':_0x711098[_0xef29('0xf1')],'scheduledat':moment()[_0xef29('0xf7')](this[_0xef29('0x1d')][_0x285f21[_0xef29('0xb1')]][_0xef29('0x116')],_0xef29('0xf9'))[_0xef29('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x21798e[_0xef29('0xd0')],'ListId':_0x21798e[_0xef29('0xd1')],'VoiceQueueId':_0x21798e[_0xef29('0xd3')]||undefined,'CampaignId':_0x21798e['CampaignId']||undefined})[_0xef29('0xae')](loggerCatch(_0xef29('0x117')));var _0x3771a3=new History(_0x711098);_0x3771a3[_0xef29('0xa4')]=0xa;_0x3771a3['statedesc']=_0xef29('0x112');_0x3771a3[_0xef29('0x118')]=moment()[_0xef29('0x7b')](_0xef29('0x101'));_0x3771a3[_0xef29('0xa6')]=_0x3771a3[_0xef29('0x118')];_0x3771a3[_0xef29('0x119')]=_0x711098[_0xef29('0x119')];_0x3771a3[_0xef29('0x11a')]=_0x711098['calleridnum'];this[_0xef29('0xc7')](_0x3771a3)[_0xef29('0xae')](loggerCatch(_0xef29('0x11b')));}}else{this[_0xef29('0x1d')][_0x285f21[_0xef29('0xb1')]][_0xef29('0x6d')]+=0x1;this[_0xef29('0x1d')][_0x285f21[_0xef29('0xb1')]]['outboundDropCallsDayCallersExit']+=0x1;_0x711098['state']=0xb;_0x711098[_0xef29('0xa5')]=_0xef29('0x11c');_0x711098['dropreason']=_0xef29('0x11d');_0x711098[_0xef29('0xf2')]+=0x1;_0x711098[_0xef29('0xea')]+=0x1;if(_0x711098[_0xef29('0xf2')]>=this[_0xef29('0x1d')][_0x285f21[_0xef29('0xb1')]][_0xef29('0x11e')]){this[_0xef29('0x10e')](_0x711098);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x711098[_0xef29('0xf2')],'scheduledat':moment()[_0xef29('0xf7')](this[_0xef29('0x1d')][_0x285f21[_0xef29('0xb1')]][_0xef29('0x11f')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x21798e[_0xef29('0xd0')],'ListId':_0x21798e[_0xef29('0xd1')],'VoiceQueueId':_0x21798e['VoiceQueueId']||undefined,'CampaignId':_0x21798e[_0xef29('0xd4')]||undefined})[_0xef29('0xae')](loggerCatch(_0xef29('0x120')));var _0x3771a3=new History(_0x711098);_0x3771a3[_0xef29('0xa4')]=0xb;_0x3771a3[_0xef29('0xa5')]=_0xef29('0x11c');_0x3771a3['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3771a3[_0xef29('0xa6')]=_0x3771a3['starttime'];_0x3771a3[_0xef29('0x119')]=_0x711098[_0xef29('0x119')];_0x3771a3[_0xef29('0x11a')]=_0x711098['calleridnum'];this[_0xef29('0xc7')](_0x3771a3)[_0xef29('0xae')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0xef29('0x19')]['syncNewExten']=function(_0x237c61){if(this['actions'][_0x237c61[_0xef29('0xde')]]){this['actions'][_0x237c61[_0xef29('0xde')]][_0xef29('0xad')]=_0x237c61[_0xef29('0xad')];}if(this[_0xef29('0x23')][_0x237c61['uniqueid']]){this[_0xef29('0x23')][_0x237c61[_0xef29('0xde')]][_0xef29('0xad')]=_0x237c61[_0xef29('0xad')];}};Dialer['prototype']['syncQueueMember']=function(_0x2c1205){if(strategy[this[_0xef29('0x1d')][this[_0xef29('0x22')][_0x2c1205[_0xef29('0x121')]]['queue']][_0xef29('0x4e')]]==='roundrobin'){if(this['actions'][_0x2c1205[_0xef29('0x121')]]&&_[_0xef29('0xab')](this[_0xef29('0x22')][_0x2c1205['actionid']][_0xef29('0x122')])&&_0x2c1205[_0xef29('0xac')]==='1'&&_0x2c1205[_0xef29('0x123')]==='0'){if(this[_0xef29('0x1f')][_0x2c1205[_0xef29('0x124')]]){if(!this[_0xef29('0x1f')][_0x2c1205[_0xef29('0x124')]][_0xef29('0x122')]){this[_0xef29('0x1f')][_0x2c1205[_0xef29('0x124')]][_0xef29('0x122')]=!![];this[_0xef29('0x22')][_0x2c1205[_0xef29('0x121')]][_0xef29('0x122')]=!![];this['actions'][_0x2c1205['actionid']][_0xef29('0x124')]=_0x2c1205[_0xef29('0x124')];}}}}else if((strategy[this[_0xef29('0x1d')][this[_0xef29('0x22')][_0x2c1205[_0xef29('0x121')]][_0xef29('0xb1')]]['strategy']]||_0xef29('0x18'))==='rrmemory'){if(this[_0xef29('0x22')][_0x2c1205[_0xef29('0x121')]]){if(this[_0xef29('0x1f')][_0x2c1205[_0xef29('0x124')]]){this['actions'][_0x2c1205['actionid']][_0xef29('0x124')]=_0x2c1205[_0xef29('0x124')];if(_['isNil'](this['queueBooked'][this[_0xef29('0x22')][_0x2c1205[_0xef29('0x121')]][_0xef29('0xb1')]])){this['queueBooked'][this[_0xef29('0x22')][_0x2c1205[_0xef29('0x121')]]['queue']]=[];}this[_0xef29('0x27')][this[_0xef29('0x22')][_0x2c1205[_0xef29('0x121')]]['queue']]['push'](_['merge'](_[_0xef29('0xcf')](this[_0xef29('0x22')][_0x2c1205[_0xef29('0x121')]],[_0xef29('0x125'),'stateinterface']),{'status':_0x2c1205[_0xef29('0xac')],'paused':_0x2c1205['paused']}));}}}};function unlockQueueStatus(_0xdee3d6,_0x340bd0){setTimeout(function(){if(_[_0xef29('0x3c')](_0xdee3d6['queueStatusComplete'])){loggerBooked[_0xef29('0x92')](_0xef29('0x126'),_0x340bd0);}_0xdee3d6[_0xef29('0x127')]=!![];loggerBooked[_0xef29('0x80')](_0xef29('0x128'),_0x340bd0,JSON[_0xef29('0x48')](_['pick'](_0xdee3d6,[_0xef29('0x3f'),_0xef29('0x127')])));},0x1f3);}Dialer['prototype']['syncQueueStatusComplete']=function(_0x1dd463){var _0x2ffcd0=this;var _0x4c7b83=_0x2ffcd0[_0xef29('0x1d')][_0x2ffcd0[_0xef29('0x22')][_0x1dd463['actionid']][_0xef29('0xb1')]];if(strategy[this[_0xef29('0x1d')][this[_0xef29('0x22')][_0x1dd463[_0xef29('0x121')]][_0xef29('0xb1')]][_0xef29('0x4e')]]===_0xef29('0x129')){if(this['actions'][_0x1dd463[_0xef29('0x121')]]&&this['actions'][_0x1dd463[_0xef29('0x121')]]['stateinterface']){this[_0xef29('0x1c')]['run'](this[_0xef29('0x22')][_0x1dd463[_0xef29('0x121')]][_0xef29('0x125')],this[_0xef29('0x22')][_0x1dd463[_0xef29('0x121')]][_0xef29('0x124')])['catch'](function(_0x17691e){logger[_0xef29('0x92')](_0xef29('0x12a'),util['inspect'](_0x17691e,{'showHidden':![],'depth':null}));})[_0xef29('0x12b')](function(){_0x2ffcd0[_0xef29('0xb0')](_0x2ffcd0[_0xef29('0x1d')][_0x2ffcd0[_0xef29('0x22')][_0x1dd463[_0xef29('0x121')]][_0xef29('0xb1')]]);_0x2ffcd0[_0xef29('0x1f')][_0x2ffcd0[_0xef29('0x22')][_0x1dd463[_0xef29('0x121')]][_0xef29('0x124')]]['locked']=![];delete _0x2ffcd0[_0xef29('0x22')][_0x1dd463[_0xef29('0x121')]];unlockQueueStatus(_0x4c7b83);});}else{this[_0xef29('0xb0')](this[_0xef29('0x1d')][this[_0xef29('0x22')][_0x1dd463[_0xef29('0x121')]][_0xef29('0xb1')]]);this[_0xef29('0xbc')]({'active':![],'ContactId':this[_0xef29('0x22')][_0x1dd463['actionid']]['ContactId'],'ListId':this[_0xef29('0x22')][_0x1dd463[_0xef29('0x121')]][_0xef29('0xd1')],'VoiceQueueId':this[_0xef29('0x22')][_0x1dd463['actionid']][_0xef29('0xd3')]||undefined,'CampaignId':this[_0xef29('0x22')][_0x1dd463[_0xef29('0x121')]][_0xef29('0xd4')]||undefined})[_0xef29('0xae')](loggerCatch(_0xef29('0x12c')));delete this['actions'][_0x1dd463[_0xef29('0x121')]];unlockQueueStatus(_0x4c7b83);}}else if((strategy[this[_0xef29('0x1d')][this[_0xef29('0x22')][_0x1dd463[_0xef29('0x121')]]['queue']][_0xef29('0x4e')]]||_0xef29('0x18'))===_0xef29('0x18')){var _0x334b64;if(this['actions'][_0x1dd463[_0xef29('0x121')]]&&!_[_0xef29('0x45')](this['queueBooked'][this['actions'][_0x1dd463[_0xef29('0x121')]]['queue']])){if(this[_0xef29('0x28')][_0x2ffcd0['actions'][_0x1dd463[_0xef29('0x121')]][_0xef29('0xb1')]]){this[_0xef29('0x28')][_0x2ffcd0[_0xef29('0x22')][_0x1dd463[_0xef29('0x121')]][_0xef29('0xb1')]]=this['queueBookedRR'][this[_0xef29('0x22')][_0x1dd463[_0xef29('0x121')]][_0xef29('0xb1')]]?this[_0xef29('0x28')][this['actions'][_0x1dd463['actionid']][_0xef29('0xb1')]]:this['queueBooked'][this['actions'][_0x1dd463['actionid']][_0xef29('0xb1')]]?this['queueBooked'][this[_0xef29('0x22')][_0x1dd463[_0xef29('0x121')]][_0xef29('0xb1')]]['_rr']||0x0:0x0;}this[_0xef29('0x27')][this[_0xef29('0x22')][_0x1dd463[_0xef29('0x121')]][_0xef29('0xb1')]][_0xef29('0x12d')]=this[_0xef29('0x28')][this[_0xef29('0x22')][_0x1dd463['actionid']]['queue']];for(var _0x34189f=0x0;_0x34189f=0x0;})[_0xef29('0xae')](myreject(_0x39ba63)));}}else{_0x1b9c1c['push'](ami['Action']({'action':'command','command':util[_0xef29('0x7b')](_0xef29('0x14c'),_0x4e1cc8,!_[_0xef29('0x3c')](config[_0xef29('0x14d')][_0x3a6caa])?_0x3a6caa:'')})[_0xef29('0x3a')](function(_0x3ea3aa){return _0x3ea3aa[_0xef29('0x14a')][_0xef29('0x14b')](_0xef29('0x14e'))>=0x0;})[_0xef29('0xae')](myreject(_0x39ba63)));}BPromise[_0xef29('0x14f')](_0x1b9c1c)[_0xef29('0x3a')](function(_0x1f8c57){var _0x1b4bcf=_['some'](_0x1f8c57);if(_0x1b4bcf){return _0x7c089f(_0x1b4bcf);}else{_0x2543c9['message']=_0x9b4b33?'GLOBAL_INTERVAL_IS_OVERTIME':_0xef29('0x150');return _0x39ba63(msgResponse(_0xef29('0x151'),'Failure',_0xef29('0x152')+_0x9b4b33+'\x20'+_0x299e74+_0xef29('0x153')+util['inspect'](_0x4e1cc8,{'showHidden':![],'depth':null})+_0xef29('0x154')+_0x3a6caa));}})[_0xef29('0xae')](function(_0x9b84da){return _0x39ba63(msgResponse(_0xef29('0x13d'),_0xef29('0x13f'),JSON[_0xef29('0x48')](_0x9b84da)));});});};Dialer[_0xef29('0x19')]['checkDialMethod']=function(_0x2a85b4){var _0x5ece61=this;return function(){switch(_0x2a85b4[_0xef29('0x5e')]){case _0xef29('0x155'):freeVariablesPredictive(_0x2a85b4);_0x5ece61[_0xef29('0x156')](_0x2a85b4,0x1);break;case'power':freeVariablesPredictive(_0x2a85b4);_0x5ece61[_0xef29('0x156')](_0x2a85b4,_0x2a85b4['dialPowerLevel']);break;case _0xef29('0x157'):_0x5ece61[_0xef29('0x157')](_0x2a85b4);break;case _0xef29('0x7'):freeVariablesPredictive(_0x2a85b4);_0x5ece61[_0xef29('0x156')](_0x2a85b4,0x1);break;default:freeVariablesPredictive(_0x2a85b4);logger[_0xef29('0x92')]('Queue',_0x2a85b4[_0xef29('0x3f')],_0xef29('0x158'));}};};Dialer[_0xef29('0x19')][_0xef29('0x159')]=function(_0x1dcc78){return BPromise[_0xef29('0xb5')]()[_0xef29('0x3a')](cmHopper[_0xef29('0x15a')](_0x1dcc78['id'],previewRecallmeReminderInterval))[_0xef29('0x3a')](function(_0x25832c){for(var _0x51bf9f=0x0;_0x51bf9f<_0x25832c[_0xef29('0x12e')];_0x51bf9f++){var _0x4edc78=_0x25832c[_0x51bf9f]['Agent'][_0xef29('0x3f')];if(_0x4edc78)io['to'](util[_0xef29('0x7b')](_0xef29('0x15b'),_0x4edc78))[_0xef29('0x4c')]('user:dialPreviewRecallReminder',{'hopper':_0x25832c[_0x51bf9f]});}})['catch'](function(_0x1185d3){});};Dialer[_0xef29('0x19')][_0xef29('0x15c')]=function(_0x55b403){var _0x520d18=this;return function(){_0x520d18['handleIvr'](_0x55b403);};};Dialer[_0xef29('0x19')]['syncQueueSummary']=function(_0x51171b){var _0x109cc1=this;if(isNotPreview(_0x51171b[_0xef29('0x5e')])){if(isVoiceQueueOutbound(_0x51171b['type'])&&isActive(_0x51171b[_0xef29('0x5d')])){_0x51171b[_0xef29('0x9f')]=!![];BPromise[_0xef29('0xb5')]()[_0xef29('0x3a')](checkIsLoggedIn(_0x51171b,_0x51171b[_0xef29('0x51')]))['then'](checkIsActive(_0x51171b,_0x51171b[_0xef29('0x5d')]))[_0xef29('0x3a')](checkInterval(_0x51171b))[_0xef29('0x3a')](_0x109cc1[_0xef29('0x13a')](_0x51171b))['then'](_0x109cc1[_0xef29('0x13c')](_0x51171b['dialGlobalInterval'],_0x51171b[_0xef29('0x15d')],_0x51171b[_0xef29('0x3f')],_0x51171b))['then'](_0x109cc1[_0xef29('0x13e')](_0x51171b[_0xef29('0x46')],_0x51171b[_0xef29('0x15d')],_0x51171b[_0xef29('0x3f')],_0x51171b))[_0xef29('0x3a')](_0x109cc1[_0xef29('0x15e')](_0x51171b))[_0xef29('0xae')](loggerCatchQueueSummary(_0xef29('0x15f'),_0x51171b));}else{notSendMessagesQueue(_0x51171b);}}else{freeVariablesPredictive(_0x51171b);if(_0x51171b['dialPreviewRecallmeReminder']){_0x109cc1[_0xef29('0x159')](_0x51171b);}}};Dialer[_0xef29('0x19')]['syncCampaigns']=function(){var _0xf5fc1b=this;var _0x2611b5;for(var _0x533255 in this[_0xef29('0x1e')]){if(typeof this['campaigns'][_0x533255]!==_0xef29('0x96')){_0x2611b5=this[_0xef29('0x1e')][_0x533255];if(isCampaignIvr(_0x2611b5[_0xef29('0x58')])&&isActive(_0x2611b5[_0xef29('0x79')])){_0x2611b5[_0xef29('0x9f')]=!![];BPromise[_0xef29('0xb5')]()[_0xef29('0x3a')](checkIsActive(_0x2611b5,_0x2611b5[_0xef29('0x79')]))[_0xef29('0x3a')](checkInterval(_0x2611b5))[_0xef29('0x3a')](_0xf5fc1b[_0xef29('0x13a')](_0x2611b5))[_0xef29('0x3a')](_0xf5fc1b[_0xef29('0x13c')](_0x2611b5[_0xef29('0x160')],_0x2611b5[_0xef29('0x15d')],_0x2611b5['name'],_0x2611b5))[_0xef29('0x3a')](_0xf5fc1b[_0xef29('0x13e')](_0x2611b5[_0xef29('0x46')],_0x2611b5[_0xef29('0x15d')],_0x2611b5[_0xef29('0x3f')],_0x2611b5))[_0xef29('0x3a')](_0xf5fc1b[_0xef29('0x15c')](_0x2611b5))[_0xef29('0xae')](loggerCatchQueueSummary(_0xef29('0x161'),_0x2611b5));}else{notSendMessagesCampaign(_0x2611b5);}}}};function getCallerIdRandom(_0x2c7d21,_0x39d6b7){var _0x1f1866;var _0x3b6f52;var _0x4d4f55;if(_0x39d6b7<=0x0){_0x39d6b7=0x1;}_0x1f1866=new RegExp('\x5cw{0,'+_0x39d6b7+'}$');_0x3b6f52=Math['pow'](0xa,_0x39d6b7-0x1);_0x4d4f55=Math[_0xef29('0x162')](0xa,_0x39d6b7)-0x1;return util[_0xef29('0x7b')]('%s',_[_0xef29('0x163')](_0x2c7d21,_0x1f1866,_[_0xef29('0x164')](_0x3b6f52,_0x4d4f55)));}function extractCalleridName(_0x170814){var _0x3a3c4c=_0x170814['match'](/"(.*?)"/);return _0x3a3c4c?_0x3a3c4c[0x1]:_0x170814;}function extractCalleridNumber(_0x14dcee){var _0x15d4bc=_0x14dcee[_0xef29('0x165')](/<(.*?)>/);return _0x15d4bc?_0x15d4bc[0x1]:_0x14dcee;}Dialer[_0xef29('0x19')][_0xef29('0x166')]=function(_0x475602,_0x1b7939){var _0x1cf3d2=this;var _0x3ea96e=uuid['v4']();this[_0xef29('0x22')][_0x3ea96e]=new Action(_0x475602,_0x1b7939,_0x3ea96e);return new BPromise(function(_0x59509f,_0x3ee726){if(_[_0xef29('0x3c')](_0x475602)&&typeof _0x475602!==_0xef29('0x167')){return _0x3ee726(msgResponse(_0xef29('0x168'),_0xef29('0x13f'),_0xef29('0x169')));}if(_[_0xef29('0x3c')](_0x1b7939['Contact']['phone'])||_0x1b7939['Contact'][_0xef29('0x16a')]===null){return _0x3ee726(msgResponse(_0xef29('0x168'),_0xef29('0x13f'),'contact\x20is\x20undefine'));}var _0x127140={'XMD-CALLERID':_0x1cf3d2[_0xef29('0x22')][_0x3ea96e]['getCaller'](),'XMD-AGI':_0x475602[_0xef29('0x104')]?util[_0xef29('0x7b')]('\x22agi://%s/square,%s\x22',ipAgi,_0x475602[_0xef29('0x104')]):_0xef29('0x16b'),'XMD-AGIAFTER':_0x475602[_0xef29('0x115')]?util[_0xef29('0x7b')](_0xef29('0x16c'),ipAgi,_0x475602[_0xef29('0x115')]):_0xef29('0x16b'),'XMD-QUEUE':_0x475602[_0xef29('0x58')]===_0xef29('0x4d')?util[_0xef29('0x7b')]('\x22%s,%s%s,,,%s\x22',_0x475602[_0xef29('0x3f')],_0x475602[_0xef29('0x16d')]||'',_0x475602[_0xef29('0x10c')]?'c':'',_0x475602['dialQueueTimeout']||0x3):'NONE','XMD-CONTACTID':_0x1b7939['ContactId'],'XMD-CDRTYPE':_0xef29('0x16e'),'CALLERID(all)':_0x1cf3d2[_0xef29('0x22')][_0x3ea96e]['getCaller'](),'XMD-AMD':_0x475602[_0xef29('0xe6')]?_0xef29('0x16f'):_0xef29('0x16b'),'XMD-DESTINATION':_0xef29('0xdb')};if(_0x475602[_0xef29('0xe6')]){_0x127140[_0xef29('0x170')]=_0x475602[_0xef29('0x171')]||0x9c4;_0x127140[_0xef29('0x172')]=_0x475602[_0xef29('0x173')]||0x5dc;_0x127140['XMD-AMDAFTERGREETINGSILENCE']=_0x475602[_0xef29('0x174')]||0x320;_0x127140[_0xef29('0x175')]=_0x475602[_0xef29('0x176')]||0x1388;_0x127140['XMD-AMDMINWORDLENGTH']=_0x475602[_0xef29('0x177')]||0x64;_0x127140[_0xef29('0x178')]=_0x475602[_0xef29('0x179')]||0x32;_0x127140[_0xef29('0x17a')]=_0x475602[_0xef29('0x17b')]||0x3;_0x127140[_0xef29('0x17c')]=_0x475602[_0xef29('0x17d')]||0x100;_0x127140['XMD-AMDMAXIMUMWORDLENGTH']=_0x475602[_0xef29('0x17e')]||0x1388;}if(_0x475602[_0xef29('0x58')]==='outbound'){_0x127140['XMD-VOICEQUEUEID']=_0x1b7939['VoiceQueueId'];}else{_0x127140[_0xef29('0x17f')]=_0x1b7939[_0xef29('0xd4')];}for(var _0x2b4976 in _0x1b7939[_0xef29('0x180')]){if(typeof _0x1b7939['Contact'][_0x2b4976]!==_0xef29('0x96')){if(isNotNull(_0x1b7939[_0xef29('0x180')][_0x2b4976])&&_0x2b4976!=='id'&&_0x2b4976!==_0xef29('0x181')&&_0x2b4976!=='createdAt'&&_0x2b4976!==_0xef29('0x182')){_0x127140[util[_0xef29('0x7b')](_0xef29('0x183'),_0xef29('0x184'),_[_0xef29('0x185')](_0x2b4976))]=_0x1b7939[_0xef29('0x180')][_0x2b4976];}}}var _0xcce22e=_0x1cf3d2[_0xef29('0x186')](_0x475602[_0xef29('0x78')])?getCallerId(_0x475602['Trunk'][_0xef29('0x7a')],_0x475602[_0xef29('0x5f')],_0x475602[_0xef29('0x187')]>0x0?getCallerIdRandom(_0x475602[_0xef29('0x60')],_0x475602['dialRandomLastDigitCallerIdNumber']):_0x475602[_0xef29('0x60')]):getCallerId(_[_0xef29('0xab')](_0x475602[_0xef29('0x188')])?_0x475602[_0xef29('0x78')][_0xef29('0x7a')]:_0x475602[_0xef29('0x188')][_0xef29('0x7a')],_0x475602[_0xef29('0x5f')],_0x475602['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x475602[_0xef29('0x60')],_0x475602['dialRandomLastDigitCallerIdNumber']):_0x475602['dialOriginateCallerIdNumber']);if(_0xcce22e){_0x127140['XMD-ORIGINATECALLERIDNAME']=_0x1cf3d2['actions'][_0x3ea96e][_0xef29('0x189')]=extractCalleridName(_0xcce22e);_0x127140[_0xef29('0x18a')]=_0x1cf3d2[_0xef29('0x22')][_0x3ea96e][_0xef29('0x18b')]=extractCalleridNumber(_0xcce22e);}return ami[_0xef29('0x147')]({'actionid':_0x3ea96e,'action':_0xef29('0x168'),'channel':_0x1cf3d2['isTrunkReachable'](_0x475602[_0xef29('0x78')])?util[_0xef29('0x7b')](_0xef29('0x18c'),_0x475602[_0xef29('0x78')][_0xef29('0x3f')],isNotNull(_0x475602[_0xef29('0x61')])?_0x475602[_0xef29('0x61')]['trim']()||'':'',_0x475602[_0xef29('0x18d')]>0x0?_0x1b7939[_0xef29('0x180')]['phone'][_0xef29('0x18e')](_0x475602[_0xef29('0x18d')]):_0x1b7939[_0xef29('0x180')][_0xef29('0x16a')]):util[_0xef29('0x7b')](_0xef29('0x18c'),_[_0xef29('0xab')](_0x475602['TrunkBackup'])?_0x475602[_0xef29('0x78')][_0xef29('0x3f')]:_0x475602[_0xef29('0x188')][_0xef29('0x3f')],isNotNull(_0x475602['dialPrefix'])?_0x475602[_0xef29('0x61')]['trim']()||'':'',_0x475602[_0xef29('0x18d')]>0x0?_0x1b7939[_0xef29('0x180')]['phone'][_0xef29('0x18e')](_0x475602[_0xef29('0x18d')]):_0x1b7939[_0xef29('0x180')][_0xef29('0x16a')]),'callerid':_0xcce22e,'Exten':_0xef29('0xdb'),'Context':_0xef29('0x18f'),'Priority':'1','variable':_0x127140,'timeout':(_0x475602['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x3ea96e})['then'](function(_0x12aa92){return _0x59509f(_0x12aa92);})[_0xef29('0xae')](function(_0xed4e86){_0x475602[_0xef29('0x68')]+=0x1;var _0x3775c7=new History(_0x1cf3d2[_0xef29('0x22')][_0x3ea96e]);logger[_0xef29('0x92')](util[_0xef29('0x7b')](_0xef29('0x190'),JSON[_0xef29('0x48')](_0xed4e86)));_0x3775c7[_0xef29('0xa4')]=0xe;_0x3775c7[_0xef29('0xa5')]=_0xef29('0x191');_0x3775c7[_0xef29('0x118')]=moment()[_0xef29('0x7b')](_0xef29('0x101'));_0x3775c7['endtime']=_0x3775c7[_0xef29('0x118')];_0x1cf3d2[_0xef29('0xc7')](_0x3775c7)[_0xef29('0xae')](loggerCatch('[originate][error]'));_0x1cf3d2[_0xef29('0xc5')](_0x3775c7)[_0xef29('0xae')](loggerCatch(_0xef29('0x192')))['finally'](function(){delete _0x1cf3d2[_0xef29('0x22')][_0x3ea96e];return _0x3ee726(msgResponse('originate',_0xef29('0x47'),'originate\x20action\x20Error'));});});});};Dialer[_0xef29('0x19')][_0xef29('0x2e')]=function(_0x5105fe){var _0x5bd098=this[_0xef29('0x22')][_0x5105fe['actionid']];if(_0x5bd098){delete this[_0xef29('0x22')][_0x5105fe[_0xef29('0x121')]];_0x5bd098['responsetime']=moment()[_0xef29('0x7b')](_0xef29('0x101'));var _0x4dfa4d=_0x5bd098[_0xef29('0x58')]===_0xef29('0x7e')?this[_0xef29('0x1e')][_0x5bd098[_0xef29('0xb1')]]:this[_0xef29('0x1d')][_0x5bd098[_0xef29('0x193')]()];if(!this['isSuccess'](_0x5105fe[_0xef29('0x194')])){this[_0xef29('0xb0')](_0x4dfa4d);return this[_0xef29('0x195')](_0x5bd098,_0x4dfa4d,_0x5105fe)[_0xef29('0xae')](loggerCatch('[callProgressDetecting]\x20'));}this[_0xef29('0x23')][_0x5105fe[_0xef29('0xde')]]=_0x5bd098;}};Dialer['prototype'][_0xef29('0x196')]=function(_0x2fbaa4,_0x579a83,_0x455c15){var _0x2b7c3e=new History(_0x579a83);if(_0x2b7c3e[_0xef29('0xed')]+_0x2b7c3e['countcongestionretry']+_0x2b7c3e[_0xef29('0xef')]+_0x2b7c3e[_0xef29('0xf0')]+_0x2b7c3e[_0xef29('0xf1')]+_0x2b7c3e[_0xef29('0xf2')]+_0x2b7c3e[_0xef29('0xe9')]+_0x2b7c3e['countagentrejectretry']>=_0x455c15[_0xef29('0xf4')]-0x1){return!![];}switch(_0x2fbaa4){case 0x3:if(_0x2b7c3e['countnoanswerretry']>=_0x455c15[_0xef29('0x197')]-0x1){return!![];}this[_0xef29('0xbc')]({'active':![],'countnoanswerretry':_0x2b7c3e[_0xef29('0xef')]+=0x1,'scheduledat':moment()[_0xef29('0xf7')](_0x455c15[_0xef29('0x198')],'minutes')[_0xef29('0x7b')](_0xef29('0x101')),'ContactId':_0x2b7c3e[_0xef29('0xd0')],'ListId':_0x2b7c3e[_0xef29('0xd1')],'VoiceQueueId':_0x2b7c3e[_0xef29('0xd3')]||undefined,'CampaignId':_0x2b7c3e[_0xef29('0xd4')]||undefined})[_0xef29('0xae')](loggerCatch(_0xef29('0x199')));break;case 0x5:if(_0x2b7c3e[_0xef29('0xed')]>=_0x455c15['dialBusyMaxRetry']-0x1){return!![];}this[_0xef29('0xbc')]({'active':![],'countbusyretry':_0x2b7c3e[_0xef29('0xed')]+=0x1,'scheduledat':moment()['add'](_0x455c15[_0xef29('0x19a')],_0xef29('0xf9'))['format'](_0xef29('0x101')),'ContactId':_0x2b7c3e[_0xef29('0xd0')],'ListId':_0x2b7c3e[_0xef29('0xd1')],'VoiceQueueId':_0x2b7c3e[_0xef29('0xd3')]||undefined,'CampaignId':_0x2b7c3e[_0xef29('0xd4')]||undefined})[_0xef29('0xae')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x2b7c3e[_0xef29('0xee')]>=_0x455c15['dialCongestionMaxRetry']-0x1){return!![];}this[_0xef29('0xbc')]({'active':![],'countcongestionretry':_0x2b7c3e['countcongestionretry']+=0x1,'scheduledat':moment()[_0xef29('0xf7')](_0x455c15[_0xef29('0x19b')],_0xef29('0xf9'))['format'](_0xef29('0x101')),'ContactId':_0x2b7c3e[_0xef29('0xd0')],'ListId':_0x2b7c3e[_0xef29('0xd1')],'VoiceQueueId':_0x2b7c3e['VoiceQueueId']||undefined,'CampaignId':_0x2b7c3e[_0xef29('0xd4')]||undefined})[_0xef29('0xae')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x2b7c3e[_0xef29('0xf0')]>=_0x455c15['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0xef29('0xbc')]({'active':![],'countnosuchnumberretry':_0x2b7c3e['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0xef29('0xf7')](_0x455c15[_0xef29('0x19c')],_0xef29('0xf9'))[_0xef29('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2b7c3e[_0xef29('0xd0')],'ListId':_0x2b7c3e[_0xef29('0xd1')],'VoiceQueueId':_0x2b7c3e[_0xef29('0xd3')]||undefined,'CampaignId':_0x2b7c3e[_0xef29('0xd4')]||undefined})[_0xef29('0xae')](loggerCatch(_0xef29('0x19d')));}break;case 0xa:if(_0x2b7c3e['countdropretry']>=_0x455c15[_0xef29('0x19e')]-0x1){return!![];}this[_0xef29('0xbc')]({'active':![],'countdropretry':_0x2b7c3e[_0xef29('0xf1')]+=0x1,'scheduledat':moment()[_0xef29('0xf7')](_0x455c15[_0xef29('0x116')],'minutes')['format'](_0xef29('0x101')),'ContactId':_0x2b7c3e[_0xef29('0xd0')],'ListId':_0x2b7c3e['ListId'],'VoiceQueueId':_0x2b7c3e[_0xef29('0xd3')]||undefined,'CampaignId':_0x2b7c3e[_0xef29('0xd4')]||undefined})[_0xef29('0xae')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x2b7c3e[_0xef29('0xf2')]>=_0x455c15[_0xef29('0x11e')]-0x1){return!![];}this[_0xef29('0xbc')]({'active':![],'countabandonedretry':_0x2b7c3e['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x455c15[_0xef29('0x11f')],_0xef29('0xf9'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2b7c3e[_0xef29('0xd0')],'ListId':_0x2b7c3e[_0xef29('0xd1')],'VoiceQueueId':_0x2b7c3e[_0xef29('0xd3')]||undefined,'CampaignId':_0x2b7c3e['CampaignId']||undefined})[_0xef29('0xae')](loggerCatch(_0xef29('0x120')));break;case 0x13:if(_0x2b7c3e[_0xef29('0xe9')]>=_0x455c15[_0xef29('0xff')]-0x1){return!![];}this[_0xef29('0xbc')]({'active':![],'countmachineretry':_0x2b7c3e[_0xef29('0xe9')]+=0x1,'scheduledat':moment()['add'](_0x455c15['dialMachineRetryFrequency'],_0xef29('0xf9'))['format'](_0xef29('0x101')),'ContactId':_0x2b7c3e[_0xef29('0xd0')],'ListId':_0x2b7c3e['ListId'],'VoiceQueueId':_0x2b7c3e[_0xef29('0xd3')]||undefined,'CampaignId':_0x2b7c3e[_0xef29('0xd4')]||undefined})[_0xef29('0xae')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x2b7c3e[_0xef29('0xf3')]>=_0x455c15[_0xef29('0x19f')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x2b7c3e[_0xef29('0xf3')]+=0x1,'scheduledat':moment()[_0xef29('0xf7')](_0x455c15[_0xef29('0x1a0')],_0xef29('0xf9'))[_0xef29('0x7b')](_0xef29('0x101')),'ContactId':_0x2b7c3e[_0xef29('0xd0')],'ListId':_0x2b7c3e[_0xef29('0xd1')],'VoiceQueueId':_0x2b7c3e[_0xef29('0xd3')]||undefined,'CampaignId':_0x2b7c3e[_0xef29('0xd4')]||undefined})[_0xef29('0xae')](loggerCatch(_0xef29('0x1a1')));break;default:return!![];}};Dialer[_0xef29('0x19')][_0xef29('0x195')]=function(_0x1788c9,_0x18cf1a,_0x1cd920){var _0x41bd67=this;var _0x34c8f8=new History(_0x1788c9);return new BPromise(function(_0x2a3396,_0x111277){if(_[_0xef29('0x3c')](_0x18cf1a)&&typeof _0x18cf1a!==_0xef29('0x167')){return _0x111277(msgResponse(_0xef29('0x1a2'),_0xef29('0x13f'),_0xef29('0x1a3')));}if(_['isUndefined'](_0x1cd920)&&typeof _0x1cd920!==_0xef29('0x167')){return _0x111277(msgResponse(_0xef29('0x1a2'),_0xef29('0x13f'),_0xef29('0x1a4')));}switch(_0x1cd920[_0xef29('0x109')]){case'0':_0x18cf1a[_0xef29('0x67')]+=0x1;_0x34c8f8['state']=0x0;_0x34c8f8[_0xef29('0xa5')]=_0xef29('0x1a5');_0x34c8f8[_0xef29('0xf0')]+=0x1;_0x34c8f8[_0xef29('0xea')]+=0x1;ami[_0xef29('0x4c')]('custom:agentnosuchnumber',ut[_0xef29('0xeb')](_0x1788c9,_0xef29('0x1a6')));_0x41bd67[_0xef29('0xc7')](_0x34c8f8)['catch'](loggerCatch(_0xef29('0xec')));if(_0x41bd67[_0xef29('0x196')](0x0,_0x1788c9,_0x18cf1a)){if(_0x34c8f8['countnosuchnumberretry']>=_0x18cf1a['dialNoSuchNumberMaxRetry']){_0x41bd67[_0xef29('0xf6')](_0x34c8f8,_0x2a3396,_0x111277,_0xef29('0x1a7'));}else{_0x41bd67['stateGlobal'](_0x34c8f8,_0x2a3396,_0x111277,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x18cf1a['outboundNoAnswerCallsDay']+=0x1;_0x34c8f8['state']=0x3;_0x34c8f8[_0xef29('0xa5')]=_0xef29('0x1a8');_0x34c8f8[_0xef29('0xef')]+=0x1;_0x34c8f8['countglobal']+=0x1;ami[_0xef29('0x4c')](_0xef29('0x1a9'),ut[_0xef29('0xeb')](_0x1788c9,'noanswer'));_0x41bd67[_0xef29('0xc7')](_0x34c8f8)[_0xef29('0xae')](loggerCatch(_0xef29('0x1aa')));if(_0x41bd67[_0xef29('0x196')](0x3,_0x1788c9,_0x18cf1a)){if(_0x34c8f8[_0xef29('0xef')]>=_0x18cf1a[_0xef29('0x197')]){_0x41bd67[_0xef29('0xf6')](_0x34c8f8,_0x2a3396,_0x111277,'reason\x203\x20ringing\x20no\x20answer');}else{_0x41bd67[_0xef29('0xf5')](_0x34c8f8,_0x2a3396,_0x111277,_0xef29('0x1ab'));}}break;case'5':_0x18cf1a[_0xef29('0x63')]+=0x1;_0x34c8f8[_0xef29('0xa4')]=0x5;_0x34c8f8['statedesc']=_0xef29('0x1ac');_0x34c8f8['countbusyretry']+=0x1;_0x34c8f8[_0xef29('0xea')]+=0x1;ami[_0xef29('0x4c')]('custom:agentbusy',ut[_0xef29('0xeb')](_0x1788c9,_0xef29('0x1ad')));_0x41bd67[_0xef29('0xc7')](_0x34c8f8)[_0xef29('0xae')](loggerCatch(_0xef29('0x1ae')));if(_0x41bd67[_0xef29('0x196')](0x5,_0x1788c9,_0x18cf1a)){if(_0x34c8f8[_0xef29('0xed')]>=_0x18cf1a[_0xef29('0x1af')]){_0x41bd67[_0xef29('0xf6')](_0x34c8f8,_0x2a3396,_0x111277,'reason\x205\x20busy');}else{_0x41bd67['stateGlobal'](_0x34c8f8,_0x2a3396,_0x111277,_0xef29('0x1b0'));}}break;case'8':_0x18cf1a[_0xef29('0x64')]+=0x1;_0x34c8f8[_0xef29('0xa4')]=0x8;_0x34c8f8[_0xef29('0xa5')]=_0xef29('0x1b1');_0x34c8f8[_0xef29('0xee')]+=0x1;_0x34c8f8[_0xef29('0xea')]+=0x1;ami['emit'](_0xef29('0x1b2'),ut[_0xef29('0xeb')](_0x1788c9,_0xef29('0x1b3')));_0x41bd67[_0xef29('0xc7')](_0x34c8f8)[_0xef29('0xae')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x41bd67[_0xef29('0x196')](0x8,_0x1788c9,_0x18cf1a)){if(_0x34c8f8[_0xef29('0xee')]>=_0x18cf1a[_0xef29('0x1b4')]){_0x41bd67[_0xef29('0xf6')](_0x34c8f8,_0x2a3396,_0x111277,_0xef29('0x1b5'));}else{_0x41bd67[_0xef29('0xf5')](_0x34c8f8,_0x2a3396,_0x111277,_0xef29('0x1b5'));}}break;case'11':_0x18cf1a[_0xef29('0x1b6')]+=0x1;_0x34c8f8[_0xef29('0xa4')]=0xb;_0x34c8f8[_0xef29('0xa5')]=_0xef29('0x11c');_0x34c8f8[_0xef29('0xf2')]+=0x1;_0x34c8f8[_0xef29('0xea')]+=0x1;_0x41bd67[_0xef29('0xc7')](_0x34c8f8)[_0xef29('0xae')](loggerCatch(_0xef29('0x1b7')));if(_0x41bd67[_0xef29('0x196')](0xb,_0x1788c9,_0x18cf1a)){if(_0x34c8f8[_0xef29('0xf2')]>=_0x18cf1a['dialAbandonedMaxRetry']){_0x41bd67['createStateFinal'](_0x34c8f8,_0x2a3396,_0x111277,_0xef29('0x1b8'));}else{_0x41bd67[_0xef29('0xf5')](_0x34c8f8,_0x2a3396,_0x111277,_0xef29('0x1b8'));}}break;case'20':_0x18cf1a[_0xef29('0x1b9')]+=0x1;_0x34c8f8[_0xef29('0xa4')]=0x14;_0x34c8f8[_0xef29('0xa5')]=_0xef29('0x1ba');_0x34c8f8[_0xef29('0xf3')]+=0x1;_0x34c8f8[_0xef29('0xea')]+=0x1;ami[_0xef29('0x4c')](_0xef29('0x1bb'),ut[_0xef29('0xeb')](_0x1788c9,_0xef29('0x1bc')));_0x41bd67['createHistory'](_0x34c8f8)[_0xef29('0xae')](loggerCatch(_0xef29('0x1bd')));if(_0x41bd67[_0xef29('0x196')](0x14,_0x1788c9,_0x18cf1a)){if(_0x34c8f8[_0xef29('0xf3')]>=_0x18cf1a['dialAgentRejectMaxRetry']){_0x41bd67[_0xef29('0xf6')](_0x34c8f8,_0x2a3396,_0x111277,_0xef29('0x1be'));}else{_0x41bd67['stateGlobal'](_0x34c8f8,_0x2a3396,_0x111277,_0xef29('0x1be'));}}break;default:_0x18cf1a[_0xef29('0x69')]+=0x1;_0x34c8f8[_0xef29('0xa4')]=0xc;_0x34c8f8['statedesc']=_0x1cd920[_0xef29('0x109')];_0x41bd67[_0xef29('0xc7')](_0x34c8f8)[_0xef29('0xae')](loggerCatch(_0xef29('0x1bf')));if(_0x41bd67[_0xef29('0x196')](_0x1cd920[_0xef29('0x109')],_0x1788c9,_0x18cf1a)){if(_0x34c8f8[_0xef29('0xed')]+_0x34c8f8[_0xef29('0xee')]+_0x34c8f8[_0xef29('0xef')]+_0x34c8f8['countnosuchnumberretry']+_0x34c8f8['countdropretry']+_0x34c8f8[_0xef29('0xf2')]+_0x34c8f8[_0xef29('0xe9')]+_0x34c8f8[_0xef29('0xf3')]>=_0x18cf1a[_0xef29('0xf4')]){_0x41bd67['stateGlobal'](_0x34c8f8,_0x2a3396,_0x111277,_0x1cd920['reason']);}else{_0x41bd67[_0xef29('0xf6')](_0x34c8f8,_0x2a3396,_0x111277,_0x1cd920[_0xef29('0x109')]);}}}});};Dialer[_0xef29('0x19')][_0xef29('0xf5')]=function(_0x2d8577,_0x3e76ac,_0x66ffc1,_0x35ab62){var _0x23958d=new Final(_0x2d8577);_0x23958d[_0xef29('0xa4')]=0xf;_0x23958d[_0xef29('0xa5')]=_0xef29('0x1c0');this[_0xef29('0xf6')](_0x23958d,_0x3e76ac,_0x66ffc1,_0x35ab62);};Dialer[_0xef29('0x19')][_0xef29('0xf6')]=function(_0x356b6f,_0xf2b1ac,_0xf6cfac,_0x234c79){this[_0xef29('0xc5')](_0x356b6f)[_0xef29('0x3a')](function(){return _0xf2b1ac(msgResponse(_0xef29('0x1a2'),_0xef29('0xd6'),_0x234c79));})[_0xef29('0xae')](function(){return _0xf6cfac(msgResponse(_0xef29('0x1c1'),_0xef29('0x13f'),_0xef29('0x1c2')));});};Dialer[_0xef29('0x19')][_0xef29('0x157')]=function(_0x18c722){var _0x8383db=_0x18c722[_0xef29('0x1c3')]/0x64;var _0x577366=_0x18c722['outboundDropCallsDayTimeout']/(_0x18c722['outboundDropCallsDayTimeout']+_0x18c722[_0xef29('0xdf')]);var _0x16f518=Math[_0xef29('0x1c4')](_0x18c722[_0xef29('0x72')]*(_0x18c722[_0xef29('0x1c5')]/0x64));var _0x1211b5=Math[_0xef29('0x1c4')](_0x18c722[_0xef29('0x72')]*(_0x18c722[_0xef29('0x1c6')]/0x64));var _0xd9220=_0x18c722[_0xef29('0x50')]+_0x18c722['talking'];var _0x1ab0a9=Math[_0xef29('0x1c7')](_0x18c722['erlangCalls']*_0x18c722[_0xef29('0x76')]*_0x18c722[_0xef29('0x1c8')]*_0x18c722[_0xef29('0x1c9')]);if(_[_0xef29('0x3c')](_0x18c722[_0xef29('0x26')])){if(!_[_0xef29('0x3c')](_0x18c722[_0xef29('0x25')])){_0x18c722['startPredictive']=undefined;loggerPredictive[_0xef29('0x92')](_0xef29('0x1ca'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xef29('0x3c')](_0x18c722[_0xef29('0x8e')])){loggerPredictive['error'](_0xef29('0x1ca'),_0xef29('0x1cb'));clearInterval(_0x18c722[_0xef29('0x8e')]);_0x18c722['handlePredictive']=undefined;}_0x18c722[_0xef29('0x26')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xef29('0x80')](_0x18c722[_0xef29('0x3f')],_0xef29('0x1cc'),_0x18c722[_0xef29('0x26')]);this[_0xef29('0x156')](_0x18c722,0x1);}else if(ifInterval(_0x18c722[_0xef29('0x1cd')],_0x18c722[_0xef29('0x26')])){this[_0xef29('0x156')](_0x18c722,0x1);loggerPredictiveCalls[_0xef29('0x80')](_0xef29('0x1ce'),_0x18c722[_0xef29('0x26')],_0x18c722[_0xef29('0x3f')]);_0x18c722[_0xef29('0x74')]=0x0;_0x18c722[_0xef29('0x70')]=0x0;}else if(_0x8383db<_0x577366&&_0x18c722[_0xef29('0x1cf')]===_0xef29('0x1d0')){freeVariablesPredictive(_0x18c722);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0x577366,_0xef29('0x26'),_0x18c722[_0xef29('0x3f')]);}else if(_0x1ab0a9<_0x18c722[_0xef29('0x70')]&&_0x18c722[_0xef29('0x1cf')]===_0xef29('0x1d0')){freeVariablesPredictive(_0x18c722);loggerPredictive[_0xef29('0x80')](_0xef29('0x1d1'),_0xef29('0x1d2'),_0x1ab0a9,'Drop\x20in\x20this\x20interval',_0x18c722[_0xef29('0x70')],_0xef29('0x26'),_0x18c722[_0xef29('0x3f')]);}else if(!ifInterval(_0x18c722[_0xef29('0x1cd')],_0x18c722[_0xef29('0x26')])&&_[_0xef29('0x3c')](_0x18c722[_0xef29('0x25')])&&!_[_0xef29('0x3c')](_0x18c722[_0xef29('0x26')])){_0x18c722[_0xef29('0x25')]=moment()[_0xef29('0x7b')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xef29('0x80')](_0x18c722[_0xef29('0x3f')],_0xef29('0x1d3'),_0x18c722[_0xef29('0x25')]);this[_0xef29('0xba')](_0x18c722['dialPredictiveInterval'])['then'](this[_0xef29('0x1d4')](_0x18c722))[_0xef29('0x3a')](mergeDataErlangB(_0x18c722))[_0xef29('0x3a')](this[_0xef29('0x1d5')](_0x18c722))[_0xef29('0xae')](loggerCatchPredictive(_0xef29('0x1d6'),_0x18c722));}else if(!ifInterval(_0x18c722[_0xef29('0x1cd')],_0x18c722[_0xef29('0x25')])){_0x18c722['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x18c722[_0xef29('0x25')]=moment()['format'](_0xef29('0x101'));loggerPredictive[_0xef29('0x80')](_0x18c722[_0xef29('0x3f')],_0xef29('0x1d7'),_0x18c722[_0xef29('0x25')]);clearInterval(_0x18c722[_0xef29('0x8e')]);_0x18c722[_0xef29('0x8e')]=undefined;this[_0xef29('0xba')](_0x18c722[_0xef29('0x1cd')])[_0xef29('0x3a')](this[_0xef29('0x1d4')](_0x18c722))['then'](mergeDataErlangB(_0x18c722))['then'](this[_0xef29('0x1d5')](_0x18c722))[_0xef29('0xae')](loggerCatchPredictive(_0xef29('0x1d8'),_0x18c722));}else if(_0x18c722['predictiveIntervalAvailable']&&_0xd9220<_0x18c722['predictiveIntervalAvailable']-_0x1211b5){freeVariablesPredictive(_0x18c722);loggerPredictive[_0xef29('0x80')](_0x18c722[_0xef29('0x3f')],_0xef29('0x1d9'),_0xd9220,_0xef29('0x1da'),_0x18c722[_0xef29('0x72')],'-',_0x1211b5,'=',_0x18c722[_0xef29('0x72')]-_0x1211b5,')');}else if(_0x18c722[_0xef29('0x72')]&&_0xd9220>_0x18c722[_0xef29('0x72')]+_0x16f518){freeVariablesPredictive(_0x18c722);loggerPredictive['info'](_0x18c722[_0xef29('0x3f')],_0xef29('0x1d9'),_0xd9220,_0xef29('0x1db'),_0x18c722[_0xef29('0x72')],'+',_0x16f518,'=',_0x18c722[_0xef29('0x72')]+_0x16f518,')');}};Dialer[_0xef29('0x19')][_0xef29('0x1d4')]=function(_0x2b4a1a){var _0x119684=this;return function(_0x372114){return new BPromise(function(_0x2ec943,_0x3452c2){_['merge'](_0x2b4a1a,_0x372114[0x0]);if(checkGetDataPredictive(_0x372114[0x0])){var _0x36f993=_0x2b4a1a[_0xef29('0x72')]=_0x2b4a1a[_0xef29('0x56')]+_0x2b4a1a[_0xef29('0x50')];var _0x560b1b=_0x2b4a1a[_0xef29('0x1cd')]*0x3c;var _0x847e83=_0x372114[0x0][_0xef29('0x6c')]+_0x372114[0x0]['predictiveIntervalAvgHoldtime'];var _0x380919=(_0x372114[0x0][_0xef29('0x6a')]+_0x372114[0x0][_0xef29('0x6e')]+_0x372114[0x0][_0xef29('0x6d')])/_0x372114[0x0][_0xef29('0x73')];_0x2b4a1a[_0xef29('0x1c8')]=_0x380919>0x0?_0x380919:0x1;switch(_0x2b4a1a[_0xef29('0x1cf')]){case _0xef29('0x1d0'):var _0x55e2de=_0x2b4a1a[_0xef29('0x1c3')]/0x64;return _0x119684['abandonmentRate'](_0x36f993,_0x560b1b,_0x847e83,_0x380919,_0x55e2de)[_0xef29('0x3a')](function(_0x8a133a){return _0x2ec943(_0x8a133a);});case'agentBusyFactor':var _0x342435=_0x2b4a1a[_0xef29('0x1c3')]/0x64;return _0x119684[_0xef29('0x1dc')](_0x36f993,_0x560b1b,_0x847e83,_0x380919,_0x342435)[_0xef29('0x3a')](function(_0x16f549){return _0x2ec943(_0x16f549);});default:return _0x3452c2(msgResponse('[getDataPredictive]','Failure','Unknown\x20Predictive'));}}else{return _0x3452c2(msgResponse('[getDataPredictive]',_0xef29('0x13f'),_0xef29('0x1dd')));}});};};Dialer[_0xef29('0x19')][_0xef29('0x1de')]=function(_0x5c08f9){var _0x2b6a39=this;return function(_0x3c0ea0){return new BPromise(function(_0x266ad7,_0x40dd05){_['merge'](_0x5c08f9,_0x3c0ea0[0x0]);if(checkGetDataPredictive(_0x3c0ea0[0x0])){loggerPredictive['info'](JSON[_0xef29('0x48')](_0x3c0ea0[0x0]));if(_0x5c08f9[_0xef29('0x1cf')]===_0xef29('0x1d0')){return _0x2b6a39['getVoiceQueueRtPauses'](_0x5c08f9['id'])[_0xef29('0x3a')](function(_0x182a7f){var _0xddb249=_0x5c08f9[_0xef29('0x51')]-_0x182a7f[0x0][_0xef29('0x1df')];var _0xb7a788=_0x5c08f9[_0xef29('0x1cd')]*0x3c;var _0x30defa=_0x3c0ea0[0x0][_0xef29('0x6c')]+_0x3c0ea0[0x0][_0xef29('0x6b')];var _0x4dcb3c=(_0x3c0ea0[0x0]['predictiveIntervalAnsweredCalls']+_0x3c0ea0[0x0][_0xef29('0x6e')]+_0x3c0ea0[0x0][_0xef29('0x6d')])/_0x3c0ea0[0x0][_0xef29('0x73')];var _0x2ed4d2=_0x5c08f9[_0xef29('0x1c3')]/0x64;_0x5c08f9[_0xef29('0x71')]=_0x182a7f[0x0][_0xef29('0x1df')]||0x0;_0x5c08f9[_0xef29('0x1c8')]=_0x4dcb3c>0x0?_0x4dcb3c:0x1;return _0x2b6a39['abandonmentRate'](_0xddb249,_0xb7a788,_0x30defa,_0x4dcb3c,_0x2ed4d2);})[_0xef29('0x3a')](function(_0x524322){return _0x266ad7(_0x524322);})[_0xef29('0xae')](function(_0x20c8ba){return _0x40dd05(msgResponse(_0xef29('0x1e0'),_0xef29('0x13f'),JSON[_0xef29('0x48')](_0x20c8ba)));});}if(_0x5c08f9[_0xef29('0x1cf')]==='agentBusyFactor'){return _0x2b6a39['getVoiceQueueRtPauses'](_0x5c08f9['id'])[_0xef29('0x3a')](function(_0x5cc3b7){var _0x167d98=_0x5c08f9[_0xef29('0x51')]-_0x5cc3b7[0x0][_0xef29('0x1df')];var _0x4e1eb4=_0x5c08f9['dialPredictiveInterval']*0x3c;var _0x3d44f5=_0x3c0ea0[0x0][_0xef29('0x6c')]+_0x3c0ea0[0x0][_0xef29('0x6b')];var _0xb9f802=(_0x3c0ea0[0x0][_0xef29('0x6a')]+_0x3c0ea0[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x3c0ea0[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x3c0ea0[0x0][_0xef29('0x73')];var _0x4ba9d5=_0x5c08f9[_0xef29('0x1c3')]/0x64;_0x5c08f9[_0xef29('0x71')]=_0x5cc3b7[0x0][_0xef29('0x1df')]||0x0;_0x5c08f9[_0xef29('0x1c8')]=_0xb9f802>0x0?_0xb9f802:0x1;return _0x2b6a39[_0xef29('0x1dc')](_0x167d98,_0x4e1eb4,_0x3d44f5,_0xb9f802,_0x4ba9d5);})[_0xef29('0x3a')](function(_0x3cbda9){return _0x266ad7(_0x3cbda9);})['catch'](function(_0x35489d){return _0x40dd05(msgResponse('[CatchErlangB]','Failure',JSON[_0xef29('0x48')](_0x35489d)));});}}else{return _0x40dd05(msgResponse(_0xef29('0x1e1'),_0xef29('0x13f'),_0xef29('0x1dd')));}});};};Dialer['prototype'][_0xef29('0x1d5')]=function(_0xd604e){var _0x70b255=this;return function(){var _0x32538a=0x0;var _0x16fe88=Math[_0xef29('0x1c7')](_0xd604e[_0xef29('0x75')]*0x3e8);if(_0x16fe88>0x0){_0x16fe88=_0x16fe88<0x64?0x64:_0x16fe88;loggerPredictive[_0xef29('0x80')](_0xd604e['name'],_0xef29('0x1e2'),_0x16fe88,'milliseconds');_0xd604e[_0xef29('0x8e')]=setInterval(function(){_0x70b255[_0xef29('0x8e')](_0xd604e);loggerPredictiveCalls[_0xef29('0x80')]('[handlePredictive]',_0x32538a+=0x1);},_0x16fe88);}else{loggerPredictive[_0xef29('0x80')](_0xd604e[_0xef29('0x3f')],_0xef29('0x1e3'));}};};Dialer[_0xef29('0x19')][_0xef29('0x1e4')]=function(_0x3bfe8f,_0x291629){var _0x527103=this;return function(_0x2bec52){if(_['isEmpty'](_0x2bec52)){if(_[_0xef29('0xab')](_0x291629['UserId'])||!_0x291629[_0xef29('0x1e5')]){if(_0x3bfe8f[_0xef29('0x5e')]===_0xef29('0x7')){_0x3bfe8f[_0xef29('0x127')]=_[_0xef29('0x3c')](_0x3bfe8f['queueStatusComplete'])?!![]:_0x3bfe8f[_0xef29('0x127')];var _0x490a26=uuid['v4']();_0x527103['actions'][_0x490a26]=new Action(_0x3bfe8f,_0x291629,_0x490a26);loggerBooked[_0xef29('0x80')](_0xef29('0x1e6'),_0x490a26,_0xef29('0x1e7'),JSON[_0xef29('0x48')](_0x3bfe8f[_0xef29('0x127')]),_0xef29('0x1e8'),_0x3bfe8f[_0xef29('0x3f')]);if(_0x3bfe8f[_0xef29('0x127')]){_0x3bfe8f[_0xef29('0x127')]=![];_0x527103[_0xef29('0x27')][_0x527103[_0xef29('0x22')][_0x490a26]['queue']]=[];ami[_0xef29('0x147')]({'actionid':_0x490a26,'action':'queuestatus','queue':_0x3bfe8f[_0xef29('0x3f')]})[_0xef29('0xae')](function(){_0x527103[_0xef29('0xb0')](_0x3bfe8f);_0x527103['rescheduleContact']({'active':![],'ContactId':_0x527103[_0xef29('0x22')][_0x490a26]['ContactId'],'ListId':_0x527103[_0xef29('0x22')][_0x490a26][_0xef29('0xd1')],'VoiceQueueId':_0x527103['actions'][_0x490a26]['VoiceQueueId']||undefined,'CampaignId':_0x527103['actions'][_0x490a26][_0xef29('0xd4')]||undefined})['catch'](loggerCatch(_0xef29('0x1e9')));delete _0x527103['actions'][_0x490a26];});}else{loggerBooked[_0xef29('0x80')](_0xef29('0x1ea'),JSON[_0xef29('0x48')](_0x3bfe8f[_0xef29('0x127')]),_0xef29('0x1e8'),_0x3bfe8f[_0xef29('0x3f')]);_0x527103[_0xef29('0xb0')](_0x3bfe8f);_0x527103[_0xef29('0xbc')]({'active':![],'ContactId':_0x527103[_0xef29('0x22')][_0x490a26][_0xef29('0xd0')],'ListId':_0x527103['actions'][_0x490a26][_0xef29('0xd1')],'VoiceQueueId':_0x527103[_0xef29('0x22')][_0x490a26][_0xef29('0xd3')]||undefined,'CampaignId':_0x527103[_0xef29('0x22')][_0x490a26][_0xef29('0xd4')]||undefined})['catch'](loggerCatch(_0xef29('0x1e9')));delete _0x527103[_0xef29('0x22')][_0x490a26];}}else{return _0x527103[_0xef29('0x166')](_0x3bfe8f,_0x291629);}}else{if(getDiff(_0x291629[_0xef29('0x1eb')])<_0x3bfe8f[_0xef29('0x1ec')]*0x3c){if(_0x291629[_0xef29('0x1ed')]&&!_0x291629[_0xef29('0x1ed')][_0xef29('0x1ee')]){_0x527103[_0xef29('0x1c')]['run'](_0x291629['id'])['finally'](function(){_0x527103[_0xef29('0xb0')](_0x3bfe8f);});}else{_0x527103['unlockContact']({'active':![]},_0x291629['id'],0x1)[_0xef29('0x12b')](function(){_0x527103[_0xef29('0xb0')](_0x3bfe8f);});}}else{_0x3bfe8f['outboundReCallsDay']+=0x1;_0x527103[_0xef29('0xb0')](_0x3bfe8f);if(_0x3bfe8f[_0xef29('0x1ef')]){_0x527103[_0xef29('0xbc')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x291629['ContactId'],'ListId':_0x291629['ListId'],'VoiceQueueId':_0x291629['VoiceQueueId']||undefined,'CampaignId':_0x291629[_0xef29('0xd4')]||undefined})[_0xef29('0xae')](loggerCatch(_0xef29('0x1f0')));_0x527103[_0xef29('0xc7')](createObjHistory(_0x3bfe8f,_0x291629,_0xef29('0x1f1'),0x17,'RecallInQueue'))[_0xef29('0xae')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x527103[_0xef29('0xce')](createObjHistory(_0x3bfe8f,_0x291629,'RECALLFAILEDTIMEOUT',0x16,_0xef29('0x1f2')),_0xef29('0x1f3'),_0xef29('0x1f4'));}}}}else{_0x3bfe8f[_0xef29('0x1f5')]+=0x1;_0x527103[_0xef29('0xce')](createObjHistory(_0x3bfe8f,_0x291629,_0xef29('0x1f6'),0xd,_0xef29('0x1f7')),_0xef29('0x1f8'),_0xef29('0x1f9'));throw _0xef29('0x1fa');}};};Dialer[_0xef29('0x19')]['handleIvr']=function(_0x23e2ee){var _0x2f7032=this;var _0x120dca=_0x23e2ee[_0xef29('0x1fb')]-_0x23e2ee['originated']-_0x23e2ee[_0xef29('0xc1')];emitCampaignSummary(_0x23e2ee);if(_0x120dca>0x0){if(_0x120dca>this[_0xef29('0x20')]){_0x120dca=this[_0xef29('0x20')];}_0x23e2ee[_0xef29('0xc1')]+=_0x120dca;this[_0xef29('0x1fc')](_0x23e2ee['id'],_0x120dca,_0x23e2ee[_0xef29('0x1fd')],_0x23e2ee)[_0xef29('0x3a')](function(_0x5311e6){_0x23e2ee[_0xef29('0xc1')]-=_0x120dca;_0x23e2ee[_0xef29('0xc1')]=_0x23e2ee[_0xef29('0xc1')]>0x0?_0x23e2ee[_0xef29('0xc1')]:0x0;if(!checkContactEmpty(_0x5311e6)){_0x23e2ee[_0xef29('0x3d')]=_0xef29('0x9d');logger['info']('[getContactCampaign2][Empty]'+_0x23e2ee['name']);}else{_0x23e2ee[_0xef29('0x95')]+=_0x5311e6[_0xef29('0x12e')];_0x23e2ee[_0xef29('0x3d')]='RUNNING';for(var _0x175d20=0x0;_0x175d20<_0x5311e6[_0xef29('0x12e')];_0x175d20+=0x1){_0x23e2ee['ivrTotalCallsDays']+=0x1;if(_[_0xef29('0xab')](_0x5311e6[_0x175d20])||_[_0xef29('0xab')](_0x5311e6[_0x175d20][_0xef29('0x180')])||_['isNil'](_0x5311e6[_0x175d20]['Contact']['phone'])){_0x2f7032['emptyContact'](_0xef29('0x1fe'),_0x23e2ee,_0x5311e6[_0x175d20]);}else{_0x2f7032[_0xef29('0xb8')](_[_0xef29('0xcf')](_0x5311e6[_0x175d20],['CampaignId','Contact.phone']))['then'](_0x2f7032[_0xef29('0x1e4')](_0x23e2ee,_0x5311e6[_0x175d20]))[_0xef29('0xae')](_0x2f7032[_0xef29('0xcb')]('[actionOriginateIvr]\x20',_0x23e2ee));}}}})[_0xef29('0xae')](loggerGetContactDialer(_0xef29('0x1ff'),_0x23e2ee,_0x120dca));}};Dialer[_0xef29('0x19')][_0xef29('0x156')]=function(_0x43ff8e,_0x40e858){var _0x4bae46=this;var _0x2fe774=[];var _0x9364c0=_0x40e858>=0x1?_0x40e858:0x1;if(_0x43ff8e[_0xef29('0x5e')]===_0xef29('0x7')){_0x9364c0=0x1;}var _0x17674b=Math[_0xef29('0x1c7')](_0x43ff8e['available']*_0x9364c0)-_0x43ff8e['originated']-_0x43ff8e[_0xef29('0xc1')];emitVoiceQueueSummary(_0x43ff8e);if(_0x43ff8e[_0xef29('0x200')]>0x0){var _0x36834d=_0x43ff8e[_0xef29('0x200')]-_0x43ff8e[_0xef29('0x95')]-_0x43ff8e[_0xef29('0x56')]-_0x43ff8e[_0xef29('0xc1')]-_0x43ff8e[_0xef29('0x52')];if(_0x17674b>_0x36834d){_0x17674b=_0x36834d;}}if(_0x17674b>0x0){if(_0x43ff8e[_0xef29('0x5e')]===_0xef29('0x7')){_0x17674b=0x1;}if(_0x17674b>this[_0xef29('0x20')]){_0x17674b=this[_0xef29('0x20')];}_0x43ff8e[_0xef29('0xc1')]+=_0x17674b;for(var _0x33579a in this[_0xef29('0x1f')]){if(typeof this[_0xef29('0x1f')][_0x33579a]!==_0xef29('0x96')){if(this[_0xef29('0x1f')][_0x33579a][_0xef29('0xa4')]===_0xef29('0x201')&&this['agents'][_0x33579a][_0xef29('0xac')]===_0xef29('0x202')){_0x2fe774[_0xef29('0x146')](this[_0xef29('0x1f')][_0x33579a]['id']);}}}this[_0xef29('0xc0')](_0x43ff8e['id'],_0x2fe774,_0x17674b,_0x43ff8e[_0xef29('0x1fd')],_0x43ff8e)[_0xef29('0x3a')](function(_0x572932){_0x43ff8e[_0xef29('0xc1')]-=_0x17674b;_0x43ff8e['temp']=_0x43ff8e[_0xef29('0xc1')]>0x0?_0x43ff8e['temp']:0x0;if(!checkContactEmpty(_0x572932)){_0x4bae46[_0xef29('0xb4')](_0x43ff8e)[_0xef29('0x3a')](sendMessageReschedule(_0x43ff8e))[_0xef29('0xae')](loggerCatch(_0xef29('0x203')));}else{_0x43ff8e[_0xef29('0x95')]+=_0x572932[_0xef29('0x12e')];_0x43ff8e[_0xef29('0x3d')]=_0x43ff8e['dialMethod']===_0xef29('0x7')?_0xef29('0x16f'):_0xef29('0x204');for(var _0x1e1f2e=0x0;_0x1e1f2e<_0x572932[_0xef29('0x12e')];_0x1e1f2e+=0x1){if(_[_0xef29('0xab')](_0x572932[_0x1e1f2e])||_['isNil'](_0x572932[_0x1e1f2e][_0xef29('0x180')])||_[_0xef29('0xab')](_0x572932[_0x1e1f2e]['Contact']['phone'])){_0x4bae46['emptyContact'](_0xef29('0x1fe'),_0x43ff8e,_0x572932[_0x1e1f2e]);}else{_0x4bae46[_0xef29('0xb6')](_['pick'](_0x572932[_0x1e1f2e],[_0xef29('0xd3'),_0xef29('0x205')]))['then'](_0x4bae46['checkContactBlack'](_0x43ff8e,_0x572932[_0x1e1f2e]))['catch'](_0x4bae46[_0xef29('0xcb')](_0xef29('0x1fe'),_0x43ff8e));}}}})[_0xef29('0xae')](loggerGetContactDialer(_0xef29('0x206'),_0x43ff8e,_0x17674b));}};Dialer[_0xef29('0x19')][_0xef29('0x8e')]=function(_0x1c34de){if(_0x1c34de[_0xef29('0x200')]>0x0){var _0x19e8fe=_0x1c34de[_0xef29('0x200')]-_0x1c34de['originated']-_0x1c34de[_0xef29('0x56')];if(_0x19e8fe>0x0){this['tryOriginatePredictive'](_0x1c34de);}else{loggerPredictiveCalls['info'](_0xef29('0x207'));}}else{this[_0xef29('0x208')](_0x1c34de);}};Dialer[_0xef29('0x19')][_0xef29('0x208')]=function(_0x36ffdd){var _0x1653fd=this;var _0x3619ce=[];_0x36ffdd[_0xef29('0x95')]+=0x1;for(var _0x4fd35b in this['agents']){if(typeof this['agents'][_0x4fd35b]!=='undefined'){if(this['agents'][_0x4fd35b]['state']===_0xef29('0x201')&&this['agents'][_0x4fd35b][_0xef29('0xac')]===_0xef29('0x202')){_0x3619ce['push'](this[_0xef29('0x1f')][_0x4fd35b]['id']);}}}this['getContactDialer'](_0x36ffdd['id'],_0x3619ce,0x1,_0x36ffdd[_0xef29('0x1fd')],_0x36ffdd)[_0xef29('0x3a')](function(_0x470280){if(!checkContactEmpty(_0x470280)){checkContactLowerLimitOriginate(_0x36ffdd,0x1,0x0);_0x1653fd[_0xef29('0xb4')](_0x36ffdd)[_0xef29('0x3a')](sendMessageReschedule(_0x36ffdd))[_0xef29('0xae')](loggerCatch(_0xef29('0x203')));}else{_0x36ffdd[_0xef29('0x3d')]=_0xef29('0x204');if(_['isNil'](_0x470280[0x0])||_[_0xef29('0xab')](_0x470280[0x0][_0xef29('0x180')])||_['isNil'](_0x470280[0x0]['Contact']['phone'])){_0x1653fd['emptyContact']('[actionOriginate]\x20',_0x36ffdd,_0x470280[0x0]);}else{_0x1653fd['checkIsBlackList'](_[_0xef29('0xcf')](_0x470280[0x0],[_0xef29('0xd3'),'Contact.phone']))['then'](_0x1653fd[_0xef29('0x1e4')](_0x36ffdd,_0x470280[0x0]))[_0xef29('0xae')](_0x1653fd[_0xef29('0xcb')](_0xef29('0x209'),_0x36ffdd));}}})[_0xef29('0xae')](loggerGetContactDialer(_0xef29('0x20a'),_0x36ffdd,0x1));emitVoiceQueueSummary(_0x36ffdd);};Dialer['prototype']['abandonmentRate']=function(_0x298046,_0xe5ab0a,_0x1567f4,_0x3a3866,_0x590da1,_0x3ac90b){loggerPredictive[_0xef29('0x80')](_0xef29('0x20b'));loggerPredictive[_0xef29('0x80')](_0xef29('0x20c'),_0x298046);loggerPredictive[_0xef29('0x80')](_0xef29('0x20d'),_0xe5ab0a);loggerPredictive['info']('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1567f4);loggerPredictive[_0xef29('0x80')]('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3a3866);loggerPredictive[_0xef29('0x80')](_0xef29('0x20e'),_0x590da1);loggerPredictive[_0xef29('0x80')]('---------------------------');return new BPromise(function(_0x18b7be,_0x26ae99){if(_0x298046<=0x0||isNaN(_0x298046)){return _0x26ae99(msgResponse(_0xef29('0x20f'),_0xef29('0x47'),_0xef29('0x210')+_0x298046));}if(_0x1567f4<=0x0||isNaN(_0x1567f4)){return _0x26ae99(msgResponse(_0xef29('0x20f'),_0xef29('0x47'),_0xef29('0x211')+_0x1567f4));}if(_0x3a3866<=0x0||isNaN(_0x3a3866)){return _0x26ae99(msgResponse('[abandonmentRate]','Error',_0xef29('0x212')+_0x3a3866));}if(_0xe5ab0a<=0x0||isNaN(_0xe5ab0a)){return _0x26ae99(msgResponse(_0xef29('0x20f'),_0xef29('0x47'),_0xef29('0x213')+_0xe5ab0a));}if(_0x590da1<=0x0||isNaN(_0x590da1)){return _0x26ae99(msgResponse('[abandonmentRate]',_0xef29('0x47'),'Amax\x20=\x20'+_0x590da1));}_0x3ac90b=_0x3ac90b||0x0;var _0x20e11b=0x1/_0x1567f4;var _0x3f853d=0x0;var _0x51a982=0x0;var _0x4fd5eb=0x0;var _0x485e32=0x0;for(var _0x1fe139=0x0;_0x4fd5eb<_0x590da1;_0x1fe139+=0x1){_0x51a982=_0x1fe139/_0xe5ab0a;_0x3f853d=(_0x3a3866*_0x51a982+_0x3ac90b)/_0x20e11b;_0x4fd5eb=erlangb(_0x3f853d,_0x298046);_0x485e32=_0x3f853d/_0x298046*(0x1-erlangb(_0x3f853d,_0x298046));}return _0x18b7be({'erlangCalls':_0x1fe139,'erlangCallToSecond':_0xe5ab0a/_0x1fe139,'erlangAbandonmentRate':_0x4fd5eb,'erlangBusyFactor':_0x485e32});});};Dialer[_0xef29('0x19')]['busyFactor']=function(_0x1e8bca,_0x165d4a,_0x424ff8,_0x402b0f,_0x1ab562,_0x1c1877){loggerPredictive[_0xef29('0x80')](_0xef29('0x214'));loggerPredictive[_0xef29('0x80')](_0xef29('0x20c'),_0x1e8bca);loggerPredictive[_0xef29('0x80')](_0xef29('0x20d'),_0x165d4a);loggerPredictive['info']('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x424ff8);loggerPredictive['info'](_0xef29('0x215'),_0x402b0f);loggerPredictive['info'](_0xef29('0x216'),_0x1ab562);loggerPredictive[_0xef29('0x80')]('---------------------------');return new BPromise(function(_0x3c5453,_0x1ab5a9){if(_0x1e8bca<=0x0||isNaN(_0x1e8bca)){return _0x1ab5a9(msgResponse(_0xef29('0x217'),_0xef29('0x47'),'m\x20=\x20'+_0x1e8bca));}if(_0x424ff8<=0x0||isNaN(_0x424ff8)){return _0x1ab5a9(msgResponse(_0xef29('0x217'),'Error',_0xef29('0x211')+_0x424ff8));}if(_0x402b0f<=0x0||isNaN(_0x402b0f)){return _0x1ab5a9(msgResponse('[busyFactor]',_0xef29('0x47'),_0xef29('0x212')+_0x402b0f));}if(_0x165d4a<=0x0||isNaN(_0x165d4a)){return _0x1ab5a9(msgResponse(_0xef29('0x217'),'Error',_0xef29('0x213')+_0x165d4a));}if(_0x1ab562<=0x0||isNaN(_0x1ab562)){return _0x1ab5a9(msgResponse(_0xef29('0x217'),_0xef29('0x47'),_0xef29('0x218')+_0x1ab562));}_0x1c1877=_0x1c1877||0x0;var _0x255277=0x1/_0x424ff8;var _0xb9debe=0x0;var _0x2df301=0x0;var _0x291e15=0x0;var _0x5e0082=0x0;for(var _0x13150b=0x0;_0x5e0082<_0x1ab562;_0x13150b+=0x1){_0x2df301=_0x13150b/_0x165d4a;_0xb9debe=(_0x402b0f*_0x2df301+_0x1c1877)/_0x255277;_0x291e15=erlangb(_0xb9debe,_0x1e8bca);_0x5e0082=_0xb9debe/_0x1e8bca*(0x1-erlangb(_0xb9debe,_0x1e8bca));}return _0x3c5453({'erlangCalls':_0x13150b,'erlangCallToSecond':_0x165d4a/_0x13150b,'erlangAbandonmentRate':_0x291e15,'erlangBusyFactor':_0x5e0082});});};module[_0xef29('0x219')]=Dialer; \ No newline at end of file +var _0xb0b2=['object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','callerid','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','isSuccess','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','Abandoned','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','outboundRejectCallsDay','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','Success','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','[getDataPredictive]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','limitCalls','[getContactCampaign2][Empty]','[actionOriginate]\x20','Contact.phone','[getContactCampaign2]','dialLimitQueue','pTalking','not_inuse','reachable','dialOrderByScheduledAt','RUNNING','tryOriginatePredictive','[handlePredictive][limitChannel]','[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','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','[abandonmentRate]','Error','m\x20=\x20','p\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','md5','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopperHistory','../rpc/setting','./action','./history','./queueCallerAbandon','./hangup','env','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','getSettings','then','previewRecallmeReminderInterval','isUndefined','message','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','name','\x20NOT\x20Active','INTERVAL_IS_NULL','Interval','Intervals','\x20INTERVAL_IS_NULL','milliseconds','diff','seconds','emit','type','strategy','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangAbandonmentRate','erlangBusyFactor','Trunk','stringify','format','voice:queue:%s','ivr','campaign:ivr:%s','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','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','outbound','preview','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','starttime','loopClearZombieChannels','clearZombieChannels','uniqueId','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','resolve','countReScheduled','[countReScheduled]\x20','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','UserId','CampaignId','[emptyContact]','isTrunkReachable','active','unmonitored','uniqueid','variable','amdstatus','xcally-motion-dialer','value','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','statedesc','HangupInAMD','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','membername','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','add','minutes','YYYY-MM-DD\x20HH:mm:ss','ContactId','VoiceQueueId','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countcongestionretry','countagentrejectretry','stateGlobal','createStateFinal','ListId','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr]','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','responsetime','dialQueueTimeout','Drop','dropreason','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','endtime','calleridname','calleridnum','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','actionid','locked','paused','stateinterface','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','Agent:\x20','idHopper','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','content','indexOf','true','push','all','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','checkDialMethod','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:%s','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','[syncCampaigns]','pow','replace','match','actionOriginate'];(function(_0x213c77,_0x457643){var _0x4e0882=function(_0x1f100b){while(--_0x1f100b){_0x213c77['push'](_0x213c77['shift']());}};_0x4e0882(++_0x457643);}(_0xb0b2,0xbb));var _0x2b0b=function(_0x504a81,_0x43735b){_0x504a81=_0x504a81-0x0;var _0x1e380c=_0xb0b2[_0x504a81];return _0x1e380c;};'use strict';var util=require(_0x2b0b('0x0'));var _=require(_0x2b0b('0x1'));var BPromise=require(_0x2b0b('0x2'));var uuid=require(_0x2b0b('0x3'));var moment=require(_0x2b0b('0x4'));var rr=require('rr');var md5=require(_0x2b0b('0x5'));var Redis=require('ioredis');var ut=require(_0x2b0b('0x6'));var config=require(_0x2b0b('0x7'));var logger=require(_0x2b0b('0x8'))(_0x2b0b('0x9'));var loggerBooked=require('../../../config/logger')(_0x2b0b('0xa'));var loggerPredictive=require(_0x2b0b('0x8'))(_0x2b0b('0xb'));var loggerPredictiveCalls=require(_0x2b0b('0x8'))(_0x2b0b('0xc'));var loggerSyncQueueSummary=require(_0x2b0b('0x8'))(_0x2b0b('0xd'));var ami=require(_0x2b0b('0xe'));config[_0x2b0b('0xf')]=_[_0x2b0b('0x10')](config[_0x2b0b('0xf')],{'host':_0x2b0b('0x11'),'port':0x18eb});var io=require(_0x2b0b('0x12'))(new Redis(config['redis']));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x2b0b('0x13'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x2b0b('0x14'));var Action=require(_0x2b0b('0x15'));var History=require(_0x2b0b('0x16'));var Final=require('./final');var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x2b0b('0x17'));var Hangup=require(_0x2b0b('0x18'));var ipAgi=process[_0x2b0b('0x19')]['XCALLY_IP_AGI']||'127.0.0.1';var strategy={'rrmemory':_0x2b0b('0x1a'),'roundrobin':_0x2b0b('0x1b')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x2b0b('0x1c')][_0x2b0b('0x1d')]=function(_0x37792e){this[_0x2b0b('0x1e')]=this[_0x2b0b('0x1e')]?this[_0x2b0b('0x1e')][_0x2b0b('0x1f')](_0x37792e):_0x37792e();};function Dialer(_0x4845bd,_0x4d62ff){this[_0x2b0b('0x20')]=new Sequence();this['preview']=_0x4d62ff;this['voiceQueues']=_0x4845bd[_0x2b0b('0x21')];this[_0x2b0b('0x22')]=_0x4845bd[_0x2b0b('0x22')];this['agents']=_0x4845bd[_0x2b0b('0x23')];this[_0x2b0b('0x24')]=_0x4845bd[_0x2b0b('0x24')];this[_0x2b0b('0x25')]=config[_0x2b0b('0x25')]||0x2;this[_0x2b0b('0x26')]={};this[_0x2b0b('0x27')]={};this[_0x2b0b('0x28')]={};this['uniqueId']={};this['optionPredictive']={};this[_0x2b0b('0x29')]={};this[_0x2b0b('0x2a')]={};this[_0x2b0b('0x2b')]={};this[_0x2b0b('0x2c')]={};this[_0x2b0b('0x2d')]={};ami['on'](_0x2b0b('0x2e'),this[_0x2b0b('0x2f')][_0x2b0b('0x30')](this));ami['on'](_0x2b0b('0x31'),this[_0x2b0b('0x32')]['bind'](this));ami['on']('originateresponse',this[_0x2b0b('0x33')][_0x2b0b('0x30')](this));ami['on'](_0x2b0b('0x34'),this[_0x2b0b('0x35')][_0x2b0b('0x30')](this));ami['on'](_0x2b0b('0x36'),this[_0x2b0b('0xd')][_0x2b0b('0x30')](this));ami['on'](_0x2b0b('0x37'),this[_0x2b0b('0x38')][_0x2b0b('0x30')](this));ami['on'](_0x2b0b('0x39'),this[_0x2b0b('0x3a')][_0x2b0b('0x30')](this));ami['on'](_0x2b0b('0x3b'),this[_0x2b0b('0x3c')][_0x2b0b('0x30')](this));ami['on'](_0x2b0b('0x3d'),this[_0x2b0b('0x3e')][_0x2b0b('0x30')](this));ami['on'](_0x2b0b('0x3f'),this[_0x2b0b('0x40')][_0x2b0b('0x30')](this));this['loopCampaigns']();this['loopClearZombieChannels']();RpcSetting[_0x2b0b('0x41')]()[_0x2b0b('0x42')](function(_0x12d561){previewRecallmeReminderInterval=_0x12d561[_0x2b0b('0x43')];});}function isNotNull(_0x41bf92){return _0x41bf92!==null&&!_[_0x2b0b('0x44')](_0x41bf92);}function checkIsLoggedIn(_0x3dad08,_0x24b84a){return function(){if(_0x24b84a<=0x0){_0x3dad08[_0x2b0b('0x45')]=_0x2b0b('0x46');throw _0x3dad08['name']+_0x2b0b('0x47');}};}function isActive(_0x3c7e47){return _0x3c7e47;}function checkIsActive(_0xd33188,_0x56ae2b){return function(){if(!isActive(_0x56ae2b)){_0xd33188[_0x2b0b('0x45')]=_0x2b0b('0x48');throw _0xd33188[_0x2b0b('0x49')]+_0x2b0b('0x4a');}};}function checkInterval(_0x430442){return function(){if(!isNotNull(_0x430442['Interval'])){_0x430442[_0x2b0b('0x45')]=_0x2b0b('0x4b');throw _0x430442[_0x2b0b('0x49')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x430442[_0x2b0b('0x4c')][_0x2b0b('0x4d')])){_0x430442['message']=_0x2b0b('0x4b');throw _0x430442[_0x2b0b('0x49')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_['isEmpty'](_0x430442[_0x2b0b('0x4c')]['Intervals']))){_0x430442['message']=_0x2b0b('0x4b');throw _0x430442[_0x2b0b('0x49')]+_0x2b0b('0x4e');}};}function msgResponse(_0x1ab79a,_0x18621b,_0x3b92fe){return{'action':_0x1ab79a,'response':_0x18621b,'message':_0x3b92fe,'stack':_0x3b92fe};}function myreject(_0xf69a32){return function(_0x12cfad){return _0xf69a32(msgResponse('[ifTime][Action]','Error',JSON['stringify'](_0x12cfad)));};}function getSeconds(_0x261d29,_0x52534e){var _0x1a2541=moment(_0x261d29)[_0x2b0b('0x4f')](0x0);var _0x35cef6=moment(_0x52534e)[_0x2b0b('0x4f')](0x0);return _0x1a2541[_0x2b0b('0x50')](_0x35cef6,_0x2b0b('0x51'));}function emit(_0x31287e,_0x457c15,_0xf7f9c7){io['to'](_0x31287e)[_0x2b0b('0x52')](_0x457c15,_0xf7f9c7);}function emitVoiceQueueSummary(_0x2263fc){if(_0x2263fc[_0x2b0b('0x53')]==='outbound'){var _0x51fccf={'id':_0x2263fc['id'],'name':_0x2263fc[_0x2b0b('0x49')],'strategy':_0x2263fc[_0x2b0b('0x54')],'answered':_0x2263fc[_0x2b0b('0x55')],'available':_0x2263fc[_0x2b0b('0x56')],'loggedIn':_0x2263fc[_0x2b0b('0x57')],'pTalking':_0x2263fc['pTalking'],'sumBillable':_0x2263fc[_0x2b0b('0x58')],'sumDuration':_0x2263fc[_0x2b0b('0x59')],'sumHoldTime':_0x2263fc[_0x2b0b('0x5a')]||0x0,'talking':_0x2263fc[_0x2b0b('0x5b')],'total':_0x2263fc[_0x2b0b('0x5c')],'type':_0x2263fc[_0x2b0b('0x53')],'unmanaged':_0x2263fc['unmanaged'],'abandoned':_0x2263fc[_0x2b0b('0x5d')],'waiting':_0x2263fc[_0x2b0b('0x5e')],'loggedInDb':_0x2263fc[_0x2b0b('0x5f')],'dialActive':_0x2263fc[_0x2b0b('0x60')],'dialMethod':_0x2263fc[_0x2b0b('0x61')],'dialOriginateCallerIdName':_0x2263fc['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x2263fc[_0x2b0b('0x62')],'dialOriginateTimeout':_0x2263fc[_0x2b0b('0x63')],'dialPrefix':_0x2263fc[_0x2b0b('0x64')],'outboundAnswerAgiCallsDay':_0x2263fc['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x2263fc['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x2263fc['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x2263fc['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x2263fc[_0x2b0b('0x65')],'outboundDropCallsDayACS':_0x2263fc['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x2263fc[_0x2b0b('0x66')],'outboundDropCallsDayTimeout':_0x2263fc[_0x2b0b('0x67')],'outboundNoAnswerCallsDay':_0x2263fc['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x2263fc[_0x2b0b('0x68')],'outboundOriginateFailureCallsDay':_0x2263fc[_0x2b0b('0x69')],'outboundReCallsDay':_0x2263fc[_0x2b0b('0x6a')],'outboundRejectCallsDay':_0x2263fc['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x2263fc[_0x2b0b('0x6b')],'predictiveIntervalAnsweredCalls':_0x2263fc[_0x2b0b('0x6c')],'predictiveIntervalAvgHoldtime':_0x2263fc[_0x2b0b('0x6d')],'predictiveIntervalAvgTalktime':_0x2263fc[_0x2b0b('0x6e')],'predictiveIntervalDroppedCallsCallersExit':_0x2263fc[_0x2b0b('0x6f')],'predictiveIntervalDroppedCallsTimeout':_0x2263fc[_0x2b0b('0x70')],'predictiveIntervalErlangCalls':_0x2263fc[_0x2b0b('0x71')],'predictiveIntervalErlangCallsDroppedCalls':_0x2263fc[_0x2b0b('0x72')],'predictiveIntervalHitRate':_0x2263fc['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x2263fc[_0x2b0b('0x73')],'predictiveIntervalPauses':_0x2263fc['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x2263fc[_0x2b0b('0x74')],'predictiveIntervalTotalCalls':_0x2263fc[_0x2b0b('0x75')],'message':_0x2263fc[_0x2b0b('0x45')],'originated':_0x2263fc[_0x2b0b('0x76')],'erlangCalls':_0x2263fc['erlangCalls'],'erlangCallToSecond':_0x2263fc['erlangCallToSecond'],'erlangAbandonmentRate':_0x2263fc[_0x2b0b('0x77')],'erlangBusyFactor':_0x2263fc[_0x2b0b('0x78')],'startPredictive':_0x2263fc['startPredictive'],'startProgressive':_0x2263fc[_0x2b0b('0x2a')]};if(_0x2263fc['Trunk']){_0x51fccf[_0x2b0b('0x79')]={'id':_0x2263fc[_0x2b0b('0x79')]['id'],'name':_0x2263fc[_0x2b0b('0x79')][_0x2b0b('0x49')],'active':_0x2263fc['Trunk']['active'],'callerid':_0x2263fc[_0x2b0b('0x79')]['callerid']};}if(_0x2263fc[_0x2b0b('0x4c')]){_0x51fccf['Interval']={'id':_0x2263fc['Interval']['id'],'name':_0x2263fc[_0x2b0b('0x4c')][_0x2b0b('0x49')]};}var _0xb08d9c=md5(JSON[_0x2b0b('0x7a')](_0x51fccf));if(_0x2263fc[_0x2b0b('0x5')]!==_0xb08d9c){_0x2263fc[_0x2b0b('0x5')]=_0xb08d9c;emit(util[_0x2b0b('0x7b')](_0x2b0b('0x7c'),_0x51fccf[_0x2b0b('0x49')]),'voice_queue:save',_0x51fccf);}}}function emitCampaignSummary(_0x138e59){if(_0x138e59[_0x2b0b('0x53')]===_0x2b0b('0x7d')){emit(util[_0x2b0b('0x7b')](_0x2b0b('0x7e'),_0x138e59['name']),'campaign:save',_0x138e59);}}function checkGetDataPredictive(_0x2a2835){if(isNotNull(_0x2a2835)&&!_[_0x2b0b('0x7f')](_0x2a2835)){loggerPredictive[_0x2b0b('0x80')](_0x2b0b('0x81'));loggerPredictive[_0x2b0b('0x80')](_0x2b0b('0x82'),_0x2a2835['predictiveIntervalTotalCalls']);loggerPredictive[_0x2b0b('0x80')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2a2835['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x2b0b('0x80')](_0x2b0b('0x83'),_0x2a2835[_0x2b0b('0x70')]);loggerPredictive['info']('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2a2835[_0x2b0b('0x6f')]);loggerPredictive['info'](_0x2b0b('0x84'),_0x2a2835[_0x2b0b('0x6d')]);loggerPredictive[_0x2b0b('0x80')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2a2835[_0x2b0b('0x6e')]);loggerPredictive[_0x2b0b('0x80')](_0x2b0b('0x85'));if(_0x2a2835[_0x2b0b('0x75')]>0x0){if(!_['isUndefined'](_0x2a2835[_0x2b0b('0x6e')])&&_0x2a2835[_0x2b0b('0x6e')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_['isUndefined'](_0x2a2835['predictiveIntervalAvgHoldtime'])&&_0x2a2835['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x2b0b('0x80')](_0x2b0b('0x86'));}else{loggerPredictive[_0x2b0b('0x80')](_0x2b0b('0x87'));}}else{loggerPredictive[_0x2b0b('0x80')](_0x2b0b('0x88'));}return![];}function mergeDataErlangB(_0x39f115){return function(_0x3a11fe){loggerPredictive[_0x2b0b('0x80')](_0x2b0b('0x89'));loggerPredictive[_0x2b0b('0x80')](_0x2b0b('0x8a'),_0x3a11fe[_0x2b0b('0x8b')]);loggerPredictive[_0x2b0b('0x80')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3a11fe[_0x2b0b('0x8c')]);loggerPredictive[_0x2b0b('0x80')](_0x2b0b('0x8d'),_0x3a11fe[_0x2b0b('0x77')]);loggerPredictive[_0x2b0b('0x80')](_0x2b0b('0x8e'),_0x3a11fe[_0x2b0b('0x78')]);loggerPredictive[_0x2b0b('0x80')](_0x2b0b('0x8d'),_0x3a11fe[_0x2b0b('0x77')]);loggerPredictive['info'](_0x2b0b('0x85'));_[_0x2b0b('0x8f')](_0x39f115,_0x3a11fe);};}function getDiff(_0x6a59d9){var _0x2af607=moment()['milliseconds'](0x0);var _0x2b4a34=moment(_0x6a59d9)[_0x2b0b('0x4f')](0x0);return _0x2af607['diff'](_0x2b4a34,'seconds');}function ifInterval(_0x31306f,_0x2129f5){if(_[_0x2b0b('0x44')](_0x2129f5)){return![];}return getDiff(_0x2129f5)<_0x31306f*0x3c;}function freeVariablesPredictive(_0x1f15de){if(isNotNull(_0x1f15de)){if(!_[_0x2b0b('0x44')](_0x1f15de[_0x2b0b('0x2a')])){_0x1f15de[_0x2b0b('0x2a')]=undefined;loggerPredictive['info'](_0x1f15de[_0x2b0b('0x49')],_0x2b0b('0x90'));}if(!_[_0x2b0b('0x44')](_0x1f15de[_0x2b0b('0x29')])){_0x1f15de['startPredictive']=undefined;loggerPredictive[_0x2b0b('0x80')](_0x1f15de[_0x2b0b('0x49')],_0x2b0b('0x91'));}if(!_['isUndefined'](_0x1f15de[_0x2b0b('0x92')])){clearInterval(_0x1f15de[_0x2b0b('0x92')]);_0x1f15de['handlePredictive']=undefined;loggerPredictive[_0x2b0b('0x80')](_0x1f15de[_0x2b0b('0x49')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x47726d,_0x44c5e4){if(_0x44c5e4===0x0){return 0x0;}var _0x3c65df=0x1;for(var _0x2535ed=0x1;_0x2535ed<=_0x44c5e4;_0x2535ed+=0x1){_0x3c65df=0x1+_0x3c65df*_0x2535ed/_0x47726d;}return 0x1/_0x3c65df;}function isVoiceQueueOutbound(_0x5a07b9){return _0x5a07b9===_0x2b0b('0x93');}function isNotPreview(_0x492d5d){return _0x492d5d!==_0x2b0b('0x94');}function isCampaignIvr(_0x182605){return _0x182605===_0x2b0b('0x7d');}function getCallerId(_0x5da700,_0x2e9a37,_0x1811e1){if(!_[_0x2b0b('0x44')](_0x1811e1)&&typeof _0x1811e1===_0x2b0b('0x95')&&!_[_0x2b0b('0x7f')](_0x1811e1)){if(!_[_0x2b0b('0x44')](_0x2e9a37)&&typeof _0x2e9a37==='string'&&!_['isEmpty'](_0x2e9a37)){return util['format'](_0x2b0b('0x96'),_0x2e9a37,_0x1811e1);}return util[_0x2b0b('0x7b')](_0x2b0b('0x96'),_0x1811e1,_0x1811e1);}if(!_[_0x2b0b('0x44')](_0x5da700)&&typeof _0x5da700===_0x2b0b('0x95')&&!_[_0x2b0b('0x7f')](_0x5da700)){return _0x5da700;}return _0x2b0b('0x97');}function loggerCatchQueueSummary(_0x28af6a,_0x12703a){return function(_0x23d29e){freeVariablesPredictive(_0x12703a);emitVoiceQueueSummary(_0x12703a);emitCampaignSummary(_0x12703a);loggerSyncQueueSummary[_0x2b0b('0x98')](_0x28af6a,util[_0x2b0b('0x99')](_0x23d29e,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x394a9b,_0x4d285c){return function(_0xeda7eb){loggerPredictive['error'](_0x4d285c[_0x2b0b('0x49')],_0x394a9b);loggerPredictive[_0x2b0b('0x98')](_0xeda7eb[_0x2b0b('0x9a')]);freeVariablesPredictive(_0x4d285c);};}function loggerCatch(_0x2f60a7){return function(_0x47df23){logger[_0x2b0b('0x98')](_0x2f60a7,util['inspect'](_0x47df23,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x24f10a){return _0x24f10a&&!_[_0x2b0b('0x44')](_0x24f10a)&&_0x24f10a[_0x2b0b('0x9b')]>0x0;}function decremetOriginate(_0x4982df){if(!_['isUndefined'](_0x4982df)&&_0x4982df!==null){if(typeof _0x4982df['originated']!==_0x2b0b('0x9c')){if(_0x4982df[_0x2b0b('0x76')]>0x0){_0x4982df[_0x2b0b('0x76')]-=0x1;}else{logger[_0x2b0b('0x98')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger['error']('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x4acb5c,_0x1242a1,_0x1c9416){if(_0x1242a1>_0x1c9416){for(var _0x14027a=0x0;_0x14027a<_0x1242a1-_0x1c9416;_0x14027a+=0x1){decremetOriginate(_0x4acb5c);}}}function loggerGetContactDialer(_0x2db22a,_0x1402be,_0xcef6ba){return function(_0x1c4c51){checkContactLowerLimitOriginate(_0x1402be,_0xcef6ba,0x0);logger[_0x2b0b('0x98')](_0x2db22a,util[_0x2b0b('0x99')](_0x1c4c51,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x19b70f){return function(_0x57e9a6){if(isNotNull(_0x57e9a6)&&isNotNull(_0x57e9a6[0x0])){if(_0x57e9a6[0x0][_0x2b0b('0x9d')]>0x0){_0x19b70f['message']=_0x2b0b('0x9e');logger[_0x2b0b('0x80')](_0x2b0b('0x9f')+_0x19b70f[_0x2b0b('0x49')],_0x57e9a6[0x0][_0x2b0b('0x9d')],_0x2b0b('0xa0'));}else{_0x19b70f['message']=_0x2b0b('0xa1');logger['info'](_0x2b0b('0xa2')+_0x19b70f[_0x2b0b('0x49')]);}}};}function notSendMessagesQueue(_0x29efe0){if(_0x29efe0[_0x2b0b('0xa3')]){freeVariablesPredictive(_0x29efe0);if(_0x29efe0[_0x2b0b('0x76')]===0x0&&_0x29efe0[_0x2b0b('0x5b')]===0x0&&_0x29efe0[_0x2b0b('0x5e')]===0x0&&(_0x29efe0['pTalking']||0x0)===0x0){_0x29efe0[_0x2b0b('0xa3')]=![];_0x29efe0[_0x2b0b('0x56')]=0x0;_0x29efe0[_0x2b0b('0x45')]=_0x2b0b('0x48');loggerSyncQueueSummary['error'](_0x2b0b('0xa4'),_0x29efe0[_0x2b0b('0x49')],'is\x20not\x20active');}else{_0x29efe0[_0x2b0b('0x45')]=_0x2b0b('0xa5');loggerSyncQueueSummary[_0x2b0b('0x98')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x29efe0[_0x2b0b('0x49')],_0x2b0b('0xa6'));}emitVoiceQueueSummary(_0x29efe0);}}function notSendMessagesCampaign(_0x326a01){if(_0x326a01[_0x2b0b('0xa3')]){if(_0x326a01[_0x2b0b('0x76')]===0x0){_0x326a01[_0x2b0b('0xa3')]=![];_0x326a01[_0x2b0b('0x45')]=_0x2b0b('0x48');loggerSyncQueueSummary[_0x2b0b('0x98')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x326a01[_0x2b0b('0x49')],'is\x20not\x20active');}else{_0x326a01[_0x2b0b('0x45')]=_0x2b0b('0xa5');loggerSyncQueueSummary[_0x2b0b('0x98')](_0x2b0b('0xa7'),_0x326a01[_0x2b0b('0x49')],_0x2b0b('0xa6'));}emitCampaignSummary(_0x326a01);}}function createObjHistory(_0x2f3f17,_0x50006c,_0x468f2e,_0x556a68,_0x452f5f){_0x2f3f17[_0x2b0b('0x45')]=_0x468f2e;var _0x59f0f5=new Action(_0x2f3f17,_0x50006c);var _0x4eb33b=new History(_0x59f0f5);_0x4eb33b[_0x2b0b('0xa8')]=_0x556a68;_0x4eb33b['statedesc']=_0x452f5f;_0x4eb33b['endtime']=_0x59f0f5[_0x2b0b('0xa9')];return _0x4eb33b;}Dialer[_0x2b0b('0x1c')][_0x2b0b('0xaa')]=function(){var _0x588c42=this;setInterval(function(){_0x588c42[_0x2b0b('0xab')](_0x588c42[_0x2b0b('0xac')],'[uniqueid]');_0x588c42['clearZombieChannels'](_0x588c42[_0x2b0b('0x27')],'[actions]');},0x32c8);};Dialer[_0x2b0b('0x1c')]['clearZombieChannels']=function(_0x279ff1,_0x4a8cc3){var _0x2e1e12=this;for(var _0x2e99dd in _0x279ff1){if(typeof _0x279ff1[_0x2e99dd]!==_0x2b0b('0x9c')){this[_0x2b0b('0x20')][_0x2b0b('0x1d')](function(){if(!_[_0x2b0b('0xad')](_0x279ff1[_0x2e99dd])){return ami[_0x2b0b('0xae')]({'action':_0x2b0b('0xaf'),'channel':_0x279ff1[_0x2e99dd][_0x2b0b('0xb0')]})[_0x2b0b('0xb1')](function(_0x438672){if(_0x438672[_0x2b0b('0x45')]===_0x2b0b('0xb2')){setTimeout(function(){if(_0x279ff1[_0x2e99dd]&&_0x279ff1[_0x2e99dd][_0x2b0b('0x53')]!==_0x2b0b('0x7d')){_0x2e1e12[_0x2b0b('0xb3')](_0x2e1e12[_0x2b0b('0x21')][_0x279ff1[_0x2e99dd][_0x2b0b('0xb4')]]);logger[_0x2b0b('0x98')](_0x2b0b('0xb5'),_0x4a8cc3,_0x2e99dd,_0x279ff1[_0x2e99dd]['queue']);delete _0x279ff1[_0x2e99dd];}if(_0x279ff1[_0x2e99dd]&&_0x279ff1[_0x2e99dd][_0x2b0b('0x53')]==='ivr'){_0x2e1e12[_0x2b0b('0xb3')](_0x2e1e12[_0x2b0b('0x22')][_0x279ff1[_0x2e99dd][_0x2b0b('0xb4')]]);logger[_0x2b0b('0x98')](_0x2b0b('0xb6'),_0x4a8cc3,_0x2e99dd,_0x279ff1[_0x2e99dd][_0x2b0b('0xb4')]);delete _0x279ff1[_0x2e99dd];}},0x2328);}});}});}}};Dialer[_0x2b0b('0x1c')]['countReScheduled']=function(_0x18435f){return BPromise[_0x2b0b('0xb7')]()['then'](cmHopper[_0x2b0b('0xb8')](_0x18435f))[_0x2b0b('0xb1')](loggerCatch(_0x2b0b('0xb9')));};Dialer[_0x2b0b('0x1c')]['checkIsBlackList']=function(_0x3872af){return BPromise[_0x2b0b('0xb7')]()[_0x2b0b('0x42')](cmHopperBlack[_0x2b0b('0xba')](_0x3872af))[_0x2b0b('0xb1')](loggerCatch('[checkIsBlackList]\x20'));};Dialer['prototype']['checkIsBlackListIvr']=function(_0x5bf1da){return BPromise[_0x2b0b('0xb7')]()[_0x2b0b('0x42')](cmHopperBlack[_0x2b0b('0xbb')](_0x5bf1da))[_0x2b0b('0xb1')](loggerCatch(_0x2b0b('0xbc')));};Dialer[_0x2b0b('0x1c')][_0x2b0b('0xbd')]=function(_0x312a73){return BPromise[_0x2b0b('0xb7')]()['then'](cmHopperHistory[_0x2b0b('0xbe')](_0x312a73))[_0x2b0b('0xb1')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0x2b0b('0x1c')][_0x2b0b('0xbf')]=function(_0x16400b){return BPromise[_0x2b0b('0xb7')]()[_0x2b0b('0x42')](cmHopper[_0x2b0b('0xbf')](_0x16400b))[_0x2b0b('0xb1')](loggerCatch('[rescheduleContact]\x20'));};Dialer['prototype'][_0x2b0b('0xc0')]=function(_0x31d224,_0xd6cae6,_0x5f3bc2){return BPromise[_0x2b0b('0xb7')]()[_0x2b0b('0x42')](cmHopper[_0x2b0b('0xc0')](_0x31d224,_0xd6cae6,_0x5f3bc2))[_0x2b0b('0xb1')](loggerCatch(_0x2b0b('0xc1')));};Dialer[_0x2b0b('0x1c')]['getContactDialer']=function(_0x5a7977,_0x5e1b02,_0x1a55af,_0x2bdd3b,_0x40cf7d){return BPromise['resolve']()[_0x2b0b('0x42')](cmHopper[_0x2b0b('0xc2')](_0x5a7977,_0x5e1b02,_0x1a55af,_0x2bdd3b))[_0x2b0b('0xb1')](function(_0x18ee30){_0x40cf7d[_0x2b0b('0xc3')]-=_0x1a55af;_0x40cf7d[_0x2b0b('0xc3')]=_0x40cf7d[_0x2b0b('0xc3')]>0x0?_0x40cf7d[_0x2b0b('0xc3')]:0x0;loggerCatch(_0x2b0b('0xc4'))(_0x18ee30);});};Dialer[_0x2b0b('0x1c')][_0x2b0b('0xc5')]=function(_0x3582dc,_0x5a4190,_0x5d97ed,_0x521621){return BPromise[_0x2b0b('0xb7')]()[_0x2b0b('0x42')](cmHopper[_0x2b0b('0xc5')](_0x3582dc,_0x5a4190,_0x5d97ed))[_0x2b0b('0xb1')](function(_0x4419dd){_0x521621[_0x2b0b('0xc3')]-=_0x5a4190;_0x521621[_0x2b0b('0xc3')]=_0x521621[_0x2b0b('0xc3')]>0x0?_0x521621[_0x2b0b('0xc3')]:0x0;loggerCatch(_0x2b0b('0xc6'))(_0x4419dd);});};Dialer[_0x2b0b('0x1c')][_0x2b0b('0xc7')]=function(_0x2dc129){return BPromise[_0x2b0b('0xb7')]()[_0x2b0b('0x42')](voiceQueueRt[_0x2b0b('0xc7')](_0x2dc129))[_0x2b0b('0xb1')](loggerCatch(_0x2b0b('0xc8')));};Dialer[_0x2b0b('0x1c')][_0x2b0b('0xc9')]=function(_0xfb0519){return BPromise[_0x2b0b('0xb7')]()[_0x2b0b('0x42')](cmHopper[_0x2b0b('0xc9')](_0xfb0519))['catch'](loggerCatch(_0x2b0b('0xca')));};Dialer[_0x2b0b('0x1c')][_0x2b0b('0xcb')]=function(_0x463ba3){return BPromise[_0x2b0b('0xb7')]()['then'](cmHopperHistory[_0x2b0b('0xcb')](_0x463ba3))[_0x2b0b('0xb1')](loggerCatch(_0x2b0b('0xcc')));};Dialer['prototype'][_0x2b0b('0xb3')]=function(_0xc720d9){if(!_['isUndefined'](_0xc720d9)&&_0xc720d9!==null){if(typeof _0xc720d9[_0x2b0b('0x76')]!==_0x2b0b('0x9c')){if(_0xc720d9['originated']>0x0){_0xc720d9[_0x2b0b('0x76')]-=0x1;}else{logger[_0x2b0b('0x98')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x2b0b('0x98')](_0x2b0b('0xcd'));}};Dialer[_0x2b0b('0x1c')][_0x2b0b('0xce')]=function(_0x508e41,_0x4383be){var _0x5d8b71=this;return function(_0x532238){_0x5d8b71[_0x2b0b('0xb3')](_0x4383be);logger[_0x2b0b('0x98')](_0x508e41,util['inspect'](_0x532238,{'showHidden':![],'depth':null}));};};Dialer[_0x2b0b('0x1c')][_0x2b0b('0xcf')]=function(_0x1c4621,_0x5030e2,_0xb21c3){var _0x549713={'state':0x19,'statedesc':_0x2b0b('0xd0')};this[_0x2b0b('0xb3')](_0x5030e2);this[_0x2b0b('0xd1')](_[_0x2b0b('0x8f')](_0x549713,_[_0x2b0b('0xd2')](_0xb21c3,['ContactId','ListId',_0x2b0b('0xd3'),'VoiceQueueId',_0x2b0b('0xd4')])),'[emptyContact][createHistory]',_0x2b0b('0xd5'));logger[_0x2b0b('0x98')](_0x1c4621);};Dialer[_0x2b0b('0x1c')]['isSuccess']=function(_0x40ae16){return _0x40ae16==='Success';};Dialer['prototype'][_0x2b0b('0xd6')]=function(_0x23f8b4){return!_[_0x2b0b('0x44')](_0x23f8b4)&&_0x23f8b4&&!_[_0x2b0b('0x44')](_0x23f8b4[_0x2b0b('0x49')])&&!_['isUndefined'](_0x23f8b4['active'])&&_0x23f8b4[_0x2b0b('0xd7')]&&(this[_0x2b0b('0x24')][util[_0x2b0b('0x7b')]('SIP/%s',_0x23f8b4[_0x2b0b('0x49')])]['status']==='reachable'||this['trunks'][util['format']('SIP/%s',_0x23f8b4[_0x2b0b('0x49')])][_0x2b0b('0xaf')]===_0x2b0b('0xd8'));};Dialer[_0x2b0b('0x1c')]['saveInDb']=function(_0x407cf9,_0xa416ae,_0xdbdc1a){this[_0x2b0b('0xcb')](_0x407cf9)[_0x2b0b('0xb1')](loggerCatch(_0xa416ae));this[_0x2b0b('0xc9')](_0x407cf9)[_0x2b0b('0xb1')](loggerCatch(_0xdbdc1a));};Dialer['prototype'][_0x2b0b('0x3c')]=function(_0x23835b){var _0x175a2c=this[_0x2b0b('0xac')][_0x23835b[_0x2b0b('0xd9')]];var _0x34d61f;if(!_[_0x2b0b('0xad')](_0x23835b)&&!_[_0x2b0b('0xad')](_0x23835b[_0x2b0b('0xda')])&&!_[_0x2b0b('0xad')](_0x23835b[_0x2b0b('0xda')][_0x2b0b('0xdb')])&&_0x23835b['exten']===_0x2b0b('0xdc')&&_0x175a2c){if(_0x175a2c[_0x2b0b('0x53')]!==_0x2b0b('0x7d')&&this[_0x2b0b('0x21')][_0x175a2c[_0x2b0b('0xb4')]]['dialAMDActive']&&_0x23835b[_0x2b0b('0xdd')]==='HANGUP'){delete this[_0x2b0b('0xac')][_0x23835b[_0x2b0b('0xd9')]];this[_0x2b0b('0xb3')](this['voiceQueues'][_0x175a2c[_0x2b0b('0xb4')]]);this['voiceQueues'][_0x175a2c['queue']][_0x2b0b('0xde')]+=0x1;this[_0x2b0b('0x21')][_0x175a2c[_0x2b0b('0xb4')]][_0x2b0b('0xdf')]+=0x1;_0x34d61f=new Hangup(_0x175a2c,_0x23835b);_0x34d61f[_0x2b0b('0xa8')]=0x12;_0x34d61f[_0x2b0b('0xe0')]=_0x2b0b('0xe1');_0x34d61f['membername']=_0x2b0b('0xe2');ami[_0x2b0b('0x52')](_0x2b0b('0xe3'),ut[_0x2b0b('0xe4')](_0x34d61f,_0x2b0b('0xe5')));this[_0x2b0b('0xd1')](_0x34d61f,_0x2b0b('0xe6'),_0x2b0b('0xe7'));}if(_0x175a2c[_0x2b0b('0x53')]!==_0x2b0b('0x7d')&&this[_0x2b0b('0x21')][_0x175a2c[_0x2b0b('0xb4')]][_0x2b0b('0xe8')]&&_0x23835b[_0x2b0b('0xdd')]===_0x2b0b('0xe9')){var _0x39ff19=this;return new BPromise(function(_0x27eee9,_0x2b042c){delete _0x39ff19[_0x2b0b('0xac')][_0x23835b['uniqueid']];_0x39ff19[_0x2b0b('0xb3')](_0x39ff19[_0x2b0b('0x21')][_0x175a2c['queue']]);_0x39ff19['voiceQueues'][_0x175a2c['queue']]['outboundAnswerCallsDay']+=0x1;_0x39ff19[_0x2b0b('0x21')][_0x175a2c[_0x2b0b('0xb4')]][_0x2b0b('0xdf')]+=0x1;var _0x389fb9=_0x39ff19[_0x2b0b('0x21')][_0x175a2c[_0x2b0b('0xb4')]];var _0x1ffc6c=new Hangup(_0x175a2c,_0x23835b);_0x1ffc6c[_0x2b0b('0xa8')]=0x13;_0x1ffc6c[_0x2b0b('0xe0')]='Machine';_0x1ffc6c[_0x2b0b('0xea')]=_0x2b0b('0xe2');_0x1ffc6c[_0x2b0b('0xeb')]+=0x1;_0x1ffc6c[_0x2b0b('0xec')]+=0x1;_0x1ffc6c[_0x2b0b('0xe5')]=!![];ami['emit'](_0x2b0b('0xe3'),ut[_0x2b0b('0xe4')](_0x1ffc6c,_0x2b0b('0xe5')));_0x39ff19['createHistory'](_0x1ffc6c)[_0x2b0b('0xb1')](loggerCatch(_0x2b0b('0xed')));if(_0x1ffc6c[_0x2b0b('0xee')]+_0x1ffc6c['countcongestionretry']+_0x1ffc6c[_0x2b0b('0xef')]+_0x1ffc6c[_0x2b0b('0xf0')]+_0x1ffc6c[_0x2b0b('0xf1')]+_0x1ffc6c[_0x2b0b('0xf2')]+_0x1ffc6c['countmachineretry']+_0x1ffc6c['countagentrejectretry']>=_0x389fb9[_0x2b0b('0xf3')]){_0x39ff19['stateGlobal'](_0x1ffc6c,_0x27eee9,_0x2b042c,_0x2b0b('0xf4'));}else{if(_0x1ffc6c[_0x2b0b('0xeb')]>=_0x389fb9[_0x2b0b('0xf5')]){_0x39ff19['createStateFinal'](_0x1ffc6c,_0x27eee9,_0x2b042c,'reason\x2019\x20machine....');}else{_0x39ff19['rescheduleContact']({'active':![],'countmachineretry':_0x1ffc6c[_0x2b0b('0xeb')],'scheduledat':moment()[_0x2b0b('0xf6')](_0x389fb9['dialMachineRetryFrequency'],_0x2b0b('0xf7'))['format'](_0x2b0b('0xf8')),'ContactId':_0x1ffc6c[_0x2b0b('0xf9')],'ListId':_0x1ffc6c['ListId'],'VoiceQueueId':_0x1ffc6c[_0x2b0b('0xfa')]||undefined,'CampaignId':_0x1ffc6c['CampaignId']||undefined})[_0x2b0b('0xb1')](loggerCatch('[rescheduleContact][Machine]'));_0x27eee9({'reschedule':0x1});}}});}if(_0x175a2c[_0x2b0b('0x53')]==='ivr'&&this[_0x2b0b('0x22')][_0x175a2c[_0x2b0b('0xb4')]]['dialAMDActive']&&_0x23835b[_0x2b0b('0xdd')]==='HANGUP'){delete this['uniqueId'][_0x23835b['uniqueid']];this['updateOriginated'](this['campaigns'][_0x175a2c[_0x2b0b('0xb4')]]);_0x34d61f=new Hangup(_0x175a2c,_0x23835b);_0x34d61f[_0x2b0b('0xa8')]=0x12;_0x34d61f['statedesc']='HangupInAMD';_0x34d61f[_0x2b0b('0xea')]=_0x2b0b('0xe2');ami['emit']('custom:amd',ut['buildObj'](_0x34d61f,_0x2b0b('0xe5')));this['saveInDb'](_0x34d61f,_0x2b0b('0xfb'),_0x2b0b('0xfc'));}if(_0x175a2c[_0x2b0b('0x53')]===_0x2b0b('0x7d')&&this[_0x2b0b('0x22')][_0x175a2c[_0x2b0b('0xb4')]]['dialAMDActive']&&_0x23835b[_0x2b0b('0xdd')]==='MACHINE'){var _0x39ff19=this;return new BPromise(function(_0x1552c0,_0x2d5b30){delete _0x39ff19['uniqueId'][_0x23835b[_0x2b0b('0xd9')]];_0x39ff19[_0x2b0b('0xb3')](_0x39ff19['campaigns'][_0x175a2c[_0x2b0b('0xb4')]]);_0x39ff19[_0x2b0b('0x22')][_0x175a2c[_0x2b0b('0xb4')]][_0x2b0b('0xde')]+=0x1;_0x39ff19[_0x2b0b('0x22')][_0x175a2c[_0x2b0b('0xb4')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x3058be=_0x39ff19[_0x2b0b('0x22')][_0x175a2c[_0x2b0b('0xb4')]];var _0x171045=new Hangup(_0x175a2c,_0x23835b);_0x171045['state']=0x13;_0x171045[_0x2b0b('0xe0')]='Machine';_0x171045[_0x2b0b('0xea')]=_0x2b0b('0xe2');_0x171045[_0x2b0b('0xeb')]+=0x1;_0x171045['countglobal']+=0x1;_0x171045[_0x2b0b('0xe5')]=!![];ami[_0x2b0b('0x52')]('custom:amd',ut[_0x2b0b('0xe4')](_0x171045,_0x2b0b('0xe5')));_0x39ff19[_0x2b0b('0xcb')](_0x171045)[_0x2b0b('0xb1')](loggerCatch(_0x2b0b('0xed')));if(_0x171045['countbusyretry']+_0x171045[_0x2b0b('0xfd')]+_0x171045[_0x2b0b('0xef')]+_0x171045[_0x2b0b('0xf0')]+_0x171045['countdropretry']+_0x171045['countabandonedretry']+_0x171045['countmachineretry']+_0x171045[_0x2b0b('0xfe')]>=_0x3058be[_0x2b0b('0xf3')]){_0x39ff19[_0x2b0b('0xff')](_0x171045,_0x1552c0,_0x2d5b30,_0x2b0b('0xf4'));}else{if(_0x171045[_0x2b0b('0xeb')]>=_0x3058be[_0x2b0b('0xf5')]){_0x39ff19[_0x2b0b('0x100')](_0x171045,_0x1552c0,_0x2d5b30,'reason\x2019\x20machine....');}else{_0x39ff19['rescheduleContact']({'active':![],'countmachineretry':_0x171045[_0x2b0b('0xeb')],'scheduledat':moment()['add'](_0x3058be['dialMachineRetryFrequency'],_0x2b0b('0xf7'))[_0x2b0b('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x171045['ContactId'],'ListId':_0x171045[_0x2b0b('0x101')],'VoiceQueueId':_0x171045[_0x2b0b('0xfa')]||undefined,'CampaignId':_0x171045[_0x2b0b('0xd4')]||undefined})['catch'](loggerCatch(_0x2b0b('0x102')));_0x1552c0({'reschedule':0x1});}}});}}};Dialer[_0x2b0b('0x1c')][_0x2b0b('0x38')]=function(_0x2a466d){var _0x11a964=this[_0x2b0b('0xac')][_0x2a466d['uniqueid']];var _0x4135a9=this;var _0x1fc3be;if(_0x11a964&&_0x11a964[_0x2b0b('0x53')]==='ivr'){delete this[_0x2b0b('0xac')][_0x2a466d[_0x2b0b('0xd9')]];this['updateOriginated'](this[_0x2b0b('0x22')][_0x11a964[_0x2b0b('0xb4')]]);this[_0x2b0b('0x22')][_0x11a964['queue']][_0x2b0b('0x103')]+=0x1;_0x1fc3be=new Hangup(_0x11a964,_0x2a466d);this[_0x2b0b('0xcb')](_0x1fc3be)['catch'](loggerCatch(_0x2b0b('0x104')));this[_0x2b0b('0xc9')](_0x1fc3be)[_0x2b0b('0xb1')](loggerCatch('[syncHangupIvr]'));}if(_0x11a964&&_0x11a964[_0x2b0b('0x53')]!==_0x2b0b('0x7d')&&isNotNull(this[_0x2b0b('0x21')][_0x11a964['queue']][_0x2b0b('0x105')])){delete this['uniqueId'][_0x2a466d[_0x2b0b('0xd9')]];this[_0x2b0b('0xb3')](this[_0x2b0b('0x21')][_0x11a964[_0x2b0b('0xb4')]]);this[_0x2b0b('0x21')][_0x11a964['queue']][_0x2b0b('0xde')]+=0x1;this['voiceQueues'][_0x11a964[_0x2b0b('0xb4')]][_0x2b0b('0xdf')]+=0x1;_0x1fc3be=new Hangup(_0x11a964,_0x2a466d);_0x1fc3be['state']=0x10;_0x1fc3be['statedesc']=_0x2b0b('0x106');_0x1fc3be[_0x2b0b('0xea')]=_0x2b0b('0x107');this[_0x2b0b('0xcb')](_0x1fc3be)['catch'](loggerCatch(_0x2b0b('0x104')));this['moveContactManagedDialer'](_0x1fc3be)[_0x2b0b('0xb1')](loggerCatch(_0x2b0b('0x108')));}if(_0x11a964&&_0x11a964[_0x2b0b('0x53')]!==_0x2b0b('0x7d')&&!isNotNull(this[_0x2b0b('0x21')][_0x11a964[_0x2b0b('0xb4')]][_0x2b0b('0x105')])){delete this[_0x2b0b('0xac')][_0x2a466d[_0x2b0b('0xd9')]];this[_0x2b0b('0xb3')](this['voiceQueues'][_0x11a964[_0x2b0b('0xb4')]]);this[_0x2b0b('0x21')][_0x11a964[_0x2b0b('0xb4')]][_0x2b0b('0x6b')]+=0x1;_0x1fc3be=new Hangup(_0x11a964,_0x2a466d);_0x1fc3be['state']=0xc;_0x1fc3be['statedesc']=_0x2a466d['cause-txt'];_0x1fc3be[_0x2b0b('0xea')]=_0x2b0b('0x109');this['createHistory'](_0x1fc3be)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x2b0b('0xc9')](_0x1fc3be)[_0x2b0b('0xb1')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x2b0b('0x1c')][_0x2b0b('0x35')]=function(_0xd29333){var _0x1dc5d8=this['uniqueId'][_0xd29333[_0x2b0b('0xd9')]];var _0x4bf4cd=this;if(this[_0x2b0b('0x21')][_0xd29333['queue']]){if(_0x1dc5d8&&_0x1dc5d8[_0x2b0b('0x53')]!==_0x2b0b('0x7d')){delete this[_0x2b0b('0xac')][_0xd29333[_0x2b0b('0xd9')]];this['voiceQueues'][_0xd29333['queue']]['outboundAnswerCallsDay']+=0x1;var _0x17133c=new AgentComplete(_0x1dc5d8,_0xd29333);if(_0xd29333[_0x2b0b('0x10a')]===_0x2b0b('0x10b')){_0x17133c[_0x2b0b('0x10c')]=this['voiceQueues'][_0xd29333[_0x2b0b('0xb4')]][_0x2b0b('0x10d')]&&this[_0x2b0b('0x21')][_0xd29333[_0x2b0b('0xb4')]][_0x2b0b('0x10e')]?moment()[_0x2b0b('0x7b')](_0x2b0b('0xf8')):undefined;}this[_0x2b0b('0xcb')](_0x17133c)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));this['moveContactManagedDialer'](_0x17133c)[_0x2b0b('0xb1')](loggerCatch(_0x2b0b('0x10f')));}}};Dialer[_0x2b0b('0x1c')][_0x2b0b('0x2f')]=function(_0x3a2966){if(this[_0x2b0b('0x21')][_0x3a2966[_0x2b0b('0xb4')]]){if(this[_0x2b0b('0xac')][_0x3a2966[_0x2b0b('0xd9')]]&&this[_0x2b0b('0xac')][_0x3a2966['uniqueid']][_0x2b0b('0x53')]!=='ivr'){this[_0x2b0b('0xb3')](this[_0x2b0b('0x21')][_0x3a2966['queue']]);this[_0x2b0b('0xac')][_0x3a2966['uniqueid']][_0x2b0b('0x110')]=moment()[_0x2b0b('0x7b')](_0x2b0b('0xf8'));}}};Dialer[_0x2b0b('0x1c')][_0x2b0b('0x111')]=function(_0x3e6dd1){this[_0x2b0b('0xcb')](_0x3e6dd1)[_0x2b0b('0xb1')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x2b0b('0xc9')](_0x3e6dd1)[_0x2b0b('0xb1')](loggerCatch(_0x2b0b('0x112')));};Dialer[_0x2b0b('0x1c')][_0x2b0b('0x32')]=function(_0x5c4de1){var _0x15c3ec=this[_0x2b0b('0xac')][_0x5c4de1[_0x2b0b('0xd9')]];var _0xe5c836=this;if(this[_0x2b0b('0x21')][_0x5c4de1[_0x2b0b('0xb4')]]){if(_0x15c3ec&&_0x15c3ec[_0x2b0b('0x53')]!==_0x2b0b('0x7d')){delete this['uniqueId'][_0x5c4de1['uniqueid']];this[_0x2b0b('0xb3')](this[_0x2b0b('0x21')][_0x5c4de1['queue']]);_0x15c3ec['droptime']=moment()['format'](_0x2b0b('0xf8'));var _0x5cb10a=new QueueCallerAbandon(_0x15c3ec,_0x5c4de1);if(getSeconds(_0x15c3ec['droptime'],_0x15c3ec[_0x2b0b('0x113')])>=_0x15c3ec[_0x2b0b('0x114')]){this[_0x2b0b('0x21')][_0x5c4de1[_0x2b0b('0xb4')]][_0x2b0b('0x70')]+=0x1;this[_0x2b0b('0x21')][_0x5c4de1[_0x2b0b('0xb4')]][_0x2b0b('0x67')]+=0x1;this['voiceQueues'][_0x5c4de1[_0x2b0b('0xb4')]][_0x2b0b('0x72')]+=0x1;_0x5cb10a[_0x2b0b('0xa8')]=0xa;_0x5cb10a[_0x2b0b('0xe0')]=_0x2b0b('0x115');_0x5cb10a[_0x2b0b('0x116')]='TIMEOUT';_0x5cb10a[_0x2b0b('0x10c')]=this[_0x2b0b('0x21')][_0x5c4de1[_0x2b0b('0xb4')]][_0x2b0b('0x10d')]?moment()[_0x2b0b('0x7b')](_0x2b0b('0xf8')):undefined;_0x5cb10a[_0x2b0b('0xf1')]+=0x1;_0x5cb10a[_0x2b0b('0xec')]+=0x1;if(_0x5cb10a['countdropretry']>=this[_0x2b0b('0x21')][_0x5c4de1[_0x2b0b('0xb4')]][_0x2b0b('0x117')]){this['queueCallerAbandonCreateState'](_0x5cb10a);}else{this[_0x2b0b('0xbf')]({'active':![],'countdropretry':_0x5cb10a['countdropretry'],'scheduledat':moment()[_0x2b0b('0xf6')](this[_0x2b0b('0x21')][_0x5c4de1[_0x2b0b('0xb4')]][_0x2b0b('0x118')],_0x2b0b('0xf7'))[_0x2b0b('0x7b')](_0x2b0b('0xf8')),'ContactId':_0x15c3ec[_0x2b0b('0xf9')],'ListId':_0x15c3ec[_0x2b0b('0x101')],'VoiceQueueId':_0x15c3ec[_0x2b0b('0xfa')]||undefined,'CampaignId':_0x15c3ec[_0x2b0b('0xd4')]||undefined})[_0x2b0b('0xb1')](loggerCatch(_0x2b0b('0x119')));var _0x5389c5=new History(_0x5cb10a);_0x5389c5[_0x2b0b('0xa8')]=0xa;_0x5389c5[_0x2b0b('0xe0')]='Drop';_0x5389c5['starttime']=moment()[_0x2b0b('0x7b')](_0x2b0b('0xf8'));_0x5389c5[_0x2b0b('0x11a')]=_0x5389c5[_0x2b0b('0xa9')];_0x5389c5['calleridname']=_0x5cb10a[_0x2b0b('0x11b')];_0x5389c5[_0x2b0b('0x11c')]=_0x5cb10a[_0x2b0b('0x11c')];this[_0x2b0b('0xcb')](_0x5389c5)[_0x2b0b('0xb1')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this['voiceQueues'][_0x5c4de1[_0x2b0b('0xb4')]][_0x2b0b('0x6f')]+=0x1;this[_0x2b0b('0x21')][_0x5c4de1[_0x2b0b('0xb4')]]['outboundDropCallsDayCallersExit']+=0x1;_0x5cb10a[_0x2b0b('0xa8')]=0xb;_0x5cb10a[_0x2b0b('0xe0')]='Abandoned';_0x5cb10a[_0x2b0b('0x116')]=_0x2b0b('0x11d');_0x5cb10a[_0x2b0b('0xf2')]+=0x1;_0x5cb10a[_0x2b0b('0xec')]+=0x1;if(_0x5cb10a[_0x2b0b('0xf2')]>=this[_0x2b0b('0x21')][_0x5c4de1[_0x2b0b('0xb4')]][_0x2b0b('0x11e')]){this[_0x2b0b('0x111')](_0x5cb10a);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x5cb10a['countabandonedretry'],'scheduledat':moment()['add'](this[_0x2b0b('0x21')][_0x5c4de1['queue']][_0x2b0b('0x11f')],_0x2b0b('0xf7'))[_0x2b0b('0x7b')](_0x2b0b('0xf8')),'ContactId':_0x15c3ec[_0x2b0b('0xf9')],'ListId':_0x15c3ec[_0x2b0b('0x101')],'VoiceQueueId':_0x15c3ec[_0x2b0b('0xfa')]||undefined,'CampaignId':_0x15c3ec[_0x2b0b('0xd4')]||undefined})[_0x2b0b('0xb1')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x5389c5=new History(_0x5cb10a);_0x5389c5[_0x2b0b('0xa8')]=0xb;_0x5389c5[_0x2b0b('0xe0')]='Abandoned';_0x5389c5[_0x2b0b('0xa9')]=moment()[_0x2b0b('0x7b')](_0x2b0b('0xf8'));_0x5389c5[_0x2b0b('0x11a')]=_0x5389c5[_0x2b0b('0xa9')];_0x5389c5[_0x2b0b('0x11b')]=_0x5cb10a[_0x2b0b('0x11b')];_0x5389c5[_0x2b0b('0x11c')]=_0x5cb10a[_0x2b0b('0x11c')];this[_0x2b0b('0xcb')](_0x5389c5)[_0x2b0b('0xb1')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0x2b0b('0x1c')]['syncNewExten']=function(_0x1efe53){if(this['actions'][_0x1efe53[_0x2b0b('0xd9')]]){this[_0x2b0b('0x27')][_0x1efe53[_0x2b0b('0xd9')]][_0x2b0b('0xb0')]=_0x1efe53[_0x2b0b('0xb0')];}if(this[_0x2b0b('0xac')][_0x1efe53[_0x2b0b('0xd9')]]){this[_0x2b0b('0xac')][_0x1efe53[_0x2b0b('0xd9')]]['channel']=_0x1efe53[_0x2b0b('0xb0')];}};Dialer['prototype']['syncQueueMember']=function(_0x488068){if(strategy[this[_0x2b0b('0x21')][this['actions'][_0x488068[_0x2b0b('0x120')]]['queue']][_0x2b0b('0x54')]]===_0x2b0b('0x1b')){if(this[_0x2b0b('0x27')][_0x488068['actionid']]&&_[_0x2b0b('0xad')](this[_0x2b0b('0x27')][_0x488068[_0x2b0b('0x120')]][_0x2b0b('0x121')])&&_0x488068['status']==='1'&&_0x488068[_0x2b0b('0x122')]==='0'){if(this[_0x2b0b('0x23')][_0x488068[_0x2b0b('0x123')]]){if(!this[_0x2b0b('0x23')][_0x488068[_0x2b0b('0x123')]][_0x2b0b('0x121')]){this[_0x2b0b('0x23')][_0x488068[_0x2b0b('0x123')]][_0x2b0b('0x121')]=!![];this[_0x2b0b('0x27')][_0x488068[_0x2b0b('0x120')]][_0x2b0b('0x121')]=!![];this['actions'][_0x488068['actionid']][_0x2b0b('0x123')]=_0x488068[_0x2b0b('0x123')];}}}}else if((strategy[this[_0x2b0b('0x21')][this[_0x2b0b('0x27')][_0x488068['actionid']][_0x2b0b('0xb4')]][_0x2b0b('0x54')]]||_0x2b0b('0x1a'))===_0x2b0b('0x1a')){if(this['actions'][_0x488068[_0x2b0b('0x120')]]){if(this[_0x2b0b('0x23')][_0x488068[_0x2b0b('0x123')]]){this[_0x2b0b('0x27')][_0x488068[_0x2b0b('0x120')]][_0x2b0b('0x123')]=_0x488068[_0x2b0b('0x123')];if(_[_0x2b0b('0xad')](this['queueBooked'][this['actions'][_0x488068[_0x2b0b('0x120')]][_0x2b0b('0xb4')]])){this[_0x2b0b('0x2c')][this['actions'][_0x488068[_0x2b0b('0x120')]][_0x2b0b('0xb4')]]=[];}this['queueBooked'][this[_0x2b0b('0x27')][_0x488068[_0x2b0b('0x120')]]['queue']]['push'](_[_0x2b0b('0x8f')](_[_0x2b0b('0xd2')](this[_0x2b0b('0x27')][_0x488068[_0x2b0b('0x120')]],['idHopper',_0x2b0b('0x123')]),{'status':_0x488068[_0x2b0b('0xaf')],'paused':_0x488068[_0x2b0b('0x122')]}));}}}};function unlockQueueStatus(_0x38ff0c,_0x3e8600){setTimeout(function(){if(_[_0x2b0b('0x44')](_0x38ff0c[_0x2b0b('0x124')])){loggerBooked['error'](_0x2b0b('0x125'),_0x3e8600);}_0x38ff0c['queueStatusComplete']=!![];loggerBooked[_0x2b0b('0x80')](_0x2b0b('0x126'),_0x3e8600,JSON[_0x2b0b('0x7a')](_[_0x2b0b('0xd2')](_0x38ff0c,[_0x2b0b('0x49'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x2b0b('0x1c')][_0x2b0b('0x40')]=function(_0x211c1d){var _0x315a58=this;var _0x45a7a0=_0x315a58[_0x2b0b('0x21')][_0x315a58[_0x2b0b('0x27')][_0x211c1d['actionid']][_0x2b0b('0xb4')]];if(strategy[this[_0x2b0b('0x21')][this[_0x2b0b('0x27')][_0x211c1d['actionid']][_0x2b0b('0xb4')]]['strategy']]===_0x2b0b('0x1b')){if(this[_0x2b0b('0x27')][_0x211c1d[_0x2b0b('0x120')]]&&this[_0x2b0b('0x27')][_0x211c1d[_0x2b0b('0x120')]][_0x2b0b('0x123')]){this[_0x2b0b('0x94')][_0x2b0b('0x127')](this[_0x2b0b('0x27')][_0x211c1d[_0x2b0b('0x120')]]['idHopper'],this['actions'][_0x211c1d[_0x2b0b('0x120')]][_0x2b0b('0x123')])['catch'](function(_0x4228b3){logger['error'](_0x2b0b('0x128'),util[_0x2b0b('0x99')](_0x4228b3,{'showHidden':![],'depth':null}));})[_0x2b0b('0x1f')](function(){_0x315a58[_0x2b0b('0xb3')](_0x315a58[_0x2b0b('0x21')][_0x315a58[_0x2b0b('0x27')][_0x211c1d['actionid']][_0x2b0b('0xb4')]]);_0x315a58[_0x2b0b('0x23')][_0x315a58[_0x2b0b('0x27')][_0x211c1d['actionid']]['stateinterface']][_0x2b0b('0x121')]=![];delete _0x315a58[_0x2b0b('0x27')][_0x211c1d[_0x2b0b('0x120')]];unlockQueueStatus(_0x45a7a0);});}else{this[_0x2b0b('0xb3')](this[_0x2b0b('0x21')][this[_0x2b0b('0x27')][_0x211c1d[_0x2b0b('0x120')]][_0x2b0b('0xb4')]]);this[_0x2b0b('0xbf')]({'active':![],'ContactId':this[_0x2b0b('0x27')][_0x211c1d[_0x2b0b('0x120')]][_0x2b0b('0xf9')],'ListId':this[_0x2b0b('0x27')][_0x211c1d[_0x2b0b('0x120')]][_0x2b0b('0x101')],'VoiceQueueId':this[_0x2b0b('0x27')][_0x211c1d[_0x2b0b('0x120')]][_0x2b0b('0xfa')]||undefined,'CampaignId':this[_0x2b0b('0x27')][_0x211c1d[_0x2b0b('0x120')]]['CampaignId']||undefined})['catch'](loggerCatch(_0x2b0b('0x129')));delete this[_0x2b0b('0x27')][_0x211c1d['actionid']];unlockQueueStatus(_0x45a7a0);}}else if((strategy[this[_0x2b0b('0x21')][this[_0x2b0b('0x27')][_0x211c1d[_0x2b0b('0x120')]]['queue']][_0x2b0b('0x54')]]||_0x2b0b('0x1a'))===_0x2b0b('0x1a')){var _0x5c2962;if(this[_0x2b0b('0x27')][_0x211c1d[_0x2b0b('0x120')]]&&!_[_0x2b0b('0x7f')](this[_0x2b0b('0x2c')][this['actions'][_0x211c1d[_0x2b0b('0x120')]][_0x2b0b('0xb4')]])){if(this[_0x2b0b('0x2d')][_0x315a58[_0x2b0b('0x27')][_0x211c1d[_0x2b0b('0x120')]][_0x2b0b('0xb4')]]){this[_0x2b0b('0x2d')][_0x315a58[_0x2b0b('0x27')][_0x211c1d[_0x2b0b('0x120')]]['queue']]=this[_0x2b0b('0x2d')][this[_0x2b0b('0x27')][_0x211c1d[_0x2b0b('0x120')]][_0x2b0b('0xb4')]]?this[_0x2b0b('0x2d')][this['actions'][_0x211c1d['actionid']][_0x2b0b('0xb4')]]:this[_0x2b0b('0x2c')][this[_0x2b0b('0x27')][_0x211c1d[_0x2b0b('0x120')]][_0x2b0b('0xb4')]]?this[_0x2b0b('0x2c')][this['actions'][_0x211c1d[_0x2b0b('0x120')]][_0x2b0b('0xb4')]]['_rr']||0x0:0x0;}this[_0x2b0b('0x2c')][this[_0x2b0b('0x27')][_0x211c1d[_0x2b0b('0x120')]]['queue']]['_rr']=this[_0x2b0b('0x2d')][this[_0x2b0b('0x27')][_0x211c1d[_0x2b0b('0x120')]][_0x2b0b('0xb4')]];for(var _0x387f10=0x0;_0x387f10=0x0;})[_0x2b0b('0xb1')](myreject(_0x37f883)));}}else{_0x22b271[_0x2b0b('0x146')](ami['Action']({'action':_0x2b0b('0x141'),'command':util[_0x2b0b('0x7b')]('iftime\x20%s,%s',_0xf6fb45,!_[_0x2b0b('0x44')](config[_0x2b0b('0x13d')][_0x2d321a])?_0x2d321a:'')})['then'](function(_0x5b9007){return _0x5b9007[_0x2b0b('0x143')][_0x2b0b('0x144')](_0x2b0b('0x145'))>=0x0;})[_0x2b0b('0xb1')](myreject(_0x37f883)));}BPromise[_0x2b0b('0x147')](_0x22b271)['then'](function(_0x3d20bd){var _0x29bcf7=_[_0x2b0b('0x148')](_0x3d20bd);if(_0x29bcf7){return _0x5936f4(_0x29bcf7);}else{_0x240657['message']=_0x203208?'GLOBAL_INTERVAL_IS_OVERTIME':_0x2b0b('0x149');return _0x37f883(msgResponse(_0x2b0b('0x14a'),'Failure',_0x2b0b('0x14b')+_0x203208+'\x20'+_0x389024+'\x20Interval\x20is\x20overtime:\x20'+util[_0x2b0b('0x99')](_0xf6fb45,{'showHidden':![],'depth':null})+_0x2b0b('0x14c')+_0x2d321a));}})[_0x2b0b('0xb1')](function(_0x41c96e){return _0x37f883(msgResponse(_0x2b0b('0x139'),_0x2b0b('0x13a'),JSON[_0x2b0b('0x7a')](_0x41c96e)));});});};Dialer['prototype'][_0x2b0b('0x14d')]=function(_0x36c8c3){var _0x1e402f=this;return function(){switch(_0x36c8c3[_0x2b0b('0x61')]){case'progressive':freeVariablesPredictive(_0x36c8c3);_0x1e402f[_0x2b0b('0x14e')](_0x36c8c3,0x1);break;case _0x2b0b('0x14f'):freeVariablesPredictive(_0x36c8c3);_0x1e402f['handlePower'](_0x36c8c3,_0x36c8c3[_0x2b0b('0x150')]);break;case _0x2b0b('0xb'):_0x1e402f[_0x2b0b('0xb')](_0x36c8c3);break;case _0x2b0b('0xa'):freeVariablesPredictive(_0x36c8c3);_0x1e402f[_0x2b0b('0x14e')](_0x36c8c3,0x1);break;default:freeVariablesPredictive(_0x36c8c3);logger[_0x2b0b('0x98')](_0x2b0b('0x151'),_0x36c8c3[_0x2b0b('0x49')],_0x2b0b('0x152'));}};};Dialer['prototype'][_0x2b0b('0x153')]=function(_0x4781fd){return BPromise[_0x2b0b('0xb7')]()['then'](cmHopper[_0x2b0b('0x154')](_0x4781fd['id'],previewRecallmeReminderInterval))[_0x2b0b('0x42')](function(_0x3d540c){for(var _0x22a141=0x0;_0x22a141<_0x3d540c[_0x2b0b('0x9b')];_0x22a141++){var _0x22eb19=_0x3d540c[_0x22a141][_0x2b0b('0x155')]['name'];if(_0x22eb19)io['to'](util[_0x2b0b('0x7b')](_0x2b0b('0x156'),_0x22eb19))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x3d540c[_0x22a141]});}})[_0x2b0b('0xb1')](function(_0x891c13){});};Dialer[_0x2b0b('0x1c')][_0x2b0b('0x157')]=function(_0x465b11){var _0x34fca4=this;return function(){_0x34fca4[_0x2b0b('0x158')](_0x465b11);};};Dialer[_0x2b0b('0x1c')][_0x2b0b('0xd')]=function(_0x2d7959){var _0x4ca62d=this;if(isNotPreview(_0x2d7959[_0x2b0b('0x61')])){if(isVoiceQueueOutbound(_0x2d7959[_0x2b0b('0x53')])&&isActive(_0x2d7959[_0x2b0b('0x60')])){_0x2d7959[_0x2b0b('0xa3')]=!![];BPromise[_0x2b0b('0xb7')]()[_0x2b0b('0x42')](checkIsLoggedIn(_0x2d7959,_0x2d7959[_0x2b0b('0x57')]))['then'](checkIsActive(_0x2d7959,_0x2d7959[_0x2b0b('0x60')]))[_0x2b0b('0x42')](checkInterval(_0x2d7959))[_0x2b0b('0x42')](_0x4ca62d[_0x2b0b('0x134')](_0x2d7959))[_0x2b0b('0x42')](_0x4ca62d[_0x2b0b('0x138')](_0x2d7959[_0x2b0b('0x159')],_0x2d7959[_0x2b0b('0x15a')],_0x2d7959[_0x2b0b('0x49')],_0x2d7959))[_0x2b0b('0x42')](_0x4ca62d[_0x2b0b('0x15b')](_0x2d7959[_0x2b0b('0x4c')],_0x2d7959[_0x2b0b('0x15a')],_0x2d7959[_0x2b0b('0x49')],_0x2d7959))[_0x2b0b('0x42')](_0x4ca62d[_0x2b0b('0x14d')](_0x2d7959))[_0x2b0b('0xb1')](loggerCatchQueueSummary('[syncQueueSummary]',_0x2d7959));}else{notSendMessagesQueue(_0x2d7959);}}else{freeVariablesPredictive(_0x2d7959);if(_0x2d7959['dialPreviewRecallmeReminder']){_0x4ca62d['checkPreviewRecallReminder'](_0x2d7959);}}};Dialer[_0x2b0b('0x1c')][_0x2b0b('0x133')]=function(){var _0x142042=this;var _0x235622;for(var _0x1af863 in this[_0x2b0b('0x22')]){if(typeof this['campaigns'][_0x1af863]!==_0x2b0b('0x9c')){_0x235622=this[_0x2b0b('0x22')][_0x1af863];if(isCampaignIvr(_0x235622[_0x2b0b('0x53')])&&isActive(_0x235622[_0x2b0b('0xd7')])){_0x235622[_0x2b0b('0xa3')]=!![];BPromise['resolve']()[_0x2b0b('0x42')](checkIsActive(_0x235622,_0x235622['active']))[_0x2b0b('0x42')](checkInterval(_0x235622))[_0x2b0b('0x42')](_0x142042[_0x2b0b('0x134')](_0x235622))[_0x2b0b('0x42')](_0x142042[_0x2b0b('0x138')](_0x235622[_0x2b0b('0x159')],_0x235622[_0x2b0b('0x15a')],_0x235622[_0x2b0b('0x49')],_0x235622))['then'](_0x142042[_0x2b0b('0x15b')](_0x235622['Interval'],_0x235622[_0x2b0b('0x15a')],_0x235622['name'],_0x235622))[_0x2b0b('0x42')](_0x142042['launchHandleIvr'](_0x235622))[_0x2b0b('0xb1')](loggerCatchQueueSummary(_0x2b0b('0x15c'),_0x235622));}else{notSendMessagesCampaign(_0x235622);}}}};function getCallerIdRandom(_0x17c2d2,_0x33147b){var _0x5c34bc;var _0x419de7;var _0x5eb57d;if(_0x33147b<=0x0){_0x33147b=0x1;}_0x5c34bc=new RegExp('\x5cw{0,'+_0x33147b+'}$');_0x419de7=Math[_0x2b0b('0x15d')](0xa,_0x33147b-0x1);_0x5eb57d=Math[_0x2b0b('0x15d')](0xa,_0x33147b)-0x1;return util[_0x2b0b('0x7b')]('%s',_[_0x2b0b('0x15e')](_0x17c2d2,_0x5c34bc,_['random'](_0x419de7,_0x5eb57d)));}function extractCalleridName(_0x187f99){var _0x2d0fb1=_0x187f99[_0x2b0b('0x15f')](/"(.*?)"/);return _0x2d0fb1?_0x2d0fb1[0x1]:_0x187f99;}function extractCalleridNumber(_0x49a201){var _0x322df7=_0x49a201['match'](/<(.*?)>/);return _0x322df7?_0x322df7[0x1]:_0x49a201;}Dialer[_0x2b0b('0x1c')][_0x2b0b('0x160')]=function(_0x7903dd,_0x24c21b){var _0x5a81d1=this;var _0x460136=uuid['v4']();this[_0x2b0b('0x27')][_0x460136]=new Action(_0x7903dd,_0x24c21b,_0x460136);return new BPromise(function(_0x4cc0a4,_0x3fb6c2){if(_[_0x2b0b('0x44')](_0x7903dd)&&typeof _0x7903dd!==_0x2b0b('0x161')){return _0x3fb6c2(msgResponse(_0x2b0b('0x162'),_0x2b0b('0x13a'),_0x2b0b('0x163')));}if(_[_0x2b0b('0x44')](_0x24c21b[_0x2b0b('0x164')][_0x2b0b('0x165')])||_0x24c21b[_0x2b0b('0x164')][_0x2b0b('0x165')]===null){return _0x3fb6c2(msgResponse('originate',_0x2b0b('0x13a'),_0x2b0b('0x166')));}var _0x50f9f6={'XMD-CALLERID':_0x5a81d1[_0x2b0b('0x27')][_0x460136][_0x2b0b('0x167')](),'XMD-AGI':_0x7903dd['dialQueueProject']?util[_0x2b0b('0x7b')](_0x2b0b('0x168'),ipAgi,_0x7903dd[_0x2b0b('0x105')]):_0x2b0b('0x169'),'XMD-AGIAFTER':_0x7903dd['dialQueueProject2']?util[_0x2b0b('0x7b')](_0x2b0b('0x168'),ipAgi,_0x7903dd[_0x2b0b('0x10d')]):_0x2b0b('0x169'),'XMD-QUEUE':_0x7903dd['type']==='outbound'?util['format'](_0x2b0b('0x16a'),_0x7903dd[_0x2b0b('0x49')],_0x7903dd[_0x2b0b('0x16b')]||'',_0x7903dd[_0x2b0b('0x10e')]?'c':'',_0x7903dd[_0x2b0b('0x114')]||0x3):_0x2b0b('0x169'),'XMD-CONTACTID':_0x24c21b[_0x2b0b('0xf9')],'XMD-CDRTYPE':_0x2b0b('0x9'),'CALLERID(all)':_0x5a81d1[_0x2b0b('0x27')][_0x460136]['getCaller'](),'XMD-AMD':_0x7903dd['dialAMDActive']?'ACTIVE':'NONE','XMD-DESTINATION':_0x2b0b('0xdc')};if(_0x7903dd[_0x2b0b('0xe8')]){_0x50f9f6[_0x2b0b('0x16c')]=_0x7903dd[_0x2b0b('0x16d')]||0x9c4;_0x50f9f6[_0x2b0b('0x16e')]=_0x7903dd[_0x2b0b('0x16f')]||0x5dc;_0x50f9f6[_0x2b0b('0x170')]=_0x7903dd[_0x2b0b('0x171')]||0x320;_0x50f9f6[_0x2b0b('0x172')]=_0x7903dd[_0x2b0b('0x173')]||0x1388;_0x50f9f6[_0x2b0b('0x174')]=_0x7903dd[_0x2b0b('0x175')]||0x64;_0x50f9f6['XMD-AMDBETWEENWORDSSILENCE']=_0x7903dd['dialAMDBetweenWordsSilence']||0x32;_0x50f9f6['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x7903dd[_0x2b0b('0x176')]||0x3;_0x50f9f6[_0x2b0b('0x177')]=_0x7903dd[_0x2b0b('0x178')]||0x100;_0x50f9f6[_0x2b0b('0x179')]=_0x7903dd[_0x2b0b('0x17a')]||0x1388;}if(_0x7903dd[_0x2b0b('0x53')]===_0x2b0b('0x93')){_0x50f9f6['XMD-VOICEQUEUEID']=_0x24c21b[_0x2b0b('0xfa')];}else{_0x50f9f6[_0x2b0b('0x17b')]=_0x24c21b[_0x2b0b('0xd4')];}for(var _0x7ffbed in _0x24c21b['Contact']){if(typeof _0x24c21b[_0x2b0b('0x164')][_0x7ffbed]!=='undefined'){if(isNotNull(_0x24c21b['Contact'][_0x7ffbed])&&_0x7ffbed!=='id'&&_0x7ffbed!==_0x2b0b('0x17c')&&_0x7ffbed!==_0x2b0b('0x17d')&&_0x7ffbed!==_0x2b0b('0x17e')){_0x50f9f6[util[_0x2b0b('0x7b')](_0x2b0b('0x17f'),'XMD-',_['toUpper'](_0x7ffbed))]=_0x24c21b[_0x2b0b('0x164')][_0x7ffbed];}}}var _0x466794=_0x5a81d1[_0x2b0b('0xd6')](_0x7903dd[_0x2b0b('0x79')])?getCallerId(_0x7903dd[_0x2b0b('0x79')][_0x2b0b('0x180')],_0x7903dd['dialOriginateCallerIdName'],_0x7903dd[_0x2b0b('0x181')]>0x0?getCallerIdRandom(_0x7903dd['dialOriginateCallerIdNumber'],_0x7903dd[_0x2b0b('0x181')]):_0x7903dd[_0x2b0b('0x62')]):getCallerId(_[_0x2b0b('0xad')](_0x7903dd['TrunkBackup'])?_0x7903dd[_0x2b0b('0x79')][_0x2b0b('0x180')]:_0x7903dd[_0x2b0b('0x135')][_0x2b0b('0x180')],_0x7903dd['dialOriginateCallerIdName'],_0x7903dd[_0x2b0b('0x181')]>0x0?getCallerIdRandom(_0x7903dd[_0x2b0b('0x62')],_0x7903dd[_0x2b0b('0x181')]):_0x7903dd[_0x2b0b('0x62')]);if(_0x466794){_0x50f9f6[_0x2b0b('0x182')]=_0x5a81d1[_0x2b0b('0x27')][_0x460136][_0x2b0b('0x183')]=extractCalleridName(_0x466794);_0x50f9f6['XMD-ORIGINATECALLERIDNUM']=_0x5a81d1[_0x2b0b('0x27')][_0x460136][_0x2b0b('0x184')]=extractCalleridNumber(_0x466794);}return ami[_0x2b0b('0xae')]({'actionid':_0x460136,'action':_0x2b0b('0x162'),'channel':_0x5a81d1[_0x2b0b('0xd6')](_0x7903dd[_0x2b0b('0x79')])?util['format'](_0x2b0b('0x185'),_0x7903dd[_0x2b0b('0x79')]['name'],isNotNull(_0x7903dd['dialPrefix'])?_0x7903dd[_0x2b0b('0x64')][_0x2b0b('0x186')]()||'':'',_0x7903dd[_0x2b0b('0x187')]>0x0?_0x24c21b['Contact']['phone'][_0x2b0b('0x188')](_0x7903dd['dialCutDigit']):_0x24c21b[_0x2b0b('0x164')][_0x2b0b('0x165')]):util[_0x2b0b('0x7b')](_0x2b0b('0x185'),_[_0x2b0b('0xad')](_0x7903dd[_0x2b0b('0x135')])?_0x7903dd[_0x2b0b('0x79')]['name']:_0x7903dd[_0x2b0b('0x135')][_0x2b0b('0x49')],isNotNull(_0x7903dd[_0x2b0b('0x64')])?_0x7903dd['dialPrefix'][_0x2b0b('0x186')]()||'':'',_0x7903dd[_0x2b0b('0x187')]>0x0?_0x24c21b[_0x2b0b('0x164')][_0x2b0b('0x165')][_0x2b0b('0x188')](_0x7903dd[_0x2b0b('0x187')]):_0x24c21b[_0x2b0b('0x164')][_0x2b0b('0x165')]),'callerid':_0x466794,'Exten':'xcally-motion-dialer','Context':_0x2b0b('0x189'),'Priority':'1','variable':_0x50f9f6,'timeout':(_0x7903dd[_0x2b0b('0x63')]||0x1e)*0x3e8,'async':!![],'channelid':_0x460136})[_0x2b0b('0x42')](function(_0x76633f){return _0x4cc0a4(_0x76633f);})['catch'](function(_0x2a8b49){_0x7903dd['outboundOriginateFailureCallsDay']+=0x1;var _0x1706e4=new History(_0x5a81d1[_0x2b0b('0x27')][_0x460136]);logger['error'](util['format'](_0x2b0b('0x18a'),JSON[_0x2b0b('0x7a')](_0x2a8b49)));_0x1706e4[_0x2b0b('0xa8')]=0xe;_0x1706e4['statedesc']=_0x2b0b('0x18b');_0x1706e4[_0x2b0b('0xa9')]=moment()[_0x2b0b('0x7b')]('YYYY-MM-DD\x20HH:mm:ss');_0x1706e4[_0x2b0b('0x11a')]=_0x1706e4[_0x2b0b('0xa9')];_0x5a81d1[_0x2b0b('0xcb')](_0x1706e4)['catch'](loggerCatch(_0x2b0b('0x18c')));_0x5a81d1[_0x2b0b('0xc9')](_0x1706e4)[_0x2b0b('0xb1')](loggerCatch(_0x2b0b('0x18c')))[_0x2b0b('0x1f')](function(){delete _0x5a81d1[_0x2b0b('0x27')][_0x460136];return _0x3fb6c2(msgResponse(_0x2b0b('0x162'),'Error',_0x2b0b('0x18d')));});});});};Dialer[_0x2b0b('0x1c')][_0x2b0b('0x33')]=function(_0x4e098a){var _0x249b9f=this[_0x2b0b('0x27')][_0x4e098a[_0x2b0b('0x120')]];if(_0x249b9f){delete this[_0x2b0b('0x27')][_0x4e098a[_0x2b0b('0x120')]];_0x249b9f[_0x2b0b('0x113')]=moment()[_0x2b0b('0x7b')]('YYYY-MM-DD\x20HH:mm:ss');var _0xa58698=_0x249b9f[_0x2b0b('0x53')]===_0x2b0b('0x7d')?this['campaigns'][_0x249b9f['queue']]:this['voiceQueues'][_0x249b9f[_0x2b0b('0x18e')]()];if(!this[_0x2b0b('0x18f')](_0x4e098a['response'])){this['updateOriginated'](_0xa58698);return this[_0x2b0b('0x190')](_0x249b9f,_0xa58698,_0x4e098a)[_0x2b0b('0xb1')](loggerCatch(_0x2b0b('0x191')));}this[_0x2b0b('0xac')][_0x4e098a[_0x2b0b('0xd9')]]=_0x249b9f;}};Dialer[_0x2b0b('0x1c')][_0x2b0b('0x192')]=function(_0x25ff5e,_0x472861,_0x3f75d3){var _0x54c99e=new History(_0x472861);if(_0x54c99e[_0x2b0b('0xee')]+_0x54c99e[_0x2b0b('0xfd')]+_0x54c99e[_0x2b0b('0xef')]+_0x54c99e['countnosuchnumberretry']+_0x54c99e[_0x2b0b('0xf1')]+_0x54c99e['countabandonedretry']+_0x54c99e[_0x2b0b('0xeb')]+_0x54c99e['countagentrejectretry']>=_0x3f75d3[_0x2b0b('0xf3')]-0x1){return!![];}switch(_0x25ff5e){case 0x3:if(_0x54c99e['countnoanswerretry']>=_0x3f75d3[_0x2b0b('0x193')]-0x1){return!![];}this[_0x2b0b('0xbf')]({'active':![],'countnoanswerretry':_0x54c99e[_0x2b0b('0xef')]+=0x1,'scheduledat':moment()[_0x2b0b('0xf6')](_0x3f75d3[_0x2b0b('0x194')],_0x2b0b('0xf7'))['format'](_0x2b0b('0xf8')),'ContactId':_0x54c99e['ContactId'],'ListId':_0x54c99e[_0x2b0b('0x101')],'VoiceQueueId':_0x54c99e['VoiceQueueId']||undefined,'CampaignId':_0x54c99e[_0x2b0b('0xd4')]||undefined})[_0x2b0b('0xb1')](loggerCatch(_0x2b0b('0x195')));break;case 0x5:if(_0x54c99e['countbusyretry']>=_0x3f75d3[_0x2b0b('0x196')]-0x1){return!![];}this[_0x2b0b('0xbf')]({'active':![],'countbusyretry':_0x54c99e[_0x2b0b('0xee')]+=0x1,'scheduledat':moment()[_0x2b0b('0xf6')](_0x3f75d3[_0x2b0b('0x197')],'minutes')[_0x2b0b('0x7b')](_0x2b0b('0xf8')),'ContactId':_0x54c99e[_0x2b0b('0xf9')],'ListId':_0x54c99e[_0x2b0b('0x101')],'VoiceQueueId':_0x54c99e['VoiceQueueId']||undefined,'CampaignId':_0x54c99e[_0x2b0b('0xd4')]||undefined})[_0x2b0b('0xb1')](loggerCatch(_0x2b0b('0x198')));break;case 0x8:if(_0x54c99e['countcongestionretry']>=_0x3f75d3[_0x2b0b('0x199')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x54c99e[_0x2b0b('0xfd')]+=0x1,'scheduledat':moment()['add'](_0x3f75d3[_0x2b0b('0x19a')],_0x2b0b('0xf7'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x54c99e[_0x2b0b('0xf9')],'ListId':_0x54c99e['ListId'],'VoiceQueueId':_0x54c99e[_0x2b0b('0xfa')]||undefined,'CampaignId':_0x54c99e[_0x2b0b('0xd4')]||undefined})[_0x2b0b('0xb1')](loggerCatch(_0x2b0b('0x19b')));break;case 0x0:if(_0x54c99e[_0x2b0b('0xf0')]>=_0x3f75d3[_0x2b0b('0x19c')]-0x1){return!![];}else{this[_0x2b0b('0xbf')]({'active':![],'countnosuchnumberretry':_0x54c99e[_0x2b0b('0xf0')]+=0x1,'scheduledat':moment()[_0x2b0b('0xf6')](_0x3f75d3[_0x2b0b('0x19d')],_0x2b0b('0xf7'))['format'](_0x2b0b('0xf8')),'ContactId':_0x54c99e['ContactId'],'ListId':_0x54c99e[_0x2b0b('0x101')],'VoiceQueueId':_0x54c99e[_0x2b0b('0xfa')]||undefined,'CampaignId':_0x54c99e[_0x2b0b('0xd4')]||undefined})[_0x2b0b('0xb1')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x54c99e[_0x2b0b('0xf1')]>=_0x3f75d3['dialDropMaxRetry']-0x1){return!![];}this[_0x2b0b('0xbf')]({'active':![],'countdropretry':_0x54c99e[_0x2b0b('0xf1')]+=0x1,'scheduledat':moment()[_0x2b0b('0xf6')](_0x3f75d3['dialDropRetryFrequency'],_0x2b0b('0xf7'))[_0x2b0b('0x7b')](_0x2b0b('0xf8')),'ContactId':_0x54c99e[_0x2b0b('0xf9')],'ListId':_0x54c99e[_0x2b0b('0x101')],'VoiceQueueId':_0x54c99e['VoiceQueueId']||undefined,'CampaignId':_0x54c99e[_0x2b0b('0xd4')]||undefined})['catch'](loggerCatch(_0x2b0b('0x119')));break;case 0xb:if(_0x54c99e[_0x2b0b('0xf2')]>=_0x3f75d3[_0x2b0b('0x11e')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x54c99e['countabandonedretry']+=0x1,'scheduledat':moment()[_0x2b0b('0xf6')](_0x3f75d3['dialAbandonedRetryFrequency'],'minutes')['format'](_0x2b0b('0xf8')),'ContactId':_0x54c99e[_0x2b0b('0xf9')],'ListId':_0x54c99e['ListId'],'VoiceQueueId':_0x54c99e[_0x2b0b('0xfa')]||undefined,'CampaignId':_0x54c99e['CampaignId']||undefined})[_0x2b0b('0xb1')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x54c99e[_0x2b0b('0xeb')]>=_0x3f75d3[_0x2b0b('0xf5')]-0x1){return!![];}this[_0x2b0b('0xbf')]({'active':![],'countmachineretry':_0x54c99e[_0x2b0b('0xeb')]+=0x1,'scheduledat':moment()['add'](_0x3f75d3[_0x2b0b('0x19e')],_0x2b0b('0xf7'))[_0x2b0b('0x7b')](_0x2b0b('0xf8')),'ContactId':_0x54c99e[_0x2b0b('0xf9')],'ListId':_0x54c99e[_0x2b0b('0x101')],'VoiceQueueId':_0x54c99e[_0x2b0b('0xfa')]||undefined,'CampaignId':_0x54c99e[_0x2b0b('0xd4')]||undefined})[_0x2b0b('0xb1')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x54c99e[_0x2b0b('0xfe')]>=_0x3f75d3[_0x2b0b('0x19f')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x54c99e[_0x2b0b('0xfe')]+=0x1,'scheduledat':moment()[_0x2b0b('0xf6')](_0x3f75d3[_0x2b0b('0x1a0')],_0x2b0b('0xf7'))[_0x2b0b('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x54c99e[_0x2b0b('0xf9')],'ListId':_0x54c99e['ListId'],'VoiceQueueId':_0x54c99e['VoiceQueueId']||undefined,'CampaignId':_0x54c99e['CampaignId']||undefined})['catch'](loggerCatch(_0x2b0b('0x1a1')));break;default:return!![];}};Dialer[_0x2b0b('0x1c')][_0x2b0b('0x190')]=function(_0x43cc09,_0x49e740,_0x48e144){var _0x535456=this;var _0x14a2bd=new History(_0x43cc09);return new BPromise(function(_0xc97bf7,_0x3dd33b){if(_[_0x2b0b('0x44')](_0x49e740)&&typeof _0x49e740!==_0x2b0b('0x161')){return _0x3dd33b(msgResponse(_0x2b0b('0x1a2'),_0x2b0b('0x13a'),_0x2b0b('0x1a3')));}if(_[_0x2b0b('0x44')](_0x48e144)&&typeof _0x48e144!==_0x2b0b('0x161')){return _0x3dd33b(msgResponse(_0x2b0b('0x1a2'),'Failure',_0x2b0b('0x1a4')));}switch(_0x48e144['reason']){case'0':_0x49e740[_0x2b0b('0x68')]+=0x1;_0x14a2bd['state']=0x0;_0x14a2bd[_0x2b0b('0xe0')]=_0x2b0b('0x1a5');_0x14a2bd[_0x2b0b('0xf0')]+=0x1;_0x14a2bd['countglobal']+=0x1;ami[_0x2b0b('0x52')](_0x2b0b('0x1a6'),ut[_0x2b0b('0xe4')](_0x43cc09,_0x2b0b('0x1a7')));_0x535456[_0x2b0b('0xcb')](_0x14a2bd)[_0x2b0b('0xb1')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x535456['checkRetriveMax'](0x0,_0x43cc09,_0x49e740)){if(_0x14a2bd[_0x2b0b('0xf0')]>=_0x49e740[_0x2b0b('0x19c')]){_0x535456[_0x2b0b('0x100')](_0x14a2bd,_0xc97bf7,_0x3dd33b,_0x2b0b('0x1a8'));}else{_0x535456[_0x2b0b('0xff')](_0x14a2bd,_0xc97bf7,_0x3dd33b,_0x2b0b('0x1a8'));}}break;case'3':_0x49e740['outboundNoAnswerCallsDay']+=0x1;_0x14a2bd[_0x2b0b('0xa8')]=0x3;_0x14a2bd[_0x2b0b('0xe0')]='NoAnswer';_0x14a2bd[_0x2b0b('0xef')]+=0x1;_0x14a2bd[_0x2b0b('0xec')]+=0x1;ami[_0x2b0b('0x52')]('custom:agentnoanswer',ut['buildObj'](_0x43cc09,'noanswer'));_0x535456['createHistory'](_0x14a2bd)[_0x2b0b('0xb1')](loggerCatch(_0x2b0b('0x1a9')));if(_0x535456['checkRetriveMax'](0x3,_0x43cc09,_0x49e740)){if(_0x14a2bd[_0x2b0b('0xef')]>=_0x49e740[_0x2b0b('0x193')]){_0x535456['createStateFinal'](_0x14a2bd,_0xc97bf7,_0x3dd33b,_0x2b0b('0x1aa'));}else{_0x535456[_0x2b0b('0xff')](_0x14a2bd,_0xc97bf7,_0x3dd33b,_0x2b0b('0x1aa'));}}break;case'5':_0x49e740[_0x2b0b('0x1ab')]+=0x1;_0x14a2bd['state']=0x5;_0x14a2bd[_0x2b0b('0xe0')]=_0x2b0b('0x1ac');_0x14a2bd['countbusyretry']+=0x1;_0x14a2bd[_0x2b0b('0xec')]+=0x1;ami[_0x2b0b('0x52')](_0x2b0b('0x1ad'),ut[_0x2b0b('0xe4')](_0x43cc09,_0x2b0b('0x1ae')));_0x535456[_0x2b0b('0xcb')](_0x14a2bd)[_0x2b0b('0xb1')](loggerCatch(_0x2b0b('0x1af')));if(_0x535456[_0x2b0b('0x192')](0x5,_0x43cc09,_0x49e740)){if(_0x14a2bd['countbusyretry']>=_0x49e740[_0x2b0b('0x196')]){_0x535456[_0x2b0b('0x100')](_0x14a2bd,_0xc97bf7,_0x3dd33b,_0x2b0b('0x1b0'));}else{_0x535456['stateGlobal'](_0x14a2bd,_0xc97bf7,_0x3dd33b,'reason\x205\x20busy');}}break;case'8':_0x49e740[_0x2b0b('0x65')]+=0x1;_0x14a2bd[_0x2b0b('0xa8')]=0x8;_0x14a2bd[_0x2b0b('0xe0')]=_0x2b0b('0x1b1');_0x14a2bd[_0x2b0b('0xfd')]+=0x1;_0x14a2bd[_0x2b0b('0xec')]+=0x1;ami[_0x2b0b('0x52')](_0x2b0b('0x1b2'),ut['buildObj'](_0x43cc09,_0x2b0b('0x1b3')));_0x535456[_0x2b0b('0xcb')](_0x14a2bd)[_0x2b0b('0xb1')](loggerCatch(_0x2b0b('0x1b4')));if(_0x535456['checkRetriveMax'](0x8,_0x43cc09,_0x49e740)){if(_0x14a2bd[_0x2b0b('0xfd')]>=_0x49e740['dialCongestionMaxRetry']){_0x535456[_0x2b0b('0x100')](_0x14a2bd,_0xc97bf7,_0x3dd33b,_0x2b0b('0x1b5'));}else{_0x535456[_0x2b0b('0xff')](_0x14a2bd,_0xc97bf7,_0x3dd33b,'reason\x208\x20congestion');}}break;case'11':_0x49e740['outboundAbandonedCallsDay']+=0x1;_0x14a2bd[_0x2b0b('0xa8')]=0xb;_0x14a2bd[_0x2b0b('0xe0')]=_0x2b0b('0x1b6');_0x14a2bd['countabandonedretry']+=0x1;_0x14a2bd[_0x2b0b('0xec')]+=0x1;_0x535456[_0x2b0b('0xcb')](_0x14a2bd)[_0x2b0b('0xb1')](loggerCatch(_0x2b0b('0x1b7')));if(_0x535456[_0x2b0b('0x192')](0xb,_0x43cc09,_0x49e740)){if(_0x14a2bd[_0x2b0b('0xf2')]>=_0x49e740[_0x2b0b('0x11e')]){_0x535456[_0x2b0b('0x100')](_0x14a2bd,_0xc97bf7,_0x3dd33b,_0x2b0b('0x1b8'));}else{_0x535456[_0x2b0b('0xff')](_0x14a2bd,_0xc97bf7,_0x3dd33b,'reason\x2011\x20abandoned');}}break;case'20':_0x49e740[_0x2b0b('0x1b9')]+=0x1;_0x14a2bd[_0x2b0b('0xa8')]=0x14;_0x14a2bd[_0x2b0b('0xe0')]='AgentReject';_0x14a2bd[_0x2b0b('0xfe')]+=0x1;_0x14a2bd[_0x2b0b('0xec')]+=0x1;ami[_0x2b0b('0x52')]('custom:agentreject',ut[_0x2b0b('0xe4')](_0x43cc09,_0x2b0b('0x1ba')));_0x535456['createHistory'](_0x14a2bd)[_0x2b0b('0xb1')](loggerCatch(_0x2b0b('0x1bb')));if(_0x535456[_0x2b0b('0x192')](0x14,_0x43cc09,_0x49e740)){if(_0x14a2bd[_0x2b0b('0xfe')]>=_0x49e740[_0x2b0b('0x19f')]){_0x535456[_0x2b0b('0x100')](_0x14a2bd,_0xc97bf7,_0x3dd33b,'reason\x2020\x20agentreject');}else{_0x535456['stateGlobal'](_0x14a2bd,_0xc97bf7,_0x3dd33b,_0x2b0b('0x1bc'));}}break;default:_0x49e740[_0x2b0b('0x6b')]+=0x1;_0x14a2bd['state']=0xc;_0x14a2bd[_0x2b0b('0xe0')]=_0x48e144[_0x2b0b('0x10a')];_0x535456[_0x2b0b('0xcb')](_0x14a2bd)[_0x2b0b('0xb1')](loggerCatch(_0x2b0b('0x1bd')));if(_0x535456['checkRetriveMax'](_0x48e144['reason'],_0x43cc09,_0x49e740)){if(_0x14a2bd['countbusyretry']+_0x14a2bd[_0x2b0b('0xfd')]+_0x14a2bd['countnoanswerretry']+_0x14a2bd[_0x2b0b('0xf0')]+_0x14a2bd[_0x2b0b('0xf1')]+_0x14a2bd[_0x2b0b('0xf2')]+_0x14a2bd[_0x2b0b('0xeb')]+_0x14a2bd['countagentrejectretry']>=_0x49e740[_0x2b0b('0xf3')]){_0x535456[_0x2b0b('0xff')](_0x14a2bd,_0xc97bf7,_0x3dd33b,_0x48e144[_0x2b0b('0x10a')]);}else{_0x535456[_0x2b0b('0x100')](_0x14a2bd,_0xc97bf7,_0x3dd33b,_0x48e144[_0x2b0b('0x10a')]);}}}});};Dialer[_0x2b0b('0x1c')]['stateGlobal']=function(_0x546239,_0x587ada,_0x64601f,_0x3db173){var _0x219f6e=new Final(_0x546239);_0x219f6e[_0x2b0b('0xa8')]=0xf;_0x219f6e['statedesc']=_0x2b0b('0x1be');this[_0x2b0b('0x100')](_0x219f6e,_0x587ada,_0x64601f,_0x3db173);};Dialer[_0x2b0b('0x1c')][_0x2b0b('0x100')]=function(_0x45cdaf,_0x3c5496,_0x5728a8,_0x419653){this[_0x2b0b('0xc9')](_0x45cdaf)[_0x2b0b('0x42')](function(){return _0x3c5496(msgResponse(_0x2b0b('0x1a2'),_0x2b0b('0x1bf'),_0x419653));})[_0x2b0b('0xb1')](function(){return _0x5728a8(msgResponse(_0x2b0b('0x1c0'),_0x2b0b('0x13a'),'contact\x20not\x20moved'));});};Dialer['prototype'][_0x2b0b('0xb')]=function(_0x22c155){var _0x3adb20=_0x22c155[_0x2b0b('0x1c1')]/0x64;var _0x393464=_0x22c155['outboundDropCallsDayTimeout']/(_0x22c155[_0x2b0b('0x67')]+_0x22c155['outboundAnswerCallsDay']);var _0x20df90=Math[_0x2b0b('0x1c2')](_0x22c155[_0x2b0b('0x74')]*(_0x22c155['predictiveIntervalMaxThreshold']/0x64));var _0xc11b20=Math[_0x2b0b('0x1c2')](_0x22c155[_0x2b0b('0x74')]*(_0x22c155[_0x2b0b('0x1c3')]/0x64));var _0x1b4e77=_0x22c155[_0x2b0b('0x56')]+_0x22c155[_0x2b0b('0x5b')];var _0x219611=Math[_0x2b0b('0x1c4')](_0x22c155[_0x2b0b('0x8b')]*_0x22c155['erlangAbandonmentRate']*_0x22c155[_0x2b0b('0x1c5')]*_0x22c155[_0x2b0b('0x73')]);if(_[_0x2b0b('0x44')](_0x22c155[_0x2b0b('0x2a')])){if(!_[_0x2b0b('0x44')](_0x22c155[_0x2b0b('0x29')])){_0x22c155[_0x2b0b('0x29')]=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0x2b0b('0x1c6'));}if(!_[_0x2b0b('0x44')](_0x22c155[_0x2b0b('0x92')])){loggerPredictive[_0x2b0b('0x98')](_0x2b0b('0x1c7'),_0x2b0b('0x1c8'));clearInterval(_0x22c155[_0x2b0b('0x92')]);_0x22c155[_0x2b0b('0x92')]=undefined;}_0x22c155[_0x2b0b('0x2a')]=moment()[_0x2b0b('0x7b')](_0x2b0b('0xf8'));loggerPredictive['info'](_0x22c155[_0x2b0b('0x49')],_0x2b0b('0x1c9'),_0x22c155[_0x2b0b('0x2a')]);this[_0x2b0b('0x14e')](_0x22c155,0x1);}else if(ifInterval(_0x22c155[_0x2b0b('0x1ca')],_0x22c155[_0x2b0b('0x2a')])){this[_0x2b0b('0x14e')](_0x22c155,0x1);loggerPredictiveCalls[_0x2b0b('0x80')](_0x2b0b('0x1cb'),_0x22c155[_0x2b0b('0x2a')],_0x22c155[_0x2b0b('0x49')]);_0x22c155['erlangCalls']=0x0;_0x22c155[_0x2b0b('0x72')]=0x0;}else if(_0x3adb20<_0x393464&&_0x22c155[_0x2b0b('0x1cc')]===_0x2b0b('0x1cd')){freeVariablesPredictive(_0x22c155);loggerPredictive[_0x2b0b('0x80')](_0x2b0b('0x1ce'),_0x2b0b('0x1cf'),_0x393464,_0x2b0b('0x2a'),_0x22c155[_0x2b0b('0x49')]);}else if(_0x219611<_0x22c155['predictiveIntervalErlangCallsDroppedCalls']&&_0x22c155[_0x2b0b('0x1cc')]===_0x2b0b('0x1cd')){freeVariablesPredictive(_0x22c155);loggerPredictive[_0x2b0b('0x80')](_0x2b0b('0x1d0'),_0x2b0b('0x1d1'),_0x219611,_0x2b0b('0x1d2'),_0x22c155[_0x2b0b('0x72')],_0x2b0b('0x2a'),_0x22c155[_0x2b0b('0x49')]);}else if(!ifInterval(_0x22c155[_0x2b0b('0x1ca')],_0x22c155[_0x2b0b('0x2a')])&&_[_0x2b0b('0x44')](_0x22c155['startPredictive'])&&!_[_0x2b0b('0x44')](_0x22c155[_0x2b0b('0x2a')])){_0x22c155[_0x2b0b('0x29')]=moment()[_0x2b0b('0x7b')](_0x2b0b('0xf8'));loggerPredictive[_0x2b0b('0x80')](_0x22c155[_0x2b0b('0x49')],'started\x20in\x20predictive\x20at',_0x22c155['startPredictive']);this['averageHandleTime'](_0x22c155['dialPredictiveInterval'])[_0x2b0b('0x42')](this[_0x2b0b('0x1d3')](_0x22c155))[_0x2b0b('0x42')](mergeDataErlangB(_0x22c155))['then'](this[_0x2b0b('0x1d4')](_0x22c155))[_0x2b0b('0xb1')](loggerCatchPredictive(_0x2b0b('0x1d5'),_0x22c155));}else if(!ifInterval(_0x22c155[_0x2b0b('0x1ca')],_0x22c155[_0x2b0b('0x29')])){_0x22c155[_0x2b0b('0x72')]=0x0;_0x22c155[_0x2b0b('0x29')]=moment()[_0x2b0b('0x7b')](_0x2b0b('0xf8'));loggerPredictive[_0x2b0b('0x80')](_0x22c155[_0x2b0b('0x49')],_0x2b0b('0x1d6'),_0x22c155[_0x2b0b('0x29')]);clearInterval(_0x22c155[_0x2b0b('0x92')]);_0x22c155[_0x2b0b('0x92')]=undefined;this[_0x2b0b('0xbd')](_0x22c155[_0x2b0b('0x1ca')])[_0x2b0b('0x42')](this[_0x2b0b('0x1d3')](_0x22c155))[_0x2b0b('0x42')](mergeDataErlangB(_0x22c155))[_0x2b0b('0x42')](this[_0x2b0b('0x1d4')](_0x22c155))[_0x2b0b('0xb1')](loggerCatchPredictive(_0x2b0b('0x1d7'),_0x22c155));}else if(_0x22c155[_0x2b0b('0x74')]&&_0x1b4e77<_0x22c155[_0x2b0b('0x74')]-_0xc11b20){freeVariablesPredictive(_0x22c155);loggerPredictive[_0x2b0b('0x80')](_0x22c155[_0x2b0b('0x49')],_0x2b0b('0x1d8'),_0x1b4e77,_0x2b0b('0x1d9'),_0x22c155[_0x2b0b('0x74')],'-',_0xc11b20,'=',_0x22c155[_0x2b0b('0x74')]-_0xc11b20,')');}else if(_0x22c155[_0x2b0b('0x74')]&&_0x1b4e77>_0x22c155[_0x2b0b('0x74')]+_0x20df90){freeVariablesPredictive(_0x22c155);loggerPredictive[_0x2b0b('0x80')](_0x22c155['name'],_0x2b0b('0x1d8'),_0x1b4e77,_0x2b0b('0x1da'),_0x22c155['predictiveIntervalAvailable'],'+',_0x20df90,'=',_0x22c155[_0x2b0b('0x74')]+_0x20df90,')');}};Dialer['prototype'][_0x2b0b('0x1d3')]=function(_0x4b368b){var _0x470e70=this;return function(_0x2082bd){return new BPromise(function(_0x503cfa,_0x2774f4){_[_0x2b0b('0x8f')](_0x4b368b,_0x2082bd[0x0]);if(checkGetDataPredictive(_0x2082bd[0x0])){var _0x31967c=_0x4b368b[_0x2b0b('0x74')]=_0x4b368b['talking']+_0x4b368b[_0x2b0b('0x56')];var _0x4823fc=_0x4b368b['dialPredictiveInterval']*0x3c;var _0x5824ee=_0x2082bd[0x0][_0x2b0b('0x6e')]+_0x2082bd[0x0][_0x2b0b('0x6d')];var _0x397975=(_0x2082bd[0x0][_0x2b0b('0x6c')]+_0x2082bd[0x0][_0x2b0b('0x70')]+_0x2082bd[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x2082bd[0x0][_0x2b0b('0x75')];_0x4b368b['predictiveIntervalHitRate']=_0x397975>0x0?_0x397975:0x1;switch(_0x4b368b['dialPredictiveOptimization']){case _0x2b0b('0x1cd'):var _0xcf2ef7=_0x4b368b[_0x2b0b('0x1c1')]/0x64;return _0x470e70[_0x2b0b('0x1db')](_0x31967c,_0x4823fc,_0x5824ee,_0x397975,_0xcf2ef7)[_0x2b0b('0x42')](function(_0xd1f85b){return _0x503cfa(_0xd1f85b);});case _0x2b0b('0x1dc'):var _0x50c82a=_0x4b368b[_0x2b0b('0x1c1')]/0x64;return _0x470e70[_0x2b0b('0x1dd')](_0x31967c,_0x4823fc,_0x5824ee,_0x397975,_0x50c82a)[_0x2b0b('0x42')](function(_0xce6f6e){return _0x503cfa(_0xce6f6e);});default:return _0x2774f4(msgResponse('[getDataPredictive]',_0x2b0b('0x13a'),_0x2b0b('0x1de')));}}else{return _0x2774f4(msgResponse('[getDataPredictive]','Failure',_0x2b0b('0x1df')));}});};};Dialer['prototype'][_0x2b0b('0x1e0')]=function(_0x23e11f){var _0x19e9d7=this;return function(_0x34a976){return new BPromise(function(_0xba6ccf,_0x3aceeb){_['merge'](_0x23e11f,_0x34a976[0x0]);if(checkGetDataPredictive(_0x34a976[0x0])){loggerPredictive[_0x2b0b('0x80')](JSON[_0x2b0b('0x7a')](_0x34a976[0x0]));if(_0x23e11f['dialPredictiveOptimization']===_0x2b0b('0x1cd')){return _0x19e9d7[_0x2b0b('0xc7')](_0x23e11f['id'])[_0x2b0b('0x42')](function(_0x1a6841){var _0x26d23a=_0x23e11f[_0x2b0b('0x57')]-_0x1a6841[0x0][_0x2b0b('0x1e1')];var _0x1e4600=_0x23e11f[_0x2b0b('0x1ca')]*0x3c;var _0xa2ac8d=_0x34a976[0x0][_0x2b0b('0x6e')]+_0x34a976[0x0]['predictiveIntervalAvgHoldtime'];var _0xf9e907=(_0x34a976[0x0]['predictiveIntervalAnsweredCalls']+_0x34a976[0x0][_0x2b0b('0x70')]+_0x34a976[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x34a976[0x0][_0x2b0b('0x75')];var _0x21ed6e=_0x23e11f[_0x2b0b('0x1c1')]/0x64;_0x23e11f[_0x2b0b('0x1e2')]=_0x1a6841[0x0][_0x2b0b('0x1e1')]||0x0;_0x23e11f['predictiveIntervalHitRate']=_0xf9e907>0x0?_0xf9e907:0x1;return _0x19e9d7[_0x2b0b('0x1db')](_0x26d23a,_0x1e4600,_0xa2ac8d,_0xf9e907,_0x21ed6e);})['then'](function(_0x3ae9d7){return _0xba6ccf(_0x3ae9d7);})[_0x2b0b('0xb1')](function(_0x5d4771){return _0x3aceeb(msgResponse(_0x2b0b('0x1e3'),_0x2b0b('0x13a'),JSON[_0x2b0b('0x7a')](_0x5d4771)));});}if(_0x23e11f['dialPredictiveOptimization']===_0x2b0b('0x1dc')){return _0x19e9d7[_0x2b0b('0xc7')](_0x23e11f['id'])[_0x2b0b('0x42')](function(_0x1bf76f){var _0x5de095=_0x23e11f[_0x2b0b('0x57')]-_0x1bf76f[0x0][_0x2b0b('0x1e1')];var _0x169df1=_0x23e11f[_0x2b0b('0x1ca')]*0x3c;var _0x4792c7=_0x34a976[0x0]['predictiveIntervalAvgTalktime']+_0x34a976[0x0]['predictiveIntervalAvgHoldtime'];var _0x228578=(_0x34a976[0x0]['predictiveIntervalAnsweredCalls']+_0x34a976[0x0][_0x2b0b('0x70')]+_0x34a976[0x0][_0x2b0b('0x6f')])/_0x34a976[0x0][_0x2b0b('0x75')];var _0x703689=_0x23e11f[_0x2b0b('0x1c1')]/0x64;_0x23e11f[_0x2b0b('0x1e2')]=_0x1bf76f[0x0][_0x2b0b('0x1e1')]||0x0;_0x23e11f[_0x2b0b('0x1c5')]=_0x228578>0x0?_0x228578:0x1;return _0x19e9d7[_0x2b0b('0x1dd')](_0x5de095,_0x169df1,_0x4792c7,_0x228578,_0x703689);})[_0x2b0b('0x42')](function(_0x331206){return _0xba6ccf(_0x331206);})[_0x2b0b('0xb1')](function(_0x4aeedd){return _0x3aceeb(msgResponse(_0x2b0b('0x1e3'),_0x2b0b('0x13a'),JSON[_0x2b0b('0x7a')](_0x4aeedd)));});}}else{return _0x3aceeb(msgResponse(_0x2b0b('0x1e4'),_0x2b0b('0x13a'),_0x2b0b('0x1df')));}});};};Dialer[_0x2b0b('0x1c')][_0x2b0b('0x1d4')]=function(_0x3fcdf5){var _0x39eb36=this;return function(){var _0x431bea=0x0;var _0x13314d=Math[_0x2b0b('0x1c4')](_0x3fcdf5[_0x2b0b('0x8c')]*0x3e8);if(_0x13314d>0x0){_0x13314d=_0x13314d<0x64?0x64:_0x13314d;loggerPredictive[_0x2b0b('0x80')](_0x3fcdf5[_0x2b0b('0x49')],_0x2b0b('0x1e5'),_0x13314d,'milliseconds');_0x3fcdf5[_0x2b0b('0x92')]=setInterval(function(){_0x39eb36['handlePredictive'](_0x3fcdf5);loggerPredictiveCalls[_0x2b0b('0x80')](_0x2b0b('0x1e6'),_0x431bea+=0x1);},_0x13314d);}else{loggerPredictive['info'](_0x3fcdf5[_0x2b0b('0x49')],_0x2b0b('0x1e7'));}};};Dialer[_0x2b0b('0x1c')][_0x2b0b('0x1e8')]=function(_0x45ca36,_0x1ef154){var _0x46d8ec=this;return function(_0x353fbd){if(_['isEmpty'](_0x353fbd)){if(_['isNil'](_0x1ef154[_0x2b0b('0xd3')])||!_0x1ef154[_0x2b0b('0x1e9')]){if(_0x45ca36[_0x2b0b('0x61')]==='booked'){_0x45ca36[_0x2b0b('0x124')]=_['isUndefined'](_0x45ca36[_0x2b0b('0x124')])?!![]:_0x45ca36[_0x2b0b('0x124')];var _0x2638d0=uuid['v4']();_0x46d8ec[_0x2b0b('0x27')][_0x2638d0]=new Action(_0x45ca36,_0x1ef154,_0x2638d0);loggerBooked[_0x2b0b('0x80')](_0x2b0b('0x1ea'),_0x2638d0,_0x2b0b('0x1eb'),JSON[_0x2b0b('0x7a')](_0x45ca36[_0x2b0b('0x124')]),_0x2b0b('0x1ec'),_0x45ca36[_0x2b0b('0x49')]);if(_0x45ca36['queueStatusComplete']){_0x45ca36[_0x2b0b('0x124')]=![];_0x46d8ec[_0x2b0b('0x2c')][_0x46d8ec[_0x2b0b('0x27')][_0x2638d0][_0x2b0b('0xb4')]]=[];ami[_0x2b0b('0xae')]({'actionid':_0x2638d0,'action':_0x2b0b('0x1ed'),'queue':_0x45ca36[_0x2b0b('0x49')]})[_0x2b0b('0xb1')](function(){_0x46d8ec['updateOriginated'](_0x45ca36);_0x46d8ec['rescheduleContact']({'active':![],'ContactId':_0x46d8ec['actions'][_0x2638d0][_0x2b0b('0xf9')],'ListId':_0x46d8ec[_0x2b0b('0x27')][_0x2638d0]['ListId'],'VoiceQueueId':_0x46d8ec[_0x2b0b('0x27')][_0x2638d0][_0x2b0b('0xfa')]||undefined,'CampaignId':_0x46d8ec[_0x2b0b('0x27')][_0x2638d0]['CampaignId']||undefined})[_0x2b0b('0xb1')](loggerCatch(_0x2b0b('0x1ee')));delete _0x46d8ec['actions'][_0x2638d0];});}else{loggerBooked[_0x2b0b('0x80')](_0x2b0b('0x1ef'),JSON[_0x2b0b('0x7a')](_0x45ca36[_0x2b0b('0x124')]),'Queue:\x20',_0x45ca36[_0x2b0b('0x49')]);_0x46d8ec[_0x2b0b('0xb3')](_0x45ca36);_0x46d8ec[_0x2b0b('0xbf')]({'active':![],'ContactId':_0x46d8ec[_0x2b0b('0x27')][_0x2638d0]['ContactId'],'ListId':_0x46d8ec[_0x2b0b('0x27')][_0x2638d0][_0x2b0b('0x101')],'VoiceQueueId':_0x46d8ec['actions'][_0x2638d0][_0x2b0b('0xfa')]||undefined,'CampaignId':_0x46d8ec[_0x2b0b('0x27')][_0x2638d0][_0x2b0b('0xd4')]||undefined})[_0x2b0b('0xb1')](loggerCatch(_0x2b0b('0x1ee')));delete _0x46d8ec[_0x2b0b('0x27')][_0x2638d0];}}else{return _0x46d8ec[_0x2b0b('0x160')](_0x45ca36,_0x1ef154);}}else{if(getDiff(_0x1ef154[_0x2b0b('0x1f0')])<_0x45ca36['dialRecallMeTimeout']*0x3c){if(_0x1ef154[_0x2b0b('0x155')]&&!_0x1ef154[_0x2b0b('0x155')][_0x2b0b('0x1f1')]){_0x46d8ec['preview'][_0x2b0b('0x127')](_0x1ef154['id'])[_0x2b0b('0x1f')](function(){_0x46d8ec[_0x2b0b('0xb3')](_0x45ca36);});}else{_0x46d8ec[_0x2b0b('0xc0')]({'active':![]},_0x1ef154['id'],0x1)[_0x2b0b('0x1f')](function(){_0x46d8ec[_0x2b0b('0xb3')](_0x45ca36);});}}else{_0x45ca36[_0x2b0b('0x6a')]+=0x1;_0x46d8ec['updateOriginated'](_0x45ca36);if(_0x45ca36[_0x2b0b('0x1f2')]){_0x46d8ec[_0x2b0b('0xbf')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1ef154[_0x2b0b('0xf9')],'ListId':_0x1ef154[_0x2b0b('0x101')],'VoiceQueueId':_0x1ef154[_0x2b0b('0xfa')]||undefined,'CampaignId':_0x1ef154[_0x2b0b('0xd4')]||undefined})[_0x2b0b('0xb1')](loggerCatch(_0x2b0b('0x1f3')));_0x46d8ec[_0x2b0b('0xcb')](createObjHistory(_0x45ca36,_0x1ef154,'RECALLINQUEUE',0x17,_0x2b0b('0x1f4')))[_0x2b0b('0xb1')](loggerCatch(_0x2b0b('0x1f5')));}else{_0x46d8ec[_0x2b0b('0xd1')](createObjHistory(_0x45ca36,_0x1ef154,_0x2b0b('0x1f6'),0x16,'RecallFailedTimeout'),_0x2b0b('0x1f7'),_0x2b0b('0x1f8'));}}}}else{_0x45ca36[_0x2b0b('0x1f9')]+=0x1;_0x46d8ec['saveInDb'](createObjHistory(_0x45ca36,_0x1ef154,_0x2b0b('0x1fa'),0xd,_0x2b0b('0x1fb')),_0x2b0b('0x1fc'),'[Originate][MoveBlacklist]');throw _0x2b0b('0x1fd');}};};Dialer[_0x2b0b('0x1c')]['handleIvr']=function(_0x4f461d){var _0x36a56b=this;var _0x104bce=_0x4f461d[_0x2b0b('0x1fe')]-_0x4f461d['originated']-_0x4f461d[_0x2b0b('0xc3')];emitCampaignSummary(_0x4f461d);if(_0x104bce>0x0){if(_0x104bce>this['maxNumberOriginate']){_0x104bce=this[_0x2b0b('0x25')];}_0x4f461d[_0x2b0b('0xc3')]+=_0x104bce;this[_0x2b0b('0xc5')](_0x4f461d['id'],_0x104bce,_0x4f461d['dialOrderByScheduledAt'],_0x4f461d)[_0x2b0b('0x42')](function(_0x262f29){_0x4f461d['temp']-=_0x104bce;_0x4f461d[_0x2b0b('0xc3')]=_0x4f461d['temp']>0x0?_0x4f461d[_0x2b0b('0xc3')]:0x0;if(!checkContactEmpty(_0x262f29)){_0x4f461d[_0x2b0b('0x45')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x2b0b('0x80')](_0x2b0b('0x1ff')+_0x4f461d['name']);}else{_0x4f461d[_0x2b0b('0x76')]+=_0x262f29['length'];_0x4f461d[_0x2b0b('0x45')]='RUNNING';for(var _0x55ede5=0x0;_0x55ede5<_0x262f29[_0x2b0b('0x9b')];_0x55ede5+=0x1){_0x4f461d['ivrTotalCallsDays']+=0x1;if(_[_0x2b0b('0xad')](_0x262f29[_0x55ede5])||_['isNil'](_0x262f29[_0x55ede5]['Contact'])||_[_0x2b0b('0xad')](_0x262f29[_0x55ede5][_0x2b0b('0x164')][_0x2b0b('0x165')])){_0x36a56b[_0x2b0b('0xcf')](_0x2b0b('0x200'),_0x4f461d,_0x262f29[_0x55ede5]);}else{_0x36a56b[_0x2b0b('0xbb')](_[_0x2b0b('0xd2')](_0x262f29[_0x55ede5],['CampaignId',_0x2b0b('0x201')]))[_0x2b0b('0x42')](_0x36a56b[_0x2b0b('0x1e8')](_0x4f461d,_0x262f29[_0x55ede5]))[_0x2b0b('0xb1')](_0x36a56b[_0x2b0b('0xce')]('[actionOriginateIvr]\x20',_0x4f461d));}}}})[_0x2b0b('0xb1')](loggerGetContactDialer(_0x2b0b('0x202'),_0x4f461d,_0x104bce));}};Dialer['prototype'][_0x2b0b('0x14e')]=function(_0x7f47a6,_0x343799){var _0x3df3d8=this;var _0xae3785=[];var _0x5da085=_0x343799>=0x1?_0x343799:0x1;if(_0x7f47a6[_0x2b0b('0x61')]===_0x2b0b('0xa')){_0x5da085=0x1;}var _0x20b310=Math['floor'](_0x7f47a6[_0x2b0b('0x56')]*_0x5da085)-_0x7f47a6[_0x2b0b('0x76')]-_0x7f47a6['temp'];emitVoiceQueueSummary(_0x7f47a6);if(_0x7f47a6[_0x2b0b('0x203')]>0x0){var _0x37118f=_0x7f47a6[_0x2b0b('0x203')]-_0x7f47a6[_0x2b0b('0x76')]-_0x7f47a6[_0x2b0b('0x5b')]-_0x7f47a6['temp']-_0x7f47a6[_0x2b0b('0x204')];if(_0x20b310>_0x37118f){_0x20b310=_0x37118f;}}if(_0x20b310>0x0){if(_0x7f47a6[_0x2b0b('0x61')]===_0x2b0b('0xa')){_0x20b310=0x1;}if(_0x20b310>this['maxNumberOriginate']){_0x20b310=this[_0x2b0b('0x25')];}_0x7f47a6['temp']+=_0x20b310;for(var _0x19b8d6 in this['agents']){if(typeof this[_0x2b0b('0x23')][_0x19b8d6]!==_0x2b0b('0x9c')){if(this['agents'][_0x19b8d6][_0x2b0b('0xa8')]===_0x2b0b('0x205')&&this['agents'][_0x19b8d6]['status']===_0x2b0b('0x206')){_0xae3785[_0x2b0b('0x146')](this[_0x2b0b('0x23')][_0x19b8d6]['id']);}}}this['getContactDialer'](_0x7f47a6['id'],_0xae3785,_0x20b310,_0x7f47a6[_0x2b0b('0x207')],_0x7f47a6)[_0x2b0b('0x42')](function(_0x32cac3){_0x7f47a6['temp']-=_0x20b310;_0x7f47a6[_0x2b0b('0xc3')]=_0x7f47a6[_0x2b0b('0xc3')]>0x0?_0x7f47a6[_0x2b0b('0xc3')]:0x0;if(!checkContactEmpty(_0x32cac3)){_0x3df3d8['countReScheduled'](_0x7f47a6)[_0x2b0b('0x42')](sendMessageReschedule(_0x7f47a6))[_0x2b0b('0xb1')](loggerCatch(_0x2b0b('0xb9')));}else{_0x7f47a6[_0x2b0b('0x76')]+=_0x32cac3['length'];_0x7f47a6['message']=_0x7f47a6[_0x2b0b('0x61')]===_0x2b0b('0xa')?'ACTIVE':_0x2b0b('0x208');for(var _0x2d2f02=0x0;_0x2d2f02<_0x32cac3[_0x2b0b('0x9b')];_0x2d2f02+=0x1){if(_[_0x2b0b('0xad')](_0x32cac3[_0x2d2f02])||_[_0x2b0b('0xad')](_0x32cac3[_0x2d2f02][_0x2b0b('0x164')])||_['isNil'](_0x32cac3[_0x2d2f02][_0x2b0b('0x164')][_0x2b0b('0x165')])){_0x3df3d8[_0x2b0b('0xcf')](_0x2b0b('0x200'),_0x7f47a6,_0x32cac3[_0x2d2f02]);}else{_0x3df3d8['checkIsBlackList'](_[_0x2b0b('0xd2')](_0x32cac3[_0x2d2f02],[_0x2b0b('0xfa'),_0x2b0b('0x201')]))[_0x2b0b('0x42')](_0x3df3d8[_0x2b0b('0x1e8')](_0x7f47a6,_0x32cac3[_0x2d2f02]))[_0x2b0b('0xb1')](_0x3df3d8[_0x2b0b('0xce')]('[actionOriginate]\x20',_0x7f47a6));}}}})[_0x2b0b('0xb1')](loggerGetContactDialer('[getContactDialer2]',_0x7f47a6,_0x20b310));}};Dialer['prototype'][_0x2b0b('0x92')]=function(_0x322903){if(_0x322903[_0x2b0b('0x203')]>0x0){var _0x4af988=_0x322903[_0x2b0b('0x203')]-_0x322903['originated']-_0x322903['talking'];if(_0x4af988>0x0){this[_0x2b0b('0x209')](_0x322903);}else{loggerPredictiveCalls[_0x2b0b('0x80')](_0x2b0b('0x20a'));}}else{this[_0x2b0b('0x209')](_0x322903);}};Dialer[_0x2b0b('0x1c')][_0x2b0b('0x209')]=function(_0x468866){var _0x79ff18=this;var _0x49e614=[];_0x468866[_0x2b0b('0x76')]+=0x1;for(var _0x4902d9 in this[_0x2b0b('0x23')]){if(typeof this[_0x2b0b('0x23')][_0x4902d9]!=='undefined'){if(this[_0x2b0b('0x23')][_0x4902d9]['state']===_0x2b0b('0x205')&&this[_0x2b0b('0x23')][_0x4902d9][_0x2b0b('0xaf')]===_0x2b0b('0x206')){_0x49e614['push'](this['agents'][_0x4902d9]['id']);}}}this[_0x2b0b('0xc2')](_0x468866['id'],_0x49e614,0x1,_0x468866[_0x2b0b('0x207')],_0x468866)[_0x2b0b('0x42')](function(_0x92f162){if(!checkContactEmpty(_0x92f162)){checkContactLowerLimitOriginate(_0x468866,0x1,0x0);_0x79ff18['countReScheduled'](_0x468866)[_0x2b0b('0x42')](sendMessageReschedule(_0x468866))[_0x2b0b('0xb1')](loggerCatch(_0x2b0b('0xb9')));}else{_0x468866[_0x2b0b('0x45')]=_0x2b0b('0x208');if(_[_0x2b0b('0xad')](_0x92f162[0x0])||_[_0x2b0b('0xad')](_0x92f162[0x0][_0x2b0b('0x164')])||_['isNil'](_0x92f162[0x0][_0x2b0b('0x164')][_0x2b0b('0x165')])){_0x79ff18[_0x2b0b('0xcf')]('[actionOriginate]\x20',_0x468866,_0x92f162[0x0]);}else{_0x79ff18[_0x2b0b('0xba')](_['pick'](_0x92f162[0x0],[_0x2b0b('0xfa'),_0x2b0b('0x201')]))[_0x2b0b('0x42')](_0x79ff18[_0x2b0b('0x1e8')](_0x468866,_0x92f162[0x0]))['catch'](_0x79ff18[_0x2b0b('0xce')](_0x2b0b('0x20b'),_0x468866));}}})[_0x2b0b('0xb1')](loggerGetContactDialer(_0x2b0b('0x20c'),_0x468866,0x1));emitVoiceQueueSummary(_0x468866);};Dialer[_0x2b0b('0x1c')][_0x2b0b('0x1db')]=function(_0x2a88ab,_0x5b2cee,_0x2051a6,_0x501eab,_0xfb3315,_0x10cf18){loggerPredictive[_0x2b0b('0x80')](_0x2b0b('0x20d'));loggerPredictive[_0x2b0b('0x80')](_0x2b0b('0x20e'),_0x2a88ab);loggerPredictive['info'](_0x2b0b('0x20f'),_0x5b2cee);loggerPredictive['info']('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2051a6);loggerPredictive[_0x2b0b('0x80')](_0x2b0b('0x210'),_0x501eab);loggerPredictive[_0x2b0b('0x80')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xfb3315);loggerPredictive[_0x2b0b('0x80')](_0x2b0b('0x85'));return new BPromise(function(_0x20c4a5,_0x5f2eb0){if(_0x2a88ab<=0x0||isNaN(_0x2a88ab)){return _0x5f2eb0(msgResponse(_0x2b0b('0x211'),_0x2b0b('0x212'),_0x2b0b('0x213')+_0x2a88ab));}if(_0x2051a6<=0x0||isNaN(_0x2051a6)){return _0x5f2eb0(msgResponse(_0x2b0b('0x211'),_0x2b0b('0x212'),'Ts\x20=\x20'+_0x2051a6));}if(_0x501eab<=0x0||isNaN(_0x501eab)){return _0x5f2eb0(msgResponse(_0x2b0b('0x211'),_0x2b0b('0x212'),_0x2b0b('0x214')+_0x501eab));}if(_0x5b2cee<=0x0||isNaN(_0x5b2cee)){return _0x5f2eb0(msgResponse(_0x2b0b('0x211'),_0x2b0b('0x212'),_0x2b0b('0x215')+_0x5b2cee));}if(_0xfb3315<=0x0||isNaN(_0xfb3315)){return _0x5f2eb0(msgResponse(_0x2b0b('0x211'),'Error','Amax\x20=\x20'+_0xfb3315));}_0x10cf18=_0x10cf18||0x0;var _0x2c984a=0x1/_0x2051a6;var _0x380b05=0x0;var _0x4f2505=0x0;var _0x2ed592=0x0;var _0x5d496b=0x0;for(var _0x5c409c=0x0;_0x2ed592<_0xfb3315;_0x5c409c+=0x1){_0x4f2505=_0x5c409c/_0x5b2cee;_0x380b05=(_0x501eab*_0x4f2505+_0x10cf18)/_0x2c984a;_0x2ed592=erlangb(_0x380b05,_0x2a88ab);_0x5d496b=_0x380b05/_0x2a88ab*(0x1-erlangb(_0x380b05,_0x2a88ab));}return _0x20c4a5({'erlangCalls':_0x5c409c,'erlangCallToSecond':_0x5b2cee/_0x5c409c,'erlangAbandonmentRate':_0x2ed592,'erlangBusyFactor':_0x5d496b});});};Dialer[_0x2b0b('0x1c')][_0x2b0b('0x1dd')]=function(_0x3564e5,_0x1e178c,_0x186f1e,_0x2c873d,_0x2aa1a9,_0x45f845){loggerPredictive[_0x2b0b('0x80')](_0x2b0b('0x216'));loggerPredictive[_0x2b0b('0x80')](_0x2b0b('0x20e'),_0x3564e5);loggerPredictive[_0x2b0b('0x80')](_0x2b0b('0x20f'),_0x1e178c);loggerPredictive[_0x2b0b('0x80')](_0x2b0b('0x217'),_0x186f1e);loggerPredictive[_0x2b0b('0x80')](_0x2b0b('0x210'),_0x2c873d);loggerPredictive[_0x2b0b('0x80')](_0x2b0b('0x218'),_0x2aa1a9);loggerPredictive[_0x2b0b('0x80')]('---------------------------');return new BPromise(function(_0x15a1ff,_0x32ba85){if(_0x3564e5<=0x0||isNaN(_0x3564e5)){return _0x32ba85(msgResponse(_0x2b0b('0x219'),'Error',_0x2b0b('0x213')+_0x3564e5));}if(_0x186f1e<=0x0||isNaN(_0x186f1e)){return _0x32ba85(msgResponse(_0x2b0b('0x219'),_0x2b0b('0x212'),'Ts\x20=\x20'+_0x186f1e));}if(_0x2c873d<=0x0||isNaN(_0x2c873d)){return _0x32ba85(msgResponse(_0x2b0b('0x219'),_0x2b0b('0x212'),_0x2b0b('0x214')+_0x2c873d));}if(_0x1e178c<=0x0||isNaN(_0x1e178c)){return _0x32ba85(msgResponse('[busyFactor]','Error',_0x2b0b('0x215')+_0x1e178c));}if(_0x2aa1a9<=0x0||isNaN(_0x2aa1a9)){return _0x32ba85(msgResponse('[busyFactor]',_0x2b0b('0x212'),_0x2b0b('0x21a')+_0x2aa1a9));}_0x45f845=_0x45f845||0x0;var _0x57a68b=0x1/_0x186f1e;var _0x2ac294=0x0;var _0x46940b=0x0;var _0x24e527=0x0;var _0x427102=0x0;for(var _0x2bbb72=0x0;_0x427102<_0x2aa1a9;_0x2bbb72+=0x1){_0x46940b=_0x2bbb72/_0x1e178c;_0x2ac294=(_0x2c873d*_0x46940b+_0x45f845)/_0x57a68b;_0x24e527=erlangb(_0x2ac294,_0x3564e5);_0x427102=_0x2ac294/_0x3564e5*(0x1-erlangb(_0x2ac294,_0x3564e5));}return _0x15a1ff({'erlangCalls':_0x2bbb72,'erlangCallToSecond':_0x1e178c/_0x2bbb72,'erlangAbandonmentRate':_0x24e527,'erlangBusyFactor':_0x427102});});};module[_0x2b0b('0x21b')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 01faf80..3e6f8a1 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 _0xe917=['queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','membername','connectedlinename','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound'];(function(_0x3401ee,_0x19476c){var _0x383615=function(_0x43ff06){while(--_0x43ff06){_0x3401ee['push'](_0x3401ee['shift']());}};_0x383615(++_0x19476c);}(_0xe917,0x1da));var _0x7e91=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0xe917[_0x468b0f];return _0x3e74d9;};'use strict';var util=require(_0x7e91('0x0'));var _=require(_0x7e91('0x1'));var moment=require(_0x7e91('0x2'));function getSeconds(_0x12620b,_0x1f2cb2){var _0x12dfaf=moment(_0x12620b)['milliseconds'](0x0);var _0x5d7e46=moment(_0x1f2cb2)[_0x7e91('0x3')](0x0);return _0x12dfaf[_0x7e91('0x4')](_0x5d7e46,_0x7e91('0x5'));}function QueueCallerAbandon(_0x40a3ff,_0x3b7476){this['scheduledat']=_0x40a3ff[_0x7e91('0x6')];this[_0x7e91('0x7')]=_0x40a3ff[_0x7e91('0x7')];this[_0x7e91('0x8')]=_0x40a3ff[_0x7e91('0x7')]===_0x7e91('0x9')?_0x7e91('0xa'):_0x40a3ff[_0x7e91('0x7')];this[_0x7e91('0xb')]=_0x40a3ff[_0x7e91('0xb')];this[_0x7e91('0xc')]=_0x40a3ff[_0x7e91('0xc')];this[_0x7e91('0xd')]=_0x40a3ff[_0x7e91('0xd')];this[_0x7e91('0xe')]=_0x40a3ff['countbusyretry']+_0x40a3ff['countcongestionretry']+_0x40a3ff[_0x7e91('0xd')]+_0x40a3ff['countnosuchnumberretry']+_0x40a3ff[_0x7e91('0xf')]+_0x40a3ff[_0x7e91('0x10')]+_0x40a3ff['countmachineretry']+_0x40a3ff[_0x7e91('0x11')];this['countnosuchnumberretry']=_0x40a3ff[_0x7e91('0x12')];this[_0x7e91('0xf')]=_0x40a3ff['countdropretry'];this[_0x7e91('0x10')]=_0x40a3ff[_0x7e91('0x10')];this[_0x7e91('0x13')]=_0x40a3ff[_0x7e91('0x13')];this[_0x7e91('0x11')]=_0x40a3ff['countagentrejectretry'];this[_0x7e91('0x14')]=_0x3b7476['uniqueid'];this['calleridname']=_0x40a3ff[_0x7e91('0x15')];this[_0x7e91('0x16')]=_0x40a3ff[_0x7e91('0x17')];this[_0x7e91('0x18')]=_0x40a3ff[_0x7e91('0x18')];this[_0x7e91('0x19')]=_0x40a3ff[_0x7e91('0x19')];this[_0x7e91('0x1a')]=_0x40a3ff['droptime'];this[_0x7e91('0x1b')]=this[_0x7e91('0x1a')];this[_0x7e91('0x1c')]=getSeconds(_0x40a3ff[_0x7e91('0x19')],_0x40a3ff['starttime']);this[_0x7e91('0x1d')]=getSeconds(this['droptime'],_0x40a3ff['responsetime']);this['talktime']=0x0;this[_0x7e91('0xa')]=_0x3b7476[_0x7e91('0xa')];this[_0x7e91('0x1e')]=_0x3b7476[_0x7e91('0x1f')];this[_0x7e91('0x20')]=_0x3b7476[_0x7e91('0x20')];this['callback']=_0x40a3ff['callback'];this[_0x7e91('0x21')]=_0x40a3ff[_0x7e91('0x21')];this[_0x7e91('0x22')]=_0x40a3ff[_0x7e91('0x22')];this[_0x7e91('0x23')]=_0x40a3ff[_0x7e91('0x23')];this['ContactId']=_0x40a3ff[_0x7e91('0x24')];this[_0x7e91('0x25')]=_0x40a3ff[_0x7e91('0x25')];this[_0x7e91('0x26')]=_0x40a3ff['UserId'];this[_0x7e91('0x27')]=_0x40a3ff[_0x7e91('0x27')];this[_0x7e91('0x28')]=_0x40a3ff[_0x7e91('0x28')];this[_0x7e91('0x29')]=_0x40a3ff[_0x7e91('0x29')]||'';this[_0x7e91('0x2a')]=_0x40a3ff['originatecalleridname']||'';}module[_0x7e91('0x2b')]=QueueCallerAbandon; \ No newline at end of file +var _0xa83b=['responsetime','droptime','endtime','ringtime','holdtime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','number','starttime'];(function(_0x174641,_0x4b7cc4){var _0x1dce47=function(_0x16b0fa){while(--_0x16b0fa){_0x174641['push'](_0x174641['shift']());}};_0x1dce47(++_0x4b7cc4);}(_0xa83b,0x1f2));var _0xba83=function(_0x25ab74,_0x415995){_0x25ab74=_0x25ab74-0x0;var _0x517d27=_0xa83b[_0x25ab74];return _0x517d27;};'use strict';var util=require(_0xba83('0x0'));var _=require(_0xba83('0x1'));var moment=require(_0xba83('0x2'));function getSeconds(_0x5bed91,_0x55cd68){var _0x1ee326=moment(_0x5bed91)[_0xba83('0x3')](0x0);var _0x4af192=moment(_0x55cd68)[_0xba83('0x3')](0x0);return _0x1ee326[_0xba83('0x4')](_0x4af192,'seconds');}function QueueCallerAbandon(_0x110b7a,_0x684e33){this[_0xba83('0x5')]=_0x110b7a[_0xba83('0x5')];this[_0xba83('0x6')]=_0x110b7a[_0xba83('0x6')];this[_0xba83('0x7')]=_0x110b7a[_0xba83('0x6')]===_0xba83('0x8')?_0xba83('0x9'):_0x110b7a[_0xba83('0x6')];this[_0xba83('0xa')]=_0x110b7a[_0xba83('0xa')];this[_0xba83('0xb')]=_0x110b7a[_0xba83('0xb')];this[_0xba83('0xc')]=_0x110b7a[_0xba83('0xc')];this[_0xba83('0xd')]=_0x110b7a[_0xba83('0xa')]+_0x110b7a[_0xba83('0xb')]+_0x110b7a['countnoanswerretry']+_0x110b7a[_0xba83('0xe')]+_0x110b7a['countdropretry']+_0x110b7a[_0xba83('0xf')]+_0x110b7a[_0xba83('0x10')]+_0x110b7a[_0xba83('0x11')];this['countnosuchnumberretry']=_0x110b7a[_0xba83('0xe')];this[_0xba83('0x12')]=_0x110b7a[_0xba83('0x12')];this[_0xba83('0xf')]=_0x110b7a['countabandonedretry'];this[_0xba83('0x10')]=_0x110b7a[_0xba83('0x10')];this[_0xba83('0x11')]=_0x110b7a[_0xba83('0x11')];this[_0xba83('0x13')]=_0x684e33[_0xba83('0x13')];this['calleridname']=_0x110b7a['name'];this['calleridnum']=_0x110b7a[_0xba83('0x14')];this[_0xba83('0x15')]=_0x110b7a['starttime'];this['responsetime']=_0x110b7a[_0xba83('0x16')];this[_0xba83('0x17')]=_0x110b7a['droptime'];this[_0xba83('0x18')]=this[_0xba83('0x17')];this[_0xba83('0x19')]=getSeconds(_0x110b7a[_0xba83('0x16')],_0x110b7a[_0xba83('0x15')]);this[_0xba83('0x1a')]=getSeconds(this[_0xba83('0x17')],_0x110b7a['responsetime']);this['talktime']=0x0;this['queue']=_0x684e33['queue'];this[_0xba83('0x1b')]=_0x684e33[_0xba83('0x1c')];this['reason']=_0x684e33[_0xba83('0x1d')];this[_0xba83('0x1e')]=_0x110b7a[_0xba83('0x1e')];this[_0xba83('0x1f')]=_0x110b7a[_0xba83('0x1f')];this[_0xba83('0x20')]=_0x110b7a['callbackat'];this['recallme']=_0x110b7a['recallme'];this[_0xba83('0x21')]=_0x110b7a[_0xba83('0x21')];this['ListId']=_0x110b7a['ListId'];this[_0xba83('0x22')]=_0x110b7a['UserId'];this[_0xba83('0x23')]=_0x110b7a[_0xba83('0x23')];this['CampaignId']=_0x110b7a[_0xba83('0x24')];this[_0xba83('0x25')]=_0x110b7a[_0xba83('0x25')]||'';this[_0xba83('0x26')]=_0x110b7a[_0xba83('0x26')]||'';}module[_0xba83('0x27')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index bb3573d..4eb3171 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(_0x395c99,_0x139077){var _0x3298b8=function(_0xca08ec){while(--_0xca08ec){_0x395c99['push'](_0x395c99['shift']());}};_0x3298b8(++_0x139077);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file +var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x5021ba,_0x295b5c){var _0x4d3f43=function(_0x3d657c){while(--_0x3d657c){_0x5021ba['push'](_0x5021ba['shift']());}};_0x4d3f43(++_0x295b5c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index a5e7eb8..9b3c53e 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 _0x065e=['variable','channelstate','channelstatedesc','syncNewExten','value','operation','status','localstationid','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf','then','.pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate2]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','FaxAccountId','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','moment','path','tiff2pdf','fax','../ami','./channel','./util/util','./action','../rpc/attachment','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','hangup','syncHangup','originateresponse','syncOriginateResponse','from-voip-provider','hasOwnProperty','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype'];(function(_0x26a0b4,_0x24bed1){var _0x552a2a=function(_0x46aa68){while(--_0x46aa68){_0x26a0b4['push'](_0x26a0b4['shift']());}};_0x552a2a(++_0x24bed1);}(_0x065e,0x1a7));var _0xe065=function(_0x37efa5,_0x430478){_0x37efa5=_0x37efa5-0x0;var _0x8267c6=_0x065e[_0x37efa5];return _0x8267c6;};'use strict';var util=require(_0xe065('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0xe065('0x1'));var path=require(_0xe065('0x2'));var tiff2pdf=require(_0xe065('0x3'));var gs=require('./util/gs');var logger=require('../../../config/logger')(_0xe065('0x4'));var ami=require(_0xe065('0x5'));var rpcDb=require('./rpcDb');var Channel=require(_0xe065('0x6'));var ut=require(_0xe065('0x7'));var Action=require(_0xe065('0x8'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0xe065('0x9'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x273e22){this[_0xe065('0xa')]={};this[_0xe065('0xb')]=_0x273e22[_0xe065('0xb')];this[_0xe065('0xc')]=_0x273e22['trunks'];this[_0xe065('0xd')]={};ami['on'](_0xe065('0xe'),this[_0xe065('0xf')][_0xe065('0x10')](this));ami['on'](_0xe065('0x11'),this[_0xe065('0x12')]['bind'](this));ami['on']('newstate',this[_0xe065('0x13')][_0xe065('0x10')](this));ami['on'](_0xe065('0x14'),this['syncNewExten'][_0xe065('0x10')](this));ami['on'](_0xe065('0x15'),this[_0xe065('0x16')][_0xe065('0x10')](this));ami['on'](_0xe065('0x17'),this['syncReceiveFax'][_0xe065('0x10')](this));ami['on'](_0xe065('0x18'),this[_0xe065('0x19')][_0xe065('0x10')](this));ami['on'](_0xe065('0x1a'),this[_0xe065('0x1b')][_0xe065('0x10')](this));}Fax['prototype'][_0xe065('0xf')]=function(_0xe48f8c){if(_0xe48f8c['context']===_0xe065('0x1c')){for(var _0x1d2f7a in this[_0xe065('0xb')]){if(this[_0xe065('0xb')][_0xe065('0x1d')](_0x1d2f7a)){if(_0xe48f8c[_0xe065('0x1e')]===this[_0xe065('0xb')][_0x1d2f7a]['localstationid']){this[_0xe065('0xa')][_0xe48f8c['uniqueid']]={};this[_0xe065('0xa')][_0xe48f8c[_0xe065('0x1f')]]['channel']=_0xe48f8c[_0xe065('0x20')];this['channels'][_0xe48f8c[_0xe065('0x1f')]]['id']=this[_0xe065('0xb')][_0x1d2f7a]['id'];this[_0xe065('0xa')][_0xe48f8c[_0xe065('0x1f')]][_0xe065('0x21')]=this[_0xe065('0xb')][_0x1d2f7a][_0xe065('0x21')];logger[_0xe065('0x22')](_0xe48f8c[_0xe065('0x1f')],'\x20syncNewchannel\x20');}}}}if(this[_0xe065('0xd')][_0xe48f8c[_0xe065('0x1f')]]){this[_0xe065('0xa')][_0xe48f8c[_0xe065('0x1f')]]={};this['channels'][_0xe48f8c['uniqueid']][_0xe065('0x20')]=_0xe48f8c['channel'];logger[_0xe065('0x22')](_0xe48f8c[_0xe065('0x1f')],_0xe065('0x23'));}};Fax[_0xe065('0x24')][_0xe065('0x12')]=function(_0x3ec154){if(this[_0xe065('0xa')][_0x3ec154[_0xe065('0x1f')]]){for(var _0x52cd9c in _0x3ec154['variable']){if(_0x3ec154[_0xe065('0x25')][_0xe065('0x1d')](_0x52cd9c)){this[_0xe065('0xa')][_0x3ec154[_0xe065('0x1f')]][_0x52cd9c]=_0x3ec154['value'];}}}};Fax[_0xe065('0x24')]['syncNewState']=function(_0x522420){if(this[_0xe065('0xa')][_0x522420[_0xe065('0x1f')]]){this[_0xe065('0xa')][_0x522420['uniqueid']][_0xe065('0x26')]=_0x522420['channelstate'];this[_0xe065('0xa')][_0x522420[_0xe065('0x1f')]][_0xe065('0x27')]=_0x522420[_0xe065('0x27')];}};Fax['prototype'][_0xe065('0x28')]=function(_0x4940cf){if(this[_0xe065('0xa')][_0x4940cf[_0xe065('0x1f')]]){for(var _0x5d0864 in _0x4940cf[_0xe065('0x25')]){if(_0x4940cf['variable'][_0xe065('0x1d')](_0x5d0864)){this['channels'][_0x4940cf[_0xe065('0x1f')]][_0x5d0864]=_0x4940cf[_0xe065('0x29')];}}}};Fax[_0xe065('0x24')][_0xe065('0x16')]=function(_0x5c5401){if(this[_0xe065('0xa')][_0x5c5401[_0xe065('0x1f')]]){this[_0xe065('0xa')][_0x5c5401[_0xe065('0x1f')]][_0xe065('0x2a')]=_0x5c5401[_0xe065('0x2a')];this['channels'][_0x5c5401[_0xe065('0x1f')]][_0xe065('0x2b')]=_0x5c5401['status'];this[_0xe065('0xa')][_0x5c5401[_0xe065('0x1f')]][_0xe065('0x2c')]=_0x5c5401[_0xe065('0x2c')];this[_0xe065('0xa')][_0x5c5401[_0xe065('0x1f')]][_0xe065('0x2d')]=_0x5c5401['filename'];logger[_0xe065('0x22')](_0x5c5401['uniqueid'],_0xe065('0x2e'));}};Fax[_0xe065('0x24')][_0xe065('0x2f')]=function(_0xcceb12){var _0x45fe3f=this;if(this[_0xe065('0xa')][_0xcceb12['uniqueid']]){var _0x402d74=this[_0xe065('0xa')][_0xcceb12[_0xe065('0x1f')]]['id'];this['channels'][_0xcceb12[_0xe065('0x1f')]][_0xe065('0x30')]=_0xcceb12[_0xe065('0x30')];this[_0xe065('0xa')][_0xcceb12[_0xe065('0x1f')]]['pagestransferred']=_0xcceb12[_0xe065('0x31')];this[_0xe065('0xa')][_0xcceb12['uniqueid']][_0xe065('0x2c')]=_0xcceb12['localstationid'];this[_0xe065('0xa')][_0xcceb12[_0xe065('0x1f')]]['resolution']=_0xcceb12[_0xe065('0x32')];this[_0xe065('0xa')][_0xcceb12['uniqueid']][_0xe065('0x33')]=_0xcceb12[_0xe065('0x33')];this[_0xe065('0xa')][_0xcceb12[_0xe065('0x1f')]][_0xe065('0x2d')]=_0xcceb12[_0xe065('0x2d')];this[_0xe065('0xa')][_0xcceb12[_0xe065('0x1f')]][_0xe065('0x34')]=_0xcceb12[_0xe065('0x34')];if(this[_0xe065('0xa')][_0xcceb12[_0xe065('0x1f')]][_0xe065('0x31')]>0x0){tiff2pdf(_0xcceb12['filename'],'/var/opt/motion2/server/files/attachments/',function(_0xfcb0d0){logger[_0xe065('0x22')](_0xcceb12['uniqueid'],_0xe065('0x35'),_0xfcb0d0[_0xe065('0x36')]);attachment[_0xe065('0x37')]({'name':path[_0xe065('0x38')](_0xcceb12[_0xe065('0x2d')])[_0xe065('0x21')],'basename':path[_0xe065('0x38')](_0xcceb12[_0xe065('0x2d')])[_0xe065('0x21')]+'.pdf','type':_0xe065('0x39')})[_0xe065('0x3a')](function(_0x299f96){faxAccount['notify'](_0x402d74,{'from':_0xcceb12[_0xe065('0x34')],'mapKey':_0xe065('0x4'),'body':path[_0xe065('0x38')](_0xcceb12[_0xe065('0x2d')])['name']+_0xe065('0x3b'),'AttachmentId':_0x299f96['id']})[_0xe065('0x3c')](function(_0x1d9ecc){logger[_0xe065('0x3d')](_0xcceb12[_0xe065('0x1f')],_0xe065('0x3e'),JSON[_0xe065('0x3f')](_0x1d9ecc));});})['catch'](function(_0x3a2900){logger[_0xe065('0x3d')](_0xcceb12[_0xe065('0x1f')],_0xe065('0x40'),JSON[_0xe065('0x3f')](_0x3a2900));});});}logger[_0xe065('0x22')](_0xcceb12[_0xe065('0x1f')],'\x20receiveFax\x20');}};Fax[_0xe065('0x24')]['syncOriginateResponse']=function(_0x45fe1f){if(this[_0xe065('0xd')][_0x45fe1f[_0xe065('0x1f')]]){_['merge'](this[_0xe065('0xa')][_0x45fe1f[_0xe065('0x1f')]],_[_0xe065('0x41')](_0x45fe1f,[_0xe065('0x42'),_0xe065('0x43')]));}};function updateStatus(_0x6953e0){if(_0x6953e0[_0xe065('0x44')]){faxMessage[_0xe065('0x45')](_0x6953e0[_0xe065('0x44')],{'failMessage':_0xe065('0x46')})[_0xe065('0x3a')](function(_0x270cd5){ut[_0xe065('0x47')]('[Fax][Message][Error][Updated]',_0x270cd5);})['catch'](function(_0x584201){ut[_0xe065('0x47')]('[Fax][Message][Error][NoUpdate1]',_0x584201);});}else{ut[_0xe065('0x47')](_0xe065('0x48'));}}Fax[_0xe065('0x24')]['updateStatus']=function(_0x45a60e,_0x20272a,_0x5cce78){var _0x39f24b=this;var _0x366d4b={};if(_0x20272a){_0x366d4b={'read':_0x20272a};}else{_0x366d4b={'failMessage':_0x5cce78};}if(this[_0xe065('0xd')][_0x45a60e][_0xe065('0x44')]){faxMessage[_0xe065('0x45')](this[_0xe065('0xd')][_0x45a60e][_0xe065('0x44')],_0x366d4b)[_0xe065('0x3a')](function(_0x43480d){ut[_0xe065('0x47')]('[Fax][Message][Updated]',_0x43480d);})[_0xe065('0x3c')](function(_0x18eb92){ut[_0xe065('0x47')](_0xe065('0x49'),_0x18eb92);})['finally'](function(){delete _0x39f24b[_0xe065('0xa')][_0x45a60e];delete _0x39f24b[_0xe065('0xd')][_0x45a60e];});}else{ut[_0xe065('0x47')](_0xe065('0x4a'));delete this['channels'][_0x45a60e];delete this[_0xe065('0xd')][_0x45a60e];}};Fax[_0xe065('0x24')][_0xe065('0x19')]=function(_0x5320c6){var _0x6e3b3b=this;if(this[_0xe065('0xa')][_0x5320c6[_0xe065('0x1f')]]){if(this[_0xe065('0xd')][_0x5320c6[_0xe065('0x1f')]]){this[_0xe065('0xa')][_0x5320c6[_0xe065('0x1f')]]['id']=this[_0xe065('0xd')][_0x5320c6[_0xe065('0x1f')]]['id'];this['channels'][_0x5320c6[_0xe065('0x1f')]]['name']=this[_0xe065('0xd')][_0x5320c6[_0xe065('0x1f')]][_0xe065('0x21')];}logger['info'](_0x5320c6['uniqueid'],this['actions'][_0x5320c6[_0xe065('0x1f')]]?_0xe065('0x4b'):_0xe065('0x4c'),JSON[_0xe065('0x3f')](this[_0xe065('0xa')][_0x5320c6[_0xe065('0x1f')]]));if(this[_0xe065('0xd')][_0x5320c6[_0xe065('0x1f')]]){if(this[_0xe065('0xa')][_0x5320c6[_0xe065('0x1f')]][_0xe065('0x4d')]>0x0&&this['channels'][_0x5320c6['uniqueid']][_0xe065('0x15')]===_0xe065('0x4e')){this['updateStatus'](_0x5320c6[_0xe065('0x1f')],!![]);}else{this['updateStatus'](_0x5320c6['uniqueid'],![],this[_0xe065('0xa')][_0x5320c6[_0xe065('0x1f')]][_0xe065('0x4f')]?_0xe065('0x50')+this[_0xe065('0xa')][_0x5320c6[_0xe065('0x1f')]][_0xe065('0x4f')]:'SENDING\x20FAILED');}}}};Fax[_0xe065('0x24')][_0xe065('0x51')]=function(_0xaef095){var _0xb3591e=this;return new BPromise(function(_0x432def,_0x4f35a6){_0xb3591e[_0xe065('0x52')](_0xaef095,_0xb3591e[_0xe065('0xb')][_0xaef095[_0xe065('0x53')]])[_0xe065('0x3a')](function(_0x2968c5){ut[_0xe065('0x47')]('[Fax][execOriginate][success]',_0x2968c5);_0x432def(ut['message']('Fax\x20received'));})['catch'](function(_0x5c3d7a){ut[_0xe065('0x47')](_0xe065('0x54'),_0x5c3d7a);updateStatus(_0xaef095);_0x4f35a6(ut[_0xe065('0x36')](_0xe065('0x55')));});});};Fax[_0xe065('0x24')][_0xe065('0x56')]=function(_0x3290bd){var _0x4084a0=this;return new BPromise(function(_0x507fd2,_0x4c96d1){var _0x3c0805=_0x4084a0[_0xe065('0x57')](_0x4084a0[_0xe065('0xb')][_0x3290bd['FaxAccountId']][_0xe065('0x58')],_0x3290bd);if(_0x3c0805[_0xe065('0x59')]){_0x507fd2(ut[_0xe065('0x36')](_0xe065('0x5a')));}else{_0x4c96d1(ut[_0xe065('0x36')](_0x3c0805[_0xe065('0x36')]));}});};function originate(_0xac5395,_0x199ca3,_0x27863d){return new BPromise(function(_0xecef2,_0x213feb){if(_0x27863d){var _0x4493db=util[_0xe065('0x5b')](_0xe065('0x5c'),path[_0xe065('0x38')](_0xac5395[_0xe065('0x2')])[_0xe065('0x21')],_0xac5395[_0xe065('0x2')]);gs['execute'](_0x4493db)[_0xe065('0x3a')](function(){_0xac5395[_0xe065('0x2')]=util[_0xe065('0x5b')](_0xe065('0x5d'),path[_0xe065('0x38')](_0xac5395[_0xe065('0x2')])[_0xe065('0x5e')],path[_0xe065('0x38')](_0xac5395[_0xe065('0x2')])[_0xe065('0x21')]);_0x199ca3[_0xe065('0x5f')]=_0xac5395[_0xe065('0x2')];ut[_0xe065('0x47')](_0xe065('0x60'),'');ami[_0xe065('0x61')](ut[_0xe065('0x62')](_0xac5395,_0x199ca3))[_0xe065('0x3a')](function(_0x4f722a){_0xecef2(_0x4f722a);})[_0xe065('0x3c')](function(_0x185b5b){_0x213feb(_0x185b5b);});})[_0xe065('0x3c')](function(_0x1993e8){_0x213feb(_0x1993e8);});}else{ami[_0xe065('0x61')](ut[_0xe065('0x62')](_0xac5395,_0x199ca3))[_0xe065('0x3a')](function(_0x7554a0){_0xecef2(_0x7554a0);})[_0xe065('0x3c')](function(_0x3a9a23){_0x213feb(_0x3a9a23);});}});}Fax['prototype']['execOriginate']=function(_0x151fd6,_0x551f72){var _0x3705e3=this;return new BPromise(function(_0x4f3f9d,_0x1df721){var _0x162482=uuid['v4']();var _0x3757bb=ut[_0xe065('0x63')](_0x151fd6,_0x551f72);_0x3705e3[_0xe065('0xd')][_0x162482]=new Action(_0x162482,_0x551f72,_0x151fd6);var _0x3318d4=_0x3705e3[_0xe065('0xd')][_0x162482];if(path[_0xe065('0x38')](_0x151fd6[_0xe065('0x2')])['ext']===_0xe065('0x3b')){originate(_0x3318d4,_0x3757bb,!![])[_0xe065('0x3a')](function(_0x134d0a){_0x4f3f9d(_0x134d0a);})[_0xe065('0x3c')](function(_0x5858d9){_0x1df721(_0x5858d9);});}else{originate(_0x3318d4,_0x3757bb,![])[_0xe065('0x3a')](function(_0x2fdaae){_0x4f3f9d(_0x2fdaae);})[_0xe065('0x3c')](function(_0x4ff8d5){_0x1df721(_0x4ff8d5);});}});};Fax[_0xe065('0x24')][_0xe065('0x64')]=function(_0x3c024b){return!_['isNil'](_0x3c024b)&&!_[_0xe065('0x65')](_0x3c024b[_0xe065('0x21')])&&!_['isNil'](_0x3c024b['active'])&&_0x3c024b[_0xe065('0x66')]&&!_[_0xe065('0x65')](this[_0xe065('0xc')][util[_0xe065('0x5b')](_0xe065('0x67'),_0x3c024b['name'])])&&!_['isNil'](this[_0xe065('0xc')][util[_0xe065('0x5b')]('SIP/%s',_0x3c024b[_0xe065('0x21')])][_0xe065('0x2b')])&&(this[_0xe065('0xc')][util[_0xe065('0x5b')](_0xe065('0x67'),_0x3c024b[_0xe065('0x21')])][_0xe065('0x2b')]===_0xe065('0x68')||this[_0xe065('0xc')][util[_0xe065('0x5b')]('SIP/%s',_0x3c024b['name'])][_0xe065('0x2b')]===_0xe065('0x69'));};Fax[_0xe065('0x24')][_0xe065('0x57')]=function(_0x2c72fa,_0x4e79ab){if(!this[_0xe065('0x64')](_0x2c72fa)){ut[_0xe065('0x47')](_0xe065('0x6a'),_[_0xe065('0x65')](_0x2c72fa)?'':_0x2c72fa[_0xe065('0x21')]+_0xe065('0x6b'));return{'isValid':![],'message':_0xe065('0x6c')};}if(_[_0xe065('0x65')](_0x4e79ab[_0xe065('0x4')])){ut[_0xe065('0x47')](_0xe065('0x6d'),JSON['stringify'](_0x4e79ab));return{'isValid':![],'message':_0xe065('0x6e')};}if(_[_0xe065('0x65')](_0x4e79ab[_0xe065('0x2')])){ut[_0xe065('0x47')](_0xe065('0x6f'),JSON[_0xe065('0x3f')](_0x4e79ab));return{'isValid':![],'message':_0xe065('0x70')};}return{'isValid':!![],'message':_0xe065('0x71')};};module[_0xe065('0x72')]=Fax; \ No newline at end of file +var _0x9c00=['remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','reason','AttachmentId','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','%s/%s.tif','dir','XMF-PATH','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','moment','path','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','prototype','context','hasOwnProperty','localstationid','channels','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','value','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20'];(function(_0x509607,_0x396d04){var _0xe619b5=function(_0x33284a){while(--_0x33284a){_0x509607['push'](_0x509607['shift']());}};_0xe619b5(++_0x396d04);}(_0x9c00,0x1a0));var _0x09c0=function(_0x133f69,_0x2d4632){_0x133f69=_0x133f69-0x0;var _0x3b67bb=_0x9c00[_0x133f69];return _0x3b67bb;};'use strict';var util=require(_0x09c0('0x0'));var _=require(_0x09c0('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x09c0('0x2'));var path=require(_0x09c0('0x3'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x09c0('0x4'));var logger=require(_0x09c0('0x5'))(_0x09c0('0x6'));var ami=require(_0x09c0('0x7'));var rpcDb=require(_0x09c0('0x8'));var Channel=require('./channel');var ut=require('./util/util');var Action=require(_0x09c0('0x9'));var faxAccount=require(_0x09c0('0xa'));var attachment=require(_0x09c0('0xb'));var faxMessage=require(_0x09c0('0xc'));function Fax(_0x17cd9d){this['channels']={};this[_0x09c0('0xd')]=_0x17cd9d[_0x09c0('0xd')];this[_0x09c0('0xe')]=_0x17cd9d[_0x09c0('0xe')];this[_0x09c0('0xf')]={};ami['on'](_0x09c0('0x10'),this[_0x09c0('0x11')][_0x09c0('0x12')](this));ami['on'](_0x09c0('0x13'),this[_0x09c0('0x14')][_0x09c0('0x12')](this));ami['on'](_0x09c0('0x15'),this[_0x09c0('0x16')][_0x09c0('0x12')](this));ami['on'](_0x09c0('0x17'),this[_0x09c0('0x18')][_0x09c0('0x12')](this));ami['on'](_0x09c0('0x19'),this[_0x09c0('0x1a')][_0x09c0('0x12')](this));ami['on'](_0x09c0('0x1b'),this[_0x09c0('0x1c')][_0x09c0('0x12')](this));ami['on'](_0x09c0('0x1d'),this[_0x09c0('0x1e')][_0x09c0('0x12')](this));ami['on']('originateresponse',this['syncOriginateResponse']['bind'](this));}Fax[_0x09c0('0x1f')][_0x09c0('0x11')]=function(_0x3991c6){if(_0x3991c6[_0x09c0('0x20')]==='from-voip-provider'){for(var _0x2c4440 in this['faxAccounts']){if(this['faxAccounts'][_0x09c0('0x21')](_0x2c4440)){if(_0x3991c6['exten']===this[_0x09c0('0xd')][_0x2c4440][_0x09c0('0x22')]){this[_0x09c0('0x23')][_0x3991c6['uniqueid']]={};this[_0x09c0('0x23')][_0x3991c6[_0x09c0('0x24')]][_0x09c0('0x25')]=_0x3991c6[_0x09c0('0x25')];this[_0x09c0('0x23')][_0x3991c6[_0x09c0('0x24')]]['id']=this[_0x09c0('0xd')][_0x2c4440]['id'];this['channels'][_0x3991c6[_0x09c0('0x24')]][_0x09c0('0x26')]=this[_0x09c0('0xd')][_0x2c4440][_0x09c0('0x26')];logger['info'](_0x3991c6['uniqueid'],_0x09c0('0x27'));}}}}if(this[_0x09c0('0xf')][_0x3991c6[_0x09c0('0x24')]]){this[_0x09c0('0x23')][_0x3991c6['uniqueid']]={};this[_0x09c0('0x23')][_0x3991c6[_0x09c0('0x24')]]['channel']=_0x3991c6[_0x09c0('0x25')];logger[_0x09c0('0x28')](_0x3991c6[_0x09c0('0x24')],_0x09c0('0x27'));}};Fax[_0x09c0('0x1f')][_0x09c0('0x14')]=function(_0x45cc64){if(this[_0x09c0('0x23')][_0x45cc64[_0x09c0('0x24')]]){for(var _0x1aa80e in _0x45cc64[_0x09c0('0x29')]){if(_0x45cc64['variable'][_0x09c0('0x21')](_0x1aa80e)){this[_0x09c0('0x23')][_0x45cc64['uniqueid']][_0x1aa80e]=_0x45cc64[_0x09c0('0x2a')];}}}};Fax['prototype'][_0x09c0('0x16')]=function(_0x4d6bdc){if(this[_0x09c0('0x23')][_0x4d6bdc[_0x09c0('0x24')]]){this[_0x09c0('0x23')][_0x4d6bdc[_0x09c0('0x24')]]['channelstate']=_0x4d6bdc['channelstate'];this[_0x09c0('0x23')][_0x4d6bdc[_0x09c0('0x24')]][_0x09c0('0x2b')]=_0x4d6bdc['channelstatedesc'];}};Fax[_0x09c0('0x1f')]['syncNewExten']=function(_0x350cd3){if(this[_0x09c0('0x23')][_0x350cd3[_0x09c0('0x24')]]){for(var _0x500cf8 in _0x350cd3[_0x09c0('0x29')]){if(_0x350cd3[_0x09c0('0x29')][_0x09c0('0x21')](_0x500cf8)){this[_0x09c0('0x23')][_0x350cd3[_0x09c0('0x24')]][_0x500cf8]=_0x350cd3[_0x09c0('0x2a')];}}}};Fax[_0x09c0('0x1f')]['syncFaxStatus']=function(_0x26da22){if(this[_0x09c0('0x23')][_0x26da22[_0x09c0('0x24')]]){this[_0x09c0('0x23')][_0x26da22[_0x09c0('0x24')]]['operation']=_0x26da22[_0x09c0('0x2c')];this[_0x09c0('0x23')][_0x26da22[_0x09c0('0x24')]][_0x09c0('0x2d')]=_0x26da22[_0x09c0('0x2d')];this['channels'][_0x26da22[_0x09c0('0x24')]][_0x09c0('0x22')]=_0x26da22[_0x09c0('0x22')];this[_0x09c0('0x23')][_0x26da22[_0x09c0('0x24')]][_0x09c0('0x2e')]=_0x26da22[_0x09c0('0x2e')];logger['info'](_0x26da22[_0x09c0('0x24')],_0x09c0('0x2f'));}};Fax[_0x09c0('0x1f')][_0x09c0('0x1c')]=function(_0x453c23){var _0x4e98f1=this;if(this['channels'][_0x453c23['uniqueid']]){var _0x4a14dc=this[_0x09c0('0x23')][_0x453c23[_0x09c0('0x24')]]['id'];this[_0x09c0('0x23')][_0x453c23[_0x09c0('0x24')]][_0x09c0('0x30')]=_0x453c23['remotestationid'];this[_0x09c0('0x23')][_0x453c23[_0x09c0('0x24')]]['pagestransferred']=_0x453c23[_0x09c0('0x31')];this['channels'][_0x453c23[_0x09c0('0x24')]]['localstationid']=_0x453c23[_0x09c0('0x22')];this[_0x09c0('0x23')][_0x453c23['uniqueid']][_0x09c0('0x32')]=_0x453c23[_0x09c0('0x32')];this['channels'][_0x453c23[_0x09c0('0x24')]][_0x09c0('0x33')]=_0x453c23[_0x09c0('0x33')];this[_0x09c0('0x23')][_0x453c23[_0x09c0('0x24')]][_0x09c0('0x2e')]=_0x453c23['filename'];this[_0x09c0('0x23')][_0x453c23[_0x09c0('0x24')]][_0x09c0('0x34')]=_0x453c23['calleridnum'];if(this[_0x09c0('0x23')][_0x453c23[_0x09c0('0x24')]][_0x09c0('0x31')]>0x0){tiff2pdf(_0x453c23['filename'],_0x09c0('0x35'),function(_0x59d188){logger['info'](_0x453c23['uniqueid'],_0x09c0('0x36'),_0x59d188[_0x09c0('0x37')]);attachment['create']({'name':path[_0x09c0('0x38')](_0x453c23[_0x09c0('0x2e')])['name'],'basename':path[_0x09c0('0x38')](_0x453c23[_0x09c0('0x2e')])[_0x09c0('0x26')]+_0x09c0('0x39'),'type':_0x09c0('0x3a')})['then'](function(_0x330fe7){faxAccount['notify'](_0x4a14dc,{'from':_0x453c23['calleridnum'],'mapKey':_0x09c0('0x6'),'body':path[_0x09c0('0x38')](_0x453c23[_0x09c0('0x2e')])[_0x09c0('0x26')]+_0x09c0('0x39'),'AttachmentId':_0x330fe7['id']})[_0x09c0('0x3b')](function(_0x52a4ff){logger['error'](_0x453c23['uniqueid'],_0x09c0('0x3c'),JSON[_0x09c0('0x3d')](_0x52a4ff));});})[_0x09c0('0x3b')](function(_0x56ec01){logger[_0x09c0('0x3e')](_0x453c23[_0x09c0('0x24')],_0x09c0('0x3f'),JSON[_0x09c0('0x3d')](_0x56ec01));});});}logger[_0x09c0('0x28')](_0x453c23[_0x09c0('0x24')],_0x09c0('0x3f'));}};Fax[_0x09c0('0x1f')][_0x09c0('0x40')]=function(_0x38085c){if(this[_0x09c0('0xf')][_0x38085c[_0x09c0('0x24')]]){_[_0x09c0('0x41')](this[_0x09c0('0x23')][_0x38085c[_0x09c0('0x24')]],_[_0x09c0('0x42')](_0x38085c,[_0x09c0('0x43'),_0x09c0('0x44')]));}};function updateStatus(_0x3ae68f){if(_0x3ae68f[_0x09c0('0x45')]){faxMessage['update'](_0x3ae68f[_0x09c0('0x45')],{'failMessage':_0x09c0('0x46')})[_0x09c0('0x47')](function(_0x30206e){ut[_0x09c0('0x48')]('[Fax][Message][Error][Updated]',_0x30206e);})[_0x09c0('0x3b')](function(_0x866d31){ut[_0x09c0('0x48')]('[Fax][Message][Error][NoUpdate1]',_0x866d31);});}else{ut[_0x09c0('0x48')](_0x09c0('0x49'));}}Fax[_0x09c0('0x1f')][_0x09c0('0x4a')]=function(_0x55b0f0,_0xebfd6d,_0x45ecd0){var _0x499905=this;var _0x1285f8={};if(_0xebfd6d){_0x1285f8={'read':_0xebfd6d};}else{_0x1285f8={'failMessage':_0x45ecd0};}if(this[_0x09c0('0xf')][_0x55b0f0][_0x09c0('0x45')]){faxMessage[_0x09c0('0x4b')](this[_0x09c0('0xf')][_0x55b0f0][_0x09c0('0x45')],_0x1285f8)[_0x09c0('0x47')](function(_0x4987cf){ut['logger'](_0x09c0('0x4c'),_0x4987cf);})[_0x09c0('0x3b')](function(_0x1ab662){ut['logger'](_0x09c0('0x4d'),_0x1ab662);})['finally'](function(){delete _0x499905[_0x09c0('0x23')][_0x55b0f0];delete _0x499905[_0x09c0('0xf')][_0x55b0f0];});}else{ut[_0x09c0('0x48')](_0x09c0('0x4e'));delete this[_0x09c0('0x23')][_0x55b0f0];delete this[_0x09c0('0xf')][_0x55b0f0];}};Fax[_0x09c0('0x1f')]['syncHangup']=function(_0xa201bf){var _0x2d6201=this;if(this[_0x09c0('0x23')][_0xa201bf[_0x09c0('0x24')]]){if(this[_0x09c0('0xf')][_0xa201bf[_0x09c0('0x24')]]){this[_0x09c0('0x23')][_0xa201bf[_0x09c0('0x24')]]['id']=this[_0x09c0('0xf')][_0xa201bf[_0x09c0('0x24')]]['id'];this[_0x09c0('0x23')][_0xa201bf['uniqueid']][_0x09c0('0x26')]=this[_0x09c0('0xf')][_0xa201bf[_0x09c0('0x24')]][_0x09c0('0x26')];}logger['info'](_0xa201bf[_0x09c0('0x24')],this['actions'][_0xa201bf[_0x09c0('0x24')]]?_0x09c0('0x4f'):_0x09c0('0x50'),JSON['stringify'](this['channels'][_0xa201bf[_0x09c0('0x24')]]));if(this[_0x09c0('0xf')][_0xa201bf[_0x09c0('0x24')]]){if(this[_0x09c0('0x23')][_0xa201bf['uniqueid']][_0x09c0('0x51')]>0x0&&this[_0x09c0('0x23')][_0xa201bf['uniqueid']][_0x09c0('0x19')]===_0x09c0('0x52')){this[_0x09c0('0x4a')](_0xa201bf[_0x09c0('0x24')],!![]);}else{this['updateStatus'](_0xa201bf[_0x09c0('0x24')],![],this[_0x09c0('0x23')][_0xa201bf[_0x09c0('0x24')]][_0x09c0('0x53')]?_0x09c0('0x54')+this[_0x09c0('0x23')][_0xa201bf[_0x09c0('0x24')]][_0x09c0('0x53')]:_0x09c0('0x55'));}}}};Fax[_0x09c0('0x1f')][_0x09c0('0x56')]=function(_0x2906cb){var _0x2d67e8=this;return new BPromise(function(_0x484df5,_0x13f3af){_0x2d67e8[_0x09c0('0x57')](_0x2906cb,_0x2d67e8[_0x09c0('0xd')][_0x2906cb[_0x09c0('0x58')]])[_0x09c0('0x47')](function(_0x54295a){ut[_0x09c0('0x48')](_0x09c0('0x59'),_0x54295a);_0x484df5(ut[_0x09c0('0x37')](_0x09c0('0x5a')));})['catch'](function(_0x1d395e){ut[_0x09c0('0x48')]('[Fax][execOriginate][failure]',_0x1d395e);updateStatus(_0x2906cb);_0x13f3af(ut[_0x09c0('0x37')](_0x09c0('0x5b')));});});};Fax[_0x09c0('0x1f')][_0x09c0('0x5c')]=function(_0x1e9dd5){var _0x5a9516=this;return new BPromise(function(_0x19503e,_0x302c81){var _0x3a3f24=_0x5a9516[_0x09c0('0x5d')](_0x5a9516[_0x09c0('0xd')][_0x1e9dd5['FaxAccountId']][_0x09c0('0x5e')],_0x1e9dd5);if(_0x3a3f24[_0x09c0('0x5f')]){_0x19503e(ut[_0x09c0('0x37')](_0x09c0('0x60')));}else{_0x302c81(ut[_0x09c0('0x37')](_0x3a3f24[_0x09c0('0x37')]));}});};function originate(_0x59c57a,_0x51fc84,_0x583c0d){return new BPromise(function(_0x52fe65,_0x7c1cb8){if(_0x583c0d){var _0x1dcd69=util[_0x09c0('0x61')]('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[_0x09c0('0x38')](_0x59c57a['path'])[_0x09c0('0x26')],_0x59c57a[_0x09c0('0x3')]);gs['execute'](_0x1dcd69)[_0x09c0('0x47')](function(){_0x59c57a['path']=util['format'](_0x09c0('0x62'),path[_0x09c0('0x38')](_0x59c57a[_0x09c0('0x3')])[_0x09c0('0x63')],path[_0x09c0('0x38')](_0x59c57a[_0x09c0('0x3')])[_0x09c0('0x26')]);_0x51fc84[_0x09c0('0x64')]=_0x59c57a[_0x09c0('0x3')];ut[_0x09c0('0x48')]('Convert\x20pdf\x20to\x20tif','');ami[_0x09c0('0x65')](ut[_0x09c0('0x66')](_0x59c57a,_0x51fc84))['then'](function(_0x4e1d42){_0x52fe65(_0x4e1d42);})[_0x09c0('0x3b')](function(_0x164bac){_0x7c1cb8(_0x164bac);});})[_0x09c0('0x3b')](function(_0x302e0d){_0x7c1cb8(_0x302e0d);});}else{ami[_0x09c0('0x65')](ut[_0x09c0('0x66')](_0x59c57a,_0x51fc84))[_0x09c0('0x47')](function(_0x53c5dd){_0x52fe65(_0x53c5dd);})[_0x09c0('0x3b')](function(_0x56b94b){_0x7c1cb8(_0x56b94b);});}});}Fax[_0x09c0('0x1f')][_0x09c0('0x57')]=function(_0x3ecf97,_0x1a81b1){var _0x2d97cb=this;return new BPromise(function(_0x4f35d1,_0x167303){var _0x4ce49a=uuid['v4']();var _0x28e4b7=ut['addVariables'](_0x3ecf97,_0x1a81b1);_0x2d97cb[_0x09c0('0xf')][_0x4ce49a]=new Action(_0x4ce49a,_0x1a81b1,_0x3ecf97);var _0x3e8b19=_0x2d97cb[_0x09c0('0xf')][_0x4ce49a];if(path[_0x09c0('0x38')](_0x3ecf97[_0x09c0('0x3')])[_0x09c0('0x67')]===_0x09c0('0x39')){originate(_0x3e8b19,_0x28e4b7,!![])['then'](function(_0x4ab50d){_0x4f35d1(_0x4ab50d);})[_0x09c0('0x3b')](function(_0x430a78){_0x167303(_0x430a78);});}else{originate(_0x3e8b19,_0x28e4b7,![])[_0x09c0('0x47')](function(_0x309d0a){_0x4f35d1(_0x309d0a);})[_0x09c0('0x3b')](function(_0x1041d9){_0x167303(_0x1041d9);});}});};Fax[_0x09c0('0x1f')][_0x09c0('0x68')]=function(_0x97cc44){return!_[_0x09c0('0x69')](_0x97cc44)&&!_['isNil'](_0x97cc44['name'])&&!_['isNil'](_0x97cc44[_0x09c0('0x6a')])&&_0x97cc44[_0x09c0('0x6a')]&&!_[_0x09c0('0x69')](this['trunks'][util['format'](_0x09c0('0x6b'),_0x97cc44['name'])])&&!_[_0x09c0('0x69')](this[_0x09c0('0xe')][util['format'](_0x09c0('0x6b'),_0x97cc44['name'])][_0x09c0('0x2d')])&&(this[_0x09c0('0xe')][util[_0x09c0('0x61')]('SIP/%s',_0x97cc44[_0x09c0('0x26')])][_0x09c0('0x2d')]===_0x09c0('0x6c')||this[_0x09c0('0xe')][util[_0x09c0('0x61')](_0x09c0('0x6b'),_0x97cc44[_0x09c0('0x26')])][_0x09c0('0x2d')]===_0x09c0('0x6d'));};Fax[_0x09c0('0x1f')][_0x09c0('0x5d')]=function(_0xf25624,_0x592151){if(!this[_0x09c0('0x68')](_0xf25624)){ut[_0x09c0('0x48')](_0x09c0('0x6e'),_[_0x09c0('0x69')](_0xf25624)?'':_0xf25624[_0x09c0('0x26')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x09c0('0x6f')};}if(_['isNil'](_0x592151['fax'])){ut[_0x09c0('0x48')](_0x09c0('0x70'),JSON[_0x09c0('0x3d')](_0x592151));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x09c0('0x69')](_0x592151[_0x09c0('0x3')])){ut[_0x09c0('0x48')](_0x09c0('0x71'),JSON[_0x09c0('0x3d')](_0x592151));return{'isValid':![],'message':_0x09c0('0x72')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x09c0('0x73')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index f6f38c1..f39bcf4 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 _0x2366=['lodash','../rpc/faxAccount','error','inspect','notify','then','catch','[Notify]\x20','util','bluebird','preview'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x2366,0x1c0));var _0x6236=function(_0xf1b134,_0xb399dd){_0xf1b134=_0xf1b134-0x0;var _0x139dbb=_0x2366[_0xf1b134];return _0x139dbb;};'use strict';var util=require(_0x6236('0x0'));var BPromise=require(_0x6236('0x1'));var logger=require('../../../config/logger')(_0x6236('0x2'));var _=require(_0x6236('0x3'));var faxAccount=require(_0x6236('0x4'));function loggerCatch(_0x2a4f83){return function(_0x5aa48f){logger[_0x6236('0x5')](_0x2a4f83,util[_0x6236('0x6')](_0x5aa48f,{'showHidden':![],'depth':null}));};}exports[_0x6236('0x7')]=function(_0x238bdf,_0x2fd6fd){return BPromise['resolve']()[_0x6236('0x8')](faxAccount[_0x6236('0x7')](_0x238bdf,_0x2fd6fd))[_0x6236('0x9')](loggerCatch(_0x6236('0xa')));}; \ No newline at end of file +var _0xe5a1=['resolve','then','[Notify]\x20','bluebird','../../../config/logger','preview','../rpc/faxAccount','inspect','notify'];(function(_0x516eef,_0x3c0047){var _0x25c38f=function(_0x341771){while(--_0x341771){_0x516eef['push'](_0x516eef['shift']());}};_0x25c38f(++_0x3c0047);}(_0xe5a1,0x1aa));var _0x1e5a=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xe5a1[_0x4cf98e];return _0x1623ac;};'use strict';var util=require('util');var BPromise=require(_0x1e5a('0x0'));var logger=require(_0x1e5a('0x1'))(_0x1e5a('0x2'));var _=require('lodash');var faxAccount=require(_0x1e5a('0x3'));function loggerCatch(_0x4071b6){return function(_0x303289){logger['error'](_0x4071b6,util[_0x1e5a('0x4')](_0x303289,{'showHidden':![],'depth':null}));};}exports[_0x1e5a('0x5')]=function(_0x209eb1,_0x148be7){return BPromise[_0x1e5a('0x6')]()[_0x1e5a('0x7')](faxAccount[_0x1e5a('0x5')](_0x209eb1,_0x148be7))['catch'](loggerCatch(_0x1e5a('0x8')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index c4187be..e8409b8 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 _0x9673=['child_process','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','fax','bluebird'];(function(_0x3c2a87,_0x301e33){var _0x3a4efd=function(_0x2c5e19){while(--_0x2c5e19){_0x3c2a87['push'](_0x3c2a87['shift']());}};_0x3a4efd(++_0x301e33);}(_0x9673,0xde));var _0x3967=function(_0x28e659,_0x21addb){_0x28e659=_0x28e659-0x0;var _0x185287=_0x9673[_0x28e659];return _0x185287;};'use strict';var util=require(_0x3967('0x0'));var logger=require('../../../../config/logger')(_0x3967('0x1'));var BPromise=require(_0x3967('0x2'));var exec=require(_0x3967('0x3'))['exec'];exports[_0x3967('0x4')]=function(_0x22ca9b){return new BPromise(function(_0x17480a,_0xcd48f4){exec(_0x22ca9b,function(_0x32c0f2,_0x2d4802,_0x595d07){logger[_0x3967('0x5')](_0x3967('0x6'),_0x2d4802);if(_0x32c0f2){logger[_0x3967('0x5')](_0x3967('0x6'),_0x3967('0x7'),util[_0x3967('0x8')](_0x32c0f2,{'showHidden':![],'depth':null}),_0x2d4802,_0x595d07);_0xcd48f4(_0x32c0f2);}_0x17480a(_0x2d4802);});});}; \ No newline at end of file +var _0x21d9=['child_process','exec','execute','info','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird'];(function(_0x4887c8,_0xc1d4b4){var _0x31e0b7=function(_0xaf5910){while(--_0xaf5910){_0x4887c8['push'](_0x4887c8['shift']());}};_0x31e0b7(++_0xc1d4b4);}(_0x21d9,0x13c));var _0x921d=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x21d9[_0x1ddedd];return _0xa3e1ac;};'use strict';var util=require(_0x921d('0x0'));var logger=require(_0x921d('0x1'))(_0x921d('0x2'));var BPromise=require(_0x921d('0x3'));var exec=require(_0x921d('0x4'))[_0x921d('0x5')];exports[_0x921d('0x6')]=function(_0xd67288){return new BPromise(function(_0xec9bec,_0x196a5c){exec(_0xd67288,function(_0x5df7f7,_0x4ae0d7,_0x245a81){logger['info']('Exec\x20gs',_0x4ae0d7);if(_0x5df7f7){logger[_0x921d('0x7')]('Exec\x20gs',_0x921d('0x8'),util[_0x921d('0x9')](_0x5df7f7,{'showHidden':![],'depth':null}),_0x4ae0d7,_0x245a81);_0x196a5c(_0x5df7f7);}_0xec9bec(_0x4ae0d7);});});}; \ 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 c2d02bf..6128f9c 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 _0xc41c=['uniqueid','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','format','gateway','faxdetect','variablesAction'];(function(_0x580eda,_0x5569d7){var _0x16df02=function(_0x483436){while(--_0x483436){_0x580eda['push'](_0x580eda['shift']());}};_0x16df02(++_0x5569d7);}(_0xc41c,0x90));var _0xcc41=function(_0x4819e3,_0x5dcdb1){_0x4819e3=_0x4819e3-0x0;var _0x3255c8=_0xc41c[_0x4819e3];return _0x3255c8;};'use strict';var util=require('util');var _=require(_0xcc41('0x0'));var moment=require(_0xcc41('0x1'));var logger=require(_0xcc41('0x2'))(_0xcc41('0x3'));exports[_0xcc41('0x4')]=function(_0x4ea08a){return{'message':_0x4ea08a};};exports[_0xcc41('0x5')]=function(_0x1cd07d,_0x41b887){logger[_0xcc41('0x6')](_0x1cd07d,util[_0xcc41('0x7')](_0x41b887,{'showHidden':![],'depth':null}));};exports[_0xcc41('0x8')]=function(_0x196043,_0x382bfb){var _0x28e3bb={'XMF-ECM':_0x382bfb[_0xcc41('0x9')],'XMF-HEADERINFO':_0x382bfb[_0xcc41('0xa')],'XMF-MINRATE':_0x382bfb[_0xcc41('0xb')],'XMF-MAXRATE':_0x382bfb['maxrate'],'XMF-MODEM':util[_0xcc41('0xc')]('\x22%s\x22',_0x382bfb['modem']),'XMF-GATEWAY':_0x382bfb[_0xcc41('0xd')],'XMF-FAXDETECT':_0x382bfb[_0xcc41('0xe')],'XMF-T38TIMEOUT':_0x382bfb['t38timeout'],'XMF-LOCALSTATIONID':_0x382bfb['localstationid'],'XMF-PATH':_0x196043['path']};return _0x28e3bb;};exports[_0xcc41('0xf')]=function(_0x52f200,_0xa169fd){return{'actionid':_0x52f200[_0xcc41('0x10')],'action':'originate','channel':_0x52f200['channel'],'Exten':_0xcc41('0x11'),'Context':_0xcc41('0x12'),'Priority':'1','callerid':util[_0xcc41('0xc')](_0xcc41('0x13'),_0x52f200[_0xcc41('0xa')]?_0x52f200[_0xcc41('0xa')]:'',_0x52f200['localstationid']),'variable':_0xa169fd,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x52f200[_0xcc41('0x10')]};}; \ No newline at end of file +var _0xee46=['channel','from-sip','localstationid','uniqueid','util','lodash','fax','logger','info','inspect','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','path','variablesAction','originate'];(function(_0x2a7544,_0x47e6d1){var _0xdaac83=function(_0x3adf98){while(--_0x3adf98){_0x2a7544['push'](_0x2a7544['shift']());}};_0xdaac83(++_0x47e6d1);}(_0xee46,0xea));var _0x6ee4=function(_0x238a2a,_0x2188ba){_0x238a2a=_0x238a2a-0x0;var _0xa83043=_0xee46[_0x238a2a];return _0xa83043;};'use strict';var util=require(_0x6ee4('0x0'));var _=require(_0x6ee4('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')(_0x6ee4('0x2'));exports['message']=function(_0x225641){return{'message':_0x225641};};exports[_0x6ee4('0x3')]=function(_0x3bb2cc,_0x4e6330){logger[_0x6ee4('0x4')](_0x3bb2cc,util[_0x6ee4('0x5')](_0x4e6330,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x30c60e,_0x53d642){var _0x164ee0={'XMF-ECM':_0x53d642[_0x6ee4('0x6')],'XMF-HEADERINFO':_0x53d642[_0x6ee4('0x7')],'XMF-MINRATE':_0x53d642[_0x6ee4('0x8')],'XMF-MAXRATE':_0x53d642[_0x6ee4('0x9')],'XMF-MODEM':util[_0x6ee4('0xa')](_0x6ee4('0xb'),_0x53d642[_0x6ee4('0xc')]),'XMF-GATEWAY':_0x53d642[_0x6ee4('0xd')],'XMF-FAXDETECT':_0x53d642[_0x6ee4('0xe')],'XMF-T38TIMEOUT':_0x53d642[_0x6ee4('0xf')],'XMF-LOCALSTATIONID':_0x53d642['localstationid'],'XMF-PATH':_0x30c60e[_0x6ee4('0x10')]};return _0x164ee0;};exports[_0x6ee4('0x11')]=function(_0xdd067b,_0x59b335){return{'actionid':_0xdd067b['uniqueid'],'action':_0x6ee4('0x12'),'channel':_0xdd067b[_0x6ee4('0x13')],'Exten':'xcally-motion-fax','Context':_0x6ee4('0x14'),'Priority':'1','callerid':util[_0x6ee4('0xa')]('\x22%s\x22\x20<%s>',_0xdd067b[_0x6ee4('0x7')]?_0xdd067b[_0x6ee4('0x7')]:'',_0xdd067b[_0x6ee4('0x15')]),'variable':_0x59b335,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0xdd067b[_0x6ee4('0x16')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index cda4534..647440c 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 _0xb820=['./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','bluebird','util'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb820,0x92));var _0x0b82=function(_0x5de27c,_0x265463){_0x5de27c=_0x5de27c-0x0;var _0x980925=_0xb820[_0x5de27c];return _0x980925;};'use strict';var BPromise=require(_0x0b82('0x0'));var util=require(_0x0b82('0x1'));var moment=require('moment');var server=require(_0x0b82('0x2'));var Realtime=require(_0x0b82('0x3'));var Report=require(_0x0b82('0x4'));var Acw=require(_0x0b82('0x5'));var Trigger=require(_0x0b82('0x6'));var Dialer=require(_0x0b82('0x7'));var Preview=require(_0x0b82('0x8'));var Fax=require('./fax');var user=require(_0x0b82('0x9'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x0b82('0xa'));var trunk=require('./rpc/trunk');var trigger=require(_0x0b82('0xb'));var template=require(_0x0b82('0xc'));var cmHopperHistory=require(_0x0b82('0xd'));var campaign=require(_0x0b82('0xe'));var voiceExtension=require(_0x0b82('0xf'));var faxAccount=require(_0x0b82('0x10'));var zendesk=require(_0x0b82('0x11'));var salesforce=require(_0x0b82('0x12'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x0b82('0x13'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x0b82('0x14'));var vtiger=require(_0x0b82('0x15'));var freshsales=require(_0x0b82('0x16'));var servicenow=require(_0x0b82('0x17'));var dynamics365=require(_0x0b82('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(_0x0b82('0x19'))(_0x0b82('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x0b82('0x1b')](_0x0b82('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get']('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x0b82('0x1d')]()[_0x0b82('0x1e')](user[_0x0b82('0x1f')]())[_0x0b82('0x1e')](realtime['initAgents']())[_0x0b82('0x1e')](user[_0x0b82('0x20')]())['then'](realtime[_0x0b82('0x21')]())[_0x0b82('0x1e')](trunk[_0x0b82('0x22')]())[_0x0b82('0x1e')](realtime[_0x0b82('0x23')]())[_0x0b82('0x1e')](voiceQueue[_0x0b82('0x24')]())[_0x0b82('0x1e')](realtime[_0x0b82('0x25')]())[_0x0b82('0x1e')](trigger[_0x0b82('0x26')]())[_0x0b82('0x1e')](realtime['initTriggers']())[_0x0b82('0x1e')](template[_0x0b82('0x27')]())[_0x0b82('0x1e')](realtime['initTemplates']())[_0x0b82('0x1e')](zendesk[_0x0b82('0x28')]())[_0x0b82('0x1e')](realtime[_0x0b82('0x29')]())['then'](salesforce[_0x0b82('0x2a')]())[_0x0b82('0x1e')](realtime[_0x0b82('0x2b')]())[_0x0b82('0x1e')](sugarcrm[_0x0b82('0x2c')]())[_0x0b82('0x1e')](realtime[_0x0b82('0x2d')]())['then'](freshdesk[_0x0b82('0x2e')]())[_0x0b82('0x1e')](realtime[_0x0b82('0x2f')]())[_0x0b82('0x1e')](desk['getDeskAccounts']())[_0x0b82('0x1e')](realtime[_0x0b82('0x30')]())[_0x0b82('0x1e')](zoho[_0x0b82('0x31')]())['then'](realtime[_0x0b82('0x32')]())['then'](vtiger['getVtigerAccounts']())[_0x0b82('0x1e')](realtime[_0x0b82('0x33')]())[_0x0b82('0x1e')](freshsales['getFreshsalesAccounts']())[_0x0b82('0x1e')](realtime[_0x0b82('0x34')]())['then'](servicenow[_0x0b82('0x35')]())[_0x0b82('0x1e')](realtime[_0x0b82('0x36')]())[_0x0b82('0x1e')](dynamics365[_0x0b82('0x37')]())[_0x0b82('0x1e')](realtime[_0x0b82('0x38')]())[_0x0b82('0x1e')](campaign[_0x0b82('0x39')]())[_0x0b82('0x1e')](realtime[_0x0b82('0x3a')]())[_0x0b82('0x1e')](voiceExtension[_0x0b82('0x3b')]())[_0x0b82('0x1e')](realtime['initVoiceExtensions']())[_0x0b82('0x1e')](faxAccount['getFaxAccounts']())[_0x0b82('0x1e')](realtime[_0x0b82('0x3c')]())[_0x0b82('0x1e')](function(){return realtime;});}function initParams(){return BPromise['resolve']()['then'](voiceQueueReport[_0x0b82('0x3d')]())['then'](realtime[_0x0b82('0x3e')]())['then'](cmHopperHistory[_0x0b82('0x3f')]())[_0x0b82('0x1e')](realtime['initVoiceQueueHopperHistory']())[_0x0b82('0x1e')](cmHopperHistory[_0x0b82('0x40')]())[_0x0b82('0x1e')](realtime[_0x0b82('0x41')]())[_0x0b82('0x1e')](voiceCallReport[_0x0b82('0x42')]())[_0x0b82('0x1e')](realtime[_0x0b82('0x43')]())[_0x0b82('0x44')](function(_0x2f1cae){logger[_0x0b82('0x45')](_0x0b82('0x46'),util[_0x0b82('0x47')](_0x2f1cae,{'showHidden':![],'depth':null}));});}function main(){return server[_0x0b82('0x48')](realtime,preview,fax)[_0x0b82('0x1e')](function(_0x43a653){return initRealtime();})['then'](function(){return initParams();})[_0x0b82('0x1e')](function(){report[_0x0b82('0x49')]();setInterval(initRealtime,0x1388);})[_0x0b82('0x44')](function(_0x3142cd){logger[_0x0b82('0x45')]('[index.js][main]',util[_0x0b82('0x47')](_0x3142cd,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x7f09=['./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','ami','hour','get','then','getAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','[index.js][initParams]','inspect','listen','util','moment','./server','./realtime','./report','./trigger','./dialer','./preview','./fax'];(function(_0x5a09b1,_0x451146){var _0x5b49af=function(_0x3dfdd4){while(--_0x3dfdd4){_0x5a09b1['push'](_0x5a09b1['shift']());}};_0x5b49af(++_0x451146);}(_0x7f09,0x1b3));var _0x97f0=function(_0x44a18a,_0x3d46e3){_0x44a18a=_0x44a18a-0x0;var _0x253cfc=_0x7f09[_0x44a18a];return _0x253cfc;};'use strict';var BPromise=require('bluebird');var util=require(_0x97f0('0x0'));var moment=require(_0x97f0('0x1'));var server=require(_0x97f0('0x2'));var Realtime=require(_0x97f0('0x3'));var Report=require(_0x97f0('0x4'));var Acw=require('./acw');var Trigger=require(_0x97f0('0x5'));var Dialer=require(_0x97f0('0x6'));var Preview=require(_0x97f0('0x7'));var Fax=require(_0x97f0('0x8'));var user=require(_0x97f0('0x9'));var voiceQueue=require(_0x97f0('0xa'));var voiceQueueReport=require(_0x97f0('0xb'));var voiceCallReport=require(_0x97f0('0xc'));var trunk=require(_0x97f0('0xd'));var trigger=require(_0x97f0('0xe'));var template=require(_0x97f0('0xf'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require('./rpc/campaign');var voiceExtension=require(_0x97f0('0x10'));var faxAccount=require(_0x97f0('0x11'));var zendesk=require(_0x97f0('0x12'));var salesforce=require(_0x97f0('0x13'));var sugarcrm=require(_0x97f0('0x14'));var freshdesk=require(_0x97f0('0x15'));var desk=require(_0x97f0('0x16'));var zoho=require(_0x97f0('0x17'));var vtiger=require(_0x97f0('0x18'));var freshsales=require(_0x97f0('0x19'));var servicenow=require(_0x97f0('0x1a'));var dynamics365=require(_0x97f0('0x1b'));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')(_0x97f0('0x1c'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x97f0('0x1d'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x97f0('0x1e')](_0x97f0('0x1d'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x97f0('0x1f')](user[_0x97f0('0x20')]())[_0x97f0('0x1f')](realtime['initAgents']())[_0x97f0('0x1f')](user[_0x97f0('0x21')]())['then'](realtime[_0x97f0('0x22')]())['then'](trunk[_0x97f0('0x23')]())[_0x97f0('0x1f')](realtime[_0x97f0('0x24')]())[_0x97f0('0x1f')](voiceQueue[_0x97f0('0x25')]())['then'](realtime[_0x97f0('0x26')]())[_0x97f0('0x1f')](trigger[_0x97f0('0x27')]())[_0x97f0('0x1f')](realtime[_0x97f0('0x28')]())['then'](template[_0x97f0('0x29')]())['then'](realtime[_0x97f0('0x2a')]())['then'](zendesk[_0x97f0('0x2b')]())[_0x97f0('0x1f')](realtime['initZendeskAccounts']())[_0x97f0('0x1f')](salesforce[_0x97f0('0x2c')]())['then'](realtime[_0x97f0('0x2d')]())['then'](sugarcrm[_0x97f0('0x2e')]())[_0x97f0('0x1f')](realtime['initSugarcrmAccounts']())[_0x97f0('0x1f')](freshdesk[_0x97f0('0x2f')]())[_0x97f0('0x1f')](realtime[_0x97f0('0x30')]())['then'](desk[_0x97f0('0x31')]())[_0x97f0('0x1f')](realtime[_0x97f0('0x32')]())[_0x97f0('0x1f')](zoho[_0x97f0('0x33')]())['then'](realtime['initZohoAccounts']())[_0x97f0('0x1f')](vtiger[_0x97f0('0x34')]())[_0x97f0('0x1f')](realtime[_0x97f0('0x35')]())[_0x97f0('0x1f')](freshsales[_0x97f0('0x36')]())['then'](realtime[_0x97f0('0x37')]())[_0x97f0('0x1f')](servicenow[_0x97f0('0x38')]())[_0x97f0('0x1f')](realtime[_0x97f0('0x39')]())[_0x97f0('0x1f')](dynamics365[_0x97f0('0x3a')]())[_0x97f0('0x1f')](realtime[_0x97f0('0x3b')]())[_0x97f0('0x1f')](campaign['getCampaigns']())['then'](realtime['initCampaigns']())[_0x97f0('0x1f')](voiceExtension[_0x97f0('0x3c')]())['then'](realtime[_0x97f0('0x3d')]())['then'](faxAccount[_0x97f0('0x3e')]())[_0x97f0('0x1f')](realtime[_0x97f0('0x3f')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x97f0('0x40')]()[_0x97f0('0x1f')](voiceQueueReport[_0x97f0('0x41')]())['then'](realtime[_0x97f0('0x42')]())[_0x97f0('0x1f')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x97f0('0x1f')](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory[_0x97f0('0x43')]())[_0x97f0('0x1f')](realtime['initCampaignHopperHistory']())['then'](voiceCallReport[_0x97f0('0x44')]())[_0x97f0('0x1f')](realtime[_0x97f0('0x45')]())['catch'](function(_0x17a1e9){logger[_0x97f0('0x46')](_0x97f0('0x47'),util[_0x97f0('0x48')](_0x17a1e9,{'showHidden':![],'depth':null}));});}function main(){return server[_0x97f0('0x49')](realtime,preview,fax)[_0x97f0('0x1f')](function(_0x2b5046){return initRealtime();})[_0x97f0('0x1f')](function(){return initParams();})[_0x97f0('0x1f')](function(){report['sync']();setInterval(initRealtime,0x1388);})['catch'](function(_0x4b536c){logger[_0x97f0('0x46')]('[index.js][main]',util[_0x97f0('0x48')](_0x4b536c,{'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 bf64cc6..651c51d 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 _0x70e0=['name','voiceStatusQueue','onhold','stringify','md5','user:%s','user:save','emit','user:presence','lodash','util','moment','../../../config/environment','redis','defaults','socket.io-emitter','email','accountcode','fullname','state','unknown','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','local','toLowerCase','not_inuse','idle','inuse','statePause','toNumber','format'];(function(_0x20b34e,_0x12b834){var _0x33e890=function(_0x54dcdc){while(--_0x54dcdc){_0x20b34e['push'](_0x20b34e['shift']());}};_0x33e890(++_0x12b834);}(_0x70e0,0x17b));var _0x070e=function(_0x7ab001,_0xc28d15){_0x7ab001=_0x7ab001-0x0;var _0x46a460=_0x70e0[_0x7ab001];return _0x46a460;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x070e('0x3'));config[_0x070e('0x4')]=_[_0x070e('0x5')](config[_0x070e('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x070e('0x6'))(new Redis(config['redis']));function Agent(_0x46fe68){this['id']=_0x46fe68['id']||0x0;this['name']=_0x46fe68['name']||'';this['email']=_0x46fe68[_0x070e('0x7')]||'';this[_0x070e('0x8')]=_0x46fe68[_0x070e('0x8')]||'';this[_0x070e('0x9')]=_0x46fe68[_0x070e('0x9')]||'';this[_0x070e('0xa')]=_0x070e('0xb');this['stateTime']=0x0;this['status']=_0x070e('0xb');this[_0x070e('0xc')]='';this[_0x070e('0xd')]='';this[_0x070e('0xe')]='';this[_0x070e('0xf')]='';this[_0x070e('0x10')]=_0x46fe68[_0x070e('0x10')]||![];this[_0x070e('0x11')]=_0x070e('0xb');this[_0x070e('0x12')]=0x0;this[_0x070e('0x13')]='';this['voiceStatusQueue']='';this['onhold']=![];this[_0x070e('0x14')]=![];this['md5']='';}Agent['prototype']['updateStatusRealtime']=function(_0x11d2ce){var _0x14c3fd;if(_0x11d2ce&&_0x11d2ce['state']){_0x14c3fd=_0x11d2ce['state'][_0x070e('0x15')]();switch(_0x14c3fd){case _0x070e('0x16'):_0x14c3fd=_0x070e('0x17');break;case _0x070e('0x18'):_0x14c3fd='talking';break;}}if(_0x14c3fd&&this['voiceStatus']!==_0x14c3fd||_0x11d2ce[_0x070e('0x19')]){this[_0x070e('0x12')]=_[_0x070e('0x1a')](moment()[_0x070e('0x1b')]('x'));}if(_0x14c3fd){this[_0x070e('0x11')]=_0x14c3fd;}var _0x5037eb={'id':this['id'],'name':this[_0x070e('0x1c')],'email':this[_0x070e('0x7')],'accountcode':this[_0x070e('0x8')],'fullname':this[_0x070e('0x9')],'state':this[_0x070e('0xa')],'stateTime':this['stateTime'],'status':this['status'],'address':this['address'],'online':this[_0x070e('0x10')],'voiceStatus':this[_0x070e('0x11')],'voiceStatusTime':this[_0x070e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x070e('0x1d')],'interface':this['interface'],'onhold':this[_0x070e('0x1e')]};var _0x3f6985=md5(JSON[_0x070e('0x1f')](_0x5037eb));if(this[_0x070e('0x20')]!==_0x3f6985){this[_0x070e('0x20')]=_0x3f6985;io['to'](util[_0x070e('0x1b')](_0x070e('0x21'),_0x5037eb[_0x070e('0x1c')]))['emit'](_0x070e('0x22'),_0x5037eb);io[_0x070e('0x23')](_0x070e('0x24'),_0x5037eb);}};module['exports']=Agent; \ No newline at end of file +var _0x0713=['idle','inuse','talking','voiceStatusTime','toNumber','format','voiceStatusQueue','stringify','user:%s','emit','user:save','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','onhold','local','prototype','state','toLowerCase','not_inuse'];(function(_0x3560de,_0xf5e290){var _0x2da26b=function(_0x5742c2){while(--_0x5742c2){_0x3560de['push'](_0x3560de['shift']());}};_0x2da26b(++_0xf5e290);}(_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 e7ffc61..4dd6fbf 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 _0x2b53=['dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','name','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','type','campaign','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2b53,0x78));var _0x32b5=function(_0x3425a9,_0x1add93){_0x3425a9=_0x3425a9-0x0;var _0x34a159=_0x2b53[_0x3425a9];return _0x34a159;};'use strict';function Campaign(_0x41ef60){this['id']=_0x41ef60['id']||0x0;this['name']=_0x41ef60['name']||'';this[_0x32b5('0x0')]=_0x41ef60[_0x32b5('0x0')]||_0x32b5('0x1');this['originated']=0x0;this['temp']=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this[_0x32b5('0x2')]='';this[_0x32b5('0x3')]=!![];this[_0x32b5('0x4')]=_0x41ef60['active'];this[_0x32b5('0x5')]=_0x41ef60['limitCalls'];this[_0x32b5('0x6')]=_0x41ef60[_0x32b5('0x6')]||null;this[_0x32b5('0x7')]=_0x41ef60[_0x32b5('0x7')]?_0x41ef60['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x41ef60[_0x32b5('0x8')];this['dialOriginateCallerIdNumber']=_0x41ef60[_0x32b5('0x9')];this[_0x32b5('0xa')]=_0x41ef60[_0x32b5('0xa')]||0x1e;this['dialCongestionMaxRetry']=_0x41ef60['dialCongestionMaxRetry'];this['dialCongestionRetryFrequency']=_0x41ef60[_0x32b5('0xb')];this['dialBusyMaxRetry']=_0x41ef60[_0x32b5('0xc')];this['dialBusyRetryFrequency']=_0x41ef60[_0x32b5('0xd')];this[_0x32b5('0xe')]=_0x41ef60[_0x32b5('0xe')];this[_0x32b5('0xf')]=_0x41ef60['dialNoAnswerRetryFrequency'];this[_0x32b5('0x10')]=_0x41ef60[_0x32b5('0x10')];this['dialNoSuchNumberMaxRetry']=_0x41ef60['dialNoSuchNumberMaxRetry']||0x3;this[_0x32b5('0x11')]=_0x41ef60['dialNoSuchNumberRetryFrequency']||0x96;this[_0x32b5('0x12')]=_0x41ef60[_0x32b5('0x12')]||0x3;this['dialDropRetryFrequency']=_0x41ef60[_0x32b5('0x13')]||0x96;this[_0x32b5('0x14')]=_0x41ef60['dialAbandonedMaxRetry']||0x3;this[_0x32b5('0x15')]=_0x41ef60[_0x32b5('0x15')]||0x96;this[_0x32b5('0x16')]=_0x41ef60[_0x32b5('0x16')]||0x3;this[_0x32b5('0x17')]=_0x41ef60[_0x32b5('0x17')]||0x96;this[_0x32b5('0x18')]=_0x41ef60['dialAgentRejectMaxRetry']||0x3;this[_0x32b5('0x19')]=_0x41ef60['dialAgentRejectRetryFrequency']||0x96;this[_0x32b5('0x1a')]=_0x41ef60[_0x32b5('0x1a')]||_0x32b5('0x1b');this['dialPrefix']=_0x41ef60[_0x32b5('0x1c')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x41ef60[_0x32b5('0x1d')]||undefined;this[_0x32b5('0x1e')]=_0x41ef60[_0x32b5('0x1e')]||undefined;this['TrunkBackup']=_0x41ef60[_0x32b5('0x1f')]?_0x41ef60[_0x32b5('0x1f')]:undefined;this[_0x32b5('0x20')]=_0x41ef60[_0x32b5('0x20')]?_0x41ef60[_0x32b5('0x20')]:undefined;this[_0x32b5('0x21')]=_0x41ef60[_0x32b5('0x21')]?_0x41ef60[_0x32b5('0x21')]:undefined;this[_0x32b5('0x22')]=_0x41ef60[_0x32b5('0x22')]?_0x41ef60[_0x32b5('0x22')]:undefined;this[_0x32b5('0x23')]=_0x41ef60['SquareProject']?_0x41ef60[_0x32b5('0x22')][_0x32b5('0x24')]:undefined;this[_0x32b5('0x25')]=_0x41ef60['dialAMDActive']||![];this[_0x32b5('0x26')]=_0x41ef60['dialAMDInitialSilence'];this[_0x32b5('0x27')]=_0x41ef60['dialAMDGreeting'];this[_0x32b5('0x28')]=_0x41ef60[_0x32b5('0x28')];this[_0x32b5('0x29')]=_0x41ef60[_0x32b5('0x29')];this[_0x32b5('0x2a')]=_0x41ef60[_0x32b5('0x2a')];this[_0x32b5('0x2b')]=_0x41ef60[_0x32b5('0x2b')];this['dialAMDMaximumNumberOfWords']=_0x41ef60[_0x32b5('0x2c')];this['dialAMDSilenceThreshold']=_0x41ef60[_0x32b5('0x2d')];this['dialAMDMaximumWordLength']=_0x41ef60[_0x32b5('0x2e')];}module[_0x32b5('0x2f')]=Campaign; \ No newline at end of file +var _0xbd4e=['dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','originated','temp','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','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','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords'];(function(_0x3c6741,_0x35f74a){var _0x1d6737=function(_0x221dd0){while(--_0x221dd0){_0x3c6741['push'](_0x3c6741['shift']());}};_0x1d6737(++_0x35f74a);}(_0xbd4e,0x12e));var _0xebd4=function(_0x4a660d,_0x5ec22d){_0x4a660d=_0x4a660d-0x0;var _0x379f33=_0xbd4e[_0x4a660d];return _0x379f33;};'use strict';function Campaign(_0x26746f){this['id']=_0x26746f['id']||0x0;this[_0xebd4('0x0')]=_0x26746f['name']||'';this[_0xebd4('0x1')]=_0x26746f['type']||'campaign';this[_0xebd4('0x2')]=0x0;this[_0xebd4('0x3')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0xebd4('0x4')]=0x0;this[_0xebd4('0x5')]='';this[_0xebd4('0x6')]=!![];this['active']=_0x26746f[_0xebd4('0x7')];this[_0xebd4('0x8')]=_0x26746f[_0xebd4('0x8')];this['dialTimezone']=_0x26746f[_0xebd4('0x9')]||null;this[_0xebd4('0xa')]=_0x26746f[_0xebd4('0xa')]?_0x26746f[_0xebd4('0xa')]:null;this[_0xebd4('0xb')]=_0x26746f[_0xebd4('0xb')];this[_0xebd4('0xc')]=_0x26746f[_0xebd4('0xc')];this[_0xebd4('0xd')]=_0x26746f['dialOriginateTimeout']||0x1e;this[_0xebd4('0xe')]=_0x26746f[_0xebd4('0xe')];this[_0xebd4('0xf')]=_0x26746f[_0xebd4('0xf')];this[_0xebd4('0x10')]=_0x26746f[_0xebd4('0x10')];this['dialBusyRetryFrequency']=_0x26746f['dialBusyRetryFrequency'];this[_0xebd4('0x11')]=_0x26746f[_0xebd4('0x11')];this[_0xebd4('0x12')]=_0x26746f[_0xebd4('0x12')];this[_0xebd4('0x13')]=_0x26746f[_0xebd4('0x13')];this[_0xebd4('0x14')]=_0x26746f[_0xebd4('0x14')]||0x3;this[_0xebd4('0x15')]=_0x26746f[_0xebd4('0x15')]||0x96;this[_0xebd4('0x16')]=_0x26746f[_0xebd4('0x16')]||0x3;this['dialDropRetryFrequency']=_0x26746f[_0xebd4('0x17')]||0x96;this['dialAbandonedMaxRetry']=_0x26746f[_0xebd4('0x18')]||0x3;this[_0xebd4('0x19')]=_0x26746f[_0xebd4('0x19')]||0x96;this[_0xebd4('0x1a')]=_0x26746f['dialMachineMaxRetry']||0x3;this[_0xebd4('0x1b')]=_0x26746f[_0xebd4('0x1b')]||0x96;this[_0xebd4('0x1c')]=_0x26746f[_0xebd4('0x1c')]||0x3;this[_0xebd4('0x1d')]=_0x26746f['dialAgentRejectRetryFrequency']||0x96;this[_0xebd4('0x1e')]=_0x26746f[_0xebd4('0x1e')]||_0xebd4('0x1f');this[_0xebd4('0x20')]=_0x26746f['dialPrefix']||undefined;this[_0xebd4('0x21')]=_0x26746f[_0xebd4('0x21')]||undefined;this[_0xebd4('0x22')]=_0x26746f['dialCutDigit']||undefined;this[_0xebd4('0x23')]=_0x26746f['TrunkBackup']?_0x26746f['TrunkBackup']:undefined;this[_0xebd4('0x24')]=_0x26746f[_0xebd4('0x24')]?_0x26746f['Trunk']:undefined;this['Interval']=_0x26746f['Interval']?_0x26746f[_0xebd4('0x25')]:undefined;this[_0xebd4('0x26')]=_0x26746f[_0xebd4('0x26')]?_0x26746f[_0xebd4('0x26')]:undefined;this[_0xebd4('0x27')]=_0x26746f[_0xebd4('0x26')]?_0x26746f[_0xebd4('0x26')][_0xebd4('0x0')]:undefined;this[_0xebd4('0x28')]=_0x26746f['dialAMDActive']||![];this[_0xebd4('0x29')]=_0x26746f[_0xebd4('0x29')];this[_0xebd4('0x2a')]=_0x26746f[_0xebd4('0x2a')];this[_0xebd4('0x2b')]=_0x26746f[_0xebd4('0x2b')];this[_0xebd4('0x2c')]=_0x26746f[_0xebd4('0x2c')];this[_0xebd4('0x2d')]=_0x26746f['dialAMDMinWordLength'];this[_0xebd4('0x2e')]=_0x26746f['dialAMDBetweenWordsSilence'];this[_0xebd4('0x2f')]=_0x26746f[_0xebd4('0x2f')];this[_0xebd4('0x30')]=_0x26746f[_0xebd4('0x30')];this[_0xebd4('0x31')]=_0x26746f[_0xebd4('0x31')];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 07644e0..75c64ba 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 _0x2faf=['monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridname','connectedlinenum','accountcode','context','uniqueid','linkedid','exten','answered','answertime','unmanaged','abandoned','lastapplication','lastdata','billableseconds','type','disposition','monitor'];(function(_0x4defd6,_0x37bbd3){var _0x4c9276=function(_0x1d7a3d){while(--_0x1d7a3d){_0x4defd6['push'](_0x4defd6['shift']());}};_0x4c9276(++_0x37bbd3);}(_0x2faf,0xb0));var _0xf2fa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2faf[_0x20a584];return _0x4b41a8;};'use strict';function Channel(){this[_0xf2fa('0x0')]=null;this[_0xf2fa('0x1')]='';this[_0xf2fa('0x2')]='';this['calleridnum']=0x0;this[_0xf2fa('0x3')]='';this[_0xf2fa('0x4')]=undefined;this['connectedlinename']=undefined;this[_0xf2fa('0x5')]=0x0;this[_0xf2fa('0x6')]='';this[_0xf2fa('0x7')]=0x0;this[_0xf2fa('0x8')]=0x0;this[_0xf2fa('0x9')]=0x0;this[_0xf2fa('0xa')]=![];this[_0xf2fa('0xb')]=null;this['endtime']=null;this[_0xf2fa('0xc')]=![];this[_0xf2fa('0xd')]=![];this[_0xf2fa('0xe')]='';this[_0xf2fa('0xf')]='';this['duration']=0x0;this[_0xf2fa('0x10')]=0x0;this['holdtime']=0x0;this[_0xf2fa('0x11')]=null;this['tag']=null;this[_0xf2fa('0x12')]=null;this[_0xf2fa('0x13')]=![];this[_0xf2fa('0x14')]=null;this[_0xf2fa('0x15')]=null;this[_0xf2fa('0x16')]=[];this[_0xf2fa('0x17')]=undefined;this[_0xf2fa('0x18')]=undefined;this[_0xf2fa('0x19')]=undefined;this[_0xf2fa('0x1a')]=0x0;}module[_0xf2fa('0x1b')]=Channel; \ No newline at end of file +var _0x7896=['destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answertime','endtime','unmanaged','lastapplication','duration','billableseconds','type','disposition','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel'];(function(_0xaf3271,_0x5cb51c){var _0x3e8df0=function(_0xcb6cf6){while(--_0xcb6cf6){_0xaf3271['push'](_0xaf3271['shift']());}};_0x3e8df0(++_0x5cb51c);}(_0x7896,0x127));var _0x6789=function(_0x57408b,_0xb7cbc5){_0x57408b=_0x57408b-0x0;var _0x31a897=_0x7896[_0x57408b];return _0x31a897;};'use strict';function Channel(){this[_0x6789('0x0')]=null;this[_0x6789('0x1')]='';this[_0x6789('0x2')]='';this[_0x6789('0x3')]=0x0;this[_0x6789('0x4')]='';this[_0x6789('0x5')]=undefined;this[_0x6789('0x6')]=undefined;this[_0x6789('0x7')]=0x0;this[_0x6789('0x8')]='';this[_0x6789('0x9')]=0x0;this[_0x6789('0xa')]=0x0;this[_0x6789('0xb')]=0x0;this['answered']=![];this[_0x6789('0xc')]=null;this[_0x6789('0xd')]=null;this[_0x6789('0xe')]=![];this['abandoned']=![];this[_0x6789('0xf')]='';this['lastdata']='';this[_0x6789('0x10')]=0x0;this[_0x6789('0x11')]=0x0;this['holdtime']=0x0;this[_0x6789('0x12')]=null;this['tag']=null;this[_0x6789('0x13')]=null;this['monitor']=![];this[_0x6789('0x14')]=null;this['queue']=null;this[_0x6789('0x15')]=[];this[_0x6789('0x16')]=undefined;this[_0x6789('0x17')]=undefined;this[_0x6789('0x18')]=undefined;this[_0x6789('0x19')]=0x0;}module[_0x6789('0x1a')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index a9deb37..a1711c7 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 _0x1f9f=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x1f9f,0x177));var _0xf1f9=function(_0x208f91,_0x8131c9){_0x208f91=_0x208f91-0x0;var _0xfc5b7f=_0x1f9f[_0x208f91];return _0xfc5b7f;};'use strict';function DeskAccount(_0x1f7f4b){this['id']=_0x1f7f4b['id']||0x0;this['name']=_0x1f7f4b[_0xf1f9('0x0')]||'';this[_0xf1f9('0x1')]=_0x1f7f4b[_0xf1f9('0x1')]||'';this[_0xf1f9('0x2')]=_0x1f7f4b[_0xf1f9('0x2')]||'';this['authType']=_0x1f7f4b[_0xf1f9('0x3')]||'';this[_0xf1f9('0x4')]=_0x1f7f4b['password']||'';this[_0xf1f9('0x5')]=_0x1f7f4b[_0xf1f9('0x5')]||'';this[_0xf1f9('0x6')]=_0x1f7f4b['consumerSecret']||'';this['token']=_0x1f7f4b[_0xf1f9('0x7')]||'';this[_0xf1f9('0x8')]=_0x1f7f4b[_0xf1f9('0x8')]||'';this[_0xf1f9('0x9')]=_0x1f7f4b['type']||'';this[_0xf1f9('0xa')]=_0x1f7f4b[_0xf1f9('0xa')]||'';this[_0xf1f9('0xb')]=_0x1f7f4b[_0xf1f9('0xb')]||{};}module[_0xf1f9('0xc')]=DeskAccount; \ No newline at end of file +var _0x4873=['password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','authType'];(function(_0x432725,_0x3614e1){var _0x31f1f1=function(_0x400052){while(--_0x400052){_0x432725['push'](_0x432725['shift']());}};_0x31f1f1(++_0x3614e1);}(_0x4873,0x69));var _0x3487=function(_0x196fd6,_0x2b24d3){_0x196fd6=_0x196fd6-0x0;var _0x4403af=_0x4873[_0x196fd6];return _0x4403af;};'use strict';function DeskAccount(_0x4f518d){this['id']=_0x4f518d['id']||0x0;this[_0x3487('0x0')]=_0x4f518d[_0x3487('0x0')]||'';this[_0x3487('0x1')]=_0x4f518d[_0x3487('0x1')]||'';this['remoteUri']=_0x4f518d['remoteUri']||'';this[_0x3487('0x2')]=_0x4f518d[_0x3487('0x2')]||'';this[_0x3487('0x3')]=_0x4f518d['password']||'';this['consumerKey']=_0x4f518d[_0x3487('0x4')]||'';this[_0x3487('0x5')]=_0x4f518d[_0x3487('0x5')]||'';this[_0x3487('0x6')]=_0x4f518d[_0x3487('0x6')]||'';this['tokenSecret']=_0x4f518d[_0x3487('0x7')]||'';this['type']=_0x4f518d[_0x3487('0x8')]||'';this[_0x3487('0x9')]=_0x4f518d[_0x3487('0x9')]||'';this[_0x3487('0xa')]=_0x4f518d['Configurations']||{};}module[_0x3487('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 0bd7186..ab109db 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 _0x560b=['name','username','password','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','exports'];(function(_0x314d1d,_0x1211b8){var _0x31e31d=function(_0x571649){while(--_0x571649){_0x314d1d['push'](_0x314d1d['shift']());}};_0x31e31d(++_0x1211b8);}(_0x560b,0x64));var _0xb560=function(_0x391835,_0x11e847){_0x391835=_0x391835-0x0;var _0x2cc4c3=_0x560b[_0x391835];return _0x2cc4c3;};'use strict';function Dynamics365Account(_0x2c9350){this['id']=_0x2c9350['id']||0x0;this[_0xb560('0x0')]=_0x2c9350[_0xb560('0x0')]||'';this['username']=_0x2c9350[_0xb560('0x1')]||'';this['password']=_0x2c9350[_0xb560('0x2')]||'';this['remoteUri']=_0x2c9350['remoteUri']||'';this[_0xb560('0x3')]=_0x2c9350[_0xb560('0x3')]||'';this['clientId']=_0x2c9350[_0xb560('0x4')]||'';this[_0xb560('0x5')]=_0x2c9350[_0xb560('0x5')]||{};this['serverUrl']=_0x2c9350[_0xb560('0x6')]||'';this[_0xb560('0x7')]=_0x2c9350[_0xb560('0x7')]||![];this[_0xb560('0x8')]=_0x2c9350['Configurations']||{};this['CloudProvider']=_0x2c9350['CloudProvider']||{};}module[_0xb560('0x9')]=Dynamics365Account; \ No newline at end of file +var _0x2512=['clientSecret','serverUrl','Configurations','CloudProvider','exports','name','username','remoteUri','tenantId','clientId'];(function(_0x284889,_0x4c7c06){var _0x109773=function(_0x5b243b){while(--_0x5b243b){_0x284889['push'](_0x284889['shift']());}};_0x109773(++_0x4c7c06);}(_0x2512,0x87));var _0x2251=function(_0x2e8802,_0x59ad8c){_0x2e8802=_0x2e8802-0x0;var _0x4617aa=_0x2512[_0x2e8802];return _0x4617aa;};'use strict';function Dynamics365Account(_0x218283){this['id']=_0x218283['id']||0x0;this[_0x2251('0x0')]=_0x218283['name']||'';this[_0x2251('0x1')]=_0x218283['username']||'';this['password']=_0x218283['password']||'';this[_0x2251('0x2')]=_0x218283['remoteUri']||'';this[_0x2251('0x3')]=_0x218283[_0x2251('0x3')]||'';this[_0x2251('0x4')]=_0x218283[_0x2251('0x4')]||'';this[_0x2251('0x5')]=_0x218283[_0x2251('0x5')]||{};this[_0x2251('0x6')]=_0x218283['serverUrl']||'';this['modernAuthentication']=_0x218283['modernAuthentication']||![];this[_0x2251('0x7')]=_0x218283[_0x2251('0x7')]||{};this[_0x2251('0x8')]=_0x218283[_0x2251('0x8')]||{};}module[_0x2251('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 568cac5..7efdd1a 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 _0xe3a3=['minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid'];(function(_0x135d0d,_0xbfab19){var _0x481cca=function(_0x3f568e){while(--_0x3f568e){_0x135d0d['push'](_0x135d0d['shift']());}};_0x481cca(++_0xbfab19);}(_0xe3a3,0x1d7));var _0x3e3a=function(_0x43d8ea,_0x5c5344){_0x43d8ea=_0x43d8ea-0x0;var _0x34a210=_0xe3a3[_0x43d8ea];return _0x34a210;};'use strict';function FaxAccount(_0x3d6254){this['id']=_0x3d6254['id']||0x0;this[_0x3e3a('0x0')]=_0x3d6254['name']||'';this[_0x3e3a('0x1')]=_0x3d6254[_0x3e3a('0x1')];this['ecm']=_0x3d6254[_0x3e3a('0x2')];this['headerinfo']=_0x3d6254[_0x3e3a('0x3')];this[_0x3e3a('0x4')]=_0x3d6254[_0x3e3a('0x4')];this[_0x3e3a('0x5')]=_0x3d6254[_0x3e3a('0x5')]||0x960;this[_0x3e3a('0x6')]=_0x3d6254[_0x3e3a('0x6')]||0x3840;this[_0x3e3a('0x7')]=_0x3d6254['modem']||'v17,v27,v29';this[_0x3e3a('0x8')]=_0x3d6254[_0x3e3a('0x8')]||'no';this[_0x3e3a('0x9')]=_0x3d6254[_0x3e3a('0x9')]||'no';this[_0x3e3a('0xa')]=_0x3d6254[_0x3e3a('0xa')]||0x1388;this[_0x3e3a('0xb')]=_0x3d6254[_0x3e3a('0xb')]||_0x3e3a('0xc');this[_0x3e3a('0xd')]=_0x3d6254[_0x3e3a('0xd')]?_0x3d6254[_0x3e3a('0xd')]:undefined;this[_0x3e3a('0xe')]=_0x3d6254[_0x3e3a('0xe')];this['key']=_0x3d6254[_0x3e3a('0xf')];}module[_0x3e3a('0x10')]=FaxAccount; \ No newline at end of file +var _0xc659=['headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','description','ecm'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0xc659,0x12f));var _0x9c65=function(_0x42a3e6,_0x165c70){_0x42a3e6=_0x42a3e6-0x0;var _0x54372d=_0xc659[_0x42a3e6];return _0x54372d;};'use strict';function FaxAccount(_0x20609c){this['id']=_0x20609c['id']||0x0;this[_0x9c65('0x0')]=_0x20609c[_0x9c65('0x0')]||'';this[_0x9c65('0x1')]=_0x20609c[_0x9c65('0x1')];this[_0x9c65('0x2')]=_0x20609c[_0x9c65('0x2')];this[_0x9c65('0x3')]=_0x20609c[_0x9c65('0x3')];this[_0x9c65('0x4')]=_0x20609c[_0x9c65('0x4')];this[_0x9c65('0x5')]=_0x20609c[_0x9c65('0x5')]||0x960;this[_0x9c65('0x6')]=_0x20609c[_0x9c65('0x6')]||0x3840;this['modem']=_0x20609c[_0x9c65('0x7')]||_0x9c65('0x8');this[_0x9c65('0x9')]=_0x20609c[_0x9c65('0x9')]||'no';this[_0x9c65('0xa')]=_0x20609c['faxdetect']||'no';this['t38timeout']=_0x20609c[_0x9c65('0xb')]||0x1388;this['tech']=_0x20609c[_0x9c65('0xc')]||'SIP';this[_0x9c65('0xd')]=_0x20609c[_0x9c65('0xd')]?_0x20609c[_0x9c65('0xd')]:undefined;this[_0x9c65('0xe')]=_0x20609c['ListId'];this[_0x9c65('0xf')]=_0x20609c[_0x9c65('0xf')];}module[_0x9c65('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 e9b4a57..2c20a87 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 _0x28c3=['username','token','remoteUri','Configurations','name'];(function(_0x4b3da2,_0x51080c){var _0x96977b=function(_0x3df70b){while(--_0x3df70b){_0x4b3da2['push'](_0x4b3da2['shift']());}};_0x96977b(++_0x51080c);}(_0x28c3,0x9a));var _0x328c=function(_0xd50edc,_0xe9e7a2){_0xd50edc=_0xd50edc-0x0;var _0x335c4d=_0x28c3[_0xd50edc];return _0x335c4d;};'use strict';function FreshdeskAccount(_0x325002){this['id']=_0x325002['id']||0x0;this[_0x328c('0x0')]=_0x325002['name']||'';this[_0x328c('0x1')]=_0x325002['username']||'';this['apiKey']=_0x325002[_0x328c('0x2')]||'';this[_0x328c('0x3')]=_0x325002[_0x328c('0x3')]||'';this['serverUrl']=_0x325002['serverUrl']||'';this[_0x328c('0x4')]=_0x325002[_0x328c('0x4')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x8050=['apiKey','token','remoteUri','serverUrl','Configurations','name','username'];(function(_0x200acc,_0x8af694){var _0xa26e06=function(_0x5473a6){while(--_0x5473a6){_0x200acc['push'](_0x200acc['shift']());}};_0xa26e06(++_0x8af694);}(_0x8050,0x19b));var _0x0805=function(_0x20fc38,_0x1b567f){_0x20fc38=_0x20fc38-0x0;var _0x3acd2a=_0x8050[_0x20fc38];return _0x3acd2a;};'use strict';function FreshdeskAccount(_0x5102cf){this['id']=_0x5102cf['id']||0x0;this[_0x0805('0x0')]=_0x5102cf[_0x0805('0x0')]||'';this[_0x0805('0x1')]=_0x5102cf['username']||'';this[_0x0805('0x2')]=_0x5102cf[_0x0805('0x3')]||'';this[_0x0805('0x4')]=_0x5102cf[_0x0805('0x4')]||'';this[_0x0805('0x5')]=_0x5102cf[_0x0805('0x5')]||'';this[_0x0805('0x6')]=_0x5102cf[_0x0805('0x6')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index b9b3ba3..b896af7 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 _0x15c6=['username','apiKey','token','remoteUri','Configurations','exports','name'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x15c6,0x1cd));var _0x615c=function(_0xf05c4d,_0x140378){_0xf05c4d=_0xf05c4d-0x0;var _0x14030b=_0x15c6[_0xf05c4d];return _0x14030b;};'use strict';function FreshsalesAccount(_0x151ccb){this['id']=_0x151ccb['id']||0x0;this[_0x615c('0x0')]=_0x151ccb[_0x615c('0x0')]||'';this[_0x615c('0x1')]=_0x151ccb[_0x615c('0x1')]||'';this[_0x615c('0x2')]=_0x151ccb[_0x615c('0x3')]||'';this[_0x615c('0x4')]=_0x151ccb['remoteUri']||'';this['serverUrl']=_0x151ccb['serverUrl']||'';this[_0x615c('0x5')]=_0x151ccb[_0x615c('0x5')]||{};}module[_0x615c('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0xfc91=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0xfc91,0xb5));var _0x1fc9=function(_0x32e9a8,_0x47d71b){_0x32e9a8=_0x32e9a8-0x0;var _0x18e706=_0xfc91[_0x32e9a8];return _0x18e706;};'use strict';function FreshsalesAccount(_0x39c6d2){this['id']=_0x39c6d2['id']||0x0;this[_0x1fc9('0x0')]=_0x39c6d2['name']||'';this[_0x1fc9('0x1')]=_0x39c6d2[_0x1fc9('0x1')]||'';this[_0x1fc9('0x2')]=_0x39c6d2[_0x1fc9('0x3')]||'';this[_0x1fc9('0x4')]=_0x39c6d2[_0x1fc9('0x4')]||'';this[_0x1fc9('0x5')]=_0x39c6d2[_0x1fc9('0x5')]||'';this[_0x1fc9('0x6')]=_0x39c6d2[_0x1fc9('0x6')]||{};}module[_0x1fc9('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index aad42c2..16e2154 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 _0x731f=['motionChannel','voice','variables','exports','type','inbound','uniqueid','calleridnum','calleridname','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','accountcode','context','priority','assigned','lastAssignedTo'];(function(_0x2f3d08,_0x11b585){var _0x37b3be=function(_0x16dd8d){while(--_0x16dd8d){_0x2f3d08['push'](_0x2f3d08['shift']());}};_0x37b3be(++_0x11b585);}(_0x731f,0x81));var _0xf731=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x731f[_0x122ef9];return _0x42fba0;};'use strict';function QueueReport(){this[_0xf731('0x0')]=_0xf731('0x1');this[_0xf731('0x2')]='';this[_0xf731('0x3')]='';this[_0xf731('0x4')]='';this['queue']='';this[_0xf731('0x5')]=null;this[_0xf731('0x6')]=null;this[_0xf731('0x7')]=0x1;this[_0xf731('0x8')]=0x1;this[_0xf731('0x9')]=![];this['queuecallerabandonAt']=null;this[_0xf731('0xa')]=![];this[_0xf731('0xb')]=null;this['queuecallerexit']=![];this[_0xf731('0xc')]=null;this[_0xf731('0xd')]=0x1;this['channel']='';this[_0xf731('0xe')]='';this[_0xf731('0xf')]='';this[_0xf731('0x10')]='';this[_0xf731('0x11')]='';this['exten']='';this[_0xf731('0x12')]='';this['holdtime']=0x0;this[_0xf731('0x13')]=![];this[_0xf731('0x14')]='';this[_0xf731('0x15')]=_0xf731('0x16');this['mohtime']=0x0;this[_0xf731('0x17')]={};}module[_0xf731('0x18')]=QueueReport; \ No newline at end of file +var _0xa8c7=['mohtime','exports','type','uniqueid','calleridnum','calleridname','queuecallerjoinAt','position','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','originalposition','channel','connectedlinename','accountcode','context','exten','holdtime','assigned','lastAssignedTo','voice'];(function(_0x25969a,_0x28dde5){var _0x1fd7bb=function(_0x1733ed){while(--_0x1733ed){_0x25969a['push'](_0x25969a['shift']());}};_0x1fd7bb(++_0x28dde5);}(_0xa8c7,0x178));var _0x7a8c=function(_0xe346f,_0x3b1edd){_0xe346f=_0xe346f-0x0;var _0x4ac045=_0xa8c7[_0xe346f];return _0x4ac045;};'use strict';function QueueReport(){this[_0x7a8c('0x0')]='inbound';this[_0x7a8c('0x1')]='';this[_0x7a8c('0x2')]='';this[_0x7a8c('0x3')]='';this['queue']='';this[_0x7a8c('0x4')]=null;this['queuecallerleaveAt']=null;this[_0x7a8c('0x5')]=0x1;this['count']=0x1;this['queuecallerabandon']=![];this[_0x7a8c('0x6')]=null;this[_0x7a8c('0x7')]=![];this[_0x7a8c('0x8')]=null;this['queuecallerexit']=![];this[_0x7a8c('0x9')]=null;this[_0x7a8c('0xa')]=0x1;this[_0x7a8c('0xb')]='';this['connectedlinenum']='';this[_0x7a8c('0xc')]='';this[_0x7a8c('0xd')]='';this[_0x7a8c('0xe')]='';this[_0x7a8c('0xf')]='';this['priority']='';this[_0x7a8c('0x10')]=0x0;this[_0x7a8c('0x11')]=![];this[_0x7a8c('0x12')]='';this['motionChannel']=_0x7a8c('0x13');this[_0x7a8c('0x14')]=0x0;this['variables']={};}module[_0x7a8c('0x15')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 8e05690..6d12d08 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 _0x7461=['exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','serverUrl','Configurations'];(function(_0x5e9a69,_0x40c0ec){var _0x5979c8=function(_0x293da2){while(--_0x293da2){_0x5e9a69['push'](_0x5e9a69['shift']());}};_0x5979c8(++_0x40c0ec);}(_0x7461,0x177));var _0x1746=function(_0x6ff984,_0x52fbd1){_0x6ff984=_0x6ff984-0x0;var _0x1b8400=_0x7461[_0x6ff984];return _0x1b8400;};'use strict';function SalesforceAccount(_0x2cbdd4){this['id']=_0x2cbdd4['id']||0x0;this[_0x1746('0x0')]=_0x2cbdd4['name']||'';this['username']=_0x2cbdd4[_0x1746('0x1')]||'';this[_0x1746('0x2')]=_0x2cbdd4['remoteUri']||'';this[_0x1746('0x3')]=_0x2cbdd4[_0x1746('0x3')]||'';this[_0x1746('0x4')]=_0x2cbdd4[_0x1746('0x4')]||'';this[_0x1746('0x5')]=_0x2cbdd4[_0x1746('0x5')]||'';this[_0x1746('0x6')]=_0x2cbdd4[_0x1746('0x6')]||'';this[_0x1746('0x7')]=_0x2cbdd4[_0x1746('0x7')]||'integrationTab';this[_0x1746('0x8')]=_0x2cbdd4['serverUrl']||'';this[_0x1746('0x9')]=_0x2cbdd4[_0x1746('0x9')]||{};}module[_0x1746('0xa')]=SalesforceAccount; \ No newline at end of file +var _0xcb37=['clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','remoteUri','password'];(function(_0x230ad6,_0x39a522){var _0x11cddb=function(_0x325d94){while(--_0x325d94){_0x230ad6['push'](_0x230ad6['shift']());}};_0x11cddb(++_0x39a522);}(_0xcb37,0xa8));var _0x7cb3=function(_0x7b94c9,_0x64d0ff){_0x7b94c9=_0x7b94c9-0x0;var _0x1b4fc1=_0xcb37[_0x7b94c9];return _0x1b4fc1;};'use strict';function SalesforceAccount(_0x4a3261){this['id']=_0x4a3261['id']||0x0;this['name']=_0x4a3261['name']||'';this['username']=_0x4a3261['username']||'';this[_0x7cb3('0x0')]=_0x4a3261[_0x7cb3('0x0')]||'';this[_0x7cb3('0x1')]=_0x4a3261[_0x7cb3('0x1')]||'';this[_0x7cb3('0x2')]=_0x4a3261[_0x7cb3('0x2')]||'';this[_0x7cb3('0x3')]=_0x4a3261[_0x7cb3('0x3')]||'';this[_0x7cb3('0x4')]=_0x4a3261['securityToken']||'';this[_0x7cb3('0x5')]=_0x4a3261[_0x7cb3('0x5')]||_0x7cb3('0x6');this['serverUrl']=_0x4a3261[_0x7cb3('0x7')]||'';this[_0x7cb3('0x8')]=_0x4a3261[_0x7cb3('0x8')]||{};}module[_0x7cb3('0x9')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index a5f0ff3..6540c2d 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 _0x90ab=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x90ab,0xfc));var _0xb90a=function(_0x1a91f0,_0x11e203){_0x1a91f0=_0x1a91f0-0x0;var _0x12f862=_0x90ab[_0x1a91f0];return _0x12f862;};'use strict';function ServicenowAccount(_0x507b53){this['id']=_0x507b53['id']||0x0;this[_0xb90a('0x0')]=_0x507b53[_0xb90a('0x0')]||'';this[_0xb90a('0x1')]=_0x507b53[_0xb90a('0x1')]||'';this[_0xb90a('0x2')]=_0x507b53[_0xb90a('0x2')]||'';this[_0xb90a('0x3')]=_0x507b53['remoteUri']||'';this[_0xb90a('0x4')]=_0x507b53[_0xb90a('0x4')]||'';this['Configurations']=_0x507b53[_0xb90a('0x5')]||{};}module[_0xb90a('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x33ad=['serverUrl','Configurations','exports','name','username','password'];(function(_0x23c251,_0x8770d6){var _0x4f7070=function(_0x242df8){while(--_0x242df8){_0x23c251['push'](_0x23c251['shift']());}};_0x4f7070(++_0x8770d6);}(_0x33ad,0x87));var _0xd33a=function(_0x47c2fd,_0x473f3f){_0x47c2fd=_0x47c2fd-0x0;var _0x51e6fb=_0x33ad[_0x47c2fd];return _0x51e6fb;};'use strict';function ServicenowAccount(_0x535f44){this['id']=_0x535f44['id']||0x0;this[_0xd33a('0x0')]=_0x535f44[_0xd33a('0x0')]||'';this[_0xd33a('0x1')]=_0x535f44['username']||'';this[_0xd33a('0x2')]=_0x535f44[_0xd33a('0x2')]||'';this['remoteUri']=_0x535f44['remoteUri']||'';this[_0xd33a('0x3')]=_0x535f44['serverUrl']||'';this[_0xd33a('0x4')]=_0x535f44['Configurations']||{};}module[_0xd33a('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 18820e2..0b77755 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 _0x9614=['username','password','remoteUri','serverUrl','Configurations','name'];(function(_0x8abd64,_0x539570){var _0xd2511e=function(_0x9fef7d){while(--_0x9fef7d){_0x8abd64['push'](_0x8abd64['shift']());}};_0xd2511e(++_0x539570);}(_0x9614,0x167));var _0x4961=function(_0x19085d,_0x5d8bc0){_0x19085d=_0x19085d-0x0;var _0xdb3f69=_0x9614[_0x19085d];return _0xdb3f69;};'use strict';function SugarcrmAccount(_0x2f3713){this['id']=_0x2f3713['id']||0x0;this[_0x4961('0x0')]=_0x2f3713['name']||'';this[_0x4961('0x1')]=_0x2f3713[_0x4961('0x1')]||'';this[_0x4961('0x2')]=_0x2f3713[_0x4961('0x2')]||'';this['remoteUri']=_0x2f3713[_0x4961('0x3')]||'';this[_0x4961('0x4')]=_0x2f3713[_0x4961('0x4')]||'';this[_0x4961('0x5')]=_0x2f3713[_0x4961('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x51db=['exports','name','username','password','remoteUri','Configurations'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x51db,0xeb));var _0xb51d=function(_0x4edef1,_0xbd9020){_0x4edef1=_0x4edef1-0x0;var _0xa596aa=_0x51db[_0x4edef1];return _0xa596aa;};'use strict';function SugarcrmAccount(_0xca8692){this['id']=_0xca8692['id']||0x0;this['name']=_0xca8692[_0xb51d('0x0')]||'';this[_0xb51d('0x1')]=_0xca8692[_0xb51d('0x1')]||'';this[_0xb51d('0x2')]=_0xca8692[_0xb51d('0x2')]||'';this[_0xb51d('0x3')]=_0xca8692['remoteUri']||'';this['serverUrl']=_0xca8692['serverUrl']||'';this[_0xb51d('0x4')]=_0xca8692[_0xb51d('0x4')]||{};}module[_0xb51d('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index c49ad13..5c348b9 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 _0x6b06=['exports','name','accountcode','unknown','stateTime','status','address'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x6b06,0x143));var _0x66b0=function(_0x16e840,_0x26c7ea){_0x16e840=_0x16e840-0x0;var _0x4afaca=_0x6b06[_0x16e840];return _0x4afaca;};'use strict';function Telephone(_0x538e2d){this['id']=_0x538e2d['id']||0x0;this[_0x66b0('0x0')]=_0x538e2d[_0x66b0('0x0')]||'';this[_0x66b0('0x1')]=_0x538e2d[_0x66b0('0x1')]||'';this['state']=_0x66b0('0x2');this[_0x66b0('0x3')]=0x0;this[_0x66b0('0x4')]=_0x66b0('0x2');this[_0x66b0('0x5')]='';}module[_0x66b0('0x6')]=Telephone; \ No newline at end of file +var _0xf24b=['accountcode','unknown','stateTime','address','exports','name'];(function(_0x2581e8,_0x3b467c){var _0x5ebf69=function(_0x551b2b){while(--_0x551b2b){_0x2581e8['push'](_0x2581e8['shift']());}};_0x5ebf69(++_0x3b467c);}(_0xf24b,0xad));var _0xbf24=function(_0x197185,_0x251145){_0x197185=_0x197185-0x0;var _0x2c8af1=_0xf24b[_0x197185];return _0x2c8af1;};'use strict';function Telephone(_0x2525f2){this['id']=_0x2525f2['id']||0x0;this[_0xbf24('0x0')]=_0x2525f2[_0xbf24('0x0')]||'';this['accountcode']=_0x2525f2[_0xbf24('0x1')]||'';this['state']=_0xbf24('0x2');this[_0xbf24('0x3')]=0x0;this['status']=_0xbf24('0x2');this[_0xbf24('0x4')]='';}module[_0xbf24('0x5')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 4c9780e..a203249 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x3c8e2e,_0x69c9){var _0x4ab154=function(_0x555ec9){while(--_0x555ec9){_0x3c8e2e['push'](_0x3c8e2e['shift']());}};_0x4ab154(++_0x69c9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x3c3207,_0x182d5e){var _0x576529=function(_0x4e65ec){while(--_0x4e65ec){_0x3c3207['push'](_0x3c3207['shift']());}};_0x576529(++_0x182d5e);}(_0xb10b,0x12a));var _0xbb10=function(_0x380b08,_0x1df63a){_0x380b08=_0x380b08-0x0;var _0x22f65d=_0xb10b[_0x380b08];return _0x22f65d;};'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 c2af652..703f791 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda2d=['channel','voice','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x335827,_0x52fba3){var _0x4676f=function(_0x576823){while(--_0x576823){_0x335827['push'](_0x335827['shift']());}};_0x4676f(++_0x52fba3);}(_0xda2d,0x102));var _0xdda2=function(_0x2d81be,_0x43287b){_0x2d81be=_0x2d81be-0x0;var _0x413469=_0xda2d[_0x2d81be];return _0x413469;};'use strict';function Trigger(_0x2625ed){this['id']=_0x2625ed['id']||0x0;this[_0xdda2('0x0')]=_0x2625ed[_0xdda2('0x0')]||'';this[_0xdda2('0x1')]=_0x2625ed[_0xdda2('0x1')]||_0xdda2('0x2');this['status']=_0x2625ed['status']||![];this['AllConditions']=_0x2625ed[_0xdda2('0x3')]||[];this[_0xdda2('0x4')]=_0x2625ed[_0xdda2('0x4')]||[];this[_0xdda2('0x5')]=_0x2625ed[_0xdda2('0x5')]||[];}module[_0xdda2('0x6')]=Trigger; \ No newline at end of file +var _0xb10b=['AllConditions','AnyConditions','Actions','exports','name','channel','status'];(function(_0x2692be,_0x510113){var _0x456de4=function(_0x4f0bac){while(--_0x4f0bac){_0x2692be['push'](_0x2692be['shift']());}};_0x456de4(++_0x510113);}(_0xb10b,0x12a));var _0xbb10=function(_0x503a0c,_0xbc78c5){_0x503a0c=_0x503a0c-0x0;var _0x3b2e83=_0xb10b[_0x503a0c];return _0x3b2e83;};'use strict';function Trigger(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'voice';this[_0xbb10('0x2')]=_0x13ce8d[_0xbb10('0x2')]||![];this[_0xbb10('0x3')]=_0x13ce8d[_0xbb10('0x3')]||[];this[_0xbb10('0x4')]=_0x13ce8d[_0xbb10('0x4')]||[];this['Actions']=_0x13ce8d[_0xbb10('0x5')]||[];}module[_0xbb10('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index ae0196f..5b539ac 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 _0x80fc=['name','unknown','stateTime','status','registry','indexOf','split','host','domain','domainport','refresh','registrationtime','address','defaultuser','active'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x80fc,0x185));var _0xc80f=function(_0x37feb3,_0x473778){_0x37feb3=_0x37feb3-0x0;var _0x10083a=_0x80fc[_0x37feb3];return _0x10083a;};'use strict';function Trunk(_0x24f7d7){this['id']=_0x24f7d7['id']||0x0;this[_0xc80f('0x0')]=_0x24f7d7['active']||![];this[_0xc80f('0x1')]=_0x24f7d7[_0xc80f('0x1')]||'';this['state']=_0xc80f('0x2');this[_0xc80f('0x3')]=0x0;this[_0xc80f('0x4')]=_0xc80f('0x2');this[_0xc80f('0x5')]=_0x24f7d7[_0xc80f('0x5')]&&_0x24f7d7[_0xc80f('0x5')][_0xc80f('0x6')](':')?_0x24f7d7['registry'][_0xc80f('0x7')](':')[0x0]:'';this[_0xc80f('0x8')]='';this['port']='';this[_0xc80f('0x9')]='';this[_0xc80f('0xa')]='';this[_0xc80f('0xb')]='';this['stateRegistry']=_0xc80f('0x2');this[_0xc80f('0xc')]='';this[_0xc80f('0xd')]='';this[_0xc80f('0xe')]=_0x24f7d7[_0xc80f('0xe')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0x75de=['domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','unknown','stateTime','status','registry','indexOf','split','port','domain'];(function(_0x524fac,_0x28553f){var _0x572f6b=function(_0x573e03){while(--_0x573e03){_0x524fac['push'](_0x524fac['shift']());}};_0x572f6b(++_0x28553f);}(_0x75de,0x139));var _0xe75d=function(_0x4356ab,_0x511c87){_0x4356ab=_0x4356ab-0x0;var _0x521534=_0x75de[_0x4356ab];return _0x521534;};'use strict';function Trunk(_0x1605eb){this['id']=_0x1605eb['id']||0x0;this[_0xe75d('0x0')]=_0x1605eb[_0xe75d('0x0')]||![];this[_0xe75d('0x1')]=_0x1605eb['name']||'';this['state']=_0xe75d('0x2');this[_0xe75d('0x3')]=0x0;this[_0xe75d('0x4')]='unknown';this['registry']=_0x1605eb[_0xe75d('0x5')]&&_0x1605eb[_0xe75d('0x5')][_0xe75d('0x6')](':')?_0x1605eb['registry'][_0xe75d('0x7')](':')[0x0]:'';this['host']='';this[_0xe75d('0x8')]='';this[_0xe75d('0x9')]='';this[_0xe75d('0xa')]='';this[_0xe75d('0xb')]='';this[_0xe75d('0xc')]=_0xe75d('0x2');this[_0xe75d('0xd')]='';this[_0xe75d('0xe')]='';this[_0xe75d('0xf')]=_0x1605eb[_0xe75d('0xf')]||'';}module[_0xe75d('0x10')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 5f468dc..fbfcf21 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 _0xbdb5=['mandatoryDisposition','exports','exten'];(function(_0xc096b3,_0x11bad8){var _0x203139=function(_0x3c4ff3){while(--_0x3c4ff3){_0xc096b3['push'](_0xc096b3['shift']());}};_0x203139(++_0x11bad8);}(_0xbdb5,0xd7));var _0x5bdb=function(_0x4827a8,_0x5318f7){_0x4827a8=_0x4827a8-0x0;var _0x532a61=_0xbdb5[_0x4827a8];return _0x532a61;};'use strict';function voiceExtension(_0x1d8b81){this['id']=_0x1d8b81['id']||0x0;this[_0x5bdb('0x0')]=_0x1d8b81[_0x5bdb('0x0')]||'';this['recordingFormat']=_0x1d8b81['recordingFormat']||'none';this[_0x5bdb('0x1')]=_0x1d8b81[_0x5bdb('0x1')]||![];}module[_0x5bdb('0x2')]=voiceExtension; \ No newline at end of file +var _0x7f47=['mandatoryDisposition','exten','recordingFormat'];(function(_0x101317,_0x162be8){var _0x481e49=function(_0x22148d){while(--_0x22148d){_0x101317['push'](_0x101317['shift']());}};_0x481e49(++_0x162be8);}(_0x7f47,0x91));var _0x77f4=function(_0xbf1875,_0x34b144){_0xbf1875=_0xbf1875-0x0;var _0x2e598b=_0x7f47[_0xbf1875];return _0x2e598b;};'use strict';function voiceExtension(_0x4f3585){this['id']=_0x4f3585['id']||0x0;this['exten']=_0x4f3585[_0x77f4('0x0')]||'';this[_0x77f4('0x1')]=_0x4f3585[_0x77f4('0x1')]||'none';this[_0x77f4('0x2')]=_0x4f3585[_0x77f4('0x2')]||![];}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 f767ac3..b4af4ef 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 _0x026b=['dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','unavailable','ringing','onhold','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','waiting','total','answered','sumBillable','abandoned','loggedIn','available','acw','acwTimeout','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel'];(function(_0x48ada8,_0x578d35){var _0x178ad1=function(_0x27ed35){while(--_0x27ed35){_0x48ada8['push'](_0x48ada8['shift']());}};_0x178ad1(++_0x578d35);}(_0x026b,0x12f));var _0xb026=function(_0x189305,_0x46c43f){_0x189305=_0x189305-0x0;var _0xea3406=_0x026b[_0x189305];return _0xea3406;};'use strict';var statusDesc=[_0xb026('0x0'),_0xb026('0x1'),_0xb026('0x2'),'busy','invalid',_0xb026('0x3'),_0xb026('0x4'),'ringinuse',_0xb026('0x5')];var monitorFormat={'wav':'wav','wav49':_0xb026('0x6'),'gsm':_0xb026('0x7')};var strategy={'rrmemory':_0xb026('0x8'),'roundrobin':_0xb026('0x9')};function VoiceQueue(_0x11289e){this['id']=_0x11289e['id']||0x0;this['name']=_0x11289e[_0xb026('0xa')]||'';this[_0xb026('0xb')]=_0x11289e[_0xb026('0xb')]||'';this[_0xb026('0xc')]=_0x11289e[_0xb026('0xc')]||'inbound';this[_0xb026('0xd')]=0x0;this['talking']=0x0;this[_0xb026('0xe')]=0x0;this[_0xb026('0xf')]=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this[_0xb026('0x10')]=0x0;this['unmanaged']=0x0;this[_0xb026('0x11')]=0x0;this[_0xb026('0x12')]=0x0;this[_0xb026('0x13')]=0x0;this[_0xb026('0x14')]=_0x11289e[_0xb026('0x14')]||![];this[_0xb026('0x15')]=_0x11289e[_0xb026('0x15')]||0xa;this['autopause']=_0x11289e['autopause']||'no';this['sendMessageOneNotActive']=!![];this['message']='';this['originated']=0x0;this[_0xb026('0x16')]=0x0;this[_0xb026('0x17')]=_0x11289e[_0xb026('0x17')]||null;this[_0xb026('0x18')]=_0x11289e[_0xb026('0x18')]?_0x11289e[_0xb026('0x18')]:null;this['dialActive']=_0x11289e[_0xb026('0x19')];this['dialMethod']=_0x11289e[_0xb026('0x1a')]||'progressive';this[_0xb026('0x1b')]=_0x11289e[_0xb026('0x1b')]||0x0;this[_0xb026('0x1c')]=_0x11289e[_0xb026('0x1c')]||0x0;this['dialPowerLevel']=_0x11289e[_0xb026('0x1d')]||0x1;this['dialPredictiveOptimization']=_0x11289e[_0xb026('0x1e')]||_0xb026('0x1f');this[_0xb026('0x20')]=_0x11289e[_0xb026('0x20')]||0.03;this[_0xb026('0x21')]=_0x11289e[_0xb026('0x21')]||0x258;this[_0xb026('0x22')]=_0x11289e['dialOriginateCallerIdName']||_0xb026('0x23');this[_0xb026('0x24')]=_0x11289e[_0xb026('0x24')]||'anonymous';this[_0xb026('0x25')]=_0x11289e[_0xb026('0x25')]||0x1e;this[_0xb026('0x26')]=_0x11289e[_0xb026('0x26')]||_0xb026('0x27');this[_0xb026('0x28')]=_0x11289e[_0xb026('0x28')]||0x3;this[_0xb026('0x29')]=_0x11289e[_0xb026('0x29')]||undefined;this[_0xb026('0x2a')]=_0x11289e[_0xb026('0x2a')]||0x3;this['dialCongestionRetryFrequency']=_0x11289e[_0xb026('0x2b')]||0x96;this['dialBusyMaxRetry']=_0x11289e[_0xb026('0x2c')]||0x3;this[_0xb026('0x2d')]=_0x11289e[_0xb026('0x2d')]||0x96;this[_0xb026('0x2e')]=_0x11289e[_0xb026('0x2e')]||0x3;this[_0xb026('0x2f')]=_0x11289e[_0xb026('0x2f')]||0x96;this[_0xb026('0x30')]=_0x11289e[_0xb026('0x30')]||0x3;this[_0xb026('0x31')]=_0x11289e[_0xb026('0x31')]||0x96;this[_0xb026('0x32')]=_0x11289e[_0xb026('0x32')]||0x3;this[_0xb026('0x33')]=_0x11289e['dialDropRetryFrequency']||0x96;this[_0xb026('0x34')]=_0x11289e[_0xb026('0x34')]||0x3;this[_0xb026('0x35')]=_0x11289e[_0xb026('0x35')]||0x96;this[_0xb026('0x36')]=_0x11289e[_0xb026('0x36')]||0x3;this['dialMachineRetryFrequency']=_0x11289e[_0xb026('0x37')]||0x96;this[_0xb026('0x38')]=_0x11289e[_0xb026('0x38')]||0x3;this[_0xb026('0x39')]=_0x11289e[_0xb026('0x39')]||0x96;this[_0xb026('0x3a')]=_0x11289e[_0xb026('0x3a')]||0x4;this[_0xb026('0x3b')]=_0x11289e[_0xb026('0x3b')]?_0x11289e[_0xb026('0x3b')]:undefined;this['TrunkBackup']=_0x11289e[_0xb026('0x3c')]?_0x11289e['TrunkBackup']:undefined;this[_0xb026('0x3d')]=_0x11289e[_0xb026('0x3d')]||undefined;this[_0xb026('0x3e')]=_0x11289e['Interval']?_0x11289e[_0xb026('0x3e')]:undefined;this['dialOrderByScheduledAt']=_0x11289e['dialOrderByScheduledAt']||_0xb026('0x3f');this[_0xb026('0x40')]=_0x11289e[_0xb026('0x40')]||undefined;this[_0xb026('0x41')]=_0x11289e['dialCutDigit']||undefined;this[_0xb026('0x42')]=strategy[_0x11289e[_0xb026('0x42')]]||_0xb026('0x8');this['queueStatusComplete']=!![];this[_0xb026('0x43')]=_0x11289e[_0xb026('0x43')]||![];this[_0xb026('0x44')]=_0x11289e[_0xb026('0x44')];this['dialAMDGreeting']=_0x11289e[_0xb026('0x45')];this[_0xb026('0x46')]=_0x11289e[_0xb026('0x46')];this[_0xb026('0x47')]=_0x11289e[_0xb026('0x47')];this[_0xb026('0x48')]=_0x11289e[_0xb026('0x48')];this[_0xb026('0x49')]=_0x11289e['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x11289e['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x11289e[_0xb026('0x4a')];this['dialAMDMaximumWordLength']=_0x11289e[_0xb026('0x4b')];this[_0xb026('0x4c')]=0x0;this[_0xb026('0x4d')]=0x0;this[_0xb026('0x4e')]=_0x11289e['timeout'];this['outboundAnswerCallsDay']=0x0;this[_0xb026('0x4f')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0xb026('0x50')]=0x0;this[_0xb026('0x51')]=0x0;this[_0xb026('0x52')]=0x0;this['outboundUnknownCallsDay']=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xb026('0x53')]=0x0;this[_0xb026('0x54')]=0x0;this[_0xb026('0x55')]=0x0;this[_0xb026('0x56')]=0x0;this['outboundReCallsDay']=0x0;this['outboundAbandonedDay']=0x0;this[_0xb026('0x57')]=undefined;this[_0xb026('0x58')]=undefined;this['handlePredictive']=undefined;this[_0xb026('0x59')]=1.05;this[_0xb026('0x5a')]=0x0;this[_0xb026('0x5b')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xb026('0x5c')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xb026('0x5d')]=0x0;this[_0xb026('0x5e')]=0x0;this[_0xb026('0x5f')]=_0x11289e[_0xb026('0x60')]||0x14;this['predictiveIntervalMinThreshold']=_0x11289e['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xb026('0x61')]=0x0;this[_0xb026('0x62')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xb026('0x63')]=0x0;this[_0xb026('0x64')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0xb026('0x65')]=0x0;this['dialRecallMeTimeout']=_0x11289e[_0xb026('0x66')]||0x1e;this[_0xb026('0x67')]=_0x11289e[_0xb026('0x67')]||![];this[_0xb026('0x68')]=!!_0x11289e[_0xb026('0x68')]||![];this[_0xb026('0x69')]=!!_0x11289e['dialPreviewRecallmeReminder']||![];this['dialQueueProject2']=_0x11289e[_0xb026('0x6a')]||undefined;this[_0xb026('0x6b')]=_0x11289e['dialAgiAfterHangupClient']||![];this['dialAgiAfterHangupAgent']=_0x11289e[_0xb026('0x6c')]||![];this['monitor_format']=monitorFormat[_0x11289e[_0xb026('0xb')]]?monitorFormat[_0x11289e[_0xb026('0xb')]]:undefined;this['mandatoryDisposition']=_0x11289e['mandatoryDisposition']||![];this[_0xb026('0x6d')]=_0x11289e[_0xb026('0x6d')]?_0x11289e[_0xb026('0x6d')]:undefined;}module[_0xb026('0x6e')]=VoiceQueue; \ No newline at end of file +var _0x8ad7=['predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','invalid','ringing','ringinuse','onhold','wav','gsm','roundrobin','name','monitor_format','type','inbound','talking','total','answered','sumDuration','sumHoldTime','unmanaged','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls'];(function(_0x15dca9,_0xd1d8b5){var _0x231100=function(_0x416066){while(--_0x416066){_0x15dca9['push'](_0x15dca9['shift']());}};_0x231100(++_0xd1d8b5);}(_0x8ad7,0x186));var _0x78ad=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x8ad7[_0x178e48];return _0x440d7e;};'use strict';var statusDesc=[_0x78ad('0x0'),_0x78ad('0x1'),'inuse','busy',_0x78ad('0x2'),'unavailable',_0x78ad('0x3'),_0x78ad('0x4'),_0x78ad('0x5')];var monitorFormat={'wav':_0x78ad('0x6'),'wav49':'wav49','gsm':_0x78ad('0x7')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x78ad('0x8')};function VoiceQueue(_0x31dbd0){this['id']=_0x31dbd0['id']||0x0;this[_0x78ad('0x9')]=_0x31dbd0[_0x78ad('0x9')]||'';this[_0x78ad('0xa')]=_0x31dbd0['monitor_format']||'';this[_0x78ad('0xb')]=_0x31dbd0[_0x78ad('0xb')]||_0x78ad('0xc');this['waiting']=0x0;this[_0x78ad('0xd')]=0x0;this[_0x78ad('0xe')]=0x0;this[_0x78ad('0xf')]=0x0;this[_0x78ad('0x10')]=0x0;this[_0x78ad('0x11')]=0x0;this['sumBillable']=0x0;this[_0x78ad('0x12')]=0x0;this['abandoned']=0x0;this[_0x78ad('0x13')]=0x0;this[_0x78ad('0x14')]=0x0;this[_0x78ad('0x15')]=_0x31dbd0[_0x78ad('0x15')]||![];this[_0x78ad('0x16')]=_0x31dbd0[_0x78ad('0x16')]||0xa;this[_0x78ad('0x17')]=_0x31dbd0[_0x78ad('0x17')]||'no';this[_0x78ad('0x18')]=!![];this['message']='';this[_0x78ad('0x19')]=0x0;this[_0x78ad('0x1a')]=0x0;this[_0x78ad('0x1b')]=_0x31dbd0['dialTimezone']||null;this[_0x78ad('0x1c')]=_0x31dbd0[_0x78ad('0x1c')]?_0x31dbd0['dialGlobalInterval']:null;this[_0x78ad('0x1d')]=_0x31dbd0['dialActive'];this['dialMethod']=_0x31dbd0[_0x78ad('0x1e')]||_0x78ad('0x1f');this[_0x78ad('0x20')]=_0x31dbd0[_0x78ad('0x20')]||0x0;this[_0x78ad('0x21')]=_0x31dbd0[_0x78ad('0x21')]||0x0;this[_0x78ad('0x22')]=_0x31dbd0[_0x78ad('0x22')]||0x1;this[_0x78ad('0x23')]=_0x31dbd0[_0x78ad('0x23')]||_0x78ad('0x24');this['dialPredictiveOptimizationPercentage']=_0x31dbd0[_0x78ad('0x25')]||0.03;this[_0x78ad('0x26')]=_0x31dbd0[_0x78ad('0x26')]||0x258;this[_0x78ad('0x27')]=_0x31dbd0['dialOriginateCallerIdName']||'anonymous';this[_0x78ad('0x28')]=_0x31dbd0[_0x78ad('0x28')]||_0x78ad('0x29');this[_0x78ad('0x2a')]=_0x31dbd0[_0x78ad('0x2a')]||0x1e;this[_0x78ad('0x2b')]=_0x31dbd0[_0x78ad('0x2b')]||_0x78ad('0x2c');this[_0x78ad('0x2d')]=_0x31dbd0[_0x78ad('0x2d')]||0x3;this[_0x78ad('0x2e')]=_0x31dbd0[_0x78ad('0x2e')]||undefined;this['dialCongestionMaxRetry']=_0x31dbd0[_0x78ad('0x2f')]||0x3;this[_0x78ad('0x30')]=_0x31dbd0[_0x78ad('0x30')]||0x96;this[_0x78ad('0x31')]=_0x31dbd0[_0x78ad('0x31')]||0x3;this[_0x78ad('0x32')]=_0x31dbd0['dialBusyRetryFrequency']||0x96;this[_0x78ad('0x33')]=_0x31dbd0['dialNoAnswerMaxRetry']||0x3;this['dialNoAnswerRetryFrequency']=_0x31dbd0[_0x78ad('0x34')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x31dbd0[_0x78ad('0x35')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x31dbd0[_0x78ad('0x36')]||0x96;this[_0x78ad('0x37')]=_0x31dbd0['dialDropMaxRetry']||0x3;this[_0x78ad('0x38')]=_0x31dbd0[_0x78ad('0x38')]||0x96;this['dialAbandonedMaxRetry']=_0x31dbd0['dialAbandonedMaxRetry']||0x3;this[_0x78ad('0x39')]=_0x31dbd0['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x31dbd0[_0x78ad('0x3a')]||0x3;this[_0x78ad('0x3b')]=_0x31dbd0[_0x78ad('0x3b')]||0x96;this[_0x78ad('0x3c')]=_0x31dbd0[_0x78ad('0x3c')]||0x3;this[_0x78ad('0x3d')]=_0x31dbd0[_0x78ad('0x3d')]||0x96;this[_0x78ad('0x3e')]=_0x31dbd0[_0x78ad('0x3e')]||0x4;this[_0x78ad('0x3f')]=_0x31dbd0[_0x78ad('0x3f')]?_0x31dbd0['Trunk']:undefined;this[_0x78ad('0x40')]=_0x31dbd0['TrunkBackup']?_0x31dbd0[_0x78ad('0x40')]:undefined;this['dialPrefix']=_0x31dbd0[_0x78ad('0x41')]||undefined;this[_0x78ad('0x42')]=_0x31dbd0['Interval']?_0x31dbd0[_0x78ad('0x42')]:undefined;this[_0x78ad('0x43')]=_0x31dbd0['dialOrderByScheduledAt']||_0x78ad('0x44');this['dialRandomLastDigitCallerIdNumber']=_0x31dbd0[_0x78ad('0x45')]||undefined;this[_0x78ad('0x46')]=_0x31dbd0['dialCutDigit']||undefined;this[_0x78ad('0x47')]=strategy[_0x31dbd0[_0x78ad('0x47')]]||_0x78ad('0x48');this[_0x78ad('0x49')]=!![];this[_0x78ad('0x4a')]=_0x31dbd0['dialAMDActive']||![];this[_0x78ad('0x4b')]=_0x31dbd0[_0x78ad('0x4b')];this[_0x78ad('0x4c')]=_0x31dbd0[_0x78ad('0x4c')];this['dialAMDAfterGreetingSilence']=_0x31dbd0[_0x78ad('0x4d')];this[_0x78ad('0x4e')]=_0x31dbd0['dialAMDTotalAnalysisTime'];this[_0x78ad('0x4f')]=_0x31dbd0[_0x78ad('0x4f')];this[_0x78ad('0x50')]=_0x31dbd0[_0x78ad('0x50')];this[_0x78ad('0x51')]=_0x31dbd0[_0x78ad('0x51')];this[_0x78ad('0x52')]=_0x31dbd0[_0x78ad('0x52')];this[_0x78ad('0x53')]=_0x31dbd0['dialAMDMaximumWordLength'];this[_0x78ad('0x54')]=0x0;this['pTalking']=0x0;this[_0x78ad('0x55')]=_0x31dbd0[_0x78ad('0x55')];this[_0x78ad('0x56')]=0x0;this[_0x78ad('0x57')]=0x0;this[_0x78ad('0x58')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x78ad('0x59')]=0x0;this[_0x78ad('0x5a')]=0x0;this[_0x78ad('0x5b')]=0x0;this[_0x78ad('0x5c')]=0x0;this[_0x78ad('0x5d')]=0x0;this[_0x78ad('0x5e')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x78ad('0x5f')]=0x0;this[_0x78ad('0x60')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x78ad('0x61')]=undefined;this[_0x78ad('0x62')]=undefined;this[_0x78ad('0x63')]=undefined;this[_0x78ad('0x64')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x78ad('0x65')]=0x0;this[_0x78ad('0x66')]=0x0;this[_0x78ad('0x67')]=0x0;this[_0x78ad('0x68')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x78ad('0x69')]=0x0;this[_0x78ad('0x6a')]=0x0;this[_0x78ad('0x6b')]=_0x31dbd0['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x78ad('0x6c')]=_0x31dbd0[_0x78ad('0x6d')]||0xa;this[_0x78ad('0x6e')]=0x0;this[_0x78ad('0x6f')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x78ad('0x70')]=0x0;this[_0x78ad('0x71')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x78ad('0x72')]=0x0;this[_0x78ad('0x73')]=_0x31dbd0[_0x78ad('0x73')]||0x1e;this[_0x78ad('0x74')]=_0x31dbd0[_0x78ad('0x74')]||![];this[_0x78ad('0x75')]=!!_0x31dbd0[_0x78ad('0x75')]||![];this['dialPreviewRecallmeReminder']=!!_0x31dbd0[_0x78ad('0x76')]||![];this['dialQueueProject2']=_0x31dbd0['dialQueueProject2']||undefined;this['dialAgiAfterHangupClient']=_0x31dbd0['dialAgiAfterHangupClient']||![];this[_0x78ad('0x77')]=_0x31dbd0[_0x78ad('0x77')]||![];this[_0x78ad('0xa')]=monitorFormat[_0x31dbd0[_0x78ad('0xa')]]?monitorFormat[_0x31dbd0[_0x78ad('0xa')]]:undefined;this[_0x78ad('0x78')]=_0x31dbd0[_0x78ad('0x78')]||![];this['mandatoryDispositionPause']=_0x31dbd0[_0x78ad('0x79')]?_0x31dbd0[_0x78ad('0x79')]:undefined;}module[_0x78ad('0x7a')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index bd1c984..051f9d9 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 _0x2cf9=['name','username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0xa90718,_0x2fd952){var _0x56ed79=function(_0x41cff1){while(--_0x41cff1){_0xa90718['push'](_0xa90718['shift']());}};_0x56ed79(++_0x2fd952);}(_0x2cf9,0x149));var _0x92cf=function(_0x598622,_0x39985c){_0x598622=_0x598622-0x0;var _0x50df2f=_0x2cf9[_0x598622];return _0x50df2f;};'use strict';function VtigerAccount(_0x429677){this['id']=_0x429677['id']||0x0;this[_0x92cf('0x0')]=_0x429677[_0x92cf('0x0')]||'';this[_0x92cf('0x1')]=_0x429677[_0x92cf('0x1')]||'';this['accessKey']=_0x429677[_0x92cf('0x2')]||'';this[_0x92cf('0x3')]=_0x429677[_0x92cf('0x3')]||'';this[_0x92cf('0x4')]=_0x429677[_0x92cf('0x4')]||'';this[_0x92cf('0x5')]=_0x429677[_0x92cf('0x5')]||{};}module[_0x92cf('0x6')]=VtigerAccount; \ No newline at end of file +var _0x82f8=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x82f8,0x14c));var _0x882f=function(_0x4fbb75,_0x594017){_0x4fbb75=_0x4fbb75-0x0;var _0x14f5b3=_0x82f8[_0x4fbb75];return _0x14f5b3;};'use strict';function VtigerAccount(_0x1db756){this['id']=_0x1db756['id']||0x0;this['name']=_0x1db756[_0x882f('0x0')]||'';this['username']=_0x1db756[_0x882f('0x1')]||'';this[_0x882f('0x2')]=_0x1db756['accessKey']||'';this[_0x882f('0x3')]=_0x1db756[_0x882f('0x3')]||'';this['serverUrl']=_0x1db756[_0x882f('0x4')]||'';this[_0x882f('0x5')]=_0x1db756[_0x882f('0x5')]||{};}module[_0x882f('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index da6d1fe..bf33b80 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 _0xb908=['username','password','token','remoteUri','authType','type','serverUrl','Configurations','exports','name'];(function(_0x23cd5a,_0x45de7d){var _0x4e4719=function(_0xe1ad36){while(--_0xe1ad36){_0x23cd5a['push'](_0x23cd5a['shift']());}};_0x4e4719(++_0x45de7d);}(_0xb908,0xb3));var _0x8b90=function(_0x231dda,_0x5b04cc){_0x231dda=_0x231dda-0x0;var _0x3f88cb=_0xb908[_0x231dda];return _0x3f88cb;};'use strict';function ZendeskAccount(_0x58ac13){this['id']=_0x58ac13['id']||0x0;this[_0x8b90('0x0')]=_0x58ac13[_0x8b90('0x0')]||'';this['username']=_0x58ac13[_0x8b90('0x1')]||'';this[_0x8b90('0x2')]=_0x58ac13[_0x8b90('0x2')]||'';this[_0x8b90('0x3')]=_0x58ac13[_0x8b90('0x3')]||'';this[_0x8b90('0x4')]=_0x58ac13[_0x8b90('0x4')]||'';this[_0x8b90('0x5')]=_0x58ac13[_0x8b90('0x5')]||'';this[_0x8b90('0x6')]=_0x58ac13[_0x8b90('0x6')]||'integrationTab';this[_0x8b90('0x7')]=_0x58ac13[_0x8b90('0x7')]||'';this[_0x8b90('0x8')]=_0x58ac13[_0x8b90('0x8')]||{};}module[_0x8b90('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x2174=['username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x1cc188,_0x10f6f4){var _0x56ba0a=function(_0x4266af){while(--_0x4266af){_0x1cc188['push'](_0x1cc188['shift']());}};_0x56ba0a(++_0x10f6f4);}(_0x2174,0x1c2));var _0x4217=function(_0x4261ba,_0x3e8c96){_0x4261ba=_0x4261ba-0x0;var _0x42ed58=_0x2174[_0x4261ba];return _0x42ed58;};'use strict';function ZendeskAccount(_0xfe343){this['id']=_0xfe343['id']||0x0;this[_0x4217('0x0')]=_0xfe343[_0x4217('0x0')]||'';this[_0x4217('0x1')]=_0xfe343[_0x4217('0x1')]||'';this['password']=_0xfe343[_0x4217('0x2')]||'';this[_0x4217('0x3')]=_0xfe343['token']||'';this[_0x4217('0x4')]=_0xfe343[_0x4217('0x4')]||'';this[_0x4217('0x5')]=_0xfe343['authType']||'';this[_0x4217('0x6')]=_0xfe343[_0x4217('0x6')]||_0x4217('0x7');this[_0x4217('0x8')]=_0xfe343['serverUrl']||'';this[_0x4217('0x9')]=_0xfe343['Configurations']||{};}module[_0x4217('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 6a04855..3595095 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 _0x92b3=['host','zone','clientSecret','serverUrl','code','refreshToken','Configurations','name','description'];(function(_0x1108ce,_0x266f4a){var _0x480580=function(_0x62d82d){while(--_0x62d82d){_0x1108ce['push'](_0x1108ce['shift']());}};_0x480580(++_0x266f4a);}(_0x92b3,0x10c));var _0x392b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x92b3[_0x3dd15e];return _0x231fd0;};'use strict';function ZohoAccount(_0x1ca5f8){this['id']=_0x1ca5f8['id']||0x0;this[_0x392b('0x0')]=_0x1ca5f8[_0x392b('0x0')]||'';this[_0x392b('0x1')]=_0x1ca5f8[_0x392b('0x1')]||'';this['host']=_0x1ca5f8[_0x392b('0x2')]||'';this[_0x392b('0x3')]=_0x1ca5f8[_0x392b('0x3')]||'';this['clientId']=_0x1ca5f8['clientId']||'';this[_0x392b('0x4')]=_0x1ca5f8[_0x392b('0x4')]||'';this[_0x392b('0x5')]=_0x1ca5f8[_0x392b('0x5')]||'';this['code']=_0x1ca5f8[_0x392b('0x6')]||'';this[_0x392b('0x7')]=_0x1ca5f8[_0x392b('0x7')]||'';this[_0x392b('0x8')]=_0x1ca5f8['Configurations']||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0xe98b=['serverUrl','code','refreshToken','Configurations','exports','name','description','zone','clientId'];(function(_0x2ab7a6,_0x2e9df7){var _0x234b34=function(_0x489916){while(--_0x489916){_0x2ab7a6['push'](_0x2ab7a6['shift']());}};_0x234b34(++_0x2e9df7);}(_0xe98b,0x7a));var _0xbe98=function(_0x59c57c,_0x4770ee){_0x59c57c=_0x59c57c-0x0;var _0x30d0f1=_0xe98b[_0x59c57c];return _0x30d0f1;};'use strict';function ZohoAccount(_0x344e2d){this['id']=_0x344e2d['id']||0x0;this[_0xbe98('0x0')]=_0x344e2d['name']||'';this[_0xbe98('0x1')]=_0x344e2d[_0xbe98('0x1')]||'';this['host']=_0x344e2d['host']||'';this['zone']=_0x344e2d[_0xbe98('0x2')]||'';this[_0xbe98('0x3')]=_0x344e2d['clientId']||'';this['clientSecret']=_0x344e2d['clientSecret']||'';this[_0xbe98('0x4')]=_0x344e2d[_0xbe98('0x4')]||'';this[_0xbe98('0x5')]=_0x344e2d['code']||'';this[_0xbe98('0x6')]=_0x344e2d[_0xbe98('0x6')]||'';this[_0xbe98('0x7')]=_0x344e2d[_0xbe98('0x7')]||{};}module[_0xbe98('0x8')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index e44bb7f..d85f30c 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 _0xe953=['countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','util','lodash','isNil','string','uniqueid','idContact','queue','name','dialAnswer','membername','Agent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry'];(function(_0x5a2406,_0x3c5983){var _0x3b490d=function(_0x12a996){while(--_0x12a996){_0x5a2406['push'](_0x5a2406['shift']());}};_0x3b490d(++_0x3c5983);}(_0xe953,0x142));var _0x3e95=function(_0x100e36,_0x4da225){_0x100e36=_0x100e36-0x0;var _0x1df0c9=_0xe953[_0x100e36];return _0x1df0c9;};'use strict';var util=require(_0x3e95('0x0'));var _=require(_0x3e95('0x1'));var moment=require('moment');function checkNameSurname(_0x358942,_0x5e9aac,_0x1feca1){var _0x2e976c='';if(!_[_0x3e95('0x2')](_0x5e9aac)&&'string'===typeof _0x5e9aac){_0x2e976c+=_0x5e9aac;}if(!_[_0x3e95('0x2')](_0x1feca1)&&_0x3e95('0x3')===typeof _0x1feca1){_0x2e976c+='\x20'+_0x1feca1;}if(_0x2e976c!==''){return _0x2e976c;}return _0x358942;}function Action(_0x2ab49e,_0x4d9e0e,_0x5a1142,_0x38d6cd,_0x3fd280){this[_0x3e95('0x4')]=_0x5a1142||undefined;this[_0x3e95('0x5')]=_0x2ab49e['id'];this[_0x3e95('0x6')]=_0x4d9e0e[_0x3e95('0x7')];this['type']=_0x4d9e0e['type'];this['campaigntype']='queue';this[_0x3e95('0x8')]=![];this[_0x3e95('0x9')]=_[_0x3e95('0x2')](_0x2ab49e[_0x3e95('0xa')])?undefined:_0x2ab49e['Agent']['name'];this['channelAgent']=this[_0x3e95('0x9')]?util[_0x3e95('0xb')](_0x3e95('0xc'),this[_0x3e95('0x9')]):_0x38d6cd||undefined;this[_0x3e95('0xd')]=checkNameSurname(_0x2ab49e[_0x3e95('0xe')][_0x3e95('0xf')],_0x2ab49e[_0x3e95('0xe')][_0x3e95('0x10')],_0x2ab49e['Contact'][_0x3e95('0x11')]);this['active']=_0x2ab49e[_0x3e95('0x12')]||![];this[_0x3e95('0x13')]=_0x2ab49e[_0x3e95('0xe')][_0x3e95('0xf')];this[_0x3e95('0x14')]=_0x2ab49e[_0x3e95('0x14')];this['countbusyretry']=_0x2ab49e[_0x3e95('0x15')]||0x0;this[_0x3e95('0x16')]=_0x2ab49e[_0x3e95('0x16')]||0x0;this[_0x3e95('0x17')]=_0x2ab49e[_0x3e95('0x17')]||0x0;this[_0x3e95('0x18')]=(_0x2ab49e['countbusyretry']||0x0)+(_0x2ab49e[_0x3e95('0x16')]||0x0)+(_0x2ab49e[_0x3e95('0x17')]||0x0)+(_0x2ab49e['countnosuchnumberretry']||0x0)+(_0x2ab49e[_0x3e95('0x19')]||0x0)+(_0x2ab49e[_0x3e95('0x1a')]||0x0)+(_0x2ab49e['countmachineretry']||0x0)+(_0x2ab49e['countagentrejectretry']||0x0);this['countnosuchnumberretry']=_0x2ab49e[_0x3e95('0x1b')]||0x0;this[_0x3e95('0x19')]=_0x2ab49e['countdropretry']||0x0;this[_0x3e95('0x1a')]=_0x2ab49e[_0x3e95('0x1a')]||0x0;this['countmachineretry']=_0x2ab49e[_0x3e95('0x1c')]||0x0;this[_0x3e95('0x1d')]=_0x2ab49e[_0x3e95('0x1d')]||0x0;this['callback']=_0x2ab49e[_0x3e95('0x1e')];this[_0x3e95('0x1f')]=_0x2ab49e[_0x3e95('0x1f')];this[_0x3e95('0x20')]=_0x2ab49e['callbackat'];this['recallme']=_0x2ab49e[_0x3e95('0x21')];this[_0x3e95('0x22')]=_0x2ab49e[_0x3e95('0x22')];this[_0x3e95('0x23')]=_0x2ab49e['ListId'];this['UserId']=_[_0x3e95('0x2')](_0x2ab49e[_0x3e95('0xa')])?_0x2ab49e[_0x3e95('0x24')]:_0x2ab49e[_0x3e95('0xa')]['id'];this['VoiceQueueId']=_0x2ab49e[_0x3e95('0x25')];this['originatecalleridnum']='';this[_0x3e95('0x26')]='';}Action[_0x3e95('0x27')][_0x3e95('0x28')]=function(){return util[_0x3e95('0xb')](_0x3e95('0x29'),this[_0x3e95('0xd')],this[_0x3e95('0x2a')]);};module['exports']=Action; \ No newline at end of file +var _0x4da9=['uniqueid','queue','name','type','campaigntype','dialAnswer','membername','Agent','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','originatecalleridname','prototype','format','\x22%s\x22\x20<%s>','exports','lodash','moment','isNil','string'];(function(_0x395c99,_0x4527b3){var _0x12bc7e=function(_0x25eeab){while(--_0x25eeab){_0x395c99['push'](_0x395c99['shift']());}};_0x12bc7e(++_0x4527b3);}(_0x4da9,0xce));var _0x94da=function(_0x507e3b,_0x8f19eb){_0x507e3b=_0x507e3b-0x0;var _0x3aafa2=_0x4da9[_0x507e3b];return _0x3aafa2;};'use strict';var util=require('util');var _=require(_0x94da('0x0'));var moment=require(_0x94da('0x1'));function checkNameSurname(_0x102572,_0x317cd4,_0x335883){var _0x32173d='';if(!_[_0x94da('0x2')](_0x317cd4)&&'string'===typeof _0x317cd4){_0x32173d+=_0x317cd4;}if(!_[_0x94da('0x2')](_0x335883)&&_0x94da('0x3')===typeof _0x335883){_0x32173d+='\x20'+_0x335883;}if(_0x32173d!==''){return _0x32173d;}return _0x102572;}function Action(_0x25ba8a,_0xcac987,_0x142762,_0x5969fc,_0x1f0877){this[_0x94da('0x4')]=_0x142762||undefined;this['idContact']=_0x25ba8a['id'];this[_0x94da('0x5')]=_0xcac987[_0x94da('0x6')];this[_0x94da('0x7')]=_0xcac987[_0x94da('0x7')];this[_0x94da('0x8')]='queue';this[_0x94da('0x9')]=![];this[_0x94da('0xa')]=_[_0x94da('0x2')](_0x25ba8a[_0x94da('0xb')])?undefined:_0x25ba8a[_0x94da('0xb')][_0x94da('0x6')];this['channelAgent']=this['membername']?util['format'](_0x94da('0xc'),this['membername']):_0x5969fc||undefined;this[_0x94da('0xd')]=checkNameSurname(_0x25ba8a[_0x94da('0xe')][_0x94da('0xf')],_0x25ba8a['Contact'][_0x94da('0x10')],_0x25ba8a['Contact'][_0x94da('0x11')]);this[_0x94da('0x12')]=_0x25ba8a['active']||![];this[_0x94da('0x13')]=_0x25ba8a[_0x94da('0xe')][_0x94da('0xf')];this[_0x94da('0x14')]=_0x25ba8a['scheduledat'];this['countbusyretry']=_0x25ba8a[_0x94da('0x15')]||0x0;this[_0x94da('0x16')]=_0x25ba8a[_0x94da('0x16')]||0x0;this[_0x94da('0x17')]=_0x25ba8a[_0x94da('0x17')]||0x0;this[_0x94da('0x18')]=(_0x25ba8a[_0x94da('0x15')]||0x0)+(_0x25ba8a[_0x94da('0x16')]||0x0)+(_0x25ba8a['countnoanswerretry']||0x0)+(_0x25ba8a[_0x94da('0x19')]||0x0)+(_0x25ba8a[_0x94da('0x1a')]||0x0)+(_0x25ba8a[_0x94da('0x1b')]||0x0)+(_0x25ba8a['countmachineretry']||0x0)+(_0x25ba8a[_0x94da('0x1c')]||0x0);this[_0x94da('0x19')]=_0x25ba8a[_0x94da('0x19')]||0x0;this['countdropretry']=_0x25ba8a[_0x94da('0x1a')]||0x0;this[_0x94da('0x1b')]=_0x25ba8a[_0x94da('0x1b')]||0x0;this[_0x94da('0x1d')]=_0x25ba8a[_0x94da('0x1d')]||0x0;this['countagentrejectretry']=_0x25ba8a[_0x94da('0x1c')]||0x0;this['callback']=_0x25ba8a[_0x94da('0x1e')];this[_0x94da('0x1f')]=_0x25ba8a[_0x94da('0x1f')];this['callbackat']=_0x25ba8a[_0x94da('0x20')];this['recallme']=_0x25ba8a[_0x94da('0x21')];this['ContactId']=_0x25ba8a[_0x94da('0x22')];this[_0x94da('0x23')]=_0x25ba8a['ListId'];this['UserId']=_[_0x94da('0x2')](_0x25ba8a['Agent'])?_0x25ba8a['UserId']:_0x25ba8a[_0x94da('0xb')]['id'];this[_0x94da('0x24')]=_0x25ba8a[_0x94da('0x24')];this['originatecalleridnum']='';this[_0x94da('0x25')]='';}Action[_0x94da('0x26')]['getCaller']=function(){return util[_0x94da('0x27')](_0x94da('0x28'),this[_0x94da('0xd')],this['number']);};module[_0x94da('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 983f751..7eacb3d 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 _0x4d9e=['Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','isEmpty','Agent','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','addVariables','merge','toLowerVariables','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','actionid','agents','logLookAgent','clone','response','idContact','custom:agentringnoanswer','rejected','cause','statedesc','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destlinkedid','destuniqueid','addVariable','variables','syncVarSet','filterKey','keys','variable','value','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','util','uuid','md5','../../../config/environment','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','defaults','redis','localhost','socket.io-emitter','prototype','tail','finally','sequence','originateresponse','syncOriginateResponse','bind','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','varset','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','emit','type','outbound','name','strategy','available','pTalking','sumBillable','sumHoldTime','talking','unmanaged','abandoned','dialActive','dialMethod','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','originated','erlangCalls','erlangCallToSecond','Trunk','active','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','sendMessageOneNotActive','paused','message','\x20is\x20not\x20active','IS_DISACTIVED','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','syncCampaigns','clockClearZombieChannels','hasOwnProperty','preview','booked','clearZombieChannels','setMessage','dialPreviewAutoRecallMe','clearZombieChannel','enqueue','isNil','actions','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','ListId','status','channel','updateOriginated','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','[action]','size','agentReadyId','length','getDiff','voicePause','run','then','logger2','[RecallMe]','catch','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','loggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','connect','acw','custom:agentConnectPreview','buildAcw','complete','total','answered','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','BUSY','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','countbusyretry','dialBusyRetryFrequency','unlockAgent','activeContact','NOANSWER','countnoanswerretry','NoAnswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','custom:amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','uniqueid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','Contact','phone','Contact\x20is\x20undefined','lookAgent','execCall','[Preview][execCall][success]','called','Calling','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','trunks','SIP/%s','unmonitored','execRun','unlock','unlockContact','disableContact','getContactPreview','recallme','checkIsBlackList','VoiceQueueId'];(function(_0x44e00a,_0x248bbc){var _0x2bdfba=function(_0x5e66c4){while(--_0x5e66c4){_0x44e00a['push'](_0x44e00a['shift']());}};_0x2bdfba(++_0x248bbc);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x551c85,_0x1d0227){_0x551c85=_0x551c85-0x0;var _0x1960cc=_0x4d9e[_0x551c85];return _0x1960cc;};'use strict';var util=require(_0xe4d9('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0xe4d9('0x1'));var moment=require('moment');var md5=require(_0xe4d9('0x2'));var Redis=require('ioredis');var config=require(_0xe4d9('0x3'));var logger=require(_0xe4d9('0x4'))('preview');var loggerAction=require(_0xe4d9('0x4'))(_0xe4d9('0x5'));var ami=require(_0xe4d9('0x6'));var rpcDb=require(_0xe4d9('0x7'));var Action=require(_0xe4d9('0x8'));var ut=require(_0xe4d9('0x9'));config['redis']=_[_0xe4d9('0xa')](config[_0xe4d9('0xb')],{'host':_0xe4d9('0xc'),'port':0x18eb});var io=require(_0xe4d9('0xd'))(new Redis(config[_0xe4d9('0xb')]));var Sequence=function(){};Sequence[_0xe4d9('0xe')]['enqueue']=function(_0x1127e5){this[_0xe4d9('0xf')]=this[_0xe4d9('0xf')]?this[_0xe4d9('0xf')][_0xe4d9('0x10')](_0x1127e5):_0x1127e5();};function Preview(_0x3d1e0e){this[_0xe4d9('0x11')]=new Sequence();this['campaignsPreview']=_0x3d1e0e['voiceQueues'];this['trunks']=_0x3d1e0e['trunks'];this['actions']={};this['agents']=_0x3d1e0e['agents'];this['clockClearZombieChannels']=0x0;ami['on'](_0xe4d9('0x12'),this[_0xe4d9('0x13')][_0xe4d9('0x14')](this));ami['on']('hangup',this[_0xe4d9('0x15')][_0xe4d9('0x14')](this));ami['on'](_0xe4d9('0x16'),this[_0xe4d9('0x17')]['bind'](this));ami['on'](_0xe4d9('0x18'),this[_0xe4d9('0x19')][_0xe4d9('0x14')](this));ami['on']('newexten',this['syncNewExten'][_0xe4d9('0x14')](this));ami['on'](_0xe4d9('0x1a'),this['syncVarSet'][_0xe4d9('0x14')](this));ami['on']('attendedtransfer',this[_0xe4d9('0x1b')][_0xe4d9('0x14')](this));ami['on'](_0xe4d9('0x1c'),this[_0xe4d9('0x1d')]['bind'](this));this[_0xe4d9('0x1e')](this[_0xe4d9('0x1f')]);}function emit(_0x151220,_0x171224,_0x2c6b89){io['to'](_0x151220)[_0xe4d9('0x20')](_0x171224,_0x2c6b89);}function emitCampaignPreview(_0x30d923){if(_0x30d923[_0xe4d9('0x21')]===_0xe4d9('0x22')){var _0x4fed7f={'id':_0x30d923['id'],'name':_0x30d923[_0xe4d9('0x23')],'strategy':_0x30d923[_0xe4d9('0x24')],'answered':_0x30d923['answered'],'available':_0x30d923[_0xe4d9('0x25')],'loggedIn':_0x30d923['loggedIn'],'pTalking':_0x30d923[_0xe4d9('0x26')],'sumBillable':_0x30d923[_0xe4d9('0x27')],'sumDuration':_0x30d923['sumDuration'],'sumHoldTime':_0x30d923[_0xe4d9('0x28')]||0x0,'talking':_0x30d923[_0xe4d9('0x29')],'total':_0x30d923['total'],'type':_0x30d923[_0xe4d9('0x21')],'unmanaged':_0x30d923[_0xe4d9('0x2a')],'abandoned':_0x30d923[_0xe4d9('0x2b')],'waiting':_0x30d923['waiting'],'loggedInDb':_0x30d923['loggedInDb'],'dialActive':_0x30d923[_0xe4d9('0x2c')],'dialMethod':_0x30d923[_0xe4d9('0x2d')],'dialOriginateCallerIdName':_0x30d923['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x30d923['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x30d923['dialOriginateTimeout'],'dialPrefix':_0x30d923['dialPrefix'],'outboundAnswerAgiCallsDay':_0x30d923[_0xe4d9('0x2e')],'outboundAnswerCallsDay':_0x30d923['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x30d923[_0xe4d9('0x2f')],'outboundBusyCallsDay':_0x30d923[_0xe4d9('0x30')],'outboundCongestionCallsDay':_0x30d923[_0xe4d9('0x31')],'outboundDropCallsDayACS':_0x30d923['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x30d923[_0xe4d9('0x32')],'outboundDropCallsDayTimeout':_0x30d923[_0xe4d9('0x33')],'outboundNoAnswerCallsDay':_0x30d923[_0xe4d9('0x34')],'outboundNoSuchCallsDay':_0x30d923[_0xe4d9('0x35')],'outboundOriginateFailureCallsDay':_0x30d923[_0xe4d9('0x36')],'outboundReCallsDay':_0x30d923[_0xe4d9('0x37')],'outboundRejectCallsDay':_0x30d923[_0xe4d9('0x38')],'outboundUnknownCallsDay':_0x30d923[_0xe4d9('0x39')],'outboundAbandonedCallsDay':_0x30d923[_0xe4d9('0x3a')],'predictiveIntervalAnsweredCalls':_0x30d923[_0xe4d9('0x3b')],'predictiveIntervalAvgHoldtime':_0x30d923[_0xe4d9('0x3c')],'predictiveIntervalAvgTalktime':_0x30d923[_0xe4d9('0x3d')],'predictiveIntervalDroppedCallsCallersExit':_0x30d923['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x30d923[_0xe4d9('0x3e')],'predictiveIntervalErlangCalls':_0x30d923[_0xe4d9('0x3f')],'predictiveIntervalErlangCallsDroppedCalls':_0x30d923[_0xe4d9('0x40')],'predictiveIntervalHitRate':_0x30d923[_0xe4d9('0x41')],'predictiveIntervalMultiplicativeFactor':_0x30d923[_0xe4d9('0x42')],'predictiveIntervalPauses':_0x30d923[_0xe4d9('0x43')],'predictiveIntervalAvailable':_0x30d923['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x30d923['predictiveIntervalTotalCalls'],'message':_0x30d923['message'],'originated':_0x30d923[_0xe4d9('0x44')],'erlangCalls':_0x30d923[_0xe4d9('0x45')],'erlangCallToSecond':_0x30d923[_0xe4d9('0x46')],'erlangAbandonmentRate':_0x30d923['erlangAbandonmentRate'],'erlangBusyFactor':_0x30d923['erlangBusyFactor'],'startPredictive':_0x30d923['startPredictive'],'startProgressive':_0x30d923['startProgressive']};if(_0x30d923[_0xe4d9('0x47')]){_0x4fed7f[_0xe4d9('0x47')]={'id':_0x30d923['Trunk']['id'],'name':_0x30d923[_0xe4d9('0x47')][_0xe4d9('0x23')],'active':_0x30d923['Trunk'][_0xe4d9('0x48')],'callerid':_0x30d923[_0xe4d9('0x47')][_0xe4d9('0x49')]};}if(_0x30d923[_0xe4d9('0x4a')]){_0x4fed7f[_0xe4d9('0x4a')]={'id':_0x30d923[_0xe4d9('0x4a')]['id'],'name':_0x30d923[_0xe4d9('0x4a')][_0xe4d9('0x23')]};}var _0x3fd26a=md5(JSON[_0xe4d9('0x4b')](_0x4fed7f));if(_0x30d923[_0xe4d9('0x2')]!==_0x3fd26a){_0x30d923[_0xe4d9('0x2')]=_0x3fd26a;emit(util[_0xe4d9('0x4c')](_0xe4d9('0x4d'),_0x4fed7f['name']),_0xe4d9('0x4e'),_0x4fed7f);}}}function emitVoiceQueueChannelRemove(_0x20aef6){logger[_0xe4d9('0x4f')](_0xe4d9('0x50'),JSON[_0xe4d9('0x4b')](_0x20aef6));emit(util[_0xe4d9('0x4c')](_0xe4d9('0x4d'),_0x20aef6[_0xe4d9('0x23')]),_0xe4d9('0x51'),_0x20aef6);io['emit']('voice_queue_presence:remove',_0x20aef6);}function notSendMessagesQueue(_0x5f5bc5){if(_0x5f5bc5[_0xe4d9('0x52')]){if(_0x5f5bc5[_0xe4d9('0x44')]===0x0&&_0x5f5bc5[_0xe4d9('0x26')]===0x0){_0x5f5bc5[_0xe4d9('0x52')]=![];_0x5f5bc5[_0xe4d9('0x25')]=0x0;_0x5f5bc5[_0xe4d9('0x53')]=0x0;_0x5f5bc5[_0xe4d9('0x54')]='NOT_ACTIVE';ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x5f5bc5[_0xe4d9('0x23')]+_0xe4d9('0x55'));}else{_0x5f5bc5['message']=_0xe4d9('0x56');ut[_0xe4d9('0x57')](_0xe4d9('0x58'),_0x5f5bc5[_0xe4d9('0x23')]+'\x20is\x20disactive');}emitCampaignPreview(_0x5f5bc5);}}Preview[_0xe4d9('0xe')][_0xe4d9('0x1e')]=function(){var _0x2afa91=this;setInterval(function(){_0x2afa91[_0xe4d9('0x59')]();},0x7cf);};Preview[_0xe4d9('0xe')][_0xe4d9('0x59')]=function(){var _0x25b1f0=this[_0xe4d9('0x1f')];this[_0xe4d9('0x5a')]+=0x1;for(var _0x288c86 in _0x25b1f0){if(_0x25b1f0[_0xe4d9('0x5b')](_0x288c86)&&(_0x25b1f0[_0x288c86]['dialMethod']===_0xe4d9('0x5c')||_0x25b1f0[_0x288c86][_0xe4d9('0x2d')]===_0xe4d9('0x5d'))&&_0x25b1f0[_0x288c86][_0xe4d9('0x21')]===_0xe4d9('0x22')){if(this['clockClearZombieChannels']>0x7){this[_0xe4d9('0x5a')]=0x0;this[_0xe4d9('0x5e')]();}}if(_0x25b1f0[_0xe4d9('0x5b')](_0x288c86)&&_0x25b1f0[_0x288c86][_0xe4d9('0x2d')]===_0xe4d9('0x5c')&&_0x25b1f0[_0x288c86][_0xe4d9('0x21')]===_0xe4d9('0x22')){if(_0x25b1f0[_0x288c86][_0xe4d9('0x2c')]){this[_0xe4d9('0x5f')](_0x25b1f0[_0x288c86]);if(_0x25b1f0[_0x288c86][_0xe4d9('0x60')])this['recallMe'](_0x25b1f0[_0x288c86]);}else{notSendMessagesQueue(_0x25b1f0[_0x288c86]);}}}};Preview[_0xe4d9('0xe')][_0xe4d9('0x61')]=function(_0x96ead7){var _0x54bf07=this;this[_0xe4d9('0x11')][_0xe4d9('0x62')](function(){if(!_[_0xe4d9('0x63')](_0x54bf07[_0xe4d9('0x64')][_0x96ead7])){loggerAction[_0xe4d9('0x4f')](_0xe4d9('0x65'),_0x96ead7,_0xe4d9('0x66'),_0x54bf07['actions'][_0x96ead7][_0xe4d9('0x67')],_0xe4d9('0x68'),JSON[_0xe4d9('0x4b')](_0x54bf07[_0xe4d9('0x1f')][_0x54bf07[_0xe4d9('0x64')][_0x96ead7][_0xe4d9('0x67')]]['originated']),_0xe4d9('0x69'),JSON[_0xe4d9('0x4b')](_0x54bf07[_0xe4d9('0x1f')][_0x54bf07[_0xe4d9('0x64')][_0x96ead7][_0xe4d9('0x67')]][_0xe4d9('0x26')]),JSON['stringify'](_0x54bf07[_0xe4d9('0x64')][_0x96ead7][_0xe4d9('0x6a')]),JSON['stringify'](_[_0xe4d9('0x6b')](_0x54bf07['actions'][_0x96ead7],[_0xe4d9('0x6c'),_0xe4d9('0x6d'),'VoiceQueueId',_0xe4d9('0x6e')])));return ami['Action']({'action':_0xe4d9('0x6f'),'channel':_0x54bf07[_0xe4d9('0x64')][_0x96ead7][_0xe4d9('0x70')]})['catch'](function(_0x39634c){if(_0x39634c[_0xe4d9('0x54')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x54bf07[_0xe4d9('0x64')][_0x96ead7]){ut[_0xe4d9('0x71')](_0x54bf07[_0xe4d9('0x1f')][_0x54bf07[_0xe4d9('0x64')][_0x96ead7]['queue']],'[clearZombieChannel]');if(_0x54bf07[_0xe4d9('0x64')][_0x96ead7][_0xe4d9('0x6a')]===!![]){ut[_0xe4d9('0x72')](_0x54bf07[_0xe4d9('0x1f')][_0x54bf07[_0xe4d9('0x64')][_0x96ead7][_0xe4d9('0x67')]],'[clearZombieChannel]');ut['loggerError'](_0xe4d9('0x73')+_0x96ead7,_0x54bf07[_0xe4d9('0x64')][_0x96ead7][_0xe4d9('0x67')]);}ut[_0xe4d9('0x74')](_0xe4d9('0x75')+_0x96ead7,_0x54bf07[_0xe4d9('0x64')][_0x96ead7]['queue']);delete _0x54bf07[_0xe4d9('0x64')][_0x96ead7];}},0x2328);}});}});};Preview[_0xe4d9('0xe')][_0xe4d9('0x5e')]=function(){var _0x48f452=this;loggerAction[_0xe4d9('0x4f')](_0xe4d9('0x76'),_[_0xe4d9('0x77')](this['actions']));for(var _0x1f7c11 in this['actions']){if(_0x48f452[_0xe4d9('0x64')][_0xe4d9('0x5b')](_0x1f7c11)){_0x48f452[_0xe4d9('0x61')](_0x1f7c11);}}};Preview['prototype']['recallMe']=function(_0x5bd06b){var _0x3b70c5=this;rpcDb['getContactRecallMe'](_0x5bd06b['id'],ut[_0xe4d9('0x78')](this['agents']))['then'](function(_0x3c2196){if(!_[_0xe4d9('0x63')](_0x3c2196)){for(var _0x467c29=0x0;_0x467c29<_0x3c2196[_0xe4d9('0x79')];_0x467c29+=0x1){if(ut[_0xe4d9('0x7a')](_0x3c2196[_0x467c29]['scheduledat'])<_0x5bd06b['dialRecallMeTimeout']*0x3c){if(_0x3c2196[_0x467c29]['Agent']&&!_0x3c2196[_0x467c29]['Agent'][_0xe4d9('0x7b')]){_0x3b70c5[_0xe4d9('0x7c')](_0x3c2196[_0x467c29]['id'])[_0xe4d9('0x7d')](ut[_0xe4d9('0x7e')](_0xe4d9('0x7f')))[_0xe4d9('0x80')](ut[_0xe4d9('0x7e')]('[RecallMe]'));}else{rpcDb['disableContact'](_0x3c2196[_0x467c29]['id']);}}else{var _0x7d1fb9=new Action(_0x3c2196[_0x467c29],_0x5bd06b);_0x7d1fb9[_0xe4d9('0x81')]=moment()[_0xe4d9('0x4c')](_0xe4d9('0x82'));_0x5bd06b[_0xe4d9('0x37')]+=0x1;ut[_0xe4d9('0x83')](_0x7d1fb9,0x17,_0xe4d9('0x84'));if(_0x5bd06b[_0xe4d9('0x85')]){rpcDb[_0xe4d9('0x86')](ut[_0xe4d9('0x87')](_0x3c2196[_0x467c29]));rpcDb[_0xe4d9('0x88')](_0x7d1fb9,_0xe4d9('0x89'));}else{ut['logCustomer'](_0x7d1fb9,0x16,_0xe4d9('0x8a'));rpcDb[_0xe4d9('0x88')](_0x7d1fb9,_0xe4d9('0x8b'));rpcDb[_0xe4d9('0x8c')](_0x7d1fb9,'[HistoryRecallClose]');}}}}})['catch'](ut['logger2'](_0xe4d9('0x8d')));};Preview[_0xe4d9('0xe')][_0xe4d9('0x5f')]=function(_0x43b750){_0x43b750['sendMessageOneNotActive']=!![];if(ut['IsNotLoggedIn'](_0x43b750[_0xe4d9('0x8e')])){_0x43b750[_0xe4d9('0x54')]=_0xe4d9('0x8f');}else if(!ut[_0xe4d9('0x90')](_0x43b750[_0xe4d9('0x2c')])){_0x43b750[_0xe4d9('0x54')]='NOT_ACTIVE';}else if(!this[_0xe4d9('0x91')](_0x43b750['Trunk'])){if(!this[_0xe4d9('0x91')](_0x43b750[_0xe4d9('0x92')])){_0x43b750['message']=_0xe4d9('0x93');}else{_0x43b750[_0xe4d9('0x54')]='ACTIVE';}}else{_0x43b750[_0xe4d9('0x54')]=_0xe4d9('0x94');}emitCampaignPreview(_0x43b750);};Preview[_0xe4d9('0xe')][_0xe4d9('0x95')]=function(_0x3a7ff2,_0x1e61a3,_0x4ec908){var _0x489439=this;var _0x3473ad=this['actions'][_0x1e61a3];var _0x10ef01=this['campaignsPreview'][_0x3473ad['queue']];var _0x2f6f7b;if(_0x10ef01){switch(_0x4ec908){case'1':_0x10ef01[_0xe4d9('0x35')]+=0x1;_0x3473ad[_0xe4d9('0x96')]+=0x1;_0x3473ad['countglobal']=ut[_0xe4d9('0x97')](_0x3473ad);ut['logCustomer'](_0x3473ad,0x0,_0xe4d9('0x98'));ami[_0xe4d9('0x20')](_0xe4d9('0x99'),ut[_0xe4d9('0x9a')](_0x3473ad,'nosuchnumber'));rpcDb[_0xe4d9('0x88')](_0x3473ad,_0xe4d9('0x9b'));if(ut[_0xe4d9('0x97')](_0x3473ad)>=_0x10ef01[_0xe4d9('0x9c')]){_0x2f6f7b=ut[_0xe4d9('0x9d')](_0x3473ad,0xf,_0xe4d9('0x9e'));rpcDb[_0xe4d9('0x8c')](_0x2f6f7b,_0xe4d9('0x9f'));}else{if(_0x3473ad[_0xe4d9('0x96')]>=_0x10ef01['dialNoSuchNumberMaxRetry']){rpcDb[_0xe4d9('0x8c')](_0x3473ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0xe4d9('0xa0')](ut[_0xe4d9('0xa1')](_0x3473ad,_0xe4d9('0x96'),_0x10ef01[_0xe4d9('0xa2')]),_0x3473ad['unlockAgent'],_0x3473ad['activeContact']);}}delete this[_0xe4d9('0x64')][_0x3a7ff2[_0xe4d9('0xa3')]];break;case _0xe4d9('0xa4'):var _0x40efe3=moment()[_0xe4d9('0x4c')](_0xe4d9('0x82'));_0x3473ad[_0xe4d9('0xa5')]=_0x40efe3;_0x3473ad[_0xe4d9('0xa6')]=_0x40efe3;_0x3473ad[_0xe4d9('0x6a')]=!![];_0x10ef01['pTalking']+=0x1;logger[_0xe4d9('0x4f')](_0xe4d9('0xa7'),_0x3473ad['uniqueid'],_0xe4d9('0xa8'),_0x10ef01[_0xe4d9('0x23')],_0xe4d9('0x69'),_0x10ef01[_0xe4d9('0x26')]);ami[_0xe4d9('0x20')]('custom:agentconnect',ut[_0xe4d9('0x9a')](_0x3473ad,_0xe4d9('0xa9'),this[_0xe4d9('0x1f')][_0x3473ad[_0xe4d9('0x67')]]));if(_0x10ef01[_0xe4d9('0xaa')]){ami[_0xe4d9('0x20')](_0xe4d9('0xab'),ut[_0xe4d9('0xac')](_0x3473ad));}break;case'16':ami[_0xe4d9('0x20')]('custom:agentcomplete',ut[_0xe4d9('0x9a')](_0x3473ad,'complete',this[_0xe4d9('0x1f')][_0x3473ad[_0xe4d9('0x67')]]));emitVoiceQueueChannelRemove(ut[_0xe4d9('0x9a')](_0x3473ad,_0xe4d9('0xad')));_0x10ef01['outboundAnswerCallsDay']+=0x1;_0x10ef01[_0xe4d9('0xae')]+=0x1;_0x10ef01[_0xe4d9('0xaf')]+=0x1;ut['decrementTalkink'](_0x10ef01,_0xe4d9('0xb0'));_0x3473ad[_0xe4d9('0xb1')]=ut['totalGlobal'](_0x3473ad);ut[_0xe4d9('0x83')](_0x3473ad,0x4,_0xe4d9('0xb2'));rpcDb[_0xe4d9('0x88')](_0x3473ad,_0xe4d9('0xb3'));rpcDb[_0xe4d9('0x8c')](_0x3473ad,_0xe4d9('0xb4'));rpcDb[_0xe4d9('0xb5')](_0x3473ad);_0x10ef01[_0xe4d9('0xb6')]+=_0x3473ad[_0xe4d9('0xb7')];_0x10ef01['sumBillable']+=_0x3473ad[_0xe4d9('0xb7')];logger['info'](_0xe4d9('0xb8'),_0x3473ad['uniqueid'],_0xe4d9('0xa8'),_0x10ef01[_0xe4d9('0x23')],_0xe4d9('0x69'),_0x10ef01[_0xe4d9('0x26')]);delete this[_0xe4d9('0x64')][_0x3a7ff2[_0xe4d9('0xa3')]];break;case _0xe4d9('0xb9'):_0x10ef01[_0xe4d9('0x30')]+=0x1;_0x3473ad['countbusyretry']+=0x1;_0x3473ad[_0xe4d9('0xb1')]=ut[_0xe4d9('0x97')](_0x3473ad);ut[_0xe4d9('0x83')](_0x3473ad,0x5,_0xe4d9('0xba'));ami[_0xe4d9('0x20')](_0xe4d9('0xbb'),ut[_0xe4d9('0x9a')](_0x3473ad,_0xe4d9('0xbc')));rpcDb[_0xe4d9('0x88')](_0x3473ad,_0xe4d9('0xbd'));if(ut[_0xe4d9('0x97')](_0x3473ad)>=_0x10ef01[_0xe4d9('0x9c')]){_0x2f6f7b=ut[_0xe4d9('0x9d')](_0x3473ad,0xf,'Global');rpcDb[_0xe4d9('0x8c')](_0x2f6f7b,_0xe4d9('0xbe'));}else{if(_0x3473ad['countbusyretry']>=_0x10ef01[_0xe4d9('0xbf')]){rpcDb[_0xe4d9('0x8c')](_0x3473ad,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xe4d9('0xa0')](ut[_0xe4d9('0xa1')](_0x3473ad,_0xe4d9('0xc0'),_0x10ef01[_0xe4d9('0xc1')]),_0x3473ad[_0xe4d9('0xc2')],_0x3473ad[_0xe4d9('0xc3')]);}}break;case _0xe4d9('0xc4'):_0x10ef01[_0xe4d9('0x34')]+=0x1;_0x3473ad[_0xe4d9('0xc5')]+=0x1;_0x3473ad[_0xe4d9('0xb1')]=ut[_0xe4d9('0x97')](_0x3473ad);ut[_0xe4d9('0x83')](_0x3473ad,0x3,_0xe4d9('0xc6'));ami['emit']('custom:agentnoanswer',ut['buildObj'](_0x3473ad,_0xe4d9('0xc7')));rpcDb[_0xe4d9('0x88')](_0x3473ad,'[callProgressDetectingCustomer][logNoAnswer]');if(ut['totalGlobal'](_0x3473ad)>=_0x10ef01[_0xe4d9('0x9c')]){_0x2f6f7b=ut['cloneAction'](_0x3473ad,0xf,_0xe4d9('0x9e'));rpcDb['createCustomerFinal'](_0x2f6f7b,_0xe4d9('0xc8'));}else{if(_0x3473ad[_0xe4d9('0xc5')]>=_0x10ef01['dialNoAnswerMaxRetry']){rpcDb[_0xe4d9('0x8c')](_0x3473ad,_0xe4d9('0xc9'));}else{rpcDb[_0xe4d9('0xa0')](ut['scheduledAt'](_0x3473ad,_0xe4d9('0xc5'),_0x10ef01[_0xe4d9('0xca')]),_0x3473ad[_0xe4d9('0xc2')],_0x3473ad[_0xe4d9('0xc3')]);}}break;case _0xe4d9('0xcb'):_0x10ef01[_0xe4d9('0x31')]+=0x1;_0x3473ad[_0xe4d9('0xcc')]+=0x1;_0x3473ad[_0xe4d9('0xb1')]=ut[_0xe4d9('0x97')](_0x3473ad);ut[_0xe4d9('0x83')](_0x3473ad,0x8,_0xe4d9('0xcd'));ami[_0xe4d9('0x20')](_0xe4d9('0xce'),ut[_0xe4d9('0x9a')](_0x3473ad,_0xe4d9('0xcf')));rpcDb[_0xe4d9('0x88')](_0x3473ad,_0xe4d9('0xd0'));if(ut[_0xe4d9('0x97')](_0x3473ad)>=_0x10ef01[_0xe4d9('0x9c')]){_0x2f6f7b=ut[_0xe4d9('0x9d')](_0x3473ad,0xf,_0xe4d9('0x9e'));rpcDb[_0xe4d9('0x8c')](_0x2f6f7b,_0xe4d9('0xd1'));}else{if(_0x3473ad[_0xe4d9('0xcc')]>=_0x10ef01['dialCongestionMaxRetry']){rpcDb[_0xe4d9('0x8c')](_0x3473ad,_0xe4d9('0xd0'));}else{rpcDb[_0xe4d9('0xa0')](ut[_0xe4d9('0xa1')](_0x3473ad,_0xe4d9('0xcc'),_0x10ef01['dialBusyRetryFrequency']),_0x3473ad[_0xe4d9('0xc2')],_0x3473ad['activeContact']);}}break;case _0xe4d9('0xd2'):_0x10ef01[_0xe4d9('0x38')]+=0x1;_0x3473ad[_0xe4d9('0xd3')]+=0x1;_0x3473ad[_0xe4d9('0xb1')]=ut[_0xe4d9('0x97')](_0x3473ad);ut['logCustomer'](_0x3473ad,0x14,_0xe4d9('0xd4'));ami[_0xe4d9('0x20')](_0xe4d9('0xd5'),ut[_0xe4d9('0x9a')](_0x3473ad,'agentreject'));rpcDb['createCustomerHistory'](_0x3473ad,_0xe4d9('0xd6'));if(ut[_0xe4d9('0x97')](_0x3473ad)>=_0x10ef01['dialGlobalMaxRetry']){_0x2f6f7b=ut[_0xe4d9('0x9d')](_0x3473ad,0x14,_0xe4d9('0xd4'));rpcDb[_0xe4d9('0x8c')](_0x2f6f7b,_0xe4d9('0xd7'));}else{if(_0x3473ad[_0xe4d9('0xd3')]>=_0x10ef01[_0xe4d9('0xd8')]){rpcDb[_0xe4d9('0x8c')](_0x3473ad,_0xe4d9('0xd7'));}else{rpcDb[_0xe4d9('0xa0')](ut[_0xe4d9('0xa1')](_0x3473ad,_0xe4d9('0xd3'),_0x10ef01['dialAgentRejectRetryFrequency']),_0x3473ad[_0xe4d9('0xc2')],_0x3473ad['activeContact']);}}break;case'ABANDONED':_0x10ef01['outboundAbandonedCallsDay']+=0x1;_0x3473ad[_0xe4d9('0xd9')]+=0x1;_0x3473ad[_0xe4d9('0xb1')]=ut[_0xe4d9('0x97')](_0x3473ad);ut[_0xe4d9('0x83')](_0x3473ad,0xb,_0xe4d9('0xda'));rpcDb[_0xe4d9('0x88')](_0x3473ad,_0xe4d9('0xdb'));if(ut['totalGlobal'](_0x3473ad)>=_0x10ef01[_0xe4d9('0x9c')]){_0x2f6f7b=ut[_0xe4d9('0x9d')](_0x3473ad,0xf,_0xe4d9('0x9e'));rpcDb[_0xe4d9('0x8c')](_0x2f6f7b,_0xe4d9('0xdb'));}else{if(_0x3473ad['countabandonedetry']>=_0x10ef01[_0xe4d9('0xdc')]){rpcDb[_0xe4d9('0x8c')](_0x3473ad,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xe4d9('0xa0')](ut[_0xe4d9('0xa1')](_0x3473ad,_0xe4d9('0xd9'),_0x10ef01[_0xe4d9('0xdd')]),_0x3473ad['unlockAgent'],_0x3473ad[_0xe4d9('0xc3')]);}}break;case'18':_0x10ef01['outboundUnknownCallsDay']+=0x1;_0x3473ad[_0xe4d9('0xde')]+=0x1;_0x3473ad[_0xe4d9('0xb1')]=ut[_0xe4d9('0x97')](_0x3473ad);ut[_0xe4d9('0x83')](_0x3473ad,0x12,_0x3a7ff2[_0xe4d9('0xdf')]||_0x3a7ff2[_0xe4d9('0xe0')]);ami[_0xe4d9('0x20')]('custom:amd',ut['buildObj'](_0x3473ad,_0xe4d9('0xe1')));rpcDb[_0xe4d9('0x88')](_0x3473ad,_0xe4d9('0xe2'));if(ut[_0xe4d9('0x97')](_0x3473ad)>=_0x10ef01['dialGlobalMaxRetry']){_0x2f6f7b=ut['cloneAction'](_0x3473ad,0xf,'Global');rpcDb[_0xe4d9('0x8c')](_0x2f6f7b,_0xe4d9('0xe2'));}else{rpcDb[_0xe4d9('0x8c')](_0x3473ad,_0xe4d9('0xe2'));}delete this[_0xe4d9('0x64')][_0x3a7ff2[_0xe4d9('0xa3')]];break;case'19':_0x10ef01[_0xe4d9('0x39')]+=0x1;_0x3473ad[_0xe4d9('0xb1')]=ut['totalGlobal'](_0x3473ad);ut[_0xe4d9('0x83')](_0x3473ad,0x13,_0x3a7ff2[_0xe4d9('0xdf')]||_0x3a7ff2['dialstatus']);ami['emit'](_0xe4d9('0xe3'),ut[_0xe4d9('0x9a')](_0x3473ad,_0xe4d9('0xe1')));rpcDb[_0xe4d9('0x88')](_0x3473ad,'[callProgressDetectingCustomer][machine]');if(ut[_0xe4d9('0x97')](_0x3473ad)>=_0x10ef01[_0xe4d9('0x9c')]){_0x2f6f7b=ut['cloneAction'](_0x3473ad,0xf,_0xe4d9('0x9e'));rpcDb['createCustomerFinal'](_0x2f6f7b,_0xe4d9('0xe4'));}else{rpcDb['createCustomerFinal'](_0x3473ad,_0xe4d9('0xe4'));}delete this['actions'][_0x3a7ff2[_0xe4d9('0xa3')]];break;default:if(_0x3473ad[_0xe4d9('0x6a')]){ut[_0xe4d9('0x72')](_0x10ef01,_0xe4d9('0xe5'));ut[_0xe4d9('0x74')](_0xe4d9('0xe6')+_0x10ef01[_0xe4d9('0x23')],_0x3a7ff2);}_0x10ef01[_0xe4d9('0x39')]+=0x1;_0x3473ad['countglobal']=ut[_0xe4d9('0x97')](_0x3473ad);ut['logCustomer'](_0x3473ad,0xc,_0x3a7ff2[_0xe4d9('0xdf')]||_0x3a7ff2[_0xe4d9('0xe0')]);rpcDb[_0xe4d9('0x88')](_0x3473ad,_0xe4d9('0xe7'));if(ut[_0xe4d9('0x97')](_0x3473ad)>=_0x10ef01[_0xe4d9('0x9c')]){_0x2f6f7b=ut['cloneAction'](_0x3473ad,0xf,_0xe4d9('0x9e'));rpcDb[_0xe4d9('0x8c')](_0x2f6f7b,_0xe4d9('0xe8'));}else{rpcDb[_0xe4d9('0x8c')](_0x3473ad,_0xe4d9('0xe8'));}delete this[_0xe4d9('0x64')][_0x3a7ff2[_0xe4d9('0xa3')]];}if(!(_0x3473ad[_0xe4d9('0x6a')]&&_0x4ec908==='16')){ut[_0xe4d9('0x71')](_0x10ef01,'[callProgressDetectingCustomer]');logger['info'](_0xe4d9('0xe9'),_0x3473ad[_0xe4d9('0xea')],_0xe4d9('0xa8'),_0x10ef01[_0xe4d9('0x23')],'originated:\x20',_0x10ef01[_0xe4d9('0x44')]);}if(_0x4ec908!=='ANSWER'){delete this[_0xe4d9('0x64')][_0x3a7ff2[_0xe4d9('0xa3')]];delete this['actions'][_0x3a7ff2['destlinkedid']];}}};Preview[_0xe4d9('0xe')][_0xe4d9('0xeb')]=function(_0x34d518,_0x771610,_0x42370d){if(_[_0xe4d9('0xec')](_0x771610)&&_0xe4d9('0xed')!==typeof _0x771610){return;}if(_[_0xe4d9('0xec')](_0x42370d)&&'object'!==typeof _0x42370d){return;}switch(_0x42370d[_0xe4d9('0xee')]){case'0':ut[_0xe4d9('0xef')](_0x34d518,0x0,_0xe4d9('0x98'));rpcDb['createAgentHistory'](_0x34d518,_0xe4d9('0xf0'));break;case'3':ut[_0xe4d9('0xef')](_0x34d518,0x3,'NoAnswer');rpcDb[_0xe4d9('0xf1')](_0x34d518,_0xe4d9('0xf2'));break;case'5':ut[_0xe4d9('0xef')](_0x34d518,0x5,_0xe4d9('0xba'));rpcDb[_0xe4d9('0xf1')](_0x34d518,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0xe4d9('0xef')](_0x34d518,0x8,'Congestion');rpcDb['createAgentHistory'](_0x34d518,_0xe4d9('0xf3'));break;case'22':ut[_0xe4d9('0xef')](_0x34d518,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0x34d518,_0xe4d9('0xf4'));break;default:ut[_0xe4d9('0xef')](_0x34d518,0xc,_0x42370d[_0xe4d9('0xee')]);rpcDb[_0xe4d9('0xf1')](_0x34d518,_0xe4d9('0xf3'));}ut[_0xe4d9('0x71')](_0x771610,_0xe4d9('0xf5'));logger[_0xe4d9('0x4f')](_0xe4d9('0xf6'),_0x34d518['uniqueid'],_0xe4d9('0xa8'),_0x771610['name'],'originated:\x20',_0x771610[_0xe4d9('0x44')]);delete this[_0xe4d9('0x64')][_0x34d518['uniqueid']];};Preview['prototype']['checkInBlack']=function(_0x294f63,_0x4f0e79,_0x2941d3,_0x4c8cd1,_0x40e057){var _0x1eb004=this;return new BPromise(function(_0x3f363d,_0xaf558e){if(_['isNil'](_0x4f0e79)||_[_0xe4d9('0x63')](_0x4f0e79[_0xe4d9('0xf7')])||_[_0xe4d9('0x63')](_0x4f0e79[_0xe4d9('0xf7')][_0xe4d9('0xf8')])||_['isNil'](_0x4f0e79['VoiceQueueId'])){_0xaf558e(ut[_0xe4d9('0x54')](_0xe4d9('0xf9'),_0x4c8cd1,_0x40e057));return;}var _0xefcf63=uuid['v4']();var _0xa5ddf3=_0x1eb004[_0xe4d9('0x1f')][_0x4f0e79[_0xe4d9('0x66')]['name']];var _0x1e76e9=_0x2941d3?_0x1eb004['agents'][_0x2941d3]['id']:undefined;_0x1eb004['actions'][_0xefcf63]=new Action(_0x4f0e79,_0xa5ddf3,_0xefcf63,_0x2941d3,_0x1e76e9);var _0x1fbcad=_0x1eb004[_0xe4d9('0x64')][_0xefcf63];_0x1fbcad[_0xe4d9('0xc2')]=_0x4c8cd1;_0x1fbcad[_0xe4d9('0xc3')]=_0x40e057;_0x1fbcad[_0xe4d9('0xfa')]=_0x2941d3;if(_['isEmpty'](_0x294f63)){_0x1eb004[_0xe4d9('0xfb')](_0x1fbcad,_0xa5ddf3,_0x4f0e79,_0x2941d3)['then'](function(_0x401970){logger[_0xe4d9('0x4f')](_0xe4d9('0xfc'),'Queue:\x20'+_0x1fbcad[_0xe4d9('0x67')]+'\x20IdHopper:\x20'+_0x1fbcad['idContact'],JSON[_0xe4d9('0x4b')](_0x401970));ami[_0xe4d9('0x20')]('custom:agentcalled',ut['buildObj'](_0x1fbcad,_0xe4d9('0xfd'),_0x1eb004[_0xe4d9('0x1f')][_0x1fbcad[_0xe4d9('0x67')]]));_0x3f363d(ut[_0xe4d9('0x54')](_0xe4d9('0xfe')));})[_0xe4d9('0x80')](function(_0x42447e){ut['logger']('[Preview][execCall][failure]',_0x42447e);_0xaf558e(ut[_0xe4d9('0x54')](_0xe4d9('0xff'),_0x4c8cd1,_0x40e057));});}else{_0xa5ddf3[_0xe4d9('0x2f')]+=0x1;ut[_0xe4d9('0x100')](_0x1fbcad);rpcDb['createHistory'](_0x1fbcad,_0xe4d9('0x101'));delete _0x1eb004[_0xe4d9('0x64')][_0xefcf63];_0xaf558e(ut[_0xe4d9('0x54')](_0xe4d9('0x102'),_0x4c8cd1,_0x40e057));}});};Preview[_0xe4d9('0xe')][_0xe4d9('0x91')]=function(_0x10f7eb){return!_[_0xe4d9('0x63')](_0x10f7eb)&&!_[_0xe4d9('0x63')](_0x10f7eb[_0xe4d9('0x23')])&&!_['isNil'](_0x10f7eb[_0xe4d9('0x48')])&&_0x10f7eb[_0xe4d9('0x48')]&&!_[_0xe4d9('0x63')](this[_0xe4d9('0x103')][util[_0xe4d9('0x4c')](_0xe4d9('0x104'),_0x10f7eb[_0xe4d9('0x23')])])&&!_[_0xe4d9('0x63')](this[_0xe4d9('0x103')][util['format'](_0xe4d9('0x104'),_0x10f7eb[_0xe4d9('0x23')])][_0xe4d9('0x6f')])&&(this['trunks'][util[_0xe4d9('0x4c')]('SIP/%s',_0x10f7eb[_0xe4d9('0x23')])]['status']==='reachable'||this['trunks'][util[_0xe4d9('0x4c')]('SIP/%s',_0x10f7eb['name'])][_0xe4d9('0x6f')]===_0xe4d9('0x105'));};Preview[_0xe4d9('0xe')]['run']=function(_0x1286cd,_0x2c52ee){var _0x2bf586=this;return new BPromise(function(_0x50c2b6,_0x2a35ad){_0x2bf586[_0xe4d9('0x106')](_0x1286cd,_0x2c52ee)[_0xe4d9('0x7d')](function(_0x3cd481){_0x50c2b6(_['pick'](_0x3cd481,[_0xe4d9('0x54')]));})[_0xe4d9('0x80')](function(_0x4bcdac){if(_0x4bcdac[_0xe4d9('0x107')]){rpcDb[_0xe4d9('0x108')](_0x1286cd);}if(_0x4bcdac[_0xe4d9('0x48')]){rpcDb[_0xe4d9('0x109')](_0x1286cd);}_0x2a35ad(_[_0xe4d9('0x6b')](_0x4bcdac,[_0xe4d9('0x54')]));});});};Preview[_0xe4d9('0xe')][_0xe4d9('0x106')]=function(_0x50d0ef,_0x1d1b63){var _0x71fe70=this;return new BPromise(function(_0x15945a,_0x3c2a9e){var _0x7f62c6,_0x39f82f;rpcDb[_0xe4d9('0x10a')](_0x50d0ef)[_0xe4d9('0x7d')](function(_0x36584b){if(!_[_0xe4d9('0x63')](_0x36584b[0x0])){_0x39f82f=_0x36584b[0x0]['recallme']?![]:!![];_0x7f62c6=_0x36584b[0x0][_0xe4d9('0x10b')]?!![]:![];_0x7f62c6=_0x1d1b63?!![]:_0x7f62c6;}var _0x1b08a6=_0x71fe70['validateContact'](_0x36584b);if(_0x1b08a6['isValid']){rpcDb[_0xe4d9('0x10c')](_[_0xe4d9('0x6b')](_0x36584b[0x0],[_0xe4d9('0x10d'),'Contact.phone']))[_0xe4d9('0x7d')](function(_0x3cbf6b){_0x71fe70['checkInBlack'](_0x3cbf6b,_0x36584b[0x0],_0x1d1b63,_0x39f82f,_0x7f62c6)[_0xe4d9('0x7d')](function(_0x368ed6){_0x15945a(_0x368ed6);})[_0xe4d9('0x80')](function(_0xcfc051){_0x3c2a9e(_0xcfc051);});})['catch'](function(_0xccaa05){ut['logger']('[Preview][checkIsBlackList]',_0xccaa05);_0x3c2a9e(ut[_0xe4d9('0x54')](_0xe4d9('0x10e'),_0x39f82f,_0x7f62c6));});}else{_0x3c2a9e(ut['message'](_0x1b08a6[_0xe4d9('0x54')],_0x39f82f,_0x7f62c6));}})['catch'](function(_0x41ae10){ut['logger'](_0xe4d9('0x10f'),_0x41ae10);_0x3c2a9e(ut[_0xe4d9('0x54')](_0xe4d9('0x10e'),![],!![]));});});};Preview['prototype'][_0xe4d9('0x110')]=function(_0x55d72b){if(_[_0xe4d9('0x63')](_0x55d72b)||_[_0xe4d9('0x111')](_0x55d72b)||!_['isNil'](_0x55d72b[0x0][_0xe4d9('0x112')])&&_['isNil'](_0x55d72b[0x0][_0xe4d9('0x112')][_0xe4d9('0x23')])){ut[_0xe4d9('0x57')](_0xe4d9('0x113'),_0x55d72b);return{'isValid':![],'message':_0xe4d9('0x114')};}var _0x299319=this[_0xe4d9('0x1f')][_0x55d72b[0x0][_0xe4d9('0x66')][_0xe4d9('0x23')]];_0x299319[_0xe4d9('0x54')]=_0xe4d9('0x94');if(_[_0xe4d9('0x63')](_0x299319)){ut[_0xe4d9('0x57')](_0xe4d9('0x115'),_0x299319);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0xe4d9('0x91')](_0x299319[_0xe4d9('0x47')])){ut[_0xe4d9('0x57')](_0xe4d9('0x116'),_0xe4d9('0x117')+_0x299319[_0xe4d9('0x23')]+_0xe4d9('0x118'));if(!this['isTrunkReachable'](_0x299319[_0xe4d9('0x92')])){ut[_0xe4d9('0x57')](_0xe4d9('0x116'),_0x299319['name']+_0xe4d9('0x119'));return{'isValid':![],'message':_0xe4d9('0x11a')};}}if(!ut[_0xe4d9('0x90')](_0x299319[_0xe4d9('0x2c')])){ut[_0xe4d9('0x57')](_0xe4d9('0x11b'),_0x299319[_0xe4d9('0x23')]+_0xe4d9('0x11c'));return{'isValid':![],'message':_0xe4d9('0x117')+_0x299319[_0xe4d9('0x23')]+_0xe4d9('0x11c')};}return{'isValid':!![],'message':_0xe4d9('0x11d')};};Preview[_0xe4d9('0xe')][_0xe4d9('0xfb')]=function(_0x3fee53,_0x3284a8,_0x32373c,_0x4be41c){var _0x155627=this;return new BPromise(function(_0x4b3aef,_0x33384d){var _0x48d83a=_0x3fee53['uniqueid'];var _0x382c0e=_0x155627['isTrunkReachable'](_0x3284a8[_0xe4d9('0x47')])?util[_0xe4d9('0x4c')](_0xe4d9('0x11e'),_0x3284a8[_0xe4d9('0x47')][_0xe4d9('0x23')],_[_0xe4d9('0x63')](_0x3284a8[_0xe4d9('0x11f')])?'':_0x3284a8['dialPrefix'][_0xe4d9('0x120')]()||'',_0x3284a8[_0xe4d9('0x121')]>0x0?_0x32373c['Contact']['phone']['substring'](_0x3284a8[_0xe4d9('0x121')]):_0x32373c[_0xe4d9('0xf7')]['phone']):util[_0xe4d9('0x4c')](_0xe4d9('0x11e'),_[_0xe4d9('0x63')](_0x3284a8[_0xe4d9('0x92')])?_0x3284a8[_0xe4d9('0x47')][_0xe4d9('0x23')]:_0x3284a8[_0xe4d9('0x92')][_0xe4d9('0x23')],_['isNil'](_0x3284a8[_0xe4d9('0x11f')])?'':_0x3284a8[_0xe4d9('0x11f')][_0xe4d9('0x120')]()||'',_0x3284a8[_0xe4d9('0x121')]>0x0?_0x32373c[_0xe4d9('0xf7')]['phone'][_0xe4d9('0x122')](_0x3284a8[_0xe4d9('0x121')]):_0x32373c['Contact'][_0xe4d9('0xf8')]);var _0x491241=_0x155627[_0xe4d9('0x91')](_0x3284a8[_0xe4d9('0x47')])?ut[_0xe4d9('0x123')](_0x3284a8[_0xe4d9('0x47')][_0xe4d9('0x49')],_0x3284a8[_0xe4d9('0x124')],_0x3284a8[_0xe4d9('0x125')]>0x0?ut[_0xe4d9('0x126')](_0x3284a8[_0xe4d9('0x127')],_0x3284a8[_0xe4d9('0x125')]):_0x3284a8[_0xe4d9('0x127')]):ut[_0xe4d9('0x123')](_['isNil'](_0x3284a8[_0xe4d9('0x92')])?_0x3284a8[_0xe4d9('0x47')][_0xe4d9('0x49')]:_0x3284a8[_0xe4d9('0x92')][_0xe4d9('0x49')],_0x3284a8[_0xe4d9('0x124')],_0x3284a8[_0xe4d9('0x125')]>0x0?ut[_0xe4d9('0x126')](_0x3284a8[_0xe4d9('0x127')],_0x3284a8[_0xe4d9('0x125')]):_0x3284a8[_0xe4d9('0x127')]);if(_0x491241){_0x3fee53[_0xe4d9('0x128')]=ut[_0xe4d9('0x129')](_0x491241);_0x3fee53[_0xe4d9('0x12a')]=ut['extractCalleridNumber'](_0x491241);}var _0x2a84c9=ut[_0xe4d9('0x12b')](_0x3284a8,_0x32373c,_0x382c0e,_0x491241,_0x48d83a,_0x3fee53);_[_0xe4d9('0x12c')](_0x3fee53,ut[_0xe4d9('0x12d')](_0x2a84c9));_0x3fee53[_0xe4d9('0x81')]=moment()[_0xe4d9('0x4c')](_0xe4d9('0x82'));ami[_0xe4d9('0x12e')](ut['variablesAction'](_0x3fee53,_0x3284a8,_0x2a84c9,_0x3fee53['activeContact'],_0x4be41c))[_0xe4d9('0x7d')](function(_0x53268d){_0x3284a8['originated']+=0x1;logger[_0xe4d9('0x4f')](_0xe4d9('0x12f'),_0x48d83a,_0xe4d9('0xa8'),_0x3284a8['name'],'originated:\x20',_0x3284a8[_0xe4d9('0x44')]);_0x4b3aef(_0x53268d);})[_0xe4d9('0x80')](function(_0x10a54a){ut['logAgent'](_0x3fee53,0xe,_0xe4d9('0x130'));rpcDb[_0xe4d9('0xf1')](_0x3fee53,_0xe4d9('0x131'));_0x33384d(_0x10a54a);});});};Preview['prototype'][_0xe4d9('0x132')]=function(_0x483ce1){if(this[_0xe4d9('0x64')][_0x483ce1[_0xe4d9('0xa3')]]){this[_0xe4d9('0x64')][_0x483ce1[_0xe4d9('0xa3')]][_0xe4d9('0x70')]=_0x483ce1['channel'];}};Preview[_0xe4d9('0xe')]['syncOriginateResponse']=function(_0x3e0a91){var _0x40d369=this;var _0x4e1165=this['actions'][_0x3e0a91[_0xe4d9('0x133')]];if(_0x4e1165){if(_0x4e1165['lookAgent']&&this[_0xe4d9('0x134')][_0x4e1165[_0xe4d9('0xfa')]]){ut[_0xe4d9('0x135')](_0x4e1165,this[_0xe4d9('0x134')][_0x4e1165[_0xe4d9('0xfa')]][_0xe4d9('0x23')],this['agents'][_0x4e1165[_0xe4d9('0xfa')]]['id']);}var _0x55da19=_[_0xe4d9('0x136')](_0x4e1165);_0x55da19[_0xe4d9('0xa5')]=moment()[_0xe4d9('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1fec40=_0x40d369[_0xe4d9('0x1f')][_0x4e1165[_0xe4d9('0x67')]];if(ut['isFailure'](_0x3e0a91[_0xe4d9('0x137')])){if(_0x4e1165[_0xe4d9('0xc2')]){rpcDb[_0xe4d9('0x108')](_0x4e1165[_0xe4d9('0x138')]);}if(_0x4e1165[_0xe4d9('0xc3')]){rpcDb[_0xe4d9('0x109')](_0x4e1165[_0xe4d9('0x138')]);}ami[_0xe4d9('0x20')](_0xe4d9('0x139'),ut[_0xe4d9('0x9a')](_0x4e1165,_0xe4d9('0x13a'),this[_0xe4d9('0x1f')][_0x4e1165[_0xe4d9('0x67')]]));this[_0xe4d9('0xeb')](_0x55da19,_0x1fec40,_0x3e0a91);}else{_0x4e1165[_0xe4d9('0x81')]=moment()[_0xe4d9('0x4c')](_0xe4d9('0x82'));ut[_0xe4d9('0xef')](_0x55da19,0x4,'Answer');rpcDb[_0xe4d9('0xf1')](_0x55da19,'[callProgressDetectingAgent][logAnswer]');}}};Preview['prototype']['syncHangup']=function(_0x31ac36){var _0xfc782f=this;var _0x3b56b1=this[_0xe4d9('0x64')][_0x31ac36[_0xe4d9('0xa3')]];var _0x809f73;if(_0x3b56b1){_0x809f73=this[_0xe4d9('0x1f')][_0x3b56b1[_0xe4d9('0x67')]];logger[_0xe4d9('0x4f')]('[syncHangup][talking]',_0x31ac36['linkedid'],'\x20Queue',_0x809f73[_0xe4d9('0x23')],'pTalking:\x20',_0x809f73[_0xe4d9('0x26')]);}if(this['actions'][_0x31ac36[_0xe4d9('0xa3')]]&&_0x31ac36[_0xe4d9('0xa3')]!==_0x31ac36['uniqueid']){if(_0x31ac36['cause']==='16'&&this['actions'][_0x31ac36['linkedid']][_0xe4d9('0x6a')]){this['callProgressDetectingCustomer'](_0x31ac36,_0x31ac36[_0xe4d9('0xa3')],_0x31ac36[_0xe4d9('0x13b')]);}else if(this['actions'][_0x31ac36[_0xe4d9('0xa3')]][_0xe4d9('0x6a')]){logger['info']('[syncHangup][talking][cause]',_0x31ac36['linkedid'],_0x31ac36[_0xe4d9('0x13b')],_0xe4d9('0xa8'),_0x809f73[_0xe4d9('0x23')],_0xe4d9('0x69'),_0x809f73[_0xe4d9('0x26')]);this[_0xe4d9('0x95')](_0x31ac36,_0x31ac36[_0xe4d9('0xa3')],_0x31ac36[_0xe4d9('0x13b')]);}}else if(_0x3b56b1&&_[_0xe4d9('0x63')](_0x3b56b1[_0xe4d9('0x13c')])&&_0x809f73['dialQueueProject']&&_0x31ac36[_0xe4d9('0xa3')]===_0x31ac36['uniqueid']&&_[_0xe4d9('0x63')](_0x31ac36[_0xe4d9('0xee')])&&_0x31ac36[_0xe4d9('0x13b')]==='16'&&_0x31ac36[_0xe4d9('0x13d')]==='6'&&_[_0xe4d9('0xec')](_0x3b56b1[_0xe4d9('0x13e')])){if(_0x3b56b1[_0xe4d9('0xc2')]){rpcDb[_0xe4d9('0x108')](_0x3b56b1[_0xe4d9('0x138')]);}if(_0x3b56b1[_0xe4d9('0xc3')]){rpcDb['disableContact'](_0x3b56b1[_0xe4d9('0x138')]);}_0x31ac36[_0xe4d9('0xee')]='22';this['callProgressDetectingAgent'](_0x3b56b1,_0x809f73,_0x31ac36);}else if(_0x3b56b1&&_0x3b56b1['transfer']){if(_0x31ac36['cause']==='16'&&this[_0xe4d9('0x64')][_0x31ac36[_0xe4d9('0xa3')]]['dialAnswer']){logger[_0xe4d9('0x4f')](_0xe4d9('0x13f'),_0x31ac36[_0xe4d9('0xa3')],_0x31ac36[_0xe4d9('0x13b')],_0xe4d9('0xa8'),_0x809f73[_0xe4d9('0x23')],_0xe4d9('0x69'),_0x809f73['pTalking']);this[_0xe4d9('0x95')](_0x31ac36,_0x31ac36[_0xe4d9('0xa3')],_0x31ac36[_0xe4d9('0x13b')]);}else if(this['actions'][_0x31ac36['linkedid']]['dialAnswer']){logger[_0xe4d9('0x4f')](_0xe4d9('0x140'),_0x31ac36[_0xe4d9('0xa3')],_0x31ac36[_0xe4d9('0x13b')],_0xe4d9('0xa8'),_0x809f73[_0xe4d9('0x23')],'pTalking:\x20',_0x809f73[_0xe4d9('0x26')]);this['callProgressDetectingCustomer'](_0x31ac36,_0x31ac36[_0xe4d9('0xa3')],_0x31ac36[_0xe4d9('0x13b')]);}}};Preview[_0xe4d9('0xe')]['syncDialEnd']=function(_0x2236e6){if(this[_0xe4d9('0x64')][_0x2236e6[_0xe4d9('0x141')]]&&_0x2236e6['destlinkedid']!==_0x2236e6[_0xe4d9('0x142')]){this[_0xe4d9('0x95')](_0x2236e6,_0x2236e6['destlinkedid'],_0x2236e6['dialstatus']);}};Preview[_0xe4d9('0xe')][_0xe4d9('0x17')]=function(_0x3f679b){if(this[_0xe4d9('0x64')][_0x3f679b[_0xe4d9('0xa3')]]&&_0x3f679b[_0xe4d9('0xa3')]!==_0x3f679b['uniqueid']&&!this[_0xe4d9('0x64')][_0x3f679b[_0xe4d9('0xa3')]][_0xe4d9('0x6a')]){if(_0x3f679b['cause']==='1'){this['callProgressDetectingCustomer'](_0x3f679b,_0x3f679b['linkedid'],_0x3f679b[_0xe4d9('0x13b')]);}}};Preview['prototype'][_0xe4d9('0x143')]=function(_0x46f323,_0xb0237c,_0x106bca){if(this['actions'][_0x46f323]){if(_['isNil'](this[_0xe4d9('0x64')][_0x46f323][_0xe4d9('0x144')])){this[_0xe4d9('0x64')][_0x46f323][_0xe4d9('0x144')]={};}this['actions'][_0x46f323][_0xe4d9('0x144')][_0xb0237c]=_0x106bca;}};Preview[_0xe4d9('0xe')][_0xe4d9('0x145')]=function(_0x317d71){try{if(!_[_0xe4d9('0x63')](_0x317d71)){if(ut[_0xe4d9('0x146')](_[_0xe4d9('0x147')](_0x317d71[_0xe4d9('0x148')])[0x0])){this[_0xe4d9('0x143')](_0x317d71[_0xe4d9('0xea')],_[_0xe4d9('0x147')](_0x317d71[_0xe4d9('0x148')])[0x0],_0x317d71[_0xe4d9('0x149')]);}}}catch(_0x2f4a9d){logger['error'](_0xe4d9('0x14a'),util['inspect'](_0x2f4a9d,{'showHidden':![],'depth':null}));}};Preview[_0xe4d9('0xe')][_0xe4d9('0x1b')]=function(_0x13c95e){if(_0x13c95e){if(this[_0xe4d9('0x64')][_0x13c95e[_0xe4d9('0x14b')]]){this[_0xe4d9('0x64')][_0x13c95e[_0xe4d9('0x14b')]][_0xe4d9('0x13e')]=!![];}}};Preview[_0xe4d9('0xe')]['syncBlindTransfer']=function(_0x1c2eb0){if(_0x1c2eb0){if(this['actions'][_0x1c2eb0[_0xe4d9('0x14c')]]){this[_0xe4d9('0x64')][_0x1c2eb0[_0xe4d9('0x14c')]][_0xe4d9('0x13e')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x3e74=['toLowerVariables','YYYY-MM-DD\x20HH:mm:ss','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','isFailure','response','unlockContact','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','filterKey','keys','variable','value','transfertargetlinkedid','transfererlinkedid','exports','util','bluebird','uuid','moment','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./util/util','redis','defaults','localhost','tail','sequence','voiceQueues','trunks','actions','clockClearZombieChannels','originateresponse','syncOriginateResponse','syncHangup','bind','hanguprequest','syncHangupRequest','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','emit','type','outbound','name','strategy','answered','loggedIn','sumDuration','sumHoldTime','total','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','erlangCalls','startPredictive','startProgressive','Trunk','Interval','stringify','md5','format','voice:queue:%s','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','sendMessageOneNotActive','pTalking','available','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','prototype','syncCampaigns','hasOwnProperty','booked','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','enqueue','isNil','queue','originated:\x20','dialAnswer','contactId','UserId','VoiceQueueId','Action','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','disableContact','starttime','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','AGENTS_NOT_LOGGED','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','decrementTalkink','[16]','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumBillable','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','dialBusyRetryFrequency','NOANSWER','NoAnswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','CONGESTION','outboundCongestionCallsDay','countcongestionretry','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','countagentrejectretry','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','destlinkedid','isUndefined','object','reason','logAgent','NoSuchNumber','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','Contact','Queue','agents','lookAgent','isEmpty','execCall','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','run','execRun','unlock','pick','getContactPreview','recallme','Contact.phone','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','validateContact','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','phone','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','merge'];(function(_0x35b70f,_0x29492d){var _0x4fdd28=function(_0x38e91e){while(--_0x38e91e){_0x35b70f['push'](_0x35b70f['shift']());}};_0x4fdd28(++_0x29492d);}(_0x3e74,0x175));var _0x43e7=function(_0x1ed7d1,_0x1579da){_0x1ed7d1=_0x1ed7d1-0x0;var _0x492642=_0x3e74[_0x1ed7d1];return _0x492642;};'use strict';var util=require(_0x43e7('0x0'));var _=require('lodash');var BPromise=require(_0x43e7('0x1'));var uuid=require(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x43e7('0x4'));var logger=require('../../../config/logger')(_0x43e7('0x5'));var loggerAction=require(_0x43e7('0x6'))(_0x43e7('0x7'));var ami=require(_0x43e7('0x8'));var rpcDb=require(_0x43e7('0x9'));var Action=require('./action');var ut=require(_0x43e7('0xa'));config[_0x43e7('0xb')]=_[_0x43e7('0xc')](config[_0x43e7('0xb')],{'host':_0x43e7('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x43e7('0xb')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x39c8bd){this[_0x43e7('0xe')]=this['tail']?this[_0x43e7('0xe')]['finally'](_0x39c8bd):_0x39c8bd();};function Preview(_0xf7c520){this[_0x43e7('0xf')]=new Sequence();this['campaignsPreview']=_0xf7c520[_0x43e7('0x10')];this[_0x43e7('0x11')]=_0xf7c520[_0x43e7('0x11')];this[_0x43e7('0x12')]={};this['agents']=_0xf7c520['agents'];this[_0x43e7('0x13')]=0x0;ami['on'](_0x43e7('0x14'),this[_0x43e7('0x15')]['bind'](this));ami['on']('hangup',this[_0x43e7('0x16')][_0x43e7('0x17')](this));ami['on'](_0x43e7('0x18'),this[_0x43e7('0x19')]['bind'](this));ami['on']('dialend',this[_0x43e7('0x1a')][_0x43e7('0x17')](this));ami['on'](_0x43e7('0x1b'),this['syncNewExten']['bind'](this));ami['on'](_0x43e7('0x1c'),this[_0x43e7('0x1d')][_0x43e7('0x17')](this));ami['on'](_0x43e7('0x1e'),this[_0x43e7('0x1f')][_0x43e7('0x17')](this));ami['on'](_0x43e7('0x20'),this[_0x43e7('0x21')][_0x43e7('0x17')](this));this[_0x43e7('0x22')](this[_0x43e7('0x23')]);}function emit(_0x177ee1,_0x4b5d64,_0xef1a5a){io['to'](_0x177ee1)[_0x43e7('0x24')](_0x4b5d64,_0xef1a5a);}function emitCampaignPreview(_0x4b386b){if(_0x4b386b[_0x43e7('0x25')]===_0x43e7('0x26')){var _0x3945bb={'id':_0x4b386b['id'],'name':_0x4b386b[_0x43e7('0x27')],'strategy':_0x4b386b[_0x43e7('0x28')],'answered':_0x4b386b[_0x43e7('0x29')],'available':_0x4b386b['available'],'loggedIn':_0x4b386b[_0x43e7('0x2a')],'pTalking':_0x4b386b['pTalking'],'sumBillable':_0x4b386b['sumBillable'],'sumDuration':_0x4b386b[_0x43e7('0x2b')],'sumHoldTime':_0x4b386b[_0x43e7('0x2c')]||0x0,'talking':_0x4b386b['talking'],'total':_0x4b386b[_0x43e7('0x2d')],'type':_0x4b386b['type'],'unmanaged':_0x4b386b[_0x43e7('0x2e')],'abandoned':_0x4b386b['abandoned'],'waiting':_0x4b386b[_0x43e7('0x2f')],'loggedInDb':_0x4b386b[_0x43e7('0x30')],'dialActive':_0x4b386b[_0x43e7('0x31')],'dialMethod':_0x4b386b[_0x43e7('0x32')],'dialOriginateCallerIdName':_0x4b386b['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x4b386b['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x4b386b[_0x43e7('0x33')],'dialPrefix':_0x4b386b['dialPrefix'],'outboundAnswerAgiCallsDay':_0x4b386b[_0x43e7('0x34')],'outboundAnswerCallsDay':_0x4b386b[_0x43e7('0x35')],'outboundBlacklistCallsDay':_0x4b386b[_0x43e7('0x36')],'outboundBusyCallsDay':_0x4b386b[_0x43e7('0x37')],'outboundCongestionCallsDay':_0x4b386b['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x4b386b[_0x43e7('0x38')],'outboundDropCallsDayCallersExit':_0x4b386b[_0x43e7('0x39')],'outboundDropCallsDayTimeout':_0x4b386b[_0x43e7('0x3a')],'outboundNoAnswerCallsDay':_0x4b386b[_0x43e7('0x3b')],'outboundNoSuchCallsDay':_0x4b386b[_0x43e7('0x3c')],'outboundOriginateFailureCallsDay':_0x4b386b[_0x43e7('0x3d')],'outboundReCallsDay':_0x4b386b[_0x43e7('0x3e')],'outboundRejectCallsDay':_0x4b386b[_0x43e7('0x3f')],'outboundUnknownCallsDay':_0x4b386b[_0x43e7('0x40')],'outboundAbandonedCallsDay':_0x4b386b[_0x43e7('0x41')],'predictiveIntervalAnsweredCalls':_0x4b386b[_0x43e7('0x42')],'predictiveIntervalAvgHoldtime':_0x4b386b[_0x43e7('0x43')],'predictiveIntervalAvgTalktime':_0x4b386b[_0x43e7('0x44')],'predictiveIntervalDroppedCallsCallersExit':_0x4b386b[_0x43e7('0x45')],'predictiveIntervalDroppedCallsTimeout':_0x4b386b['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x4b386b[_0x43e7('0x46')],'predictiveIntervalErlangCallsDroppedCalls':_0x4b386b[_0x43e7('0x47')],'predictiveIntervalHitRate':_0x4b386b[_0x43e7('0x48')],'predictiveIntervalMultiplicativeFactor':_0x4b386b[_0x43e7('0x49')],'predictiveIntervalPauses':_0x4b386b[_0x43e7('0x4a')],'predictiveIntervalAvailable':_0x4b386b['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x4b386b[_0x43e7('0x4b')],'message':_0x4b386b[_0x43e7('0x4c')],'originated':_0x4b386b[_0x43e7('0x4d')],'erlangCalls':_0x4b386b[_0x43e7('0x4e')],'erlangCallToSecond':_0x4b386b['erlangCallToSecond'],'erlangAbandonmentRate':_0x4b386b['erlangAbandonmentRate'],'erlangBusyFactor':_0x4b386b['erlangBusyFactor'],'startPredictive':_0x4b386b[_0x43e7('0x4f')],'startProgressive':_0x4b386b[_0x43e7('0x50')]};if(_0x4b386b[_0x43e7('0x51')]){_0x3945bb[_0x43e7('0x51')]={'id':_0x4b386b[_0x43e7('0x51')]['id'],'name':_0x4b386b[_0x43e7('0x51')]['name'],'active':_0x4b386b['Trunk']['active'],'callerid':_0x4b386b['Trunk']['callerid']};}if(_0x4b386b['Interval']){_0x3945bb['Interval']={'id':_0x4b386b[_0x43e7('0x52')]['id'],'name':_0x4b386b['Interval'][_0x43e7('0x27')]};}var _0x8e9f40=md5(JSON[_0x43e7('0x53')](_0x3945bb));if(_0x4b386b[_0x43e7('0x54')]!==_0x8e9f40){_0x4b386b[_0x43e7('0x54')]=_0x8e9f40;emit(util[_0x43e7('0x55')](_0x43e7('0x56'),_0x3945bb['name']),'voice_queue:save',_0x3945bb);}}}function emitVoiceQueueChannelRemove(_0x5d84f4){logger[_0x43e7('0x57')](_0x43e7('0x58'),JSON[_0x43e7('0x53')](_0x5d84f4));emit(util[_0x43e7('0x55')](_0x43e7('0x56'),_0x5d84f4[_0x43e7('0x27')]),_0x43e7('0x59'),_0x5d84f4);io[_0x43e7('0x24')]('voice_queue_presence:remove',_0x5d84f4);}function notSendMessagesQueue(_0x61ed8e){if(_0x61ed8e[_0x43e7('0x5a')]){if(_0x61ed8e['originated']===0x0&&_0x61ed8e[_0x43e7('0x5b')]===0x0){_0x61ed8e['sendMessageOneNotActive']=![];_0x61ed8e[_0x43e7('0x5c')]=0x0;_0x61ed8e[_0x43e7('0x5d')]=0x0;_0x61ed8e[_0x43e7('0x4c')]=_0x43e7('0x5e');ut[_0x43e7('0x5f')](_0x43e7('0x60'),_0x61ed8e['name']+'\x20is\x20not\x20active');}else{_0x61ed8e[_0x43e7('0x4c')]=_0x43e7('0x61');ut[_0x43e7('0x5f')](_0x43e7('0x60'),_0x61ed8e[_0x43e7('0x27')]+'\x20is\x20disactive');}emitCampaignPreview(_0x61ed8e);}}Preview[_0x43e7('0x62')][_0x43e7('0x22')]=function(){var _0x575439=this;setInterval(function(){_0x575439[_0x43e7('0x63')]();},0x7cf);};Preview['prototype'][_0x43e7('0x63')]=function(){var _0x504101=this[_0x43e7('0x23')];this[_0x43e7('0x13')]+=0x1;for(var _0x3a5807 in _0x504101){if(_0x504101[_0x43e7('0x64')](_0x3a5807)&&(_0x504101[_0x3a5807]['dialMethod']==='preview'||_0x504101[_0x3a5807][_0x43e7('0x32')]===_0x43e7('0x65'))&&_0x504101[_0x3a5807][_0x43e7('0x25')]===_0x43e7('0x26')){if(this['clockClearZombieChannels']>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x504101[_0x43e7('0x64')](_0x3a5807)&&_0x504101[_0x3a5807]['dialMethod']===_0x43e7('0x5')&&_0x504101[_0x3a5807]['type']==='outbound'){if(_0x504101[_0x3a5807][_0x43e7('0x31')]){this['setMessage'](_0x504101[_0x3a5807]);if(_0x504101[_0x3a5807][_0x43e7('0x66')])this[_0x43e7('0x67')](_0x504101[_0x3a5807]);}else{notSendMessagesQueue(_0x504101[_0x3a5807]);}}}};Preview[_0x43e7('0x62')][_0x43e7('0x68')]=function(_0x4fc5e8){var _0x91f1e4=this;this[_0x43e7('0xf')][_0x43e7('0x69')](function(){if(!_[_0x43e7('0x6a')](_0x91f1e4[_0x43e7('0x12')][_0x4fc5e8])){loggerAction[_0x43e7('0x57')]('[clearZombieChannels][talking]',_0x4fc5e8,'Queue',_0x91f1e4[_0x43e7('0x12')][_0x4fc5e8][_0x43e7('0x6b')],_0x43e7('0x6c'),JSON['stringify'](_0x91f1e4['campaignsPreview'][_0x91f1e4['actions'][_0x4fc5e8][_0x43e7('0x6b')]][_0x43e7('0x4d')]),'pTalking:\x20',JSON[_0x43e7('0x53')](_0x91f1e4[_0x43e7('0x23')][_0x91f1e4[_0x43e7('0x12')][_0x4fc5e8]['queue']]['pTalking']),JSON['stringify'](_0x91f1e4['actions'][_0x4fc5e8][_0x43e7('0x6d')]),JSON[_0x43e7('0x53')](_['pick'](_0x91f1e4[_0x43e7('0x12')][_0x4fc5e8],[_0x43e7('0x6e'),_0x43e7('0x6f'),_0x43e7('0x70'),'ListId'])));return ami[_0x43e7('0x71')]({'action':'status','channel':_0x91f1e4['actions'][_0x4fc5e8][_0x43e7('0x72')]})[_0x43e7('0x73')](function(_0x22d98e){if(_0x22d98e[_0x43e7('0x4c')]===_0x43e7('0x74')){setTimeout(function(){if(_0x91f1e4[_0x43e7('0x12')][_0x4fc5e8]){ut[_0x43e7('0x75')](_0x91f1e4[_0x43e7('0x23')][_0x91f1e4[_0x43e7('0x12')][_0x4fc5e8][_0x43e7('0x6b')]],'[clearZombieChannel]');if(_0x91f1e4[_0x43e7('0x12')][_0x4fc5e8][_0x43e7('0x6d')]===!![]){ut['decrementTalkink'](_0x91f1e4[_0x43e7('0x23')][_0x91f1e4['actions'][_0x4fc5e8][_0x43e7('0x6b')]],_0x43e7('0x76'));ut[_0x43e7('0x77')](_0x43e7('0x78')+_0x4fc5e8,_0x91f1e4[_0x43e7('0x12')][_0x4fc5e8]['queue']);}ut['loggerError'](_0x43e7('0x79')+_0x4fc5e8,_0x91f1e4[_0x43e7('0x12')][_0x4fc5e8][_0x43e7('0x6b')]);delete _0x91f1e4[_0x43e7('0x12')][_0x4fc5e8];}},0x2328);}});}});};Preview[_0x43e7('0x62')][_0x43e7('0x7a')]=function(){var _0xa47464=this;loggerAction[_0x43e7('0x57')](_0x43e7('0x7b'),_[_0x43e7('0x7c')](this[_0x43e7('0x12')]));for(var _0x4ace49 in this[_0x43e7('0x12')]){if(_0xa47464[_0x43e7('0x12')]['hasOwnProperty'](_0x4ace49)){_0xa47464[_0x43e7('0x68')](_0x4ace49);}}};Preview[_0x43e7('0x62')][_0x43e7('0x67')]=function(_0x558d54){var _0x5d63c6=this;rpcDb[_0x43e7('0x7d')](_0x558d54['id'],ut[_0x43e7('0x7e')](this['agents']))[_0x43e7('0x7f')](function(_0x54506d){if(!_['isNil'](_0x54506d)){for(var _0x1fa3f6=0x0;_0x1fa3f6<_0x54506d[_0x43e7('0x80')];_0x1fa3f6+=0x1){if(ut[_0x43e7('0x81')](_0x54506d[_0x1fa3f6][_0x43e7('0x82')])<_0x558d54[_0x43e7('0x83')]*0x3c){if(_0x54506d[_0x1fa3f6]['Agent']&&!_0x54506d[_0x1fa3f6][_0x43e7('0x84')][_0x43e7('0x85')]){_0x5d63c6['run'](_0x54506d[_0x1fa3f6]['id'])[_0x43e7('0x7f')](ut[_0x43e7('0x86')](_0x43e7('0x87')))['catch'](ut['logger2']('[RecallMe]'));}else{rpcDb[_0x43e7('0x88')](_0x54506d[_0x1fa3f6]['id']);}}else{var _0x4058ce=new Action(_0x54506d[_0x1fa3f6],_0x558d54);_0x4058ce[_0x43e7('0x89')]=moment()[_0x43e7('0x55')]('YYYY-MM-DD\x20HH:mm:ss');_0x558d54['outboundReCallsDay']+=0x1;ut[_0x43e7('0x8a')](_0x4058ce,0x17,_0x43e7('0x8b'));if(_0x558d54[_0x43e7('0x8c')]){rpcDb[_0x43e7('0x8d')](ut['createBody'](_0x54506d[_0x1fa3f6]));rpcDb[_0x43e7('0x8e')](_0x4058ce,_0x43e7('0x8f'));}else{ut[_0x43e7('0x8a')](_0x4058ce,0x16,_0x43e7('0x90'));rpcDb[_0x43e7('0x8e')](_0x4058ce,_0x43e7('0x91'));rpcDb[_0x43e7('0x92')](_0x4058ce,_0x43e7('0x91'));}}}}})[_0x43e7('0x73')](ut[_0x43e7('0x86')](_0x43e7('0x93')));};Preview['prototype']['setMessage']=function(_0x2b0711){_0x2b0711['sendMessageOneNotActive']=!![];if(ut['IsNotLoggedIn'](_0x2b0711['loggedIn'])){_0x2b0711[_0x43e7('0x4c')]=_0x43e7('0x94');}else if(!ut['isActive'](_0x2b0711[_0x43e7('0x31')])){_0x2b0711[_0x43e7('0x4c')]=_0x43e7('0x5e');}else if(!this['isTrunkReachable'](_0x2b0711[_0x43e7('0x51')])){if(!this[_0x43e7('0x95')](_0x2b0711[_0x43e7('0x96')])){_0x2b0711[_0x43e7('0x4c')]=_0x43e7('0x97');}else{_0x2b0711[_0x43e7('0x4c')]=_0x43e7('0x98');}}else{_0x2b0711['message']=_0x43e7('0x98');}emitCampaignPreview(_0x2b0711);};Preview[_0x43e7('0x62')][_0x43e7('0x99')]=function(_0x549f4e,_0x56b06d,_0x30377a){var _0x5c3ad8=this;var _0x5cb26e=this[_0x43e7('0x12')][_0x56b06d];var _0x154e47=this['campaignsPreview'][_0x5cb26e[_0x43e7('0x6b')]];var _0x28b21d;if(_0x154e47){switch(_0x30377a){case'1':_0x154e47[_0x43e7('0x3c')]+=0x1;_0x5cb26e[_0x43e7('0x9a')]+=0x1;_0x5cb26e[_0x43e7('0x9b')]=ut[_0x43e7('0x9c')](_0x5cb26e);ut[_0x43e7('0x8a')](_0x5cb26e,0x0,'NoSuchNumber');ami[_0x43e7('0x24')](_0x43e7('0x9d'),ut['buildObj'](_0x5cb26e,_0x43e7('0x9e')));rpcDb['createCustomerHistory'](_0x5cb26e,_0x43e7('0x9f'));if(ut[_0x43e7('0x9c')](_0x5cb26e)>=_0x154e47[_0x43e7('0xa0')]){_0x28b21d=ut[_0x43e7('0xa1')](_0x5cb26e,0xf,'Global');rpcDb[_0x43e7('0x92')](_0x28b21d,_0x43e7('0xa2'));}else{if(_0x5cb26e[_0x43e7('0x9a')]>=_0x154e47['dialNoSuchNumberMaxRetry']){rpcDb[_0x43e7('0x92')](_0x5cb26e,_0x43e7('0xa2'));}else{rpcDb[_0x43e7('0xa3')](ut[_0x43e7('0xa4')](_0x5cb26e,_0x43e7('0x9a'),_0x154e47['dialNoSuchNumberRetryFrequency']),_0x5cb26e[_0x43e7('0xa5')],_0x5cb26e[_0x43e7('0xa6')]);}}delete this[_0x43e7('0x12')][_0x549f4e[_0x43e7('0xa7')]];break;case _0x43e7('0xa8'):var _0x8122f4=moment()[_0x43e7('0x55')]('YYYY-MM-DD\x20HH:mm:ss');_0x5cb26e['responsetime']=_0x8122f4;_0x5cb26e[_0x43e7('0xa9')]=_0x8122f4;_0x5cb26e['dialAnswer']=!![];_0x154e47['pTalking']+=0x1;logger['info'](_0x43e7('0xaa'),_0x5cb26e[_0x43e7('0xab')],_0x43e7('0xac'),_0x154e47[_0x43e7('0x27')],_0x43e7('0xad'),_0x154e47[_0x43e7('0x5b')]);ami['emit'](_0x43e7('0xae'),ut[_0x43e7('0xaf')](_0x5cb26e,_0x43e7('0xb0'),this['campaignsPreview'][_0x5cb26e[_0x43e7('0x6b')]]));if(_0x154e47[_0x43e7('0xb1')]){ami[_0x43e7('0x24')](_0x43e7('0xb2'),ut[_0x43e7('0xb3')](_0x5cb26e));}break;case'16':ami[_0x43e7('0x24')](_0x43e7('0xb4'),ut[_0x43e7('0xaf')](_0x5cb26e,'complete',this['campaignsPreview'][_0x5cb26e['queue']]));emitVoiceQueueChannelRemove(ut[_0x43e7('0xaf')](_0x5cb26e,_0x43e7('0xb5')));_0x154e47['outboundAnswerCallsDay']+=0x1;_0x154e47[_0x43e7('0x2d')]+=0x1;_0x154e47[_0x43e7('0x29')]+=0x1;ut[_0x43e7('0xb6')](_0x154e47,_0x43e7('0xb7'));_0x5cb26e['countglobal']=ut['totalGlobal'](_0x5cb26e);ut['logCustomer'](_0x5cb26e,0x4,_0x43e7('0xb8'));rpcDb[_0x43e7('0x8e')](_0x5cb26e,'[callProgressDetectingCustomer][logAnswer]');rpcDb['createCustomerFinal'](_0x5cb26e,_0x43e7('0xb9'));rpcDb[_0x43e7('0xba')](_0x5cb26e);_0x154e47[_0x43e7('0x2b')]+=_0x5cb26e['talktime'];_0x154e47[_0x43e7('0xbb')]+=_0x5cb26e[_0x43e7('0xbc')];logger[_0x43e7('0x57')](_0x43e7('0xbd'),_0x5cb26e['uniqueid'],_0x43e7('0xac'),_0x154e47['name'],_0x43e7('0xad'),_0x154e47[_0x43e7('0x5b')]);delete this[_0x43e7('0x12')][_0x549f4e[_0x43e7('0xa7')]];break;case _0x43e7('0xbe'):_0x154e47[_0x43e7('0x37')]+=0x1;_0x5cb26e[_0x43e7('0xbf')]+=0x1;_0x5cb26e['countglobal']=ut[_0x43e7('0x9c')](_0x5cb26e);ut[_0x43e7('0x8a')](_0x5cb26e,0x5,_0x43e7('0xc0'));ami[_0x43e7('0x24')]('custom:agentbusy',ut['buildObj'](_0x5cb26e,'busy'));rpcDb[_0x43e7('0x8e')](_0x5cb26e,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x43e7('0x9c')](_0x5cb26e)>=_0x154e47[_0x43e7('0xa0')]){_0x28b21d=ut[_0x43e7('0xa1')](_0x5cb26e,0xf,_0x43e7('0xc1'));rpcDb[_0x43e7('0x92')](_0x28b21d,_0x43e7('0xc2'));}else{if(_0x5cb26e[_0x43e7('0xbf')]>=_0x154e47[_0x43e7('0xc3')]){rpcDb[_0x43e7('0x92')](_0x5cb26e,_0x43e7('0xc4'));}else{rpcDb[_0x43e7('0xa3')](ut['scheduledAt'](_0x5cb26e,_0x43e7('0xbf'),_0x154e47[_0x43e7('0xc5')]),_0x5cb26e[_0x43e7('0xa5')],_0x5cb26e[_0x43e7('0xa6')]);}}break;case _0x43e7('0xc6'):_0x154e47['outboundNoAnswerCallsDay']+=0x1;_0x5cb26e['countnoanswerretry']+=0x1;_0x5cb26e[_0x43e7('0x9b')]=ut[_0x43e7('0x9c')](_0x5cb26e);ut['logCustomer'](_0x5cb26e,0x3,_0x43e7('0xc7'));ami[_0x43e7('0x24')]('custom:agentnoanswer',ut['buildObj'](_0x5cb26e,_0x43e7('0xc8')));rpcDb[_0x43e7('0x8e')](_0x5cb26e,_0x43e7('0xc9'));if(ut[_0x43e7('0x9c')](_0x5cb26e)>=_0x154e47[_0x43e7('0xa0')]){_0x28b21d=ut['cloneAction'](_0x5cb26e,0xf,'Global');rpcDb[_0x43e7('0x92')](_0x28b21d,_0x43e7('0xca'));}else{if(_0x5cb26e[_0x43e7('0xcb')]>=_0x154e47[_0x43e7('0xcc')]){rpcDb['createCustomerFinal'](_0x5cb26e,_0x43e7('0xc9'));}else{rpcDb[_0x43e7('0xa3')](ut[_0x43e7('0xa4')](_0x5cb26e,_0x43e7('0xcb'),_0x154e47['dialNoAnswerRetryFrequency']),_0x5cb26e[_0x43e7('0xa5')],_0x5cb26e[_0x43e7('0xa6')]);}}break;case _0x43e7('0xcd'):_0x154e47[_0x43e7('0xce')]+=0x1;_0x5cb26e[_0x43e7('0xcf')]+=0x1;_0x5cb26e['countglobal']=ut[_0x43e7('0x9c')](_0x5cb26e);ut[_0x43e7('0x8a')](_0x5cb26e,0x8,'Congestion');ami[_0x43e7('0x24')](_0x43e7('0xd0'),ut[_0x43e7('0xaf')](_0x5cb26e,_0x43e7('0xd1')));rpcDb['createCustomerHistory'](_0x5cb26e,_0x43e7('0xd2'));if(ut['totalGlobal'](_0x5cb26e)>=_0x154e47[_0x43e7('0xa0')]){_0x28b21d=ut[_0x43e7('0xa1')](_0x5cb26e,0xf,_0x43e7('0xc1'));rpcDb[_0x43e7('0x92')](_0x28b21d,_0x43e7('0xd3'));}else{if(_0x5cb26e[_0x43e7('0xcf')]>=_0x154e47[_0x43e7('0xd4')]){rpcDb[_0x43e7('0x92')](_0x5cb26e,_0x43e7('0xd2'));}else{rpcDb['rescheduleContact'](ut[_0x43e7('0xa4')](_0x5cb26e,_0x43e7('0xcf'),_0x154e47[_0x43e7('0xc5')]),_0x5cb26e[_0x43e7('0xa5')],_0x5cb26e['activeContact']);}}break;case'CANCEL':_0x154e47[_0x43e7('0x3f')]+=0x1;_0x5cb26e[_0x43e7('0xd5')]+=0x1;_0x5cb26e[_0x43e7('0x9b')]=ut['totalGlobal'](_0x5cb26e);ut[_0x43e7('0x8a')](_0x5cb26e,0x14,'AgentReject');ami['emit']('custom:agentreject',ut[_0x43e7('0xaf')](_0x5cb26e,'agentreject'));rpcDb[_0x43e7('0x8e')](_0x5cb26e,_0x43e7('0xd6'));if(ut[_0x43e7('0x9c')](_0x5cb26e)>=_0x154e47[_0x43e7('0xa0')]){_0x28b21d=ut[_0x43e7('0xa1')](_0x5cb26e,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x28b21d,_0x43e7('0xd7'));}else{if(_0x5cb26e[_0x43e7('0xd5')]>=_0x154e47['dialAgentRejectMaxRetry']){rpcDb[_0x43e7('0x92')](_0x5cb26e,_0x43e7('0xd7'));}else{rpcDb[_0x43e7('0xa3')](ut[_0x43e7('0xa4')](_0x5cb26e,_0x43e7('0xd5'),_0x154e47[_0x43e7('0xd8')]),_0x5cb26e[_0x43e7('0xa5')],_0x5cb26e[_0x43e7('0xa6')]);}}break;case _0x43e7('0xd9'):_0x154e47[_0x43e7('0x41')]+=0x1;_0x5cb26e[_0x43e7('0xda')]+=0x1;_0x5cb26e[_0x43e7('0x9b')]=ut[_0x43e7('0x9c')](_0x5cb26e);ut[_0x43e7('0x8a')](_0x5cb26e,0xb,_0x43e7('0xdb'));rpcDb[_0x43e7('0x8e')](_0x5cb26e,_0x43e7('0xdc'));if(ut[_0x43e7('0x9c')](_0x5cb26e)>=_0x154e47[_0x43e7('0xa0')]){_0x28b21d=ut[_0x43e7('0xa1')](_0x5cb26e,0xf,_0x43e7('0xc1'));rpcDb[_0x43e7('0x92')](_0x28b21d,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x5cb26e[_0x43e7('0xdd')]>=_0x154e47[_0x43e7('0xde')]){rpcDb[_0x43e7('0x92')](_0x5cb26e,_0x43e7('0xdc'));}else{rpcDb['rescheduleContact'](ut[_0x43e7('0xa4')](_0x5cb26e,'countabandonedretry',_0x154e47[_0x43e7('0xdf')]),_0x5cb26e[_0x43e7('0xa5')],_0x5cb26e[_0x43e7('0xa6')]);}}break;case'18':_0x154e47[_0x43e7('0x40')]+=0x1;_0x5cb26e[_0x43e7('0xe0')]+=0x1;_0x5cb26e[_0x43e7('0x9b')]=ut['totalGlobal'](_0x5cb26e);ut[_0x43e7('0x8a')](_0x5cb26e,0x12,_0x549f4e[_0x43e7('0xe1')]||_0x549f4e[_0x43e7('0xe2')]);ami[_0x43e7('0x24')](_0x43e7('0xe3'),ut['buildObj'](_0x5cb26e,'amd'));rpcDb[_0x43e7('0x8e')](_0x5cb26e,'[callProgressDetectingCustomer][hangupInAMD]');if(ut[_0x43e7('0x9c')](_0x5cb26e)>=_0x154e47[_0x43e7('0xa0')]){_0x28b21d=ut[_0x43e7('0xa1')](_0x5cb26e,0xf,_0x43e7('0xc1'));rpcDb['createCustomerFinal'](_0x28b21d,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb['createCustomerFinal'](_0x5cb26e,_0x43e7('0xe4'));}delete this['actions'][_0x549f4e['linkedid']];break;case'19':_0x154e47['outboundUnknownCallsDay']+=0x1;_0x5cb26e[_0x43e7('0x9b')]=ut[_0x43e7('0x9c')](_0x5cb26e);ut['logCustomer'](_0x5cb26e,0x13,_0x549f4e[_0x43e7('0xe1')]||_0x549f4e['dialstatus']);ami[_0x43e7('0x24')](_0x43e7('0xe3'),ut[_0x43e7('0xaf')](_0x5cb26e,_0x43e7('0xe5')));rpcDb[_0x43e7('0x8e')](_0x5cb26e,'[callProgressDetectingCustomer][machine]');if(ut[_0x43e7('0x9c')](_0x5cb26e)>=_0x154e47[_0x43e7('0xa0')]){_0x28b21d=ut[_0x43e7('0xa1')](_0x5cb26e,0xf,'Global');rpcDb['createCustomerFinal'](_0x28b21d,_0x43e7('0xe6'));}else{rpcDb[_0x43e7('0x92')](_0x5cb26e,_0x43e7('0xe6'));}delete this[_0x43e7('0x12')][_0x549f4e['linkedid']];break;default:if(_0x5cb26e[_0x43e7('0x6d')]){ut[_0x43e7('0xb6')](_0x154e47,_0x43e7('0xe7'));ut['loggerError'](_0x43e7('0xe8')+_0x154e47[_0x43e7('0x27')],_0x549f4e);}_0x154e47[_0x43e7('0x40')]+=0x1;_0x5cb26e[_0x43e7('0x9b')]=ut['totalGlobal'](_0x5cb26e);ut[_0x43e7('0x8a')](_0x5cb26e,0xc,_0x549f4e['cause-txt']||_0x549f4e[_0x43e7('0xe2')]);rpcDb[_0x43e7('0x8e')](_0x5cb26e,'[callProgressDetectingCustomer][logUnknown]');if(ut['totalGlobal'](_0x5cb26e)>=_0x154e47[_0x43e7('0xa0')]){_0x28b21d=ut[_0x43e7('0xa1')](_0x5cb26e,0xf,_0x43e7('0xc1'));rpcDb[_0x43e7('0x92')](_0x28b21d,_0x43e7('0xe9'));}else{rpcDb[_0x43e7('0x92')](_0x5cb26e,_0x43e7('0xe9'));}delete this[_0x43e7('0x12')][_0x549f4e[_0x43e7('0xa7')]];}if(!(_0x5cb26e[_0x43e7('0x6d')]&&_0x30377a==='16')){ut[_0x43e7('0x75')](_0x154e47,'[callProgressDetectingCustomer]');logger[_0x43e7('0x57')]('[originated][decrement][callProgressDetectingCustomer]',_0x5cb26e[_0x43e7('0xab')],_0x43e7('0xac'),_0x154e47[_0x43e7('0x27')],'originated:\x20',_0x154e47[_0x43e7('0x4d')]);}if(_0x30377a!==_0x43e7('0xa8')){delete this[_0x43e7('0x12')][_0x549f4e[_0x43e7('0xa7')]];delete this['actions'][_0x549f4e[_0x43e7('0xea')]];}}};Preview[_0x43e7('0x62')]['callProgressDetectingAgent']=function(_0x5192d2,_0x4b89ec,_0x124024){if(_[_0x43e7('0xeb')](_0x4b89ec)&&_0x43e7('0xec')!==typeof _0x4b89ec){return;}if(_[_0x43e7('0xeb')](_0x124024)&&_0x43e7('0xec')!==typeof _0x124024){return;}switch(_0x124024[_0x43e7('0xed')]){case'0':ut[_0x43e7('0xee')](_0x5192d2,0x0,_0x43e7('0xef'));rpcDb['createAgentHistory'](_0x5192d2,_0x43e7('0xf0'));break;case'3':ut[_0x43e7('0xee')](_0x5192d2,0x3,_0x43e7('0xc7'));rpcDb[_0x43e7('0xf1')](_0x5192d2,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut['logAgent'](_0x5192d2,0x5,_0x43e7('0xc0'));rpcDb[_0x43e7('0xf1')](_0x5192d2,_0x43e7('0xf2'));break;case'8':ut[_0x43e7('0xee')](_0x5192d2,0x8,'Congestion');rpcDb[_0x43e7('0xf1')](_0x5192d2,_0x43e7('0xf3'));break;case'22':ut[_0x43e7('0xee')](_0x5192d2,0x16,_0x43e7('0xf4'));rpcDb[_0x43e7('0xf1')](_0x5192d2,_0x43e7('0xf5'));break;default:ut['logAgent'](_0x5192d2,0xc,_0x124024[_0x43e7('0xed')]);rpcDb['createAgentHistory'](_0x5192d2,'[callProgressDetectingAgent][logCongestion]');}ut[_0x43e7('0x75')](_0x4b89ec,_0x43e7('0xf6'));logger['info']('[originated][decrement][callProgressDetectingAgent]',_0x5192d2[_0x43e7('0xab')],_0x43e7('0xac'),_0x4b89ec['name'],_0x43e7('0x6c'),_0x4b89ec[_0x43e7('0x4d')]);delete this[_0x43e7('0x12')][_0x5192d2[_0x43e7('0xab')]];};Preview['prototype']['checkInBlack']=function(_0x2a084b,_0x31354e,_0x4e477b,_0x489f77,_0x49de67){var _0x298239=this;return new BPromise(function(_0xf682ec,_0x227f7c){if(_[_0x43e7('0x6a')](_0x31354e)||_[_0x43e7('0x6a')](_0x31354e[_0x43e7('0xf7')])||_[_0x43e7('0x6a')](_0x31354e[_0x43e7('0xf7')]['phone'])||_['isNil'](_0x31354e['VoiceQueueId'])){_0x227f7c(ut[_0x43e7('0x4c')]('Contact\x20is\x20undefined',_0x489f77,_0x49de67));return;}var _0xd01836=uuid['v4']();var _0x1e132c=_0x298239[_0x43e7('0x23')][_0x31354e[_0x43e7('0xf8')][_0x43e7('0x27')]];var _0x5e87d6=_0x4e477b?_0x298239[_0x43e7('0xf9')][_0x4e477b]['id']:undefined;_0x298239[_0x43e7('0x12')][_0xd01836]=new Action(_0x31354e,_0x1e132c,_0xd01836,_0x4e477b,_0x5e87d6);var _0x190400=_0x298239[_0x43e7('0x12')][_0xd01836];_0x190400['unlockAgent']=_0x489f77;_0x190400[_0x43e7('0xa6')]=_0x49de67;_0x190400[_0x43e7('0xfa')]=_0x4e477b;if(_[_0x43e7('0xfb')](_0x2a084b)){_0x298239[_0x43e7('0xfc')](_0x190400,_0x1e132c,_0x31354e,_0x4e477b)[_0x43e7('0x7f')](function(_0x280b10){logger[_0x43e7('0x57')]('[Preview][execCall][success]',_0x43e7('0xfd')+_0x190400[_0x43e7('0x6b')]+_0x43e7('0xfe')+_0x190400[_0x43e7('0xff')],JSON[_0x43e7('0x53')](_0x280b10));ami['emit'](_0x43e7('0x100'),ut[_0x43e7('0xaf')](_0x190400,'called',_0x298239[_0x43e7('0x23')][_0x190400[_0x43e7('0x6b')]]));_0xf682ec(ut['message'](_0x43e7('0x101')));})[_0x43e7('0x73')](function(_0x110154){ut[_0x43e7('0x5f')](_0x43e7('0x102'),_0x110154);_0x227f7c(ut['message'](_0x43e7('0x103'),_0x489f77,_0x49de67));});}else{_0x1e132c[_0x43e7('0x36')]+=0x1;ut[_0x43e7('0x104')](_0x190400);rpcDb['createHistory'](_0x190400,_0x43e7('0x105'));delete _0x298239[_0x43e7('0x12')][_0xd01836];_0x227f7c(ut['message'](_0x43e7('0x106'),_0x489f77,_0x49de67));}});};Preview[_0x43e7('0x62')][_0x43e7('0x95')]=function(_0x2dc13d){return!_[_0x43e7('0x6a')](_0x2dc13d)&&!_[_0x43e7('0x6a')](_0x2dc13d['name'])&&!_[_0x43e7('0x6a')](_0x2dc13d[_0x43e7('0x107')])&&_0x2dc13d[_0x43e7('0x107')]&&!_['isNil'](this[_0x43e7('0x11')][util[_0x43e7('0x55')](_0x43e7('0x108'),_0x2dc13d[_0x43e7('0x27')])])&&!_[_0x43e7('0x6a')](this[_0x43e7('0x11')][util[_0x43e7('0x55')](_0x43e7('0x108'),_0x2dc13d[_0x43e7('0x27')])]['status'])&&(this[_0x43e7('0x11')][util[_0x43e7('0x55')](_0x43e7('0x108'),_0x2dc13d[_0x43e7('0x27')])][_0x43e7('0x109')]===_0x43e7('0x10a')||this[_0x43e7('0x11')][util[_0x43e7('0x55')]('SIP/%s',_0x2dc13d[_0x43e7('0x27')])][_0x43e7('0x109')]===_0x43e7('0x10b'));};Preview[_0x43e7('0x62')][_0x43e7('0x10c')]=function(_0x582077,_0x256b02){var _0x186e57=this;return new BPromise(function(_0x1c83cf,_0x3d05d4){_0x186e57[_0x43e7('0x10d')](_0x582077,_0x256b02)['then'](function(_0x463ecc){_0x1c83cf(_['pick'](_0x463ecc,[_0x43e7('0x4c')]));})[_0x43e7('0x73')](function(_0x1bc887){if(_0x1bc887[_0x43e7('0x10e')]){rpcDb['unlockContact'](_0x582077);}if(_0x1bc887[_0x43e7('0x107')]){rpcDb[_0x43e7('0x88')](_0x582077);}_0x3d05d4(_[_0x43e7('0x10f')](_0x1bc887,[_0x43e7('0x4c')]));});});};Preview[_0x43e7('0x62')][_0x43e7('0x10d')]=function(_0x3a6e92,_0x39b79a){var _0x16a213=this;return new BPromise(function(_0x33fb62,_0x2fbbc4){var _0x5cb92a,_0x531133;rpcDb[_0x43e7('0x110')](_0x3a6e92)['then'](function(_0x489cad){if(!_[_0x43e7('0x6a')](_0x489cad[0x0])){_0x531133=_0x489cad[0x0][_0x43e7('0x111')]?![]:!![];_0x5cb92a=_0x489cad[0x0]['recallme']?!![]:![];_0x5cb92a=_0x39b79a?!![]:_0x5cb92a;}var _0x143be2=_0x16a213['validateContact'](_0x489cad);if(_0x143be2['isValid']){rpcDb['checkIsBlackList'](_[_0x43e7('0x10f')](_0x489cad[0x0],[_0x43e7('0x70'),_0x43e7('0x112')]))[_0x43e7('0x7f')](function(_0x258451){_0x16a213[_0x43e7('0x113')](_0x258451,_0x489cad[0x0],_0x39b79a,_0x531133,_0x5cb92a)[_0x43e7('0x7f')](function(_0x2c40b7){_0x33fb62(_0x2c40b7);})[_0x43e7('0x73')](function(_0x1ea429){_0x2fbbc4(_0x1ea429);});})[_0x43e7('0x73')](function(_0x2a1218){ut[_0x43e7('0x5f')](_0x43e7('0x114'),_0x2a1218);_0x2fbbc4(ut[_0x43e7('0x4c')](_0x43e7('0x115'),_0x531133,_0x5cb92a));});}else{_0x2fbbc4(ut[_0x43e7('0x4c')](_0x143be2[_0x43e7('0x4c')],_0x531133,_0x5cb92a));}})[_0x43e7('0x73')](function(_0x3dc065){ut['logger'](_0x43e7('0x116'),_0x3dc065);_0x2fbbc4(ut[_0x43e7('0x4c')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0x43e7('0x62')][_0x43e7('0x117')]=function(_0x45a565){if(_[_0x43e7('0x6a')](_0x45a565)||_['isEmpty'](_0x45a565)||!_[_0x43e7('0x6a')](_0x45a565[0x0][_0x43e7('0x84')])&&_['isNil'](_0x45a565[0x0][_0x43e7('0x84')][_0x43e7('0x27')])){ut[_0x43e7('0x5f')]('[Preview][validateContact][Empty\x20Contact]',_0x45a565);return{'isValid':![],'message':_0x43e7('0x118')};}var _0x420fc3=this[_0x43e7('0x23')][_0x45a565[0x0][_0x43e7('0xf8')][_0x43e7('0x27')]];_0x420fc3['message']=_0x43e7('0x98');if(_[_0x43e7('0x6a')](_0x420fc3)){ut['logger'](_0x43e7('0x119'),_0x420fc3);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this['isTrunkReachable'](_0x420fc3['Trunk'])){ut['logger'](_0x43e7('0x11a'),_0x43e7('0x11b')+_0x420fc3[_0x43e7('0x27')]+_0x43e7('0x11c'));if(!this['isTrunkReachable'](_0x420fc3['TrunkBackup'])){ut[_0x43e7('0x5f')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x420fc3[_0x43e7('0x27')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x43e7('0x11d')};}}if(!ut['isActive'](_0x420fc3['dialActive'])){ut['logger']('[Preview][validateContact][Campaign\x20Active]',_0x420fc3[_0x43e7('0x27')]+_0x43e7('0x11e'));return{'isValid':![],'message':_0x43e7('0x11b')+_0x420fc3['name']+_0x43e7('0x11e')};}return{'isValid':!![],'message':_0x43e7('0x11f')};};Preview[_0x43e7('0x62')]['execCall']=function(_0x25fd39,_0xb2aca0,_0x271241,_0x265125){var _0x5bd12b=this;return new BPromise(function(_0x310b71,_0x536b7d){var _0x15ce64=_0x25fd39[_0x43e7('0xab')];var _0x3dbe9f=_0x5bd12b[_0x43e7('0x95')](_0xb2aca0[_0x43e7('0x51')])?util[_0x43e7('0x55')](_0x43e7('0x120'),_0xb2aca0['Trunk'][_0x43e7('0x27')],_[_0x43e7('0x6a')](_0xb2aca0['dialPrefix'])?'':_0xb2aca0[_0x43e7('0x121')][_0x43e7('0x122')]()||'',_0xb2aca0[_0x43e7('0x123')]>0x0?_0x271241[_0x43e7('0xf7')][_0x43e7('0x124')]['substring'](_0xb2aca0[_0x43e7('0x123')]):_0x271241['Contact'][_0x43e7('0x124')]):util['format'](_0x43e7('0x120'),_[_0x43e7('0x6a')](_0xb2aca0[_0x43e7('0x96')])?_0xb2aca0[_0x43e7('0x51')][_0x43e7('0x27')]:_0xb2aca0['TrunkBackup'][_0x43e7('0x27')],_['isNil'](_0xb2aca0[_0x43e7('0x121')])?'':_0xb2aca0[_0x43e7('0x121')][_0x43e7('0x122')]()||'',_0xb2aca0['dialCutDigit']>0x0?_0x271241[_0x43e7('0xf7')][_0x43e7('0x124')][_0x43e7('0x125')](_0xb2aca0[_0x43e7('0x123')]):_0x271241[_0x43e7('0xf7')]['phone']);var _0xc9cdd8=_0x5bd12b['isTrunkReachable'](_0xb2aca0[_0x43e7('0x51')])?ut[_0x43e7('0x126')](_0xb2aca0[_0x43e7('0x51')][_0x43e7('0x127')],_0xb2aca0[_0x43e7('0x128')],_0xb2aca0[_0x43e7('0x129')]>0x0?ut[_0x43e7('0x12a')](_0xb2aca0['dialOriginateCallerIdNumber'],_0xb2aca0[_0x43e7('0x129')]):_0xb2aca0['dialOriginateCallerIdNumber']):ut[_0x43e7('0x126')](_[_0x43e7('0x6a')](_0xb2aca0[_0x43e7('0x96')])?_0xb2aca0[_0x43e7('0x51')][_0x43e7('0x127')]:_0xb2aca0[_0x43e7('0x96')][_0x43e7('0x127')],_0xb2aca0[_0x43e7('0x128')],_0xb2aca0[_0x43e7('0x129')]>0x0?ut['getCallerIdRandom'](_0xb2aca0[_0x43e7('0x12b')],_0xb2aca0['dialRandomLastDigitCallerIdNumber']):_0xb2aca0[_0x43e7('0x12b')]);if(_0xc9cdd8){_0x25fd39[_0x43e7('0x12c')]=ut['extractCalleridName'](_0xc9cdd8);_0x25fd39[_0x43e7('0x12d')]=ut[_0x43e7('0x12e')](_0xc9cdd8);}var _0x5d9be9=ut[_0x43e7('0x12f')](_0xb2aca0,_0x271241,_0x3dbe9f,_0xc9cdd8,_0x15ce64,_0x25fd39);_[_0x43e7('0x130')](_0x25fd39,ut[_0x43e7('0x131')](_0x5d9be9));_0x25fd39[_0x43e7('0x89')]=moment()[_0x43e7('0x55')](_0x43e7('0x132'));ami[_0x43e7('0x71')](ut[_0x43e7('0x133')](_0x25fd39,_0xb2aca0,_0x5d9be9,_0x25fd39['activeContact'],_0x265125))[_0x43e7('0x7f')](function(_0x57e115){_0xb2aca0[_0x43e7('0x4d')]+=0x1;logger['info'](_0x43e7('0x134'),_0x15ce64,_0x43e7('0xac'),_0xb2aca0['name'],_0x43e7('0x6c'),_0xb2aca0[_0x43e7('0x4d')]);_0x310b71(_0x57e115);})['catch'](function(_0x25e6bd){ut[_0x43e7('0xee')](_0x25fd39,0xe,_0x43e7('0x135'));rpcDb['createAgentHistory'](_0x25fd39,_0x43e7('0x136'));_0x536b7d(_0x25e6bd);});});};Preview[_0x43e7('0x62')]['syncNewExten']=function(_0x23e0f1){if(this[_0x43e7('0x12')][_0x23e0f1[_0x43e7('0xa7')]]){this[_0x43e7('0x12')][_0x23e0f1['linkedid']]['channel']=_0x23e0f1[_0x43e7('0x72')];}};Preview[_0x43e7('0x62')][_0x43e7('0x15')]=function(_0x3aaf1a){var _0x5df124=this;var _0x1e6245=this[_0x43e7('0x12')][_0x3aaf1a[_0x43e7('0x137')]];if(_0x1e6245){if(_0x1e6245[_0x43e7('0xfa')]&&this['agents'][_0x1e6245[_0x43e7('0xfa')]]){ut[_0x43e7('0x138')](_0x1e6245,this[_0x43e7('0xf9')][_0x1e6245[_0x43e7('0xfa')]][_0x43e7('0x27')],this['agents'][_0x1e6245['lookAgent']]['id']);}var _0x561861=_[_0x43e7('0x139')](_0x1e6245);_0x561861[_0x43e7('0x13a')]=moment()[_0x43e7('0x55')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1e11bb=_0x5df124['campaignsPreview'][_0x1e6245[_0x43e7('0x6b')]];if(ut[_0x43e7('0x13b')](_0x3aaf1a[_0x43e7('0x13c')])){if(_0x1e6245[_0x43e7('0xa5')]){rpcDb[_0x43e7('0x13d')](_0x1e6245[_0x43e7('0xff')]);}if(_0x1e6245['activeContact']){rpcDb[_0x43e7('0x88')](_0x1e6245[_0x43e7('0xff')]);}ami[_0x43e7('0x24')](_0x43e7('0x13e'),ut[_0x43e7('0xaf')](_0x1e6245,_0x43e7('0x13f'),this[_0x43e7('0x23')][_0x1e6245[_0x43e7('0x6b')]]));this[_0x43e7('0x140')](_0x561861,_0x1e11bb,_0x3aaf1a);}else{_0x1e6245[_0x43e7('0x89')]=moment()[_0x43e7('0x55')](_0x43e7('0x132'));ut[_0x43e7('0xee')](_0x561861,0x4,'Answer');rpcDb[_0x43e7('0xf1')](_0x561861,_0x43e7('0x141'));}}};Preview['prototype'][_0x43e7('0x16')]=function(_0x2c5e64){var _0x4aaf17=this;var _0x331a72=this[_0x43e7('0x12')][_0x2c5e64[_0x43e7('0xa7')]];var _0x54e369;if(_0x331a72){_0x54e369=this['campaignsPreview'][_0x331a72[_0x43e7('0x6b')]];logger[_0x43e7('0x57')](_0x43e7('0x142'),_0x2c5e64[_0x43e7('0xa7')],_0x43e7('0xac'),_0x54e369[_0x43e7('0x27')],_0x43e7('0xad'),_0x54e369[_0x43e7('0x5b')]);}if(this['actions'][_0x2c5e64[_0x43e7('0xa7')]]&&_0x2c5e64[_0x43e7('0xa7')]!==_0x2c5e64[_0x43e7('0xab')]){if(_0x2c5e64[_0x43e7('0x143')]==='16'&&this[_0x43e7('0x12')][_0x2c5e64[_0x43e7('0xa7')]][_0x43e7('0x6d')]){this[_0x43e7('0x99')](_0x2c5e64,_0x2c5e64[_0x43e7('0xa7')],_0x2c5e64[_0x43e7('0x143')]);}else if(this[_0x43e7('0x12')][_0x2c5e64[_0x43e7('0xa7')]]['dialAnswer']){logger[_0x43e7('0x57')](_0x43e7('0x144'),_0x2c5e64[_0x43e7('0xa7')],_0x2c5e64[_0x43e7('0x143')],_0x43e7('0xac'),_0x54e369[_0x43e7('0x27')],'pTalking:\x20',_0x54e369[_0x43e7('0x5b')]);this['callProgressDetectingCustomer'](_0x2c5e64,_0x2c5e64[_0x43e7('0xa7')],_0x2c5e64[_0x43e7('0x143')]);}}else if(_0x331a72&&_[_0x43e7('0x6a')](_0x331a72['statedesc'])&&_0x54e369[_0x43e7('0x145')]&&_0x2c5e64[_0x43e7('0xa7')]===_0x2c5e64['uniqueid']&&_[_0x43e7('0x6a')](_0x2c5e64['reason'])&&_0x2c5e64[_0x43e7('0x143')]==='16'&&_0x2c5e64[_0x43e7('0x146')]==='6'&&_[_0x43e7('0xeb')](_0x331a72[_0x43e7('0x147')])){if(_0x331a72['unlockAgent']){rpcDb[_0x43e7('0x13d')](_0x331a72[_0x43e7('0xff')]);}if(_0x331a72[_0x43e7('0xa6')]){rpcDb['disableContact'](_0x331a72[_0x43e7('0xff')]);}_0x2c5e64[_0x43e7('0xed')]='22';this[_0x43e7('0x140')](_0x331a72,_0x54e369,_0x2c5e64);}else if(_0x331a72&&_0x331a72[_0x43e7('0x147')]){if(_0x2c5e64[_0x43e7('0x143')]==='16'&&this[_0x43e7('0x12')][_0x2c5e64['linkedid']][_0x43e7('0x6d')]){logger['info'](_0x43e7('0x148'),_0x2c5e64[_0x43e7('0xa7')],_0x2c5e64['cause'],_0x43e7('0xac'),_0x54e369[_0x43e7('0x27')],'pTalking:\x20',_0x54e369[_0x43e7('0x5b')]);this[_0x43e7('0x99')](_0x2c5e64,_0x2c5e64[_0x43e7('0xa7')],_0x2c5e64[_0x43e7('0x143')]);}else if(this['actions'][_0x2c5e64['linkedid']][_0x43e7('0x6d')]){logger[_0x43e7('0x57')](_0x43e7('0x144'),_0x2c5e64[_0x43e7('0xa7')],_0x2c5e64[_0x43e7('0x143')],_0x43e7('0xac'),_0x54e369[_0x43e7('0x27')],_0x43e7('0xad'),_0x54e369['pTalking']);this[_0x43e7('0x99')](_0x2c5e64,_0x2c5e64[_0x43e7('0xa7')],_0x2c5e64['cause']);}}};Preview[_0x43e7('0x62')][_0x43e7('0x1a')]=function(_0x198591){if(this[_0x43e7('0x12')][_0x198591[_0x43e7('0xea')]]&&_0x198591[_0x43e7('0xea')]!==_0x198591[_0x43e7('0x149')]){this['callProgressDetectingCustomer'](_0x198591,_0x198591[_0x43e7('0xea')],_0x198591['dialstatus']);}};Preview[_0x43e7('0x62')][_0x43e7('0x19')]=function(_0x5bc8c5){if(this[_0x43e7('0x12')][_0x5bc8c5['linkedid']]&&_0x5bc8c5[_0x43e7('0xa7')]!==_0x5bc8c5[_0x43e7('0xab')]&&!this[_0x43e7('0x12')][_0x5bc8c5['linkedid']]['dialAnswer']){if(_0x5bc8c5[_0x43e7('0x143')]==='1'){this[_0x43e7('0x99')](_0x5bc8c5,_0x5bc8c5['linkedid'],_0x5bc8c5[_0x43e7('0x143')]);}}};Preview[_0x43e7('0x62')][_0x43e7('0x14a')]=function(_0x4fec66,_0x3127d4,_0x2e6031){if(this[_0x43e7('0x12')][_0x4fec66]){if(_['isNil'](this[_0x43e7('0x12')][_0x4fec66][_0x43e7('0x14b')])){this[_0x43e7('0x12')][_0x4fec66][_0x43e7('0x14b')]={};}this[_0x43e7('0x12')][_0x4fec66][_0x43e7('0x14b')][_0x3127d4]=_0x2e6031;}};Preview['prototype'][_0x43e7('0x1d')]=function(_0x27e3dd){try{if(!_[_0x43e7('0x6a')](_0x27e3dd)){if(ut[_0x43e7('0x14c')](_[_0x43e7('0x14d')](_0x27e3dd[_0x43e7('0x14e')])[0x0])){this[_0x43e7('0x14a')](_0x27e3dd[_0x43e7('0xab')],_[_0x43e7('0x14d')](_0x27e3dd[_0x43e7('0x14e')])[0x0],_0x27e3dd[_0x43e7('0x14f')]);}}}catch(_0x288d6a){logger['error']('[syncVarSet][Preview]',util['inspect'](_0x288d6a,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x43e7('0x1f')]=function(_0x20eef6){if(_0x20eef6){if(this[_0x43e7('0x12')][_0x20eef6[_0x43e7('0x150')]]){this[_0x43e7('0x12')][_0x20eef6[_0x43e7('0x150')]]['transfer']=!![];}}};Preview['prototype'][_0x43e7('0x21')]=function(_0x36dee9){if(_0x36dee9){if(this['actions'][_0x36dee9['transfererlinkedid']]){this[_0x43e7('0x12')][_0x36dee9[_0x43e7('0x151')]]['transfer']=!![];}}};module[_0x43e7('0x152')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 078b02d..19edd77 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 _0x3fcf=['rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','lastAssignedTo','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','then','createHistory','resolve','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','[getContactPreview]\x20','createAgentHistory','createCustomerFinal'];(function(_0x403442,_0x3d06fe){var _0x17d70c=function(_0x5b8139){while(--_0x5b8139){_0x403442['push'](_0x403442['shift']());}};_0x17d70c(++_0x3d06fe);}(_0x3fcf,0x1e9));var _0xf3fc=function(_0xa108c6,_0x382173){_0xa108c6=_0xa108c6-0x0;var _0x1bf573=_0x3fcf[_0xa108c6];return _0x1bf573;};'use strict';var util=require(_0xf3fc('0x0'));var BPromise=require(_0xf3fc('0x1'));var logger=require(_0xf3fc('0x2'))(_0xf3fc('0x3'));var _=require('lodash');var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0xf3fc('0x4'));var cmHopperHistory=require(_0xf3fc('0x5'));var cmHopperBlack=require(_0xf3fc('0x6'));var voiceQueueRt=require(_0xf3fc('0x7'));var agentReportPreview=require(_0xf3fc('0x8'));var voiceQueueReport=require(_0xf3fc('0x9'));function loggerCatch(_0x2d7fa7){return function(_0x16fe53){logger[_0xf3fc('0xa')](_0x2d7fa7,util[_0xf3fc('0xb')](_0x16fe53,{'showHidden':![],'depth':null}));};}function create(_0x522973){return BPromise['resolve']()[_0xf3fc('0xc')](cmHopperHistory[_0xf3fc('0xd')](_0x522973))['catch'](loggerCatch('[createHistory]\x20'));}function createAgent(_0x269f92){return BPromise[_0xf3fc('0xe')]()['then'](agentReportPreview['createHistory'](_0x269f92))[_0xf3fc('0xf')](loggerCatch(_0xf3fc('0x10')));}function moveContact(_0x455f7f){return BPromise[_0xf3fc('0xe')]()[_0xf3fc('0xc')](cmHopper[_0xf3fc('0x11')](_0x455f7f,!![]))[_0xf3fc('0xf')](loggerCatch(_0xf3fc('0x12')));}exports[_0xf3fc('0x13')]=function(_0x1087f3){return BPromise[_0xf3fc('0xe')]()[_0xf3fc('0xc')](cmHopperBlack[_0xf3fc('0x13')](_0x1087f3))[_0xf3fc('0xf')](loggerCatch(_0xf3fc('0x14')));};exports['getContactPreview']=function(_0x387f9e){return BPromise[_0xf3fc('0xe')]()['then'](cmHopper['getContactPreview'](_0x387f9e))[_0xf3fc('0xf')](loggerCatch(_0xf3fc('0x15')));};exports[_0xf3fc('0xd')]=function(_0x4e066f,_0x4f5b43){create(_0x4e066f)[_0xf3fc('0xf')](loggerCatch(_0x4f5b43));moveContact(_0x4e066f)[_0xf3fc('0xf')](loggerCatch(_0x4f5b43));};exports[_0xf3fc('0x16')]=function(_0x256735,_0x1aa0f5){createAgent(_0x256735)[_0xf3fc('0xf')](loggerCatch(_0x1aa0f5));};exports['createCustomerHistory']=function(_0x1f0c9f,_0x158289){create(_0x1f0c9f)[_0xf3fc('0xf')](loggerCatch(_0x158289));};exports[_0xf3fc('0x17')]=function(_0x15233b,_0x587193){moveContact(_0x15233b)['catch'](loggerCatch(_0x587193));};exports[_0xf3fc('0x18')]=function(_0x540e5d,_0x230704,_0x7bd886){if(_0x230704){_0x540e5d[_0xf3fc('0x19')]=null;}if(_0x7bd886){_0x540e5d[_0xf3fc('0x1a')]=![];}return BPromise[_0xf3fc('0xe')]()['then'](cmHopper[_0xf3fc('0x18')](_0x540e5d))[_0xf3fc('0xf')](loggerCatch(_0xf3fc('0x1b')));};exports[_0xf3fc('0x1c')]=function(_0x34f169){return BPromise[_0xf3fc('0xe')]()[_0xf3fc('0xc')](cmHopper[_0xf3fc('0x1c')](_0x34f169))['catch'](loggerCatch(_0xf3fc('0x1d')));};exports[_0xf3fc('0x1e')]=function(_0x262c0a){return BPromise[_0xf3fc('0xe')]()[_0xf3fc('0xc')](cmHopper[_0xf3fc('0x1e')]({'UserId':null},_0x262c0a,0x1))['catch'](loggerCatch(_0xf3fc('0x1f')));};exports[_0xf3fc('0x20')]=function(_0x2dac15){return BPromise[_0xf3fc('0xe')]()[_0xf3fc('0xc')](cmHopper[_0xf3fc('0x1e')]({'active':![]},_0x2dac15,0x1))[_0xf3fc('0xf')](loggerCatch(_0xf3fc('0x21')));};exports[_0xf3fc('0x22')]=function(_0x569fff){var _0x2d1d5b={};_0x2d1d5b[_0xf3fc('0x23')]=_0x569fff[_0xf3fc('0x23')];_0x2d1d5b['uniqueid']=_0x569fff[_0xf3fc('0x24')];_0x2d1d5b[_0xf3fc('0x25')]=_0x569fff['calleridnum'];_0x2d1d5b[_0xf3fc('0x26')]=_0x569fff[_0xf3fc('0x26')];_0x2d1d5b['queue']=_0x569fff[_0xf3fc('0x27')];_0x2d1d5b[_0xf3fc('0x28')]=_0x569fff[_0xf3fc('0x29')];_0x2d1d5b[_0xf3fc('0x2a')]=_0x569fff[_0xf3fc('0x29')];_0x2d1d5b[_0xf3fc('0x2b')]=0x1;_0x2d1d5b['queuecallercompleteAt']=_0x569fff[_0xf3fc('0x2c')];_0x2d1d5b[_0xf3fc('0x2d')]=_0x569fff[_0xf3fc('0x2e')];_0x2d1d5b[_0xf3fc('0x2f')]=_0xf3fc('0x30');_0x2d1d5b[_0xf3fc('0x31')]=_0xf3fc('0x32');_0x2d1d5b['holdtime']=0x0;_0x2d1d5b['assigned']=0x1;_0x2d1d5b[_0xf3fc('0x33')]=_0x569fff[_0xf3fc('0x2e')];_0x2d1d5b['queuecallerexitreason']='COMPLETED';return BPromise['resolve']()['then'](voiceQueueReport[_0xf3fc('0x34')](_0x2d1d5b))[_0xf3fc('0xf')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0xf3fc('0x35')]=function(_0xaa4051,_0x26cdd4){return BPromise[_0xf3fc('0xe')]()['then'](cmHopper['getContactRecallMe'](_0xaa4051,_0x26cdd4))['catch'](loggerCatch(_0xf3fc('0x36')));};exports[_0xf3fc('0x37')]=function(_0x28756b){return BPromise[_0xf3fc('0xe')]()[_0xf3fc('0xc')](cmHopper['rescheduleContact'](_0x28756b,!![],!![]))[_0xf3fc('0xf')](loggerCatch(_0xf3fc('0x38')));}; \ No newline at end of file +var _0xdd5a=['[rescheduleContactInQueue]\x20','util','../../../config/logger','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','then','createHistory','catch','resolve','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','queuecallerexitreason','COMPLETED','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue'];(function(_0x3a1923,_0x33c647){var _0xdb130b=function(_0x4d05fd){while(--_0x4d05fd){_0x3a1923['push'](_0x3a1923['shift']());}};_0xdb130b(++_0x33c647);}(_0xdd5a,0xd1));var _0xadd5=function(_0x5882f1,_0x123065){_0x5882f1=_0x5882f1-0x0;var _0x3f3fc8=_0xdd5a[_0x5882f1];return _0x3f3fc8;};'use strict';var util=require(_0xadd5('0x0'));var BPromise=require('bluebird');var logger=require(_0xadd5('0x1'))('preview');var _=require('lodash');var cmHopper=require(_0xadd5('0x2'));var cmHopperFinal=require(_0xadd5('0x3'));var cmHopperHistory=require(_0xadd5('0x4'));var cmHopperBlack=require(_0xadd5('0x5'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0xadd5('0x6'));var voiceQueueReport=require(_0xadd5('0x7'));function loggerCatch(_0x3e4356){return function(_0x8e053){logger[_0xadd5('0x8')](_0x3e4356,util[_0xadd5('0x9')](_0x8e053,{'showHidden':![],'depth':null}));};}function create(_0x2852ca){return BPromise['resolve']()[_0xadd5('0xa')](cmHopperHistory[_0xadd5('0xb')](_0x2852ca))[_0xadd5('0xc')](loggerCatch('[createHistory]\x20'));}function createAgent(_0xf7fe7d){return BPromise[_0xadd5('0xd')]()[_0xadd5('0xa')](agentReportPreview[_0xadd5('0xb')](_0xf7fe7d))[_0xadd5('0xc')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x2b169a){return BPromise[_0xadd5('0xd')]()[_0xadd5('0xa')](cmHopper[_0xadd5('0xe')](_0x2b169a,!![]))['catch'](loggerCatch(_0xadd5('0xf')));}exports[_0xadd5('0x10')]=function(_0xbf90b4){return BPromise['resolve']()[_0xadd5('0xa')](cmHopperBlack[_0xadd5('0x10')](_0xbf90b4))[_0xadd5('0xc')](loggerCatch('[checkIsBlackList]\x20'));};exports['getContactPreview']=function(_0x15936f){return BPromise[_0xadd5('0xd')]()[_0xadd5('0xa')](cmHopper[_0xadd5('0x11')](_0x15936f))[_0xadd5('0xc')](loggerCatch(_0xadd5('0x12')));};exports[_0xadd5('0xb')]=function(_0x5e68a6,_0x3365ff){create(_0x5e68a6)['catch'](loggerCatch(_0x3365ff));moveContact(_0x5e68a6)[_0xadd5('0xc')](loggerCatch(_0x3365ff));};exports[_0xadd5('0x13')]=function(_0x3c82b6,_0x5af941){createAgent(_0x3c82b6)[_0xadd5('0xc')](loggerCatch(_0x5af941));};exports['createCustomerHistory']=function(_0x554193,_0x3eb121){create(_0x554193)[_0xadd5('0xc')](loggerCatch(_0x3eb121));};exports[_0xadd5('0x14')]=function(_0x105be7,_0x114e49){moveContact(_0x105be7)[_0xadd5('0xc')](loggerCatch(_0x114e49));};exports[_0xadd5('0x15')]=function(_0x2cd64a,_0x237b82,_0x45a89b){if(_0x237b82){_0x2cd64a[_0xadd5('0x16')]=null;}if(_0x45a89b){_0x2cd64a[_0xadd5('0x17')]=![];}return BPromise['resolve']()[_0xadd5('0xa')](cmHopper[_0xadd5('0x15')](_0x2cd64a))[_0xadd5('0xc')](loggerCatch('[rescheduleContact]\x20'));};exports[_0xadd5('0x18')]=function(_0x7e50c1){return BPromise[_0xadd5('0xd')]()[_0xadd5('0xa')](cmHopper[_0xadd5('0x18')](_0x7e50c1))['catch'](loggerCatch(_0xadd5('0x19')));};exports['unlockContact']=function(_0x67d93){return BPromise[_0xadd5('0xd')]()['then'](cmHopper[_0xadd5('0x1a')]({'UserId':null},_0x67d93,0x1))[_0xadd5('0xc')](loggerCatch(_0xadd5('0x1b')));};exports[_0xadd5('0x1c')]=function(_0x137254){return BPromise['resolve']()[_0xadd5('0xa')](cmHopper[_0xadd5('0x1a')]({'active':![]},_0x137254,0x1))[_0xadd5('0xc')](loggerCatch('[activeContact]\x20'));};exports[_0xadd5('0x1d')]=function(_0x2a3c33){var _0x5c43fa={};_0x5c43fa['type']=_0x2a3c33[_0xadd5('0x1e')];_0x5c43fa[_0xadd5('0x1f')]=_0x2a3c33[_0xadd5('0x1f')];_0x5c43fa[_0xadd5('0x20')]=_0x2a3c33[_0xadd5('0x20')];_0x5c43fa['calleridname']=_0x2a3c33[_0xadd5('0x21')];_0x5c43fa['queue']=_0x2a3c33[_0xadd5('0x22')];_0x5c43fa['queuecallerjoinAt']=_0x2a3c33[_0xadd5('0x23')];_0x5c43fa['queuecallerleaveAt']=_0x2a3c33[_0xadd5('0x23')];_0x5c43fa[_0xadd5('0x24')]=0x1;_0x5c43fa[_0xadd5('0x25')]=_0x2a3c33[_0xadd5('0x26')];_0x5c43fa[_0xadd5('0x27')]=_0x2a3c33[_0xadd5('0x28')];_0x5c43fa[_0xadd5('0x29')]=_0xadd5('0x2a');_0x5c43fa[_0xadd5('0x2b')]=_0xadd5('0x2c');_0x5c43fa[_0xadd5('0x2d')]=0x0;_0x5c43fa['assigned']=0x1;_0x5c43fa['lastAssignedTo']=_0x2a3c33['membername'];_0x5c43fa[_0xadd5('0x2e')]=_0xadd5('0x2f');return BPromise[_0xadd5('0xd')]()['then'](voiceQueueReport['create'](_0x5c43fa))[_0xadd5('0xc')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0xadd5('0x30')]=function(_0xef0610,_0x2d99aa){return BPromise[_0xadd5('0xd')]()[_0xadd5('0xa')](cmHopper[_0xadd5('0x30')](_0xef0610,_0x2d99aa))[_0xadd5('0xc')](loggerCatch(_0xadd5('0x31')));};exports[_0xadd5('0x32')]=function(_0x2fe1d1){return BPromise['resolve']()[_0xadd5('0xa')](cmHopper[_0xadd5('0x15')](_0x2fe1d1,!![],!![]))[_0xadd5('0xc')](loggerCatch(_0xadd5('0x33')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 9bb7185..1927551 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 _0xabfa=['logger2','message','getCallerId','string','isEmpty','format','isUndefined','isActive','addVariables','Queue','\x22%s\x22\x20<%s>','calleridname','calleridnum','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','tags','createdAt','updatedAt','%s%s','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','statedesc','Blacklist','state','responsetime','ringtime','UserId','logCustomer','YYYY-MM-DD\x20HH:mm:ss','endtime','talktime','answertime','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','name','queue','interface','motionChannel','mandatoryDisposition','buildAcw','agentReadyId','status','reachable','push','getDiff','createBody','filterKey','idContact','type','campaigntype','membername','countglobal','callback','callbackat','sipcallid','xmd-voicequeueid','xmd-queue','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqos','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','replace','random','extractCalleridName','match','lodash','moment','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','info','loggerError'];(function(_0x3f157a,_0x5cb402){var _0x234267=function(_0x195c95){while(--_0x195c95){_0x3f157a['push'](_0x3f157a['shift']());}};_0x234267(++_0x5cb402);}(_0xabfa,0x7c));var _0xaabf=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0xabfa[_0xf79bae];return _0x5d2cb7;};'use strict';var util=require('util');var _=require(_0xaabf('0x0'));var moment=require(_0xaabf('0x1'));var logger=require('../../../../config/logger')('preview');var ipAgi=process[_0xaabf('0x2')][_0xaabf('0x3')]||_0xaabf('0x4');function getSeconds(_0x3de086,_0x549232){var _0x3de97f=moment(_0x3de086)['milliseconds'](0x0);var _0x1e7826=moment(_0x549232)[_0xaabf('0x5')](0x0);return _0x3de97f[_0xaabf('0x6')](_0x1e7826,_0xaabf('0x7'));}exports[_0xaabf('0x8')]=function(_0x5325e8){return function(_0x5c3778){logger[_0xaabf('0x9')](_0x5325e8,util[_0xaabf('0xa')](_0x5c3778,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x46204e,_0x5586bd){logger[_0xaabf('0xb')](_0x46204e,util['inspect'](_0x5586bd,{'showHidden':![],'depth':null}));};exports[_0xaabf('0xc')]=function(_0xf13263,_0x30e9e7){logger[_0xaabf('0x9')](_0xf13263,util[_0xaabf('0xa')](_0x30e9e7,{'showHidden':![],'depth':null}));};exports[_0xaabf('0xd')]=function(_0x67e6f6){return function(_0x269ffd){logger[_0xaabf('0xb')](_0x67e6f6,util[_0xaabf('0xa')](_0x269ffd,{'showHidden':![],'depth':null}));};};exports[_0xaabf('0xe')]=function(_0x1db9a2,_0xfc95ab,_0x5b422a){return{'message':_0x1db9a2,'unlock':_0xfc95ab,'active':_0x5b422a};};exports[_0xaabf('0xf')]=function(_0x4f333d,_0x1b7e89,_0x554098){if(!_['isUndefined'](_0x554098)&&_0xaabf('0x10')===typeof _0x554098&&!_[_0xaabf('0x11')](_0x554098)){if(!_['isUndefined'](_0x1b7e89)&&_0xaabf('0x10')===typeof _0x1b7e89&&!_['isEmpty'](_0x1b7e89)){return util['format']('\x22%s\x22\x20<%s>',_0x1b7e89,_0x554098);}return util[_0xaabf('0x12')]('\x22%s\x22\x20<%s>',_0x554098,_0x554098);}if(!_[_0xaabf('0x13')](_0x4f333d)&&_0xaabf('0x10')===typeof _0x4f333d&&!_[_0xaabf('0x11')](_0x4f333d)){return _0x4f333d;}return'\x22\x22\x20<>';};exports[_0xaabf('0x14')]=function(_0x46ea8c){if(_['isNil'](_0x46ea8c)){return![];}return _0x46ea8c;};exports[_0xaabf('0x15')]=function(_0x4b3e05,_0x3c7afa,_0x1ec859,_0x347f57,_0x251dc6,_0x5e1d4b){var _0x58c6b0={'XMD-QUEUE':_0x3c7afa[_0xaabf('0x16')]?_0x3c7afa['Queue']['name']:'','XMD-CALLERID':_0x347f57,'XMD-CALLERID-PREVIEW':_0x5e1d4b?util[_0xaabf('0x12')](_0xaabf('0x17'),_0x5e1d4b[_0xaabf('0x18')],_0x5e1d4b[_0xaabf('0x19')]):_0x347f57,'XMD-DIALID':_0x251dc6,'XMD-CONTACTID':_0x3c7afa['ContactId'],'XMD-CDRTYPE':_0xaabf('0x1a'),'CALLERID(all)':_0x347f57,'XMD-VOICEQUEUEID':_0x3c7afa[_0xaabf('0x1b')],'XMD-DIALCHANNEL':_0x1ec859,'XMD-DIALTIMEOUT':_0x4b3e05['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xaabf('0x12')](_0xaabf('0x1c'),_0x4b3e05[_0xaabf('0x1d')]?'g':'',_[_0xaabf('0x11')](_0x4b3e05[_0xaabf('0x1e')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x4b3e05[_0xaabf('0x1f')]||'','XMD-AGI':_0x4b3e05[_0xaabf('0x20')]?util[_0xaabf('0x12')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4b3e05[_0xaabf('0x20')]):_0xaabf('0x21'),'XMD-AGIAFTER':_0x4b3e05['dialQueueProject2']?util[_0xaabf('0x12')](_0xaabf('0x22'),ipAgi,_0x4b3e05[_0xaabf('0x1d')]):_0xaabf('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x5e1d4b?_0x5e1d4b['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x5e1d4b?_0x5e1d4b[_0xaabf('0x23')]:'','XMD-DESTINATION':_0xaabf('0x24'),'SIPADDHEADER':_0xaabf('0x25')};if(!_[_0xaabf('0x11')](_0x4b3e05[_0xaabf('0x1e')])){_0x58c6b0[util[_0xaabf('0x12')]('%s',_0xaabf('0x26'))]=_0x4b3e05[_0xaabf('0x1e')];_0x58c6b0[util[_0xaabf('0x12')]('%s',_0xaabf('0x27'))]=_0x251dc6;}if(_0x3c7afa&&_0x3c7afa[_0xaabf('0x28')]){for(var _0x3a7ddf in _0x3c7afa[_0xaabf('0x28')]){if(_0x3c7afa[_0xaabf('0x28')][_0xaabf('0x29')](_0x3a7ddf)){if(!_[_0xaabf('0x2a')](_0x3c7afa[_0xaabf('0x28')][_0x3a7ddf])&&_0x3a7ddf!=='id'&&_0x3a7ddf!==_0xaabf('0x2b')&&_0x3a7ddf!==_0xaabf('0x2c')&&_0x3a7ddf!==_0xaabf('0x2d')){_0x58c6b0[util['format'](_0xaabf('0x2e'),'XMD-',_[_0xaabf('0x2f')](_0x3a7ddf))]=_0x3c7afa[_0xaabf('0x28')][_0x3a7ddf];}}}}return _0x58c6b0;};exports[_0xaabf('0x30')]=function(_0x3947d2){var _0x1ab64c={};for(var _0x53c7fa in _0x3947d2){if(_0x3947d2['hasOwnProperty'](_0x53c7fa)){_0x1ab64c[util[_0xaabf('0x12')]('%s',_[_0xaabf('0x31')](_0x53c7fa))]=_0x3947d2[_0x53c7fa];}}return{'variables':_0x1ab64c};};exports[_0xaabf('0x32')]=function(_0x146e7d,_0x871024){if(!_['isNil'](_0x146e7d)){if(_0x146e7d[_0xaabf('0x29')](_0xaabf('0x33'))){if(_0x146e7d[_0xaabf('0x33')]>0x0){_0x146e7d[_0xaabf('0x33')]-=0x1;}else{logger[_0xaabf('0x9')](_0xaabf('0x34'),_0x871024);}}}else{logger['error'](_0xaabf('0x35'),_0x871024);}};exports[_0xaabf('0x36')]=function(_0x59da1d){var _0x30e6ba=moment()[_0xaabf('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x59da1d['state']=0xd;_0x59da1d[_0xaabf('0x37')]=_0xaabf('0x38');_0x59da1d['starttime']=_0x30e6ba;_0x59da1d['responsetime']=_0x30e6ba;_0x59da1d['endtime']=_0x30e6ba;};exports['logAgent']=function(_0x50b86d,_0x100479,_0x50d617){var _0x3d17b7=moment()[_0xaabf('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x50b86d[_0xaabf('0x39')]=_0x100479;_0x50b86d[_0xaabf('0x37')]=_0x50d617;_0x50b86d[_0xaabf('0x3a')]=_0x3d17b7;_0x50b86d[_0xaabf('0x3b')]=getSeconds(_0x50b86d[_0xaabf('0x3a')],_0x50b86d['starttime']);};exports['logLookAgent']=function(_0x4dd27b,_0x1278d2,_0x198312){_0x4dd27b['membername']=_0x1278d2;_0x4dd27b[_0xaabf('0x3c')]=_0x198312;};exports[_0xaabf('0x3d')]=function(_0x2964a0,_0x8226bb,_0x253c61){var _0x1f0d35=moment()[_0xaabf('0x12')](_0xaabf('0x3e'));_0x2964a0[_0xaabf('0x39')]=_0x8226bb;_0x2964a0[_0xaabf('0x37')]=_0x253c61;_0x2964a0['responsetime']=_0x2964a0['responsetime']?_0x2964a0[_0xaabf('0x3a')]:_0x1f0d35;_0x2964a0['endtime']=_0x2964a0[_0xaabf('0x3f')]?_0x2964a0[_0xaabf('0x3f')]:_0x1f0d35;_0x2964a0[_0xaabf('0x3b')]=getSeconds(_0x2964a0[_0xaabf('0x3a')]||0x0,_0x2964a0['starttime']||0x0);_0x2964a0[_0xaabf('0x40')]=_0x2964a0['answertime']?getSeconds(_0x2964a0['endtime'],_0x2964a0[_0xaabf('0x41')]):0x0;};exports['isFailure']=function(_0x322355){return _0x322355===_0xaabf('0x42');};exports[_0xaabf('0x43')]=function(_0x231557,_0x458d7a,_0x49e142,_0x53bf0a,_0x2b6a87){var _0x468a68=_0x53bf0a?_0xaabf('0x44'):_0x231557['calleridname'];_0x468a68=_0x2b6a87?_0xaabf('0x45'):_0x468a68;return{'actionid':_0x231557[_0xaabf('0x46')],'action':_0xaabf('0x47'),'channel':_0x231557[_0xaabf('0x48')],'callerid':util['format'](_0xaabf('0x17'),_0x468a68,_0x231557[_0xaabf('0x19')]),'Exten':_0xaabf('0x24'),'Context':_0xaabf('0x49'),'Priority':'1','variable':_0x49e142,'timeout':(_0x458d7a[_0xaabf('0x4a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x231557['uniqueid']};};exports[_0xaabf('0x4b')]=function(_0x276f65){return _0x276f65['countbusyretry']+_0x276f65[_0xaabf('0x4c')]+_0x276f65[_0xaabf('0x4d')]+_0x276f65[_0xaabf('0x4e')]+_0x276f65['countnosuchnumberretry'];};exports[_0xaabf('0x4f')]=function(_0x4e99aa){var _0x1afb91=_[_0xaabf('0x50')](_0x4e99aa);_0x1afb91[_0xaabf('0x39')]=0xf;_0x1afb91[_0xaabf('0x37')]=_0xaabf('0x51');return _0x1afb91;};exports[_0xaabf('0x52')]=function(_0x1a23da,_0xf7475e,_0x12ca71){var _0x1f4576={};_0x1f4576[_0xf7475e]=_0x1a23da[_0xf7475e];_0x1f4576[_0xaabf('0x53')]=![];_0x1f4576[_0xaabf('0x54')]=moment()['add'](_0x12ca71,'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1f4576[_0xaabf('0x55')]=_0x1a23da['ContactId'];_0x1f4576['ListId']=_0x1a23da[_0xaabf('0x56')];_0x1f4576[_0xaabf('0x1b')]=_0x1a23da[_0xaabf('0x1b')]||undefined;return _0x1f4576;};exports[_0xaabf('0x57')]=function(_0x50e87f,_0x17bed3){if(!_['isNil'](_0x50e87f)){if(_0x50e87f['pTalking']>0x0){_0x50e87f[_0xaabf('0x58')]-=0x1;}else{logger[_0xaabf('0x9')](_0x17bed3,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xaabf('0x9')](_0x17bed3,_0xaabf('0x59'));}};exports['IsNotLoggedIn']=function(_0x11082b){if(_0x11082b<=0x0){return!![];}return![];};exports['buildObj']=function(_0x3a2e17,_0xec8916,_0x19b853){_0x3a2e17['lastevent']=_0xec8916;_0x3a2e17[_0xaabf('0x5a')]=_0x3a2e17[_0xaabf('0x5b')];_0x3a2e17[_0xaabf('0x5c')]=_0x3a2e17[_0xaabf('0x48')];_0x3a2e17[_0xaabf('0x5d')]='voice';if(_0x19b853){_0x3a2e17['mandatoryDisposition']=_0x19b853[_0xaabf('0x5e')];}return _0x3a2e17;};exports[_0xaabf('0x5f')]=function(_0x3ed9ea){var _0x155f2f={};_0x155f2f[_0xaabf('0x5b')]=_0x3ed9ea[_0xaabf('0x5b')];_0x155f2f[_0xaabf('0x5c')]=_0x3ed9ea[_0xaabf('0x48')];_0x155f2f['uniqueid']=_0x3ed9ea[_0xaabf('0x46')];return _0x155f2f;};exports[_0xaabf('0x60')]=function(_0xad6e55){var _0x381053=[];for(var _0x686f91 in _0xad6e55){if(_0xad6e55[_0xaabf('0x29')](_0x686f91)){if(!_[_0xaabf('0x2a')](_0xad6e55[_0x686f91])&&_0xad6e55[_0x686f91]['state']==='not_inuse'&&_0xad6e55[_0x686f91][_0xaabf('0x61')]===_0xaabf('0x62')){_0x381053[_0xaabf('0x63')](_0xad6e55[_0x686f91]['id']);}}}return _0x381053;};exports[_0xaabf('0x64')]=function(_0x148e0f){var _0x43dbbb=moment()[_0xaabf('0x5')](0x0);var _0x17dd26=moment(_0x148e0f)[_0xaabf('0x5')](0x0);return _0x43dbbb[_0xaabf('0x6')](_0x17dd26,_0xaabf('0x7'));};exports[_0xaabf('0x65')]=function(_0x46083d){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x46083d[_0xaabf('0x55')],'ListId':_0x46083d[_0xaabf('0x56')],'VoiceQueueId':_0x46083d[_0xaabf('0x1b')]||undefined,'CampaignId':_0x46083d['CampaignId']||undefined};};exports[_0xaabf('0x66')]=function(_0x4b21da){if(_0x4b21da===_0xaabf('0x46')||_0x4b21da===_0xaabf('0x67')||_0x4b21da===_0xaabf('0x5b')||_0x4b21da===_0xaabf('0x68')||_0x4b21da===_0xaabf('0x69')||_0x4b21da==='dialAnswer'||_0x4b21da===_0xaabf('0x6a')||_0x4b21da===_0xaabf('0x48')||_0x4b21da===_0xaabf('0x18')||_0x4b21da===_0xaabf('0x53')||_0x4b21da===_0xaabf('0x19')||_0x4b21da==='scheduledat'||_0x4b21da==='countbusyretry'||_0x4b21da===_0xaabf('0x4c')||_0x4b21da===_0xaabf('0x4d')||_0x4b21da===_0xaabf('0x6b')||_0x4b21da===_0xaabf('0x6c')||_0x4b21da==='callbackuniqueid'||_0x4b21da===_0xaabf('0x6d')||_0x4b21da==='recallme'||_0x4b21da==='ContactId'||_0x4b21da===_0xaabf('0x56')||_0x4b21da===_0xaabf('0x3c')||_0x4b21da===_0xaabf('0x1b')||_0x4b21da===_0xaabf('0x6e')||_0x4b21da===_0xaabf('0x6f')||_0x4b21da===_0xaabf('0x70')||_0x4b21da==='xmd-phone'||_0x4b21da==='xmd-listid'||_0x4b21da===_0xaabf('0x71')||_0x4b21da===_0xaabf('0x72')||_0x4b21da===_0xaabf('0x73')||_0x4b21da===_0xaabf('0x74')||_0x4b21da===_0xaabf('0x75')||_0x4b21da===_0xaabf('0x76')||_0x4b21da==='xmd-cdrtype'||_0x4b21da===_0xaabf('0x77')||_0x4b21da===_0xaabf('0x78')||_0x4b21da===_0xaabf('0x79')||_0x4b21da==='rtpaudioqos'||_0x4b21da===_0xaabf('0x7a')||_0x4b21da===_0xaabf('0x7b')||_0x4b21da===_0xaabf('0x7c')||_0x4b21da===_0xaabf('0x7d')||_0x4b21da===_0xaabf('0x7e')||_0x4b21da==='rtpaudioqosrtt'||_0x4b21da===_0xaabf('0x7f')||_0x4b21da===_0xaabf('0x80')||_0x4b21da===_0xaabf('0x7a')||_0x4b21da===_0xaabf('0x7b')||_0x4b21da===_0xaabf('0x7c')||_0x4b21da===_0xaabf('0x7d')||_0x4b21da===_0xaabf('0x7e')||_0x4b21da==='rtpaudioqosrtt'||_0x4b21da===_0xaabf('0x7f')||_0x4b21da===_0xaabf('0x81')||_0x4b21da===_0xaabf('0x82')||_0x4b21da===_0xaabf('0x39')||_0x4b21da===_0xaabf('0x37')){return![];}return!![];};exports[_0xaabf('0x83')]=function(_0x271bef,_0x54e58c){var _0x270532,_0xf8beb,_0x91ee2e;if(_0x54e58c<=0x0){_0x54e58c=0x1;}_0x270532=new RegExp(_0xaabf('0x84')+_0x54e58c+'}$');_0xf8beb=Math['pow'](0xa,_0x54e58c-0x1);_0x91ee2e=Math['pow'](0xa,_0x54e58c)-0x1;return util[_0xaabf('0x12')]('%s',_[_0xaabf('0x85')](_0x271bef,_0x270532,_[_0xaabf('0x86')](_0xf8beb,_0x91ee2e)));};exports[_0xaabf('0x87')]=function(_0x57a171){var _0x5955c1=_0x57a171[_0xaabf('0x88')](/"(.*?)"/);return _0x5955c1?_0x5955c1[0x1]:_0x57a171;};exports['extractCalleridNumber']=function(_0x2bba5d){var _0x10016d=_0x2bba5d['match'](/<(.*?)>/);return _0x10016d?_0x10016d[0x1]:_0x2bba5d;}; \ No newline at end of file +var _0xa98b=['error','message','getCallerId','isUndefined','string','isEmpty','format','\x22\x22\x20<>','isActive','addVariables','Queue','name','\x22%s\x22\x20<%s>','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','isNil','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','motionChannel','voice','mandatoryDisposition','interface','channelAgent','agentReadyId','status','reachable','push','getDiff','seconds','createBody','filterKey','idContact','type','countnoanswerretry','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosjitter','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','extractCalleridNumber','match','lodash','moment','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','milliseconds','loggerCatch','logger','info','inspect','loggerError'];(function(_0x695cfc,_0x1ac1d2){var _0x7eb0cd=function(_0x8b6e23){while(--_0x8b6e23){_0x695cfc['push'](_0x695cfc['shift']());}};_0x7eb0cd(++_0x1ac1d2);}(_0xa98b,0x11e));var _0xba98=function(_0x210b22,_0x55d945){_0x210b22=_0x210b22-0x0;var _0x402309=_0xa98b[_0x210b22];return _0x402309;};'use strict';var util=require('util');var _=require(_0xba98('0x0'));var moment=require(_0xba98('0x1'));var logger=require(_0xba98('0x2'))(_0xba98('0x3'));var ipAgi=process['env'][_0xba98('0x4')]||_0xba98('0x5');function getSeconds(_0x202889,_0xcb43b6){var _0x459b67=moment(_0x202889)[_0xba98('0x6')](0x0);var _0x3ef39a=moment(_0xcb43b6)[_0xba98('0x6')](0x0);return _0x459b67['diff'](_0x3ef39a,'seconds');}exports[_0xba98('0x7')]=function(_0x354b74){return function(_0x545de8){logger['error'](_0x354b74,util['inspect'](_0x545de8,{'showHidden':![],'depth':null}));};};exports[_0xba98('0x8')]=function(_0xd7bc9b,_0x307be7){logger[_0xba98('0x9')](_0xd7bc9b,util[_0xba98('0xa')](_0x307be7,{'showHidden':![],'depth':null}));};exports[_0xba98('0xb')]=function(_0x54aadb,_0x4099f4){logger[_0xba98('0xc')](_0x54aadb,util[_0xba98('0xa')](_0x4099f4,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x14ee54){return function(_0x1b4d58){logger['info'](_0x14ee54,util[_0xba98('0xa')](_0x1b4d58,{'showHidden':![],'depth':null}));};};exports[_0xba98('0xd')]=function(_0x2f1b00,_0x10e25a,_0x20a6af){return{'message':_0x2f1b00,'unlock':_0x10e25a,'active':_0x20a6af};};exports[_0xba98('0xe')]=function(_0xc80e7c,_0x54f134,_0x232d31){if(!_[_0xba98('0xf')](_0x232d31)&&_0xba98('0x10')===typeof _0x232d31&&!_[_0xba98('0x11')](_0x232d31)){if(!_['isUndefined'](_0x54f134)&&_0xba98('0x10')===typeof _0x54f134&&!_[_0xba98('0x11')](_0x54f134)){return util[_0xba98('0x12')]('\x22%s\x22\x20<%s>',_0x54f134,_0x232d31);}return util[_0xba98('0x12')]('\x22%s\x22\x20<%s>',_0x232d31,_0x232d31);}if(!_[_0xba98('0xf')](_0xc80e7c)&&_0xba98('0x10')===typeof _0xc80e7c&&!_[_0xba98('0x11')](_0xc80e7c)){return _0xc80e7c;}return _0xba98('0x13');};exports[_0xba98('0x14')]=function(_0x3e3ec5){if(_['isNil'](_0x3e3ec5)){return![];}return _0x3e3ec5;};exports[_0xba98('0x15')]=function(_0x4c6c2f,_0x5c6085,_0x16ded8,_0x18f102,_0x76e0f4,_0x2f1e78){var _0x189339={'XMD-QUEUE':_0x5c6085['Queue']?_0x5c6085[_0xba98('0x16')][_0xba98('0x17')]:'','XMD-CALLERID':_0x18f102,'XMD-CALLERID-PREVIEW':_0x2f1e78?util[_0xba98('0x12')](_0xba98('0x18'),_0x2f1e78[_0xba98('0x19')],_0x2f1e78[_0xba98('0x1a')]):_0x18f102,'XMD-DIALID':_0x76e0f4,'XMD-CONTACTID':_0x5c6085[_0xba98('0x1b')],'XMD-CDRTYPE':_0xba98('0x1c'),'CALLERID(all)':_0x18f102,'XMD-VOICEQUEUEID':_0x5c6085[_0xba98('0x1d')],'XMD-DIALCHANNEL':_0x16ded8,'XMD-DIALTIMEOUT':_0x4c6c2f['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util['format'](_0xba98('0x1e'),_0x4c6c2f[_0xba98('0x1f')]?'g':'',_['isEmpty'](_0x4c6c2f[_0xba98('0x20')])?'':_0xba98('0x21')),'XMD-DIALURL':_0x4c6c2f[_0xba98('0x22')]||'','XMD-AGI':_0x4c6c2f[_0xba98('0x23')]?util['format'](_0xba98('0x24'),ipAgi,_0x4c6c2f[_0xba98('0x23')]):_0xba98('0x25'),'XMD-AGIAFTER':_0x4c6c2f[_0xba98('0x1f')]?util[_0xba98('0x12')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4c6c2f[_0xba98('0x1f')]):_0xba98('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x2f1e78?_0x2f1e78[_0xba98('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x2f1e78?_0x2f1e78['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0xba98('0x27')};if(!_[_0xba98('0x11')](_0x4c6c2f[_0xba98('0x20')])){_0x189339[util[_0xba98('0x12')]('%s',_0xba98('0x28'))]=_0x4c6c2f[_0xba98('0x20')];_0x189339[util[_0xba98('0x12')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x76e0f4;}if(_0x5c6085&&_0x5c6085[_0xba98('0x29')]){for(var _0x408758 in _0x5c6085[_0xba98('0x29')]){if(_0x5c6085[_0xba98('0x29')][_0xba98('0x2a')](_0x408758)){if(!_[_0xba98('0x2b')](_0x5c6085[_0xba98('0x29')][_0x408758])&&_0x408758!=='id'&&_0x408758!==_0xba98('0x2c')&&_0x408758!==_0xba98('0x2d')&&_0x408758!==_0xba98('0x2e')){_0x189339[util[_0xba98('0x12')](_0xba98('0x2f'),_0xba98('0x30'),_[_0xba98('0x31')](_0x408758))]=_0x5c6085[_0xba98('0x29')][_0x408758];}}}}return _0x189339;};exports['toLowerVariables']=function(_0x51bda7){var _0x3fb651={};for(var _0x407ba3 in _0x51bda7){if(_0x51bda7['hasOwnProperty'](_0x407ba3)){_0x3fb651[util['format']('%s',_['toLower'](_0x407ba3))]=_0x51bda7[_0x407ba3];}}return{'variables':_0x3fb651};};exports[_0xba98('0x32')]=function(_0x1b78e0,_0x15d6b7){if(!_[_0xba98('0x2b')](_0x1b78e0)){if(_0x1b78e0['hasOwnProperty'](_0xba98('0x33'))){if(_0x1b78e0[_0xba98('0x33')]>0x0){_0x1b78e0[_0xba98('0x33')]-=0x1;}else{logger[_0xba98('0xc')](_0xba98('0x34'),_0x15d6b7);}}}else{logger['error'](_0xba98('0x35'),_0x15d6b7);}};exports[_0xba98('0x36')]=function(_0x1f29d3){var _0x590924=moment()[_0xba98('0x12')](_0xba98('0x37'));_0x1f29d3[_0xba98('0x38')]=0xd;_0x1f29d3[_0xba98('0x39')]=_0xba98('0x3a');_0x1f29d3[_0xba98('0x3b')]=_0x590924;_0x1f29d3[_0xba98('0x3c')]=_0x590924;_0x1f29d3[_0xba98('0x3d')]=_0x590924;};exports[_0xba98('0x3e')]=function(_0x29751e,_0x21f274,_0x17040f){var _0x2249c2=moment()[_0xba98('0x12')](_0xba98('0x37'));_0x29751e[_0xba98('0x38')]=_0x21f274;_0x29751e[_0xba98('0x39')]=_0x17040f;_0x29751e['responsetime']=_0x2249c2;_0x29751e['ringtime']=getSeconds(_0x29751e[_0xba98('0x3c')],_0x29751e[_0xba98('0x3b')]);};exports['logLookAgent']=function(_0xf4d765,_0x29135a,_0x260d73){_0xf4d765[_0xba98('0x3f')]=_0x29135a;_0xf4d765[_0xba98('0x40')]=_0x260d73;};exports[_0xba98('0x41')]=function(_0x233a0d,_0x4d2f7b,_0x27b311){var _0x5b6453=moment()[_0xba98('0x12')](_0xba98('0x37'));_0x233a0d['state']=_0x4d2f7b;_0x233a0d[_0xba98('0x39')]=_0x27b311;_0x233a0d['responsetime']=_0x233a0d['responsetime']?_0x233a0d[_0xba98('0x3c')]:_0x5b6453;_0x233a0d['endtime']=_0x233a0d[_0xba98('0x3d')]?_0x233a0d[_0xba98('0x3d')]:_0x5b6453;_0x233a0d['ringtime']=getSeconds(_0x233a0d[_0xba98('0x3c')]||0x0,_0x233a0d[_0xba98('0x3b')]||0x0);_0x233a0d[_0xba98('0x42')]=_0x233a0d[_0xba98('0x43')]?getSeconds(_0x233a0d['endtime'],_0x233a0d['answertime']):0x0;};exports[_0xba98('0x44')]=function(_0x28877a){return _0x28877a===_0xba98('0x45');};exports[_0xba98('0x46')]=function(_0x40d2b0,_0x9a5044,_0x319d05,_0x57605b,_0x379e34){var _0x2c5ad4=_0x57605b?_0xba98('0x47'):_0x40d2b0[_0xba98('0x19')];_0x2c5ad4=_0x379e34?_0xba98('0x48'):_0x2c5ad4;return{'actionid':_0x40d2b0[_0xba98('0x49')],'action':'originate','channel':_0x40d2b0['channelAgent'],'callerid':util['format'](_0xba98('0x18'),_0x2c5ad4,_0x40d2b0[_0xba98('0x1a')]),'Exten':'xcally-motion-preview','Context':_0xba98('0x4a'),'Priority':'1','variable':_0x319d05,'timeout':(_0x9a5044[_0xba98('0x4b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x40d2b0['uniqueid']};};exports[_0xba98('0x4c')]=function(_0x52d641){return _0x52d641[_0xba98('0x4d')]+_0x52d641[_0xba98('0x4e')]+_0x52d641['countnoanswerretry']+_0x52d641[_0xba98('0x4f')]+_0x52d641[_0xba98('0x50')];};exports[_0xba98('0x51')]=function(_0x2adf4a){var _0x2e8977=_[_0xba98('0x52')](_0x2adf4a);_0x2e8977[_0xba98('0x38')]=0xf;_0x2e8977[_0xba98('0x39')]='Global';return _0x2e8977;};exports[_0xba98('0x53')]=function(_0x465994,_0xef3d9f,_0xa856cf){var _0x31abcd={};_0x31abcd[_0xef3d9f]=_0x465994[_0xef3d9f];_0x31abcd[_0xba98('0x54')]=![];_0x31abcd[_0xba98('0x55')]=moment()[_0xba98('0x56')](_0xa856cf,_0xba98('0x57'))['format'](_0xba98('0x37'));_0x31abcd[_0xba98('0x1b')]=_0x465994[_0xba98('0x1b')];_0x31abcd[_0xba98('0x58')]=_0x465994['ListId'];_0x31abcd[_0xba98('0x1d')]=_0x465994[_0xba98('0x1d')]||undefined;return _0x31abcd;};exports[_0xba98('0x59')]=function(_0x2d54a1,_0x51aba2){if(!_[_0xba98('0x2b')](_0x2d54a1)){if(_0x2d54a1[_0xba98('0x5a')]>0x0){_0x2d54a1['pTalking']-=0x1;}else{logger[_0xba98('0xc')](_0x51aba2,_0xba98('0x5b'));}}else{logger[_0xba98('0xc')](_0x51aba2,_0xba98('0x5c'));}};exports[_0xba98('0x5d')]=function(_0x6856f9){if(_0x6856f9<=0x0){return!![];}return![];};exports[_0xba98('0x5e')]=function(_0x1d5dcd,_0x4fccde,_0x405aa8){_0x1d5dcd[_0xba98('0x5f')]=_0x4fccde;_0x1d5dcd[_0xba98('0x17')]=_0x1d5dcd[_0xba98('0x60')];_0x1d5dcd['interface']=_0x1d5dcd['channelAgent'];_0x1d5dcd[_0xba98('0x61')]=_0xba98('0x62');if(_0x405aa8){_0x1d5dcd[_0xba98('0x63')]=_0x405aa8[_0xba98('0x63')];}return _0x1d5dcd;};exports['buildAcw']=function(_0x4e7733){var _0x5736f8={};_0x5736f8[_0xba98('0x60')]=_0x4e7733[_0xba98('0x60')];_0x5736f8[_0xba98('0x64')]=_0x4e7733[_0xba98('0x65')];_0x5736f8[_0xba98('0x49')]=_0x4e7733[_0xba98('0x49')];return _0x5736f8;};exports[_0xba98('0x66')]=function(_0x5b0c88){var _0x56a342=[];for(var _0x4005eb in _0x5b0c88){if(_0x5b0c88['hasOwnProperty'](_0x4005eb)){if(!_[_0xba98('0x2b')](_0x5b0c88[_0x4005eb])&&_0x5b0c88[_0x4005eb][_0xba98('0x38')]==='not_inuse'&&_0x5b0c88[_0x4005eb][_0xba98('0x67')]===_0xba98('0x68')){_0x56a342[_0xba98('0x69')](_0x5b0c88[_0x4005eb]['id']);}}}return _0x56a342;};exports[_0xba98('0x6a')]=function(_0xf52108){var _0x38a76a=moment()[_0xba98('0x6')](0x0);var _0x310794=moment(_0xf52108)['milliseconds'](0x0);return _0x38a76a['diff'](_0x310794,_0xba98('0x6b'));};exports[_0xba98('0x6c')]=function(_0x681b52){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x681b52[_0xba98('0x1b')],'ListId':_0x681b52[_0xba98('0x58')],'VoiceQueueId':_0x681b52[_0xba98('0x1d')]||undefined,'CampaignId':_0x681b52['CampaignId']||undefined};};exports[_0xba98('0x6d')]=function(_0x44c858){if(_0x44c858===_0xba98('0x49')||_0x44c858===_0xba98('0x6e')||_0x44c858===_0xba98('0x60')||_0x44c858===_0xba98('0x6f')||_0x44c858==='campaigntype'||_0x44c858==='dialAnswer'||_0x44c858===_0xba98('0x3f')||_0x44c858===_0xba98('0x65')||_0x44c858===_0xba98('0x19')||_0x44c858==='active'||_0x44c858==='calleridnum'||_0x44c858===_0xba98('0x55')||_0x44c858==='countbusyretry'||_0x44c858===_0xba98('0x4e')||_0x44c858===_0xba98('0x70')||_0x44c858==='countglobal'||_0x44c858===_0xba98('0x71')||_0x44c858===_0xba98('0x72')||_0x44c858===_0xba98('0x73')||_0x44c858===_0xba98('0x74')||_0x44c858===_0xba98('0x1b')||_0x44c858==='ListId'||_0x44c858===_0xba98('0x40')||_0x44c858===_0xba98('0x1d')||_0x44c858===_0xba98('0x75')||_0x44c858==='xmd-voicequeueid'||_0x44c858===_0xba98('0x76')||_0x44c858===_0xba98('0x77')||_0x44c858===_0xba98('0x78')||_0x44c858===_0xba98('0x79')||_0x44c858===_0xba98('0x7a')||_0x44c858===_0xba98('0x7b')||_0x44c858===_0xba98('0x7c')||_0x44c858===_0xba98('0x7d')||_0x44c858===_0xba98('0x7e')||_0x44c858===_0xba98('0x7f')||_0x44c858===_0xba98('0x80')||_0x44c858===_0xba98('0x81')||_0x44c858===_0xba98('0x82')||_0x44c858===_0xba98('0x83')||_0x44c858===_0xba98('0x84')||_0x44c858==='rtpaudioqosjitter'||_0x44c858===_0xba98('0x85')||_0x44c858===_0xba98('0x86')||_0x44c858===_0xba98('0x87')||_0x44c858===_0xba98('0x88')||_0x44c858==='rtpaudioqosrttbridged'||_0x44c858===_0xba98('0x83')||_0x44c858===_0xba98('0x84')||_0x44c858===_0xba98('0x89')||_0x44c858===_0xba98('0x85')||_0x44c858==='rtpaudioqosloss'||_0x44c858===_0xba98('0x87')||_0x44c858===_0xba98('0x88')||_0x44c858===_0xba98('0x8a')||_0x44c858===_0xba98('0x8b')||_0x44c858===_0xba98('0x8c')||_0x44c858===_0xba98('0x38')||_0x44c858===_0xba98('0x39')){return![];}return!![];};exports[_0xba98('0x8d')]=function(_0x9800fa,_0x575447){var _0xc81f27,_0x2c2975,_0x457bec;if(_0x575447<=0x0){_0x575447=0x1;}_0xc81f27=new RegExp(_0xba98('0x8e')+_0x575447+'}$');_0x2c2975=Math[_0xba98('0x8f')](0xa,_0x575447-0x1);_0x457bec=Math[_0xba98('0x8f')](0xa,_0x575447)-0x1;return util[_0xba98('0x12')]('%s',_[_0xba98('0x90')](_0x9800fa,_0xc81f27,_[_0xba98('0x91')](_0x2c2975,_0x457bec)));};exports[_0xba98('0x92')]=function(_0x268454){var _0x3ba5ce=_0x268454['match'](/"(.*?)"/);return _0x3ba5ce?_0x3ba5ce[0x1]:_0x268454;};exports[_0xba98('0x93')]=function(_0x1a9070){var _0x5103f1=_0x1a9070[_0xba98('0x94')](/<(.*?)>/);return _0x5103f1?_0x5103f1[0x1]:_0x1a9070;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 2cf7582..ec68f57 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 _0x78b4=['queuepause','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','queueremove'];(function(_0x56f352,_0x35361f){var _0x5a1c6e=function(_0x493a4f){while(--_0x493a4f){_0x56f352['push'](_0x56f352['shift']());}};_0x5a1c6e(++_0x35361f);}(_0x78b4,0x73));var _0x478b=function(_0x21d292,_0x2cfcd1){_0x21d292=_0x21d292-0x0;var _0x2a607a=_0x78b4[_0x21d292];return _0x2a607a;};'use strict';exports[_0x478b('0x0')]={'queue':{'type':_0x478b('0x1'),'required':!![]},'interface':{'type':_0x478b('0x1'),'required':!![]},'membername':{'type':_0x478b('0x1'),'required':!![]},'penalty':{'type':_0x478b('0x2'),'required':![]},'paused':{'type':_0x478b('0x3'),'required':![]}};exports[_0x478b('0x4')]={'queue':{'type':_0x478b('0x1'),'required':!![]},'interface':{'type':_0x478b('0x1'),'required':!![]}};exports[_0x478b('0x5')]={'interface':{'type':_0x478b('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':'string','required':![]}};exports['reload']={'module':{'type':_0x478b('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x478b('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x478b('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0x478b('0x1')},'mixmonitorid':{'type':_0x478b('0x1')}};exports[_0x478b('0x6')]={'uniqueid':{'type':_0x478b('0x1'),'required':!![]}};exports[_0x478b('0x7')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x478b('0x1'),'required':!![]},'context':{'type':_0x478b('0x1')}}; \ No newline at end of file +var _0x2bb5=['string','number','boolean','queueremove','queuepause','reload','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2bb5,0x153));var _0x52bb=function(_0x5eaa0b,_0x433b2f){_0x5eaa0b=_0x5eaa0b-0x0;var _0x28b295=_0x2bb5[_0x5eaa0b];return _0x28b295;};'use strict';exports[_0x52bb('0x0')]={'queue':{'type':_0x52bb('0x1'),'required':!![]},'interface':{'type':_0x52bb('0x1'),'required':!![]},'membername':{'type':_0x52bb('0x1'),'required':!![]},'penalty':{'type':_0x52bb('0x2'),'required':![]},'paused':{'type':_0x52bb('0x3'),'required':![]}};exports[_0x52bb('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x52bb('0x1'),'required':!![]}};exports[_0x52bb('0x5')]={'interface':{'type':_0x52bb('0x1'),'required':!![]},'paused':{'type':_0x52bb('0x3')},'reason':{'type':'string','required':![]}};exports[_0x52bb('0x6')]={'module':{'type':'string','required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x52bb('0x1'),'required':!![]}};exports[_0x52bb('0x7')]={'uniqueid':{'type':_0x52bb('0x1'),'required':!![]},'filename':{'type':_0x52bb('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0x52bb('0x1')}};exports[_0x52bb('0x8')]={'uniqueid':{'type':_0x52bb('0x1'),'required':!![]}};exports[_0x52bb('0x9')]={'uniqueid':{'type':_0x52bb('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x52bb('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index fda8aee..e6cb866 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 _0x30c6=['isNil','interface','total','answered','sumBillable','ivrTotalCallsDays','ivrAnswerCallsDay','isEmpty','unmanaged','abandoned','sumHoldTime','sumDuration','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initTelephones','length','initTrunks','initVoiceQueues','voiceQueues','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','lodash','moment','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','name','hasOwnProperty'];(function(_0xdfdefd,_0x184f52){var _0x5ce839=function(_0x5f4bb0){while(--_0x5f4bb0){_0xdfdefd['push'](_0xdfdefd['shift']());}};_0x5ce839(++_0x184f52);}(_0x30c6,0xaa));var _0x630c=function(_0x584ada,_0x1c05c0){_0x584ada=_0x584ada-0x0;var _0x95a50b=_0x30c6[_0x584ada];return _0x95a50b;};'use strict';var BPromise=require(_0x630c('0x0'));var util=require('util');var _=require(_0x630c('0x1'));var moment=require(_0x630c('0x2'));var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require(_0x630c('0x3'));var VoiceQueue=require(_0x630c('0x4'));var Trigger=require(_0x630c('0x5'));var Template=require('../model/template');var Campaign=require(_0x630c('0x6'));var VoiceExtension=require(_0x630c('0x7'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x630c('0x8'));var FreshdeskAccount=require(_0x630c('0x9'));var SugarcrmAccount=require(_0x630c('0xa'));var ZohoAccount=require(_0x630c('0xb'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x630c('0xc'));var ServicenowAccount=require(_0x630c('0xd'));var Dynamics365Account=require(_0x630c('0xe'));var FreshsalesAccount=require(_0x630c('0xf'));var FaxAccount=require(_0x630c('0x10'));var Realtime=function(){this['agents']={};this[_0x630c('0x11')]={};this[_0x630c('0x12')]={};this['voiceQueues']={};this[_0x630c('0x13')]={};this[_0x630c('0x14')]={};this[_0x630c('0x15')]={};this[_0x630c('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x630c('0x17')]={};this[_0x630c('0x18')]={};this[_0x630c('0x19')]={};this['outboundChannels']={};this[_0x630c('0x1a')]={};this['settings']={};this[_0x630c('0x1b')]={};this[_0x630c('0x1c')]={};this[_0x630c('0x1d')]={};this[_0x630c('0x1e')]={};this[_0x630c('0x1f')]={};this[_0x630c('0x20')]={};this[_0x630c('0x21')]={};this[_0x630c('0x22')]={};this['dynamics365Accounts']={};this[_0x630c('0x23')]={};this[_0x630c('0x24')]={};};function freeIsNotKey(_0x5a0e42,_0x257693,_0x962415){var _0x369235=_[_0x630c('0x25')](_0x5a0e42,function(_0x42a209,_0x157e48){return _0x42a209[_0x962415];});for(var _0xc12e43 in _0x257693){if(_0x257693['hasOwnProperty'](_0xc12e43)){if(!_0x369235[_0xc12e43]){delete _0x257693[_0xc12e43];}}}}function freeIsNotKeySip(_0x456852,_0x225f10){var _0x25913f=_[_0x630c('0x25')](_0x456852,function(_0x243e9c,_0x2d387c){return util[_0x630c('0x26')](_0x630c('0x27'),_0x243e9c[_0x630c('0x28')]);});for(var _0x228f1f in _0x225f10){if(_0x225f10[_0x630c('0x29')](_0x228f1f)){if(!_0x25913f[_0x228f1f]){delete _0x225f10[_0x228f1f];}}}}function freeIsNotKeyAgent(_0x104bdc,_0x431738){var _0x34d73e=_[_0x630c('0x25')](_0x104bdc,function(_0x340307,_0x39f13b){var _0x411b61=_[_0x630c('0x2a')](_0x340307[_0x630c('0x2b')])?util[_0x630c('0x26')]('SIP/%s',_0x340307[_0x630c('0x28')]):_0x340307['interface'];return _0x411b61;});for(var _0x2bb353 in _0x431738){if(_0x431738[_0x630c('0x29')](_0x2bb353)){if(!_0x34d73e[_0x2bb353]){delete _0x431738[_0x2bb353];}}}}function clearVoiceCallReports(_0x1e691d){_0x1e691d[_0x630c('0x2c')]=0x0;_0x1e691d[_0x630c('0x2d')]=0x0;_0x1e691d['sumHoldTime']=0x0;_0x1e691d['sumDuration']=0x0;_0x1e691d[_0x630c('0x2e')]=0x0;}function clearCampaigns(_0x362f34){if(!_['isEmpty'](_0x362f34)){for(var _0x310e89 in _0x362f34){if(_0x362f34[_0x630c('0x29')](_0x310e89)){_0x362f34[_0x310e89][_0x630c('0x2f')]=0x0;_0x362f34[_0x310e89][_0x630c('0x30')]=0x0;}}}}function clearVoiceQueues(_0x13c329){if(!_[_0x630c('0x31')](_0x13c329)){for(var _0x85c0c1 in _0x13c329){if(_0x13c329[_0x630c('0x29')](_0x85c0c1)){_0x13c329[_0x85c0c1]['total']=0x0;_0x13c329[_0x85c0c1]['answered']=0x0;_0x13c329[_0x85c0c1][_0x630c('0x32')]=0x0;_0x13c329[_0x85c0c1][_0x630c('0x33')]=0x0;_0x13c329[_0x85c0c1][_0x630c('0x34')]=0x0;_0x13c329[_0x85c0c1][_0x630c('0x35')]=0x0;_0x13c329[_0x85c0c1][_0x630c('0x2e')]=0x0;_0x13c329[_0x85c0c1][_0x630c('0x36')]=0x0;_0x13c329[_0x85c0c1]['outboundNoAnswerCallsDay']=0x0;_0x13c329[_0x85c0c1][_0x630c('0x37')]=0x0;_0x13c329[_0x85c0c1]['outboundCongestionCallsDay']=0x0;_0x13c329[_0x85c0c1]['outboundNoSuchCallsDay']=0x0;_0x13c329[_0x85c0c1][_0x630c('0x38')]=0x0;_0x13c329[_0x85c0c1][_0x630c('0x39')]=0x0;_0x13c329[_0x85c0c1]['outboundDropCallsDayCallersExit']=0x0;_0x13c329[_0x85c0c1]['outboundBlacklistCallsDay']=0x0;_0x13c329[_0x85c0c1][_0x630c('0x3a')]=0x0;_0x13c329[_0x85c0c1]['outboundRejectCallsDay']=0x0;_0x13c329[_0x85c0c1]['outboundReCallsDay']=0x0;_0x13c329[_0x85c0c1][_0x630c('0x36')]=0x0;_0x13c329[_0x85c0c1][_0x630c('0x3b')]=0x0;_0x13c329[_0x85c0c1][_0x630c('0x3c')]=!![];}}}}Realtime[_0x630c('0x3d')][_0x630c('0x3e')]=function(_0x35ef8d,_0x46f42d){for(var _0xaf5693 in _0x46f42d){if(_0x35ef8d[_0x630c('0x29')](_0xaf5693)){_0x35ef8d[_0xaf5693]=_0x46f42d[_0xaf5693];}}};Realtime[_0x630c('0x3d')][_0x630c('0x3f')]=function(){var _0x4134e1=this;return function(_0x1a93b4){if(_0x1a93b4){freeIsNotKeyAgent(_0x1a93b4,_0x4134e1[_0x630c('0x40')]);for(var _0x303564=0x0,_0x50c600={},_0x448709={};_0x303564<_0x1a93b4['length'];_0x303564+=0x1){_0x50c600=_0x1a93b4[_0x303564];var _0x29e166=_[_0x630c('0x2a')](_0x50c600[_0x630c('0x2b')])?util['format'](_0x630c('0x27'),_0x50c600[_0x630c('0x28')]):_0x50c600[_0x630c('0x2b')];if(_[_0x630c('0x41')](_0x4134e1['agents'][_0x29e166])){_0x4134e1['agents'][_0x29e166]=new Agent(_0x50c600);}else{_0x4134e1[_0x630c('0x3e')](_0x4134e1['agents'][_0x29e166],_0x50c600);}}}return _0x4134e1[_0x630c('0x40')];};};Realtime['prototype'][_0x630c('0x42')]=function(){var _0x56cf7b=this;return function(_0x40485b){if(_0x40485b){freeIsNotKeySip(_0x40485b,_0x56cf7b[_0x630c('0x11')]);for(var _0x21376d=0x0,_0x2aef6d={},_0x5abcfa={};_0x21376d<_0x40485b[_0x630c('0x43')];_0x21376d+=0x1){_0x2aef6d=_0x40485b[_0x21376d];if(_['isUndefined'](_0x56cf7b[_0x630c('0x11')][util[_0x630c('0x26')](_0x630c('0x27'),_0x2aef6d[_0x630c('0x28')])])){_0x56cf7b[_0x630c('0x11')][util[_0x630c('0x26')](_0x630c('0x27'),_0x2aef6d[_0x630c('0x28')])]=new Telephone(_0x2aef6d);}else{_0x56cf7b[_0x630c('0x3e')](_0x56cf7b[_0x630c('0x11')][util[_0x630c('0x26')]('SIP/%s',_0x2aef6d[_0x630c('0x28')])],_0x2aef6d);}}}return _0x56cf7b['telephones'];};};Realtime[_0x630c('0x3d')][_0x630c('0x44')]=function(){var _0xf1584f=this;return function(_0xde9e5f){if(_0xde9e5f){freeIsNotKeySip(_0xde9e5f,_0xf1584f[_0x630c('0x12')]);for(var _0x404141=0x0,_0x509081={},_0x394546={};_0x404141<_0xde9e5f[_0x630c('0x43')];_0x404141+=0x1){_0x509081=_0xde9e5f[_0x404141];if(_[_0x630c('0x41')](_0xf1584f[_0x630c('0x12')][util[_0x630c('0x26')](_0x630c('0x27'),_0x509081[_0x630c('0x28')])])){_0xf1584f['trunks'][util[_0x630c('0x26')](_0x630c('0x27'),_0x509081['name'])]=new Trunk(_0x509081);}else{_0xf1584f['mergeFromDatabase'](_0xf1584f[_0x630c('0x12')][util['format']('SIP/%s',_0x509081[_0x630c('0x28')])],_0x509081);}}}return _0xf1584f[_0x630c('0x12')];};};Realtime[_0x630c('0x3d')][_0x630c('0x45')]=function(){var _0x55463d=this;return function(_0x54aad1){if(_0x54aad1){freeIsNotKey(_0x54aad1,_0x55463d[_0x630c('0x46')],_0x630c('0x28'));for(var _0x49eb08=0x0,_0x45c9c4={},_0x17b1e3={};_0x49eb08<_0x54aad1['length'];_0x49eb08+=0x1){_0x45c9c4=_0x54aad1[_0x49eb08];if(_[_0x630c('0x41')](_0x55463d['voiceQueues'][_0x45c9c4[_0x630c('0x28')]])){_0x55463d['voiceQueues'][_0x45c9c4[_0x630c('0x28')]]=new VoiceQueue(_0x45c9c4);}else{_0x55463d[_0x630c('0x3e')](_0x55463d[_0x630c('0x46')][_0x45c9c4['name']],_0x45c9c4);}}}return _0x55463d[_0x630c('0x46')];};};Realtime[_0x630c('0x3d')]['initTriggers']=function(){var _0x390c1e=this;return function(_0x2a69bd){if(_0x2a69bd){freeIsNotKey(_0x2a69bd,_0x390c1e['triggers'],'id');for(var _0xb47519=0x0,_0x420bb3={},_0x3251fd={};_0xb47519<_0x2a69bd[_0x630c('0x43')];_0xb47519+=0x1){_0x420bb3=_0x2a69bd[_0xb47519];if(_[_0x630c('0x41')](_0x390c1e[_0x630c('0x13')][_0x420bb3['id']])){_0x390c1e[_0x630c('0x13')][_0x420bb3['id']]=new Trigger(_0x420bb3);}else{_0x390c1e['mergeFromDatabase'](_0x390c1e['triggers'][_0x420bb3['id']],_0x420bb3);}}}return _0x390c1e[_0x630c('0x13')];};};Realtime[_0x630c('0x3d')][_0x630c('0x47')]=function(){var _0x5996ea=this;return function(_0x51cfb3){if(_0x51cfb3){freeIsNotKey(_0x51cfb3,_0x5996ea['templates'],'id');for(var _0x2037b8=0x0,_0x12817d={},_0x3dc062={};_0x2037b8<_0x51cfb3['length'];_0x2037b8+=0x1){_0x12817d=_0x51cfb3[_0x2037b8];if(_[_0x630c('0x41')](_0x5996ea[_0x630c('0x15')][_0x12817d['id']])){_0x5996ea[_0x630c('0x15')][_0x12817d['id']]=new Template(_0x12817d);}else{_0x5996ea[_0x630c('0x3e')](_0x5996ea[_0x630c('0x15')][_0x12817d['id']],_0x12817d);}}}return _0x5996ea[_0x630c('0x15')];};};Realtime[_0x630c('0x3d')][_0x630c('0x48')]=function(){var _0x50ed16=this;return function(_0x12636e){if(_0x12636e){freeIsNotKey(_0x12636e,_0x50ed16[_0x630c('0x1b')],'id');for(var _0xfc4bde=0x0,_0x39ac56={},_0x5304e7={};_0xfc4bde<_0x12636e[_0x630c('0x43')];_0xfc4bde+=0x1){_0x39ac56=_0x12636e[_0xfc4bde];if(_[_0x630c('0x41')](_0x50ed16[_0x630c('0x1b')][_0x39ac56['id']])){_0x50ed16[_0x630c('0x1b')][_0x39ac56['id']]=new ZendeskAccount(_0x39ac56);}else{_0x50ed16[_0x630c('0x3e')](_0x50ed16[_0x630c('0x1b')][_0x39ac56['id']],_0x39ac56);}}}return _0x50ed16[_0x630c('0x1b')];};};Realtime[_0x630c('0x3d')][_0x630c('0x49')]=function(){var _0x9c9cd2=this;return function(_0x1eb0b4){if(_0x1eb0b4){freeIsNotKey(_0x1eb0b4,_0x9c9cd2[_0x630c('0x1c')],'id');for(var _0x3da1de=0x0,_0x10e731={},_0x239fa5={};_0x3da1de<_0x1eb0b4[_0x630c('0x43')];_0x3da1de+=0x1){_0x10e731=_0x1eb0b4[_0x3da1de];if(_[_0x630c('0x41')](_0x9c9cd2[_0x630c('0x1c')][_0x10e731['id']])){_0x9c9cd2[_0x630c('0x1c')][_0x10e731['id']]=new SalesforceAccount(_0x10e731);}else{_0x9c9cd2[_0x630c('0x3e')](_0x9c9cd2[_0x630c('0x1c')][_0x10e731['id']],_0x10e731);}}}return _0x9c9cd2['salesforceAccounts'];};};Realtime['prototype'][_0x630c('0x4a')]=function(){var _0x8f06f8=this;return function(_0x24dcb0){if(_0x24dcb0){freeIsNotKey(_0x24dcb0,_0x8f06f8['freshdeskAccounts'],'id');for(var _0x2e8e83=0x0,_0x1dbc1b={},_0x2f7cbd={};_0x2e8e83<_0x24dcb0['length'];_0x2e8e83+=0x1){_0x1dbc1b=_0x24dcb0[_0x2e8e83];if(_[_0x630c('0x41')](_0x8f06f8[_0x630c('0x1e')][_0x1dbc1b['id']])){_0x8f06f8['freshdeskAccounts'][_0x1dbc1b['id']]=new FreshdeskAccount(_0x1dbc1b);}else{_0x8f06f8[_0x630c('0x3e')](_0x8f06f8['freshdeskAccounts'][_0x1dbc1b['id']],_0x1dbc1b);}}}return _0x8f06f8[_0x630c('0x1e')];};};Realtime[_0x630c('0x3d')]['initZohoAccounts']=function(){var _0x38d3a1=this;return function(_0x54c738){if(_0x54c738){freeIsNotKey(_0x54c738,_0x38d3a1[_0x630c('0x1f')],'id');for(var _0x130fc4=0x0,_0x4efda7={},_0x43d09e={};_0x130fc4<_0x54c738[_0x630c('0x43')];_0x130fc4+=0x1){_0x4efda7=_0x54c738[_0x130fc4];if(_['isUndefined'](_0x38d3a1['zohoAccounts'][_0x4efda7['id']])){_0x38d3a1[_0x630c('0x1f')][_0x4efda7['id']]=new ZohoAccount(_0x4efda7);}else{_0x38d3a1[_0x630c('0x3e')](_0x38d3a1[_0x630c('0x1f')][_0x4efda7['id']],_0x4efda7);}}}return _0x38d3a1['zohoAccounts'];};};Realtime[_0x630c('0x3d')]['initDeskAccounts']=function(){var _0x27b18b=this;return function(_0x3f2243){if(_0x3f2243){freeIsNotKey(_0x3f2243,_0x27b18b['deskAccounts'],'id');for(var _0x568249=0x0,_0x1613b1={},_0x1cba4a={};_0x568249<_0x3f2243[_0x630c('0x43')];_0x568249+=0x1){_0x1613b1=_0x3f2243[_0x568249];if(_[_0x630c('0x41')](_0x27b18b[_0x630c('0x20')][_0x1613b1['id']])){_0x27b18b[_0x630c('0x20')][_0x1613b1['id']]=new DeskAccount(_0x1613b1);}else{_0x27b18b[_0x630c('0x3e')](_0x27b18b[_0x630c('0x20')][_0x1613b1['id']],_0x1613b1);}}}return _0x27b18b['deskAccounts'];};};Realtime[_0x630c('0x3d')][_0x630c('0x4b')]=function(){var _0x33b09b=this;return function(_0x1c6df4){if(_0x1c6df4){freeIsNotKey(_0x1c6df4,_0x33b09b['sugarcrmAccounts'],'id');for(var _0x4db74a=0x0,_0x4df84b={},_0x5b9fb1={};_0x4db74a<_0x1c6df4['length'];_0x4db74a+=0x1){_0x4df84b=_0x1c6df4[_0x4db74a];if(_['isUndefined'](_0x33b09b[_0x630c('0x1d')][_0x4df84b['id']])){_0x33b09b['sugarcrmAccounts'][_0x4df84b['id']]=new SugarcrmAccount(_0x4df84b);}else{_0x33b09b[_0x630c('0x3e')](_0x33b09b['sugarcrmAccounts'][_0x4df84b['id']],_0x4df84b);}}}return _0x33b09b[_0x630c('0x1d')];};};Realtime[_0x630c('0x3d')][_0x630c('0x4c')]=function(){var _0x47eab7=this;return function(_0x305328){if(_0x305328){freeIsNotKey(_0x305328,_0x47eab7[_0x630c('0x21')],'id');for(var _0x1b1080=0x0,_0x1175da={},_0x15fb13={};_0x1b1080<_0x305328[_0x630c('0x43')];_0x1b1080+=0x1){_0x1175da=_0x305328[_0x1b1080];if(_['isUndefined'](_0x47eab7[_0x630c('0x21')][_0x1175da['id']])){_0x47eab7['vtigerAccounts'][_0x1175da['id']]=new VtigerAccount(_0x1175da);}else{_0x47eab7[_0x630c('0x3e')](_0x47eab7[_0x630c('0x21')][_0x1175da['id']],_0x1175da);}}}return _0x47eab7['vtigerAccounts'];};};Realtime[_0x630c('0x3d')][_0x630c('0x4d')]=function(){var _0x37c549=this;return function(_0xf2404f){if(_0xf2404f){freeIsNotKey(_0xf2404f,_0x37c549[_0x630c('0x22')],'id');for(var _0x50e21a=0x0,_0x1602a8={},_0x196e99={};_0x50e21a<_0xf2404f['length'];_0x50e21a+=0x1){_0x1602a8=_0xf2404f[_0x50e21a];if(_[_0x630c('0x41')](_0x37c549[_0x630c('0x22')][_0x1602a8['id']])){_0x37c549['servicenowAccounts'][_0x1602a8['id']]=new ServicenowAccount(_0x1602a8);}else{_0x37c549[_0x630c('0x3e')](_0x37c549[_0x630c('0x22')][_0x1602a8['id']],_0x1602a8);}}}return _0x37c549[_0x630c('0x22')];};};Realtime['prototype'][_0x630c('0x4e')]=function(){var _0x541f22=this;return function(_0x2e8ad8){if(_0x2e8ad8){freeIsNotKey(_0x2e8ad8,_0x541f22[_0x630c('0x4f')],'id');for(var _0x4f5eab=0x0,_0x20ea53={},_0x353105={};_0x4f5eab<_0x2e8ad8[_0x630c('0x43')];_0x4f5eab+=0x1){_0x20ea53=_0x2e8ad8[_0x4f5eab];if(_[_0x630c('0x41')](_0x541f22[_0x630c('0x4f')][_0x20ea53['id']])){_0x541f22['dynamics365Accounts'][_0x20ea53['id']]=new Dynamics365Account(_0x20ea53);}else{_0x541f22['mergeFromDatabase'](_0x541f22[_0x630c('0x4f')][_0x20ea53['id']],_0x20ea53);}}}return _0x541f22[_0x630c('0x4f')];};};Realtime[_0x630c('0x3d')][_0x630c('0x50')]=function(){var _0x18cf84=this;return function(_0x5e9127){if(_0x5e9127){freeIsNotKey(_0x5e9127,_0x18cf84['freshsalesAccounts'],'id');for(var _0x39d3d4=0x0,_0x4f2e76={},_0x2a3c03={};_0x39d3d4<_0x5e9127[_0x630c('0x43')];_0x39d3d4+=0x1){_0x4f2e76=_0x5e9127[_0x39d3d4];if(_[_0x630c('0x41')](_0x18cf84[_0x630c('0x23')][_0x4f2e76['id']])){_0x18cf84[_0x630c('0x23')][_0x4f2e76['id']]=new FreshsalesAccount(_0x4f2e76);}else{_0x18cf84['mergeFromDatabase'](_0x18cf84[_0x630c('0x23')][_0x4f2e76['id']],_0x4f2e76);}}}return _0x18cf84[_0x630c('0x23')];};};Realtime['prototype'][_0x630c('0x51')]=function(){var _0x33f5cf=this;return function(_0x4eb164){for(var _0x16a212=0x0;_0x16a212<_0x4eb164['length'];_0x16a212+=0x1){_[_0x630c('0x52')](_0x33f5cf[_0x630c('0x46')][_0x4eb164[_0x16a212]['name']],_0x4eb164[_0x16a212]);}return _0x33f5cf[_0x630c('0x46')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x3daaa2=this;return function(_0x1bfb6e){clearVoiceQueues(_0x3daaa2['voiceQueues']);if(_0x1bfb6e){_0x1bfb6e=_[_0x630c('0x53')](_0x1bfb6e,_0x630c('0x54'));for(var _0x391bc8 in _0x1bfb6e){if(_0x1bfb6e[_0x630c('0x29')](_0x391bc8)){var _0x34aa8b={};for(var _0x48c6ef=0x0;_0x48c6ef<_0x1bfb6e[_0x391bc8][_0x630c('0x43')];_0x48c6ef+=0x1){var _0x4c41da=_0x1bfb6e[_0x391bc8][_0x48c6ef][_0x630c('0x55')];if(_0x3daaa2[_0x630c('0x46')][_0x4c41da]){if(_0x1bfb6e[_0x391bc8][_0x48c6ef][_0x630c('0x56')]){_0x3daaa2[_0x630c('0x46')][_0x4c41da][_0x630c('0x32')]+=0x1;}if(_0x1bfb6e[_0x391bc8][_0x48c6ef][_0x630c('0x57')]){_0x3daaa2[_0x630c('0x46')][_0x4c41da]['abandoned']+=0x1;}_0x3daaa2[_0x630c('0x46')][_0x4c41da][_0x630c('0x34')]+=moment(_0x1bfb6e[_0x391bc8][_0x48c6ef][_0x630c('0x58')])[_0x630c('0x59')](moment(_0x1bfb6e[_0x391bc8][_0x48c6ef][_0x630c('0x5a')]),_0x630c('0x5b'))||0x0;if(_0x48c6ef===_0x1bfb6e[_0x391bc8][_0x630c('0x43')]-0x1){_0x3daaa2['voiceQueues'][_0x4c41da][_0x630c('0x35')]+=moment(_0x1bfb6e[_0x391bc8][_0x48c6ef]['queuecallercompleteAt']||_0x1bfb6e[_0x391bc8][_0x48c6ef][_0x630c('0x5c')]||_0x1bfb6e[_0x391bc8][_0x48c6ef]['queuecallerexitAt'])[_0x630c('0x59')](moment(_0x1bfb6e[_0x391bc8][_0x48c6ef][_0x630c('0x5a')]),'seconds')||0x0;_0x3daaa2[_0x630c('0x46')][_0x4c41da]['total']+=0x1;if(_0x1bfb6e[_0x391bc8][_0x48c6ef][_0x630c('0x5d')]){_0x3daaa2[_0x630c('0x46')][_0x4c41da]['answered']+=0x1;_0x3daaa2['voiceQueues'][_0x4c41da]['sumBillable']+=moment(_0x1bfb6e[_0x391bc8][_0x48c6ef]['queuecallercompleteAt'])[_0x630c('0x59')](moment(_0x1bfb6e[_0x391bc8][_0x48c6ef]['queuecallerleaveAt']),_0x630c('0x5b'))||0x0;}}else{_0x3daaa2[_0x630c('0x46')][_0x4c41da]['sumDuration']+=_0x3daaa2['voiceQueues'][_0x4c41da][_0x630c('0x34')]||0x0;}}}}}}return _0x3daaa2[_0x630c('0x46')];};};Realtime['prototype'][_0x630c('0x5e')]=function(){var _0x485687=this;return function(_0x21cb42){clearVoiceCallReports(_0x485687['outbound']);if(_0x21cb42){for(var _0x3790da=0x0;_0x3790da<_0x21cb42['length'];_0x3790da+=0x1){_0x485687[_0x630c('0x16')][_0x630c('0x2c')]+=0x1;_0x485687[_0x630c('0x16')][_0x630c('0x35')]+=_0x21cb42[_0x3790da][_0x630c('0x5f')];if(_0x21cb42[_0x3790da][_0x630c('0x60')]===_0x630c('0x61')){_0x485687[_0x630c('0x16')]['answered']+=0x1;_0x485687[_0x630c('0x16')][_0x630c('0x34')]+=_0x21cb42[_0x3790da][_0x630c('0x5f')]-_0x21cb42[_0x3790da][_0x630c('0x62')]||0x0;_0x485687[_0x630c('0x16')]['sumBillable']+=_0x21cb42[_0x3790da][_0x630c('0x62')];}}}return _0x485687['outbound'];};};Realtime[_0x630c('0x3d')][_0x630c('0x63')]=function(){var _0x42cc56=this;return function(_0x5a97f3){if(_0x5a97f3){freeIsNotKey(_0x5a97f3,_0x42cc56[_0x630c('0x14')],_0x630c('0x28'));for(var _0x308a18=0x0,_0x4ea481={};_0x308a18<_0x5a97f3[_0x630c('0x43')];_0x308a18+=0x1){_0x4ea481=_0x5a97f3[_0x308a18];if(_[_0x630c('0x41')](_0x42cc56[_0x630c('0x14')][_0x4ea481['name']])){_0x42cc56[_0x630c('0x14')][_0x4ea481[_0x630c('0x28')]]=new Campaign(_0x4ea481);}else{_0x42cc56['mergeFromDatabase'](_0x42cc56['campaigns'][_0x4ea481[_0x630c('0x28')]],_0x4ea481);_0x42cc56[_0x630c('0x14')][_0x4ea481[_0x630c('0x28')]][_0x630c('0x64')]=_0x4ea481[_0x630c('0x65')]?_0x4ea481[_0x630c('0x65')][_0x630c('0x28')]:undefined;}}}return _0x42cc56[_0x630c('0x14')];};};Realtime[_0x630c('0x3d')][_0x630c('0x66')]=function(){var _0x260d5e=this;return function(_0x106414){if(_0x106414){freeIsNotKey(_0x106414,_0x260d5e['voiceExtensions'],'id');for(var _0x677bb=0x0,_0x4b349d={};_0x677bb<_0x106414[_0x630c('0x43')];_0x677bb+=0x1){_0x4b349d=_0x106414[_0x677bb];if(_[_0x630c('0x41')](_0x260d5e[_0x630c('0x17')][_0x4b349d['id']])){_0x260d5e[_0x630c('0x17')][_0x4b349d['id']]=new VoiceExtension(_0x4b349d);}else{_0x260d5e[_0x630c('0x3e')](_0x260d5e['voiceExtensions'][_0x4b349d['id']],_0x4b349d);}}}return _0x260d5e['voiceExtensions'];};};Realtime[_0x630c('0x3d')][_0x630c('0x67')]=function(){var _0x46e336=this;return function(_0x4d4629){clearCampaigns(_0x46e336['campaigns']);for(var _0x51c9e5=0x0;_0x51c9e5<_0x4d4629['length'];_0x51c9e5+=0x1){_[_0x630c('0x52')](_0x46e336[_0x630c('0x14')][_0x4d4629[_0x51c9e5][_0x630c('0x28')]],_0x4d4629[_0x51c9e5]);}return _0x46e336['campaigns'];};};Realtime[_0x630c('0x3d')][_0x630c('0x68')]=function(){var _0x5eb8ec=this;return function(_0x45f5fd){if(_0x45f5fd){freeIsNotKey(_0x45f5fd,_0x5eb8ec['faxAccounts'],'id');for(var _0x1537a4=0x0,_0x1b6064={},_0x4ba95f={};_0x1537a4<_0x45f5fd['length'];_0x1537a4+=0x1){_0x1b6064=_0x45f5fd[_0x1537a4];if(_[_0x630c('0x41')](_0x5eb8ec['faxAccounts'][_0x1b6064['id']])){_0x5eb8ec['faxAccounts'][_0x1b6064['id']]=new FaxAccount(_0x1b6064);}else{_0x5eb8ec[_0x630c('0x3e')](_0x5eb8ec[_0x630c('0x24')][_0x1b6064['id']],_0x1b6064);}}}return _0x5eb8ec[_0x630c('0x24')];};};module[_0x630c('0x69')]=Realtime; \ No newline at end of file +var _0x39d7=['hasOwnProperty','format','SIP/%s','name','isNil','interface','total','answered','sumHoldTime','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','abandoned','sumBillable','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','agents','initTelephones','initTrunks','isUndefined','initVoiceQueues','voiceQueues','initTriggers','initZendeskAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','uniqueid','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/template','../model/voiceExtension','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/freshsalesAccount','telephones','trunks','triggers','campaigns','templates','voiceExtensions','channels','queueChannels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys'];(function(_0xea35d1,_0x302471){var _0x1d7a7c=function(_0x1bc101){while(--_0x1bc101){_0xea35d1['push'](_0xea35d1['shift']());}};_0x1d7a7c(++_0x302471);}(_0x39d7,0x1da));var _0x739d=function(_0x44659e,_0x31137a){_0x44659e=_0x44659e-0x0;var _0x378e57=_0x39d7[_0x44659e];return _0x378e57;};'use strict';var BPromise=require(_0x739d('0x0'));var util=require(_0x739d('0x1'));var _=require('lodash');var moment=require('moment');var Agent=require(_0x739d('0x2'));var Telephone=require(_0x739d('0x3'));var Trunk=require(_0x739d('0x4'));var VoiceQueue=require(_0x739d('0x5'));var Trigger=require('../model/trigger');var Template=require(_0x739d('0x6'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0x739d('0x7'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x739d('0x8'));var SugarcrmAccount=require(_0x739d('0x9'));var ZohoAccount=require(_0x739d('0xa'));var DeskAccount=require(_0x739d('0xb'));var VtigerAccount=require(_0x739d('0xc'));var ServicenowAccount=require(_0x739d('0xd'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0x739d('0xe'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this['agents']={};this[_0x739d('0xf')]={};this[_0x739d('0x10')]={};this['voiceQueues']={};this[_0x739d('0x11')]={};this[_0x739d('0x12')]={};this[_0x739d('0x13')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x739d('0x14')]={};this[_0x739d('0x15')]={};this[_0x739d('0x16')]={};this['outboundChannels']={};this[_0x739d('0x17')]={};this[_0x739d('0x18')]={};this[_0x739d('0x19')]={};this[_0x739d('0x1a')]={};this[_0x739d('0x1b')]={};this['freshdeskAccounts']={};this[_0x739d('0x1c')]={};this[_0x739d('0x1d')]={};this[_0x739d('0x1e')]={};this[_0x739d('0x1f')]={};this[_0x739d('0x20')]={};this[_0x739d('0x21')]={};this[_0x739d('0x22')]={};};function freeIsNotKey(_0x5f08a2,_0x86c08e,_0x7f4868){var _0xfb3b99=_[_0x739d('0x23')](_0x5f08a2,function(_0x15049c,_0x4dde80){return _0x15049c[_0x7f4868];});for(var _0x2eff06 in _0x86c08e){if(_0x86c08e[_0x739d('0x24')](_0x2eff06)){if(!_0xfb3b99[_0x2eff06]){delete _0x86c08e[_0x2eff06];}}}}function freeIsNotKeySip(_0x414d93,_0x665ef5){var _0x52a0a8=_['mapKeys'](_0x414d93,function(_0x2f6bab,_0x47c2cd){return util[_0x739d('0x25')](_0x739d('0x26'),_0x2f6bab[_0x739d('0x27')]);});for(var _0x3718f4 in _0x665ef5){if(_0x665ef5[_0x739d('0x24')](_0x3718f4)){if(!_0x52a0a8[_0x3718f4]){delete _0x665ef5[_0x3718f4];}}}}function freeIsNotKeyAgent(_0x514b8d,_0x550b8a){var _0x7d8aec=_['mapKeys'](_0x514b8d,function(_0x19216c,_0x31c892){var _0x1d93b0=_[_0x739d('0x28')](_0x19216c[_0x739d('0x29')])?util[_0x739d('0x25')](_0x739d('0x26'),_0x19216c[_0x739d('0x27')]):_0x19216c[_0x739d('0x29')];return _0x1d93b0;});for(var _0x92a8dd in _0x550b8a){if(_0x550b8a[_0x739d('0x24')](_0x92a8dd)){if(!_0x7d8aec[_0x92a8dd]){delete _0x550b8a[_0x92a8dd];}}}}function clearVoiceCallReports(_0x31fc60){_0x31fc60[_0x739d('0x2a')]=0x0;_0x31fc60[_0x739d('0x2b')]=0x0;_0x31fc60[_0x739d('0x2c')]=0x0;_0x31fc60[_0x739d('0x2d')]=0x0;_0x31fc60['sumBillable']=0x0;}function clearCampaigns(_0x196553){if(!_[_0x739d('0x2e')](_0x196553)){for(var _0x399306 in _0x196553){if(_0x196553[_0x739d('0x24')](_0x399306)){_0x196553[_0x399306][_0x739d('0x2f')]=0x0;_0x196553[_0x399306][_0x739d('0x30')]=0x0;}}}}function clearVoiceQueues(_0xed5f43){if(!_[_0x739d('0x2e')](_0xed5f43)){for(var _0x594c46 in _0xed5f43){if(_0xed5f43[_0x739d('0x24')](_0x594c46)){_0xed5f43[_0x594c46]['total']=0x0;_0xed5f43[_0x594c46][_0x739d('0x2b')]=0x0;_0xed5f43[_0x594c46]['unmanaged']=0x0;_0xed5f43[_0x594c46][_0x739d('0x31')]=0x0;_0xed5f43[_0x594c46][_0x739d('0x2c')]=0x0;_0xed5f43[_0x594c46][_0x739d('0x2d')]=0x0;_0xed5f43[_0x594c46][_0x739d('0x32')]=0x0;_0xed5f43[_0x594c46]['outboundAnswerAgiCallsDay']=0x0;_0xed5f43[_0x594c46]['outboundNoAnswerCallsDay']=0x0;_0xed5f43[_0x594c46][_0x739d('0x33')]=0x0;_0xed5f43[_0x594c46][_0x739d('0x34')]=0x0;_0xed5f43[_0x594c46]['outboundNoSuchCallsDay']=0x0;_0xed5f43[_0x594c46][_0x739d('0x35')]=0x0;_0xed5f43[_0x594c46]['outboundDropCallsDayTimeout']=0x0;_0xed5f43[_0x594c46]['outboundDropCallsDayCallersExit']=0x0;_0xed5f43[_0x594c46]['outboundBlacklistCallsDay']=0x0;_0xed5f43[_0x594c46][_0x739d('0x36')]=0x0;_0xed5f43[_0x594c46][_0x739d('0x37')]=0x0;_0xed5f43[_0x594c46][_0x739d('0x38')]=0x0;_0xed5f43[_0x594c46][_0x739d('0x39')]=0x0;_0xed5f43[_0x594c46][_0x739d('0x3a')]=0x0;_0xed5f43[_0x594c46][_0x739d('0x3b')]=!![];}}}}Realtime[_0x739d('0x3c')][_0x739d('0x3d')]=function(_0x49ace9,_0x3fd56a){for(var _0x36b3fc in _0x3fd56a){if(_0x49ace9[_0x739d('0x24')](_0x36b3fc)){_0x49ace9[_0x36b3fc]=_0x3fd56a[_0x36b3fc];}}};Realtime[_0x739d('0x3c')]['initAgents']=function(){var _0x295496=this;return function(_0x2a1f1f){if(_0x2a1f1f){freeIsNotKeyAgent(_0x2a1f1f,_0x295496['agents']);for(var _0x20af05=0x0,_0x282a0a={},_0x55f017={};_0x20af05<_0x2a1f1f[_0x739d('0x3e')];_0x20af05+=0x1){_0x282a0a=_0x2a1f1f[_0x20af05];var _0x59437d=_[_0x739d('0x28')](_0x282a0a['interface'])?util['format'](_0x739d('0x26'),_0x282a0a['name']):_0x282a0a['interface'];if(_['isUndefined'](_0x295496[_0x739d('0x3f')][_0x59437d])){_0x295496[_0x739d('0x3f')][_0x59437d]=new Agent(_0x282a0a);}else{_0x295496[_0x739d('0x3d')](_0x295496[_0x739d('0x3f')][_0x59437d],_0x282a0a);}}}return _0x295496[_0x739d('0x3f')];};};Realtime[_0x739d('0x3c')][_0x739d('0x40')]=function(){var _0x486d5d=this;return function(_0x55cafb){if(_0x55cafb){freeIsNotKeySip(_0x55cafb,_0x486d5d[_0x739d('0xf')]);for(var _0x3ee0c0=0x0,_0x5c59de={},_0x209788={};_0x3ee0c0<_0x55cafb[_0x739d('0x3e')];_0x3ee0c0+=0x1){_0x5c59de=_0x55cafb[_0x3ee0c0];if(_['isUndefined'](_0x486d5d[_0x739d('0xf')][util[_0x739d('0x25')]('SIP/%s',_0x5c59de['name'])])){_0x486d5d[_0x739d('0xf')][util[_0x739d('0x25')](_0x739d('0x26'),_0x5c59de[_0x739d('0x27')])]=new Telephone(_0x5c59de);}else{_0x486d5d[_0x739d('0x3d')](_0x486d5d[_0x739d('0xf')][util[_0x739d('0x25')](_0x739d('0x26'),_0x5c59de[_0x739d('0x27')])],_0x5c59de);}}}return _0x486d5d[_0x739d('0xf')];};};Realtime[_0x739d('0x3c')][_0x739d('0x41')]=function(){var _0x4a122c=this;return function(_0x52b379){if(_0x52b379){freeIsNotKeySip(_0x52b379,_0x4a122c[_0x739d('0x10')]);for(var _0x2d68a1=0x0,_0x1bb5f9={},_0xe46bbe={};_0x2d68a1<_0x52b379[_0x739d('0x3e')];_0x2d68a1+=0x1){_0x1bb5f9=_0x52b379[_0x2d68a1];if(_[_0x739d('0x42')](_0x4a122c['trunks'][util[_0x739d('0x25')](_0x739d('0x26'),_0x1bb5f9[_0x739d('0x27')])])){_0x4a122c[_0x739d('0x10')][util[_0x739d('0x25')](_0x739d('0x26'),_0x1bb5f9[_0x739d('0x27')])]=new Trunk(_0x1bb5f9);}else{_0x4a122c[_0x739d('0x3d')](_0x4a122c['trunks'][util[_0x739d('0x25')](_0x739d('0x26'),_0x1bb5f9[_0x739d('0x27')])],_0x1bb5f9);}}}return _0x4a122c['trunks'];};};Realtime['prototype'][_0x739d('0x43')]=function(){var _0xbbdcb0=this;return function(_0x28f836){if(_0x28f836){freeIsNotKey(_0x28f836,_0xbbdcb0[_0x739d('0x44')],_0x739d('0x27'));for(var _0x1f555e=0x0,_0x24dc72={},_0xec0ec7={};_0x1f555e<_0x28f836[_0x739d('0x3e')];_0x1f555e+=0x1){_0x24dc72=_0x28f836[_0x1f555e];if(_[_0x739d('0x42')](_0xbbdcb0['voiceQueues'][_0x24dc72['name']])){_0xbbdcb0['voiceQueues'][_0x24dc72[_0x739d('0x27')]]=new VoiceQueue(_0x24dc72);}else{_0xbbdcb0['mergeFromDatabase'](_0xbbdcb0[_0x739d('0x44')][_0x24dc72['name']],_0x24dc72);}}}return _0xbbdcb0['voiceQueues'];};};Realtime[_0x739d('0x3c')][_0x739d('0x45')]=function(){var _0x2c139d=this;return function(_0x440012){if(_0x440012){freeIsNotKey(_0x440012,_0x2c139d[_0x739d('0x11')],'id');for(var _0x41cc3f=0x0,_0x11cbca={},_0x3fbed4={};_0x41cc3f<_0x440012[_0x739d('0x3e')];_0x41cc3f+=0x1){_0x11cbca=_0x440012[_0x41cc3f];if(_[_0x739d('0x42')](_0x2c139d[_0x739d('0x11')][_0x11cbca['id']])){_0x2c139d[_0x739d('0x11')][_0x11cbca['id']]=new Trigger(_0x11cbca);}else{_0x2c139d[_0x739d('0x3d')](_0x2c139d[_0x739d('0x11')][_0x11cbca['id']],_0x11cbca);}}}return _0x2c139d[_0x739d('0x11')];};};Realtime[_0x739d('0x3c')]['initTemplates']=function(){var _0x3a9b56=this;return function(_0x317ea6){if(_0x317ea6){freeIsNotKey(_0x317ea6,_0x3a9b56[_0x739d('0x13')],'id');for(var _0x2b3a3c=0x0,_0x3a82d1={},_0x26e3f5={};_0x2b3a3c<_0x317ea6[_0x739d('0x3e')];_0x2b3a3c+=0x1){_0x3a82d1=_0x317ea6[_0x2b3a3c];if(_['isUndefined'](_0x3a9b56['templates'][_0x3a82d1['id']])){_0x3a9b56[_0x739d('0x13')][_0x3a82d1['id']]=new Template(_0x3a82d1);}else{_0x3a9b56[_0x739d('0x3d')](_0x3a9b56[_0x739d('0x13')][_0x3a82d1['id']],_0x3a82d1);}}}return _0x3a9b56[_0x739d('0x13')];};};Realtime[_0x739d('0x3c')][_0x739d('0x46')]=function(){var _0x49dcbd=this;return function(_0x23aa7d){if(_0x23aa7d){freeIsNotKey(_0x23aa7d,_0x49dcbd[_0x739d('0x19')],'id');for(var _0x5c97a6=0x0,_0x2aa046={},_0x51a19a={};_0x5c97a6<_0x23aa7d[_0x739d('0x3e')];_0x5c97a6+=0x1){_0x2aa046=_0x23aa7d[_0x5c97a6];if(_[_0x739d('0x42')](_0x49dcbd[_0x739d('0x19')][_0x2aa046['id']])){_0x49dcbd[_0x739d('0x19')][_0x2aa046['id']]=new ZendeskAccount(_0x2aa046);}else{_0x49dcbd[_0x739d('0x3d')](_0x49dcbd[_0x739d('0x19')][_0x2aa046['id']],_0x2aa046);}}}return _0x49dcbd[_0x739d('0x19')];};};Realtime[_0x739d('0x3c')]['initSalesforceAccounts']=function(){var _0x2fb173=this;return function(_0x416bf4){if(_0x416bf4){freeIsNotKey(_0x416bf4,_0x2fb173[_0x739d('0x1a')],'id');for(var _0x4f8c98=0x0,_0x3f31ef={},_0x6b7d6a={};_0x4f8c98<_0x416bf4[_0x739d('0x3e')];_0x4f8c98+=0x1){_0x3f31ef=_0x416bf4[_0x4f8c98];if(_[_0x739d('0x42')](_0x2fb173[_0x739d('0x1a')][_0x3f31ef['id']])){_0x2fb173[_0x739d('0x1a')][_0x3f31ef['id']]=new SalesforceAccount(_0x3f31ef);}else{_0x2fb173[_0x739d('0x3d')](_0x2fb173[_0x739d('0x1a')][_0x3f31ef['id']],_0x3f31ef);}}}return _0x2fb173[_0x739d('0x1a')];};};Realtime[_0x739d('0x3c')][_0x739d('0x47')]=function(){var _0x2eed17=this;return function(_0x1add24){if(_0x1add24){freeIsNotKey(_0x1add24,_0x2eed17[_0x739d('0x48')],'id');for(var _0x27c74b=0x0,_0x2ba0f4={},_0x134335={};_0x27c74b<_0x1add24[_0x739d('0x3e')];_0x27c74b+=0x1){_0x2ba0f4=_0x1add24[_0x27c74b];if(_[_0x739d('0x42')](_0x2eed17['freshdeskAccounts'][_0x2ba0f4['id']])){_0x2eed17['freshdeskAccounts'][_0x2ba0f4['id']]=new FreshdeskAccount(_0x2ba0f4);}else{_0x2eed17['mergeFromDatabase'](_0x2eed17[_0x739d('0x48')][_0x2ba0f4['id']],_0x2ba0f4);}}}return _0x2eed17[_0x739d('0x48')];};};Realtime[_0x739d('0x3c')][_0x739d('0x49')]=function(){var _0x3ec602=this;return function(_0x543aea){if(_0x543aea){freeIsNotKey(_0x543aea,_0x3ec602[_0x739d('0x1c')],'id');for(var _0x88a586=0x0,_0x2702b3={},_0x15c731={};_0x88a586<_0x543aea['length'];_0x88a586+=0x1){_0x2702b3=_0x543aea[_0x88a586];if(_[_0x739d('0x42')](_0x3ec602[_0x739d('0x1c')][_0x2702b3['id']])){_0x3ec602['zohoAccounts'][_0x2702b3['id']]=new ZohoAccount(_0x2702b3);}else{_0x3ec602[_0x739d('0x3d')](_0x3ec602['zohoAccounts'][_0x2702b3['id']],_0x2702b3);}}}return _0x3ec602[_0x739d('0x1c')];};};Realtime[_0x739d('0x3c')][_0x739d('0x4a')]=function(){var _0x4fabe4=this;return function(_0x2f4bf4){if(_0x2f4bf4){freeIsNotKey(_0x2f4bf4,_0x4fabe4[_0x739d('0x1d')],'id');for(var _0x2aa328=0x0,_0x336187={},_0x30f72b={};_0x2aa328<_0x2f4bf4[_0x739d('0x3e')];_0x2aa328+=0x1){_0x336187=_0x2f4bf4[_0x2aa328];if(_['isUndefined'](_0x4fabe4['deskAccounts'][_0x336187['id']])){_0x4fabe4[_0x739d('0x1d')][_0x336187['id']]=new DeskAccount(_0x336187);}else{_0x4fabe4[_0x739d('0x3d')](_0x4fabe4['deskAccounts'][_0x336187['id']],_0x336187);}}}return _0x4fabe4[_0x739d('0x1d')];};};Realtime[_0x739d('0x3c')]['initSugarcrmAccounts']=function(){var _0x42d2df=this;return function(_0x226ce9){if(_0x226ce9){freeIsNotKey(_0x226ce9,_0x42d2df[_0x739d('0x1b')],'id');for(var _0x2def85=0x0,_0x7d6348={},_0x5aab85={};_0x2def85<_0x226ce9['length'];_0x2def85+=0x1){_0x7d6348=_0x226ce9[_0x2def85];if(_[_0x739d('0x42')](_0x42d2df['sugarcrmAccounts'][_0x7d6348['id']])){_0x42d2df['sugarcrmAccounts'][_0x7d6348['id']]=new SugarcrmAccount(_0x7d6348);}else{_0x42d2df[_0x739d('0x3d')](_0x42d2df['sugarcrmAccounts'][_0x7d6348['id']],_0x7d6348);}}}return _0x42d2df[_0x739d('0x1b')];};};Realtime[_0x739d('0x3c')][_0x739d('0x4b')]=function(){var _0x202e56=this;return function(_0x2a419b){if(_0x2a419b){freeIsNotKey(_0x2a419b,_0x202e56[_0x739d('0x1e')],'id');for(var _0xc64307=0x0,_0x10730f={},_0x162c82={};_0xc64307<_0x2a419b['length'];_0xc64307+=0x1){_0x10730f=_0x2a419b[_0xc64307];if(_[_0x739d('0x42')](_0x202e56[_0x739d('0x1e')][_0x10730f['id']])){_0x202e56['vtigerAccounts'][_0x10730f['id']]=new VtigerAccount(_0x10730f);}else{_0x202e56['mergeFromDatabase'](_0x202e56['vtigerAccounts'][_0x10730f['id']],_0x10730f);}}}return _0x202e56[_0x739d('0x1e')];};};Realtime[_0x739d('0x3c')][_0x739d('0x4c')]=function(){var _0x2252b9=this;return function(_0x2b433e){if(_0x2b433e){freeIsNotKey(_0x2b433e,_0x2252b9[_0x739d('0x1f')],'id');for(var _0x406b24=0x0,_0x2fab1c={},_0x32c912={};_0x406b24<_0x2b433e['length'];_0x406b24+=0x1){_0x2fab1c=_0x2b433e[_0x406b24];if(_[_0x739d('0x42')](_0x2252b9[_0x739d('0x1f')][_0x2fab1c['id']])){_0x2252b9[_0x739d('0x1f')][_0x2fab1c['id']]=new ServicenowAccount(_0x2fab1c);}else{_0x2252b9[_0x739d('0x3d')](_0x2252b9[_0x739d('0x1f')][_0x2fab1c['id']],_0x2fab1c);}}}return _0x2252b9[_0x739d('0x1f')];};};Realtime['prototype'][_0x739d('0x4d')]=function(){var _0x2c31a1=this;return function(_0xf89ab5){if(_0xf89ab5){freeIsNotKey(_0xf89ab5,_0x2c31a1[_0x739d('0x20')],'id');for(var _0x29267f=0x0,_0x197a16={},_0x492914={};_0x29267f<_0xf89ab5['length'];_0x29267f+=0x1){_0x197a16=_0xf89ab5[_0x29267f];if(_['isUndefined'](_0x2c31a1['dynamics365Accounts'][_0x197a16['id']])){_0x2c31a1[_0x739d('0x20')][_0x197a16['id']]=new Dynamics365Account(_0x197a16);}else{_0x2c31a1[_0x739d('0x3d')](_0x2c31a1['dynamics365Accounts'][_0x197a16['id']],_0x197a16);}}}return _0x2c31a1['dynamics365Accounts'];};};Realtime[_0x739d('0x3c')][_0x739d('0x4e')]=function(){var _0x29494b=this;return function(_0x118c40){if(_0x118c40){freeIsNotKey(_0x118c40,_0x29494b[_0x739d('0x21')],'id');for(var _0x4268d0=0x0,_0x5d4520={},_0x35ad4c={};_0x4268d0<_0x118c40[_0x739d('0x3e')];_0x4268d0+=0x1){_0x5d4520=_0x118c40[_0x4268d0];if(_[_0x739d('0x42')](_0x29494b[_0x739d('0x21')][_0x5d4520['id']])){_0x29494b[_0x739d('0x21')][_0x5d4520['id']]=new FreshsalesAccount(_0x5d4520);}else{_0x29494b['mergeFromDatabase'](_0x29494b[_0x739d('0x21')][_0x5d4520['id']],_0x5d4520);}}}return _0x29494b[_0x739d('0x21')];};};Realtime[_0x739d('0x3c')][_0x739d('0x4f')]=function(){var _0x5bc8f9=this;return function(_0x420c63){for(var _0x36acde=0x0;_0x36acde<_0x420c63['length'];_0x36acde+=0x1){_[_0x739d('0x50')](_0x5bc8f9[_0x739d('0x44')][_0x420c63[_0x36acde][_0x739d('0x27')]],_0x420c63[_0x36acde]);}return _0x5bc8f9[_0x739d('0x44')];};};Realtime[_0x739d('0x3c')]['initVoiceQueueReports']=function(){var _0x5e8f9a=this;return function(_0x324950){clearVoiceQueues(_0x5e8f9a[_0x739d('0x44')]);if(_0x324950){_0x324950=_['groupBy'](_0x324950,_0x739d('0x51'));for(var _0x55b208 in _0x324950){if(_0x324950[_0x739d('0x24')](_0x55b208)){var _0x1b3cb0={};for(var _0x507018=0x0;_0x507018<_0x324950[_0x55b208]['length'];_0x507018+=0x1){var _0x378b1f=_0x324950[_0x55b208][_0x507018]['queue'];if(_0x5e8f9a[_0x739d('0x44')][_0x378b1f]){if(_0x324950[_0x55b208][_0x507018][_0x739d('0x52')]){_0x5e8f9a['voiceQueues'][_0x378b1f]['unmanaged']+=0x1;}if(_0x324950[_0x55b208][_0x507018][_0x739d('0x53')]){_0x5e8f9a[_0x739d('0x44')][_0x378b1f]['abandoned']+=0x1;}_0x5e8f9a['voiceQueues'][_0x378b1f][_0x739d('0x2c')]+=moment(_0x324950[_0x55b208][_0x507018][_0x739d('0x54')])[_0x739d('0x55')](moment(_0x324950[_0x55b208][_0x507018][_0x739d('0x56')]),_0x739d('0x57'))||0x0;if(_0x507018===_0x324950[_0x55b208][_0x739d('0x3e')]-0x1){_0x5e8f9a['voiceQueues'][_0x378b1f]['sumDuration']+=moment(_0x324950[_0x55b208][_0x507018]['queuecallercompleteAt']||_0x324950[_0x55b208][_0x507018][_0x739d('0x58')]||_0x324950[_0x55b208][_0x507018][_0x739d('0x59')])[_0x739d('0x55')](moment(_0x324950[_0x55b208][_0x507018]['queuecallerjoinAt']),_0x739d('0x57'))||0x0;_0x5e8f9a[_0x739d('0x44')][_0x378b1f][_0x739d('0x2a')]+=0x1;if(_0x324950[_0x55b208][_0x507018][_0x739d('0x5a')]){_0x5e8f9a[_0x739d('0x44')][_0x378b1f]['answered']+=0x1;_0x5e8f9a[_0x739d('0x44')][_0x378b1f][_0x739d('0x32')]+=moment(_0x324950[_0x55b208][_0x507018]['queuecallercompleteAt'])['diff'](moment(_0x324950[_0x55b208][_0x507018][_0x739d('0x54')]),_0x739d('0x57'))||0x0;}}else{_0x5e8f9a['voiceQueues'][_0x378b1f]['sumDuration']+=_0x5e8f9a[_0x739d('0x44')][_0x378b1f][_0x739d('0x2c')]||0x0;}}}}}}return _0x5e8f9a[_0x739d('0x44')];};};Realtime[_0x739d('0x3c')][_0x739d('0x5b')]=function(){var _0x30b9cd=this;return function(_0x22bd06){clearVoiceCallReports(_0x30b9cd[_0x739d('0x5c')]);if(_0x22bd06){for(var _0x187ae6=0x0;_0x187ae6<_0x22bd06['length'];_0x187ae6+=0x1){_0x30b9cd[_0x739d('0x5c')][_0x739d('0x2a')]+=0x1;_0x30b9cd[_0x739d('0x5c')][_0x739d('0x2d')]+=_0x22bd06[_0x187ae6][_0x739d('0x5d')];if(_0x22bd06[_0x187ae6]['disposition']===_0x739d('0x5e')){_0x30b9cd[_0x739d('0x5c')][_0x739d('0x2b')]+=0x1;_0x30b9cd[_0x739d('0x5c')][_0x739d('0x2c')]+=_0x22bd06[_0x187ae6][_0x739d('0x5d')]-_0x22bd06[_0x187ae6]['billableseconds']||0x0;_0x30b9cd['outbound'][_0x739d('0x32')]+=_0x22bd06[_0x187ae6][_0x739d('0x5f')];}}}return _0x30b9cd['outbound'];};};Realtime[_0x739d('0x3c')][_0x739d('0x60')]=function(){var _0x200998=this;return function(_0x28374d){if(_0x28374d){freeIsNotKey(_0x28374d,_0x200998[_0x739d('0x12')],_0x739d('0x27'));for(var _0x8e1965=0x0,_0x2b94fb={};_0x8e1965<_0x28374d['length'];_0x8e1965+=0x1){_0x2b94fb=_0x28374d[_0x8e1965];if(_[_0x739d('0x42')](_0x200998[_0x739d('0x12')][_0x2b94fb[_0x739d('0x27')]])){_0x200998[_0x739d('0x12')][_0x2b94fb['name']]=new Campaign(_0x2b94fb);}else{_0x200998['mergeFromDatabase'](_0x200998[_0x739d('0x12')][_0x2b94fb['name']],_0x2b94fb);_0x200998[_0x739d('0x12')][_0x2b94fb[_0x739d('0x27')]][_0x739d('0x61')]=_0x2b94fb['SquareProject']?_0x2b94fb[_0x739d('0x62')][_0x739d('0x27')]:undefined;}}}return _0x200998[_0x739d('0x12')];};};Realtime[_0x739d('0x3c')]['initVoiceExtensions']=function(){var _0x390db9=this;return function(_0x264abb){if(_0x264abb){freeIsNotKey(_0x264abb,_0x390db9[_0x739d('0x14')],'id');for(var _0x53969d=0x0,_0x3d750f={};_0x53969d<_0x264abb[_0x739d('0x3e')];_0x53969d+=0x1){_0x3d750f=_0x264abb[_0x53969d];if(_['isUndefined'](_0x390db9[_0x739d('0x14')][_0x3d750f['id']])){_0x390db9[_0x739d('0x14')][_0x3d750f['id']]=new VoiceExtension(_0x3d750f);}else{_0x390db9['mergeFromDatabase'](_0x390db9[_0x739d('0x14')][_0x3d750f['id']],_0x3d750f);}}}return _0x390db9[_0x739d('0x14')];};};Realtime['prototype'][_0x739d('0x63')]=function(){var _0x2e5ab1=this;return function(_0x3f3d7c){clearCampaigns(_0x2e5ab1[_0x739d('0x12')]);for(var _0x2e1921=0x0;_0x2e1921<_0x3f3d7c[_0x739d('0x3e')];_0x2e1921+=0x1){_['merge'](_0x2e5ab1[_0x739d('0x12')][_0x3f3d7c[_0x2e1921][_0x739d('0x27')]],_0x3f3d7c[_0x2e1921]);}return _0x2e5ab1['campaigns'];};};Realtime['prototype'][_0x739d('0x64')]=function(){var _0x584838=this;return function(_0x584b4e){if(_0x584b4e){freeIsNotKey(_0x584b4e,_0x584838[_0x739d('0x22')],'id');for(var _0x157d67=0x0,_0x1fa535={},_0x4a69dc={};_0x157d67<_0x584b4e['length'];_0x157d67+=0x1){_0x1fa535=_0x584b4e[_0x157d67];if(_[_0x739d('0x42')](_0x584838['faxAccounts'][_0x1fa535['id']])){_0x584838[_0x739d('0x22')][_0x1fa535['id']]=new FaxAccount(_0x1fa535);}else{_0x584838[_0x739d('0x3d')](_0x584838[_0x739d('0x22')][_0x1fa535['id']],_0x1fa535);}}}return _0x584838['faxAccounts'];};};module[_0x739d('0x65')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 7bf3f9e..45fc392 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 _0xf829=['assigned','lastAssignedTo','name','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','voiceQueueReport','match','getAgentByInternal','keys','channel','split','outbound','internal','destination','exten','type','lastapplication','queue','lastdata','context','from-voip-provider','from-sip','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','getCallType','UserId','membername','monitor','monitors','monitorFilename','filename','createdAt','xcally-motion-preview','connectedlinename','xcally-motion-dialer','isArray','forEach','create','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','lodash','moment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','realtime','agents','telephones','xdr','disabled','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','prototype','find','accountcode','isNil','interface','format','SIP/%s','length','findAgent','connectedlinenum'];(function(_0x209cfa,_0x10257e){var _0x20284a=function(_0x2248e6){while(--_0x2248e6){_0x209cfa['push'](_0x209cfa['shift']());}};_0x20284a(++_0x10257e);}(_0xf829,0x1b9));var _0x9f82=function(_0x7cf586,_0xd0ff06){_0x7cf586=_0x7cf586-0x0;var _0x3c38a4=_0xf829[_0x7cf586];return _0x3c38a4;};'use strict';var _=require(_0x9f82('0x0'));var moment=require(_0x9f82('0x1'));var util=require('util');var config=require('../../../config/environment');var ami=require(_0x9f82('0x2'));var RpcVoiceAgentReport=require(_0x9f82('0x3'));var RpcVoiceCallReport=require(_0x9f82('0x4'));var RpcVoiceDialReport=require(_0x9f82('0x5'));var RpcMemberReport=require(_0x9f82('0x6'));var RpcVoiceQueueReport=require(_0x9f82('0x7'));var RpcVoiceRecording=require(_0x9f82('0x8'));var RpcVoiceTransferReport=require(_0x9f82('0x9'));var VoiceQueueReport=require(_0x9f82('0xa'));var VoiceCallReport=require(_0x9f82('0xb'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x9f82('0xc'));var UserReport=require(_0x9f82('0xd'));function Report(_0x1a5a0f){this[_0x9f82('0xe')]=_0x1a5a0f;this[_0x9f82('0xf')]=_0x1a5a0f[_0x9f82('0xf')];this[_0x9f82('0x10')]=_0x1a5a0f['telephones'];}Report['prototype']['sync']=function(_0x32a2e7){var _0x48d86c=new VoiceQueueReport(this[_0x9f82('0xe')]);var _0x9993e7=new VoiceAgentReport(this[_0x9f82('0xe')]);var _0x5a4ded=new VoiceDialReport(this['realtime']);var _0x38d6ed=new VoiceCallReport(this['realtime']);var _0x358ada=new UserReport(this['realtime']);if(config[_0x9f82('0x11')]&&config[_0x9f82('0x11')][_0x9f82('0x12')]){ami['on'](_0x9f82('0x13'),this['voiceQueueReport'][_0x9f82('0x14')](this));ami['on'](_0x9f82('0x15'),this[_0x9f82('0x16')][_0x9f82('0x14')](this));ami['on'](_0x9f82('0x17'),this['voiceAgentReport'][_0x9f82('0x14')](this));ami['on'](_0x9f82('0x18'),this[_0x9f82('0x19')]['bind'](this));ami['on'](_0x9f82('0x1a'),this[_0x9f82('0x1b')]['bind'](this));ami['on']('attendedtransfer',this[_0x9f82('0x1c')][_0x9f82('0x14')](this));}};Report[_0x9f82('0x1d')]['findAgent']=function(_0x21abd4){var _0x3ad2f7;_0x3ad2f7=_[_0x9f82('0x1e')](this[_0x9f82('0xf')],function(_0x26c89f){return _0x26c89f[_0x9f82('0x1f')]==_0x21abd4||_0x26c89f['name']==_0x21abd4;});if(_[_0x9f82('0x20')](_0x3ad2f7)){var _0x319660=_[_0x9f82('0x1e')](this[_0x9f82('0x10')],function(_0x33fc1b){return _0x33fc1b[_0x9f82('0x1f')]==_0x21abd4||_0x33fc1b['name']==_0x21abd4;});if(_0x319660){_0x3ad2f7=_['find'](this[_0x9f82('0xf')],function(_0xb7c133){return _0xb7c133[_0x9f82('0x21')]==util[_0x9f82('0x22')](_0x9f82('0x23'),_0x319660['name']);});}}return _0x3ad2f7;};Report[_0x9f82('0x1d')]['voiceQueueReport']=function(_0x33c1ae){for(var _0x264eaa=0x0;_0x264eaa<_0x33c1ae[_0x9f82('0x24')];_0x264eaa+=0x1){var _0x45ff9b=this[_0x9f82('0x25')](_0x33c1ae[_0x264eaa][_0x9f82('0x26')]);if(_0x45ff9b){_0x33c1ae[_0x264eaa][_0x9f82('0x1f')]=_0x45ff9b[_0x9f82('0x1f')];_0x33c1ae[_0x264eaa][_0x9f82('0x27')]=!![];_0x33c1ae[_0x264eaa][_0x9f82('0x28')]=_0x45ff9b[_0x9f82('0x29')];_0x33c1ae[_0x264eaa]['interface']=_[_0x9f82('0x20')](_0x45ff9b[_0x9f82('0x21')])?util['format'](_0x9f82('0x23'),_0x45ff9b[_0x9f82('0x29')]):_0x45ff9b['interface'];if(_0x33c1ae[_0x264eaa][_0x9f82('0x2a')]){_0x33c1ae[_0x264eaa][_0x9f82('0x2b')]=moment()[_0x9f82('0x22')](_0x9f82('0x2c'));}if(_0x33c1ae[_0x264eaa]['queuecallerexit']){_0x33c1ae[_0x264eaa]['queuecallerexitAt']=moment()['format'](_0x9f82('0x2c'));}RpcMemberReport[_0x9f82('0x2d')](_0x33c1ae[_0x264eaa]);}RpcVoiceQueueReport['create'](_0x33c1ae[_0x264eaa]);}};function extractCalleridNumber(_0x4a16dd){var _0x4dbf66=_0x4a16dd[_0x9f82('0x2e')](/<(.*?)>/);return _0x4dbf66?_0x4dbf66[0x1]:_0x4a16dd;}Report['prototype'][_0x9f82('0x2f')]=function(_0x50d056){for(var _0x2699b2=0x0;_0x2699b2','calleridname','transfers','linkedid','transfereelinkedid','getCallType','UserId','membername','monitors','filename','createdAt','exten','connectedlinename','originatecalleridnum','xcally-motion-dialer','isArray','forEach','Local','substring','indexOf','lastIndexOf','lodash','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','find','accountcode','name','interface','format','SIP/%s','findAgent','connectedlinenum','isNil','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','create','match','getAgentByInternal','keys','length','channel','split','calleridnum','internal','destination','type','dialer','queue','lastdata','context','callerid'];(function(_0x446baf,_0x4dbed7){var _0x3fd835=function(_0x1bf78a){while(--_0x1bf78a){_0x446baf['push'](_0x446baf['shift']());}};_0x3fd835(++_0x4dbed7);}(_0x65e4,0x6f));var _0x465e=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x65e4[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x465e('0x0'));var moment=require('moment');var util=require(_0x465e('0x1'));var config=require(_0x465e('0x2'));var ami=require(_0x465e('0x3'));var RpcVoiceAgentReport=require(_0x465e('0x4'));var RpcVoiceCallReport=require(_0x465e('0x5'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x465e('0x6'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x465e('0x7'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x465e('0x8'));var VoiceAgentReport=require(_0x465e('0x9'));var VoiceDialReport=require(_0x465e('0xa'));var UserReport=require(_0x465e('0xb'));function Report(_0x578019){this[_0x465e('0xc')]=_0x578019;this[_0x465e('0xd')]=_0x578019[_0x465e('0xd')];this[_0x465e('0xe')]=_0x578019[_0x465e('0xe')];}Report[_0x465e('0xf')][_0x465e('0x10')]=function(_0x1bbabe){var _0x1149ed=new VoiceQueueReport(this[_0x465e('0xc')]);var _0x11512c=new VoiceAgentReport(this['realtime']);var _0x226594=new VoiceDialReport(this[_0x465e('0xc')]);var _0x30541f=new VoiceCallReport(this['realtime']);var _0x57c6a3=new UserReport(this[_0x465e('0xc')]);if(config['xdr']&&config[_0x465e('0x11')][_0x465e('0x12')]){ami['on']('custom:voiceQueueReport',this[_0x465e('0x13')][_0x465e('0x14')](this));ami['on'](_0x465e('0x15'),this[_0x465e('0x16')][_0x465e('0x14')](this));ami['on'](_0x465e('0x17'),this[_0x465e('0x18')][_0x465e('0x14')](this));ami['on']('custom:voiceDialReport',this[_0x465e('0x19')][_0x465e('0x14')](this));ami['on'](_0x465e('0x1a'),this[_0x465e('0x1b')][_0x465e('0x14')](this));ami['on'](_0x465e('0x1c'),this[_0x465e('0x1d')][_0x465e('0x14')](this));}};Report[_0x465e('0xf')]['findAgent']=function(_0x593f58){var _0x4dc86b;_0x4dc86b=_[_0x465e('0x1e')](this[_0x465e('0xd')],function(_0x458170){return _0x458170[_0x465e('0x1f')]==_0x593f58||_0x458170[_0x465e('0x20')]==_0x593f58;});if(_['isNil'](_0x4dc86b)){var _0x2ee135=_[_0x465e('0x1e')](this['telephones'],function(_0x10763b){return _0x10763b[_0x465e('0x1f')]==_0x593f58||_0x10763b[_0x465e('0x20')]==_0x593f58;});if(_0x2ee135){_0x4dc86b=_['find'](this[_0x465e('0xd')],function(_0x5086a8){return _0x5086a8[_0x465e('0x21')]==util[_0x465e('0x22')](_0x465e('0x23'),_0x2ee135[_0x465e('0x20')]);});}}return _0x4dc86b;};Report['prototype'][_0x465e('0x13')]=function(_0x26ce9d){for(var _0x30f753=0x0;_0x30f753<_0x26ce9d['length'];_0x30f753+=0x1){var _0x10ed11=this[_0x465e('0x24')](_0x26ce9d[_0x30f753][_0x465e('0x25')]);if(_0x10ed11){_0x26ce9d[_0x30f753][_0x465e('0x1f')]=_0x10ed11['accountcode'];_0x26ce9d[_0x30f753]['assigned']=!![];_0x26ce9d[_0x30f753]['lastAssignedTo']=_0x10ed11[_0x465e('0x20')];_0x26ce9d[_0x30f753]['interface']=_[_0x465e('0x26')](_0x10ed11['interface'])?util[_0x465e('0x22')](_0x465e('0x23'),_0x10ed11[_0x465e('0x20')]):_0x10ed11[_0x465e('0x21')];if(_0x26ce9d[_0x30f753][_0x465e('0x27')]){_0x26ce9d[_0x30f753]['queuecallercompleteAt']=moment()[_0x465e('0x22')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x26ce9d[_0x30f753]['queuecallerexit']){_0x26ce9d[_0x30f753]['queuecallerexitAt']=moment()[_0x465e('0x22')](_0x465e('0x28'));}RpcMemberReport['voiceQueueReport'](_0x26ce9d[_0x30f753]);}RpcVoiceQueueReport[_0x465e('0x29')](_0x26ce9d[_0x30f753]);}};function extractCalleridNumber(_0x56636b){var _0x59348f=_0x56636b[_0x465e('0x2a')](/<(.*?)>/);return _0x59348f?_0x59348f[0x1]:_0x56636b;}Report[_0x465e('0xf')][_0x465e('0x2b')]=function(_0x3624ca){for(var _0x41fd28=0x0;_0x41fd280x0?_0x41a357:0x0;this[_0xd2f6('0x11')][_0x25a58d[_0xd2f6('0x64')]][_0xd2f6('0x2f')]=this[_0xd2f6('0x11')][_0x25a58d[_0xd2f6('0x64')]][_0xd2f6('0x2f')]>_['toNumber'](_0x25a58d['loggedin'])?_[_0xd2f6('0x6b')](_0x25a58d[_0xd2f6('0x6a')]):this[_0xd2f6('0x11')][_0x25a58d[_0xd2f6('0x64')]]['talking'];this[_0xd2f6('0x4a')](this[_0xd2f6('0x11')][_0x25a58d[_0xd2f6('0x64')]],_0xd2f6('0x15'));}logger[_0xd2f6('0x6c')](_0xd2f6('0x6d'),util['inspect'](this[_0xd2f6('0x11')][_0x25a58d[_0xd2f6('0x64')]],{'showHidden':![],'depth':null}));ami['emit'](_0xd2f6('0x6e'),this[_0xd2f6('0x11')][_0x25a58d[_0xd2f6('0x64')]]);}}}catch(_0x223ed2){logger[_0xd2f6('0x39')]('[voiceQueueReport][queuesummary]',util[_0xd2f6('0x38')](_0x223ed2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd2f6('0x9')][_0xd2f6('0x18')]=function(_0x4a3b7f){logger[_0xd2f6('0x6c')](_0xd2f6('0x6f'),util[_0xd2f6('0x38')](_0x4a3b7f,{'showHidden':![],'depth':null}));this[_0xd2f6('0x12')]=!![];};VoiceQueueReport[_0xd2f6('0x9')][_0xd2f6('0x19')]=function(_0x891214){try{if(this[_0xd2f6('0x5d')](_0x891214)){logger[_0xd2f6('0x6c')](_0xd2f6('0x70'),_0x891214[_0xd2f6('0x71')],util[_0xd2f6('0x38')](_0x891214,{'showHidden':![],'depth':null}));if(_[_0xd2f6('0x5e')](this[_0xd2f6('0xd')][_0x891214[_0xd2f6('0x71')]]))this[_0xd2f6('0xd')][_0x891214[_0xd2f6('0x71')]]=[];if(_[_0xd2f6('0x5e')](this[_0xd2f6('0xf')][_0x891214['uniqueid']]))this['channels'][_0x891214[_0xd2f6('0x71')]]={};var _0x15a840=new QueueReport();_0x15a840[_0xd2f6('0x47')]=_0x891214[_0xd2f6('0x64')];_0x15a840[_0xd2f6('0x4b')]=this[_0xd2f6('0x11')][_0x15a840[_0xd2f6('0x47')]]&&this['voiceQueues'][_0x15a840[_0xd2f6('0x47')]][_0xd2f6('0x4b')]?this[_0xd2f6('0x11')][_0x15a840[_0xd2f6('0x47')]][_0xd2f6('0x4b')]||_0xd2f6('0x4c'):'inbound';_0x15a840['queue']=_0x891214[_0xd2f6('0x64')];_0x15a840[_0xd2f6('0x72')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x15a840[_0xd2f6('0x73')]=_0x891214['position'];_0x15a840['count']=_0x891214[_0xd2f6('0x74')];_0x15a840['uniqueid']=_0x891214[_0xd2f6('0x71')];_0x15a840[_0xd2f6('0x75')]=this[_0xd2f6('0xf')][_0x891214[_0xd2f6('0x71')]]['routealias'];logger['info'](_0xd2f6('0x76'),_0x15a840[_0xd2f6('0x47')],_0x15a840[_0xd2f6('0x4b')]);_['merge'](_0x15a840,_[_0xd2f6('0x77')](_0x891214,_[_0xd2f6('0x78')](_0x15a840)));this['queueReports'][_0x891214[_0xd2f6('0x71')]][_0xd2f6('0x79')](_0x15a840);this[_0xd2f6('0xf')][_0x891214[_0xd2f6('0x71')]]=_0x15a840;this[_0xd2f6('0x7a')](_0x15a840,_0xd2f6('0x7b'));}}catch(_0x2ffb8f){logger[_0xd2f6('0x39')](_0xd2f6('0x70'),_0x891214[_0xd2f6('0x71')],util['inspect'](_0x2ffb8f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd2f6('0x9')][_0xd2f6('0x7c')]=function(_0xd90ad6){try{if(this['isNotNull'](_0xd90ad6)){logger[_0xd2f6('0x6c')](_0xd2f6('0x7d'),_0xd90ad6[_0xd2f6('0x71')],util[_0xd2f6('0x38')](_0xd90ad6,{'showHidden':![],'depth':null}));if(this[_0xd2f6('0xd')][_0xd90ad6[_0xd2f6('0x71')]]){var _0x524b17=_[_0xd2f6('0x7e')](this['queueReports'][_0xd90ad6[_0xd2f6('0x71')]]);_0x524b17['queuecallercomplete']=![];_0x524b17[_0xd2f6('0x7f')]=null;_0x524b17['holdtime']=_0xd90ad6['holdtime'];_0x524b17[_0xd2f6('0x80')]=_0xd90ad6[_0xd2f6('0x80')];_0x524b17[_0xd2f6('0x1a')]=!![];_0x524b17['queuecallerabandonAt']=moment()[_0xd2f6('0x41')]('YYYY-MM-DD\x20HH:mm:ss');_0x524b17[_0xd2f6('0x46')]=_0xd2f6('0x81');_0x524b17[_0xd2f6('0x82')]=null;logger[_0xd2f6('0x65')](_0xd2f6('0x83'),_0x524b17[_0xd2f6('0x47')],_0x524b17['type']);this[_0xd2f6('0xf')][_0xd90ad6[_0xd2f6('0x71')]]=_0x524b17;this['emitVoiceQueueChannelRemove'](_0x524b17,'queuecallerabandon');}}}catch(_0x53227a){logger['error'](_0xd2f6('0x7d'),_0xd90ad6[_0xd2f6('0x71')],util[_0xd2f6('0x38')](_0x53227a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd2f6('0x9')][_0xd2f6('0x84')]=function(_0x3cbd59){try{if(this[_0xd2f6('0x5d')](_0x3cbd59)){logger['debug'](_0xd2f6('0x85'),_0x3cbd59[_0xd2f6('0x71')],util[_0xd2f6('0x38')](_0x3cbd59,{'showHidden':![],'depth':null}));if(this[_0xd2f6('0xd')][_0x3cbd59[_0xd2f6('0x71')]]){var _0x15bfb3=_[_0xd2f6('0x7e')](this[_0xd2f6('0xd')][_0x3cbd59[_0xd2f6('0x71')]]);_0x15bfb3[_0xd2f6('0x86')]=moment()[_0xd2f6('0x41')]('YYYY-MM-DD\x20HH:mm:ss');_0x15bfb3[_0xd2f6('0x87')]=_0x3cbd59[_0xd2f6('0x87')];_0x15bfb3['connectedlinename']=_0x3cbd59[_0xd2f6('0x88')];logger[_0xd2f6('0x65')](_0xd2f6('0x89'),_0x15bfb3[_0xd2f6('0x47')],_0x15bfb3[_0xd2f6('0x4b')],_0x3cbd59['connectedlinenum'],_0x3cbd59[_0xd2f6('0x88')]);this[_0xd2f6('0xf')][_0x3cbd59[_0xd2f6('0x71')]]=_0x15bfb3;this[_0xd2f6('0x7a')](_0x15bfb3,_0xd2f6('0x1b'));}}}catch(_0x5ec653){logger[_0xd2f6('0x39')]('[%s][voiceQueueReport][queuecallerleave]',_0x3cbd59[_0xd2f6('0x71')],util[_0xd2f6('0x38')](_0x5ec653,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd2f6('0x1f')]=function(_0x3b2699){try{if(this[_0xd2f6('0x5d')](_0x3b2699)){logger[_0xd2f6('0x6c')](_0xd2f6('0x8a'),_0x3b2699[_0xd2f6('0x71')],util['inspect'](_0x3b2699,{'showHidden':![],'depth':null}));if(this[_0xd2f6('0xd')][_0x3b2699['uniqueid']]){var _0x3bc969=_[_0xd2f6('0x7e')](this['queueReports'][_0x3b2699['uniqueid']]);_0x3bc969[_0xd2f6('0x8b')]=!![];_0x3bc969[_0xd2f6('0x46')]='COMPLETEDBYAGENT';logger[_0xd2f6('0x65')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x3bc969[_0xd2f6('0x47')],_0x3bc969[_0xd2f6('0x4b')]);}}}catch(_0x38b41b){logger[_0xd2f6('0x39')](_0xd2f6('0x8a'),_0x3b2699[_0xd2f6('0x71')],util[_0xd2f6('0x38')](_0x38b41b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd2f6('0x9')]['syncAgentComplete']=function(_0x4b38cd){try{if(this[_0xd2f6('0x5d')](_0x4b38cd)){logger[_0xd2f6('0x6c')]('[%s][voiceQueueReport][agentcomplete]',_0x4b38cd[_0xd2f6('0x71')],util[_0xd2f6('0x38')](_0x4b38cd,{'showHidden':![],'depth':null}));if(this[_0xd2f6('0xd')][_0x4b38cd[_0xd2f6('0x71')]]){var _0x32faea=_[_0xd2f6('0x7e')](this[_0xd2f6('0xd')][_0x4b38cd['uniqueid']]);_0x32faea[_0xd2f6('0x1a')]=![];_0x32faea[_0xd2f6('0x8c')]=null;_0x32faea[_0xd2f6('0x8d')]=!![];_0x32faea['lastAssignedTo']=_0x4b38cd[_0xd2f6('0x8e')];_0x32faea[_0xd2f6('0x8f')]=_0x4b38cd[_0xd2f6('0x8f')];_0x32faea[_0xd2f6('0x8b')]=!![];_0x32faea[_0xd2f6('0x90')]=![];_0x32faea[_0xd2f6('0x91')]=null;if(!_0x32faea['transfer']){if(_0x4b38cd['reason']==_0xd2f6('0x92')){_0x32faea[_0xd2f6('0x46')]=_0xd2f6('0x93');logger[_0xd2f6('0x65')](_0xd2f6('0x94'),_0x32faea[_0xd2f6('0x47')],_0x32faea[_0xd2f6('0x4b')]);}else{if(_['startsWith'](_0x4b38cd[_0xd2f6('0x35')][_0xd2f6('0x95')](),_0xd2f6('0x96'))){if(this['queueReports'][_0x4b38cd[_0xd2f6('0x97')]]){var _0x1d2ae8=_[_0xd2f6('0x7e')](this[_0xd2f6('0xd')][_0x4b38cd[_0xd2f6('0x97')]]);_0x1d2ae8[_0xd2f6('0x8b')]=![];_0x1d2ae8[_0xd2f6('0x90')]=!![];_0x1d2ae8[_0xd2f6('0x91')]=moment(_0x32faea[_0xd2f6('0x72')])[_0xd2f6('0x98')](_0x4b38cd[_0xd2f6('0x8f')],_0xd2f6('0x99'))[_0xd2f6('0x41')](_0xd2f6('0x9a'));_0x1d2ae8[_0xd2f6('0x46')]=_0xd2f6('0x9b');_0x1d2ae8['transfer']=!![];_0x1d2ae8['transfertype']=_0xd2f6('0x9c');_0x1d2ae8['transferexten']=_0x4b38cd[_0xd2f6('0x9d')];_0x1d2ae8[_0xd2f6('0x9e')]=_0x4b38cd[_0xd2f6('0x71')];logger[_0xd2f6('0x65')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x1d2ae8[_0xd2f6('0x47')],_0x1d2ae8[_0xd2f6('0x4b')]);var _0x501fc3=this[_0xd2f6('0xd')][_0x4b38cd[_0xd2f6('0x97')]];this[_0xd2f6('0xd')][_0x4b38cd[_0xd2f6('0x97')]]=this[_0xd2f6('0xd')][_0x4b38cd[_0xd2f6('0x71')]];this['queueReports'][_0x4b38cd[_0xd2f6('0x71')]]=_0x501fc3;}}else{_0x32faea['queuecallerexitreason']=_0xd2f6('0x9f')+_0x4b38cd['reason'][_0xd2f6('0xa0')]();logger[_0xd2f6('0x65')](_0xd2f6('0xa1'),_0x32faea[_0xd2f6('0x47')],_0x32faea[_0xd2f6('0x4b')],_0x32faea[_0xd2f6('0x46')]);}}}this[_0xd2f6('0xf')][_0x4b38cd[_0xd2f6('0x71')]]=_0x32faea;this['emitVoiceQueueChannelRemove'](_0x32faea,'agentcomplete');}}}catch(_0x29ec6b){logger[_0xd2f6('0x39')]('[%s][voiceQueueReport][agentcomplete]',_0x4b38cd[_0xd2f6('0x71')],util[_0xd2f6('0x38')](_0x29ec6b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd2f6('0x9')][_0xd2f6('0x20')]=function(_0x3695d2){try{if(this[_0xd2f6('0x5d')](_0x3695d2)){logger['debug'](_0xd2f6('0xa2'),_0x3695d2['uniqueid'],util[_0xd2f6('0x38')](_0x3695d2,{'showHidden':![],'depth':null}));this[_0xd2f6('0xa3')](_0x3695d2[_0xd2f6('0x71')],_['keys'](_0x3695d2[_0xd2f6('0xa4')])[0x0],_0x3695d2[_0xd2f6('0xa5')]);if(this[_0xd2f6('0xd')][_0x3695d2[_0xd2f6('0x71')]]){var _0xe1c008=_[_0xd2f6('0x7e')](this[_0xd2f6('0xd')][_0x3695d2[_0xd2f6('0x71')]]);if(_0xe1c008){if(this[_0xd2f6('0x5d')](_0x3695d2[_0xd2f6('0xa4')])&&this[_0xd2f6('0x5d')](_0x3695d2[_0xd2f6('0xa4')][_0xd2f6('0xa6')])){switch(_0x3695d2[_0xd2f6('0xa5')]){case _0xd2f6('0xa7'):_0xe1c008['queuecallerexit']=![];_0xe1c008['queuecallerexitAt']=null;break;case _0xd2f6('0xa8'):_0xe1c008['lastevent']=_0xd2f6('0xa9');_0xe1c008['queuecallerexit']=!![];_0xe1c008['queuecallerexitAt']=moment()[_0xd2f6('0x41')]('YYYY-MM-DD\x20HH:mm:ss');_0xe1c008[_0xd2f6('0x86')]=moment()['format'](_0xd2f6('0x9a'));logger[_0xd2f6('0x6c')](_0xd2f6('0xaa'),_0x3695d2[_0xd2f6('0x71')],util[_0xd2f6('0x38')](_0xe1c008,{'showHidden':![],'depth':null}));ami[_0xd2f6('0x3e')](_0xd2f6('0xab'),_0xe1c008);break;default:_0xe1c008[_0xd2f6('0x90')]=!![];_0xe1c008['queuecallerexitAt']=moment()[_0xd2f6('0x41')](_0xd2f6('0x9a'));_0xe1c008[_0xd2f6('0x86')]=moment()[_0xd2f6('0x41')](_0xd2f6('0x9a'));}_0xe1c008[_0xd2f6('0x1a')]=![];_0xe1c008['queuecallerabandonAt']=null;_0xe1c008[_0xd2f6('0x46')]=_0x3695d2['value'];this[_0xd2f6('0xf')][_0x3695d2[_0xd2f6('0x71')]]=_0xe1c008;this[_0xd2f6('0x44')](_0xe1c008,'varset');}else if(this[_0xd2f6('0x5d')](_0x3695d2['variable'])&&this[_0xd2f6('0x5d')](_0x3695d2['variable'][_0xd2f6('0xac')])){if(!_0xe1c008['queuecallerabandon']){_0xe1c008[_0xd2f6('0x90')]=!![];_0xe1c008[_0xd2f6('0x91')]=moment()[_0xd2f6('0x41')](_0xd2f6('0x9a'));_0xe1c008[_0xd2f6('0x46')]=_0xd2f6('0xad');_0xe1c008[_0xd2f6('0x86')]=moment()[_0xd2f6('0x41')](_0xd2f6('0x9a'));this[_0xd2f6('0xf')][_0x3695d2['uniqueid']]=_0xe1c008;}}logger['info']('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x3695d2['uniqueid'],_0xe1c008['name'],_0xe1c008[_0xd2f6('0x4b')],_[_0xd2f6('0x78')](_0x3695d2[_0xd2f6('0xa4')])[0x0],_0x3695d2[_0xd2f6('0xa5')]);_0xe1c008['variables']=this['variables'][_0x3695d2[_0xd2f6('0x71')]];}}}}catch(_0x222ee8){logger[_0xd2f6('0x39')](_0xd2f6('0xa2'),_0x3695d2[_0xd2f6('0x71')],util['inspect'](_0x222ee8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd2f6('0x9')][_0xd2f6('0xa3')]=function(_0x58a118,_0x101c7a,_0x37bd8b){var _0x1a62b5=['rtpaudioqos',_0xd2f6('0xae'),_0xd2f6('0xaf'),'rtpaudioqosjitterbridged',_0xd2f6('0xb0'),'rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged',_0xd2f6('0xb1'),_0xd2f6('0xb2'),_0xd2f6('0xb3'),_0xd2f6('0xb4'),_0xd2f6('0xb5'),'memberdynamic',_0xd2f6('0xb6'),_0xd2f6('0xb7'),_0xd2f6('0x8e'),'memberpenalty',_0xd2f6('0xb8')];if(!_[_0xd2f6('0x33')](_0x101c7a)&&!_[_0xd2f6('0xb9')](_0x1a62b5,_0x101c7a)){if(_['isUndefined'](this[_0xd2f6('0x14')][_0x58a118])){this[_0xd2f6('0x14')][_0x58a118]={};}this[_0xd2f6('0x14')][_0x58a118][_0x101c7a]=_0x37bd8b;}};VoiceQueueReport[_0xd2f6('0x9')][_0xd2f6('0x21')]=function(_0x323c76){try{if(this[_0xd2f6('0x5d')](_0x323c76)){logger[_0xd2f6('0x6c')](_0xd2f6('0xba'),_0x323c76[_0xd2f6('0x71')],util[_0xd2f6('0x38')](_0x323c76,{'showHidden':![],'depth':null}));if(this[_0xd2f6('0xd')][_0x323c76[_0xd2f6('0x71')]]){for(var _0x43db1f=0x0,_0x2adc95={};_0x43db1f0x0?_0x4411db:0x0;this[_0xbcfe('0x12')][_0x58eaf0[_0xbcfe('0x66')]][_0xbcfe('0x2e')]=this[_0xbcfe('0x12')][_0x58eaf0['queue']][_0xbcfe('0x2e')]>_[_0xbcfe('0x69')](_0x58eaf0[_0xbcfe('0x6a')])?_['toNumber'](_0x58eaf0[_0xbcfe('0x6a')]):this['voiceQueues'][_0x58eaf0['queue']]['talking'];this[_0xbcfe('0x6c')](this[_0xbcfe('0x12')][_0x58eaf0['queue']],'queuesummary');}logger[_0xbcfe('0x41')]('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0xbcfe('0x3a')](this['voiceQueues'][_0x58eaf0['queue']],{'showHidden':![],'depth':null}));ami[_0xbcfe('0x3f')]('custom:queuesummary',this[_0xbcfe('0x12')][_0x58eaf0['queue']]);}}}catch(_0x1e0ed9){logger[_0xbcfe('0x37')](_0xbcfe('0x65'),util['inspect'](_0x1e0ed9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbcfe('0xa')]['syncQueueSummaryComplete']=function(_0x328077){logger['debug'](_0xbcfe('0x6d'),util[_0xbcfe('0x3a')](_0x328077,{'showHidden':![],'depth':null}));this[_0xbcfe('0x62')]=!![];};VoiceQueueReport['prototype'][_0xbcfe('0x19')]=function(_0x4c64c1){try{if(this[_0xbcfe('0x5e')](_0x4c64c1)){logger[_0xbcfe('0x41')](_0xbcfe('0x6e'),_0x4c64c1[_0xbcfe('0x4a')],util[_0xbcfe('0x3a')](_0x4c64c1,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xbcfe('0xe')][_0x4c64c1[_0xbcfe('0x4a')]]))this[_0xbcfe('0xe')][_0x4c64c1[_0xbcfe('0x4a')]]=[];if(_[_0xbcfe('0x6f')](this['channels'][_0x4c64c1[_0xbcfe('0x4a')]]))this[_0xbcfe('0x10')][_0x4c64c1[_0xbcfe('0x4a')]]={};var _0x523bec=new QueueReport();_0x523bec[_0xbcfe('0x46')]=_0x4c64c1[_0xbcfe('0x66')];_0x523bec['type']=this[_0xbcfe('0x12')][_0x523bec[_0xbcfe('0x46')]]&&this[_0xbcfe('0x12')][_0x523bec[_0xbcfe('0x46')]]['type']?this[_0xbcfe('0x12')][_0x523bec[_0xbcfe('0x46')]]['type']||_0xbcfe('0x4e'):_0xbcfe('0x4e');_0x523bec[_0xbcfe('0x66')]=_0x4c64c1['queue'];_0x523bec[_0xbcfe('0x70')]=moment()[_0xbcfe('0x44')](_0xbcfe('0x71'));_0x523bec[_0xbcfe('0x72')]=_0x4c64c1[_0xbcfe('0x72')];_0x523bec[_0xbcfe('0x73')]=_0x4c64c1[_0xbcfe('0x73')];_0x523bec[_0xbcfe('0x4a')]=_0x4c64c1[_0xbcfe('0x4a')];_0x523bec[_0xbcfe('0x74')]=this[_0xbcfe('0x10')][_0x4c64c1[_0xbcfe('0x4a')]]['routealias'];logger[_0xbcfe('0x67')](_0xbcfe('0x75'),_0x523bec['name'],_0x523bec[_0xbcfe('0x76')]);_['merge'](_0x523bec,_[_0xbcfe('0x77')](_0x4c64c1,_['keys'](_0x523bec)));this['queueReports'][_0x4c64c1[_0xbcfe('0x4a')]][_0xbcfe('0x78')](_0x523bec);this['channels'][_0x4c64c1[_0xbcfe('0x4a')]]=_0x523bec;this['emitVoiceQueueChannelSave'](_0x523bec,_0xbcfe('0x79'));}}catch(_0x2ae135){logger[_0xbcfe('0x37')](_0xbcfe('0x6e'),_0x4c64c1['uniqueid'],util['inspect'](_0x2ae135,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbcfe('0xa')][_0xbcfe('0x1b')]=function(_0xa5b5ef){try{if(this['isNotNull'](_0xa5b5ef)){logger[_0xbcfe('0x41')]('[%s][voiceQueueReport][queuecallerabandon]',_0xa5b5ef[_0xbcfe('0x4a')],util[_0xbcfe('0x3a')](_0xa5b5ef,{'showHidden':![],'depth':null}));if(this[_0xbcfe('0xe')][_0xa5b5ef['uniqueid']]){var _0xd60670=_[_0xbcfe('0x7a')](this[_0xbcfe('0xe')][_0xa5b5ef[_0xbcfe('0x4a')]]);_0xd60670[_0xbcfe('0x7b')]=![];_0xd60670[_0xbcfe('0x7c')]=null;_0xd60670[_0xbcfe('0x7d')]=_0xa5b5ef[_0xbcfe('0x7d')];_0xd60670[_0xbcfe('0x7e')]=_0xa5b5ef[_0xbcfe('0x7e')];_0xd60670[_0xbcfe('0x1a')]=!![];_0xd60670['queuecallerabandonAt']=moment()[_0xbcfe('0x44')](_0xbcfe('0x71'));_0xd60670[_0xbcfe('0x4b')]=_0xbcfe('0x7f');_0xd60670['lastAssignedTo']=null;logger[_0xbcfe('0x67')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0xd60670['name'],_0xd60670['type']);this[_0xbcfe('0x10')][_0xa5b5ef[_0xbcfe('0x4a')]]=_0xd60670;this['emitVoiceQueueChannelRemove'](_0xd60670,_0xbcfe('0x1a'));}}}catch(_0x442dee){logger[_0xbcfe('0x37')](_0xbcfe('0x80'),_0xa5b5ef[_0xbcfe('0x4a')],util[_0xbcfe('0x3a')](_0x442dee,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerLeave']=function(_0x5c92b1){try{if(this[_0xbcfe('0x5e')](_0x5c92b1)){logger['debug'](_0xbcfe('0x81'),_0x5c92b1['uniqueid'],util[_0xbcfe('0x3a')](_0x5c92b1,{'showHidden':![],'depth':null}));if(this[_0xbcfe('0xe')][_0x5c92b1[_0xbcfe('0x4a')]]){var _0x24f620=_[_0xbcfe('0x7a')](this[_0xbcfe('0xe')][_0x5c92b1[_0xbcfe('0x4a')]]);_0x24f620[_0xbcfe('0x82')]=moment()[_0xbcfe('0x44')](_0xbcfe('0x71'));_0x24f620['connectedlinenum']=_0x5c92b1[_0xbcfe('0x83')];_0x24f620['connectedlinename']=_0x5c92b1[_0xbcfe('0x84')];logger['info'](_0xbcfe('0x85'),_0x24f620[_0xbcfe('0x46')],_0x24f620[_0xbcfe('0x76')],_0x5c92b1['connectedlinenum'],_0x5c92b1[_0xbcfe('0x84')]);this[_0xbcfe('0x10')][_0x5c92b1['uniqueid']]=_0x24f620;this[_0xbcfe('0x40')](_0x24f620,_0xbcfe('0x1c'));}}}catch(_0x4ecd06){logger[_0xbcfe('0x37')]('[%s][voiceQueueReport][queuecallerleave]',_0x5c92b1[_0xbcfe('0x4a')],util[_0xbcfe('0x3a')](_0x4ecd06,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbcfe('0xa')][_0xbcfe('0x20')]=function(_0x5386f7){try{if(this[_0xbcfe('0x5e')](_0x5386f7)){logger['debug'](_0xbcfe('0x86'),_0x5386f7['uniqueid'],util[_0xbcfe('0x3a')](_0x5386f7,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x5386f7[_0xbcfe('0x4a')]]){var _0x38fa2a=_[_0xbcfe('0x7a')](this[_0xbcfe('0xe')][_0x5386f7['uniqueid']]);_0x38fa2a['queuecallercomplete']=!![];_0x38fa2a[_0xbcfe('0x4b')]='COMPLETEDBYAGENT';logger['info'](_0xbcfe('0x87'),_0x38fa2a[_0xbcfe('0x46')],_0x38fa2a[_0xbcfe('0x76')]);}}}catch(_0x1c79a1){logger[_0xbcfe('0x37')](_0xbcfe('0x86'),_0x5386f7[_0xbcfe('0x4a')],util['inspect'](_0x1c79a1,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x98c0a){try{if(this[_0xbcfe('0x5e')](_0x98c0a)){logger[_0xbcfe('0x41')]('[%s][voiceQueueReport][agentcomplete]',_0x98c0a['uniqueid'],util[_0xbcfe('0x3a')](_0x98c0a,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x98c0a[_0xbcfe('0x4a')]]){var _0x942854=_[_0xbcfe('0x7a')](this[_0xbcfe('0xe')][_0x98c0a[_0xbcfe('0x4a')]]);_0x942854['queuecallerabandon']=![];_0x942854[_0xbcfe('0x88')]=null;_0x942854[_0xbcfe('0x89')]=!![];_0x942854[_0xbcfe('0x8a')]=_0x98c0a['membername'];_0x942854[_0xbcfe('0x7d')]=_0x98c0a[_0xbcfe('0x7d')];_0x942854[_0xbcfe('0x7b')]=!![];_0x942854[_0xbcfe('0x8b')]=![];_0x942854[_0xbcfe('0x8c')]=null;if(!_0x942854[_0xbcfe('0x8d')]){if(_0x98c0a[_0xbcfe('0x8e')]==_0xbcfe('0x8d')){_0x942854[_0xbcfe('0x4b')]=_0xbcfe('0x8f');logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x942854[_0xbcfe('0x46')],_0x942854[_0xbcfe('0x76')]);}else{if(_[_0xbcfe('0x90')](_0x98c0a['channel']['toLowerCase'](),'local/')){if(this['queueReports'][_0x98c0a['linkedid']]){var _0x3a5c7c=_[_0xbcfe('0x7a')](this[_0xbcfe('0xe')][_0x98c0a[_0xbcfe('0x91')]]);_0x3a5c7c[_0xbcfe('0x7b')]=![];_0x3a5c7c['queuecallerexit']=!![];_0x3a5c7c[_0xbcfe('0x8c')]=moment(_0x942854['queuecallerjoinAt'])[_0xbcfe('0x92')](_0x98c0a[_0xbcfe('0x7d')],'seconds')[_0xbcfe('0x44')](_0xbcfe('0x71'));_0x3a5c7c['queuecallerexitreason']=_0xbcfe('0x93');_0x3a5c7c[_0xbcfe('0x8d')]=!![];_0x3a5c7c[_0xbcfe('0x94')]='FORWARD';_0x3a5c7c[_0xbcfe('0x95')]=_0x98c0a[_0xbcfe('0x96')];_0x3a5c7c['transferuniqueid']=_0x98c0a[_0xbcfe('0x4a')];logger[_0xbcfe('0x67')](_0xbcfe('0x97'),_0x3a5c7c[_0xbcfe('0x46')],_0x3a5c7c[_0xbcfe('0x76')]);var _0x52535b=this['queueReports'][_0x98c0a[_0xbcfe('0x91')]];this[_0xbcfe('0xe')][_0x98c0a[_0xbcfe('0x91')]]=this[_0xbcfe('0xe')][_0x98c0a['uniqueid']];this[_0xbcfe('0xe')][_0x98c0a['uniqueid']]=_0x52535b;}}else{_0x942854['queuecallerexitreason']='COMPLETEDBY'+_0x98c0a[_0xbcfe('0x8e')][_0xbcfe('0x98')]();logger['info'](_0xbcfe('0x99'),_0x942854['name'],_0x942854[_0xbcfe('0x76')],_0x942854[_0xbcfe('0x4b')]);}}}this[_0xbcfe('0x10')][_0x98c0a[_0xbcfe('0x4a')]]=_0x942854;this['emitVoiceQueueChannelRemove'](_0x942854,_0xbcfe('0x1e'));}}}catch(_0x19360f){logger[_0xbcfe('0x37')](_0xbcfe('0x9a'),_0x98c0a[_0xbcfe('0x4a')],util[_0xbcfe('0x3a')](_0x19360f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xbcfe('0xa')]['syncVarSet']=function(_0x789625){try{if(this[_0xbcfe('0x5e')](_0x789625)){logger[_0xbcfe('0x41')](_0xbcfe('0x9b'),_0x789625['uniqueid'],util['inspect'](_0x789625,{'showHidden':![],'depth':null}));this['addVariable'](_0x789625[_0xbcfe('0x4a')],_[_0xbcfe('0x9c')](_0x789625[_0xbcfe('0x9d')])[0x0],_0x789625[_0xbcfe('0x9e')]);if(this[_0xbcfe('0xe')][_0x789625[_0xbcfe('0x4a')]]){var _0x508a2d=_['last'](this[_0xbcfe('0xe')][_0x789625['uniqueid']]);if(_0x508a2d){if(this[_0xbcfe('0x5e')](_0x789625[_0xbcfe('0x9d')])&&this[_0xbcfe('0x5e')](_0x789625[_0xbcfe('0x9d')]['queuestatus'])){switch(_0x789625[_0xbcfe('0x9e')]){case _0xbcfe('0x9f'):_0x508a2d[_0xbcfe('0x8b')]=![];_0x508a2d[_0xbcfe('0x8c')]=null;break;case _0xbcfe('0xa0'):_0x508a2d['lastevent']=_0xbcfe('0xa1');_0x508a2d[_0xbcfe('0x8b')]=!![];_0x508a2d[_0xbcfe('0x8c')]=moment()[_0xbcfe('0x44')](_0xbcfe('0x71'));_0x508a2d['queuecallerleaveAt']=moment()['format'](_0xbcfe('0x71'));logger[_0xbcfe('0x41')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x789625['uniqueid'],util[_0xbcfe('0x3a')](_0x508a2d,{'showHidden':![],'depth':null}));ami[_0xbcfe('0x3f')]('custom:timeout',_0x508a2d);break;default:_0x508a2d[_0xbcfe('0x8b')]=!![];_0x508a2d[_0xbcfe('0x8c')]=moment()['format'](_0xbcfe('0x71'));_0x508a2d[_0xbcfe('0x82')]=moment()['format'](_0xbcfe('0x71'));}_0x508a2d[_0xbcfe('0x1a')]=![];_0x508a2d[_0xbcfe('0x88')]=null;_0x508a2d['queuecallerexitreason']=_0x789625['value'];this[_0xbcfe('0x10')][_0x789625[_0xbcfe('0x4a')]]=_0x508a2d;this['emitVoiceQueueChannelRemove'](_0x508a2d,_0xbcfe('0xa2'));}else if(this[_0xbcfe('0x5e')](_0x789625[_0xbcfe('0x9d')])&&this[_0xbcfe('0x5e')](_0x789625[_0xbcfe('0x9d')]['queueposition'])){if(!_0x508a2d[_0xbcfe('0x1a')]){_0x508a2d[_0xbcfe('0x8b')]=!![];_0x508a2d['queuecallerexitAt']=moment()[_0xbcfe('0x44')](_0xbcfe('0x71'));_0x508a2d[_0xbcfe('0x4b')]=_0xbcfe('0xa3');_0x508a2d[_0xbcfe('0x82')]=moment()[_0xbcfe('0x44')](_0xbcfe('0x71'));this[_0xbcfe('0x10')][_0x789625[_0xbcfe('0x4a')]]=_0x508a2d;}}logger[_0xbcfe('0x67')](_0xbcfe('0xa4'),_0x789625[_0xbcfe('0x4a')],_0x508a2d[_0xbcfe('0x46')],_0x508a2d['type'],_['keys'](_0x789625[_0xbcfe('0x9d')])[0x0],_0x789625['value']);_0x508a2d[_0xbcfe('0x14')]=this[_0xbcfe('0x14')][_0x789625[_0xbcfe('0x4a')]];}}}}catch(_0x20c8dd){logger[_0xbcfe('0x37')](_0xbcfe('0x9b'),_0x789625[_0xbcfe('0x4a')],util[_0xbcfe('0x3a')](_0x20c8dd,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xbcfe('0xa5')]=function(_0x16ee7a,_0x4be506,_0x2281f9){var _0x1212d3=[_0xbcfe('0xa6'),_0xbcfe('0xa7'),_0xbcfe('0xa8'),_0xbcfe('0xa9'),_0xbcfe('0xaa'),_0xbcfe('0xab'),_0xbcfe('0xac'),_0xbcfe('0xad'),_0xbcfe('0xae'),_0xbcfe('0xaf'),_0xbcfe('0xb0'),_0xbcfe('0xb1'),_0xbcfe('0xb2'),_0xbcfe('0xb3'),_0xbcfe('0xb4'),_0xbcfe('0xb5'),_0xbcfe('0xb6'),_0xbcfe('0xb7'),'memberrealtime'];if(!_[_0xbcfe('0xb8')](_0x4be506)&&!_[_0xbcfe('0xb9')](_0x1212d3,_0x4be506)){if(_[_0xbcfe('0x6f')](this[_0xbcfe('0x14')][_0x16ee7a])){this['variables'][_0x16ee7a]={};}this[_0xbcfe('0x14')][_0x16ee7a][_0x4be506]=_0x2281f9;}};VoiceQueueReport[_0xbcfe('0xa')][_0xbcfe('0x23')]=function(_0x1ef0dc){try{if(this[_0xbcfe('0x5e')](_0x1ef0dc)){logger[_0xbcfe('0x41')]('[%s][voiceQueueReport][hangup]',_0x1ef0dc['uniqueid'],util['inspect'](_0x1ef0dc,{'showHidden':![],'depth':null}));if(this[_0xbcfe('0xe')][_0x1ef0dc[_0xbcfe('0x4a')]]){for(var _0x42be4d=0x0,_0x2f60fe={};_0x42be4d=0x0?moment(_0x51f086[_0xba92('0x18')])[_0xba92('0xa')](_0x51f086['starttime'],_0xba92('0x19')):null,'data1':_0xba92('0x1a'),'data2':_0x51f086[_0xba92('0x11')],'data3':_0x51f086[_0xba92('0xe')],'data4':_0x51f086['dialstring']||null,'role':'agent','internal':_0x51f086['accountcode']?_[_0xba92('0x12')](_0x51f086[_0xba92('0x11')]):undefined,'uniqueid':_0x51f086['uniqueid']},'log':_0xba92('0x5')});}; \ No newline at end of file +var _0xeb2e=['Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','queue','agent','accountcode','uniqueid','voiceDialReport','membername','starttime','endtime','outbound','dialstring','toNumber','moment','lodash','../client','voiceQueueReport','queuecallerexitAt'];(function(_0x40ee16,_0x1ada1f){var _0x484844=function(_0x3e8b0f){while(--_0x3e8b0f){_0x40ee16['push'](_0x40ee16['shift']());}};_0x484844(++_0x1ada1f);}(_0xeb2e,0x109));var _0xeeb2=function(_0x1e0f36,_0x5760cb){_0x1e0f36=_0x1e0f36-0x0;var _0x492172=_0xeb2e[_0x1e0f36];return _0x492172;};'use strict';var moment=require(_0xeeb2('0x0'));var _=require(_0xeeb2('0x1'));var util=require('util');var client=require(_0xeeb2('0x2'));exports[_0xeeb2('0x3')]=function(_0x49350e){var _0x152c70=_0x49350e['queuecallercompleteAt']||_0x49350e[_0xeeb2('0x4')];return client[_0xeeb2('0x5')](_0xeeb2('0x6'),{'body':{'channel':_0xeeb2('0x7'),'membername':_0x49350e[_0xeeb2('0x8')],'interface':_[_0xeeb2('0x9')](_0x49350e[_0xeeb2('0xa')])?util['format'](_0xeeb2('0xb'),_0x49350e['lastAssignedTo']):_0x49350e[_0xeeb2('0xa')],'type':_0xeeb2('0xc'),'enterAt':_0x49350e[_0xeeb2('0xd')],'exitAt':_0x152c70,'duration':moment(_0x152c70)[_0xeeb2('0xe')](_0x49350e[_0xeeb2('0xd')],_0xeeb2('0xf')),'data1':_0xeeb2('0x10'),'data2':_0x49350e[_0xeeb2('0x11')],'data3':_0x49350e[_0xeeb2('0x12')],'data4':null,'data5':_0x49350e[_0xeeb2('0x13')],'role':_0xeeb2('0x14'),'internal':_0x49350e[_0xeeb2('0x15')]?_['toNumber'](_0x49350e[_0xeeb2('0x15')]):undefined,'uniqueid':_0x49350e[_0xeeb2('0x16')]},'log':'CreateMemberReport'});};exports[_0xeeb2('0x17')]=function(_0x356868){return client['Request'](_0xeeb2('0x6'),{'body':{'channel':_0xeeb2('0x7'),'membername':_0x356868[_0xeeb2('0x18')],'interface':_0x356868[_0xeeb2('0xa')],'type':_0xeeb2('0xc'),'enterAt':_0x356868[_0xeeb2('0x19')],'exitAt':_0x356868['endtime'],'duration':moment(_0x356868[_0xeeb2('0x1a')])[_0xeeb2('0xe')](_0x356868['starttime'],'seconds')>=0x0?moment(_0x356868['endtime'])[_0xeeb2('0xe')](_0x356868['starttime'],_0xeeb2('0xf')):null,'data1':_0xeeb2('0x1b'),'data2':_0x356868[_0xeeb2('0x15')],'data3':_0x356868[_0xeeb2('0x12')],'data4':_0x356868[_0xeeb2('0x1c')]||null,'role':_0xeeb2('0x14'),'internal':_0x356868['accountcode']?_[_0xeeb2('0x1d')](_0x356868[_0xeeb2('0x15')]):undefined,'uniqueid':_0x356868[_0xeeb2('0x16')]},'log':_0xeeb2('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 28a9b9a..dd3a450 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 _0x91ab=['stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','getSettings','ShowSetting'];(function(_0x45471f,_0xf7f20d){var _0x3a0269=function(_0x303d98){while(--_0x303d98){_0x45471f['push'](_0x45471f['shift']());}};_0x3a0269(++_0xf7f20d);}(_0x91ab,0x7b));var _0xb91a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x91ab[_0x14add3];return _0x4a174f;};'use strict';var client=require('../client');exports[_0xb91a('0x0')]=function(){return client['Request'](_0xb91a('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xb91a('0x2'),_0xb91a('0x3')]},'log':_0xb91a('0x4')});}; \ No newline at end of file +var _0x1177=['ShowSetting','stopRecordingOnTransfer','GetSettings','../client','Request'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1177,0x143));var _0x7117=function(_0x2d9359,_0x52473b){_0x2d9359=_0x2d9359-0x0;var _0x3fe0ef=_0x1177[_0x2d9359];return _0x3fe0ef;};'use strict';var client=require(_0x7117('0x0'));exports['getSettings']=function(){return client[_0x7117('0x1')](_0x7117('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x7117('0x3'),'previewRecallmeReminderInterval']},'log':_0x7117('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 3fa9543..da5c561 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 _0x6a21=['Request','GetTemplate','name','html','getTemplates'];(function(_0x33f6b3,_0x1ef8ec){var _0x38d5b9=function(_0x368262){while(--_0x368262){_0x33f6b3['push'](_0x33f6b3['shift']());}};_0x38d5b9(++_0x1ef8ec);}(_0x6a21,0xf9));var _0x16a2=function(_0x172158,_0x1b0f5c){_0x172158=_0x172158-0x0;var _0x20e605=_0x6a21[_0x172158];return _0x20e605;};'use strict';var client=require('../client');exports[_0x16a2('0x0')]=function(_0x176bf0){return function(_0x58fa6e){return client[_0x16a2('0x1')](_0x16a2('0x2'),{'options':{'raw':!![],'attributes':['id',_0x16a2('0x3'),_0x16a2('0x4')]},'log':_0x16a2('0x2')});};}; \ No newline at end of file +var _0x1b8e=['Request','GetTemplate','html','../client','getTemplates'];(function(_0x5e299e,_0x44f590){var _0x473b88=function(_0x20094a){while(--_0x20094a){_0x5e299e['push'](_0x5e299e['shift']());}};_0x473b88(++_0x44f590);}(_0x1b8e,0x10c));var _0xe1b8=function(_0x1c3df9,_0x39fe50){_0x1c3df9=_0x1c3df9-0x0;var _0xe6e8c7=_0x1b8e[_0x1c3df9];return _0xe6e8c7;};'use strict';var client=require(_0xe1b8('0x0'));exports[_0xe1b8('0x1')]=function(_0x315ca5){return function(_0x4ef693){return client[_0xe1b8('0x2')](_0xe1b8('0x3'),{'options':{'raw':!![],'attributes':['id','name',_0xe1b8('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index d7eeb2e..3d95659 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 _0xc690=['AllConditions','field','operator','value','AnyConditions','Action','Actions','action','data2','data3','data4','data6','data7','GetTrigger','getTriggers','Request','name','channel','status','Condition'];(function(_0xdaf516,_0xd8c44b){var _0x3e9f02=function(_0x1186ec){while(--_0x1186ec){_0xdaf516['push'](_0xdaf516['shift']());}};_0x3e9f02(++_0xd8c44b);}(_0xc690,0xfe));var _0x0c69=function(_0xd66f9e,_0xb25eeb){_0xd66f9e=_0xd66f9e-0x0;var _0x3553a2=_0xc690[_0xd66f9e];return _0x3553a2;};'use strict';var client=require('../client');exports[_0x0c69('0x0')]=function(_0x18b123){return function(_0x5bbbf4){return client[_0x0c69('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x0c69('0x2'),_0x0c69('0x3'),_0x0c69('0x4')],'include':[{'model':_0x0c69('0x5'),'as':_0x0c69('0x6'),'attributes':['id',_0x0c69('0x7'),_0x0c69('0x8'),_0x0c69('0x9')]},{'model':_0x0c69('0x5'),'as':_0x0c69('0xa'),'attributes':['id',_0x0c69('0x7'),_0x0c69('0x8'),'value']},{'model':_0x0c69('0xb'),'as':_0x0c69('0xc'),'attributes':['id',_0x0c69('0xd'),'data1',_0x0c69('0xe'),_0x0c69('0xf'),_0x0c69('0x10'),'data5',_0x0c69('0x11'),_0x0c69('0x12')]}]},'log':_0x0c69('0x13')});};}; \ No newline at end of file +var _0x35b1=['data3','data4','data5','data6','data7','../client','getTriggers','Request','channel','Condition','AllConditions','field','operator','Action','Actions','action','data1','data2'];(function(_0x29d550,_0x5b5f70){var _0x3d7c47=function(_0xb1337f){while(--_0xb1337f){_0x29d550['push'](_0x29d550['shift']());}};_0x3d7c47(++_0x5b5f70);}(_0x35b1,0xb9));var _0x135b=function(_0x22bdd3,_0x552e50){_0x22bdd3=_0x22bdd3-0x0;var _0x44d9d9=_0x35b1[_0x22bdd3];return _0x44d9d9;};'use strict';var client=require(_0x135b('0x0'));exports[_0x135b('0x1')]=function(_0x3c8296){return function(_0x486b2e){return client[_0x135b('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id','name',_0x135b('0x3'),'status'],'include':[{'model':_0x135b('0x4'),'as':_0x135b('0x5'),'attributes':['id',_0x135b('0x6'),_0x135b('0x7'),'value']},{'model':_0x135b('0x4'),'as':'AnyConditions','attributes':['id',_0x135b('0x6'),'operator','value']},{'model':_0x135b('0x8'),'as':_0x135b('0x9'),'attributes':['id',_0x135b('0xa'),_0x135b('0xb'),_0x135b('0xc'),_0x135b('0xd'),_0x135b('0xe'),_0x135b('0xf'),_0x135b('0x10'),_0x135b('0x11')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 48c7d02..c26d718 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 _0xcee8=['GetTrunk','registry','defaultuser','../client','getTrunks','Request'];(function(_0x2711b2,_0x5d6c25){var _0x5f5533=function(_0x58ab7b){while(--_0x58ab7b){_0x2711b2['push'](_0x2711b2['shift']());}};_0x5f5533(++_0x5d6c25);}(_0xcee8,0xb1));var _0x8cee=function(_0x4b127f,_0x51346b){_0x4b127f=_0x4b127f-0x0;var _0x353c85=_0xcee8[_0x4b127f];return _0x353c85;};'use strict';var client=require(_0x8cee('0x0'));exports[_0x8cee('0x1')]=function(_0x2a57bd){return function(_0x1471b2){return client[_0x8cee('0x2')](_0x8cee('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x8cee('0x4'),_0x8cee('0x5')]},'log':_0x8cee('0x3')});};}; \ No newline at end of file +var _0xe07d=['getTrunks','Request','registry','defaultuser','GetTrunk','../client'];(function(_0x398310,_0x26fd34){var _0x384b56=function(_0x280e03){while(--_0x280e03){_0x398310['push'](_0x398310['shift']());}};_0x384b56(++_0x26fd34);}(_0xe07d,0x179));var _0xde07=function(_0x352d28,_0x444033){_0x352d28=_0x352d28-0x0;var _0x387d7e=_0xe07d[_0x352d28];return _0x387d7e;};'use strict';var client=require(_0xde07('0x0'));exports[_0xde07('0x1')]=function(_0x497dd8){return function(_0x51ec25){return client[_0xde07('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0xde07('0x3'),_0xde07('0x4')]},'log':_0xde07('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 12384d6..4502b12 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x2fc8b9,_0x2843cb){var _0x599fbe=function(_0x45ba2a){while(--_0x45ba2a){_0x2fc8b9['push'](_0x2fc8b9['shift']());}};_0x599fbe(++_0x2843cb);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x26fc81,_0x57fc19){_0x26fc81=_0x26fc81-0x0;var _0x9feece=_0xcb91[_0x26fc81];return _0x9feece;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file +var _0x34e8=['../client','getAgents','Request','GetUser','name','email','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','mobile','interface','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','agent','lastPauseAt'];(function(_0x20f86c,_0x220c06){var _0x3c851c=function(_0x45d401){while(--_0x45d401){_0x20f86c['push'](_0x20f86c['shift']());}};_0x3c851c(++_0x220c06);}(_0x34e8,0x12c));var _0x834e=function(_0x23a45e,_0x5116d3){_0x23a45e=_0x23a45e-0x0;var _0x312482=_0x34e8[_0x23a45e];return _0x312482;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6'),_0x834e('0x7'),_0x834e('0x8'),_0x834e('0x9'),_0x834e('0xa'),'lastPauseAt',_0x834e('0xb'),'phone',_0x834e('0xc'),_0x834e('0xd')]},'log':_0x834e('0x1')});};};exports[_0x834e('0xe')]=function(){return function(){return client[_0x834e('0x2')](_0x834e('0x3'),{'options':{'raw':!![],'where':{'role':_0x834e('0xf')},'attributes':['id',_0x834e('0x4'),_0x834e('0x6'),_0x834e('0x10')]},'log':_0x834e('0xe')});};};exports[_0x834e('0x11')]=function(_0x14038b,_0x2e1a37,_0x293514){return client[_0x834e('0x2')](_0x834e('0x12'),{'body':{'type':_0x2e1a37,'uniqueid':_0x293514},'options':{'where':{'id':_0x14038b['id']}},'log':'savePause'});};exports[_0x834e('0x13')]=function(_0x6cd9b9){return client['Request'](_0x834e('0x14'),{'body':{},'options':{'where':{'id':_0x6cd9b9['id']}},'log':_0x834e('0x11')});};exports[_0x834e('0x15')]=function(_0x21cc0a){return client['Request'](_0x834e('0x16'),{'options':{'raw':![],'where':{'role':_0x834e('0x17'),'id':_0x21cc0a},'attributes':['id','name',_0x834e('0x5'),'accountcode',_0x834e('0x7'),_0x834e('0x8'),'lastLoginAt',_0x834e('0xa'),_0x834e('0x18'),_0x834e('0xb'),'interface']},'log':_0x834e('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 4ada28a..b9f9c09 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 _0x1814=['Request','CreateVoiceAgentReport','UpdateVoiceAgentReport','../client','create'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x1814,0xfd));var _0x4181=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1814[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x4181('0x0'));exports[_0x4181('0x1')]=function(_0x389960){return client[_0x4181('0x2')](_0x4181('0x3'),{'body':_0x389960,'log':_0x4181('0x3')});};exports['update']=function(_0x4b5ed4,_0x2f425a,_0x2d5cae){return client['Request'](_0x4181('0x4'),{'body':_0x4b5ed4,'options':{'where':{'uniqueid':_0x2f425a,'interface':_0x2d5cae,'agentcomplete':!![]}},'log':_0x4181('0x4')});}; \ No newline at end of file +var _0xa854=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xa854,0x8d));var _0x4a85=function(_0x219f68,_0x336e9b){_0x219f68=_0x219f68-0x0;var _0x231f5e=_0xa854[_0x219f68];return _0x231f5e;};'use strict';var client=require(_0x4a85('0x0'));exports[_0x4a85('0x1')]=function(_0x4ef8c8){return client[_0x4a85('0x2')](_0x4a85('0x3'),{'body':_0x4ef8c8,'log':'CreateVoiceAgentReport'});};exports[_0x4a85('0x4')]=function(_0x52bb74,_0x2b25eb,_0x29ea65){return client[_0x4a85('0x2')](_0x4a85('0x5'),{'body':_0x52bb74,'options':{'where':{'uniqueid':_0x2b25eb,'interface':_0x29ea65,'agentcomplete':!![]}},'log':_0x4a85('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 27c87f7..0b872fb 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 _0xf207=['merge','calleridnum','callerid','DOCUMENTATION','getVoiceCallReports','Request','GetVoiceCallReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','lodash','../client','create','CreateVoiceCallReport'];(function(_0x92354d,_0xcbd1ac){var _0x57f449=function(_0x19658f){while(--_0x19658f){_0x92354d['push'](_0x92354d['shift']());}};_0x57f449(++_0xcbd1ac);}(_0xf207,0xa7));var _0x7f20=function(_0xe1a3a5,_0xd3e341){_0xe1a3a5=_0xe1a3a5-0x0;var _0x362646=_0xf207[_0xe1a3a5];return _0x362646;};'use strict';var moment=require('moment');var util=require('util');var _=require(_0x7f20('0x0'));var client=require(_0x7f20('0x1'));exports[_0x7f20('0x2')]=function(_0x55df57){return client['Request'](_0x7f20('0x3'),{'body':_[_0x7f20('0x4')](_0x55df57,{'source':_0x55df57[_0x7f20('0x5')],'destinationcontext':_0x55df57['context'],'callerid':_0x55df57[_0x7f20('0x6')],'amaflags':_0x7f20('0x7')}),'log':_0x7f20('0x3')});};exports[_0x7f20('0x8')]=function(){return function(){return client[_0x7f20('0x9')](_0x7f20('0xa'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x7f20('0xb')](_0x7f20('0xc'))[_0x7f20('0xd')](_0x7f20('0xe')),moment()['endOf'](_0x7f20('0xc'))['format'](_0x7f20('0xe'))]}},'attributes':[_0x7f20('0xf'),_0x7f20('0x10'),_0x7f20('0x11'),_0x7f20('0x12')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0xe0ce=['Request','CreateVoiceCallReport','merge','context','callerid','DOCUMENTATION','getVoiceCallReports','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','duration','billableseconds','moment','util','lodash','../client','create'];(function(_0x9a7d08,_0xe9048){var _0x58e6e8=function(_0x31f047){while(--_0x31f047){_0x9a7d08['push'](_0x9a7d08['shift']());}};_0x58e6e8(++_0xe9048);}(_0xe0ce,0x19f));var _0xee0c=function(_0x37a3f3,_0x663b49){_0x37a3f3=_0x37a3f3-0x0;var _0x4da923=_0xe0ce[_0x37a3f3];return _0x4da923;};'use strict';var moment=require(_0xee0c('0x0'));var util=require(_0xee0c('0x1'));var _=require(_0xee0c('0x2'));var client=require(_0xee0c('0x3'));exports[_0xee0c('0x4')]=function(_0x31262f){return client[_0xee0c('0x5')](_0xee0c('0x6'),{'body':_[_0xee0c('0x7')](_0x31262f,{'source':_0x31262f['calleridnum'],'destinationcontext':_0x31262f[_0xee0c('0x8')],'callerid':_0x31262f[_0xee0c('0x9')],'amaflags':_0xee0c('0xa')}),'log':_0xee0c('0x6')});};exports[_0xee0c('0xb')]=function(){return function(){return client[_0xee0c('0x5')]('GetVoiceCallReport',{'options':{'where':{'type':[_0xee0c('0xc')],'createdAt':{'$between':[moment()[_0xee0c('0xd')](_0xee0c('0xe'))[_0xee0c('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0xee0c('0xe'))['format'](_0xee0c('0x10'))]}},'attributes':[_0xee0c('0x11'),'disposition',_0xee0c('0x12'),_0xee0c('0x13')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 4dcbc63..ccc07c2 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 _0x6263=['create','CreateVoiceDialReport','../client'];(function(_0x24dd33,_0xcdb9c3){var _0x4c5261=function(_0x41b9df){while(--_0x41b9df){_0x24dd33['push'](_0x24dd33['shift']());}};_0x4c5261(++_0xcdb9c3);}(_0x6263,0x1c1));var _0x3626=function(_0x35b378,_0x35674d){_0x35b378=_0x35b378-0x0;var _0x592edd=_0x6263[_0x35b378];return _0x592edd;};'use strict';var client=require(_0x3626('0x0'));exports[_0x3626('0x1')]=function(_0x5d3bc6){return client['Request']('CreateVoiceDialReport',{'body':_0x5d3bc6,'log':_0x3626('0x2')});}; \ No newline at end of file +var _0x8d42=['../client','Request','CreateVoiceDialReport'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x8d42,0xde));var _0x28d4=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x8d42[_0x37c22c];return _0x119d79;};'use strict';var client=require(_0x28d4('0x0'));exports['create']=function(_0x5af170){return client[_0x28d4('0x1')](_0x28d4('0x2'),{'body':_0x5af170,'log':_0x28d4('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 1d33194..69ff438 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 _0xcd31=['recordingFormat','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcd31,0x15d));var _0x1cd3=function(_0xcf8432,_0xa5556a){_0xcf8432=_0xcf8432-0x0;var _0x3b5f02=_0xcd31[_0xcf8432];return _0x3b5f02;};'use strict';var client=require('../client');exports[_0x1cd3('0x0')]=function(){return function(){return client[_0x1cd3('0x1')](_0x1cd3('0x2'),{'options':{'raw':!![],'attributes':['id','exten',_0x1cd3('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x1cd3('0x0')});};}; \ No newline at end of file +var _0x8130=['recordingFormat','../client','getVoiceExtensions','GetVoiceExtension','exten'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x8130,0x146));var _0x0813=function(_0x4d5df4,_0x41efb6){_0x4d5df4=_0x4d5df4-0x0;var _0x115f13=_0x8130[_0x4d5df4];return _0x115f13;};'use strict';var client=require(_0x0813('0x0'));exports[_0x0813('0x1')]=function(){return function(){return client['Request'](_0x0813('0x2'),{'options':{'raw':!![],'attributes':['id',_0x0813('0x3'),_0x0813('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x0813('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 25ef864..fb861eb 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 _0x57b7=['TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acwTimeout','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','Pause'];(function(_0x355e28,_0x5c7730){var _0x378532=function(_0xf80c9a){while(--_0xf80c9a){_0x355e28['push'](_0x355e28['shift']());}};_0x378532(++_0x5c7730);}(_0x57b7,0x184));var _0x757b=function(_0x286da0,_0x3479da){_0x286da0=_0x286da0-0x0;var _0x1bce22=_0x57b7[_0x286da0];return _0x1bce22;};'use strict';var client=require(_0x757b('0x0'));exports[_0x757b('0x1')]=function(){return function(){return client[_0x757b('0x2')](_0x757b('0x3'),{'options':{'raw':![],'attributes':['id',_0x757b('0x4'),'acw',_0x757b('0x5'),'autopause',_0x757b('0x6'),_0x757b('0x7'),_0x757b('0x8'),_0x757b('0x9'),_0x757b('0xa'),_0x757b('0xb'),_0x757b('0xc'),_0x757b('0xd'),_0x757b('0xe'),_0x757b('0xf'),_0x757b('0x10'),'dialOriginateCallerIdNumber',_0x757b('0x11'),_0x757b('0x12'),_0x757b('0x13'),_0x757b('0x14'),_0x757b('0x15'),_0x757b('0x16'),_0x757b('0x17'),_0x757b('0x18'),'dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency',_0x757b('0x19'),_0x757b('0x1a'),_0x757b('0x1b'),'dialPrefix',_0x757b('0x1c'),_0x757b('0x1d'),_0x757b('0x1e'),_0x757b('0x1f'),_0x757b('0x20'),_0x757b('0x21'),_0x757b('0x22'),_0x757b('0x23'),'dialAMDMaximumNumberOfWords',_0x757b('0x24'),_0x757b('0x25'),_0x757b('0x26'),'dialRecallMeTimeout',_0x757b('0x27'),_0x757b('0x28'),_0x757b('0x29'),'dialAgiAfterHangupClient','dialQueueProject2',_0x757b('0x6'),_0x757b('0x2a'),_0x757b('0x2b'),_0x757b('0x2c'),_0x757b('0x2d'),'dialNoSuchNumberRetryFrequency',_0x757b('0x2e'),_0x757b('0x2f'),'dialAbandonedMaxRetry',_0x757b('0x30'),_0x757b('0x31'),_0x757b('0x32'),_0x757b('0x33'),_0x757b('0x34'),'mandatoryDisposition',_0x757b('0x35'),_0x757b('0x36'),_0x757b('0x37'),_0x757b('0x38')],'include':[{'model':_0x757b('0x39'),'as':_0x757b('0x39'),'attributes':['id',_0x757b('0x4'),_0x757b('0x3a'),'active']},{'model':_0x757b('0x3b'),'as':'mandatoryDispositionPause','attributes':['id',_0x757b('0x4')]},{'model':_0x757b('0x39'),'as':_0x757b('0x3c'),'attributes':['id',_0x757b('0x4'),_0x757b('0x3a'),'active']},{'model':'Interval','as':_0x757b('0x3d'),'attributes':['id','name'],'include':[{'model':_0x757b('0x3d'),'as':_0x757b('0x3e'),'attributes':['id',_0x757b('0x4'),_0x757b('0x3f')]}]}]},'log':_0x757b('0x1')});};}; \ No newline at end of file +var _0xb100=['dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialAgiAfterHangupAgent','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPreviewRecallmeReminder','Trunk','active','Pause','mandatoryDispositionPause','TrunkBackup','callerid','Interval','Intervals','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','monitor_format','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout'];(function(_0x9b243f,_0x3f5ece){var _0x2a3d3b=function(_0x5aac39){while(--_0x5aac39){_0x9b243f['push'](_0x9b243f['shift']());}};_0x2a3d3b(++_0x3f5ece);}(_0xb100,0x143));var _0x0b10=function(_0x585829,_0x81f0f0){_0x585829=_0x585829-0x0;var _0x3c1c02=_0xb100[_0x585829];return _0x3c1c02;};'use strict';var client=require(_0x0b10('0x0'));exports[_0x0b10('0x1')]=function(){return function(){return client[_0x0b10('0x2')](_0x0b10('0x3'),{'options':{'raw':![],'attributes':['id',_0x0b10('0x4'),_0x0b10('0x5'),_0x0b10('0x6'),'autopause',_0x0b10('0x7'),'type',_0x0b10('0x8'),'dialMethod',_0x0b10('0x9'),_0x0b10('0xa'),_0x0b10('0xb'),'dialPredictiveOptimization',_0x0b10('0xc'),_0x0b10('0xd'),_0x0b10('0xe'),_0x0b10('0xf'),_0x0b10('0x10'),_0x0b10('0x11'),_0x0b10('0x12'),_0x0b10('0x13'),_0x0b10('0x14'),_0x0b10('0x15'),'dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency',_0x0b10('0x16'),_0x0b10('0x17'),_0x0b10('0x18'),_0x0b10('0x19'),_0x0b10('0x1a'),_0x0b10('0x1b'),_0x0b10('0x1c'),'dialAMDGreeting',_0x0b10('0x1d'),'dialAMDTotalAnalysisTime',_0x0b10('0x1e'),_0x0b10('0x1f'),_0x0b10('0x20'),_0x0b10('0x21'),_0x0b10('0x22'),_0x0b10('0x23'),_0x0b10('0x24'),'dialRecallInQueue','dialOrderByScheduledAt',_0x0b10('0x25'),'dialAgiAfterHangupClient','dialQueueProject2',_0x0b10('0x7'),_0x0b10('0x26'),_0x0b10('0x27'),_0x0b10('0x28'),_0x0b10('0x29'),_0x0b10('0x2a'),_0x0b10('0x2b'),_0x0b10('0x2c'),'dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency',_0x0b10('0x2d'),_0x0b10('0x2e'),_0x0b10('0x2f'),'dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe',_0x0b10('0x30')],'include':[{'model':_0x0b10('0x31'),'as':_0x0b10('0x31'),'attributes':['id','name','callerid',_0x0b10('0x32')]},{'model':_0x0b10('0x33'),'as':_0x0b10('0x34'),'attributes':['id',_0x0b10('0x4')]},{'model':_0x0b10('0x31'),'as':_0x0b10('0x35'),'attributes':['id',_0x0b10('0x4'),_0x0b10('0x36'),_0x0b10('0x32')]},{'model':_0x0b10('0x37'),'as':_0x0b10('0x37'),'attributes':['id',_0x0b10('0x4')],'include':[{'model':_0x0b10('0x37'),'as':_0x0b10('0x38'),'attributes':['id',_0x0b10('0x4'),'interval']}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 6b07d53..3a3a51a 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(_0x1fbbc1,_0x1d0ca1){var _0x198383=function(_0x36841e){while(--_0x36841e){_0x1fbbc1['push'](_0x1fbbc1['shift']());}};_0x198383(++_0x1d0ca1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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(_0x2728b8,_0x4691f4){var _0x225b7a=function(_0xecdfcd){while(--_0xecdfcd){_0x2728b8['push'](_0x2728b8['shift']());}};_0x225b7a(++_0x4691f4);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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 bd669c9..ef9056f 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 _0x2e23=['Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x2621e0,_0x4d0a6d){var _0xad9b8d=function(_0x5ba750){while(--_0x5ba750){_0x2621e0['push'](_0x2621e0['shift']());}};_0xad9b8d(++_0x4d0a6d);}(_0x2e23,0xa4));var _0x32e2=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x2e23[_0x55e08b];return _0xd1a7ff;};'use strict';var client=require('../client');exports[_0x32e2('0x0')]=function(_0x3c398c){return function(){return client[_0x32e2('0x1')](_0x32e2('0x2'),{'options':{'where':{'VoiceQueueId':_0x3c398c,'paused':!![]},'raw':!![]},'log':_0x32e2('0x0')});};}; \ No newline at end of file +var _0x03eb=['../client','getVoiceQueueRtPauses','GetVoiceQueueRtPauses'];(function(_0x426dd2,_0x4b0012){var _0x4bc76c=function(_0x4c0732){while(--_0x4c0732){_0x426dd2['push'](_0x426dd2['shift']());}};_0x4bc76c(++_0x4b0012);}(_0x03eb,0x1ad));var _0xb03e=function(_0x2b7065,_0x2282c8){_0x2b7065=_0x2b7065-0x0;var _0x43294a=_0x03eb[_0x2b7065];return _0x43294a;};'use strict';var client=require(_0xb03e('0x0'));exports[_0xb03e('0x1')]=function(_0x33841b){return function(){return client['Request'](_0xb03e('0x2'),{'options':{'where':{'VoiceQueueId':_0x33841b,'paused':!![]},'raw':!![]},'log':_0xb03e('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 7231063..b72f9e5 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x1b5f03,_0xb098f8){var _0x83101=function(_0x21236f){while(--_0x21236f){_0x1b5f03['push'](_0x1b5f03['shift']());}};_0x83101(++_0xb098f8);}(_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 +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x3819a4,_0x4e13a2){var _0x484f13=function(_0x56f138){while(--_0x56f138){_0x3819a4['push'](_0x3819a4['shift']());}};_0x484f13(++_0x4e13a2);}(_0x7a54,0x106));var _0x47a5=function(_0x257822,_0x321b2d){_0x257822=_0x257822-0x0;var _0x410673=_0x7a54[_0x257822];return _0x410673;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index bb3b88e..049ccc1 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 _0xf7da=['extension','blind','attendedTransfer','result','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','origtransferercontext','attended','transfers','blindTransfer','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereecontext','transfereelinkedid','isexternal'];(function(_0x52dfc9,_0x5f5300){var _0x58d261=function(_0x55ffba){while(--_0x55ffba){_0x52dfc9['push'](_0x52dfc9['shift']());}};_0x58d261(++_0x5f5300);}(_0xf7da,0xc5));var _0xaf7d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf7da[_0xa464c9];return _0x3d73c4;};'use strict';var client=require('../client');exports[_0xaf7d('0x0')]={};exports[_0xaf7d('0x1')]=function(_0x55cdb8){return client[_0xaf7d('0x2')](_0xaf7d('0x3'),{'body':{'result':_0x55cdb8['result'],'transfererchannel':_0x55cdb8[_0xaf7d('0x4')],'transferercalleridnum':_0x55cdb8[_0xaf7d('0x5')],'transferercalleridname':_0x55cdb8[_0xaf7d('0x6')],'transfererconnectedlinenum':_0x55cdb8[_0xaf7d('0x7')],'transfererconnectedlinename':_0x55cdb8[_0xaf7d('0x8')],'transfereraccountcode':_0x55cdb8[_0xaf7d('0x9')],'transferercontext':_0x55cdb8[_0xaf7d('0xa')],'transfererexten':_0x55cdb8[_0xaf7d('0xb')],'transfererlinkedid':_0x55cdb8[_0xaf7d('0xc')],'transfereechannel':_0x55cdb8[_0xaf7d('0xd')],'transfereecalleridnum':_0x55cdb8[_0xaf7d('0xe')],'transfereecalleridname':_0x55cdb8[_0xaf7d('0xf')],'transfereeconnectedlinenum':_0x55cdb8['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x55cdb8['transfereeconnectedlinename'],'transfereeaccountcode':_0x55cdb8['transfereeaccountcode'],'transfereecontext':_0x55cdb8[_0xaf7d('0x10')],'transfereeexten':_0x55cdb8['transfereeexten'],'transfereelinkedid':_0x55cdb8[_0xaf7d('0x11')],'isexternal':_0x55cdb8[_0xaf7d('0x12')],'context':_0x55cdb8['context'],'extension':_0x55cdb8[_0xaf7d('0x13')],'type':_0xaf7d('0x14')},'log':_0xaf7d('0x3')});};exports[_0xaf7d('0x15')]=function(_0x9cea53){return client[_0xaf7d('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x9cea53[_0xaf7d('0x16')],'transfererchannel':_0x9cea53[_0xaf7d('0x17')],'transferercalleridnum':_0x9cea53[_0xaf7d('0x18')],'transferercalleridname':_0x9cea53['origtransferercalleridname'],'transfererconnectedlinenum':_0x9cea53[_0xaf7d('0x19')],'transfererconnectedlinename':_0x9cea53[_0xaf7d('0x1a')],'transfereraccountcode':_0x9cea53[_0xaf7d('0x1b')],'transferercontext':_0x9cea53['secondtransferercontext'],'transfererexten':_0x9cea53['secondtransfererexten'],'transfererlinkedid':_0x9cea53[_0xaf7d('0x1c')],'transfereechannel':_0x9cea53['transfertargetchannel'],'transfereecalleridnum':_0x9cea53[_0xaf7d('0x1d')],'transfereecalleridname':_0x9cea53[_0xaf7d('0x1e')],'transfereeconnectedlinenum':_0x9cea53[_0xaf7d('0x1f')],'transfereeconnectedlinename':_0x9cea53['transfertargetconnectedlinename'],'transfereeaccountcode':_0x9cea53[_0xaf7d('0x20')],'transfereecontext':_0x9cea53[_0xaf7d('0x21')],'transfereeexten':_0x9cea53['transfertargetexten'],'transfereelinkedid':_0x9cea53['transfertargetlinkedid'],'isexternal':_0x9cea53[_0xaf7d('0x12')],'context':_0x9cea53[_0xaf7d('0x22')],'extension':_0x9cea53['origtransfererexten'],'type':_0xaf7d('0x23')},'log':_0xaf7d('0x3')});}; \ No newline at end of file +var _0xa5cd=['transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','extension','CreateVoiceTransferReport','attendedTransfer','result','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','blindTransfer','Request','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transfererexten','transfererlinkedid'];(function(_0x12c4da,_0x407efd){var _0x4726e5=function(_0x3740e9){while(--_0x3740e9){_0x12c4da['push'](_0x12c4da['shift']());}};_0x4726e5(++_0x407efd);}(_0xa5cd,0x92));var _0xda5c=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xa5cd[_0x1ccdf7];return _0x52a0ae;};'use strict';var client=require(_0xda5c('0x0'));exports['transfers']={};exports[_0xda5c('0x1')]=function(_0x9c5543){return client[_0xda5c('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x9c5543['result'],'transfererchannel':_0x9c5543[_0xda5c('0x3')],'transferercalleridnum':_0x9c5543[_0xda5c('0x4')],'transferercalleridname':_0x9c5543[_0xda5c('0x5')],'transfererconnectedlinenum':_0x9c5543['transfererconnectedlinenum'],'transfererconnectedlinename':_0x9c5543[_0xda5c('0x6')],'transfereraccountcode':_0x9c5543[_0xda5c('0x7')],'transferercontext':_0x9c5543['transferercontext'],'transfererexten':_0x9c5543[_0xda5c('0x8')],'transfererlinkedid':_0x9c5543[_0xda5c('0x9')],'transfereechannel':_0x9c5543[_0xda5c('0xa')],'transfereecalleridnum':_0x9c5543[_0xda5c('0xb')],'transfereecalleridname':_0x9c5543[_0xda5c('0xc')],'transfereeconnectedlinenum':_0x9c5543['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x9c5543['transfereeconnectedlinename'],'transfereeaccountcode':_0x9c5543[_0xda5c('0xd')],'transfereecontext':_0x9c5543[_0xda5c('0xe')],'transfereeexten':_0x9c5543[_0xda5c('0xf')],'transfereelinkedid':_0x9c5543[_0xda5c('0x10')],'isexternal':_0x9c5543[_0xda5c('0x11')],'context':_0x9c5543['context'],'extension':_0x9c5543[_0xda5c('0x12')],'type':'blind'},'log':_0xda5c('0x13')});};exports[_0xda5c('0x14')]=function(_0x542ab8){return client[_0xda5c('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x542ab8[_0xda5c('0x15')],'transfererchannel':_0x542ab8[_0xda5c('0x16')],'transferercalleridnum':_0x542ab8[_0xda5c('0x17')],'transferercalleridname':_0x542ab8[_0xda5c('0x18')],'transfererconnectedlinenum':_0x542ab8['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x542ab8[_0xda5c('0x19')],'transfereraccountcode':_0x542ab8[_0xda5c('0x1a')],'transferercontext':_0x542ab8[_0xda5c('0x1b')],'transfererexten':_0x542ab8[_0xda5c('0x1c')],'transfererlinkedid':_0x542ab8['origtransfererlinkedid'],'transfereechannel':_0x542ab8[_0xda5c('0x1d')],'transfereecalleridnum':_0x542ab8['transfertargetcalleridnum'],'transfereecalleridname':_0x542ab8[_0xda5c('0x1e')],'transfereeconnectedlinenum':_0x542ab8[_0xda5c('0x1f')],'transfereeconnectedlinename':_0x542ab8[_0xda5c('0x20')],'transfereeaccountcode':_0x542ab8['transfertargetaccountcode'],'transfereecontext':_0x542ab8[_0xda5c('0x21')],'transfereeexten':_0x542ab8[_0xda5c('0x22')],'transfereelinkedid':_0x542ab8[_0xda5c('0x23')],'isexternal':_0x542ab8[_0xda5c('0x11')],'context':_0x542ab8[_0xda5c('0x24')],'extension':_0x542ab8[_0xda5c('0x25')],'type':_0xda5c('0x26')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index cfd419e..cd8150e 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 _0xcaaf=['loggedIn','pTalking','sumDuration','sumHoldTime','total','abandoned','waiting','loggedInDb','type','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','find','undefined','values','channels','map','uniqueid','channel','format','filename','MixMonitor','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','resolve','destinationchannel','stop','%s.%s','wav','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','validate','Channel\x20doesn\x27t\x20exist','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','trunks','outboundChannels','outbound','campaigns','Event\x20name\x20mandatory','emit','custom:','event','send','server','http','listen','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','moment','../../../config/environment','../ami','%s/%s','name','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','keys','module','action','Action','then','message','pick','command','Command','catch','voiceQueues','hasOwnProperty'];(function(_0x235343,_0x270d8f){var _0x5cfeca=function(_0x360d02){while(--_0x360d02){_0x235343['push'](_0x235343['shift']());}};_0x5cfeca(++_0x270d8f);}(_0xcaaf,0x66));var _0xfcaa=function(_0xd29be2,_0x3d4870){_0xd29be2=_0xd29be2-0x0;var _0x43e96a=_0xcaaf[_0xd29be2];return _0x43e96a;};'use strict';var _=require(_0xfcaa('0x0'));var util=require('util');var jayson=require(_0xfcaa('0x1'));var schema=require('validate');var BPromise=require('bluebird');var moment=require(_0xfcaa('0x2'));var config=require(_0xfcaa('0x3'));var properties=require('../properties');var ami=require(_0xfcaa('0x4'));exports['listen']=function(_0x581a66,_0x3011eb,_0x83f91d){return new BPromise(function(_0x146224,_0x28a6b6){var _0x26678d={'QueuePause':function(_0x287c48){return new Promise(function(_0x15ef84,_0x4ee7d3){var _0xa0706d=util['format'](_0xfcaa('0x5'),'SIP',_0x287c48[_0xfcaa('0x6')]);if(_0x581a66['timers']&&_0x581a66['timers'][_0xa0706d]&&_0x581a66[_0xfcaa('0x7')][_0xa0706d]['timer']){_0x581a66[_0xfcaa('0x7')][_0xa0706d][_0xfcaa('0x8')]();}if(_0x581a66[_0xfcaa('0x9')][_0xa0706d]){_0x581a66[_0xfcaa('0x9')][_0xa0706d][_0xfcaa('0xa')]({'statePause':_0x287c48[_0xfcaa('0xb')]?!![]:![]});}_0x15ef84({'code':0xc8,'message':_0xfcaa('0xc')});});},'Reload':function(_0xc03e64){var _0x4ac03d=this;return new Promise(function(_0x5831ba,_0xf92410){if(ami[_0xfcaa('0xd')]()==![]){return _0xf92410(_0x4ac03d[_0xfcaa('0xe')](0x1f4,[config['asterisk']['ip'],config[_0xfcaa('0xf')][_0xfcaa('0x10')],_0xfcaa('0x11')][_0xfcaa('0x12')]('\x20')));}_0xc03e64=_['pick'](_0xc03e64,_[_0xfcaa('0x13')](properties[_0xfcaa('0x14')]));_0xc03e64[_0xfcaa('0x15')]='Reload';return ami[_0xfcaa('0x16')](_0xc03e64)[_0xfcaa('0x17')](function(_0x5c0705){_0x5831ba({'code':0xc8,'message':_0x5c0705[_0xfcaa('0x18')]});})['catch'](function(_0x587419){_0xf92410(_0x4ac03d[_0xfcaa('0xe')](0x1f5,_0x587419[_0xfcaa('0x18')]));});});},'Command':function(_0x416132){var _0xa4df1=this;return new Promise(function(_0x2b56e4,_0x4566e1){if(ami[_0xfcaa('0xd')]()==![]){return _0x4566e1(_0xa4df1[_0xfcaa('0xe')](0x1f4,[config[_0xfcaa('0xf')]['ip'],config[_0xfcaa('0xf')]['username'],_0xfcaa('0x11')][_0xfcaa('0x12')]('\x20')));}_0x416132=_[_0xfcaa('0x19')](_0x416132,_0xfcaa('0x1a'));_0x416132[_0xfcaa('0x15')]=_0xfcaa('0x1b');return ami[_0xfcaa('0x16')](_0x416132)[_0xfcaa('0x17')](function(_0x653ca8){_0x2b56e4({'code':0xc8,'message':_0x653ca8['content']});})[_0xfcaa('0x1c')](function(_0x1526d9){_0x4566e1(_0xa4df1[_0xfcaa('0xe')](0x1f5,_0x1526d9['message']));});});},'VoiceQueues':function(_0x1d8e09){return new Promise(function(_0x59c206,_0x4642bb){var _0x2209d8=[];for(var _0x3dc1d4 in _0x581a66[_0xfcaa('0x1d')]){if(_0x581a66[_0xfcaa('0x1d')][_0xfcaa('0x1e')](_0x3dc1d4)){var _0xf471ce=_0x581a66[_0xfcaa('0x1d')][_0x3dc1d4];var _0x3ba17e={'id':_0xf471ce['id'],'name':_0xf471ce['name'],'strategy':_0xf471ce['strategy'],'answered':_0xf471ce['answered'],'available':_0xf471ce['available'],'loggedIn':_0xf471ce[_0xfcaa('0x1f')],'pTalking':_0xf471ce[_0xfcaa('0x20')],'sumBillable':_0xf471ce['sumBillable'],'sumDuration':_0xf471ce[_0xfcaa('0x21')],'sumHoldTime':_0xf471ce[_0xfcaa('0x22')]||0x0,'talking':_0xf471ce['talking'],'total':_0xf471ce[_0xfcaa('0x23')],'type':_0xf471ce['type'],'unmanaged':_0xf471ce['unmanaged'],'abandoned':_0xf471ce[_0xfcaa('0x24')],'waiting':_0xf471ce[_0xfcaa('0x25')],'loggedInDb':_0xf471ce[_0xfcaa('0x26')]};if(_0xf471ce[_0xfcaa('0x27')]==='outbound'){_0x3ba17e[_0xfcaa('0x28')]=_0xf471ce[_0xfcaa('0x28')];_0x3ba17e['dialMethod']=_0xf471ce[_0xfcaa('0x29')];_0x3ba17e[_0xfcaa('0x2a')]=_0xf471ce[_0xfcaa('0x2a')];_0x3ba17e[_0xfcaa('0x2b')]=_0xf471ce[_0xfcaa('0x2b')];_0x3ba17e[_0xfcaa('0x2c')]=_0xf471ce['dialOriginateTimeout'];_0x3ba17e[_0xfcaa('0x2d')]=_0xf471ce[_0xfcaa('0x2d')];_0x3ba17e[_0xfcaa('0x2e')]=_0xf471ce[_0xfcaa('0x2e')];_0x3ba17e['outboundAnswerAgiCallsDay']=_0xf471ce[_0xfcaa('0x2f')];_0x3ba17e['outboundAnswerCallsDay']=_0xf471ce[_0xfcaa('0x30')];_0x3ba17e['outboundBlacklistCallsDay']=_0xf471ce[_0xfcaa('0x31')];_0x3ba17e[_0xfcaa('0x32')]=_0xf471ce[_0xfcaa('0x32')];_0x3ba17e[_0xfcaa('0x33')]=_0xf471ce[_0xfcaa('0x33')];_0x3ba17e[_0xfcaa('0x34')]=_0xf471ce['outboundDropCallsDayACS'];_0x3ba17e[_0xfcaa('0x35')]=_0xf471ce[_0xfcaa('0x35')];_0x3ba17e[_0xfcaa('0x36')]=_0xf471ce[_0xfcaa('0x36')];_0x3ba17e[_0xfcaa('0x37')]=_0xf471ce[_0xfcaa('0x37')];_0x3ba17e[_0xfcaa('0x38')]=_0xf471ce[_0xfcaa('0x38')];_0x3ba17e[_0xfcaa('0x39')]=_0xf471ce[_0xfcaa('0x39')];_0x3ba17e[_0xfcaa('0x3a')]=_0xf471ce[_0xfcaa('0x3a')];_0x3ba17e[_0xfcaa('0x3b')]=_0xf471ce[_0xfcaa('0x3b')];_0x3ba17e['outboundUnknownCallsDay']=_0xf471ce['outboundUnknownCallsDay'];_0x3ba17e[_0xfcaa('0x3c')]=_0xf471ce['predictiveIntervalAnsweredCalls'];_0x3ba17e[_0xfcaa('0x3d')]=_0xf471ce['predictiveIntervalAvgHoldtime'];_0x3ba17e[_0xfcaa('0x3e')]=_0xf471ce['predictiveIntervalAvgTalktime'];_0x3ba17e[_0xfcaa('0x3f')]=_0xf471ce[_0xfcaa('0x3f')];_0x3ba17e[_0xfcaa('0x40')]=_0xf471ce[_0xfcaa('0x40')];_0x3ba17e[_0xfcaa('0x41')]=_0xf471ce[_0xfcaa('0x41')];_0x3ba17e[_0xfcaa('0x42')]=_0xf471ce[_0xfcaa('0x42')];_0x3ba17e['predictiveIntervalHitRate']=_0xf471ce[_0xfcaa('0x43')];_0x3ba17e[_0xfcaa('0x44')]=_0xf471ce[_0xfcaa('0x44')];_0x3ba17e['predictiveIntervalPauses']=_0xf471ce[_0xfcaa('0x45')];_0x3ba17e[_0xfcaa('0x46')]=_0xf471ce[_0xfcaa('0x46')];_0x3ba17e[_0xfcaa('0x47')]=_0xf471ce[_0xfcaa('0x47')];_0x3ba17e['message']=_0xf471ce[_0xfcaa('0x18')];_0x3ba17e[_0xfcaa('0x48')]=_0xf471ce[_0xfcaa('0x48')];_0x3ba17e[_0xfcaa('0x49')]=_0xf471ce[_0xfcaa('0x49')];_0x3ba17e['erlangCallToSecond']=_0xf471ce['erlangCallToSecond'];_0x3ba17e[_0xfcaa('0x4a')]=_0xf471ce[_0xfcaa('0x4a')];_0x3ba17e['erlangBusyFactor']=_0xf471ce[_0xfcaa('0x4b')];_0x3ba17e[_0xfcaa('0x4c')]=_0xf471ce['startPredictive'];_0x3ba17e[_0xfcaa('0x4d')]=_0xf471ce[_0xfcaa('0x4d')];}if(_0xf471ce[_0xfcaa('0x4e')]){_0x3ba17e[_0xfcaa('0x4e')]={'id':_0xf471ce['Trunk']['id'],'name':_0xf471ce[_0xfcaa('0x4e')][_0xfcaa('0x6')],'active':_0xf471ce['Trunk'][_0xfcaa('0x4f')],'callerid':_0xf471ce[_0xfcaa('0x4e')][_0xfcaa('0x50')]};}if(_0xf471ce[_0xfcaa('0x51')]){_0x3ba17e[_0xfcaa('0x51')]={'id':_0xf471ce['Interval']['id'],'name':_0xf471ce[_0xfcaa('0x51')][_0xfcaa('0x6')]};}_0x2209d8[_0xfcaa('0x52')](_0x3ba17e);}}_0x59c206({'count':_0x2209d8[_0xfcaa('0x53')],'rows':_0x2209d8});});},'UpdateVoiceQueue':function(_0x23cf9e){return new Promise(function(_0x32667c,_0xdca61f){var _0x5b6e69=_[_0xfcaa('0x54')](_0x581a66['voiceQueues'],{'id':parseInt(_0x23cf9e['id'])});var _0x420c2c=_['omit'](_0x23cf9e,['id']);if(_0x5b6e69){for(var _0x45d310 in _0x420c2c){if(typeof _0x420c2c[_0x45d310]!=='undefined'&&typeof _0x5b6e69[_0x45d310]!==_0xfcaa('0x55')){_0x5b6e69[_0x45d310]=_0x420c2c[_0x45d310];}}_0x32667c(_0x5b6e69);}else{_0xdca61f();}});},'VoiceChannels':function(_0x575172){return new Promise(function(_0x1ff01e,_0x2e6e4c){var _0x5808b9=_[_0xfcaa('0x56')](_0x581a66[_0xfcaa('0x57')]);_0x1ff01e({'count':_0x5808b9[_0xfcaa('0x53')],'rows':_0x5808b9});});},'VoiceChannelMixMonitor':function(_0x323d3d){var _0x407ed0=this;return new Promise(function(_0x52ee91,_0x262ae0){if(ami[_0xfcaa('0xd')]()==![]){return _0x262ae0(_0x407ed0[_0xfcaa('0xe')](0x1f4,[config[_0xfcaa('0xf')]['ip'],config[_0xfcaa('0xf')][_0xfcaa('0x10')],_0xfcaa('0x11')][_0xfcaa('0x12')]('\x20')));}var _0x47f0c7=schema(properties['voicechannel'])['validate'](_0x323d3d);if(_0x47f0c7[_0xfcaa('0x53')]>0x0){return _0x262ae0(_0x407ed0['error'](0x1f4,_[_0xfcaa('0x58')](_0x47f0c7,_0xfcaa('0x18'))[_0xfcaa('0x12')](',\x20')));}var _0x4a0ae6=_[_0xfcaa('0x54')](_0x581a66[_0xfcaa('0x57')],{'uniqueid':_0x323d3d[_0xfcaa('0x59')]});if(_0x4a0ae6&&_0x4a0ae6[_0xfcaa('0x5a')]){var _0x4fdd07=util[_0xfcaa('0x5b')]('%s.%s',_0x323d3d[_0xfcaa('0x5c')]||_0x323d3d[_0xfcaa('0x59')],_0x323d3d[_0xfcaa('0x5b')]||'wav');return ami[_0xfcaa('0x16')]({'action':_0xfcaa('0x5d'),'channel':_0x4a0ae6[_0xfcaa('0x5a')],'file':_0x4fdd07,'options':'ai(mixmonitorid)'})[_0xfcaa('0x17')](function(_0x4a7b64){var _0x1316ac=_['find'](_0x4a0ae6[_0xfcaa('0x5e')],{'filename':_0xfcaa('0x5f')+_0x4fdd07[_0xfcaa('0x60')]()});if(_[_0xfcaa('0x61')](_0x1316ac)){_0x4a0ae6['monitors'][_0xfcaa('0x52')]({'filename':_0xfcaa('0x5f')+_0x4fdd07['toLowerCase'](),'createdAt':moment()[_0xfcaa('0x5b')](_0xfcaa('0x62')),'mixmonitorid':_0x4a7b64[_0xfcaa('0x63')],'status':_0xfcaa('0x64')});}else{_0x1316ac['mixmonitorid']=_0x4a7b64[_0xfcaa('0x63')];_0x1316ac[_0xfcaa('0x65')]=_0xfcaa('0x64');}_0x52ee91({'code':0xc8,'message':[_0x323d3d[_0xfcaa('0x59')],'MixMonitor\x20Success',_0x4a7b64[_0xfcaa('0x63')]]['join']('\x20'),'mixmonitorid':_0x4a7b64[_0xfcaa('0x63')]});})[_0xfcaa('0x1c')](function(_0x506fc8){_0x262ae0(_0x407ed0[_0xfcaa('0xe')](0x1f5,[_0x323d3d['uniqueid'],_0x506fc8['message'][_0xfcaa('0x60')]()][_0xfcaa('0x12')]('\x20')));});}else{return _0x262ae0(_0x407ed0[_0xfcaa('0xe')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x5e7973){var _0x38b478=this;return new Promise(function(_0x30e294,_0x2d5411){if(ami['isConnected']()==![]){return _0x2d5411(_0x38b478['error'](0x1f4,[config[_0xfcaa('0xf')]['ip'],config[_0xfcaa('0xf')][_0xfcaa('0x10')],_0xfcaa('0x11')][_0xfcaa('0x12')]('\x20')));}var _0x1c058a=schema(properties['voicechannel'])['validate'](_0x5e7973);if(_0x1c058a[_0xfcaa('0x53')]>0x0){return _0x2d5411(_0x38b478[_0xfcaa('0xe')](0x1f4,_[_0xfcaa('0x58')](_0x1c058a,_0xfcaa('0x18'))[_0xfcaa('0x12')](',\x20')));}var _0x45c54a=_[_0xfcaa('0x54')](_0x581a66['channels'],{'uniqueid':_0x5e7973['uniqueid']});if(_0x45c54a){return BPromise[_0xfcaa('0x66')]()[_0xfcaa('0x17')](function(){if(_0x45c54a['channel']){return ami[_0xfcaa('0x16')]({'action':'StopMixMonitor','channel':_0x45c54a[_0xfcaa('0x5a')],'mixmonitorid':_0x5e7973[_0xfcaa('0x63')]})['catch'](function(_0x3aac86){});}})[_0xfcaa('0x17')](function(){if(_0x45c54a['destinationchannel']){return ami[_0xfcaa('0x16')]({'action':'StopMixMonitor','channel':_0x45c54a[_0xfcaa('0x67')],'mixmonitorid':_0x5e7973[_0xfcaa('0x63')]})['catch'](function(_0x1a478b){});}})[_0xfcaa('0x17')](function(_0x5da520){var _0xc4d7a0=_[_0xfcaa('0x54')](_0x45c54a[_0xfcaa('0x5e')],{'mixmonitorid':_0x5e7973[_0xfcaa('0x63')]});if(_0xc4d7a0){_0xc4d7a0[_0xfcaa('0x65')]=_0xfcaa('0x68');}})[_0xfcaa('0x17')](function(){var _0x94ae21=util[_0xfcaa('0x5b')](_0xfcaa('0x69'),_0x5e7973['filename']||_0x5e7973[_0xfcaa('0x59')],_0x5e7973[_0xfcaa('0x5b')]||_0xfcaa('0x6a'));var _0x7cc5d9=_[_0xfcaa('0x54')](_0x45c54a[_0xfcaa('0x5e')],{'filename':_0xfcaa('0x5f')+_0x94ae21[_0xfcaa('0x60')]()});if(_0x7cc5d9){_0x7cc5d9[_0xfcaa('0x65')]=_0xfcaa('0x68');}})['then'](function(){_0x30e294({'code':0xc8,'message':[_0x5e7973[_0xfcaa('0x59')],_0xfcaa('0x6b')][_0xfcaa('0x12')]('\x20')});})[_0xfcaa('0x1c')](function(_0x314c19){_0x2d5411(_0x38b478[_0xfcaa('0xe')](0x1f5,[_0x5e7973[_0xfcaa('0x59')],_0x314c19[_0xfcaa('0x18')][_0xfcaa('0x60')]()][_0xfcaa('0x12')]('\x20')));});}else{return _0x2d5411(_0x38b478[_0xfcaa('0xe')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x4d1ce2){return new Promise(function(_0x1760c7,_0x104b54){var _0x46581d=_['values'](_0x581a66[_0xfcaa('0x6c')]);_0x1760c7({'count':_0x46581d[_0xfcaa('0x53')],'rows':_0x46581d});});},'VoiceQueuesChannel':function(_0x144bdd){var _0x56f49e=this;return new Promise(function(_0x4432bf,_0x25912c){var _0x3f20b6=schema(properties[_0xfcaa('0x6d')])[_0xfcaa('0x6e')](_0x144bdd);if(_0x3f20b6[_0xfcaa('0x53')]>0x0){return _0x25912c(_0x56f49e[_0xfcaa('0xe')](0x1f4,_['map'](_0x3f20b6,_0xfcaa('0x18'))[_0xfcaa('0x12')](',\x20')));}var _0x3bc655=_[_0xfcaa('0x54')](_0x581a66[_0xfcaa('0x6c')],{'uniqueid':_0x144bdd[_0xfcaa('0x59')]});if(_0x3bc655){_0x4432bf(_0x3bc655);}else{return _0x25912c(_0x56f49e[_0xfcaa('0xe')](0x1f5,_0xfcaa('0x6f')));}});},'VoiceQueuesChannelHangup':function(_0x1adb89){var _0x1644bc=this;return new Promise(function(_0xc3ad08,_0xb8656c){if(ami[_0xfcaa('0xd')]()==![]){return _0xb8656c(_0x1644bc[_0xfcaa('0xe')](0x1f4,[config[_0xfcaa('0xf')]['ip'],config[_0xfcaa('0xf')]['username'],'ami\x20disconnected']['join']('\x20')));}var _0x167e61=schema(properties[_0xfcaa('0x70')])[_0xfcaa('0x6e')](_0x1adb89);if(_0x167e61[_0xfcaa('0x53')]>0x0){return _0xb8656c(_0x1644bc['error'](0x1f4,_[_0xfcaa('0x58')](_0x167e61,_0xfcaa('0x18'))[_0xfcaa('0x12')](',\x20')));}var _0x11903a=_[_0xfcaa('0x54')](_0x581a66[_0xfcaa('0x6c')],{'uniqueid':_0x1adb89[_0xfcaa('0x59')]});if(_0x11903a&&_0x11903a[_0xfcaa('0x5a')]){return ami[_0xfcaa('0x16')]({'action':_0xfcaa('0x71'),'channel':_0x11903a[_0xfcaa('0x5a')]})[_0xfcaa('0x17')](function(_0x3cadb1){_0xc3ad08({'code':0xc8,'message':[_0x1adb89[_0xfcaa('0x59')],_0x3cadb1[_0xfcaa('0x18')][_0xfcaa('0x60')]()][_0xfcaa('0x12')]('\x20')});})[_0xfcaa('0x1c')](function(_0x3210aa){_0xb8656c(_0x1644bc[_0xfcaa('0xe')](0x1f5,[_0x1adb89[_0xfcaa('0x59')],_0x3210aa[_0xfcaa('0x18')][_0xfcaa('0x60')]()][_0xfcaa('0x12')]('\x20')));});}else{return _0xb8656c(_0x1644bc['error'](0x1f5,_0xfcaa('0x6f')));}});},'VoiceQueuesChannelRedirect':function(_0x3a6544){var _0xcbac03=this;return new Promise(function(_0x83f28f,_0x36b205){if(ami[_0xfcaa('0xd')]()==![]){return _0x36b205(_0xcbac03[_0xfcaa('0xe')](0x1f4,[config[_0xfcaa('0xf')]['ip'],config[_0xfcaa('0xf')][_0xfcaa('0x10')],_0xfcaa('0x11')][_0xfcaa('0x12')]('\x20')));}var _0x32268e=schema(properties[_0xfcaa('0x72')])['validate'](_0x3a6544);if(_0x32268e[_0xfcaa('0x53')]>0x0){return _0x36b205(_0xcbac03[_0xfcaa('0xe')](0x1f4,_[_0xfcaa('0x58')](_0x32268e,_0xfcaa('0x18'))[_0xfcaa('0x12')](',\x20')));}var _0x1ee72f=_['find'](_0x581a66[_0xfcaa('0x6c')],{'uniqueid':_0x3a6544[_0xfcaa('0x59')]});if(_0x1ee72f&&_0x1ee72f[_0xfcaa('0x5a')]){return ami[_0xfcaa('0x16')]({'action':_0xfcaa('0x73'),'channel':_0x1ee72f[_0xfcaa('0x5a')],'exten':_0x3a6544[_0xfcaa('0x74')],'context':_0x3a6544[_0xfcaa('0x75')]||_0x1ee72f[_0xfcaa('0x75')],'priority':0x1})[_0xfcaa('0x17')](function(_0x158add){_0x83f28f({'code':0xc8,'message':[_0x3a6544[_0xfcaa('0x59')],_0x158add[_0xfcaa('0x18')][_0xfcaa('0x60')]()][_0xfcaa('0x12')]('\x20')});})['catch'](function(_0x9999f3){_0x36b205(_0xcbac03[_0xfcaa('0xe')](0x1f5,[_0x3a6544[_0xfcaa('0x59')],_0x9999f3[_0xfcaa('0x18')][_0xfcaa('0x60')]()][_0xfcaa('0x12')]('\x20')));});}else{return _0x36b205(_0xcbac03['error'](0x1f5,_0xfcaa('0x6f')));}});},'Agents':function(_0x40030b){return new Promise(function(_0x2ca18c,_0x5ad5e0){var _0x97b150=_[_0xfcaa('0x56')](_0x581a66[_0xfcaa('0x9')]);_0x2ca18c({'count':_0x97b150[_0xfcaa('0x53')],'rows':_0x97b150});});},'Telephones':function(_0x1bb5c3){return new Promise(function(_0x5d593d,_0x21c452){var _0x43056c=_[_0xfcaa('0x56')](_0x581a66['telephones']);_0x5d593d({'count':_0x43056c[_0xfcaa('0x53')],'rows':_0x43056c});});},'Trunks':function(_0x1bffd5){return new Promise(function(_0x132841,_0x4999fd){var _0xafbc17=_[_0xfcaa('0x56')](_0x581a66[_0xfcaa('0x76')]);_0x132841({'count':_0xafbc17['length'],'rows':_0xafbc17});});},'OutboundChannels':function(_0x48e506){return new Promise(function(_0x40f152,_0x404880){var _0xc2646=_[_0xfcaa('0x56')](_0x581a66[_0xfcaa('0x77')]);_0x40f152({'count':_0xc2646[_0xfcaa('0x53')],'rows':_0xc2646});});},'Outbound':function(_0x9a7646){return new Promise(function(_0x51cc7c,_0x5eaf47){_0x51cc7c(_0x581a66[_0xfcaa('0x78')]);});},'Campaigns':function(_0x5b8efa){return new Promise(function(_0xaeb3db,_0x4cfcfd){var _0x476a74=_[_0xfcaa('0x56')](_0x581a66[_0xfcaa('0x79')]);_0xaeb3db({'count':_0x476a74['length'],'rows':_0x476a74});});},'VoiceQueuesPreview':function(_0x313214){var _0x171b6f=this;return new Promise(function(_0x355d6d,_0x5d9f5c){_0x3011eb['run'](_0x313214['id'])['then'](function(_0x4f9ee3){_0x355d6d({'code':0xc8,'message':_0x4f9ee3[_0xfcaa('0x18')]});})[_0xfcaa('0x1c')](function(_0x5c8b01){_0x5d9f5c(_0x171b6f['error'](0x1f4,_0x5c8b01[_0xfcaa('0x18')]));});});},'EventManager':function(_0x1bc0cc){var _0x3738ef=this;return new Promise(function(_0x40a0b9,_0x1a2357){if(!_0x1bc0cc['event']){return _0x1a2357(_0x3738ef['error'](0x1f4,_0xfcaa('0x7a')));}ami[_0xfcaa('0x7b')](_0xfcaa('0x7c')+_0x1bc0cc[_0xfcaa('0x7d')],_0x1bc0cc[_0xfcaa('0x18')]);_0x40a0b9({'code':0xc8,'message':_0x1bc0cc});});},'FaxAccounts':function(_0x5a89a4){return new Promise(function(_0x3dc83a,_0x2296cc){var _0x5f4892=_[_0xfcaa('0x56')](_0x581a66['faxAccounts']);_0x3dc83a({'count':_0x5f4892[_0xfcaa('0x53')],'rows':_0x5f4892});});},'SendFax':function(_0x11c00f){var _0x3216bd=this;return new Promise(function(_0x4068e6,_0x58187d){_0x83f91d[_0xfcaa('0x7e')](_0x11c00f)[_0xfcaa('0x17')](function(_0x2f5563){_0x4068e6({'code':0xc8,'message':_0x2f5563[_0xfcaa('0x18')]});})[_0xfcaa('0x1c')](function(_0x123102){_0x58187d(_0x3216bd['error'](0x1f4,_0x123102['message']));});});},'CheckAfterSend':function(_0x343396){var _0x2dee0b=this;return new Promise(function(_0x32475d,_0xb9a905){_0x83f91d['checkAfterSend'](_0x343396)[_0xfcaa('0x17')](function(_0x227184){_0x32475d({'code':0xc8,'message':_0x227184[_0xfcaa('0x18')]});})['catch'](function(_0x1eefbc){_0xb9a905(_0x2dee0b[_0xfcaa('0xe')](0x1f4,_0x1eefbc[_0xfcaa('0x18')]));});});}};var _0x5dbc15=jayson[_0xfcaa('0x7f')](_0x26678d)[_0xfcaa('0x80')]();_0x5dbc15['on']('error',function(_0x706bd8){return _0x28a6b6(_0x706bd8);});_0x5dbc15[_0xfcaa('0x81')](0x232a,'127.0.0.1',function(){console[_0xfcaa('0x82')](_0xfcaa('0x83'),0x232a);return _0x146224(_0xfcaa('0x84')+0x232a);});});}; \ No newline at end of file +var _0x41fe=['predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','name','active','callerid','Interval','push','length','omit','undefined','values','voicechannel','channels','uniqueid','channel','format','filename','MixMonitor','ai(mixmonitorid)','find','monitors','toLowerCase','isNil','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','map','resolve','StopMixMonitor','destinationchannel','stop','wav','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','Channel\x20doesn\x27t\x20exist','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','exten','context','telephones','trunks','outboundChannels','run','event','emit','custom:','faxAccounts','send','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','bluebird','moment','../../../config/environment','../properties','../ami','listen','%s/%s','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','then','catch','message','isConnected','command','Command','Action','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable'];(function(_0x5bc804,_0x421d8b){var _0x273b5d=function(_0x1c9dce){while(--_0x1c9dce){_0x5bc804['push'](_0x5bc804['shift']());}};_0x273b5d(++_0x421d8b);}(_0x41fe,0xd1));var _0xe41f=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x41fe[_0x4e9d3c];return _0x2d0825;};'use strict';var _=require(_0xe41f('0x0'));var util=require(_0xe41f('0x1'));var jayson=require(_0xe41f('0x2'));var schema=require(_0xe41f('0x3'));var BPromise=require(_0xe41f('0x4'));var moment=require(_0xe41f('0x5'));var config=require(_0xe41f('0x6'));var properties=require(_0xe41f('0x7'));var ami=require(_0xe41f('0x8'));exports[_0xe41f('0x9')]=function(_0x456a8a,_0x1e8e93,_0xd3c763){return new BPromise(function(_0x370385,_0x32a410){var _0x6fda32={'QueuePause':function(_0x23fdc9){return new Promise(function(_0x519361,_0x27ba71){var _0x4295a2=util['format'](_0xe41f('0xa'),'SIP',_0x23fdc9['name']);if(_0x456a8a['timers']&&_0x456a8a[_0xe41f('0xb')][_0x4295a2]&&_0x456a8a['timers'][_0x4295a2]['timer']){_0x456a8a['timers'][_0x4295a2][_0xe41f('0xc')]();}if(_0x456a8a[_0xe41f('0xd')][_0x4295a2]){_0x456a8a[_0xe41f('0xd')][_0x4295a2][_0xe41f('0xe')]({'statePause':_0x23fdc9[_0xe41f('0xf')]?!![]:![]});}_0x519361({'code':0xc8,'message':_0xe41f('0x10')});});},'Reload':function(_0x34ae3a){var _0x1f22fb=this;return new Promise(function(_0x2563ca,_0x431536){if(ami['isConnected']()==![]){return _0x431536(_0x1f22fb[_0xe41f('0x11')](0x1f4,[config[_0xe41f('0x12')]['ip'],config['asterisk'][_0xe41f('0x13')],_0xe41f('0x14')][_0xe41f('0x15')]('\x20')));}_0x34ae3a=_[_0xe41f('0x16')](_0x34ae3a,_[_0xe41f('0x17')](properties[_0xe41f('0x18')]));_0x34ae3a[_0xe41f('0x19')]='Reload';return ami['Action'](_0x34ae3a)[_0xe41f('0x1a')](function(_0x5e59e2){_0x2563ca({'code':0xc8,'message':_0x5e59e2['message']});})[_0xe41f('0x1b')](function(_0x15f6c1){_0x431536(_0x1f22fb[_0xe41f('0x11')](0x1f5,_0x15f6c1[_0xe41f('0x1c')]));});});},'Command':function(_0x161549){var _0x5bd220=this;return new Promise(function(_0x374a8e,_0x5339dd){if(ami[_0xe41f('0x1d')]()==![]){return _0x5339dd(_0x5bd220[_0xe41f('0x11')](0x1f4,[config['asterisk']['ip'],config[_0xe41f('0x12')][_0xe41f('0x13')],_0xe41f('0x14')]['join']('\x20')));}_0x161549=_[_0xe41f('0x16')](_0x161549,_0xe41f('0x1e'));_0x161549[_0xe41f('0x19')]=_0xe41f('0x1f');return ami[_0xe41f('0x20')](_0x161549)[_0xe41f('0x1a')](function(_0x9c0c33){_0x374a8e({'code':0xc8,'message':_0x9c0c33['content']});})[_0xe41f('0x1b')](function(_0x5a443f){_0x5339dd(_0x5bd220['error'](0x1f5,_0x5a443f[_0xe41f('0x1c')]));});});},'VoiceQueues':function(_0x234451){return new Promise(function(_0x5cd624,_0x4f7965){var _0x1ac25a=[];for(var _0x573b3 in _0x456a8a[_0xe41f('0x21')]){if(_0x456a8a['voiceQueues'][_0xe41f('0x22')](_0x573b3)){var _0x5790ae=_0x456a8a[_0xe41f('0x21')][_0x573b3];var _0x44fb04={'id':_0x5790ae['id'],'name':_0x5790ae['name'],'strategy':_0x5790ae[_0xe41f('0x23')],'answered':_0x5790ae[_0xe41f('0x24')],'available':_0x5790ae[_0xe41f('0x25')],'loggedIn':_0x5790ae[_0xe41f('0x26')],'pTalking':_0x5790ae[_0xe41f('0x27')],'sumBillable':_0x5790ae[_0xe41f('0x28')],'sumDuration':_0x5790ae[_0xe41f('0x29')],'sumHoldTime':_0x5790ae[_0xe41f('0x2a')]||0x0,'talking':_0x5790ae[_0xe41f('0x2b')],'total':_0x5790ae[_0xe41f('0x2c')],'type':_0x5790ae[_0xe41f('0x2d')],'unmanaged':_0x5790ae[_0xe41f('0x2e')],'abandoned':_0x5790ae[_0xe41f('0x2f')],'waiting':_0x5790ae[_0xe41f('0x30')],'loggedInDb':_0x5790ae[_0xe41f('0x31')]};if(_0x5790ae['type']===_0xe41f('0x32')){_0x44fb04[_0xe41f('0x33')]=_0x5790ae[_0xe41f('0x33')];_0x44fb04[_0xe41f('0x34')]=_0x5790ae[_0xe41f('0x34')];_0x44fb04['dialOriginateCallerIdName']=_0x5790ae[_0xe41f('0x35')];_0x44fb04[_0xe41f('0x36')]=_0x5790ae[_0xe41f('0x36')];_0x44fb04[_0xe41f('0x37')]=_0x5790ae['dialOriginateTimeout'];_0x44fb04['dialPrefix']=_0x5790ae['dialPrefix'];_0x44fb04[_0xe41f('0x38')]=_0x5790ae[_0xe41f('0x38')];_0x44fb04[_0xe41f('0x39')]=_0x5790ae['outboundAnswerAgiCallsDay'];_0x44fb04[_0xe41f('0x3a')]=_0x5790ae[_0xe41f('0x3a')];_0x44fb04[_0xe41f('0x3b')]=_0x5790ae[_0xe41f('0x3b')];_0x44fb04[_0xe41f('0x3c')]=_0x5790ae[_0xe41f('0x3c')];_0x44fb04[_0xe41f('0x3d')]=_0x5790ae[_0xe41f('0x3d')];_0x44fb04[_0xe41f('0x3e')]=_0x5790ae[_0xe41f('0x3e')];_0x44fb04[_0xe41f('0x3f')]=_0x5790ae[_0xe41f('0x3f')];_0x44fb04['outboundDropCallsDayTimeout']=_0x5790ae[_0xe41f('0x40')];_0x44fb04['outboundNoAnswerCallsDay']=_0x5790ae[_0xe41f('0x41')];_0x44fb04['outboundNoSuchCallsDay']=_0x5790ae[_0xe41f('0x42')];_0x44fb04['outboundOriginateFailureCallsDay']=_0x5790ae['outboundOriginateFailureCallsDay'];_0x44fb04[_0xe41f('0x43')]=_0x5790ae[_0xe41f('0x43')];_0x44fb04[_0xe41f('0x44')]=_0x5790ae[_0xe41f('0x44')];_0x44fb04[_0xe41f('0x45')]=_0x5790ae['outboundUnknownCallsDay'];_0x44fb04[_0xe41f('0x46')]=_0x5790ae[_0xe41f('0x46')];_0x44fb04[_0xe41f('0x47')]=_0x5790ae[_0xe41f('0x47')];_0x44fb04[_0xe41f('0x48')]=_0x5790ae[_0xe41f('0x48')];_0x44fb04[_0xe41f('0x49')]=_0x5790ae['predictiveIntervalDroppedCallsCallersExit'];_0x44fb04[_0xe41f('0x4a')]=_0x5790ae[_0xe41f('0x4a')];_0x44fb04[_0xe41f('0x4b')]=_0x5790ae[_0xe41f('0x4b')];_0x44fb04[_0xe41f('0x4c')]=_0x5790ae[_0xe41f('0x4c')];_0x44fb04[_0xe41f('0x4d')]=_0x5790ae[_0xe41f('0x4d')];_0x44fb04[_0xe41f('0x4e')]=_0x5790ae['predictiveIntervalMultiplicativeFactor'];_0x44fb04['predictiveIntervalPauses']=_0x5790ae[_0xe41f('0x4f')];_0x44fb04['predictiveIntervalAvailable']=_0x5790ae[_0xe41f('0x50')];_0x44fb04[_0xe41f('0x51')]=_0x5790ae[_0xe41f('0x51')];_0x44fb04['message']=_0x5790ae[_0xe41f('0x1c')];_0x44fb04[_0xe41f('0x52')]=_0x5790ae['originated'];_0x44fb04['erlangCalls']=_0x5790ae[_0xe41f('0x53')];_0x44fb04[_0xe41f('0x54')]=_0x5790ae[_0xe41f('0x54')];_0x44fb04[_0xe41f('0x55')]=_0x5790ae[_0xe41f('0x55')];_0x44fb04[_0xe41f('0x56')]=_0x5790ae[_0xe41f('0x56')];_0x44fb04['startPredictive']=_0x5790ae[_0xe41f('0x57')];_0x44fb04[_0xe41f('0x58')]=_0x5790ae['startProgressive'];}if(_0x5790ae[_0xe41f('0x59')]){_0x44fb04['Trunk']={'id':_0x5790ae[_0xe41f('0x59')]['id'],'name':_0x5790ae[_0xe41f('0x59')][_0xe41f('0x5a')],'active':_0x5790ae['Trunk'][_0xe41f('0x5b')],'callerid':_0x5790ae['Trunk'][_0xe41f('0x5c')]};}if(_0x5790ae[_0xe41f('0x5d')]){_0x44fb04[_0xe41f('0x5d')]={'id':_0x5790ae[_0xe41f('0x5d')]['id'],'name':_0x5790ae[_0xe41f('0x5d')][_0xe41f('0x5a')]};}_0x1ac25a[_0xe41f('0x5e')](_0x44fb04);}}_0x5cd624({'count':_0x1ac25a[_0xe41f('0x5f')],'rows':_0x1ac25a});});},'UpdateVoiceQueue':function(_0x4f7350){return new Promise(function(_0x27b961,_0x486711){var _0x1688cb=_['find'](_0x456a8a[_0xe41f('0x21')],{'id':parseInt(_0x4f7350['id'])});var _0x20e944=_[_0xe41f('0x60')](_0x4f7350,['id']);if(_0x1688cb){for(var _0x35b7f5 in _0x20e944){if(typeof _0x20e944[_0x35b7f5]!=='undefined'&&typeof _0x1688cb[_0x35b7f5]!==_0xe41f('0x61')){_0x1688cb[_0x35b7f5]=_0x20e944[_0x35b7f5];}}_0x27b961(_0x1688cb);}else{_0x486711();}});},'VoiceChannels':function(_0x49bcac){return new Promise(function(_0x1a2388,_0x346587){var _0x6154a=_[_0xe41f('0x62')](_0x456a8a['channels']);_0x1a2388({'count':_0x6154a[_0xe41f('0x5f')],'rows':_0x6154a});});},'VoiceChannelMixMonitor':function(_0x49f716){var _0x539027=this;return new Promise(function(_0x4d9510,_0x160824){if(ami[_0xe41f('0x1d')]()==![]){return _0x160824(_0x539027['error'](0x1f4,[config[_0xe41f('0x12')]['ip'],config[_0xe41f('0x12')][_0xe41f('0x13')],_0xe41f('0x14')][_0xe41f('0x15')]('\x20')));}var _0xf05cc=schema(properties[_0xe41f('0x63')])[_0xe41f('0x3')](_0x49f716);if(_0xf05cc[_0xe41f('0x5f')]>0x0){return _0x160824(_0x539027[_0xe41f('0x11')](0x1f4,_['map'](_0xf05cc,_0xe41f('0x1c'))[_0xe41f('0x15')](',\x20')));}var _0x3cf68c=_['find'](_0x456a8a[_0xe41f('0x64')],{'uniqueid':_0x49f716[_0xe41f('0x65')]});if(_0x3cf68c&&_0x3cf68c[_0xe41f('0x66')]){var _0x4676c1=util[_0xe41f('0x67')]('%s.%s',_0x49f716[_0xe41f('0x68')]||_0x49f716[_0xe41f('0x65')],_0x49f716['format']||'wav');return ami['Action']({'action':_0xe41f('0x69'),'channel':_0x3cf68c[_0xe41f('0x66')],'file':_0x4676c1,'options':_0xe41f('0x6a')})[_0xe41f('0x1a')](function(_0x398815){var _0x3b8b09=_[_0xe41f('0x6b')](_0x3cf68c[_0xe41f('0x6c')],{'filename':'/var/spool/asterisk/monitor/'+_0x4676c1[_0xe41f('0x6d')]()});if(_[_0xe41f('0x6e')](_0x3b8b09)){_0x3cf68c['monitors'][_0xe41f('0x5e')]({'filename':_0xe41f('0x6f')+_0x4676c1['toLowerCase'](),'createdAt':moment()[_0xe41f('0x67')](_0xe41f('0x70')),'mixmonitorid':_0x398815['mixmonitorid'],'status':_0xe41f('0x71')});}else{_0x3b8b09[_0xe41f('0x72')]=_0x398815[_0xe41f('0x72')];_0x3b8b09[_0xe41f('0x73')]=_0xe41f('0x71');}_0x4d9510({'code':0xc8,'message':[_0x49f716[_0xe41f('0x65')],'MixMonitor\x20Success',_0x398815[_0xe41f('0x72')]][_0xe41f('0x15')]('\x20'),'mixmonitorid':_0x398815['mixmonitorid']});})[_0xe41f('0x1b')](function(_0x101e16){_0x160824(_0x539027[_0xe41f('0x11')](0x1f5,[_0x49f716['uniqueid'],_0x101e16[_0xe41f('0x1c')][_0xe41f('0x6d')]()][_0xe41f('0x15')]('\x20')));});}else{return _0x160824(_0x539027[_0xe41f('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x40555f){var _0xa2eae9=this;return new Promise(function(_0x51c5ae,_0x53781a){if(ami[_0xe41f('0x1d')]()==![]){return _0x53781a(_0xa2eae9[_0xe41f('0x11')](0x1f4,[config['asterisk']['ip'],config[_0xe41f('0x12')][_0xe41f('0x13')],_0xe41f('0x14')]['join']('\x20')));}var _0x293583=schema(properties['voicechannel'])[_0xe41f('0x3')](_0x40555f);if(_0x293583[_0xe41f('0x5f')]>0x0){return _0x53781a(_0xa2eae9[_0xe41f('0x11')](0x1f4,_[_0xe41f('0x74')](_0x293583,_0xe41f('0x1c'))[_0xe41f('0x15')](',\x20')));}var _0x70217b=_['find'](_0x456a8a[_0xe41f('0x64')],{'uniqueid':_0x40555f[_0xe41f('0x65')]});if(_0x70217b){return BPromise[_0xe41f('0x75')]()['then'](function(){if(_0x70217b['channel']){return ami['Action']({'action':_0xe41f('0x76'),'channel':_0x70217b['channel'],'mixmonitorid':_0x40555f[_0xe41f('0x72')]})['catch'](function(_0x5c729d){});}})['then'](function(){if(_0x70217b[_0xe41f('0x77')]){return ami[_0xe41f('0x20')]({'action':_0xe41f('0x76'),'channel':_0x70217b[_0xe41f('0x77')],'mixmonitorid':_0x40555f[_0xe41f('0x72')]})['catch'](function(_0x3d5786){});}})[_0xe41f('0x1a')](function(_0x5abf91){var _0x4fff2f=_[_0xe41f('0x6b')](_0x70217b['monitors'],{'mixmonitorid':_0x40555f[_0xe41f('0x72')]});if(_0x4fff2f){_0x4fff2f[_0xe41f('0x73')]=_0xe41f('0x78');}})['then'](function(){var _0x524bc3=util['format']('%s.%s',_0x40555f['filename']||_0x40555f['uniqueid'],_0x40555f[_0xe41f('0x67')]||_0xe41f('0x79'));var _0x37471b=_[_0xe41f('0x6b')](_0x70217b[_0xe41f('0x6c')],{'filename':_0xe41f('0x6f')+_0x524bc3[_0xe41f('0x6d')]()});if(_0x37471b){_0x37471b[_0xe41f('0x73')]=_0xe41f('0x78');}})['then'](function(){_0x51c5ae({'code':0xc8,'message':[_0x40555f['uniqueid'],_0xe41f('0x7a')][_0xe41f('0x15')]('\x20')});})[_0xe41f('0x1b')](function(_0x5816a6){_0x53781a(_0xa2eae9[_0xe41f('0x11')](0x1f5,[_0x40555f[_0xe41f('0x65')],_0x5816a6[_0xe41f('0x1c')][_0xe41f('0x6d')]()][_0xe41f('0x15')]('\x20')));});}else{return _0x53781a(_0xa2eae9[_0xe41f('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x393f83){return new Promise(function(_0x50e3bc,_0x16ab90){var _0x4dd9be=_[_0xe41f('0x62')](_0x456a8a[_0xe41f('0x7b')]);_0x50e3bc({'count':_0x4dd9be[_0xe41f('0x5f')],'rows':_0x4dd9be});});},'VoiceQueuesChannel':function(_0x7851aa){var _0x5c0e67=this;return new Promise(function(_0x4ca6dd,_0x2e9ff9){var _0x430dac=schema(properties[_0xe41f('0x7c')])[_0xe41f('0x3')](_0x7851aa);if(_0x430dac[_0xe41f('0x5f')]>0x0){return _0x2e9ff9(_0x5c0e67[_0xe41f('0x11')](0x1f4,_['map'](_0x430dac,'message')['join'](',\x20')));}var _0x47981b=_[_0xe41f('0x6b')](_0x456a8a[_0xe41f('0x7b')],{'uniqueid':_0x7851aa[_0xe41f('0x65')]});if(_0x47981b){_0x4ca6dd(_0x47981b);}else{return _0x2e9ff9(_0x5c0e67[_0xe41f('0x11')](0x1f5,_0xe41f('0x7d')));}});},'VoiceQueuesChannelHangup':function(_0x3c40b1){var _0x2aa5a=this;return new Promise(function(_0x4e5abc,_0x608e5c){if(ami[_0xe41f('0x1d')]()==![]){return _0x608e5c(_0x2aa5a[_0xe41f('0x11')](0x1f4,[config[_0xe41f('0x12')]['ip'],config[_0xe41f('0x12')][_0xe41f('0x13')],_0xe41f('0x14')][_0xe41f('0x15')]('\x20')));}var _0x5ce1da=schema(properties[_0xe41f('0x7e')])[_0xe41f('0x3')](_0x3c40b1);if(_0x5ce1da[_0xe41f('0x5f')]>0x0){return _0x608e5c(_0x2aa5a[_0xe41f('0x11')](0x1f4,_[_0xe41f('0x74')](_0x5ce1da,'message')[_0xe41f('0x15')](',\x20')));}var _0x1acaa1=_[_0xe41f('0x6b')](_0x456a8a['queueChannels'],{'uniqueid':_0x3c40b1[_0xe41f('0x65')]});if(_0x1acaa1&&_0x1acaa1[_0xe41f('0x66')]){return ami[_0xe41f('0x20')]({'action':_0xe41f('0x7f'),'channel':_0x1acaa1[_0xe41f('0x66')]})['then'](function(_0x52865a){_0x4e5abc({'code':0xc8,'message':[_0x3c40b1[_0xe41f('0x65')],_0x52865a[_0xe41f('0x1c')][_0xe41f('0x6d')]()][_0xe41f('0x15')]('\x20')});})['catch'](function(_0x2b5996){_0x608e5c(_0x2aa5a[_0xe41f('0x11')](0x1f5,[_0x3c40b1['uniqueid'],_0x2b5996[_0xe41f('0x1c')][_0xe41f('0x6d')]()][_0xe41f('0x15')]('\x20')));});}else{return _0x608e5c(_0x2aa5a[_0xe41f('0x11')](0x1f5,_0xe41f('0x7d')));}});},'VoiceQueuesChannelRedirect':function(_0x1a82a7){var _0x5a8342=this;return new Promise(function(_0x2c890d,_0x193687){if(ami[_0xe41f('0x1d')]()==![]){return _0x193687(_0x5a8342[_0xe41f('0x11')](0x1f4,[config[_0xe41f('0x12')]['ip'],config[_0xe41f('0x12')][_0xe41f('0x13')],'ami\x20disconnected'][_0xe41f('0x15')]('\x20')));}var _0x51cc69=schema(properties[_0xe41f('0x80')])[_0xe41f('0x3')](_0x1a82a7);if(_0x51cc69[_0xe41f('0x5f')]>0x0){return _0x193687(_0x5a8342[_0xe41f('0x11')](0x1f4,_['map'](_0x51cc69,_0xe41f('0x1c'))['join'](',\x20')));}var _0x155701=_[_0xe41f('0x6b')](_0x456a8a['queueChannels'],{'uniqueid':_0x1a82a7[_0xe41f('0x65')]});if(_0x155701&&_0x155701[_0xe41f('0x66')]){return ami['Action']({'action':'Redirect','channel':_0x155701[_0xe41f('0x66')],'exten':_0x1a82a7[_0xe41f('0x81')],'context':_0x1a82a7[_0xe41f('0x82')]||_0x155701[_0xe41f('0x82')],'priority':0x1})[_0xe41f('0x1a')](function(_0x43fc33){_0x2c890d({'code':0xc8,'message':[_0x1a82a7[_0xe41f('0x65')],_0x43fc33[_0xe41f('0x1c')][_0xe41f('0x6d')]()][_0xe41f('0x15')]('\x20')});})['catch'](function(_0x169bfa){_0x193687(_0x5a8342[_0xe41f('0x11')](0x1f5,[_0x1a82a7['uniqueid'],_0x169bfa[_0xe41f('0x1c')][_0xe41f('0x6d')]()][_0xe41f('0x15')]('\x20')));});}else{return _0x193687(_0x5a8342[_0xe41f('0x11')](0x1f5,_0xe41f('0x7d')));}});},'Agents':function(_0xec5599){return new Promise(function(_0xb52da0,_0x429b05){var _0x133298=_[_0xe41f('0x62')](_0x456a8a['agents']);_0xb52da0({'count':_0x133298['length'],'rows':_0x133298});});},'Telephones':function(_0x4cf71d){return new Promise(function(_0x2039b6,_0x45fbb3){var _0x22edc4=_['values'](_0x456a8a[_0xe41f('0x83')]);_0x2039b6({'count':_0x22edc4['length'],'rows':_0x22edc4});});},'Trunks':function(_0x445945){return new Promise(function(_0x574e5d,_0x315c9e){var _0x529033=_[_0xe41f('0x62')](_0x456a8a[_0xe41f('0x84')]);_0x574e5d({'count':_0x529033[_0xe41f('0x5f')],'rows':_0x529033});});},'OutboundChannels':function(_0x325d20){return new Promise(function(_0x4922ac,_0x753c92){var _0xca0f8=_[_0xe41f('0x62')](_0x456a8a[_0xe41f('0x85')]);_0x4922ac({'count':_0xca0f8[_0xe41f('0x5f')],'rows':_0xca0f8});});},'Outbound':function(_0x21a39c){return new Promise(function(_0x2cbc94,_0x4dd740){_0x2cbc94(_0x456a8a[_0xe41f('0x32')]);});},'Campaigns':function(_0xc9c453){return new Promise(function(_0x4c5413,_0x1d58fa){var _0xb26a8e=_['values'](_0x456a8a['campaigns']);_0x4c5413({'count':_0xb26a8e['length'],'rows':_0xb26a8e});});},'VoiceQueuesPreview':function(_0x333855){var _0x1a4cb7=this;return new Promise(function(_0x5c4a01,_0x23bc50){_0x1e8e93[_0xe41f('0x86')](_0x333855['id'])[_0xe41f('0x1a')](function(_0x2eeefd){_0x5c4a01({'code':0xc8,'message':_0x2eeefd[_0xe41f('0x1c')]});})[_0xe41f('0x1b')](function(_0x2379d8){_0x23bc50(_0x1a4cb7[_0xe41f('0x11')](0x1f4,_0x2379d8[_0xe41f('0x1c')]));});});},'EventManager':function(_0xab7784){var _0x42c02e=this;return new Promise(function(_0x1ea9ad,_0x206181){if(!_0xab7784[_0xe41f('0x87')]){return _0x206181(_0x42c02e[_0xe41f('0x11')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0xe41f('0x88')](_0xe41f('0x89')+_0xab7784['event'],_0xab7784[_0xe41f('0x1c')]);_0x1ea9ad({'code':0xc8,'message':_0xab7784});});},'FaxAccounts':function(_0x309a7c){return new Promise(function(_0x12d794,_0x3dd710){var _0x36d205=_[_0xe41f('0x62')](_0x456a8a[_0xe41f('0x8a')]);_0x12d794({'count':_0x36d205[_0xe41f('0x5f')],'rows':_0x36d205});});},'SendFax':function(_0x40b7cd){var _0x45f81f=this;return new Promise(function(_0x52a618,_0x19098b){_0xd3c763[_0xe41f('0x8b')](_0x40b7cd)[_0xe41f('0x1a')](function(_0x3eb417){_0x52a618({'code':0xc8,'message':_0x3eb417['message']});})['catch'](function(_0x4184ce){_0x19098b(_0x45f81f[_0xe41f('0x11')](0x1f4,_0x4184ce[_0xe41f('0x1c')]));});});},'CheckAfterSend':function(_0x58c55d){var _0x3055ef=this;return new Promise(function(_0x41dfd8,_0x2ef408){_0xd3c763['checkAfterSend'](_0x58c55d)['then'](function(_0x1a2194){_0x41dfd8({'code':0xc8,'message':_0x1a2194['message']});})[_0xe41f('0x1b')](function(_0x48ecbc){_0x2ef408(_0x3055ef[_0xe41f('0x11')](0x1f4,_0x48ecbc[_0xe41f('0x1c')]));});});}};var _0x2cd117=jayson['server'](_0x6fda32)[_0xe41f('0x8c')]();_0x2cd117['on'](_0xe41f('0x11'),function(_0x5787b4){return _0x32a410(_0x5787b4);});_0x2cd117[_0xe41f('0x9')](0x232a,_0xe41f('0x8d'),function(){console[_0xe41f('0x8e')](_0xe41f('0x8f'),0x232a);return _0x370385(_0xe41f('0x90')+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 9bc8d40..da365d7 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 _0x4b84=['calleridnum','lastName','phone','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','destcalleridnum','calleridname','Unknown','firstName','destcalleridname','','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','bluebird','../../../../config/environment','../../rpc/cmContact','redis','defaults','[CM][%s][%s]','stringify','emit','data1','data2','isNil','data5','ListId','data3','map','routeId'];(function(_0x2a7b8e,_0x50ffce){var _0x29b5c8=function(_0x131fe0){while(--_0x131fe0){_0x2a7b8e['push'](_0x2a7b8e['shift']());}};_0x29b5c8(++_0x50ffce);}(_0x4b84,0x1cc));var _0x44b8=function(_0x1db251,_0xf0443d){_0x1db251=_0x1db251-0x0;var _0x56685a=_0x4b84[_0x1db251];return _0x56685a;};'use strict';var _=require(_0x44b8('0x0'));var BPromise=require(_0x44b8('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0x44b8('0x2'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0x44b8('0x3'));config[_0x44b8('0x4')]=_[_0x44b8('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x44b8('0x4')]));function emit(_0x54274b,_0x327f59,_0x5947f7,_0x3e87c5,_0x5a2353){logger['info'](_0x44b8('0x6'),_0x54274b,_0x327f59['id'],_0x5947f7,_0x3e87c5,JSON[_0x44b8('0x7')](_0x5a2353));io['to'](_0x5947f7)[_0x44b8('0x8')](_0x3e87c5,_0x5a2353);}exports['exec']=function(_0xc650ec,_0x2cc74b,_0x4315f6,_0x9b6048){var _0x24dd10,_0x37e471;var _0xe9a025={};var _0x4ae8a1=Number(_0x4315f6[_0x44b8('0x9')]);var _0x4301a6=_0x4315f6['data2']?Boolean(Number(_0x4315f6[_0x44b8('0xa')])):![];var _0x490bc6;var _0x833ea3=![];if(!_[_0x44b8('0xb')](_0x4315f6['data5'])){if(_0x4315f6[_0x44b8('0xc')]=='1')_0x833ea3=!![];}if(!_0x833ea3){if(_0x9b6048['xmd-contactid']){_0xe9a025['id']=_0x9b6048['xmd-contactid'];}}if(!_0xe9a025['id']){_0xe9a025[_0x44b8('0xd')]=_0x4ae8a1;_0x490bc6=_0x4315f6[_0x44b8('0xe')]&&_0x4315f6[_0x44b8('0xe')]!=='0'?_0x4315f6[_0x44b8('0xe')]['split'](','):['phone'];_0xe9a025['$or']=_[_0x44b8('0xf')](_0x490bc6,function(_0x5b7803){var _0x28ef36={};_0x28ef36[_0x5b7803]=_0x9b6048[_0x44b8('0x10')]?_0x9b6048['destcalleridnum']:_0x9b6048[_0x44b8('0x11')];return _0x28ef36;});}var _0xe3de8f=['id','firstName',_0x44b8('0x12'),_0x44b8('0x13'),'mobile',_0x44b8('0x14'),_0x44b8('0xd'),_0x44b8('0x15'),_0x44b8('0x16'),_0x44b8('0x17')];var _0x369c09=_[_0x44b8('0x18')](_0xe3de8f,_0x490bc6);BPromise[_0x44b8('0x19')]()[_0x44b8('0x1a')](cmContactRpc[_0x44b8('0x1b')]({'attributes':_0x369c09,'where':_0xe9a025}))[_0x44b8('0x1a')](function(_0x14996c){_0x37e471=_0x14996c;if(!_['isEmpty'](_0x37e471)){if(_0x37e471[_0x44b8('0x1c')]===0x1){_0x24dd10=_0x37e471[0x0];logger[_0x44b8('0x1d')](_0x44b8('0x1e'),_0x9b6048[_0x44b8('0x1f')],_0x2cc74b['id'],_0x24dd10['id']);}else{logger[_0x44b8('0x1d')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x9b6048[_0x44b8('0x1f')],_0x2cc74b['id'],_['map'](_0x37e471,'id')[_0x44b8('0x20')](','));}return;}else{logger[_0x44b8('0x1d')](_0x44b8('0x21'),_0x9b6048[_0x44b8('0x1f')],_0x2cc74b['id']);var _0x230a3d={'ListId':_0x4ae8a1};var _0x59acbc=_0x4315f6[_0x44b8('0x22')]&&_0x4315f6['data4']!=='0'?_0x4315f6[_0x44b8('0x22')]:_0x44b8('0x13');if(_0x4301a6){logger['info'](_0x44b8('0x23'),_0x9b6048[_0x44b8('0x1f')],_0x2cc74b['id']);_0x230a3d[_0x59acbc]=_[_0x44b8('0xb')](_0x9b6048['routeId'])?_0x9b6048[_0x44b8('0x11')]:_0x9b6048[_0x44b8('0x24')];if(_['isNil'](_0x9b6048[_0x44b8('0x10')])){_0x230a3d['firstName']=_0x9b6048[_0x44b8('0x25')]&&_0x9b6048['calleridname']!==''?_0x9b6048['calleridname']:_0x44b8('0x26');}else{_0x230a3d[_0x44b8('0x27')]=_0x9b6048[_0x44b8('0x28')]&&_0x9b6048[_0x44b8('0x28')]!==_0x44b8('0x29')?_0x9b6048[_0x44b8('0x28')]:_0x44b8('0x26');}return BPromise[_0x44b8('0x19')]()[_0x44b8('0x1a')](cmContactRpc[_0x44b8('0x2a')](_0x230a3d))[_0x44b8('0x1a')](function(_0x417d81){_0x24dd10=_0x417d81;_0x37e471[_0x44b8('0x2b')](_0x417d81);if(_0x24dd10){logger['info'](_0x44b8('0x2c'),_0x9b6048['uniqueid'],_0x2cc74b['id'],_0x24dd10['id']);}return;});}else{logger[_0x44b8('0x1d')](_0x44b8('0x2d'),_0x9b6048[_0x44b8('0x1f')],_0x2cc74b['id']);_0x230a3d[_0x59acbc]=_[_0x44b8('0xb')](_0x9b6048[_0x44b8('0x10')])?_0x9b6048['calleridnum']:_0x9b6048[_0x44b8('0x24')];if(_[_0x44b8('0xb')](_0x9b6048[_0x44b8('0x10')])){_0x230a3d[_0x44b8('0x27')]=_0x9b6048[_0x44b8('0x25')]&&_0x9b6048['calleridname']!==_0x44b8('0x29')?_0x9b6048[_0x44b8('0x25')]:_0x44b8('0x26');}else{_0x230a3d[_0x44b8('0x27')]=_0x9b6048[_0x44b8('0x28')]&&_0x9b6048[_0x44b8('0x28')]!==_0x44b8('0x29')?_0x9b6048[_0x44b8('0x28')]:_0x44b8('0x26');}_0x24dd10=_0x230a3d;_0x37e471[_0x44b8('0x2b')](_0x230a3d);return;}}})[_0x44b8('0x1a')](function(){if(_0xc650ec){emit(_0x9b6048[_0x44b8('0x1f')],_0x2cc74b,util[_0x44b8('0x2e')](_0x44b8('0x2f'),_0xc650ec[_0x44b8('0x30')]),util[_0x44b8('0x2e')](_0x44b8('0x31'),_0x4315f6[_0x44b8('0x32')][_0x44b8('0x33')]()),{'evt':_[_0x44b8('0x34')](_0x9b6048,{'autoCreate':_0x4301a6}),'contact':_0x24dd10===undefined?{}:_0x24dd10,'contacts':_0x37e471[_0x44b8('0x1c')]===0x0?undefined:_0x37e471});}});}; \ No newline at end of file +var _0x3e74=['scheduledAt','updatedAt','union','resolve','getContacts','then','isEmpty','length','uniqueid','data4','[CM][%s][%s]\x20Autocreate\x20enabled','routeId','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','merge','lodash','ioredis','util','../../../../config/environment','../../rpc/cmContact','defaults','redis','localhost','socket.io-emitter','info','stringify','data1','data2','isNil','data5','ListId','data3','$or','map','destcalleridnum','calleridnum','firstName','lastName','phone','mobile','fax','createdAt'];(function(_0x43ae5c,_0x301ba3){var _0x1e11aa=function(_0x4b7bcb){while(--_0x4b7bcb){_0x43ae5c['push'](_0x43ae5c['shift']());}};_0x1e11aa(++_0x301ba3);}(_0x3e74,0x175));var _0x43e7=function(_0x1b39f7,_0x2d99d4){_0x1b39f7=_0x1b39f7-0x0;var _0x2cc400=_0x3e74[_0x1b39f7];return _0x2cc400;};'use strict';var _=require(_0x43e7('0x0'));var BPromise=require('bluebird');var Redis=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var config=require(_0x43e7('0x3'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0x43e7('0x4'));config['redis']=_[_0x43e7('0x5')](config[_0x43e7('0x6')],{'host':_0x43e7('0x7'),'port':0x18eb});var io=require(_0x43e7('0x8'))(new Redis(config[_0x43e7('0x6')]));function emit(_0x503698,_0x45a0d1,_0x3491d6,_0x2ede2d,_0x8528fc){logger[_0x43e7('0x9')]('[CM][%s][%s]',_0x503698,_0x45a0d1['id'],_0x3491d6,_0x2ede2d,JSON[_0x43e7('0xa')](_0x8528fc));io['to'](_0x3491d6)['emit'](_0x2ede2d,_0x8528fc);}exports['exec']=function(_0x39c8bd,_0x4139c9,_0x5c34f4,_0x2803d9){var _0x513707,_0xf7c520;var _0x37302c={};var _0x4ebc8e=Number(_0x5c34f4[_0x43e7('0xb')]);var _0xc960ea=_0x5c34f4[_0x43e7('0xc')]?Boolean(Number(_0x5c34f4[_0x43e7('0xc')])):![];var _0x4e008c;var _0x583d85=![];if(!_[_0x43e7('0xd')](_0x5c34f4[_0x43e7('0xe')])){if(_0x5c34f4[_0x43e7('0xe')]=='1')_0x583d85=!![];}if(!_0x583d85){if(_0x2803d9['xmd-contactid']){_0x37302c['id']=_0x2803d9['xmd-contactid'];}}if(!_0x37302c['id']){_0x37302c[_0x43e7('0xf')]=_0x4ebc8e;_0x4e008c=_0x5c34f4[_0x43e7('0x10')]&&_0x5c34f4[_0x43e7('0x10')]!=='0'?_0x5c34f4[_0x43e7('0x10')]['split'](','):['phone'];_0x37302c[_0x43e7('0x11')]=_[_0x43e7('0x12')](_0x4e008c,function(_0x273a32){var _0x5d346f={};_0x5d346f[_0x273a32]=_0x2803d9['routeId']?_0x2803d9[_0x43e7('0x13')]:_0x2803d9[_0x43e7('0x14')];return _0x5d346f;});}var _0x9037d3=['id',_0x43e7('0x15'),_0x43e7('0x16'),_0x43e7('0x17'),_0x43e7('0x18'),_0x43e7('0x19'),_0x43e7('0xf'),_0x43e7('0x1a'),_0x43e7('0x1b'),_0x43e7('0x1c')];var _0x4b5d64=_[_0x43e7('0x1d')](_0x9037d3,_0x4e008c);BPromise[_0x43e7('0x1e')]()['then'](cmContactRpc[_0x43e7('0x1f')]({'attributes':_0x4b5d64,'where':_0x37302c}))[_0x43e7('0x20')](function(_0x3945bb){_0xf7c520=_0x3945bb;if(!_[_0x43e7('0x21')](_0xf7c520)){if(_0xf7c520[_0x43e7('0x22')]===0x1){_0x513707=_0xf7c520[0x0];logger[_0x43e7('0x9')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x2803d9[_0x43e7('0x23')],_0x4139c9['id'],_0x513707['id']);}else{logger['info']('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x2803d9[_0x43e7('0x23')],_0x4139c9['id'],_[_0x43e7('0x12')](_0xf7c520,'id')['join'](','));}return;}else{logger[_0x43e7('0x9')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x2803d9[_0x43e7('0x23')],_0x4139c9['id']);var _0x5c5e67={'ListId':_0x4ebc8e};var _0x1af208=_0x5c34f4[_0x43e7('0x24')]&&_0x5c34f4[_0x43e7('0x24')]!=='0'?_0x5c34f4[_0x43e7('0x24')]:'phone';if(_0xc960ea){logger['info'](_0x43e7('0x25'),_0x2803d9['uniqueid'],_0x4139c9['id']);_0x5c5e67[_0x1af208]=_[_0x43e7('0xd')](_0x2803d9[_0x43e7('0x26')])?_0x2803d9[_0x43e7('0x14')]:_0x2803d9[_0x43e7('0x13')];if(_['isNil'](_0x2803d9[_0x43e7('0x26')])){_0x5c5e67[_0x43e7('0x15')]=_0x2803d9[_0x43e7('0x27')]&&_0x2803d9[_0x43e7('0x27')]!==_0x43e7('0x28')?_0x2803d9[_0x43e7('0x27')]:_0x43e7('0x29');}else{_0x5c5e67[_0x43e7('0x15')]=_0x2803d9[_0x43e7('0x2a')]&&_0x2803d9[_0x43e7('0x2a')]!==_0x43e7('0x28')?_0x2803d9[_0x43e7('0x2a')]:_0x43e7('0x29');}return BPromise[_0x43e7('0x1e')]()['then'](cmContactRpc[_0x43e7('0x2b')](_0x5c5e67))[_0x43e7('0x20')](function(_0x3b8f78){_0x513707=_0x3b8f78;_0xf7c520[_0x43e7('0x2c')](_0x3b8f78);if(_0x513707){logger[_0x43e7('0x9')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x2803d9[_0x43e7('0x23')],_0x4139c9['id'],_0x513707['id']);}return;});}else{logger[_0x43e7('0x9')](_0x43e7('0x2d'),_0x2803d9[_0x43e7('0x23')],_0x4139c9['id']);_0x5c5e67[_0x1af208]=_['isNil'](_0x2803d9['routeId'])?_0x2803d9['calleridnum']:_0x2803d9[_0x43e7('0x13')];if(_[_0x43e7('0xd')](_0x2803d9[_0x43e7('0x26')])){_0x5c5e67[_0x43e7('0x15')]=_0x2803d9[_0x43e7('0x27')]&&_0x2803d9[_0x43e7('0x27')]!==''?_0x2803d9['calleridname']:'Unknown';}else{_0x5c5e67['firstName']=_0x2803d9['destcalleridname']&&_0x2803d9['destcalleridname']!==''?_0x2803d9[_0x43e7('0x2a')]:'Unknown';}_0x513707=_0x5c5e67;_0xf7c520[_0x43e7('0x2c')](_0x5c5e67);return;}}})[_0x43e7('0x20')](function(){if(_0x39c8bd){emit(_0x2803d9[_0x43e7('0x23')],_0x4139c9,util[_0x43e7('0x2e')](_0x43e7('0x2f'),_0x39c8bd[_0x43e7('0x30')]),util[_0x43e7('0x2e')]('trigger:%s',_0x5c34f4['action']['toLowerCase']()),{'evt':_[_0x43e7('0x31')](_0x2803d9,{'autoCreate':_0xc960ea}),'contact':_0x513707===undefined?{}:_0x513707,'contacts':_0xf7c520[_0x43e7('0x22')]===0x0?undefined:_0xf7c520});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 77e5790..b19cb56 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 _0x5942=['winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','custom:agentconnect','bind','custom:agentringnoanswer','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialend','custom:substatus','custom:rejectmessage','custom:offlineMessage','prototype','emit','info','stringify','clone','motionChannel','undefined','voice','checkTriggers','hasOwnProperty','status','checkTrigger','variables','length','Actions','motionbar','browser','data1','data2','render','html','data3','isNil','data4','location','uriLocation','windowWidth','data5','800','600','data6','winApplication','winArguments','format','user:%s','interface','name','trigger:%s:%s','action','toLowerCase','merge','trigger:%s','contactmanager','queue','routeId','exec','buildUri','parse','query','AllConditions','every','channel','AnyConditions','some','checkConditions','field','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','agent','membername','lastevent','mailSubstatus','null','substatus','created','equals','exports','util','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','defaults','redis','localhost','popup'];(function(_0x186ae6,_0x54d672){var _0x36cc03=function(_0x3fd481){while(--_0x3fd481){_0x186ae6['push'](_0x186ae6['shift']());}};_0x36cc03(++_0x54d672);}(_0x5942,0x16a));var _0x2594=function(_0x2fe582,_0x493b8e){_0x2fe582=_0x2fe582-0x0;var _0x46f324=_0x5942[_0x2fe582];return _0x46f324;};'use strict';var util=require(_0x2594('0x0'));var _=require(_0x2594('0x1'));var url=require(_0x2594('0x2'));var Mustache=require(_0x2594('0x3'));var Redis=require(_0x2594('0x4'));var urlforward=require(_0x2594('0x5'));var integration=require(_0x2594('0x6'));var cmContact=require(_0x2594('0x7'));var script=require(_0x2594('0x8'));var config=require(_0x2594('0x9'));var logger=require(_0x2594('0xa'))(_0x2594('0xb'));var ami=require('../ami');config['redis']=_[_0x2594('0xc')](config[_0x2594('0xd')],{'host':_0x2594('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2594('0xd')]));var operators={'equals':function(_0x9d830c,_0x53a4dc){return _0x9d830c==_0x53a4dc;},'not_equals':function(_0x29517f,_0x516088){return _0x29517f!=_0x516088;}};var barAndWebActions=[_0x2594('0xf'),_0x2594('0x2'),_0x2594('0x10')];function Trigger(_0x4a7dd2){this[_0x2594('0x11')]=_0x4a7dd2[_0x2594('0x11')];this[_0x2594('0x12')]=_0x4a7dd2[_0x2594('0x12')];this['voiceQueues']=_0x4a7dd2[_0x2594('0x13')];this[_0x2594('0x14')]=_0x4a7dd2[_0x2594('0x14')];this[_0x2594('0x15')]=_0x4a7dd2[_0x2594('0x15')];this[_0x2594('0x16')]=_0x4a7dd2[_0x2594('0x16')];this[_0x2594('0x17')]=_0x4a7dd2[_0x2594('0x17')];this['salesforceAccounts']=_0x4a7dd2[_0x2594('0x18')];this[_0x2594('0x19')]=_0x4a7dd2['sugarcrmAccounts'];this[_0x2594('0x1a')]=_0x4a7dd2['zohoAccounts'];this[_0x2594('0x1b')]=_0x4a7dd2[_0x2594('0x1b')];this[_0x2594('0x1c')]=_0x4a7dd2[_0x2594('0x1c')];this[_0x2594('0x1d')]=_0x4a7dd2['servicenowAccounts'];this[_0x2594('0x1e')]=_0x4a7dd2[_0x2594('0x1e')];this[_0x2594('0x1f')]=_0x4a7dd2[_0x2594('0x1f')];this[_0x2594('0x20')]={'zendesk':this[_0x2594('0x16')],'salesforce':this[_0x2594('0x18')],'freshdesk':this[_0x2594('0x17')],'sugarcrm':this[_0x2594('0x19')],'zoho':this['zohoAccounts'],'desk':this['deskAccounts'],'vtiger':this[_0x2594('0x1c')],'dynamics365':this[_0x2594('0x1e')],'freshsales':this[_0x2594('0x1f')],'servicenow':this[_0x2594('0x1d')]};ami['on'](_0x2594('0x21'),this[_0x2594('0x22')]['bind'](this));ami['on'](_0x2594('0x23'),this[_0x2594('0x22')][_0x2594('0x24')](this));ami['on'](_0x2594('0x25'),this['syncCustomEvent'][_0x2594('0x24')](this));ami['on']('custom:agentcomplete',this[_0x2594('0x22')]['bind'](this));ami['on'](_0x2594('0x26'),this[_0x2594('0x22')]['bind'](this));ami['on'](_0x2594('0x27'),this['syncCustomEvent'][_0x2594('0x24')](this));ami['on'](_0x2594('0x28'),this[_0x2594('0x22')][_0x2594('0x24')](this));ami['on'](_0x2594('0x29'),this[_0x2594('0x22')][_0x2594('0x24')](this));ami['on'](_0x2594('0x2a'),this['syncCustomEvent'][_0x2594('0x24')](this));ami['on']('custom:amd',this['syncCustomEvent'][_0x2594('0x24')](this));ami['on'](_0x2594('0x2b'),this['syncCustomEvent'][_0x2594('0x24')](this));ami['on'](_0x2594('0x2c'),this['syncCustomEvent'][_0x2594('0x24')](this));ami['on'](_0x2594('0x2d'),this[_0x2594('0x2e')][_0x2594('0x24')](this));ami['on']('custom:dialconnect',this[_0x2594('0x2e')][_0x2594('0x24')](this));ami['on'](_0x2594('0x2f'),this[_0x2594('0x2e')][_0x2594('0x24')](this));ami['on']('custom:newinteraction',this[_0x2594('0x22')][_0x2594('0x24')](this));ami['on']('custom:closedinteraction',this['syncCustomEvent'][_0x2594('0x24')](this));ami['on'](_0x2594('0x30'),this[_0x2594('0x22')][_0x2594('0x24')](this));ami['on']('custom:incomingmessage',this[_0x2594('0x22')][_0x2594('0x24')](this));ami['on']('custom:outgoingmessage',this['syncCustomEvent']['bind'](this));ami['on']('custom:acceptmessage',this['syncCustomEvent'][_0x2594('0x24')](this));ami['on'](_0x2594('0x31'),this[_0x2594('0x22')][_0x2594('0x24')](this));ami['on'](_0x2594('0x32'),this[_0x2594('0x22')][_0x2594('0x24')](this));}Trigger[_0x2594('0x33')][_0x2594('0x34')]=function(_0x984546,_0x2f9fc9,_0x4271fd){logger[_0x2594('0x35')](_0x984546,_0x2f9fc9,JSON[_0x2594('0x36')](_0x4271fd));io['to'](_0x984546)[_0x2594('0x34')](_0x2f9fc9,_0x4271fd);};Trigger['prototype']['syncCustomEvent']=function(_0x12bcde){var _0x1deaba=_[_0x2594('0x37')](_0x12bcde);if(typeof _0x1deaba[_0x2594('0x38')]===_0x2594('0x39')){_0x1deaba[_0x2594('0x38')]=_0x2594('0x3a');}this[_0x2594('0x3b')](_0x1deaba);};Trigger[_0x2594('0x33')]['syncAgentDial']=function(_0x54bf62){if(this[_0x2594('0x12')][_0x54bf62['interface']]){this[_0x2594('0x22')](_0x54bf62);}};Trigger[_0x2594('0x33')][_0x2594('0x3b')]=function(_0x186d47){var _0x547621;for(var _0x5b2de3 in this['triggers']){if(this[_0x2594('0x11')][_0x2594('0x3c')](_0x5b2de3)){if(this[_0x2594('0x11')][_0x5b2de3][_0x2594('0x3d')]){_0x547621=this[_0x2594('0x3e')](this[_0x2594('0x11')][_0x5b2de3],_0x186d47);if(_0x547621){_['merge'](_0x186d47,_0x186d47[_0x2594('0x3f')]);for(var _0x2ab69b=0x0,_0x9447da,_0x12a8f1,_0x257bee;_0x2ab69b0x0){_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 _0x9957=['Motion','CTI','concat','Tags','/api/v2/users/%d','Descriptions','%s/customers/%d/cases','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','Desk\x20account\x20type\x20not\x20recognized','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','integrationTab','newTab','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','The\x20Ticket\x20ID\x20is:','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','desk','defaults','redis','localhost','socket.io-emitter','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','remoteUri','then','total_entries','find','_embedded','entries','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','[HTTP]','stringify','GET','password','authType','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','includes','string','picklist','type','nameField','customField','content','idField','custom_fields','variable','variableName','customVariable','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x2b2858,_0x3f0832){var _0x12a1d8=function(_0x5103a0){while(--_0x5103a0){_0x2b2858['push'](_0x2b2858['shift']());}};_0x12a1d8(++_0x3f0832);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var rp=require(_0x7995('0x1'));var md5=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));config['redis']=_[_0x7995('0x8')](config[_0x7995('0x9')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x9')]));function emit(_0x326741,_0x4996ca,_0x465276){io['to'](_0x326741)[_0x7995('0xc')](_0x4996ca,_0x465276);}var headers={'Content-Type':'application/json','Accept':_0x7995('0xd')};function getUser(_0x3116fb,_0x18c8a3){if(intUtil[_0x7995('0xe')](_0x18c8a3)===!![]){logger[_0x7995('0xf')](_0x7995('0x10'),_0x18c8a3);return request({'uri':util[_0x7995('0x11')]('%s/users',_0x3116fb[_0x7995('0x12')])})[_0x7995('0x13')](function(_0x581f22){if(_0x581f22[_0x7995('0x14')]){return _[_0x7995('0x15')](_0x581f22[_0x7995('0x16')][_0x7995('0x17')],{'email':_0x18c8a3});}})[_0x7995('0x13')](function(_0x23999f){if(_0x23999f){logger[_0x7995('0xf')]('Agent\x20found!');return _0x23999f;}else{logger['info'](_0x7995('0x18'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb[_0x7995('0x12')])});}});}else{logger[_0x7995('0xf')](_0x7995('0x1a'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb['remoteUri'])});}}function request(_0x2eeacc){logger['debug'](_0x7995('0x1b'),JSON[_0x7995('0x1c')](_0x2eeacc));return rp(_[_0x7995('0x8')](_0x2eeacc,{'method':_0x7995('0x1d'),'headers':headers,'json':!![]}));}function getAuth(_0x1e1415){var _0x37a7d4;if(_0x1e1415['authType']==='basic'){_0x37a7d4=util[_0x7995('0x11')]('%s:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x1e')]);}else if(_0x1e1415[_0x7995('0x1f')]==='token'){_0x37a7d4=util[_0x7995('0x11')]('%s/token:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x20')]);}return util[_0x7995('0x11')](_0x7995('0x21'),new Buffer(_0x37a7d4)[_0x7995('0x22')](_0x7995('0x23')));}function getEndUser(_0x1c278a,_0x5d40ae,_0x32a09a){logger[_0x7995('0xf')](_0x7995('0x24'),_0x32a09a);return request({'uri':util[_0x7995('0x11')](_0x7995('0x25'),_0x1c278a[_0x7995('0x12')]),'qs':{'phone':_0x32a09a}})[_0x7995('0x13')](function(_0x472195){if(_0x472195['total_entries']){logger[_0x7995('0xf')](_0x7995('0x26'));return _0x472195[_0x7995('0x16')][_0x7995('0x17')][0x0];}else{logger[_0x7995('0xf')](_0x7995('0x27'));return request({'uri':util['format'](_0x7995('0x28'),_0x1c278a['remoteUri']),'method':_0x7995('0x29'),'body':{'first_name':_0x5d40ae,'title':_0x5d40ae,'phone_numbers':[{'type':_0x7995('0x2a'),'value':_0x32a09a}]}});}});}function getTags(_0xf16cc2,_0x132a42){var _0x11c1eb=[];if(_0xf16cc2&&_0xf16cc2['length']>0x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index f8a4f7b..24e668b 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 _0x93ba=['catch','error','toUpperCase',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','validateEmail','email','userEmail','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','userId','systemuserid','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','message','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','headers','odata-entityid','lastIndexOf','enduserId','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','%2b','length','telephone1','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','includes','picklist','type','nameField','idField','indexOf','substring','content','ticketType','incidents','getString','Subjects','/contacts(','/systemusers(','Fields','Bearer\x20','phonecall','callDirection','queue','phonecalls','assign','Descriptions','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','resolve','POST','username','password','then','access_token'];(function(_0x542252,_0x53131e){var _0x49408f=function(_0xd3de2e){while(--_0xd3de2e){_0x542252['push'](_0x542252['shift']());}};_0x49408f(++_0x53131e);}(_0x93ba,0xb8));var _0xa93b=function(_0x4e95ef,_0xaa0c75){_0x4e95ef=_0x4e95ef-0x0;var _0x505bda=_0x93ba[_0x4e95ef];return _0x505bda;};'use strict';var _=require(_0xa93b('0x0'));var rp=require(_0xa93b('0x1'));var util=require(_0xa93b('0x2'));var intUtil=require(_0xa93b('0x3'));var md5=require(_0xa93b('0x4'));var Redis=require(_0xa93b('0x5'));var logger=require(_0xa93b('0x6'))('dynamics365');var config=require(_0xa93b('0x7'));config[_0xa93b('0x8')]=_[_0xa93b('0x9')](config['redis'],{'host':_0xa93b('0xa'),'port':0x18eb});var io=require(_0xa93b('0xb'))(new Redis(config[_0xa93b('0x8')]));function getAuthToken(_0x1376a0,_0x475e0e,_0x3a28c2){if(_0x1376a0[_0xa93b('0xc')]){_0x1376a0[_0xa93b('0xd')]=_0x1376a0[_0xa93b('0xe')][_0xa93b('0xf')];_0x1376a0['tenantId']=_0x1376a0[_0xa93b('0xe')]['data2'];return Promise[_0xa93b('0x10')](_0x1376a0[_0xa93b('0xe')]['data5']);}var _0x1a24b9={'method':_0xa93b('0x11'),'uri':_0x475e0e,'form':{'client_id':_0x1376a0['clientId'],'resource':_0x1376a0[_0xa93b('0xd')],'username':_0x1376a0[_0xa93b('0x12')],'password':_0x1376a0['password'],'grant_type':_0xa93b('0x13'),'client_secret':_0x1376a0['clientSecret']},'json':!![]};return rp(_0x1a24b9)[_0xa93b('0x14')](function(_0x31c950){return _0x31c950[_0xa93b('0x15')];})[_0xa93b('0x16')](function(_0xf691ba){logger[_0xa93b('0x17')]('['+[_0x3a28c2[_0xa93b('0x18')]()]+_0xa93b('0x19'));return _0xf691ba['message'];});}function getUser(_0x370977,_0xebddcd,_0x153e12,_0xccf7e5,_0x4d2711,_0x4e903f){return new Promise(function(_0x4413e3,_0x20e657){return getAuthToken(_0xebddcd,_0xccf7e5,_0x4e903f)[_0xa93b('0x14')](function(_0x3f880f){var _0x204ae0={'method':_0xa93b('0x1a'),'uri':_0x4d2711+_0xa93b('0x1b'),'headers':{'Authorization':'Bearer\x20'+_0x3f880f,'OData-Version':_0xa93b('0x1c')},'json':!![]};return rp(_0x204ae0);})[_0xa93b('0x14')](function(_0x57649d){var _0x5da3c7=_0x57649d[_0xa93b('0x1d')];var _0x494d9a=![];var _0x1416cd=null;if(!_[_0xa93b('0x1e')](_0x153e12)){if(intUtil[_0xa93b('0x1f')](_0x153e12[_0xa93b('0x20')])){_0x370977[_0xa93b('0x21')]=_0x153e12[_0xa93b('0x20')];for(_0x1416cd=0x0;_0x1416cd<_0x5da3c7['length'];_0x1416cd++){if(_0x5da3c7[_0x1416cd][_0xa93b('0x22')]===_0x153e12[_0xa93b('0x20')]&&!_0x5da3c7[_0x1416cd][_0xa93b('0x23')]){_0x494d9a=!![];logger['info']('['+[_0x4e903f['toUpperCase']()]+_0xa93b('0x24')+_0x5da3c7[_0x1416cd]['systemuserid']+'!');_0x370977[_0xa93b('0x25')]=_0x5da3c7[_0x1416cd][_0xa93b('0x26')];}}}}if(!_0x494d9a){logger[_0xa93b('0x27')]('['+[_0x4e903f[_0xa93b('0x18')]()]+_0xa93b('0x28'));_0x370977['userEmail']=_0xebddcd[_0xa93b('0x12')];for(_0x1416cd=0x0;_0x1416cd<_0x5da3c7['length'];_0x1416cd++){if(_0x5da3c7[_0x1416cd][_0xa93b('0x22')]===_0xebddcd[_0xa93b('0x12')]){_0x370977[_0xa93b('0x25')]=_0x5da3c7[_0x1416cd][_0xa93b('0x26')];}}}_0x4413e3(_0x370977);})[_0xa93b('0x16')](function(_0x2a6ca7){_0x20e657(_0x2a6ca7[_0xa93b('0x29')]);});});}function createEndUser(_0x2015ca,_0xefa693,_0x3444ac,_0x186ab8,_0x522219,_0x279456){return new Promise(function(_0x151e4d,_0x34c825){return getAuthToken(_0xefa693,_0x3444ac,_0x279456)['then'](function(_0x4b402a){var _0xed3f2f=_0x279456[_0xa93b('0x2a')]()===_0xa93b('0x2b')?_0x522219[_0xa93b('0x2c')]:_0x522219[_0xa93b('0x2d')];var _0x2435e8={'method':_0xa93b('0x11'),'uri':_0x186ab8+_0xa93b('0x2e'),'body':{'telephone1':_0xed3f2f,'fullname':_0xed3f2f,'firstname':_0xed3f2f,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x2015ca[_0xa93b('0x25')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x4b402a,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x2435e8);})[_0xa93b('0x14')](function(_0x458f3b){var _0x27ac20=_0x458f3b[_0xa93b('0x2f')][_0xa93b('0x30')];var _0x133e8d=_0x27ac20['substring'](_0x27ac20['lastIndexOf']('(')+0x1,_0x27ac20[_0xa93b('0x31')](')'));_0x2015ca[_0xa93b('0x32')]=_0x133e8d;_0x151e4d(_0x2015ca);})['catch'](function(_0xc7febf){_0x34c825(_0xc7febf[_0xa93b('0x29')]);});});}function getEndUser(_0x2a2632,_0x9e0043,_0x35868b,_0x366b91,_0x2a619c,_0x147209,_0x3ca139){var _0x3456ea=_0x147209['toLowerCase']()==='outbound'?_0x2a619c[_0xa93b('0x2c')]:_0x2a619c[_0xa93b('0x2d')];return getAuthToken(_0x9e0043,_0x35868b,_0x147209)[_0xa93b('0x14')](function(_0x4550f9){var _0x235a08={'method':_0xa93b('0x1a'),'uri':_0x366b91+_0xa93b('0x33')+_0x3456ea['replace']('+',_0xa93b('0x34'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x4550f9,'If-None-Match':null,'OData-Version':_0xa93b('0x1c')},'json':!![]};return rp(_0x235a08);})[_0xa93b('0x14')](function(_0x32a18b){var _0x2dfc69=![];if(!_0x32a18b)return _0x2dfc69;var _0x47551a=_0x32a18b[_0xa93b('0x1d')];for(var _0xd9f1b8=0x0;_0xd9f1b8<_0x47551a[_0xa93b('0x35')];_0xd9f1b8++){if(_0x47551a[_0xd9f1b8][_0xa93b('0x36')]===_0x3456ea){_0x2dfc69=!![];_0x2a2632[_0xa93b('0x32')]=_0x47551a[_0xd9f1b8][_0xa93b('0x37')];}}return _0x2dfc69;})[_0xa93b('0x14')](function(_0x8d2709){if(_0x8d2709)return _0x2a2632;if(_0x3ca139===_0xa93b('0x38')){logger['info']('['+[_0x147209[_0xa93b('0x18')]()]+_0xa93b('0x39'));return _0x2a2632;}return createEndUser(_0x2a2632,_0x9e0043,_0x35868b,_0x366b91,_0x2a619c,_0x147209)[_0xa93b('0x14')](function(_0x2885ec){logger[_0xa93b('0x27')]('['+[_0x147209['toUpperCase']()]+']\x20Enduser\x20created!',_0x2885ec[_0xa93b('0x32')]);return _0x2885ec;});});}function getCustomFields(_0x24f70c,_0x437318,_0x573bb3){var _0x4eb384={};if(_0x24f70c[_0xa93b('0x35')]>0x0){_[_0xa93b('0x3a')](_0x24f70c,function(_0x3bf813){if(_[_0xa93b('0x3b')](['string',_0xa93b('0x3c')],_0x3bf813[_0xa93b('0x3d')])&&_0x3bf813[_0xa93b('0x3e')]&&!_0x3bf813['customField']){var _0x278bb8=_0x3bf813[_0xa93b('0x3f')]['toLowerCase']();var _0x13942f=_0x278bb8['substring'](0x0,_0x278bb8[_0xa93b('0x40')]('_'));var _0x2e8d07=_0x278bb8[_0xa93b('0x41')](_0x278bb8[_0xa93b('0x40')]('_')+0x1);if(_0x13942f===_0x573bb3){_0x4eb384[_0x2e8d07]=_0x3bf813[_0xa93b('0x42')];}}});}return _0x4eb384;}function getTicket(_0x1a12f1,_0x2a4c26,_0x32656d,_0x3645ad,_0x1a950a,_0x332f36,_0x147a69){return new Promise(function(_0x15ac19,_0x33073a){var _0x28aefd;return getAuthToken(_0x2a4c26,_0x32656d,_0x147a69)['then'](function(_0x5b3422){if(_0x332f36[_0xa93b('0x43')]==='incident'){_0x28aefd={'method':_0xa93b('0x11'),'uri':_0x3645ad+_0xa93b('0x44'),'body':Object['assign']({},{'title':intUtil[_0xa93b('0x45')](_0x332f36[_0xa93b('0x46')],_0x1a950a,'\x20'),'description':intUtil[_0xa93b('0x45')](_0x332f36['Descriptions'],_0x1a950a,'\x0a'),'customerid_contact@odata.bind':_0x1a12f1[_0xa93b('0x32')]?_0xa93b('0x47')+_0x1a12f1['enduserId']+')':undefined,'ownerid@odata.bind':_0xa93b('0x48')+_0x1a12f1[_0xa93b('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x332f36[_0xa93b('0x49')],_0x1a950a,_0x332f36[_0xa93b('0x43')])),'headers':{'Authorization':_0xa93b('0x4a')+_0x5b3422,'OData-Version':_0xa93b('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x332f36[_0xa93b('0x43')]===_0xa93b('0x4b')){var _0x38dbee=_0x1a12f1['enduserId']?[{'partyid_systemuser@odata.bind':_0xa93b('0x48')+_0x1a12f1[_0xa93b('0x25')]+')','participationtypemask':_0x1a12f1[_0xa93b('0x4c')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0xa93b('0x47')+_0x1a12f1[_0xa93b('0x32')]+')','participationtypemask':_0x1a12f1['callDirection']==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xa93b('0x48')+_0x1a12f1[_0xa93b('0x25')]+')','participationtypemask':_0x1a12f1[_0xa93b('0x4c')]===_0xa93b('0x4d')?0x2:0x1}];_0x28aefd={'method':_0xa93b('0x11'),'uri':_0x3645ad+_0xa93b('0x4e'),'body':Object[_0xa93b('0x4f')]({},{'subject':intUtil['getString'](_0x332f36[_0xa93b('0x46')],_0x1a950a,'\x20'),'phonenumber':String(_0x1a950a['calleridnum']),'description':intUtil[_0xa93b('0x45')](_0x332f36[_0xa93b('0x50')],_0x1a950a,'\x0a'),'regardingobjectid_contact@odata.bind':_0x1a12f1['enduserId']?_0xa93b('0x47')+_0x1a12f1[_0xa93b('0x32')]+')':undefined,'ownerid@odata.bind':_0xa93b('0x48')+_0x1a12f1[_0xa93b('0x25')]+')','directioncode':_0x1a12f1[_0xa93b('0x4c')]==='queue'?![]:!![],'phonecall_activity_parties':_0x38dbee},getCustomFields(_0x332f36[_0xa93b('0x49')],_0x1a950a,_0x332f36[_0xa93b('0x43')])),'headers':{'Authorization':'Bearer\x20'+_0x5b3422,'OData-Version':_0xa93b('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x28aefd);})[_0xa93b('0x14')](function(_0xab8c25){var _0x2dfcb6=_0xab8c25[_0xa93b('0x2f')][_0xa93b('0x30')];var _0x4354b7=_0x2dfcb6[_0xa93b('0x41')](_0x2dfcb6[_0xa93b('0x31')]('(')+0x1,_0x2dfcb6['lastIndexOf'](')'));_0x1a12f1[_0xa93b('0x51')]=_0x4354b7;_0x15ac19(_0x1a12f1);})['catch'](function(_0x164c94){_0x33073a(_0x164c94[_0xa93b('0x29')]);});});}function emit(_0x5d3e6f,_0x21d0d9,_0x26a09b,_0x4d243e){var _0x34acd2={'uri':util[_0xa93b('0x52')](_0xa93b('0x53'),_0x5d3e6f,_0x26a09b,_0x4d243e)};io['to'](util[_0xa93b('0x52')](_0xa93b('0x54'),_0x21d0d9))['emit']('trigger:browser:url',_0x34acd2);}exports['cs']=function(_0x42404d,_0x10dc97,_0x514be2,_0x471975,_0x125538,_0xc38474,_0x57bdec,_0xaba76a){var _0xd16230={};_0xc38474['remoteUri']=_0xc38474[_0xa93b('0xc')]?intUtil[_0xa93b('0x55')](_0xc38474[_0xa93b('0xe')][_0xa93b('0xf')]):intUtil['stripTrailingSlash'](_0xc38474['remoteUri']);_0xc38474['serverUrl']=intUtil[_0xa93b('0x55')](_0xc38474[_0xa93b('0x56')]);_0xd16230[_0xa93b('0x4c')]=_0xaba76a==='queue'||_0xaba76a==='unmanaged'?_0xa93b('0x4d'):_0xa93b('0x2b');var _0x15bfb8=_0xc38474[_0xa93b('0xc')]?util[_0xa93b('0x52')](_0xa93b('0x57'),_0xc38474['CloudProvider'][_0xa93b('0xf')]):util[_0xa93b('0x52')]('%s/api/data/v9.0/',_0xc38474[_0xa93b('0xd')]);var _0x8d012e=util['format'](_0xa93b('0x58'),_0xc38474[_0xa93b('0x59')]);var _0xb9b0e0=util[_0xa93b('0x52')](_0xa93b('0x5a'),_0xc38474[_0xa93b('0x56')],_0x10dc97[_0xa93b('0x5b')],md5(_0x10dc97[_0xa93b('0x5b')]));if(_0x125538&&_0x125538['monitor_format']){logger[_0xa93b('0x27')]('[QUEUE]',_0xa93b('0x5c'));_0x10dc97[_0xa93b('0x5d')]=_0xb9b0e0;}else if(_0x57bdec&&_0x57bdec['recordingFormat']&&_0x57bdec[_0xa93b('0x5e')]!=='none'){logger[_0xa93b('0x27')](_0xa93b('0x5f'),_0xa93b('0x5c'));_0x10dc97['recordingURL']=_0xb9b0e0;}else{_0x10dc97[_0xa93b('0x5d')]='';}return getUser(_0xd16230,_0xc38474,_0x471975,_0x8d012e,_0x15bfb8,_0xaba76a)[_0xa93b('0x14')](function(_0xf6175b){logger[_0xa93b('0x27')]('['+_0xaba76a[_0xa93b('0x18')]()+_0xa93b('0x60'),_0xf6175b[_0xa93b('0x25')]);logger['info']('['+_0xaba76a['toUpperCase']()+_0xa93b('0x61'),_0xf6175b[_0xa93b('0x21')]);return getEndUser(_0xf6175b,_0xc38474,_0x8d012e,_0x15bfb8,_0x10dc97,_0xaba76a,_0x514be2[_0xa93b('0x62')]);})['then'](function(_0x1fc2fa){logger[_0xa93b('0x27')]('['+_0xaba76a[_0xa93b('0x18')]()+_0xa93b('0x63'),_0x1fc2fa[_0xa93b('0x32')]);logger[_0xa93b('0x27')]('['+_0xaba76a[_0xa93b('0x18')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x10dc97['calleridnum']);return getTicket(_0x1fc2fa,_0xc38474,_0x8d012e,_0x15bfb8,_0x10dc97,_0x514be2,_0xaba76a);})[_0xa93b('0x14')](function(_0x41677e){logger[_0xa93b('0x27')](util[_0xa93b('0x52')]('['+_0xaba76a[_0xa93b('0x18')]()+_0xa93b('0x64'),_0x514be2['ticketType'],_0x41677e[_0xa93b('0x51')]));logger[_0xa93b('0x27')](util[_0xa93b('0x52')]('['+_0xaba76a[_0xa93b('0x18')]()+']\x20Call\x20direction:\x20%s',_0xaba76a));if(_0xaba76a!=='unmanaged'){logger[_0xa93b('0x27')]('['+_0xaba76a[_0xa93b('0x18')]()+']',_0xa93b('0x65'));emit(_0xc38474['remoteUri'],_0x471975['name'],_0x514be2[_0xa93b('0x43')],_0x41677e['ticketId']);}})[_0xa93b('0x16')](function(_0x1ad0c4){logger[_0xa93b('0x17')]('['+_0xaba76a[_0xa93b('0x18')]()+_0xa93b('0x66'),_0x1ad0c4['message']);});}; \ No newline at end of file +var _0x780c=['%2b','value','enduserId','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','includes','type','nameField','idField','indexOf','ticketType','incidents','assign','Subjects','getString','/contacts(','phonecall','callDirection','queue','phonecalls','Descriptions','ticketId','catch','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','[QUEUE]','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','userEmail','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','ioredis','dynamics365','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','POST','username','password','clientSecret','message','then','GET','Bearer\x20','4.0','isNil','validateEmail','email','length','internalemailaddress','toUpperCase','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','replace'];(function(_0x4a4b9b,_0x46fcac){var _0x12f723=function(_0x1a35ed){while(--_0x1a35ed){_0x4a4b9b['push'](_0x4a4b9b['shift']());}};_0x12f723(++_0x46fcac);}(_0x780c,0x15a));var _0xc780=function(_0x1c4409,_0x3b2e8f){_0x1c4409=_0x1c4409-0x0;var _0x356d8f=_0x780c[_0x1c4409];return _0x356d8f;};'use strict';var _=require(_0xc780('0x0'));var rp=require(_0xc780('0x1'));var util=require('util');var intUtil=require('./util');var md5=require('md5');var Redis=require(_0xc780('0x2'));var logger=require('../../../../config/logger')(_0xc780('0x3'));var config=require('../../../../config/environment');config[_0xc780('0x4')]=_[_0xc780('0x5')](config[_0xc780('0x4')],{'host':_0xc780('0x6'),'port':0x18eb});var io=require(_0xc780('0x7'))(new Redis(config[_0xc780('0x4')]));function getAuthToken(_0x342c35,_0xdb9a40,_0x8661af){if(_0x342c35[_0xc780('0x8')]){_0x342c35[_0xc780('0x9')]=_0x342c35[_0xc780('0xa')][_0xc780('0xb')];_0x342c35[_0xc780('0xc')]=_0x342c35[_0xc780('0xa')][_0xc780('0xd')];return Promise[_0xc780('0xe')](_0x342c35['CloudProvider'][_0xc780('0xf')]);}var _0x30272d={'method':_0xc780('0x10'),'uri':_0xdb9a40,'form':{'client_id':_0x342c35['clientId'],'resource':_0x342c35[_0xc780('0x9')],'username':_0x342c35[_0xc780('0x11')],'password':_0x342c35['password'],'grant_type':_0xc780('0x12'),'client_secret':_0x342c35[_0xc780('0x13')]},'json':!![]};return rp(_0x30272d)['then'](function(_0x4bc15b){return _0x4bc15b['access_token'];})['catch'](function(_0x439924){logger['error']('['+[_0x8661af['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0x439924[_0xc780('0x14')];});}function getUser(_0x2dcf5e,_0x4479ae,_0x44281f,_0x1f287f,_0x45f506,_0x431fd8){return new Promise(function(_0x549b70,_0xb74638){return getAuthToken(_0x4479ae,_0x1f287f,_0x431fd8)[_0xc780('0x15')](function(_0x321334){var _0x4dc161={'method':_0xc780('0x16'),'uri':_0x45f506+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0xc780('0x17')+_0x321334,'OData-Version':_0xc780('0x18')},'json':!![]};return rp(_0x4dc161);})[_0xc780('0x15')](function(_0x176a1e){var _0xd2611e=_0x176a1e['value'];var _0x5f416d=![];var _0x30c3e1=null;if(!_[_0xc780('0x19')](_0x44281f)){if(intUtil[_0xc780('0x1a')](_0x44281f[_0xc780('0x1b')])){_0x2dcf5e['userEmail']=_0x44281f[_0xc780('0x1b')];for(_0x30c3e1=0x0;_0x30c3e1<_0xd2611e[_0xc780('0x1c')];_0x30c3e1++){if(_0xd2611e[_0x30c3e1][_0xc780('0x1d')]===_0x44281f['email']&&!_0xd2611e[_0x30c3e1]['isdisabled']){_0x5f416d=!![];logger['info']('['+[_0x431fd8[_0xc780('0x1e')]()]+']\x20Agent\x20found\x20'+_0xd2611e[_0x30c3e1][_0xc780('0x1f')]+'!');_0x2dcf5e[_0xc780('0x20')]=_0xd2611e[_0x30c3e1][_0xc780('0x1f')];}}}}if(!_0x5f416d){logger[_0xc780('0x21')]('['+[_0x431fd8['toUpperCase']()]+_0xc780('0x22'));_0x2dcf5e['userEmail']=_0x4479ae[_0xc780('0x11')];for(_0x30c3e1=0x0;_0x30c3e1<_0xd2611e[_0xc780('0x1c')];_0x30c3e1++){if(_0xd2611e[_0x30c3e1][_0xc780('0x1d')]===_0x4479ae[_0xc780('0x11')]){_0x2dcf5e[_0xc780('0x20')]=_0xd2611e[_0x30c3e1][_0xc780('0x1f')];}}}_0x549b70(_0x2dcf5e);})['catch'](function(_0x2c5501){_0xb74638(_0x2c5501[_0xc780('0x14')]);});});}function createEndUser(_0x1d21a2,_0x270256,_0x12f739,_0x2b8883,_0x13a1da,_0x35a0a7){return new Promise(function(_0x4988d1,_0x17ec3c){return getAuthToken(_0x270256,_0x12f739,_0x35a0a7)[_0xc780('0x15')](function(_0x3c78fd){var _0x3d9b97=_0x35a0a7[_0xc780('0x23')]()===_0xc780('0x24')?_0x13a1da[_0xc780('0x25')]:_0x13a1da[_0xc780('0x26')];var _0x3321f1={'method':_0xc780('0x10'),'uri':_0x2b8883+_0xc780('0x27'),'body':{'telephone1':_0x3d9b97,'fullname':_0x3d9b97,'firstname':_0x3d9b97,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xc780('0x28')+_0x1d21a2[_0xc780('0x20')]+')'},'headers':{'Authorization':_0xc780('0x17')+_0x3c78fd,'OData-Version':_0xc780('0x18')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x3321f1);})[_0xc780('0x15')](function(_0x1417ff){var _0x482031=_0x1417ff[_0xc780('0x29')][_0xc780('0x2a')];var _0x2e757f=_0x482031[_0xc780('0x2b')](_0x482031['lastIndexOf']('(')+0x1,_0x482031[_0xc780('0x2c')](')'));_0x1d21a2['enduserId']=_0x2e757f;_0x4988d1(_0x1d21a2);})['catch'](function(_0x3e449a){_0x17ec3c(_0x3e449a[_0xc780('0x14')]);});});}function getEndUser(_0x59cc56,_0x3c3731,_0x209303,_0x269b6a,_0x316666,_0x402c68,_0x5a8f3a){var _0x4bc480=_0x402c68[_0xc780('0x23')]()==='outbound'?_0x316666['destcalleridnum']:_0x316666[_0xc780('0x26')];return getAuthToken(_0x3c3731,_0x209303,_0x402c68)[_0xc780('0x15')](function(_0x10fcc5){var _0x17a2f7={'method':_0xc780('0x16'),'uri':_0x269b6a+'contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27'+_0x4bc480[_0xc780('0x2d')]('+',_0xc780('0x2e'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x10fcc5,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x17a2f7);})[_0xc780('0x15')](function(_0x3c1e6e){var _0x37bd34=![];if(!_0x3c1e6e)return _0x37bd34;var _0x42f846=_0x3c1e6e[_0xc780('0x2f')];for(var _0x3d1d6b=0x0;_0x3d1d6b<_0x42f846[_0xc780('0x1c')];_0x3d1d6b++){if(_0x42f846[_0x3d1d6b]['telephone1']===_0x4bc480){_0x37bd34=!![];_0x59cc56[_0xc780('0x30')]=_0x42f846[_0x3d1d6b]['contactid'];}}return _0x37bd34;})[_0xc780('0x15')](function(_0x5c72f1){if(_0x5c72f1)return _0x59cc56;if(_0x5a8f3a===_0xc780('0x31')){logger[_0xc780('0x21')]('['+[_0x402c68[_0xc780('0x1e')]()]+_0xc780('0x32'));return _0x59cc56;}return createEndUser(_0x59cc56,_0x3c3731,_0x209303,_0x269b6a,_0x316666,_0x402c68)[_0xc780('0x15')](function(_0x464823){logger[_0xc780('0x21')]('['+[_0x402c68['toUpperCase']()]+']\x20Enduser\x20created!',_0x464823[_0xc780('0x30')]);return _0x464823;});});}function getCustomFields(_0x3794d6,_0x2a81fa,_0x1334e3){var _0x50958b={};if(_0x3794d6['length']>0x0){_[_0xc780('0x33')](_0x3794d6,function(_0x27c654){if(_[_0xc780('0x34')](['string','picklist'],_0x27c654[_0xc780('0x35')])&&_0x27c654[_0xc780('0x36')]&&!_0x27c654['customField']){var _0x160dc0=_0x27c654[_0xc780('0x37')][_0xc780('0x23')]();var _0x4f7b91=_0x160dc0[_0xc780('0x2b')](0x0,_0x160dc0[_0xc780('0x38')]('_'));var _0x4952b3=_0x160dc0['substring'](_0x160dc0[_0xc780('0x38')]('_')+0x1);if(_0x4f7b91===_0x1334e3){_0x50958b[_0x4952b3]=_0x27c654['content'];}}});}return _0x50958b;}function getTicket(_0x2d5366,_0xb4c0bb,_0x59e676,_0x3c8c25,_0x3e78af,_0x3e84d9,_0x4ed47d){return new Promise(function(_0x277544,_0x6e2975){var _0xbab2b6;return getAuthToken(_0xb4c0bb,_0x59e676,_0x4ed47d)['then'](function(_0x5cba59){if(_0x3e84d9[_0xc780('0x39')]==='incident'){_0xbab2b6={'method':_0xc780('0x10'),'uri':_0x3c8c25+_0xc780('0x3a'),'body':Object[_0xc780('0x3b')]({},{'title':intUtil['getString'](_0x3e84d9[_0xc780('0x3c')],_0x3e78af,'\x20'),'description':intUtil[_0xc780('0x3d')](_0x3e84d9['Descriptions'],_0x3e78af,'\x0a'),'customerid_contact@odata.bind':_0x2d5366['enduserId']?_0xc780('0x3e')+_0x2d5366[_0xc780('0x30')]+')':undefined,'ownerid@odata.bind':_0xc780('0x28')+_0x2d5366[_0xc780('0x20')]+')','caseorigincode':'1'},getCustomFields(_0x3e84d9['Fields'],_0x3e78af,_0x3e84d9['ticketType'])),'headers':{'Authorization':_0xc780('0x17')+_0x5cba59,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x3e84d9[_0xc780('0x39')]===_0xc780('0x3f')){var _0x2fbb2e=_0x2d5366['enduserId']?[{'partyid_systemuser@odata.bind':_0xc780('0x28')+_0x2d5366[_0xc780('0x20')]+')','participationtypemask':_0x2d5366[_0xc780('0x40')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0xc780('0x3e')+_0x2d5366[_0xc780('0x30')]+')','participationtypemask':_0x2d5366[_0xc780('0x40')]===_0xc780('0x41')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xc780('0x28')+_0x2d5366[_0xc780('0x20')]+')','participationtypemask':_0x2d5366['callDirection']==='queue'?0x2:0x1}];_0xbab2b6={'method':_0xc780('0x10'),'uri':_0x3c8c25+_0xc780('0x42'),'body':Object[_0xc780('0x3b')]({},{'subject':intUtil[_0xc780('0x3d')](_0x3e84d9[_0xc780('0x3c')],_0x3e78af,'\x20'),'phonenumber':String(_0x3e78af[_0xc780('0x26')]),'description':intUtil[_0xc780('0x3d')](_0x3e84d9[_0xc780('0x43')],_0x3e78af,'\x0a'),'regardingobjectid_contact@odata.bind':_0x2d5366[_0xc780('0x30')]?_0xc780('0x3e')+_0x2d5366[_0xc780('0x30')]+')':undefined,'ownerid@odata.bind':_0xc780('0x28')+_0x2d5366[_0xc780('0x20')]+')','directioncode':_0x2d5366[_0xc780('0x40')]==='queue'?![]:!![],'phonecall_activity_parties':_0x2fbb2e},getCustomFields(_0x3e84d9['Fields'],_0x3e78af,_0x3e84d9[_0xc780('0x39')])),'headers':{'Authorization':_0xc780('0x17')+_0x5cba59,'OData-Version':_0xc780('0x18')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0xbab2b6);})[_0xc780('0x15')](function(_0x23bae1){var _0x1b5393=_0x23bae1[_0xc780('0x29')][_0xc780('0x2a')];var _0x549636=_0x1b5393[_0xc780('0x2b')](_0x1b5393[_0xc780('0x2c')]('(')+0x1,_0x1b5393[_0xc780('0x2c')](')'));_0x2d5366[_0xc780('0x44')]=_0x549636;_0x277544(_0x2d5366);})[_0xc780('0x45')](function(_0x800ed4){_0x6e2975(_0x800ed4['message']);});});}function emit(_0x31b98e,_0x56aedb,_0x1e29c6,_0x4310a0){var _0x888d2c={'uri':util[_0xc780('0x46')](_0xc780('0x47'),_0x31b98e,_0x1e29c6,_0x4310a0)};io['to'](util[_0xc780('0x46')](_0xc780('0x48'),_0x56aedb))[_0xc780('0x49')](_0xc780('0x4a'),_0x888d2c);}exports['cs']=function(_0x44ffec,_0x17f1e8,_0x5ac1be,_0xfcd279,_0x548a51,_0x17f51c,_0x2c52a8,_0x70e62a){var _0x2deb44={};_0x17f51c[_0xc780('0x9')]=_0x17f51c[_0xc780('0x8')]?intUtil[_0xc780('0x4b')](_0x17f51c[_0xc780('0xa')][_0xc780('0xb')]):intUtil[_0xc780('0x4b')](_0x17f51c[_0xc780('0x9')]);_0x17f51c['serverUrl']=intUtil['stripTrailingSlash'](_0x17f51c[_0xc780('0x4c')]);_0x2deb44[_0xc780('0x40')]=_0x70e62a===_0xc780('0x41')||_0x70e62a==='unmanaged'?_0xc780('0x41'):_0xc780('0x24');var _0x317ed8=_0x17f51c['modernAuthentication']?util[_0xc780('0x46')]('%s/api/data/v9.0/',_0x17f51c[_0xc780('0xa')][_0xc780('0xb')]):util[_0xc780('0x46')]('%s/api/data/v9.0/',_0x17f51c[_0xc780('0x9')]);var _0x1b21b9=util[_0xc780('0x46')](_0xc780('0x4d'),_0x17f51c[_0xc780('0xc')]);var _0x1629c0=util[_0xc780('0x46')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x17f51c[_0xc780('0x4c')],_0x17f1e8[_0xc780('0x4e')],md5(_0x17f1e8[_0xc780('0x4e')]));if(_0x548a51&&_0x548a51[_0xc780('0x4f')]){logger[_0xc780('0x21')](_0xc780('0x50'),'Recording\x20is\x20enabled!');_0x17f1e8['recordingURL']=_0x1629c0;}else if(_0x2c52a8&&_0x2c52a8['recordingFormat']&&_0x2c52a8[_0xc780('0x51')]!==_0xc780('0x52')){logger['info'](_0xc780('0x53'),'Recording\x20is\x20enabled!');_0x17f1e8[_0xc780('0x54')]=_0x1629c0;}else{_0x17f1e8[_0xc780('0x54')]='';}return getUser(_0x2deb44,_0x17f51c,_0xfcd279,_0x1b21b9,_0x317ed8,_0x70e62a)[_0xc780('0x15')](function(_0x3aa50c){logger[_0xc780('0x21')]('['+_0x70e62a['toUpperCase']()+_0xc780('0x55'),_0x3aa50c[_0xc780('0x20')]);logger[_0xc780('0x21')]('['+_0x70e62a[_0xc780('0x1e')]()+_0xc780('0x56'),_0x3aa50c[_0xc780('0x57')]);return getEndUser(_0x3aa50c,_0x17f51c,_0x1b21b9,_0x317ed8,_0x17f1e8,_0x70e62a,_0x5ac1be[_0xc780('0x58')]);})[_0xc780('0x15')](function(_0x3a253e){logger[_0xc780('0x21')]('['+_0x70e62a[_0xc780('0x1e')]()+_0xc780('0x59'),_0x3a253e[_0xc780('0x30')]);logger['info']('['+_0x70e62a[_0xc780('0x1e')]()+_0xc780('0x5a'),_0x17f1e8[_0xc780('0x26')]);return getTicket(_0x3a253e,_0x17f51c,_0x1b21b9,_0x317ed8,_0x17f1e8,_0x5ac1be,_0x70e62a);})[_0xc780('0x15')](function(_0x123cbb){logger[_0xc780('0x21')](util['format']('['+_0x70e62a[_0xc780('0x1e')]()+_0xc780('0x5b'),_0x5ac1be['ticketType'],_0x123cbb[_0xc780('0x44')]));logger[_0xc780('0x21')](util[_0xc780('0x46')]('['+_0x70e62a[_0xc780('0x1e')]()+_0xc780('0x5c'),_0x70e62a));if(_0x70e62a!==_0xc780('0x5d')){logger[_0xc780('0x21')]('['+_0x70e62a['toUpperCase']()+']',_0xc780('0x5e'));emit(_0x17f51c['remoteUri'],_0xfcd279[_0xc780('0x5f')],_0x5ac1be[_0xc780('0x39')],_0x123cbb[_0xc780('0x44')]);}})[_0xc780('0x45')](function(_0x356b09){logger[_0xc780('0x60')]('['+_0x70e62a[_0xc780('0x1e')]()+_0xc780('0x61'),_0x356b09[_0xc780('0x14')]);});}; \ 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 3fcd0c9..91e3bd8 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 _0x1cce=['calleridnum','getString','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','remoteUri','POST','validateEmail','%s/api/v2/agents','then','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20found!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','stringify','forEach','includes','picklist','type','customField','nameField','toLowerCase','content','string','idField','push','variable','variableName','customVariable','Variable','queue','serverUrl','stripTrailingSlash','monitor_format','recordingURL','uniqueid','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','[QUEUE]','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','unmanaged','Recording\x20is\x20enabled!','Authorization','lastevent','toUpperCase','request-promise','md5','util','ioredis','./util','../../../../config/environment','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x1cce,0xaa));var _0xe1cc=function(_0x4383e9,_0xa4b307){_0x4383e9=_0x4383e9-0x0;var _0x355405=_0x1cce[_0x4383e9];return _0x355405;};'use strict';var _=require('lodash');var rp=require(_0xe1cc('0x0'));var md5=require(_0xe1cc('0x1'));var util=require(_0xe1cc('0x2'));var Redis=require(_0xe1cc('0x3'));var intUtil=require(_0xe1cc('0x4'));var config=require(_0xe1cc('0x5'));var logger=require('../../../../config/logger')(_0xe1cc('0x6'));config[_0xe1cc('0x7')]=_[_0xe1cc('0x8')](config[_0xe1cc('0x7')],{'host':_0xe1cc('0x9'),'port':0x18eb});var io=require(_0xe1cc('0xa'))(new Redis(config[_0xe1cc('0x7')]));var headers={'Content-Type':_0xe1cc('0xb'),'Accept':_0xe1cc('0xb')};function emit(_0xae8b9f,_0x5a88e9,_0x230d5c){io['to'](_0xae8b9f)['emit'](_0x5a88e9,_0x230d5c);}function getTicket(_0x1ece6b,_0x251a9c,_0x1adbc7,_0x21c4b5,_0x5a2abc){logger[_0xe1cc('0xc')](_0xe1cc('0xd'));var _0x499400=_[_0xe1cc('0xe')]({'responder_id':_0x251a9c['id'],'requester_id':_0x1adbc7['id'],'name':util[_0xe1cc('0xf')](_0xe1cc('0x10'),_0x5a2abc[_0xe1cc('0x11')]),'phone':_0x5a2abc[_0xe1cc('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xe1cc('0x13')](_0x21c4b5['Subjects'],_0x5a2abc,'\x20'),'description':intUtil[_0xe1cc('0x13')](_0x21c4b5[_0xe1cc('0x14')],_0x5a2abc,_0xe1cc('0x15')),'tags':getTags(_0x21c4b5[_0xe1cc('0x16')],_0xe1cc('0x17'))},getCustomFields(_0x21c4b5[_0xe1cc('0x18')],_0x5a2abc));_0x499400[_0xe1cc('0x19')]=_[_0xe1cc('0x1a')](_[_0xe1cc('0x1b')](_0x499400[_0xe1cc('0x19')],'id'),_0xe1cc('0x1c'));return request({'uri':util[_0xe1cc('0xf')]('%s/api/v2/tickets',_0x1ece6b[_0xe1cc('0x1d')]),'method':_0xe1cc('0x1e'),'body':_0x499400})['then'](function(_0x1eaa55){logger[_0xe1cc('0xc')]('Ticket\x20created!');return _0x1eaa55;});}function getUser(_0x40fe39,_0x14a9aa){if(intUtil[_0xe1cc('0x1f')](_0x14a9aa)){return request({'uri':util[_0xe1cc('0xf')](_0xe1cc('0x20'),_0x40fe39[_0xe1cc('0x1d')]),'qs':{'email':_0x14a9aa}})[_0xe1cc('0x21')](function(_0x3cd06c){if(_0x3cd06c['length']){logger[_0xe1cc('0xc')](_0xe1cc('0x22'));return _[_0xe1cc('0x23')](_0x3cd06c,function(_0x1d64c4){return _0x1d64c4[_0xe1cc('0x24')][_0xe1cc('0x25')]===_0x14a9aa;});}else{logger['info'](_0xe1cc('0x26'));return request({'uri':util[_0xe1cc('0xf')]('%s/api/v2/agents/me',_0x40fe39[_0xe1cc('0x1d')])})[_0xe1cc('0x21')](function(_0x39ed20){logger[_0xe1cc('0xc')](_0xe1cc('0x27'));return _0x39ed20;});}});}else{logger[_0xe1cc('0xc')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xe1cc('0xf')](_0xe1cc('0x28'),_0x40fe39[_0xe1cc('0x1d')])})[_0xe1cc('0x21')](function(_0x3249cc){logger[_0xe1cc('0xc')](_0xe1cc('0x27'));return _0x3249cc;});}}function getEndUser(_0x31cef4,_0x2d2f5c,_0x5ed550){logger[_0xe1cc('0xc')](_0xe1cc('0x29'),_0x5ed550);return request({'uri':util[_0xe1cc('0xf')](_0xe1cc('0x2a'),_0x31cef4['remoteUri']),'qs':{'phone':_0x5ed550}})[_0xe1cc('0x21')](function(_0x183b83){if(_0x183b83[_0xe1cc('0x2b')]){logger['info'](_0xe1cc('0x2c'));return _['find'](_0x183b83,{'phone':_0x5ed550});}else{logger[_0xe1cc('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0xe1cc('0x2a'),_0x31cef4[_0xe1cc('0x1d')]),'method':'POST','body':{'name':_0x2d2f5c,'phone':_0x5ed550}})['then'](function(_0x559e0a){logger[_0xe1cc('0xc')](_0xe1cc('0x2d'));return _0x559e0a;});}});}function getAuth(_0x2580ad){return util[_0xe1cc('0xf')](_0xe1cc('0x2e'),new Buffer(_0x2580ad[_0xe1cc('0x2f')]+':X')[_0xe1cc('0x30')](_0xe1cc('0x31')));}function request(_0x207966){logger[_0xe1cc('0x32')]('[HTTP]',JSON[_0xe1cc('0x33')](_0x207966));return rp(_[_0xe1cc('0x8')](_0x207966,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x183b6a,_0xc0a2fb){var _0x43b7fd=[];if(_0x183b6a&&_0x183b6a[_0xe1cc('0x2b')]>0x0){_0x43b7fd=_['map'](_0x183b6a,_0xc0a2fb);}return _0x43b7fd;}function getCustomFields(_0x2b6f58,_0x1d196d){var _0x103ef8=[];var _0x1052d3={'custom_fields':[]};if(_0x2b6f58[_0xe1cc('0x2b')]>0x0){_[_0xe1cc('0x34')](_0x2b6f58,function(_0x459738){if(_[_0xe1cc('0x35')](['string',_0xe1cc('0x36')],_0x459738[_0xe1cc('0x37')])&&_0x459738['nameField']&&!_0x459738[_0xe1cc('0x38')]){_0x1052d3[_0x459738[_0xe1cc('0x39')][_0xe1cc('0x3a')]()]=_0x459738[_0xe1cc('0x3b')][_0xe1cc('0x30')]();}else if(_[_0xe1cc('0x35')]([_0xe1cc('0x3c'),_0xe1cc('0x36')],_0x459738[_0xe1cc('0x37')])&&_0x459738[_0xe1cc('0x3d')]&&_0x459738[_0xe1cc('0x38')]){_0x1052d3[_0xe1cc('0x19')][_0xe1cc('0x3e')]({'id':_0x459738[_0xe1cc('0x3d')],'value':_0x459738[_0xe1cc('0x3b')]['toString']()});}else if(_0x459738['type']===_0xe1cc('0x3f')&&_0x459738['variableName']&&_0x459738[_0xe1cc('0x3d')]&&_0x459738[_0xe1cc('0x38')]){_0x1d196d[_0x459738[_0xe1cc('0x40')]]&&_0x1052d3[_0xe1cc('0x19')]['push']({'id':_0x459738[_0xe1cc('0x3d')],'value':_0x1d196d[_0x459738[_0xe1cc('0x40')]][_0xe1cc('0x30')]()});}else if(_0x459738['type']===_0xe1cc('0x41')&&_0x459738[_0xe1cc('0x42')]&&_0x459738[_0xe1cc('0x42')][_0xe1cc('0x17')]&&_0x459738[_0xe1cc('0x3d')]&&_0x459738[_0xe1cc('0x38')]){_0x1d196d[_0x459738['Variable'][_0xe1cc('0x17')][_0xe1cc('0x3a')]()]&&_0x1052d3[_0xe1cc('0x19')][_0xe1cc('0x3e')]({'id':_0x459738[_0xe1cc('0x3d')],'value':_0x1d196d[_0x459738['Variable'][_0xe1cc('0x17')][_0xe1cc('0x3a')]()][_0xe1cc('0x30')]()});}});}return _0x1052d3;}exports[_0xe1cc('0x43')]=function(_0x4bcf2a,_0xe31b92,_0x1f175d,_0x2bc5b8,_0x5f0c3,_0x39c143){var _0xa940e1,_0x450e9a;_0x39c143[_0xe1cc('0x1d')]=intUtil['stripTrailingSlash'](_0x39c143[_0xe1cc('0x1d')]);_0x39c143[_0xe1cc('0x44')]=intUtil[_0xe1cc('0x45')](_0x39c143[_0xe1cc('0x44')]);if(_0x5f0c3&&_0x5f0c3[_0xe1cc('0x46')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0xe31b92[_0xe1cc('0x47')]=util[_0xe1cc('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39c143[_0xe1cc('0x44')],_0xe31b92[_0xe1cc('0x48')],md5(_0xe31b92[_0xe1cc('0x48')]));}else{_0xe31b92[_0xe1cc('0x47')]='';}headers['Authorization']=getAuth(_0x39c143);return getUser(_0x39c143,_0x2bc5b8[_0xe1cc('0x25')])[_0xe1cc('0x21')](function(_0x31157d){_0xa940e1=_0x31157d;logger[_0xe1cc('0xc')](_0xe1cc('0x49'),_0xa940e1['id']);return getEndUser(_0x39c143,_0xe31b92[_0xe1cc('0x11')],_0xe31b92[_0xe1cc('0x12')]);})[_0xe1cc('0x21')](function(_0x36288d){_0x450e9a=_0x36288d;logger[_0xe1cc('0xc')](_0xe1cc('0x4a'),_0x450e9a['id']);return getTicket(_0x39c143,_0xa940e1,_0x450e9a,_0x1f175d,_0xe31b92);})[_0xe1cc('0x21')](function(_0x1b7e32){if(_0x1b7e32&&_0x1b7e32['id']){logger[_0xe1cc('0xc')](_0xe1cc('0x4b'));logger[_0xe1cc('0xc')](_0xe1cc('0x4c'),_0x1b7e32['id']);logger[_0xe1cc('0xc')]('[QUEUE]',_0xe1cc('0x4d'));emit(util[_0xe1cc('0xf')](_0xe1cc('0x4e'),_0x2bc5b8[_0xe1cc('0x17')]),_0xe1cc('0x4f'),{'uri':util[_0xe1cc('0xf')](_0xe1cc('0x50'),_0x39c143[_0xe1cc('0x1d')],_0x1b7e32['id'])});}})[_0xe1cc('0x51')](function(_0x4debaf){logger[_0xe1cc('0x52')](_0xe1cc('0x53'),JSON[_0xe1cc('0x33')](_0x4debaf));});};exports[_0xe1cc('0x54')]=function(_0x1df1f9,_0x32a661,_0x12eee3,_0x493962,_0x3a153b,_0x43443e,_0xc6d8a5){var _0x559aff,_0xf7961b;_0x43443e[_0xe1cc('0x1d')]=intUtil[_0xe1cc('0x45')](_0x43443e['remoteUri']);_0x43443e[_0xe1cc('0x44')]=intUtil[_0xe1cc('0x45')](_0x43443e['serverUrl']);if(_0xc6d8a5&&_0xc6d8a5['recordingFormat']&&_0xc6d8a5[_0xe1cc('0x55')]!=='none'){logger[_0xe1cc('0xc')](_0xe1cc('0x56'),'Recording\x20is\x20enabled!');_0x32a661[_0xe1cc('0x47')]=util[_0xe1cc('0xf')](_0xe1cc('0x57'),_0x43443e['serverUrl'],_0x32a661[_0xe1cc('0x48')],md5(_0x32a661['uniqueid']));}headers['Authorization']=getAuth(_0x43443e);return getUser(_0x43443e,_0x493962['email'])[_0xe1cc('0x21')](function(_0x2cb4a4){_0x559aff=_0x2cb4a4;logger[_0xe1cc('0xc')](_0xe1cc('0x49'),_0x559aff['id']);return getEndUser(_0x43443e,_0x32a661[_0xe1cc('0x58')],_0x32a661['destcalleridnum']);})[_0xe1cc('0x21')](function(_0x323c02){_0xf7961b=_0x323c02;logger['info'](_0xe1cc('0x4a'),_0xf7961b['id']);return getTicket(_0x43443e,_0x559aff,_0xf7961b,_0x12eee3,_0x32a661);})[_0xe1cc('0x21')](function(_0x32afd0){if(_0x32afd0&&_0x32afd0['id']){logger[_0xe1cc('0xc')](_0xe1cc('0x4b'));logger[_0xe1cc('0xc')](_0xe1cc('0x4c'),_0x32afd0['id']);logger[_0xe1cc('0xc')](_0xe1cc('0x56'),_0xe1cc('0x4d'));emit(util['format'](_0xe1cc('0x4e'),_0x493962['name']),_0xe1cc('0x4f'),{'uri':util[_0xe1cc('0xf')](_0xe1cc('0x50'),_0x43443e[_0xe1cc('0x1d')],_0x32afd0['id'])});}})[_0xe1cc('0x51')](function(_0x213722){logger[_0xe1cc('0x52')]('[OUTBOUND]',JSON['stringify'](_0x213722));});};exports[_0xe1cc('0x59')]=function(_0x174945,_0x269a8e,_0x91de9,_0x197daf,_0x36157a,_0x3bcef5){var _0x338c8a,_0x3e5726;_0x3bcef5['remoteUri']=intUtil[_0xe1cc('0x45')](_0x3bcef5[_0xe1cc('0x1d')]);_0x3bcef5[_0xe1cc('0x44')]=intUtil['stripTrailingSlash'](_0x3bcef5[_0xe1cc('0x44')]);if(_0x36157a&&_0x36157a['monitor_format']){logger[_0xe1cc('0xc')]('['+_0x269a8e['lastevent']['toUpperCase']()+']',_0xe1cc('0x5a'));_0x269a8e[_0xe1cc('0x47')]=util[_0xe1cc('0xf')](_0xe1cc('0x57'),_0x3bcef5[_0xe1cc('0x44')],_0x269a8e[_0xe1cc('0x48')],md5(_0x269a8e[_0xe1cc('0x48')]));}else{_0x269a8e['recordingURL']='';}headers[_0xe1cc('0x5b')]=getAuth(_0x3bcef5);return getUser(_0x3bcef5,'')[_0xe1cc('0x21')](function(_0x1f042f){_0x338c8a=_0x1f042f;logger[_0xe1cc('0xc')]('The\x20User\x20ID\x20is:',_0x338c8a['id']);return getEndUser(_0x3bcef5,_0x269a8e[_0xe1cc('0x11')],_0x269a8e[_0xe1cc('0x12')]);})[_0xe1cc('0x21')](function(_0x42df1a){_0x3e5726=_0x42df1a;logger[_0xe1cc('0xc')](_0xe1cc('0x4a'),_0x3e5726['id']);return getTicket(_0x3bcef5,_0x338c8a,_0x3e5726,_0x91de9,_0x269a8e);})[_0xe1cc('0x21')](function(_0x2cc1c9){if(_0x2cc1c9){logger[_0xe1cc('0xc')](_0xe1cc('0x4b'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x2cc1c9['id']);}})['catch'](function(_0x34f9a3){logger[_0xe1cc('0x52')]('['+_0x269a8e[_0xe1cc('0x5c')][_0xe1cc('0x5d')]()+']',JSON[_0xe1cc('0x33')](_0x34f9a3));});}; \ No newline at end of file +var _0xaa70=['recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','unmanaged','stripTrailingSlash','lastevent','toUpperCase','lodash','md5','util','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridnum','Subjects','
','Tags','name','Fields','custom_fields','mapValues','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','[HTTP]','stringify','GET','forEach','picklist','type','nameField','customField','content','toString','includes','idField','push','variable','variableName','Variable','toLowerCase','queue','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound'];(function(_0x1db9f5,_0xb1a825){var _0x18ef0b=function(_0x571dd0){while(--_0x571dd0){_0x1db9f5['push'](_0x1db9f5['shift']());}};_0x18ef0b(++_0xb1a825);}(_0xaa70,0x121));var _0x0aa7=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xaa70[_0x487b0c];return _0x1adbdc;};'use strict';var _=require(_0x0aa7('0x0'));var rp=require('request-promise');var md5=require(_0x0aa7('0x1'));var util=require(_0x0aa7('0x2'));var Redis=require(_0x0aa7('0x3'));var intUtil=require('./util');var config=require(_0x0aa7('0x4'));var logger=require(_0x0aa7('0x5'))(_0x0aa7('0x6'));config[_0x0aa7('0x7')]=_[_0x0aa7('0x8')](config[_0x0aa7('0x7')],{'host':_0x0aa7('0x9'),'port':0x18eb});var io=require(_0x0aa7('0xa'))(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':_0x0aa7('0xb')};function emit(_0x58e9ce,_0x1bf553,_0x3922c5){io['to'](_0x58e9ce)[_0x0aa7('0xc')](_0x1bf553,_0x3922c5);}function getTicket(_0xfb69ad,_0x394dd9,_0x4d5b9d,_0x3f8360,_0xd5084b){logger[_0x0aa7('0xd')](_0x0aa7('0xe'));var _0x5c11b1=_[_0x0aa7('0xf')]({'responder_id':_0x394dd9['id'],'requester_id':_0x4d5b9d['id'],'name':util[_0x0aa7('0x10')](_0x0aa7('0x11'),_0xd5084b['calleridname']),'phone':_0xd5084b[_0x0aa7('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x3f8360[_0x0aa7('0x13')],_0xd5084b,'\x20'),'description':intUtil['getString'](_0x3f8360['Descriptions'],_0xd5084b,_0x0aa7('0x14')),'tags':getTags(_0x3f8360[_0x0aa7('0x15')],_0x0aa7('0x16'))},getCustomFields(_0x3f8360[_0x0aa7('0x17')],_0xd5084b));_0x5c11b1[_0x0aa7('0x18')]=_[_0x0aa7('0x19')](_['keyBy'](_0x5c11b1[_0x0aa7('0x18')],'id'),'value');return request({'uri':util[_0x0aa7('0x10')](_0x0aa7('0x1a'),_0xfb69ad[_0x0aa7('0x1b')]),'method':_0x0aa7('0x1c'),'body':_0x5c11b1})[_0x0aa7('0x1d')](function(_0x4620ed){logger['info'](_0x0aa7('0x1e'));return _0x4620ed;});}function getUser(_0x35c306,_0x45c33f){if(intUtil[_0x0aa7('0x1f')](_0x45c33f)){return request({'uri':util[_0x0aa7('0x10')](_0x0aa7('0x20'),_0x35c306[_0x0aa7('0x1b')]),'qs':{'email':_0x45c33f}})['then'](function(_0x51e636){if(_0x51e636[_0x0aa7('0x21')]){logger[_0x0aa7('0xd')](_0x0aa7('0x22'));return _[_0x0aa7('0x23')](_0x51e636,function(_0xe679ad){return _0xe679ad[_0x0aa7('0x24')][_0x0aa7('0x25')]===_0x45c33f;});}else{logger[_0x0aa7('0xd')](_0x0aa7('0x26'));return request({'uri':util[_0x0aa7('0x10')](_0x0aa7('0x27'),_0x35c306[_0x0aa7('0x1b')])})[_0x0aa7('0x1d')](function(_0x143be9){logger[_0x0aa7('0xd')](_0x0aa7('0x28'));return _0x143be9;});}});}else{logger[_0x0aa7('0xd')](_0x0aa7('0x29'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x35c306[_0x0aa7('0x1b')])})['then'](function(_0x51a809){logger[_0x0aa7('0xd')](_0x0aa7('0x28'));return _0x51a809;});}}function getEndUser(_0x33ea2e,_0x5938bd,_0x17963b){logger['info'](_0x0aa7('0x2a'),_0x17963b);return request({'uri':util[_0x0aa7('0x10')]('%s/api/v2/contacts',_0x33ea2e[_0x0aa7('0x1b')]),'qs':{'phone':_0x17963b}})['then'](function(_0x288efd){if(_0x288efd[_0x0aa7('0x21')]){logger[_0x0aa7('0xd')]('Enduser\x20found!');return _[_0x0aa7('0x23')](_0x288efd,{'phone':_0x17963b});}else{logger[_0x0aa7('0xd')](_0x0aa7('0x2b'));return request({'uri':util[_0x0aa7('0x10')](_0x0aa7('0x2c'),_0x33ea2e[_0x0aa7('0x1b')]),'method':'POST','body':{'name':_0x5938bd,'phone':_0x17963b}})[_0x0aa7('0x1d')](function(_0x2c26d8){logger[_0x0aa7('0xd')](_0x0aa7('0x2d'));return _0x2c26d8;});}});}function getAuth(_0x3b5f08){return util[_0x0aa7('0x10')](_0x0aa7('0x2e'),new Buffer(_0x3b5f08[_0x0aa7('0x2f')]+':X')['toString']('base64'));}function request(_0x1cfcde){logger['debug'](_0x0aa7('0x30'),JSON[_0x0aa7('0x31')](_0x1cfcde));return rp(_[_0x0aa7('0x8')](_0x1cfcde,{'method':_0x0aa7('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x5ce326,_0x3dc9d7){var _0x170f09=[];if(_0x5ce326&&_0x5ce326[_0x0aa7('0x21')]>0x0){_0x170f09=_['map'](_0x5ce326,_0x3dc9d7);}return _0x170f09;}function getCustomFields(_0x1544cf,_0x6db4d9){var _0xa0b8c6=[];var _0x3043f2={'custom_fields':[]};if(_0x1544cf['length']>0x0){_[_0x0aa7('0x33')](_0x1544cf,function(_0x31ffd0){if(_['includes'](['string',_0x0aa7('0x34')],_0x31ffd0[_0x0aa7('0x35')])&&_0x31ffd0[_0x0aa7('0x36')]&&!_0x31ffd0[_0x0aa7('0x37')]){_0x3043f2[_0x31ffd0[_0x0aa7('0x36')]['toLowerCase']()]=_0x31ffd0[_0x0aa7('0x38')][_0x0aa7('0x39')]();}else if(_[_0x0aa7('0x3a')](['string',_0x0aa7('0x34')],_0x31ffd0[_0x0aa7('0x35')])&&_0x31ffd0[_0x0aa7('0x3b')]&&_0x31ffd0['customField']){_0x3043f2['custom_fields'][_0x0aa7('0x3c')]({'id':_0x31ffd0[_0x0aa7('0x3b')],'value':_0x31ffd0[_0x0aa7('0x38')]['toString']()});}else if(_0x31ffd0['type']===_0x0aa7('0x3d')&&_0x31ffd0[_0x0aa7('0x3e')]&&_0x31ffd0[_0x0aa7('0x3b')]&&_0x31ffd0[_0x0aa7('0x37')]){_0x6db4d9[_0x31ffd0[_0x0aa7('0x3e')]]&&_0x3043f2[_0x0aa7('0x18')][_0x0aa7('0x3c')]({'id':_0x31ffd0[_0x0aa7('0x3b')],'value':_0x6db4d9[_0x31ffd0['variableName']]['toString']()});}else if(_0x31ffd0['type']==='customVariable'&&_0x31ffd0[_0x0aa7('0x3f')]&&_0x31ffd0[_0x0aa7('0x3f')]['name']&&_0x31ffd0['idField']&&_0x31ffd0[_0x0aa7('0x37')]){_0x6db4d9[_0x31ffd0[_0x0aa7('0x3f')]['name'][_0x0aa7('0x40')]()]&&_0x3043f2[_0x0aa7('0x18')][_0x0aa7('0x3c')]({'id':_0x31ffd0[_0x0aa7('0x3b')],'value':_0x6db4d9[_0x31ffd0[_0x0aa7('0x3f')][_0x0aa7('0x16')]['toLowerCase']()][_0x0aa7('0x39')]()});}});}return _0x3043f2;}exports[_0x0aa7('0x41')]=function(_0x578619,_0x4a92fa,_0x1b69d8,_0x51635b,_0x354aeb,_0x747ed4){var _0x4b8fe2,_0x49b9e7;_0x747ed4[_0x0aa7('0x1b')]=intUtil['stripTrailingSlash'](_0x747ed4[_0x0aa7('0x1b')]);_0x747ed4[_0x0aa7('0x42')]=intUtil['stripTrailingSlash'](_0x747ed4[_0x0aa7('0x42')]);if(_0x354aeb&&_0x354aeb[_0x0aa7('0x43')]){logger['info'](_0x0aa7('0x44'),_0x0aa7('0x45'));_0x4a92fa[_0x0aa7('0x46')]=util[_0x0aa7('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x747ed4[_0x0aa7('0x42')],_0x4a92fa[_0x0aa7('0x47')],md5(_0x4a92fa[_0x0aa7('0x47')]));}else{_0x4a92fa['recordingURL']='';}headers[_0x0aa7('0x48')]=getAuth(_0x747ed4);return getUser(_0x747ed4,_0x51635b[_0x0aa7('0x25')])[_0x0aa7('0x1d')](function(_0x1042e4){_0x4b8fe2=_0x1042e4;logger[_0x0aa7('0xd')](_0x0aa7('0x49'),_0x4b8fe2['id']);return getEndUser(_0x747ed4,_0x4a92fa[_0x0aa7('0x4a')],_0x4a92fa['calleridnum']);})[_0x0aa7('0x1d')](function(_0x2ab70f){_0x49b9e7=_0x2ab70f;logger[_0x0aa7('0xd')](_0x0aa7('0x4b'),_0x49b9e7['id']);return getTicket(_0x747ed4,_0x4b8fe2,_0x49b9e7,_0x1b69d8,_0x4a92fa);})[_0x0aa7('0x1d')](function(_0x2a91a8){if(_0x2a91a8&&_0x2a91a8['id']){logger[_0x0aa7('0xd')](_0x0aa7('0x1e'));logger['info'](_0x0aa7('0x4c'),_0x2a91a8['id']);logger[_0x0aa7('0xd')](_0x0aa7('0x44'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x0aa7('0x10')](_0x0aa7('0x4d'),_0x51635b[_0x0aa7('0x16')]),_0x0aa7('0x4e'),{'uri':util[_0x0aa7('0x10')](_0x0aa7('0x4f'),_0x747ed4[_0x0aa7('0x1b')],_0x2a91a8['id'])});}})[_0x0aa7('0x50')](function(_0x49b879){logger[_0x0aa7('0x51')](_0x0aa7('0x44'),JSON[_0x0aa7('0x31')](_0x49b879));});};exports[_0x0aa7('0x52')]=function(_0x3943f6,_0x4ad772,_0x483044,_0x474e40,_0x292027,_0x348e3f,_0x3513f7){var _0x4fa85b,_0x5d4463;_0x348e3f[_0x0aa7('0x1b')]=intUtil['stripTrailingSlash'](_0x348e3f[_0x0aa7('0x1b')]);_0x348e3f[_0x0aa7('0x42')]=intUtil['stripTrailingSlash'](_0x348e3f[_0x0aa7('0x42')]);if(_0x3513f7&&_0x3513f7[_0x0aa7('0x53')]&&_0x3513f7['recordingFormat']!==_0x0aa7('0x54')){logger[_0x0aa7('0xd')](_0x0aa7('0x55'),'Recording\x20is\x20enabled!');_0x4ad772['recordingURL']=util[_0x0aa7('0x10')](_0x0aa7('0x56'),_0x348e3f[_0x0aa7('0x42')],_0x4ad772[_0x0aa7('0x47')],md5(_0x4ad772[_0x0aa7('0x47')]));}headers[_0x0aa7('0x48')]=getAuth(_0x348e3f);return getUser(_0x348e3f,_0x474e40['email'])['then'](function(_0xa9cf5d){_0x4fa85b=_0xa9cf5d;logger['info'](_0x0aa7('0x49'),_0x4fa85b['id']);return getEndUser(_0x348e3f,_0x4ad772[_0x0aa7('0x57')],_0x4ad772[_0x0aa7('0x58')]);})[_0x0aa7('0x1d')](function(_0x162f5a){_0x5d4463=_0x162f5a;logger[_0x0aa7('0xd')](_0x0aa7('0x4b'),_0x5d4463['id']);return getTicket(_0x348e3f,_0x4fa85b,_0x5d4463,_0x483044,_0x4ad772);})[_0x0aa7('0x1d')](function(_0x3d2fa0){if(_0x3d2fa0&&_0x3d2fa0['id']){logger[_0x0aa7('0xd')](_0x0aa7('0x1e'));logger[_0x0aa7('0xd')]('The\x20Ticket\x20ID\x20is:',_0x3d2fa0['id']);logger['info'](_0x0aa7('0x55'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x0aa7('0x10')]('user:%s',_0x474e40[_0x0aa7('0x16')]),_0x0aa7('0x4e'),{'uri':util[_0x0aa7('0x10')]('%s/helpdesk/tickets/%d',_0x348e3f[_0x0aa7('0x1b')],_0x3d2fa0['id'])});}})[_0x0aa7('0x50')](function(_0x24d298){logger[_0x0aa7('0x51')](_0x0aa7('0x55'),JSON['stringify'](_0x24d298));});};exports[_0x0aa7('0x59')]=function(_0x2c18f7,_0x513529,_0x2a8691,_0x28002b,_0x4ba039,_0xbf8332){var _0x2634fb,_0x4838e4;_0xbf8332['remoteUri']=intUtil[_0x0aa7('0x5a')](_0xbf8332[_0x0aa7('0x1b')]);_0xbf8332[_0x0aa7('0x42')]=intUtil[_0x0aa7('0x5a')](_0xbf8332[_0x0aa7('0x42')]);if(_0x4ba039&&_0x4ba039[_0x0aa7('0x43')]){logger[_0x0aa7('0xd')]('['+_0x513529[_0x0aa7('0x5b')][_0x0aa7('0x5c')]()+']','Recording\x20is\x20enabled!');_0x513529[_0x0aa7('0x46')]=util[_0x0aa7('0x10')](_0x0aa7('0x56'),_0xbf8332['serverUrl'],_0x513529['uniqueid'],md5(_0x513529['uniqueid']));}else{_0x513529[_0x0aa7('0x46')]='';}headers[_0x0aa7('0x48')]=getAuth(_0xbf8332);return getUser(_0xbf8332,'')[_0x0aa7('0x1d')](function(_0x3fc74c){_0x2634fb=_0x3fc74c;logger[_0x0aa7('0xd')]('The\x20User\x20ID\x20is:',_0x2634fb['id']);return getEndUser(_0xbf8332,_0x513529[_0x0aa7('0x4a')],_0x513529[_0x0aa7('0x12')]);})['then'](function(_0x2cc0e0){_0x4838e4=_0x2cc0e0;logger[_0x0aa7('0xd')](_0x0aa7('0x4b'),_0x4838e4['id']);return getTicket(_0xbf8332,_0x2634fb,_0x4838e4,_0x2a8691,_0x513529);})[_0x0aa7('0x1d')](function(_0xce4a8e){if(_0xce4a8e){logger['info']('Ticket\x20created!');logger[_0x0aa7('0xd')]('The\x20Ticket\x20ID\x20is:',_0xce4a8e['id']);}})[_0x0aa7('0x50')](function(_0x2db545){logger[_0x0aa7('0x51')]('['+_0x513529['lastevent'][_0x0aa7('0x5c')]()+']',JSON[_0x0aa7('0x31')](_0x2db545));});}; \ 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 cbb3fdf..422b8df 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 _0x9578=['redis','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','userId','User\x20found:','Admin\x20selected','userEmail','message','&f=','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20created:','POST','format','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','ticketId','task','Task\x20created:','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','callDirection','queue','unmanaged','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','lodash','request-promise','md5','util','moment','ioredis','./util','freshsales','defaults','socket.io-emitter'];(function(_0x1557ff,_0x356742){var _0x4121e9=function(_0x5c81cb){while(--_0x5c81cb){_0x1557ff['push'](_0x1557ff['shift']());}};_0x4121e9(++_0x356742);}(_0x9578,0x195));var _0x8957=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x9578[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x8957('0x0'));var rp=require(_0x8957('0x1'));var md5=require(_0x8957('0x2'));var util=require(_0x8957('0x3'));var moment=require(_0x8957('0x4'));var Promise=require('bluebird');var Redis=require(_0x8957('0x5'));var intUtil=require(_0x8957('0x6'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x8957('0x7'));config['redis']=_[_0x8957('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x8957('0x9'))(new Redis(config[_0x8957('0xa')]));function getAdminId(_0x36c663,_0x254391,_0x31e978,_0x34a569){return new Promise(function(_0x3f4359,_0x1042ab){var _0x1ee5b5=![];var _0x2a994e={'method':_0x8957('0xb'),'uri':_0x34a569+_0x8957('0xc'),'json':!![]};_0x2a994e[_0x8957('0xd')]=_0x31e978;logger[_0x8957('0xe')](_0x8957('0xf'));return rp(_0x2a994e)[_0x8957('0x10')](function(_0x1a213e){if(_0x1a213e){var _0x442163=_0x1a213e[_0x8957('0x11')];var _0x420166=null;for(_0x420166=0x0;_0x420166<_0x442163[_0x8957('0x12')];_0x420166++){if(_0x442163[_0x420166][_0x8957('0x13')]===_0x36c663[_0x8957('0x14')]){_0x36c663[_0x8957('0x15')]=_0x442163[_0x420166]['id'];_0x1ee5b5=!![];}}if(_0x1ee5b5){logger['info'](_0x8957('0x16'),_0x36c663['adminId']);_0x3f4359(_0x36c663);}else{_0x1042ab({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x1042ab({'statusCode':0x194,'message':_0x8957('0x17')});}})[_0x8957('0x18')](function(_0x4c7c61){logger[_0x8957('0x19')]('['+[_0x254391[_0x8957('0x1a')]()]+']',_0x4c7c61['message']);_0x1042ab(_0x4c7c61);});});}function getUser(_0x3cb8c3,_0x3e37ed,_0x19db99){return function(_0x4c778e){return new Promise(function(_0x4792dd,_0x213137){var _0x565304={'method':'GET','uri':_0x19db99+_0x8957('0xc'),'json':!![]};_0x565304[_0x8957('0xd')]=_0x3e37ed;logger['info'](_0x8957('0x1b'));return rp(_0x565304)[_0x8957('0x10')](function(_0xae4e13){if(_0xae4e13){var _0x2dbefa=_0xae4e13[_0x8957('0x11')];var _0xa7d59a=![];var _0xfc151d=null;if(_0x4c778e['agentEmail']!==null){logger[_0x8957('0xe')](_0x8957('0x1c'),_0x4c778e['agentEmail']);_0x4c778e['userEmail']=_0x4c778e['agentEmail'];for(_0xfc151d=0x0;_0xfc151d<_0x2dbefa['length'];_0xfc151d++){if(_0x2dbefa[_0xfc151d][_0x8957('0x13')]===_0x4c778e[_0x8957('0x1d')]){_0xa7d59a=!![];_0x4c778e[_0x8957('0x1e')]=_0x2dbefa[_0xfc151d]['id'];logger[_0x8957('0xe')](_0x8957('0x1f'),_0x4c778e[_0x8957('0x1e')]);}}}if(!_0xa7d59a){logger[_0x8957('0xe')](_0x8957('0x20'));_0x4c778e[_0x8957('0x21')]=_0x4c778e['adminEmail'];_0x4c778e[_0x8957('0x1e')]=_0x4c778e['adminId'];_0xa7d59a=!![];}if(_0xa7d59a){_0x4792dd(_0x4c778e);}else{_0x213137({'statusCode':0x194,'message':_0x8957('0x17')});}}else{_0x213137({'statusCode':0x194,'message':_0x8957('0x17')});}})[_0x8957('0x18')](function(_0x282a2d){logger['error']('['+[_0x3cb8c3['toUpperCase']()]+']',_0x282a2d[_0x8957('0x22')]);_0x213137(_0x282a2d);});});};}function searchContact(_0x505421,_0x5809ca,_0x522862,_0x490571){return new Promise(function(_0x1d9886,_0x35ba2e){var _0x282df3={'method':_0x8957('0xb'),'headers':_0x5809ca,'uri':_0x505421+'/api/lookup?q='+_0x490571+_0x8957('0x23')+_0x522862+'&entities=contact','json':!![]};rp(_0x282df3)[_0x8957('0x10')](function(_0x386c54){var _0x7e1585=_[_0x8957('0x24')](_0x386c54[_0x8957('0x25')][_0x8957('0x25')],[_0x522862,_0x490571]);_0x1d9886(_0x7e1585);})[_0x8957('0x18')](function(_0x4945ab){_0x35ba2e(_0x4945ab);});});}function getEndUser(_0xe30422,_0x59e812,_0x4ebb60){return function(_0x248dfa){return new Promise(function(_0x4403de,_0x4929a2){logger[_0x8957('0xe')](util['format'](_0x8957('0x26'),_0x248dfa[_0x8957('0x27')]));searchContact(_0x4ebb60,_0x59e812,_0x8957('0x28'),_0x248dfa[_0x8957('0x27')])[_0x8957('0x10')](function(_0x243d1d){if(_0x243d1d){_0x248dfa[_0x8957('0x29')]=_0x243d1d['id'];logger[_0x8957('0xe')](_0x8957('0x2a'),_0x248dfa[_0x8957('0x29')]);return _0x4403de(_0x248dfa);}searchContact(_0x4ebb60,_0x59e812,_0x8957('0x2b'),_0x248dfa[_0x8957('0x27')])[_0x8957('0x10')](function(_0x25678f){if(_0x25678f){_0x248dfa[_0x8957('0x29')]=_0x25678f['id'];logger[_0x8957('0xe')]('Contact\x20found\x20work_number:',_0x248dfa[_0x8957('0x29')]);return _0x4403de(_0x248dfa);}createEndUser(_0x248dfa,_0xe30422,_0x59e812,_0x4ebb60)[_0x8957('0x10')](function(_0x195605){logger[_0x8957('0xe')](_0x8957('0x2c'),_0x195605[_0x8957('0x29')]);return _0x4403de(_0x195605);});});})[_0x8957('0x18')](function(_0x425cae){_0x4929a2(_0x425cae);});});};}function createEndUser(_0x49152b,_0xec2d04,_0xee9adc,_0x1bb7c3){return new Promise(function(_0x2a3e33,_0x563c30){var _0x39fa2d=moment();var _0x52f8a9={'method':_0x8957('0x2d'),'uri':_0x1bb7c3+'/api/contacts','body':{'contact':{'last_name':_0x49152b[_0x8957('0x27')],'work_number':_0x49152b[_0x8957('0x27')],'mobile_number':_0x49152b[_0x8957('0x27')],'owner_id':_0x49152b[_0x8957('0x1e')],'created_at':_0x39fa2d[_0x8957('0x2e')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x52f8a9['headers']=_0xee9adc;logger[_0x8957('0xe')](_0x8957('0x2f'));return rp(_0x52f8a9)['then'](function(_0x5399c5){_0x49152b['endUserId']=_0x5399c5[_0x8957('0x30')]['id'];_0x2a3e33(_0x49152b);})[_0x8957('0x18')](function(_0x4e25d9){logger[_0x8957('0x19')]('['+[_0xec2d04['toUpperCase']()]+']',_0x4e25d9[_0x8957('0x22')]);_0x563c30(_0x4e25d9['message']);});});}function getTicket(_0x44acc6,_0x27ba2d,_0x27b462,_0x420617,_0x20e579){return function(_0x7d0176){logger['info'](_0x8957('0x31'));return new Promise(function(_0x365bba,_0x1b4d4b){var _0x1b94d7=moment();var _0x5f2ffb={'method':'POST','uri':_0x27b462+_0x8957('0x32'),'body':{'title':intUtil[_0x8957('0x33')](_0x420617[_0x8957('0x34')],_0x20e579,'\x20'),'description':intUtil[_0x8957('0x33')](_0x420617[_0x8957('0x35')],_0x20e579,'\x0a'),'owner_id':_0x7d0176['userId'],'creater_id':_0x7d0176['adminId'],'targetable_id':_0x7d0176['endUserId'],'targetable_type':_0x8957('0x36'),'created_at':_0x1b94d7[_0x8957('0x2e')](_0x8957('0x37')),'due_date':_0x1b94d7['add'](0x1e,'m')[_0x8957('0x2e')](_0x8957('0x37'))},'json':!![]};_0x5f2ffb[_0x8957('0xd')]=_0x27ba2d;return rp(_0x5f2ffb)['then'](function(_0x795e67){_0x7d0176[_0x8957('0x38')]=_0x795e67[_0x8957('0x39')]['id'];logger[_0x8957('0xe')](_0x8957('0x3a'),_0x7d0176[_0x8957('0x38')]);_0x365bba(_0x7d0176);})[_0x8957('0x18')](function(_0x52df32){logger[_0x8957('0x19')]('['+[_0x44acc6[_0x8957('0x1a')]()]+']',_0x52df32[_0x8957('0x22')]);_0x1b4d4b(_0x52df32['message']);});});};}function emit(_0x2d88f7,_0x58236a,_0x492a56){var _0x6c440c={'uri':_0x2d88f7+'/contacts/'+_0x492a56};io['to'](util[_0x8957('0x2e')](_0x8957('0x3b'),_0x58236a))[_0x8957('0x3c')](_0x8957('0x3d'),_0x6c440c);}exports['cs']=function(_0x493ad7,_0x48b855,_0x184d10,_0x454748,_0x464e1f,_0x1d7708,_0x1d4e72,_0x41e407){var _0x29207f={};var _0x3efea3={'Authorization':_0x8957('0x3e')+_0x1d7708[_0x8957('0x3f')]};_0x1d7708[_0x8957('0x40')]=intUtil[_0x8957('0x41')](_0x1d7708[_0x8957('0x40')]);_0x1d7708[_0x8957('0x42')]=intUtil[_0x8957('0x41')](_0x1d7708[_0x8957('0x42')]);var _0x527e94=_0x1d7708[_0x8957('0x40')];_0x29207f[_0x8957('0x14')]=_0x1d7708[_0x8957('0x43')];_0x29207f[_0x8957('0x27')]=_0x41e407[_0x8957('0x44')]()===_0x8957('0x45')?_0x48b855[_0x8957('0x46')]:_0x48b855['calleridnum'];_0x29207f[_0x8957('0x47')]=_0x41e407===_0x8957('0x48')||_0x41e407===_0x8957('0x49')?_0x8957('0x48'):_0x8957('0x45');if(_0x454748){_0x29207f[_0x8957('0x1d')]=_0x454748[_0x8957('0x13')];}var _0x4be53f=util[_0x8957('0x2e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1d7708['serverUrl'],_0x48b855[_0x8957('0x4a')],md5(_0x48b855[_0x8957('0x4a')]));if(_0x464e1f&&_0x464e1f['monitor_format']){logger[_0x8957('0xe')](_0x8957('0x4b'),_0x8957('0x4c'));_0x48b855['recordingURL']=_0x4be53f;}else if(_0x1d4e72&&_0x1d4e72[_0x8957('0x4d')]&&_0x1d4e72['recordingFormat']!==_0x8957('0x4e')){logger['info'](_0x8957('0x4f'),_0x8957('0x4c'));_0x48b855['recordingURL']=_0x4be53f;}else{_0x48b855['recordingURL']='';}return getAdminId(_0x29207f,_0x41e407,_0x3efea3,_0x527e94)['then'](getUser(_0x41e407,_0x3efea3,_0x527e94))[_0x8957('0x10')](getEndUser(_0x41e407,_0x3efea3,_0x527e94))[_0x8957('0x10')](getTicket(_0x41e407,_0x3efea3,_0x527e94,_0x184d10,_0x48b855))[_0x8957('0x10')](function(_0x43b106){logger['info'](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x43b106[_0x8957('0x38')]));if(_0x41e407!=='unmanaged'){logger[_0x8957('0xe')]('['+[_0x41e407[_0x8957('0x1a')]()]+']',_0x8957('0x50'));emit(_0x527e94,_0x454748[_0x8957('0x51')],_0x43b106[_0x8957('0x29')]);}})[_0x8957('0x18')](function(_0x34c9f9){logger['error']('['+[_0x41e407[_0x8957('0x1a')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x8957('0x52')](_0x34c9f9,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x47ef=['calleridnum','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','GET','/api/selector/owners','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','/api/lookup?q=','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','headers','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','Subjects','getString','Descriptions','Contact','ticketId','task','Task\x20created:','/contacts/','emit','trigger:browser:url','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','outbound','destcalleridnum'];(function(_0x387dc1,_0x3ba649){var _0x17567c=function(_0x4690aa){while(--_0x4690aa){_0x387dc1['push'](_0x387dc1['shift']());}};_0x17567c(++_0x3ba649);}(_0x47ef,0x1b8));var _0xf47e=function(_0x95e39f,_0x5eb1b){_0x95e39f=_0x95e39f-0x0;var _0x35d677=_0x47ef[_0x95e39f];return _0x35d677;};'use strict';var _=require(_0xf47e('0x0'));var rp=require(_0xf47e('0x1'));var md5=require(_0xf47e('0x2'));var util=require('util');var moment=require(_0xf47e('0x3'));var Promise=require(_0xf47e('0x4'));var Redis=require(_0xf47e('0x5'));var intUtil=require(_0xf47e('0x6'));var config=require(_0xf47e('0x7'));var logger=require(_0xf47e('0x8'))('freshsales');config[_0xf47e('0x9')]=_[_0xf47e('0xa')](config[_0xf47e('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xf47e('0xb'))(new Redis(config[_0xf47e('0x9')]));function getAdminId(_0x1349a1,_0x110aeb,_0x3f11a6,_0x55822d){return new Promise(function(_0x4cecc2,_0x5a4978){var _0x394736=![];var _0x45058b={'method':_0xf47e('0xc'),'uri':_0x55822d+_0xf47e('0xd'),'json':!![]};_0x45058b['headers']=_0x3f11a6;logger[_0xf47e('0xe')](_0xf47e('0xf'));return rp(_0x45058b)[_0xf47e('0x10')](function(_0x818e97){if(_0x818e97){var _0x2ca24c=_0x818e97[_0xf47e('0x11')];var _0x4293ce=null;for(_0x4293ce=0x0;_0x4293ce<_0x2ca24c[_0xf47e('0x12')];_0x4293ce++){if(_0x2ca24c[_0x4293ce][_0xf47e('0x13')]===_0x1349a1[_0xf47e('0x14')]){_0x1349a1['adminId']=_0x2ca24c[_0x4293ce]['id'];_0x394736=!![];}}if(_0x394736){logger[_0xf47e('0xe')](_0xf47e('0x15'),_0x1349a1[_0xf47e('0x16')]);_0x4cecc2(_0x1349a1);}else{_0x5a4978({'statusCode':0x194,'message':_0xf47e('0x17')});}}else{_0x5a4978({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xf47e('0x18')](function(_0x3b5e13){logger[_0xf47e('0x19')]('['+[_0x110aeb[_0xf47e('0x1a')]()]+']',_0x3b5e13[_0xf47e('0x1b')]);_0x5a4978(_0x3b5e13);});});}function getUser(_0x2c5fab,_0x16ecf5,_0xaa8a){return function(_0x1861ef){return new Promise(function(_0x5bec48,_0x23b182){var _0x307406={'method':_0xf47e('0xc'),'uri':_0xaa8a+_0xf47e('0xd'),'json':!![]};_0x307406['headers']=_0x16ecf5;logger[_0xf47e('0xe')](_0xf47e('0x1c'));return rp(_0x307406)[_0xf47e('0x10')](function(_0x10075a){if(_0x10075a){var _0x3e1018=_0x10075a['users'];var _0x44c2f4=![];var _0x396cae=null;if(_0x1861ef[_0xf47e('0x1d')]!==null){logger[_0xf47e('0xe')](_0xf47e('0x1e'),_0x1861ef[_0xf47e('0x1d')]);_0x1861ef[_0xf47e('0x1f')]=_0x1861ef['agentEmail'];for(_0x396cae=0x0;_0x396cae<_0x3e1018[_0xf47e('0x12')];_0x396cae++){if(_0x3e1018[_0x396cae][_0xf47e('0x13')]===_0x1861ef[_0xf47e('0x1d')]){_0x44c2f4=!![];_0x1861ef[_0xf47e('0x20')]=_0x3e1018[_0x396cae]['id'];logger[_0xf47e('0xe')](_0xf47e('0x21'),_0x1861ef[_0xf47e('0x20')]);}}}if(!_0x44c2f4){logger[_0xf47e('0xe')](_0xf47e('0x22'));_0x1861ef[_0xf47e('0x1f')]=_0x1861ef['adminEmail'];_0x1861ef[_0xf47e('0x20')]=_0x1861ef[_0xf47e('0x16')];_0x44c2f4=!![];}if(_0x44c2f4){_0x5bec48(_0x1861ef);}else{_0x23b182({'statusCode':0x194,'message':_0xf47e('0x17')});}}else{_0x23b182({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xf47e('0x18')](function(_0x2c977e){logger[_0xf47e('0x19')]('['+[_0x2c5fab[_0xf47e('0x1a')]()]+']',_0x2c977e[_0xf47e('0x1b')]);_0x23b182(_0x2c977e);});});};}function searchContact(_0x58674f,_0x4baf62,_0x357747,_0x2c48f4){return new Promise(function(_0x24c7ba,_0x5991d3){var _0x48ab01={'method':'GET','headers':_0x4baf62,'uri':_0x58674f+_0xf47e('0x23')+_0x2c48f4+_0xf47e('0x24')+_0x357747+_0xf47e('0x25'),'json':!![]};rp(_0x48ab01)[_0xf47e('0x10')](function(_0x42317a){var _0x4f0d30=_[_0xf47e('0x26')](_0x42317a[_0xf47e('0x27')][_0xf47e('0x27')],[_0x357747,_0x2c48f4]);_0x24c7ba(_0x4f0d30);})[_0xf47e('0x18')](function(_0x216162){_0x5991d3(_0x216162);});});}function getEndUser(_0x193bff,_0x3f4e6f,_0x1d9f6d){return function(_0x1f4006){return new Promise(function(_0x20307e,_0x16d280){logger[_0xf47e('0xe')](util['format'](_0xf47e('0x28'),_0x1f4006[_0xf47e('0x29')]));searchContact(_0x1d9f6d,_0x3f4e6f,'mobile_number',_0x1f4006[_0xf47e('0x29')])[_0xf47e('0x10')](function(_0x2d90b){if(_0x2d90b){_0x1f4006[_0xf47e('0x2a')]=_0x2d90b['id'];logger[_0xf47e('0xe')](_0xf47e('0x2b'),_0x1f4006[_0xf47e('0x2a')]);return _0x20307e(_0x1f4006);}searchContact(_0x1d9f6d,_0x3f4e6f,'work_number',_0x1f4006[_0xf47e('0x29')])['then'](function(_0x5429aa){if(_0x5429aa){_0x1f4006['endUserId']=_0x5429aa['id'];logger[_0xf47e('0xe')](_0xf47e('0x2c'),_0x1f4006[_0xf47e('0x2a')]);return _0x20307e(_0x1f4006);}createEndUser(_0x1f4006,_0x193bff,_0x3f4e6f,_0x1d9f6d)['then'](function(_0x3fddb7){logger[_0xf47e('0xe')]('Contact\x20created:',_0x3fddb7[_0xf47e('0x2a')]);return _0x20307e(_0x3fddb7);});});})[_0xf47e('0x18')](function(_0x116460){_0x16d280(_0x116460);});});};}function createEndUser(_0x53093a,_0x1309e0,_0x4c5926,_0x4ea047){return new Promise(function(_0x3100f8,_0x2527e6){var _0x2eb316=moment();var _0x357105={'method':_0xf47e('0x2d'),'uri':_0x4ea047+_0xf47e('0x2e'),'body':{'contact':{'last_name':_0x53093a['contactNumber'],'work_number':_0x53093a[_0xf47e('0x29')],'mobile_number':_0x53093a[_0xf47e('0x29')],'owner_id':_0x53093a[_0xf47e('0x20')],'created_at':_0x2eb316[_0xf47e('0x2f')](_0xf47e('0x30'))}},'json':!![]};_0x357105[_0xf47e('0x31')]=_0x4c5926;logger[_0xf47e('0xe')](_0xf47e('0x32'));return rp(_0x357105)['then'](function(_0x1e6b7d){_0x53093a[_0xf47e('0x2a')]=_0x1e6b7d[_0xf47e('0x33')]['id'];_0x3100f8(_0x53093a);})[_0xf47e('0x18')](function(_0x3c27ba){logger['error']('['+[_0x1309e0['toUpperCase']()]+']',_0x3c27ba['message']);_0x2527e6(_0x3c27ba[_0xf47e('0x1b')]);});});}function getTicket(_0x1755eb,_0x32445c,_0x29ede5,_0x4cd0b2,_0x1be278){return function(_0x460465){logger[_0xf47e('0xe')](_0xf47e('0x34'));return new Promise(function(_0x4da214,_0xe06f77){var _0x11f6ae=moment();var _0x1da690={'method':_0xf47e('0x2d'),'uri':_0x29ede5+'/api/tasks','body':{'title':intUtil['getString'](_0x4cd0b2[_0xf47e('0x35')],_0x1be278,'\x20'),'description':intUtil[_0xf47e('0x36')](_0x4cd0b2[_0xf47e('0x37')],_0x1be278,'\x0a'),'owner_id':_0x460465[_0xf47e('0x20')],'creater_id':_0x460465[_0xf47e('0x16')],'targetable_id':_0x460465[_0xf47e('0x2a')],'targetable_type':_0xf47e('0x38'),'created_at':_0x11f6ae[_0xf47e('0x2f')](_0xf47e('0x30')),'due_date':_0x11f6ae['add'](0x1e,'m')[_0xf47e('0x2f')](_0xf47e('0x30'))},'json':!![]};_0x1da690[_0xf47e('0x31')]=_0x32445c;return rp(_0x1da690)[_0xf47e('0x10')](function(_0x19812b){_0x460465[_0xf47e('0x39')]=_0x19812b[_0xf47e('0x3a')]['id'];logger[_0xf47e('0xe')](_0xf47e('0x3b'),_0x460465[_0xf47e('0x39')]);_0x4da214(_0x460465);})['catch'](function(_0x19bb06){logger[_0xf47e('0x19')]('['+[_0x1755eb[_0xf47e('0x1a')]()]+']',_0x19bb06['message']);_0xe06f77(_0x19bb06[_0xf47e('0x1b')]);});});};}function emit(_0xfe7261,_0x26f532,_0x53f8ab){var _0x15153e={'uri':_0xfe7261+_0xf47e('0x3c')+_0x53f8ab};io['to'](util[_0xf47e('0x2f')]('user:%s',_0x26f532))[_0xf47e('0x3d')](_0xf47e('0x3e'),_0x15153e);}exports['cs']=function(_0x2e408b,_0x363386,_0x127bc7,_0x5d363c,_0x276a29,_0x2c3d0a,_0x4f1026,_0x342d55){var _0x2c5840={};var _0x4fb192={'Authorization':'Token\x20token='+_0x2c3d0a[_0xf47e('0x3f')]};_0x2c3d0a['remoteUri']=intUtil[_0xf47e('0x40')](_0x2c3d0a[_0xf47e('0x41')]);_0x2c3d0a['serverUrl']=intUtil[_0xf47e('0x40')](_0x2c3d0a[_0xf47e('0x42')]);var _0x5cb7c9=_0x2c3d0a[_0xf47e('0x41')];_0x2c5840[_0xf47e('0x14')]=_0x2c3d0a[_0xf47e('0x43')];_0x2c5840[_0xf47e('0x29')]=_0x342d55['toLowerCase']()===_0xf47e('0x44')?_0x363386[_0xf47e('0x45')]:_0x363386[_0xf47e('0x46')];_0x2c5840['callDirection']=_0x342d55==='queue'||_0x342d55===_0xf47e('0x47')?'queue':_0xf47e('0x44');if(_0x5d363c){_0x2c5840['agentEmail']=_0x5d363c[_0xf47e('0x13')];}var _0x264080=util[_0xf47e('0x2f')](_0xf47e('0x48'),_0x2c3d0a[_0xf47e('0x42')],_0x363386[_0xf47e('0x49')],md5(_0x363386[_0xf47e('0x49')]));if(_0x276a29&&_0x276a29[_0xf47e('0x4a')]){logger[_0xf47e('0xe')](_0xf47e('0x4b'),_0xf47e('0x4c'));_0x363386[_0xf47e('0x4d')]=_0x264080;}else if(_0x4f1026&&_0x4f1026[_0xf47e('0x4e')]&&_0x4f1026['recordingFormat']!==_0xf47e('0x4f')){logger[_0xf47e('0xe')](_0xf47e('0x50'),_0xf47e('0x4c'));_0x363386[_0xf47e('0x4d')]=_0x264080;}else{_0x363386[_0xf47e('0x4d')]='';}return getAdminId(_0x2c5840,_0x342d55,_0x4fb192,_0x5cb7c9)[_0xf47e('0x10')](getUser(_0x342d55,_0x4fb192,_0x5cb7c9))['then'](getEndUser(_0x342d55,_0x4fb192,_0x5cb7c9))[_0xf47e('0x10')](getTicket(_0x342d55,_0x4fb192,_0x5cb7c9,_0x127bc7,_0x363386))[_0xf47e('0x10')](function(_0x50e429){logger[_0xf47e('0xe')](util[_0xf47e('0x2f')]('The\x20ticket\x20ID\x20is:\x20%s',_0x50e429[_0xf47e('0x39')]));if(_0x342d55!==_0xf47e('0x47')){logger[_0xf47e('0xe')]('['+[_0x342d55[_0xf47e('0x1a')]()]+']',_0xf47e('0x51'));emit(_0x5cb7c9,_0x5d363c[_0xf47e('0x52')],_0x50e429['endUserId']);}})[_0xf47e('0x18')](function(_0x4d241b){logger[_0xf47e('0x19')]('['+[_0x342d55[_0xf47e('0x1a')]()]+_0xf47e('0x53'),util[_0xf47e('0x54')](_0x4d241b,{'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 2f50d83..14ed1e3 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 _0x6154=['../../../../config/logger','error','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','data2','lodash','./zendesk','./sugarcrm','./freshdesk','./desk','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','freshsales','servicenow','exec','includes','data1','toLowerCase','find','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','desk','vtiger','unknown\x20integration'];(function(_0x18b5e8,_0x51e875){var _0x25baed=function(_0x3fcdf9){while(--_0x3fcdf9){_0x18b5e8['push'](_0x18b5e8['shift']());}};_0x25baed(++_0x51e875);}(_0x6154,0xd8));var _0x4615=function(_0x5d7fde,_0x4fb4d3){_0x5d7fde=_0x5d7fde-0x0;var _0x2db55f=_0x6154[_0x5d7fde];return _0x2db55f;};'use strict';var _=require(_0x4615('0x0'));var util=require('util');var zendesk=require(_0x4615('0x1'));var salesforce=require('./salesforce');var sugarcrm=require(_0x4615('0x2'));var freshdesk=require(_0x4615('0x3'));var zoho=require('./zoho');var desk=require(_0x4615('0x4'));var vtiger=require('./vtiger');var servicenow=require(_0x4615('0x5'));var dynamics365=require(_0x4615('0x6'));var freshsales=require(_0x4615('0x7'));var integrations=[_0x4615('0x8'),_0x4615('0x9'),_0x4615('0xa'),_0x4615('0xb'),_0x4615('0xc'),'desk','vtiger','dynamics365',_0x4615('0xd'),_0x4615('0xe')];exports[_0x4615('0xf')]=function(_0x3533d8,_0x2fe345,_0x355bad,_0x4c358c,_0x4e2085,_0x5e9b41){if(_0x355bad){if(_[_0x4615('0x10')](integrations,_0x3533d8[_0x4615('0x11')]['toLowerCase']())){try{var _0x26a0b1=null;var _0x132d3e='';var _0x19a051=_0x355bad[_0x3533d8[_0x4615('0x11')][_0x4615('0x12')]()];if(_0x19a051){var _0x1f17e4=_0x19a051[_0x3533d8['data2']];if(_0x1f17e4){var _0x30c3a0=_[_0x4615('0x13')](_0x1f17e4['Configurations'],{'id':parseInt(_0x3533d8[_0x4615('0x14')],0xa)});if(_0x30c3a0){if(_0x4c358c){if(_0x4e2085&&_0x2fe345[_0x4615('0x15')]){_0x132d3e=_0x4615('0x15');}else if(_0x2fe345[_0x4615('0x16')]){_0x132d3e=_0x4615('0x17');}else{console[_0x4615('0x18')](_0x4615('0x19'),_0x2fe345);}}else{_0x132d3e='unmanaged';}switch(_0x3533d8[_0x4615('0x11')][_0x4615('0x12')]()){case _0x4615('0x8'):zendesk[_0x132d3e](_0x3533d8,_0x2fe345,_0x30c3a0,_0x4c358c,_0x4e2085,_0x1f17e4,_0x5e9b41);break;case _0x4615('0x9'):salesforce[_0x132d3e](_0x3533d8,_0x2fe345,_0x30c3a0,_0x4c358c,_0x4e2085,_0x1f17e4,_0x5e9b41);break;case'sugarcrm':sugarcrm[_0x132d3e](_0x3533d8,_0x2fe345,_0x30c3a0,_0x4c358c,_0x4e2085,_0x1f17e4,_0x5e9b41);break;case _0x4615('0xb'):freshdesk[_0x132d3e](_0x3533d8,_0x2fe345,_0x30c3a0,_0x4c358c,_0x4e2085,_0x1f17e4,_0x5e9b41);break;case'zoho':zoho[_0x132d3e](_0x3533d8,_0x2fe345,_0x30c3a0,_0x4c358c,_0x4e2085,_0x1f17e4,_0x5e9b41);break;case _0x4615('0x1a'):desk[_0x132d3e](_0x3533d8,_0x2fe345,_0x30c3a0,_0x4c358c,_0x4e2085,_0x1f17e4,_0x5e9b41);break;case _0x4615('0x1b'):vtiger[_0x132d3e](_0x3533d8,_0x2fe345,_0x30c3a0,_0x4c358c,_0x4e2085,_0x1f17e4,_0x5e9b41);break;case _0x4615('0xd'):freshsales['cs'](_0x3533d8,_0x2fe345,_0x30c3a0,_0x4c358c,_0x4e2085,_0x1f17e4,_0x5e9b41,_0x132d3e);break;case _0x4615('0xe'):servicenow['cs'](_0x3533d8,_0x2fe345,_0x30c3a0,_0x4c358c,_0x4e2085,_0x1f17e4,_0x5e9b41,_0x132d3e);break;case'dynamics365':dynamics365['cs'](_0x3533d8,_0x2fe345,_0x30c3a0,_0x4c358c,_0x4e2085,_0x1f17e4,_0x5e9b41,_0x132d3e);break;default:console[_0x4615('0x18')](_0x4615('0x1c'));}}else{_0x26a0b1=require(_0x4615('0x1d'))(_0x3533d8[_0x4615('0x11')][_0x4615('0x12')]());_0x26a0b1[_0x4615('0x1e')](_0x4615('0x1f'),util[_0x4615('0x20')]('%s\x20configuration\x20#%s\x20not\x20found',_0x3533d8[_0x4615('0x11')][_0x4615('0x12')](),_0x3533d8[_0x4615('0x14')]));}}else{_0x26a0b1=require(_0x4615('0x1d'))(_0x3533d8[_0x4615('0x11')][_0x4615('0x12')]());_0x26a0b1[_0x4615('0x1e')](_0x4615('0x1f'),util[_0x4615('0x20')](_0x4615('0x21'),_0x3533d8[_0x4615('0x11')][_0x4615('0x12')](),_0x3533d8[_0x4615('0x22')]));}}else{}}catch(_0x584cfe){console[_0x4615('0x1e')](_0x584cfe);}}}}; \ No newline at end of file +var _0xc216=['routeId','outbound','EVENT\x20UNKNOWN','unmanaged','zoho','servicenow','log','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','desk','vtiger','dynamics365','freshsales','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue'];(function(_0x2b4ffa,_0x22384c){var _0xa263ab=function(_0x3f7fb1){while(--_0x3f7fb1){_0x2b4ffa['push'](_0x2b4ffa['shift']());}};_0xa263ab(++_0x22384c);}(_0xc216,0x15d));var _0x6c21=function(_0x1bbc08,_0x444008){_0x1bbc08=_0x1bbc08-0x0;var _0x5d825b=_0xc216[_0x1bbc08];return _0x5d825b;};'use strict';var _=require(_0x6c21('0x0'));var util=require(_0x6c21('0x1'));var zendesk=require(_0x6c21('0x2'));var salesforce=require(_0x6c21('0x3'));var sugarcrm=require(_0x6c21('0x4'));var freshdesk=require(_0x6c21('0x5'));var zoho=require(_0x6c21('0x6'));var desk=require(_0x6c21('0x7'));var vtiger=require(_0x6c21('0x8'));var servicenow=require(_0x6c21('0x9'));var dynamics365=require(_0x6c21('0xa'));var freshsales=require(_0x6c21('0xb'));var integrations=[_0x6c21('0xc'),_0x6c21('0xd'),_0x6c21('0xe'),_0x6c21('0xf'),'zoho',_0x6c21('0x10'),_0x6c21('0x11'),_0x6c21('0x12'),_0x6c21('0x13'),'servicenow'];exports[_0x6c21('0x14')]=function(_0x34aa63,_0x757e4b,_0x37f1af,_0x3b555a,_0x4bd57e,_0x425178){if(_0x37f1af){if(_[_0x6c21('0x15')](integrations,_0x34aa63[_0x6c21('0x16')][_0x6c21('0x17')]())){try{var _0x4d1e57=null;var _0x1b46b3='';var _0x784b0d=_0x37f1af[_0x34aa63[_0x6c21('0x16')]['toLowerCase']()];if(_0x784b0d){var _0x35d527=_0x784b0d[_0x34aa63[_0x6c21('0x18')]];if(_0x35d527){var _0x15dc90=_[_0x6c21('0x19')](_0x35d527[_0x6c21('0x1a')],{'id':parseInt(_0x34aa63[_0x6c21('0x1b')],0xa)});if(_0x15dc90){if(_0x3b555a){if(_0x4bd57e&&_0x757e4b[_0x6c21('0x1c')]){_0x1b46b3=_0x6c21('0x1c');}else if(_0x757e4b[_0x6c21('0x1d')]){_0x1b46b3=_0x6c21('0x1e');}else{console['log'](_0x6c21('0x1f'),_0x757e4b);}}else{_0x1b46b3=_0x6c21('0x20');}switch(_0x34aa63[_0x6c21('0x16')]['toLowerCase']()){case'zendesk':zendesk[_0x1b46b3](_0x34aa63,_0x757e4b,_0x15dc90,_0x3b555a,_0x4bd57e,_0x35d527,_0x425178);break;case _0x6c21('0xd'):salesforce[_0x1b46b3](_0x34aa63,_0x757e4b,_0x15dc90,_0x3b555a,_0x4bd57e,_0x35d527,_0x425178);break;case _0x6c21('0xe'):sugarcrm[_0x1b46b3](_0x34aa63,_0x757e4b,_0x15dc90,_0x3b555a,_0x4bd57e,_0x35d527,_0x425178);break;case _0x6c21('0xf'):freshdesk[_0x1b46b3](_0x34aa63,_0x757e4b,_0x15dc90,_0x3b555a,_0x4bd57e,_0x35d527,_0x425178);break;case _0x6c21('0x21'):zoho[_0x1b46b3](_0x34aa63,_0x757e4b,_0x15dc90,_0x3b555a,_0x4bd57e,_0x35d527,_0x425178);break;case _0x6c21('0x10'):desk[_0x1b46b3](_0x34aa63,_0x757e4b,_0x15dc90,_0x3b555a,_0x4bd57e,_0x35d527,_0x425178);break;case _0x6c21('0x11'):vtiger[_0x1b46b3](_0x34aa63,_0x757e4b,_0x15dc90,_0x3b555a,_0x4bd57e,_0x35d527,_0x425178);break;case'freshsales':freshsales['cs'](_0x34aa63,_0x757e4b,_0x15dc90,_0x3b555a,_0x4bd57e,_0x35d527,_0x425178,_0x1b46b3);break;case _0x6c21('0x22'):servicenow['cs'](_0x34aa63,_0x757e4b,_0x15dc90,_0x3b555a,_0x4bd57e,_0x35d527,_0x425178,_0x1b46b3);break;case _0x6c21('0x12'):dynamics365['cs'](_0x34aa63,_0x757e4b,_0x15dc90,_0x3b555a,_0x4bd57e,_0x35d527,_0x425178,_0x1b46b3);break;default:console[_0x6c21('0x23')](_0x6c21('0x24'));}}else{_0x4d1e57=require(_0x6c21('0x25'))(_0x34aa63[_0x6c21('0x16')][_0x6c21('0x17')]());_0x4d1e57[_0x6c21('0x26')](_0x6c21('0x27'),util[_0x6c21('0x28')](_0x6c21('0x29'),_0x34aa63['data1'][_0x6c21('0x17')](),_0x34aa63[_0x6c21('0x1b')]));}}else{_0x4d1e57=require('../../../../config/logger')(_0x34aa63[_0x6c21('0x16')][_0x6c21('0x17')]());_0x4d1e57['error']('[EXEC]',util['format']('%s\x20account\x20#%s\x20not\x20found',_0x34aa63[_0x6c21('0x16')][_0x6c21('0x17')](),_0x34aa63['data2']));}}else{}}catch(_0x3e3e30){console[_0x6c21('0x26')](_0x3e3e30);}}}}; \ 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 a8f4d90..db2055e 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 _0xb32c=['Salesforce\x20account\x20type\x20not\x20recognized','[OUTBOUND]','lastevent','toUpperCase','isNil','calleridname',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','moment','md5','util','ioredis','./util','../../../../config/environment','redis','emit','assign','getString','Subjects','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','WhatId','ContactId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','find','execute','length','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','cloneDeep','additionalSearchContact','$or','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','merge','Account','Contact','first','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','Caller\x20-\x20%s','format','No\x20Company','account','forEach','includes','picklist','idField','variableName','toString','Variable','name','password','securityToken','remoteUri','clientId','clientSecret','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','Recording\x20is\x20enabled!','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','trigger:browser:url'];(function(_0x1edf32,_0x1246c7){var _0x291779=function(_0x1fc985){while(--_0x1fc985){_0x1edf32['push'](_0x1edf32['shift']());}};_0x291779(++_0x1246c7);}(_0xb32c,0x15e));var _0xcb32=function(_0x406982,_0x135253){_0x406982=_0x406982-0x0;var _0x149930=_0xb32c[_0x406982];return _0x149930;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require(_0xcb32('0x0'));var BPromise=require('bluebird');var md5=require(_0xcb32('0x1'));var jsforce=require('jsforce');var util=require(_0xcb32('0x2'));var Redis=require(_0xcb32('0x3'));var intUtil=require(_0xcb32('0x4'));var config=require(_0xcb32('0x5'));var logger=require('../../../../config/logger')('salesforce');config['redis']=_['defaults'](config[_0xcb32('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcb32('0x6')]));function emit(_0x1dc147,_0x46f2a7,_0x8881f6){io['to'](_0x1dc147)[_0xcb32('0x7')](_0x46f2a7,_0x8881f6);}function getTicket(_0x5c9bc7,_0x531126,_0x409dc2,_0x209107,_0x24301d,_0x9c1675,_0x2e60fc,_0x5e2254){var _0x312114=Object[_0xcb32('0x8')]({},{'OwnerId':_0x531126['id'],'Subject':intUtil[_0xcb32('0x9')](_0x209107[_0xcb32('0xa')],_0x24301d,'\x20'),'Description':intUtil['getString'](_0x209107['Descriptions'],_0x24301d,'\x0a')},getCustomFields(_0x9c1675,_0x24301d));if(_0x409dc2){if(_0x209107[_0xcb32('0xb')]===_0xcb32('0xc')){_0x312114[_0xcb32('0xd')]=moment[_0xcb32('0xe')]();_0x312114[_0xcb32('0xf')]=![];_0x312114[_0xcb32('0x10')]=![];if(_0x409dc2[_0xcb32('0x11')]===_0xcb32('0x12')||_0x409dc2[_0xcb32('0x11')]===_0xcb32('0x13')){_0x312114[_0xcb32('0x14')]=_0x409dc2['id'];}else if(_0x409dc2[_0xcb32('0x11')]==='account'){_0x312114[_0xcb32('0x15')]=_0x409dc2['id'];}}else if(_0x209107[_0xcb32('0xb')]==='Case'){if(_0x409dc2[_0xcb32('0x11')]===_0xcb32('0x12')){_0x312114[_0xcb32('0x16')]=_0x409dc2['id'];}else if(_0x409dc2['endUserType']==='account'){_0x312114['AccountId']=_0x409dc2['id'];}else if(_0x409dc2[_0xcb32('0x11')]===_0xcb32('0x13')&&_0x209107[_0xcb32('0x17')]){_0x312114[_0x209107['leadId']]=_0x409dc2['id'];}else{logger[_0xcb32('0x18')](_0xcb32('0x19'));}}}return _0x2e60fc[_0xcb32('0x1a')](_0x209107[_0xcb32('0xb')])[_0xcb32('0x1b')](_0x312114);}function getUser(_0x128ae7,_0xd67790,_0x25c5c6){if(!_['isNil'](_0xd67790)&&intUtil['validateEmail'](_0xd67790)){var _0x5f3b78={'Email':_0xd67790};var _0x491ede={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x25c5c6[_0xcb32('0x1a')]('User')[_0xcb32('0x1c')](_0x5f3b78,_0x491ede)[_0xcb32('0x1d')]()['then'](function(_0x5352a2){if(_0x5352a2[_0xcb32('0x1e')]){var _0x512d27=_['find'](_0x5352a2,function(_0x189673){return _0x189673['Email']===_0xd67790;});if(_0x512d27){logger[_0xcb32('0x18')](_0xcb32('0x1f'),_0xd67790);return BPromise[_0xcb32('0x20')]({'id':_0x512d27['Id'],'name':_0x512d27[_0xcb32('0x21')]});}}else{logger['info'](_0xcb32('0x22'),_0xd67790);return _0x25c5c6[_0xcb32('0x23')]()[_0xcb32('0x24')](function(_0x2b5509){return BPromise[_0xcb32('0x20')]({'id':_0x2b5509[_0xcb32('0x25')],'name':_0x2b5509['display_name']});});}});}else{logger[_0xcb32('0x18')](_0xcb32('0x22'),_0xd67790);return _0x25c5c6['identity']()['then'](function(_0x291609){return BPromise[_0xcb32('0x20')]({'id':_0x291609[_0xcb32('0x25')],'name':_0x291609[_0xcb32('0x26')]});});}}function getEndUser(_0x424438,_0x4f1ed6,_0x3580ff,_0x257e9c,_0x4ecf16){var _0x3c992b={'$or':{'Phone':_0x257e9c}};var _0x19a561={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xcb32('0x24')](function(){logger['info']('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x257e9c,_0x4f1ed6['moduleSearch']);switch(_0x4f1ed6['moduleSearch']){case'contact_lead':var _0x3912fd=_[_0xcb32('0x27')](_0x3c992b);if(_0x4f1ed6[_0xcb32('0x28')]){var _0x619371={};_0x619371[_0x4f1ed6[_0xcb32('0x28')]]=_0x257e9c;_['merge'](_0x3912fd[_0xcb32('0x29')],_0x619371);}return _0x4ecf16[_0xcb32('0x1a')]('Contact')['find'](_0x3912fd,_0x19a561)[_0xcb32('0x1d')]()[_0xcb32('0x24')](function(_0xca76d7){if(_0xca76d7&&_0xca76d7['length']){return _0xca76d7;}else{var _0x556cac=_[_0xcb32('0x27')](_0x3c992b);if(_0x4f1ed6[_0xcb32('0x2a')]){var _0x941009={};_0x941009[_0x4f1ed6['additionalSearchLead']]=_0x257e9c;_['merge'](_0x556cac['$or'],_0x941009);}return _0x4ecf16[_0xcb32('0x1a')](_0xcb32('0x2b'))[_0xcb32('0x1c')](_0x556cac,_0x19a561);}});case _0xcb32('0x2c'):var _0x513bea=_[_0xcb32('0x27')](_0x3c992b);if(_0x4f1ed6['additionalSearchAccount']){var _0x619371={};_0x619371[_0x4f1ed6[_0xcb32('0x2d')]]=_0x257e9c;_[_0xcb32('0x2e')](_0x513bea[_0xcb32('0x29')],_0x619371);}return _0x4ecf16[_0xcb32('0x1a')](_0xcb32('0x2f'))[_0xcb32('0x1c')](_0x513bea,_0x19a561)[_0xcb32('0x1d')]()['then'](function(_0x319732){if(_0x319732&&_0x319732[_0xcb32('0x1e')]){return _0x319732;}else{var _0x54ee4e=_[_0xcb32('0x27')](_0x3c992b);if(_0x4f1ed6['additionalSearchContact']){var _0x33276b={};_0x33276b[_0x4f1ed6[_0xcb32('0x28')]]=_0x257e9c;_[_0xcb32('0x2e')](_0x54ee4e[_0xcb32('0x29')],_0x33276b);}return _0x4ecf16['sobject'](_0xcb32('0x30'))[_0xcb32('0x1c')](_0x54ee4e,_0x19a561)[_0xcb32('0x24')](function(_0x271978){if(_0x271978&&_0x271978['length']){return _0x271978;}else{var _0x2fad7e=_[_0xcb32('0x27')](_0x3c992b);if(_0x4f1ed6[_0xcb32('0x2a')]){var _0xa7fc28={};_0xa7fc28[_0x4f1ed6[_0xcb32('0x2a')]]=_0x257e9c;_[_0xcb32('0x2e')](_0x2fad7e[_0xcb32('0x29')],_0xa7fc28);}return _0x4ecf16[_0xcb32('0x1a')](_0xcb32('0x2b'))[_0xcb32('0x1c')](_0x2fad7e,_0x19a561);}});}});case'contact':var _0x3912fd=_[_0xcb32('0x27')](_0x3c992b);if(_0x4f1ed6[_0xcb32('0x28')]){var _0x619371={};_0x619371[_0x4f1ed6['additionalSearchContact']]=_0x257e9c;_[_0xcb32('0x2e')](_0x3912fd[_0xcb32('0x29')],_0x619371);}return _0x4ecf16[_0xcb32('0x1a')](_0xcb32('0x30'))[_0xcb32('0x1c')](_0x3912fd,_0x19a561)[_0xcb32('0x1d')]();case _0xcb32('0x13'):var _0x5c8f3=_['cloneDeep'](_0x3c992b);if(_0x4f1ed6[_0xcb32('0x2a')]){var _0x619371={};_0x619371[_0x4f1ed6[_0xcb32('0x2a')]]=_0x257e9c;_[_0xcb32('0x2e')](_0x5c8f3[_0xcb32('0x29')],_0x619371);}return _0x4ecf16[_0xcb32('0x1a')](_0xcb32('0x2b'))['find'](_0x5c8f3,_0x19a561);case'account':var _0x513bea=_['cloneDeep'](_0x3c992b);if(_0x4f1ed6['additionalSearchAccount']){var _0x619371={};_0x619371[_0x4f1ed6[_0xcb32('0x2d')]]=_0x257e9c;_['merge'](_0x513bea[_0xcb32('0x29')],_0x619371);}return _0x4ecf16[_0xcb32('0x1a')](_0xcb32('0x2f'))[_0xcb32('0x1c')](_0x513bea,_0x19a561);default:return null;}})[_0xcb32('0x24')](function(_0x27bca6){if(_0x27bca6&&_0x27bca6['length']){var _0x3008b2=_[_0xcb32('0x31')](_0x27bca6);if(_0x3008b2){return BPromise[_0xcb32('0x20')]({'id':_0x3008b2['Id'],'name':_0x3008b2[_0xcb32('0x21')],'phone':_0x3008b2['Phone'],'endUserType':_0x3008b2[_0xcb32('0x32')][_0xcb32('0x33')][_0xcb32('0x34')]()});}}})[_0xcb32('0x24')](function(_0x4e781c){if(_0x4e781c){logger[_0xcb32('0x18')](_0xcb32('0x35'),_0x4e781c[_0xcb32('0x11')],_0x257e9c);return BPromise[_0xcb32('0x20')](_0x4e781c);}else{logger['info'](_0xcb32('0x36'),_0x257e9c);var _0x3c3b07={'Phone':_0x257e9c};if(_0x4f1ed6[_0xcb32('0x37')]){if(_0x4f1ed6['moduleCreate']==='contact'){logger[_0xcb32('0x18')](_0xcb32('0x38'),_0x257e9c,_0x4f1ed6[_0xcb32('0x37')]);_0x3c3b07[_0xcb32('0x39')]=_0x3580ff!==_0xcb32('0x3a')?_0x3580ff:util['format'](_0xcb32('0x3b'),_0x257e9c);}else if(_0x4f1ed6[_0xcb32('0x37')]==='lead'){logger[_0xcb32('0x18')](_0xcb32('0x38'),_0x257e9c,_0x4f1ed6[_0xcb32('0x37')]);_0x3c3b07[_0xcb32('0x39')]=_0x3580ff!==_0xcb32('0x3a')?_0x3580ff:util[_0xcb32('0x3c')]('Caller\x20-\x20%s',_0x257e9c);_0x3c3b07['Company']=_0xcb32('0x3d');}else if(_0x4f1ed6[_0xcb32('0x37')]===_0xcb32('0x3e')){logger[_0xcb32('0x18')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x257e9c,_0x4f1ed6[_0xcb32('0x37')]);_0x3c3b07[_0xcb32('0x21')]=_0x3580ff!==_0xcb32('0x3a')?_0x3580ff:util['format'](_0xcb32('0x3b'),_0x257e9c);}else{return null;}}return _0x4ecf16[_0xcb32('0x1a')](_['upperFirst'](_0x4f1ed6[_0xcb32('0x37')]))[_0xcb32('0x1b')](_0x3c3b07)[_0xcb32('0x24')](function(_0xb1c110){return BPromise['resolve']({'id':_0xb1c110['id'],'endUserType':_0x4f1ed6[_0xcb32('0x37')]});});}});}function getCustomFields(_0x1daa2c,_0x47461f){var _0x3cf168={};if(_0x1daa2c[_0xcb32('0x1e')]>0x0){_[_0xcb32('0x3f')](_0x1daa2c,function(_0x2428ce){if(_[_0xcb32('0x40')](['string',_0xcb32('0x41')],_0x2428ce[_0xcb32('0x33')])&&_0x2428ce['idField']){_0x3cf168[_0x2428ce[_0xcb32('0x42')]]=_0x2428ce['content']['toString']();}else if(_0x2428ce['type']==='variable'&&_0x2428ce['variableName']&&_0x2428ce[_0xcb32('0x42')]){_0x47461f[_0x2428ce[_0xcb32('0x43')]]&&(_0x3cf168[_0x2428ce[_0xcb32('0x42')]]=_0x47461f[_0x2428ce['variableName']][_0xcb32('0x44')]());}else if(_0x2428ce[_0xcb32('0x33')]==='customVariable'&&_0x2428ce[_0xcb32('0x45')]&&_0x2428ce[_0xcb32('0x45')][_0xcb32('0x46')]&&_0x2428ce[_0xcb32('0x42')]){_0x47461f[_0x2428ce['Variable'][_0xcb32('0x46')][_0xcb32('0x34')]()]&&(_0x3cf168[_0x2428ce['idField']]=_0x47461f[_0x2428ce['Variable'][_0xcb32('0x46')]['toLowerCase']()][_0xcb32('0x44')]());}});}return _0x3cf168;}function getConnection(_0xf5b40f){var _0x341840=_0xf5b40f[_0xcb32('0x47')]['concat'](_0xf5b40f[_0xcb32('0x48')]);var _0x22413c=new jsforce['Connection']({'oauth2':{'loginUrl':_0xf5b40f[_0xcb32('0x49')]||'https://login.salesforce.com','clientId':_0xf5b40f[_0xcb32('0x4a')],'clientSecret':_0xf5b40f[_0xcb32('0x4b')]}});return _0x22413c['login'](_0xf5b40f['username'],_0x341840)[_0xcb32('0x24')](function(){logger[_0xcb32('0x18')](_0xcb32('0x4c'));return _0x22413c;});}exports[_0xcb32('0x4d')]=function(_0x1468c1,_0x1afb9d,_0x2e2391,_0x11a5de,_0x8432ef,_0xbc3d46){var _0x588ab,_0x7738d0,_0x24f0c9,_0x2b0983;_0xbc3d46[_0xcb32('0x4e')]=intUtil[_0xcb32('0x4f')](_0xbc3d46[_0xcb32('0x4e')]);_0xbc3d46[_0xcb32('0x49')]=intUtil[_0xcb32('0x4f')](_0xbc3d46[_0xcb32('0x49')]);if(_0x8432ef&&_0x8432ef[_0xcb32('0x50')]){logger[_0xcb32('0x18')](_0xcb32('0x51'),'Recording\x20is\x20enabled!');_0x1afb9d[_0xcb32('0x52')]=util[_0xcb32('0x3c')](_0xcb32('0x53'),_0xbc3d46[_0xcb32('0x4e')],_0x1afb9d['uniqueid'],md5(_0x1afb9d[_0xcb32('0x54')]));}else{_0x1afb9d['recordingURL']='';}return getConnection(_0xbc3d46)[_0xcb32('0x24')](function(_0x2d1d12){_0x2b0983=_0x2d1d12;return getUser(_0xbc3d46,_0x11a5de[_0xcb32('0x55')],_0x2b0983);})['then'](function(_0xddc300){_0x588ab=_0xddc300;return getEndUser(_0xbc3d46,_0x2e2391,_0x1afb9d['calleridname'],_0x1afb9d[_0xcb32('0x56')],_0x2b0983);})[_0xcb32('0x24')](function(_0x4497bc){_0x7738d0=_0x4497bc;return getTicket(_0xbc3d46,_0x588ab,_0x7738d0,_0x2e2391,_0x1afb9d,_0x2e2391[_0xcb32('0x57')],_0x2b0983,_0xcb32('0x4d'));})[_0xcb32('0x24')](function(_0x3976d9){_0x24f0c9=_0x3976d9;logger[_0xcb32('0x18')](_0xcb32('0x58'),_0x24f0c9['id']);logger[_0xcb32('0x18')](_0xcb32('0x59'),_0x24f0c9['id'],_0x11a5de[_0xcb32('0x46')],_0xbc3d46[_0xcb32('0x33')]);switch(_0xbc3d46[_0xcb32('0x33')]){case _0xcb32('0x5a'):emit(util[_0xcb32('0x3c')](_0xcb32('0x5b'),_0x11a5de[_0xcb32('0x46')]),_0xcb32('0x5c'),{'recordId':_0x24f0c9['id']});break;case'newTab':emit(util['format']('user:%s',_0x11a5de[_0xcb32('0x46')]),'trigger:browser:url',{'uri':util[_0xcb32('0x3c')](_0xcb32('0x5d'),_0x2b0983[_0xcb32('0x5e')],_0x24f0c9['id'])});break;default:logger[_0xcb32('0x5f')](_0xcb32('0x60'));}})[_0xcb32('0x61')](function(_0x1483b8){logger['error']('[QUEUE]',_0x1483b8);});};exports[_0xcb32('0x62')]=function(_0x467c86,_0x56b8b7,_0x3a6675,_0x30e274,_0x1cf804,_0x4c603b,_0x5bbdca){var _0x294098,_0x4cabed,_0x247e0a,_0x2fbfa7;_0x4c603b[_0xcb32('0x4e')]=intUtil[_0xcb32('0x4f')](_0x4c603b[_0xcb32('0x4e')]);_0x4c603b[_0xcb32('0x49')]=intUtil['stripTrailingSlash'](_0x4c603b[_0xcb32('0x49')]);if(_0x5bbdca&&_0x5bbdca[_0xcb32('0x63')]&&_0x5bbdca[_0xcb32('0x63')]!==_0xcb32('0x64')){logger[_0xcb32('0x18')]('[OUTBOUND]',_0xcb32('0x65'));_0x56b8b7['recordingURL']=util[_0xcb32('0x3c')](_0xcb32('0x53'),_0x4c603b[_0xcb32('0x4e')],_0x56b8b7[_0xcb32('0x54')],md5(_0x56b8b7[_0xcb32('0x54')]));}return getConnection(_0x4c603b)[_0xcb32('0x24')](function(_0x3a436c){_0x2fbfa7=_0x3a436c;return getUser(_0x4c603b,_0x30e274[_0xcb32('0x55')],_0x2fbfa7);})[_0xcb32('0x24')](function(_0x59f03f){_0x294098=_0x59f03f;return getEndUser(_0x4c603b,_0x3a6675,_0x56b8b7['destcalleridname'],_0x56b8b7['destcalleridnum'],_0x2fbfa7);})[_0xcb32('0x24')](function(_0x17211f){_0x4cabed=_0x17211f;return getTicket(_0x4c603b,_0x294098,_0x4cabed,_0x3a6675,_0x56b8b7,_0x3a6675['Fields'],_0x2fbfa7,_0xcb32('0x62'));})[_0xcb32('0x24')](function(_0x1d6b77){_0x247e0a=_0x1d6b77;logger[_0xcb32('0x18')](_0xcb32('0x66'),_0x247e0a['id']);logger[_0xcb32('0x18')](_0xcb32('0x67'),_0x247e0a['id'],_0x30e274[_0xcb32('0x46')],_0x4c603b['type']);switch(_0x4c603b[_0xcb32('0x33')]){case _0xcb32('0x5a'):emit(util[_0xcb32('0x3c')](_0xcb32('0x5b'),_0x30e274[_0xcb32('0x46')]),_0xcb32('0x5c'),{'recordId':_0x247e0a['id']});break;case _0xcb32('0x68'):emit(util[_0xcb32('0x3c')](_0xcb32('0x5b'),_0x30e274[_0xcb32('0x46')]),_0xcb32('0x69'),{'uri':util['format'](_0xcb32('0x5d'),_0x2fbfa7['instanceUrl'],_0x247e0a['id'])});break;default:logger[_0xcb32('0x5f')]('[OUTBOUND]',_0xcb32('0x6a'));}})[_0xcb32('0x61')](function(_0x36c445){logger[_0xcb32('0x5f')](_0xcb32('0x6b'),_0x36c445);});};exports['unmanaged']=function(_0x2070aa,_0x5846a0,_0x55b29b,_0x3e99a9,_0x3a3766,_0x40232f){var _0x308ee8,_0xd7f0f8,_0x1875a9,_0x4a1d13;_0x40232f['serverUrl']=intUtil['stripTrailingSlash'](_0x40232f['serverUrl']);_0x40232f[_0xcb32('0x49')]=intUtil[_0xcb32('0x4f')](_0x40232f[_0xcb32('0x49')]);if(_0x3a3766&&_0x3a3766['monitor_format']){logger[_0xcb32('0x18')]('['+_0x5846a0[_0xcb32('0x6c')][_0xcb32('0x6d')]()+']',_0xcb32('0x65'));_0x5846a0['recordingURL']=util[_0xcb32('0x3c')](_0xcb32('0x53'),_0x40232f[_0xcb32('0x4e')],_0x5846a0[_0xcb32('0x54')],md5(_0x5846a0[_0xcb32('0x54')]));}else{_0x5846a0[_0xcb32('0x52')]='';}return getConnection(_0x40232f)['then'](function(_0x2439c8){_0x4a1d13=_0x2439c8;if(!_[_0xcb32('0x6e')](_0x3e99a9)){return getUser(_0x40232f,_0x3e99a9[_0xcb32('0x46')],_0x4a1d13);}else{return getUser(_0x40232f,null,_0x4a1d13);}})[_0xcb32('0x24')](function(_0xa116e6){_0x308ee8=_0xa116e6;return getEndUser(_0x40232f,_0x55b29b,_0x5846a0[_0xcb32('0x6f')],_0x5846a0[_0xcb32('0x56')],_0x4a1d13);})[_0xcb32('0x24')](function(_0x351fb6){_0xd7f0f8=_0x351fb6;return getTicket(_0x40232f,_0x308ee8,_0xd7f0f8,_0x55b29b,_0x5846a0,_0x55b29b[_0xcb32('0x57')],_0x4a1d13);})[_0xcb32('0x24')](function(_0x2cca6a){_0x1875a9=_0x2cca6a;logger[_0xcb32('0x18')]('['+_0x5846a0[_0xcb32('0x6c')][_0xcb32('0x6d')]()+_0xcb32('0x70'),_0x1875a9['id']);logger['info']('['+_0x5846a0['lastevent'][_0xcb32('0x6d')]()+_0xcb32('0x71'),_0x40232f['type']);})[_0xcb32('0x61')](function(_0x2f0c18){logger[_0xcb32('0x5f')]('['+_0x5846a0[_0xcb32('0x6c')][_0xcb32('0x6d')]()+']',_0x2f0c18);});}; \ No newline at end of file +var _0xac1d=['WhoId','account','WhatId','ticketType','contact','ContactId','leadId','info','create','validateEmail','sobject','User','then','length','find','Email','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','resolve','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','Contact','execute','additionalSearchLead','Lead','additionalSearchAccount','merge','Account','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','password','securityToken','Connection','clientSecret','username','queue','stripTrailingSlash','serverUrl','remoteUri','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','recordingFormat','none','[OUTBOUND]','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:browser:url','Salesforce\x20account\x20type\x20not\x20recognized','catch','toUpperCase','Recording\x20is\x20enabled!','isNil','calleridnum','lastevent','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','salesforce','defaults','redis','localhost','emit','getString','Subjects','Descriptions','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','lead'];(function(_0x217607,_0xa467ba){var _0x553e99=function(_0x38113e){while(--_0x38113e){_0x217607['push'](_0x217607['shift']());}};_0x553e99(++_0xa467ba);}(_0xac1d,0x1e8));var _0xdac1=function(_0x43ada6,_0x24ea43){_0x43ada6=_0x43ada6-0x0;var _0x1bd289=_0xac1d[_0x43ada6];return _0x1bd289;};'use strict';var _=require('lodash');var rp=require(_0xdac1('0x0'));var moment=require(_0xdac1('0x1'));var BPromise=require(_0xdac1('0x2'));var md5=require(_0xdac1('0x3'));var jsforce=require(_0xdac1('0x4'));var util=require(_0xdac1('0x5'));var Redis=require(_0xdac1('0x6'));var intUtil=require(_0xdac1('0x7'));var config=require(_0xdac1('0x8'));var logger=require('../../../../config/logger')(_0xdac1('0x9'));config['redis']=_[_0xdac1('0xa')](config[_0xdac1('0xb')],{'host':_0xdac1('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdac1('0xb')]));function emit(_0x1e4339,_0x8eb530,_0x278f01){io['to'](_0x1e4339)[_0xdac1('0xd')](_0x8eb530,_0x278f01);}function getTicket(_0x3fa312,_0x2e83c6,_0x31a03b,_0x5268f1,_0x6b815c,_0x3cbc7a,_0x2ab70e,_0x467989){var _0x348641=Object['assign']({},{'OwnerId':_0x2e83c6['id'],'Subject':intUtil[_0xdac1('0xe')](_0x5268f1[_0xdac1('0xf')],_0x6b815c,'\x20'),'Description':intUtil['getString'](_0x5268f1[_0xdac1('0x10')],_0x6b815c,'\x0a')},getCustomFields(_0x3cbc7a,_0x6b815c));if(_0x31a03b){if(_0x5268f1['ticketType']===_0xdac1('0x11')){_0x348641[_0xdac1('0x12')]=moment[_0xdac1('0x13')]();_0x348641[_0xdac1('0x14')]=![];_0x348641[_0xdac1('0x15')]=![];if(_0x31a03b[_0xdac1('0x16')]==='contact'||_0x31a03b[_0xdac1('0x16')]===_0xdac1('0x17')){_0x348641[_0xdac1('0x18')]=_0x31a03b['id'];}else if(_0x31a03b['endUserType']===_0xdac1('0x19')){_0x348641[_0xdac1('0x1a')]=_0x31a03b['id'];}}else if(_0x5268f1[_0xdac1('0x1b')]==='Case'){if(_0x31a03b[_0xdac1('0x16')]===_0xdac1('0x1c')){_0x348641[_0xdac1('0x1d')]=_0x31a03b['id'];}else if(_0x31a03b[_0xdac1('0x16')]===_0xdac1('0x19')){_0x348641['AccountId']=_0x31a03b['id'];}else if(_0x31a03b[_0xdac1('0x16')]===_0xdac1('0x17')&&_0x5268f1[_0xdac1('0x1e')]){_0x348641[_0x5268f1[_0xdac1('0x1e')]]=_0x31a03b['id'];}else{logger[_0xdac1('0x1f')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x2ab70e['sobject'](_0x5268f1[_0xdac1('0x1b')])[_0xdac1('0x20')](_0x348641);}function getUser(_0x12f6e9,_0x4d5a0d,_0x285521){if(!_['isNil'](_0x4d5a0d)&&intUtil[_0xdac1('0x21')](_0x4d5a0d)){var _0x4538cd={'Email':_0x4d5a0d};var _0xea7a42={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x285521[_0xdac1('0x22')](_0xdac1('0x23'))['find'](_0x4538cd,_0xea7a42)['execute']()[_0xdac1('0x24')](function(_0x790c79){if(_0x790c79[_0xdac1('0x25')]){var _0x4ff3cf=_[_0xdac1('0x26')](_0x790c79,function(_0x28c518){return _0x28c518[_0xdac1('0x27')]===_0x4d5a0d;});if(_0x4ff3cf){logger[_0xdac1('0x1f')](_0xdac1('0x28'),_0x4d5a0d);return BPromise['resolve']({'id':_0x4ff3cf['Id'],'name':_0x4ff3cf[_0xdac1('0x29')]});}}else{logger[_0xdac1('0x1f')](_0xdac1('0x2a'),_0x4d5a0d);return _0x285521[_0xdac1('0x2b')]()['then'](function(_0x5e4eab){return BPromise[_0xdac1('0x2c')]({'id':_0x5e4eab['user_id'],'name':_0x5e4eab['display_name']});});}});}else{logger[_0xdac1('0x1f')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x4d5a0d);return _0x285521[_0xdac1('0x2b')]()[_0xdac1('0x24')](function(_0x22d5bc){return BPromise[_0xdac1('0x2c')]({'id':_0x22d5bc[_0xdac1('0x2d')],'name':_0x22d5bc[_0xdac1('0x2e')]});});}}function getEndUser(_0x92785,_0x597cf6,_0xaf3e9a,_0x2a753f,_0x59d986){var _0xe93b12={'$or':{'Phone':_0x2a753f}};var _0x2c028d={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xdac1('0x2c')]()[_0xdac1('0x24')](function(){logger[_0xdac1('0x1f')](_0xdac1('0x2f'),_0x2a753f,_0x597cf6[_0xdac1('0x30')]);switch(_0x597cf6[_0xdac1('0x30')]){case _0xdac1('0x31'):var _0x54893a=_[_0xdac1('0x32')](_0xe93b12);if(_0x597cf6[_0xdac1('0x33')]){var _0x2f7b5f={};_0x2f7b5f[_0x597cf6[_0xdac1('0x33')]]=_0x2a753f;_['merge'](_0x54893a[_0xdac1('0x34')],_0x2f7b5f);}return _0x59d986[_0xdac1('0x22')](_0xdac1('0x35'))[_0xdac1('0x26')](_0x54893a,_0x2c028d)[_0xdac1('0x36')]()[_0xdac1('0x24')](function(_0x414f21){if(_0x414f21&&_0x414f21[_0xdac1('0x25')]){return _0x414f21;}else{var _0x3abbce=_['cloneDeep'](_0xe93b12);if(_0x597cf6[_0xdac1('0x37')]){var _0x2fde41={};_0x2fde41[_0x597cf6[_0xdac1('0x37')]]=_0x2a753f;_['merge'](_0x3abbce[_0xdac1('0x34')],_0x2fde41);}return _0x59d986[_0xdac1('0x22')](_0xdac1('0x38'))['find'](_0x3abbce,_0x2c028d);}});case'account_contact_lead':var _0x120c91=_['cloneDeep'](_0xe93b12);if(_0x597cf6[_0xdac1('0x39')]){var _0x2f7b5f={};_0x2f7b5f[_0x597cf6[_0xdac1('0x39')]]=_0x2a753f;_[_0xdac1('0x3a')](_0x120c91['$or'],_0x2f7b5f);}return _0x59d986[_0xdac1('0x22')](_0xdac1('0x3b'))[_0xdac1('0x26')](_0x120c91,_0x2c028d)[_0xdac1('0x36')]()[_0xdac1('0x24')](function(_0x54296d){if(_0x54296d&&_0x54296d[_0xdac1('0x25')]){return _0x54296d;}else{var _0x59ffa0=_['cloneDeep'](_0xe93b12);if(_0x597cf6['additionalSearchContact']){var _0x52aef7={};_0x52aef7[_0x597cf6[_0xdac1('0x33')]]=_0x2a753f;_[_0xdac1('0x3a')](_0x59ffa0[_0xdac1('0x34')],_0x52aef7);}return _0x59d986['sobject'](_0xdac1('0x35'))[_0xdac1('0x26')](_0x59ffa0,_0x2c028d)[_0xdac1('0x24')](function(_0xc67e14){if(_0xc67e14&&_0xc67e14['length']){return _0xc67e14;}else{var _0x15ccd1=_[_0xdac1('0x32')](_0xe93b12);if(_0x597cf6[_0xdac1('0x37')]){var _0x55046b={};_0x55046b[_0x597cf6[_0xdac1('0x37')]]=_0x2a753f;_[_0xdac1('0x3a')](_0x15ccd1[_0xdac1('0x34')],_0x55046b);}return _0x59d986[_0xdac1('0x22')](_0xdac1('0x38'))['find'](_0x15ccd1,_0x2c028d);}});}});case _0xdac1('0x1c'):var _0x54893a=_[_0xdac1('0x32')](_0xe93b12);if(_0x597cf6[_0xdac1('0x33')]){var _0x2f7b5f={};_0x2f7b5f[_0x597cf6[_0xdac1('0x33')]]=_0x2a753f;_['merge'](_0x54893a[_0xdac1('0x34')],_0x2f7b5f);}return _0x59d986['sobject'](_0xdac1('0x35'))[_0xdac1('0x26')](_0x54893a,_0x2c028d)[_0xdac1('0x36')]();case _0xdac1('0x17'):var _0x11b240=_['cloneDeep'](_0xe93b12);if(_0x597cf6[_0xdac1('0x37')]){var _0x2f7b5f={};_0x2f7b5f[_0x597cf6['additionalSearchLead']]=_0x2a753f;_[_0xdac1('0x3a')](_0x11b240[_0xdac1('0x34')],_0x2f7b5f);}return _0x59d986['sobject']('Lead')[_0xdac1('0x26')](_0x11b240,_0x2c028d);case _0xdac1('0x19'):var _0x120c91=_[_0xdac1('0x32')](_0xe93b12);if(_0x597cf6[_0xdac1('0x39')]){var _0x2f7b5f={};_0x2f7b5f[_0x597cf6['additionalSearchAccount']]=_0x2a753f;_[_0xdac1('0x3a')](_0x120c91['$or'],_0x2f7b5f);}return _0x59d986[_0xdac1('0x22')](_0xdac1('0x3b'))[_0xdac1('0x26')](_0x120c91,_0x2c028d);default:return null;}})['then'](function(_0x131a45){if(_0x131a45&&_0x131a45[_0xdac1('0x25')]){var _0x1134af=_[_0xdac1('0x3c')](_0x131a45);if(_0x1134af){return BPromise[_0xdac1('0x2c')]({'id':_0x1134af['Id'],'name':_0x1134af[_0xdac1('0x29')],'phone':_0x1134af[_0xdac1('0x3d')],'endUserType':_0x1134af[_0xdac1('0x3e')][_0xdac1('0x3f')][_0xdac1('0x40')]()});}}})['then'](function(_0x554e5b){if(_0x554e5b){logger[_0xdac1('0x1f')](_0xdac1('0x41'),_0x554e5b[_0xdac1('0x16')],_0x2a753f);return BPromise['resolve'](_0x554e5b);}else{logger[_0xdac1('0x1f')](_0xdac1('0x42'),_0x2a753f);var _0x3d87e5={'Phone':_0x2a753f};if(_0x597cf6[_0xdac1('0x43')]){if(_0x597cf6[_0xdac1('0x43')]===_0xdac1('0x1c')){logger[_0xdac1('0x1f')](_0xdac1('0x44'),_0x2a753f,_0x597cf6['moduleCreate']);_0x3d87e5[_0xdac1('0x45')]=_0xaf3e9a!==_0xdac1('0x46')?_0xaf3e9a:util['format']('Caller\x20-\x20%s',_0x2a753f);}else if(_0x597cf6[_0xdac1('0x43')]===_0xdac1('0x17')){logger[_0xdac1('0x1f')](_0xdac1('0x44'),_0x2a753f,_0x597cf6[_0xdac1('0x43')]);_0x3d87e5[_0xdac1('0x45')]=_0xaf3e9a!==_0xdac1('0x46')?_0xaf3e9a:util[_0xdac1('0x47')](_0xdac1('0x48'),_0x2a753f);_0x3d87e5[_0xdac1('0x49')]=_0xdac1('0x4a');}else if(_0x597cf6[_0xdac1('0x43')]==='account'){logger[_0xdac1('0x1f')](_0xdac1('0x44'),_0x2a753f,_0x597cf6[_0xdac1('0x43')]);_0x3d87e5[_0xdac1('0x29')]=_0xaf3e9a!==_0xdac1('0x46')?_0xaf3e9a:util['format'](_0xdac1('0x48'),_0x2a753f);}else{return null;}}return _0x59d986[_0xdac1('0x22')](_[_0xdac1('0x4b')](_0x597cf6['moduleCreate']))['create'](_0x3d87e5)['then'](function(_0x4d3f71){return BPromise[_0xdac1('0x2c')]({'id':_0x4d3f71['id'],'endUserType':_0x597cf6[_0xdac1('0x43')]});});}});}function getCustomFields(_0x2d0487,_0x3e8c3f){var _0x88a8bf={};if(_0x2d0487[_0xdac1('0x25')]>0x0){_[_0xdac1('0x4c')](_0x2d0487,function(_0x44fe5b){if(_[_0xdac1('0x4d')]([_0xdac1('0x4e'),_0xdac1('0x4f')],_0x44fe5b[_0xdac1('0x3f')])&&_0x44fe5b[_0xdac1('0x50')]){_0x88a8bf[_0x44fe5b[_0xdac1('0x50')]]=_0x44fe5b[_0xdac1('0x51')][_0xdac1('0x52')]();}else if(_0x44fe5b[_0xdac1('0x3f')]===_0xdac1('0x53')&&_0x44fe5b[_0xdac1('0x54')]&&_0x44fe5b[_0xdac1('0x50')]){_0x3e8c3f[_0x44fe5b[_0xdac1('0x54')]]&&(_0x88a8bf[_0x44fe5b['idField']]=_0x3e8c3f[_0x44fe5b[_0xdac1('0x54')]][_0xdac1('0x52')]());}else if(_0x44fe5b[_0xdac1('0x3f')]===_0xdac1('0x55')&&_0x44fe5b[_0xdac1('0x56')]&&_0x44fe5b[_0xdac1('0x56')][_0xdac1('0x57')]&&_0x44fe5b['idField']){_0x3e8c3f[_0x44fe5b[_0xdac1('0x56')]['name'][_0xdac1('0x40')]()]&&(_0x88a8bf[_0x44fe5b[_0xdac1('0x50')]]=_0x3e8c3f[_0x44fe5b[_0xdac1('0x56')][_0xdac1('0x57')][_0xdac1('0x40')]()][_0xdac1('0x52')]());}});}return _0x88a8bf;}function getConnection(_0x3ca280){var _0x2a4a7f=_0x3ca280[_0xdac1('0x58')]['concat'](_0x3ca280[_0xdac1('0x59')]);var _0x124543=new jsforce[(_0xdac1('0x5a'))]({'oauth2':{'loginUrl':_0x3ca280['remoteUri']||'https://login.salesforce.com','clientId':_0x3ca280['clientId'],'clientSecret':_0x3ca280[_0xdac1('0x5b')]}});return _0x124543['login'](_0x3ca280[_0xdac1('0x5c')],_0x2a4a7f)[_0xdac1('0x24')](function(){logger[_0xdac1('0x1f')]('Connection\x20established.');return _0x124543;});}exports[_0xdac1('0x5d')]=function(_0x9cf121,_0x478d5b,_0x38f898,_0xa493e0,_0x5b1a4d,_0x5436fe){var _0x4032d1,_0x295e6c,_0x325a61,_0xf51f42;_0x5436fe['serverUrl']=intUtil[_0xdac1('0x5e')](_0x5436fe[_0xdac1('0x5f')]);_0x5436fe[_0xdac1('0x60')]=intUtil[_0xdac1('0x5e')](_0x5436fe[_0xdac1('0x60')]);if(_0x5b1a4d&&_0x5b1a4d[_0xdac1('0x61')]){logger['info'](_0xdac1('0x62'),'Recording\x20is\x20enabled!');_0x478d5b[_0xdac1('0x63')]=util[_0xdac1('0x47')](_0xdac1('0x64'),_0x5436fe[_0xdac1('0x5f')],_0x478d5b[_0xdac1('0x65')],md5(_0x478d5b[_0xdac1('0x65')]));}else{_0x478d5b[_0xdac1('0x63')]='';}return getConnection(_0x5436fe)[_0xdac1('0x24')](function(_0x3331bd){_0xf51f42=_0x3331bd;return getUser(_0x5436fe,_0xa493e0[_0xdac1('0x66')],_0xf51f42);})[_0xdac1('0x24')](function(_0x484112){_0x4032d1=_0x484112;return getEndUser(_0x5436fe,_0x38f898,_0x478d5b[_0xdac1('0x67')],_0x478d5b['calleridnum'],_0xf51f42);})['then'](function(_0x647d90){_0x295e6c=_0x647d90;return getTicket(_0x5436fe,_0x4032d1,_0x295e6c,_0x38f898,_0x478d5b,_0x38f898[_0xdac1('0x68')],_0xf51f42,_0xdac1('0x5d'));})[_0xdac1('0x24')](function(_0x4ee8c9){_0x325a61=_0x4ee8c9;logger[_0xdac1('0x1f')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x325a61['id']);logger[_0xdac1('0x1f')](_0xdac1('0x69'),_0x325a61['id'],_0xa493e0['name'],_0x5436fe[_0xdac1('0x3f')]);switch(_0x5436fe[_0xdac1('0x3f')]){case _0xdac1('0x6a'):emit(util['format'](_0xdac1('0x6b'),_0xa493e0[_0xdac1('0x57')]),_0xdac1('0x6c'),{'recordId':_0x325a61['id']});break;case _0xdac1('0x6d'):emit(util[_0xdac1('0x47')]('user:%s',_0xa493e0[_0xdac1('0x57')]),'trigger:browser:url',{'uri':util['format'](_0xdac1('0x6e'),_0xf51f42[_0xdac1('0x6f')],_0x325a61['id'])});break;default:logger[_0xdac1('0x70')](_0xdac1('0x71'));}})['catch'](function(_0xc63add){logger[_0xdac1('0x70')](_0xdac1('0x62'),_0xc63add);});};exports[_0xdac1('0x72')]=function(_0x403dc1,_0x47ee6c,_0x13cf16,_0x1d68b4,_0x3d9a66,_0x2f9c86,_0x49d028){var _0x31df8b,_0x4a8b78,_0x12387f,_0x306195;_0x2f9c86['serverUrl']=intUtil['stripTrailingSlash'](_0x2f9c86[_0xdac1('0x5f')]);_0x2f9c86[_0xdac1('0x60')]=intUtil[_0xdac1('0x5e')](_0x2f9c86[_0xdac1('0x60')]);if(_0x49d028&&_0x49d028[_0xdac1('0x73')]&&_0x49d028[_0xdac1('0x73')]!==_0xdac1('0x74')){logger[_0xdac1('0x1f')](_0xdac1('0x75'),'Recording\x20is\x20enabled!');_0x47ee6c[_0xdac1('0x63')]=util[_0xdac1('0x47')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2f9c86['serverUrl'],_0x47ee6c[_0xdac1('0x65')],md5(_0x47ee6c[_0xdac1('0x65')]));}return getConnection(_0x2f9c86)[_0xdac1('0x24')](function(_0x40dc87){_0x306195=_0x40dc87;return getUser(_0x2f9c86,_0x1d68b4[_0xdac1('0x66')],_0x306195);})[_0xdac1('0x24')](function(_0x2bb8b7){_0x31df8b=_0x2bb8b7;return getEndUser(_0x2f9c86,_0x13cf16,_0x47ee6c['destcalleridname'],_0x47ee6c['destcalleridnum'],_0x306195);})[_0xdac1('0x24')](function(_0x53752c){_0x4a8b78=_0x53752c;return getTicket(_0x2f9c86,_0x31df8b,_0x4a8b78,_0x13cf16,_0x47ee6c,_0x13cf16[_0xdac1('0x68')],_0x306195,'outbound');})[_0xdac1('0x24')](function(_0x430c01){_0x12387f=_0x430c01;logger[_0xdac1('0x1f')](_0xdac1('0x76'),_0x12387f['id']);logger[_0xdac1('0x1f')](_0xdac1('0x77'),_0x12387f['id'],_0x1d68b4[_0xdac1('0x57')],_0x2f9c86['type']);switch(_0x2f9c86['type']){case _0xdac1('0x6a'):emit(util['format'](_0xdac1('0x6b'),_0x1d68b4[_0xdac1('0x57')]),_0xdac1('0x6c'),{'recordId':_0x12387f['id']});break;case _0xdac1('0x6d'):emit(util[_0xdac1('0x47')]('user:%s',_0x1d68b4[_0xdac1('0x57')]),_0xdac1('0x78'),{'uri':util['format'](_0xdac1('0x6e'),_0x306195[_0xdac1('0x6f')],_0x12387f['id'])});break;default:logger[_0xdac1('0x70')](_0xdac1('0x75'),_0xdac1('0x79'));}})[_0xdac1('0x7a')](function(_0x590d48){logger['error'](_0xdac1('0x75'),_0x590d48);});};exports['unmanaged']=function(_0x28e5a2,_0x5c1bee,_0x5d64cc,_0x362f94,_0x3e9445,_0x89c1c9){var _0x1dd3b4,_0x125252,_0x2e4c6b,_0xa8a65;_0x89c1c9['serverUrl']=intUtil['stripTrailingSlash'](_0x89c1c9[_0xdac1('0x5f')]);_0x89c1c9[_0xdac1('0x60')]=intUtil[_0xdac1('0x5e')](_0x89c1c9[_0xdac1('0x60')]);if(_0x3e9445&&_0x3e9445[_0xdac1('0x61')]){logger[_0xdac1('0x1f')]('['+_0x5c1bee['lastevent'][_0xdac1('0x7b')]()+']',_0xdac1('0x7c'));_0x5c1bee['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x89c1c9[_0xdac1('0x5f')],_0x5c1bee[_0xdac1('0x65')],md5(_0x5c1bee[_0xdac1('0x65')]));}else{_0x5c1bee[_0xdac1('0x63')]='';}return getConnection(_0x89c1c9)[_0xdac1('0x24')](function(_0x1bf5f8){_0xa8a65=_0x1bf5f8;if(!_[_0xdac1('0x7d')](_0x362f94)){return getUser(_0x89c1c9,_0x362f94['name'],_0xa8a65);}else{return getUser(_0x89c1c9,null,_0xa8a65);}})['then'](function(_0x52da2d){_0x1dd3b4=_0x52da2d;return getEndUser(_0x89c1c9,_0x5d64cc,_0x5c1bee['calleridname'],_0x5c1bee[_0xdac1('0x7e')],_0xa8a65);})[_0xdac1('0x24')](function(_0x608ccc){_0x125252=_0x608ccc;return getTicket(_0x89c1c9,_0x1dd3b4,_0x125252,_0x5d64cc,_0x5c1bee,_0x5d64cc['Fields'],_0xa8a65);})[_0xdac1('0x24')](function(_0xd2460){_0x2e4c6b=_0xd2460;logger[_0xdac1('0x1f')]('['+_0x5c1bee['lastevent'][_0xdac1('0x7b')]()+']\x20Ticket\x20%s\x20created.',_0x2e4c6b['id']);logger[_0xdac1('0x1f')]('['+_0x5c1bee[_0xdac1('0x7f')][_0xdac1('0x7b')]()+']\x20Integration\x20account\x20type\x20%s.',_0x89c1c9[_0xdac1('0x3f')]);})[_0xdac1('0x7a')](function(_0xe490dd){logger[_0xdac1('0x70')]('['+_0x5c1bee[_0xdac1('0x7f')][_0xdac1('0x7b')]()+']',_0xe490dd);});}; \ 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 531323f..900c3da 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 _0x6889=[']\x20getTicket\x20crm','label','label_entry','incident','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','sys_id','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','],\x20getUser\x20input\x20crm','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','userId','adminId','adminEmail',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','length','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','string','picklist','type','nameField','toString','includes','idField','customField','toLowerCase','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','POST','assign','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number'];(function(_0x162780,_0x47f2e2){var _0x1ea2dc=function(_0x123898){while(--_0x123898){_0x162780['push'](_0x162780['shift']());}};_0x1ea2dc(++_0x47f2e2);}(_0x6889,0x115));var _0x9688=function(_0x96a3e,_0x166ff0){_0x96a3e=_0x96a3e-0x0;var _0x44e17a=_0x6889[_0x96a3e];return _0x44e17a;};'use strict';var _=require(_0x9688('0x0'));var Promise=require(_0x9688('0x1'));var rp=require(_0x9688('0x2'));var util=require(_0x9688('0x3'));var md5=require(_0x9688('0x4'));var Redis=require(_0x9688('0x5'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x9688('0x6'))(_0x9688('0x7'));config[_0x9688('0x8')]=_[_0x9688('0x9')](config[_0x9688('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x9688('0xa'))(new Redis(config[_0x9688('0x8')]));function getAdminUser(_0x512ef9,_0x26f1c3,_0x29e6d7,_0x210edd,_0x284784,_0x52b7a7){return new Promise(function(_0x5e382a,_0x59469d){var _0x495d0b={'method':_0x9688('0xb'),'uri':_0x210edd+_0x9688('0xc')+'&'+_0x284784+'&'+_0x52b7a7,'auth':_0x26f1c3,'json':!![]};return rp(_0x495d0b)[_0x9688('0xd')](function(_0xa1b311){if(_0xa1b311[_0x9688('0xe')]['length']>0x0){_0x29e6d7['adminId']=_0xa1b311[_0x9688('0xe')][0x0][_0x9688('0xf')];}logger[_0x9688('0x10')]('['+[_0x512ef9['toUpperCase']()]+_0x9688('0x11'),_0x29e6d7);_0x5e382a(_0x29e6d7);})[_0x9688('0x12')](function(_0x3c2888){logger[_0x9688('0x13')]('['+[_0x512ef9[_0x9688('0x14')]()]+']',_0x3c2888[_0x9688('0x15')]);_0x59469d(_0x3c2888[_0x9688('0x15')]);});});}function getUser(_0x83a202,_0x3be4d9,_0x3d3702,_0x99db36,_0x26a8de){return function(_0x3276b3){logger['info']('['+[_0x83a202['toUpperCase']()]+_0x9688('0x16'),_0x3276b3);return new Promise(function(_0x5fbf54,_0x2f4192){if(intUtil['validateEmail'](_0x3276b3['userEmail'])){var _0x5efbd3={'method':'GET','uri':_0x3d3702+'sys_user?sysparm_query=email%3D'+_0x3276b3[_0x9688('0x17')]+'&'+_0x99db36+'&'+_0x26a8de,'auth':_0x3be4d9,'json':!![]};logger[_0x9688('0x10')]('['+[_0x83a202[_0x9688('0x14')]()]+_0x9688('0x18'),_0x5efbd3);return rp(_0x5efbd3)[_0x9688('0xd')](function(_0x14f57c){logger[_0x9688('0x10')]('['+[_0x83a202[_0x9688('0x14')]()]+_0x9688('0x19'),_0x14f57c);if(_0x14f57c['result']['length']>0x0&&String(_0x14f57c[_0x9688('0xe')][0x0][_0x9688('0x1a')])==='true'){_0x3276b3['userId']=_0x14f57c['result'][0x0][_0x9688('0xf')];}else{_0x3276b3[_0x9688('0x1b')]=_0x3276b3[_0x9688('0x1c')];_0x3276b3[_0x9688('0x17')]=_0x3276b3[_0x9688('0x1d')];}logger[_0x9688('0x10')]('['+[_0x83a202[_0x9688('0x14')]()]+'],\x20getUser\x20crm',_0x3276b3);_0x5fbf54(_0x3276b3);})['catch'](function(_0x40ed13){logger['error']('['+[_0x83a202[_0x9688('0x14')]()]+']',_0x40ed13['message']);_0x2f4192(_0x40ed13[_0x9688('0x15')]);});}else{logger[_0x9688('0x10')]('['+[_0x83a202[_0x9688('0x14')]()]+_0x9688('0x1e'));_0x3276b3[_0x9688('0x1b')]=_0x3276b3['adminId'];_0x3276b3[_0x9688('0x17')]=_0x3276b3[_0x9688('0x1d')];_0x5fbf54(_0x3276b3);}});};}function createEndUser(_0x2be712,_0x3a6110,_0x29a7ec,_0x2bac63,_0x56df20){logger[_0x9688('0x10')]('['+[_0x2be712[_0x9688('0x14')]()]+_0x9688('0x1f'),_0x29a7ec);return new Promise(function(_0x567e26,_0x54c6d7){var _0x478c43={'method':'POST','uri':_0x2bac63+_0x9688('0x20')+_0x56df20,'body':{'user_name':_0x29a7ec[_0x9688('0x21')],'roles':_0x9688('0x22'),'first_name':_0x29a7ec[_0x9688('0x21')],'active':_0x9688('0x23'),'date_format':_0x9688('0x24'),'phone':_0x29a7ec['endUserNumber']},'auth':_0x3a6110,'json':!![]};return rp(_0x478c43)[_0x9688('0xd')](function(_0x306bd1){logger[_0x9688('0x10')]('['+[_0x2be712[_0x9688('0x14')]()]+_0x9688('0x25'),_0x306bd1['result']);_0x29a7ec[_0x9688('0x26')]=_0x306bd1[_0x9688('0xe')][_0x9688('0xf')];_0x567e26(_0x29a7ec);})['catch'](function(_0x5a928a){logger[_0x9688('0x13')]('['+[_0x2be712[_0x9688('0x14')]()]+']',_0x5a928a[_0x9688('0x15')]);_0x54c6d7(_0x5a928a[_0x9688('0x15')]);});});}function getEndUser(_0x345cf0,_0x158fe7,_0x164417,_0x2acfcd,_0x4833f3){return function(_0x3b13f4){logger['info']('['+[_0x345cf0[_0x9688('0x14')]()]+_0x9688('0x27'),_0x3b13f4);return new Promise(function(_0x4cc64f,_0x876702){var _0x5d8132={'method':_0x9688('0xb'),'uri':_0x164417+_0x9688('0x28')+_0x3b13f4[_0x9688('0x21')]+'&'+_0x2acfcd+'&'+_0x4833f3,'auth':_0x158fe7,'json':!![]};return rp(_0x5d8132)['then'](function(_0x448d07){if(_0x448d07['result'][_0x9688('0x29')]>0x0){_0x3b13f4[_0x9688('0x26')]=_0x448d07[_0x9688('0xe')][0x0][_0x9688('0xf')];logger[_0x9688('0x10')]('['+[_0x345cf0['toUpperCase']()]+_0x9688('0x2a'),_0x3b13f4);_0x4cc64f(_0x3b13f4);}else{return createEndUser(_0x345cf0,_0x158fe7,_0x3b13f4,_0x164417,_0x2acfcd)[_0x9688('0xd')](function(_0x495b29){logger[_0x9688('0x10')]('['+[_0x345cf0[_0x9688('0x14')]()]+_0x9688('0x2b'),_0x495b29);_0x4cc64f(_0x495b29);});}})[_0x9688('0x12')](function(_0x807228){logger['error']('['+[_0x345cf0[_0x9688('0x14')]()]+']',_0x807228[_0x9688('0x15')]);_0x876702(_0x807228['message']);});});};}function getCustomFields(_0x3c407f,_0x550a24){var _0x2ef7f4={};if(_0x3c407f[_0x9688('0x29')]>0x0){_[_0x9688('0x2c')](_0x3c407f,function(_0x1ee1f5){if(_['includes']([_0x9688('0x2d'),_0x9688('0x2e')],_0x1ee1f5[_0x9688('0x2f')])&&_0x1ee1f5[_0x9688('0x30')]&&!_0x1ee1f5['customField']){_0x2ef7f4[_0x1ee1f5[_0x9688('0x30')]['toLowerCase']()]=_0x1ee1f5['content'][_0x9688('0x31')]();}else if(_[_0x9688('0x32')]([_0x9688('0x2d'),_0x9688('0x2e')],_0x1ee1f5[_0x9688('0x2f')])&&_0x1ee1f5[_0x9688('0x33')]&&_0x1ee1f5[_0x9688('0x34')]){_0x2ef7f4[_0x1ee1f5[_0x9688('0x33')][_0x9688('0x35')]()]=_0x1ee1f5['content'][_0x9688('0x31')]();}else if(_0x1ee1f5[_0x9688('0x2f')]==='variable'&&_0x1ee1f5[_0x9688('0x36')]&&_0x1ee1f5[_0x9688('0x33')]&&_0x1ee1f5['customField']){_0x2ef7f4[_0x1ee1f5[_0x9688('0x33')][_0x9688('0x35')]()]=_0x550a24[_0x1ee1f5[_0x9688('0x36')]]['toString']();}else if(_0x1ee1f5['type']===_0x9688('0x37')&&_0x1ee1f5['Variable']&&_0x1ee1f5['Variable']['name']&&_0x1ee1f5[_0x9688('0x33')]&&_0x1ee1f5[_0x9688('0x34')]){_0x2ef7f4[_0x1ee1f5['idField'][_0x9688('0x35')]()]=_0x550a24[_0x1ee1f5[_0x9688('0x38')][_0x9688('0x39')][_0x9688('0x35')]()][_0x9688('0x31')]();}});}return _0x2ef7f4;}function getTicket(_0x5a974d,_0x54c822,_0x409c21,_0x14c846,_0x25a47a,_0x5c508d){return function(_0x303128){logger[_0x9688('0x10')]('['+[_0x5a974d['toUpperCase']()]+_0x9688('0x3a'),_0x303128);return new Promise(function(_0x109243,_0x735164){var _0x4cab35=_0x5a974d[_0x9688('0x35')]()==='outbound'?_0x303128[_0x9688('0x1b')]:_0x303128[_0x9688('0x26')];var _0x150c11={'method':_0x9688('0x3b'),'uri':_0x409c21+'incident'+'?'+_0x5c508d,'body':Object[_0x9688('0x3c')]({},{'active':_0x9688('0x23'),'caller_id':_0x4cab35,'assigned_to':_0x303128[_0x9688('0x1b')],'short_description':intUtil[_0x9688('0x3d')](_0x14c846[_0x9688('0x3e')],_0x25a47a,'\x20'),'description':intUtil[_0x9688('0x3d')](_0x14c846['Descriptions'],_0x25a47a,'\x0a')},getCustomFields(_0x14c846[_0x9688('0x3f')],_0x25a47a)),'auth':_0x54c822,'json':!![]};return rp(_0x150c11)[_0x9688('0xd')](function(_0xebdaa0){logger[_0x9688('0x10')]('['+[_0x5a974d[_0x9688('0x14')]()]+_0x9688('0x40'),_0xebdaa0[_0x9688('0xe')]);_0x303128[_0x9688('0x41')]=_0xebdaa0[_0x9688('0xe')][_0x9688('0xf')];_0x303128[_0x9688('0x42')]=_0xebdaa0[_0x9688('0xe')][_0x9688('0x43')];logger[_0x9688('0x10')]('['+[_0x5a974d[_0x9688('0x14')]()]+_0x9688('0x44'),_0x303128);_0x109243(_0x303128);})[_0x9688('0x12')](function(_0x3bf3f7){logger[_0x9688('0x13')]('['+[_0x5a974d['toUpperCase']()]+']',_0x3bf3f7[_0x9688('0x15')]);_0x735164(_0x3bf3f7[_0x9688('0x15')]);});});};}function createRemoteTag(_0x3d5280,_0x1c8a96,_0xef0ff3,_0x377740){return new Promise(function(_0x583f97,_0x1078c3){var _0x3f7a73={'method':_0x9688('0x3b'),'uri':_0xef0ff3+'label'+'?'+_0x377740,'body':{'short_description':_0x3d5280,'global':!![],'active':!![],'name':_0x3d5280},'auth':_0x1c8a96,'json':!![]};return rp(_0x3f7a73)['then'](function(_0x1c016d){var _0x190c94=_0x1c016d[_0x9688('0xe')][_0x9688('0xf')];_0x583f97(_0x190c94);});});}function getRemoteTag(_0x2585c3,_0x277089,_0x218ecc,_0x22d42d,_0x3af16d){return new Promise(function(_0x523f91,_0x333a14){var _0x443148={'method':'GET','uri':_0x218ecc+_0x9688('0x45')+'?sysparm_query=name%3D'+_0x2585c3+'&'+_0x22d42d,'auth':_0x277089,'json':!![]};return rp(_0x443148)[_0x9688('0xd')](function(_0x310c38){if(_0x310c38[_0x9688('0xe')][_0x9688('0x29')]>0x0){var _0x214592=_0x310c38[_0x9688('0xe')][0x0][_0x9688('0xf')];_0x523f91(_0x214592);}else{return createRemoteTag(_0x2585c3,_0x277089,_0x218ecc,_0x22d42d)['then'](function(_0x58c19c){_0x523f91(_0x58c19c);});}});});}function assignTagToIncident(_0x31506c,_0x40c9bc,_0x3eac15,_0x3b1d99,_0x2626ad){return new Promise(function(_0x5f3a4a,_0x1e216e){var _0x3d2293={'method':_0x9688('0x3b'),'uri':_0x3eac15+_0x9688('0x46')+'?'+_0x2626ad,'body':{'label':_0x31506c,'table':_0x9688('0x47'),'id_type':_0x9688('0x48'),'table_key':_0x3b1d99['ticketId'],'title':_0x9688('0x49')+_0x3b1d99[_0x9688('0x42')],'id_display':_0x3b1d99[_0x9688('0x42')]},'auth':_0x40c9bc,'json':!![]};return rp(_0x3d2293)[_0x9688('0xd')](function(_0x53b094){_0x5f3a4a();})[_0x9688('0x12')](function(){_0x5f3a4a();});});}function manageTags(_0x282356,_0x1c681b,_0x50736b,_0x205a5c,_0x5f01f2,_0x8708e0,_0x402c4e){return new Promise(function(_0x283151,_0x4875f6){var _0x310dd3=[];_0x1c681b[_0x9688('0x2c')](function(_0x41200e){_0x310dd3[_0x9688('0x4a')](getRemoteTag(_0x41200e,_0x50736b,_0x205a5c,_0x8708e0,_0x402c4e));});return Promise[_0x9688('0x4b')](_0x310dd3)[_0x9688('0xd')](function(_0x26a856){if(_0x26a856[_0x9688('0x29')]){logger[_0x9688('0x10')]('['+[_0x282356[_0x9688('0x14')]()]+_0x9688('0x4c'),_0x26a856);var _0x4ac0e0=[];_0x26a856['forEach'](function(_0x36d552){_0x4ac0e0[_0x9688('0x4a')](assignTagToIncident(_0x36d552,_0x50736b,_0x205a5c,_0x5f01f2,_0x8708e0));});return Promise[_0x9688('0x4b')](_0x4ac0e0)[_0x9688('0xd')](function(){_0x283151();})['catch'](function(){_0x283151();});}else{_0x283151();}});});}function getTags(_0x33dd6e,_0x2e4756,_0x21309e,_0x14640c,_0x7598bc,_0x1c5fa7){return function(_0x2fb2a7){return new Promise(function(_0x1303d3,_0x34aaca){var _0xe1e0e=[];var _0x37ff23=_0x14640c[_0x9688('0x4d')];if(_0x37ff23&&_0x37ff23[_0x9688('0x29')]>0x0){_0xe1e0e=_['map'](_0x37ff23,_0x9688('0x39'));}if(_0xe1e0e[_0x9688('0x29')]>0x0){return manageTags(_0x33dd6e,_0xe1e0e,_0x2e4756,_0x21309e,_0x2fb2a7,_0x7598bc,_0x1c5fa7)[_0x9688('0xd')](function(){_0x1303d3(_0x2fb2a7);});}else{_0x1303d3(_0x2fb2a7);}});};}function emit(_0x27df6d,_0x125b3a,_0x5b12e7){var _0x2d8bf5=_0x9688('0x4e')+_0x9688('0x4f')+_0x9688('0x50')+_0x9688('0x51');var _0x20f479={'uri':_0x27df6d+_0x9688('0x52')+_0x5b12e7+_0x2d8bf5};io['to'](util[_0x9688('0x53')](_0x9688('0x54'),_0x125b3a))[_0x9688('0x55')]('trigger:browser:url',_0x20f479);}exports['cs']=function(_0x1f8359,_0x48f1f3,_0x1bcc77,_0x4f85e3,_0x16a53b,_0x157342,_0x3a032b,_0x456b34){var _0xa47ef6={};var _0x2dc3ff={'user':_0x157342[_0x9688('0x56')],'pass':_0x157342[_0x9688('0x57')]};var _0x47519b=_0x9688('0x58');var _0x7a3ed0=_0x9688('0x59');_0x157342[_0x9688('0x5a')]=intUtil[_0x9688('0x5b')](_0x157342[_0x9688('0x5a')]);_0x157342[_0x9688('0x5c')]=intUtil[_0x9688('0x5b')](_0x157342[_0x9688('0x5c')]);var _0x9adcfe=util[_0x9688('0x53')](_0x9688('0x5d'),_0x157342[_0x9688('0x5a')]);_0xa47ef6[_0x9688('0x17')]=!_[_0x9688('0x5e')](_0x4f85e3)?_0x4f85e3[_0x9688('0x5f')]:null;_0xa47ef6[_0x9688('0x1d')]=_0x157342[_0x9688('0x5f')];_0xa47ef6['endUserNumber']=_0x456b34[_0x9688('0x35')]()===_0x9688('0x60')?_0x48f1f3[_0x9688('0x61')]:_0x48f1f3[_0x9688('0x62')];_0xa47ef6[_0x9688('0x63')]=_0x456b34===_0x9688('0x64')||_0x456b34===_0x9688('0x65')?_0x9688('0x64'):_0x9688('0x60');var _0x42d48e=util['format'](_0x9688('0x66'),_0x157342[_0x9688('0x5c')],_0x48f1f3[_0x9688('0x67')],md5(_0x48f1f3[_0x9688('0x67')]));if(_0x16a53b&&_0x16a53b[_0x9688('0x68')]){logger[_0x9688('0x10')](_0x9688('0x69'),'Recording\x20is\x20enabled!');_0x48f1f3[_0x9688('0x6a')]=_0x42d48e;}else if(_0x3a032b&&_0x3a032b[_0x9688('0x6b')]&&_0x3a032b[_0x9688('0x6b')]!==_0x9688('0x6c')){logger[_0x9688('0x10')](_0x9688('0x6d'),'Recording\x20is\x20enabled!');_0x48f1f3[_0x9688('0x6a')]=_0x42d48e;}else{_0x48f1f3[_0x9688('0x6a')]='';}return getAdminUser(_0x456b34,_0x2dc3ff,_0xa47ef6,_0x9adcfe,_0x7a3ed0,_0x47519b)[_0x9688('0xd')](getUser(_0x456b34,_0x2dc3ff,_0x9adcfe,_0x7a3ed0,_0x47519b))[_0x9688('0xd')](getEndUser(_0x456b34,_0x2dc3ff,_0x9adcfe,_0x7a3ed0,_0x47519b))[_0x9688('0xd')](getTicket(_0x456b34,_0x2dc3ff,_0x9adcfe,_0x1bcc77,_0x48f1f3,_0x7a3ed0))['then'](function(_0x449d30){logger['info'](util[_0x9688('0x53')](_0x9688('0x6e'),_0x449d30[_0x9688('0x41')]));logger[_0x9688('0x10')](util['format'](_0x9688('0x6f'),_0x456b34));if(_0x456b34!==_0x9688('0x65')){logger['info']('['+[_0x456b34[_0x9688('0x14')]()]+']',_0x9688('0x70'));emit(_0x157342[_0x9688('0x5a')],_0x4f85e3['name'],_0x449d30[_0x9688('0x41')]);}})[_0x9688('0x12')](function(_0x3b10de){logger[_0x9688('0x13')]('['+[_0x456b34['toUpperCase']()]+_0x9688('0x71'),util[_0x9688('0x72')](_0x3b10de,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x998b=['type','customField','nameField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','name','outbound','incident','assign','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push','all','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','email','destcalleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','result','length','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminId','adminEmail','catch',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','System','],\x20EndUser\x20schema','endUserId','GET','sys_user?sysparm_query=phone%3D','then','sys_id','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist'];(function(_0x185e10,_0x51d15c){var _0x370fe8=function(_0x53bd15){while(--_0x53bd15){_0x185e10['push'](_0x185e10['shift']());}};_0x370fe8(++_0x51d15c);}(_0x998b,0x184));var _0xb998=function(_0x330a66,_0x524e97){_0x330a66=_0x330a66-0x0;var _0x4590ad=_0x998b[_0x330a66];return _0x4590ad;};'use strict';var _=require('lodash');var Promise=require(_0xb998('0x0'));var rp=require(_0xb998('0x1'));var util=require(_0xb998('0x2'));var md5=require(_0xb998('0x3'));var Redis=require(_0xb998('0x4'));var intUtil=require(_0xb998('0x5'));var config=require(_0xb998('0x6'));var logger=require('../../../../config/logger')('servicenow');config['redis']=_[_0xb998('0x7')](config[_0xb998('0x8')],{'host':_0xb998('0x9'),'port':0x18eb});var io=require(_0xb998('0xa'))(new Redis(config[_0xb998('0x8')]));function getAdminUser(_0x29d765,_0x306f26,_0x1897af,_0x5ba2c9,_0x5e5750,_0x361427){return new Promise(function(_0x1fff6a,_0x41d961){var _0x508cbd={'method':'GET','uri':_0x5ba2c9+_0xb998('0xb')+'&'+_0x5e5750+'&'+_0x361427,'auth':_0x306f26,'json':!![]};return rp(_0x508cbd)['then'](function(_0x5144cc){if(_0x5144cc[_0xb998('0xc')][_0xb998('0xd')]>0x0){_0x1897af['adminId']=_0x5144cc[_0xb998('0xc')][0x0]['sys_id'];}logger[_0xb998('0xe')]('['+[_0x29d765[_0xb998('0xf')]()]+_0xb998('0x10'),_0x1897af);_0x1fff6a(_0x1897af);})['catch'](function(_0x25c967){logger[_0xb998('0x11')]('['+[_0x29d765['toUpperCase']()]+']',_0x25c967[_0xb998('0x12')]);_0x41d961(_0x25c967[_0xb998('0x12')]);});});}function getUser(_0x2bc6e1,_0x26f4bf,_0x347d74,_0x14681a,_0x3686af){return function(_0x5e27ee){logger[_0xb998('0xe')]('['+[_0x2bc6e1['toUpperCase']()]+'],\x20getUser\x20input\x20crm',_0x5e27ee);return new Promise(function(_0x3eeef8,_0x3b1a1f){if(intUtil[_0xb998('0x13')](_0x5e27ee[_0xb998('0x14')])){var _0x4eadcb={'method':'GET','uri':_0x347d74+_0xb998('0x15')+_0x5e27ee[_0xb998('0x14')]+'&'+_0x14681a+'&'+_0x3686af,'auth':_0x26f4bf,'json':!![]};logger['info']('['+[_0x2bc6e1[_0xb998('0xf')]()]+_0xb998('0x16'),_0x4eadcb);return rp(_0x4eadcb)['then'](function(_0x3d4896){logger[_0xb998('0xe')]('['+[_0x2bc6e1[_0xb998('0xf')]()]+_0xb998('0x17'),_0x3d4896);if(_0x3d4896[_0xb998('0xc')]['length']>0x0&&String(_0x3d4896['result'][0x0][_0xb998('0x18')])===_0xb998('0x19')){_0x5e27ee['userId']=_0x3d4896['result'][0x0]['sys_id'];}else{_0x5e27ee[_0xb998('0x1a')]=_0x5e27ee[_0xb998('0x1b')];_0x5e27ee[_0xb998('0x14')]=_0x5e27ee[_0xb998('0x1c')];}logger['info']('['+[_0x2bc6e1[_0xb998('0xf')]()]+'],\x20getUser\x20crm',_0x5e27ee);_0x3eeef8(_0x5e27ee);})[_0xb998('0x1d')](function(_0x416955){logger[_0xb998('0x11')]('['+[_0x2bc6e1[_0xb998('0xf')]()]+']',_0x416955[_0xb998('0x12')]);_0x3b1a1f(_0x416955['message']);});}else{logger['info']('['+[_0x2bc6e1[_0xb998('0xf')]()]+_0xb998('0x1e'));_0x5e27ee['userId']=_0x5e27ee[_0xb998('0x1b')];_0x5e27ee[_0xb998('0x14')]=_0x5e27ee[_0xb998('0x1c')];_0x3eeef8(_0x5e27ee);}});};}function createEndUser(_0x122f27,_0x134999,_0x2ed97c,_0x4323c1,_0x8d2e3){logger[_0xb998('0xe')]('['+[_0x122f27[_0xb998('0xf')]()]+_0xb998('0x1f'),_0x2ed97c);return new Promise(function(_0x1ac557,_0x33ac7c){var _0x205eb0={'method':_0xb998('0x20'),'uri':_0x4323c1+_0xb998('0x21')+_0x8d2e3,'body':{'user_name':_0x2ed97c[_0xb998('0x22')],'roles':'user','first_name':_0x2ed97c[_0xb998('0x22')],'active':'true','date_format':_0xb998('0x23'),'phone':_0x2ed97c[_0xb998('0x22')]},'auth':_0x134999,'json':!![]};return rp(_0x205eb0)['then'](function(_0x4db2e9){logger[_0xb998('0xe')]('['+[_0x122f27[_0xb998('0xf')]()]+_0xb998('0x24'),_0x4db2e9[_0xb998('0xc')]);_0x2ed97c[_0xb998('0x25')]=_0x4db2e9['result']['sys_id'];_0x1ac557(_0x2ed97c);})[_0xb998('0x1d')](function(_0x3b022c){logger[_0xb998('0x11')]('['+[_0x122f27['toUpperCase']()]+']',_0x3b022c['message']);_0x33ac7c(_0x3b022c['message']);});});}function getEndUser(_0x2889a9,_0x2d1226,_0x200b4e,_0x5bb1a3,_0x18adb7){return function(_0x222ed6){logger[_0xb998('0xe')]('['+[_0x2889a9[_0xb998('0xf')]()]+'],\x20getEndUser\x20input\x20crm',_0x222ed6);return new Promise(function(_0x2530d0,_0x1538a5){var _0x299f99={'method':_0xb998('0x26'),'uri':_0x200b4e+_0xb998('0x27')+_0x222ed6[_0xb998('0x22')]+'&'+_0x5bb1a3+'&'+_0x18adb7,'auth':_0x2d1226,'json':!![]};return rp(_0x299f99)[_0xb998('0x28')](function(_0x4efa7f){if(_0x4efa7f[_0xb998('0xc')][_0xb998('0xd')]>0x0){_0x222ed6[_0xb998('0x25')]=_0x4efa7f['result'][0x0][_0xb998('0x29')];logger[_0xb998('0xe')]('['+[_0x2889a9[_0xb998('0xf')]()]+_0xb998('0x2a'),_0x222ed6);_0x2530d0(_0x222ed6);}else{return createEndUser(_0x2889a9,_0x2d1226,_0x222ed6,_0x200b4e,_0x5bb1a3)[_0xb998('0x28')](function(_0x420201){logger[_0xb998('0xe')]('['+[_0x2889a9[_0xb998('0xf')]()]+_0xb998('0x2b'),_0x420201);_0x2530d0(_0x420201);});}})['catch'](function(_0x23ef5c){logger[_0xb998('0x11')]('['+[_0x2889a9['toUpperCase']()]+']',_0x23ef5c[_0xb998('0x12')]);_0x1538a5(_0x23ef5c[_0xb998('0x12')]);});});};}function getCustomFields(_0x2d2b1f,_0x4503d8){var _0x3f947b={};if(_0x2d2b1f['length']>0x0){_[_0xb998('0x2c')](_0x2d2b1f,function(_0xe5a660){if(_[_0xb998('0x2d')]([_0xb998('0x2e'),_0xb998('0x2f')],_0xe5a660[_0xb998('0x30')])&&_0xe5a660['nameField']&&!_0xe5a660[_0xb998('0x31')]){_0x3f947b[_0xe5a660[_0xb998('0x32')][_0xb998('0x33')]()]=_0xe5a660[_0xb998('0x34')][_0xb998('0x35')]();}else if(_['includes']([_0xb998('0x2e'),_0xb998('0x2f')],_0xe5a660[_0xb998('0x30')])&&_0xe5a660[_0xb998('0x36')]&&_0xe5a660['customField']){_0x3f947b[_0xe5a660[_0xb998('0x36')][_0xb998('0x33')]()]=_0xe5a660['content'][_0xb998('0x35')]();}else if(_0xe5a660[_0xb998('0x30')]===_0xb998('0x37')&&_0xe5a660['variableName']&&_0xe5a660[_0xb998('0x36')]&&_0xe5a660[_0xb998('0x31')]){_0x3f947b[_0xe5a660[_0xb998('0x36')][_0xb998('0x33')]()]=_0x4503d8[_0xe5a660[_0xb998('0x38')]][_0xb998('0x35')]();}else if(_0xe5a660['type']===_0xb998('0x39')&&_0xe5a660[_0xb998('0x3a')]&&_0xe5a660[_0xb998('0x3a')][_0xb998('0x3b')]&&_0xe5a660[_0xb998('0x36')]&&_0xe5a660[_0xb998('0x31')]){_0x3f947b[_0xe5a660[_0xb998('0x36')][_0xb998('0x33')]()]=_0x4503d8[_0xe5a660[_0xb998('0x3a')][_0xb998('0x3b')][_0xb998('0x33')]()][_0xb998('0x35')]();}});}return _0x3f947b;}function getTicket(_0x311a0b,_0x444525,_0x4187b0,_0x2e4e7a,_0x190559,_0x1a87b4){return function(_0x2b7286){logger[_0xb998('0xe')]('['+[_0x311a0b[_0xb998('0xf')]()]+']\x20getTicket\x20input\x20crm',_0x2b7286);return new Promise(function(_0xeb84bd,_0x1962b4){var _0x3f222b=_0x311a0b[_0xb998('0x33')]()===_0xb998('0x3c')?_0x2b7286[_0xb998('0x1a')]:_0x2b7286['endUserId'];var _0x52e8f0={'method':_0xb998('0x20'),'uri':_0x4187b0+_0xb998('0x3d')+'?'+_0x1a87b4,'body':Object[_0xb998('0x3e')]({},{'active':'true','caller_id':_0x3f222b,'assigned_to':_0x2b7286[_0xb998('0x1a')],'short_description':intUtil['getString'](_0x2e4e7a[_0xb998('0x3f')],_0x190559,'\x20'),'description':intUtil['getString'](_0x2e4e7a[_0xb998('0x40')],_0x190559,'\x0a')},getCustomFields(_0x2e4e7a[_0xb998('0x41')],_0x190559)),'auth':_0x444525,'json':!![]};return rp(_0x52e8f0)[_0xb998('0x28')](function(_0x455c23){logger['info']('['+[_0x311a0b[_0xb998('0xf')]()]+_0xb998('0x42'),_0x455c23['result']);_0x2b7286[_0xb998('0x43')]=_0x455c23[_0xb998('0xc')]['sys_id'];_0x2b7286[_0xb998('0x44')]=_0x455c23[_0xb998('0xc')][_0xb998('0x45')];logger[_0xb998('0xe')]('['+[_0x311a0b[_0xb998('0xf')]()]+']\x20getTicket\x20crm',_0x2b7286);_0xeb84bd(_0x2b7286);})['catch'](function(_0x142728){logger[_0xb998('0x11')]('['+[_0x311a0b[_0xb998('0xf')]()]+']',_0x142728[_0xb998('0x12')]);_0x1962b4(_0x142728['message']);});});};}function createRemoteTag(_0x3aeb6a,_0x25806a,_0x18b1ea,_0x38a310){return new Promise(function(_0x5f3695,_0x49faab){var _0x487805={'method':_0xb998('0x20'),'uri':_0x18b1ea+_0xb998('0x46')+'?'+_0x38a310,'body':{'short_description':_0x3aeb6a,'global':!![],'active':!![],'name':_0x3aeb6a},'auth':_0x25806a,'json':!![]};return rp(_0x487805)['then'](function(_0x9603ac){var _0x100990=_0x9603ac[_0xb998('0xc')]['sys_id'];_0x5f3695(_0x100990);});});}function getRemoteTag(_0x32b303,_0x66e419,_0x1c121a,_0x269611,_0x3eaa2){return new Promise(function(_0x4b9b5a,_0x472199){var _0x43a12e={'method':'GET','uri':_0x1c121a+_0xb998('0x46')+_0xb998('0x47')+_0x32b303+'&'+_0x269611,'auth':_0x66e419,'json':!![]};return rp(_0x43a12e)[_0xb998('0x28')](function(_0x28a910){if(_0x28a910[_0xb998('0xc')][_0xb998('0xd')]>0x0){var _0x16d856=_0x28a910[_0xb998('0xc')][0x0][_0xb998('0x29')];_0x4b9b5a(_0x16d856);}else{return createRemoteTag(_0x32b303,_0x66e419,_0x1c121a,_0x269611)['then'](function(_0x23e730){_0x4b9b5a(_0x23e730);});}});});}function assignTagToIncident(_0x2a3bd1,_0x45a89b,_0x7465ed,_0x2146cd,_0x35249a){return new Promise(function(_0x281600,_0x138eda){var _0xe084c6={'method':_0xb998('0x20'),'uri':_0x7465ed+_0xb998('0x48')+'?'+_0x35249a,'body':{'label':_0x2a3bd1,'table':'incident','id_type':_0xb998('0x49'),'table_key':_0x2146cd[_0xb998('0x43')],'title':_0xb998('0x4a')+_0x2146cd[_0xb998('0x44')],'id_display':_0x2146cd[_0xb998('0x44')]},'auth':_0x45a89b,'json':!![]};return rp(_0xe084c6)[_0xb998('0x28')](function(_0x4fc2e5){_0x281600();})[_0xb998('0x1d')](function(){_0x281600();});});}function manageTags(_0x44c602,_0x152630,_0x3ef320,_0x5026b6,_0x204649,_0xb37b9c,_0x3ac93f){return new Promise(function(_0xb982de,_0x40c25a){var _0x770d7c=[];_0x152630[_0xb998('0x2c')](function(_0x178358){_0x770d7c[_0xb998('0x4b')](getRemoteTag(_0x178358,_0x3ef320,_0x5026b6,_0xb37b9c,_0x3ac93f));});return Promise[_0xb998('0x4c')](_0x770d7c)[_0xb998('0x28')](function(_0x1a022b){if(_0x1a022b[_0xb998('0xd')]){logger['info']('['+[_0x44c602[_0xb998('0xf')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x1a022b);var _0x52e684=[];_0x1a022b[_0xb998('0x2c')](function(_0x230fb3){_0x52e684['push'](assignTagToIncident(_0x230fb3,_0x3ef320,_0x5026b6,_0x204649,_0xb37b9c));});return Promise[_0xb998('0x4c')](_0x52e684)['then'](function(){_0xb982de();})[_0xb998('0x1d')](function(){_0xb982de();});}else{_0xb982de();}});});}function getTags(_0x5159b0,_0x491f28,_0x44645c,_0x47ea8b,_0x50735b,_0xddbe3c){return function(_0x3cc093){return new Promise(function(_0x2e05dd,_0x116355){var _0x7851a2=[];var _0x25f9e7=_0x47ea8b['Tags'];if(_0x25f9e7&&_0x25f9e7[_0xb998('0xd')]>0x0){_0x7851a2=_[_0xb998('0x4d')](_0x25f9e7,'name');}if(_0x7851a2[_0xb998('0xd')]>0x0){return manageTags(_0x5159b0,_0x7851a2,_0x491f28,_0x44645c,_0x3cc093,_0x50735b,_0xddbe3c)[_0xb998('0x28')](function(){_0x2e05dd(_0x3cc093);});}else{_0x2e05dd(_0x3cc093);}});};}function emit(_0x5d2317,_0x5dbda2,_0x3884b9){var _0x19efc6=_0xb998('0x4e')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xb998('0x4f')+_0xb998('0x50');var _0x31ef97={'uri':_0x5d2317+_0xb998('0x51')+_0x3884b9+_0x19efc6};io['to'](util[_0xb998('0x52')](_0xb998('0x53'),_0x5dbda2))[_0xb998('0x54')](_0xb998('0x55'),_0x31ef97);}exports['cs']=function(_0x251a2d,_0x1382e8,_0x4760ec,_0x200e0c,_0x5885cc,_0x485b47,_0x36bfc0,_0x416196){var _0x52dbbc={};var _0x2f34bb={'user':_0x485b47[_0xb998('0x56')],'pass':_0x485b47[_0xb998('0x57')]};var _0x1bbdd9=_0xb998('0x58');var _0x64a7c0=_0xb998('0x59');_0x485b47[_0xb998('0x5a')]=intUtil[_0xb998('0x5b')](_0x485b47[_0xb998('0x5a')]);_0x485b47['serverUrl']=intUtil[_0xb998('0x5b')](_0x485b47[_0xb998('0x5c')]);var _0x337ac1=util[_0xb998('0x52')]('%s/api/now/table/',_0x485b47[_0xb998('0x5a')]);_0x52dbbc[_0xb998('0x14')]=!_[_0xb998('0x5d')](_0x200e0c)?_0x200e0c[_0xb998('0x5e')]:null;_0x52dbbc[_0xb998('0x1c')]=_0x485b47[_0xb998('0x5e')];_0x52dbbc[_0xb998('0x22')]=_0x416196[_0xb998('0x33')]()==='outbound'?_0x1382e8[_0xb998('0x5f')]:_0x1382e8['calleridnum'];_0x52dbbc['callDirection']=_0x416196===_0xb998('0x60')||_0x416196===_0xb998('0x61')?'queue':_0xb998('0x3c');var _0x240070=util[_0xb998('0x52')](_0xb998('0x62'),_0x485b47[_0xb998('0x5c')],_0x1382e8['uniqueid'],md5(_0x1382e8[_0xb998('0x63')]));if(_0x5885cc&&_0x5885cc[_0xb998('0x64')]){logger[_0xb998('0xe')]('[QUEUE]','Recording\x20is\x20enabled!');_0x1382e8[_0xb998('0x65')]=_0x240070;}else if(_0x36bfc0&&_0x36bfc0[_0xb998('0x66')]&&_0x36bfc0['recordingFormat']!=='none'){logger[_0xb998('0xe')](_0xb998('0x67'),_0xb998('0x68'));_0x1382e8['recordingURL']=_0x240070;}else{_0x1382e8[_0xb998('0x65')]='';}return getAdminUser(_0x416196,_0x2f34bb,_0x52dbbc,_0x337ac1,_0x64a7c0,_0x1bbdd9)[_0xb998('0x28')](getUser(_0x416196,_0x2f34bb,_0x337ac1,_0x64a7c0,_0x1bbdd9))['then'](getEndUser(_0x416196,_0x2f34bb,_0x337ac1,_0x64a7c0,_0x1bbdd9))[_0xb998('0x28')](getTicket(_0x416196,_0x2f34bb,_0x337ac1,_0x4760ec,_0x1382e8,_0x64a7c0))[_0xb998('0x28')](function(_0x2641c7){logger[_0xb998('0xe')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x2641c7[_0xb998('0x43')]));logger['info'](util[_0xb998('0x52')](_0xb998('0x69'),_0x416196));if(_0x416196!==_0xb998('0x61')){logger['info']('['+[_0x416196[_0xb998('0xf')]()]+']',_0xb998('0x6a'));emit(_0x485b47[_0xb998('0x5a')],_0x200e0c['name'],_0x2641c7[_0xb998('0x43')]);}})[_0xb998('0x1d')](function(_0x29c8a0){logger[_0xb998('0x11')]('['+[_0x416196['toUpperCase']()]+_0xb998('0x6b'),util[_0xb998('0x6c')](_0x29c8a0,{'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 bf7655d..155b42a 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 _0xc5b6=['monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','uri','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridnum','Fields','Outbound','The\x20Ticket\x20ID\x20is:','users','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','trigger:browser:url','error','unmanaged','lastevent','toUpperCase','lodash','bluebird','md5','util','ioredis','../../../../config/environment','sugarcrm','redis','defaults','localhost','socket.io-emitter','emit','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_minutes','parent_type','parent_name','direction','forEach','variableName','push','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','get_server_info','isNil','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','entry_list','length','find','name_value_list','value','info','Agent\x20found!','resolve','user_name','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','then','Enduser\x20created.','debug','type','string','nameField','toLowerCase','content','customField','custom_fields','idField','variable','customVariable','Variable','POST','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xc5b6,0x195));var _0x6c5b=function(_0x5cf830,_0x2a6eac){_0x5cf830=_0x5cf830-0x0;var _0x2c4323=_0xc5b6[_0x5cf830];return _0x2c4323;};'use strict';var _=require(_0x6c5b('0x0'));var rp=require('request-promise');var BPromise=require(_0x6c5b('0x1'));var md5=require(_0x6c5b('0x2'));var util=require(_0x6c5b('0x3'));var Redis=require(_0x6c5b('0x4'));var intUtil=require('./util');var config=require(_0x6c5b('0x5'));var logger=require('../../../../config/logger')(_0x6c5b('0x6'));config[_0x6c5b('0x7')]=_[_0x6c5b('0x8')](config[_0x6c5b('0x7')],{'host':_0x6c5b('0x9'),'port':0x18eb});var io=require(_0x6c5b('0xa'))(new Redis(config[_0x6c5b('0x7')]));var def={'method':'POST','json':!![]};function emit(_0xc48a12,_0x561711,_0x2e44b6){io['to'](_0xc48a12)[_0x6c5b('0xb')](_0x561711,_0x2e44b6);}function getTicket(_0x38ac7e,_0xdb0f3a,_0x1bad13,_0x27ddde,_0x3f8d7b,_0x1f5e80,_0x405b6c,_0x461416){logger['info']('Creating\x20new\x20ticket...');var _0x27174b=new Date();var _0xa31545=[{'name':_0x6c5b('0xc'),'value':intUtil[_0x6c5b('0xd')](_0x27ddde[_0x6c5b('0xe')],_0x3f8d7b,'\x20')},{'name':_0x6c5b('0xf'),'value':_0xdb0f3a['id']},{'name':_0x6c5b('0x10'),'value':_0xdb0f3a['id']},{'name':_0x6c5b('0x11'),'value':intUtil[_0x6c5b('0xd')](_0x27ddde[_0x6c5b('0x12')],_0x3f8d7b,'\x0a')},{'name':_0x6c5b('0x13'),'value':_0x27174b[_0x6c5b('0x14')]()[_0x6c5b('0x15')](0x0,0x13)[_0x6c5b('0x16')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x6c5b('0x17'),'value':'15'},{'name':'parent_id','value':_0x1bad13['id']},{'name':_0x6c5b('0x18'),'value':'Contacts'},{'name':_0x6c5b('0x19'),'value':_0x1bad13[_0x6c5b('0xc')]},{'name':_0x6c5b('0x1a'),'value':_0x461416}];if(_0x1f5e80['length']){_[_0x6c5b('0x1b')](_0x1f5e80,function(_0x3b2a97){if(_0x3f8d7b[_0x3b2a97[_0x6c5b('0x1c')]]){_0xa31545[_0x6c5b('0x1d')]({'name':_0x3b2a97['idField'],'value':_0x3f8d7b[_0x3b2a97[_0x6c5b('0x1c')]]});}});}return request({'form':{'method':_0x6c5b('0x1e'),'input_type':_0x6c5b('0x1f'),'response_type':'JSON','rest_data':JSON[_0x6c5b('0x20')]({'session':_0x405b6c['id'],'module_name':_0x6c5b('0x21'),'name_value_list':_0xa31545})}});}function getAuth(_0x14bc52){return util[_0x6c5b('0x22')](_0x6c5b('0x23'),new Buffer(_0x14bc52[_0x6c5b('0x24')]+':X')[_0x6c5b('0x25')]('base64'));}function getServerInfo(_0x50265b){return request({'form':{'method':_0x6c5b('0x26'),'input_type':'JSON','response_type':_0x6c5b('0x1f'),'rest_data':JSON['stringify']({'session':_0x50265b['id']})}});}function getUser(_0x445cc3,_0x2ee819,_0x1cc741){if(!_[_0x6c5b('0x27')](_0x2ee819)){logger['info']('Getting\x20agent\x20with\x20name',_0x2ee819);return request({'form':{'method':'get_entry_list','input_type':_0x6c5b('0x1f'),'response_type':_0x6c5b('0x1f'),'rest_data':JSON[_0x6c5b('0x20')]({'session':_0x1cc741['id'],'module_name':_0x6c5b('0x28'),'query':util['format'](_0x6c5b('0x29'),_0x2ee819),'order_by':'','offset':'0','select_fields':['id',_0x6c5b('0xc'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x115288){if(_0x115288[_0x6c5b('0x2a')][_0x6c5b('0x2b')]){var _0x7e7bf4=_[_0x6c5b('0x2c')](_0x115288[_0x6c5b('0x2a')],function(_0x872983){return _0x872983[_0x6c5b('0x2d')]['user_name'][_0x6c5b('0x2e')]===_0x2ee819;});if(_0x7e7bf4){logger[_0x6c5b('0x2f')](_0x6c5b('0x30'));return BPromise[_0x6c5b('0x31')]({'id':_0x7e7bf4['name_value_list']['id'][_0x6c5b('0x2e')],'name':_0x7e7bf4[_0x6c5b('0x2d')][_0x6c5b('0xc')][_0x6c5b('0x2e')]});}}logger[_0x6c5b('0x2f')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x6c5b('0x31')]({'id':_0x1cc741['name_value_list']['user_id']['value'],'name':_0x1cc741[_0x6c5b('0x2d')][_0x6c5b('0x32')]['value']});});}else{logger['info'](_0x6c5b('0x33'));return BPromise[_0x6c5b('0x31')]({'id':_0x1cc741['name_value_list'][_0x6c5b('0x34')]['value'],'name':_0x1cc741['name_value_list'][_0x6c5b('0x32')]['value']});}}function getEndUser(_0x47eb70,_0xc6d1db,_0x1bf3fb,_0x1d6768){logger['info'](_0x6c5b('0x35'),_0x1bf3fb);return request({'form':{'method':_0x6c5b('0x36'),'input_type':'JSON','response_type':_0x6c5b('0x1f'),'rest_data':JSON[_0x6c5b('0x20')]({'session':_0x1d6768['id'],'module_name':_0x6c5b('0x37'),'query':util[_0x6c5b('0x22')](_0x6c5b('0x38'),_0x1bf3fb),'order_by':'','offset':'0','select_fields':['id',_0x6c5b('0xc'),_0x6c5b('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x4f57b2){if(_0x4f57b2['entry_list']['length']){var _0x32927c=_[_0x6c5b('0x2c')](_0x4f57b2['entry_list'],function(_0x4a0d47){return _0x4a0d47[_0x6c5b('0x2d')][_0x6c5b('0x39')][_0x6c5b('0x2e')]===_0x1bf3fb;});if(_0x32927c){logger['info'](_0x6c5b('0x3a'));return BPromise[_0x6c5b('0x31')]({'id':_0x32927c[_0x6c5b('0x2d')]['id'][_0x6c5b('0x2e')],'name':_0x32927c[_0x6c5b('0x2d')]['name']['value'],'phone':_0x32927c['name_value_list']['phone_home'][_0x6c5b('0x2e')]});}}else{logger[_0x6c5b('0x2f')](_0x6c5b('0x3b'));return request({'form':{'method':_0x6c5b('0x1e'),'input_type':_0x6c5b('0x1f'),'response_type':_0x6c5b('0x1f'),'rest_data':JSON[_0x6c5b('0x20')]({'session':_0x1d6768['id'],'module_name':_0x6c5b('0x37'),'name_value_list':[{'name':_0x6c5b('0x3c'),'value':_0xc6d1db!==_0x6c5b('0x3d')?_0xc6d1db:util[_0x6c5b('0x22')](_0x6c5b('0x3e'),_0x1bf3fb)},{'name':'phone_home','value':_0x1bf3fb}]})}})[_0x6c5b('0x3f')](function(_0xe6edfa){logger[_0x6c5b('0x2f')](_0x6c5b('0x40'));return BPromise[_0x6c5b('0x31')]({'id':_0xe6edfa['id'],'name':_0xe6edfa['entry_list'][_0x6c5b('0x3c')][_0x6c5b('0x2e')],'phone':_0xe6edfa[_0x6c5b('0x2a')][_0x6c5b('0x39')]['value']});});}});}function request(_0x5ecfb1){logger[_0x6c5b('0x41')]('[HTTP]',JSON[_0x6c5b('0x20')](_0x5ecfb1));return rp(_['merge'](def,_0x5ecfb1));}function getTags(_0x2a4b43,_0x47bb31){var _0x581350=[];if(_0x2a4b43&&_0x2a4b43['length']>0x0){_0x581350=_['map'](_0x2a4b43,_0x47bb31);}return _0x581350;}function getCustomFields(_0x5373bd,_0x4151e4){var _0x29f31e=[];var _0x26148d={'custom_fields':[]};if(_0x5373bd['length']>0x0){_[_0x6c5b('0x1b')](_0x5373bd,function(_0x389994){if(_0x389994[_0x6c5b('0x42')]===_0x6c5b('0x43')&&_0x389994[_0x6c5b('0x44')]&&!_0x389994['customField']){_0x26148d[_0x389994['nameField'][_0x6c5b('0x45')]()]=_0x389994[_0x6c5b('0x46')][_0x6c5b('0x25')]();}else if(_0x389994[_0x6c5b('0x42')]==='string'&&_0x389994['idField']&&_0x389994[_0x6c5b('0x47')]){_0x26148d[_0x6c5b('0x48')]['push']({'id':_0x389994[_0x6c5b('0x49')],'value':_0x389994[_0x6c5b('0x46')][_0x6c5b('0x25')]()});}else if(_0x389994[_0x6c5b('0x42')]===_0x6c5b('0x4a')&&_0x389994[_0x6c5b('0x1c')]&&_0x389994['idField']&&_0x389994['customField']){_0x4151e4[_0x389994[_0x6c5b('0x1c')]]&&_0x26148d[_0x6c5b('0x48')][_0x6c5b('0x1d')]({'id':_0x389994[_0x6c5b('0x49')],'value':_0x4151e4[_0x389994['variableName']]['toString']()});}else if(_0x389994[_0x6c5b('0x42')]===_0x6c5b('0x4b')&&_0x389994[_0x6c5b('0x4c')]&&_0x389994[_0x6c5b('0x4c')]['name']&&_0x389994[_0x6c5b('0x49')]&&_0x389994['customField']){_0x4151e4[_0x389994[_0x6c5b('0x4c')][_0x6c5b('0xc')][_0x6c5b('0x45')]()]&&_0x26148d[_0x6c5b('0x48')]['push']({'id':_0x389994[_0x6c5b('0x49')],'value':_0x4151e4[_0x389994[_0x6c5b('0x4c')]['name']['toLowerCase']()]['toString']()});}});}return _0x26148d;}function getConnection(_0x517871){return request({'method':_0x6c5b('0x4d'),'form':{'method':_0x6c5b('0x4e'),'input_type':_0x6c5b('0x1f'),'response_type':_0x6c5b('0x1f'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x517871[_0x6c5b('0x4f')],'password':_0x517871[_0x6c5b('0x50')],'encryption':_0x6c5b('0x51')},'application':_0x6c5b('0x52')})}})[_0x6c5b('0x3f')](function(_0x5eba87){var _0x35b584=_0x5eba87;if(_0x35b584['id']){def[_0x6c5b('0x53')]=_0x35b584['id'];return BPromise[_0x6c5b('0x31')](_0x35b584);}else{throw new Error(util[_0x6c5b('0x22')](_0x6c5b('0x54'),_0x517871['id']));}});}function setRelationship(_0x28e61b,_0x4c70c1,_0x4deff9,_0x545705){return request({'form':{'method':_0x6c5b('0x55'),'input_type':'JSON','response_type':_0x6c5b('0x1f'),'rest_data':JSON[_0x6c5b('0x20')]({'session':_0x28e61b['id'],'module_name':_0x6c5b('0x21'),'module_id':_0x4deff9['id'],'link_field_name':_0x545705,'related_ids':[_0x4c70c1['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x6c5b('0x56')]=function(_0x44d8d9,_0x5c918f,_0x2dedb3,_0x32b6e2,_0x347441,_0x217c8f){var _0x351b3a,_0x511daf,_0x29ca09,_0x188d87;_0x217c8f[_0x6c5b('0x57')]=intUtil[_0x6c5b('0x58')](_0x217c8f[_0x6c5b('0x57')]);_0x217c8f['serverUrl']=intUtil[_0x6c5b('0x58')](_0x217c8f[_0x6c5b('0x59')]);def['uri']=util[_0x6c5b('0x22')](_0x6c5b('0x5a'),_0x217c8f[_0x6c5b('0x57')]);if(_0x347441&&_0x347441[_0x6c5b('0x5b')]){logger[_0x6c5b('0x2f')](_0x6c5b('0x5c'),_0x6c5b('0x5d'));_0x5c918f[_0x6c5b('0x5e')]=util['format'](_0x6c5b('0x5f'),_0x217c8f['serverUrl'],_0x5c918f['uniqueid'],md5(_0x5c918f[_0x6c5b('0x60')]));}else{_0x5c918f[_0x6c5b('0x5e')]='';}return getConnection(_0x217c8f)[_0x6c5b('0x3f')](function(_0x1c5127){_0x188d87=_0x1c5127;return getUser(_0x217c8f,_0x32b6e2['name'],_0x188d87);})[_0x6c5b('0x3f')](function(_0x13b480){_0x351b3a=_0x13b480;logger[_0x6c5b('0x2f')]('The\x20User\x20ID\x20is:',_0x351b3a['id']);return getEndUser(_0x217c8f,_0x5c918f[_0x6c5b('0x61')],_0x5c918f[_0x6c5b('0x62')],_0x188d87);})[_0x6c5b('0x3f')](function(_0x5a4bff){_0x511daf=_0x5a4bff;logger[_0x6c5b('0x2f')](_0x6c5b('0x63'),_0x511daf['id']);return getTicket(_0x217c8f,_0x351b3a,_0x511daf,_0x2dedb3,_0x5c918f,_0x2dedb3['Fields'],_0x188d87,_0x6c5b('0x64'));})['then'](function(_0x15cffa){_0x29ca09=_0x15cffa;logger['info'](_0x6c5b('0x65'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x29ca09['id']);return setRelationship(_0x188d87,_0x351b3a,_0x29ca09,'users');})[_0x6c5b('0x3f')](function(){return setRelationship(_0x188d87,_0x511daf,_0x29ca09,_0x6c5b('0x66'));})[_0x6c5b('0x3f')](function(){return getServerInfo(_0x188d87);})[_0x6c5b('0x3f')](function(_0x39d331){var _0x3a5065=parseInt(_0x39d331[_0x6c5b('0x67')][_0x6c5b('0x68')](0x0));var _0x22202e=util[_0x6c5b('0x22')](_0x6c5b('0x69'),_0x217c8f[_0x6c5b('0x57')],_0x29ca09['id']);if(_0x3a5065>0x6){_0x22202e=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x217c8f[_0x6c5b('0x57')],_0x29ca09['id']);}logger[_0x6c5b('0x2f')](_0x6c5b('0x5c'),_0x6c5b('0x6a'));emit(util[_0x6c5b('0x22')](_0x6c5b('0x6b'),_0x32b6e2['name']),'trigger:browser:url',{'uri':_0x22202e});})[_0x6c5b('0x6c')](function(_0x46b2cb){logger['error']('[QUEUE]',JSON[_0x6c5b('0x20')](_0x46b2cb));});};exports['outbound']=function(_0x113a3a,_0x7cc159,_0x468498,_0x17483f,_0xf936ef,_0x55d790,_0x2ee957){var _0x2680bb,_0x52bc74,_0x53baa4,_0x3ed6f3;_0x55d790['remoteUri']=intUtil[_0x6c5b('0x58')](_0x55d790[_0x6c5b('0x57')]);_0x55d790['serverUrl']=intUtil[_0x6c5b('0x58')](_0x55d790[_0x6c5b('0x59')]);def[_0x6c5b('0x6d')]=util[_0x6c5b('0x22')](_0x6c5b('0x5a'),_0x55d790[_0x6c5b('0x57')]);if(_0x2ee957&&_0x2ee957['recordingFormat']&&_0x2ee957[_0x6c5b('0x6e')]!=='none'){logger[_0x6c5b('0x2f')](_0x6c5b('0x6f'),_0x6c5b('0x5d'));_0x7cc159[_0x6c5b('0x5e')]=util['format'](_0x6c5b('0x5f'),_0x55d790[_0x6c5b('0x59')],_0x7cc159[_0x6c5b('0x60')],md5(_0x7cc159['uniqueid']));}return getConnection(_0x55d790)[_0x6c5b('0x3f')](function(_0x4271f1){_0x3ed6f3=_0x4271f1;return getUser(_0x55d790,_0x17483f[_0x6c5b('0xc')],_0x3ed6f3);})[_0x6c5b('0x3f')](function(_0x58d666){_0x2680bb=_0x58d666;logger[_0x6c5b('0x2f')](_0x6c5b('0x70'),_0x2680bb['id']);return getEndUser(_0x55d790,_0x7cc159['destcalleridname'],_0x7cc159[_0x6c5b('0x71')],_0x3ed6f3);})[_0x6c5b('0x3f')](function(_0x238ab8){_0x52bc74=_0x238ab8;logger[_0x6c5b('0x2f')](_0x6c5b('0x63'),_0x52bc74['id']);return getTicket(_0x55d790,_0x2680bb,_0x52bc74,_0x468498,_0x7cc159,_0x468498[_0x6c5b('0x72')],_0x3ed6f3,_0x6c5b('0x73'));})[_0x6c5b('0x3f')](function(_0xc94010){_0x53baa4=_0xc94010;logger[_0x6c5b('0x2f')](_0x6c5b('0x65'));logger['info'](_0x6c5b('0x74'),_0x53baa4['id']);return setRelationship(_0x3ed6f3,_0x2680bb,_0x53baa4,_0x6c5b('0x75'));})[_0x6c5b('0x3f')](function(){return setRelationship(_0x3ed6f3,_0x52bc74,_0x53baa4,_0x6c5b('0x66'));})['then'](function(){return getServerInfo(_0x3ed6f3);})['then'](function(_0x141b61){var _0x573ba3=parseInt(_0x141b61[_0x6c5b('0x67')][_0x6c5b('0x68')](0x0));var _0x487964=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x55d790[_0x6c5b('0x57')],_0x53baa4['id']);if(_0x573ba3>0x6){_0x487964=util['format'](_0x6c5b('0x76'),_0x55d790[_0x6c5b('0x57')],_0x53baa4['id']);}logger[_0x6c5b('0x2f')](_0x6c5b('0x6f'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6c5b('0x22')](_0x6c5b('0x6b'),_0x17483f['name']),_0x6c5b('0x77'),{'uri':_0x487964});})[_0x6c5b('0x6c')](function(_0x5204f3){logger[_0x6c5b('0x78')]('[OUTBOUND]',JSON[_0x6c5b('0x20')](_0x5204f3));});};exports[_0x6c5b('0x79')]=function(_0x4097e4,_0x129d5d,_0x53df5b,_0x875a67,_0x121604,_0x2d945f){var _0x554a14,_0x2252e6,_0x44ab7d,_0x4ddd4c;_0x2d945f[_0x6c5b('0x57')]=intUtil[_0x6c5b('0x58')](_0x2d945f[_0x6c5b('0x57')]);_0x2d945f[_0x6c5b('0x59')]=intUtil[_0x6c5b('0x58')](_0x2d945f[_0x6c5b('0x59')]);def[_0x6c5b('0x6d')]=util[_0x6c5b('0x22')](_0x6c5b('0x5a'),_0x2d945f[_0x6c5b('0x57')]);if(_0x121604&&_0x121604[_0x6c5b('0x5b')]){logger['info']('['+_0x129d5d[_0x6c5b('0x7a')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x129d5d['recordingURL']=util[_0x6c5b('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2d945f[_0x6c5b('0x59')],_0x129d5d['uniqueid'],md5(_0x129d5d[_0x6c5b('0x60')]));}else{_0x129d5d[_0x6c5b('0x5e')]='';}return getConnection(_0x2d945f)[_0x6c5b('0x3f')](function(_0x337284){_0x4ddd4c=_0x337284;if(!_['isNil'](_0x875a67)){return getUser(_0x2d945f,_0x875a67[_0x6c5b('0xc')],_0x4ddd4c);}else{return getUser(_0x2d945f,null,_0x4ddd4c);}})[_0x6c5b('0x3f')](function(_0x5154a3){_0x554a14=_0x5154a3;logger[_0x6c5b('0x2f')](_0x6c5b('0x70'),_0x554a14['id']);return getEndUser(_0x2d945f,_0x129d5d[_0x6c5b('0x61')],_0x129d5d['calleridnum'],_0x4ddd4c);})[_0x6c5b('0x3f')](function(_0x343472){_0x2252e6=_0x343472;logger[_0x6c5b('0x2f')]('The\x20Enduser\x20ID\x20is:',_0x2252e6['id']);return getTicket(_0x2d945f,_0x554a14,_0x2252e6,_0x53df5b,_0x129d5d,_0x53df5b[_0x6c5b('0x72')],_0x4ddd4c,_0x6c5b('0x64'));})[_0x6c5b('0x3f')](function(_0x24475f){_0x44ab7d=_0x24475f;logger[_0x6c5b('0x2f')]('Ticket\x20created!');logger[_0x6c5b('0x2f')](_0x6c5b('0x74'),_0x44ab7d['id']);return setRelationship(_0x4ddd4c,_0x554a14,_0x44ab7d,_0x6c5b('0x75'));})['then'](function(){return setRelationship(_0x4ddd4c,_0x2252e6,_0x44ab7d,_0x6c5b('0x66'));})[_0x6c5b('0x3f')](function(){return getServerInfo(_0x4ddd4c);})[_0x6c5b('0x6c')](function(_0x29e0f8){logger['error']('['+_0x129d5d[_0x6c5b('0x7a')][_0x6c5b('0x7b')]()+']',JSON[_0x6c5b('0x20')](_0x29e0f8));});}; \ No newline at end of file +var _0x81ac=['sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','remoteUri','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','trigger:browser:url','catch','error','outbound','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Outbound','contacts','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','uri','lastevent','toUpperCase','isNil','calleridname','lodash','bluebird','md5','util','ioredis','./util','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','parent_id','parent_type','Contacts','length','forEach','variableName','idField','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','toString','base64','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','find','value','info','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','phone_home','then','Enduser\x20found!','first_name','','Caller\x20-\x20%s','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','content','custom_fields','variable','push','customVariable','Variable','login','password','PLAIN','xCALLY\x20Motion\x20integration'];(function(_0x4b1c44,_0x13151c){var _0x89731=function(_0x18a1c5){while(--_0x18a1c5){_0x4b1c44['push'](_0x4b1c44['shift']());}};_0x89731(++_0x13151c);}(_0x81ac,0xaa));var _0xc81a=function(_0x4c82ff,_0x4675bb){_0x4c82ff=_0x4c82ff-0x0;var _0x4d3c6e=_0x81ac[_0x4c82ff];return _0x4d3c6e;};'use strict';var _=require(_0xc81a('0x0'));var rp=require('request-promise');var BPromise=require(_0xc81a('0x1'));var md5=require(_0xc81a('0x2'));var util=require(_0xc81a('0x3'));var Redis=require(_0xc81a('0x4'));var intUtil=require(_0xc81a('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xc81a('0x6'));config[_0xc81a('0x7')]=_[_0xc81a('0x8')](config[_0xc81a('0x7')],{'host':_0xc81a('0x9'),'port':0x18eb});var io=require(_0xc81a('0xa'))(new Redis(config[_0xc81a('0x7')]));var def={'method':_0xc81a('0xb'),'json':!![]};function emit(_0x3e0c67,_0x154413,_0x2061f3){io['to'](_0x3e0c67)[_0xc81a('0xc')](_0x154413,_0x2061f3);}function getTicket(_0x4b706e,_0x45be3c,_0x5b0710,_0x2ed5c7,_0x10de89,_0x5ad31c,_0x32c82d,_0x1ce10c){logger['info'](_0xc81a('0xd'));var _0x34b4c2=new Date();var _0x27241a=[{'name':_0xc81a('0xe'),'value':intUtil[_0xc81a('0xf')](_0x2ed5c7[_0xc81a('0x10')],_0x10de89,'\x20')},{'name':_0xc81a('0x11'),'value':_0x45be3c['id']},{'name':_0xc81a('0x12'),'value':_0x45be3c['id']},{'name':_0xc81a('0x13'),'value':intUtil[_0xc81a('0xf')](_0x2ed5c7[_0xc81a('0x14')],_0x10de89,'\x0a')},{'name':_0xc81a('0x15'),'value':_0x34b4c2[_0xc81a('0x16')]()[_0xc81a('0x17')](0x0,0x13)[_0xc81a('0x18')]('T','\x20')},{'name':_0xc81a('0x19'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xc81a('0x1a'),'value':_0x5b0710['id']},{'name':_0xc81a('0x1b'),'value':_0xc81a('0x1c')},{'name':'parent_name','value':_0x5b0710[_0xc81a('0xe')]},{'name':'direction','value':_0x1ce10c}];if(_0x5ad31c[_0xc81a('0x1d')]){_[_0xc81a('0x1e')](_0x5ad31c,function(_0xd9113c){if(_0x10de89[_0xd9113c[_0xc81a('0x1f')]]){_0x27241a['push']({'name':_0xd9113c[_0xc81a('0x20')],'value':_0x10de89[_0xd9113c['variableName']]});}});}return request({'form':{'method':_0xc81a('0x21'),'input_type':_0xc81a('0x22'),'response_type':'JSON','rest_data':JSON[_0xc81a('0x23')]({'session':_0x32c82d['id'],'module_name':'Calls','name_value_list':_0x27241a})}});}function getAuth(_0x40e9e0){return util[_0xc81a('0x24')](_0xc81a('0x25'),new Buffer(_0x40e9e0[_0xc81a('0x26')]+':X')[_0xc81a('0x27')](_0xc81a('0x28')));}function getServerInfo(_0x5f1c57){return request({'form':{'method':_0xc81a('0x29'),'input_type':_0xc81a('0x22'),'response_type':_0xc81a('0x22'),'rest_data':JSON[_0xc81a('0x23')]({'session':_0x5f1c57['id']})}});}function getUser(_0x2add2d,_0x2ef0dc,_0x414ce4){if(!_['isNil'](_0x2ef0dc)){logger['info'](_0xc81a('0x2a'),_0x2ef0dc);return request({'form':{'method':_0xc81a('0x2b'),'input_type':_0xc81a('0x22'),'response_type':_0xc81a('0x22'),'rest_data':JSON[_0xc81a('0x23')]({'session':_0x414ce4['id'],'module_name':_0xc81a('0x2c'),'query':util[_0xc81a('0x24')](_0xc81a('0x2d'),_0x2ef0dc),'order_by':'','offset':'0','select_fields':['id',_0xc81a('0xe'),_0xc81a('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x27f9cd){if(_0x27f9cd[_0xc81a('0x2f')][_0xc81a('0x1d')]){var _0x36e406=_[_0xc81a('0x30')](_0x27f9cd[_0xc81a('0x2f')],function(_0x5c8c0b){return _0x5c8c0b['name_value_list'][_0xc81a('0x2e')][_0xc81a('0x31')]===_0x2ef0dc;});if(_0x36e406){logger[_0xc81a('0x32')](_0xc81a('0x33'));return BPromise[_0xc81a('0x34')]({'id':_0x36e406[_0xc81a('0x35')]['id'][_0xc81a('0x31')],'name':_0x36e406[_0xc81a('0x35')][_0xc81a('0xe')][_0xc81a('0x31')]});}}logger['info'](_0xc81a('0x36'));return BPromise[_0xc81a('0x34')]({'id':_0x414ce4[_0xc81a('0x35')][_0xc81a('0x37')][_0xc81a('0x31')],'name':_0x414ce4[_0xc81a('0x35')][_0xc81a('0x2e')]['value']});});}else{logger[_0xc81a('0x32')](_0xc81a('0x38'));return BPromise['resolve']({'id':_0x414ce4[_0xc81a('0x35')][_0xc81a('0x37')][_0xc81a('0x31')],'name':_0x414ce4[_0xc81a('0x35')][_0xc81a('0x2e')][_0xc81a('0x31')]});}}function getEndUser(_0x20c64d,_0x1b754a,_0x420dd2,_0x1c5c6c){logger[_0xc81a('0x32')](_0xc81a('0x39'),_0x420dd2);return request({'form':{'method':_0xc81a('0x2b'),'input_type':_0xc81a('0x22'),'response_type':_0xc81a('0x22'),'rest_data':JSON[_0xc81a('0x23')]({'session':_0x1c5c6c['id'],'module_name':_0xc81a('0x1c'),'query':util[_0xc81a('0x24')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x420dd2),'order_by':'','offset':'0','select_fields':['id',_0xc81a('0xe'),_0xc81a('0x3a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xc81a('0x3b')](function(_0x4c7d9d){if(_0x4c7d9d[_0xc81a('0x2f')][_0xc81a('0x1d')]){var _0x7aa5b5=_[_0xc81a('0x30')](_0x4c7d9d['entry_list'],function(_0x31f479){return _0x31f479['name_value_list'][_0xc81a('0x3a')]['value']===_0x420dd2;});if(_0x7aa5b5){logger[_0xc81a('0x32')](_0xc81a('0x3c'));return BPromise[_0xc81a('0x34')]({'id':_0x7aa5b5[_0xc81a('0x35')]['id'][_0xc81a('0x31')],'name':_0x7aa5b5[_0xc81a('0x35')][_0xc81a('0xe')]['value'],'phone':_0x7aa5b5[_0xc81a('0x35')][_0xc81a('0x3a')][_0xc81a('0x31')]});}}else{logger[_0xc81a('0x32')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xc81a('0x21'),'input_type':'JSON','response_type':_0xc81a('0x22'),'rest_data':JSON[_0xc81a('0x23')]({'session':_0x1c5c6c['id'],'module_name':'Contacts','name_value_list':[{'name':_0xc81a('0x3d'),'value':_0x1b754a!==_0xc81a('0x3e')?_0x1b754a:util[_0xc81a('0x24')](_0xc81a('0x3f'),_0x420dd2)},{'name':_0xc81a('0x3a'),'value':_0x420dd2}]})}})['then'](function(_0x114e37){logger[_0xc81a('0x32')]('Enduser\x20created.');return BPromise[_0xc81a('0x34')]({'id':_0x114e37['id'],'name':_0x114e37['entry_list'][_0xc81a('0x3d')]['value'],'phone':_0x114e37[_0xc81a('0x2f')][_0xc81a('0x3a')][_0xc81a('0x31')]});});}});}function request(_0x12ec3d){logger['debug'](_0xc81a('0x40'),JSON[_0xc81a('0x23')](_0x12ec3d));return rp(_[_0xc81a('0x41')](def,_0x12ec3d));}function getTags(_0x5f43e3,_0x445731){var _0x5dab14=[];if(_0x5f43e3&&_0x5f43e3[_0xc81a('0x1d')]>0x0){_0x5dab14=_[_0xc81a('0x42')](_0x5f43e3,_0x445731);}return _0x5dab14;}function getCustomFields(_0x5652a3,_0x4036aa){var _0x1417a0=[];var _0x3371cd={'custom_fields':[]};if(_0x5652a3['length']>0x0){_['forEach'](_0x5652a3,function(_0x3fa66c){if(_0x3fa66c[_0xc81a('0x43')]===_0xc81a('0x44')&&_0x3fa66c[_0xc81a('0x45')]&&!_0x3fa66c[_0xc81a('0x46')]){_0x3371cd[_0x3fa66c[_0xc81a('0x45')][_0xc81a('0x47')]()]=_0x3fa66c[_0xc81a('0x48')]['toString']();}else if(_0x3fa66c['type']===_0xc81a('0x44')&&_0x3fa66c[_0xc81a('0x20')]&&_0x3fa66c[_0xc81a('0x46')]){_0x3371cd[_0xc81a('0x49')]['push']({'id':_0x3fa66c[_0xc81a('0x20')],'value':_0x3fa66c[_0xc81a('0x48')][_0xc81a('0x27')]()});}else if(_0x3fa66c[_0xc81a('0x43')]===_0xc81a('0x4a')&&_0x3fa66c[_0xc81a('0x1f')]&&_0x3fa66c['idField']&&_0x3fa66c[_0xc81a('0x46')]){_0x4036aa[_0x3fa66c['variableName']]&&_0x3371cd[_0xc81a('0x49')][_0xc81a('0x4b')]({'id':_0x3fa66c['idField'],'value':_0x4036aa[_0x3fa66c[_0xc81a('0x1f')]][_0xc81a('0x27')]()});}else if(_0x3fa66c[_0xc81a('0x43')]===_0xc81a('0x4c')&&_0x3fa66c[_0xc81a('0x4d')]&&_0x3fa66c[_0xc81a('0x4d')][_0xc81a('0xe')]&&_0x3fa66c['idField']&&_0x3fa66c[_0xc81a('0x46')]){_0x4036aa[_0x3fa66c['Variable'][_0xc81a('0xe')][_0xc81a('0x47')]()]&&_0x3371cd['custom_fields'][_0xc81a('0x4b')]({'id':_0x3fa66c[_0xc81a('0x20')],'value':_0x4036aa[_0x3fa66c[_0xc81a('0x4d')][_0xc81a('0xe')][_0xc81a('0x47')]()][_0xc81a('0x27')]()});}});}return _0x3371cd;}function getConnection(_0x238171){return request({'method':_0xc81a('0xb'),'form':{'method':_0xc81a('0x4e'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xc81a('0x23')]({'user_auth':{'user_name':_0x238171['username'],'password':_0x238171[_0xc81a('0x4f')],'encryption':_0xc81a('0x50')},'application':_0xc81a('0x51')})}})[_0xc81a('0x3b')](function(_0x45dfb7){var _0x421e7a=_0x45dfb7;if(_0x421e7a['id']){def[_0xc81a('0x52')]=_0x421e7a['id'];return BPromise[_0xc81a('0x34')](_0x421e7a);}else{throw new Error(util['format'](_0xc81a('0x53'),_0x238171['id']));}});}function setRelationship(_0x395252,_0x45f7f0,_0x2eda1f,_0x4ea779){return request({'form':{'method':_0xc81a('0x54'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xc81a('0x23')]({'session':_0x395252['id'],'module_name':_0xc81a('0x55'),'module_id':_0x2eda1f['id'],'link_field_name':_0x4ea779,'related_ids':[_0x45f7f0['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x73ee7e,_0x1e2836,_0x12b7bc,_0x131d33,_0x4f5ffd,_0xba2ccf){var _0x316b70,_0x367102,_0x3c068d,_0x11e929;_0xba2ccf[_0xc81a('0x56')]=intUtil[_0xc81a('0x57')](_0xba2ccf['remoteUri']);_0xba2ccf[_0xc81a('0x58')]=intUtil[_0xc81a('0x57')](_0xba2ccf['serverUrl']);def['uri']=util['format']('%s/service/v4_1/rest.php',_0xba2ccf[_0xc81a('0x56')]);if(_0x4f5ffd&&_0x4f5ffd[_0xc81a('0x59')]){logger[_0xc81a('0x32')](_0xc81a('0x5a'),'Recording\x20is\x20enabled!');_0x1e2836[_0xc81a('0x5b')]=util[_0xc81a('0x24')](_0xc81a('0x5c'),_0xba2ccf[_0xc81a('0x58')],_0x1e2836[_0xc81a('0x5d')],md5(_0x1e2836[_0xc81a('0x5d')]));}else{_0x1e2836[_0xc81a('0x5b')]='';}return getConnection(_0xba2ccf)[_0xc81a('0x3b')](function(_0x451ed4){_0x11e929=_0x451ed4;return getUser(_0xba2ccf,_0x131d33['name'],_0x11e929);})[_0xc81a('0x3b')](function(_0x42efbd){_0x316b70=_0x42efbd;logger[_0xc81a('0x32')](_0xc81a('0x5e'),_0x316b70['id']);return getEndUser(_0xba2ccf,_0x1e2836['calleridname'],_0x1e2836[_0xc81a('0x5f')],_0x11e929);})['then'](function(_0x8a44c){_0x367102=_0x8a44c;logger[_0xc81a('0x32')](_0xc81a('0x60'),_0x367102['id']);return getTicket(_0xba2ccf,_0x316b70,_0x367102,_0x12b7bc,_0x1e2836,_0x12b7bc[_0xc81a('0x61')],_0x11e929,_0xc81a('0x62'));})[_0xc81a('0x3b')](function(_0x5ad356){_0x3c068d=_0x5ad356;logger[_0xc81a('0x32')](_0xc81a('0x63'));logger['info'](_0xc81a('0x64'),_0x3c068d['id']);return setRelationship(_0x11e929,_0x316b70,_0x3c068d,_0xc81a('0x65'));})[_0xc81a('0x3b')](function(){return setRelationship(_0x11e929,_0x367102,_0x3c068d,'contacts');})[_0xc81a('0x3b')](function(){return getServerInfo(_0x11e929);})['then'](function(_0x33b5ee){var _0x16f710=parseInt(_0x33b5ee['version'][_0xc81a('0x66')](0x0));var _0x4d0df1=util['format'](_0xc81a('0x67'),_0xba2ccf['remoteUri'],_0x3c068d['id']);if(_0x16f710>0x6){_0x4d0df1=util[_0xc81a('0x24')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0xba2ccf['remoteUri'],_0x3c068d['id']);}logger[_0xc81a('0x32')](_0xc81a('0x5a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x131d33[_0xc81a('0xe')]),_0xc81a('0x68'),{'uri':_0x4d0df1});})[_0xc81a('0x69')](function(_0x15feda){logger[_0xc81a('0x6a')](_0xc81a('0x5a'),JSON['stringify'](_0x15feda));});};exports[_0xc81a('0x6b')]=function(_0x1c0df8,_0x20a728,_0x157573,_0x5cef59,_0x4abf32,_0x493b24,_0x1abecc){var _0xa14eb7,_0x5421b7,_0x5356ad,_0x29d405;_0x493b24['remoteUri']=intUtil[_0xc81a('0x57')](_0x493b24[_0xc81a('0x56')]);_0x493b24[_0xc81a('0x58')]=intUtil[_0xc81a('0x57')](_0x493b24[_0xc81a('0x58')]);def['uri']=util[_0xc81a('0x24')](_0xc81a('0x6c'),_0x493b24[_0xc81a('0x56')]);if(_0x1abecc&&_0x1abecc['recordingFormat']&&_0x1abecc[_0xc81a('0x6d')]!==_0xc81a('0x6e')){logger[_0xc81a('0x32')](_0xc81a('0x6f'),_0xc81a('0x70'));_0x20a728[_0xc81a('0x5b')]=util[_0xc81a('0x24')](_0xc81a('0x5c'),_0x493b24['serverUrl'],_0x20a728[_0xc81a('0x5d')],md5(_0x20a728[_0xc81a('0x5d')]));}return getConnection(_0x493b24)[_0xc81a('0x3b')](function(_0xa29514){_0x29d405=_0xa29514;return getUser(_0x493b24,_0x5cef59[_0xc81a('0xe')],_0x29d405);})[_0xc81a('0x3b')](function(_0x136e09){_0xa14eb7=_0x136e09;logger['info'](_0xc81a('0x5e'),_0xa14eb7['id']);return getEndUser(_0x493b24,_0x20a728[_0xc81a('0x71')],_0x20a728[_0xc81a('0x72')],_0x29d405);})[_0xc81a('0x3b')](function(_0x47dec4){_0x5421b7=_0x47dec4;logger[_0xc81a('0x32')](_0xc81a('0x60'),_0x5421b7['id']);return getTicket(_0x493b24,_0xa14eb7,_0x5421b7,_0x157573,_0x20a728,_0x157573[_0xc81a('0x61')],_0x29d405,_0xc81a('0x73'));})[_0xc81a('0x3b')](function(_0x320e78){_0x5356ad=_0x320e78;logger['info'](_0xc81a('0x63'));logger[_0xc81a('0x32')](_0xc81a('0x64'),_0x5356ad['id']);return setRelationship(_0x29d405,_0xa14eb7,_0x5356ad,_0xc81a('0x65'));})[_0xc81a('0x3b')](function(){return setRelationship(_0x29d405,_0x5421b7,_0x5356ad,_0xc81a('0x74'));})[_0xc81a('0x3b')](function(){return getServerInfo(_0x29d405);})[_0xc81a('0x3b')](function(_0x403117){var _0x9bf430=parseInt(_0x403117[_0xc81a('0x75')][_0xc81a('0x66')](0x0));var _0x5c7f84=util[_0xc81a('0x24')](_0xc81a('0x67'),_0x493b24[_0xc81a('0x56')],_0x5356ad['id']);if(_0x9bf430>0x6){_0x5c7f84=util[_0xc81a('0x24')](_0xc81a('0x76'),_0x493b24[_0xc81a('0x56')],_0x5356ad['id']);}logger['info']('[OUTBOUND]',_0xc81a('0x77'));emit(util[_0xc81a('0x24')](_0xc81a('0x78'),_0x5cef59[_0xc81a('0xe')]),_0xc81a('0x68'),{'uri':_0x5c7f84});})[_0xc81a('0x69')](function(_0x3bfb54){logger[_0xc81a('0x6a')]('[OUTBOUND]',JSON[_0xc81a('0x23')](_0x3bfb54));});};exports['unmanaged']=function(_0x4f6a41,_0x6bbbda,_0x1d0813,_0xd5ad55,_0xba3214,_0x1d4f00){var _0xae1e2f,_0x538cad,_0x4fc584,_0x136c8f;_0x1d4f00[_0xc81a('0x56')]=intUtil[_0xc81a('0x57')](_0x1d4f00[_0xc81a('0x56')]);_0x1d4f00[_0xc81a('0x58')]=intUtil[_0xc81a('0x57')](_0x1d4f00['serverUrl']);def[_0xc81a('0x79')]=util[_0xc81a('0x24')](_0xc81a('0x6c'),_0x1d4f00[_0xc81a('0x56')]);if(_0xba3214&&_0xba3214[_0xc81a('0x59')]){logger[_0xc81a('0x32')]('['+_0x6bbbda[_0xc81a('0x7a')][_0xc81a('0x7b')]()+']','Recording\x20is\x20enabled!');_0x6bbbda[_0xc81a('0x5b')]=util['format'](_0xc81a('0x5c'),_0x1d4f00[_0xc81a('0x58')],_0x6bbbda['uniqueid'],md5(_0x6bbbda['uniqueid']));}else{_0x6bbbda['recordingURL']='';}return getConnection(_0x1d4f00)[_0xc81a('0x3b')](function(_0x474600){_0x136c8f=_0x474600;if(!_[_0xc81a('0x7c')](_0xd5ad55)){return getUser(_0x1d4f00,_0xd5ad55[_0xc81a('0xe')],_0x136c8f);}else{return getUser(_0x1d4f00,null,_0x136c8f);}})[_0xc81a('0x3b')](function(_0x340b77){_0xae1e2f=_0x340b77;logger[_0xc81a('0x32')](_0xc81a('0x5e'),_0xae1e2f['id']);return getEndUser(_0x1d4f00,_0x6bbbda[_0xc81a('0x7d')],_0x6bbbda['calleridnum'],_0x136c8f);})[_0xc81a('0x3b')](function(_0x30bb4d){_0x538cad=_0x30bb4d;logger[_0xc81a('0x32')](_0xc81a('0x60'),_0x538cad['id']);return getTicket(_0x1d4f00,_0xae1e2f,_0x538cad,_0x1d0813,_0x6bbbda,_0x1d0813[_0xc81a('0x61')],_0x136c8f,_0xc81a('0x62'));})[_0xc81a('0x3b')](function(_0x43e892){_0x4fc584=_0x43e892;logger[_0xc81a('0x32')](_0xc81a('0x63'));logger[_0xc81a('0x32')](_0xc81a('0x64'),_0x4fc584['id']);return setRelationship(_0x136c8f,_0xae1e2f,_0x4fc584,_0xc81a('0x65'));})[_0xc81a('0x3b')](function(){return setRelationship(_0x136c8f,_0x538cad,_0x4fc584,_0xc81a('0x74'));})[_0xc81a('0x3b')](function(){return getServerInfo(_0x136c8f);})[_0xc81a('0x69')](function(_0x2fde69){logger[_0xc81a('0x6a')]('['+_0x6bbbda[_0xc81a('0x7a')][_0xc81a('0x7b')]()+']',JSON[_0xc81a('0x23')](_0x2fde69));});}; \ 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 c81063c..792538a 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 _0xc2ca=['string','push','content','type','variable','variableName','Variable','name','toString','keyValue','key','keyContent','keyType','%s:\x20%s','customVariable','toLowerCase','format','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','test','lodash','util','getString','length','sortBy'];(function(_0x58d8d7,_0x108377){var _0x339d20=function(_0x45849e){while(--_0x45849e){_0x58d8d7['push'](_0x58d8d7['shift']());}};_0x339d20(++_0x108377);}(_0xc2ca,0x6b));var _0xac2c=function(_0x2610db,_0x454344){_0x2610db=_0x2610db-0x0;var _0x5d4d96=_0xc2ca[_0x2610db];return _0x5d4d96;};'use strict';var _=require(_0xac2c('0x0'));var util=require(_0xac2c('0x1'));exports[_0xac2c('0x2')]=function(_0x5ce028,_0x429031,_0x1bcce4){var _0x26e46f=[];if(_0x5ce028[_0xac2c('0x3')]>0x0){var _0x37db92=_[_0xac2c('0x4')](_0x5ce028,['id']);for(var _0x349b2f=0x0;_0x349b2f<_0x37db92[_0xac2c('0x3')];_0x349b2f++){var _0x1db535=_0x37db92[_0x349b2f];if(_0x1db535['type']===_0xac2c('0x5')){_0x26e46f[_0xac2c('0x6')](_0x1db535[_0xac2c('0x7')]);}else if(_0x1db535[_0xac2c('0x8')]===_0xac2c('0x9')&&_0x1db535['variableName']){_0x429031[_0x1db535[_0xac2c('0xa')]]&&_0x26e46f[_0xac2c('0x6')](_0x429031[_0x1db535[_0xac2c('0xa')]]['toString']());}else if(_0x1db535[_0xac2c('0x8')]==='customVariable'&&_0x1db535[_0xac2c('0xb')]&&_0x1db535[_0xac2c('0xb')][_0xac2c('0xc')]){_0x429031[_0x1db535[_0xac2c('0xb')]['name']['toLowerCase']()]&&_0x26e46f[_0xac2c('0x6')](_0x429031[_0x1db535[_0xac2c('0xb')][_0xac2c('0xc')]['toLowerCase']()][_0xac2c('0xd')]());}else if(_0x1db535[_0xac2c('0x8')]===_0xac2c('0xe')){if(_0x1db535['keyType']===_0xac2c('0x5')&&_0x1db535[_0xac2c('0xf')]){_0x26e46f[_0xac2c('0x6')](util['format']('%s:\x20%s',_0x1db535[_0xac2c('0xf')],_0x1db535[_0xac2c('0x10')]));}else if(_0x1db535[_0xac2c('0x11')]===_0xac2c('0x9')&&_0x1db535[_0xac2c('0xa')]&&_0x1db535[_0xac2c('0xf')]){_0x429031[_0x1db535[_0xac2c('0xa')]]&&_0x26e46f[_0xac2c('0x6')](util['format'](_0xac2c('0x12'),_0x1db535[_0xac2c('0xf')],_0x429031[_0x1db535[_0xac2c('0xa')]]));}else if(_0x1db535['keyType']===_0xac2c('0x13')&&_0x1db535['Variable']&&_0x1db535[_0xac2c('0xb')][_0xac2c('0xc')]&&_0x1db535['key']){_0x429031[_0x1db535[_0xac2c('0xb')]['name'][_0xac2c('0x14')]()]&&_0x26e46f[_0xac2c('0x6')](util[_0xac2c('0x15')](_0xac2c('0x12'),_0x1db535['key'],_0x429031[_0x1db535[_0xac2c('0xb')][_0xac2c('0xc')][_0xac2c('0x14')]()]));}}}}return _0x26e46f['join'](_0x1bcce4);};exports[_0xac2c('0x16')]=function(_0x2e445e){var _0x2ec483=_0x2e445e[_0xac2c('0x17')](-0x1);if(_0x2ec483==='/'){_0x2e445e=_0x2e445e[_0xac2c('0x18')](0x0,_0x2e445e[_0xac2c('0x19')](_0x2ec483));}return _0x2e445e;};exports[_0xac2c('0x1a')]=function(_0x4c2589){if(!_['isNil'](_0x4c2589)&&_0x4c2589!==''){var _0x5cbd7b=/^(([^<>()\[\]\\.,;:\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 _0x5cbd7b[_0xac2c('0x1b')](String(_0x4c2589)[_0xac2c('0x14')]());}else{return![];}}; \ No newline at end of file +var _0x4f0e=['stripTrailingSlash','slice','lastIndexOf','validateEmail','isNil','test','util','getString','sortBy','length','type','string','content','variableName','push','toString','Variable','name','toLowerCase','keyType','key','format','variable','%s:\x20%s','customVariable'];(function(_0x2dd615,_0x18099c){var _0x5255a4=function(_0x3f4c54){while(--_0x3f4c54){_0x2dd615['push'](_0x2dd615['shift']());}};_0x5255a4(++_0x18099c);}(_0x4f0e,0x17d));var _0xe4f0=function(_0x31e584,_0x4d9f7f){_0x31e584=_0x31e584-0x0;var _0x5686d0=_0x4f0e[_0x31e584];return _0x5686d0;};'use strict';var _=require('lodash');var util=require(_0xe4f0('0x0'));exports[_0xe4f0('0x1')]=function(_0x16b49b,_0x36d0ef,_0x37ea3e){var _0x417e7f=[];if(_0x16b49b['length']>0x0){var _0x559983=_[_0xe4f0('0x2')](_0x16b49b,['id']);for(var _0x2dabe4=0x0;_0x2dabe4<_0x559983[_0xe4f0('0x3')];_0x2dabe4++){var _0x1cb733=_0x559983[_0x2dabe4];if(_0x1cb733[_0xe4f0('0x4')]===_0xe4f0('0x5')){_0x417e7f['push'](_0x1cb733[_0xe4f0('0x6')]);}else if(_0x1cb733[_0xe4f0('0x4')]==='variable'&&_0x1cb733[_0xe4f0('0x7')]){_0x36d0ef[_0x1cb733[_0xe4f0('0x7')]]&&_0x417e7f[_0xe4f0('0x8')](_0x36d0ef[_0x1cb733[_0xe4f0('0x7')]][_0xe4f0('0x9')]());}else if(_0x1cb733[_0xe4f0('0x4')]==='customVariable'&&_0x1cb733[_0xe4f0('0xa')]&&_0x1cb733[_0xe4f0('0xa')][_0xe4f0('0xb')]){_0x36d0ef[_0x1cb733[_0xe4f0('0xa')][_0xe4f0('0xb')][_0xe4f0('0xc')]()]&&_0x417e7f[_0xe4f0('0x8')](_0x36d0ef[_0x1cb733[_0xe4f0('0xa')][_0xe4f0('0xb')][_0xe4f0('0xc')]()][_0xe4f0('0x9')]());}else if(_0x1cb733[_0xe4f0('0x4')]==='keyValue'){if(_0x1cb733[_0xe4f0('0xd')]==='string'&&_0x1cb733[_0xe4f0('0xe')]){_0x417e7f[_0xe4f0('0x8')](util[_0xe4f0('0xf')]('%s:\x20%s',_0x1cb733[_0xe4f0('0xe')],_0x1cb733['keyContent']));}else if(_0x1cb733['keyType']===_0xe4f0('0x10')&&_0x1cb733[_0xe4f0('0x7')]&&_0x1cb733['key']){_0x36d0ef[_0x1cb733[_0xe4f0('0x7')]]&&_0x417e7f[_0xe4f0('0x8')](util['format'](_0xe4f0('0x11'),_0x1cb733[_0xe4f0('0xe')],_0x36d0ef[_0x1cb733[_0xe4f0('0x7')]]));}else if(_0x1cb733[_0xe4f0('0xd')]===_0xe4f0('0x12')&&_0x1cb733[_0xe4f0('0xa')]&&_0x1cb733[_0xe4f0('0xa')][_0xe4f0('0xb')]&&_0x1cb733[_0xe4f0('0xe')]){_0x36d0ef[_0x1cb733[_0xe4f0('0xa')][_0xe4f0('0xb')]['toLowerCase']()]&&_0x417e7f['push'](util[_0xe4f0('0xf')](_0xe4f0('0x11'),_0x1cb733[_0xe4f0('0xe')],_0x36d0ef[_0x1cb733[_0xe4f0('0xa')][_0xe4f0('0xb')]['toLowerCase']()]));}}}}return _0x417e7f['join'](_0x37ea3e);};exports[_0xe4f0('0x13')]=function(_0x7400f2){var _0x3ab339=_0x7400f2[_0xe4f0('0x14')](-0x1);if(_0x3ab339==='/'){_0x7400f2=_0x7400f2['substring'](0x0,_0x7400f2[_0xe4f0('0x15')](_0x3ab339));}return _0x7400f2;};exports[_0xe4f0('0x16')]=function(_0x4dec6a){if(!_[_0xe4f0('0x17')](_0x4dec6a)&&_0x4dec6a!==''){var _0x2d18dd=/^(([^<>()\[\]\\.,;:\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 _0x2d18dd[_0xe4f0('0x18')](String(_0x4dec6a)[_0xe4f0('0xc')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 77ae70a..cc71c61 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0x5a9871,_0x489780){var _0x5cee49=function(_0x46af0e){while(--_0x46af0e){_0x5a9871['push'](_0x5a9871['shift']());}};_0x5cee49(++_0x489780);}(_0x34e8,0x12c));var _0x834e=function(_0x4256d4,_0x451408){_0x4256d4=_0x4256d4-0x0;var _0x435dc9=_0x34e8[_0x4256d4];return _0x435dc9;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ No newline at end of file +var _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0x28495e,_0x441ecb){var _0x507e5d=function(_0x5630d8){while(--_0x5630d8){_0x28495e['push'](_0x28495e['shift']());}};_0x507e5d(++_0x441ecb);}(_0x34e8,0x12c));var _0x834e=function(_0x3ed8d0,_0x4817fe){_0x3ed8d0=_0x3ed8d0-0x0;var _0x57ebb4=_0x34e8[_0x3ed8d0];return _0x57ebb4;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 538ff37..c8dea9c 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 _0xdee1=['Enduser\x20created.','authType','password','token','%s/token:%s','username','Basic\x20%s','toString','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','toLowerCase','content','idField','customField','custom_fields','push','variable','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','%s/channels/voice/agents/%d/tickets/%d/display.json','inspect','toUpperCase','lastevent','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','Subjects','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json'];(function(_0x25debb,_0x20fa04){var _0x3ecf85=function(_0x13fd54){while(--_0x13fd54){_0x25debb['push'](_0x25debb['shift']());}};_0x3ecf85(++_0x20fa04);}(_0xdee1,0xb8));var _0x1dee=function(_0xf22dce,_0x46f799){_0xf22dce=_0xf22dce-0x0;var _0x55c4ba=_0xdee1[_0xf22dce];return _0x55c4ba;};'use strict';var _=require('lodash');var rp=require(_0x1dee('0x0'));var md5=require(_0x1dee('0x1'));var util=require(_0x1dee('0x2'));var Redis=require(_0x1dee('0x3'));var intUtil=require(_0x1dee('0x4'));var config=require(_0x1dee('0x5'));var logger=require(_0x1dee('0x6'))('zendesk');config['redis']=_['defaults'](config[_0x1dee('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x1dee('0x8'))(new Redis(config['redis']));function emit(_0x5f3389,_0x2a87b4,_0x4ccd3d){io['to'](_0x5f3389)['emit'](_0x2a87b4,_0x4ccd3d);}var headers={'Content-Type':'application/json','Accept':_0x1dee('0x9')};function getTicket(_0x10ac58,_0x55c14d,_0x5097cb,_0x5e049c,_0x5346c9){logger[_0x1dee('0xa')](_0x1dee('0xb'));return request({'uri':util[_0x1dee('0xc')](_0x1dee('0xd'),_0x10ac58[_0x1dee('0xe')]),'method':_0x1dee('0xf'),'body':{'ticket':_[_0x1dee('0x10')]({'requester_id':_0x5097cb['id'],'submitter_id':_0x55c14d?_0x55c14d['id']:undefined,'assignee_id':_0x55c14d?_0x55c14d['id']:undefined,'tags':getTags(_0x5e049c[_0x1dee('0x11')],'name'),'subject':intUtil['getString'](_0x5e049c[_0x1dee('0x12')],_0x5346c9,'\x20'),'description':intUtil[_0x1dee('0x13')](_0x5e049c[_0x1dee('0x14')],_0x5346c9,'\x0a'),'comment':{'public':![],'body':intUtil[_0x1dee('0x13')](_0x5e049c[_0x1dee('0x14')],_0x5346c9,'\x0a')}},getCustomFields(_0x5e049c[_0x1dee('0x15')],_0x5346c9))}})[_0x1dee('0x16')](function(_0x496be0){logger[_0x1dee('0xa')](_0x1dee('0x17'));return _0x496be0[_0x1dee('0x18')];});}function getUser(_0x3d82c2,_0x5df8d0){if(intUtil[_0x1dee('0x19')](_0x5df8d0)){logger[_0x1dee('0xa')](_0x1dee('0x1a'),_0x5df8d0);return request({'uri':util['format'](_0x1dee('0x1b'),_0x3d82c2[_0x1dee('0xe')]),'qs':{'query':util[_0x1dee('0xc')](_0x1dee('0x1c'),_0x5df8d0)}})[_0x1dee('0x16')](function(_0x5a8bea){if(_0x5a8bea[_0x1dee('0x1d')]){logger[_0x1dee('0xa')](_0x1dee('0x1e'));return _[_0x1dee('0x1f')](_0x5a8bea[_0x1dee('0x20')],{'email':_0x5df8d0,'role':'agent'});}else{logger[_0x1dee('0xa')](_0x1dee('0x21'));return request({'uri':util[_0x1dee('0xc')]('%s/users/me.json',_0x3d82c2['remoteUri'])})[_0x1dee('0x16')](function(_0x5ab078){logger[_0x1dee('0xa')](_0x1dee('0x22'));return _0x5ab078[_0x1dee('0x23')];});}});}else{logger['info'](_0x1dee('0x21'));return request({'uri':util[_0x1dee('0xc')](_0x1dee('0x24'),_0x3d82c2[_0x1dee('0xe')])})[_0x1dee('0x16')](function(_0x114142){logger[_0x1dee('0xa')](_0x1dee('0x22'));return _0x114142[_0x1dee('0x23')];});}}function getEndUser(_0x49b5ab,_0x1d9210,_0x2d5941){logger[_0x1dee('0xa')](_0x1dee('0x25'),_0x2d5941);return request({'uri':util[_0x1dee('0xc')](_0x1dee('0x1b'),_0x49b5ab[_0x1dee('0xe')]),'qs':{'query':util[_0x1dee('0xc')](_0x1dee('0x26'),_0x2d5941)}})['then'](function(_0x42c32d){var _0x50df77;if(_0x42c32d['results'][_0x1dee('0x27')]){_0x42c32d['results']=_[_0x1dee('0x28')](_0x42c32d['results'],{'suspended':![],'role':_0x1dee('0x29')});if(_0x42c32d[_0x1dee('0x20')][_0x1dee('0x27')]){_0x50df77=_[_0x1dee('0x2a')](_0x42c32d[_0x1dee('0x20')]);}}if(_0x50df77){logger[_0x1dee('0xa')](_0x1dee('0x2b'));return _0x50df77;}else{logger[_0x1dee('0xa')](_0x1dee('0x2c'));return request({'uri':util[_0x1dee('0xc')](_0x1dee('0x2d'),_0x49b5ab[_0x1dee('0xe')]),'method':'POST','body':{'user':{'role':_0x1dee('0x29'),'name':util[_0x1dee('0xc')]('Caller\x20-\x20%s',_0x1d9210||_0x2d5941),'phone':_0x2d5941}}})[_0x1dee('0x16')](function(_0x2734ed){logger[_0x1dee('0xa')](_0x1dee('0x2e'));return _0x2734ed[_0x1dee('0x23')];});}});}function getAuth(_0x123d19){var _0x3c5884;if(_0x123d19[_0x1dee('0x2f')]===_0x1dee('0x30')){_0x3c5884=util['format']('%s:%s',_0x123d19['username'],_0x123d19[_0x1dee('0x30')]);}else if(_0x123d19[_0x1dee('0x2f')]===_0x1dee('0x31')){_0x3c5884=util[_0x1dee('0xc')](_0x1dee('0x32'),_0x123d19[_0x1dee('0x33')],_0x123d19[_0x1dee('0x31')]);}return util['format'](_0x1dee('0x34'),new Buffer(_0x3c5884)[_0x1dee('0x35')]('base64'));}function request(_0x346e83){logger[_0x1dee('0x36')](_0x1dee('0x37'),JSON[_0x1dee('0x38')](_0x346e83));return rp(_['defaults'](_0x346e83,{'method':_0x1dee('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x104ff4,_0x44ac64){var _0x59b032=[];if(_0x104ff4&&_0x104ff4[_0x1dee('0x27')]>0x0){_0x59b032=_[_0x1dee('0x3a')](_0x104ff4,_0x44ac64);}return _0x59b032;}function getCustomFields(_0x2cb283,_0x43345a){var _0x5be821=[];var _0x43ad37={'custom_fields':[]};if(_0x2cb283['length']>0x0){_[_0x1dee('0x3b')](_0x2cb283,function(_0x507ac5){if(_[_0x1dee('0x3c')]([_0x1dee('0x3d'),_0x1dee('0x3e')],_0x507ac5[_0x1dee('0x3f')])&&_0x507ac5['nameField']&&!_0x507ac5['customField']){_0x43ad37[_0x507ac5[_0x1dee('0x40')][_0x1dee('0x41')]()]=_0x507ac5[_0x1dee('0x42')]['toString']();}else if(_[_0x1dee('0x3c')]([_0x1dee('0x3d'),'picklist'],_0x507ac5[_0x1dee('0x3f')])&&_0x507ac5[_0x1dee('0x43')]&&_0x507ac5[_0x1dee('0x44')]){_0x43ad37[_0x1dee('0x45')][_0x1dee('0x46')]({'id':_0x507ac5[_0x1dee('0x43')],'value':_0x507ac5['content'][_0x1dee('0x35')]()});}else if(_0x507ac5['type']===_0x1dee('0x47')&&_0x507ac5[_0x1dee('0x48')]&&_0x507ac5[_0x1dee('0x43')]&&_0x507ac5[_0x1dee('0x44')]){_0x43345a[_0x507ac5['variableName']]&&_0x43ad37[_0x1dee('0x45')][_0x1dee('0x46')]({'id':_0x507ac5[_0x1dee('0x43')],'value':_0x43345a[_0x507ac5[_0x1dee('0x48')]][_0x1dee('0x35')]()});}else if(_0x507ac5[_0x1dee('0x3f')]===_0x1dee('0x49')&&_0x507ac5[_0x1dee('0x4a')]&&_0x507ac5[_0x1dee('0x4a')][_0x1dee('0x4b')]&&_0x507ac5[_0x1dee('0x43')]&&_0x507ac5[_0x1dee('0x44')]){_0x43345a[_0x507ac5[_0x1dee('0x4a')]['name'][_0x1dee('0x41')]()]&&_0x43ad37[_0x1dee('0x45')]['push']({'id':_0x507ac5[_0x1dee('0x43')],'value':_0x43345a[_0x507ac5[_0x1dee('0x4a')][_0x1dee('0x4b')][_0x1dee('0x41')]()][_0x1dee('0x35')]()});}});}return _0x43ad37;}exports[_0x1dee('0x4c')]=function(_0xf72814,_0x3cb3b4,_0x575158,_0x120efb,_0xa4ed02,_0x3365ae){var _0x8581ff,_0xef859e;_0x3365ae['remoteUri']=intUtil[_0x1dee('0x4d')](_0x3365ae[_0x1dee('0xe')]);_0x3365ae[_0x1dee('0x4e')]=intUtil['stripTrailingSlash'](_0x3365ae[_0x1dee('0x4e')]);if(_0xa4ed02&&_0xa4ed02[_0x1dee('0x4f')]){logger[_0x1dee('0xa')](_0x1dee('0x50'),'Recording\x20is\x20enabled!');_0x3cb3b4[_0x1dee('0x51')]=util['format'](_0x1dee('0x52'),_0x3365ae[_0x1dee('0x4e')],_0x3cb3b4['uniqueid'],md5(_0x3cb3b4[_0x1dee('0x53')]));}else{_0x3cb3b4[_0x1dee('0x51')]='';}headers[_0x1dee('0x54')]=getAuth(_0x3365ae);return getUser(_0x3365ae,_0x120efb[_0x1dee('0x55')])[_0x1dee('0x16')](function(_0x5ea40e){_0x8581ff=_0x5ea40e;logger[_0x1dee('0xa')](_0x1dee('0x56'),_0x8581ff['id']);return getEndUser(_0x3365ae,_0x3cb3b4[_0x1dee('0x57')],_0x3cb3b4[_0x1dee('0x58')]);})['then'](function(_0x2cea04){_0xef859e=_0x2cea04;logger[_0x1dee('0xa')](_0x1dee('0x59'),_0xef859e['id']);return getTicket(_0x3365ae,_0x8581ff,_0xef859e,_0x575158,_0x3cb3b4);})[_0x1dee('0x16')](function(_0x5e9f13){if(_0x5e9f13){logger[_0x1dee('0xa')](_0x1dee('0x5a'),_0x5e9f13['id']);switch(_0x3365ae[_0x1dee('0x3f')]){case _0x1dee('0x5b'):logger[_0x1dee('0xa')](_0x1dee('0x50'),_0x1dee('0x5c'));return request({'uri':util[_0x1dee('0xc')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x3365ae['remoteUri'],_0x8581ff['id'],_0x5e9f13['id']),'method':'POST'});case _0x1dee('0x5d'):logger[_0x1dee('0xa')]('[QUEUE]',_0x1dee('0x5e'));emit(util[_0x1dee('0xc')](_0x1dee('0x5f'),_0x120efb[_0x1dee('0x4b')]),_0x1dee('0x60'),{'uri':util[_0x1dee('0xc')](_0x1dee('0x61'),_0x3365ae['remoteUri'][_0x1dee('0x62')](_0x1dee('0x63'),''),_0x5e9f13['id'])});break;default:logger[_0x1dee('0x64')](_0x1dee('0x50'),_0x1dee('0x65'));}}})[_0x1dee('0x66')](function(_0x11ac14){logger[_0x1dee('0x64')](_0x1dee('0x67'),util['inspect'](_0x11ac14,{'showHidden':!![],'depth':null}));});};exports[_0x1dee('0x68')]=function(_0x2768b5,_0x3017b9,_0x2bb24e,_0x46d642,_0x402192,_0x3e2aaf,_0x418867){var _0x2ac514,_0x258569;_0x3e2aaf[_0x1dee('0xe')]=intUtil[_0x1dee('0x4d')](_0x3e2aaf[_0x1dee('0xe')]);_0x3e2aaf['serverUrl']=intUtil['stripTrailingSlash'](_0x3e2aaf[_0x1dee('0x4e')]);if(_0x418867&&_0x418867[_0x1dee('0x69')]&&_0x418867[_0x1dee('0x69')]!=='none'){logger[_0x1dee('0xa')](_0x1dee('0x6a'),_0x1dee('0x6b'));_0x3017b9[_0x1dee('0x51')]=util[_0x1dee('0xc')](_0x1dee('0x52'),_0x3e2aaf['serverUrl'],_0x3017b9[_0x1dee('0x53')],md5(_0x3017b9[_0x1dee('0x53')]));}headers[_0x1dee('0x54')]=getAuth(_0x3e2aaf);return getUser(_0x3e2aaf,_0x46d642['email'])[_0x1dee('0x16')](function(_0x2c965d){_0x2ac514=_0x2c965d;logger[_0x1dee('0xa')](_0x1dee('0x56'),_0x2ac514['id']);return getEndUser(_0x3e2aaf,_0x3017b9[_0x1dee('0x6c')],_0x3017b9[_0x1dee('0x6d')]);})[_0x1dee('0x16')](function(_0x1a461a){_0x258569=_0x1a461a;logger[_0x1dee('0xa')](_0x1dee('0x59'),_0x258569['id']);return getTicket(_0x3e2aaf,_0x2ac514,_0x258569,_0x2bb24e,_0x3017b9);})[_0x1dee('0x16')](function(_0x371747){if(_0x371747){logger[_0x1dee('0xa')](_0x1dee('0x5a'),_0x371747['id']);switch(_0x3e2aaf[_0x1dee('0x3f')]){case _0x1dee('0x5b'):logger[_0x1dee('0xa')](_0x1dee('0x6a'),_0x1dee('0x5c'));return request({'uri':util[_0x1dee('0xc')](_0x1dee('0x6e'),_0x3e2aaf['remoteUri'],_0x2ac514['id'],_0x371747['id']),'method':'POST'});case _0x1dee('0x5d'):logger[_0x1dee('0xa')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x1dee('0xc')]('user:%s',_0x46d642[_0x1dee('0x4b')]),_0x1dee('0x60'),{'uri':util[_0x1dee('0xc')](_0x1dee('0x61'),_0x3e2aaf[_0x1dee('0xe')]['replace'](_0x1dee('0x63'),''),_0x371747['id'])});break;default:logger[_0x1dee('0x64')](_0x1dee('0x6a'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x1dee('0x66')](function(_0x2c7752){logger[_0x1dee('0x64')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x1dee('0x6f')](_0x2c7752,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x4fb31e,_0x438f75,_0x60564d,_0x37e768,_0x159374,_0x30c50a){var _0x3ae5d7,_0x4dabbf;_0x30c50a[_0x1dee('0xe')]=intUtil['stripTrailingSlash'](_0x30c50a[_0x1dee('0xe')]);_0x30c50a[_0x1dee('0x4e')]=intUtil[_0x1dee('0x4d')](_0x30c50a['serverUrl']);if(_0x159374&&_0x159374[_0x1dee('0x4f')]){logger[_0x1dee('0xa')]('['+_0x438f75['lastevent'][_0x1dee('0x70')]()+']',_0x1dee('0x6b'));_0x438f75[_0x1dee('0x51')]=util[_0x1dee('0xc')](_0x1dee('0x52'),_0x30c50a[_0x1dee('0x4e')],_0x438f75[_0x1dee('0x53')],md5(_0x438f75[_0x1dee('0x53')]));}else{_0x438f75[_0x1dee('0x51')]='';}headers[_0x1dee('0x54')]=getAuth(_0x30c50a);return getUser(_0x30c50a)['then'](function(_0x197b8b){_0x3ae5d7=_0x197b8b;logger[_0x1dee('0xa')](_0x1dee('0x56'),_0x3ae5d7['id']);return getEndUser(_0x30c50a,_0x438f75[_0x1dee('0x57')],_0x438f75[_0x1dee('0x58')]);})[_0x1dee('0x16')](function(_0x192a76){_0x4dabbf=_0x192a76;logger[_0x1dee('0xa')](_0x1dee('0x59'),_0x4dabbf['id']);return getTicket(_0x30c50a,_0x3ae5d7,_0x4dabbf,_0x60564d,_0x438f75);})[_0x1dee('0x16')](function(_0x19a540){if(_0x19a540){logger['info'](_0x1dee('0x5a'),_0x19a540['id']);}})['catch'](function(_0x55b3a1){logger['error']('['+_0x438f75[_0x1dee('0x71')][_0x1dee('0x70')]()+']'+_0x1dee('0x72'),util[_0x1dee('0x6f')](_0x55b3a1,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x7ac2=['POST','merge','Tags','getString','Descriptions','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','%s/search.json','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','then','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','filter','end-user','length','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','password','token','%s/token:%s','username','Basic\x20%s','base64','[HTTP]','stringify','GET','map','includes','string','picklist','customField','nameField','content','toString','custom_fields','push','variable','variableName','customVariable','Variable','name','idField','toLowerCase','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','type','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','newTab','replace','/api/v2','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','application/json','info','%s/tickets.json','remoteUri'];(function(_0x282cf8,_0x13d611){var _0x4449b5=function(_0x2fd230){while(--_0x2fd230){_0x282cf8['push'](_0x282cf8['shift']());}};_0x4449b5(++_0x13d611);}(_0x7ac2,0xd1));var _0x27ac=function(_0x25cfa3,_0x1eafb4){_0x25cfa3=_0x25cfa3-0x0;var _0x1e0cd6=_0x7ac2[_0x25cfa3];return _0x1e0cd6;};'use strict';var _=require(_0x27ac('0x0'));var rp=require(_0x27ac('0x1'));var md5=require(_0x27ac('0x2'));var util=require(_0x27ac('0x3'));var Redis=require(_0x27ac('0x4'));var intUtil=require(_0x27ac('0x5'));var config=require(_0x27ac('0x6'));var logger=require(_0x27ac('0x7'))(_0x27ac('0x8'));config[_0x27ac('0x9')]=_[_0x27ac('0xa')](config[_0x27ac('0x9')],{'host':_0x27ac('0xb'),'port':0x18eb});var io=require(_0x27ac('0xc'))(new Redis(config[_0x27ac('0x9')]));function emit(_0xeddbd5,_0x305f5e,_0x444f36){io['to'](_0xeddbd5)['emit'](_0x305f5e,_0x444f36);}var headers={'Content-Type':'application/json','Accept':_0x27ac('0xd')};function getTicket(_0x217051,_0x245b44,_0x242ad2,_0x42e392,_0x506581){logger[_0x27ac('0xe')]('Creating\x20new\x20ticket...');return request({'uri':util['format'](_0x27ac('0xf'),_0x217051[_0x27ac('0x10')]),'method':_0x27ac('0x11'),'body':{'ticket':_[_0x27ac('0x12')]({'requester_id':_0x242ad2['id'],'submitter_id':_0x245b44?_0x245b44['id']:undefined,'assignee_id':_0x245b44?_0x245b44['id']:undefined,'tags':getTags(_0x42e392[_0x27ac('0x13')],'name'),'subject':intUtil[_0x27ac('0x14')](_0x42e392['Subjects'],_0x506581,'\x20'),'description':intUtil['getString'](_0x42e392[_0x27ac('0x15')],_0x506581,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x42e392[_0x27ac('0x15')],_0x506581,'\x0a')}},getCustomFields(_0x42e392['Fields'],_0x506581))}})['then'](function(_0x38b351){logger[_0x27ac('0xe')](_0x27ac('0x16'));return _0x38b351[_0x27ac('0x17')];});}function getUser(_0x44c006,_0x181d21){if(intUtil[_0x27ac('0x18')](_0x181d21)){logger['info'](_0x27ac('0x19'),_0x181d21);return request({'uri':util[_0x27ac('0x1a')](_0x27ac('0x1b'),_0x44c006['remoteUri']),'qs':{'query':util[_0x27ac('0x1a')]('type:user\x20role:agent\x20email:%s',_0x181d21)}})['then'](function(_0x2b6258){if(_0x2b6258['count']){logger[_0x27ac('0xe')](_0x27ac('0x1c'));return _[_0x27ac('0x1d')](_0x2b6258[_0x27ac('0x1e')],{'email':_0x181d21,'role':_0x27ac('0x1f')});}else{logger['info'](_0x27ac('0x20'));return request({'uri':util[_0x27ac('0x1a')](_0x27ac('0x21'),_0x44c006[_0x27ac('0x10')])})[_0x27ac('0x22')](function(_0x3e126d){logger[_0x27ac('0xe')]('Admin\x20account\x20selected.');return _0x3e126d[_0x27ac('0x23')];});}});}else{logger[_0x27ac('0xe')](_0x27ac('0x20'));return request({'uri':util[_0x27ac('0x1a')](_0x27ac('0x21'),_0x44c006['remoteUri'])})[_0x27ac('0x22')](function(_0x1b1ab6){logger[_0x27ac('0xe')](_0x27ac('0x24'));return _0x1b1ab6[_0x27ac('0x23')];});}}function getEndUser(_0x14948c,_0x536738,_0x10dcd5){logger[_0x27ac('0xe')](_0x27ac('0x25'),_0x10dcd5);return request({'uri':util[_0x27ac('0x1a')](_0x27ac('0x1b'),_0x14948c['remoteUri']),'qs':{'query':util['format'](_0x27ac('0x26'),_0x10dcd5)}})[_0x27ac('0x22')](function(_0x287938){var _0x1cc8f3;if(_0x287938[_0x27ac('0x1e')]['length']){_0x287938[_0x27ac('0x1e')]=_[_0x27ac('0x27')](_0x287938['results'],{'suspended':![],'role':_0x27ac('0x28')});if(_0x287938[_0x27ac('0x1e')][_0x27ac('0x29')]){_0x1cc8f3=_[_0x27ac('0x2a')](_0x287938['results']);}}if(_0x1cc8f3){logger[_0x27ac('0xe')]('Enduser\x20found!');return _0x1cc8f3;}else{logger[_0x27ac('0xe')](_0x27ac('0x2b'));return request({'uri':util[_0x27ac('0x1a')](_0x27ac('0x2c'),_0x14948c['remoteUri']),'method':_0x27ac('0x11'),'body':{'user':{'role':_0x27ac('0x28'),'name':util[_0x27ac('0x1a')](_0x27ac('0x2d'),_0x536738||_0x10dcd5),'phone':_0x10dcd5}}})[_0x27ac('0x22')](function(_0x1134b4){logger[_0x27ac('0xe')](_0x27ac('0x2e'));return _0x1134b4['user'];});}});}function getAuth(_0x385d36){var _0x18357f;if(_0x385d36['authType']===_0x27ac('0x2f')){_0x18357f=util['format']('%s:%s',_0x385d36['username'],_0x385d36['password']);}else if(_0x385d36['authType']===_0x27ac('0x30')){_0x18357f=util['format'](_0x27ac('0x31'),_0x385d36[_0x27ac('0x32')],_0x385d36['token']);}return util[_0x27ac('0x1a')](_0x27ac('0x33'),new Buffer(_0x18357f)['toString'](_0x27ac('0x34')));}function request(_0x5ad242){logger['debug'](_0x27ac('0x35'),JSON[_0x27ac('0x36')](_0x5ad242));return rp(_[_0x27ac('0xa')](_0x5ad242,{'method':_0x27ac('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x4b2d45,_0x4fbb66){var _0x384bfe=[];if(_0x4b2d45&&_0x4b2d45[_0x27ac('0x29')]>0x0){_0x384bfe=_[_0x27ac('0x38')](_0x4b2d45,_0x4fbb66);}return _0x384bfe;}function getCustomFields(_0x1a3273,_0x2a0d7a){var _0x250fa4=[];var _0x2a3155={'custom_fields':[]};if(_0x1a3273[_0x27ac('0x29')]>0x0){_['forEach'](_0x1a3273,function(_0x64456a){if(_[_0x27ac('0x39')]([_0x27ac('0x3a'),_0x27ac('0x3b')],_0x64456a['type'])&&_0x64456a['nameField']&&!_0x64456a[_0x27ac('0x3c')]){_0x2a3155[_0x64456a[_0x27ac('0x3d')]['toLowerCase']()]=_0x64456a[_0x27ac('0x3e')][_0x27ac('0x3f')]();}else if(_['includes']([_0x27ac('0x3a'),_0x27ac('0x3b')],_0x64456a['type'])&&_0x64456a['idField']&&_0x64456a[_0x27ac('0x3c')]){_0x2a3155[_0x27ac('0x40')][_0x27ac('0x41')]({'id':_0x64456a['idField'],'value':_0x64456a[_0x27ac('0x3e')]['toString']()});}else if(_0x64456a['type']===_0x27ac('0x42')&&_0x64456a[_0x27ac('0x43')]&&_0x64456a['idField']&&_0x64456a[_0x27ac('0x3c')]){_0x2a0d7a[_0x64456a[_0x27ac('0x43')]]&&_0x2a3155[_0x27ac('0x40')][_0x27ac('0x41')]({'id':_0x64456a['idField'],'value':_0x2a0d7a[_0x64456a[_0x27ac('0x43')]][_0x27ac('0x3f')]()});}else if(_0x64456a['type']===_0x27ac('0x44')&&_0x64456a['Variable']&&_0x64456a[_0x27ac('0x45')][_0x27ac('0x46')]&&_0x64456a[_0x27ac('0x47')]&&_0x64456a[_0x27ac('0x3c')]){_0x2a0d7a[_0x64456a[_0x27ac('0x45')][_0x27ac('0x46')][_0x27ac('0x48')]()]&&_0x2a3155['custom_fields'][_0x27ac('0x41')]({'id':_0x64456a['idField'],'value':_0x2a0d7a[_0x64456a[_0x27ac('0x45')][_0x27ac('0x46')][_0x27ac('0x48')]()][_0x27ac('0x3f')]()});}});}return _0x2a3155;}exports['queue']=function(_0xd7ea62,_0x32ecd2,_0x5ee7a6,_0x58059e,_0x410d54,_0x44ef0d){var _0x221090,_0x17a31a;_0x44ef0d[_0x27ac('0x10')]=intUtil[_0x27ac('0x49')](_0x44ef0d[_0x27ac('0x10')]);_0x44ef0d[_0x27ac('0x4a')]=intUtil['stripTrailingSlash'](_0x44ef0d[_0x27ac('0x4a')]);if(_0x410d54&&_0x410d54[_0x27ac('0x4b')]){logger[_0x27ac('0xe')](_0x27ac('0x4c'),_0x27ac('0x4d'));_0x32ecd2[_0x27ac('0x4e')]=util[_0x27ac('0x1a')](_0x27ac('0x4f'),_0x44ef0d[_0x27ac('0x4a')],_0x32ecd2['uniqueid'],md5(_0x32ecd2[_0x27ac('0x50')]));}else{_0x32ecd2[_0x27ac('0x4e')]='';}headers[_0x27ac('0x51')]=getAuth(_0x44ef0d);return getUser(_0x44ef0d,_0x58059e[_0x27ac('0x52')])[_0x27ac('0x22')](function(_0x5abacd){_0x221090=_0x5abacd;logger['info'](_0x27ac('0x53'),_0x221090['id']);return getEndUser(_0x44ef0d,_0x32ecd2[_0x27ac('0x54')],_0x32ecd2[_0x27ac('0x55')]);})['then'](function(_0x3ea867){_0x17a31a=_0x3ea867;logger[_0x27ac('0xe')](_0x27ac('0x56'),_0x17a31a['id']);return getTicket(_0x44ef0d,_0x221090,_0x17a31a,_0x5ee7a6,_0x32ecd2);})[_0x27ac('0x22')](function(_0x26295b){if(_0x26295b){logger[_0x27ac('0xe')](_0x27ac('0x57'),_0x26295b['id']);switch(_0x44ef0d[_0x27ac('0x58')]){case _0x27ac('0x59'):logger[_0x27ac('0xe')](_0x27ac('0x4c'),_0x27ac('0x5a'));return request({'uri':util['format'](_0x27ac('0x5b'),_0x44ef0d[_0x27ac('0x10')],_0x221090['id'],_0x26295b['id']),'method':_0x27ac('0x11')});case'newTab':logger['info'](_0x27ac('0x4c'),_0x27ac('0x5c'));emit(util[_0x27ac('0x1a')](_0x27ac('0x5d'),_0x58059e[_0x27ac('0x46')]),_0x27ac('0x5e'),{'uri':util[_0x27ac('0x1a')](_0x27ac('0x5f'),_0x44ef0d['remoteUri']['replace']('/api/v2',''),_0x26295b['id'])});break;default:logger[_0x27ac('0x60')]('[QUEUE]',_0x27ac('0x61'));}}})[_0x27ac('0x62')](function(_0x433648){logger['error'](_0x27ac('0x63'),util[_0x27ac('0x64')](_0x433648,{'showHidden':!![],'depth':null}));});};exports[_0x27ac('0x65')]=function(_0x3ff35d,_0x170b5b,_0x1bb854,_0x2c3577,_0xb60a0c,_0x107152,_0xfc77ab){var _0x4ef8e7,_0x35d9db;_0x107152[_0x27ac('0x10')]=intUtil[_0x27ac('0x49')](_0x107152[_0x27ac('0x10')]);_0x107152[_0x27ac('0x4a')]=intUtil[_0x27ac('0x49')](_0x107152[_0x27ac('0x4a')]);if(_0xfc77ab&&_0xfc77ab[_0x27ac('0x66')]&&_0xfc77ab[_0x27ac('0x66')]!==_0x27ac('0x67')){logger[_0x27ac('0xe')](_0x27ac('0x68'),_0x27ac('0x4d'));_0x170b5b[_0x27ac('0x4e')]=util[_0x27ac('0x1a')](_0x27ac('0x4f'),_0x107152[_0x27ac('0x4a')],_0x170b5b[_0x27ac('0x50')],md5(_0x170b5b[_0x27ac('0x50')]));}headers[_0x27ac('0x51')]=getAuth(_0x107152);return getUser(_0x107152,_0x2c3577[_0x27ac('0x52')])['then'](function(_0x20a65a){_0x4ef8e7=_0x20a65a;logger[_0x27ac('0xe')](_0x27ac('0x53'),_0x4ef8e7['id']);return getEndUser(_0x107152,_0x170b5b['destcalleridname'],_0x170b5b[_0x27ac('0x69')]);})[_0x27ac('0x22')](function(_0x1b8805){_0x35d9db=_0x1b8805;logger[_0x27ac('0xe')]('The\x20Enduser\x20ID\x20is:',_0x35d9db['id']);return getTicket(_0x107152,_0x4ef8e7,_0x35d9db,_0x1bb854,_0x170b5b);})[_0x27ac('0x22')](function(_0x4d507c){if(_0x4d507c){logger[_0x27ac('0xe')](_0x27ac('0x57'),_0x4d507c['id']);switch(_0x107152[_0x27ac('0x58')]){case _0x27ac('0x59'):logger[_0x27ac('0xe')](_0x27ac('0x68'),_0x27ac('0x5a'));return request({'uri':util[_0x27ac('0x1a')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x107152[_0x27ac('0x10')],_0x4ef8e7['id'],_0x4d507c['id']),'method':_0x27ac('0x11')});case _0x27ac('0x6a'):logger['info'](_0x27ac('0x68'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x27ac('0x1a')]('user:%s',_0x2c3577[_0x27ac('0x46')]),'trigger:browser:url',{'uri':util[_0x27ac('0x1a')](_0x27ac('0x5f'),_0x107152[_0x27ac('0x10')][_0x27ac('0x6b')](_0x27ac('0x6c'),''),_0x4d507c['id'])});break;default:logger['error']('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x2c575f){logger[_0x27ac('0x60')](_0x27ac('0x6d'),util[_0x27ac('0x64')](_0x2c575f,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x59263a,_0x5ddb39,_0xd38d5b,_0x29b6dc,_0x73f1bd,_0xf9faed){var _0x26b338,_0x19adfc;_0xf9faed['remoteUri']=intUtil[_0x27ac('0x49')](_0xf9faed['remoteUri']);_0xf9faed[_0x27ac('0x4a')]=intUtil['stripTrailingSlash'](_0xf9faed[_0x27ac('0x4a')]);if(_0x73f1bd&&_0x73f1bd['monitor_format']){logger[_0x27ac('0xe')]('['+_0x5ddb39[_0x27ac('0x6e')][_0x27ac('0x6f')]()+']',_0x27ac('0x4d'));_0x5ddb39[_0x27ac('0x4e')]=util[_0x27ac('0x1a')](_0x27ac('0x4f'),_0xf9faed[_0x27ac('0x4a')],_0x5ddb39[_0x27ac('0x50')],md5(_0x5ddb39['uniqueid']));}else{_0x5ddb39[_0x27ac('0x4e')]='';}headers[_0x27ac('0x51')]=getAuth(_0xf9faed);return getUser(_0xf9faed)[_0x27ac('0x22')](function(_0x1720bd){_0x26b338=_0x1720bd;logger['info'](_0x27ac('0x53'),_0x26b338['id']);return getEndUser(_0xf9faed,_0x5ddb39[_0x27ac('0x54')],_0x5ddb39[_0x27ac('0x55')]);})['then'](function(_0x54f90b){_0x19adfc=_0x54f90b;logger[_0x27ac('0xe')](_0x27ac('0x56'),_0x19adfc['id']);return getTicket(_0xf9faed,_0x26b338,_0x19adfc,_0xd38d5b,_0x5ddb39);})[_0x27ac('0x22')](function(_0x58ebad){if(_0x58ebad){logger['info'](_0x27ac('0x57'),_0x58ebad['id']);}})[_0x27ac('0x62')](function(_0x596b75){logger[_0x27ac('0x60')]('['+_0x5ddb39[_0x27ac('0x6e')][_0x27ac('0x6f')]()+']'+_0x27ac('0x70'),util[_0x27ac('0x64')](_0x596b75,{'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 4603ae9..ea02c0f 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 _0x0f10=['Answered','rejected','Abandoned','timeout','Call_Start_Time','outbound','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','code','Call\x20created!','err','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','unmanaged','lastevent','toUpperCase','lodash','md5','util','ioredis','bluebird','../../../../config/environment','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','string','idField','content','type','variable','variableName','customVariable','Variable','name','toString','indexOf','split','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','clientId','clientSecret','then','add','seconds','catch','error','stack','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','isArrayLikeObject','email','Agent\x20found!','info','Using\x20the\x20admin\x20account!','findIndex','profile','user','Administrator','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','Zoho-oauthtoken\x20','SUCCESS','details','moduleCreate','Error:\x20','log','moduleSearch','contact_lead','Contacts','Leads','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','uri','nothing','Creating\x20new\x20call...','administrator','first_name','last_name','Subjects','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','endtime','utc','YYYY-MM-DDTHH:mm:ss','diff','starttime','format','mm:ss','called','Call_Result','connect'];(function(_0x1efa97,_0x50c159){var _0x4675c1=function(_0x15bef5){while(--_0x15bef5){_0x1efa97['push'](_0x1efa97['shift']());}};_0x4675c1(++_0x50c159);}(_0x0f10,0xc3));var _0x00f1=function(_0x25f6b5,_0x28f644){_0x25f6b5=_0x25f6b5-0x0;var _0x1183ee=_0x0f10[_0x25f6b5];return _0x1183ee;};'use strict';var _=require(_0x00f1('0x0'));var rp=require('request-promise');var md5=require(_0x00f1('0x1'));var util=require(_0x00f1('0x2'));var intUtil=require('./util');var moment=require('moment');var Redis=require(_0x00f1('0x3'));var BPromise=require(_0x00f1('0x4'));var config=require(_0x00f1('0x5'));var logger=require('../../../../config/logger')(_0x00f1('0x6'));config[_0x00f1('0x7')]=_[_0x00f1('0x8')](config[_0x00f1('0x7')],{'host':_0x00f1('0x9'),'port':0x18eb});var io=require(_0x00f1('0xa'))(new Redis(config[_0x00f1('0x7')]));function emit(_0x5bb30f,_0x33347b,_0x1792c7){io['to'](_0x5bb30f)[_0x00f1('0xb')](_0x33347b,_0x1792c7);}function request(_0x4039a3){logger[_0x00f1('0xc')](_0x00f1('0xd'),JSON[_0x00f1('0xe')](_0x4039a3));return rp(_0x4039a3);}function getCustomFields(_0x5e299c,_0xc3623f){var _0x2f25ad={};if(_0x5e299c[_0x00f1('0xf')]>0x0){_[_0x00f1('0x10')](_0x5e299c,function(_0xfca510){if(_[_0x00f1('0x11')]([_0x00f1('0x12'),'picklist'],_0xfca510['type'])&&_0xfca510[_0x00f1('0x13')]){_0x2f25ad[_0xfca510[_0x00f1('0x13')]]=_0xfca510[_0x00f1('0x14')]['toString']();}else if(_0xfca510[_0x00f1('0x15')]===_0x00f1('0x16')&&_0xfca510[_0x00f1('0x17')]&&_0xfca510[_0x00f1('0x13')]&&_0xc3623f[_0xfca510[_0x00f1('0x17')]]){_0x2f25ad[_0xfca510['idField']]=_0xc3623f[_0xfca510[_0x00f1('0x17')]]['toString']();}else if(_0xfca510['type']===_0x00f1('0x18')&&_0xfca510[_0x00f1('0x19')]&&_0xfca510[_0x00f1('0x19')]['name']&&_0xfca510[_0x00f1('0x13')]&&_0xc3623f[_0xfca510['Variable'][_0x00f1('0x1a')]['toLowerCase']()]){_0x2f25ad[_0xfca510[_0x00f1('0x13')]]=_0xc3623f[_0xfca510['Variable'][_0x00f1('0x1a')]['toLowerCase']()][_0x00f1('0x1b')]();}});}return _0x2f25ad;}function getName(_0x5248d9){if(_0x5248d9[_0x00f1('0x1c')]('\x20')>0x0){var _0x5cbfd4=_0x5248d9[_0x00f1('0x1d')](/ (.+)/);if(_0x5cbfd4[0x1]){return _0x5cbfd4;}}return[_0x5248d9,_0x5248d9];}var accountsTokens={};function getAccessToken(_0x21f97e){return new Promise(function(_0x1efc87,_0x235ed8){if(!_[_0x00f1('0x1e')](accountsTokens[_0x21f97e['id']])&&!_[_0x00f1('0x1e')](accountsTokens[_0x21f97e['id']][_0x00f1('0x1f')])){if(moment()['isBefore'](accountsTokens[_0x21f97e['id']][_0x00f1('0x20')])){_0x1efc87(accountsTokens[_0x21f97e['id']][_0x00f1('0x1f')]);}}var _0xd31cb0;switch(_0x21f97e[_0x00f1('0x21')]){case'US':_0xd31cb0=_0x00f1('0x22');break;case'AU':_0xd31cb0='https://accounts.zoho.com.au';break;case'EU':_0xd31cb0='https://accounts.zoho.eu';break;case'IN':_0xd31cb0=_0x00f1('0x23');break;case'CN':_0xd31cb0=_0x00f1('0x24');break;default:_0xd31cb0=_0x00f1('0x25');break;}var _0x5d4df5={'method':_0x00f1('0x26'),'uri':_0xd31cb0+_0x00f1('0x27'),'qs':{'refresh_token':_0x21f97e['refreshToken'],'client_id':_0x21f97e[_0x00f1('0x28')],'client_secret':_0x21f97e[_0x00f1('0x29')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x5d4df5)[_0x00f1('0x2a')](function(_0x3318b4){accountsTokens[_0x21f97e['id']]={'access_token':_0x3318b4[_0x00f1('0x1f')],'expires_in':moment()[_0x00f1('0x2b')](_0x3318b4['expires_in'],_0x00f1('0x2c'))};_0x1efc87(_0x3318b4[_0x00f1('0x1f')]);})[_0x00f1('0x2d')](function(_0x4ef02f){logger[_0x00f1('0x2e')]('Failing\x20creating\x20the\x20access_token',_0x4ef02f[_0x00f1('0x2f')]);_0x235ed8(_0x4ef02f);});});}function getUser(_0x59b339,_0x4648fd,_0x1ef755,_0x6eac2b){logger['info']('Search\x20user');return request({'method':'GET','uri':util['format'](_0x00f1('0x30'),_0x4648fd),'qs':{'type':_0x00f1('0x31')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x59b339},'json':!![]})[_0x00f1('0x2a')](function(_0x100db5){if(_0x100db5[_0x00f1('0x32')]){var _0x18358f=-0x1;if(_[_0x00f1('0x33')](_0x100db5[_0x00f1('0x32')])){if(!_['isNil'](_0x6eac2b)){_0x18358f=_['findIndex'](_0x100db5[_0x00f1('0x32')],function(_0x29dccc){return _0x29dccc[_0x00f1('0x34')]===_0x6eac2b;});}if(_0x18358f>=0x0){logger['info'](_0x00f1('0x35'));}else{logger[_0x00f1('0x36')](_0x00f1('0x37'));_0x18358f=_[_0x00f1('0x38')](_0x100db5[_0x00f1('0x32')],function(_0x309dc2){return _0x309dc2[_0x00f1('0x39')][_0x00f1('0x1a')]==='Administrator';});}return _0x100db5[_0x00f1('0x32')][_0x18358f];}else{if(_0x100db5[_0x00f1('0x3a')][_0x00f1('0x39')][_0x00f1('0x1a')]===_0x00f1('0x3b')){logger[_0x00f1('0x36')]('Using\x20the\x20admin\x20account!');user=_0x100db5['user'];return user;}else{logger['error'](_0x00f1('0x3c'),JSON[_0x00f1('0xe')](_0x100db5));throw new Error(_0x00f1('0x3d')+JSON[_0x00f1('0xe')](_0x100db5));}}}else{logger[_0x00f1('0x2e')](_0x00f1('0x3c'),JSON[_0x00f1('0xe')](_0x100db5));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x00f1('0xe')](_0x100db5));}})[_0x00f1('0x2d')](function(_0xe75494){console[_0x00f1('0x2e')](_0xe75494);});}function getZohoUser(_0x3d68f5,_0x304569){return new BPromise(function(_0x48c119,_0x211853){request(_0x3d68f5)[_0x00f1('0x2a')](function(_0x3ec6ad){var _0x1b8126=null;if(_0x3ec6ad){_0x1b8126=_0x3ec6ad[_0x00f1('0x3e')][0x0];_0x1b8126[_0x00f1('0x3f')]=_0x304569;}_0x48c119(_0x1b8126);})[_0x00f1('0x2d')](function(_0x2db21b){_0x211853(_0x2db21b);});});}function createEndUser(_0x6c4999,_0x492a1c,_0x4ff9b7,_0x3fdee7,_0x2d1408,_0x35bc4a){var _0x4ff9b7=getName(_0x4ff9b7);return request({'method':_0x00f1('0x26'),'uri':_0x00f1('0x40')+_0x492a1c+_0x00f1('0x41')+_[_0x00f1('0x42')](_0x35bc4a['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x4ff9b7[0x1],'First_Name':_0x4ff9b7[0x0],'Phone':_0x3fdee7,'Owner':{'name':!_['isNil'](_0x2d1408[_0x00f1('0x43')][_0x00f1('0x1a')])?_0x2d1408[_0x00f1('0x43')][_0x00f1('0x1a')]:!_[_0x00f1('0x1e')](_0x2d1408['first_name'])?_0x2d1408['first_name']+'\x20'+_0x2d1408['last_name']:_0x2d1408['last_name'],'id':_0x2d1408['id']}}]},'headers':{'Authorization':_0x00f1('0x44')+_0x6c4999},'json':!![]})[_0x00f1('0x2a')](function(_0x570b21){if(_0x570b21&&_0x570b21[_0x00f1('0x3e')][0x0]['code']===_0x00f1('0x45')){var _0xcbcf18=_0x570b21[_0x00f1('0x3e')][0x0][_0x00f1('0x46')];_0xcbcf18['enduserType']=_['startCase'](_0x35bc4a[_0x00f1('0x47')])+'s';return _0xcbcf18;}logger['error'](_0x00f1('0x3c'),JSON[_0x00f1('0xe')](data));throw new Error(_0x00f1('0x48')+JSON[_0x00f1('0xe')](data));})[_0x00f1('0x2d')](function(_0x1b0c32){console[_0x00f1('0x49')]('CREATE\x20ERROR',_0x1b0c32);});}function getEndUser(_0x40f390,_0x56541e,_0x4bda3e,_0x3bdd08,_0x3ce6a9,_0x5900c9,_0x16a7be){var _0x2f1649={'method':'GET','uri':'','headers':{'Authorization':_0x00f1('0x44')+_0x40f390},'json':!![]};switch(_0x16a7be[_0x00f1('0x4a')]){case _0x00f1('0x4b'):_0x2f1649['uri']='https://www.zohoapis.'+_0x56541e+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x3ce6a9+'))';return getZohoUser(_0x2f1649,_0x00f1('0x4c'))['then'](function(_0x313428){if(_0x313428)return _0x313428;_0x2f1649['uri']=_0x00f1('0x40')+_0x56541e+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x3ce6a9+'))';return getZohoUser(_0x2f1649,_0x00f1('0x4d'))[_0x00f1('0x2a')](function(_0x453860){if(_0x453860)return _0x453860;if(_0x16a7be[_0x00f1('0x47')]!='nothing'){return createEndUser(_0x40f390,_0x56541e,_0x3bdd08,_0x3ce6a9,_0x5900c9,_0x16a7be);}else{return{};}});});break;case _0x00f1('0x4e'):_0x2f1649['uri']=_0x00f1('0x40')+_0x56541e+_0x00f1('0x4f')+_0x3ce6a9+'))';return getZohoUser(_0x2f1649,'Contacts')[_0x00f1('0x2a')](function(_0x5586e2){if(_0x5586e2)return _0x5586e2;if(_0x16a7be[_0x00f1('0x47')]!='nothing'){return createEndUser(_0x40f390,_0x56541e,_0x3bdd08,_0x3ce6a9,_0x5900c9,_0x16a7be);}else{return{};}});break;case _0x00f1('0x50'):_0x2f1649[_0x00f1('0x51')]=_0x00f1('0x40')+_0x56541e+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x3ce6a9+'))';return getZohoUser(_0x2f1649,'Leads')[_0x00f1('0x2a')](function(_0x4756fc){if(_0x4756fc)return _0x4756fc;if(_0x16a7be['moduleCreate']!=_0x00f1('0x52')){return createEndUser(_0x40f390,_0x56541e,_0x3bdd08,_0x3ce6a9,_0x5900c9,_0x16a7be);}else{return{};}});break;}}function getCall(_0x144d30,_0x873c76,_0x38473b,_0x1640a5,_0x3e90fe,_0x50ec89,_0x22561e,_0x4aa269){logger[_0x00f1('0x36')](_0x00f1('0x53'));var _0x1645d8={};_0x1645d8['Owner']={'name':!_[_0x00f1('0x1e')](_0x1640a5['role'][_0x00f1('0x1a')])&&!_[_0x00f1('0x1e')](_0x1640a5[_0x00f1('0x39')][_0x00f1('0x1a')])&&_0x1640a5[_0x00f1('0x39')]['name']===_0x00f1('0x54')?_0x1640a5[_0x00f1('0x43')][_0x00f1('0x1a')]:!_[_0x00f1('0x1e')](_0x1640a5['first_name'])?_0x1640a5[_0x00f1('0x55')]+'\x20'+_0x1640a5[_0x00f1('0x56')]:_0x1640a5[_0x00f1('0x56')],'id':_0x1640a5['id']};_0x1645d8['Subject']=intUtil['getString'](_0x50ec89[_0x00f1('0x57')],_0x22561e,'\x20');_0x1645d8['Description']=intUtil[_0x00f1('0x58')](_0x50ec89[_0x00f1('0x59')],_0x22561e,'\x0a');if(_0x3e90fe['enduserType']==='Contacts'){_0x1645d8[_0x00f1('0x5a')]={'name':!_[_0x00f1('0x1e')](_0x3e90fe[_0x00f1('0x5b')])?_0x3e90fe[_0x00f1('0x5b')]:!_[_0x00f1('0x1e')](_0x3e90fe['First_Name'])?_0x3e90fe[_0x00f1('0x5c')]+'\x20'+_0x3e90fe[_0x00f1('0x5d')]:_0x3e90fe[_0x00f1('0x5d')],'id':_0x3e90fe['id']};}if(_0x3e90fe[_0x00f1('0x3f')]===_0x00f1('0x4d')){_0x1645d8[_0x00f1('0x5e')]={'name':!_[_0x00f1('0x1e')](_0x3e90fe['Full_Name'])?_0x3e90fe[_0x00f1('0x5b')]:!_[_0x00f1('0x1e')](_0x3e90fe[_0x00f1('0x5c')])?_0x3e90fe[_0x00f1('0x5c')]+'\x20'+_0x3e90fe[_0x00f1('0x5d')]:_0x3e90fe['Last_Name'],'id':_0x3e90fe['id']};_0x1645d8['$se_module']=_[_0x00f1('0x42')](_0x3e90fe[_0x00f1('0x3f')]);}if(_0x22561e[_0x00f1('0x5f')]){_0x1645d8[_0x00f1('0x60')]=moment['utc'](parseInt(_0x22561e[_0x00f1('0x5f')])*0x3e8)['format']('mm:ss');}else if(_0x22561e['answertime']&&_0x22561e[_0x00f1('0x61')]){_0x1645d8[_0x00f1('0x60')]=moment[_0x00f1('0x62')](moment(_0x22561e[_0x00f1('0x61')],_0x00f1('0x63'))[_0x00f1('0x64')](moment(_0x22561e[_0x00f1('0x65')],_0x00f1('0x63'))))[_0x00f1('0x66')](_0x00f1('0x67'));}switch(_0x22561e['lastevent']){case _0x00f1('0x68'):_0x1645d8[_0x00f1('0x69')]='Called';break;case'complete':case _0x00f1('0x6a'):_0x1645d8[_0x00f1('0x69')]=_0x00f1('0x6b');break;case _0x00f1('0x6c'):_0x1645d8[_0x00f1('0x69')]='Rejected';break;case'abandoned':_0x1645d8[_0x00f1('0x69')]=_0x00f1('0x6d');break;case _0x00f1('0x6e'):_0x1645d8['Call_Result']='Timeout';default:}_0x1645d8[_0x00f1('0x6f')]=(_0x4aa269===_0x00f1('0x70')?moment(_0x22561e[_0x00f1('0x65')])['format'](_0x00f1('0x63')):moment(_0x22561e['agentcalledAt'])[_0x00f1('0x66')](_0x00f1('0x63')))||moment()[_0x00f1('0x66')](_0x00f1('0x63'));_0x1645d8[_0x00f1('0x71')]=_0x4aa269||_0x00f1('0x72');_0x1645d8=_[_0x00f1('0x73')](_0x1645d8,getCustomFields(_0x50ec89[_0x00f1('0x74')],_0x22561e));return request({'method':_0x00f1('0x26'),'uri':_0x00f1('0x40')+_0x873c76+_0x00f1('0x75'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x144d30},'body':{'data':[_0x1645d8]},'json':!![]})[_0x00f1('0x2a')](function(_0x564552){if(_0x564552&&_0x564552[_0x00f1('0x3e')][0x0][_0x00f1('0x76')]==='SUCCESS'){logger[_0x00f1('0x36')](_0x00f1('0x77'));return{'id':_0x564552[_0x00f1('0x3e')][0x0][_0x00f1('0x46')]['id']};}})['catch'](function(_0x293018){logger['info'](_0x00f1('0x78'),_0x293018[_0x00f1('0x2f')]);console[_0x00f1('0x49')](_0x00f1('0x78'),_0x293018);});}exports[_0x00f1('0x79')]=function(_0x5eead6,_0x1aff7c,_0xa5ad98,_0x486049,_0x564424,_0x3f3d7a){var _0x297f4f,_0xf7eaac,_0x3aadd3;_0x3f3d7a['host']=intUtil['stripTrailingSlash'](_0x3f3d7a[_0x00f1('0x7a')]);_0x3f3d7a[_0x00f1('0x7b')]=intUtil[_0x00f1('0x7c')](_0x3f3d7a['serverUrl']);if(_0x564424&&_0x564424[_0x00f1('0x7d')]){logger['info'](_0x00f1('0x7e'),_0x00f1('0x7f'));_0x1aff7c[_0x00f1('0x80')]=_0x3f3d7a[_0x00f1('0x7b')]+_0x00f1('0x81')+_0x1aff7c[_0x00f1('0x82')]+_0x00f1('0x83')+md5(_0x1aff7c[_0x00f1('0x82')]);}else{_0x1aff7c[_0x00f1('0x80')]='';}var _0x403837=_0x3f3d7a['host']===_0x00f1('0x84')?'eu':_0x00f1('0x85');return getAccessToken(_0x3f3d7a)[_0x00f1('0x2a')](function(_0x1d2816){_0x3aadd3=_0x1d2816;return getUser(_0x3aadd3,_0x403837,_0x3f3d7a,_0x486049[_0x00f1('0x34')]);})['then'](function(_0xd26b50){_0x297f4f=_0xd26b50;logger[_0x00f1('0x36')](_0x00f1('0x86'),_0x297f4f['id']);return getEndUser(_0x3aadd3,_0x403837,_0x3f3d7a,_0x1aff7c[_0x00f1('0x87')],_0x1aff7c[_0x00f1('0x88')],_0x297f4f,_0xa5ad98);})[_0x00f1('0x2a')](function(_0x2fe175){_0xf7eaac=_0x2fe175;return getCall(_0x3aadd3,_0x403837,_0x3f3d7a,_0x297f4f,_0xf7eaac,_0xa5ad98,_0x1aff7c,'Inbound');})['then'](function(_0x9f419c){if(_0x9f419c){logger[_0x00f1('0x36')](_0x00f1('0x89'),_0x9f419c['id']);logger[_0x00f1('0x36')](_0x00f1('0x7e'),_0x00f1('0x8a'));emit(util[_0x00f1('0x66')](_0x00f1('0x8b'),_0x486049['name']),_0x00f1('0x8c'),{'uri':_0x00f1('0x8d')+_0x3f3d7a[_0x00f1('0x7a')]+_0x00f1('0x8e')+_0x9f419c['id']});}})[_0x00f1('0x2d')](function(_0x2d2af3){logger['error'](_0x00f1('0x7e'),JSON[_0x00f1('0xe')](_0x2d2af3));});};exports[_0x00f1('0x70')]=function(_0x310629,_0x262ca0,_0x4c74df,_0xb4f6b9,_0x34b684,_0x88117b,_0x471ced){var _0x11bed7,_0x579187,_0x3c5d98;_0x88117b[_0x00f1('0x7a')]=intUtil[_0x00f1('0x7c')](_0x88117b['host']);_0x88117b['serverUrl']=intUtil[_0x00f1('0x7c')](_0x88117b[_0x00f1('0x7b')]);if(_0x471ced&&_0x471ced[_0x00f1('0x8f')]&&_0x471ced['recordingFormat']!=='none'){logger[_0x00f1('0x36')](_0x00f1('0x90'),_0x00f1('0x7f'));_0x262ca0[_0x00f1('0x80')]=_0x88117b[_0x00f1('0x7b')]+_0x00f1('0x81')+_0x262ca0[_0x00f1('0x82')]+_0x00f1('0x83')+md5(_0x262ca0[_0x00f1('0x82')]);}var _0x22b7c9=_0x88117b['host']===_0x00f1('0x84')?'eu':_0x00f1('0x85');return getAccessToken(_0x88117b)[_0x00f1('0x2a')](function(_0x4160ac){_0x3c5d98=_0x4160ac;return getUser(_0x3c5d98,_0x22b7c9,_0x88117b,_0xb4f6b9[_0x00f1('0x34')]);})[_0x00f1('0x2a')](function(_0x41e5d9){_0x11bed7=_0x41e5d9;logger['info'](_0x00f1('0x86'),_0x11bed7['id']);return getEndUser(_0x3c5d98,_0x22b7c9,_0x88117b,_0x262ca0[_0x00f1('0x91')],_0x262ca0[_0x00f1('0x92')],_0x11bed7,_0x4c74df);})[_0x00f1('0x2a')](function(_0x297b3e){_0x579187=_0x297b3e;return getCall(_0x3c5d98,_0x22b7c9,_0x88117b,_0x11bed7,_0x579187,_0x4c74df,_0x262ca0,_0x00f1('0x93'));})[_0x00f1('0x2a')](function(_0x1ff5a3){if(_0x1ff5a3){logger[_0x00f1('0x36')](_0x00f1('0x89'),_0x1ff5a3['id']);logger['info'](_0x00f1('0x90'),_0x00f1('0x8a'));emit(util['format'](_0x00f1('0x8b'),_0xb4f6b9[_0x00f1('0x1a')]),_0x00f1('0x8c'),{'uri':_0x00f1('0x8d')+_0x88117b['host']+_0x00f1('0x8e')+_0x1ff5a3['id']});}})[_0x00f1('0x2d')](function(_0xcae558){logger[_0x00f1('0x2e')](_0x00f1('0x90'),JSON[_0x00f1('0xe')](_0xcae558));});};exports[_0x00f1('0x94')]=function(_0x540fd7,_0x4422b2,_0x389065,_0x484554,_0x165b62,_0x142e84){var _0xc36b55,_0x1b6699,_0xc90e1b;_0x142e84[_0x00f1('0x7a')]=intUtil[_0x00f1('0x7c')](_0x142e84['host']);_0x142e84[_0x00f1('0x7b')]=intUtil[_0x00f1('0x7c')](_0x142e84[_0x00f1('0x7b')]);if(_0x165b62&&_0x165b62[_0x00f1('0x7d')]){logger[_0x00f1('0x36')]('['+_0x4422b2[_0x00f1('0x95')][_0x00f1('0x96')]()+']',_0x00f1('0x7f'));_0x4422b2[_0x00f1('0x80')]=_0x142e84[_0x00f1('0x7b')]+_0x00f1('0x81')+_0x4422b2[_0x00f1('0x82')]+_0x00f1('0x83')+md5(_0x4422b2[_0x00f1('0x82')]);}else{_0x4422b2['recordingURL']='';}var _0x31032c=_0x142e84[_0x00f1('0x7a')]===_0x00f1('0x84')?'eu':'com';return getAccessToken(_0x142e84)['then'](function(_0x5e1b69){_0xc90e1b=_0x5e1b69;return getUser(_0xc90e1b,_0x31032c,_0x142e84);})[_0x00f1('0x2a')](function(_0x55df43){_0xc36b55=_0x55df43;logger[_0x00f1('0x36')](_0x00f1('0x86'),_0xc36b55['id']);return getEndUser(_0xc90e1b,_0x31032c,_0x142e84,_0x4422b2[_0x00f1('0x87')],_0x4422b2[_0x00f1('0x88')],_0xc36b55,_0x389065);})[_0x00f1('0x2a')](function(_0x4bf60c){_0x1b6699=_0x4bf60c;return getCall(_0xc90e1b,_0x31032c,_0x142e84,_0xc36b55,_0x1b6699,_0x389065,_0x4422b2,_0x00f1('0x72'));})[_0x00f1('0x2a')](function(_0x5ef606){if(_0x5ef606){logger[_0x00f1('0x36')](_0x00f1('0x89'),_0x5ef606['id']);}})[_0x00f1('0x2d')](function(_0x13d80d){logger[_0x00f1('0x2e')]('['+_0x4422b2[_0x00f1('0x95')][_0x00f1('0x96')]()+']',JSON[_0x00f1('0xe')](_0x13d80d));});}; \ No newline at end of file +var _0x2e31=['The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','zoho.eu','destcalleridname','destcalleridnum','unmanaged','lastevent','toUpperCase','The\x20User\x20ID\x20is:','lodash','request-promise','md5','./util','moment','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','debug','[HTTP]','length','forEach','includes','string','picklist','type','idField','content','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','then','add','expires_in','seconds','catch','error','Failing\x20creating\x20the\x20access_token','info','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','Agent\x20found!','findIndex','profile','Administrator','user','Using\x20the\x20admin\x20account!','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','data','code','SUCCESS','The\x20failing\x20result\x20is','Error:\x20','log','CREATE\x20ERROR','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','Contacts','nothing','lead','Creating\x20new\x20call...','Owner','administrator','Subjects','Description','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','utc','answertime','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','called','Call_Result','Called','complete','connect','Answered','Rejected','Abandoned','timeout','Timeout','outbound','agentcalledAt','Call_Type','Inbound','Fields','/crm/v2/Calls','details','err','stack','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','recordingURL','host','com','email','calleridname','calleridnum'];(function(_0x23cf29,_0x4f74bb){var _0x4e818c=function(_0x277048){while(--_0x277048){_0x23cf29['push'](_0x23cf29['shift']());}};_0x4e818c(++_0x4f74bb);}(_0x2e31,0x145));var _0x12e3=function(_0x77864c,_0x2480b4){_0x77864c=_0x77864c-0x0;var _0x2f03e9=_0x2e31[_0x77864c];return _0x2f03e9;};'use strict';var _=require(_0x12e3('0x0'));var rp=require(_0x12e3('0x1'));var md5=require(_0x12e3('0x2'));var util=require('util');var intUtil=require(_0x12e3('0x3'));var moment=require(_0x12e3('0x4'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0x12e3('0x5'));var logger=require(_0x12e3('0x6'))(_0x12e3('0x7'));config['redis']=_[_0x12e3('0x8')](config[_0x12e3('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x12e3('0x9')]));function emit(_0x403cc5,_0x31e2cf,_0x33f3a2){io['to'](_0x403cc5)['emit'](_0x31e2cf,_0x33f3a2);}function request(_0x438c7e){logger[_0x12e3('0xa')](_0x12e3('0xb'),JSON['stringify'](_0x438c7e));return rp(_0x438c7e);}function getCustomFields(_0x5901b3,_0x3e7283){var _0x55bb88={};if(_0x5901b3[_0x12e3('0xc')]>0x0){_[_0x12e3('0xd')](_0x5901b3,function(_0x45dd64){if(_[_0x12e3('0xe')]([_0x12e3('0xf'),_0x12e3('0x10')],_0x45dd64[_0x12e3('0x11')])&&_0x45dd64[_0x12e3('0x12')]){_0x55bb88[_0x45dd64[_0x12e3('0x12')]]=_0x45dd64[_0x12e3('0x13')]['toString']();}else if(_0x45dd64[_0x12e3('0x11')]===_0x12e3('0x14')&&_0x45dd64[_0x12e3('0x15')]&&_0x45dd64['idField']&&_0x3e7283[_0x45dd64[_0x12e3('0x15')]]){_0x55bb88[_0x45dd64[_0x12e3('0x12')]]=_0x3e7283[_0x45dd64['variableName']]['toString']();}else if(_0x45dd64['type']===_0x12e3('0x16')&&_0x45dd64['Variable']&&_0x45dd64[_0x12e3('0x17')][_0x12e3('0x18')]&&_0x45dd64[_0x12e3('0x12')]&&_0x3e7283[_0x45dd64[_0x12e3('0x17')][_0x12e3('0x18')][_0x12e3('0x19')]()]){_0x55bb88[_0x45dd64['idField']]=_0x3e7283[_0x45dd64[_0x12e3('0x17')][_0x12e3('0x18')]['toLowerCase']()]['toString']();}});}return _0x55bb88;}function getName(_0x4a68ec){if(_0x4a68ec[_0x12e3('0x1a')]('\x20')>0x0){var _0x577b74=_0x4a68ec[_0x12e3('0x1b')](/ (.+)/);if(_0x577b74[0x1]){return _0x577b74;}}return[_0x4a68ec,_0x4a68ec];}var accountsTokens={};function getAccessToken(_0x2ddfbf){return new Promise(function(_0x5a1990,_0x48f4b6){if(!_[_0x12e3('0x1c')](accountsTokens[_0x2ddfbf['id']])&&!_[_0x12e3('0x1c')](accountsTokens[_0x2ddfbf['id']][_0x12e3('0x1d')])){if(moment()[_0x12e3('0x1e')](accountsTokens[_0x2ddfbf['id']]['expires_in'])){_0x5a1990(accountsTokens[_0x2ddfbf['id']]['access_token']);}}var _0x3e03d8;switch(_0x2ddfbf[_0x12e3('0x1f')]){case'US':_0x3e03d8=_0x12e3('0x20');break;case'AU':_0x3e03d8=_0x12e3('0x21');break;case'EU':_0x3e03d8=_0x12e3('0x22');break;case'IN':_0x3e03d8='https://accounts.zoho.in';break;case'CN':_0x3e03d8=_0x12e3('0x23');break;default:_0x3e03d8=_0x12e3('0x22');break;}var _0xd04cbc={'method':_0x12e3('0x24'),'uri':_0x3e03d8+_0x12e3('0x25'),'qs':{'refresh_token':_0x2ddfbf[_0x12e3('0x26')],'client_id':_0x2ddfbf['clientId'],'client_secret':_0x2ddfbf[_0x12e3('0x27')],'grant_type':_0x12e3('0x28')},'json':!![]};return rp(_0xd04cbc)[_0x12e3('0x29')](function(_0x42765f){accountsTokens[_0x2ddfbf['id']]={'access_token':_0x42765f['access_token'],'expires_in':moment()[_0x12e3('0x2a')](_0x42765f[_0x12e3('0x2b')],_0x12e3('0x2c'))};_0x5a1990(_0x42765f['access_token']);})[_0x12e3('0x2d')](function(_0x2f9a7d){logger[_0x12e3('0x2e')](_0x12e3('0x2f'),_0x2f9a7d['stack']);_0x48f4b6(_0x2f9a7d);});});}function getUser(_0x342ad2,_0x2859d2,_0x40aefe,_0x546f26){logger[_0x12e3('0x30')]('Search\x20user');return request({'method':_0x12e3('0x31'),'uri':util[_0x12e3('0x32')](_0x12e3('0x33'),_0x2859d2),'qs':{'type':_0x12e3('0x34')},'headers':{'Authorization':_0x12e3('0x35')+_0x342ad2},'json':!![]})[_0x12e3('0x29')](function(_0x58355e){if(_0x58355e[_0x12e3('0x36')]){var _0x2609c4=-0x1;if(_['isArrayLikeObject'](_0x58355e[_0x12e3('0x36')])){if(!_[_0x12e3('0x1c')](_0x546f26)){_0x2609c4=_['findIndex'](_0x58355e[_0x12e3('0x36')],function(_0x121084){return _0x121084['email']===_0x546f26;});}if(_0x2609c4>=0x0){logger[_0x12e3('0x30')](_0x12e3('0x37'));}else{logger[_0x12e3('0x30')]('Using\x20the\x20admin\x20account!');_0x2609c4=_[_0x12e3('0x38')](_0x58355e[_0x12e3('0x36')],function(_0x11e0c7){return _0x11e0c7[_0x12e3('0x39')][_0x12e3('0x18')]===_0x12e3('0x3a');});}return _0x58355e[_0x12e3('0x36')][_0x2609c4];}else{if(_0x58355e[_0x12e3('0x3b')][_0x12e3('0x39')][_0x12e3('0x18')]===_0x12e3('0x3a')){logger[_0x12e3('0x30')](_0x12e3('0x3c'));user=_0x58355e['user'];return user;}else{logger[_0x12e3('0x2e')]('The\x20failing\x20result\x20is',JSON[_0x12e3('0x3d')](_0x58355e));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x12e3('0x3d')](_0x58355e));}}}else{logger[_0x12e3('0x2e')]('The\x20failing\x20result\x20is',JSON[_0x12e3('0x3d')](_0x58355e));throw new Error(_0x12e3('0x3e')+JSON['stringify'](_0x58355e));}})[_0x12e3('0x2d')](function(_0x1a8c02){console[_0x12e3('0x2e')](_0x1a8c02);});}function getZohoUser(_0x538a07,_0x34c0fd){return new BPromise(function(_0x25cf17,_0x393fff){request(_0x538a07)['then'](function(_0x42392b){var _0x4d6bdd=null;if(_0x42392b){_0x4d6bdd=_0x42392b['data'][0x0];_0x4d6bdd[_0x12e3('0x3f')]=_0x34c0fd;}_0x25cf17(_0x4d6bdd);})[_0x12e3('0x2d')](function(_0x1bd136){_0x393fff(_0x1bd136);});});}function createEndUser(_0x598b4e,_0x482285,_0x1fbf30,_0x501e83,_0x3314dc,_0x4c01bd){var _0x1fbf30=getName(_0x1fbf30);return request({'method':_0x12e3('0x24'),'uri':_0x12e3('0x40')+_0x482285+'/crm/v2/'+_[_0x12e3('0x41')](_0x4c01bd[_0x12e3('0x42')])+'s','body':{'data':[{'Last_Name':_0x1fbf30[0x1],'First_Name':_0x1fbf30[0x0],'Phone':_0x501e83,'Owner':{'name':!_[_0x12e3('0x1c')](_0x3314dc[_0x12e3('0x43')][_0x12e3('0x18')])?_0x3314dc[_0x12e3('0x43')]['name']:!_[_0x12e3('0x1c')](_0x3314dc[_0x12e3('0x44')])?_0x3314dc['first_name']+'\x20'+_0x3314dc[_0x12e3('0x45')]:_0x3314dc[_0x12e3('0x45')],'id':_0x3314dc['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x598b4e},'json':!![]})[_0x12e3('0x29')](function(_0xc03bd0){if(_0xc03bd0&&_0xc03bd0[_0x12e3('0x46')][0x0][_0x12e3('0x47')]===_0x12e3('0x48')){var _0x178014=_0xc03bd0[_0x12e3('0x46')][0x0]['details'];_0x178014[_0x12e3('0x3f')]=_[_0x12e3('0x41')](_0x4c01bd[_0x12e3('0x42')])+'s';return _0x178014;}logger[_0x12e3('0x2e')](_0x12e3('0x49'),JSON[_0x12e3('0x3d')](data));throw new Error(_0x12e3('0x4a')+JSON[_0x12e3('0x3d')](data));})['catch'](function(_0x5d87ad){console[_0x12e3('0x4b')](_0x12e3('0x4c'),_0x5d87ad);});}function getEndUser(_0x5ab44e,_0x1ba980,_0x497ef0,_0x3ad181,_0x1523e8,_0x2b75aa,_0x20c50f){var _0x2a1fd8={'method':_0x12e3('0x31'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5ab44e},'json':!![]};switch(_0x20c50f['moduleSearch']){case'contact_lead':_0x2a1fd8[_0x12e3('0x4d')]=_0x12e3('0x40')+_0x1ba980+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x1523e8+'))';return getZohoUser(_0x2a1fd8,'Contacts')[_0x12e3('0x29')](function(_0x5ceb50){if(_0x5ceb50)return _0x5ceb50;_0x2a1fd8[_0x12e3('0x4d')]=_0x12e3('0x40')+_0x1ba980+_0x12e3('0x4e')+_0x1523e8+'))';return getZohoUser(_0x2a1fd8,_0x12e3('0x4f'))[_0x12e3('0x29')](function(_0x1b129a){if(_0x1b129a)return _0x1b129a;if(_0x20c50f[_0x12e3('0x42')]!='nothing'){return createEndUser(_0x5ab44e,_0x1ba980,_0x3ad181,_0x1523e8,_0x2b75aa,_0x20c50f);}else{return{};}});});break;case _0x12e3('0x50'):_0x2a1fd8[_0x12e3('0x4d')]='https://www.zohoapis.'+_0x1ba980+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x1523e8+'))';return getZohoUser(_0x2a1fd8,_0x12e3('0x51'))[_0x12e3('0x29')](function(_0x309969){if(_0x309969)return _0x309969;if(_0x20c50f['moduleCreate']!=_0x12e3('0x52')){return createEndUser(_0x5ab44e,_0x1ba980,_0x3ad181,_0x1523e8,_0x2b75aa,_0x20c50f);}else{return{};}});break;case _0x12e3('0x53'):_0x2a1fd8[_0x12e3('0x4d')]='https://www.zohoapis.'+_0x1ba980+_0x12e3('0x4e')+_0x1523e8+'))';return getZohoUser(_0x2a1fd8,_0x12e3('0x4f'))[_0x12e3('0x29')](function(_0x569885){if(_0x569885)return _0x569885;if(_0x20c50f[_0x12e3('0x42')]!=_0x12e3('0x52')){return createEndUser(_0x5ab44e,_0x1ba980,_0x3ad181,_0x1523e8,_0x2b75aa,_0x20c50f);}else{return{};}});break;}}function getCall(_0x1b4430,_0x36e8de,_0x3e772d,_0x220d97,_0x60e6fc,_0x2d409f,_0x4159ab,_0x2d9ed0){logger[_0x12e3('0x30')](_0x12e3('0x54'));var _0x2c52c7={};_0x2c52c7[_0x12e3('0x55')]={'name':!_[_0x12e3('0x1c')](_0x220d97['role']['name'])&&!_[_0x12e3('0x1c')](_0x220d97[_0x12e3('0x39')][_0x12e3('0x18')])&&_0x220d97[_0x12e3('0x39')][_0x12e3('0x18')]===_0x12e3('0x56')?_0x220d97[_0x12e3('0x43')]['name']:!_[_0x12e3('0x1c')](_0x220d97[_0x12e3('0x44')])?_0x220d97['first_name']+'\x20'+_0x220d97[_0x12e3('0x45')]:_0x220d97[_0x12e3('0x45')],'id':_0x220d97['id']};_0x2c52c7['Subject']=intUtil['getString'](_0x2d409f[_0x12e3('0x57')],_0x4159ab,'\x20');_0x2c52c7[_0x12e3('0x58')]=intUtil[_0x12e3('0x59')](_0x2d409f[_0x12e3('0x5a')],_0x4159ab,'\x0a');if(_0x60e6fc[_0x12e3('0x3f')]===_0x12e3('0x51')){_0x2c52c7[_0x12e3('0x5b')]={'name':!_[_0x12e3('0x1c')](_0x60e6fc[_0x12e3('0x5c')])?_0x60e6fc['Full_Name']:!_[_0x12e3('0x1c')](_0x60e6fc['First_Name'])?_0x60e6fc[_0x12e3('0x5d')]+'\x20'+_0x60e6fc[_0x12e3('0x5e')]:_0x60e6fc[_0x12e3('0x5e')],'id':_0x60e6fc['id']};}if(_0x60e6fc[_0x12e3('0x3f')]===_0x12e3('0x4f')){_0x2c52c7[_0x12e3('0x5f')]={'name':!_[_0x12e3('0x1c')](_0x60e6fc[_0x12e3('0x5c')])?_0x60e6fc[_0x12e3('0x5c')]:!_[_0x12e3('0x1c')](_0x60e6fc[_0x12e3('0x5d')])?_0x60e6fc[_0x12e3('0x5d')]+'\x20'+_0x60e6fc[_0x12e3('0x5e')]:_0x60e6fc[_0x12e3('0x5e')],'id':_0x60e6fc['id']};_0x2c52c7[_0x12e3('0x60')]=_['startCase'](_0x60e6fc[_0x12e3('0x3f')]);}if(_0x4159ab[_0x12e3('0x61')]){_0x2c52c7['Call_Duration']=moment[_0x12e3('0x62')](parseInt(_0x4159ab[_0x12e3('0x61')])*0x3e8)[_0x12e3('0x32')]('mm:ss');}else if(_0x4159ab[_0x12e3('0x63')]&&_0x4159ab[_0x12e3('0x64')]){_0x2c52c7[_0x12e3('0x65')]=moment[_0x12e3('0x62')](moment(_0x4159ab['endtime'],_0x12e3('0x66'))[_0x12e3('0x67')](moment(_0x4159ab[_0x12e3('0x68')],_0x12e3('0x66'))))[_0x12e3('0x32')](_0x12e3('0x69'));}switch(_0x4159ab['lastevent']){case _0x12e3('0x6a'):_0x2c52c7[_0x12e3('0x6b')]=_0x12e3('0x6c');break;case _0x12e3('0x6d'):case _0x12e3('0x6e'):_0x2c52c7[_0x12e3('0x6b')]=_0x12e3('0x6f');break;case'rejected':_0x2c52c7[_0x12e3('0x6b')]=_0x12e3('0x70');break;case'abandoned':_0x2c52c7[_0x12e3('0x6b')]=_0x12e3('0x71');break;case _0x12e3('0x72'):_0x2c52c7[_0x12e3('0x6b')]=_0x12e3('0x73');default:}_0x2c52c7['Call_Start_Time']=(_0x2d9ed0===_0x12e3('0x74')?moment(_0x4159ab['starttime'])['format'](_0x12e3('0x66')):moment(_0x4159ab[_0x12e3('0x75')])[_0x12e3('0x32')](_0x12e3('0x66')))||moment()[_0x12e3('0x32')]('YYYY-MM-DDTHH:mm:ss');_0x2c52c7[_0x12e3('0x76')]=_0x2d9ed0||_0x12e3('0x77');_0x2c52c7=_['merge'](_0x2c52c7,getCustomFields(_0x2d409f[_0x12e3('0x78')],_0x4159ab));return request({'method':_0x12e3('0x24'),'uri':_0x12e3('0x40')+_0x36e8de+_0x12e3('0x79'),'headers':{'Authorization':_0x12e3('0x35')+_0x1b4430},'body':{'data':[_0x2c52c7]},'json':!![]})['then'](function(_0x5880fc){if(_0x5880fc&&_0x5880fc[_0x12e3('0x46')][0x0][_0x12e3('0x47')]===_0x12e3('0x48')){logger[_0x12e3('0x30')]('Call\x20created!');return{'id':_0x5880fc[_0x12e3('0x46')][0x0][_0x12e3('0x7a')]['id']};}})[_0x12e3('0x2d')](function(_0x319563){logger['info'](_0x12e3('0x7b'),_0x319563[_0x12e3('0x7c')]);console['log'](_0x12e3('0x7b'),_0x319563);});}exports[_0x12e3('0x7d')]=function(_0x4f0d07,_0x4b048f,_0x77aa9a,_0x3a0598,_0x3b1835,_0x18c21b){var _0x407667,_0x5703aa,_0x3c6219;_0x18c21b['host']=intUtil[_0x12e3('0x7e')](_0x18c21b['host']);_0x18c21b[_0x12e3('0x7f')]=intUtil['stripTrailingSlash'](_0x18c21b[_0x12e3('0x7f')]);if(_0x3b1835&&_0x3b1835[_0x12e3('0x80')]){logger[_0x12e3('0x30')](_0x12e3('0x81'),_0x12e3('0x82'));_0x4b048f['recordingURL']=_0x18c21b[_0x12e3('0x7f')]+_0x12e3('0x83')+_0x4b048f[_0x12e3('0x84')]+_0x12e3('0x85')+md5(_0x4b048f[_0x12e3('0x84')]);}else{_0x4b048f[_0x12e3('0x86')]='';}var _0x50c5d7=_0x18c21b[_0x12e3('0x87')]==='zoho.eu'?'eu':_0x12e3('0x88');return getAccessToken(_0x18c21b)['then'](function(_0x256049){_0x3c6219=_0x256049;return getUser(_0x3c6219,_0x50c5d7,_0x18c21b,_0x3a0598[_0x12e3('0x89')]);})[_0x12e3('0x29')](function(_0x3122ad){_0x407667=_0x3122ad;logger['info']('The\x20User\x20ID\x20is:',_0x407667['id']);return getEndUser(_0x3c6219,_0x50c5d7,_0x18c21b,_0x4b048f[_0x12e3('0x8a')],_0x4b048f[_0x12e3('0x8b')],_0x407667,_0x77aa9a);})[_0x12e3('0x29')](function(_0x3d1164){_0x5703aa=_0x3d1164;return getCall(_0x3c6219,_0x50c5d7,_0x18c21b,_0x407667,_0x5703aa,_0x77aa9a,_0x4b048f,_0x12e3('0x77'));})[_0x12e3('0x29')](function(_0x2f5a7d){if(_0x2f5a7d){logger['info'](_0x12e3('0x8c'),_0x2f5a7d['id']);logger[_0x12e3('0x30')](_0x12e3('0x81'),_0x12e3('0x8d'));emit(util['format']('user:%s',_0x3a0598[_0x12e3('0x18')]),_0x12e3('0x8e'),{'uri':_0x12e3('0x8f')+_0x18c21b[_0x12e3('0x87')]+_0x12e3('0x90')+_0x2f5a7d['id']});}})['catch'](function(_0x556798){logger[_0x12e3('0x2e')](_0x12e3('0x81'),JSON[_0x12e3('0x3d')](_0x556798));});};exports['outbound']=function(_0x3af0b4,_0x2966f9,_0x24fae5,_0x1e2a77,_0x260286,_0x3f7a2e,_0x3c1d23){var _0x2e4ef7,_0x5a3dd1,_0x9ca9c6;_0x3f7a2e[_0x12e3('0x87')]=intUtil['stripTrailingSlash'](_0x3f7a2e[_0x12e3('0x87')]);_0x3f7a2e[_0x12e3('0x7f')]=intUtil['stripTrailingSlash'](_0x3f7a2e[_0x12e3('0x7f')]);if(_0x3c1d23&&_0x3c1d23[_0x12e3('0x91')]&&_0x3c1d23[_0x12e3('0x91')]!==_0x12e3('0x92')){logger[_0x12e3('0x30')](_0x12e3('0x93'),'Recording\x20is\x20enabled!');_0x2966f9[_0x12e3('0x86')]=_0x3f7a2e[_0x12e3('0x7f')]+_0x12e3('0x83')+_0x2966f9['uniqueid']+_0x12e3('0x85')+md5(_0x2966f9[_0x12e3('0x84')]);}var _0x485ef7=_0x3f7a2e[_0x12e3('0x87')]===_0x12e3('0x94')?'eu':'com';return getAccessToken(_0x3f7a2e)[_0x12e3('0x29')](function(_0x3169f6){_0x9ca9c6=_0x3169f6;return getUser(_0x9ca9c6,_0x485ef7,_0x3f7a2e,_0x1e2a77[_0x12e3('0x89')]);})['then'](function(_0x3e1477){_0x2e4ef7=_0x3e1477;logger[_0x12e3('0x30')]('The\x20User\x20ID\x20is:',_0x2e4ef7['id']);return getEndUser(_0x9ca9c6,_0x485ef7,_0x3f7a2e,_0x2966f9[_0x12e3('0x95')],_0x2966f9[_0x12e3('0x96')],_0x2e4ef7,_0x24fae5);})['then'](function(_0x5d029c){_0x5a3dd1=_0x5d029c;return getCall(_0x9ca9c6,_0x485ef7,_0x3f7a2e,_0x2e4ef7,_0x5a3dd1,_0x24fae5,_0x2966f9,'Outbound');})[_0x12e3('0x29')](function(_0x3e7f6f){if(_0x3e7f6f){logger[_0x12e3('0x30')](_0x12e3('0x8c'),_0x3e7f6f['id']);logger[_0x12e3('0x30')]('[OUTBOUND]',_0x12e3('0x8d'));emit(util['format']('user:%s',_0x1e2a77[_0x12e3('0x18')]),_0x12e3('0x8e'),{'uri':_0x12e3('0x8f')+_0x3f7a2e['host']+_0x12e3('0x90')+_0x3e7f6f['id']});}})[_0x12e3('0x2d')](function(_0x54388a){logger['error']('[OUTBOUND]',JSON[_0x12e3('0x3d')](_0x54388a));});};exports[_0x12e3('0x97')]=function(_0x5d2d82,_0x10e1cb,_0x171b19,_0x358bdf,_0x1dbe57,_0x9a93d3){var _0x28dea8,_0x23b600,_0x5d82f2;_0x9a93d3[_0x12e3('0x87')]=intUtil[_0x12e3('0x7e')](_0x9a93d3[_0x12e3('0x87')]);_0x9a93d3[_0x12e3('0x7f')]=intUtil[_0x12e3('0x7e')](_0x9a93d3[_0x12e3('0x7f')]);if(_0x1dbe57&&_0x1dbe57[_0x12e3('0x80')]){logger['info']('['+_0x10e1cb[_0x12e3('0x98')][_0x12e3('0x99')]()+']',_0x12e3('0x82'));_0x10e1cb[_0x12e3('0x86')]=_0x9a93d3[_0x12e3('0x7f')]+_0x12e3('0x83')+_0x10e1cb[_0x12e3('0x84')]+_0x12e3('0x85')+md5(_0x10e1cb[_0x12e3('0x84')]);}else{_0x10e1cb[_0x12e3('0x86')]='';}var _0xf05f11=_0x9a93d3[_0x12e3('0x87')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x9a93d3)['then'](function(_0x3f8ec2){_0x5d82f2=_0x3f8ec2;return getUser(_0x5d82f2,_0xf05f11,_0x9a93d3);})[_0x12e3('0x29')](function(_0x4817ae){_0x28dea8=_0x4817ae;logger[_0x12e3('0x30')](_0x12e3('0x9a'),_0x28dea8['id']);return getEndUser(_0x5d82f2,_0xf05f11,_0x9a93d3,_0x10e1cb[_0x12e3('0x8a')],_0x10e1cb[_0x12e3('0x8b')],_0x28dea8,_0x171b19);})['then'](function(_0x20340){_0x23b600=_0x20340;return getCall(_0x5d82f2,_0xf05f11,_0x9a93d3,_0x28dea8,_0x23b600,_0x171b19,_0x10e1cb,'Inbound');})['then'](function(_0x4c456f){if(_0x4c456f){logger[_0x12e3('0x30')](_0x12e3('0x8c'),_0x4c456f['id']);}})['catch'](function(_0x2a9452){logger[_0x12e3('0x2e')]('['+_0x10e1cb[_0x12e3('0x98')][_0x12e3('0x99')]()+']',JSON[_0x12e3('0x3d')](_0x2a9452));});}; \ 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 2b23109..fec5c23 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 _0x0fa9=['info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','mustache','../../../../config/logger','trigger','exec','data2','Script','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x0fa9,0x64));var _0x90fa=function(_0x2a877b,_0x3e1367){_0x2a877b=_0x2a877b-0x0;var _0x62de26=_0x0fa9[_0x2a877b];return _0x62de26;};'use strict';var util=require('util');var sh=require(_0x90fa('0x0'));var Mustache=require(_0x90fa('0x1'));var logger=require(_0x90fa('0x2'))(_0x90fa('0x3'));exports[_0x90fa('0x4')]=function(_0x84578c,_0x5b46e3){var _0x4c1c5d=_0x84578c[_0x90fa('0x5')]?_0x84578c[_0x90fa('0x5')]:_0x90fa('0x6');var _0x1c6aa2=_0x84578c[_0x90fa('0x7')]?Mustache[_0x90fa('0x8')](_0x84578c['data3'],_0x5b46e3):_0x5b46e3;sh[_0x90fa('0x4')](_0x1c6aa2,function(_0x413769,_0x2041c5,_0x210d7b){if(_0x413769!==0x0){logger[_0x90fa('0x9')](util[_0x90fa('0xa')](_0x90fa('0xb'),_0x4c1c5d,_0x1c6aa2,_0x413769,_0x210d7b));}else{logger[_0x90fa('0xc')](util['format'](_0x90fa('0xd'),_0x4c1c5d,_0x1c6aa2,_0x2041c5));}});}; \ No newline at end of file +var _0xf65f=['data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','../../../../config/logger','trigger','exec','data2'];(function(_0x2c937a,_0xe46ed1){var _0xea8f30=function(_0x509e28){while(--_0x509e28){_0x2c937a['push'](_0x2c937a['shift']());}};_0xea8f30(++_0xe46ed1);}(_0xf65f,0xe1));var _0xff65=function(_0x54d59a,_0x5b3c2c){_0x54d59a=_0x54d59a-0x0;var _0x5b52b6=_0xf65f[_0x54d59a];return _0x5b52b6;};'use strict';var util=require(_0xff65('0x0'));var sh=require(_0xff65('0x1'));var Mustache=require('mustache');var logger=require(_0xff65('0x2'))(_0xff65('0x3'));exports[_0xff65('0x4')]=function(_0x4d056a,_0x29a752){var _0x187509=_0x4d056a['data2']?_0x4d056a[_0xff65('0x5')]:'Script';var _0x427042=_0x4d056a[_0xff65('0x6')]?Mustache['render'](_0x4d056a[_0xff65('0x6')],_0x29a752):_0x29a752;sh[_0xff65('0x4')](_0x427042,function(_0x536403,_0x3ea709,_0x3565eb){if(_0x536403!==0x0){logger[_0xff65('0x7')](util[_0xff65('0x8')](_0xff65('0x9'),_0x187509,_0x427042,_0x536403,_0x3565eb));}else{logger['info'](util[_0xff65('0x8')](_0xff65('0xa'),_0x187509,_0x427042,_0x3ea709));}});}; \ 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 8fbeb79..2ddfa00 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 _0x5802=['request-promise','util','mustache','exec','data1','render','data2','data5','data6','error','stack','DELETE','data7','parse','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','isNil',',\x20request\x20body:\x20','object','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','message'];(function(_0x599da4,_0x2ec53d){var _0x380805=function(_0x15d390){while(--_0x15d390){_0x599da4['push'](_0x599da4['shift']());}};_0x380805(++_0x2ec53d);}(_0x5802,0x122));var _0x2580=function(_0x5cbace,_0x33943c){_0x5cbace=_0x5cbace-0x0;var _0x6de5b8=_0x5802[_0x5cbace];return _0x6de5b8;};'use strict';var rp=require(_0x2580('0x0'));var util=require(_0x2580('0x1'));var _=require('lodash');var Mustache=require(_0x2580('0x2'));var logger=require('../../../../config/logger')('trigger');exports[_0x2580('0x3')]=function(_0x4f80eb,_0x30ae8c){var _0x542018,_0x52c6df;var _0x4e8371={'method':_0x4f80eb[_0x2580('0x4')]['toUpperCase'](),'uri':Mustache[_0x2580('0x5')](_0x4f80eb[_0x2580('0x6')],_0x30ae8c),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4f80eb['data5'])==='number'&&parseInt(_0x4f80eb[_0x2580('0x7')])>=0x1&&parseInt(_0x4f80eb[_0x2580('0x7')])<=0xa?parseInt(_0x4f80eb[_0x2580('0x7')])*0x3e8:0x5*0x3e8};try{_0x4e8371['headers']=_0x4f80eb['data6']?JSON['parse'](Mustache[_0x2580('0x5')](_0x4f80eb[_0x2580('0x8')],_0x30ae8c)):{};}catch(_0x16b07b){logger[_0x2580('0x9')](_0x16b07b[_0x2580('0xa')]);}switch(_0x4f80eb['data1']['toUpperCase']()){case'GET':case _0x2580('0xb'):_0x542018=null;_0x4e8371['qs']=_0x30ae8c;break;case'POST':case'PUT':if(_0x4f80eb[_0x2580('0xc')]){try{_0x542018=JSON[_0x2580('0xd')](Mustache[_0x2580('0x5')](_0x4f80eb['data7'],_0x30ae8c));_0x4e8371[_0x2580('0xe')]=_0x542018;}catch(_0x24088e){logger[_0x2580('0x9')](_0x24088e['stack']);logger[_0x2580('0x9')](_0x2580('0xf'));}}else{_0x542018=_0x30ae8c;_0x4e8371[_0x2580('0xe')]=_0x542018;}break;}logger['info'](util[_0x2580('0x10')](_0x2580('0x11'),_0x4f80eb[_0x2580('0x4')],_0x4f80eb[_0x2580('0x6')],JSON[_0x2580('0x12')](_0x4e8371)));rp(_0x4e8371)['then'](function(_0x19f9dd){_0x542018=!_[_0x2580('0x13')](_0x542018)?_0x2580('0x14')+_0x542018:'';_0x52c6df=typeof _0x19f9dd['body']===_0x2580('0x15')?JSON['stringify'](_0x19f9dd[_0x2580('0xe')]):_0x19f9dd[_0x2580('0xe')];logger[_0x2580('0x16')](util[_0x2580('0x10')](_0x2580('0x17'),_0x4f80eb[_0x2580('0x4')],_0x4f80eb['data2'],_0x19f9dd['statusCode'],_0x52c6df));})[_0x2580('0x18')](function(_0x16b5e0){logger[_0x2580('0x9')](util[_0x2580('0x10')](_0x2580('0x19'),_0x4f80eb[_0x2580('0x4')],_0x4f80eb['data2'],_0x16b5e0[_0x2580('0x1a')],_0x16b5e0[_0x2580('0x1b')],_0x16b5e0[_0x2580('0x1c')]));});}; \ No newline at end of file +var _0x194b=['mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','data5','headers','data6','parse','render','error','DELETE','PUT','data7','body','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','isNil','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','request-promise','lodash'];(function(_0x1e77ed,_0x5720c1){var _0x32ed55=function(_0x282f65){while(--_0x282f65){_0x1e77ed['push'](_0x1e77ed['shift']());}};_0x32ed55(++_0x5720c1);}(_0x194b,0x148));var _0xb194=function(_0x52c2c1,_0x5d1174){_0x52c2c1=_0x52c2c1-0x0;var _0x197712=_0x194b[_0x52c2c1];return _0x197712;};'use strict';var rp=require(_0xb194('0x0'));var util=require('util');var _=require(_0xb194('0x1'));var Mustache=require(_0xb194('0x2'));var logger=require(_0xb194('0x3'))(_0xb194('0x4'));exports[_0xb194('0x5')]=function(_0x232e94,_0x780dd1){var _0x403701,_0x251832;var _0x362f06={'method':_0x232e94[_0xb194('0x6')][_0xb194('0x7')](),'uri':Mustache['render'](_0x232e94['data2'],_0x780dd1),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x232e94[_0xb194('0x8')])==='number'&&parseInt(_0x232e94[_0xb194('0x8')])>=0x1&&parseInt(_0x232e94[_0xb194('0x8')])<=0xa?parseInt(_0x232e94[_0xb194('0x8')])*0x3e8:0x5*0x3e8};try{_0x362f06[_0xb194('0x9')]=_0x232e94[_0xb194('0xa')]?JSON[_0xb194('0xb')](Mustache[_0xb194('0xc')](_0x232e94[_0xb194('0xa')],_0x780dd1)):{};}catch(_0x17d00c){logger[_0xb194('0xd')](_0x17d00c['stack']);}switch(_0x232e94[_0xb194('0x6')]['toUpperCase']()){case'GET':case _0xb194('0xe'):_0x403701=null;_0x362f06['qs']=_0x780dd1;break;case'POST':case _0xb194('0xf'):if(_0x232e94[_0xb194('0x10')]){try{_0x403701=JSON['parse'](Mustache[_0xb194('0xc')](_0x232e94[_0xb194('0x10')],_0x780dd1));_0x362f06[_0xb194('0x11')]=_0x403701;}catch(_0x495525){logger[_0xb194('0xd')](_0x495525[_0xb194('0x12')]);logger[_0xb194('0xd')](_0xb194('0x13'));}}else{_0x403701=_0x780dd1;_0x362f06[_0xb194('0x11')]=_0x403701;}break;}logger['info'](util[_0xb194('0x14')](_0xb194('0x15'),_0x232e94['data1'],_0x232e94[_0xb194('0x16')],JSON[_0xb194('0x17')](_0x362f06)));rp(_0x362f06)['then'](function(_0x1aa352){_0x403701=!_[_0xb194('0x18')](_0x403701)?',\x20request\x20body:\x20'+_0x403701:'';_0x251832=typeof _0x1aa352['body']===_0xb194('0x19')?JSON['stringify'](_0x1aa352['body']):_0x1aa352[_0xb194('0x11')];logger['info'](util[_0xb194('0x14')](_0xb194('0x1a'),_0x232e94['data1'],_0x232e94['data2'],_0x1aa352[_0xb194('0x1b')],_0x251832));})[_0xb194('0x1c')](function(_0x24254c){logger['error'](util[_0xb194('0x14')](_0xb194('0x1d'),_0x232e94[_0xb194('0x6')],_0x232e94[_0xb194('0x16')],_0x24254c[_0xb194('0x1b')],_0x24254c['name'],_0x24254c['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 1ff0c1f..ce4561d 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 _0x5d3f=['result','catch','exports','jayson/promise','routing','client','http','Request','debug','rpc','error','message'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x5d3f,0xb7));var _0xf5d3=function(_0xbae156,_0x46c9fc){_0xbae156=_0xbae156-0x0;var _0x17986b=_0x5d3f[_0xbae156];return _0x17986b;};'use strict';var jayson=require(_0xf5d3('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')(_0xf5d3('0x1'));var client=jayson[_0xf5d3('0x2')][_0xf5d3('0x3')]({'port':0x2329});client[_0xf5d3('0x4')]=function(_0x50ee44,_0x588527){return new BPromise(function(_0x3bc705,_0x59ed67){return client['request'](_0x50ee44,_0x588527)['then'](function(_0x410b10){logger[_0xf5d3('0x5')](_0xf5d3('0x6'),'routing',_0x50ee44,_0x588527,_0x410b10);if(_0x410b10[_0xf5d3('0x7')]){logger[_0xf5d3('0x7')](_0xf5d3('0x6'),_0xf5d3('0x1'),_0x50ee44,_0x410b10[_0xf5d3('0x7')][_0xf5d3('0x8')],_0x588527);return _0x59ed67(_0x410b10['error'][_0xf5d3('0x8')]);}else{return _0x3bc705(_0x410b10[_0xf5d3('0x9')]);}})[_0xf5d3('0xa')](function(_0x4be3d){logger['error'](_0xf5d3('0x6'),_0xf5d3('0x1'),_0x50ee44,_0x4be3d,_0x588527);return _0x59ed67(_0x4be3d);});});};module[_0xf5d3('0xb')]=client; \ No newline at end of file +var _0x00cb=['rpc','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','debug','error','message','result','catch'];(function(_0x4c2d70,_0x3877ae){var _0x54831e=function(_0x28eddc){while(--_0x28eddc){_0x4c2d70['push'](_0x4c2d70['shift']());}};_0x54831e(++_0x3877ae);}(_0x00cb,0x83));var _0xb00c=function(_0x5a03c5,_0x33d486){_0x5a03c5=_0x5a03c5-0x0;var _0x405ca9=_0x00cb[_0x5a03c5];return _0x405ca9;};'use strict';var jayson=require(_0xb00c('0x0'));var BPromise=require(_0xb00c('0x1'));var logger=require(_0xb00c('0x2'))(_0xb00c('0x3'));var client=jayson[_0xb00c('0x4')][_0xb00c('0x5')]({'port':0x2329});client[_0xb00c('0x6')]=function(_0x219f22,_0x1da0b4){return new BPromise(function(_0x50ccb8,_0x564648){return client['request'](_0x219f22,_0x1da0b4)['then'](function(_0x513d43){logger[_0xb00c('0x7')]('rpc',_0xb00c('0x3'),_0x219f22,_0x1da0b4,_0x513d43);if(_0x513d43[_0xb00c('0x8')]){logger[_0xb00c('0x8')]('rpc',_0xb00c('0x3'),_0x219f22,_0x513d43['error'][_0xb00c('0x9')],_0x1da0b4);return _0x564648(_0x513d43['error'][_0xb00c('0x9')]);}else{return _0x50ccb8(_0x513d43[_0xb00c('0xa')]);}})[_0xb00c('0xb')](function(_0x58d663){logger[_0xb00c('0x8')](_0xb00c('0xc'),_0xb00c('0x3'),_0x219f22,_0x58d663,_0x1da0b4);return _0x564648(_0x58d663);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 7636108..8e9ce33 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 _0x232a=['getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./rpc/mailAccount','./rpc/setting','then','getMailAccounts','initMailAccounts','refresh','listen'];(function(_0xda90fc,_0x42b0ca){var _0x1bd247=function(_0x22e226){while(--_0x22e226){_0xda90fc['push'](_0xda90fc['shift']());}};_0x1bd247(++_0x42b0ca);}(_0x232a,0x87));var _0xa232=function(_0x3ec040,_0x32c577){_0x3ec040=_0x3ec040-0x0;var _0x40b32b=_0x232a[_0x3ec040];return _0x40b32b;};'use strict';var server=require(_0xa232('0x0'));var Realtime=require('./realtime');var EmailChannel=require('./lib/email');var mailAccount=require(_0xa232('0x1'));var setting=require(_0xa232('0x2'));var logger=require('../../config/logger')('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0xa232('0x3')](mailAccount[_0xa232('0x4')]())['then'](realtime[_0xa232('0x5')]())[_0xa232('0x3')](function(){email[_0xa232('0x6')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0xa232('0x7')](realtime,email)[_0xa232('0x3')](function(){return initRealtime();})[_0xa232('0x3')](function(){return setting[_0xa232('0x8')]();})[_0xa232('0x3')](function(_0x113a1a){return setInterval(initRealtime,_0x113a1a[_0xa232('0x9')]*0x3e8);})[_0xa232('0xa')](function(_0x41c408){logger[_0xa232('0xb')](_0xa232('0xc'),_0x41c408);});}main(); \ No newline at end of file +var _0x58ea=['listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/setting','../../config/logger','email','then','getMailAccounts','refresh','mailAccounts'];(function(_0x1c94c4,_0x5c25b3){var _0x4a2e5f=function(_0x3f7df1){while(--_0x3f7df1){_0x1c94c4['push'](_0x1c94c4['shift']());}};_0x4a2e5f(++_0x5c25b3);}(_0x58ea,0x126));var _0xa58e=function(_0x1ec7f5,_0x19b149){_0x1ec7f5=_0x1ec7f5-0x0;var _0x121d0f=_0x58ea[_0x1ec7f5];return _0x121d0f;};'use strict';var server=require(_0xa58e('0x0'));var Realtime=require(_0xa58e('0x1'));var EmailChannel=require(_0xa58e('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0xa58e('0x3'));var logger=require(_0xa58e('0x4'))(_0xa58e('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0xa58e('0x6')](mailAccount[_0xa58e('0x7')]())[_0xa58e('0x6')](realtime['initMailAccounts']())[_0xa58e('0x6')](function(){email[_0xa58e('0x8')](realtime[_0xa58e('0x9')]);return realtime;});}function main(){return server[_0xa58e('0xa')](realtime,email)[_0xa58e('0x6')](function(){return initRealtime();})[_0xa58e('0x6')](function(){return setting[_0xa58e('0xb')]();})[_0xa58e('0x6')](function(_0x5acf05){return setInterval(initRealtime,_0x5acf05[_0xa58e('0xc')]*0x3e8);})[_0xa58e('0xd')](function(_0x2d4304){logger[_0xa58e('0xe')](_0xa58e('0xf'),_0x2d4304);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 446da8f..95ff818 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 _0x121c=['smtp','prototype','name','Imap','status','messageStatus','isNil','stringify','emit','refresh','active','service','provider','hasOwnProperty','box','bind','handleImapEmail','error','handleImapError','handleImapBox','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','sendMail','send','Smtp','verified','verify','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','email','redis','localhost','./imap','info','start\x20email\x20channel','mailAccounts','imapAccounts'];(function(_0xba6e45,_0x301f74){var _0x35d74f=function(_0x4af989){while(--_0x4af989){_0xba6e45['push'](_0xba6e45['shift']());}};_0x35d74f(++_0x301f74);}(_0x121c,0xf6));var _0xc121=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x121c[_0x3a6efd];return _0x487b9a;};'use strict';var _=require(_0xc121('0x0'));var moment=require(_0xc121('0x1'));var BPromise=require(_0xc121('0x2'));var md5=require(_0xc121('0x3'));var Redis=require(_0xc121('0x4'));var config=require(_0xc121('0x5'));var logger=require('../../../config/logger')(_0xc121('0x6'));config[_0xc121('0x7')]=_['defaults'](config[_0xc121('0x7')],{'host':_0xc121('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc121('0x7')]));var EmailImap=require(_0xc121('0x9'));var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x405a66){logger[_0xc121('0xa')](_0xc121('0xb'));this[_0xc121('0xc')]=_0x405a66['mailAccounts'];this[_0xc121('0xd')]={};this[_0xc121('0xe')]=new EmailSmtp();}EmailChannel[_0xc121('0xf')]['emit']=function(_0x479d2a){var _0x4d8246=this[_0xc121('0xc')][_0x479d2a];var _0x1d9711={'id':_0x4d8246['id'],'name':_0x4d8246[_0xc121('0x10')],'key':_0x4d8246['key'],'active':_0x4d8246['active'],'Imap':{'status':_0x4d8246[_0xc121('0x11')][_0xc121('0x12')],'messageStatus':_0x4d8246['Imap'][_0xc121('0x13')],'total':_0x4d8246['Imap']['total']}};if(_[_0xc121('0x14')](md5Accounts[_0x479d2a])){md5Accounts[_0x479d2a]={};}var _0x56ca58=md5(JSON[_0xc121('0x15')](_0x1d9711));if(md5Accounts[_0x479d2a][_0xc121('0x3')]!==_0x56ca58){md5Accounts[_0x479d2a][_0xc121('0x3')]=_0x56ca58;io[_0xc121('0x16')]('mailAccount:update',_0x1d9711);}};EmailChannel[_0xc121('0xf')][_0xc121('0x17')]=function(_0x2a3ac8){for(var _0xdca357 in _0x2a3ac8){if(_0x2a3ac8['hasOwnProperty'](_0xdca357)){if(_0x2a3ac8[_0xdca357]['Imap']&&_0x2a3ac8[_0xdca357][_0xc121('0x18')]){var _0x3785de=_0x2a3ac8[_0xdca357]['Imap'];if(!_0x3785de[_0xc121('0x19')]&&_0x2a3ac8[_0xdca357][_0xc121('0x1a')]!=='custom')_0x3785de[_0xc121('0x19')]=_0x2a3ac8[_0xdca357]['provider'];if(!this[_0xc121('0xd')][_0xc121('0x1b')](_0x3785de['id'])){this['imapAccounts'][_0x3785de['id']]=new EmailImap(_0x3785de,_0x2a3ac8[_0xdca357][_0xc121('0x6')]);this[_0xc121('0xd')][_0x3785de['id']]['on'](_0xc121('0x1c'),this['handleImapBox'][_0xc121('0x1d')](this,_0xdca357));this[_0xc121('0xd')][_0x3785de['id']]['on'](_0xc121('0x6'),this[_0xc121('0x1e')][_0xc121('0x1d')](this,_0xdca357));this[_0xc121('0xd')][_0x3785de['id']]['on']('end',this['handleImapEnd'][_0xc121('0x1d')](this,_0xdca357));this['imapAccounts'][_0x3785de['id']]['on'](_0xc121('0x1f'),this[_0xc121('0x20')]['bind'](this,_0xdca357));}}else{if(_[_0xc121('0x14')](this[_0xc121('0xc')][_0xdca357][_0xc121('0x11')])){this[_0xc121('0xc')][_0xdca357]['Imap']={};}this[_0xc121('0xc')][_0xdca357][_0xc121('0x11')][_0xc121('0x12')]='disabled';this[_0xc121('0xc')][_0xdca357][_0xc121('0x11')][_0xc121('0x13')]='';this['emit'](_0xdca357);}}}};EmailChannel[_0xc121('0xf')][_0xc121('0x21')]=function(_0x2429d3,_0x4e7122){if(this['mailAccounts'][_0x2429d3]){this[_0xc121('0xc')][_0x2429d3][_0xc121('0x11')][_0xc121('0x12')]='connected';this[_0xc121('0xc')][_0x2429d3][_0xc121('0x11')][_0xc121('0x13')]=_0x4e7122[_0xc121('0x10')];if(_0x4e7122[_0xc121('0x22')]){this[_0xc121('0xc')][_0x2429d3][_0xc121('0x11')][_0xc121('0x23')]=_0x4e7122[_0xc121('0x22')][_0xc121('0x23')];}return this[_0xc121('0x16')](_0x2429d3);}};EmailChannel[_0xc121('0xf')][_0xc121('0x1e')]=function(_0x1788f6,_0x4ddff1){logger[_0xc121('0xa')](_0xc121('0x24'),_0x4ddff1[_0xc121('0x25')],_0x4ddff1[_0xc121('0x26')],_0x4ddff1[_0xc121('0x27')],_0x1788f6);if(this[_0xc121('0xc')][_0x1788f6]){return mailAccount[_0xc121('0x28')](_0x1788f6,_0x4ddff1)[_0xc121('0x29')](function(_0x4307a2){if(_0x4307a2){logger[_0xc121('0xa')](_0xc121('0x2a'));}})['catch'](function(_0x5cf43e){logger[_0xc121('0x1f')](_0xc121('0x2b'),JSON[_0xc121('0x15')](_0x5cf43e));});}};EmailChannel[_0xc121('0xf')][_0xc121('0x2c')]=function(_0x30d5e4){if(this[_0xc121('0xc')][_0x30d5e4]&&this[_0xc121('0xc')][_0x30d5e4][_0xc121('0x11')]){if(this['imapAccounts'][this['mailAccounts'][_0x30d5e4][_0xc121('0x11')]['id']]){delete this[_0xc121('0xd')][this['mailAccounts'][_0x30d5e4][_0xc121('0x11')]['id']];}this[_0xc121('0xc')][_0x30d5e4]['Imap'][_0xc121('0x2d')]=moment();this['emit'](_0x30d5e4);}};EmailChannel[_0xc121('0xf')][_0xc121('0x20')]=function(_0x410d0e,_0x30ad85){if(this[_0xc121('0xc')][_0x410d0e]){this['mailAccounts'][_0x410d0e][_0xc121('0x11')][_0xc121('0x12')]=_0xc121('0x1f');this['mailAccounts'][_0x410d0e][_0xc121('0x11')][_0xc121('0x13')]=_0x30ad85;return this[_0xc121('0x16')](_0x410d0e);}};EmailChannel[_0xc121('0xf')][_0xc121('0x2e')]=function(_0x43175c,_0x435786){return this[_0xc121('0xe')][_0xc121('0x2f')](_0x43175c,_0x435786);};EmailChannel['prototype']['verifySmtp']=function(_0xba5a6e){var _0x11c45c=this;if(this[_0xc121('0xc')][_0xba5a6e['id']]){if(_[_0xc121('0x14')](this[_0xc121('0xc')][_0xba5a6e['id']]['Smtp'])){this[_0xc121('0xc')][_0xba5a6e['id']][_0xc121('0x30')]={};}this[_0xc121('0xc')][_0xba5a6e['id']][_0xc121('0x30')][_0xc121('0x2d')]=moment();return new BPromise(function(_0x3538cf,_0x4eb405){return _0x11c45c[_0xc121('0xe')]['verify'](_0xba5a6e)[_0xc121('0x29')](function(_0x540a17){_0x11c45c[_0xc121('0xc')][_0xba5a6e['id']][_0xc121('0x30')][_0xc121('0x12')]=_0xc121('0x31');_0x11c45c[_0xc121('0xc')][_0xba5a6e['id']][_0xc121('0x30')][_0xc121('0x13')]='';_0x11c45c[_0xc121('0x16')](_0xba5a6e['id']);_0x3538cf(_0x540a17);})['catch'](function(_0x352b19){_0x11c45c[_0xc121('0xc')][_0xba5a6e['id']][_0xc121('0x30')][_0xc121('0x12')]=_0xc121('0x1f');_0x11c45c[_0xc121('0xc')][_0xba5a6e['id']][_0xc121('0x30')][_0xc121('0x13')]=_0x352b19;_0x11c45c['emit'](_0xba5a6e['id']);_0x4eb405(_0x352b19);});});}return this['smtp'][_0xc121('0x32')](_0xba5a6e);};module[_0xc121('0x33')]=EmailChannel; \ No newline at end of file +var _0x8996=['isNil','stringify','emit','mailAccount:update','refresh','hasOwnProperty','service','provider','custom','box','bind','end','handleImapEnd','error','handleImapError','disabled','handleImapBox','connected','messages','handleImapEmail','firstName','lastName','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','Smtp','verify','verified','lodash','md5','ioredis','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','name','key','Imap','status','messageStatus','total'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8996,0x171));var _0x6899=function(_0x933f1d,_0x1b9d27){_0x933f1d=_0x933f1d-0x0;var _0x20e961=_0x8996[_0x933f1d];return _0x20e961;};'use strict';var _=require(_0x6899('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0x6899('0x1'));var Redis=require(_0x6899('0x2'));var config=require('../../../config/environment');var logger=require(_0x6899('0x3'))(_0x6899('0x4'));config[_0x6899('0x5')]=_[_0x6899('0x6')](config['redis'],{'host':_0x6899('0x7'),'port':0x18eb});var io=require(_0x6899('0x8'))(new Redis(config[_0x6899('0x5')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x6899('0x9'));var mailAccount=require(_0x6899('0xa'));var md5Accounts={};function EmailChannel(_0x365d0d){logger[_0x6899('0xb')](_0x6899('0xc'));this[_0x6899('0xd')]=_0x365d0d['mailAccounts'];this[_0x6899('0xe')]={};this[_0x6899('0xf')]=new EmailSmtp();}EmailChannel[_0x6899('0x10')]['emit']=function(_0x405665){var _0x54af49=this[_0x6899('0xd')][_0x405665];var _0x119d92={'id':_0x54af49['id'],'name':_0x54af49[_0x6899('0x11')],'key':_0x54af49[_0x6899('0x12')],'active':_0x54af49['active'],'Imap':{'status':_0x54af49[_0x6899('0x13')][_0x6899('0x14')],'messageStatus':_0x54af49['Imap'][_0x6899('0x15')],'total':_0x54af49[_0x6899('0x13')][_0x6899('0x16')]}};if(_[_0x6899('0x17')](md5Accounts[_0x405665])){md5Accounts[_0x405665]={};}var _0x421fa4=md5(JSON[_0x6899('0x18')](_0x119d92));if(md5Accounts[_0x405665]['md5']!==_0x421fa4){md5Accounts[_0x405665][_0x6899('0x1')]=_0x421fa4;io[_0x6899('0x19')](_0x6899('0x1a'),_0x119d92);}};EmailChannel[_0x6899('0x10')][_0x6899('0x1b')]=function(_0x29d0b8){for(var _0x351c75 in _0x29d0b8){if(_0x29d0b8[_0x6899('0x1c')](_0x351c75)){if(_0x29d0b8[_0x351c75][_0x6899('0x13')]&&_0x29d0b8[_0x351c75]['active']){var _0xc7c71=_0x29d0b8[_0x351c75][_0x6899('0x13')];if(!_0xc7c71[_0x6899('0x1d')]&&_0x29d0b8[_0x351c75][_0x6899('0x1e')]!==_0x6899('0x1f'))_0xc7c71[_0x6899('0x1d')]=_0x29d0b8[_0x351c75][_0x6899('0x1e')];if(!this['imapAccounts'][_0x6899('0x1c')](_0xc7c71['id'])){this[_0x6899('0xe')][_0xc7c71['id']]=new EmailImap(_0xc7c71,_0x29d0b8[_0x351c75]['email']);this['imapAccounts'][_0xc7c71['id']]['on'](_0x6899('0x20'),this['handleImapBox'][_0x6899('0x21')](this,_0x351c75));this[_0x6899('0xe')][_0xc7c71['id']]['on'](_0x6899('0x4'),this['handleImapEmail']['bind'](this,_0x351c75));this['imapAccounts'][_0xc7c71['id']]['on'](_0x6899('0x22'),this[_0x6899('0x23')][_0x6899('0x21')](this,_0x351c75));this['imapAccounts'][_0xc7c71['id']]['on'](_0x6899('0x24'),this[_0x6899('0x25')][_0x6899('0x21')](this,_0x351c75));}}else{if(_[_0x6899('0x17')](this[_0x6899('0xd')][_0x351c75][_0x6899('0x13')])){this[_0x6899('0xd')][_0x351c75][_0x6899('0x13')]={};}this[_0x6899('0xd')][_0x351c75]['Imap'][_0x6899('0x14')]=_0x6899('0x26');this[_0x6899('0xd')][_0x351c75][_0x6899('0x13')][_0x6899('0x15')]='';this[_0x6899('0x19')](_0x351c75);}}}};EmailChannel[_0x6899('0x10')][_0x6899('0x27')]=function(_0x4bf5ef,_0x5421d9){if(this[_0x6899('0xd')][_0x4bf5ef]){this[_0x6899('0xd')][_0x4bf5ef][_0x6899('0x13')][_0x6899('0x14')]=_0x6899('0x28');this[_0x6899('0xd')][_0x4bf5ef][_0x6899('0x13')][_0x6899('0x15')]=_0x5421d9[_0x6899('0x11')];if(_0x5421d9[_0x6899('0x29')]){this['mailAccounts'][_0x4bf5ef][_0x6899('0x13')][_0x6899('0x16')]=_0x5421d9[_0x6899('0x29')][_0x6899('0x16')];}return this[_0x6899('0x19')](_0x4bf5ef);}};EmailChannel[_0x6899('0x10')][_0x6899('0x2a')]=function(_0x2c441a,_0x5f10e1){logger[_0x6899('0xb')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x5f10e1[_0x6899('0x2b')],_0x5f10e1[_0x6899('0x2c')],_0x5f10e1['from'],_0x2c441a);if(this[_0x6899('0xd')][_0x2c441a]){return mailAccount[_0x6899('0x2d')](_0x2c441a,_0x5f10e1)[_0x6899('0x2e')](function(_0x379004){if(_0x379004){logger[_0x6899('0xb')](_0x6899('0x2f'));}})[_0x6899('0x30')](function(_0x220a44){logger['error'](_0x6899('0x31'),JSON[_0x6899('0x18')](_0x220a44));});}};EmailChannel['prototype'][_0x6899('0x23')]=function(_0x23fc5f){if(this[_0x6899('0xd')][_0x23fc5f]&&this[_0x6899('0xd')][_0x23fc5f][_0x6899('0x13')]){if(this[_0x6899('0xe')][this[_0x6899('0xd')][_0x23fc5f][_0x6899('0x13')]['id']]){delete this[_0x6899('0xe')][this['mailAccounts'][_0x23fc5f]['Imap']['id']];}this['mailAccounts'][_0x23fc5f][_0x6899('0x13')][_0x6899('0x32')]=moment();this['emit'](_0x23fc5f);}};EmailChannel[_0x6899('0x10')][_0x6899('0x25')]=function(_0x1a7ed2,_0x18f5bb){if(this[_0x6899('0xd')][_0x1a7ed2]){this[_0x6899('0xd')][_0x1a7ed2][_0x6899('0x13')]['status']=_0x6899('0x24');this[_0x6899('0xd')][_0x1a7ed2][_0x6899('0x13')][_0x6899('0x15')]=_0x18f5bb;return this[_0x6899('0x19')](_0x1a7ed2);}};EmailChannel[_0x6899('0x10')][_0x6899('0x33')]=function(_0x341368,_0x356c3c){return this[_0x6899('0xf')][_0x6899('0x34')](_0x341368,_0x356c3c);};EmailChannel[_0x6899('0x10')]['verifySmtp']=function(_0x596a02){var _0xbade16=this;if(this[_0x6899('0xd')][_0x596a02['id']]){if(_[_0x6899('0x17')](this[_0x6899('0xd')][_0x596a02['id']][_0x6899('0x35')])){this[_0x6899('0xd')][_0x596a02['id']][_0x6899('0x35')]={};}this[_0x6899('0xd')][_0x596a02['id']][_0x6899('0x35')][_0x6899('0x32')]=moment();return new BPromise(function(_0x1fbc7c,_0x1e2f7e){return _0xbade16[_0x6899('0xf')][_0x6899('0x36')](_0x596a02)[_0x6899('0x2e')](function(_0x203dee){_0xbade16['mailAccounts'][_0x596a02['id']][_0x6899('0x35')][_0x6899('0x14')]=_0x6899('0x37');_0xbade16[_0x6899('0xd')][_0x596a02['id']]['Smtp'][_0x6899('0x15')]='';_0xbade16['emit'](_0x596a02['id']);_0x1fbc7c(_0x203dee);})['catch'](function(_0x2bc9b6){_0xbade16[_0x6899('0xd')][_0x596a02['id']]['Smtp'][_0x6899('0x14')]=_0x6899('0x24');_0xbade16[_0x6899('0xd')][_0x596a02['id']]['Smtp']['messageStatus']=_0x2bc9b6;_0xbade16[_0x6899('0x19')](_0x596a02['id']);_0x1e2f7e(_0x2bc9b6);});});}return this['smtp'][_0x6899('0x36')](_0x596a02);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 436c445..c58b3af 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 _0x90b1=['hasOwnProperty','exports','lodash','util','imap','iconv','Iconv','events','EventEmitter','mailbox','INBOX','account','getAccount','once','ready','handleReady','bind','end','handleEnd','error','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','required','modernAuthentication','xoauth2','CloudProvider','data5','getHost','email','anonymous@xcally.com','openBox','handleOpenBox','handleError','emit','readUnseen','handleCloseBox','search','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchEnd','closeBox','body','attributes','handleMessageEnd','handleMessageBody','handleSimpleParser','handleMessageAttributes','textCode'];(function(_0x2307fa,_0x266e5e){var _0x496486=function(_0x53466e){while(--_0x53466e){_0x2307fa['push'](_0x2307fa['shift']());}};_0x496486(++_0x266e5e);}(_0x90b1,0x1bb));var _0x190b=function(_0x95975e,_0x51412c){_0x95975e=_0x95975e-0x0;var _0x5d4933=_0x90b1[_0x95975e];return _0x5d4933;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var Imap=require(_0x190b('0x2'));var simpleParser=require('mailparser')['simpleParser'];var Iconv=require(_0x190b('0x3'))[_0x190b('0x4')];var EventEmitter=require(_0x190b('0x5'))[_0x190b('0x6')];var utils=require('./utils');var logger=require('../../../config/logger')('email');function EmailImap(_0x5da9c1,_0x27ff8c){this[_0x190b('0x7')]=_0x190b('0x8');this[_0x190b('0x9')]=this[_0x190b('0xa')](_0x5da9c1,_0x27ff8c);this[_0x190b('0x2')]=new Imap(this[_0x190b('0x9')]);this['imap'][_0x190b('0xb')](_0x190b('0xc'),this[_0x190b('0xd')][_0x190b('0xe')](this));this[_0x190b('0x2')][_0x190b('0xb')](_0x190b('0xf'),this[_0x190b('0x10')]['bind'](this));this[_0x190b('0x2')]['on'](_0x190b('0x11'),this['handleError'][_0x190b('0xe')](this));this[_0x190b('0x2')][_0x190b('0x12')]();}util[_0x190b('0x13')](EmailImap,EventEmitter);EmailImap[_0x190b('0x14')][_0x190b('0xa')]=function(_0x2e12d4,_0x13544c){var _0x1ff180={'connTimeout':_0x2e12d4[_0x190b('0x15')]?_0x2e12d4[_0x190b('0x15')]*0x3e8:0x2710,'authTimeout':_0x2e12d4[_0x190b('0x16')]?_0x2e12d4[_0x190b('0x16')]*0x3e8:0x1388};if(_[_0x190b('0x17')](_0x2e12d4[_0x190b('0x18')])){if(_0x2e12d4[_0x190b('0x19')]){_0x1ff180[_0x190b('0x1a')]=_0x2e12d4['user'];_0x1ff180[_0x190b('0x1b')]=_0x2e12d4['password'];}_0x1ff180[_0x190b('0x1c')]=_0x2e12d4[_0x190b('0x1c')];_0x1ff180[_0x190b('0x1d')]=_0x2e12d4[_0x190b('0x1d')]||0x3e1;if(_0x2e12d4['tls']){_0x1ff180[_0x190b('0x1e')]=!![];}else{_0x1ff180[_0x190b('0x1e')]=![];_0x1ff180[_0x190b('0x1f')]=_0x190b('0x20');}}else{if(_0x2e12d4[_0x190b('0x21')]){_0x1ff180[_0x190b('0x22')]=utils['generateXOAuth2Token'](_0x2e12d4[_0x190b('0x23')][_0x190b('0x24')],_0x2e12d4['user']);_0x1ff180[_0x190b('0x1a')]=_0x2e12d4['user'];}else{_0x1ff180['user']=_0x2e12d4[_0x190b('0x1a')];_0x1ff180[_0x190b('0x1b')]=_0x2e12d4[_0x190b('0x1b')];}_0x1ff180['host']=utils[_0x190b('0x25')](_0x2e12d4[_0x190b('0x18')]);_0x1ff180[_0x190b('0x1d')]=0x3e1;_0x1ff180[_0x190b('0x1e')]=!![];}_0x1ff180[_0x190b('0x26')]=_0x13544c||_0x2e12d4[_0x190b('0x1a')]||_0x190b('0x27');return _0x1ff180;};EmailImap['prototype']['handleReady']=function(){this[_0x190b('0x2')][_0x190b('0x28')](this['mailbox'],![],this['handleOpenBox'][_0x190b('0xe')](this));};EmailImap['prototype'][_0x190b('0x29')]=function(_0x3b6aaf,_0x51f8b4){if(_0x3b6aaf){this[_0x190b('0x2a')](_0x3b6aaf,!![]);}else{this[_0x190b('0x2b')]('box',_0x51f8b4);this[_0x190b('0x2c')]();}};EmailImap[_0x190b('0x14')][_0x190b('0x2d')]=function(_0x494f3f){if(_0x494f3f){this['handleError'](_0x494f3f,!![]);}else{this[_0x190b('0x2')]['end']();}};EmailImap[_0x190b('0x14')][_0x190b('0x2c')]=function(){this['imap'][_0x190b('0x2e')](['UNSEEN'],this[_0x190b('0x2f')]['bind'](this));};EmailImap[_0x190b('0x14')]['handleReadUnseen']=function(_0xc789e5,_0x5c6ff3){if(_0xc789e5){this['handleError'](_0xc789e5,!![]);}else{if(_0x5c6ff3[_0x190b('0x30')]){try{var _0x15fed4=this[_0x190b('0x2')][_0x190b('0x31')](_0x5c6ff3,{'bodies':'','markSeen':!![]});_0x15fed4['on'](_0x190b('0x32'),this[_0x190b('0x33')][_0x190b('0xe')](this));_0x15fed4[_0x190b('0xb')]('error',this['handleFetchError'][_0x190b('0xe')](this));_0x15fed4[_0x190b('0xb')]('end',this[_0x190b('0x34')][_0x190b('0xe')](this));}catch(_0x3e4dd8){logger[_0x190b('0x11')](_0x3e4dd8);}}else{this[_0x190b('0x2')][_0x190b('0x35')](!![],this[_0x190b('0x2d')]['bind'](this));}}};EmailImap['prototype'][_0x190b('0x33')]=function(_0x2f7111){_0x2f7111['on'](_0x190b('0x36'),this['handleMessageBody'][_0x190b('0xe')](this));_0x2f7111[_0x190b('0xb')](_0x190b('0x37'),this['handleMessageAttributes'][_0x190b('0xe')](this));_0x2f7111['once']('end',this[_0x190b('0x38')][_0x190b('0xe')](this));};EmailImap['prototype'][_0x190b('0x39')]=function(_0xfd0d62){simpleParser(_0xfd0d62,{'Iconv':Iconv},this[_0x190b('0x3a')]['bind'](this));};EmailImap[_0x190b('0x14')][_0x190b('0x3b')]=function(){};EmailImap['prototype']['handleMessageEnd']=function(){};EmailImap[_0x190b('0x14')]['handleSimpleParser']=function(_0x46bdba,_0x741e94){if(_0x46bdba){logger[_0x190b('0x11')](_0x46bdba);}else{var _0xad955a=this;utils['parser'](this[_0x190b('0x9')],_0x741e94,function(_0x5f118c){_0xad955a[_0x190b('0x2b')](_0x190b('0x26'),_0x5f118c);});}};EmailImap['prototype'][_0x190b('0x34')]=function(){this[_0x190b('0x2')][_0x190b('0x35')](!![],this['handleCloseBox'][_0x190b('0xe')](this));};EmailImap['prototype']['handleFetchError']=function(_0x554486){this[_0x190b('0x2a')](_0x554486);this[_0x190b('0x2')][_0x190b('0x35')](!![],this[_0x190b('0x2d')]['bind'](this));};EmailImap['prototype'][_0x190b('0x10')]=function(){this['emit'](_0x190b('0xf'));};EmailImap[_0x190b('0x14')]['handleError']=function(_0x2e25e3,_0x36db47){logger[_0x190b('0x11')]('handleError',this[_0x190b('0x9')][_0x190b('0x26')],JSON['stringify'](_0x2e25e3));var _0x3c734b='';if(_0x2e25e3){if(_0x2e25e3['textCode']){_0x3c734b=_0x2e25e3[_0x190b('0x3c')];}else{for(var _0x12c276 in _0x2e25e3){if(_0x2e25e3[_0x190b('0x3d')](_0x12c276)){_0x3c734b+=_['upperFirst'](_0x12c276)+':\x20'+_0x2e25e3[_0x12c276]+'\x0a';}}}}if(_0x36db47){this[_0x190b('0x2')]['end']();}else{this[_0x190b('0x2b')](_0x190b('0x11'),_0x3c734b);this[_0x190b('0x2b')](_0x190b('0xf'));}};module[_0x190b('0x3e')]=EmailImap; \ No newline at end of file +var _0x57ca=['modernAuthentication','CloudProvider','data5','getHost','anonymous@xcally.com','handleReady','handleOpenBox','emit','box','readUnseen','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','closeBox','handleMessageBody','attributes','handleMessageAttributes','parser','handleFetchError','handleCloseBox','stringify','textCode','hasOwnProperty','upperFirst','exports','util','imap','simpleParser','iconv','Iconv','events','EventEmitter','../../../config/logger','email','mailbox','INBOX','account','getAccount','once','ready','bind','end','error','handleError','connect','prototype','connTimeout','authTimeout','service','authentication','user','password','host','port','tls','autotls'];(function(_0x449926,_0x2bbd42){var _0x431b35=function(_0x304a40){while(--_0x304a40){_0x449926['push'](_0x449926['shift']());}};_0x431b35(++_0x2bbd42);}(_0x57ca,0x108));var _0xa57c=function(_0x22dba5,_0x382151){_0x22dba5=_0x22dba5-0x0;var _0x32d7ec=_0x57ca[_0x22dba5];return _0x32d7ec;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var Imap=require(_0xa57c('0x1'));var simpleParser=require('mailparser')[_0xa57c('0x2')];var Iconv=require(_0xa57c('0x3'))[_0xa57c('0x4')];var EventEmitter=require(_0xa57c('0x5'))[_0xa57c('0x6')];var utils=require('./utils');var logger=require(_0xa57c('0x7'))(_0xa57c('0x8'));function EmailImap(_0x113dcf,_0x19473f){this[_0xa57c('0x9')]=_0xa57c('0xa');this[_0xa57c('0xb')]=this[_0xa57c('0xc')](_0x113dcf,_0x19473f);this['imap']=new Imap(this[_0xa57c('0xb')]);this['imap'][_0xa57c('0xd')](_0xa57c('0xe'),this['handleReady'][_0xa57c('0xf')](this));this['imap'][_0xa57c('0xd')](_0xa57c('0x10'),this['handleEnd'][_0xa57c('0xf')](this));this['imap']['on'](_0xa57c('0x11'),this[_0xa57c('0x12')][_0xa57c('0xf')](this));this[_0xa57c('0x1')][_0xa57c('0x13')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0xa57c('0x14')]['getAccount']=function(_0x30d23d,_0x3d5995){var _0x30940d={'connTimeout':_0x30d23d[_0xa57c('0x15')]?_0x30d23d[_0xa57c('0x15')]*0x3e8:0x2710,'authTimeout':_0x30d23d[_0xa57c('0x16')]?_0x30d23d[_0xa57c('0x16')]*0x3e8:0x1388};if(_['isNil'](_0x30d23d[_0xa57c('0x17')])){if(_0x30d23d[_0xa57c('0x18')]){_0x30940d[_0xa57c('0x19')]=_0x30d23d['user'];_0x30940d[_0xa57c('0x1a')]=_0x30d23d['password'];}_0x30940d[_0xa57c('0x1b')]=_0x30d23d[_0xa57c('0x1b')];_0x30940d[_0xa57c('0x1c')]=_0x30d23d[_0xa57c('0x1c')]||0x3e1;if(_0x30d23d[_0xa57c('0x1d')]){_0x30940d[_0xa57c('0x1d')]=!![];}else{_0x30940d[_0xa57c('0x1d')]=![];_0x30940d[_0xa57c('0x1e')]='required';}}else{if(_0x30d23d[_0xa57c('0x1f')]){_0x30940d['xoauth2']=utils['generateXOAuth2Token'](_0x30d23d[_0xa57c('0x20')][_0xa57c('0x21')],_0x30d23d[_0xa57c('0x19')]);_0x30940d[_0xa57c('0x19')]=_0x30d23d['user'];}else{_0x30940d[_0xa57c('0x19')]=_0x30d23d[_0xa57c('0x19')];_0x30940d[_0xa57c('0x1a')]=_0x30d23d[_0xa57c('0x1a')];}_0x30940d[_0xa57c('0x1b')]=utils[_0xa57c('0x22')](_0x30d23d[_0xa57c('0x17')]);_0x30940d[_0xa57c('0x1c')]=0x3e1;_0x30940d[_0xa57c('0x1d')]=!![];}_0x30940d[_0xa57c('0x8')]=_0x3d5995||_0x30d23d[_0xa57c('0x19')]||_0xa57c('0x23');return _0x30940d;};EmailImap[_0xa57c('0x14')][_0xa57c('0x24')]=function(){this[_0xa57c('0x1')]['openBox'](this[_0xa57c('0x9')],![],this[_0xa57c('0x25')][_0xa57c('0xf')](this));};EmailImap[_0xa57c('0x14')][_0xa57c('0x25')]=function(_0x1e8e45,_0x8ee1c0){if(_0x1e8e45){this[_0xa57c('0x12')](_0x1e8e45,!![]);}else{this[_0xa57c('0x26')](_0xa57c('0x27'),_0x8ee1c0);this['readUnseen']();}};EmailImap[_0xa57c('0x14')]['handleCloseBox']=function(_0x54a18b){if(_0x54a18b){this[_0xa57c('0x12')](_0x54a18b,!![]);}else{this[_0xa57c('0x1')]['end']();}};EmailImap[_0xa57c('0x14')][_0xa57c('0x28')]=function(){this[_0xa57c('0x1')]['search']([_0xa57c('0x29')],this['handleReadUnseen'][_0xa57c('0xf')](this));};EmailImap['prototype'][_0xa57c('0x2a')]=function(_0x51ad09,_0xd4c5d4){if(_0x51ad09){this['handleError'](_0x51ad09,!![]);}else{if(_0xd4c5d4[_0xa57c('0x2b')]){try{var _0x1d82d9=this[_0xa57c('0x1')][_0xa57c('0x2c')](_0xd4c5d4,{'bodies':'','markSeen':!![]});_0x1d82d9['on'](_0xa57c('0x2d'),this[_0xa57c('0x2e')][_0xa57c('0xf')](this));_0x1d82d9['once'](_0xa57c('0x11'),this['handleFetchError'][_0xa57c('0xf')](this));_0x1d82d9[_0xa57c('0xd')](_0xa57c('0x10'),this['handleFetchEnd'][_0xa57c('0xf')](this));}catch(_0x4901a8){logger[_0xa57c('0x11')](_0x4901a8);}}else{this['imap'][_0xa57c('0x2f')](!![],this['handleCloseBox'][_0xa57c('0xf')](this));}}};EmailImap[_0xa57c('0x14')]['handleFetchMessage']=function(_0x3b8d17){_0x3b8d17['on']('body',this[_0xa57c('0x30')]['bind'](this));_0x3b8d17[_0xa57c('0xd')](_0xa57c('0x31'),this[_0xa57c('0x32')][_0xa57c('0xf')](this));_0x3b8d17[_0xa57c('0xd')](_0xa57c('0x10'),this['handleMessageEnd']['bind'](this));};EmailImap[_0xa57c('0x14')][_0xa57c('0x30')]=function(_0x2c70d6){simpleParser(_0x2c70d6,{'Iconv':Iconv},this['handleSimpleParser'][_0xa57c('0xf')](this));};EmailImap['prototype'][_0xa57c('0x32')]=function(){};EmailImap[_0xa57c('0x14')]['handleMessageEnd']=function(){};EmailImap['prototype']['handleSimpleParser']=function(_0x3be888,_0x5d410b){if(_0x3be888){logger[_0xa57c('0x11')](_0x3be888);}else{var _0x21e4df=this;utils[_0xa57c('0x33')](this[_0xa57c('0xb')],_0x5d410b,function(_0x5a444a){_0x21e4df[_0xa57c('0x26')](_0xa57c('0x8'),_0x5a444a);});}};EmailImap['prototype']['handleFetchEnd']=function(){this[_0xa57c('0x1')][_0xa57c('0x2f')](!![],this['handleCloseBox'][_0xa57c('0xf')](this));};EmailImap[_0xa57c('0x14')][_0xa57c('0x34')]=function(_0x2206a3){this[_0xa57c('0x12')](_0x2206a3);this[_0xa57c('0x1')]['closeBox'](!![],this[_0xa57c('0x35')]['bind'](this));};EmailImap['prototype']['handleEnd']=function(){this['emit']('end');};EmailImap[_0xa57c('0x14')][_0xa57c('0x12')]=function(_0x26d5e1,_0x4c8c65){logger['error']('handleError',this[_0xa57c('0xb')][_0xa57c('0x8')],JSON[_0xa57c('0x36')](_0x26d5e1));var _0x40715e='';if(_0x26d5e1){if(_0x26d5e1[_0xa57c('0x37')]){_0x40715e=_0x26d5e1[_0xa57c('0x37')];}else{for(var _0x48d2a7 in _0x26d5e1){if(_0x26d5e1[_0xa57c('0x38')](_0x48d2a7)){_0x40715e+=_[_0xa57c('0x39')](_0x48d2a7)+':\x20'+_0x26d5e1[_0x48d2a7]+'\x0a';}}}}if(_0x4c8c65){this[_0xa57c('0x1')][_0xa57c('0x10')]();}else{this[_0xa57c('0x26')](_0xa57c('0x11'),_0x40715e);this['emit'](_0xa57c('0x10'));}};module[_0xa57c('0x3a')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index eea6f5b..ab8d7b0 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 _0x3968=['nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile','toString','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3968,0xcf));var _0x8396=function(_0x4b2366,_0x341406){_0x4b2366=_0x4b2366-0x0;var _0x4c30dd=_0x3968[_0x4b2366];return _0x4c30dd;};'use strict';var nodemailer=require(_0x8396('0x0'));var inlineBase64=require(_0x8396('0x1'));function EmailSmtp(){}EmailSmtp[_0x8396('0x2')][_0x8396('0x3')]=function(_0x3659f1,_0x52ebba){return new Promise(function(_0x432349,_0x186fe0){var _0x331bdc=nodemailer[_0x8396('0x4')](_0x3659f1);_0x331bdc[_0x8396('0x5')](_0x8396('0x6'),inlineBase64());_0x331bdc['sendMail'](_0x52ebba,function(_0x2fb2f5,_0x1b0c2d){if(_0x2fb2f5){_0x186fe0(_0x2fb2f5[_0x8396('0x7')]());}else{_0x432349(_0x1b0c2d);}});});};EmailSmtp['prototype']['verify']=function(_0x4ba9b8){return new Promise(function(_0x46671f,_0x48f3e5){var _0xb0c6f2=nodemailer['createTransport'](_0x4ba9b8);_0xb0c6f2['verify'](function(_0x15cb49,_0xc241a8){if(_0x15cb49){_0x48f3e5(_0x15cb49['toString']());}else{if(_0xc241a8){_0x46671f(_0xc241a8);}else{_0x48f3e5('Not\x20verifired');}}});});};module[_0x8396('0x8')]=EmailSmtp; \ No newline at end of file +var _0x2489=['nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile','toString','verify','Not\x20verifired','exports'];(function(_0x40b6db,_0x2a1fbb){var _0x3eaa81=function(_0x203e91){while(--_0x203e91){_0x40b6db['push'](_0x40b6db['shift']());}};_0x3eaa81(++_0x2a1fbb);}(_0x2489,0x6e));var _0x9248=function(_0x32fabf,_0x1dd9f1){_0x32fabf=_0x32fabf-0x0;var _0x54df43=_0x2489[_0x32fabf];return _0x54df43;};'use strict';var nodemailer=require(_0x9248('0x0'));var inlineBase64=require(_0x9248('0x1'));function EmailSmtp(){}EmailSmtp[_0x9248('0x2')][_0x9248('0x3')]=function(_0xa8cf06,_0xebbf3b){return new Promise(function(_0x370f18,_0x5c5af6){var _0xe06c82=nodemailer[_0x9248('0x4')](_0xa8cf06);_0xe06c82[_0x9248('0x5')](_0x9248('0x6'),inlineBase64());_0xe06c82['sendMail'](_0xebbf3b,function(_0x3ecef7,_0x5af4a3){if(_0x3ecef7){_0x5c5af6(_0x3ecef7[_0x9248('0x7')]());}else{_0x370f18(_0x5af4a3);}});});};EmailSmtp['prototype']['verify']=function(_0x236f26){return new Promise(function(_0x4ca052,_0x2a014b){var _0x3784cd=nodemailer[_0x9248('0x4')](_0x236f26);_0x3784cd[_0x9248('0x8')](function(_0xc6ae2b,_0x3486fd){if(_0xc6ae2b){_0x2a014b(_0xc6ae2b[_0x9248('0x7')]());}else{if(_0x3486fd){_0x4ca052(_0x3486fd);}else{_0x2a014b(_0x9248('0x9'));}}});});};module[_0x9248('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 1be357d..5e2f849 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 _0x31ef=['%s-%s','now','root','server/files/attachments/','writeFileSync','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','parser','from','subject','date','format','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','messageId','parseBuffer','first','BodyHTML','Attachments','Title','Data','

Empty\x20message

','getHost','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','../../../config/environment','value','address','generate','head','name','substring','indexOf','length','slice','join','Anonymous','split','pop','anonymous','@xcally.com','html','test','replace','includes','attachments','forEach','push','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x2230d8[_0xf31e('0x10')](0x0,-0x1)[_0xf31e('0x11')]('\x20'):_0x8c444['name'];}return _0xf31e('0x12');}function getLastName(_0x8c351e){var _0x37c44a=_[_0xf31e('0xb')](_0x8c351e[_0xf31e('0x8')]);if(_0x37c44a&&_0x37c44a['name']){var _0x294ebe=_0x37c44a[_0xf31e('0xc')][_0xf31e('0x13')](/\s+/);return _0x294ebe[_0xf31e('0xf')]>0x1?_0x294ebe[_0xf31e('0x14')]():'';}return'';}function getMails(_0x5685e8,_0x51dbb3){var _0x4726c9='';for(var _0x12dc34=0x0;_0x12dc34<_0x51dbb3[_0xf31e('0x8')][_0xf31e('0xf')];_0x12dc34+=0x1){if(_0x51dbb3['value'][_0x12dc34][_0xf31e('0x9')]!==_0x5685e8){if(!_['isEmpty'](_0x4726c9)){_0x4726c9+=',';}_0x4726c9+=_0x51dbb3[_0xf31e('0x8')][_0x12dc34]['name']||_0x51dbb3[_0xf31e('0x8')][_0x12dc34]['address']||'';_0x4726c9+='\x20<';_0x4726c9+=_0x51dbb3[_0xf31e('0x8')][_0x12dc34][_0xf31e('0x9')]?_0x51dbb3[_0xf31e('0x8')][_0x12dc34][_0xf31e('0x9')]:_0xf31e('0x15')+random[_0xf31e('0xa')](0x6)+_0xf31e('0x16');_0x4726c9+='>';}}return _0x4726c9;}function parseEmail(_0x3625e5,_0x462bc5,_0x1f8929){if(_0x462bc5[_0xf31e('0x17')]){var _0x3de140=/)<[^<]*)*<\/script>/gi;while(_0x3de140[_0xf31e('0x18')](_0x462bc5['html'])){_0x462bc5[_0xf31e('0x17')]=_0x462bc5[_0xf31e('0x17')][_0xf31e('0x19')](_0x3de140,'');}if(_0x462bc5[_0xf31e('0x17')][_0xf31e('0x1a')]('{_0x474c1f[_0xf31e('0x1d')](_0x2792d9['filename']);});var _0x307c75=/]+>/g;var _0x1f4bf5=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x546d77=_0x462bc5[_0xf31e('0x17')]['replace'](_0x1f4bf5,_0xf31e('0x1e'));var _0x368e17=_0x546d77['replace'](_0x307c75,_0xf31e('0x1f'));for(let _0x18f242=0x0;_0x18f242<_0x474c1f['length'];_0x18f242++){var _0x4a2fd4=_0x368e17[_0xf31e('0x19')]('_IMG',_0xf31e('0x20')+_0x474c1f[_0x18f242]+_0xf31e('0x21'));_0x368e17=_0x4a2fd4;}_0x462bc5['html']=_0x368e17;}_0x1f8929[_0xf31e('0x22')]=_0x462bc5[_0xf31e('0x17')];}else{_0x1f8929[_0xf31e('0x22')]=_0x462bc5[_0xf31e('0x23')];}if(_0x1f8929['body']){_0x1f8929['body']=_0x1f8929[_0xf31e('0x22')]['replace'](/0x0){var _0x2c44b6=[_0xf31e('0x38'),_0xf31e('0x39'),_0xf31e('0x3a')];for(var _0x28c7c2=0x0;_0x28c7c2<_0x462bc5[_0xf31e('0x37')]['length'];_0x28c7c2++){var _0x166390=_['indexOf'](_0x2c44b6,_0x462bc5[_0xf31e('0x37')][_0x28c7c2][_0xf31e('0x3b')]);if(_0x166390>=0x0){_0x1f8929[_0xf31e('0x3c')]=!![];}}}return _0x1f8929;}exports[_0xf31e('0x3d')]=function(_0x308c5a,_0x29944e,_0x3c391d){var _0x28f53f={'from':getAddress(_0x29944e[_0xf31e('0x3e')]),'firstName':getFirstName(_0x29944e[_0xf31e('0x3e')]),'lastName':getLastName(_0x29944e['from']),'mapKey':'email','message':{'from':getMails(_0x308c5a['email'],_0x29944e['from']),'to':_0x308c5a[_0xf31e('0x28')],'cc':'','subject':_0x29944e[_0xf31e('0x3f')]||'','messageId':_0x29944e['messageId'],'inReplyTo':_0x29944e['inReplyTo'],'sentAt':moment(_0x29944e[_0xf31e('0x40')])[_0xf31e('0x41')](_0xf31e('0x42')),'attach':![],'attachments':[]}};if(!_0x29944e[_0xf31e('0x17')]&&!_0x29944e[_0xf31e('0x23')]){var _0x1f8012=_[_0xf31e('0x43')](_0x29944e['attachments'],{'contentType':_0xf31e('0x44')});if(_0x1f8012['length']){logger[_0xf31e('0x45')](util[_0xf31e('0x41')](_0xf31e('0x46'),_0x29944e[_0xf31e('0x47')]));tnef[_0xf31e('0x48')](_[_0xf31e('0x49')](_0x1f8012)[_0xf31e('0x35')],function(_0x46271e,_0x20514e){if(_0x20514e){_0x29944e[_0xf31e('0x17')]=_0x20514e[_0xf31e('0x4a')]||'

Empty\x20message

';if(_0x20514e[_0xf31e('0x4b')]){for(var _0x185bdb=0x0;_0x185bdb<_0x20514e[_0xf31e('0x4b')][_0xf31e('0xf')];_0x185bdb++){var _0xfebfda=_0x20514e[_0xf31e('0x4b')][_0x185bdb];_0x28f53f['message'][_0xf31e('0x1b')]['push']({'filename':_0xfebfda[_0xf31e('0x4c')],'content':Buffer['from'](_0xfebfda[_0xf31e('0x4d')])});}}}_0x3c391d(parseEmail(_0x308c5a,_0x29944e,_0x28f53f));});}else{_0x29944e[_0xf31e('0x17')]=_0xf31e('0x4e');_0x3c391d(parseEmail(_0x308c5a,_0x29944e,_0x28f53f));}}else{_0x3c391d(parseEmail(_0x308c5a,_0x29944e,_0x28f53f));}};exports[_0xf31e('0x4f')]=function(_0x4bc416){switch(_0x4bc416){case'gmail':return _0xf31e('0x50');case _0xf31e('0x51'):return _0xf31e('0x52');case _0xf31e('0x53'):return _0xf31e('0x54');case _0xf31e('0x55'):return _0xf31e('0x56');}return'127.0.0.1';};exports[_0xf31e('0x57')]=function(_0x447f63,_0x30963){var _0x1cb713=[_0xf31e('0x58')+(_0x30963||''),_0xf31e('0x59')+_0x447f63,'',''];return Buffer[_0xf31e('0x3e')](_0x1cb713[_0xf31e('0x11')](''),_0xf31e('0x5a'))['toString'](_0xf31e('0x5b'));}; \ No newline at end of file +var _0x8331=['forEach','filename','_SRC','_IMG','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','user=','utf-8','toString','base64','moment','randomstring','path','node-tnef','../../../config/logger','email','../../../config/environment','head','address','anonymous','generate','@xcally.com','value','name','substring','indexOf','split','slice','join','Anonymous','length','isEmpty','html','test','replace','includes','0x1?_0x10afc8[_0x1833('0x11')](0x0,-0x1)[_0x1833('0x12')]('\x20'):_0x5dd2ee[_0x1833('0xd')];}return _0x1833('0x13');}function getLastName(_0x2f0668){var _0x35e37e=_['head'](_0x2f0668['value']);if(_0x35e37e&&_0x35e37e[_0x1833('0xd')]){var _0x45f3d7=_0x35e37e[_0x1833('0xd')][_0x1833('0x10')](/\s+/);return _0x45f3d7[_0x1833('0x14')]>0x1?_0x45f3d7['pop']():'';}return'';}function getMails(_0x4bb31e,_0x5ec4d2){var _0x1a4bef='';for(var _0x297b76=0x0;_0x297b76<_0x5ec4d2[_0x1833('0xc')]['length'];_0x297b76+=0x1){if(_0x5ec4d2['value'][_0x297b76]['address']!==_0x4bb31e){if(!_[_0x1833('0x15')](_0x1a4bef)){_0x1a4bef+=',';}_0x1a4bef+=_0x5ec4d2[_0x1833('0xc')][_0x297b76][_0x1833('0xd')]||_0x5ec4d2[_0x1833('0xc')][_0x297b76]['address']||'';_0x1a4bef+='\x20<';_0x1a4bef+=_0x5ec4d2[_0x1833('0xc')][_0x297b76][_0x1833('0x8')]?_0x5ec4d2[_0x1833('0xc')][_0x297b76][_0x1833('0x8')]:_0x1833('0x9')+random['generate'](0x6)+_0x1833('0xb');_0x1a4bef+='>';}}return _0x1a4bef;}function parseEmail(_0x3524a7,_0x2de1ad,_0xc425dc){if(_0x2de1ad[_0x1833('0x16')]){var _0xfb138a=/)<[^<]*)*<\/script>/gi;while(_0xfb138a[_0x1833('0x17')](_0x2de1ad[_0x1833('0x16')])){_0x2de1ad[_0x1833('0x16')]=_0x2de1ad[_0x1833('0x16')][_0x1833('0x18')](_0xfb138a,'');}if(_0x2de1ad[_0x1833('0x16')][_0x1833('0x19')](_0x1833('0x1a'))){var _0x2435b7=[];_0x2de1ad[_0x1833('0x1b')][_0x1833('0x1c')](_0x4b28e0=>{_0x2435b7['push'](_0x4b28e0[_0x1833('0x1d')]);});var _0x68e4f8=/]+>/g;var _0x2da230=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x448c9c=_0x2de1ad[_0x1833('0x16')]['replace'](_0x2da230,_0x1833('0x1e'));var _0x4250a3=_0x448c9c[_0x1833('0x18')](_0x68e4f8,_0x1833('0x1f'));for(let _0x570dea=0x0;_0x570dea<_0x2435b7['length'];_0x570dea++){var _0x44e559=_0x4250a3[_0x1833('0x18')](_0x1833('0x1f'),'\x20[Attachment:\x20'+_0x2435b7[_0x570dea]+_0x1833('0x20'));_0x4250a3=_0x44e559;}_0x2de1ad['html']=_0x4250a3;}_0xc425dc[_0x1833('0x21')]=_0x2de1ad[_0x1833('0x16')];}else{_0xc425dc[_0x1833('0x21')]=_0x2de1ad[_0x1833('0x22')];}if(_0xc425dc['body']){_0xc425dc[_0x1833('0x21')]=_0xc425dc['body']['replace'](/0x0){var _0x4a7a55=[_0x1833('0x33'),_0x1833('0x34'),'Precedence:\x20auto_reply'];for(var _0x3e5222=0x0;_0x3e5222<_0x2de1ad[_0x1833('0x32')][_0x1833('0x14')];_0x3e5222++){var _0x581cde=_[_0x1833('0xf')](_0x4a7a55,_0x2de1ad['headerLines'][_0x3e5222][_0x1833('0x35')]);if(_0x581cde>=0x0){_0xc425dc[_0x1833('0x36')]=!![];}}}return _0xc425dc;}exports['parser']=function(_0x3b3268,_0x5dc525,_0x3267c5){var _0x1973d9={'from':getAddress(_0x5dc525['from']),'firstName':getFirstName(_0x5dc525['from']),'lastName':getLastName(_0x5dc525[_0x1833('0x37')]),'mapKey':'email','message':{'from':getMails(_0x3b3268[_0x1833('0x5')],_0x5dc525[_0x1833('0x37')]),'to':_0x3b3268[_0x1833('0x5')],'cc':'','subject':_0x5dc525[_0x1833('0x38')]||'','messageId':_0x5dc525[_0x1833('0x39')],'inReplyTo':_0x5dc525[_0x1833('0x3a')],'sentAt':moment(_0x5dc525[_0x1833('0x3b')])[_0x1833('0x2c')](_0x1833('0x3c')),'attach':![],'attachments':[]}};if(!_0x5dc525[_0x1833('0x16')]&&!_0x5dc525[_0x1833('0x22')]){var _0x93820e=_[_0x1833('0x3d')](_0x5dc525[_0x1833('0x1b')],{'contentType':'application/ms-tnef'});if(_0x93820e[_0x1833('0x14')]){logger['info'](util[_0x1833('0x2c')](_0x1833('0x3e'),_0x5dc525[_0x1833('0x39')]));tnef[_0x1833('0x3f')](_['first'](_0x93820e)['content'],function(_0xf20300,_0x2a8d22){if(_0x2a8d22){_0x5dc525[_0x1833('0x16')]=_0x2a8d22['BodyHTML']||_0x1833('0x40');if(_0x2a8d22[_0x1833('0x41')]){for(var _0x1b3858=0x0;_0x1b3858<_0x2a8d22['Attachments'][_0x1833('0x14')];_0x1b3858++){var _0x5972ee=_0x2a8d22[_0x1833('0x41')][_0x1b3858];_0x1973d9[_0x1833('0x24')]['attachments']['push']({'filename':_0x5972ee[_0x1833('0x42')],'content':Buffer[_0x1833('0x37')](_0x5972ee[_0x1833('0x43')])});}}}_0x3267c5(parseEmail(_0x3b3268,_0x5dc525,_0x1973d9));});}else{_0x5dc525[_0x1833('0x16')]=_0x1833('0x40');_0x3267c5(parseEmail(_0x3b3268,_0x5dc525,_0x1973d9));}}else{_0x3267c5(parseEmail(_0x3b3268,_0x5dc525,_0x1973d9));}};exports[_0x1833('0x44')]=function(_0x1087d5){switch(_0x1087d5){case _0x1833('0x45'):return _0x1833('0x46');case _0x1833('0x47'):return'imap.mail.yahoo.com';case _0x1833('0x48'):return _0x1833('0x49');case _0x1833('0x4a'):return _0x1833('0x4b');}return _0x1833('0x4c');};exports['generateXOAuth2Token']=function(_0x4d674c,_0x4d8576){var _0xd6b511=[_0x1833('0x4d')+(_0x4d8576||''),'auth=Bearer\x20'+_0x4d674c,'',''];return Buffer['from'](_0xd6b511['join'](''),_0x1833('0x4e'))[_0x1833('0x4f')](_0x1833('0x50'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index e02a4be..584f9c3 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 _0xcce5=['key','SERV','active','Imap','Smtp','exports','lodash','name','Service'];(function(_0x11ed18,_0x2ba407){var _0x4abdf2=function(_0x17f79e){while(--_0x17f79e){_0x11ed18['push'](_0x11ed18['shift']());}};_0x4abdf2(++_0x2ba407);}(_0xcce5,0x8d));var _0x5cce=function(_0x55490e,_0x957acd){_0x55490e=_0x55490e-0x0;var _0x1d99d2=_0xcce5[_0x55490e];return _0x1d99d2;};'use strict';var _=require(_0x5cce('0x0'));function MailAccount(_0x278545){this['id']=_0x278545['id']||0x0;this[_0x5cce('0x1')]=_0x278545['name']||_0x5cce('0x2');this[_0x5cce('0x3')]=_0x278545[_0x5cce('0x3')]||_0x5cce('0x4');this[_0x5cce('0x5')]=_0x278545[_0x5cce('0x5')]||![];this[_0x5cce('0x6')]=_0x278545[_0x5cce('0x6')]||[];this['Smtp']=_0x278545[_0x5cce('0x7')]||[];}module[_0x5cce('0x8')]=MailAccount; \ No newline at end of file +var _0x468b=['Imap','Smtp','exports','lodash','name','Service','key','SERV','active'];(function(_0x31ad09,_0xb281b9){var _0xc03314=function(_0x27e035){while(--_0x27e035){_0x31ad09['push'](_0x31ad09['shift']());}};_0xc03314(++_0xb281b9);}(_0x468b,0x1d7));var _0xb468=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x468b[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xb468('0x0'));function MailAccount(_0x3d5b6c){this['id']=_0x3d5b6c['id']||0x0;this['name']=_0x3d5b6c[_0xb468('0x1')]||_0xb468('0x2');this[_0xb468('0x3')]=_0x3d5b6c[_0xb468('0x3')]||_0xb468('0x4');this[_0xb468('0x5')]=_0x3d5b6c[_0xb468('0x5')]||![];this[_0xb468('0x6')]=_0x3d5b6c[_0xb468('0x6')]||[];this[_0xb468('0x7')]=_0x3d5b6c[_0xb468('0x7')]||[];}module[_0xb468('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 d757d6c..763d6bd 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 _0xd975=['mergeFromDatabase','hasOwnProperty','prototype','initMailAccounts','length','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts','mapKeys'];(function(_0x45b807,_0xd7efbf){var _0x20dabf=function(_0x251161){while(--_0x251161){_0x45b807['push'](_0x45b807['shift']());}};_0x20dabf(++_0xd7efbf);}(_0xd975,0x1ac));var _0x5d97=function(_0x14d3fd,_0x33142a){_0x14d3fd=_0x14d3fd-0x0;var _0x5f26cb=_0xd975[_0x14d3fd];return _0x5f26cb;};'use strict';var _=require(_0x5d97('0x0'));var MailAccount=require(_0x5d97('0x1'));var Realtime=function(){this[_0x5d97('0x2')]={};};function freeIsNotKey(_0x55f36a,_0x474f5e,_0x352a26){var _0x52baec=_[_0x5d97('0x3')](_0x55f36a,function(_0x51a7ba,_0x5bb54c){return _0x51a7ba[_0x352a26];});for(var _0x4c7330 in _0x474f5e){if(_0x474f5e['hasOwnProperty'](_0x4c7330)){if(!_0x52baec[_0x4c7330]){delete _0x474f5e[_0x4c7330];}}}}Realtime['prototype'][_0x5d97('0x4')]=function(_0x4abe1a,_0x17b53f){for(var _0x28abc8 in _0x17b53f){if(_0x4abe1a[_0x5d97('0x5')](_0x28abc8)){_0x4abe1a[_0x28abc8]=_0x17b53f[_0x28abc8];}}};Realtime[_0x5d97('0x6')][_0x5d97('0x7')]=function(){var _0x4a35bc=this;return function(_0x12331e){if(_0x12331e){freeIsNotKey(_0x12331e,_0x4a35bc[_0x5d97('0x2')],'id');for(var _0x41ecab=0x0,_0x27b531={},_0x4c296b={};_0x41ecab<_0x12331e[_0x5d97('0x8')];_0x41ecab+=0x1){_0x27b531=_0x12331e[_0x41ecab];if(_[_0x5d97('0x9')](_0x4a35bc['mailAccounts'][_0x27b531['id']])){_0x4a35bc['mailAccounts'][_0x27b531['id']]=new MailAccount(_0x27b531);}else{_[_0x5d97('0xa')](_0x4a35bc['mailAccounts'][_0x27b531['id']],_0x27b531);}}}return _0x4a35bc[_0x5d97('0x2')];};};module[_0x5d97('0xb')]=Realtime; \ No newline at end of file +var _0xd05d=['exports','lodash','../model/mailAccount','mapKeys','prototype','mergeFromDatabase','hasOwnProperty','initMailAccounts','mailAccounts','isUndefined','merge'];(function(_0x14ae7d,_0x3a2c94){var _0x5d7881=function(_0x559cc0){while(--_0x559cc0){_0x14ae7d['push'](_0x14ae7d['shift']());}};_0x5d7881(++_0x3a2c94);}(_0xd05d,0x1f0));var _0xdd05=function(_0x1bcdde,_0x382f2a){_0x1bcdde=_0x1bcdde-0x0;var _0x1fd012=_0xd05d[_0x1bcdde];return _0x1fd012;};'use strict';var _=require(_0xdd05('0x0'));var MailAccount=require(_0xdd05('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x413f01,_0x48f0e1,_0x9c69cf){var _0xbdd58c=_[_0xdd05('0x2')](_0x413f01,function(_0x14bc59,_0x98e773){return _0x14bc59[_0x9c69cf];});for(var _0x130d34 in _0x48f0e1){if(_0x48f0e1['hasOwnProperty'](_0x130d34)){if(!_0xbdd58c[_0x130d34]){delete _0x48f0e1[_0x130d34];}}}}Realtime[_0xdd05('0x3')][_0xdd05('0x4')]=function(_0x5e048c,_0x45421f){for(var _0xd0da80 in _0x45421f){if(_0x5e048c[_0xdd05('0x5')](_0xd0da80)){_0x5e048c[_0xd0da80]=_0x45421f[_0xd0da80];}}};Realtime[_0xdd05('0x3')][_0xdd05('0x6')]=function(){var _0x5f66d8=this;return function(_0x52fe41){if(_0x52fe41){freeIsNotKey(_0x52fe41,_0x5f66d8[_0xdd05('0x7')],'id');for(var _0x15ca09=0x0,_0x4bed1b={},_0x14707d={};_0x15ca09<_0x52fe41['length'];_0x15ca09+=0x1){_0x4bed1b=_0x52fe41[_0x15ca09];if(_[_0xdd05('0x8')](_0x5f66d8['mailAccounts'][_0x4bed1b['id']])){_0x5f66d8[_0xdd05('0x7')][_0x4bed1b['id']]=new MailAccount(_0x4bed1b);}else{_[_0xdd05('0x9')](_0x5f66d8[_0xdd05('0x7')][_0x4bed1b['id']],_0x4bed1b);}}}return _0x5f66d8[_0xdd05('0x7')];};};module[_0xdd05('0xa')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index f5fbf6b..b74f437 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 _0xc177=['email','active','key','TemplateId','MailServerIn','Imap','type','data5','CloudProvider','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','service'];(function(_0x4472b0,_0x527530){var _0x41c268=function(_0x4b089b){while(--_0x4b089b){_0x4472b0['push'](_0x4472b0['shift']());}};_0x41c268(++_0x527530);}(_0xc177,0x1b2));var _0x7c17=function(_0x566d12,_0xe2d82a){_0x566d12=_0x566d12-0x0;var _0x42d0cd=_0xc177[_0x566d12];return _0x42d0cd;};'use strict';var client=require(_0x7c17('0x0'));exports[_0x7c17('0x1')]=function(){return function(){return client[_0x7c17('0x2')](_0x7c17('0x3'),{'options':{'attributes':['id',_0x7c17('0x4'),'provider',_0x7c17('0x5'),_0x7c17('0x6'),_0x7c17('0x7'),_0x7c17('0x8'),'ListId',_0x7c17('0x9')],'raw':![],'include':[{'model':_0x7c17('0xa'),'as':_0x7c17('0xb'),'include':[{'model':'CloudProvider','attributes':['id',_0x7c17('0x4'),_0x7c17('0x5'),_0x7c17('0xc'),_0x7c17('0xd')],'as':_0x7c17('0xe')}]},{'model':_0x7c17('0xf'),'as':_0x7c17('0x10'),'include':[{'model':_0x7c17('0xe'),'attributes':['id',_0x7c17('0x4'),_0x7c17('0x5'),'type','data5'],'as':'CloudProvider'}]}]},'log':_0x7c17('0x11')});};};exports[_0x7c17('0x12')]=function(_0x40cc08,_0x57a04c){return client[_0x7c17('0x2')](_0x7c17('0x13'),{'account':{'id':_0x40cc08},'body':_0x57a04c,'log':_0x7c17('0x13')});}; \ No newline at end of file +var _0xa897=['type','data5','MailServerOut','notify','NotifyMailAccount','../client','Request','GetMailAccount','name','service','active','ListId','MailServerIn','Imap','CloudProvider'];(function(_0x475798,_0x32579f){var _0x574379=function(_0x568d3e){while(--_0x568d3e){_0x475798['push'](_0x475798['shift']());}};_0x574379(++_0x32579f);}(_0xa897,0x17c));var _0x7a89=function(_0x3b3cff,_0x3cd3cf){_0x3b3cff=_0x3b3cff-0x0;var _0x18b376=_0xa897[_0x3b3cff];return _0x18b376;};'use strict';var client=require(_0x7a89('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x7a89('0x1')](_0x7a89('0x2'),{'options':{'attributes':['id',_0x7a89('0x3'),'provider',_0x7a89('0x4'),'email',_0x7a89('0x5'),'key',_0x7a89('0x6'),'TemplateId'],'raw':![],'include':[{'model':_0x7a89('0x7'),'as':_0x7a89('0x8'),'include':[{'model':_0x7a89('0x9'),'attributes':['id',_0x7a89('0x3'),_0x7a89('0x4'),_0x7a89('0xa'),_0x7a89('0xb')],'as':_0x7a89('0x9')}]},{'model':_0x7a89('0xc'),'as':'Smtp','include':[{'model':_0x7a89('0x9'),'attributes':['id',_0x7a89('0x3'),_0x7a89('0x4'),_0x7a89('0xa'),_0x7a89('0xb')],'as':_0x7a89('0x9')}]}]},'log':'getMailAccount'});};};exports[_0x7a89('0xd')]=function(_0x2d4240,_0x460cd8){return client[_0x7a89('0x1')](_0x7a89('0xe'),{'account':{'id':_0x2d4240},'body':_0x460cd8,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 83c1e4a..c9ecb7d 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 _0x462c=['getSettings','Request','ShowSetting','GetSettings','../client'];(function(_0x26d727,_0x2ce4e0){var _0x2d446c=function(_0x4081bf){while(--_0x4081bf){_0x26d727['push'](_0x26d727['shift']());}};_0x2d446c(++_0x2ce4e0);}(_0x462c,0x1cb));var _0xc462=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x462c[_0x502c7d];return _0x30b7ed;};'use strict';var client=require(_0xc462('0x0'));exports[_0xc462('0x1')]=function(){return client[_0xc462('0x2')](_0xc462('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0xc462('0x4')});}; \ No newline at end of file +var _0x7cb9=['getSettings','Request','ShowSetting','loginMailFrequency'];(function(_0x5d0fc5,_0x255981){var _0x4ccbae=function(_0x1fcb91){while(--_0x1fcb91){_0x5d0fc5['push'](_0x5d0fc5['shift']());}};_0x4ccbae(++_0x255981);}(_0x7cb9,0x64));var _0x97cb=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7cb9[_0xa464c9];return _0x3d73c4;};'use strict';var client=require('../client');exports[_0x97cb('0x0')]=function(){return client[_0x97cb('0x1')](_0x97cb('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x97cb('0x3')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 1ec8764..7ef144d 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(_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 jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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 235cdc8..e32b4f0 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 _0xf470=['createServer','port','websocket','polling','redis','defaults','localhost','default','../../config/socketio','../../config/express','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','sticky-session','ioredis','../../config/environment'];(function(_0x10578a,_0xa29c8b){var _0x199ed0=function(_0x10fbd5){while(--_0x10fbd5){_0x10578a['push'](_0x10578a['shift']());}};_0x199ed0(++_0xa29c8b);}(_0xf470,0x81));var _0x0f47=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0xf470[_0x166742];return _0xb7814a;};'use strict';var _=require(_0x0f47('0x0'));var http=require('http');var express=require('express');var sticky=require(_0x0f47('0x1'));var Redis=require(_0x0f47('0x2'));var config=require(_0x0f47('0x3'));var app=express();var server=http[_0x0f47('0x4')](app);server['timeout']=0xdbba0;if(sticky['listen'](server,config[_0x0f47('0x5')])){var socketio=require('socket.io')(server,{'transports':[_0x0f47('0x6'),_0x0f47('0x7')]});config[_0x0f47('0x8')]=_[_0x0f47('0x9')](config[_0x0f47('0x8')],{'host':_0x0f47('0xa'),'port':0x18eb});socketio['adapter'](require('socket.io-redis')({'pubClient':new Redis(config[_0x0f47('0x8')]),'subClient':new Redis(config[_0x0f47('0x8')])}));require('../../config/triggers')[_0x0f47('0xb')]();require(_0x0f47('0xc'))['default'](socketio);require(_0x0f47('0xd'))[_0x0f47('0xb')](app);require('../../routes')[_0x0f47('0xb')](app);}else{server[_0x0f47('0xe')](_0x0f47('0xf'),function(){console[_0x0f47('0x10')](_0x0f47('0x11'),config['port']);});}exports=module[_0x0f47('0x12')]=app; \ No newline at end of file +var _0xdeda=['sticky-session','ioredis','../../config/environment','createServer','timeout','socket.io','websocket','polling','redis','localhost','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http'];(function(_0x18ae56,_0x4fa3b0){var _0x25e241=function(_0x52275e){while(--_0x52275e){_0x18ae56['push'](_0x18ae56['shift']());}};_0x25e241(++_0x4fa3b0);}(_0xdeda,0x148));var _0xaded=function(_0x272ec2,_0x1a2735){_0x272ec2=_0x272ec2-0x0;var _0x2af5eb=_0xdeda[_0x272ec2];return _0x2af5eb;};'use strict';var _=require(_0xaded('0x0'));var http=require(_0xaded('0x1'));var express=require('express');var sticky=require(_0xaded('0x2'));var Redis=require(_0xaded('0x3'));var config=require(_0xaded('0x4'));var app=express();var server=http[_0xaded('0x5')](app);server[_0xaded('0x6')]=0xdbba0;if(sticky['listen'](server,config['port'])){var socketio=require(_0xaded('0x7'))(server,{'transports':[_0xaded('0x8'),_0xaded('0x9')]});config[_0xaded('0xa')]=_['defaults'](config[_0xaded('0xa')],{'host':_0xaded('0xb'),'port':0x18eb});socketio['adapter'](require(_0xaded('0xc'))({'pubClient':new Redis(config[_0xaded('0xa')]),'subClient':new Redis(config[_0xaded('0xa')])}));require(_0xaded('0xd'))[_0xaded('0xe')]();require(_0xaded('0xf'))[_0xaded('0xe')](socketio);require(_0xaded('0x10'))[_0xaded('0xe')](app);require(_0xaded('0x11'))[_0xaded('0xe')](app);}else{server[_0xaded('0x12')]('listening',function(){console[_0xaded('0x13')](_0xaded('0x14'),config['port']);});}exports=module[_0xaded('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 49ab8ed..2e75d15 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 _0x1c76=['message','catch','error','exports','bluebird','routing','client','Request','request','then','debug','rpc'];(function(_0x15ceb7,_0x961934){var _0x1d9eaa=function(_0x532231){while(--_0x532231){_0x15ceb7['push'](_0x15ceb7['shift']());}};_0x1d9eaa(++_0x961934);}(_0x1c76,0x148));var _0x61c7=function(_0x7f66a8,_0x116768){_0x7f66a8=_0x7f66a8-0x0;var _0x1f5fe7=_0x1c76[_0x7f66a8];return _0x1f5fe7;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x61c7('0x0'));var logger=require('../../config/logger')(_0x61c7('0x1'));var client=jayson[_0x61c7('0x2')]['http']({'port':0x2329});client[_0x61c7('0x3')]=function(_0x1ca8bd,_0x24943e){return new BPromise(function(_0x32d3c5,_0x1254ff){return client[_0x61c7('0x4')](_0x1ca8bd,_0x24943e)[_0x61c7('0x5')](function(_0x50c4b3){logger[_0x61c7('0x6')](_0x61c7('0x7'),'routing',_0x1ca8bd,_0x24943e,_0x50c4b3);if(_0x50c4b3['error']){logger['error'](_0x61c7('0x7'),_0x61c7('0x1'),_0x1ca8bd,_0x50c4b3['error'][_0x61c7('0x8')],_0x24943e);return _0x1254ff(_0x50c4b3['error'][_0x61c7('0x8')]);}else{return _0x32d3c5(_0x50c4b3['result']);}})[_0x61c7('0x9')](function(_0x44f4df){logger[_0x61c7('0xa')](_0x61c7('0x7'),_0x61c7('0x1'),_0x1ca8bd,_0x44f4df,_0x24943e);return _0x1254ff(_0x44f4df);});});};module[_0x61c7('0xb')]=client; \ No newline at end of file +var _0x3f00=['request','then','rpc','routing','error','message','result','catch','exports','jayson/promise','bluebird','http','Request'];(function(_0x5c90fa,_0x262823){var _0x3a3aad=function(_0x2c195d){while(--_0x2c195d){_0x5c90fa['push'](_0x5c90fa['shift']());}};_0x3a3aad(++_0x262823);}(_0x3f00,0x100));var _0x03f0=function(_0x2acbcb,_0x17fb89){_0x2acbcb=_0x2acbcb-0x0;var _0x7eeabf=_0x3f00[_0x2acbcb];return _0x7eeabf;};'use strict';var jayson=require(_0x03f0('0x0'));var BPromise=require(_0x03f0('0x1'));var logger=require('../../config/logger')('routing');var client=jayson['client'][_0x03f0('0x2')]({'port':0x2329});client[_0x03f0('0x3')]=function(_0x2a7413,_0x1bcba0){return new BPromise(function(_0x2e4563,_0x103254){return client[_0x03f0('0x4')](_0x2a7413,_0x1bcba0)[_0x03f0('0x5')](function(_0x34e737){logger['debug'](_0x03f0('0x6'),_0x03f0('0x7'),_0x2a7413,_0x1bcba0,_0x34e737);if(_0x34e737[_0x03f0('0x8')]){logger[_0x03f0('0x8')](_0x03f0('0x6'),_0x03f0('0x7'),_0x2a7413,_0x34e737[_0x03f0('0x8')][_0x03f0('0x9')],_0x1bcba0);return _0x103254(_0x34e737[_0x03f0('0x8')]['message']);}else{return _0x2e4563(_0x34e737[_0x03f0('0xa')]);}})[_0x03f0('0xb')](function(_0x450607){logger[_0x03f0('0x8')]('rpc','routing',_0x2a7413,_0x450607,_0x1bcba0);return _0x103254(_0x450607);});});};module[_0x03f0('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 75a5a5f..3b8d5e1 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 _0x973c=['then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve'];(function(_0x113a52,_0x2b94c5){var _0x4cb9b9=function(_0x414f8c){while(--_0x414f8c){_0x113a52['push'](_0x113a52['shift']());}};_0x4cb9b9(++_0x2b94c5);}(_0x973c,0xc6));var _0xc973=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x973c[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xc973('0x0'));var server=require(_0xc973('0x1'));var Realtime=require(_0xc973('0x2'));var user=require(_0xc973('0x3'));var interval=require(_0xc973('0x4'));var openchannelQueue=require(_0xc973('0x5'));var chatQueue=require(_0xc973('0x6'));var smsQueue=require(_0xc973('0x7'));var mailQueue=require(_0xc973('0x8'));var faxQueue=require(_0xc973('0x9'));var whatsappQueue=require(_0xc973('0xa'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xc973('0xb')]()[_0xc973('0xc')](user['getAgents']())[_0xc973('0xc')](realtime[_0xc973('0xd')]())[_0xc973('0xc')](interval[_0xc973('0xe')]())['then'](realtime[_0xc973('0xf')]())['then'](openchannelQueue[_0xc973('0x10')]())[_0xc973('0xc')](realtime[_0xc973('0x11')]())[_0xc973('0xc')](chatQueue['getChatQueues']())[_0xc973('0xc')](realtime[_0xc973('0x12')]())[_0xc973('0xc')](smsQueue[_0xc973('0x13')]())[_0xc973('0xc')](realtime[_0xc973('0x14')]())['then'](mailQueue[_0xc973('0x15')]())[_0xc973('0xc')](realtime[_0xc973('0x16')]())[_0xc973('0xc')](faxQueue[_0xc973('0x17')]())[_0xc973('0xc')](realtime[_0xc973('0x18')]())['then'](whatsappQueue[_0xc973('0x19')]())[_0xc973('0xc')](realtime[_0xc973('0x1a')]())[_0xc973('0xc')](function(){return realtime;});}function main(){return server[_0xc973('0x1b')](realtime)[_0xc973('0xc')](function(_0x309b57){return initRealtime();})[_0xc973('0xc')](function(_0x429f7a){return setInterval(initRealtime,0x1388);})[_0xc973('0x1c')](function(_0x2dd6d3){console[_0xc973('0x1d')](_0x2dd6d3);});}main(); \ No newline at end of file +var _0x49b0=['resolve','then','getAgents','initAgents','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','initMailQueues','getFaxQueues','initFaxQueues','initWhatsappQueues','catch','log','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue'];(function(_0x471f7c,_0x59016f){var _0xb1336c=function(_0x4e39bb){while(--_0x4e39bb){_0x471f7c['push'](_0x471f7c['shift']());}};_0xb1336c(++_0x59016f);}(_0x49b0,0x1f1));var _0x049b=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x49b0[_0x4565bf];return _0x5610ba;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require(_0x049b('0x0'));var user=require(_0x049b('0x1'));var interval=require(_0x049b('0x2'));var openchannelQueue=require(_0x049b('0x3'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x049b('0x4'));var mailQueue=require(_0x049b('0x5'));var faxQueue=require(_0x049b('0x6'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x049b('0x7')]()[_0x049b('0x8')](user[_0x049b('0x9')]())[_0x049b('0x8')](realtime[_0x049b('0xa')]())['then'](interval['getIntervals']())[_0x049b('0x8')](realtime[_0x049b('0xb')]())['then'](openchannelQueue[_0x049b('0xc')]())['then'](realtime[_0x049b('0xd')]())[_0x049b('0x8')](chatQueue[_0x049b('0xe')]())[_0x049b('0x8')](realtime[_0x049b('0xf')]())[_0x049b('0x8')](smsQueue[_0x049b('0x10')]())['then'](realtime[_0x049b('0x11')]())[_0x049b('0x8')](mailQueue['getMailQueues']())['then'](realtime[_0x049b('0x12')]())[_0x049b('0x8')](faxQueue[_0x049b('0x13')]())[_0x049b('0x8')](realtime[_0x049b('0x14')]())[_0x049b('0x8')](whatsappQueue['getWhatsappQueues']())[_0x049b('0x8')](realtime[_0x049b('0x15')]())[_0x049b('0x8')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x049b('0x8')](function(_0x1c57bf){return initRealtime();})[_0x049b('0x8')](function(_0x20e21f){return setInterval(initRealtime,0x1388);})[_0x049b('0x16')](function(_0x2afb6c){console[_0x049b('0x17')](_0x2afb6c);});}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 1e95857..bc81fd7 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 _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x53c6e4,_0x2ef80b){var _0x3db71a=function(_0xf78f83){while(--_0xf78f83){_0x53c6e4['push'](_0x53c6e4['shift']());}};_0x3db71a(++_0x2ef80b);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xc4aa[_0x565ed7];return _0x183ad7;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file +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(_0x3b3947,_0x1c5e57){var _0x4113d7=function(_0x59c48c){while(--_0x59c48c){_0x3b3947['push'](_0x3b3947['shift']());}};_0x4113d7(++_0x1c5e57);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5ce3c8,_0x2503bd){_0x5ce3c8=_0x5ce3c8-0x0;var _0xa76867=_0x5fc3[_0x5ce3c8];return _0xa76867;};'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 3a0ea73..a4bbfc8 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 _0x0343=['result','catch','SendMail','bluebird','jayson/promise','http','request','then','error'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x0343,0x12c));var _0x3034=function(_0x242a98,_0x13988e){_0x242a98=_0x242a98-0x0;var _0x580999=_0x0343[_0x242a98];return _0x580999;};'use strict';var BPromise=require(_0x3034('0x0'));var jayson=require(_0x3034('0x1'));var client=jayson['client'][_0x3034('0x2')]({'port':0x232b});function request(_0x21c17e,_0x4dbe36){return new BPromise(function(_0x49e666,_0x524391){return client[_0x3034('0x3')](_0x21c17e,_0x4dbe36)[_0x3034('0x4')](function(_0x256297){if(_0x256297[_0x3034('0x5')]){return _0x524391(_0x256297[_0x3034('0x5')]['message']);}else{return _0x49e666(_0x256297[_0x3034('0x6')]);}})[_0x3034('0x7')](function(_0x52df83){return _0x524391(_0x52df83);});});}exports['sendMailMessage']=function(_0x4ec43d,_0x15a484){return request(_0x3034('0x8'),{'account':_0x4ec43d,'message':_0x15a484});}; \ No newline at end of file +var _0xd4ad=['result','catch','sendMailMessage','SendMail','client','http','request','then','error','message'];(function(_0x572f11,_0x4be9fa){var _0x331583=function(_0x18d77b){while(--_0x18d77b){_0x572f11['push'](_0x572f11['shift']());}};_0x331583(++_0x4be9fa);}(_0xd4ad,0xb8));var _0xdd4a=function(_0x1c1796,_0x1461ce){_0x1c1796=_0x1c1796-0x0;var _0x1f3b14=_0xd4ad[_0x1c1796];return _0x1f3b14;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0xdd4a('0x0')][_0xdd4a('0x1')]({'port':0x232b});function request(_0x3555bc,_0xb57360){return new BPromise(function(_0x5ab647,_0x1c801a){return client[_0xdd4a('0x2')](_0x3555bc,_0xb57360)[_0xdd4a('0x3')](function(_0x1f0ec5){if(_0x1f0ec5['error']){return _0x1c801a(_0x1f0ec5[_0xdd4a('0x4')][_0xdd4a('0x5')]);}else{return _0x5ab647(_0x1f0ec5[_0xdd4a('0x6')]);}})[_0xdd4a('0x7')](function(_0x58316e){return _0x1c801a(_0x58316e);});});}exports[_0xdd4a('0x8')]=function(_0x1bd037,_0x389e5b){return request(_0xdd4a('0x9'),{'account':_0x1bd037,'message':_0x389e5b});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index f7c385b..17d6bd7 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 _0x3b43=['updateRealtime','CurrentCapacity','Capacity','maxcapacity','working','idle','prototype','chat','openchannel','fax','sms','whatsapp','length','getChannelStatus','Status','toNumber','format','faxCurrentCapacity','whatsappStatusTime','whatsappCurrentCapacity','openchannelStatusTime','stringify','emit','user:save','exports','lodash','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','md5'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3b43,0x115));var _0x33b4=function(_0x53a1d9,_0x4c26b0){_0x53a1d9=_0x53a1d9-0x0;var _0x531854=_0x3b43[_0x53a1d9];return _0x531854;};'use strict';var _=require(_0x33b4('0x0'));var moment=require('moment');var md5=require('md5');var Redis=require(_0x33b4('0x1'));var config=require(_0x33b4('0x2'));config['redis']=_[_0x33b4('0x3')](config['redis'],{'host':_0x33b4('0x4'),'port':0x18eb});var io=require(_0x33b4('0x5'))(new Redis(config[_0x33b4('0x6')]));function Agent(_0x507ff6){this['id']=_0x507ff6['id']||0x0;this[_0x33b4('0x7')]=_0x507ff6[_0x33b4('0x7')]||'';this[_0x33b4('0x8')]=_0x507ff6[_0x33b4('0x8')]||!![];this[_0x33b4('0x9')]=_0x507ff6[_0x33b4('0x9')]||![];this[_0x33b4('0xa')]=_0x507ff6['chatPause']||![];this[_0x33b4('0xb')]=_0x507ff6[_0x33b4('0xb')]||![];this[_0x33b4('0xc')]=_0x507ff6[_0x33b4('0xc')]||![];this['smsPause']=_0x507ff6[_0x33b4('0xd')]||![];this[_0x33b4('0xe')]=_0x507ff6[_0x33b4('0xe')]||![];this[_0x33b4('0xf')]=_0x33b4('0x10');this[_0x33b4('0x11')]=0x0;this[_0x33b4('0x12')]=_0x507ff6[_0x33b4('0x12')]||0x0;this[_0x33b4('0x13')]=0x0;this['mailStatus']=_0x33b4('0x10');this[_0x33b4('0x14')]=0x0;this[_0x33b4('0x15')]=_0x507ff6['mailCapacity']||0x0;this[_0x33b4('0x16')]=0x0;this[_0x33b4('0x17')]='unknown';this[_0x33b4('0x18')]=0x0;this[_0x33b4('0x19')]=_0x507ff6[_0x33b4('0x19')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x33b4('0x1a')]='unknown';this[_0x33b4('0x1b')]=0x0;this[_0x33b4('0x1c')]=_0x507ff6[_0x33b4('0x1c')]||0x0;this[_0x33b4('0x1d')]=0x0;this[_0x33b4('0x1e')]=_0x33b4('0x10');this['whatsappStatusTime']=0x0;this[_0x33b4('0x1f')]=_0x507ff6[_0x33b4('0x1f')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x33b4('0x20')]=_0x33b4('0x10');this['openchannelStatusTime']=0x0;this[_0x33b4('0x21')]=_0x507ff6[_0x33b4('0x21')]||0x0;this[_0x33b4('0x22')]=0x0;this[_0x33b4('0x23')]=![];this[_0x33b4('0x24')]=undefined;this[_0x33b4('0x25')]='';this[_0x33b4('0x26')]();}Agent['prototype']['getChannelStatus']=function(_0x29e0f0){if(this[_0x29e0f0+_0x33b4('0x27')]>0x0){if(this[_0x29e0f0+_0x33b4('0x28')]>0x0&&this[_0x29e0f0+'CurrentCapacity']>=this[_0x29e0f0+_0x33b4('0x28')]){return _0x33b4('0x29');}else{return _0x33b4('0x2a');}}else{return _0x33b4('0x2b');}};Agent[_0x33b4('0x2c')][_0x33b4('0x26')]=function(){var _0x5e417f=['mail',_0x33b4('0x2d'),_0x33b4('0x2e'),_0x33b4('0x2f'),_0x33b4('0x30'),_0x33b4('0x31')];for(var _0x5a5d8b=0x0;_0x5a5d8b<_0x5e417f[_0x33b4('0x32')];_0x5a5d8b+=0x1){var _0x2a73e8=this[_0x33b4('0x33')](_0x5e417f[_0x5a5d8b]);if(this[_0x5e417f[_0x5a5d8b]+_0x33b4('0x34')]!==_0x2a73e8){this[_0x5e417f[_0x5a5d8b]+'StatusTime']=_[_0x33b4('0x35')](moment()[_0x33b4('0x36')]('x'));}this[_0x5e417f[_0x5a5d8b]+_0x33b4('0x34')]=_0x2a73e8;}var _0x547481={'id':this['id'],'name':this[_0x33b4('0x7')],'online':this[_0x33b4('0x8')],'voicePause':this['voicePause'],'chatPause':this[_0x33b4('0xa')],'mailPause':this['mailPause'],'smsPause':this['smsPause'],'faxPause':this[_0x33b4('0xc')],'openchannelPause':this[_0x33b4('0xe')],'chatStatus':this[_0x33b4('0xf')],'chatStatusTime':this[_0x33b4('0x11')],'chatCapacity':this[_0x33b4('0x12')],'chatCurrentCapacity':this[_0x33b4('0x13')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x33b4('0x14')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x33b4('0x16')],'faxStatus':this[_0x33b4('0x17')],'faxStatusTime':this[_0x33b4('0x18')],'faxCapacity':this[_0x33b4('0x19')],'faxCurrentCapacity':this[_0x33b4('0x37')],'smsStatus':this[_0x33b4('0x1a')],'smsStatusTime':this[_0x33b4('0x1b')],'smsCapacity':this[_0x33b4('0x1c')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x33b4('0x1e')],'whatsappStatusTime':this[_0x33b4('0x38')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x33b4('0x39')],'openchannelStatus':this[_0x33b4('0x20')],'openchannelStatusTime':this[_0x33b4('0x3a')],'openchannelCapacity':this[_0x33b4('0x21')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x33b4('0x23')],'busyQueue':this[_0x33b4('0x24')]};var _0x4a8573=md5(JSON[_0x33b4('0x3b')](_0x547481));if(this['md5']!==_0x4a8573){this[_0x33b4('0x25')]=_0x4a8573;io[_0x33b4('0x3c')](_0x33b4('0x3d'),_0x547481);}};module[_0x33b4('0x3e')]=Agent; \ No newline at end of file +var _0xf725=['faxStatus','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelCapacity','busy','busyQueue','prototype','CurrentCapacity','Capacity','maxcapacity','working','idle','updateRealtime','openchannel','fax','whatsapp','length','getChannelStatus','Status','StatusTime','toNumber','format','openchannelStatus','openchannelCurrentCapacity','stringify','emit','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity'];(function(_0x151132,_0x32026a){var _0x13c2ad=function(_0x4dcd81){while(--_0x4dcd81){_0x151132['push'](_0x151132['shift']());}};_0x13c2ad(++_0x32026a);}(_0xf725,0x14f));var _0x5f72=function(_0x176df8,_0x2a2511){_0x176df8=_0x176df8-0x0;var _0x5496b8=_0xf725[_0x176df8];return _0x5496b8;};'use strict';var _=require(_0x5f72('0x0'));var moment=require(_0x5f72('0x1'));var md5=require(_0x5f72('0x2'));var Redis=require(_0x5f72('0x3'));var config=require(_0x5f72('0x4'));config[_0x5f72('0x5')]=_[_0x5f72('0x6')](config['redis'],{'host':_0x5f72('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5f72('0x5')]));function Agent(_0x3b09f7){this['id']=_0x3b09f7['id']||0x0;this[_0x5f72('0x8')]=_0x3b09f7[_0x5f72('0x8')]||'';this['online']=_0x3b09f7[_0x5f72('0x9')]||!![];this['voicePause']=_0x3b09f7[_0x5f72('0xa')]||![];this[_0x5f72('0xb')]=_0x3b09f7[_0x5f72('0xb')]||![];this[_0x5f72('0xc')]=_0x3b09f7[_0x5f72('0xc')]||![];this[_0x5f72('0xd')]=_0x3b09f7[_0x5f72('0xd')]||![];this['smsPause']=_0x3b09f7[_0x5f72('0xe')]||![];this[_0x5f72('0xf')]=_0x3b09f7['openchannelPause']||![];this[_0x5f72('0x10')]=_0x5f72('0x11');this[_0x5f72('0x12')]=0x0;this[_0x5f72('0x13')]=_0x3b09f7[_0x5f72('0x13')]||0x0;this[_0x5f72('0x14')]=0x0;this[_0x5f72('0x15')]='unknown';this[_0x5f72('0x16')]=0x0;this[_0x5f72('0x17')]=_0x3b09f7[_0x5f72('0x17')]||0x0;this[_0x5f72('0x18')]=0x0;this[_0x5f72('0x19')]='unknown';this[_0x5f72('0x1a')]=0x0;this[_0x5f72('0x1b')]=_0x3b09f7[_0x5f72('0x1b')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x5f72('0x1c')]=_0x5f72('0x11');this[_0x5f72('0x1d')]=0x0;this[_0x5f72('0x1e')]=_0x3b09f7['smsCapacity']||0x0;this[_0x5f72('0x1f')]=0x0;this['whatsappStatus']=_0x5f72('0x11');this[_0x5f72('0x20')]=0x0;this[_0x5f72('0x21')]=_0x3b09f7[_0x5f72('0x21')]||0x0;this[_0x5f72('0x22')]=0x0;this['openchannelStatus']='unknown';this['openchannelStatusTime']=0x0;this[_0x5f72('0x23')]=_0x3b09f7['openchannelCapacity']||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x5f72('0x24')]=![];this[_0x5f72('0x25')]=undefined;this[_0x5f72('0x2')]='';this['updateRealtime']();}Agent[_0x5f72('0x26')]['getChannelStatus']=function(_0x59f8c4){if(this[_0x59f8c4+_0x5f72('0x27')]>0x0){if(this[_0x59f8c4+_0x5f72('0x28')]>0x0&&this[_0x59f8c4+'CurrentCapacity']>=this[_0x59f8c4+'Capacity']){return _0x5f72('0x29');}else{return _0x5f72('0x2a');}}else{return _0x5f72('0x2b');}};Agent[_0x5f72('0x26')][_0x5f72('0x2c')]=function(){var _0x3e2ef8=['mail','chat',_0x5f72('0x2d'),_0x5f72('0x2e'),'sms',_0x5f72('0x2f')];for(var _0x5c5f53=0x0;_0x5c5f53<_0x3e2ef8[_0x5f72('0x30')];_0x5c5f53+=0x1){var _0x570557=this[_0x5f72('0x31')](_0x3e2ef8[_0x5c5f53]);if(this[_0x3e2ef8[_0x5c5f53]+_0x5f72('0x32')]!==_0x570557){this[_0x3e2ef8[_0x5c5f53]+_0x5f72('0x33')]=_[_0x5f72('0x34')](moment()[_0x5f72('0x35')]('x'));}this[_0x3e2ef8[_0x5c5f53]+_0x5f72('0x32')]=_0x570557;}var _0x19753e={'id':this['id'],'name':this[_0x5f72('0x8')],'online':this[_0x5f72('0x9')],'voicePause':this[_0x5f72('0xa')],'chatPause':this[_0x5f72('0xb')],'mailPause':this['mailPause'],'smsPause':this['smsPause'],'faxPause':this[_0x5f72('0xd')],'openchannelPause':this[_0x5f72('0xf')],'chatStatus':this[_0x5f72('0x10')],'chatStatusTime':this[_0x5f72('0x12')],'chatCapacity':this[_0x5f72('0x13')],'chatCurrentCapacity':this[_0x5f72('0x14')],'mailStatus':this[_0x5f72('0x15')],'mailStatusTime':this[_0x5f72('0x16')],'mailCapacity':this[_0x5f72('0x17')],'mailCurrentCapacity':this[_0x5f72('0x18')],'faxStatus':this[_0x5f72('0x19')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x5f72('0x1b')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x5f72('0x1c')],'smsStatusTime':this[_0x5f72('0x1d')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x5f72('0x1f')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x5f72('0x20')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x5f72('0x22')],'openchannelStatus':this[_0x5f72('0x36')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x5f72('0x37')],'busy':this[_0x5f72('0x24')],'busyQueue':this['busyQueue']};var _0x4f13fd=md5(JSON[_0x5f72('0x38')](_0x19753e));if(this[_0x5f72('0x2')]!==_0x4f13fd){this[_0x5f72('0x2')]=_0x4f13fd;io[_0x5f72('0x39')](_0x5f72('0x3a'),_0x19753e);}};module[_0x5f72('0x3b')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 946c7c1..6b11424 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 _0x85b9=['exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRealtime','prototype','updateRouting','map','_rr','length','online','loggedIn','chatPause','paused','available','waiting','stringify','format','chat:queue:%s','emit','chat_queue:save'];(function(_0x2f8cc6,_0x18cf3b){var _0x168ac5=function(_0x332f86){while(--_0x332f86){_0x2f8cc6['push'](_0x2f8cc6['shift']());}};_0x168ac5(++_0x18cf3b);}(_0x85b9,0xc1));var _0x985b=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x85b9[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0x985b('0x0'));var md5=require(_0x985b('0x1'));var util=require(_0x985b('0x2'));var Redis=require('ioredis');var config=require(_0x985b('0x3'));config[_0x985b('0x4')]=_[_0x985b('0x5')](config[_0x985b('0x4')],{'host':_0x985b('0x6'),'port':0x18eb});var io=require(_0x985b('0x7'))(new Redis(config[_0x985b('0x4')]));function ChatQueue(_0x20d5a7){this['id']=_0x20d5a7['id']||0x0;this[_0x985b('0x8')]=_0x20d5a7[_0x985b('0x8')]||'';this['timeout']=_0x20d5a7[_0x985b('0x9')]||0xa;this[_0x985b('0xa')]=_0x20d5a7[_0x985b('0xa')]||_0x985b('0xb');this[_0x985b('0xc')]=_0x20d5a7[_0x985b('0xc')];this[_0x985b('0xd')]={};this['waiting']=0x0;this[_0x985b('0x1')]='';this['updateRouting']();this[_0x985b('0xe')]();}ChatQueue[_0x985b('0xf')][_0x985b('0x10')]=function(){var _0x18395a=this[_0x985b('0xd')]['_rr'];this['mapAgentsId']=_[_0x985b('0x11')](this[_0x985b('0xc')],'id');this[_0x985b('0xd')][_0x985b('0x12')]=_0x18395a;};ChatQueue[_0x985b('0xf')][_0x985b('0xe')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x45a7e5=0x0;_0x45a7e5=0x0?this['available']:0x0;var _0x5a43bc={'id':this['id'],'available':this[_0x985b('0x18')],'loggedIn':this[_0x985b('0x15')],'name':this[_0x985b('0x8')],'paused':this['paused'],'waiting':this[_0x985b('0x19')]};var _0x57b787=md5(JSON[_0x985b('0x1a')](_0x5a43bc));if(this[_0x985b('0x1')]!==_0x57b787){this[_0x985b('0x1')]=_0x57b787;io['to'](util[_0x985b('0x1b')](_0x985b('0x1c'),_0x5a43bc[_0x985b('0x8')]))[_0x985b('0x1d')](_0x985b('0x1e'),_0x5a43bc);}};module[_0x985b('0x1f')]=ChatQueue; \ No newline at end of file +var _0x24b7=['md5','util','ioredis','../../../config/environment','redis','defaults','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','available','stringify','chat:queue:%s','emit','lodash'];(function(_0x2b6b1b,_0x5986bc){var _0x39030c=function(_0xca241e){while(--_0xca241e){_0x2b6b1b['push'](_0x2b6b1b['shift']());}};_0x39030c(++_0x5986bc);}(_0x24b7,0x151));var _0x724b=function(_0x336c30,_0x197420){_0x336c30=_0x336c30-0x0;var _0x3a5ef5=_0x24b7[_0x336c30];return _0x3a5ef5;};'use strict';var _=require(_0x724b('0x0'));var md5=require(_0x724b('0x1'));var util=require(_0x724b('0x2'));var Redis=require(_0x724b('0x3'));var config=require(_0x724b('0x4'));config[_0x724b('0x5')]=_[_0x724b('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x724b('0x5')]));function ChatQueue(_0x125c8){this['id']=_0x125c8['id']||0x0;this[_0x724b('0x7')]=_0x125c8['name']||'';this[_0x724b('0x8')]=_0x125c8['timeout']||0xa;this[_0x724b('0x9')]=_0x125c8[_0x724b('0x9')]||_0x724b('0xa');this[_0x724b('0xb')]=_0x125c8[_0x724b('0xb')];this[_0x724b('0xc')]={};this['waiting']=0x0;this[_0x724b('0x1')]='';this[_0x724b('0xd')]();this[_0x724b('0xe')]();}ChatQueue[_0x724b('0xf')]['updateRouting']=function(){var _0x5de61f=this[_0x724b('0xc')][_0x724b('0x10')];this[_0x724b('0xc')]=_[_0x724b('0x11')](this['Agents'],'id');this[_0x724b('0xc')][_0x724b('0x10')]=_0x5de61f;};ChatQueue[_0x724b('0xf')][_0x724b('0xe')]=function(){this[_0x724b('0x12')]=0x0;this[_0x724b('0x13')]=0x0;for(var _0x43398f=0x0;_0x43398f=0x0?this[_0x724b('0x16')]:0x0;var _0x3a69a1={'id':this['id'],'available':this[_0x724b('0x16')],'loggedIn':this[_0x724b('0x12')],'name':this['name'],'paused':this[_0x724b('0x13')],'waiting':this['waiting']};var _0x52dbfa=md5(JSON[_0x724b('0x17')](_0x3a69a1));if(this['md5']!==_0x52dbfa){this[_0x724b('0x1')]=_0x52dbfa;io['to'](util['format'](_0x724b('0x18'),_0x3a69a1['name']))[_0x724b('0x19')]('chat_queue:save',_0x3a69a1);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index e0dec1a..c623e26 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 _0xdcc9=['socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','paused','length','online','faxPause','available','loggedIn','stringify','format','emit','exports','lodash','md5','ioredis','redis','defaults'];(function(_0x316a88,_0x451333){var _0x2d35b1=function(_0x234608){while(--_0x234608){_0x316a88['push'](_0x316a88['shift']());}};_0x2d35b1(++_0x451333);}(_0xdcc9,0x10e));var _0x9dcc=function(_0x18d5d7,_0x19074b){_0x18d5d7=_0x18d5d7-0x0;var _0x30a9ea=_0xdcc9[_0x18d5d7];return _0x30a9ea;};'use strict';var _=require(_0x9dcc('0x0'));var md5=require(_0x9dcc('0x1'));var util=require('util');var Redis=require(_0x9dcc('0x2'));var config=require('../../../config/environment');config[_0x9dcc('0x3')]=_[_0x9dcc('0x4')](config[_0x9dcc('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x9dcc('0x5'))(new Redis(config['redis']));function FaxQueue(_0xf34d32){this['id']=_0xf34d32['id']||0x0;this[_0x9dcc('0x6')]=_0xf34d32['name']||'';this['timeout']=_0xf34d32[_0x9dcc('0x7')]||0xa;this[_0x9dcc('0x8')]=_0xf34d32[_0x9dcc('0x8')]||_0x9dcc('0x9');this[_0x9dcc('0xa')]=_0xf34d32[_0x9dcc('0xa')];this[_0x9dcc('0xb')]={};this[_0x9dcc('0xc')]=0x0;this[_0x9dcc('0x1')]='';this[_0x9dcc('0xd')]();this['updateRealtime']();}FaxQueue[_0x9dcc('0xe')]['updateRouting']=function(){var _0x1cc4b1=this[_0x9dcc('0xb')]['_rr'];this['mapAgentsId']=_['map'](this[_0x9dcc('0xa')],'id');this[_0x9dcc('0xb')]['_rr']=_0x1cc4b1;};FaxQueue[_0x9dcc('0xe')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x9dcc('0xf')]=0x0;for(var _0x205250=0x0;_0x205250=0x0?this['available']:0x0;var _0x14302a={'id':this['id'],'available':this[_0x9dcc('0x13')],'loggedIn':this[_0x9dcc('0x14')],'name':this[_0x9dcc('0x6')],'paused':this['paused'],'waiting':this[_0x9dcc('0xc')]};var _0xab9e52=md5(JSON[_0x9dcc('0x15')](_0x14302a));if(this['md5']!==_0xab9e52){this[_0x9dcc('0x1')]=_0xab9e52;io['to'](util[_0x9dcc('0x16')]('fax:queue:%s',_0x14302a['name']))[_0x9dcc('0x17')]('fax_queue:save',_0x14302a);}};module[_0x9dcc('0x18')]=FaxQueue; \ No newline at end of file +var _0xbf0e=['loggedIn','paused','online','faxPause','available','stringify','fax:queue:%s','lodash','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','Agents','waiting','md5','prototype','updateRouting','mapAgentsId','map','_rr','updateRealtime'];(function(_0x4d009c,_0x574b90){var _0x5cdf6a=function(_0x186822){while(--_0x186822){_0x4d009c['push'](_0x4d009c['shift']());}};_0x5cdf6a(++_0x574b90);}(_0xbf0e,0x133));var _0xebf0=function(_0xe4647e,_0x5711a3){_0xe4647e=_0xe4647e-0x0;var _0x5a1558=_0xbf0e[_0xe4647e];return _0x5a1558;};'use strict';var _=require(_0xebf0('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xebf0('0x1'));var config=require(_0xebf0('0x2'));config[_0xebf0('0x3')]=_[_0xebf0('0x4')](config[_0xebf0('0x3')],{'host':_0xebf0('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xebf0('0x3')]));function FaxQueue(_0x23a010){this['id']=_0x23a010['id']||0x0;this['name']=_0x23a010[_0xebf0('0x6')]||'';this[_0xebf0('0x7')]=_0x23a010[_0xebf0('0x7')]||0xa;this[_0xebf0('0x8')]=_0x23a010[_0xebf0('0x8')]||'beepall';this[_0xebf0('0x9')]=_0x23a010[_0xebf0('0x9')];this['mapAgentsId']={};this[_0xebf0('0xa')]=0x0;this[_0xebf0('0xb')]='';this['updateRouting']();this['updateRealtime']();}FaxQueue[_0xebf0('0xc')][_0xebf0('0xd')]=function(){var _0x186436=this[_0xebf0('0xe')]['_rr'];this[_0xebf0('0xe')]=_[_0xebf0('0xf')](this[_0xebf0('0x9')],'id');this[_0xebf0('0xe')][_0xebf0('0x10')]=_0x186436;};FaxQueue[_0xebf0('0xc')][_0xebf0('0x11')]=function(){this[_0xebf0('0x12')]=0x0;this[_0xebf0('0x13')]=0x0;for(var _0x481605=0x0;_0x481605=0x0?this[_0xebf0('0x16')]:0x0;var _0x3877bf={'id':this['id'],'available':this[_0xebf0('0x16')],'loggedIn':this[_0xebf0('0x12')],'name':this[_0xebf0('0x6')],'paused':this['paused'],'waiting':this[_0xebf0('0xa')]};var _0x6467c6=md5(JSON[_0xebf0('0x17')](_0x3877bf));if(this['md5']!==_0x6467c6){this[_0xebf0('0xb')]=_0x6467c6;io['to'](util['format'](_0xebf0('0x18'),_0x3877bf[_0xebf0('0x6')]))['emit']('fax_queue:save',_0x3877bf);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index cae62a2..52dedce 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 _0x0483=['name','Intervals','exports'];(function(_0x1cd880,_0x35c8c0){var _0x81dfc7=function(_0x33807b){while(--_0x33807b){_0x1cd880['push'](_0x1cd880['shift']());}};_0x81dfc7(++_0x35c8c0);}(_0x0483,0x18c));var _0x3048=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x0483[_0x2aea9e];return _0x430b92;};'use strict';function Interval(_0x18b1b3){this['id']=_0x18b1b3['id']||0x0;this[_0x3048('0x0')]=_0x18b1b3[_0x3048('0x0')]||'';this[_0x3048('0x1')]=_0x18b1b3[_0x3048('0x1')]||{};}module[_0x3048('0x2')]=Interval; \ No newline at end of file +var _0xb09a=['exports','name','Intervals'];(function(_0x48c9fe,_0x4f32c9){var _0xa3ed1c=function(_0x593efa){while(--_0x593efa){_0x48c9fe['push'](_0x48c9fe['shift']());}};_0xa3ed1c(++_0x4f32c9);}(_0xb09a,0xeb));var _0xab09=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0xb09a[_0xbeb808];return _0x5d6909;};'use strict';function Interval(_0x8e2d89){this['id']=_0x8e2d89['id']||0x0;this[_0xab09('0x0')]=_0x8e2d89[_0xab09('0x0')]||'';this[_0xab09('0x1')]=_0x8e2d89[_0xab09('0x1')]||{};}module[_0xab09('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 2c0f199..8144b98 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 _0x7347=['waiting','stringify','mail:queue:%s','emit','exports','lodash','md5','util','../../../config/environment','defaults','redis','socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId','prototype','updateRouting','_rr','updateRealtime','loggedIn','paused','length','online','mailPause','available'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x7347,0x1b5));var _0x7734=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x7347[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x7734('0x0'));var md5=require(_0x7734('0x1'));var util=require(_0x7734('0x2'));var Redis=require('ioredis');var config=require(_0x7734('0x3'));config['redis']=_[_0x7734('0x4')](config[_0x7734('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x7734('0x6'))(new Redis(config['redis']));function MailQueue(_0xbfba7){this['id']=_0xbfba7['id']||0x0;this['name']=_0xbfba7[_0x7734('0x7')]||'';this['timeout']=_0xbfba7['timeout']||0xa;this[_0x7734('0x8')]=_0xbfba7[_0x7734('0x8')]||_0x7734('0x9');this[_0x7734('0xa')]=_0xbfba7['Agents'];this[_0x7734('0xb')]={};this['waiting']=0x0;this[_0x7734('0x1')]='';this['updateRouting']();this['updateRealtime']();}MailQueue[_0x7734('0xc')][_0x7734('0xd')]=function(){var _0x4140e4=this['mapAgentsId'][_0x7734('0xe')];this['mapAgentsId']=_['map'](this[_0x7734('0xa')],'id');this['mapAgentsId'][_0x7734('0xe')]=_0x4140e4;};MailQueue['prototype'][_0x7734('0xf')]=function(){this[_0x7734('0x10')]=0x0;this[_0x7734('0x11')]=0x0;for(var _0x32bfdb=0x0;_0x32bfdb=0x0?this[_0x7734('0x15')]:0x0;var _0x4ae0c4={'id':this['id'],'available':this[_0x7734('0x15')],'loggedIn':this['loggedIn'],'name':this[_0x7734('0x7')],'paused':this['paused'],'waiting':this[_0x7734('0x16')]};var _0x44ffea=md5(JSON[_0x7734('0x17')](_0x4ae0c4));if(this['md5']!==_0x44ffea){this['md5']=_0x44ffea;io['to'](util['format'](_0x7734('0x18'),_0x4ae0c4[_0x7734('0x7')]))[_0x7734('0x19')]('mail_queue:save',_0x4ae0c4);}};module[_0x7734('0x1a')]=MailQueue; \ No newline at end of file +var _0x02d1=['exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','paused','length','online','loggedIn','mailPause','available','stringify','format','mail:queue:%s','mail_queue:save'];(function(_0x573ace,_0x5f5c56){var _0x6059c1=function(_0x52158b){while(--_0x52158b){_0x573ace['push'](_0x573ace['shift']());}};_0x6059c1(++_0x5f5c56);}(_0x02d1,0x1f1));var _0x102d=function(_0x3c94c2,_0x284264){_0x3c94c2=_0x3c94c2-0x0;var _0x30dced=_0x02d1[_0x3c94c2];return _0x30dced;};'use strict';var _=require(_0x102d('0x0'));var md5=require(_0x102d('0x1'));var util=require(_0x102d('0x2'));var Redis=require(_0x102d('0x3'));var config=require(_0x102d('0x4'));config[_0x102d('0x5')]=_['defaults'](config[_0x102d('0x5')],{'host':_0x102d('0x6'),'port':0x18eb});var io=require(_0x102d('0x7'))(new Redis(config[_0x102d('0x5')]));function MailQueue(_0x29b5a1){this['id']=_0x29b5a1['id']||0x0;this[_0x102d('0x8')]=_0x29b5a1['name']||'';this['timeout']=_0x29b5a1[_0x102d('0x9')]||0xa;this[_0x102d('0xa')]=_0x29b5a1[_0x102d('0xa')]||_0x102d('0xb');this[_0x102d('0xc')]=_0x29b5a1[_0x102d('0xc')];this['mapAgentsId']={};this[_0x102d('0xd')]=0x0;this['md5']='';this[_0x102d('0xe')]();this[_0x102d('0xf')]();}MailQueue[_0x102d('0x10')]['updateRouting']=function(){var _0x428b7f=this[_0x102d('0x11')][_0x102d('0x12')];this[_0x102d('0x11')]=_[_0x102d('0x13')](this['Agents'],'id');this[_0x102d('0x11')][_0x102d('0x12')]=_0x428b7f;};MailQueue[_0x102d('0x10')][_0x102d('0xf')]=function(){this['loggedIn']=0x0;this[_0x102d('0x14')]=0x0;for(var _0x45ccfc=0x0;_0x45ccfc=0x0?this[_0x102d('0x19')]:0x0;var _0x55abed={'id':this['id'],'available':this[_0x102d('0x19')],'loggedIn':this[_0x102d('0x17')],'name':this['name'],'paused':this[_0x102d('0x14')],'waiting':this[_0x102d('0xd')]};var _0x596a15=md5(JSON[_0x102d('0x1a')](_0x55abed));if(this[_0x102d('0x1')]!==_0x596a15){this['md5']=_0x596a15;io['to'](util[_0x102d('0x1b')](_0x102d('0x1c'),_0x55abed[_0x102d('0x8')]))['emit'](_0x102d('0x1d'),_0x55abed);}};module[_0x102d('0x1e')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index aadc096..c31c38b 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(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x1261,0x144));var _0x1126=function(_0x1d291d,_0x17314a){_0x1d291d=_0x1d291d-0x0;var _0x44cc4e=_0x1261[_0x1d291d];return _0x44cc4e;};'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 _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0x14e51e,_0xed289b){var _0xf93e94=function(_0x4ed5bb){while(--_0x4ed5bb){_0x14e51e['push'](_0x14e51e['shift']());}};_0xf93e94(++_0xed289b);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5f5cce,_0x138cc5){_0x5f5cce=_0x5f5cce-0x0;var _0x705ecf=_0x5fc3[_0x5f5cce];return _0x705ecf;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 7127143..c26e423 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 _0xe600=['paused','length','online','available','format','sms:queue:%s','emit','sms_queue:save','exports','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','updateRealtime','loggedIn'];(function(_0x357ba1,_0x506dc5){var _0xd553c4=function(_0x1e7b69){while(--_0x1e7b69){_0x357ba1['push'](_0x357ba1['shift']());}};_0xd553c4(++_0x506dc5);}(_0xe600,0x159));var _0x0e60=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe600[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var md5=require(_0x0e60('0x0'));var util=require('util');var Redis=require(_0x0e60('0x1'));var config=require(_0x0e60('0x2'));config[_0x0e60('0x3')]=_[_0x0e60('0x4')](config[_0x0e60('0x3')],{'host':_0x0e60('0x5'),'port':0x18eb});var io=require(_0x0e60('0x6'))(new Redis(config[_0x0e60('0x3')]));function SmsQueue(_0xc730ea){this['id']=_0xc730ea['id']||0x0;this[_0x0e60('0x7')]=_0xc730ea['name']||'';this[_0x0e60('0x8')]=_0xc730ea[_0x0e60('0x8')]||0xa;this[_0x0e60('0x9')]=_0xc730ea[_0x0e60('0x9')]||'beepall';this[_0x0e60('0xa')]=_0xc730ea[_0x0e60('0xa')];this[_0x0e60('0xb')]={};this[_0x0e60('0xc')]=0x0;this[_0x0e60('0x0')]='';this[_0x0e60('0xd')]();this['updateRealtime']();}SmsQueue[_0x0e60('0xe')][_0x0e60('0xd')]=function(){var _0x32274f=this[_0x0e60('0xb')][_0x0e60('0xf')];this[_0x0e60('0xb')]=_[_0x0e60('0x10')](this[_0x0e60('0xa')],'id');this['mapAgentsId'][_0x0e60('0xf')]=_0x32274f;};SmsQueue[_0x0e60('0xe')][_0x0e60('0x11')]=function(){this[_0x0e60('0x12')]=0x0;this[_0x0e60('0x13')]=0x0;for(var _0x37bf95=0x0;_0x37bf95=0x0?this[_0x0e60('0x16')]:0x0;var _0x43a103={'id':this['id'],'available':this['available'],'loggedIn':this[_0x0e60('0x12')],'name':this[_0x0e60('0x7')],'paused':this[_0x0e60('0x13')],'waiting':this['waiting']};var _0xc1a7b9=md5(JSON['stringify'](_0x43a103));if(this[_0x0e60('0x0')]!==_0xc1a7b9){this[_0x0e60('0x0')]=_0xc1a7b9;io['to'](util[_0x0e60('0x17')](_0x0e60('0x18'),_0x43a103[_0x0e60('0x7')]))[_0x0e60('0x19')](_0x0e60('0x1a'),_0x43a103);}};module[_0x0e60('0x1b')]=SmsQueue; \ No newline at end of file +var _0x6282=['sms_queue:save','exports','lodash','md5','util','ioredis','defaults','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','online','available','format','sms:queue:%s','emit'];(function(_0x334279,_0x43a21c){var _0xbbdd06=function(_0x546982){while(--_0x546982){_0x334279['push'](_0x334279['shift']());}};_0xbbdd06(++_0x43a21c);}(_0x6282,0x76));var _0x2628=function(_0x27c499,_0x4a691e){_0x27c499=_0x27c499-0x0;var _0x5a2543=_0x6282[_0x27c499];return _0x5a2543;};'use strict';var _=require(_0x2628('0x0'));var md5=require(_0x2628('0x1'));var util=require(_0x2628('0x2'));var Redis=require(_0x2628('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x2628('0x4')](config[_0x2628('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x2628('0x6'))(new Redis(config[_0x2628('0x5')]));function SmsQueue(_0x3937c5){this['id']=_0x3937c5['id']||0x0;this[_0x2628('0x7')]=_0x3937c5[_0x2628('0x7')]||'';this['timeout']=_0x3937c5[_0x2628('0x8')]||0xa;this[_0x2628('0x9')]=_0x3937c5[_0x2628('0x9')]||_0x2628('0xa');this[_0x2628('0xb')]=_0x3937c5[_0x2628('0xb')];this[_0x2628('0xc')]={};this[_0x2628('0xd')]=0x0;this[_0x2628('0x1')]='';this[_0x2628('0xe')]();this[_0x2628('0xf')]();}SmsQueue[_0x2628('0x10')][_0x2628('0xe')]=function(){var _0x26d8aa=this[_0x2628('0xc')]['_rr'];this['mapAgentsId']=_[_0x2628('0x11')](this[_0x2628('0xb')],'id');this[_0x2628('0xc')][_0x2628('0x12')]=_0x26d8aa;};SmsQueue['prototype']['updateRealtime']=function(){this[_0x2628('0x13')]=0x0;this[_0x2628('0x14')]=0x0;for(var _0x4d2cfb=0x0;_0x4d2cfb=0x0?this[_0x2628('0x17')]:0x0;var _0x57a575={'id':this['id'],'available':this[_0x2628('0x17')],'loggedIn':this[_0x2628('0x13')],'name':this['name'],'paused':this[_0x2628('0x14')],'waiting':this['waiting']};var _0x2066ec=md5(JSON['stringify'](_0x57a575));if(this['md5']!==_0x2066ec){this[_0x2628('0x1')]=_0x2066ec;io['to'](util[_0x2628('0x18')](_0x2628('0x19'),_0x57a575[_0x2628('0x7')]))[_0x2628('0x1a')](_0x2628('0x1b'),_0x57a575);}};module[_0x2628('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 9398d66..546fafe 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 _0xeed9=['loggedIn','length','online','whatsappPause','paused','available','stringify','format','emit','whatsapp_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map'];(function(_0x55971c,_0x423fe5){var _0x5bb422=function(_0x3e8bb5){while(--_0x3e8bb5){_0x55971c['push'](_0x55971c['shift']());}};_0x5bb422(++_0x423fe5);}(_0xeed9,0x141));var _0x9eed=function(_0x3d90b4,_0x1e2fc6){_0x3d90b4=_0x3d90b4-0x0;var _0x4c65d3=_0xeed9[_0x3d90b4];return _0x4c65d3;};'use strict';var _=require(_0x9eed('0x0'));var md5=require(_0x9eed('0x1'));var util=require(_0x9eed('0x2'));var Redis=require('ioredis');var config=require(_0x9eed('0x3'));config[_0x9eed('0x4')]=_[_0x9eed('0x5')](config[_0x9eed('0x4')],{'host':_0x9eed('0x6'),'port':0x18eb});var io=require(_0x9eed('0x7'))(new Redis(config['redis']));function WhatsappQueue(_0x2668e2){this['id']=_0x2668e2['id']||0x0;this[_0x9eed('0x8')]=_0x2668e2['name']||'';this[_0x9eed('0x9')]=_0x2668e2['timeout']||0xa;this[_0x9eed('0xa')]=_0x2668e2[_0x9eed('0xa')]||_0x9eed('0xb');this[_0x9eed('0xc')]=_0x2668e2[_0x9eed('0xc')];this[_0x9eed('0xd')]={};this[_0x9eed('0xe')]=0x0;this['md5']='';this[_0x9eed('0xf')]();this[_0x9eed('0x10')]();}WhatsappQueue[_0x9eed('0x11')][_0x9eed('0xf')]=function(){var _0x267c69=this['mapAgentsId'][_0x9eed('0x12')];this[_0x9eed('0xd')]=_[_0x9eed('0x13')](this[_0x9eed('0xc')],'id');this[_0x9eed('0xd')][_0x9eed('0x12')]=_0x267c69;};WhatsappQueue[_0x9eed('0x11')][_0x9eed('0x10')]=function(){this[_0x9eed('0x14')]=0x0;this['paused']=0x0;for(var _0x72d5=0x0;_0x72d5=0x0?this[_0x9eed('0x19')]:0x0;var _0x255cb3={'id':this['id'],'available':this['available'],'loggedIn':this[_0x9eed('0x14')],'name':this[_0x9eed('0x8')],'paused':this[_0x9eed('0x18')],'waiting':this[_0x9eed('0xe')]};var _0xff2c76=md5(JSON[_0x9eed('0x1a')](_0x255cb3));if(this[_0x9eed('0x1')]!==_0xff2c76){this[_0x9eed('0x1')]=_0xff2c76;io['to'](util[_0x9eed('0x1b')]('whatsapp:queue:%s',_0x255cb3[_0x9eed('0x8')]))[_0x9eed('0x1c')](_0x9eed('0x1d'),_0x255cb3);}};module[_0x9eed('0x1e')]=WhatsappQueue; \ No newline at end of file +var _0x91f2=['online','whatsappPause','paused','available','name','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','timeout','strategy','Agents','mapAgentsId','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn'];(function(_0x5471ec,_0x1ce81a){var _0x121d4c=function(_0xefb655){while(--_0xefb655){_0x5471ec['push'](_0x5471ec['shift']());}};_0x121d4c(++_0x1ce81a);}(_0x91f2,0x175));var _0x291f=function(_0x3573a0,_0x24de20){_0x3573a0=_0x3573a0-0x0;var _0x10afad=_0x91f2[_0x3573a0];return _0x10afad;};'use strict';var _=require(_0x291f('0x0'));var md5=require('md5');var util=require(_0x291f('0x1'));var Redis=require(_0x291f('0x2'));var config=require(_0x291f('0x3'));config[_0x291f('0x4')]=_[_0x291f('0x5')](config[_0x291f('0x4')],{'host':_0x291f('0x6'),'port':0x18eb});var io=require(_0x291f('0x7'))(new Redis(config[_0x291f('0x4')]));function WhatsappQueue(_0x1f3486){this['id']=_0x1f3486['id']||0x0;this['name']=_0x1f3486['name']||'';this[_0x291f('0x8')]=_0x1f3486[_0x291f('0x8')]||0xa;this['strategy']=_0x1f3486[_0x291f('0x9')]||'beepall';this['Agents']=_0x1f3486[_0x291f('0xa')];this[_0x291f('0xb')]={};this['waiting']=0x0;this[_0x291f('0xc')]='';this[_0x291f('0xd')]();this[_0x291f('0xe')]();}WhatsappQueue[_0x291f('0xf')]['updateRouting']=function(){var _0x25352c=this[_0x291f('0xb')][_0x291f('0x10')];this[_0x291f('0xb')]=_[_0x291f('0x11')](this[_0x291f('0xa')],'id');this[_0x291f('0xb')][_0x291f('0x10')]=_0x25352c;};WhatsappQueue[_0x291f('0xf')][_0x291f('0xe')]=function(){this[_0x291f('0x12')]=0x0;this['paused']=0x0;for(var _0xdb9746=0x0;_0xdb9746=0x0?this[_0x291f('0x16')]:0x0;var _0xf4c343={'id':this['id'],'available':this[_0x291f('0x16')],'loggedIn':this[_0x291f('0x12')],'name':this[_0x291f('0x17')],'paused':this[_0x291f('0x15')],'waiting':this['waiting']};var _0x1be4e5=md5(JSON['stringify'](_0xf4c343));if(this['md5']!==_0x1be4e5){this['md5']=_0x1be4e5;io['to'](util['format'](_0x291f('0x18'),_0xf4c343[_0x291f('0x17')]))[_0x291f('0x19')](_0x291f('0x1a'),_0xf4c343);}};module[_0x291f('0x1b')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index bd99d42..385f27f 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(_0x1dce16,_0x214e50){var _0x2a9c18=function(_0x3a2280){while(--_0x3a2280){_0x1dce16['push'](_0x1dce16['shift']());}};_0x2a9c18(++_0x214e50);}(_0xb10b,0x12a));var _0xbb10=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0xb10b[_0x22f8ab];return _0x2a70e5;};'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(_0x1e3b09,_0x302b84){var _0x4602a9=function(_0x2ef98c){while(--_0x2ef98c){_0x1e3b09['push'](_0x1e3b09['shift']());}};_0x4602a9(++_0x302b84);}(_0xb10b,0x12a));var _0xbb10=function(_0x39551a,_0x116007){_0x39551a=_0x39551a-0x0;var _0x4b0b62=_0xb10b[_0x39551a];return _0x4b0b62;};'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 38cedd2..6e2c05c 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 _0xd845=['Request','UpdateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','update'];(function(_0x3ffb68,_0x5541e9){var _0x400e8a=function(_0x526f93){while(--_0x526f93){_0x3ffb68['push'](_0x3ffb68['shift']());}};_0x400e8a(++_0x5541e9);}(_0xd845,0x95));var _0x5d84=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xd845[_0x6c993a];return _0x27f547;};'use strict';var client=require('../client');exports[_0x5d84('0x0')]=function(_0x30fb1e,_0x486723){return client[_0x5d84('0x1')](_0x5d84('0x2'),{'body':_0x486723,'options':{'where':{'id':_0x30fb1e}},'log':'updateChatInteraction'});};exports[_0x5d84('0x3')]=function(_0x2e474e,_0x478ffb){return client[_0x5d84('0x1')](_0x5d84('0x4'),{'body':_0x478ffb,'options':{'where':{'id':_0x2e474e}},'log':_0x5d84('0x5')});}; \ No newline at end of file +var _0x22c7=['UpdateChatInteraction','addTags','Request','AddTagsToChatInteraction','addTagsToChatInteraction','../client'];(function(_0x53e506,_0x4a7b4a){var _0x8f5aa0=function(_0x8dee02){while(--_0x8dee02){_0x53e506['push'](_0x53e506['shift']());}};_0x8f5aa0(++_0x4a7b4a);}(_0x22c7,0x11f));var _0x722c=function(_0x3d6950,_0x5a302d){_0x3d6950=_0x3d6950-0x0;var _0x2e380f=_0x22c7[_0x3d6950];return _0x2e380f;};'use strict';var client=require(_0x722c('0x0'));exports['update']=function(_0x59e807,_0x464b67){return client['Request'](_0x722c('0x1'),{'body':_0x464b67,'options':{'where':{'id':_0x59e807}},'log':'updateChatInteraction'});};exports[_0x722c('0x2')]=function(_0x57a98b,_0x174862){return client[_0x722c('0x3')](_0x722c('0x4'),{'body':_0x174862,'options':{'where':{'id':_0x57a98b}},'log':_0x722c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 794a199..6ad54db 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 _0x4959=['../client','create','Request','CreateChatMessage','createChatMessage'];(function(_0x2763f8,_0x54cc72){var _0x397168=function(_0x47f824){while(--_0x47f824){_0x2763f8['push'](_0x2763f8['shift']());}};_0x397168(++_0x54cc72);}(_0x4959,0x16d));var _0x9495=function(_0x4a08ae,_0x38c263){_0x4a08ae=_0x4a08ae-0x0;var _0x1447d3=_0x4959[_0x4a08ae];return _0x1447d3;};'use strict';var client=require(_0x9495('0x0'));exports[_0x9495('0x1')]=function(_0x522851){return client[_0x9495('0x2')](_0x9495('0x3'),{'body':_0x522851,'log':_0x9495('0x4')});}; \ No newline at end of file +var _0xbaf9=['../client','create','Request','CreateChatMessage','createChatMessage'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xbaf9,0x1d1));var _0x9baf=function(_0x10cd3b,_0x6831cd){_0x10cd3b=_0x10cd3b-0x0;var _0x3895ea=_0xbaf9[_0x10cd3b];return _0x3895ea;};'use strict';var client=require(_0x9baf('0x0'));exports[_0x9baf('0x1')]=function(_0x498024){return client[_0x9baf('0x2')](_0x9baf('0x3'),{'body':_0x498024,'log':_0x9baf('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index c6ee8c3..0724bf2 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 _0xac0a=['User','Agents','name','online','chatPause','getChatQueues','Request','GetChatQueue','timeout','strategy'];(function(_0x3a5028,_0x5a4673){var _0x335f10=function(_0x4a76d0){while(--_0x4a76d0){_0x3a5028['push'](_0x3a5028['shift']());}};_0x335f10(++_0x5a4673);}(_0xac0a,0x11e));var _0xaac0=function(_0x3093ee,_0x2e3d20){_0x3093ee=_0x3093ee-0x0;var _0x48ac52=_0xac0a[_0x3093ee];return _0x48ac52;};'use strict';var client=require('../client');exports['getChatQueues']=function(){return function(){return client[_0xaac0('0x0')](_0xaac0('0x1'),{'options':{'raw':![],'attributes':['id','name',_0xaac0('0x2'),_0xaac0('0x3')],'include':[{'model':_0xaac0('0x4'),'as':_0xaac0('0x5'),'attributes':['id',_0xaac0('0x6'),_0xaac0('0x7'),_0xaac0('0x8')]}]},'log':_0xaac0('0x9')});};}; \ No newline at end of file +var _0x943c=['../client','getChatQueues','Request','GetChatQueue','strategy','User','Agents','online','chatPause'];(function(_0x5d1748,_0x104eef){var _0x4ab90c=function(_0x428e09){while(--_0x428e09){_0x5d1748['push'](_0x5d1748['shift']());}};_0x4ab90c(++_0x104eef);}(_0x943c,0xd8));var _0xc943=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x943c[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xc943('0x0'));exports[_0xc943('0x1')]=function(){return function(){return client[_0xc943('0x2')](_0xc943('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xc943('0x4')],'include':[{'model':_0xc943('0x5'),'as':_0xc943('0x6'),'attributes':['id','name',_0xc943('0x7'),_0xc943('0x8')]}]},'log':_0xc943('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 50e3501..634bcec 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 _0x98d5=['UpdateChatQueueReport','../client','Request','CreateChatQueueReport','update'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x98d5,0xfb));var _0x598d=function(_0x46a8ee,_0x4fb69a){_0x46a8ee=_0x46a8ee-0x0;var _0x125121=_0x98d5[_0x46a8ee];return _0x125121;};'use strict';var client=require(_0x598d('0x0'));exports['create']=function(_0x491dcb){return client[_0x598d('0x1')](_0x598d('0x2'),{'body':_0x491dcb,'log':_0x598d('0x2')});};exports[_0x598d('0x3')]=function(_0x418321,_0x3890f3){return client[_0x598d('0x1')](_0x598d('0x4'),{'body':_0x3890f3,'options':{'where':{'uniqueid':_0x418321},'order':[['id','DESC']],'limit':0x1},'log':_0x598d('0x4')});}; \ No newline at end of file +var _0x0eec=['update','DESC','../client','Request','CreateChatQueueReport'];(function(_0x5b2f71,_0x5c7880){var _0x1e18f2=function(_0x703e27){while(--_0x703e27){_0x5b2f71['push'](_0x5b2f71['shift']());}};_0x1e18f2(++_0x5c7880);}(_0x0eec,0xac));var _0xc0ee=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0eec[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0xc0ee('0x0'));exports['create']=function(_0x51c509){return client[_0xc0ee('0x1')](_0xc0ee('0x2'),{'body':_0x51c509,'log':_0xc0ee('0x2')});};exports[_0xc0ee('0x3')]=function(_0xf8033b,_0x1accbe){return client[_0xc0ee('0x1')]('UpdateChatQueueReport',{'body':_0x1accbe,'options':{'where':{'uniqueid':_0xf8033b},'order':[['id',_0xc0ee('0x4')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index f45f831..80fad96 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(_0x48326a,_0x8cfa0c){var _0x466709=function(_0x5ab1b7){while(--_0x5ab1b7){_0x48326a['push'](_0x48326a['shift']());}};_0x466709(++_0x8cfa0c);}(_0x7a54,0x106));var _0x47a5=function(_0x436b17,_0x267ef1){_0x436b17=_0x436b17-0x0;var _0x24cbd7=_0x7a54[_0x436b17];return _0x24cbd7;};'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(_0x5471ec,_0x1ce81a){var _0x121d4c=function(_0xefb655){while(--_0xefb655){_0x5471ec['push'](_0x5471ec['shift']());}};_0x121d4c(++_0x1ce81a);}(_0x7a54,0x106));var _0x47a5=function(_0xddde4a,_0x3b905f){_0xddde4a=_0xddde4a-0x0;var _0x355c24=_0x7a54[_0xddde4a];return _0x355c24;};'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 742b850..a58d2e2 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 _0x8033=['create','Request','CreateFaxMessage','createFaxMessage'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x8033,0x1f4));var _0x3803=function(_0x1ecfc8,_0x39ea27){_0x1ecfc8=_0x1ecfc8-0x0;var _0x7b6b6c=_0x8033[_0x1ecfc8];return _0x7b6b6c;};'use strict';var client=require('../client');exports[_0x3803('0x0')]=function(_0x3bbf3d){return client[_0x3803('0x1')](_0x3803('0x2'),{'body':_0x3bbf3d,'log':_0x3803('0x3')});}; \ No newline at end of file +var _0x0cef=['../client','Request','CreateFaxMessage','createFaxMessage'];(function(_0x3b55ce,_0x1e7727){var _0xe4d917=function(_0x5f3c4d){while(--_0x5f3c4d){_0x3b55ce['push'](_0x3b55ce['shift']());}};_0xe4d917(++_0x1e7727);}(_0x0cef,0x1e4));var _0xf0ce=function(_0x456a84,_0x46bc0b){_0x456a84=_0x456a84-0x0;var _0x1117d6=_0x0cef[_0x456a84];return _0x1117d6;};'use strict';var client=require(_0xf0ce('0x0'));exports['create']=function(_0xbc442){return client[_0xf0ce('0x1')](_0xf0ce('0x2'),{'body':_0xbc442,'log':_0xf0ce('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index a970d7f..8717da9 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 _0x6e83=['name','strategy','User','Agents','faxPause','getFaxQueues','Request','GetFaxQueue'];(function(_0x2b7fc5,_0x46ad57){var _0x44f312=function(_0x46dbf4){while(--_0x46dbf4){_0x2b7fc5['push'](_0x2b7fc5['shift']());}};_0x44f312(++_0x46ad57);}(_0x6e83,0x165));var _0x36e8=function(_0x55fe01,_0x12ed37){_0x55fe01=_0x55fe01-0x0;var _0x5b42f0=_0x6e83[_0x55fe01];return _0x5b42f0;};'use strict';var client=require('../client');exports[_0x36e8('0x0')]=function(){return function(){return client[_0x36e8('0x1')](_0x36e8('0x2'),{'options':{'raw':![],'attributes':['id',_0x36e8('0x3'),'timeout',_0x36e8('0x4')],'include':[{'model':_0x36e8('0x5'),'as':_0x36e8('0x6'),'attributes':['id',_0x36e8('0x3'),'online',_0x36e8('0x7')]}]},'log':_0x36e8('0x0')});};}; \ No newline at end of file +var _0x9d66=['name','timeout','strategy','Agents','online','faxPause','../client','getFaxQueues','Request'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9d66,0xc3));var _0x69d6=function(_0x53c0a3,_0x542cbd){_0x53c0a3=_0x53c0a3-0x0;var _0x4e25d6=_0x9d66[_0x53c0a3];return _0x4e25d6;};'use strict';var client=require(_0x69d6('0x0'));exports[_0x69d6('0x1')]=function(){return function(){return client[_0x69d6('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x69d6('0x3'),_0x69d6('0x4'),_0x69d6('0x5')],'include':[{'model':'User','as':_0x69d6('0x6'),'attributes':['id',_0x69d6('0x3'),_0x69d6('0x7'),_0x69d6('0x8')]}]},'log':_0x69d6('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index af6141e..5d33deb 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 _0xce56=['Request','CreateFaxQueueReport','UpdateFaxQueueReport','DESC','../client','create'];(function(_0x9a3e0f,_0x2f796d){var _0x3d2a9a=function(_0x3aeb03){while(--_0x3aeb03){_0x9a3e0f['push'](_0x9a3e0f['shift']());}};_0x3d2a9a(++_0x2f796d);}(_0xce56,0x142));var _0x6ce5=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0xce56[_0x4e6ae6];return _0x23c108;};'use strict';var client=require(_0x6ce5('0x0'));exports[_0x6ce5('0x1')]=function(_0x492a01){return client[_0x6ce5('0x2')](_0x6ce5('0x3'),{'body':_0x492a01,'log':_0x6ce5('0x3')});};exports['update']=function(_0x165689,_0x595128){return client[_0x6ce5('0x2')](_0x6ce5('0x4'),{'body':_0x595128,'options':{'where':{'uniqueid':_0x165689},'order':[['id',_0x6ce5('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0xe50e=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','../client','create'];(function(_0x3f969a,_0x3cd782){var _0x3b39b7=function(_0x484413){while(--_0x484413){_0x3f969a['push'](_0x3f969a['shift']());}};_0x3b39b7(++_0x3cd782);}(_0xe50e,0xbe));var _0xee50=function(_0x1dc4c2,_0x4038e1){_0x1dc4c2=_0x1dc4c2-0x0;var _0xb8d224=_0xe50e[_0x1dc4c2];return _0xb8d224;};'use strict';var client=require(_0xee50('0x0'));exports[_0xee50('0x1')]=function(_0xd3ba6b){return client[_0xee50('0x2')](_0xee50('0x3'),{'body':_0xd3ba6b,'log':_0xee50('0x3')});};exports[_0xee50('0x4')]=function(_0x41cf11,_0x61fd23){return client['Request'](_0xee50('0x5'),{'body':_0x61fd23,'options':{'where':{'uniqueid':_0x41cf11},'order':[['id','DESC']],'limit':0x1},'log':_0xee50('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index ce411d5..20b2255 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 _0x45e2=['../client','getIntervals','Request','Interval','Intervals','name','interval'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x45e2,0x157));var _0x245e=function(_0x2c6f8b,_0x4016cf){_0x2c6f8b=_0x2c6f8b-0x0;var _0x1c28a1=_0x45e2[_0x2c6f8b];return _0x1c28a1;};'use strict';var client=require(_0x245e('0x0'));exports[_0x245e('0x1')]=function(){return function(){return client[_0x245e('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x245e('0x3'),'as':_0x245e('0x4'),'attributes':['id',_0x245e('0x5'),_0x245e('0x6')]}]},'log':_0x245e('0x1')});};}; \ No newline at end of file +var _0x5faa=['name','Interval','Intervals','interval','../client','getIntervals','GetInterval'];(function(_0x3642ef,_0x52a3e0){var _0x120adf=function(_0x2aee16){while(--_0x2aee16){_0x3642ef['push'](_0x3642ef['shift']());}};_0x120adf(++_0x52a3e0);}(_0x5faa,0x97));var _0xa5fa=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x5faa[_0x5d2803];return _0xdcad2c;};'use strict';var client=require(_0xa5fa('0x0'));exports[_0xa5fa('0x1')]=function(){return function(){return client['Request'](_0xa5fa('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xa5fa('0x3')],'include':[{'model':_0xa5fa('0x4'),'as':_0xa5fa('0x5'),'attributes':['id',_0xa5fa('0x3'),_0xa5fa('0x6')]}]},'log':_0xa5fa('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index cc605dd..c07fb26 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 _0xef0f=['../client','Request','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xef0f,0x168));var _0xfef0=function(_0x4b135e,_0x289488){_0x4b135e=_0x4b135e-0x0;var _0x16aa1d=_0xef0f[_0x4b135e];return _0x16aa1d;};'use strict';var client=require(_0xfef0('0x0'));exports['update']=function(_0x74fc2,_0x22a6a3){return client[_0xfef0('0x1')]('UpdateMailInteraction',{'body':_0x22a6a3,'options':{'where':{'id':_0x74fc2}},'log':_0xfef0('0x2')});};exports[_0xfef0('0x3')]=function(_0x4618fb,_0x4e1af6){return client[_0xfef0('0x1')](_0xfef0('0x4'),{'body':_0x4e1af6,'options':{'where':{'id':_0x4618fb}},'log':_0xfef0('0x5')});}; \ No newline at end of file +var _0x781d=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x5ac94d,_0x5d3a8c){var _0x563863=function(_0x39285d){while(--_0x39285d){_0x5ac94d['push'](_0x5ac94d['shift']());}};_0x563863(++_0x5d3a8c);}(_0x781d,0x14a));var _0xd781=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x781d[_0x1ac595];return _0x455fff;};'use strict';var client=require(_0xd781('0x0'));exports[_0xd781('0x1')]=function(_0x596ba2,_0x5c1007){return client[_0xd781('0x2')](_0xd781('0x3'),{'body':_0x5c1007,'options':{'where':{'id':_0x596ba2}},'log':_0xd781('0x4')});};exports[_0xd781('0x5')]=function(_0xfd915d,_0x42258e){return client[_0xd781('0x2')](_0xd781('0x6'),{'body':_0x42258e,'options':{'where':{'id':_0xfd915d}},'log':_0xd781('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 58dd374..ba68f4b 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 _0xff92=['create','Request','CreateMailMessage','createMailMessage'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0xff92,0x154));var _0x2ff9=function(_0x41cd82,_0x5ad95b){_0x41cd82=_0x41cd82-0x0;var _0x59c943=_0xff92[_0x41cd82];return _0x59c943;};'use strict';var client=require('../client');exports[_0x2ff9('0x0')]=function(_0x46924f){return client[_0x2ff9('0x1')](_0x2ff9('0x2'),{'body':_0x46924f,'log':_0x2ff9('0x3')});}; \ No newline at end of file +var _0xedb5=['../client','create','Request','createMailMessage'];(function(_0x226b01,_0x2dfe4e){var _0x56b6c6=function(_0x535f5f){while(--_0x535f5f){_0x226b01['push'](_0x226b01['shift']());}};_0x56b6c6(++_0x2dfe4e);}(_0xedb5,0xe0));var _0x5edb=function(_0x45f5c6,_0x2db068){_0x45f5c6=_0x45f5c6-0x0;var _0x12e5e5=_0xedb5[_0x45f5c6];return _0x12e5e5;};'use strict';var client=require(_0x5edb('0x0'));exports[_0x5edb('0x1')]=function(_0x521fcb){return client[_0x5edb('0x2')]('CreateMailMessage',{'body':_0x521fcb,'log':_0x5edb('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 283a0db..0aaa747 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 _0x4122=['../client','getMailQueues','Request','GetMailQueue','name','User','Agents','online','mailPause'];(function(_0x5f20d8,_0x500714){var _0x3065d1=function(_0x371d39){while(--_0x371d39){_0x5f20d8['push'](_0x5f20d8['shift']());}};_0x3065d1(++_0x500714);}(_0x4122,0x1d4));var _0x2412=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4122[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x2412('0x0'));exports[_0x2412('0x1')]=function(){return function(){return client[_0x2412('0x2')](_0x2412('0x3'),{'options':{'raw':![],'attributes':['id',_0x2412('0x4'),'timeout','strategy'],'include':[{'model':_0x2412('0x5'),'as':_0x2412('0x6'),'attributes':['id',_0x2412('0x4'),_0x2412('0x7'),_0x2412('0x8')]}]},'log':_0x2412('0x1')});};}; \ No newline at end of file +var _0xa7e0=['User','Agents','name','online','mailPause','../client','getMailQueues','Request','timeout','strategy'];(function(_0x21b880,_0x56d303){var _0x252eae=function(_0x2d5527){while(--_0x2d5527){_0x21b880['push'](_0x21b880['shift']());}};_0x252eae(++_0x56d303);}(_0xa7e0,0xff));var _0x0a7e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa7e0[_0x56482c];return _0x5aae7a;};'use strict';var client=require(_0x0a7e('0x0'));exports[_0x0a7e('0x1')]=function(){return function(){return client[_0x0a7e('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a7e('0x3'),_0x0a7e('0x4')],'include':[{'model':_0x0a7e('0x5'),'as':_0x0a7e('0x6'),'attributes':['id',_0x0a7e('0x7'),_0x0a7e('0x8'),_0x0a7e('0x9')]}]},'log':_0x0a7e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 273ffc0..d04eb27 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 _0xc0f1=['../client','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC'];(function(_0x3950aa,_0x3b2aad){var _0x4ef637=function(_0x528e3f){while(--_0x528e3f){_0x3950aa['push'](_0x3950aa['shift']());}};_0x4ef637(++_0x3b2aad);}(_0xc0f1,0x165));var _0x1c0f=function(_0x454e6d,_0x1e1f38){_0x454e6d=_0x454e6d-0x0;var _0x4bc294=_0xc0f1[_0x454e6d];return _0x4bc294;};'use strict';var client=require(_0x1c0f('0x0'));exports[_0x1c0f('0x1')]=function(_0xa5d8b0){return client[_0x1c0f('0x2')](_0x1c0f('0x3'),{'body':_0xa5d8b0,'log':_0x1c0f('0x3')});};exports[_0x1c0f('0x4')]=function(_0x14e193,_0x5747cc){return client['Request'](_0x1c0f('0x5'),{'body':_0x5747cc,'options':{'where':{'uniqueid':_0x14e193},'order':[['id',_0x1c0f('0x6')]],'limit':0x1},'log':_0x1c0f('0x5')});}; \ No newline at end of file +var _0x576a=['DESC','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x291d3f,_0x3ef99f){var _0x242080=function(_0x257705){while(--_0x257705){_0x291d3f['push'](_0x291d3f['shift']());}};_0x242080(++_0x3ef99f);}(_0x576a,0x121));var _0xa576=function(_0x5226ca,_0x386892){_0x5226ca=_0x5226ca-0x0;var _0x15eee7=_0x576a[_0x5226ca];return _0x15eee7;};'use strict';var client=require('../client');exports[_0xa576('0x0')]=function(_0x2cf6be){return client[_0xa576('0x1')](_0xa576('0x2'),{'body':_0x2cf6be,'log':_0xa576('0x2')});};exports[_0xa576('0x3')]=function(_0x304fd4,_0x5348bd){return client['Request'](_0xa576('0x4'),{'body':_0x5348bd,'options':{'where':{'uniqueid':_0x304fd4},'order':[['id',_0xa576('0x5')]],'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 4e3466c..f2deb35 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 _0xe542=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','addTags','Request'];(function(_0x48e047,_0x35c0c2){var _0x51f1ec=function(_0x4eaf15){while(--_0x4eaf15){_0x48e047['push'](_0x48e047['shift']());}};_0x51f1ec(++_0x35c0c2);}(_0xe542,0xc8));var _0x2e54=function(_0x39b3bd,_0x1c307a){_0x39b3bd=_0x39b3bd-0x0;var _0x46c65d=_0xe542[_0x39b3bd];return _0x46c65d;};'use strict';var client=require(_0x2e54('0x0'));exports[_0x2e54('0x1')]=function(_0x3491ac,_0x37afb5){return client['Request']('UpdateOpenchannelInteraction',{'body':_0x37afb5,'options':{'where':{'id':_0x3491ac}},'log':'updateOpenchannelInteraction'});};exports[_0x2e54('0x2')]=function(_0x45fc28,_0x1dd64a){return client[_0x2e54('0x3')](_0x2e54('0x4'),{'body':_0x1dd64a,'options':{'where':{'id':_0x45fc28}},'log':_0x2e54('0x5')});}; \ No newline at end of file +var _0x1690=['addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction'];(function(_0x523915,_0x3fa421){var _0x2f31fa=function(_0x1c86ce){while(--_0x1c86ce){_0x523915['push'](_0x523915['shift']());}};_0x2f31fa(++_0x3fa421);}(_0x1690,0x1eb));var _0x0169=function(_0x1ea505,_0x55cd28){_0x1ea505=_0x1ea505-0x0;var _0x203d89=_0x1690[_0x1ea505];return _0x203d89;};'use strict';var client=require(_0x0169('0x0'));exports[_0x0169('0x1')]=function(_0x319dcd,_0x401835){return client[_0x0169('0x2')](_0x0169('0x3'),{'body':_0x401835,'options':{'where':{'id':_0x319dcd}},'log':_0x0169('0x4')});};exports['addTags']=function(_0x1fd4bc,_0x51d4a5){return client[_0x0169('0x2')](_0x0169('0x5'),{'body':_0x51d4a5,'options':{'where':{'id':_0x1fd4bc}},'log':_0x0169('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index d5578c4..1830281 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 _0x1af8=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x1af8,0x192));var _0x81af=function(_0x5e4f12,_0x3ffd19){_0x5e4f12=_0x5e4f12-0x0;var _0x45f65a=_0x1af8[_0x5e4f12];return _0x45f65a;};'use strict';var client=require(_0x81af('0x0'));exports[_0x81af('0x1')]=function(_0x25e62b){return client[_0x81af('0x2')](_0x81af('0x3'),{'body':_0x25e62b,'log':_0x81af('0x4')});}; \ No newline at end of file +var _0xedd3=['../client','create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x4c4664,_0x506a85){var _0x2920cf=function(_0x54a19d){while(--_0x54a19d){_0x4c4664['push'](_0x4c4664['shift']());}};_0x2920cf(++_0x506a85);}(_0xedd3,0x1b8));var _0x3edd=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xedd3[_0x2b7764];return _0x848dcb;};'use strict';var client=require(_0x3edd('0x0'));exports[_0x3edd('0x1')]=function(_0x37a5c7){return client[_0x3edd('0x2')](_0x3edd('0x3'),{'body':_0x37a5c7,'log':_0x3edd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 6574f3b..0cc37df 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 _0x95c0=['strategy','User','Agents','online','openchannelPause','getOpenchannelQueues','../client','Request','GetOpenchannelQueue','timeout'];(function(_0x9728b8,_0x5a1a6d){var _0x4b80ab=function(_0xdccc9b){while(--_0xdccc9b){_0x9728b8['push'](_0x9728b8['shift']());}};_0x4b80ab(++_0x5a1a6d);}(_0x95c0,0x74));var _0x095c=function(_0x169c27,_0x399270){_0x169c27=_0x169c27-0x0;var _0x2cd1cd=_0x95c0[_0x169c27];return _0x2cd1cd;};'use strict';var client=require(_0x095c('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x095c('0x1')](_0x095c('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x095c('0x3'),_0x095c('0x4')],'include':[{'model':_0x095c('0x5'),'as':_0x095c('0x6'),'attributes':['id','name',_0x095c('0x7'),_0x095c('0x8')]}]},'log':_0x095c('0x9')});};}; \ No newline at end of file +var _0x8dbb=['Request','name','strategy','User','online','openchannelPause','../client','getOpenchannelQueues'];(function(_0x35404d,_0x191a4f){var _0x5ad155=function(_0xbb9517){while(--_0xbb9517){_0x35404d['push'](_0x35404d['shift']());}};_0x5ad155(++_0x191a4f);}(_0x8dbb,0xce));var _0xb8db=function(_0x5ab7cf,_0x173067){_0x5ab7cf=_0x5ab7cf-0x0;var _0x519b07=_0x8dbb[_0x5ab7cf];return _0x519b07;};'use strict';var client=require(_0xb8db('0x0'));exports[_0xb8db('0x1')]=function(){return function(){return client[_0xb8db('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xb8db('0x3'),'timeout',_0xb8db('0x4')],'include':[{'model':_0xb8db('0x5'),'as':'Agents','attributes':['id',_0xb8db('0x3'),_0xb8db('0x6'),_0xb8db('0x7')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index de7ff28..5d48140 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 _0xcc6a=['create','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcc6a,0x1cd));var _0xacc6=function(_0x322ce9,_0x146dbe){_0x322ce9=_0x322ce9-0x0;var _0x41cab5=_0xcc6a[_0x322ce9];return _0x41cab5;};'use strict';var client=require(_0xacc6('0x0'));exports[_0xacc6('0x1')]=function(_0x36421a){return client['Request'](_0xacc6('0x2'),{'body':_0x36421a,'log':_0xacc6('0x2')});};exports[_0xacc6('0x3')]=function(_0x318201,_0x43dad6){return client['Request'](_0xacc6('0x4'),{'body':_0x43dad6,'options':{'where':{'uniqueid':_0x318201},'order':[['id',_0xacc6('0x5')]],'limit':0x1},'log':_0xacc6('0x4')});}; \ No newline at end of file +var _0x25dc=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','../client','create','Request'];(function(_0x207a02,_0x278c56){var _0xd995c3=function(_0x24e415){while(--_0x24e415){_0x207a02['push'](_0x207a02['shift']());}};_0xd995c3(++_0x278c56);}(_0x25dc,0x135));var _0xc25d=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0x25dc[_0x1a9204];return _0x17ca68;};'use strict';var client=require(_0xc25d('0x0'));exports[_0xc25d('0x1')]=function(_0x2a77a3){return client[_0xc25d('0x2')](_0xc25d('0x3'),{'body':_0x2a77a3,'log':_0xc25d('0x3')});};exports[_0xc25d('0x4')]=function(_0x16d6a,_0x41d797){return client[_0xc25d('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x41d797,'options':{'where':{'uniqueid':_0x16d6a},'order':[['id','DESC']],'limit':0x1},'log':_0xc25d('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 02df5fc..401b520 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 _0xc18a=['update','UpdateSmsInteraction','updateSmsInteraction','addTags','Request','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x44474f,_0x431580){var _0x427d97=function(_0x53f7d4){while(--_0x53f7d4){_0x44474f['push'](_0x44474f['shift']());}};_0x427d97(++_0x431580);}(_0xc18a,0x1cf));var _0xac18=function(_0x2178e9,_0x30db4c){_0x2178e9=_0x2178e9-0x0;var _0x51113b=_0xc18a[_0x2178e9];return _0x51113b;};'use strict';var client=require(_0xac18('0x0'));exports[_0xac18('0x1')]=function(_0x1bb84d,_0x249826){return client['Request'](_0xac18('0x2'),{'body':_0x249826,'options':{'where':{'id':_0x1bb84d}},'log':_0xac18('0x3')});};exports[_0xac18('0x4')]=function(_0x3da5f5,_0x42f646){return client[_0xac18('0x5')](_0xac18('0x6'),{'body':_0x42f646,'options':{'where':{'id':_0x3da5f5}},'log':_0xac18('0x7')});}; \ No newline at end of file +var _0xf822=['../client','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction'];(function(_0x46ebe3,_0x164acb){var _0x31ec5a=function(_0x17ae8f){while(--_0x17ae8f){_0x46ebe3['push'](_0x46ebe3['shift']());}};_0x31ec5a(++_0x164acb);}(_0xf822,0x19e));var _0x2f82=function(_0x3c89aa,_0x4728f9){_0x3c89aa=_0x3c89aa-0x0;var _0x3391c9=_0xf822[_0x3c89aa];return _0x3391c9;};'use strict';var client=require(_0x2f82('0x0'));exports['update']=function(_0xef5887,_0x2e79de){return client[_0x2f82('0x1')](_0x2f82('0x2'),{'body':_0x2e79de,'options':{'where':{'id':_0xef5887}},'log':_0x2f82('0x3')});};exports[_0x2f82('0x4')]=function(_0x48a05c,_0x12e2d7){return client[_0x2f82('0x1')](_0x2f82('0x5'),{'body':_0x12e2d7,'options':{'where':{'id':_0x48a05c}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index eb173a6..2f7d47c 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 _0x3266=['create','createSmsMessage','../client'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x3266,0x149));var _0x6326=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0x3266[_0x38b14f];return _0x22a324;};'use strict';var client=require(_0x6326('0x0'));exports[_0x6326('0x1')]=function(_0x59e963){return client['Request']('CreateSmsMessage',{'body':_0x59e963,'log':_0x6326('0x2')});}; \ No newline at end of file +var _0x3b09=['createSmsMessage','create','Request'];(function(_0x50a88e,_0x121931){var _0x4dd282=function(_0x4c3c39){while(--_0x4c3c39){_0x50a88e['push'](_0x50a88e['shift']());}};_0x4dd282(++_0x121931);}(_0x3b09,0x1c6));var _0x93b0=function(_0x514e38,_0x18958d){_0x514e38=_0x514e38-0x0;var _0x57305d=_0x3b09[_0x514e38];return _0x57305d;};'use strict';var client=require('../client');exports[_0x93b0('0x0')]=function(_0x5cd5a7){return client[_0x93b0('0x1')]('CreateSmsMessage',{'body':_0x5cd5a7,'log':_0x93b0('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 0855e68..0c12ab5 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x533292,_0x2ed192){var _0x5be567=function(_0x3bc528){while(--_0x3bc528){_0x533292['push'](_0x533292['shift']());}};_0x5be567(++_0x2ed192);}(_0xe706,0xa3));var _0x6e70=function(_0x2d6f29,_0x2f6366){_0x2d6f29=_0x2d6f29-0x0;var _0x291f5a=_0xe706[_0x2d6f29];return _0x291f5a;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x98686d,_0x16a78e){var _0x3b64b2=function(_0x343a9f){while(--_0x343a9f){_0x98686d['push'](_0x98686d['shift']());}};_0x3b64b2(++_0x16a78e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 3da7a5f..aac5fce 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 _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x515e9f,_0xff9586){var _0x19cbf0=function(_0xa2ae5c){while(--_0xa2ae5c){_0x515e9f['push'](_0x515e9f['shift']());}};_0x19cbf0(++_0xff9586);}(_0x008c,0x188));var _0xc008=function(_0x3a36e4,_0x420a62){_0x3a36e4=_0x3a36e4-0x0;var _0x3e3628=_0x008c[_0x3a36e4];return _0x3e3628;};'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 +var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x5ecef8,_0x227d5c){var _0x30bce1=function(_0x3ec0fb){while(--_0x3ec0fb){_0x5ecef8['push'](_0x5ecef8['shift']());}};_0x30bce1(++_0x227d5c);}(_0x70e0,0x17b));var _0x070e=function(_0x55b708,_0x24d3e8){_0x55b708=_0x55b708-0x0;var _0x18b761=_0x70e0[_0x55b708];return _0x18b761;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index b2ac15d..a4ab531 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(_0x7e40ca,_0x49e471){var _0x42c41e=function(_0x14c4d5){while(--_0x14c4d5){_0x7e40ca['push'](_0x7e40ca['shift']());}};_0x42c41e(++_0x49e471);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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(_0x18c958,_0x5544b9){var _0x285972=function(_0x195848){while(--_0x195848){_0x18c958['push'](_0x18c958['shift']());}};_0x285972(++_0x5544b9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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 1c480b8..7ec5d71 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 _0x2aa3=['update','updateWhatsappInteraction','addTags','Request','AddTagsToWhatsappInteraction','../client'];(function(_0x2389bc,_0x167cd2){var _0x170548=function(_0x2da7f2){while(--_0x2da7f2){_0x2389bc['push'](_0x2389bc['shift']());}};_0x170548(++_0x167cd2);}(_0x2aa3,0x83));var _0x32aa=function(_0x44e795,_0x317e9){_0x44e795=_0x44e795-0x0;var _0x517e5d=_0x2aa3[_0x44e795];return _0x517e5d;};'use strict';var client=require(_0x32aa('0x0'));exports[_0x32aa('0x1')]=function(_0x107517,_0x2ef91b){return client['Request']('UpdateWhatsappInteraction',{'body':_0x2ef91b,'options':{'where':{'id':_0x107517}},'log':_0x32aa('0x2')});};exports[_0x32aa('0x3')]=function(_0x13843c,_0x33612d){return client[_0x32aa('0x4')](_0x32aa('0x5'),{'body':_0x33612d,'options':{'where':{'id':_0x13843c}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x2f74=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','../client','Request'];(function(_0x1644f2,_0x2884e8){var _0x1fcb31=function(_0x41773c){while(--_0x41773c){_0x1644f2['push'](_0x1644f2['shift']());}};_0x1fcb31(++_0x2884e8);}(_0x2f74,0x7b));var _0x42f7=function(_0x727f82,_0x29531d){_0x727f82=_0x727f82-0x0;var _0x324e51=_0x2f74[_0x727f82];return _0x324e51;};'use strict';var client=require(_0x42f7('0x0'));exports['update']=function(_0x216970,_0x32d116){return client[_0x42f7('0x1')](_0x42f7('0x2'),{'body':_0x32d116,'options':{'where':{'id':_0x216970}},'log':_0x42f7('0x3')});};exports[_0x42f7('0x4')]=function(_0x43a650,_0x16d639){return client['Request']('AddTagsToWhatsappInteraction',{'body':_0x16d639,'options':{'where':{'id':_0x43a650}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 1c53024..181c699 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 _0xaafd=['createWhatsappMessage','../client','create','CreateWhatsappMessage'];(function(_0x1e1ca9,_0x12e36a){var _0x57bca3=function(_0x3974d0){while(--_0x3974d0){_0x1e1ca9['push'](_0x1e1ca9['shift']());}};_0x57bca3(++_0x12e36a);}(_0xaafd,0xdd));var _0xdaaf=function(_0x5d2ed9,_0x16c436){_0x5d2ed9=_0x5d2ed9-0x0;var _0x4262c5=_0xaafd[_0x5d2ed9];return _0x4262c5;};'use strict';var client=require(_0xdaaf('0x0'));exports[_0xdaaf('0x1')]=function(_0x40dc4a){return client['Request'](_0xdaaf('0x2'),{'body':_0x40dc4a,'log':_0xdaaf('0x3')});}; \ No newline at end of file +var _0x7a72=['CreateWhatsappMessage','../client','create'];(function(_0x2e0469,_0x2ba42d){var _0x41481b=function(_0x3f5ba3){while(--_0x3f5ba3){_0x2e0469['push'](_0x2e0469['shift']());}};_0x41481b(++_0x2ba42d);}(_0x7a72,0xf7));var _0x27a7=function(_0x9ed843,_0xffb369){_0x9ed843=_0x9ed843-0x0;var _0x3089ad=_0x7a72[_0x9ed843];return _0x3089ad;};'use strict';var client=require(_0x27a7('0x0'));exports[_0x27a7('0x1')]=function(_0x56bfc3){return client['Request'](_0x27a7('0x2'),{'body':_0x56bfc3,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index b6a0f3d..5fde2c5 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 _0x1552=['whatsappPause','getWhatsappQueues','../client','GetWhatsappQueue','name','timeout','strategy','Agents','online'];(function(_0x4d29ac,_0x2c284d){var _0x33a365=function(_0xc7f451){while(--_0xc7f451){_0x4d29ac['push'](_0x4d29ac['shift']());}};_0x33a365(++_0x2c284d);}(_0x1552,0xd1));var _0x2155=function(_0xf4050f,_0xefc6bb){_0xf4050f=_0xf4050f-0x0;var _0x42baab=_0x1552[_0xf4050f];return _0x42baab;};'use strict';var client=require(_0x2155('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0x2155('0x1'),{'options':{'raw':![],'attributes':['id',_0x2155('0x2'),_0x2155('0x3'),_0x2155('0x4')],'include':[{'model':'User','as':_0x2155('0x5'),'attributes':['id',_0x2155('0x2'),_0x2155('0x6'),_0x2155('0x7')]}]},'log':_0x2155('0x8')});};}; \ No newline at end of file +var _0x91ff=['GetWhatsappQueue','name','User','Agents','online','whatsappPause','getWhatsappQueues','Request'];(function(_0x11db48,_0x362f0e){var _0x20d3e9=function(_0x595d81){while(--_0x595d81){_0x11db48['push'](_0x11db48['shift']());}};_0x20d3e9(++_0x362f0e);}(_0x91ff,0xde));var _0xf91f=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x91ff[_0x297fd3];return _0x2af381;};'use strict';var client=require('../client');exports[_0xf91f('0x0')]=function(){return function(){return client[_0xf91f('0x1')](_0xf91f('0x2'),{'options':{'raw':![],'attributes':['id',_0xf91f('0x3'),'timeout','strategy'],'include':[{'model':_0xf91f('0x4'),'as':_0xf91f('0x5'),'attributes':['id',_0xf91f('0x3'),_0xf91f('0x6'),_0xf91f('0x7')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 1f6e580..f80e70f 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 _0xabf8=['Request','CreateWhatsappQueueReport','DESC','UpdateWhatsappQueueReport','../client'];(function(_0x3a8f51,_0x1c5221){var _0x2b83dc=function(_0x10e195){while(--_0x10e195){_0x3a8f51['push'](_0x3a8f51['shift']());}};_0x2b83dc(++_0x1c5221);}(_0xabf8,0x13a));var _0x8abf=function(_0x230b6d,_0x37fe38){_0x230b6d=_0x230b6d-0x0;var _0x147d3c=_0xabf8[_0x230b6d];return _0x147d3c;};'use strict';var client=require(_0x8abf('0x0'));exports['create']=function(_0x3c777c){return client[_0x8abf('0x1')](_0x8abf('0x2'),{'body':_0x3c777c,'log':_0x8abf('0x2')});};exports['update']=function(_0x1a4914,_0xc2151e){return client['Request']('UpdateWhatsappQueueReport',{'body':_0xc2151e,'options':{'where':{'uniqueid':_0x1a4914},'order':[['id',_0x8abf('0x3')]],'limit':0x1},'log':_0x8abf('0x4')});}; \ No newline at end of file +var _0xf34b=['create','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf34b,0x1c7));var _0xbf34=function(_0x32ff10,_0x32b30e){_0x32ff10=_0x32ff10-0x0;var _0x5ced53=_0xf34b[_0x32ff10];return _0x5ced53;};'use strict';var client=require(_0xbf34('0x0'));exports[_0xbf34('0x1')]=function(_0x4273ed){return client['Request'](_0xbf34('0x2'),{'body':_0x4273ed,'log':_0xbf34('0x2')});};exports[_0xbf34('0x3')]=function(_0x385f8e,_0xe803b9){return client['Request'](_0xbf34('0x4'),{'body':_0xe803b9,'options':{'where':{'uniqueid':_0x385f8e},'order':[['id',_0xbf34('0x5')]],'limit':0x1},'log':_0xbf34('0x4')});}; \ 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 b02906d..2085ddc 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 _0x7730=['START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','[%s][AGENT]\x20ROUTING\x20END','close','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','validate','util','seq-queue','routing','string','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','error','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','createQueue','channel'];(function(_0x2d4813,_0x1eb6f4){var _0x5ec674=function(_0x4ea51d){while(--_0x4ea51d){_0x2d4813['push'](_0x2d4813['shift']());}};_0x5ec674(++_0x1eb6f4);}(_0x7730,0x1e8));var _0x0773=function(_0x476c7,_0x298ee0){_0x476c7=_0x476c7-0x0;var _0x47ae56=_0x7730[_0x476c7];return _0x47ae56;};'use strict';var schema=require(_0x0773('0x0'));var _=require('lodash');var util=require(_0x0773('0x1'));var seqqueue=require(_0x0773('0x2'));var logger=require('../../../../config/logger')(_0x0773('0x3'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x0773('0x4'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x0773('0x5')}});function writeLog(_0x543bbe,_0x48e207,_0x43117b){return logger[_0x0773('0x6')](util[_0x0773('0x7')](_0x0773('0x8'),_0x543bbe,_0x48e207[_0x0773('0x9')],_0x43117b));}function handleFindAgent(_0x4a5670){return function(_0x1ed58c){return _0x1ed58c[_0x0773('0x9')]['toLowerCase']()===_0x4a5670[_0x0773('0xa')]();};}exports['consequence']=function(_0x4830ee,_0x1b694b,_0x23ec62,_0x332445){return function(_0x42d340){try{var _0x22092e={'name':_0x1b694b[0x0],'timeout':_0x1b694b[0x1]};var _0x247cbb=queue[_0x0773('0x0')](_0x22092e,{'typecast':!![]});if(_0x247cbb['length']){logger[_0x0773('0xb')](_0x0773('0xc'),_0x4830ee,_[_0x0773('0xd')](_0x247cbb,_0x0773('0xe'))[_0x0773('0xf')](',\x20'));_0x42d340[_0x0773('0x10')]();}else{var _0x1b7d37=_[_0x0773('0x11')](_0x23ec62[_0x0773('0x12')],handleFindAgent(_0x22092e[_0x0773('0x9')]));if(_0x1b7d37){var _0xb8199c=(_0x22092e[_0x0773('0x13')]||0xa)*0x3e8;var _0x3ed85e,_0x5e7ff9;var _0x52784a=seqqueue[_0x0773('0x14')](_0xb8199c);_0x52784a['id']=_0x4830ee;_0x52784a['atimeout']=_0xb8199c;_0x52784a[_0x0773('0x15')]=_0x332445[_0x0773('0x15')];writeLog(_0x4830ee,_0x1b7d37,util[_0x0773('0x7')](_0x0773('0x16'),_0xb8199c));_0x23ec62[_0x0773('0x17')][_0x4830ee]['on'](_0x0773('0x18'),function(){logger[_0x0773('0x6')](_0x0773('0x19'),_0x4830ee);clearTimeout(_0x5e7ff9);_0x5e7ff9=undefined;_0x52784a['close']();if(_0x23ec62[_0x0773('0x17')][_0x4830ee]){delete _0x23ec62[_0x0773('0x17')][_0x4830ee];}_0x42d340[_0x0773('0x10')]();});_0x23ec62[_0x0773('0x17')][_0x4830ee]['on']('complete',function(){if(_0x23ec62[_0x0773('0x17')][_0x4830ee]){delete _0x23ec62['rules'][_0x4830ee];}});_0x5e7ff9=setTimeout(function(){logger[_0x0773('0x6')](_0x0773('0x1a'),_0x4830ee);clearTimeout(_0x5e7ff9);_0x52784a[_0x0773('0x1b')]();_0x42d340['next']();},_0xb8199c);strategy[_0x0773('0x1c')](_0x52784a,_0x1b7d37,_0x23ec62,_0x332445);}else{logger[_0x0773('0xb')](_0x0773('0x1d'),_0x4830ee,_0x22092e[_0x0773('0x9')]);_0x42d340['stop']();}}}catch(_0xd01b02){console['log'](_0xd01b02);logger[_0x0773('0xb')]('[%s][QUEUE]\x20%s',_0x4830ee,_0xd01b02['stack']);_0x42d340[_0x0773('0x10')]();}};}; \ No newline at end of file +var _0x6149=['routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','name','consequence','length','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','createQueue','atimeout','channel','format','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','log','[%s][QUEUE]\x20%s','stack','validate','lodash','seq-queue'];(function(_0xfb94f,_0x31b129){var _0x51b33a=function(_0x5c5337){while(--_0x5c5337){_0xfb94f['push'](_0xfb94f['shift']());}};_0x51b33a(++_0x31b129);}(_0x6149,0x1b9));var _0x9614=function(_0xa6f6a6,_0x138b7a){_0xa6f6a6=_0xa6f6a6-0x0;var _0x71a78a=_0x6149[_0xa6f6a6];return _0x71a78a;};'use strict';var schema=require(_0x9614('0x0'));var _=require(_0x9614('0x1'));var util=require('util');var seqqueue=require(_0x9614('0x2'));var logger=require('../../../../config/logger')(_0x9614('0x3'));var strategy=require(_0x9614('0x4'));var queue=schema({'name':{'type':_0x9614('0x5'),'required':!![],'message':_0x9614('0x6')},'timeout':{'type':_0x9614('0x7'),'message':_0x9614('0x8')}});function writeLog(_0xd2bdd3,_0x1b0e81,_0x28f12a){return logger[_0x9614('0x9')](util['format']('[%s][AGENT][NAME:%s][STATUS:%s]',_0xd2bdd3,_0x1b0e81['name'],_0x28f12a));}function handleFindAgent(_0x411067){return function(_0x2333e1){return _0x2333e1[_0x9614('0xa')]['toLowerCase']()===_0x411067['toLowerCase']();};}exports[_0x9614('0xb')]=function(_0x385e18,_0x58d4ac,_0x330c97,_0x1429fa){return function(_0x11a5d5){try{var _0x2e2315={'name':_0x58d4ac[0x0],'timeout':_0x58d4ac[0x1]};var _0xeff012=queue[_0x9614('0x0')](_0x2e2315,{'typecast':!![]});if(_0xeff012[_0x9614('0xc')]){logger['error'](_0x9614('0xd'),_0x385e18,_[_0x9614('0xe')](_0xeff012,_0x9614('0xf'))[_0x9614('0x10')](',\x20'));_0x11a5d5[_0x9614('0x11')]();}else{var _0x1070af=_[_0x9614('0x12')](_0x330c97[_0x9614('0x13')],handleFindAgent(_0x2e2315['name']));if(_0x1070af){var _0x11dcff=(_0x2e2315[_0x9614('0x14')]||0xa)*0x3e8;var _0x2ebb3c,_0x4be8ba;var _0x57a65d=seqqueue[_0x9614('0x15')](_0x11dcff);_0x57a65d['id']=_0x385e18;_0x57a65d[_0x9614('0x16')]=_0x11dcff;_0x57a65d[_0x9614('0x17')]=_0x1429fa[_0x9614('0x17')];writeLog(_0x385e18,_0x1070af,util[_0x9614('0x18')](_0x9614('0x19'),_0x11dcff));_0x330c97[_0x9614('0x1a')][_0x385e18]['on'](_0x9614('0x1b'),function(){logger['info'](_0x9614('0x1c'),_0x385e18);clearTimeout(_0x4be8ba);_0x4be8ba=undefined;_0x57a65d[_0x9614('0x1d')]();if(_0x330c97[_0x9614('0x1a')][_0x385e18]){delete _0x330c97[_0x9614('0x1a')][_0x385e18];}_0x11a5d5['stop']();});_0x330c97[_0x9614('0x1a')][_0x385e18]['on'](_0x9614('0x1e'),function(){if(_0x330c97[_0x9614('0x1a')][_0x385e18]){delete _0x330c97[_0x9614('0x1a')][_0x385e18];}});_0x4be8ba=setTimeout(function(){logger[_0x9614('0x9')](_0x9614('0x1f'),_0x385e18);clearTimeout(_0x4be8ba);_0x57a65d[_0x9614('0x1d')]();_0x11a5d5[_0x9614('0x20')]();},_0x11dcff);strategy[_0x9614('0x21')](_0x57a65d,_0x1070af,_0x330c97,_0x1429fa);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x385e18,_0x2e2315[_0x9614('0xa')]);_0x11a5d5[_0x9614('0x11')]();}}}catch(_0x47d098){console[_0x9614('0x22')](_0x47d098);logger['error'](_0x9614('0x23'),_0x385e18,_0x47d098[_0x9614('0x24')]);_0x11a5d5[_0x9614('0x11')]();}};}; \ 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 7eb57c8..cff53dd 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 _0xf4ca=['UserId','info','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','getMustacheRender','create','[%s][AMAZONLEX]\x20%s','catch','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','body','toString','amazonlex','providerResponse','Message','then','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction'];(function(_0x263908,_0x134d8f){var _0x2bed68=function(_0x103ec8){while(--_0x103ec8){_0x263908['push'](_0x263908['shift']());}};_0x2bed68(++_0x134d8f);}(_0xf4ca,0x174));var _0xaf4c=function(_0x590870,_0x49d834){_0x590870=_0x590870-0x0;var _0x16b06e=_0xf4ca[_0x590870];return _0x16b06e;};'use strict';var _=require(_0xaf4c('0x0'));var moment=require(_0xaf4c('0x1'));var AWS=require(_0xaf4c('0x2'));var utils=require(_0xaf4c('0x3'));var logger=require(_0xaf4c('0x4'))(_0xaf4c('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xaf4c('0x6')),'smsMessage':require(_0xaf4c('0x7')),'faxMessage':require(_0xaf4c('0x8')),'whatsappMessage':require(_0xaf4c('0x9'))};exports['consequence']=function(_0x26eb87,_0x5f71ad){return function(_0x4824e1){try{if(!_[_0xaf4c('0xa')](this[_0xaf4c('0xb')][_0xaf4c('0xc')])){logger[_0xaf4c('0xd')]('[%s][AMAZONLEX]\x20%s',_0x26eb87,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x4824e1[_0xaf4c('0xe')]();}var _0x278aed={'ContactId':this[_0xaf4c('0xf')]['id'],'sentAt':moment()[_0xaf4c('0x10')](_0xaf4c('0x11')),'direction':_0xaf4c('0x12')};if(this[_0xaf4c('0x13')]===_0xaf4c('0x14')||this[_0xaf4c('0x13')]===_0xaf4c('0x15')){_0x278aed[_0xaf4c('0x16')]=this[_0xaf4c('0xb')][_0xaf4c('0x16')];}var _0x7209d5=this[_0xaf4c('0x13')];if(_0x7209d5===_0xaf4c('0x17')){_0x278aed[_0xaf4c('0x18')]=this['account']['id'];}else{_0x278aed[_[_0xaf4c('0x19')](_0x7209d5)+_0xaf4c('0x1a')]=this[_0xaf4c('0x1b')]['id'];}_0x278aed[_[_0xaf4c('0x19')](_0x7209d5)+_0xaf4c('0x1c')]=this[_0xaf4c('0xb')]['id'];if(this[_0xaf4c('0xb')][_0xaf4c('0x1d')]){var _0x2dc44d=_0x5f71ad[0x4];if(!_['isEmpty'](_0x2dc44d)){_0x278aed['body']=utils[_0xaf4c('0x1e')](_0x2dc44d,this);return rpc[_0x7209d5+'Message'][_0xaf4c('0x1f')](_0x278aed)['then'](function(_0xf490c4){logger[_0xaf4c('0xd')](_0xaf4c('0x20'),_0x26eb87,_0x278aed['body']);})[_0xaf4c('0x21')](function(_0x1a82a9){logger[_0xaf4c('0x22')](_0xaf4c('0x20'),_0x26eb87,JSON[_0xaf4c('0x23')](_0x1a82a9));})['finally'](function(){logger[_0xaf4c('0xd')](_0xaf4c('0x24'),_0x26eb87);_0x4824e1[_0xaf4c('0x25')]();});}else{logger['info'](_0xaf4c('0x26'),_0x26eb87);_0x4824e1[_0xaf4c('0x25')]();}}else{var _0x1ecfad=this;var _0x3970a5=new AWS[(_0xaf4c('0x27'))]({'accessKeyId':_0x5f71ad[0x0],'secretAccessKey':_0x5f71ad[0x1],'region':_0x5f71ad[0x2]});var _0x2e4c08={'botAlias':'$LATEST','botName':_0x5f71ad[0x3],'inputText':this[_0xaf4c('0x28')][_0xaf4c('0x29')],'userId':this['channel']+':'+this['interaction']['id'][_0xaf4c('0x2a')]()};_0x3970a5['postText'](_0x2e4c08,function(_0x59d517,_0x49d8e5){if(_0x59d517){logger[_0xaf4c('0x22')](_0xaf4c('0x20'),_0x26eb87,_0x59d517[_0xaf4c('0x28')]);_0x4824e1[_0xaf4c('0xe')]();}else if(_0x49d8e5&&_0x49d8e5[_0xaf4c('0x28')]){_0x1ecfad['body'][_0xaf4c('0x2b')]=_0x49d8e5;_0x278aed[_0xaf4c('0x29')]=_0x49d8e5[_0xaf4c('0x28')];_0x278aed['providerName']=_0xaf4c('0x2b');_0x278aed[_0xaf4c('0x2c')]=JSON[_0xaf4c('0x23')](_0x49d8e5);return rpc[_0x7209d5+_0xaf4c('0x2d')]['create'](_0x278aed)[_0xaf4c('0x2e')](function(_0xd04324){logger['info'](_0xaf4c('0x20'),_0x26eb87,_0x278aed[_0xaf4c('0x29')]);if(_0x49d8e5['dialogState']==_0xaf4c('0x2f')){_0x4824e1[_0xaf4c('0xe')]();}else{_0x4824e1[_0xaf4c('0x25')]();}})[_0xaf4c('0x21')](function(_0x4095cc){logger['error'](_0xaf4c('0x20'),_0x26eb87,JSON[_0xaf4c('0x23')](_0x4095cc));_0x4824e1[_0xaf4c('0xe')]();});}else{_0x4824e1[_0xaf4c('0xe')]();}});}}catch(_0x4fafdd){logger['error'](_0xaf4c('0x20'),_0x26eb87,JSON[_0xaf4c('0x23')](_0x4fafdd));_0x4824e1['stop']();}};}; \ No newline at end of file +var _0x4585=['create','then','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','message','body','toString','postText','error','amazonlex','providerResponse','dialogState','catch','moment','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','info','[%s][AMAZONLEX]\x20%s','next','sms','channel','whatsapp','interaction','phone','chat','ChatWebsiteId','upperFirst','AccountId','InteractionId','created','isEmpty','Message'];(function(_0x3e40e0,_0x4a3332){var _0x3816d1=function(_0x5e388d){while(--_0x5e388d){_0x3e40e0['push'](_0x3e40e0['shift']());}};_0x3816d1(++_0x4a3332);}(_0x4585,0x95));var _0x5458=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0x4585[_0x3305de];return _0x3b5a84;};'use strict';var _=require('lodash');var moment=require(_0x5458('0x0'));var AWS=require(_0x5458('0x1'));var utils=require('./utils');var logger=require(_0x5458('0x2'))(_0x5458('0x3'));var rpc={'chatMessage':require(_0x5458('0x4')),'openchannelMessage':require(_0x5458('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x5458('0x6')),'faxMessage':require(_0x5458('0x7')),'whatsappMessage':require(_0x5458('0x8'))};exports[_0x5458('0x9')]=function(_0x1011cc,_0x1a7896){return function(_0x35997b){try{if(!_[_0x5458('0xa')](this['interaction']['UserId'])){logger[_0x5458('0xb')](_0x5458('0xc'),_0x1011cc,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x35997b[_0x5458('0xd')]();}var _0x5c5b0f={'ContactId':this['contact']['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this['channel']===_0x5458('0xe')||this[_0x5458('0xf')]===_0x5458('0x10')){_0x5c5b0f['phone']=this[_0x5458('0x11')][_0x5458('0x12')];}var _0x4a5945=this[_0x5458('0xf')];if(_0x4a5945===_0x5458('0x13')){_0x5c5b0f[_0x5458('0x14')]=this['account']['id'];}else{_0x5c5b0f[_[_0x5458('0x15')](_0x4a5945)+_0x5458('0x16')]=this['account']['id'];}_0x5c5b0f[_['upperFirst'](_0x4a5945)+_0x5458('0x17')]=this[_0x5458('0x11')]['id'];if(this['interaction'][_0x5458('0x18')]){var _0x5103ea=_0x1a7896[0x4];if(!_[_0x5458('0x19')](_0x5103ea)){_0x5c5b0f['body']=utils['getMustacheRender'](_0x5103ea,this);return rpc[_0x4a5945+_0x5458('0x1a')][_0x5458('0x1b')](_0x5c5b0f)[_0x5458('0x1c')](function(_0xcda95){logger[_0x5458('0xb')]('[%s][AMAZONLEX]\x20%s',_0x1011cc,_0x5c5b0f['body']);})['catch'](function(_0x2331b0){logger['error'](_0x5458('0xc'),_0x1011cc,JSON[_0x5458('0x1d')](_0x2331b0));})[_0x5458('0x1e')](function(){logger['info'](_0x5458('0x1f'),_0x1011cc);_0x35997b['stop']();});}else{logger[_0x5458('0xb')](_0x5458('0x20'),_0x1011cc);_0x35997b[_0x5458('0x21')]();}}else{var _0x1ca072=this;var _0x22b9da=new AWS[(_0x5458('0x22'))]({'accessKeyId':_0x1a7896[0x0],'secretAccessKey':_0x1a7896[0x1],'region':_0x1a7896[0x2]});var _0x3714f8={'botAlias':'$LATEST','botName':_0x1a7896[0x3],'inputText':this[_0x5458('0x23')][_0x5458('0x24')],'userId':this[_0x5458('0xf')]+':'+this['interaction']['id'][_0x5458('0x25')]()};_0x22b9da[_0x5458('0x26')](_0x3714f8,function(_0x555a30,_0x1be211){if(_0x555a30){logger[_0x5458('0x27')](_0x5458('0xc'),_0x1011cc,_0x555a30[_0x5458('0x23')]);_0x35997b[_0x5458('0xd')]();}else if(_0x1be211&&_0x1be211[_0x5458('0x23')]){_0x1ca072[_0x5458('0x24')]['amazonlex']=_0x1be211;_0x5c5b0f[_0x5458('0x24')]=_0x1be211[_0x5458('0x23')];_0x5c5b0f['providerName']=_0x5458('0x28');_0x5c5b0f[_0x5458('0x29')]=JSON[_0x5458('0x1d')](_0x1be211);return rpc[_0x4a5945+_0x5458('0x1a')][_0x5458('0x1b')](_0x5c5b0f)[_0x5458('0x1c')](function(_0x573a66){logger[_0x5458('0xb')](_0x5458('0xc'),_0x1011cc,_0x5c5b0f[_0x5458('0x24')]);if(_0x1be211[_0x5458('0x2a')]=='Failed'){_0x35997b['next']();}else{_0x35997b[_0x5458('0x21')]();}})[_0x5458('0x2b')](function(_0x5a0381){logger['error']('[%s][AMAZONLEX]\x20%s',_0x1011cc,JSON[_0x5458('0x1d')](_0x5a0381));_0x35997b['next']();});}else{_0x35997b['next']();}});}}catch(_0x3db36b){logger[_0x5458('0x27')]('[%s][AMAZONLEX]\x20%s',_0x1011cc,JSON[_0x5458('0x1d')](_0x3db36b));_0x35997b[_0x5458('0x21')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 03a75dd..267da1a 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 _0xedf3=['interaction','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','body','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','Smtp','service','host','port','secure','authentication','auth','user','pass','inReplyTo','html','','','headers','auto-replied','All','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','autoreplyExecuted','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','resolve','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','mail','isAutoreply','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xedf3,0x127));var _0x3edf=function(_0x2e986d,_0x4b6b63){_0x2e986d=_0x2e986d-0x0;var _0x351c79=_0xedf3[_0x2e986d];return _0x351c79;};'use strict';var _=require(_0x3edf('0x0'));var moment=require(_0x3edf('0x1'));var utils=require(_0x3edf('0x2'));var logger=require(_0x3edf('0x3'))(_0x3edf('0x4'));var rpc={'chatMessage':require(_0x3edf('0x5')),'openchannelMessage':require(_0x3edf('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x3edf('0x7')),'faxMessage':require(_0x3edf('0x8')),'whatsappMessage':require(_0x3edf('0x9')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x3edf('0xa')),'mailInteraction':require(_0x3edf('0xb')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x3edf('0xc'))};var mailRpc=require(_0x3edf('0xd'));exports[_0x3edf('0xe')]=function(_0x2a74be,_0xb75f06,_0x30a832,_0x369bb9){return function(_0x2a7d33){try{var _0x25e7ce=this['channel'];if(_0x25e7ce===_0x3edf('0xf')&&_0x369bb9['body'][_0x3edf('0x10')]){logger[_0x3edf('0x11')]('[%s][AUTOREPLY]\x20%s',_0x2a74be,_0x3edf('0x12'));return _0x2a7d33[_0x3edf('0x13')]();}if(_0xb75f06[0x0]==='1'&&(_[_0x3edf('0x14')](this[_0x3edf('0x15')][_0x3edf('0x16')])||!this[_0x3edf('0x15')][_0x3edf('0x16')])){logger[_0x3edf('0x11')](_0x3edf('0x17'),_0x2a74be,_0x3edf('0x18'));return _0x2a7d33[_0x3edf('0x13')]();}if(_0xb75f06[0x0]==='2'&&this[_0x3edf('0x15')]['autoreplyExecuted']){logger['info'](_0x3edf('0x19'),_0x2a74be,_0x3edf('0x1a'));return _0x2a7d33[_0x3edf('0x13')]();}var _0x4d81a0={'ContactId':this['contact']['id'],'sentAt':moment()[_0x3edf('0x1b')](_0x3edf('0x1c')),'direction':_0x3edf('0x1d')};if(this[_0x3edf('0x1e')]===_0x3edf('0xf')){_0x4d81a0[_0x3edf('0x1f')]=utils[_0x3edf('0x20')](_0xb75f06[0x2],this);}else{_0x4d81a0[_0x3edf('0x1f')]=utils[_0x3edf('0x20')](_0xb75f06[0x1],this);}if(this['message']){_0x4d81a0['to']=this[_0x3edf('0x21')][_0x3edf('0x22')]||'';if(this[_0x3edf('0x1e')]==='mail'&&_0xb75f06[0x1]==='1'){_0x4d81a0['cc']=this['message']['cc']||'';}_0x4d81a0['from']=this[_0x3edf('0x21')]['to']||'';_0x4d81a0[_0x3edf('0x23')]=this[_0x3edf('0x21')][_0x3edf('0x23')]||'';_0x4d81a0[_0x3edf('0x24')]=!![];if(this[_0x3edf('0x21')][_0x3edf('0x25')]){_0x4d81a0[_0x3edf('0x25')]='';_0x4d81a0[_0x3edf('0x25')]+=_[_0x3edf('0x26')](this[_0x3edf('0x21')][_0x3edf('0x25')],_0x3edf('0x27'))?'':_0x3edf('0x28');_0x4d81a0[_0x3edf('0x25')]+=this[_0x3edf('0x21')][_0x3edf('0x25')];}}if(this[_0x3edf('0x1e')]===_0x3edf('0x29')){_0x4d81a0[_0x3edf('0x2a')]=this[_0x3edf('0x2b')]['id'];}else{_0x4d81a0[_['upperFirst'](this[_0x3edf('0x1e')])+'AccountId']=this[_0x3edf('0x2b')]['id'];}_0x4d81a0[_[_0x3edf('0x2c')](this[_0x3edf('0x1e')])+'InteractionId']=this[_0x3edf('0x15')]['id'];var _0xa7d46c=this[_0x3edf('0x15')];if(rpc[this[_0x3edf('0x1e')]+'Message']){if(this[_0x3edf('0x1e')]==='mail'){var _0x39ed61={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0x3edf('0x2d')][_0x3edf('0x2e')]){_0x39ed61['service']=this[_0x3edf('0x2b')][_0x3edf('0x2d')][_0x3edf('0x2e')];}else{_0x39ed61[_0x3edf('0x2f')]=this[_0x3edf('0x2b')][_0x3edf('0x2d')]['host'];_0x39ed61[_0x3edf('0x30')]=this['account'][_0x3edf('0x2d')][_0x3edf('0x30')];_0x39ed61[_0x3edf('0x31')]=this[_0x3edf('0x2b')]['Smtp']['secure'];}if(this['account'][_0x3edf('0x2d')][_0x3edf('0x32')]){_0x39ed61[_0x3edf('0x33')]={'user':this['account'][_0x3edf('0x2d')][_0x3edf('0x34')],'pass':this['account']['Smtp'][_0x3edf('0x35')]};}_0x4d81a0[_0x3edf('0x36')]=this[_0x3edf('0x21')]['messageId'];_0x4d81a0[_0x3edf('0x37')]=_0x3edf('0x38')+_['replace'](_0x4d81a0[_0x3edf('0x1f')],_0x3edf('0x39'),_0x3edf('0x3a'))+_0x3edf('0x3b');_0x4d81a0[_0x3edf('0x3c')]={'Auto-Submitted':_0x3edf('0x3d'),'X-Auto-Response-Suppress':_0x3edf('0x3e'),'Precedence':_0x3edf('0x3f')};return mailRpc[_0x3edf('0x40')](_0x39ed61,_0x4d81a0)[_0x3edf('0x41')](function(_0x710411){logger[_0x3edf('0x11')](_0x3edf('0x42'),_0x2a74be);_0x4d81a0[_0x3edf('0x43')]=_0x710411[_0x3edf('0x21')][_0x3edf('0x43')];return rpc[_0x25e7ce+'Message'][_0x3edf('0x44')](_0x4d81a0);})['then'](function(_0x3987df){logger[_0x3edf('0x11')]('[%s][AUTOREPLY]\x20%s',_0x2a74be,JSON[_0x3edf('0x45')](_0x3987df));})[_0x3edf('0x46')](function(_0x5b4c17){logger[_0x3edf('0x47')](_0x3edf('0x48'),_0x2a74be,JSON[_0x3edf('0x45')](_0x5b4c17));})[_0x3edf('0x49')](function(){Promise['resolve']()[_0x3edf('0x41')](function(){if(_0xb75f06[0x0]!=='2'||_0xa7d46c[_0x3edf('0x4a')])return;return rpc[_0x25e7ce+_0x3edf('0x4b')][_0x3edf('0x4c')](_0xa7d46c['id'],{'autoreplyExecuted':!![]})[_0x3edf('0x41')](function(_0xd21c99){logger[_0x3edf('0x11')](_0x3edf('0x19'),_0x2a74be,JSON[_0x3edf('0x45')](_0xd21c99));})['catch'](function(_0x1afd5d){logger[_0x3edf('0x47')](_0x3edf('0x4d'),_0x2a74be,JSON[_0x3edf('0x45')](_0x1afd5d));});})['then'](function(){_0x2a7d33[_0x3edf('0x13')]();});});}else{return rpc[this[_0x3edf('0x1e')]+'Message']['create'](_0x4d81a0)['then'](function(_0x3c9a8c){logger['info'](_0x3edf('0x17'),_0x2a74be,_0x4d81a0[_0x3edf('0x1f')]);})[_0x3edf('0x46')](function(_0x35723d){logger[_0x3edf('0x47')](_0x3edf('0x17'),_0x2a74be,JSON[_0x3edf('0x45')](_0x35723d));})['finally'](function(){Promise[_0x3edf('0x4e')]()[_0x3edf('0x41')](function(){if(_0xb75f06[0x0]!=='2'||_0xa7d46c[_0x3edf('0x4a')])return;return rpc[_0x25e7ce+_0x3edf('0x4b')][_0x3edf('0x4c')](_0xa7d46c['id'],{'autoreplyExecuted':!![]})[_0x3edf('0x41')](function(_0x371531){logger[_0x3edf('0x11')](_0x3edf('0x19'),_0x2a74be,JSON[_0x3edf('0x45')](_0x371531));})[_0x3edf('0x46')](function(_0xabc9ef){logger[_0x3edf('0x47')](_0x3edf('0x4d'),_0x2a74be,JSON['stringify'](_0xabc9ef));});})['then'](function(){_0x2a7d33[_0x3edf('0x13')]();});});}}}catch(_0x28e3c3){logger[_0x3edf('0x47')](_0x3edf('0x17'),_0x2a74be,JSON[_0x3edf('0x45')](_0x28e3c3));_0x2a7d33['stop']();}};}; \ No newline at end of file +var _0x1cf3=['contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','upperFirst','AccountId','account','InteractionId','Message','service','Smtp','host','port','secure','authentication','auth','user','pass','inReplyTo','messageId','html','replace','headers','auto_reply','sendMailMessage','then','create','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','resolve','catch','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','finally','Interaction','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','interaction','created','info','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent'];(function(_0xe9e6cf,_0x395f6d){var _0x2b8851=function(_0x4d6bd4){while(--_0x4d6bd4){_0xe9e6cf['push'](_0xe9e6cf['shift']());}};_0x2b8851(++_0x395f6d);}(_0x1cf3,0xbd));var _0x31cf=function(_0x37e110,_0x5ba0af){_0x37e110=_0x37e110-0x0;var _0x2451b1=_0x1cf3[_0x37e110];return _0x2451b1;};'use strict';var _=require('lodash');var moment=require(_0x31cf('0x0'));var utils=require(_0x31cf('0x1'));var logger=require(_0x31cf('0x2'))(_0x31cf('0x3'));var rpc={'chatMessage':require(_0x31cf('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x31cf('0x5')),'smsMessage':require(_0x31cf('0x6')),'faxMessage':require(_0x31cf('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x31cf('0x8')),'mailInteraction':require(_0x31cf('0x9')),'smsInteraction':require(_0x31cf('0xa')),'faxInteraction':require(_0x31cf('0xb')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0x31cf('0xc'));exports[_0x31cf('0xd')]=function(_0x512ec7,_0x1370db,_0x4e8a54,_0x37e9eb){return function(_0x3eef91){try{var _0x363db4=this[_0x31cf('0xe')];if(_0x363db4===_0x31cf('0xf')&&_0x37e9eb[_0x31cf('0x10')][_0x31cf('0x11')]){logger['info'](_0x31cf('0x12'),_0x512ec7,_0x31cf('0x13'));return _0x3eef91[_0x31cf('0x14')]();}if(_0x1370db[0x0]==='1'&&(_['isNil'](this[_0x31cf('0x15')][_0x31cf('0x16')])||!this[_0x31cf('0x15')][_0x31cf('0x16')])){logger[_0x31cf('0x17')](_0x31cf('0x12'),_0x512ec7,'Autoreply\x20already\x20sent');return _0x3eef91[_0x31cf('0x14')]();}if(_0x1370db[0x0]==='2'&&this[_0x31cf('0x15')][_0x31cf('0x18')]){logger['info'](_0x31cf('0x19'),_0x512ec7,_0x31cf('0x1a'));return _0x3eef91[_0x31cf('0x14')]();}var _0x4775cc={'ContactId':this[_0x31cf('0x1b')]['id'],'sentAt':moment()[_0x31cf('0x1c')](_0x31cf('0x1d')),'direction':_0x31cf('0x1e')};if(this[_0x31cf('0xe')]===_0x31cf('0xf')){_0x4775cc[_0x31cf('0x10')]=utils[_0x31cf('0x1f')](_0x1370db[0x2],this);}else{_0x4775cc[_0x31cf('0x10')]=utils[_0x31cf('0x1f')](_0x1370db[0x1],this);}if(this[_0x31cf('0x20')]){_0x4775cc['to']=this['message'][_0x31cf('0x21')]||'';if(this[_0x31cf('0xe')]===_0x31cf('0xf')&&_0x1370db[0x1]==='1'){_0x4775cc['cc']=this[_0x31cf('0x20')]['cc']||'';}_0x4775cc['from']=this[_0x31cf('0x20')]['to']||'';_0x4775cc[_0x31cf('0x22')]=this[_0x31cf('0x20')]['phone']||'';_0x4775cc[_0x31cf('0x23')]=!![];if(this[_0x31cf('0x20')][_0x31cf('0x24')]){_0x4775cc[_0x31cf('0x24')]='';_0x4775cc['subject']+=_[_0x31cf('0x25')](this[_0x31cf('0x20')][_0x31cf('0x24')],_0x31cf('0x26'))?'':_0x31cf('0x27');_0x4775cc['subject']+=this[_0x31cf('0x20')][_0x31cf('0x24')];}}if(this[_0x31cf('0xe')]===_0x31cf('0x28')){_0x4775cc['ChatWebsiteId']=this['account']['id'];}else{_0x4775cc[_[_0x31cf('0x29')](this[_0x31cf('0xe')])+_0x31cf('0x2a')]=this[_0x31cf('0x2b')]['id'];}_0x4775cc[_[_0x31cf('0x29')](this[_0x31cf('0xe')])+_0x31cf('0x2c')]=this[_0x31cf('0x15')]['id'];var _0x23fa40=this[_0x31cf('0x15')];if(rpc[this[_0x31cf('0xe')]+_0x31cf('0x2d')]){if(this[_0x31cf('0xe')]===_0x31cf('0xf')){var _0x29fe7b={'tls':{'rejectUnauthorized':![]}};if(this[_0x31cf('0x2b')]['Smtp']['service']){_0x29fe7b[_0x31cf('0x2e')]=this[_0x31cf('0x2b')][_0x31cf('0x2f')]['service'];}else{_0x29fe7b[_0x31cf('0x30')]=this[_0x31cf('0x2b')][_0x31cf('0x2f')][_0x31cf('0x30')];_0x29fe7b['port']=this[_0x31cf('0x2b')]['Smtp'][_0x31cf('0x31')];_0x29fe7b[_0x31cf('0x32')]=this[_0x31cf('0x2b')][_0x31cf('0x2f')][_0x31cf('0x32')];}if(this[_0x31cf('0x2b')][_0x31cf('0x2f')][_0x31cf('0x33')]){_0x29fe7b[_0x31cf('0x34')]={'user':this[_0x31cf('0x2b')]['Smtp'][_0x31cf('0x35')],'pass':this[_0x31cf('0x2b')][_0x31cf('0x2f')][_0x31cf('0x36')]};}_0x4775cc[_0x31cf('0x37')]=this['message'][_0x31cf('0x38')];_0x4775cc[_0x31cf('0x39')]=''+_[_0x31cf('0x3a')](_0x4775cc['body'],'';_0x4775cc[_0x31cf('0x3b')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':'All','Precedence':_0x31cf('0x3c')};return mailRpc[_0x31cf('0x3d')](_0x29fe7b,_0x4775cc)[_0x31cf('0x3e')](function(_0x20945d){logger['info']('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x512ec7);_0x4775cc['messageId']=_0x20945d[_0x31cf('0x20')][_0x31cf('0x38')];return rpc[_0x363db4+'Message'][_0x31cf('0x3f')](_0x4775cc);})[_0x31cf('0x3e')](function(_0x43c516){logger[_0x31cf('0x17')](_0x31cf('0x12'),_0x512ec7,JSON['stringify'](_0x43c516));})['catch'](function(_0x247362){logger[_0x31cf('0x40')](_0x31cf('0x41'),_0x512ec7,JSON[_0x31cf('0x42')](_0x247362));})['finally'](function(){Promise[_0x31cf('0x43')]()['then'](function(){if(_0x1370db[0x0]!=='2'||_0x23fa40[_0x31cf('0x18')])return;return rpc[_0x363db4+'Interaction']['update'](_0x23fa40['id'],{'autoreplyExecuted':!![]})[_0x31cf('0x3e')](function(_0x287ad1){logger[_0x31cf('0x17')](_0x31cf('0x19'),_0x512ec7,JSON[_0x31cf('0x42')](_0x287ad1));})[_0x31cf('0x44')](function(_0x133a1c){logger[_0x31cf('0x40')](_0x31cf('0x45'),_0x512ec7,JSON[_0x31cf('0x42')](_0x133a1c));});})[_0x31cf('0x3e')](function(){_0x3eef91[_0x31cf('0x14')]();});});}else{return rpc[this[_0x31cf('0xe')]+_0x31cf('0x2d')]['create'](_0x4775cc)[_0x31cf('0x3e')](function(_0x3fc90a){logger[_0x31cf('0x17')](_0x31cf('0x12'),_0x512ec7,_0x4775cc[_0x31cf('0x10')]);})[_0x31cf('0x44')](function(_0x42aa0d){logger[_0x31cf('0x40')]('[%s][AUTOREPLY]\x20%s',_0x512ec7,JSON['stringify'](_0x42aa0d));})[_0x31cf('0x46')](function(){Promise[_0x31cf('0x43')]()[_0x31cf('0x3e')](function(){if(_0x1370db[0x0]!=='2'||_0x23fa40['autoreplyExecuted'])return;return rpc[_0x363db4+_0x31cf('0x47')]['update'](_0x23fa40['id'],{'autoreplyExecuted':!![]})[_0x31cf('0x3e')](function(_0x3e009c){logger[_0x31cf('0x17')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x512ec7,JSON[_0x31cf('0x42')](_0x3e009c));})[_0x31cf('0x44')](function(_0x415372){logger[_0x31cf('0x40')](_0x31cf('0x45'),_0x512ec7,JSON[_0x31cf('0x42')](_0x415372));});})['then'](function(){_0x3eef91[_0x31cf('0x14')]();});});}}}catch(_0x2a5fe6){logger[_0x31cf('0x40')](_0x31cf('0x12'),_0x512ec7,JSON['stringify'](_0x2a5fe6));_0x3eef91['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index fb15cc7..02bea59 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfa21=['../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s','stringify','stop','moment'];(function(_0x3c3fa0,_0x4224be){var _0x4eaa8d=function(_0x239f34){while(--_0x239f34){_0x3c3fa0['push'](_0x3c3fa0['shift']());}};_0x4eaa8d(++_0x4224be);}(_0xfa21,0x7d));var _0x1fa2=function(_0x103d45,_0x21187e){_0x103d45=_0x103d45-0x0;var _0x47d034=_0xfa21[_0x103d45];return _0x47d034;};'use strict';var moment=require(_0x1fa2('0x0'));var logger=require('../../../../config/logger')('routing');var rpc={'chatInteraction':require(_0x1fa2('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x1fa2('0x2')),'mailInteraction':require(_0x1fa2('0x3')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x1fa2('0x4'))};exports[_0x1fa2('0x5')]=function(_0x1cf961,_0x4981d4,_0x26eb7f,_0x1db1fe){return function(_0xaae1fa){try{logger[_0x1fa2('0x6')](_0x1fa2('0x7'),_0x1cf961,_0x4981d4[0x0]);var _0x370ea1={'closed':0x1,'closedAt':moment()[_0x1fa2('0x8')](_0x1fa2('0x9')),'closeReason':_0x1fa2('0xa'),'disposition':_0x4981d4[0x0]};if(rpc[_0x1db1fe[_0x1fa2('0xb')]+_0x1fa2('0xc')]){rpc[_0x1db1fe[_0x1fa2('0xb')]+_0x1fa2('0xc')][_0x1fa2('0xd')](_0x1db1fe[_0x1fa2('0xe')]['id'],_0x370ea1)[_0x1fa2('0xf')](function(_0x2bc502){logger['info'](_0x1fa2('0x10'),_0x1cf961,_0x1db1fe[_0x1fa2('0xe')]['id']);})['catch'](function(_0x4f2c7e){logger[_0x1fa2('0x11')](_0x1fa2('0x12'),_0x1cf961,JSON[_0x1fa2('0x13')](_0x4f2c7e));})['finally'](function(){_0xaae1fa[_0x1fa2('0x14')]();});}}catch(_0x2dd515){logger[_0x1fa2('0x11')]('[%s][CLOSE]\x20%s',_0x1cf961,JSON['stringify'](_0x2dd515));_0xaae1fa[_0x1fa2('0x14')]();}};}; \ No newline at end of file +var _0x61f3=['interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','finally','error','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','update'];(function(_0x2e249d,_0x41b7e7){var _0x1faa37=function(_0x1422b4){while(--_0x1422b4){_0x2e249d['push'](_0x2e249d['shift']());}};_0x1faa37(++_0x41b7e7);}(_0x61f3,0x1d4));var _0x361f=function(_0xaeff5b,_0xd051b4){_0xaeff5b=_0xaeff5b-0x0;var _0x1c9970=_0x61f3[_0xaeff5b];return _0x1c9970;};'use strict';var moment=require(_0x361f('0x0'));var logger=require(_0x361f('0x1'))('routing');var rpc={'chatInteraction':require(_0x361f('0x2')),'openchannelInteraction':require(_0x361f('0x3')),'smsInteraction':require(_0x361f('0x4')),'mailInteraction':require(_0x361f('0x5')),'faxInteraction':require(_0x361f('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x361f('0x7')]=function(_0x5451cb,_0x78443b,_0x31d93b,_0x125071){return function(_0x44978b){try{logger[_0x361f('0x8')](_0x361f('0x9'),_0x5451cb,_0x78443b[0x0]);var _0x5826f2={'closed':0x1,'closedAt':moment()[_0x361f('0xa')](_0x361f('0xb')),'closeReason':_0x361f('0xc'),'disposition':_0x78443b[0x0]};if(rpc[_0x125071['channel']+_0x361f('0xd')]){rpc[_0x125071['channel']+_0x361f('0xd')][_0x361f('0xe')](_0x125071[_0x361f('0xf')]['id'],_0x5826f2)['then'](function(_0xbc1086){logger['info'](_0x361f('0x10'),_0x5451cb,_0x125071[_0x361f('0xf')]['id']);})[_0x361f('0x11')](function(_0x2e116a){logger['error'](_0x361f('0x12'),_0x5451cb,JSON['stringify'](_0x2e116a));})[_0x361f('0x13')](function(){_0x44978b['stop']();});}}catch(_0x397056){logger[_0x361f('0x14')]('[%s][CLOSE]\x20%s',_0x5451cb,JSON['stringify'](_0x397056));_0x44978b['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index c281b6a..94ac8f3 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfdcd=['isNil','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','whatsapp','phone','interaction','ChatWebsiteId','account','upperFirst','InteractionId','isEmpty','getMustacheRender','create','then','body','catch','[%s][DIALOGFLOW]\x20%s','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','providerName','providerResponse','Message','result','metadata','endConversation','error','moment','apiai-promise','md5','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence'];(function(_0x43da77,_0x4d372c){var _0x2a4d75=function(_0x1a5829){while(--_0x1a5829){_0x43da77['push'](_0x43da77['shift']());}};_0x2a4d75(++_0x4d372c);}(_0xfdcd,0xe9));var _0xdfdc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xfdcd[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var moment=require(_0xdfdc('0x0'));var apiai=require(_0xdfdc('0x1'));var md5=require(_0xdfdc('0x2'));var utils=require('./utils');var logger=require(_0xdfdc('0x3'))(_0xdfdc('0x4'));var rpc={'chatMessage':require(_0xdfdc('0x5')),'openchannelMessage':require(_0xdfdc('0x6')),'mailMessage':require(_0xdfdc('0x7')),'smsMessage':require(_0xdfdc('0x8')),'faxMessage':require(_0xdfdc('0x9')),'whatsappMessage':require(_0xdfdc('0xa'))};exports[_0xdfdc('0xb')]=function(_0x1f2529,_0x13ab53){return function(_0x18691e){try{if(!_[_0xdfdc('0xc')](this['interaction'][_0xdfdc('0xd')])){logger[_0xdfdc('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x1f2529,_0xdfdc('0xf'));return _0x18691e[_0xdfdc('0x10')]();}var _0x452de2={'ContactId':this[_0xdfdc('0x11')]['id'],'sentAt':moment()[_0xdfdc('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xdfdc('0x13')};if(this['channel']==='sms'||this[_0xdfdc('0x14')]===_0xdfdc('0x15')){_0x452de2[_0xdfdc('0x16')]=this[_0xdfdc('0x17')][_0xdfdc('0x16')];}var _0x1b8d38=this[_0xdfdc('0x14')];if(_0x1b8d38==='chat'){_0x452de2[_0xdfdc('0x18')]=this[_0xdfdc('0x19')]['id'];}else{_0x452de2[_[_0xdfdc('0x1a')](_0x1b8d38)+'AccountId']=this[_0xdfdc('0x19')]['id'];}_0x452de2[_[_0xdfdc('0x1a')](_0x1b8d38)+_0xdfdc('0x1b')]=this['interaction']['id'];if(this[_0xdfdc('0x17')]['created']){var _0x30abc2=_0x13ab53[0x2];if(!_[_0xdfdc('0x1c')](_0x30abc2)){_0x452de2['body']=utils[_0xdfdc('0x1d')](_0x30abc2,this);return rpc[_0x1b8d38+'Message'][_0xdfdc('0x1e')](_0x452de2)[_0xdfdc('0x1f')](function(_0x23a3be){logger[_0xdfdc('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x1f2529,_0x452de2[_0xdfdc('0x20')]);})[_0xdfdc('0x21')](function(_0x1315ee){logger['error'](_0xdfdc('0x22'),_0x1f2529,JSON[_0xdfdc('0x23')](_0x1315ee));})['finally'](function(){logger['info'](_0xdfdc('0x24'),_0x1f2529);_0x18691e[_0xdfdc('0x25')]();});}else{logger[_0xdfdc('0xe')](_0xdfdc('0x26'),_0x1f2529);_0x18691e[_0xdfdc('0x25')]();}}else{var _0x1bb542=this;var _0x1a2b57=apiai(_0x13ab53[0x0],{'language':_0x13ab53[0x1]||'en'});return _0x1a2b57[_0xdfdc('0x27')](this[_0xdfdc('0x28')][_0xdfdc('0x20')],{'sessionId':md5(this['interaction']['id'])})[_0xdfdc('0x1f')](function(_0x1b01b8){_0x1bb542[_0xdfdc('0x20')][_0xdfdc('0x29')]=_0x1b01b8;_0x452de2[_0xdfdc('0x20')]=_0x1b01b8['result']['fulfillment']['speech'];_0x452de2[_0xdfdc('0x2a')]=_0xdfdc('0x29');_0x452de2[_0xdfdc('0x2b')]=JSON[_0xdfdc('0x23')](_0x1b01b8);return rpc[_0x1b8d38+_0xdfdc('0x2c')]['create'](_0x452de2)[_0xdfdc('0x1f')](function(_0x1a5d86){logger[_0xdfdc('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x1f2529,_0x452de2['body']);if(_0x1b01b8[_0xdfdc('0x2d')][_0xdfdc('0x2e')][_0xdfdc('0x2f')]){_0x18691e[_0xdfdc('0x10')]();}else{_0x18691e[_0xdfdc('0x25')]();}})[_0xdfdc('0x21')](function(_0x283df7){logger['error'](_0xdfdc('0x22'),_0x1f2529,JSON[_0xdfdc('0x23')](_0x283df7));_0x18691e[_0xdfdc('0x10')]();});})[_0xdfdc('0x21')](function(_0x3b077a){logger[_0xdfdc('0x30')](_0xdfdc('0x22'),_0x1f2529,_0x3b077a[_0xdfdc('0x28')]);_0x18691e[_0xdfdc('0x10')]();});}}catch(_0x135bdb){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x1f2529,JSON['stringify'](_0x135bdb));_0x18691e[_0xdfdc('0x25')]();}};}; \ No newline at end of file +var _0x00b3=['error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','dialogflow','result','fulfillment','speech','providerResponse','metadata','next','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','out','channel','whatsapp','phone','chat','ChatWebsiteId','AccountId','account','created','isEmpty','body','getMustacheRender','Message','then','catch'];(function(_0x613e1a,_0x5364c2){var _0x3c19bf=function(_0x1dde0e){while(--_0x1dde0e){_0x613e1a['push'](_0x613e1a['shift']());}};_0x3c19bf(++_0x5364c2);}(_0x00b3,0x157));var _0x300b=function(_0x125deb,_0x3b464f){_0x125deb=_0x125deb-0x0;var _0x31c258=_0x00b3[_0x125deb];return _0x31c258;};'use strict';var _=require(_0x300b('0x0'));var moment=require(_0x300b('0x1'));var apiai=require(_0x300b('0x2'));var md5=require(_0x300b('0x3'));var utils=require(_0x300b('0x4'));var logger=require(_0x300b('0x5'))('routing');var rpc={'chatMessage':require(_0x300b('0x6')),'openchannelMessage':require(_0x300b('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x300b('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x300b('0x9'))};exports[_0x300b('0xa')]=function(_0x2533d3,_0x2caa7c){return function(_0x291829){try{if(!_['isNil'](this[_0x300b('0xb')][_0x300b('0xc')])){logger[_0x300b('0xd')](_0x300b('0xe'),_0x2533d3,_0x300b('0xf'));return _0x291829['next']();}var _0x5c1ded={'ContactId':this[_0x300b('0x10')]['id'],'sentAt':moment()[_0x300b('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x300b('0x12')};if(this[_0x300b('0x13')]==='sms'||this[_0x300b('0x13')]===_0x300b('0x14')){_0x5c1ded[_0x300b('0x15')]=this[_0x300b('0xb')][_0x300b('0x15')];}var _0x21a6ae=this[_0x300b('0x13')];if(_0x21a6ae===_0x300b('0x16')){_0x5c1ded[_0x300b('0x17')]=this['account']['id'];}else{_0x5c1ded[_['upperFirst'](_0x21a6ae)+_0x300b('0x18')]=this[_0x300b('0x19')]['id'];}_0x5c1ded[_['upperFirst'](_0x21a6ae)+'InteractionId']=this[_0x300b('0xb')]['id'];if(this[_0x300b('0xb')][_0x300b('0x1a')]){var _0x2800e9=_0x2caa7c[0x2];if(!_[_0x300b('0x1b')](_0x2800e9)){_0x5c1ded[_0x300b('0x1c')]=utils[_0x300b('0x1d')](_0x2800e9,this);return rpc[_0x21a6ae+_0x300b('0x1e')]['create'](_0x5c1ded)[_0x300b('0x1f')](function(_0x3860ab){logger[_0x300b('0xd')](_0x300b('0xe'),_0x2533d3,_0x5c1ded[_0x300b('0x1c')]);})[_0x300b('0x20')](function(_0x5e02ad){logger[_0x300b('0x21')]('[%s][DIALOGFLOW]\x20%s',_0x2533d3,JSON[_0x300b('0x22')](_0x5e02ad));})[_0x300b('0x23')](function(){logger['info'](_0x300b('0x24'),_0x2533d3);_0x291829['stop']();});}else{logger[_0x300b('0xd')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x2533d3);_0x291829[_0x300b('0x25')]();}}else{var _0x1f54ee=this;var _0x59f7fc=apiai(_0x2caa7c[0x0],{'language':_0x2caa7c[0x1]||'en'});return _0x59f7fc[_0x300b('0x26')](this[_0x300b('0x27')]['body'],{'sessionId':md5(this[_0x300b('0xb')]['id'])})['then'](function(_0x429094){_0x1f54ee[_0x300b('0x1c')][_0x300b('0x28')]=_0x429094;_0x5c1ded[_0x300b('0x1c')]=_0x429094[_0x300b('0x29')][_0x300b('0x2a')][_0x300b('0x2b')];_0x5c1ded['providerName']=_0x300b('0x28');_0x5c1ded[_0x300b('0x2c')]=JSON['stringify'](_0x429094);return rpc[_0x21a6ae+_0x300b('0x1e')]['create'](_0x5c1ded)[_0x300b('0x1f')](function(_0xab5f6a){logger[_0x300b('0xd')](_0x300b('0xe'),_0x2533d3,_0x5c1ded[_0x300b('0x1c')]);if(_0x429094[_0x300b('0x29')][_0x300b('0x2d')]['endConversation']){_0x291829[_0x300b('0x2e')]();}else{_0x291829[_0x300b('0x25')]();}})[_0x300b('0x20')](function(_0x19d303){logger[_0x300b('0x21')](_0x300b('0xe'),_0x2533d3,JSON['stringify'](_0x19d303));_0x291829[_0x300b('0x2e')]();});})[_0x300b('0x20')](function(_0x363261){logger[_0x300b('0x21')](_0x300b('0xe'),_0x2533d3,_0x363261['message']);_0x291829[_0x300b('0x2e')]();});}}catch(_0x258605){logger[_0x300b('0x21')](_0x300b('0xe'),_0x2533d3,JSON[_0x300b('0x22')](_0x258605));_0x291829['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 60365e3..4b0f852 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6dca=['push','all','next','lodash','dialogflow','moment','bluebird','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','stringify','consequence','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','interaction','created','isEmpty','getMustacheRender','error','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','SessionsClient','sessionPath','message','detectIntent','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','providerName','fulfillmentText'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x6dca,0x8d));var _0xa6dc=function(_0x56b2d0,_0x571830){_0x56b2d0=_0x56b2d0-0x0;var _0x4ccb5b=_0x6dca[_0x56b2d0];return _0x4ccb5b;};'use strict';var _=require(_0xa6dc('0x0'));var dialogflow=require(_0xa6dc('0x1'));var md5=require('md5');var moment=require(_0xa6dc('0x2'));var Promise=require(_0xa6dc('0x3'));var logger=require(_0xa6dc('0x4'))('routing');var utils=require('./utils');var rpc={'chatMessage':require(_0xa6dc('0x5')),'openchannelMessage':require(_0xa6dc('0x6')),'mailMessage':require(_0xa6dc('0x7')),'smsMessage':require(_0xa6dc('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xa6dc('0x9'))};function createMessage(_0x13793c,_0xb53384,_0x39866d,_0x54556f){return new Promise(function(_0x375956,_0x249301){var _0x1d65c2=_['clone'](_0x39866d);_0x1d65c2[_0xa6dc('0xa')]=_0x54556f;return rpc[_0xb53384+_0xa6dc('0xb')][_0xa6dc('0xc')](_0x1d65c2)[_0xa6dc('0xd')](function(){logger[_0xa6dc('0xe')](_0xa6dc('0xf'),_0x13793c,_0x1d65c2[_0xa6dc('0xa')]);_0x375956();})[_0xa6dc('0x10')](function(_0x3f4d51){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x13793c,JSON[_0xa6dc('0x11')](_0x3f4d51));_0x249301(_0x3f4d51);});});}exports[_0xa6dc('0x12')]=function(_0x1c90c0,_0x491be9){return function(_0x36d95d){try{if(!_['isNil'](this['interaction']['UserId'])){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x1c90c0,_0xa6dc('0x13'));return _0x36d95d['next']();}var _0x233616={'ContactId':this[_0xa6dc('0x14')]['id'],'sentAt':moment()['format'](_0xa6dc('0x15')),'direction':_0xa6dc('0x16')};if(this[_0xa6dc('0x17')]===_0xa6dc('0x18')||this[_0xa6dc('0x17')]==='whatsapp'){_0x233616['phone']=this['interaction'][_0xa6dc('0x19')];}var _0x271f34=this[_0xa6dc('0x17')];if(_0x271f34===_0xa6dc('0x1a')){_0x233616[_0xa6dc('0x1b')]=this['account']['id'];}else{_0x233616[_[_0xa6dc('0x1c')](_0x271f34)+_0xa6dc('0x1d')]=this[_0xa6dc('0x1e')]['id'];}_0x233616[_[_0xa6dc('0x1c')](_0x271f34)+_0xa6dc('0x1f')]=this['interaction']['id'];if(this[_0xa6dc('0x20')][_0xa6dc('0x21')]){var _0x399c4a=_0x491be9[0x4];if(!_[_0xa6dc('0x22')](_0x399c4a)){_0x233616[_0xa6dc('0xa')]=utils[_0xa6dc('0x23')](_0x399c4a,this);return rpc[_0x271f34+_0xa6dc('0xb')][_0xa6dc('0xc')](_0x233616)[_0xa6dc('0xd')](function(_0x440787){logger[_0xa6dc('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x1c90c0,_0x233616[_0xa6dc('0xa')]);})['catch'](function(_0x5307b0){logger[_0xa6dc('0x24')]('[%s][DIALOGFLOWV2]\x20%s',_0x1c90c0,JSON[_0xa6dc('0x11')](_0x5307b0));})[_0xa6dc('0x25')](function(){logger[_0xa6dc('0xe')](_0xa6dc('0x26'),_0x1c90c0);_0x36d95d[_0xa6dc('0x27')]();});}else{logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x1c90c0);_0x36d95d[_0xa6dc('0x27')]();}}else{var _0x55bc27=this;var _0x2cb846=_0x491be9[0x2][_0xa6dc('0x28')](/\\n/g,'\x0a');var _0x4f252e={'credentials':{'private_key':_0x2cb846,'client_email':_0x491be9[0x1]}};var _0x1322ff=new dialogflow[(_0xa6dc('0x29'))](_0x4f252e);var _0x5d3045=_0x1322ff[_0xa6dc('0x2a')](_0x491be9[0x0],md5(_0x55bc27[_0xa6dc('0x20')]['id']));var _0x16fe7f={'session':_0x5d3045,'queryInput':{'text':{'text':_0x55bc27[_0xa6dc('0x2b')][_0xa6dc('0xa')],'languageCode':_0x491be9[0x3]||'en'}}};return _0x1322ff[_0xa6dc('0x2c')](_0x16fe7f)[_0xa6dc('0xd')](function(_0x1cf359){if(_0x1cf359&&_0x1cf359['length']){_0x55bc27[_0xa6dc('0xa')][_0xa6dc('0x2d')]=_0x1cf359;var _0x5d0cec=_0x1cf359[0x0];var _0x571f30=_0x5d0cec[_0xa6dc('0x2e')][_0xa6dc('0x2f')]&&_0x5d0cec['queryResult']['diagnosticInfo'][_0xa6dc('0x30')]?_0x5d0cec[_0xa6dc('0x2e')]['diagnosticInfo']['fields'][_0xa6dc('0x31')][_0xa6dc('0x32')]:![];_0x55bc27['body']['DIALOGFLOWV2_ACTION']=_0x5d0cec[_0xa6dc('0x2e')]['action'];_0x55bc27['body'][_0xa6dc('0x33')]=_0x5d0cec[_0xa6dc('0x2e')][_0xa6dc('0x34')];_0x55bc27[_0xa6dc('0xa')][_0xa6dc('0x35')]=_0x5d0cec[_0xa6dc('0x2e')]['diagnosticInfo']&&_0x5d0cec[_0xa6dc('0x2e')][_0xa6dc('0x2f')]['fields']?_0x5d0cec[_0xa6dc('0x2e')][_0xa6dc('0x2f')][_0xa6dc('0x30')][_0xa6dc('0x31')][_0xa6dc('0x32')]:![];_0x55bc27[_0xa6dc('0xa')][_0xa6dc('0x36')]=_0x5d0cec[_0xa6dc('0x2e')][_0xa6dc('0x37')][_0xa6dc('0x38')];_0x55bc27[_0xa6dc('0xa')][_0xa6dc('0x39')]=_0x5d0cec[_0xa6dc('0x2e')][_0xa6dc('0x37')][_0xa6dc('0x3a')];_0x55bc27['body'][_0xa6dc('0x3b')]=_0x5d0cec['queryResult'][_0xa6dc('0x37')]['isFallback'];_0x55bc27[_0xa6dc('0xa')][_0xa6dc('0x3c')]=_0x5d0cec[_0xa6dc('0x2e')][_0xa6dc('0x3d')];_0x55bc27[_0xa6dc('0xa')][_0xa6dc('0x3e')]=_0x5d0cec[_0xa6dc('0x2e')][_0xa6dc('0x3f')];_0x55bc27[_0xa6dc('0xa')]['DIALOGFLOWV2_SCORE']=_0x5d0cec[_0xa6dc('0x2e')]['intentDetectionConfidence'];_0x233616[_0xa6dc('0x40')]=_0xa6dc('0x2d');_0x233616['providerResponse']=JSON[_0xa6dc('0x11')](_0x1cf359);var _0x491195=[];for(var _0x410d31=0x0;_0x410d31<_0x1cf359['length'];_0x410d31++){var _0x1f6e92=_0x1cf359[_0x410d31];if(_0x1f6e92&&_0x1f6e92[_0xa6dc('0x2e')]&&_0x1f6e92[_0xa6dc('0x2e')][_0xa6dc('0x41')]){_0x491195[_0xa6dc('0x42')](createMessage(_0x1c90c0,_0x271f34,_0x233616,_0x1f6e92[_0xa6dc('0x2e')][_0xa6dc('0x41')]));}}return Promise[_0xa6dc('0x43')](_0x491195)[_0xa6dc('0xd')](function(){if(_0x571f30){_0x36d95d[_0xa6dc('0x44')]();}else{_0x36d95d['stop']();}})[_0xa6dc('0x10')](function(_0x5e31bb){logger[_0xa6dc('0x24')]('[%s][DIALOGFLOWV2]\x20%s',_0x1c90c0,JSON[_0xa6dc('0x11')](_0x5e31bb));_0x36d95d['next']();});}})[_0xa6dc('0x10')](function(_0x560456){logger['error'](_0xa6dc('0xf'),_0x1c90c0,_0x560456[_0xa6dc('0x2b')]);_0x36d95d[_0xa6dc('0x44')]();});}}catch(_0x3602eb){logger[_0xa6dc('0x24')](_0xa6dc('0xf'),_0x1c90c0,JSON[_0xa6dc('0x11')](_0x3602eb));_0x36d95d[_0xa6dc('0x27')]();}};}; \ No newline at end of file +var _0x869a=['languageCode','DIALOGFLOWV2_QUERYTEXT','intentDetectionConfidence','providerName','dialogflowV2','providerResponse','length','fulfillmentText','push','all','lodash','../../../../config/logger','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','clone','create','then','info','[%s][DIALOGFLOWV2]\x20%s','body','catch','error','stringify','consequence','isNil','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','replace','SessionsClient','sessionPath','message','detectIntent','queryResult','diagnosticInfo','fields','end_conversation','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','boolValue','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback'];(function(_0x5ed8d3,_0x3f149c){var _0x4ae472=function(_0x17fcbd){while(--_0x17fcbd){_0x5ed8d3['push'](_0x5ed8d3['shift']());}};_0x4ae472(++_0x3f149c);}(_0x869a,0x1f4));var _0xa869=function(_0x17d9f5,_0x11a94f){_0x17d9f5=_0x17d9f5-0x0;var _0x306257=_0x869a[_0x17d9f5];return _0x306257;};'use strict';var _=require(_0xa869('0x0'));var dialogflow=require('dialogflow');var md5=require('md5');var moment=require('moment');var Promise=require('bluebird');var logger=require(_0xa869('0x1'))('routing');var utils=require(_0xa869('0x2'));var rpc={'chatMessage':require(_0xa869('0x3')),'openchannelMessage':require(_0xa869('0x4')),'mailMessage':require(_0xa869('0x5')),'smsMessage':require(_0xa869('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xa869('0x7'))};function createMessage(_0x3e79d1,_0x5c443d,_0x458ba4,_0x3d9d76){return new Promise(function(_0x464f44,_0x20f35f){var _0x4c5156=_[_0xa869('0x8')](_0x458ba4);_0x4c5156['body']=_0x3d9d76;return rpc[_0x5c443d+'Message'][_0xa869('0x9')](_0x4c5156)[_0xa869('0xa')](function(){logger[_0xa869('0xb')](_0xa869('0xc'),_0x3e79d1,_0x4c5156[_0xa869('0xd')]);_0x464f44();})[_0xa869('0xe')](function(_0x5dfe1f){logger[_0xa869('0xf')](_0xa869('0xc'),_0x3e79d1,JSON[_0xa869('0x10')](_0x5dfe1f));_0x20f35f(_0x5dfe1f);});});}exports[_0xa869('0x11')]=function(_0x1bccdf,_0x29630e){return function(_0x2680b1){try{if(!_[_0xa869('0x12')](this['interaction']['UserId'])){logger[_0xa869('0xb')](_0xa869('0xc'),_0x1bccdf,_0xa869('0x13'));return _0x2680b1[_0xa869('0x14')]();}var _0x5add52={'ContactId':this['contact']['id'],'sentAt':moment()[_0xa869('0x15')](_0xa869('0x16')),'direction':'out'};if(this[_0xa869('0x17')]==='sms'||this[_0xa869('0x17')]===_0xa869('0x18')){_0x5add52[_0xa869('0x19')]=this[_0xa869('0x1a')]['phone'];}var _0x36b54b=this[_0xa869('0x17')];if(_0x36b54b===_0xa869('0x1b')){_0x5add52[_0xa869('0x1c')]=this[_0xa869('0x1d')]['id'];}else{_0x5add52[_[_0xa869('0x1e')](_0x36b54b)+_0xa869('0x1f')]=this['account']['id'];}_0x5add52[_[_0xa869('0x1e')](_0x36b54b)+_0xa869('0x20')]=this[_0xa869('0x1a')]['id'];if(this['interaction']['created']){var _0x14270a=_0x29630e[0x4];if(!_[_0xa869('0x21')](_0x14270a)){_0x5add52[_0xa869('0xd')]=utils['getMustacheRender'](_0x14270a,this);return rpc[_0x36b54b+'Message'][_0xa869('0x9')](_0x5add52)[_0xa869('0xa')](function(_0x12ea69){logger[_0xa869('0xb')]('[%s][DIALOGFLOWV2]\x20%s',_0x1bccdf,_0x5add52['body']);})[_0xa869('0xe')](function(_0x51fdb8){logger[_0xa869('0xf')](_0xa869('0xc'),_0x1bccdf,JSON[_0xa869('0x10')](_0x51fdb8));})[_0xa869('0x22')](function(){logger[_0xa869('0xb')](_0xa869('0x23'),_0x1bccdf);_0x2680b1['stop']();});}else{logger[_0xa869('0xb')](_0xa869('0x24'),_0x1bccdf);_0x2680b1[_0xa869('0x25')]();}}else{var _0x41529e=this;var _0x18725a=_0x29630e[0x2][_0xa869('0x26')](/\\n/g,'\x0a');var _0x13ec4c={'credentials':{'private_key':_0x18725a,'client_email':_0x29630e[0x1]}};var _0x24a331=new dialogflow[(_0xa869('0x27'))](_0x13ec4c);var _0x636b5=_0x24a331[_0xa869('0x28')](_0x29630e[0x0],md5(_0x41529e[_0xa869('0x1a')]['id']));var _0x3316d8={'session':_0x636b5,'queryInput':{'text':{'text':_0x41529e[_0xa869('0x29')][_0xa869('0xd')],'languageCode':_0x29630e[0x3]||'en'}}};return _0x24a331[_0xa869('0x2a')](_0x3316d8)[_0xa869('0xa')](function(_0x54339c){if(_0x54339c&&_0x54339c['length']){_0x41529e['body']['dialogflowV2']=_0x54339c;var _0x1bf360=_0x54339c[0x0];var _0x5ebb38=_0x1bf360[_0xa869('0x2b')][_0xa869('0x2c')]&&_0x1bf360['queryResult'][_0xa869('0x2c')][_0xa869('0x2d')]?_0x1bf360['queryResult'][_0xa869('0x2c')]['fields'][_0xa869('0x2e')]['boolValue']:![];_0x41529e[_0xa869('0xd')][_0xa869('0x2f')]=_0x1bf360[_0xa869('0x2b')][_0xa869('0x30')];_0x41529e[_0xa869('0xd')][_0xa869('0x31')]=_0x1bf360[_0xa869('0x2b')][_0xa869('0x32')];_0x41529e[_0xa869('0xd')][_0xa869('0x33')]=_0x1bf360[_0xa869('0x2b')]['diagnosticInfo']&&_0x1bf360['queryResult'][_0xa869('0x2c')]['fields']?_0x1bf360[_0xa869('0x2b')]['diagnosticInfo'][_0xa869('0x2d')]['end_conversation'][_0xa869('0x34')]:![];_0x41529e['body'][_0xa869('0x35')]=_0x1bf360[_0xa869('0x2b')][_0xa869('0x36')][_0xa869('0x37')];_0x41529e[_0xa869('0xd')][_0xa869('0x38')]=_0x1bf360['queryResult'][_0xa869('0x36')][_0xa869('0x39')];_0x41529e[_0xa869('0xd')][_0xa869('0x3a')]=_0x1bf360[_0xa869('0x2b')][_0xa869('0x36')][_0xa869('0x3b')];_0x41529e[_0xa869('0xd')]['DIALOGFLOWV2_LANGUAGECODE']=_0x1bf360[_0xa869('0x2b')][_0xa869('0x3c')];_0x41529e[_0xa869('0xd')][_0xa869('0x3d')]=_0x1bf360[_0xa869('0x2b')]['queryText'];_0x41529e[_0xa869('0xd')]['DIALOGFLOWV2_SCORE']=_0x1bf360['queryResult'][_0xa869('0x3e')];_0x5add52[_0xa869('0x3f')]=_0xa869('0x40');_0x5add52[_0xa869('0x41')]=JSON['stringify'](_0x54339c);var _0x2bf451=[];for(var _0x5490b0=0x0;_0x5490b0<_0x54339c[_0xa869('0x42')];_0x5490b0++){var _0x50d25c=_0x54339c[_0x5490b0];if(_0x50d25c&&_0x50d25c[_0xa869('0x2b')]&&_0x50d25c['queryResult'][_0xa869('0x43')]){_0x2bf451[_0xa869('0x44')](createMessage(_0x1bccdf,_0x36b54b,_0x5add52,_0x50d25c[_0xa869('0x2b')]['fulfillmentText']));}}return Promise[_0xa869('0x45')](_0x2bf451)[_0xa869('0xa')](function(){if(_0x5ebb38){_0x2680b1[_0xa869('0x14')]();}else{_0x2680b1[_0xa869('0x25')]();}})[_0xa869('0xe')](function(_0xdf88de){logger[_0xa869('0xf')](_0xa869('0xc'),_0x1bccdf,JSON[_0xa869('0x10')](_0xdf88de));_0x2680b1[_0xa869('0x14')]();});}})[_0xa869('0xe')](function(_0x29fcb0){logger['error'](_0xa869('0xc'),_0x1bccdf,_0x29fcb0['message']);_0x2680b1[_0xa869('0x14')]();});}}catch(_0x134fb6){logger['error'](_0xa869('0xc'),_0x1bccdf,JSON[_0xa869('0x10')](_0x134fb6));_0x2680b1[_0xa869('0x25')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index bec9c02..8ec7b23 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe195=['string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','condition','priorityTrue','priorityFalse','info','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','./utils','../../../../config/logger'];(function(_0x5cc71f,_0x52f949){var _0x5bf181=function(_0x568d37){while(--_0x568d37){_0x5cc71f['push'](_0x5cc71f['shift']());}};_0x5bf181(++_0x52f949);}(_0xe195,0x13c));var _0x5e19=function(_0x48b881,_0x4c110b){_0x48b881=_0x48b881-0x0;var _0x384f22=_0xe195[_0x48b881];return _0x384f22;};'use strict';var schema=require(_0x5e19('0x0'));var _=require('lodash');var htmlToText=require('html-to-text');var utils=require(_0x5e19('0x1'));var logger=require(_0x5e19('0x2'))('routing');var gotoif=schema({'condition':{'type':_0x5e19('0x3'),'required':!![],'message':_0x5e19('0x4')},'priorityTrue':{'type':'number','message':_0x5e19('0x5')},'priorityFalse':{'type':_0x5e19('0x6'),'message':_0x5e19('0x7')}});exports[_0x5e19('0x8')]=function(_0x20a99d,_0x4b4143){return function(_0x8dd8df){try{var _0x3d7a7e={'condition':htmlToText[_0x5e19('0x9')](utils[_0x5e19('0xa')](_0x4b4143[0x0],this),{'wordwrap':![]})[_0x5e19('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4b4143[0x1],'priorityFalse':_0x4b4143[0x2]};var _0x4d89fa=gotoif[_0x5e19('0x0')](_0x3d7a7e,{'typecast':!![]});if(_0x4d89fa[_0x5e19('0xc')]){logger[_0x5e19('0xd')](_0x5e19('0xe'),_0x20a99d,_[_0x5e19('0xf')](_0x4d89fa,_0x5e19('0x10'))[_0x5e19('0x11')](',\x20'));_0x8dd8df['stop']();}else{try{var _0x34c19e=eval('('+_0x3d7a7e[_0x5e19('0x12')]+')');var _0xa1d75b=_0x34c19e?_0x3d7a7e[_0x5e19('0x13')]:_0x3d7a7e[_0x5e19('0x14')];logger[_0x5e19('0x15')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x20a99d,_0x3d7a7e[_0x5e19('0x12')],_0x34c19e,_0xa1d75b||_0x5e19('0x16'));if(_0xa1d75b){var _0x2ff168=_[_0x5e19('0x17')](_0x8dd8df[_0x5e19('0x18')](),{'p':_0xa1d75b});if(_0x2ff168>=0x0){logger[_0x5e19('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x20a99d,_0xa1d75b||_0x5e19('0x16'),_0x2ff168);_0x8dd8df[_0x5e19('0x16')](_0x2ff168);}else{logger[_0x5e19('0x15')](_0x5e19('0x19'),_0x20a99d,_0xa1d75b||_0x5e19('0x16'));_0x8dd8df[_0x5e19('0x1a')]();}}else{_0x8dd8df[_0x5e19('0x16')]();}}catch(_0x36d992){logger[_0x5e19('0xd')](_0x5e19('0x1b'),_0x20a99d,_0x36d992[_0x5e19('0x10')]);_0x8dd8df[_0x5e19('0x1a')]();}}}catch(_0x594f61){logger['error'](_0x5e19('0xe'),_0x20a99d,JSON[_0x5e19('0x1c')](_0x594f61));_0x8dd8df[_0x5e19('0x1a')]();}};}; \ No newline at end of file +var _0x40da=['condition','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','[%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','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop'];(function(_0xf55e73,_0x3fecc5){var _0x116b99=function(_0x314e0c){while(--_0x314e0c){_0xf55e73['push'](_0xf55e73['shift']());}};_0x116b99(++_0x3fecc5);}(_0x40da,0x1c9));var _0xa40d=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x40da[_0x3ab51d];return _0x29a04e;};'use strict';var schema=require(_0xa40d('0x0'));var _=require(_0xa40d('0x1'));var htmlToText=require(_0xa40d('0x2'));var utils=require(_0xa40d('0x3'));var logger=require(_0xa40d('0x4'))(_0xa40d('0x5'));var gotoif=schema({'condition':{'type':_0xa40d('0x6'),'required':!![],'message':_0xa40d('0x7')},'priorityTrue':{'type':'number','message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':'number','message':'priority\x20false\x20is\x20a\x20number'}});exports['consequence']=function(_0x5ef273,_0x1dfeae){return function(_0x1e07c0){try{var _0x14bc3b={'condition':htmlToText[_0xa40d('0x8')](utils[_0xa40d('0x9')](_0x1dfeae[0x0],this),{'wordwrap':![]})[_0xa40d('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1dfeae[0x1],'priorityFalse':_0x1dfeae[0x2]};var _0x2af6b6=gotoif['validate'](_0x14bc3b,{'typecast':!![]});if(_0x2af6b6[_0xa40d('0xb')]){logger[_0xa40d('0xc')](_0xa40d('0xd'),_0x5ef273,_[_0xa40d('0xe')](_0x2af6b6,_0xa40d('0xf'))[_0xa40d('0x10')](',\x20'));_0x1e07c0[_0xa40d('0x11')]();}else{try{var _0x3e2fe3=eval('('+_0x14bc3b[_0xa40d('0x12')]+')');var _0x39c98d=_0x3e2fe3?_0x14bc3b['priorityTrue']:_0x14bc3b['priorityFalse'];logger[_0xa40d('0x13')](_0xa40d('0x14'),_0x5ef273,_0x14bc3b['condition'],_0x3e2fe3,_0x39c98d||_0xa40d('0x15'));if(_0x39c98d){var _0x50a163=_[_0xa40d('0x16')](_0x1e07c0['rules'](),{'p':_0x39c98d});if(_0x50a163>=0x0){logger[_0xa40d('0x13')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x5ef273,_0x39c98d||_0xa40d('0x15'),_0x50a163);_0x1e07c0[_0xa40d('0x15')](_0x50a163);}else{logger[_0xa40d('0x13')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x5ef273,_0x39c98d||_0xa40d('0x15'));_0x1e07c0['stop']();}}else{_0x1e07c0['next']();}}catch(_0x39ae6f){logger[_0xa40d('0xc')](_0xa40d('0x17'),_0x5ef273,_0x39ae6f[_0xa40d('0xf')]);_0x1e07c0[_0xa40d('0x11')]();}}}catch(_0x3dafe6){logger[_0xa40d('0xc')](_0xa40d('0xd'),_0x5ef273,JSON[_0xa40d('0x18')](_0x3dafe6));_0x1e07c0['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 e42669d..9651d69 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 _0x71fa=['[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','next','stringify','validate','lodash','../../../../config/logger','routing','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'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x71fa,0x164));var _0xa71f=function(_0x186582,_0x5ccf6f){_0x186582=_0x186582-0x0;var _0x1d3ee1=_0x71fa[_0x186582];return _0x1d3ee1;};'use strict';var schema=require(_0xa71f('0x0'));var _=require(_0xa71f('0x1'));var logger=require(_0xa71f('0x2'))(_0xa71f('0x3'));var gotop=schema({'priority':{'type':_0xa71f('0x4'),'required':!![],'message':_0xa71f('0x5')}});exports[_0xa71f('0x6')]=function(_0xf7832e,_0x735069){return function(_0x1aa1f1){try{var _0x82698a={'priority':_0x735069[0x0]};var _0x304f5d=gotop[_0xa71f('0x0')](_0x82698a,{'typecast':!![]});if(_0x304f5d[_0xa71f('0x7')]){logger[_0xa71f('0x8')](_0xa71f('0x9'),_0xf7832e,_[_0xa71f('0xa')](_0x304f5d,_0xa71f('0xb'))[_0xa71f('0xc')](',\x20'));_0x1aa1f1[_0xa71f('0xd')]();}else{logger[_0xa71f('0xe')](_0xa71f('0xf'),_0xf7832e,_0x82698a[_0xa71f('0x10')]);if(_0x82698a[_0xa71f('0x10')]){var _0x3676d4=_[_0xa71f('0x11')](_0x1aa1f1['rules'](),{'p':_0x82698a[_0xa71f('0x10')]});if(_0x3676d4>=0x0){logger['info'](_0xa71f('0x12'),_0xf7832e,_0x82698a[_0xa71f('0x10')]||'next',_0x3676d4);_0x1aa1f1['next'](_0x3676d4);}else{logger[_0xa71f('0xe')](_0xa71f('0x13'),_0xf7832e,_0x82698a['priority']||'next');_0x1aa1f1['stop']();}}else{_0x1aa1f1[_0xa71f('0x14')]();}}}catch(_0x27c75e){logger[_0xa71f('0x8')](_0xa71f('0x9'),_0xf7832e,JSON[_0xa71f('0x15')](_0x27c75e));_0x1aa1f1['stop']();}};}; \ No newline at end of file +var _0x4e44=['routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','next','info','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash'];(function(_0x41c4a2,_0x548350){var _0x423e6b=function(_0x5566f6){while(--_0x5566f6){_0x41c4a2['push'](_0x41c4a2['shift']());}};_0x423e6b(++_0x548350);}(_0x4e44,0xda));var _0x44e4=function(_0x18628f,_0x567533){_0x18628f=_0x18628f-0x0;var _0x365e85=_0x4e44[_0x18628f];return _0x365e85;};'use strict';var schema=require(_0x44e4('0x0'));var _=require(_0x44e4('0x1'));var logger=require('../../../../config/logger')(_0x44e4('0x2'));var gotop=schema({'priority':{'type':_0x44e4('0x3'),'required':!![],'message':_0x44e4('0x4')}});exports[_0x44e4('0x5')]=function(_0xdc77e0,_0x148e48){return function(_0x598582){try{var _0x4c722f={'priority':_0x148e48[0x0]};var _0x2697ea=gotop['validate'](_0x4c722f,{'typecast':!![]});if(_0x2697ea[_0x44e4('0x6')]){logger[_0x44e4('0x7')](_0x44e4('0x8'),_0xdc77e0,_[_0x44e4('0x9')](_0x2697ea,_0x44e4('0xa'))['join'](',\x20'));_0x598582[_0x44e4('0xb')]();}else{logger['info'](_0x44e4('0xc'),_0xdc77e0,_0x4c722f[_0x44e4('0xd')]);if(_0x4c722f[_0x44e4('0xd')]){var _0x176211=_[_0x44e4('0xe')](_0x598582[_0x44e4('0xf')](),{'p':_0x4c722f[_0x44e4('0xd')]});if(_0x176211>=0x0){logger['info']('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0xdc77e0,_0x4c722f[_0x44e4('0xd')]||_0x44e4('0x10'),_0x176211);_0x598582['next'](_0x176211);}else{logger[_0x44e4('0x11')](_0x44e4('0x12'),_0xdc77e0,_0x4c722f['priority']||_0x44e4('0x10'));_0x598582[_0x44e4('0xb')]();}}else{_0x598582[_0x44e4('0x10')]();}}}catch(_0x286355){logger[_0x44e4('0x7')]('[%s][GOTOP]\x20%s',_0xdc77e0,JSON[_0x44e4('0x13')](_0x286355));_0x598582[_0x44e4('0xb')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 4036358..df8b497 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 _0x6ae7=['interaction','Message','create','info','body','next','catch','[%s][MESSAGE]\x20%s','stringify','error','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','channel','ChatWebsiteId','account','upperFirst','AccountId','InteractionId'];(function(_0x5beab8,_0x3401e0){var _0x317f06=function(_0x160349){while(--_0x160349){_0x5beab8['push'](_0x5beab8['shift']());}};_0x317f06(++_0x3401e0);}(_0x6ae7,0x6e));var _0x76ae=function(_0x286b14,_0x4a6752){_0x286b14=_0x286b14-0x0;var _0x5c8102=_0x6ae7[_0x286b14];return _0x5c8102;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require(_0x76ae('0x0'))(_0x76ae('0x1'));var rpc={'chatMessage':require(_0x76ae('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x76ae('0x3')),'smsMessage':require(_0x76ae('0x4')),'faxMessage':require(_0x76ae('0x5')),'whatsappMessage':require(_0x76ae('0x6'))};exports[_0x76ae('0x7')]=function(_0x367b7f,_0x2059f4){return function(_0x537226){try{var _0x51e9f6={'body':utils[_0x76ae('0x8')](_0x2059f4[0x0],this),'ContactId':this['contact']['id']};if(this[_0x76ae('0x9')]==='chat'){_0x51e9f6[_0x76ae('0xa')]=this[_0x76ae('0xb')]['id'];}else{_0x51e9f6[_[_0x76ae('0xc')](this[_0x76ae('0x9')])+_0x76ae('0xd')]=this['account']['id'];}_0x51e9f6[_[_0x76ae('0xc')](this[_0x76ae('0x9')])+_0x76ae('0xe')]=this[_0x76ae('0xf')]['id'];if(rpc[this[_0x76ae('0x9')]+_0x76ae('0x10')]){return rpc[this[_0x76ae('0x9')]+_0x76ae('0x10')][_0x76ae('0x11')](_0x51e9f6)['then'](function(_0x4fb99e){logger[_0x76ae('0x12')]('[%s][MESSAGE]\x20%s',_0x367b7f,_0x51e9f6[_0x76ae('0x13')]);_0x537226[_0x76ae('0x14')]();})[_0x76ae('0x15')](function(_0x5ec601){logger['error'](_0x76ae('0x16'),_0x367b7f,JSON[_0x76ae('0x17')](_0x5ec601));_0x537226['stop']();});}}catch(_0xcff109){logger[_0x76ae('0x18')]('[%s][MESSAGE]\x20%s',_0x367b7f,JSON[_0x76ae('0x17')](_0xcff109));_0x537226['stop']();}};}; \ No newline at end of file +var _0x6ae2=['AccountId','InteractionId','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stop','stringify','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst'];(function(_0x537af5,_0x232170){var _0x43302e=function(_0x1027f7){while(--_0x1027f7){_0x537af5['push'](_0x537af5['shift']());}};_0x43302e(++_0x232170);}(_0x6ae2,0x1ed));var _0x26ae=function(_0x248a82,_0x4fca3e){_0x248a82=_0x248a82-0x0;var _0x4bef56=_0x6ae2[_0x248a82];return _0x4bef56;};'use strict';var _=require(_0x26ae('0x0'));var utils=require(_0x26ae('0x1'));var logger=require(_0x26ae('0x2'))(_0x26ae('0x3'));var rpc={'chatMessage':require(_0x26ae('0x4')),'openchannelMessage':require(_0x26ae('0x5')),'mailMessage':require(_0x26ae('0x6')),'smsMessage':require(_0x26ae('0x7')),'faxMessage':require(_0x26ae('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x26ae('0x9')]=function(_0x408677,_0x595da8){return function(_0x5609b0){try{var _0x13cb27={'body':utils[_0x26ae('0xa')](_0x595da8[0x0],this),'ContactId':this[_0x26ae('0xb')]['id']};if(this[_0x26ae('0xc')]===_0x26ae('0xd')){_0x13cb27[_0x26ae('0xe')]=this[_0x26ae('0xf')]['id'];}else{_0x13cb27[_[_0x26ae('0x10')](this[_0x26ae('0xc')])+_0x26ae('0x11')]=this[_0x26ae('0xf')]['id'];}_0x13cb27[_[_0x26ae('0x10')](this['channel'])+_0x26ae('0x12')]=this['interaction']['id'];if(rpc[this[_0x26ae('0xc')]+'Message']){return rpc[this['channel']+_0x26ae('0x13')][_0x26ae('0x14')](_0x13cb27)[_0x26ae('0x15')](function(_0x17f9a6){logger[_0x26ae('0x16')](_0x26ae('0x17'),_0x408677,_0x13cb27[_0x26ae('0x18')]);_0x5609b0[_0x26ae('0x19')]();})[_0x26ae('0x1a')](function(_0x52d611){logger[_0x26ae('0x1b')](_0x26ae('0x17'),_0x408677,JSON['stringify'](_0x52d611));_0x5609b0[_0x26ae('0x1c')]();});}}catch(_0x32cd9e){logger['error'](_0x26ae('0x17'),_0x408677,JSON[_0x26ae('0x1d')](_0x32cd9e));_0x5609b0[_0x26ae('0x1c')]();}};}; \ 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 c419b58..b5ea674 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 _0x66f2=['consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','./utils','../../../../config/logger','routing'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x66f2,0x8c));var _0x266f=function(_0x557a30,_0x433df5){_0x557a30=_0x557a30-0x0;var _0x2bf5f6=_0x66f2[_0x557a30];return _0x2bf5f6;};'use strict';var utils=require(_0x266f('0x0'));var logger=require(_0x266f('0x1'))(_0x266f('0x2'));exports[_0x266f('0x3')]=function(_0x5cf694,_0x57a8d9){return function(_0xa5535b){try{logger[_0x266f('0x4')](_0x266f('0x5'),_0x5cf694,utils[_0x266f('0x6')](_0x57a8d9[0x0],this));_0xa5535b[_0x266f('0x7')]();}catch(_0x26797f){logger[_0x266f('0x8')](_0x266f('0x5'),_0x5cf694,JSON[_0x266f('0x9')](_0x26797f));_0xa5535b[_0x266f('0xa')]();}};}; \ No newline at end of file +var _0x2876=['routing','consequence','info','[%s][NOOP]\x20%s','next','error','stringify','stop','./utils','../../../../config/logger'];(function(_0xdf1d1b,_0x3989a7){var _0x5da9e2=function(_0x2f3265){while(--_0x2f3265){_0xdf1d1b['push'](_0xdf1d1b['shift']());}};_0x5da9e2(++_0x3989a7);}(_0x2876,0xda));var _0x6287=function(_0x608e20,_0x2c546d){_0x608e20=_0x608e20-0x0;var _0x5f498a=_0x2876[_0x608e20];return _0x5f498a;};'use strict';var utils=require(_0x6287('0x0'));var logger=require(_0x6287('0x1'))(_0x6287('0x2'));exports[_0x6287('0x3')]=function(_0x33cc7b,_0x376d57){return function(_0x539f2e){try{logger[_0x6287('0x4')](_0x6287('0x5'),_0x33cc7b,utils['getMustacheRender'](_0x376d57[0x0],this));_0x539f2e[_0x6287('0x6')]();}catch(_0x3817b8){logger[_0x6287('0x7')](_0x6287('0x5'),_0x33cc7b,JSON[_0x6287('0x8')](_0x3817b8));_0x539f2e[_0x6287('0x9')]();}};}; \ 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 63de168..79ff85f 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 _0x515f=['[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','ioredis','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','contact','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','AccountId','WebsiteId','info','name','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','join','stop','Queues','timeout','createQueue','qtimeout','rules','end','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x515f,0xe3));var _0xf515=function(_0xdb4e73,_0x30b446){_0xdb4e73=_0xdb4e73-0x0;var _0x4578b4=_0x515f[_0xdb4e73];return _0x4578b4;};'use strict';var schema=require(_0xf515('0x0'));var _=require('lodash');var util=require(_0xf515('0x1'));var seqqueue=require(_0xf515('0x2'));var moment=require('moment');var Redis=require(_0xf515('0x3'));var config=require('../../../../config/environment');var logger=require(_0xf515('0x4'))(_0xf515('0x5'));var strategy=require(_0xf515('0x6'));config[_0xf515('0x7')]=_[_0xf515('0x8')](config['redis'],{'host':_0xf515('0x9'),'port':0x18eb});var io=require(_0xf515('0xa'))(new Redis(config[_0xf515('0x7')]));var attributes=['id',_0xf515('0xb'),_0xf515('0xc'),_0xf515('0xd'),_0xf515('0xe'),_0xf515('0xf')];function emit(_0x30644b,_0x472d1d,_0x79cfc0){io['to'](_0x30644b)[_0xf515('0x10')](_0x472d1d,_0x79cfc0);}function emitChannelQueueInteraction(_0x3dab36,_0x305109,_0x4ae2ed,_0x44de2b,_0x3947f8,_0x4a582b,_0x19fdcd,_0x124137){var _0x28640a=_[_0xf515('0x11')](_0x4ae2ed);_0x28640a[_0xf515('0xb')]=_0x124137;_0x28640a[_0xf515('0xd')]=_0x305109;_0x28640a[_0xf515('0xc')]=_0x44de2b;_0x28640a['id']=_0x3947f8;if(_0x4a582b){_0x19fdcd[util['format'](_0xf515('0x12'),_0x3dab36)][_0x3947f8]=_[_0xf515('0x13')](_0x28640a,attributes);}else{delete _0x19fdcd[util[_0xf515('0x14')](_0xf515('0x12'),_0x3dab36)][_0x3947f8];}emit(util[_0xf515('0x14')](_0xf515('0x15'),_0x3dab36,_0x305109),util[_0xf515('0x14')]('%s_queue_waiting_interaction:%s',_0x3dab36,_0x4a582b?_0xf515('0x16'):_0xf515('0x17')),_[_0xf515('0x13')](_0x28640a,attributes));}var rpc={'openchannelQueueReport':require(_0xf515('0x18')),'mailQueueReport':require(_0xf515('0x19')),'chatQueueReport':require(_0xf515('0x1a')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0xf515('0x1b')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xf515('0x1c'),'required':!![],'message':_0xf515('0x1d')},'timeout':{'type':_0xf515('0x1e'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x21d962,_0x22c6f5,_0x286a94,_0x2a1ed0){if(_0x21d962&&_0x22c6f5&&_0x286a94){_0x22c6f5[_0xf515('0x1f')]+=0x1;var _0xe8b327={'uniqueid':_0x21d962,'from':_0x286a94['body']?_0x286a94[_0xf515('0x20')]['from']:'','joinAt':moment()[_0xf515('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x286a94[_0xf515('0x21')]?_0x286a94[_0xf515('0x21')]['id']:null,'ListId':_0x286a94['list']?_0x286a94['list']['id']:null};_0xe8b327[_[_0xf515('0x22')](_0x286a94[_0xf515('0x23')])+_0xf515('0x24')]=_0x22c6f5['id']||null;_0xe8b327[_['upperFirst'](_0x286a94['channel'])+_0xf515('0x25')]=_0x286a94[_0xf515('0x26')]?_0x286a94['interaction']['id']:null;_0xe8b327[_['upperFirst'](_0x286a94[_0xf515('0x23')])+_0xf515('0x27')]=_0x286a94[_0xf515('0x28')]?_0x286a94[_0xf515('0x28')]['id']:null;_0xe8b327[_['upperFirst'](_0x286a94[_0xf515('0x23')])+(_0x286a94[_0xf515('0x23')]!=='chat'?_0xf515('0x29'):_0xf515('0x2a'))]=_0x286a94[_0xf515('0xc')]?_0x286a94['account']['id']:null;logger[_0xf515('0x2b')](util['format']('[%s][START:QUEUE][NAME:%s]',_0x21d962,_0x22c6f5[_0xf515('0x2c')]));emitChannelQueueInteraction(_0x286a94[_0xf515('0x23')],_0x22c6f5[_0xf515('0x2c')],_0xe8b327,_0x286a94[_0xf515('0xc')][_0xf515('0x2c')],_0x286a94['message']['id'],!![],_0x2a1ed0,_0x22c6f5['id']);if(rpc[_0x286a94[_0xf515('0x23')]+_0xf515('0x2d')]){return rpc[_0x286a94[_0xf515('0x23')]+_0xf515('0x2d')][_0xf515('0x2e')](_0xe8b327)[_0xf515('0x2f')](function(_0x36fa68){logger[_0xf515('0x30')](_0xf515('0x31'));});}}}function stopRouting(_0x12aa63,_0x4584b2,_0x18d366,_0x31e7b6){if(_0x12aa63&&_0x4584b2){_0x4584b2['waiting']-=0x1;var _0x45fb3a={'leaveAt':moment()['format'](_0xf515('0x32')),'acceptAt':moment()[_0xf515('0x14')](_0xf515('0x32')),'reason':_0xf515('0x33')};logger[_0xf515('0x2b')](util['format'](_0xf515('0x34'),_0x12aa63,_0x4584b2[_0xf515('0x2c')]));emitChannelQueueInteraction(_0x18d366[_0xf515('0x23')],_0x4584b2[_0xf515('0x2c')],_0x18d366[_0xf515('0x20')],_0x18d366[_0xf515('0xc')][_0xf515('0x2c')],_0x18d366[_0xf515('0x28')]['id'],![],_0x31e7b6,_0x4584b2['id']);if(rpc[_0x18d366[_0xf515('0x23')]+_0xf515('0x2d')]){return rpc[_0x18d366[_0xf515('0x23')]+_0xf515('0x2d')]['update'](_0x12aa63,_0x45fb3a)[_0xf515('0x2f')](function(_0x2d32b5){logger[_0xf515('0x30')](_0xf515('0x35'));});}}}function endRouting(_0x282a04,_0x24ab75,_0x1c2c33,_0x47d138){if(_0x282a04&&_0x24ab75){_0x24ab75[_0xf515('0x1f')]-=0x1;var _0x26f81a={'leaveAt':moment()[_0xf515('0x14')](_0xf515('0x32')),'exitAt':moment()[_0xf515('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger[_0xf515('0x2b')](util[_0xf515('0x14')](_0xf515('0x36'),_0x282a04,_0x24ab75[_0xf515('0x2c')]));emitChannelQueueInteraction(_0x1c2c33[_0xf515('0x23')],_0x24ab75[_0xf515('0x2c')],_0x1c2c33[_0xf515('0x20')],_0x1c2c33['account'][_0xf515('0x2c')],_0x1c2c33[_0xf515('0x28')]['id'],![],_0x47d138);if(rpc[_0x1c2c33[_0xf515('0x23')]+_0xf515('0x2d')]){return rpc[_0x1c2c33['channel']+_0xf515('0x2d')][_0xf515('0x37')](_0x282a04,_0x26f81a)['catch'](function(_0x3097f1){logger['error']('update\x20queue\x20report');});}}}function handleFindQueue(_0x698ddb){return function(_0x598410){return _0x598410['name']['toLowerCase']()===_0x698ddb[_0xf515('0x38')]();};}exports['consequence']=function(_0x3eba7f,_0x122f18,_0x33a100,_0x5f465c){return function(_0x58df7d){try{var _0x5adf5c={'name':_0x122f18[0x0],'timeout':_0x122f18[0x1]};var _0x2e6a74=queue[_0xf515('0x0')](_0x5adf5c,{'typecast':!![]});if(_0x2e6a74['length']){logger['error']('[%s][QUEUE]\x20%s',_0x3eba7f,_['map'](_0x2e6a74,'message')[_0xf515('0x39')](',\x20'));_0x58df7d[_0xf515('0x3a')]();}else{var _0x36ddb7=_['find'](_0x33a100[_0x5f465c['channel']+_0xf515('0x3b')],handleFindQueue(_0x5adf5c[_0xf515('0x2c')]));if(_0x36ddb7){startRouting(_0x3eba7f,_0x36ddb7,_0x5f465c,_0x33a100);var _0xebcae0=(_0x36ddb7[_0xf515('0x3c')]||0xa)*0x3e8;var _0x34a27c=(_0x5adf5c['timeout']||0x14)*0x3e8;var _0x1bd551,_0x2c7b69;if(_0xebcae0>_0x34a27c){_0x34a27c=_0xebcae0;}var _0x16570d=seqqueue[_0xf515('0x3d')](_0xebcae0);_0x16570d['id']=_0x3eba7f;_0x16570d['atimeout']=_0xebcae0;_0x16570d[_0xf515('0x3e')]=_0x34a27c;_0x16570d[_0xf515('0x23')]=_0x5f465c[_0xf515('0x23')];_0x33a100[_0xf515('0x3f')][_0x3eba7f]['on'](_0xf515('0x40'),function(){logger[_0xf515('0x2b')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x3eba7f);stopRouting(_0x3eba7f,_0x36ddb7,_0x5f465c,_0x33a100);clearTimeout(_0x1bd551);_0x1bd551=undefined;_0x16570d[_0xf515('0x41')](!![]);if(_0x33a100[_0xf515('0x3f')][_0x3eba7f]){delete _0x33a100[_0xf515('0x3f')][_0x3eba7f];}_0x58df7d[_0xf515('0x3a')]();});_0x33a100[_0xf515('0x3f')][_0x3eba7f]['on'](_0xf515('0x42'),function(){if(_0x33a100['rules'][_0x3eba7f]){delete _0x33a100['rules'][_0x3eba7f];}});_0x1bd551=setTimeout(function(){logger[_0xf515('0x2b')](_0xf515('0x43'),_0x3eba7f);endRouting(_0x3eba7f,_0x36ddb7,_0x5f465c,_0x33a100);clearTimeout(_0x1bd551);_0x16570d[_0xf515('0x41')](!![]);_0x58df7d[_0xf515('0x44')]();},_0x34a27c);switch(_0x36ddb7[_0xf515('0x45')]){case _0xf515('0x46'):strategy['rrmemory'](_0x16570d,_0x36ddb7,_0x33a100,_0x5f465c);break;default:strategy[_0xf515('0x47')](_0x16570d,_0x36ddb7,_0x33a100,_0x5f465c);}}else{logger[_0xf515('0x30')](_0xf515('0x48'),_0x3eba7f,_0x5adf5c[_0xf515('0x2c')]);_0x58df7d[_0xf515('0x3a')]();}}}catch(_0x2bf722){console['log'](_0x2bf722);logger['error'](_0xf515('0x49'),_0x3eba7f,_0x2bf722[_0xf515('0x4a')]);_0x58df7d[_0xf515('0x3a')]();}};}; \ No newline at end of file +var _0x96b8=['format','%sQueuesWaitingInteractions','%s_queue_waiting_interaction:%s','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','AccountId','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','length','stop','find','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','moment','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','queue_id','account','joinAt','emit','clone','queue'];(function(_0xd55348,_0x499fa0){var _0x524001=function(_0x204a8f){while(--_0x204a8f){_0xd55348['push'](_0xd55348['shift']());}};_0x524001(++_0x499fa0);}(_0x96b8,0x179));var _0x896b=function(_0x2786b3,_0x8e6d26){_0x2786b3=_0x2786b3-0x0;var _0x34223e=_0x96b8[_0x2786b3];return _0x34223e;};'use strict';var schema=require(_0x896b('0x0'));var _=require(_0x896b('0x1'));var util=require(_0x896b('0x2'));var seqqueue=require(_0x896b('0x3'));var moment=require(_0x896b('0x4'));var Redis=require('ioredis');var config=require(_0x896b('0x5'));var logger=require(_0x896b('0x6'))(_0x896b('0x7'));var strategy=require(_0x896b('0x8'));config[_0x896b('0x9')]=_[_0x896b('0xa')](config[_0x896b('0x9')],{'host':_0x896b('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var attributes=['id',_0x896b('0xc'),_0x896b('0xd'),'queue','from',_0x896b('0xe')];function emit(_0x6230bc,_0x1e6371,_0x5f1c27){io['to'](_0x6230bc)[_0x896b('0xf')](_0x1e6371,_0x5f1c27);}function emitChannelQueueInteraction(_0x44419f,_0x49700a,_0x5d31af,_0x367879,_0x49b6a9,_0x15eed3,_0x5c8900,_0x33c9f1){var _0x4d4528=_[_0x896b('0x10')](_0x5d31af);_0x4d4528[_0x896b('0xc')]=_0x33c9f1;_0x4d4528[_0x896b('0x11')]=_0x49700a;_0x4d4528[_0x896b('0xd')]=_0x367879;_0x4d4528['id']=_0x49b6a9;if(_0x15eed3){_0x5c8900[util[_0x896b('0x12')](_0x896b('0x13'),_0x44419f)][_0x49b6a9]=_['pick'](_0x4d4528,attributes);}else{delete _0x5c8900[util[_0x896b('0x12')](_0x896b('0x13'),_0x44419f)][_0x49b6a9];}emit(util[_0x896b('0x12')]('%s:queue:%s',_0x44419f,_0x49700a),util[_0x896b('0x12')](_0x896b('0x14'),_0x44419f,_0x15eed3?'save':'remove'),_[_0x896b('0x15')](_0x4d4528,attributes));}var rpc={'openchannelQueueReport':require(_0x896b('0x16')),'mailQueueReport':require(_0x896b('0x17')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x896b('0x18')),'faxQueueReport':require(_0x896b('0x19')),'whatsappQueueReport':require(_0x896b('0x1a'))};var queue=schema({'name':{'type':_0x896b('0x1b'),'required':!![],'message':_0x896b('0x1c')},'timeout':{'type':_0x896b('0x1d'),'message':_0x896b('0x1e')}});function startRouting(_0x41c305,_0x1831e0,_0x56a9e3,_0x111532){if(_0x41c305&&_0x1831e0&&_0x56a9e3){_0x1831e0[_0x896b('0x1f')]+=0x1;var _0x3166c5={'uniqueid':_0x41c305,'from':_0x56a9e3[_0x896b('0x20')]?_0x56a9e3['body'][_0x896b('0x21')]:'','joinAt':moment()[_0x896b('0x12')](_0x896b('0x22')),'ContactId':_0x56a9e3[_0x896b('0x23')]?_0x56a9e3[_0x896b('0x23')]['id']:null,'ListId':_0x56a9e3[_0x896b('0x24')]?_0x56a9e3[_0x896b('0x24')]['id']:null};_0x3166c5[_[_0x896b('0x25')](_0x56a9e3[_0x896b('0x26')])+_0x896b('0x27')]=_0x1831e0['id']||null;_0x3166c5[_['upperFirst'](_0x56a9e3[_0x896b('0x26')])+_0x896b('0x28')]=_0x56a9e3[_0x896b('0x29')]?_0x56a9e3[_0x896b('0x29')]['id']:null;_0x3166c5[_[_0x896b('0x25')](_0x56a9e3[_0x896b('0x26')])+_0x896b('0x2a')]=_0x56a9e3['message']?_0x56a9e3[_0x896b('0x2b')]['id']:null;_0x3166c5[_[_0x896b('0x25')](_0x56a9e3[_0x896b('0x26')])+(_0x56a9e3[_0x896b('0x26')]!==_0x896b('0x2c')?_0x896b('0x2d'):'WebsiteId')]=_0x56a9e3[_0x896b('0xd')]?_0x56a9e3['account']['id']:null;logger[_0x896b('0x2e')](util[_0x896b('0x12')](_0x896b('0x2f'),_0x41c305,_0x1831e0[_0x896b('0x30')]));emitChannelQueueInteraction(_0x56a9e3['channel'],_0x1831e0[_0x896b('0x30')],_0x3166c5,_0x56a9e3[_0x896b('0xd')][_0x896b('0x30')],_0x56a9e3[_0x896b('0x2b')]['id'],!![],_0x111532,_0x1831e0['id']);if(rpc[_0x56a9e3[_0x896b('0x26')]+'QueueReport']){return rpc[_0x56a9e3[_0x896b('0x26')]+_0x896b('0x31')][_0x896b('0x32')](_0x3166c5)[_0x896b('0x33')](function(_0x44818){logger[_0x896b('0x34')](_0x896b('0x35'));});}}}function stopRouting(_0x36b086,_0x2ce31b,_0x2777a0,_0x4dae43){if(_0x36b086&&_0x2ce31b){_0x2ce31b[_0x896b('0x1f')]-=0x1;var _0x185724={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x896b('0x12')](_0x896b('0x22')),'reason':_0x896b('0x36')};logger['info'](util[_0x896b('0x12')](_0x896b('0x37'),_0x36b086,_0x2ce31b[_0x896b('0x30')]));emitChannelQueueInteraction(_0x2777a0['channel'],_0x2ce31b[_0x896b('0x30')],_0x2777a0[_0x896b('0x20')],_0x2777a0[_0x896b('0xd')][_0x896b('0x30')],_0x2777a0[_0x896b('0x2b')]['id'],![],_0x4dae43,_0x2ce31b['id']);if(rpc[_0x2777a0[_0x896b('0x26')]+_0x896b('0x31')]){return rpc[_0x2777a0[_0x896b('0x26')]+_0x896b('0x31')][_0x896b('0x38')](_0x36b086,_0x185724)['catch'](function(_0x5e5fea){logger['error'](_0x896b('0x39'));});}}}function endRouting(_0x310893,_0x2d8397,_0xd96cc2,_0x3f7588){if(_0x310893&&_0x2d8397){_0x2d8397['waiting']-=0x1;var _0x5691c6={'leaveAt':moment()['format'](_0x896b('0x22')),'exitAt':moment()[_0x896b('0x12')](_0x896b('0x22')),'reason':_0x896b('0x3a')};logger[_0x896b('0x2e')](util[_0x896b('0x12')](_0x896b('0x3b'),_0x310893,_0x2d8397[_0x896b('0x30')]));emitChannelQueueInteraction(_0xd96cc2[_0x896b('0x26')],_0x2d8397[_0x896b('0x30')],_0xd96cc2['body'],_0xd96cc2[_0x896b('0xd')][_0x896b('0x30')],_0xd96cc2[_0x896b('0x2b')]['id'],![],_0x3f7588);if(rpc[_0xd96cc2['channel']+_0x896b('0x31')]){return rpc[_0xd96cc2[_0x896b('0x26')]+_0x896b('0x31')][_0x896b('0x38')](_0x310893,_0x5691c6)[_0x896b('0x33')](function(_0x466587){logger[_0x896b('0x34')](_0x896b('0x39'));});}}}function handleFindQueue(_0x101589){return function(_0x15a35b){return _0x15a35b[_0x896b('0x30')][_0x896b('0x3c')]()===_0x101589[_0x896b('0x3c')]();};}exports[_0x896b('0x3d')]=function(_0x5e3b6f,_0x25f97e,_0x534184,_0x495a2e){return function(_0x29fded){try{var _0x357c21={'name':_0x25f97e[0x0],'timeout':_0x25f97e[0x1]};var _0x49f9af=queue['validate'](_0x357c21,{'typecast':!![]});if(_0x49f9af[_0x896b('0x3e')]){logger[_0x896b('0x34')]('[%s][QUEUE]\x20%s',_0x5e3b6f,_['map'](_0x49f9af,_0x896b('0x2b'))['join'](',\x20'));_0x29fded[_0x896b('0x3f')]();}else{var _0x140943=_[_0x896b('0x40')](_0x534184[_0x495a2e['channel']+'Queues'],handleFindQueue(_0x357c21[_0x896b('0x30')]));if(_0x140943){startRouting(_0x5e3b6f,_0x140943,_0x495a2e,_0x534184);var _0x3a36d7=(_0x140943[_0x896b('0x3a')]||0xa)*0x3e8;var _0x3fb08a=(_0x357c21[_0x896b('0x3a')]||0x14)*0x3e8;var _0x212d00,_0x3560a7;if(_0x3a36d7>_0x3fb08a){_0x3fb08a=_0x3a36d7;}var _0x5ae1d9=seqqueue['createQueue'](_0x3a36d7);_0x5ae1d9['id']=_0x5e3b6f;_0x5ae1d9[_0x896b('0x41')]=_0x3a36d7;_0x5ae1d9[_0x896b('0x42')]=_0x3fb08a;_0x5ae1d9[_0x896b('0x26')]=_0x495a2e['channel'];_0x534184[_0x896b('0x43')][_0x5e3b6f]['on'](_0x896b('0x44'),function(){logger[_0x896b('0x2e')](_0x896b('0x45'),_0x5e3b6f);stopRouting(_0x5e3b6f,_0x140943,_0x495a2e,_0x534184);clearTimeout(_0x212d00);_0x212d00=undefined;_0x5ae1d9[_0x896b('0x46')](!![]);if(_0x534184['rules'][_0x5e3b6f]){delete _0x534184['rules'][_0x5e3b6f];}_0x29fded['stop']();});_0x534184['rules'][_0x5e3b6f]['on'](_0x896b('0x47'),function(){if(_0x534184[_0x896b('0x43')][_0x5e3b6f]){delete _0x534184['rules'][_0x5e3b6f];}});_0x212d00=setTimeout(function(){logger[_0x896b('0x2e')](_0x896b('0x48'),_0x5e3b6f);endRouting(_0x5e3b6f,_0x140943,_0x495a2e,_0x534184);clearTimeout(_0x212d00);_0x5ae1d9['close'](!![]);_0x29fded[_0x896b('0x49')]();},_0x3fb08a);switch(_0x140943[_0x896b('0x4a')]){case _0x896b('0x4b'):strategy[_0x896b('0x4b')](_0x5ae1d9,_0x140943,_0x534184,_0x495a2e);break;default:strategy['beepall'](_0x5ae1d9,_0x140943,_0x534184,_0x495a2e);}}else{logger[_0x896b('0x34')](_0x896b('0x4c'),_0x5e3b6f,_0x357c21['name']);_0x29fded['stop']();}}}catch(_0x4dd3fa){console['log'](_0x4dd3fa);logger['error'](_0x896b('0x4d'),_0x5e3b6f,_0x4dd3fa[_0x896b('0x4e')]);_0x29fded['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 9af877c..78d1aaf 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 _0x5f9d=['push','handleRun','handleTimeout','timeout','drained','handleDrained','bind','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','busyQueue','showNotification','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','busy','writeLog','STOP','exports','lodash','uuid','notificationId','agent','realtime','routing','squeue'];(function(_0x2b86a5,_0x259e3c){var _0x2e0b61=function(_0x31cb94){while(--_0x31cb94){_0x2b86a5['push'](_0x2b86a5['shift']());}};_0x2e0b61(++_0x259e3c);}(_0x5f9d,0x1e9));var _0xd5f9=function(_0x1e8f96,_0x4e097f){_0x1e8f96=_0x1e8f96-0x0;var _0x29ea45=_0x5f9d[_0x1e8f96];return _0x29ea45;};'use strict';var _=require(_0xd5f9('0x0'));var uuid=require(_0xd5f9('0x1'));var util=require('./util');var logger=require('../../../../../config/logger')('routing');var Agent=function(_0x1c308e,_0x3326f3,_0xc1e92a,_0x15ba24){this[_0xd5f9('0x2')]=uuid['v4']();this['squeue']=_0x1c308e;this[_0xd5f9('0x3')]=_0x3326f3;this[_0xd5f9('0x4')]=_0xc1e92a;this[_0xd5f9('0x5')]=_0x15ba24;this[_0xd5f9('0x6')][_0xd5f9('0x7')](this[_0xd5f9('0x8')]['bind'](this),this[_0xd5f9('0x9')]['bind'](this));this[_0xd5f9('0x6')]['on'](_0xd5f9('0xa'),this[_0xd5f9('0x9')]['bind'](this));this[_0xd5f9('0x6')]['on'](_0xd5f9('0xb'),this[_0xd5f9('0xc')]['bind'](this));};Agent['prototype'][_0xd5f9('0x7')]=function(){this['squeue'][_0xd5f9('0x7')](this[_0xd5f9('0x8')]['bind'](this),this[_0xd5f9('0x9')][_0xd5f9('0xd')](this));};Agent[_0xd5f9('0xe')][_0xd5f9('0xc')]=function(){this['handleTimeout'](!![]);};Agent[_0xd5f9('0xe')][_0xd5f9('0x8')]=function(_0x3d9863){logger[_0xd5f9('0xf')](_0xd5f9('0x10'),this['squeue']['id'],this[_0xd5f9('0x3')]['id']);if(_[_0xd5f9('0x11')](this['realtime'][_0xd5f9('0x12')][this[_0xd5f9('0x3')]['id']])){logger[_0xd5f9('0xf')](_0xd5f9('0x13'),this[_0xd5f9('0x6')]['id'],this[_0xd5f9('0x3')]['id']);setTimeout(this['push'][_0xd5f9('0xd')](this),0x3e8);}else{if(this['routing'][_0xd5f9('0x14')]||util['isAgentAvailable'](this[_0xd5f9('0x6')]['id'],this[_0xd5f9('0x4')][_0xd5f9('0x12')][this[_0xd5f9('0x3')]['id']],this[_0xd5f9('0x6')][_0xd5f9('0x15')],![])){this[_0xd5f9('0x4')][_0xd5f9('0x12')][this[_0xd5f9('0x3')]['id']]['busy']=!![];this['realtime'][_0xd5f9('0x12')][this['agent']['id']][_0xd5f9('0x16')]=undefined;util[_0xd5f9('0x17')](this['notificationId'],this[_0xd5f9('0x6')]['id'],this[_0xd5f9('0x4')][_0xd5f9('0x12')][this[_0xd5f9('0x3')]['id']],null,this[_0xd5f9('0x5')]);util['writeLog'](this[_0xd5f9('0x6')]['id'],this['realtime'][_0xd5f9('0x12')][this['agent']['id']],_0xd5f9('0x18')+(this[_0xd5f9('0x5')][_0xd5f9('0x14')]?':FORCED':''));}else{logger[_0xd5f9('0xf')](_0xd5f9('0x19'),this[_0xd5f9('0x6')]['id'],this[_0xd5f9('0x3')]['id']);setTimeout(this['push'][_0xd5f9('0xd')](this),0x3e8);}}};Agent[_0xd5f9('0xe')][_0xd5f9('0x9')]=function(_0x190ac5){if(_[_0xd5f9('0x11')](this['realtime'][_0xd5f9('0x12')][this[_0xd5f9('0x3')]['id']])){return logger[_0xd5f9('0xf')](_0xd5f9('0x13'),this[_0xd5f9('0x6')]['id'],this['agent']['id']);}else{logger[_0xd5f9('0xf')]('[%s][AGENT]\x20timeout\x20with\x20%s',this['squeue']['id'],this[_0xd5f9('0x3')]['id']);util[_0xd5f9('0x1a')](this[_0xd5f9('0x2')],this[_0xd5f9('0x6')]['id'],this['realtime']['agents'][this[_0xd5f9('0x3')]['id']],null,this['routing']);this['realtime'][_0xd5f9('0x12')][this[_0xd5f9('0x3')]['id']][_0xd5f9('0x1b')]=![];this[_0xd5f9('0x4')]['agents'][this[_0xd5f9('0x3')]['id']][_0xd5f9('0x16')]=undefined;util[_0xd5f9('0x1c')](this[_0xd5f9('0x6')]['id'],this['realtime'][_0xd5f9('0x12')][this[_0xd5f9('0x3')]['id']],_0x190ac5?_0xd5f9('0x1d'):'TIMEOUT');}if(!_0x190ac5){setTimeout(this[_0xd5f9('0x7')]['bind'](this),0x3e8);}};function agent(_0x47f770,_0x1853d3,_0x327691,_0x541a11){return new Agent(_0x47f770,_0x1853d3,_0x327691,_0x541a11);}module[_0xd5f9('0x1e')]=agent; \ No newline at end of file +var _0xf6f6=['[%s][AGENT]\x20try\x20with\x20%s','isNil','isAgentAvailable','channel','agents','busy','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','STOP','TIMEOUT','exports','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','handleTimeout','bind','timeout','drained','handleDrained','prototype','info'];(function(_0x15e0d6,_0x4225ef){var _0x53e8bd=function(_0x26d1a0){while(--_0x26d1a0){_0x15e0d6['push'](_0x15e0d6['shift']());}};_0x53e8bd(++_0x4225ef);}(_0xf6f6,0x15a));var _0x6f6f=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xf6f6[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require('lodash');var uuid=require(_0x6f6f('0x0'));var util=require(_0x6f6f('0x1'));var logger=require(_0x6f6f('0x2'))(_0x6f6f('0x3'));var Agent=function(_0x16ef66,_0x456d77,_0x2659b5,_0x2731fa){this[_0x6f6f('0x4')]=uuid['v4']();this[_0x6f6f('0x5')]=_0x16ef66;this[_0x6f6f('0x6')]=_0x456d77;this[_0x6f6f('0x7')]=_0x2659b5;this[_0x6f6f('0x3')]=_0x2731fa;this['squeue'][_0x6f6f('0x8')](this[_0x6f6f('0x9')]['bind'](this),this[_0x6f6f('0xa')][_0x6f6f('0xb')](this));this[_0x6f6f('0x5')]['on'](_0x6f6f('0xc'),this[_0x6f6f('0xa')]['bind'](this));this['squeue']['on'](_0x6f6f('0xd'),this[_0x6f6f('0xe')]['bind'](this));};Agent[_0x6f6f('0xf')][_0x6f6f('0x8')]=function(){this['squeue']['push'](this[_0x6f6f('0x9')][_0x6f6f('0xb')](this),this[_0x6f6f('0xa')][_0x6f6f('0xb')](this));};Agent[_0x6f6f('0xf')][_0x6f6f('0xe')]=function(){this['handleTimeout'](!![]);};Agent[_0x6f6f('0xf')][_0x6f6f('0x9')]=function(_0x3aaaf2){logger[_0x6f6f('0x10')](_0x6f6f('0x11'),this[_0x6f6f('0x5')]['id'],this['agent']['id']);if(_[_0x6f6f('0x12')](this[_0x6f6f('0x7')]['agents'][this[_0x6f6f('0x6')]['id']])){logger[_0x6f6f('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x6f6f('0x5')]['id'],this[_0x6f6f('0x6')]['id']);setTimeout(this[_0x6f6f('0x8')][_0x6f6f('0xb')](this),0x3e8);}else{if(this[_0x6f6f('0x3')]['forcedOwnership']||util[_0x6f6f('0x13')](this[_0x6f6f('0x5')]['id'],this[_0x6f6f('0x7')]['agents'][this[_0x6f6f('0x6')]['id']],this[_0x6f6f('0x5')][_0x6f6f('0x14')],![])){this[_0x6f6f('0x7')][_0x6f6f('0x15')][this['agent']['id']][_0x6f6f('0x16')]=!![];this['realtime'][_0x6f6f('0x15')][this[_0x6f6f('0x6')]['id']][_0x6f6f('0x17')]=undefined;util[_0x6f6f('0x18')](this['notificationId'],this[_0x6f6f('0x5')]['id'],this['realtime'][_0x6f6f('0x15')][this[_0x6f6f('0x6')]['id']],null,this[_0x6f6f('0x3')]);util[_0x6f6f('0x19')](this[_0x6f6f('0x5')]['id'],this[_0x6f6f('0x7')]['agents'][this[_0x6f6f('0x6')]['id']],_0x6f6f('0x1a')+(this[_0x6f6f('0x3')]['forcedOwnership']?_0x6f6f('0x1b'):''));}else{logger[_0x6f6f('0x10')](_0x6f6f('0x1c'),this[_0x6f6f('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x6f6f('0x8')][_0x6f6f('0xb')](this),0x3e8);}}};Agent[_0x6f6f('0xf')]['handleTimeout']=function(_0x4fbcdd){if(_[_0x6f6f('0x12')](this[_0x6f6f('0x7')][_0x6f6f('0x15')][this[_0x6f6f('0x6')]['id']])){return logger[_0x6f6f('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x6f6f('0x5')]['id'],this[_0x6f6f('0x6')]['id']);}else{logger['info'](_0x6f6f('0x1d'),this[_0x6f6f('0x5')]['id'],this[_0x6f6f('0x6')]['id']);util['hideNotification'](this[_0x6f6f('0x4')],this[_0x6f6f('0x5')]['id'],this[_0x6f6f('0x7')][_0x6f6f('0x15')][this[_0x6f6f('0x6')]['id']],null,this['routing']);this[_0x6f6f('0x7')][_0x6f6f('0x15')][this['agent']['id']][_0x6f6f('0x16')]=![];this[_0x6f6f('0x7')][_0x6f6f('0x15')][this[_0x6f6f('0x6')]['id']]['busyQueue']=undefined;util[_0x6f6f('0x19')](this[_0x6f6f('0x5')]['id'],this[_0x6f6f('0x7')][_0x6f6f('0x15')][this[_0x6f6f('0x6')]['id']],_0x4fbcdd?_0x6f6f('0x1e'):_0x6f6f('0x1f'));}if(!_0x4fbcdd){setTimeout(this['push'][_0x6f6f('0xb')](this),0x3e8);}};function agent(_0x8e3a89,_0x2d9202,_0x586d52,_0x288b75){return new Agent(_0x8e3a89,_0x2d9202,_0x586d52,_0x288b75);}module[_0x6f6f('0x20')]=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 6a0af6c..f240b3e 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 _0xcdd0=['channel','writeLog','RINGING','busyQueue','name','showNotification','notificationId','routing','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','length','hideNotification','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','squeue','queue','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','isNil','Agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','agents'];(function(_0x23654d,_0x3f5c77){var _0x239b3f=function(_0x5258c5){while(--_0x5258c5){_0x23654d['push'](_0x23654d['shift']());}};_0x239b3f(++_0x3f5c77);}(_0xcdd0,0xd9));var _0x0cdd=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xcdd0[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0x0cdd('0x0'));var uuid=require(_0x0cdd('0x1'));var util=require(_0x0cdd('0x2'));var logger=require(_0x0cdd('0x3'))('routing');var Beepall=function(_0x167a54,_0x5b97f9,_0x47eb4d,_0x2ff2d3){this['notificationId']=uuid['v4']();this[_0x0cdd('0x4')]=_0x167a54;this[_0x0cdd('0x5')]=_0x5b97f9;this[_0x0cdd('0x6')]=_0x47eb4d;this['routing']=_0x2ff2d3;this[_0x0cdd('0x4')][_0x0cdd('0x7')](this[_0x0cdd('0x8')][_0x0cdd('0x9')](this),this[_0x0cdd('0xa')][_0x0cdd('0x9')](this));this[_0x0cdd('0x4')]['on'](_0x0cdd('0xb'),this[_0x0cdd('0xa')][_0x0cdd('0x9')](this));this[_0x0cdd('0x4')]['on'](_0x0cdd('0xc'),this[_0x0cdd('0xd')]['bind'](this));};Beepall[_0x0cdd('0xe')][_0x0cdd('0x7')]=function(){this['squeue'][_0x0cdd('0x7')](this[_0x0cdd('0x8')]['bind'](this),this[_0x0cdd('0xa')]['bind'](this));};Beepall[_0x0cdd('0xe')][_0x0cdd('0xd')]=function(_0x55f692){this['handleTimeout'](!![]);};Beepall[_0x0cdd('0xe')]['handleRun']=function(_0x511a9b){var _0x59d36e=!![];if(!_[_0x0cdd('0xf')](this['queue'])&&!_[_0x0cdd('0xf')](this[_0x0cdd('0x5')][_0x0cdd('0x10')])&&this['queue'][_0x0cdd('0x10')]['length']>0x0){for(var _0x9bd09f=0x0,_0x1b758a;_0x9bd09f0x0){for(var _0x41e10c=0x0,_0x178633;_0x41e10c0x0&&_0x18af5c[_0x30e1b0+_0x0fcf('0x29')]>=_0x18af5c[_0x30e1b0+_0x0fcf('0x28')]){writeLog(_0x41b20b,_0x18af5c,_0x30e1b0[_0x0fcf('0x2a')]()+_0x0fcf('0x2b'));return![];}}return!![];};exports[_0x0fcf('0x2c')]=function(_0x2730b0,_0x527d43,_0x137e10,_0xbaa4d8,_0x200517){return sendNotification(!![],_0x2730b0,_0x527d43,_0x137e10,_0xbaa4d8,_0x200517);};exports[_0x0fcf('0x2d')]=function(_0x49fd0e,_0x5d9bcd,_0x4af80d,_0x428194,_0x50b7df){return sendNotification(![],_0x49fd0e,_0x5d9bcd,_0x4af80d,_0x428194,_0x50b7df);};exports[_0x0fcf('0x2e')]=writeLog; \ No newline at end of file +var _0x7880=['Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','writeLog','util','../utils','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','format','user:%s','name','split','\x20interaction','account','notificationShake','body','queue','msg','getMustacheRender','I\x20can\x27t\x20render\x20your\x20template','[%s][QUEUE]\x20%s','message','save','info','isAgentAvailable','BUSY','online','OFFLINE','hasOwnProperty'];(function(_0x1aed01,_0x3b59f3){var _0x34ccb8=function(_0x1420db){while(--_0x1420db){_0x1aed01['push'](_0x1aed01['shift']());}};_0x34ccb8(++_0x3b59f3);}(_0x7880,0x1f4));var _0x0788=function(_0x2472a6,_0x5f2d82){_0x2472a6=_0x2472a6-0x0;var _0x5c04b9=_0x7880[_0x2472a6];return _0x5c04b9;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var utils=require(_0x0788('0x1'));var Mustache=require(_0x0788('0x2'));var Redis=require(_0x0788('0x3'));var config=require(_0x0788('0x4'));var logger=require(_0x0788('0x5'))('routing');config[_0x0788('0x6')]=_[_0x0788('0x7')](config[_0x0788('0x6')],{'host':_0x0788('0x8'),'port':0x18eb});var io=require(_0x0788('0x9'))(new Redis(config[_0x0788('0x6')]));function emit(_0x3f9cb8,_0x44bbb5,_0x3c29f3){io['to'](_0x3f9cb8)[_0x0788('0xa')](_0x44bbb5,_0x3c29f3);}function sendNotification(_0x55e48a,_0x1497dd,_0x49f53b,_0xabaf81,_0x53b2f2,_0x433c26){io['to'](util[_0x0788('0xb')](_0x0788('0xc'),_0xabaf81[_0x0788('0xd')]))[_0x0788('0xa')]('user:save',_0xabaf81);var _0x1920b3=_0x433c26||{};var _0x37560d=_0x49f53b[_0x0788('0xe')]('.');var _0x2d8568={'uniqueid':_0x1497dd,'channel':_0x37560d[0x0],'id':_0x37560d[0x1],'title':_0x37560d[0x0]+_0x0788('0xf'),'interactionId':_0x37560d[0x2],'queue':_0x53b2f2?_0x53b2f2[_0x0788('0xd')]:null,'sound':_0x1920b3[_0x0788('0x10')]['notificationSound'],'shake':_0x1920b3[_0x0788('0x10')][_0x0788('0x11')]};try{if(!_0x1920b3[_0x0788('0x12')]){_0x1920b3[_0x0788('0x12')]={};}if(_0x53b2f2){_0x1920b3['body'][_0x0788('0x13')]=_0x53b2f2;}else if(_0x1920b3['body'][_0x0788('0x13')]){delete _0x1920b3[_0x0788('0x12')][_0x0788('0x13')];}_0x2d8568[_0x0788('0x14')]=utils[_0x0788('0x15')](_0x1920b3[_0x0788('0x10')]['notificationTemplate'],_0x1920b3);}catch(_0x573822){_0x2d8568[_0x0788('0x14')]=_0x0788('0x16');logger['error'](util[_0x0788('0xb')](_0x0788('0x17'),_0x1497dd,_0x573822[_0x0788('0x18')]));}io['to'](util['format'](_0x0788('0xc'),_0xabaf81[_0x0788('0xd')]))['emit'](util[_0x0788('0xb')]('notification:%s',_0x55e48a?_0x0788('0x19'):'remove'),_0x2d8568);}function writeLog(_0x17cca3,_0x3c37ca,_0x18ff22){return logger[_0x0788('0x1a')](util[_0x0788('0xb')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x17cca3,_0x3c37ca['name'],_0x18ff22));}exports[_0x0788('0x1b')]=function(_0x2a1460,_0x645320,_0x7a99a1,_0x5ba1da){if(_0x645320['busy']){writeLog(_0x2a1460,_0x645320,_0x0788('0x1c'));return![];}if(!_0x645320[_0x0788('0x1d')]){writeLog(_0x2a1460,_0x645320,_0x0788('0x1e'));return![];}if(_0x645320[_0x7a99a1+'Pause']){writeLog(_0x2a1460,_0x645320,'PAUSE');return![];}if(_0x5ba1da&&_0x645320[_0x0788('0x1f')](_0x7a99a1+_0x0788('0x20'))&&_0x645320['hasOwnProperty'](_0x7a99a1+'CurrentCapacity')){if(_0x645320[_0x7a99a1+_0x0788('0x20')]>0x0&&_0x645320[_0x7a99a1+_0x0788('0x21')]>=_0x645320[_0x7a99a1+'Capacity']){writeLog(_0x2a1460,_0x645320,_0x7a99a1[_0x0788('0x22')]()+_0x0788('0x23'));return![];}}return!![];};exports[_0x0788('0x24')]=function(_0x18fc0e,_0xf9ba32,_0xb2f4a5,_0x6bf651,_0x3ffe4f){return sendNotification(!![],_0x18fc0e,_0xf9ba32,_0xb2f4a5,_0x6bf651,_0x3ffe4f);};exports['hideNotification']=function(_0x5a5178,_0x3c5246,_0x40d345,_0x54979a,_0x4aa48b){return sendNotification(![],_0x5a5178,_0x3c5246,_0x40d345,_0x54979a,_0x4aa48b);};exports[_0x0788('0x25')]=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 f8e7cd3..15e52e7 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 _0xf0db=['[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][SYSTEM]\x20%s','map','message','join','info'];(function(_0x427370,_0x2bf986){var _0x5609f9=function(_0x2f0414){while(--_0x2f0414){_0x427370['push'](_0x427370['shift']());}};_0x5609f9(++_0x2bf986);}(_0xf0db,0x12b));var _0xbf0d=function(_0xba0502,_0x2fb75b){_0xba0502=_0xba0502-0x0;var _0x5ed16d=_0xf0db[_0xba0502];return _0x5ed16d;};'use strict';var schema=require(_0xbf0d('0x0'));var sh=require(_0xbf0d('0x1'));var _=require('lodash');var utils=require(_0xbf0d('0x2'));var logger=require(_0xbf0d('0x3'))(_0xbf0d('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0xbf0d('0x5')}});exports[_0xbf0d('0x6')]=function(_0x56f648,_0x4bb1b7){return function(_0x45c463){try{var _0x1e4a49={'command':_0x4bb1b7[0x0]};var _0x28586b=system[_0xbf0d('0x0')](_0x1e4a49,{'typecast':!![]});if(_0x28586b['length']){logger[_0xbf0d('0x7')](_0xbf0d('0x8'),_0x56f648,_[_0xbf0d('0x9')](_0x28586b,_0xbf0d('0xa'))[_0xbf0d('0xb')](',\x20'));logger[_0xbf0d('0xc')](_0xbf0d('0xd'),_0x56f648);_0x45c463[_0xbf0d('0xe')]();}else{var _0x55cb8f=this;var _0x5a28a3=utils[_0xbf0d('0xf')](_0x4bb1b7[0x0],this);logger[_0xbf0d('0xc')](_0xbf0d('0x10'),_0x56f648,_0x5a28a3);sh[_0xbf0d('0x11')](_[_0xbf0d('0x12')](_0x5a28a3),function(_0x46b10d,_0xdc1372){logger[_0xbf0d('0xc')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x56f648,_0x46b10d);if(_0x46b10d==0x0){var _0x22056f=_0xdc1372[_0xbf0d('0x13')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x4bb1b7[0x1])||_[_0xbf0d('0x14')](_0x4bb1b7[0x1])){logger[_0xbf0d('0xc')](_0xbf0d('0x15'),_0x56f648);_0x55cb8f[_0xbf0d('0x16')][_0x4bb1b7[0x1]]=_0x22056f;}else{logger[_0xbf0d('0xc')](_0xbf0d('0x17'),_0x56f648,_0x4bb1b7[0x1],_0x22056f);_0x55cb8f[_0xbf0d('0x16')][_0x4bb1b7[0x1]]=_0x22056f;}}_0x45c463[_0xbf0d('0xe')]();});}}catch(_0x29aeb1){logger[_0xbf0d('0x7')](_0xbf0d('0x8'),_0x56f648,_[_0xbf0d('0x18')](_0x29aeb1)?JSON[_0xbf0d('0x19')](_0x29aeb1):_0x29aeb1);logger[_0xbf0d('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x56f648);_0x45c463[_0xbf0d('0xe')]();}};}; \ No newline at end of file +var _0x061c=['validate','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','next','error','stringify','lodash','./utils','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence'];(function(_0x2ebf10,_0x1b4c1c){var _0x38eff5=function(_0x311dc8){while(--_0x311dc8){_0x2ebf10['push'](_0x2ebf10['shift']());}};_0x38eff5(++_0x1b4c1c);}(_0x061c,0x1df));var _0xc061=function(_0x14de92,_0x85e516){_0x14de92=_0x14de92-0x0;var _0x538070=_0x061c[_0x14de92];return _0x538070;};'use strict';var schema=require('validate');var sh=require('shelljs');var _=require(_0xc061('0x0'));var utils=require(_0xc061('0x1'));var logger=require('../../../../config/logger')('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0xc061('0x2')}});exports[_0xc061('0x3')]=function(_0x2f1b03,_0x38605d){return function(_0x52e164){try{var _0x3126ee={'command':_0x38605d[0x0]};var _0x4f7004=system[_0xc061('0x4')](_0x3126ee,{'typecast':!![]});if(_0x4f7004['length']){logger['error'](_0xc061('0x5'),_0x2f1b03,_[_0xc061('0x6')](_0x4f7004,_0xc061('0x7'))[_0xc061('0x8')](',\x20'));logger[_0xc061('0x9')](_0xc061('0xa'),_0x2f1b03);_0x52e164['next']();}else{var _0x1ee1df=this;var _0x1a84ab=utils[_0xc061('0xb')](_0x38605d[0x0],this);logger['info'](_0xc061('0xc'),_0x2f1b03,_0x1a84ab);sh['exec'](_[_0xc061('0xd')](_0x1a84ab),function(_0x2f9e7d,_0x177d02){logger['info']('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x2f1b03,_0x2f9e7d);if(_0x2f9e7d==0x0){var _0x151c8e=_0x177d02[_0xc061('0xe')](/(\r\n|\n|\r)/gm,'');if(_[_0xc061('0xf')](_0x38605d[0x1])||_[_0xc061('0x10')](_0x38605d[0x1])){logger['info'](_0xc061('0x11'),_0x2f1b03);_0x1ee1df['body'][_0x38605d[0x1]]=_0x151c8e;}else{logger[_0xc061('0x9')](_0xc061('0x12'),_0x2f1b03,_0x38605d[0x1],_0x151c8e);_0x1ee1df[_0xc061('0x13')][_0x38605d[0x1]]=_0x151c8e;}}_0x52e164[_0xc061('0x14')]();});}}catch(_0x1724b6){logger[_0xc061('0x15')]('[%s][SYSTEM]\x20%s',_0x2f1b03,_['isObject'](_0x1724b6)?JSON[_0xc061('0x16')](_0x1724b6):_0x1724b6);logger['info'](_0xc061('0xa'),_0x2f1b03);_0x52e164[_0xc061('0x14')]();}};}; \ 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 be3781d..74649bc 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 _0xaf03=['[%s][TAG]\x20%s','stringify','finally','isObject','next','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','message','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','then','info','catch'];(function(_0x363af1,_0x479c37){var _0x4a6a93=function(_0x1002c7){while(--_0x1002c7){_0x363af1['push'](_0x363af1['shift']());}};_0x4a6a93(++_0x479c37);}(_0xaf03,0x10a));var _0x3af0=function(_0x45c87f,_0x59f808){_0x45c87f=_0x45c87f-0x0;var _0x1f3f70=_0xaf03[_0x45c87f];return _0x1f3f70;};'use strict';var schema=require(_0x3af0('0x0'));var _=require(_0x3af0('0x1'));var rpc={'chatInteraction':require(_0x3af0('0x2')),'openchannelInteraction':require(_0x3af0('0x3')),'smsInteraction':require(_0x3af0('0x4')),'mailInteraction':require(_0x3af0('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x3af0('0x6'))};var logger=require(_0x3af0('0x7'))(_0x3af0('0x8'));var tag=schema({'tag':{'type':_0x3af0('0x9'),'required':!![],'message':_0x3af0('0xa')}});exports[_0x3af0('0xb')]=function(_0x3806dc,_0x45671b,_0x441e22,_0x2d9f65){return function(_0x368eb5){try{var _0x408e8c={'tag':_0x45671b[0x0]};var _0x2aa95a=tag[_0x3af0('0x0')](_0x408e8c,{'typecast':!![]});if(_0x2aa95a[_0x3af0('0xc')]){logger[_0x3af0('0xd')]('[%s][TAG]\x20%s',_0x3806dc,_[_0x3af0('0xe')](_0x2aa95a,_0x3af0('0xf'))['join'](',\x20'));logger['info'](_0x3af0('0x10'),_0x3806dc);_0x368eb5['next']();}else{var _0x1d7206={'ids':[_0x45671b[0x0]]};if(rpc[_0x2d9f65[_0x3af0('0x11')]+'Interaction']){rpc[_0x2d9f65[_0x3af0('0x11')]+_0x3af0('0x12')][_0x3af0('0x13')](_0x2d9f65[_0x3af0('0x14')]['id'],_0x1d7206)[_0x3af0('0x15')](function(_0x460102){logger[_0x3af0('0x16')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x3806dc,_0x45671b[0x1],_0x2d9f65[_0x3af0('0x11')],_0x2d9f65[_0x3af0('0x14')]['id']);})[_0x3af0('0x17')](function(_0x2c3c5b){logger[_0x3af0('0xd')](_0x3af0('0x18'),_0x3806dc,JSON[_0x3af0('0x19')](_0x2c3c5b));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3806dc);})[_0x3af0('0x1a')](function(){_0x368eb5['next']();});}}}catch(_0x4f212d){logger['error'](_0x3af0('0x18'),_0x3806dc,_[_0x3af0('0x1b')](_0x4f212d)?JSON['stringify'](_0x4f212d):_0x4f212d);logger['info'](_0x3af0('0x10'),_0x3806dc);_0x368eb5[_0x3af0('0x1c')]();}};}; \ No newline at end of file +var _0xf3f0=['channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','finally','error','isObject','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xf3f0,0x149));var _0x0f3f=function(_0x139870,_0x2bcbc7){_0x139870=_0x139870-0x0;var _0x1c82a1=_0xf3f0[_0x139870];return _0x1c82a1;};'use strict';var schema=require(_0x0f3f('0x0'));var _=require(_0x0f3f('0x1'));var rpc={'chatInteraction':require(_0x0f3f('0x2')),'openchannelInteraction':require(_0x0f3f('0x3')),'smsInteraction':require(_0x0f3f('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x0f3f('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x0f3f('0x6'))(_0x0f3f('0x7'));var tag=schema({'tag':{'type':_0x0f3f('0x8'),'required':!![],'message':_0x0f3f('0x9')}});exports[_0x0f3f('0xa')]=function(_0x464398,_0x3e694a,_0x5a34b2,_0x4e56db){return function(_0x435167){try{var _0x59de5a={'tag':_0x3e694a[0x0]};var _0x53f405=tag['validate'](_0x59de5a,{'typecast':!![]});if(_0x53f405[_0x0f3f('0xb')]){logger['error'](_0x0f3f('0xc'),_0x464398,_[_0x0f3f('0xd')](_0x53f405,_0x0f3f('0xe'))[_0x0f3f('0xf')](',\x20'));logger[_0x0f3f('0x10')](_0x0f3f('0x11'),_0x464398);_0x435167[_0x0f3f('0x12')]();}else{var _0x17f868={'ids':[_0x3e694a[0x0]]};if(rpc[_0x4e56db[_0x0f3f('0x13')]+_0x0f3f('0x14')]){rpc[_0x4e56db[_0x0f3f('0x13')]+_0x0f3f('0x14')][_0x0f3f('0x15')](_0x4e56db[_0x0f3f('0x16')]['id'],_0x17f868)[_0x0f3f('0x17')](function(_0x40091c){logger['info'](_0x0f3f('0x18'),_0x464398,_0x3e694a[0x1],_0x4e56db[_0x0f3f('0x13')],_0x4e56db[_0x0f3f('0x16')]['id']);})['catch'](function(_0x138df9){logger['error'](_0x0f3f('0xc'),_0x464398,JSON['stringify'](_0x138df9));logger[_0x0f3f('0x10')](_0x0f3f('0x11'),_0x464398);})[_0x0f3f('0x19')](function(){_0x435167['next']();});}}}catch(_0x474a59){logger[_0x0f3f('0x1a')]('[%s][TAG]\x20%s',_0x464398,_[_0x0f3f('0x1b')](_0x474a59)?JSON[_0x0f3f('0x1c')](_0x474a59):_0x474a59);logger[_0x0f3f('0x10')](_0x0f3f('0x11'),_0x464398);_0x435167[_0x0f3f('0x12')]();}};}; \ 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 b448337..9c9a99a 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 _0xce0c=['consequence','replace','\x20-\x20','includes','push','?params=','urlOnRing','jsonrpc','2.0','method','login','params','stringify','POST','then','parse','logged','channelId=','&serviceId=','&sessionId=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','isObject','../../../../config/logger','routing','lodash'];(function(_0x580b43,_0x55fc05){var _0xd2eaed=function(_0xae2e16){while(--_0xae2e16){_0x580b43['push'](_0x580b43['shift']());}};_0xd2eaed(++_0x55fc05);}(_0xce0c,0x131));var _0xcce0=function(_0x1d20e5,_0x3d4f74){_0x1d20e5=_0x1d20e5-0x0;var _0x14c8d3=_0xce0c[_0x1d20e5];return _0x14c8d3;};'use strict';var rp=require('request-promise');var logger=require(_0xcce0('0x0'))(_0xcce0('0x1'));var _=require(_0xcce0('0x2'));var arr=[];exports[_0xcce0('0x3')]=function(_0x3f2306,_0x20cf1b){return function(_0x3a96dc){var _0x2710e0=_0x20cf1b[0xa];var _0x198481=_0x20cf1b[0xb];var _0xe889c1=_0x20cf1b[0xc];var _0x2e9819=_0x20cf1b[0xd];var _0x598520=_0x20cf1b[0xe];var _0x3ac4fc=_0x20cf1b[0xf][_0xcce0('0x4')](/\n/g,_0xcce0('0x5'));var _0x1e4872=_0x20cf1b[0x10][_0xcce0('0x4')](/\n/g,'\x20');if(!arr[_0xcce0('0x6')](_0x198481)){arr[_0xcce0('0x7')](_0x198481);var _0x392843=_0x20cf1b[0x3];var _0x54b35e=_0x20cf1b[0x4];var _0x52d5ee=_0x20cf1b[0x1];var _0x5e5154=_0x20cf1b[0x0];var _0x50d5a7={};_0x50d5a7['urlOnAnswer']=_0x20cf1b[0x8]+_0xcce0('0x8')+_0xe889c1+'|'+_0x2710e0+'|'+_0x2e9819+'|'+_0x198481+'|'+_0x598520;_0x50d5a7[_0xcce0('0x9')]=_0x20cf1b[0x7]+_0xcce0('0x8')+_0xe889c1+'|'+_0x2710e0+'|'+_0x2e9819+'|'+_0x198481+'|'+_0x598520+'|'+_0x3ac4fc+'|'+_0x1e4872;_0x50d5a7['title']=_0x20cf1b[0x9];var _0x1b7559={};_0x1b7559[_0xcce0('0xa')]=_0xcce0('0xb');_0x1b7559[_0xcce0('0xc')]=_0xcce0('0xd');var _0x148ebb=[];_0x148ebb[_0xcce0('0x7')](_0x20cf1b[0x2]);_0x148ebb[_0xcce0('0x7')](_0x20cf1b[0x5]);_0x148ebb[_0xcce0('0x7')](_0x20cf1b[0x6]);_0x1b7559[_0xcce0('0xe')]=_0x148ebb;_0x1b7559['id']=0x1;var _0x1c4f46=JSON[_0xcce0('0xf')](_0x1b7559);var _0x5c8c0c={'encoding':'utf8','method':_0xcce0('0x10'),'timeout':0x2710,'url':_0x392843,'headers':{'Content-Type':'application/json-rpc'},'body':_0x1c4f46};return rp(_0x5c8c0c)[_0xcce0('0x11')](function(_0x48dc74){const _0x2281b1=JSON[_0xcce0('0x12')](_0x48dc74);if(!_0x2281b1['result'][_0xcce0('0x13')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x2eeffb=_0x198481;var _0x6f110f=_0xcce0('0x14')+_0x52d5ee+_0xcce0('0x15')+_0x5e5154+_0xcce0('0x16')+_0x2eeffb+'&data='+JSON[_0xcce0('0xf')](_0x50d5a7);var _0x4d07c4=_0x54b35e+'?'+_0x6f110f;return rp(_0x4d07c4);})[_0xcce0('0x11')](function(_0xf9e1c8){logger[_0xcce0('0x17')](_0xcce0('0x18'),_0x3f2306,_0xf9e1c8);_0x3a96dc[_0xcce0('0x19')]();})[_0xcce0('0x1a')](function(_0x1a0020){logger['error']('[%s][TVOX]\x20%s',_0x3f2306,_[_0xcce0('0x1b')](_0x1a0020)?JSON[_0xcce0('0xf')](_0x1a0020):_0x1a0020);_0x3a96dc[_0xcce0('0x19')]();});}else{logger[_0xcce0('0x17')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x3f2306);_0x3a96dc['next']();}};}; \ No newline at end of file +var _0x2cb2=['logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','error','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','../../../../config/logger','routing','consequence','replace','includes','?params=','urlOnRing','title','jsonrpc','2.0','method','login','push','params','stringify','utf8','POST','application/json-rpc','then','result'];(function(_0x5acd03,_0x4bf673){var _0x25336a=function(_0xbbfdf2){while(--_0xbbfdf2){_0x5acd03['push'](_0x5acd03['shift']());}};_0x25336a(++_0x4bf673);}(_0x2cb2,0x6b));var _0x22cb=function(_0x217dfa,_0x126914){_0x217dfa=_0x217dfa-0x0;var _0x1a7f0e=_0x2cb2[_0x217dfa];return _0x1a7f0e;};'use strict';var rp=require(_0x22cb('0x0'));var logger=require(_0x22cb('0x1'))(_0x22cb('0x2'));var _=require('lodash');var arr=[];exports[_0x22cb('0x3')]=function(_0x1cb1ae,_0xa4d491){return function(_0x2a4c92){var _0x5b75b8=_0xa4d491[0xa];var _0x4fae5e=_0xa4d491[0xb];var _0x2a4335=_0xa4d491[0xc];var _0xf54cba=_0xa4d491[0xd];var _0x3c4bc2=_0xa4d491[0xe];var _0x55f136=_0xa4d491[0xf]['replace'](/\n/g,'\x20-\x20');var _0x58a7d6=_0xa4d491[0x10][_0x22cb('0x4')](/\n/g,'\x20');if(!arr[_0x22cb('0x5')](_0x4fae5e)){arr['push'](_0x4fae5e);var _0xcf96df=_0xa4d491[0x3];var _0x55f916=_0xa4d491[0x4];var _0x5c18aa=_0xa4d491[0x1];var _0x15ad76=_0xa4d491[0x0];var _0x4d2fb6={};_0x4d2fb6['urlOnAnswer']=_0xa4d491[0x8]+_0x22cb('0x6')+_0x2a4335+'|'+_0x5b75b8+'|'+_0xf54cba+'|'+_0x4fae5e+'|'+_0x3c4bc2;_0x4d2fb6[_0x22cb('0x7')]=_0xa4d491[0x7]+_0x22cb('0x6')+_0x2a4335+'|'+_0x5b75b8+'|'+_0xf54cba+'|'+_0x4fae5e+'|'+_0x3c4bc2+'|'+_0x55f136+'|'+_0x58a7d6;_0x4d2fb6[_0x22cb('0x8')]=_0xa4d491[0x9];var _0x4b0318={};_0x4b0318[_0x22cb('0x9')]=_0x22cb('0xa');_0x4b0318[_0x22cb('0xb')]=_0x22cb('0xc');var _0x5f2cb8=[];_0x5f2cb8[_0x22cb('0xd')](_0xa4d491[0x2]);_0x5f2cb8[_0x22cb('0xd')](_0xa4d491[0x5]);_0x5f2cb8['push'](_0xa4d491[0x6]);_0x4b0318[_0x22cb('0xe')]=_0x5f2cb8;_0x4b0318['id']=0x1;var _0x90653c=JSON[_0x22cb('0xf')](_0x4b0318);var _0x17841a={'encoding':_0x22cb('0x10'),'method':_0x22cb('0x11'),'timeout':0x2710,'url':_0xcf96df,'headers':{'Content-Type':_0x22cb('0x12')},'body':_0x90653c};return rp(_0x17841a)[_0x22cb('0x13')](function(_0x4271f7){const _0x57f630=JSON['parse'](_0x4271f7);if(!_0x57f630[_0x22cb('0x14')][_0x22cb('0x15')]){throw new Error(_0x22cb('0x16'));}var _0x4b4363=_0x4fae5e;var _0x4bdecc=_0x22cb('0x17')+_0x5c18aa+_0x22cb('0x18')+_0x15ad76+_0x22cb('0x19')+_0x4b4363+_0x22cb('0x1a')+JSON[_0x22cb('0xf')](_0x4d2fb6);var _0x891314=_0x55f916+'?'+_0x4bdecc;return rp(_0x891314);})[_0x22cb('0x13')](function(_0x1b4ccc){logger[_0x22cb('0x1b')](_0x22cb('0x1c'),_0x1cb1ae,_0x1b4ccc);_0x2a4c92[_0x22cb('0x1d')]();})['catch'](function(_0x124ad9){logger[_0x22cb('0x1e')]('[%s][TVOX]\x20%s',_0x1cb1ae,_['isObject'](_0x124ad9)?JSON[_0x22cb('0xf')](_0x124ad9):_0x124ad9);_0x2a4c92[_0x22cb('0x1d')]();});}else{logger[_0x22cb('0x1b')](_0x22cb('0x1f'),_0x1cb1ae);_0x2a4c92['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 8f8abfe..046ebc0 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x486b3b,_0x13b406){var _0x4496d4=function(_0xfc8678){while(--_0xfc8678){_0x486b3b['push'](_0x486b3b['shift']());}};_0x4496d4(++_0x13b406);}(_0xe706,0xa3));var _0x6e70=function(_0x4361b6,_0x414635){_0x4361b6=_0x4361b6-0x0;var _0x4c6878=_0xe706[_0x4361b6];return _0x4c6878;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x269b6e,_0x3f379a){var _0xfa150e=function(_0x50eded){while(--_0x50eded){_0x269b6e['push'](_0x269b6e['shift']());}};_0xfa150e(++_0x3f379a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index f6e4ebf..d6758f5 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 _0xc964=['mailQueues','available','openchannelQueues','paused','waiting','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','uuid','../../../config/environment','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','%s.%s.%s','IntervalId','isNil','Intervals','interval','listen','message','interaction','applications','isArray','length','existsSync','.js','app','toLowerCase','autoreply','split','channel','mail','push','join','dialogflow','slice','dialogflowv2','appdata','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','format','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','Applications\x20executed','stringify','emit','complete','routing\x20is\x20empty','agent','agents','busy','busyQueue','QueueReport','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','loggedIn','name'];(function(_0x24fcd0,_0x343a4b){var _0x392b1e=function(_0x4c5d2b){while(--_0x4c5d2b){_0x24fcd0['push'](_0x24fcd0['shift']());}};_0x392b1e(++_0x343a4b);}(_0xc964,0x7e));var _0x4c96=function(_0x382666,_0x3a90ce){_0x382666=_0x382666-0x0;var _0x1bcf4f=_0xc964[_0x382666];return _0x1bcf4f;};'use strict';var _=require(_0x4c96('0x0'));var util=require(_0x4c96('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0x4c96('0x2'));var BPromise=require(_0x4c96('0x3'));var uuid=require(_0x4c96('0x4'));var utils=require('./applications/utils');var config=require(_0x4c96('0x5'));var logger=require('../../../config/logger')(_0x4c96('0x6'));var rpc={'openchannelQueueReport':require(_0x4c96('0x7')),'mailQueueReport':require(_0x4c96('0x8')),'chatQueueReport':require(_0x4c96('0x9')),'smsQueueReport':require(_0x4c96('0xa')),'faxQueueReport':require(_0x4c96('0xb')),'whatsappQueueReport':require(_0x4c96('0xc'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x19ed76,_0xaa3f20,_0x135c89){return util['format'](_0x4c96('0xd'),_0x19ed76,_0xaa3f20||0x0,_0x135c89||0x0);}function getIntervals(_0x2ea23f,_0x561bcd){var _0x57783e=[];if(!_['isNil'](_0x561bcd[_0x4c96('0xe')])&&!_[_0x4c96('0xf')](_0x2ea23f[_0x561bcd[_0x4c96('0xe')]])&&!_['isNil'](_0x2ea23f[_0x561bcd[_0x4c96('0xe')]]['Intervals'])){_0x57783e=_['map'](_0x2ea23f[_0x561bcd[_0x4c96('0xe')]][_0x4c96('0x10')],_0x4c96('0x11'));}else if(!_['isNil'](_0x561bcd['interval'])){_0x57783e=[_0x561bcd[_0x4c96('0x11')]];}return _0x57783e;}exports[_0x4c96('0x12')]=function(_0x181afb){_0x181afb['rules']={};return new BPromise(function(_0xe42458,_0x334165){var _0x167537={'Start':function(_0x3c6fce){var _0x433608=this;return new Promise(function(_0x66964b,_0xeb18f3){if(_0x3c6fce){try{var _0x4a3fca=[];var _0x388237=getId(_0x3c6fce['channel'],_0x3c6fce[_0x4c96('0x13')]?_0x3c6fce['message']['id']:0x0,_0x3c6fce[_0x4c96('0x14')]?_0x3c6fce['interaction']['id']:0x0);if(_0x3c6fce[_0x4c96('0x15')]&&_[_0x4c96('0x16')](_0x3c6fce[_0x4c96('0x15')])&&_0x3c6fce[_0x4c96('0x15')][_0x4c96('0x17')]){for(var _0x32552d=0x0;_0x32552d<_0x3c6fce[_0x4c96('0x15')][_0x4c96('0x17')];_0x32552d+=0x1){var _0x2202ec=_0x3c6fce[_0x4c96('0x15')][_0x32552d];if(fs[_0x4c96('0x18')](path['join'](__dirname,'applications',_0x2202ec['app']+_0x4c96('0x19')))){var _0x13eaa0=[];switch(_0x2202ec[_0x4c96('0x1a')][_0x4c96('0x1b')]()){case _0x4c96('0x1c'):var _0x422fc6=_0x2202ec['appdata'][_0x4c96('0x1d')](',');if(_0x3c6fce[_0x4c96('0x1e')]===_0x4c96('0x1f')){_0x13eaa0[_0x4c96('0x20')](_0x422fc6[0x0]);_0x13eaa0[_0x4c96('0x20')](_0x422fc6[0x1]);_0x13eaa0[_0x4c96('0x20')](_0x422fc6['slice'](0x2,_0x422fc6[_0x4c96('0x17')])[_0x4c96('0x21')](','));}else{_0x13eaa0['push'](_0x422fc6[0x0]);_0x13eaa0[_0x4c96('0x20')](_0x422fc6['slice'](0x1,_0x422fc6[_0x4c96('0x17')])[_0x4c96('0x21')](','));}break;case _0x4c96('0x22'):var _0x1543d8=_0x2202ec['appdata'][_0x4c96('0x1d')](',');_0x13eaa0[_0x4c96('0x20')](_0x1543d8[0x0]);_0x13eaa0[_0x4c96('0x20')](_0x1543d8[0x1]);_0x13eaa0[_0x4c96('0x20')](_0x1543d8[_0x4c96('0x23')](0x2,_0x1543d8[_0x4c96('0x17')])['join'](','));break;case _0x4c96('0x24'):var _0x3ea83d=_0x2202ec[_0x4c96('0x25')][_0x4c96('0x1d')](',');_0x13eaa0[_0x4c96('0x20')](_0x3ea83d[0x0]);_0x13eaa0[_0x4c96('0x20')](_0x3ea83d[0x1]);_0x13eaa0['push'](_0x3ea83d[0x2]);_0x13eaa0['push'](_0x3ea83d[0x3]);_0x13eaa0[_0x4c96('0x20')](_0x3ea83d[_0x4c96('0x23')](0x4,_0x3ea83d[_0x4c96('0x17')])[_0x4c96('0x21')](','));break;case _0x4c96('0x26'):var _0x5dee7c=_0x2202ec[_0x4c96('0x25')]['split'](',');_0x13eaa0[_0x4c96('0x20')](_0x5dee7c[0x0]);_0x13eaa0['push'](_0x5dee7c[0x1]);_0x13eaa0[_0x4c96('0x20')](_0x5dee7c[0x2]);_0x13eaa0[_0x4c96('0x20')](_0x5dee7c[0x3]);_0x13eaa0[_0x4c96('0x20')](_0x5dee7c[_0x4c96('0x23')](0x4,_0x5dee7c[_0x4c96('0x17')])[_0x4c96('0x21')](','));break;case _0x4c96('0x13'):_0x13eaa0[_0x4c96('0x20')](_0x2202ec[_0x4c96('0x25')]);break;case _0x4c96('0x27'):_0x13eaa0[_0x4c96('0x20')](_0x2202ec[_0x4c96('0x28')]);_0x13eaa0[_0x4c96('0x20')](_0x2202ec[_0x4c96('0x25')]);break;case _0x4c96('0x29'):var _0x4a5b78=utils[_0x4c96('0x2a')](_0x3c6fce[_0x4c96('0x2b')][_0x4c96('0x2c')],_0x3c6fce);var _0x5d1dfd=_0x2202ec[_0x4c96('0x25')]['split'](',');_0x13eaa0[_0x4c96('0x20')](_0x5d1dfd[0x0]);_0x13eaa0['push'](_0x5d1dfd[0x1]);_0x13eaa0[_0x4c96('0x20')](_0x5d1dfd[0x2]);_0x13eaa0[_0x4c96('0x20')](_0x5d1dfd[0x3]);_0x13eaa0[_0x4c96('0x20')](_0x5d1dfd[0x4]);_0x13eaa0['push'](_0x5d1dfd[0x5]);_0x13eaa0['push'](_0x5d1dfd[0x6]);_0x13eaa0[_0x4c96('0x20')](_0x5d1dfd[0x7]);_0x13eaa0[_0x4c96('0x20')](_0x5d1dfd[0x8]);_0x13eaa0['push'](_0x5d1dfd[0x9]);_0x13eaa0[_0x4c96('0x20')](_0x5d1dfd[0xa]);_0x13eaa0[_0x4c96('0x20')](_0x3c6fce[_0x4c96('0x14')]['id']);_0x13eaa0[_0x4c96('0x20')](_0x3c6fce['message']['id']);_0x13eaa0[_0x4c96('0x20')](_0x2202ec[_0x4c96('0x2d')]);_0x13eaa0[_0x4c96('0x20')](_0x3c6fce[_0x4c96('0x14')][_0x4c96('0x2e')]);_0x13eaa0['push'](_0x3c6fce[_0x4c96('0x2f')][_0x4c96('0x2f')]);_0x13eaa0['push'](_0x4a5b78);break;default:_0x13eaa0=_[_0x4c96('0xf')](_0x2202ec[_0x4c96('0x25')])?[]:_0x2202ec[_0x4c96('0x25')][_0x4c96('0x1d')](',');}var _0x35b189={'id':util[_0x4c96('0x30')](_0x4c96('0x31'),_0x388237,_0x2202ec['id'],_0x2202ec['app']),'condition':require(_0x4c96('0x32'))[_0x4c96('0x33')](_0x388237,getIntervals(_0x181afb[_0x4c96('0x34')],_0x2202ec),_0x181afb),'consequence':require(_0x4c96('0x35')+_0x2202ec[_0x4c96('0x1a')])[_0x4c96('0x36')](_0x388237,_0x13eaa0,_0x181afb,_0x3c6fce),'p':_0x2202ec[_0x4c96('0x37')]||0x0};logger[_0x4c96('0x38')](_0x4c96('0x39'),_0x35b189['id'],_0x4c96('0x3a'),getIntervals(_0x181afb['intervals'],_0x2202ec)[_0x4c96('0x21')](_0x4c96('0x3b')));_0x4a3fca[_0x4c96('0x20')](_0x35b189);}else{logger[_0x4c96('0x3c')](_0x4c96('0x3d'),path['join'](__dirname,_0x4c96('0x15'),_0x2202ec[_0x4c96('0x1a')]+_0x4c96('0x19')));}}_0x181afb[_0x4c96('0x3e')][_0x388237]=new RuleEngine(_0x4a3fca);_0x181afb['rules'][_0x388237][_0x4c96('0x3f')](_0x3c6fce,function(_0xd789ec){logger[_0x4c96('0x38')](_0x4c96('0x40'),JSON[_0x4c96('0x41')](_0xd789ec['matchPath']));if(_0x181afb[_0x4c96('0x3e')][_0x388237]){_0x181afb[_0x4c96('0x3e')][_0x388237][_0x4c96('0x42')](_0x4c96('0x43'));}});return _0x66964b({'code':0xc8,'message':_0x3c6fce});}else{logger[_0x4c96('0x38')]('No\x20applications\x20to\x20execute');return _0x66964b({'code':0xc8,'message':_0x3c6fce});}}catch(_0x5eaf3a){logger[_0x4c96('0x3c')](_0x5eaf3a['stack']);return _0xeb18f3(_0x433608['error'](0x1f4,_0x5eaf3a));}}return _0xeb18f3(_0x4c96('0x44'));});},'AcceptMessage':function(_0x229bcd){var _0xb26faa=this;return new Promise(function(_0x46a0c3,_0x299f7d){if(_0x229bcd[_0x4c96('0x45')]&&_0x229bcd[_0x4c96('0x45')]['id']){if(_0x181afb[_0x4c96('0x46')][_0x229bcd[_0x4c96('0x45')]['id']]){_0x181afb['agents'][_0x229bcd[_0x4c96('0x45')]['id']][_0x4c96('0x47')]=![];_0x181afb[_0x4c96('0x46')][_0x229bcd[_0x4c96('0x45')]['id']][_0x4c96('0x48')]=undefined;}}if(_0x229bcd['message']&&_0x229bcd[_0x4c96('0x13')]['id']){try{var _0x2c5fdb=getId(_0x229bcd['channel'],_0x229bcd['message']?_0x229bcd[_0x4c96('0x13')]['id']:0x0,_0x229bcd[_0x4c96('0x14')]?_0x229bcd[_0x4c96('0x14')]['id']:0x0);if(_0x181afb['rules'][_0x2c5fdb]){_0x181afb[_0x4c96('0x3e')][_0x2c5fdb][_0x4c96('0x42')]('end');if(rpc[_0x229bcd[_0x4c96('0x1e')]+_0x4c96('0x49')]){rpc[_0x229bcd[_0x4c96('0x1e')]+'QueueReport']['update'](_0x2c5fdb,{'UserId':_0x229bcd['message']['UserId']})[_0x4c96('0x4a')](function(_0xa5a1b3){logger[_0x4c96('0x3c')](_0x4c96('0x4b'));});}}return _0x46a0c3({'code':0xc8,'message':_0x229bcd});}catch(_0x3df197){logger[_0x4c96('0x3c')](_0x3df197[_0x4c96('0x4c')]);return _0x299f7d(_0xb26faa[_0x4c96('0x3c')](0x1f4,_0x3df197));}}logger[_0x4c96('0x3c')](_0x4c96('0x4d'));return _0x299f7d(_0xb26faa[_0x4c96('0x3c')](0x1f4,_0x4c96('0x4d')));});},'RejectMessage':function(_0x55c727){var _0x4b9077=this;return new Promise(function(_0x252c64,_0x454b63){if(_0x55c727['agent']&&_0x55c727[_0x4c96('0x45')]['id']){try{if(_0x181afb[_0x4c96('0x46')][_0x55c727[_0x4c96('0x45')]['id']]){_0x181afb[_0x4c96('0x46')][_0x55c727[_0x4c96('0x45')]['id']][_0x4c96('0x47')]=![];_0x181afb['agents'][_0x55c727[_0x4c96('0x45')]['id']]['busyQueue']=undefined;}return _0x252c64({'code':0xc8,'message':_0x55c727});}catch(_0x461b10){logger[_0x4c96('0x3c')](_0x461b10[_0x4c96('0x4c')]);return _0x454b63(_0x4b9077[_0x4c96('0x3c')](0x1f4,_0x461b10));}}logger[_0x4c96('0x3c')](_0x4c96('0x4d'));return _0x454b63(_0x4b9077['error'](0x1f4,_0x4c96('0x4d')));});},'AbandonInteraction':function(_0x1dfb78){var _0x8ffe53=this;return new Promise(function(_0x58d687,_0x1e5fe2){if(_0x1dfb78['channel']&&_0x1dfb78[_0x4c96('0x14')]&&_0x1dfb78[_0x4c96('0x14')]['id']){try{var _0x5ef242=getId(_0x1dfb78['channel'],_0x1dfb78[_0x4c96('0x13')]?_0x1dfb78[_0x4c96('0x13')]['id']:0x0,_0x1dfb78[_0x4c96('0x14')]?_0x1dfb78[_0x4c96('0x14')]['id']:0x0);if(_0x181afb[_0x4c96('0x3e')][_0x5ef242]){_0x181afb[_0x4c96('0x3e')][_0x5ef242]['emit'](_0x4c96('0x4e'));}return _0x58d687({'code':0xc8,'message':_0x1dfb78});}catch(_0x2f003b){logger[_0x4c96('0x3c')](_0x2f003b[_0x4c96('0x4c')]);return _0x1e5fe2(_0x8ffe53[_0x4c96('0x3c')](0x1f4,_0x2f003b));}}logger['error'](_0x4c96('0x4d'));return _0x1e5fe2(_0x8ffe53[_0x4c96('0x3c')](0x1f4,_0x4c96('0x4d')));});},'AgentCapacity':function(_0x428643){var _0x48ae2b=this;return new Promise(function(_0x18fef9,_0x97fe6c){if(_0x181afb[_0x4c96('0x46')][_0x4c96('0x4f')](_0x428643['id'])){for(var _0x5337c2 in _0x428643['capacity']){if(_0x428643[_0x4c96('0x50')]['hasOwnProperty'](_0x5337c2)){if(_0x181afb[_0x4c96('0x46')][_0x428643['id']][_0x4c96('0x4f')](_0x5337c2+'CurrentCapacity')){_0x181afb[_0x4c96('0x46')][_0x428643['id']][_0x5337c2+_0x4c96('0x51')]=parseInt(_0x428643[_0x4c96('0x50')][_0x5337c2],0xa);}}}_0x181afb[_0x4c96('0x46')][_0x428643['id']][_0x4c96('0x52')]();return _0x18fef9({'code':0xc8,'message':_0x181afb[_0x4c96('0x46')][_0x428643['id']]});}else{return _0x97fe6c(_0x48ae2b[_0x4c96('0x3c')](0x1f4,_0x4c96('0x53')));}});},'Agents':function(_0x1e620d){return new Promise(function(_0x28e353,_0x40503c){var _0x32c409=_[_0x4c96('0x54')](_0x181afb[_0x4c96('0x46')]);_0x28e353({'count':_0x32c409[_0x4c96('0x17')],'rows':_0x32c409});});},'ChatQueues':function(_0x1aeebd){return new Promise(function(_0x3411ac,_0xc616a4){var _0x3068d0=[];for(var _0x714b3e in _0x181afb['chatQueues']){if(_0x181afb[_0x4c96('0x55')]['hasOwnProperty'](_0x714b3e)){var _0x2e9231=_0x181afb[_0x4c96('0x55')][_0x714b3e];var _0xb55203={'id':_0x2e9231['id'],'available':_0x2e9231['available'],'loggedIn':_0x2e9231[_0x4c96('0x56')],'name':_0x2e9231[_0x4c96('0x57')],'paused':_0x2e9231['paused'],'waiting':_0x2e9231['waiting']};_0x3068d0[_0x4c96('0x20')](_0xb55203);}}_0x3411ac({'count':_0x3068d0[_0x4c96('0x17')],'rows':_0x3068d0});});},'MailQueues':function(_0x317fd9){return new Promise(function(_0x168a1f,_0x15ee2f){var _0x5c2d18=[];for(var _0x128e61 in _0x181afb[_0x4c96('0x58')]){if(_0x181afb[_0x4c96('0x58')][_0x4c96('0x4f')](_0x128e61)){var _0x44ee5a=_0x181afb[_0x4c96('0x58')][_0x128e61];var _0x4a47ca={'id':_0x44ee5a['id'],'available':_0x44ee5a[_0x4c96('0x59')],'loggedIn':_0x44ee5a[_0x4c96('0x56')],'name':_0x44ee5a[_0x4c96('0x57')],'paused':_0x44ee5a['paused'],'waiting':_0x44ee5a['waiting']};_0x5c2d18[_0x4c96('0x20')](_0x4a47ca);}}_0x168a1f({'count':_0x5c2d18[_0x4c96('0x17')],'rows':_0x5c2d18});});},'OpenchannelQueues':function(_0x3c0bed){return new Promise(function(_0x2c19bc,_0x5c2c23){var _0x169b31=[];for(var _0x5670a6 in _0x181afb[_0x4c96('0x5a')]){if(_0x181afb['openchannelQueues'][_0x4c96('0x4f')](_0x5670a6)){var _0xbf27ff=_0x181afb[_0x4c96('0x5a')][_0x5670a6];var _0x5e1e45={'id':_0xbf27ff['id'],'available':_0xbf27ff[_0x4c96('0x59')],'loggedIn':_0xbf27ff[_0x4c96('0x56')],'name':_0xbf27ff[_0x4c96('0x57')],'paused':_0xbf27ff[_0x4c96('0x5b')],'waiting':_0xbf27ff[_0x4c96('0x5c')]};_0x169b31[_0x4c96('0x20')](_0x5e1e45);}}_0x2c19bc({'count':_0x169b31[_0x4c96('0x17')],'rows':_0x169b31});});},'SmsQueues':function(_0x4316b3){return new Promise(function(_0x15088f,_0x194596){var _0x54dfdc=[];for(var _0xcb9bc8 in _0x181afb[_0x4c96('0x5d')]){if(_0x181afb[_0x4c96('0x5d')][_0x4c96('0x4f')](_0xcb9bc8)){var _0x1b4fd7=_0x181afb[_0x4c96('0x5d')][_0xcb9bc8];var _0x57bad3={'id':_0x1b4fd7['id'],'available':_0x1b4fd7[_0x4c96('0x59')],'loggedIn':_0x1b4fd7['loggedIn'],'name':_0x1b4fd7[_0x4c96('0x57')],'paused':_0x1b4fd7[_0x4c96('0x5b')],'waiting':_0x1b4fd7[_0x4c96('0x5c')]};_0x54dfdc['push'](_0x57bad3);}}_0x15088f({'count':_0x54dfdc[_0x4c96('0x17')],'rows':_0x54dfdc});});},'FaxQueues':function(_0x2d3c67){return new Promise(function(_0x249e25,_0xfad19a){var _0x8e8588=[];for(var _0x481518 in _0x181afb['faxQueues']){if(_0x181afb[_0x4c96('0x5e')][_0x4c96('0x4f')](_0x481518)){var _0x96f279=_0x181afb[_0x4c96('0x5e')][_0x481518];var _0x119b93={'id':_0x96f279['id'],'available':_0x96f279[_0x4c96('0x59')],'loggedIn':_0x96f279['loggedIn'],'name':_0x96f279[_0x4c96('0x57')],'paused':_0x96f279[_0x4c96('0x5b')],'waiting':_0x96f279[_0x4c96('0x5c')]};_0x8e8588[_0x4c96('0x20')](_0x119b93);}}_0x249e25({'count':_0x8e8588[_0x4c96('0x17')],'rows':_0x8e8588});});},'WhatsappQueues':function(_0x3b1014){return new Promise(function(_0x133413,_0xaf4eb5){var _0x569661=[];for(var _0x3adc13 in _0x181afb[_0x4c96('0x5f')]){if(_0x181afb['whatsappQueues'][_0x4c96('0x4f')](_0x3adc13)){var _0x33dbe7=_0x181afb[_0x4c96('0x5f')][_0x3adc13];var _0x5117b6={'id':_0x33dbe7['id'],'available':_0x33dbe7[_0x4c96('0x59')],'loggedIn':_0x33dbe7['loggedIn'],'name':_0x33dbe7[_0x4c96('0x57')],'paused':_0x33dbe7['paused'],'waiting':_0x33dbe7[_0x4c96('0x5c')]};_0x569661[_0x4c96('0x20')](_0x5117b6);}}_0x133413({'count':_0x569661[_0x4c96('0x17')],'rows':_0x569661});});},'ChatQueuesWaitingInteractions':function(_0x5c7e77){return new Promise(function(_0x50c0ca,_0x349cad){var _0x19d6fd=_[_0x4c96('0x54')](_0x181afb[_0x4c96('0x60')]);_0x50c0ca({'count':_0x19d6fd['length'],'rows':_0x19d6fd});});},'MailQueuesWaitingInteractions':function(_0x51f3ed){return new Promise(function(_0x5d3061,_0x496975){var _0x5e1052=_[_0x4c96('0x54')](_0x181afb[_0x4c96('0x61')]);_0x5d3061({'count':_0x5e1052[_0x4c96('0x17')],'rows':_0x5e1052});});},'OpenchannelQueuesWaitingInteractions':function(_0x206f3b){return new Promise(function(_0x2593cb,_0x3364b1){var _0x534dee=_[_0x4c96('0x54')](_0x181afb[_0x4c96('0x62')]);_0x2593cb({'count':_0x534dee[_0x4c96('0x17')],'rows':_0x534dee});});},'SmsQueuesWaitingInteractions':function(_0x17bbd8){return new Promise(function(_0x74935f,_0x1f628b){var _0x4a1554=_[_0x4c96('0x54')](_0x181afb[_0x4c96('0x63')]);_0x74935f({'count':_0x4a1554[_0x4c96('0x17')],'rows':_0x4a1554});});},'FaxQueuesWaitingInteractions':function(_0x241db5){return new Promise(function(_0x1ff7bb,_0x3c6762){var _0x16e33d=_['values'](_0x181afb[_0x4c96('0x64')]);_0x1ff7bb({'count':_0x16e33d[_0x4c96('0x17')],'rows':_0x16e33d});});},'WhatsappQueuesWaitingInteractions':function(_0x1587c7){return new Promise(function(_0x382720,_0x5cc4cc){var _0x5c704b=_[_0x4c96('0x54')](_0x181afb[_0x4c96('0x65')]);_0x382720({'count':_0x5c704b[_0x4c96('0x17')],'rows':_0x5c704b});});}};var _0x55f3ac=jayson[_0x4c96('0x66')](_0x167537)[_0x4c96('0x67')]();_0x55f3ac['on'](_0x4c96('0x3c'),function(_0x41f58a){logger[_0x4c96('0x3c')](JSON[_0x4c96('0x41')](_0x41f58a));return _0x334165(_0x41f58a);});_0x55f3ac['listen'](0x232c,_0x4c96('0x68'),function(){console['log'](_0x4c96('0x69'),0x232c);return _0xe42458(_0x4c96('0x6a')+0x232c);});});}; \ No newline at end of file +var _0xe630=['routing\x20is\x20empty','agent','agents','busy','busyQueue','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','end','hasOwnProperty','capacity','agent\x20not\x20found','chatQueues','loggedIn','name','paused','mailQueues','available','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','values','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','rules','channel','message','interaction','applications','length','existsSync','join','app','toLowerCase','autoreply','mail','push','slice','dialogflow','appdata','split','dialogflowv2','amazonlex','tag','tvox','getMustacheRender','account','ChatWebsiteId','body','%s:%s:%s','./interval','condition','intervals','./applications/','info','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','Applications\x20executed','stringify','matchPath','emit','complete','stack'];(function(_0x16a60a,_0x231045){var _0x53d4cc=function(_0x40fdb3){while(--_0x40fdb3){_0x16a60a['push'](_0x16a60a['shift']());}};_0x53d4cc(++_0x231045);}(_0xe630,0x149));var _0x0e63=function(_0x1c4c24,_0x154c79){_0x1c4c24=_0x1c4c24-0x0;var _0x1c033d=_0xe630[_0x1c4c24];return _0x1c033d;};'use strict';var _=require(_0x0e63('0x0'));var util=require(_0x0e63('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0x0e63('0x2'));var BPromise=require(_0x0e63('0x3'));var uuid=require(_0x0e63('0x4'));var utils=require('./applications/utils');var config=require(_0x0e63('0x5'));var logger=require(_0x0e63('0x6'))(_0x0e63('0x7'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x0e63('0x8')),'chatQueueReport':require(_0x0e63('0x9')),'smsQueueReport':require(_0x0e63('0xa')),'faxQueueReport':require(_0x0e63('0xb')),'whatsappQueueReport':require(_0x0e63('0xc'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x35e304,_0x2db49a,_0xf04128){return util[_0x0e63('0xd')](_0x0e63('0xe'),_0x35e304,_0x2db49a||0x0,_0xf04128||0x0);}function getIntervals(_0x270c4b,_0x16f195){var _0x1240ea=[];if(!_[_0x0e63('0xf')](_0x16f195[_0x0e63('0x10')])&&!_[_0x0e63('0xf')](_0x270c4b[_0x16f195['IntervalId']])&&!_[_0x0e63('0xf')](_0x270c4b[_0x16f195[_0x0e63('0x10')]][_0x0e63('0x11')])){_0x1240ea=_[_0x0e63('0x12')](_0x270c4b[_0x16f195[_0x0e63('0x10')]][_0x0e63('0x11')],_0x0e63('0x13'));}else if(!_[_0x0e63('0xf')](_0x16f195[_0x0e63('0x13')])){_0x1240ea=[_0x16f195['interval']];}return _0x1240ea;}exports['listen']=function(_0xf547b8){_0xf547b8[_0x0e63('0x14')]={};return new BPromise(function(_0x208037,_0x187cf5){var _0x61c395={'Start':function(_0x35643c){var _0x47f3e2=this;return new Promise(function(_0x5d1f1e,_0x5d8660){if(_0x35643c){try{var _0x503f34=[];var _0x37f6e4=getId(_0x35643c[_0x0e63('0x15')],_0x35643c[_0x0e63('0x16')]?_0x35643c['message']['id']:0x0,_0x35643c['interaction']?_0x35643c[_0x0e63('0x17')]['id']:0x0);if(_0x35643c['applications']&&_['isArray'](_0x35643c[_0x0e63('0x18')])&&_0x35643c['applications'][_0x0e63('0x19')]){for(var _0x44e74a=0x0;_0x44e74a<_0x35643c['applications']['length'];_0x44e74a+=0x1){var _0x32691d=_0x35643c[_0x0e63('0x18')][_0x44e74a];if(fs[_0x0e63('0x1a')](path[_0x0e63('0x1b')](__dirname,_0x0e63('0x18'),_0x32691d[_0x0e63('0x1c')]+'.js'))){var _0xb0d024=[];switch(_0x32691d[_0x0e63('0x1c')][_0x0e63('0x1d')]()){case _0x0e63('0x1e'):var _0xec68e1=_0x32691d['appdata']['split'](',');if(_0x35643c[_0x0e63('0x15')]===_0x0e63('0x1f')){_0xb0d024[_0x0e63('0x20')](_0xec68e1[0x0]);_0xb0d024[_0x0e63('0x20')](_0xec68e1[0x1]);_0xb0d024[_0x0e63('0x20')](_0xec68e1['slice'](0x2,_0xec68e1[_0x0e63('0x19')])[_0x0e63('0x1b')](','));}else{_0xb0d024[_0x0e63('0x20')](_0xec68e1[0x0]);_0xb0d024[_0x0e63('0x20')](_0xec68e1[_0x0e63('0x21')](0x1,_0xec68e1[_0x0e63('0x19')])[_0x0e63('0x1b')](','));}break;case _0x0e63('0x22'):var _0x25e88e=_0x32691d[_0x0e63('0x23')][_0x0e63('0x24')](',');_0xb0d024['push'](_0x25e88e[0x0]);_0xb0d024['push'](_0x25e88e[0x1]);_0xb0d024['push'](_0x25e88e[_0x0e63('0x21')](0x2,_0x25e88e[_0x0e63('0x19')])[_0x0e63('0x1b')](','));break;case _0x0e63('0x25'):var _0x2ea651=_0x32691d[_0x0e63('0x23')][_0x0e63('0x24')](',');_0xb0d024[_0x0e63('0x20')](_0x2ea651[0x0]);_0xb0d024[_0x0e63('0x20')](_0x2ea651[0x1]);_0xb0d024[_0x0e63('0x20')](_0x2ea651[0x2]);_0xb0d024[_0x0e63('0x20')](_0x2ea651[0x3]);_0xb0d024[_0x0e63('0x20')](_0x2ea651[_0x0e63('0x21')](0x4,_0x2ea651[_0x0e63('0x19')])[_0x0e63('0x1b')](','));break;case _0x0e63('0x26'):var _0x33953c=_0x32691d['appdata'][_0x0e63('0x24')](',');_0xb0d024[_0x0e63('0x20')](_0x33953c[0x0]);_0xb0d024['push'](_0x33953c[0x1]);_0xb0d024[_0x0e63('0x20')](_0x33953c[0x2]);_0xb0d024[_0x0e63('0x20')](_0x33953c[0x3]);_0xb0d024[_0x0e63('0x20')](_0x33953c[_0x0e63('0x21')](0x4,_0x33953c['length'])[_0x0e63('0x1b')](','));break;case _0x0e63('0x16'):_0xb0d024[_0x0e63('0x20')](_0x32691d[_0x0e63('0x23')]);break;case _0x0e63('0x27'):_0xb0d024[_0x0e63('0x20')](_0x32691d['TagId']);_0xb0d024[_0x0e63('0x20')](_0x32691d[_0x0e63('0x23')]);break;case _0x0e63('0x28'):var _0x34d131=utils[_0x0e63('0x29')](_0x35643c[_0x0e63('0x2a')]['notificationTemplate'],_0x35643c);var _0x36c466=_0x32691d[_0x0e63('0x23')][_0x0e63('0x24')](',');_0xb0d024[_0x0e63('0x20')](_0x36c466[0x0]);_0xb0d024[_0x0e63('0x20')](_0x36c466[0x1]);_0xb0d024[_0x0e63('0x20')](_0x36c466[0x2]);_0xb0d024['push'](_0x36c466[0x3]);_0xb0d024[_0x0e63('0x20')](_0x36c466[0x4]);_0xb0d024['push'](_0x36c466[0x5]);_0xb0d024[_0x0e63('0x20')](_0x36c466[0x6]);_0xb0d024[_0x0e63('0x20')](_0x36c466[0x7]);_0xb0d024[_0x0e63('0x20')](_0x36c466[0x8]);_0xb0d024[_0x0e63('0x20')](_0x36c466[0x9]);_0xb0d024[_0x0e63('0x20')](_0x36c466[0xa]);_0xb0d024['push'](_0x35643c['interaction']['id']);_0xb0d024['push'](_0x35643c[_0x0e63('0x16')]['id']);_0xb0d024[_0x0e63('0x20')](_0x32691d[_0x0e63('0x2b')]);_0xb0d024[_0x0e63('0x20')](_0x35643c[_0x0e63('0x17')]['ContactId']);_0xb0d024['push'](_0x35643c[_0x0e63('0x2c')]['body']);_0xb0d024[_0x0e63('0x20')](_0x34d131);break;default:_0xb0d024=_['isNil'](_0x32691d[_0x0e63('0x23')])?[]:_0x32691d[_0x0e63('0x23')]['split'](',');}var _0x198b04={'id':util[_0x0e63('0xd')](_0x0e63('0x2d'),_0x37f6e4,_0x32691d['id'],_0x32691d[_0x0e63('0x1c')]),'condition':require(_0x0e63('0x2e'))[_0x0e63('0x2f')](_0x37f6e4,getIntervals(_0xf547b8[_0x0e63('0x30')],_0x32691d),_0xf547b8),'consequence':require(_0x0e63('0x31')+_0x32691d[_0x0e63('0x1c')])['consequence'](_0x37f6e4,_0xb0d024,_0xf547b8,_0x35643c),'p':_0x32691d['priority']||0x0};logger[_0x0e63('0x32')]('Push\x20new\x20rule',_0x198b04['id'],_0x0e63('0x33'),getIntervals(_0xf547b8[_0x0e63('0x30')],_0x32691d)[_0x0e63('0x1b')](_0x0e63('0x34')));_0x503f34['push'](_0x198b04);}else{logger[_0x0e63('0x35')](_0x0e63('0x36'),path[_0x0e63('0x1b')](__dirname,_0x0e63('0x18'),_0x32691d[_0x0e63('0x1c')]+_0x0e63('0x37')));}}_0xf547b8[_0x0e63('0x14')][_0x37f6e4]=new RuleEngine(_0x503f34);_0xf547b8[_0x0e63('0x14')][_0x37f6e4][_0x0e63('0x38')](_0x35643c,function(_0x18e754){logger['info'](_0x0e63('0x39'),JSON[_0x0e63('0x3a')](_0x18e754[_0x0e63('0x3b')]));if(_0xf547b8[_0x0e63('0x14')][_0x37f6e4]){_0xf547b8['rules'][_0x37f6e4][_0x0e63('0x3c')](_0x0e63('0x3d'));}});return _0x5d1f1e({'code':0xc8,'message':_0x35643c});}else{logger[_0x0e63('0x32')]('No\x20applications\x20to\x20execute');return _0x5d1f1e({'code':0xc8,'message':_0x35643c});}}catch(_0x4577d9){logger[_0x0e63('0x35')](_0x4577d9[_0x0e63('0x3e')]);return _0x5d8660(_0x47f3e2['error'](0x1f4,_0x4577d9));}}return _0x5d8660(_0x0e63('0x3f'));});},'AcceptMessage':function(_0x110917){var _0x124acb=this;return new Promise(function(_0x17bdc9,_0x5e6db2){if(_0x110917[_0x0e63('0x40')]&&_0x110917['agent']['id']){if(_0xf547b8[_0x0e63('0x41')][_0x110917[_0x0e63('0x40')]['id']]){_0xf547b8[_0x0e63('0x41')][_0x110917[_0x0e63('0x40')]['id']][_0x0e63('0x42')]=![];_0xf547b8[_0x0e63('0x41')][_0x110917[_0x0e63('0x40')]['id']][_0x0e63('0x43')]=undefined;}}if(_0x110917['message']&&_0x110917['message']['id']){try{var _0x59e19e=getId(_0x110917[_0x0e63('0x15')],_0x110917[_0x0e63('0x16')]?_0x110917[_0x0e63('0x16')]['id']:0x0,_0x110917['interaction']?_0x110917[_0x0e63('0x17')]['id']:0x0);if(_0xf547b8[_0x0e63('0x14')][_0x59e19e]){_0xf547b8[_0x0e63('0x14')][_0x59e19e][_0x0e63('0x3c')]('end');if(rpc[_0x110917['channel']+_0x0e63('0x44')]){rpc[_0x110917[_0x0e63('0x15')]+'QueueReport'][_0x0e63('0x45')](_0x59e19e,{'UserId':_0x110917[_0x0e63('0x16')][_0x0e63('0x46')]})['catch'](function(_0x1c8e33){logger[_0x0e63('0x35')](_0x0e63('0x47'));});}}return _0x17bdc9({'code':0xc8,'message':_0x110917});}catch(_0x54b482){logger[_0x0e63('0x35')](_0x54b482[_0x0e63('0x3e')]);return _0x5e6db2(_0x124acb[_0x0e63('0x35')](0x1f4,_0x54b482));}}logger[_0x0e63('0x35')](_0x0e63('0x48'));return _0x5e6db2(_0x124acb[_0x0e63('0x35')](0x1f4,_0x0e63('0x48')));});},'RejectMessage':function(_0x118418){var _0x39ba10=this;return new Promise(function(_0x1978b1,_0x5a513d){if(_0x118418[_0x0e63('0x40')]&&_0x118418[_0x0e63('0x40')]['id']){try{if(_0xf547b8[_0x0e63('0x41')][_0x118418[_0x0e63('0x40')]['id']]){_0xf547b8[_0x0e63('0x41')][_0x118418[_0x0e63('0x40')]['id']][_0x0e63('0x42')]=![];_0xf547b8[_0x0e63('0x41')][_0x118418['agent']['id']][_0x0e63('0x43')]=undefined;}return _0x1978b1({'code':0xc8,'message':_0x118418});}catch(_0x398706){logger[_0x0e63('0x35')](_0x398706[_0x0e63('0x3e')]);return _0x5a513d(_0x39ba10[_0x0e63('0x35')](0x1f4,_0x398706));}}logger[_0x0e63('0x35')](_0x0e63('0x48'));return _0x5a513d(_0x39ba10[_0x0e63('0x35')](0x1f4,_0x0e63('0x48')));});},'AbandonInteraction':function(_0x4266a1){var _0x4351ff=this;return new Promise(function(_0x21e832,_0x2e6b4a){if(_0x4266a1['channel']&&_0x4266a1[_0x0e63('0x17')]&&_0x4266a1[_0x0e63('0x17')]['id']){try{var _0x4835d1=getId(_0x4266a1[_0x0e63('0x15')],_0x4266a1[_0x0e63('0x16')]?_0x4266a1['message']['id']:0x0,_0x4266a1['interaction']?_0x4266a1[_0x0e63('0x17')]['id']:0x0);if(_0xf547b8[_0x0e63('0x14')][_0x4835d1]){_0xf547b8[_0x0e63('0x14')][_0x4835d1][_0x0e63('0x3c')](_0x0e63('0x49'));}return _0x21e832({'code':0xc8,'message':_0x4266a1});}catch(_0x274e2c){logger[_0x0e63('0x35')](_0x274e2c[_0x0e63('0x3e')]);return _0x2e6b4a(_0x4351ff[_0x0e63('0x35')](0x1f4,_0x274e2c));}}logger[_0x0e63('0x35')](_0x0e63('0x48'));return _0x2e6b4a(_0x4351ff[_0x0e63('0x35')](0x1f4,_0x0e63('0x48')));});},'AgentCapacity':function(_0x453be1){var _0x3a338a=this;return new Promise(function(_0x2a3eb3,_0x3d37a5){if(_0xf547b8[_0x0e63('0x41')][_0x0e63('0x4a')](_0x453be1['id'])){for(var _0x1d3d88 in _0x453be1[_0x0e63('0x4b')]){if(_0x453be1[_0x0e63('0x4b')][_0x0e63('0x4a')](_0x1d3d88)){if(_0xf547b8[_0x0e63('0x41')][_0x453be1['id']][_0x0e63('0x4a')](_0x1d3d88+'CurrentCapacity')){_0xf547b8[_0x0e63('0x41')][_0x453be1['id']][_0x1d3d88+'CurrentCapacity']=parseInt(_0x453be1[_0x0e63('0x4b')][_0x1d3d88],0xa);}}}_0xf547b8['agents'][_0x453be1['id']]['updateRealtime']();return _0x2a3eb3({'code':0xc8,'message':_0xf547b8[_0x0e63('0x41')][_0x453be1['id']]});}else{return _0x3d37a5(_0x3a338a[_0x0e63('0x35')](0x1f4,_0x0e63('0x4c')));}});},'Agents':function(_0x5596ba){return new Promise(function(_0x429120,_0x35f143){var _0x1dcbb0=_['values'](_0xf547b8[_0x0e63('0x41')]);_0x429120({'count':_0x1dcbb0[_0x0e63('0x19')],'rows':_0x1dcbb0});});},'ChatQueues':function(_0x597cf2){return new Promise(function(_0x5b84b3,_0x3e8ca2){var _0x4b48fa=[];for(var _0x2d925e in _0xf547b8['chatQueues']){if(_0xf547b8[_0x0e63('0x4d')][_0x0e63('0x4a')](_0x2d925e)){var _0x3f7211=_0xf547b8[_0x0e63('0x4d')][_0x2d925e];var _0x3b10fa={'id':_0x3f7211['id'],'available':_0x3f7211['available'],'loggedIn':_0x3f7211[_0x0e63('0x4e')],'name':_0x3f7211[_0x0e63('0x4f')],'paused':_0x3f7211[_0x0e63('0x50')],'waiting':_0x3f7211['waiting']};_0x4b48fa[_0x0e63('0x20')](_0x3b10fa);}}_0x5b84b3({'count':_0x4b48fa[_0x0e63('0x19')],'rows':_0x4b48fa});});},'MailQueues':function(_0x33c5e6){return new Promise(function(_0x2da3b8,_0x5120be){var _0x4469b7=[];for(var _0x2b9fdd in _0xf547b8[_0x0e63('0x51')]){if(_0xf547b8['mailQueues'][_0x0e63('0x4a')](_0x2b9fdd)){var _0x4beed1=_0xf547b8['mailQueues'][_0x2b9fdd];var _0x46fbed={'id':_0x4beed1['id'],'available':_0x4beed1[_0x0e63('0x52')],'loggedIn':_0x4beed1[_0x0e63('0x4e')],'name':_0x4beed1['name'],'paused':_0x4beed1['paused'],'waiting':_0x4beed1[_0x0e63('0x53')]};_0x4469b7[_0x0e63('0x20')](_0x46fbed);}}_0x2da3b8({'count':_0x4469b7[_0x0e63('0x19')],'rows':_0x4469b7});});},'OpenchannelQueues':function(_0x1bf9cd){return new Promise(function(_0x38babf,_0x9f28d8){var _0x4a7457=[];for(var _0x54b7fc in _0xf547b8[_0x0e63('0x54')]){if(_0xf547b8['openchannelQueues'][_0x0e63('0x4a')](_0x54b7fc)){var _0x4e537e=_0xf547b8['openchannelQueues'][_0x54b7fc];var _0x5ae0c1={'id':_0x4e537e['id'],'available':_0x4e537e['available'],'loggedIn':_0x4e537e[_0x0e63('0x4e')],'name':_0x4e537e[_0x0e63('0x4f')],'paused':_0x4e537e[_0x0e63('0x50')],'waiting':_0x4e537e[_0x0e63('0x53')]};_0x4a7457[_0x0e63('0x20')](_0x5ae0c1);}}_0x38babf({'count':_0x4a7457[_0x0e63('0x19')],'rows':_0x4a7457});});},'SmsQueues':function(_0x3d42c8){return new Promise(function(_0x2af0a2,_0x118e71){var _0x5e1225=[];for(var _0x15e33c in _0xf547b8[_0x0e63('0x55')]){if(_0xf547b8[_0x0e63('0x55')][_0x0e63('0x4a')](_0x15e33c)){var _0x146755=_0xf547b8[_0x0e63('0x55')][_0x15e33c];var _0x29ab2f={'id':_0x146755['id'],'available':_0x146755['available'],'loggedIn':_0x146755[_0x0e63('0x4e')],'name':_0x146755[_0x0e63('0x4f')],'paused':_0x146755[_0x0e63('0x50')],'waiting':_0x146755['waiting']};_0x5e1225[_0x0e63('0x20')](_0x29ab2f);}}_0x2af0a2({'count':_0x5e1225[_0x0e63('0x19')],'rows':_0x5e1225});});},'FaxQueues':function(_0x5f045e){return new Promise(function(_0x18a77a,_0x106c46){var _0x2c50e0=[];for(var _0x1666e9 in _0xf547b8['faxQueues']){if(_0xf547b8[_0x0e63('0x56')][_0x0e63('0x4a')](_0x1666e9)){var _0x514645=_0xf547b8[_0x0e63('0x56')][_0x1666e9];var _0x18ca2c={'id':_0x514645['id'],'available':_0x514645[_0x0e63('0x52')],'loggedIn':_0x514645['loggedIn'],'name':_0x514645[_0x0e63('0x4f')],'paused':_0x514645[_0x0e63('0x50')],'waiting':_0x514645['waiting']};_0x2c50e0[_0x0e63('0x20')](_0x18ca2c);}}_0x18a77a({'count':_0x2c50e0['length'],'rows':_0x2c50e0});});},'WhatsappQueues':function(_0x48bffb){return new Promise(function(_0x4933e0,_0x5cde3a){var _0x4dc889=[];for(var _0x2f1190 in _0xf547b8[_0x0e63('0x57')]){if(_0xf547b8[_0x0e63('0x57')][_0x0e63('0x4a')](_0x2f1190)){var _0x34eda1=_0xf547b8[_0x0e63('0x57')][_0x2f1190];var _0x5755c3={'id':_0x34eda1['id'],'available':_0x34eda1[_0x0e63('0x52')],'loggedIn':_0x34eda1['loggedIn'],'name':_0x34eda1[_0x0e63('0x4f')],'paused':_0x34eda1[_0x0e63('0x50')],'waiting':_0x34eda1[_0x0e63('0x53')]};_0x4dc889['push'](_0x5755c3);}}_0x4933e0({'count':_0x4dc889[_0x0e63('0x19')],'rows':_0x4dc889});});},'ChatQueuesWaitingInteractions':function(_0x51a406){return new Promise(function(_0x3f896f,_0x3e6835){var _0x3bcd3d=_['values'](_0xf547b8[_0x0e63('0x58')]);_0x3f896f({'count':_0x3bcd3d['length'],'rows':_0x3bcd3d});});},'MailQueuesWaitingInteractions':function(_0x5021fa){return new Promise(function(_0x1bb055,_0x25332d){var _0x5c5421=_['values'](_0xf547b8[_0x0e63('0x59')]);_0x1bb055({'count':_0x5c5421[_0x0e63('0x19')],'rows':_0x5c5421});});},'OpenchannelQueuesWaitingInteractions':function(_0x310733){return new Promise(function(_0x5230be,_0x1fbb05){var _0x1c14d1=_[_0x0e63('0x5a')](_0xf547b8['openchannelQueuesWaitingInteractions']);_0x5230be({'count':_0x1c14d1[_0x0e63('0x19')],'rows':_0x1c14d1});});},'SmsQueuesWaitingInteractions':function(_0x5b612c){return new Promise(function(_0x1b70db,_0x2ec40e){var _0x42ba06=_[_0x0e63('0x5a')](_0xf547b8['smsQueuesWaitingInteractions']);_0x1b70db({'count':_0x42ba06[_0x0e63('0x19')],'rows':_0x42ba06});});},'FaxQueuesWaitingInteractions':function(_0x7b2288){return new Promise(function(_0x22c85e,_0x120ea4){var _0x31ddc1=_[_0x0e63('0x5a')](_0xf547b8['faxQueuesWaitingInteractions']);_0x22c85e({'count':_0x31ddc1[_0x0e63('0x19')],'rows':_0x31ddc1});});},'WhatsappQueuesWaitingInteractions':function(_0x2ca6a8){return new Promise(function(_0x5157a9,_0x2470d8){var _0x50c5a5=_[_0x0e63('0x5a')](_0xf547b8[_0x0e63('0x5b')]);_0x5157a9({'count':_0x50c5a5['length'],'rows':_0x50c5a5});});}};var _0xaacc5=jayson[_0x0e63('0x5c')](_0x61c395)[_0x0e63('0x5d')]();_0xaacc5['on'](_0x0e63('0x35'),function(_0x12cf6c){logger[_0x0e63('0x35')](JSON[_0x0e63('0x3a')](_0x12cf6c));return _0x187cf5(_0x12cf6c);});_0xaacc5['listen'](0x232c,_0x0e63('0x5e'),function(){console[_0x0e63('0x5f')](_0x0e63('0x60'),0x232c);return _0x208037(_0x0e63('0x61')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 527f348..80d8965 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 _0xd63c=['then','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','format','iftime\x20%s','message','indexOf','error','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','util','bluebird','jayson/promise','lodash','routing','client','request'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xd63c,0x18f));var _0xcd63=function(_0x513f27,_0x1cbc87){_0x513f27=_0x513f27-0x0;var _0xa316b7=_0xd63c[_0x513f27];return _0xa316b7;};'use strict';var util=require(_0xcd63('0x0'));var BPromise=require(_0xcd63('0x1'));var jayson=require(_0xcd63('0x2'));var _=require(_0xcd63('0x3'));var logger=require('../../../config/logger')(_0xcd63('0x4'));var client=jayson[_0xcd63('0x5')]['http']({'port':0x232a});function request(_0x3e9338,_0x56aa37){return new BPromise(function(_0x37fcbb,_0xfe5a06){return client[_0xcd63('0x6')](_0x3e9338,_0x56aa37)[_0xcd63('0x7')](function(_0x2f0b9f){if(_0x2f0b9f['error']){return _0xfe5a06(_0x2f0b9f['error']['message']);}else{return _0x37fcbb(_0x2f0b9f['result']);}})[_0xcd63('0x8')](function(_0x2ae54f){return _0xfe5a06(_0x2ae54f);});});}exports['condition']=function(_0x12b9f3,_0x4def2d,_0x322da6){return function(_0x517236){if(_0x322da6[_0xcd63('0x9')]&&!_0x322da6[_0xcd63('0x9')][_0x12b9f3]){logger[_0xcd63('0xa')](_0xcd63('0xb'),_0x12b9f3);return _0x517236[_0xcd63('0xc')]();}var _0x4e77e1=[];for(var _0x3aa460=0x0;_0x3aa460<_0x4def2d[_0xcd63('0xd')];_0x3aa460+=0x1){_0x4e77e1['push'](request(_0xcd63('0xe'),{'command':util[_0xcd63('0xf')](_0xcd63('0x10'),_0x4def2d[_0x3aa460])})[_0xcd63('0x7')](function(_0x4d5361){return _0x4d5361&&_0x4d5361[_0xcd63('0x11')]&&_0x4d5361[_0xcd63('0x11')][_0xcd63('0x12')]('true')>=0x0?!![]:![];})[_0xcd63('0x8')](function(_0x3fa415){logger[_0xcd63('0x13')](_0xcd63('0x14'),_0x12b9f3,_0x4def2d[_0x3aa460]);}));}BPromise[_0xcd63('0x15')](_0x4e77e1)[_0xcd63('0x7')](function(_0x2ce0a2){var _0xb62487=_[_0xcd63('0x16')](_0x2ce0a2);logger['info'](_0xcd63('0x17'),_0x12b9f3,_0x4def2d[_0xcd63('0x18')](_0xcd63('0x19')),_0xb62487);_0x517236[_0xcd63('0x1a')](_0xb62487);})[_0xcd63('0x8')](function(_0x504865){console[_0xcd63('0x1b')](_0x504865);logger[_0xcd63('0x13')](_0xcd63('0x17'),_0x12b9f3,_0x4def2d[_0xcd63('0x18')]('\x20|\x20'),_0x504865[_0xcd63('0x1c')]);_0x517236[_0xcd63('0xc')]();});};}; \ No newline at end of file +var _0x962e=['Command','format','message','indexOf','true','[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','join','when','log','\x20|\x20','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','request','then','error','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push'];(function(_0x506464,_0x512fd0){var _0x5e3a52=function(_0x25b440){while(--_0x25b440){_0x506464['push'](_0x506464['shift']());}};_0x5e3a52(++_0x512fd0);}(_0x962e,0x67));var _0xe962=function(_0xc471d2,_0x26ab16){_0xc471d2=_0xc471d2-0x0;var _0x334c68=_0x962e[_0xc471d2];return _0x334c68;};'use strict';var util=require(_0xe962('0x0'));var BPromise=require(_0xe962('0x1'));var jayson=require(_0xe962('0x2'));var _=require(_0xe962('0x3'));var logger=require(_0xe962('0x4'))(_0xe962('0x5'));var client=jayson['client']['http']({'port':0x232a});function request(_0x19bcc5,_0x4ead24){return new BPromise(function(_0xe2c01b,_0xb621ed){return client[_0xe962('0x6')](_0x19bcc5,_0x4ead24)[_0xe962('0x7')](function(_0x3ad8f8){if(_0x3ad8f8[_0xe962('0x8')]){return _0xb621ed(_0x3ad8f8[_0xe962('0x8')]['message']);}else{return _0xe2c01b(_0x3ad8f8['result']);}})[_0xe962('0x9')](function(_0x1b9e7d){return _0xb621ed(_0x1b9e7d);});});}exports[_0xe962('0xa')]=function(_0x85b7d1,_0x299434,_0x176c80){return function(_0x789b1f){if(_0x176c80[_0xe962('0xb')]&&!_0x176c80['rules'][_0x85b7d1]){logger[_0xe962('0xc')](_0xe962('0xd'),_0x85b7d1);return _0x789b1f[_0xe962('0xe')]();}var _0xe73ba4=[];for(var _0x4c88c6=0x0;_0x4c88c6<_0x299434[_0xe962('0xf')];_0x4c88c6+=0x1){_0xe73ba4[_0xe962('0x10')](request(_0xe962('0x11'),{'command':util[_0xe962('0x12')]('iftime\x20%s',_0x299434[_0x4c88c6])})[_0xe962('0x7')](function(_0xa97215){return _0xa97215&&_0xa97215[_0xe962('0x13')]&&_0xa97215[_0xe962('0x13')][_0xe962('0x14')](_0xe962('0x15'))>=0x0?!![]:![];})[_0xe962('0x9')](function(_0x362f9a){logger[_0xe962('0x8')](_0xe962('0x16'),_0x85b7d1,_0x299434[_0x4c88c6]);}));}BPromise['all'](_0xe73ba4)[_0xe962('0x7')](function(_0x4423fd){var _0x523c09=_[_0xe962('0x17')](_0x4423fd);logger['info'](_0xe962('0x18'),_0x85b7d1,_0x299434[_0xe962('0x19')]('\x20|\x20'),_0x523c09);_0x789b1f[_0xe962('0x1a')](_0x523c09);})['catch'](function(_0x28457f){console[_0xe962('0x1b')](_0x28457f);logger['error'](_0xe962('0x18'),_0x85b7d1,_0x299434[_0xe962('0x19')](_0xe962('0x1c')),_0x28457f[_0xe962('0x1d')]);_0x789b1f[_0xe962('0xe')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index af949dc..750121b 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 _0xa571=['calleridname','ATTENDED','secondtransfererexten','transfertargetuniqueid','clone','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','diffTime','agent','[%s][agents][hangup]','lodash','util','./utils','info','format','channel','membername','interface','calleridnum','connectedlinenum','lastevent','queue','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','debug','[%s][agents][agentcalled]','agentcalledAt','now','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','talktime','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','ringtime','connect','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','transfer','transferexten','transferuniqueid','transfereeuniqueid','agententerreason'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xa571,0x107));var _0x1a57=function(_0x37f8b0,_0x2da2c3){_0x37f8b0=_0x37f8b0-0x0;var _0x3896c5=_0xa571[_0x37f8b0];return _0x3896c5;};'use strict';var _=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var utils=require(_0x1a57('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1067d9,_0x48485e){utils[_0x1a57('0x3')](util[_0x1a57('0x4')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1067d9['uniqueid'],_0x1067d9[_0x1a57('0x5')],_0x1067d9['queue'],_0x1067d9[_0x1a57('0x6')],_0x1067d9[_0x1a57('0x7')],_0x1067d9[_0x1a57('0x8')],_0x1067d9[_0x1a57('0x9')],_0x1067d9[_0x1a57('0xa')]));if(_0x1067d9[_0x1a57('0xb')]){utils['getVoiceQueueByName'](_0x1067d9[_0x1a57('0xb')])[_0x1a57('0xc')](function(_0x3631d6){if(_0x3631d6){_0x1067d9['type']=_0x3631d6[_0x1a57('0xd')];_0x1067d9[_0x1a57('0xe')]=_0x1067d9[_0x1a57('0xf')]?_0x3631d6[_0x1a57('0x10')]:![];_0x1067d9[_0x1a57('0x11')]=_0x1067d9[_0x1a57('0xe')]?_0x3631d6[_0x1a57('0x12')]:0x0;}utils[_0x1a57('0x13')]('CreateVoiceAgentReport',_0x1067d9);});}else{utils['request'](_0x1a57('0x14'),_0x1067d9);}if(_0x48485e){delete transfers[_0x1067d9[_0x1a57('0x15')]];}else{delete agents[_0x1067d9[_0x1a57('0x16')]];}}exports['agentcalled']=function(_0x3de36a){try{utils[_0x1a57('0x17')](util['format'](_0x1a57('0x18'),_0x3de36a['uniqueid']),_0x3de36a);agents[_0x3de36a[_0x1a57('0x16')]]=_0x3de36a;agents[_0x3de36a[_0x1a57('0x16')]][_0x1a57('0x19')]=utils[_0x1a57('0x1a')]();agents[_0x3de36a['destuniqueid']][_0x1a57('0xa')]='called';agents[_0x3de36a['destuniqueid']][_0x1a57('0x9')]=null;agents[_0x3de36a[_0x1a57('0x16')]][_0x1a57('0x1b')]=null;utils['info'](util[_0x1a57('0x4')](_0x1a57('0x1c'),_0x3de36a[_0x1a57('0x15')],agents[_0x3de36a['destuniqueid']][_0x1a57('0x6')],_0x3de36a[_0x1a57('0x16')]));}catch(_0x451b34){utils[_0x1a57('0x1d')](util[_0x1a57('0x4')]('[%s][agents][agentcalled]',_0x3de36a['uniqueid']),_0x451b34);}};exports[_0x1a57('0x1e')]=function(_0x21e811){try{if(!_[_0x1a57('0x1f')](agents[_0x21e811['destuniqueid']])){utils['debug'](util['format'](_0x1a57('0x20'),_0x21e811[_0x1a57('0x15')]),_0x21e811);utils[_0x1a57('0x3')](util[_0x1a57('0x4')](_0x1a57('0x21'),_0x21e811[_0x1a57('0x15')],agents[_0x21e811[_0x1a57('0x16')]][_0x1a57('0x6')],_0x21e811[_0x1a57('0x16')]));agents[_0x21e811[_0x1a57('0x16')]][_0x1a57('0x1e')]=!![];agents[_0x21e811[_0x1a57('0x16')]][_0x1a57('0x22')]=utils[_0x1a57('0x1a')]();agents[_0x21e811[_0x1a57('0x16')]][_0x1a57('0xa')]=_0x1a57('0x23');agents[_0x21e811[_0x1a57('0x16')]][_0x1a57('0x24')]=_0x1a57('0x23');agents[_0x21e811[_0x1a57('0x16')]][_0x1a57('0x25')]=_0x21e811['ringtime']?parseInt(_0x21e811['ringtime'])/0x3e8:0x0;agents[_0x21e811[_0x1a57('0x16')]][_0x1a57('0x26')]=0x0;unanswered['push'](_0x21e811[_0x1a57('0x16')]);}}catch(_0x54f6a5){utils[_0x1a57('0x1d')](util[_0x1a57('0x4')]('[%s][agents][agentringnoanswer]',_0x21e811[_0x1a57('0x15')]),_0x54f6a5);}};exports[_0x1a57('0x27')]=function(_0x30527c){try{_[_0x1a57('0x28')](agents,function(_0x492b90,_0x366d5f){if(_0x492b90[_0x1a57('0x15')]==_0x30527c[_0x1a57('0x15')]&&!_[_0x1a57('0x29')](unanswered,_0x492b90['destuniqueid'])){utils[_0x1a57('0x17')](util[_0x1a57('0x4')](_0x1a57('0x2a'),_0x30527c[_0x1a57('0x15')]),_0x30527c);utils[_0x1a57('0x3')](util[_0x1a57('0x4')](_0x1a57('0x2b'),_0x30527c[_0x1a57('0x15')],_0x492b90[_0x1a57('0x6')],_0x492b90['destuniqueid']));_0x492b90[_0x1a57('0x1e')]=!![];_0x492b90[_0x1a57('0x22')]=utils['now']();_0x492b90['lastevent']=_0x1a57('0x2c');_0x492b90[_0x1a57('0x24')]=_0x1a57('0x2c');_0x492b90[_0x1a57('0x25')]=_0x30527c[_0x1a57('0x25')];_0x492b90[_0x1a57('0x26')]=0x0;writeDB(_0x492b90);}});}catch(_0xe80d94){utils[_0x1a57('0x1d')](util[_0x1a57('0x4')](_0x1a57('0x2a'),_0x30527c[_0x1a57('0x15')]),_0xe80d94);}};exports[_0x1a57('0x2d')]=function(_0x12f3a7){try{if(agents[_0x12f3a7[_0x1a57('0x16')]]){utils[_0x1a57('0x17')](util[_0x1a57('0x4')](_0x1a57('0x2e'),_0x12f3a7[_0x1a57('0x15')]),_0x12f3a7);utils['info'](util[_0x1a57('0x4')](_0x1a57('0x2f'),_0x12f3a7[_0x1a57('0x15')],agents[_0x12f3a7[_0x1a57('0x16')]][_0x1a57('0x6')],_0x12f3a7[_0x1a57('0x16')]));agents[_0x12f3a7[_0x1a57('0x16')]][_0x1a57('0x30')]=utils[_0x1a57('0x1a')]();agents[_0x12f3a7['destuniqueid']]['connectedlinenum']=_0x12f3a7['connectedlinenum'];agents[_0x12f3a7['destuniqueid']][_0x1a57('0x1b')]=_0x12f3a7[_0x1a57('0x1b')];agents[_0x12f3a7[_0x1a57('0x16')]]['holdtime']=_0x12f3a7[_0x1a57('0x31')];agents[_0x12f3a7[_0x1a57('0x16')]][_0x1a57('0xa')]=_0x1a57('0x32');_['forIn'](agents,function(_0x1be254,_0x5e79f0){if(_0x1be254[_0x1a57('0x16')]!=_0x12f3a7[_0x1a57('0x16')]&&_0x1be254[_0x1a57('0x15')]==_0x12f3a7['uniqueid']){_0x1be254[_0x1a57('0x26')]=0x0;_0x1be254[_0x1a57('0x25')]=_0x12f3a7[_0x1a57('0x31')];_0x1be254[_0x1a57('0x1e')]=!![];_0x1be254[_0x1a57('0x22')]=utils['now']();_0x1be254[_0x1a57('0xa')]='answered_elsewhere';_0x1be254['reason']=_0x1a57('0x33');_0x1be254['answeredelsewheredestinationuniqueid']=_0x12f3a7[_0x1a57('0x16')];_0x1be254[_0x1a57('0x34')]=_0x12f3a7[_0x1a57('0x6')];writeDB(_0x1be254);}});}}catch(_0x59abb1){utils[_0x1a57('0x1d')](util[_0x1a57('0x4')](_0x1a57('0x2e'),_0x12f3a7[_0x1a57('0x15')]),_0x59abb1);}};exports['agentcomplete']=function(_0xc7bab4){try{if(!_[_0x1a57('0x1f')](agents[_0xc7bab4['destuniqueid']])){utils[_0x1a57('0x17')](util['format']('[%s][agents][agentcomplete]',_0xc7bab4[_0x1a57('0x15')]),_0xc7bab4);utils[_0x1a57('0x3')](util[_0x1a57('0x4')](_0x1a57('0x35'),_0xc7bab4['uniqueid'],agents[_0xc7bab4[_0x1a57('0x16')]][_0x1a57('0x6')],_0xc7bab4[_0x1a57('0x16')]));agents[_0xc7bab4[_0x1a57('0x16')]][_0x1a57('0xf')]=!![];agents[_0xc7bab4['destuniqueid']][_0x1a57('0x36')]=utils[_0x1a57('0x1a')]();agents[_0xc7bab4[_0x1a57('0x16')]][_0x1a57('0x26')]=utils['diffTime'](agents[_0xc7bab4[_0x1a57('0x16')]]['agentcompleteAt'],agents[_0xc7bab4[_0x1a57('0x16')]][_0x1a57('0x30')]);agents[_0xc7bab4[_0x1a57('0x16')]][_0x1a57('0x24')]=_0xc7bab4[_0x1a57('0x24')];agents[_0xc7bab4[_0x1a57('0x16')]][_0x1a57('0xa')]=_0x1a57('0x37');writeDB(agents[_0xc7bab4[_0x1a57('0x16')]]);}}catch(_0x424065){utils[_0x1a57('0x1d')](util[_0x1a57('0x4')](_0x1a57('0x38'),_0xc7bab4['uniqueid']),_0x424065);}};exports[_0x1a57('0x39')]=function(_0x480aff){try{if(!_[_0x1a57('0x1f')](agents[_0x480aff[_0x1a57('0x3a')]])){utils[_0x1a57('0x17')](util[_0x1a57('0x4')](_0x1a57('0x3b'),_0x480aff[_0x1a57('0x15')]),_0x480aff);utils[_0x1a57('0x3')](util[_0x1a57('0x4')](_0x1a57('0x3c'),_0x480aff['uniqueid'],agents[_0x480aff[_0x1a57('0x3a')]][_0x1a57('0x6')],agents[_0x480aff['transfereruniqueid']][_0x1a57('0x15')]));agents[_0x480aff[_0x1a57('0x3a')]]['transfer']=!![];agents[_0x480aff[_0x1a57('0x3a')]][_0x1a57('0x3d')]='blind';agents[_0x480aff['transfereruniqueid']]['transferexten']=_0x480aff[_0x1a57('0x3e')];agents[_0x480aff[_0x1a57('0x3a')]]['transferuniqueid']=agents[_0x480aff[_0x1a57('0x3a')]][_0x1a57('0x15')];}}catch(_0x572202){utils['error'](util['format'](_0x1a57('0x3b'),_0x480aff[_0x1a57('0x15')]),_0x572202);}};exports[_0x1a57('0x3f')]=function(_0x31be00){try{utils[_0x1a57('0x17')](util[_0x1a57('0x4')](_0x1a57('0x40'),_0x31be00[_0x1a57('0x41')]),_0x31be00);if(_0x31be00['origtransfereruniqueid']==_0x31be00['origtransfererlinkedid']){if(!_['isNil'](agents[_0x31be00['secondtransfereruniqueid']])){utils['info'](util[_0x1a57('0x4')](_0x1a57('0x42'),_0x31be00[_0x1a57('0x41')],agents[_0x31be00[_0x1a57('0x43')]][_0x1a57('0x6')]));agents[_0x31be00[_0x1a57('0x43')]][_0x1a57('0x44')]=!![];agents[_0x31be00[_0x1a57('0x43')]]['transfertype']='ATTENDED';agents[_0x31be00['secondtransfereruniqueid']][_0x1a57('0x45')]=_0x31be00['origtransfererexten'];agents[_0x31be00[_0x1a57('0x43')]][_0x1a57('0x46')]=_0x31be00[_0x1a57('0x41')];}if(_0x31be00[_0x1a57('0x47')]&&agents[_0x31be00[_0x1a57('0x47')]]){agents[_0x31be00[_0x1a57('0x47')]][_0x1a57('0x48')]=0x1;transfers[_0x31be00['transfereeuniqueid']]=_['clone'](agents[_0x31be00['transfereeuniqueid']]);transfers[_0x31be00[_0x1a57('0x47')]][_0x1a57('0x8')]=agents[_0x31be00[_0x1a57('0x43')]][_0x1a57('0x8')];transfers[_0x31be00[_0x1a57('0x47')]][_0x1a57('0x49')]=agents[_0x31be00[_0x1a57('0x43')]]['calleridname'];transfers[_0x31be00['transfereeuniqueid']][_0x1a57('0x19')]=utils[_0x1a57('0x1a')]();transfers[_0x31be00[_0x1a57('0x47')]][_0x1a57('0x30')]=utils[_0x1a57('0x1a')]();transfers[_0x31be00[_0x1a57('0x47')]]['holdtime']=0x0;transfers[_0x31be00['transfereeuniqueid']][_0x1a57('0x48')]=0x2;}}else if(_0x31be00[_0x1a57('0x43')]==_0x31be00['secondtransfererlinkedid']){if(!_['isNil'](agents[_0x31be00[_0x1a57('0x41')]])){utils[_0x1a57('0x3')](util[_0x1a57('0x4')](_0x1a57('0x42'),_0x31be00[_0x1a57('0x41')],agents[_0x31be00[_0x1a57('0x41')]][_0x1a57('0x6')]));agents[_0x31be00['origtransfereruniqueid']]['transfer']=!![];agents[_0x31be00[_0x1a57('0x41')]][_0x1a57('0x3d')]=_0x1a57('0x4a');agents[_0x31be00[_0x1a57('0x41')]]['transferexten']=_0x31be00[_0x1a57('0x4b')];agents[_0x31be00[_0x1a57('0x41')]][_0x1a57('0x46')]=_0x31be00[_0x1a57('0x43')];}if(_0x31be00[_0x1a57('0x4c')]&&agents[_0x31be00['transfertargetuniqueid']]){agents[_0x31be00['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x31be00[_0x1a57('0x4c')]]=_[_0x1a57('0x4d')](agents[_0x31be00[_0x1a57('0x4c')]]);transfers[_0x31be00[_0x1a57('0x4c')]][_0x1a57('0x8')]=agents[_0x31be00[_0x1a57('0x41')]][_0x1a57('0x8')];transfers[_0x31be00[_0x1a57('0x4c')]]['calleridname']=agents[_0x31be00[_0x1a57('0x41')]][_0x1a57('0x49')];transfers[_0x31be00['transfertargetuniqueid']]['agentcalledAt']=utils[_0x1a57('0x1a')]();transfers[_0x31be00['transfertargetuniqueid']][_0x1a57('0x30')]=utils[_0x1a57('0x1a')]();transfers[_0x31be00[_0x1a57('0x4c')]][_0x1a57('0x25')]=0x0;transfers[_0x31be00[_0x1a57('0x4c')]][_0x1a57('0x48')]=0x2;}}}catch(_0x213576){utils[_0x1a57('0x1d')](util['format'](_0x1a57('0x40'),_0x31be00[_0x1a57('0x41')]),_0x213576);}};exports['hangup']=function(_0x24b56c){try{utils[_0x1a57('0x17')](util[_0x1a57('0x4')]('[%s][agents][hangup]',_0x24b56c['uniqueid']),_0x24b56c);if(agents[_0x24b56c[_0x1a57('0x15')]]&&agents[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0x24')]===_0x1a57('0x23')){if(_0x24b56c['cause']==='21'){agents[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0x24')]=_0x1a57('0x4e');agents[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0xa')]='rejected';}utils[_0x1a57('0x3')](util[_0x1a57('0x4')](_0x1a57('0x4f'),_0x24b56c[_0x1a57('0x15')],agents[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0x6')],agents[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0x24')],agents[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0xa')]));writeDB(agents[_0x24b56c[_0x1a57('0x15')]]);var _0x48a10e=unanswered[_0x1a57('0x50')](_0x24b56c[_0x1a57('0x15')]);if(_0x48a10e>-0x1){unanswered['splice'](_0x48a10e,0x1);}}if(transfers[_0x24b56c[_0x1a57('0x15')]]){transfers[_0x24b56c[_0x1a57('0x15')]]['agentcomplete']=!![];transfers[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0x36')]=utils[_0x1a57('0x1a')]();transfers[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0x26')]=utils[_0x1a57('0x51')](transfers[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0x36')],transfers[_0x24b56c['uniqueid']][_0x1a57('0x30')]);transfers[_0x24b56c[_0x1a57('0x15')]]['reason']=_0x1a57('0x52');transfers[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0xa')]=_0x1a57('0x37');utils[_0x1a57('0x3')](util[_0x1a57('0x4')](_0x1a57('0x4f'),_0x24b56c[_0x1a57('0x15')],transfers[_0x24b56c[_0x1a57('0x15')]]['membername'],transfers[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0x24')],transfers[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0xa')]));writeDB(transfers[_0x24b56c[_0x1a57('0x15')]],!![]);}if(agents[_0x24b56c['uniqueid']]&&agents[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0x30')]){agents[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0xf')]=!![];agents[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0x36')]=utils[_0x1a57('0x1a')]();agents[_0x24b56c[_0x1a57('0x15')]]['talktime']=utils[_0x1a57('0x51')](agents[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0x36')],agents[_0x24b56c[_0x1a57('0x15')]]['agentconnectAt']);agents[_0x24b56c['uniqueid']]['reason']=agents[_0x24b56c['uniqueid']]['transfer']?_0x1a57('0x44'):_0x1a57('0x52');agents[_0x24b56c['uniqueid']][_0x1a57('0xa')]=_0x1a57('0x37');utils['info'](util[_0x1a57('0x4')](_0x1a57('0x4f'),_0x24b56c[_0x1a57('0x15')],agents[_0x24b56c[_0x1a57('0x15')]]['membername'],agents[_0x24b56c[_0x1a57('0x15')]][_0x1a57('0x24')],agents[_0x24b56c['uniqueid']][_0x1a57('0xa')]));writeDB(agents[_0x24b56c[_0x1a57('0x15')]]);}}catch(_0x42d41e){utils[_0x1a57('0x1d')](util[_0x1a57('0x4')](_0x1a57('0x53'),_0x24b56c[_0x1a57('0x15')]),_0x42d41e);}}; \ No newline at end of file +var _0xf45e=['secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfererexten','transferuniqueid','transfereeuniqueid','clone','calleridname','agentcalledAt','ATTENDED','transfertargetuniqueid','agententerreason','hangup','[%s][agents][hangup]','cause','rejected','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentcomplete','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','debug','[%s][agents][agentringnoanswer]','agentringnoanswerAt','timeout','ringtime','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','talktime','agentconnect','[%s][agents][agentconnect]','agentconnectAt','now','connectedlinename','answered_elsewhere','reason','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','[%s][agents][blindtransfer]','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0xf45e,0x115));var _0xef45=function(_0x172127,_0x2cd369){_0x172127=_0x172127-0x0;var _0x37187b=_0xf45e[_0x172127];return _0x37187b;};'use strict';var _=require(_0xef45('0x0'));var util=require('util');var utils=require(_0xef45('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5762da,_0x17b897){utils[_0xef45('0x2')](util[_0xef45('0x3')](_0xef45('0x4'),_0x5762da[_0xef45('0x5')],_0x5762da[_0xef45('0x6')],_0x5762da[_0xef45('0x7')],_0x5762da[_0xef45('0x8')],_0x5762da[_0xef45('0x9')],_0x5762da[_0xef45('0xa')],_0x5762da[_0xef45('0xb')],_0x5762da[_0xef45('0xc')]));if(_0x5762da[_0xef45('0x7')]){utils[_0xef45('0xd')](_0x5762da[_0xef45('0x7')])[_0xef45('0xe')](function(_0x134c86){if(_0x134c86){_0x5762da[_0xef45('0xf')]=_0x134c86[_0xef45('0xf')];_0x5762da['agentacw']=_0x5762da[_0xef45('0x10')]?_0x134c86[_0xef45('0x11')]:![];_0x5762da[_0xef45('0x12')]=_0x5762da[_0xef45('0x13')]?_0x134c86[_0xef45('0x14')]:0x0;}utils[_0xef45('0x15')]('CreateVoiceAgentReport',_0x5762da);});}else{utils[_0xef45('0x15')](_0xef45('0x16'),_0x5762da);}if(_0x17b897){delete transfers[_0x5762da[_0xef45('0x5')]];}else{delete agents[_0x5762da[_0xef45('0x17')]];}}exports[_0xef45('0x18')]=function(_0x4a6e5c){try{utils['debug'](util[_0xef45('0x3')]('[%s][agents][agentcalled]',_0x4a6e5c[_0xef45('0x5')]),_0x4a6e5c);agents[_0x4a6e5c[_0xef45('0x17')]]=_0x4a6e5c;agents[_0x4a6e5c[_0xef45('0x17')]]['agentcalledAt']=utils['now']();agents[_0x4a6e5c[_0xef45('0x17')]]['lastevent']=_0xef45('0x19');agents[_0x4a6e5c[_0xef45('0x17')]][_0xef45('0xb')]=null;agents[_0x4a6e5c[_0xef45('0x17')]]['connectedlinename']=null;utils['info'](util[_0xef45('0x3')](_0xef45('0x1a'),_0x4a6e5c[_0xef45('0x5')],agents[_0x4a6e5c[_0xef45('0x17')]]['membername'],_0x4a6e5c['destuniqueid']));}catch(_0x2c57fc){utils[_0xef45('0x1b')](util[_0xef45('0x3')](_0xef45('0x1c'),_0x4a6e5c[_0xef45('0x5')]),_0x2c57fc);}};exports[_0xef45('0x1d')]=function(_0x375cbd){try{if(!_['isNil'](agents[_0x375cbd[_0xef45('0x17')]])){utils[_0xef45('0x1e')](util[_0xef45('0x3')](_0xef45('0x1f'),_0x375cbd[_0xef45('0x5')]),_0x375cbd);utils['info'](util[_0xef45('0x3')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x375cbd['uniqueid'],agents[_0x375cbd[_0xef45('0x17')]][_0xef45('0x8')],_0x375cbd[_0xef45('0x17')]));agents[_0x375cbd[_0xef45('0x17')]][_0xef45('0x1d')]=!![];agents[_0x375cbd[_0xef45('0x17')]][_0xef45('0x20')]=utils['now']();agents[_0x375cbd[_0xef45('0x17')]]['lastevent']=_0xef45('0x21');agents[_0x375cbd[_0xef45('0x17')]]['reason']=_0xef45('0x21');agents[_0x375cbd[_0xef45('0x17')]]['holdtime']=_0x375cbd[_0xef45('0x22')]?parseInt(_0x375cbd['ringtime'])/0x3e8:0x0;agents[_0x375cbd['destuniqueid']]['talktime']=0x0;unanswered['push'](_0x375cbd[_0xef45('0x17')]);}}catch(_0x2f72ef){utils[_0xef45('0x1b')](util[_0xef45('0x3')]('[%s][agents][agentringnoanswer]',_0x375cbd[_0xef45('0x5')]),_0x2f72ef);}};exports['queuecallerabandon']=function(_0x2525da){try{_['forIn'](agents,function(_0x3e6922,_0x5bfd2d){if(_0x3e6922['uniqueid']==_0x2525da[_0xef45('0x5')]&&!_[_0xef45('0x23')](unanswered,_0x3e6922[_0xef45('0x17')])){utils[_0xef45('0x1e')](util[_0xef45('0x3')]('[%s][agents][queuecallerabandon]',_0x2525da['uniqueid']),_0x2525da);utils['info'](util[_0xef45('0x3')](_0xef45('0x24'),_0x2525da[_0xef45('0x5')],_0x3e6922[_0xef45('0x8')],_0x3e6922[_0xef45('0x17')]));_0x3e6922[_0xef45('0x1d')]=!![];_0x3e6922[_0xef45('0x20')]=utils['now']();_0x3e6922['lastevent']=_0xef45('0x25');_0x3e6922['reason']=_0xef45('0x25');_0x3e6922['holdtime']=_0x2525da[_0xef45('0x26')];_0x3e6922[_0xef45('0x27')]=0x0;writeDB(_0x3e6922);}});}catch(_0x2a7c53){utils[_0xef45('0x1b')](util[_0xef45('0x3')]('[%s][agents][queuecallerabandon]',_0x2525da[_0xef45('0x5')]),_0x2a7c53);}};exports[_0xef45('0x28')]=function(_0x9df07e){try{if(agents[_0x9df07e['destuniqueid']]){utils['debug'](util[_0xef45('0x3')](_0xef45('0x29'),_0x9df07e['uniqueid']),_0x9df07e);utils[_0xef45('0x2')](util['format']('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x9df07e[_0xef45('0x5')],agents[_0x9df07e[_0xef45('0x17')]][_0xef45('0x8')],_0x9df07e['destuniqueid']));agents[_0x9df07e[_0xef45('0x17')]][_0xef45('0x2a')]=utils[_0xef45('0x2b')]();agents[_0x9df07e[_0xef45('0x17')]]['connectedlinenum']=_0x9df07e['connectedlinenum'];agents[_0x9df07e[_0xef45('0x17')]][_0xef45('0x2c')]=_0x9df07e[_0xef45('0x2c')];agents[_0x9df07e[_0xef45('0x17')]][_0xef45('0x26')]=_0x9df07e[_0xef45('0x22')];agents[_0x9df07e[_0xef45('0x17')]][_0xef45('0xc')]='connect';_['forIn'](agents,function(_0x13f8b2,_0x35d014){if(_0x13f8b2[_0xef45('0x17')]!=_0x9df07e[_0xef45('0x17')]&&_0x13f8b2[_0xef45('0x5')]==_0x9df07e[_0xef45('0x5')]){_0x13f8b2[_0xef45('0x27')]=0x0;_0x13f8b2[_0xef45('0x26')]=_0x9df07e[_0xef45('0x22')];_0x13f8b2[_0xef45('0x1d')]=!![];_0x13f8b2[_0xef45('0x20')]=utils[_0xef45('0x2b')]();_0x13f8b2[_0xef45('0xc')]=_0xef45('0x2d');_0x13f8b2[_0xef45('0x2e')]=_0xef45('0x2d');_0x13f8b2['answeredelsewheredestinationuniqueid']=_0x9df07e[_0xef45('0x17')];_0x13f8b2[_0xef45('0x2f')]=_0x9df07e[_0xef45('0x8')];writeDB(_0x13f8b2);}});}}catch(_0x82c123){utils['error'](util[_0xef45('0x3')]('[%s][agents][agentconnect]',_0x9df07e[_0xef45('0x5')]),_0x82c123);}};exports['agentcomplete']=function(_0x5faf67){try{if(!_[_0xef45('0x30')](agents[_0x5faf67[_0xef45('0x17')]])){utils[_0xef45('0x1e')](util[_0xef45('0x3')](_0xef45('0x31'),_0x5faf67[_0xef45('0x5')]),_0x5faf67);utils['info'](util[_0xef45('0x3')](_0xef45('0x32'),_0x5faf67[_0xef45('0x5')],agents[_0x5faf67[_0xef45('0x17')]][_0xef45('0x8')],_0x5faf67[_0xef45('0x17')]));agents[_0x5faf67[_0xef45('0x17')]][_0xef45('0x10')]=!![];agents[_0x5faf67[_0xef45('0x17')]][_0xef45('0x33')]=utils[_0xef45('0x2b')]();agents[_0x5faf67[_0xef45('0x17')]][_0xef45('0x27')]=utils[_0xef45('0x34')](agents[_0x5faf67[_0xef45('0x17')]]['agentcompleteAt'],agents[_0x5faf67[_0xef45('0x17')]][_0xef45('0x2a')]);agents[_0x5faf67[_0xef45('0x17')]]['reason']=_0x5faf67['reason'];agents[_0x5faf67['destuniqueid']][_0xef45('0xc')]=_0xef45('0x35');writeDB(agents[_0x5faf67[_0xef45('0x17')]]);}}catch(_0x34e9d5){utils[_0xef45('0x1b')](util[_0xef45('0x3')]('[%s][agents][agentcomplete]',_0x5faf67[_0xef45('0x5')]),_0x34e9d5);}};exports[_0xef45('0x36')]=function(_0x2b2419){try{if(!_['isNil'](agents[_0x2b2419['transfereruniqueid']])){utils[_0xef45('0x1e')](util[_0xef45('0x3')]('[%s][agents][blindtransfer]',_0x2b2419[_0xef45('0x5')]),_0x2b2419);utils[_0xef45('0x2')](util[_0xef45('0x3')](_0xef45('0x37'),_0x2b2419[_0xef45('0x5')],agents[_0x2b2419[_0xef45('0x38')]][_0xef45('0x8')],agents[_0x2b2419[_0xef45('0x38')]][_0xef45('0x5')]));agents[_0x2b2419[_0xef45('0x38')]][_0xef45('0x39')]=!![];agents[_0x2b2419[_0xef45('0x38')]][_0xef45('0x3a')]=_0xef45('0x3b');agents[_0x2b2419['transfereruniqueid']][_0xef45('0x3c')]=_0x2b2419[_0xef45('0x3d')];agents[_0x2b2419[_0xef45('0x38')]]['transferuniqueid']=agents[_0x2b2419[_0xef45('0x38')]][_0xef45('0x5')];}}catch(_0x464bda){utils[_0xef45('0x1b')](util['format'](_0xef45('0x3e'),_0x2b2419[_0xef45('0x5')]),_0x464bda);}};exports[_0xef45('0x3f')]=function(_0x310105){try{utils[_0xef45('0x1e')](util[_0xef45('0x3')](_0xef45('0x40'),_0x310105[_0xef45('0x41')]),_0x310105);if(_0x310105[_0xef45('0x41')]==_0x310105[_0xef45('0x42')]){if(!_[_0xef45('0x30')](agents[_0x310105[_0xef45('0x43')]])){utils['info'](util[_0xef45('0x3')](_0xef45('0x44'),_0x310105[_0xef45('0x41')],agents[_0x310105[_0xef45('0x43')]][_0xef45('0x8')]));agents[_0x310105[_0xef45('0x43')]]['transfer']=!![];agents[_0x310105['secondtransfereruniqueid']][_0xef45('0x3a')]='ATTENDED';agents[_0x310105[_0xef45('0x43')]][_0xef45('0x3c')]=_0x310105[_0xef45('0x45')];agents[_0x310105['secondtransfereruniqueid']][_0xef45('0x46')]=_0x310105[_0xef45('0x41')];}if(_0x310105['transfereeuniqueid']&&agents[_0x310105[_0xef45('0x47')]]){agents[_0x310105['transfereeuniqueid']]['agententerreason']=0x1;transfers[_0x310105[_0xef45('0x47')]]=_[_0xef45('0x48')](agents[_0x310105[_0xef45('0x47')]]);transfers[_0x310105[_0xef45('0x47')]][_0xef45('0xa')]=agents[_0x310105['secondtransfereruniqueid']][_0xef45('0xa')];transfers[_0x310105[_0xef45('0x47')]]['calleridname']=agents[_0x310105[_0xef45('0x43')]][_0xef45('0x49')];transfers[_0x310105[_0xef45('0x47')]][_0xef45('0x4a')]=utils[_0xef45('0x2b')]();transfers[_0x310105[_0xef45('0x47')]][_0xef45('0x2a')]=utils[_0xef45('0x2b')]();transfers[_0x310105['transfereeuniqueid']][_0xef45('0x26')]=0x0;transfers[_0x310105['transfereeuniqueid']]['agententerreason']=0x2;}}else if(_0x310105[_0xef45('0x43')]==_0x310105['secondtransfererlinkedid']){if(!_[_0xef45('0x30')](agents[_0x310105[_0xef45('0x41')]])){utils['info'](util[_0xef45('0x3')](_0xef45('0x44'),_0x310105[_0xef45('0x41')],agents[_0x310105[_0xef45('0x41')]][_0xef45('0x8')]));agents[_0x310105[_0xef45('0x41')]]['transfer']=!![];agents[_0x310105[_0xef45('0x41')]][_0xef45('0x3a')]=_0xef45('0x4b');agents[_0x310105[_0xef45('0x41')]][_0xef45('0x3c')]=_0x310105['secondtransfererexten'];agents[_0x310105[_0xef45('0x41')]]['transferuniqueid']=_0x310105[_0xef45('0x43')];}if(_0x310105[_0xef45('0x4c')]&&agents[_0x310105['transfertargetuniqueid']]){agents[_0x310105[_0xef45('0x4c')]][_0xef45('0x4d')]=0x1;transfers[_0x310105[_0xef45('0x4c')]]=_['clone'](agents[_0x310105['transfertargetuniqueid']]);transfers[_0x310105[_0xef45('0x4c')]][_0xef45('0xa')]=agents[_0x310105[_0xef45('0x41')]]['calleridnum'];transfers[_0x310105[_0xef45('0x4c')]][_0xef45('0x49')]=agents[_0x310105['origtransfereruniqueid']][_0xef45('0x49')];transfers[_0x310105['transfertargetuniqueid']][_0xef45('0x4a')]=utils[_0xef45('0x2b')]();transfers[_0x310105[_0xef45('0x4c')]][_0xef45('0x2a')]=utils[_0xef45('0x2b')]();transfers[_0x310105[_0xef45('0x4c')]][_0xef45('0x26')]=0x0;transfers[_0x310105[_0xef45('0x4c')]]['agententerreason']=0x2;}}}catch(_0x3e6b06){utils[_0xef45('0x1b')](util[_0xef45('0x3')](_0xef45('0x40'),_0x310105[_0xef45('0x41')]),_0x3e6b06);}};exports[_0xef45('0x4e')]=function(_0xef7b79){try{utils[_0xef45('0x1e')](util[_0xef45('0x3')](_0xef45('0x4f'),_0xef7b79[_0xef45('0x5')]),_0xef7b79);if(agents[_0xef7b79['uniqueid']]&&agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0x2e')]===_0xef45('0x21')){if(_0xef7b79[_0xef45('0x50')]==='21'){agents[_0xef7b79[_0xef45('0x5')]]['reason']=_0xef45('0x51');agents[_0xef7b79[_0xef45('0x5')]]['lastevent']='rejected';}utils[_0xef45('0x2')](util[_0xef45('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0xef7b79['uniqueid'],agents[_0xef7b79['uniqueid']][_0xef45('0x8')],agents[_0xef7b79[_0xef45('0x5')]]['reason'],agents[_0xef7b79['uniqueid']][_0xef45('0xc')]));writeDB(agents[_0xef7b79['uniqueid']]);var _0x36586a=unanswered[_0xef45('0x52')](_0xef7b79[_0xef45('0x5')]);if(_0x36586a>-0x1){unanswered[_0xef45('0x53')](_0x36586a,0x1);}}if(transfers[_0xef7b79[_0xef45('0x5')]]){transfers[_0xef7b79[_0xef45('0x5')]][_0xef45('0x10')]=!![];transfers[_0xef7b79['uniqueid']][_0xef45('0x33')]=utils[_0xef45('0x2b')]();transfers[_0xef7b79[_0xef45('0x5')]][_0xef45('0x27')]=utils[_0xef45('0x34')](transfers[_0xef7b79[_0xef45('0x5')]]['agentcompleteAt'],transfers[_0xef7b79['uniqueid']][_0xef45('0x2a')]);transfers[_0xef7b79[_0xef45('0x5')]][_0xef45('0x2e')]=_0xef45('0x54');transfers[_0xef7b79[_0xef45('0x5')]][_0xef45('0xc')]=_0xef45('0x35');utils[_0xef45('0x2')](util['format'](_0xef45('0x55'),_0xef7b79[_0xef45('0x5')],transfers[_0xef7b79[_0xef45('0x5')]][_0xef45('0x8')],transfers[_0xef7b79[_0xef45('0x5')]][_0xef45('0x2e')],transfers[_0xef7b79[_0xef45('0x5')]]['lastevent']));writeDB(transfers[_0xef7b79[_0xef45('0x5')]],!![]);}if(agents[_0xef7b79['uniqueid']]&&agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0x2a')]){agents[_0xef7b79['uniqueid']][_0xef45('0x10')]=!![];agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0x33')]=utils['now']();agents[_0xef7b79[_0xef45('0x5')]]['talktime']=utils[_0xef45('0x34')](agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0x33')],agents[_0xef7b79[_0xef45('0x5')]]['agentconnectAt']);agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0x2e')]=agents[_0xef7b79[_0xef45('0x5')]]['transfer']?_0xef45('0x39'):_0xef45('0x54');agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0xc')]=_0xef45('0x35');utils['info'](util[_0xef45('0x3')](_0xef45('0x55'),_0xef7b79[_0xef45('0x5')],agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0x8')],agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0x2e')],agents[_0xef7b79[_0xef45('0x5')]][_0xef45('0xc')]));writeDB(agents[_0xef7b79['uniqueid']]);}}catch(_0xd3a51e){utils[_0xef45('0x1b')](util[_0xef45('0x3')]('[%s][agents][hangup]',_0xef7b79[_0xef45('0x5')]),_0xd3a51e);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 5383059..5b5f5ab 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 _0x6c14=['uniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','connectedlinenum','lastevent','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','calleridnum','context','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','systemanswertime','linkedid','channelstate','transfer','answertime','disposition','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','diffTime','endtime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','destinationchannel','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','userfield','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','lastdata','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','toLowerCase','set','startsWith','cdr','appdata','split','lastIndexOf','includes','gotoif','application','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds'];(function(_0x2f1753,_0x458f6d){var _0x56a164=function(_0x1e36dd){while(--_0x1e36dd){_0x2f1753['push'](_0x2f1753['shift']());}};_0x56a164(++_0x458f6d);}(_0x6c14,0xd1));var _0x46c1=function(_0x3b1c8a,_0x21bc95){_0x3b1c8a=_0x3b1c8a-0x0;var _0x1f9dc9=_0x6c14[_0x3b1c8a];return _0x1f9dc9;};'use strict';var _=require(_0x46c1('0x0'));var util=require(_0x46c1('0x1'));var utils=require(_0x46c1('0x2'));var transfers=require(_0x46c1('0x3'));var dispositions=[_0x46c1('0x4'),'FAILED',_0x46c1('0x5'),_0x46c1('0x4'),_0x46c1('0x4'),'NO\x20ANSWER',_0x46c1('0x6'),_0x46c1('0x7'),_0x46c1('0x5'),_0x46c1('0x5'),_0x46c1('0x5')];var channels={};function writeDB(_0x10b22d){var _0xfaf798;if(transfers[_0x46c1('0x8')][_0x10b22d[_0x46c1('0x9')]]){_0xfaf798=_0x10b22d['uniqueid'];_0x10b22d[_0x46c1('0x9')]=transfers[_0x46c1('0x8')][_0x10b22d[_0x46c1('0x9')]]['transfereeuniqueid'];}utils[_0x46c1('0xa')](util[_0x46c1('0xb')](_0x46c1('0xc'),_0x10b22d['uniqueid'],_0x10b22d[_0x46c1('0xd')],_0x10b22d[_0x46c1('0xe')],_0x10b22d[_0x46c1('0xf')],_0x10b22d[_0x46c1('0x10')],_0x10b22d['calleridnum'],_0x10b22d[_0x46c1('0x11')],_0x10b22d[_0x46c1('0x12')]));if(_0x10b22d['accountcode']){utils['getUserByInternal'](_0x10b22d[_0x46c1('0x13')])[_0x46c1('0x14')](function(_0xa10462){if(_0xa10462){_0x10b22d[_0x46c1('0x15')]=_0xa10462['id'];}utils[_0x46c1('0x16')]('CreateVoiceCallReport',_0x10b22d);});}else{utils[_0x46c1('0x16')](_0x46c1('0x17'),_0x10b22d);}if(channels[_0x10b22d[_0x46c1('0x9')]]){delete channels[_0x10b22d[_0x46c1('0x9')]];}else if(_0xfaf798&&channels[_0xfaf798]){if(!transfers[_0x46c1('0x8')][_0xfaf798]['recording'])delete transfers['blinds'][_0xfaf798];delete channels[_0xfaf798];}}exports[_0x46c1('0x18')]=function(_0x45790c){try{utils[_0x46c1('0x19')](util[_0x46c1('0xb')](_0x46c1('0x1a'),_0x45790c[_0x46c1('0x9')]),_0x45790c);if(_0x45790c[_0x46c1('0x9')]==_0x45790c['linkedid']&&_0x45790c[_0x46c1('0xd')]!=_0x46c1('0x1b')){utils['info'](util['format'](_0x46c1('0x1c'),_0x45790c['uniqueid'],_0x45790c['context'],_0x45790c[_0x46c1('0x1d')]));channels[_0x45790c[_0x46c1('0x9')]]={'uniqueid':_0x45790c[_0x46c1('0x9')],'accountcode':_0x45790c[_0x46c1('0x13')],'source':_0x45790c[_0x46c1('0x1e')],'destination':_0x45790c[_0x46c1('0x1d')],'destinationcontext':_0x45790c[_0x46c1('0x1f')],'channel':_0x45790c[_0x46c1('0xd')],'starttime':utils[_0x46c1('0x20')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x46c1('0x4'),'amaflags':_0x46c1('0x21')};}}catch(_0x217c2c){utils[_0x46c1('0x22')](util[_0x46c1('0xb')](_0x46c1('0x1a'),_0x45790c[_0x46c1('0x9')]),_0x217c2c);}};exports[_0x46c1('0x23')]=function(_0x15c4ad){try{utils[_0x46c1('0x19')](util[_0x46c1('0xb')](_0x46c1('0x24'),_0x15c4ad[_0x46c1('0x9')]),_0x15c4ad);if(!_[_0x46c1('0x25')](channels[_0x15c4ad['uniqueid']])&&_0x15c4ad['channelstate']==0x6){utils[_0x46c1('0xa')](util[_0x46c1('0xb')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x15c4ad[_0x46c1('0x9')],_0x15c4ad[_0x46c1('0x1f')],_0x15c4ad[_0x46c1('0xd')]));if(_[_0x46c1('0x25')](channels[_0x15c4ad[_0x46c1('0x9')]][_0x46c1('0x26')])){channels[_0x15c4ad['uniqueid']][_0x46c1('0x26')]=utils[_0x46c1('0x20')]();}}else if(!_[_0x46c1('0x25')](channels[_0x15c4ad[_0x46c1('0x27')]])&&_0x15c4ad[_0x46c1('0x28')]==0x6&&_0x15c4ad[_0x46c1('0x1f')]!=_0x46c1('0x29')){utils['info'](util[_0x46c1('0xb')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x15c4ad[_0x46c1('0x9')],_0x15c4ad[_0x46c1('0x27')],_0x15c4ad[_0x46c1('0x1f')],_0x15c4ad[_0x46c1('0xd')]));channels[_0x15c4ad['linkedid']]['accountcode']=_0x15c4ad[_0x46c1('0x13')];channels[_0x15c4ad[_0x46c1('0x27')]]['destinationchannel']=_0x15c4ad[_0x46c1('0xd')];if(_[_0x46c1('0x25')](channels[_0x15c4ad[_0x46c1('0x27')]][_0x46c1('0x2a')])){channels[_0x15c4ad['linkedid']][_0x46c1('0x2a')]=utils[_0x46c1('0x20')]();}channels[_0x15c4ad['linkedid']][_0x46c1('0x2b')]=dispositions[_['toNumber'](_0x15c4ad[_0x46c1('0x28')])]||_0x46c1('0x6');}}catch(_0x28448b){utils[_0x46c1('0x22')](util[_0x46c1('0xb')](_0x46c1('0x24'),_0x15c4ad['uniqueid']),_0x28448b);}};exports['hangup']=function(_0x17a8c8){try{if(!_['isNil'](channels[_0x17a8c8[_0x46c1('0x9')]])){utils['debug'](util['format'](_0x46c1('0x2c'),_0x17a8c8[_0x46c1('0x9')]),_0x17a8c8);if(_[_0x46c1('0x25')](channels[_0x17a8c8['uniqueid']][_0x46c1('0x2d')])){channels[_0x17a8c8[_0x46c1('0x9')]][_0x46c1('0x2d')]=_0x17a8c8['calleridname']+'\x20<'+_0x17a8c8[_0x46c1('0x1e')]+'>';}utils[_0x46c1('0xa')](util[_0x46c1('0xb')](_0x46c1('0x2e'),_0x17a8c8[_0x46c1('0x9')],channels[_0x17a8c8[_0x46c1('0x9')]][_0x46c1('0x2d')],_0x17a8c8[_0x46c1('0x2f')]));channels[_0x17a8c8[_0x46c1('0x9')]]['endtime']=utils[_0x46c1('0x20')]();channels[_0x17a8c8[_0x46c1('0x9')]][_0x46c1('0x30')]=utils[_0x46c1('0x31')](channels[_0x17a8c8[_0x46c1('0x9')]][_0x46c1('0x32')],channels[_0x17a8c8['uniqueid']][_0x46c1('0x33')]);channels[_0x17a8c8['uniqueid']][_0x46c1('0x34')]=channels[_0x17a8c8[_0x46c1('0x9')]][_0x46c1('0x2a')]?utils['diffTime'](channels[_0x17a8c8[_0x46c1('0x9')]]['endtime'],channels[_0x17a8c8[_0x46c1('0x9')]][_0x46c1('0x2a')]):0x0;writeDB(channels[_0x17a8c8['uniqueid']]);}}catch(_0x58d9c4){utils[_0x46c1('0x22')](util['format'](_0x46c1('0x2c'),_0x17a8c8[_0x46c1('0x9')]),_0x58d9c4);}};exports[_0x46c1('0x35')]=function(_0x538a10){try{if(!_[_0x46c1('0x25')](channels[_0x538a10[_0x46c1('0x36')]])){utils['debug'](util[_0x46c1('0xb')](_0x46c1('0x37'),_0x538a10['origtransfereruniqueid']),_0x538a10);if(channels[_0x538a10['localtwolinkedid']][_0x46c1('0xd')]==_0x538a10['transfereechannel']){utils[_0x46c1('0xa')](util[_0x46c1('0xb')](_0x46c1('0x38'),_0x538a10[_0x46c1('0x39')],_0x538a10['localtwolinkedid'],_0x538a10['secondtransfererchannel']));channels[_0x538a10[_0x46c1('0x36')]][_0x46c1('0x3a')]=_0x538a10[_0x46c1('0x3b')];channels[_0x538a10[_0x46c1('0x36')]]['userfield']=_0x46c1('0x3c');}else if(channels[_0x538a10['localtwolinkedid']]['channel']=_0x538a10[_0x46c1('0x3d')]){utils[_0x46c1('0xa')](util['format'](_0x46c1('0x38'),_0x538a10[_0x46c1('0x39')],_0x538a10[_0x46c1('0x36')],_0x538a10[_0x46c1('0x3e')]));channels[_0x538a10[_0x46c1('0x36')]][_0x46c1('0x3a')]=_0x538a10['origtransfererchannel'];channels[_0x538a10[_0x46c1('0x36')]][_0x46c1('0x3f')]=_0x46c1('0x3c');}}}catch(_0x34b29b){utils['error'](util[_0x46c1('0xb')](_0x46c1('0x37'),_0x538a10['origtransfereruniqueid']),_0x34b29b);}};exports[_0x46c1('0x40')]=function(_0x3f2f1d){try{if(!_['isNil'](channels[_0x3f2f1d['uniqueid']])){utils[_0x46c1('0x19')](util[_0x46c1('0xb')](_0x46c1('0x41'),_0x3f2f1d['uniqueid']),_0x3f2f1d);channels[_0x3f2f1d[_0x46c1('0x9')]][_0x46c1('0x42')]=utils[_0x46c1('0x20')]();utils['info'](util[_0x46c1('0xb')](_0x46c1('0x43'),_0x3f2f1d[_0x46c1('0x9')],channels[_0x3f2f1d[_0x46c1('0x9')]][_0x46c1('0x42')]));}}catch(_0x2c054e){utils[_0x46c1('0x22')](util[_0x46c1('0xb')](_0x46c1('0x41'),_0x3f2f1d[_0x46c1('0x9')]),_0x2c054e);}};exports[_0x46c1('0x44')]=function(_0x345074){try{if(!_[_0x46c1('0x25')](channels[_0x345074[_0x46c1('0x9')]])){utils[_0x46c1('0x19')](util[_0x46c1('0xb')](_0x46c1('0x45'),_0x345074['uniqueid']),_0x345074);if(!_[_0x46c1('0x25')](channels[_0x345074[_0x46c1('0x9')]][_0x46c1('0x42')])){channels[_0x345074[_0x46c1('0x9')]][_0x46c1('0x46')]+=utils[_0x46c1('0x31')](utils[_0x46c1('0x20')](),channels[_0x345074['uniqueid']][_0x46c1('0x42')]);utils[_0x46c1('0xa')](util[_0x46c1('0xb')](_0x46c1('0x47'),_0x345074[_0x46c1('0x9')],channels[_0x345074[_0x46c1('0x9')]][_0x46c1('0x46')]));delete channels[_0x345074[_0x46c1('0x9')]]['musiconholdstartAt'];}}}catch(_0x3b65ad){utils['error'](util[_0x46c1('0xb')](_0x46c1('0x45'),_0x345074[_0x46c1('0x9')]),_0x3b65ad);}};exports['varset']=function(_0x10590b){try{if(!_[_0x46c1('0x25')](channels[_0x10590b[_0x46c1('0x9')]])){utils[_0x46c1('0x19')](util[_0x46c1('0xb')](_0x46c1('0x48'),_0x10590b[_0x46c1('0x9')]),_0x10590b);if(!_[_0x46c1('0x25')](_0x10590b[_0x46c1('0x49')][_0x46c1('0x4a')])){utils[_0x46c1('0xa')](util['format'](_0x46c1('0x4b'),_0x10590b[_0x46c1('0x9')],_0x10590b[_0x46c1('0x4c')]));channels[_0x10590b[_0x46c1('0x9')]][_0x46c1('0x4d')]=_0x10590b['value'];}if(!_[_0x46c1('0x25')](_0x10590b[_0x46c1('0x49')]['xmd-phone'])){utils[_0x46c1('0xa')](util['format'](_0x46c1('0x4e'),_0x10590b[_0x46c1('0x9')],_0x10590b[_0x46c1('0x4c')]));channels[_0x10590b[_0x46c1('0x9')]][_0x46c1('0x4f')]=_0x10590b['value'];channels[_0x10590b[_0x46c1('0x9')]][_0x46c1('0x2d')]='\x22'+_0x10590b[_0x46c1('0x4c')]+_0x46c1('0x50')+_0x10590b['value']+'>';}if(!_[_0x46c1('0x25')](_0x10590b['variable'][_0x46c1('0x51')])||!_['isNil'](_0x10590b[_0x46c1('0x49')]['xmd-callerid'])){utils[_0x46c1('0xa')](util[_0x46c1('0xb')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x10590b[_0x46c1('0x9')],!_[_0x46c1('0x25')](_0x10590b[_0x46c1('0x49')][_0x46c1('0x51')])?_0x46c1('0x51'):'xmd-callerid',_0x10590b[_0x46c1('0x4c')]));channels[_0x10590b['uniqueid']][_0x46c1('0x2d')]=_0x10590b[_0x46c1('0x4c')];}if(!_['isNil'](_0x10590b['variable'][_0x46c1('0x52')])||!_['isNil'](_0x10590b[_0x46c1('0x49')][_0x46c1('0x53')])){utils[_0x46c1('0xa')](util[_0x46c1('0xb')](_0x46c1('0x54'),_0x10590b[_0x46c1('0x9')],!_[_0x46c1('0x25')](_0x10590b[_0x46c1('0x49')][_0x46c1('0x52')])?_0x46c1('0x52'):_0x46c1('0x53'),_0x10590b[_0x46c1('0x4c')]));channels[_0x10590b[_0x46c1('0x9')]][_0x46c1('0x55')]=_0x46c1('0x56');channels[_0x10590b[_0x46c1('0x9')]][_0x46c1('0x57')]=_0x10590b[_0x46c1('0x4c')];channels[_0x10590b['uniqueid']][_0x46c1('0xe')]=!![];}if(!_[_0x46c1('0x25')](_0x10590b[_0x46c1('0x49')]['xmd-contactid'])){utils[_0x46c1('0xa')](util[_0x46c1('0xb')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x10590b[_0x46c1('0x9')],_0x10590b[_0x46c1('0x4c')]));channels[_0x10590b[_0x46c1('0x9')]][_0x46c1('0x58')]=_0x10590b[_0x46c1('0x4c')];}if(!_[_0x46c1('0x25')](_0x10590b[_0x46c1('0x49')][_0x46c1('0x59')])){utils['info'](util['format'](_0x46c1('0x5a'),_0x10590b[_0x46c1('0x9')],_0x10590b[_0x46c1('0x4c')]));channels[_0x10590b[_0x46c1('0x9')]][_0x46c1('0x5b')]=_0x10590b[_0x46c1('0x4c')];}if(!_[_0x46c1('0x25')](_0x10590b[_0x46c1('0x49')][_0x46c1('0x5c')])){utils[_0x46c1('0xa')](util[_0x46c1('0xb')](_0x46c1('0x5d'),_0x10590b[_0x46c1('0x9')],_0x10590b[_0x46c1('0x4c')]));channels[_0x10590b[_0x46c1('0x9')]][_0x46c1('0x5e')]=_0x10590b[_0x46c1('0x4c')];}if(!_[_0x46c1('0x25')](_0x10590b['variable'][_0x46c1('0x5f')])){utils[_0x46c1('0xa')](util[_0x46c1('0xb')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x10590b[_0x46c1('0x9')],_0x10590b[_0x46c1('0x4c')]));channels[_0x10590b[_0x46c1('0x9')]][_0x46c1('0x5f')]=_0x10590b[_0x46c1('0x4c')];}}}catch(_0x620b62){utils['error'](util[_0x46c1('0xb')](_0x46c1('0x48'),_0x10590b[_0x46c1('0x9')]),_0x620b62);}};exports[_0x46c1('0x60')]=function(_0x287b95){try{if(!_['isNil'](channels[_0x287b95[_0x46c1('0x9')]])){utils['debug'](util['format'](_0x46c1('0x61'),_0x287b95[_0x46c1('0x9')]),_0x287b95);utils[_0x46c1('0xa')](util[_0x46c1('0xb')](_0x46c1('0x62'),_0x287b95['uniqueid'],_0x287b95['application'],_0x287b95['appdata']));if(_0x287b95['application'][_0x46c1('0x63')]()==_0x46c1('0x64')&&_[_0x46c1('0x65')](_0x287b95['appdata'][_0x46c1('0x63')](),_0x46c1('0x66'))){var _0x4ecf74=_0x287b95[_0x46c1('0x67')][_0x46c1('0x68')]('=');var _0x11f561=_0x4ecf74[0x0]['substring'](_0x4ecf74[0x0][_0x46c1('0x69')]('(')+0x1,_0x4ecf74[0x0][_0x46c1('0x69')](')'));var _0x384580=_0x4ecf74[0x1];channels[_0x287b95[_0x46c1('0x9')]][_0x11f561]=_0x384580;}if(!_[_0x46c1('0x6a')](['hangup','noop','execif',_0x46c1('0x64'),_0x46c1('0x6b')],_0x287b95[_0x46c1('0x6c')][_0x46c1('0x63')]())){channels[_0x287b95[_0x46c1('0x9')]][_0x46c1('0x55')]=_0x287b95[_0x46c1('0x6c')];channels[_0x287b95[_0x46c1('0x9')]][_0x46c1('0x57')]=_0x287b95['appdata'];}}}catch(_0x188c37){utils[_0x46c1('0x22')](util[_0x46c1('0xb')](_0x46c1('0x61'),_0x287b95['uniqueid']),_0x188c37);}}; \ No newline at end of file +var _0x788c=['[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','[%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','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','outboundrouteid','routeid','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','noop','util','./transfers.controller','FAILED','NO\x20ANSWER','ANSWERED','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','interface','calleridnum','connectedlinenum','getUserByInternal','accountcode','UserId','request','CreateVoiceCallReport','recording','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','toNumber','hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','endtime','starttime','billableseconds','diffTime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum'];(function(_0xb67251,_0x1f6208){var _0x979d96=function(_0x41d0d0){while(--_0x41d0d0){_0xb67251['push'](_0xb67251['shift']());}};_0x979d96(++_0x1f6208);}(_0x788c,0xf6));var _0xc788=function(_0x1ccc7f,_0x37da36){_0x1ccc7f=_0x1ccc7f-0x0;var _0x27996c=_0x788c[_0x1ccc7f];return _0x27996c;};'use strict';var _=require('lodash');var util=require(_0xc788('0x0'));var utils=require('./utils');var transfers=require(_0xc788('0x1'));var dispositions=['NO\x20ANSWER',_0xc788('0x2'),'FAILED','NO\x20ANSWER',_0xc788('0x3'),_0xc788('0x3'),_0xc788('0x4'),'BUSY','FAILED',_0xc788('0x2'),_0xc788('0x2')];var channels={};function writeDB(_0x184979){var _0x3685d2;if(transfers[_0xc788('0x5')][_0x184979[_0xc788('0x6')]]){_0x3685d2=_0x184979['uniqueid'];_0x184979[_0xc788('0x6')]=transfers['blinds'][_0x184979[_0xc788('0x6')]][_0xc788('0x7')];}utils[_0xc788('0x8')](util[_0xc788('0x9')](_0xc788('0xa'),_0x184979[_0xc788('0x6')],_0x184979[_0xc788('0xb')],_0x184979['queue'],_0x184979[_0xc788('0xc')],_0x184979[_0xc788('0xd')],_0x184979[_0xc788('0xe')],_0x184979[_0xc788('0xf')],_0x184979['lastevent']));if(_0x184979['accountcode']){utils[_0xc788('0x10')](_0x184979[_0xc788('0x11')])['then'](function(_0x511250){if(_0x511250){_0x184979[_0xc788('0x12')]=_0x511250['id'];}utils[_0xc788('0x13')](_0xc788('0x14'),_0x184979);});}else{utils[_0xc788('0x13')]('CreateVoiceCallReport',_0x184979);}if(channels[_0x184979[_0xc788('0x6')]]){delete channels[_0x184979[_0xc788('0x6')]];}else if(_0x3685d2&&channels[_0x3685d2]){if(!transfers[_0xc788('0x5')][_0x3685d2][_0xc788('0x15')])delete transfers[_0xc788('0x5')][_0x3685d2];delete channels[_0x3685d2];}}exports[_0xc788('0x16')]=function(_0x267c96){try{utils[_0xc788('0x17')](util[_0xc788('0x9')](_0xc788('0x18'),_0x267c96['uniqueid']),_0x267c96);if(_0x267c96[_0xc788('0x6')]==_0x267c96[_0xc788('0x19')]&&_0x267c96['channel']!=_0xc788('0x1a')){utils[_0xc788('0x8')](util[_0xc788('0x9')](_0xc788('0x1b'),_0x267c96[_0xc788('0x6')],_0x267c96[_0xc788('0x1c')],_0x267c96['exten']));channels[_0x267c96[_0xc788('0x6')]]={'uniqueid':_0x267c96['uniqueid'],'accountcode':_0x267c96[_0xc788('0x11')],'source':_0x267c96[_0xc788('0xe')],'destination':_0x267c96['exten'],'destinationcontext':_0x267c96['context'],'channel':_0x267c96['channel'],'starttime':utils[_0xc788('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xc788('0x3'),'amaflags':_0xc788('0x1e')};}}catch(_0x4d457e){utils[_0xc788('0x1f')](util[_0xc788('0x9')]('[%s][calls][newchannel]',_0x267c96[_0xc788('0x6')]),_0x4d457e);}};exports[_0xc788('0x20')]=function(_0x3f470b){try{utils[_0xc788('0x17')](util[_0xc788('0x9')](_0xc788('0x21'),_0x3f470b[_0xc788('0x6')]),_0x3f470b);if(!_[_0xc788('0x22')](channels[_0x3f470b['uniqueid']])&&_0x3f470b['channelstate']==0x6){utils[_0xc788('0x8')](util[_0xc788('0x9')](_0xc788('0x23'),_0x3f470b[_0xc788('0x6')],_0x3f470b['context'],_0x3f470b[_0xc788('0xb')]));if(_[_0xc788('0x22')](channels[_0x3f470b['uniqueid']][_0xc788('0x24')])){channels[_0x3f470b[_0xc788('0x6')]][_0xc788('0x24')]=utils[_0xc788('0x1d')]();}}else if(!_[_0xc788('0x22')](channels[_0x3f470b[_0xc788('0x19')]])&&_0x3f470b[_0xc788('0x25')]==0x6&&_0x3f470b[_0xc788('0x1c')]!=_0xc788('0x26')){utils[_0xc788('0x8')](util[_0xc788('0x9')](_0xc788('0x27'),_0x3f470b[_0xc788('0x6')],_0x3f470b[_0xc788('0x19')],_0x3f470b[_0xc788('0x1c')],_0x3f470b[_0xc788('0xb')]));channels[_0x3f470b[_0xc788('0x19')]][_0xc788('0x11')]=_0x3f470b['accountcode'];channels[_0x3f470b[_0xc788('0x19')]][_0xc788('0x28')]=_0x3f470b[_0xc788('0xb')];if(_[_0xc788('0x22')](channels[_0x3f470b[_0xc788('0x19')]][_0xc788('0x29')])){channels[_0x3f470b[_0xc788('0x19')]][_0xc788('0x29')]=utils[_0xc788('0x1d')]();}channels[_0x3f470b['linkedid']]['disposition']=dispositions[_[_0xc788('0x2a')](_0x3f470b['channelstate'])]||'ANSWERED';}}catch(_0x50aea6){utils[_0xc788('0x1f')](util[_0xc788('0x9')]('[%s][calls][newstate]',_0x3f470b[_0xc788('0x6')]),_0x50aea6);}};exports[_0xc788('0x2b')]=function(_0x33f9a4){try{if(!_['isNil'](channels[_0x33f9a4[_0xc788('0x6')]])){utils[_0xc788('0x17')](util[_0xc788('0x9')](_0xc788('0x2c'),_0x33f9a4[_0xc788('0x6')]),_0x33f9a4);if(_[_0xc788('0x22')](channels[_0x33f9a4[_0xc788('0x6')]][_0xc788('0x2d')])){channels[_0x33f9a4['uniqueid']][_0xc788('0x2d')]=_0x33f9a4['calleridname']+'\x20<'+_0x33f9a4[_0xc788('0xe')]+'>';}utils[_0xc788('0x8')](util['format'](_0xc788('0x2e'),_0x33f9a4[_0xc788('0x6')],channels[_0x33f9a4[_0xc788('0x6')]][_0xc788('0x2d')],_0x33f9a4[_0xc788('0x2f')]));channels[_0x33f9a4[_0xc788('0x6')]]['endtime']=utils['now']();channels[_0x33f9a4['uniqueid']][_0xc788('0x30')]=utils['diffTime'](channels[_0x33f9a4[_0xc788('0x6')]][_0xc788('0x31')],channels[_0x33f9a4[_0xc788('0x6')]][_0xc788('0x32')]);channels[_0x33f9a4[_0xc788('0x6')]][_0xc788('0x33')]=channels[_0x33f9a4[_0xc788('0x6')]]['answertime']?utils[_0xc788('0x34')](channels[_0x33f9a4[_0xc788('0x6')]][_0xc788('0x31')],channels[_0x33f9a4[_0xc788('0x6')]][_0xc788('0x29')]):0x0;writeDB(channels[_0x33f9a4[_0xc788('0x6')]]);}}catch(_0xd93ded){utils[_0xc788('0x1f')](util[_0xc788('0x9')](_0xc788('0x2c'),_0x33f9a4[_0xc788('0x6')]),_0xd93ded);}};exports[_0xc788('0x35')]=function(_0xb9b49f){try{if(!_[_0xc788('0x22')](channels[_0xb9b49f[_0xc788('0x36')]])){utils['debug'](util[_0xc788('0x9')](_0xc788('0x37'),_0xb9b49f[_0xc788('0x38')]),_0xb9b49f);if(channels[_0xb9b49f[_0xc788('0x36')]][_0xc788('0xb')]==_0xb9b49f[_0xc788('0x39')]){utils[_0xc788('0x8')](util[_0xc788('0x9')](_0xc788('0x3a'),_0xb9b49f[_0xc788('0x38')],_0xb9b49f['localtwolinkedid'],_0xb9b49f[_0xc788('0x3b')]));channels[_0xb9b49f[_0xc788('0x36')]][_0xc788('0x28')]=_0xb9b49f[_0xc788('0x3b')];channels[_0xb9b49f[_0xc788('0x36')]][_0xc788('0x3c')]=_0xc788('0x3d');}else if(channels[_0xb9b49f[_0xc788('0x36')]][_0xc788('0xb')]=_0xb9b49f[_0xc788('0x3e')]){utils[_0xc788('0x8')](util[_0xc788('0x9')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0xb9b49f[_0xc788('0x38')],_0xb9b49f['localtwolinkedid'],_0xb9b49f['origtransfererchannel']));channels[_0xb9b49f[_0xc788('0x36')]][_0xc788('0x28')]=_0xb9b49f[_0xc788('0x3f')];channels[_0xb9b49f[_0xc788('0x36')]][_0xc788('0x3c')]=_0xc788('0x3d');}}}catch(_0x404c9a){utils[_0xc788('0x1f')](util[_0xc788('0x9')](_0xc788('0x37'),_0xb9b49f[_0xc788('0x38')]),_0x404c9a);}};exports[_0xc788('0x40')]=function(_0x51afde){try{if(!_['isNil'](channels[_0x51afde['uniqueid']])){utils[_0xc788('0x17')](util[_0xc788('0x9')](_0xc788('0x41'),_0x51afde[_0xc788('0x6')]),_0x51afde);channels[_0x51afde['uniqueid']][_0xc788('0x42')]=utils[_0xc788('0x1d')]();utils[_0xc788('0x8')](util[_0xc788('0x9')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x51afde[_0xc788('0x6')],channels[_0x51afde[_0xc788('0x6')]][_0xc788('0x42')]));}}catch(_0x4700fe){utils['error'](util[_0xc788('0x9')](_0xc788('0x41'),_0x51afde[_0xc788('0x6')]),_0x4700fe);}};exports[_0xc788('0x43')]=function(_0x4b6fac){try{if(!_['isNil'](channels[_0x4b6fac[_0xc788('0x6')]])){utils['debug'](util[_0xc788('0x9')](_0xc788('0x44'),_0x4b6fac['uniqueid']),_0x4b6fac);if(!_['isNil'](channels[_0x4b6fac[_0xc788('0x6')]][_0xc788('0x42')])){channels[_0x4b6fac[_0xc788('0x6')]]['mohtime']+=utils[_0xc788('0x34')](utils[_0xc788('0x1d')](),channels[_0x4b6fac[_0xc788('0x6')]][_0xc788('0x42')]);utils['info'](util[_0xc788('0x9')](_0xc788('0x45'),_0x4b6fac['uniqueid'],channels[_0x4b6fac[_0xc788('0x6')]][_0xc788('0x46')]));delete channels[_0x4b6fac[_0xc788('0x6')]][_0xc788('0x42')];}}}catch(_0x12daee){utils[_0xc788('0x1f')](util[_0xc788('0x9')]('[%s][calls][musiconholdstop]',_0x4b6fac[_0xc788('0x6')]),_0x12daee);}};exports[_0xc788('0x47')]=function(_0x5c164b){try{if(!_[_0xc788('0x22')](channels[_0x5c164b[_0xc788('0x6')]])){utils[_0xc788('0x17')](util[_0xc788('0x9')](_0xc788('0x48'),_0x5c164b[_0xc788('0x6')]),_0x5c164b);if(!_[_0xc788('0x22')](_0x5c164b[_0xc788('0x49')][_0xc788('0x4a')])){utils['info'](util[_0xc788('0x9')](_0xc788('0x4b'),_0x5c164b[_0xc788('0x6')],_0x5c164b[_0xc788('0x4c')]));channels[_0x5c164b[_0xc788('0x6')]][_0xc788('0x4d')]=_0x5c164b[_0xc788('0x4c')];}if(!_[_0xc788('0x22')](_0x5c164b[_0xc788('0x49')]['xmd-phone'])){utils[_0xc788('0x8')](util[_0xc788('0x9')](_0xc788('0x4e'),_0x5c164b[_0xc788('0x6')],_0x5c164b[_0xc788('0x4c')]));channels[_0x5c164b['uniqueid']]['destination']=_0x5c164b['value'];channels[_0x5c164b['uniqueid']][_0xc788('0x2d')]='\x22'+_0x5c164b[_0xc788('0x4c')]+_0xc788('0x4f')+_0x5c164b[_0xc788('0x4c')]+'>';}if(!_[_0xc788('0x22')](_0x5c164b['variable']['xmd-callerid-preview'])||!_[_0xc788('0x22')](_0x5c164b[_0xc788('0x49')]['xmd-callerid'])){utils[_0xc788('0x8')](util[_0xc788('0x9')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x5c164b['uniqueid'],!_[_0xc788('0x22')](_0x5c164b['variable'][_0xc788('0x50')])?_0xc788('0x50'):_0xc788('0x51'),_0x5c164b[_0xc788('0x4c')]));channels[_0x5c164b[_0xc788('0x6')]][_0xc788('0x2d')]=_0x5c164b['value'];}if(!_[_0xc788('0x22')](_0x5c164b[_0xc788('0x49')][_0xc788('0x52')])||!_['isNil'](_0x5c164b[_0xc788('0x49')][_0xc788('0x53')])){utils['info'](util[_0xc788('0x9')](_0xc788('0x54'),_0x5c164b[_0xc788('0x6')],!_[_0xc788('0x22')](_0x5c164b[_0xc788('0x49')][_0xc788('0x52')])?_0xc788('0x52'):_0xc788('0x53'),_0x5c164b[_0xc788('0x4c')]));channels[_0x5c164b[_0xc788('0x6')]][_0xc788('0x55')]=_0xc788('0x56');channels[_0x5c164b[_0xc788('0x6')]][_0xc788('0x57')]=_0x5c164b[_0xc788('0x4c')];channels[_0x5c164b[_0xc788('0x6')]][_0xc788('0x58')]=!![];}if(!_[_0xc788('0x22')](_0x5c164b[_0xc788('0x49')][_0xc788('0x59')])){utils[_0xc788('0x8')](util[_0xc788('0x9')](_0xc788('0x5a'),_0x5c164b['uniqueid'],_0x5c164b[_0xc788('0x4c')]));channels[_0x5c164b[_0xc788('0x6')]]['ContactId']=_0x5c164b[_0xc788('0x4c')];}if(!_[_0xc788('0x22')](_0x5c164b[_0xc788('0x49')][_0xc788('0x5b')])){utils[_0xc788('0x8')](util[_0xc788('0x9')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x5c164b[_0xc788('0x6')],_0x5c164b['value']));channels[_0x5c164b['uniqueid']]['type']=_0x5c164b[_0xc788('0x4c')];}if(!_['isNil'](_0x5c164b[_0xc788('0x49')][_0xc788('0x5c')])){utils[_0xc788('0x8')](util[_0xc788('0x9')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x5c164b['uniqueid'],_0x5c164b[_0xc788('0x4c')]));channels[_0x5c164b['uniqueid']][_0xc788('0x5d')]=_0x5c164b[_0xc788('0x4c')];}if(!_[_0xc788('0x22')](_0x5c164b['variable']['sipcallid'])){utils[_0xc788('0x8')](util[_0xc788('0x9')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x5c164b['uniqueid'],_0x5c164b['value']));channels[_0x5c164b[_0xc788('0x6')]][_0xc788('0x5e')]=_0x5c164b[_0xc788('0x4c')];}}}catch(_0xff7688){utils['error'](util['format']('[%s][calls][varset]',_0x5c164b[_0xc788('0x6')]),_0xff7688);}};exports[_0xc788('0x5f')]=function(_0x592b3d){try{if(!_['isNil'](channels[_0x592b3d[_0xc788('0x6')]])){utils['debug'](util[_0xc788('0x9')](_0xc788('0x60'),_0x592b3d[_0xc788('0x6')]),_0x592b3d);utils[_0xc788('0x8')](util[_0xc788('0x9')](_0xc788('0x61'),_0x592b3d[_0xc788('0x6')],_0x592b3d[_0xc788('0x62')],_0x592b3d[_0xc788('0x63')]));if(_0x592b3d['application'][_0xc788('0x64')]()==_0xc788('0x65')&&_[_0xc788('0x66')](_0x592b3d['appdata'][_0xc788('0x64')](),_0xc788('0x67'))){var _0x56a0be=_0x592b3d['appdata'][_0xc788('0x68')]('=');var _0x3b73aa=_0x56a0be[0x0][_0xc788('0x69')](_0x56a0be[0x0]['lastIndexOf']('(')+0x1,_0x56a0be[0x0]['lastIndexOf'](')'));var _0x469935=_0x56a0be[0x1];channels[_0x592b3d['uniqueid']][_0x3b73aa]=_0x469935;}if(!_['includes']([_0xc788('0x2b'),_0xc788('0x6a'),'execif',_0xc788('0x65'),'gotoif'],_0x592b3d['application'][_0xc788('0x64')]())){channels[_0x592b3d[_0xc788('0x6')]]['lastapplication']=_0x592b3d[_0xc788('0x62')];channels[_0x592b3d[_0xc788('0x6')]][_0xc788('0x57')]=_0x592b3d[_0xc788('0x63')];}}}catch(_0x19d8c2){utils[_0xc788('0x1f')](util[_0xc788('0x9')](_0xc788('0x60'),_0x592b3d[_0xc788('0x6')]),_0x19d8c2);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 33b23e0..9c92dd8 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 _0xafc0=['./utils','[core]\x20connected','info','[core]\x20shutdown','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent'];(function(_0x4e34ac,_0x3bea82){var _0x38a01d=function(_0x1fcb7b){while(--_0x1fcb7b){_0x4e34ac['push'](_0x4e34ac['shift']());}};_0x38a01d(++_0x3bea82);}(_0xafc0,0x8c));var _0x0afc=function(_0x155c8f,_0x2d7bc0){_0x155c8f=_0x155c8f-0x0;var _0x171776=_0xafc0[_0x155c8f];return _0x171776;};'use strict';var utils=require(_0x0afc('0x0'));exports['connect']=function(){utils['info'](_0x0afc('0x1'));};exports['shutdown']=function(){utils[_0x0afc('0x2')](_0x0afc('0x3'));};exports['fullybooted']=function(){utils[_0x0afc('0x2')](_0x0afc('0x4'));};exports[_0x0afc('0x5')]=function(_0xbc9556){utils['error'](_0x0afc('0x6'),_0xbc9556);};exports[_0x0afc('0x7')]=function(){utils[_0x0afc('0x2')](_0x0afc('0x8'));};exports[_0x0afc('0x9')]=function(_0x5d2d7b){}; \ No newline at end of file +var _0x4ae0=['error','[core]\x20error','close','[core]\x20close','managerevent','./utils','info','[core]\x20connected','shutdown'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4ae0,0x152));var _0x04ae=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x4ae0[_0x5d6456];return _0x4d66c1;};'use strict';var utils=require(_0x04ae('0x0'));exports['connect']=function(){utils[_0x04ae('0x1')](_0x04ae('0x2'));};exports[_0x04ae('0x3')]=function(){utils[_0x04ae('0x1')]('[core]\x20shutdown');};exports['fullybooted']=function(){utils[_0x04ae('0x1')]('[core]\x20fullybooted');};exports['error']=function(_0x4c47a8){utils[_0x04ae('0x4')](_0x04ae('0x5'),_0x4c47a8);};exports[_0x04ae('0x6')]=function(){utils['info'](_0x04ae('0x7'));};exports[_0x04ae('0x8')]=function(_0x5c118f){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index cac31a4..092818d 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 _0xb1f2=['info','format','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','error','varset','isNil','value','dialbegin','[%s][dials][dialbegin]','starttime','now','called','dialend','ANSWER','assign','answertime','lastevent','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','endtime','billableseconds','[%s][dials][hangup]','lodash'];(function(_0xadf5ce,_0x43386d){var _0x3f45c4=function(_0xae6d2e){while(--_0xae6d2e){_0xadf5ce['push'](_0xadf5ce['shift']());}};_0x3f45c4(++_0x43386d);}(_0xb1f2,0x1c1));var _0x2b1f=function(_0x352783,_0xdfcc1f){_0x352783=_0x352783-0x0;var _0x513027=_0xb1f2[_0x352783];return _0x513027;};'use strict';var _=require(_0x2b1f('0x0'));var util=require('util');var utils=require('./utils');var dials={};function writeDB(_0x605a37){utils[_0x2b1f('0x1')](util[_0x2b1f('0x2')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x605a37[_0x2b1f('0x3')],_0x605a37[_0x2b1f('0x4')],_0x605a37[_0x2b1f('0x5')],_0x605a37[_0x2b1f('0x6')],_0x605a37[_0x2b1f('0x7')],_0x605a37[_0x2b1f('0x8')]));utils[_0x2b1f('0x9')](_0x2b1f('0xa'),_0x605a37);delete dials[_0x605a37[_0x2b1f('0x3')]];}exports[_0x2b1f('0xb')]=function(_0x583f5d){try{utils[_0x2b1f('0xc')](util['format'](_0x2b1f('0xd'),_0x583f5d[_0x2b1f('0x3')]),_0x583f5d);utils[_0x2b1f('0x1')](util['format'](_0x2b1f('0xe'),_0x583f5d['uniqueid'],_0x583f5d[_0x2b1f('0xf')],_0x583f5d[_0x2b1f('0x10')]));if(_0x583f5d[_0x2b1f('0xf')][_0x2b1f('0x11')]()==_0x2b1f('0x12')&&_[_0x2b1f('0x13')](_0x583f5d[_0x2b1f('0x10')][_0x2b1f('0x11')](),'cdr(routeid)')){var _0x142514=_0x583f5d['appdata'][_0x2b1f('0x14')]('=');dials[_0x583f5d[_0x2b1f('0x3')]]={'routeId':_0x142514[0x1]};}}catch(_0x3eecf1){utils[_0x2b1f('0x15')](util['format'](_0x2b1f('0xd'),_0x583f5d[_0x2b1f('0x3')]),_0x3eecf1);}};exports[_0x2b1f('0x16')]=function(_0x2bb26f){try{utils[_0x2b1f('0xc')](util[_0x2b1f('0x2')]('[%s][dials][varset]',_0x2bb26f['uniqueid']),_0x2bb26f);if(!_[_0x2b1f('0x17')](_0x2bb26f['variable']['outboundrouteid'])){utils[_0x2b1f('0x1')](util[_0x2b1f('0x2')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x2bb26f[_0x2b1f('0x3')],_0x2bb26f[_0x2b1f('0x18')]));dials[_0x2bb26f[_0x2b1f('0x3')]]={'routeId':_0x2bb26f[_0x2b1f('0x18')]};}}catch(_0x281c2f){utils[_0x2b1f('0x15')](util['format']('[%s][dials][varset]',_0x2bb26f[_0x2b1f('0x3')]),_0x281c2f);}};exports[_0x2b1f('0x19')]=function(_0x410642){try{if(!_[_0x2b1f('0x17')](dials[_0x410642[_0x2b1f('0x3')]])){utils[_0x2b1f('0xc')](util[_0x2b1f('0x2')](_0x2b1f('0x1a'),_0x410642[_0x2b1f('0x3')]),_0x410642);dials[_0x410642[_0x2b1f('0x3')]]=_['assign'](dials[_0x410642[_0x2b1f('0x3')]],_0x410642);dials[_0x410642[_0x2b1f('0x3')]][_0x2b1f('0x1b')]=utils[_0x2b1f('0x1c')]();dials[_0x410642[_0x2b1f('0x3')]]['lastevent']=_0x2b1f('0x1d');utils[_0x2b1f('0x1')](util['format']('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x410642[_0x2b1f('0x3')],dials[_0x410642[_0x2b1f('0x3')]][_0x2b1f('0x1b')]));}}catch(_0x17fd7a){utils['error'](util['format']('[%s][dials][dialbegin]',_0x410642[_0x2b1f('0x3')]),_0x17fd7a);}};exports[_0x2b1f('0x1e')]=function(_0x4a0699){try{if(!_[_0x2b1f('0x17')](dials[_0x4a0699[_0x2b1f('0x3')]])){utils[_0x2b1f('0xc')](util[_0x2b1f('0x2')]('[%s][dials][dialend]',_0x4a0699[_0x2b1f('0x3')]),_0x4a0699);dials[_0x4a0699[_0x2b1f('0x3')]][_0x2b1f('0x8')]=_0x4a0699[_0x2b1f('0x8')];if(_0x4a0699[_0x2b1f('0x8')]==_0x2b1f('0x1f')){dials[_0x4a0699[_0x2b1f('0x3')]]=_[_0x2b1f('0x20')](dials[_0x4a0699[_0x2b1f('0x3')]],_0x4a0699);dials[_0x4a0699[_0x2b1f('0x3')]][_0x2b1f('0x21')]=utils[_0x2b1f('0x1c')]();dials[_0x4a0699[_0x2b1f('0x3')]][_0x2b1f('0x22')]='connect';utils['info'](util[_0x2b1f('0x2')](_0x2b1f('0x23'),_0x4a0699[_0x2b1f('0x3')],_0x4a0699['dialstatus'],dials[_0x4a0699[_0x2b1f('0x3')]][_0x2b1f('0x21')]));}else{utils[_0x2b1f('0x1')](util['format']('[%s][dials][dialend]\x20dialstatus:%s',_0x4a0699[_0x2b1f('0x3')],_0x4a0699['dialstatus']));}}}catch(_0x1753a8){utils[_0x2b1f('0x15')](util[_0x2b1f('0x2')]('[%s][dials][dialend]',_0x4a0699['uniqueid']),_0x1753a8);}};exports[_0x2b1f('0x24')]=function(_0x5dd962){try{if(!_[_0x2b1f('0x17')](dials[_0x5dd962[_0x2b1f('0x3')]])){utils[_0x2b1f('0xc')](util[_0x2b1f('0x2')]('[%s][dials][hangup]',_0x5dd962[_0x2b1f('0x3')]),_0x5dd962);utils[_0x2b1f('0x1')](util['format'](_0x2b1f('0x25'),_0x5dd962[_0x2b1f('0x3')],_0x5dd962['calleridnum'],_0x5dd962[_0x2b1f('0x26')],_0x5dd962[_0x2b1f('0x27')]));dials[_0x5dd962[_0x2b1f('0x3')]]=_[_0x2b1f('0x20')](dials[_0x5dd962['uniqueid']],{'endtime':utils[_0x2b1f('0x1c')](),'lastevent':_0x2b1f('0x28')});dials[_0x5dd962[_0x2b1f('0x3')]][_0x2b1f('0x29')]=utils['diffTime'](dials[_0x5dd962[_0x2b1f('0x3')]][_0x2b1f('0x2a')],dials[_0x5dd962[_0x2b1f('0x3')]][_0x2b1f('0x1b')]);dials[_0x5dd962[_0x2b1f('0x3')]]['holdtime']=utils['diffTime'](dials[_0x5dd962[_0x2b1f('0x3')]][_0x2b1f('0x21')]||dials[_0x5dd962[_0x2b1f('0x3')]][_0x2b1f('0x2a')],dials[_0x5dd962[_0x2b1f('0x3')]][_0x2b1f('0x1b')]);dials[_0x5dd962[_0x2b1f('0x3')]][_0x2b1f('0x2b')]=dials[_0x5dd962[_0x2b1f('0x3')]][_0x2b1f('0x21')]?utils['diffTime'](dials[_0x5dd962[_0x2b1f('0x3')]][_0x2b1f('0x2a')],dials[_0x5dd962[_0x2b1f('0x3')]][_0x2b1f('0x21')]):0x0;writeDB(dials[_0x5dd962[_0x2b1f('0x3')]]);}}catch(_0x4f85bf){utils['error'](util['format'](_0x2b1f('0x2c'),_0x5dd962['uniqueid']),_0x4f85bf);}}; \ No newline at end of file +var _0xa953=['uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','debug','format','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr(routeid)','split','error','[%s][dials][varset]','isNil','variable','info','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','starttime','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','ANSWER','assign','answertime','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','billableseconds','util','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s'];(function(_0x4d1ab5,_0x37f416){var _0x59d73f=function(_0x39d754){while(--_0x39d754){_0x4d1ab5['push'](_0x4d1ab5['shift']());}};_0x59d73f(++_0x37f416);}(_0xa953,0x1c0));var _0x3a95=function(_0x52b844,_0x434e67){_0x52b844=_0x52b844-0x0;var _0x14432f=_0xa953[_0x52b844];return _0x14432f;};'use strict';var _=require('lodash');var util=require(_0x3a95('0x0'));var utils=require('./utils');var dials={};function writeDB(_0x674fd3){utils['info'](util['format'](_0x3a95('0x1'),_0x674fd3[_0x3a95('0x2')],_0x674fd3[_0x3a95('0x3')],_0x674fd3[_0x3a95('0x4')],_0x674fd3[_0x3a95('0x5')],_0x674fd3[_0x3a95('0x6')],_0x674fd3[_0x3a95('0x7')]));utils[_0x3a95('0x8')](_0x3a95('0x9'),_0x674fd3);delete dials[_0x674fd3[_0x3a95('0x2')]];}exports['newexten']=function(_0x20c8bf){try{utils[_0x3a95('0xa')](util[_0x3a95('0xb')](_0x3a95('0xc'),_0x20c8bf[_0x3a95('0x2')]),_0x20c8bf);utils['info'](util['format'](_0x3a95('0xd'),_0x20c8bf[_0x3a95('0x2')],_0x20c8bf[_0x3a95('0xe')],_0x20c8bf[_0x3a95('0xf')]));if(_0x20c8bf['application']['toLowerCase']()==_0x3a95('0x10')&&_[_0x3a95('0x11')](_0x20c8bf['appdata'][_0x3a95('0x12')](),_0x3a95('0x13'))){var _0x58b524=_0x20c8bf[_0x3a95('0xf')][_0x3a95('0x14')]('=');dials[_0x20c8bf[_0x3a95('0x2')]]={'routeId':_0x58b524[0x1]};}}catch(_0x45a1f9){utils[_0x3a95('0x15')](util['format'](_0x3a95('0xc'),_0x20c8bf[_0x3a95('0x2')]),_0x45a1f9);}};exports['varset']=function(_0xbf2bb){try{utils[_0x3a95('0xa')](util[_0x3a95('0xb')](_0x3a95('0x16'),_0xbf2bb[_0x3a95('0x2')]),_0xbf2bb);if(!_[_0x3a95('0x17')](_0xbf2bb[_0x3a95('0x18')]['outboundrouteid'])){utils[_0x3a95('0x19')](util['format'](_0x3a95('0x1a'),_0xbf2bb[_0x3a95('0x2')],_0xbf2bb[_0x3a95('0x1b')]));dials[_0xbf2bb[_0x3a95('0x2')]]={'routeId':_0xbf2bb['value']};}}catch(_0x1771c6){utils['error'](util[_0x3a95('0xb')](_0x3a95('0x16'),_0xbf2bb[_0x3a95('0x2')]),_0x1771c6);}};exports[_0x3a95('0x1c')]=function(_0x3416eb){try{if(!_['isNil'](dials[_0x3416eb[_0x3a95('0x2')]])){utils[_0x3a95('0xa')](util['format'](_0x3a95('0x1d'),_0x3416eb[_0x3a95('0x2')]),_0x3416eb);dials[_0x3416eb[_0x3a95('0x2')]]=_['assign'](dials[_0x3416eb['uniqueid']],_0x3416eb);dials[_0x3416eb[_0x3a95('0x2')]][_0x3a95('0x1e')]=utils['now']();dials[_0x3416eb['uniqueid']]['lastevent']='called';utils[_0x3a95('0x19')](util['format'](_0x3a95('0x1f'),_0x3416eb[_0x3a95('0x2')],dials[_0x3416eb[_0x3a95('0x2')]][_0x3a95('0x1e')]));}}catch(_0xcc4950){utils[_0x3a95('0x15')](util[_0x3a95('0xb')](_0x3a95('0x1d'),_0x3416eb['uniqueid']),_0xcc4950);}};exports[_0x3a95('0x20')]=function(_0x3a60a9){try{if(!_['isNil'](dials[_0x3a60a9['uniqueid']])){utils[_0x3a95('0xa')](util[_0x3a95('0xb')]('[%s][dials][dialend]',_0x3a60a9[_0x3a95('0x2')]),_0x3a60a9);dials[_0x3a60a9[_0x3a95('0x2')]]['dialstatus']=_0x3a60a9[_0x3a95('0x7')];if(_0x3a60a9[_0x3a95('0x7')]==_0x3a95('0x21')){dials[_0x3a60a9[_0x3a95('0x2')]]=_[_0x3a95('0x22')](dials[_0x3a60a9[_0x3a95('0x2')]],_0x3a60a9);dials[_0x3a60a9['uniqueid']][_0x3a95('0x23')]=utils[_0x3a95('0x24')]();dials[_0x3a60a9[_0x3a95('0x2')]]['lastevent']=_0x3a95('0x25');utils['info'](util[_0x3a95('0xb')](_0x3a95('0x26'),_0x3a60a9[_0x3a95('0x2')],_0x3a60a9[_0x3a95('0x7')],dials[_0x3a60a9[_0x3a95('0x2')]][_0x3a95('0x23')]));}else{utils[_0x3a95('0x19')](util[_0x3a95('0xb')]('[%s][dials][dialend]\x20dialstatus:%s',_0x3a60a9[_0x3a95('0x2')],_0x3a60a9[_0x3a95('0x7')]));}}}catch(_0x3629ce){utils[_0x3a95('0x15')](util[_0x3a95('0xb')]('[%s][dials][dialend]',_0x3a60a9[_0x3a95('0x2')]),_0x3629ce);}};exports[_0x3a95('0x27')]=function(_0x13543f){try{if(!_['isNil'](dials[_0x13543f['uniqueid']])){utils[_0x3a95('0xa')](util['format'](_0x3a95('0x28'),_0x13543f[_0x3a95('0x2')]),_0x13543f);utils['info'](util[_0x3a95('0xb')](_0x3a95('0x29'),_0x13543f[_0x3a95('0x2')],_0x13543f[_0x3a95('0x5')],_0x13543f[_0x3a95('0x2a')],_0x13543f[_0x3a95('0x2b')]));dials[_0x13543f['uniqueid']]=_[_0x3a95('0x22')](dials[_0x13543f['uniqueid']],{'endtime':utils['now'](),'lastevent':_0x3a95('0x2c')});dials[_0x13543f[_0x3a95('0x2')]][_0x3a95('0x2d')]=utils[_0x3a95('0x2e')](dials[_0x13543f[_0x3a95('0x2')]][_0x3a95('0x2f')],dials[_0x13543f[_0x3a95('0x2')]][_0x3a95('0x1e')]);dials[_0x13543f[_0x3a95('0x2')]][_0x3a95('0x30')]=utils[_0x3a95('0x2e')](dials[_0x13543f[_0x3a95('0x2')]][_0x3a95('0x23')]||dials[_0x13543f[_0x3a95('0x2')]]['endtime'],dials[_0x13543f['uniqueid']]['starttime']);dials[_0x13543f[_0x3a95('0x2')]][_0x3a95('0x31')]=dials[_0x13543f[_0x3a95('0x2')]][_0x3a95('0x23')]?utils[_0x3a95('0x2e')](dials[_0x13543f[_0x3a95('0x2')]]['endtime'],dials[_0x13543f[_0x3a95('0x2')]][_0x3a95('0x23')]):0x0;writeDB(dials[_0x13543f[_0x3a95('0x2')]]);}}catch(_0x5b962a){utils[_0x3a95('0x15')](util[_0x3a95('0xb')](_0x3a95('0x28'),_0x13543f[_0x3a95('0x2')]),_0x5b962a);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index e790f45..55369f9 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 _0x1602=['uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','port','asterisk','password','keepConnected','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','device','format','agentcalled','[%s][index][agentcalled]'];(function(_0x1e758e,_0x157fa3){var _0x23840b=function(_0x54b1a8){while(--_0x54b1a8){_0x1e758e['push'](_0x1e758e['shift']());}};_0x23840b(++_0x157fa3);}(_0x1602,0x135));var _0x2160=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x1602[_0x3bf83f];return _0x22c4a9;};var AsteriskManager=require(_0x2160('0x0'));var config=require(_0x2160('0x1'));var utils=require(_0x2160('0x2'));var util=require(_0x2160('0x3'));var isXDREnabled=config[_0x2160('0x4')]&&!config[_0x2160('0x4')][_0x2160('0x5')];var isProduction=config[_0x2160('0x6')]===_0x2160('0x7')||![];var isLocalAsterisk=config[_0x2160('0x4')]&&config['xdr']['local']===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x2160('0x8')],config[_0x2160('0x9')]['ip'],config[_0x2160('0x9')]['username'],config[_0x2160('0x9')][_0x2160('0xa')],!![]);ami[_0x2160('0xb')]();if(!isXDREnabled){utils['info'](_0x2160('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0x2160('0xd'));}else{var agents=require('./agents.controller');var calls=require(_0x2160('0xe'));var queues=require('./queues.controller');var recordings=require('./recordings.controller');var members=require(_0x2160('0xf'));var dials=require(_0x2160('0x10'));var transfers=require(_0x2160('0x11'));var core=require(_0x2160('0x12'));ami['on'](_0x2160('0x13'),core[_0x2160('0x13')]);ami['on'](_0x2160('0x14'),core[_0x2160('0x14')]);ami['on'](_0x2160('0x15'),core[_0x2160('0x15')]);ami['on'](_0x2160('0x16'),core[_0x2160('0x16')]);ami['on']('close',core['close']);ami['on'](_0x2160('0x17'),core[_0x2160('0x17')]);ami['on'](_0x2160('0x18'),function(_0x1037ed){try{utils[_0x2160('0x19')](util['format'](_0x2160('0x1a'),_0x1037ed[_0x2160('0x1b')]),_0x1037ed);members[_0x2160('0x18')](_0x1037ed);}catch(_0x59d29f){utils[_0x2160('0x16')](util[_0x2160('0x1c')](_0x2160('0x1a'),_0x1037ed[_0x2160('0x1b')]),_0x59d29f);}});ami['on'](_0x2160('0x1d'),function(_0x24267a){try{utils[_0x2160('0x19')](util[_0x2160('0x1c')](_0x2160('0x1e'),_0x24267a[_0x2160('0x1f')]),_0x24267a);agents[_0x2160('0x1d')](_0x24267a);}catch(_0x587520){utils[_0x2160('0x16')](util[_0x2160('0x1c')](_0x2160('0x1e'),_0x24267a[_0x2160('0x1f')]),_0x587520);}});ami['on'](_0x2160('0x20'),function(_0x128d75){try{utils['debug'](util['format'](_0x2160('0x21'),_0x128d75[_0x2160('0x1f')]),_0x128d75);agents[_0x2160('0x20')](_0x128d75);}catch(_0x54c5f8){utils[_0x2160('0x16')](util[_0x2160('0x1c')](_0x2160('0x21'),_0x128d75[_0x2160('0x1f')]),_0x54c5f8);}});ami['on'](_0x2160('0x22'),function(_0x2342bb){try{utils['debug'](util[_0x2160('0x1c')](_0x2160('0x23'),_0x2342bb[_0x2160('0x1f')]),_0x2342bb);agents[_0x2160('0x22')](_0x2342bb);queues['agentconnect'](_0x2342bb);}catch(_0x48028d){utils[_0x2160('0x16')](util['format']('[%s][index][agentconnect]',_0x2342bb[_0x2160('0x1f')]),_0x48028d);}});ami['on'](_0x2160('0x24'),function(_0x56af01){try{utils['debug'](util[_0x2160('0x1c')]('[%s][index][agentcomplete]',_0x56af01[_0x2160('0x1f')]),_0x56af01);agents[_0x2160('0x24')](_0x56af01);queues['agentcomplete'](_0x56af01);members[_0x2160('0x24')](_0x56af01);}catch(_0x2a525e){utils['error'](util[_0x2160('0x1c')](_0x2160('0x25'),_0x56af01['uniqueid']),_0x2a525e);}});ami['on'](_0x2160('0x26'),function(_0x1051b7){try{utils[_0x2160('0x19')](util[_0x2160('0x1c')](_0x2160('0x27'),_0x1051b7['uniqueid']),_0x1051b7);agents[_0x2160('0x26')](_0x1051b7);queues['queuecallerabandon'](_0x1051b7);}catch(_0xc6f21){utils[_0x2160('0x16')](util[_0x2160('0x1c')](_0x2160('0x27'),_0x1051b7[_0x2160('0x1f')]),_0xc6f21);}});ami['on'](_0x2160('0x28'),function(_0x1c8599){try{utils[_0x2160('0x19')](util['format']('[%s][index][queuecallerjoin]',_0x1c8599['uniqueid']),_0x1c8599);queues['queuecallerjoin'](_0x1c8599);recordings[_0x2160('0x28')](_0x1c8599);}catch(_0x2ad54d){utils[_0x2160('0x16')](util['format']('[%s][index][queuecallerjoin]',_0x1c8599[_0x2160('0x1f')]),_0x2ad54d);}});ami['on']('queuecallerleave',function(_0x487af8){try{utils[_0x2160('0x19')](util[_0x2160('0x1c')](_0x2160('0x29'),_0x487af8[_0x2160('0x1f')]),_0x487af8);queues[_0x2160('0x2a')](_0x487af8);}catch(_0x29220a){utils[_0x2160('0x16')](util[_0x2160('0x1c')](_0x2160('0x29'),_0x487af8[_0x2160('0x1f')]),_0x29220a);}});ami['on'](_0x2160('0x2b'),function(_0x59caf1){try{utils[_0x2160('0x19')](util[_0x2160('0x1c')](_0x2160('0x2c'),_0x59caf1[_0x2160('0x1f')]),_0x59caf1);queues[_0x2160('0x2b')](_0x59caf1);calls['musiconholdstart'](_0x59caf1);}catch(_0x55063d){utils['error'](util['format'](_0x2160('0x2c'),_0x59caf1[_0x2160('0x1f')]),_0x55063d);}});ami['on'](_0x2160('0x2d'),function(_0x3121c8){try{utils[_0x2160('0x19')](util[_0x2160('0x1c')](_0x2160('0x2e'),_0x3121c8[_0x2160('0x1f')]),_0x3121c8);queues[_0x2160('0x2d')](_0x3121c8);calls[_0x2160('0x2d')](_0x3121c8);}catch(_0x2aea8e){utils[_0x2160('0x16')](util[_0x2160('0x1c')]('[%s][index][musiconholdstop]',_0x3121c8[_0x2160('0x1f')]),_0x2aea8e);}});ami['on'](_0x2160('0x2f'),function(_0x6bfcc){try{utils[_0x2160('0x19')](util['format'](_0x2160('0x30'),_0x6bfcc[_0x2160('0x1f')]),_0x6bfcc);calls[_0x2160('0x2f')](_0x6bfcc);recordings[_0x2160('0x2f')](_0x6bfcc);}catch(_0x1c119c){utils['error'](util[_0x2160('0x1c')](_0x2160('0x30'),_0x6bfcc[_0x2160('0x1f')]),_0x1c119c);}});ami['on'](_0x2160('0x31'),function(_0x5a7ebb){try{utils['debug'](util['format'](_0x2160('0x32'),_0x5a7ebb['uniqueid']),_0x5a7ebb);calls[_0x2160('0x31')](_0x5a7ebb);recordings[_0x2160('0x31')](_0x5a7ebb);dials[_0x2160('0x31')](_0x5a7ebb);agents[_0x2160('0x31')](_0x5a7ebb);queues[_0x2160('0x31')](_0x5a7ebb);}catch(_0x3a35cb){utils[_0x2160('0x16')](util[_0x2160('0x1c')](_0x2160('0x32'),_0x5a7ebb[_0x2160('0x1f')]),_0x3a35cb);}});ami['on'](_0x2160('0x33'),function(_0x33cb5e){try{utils[_0x2160('0x19')](util[_0x2160('0x1c')](_0x2160('0x34'),_0x33cb5e['uniqueid']),_0x33cb5e);members[_0x2160('0x33')](_0x33cb5e);}catch(_0x4f6c5d){utils[_0x2160('0x16')](util['format'](_0x2160('0x34'),_0x33cb5e[_0x2160('0x1f')]),_0x4f6c5d);}});ami['on'](_0x2160('0x35'),function(_0x510116){try{utils['debug'](util[_0x2160('0x1c')](_0x2160('0x36'),_0x510116['uniqueid']),_0x510116);queues[_0x2160('0x35')](_0x510116);agents['blindtransfer'](_0x510116);transfers[_0x2160('0x35')](_0x510116);recordings['blindtransfer'](_0x510116);}catch(_0x4220ce){utils['error'](util[_0x2160('0x1c')](_0x2160('0x36'),_0x510116[_0x2160('0x1f')]),_0x4220ce);}});ami['on'](_0x2160('0x37'),function(_0x3fa7dc){try{utils[_0x2160('0x19')](util[_0x2160('0x1c')](_0x2160('0x38'),_0x3fa7dc[_0x2160('0x39')]),_0x3fa7dc);queues[_0x2160('0x37')](_0x3fa7dc);transfers[_0x2160('0x37')](_0x3fa7dc);agents[_0x2160('0x37')](_0x3fa7dc);calls['attendedtransfer'](_0x3fa7dc);}catch(_0x28aa8b){utils[_0x2160('0x16')](util['format'](_0x2160('0x38'),_0x3fa7dc['origtransfereruniqueid']),_0x28aa8b);}});ami['on'](_0x2160('0x3a'),function(_0x5143d2){try{utils[_0x2160('0x19')](util['format'](_0x2160('0x3b'),_0x5143d2['uniqueid']),_0x5143d2);queues[_0x2160('0x3a')](_0x5143d2);recordings[_0x2160('0x3a')](_0x5143d2);calls['varset'](_0x5143d2);dials[_0x2160('0x3a')](_0x5143d2);}catch(_0x46d9ab){utils['error'](util['format'](_0x2160('0x3b'),_0x5143d2['uniqueid']),_0x46d9ab);}});ami['on'](_0x2160('0x3c'),function(_0x52f000){try{utils[_0x2160('0x19')](util[_0x2160('0x1c')]('[%s][index][newexten]',_0x52f000[_0x2160('0x1f')]),_0x52f000);calls['newexten'](_0x52f000);recordings[_0x2160('0x3c')](_0x52f000);dials['newexten'](_0x52f000);}catch(_0x10c4f5){utils[_0x2160('0x16')](util[_0x2160('0x1c')](_0x2160('0x3d'),_0x52f000[_0x2160('0x1f')]),_0x10c4f5);}});ami['on'](_0x2160('0x3e'),function(_0x4b1e79){try{utils[_0x2160('0x19')](util[_0x2160('0x1c')](_0x2160('0x3f'),_0x4b1e79[_0x2160('0x1f')]),_0x4b1e79);calls['newchannel'](_0x4b1e79);recordings['newchannel'](_0x4b1e79);}catch(_0x5bf38e){utils[_0x2160('0x16')](util['format'](_0x2160('0x3f'),_0x4b1e79[_0x2160('0x1f')]),_0x5bf38e);}});ami['on'](_0x2160('0x40'),function(_0x5b48c4){try{utils[_0x2160('0x19')](util[_0x2160('0x1c')](_0x2160('0x41'),_0x5b48c4[_0x2160('0x1f')]),_0x5b48c4);dials['dialbegin'](_0x5b48c4);}catch(_0x43f68a){utils[_0x2160('0x16')](util[_0x2160('0x1c')]('[%s]dialbegin',_0x5b48c4[_0x2160('0x1f')]),_0x43f68a);}});ami['on'](_0x2160('0x42'),function(_0x5a7a46){try{utils[_0x2160('0x19')](util[_0x2160('0x1c')](_0x2160('0x43'),_0x5a7a46[_0x2160('0x1f')]),_0x5a7a46);dials[_0x2160('0x42')](_0x5a7a46);}catch(_0x134c5e){utils[_0x2160('0x16')](util[_0x2160('0x1c')](_0x2160('0x43'),_0x5a7a46[_0x2160('0x1f')]),_0x134c5e);}});} \ No newline at end of file +var _0xbeff=['[%s][index][devicestatechange]','agentcalled','debug','uniqueid','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','util','xdr','disabled','env','production','local','asterisk','port','username','password','keepConnected','XDR\x20DISABLED','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','managerevent','devicestatechange','format','device'];(function(_0x203b5c,_0x2384f1){var _0x20a057=function(_0x511230){while(--_0x511230){_0x203b5c['push'](_0x203b5c['shift']());}};_0x20a057(++_0x2384f1);}(_0xbeff,0x14b));var _0xfbef=function(_0x7a695e,_0x3517c8){_0x7a695e=_0x7a695e-0x0;var _0x4438a1=_0xbeff[_0x7a695e];return _0x4438a1;};var AsteriskManager=require(_0xfbef('0x0'));var config=require('../../config/environment');var utils=require('./utils');var util=require(_0xfbef('0x1'));var isXDREnabled=config[_0xfbef('0x2')]&&!config['xdr'][_0xfbef('0x3')];var isProduction=config[_0xfbef('0x4')]===_0xfbef('0x5')||![];var isLocalAsterisk=config[_0xfbef('0x2')]&&config[_0xfbef('0x2')][_0xfbef('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0xfbef('0x7')][_0xfbef('0x8')],config[_0xfbef('0x7')]['ip'],config[_0xfbef('0x7')][_0xfbef('0x9')],config['asterisk'][_0xfbef('0xa')],!![]);ami[_0xfbef('0xb')]();if(!isXDREnabled){utils['info'](_0xfbef('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xfbef('0xd')](_0xfbef('0xe'));}else{var agents=require(_0xfbef('0xf'));var calls=require(_0xfbef('0x10'));var queues=require('./queues.controller');var recordings=require(_0xfbef('0x11'));var members=require(_0xfbef('0x12'));var dials=require(_0xfbef('0x13'));var transfers=require('./transfers.controller');var core=require(_0xfbef('0x14'));ami['on'](_0xfbef('0x15'),core[_0xfbef('0x15')]);ami['on'](_0xfbef('0x16'),core[_0xfbef('0x16')]);ami['on'](_0xfbef('0x17'),core[_0xfbef('0x17')]);ami['on'](_0xfbef('0x18'),core[_0xfbef('0x18')]);ami['on']('close',core['close']);ami['on'](_0xfbef('0x19'),core[_0xfbef('0x19')]);ami['on'](_0xfbef('0x1a'),function(_0x256280){try{utils['debug'](util[_0xfbef('0x1b')]('[%s][index][devicestatechange]',_0x256280[_0xfbef('0x1c')]),_0x256280);members['devicestatechange'](_0x256280);}catch(_0x47ee2d){utils[_0xfbef('0x18')](util['format'](_0xfbef('0x1d'),_0x256280[_0xfbef('0x1c')]),_0x47ee2d);}});ami['on'](_0xfbef('0x1e'),function(_0x11b20d){try{utils[_0xfbef('0x1f')](util[_0xfbef('0x1b')]('[%s][index][agentcalled]',_0x11b20d[_0xfbef('0x20')]),_0x11b20d);agents['agentcalled'](_0x11b20d);}catch(_0x106524){utils[_0xfbef('0x18')](util[_0xfbef('0x1b')](_0xfbef('0x21'),_0x11b20d[_0xfbef('0x20')]),_0x106524);}});ami['on'](_0xfbef('0x22'),function(_0x4683c4){try{utils[_0xfbef('0x1f')](util[_0xfbef('0x1b')](_0xfbef('0x23'),_0x4683c4[_0xfbef('0x20')]),_0x4683c4);agents[_0xfbef('0x22')](_0x4683c4);}catch(_0x4aae93){utils[_0xfbef('0x18')](util[_0xfbef('0x1b')](_0xfbef('0x23'),_0x4683c4[_0xfbef('0x20')]),_0x4aae93);}});ami['on']('agentconnect',function(_0x55f17a){try{utils['debug'](util['format'](_0xfbef('0x24'),_0x55f17a[_0xfbef('0x20')]),_0x55f17a);agents[_0xfbef('0x25')](_0x55f17a);queues['agentconnect'](_0x55f17a);}catch(_0x145127){utils[_0xfbef('0x18')](util['format']('[%s][index][agentconnect]',_0x55f17a['uniqueid']),_0x145127);}});ami['on'](_0xfbef('0x26'),function(_0x5b23ed){try{utils[_0xfbef('0x1f')](util[_0xfbef('0x1b')](_0xfbef('0x27'),_0x5b23ed['uniqueid']),_0x5b23ed);agents[_0xfbef('0x26')](_0x5b23ed);queues[_0xfbef('0x26')](_0x5b23ed);members[_0xfbef('0x26')](_0x5b23ed);}catch(_0xa2ba0f){utils['error'](util[_0xfbef('0x1b')]('[%s][index][agentcomplete]',_0x5b23ed[_0xfbef('0x20')]),_0xa2ba0f);}});ami['on'](_0xfbef('0x28'),function(_0x4db999){try{utils[_0xfbef('0x1f')](util[_0xfbef('0x1b')](_0xfbef('0x29'),_0x4db999[_0xfbef('0x20')]),_0x4db999);agents[_0xfbef('0x28')](_0x4db999);queues[_0xfbef('0x28')](_0x4db999);}catch(_0x3b835d){utils[_0xfbef('0x18')](util['format'](_0xfbef('0x29'),_0x4db999[_0xfbef('0x20')]),_0x3b835d);}});ami['on'](_0xfbef('0x2a'),function(_0xfa56f0){try{utils[_0xfbef('0x1f')](util[_0xfbef('0x1b')](_0xfbef('0x2b'),_0xfa56f0[_0xfbef('0x20')]),_0xfa56f0);queues['queuecallerjoin'](_0xfa56f0);recordings['queuecallerjoin'](_0xfa56f0);}catch(_0x13d270){utils[_0xfbef('0x18')](util[_0xfbef('0x1b')]('[%s][index][queuecallerjoin]',_0xfa56f0[_0xfbef('0x20')]),_0x13d270);}});ami['on'](_0xfbef('0x2c'),function(_0x5a516e){try{utils[_0xfbef('0x1f')](util[_0xfbef('0x1b')]('[%s][index][queuecallerleave]',_0x5a516e[_0xfbef('0x20')]),_0x5a516e);queues[_0xfbef('0x2c')](_0x5a516e);}catch(_0x353cfd){utils['error'](util[_0xfbef('0x1b')](_0xfbef('0x2d'),_0x5a516e['uniqueid']),_0x353cfd);}});ami['on'](_0xfbef('0x2e'),function(_0xe74cb3){try{utils['debug'](util[_0xfbef('0x1b')]('[%s][index][musiconholdstart]',_0xe74cb3[_0xfbef('0x20')]),_0xe74cb3);queues[_0xfbef('0x2e')](_0xe74cb3);calls[_0xfbef('0x2e')](_0xe74cb3);}catch(_0x6b5421){utils['error'](util[_0xfbef('0x1b')](_0xfbef('0x2f'),_0xe74cb3[_0xfbef('0x20')]),_0x6b5421);}});ami['on'](_0xfbef('0x30'),function(_0x481829){try{utils[_0xfbef('0x1f')](util[_0xfbef('0x1b')](_0xfbef('0x31'),_0x481829[_0xfbef('0x20')]),_0x481829);queues[_0xfbef('0x30')](_0x481829);calls[_0xfbef('0x30')](_0x481829);}catch(_0x5b7277){utils[_0xfbef('0x18')](util[_0xfbef('0x1b')](_0xfbef('0x31'),_0x481829[_0xfbef('0x20')]),_0x5b7277);}});ami['on'](_0xfbef('0x32'),function(_0x5b162e){try{utils[_0xfbef('0x1f')](util['format'](_0xfbef('0x33'),_0x5b162e[_0xfbef('0x20')]),_0x5b162e);calls['newstate'](_0x5b162e);recordings[_0xfbef('0x32')](_0x5b162e);}catch(_0x8c1c90){utils[_0xfbef('0x18')](util['format'](_0xfbef('0x33'),_0x5b162e[_0xfbef('0x20')]),_0x8c1c90);}});ami['on'](_0xfbef('0x34'),function(_0xdc5675){try{utils[_0xfbef('0x1f')](util[_0xfbef('0x1b')](_0xfbef('0x35'),_0xdc5675[_0xfbef('0x20')]),_0xdc5675);calls['hangup'](_0xdc5675);recordings['hangup'](_0xdc5675);dials['hangup'](_0xdc5675);agents[_0xfbef('0x34')](_0xdc5675);queues[_0xfbef('0x34')](_0xdc5675);}catch(_0x2ea16b){utils[_0xfbef('0x18')](util[_0xfbef('0x1b')](_0xfbef('0x35'),_0xdc5675[_0xfbef('0x20')]),_0x2ea16b);}});ami['on'](_0xfbef('0x36'),function(_0x1581a0){try{utils[_0xfbef('0x1f')](util[_0xfbef('0x1b')]('[%s][index][cdr]',_0x1581a0[_0xfbef('0x20')]),_0x1581a0);members['cdr'](_0x1581a0);}catch(_0x565654){utils['error'](util[_0xfbef('0x1b')](_0xfbef('0x37'),_0x1581a0[_0xfbef('0x20')]),_0x565654);}});ami['on'](_0xfbef('0x38'),function(_0xce1951){try{utils[_0xfbef('0x1f')](util['format'](_0xfbef('0x39'),_0xce1951[_0xfbef('0x20')]),_0xce1951);queues[_0xfbef('0x38')](_0xce1951);agents[_0xfbef('0x38')](_0xce1951);transfers[_0xfbef('0x38')](_0xce1951);recordings[_0xfbef('0x38')](_0xce1951);}catch(_0x436181){utils[_0xfbef('0x18')](util[_0xfbef('0x1b')]('[%s][index][blindtransfer]',_0xce1951[_0xfbef('0x20')]),_0x436181);}});ami['on']('attendedtransfer',function(_0x4e89f1){try{utils[_0xfbef('0x1f')](util[_0xfbef('0x1b')](_0xfbef('0x3a'),_0x4e89f1[_0xfbef('0x3b')]),_0x4e89f1);queues[_0xfbef('0x3c')](_0x4e89f1);transfers[_0xfbef('0x3c')](_0x4e89f1);agents['attendedtransfer'](_0x4e89f1);calls[_0xfbef('0x3c')](_0x4e89f1);}catch(_0x4ffd1d){utils[_0xfbef('0x18')](util[_0xfbef('0x1b')]('[%s][index][attendedtransfer]',_0x4e89f1[_0xfbef('0x3b')]),_0x4ffd1d);}});ami['on']('varset',function(_0x4f6f65){try{utils[_0xfbef('0x1f')](util[_0xfbef('0x1b')]('[%s][index][varset]',_0x4f6f65[_0xfbef('0x20')]),_0x4f6f65);queues[_0xfbef('0x3d')](_0x4f6f65);recordings[_0xfbef('0x3d')](_0x4f6f65);calls['varset'](_0x4f6f65);dials[_0xfbef('0x3d')](_0x4f6f65);}catch(_0x236469){utils[_0xfbef('0x18')](util[_0xfbef('0x1b')](_0xfbef('0x3e'),_0x4f6f65[_0xfbef('0x20')]),_0x236469);}});ami['on'](_0xfbef('0x3f'),function(_0xb1d05b){try{utils['debug'](util[_0xfbef('0x1b')](_0xfbef('0x40'),_0xb1d05b[_0xfbef('0x20')]),_0xb1d05b);calls[_0xfbef('0x3f')](_0xb1d05b);recordings[_0xfbef('0x3f')](_0xb1d05b);dials[_0xfbef('0x3f')](_0xb1d05b);}catch(_0x5496b9){utils[_0xfbef('0x18')](util[_0xfbef('0x1b')](_0xfbef('0x40'),_0xb1d05b[_0xfbef('0x20')]),_0x5496b9);}});ami['on']('newchannel',function(_0x2ff365){try{utils['debug'](util['format'](_0xfbef('0x41'),_0x2ff365['uniqueid']),_0x2ff365);calls[_0xfbef('0x42')](_0x2ff365);recordings[_0xfbef('0x42')](_0x2ff365);}catch(_0x186716){utils[_0xfbef('0x18')](util[_0xfbef('0x1b')]('[%s][index][newchannel]',_0x2ff365[_0xfbef('0x20')]),_0x186716);}});ami['on'](_0xfbef('0x43'),function(_0x49d940){try{utils[_0xfbef('0x1f')](util[_0xfbef('0x1b')](_0xfbef('0x44'),_0x49d940[_0xfbef('0x20')]),_0x49d940);dials[_0xfbef('0x43')](_0x49d940);}catch(_0x416319){utils['error'](util[_0xfbef('0x1b')](_0xfbef('0x45'),_0x49d940[_0xfbef('0x20')]),_0x416319);}});ami['on'](_0xfbef('0x46'),function(_0x1ee2f4){try{utils[_0xfbef('0x1f')](util[_0xfbef('0x1b')](_0xfbef('0x47'),_0x1ee2f4[_0xfbef('0x20')]),_0x1ee2f4);dials[_0xfbef('0x46')](_0x1ee2f4);}catch(_0x3e024d){utils[_0xfbef('0x18')](util[_0xfbef('0x1b')](_0xfbef('0x47'),_0x1ee2f4['uniqueid']),_0x3e024d);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 3934ffd..6ca24a3 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 _0xd20f=['CreateMemberReport','getUserByName','name','catch','[%s][members][writeDB]','some','devicestatechange','debug','[%s][members][devicestatechange]','device','uniqueid','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','TALKING','agent','NOT_INUSE','exitAt','now','duration','diffTime','enterAt','error','agentcomplete','isNil','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][agentcomplete]','cdr','channel','split','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','util','Local/_attended@transfer','info','format','data2','membername','type','interface','getUserByInterface','then','internal','request'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xd20f,0xbf));var _0xfd20=function(_0x21f84d,_0x50bbdf){_0x21f84d=_0x21f84d-0x0;var _0x5c4b28=_0xd20f[_0x21f84d];return _0x5c4b28;};'use strict';var _=require(_0xfd20('0x0'));var util=require(_0xfd20('0x1'));var utils=require('./utils');var members={};var exclude=[_0xfd20('0x2'),'Queue:'];function writeDB(_0x5120f1){utils[_0xfd20('0x3')](util[_0xfd20('0x4')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x5120f1['uniqueid'],_0x5120f1['interface'],_0x5120f1['channel'],_0x5120f1[_0xfd20('0x5')],_0x5120f1[_0xfd20('0x6')],_0x5120f1[_0xfd20('0x7')]));if(_0x5120f1[_0xfd20('0x8')]){utils[_0xfd20('0x9')](_0x5120f1[_0xfd20('0x8')])[_0xfd20('0xa')](function(_0x423abe){if(_0x423abe){_0x5120f1['membername']=_0x423abe['name'];_0x5120f1[_0xfd20('0xb')]=_0x423abe[_0xfd20('0xb')];utils[_0xfd20('0xc')](_0xfd20('0xd'),_0x5120f1);}else{utils[_0xfd20('0xe')](_0x5120f1[_0xfd20('0x8')]['split']('/')[0x1])[_0xfd20('0xa')](function(_0x15b07b){if(_0x15b07b){_0x5120f1[_0xfd20('0x6')]=_0x15b07b[_0xfd20('0xf')];_0x5120f1[_0xfd20('0xb')]=_0x15b07b[_0xfd20('0xb')];utils[_0xfd20('0xc')]('CreateMemberReport',_0x5120f1);}});}})[_0xfd20('0x10')](function(_0x2aa58f){utils['error'](util['format'](_0xfd20('0x11'),_0x5120f1['uniqueid']),_0x2aa58f);});}delete members[_0x5120f1['interface']];}function startsWith(_0xa1d931,_0x598be4){return _[_0xfd20('0x12')](_0xa1d931,function(_0x4ea30e){return _['startsWith'](_0x598be4,_0x4ea30e);});}exports[_0xfd20('0x13')]=function(_0x227786){try{utils[_0xfd20('0x14')](util[_0xfd20('0x4')](_0xfd20('0x15'),members[_0x227786[_0xfd20('0x16')]]?members[_0x227786[_0xfd20('0x16')]][_0xfd20('0x17')]:_0x227786[_0xfd20('0x16')]),_0x227786);utils[_0xfd20('0x3')](util[_0xfd20('0x4')](_0xfd20('0x18'),members[_0x227786['device']]?members[_0x227786[_0xfd20('0x16')]][_0xfd20('0x17')]:_0x227786[_0xfd20('0x16')],_0x227786['state'],_0x227786[_0xfd20('0x16')]));switch(_0x227786[_0xfd20('0x19')]){case'INUSE':case _0xfd20('0x1a'):if(!startsWith(exclude,_0x227786['device'])){members[_0x227786[_0xfd20('0x16')]]={'channel':'voice','interface':_0x227786[_0xfd20('0x16')],'type':_0xfd20('0x1b'),'enterAt':utils['now'](),'role':_0xfd20('0x1c')};}break;case _0xfd20('0x1d'):if(!_['isNil'](members[_0x227786[_0xfd20('0x16')]])){members[_0x227786[_0xfd20('0x16')]][_0xfd20('0x1e')]=utils[_0xfd20('0x1f')]();members[_0x227786['device']][_0xfd20('0x20')]=utils[_0xfd20('0x21')](members[_0x227786['device']][_0xfd20('0x1e')],members[_0x227786[_0xfd20('0x16')]][_0xfd20('0x22')]);if(members[_0x227786[_0xfd20('0x16')]][_0xfd20('0x17')]){writeDB(members[_0x227786[_0xfd20('0x16')]]);}}break;default:break;}}catch(_0x5631ea){utils[_0xfd20('0x23')](util[_0xfd20('0x4')]('[%s][members][devicestatechange]',members[_0x227786[_0xfd20('0x16')]]?members[_0x227786[_0xfd20('0x16')]][_0xfd20('0x17')]:_0x227786[_0xfd20('0x16')]),_0x5631ea);}};exports[_0xfd20('0x24')]=function(_0x4565fd){try{if(!_[_0xfd20('0x25')](members[_0x4565fd[_0xfd20('0x8')]])){utils[_0xfd20('0x14')](util['format']('[%s][members][agentcomplete]',_0x4565fd[_0xfd20('0x17')]),_0x4565fd);utils[_0xfd20('0x3')](util[_0xfd20('0x4')](_0xfd20('0x26'),_0x4565fd[_0xfd20('0x17')],_0x4565fd[_0xfd20('0x8')],_0x4565fd[_0xfd20('0x27')]));members[_0x4565fd[_0xfd20('0x8')]]=_[_0xfd20('0x28')](members[_0x4565fd['interface']],{'data4':_0x4565fd[_0xfd20('0x27')],'uniqueid':_0x4565fd[_0xfd20('0x17')]});}}catch(_0x591602){utils[_0xfd20('0x23')](util[_0xfd20('0x4')](_0xfd20('0x29'),_0x4565fd[_0xfd20('0x17')]),_0x591602);}};exports[_0xfd20('0x2a')]=function(_0x1300c4){try{utils['debug'](util[_0xfd20('0x4')]('[%s][members][cdr]',_0x1300c4[_0xfd20('0x17')]),_0x1300c4);if(_0x1300c4[_0xfd20('0x2b')]){var _0x4f7b9d=_0x1300c4[_0xfd20('0x2b')][_0xfd20('0x2c')]('-')[0x0];if(!_[_0xfd20('0x25')](members[_0x4f7b9d])){members[_0x4f7b9d]=_[_0xfd20('0x28')](members[_0x4f7b9d],{'data1':members[_0x4f7b9d][_0xfd20('0x2d')]||_0x1300c4['type'],'data2':members[_0x4f7b9d][_0xfd20('0x5')]||_0x1300c4[_0xfd20('0x2e')],'data3':members[_0x4f7b9d][_0xfd20('0x2f')]||_0x1300c4[_0xfd20('0x30')],'uniqueid':members[_0x4f7b9d]['uniqueid']||_0x1300c4[_0xfd20('0x17')]});utils[_0xfd20('0x3')](util[_0xfd20('0x4')](_0xfd20('0x31'),_0x1300c4[_0xfd20('0x17')],members[_0x4f7b9d][_0xfd20('0x2d')],members[_0x4f7b9d][_0xfd20('0x5')],members[_0x4f7b9d][_0xfd20('0x2f')]));if(members[_0x4f7b9d][_0xfd20('0x1e')]){writeDB(members[_0x4f7b9d]);}}}if(_0x1300c4[_0xfd20('0x32')]){var _0x292ebd=_0x1300c4[_0xfd20('0x32')][_0xfd20('0x2c')]('-')[0x0];if(!_[_0xfd20('0x25')](members[_0x292ebd])){members[_0x292ebd]=_[_0xfd20('0x28')](members[_0x292ebd],{'data1':members[_0x292ebd][_0xfd20('0x2d')]||_0x1300c4[_0xfd20('0x7')],'data2':members[_0x292ebd]['data2']||_0x1300c4[_0xfd20('0x2e')],'data3':members[_0x292ebd][_0xfd20('0x2f')]||_0x1300c4[_0xfd20('0x30')],'uniqueid':members[_0x292ebd][_0xfd20('0x17')]||_0x1300c4[_0xfd20('0x17')]});utils[_0xfd20('0x3')](util[_0xfd20('0x4')](_0xfd20('0x31'),_0x1300c4[_0xfd20('0x17')],members[_0x292ebd]['data1'],members[_0x292ebd][_0xfd20('0x5')],members[_0x292ebd]['data3']));if(members[_0x292ebd]['exitAt']){writeDB(members[_0x292ebd]);}}}}catch(_0x2bcc3b){utils['error'](util[_0xfd20('0x4')]('[%s][members][cdr]',_0x1300c4[_0xfd20('0x17')]),_0x2bcc3b);}}; \ No newline at end of file +var _0x1502=['[%s][members][cdr]','lodash','util','./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','data2','membername','getUserByInterface','name','internal','request','CreateMemberReport','split','then','catch','error','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','INUSE','BUSY','voice','TALKING','now','isNil','exitAt','duration','enterAt','[%s][members][agentcomplete]','info','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','channel','data1','type','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel'];(function(_0x4cefc3,_0x23f291){var _0x1cc779=function(_0x7cb914){while(--_0x7cb914){_0x4cefc3['push'](_0x4cefc3['shift']());}};_0x1cc779(++_0x23f291);}(_0x1502,0x1c3));var _0x2150=function(_0xe7ddf2,_0x5d7ece){_0xe7ddf2=_0xe7ddf2-0x0;var _0x43407a=_0x1502[_0xe7ddf2];return _0x43407a;};'use strict';var _=require(_0x2150('0x0'));var util=require(_0x2150('0x1'));var utils=require(_0x2150('0x2'));var members={};var exclude=[_0x2150('0x3'),_0x2150('0x4')];function writeDB(_0x208af9){utils['info'](util[_0x2150('0x5')](_0x2150('0x6'),_0x208af9[_0x2150('0x7')],_0x208af9[_0x2150('0x8')],_0x208af9['channel'],_0x208af9[_0x2150('0x9')],_0x208af9[_0x2150('0xa')],_0x208af9['type']));if(_0x208af9[_0x2150('0x8')]){utils[_0x2150('0xb')](_0x208af9[_0x2150('0x8')])['then'](function(_0x31a4f){if(_0x31a4f){_0x208af9[_0x2150('0xa')]=_0x31a4f[_0x2150('0xc')];_0x208af9['internal']=_0x31a4f[_0x2150('0xd')];utils[_0x2150('0xe')](_0x2150('0xf'),_0x208af9);}else{utils['getUserByName'](_0x208af9[_0x2150('0x8')][_0x2150('0x10')]('/')[0x1])[_0x2150('0x11')](function(_0x30975e){if(_0x30975e){_0x208af9['membername']=_0x30975e['name'];_0x208af9[_0x2150('0xd')]=_0x30975e[_0x2150('0xd')];utils['request']('CreateMemberReport',_0x208af9);}});}})[_0x2150('0x12')](function(_0x1536f){utils[_0x2150('0x13')](util['format']('[%s][members][writeDB]',_0x208af9[_0x2150('0x7')]),_0x1536f);});}delete members[_0x208af9[_0x2150('0x8')]];}function startsWith(_0x4beabc,_0x13ad4b){return _[_0x2150('0x14')](_0x4beabc,function(_0x3543a1){return _[_0x2150('0x15')](_0x13ad4b,_0x3543a1);});}exports[_0x2150('0x16')]=function(_0x31b9fb){try{utils[_0x2150('0x17')](util[_0x2150('0x5')](_0x2150('0x18'),members[_0x31b9fb[_0x2150('0x19')]]?members[_0x31b9fb[_0x2150('0x19')]][_0x2150('0x7')]:_0x31b9fb[_0x2150('0x19')]),_0x31b9fb);utils['info'](util['format'](_0x2150('0x1a'),members[_0x31b9fb[_0x2150('0x19')]]?members[_0x31b9fb[_0x2150('0x19')]][_0x2150('0x7')]:_0x31b9fb['device'],_0x31b9fb['state'],_0x31b9fb[_0x2150('0x19')]));switch(_0x31b9fb['state']){case _0x2150('0x1b'):case _0x2150('0x1c'):if(!startsWith(exclude,_0x31b9fb[_0x2150('0x19')])){members[_0x31b9fb[_0x2150('0x19')]]={'channel':_0x2150('0x1d'),'interface':_0x31b9fb['device'],'type':_0x2150('0x1e'),'enterAt':utils[_0x2150('0x1f')](),'role':'agent'};}break;case'NOT_INUSE':if(!_[_0x2150('0x20')](members[_0x31b9fb[_0x2150('0x19')]])){members[_0x31b9fb[_0x2150('0x19')]][_0x2150('0x21')]=utils[_0x2150('0x1f')]();members[_0x31b9fb[_0x2150('0x19')]][_0x2150('0x22')]=utils['diffTime'](members[_0x31b9fb[_0x2150('0x19')]]['exitAt'],members[_0x31b9fb['device']][_0x2150('0x23')]);if(members[_0x31b9fb[_0x2150('0x19')]]['uniqueid']){writeDB(members[_0x31b9fb['device']]);}}break;default:break;}}catch(_0xabd935){utils['error'](util[_0x2150('0x5')](_0x2150('0x18'),members[_0x31b9fb[_0x2150('0x19')]]?members[_0x31b9fb[_0x2150('0x19')]]['uniqueid']:_0x31b9fb[_0x2150('0x19')]),_0xabd935);}};exports['agentcomplete']=function(_0x1b1d6a){try{if(!_['isNil'](members[_0x1b1d6a[_0x2150('0x8')]])){utils[_0x2150('0x17')](util[_0x2150('0x5')](_0x2150('0x24'),_0x1b1d6a[_0x2150('0x7')]),_0x1b1d6a);utils[_0x2150('0x25')](util[_0x2150('0x5')](_0x2150('0x26'),_0x1b1d6a[_0x2150('0x7')],_0x1b1d6a[_0x2150('0x8')],_0x1b1d6a[_0x2150('0x27')]));members[_0x1b1d6a[_0x2150('0x8')]]=_[_0x2150('0x28')](members[_0x1b1d6a['interface']],{'data4':_0x1b1d6a[_0x2150('0x27')],'uniqueid':_0x1b1d6a[_0x2150('0x7')]});}}catch(_0x656c7f){utils[_0x2150('0x13')](util[_0x2150('0x5')](_0x2150('0x24'),_0x1b1d6a['uniqueid']),_0x656c7f);}};exports['cdr']=function(_0x253c5f){try{utils[_0x2150('0x17')](util[_0x2150('0x5')]('[%s][members][cdr]',_0x253c5f[_0x2150('0x7')]),_0x253c5f);if(_0x253c5f[_0x2150('0x29')]){var _0x2b4050=_0x253c5f['channel']['split']('-')[0x0];if(!_[_0x2150('0x20')](members[_0x2b4050])){members[_0x2b4050]=_[_0x2150('0x28')](members[_0x2b4050],{'data1':members[_0x2b4050][_0x2150('0x2a')]||_0x253c5f[_0x2150('0x2b')],'data2':members[_0x2b4050][_0x2150('0x9')]||_0x253c5f[_0x2150('0x2c')],'data3':members[_0x2b4050][_0x2150('0x2d')]||_0x253c5f[_0x2150('0x2e')],'uniqueid':members[_0x2b4050][_0x2150('0x7')]||_0x253c5f[_0x2150('0x7')]});utils[_0x2150('0x25')](util[_0x2150('0x5')](_0x2150('0x2f'),_0x253c5f[_0x2150('0x7')],members[_0x2b4050][_0x2150('0x2a')],members[_0x2b4050]['data2'],members[_0x2b4050]['data3']));if(members[_0x2b4050]['exitAt']){writeDB(members[_0x2b4050]);}}}if(_0x253c5f[_0x2150('0x30')]){var _0x5b240e=_0x253c5f[_0x2150('0x30')]['split']('-')[0x0];if(!_['isNil'](members[_0x5b240e])){members[_0x5b240e]=_[_0x2150('0x28')](members[_0x5b240e],{'data1':members[_0x5b240e][_0x2150('0x2a')]||_0x253c5f[_0x2150('0x2b')],'data2':members[_0x5b240e][_0x2150('0x9')]||_0x253c5f[_0x2150('0x2c')],'data3':members[_0x5b240e]['data3']||_0x253c5f[_0x2150('0x2e')],'uniqueid':members[_0x5b240e][_0x2150('0x7')]||_0x253c5f[_0x2150('0x7')]});utils['info'](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x253c5f[_0x2150('0x7')],members[_0x5b240e][_0x2150('0x2a')],members[_0x5b240e]['data2'],members[_0x5b240e][_0x2150('0x2d')]));if(members[_0x5b240e][_0x2150('0x21')]){writeDB(members[_0x5b240e]);}}}}catch(_0x555ec6){utils[_0x2150('0x13')](util['format'](_0x2150('0x31'),_0x253c5f['uniqueid']),_0x555ec6);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 94780a3..7ac6ba6 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 _0x5b01=['[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','transfertargetuniqueid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','error','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','queuecallerjoinAt','count','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfertype','BLIND','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','ATTENDED','transferexten','origtransfererexten','transfereelinkedid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s'];(function(_0x12a90b,_0x5d119b){var _0x2114bc=function(_0x14ed80){while(--_0x14ed80){_0x12a90b['push'](_0x12a90b['shift']());}};_0x2114bc(++_0x5d119b);}(_0x5b01,0x154));var _0x15b0=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x5b01[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0x15b0('0x0'));var util=require(_0x15b0('0x1'));var utils=require(_0x15b0('0x2'));var queues={};function writeDB(_0x445980){utils[_0x15b0('0x3')](util[_0x15b0('0x4')](_0x15b0('0x5'),_0x445980[_0x15b0('0x6')],_0x445980['channel'],_0x445980['queue'],_0x445980[_0x15b0('0x7')],_0x445980[_0x15b0('0x8')],_0x445980[_0x15b0('0x9')],_0x445980[_0x15b0('0xa')]));if(_0x445980[_0x15b0('0xb')]){utils[_0x15b0('0xc')](_0x445980[_0x15b0('0xb')])[_0x15b0('0xd')](function(_0x2ce0a4){if(_0x2ce0a4){_0x445980[_0x15b0('0xe')]=_0x2ce0a4[_0x15b0('0xe')];}utils[_0x15b0('0xf')]('CreateVoiceQueueReport',_0x445980);});}else{utils[_0x15b0('0xf')]('CreateVoiceQueueReport',_0x445980);}if(_0x445980[_0x15b0('0x10')]){delete queues[_0x445980['transfereduniqueid']];}else{delete queues[_0x445980['uniqueid']];}}exports[_0x15b0('0x11')]=function(_0x402670){try{utils['debug'](util[_0x15b0('0x4')](_0x15b0('0x12'),_0x402670['uniqueid']),_0x402670);utils[_0x15b0('0x3')](util[_0x15b0('0x4')](_0x15b0('0x13'),_0x402670[_0x15b0('0x6')],_0x402670['queue'],_0x402670['position']));queues[_0x402670[_0x15b0('0x6')]]=_[_0x15b0('0x14')](_0x402670,{'originalposition':_0x402670[_0x15b0('0x15')],'queuecallerjoinAt':utils[_0x15b0('0x16')](),'mohtime':0x0});}catch(_0x4a80fc){utils[_0x15b0('0x17')](util[_0x15b0('0x4')](_0x15b0('0x12'),_0x402670[_0x15b0('0x6')]),_0x4a80fc);}};exports['hangup']=function(_0x3c0945){try{if(!_[_0x15b0('0x18')](queues[_0x3c0945[_0x15b0('0x6')]])){utils[_0x15b0('0x19')](util[_0x15b0('0x4')](_0x15b0('0x1a'),_0x3c0945[_0x15b0('0x6')]),_0x3c0945);if(queues[_0x3c0945[_0x15b0('0x6')]][_0x15b0('0x1b')]){if(!queues[_0x3c0945[_0x15b0('0x6')]][_0x15b0('0x1c')]&&!queues[_0x3c0945['uniqueid']][_0x15b0('0x1d')]){queues[_0x3c0945['uniqueid']][_0x15b0('0x1e')]=!![];queues[_0x3c0945['uniqueid']][_0x15b0('0x1f')]=utils[_0x15b0('0x16')]();queues[_0x3c0945['uniqueid']][_0x15b0('0xa')]=_0x15b0('0x20');}utils[_0x15b0('0x3')](util['format'](_0x15b0('0x21'),_0x3c0945[_0x15b0('0x6')],queues[_0x3c0945['uniqueid']]['name'],queues[_0x3c0945[_0x15b0('0x6')]][_0x15b0('0xa')]));writeDB(queues[_0x3c0945[_0x15b0('0x6')]]);}else if(queues[_0x3c0945[_0x15b0('0x6')]][_0x15b0('0x10')]){utils[_0x15b0('0x3')](util[_0x15b0('0x4')](_0x15b0('0x22'),_0x3c0945['uniqueid'],queues[_0x3c0945[_0x15b0('0x6')]][_0x15b0('0x23')],queues[_0x3c0945[_0x15b0('0x6')]]['transfereduniqueid']));queues[queues[_0x3c0945['uniqueid']][_0x15b0('0x10')]]=queues[_0x3c0945['uniqueid']];queues[queues[_0x3c0945[_0x15b0('0x6')]][_0x15b0('0x10')]][_0x15b0('0x24')]=0x2;delete queues[_0x3c0945['uniqueid']];}}}catch(_0x2c1ed0){utils[_0x15b0('0x17')](util['format'](_0x15b0('0x1a'),_0x3c0945['uniqueid']),_0x2c1ed0);}};exports[_0x15b0('0x25')]=function(_0x42408c){try{utils[_0x15b0('0x19')](util[_0x15b0('0x4')](_0x15b0('0x26'),_0x42408c[_0x15b0('0x6')]),_0x42408c);if(!_[_0x15b0('0x18')](_0x42408c[_0x15b0('0x27')][_0x15b0('0x28')])&&_0x42408c[_0x15b0('0x29')][_0x15b0('0x2a')]()!==_0x15b0('0x2b')){if(!_[_0x15b0('0x18')](queues[_0x42408c[_0x15b0('0x6')]])){queues[_0x42408c[_0x15b0('0x6')]][_0x15b0('0x1c')]=![];queues[_0x42408c[_0x15b0('0x6')]][_0x15b0('0x2c')]=null;queues[_0x42408c[_0x15b0('0x6')]][_0x15b0('0x1d')]=!![];queues[_0x42408c[_0x15b0('0x6')]][_0x15b0('0x2d')]=utils[_0x15b0('0x16')]();queues[_0x42408c[_0x15b0('0x6')]][_0x15b0('0xa')]=_0x42408c[_0x15b0('0x29')][_0x15b0('0x2a')]();utils[_0x15b0('0x3')](util['format'](_0x15b0('0x2e'),_0x42408c['uniqueid'],queues[_0x42408c[_0x15b0('0x6')]][_0x15b0('0x23')],_0x42408c[_0x15b0('0x29')],queues[_0x42408c['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x42408c['uniqueid']]);}}else if(!_[_0x15b0('0x18')](_0x42408c[_0x15b0('0x27')][_0x15b0('0x2f')])){if(!_[_0x15b0('0x18')](queues[_0x42408c['uniqueid']])&&!queues[_0x42408c['uniqueid']][_0x15b0('0x1c')]){queues[_0x42408c['uniqueid']]['queuecallerabandon']=![];queues[_0x42408c[_0x15b0('0x6')]][_0x15b0('0x2c')]=null;queues[_0x42408c[_0x15b0('0x6')]]['queuecallerexit']=!![];queues[_0x42408c[_0x15b0('0x6')]]['queuecallerexitAt']=utils[_0x15b0('0x16')]();queues[_0x42408c['uniqueid']]['queuecallerexitreason']=_0x15b0('0x30');utils[_0x15b0('0x3')](util['format'](_0x15b0('0x31'),_0x42408c['uniqueid'],queues[_0x42408c['uniqueid']][_0x15b0('0x23')],_0x42408c[_0x15b0('0x29')],queues[_0x42408c['uniqueid']][_0x15b0('0xa')]));}}}catch(_0x587d5b){utils['error'](util[_0x15b0('0x4')]('[%s][queues][varset]',_0x42408c[_0x15b0('0x6')]),_0x587d5b);}};exports['queuecallerabandon']=function(_0x2fc28e){try{if(!_['isNil'](queues[_0x2fc28e[_0x15b0('0x6')]])){utils[_0x15b0('0x19')](util['format'](_0x15b0('0x32'),_0x2fc28e[_0x15b0('0x6')]),_0x2fc28e);queues[_0x2fc28e[_0x15b0('0x6')]][_0x15b0('0x1d')]=![];queues[_0x2fc28e[_0x15b0('0x6')]][_0x15b0('0x2d')]=null;queues[_0x2fc28e[_0x15b0('0x6')]]['queuecallerabandon']=!![];queues[_0x2fc28e['uniqueid']]['queuecallerabandonAt']=utils[_0x15b0('0x16')]();queues[_0x2fc28e[_0x15b0('0x6')]][_0x15b0('0xa')]=_0x15b0('0x33');utils[_0x15b0('0x3')](util[_0x15b0('0x4')](_0x15b0('0x34'),_0x2fc28e[_0x15b0('0x6')],queues[_0x2fc28e['uniqueid']]['name'],queues[_0x2fc28e[_0x15b0('0x6')]][_0x15b0('0xa')]));}}catch(_0x486382){utils[_0x15b0('0x17')](util[_0x15b0('0x4')]('[%s][queues][queuecallerabandon]',_0x2fc28e['uniqueid']),_0x486382);}};exports[_0x15b0('0x35')]=function(_0xc112ec){try{if(!_[_0x15b0('0x18')](queues[_0xc112ec[_0x15b0('0x6')]])){utils[_0x15b0('0x19')](util['format'](_0x15b0('0x36'),_0xc112ec[_0x15b0('0x6')]),_0xc112ec);utils[_0x15b0('0x3')](util[_0x15b0('0x4')](_0x15b0('0x37'),_0xc112ec[_0x15b0('0x6')],queues[_0xc112ec[_0x15b0('0x6')]][_0x15b0('0x23')],_0xc112ec[_0x15b0('0x38')],_0xc112ec[_0x15b0('0x39')]));queues[_0xc112ec[_0x15b0('0x6')]][_0x15b0('0x35')]=!![];queues[_0xc112ec[_0x15b0('0x6')]]['queuecallerleaveAt']=utils[_0x15b0('0x16')]();queues[_0xc112ec[_0x15b0('0x6')]][_0x15b0('0x3a')]=utils['diffTime'](queues[_0xc112ec[_0x15b0('0x6')]]['queuecallerleaveAt'],queues[_0xc112ec['uniqueid']][_0x15b0('0x3b')]);queues[_0xc112ec[_0x15b0('0x6')]][_0x15b0('0x15')]=_0xc112ec['position'];queues[_0xc112ec[_0x15b0('0x6')]][_0x15b0('0x3c')]=_0xc112ec[_0x15b0('0x3c')];queues[_0xc112ec[_0x15b0('0x6')]]['connectedlinenum']=_0xc112ec[_0x15b0('0x38')];queues[_0xc112ec[_0x15b0('0x6')]][_0x15b0('0x39')]=_0xc112ec[_0x15b0('0x39')];}}catch(_0x507593){utils['error'](util[_0x15b0('0x4')](_0x15b0('0x36'),_0xc112ec[_0x15b0('0x6')]),_0x507593);}};exports['agentconnect']=function(_0x1e1349){try{if(!_[_0x15b0('0x18')](queues[_0x1e1349['uniqueid']])){utils[_0x15b0('0x19')](util['format']('[%s][queues][agentconnect]',_0x1e1349[_0x15b0('0x6')]),_0x1e1349);utils[_0x15b0('0x3')](util[_0x15b0('0x4')](_0x15b0('0x3d'),_0x1e1349['uniqueid'],queues[_0x1e1349[_0x15b0('0x6')]]['name'],_0x1e1349[_0x15b0('0x3e')],_0x1e1349[_0x15b0('0x3f')]));queues[_0x1e1349[_0x15b0('0x6')]][_0x15b0('0x1c')]=![];queues[_0x1e1349[_0x15b0('0x6')]][_0x15b0('0x1c')]=![];queues[_0x1e1349[_0x15b0('0x6')]][_0x15b0('0x2c')]=null;queues[_0x1e1349['uniqueid']][_0x15b0('0x1d')]=![];queues[_0x1e1349['uniqueid']][_0x15b0('0xa')]=null;queues[_0x1e1349[_0x15b0('0x6')]]['queuecallerexitAt']=null;queues[_0x1e1349[_0x15b0('0x6')]][_0x15b0('0x40')]=!![];queues[_0x1e1349[_0x15b0('0x6')]][_0x15b0('0x9')]=_0x1e1349[_0x15b0('0x3f')];queues[_0x1e1349['uniqueid']][_0x15b0('0x7')]=_0x1e1349[_0x15b0('0x3e')];}}catch(_0x271337){utils['error'](util[_0x15b0('0x4')](_0x15b0('0x41'),_0x1e1349[_0x15b0('0x6')]),_0x271337);}};exports[_0x15b0('0x42')]=function(_0x522f94){try{if(!_['isNil'](queues[_0x522f94['uniqueid']])){if(queues[_0x522f94['uniqueid']][_0x15b0('0x1b')]){utils[_0x15b0('0x19')](util[_0x15b0('0x4')](_0x15b0('0x43'),_0x522f94[_0x15b0('0x6')]),_0x522f94);queues[_0x522f94[_0x15b0('0x6')]][_0x15b0('0x1c')]=![];queues[_0x522f94[_0x15b0('0x6')]][_0x15b0('0x1c')]=![];queues[_0x522f94[_0x15b0('0x6')]][_0x15b0('0x2c')]=null;queues[_0x522f94[_0x15b0('0x6')]][_0x15b0('0x1d')]=![];queues[_0x522f94[_0x15b0('0x6')]]['queuecallerexitAt']=null;queues[_0x522f94[_0x15b0('0x6')]][_0x15b0('0x40')]=!![];queues[_0x522f94[_0x15b0('0x6')]][_0x15b0('0x7')]=_0x522f94['membername'];queues[_0x522f94[_0x15b0('0x6')]][_0x15b0('0x1e')]=!![];queues[_0x522f94[_0x15b0('0x6')]][_0x15b0('0x1f')]=utils[_0x15b0('0x16')]();if(_0x522f94[_0x15b0('0x44')]==_0x15b0('0x45')){if(!queues[_0x522f94[_0x15b0('0x6')]][_0x15b0('0x45')]){queues[_0x522f94['uniqueid']]['queuecallerexitreason']=_0x15b0('0x46');}}else{queues[_0x522f94[_0x15b0('0x6')]][_0x15b0('0xa')]=_0x15b0('0x47')+_0x522f94[_0x15b0('0x44')][_0x15b0('0x2a')]();}utils[_0x15b0('0x3')](util[_0x15b0('0x4')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x522f94[_0x15b0('0x6')],queues[_0x522f94[_0x15b0('0x6')]][_0x15b0('0x23')],_0x522f94[_0x15b0('0x3e')],queues[_0x522f94[_0x15b0('0x6')]]['queuecallerexitreason']));writeDB(queues[_0x522f94[_0x15b0('0x6')]]);}}}catch(_0x5dca0f){utils['error'](util[_0x15b0('0x4')](_0x15b0('0x43'),_0x522f94[_0x15b0('0x6')]),_0x5dca0f);}};exports[_0x15b0('0x48')]=function(_0x5d413b){try{if(!_['isNil'](queues[_0x5d413b['transfereeuniqueid']])){utils[_0x15b0('0x19')](util[_0x15b0('0x4')]('[%s][queues][blindtransfer]',_0x5d413b[_0x15b0('0x6')]),_0x5d413b);queues[_0x5d413b['transfereeuniqueid']]['transfer']=!![];queues[_0x5d413b[_0x15b0('0x49')]][_0x15b0('0x4a')]=_0x15b0('0x4b');queues[_0x5d413b[_0x15b0('0x49')]]['transferexten']=_0x5d413b[_0x15b0('0x4c')];queues[_0x5d413b[_0x15b0('0x49')]][_0x15b0('0x4d')]=_0x5d413b['transfereeuniqueid'];queues[_0x5d413b['transfereeuniqueid']]['queuecallerexitreason']=_0x15b0('0x4e');utils[_0x15b0('0x3')](util[_0x15b0('0x4')](_0x15b0('0x4f'),_0x5d413b[_0x15b0('0x6')],queues[_0x5d413b[_0x15b0('0x49')]][_0x15b0('0x23')],_0x5d413b[_0x15b0('0x49')],_0x5d413b['extension']));}}catch(_0x131c44){utils[_0x15b0('0x17')](util['format']('[%s][queues][blindtransfer]',_0x5d413b['uniqueid']),_0x131c44);}};exports['attendedtransfer']=function(_0x57edb3){try{utils['debug'](util[_0x15b0('0x4')](_0x15b0('0x50'),_0x57edb3[_0x15b0('0x51')]),_0x57edb3);if(_0x57edb3[_0x15b0('0x51')]==_0x57edb3[_0x15b0('0x52')]){if(!_[_0x15b0('0x18')](queues[_0x57edb3['secondtransfererlinkedid']])){utils['info'](util[_0x15b0('0x4')](_0x15b0('0x53'),_0x57edb3[_0x15b0('0x51')],queues[_0x57edb3['secondtransfererlinkedid']][_0x15b0('0x23')],_0x57edb3['origtransfererexten']));queues[_0x57edb3[_0x15b0('0x54')]][_0x15b0('0x45')]=!![];queues[_0x57edb3[_0x15b0('0x54')]][_0x15b0('0x4a')]=_0x15b0('0x55');queues[_0x57edb3[_0x15b0('0x54')]][_0x15b0('0x56')]=_0x57edb3[_0x15b0('0x57')];queues[_0x57edb3['secondtransfererlinkedid']][_0x15b0('0x4d')]=_0x57edb3[_0x15b0('0x51')];queues[_0x57edb3[_0x15b0('0x54')]][_0x15b0('0xa')]='ATTENDEDTRANSFER';}if(!_[_0x15b0('0x18')](queues[_0x57edb3[_0x15b0('0x52')]])){if(_0x57edb3['transfereelinkedid']&&queues[_0x57edb3['transfereelinkedid']]){queues[_0x57edb3[_0x15b0('0x58')]]['queuecallerenterreason']=0x1;queues[_0x57edb3[_0x15b0('0x49')]]=_['clone'](queues[_0x57edb3[_0x15b0('0x58')]]);queues[_0x57edb3[_0x15b0('0x49')]][_0x15b0('0x10')]=_0x57edb3['transfertargetuniqueid'];queues[_0x57edb3[_0x15b0('0x49')]][_0x15b0('0x24')]=0x2;queues[_0x57edb3['transfereeuniqueid']][_0x15b0('0x8')]=queues[_0x57edb3[_0x15b0('0x54')]][_0x15b0('0x8')];queues[_0x57edb3[_0x15b0('0x49')]][_0x15b0('0x59')]=queues[_0x57edb3[_0x15b0('0x54')]][_0x15b0('0x59')];queues[_0x57edb3['transfereeuniqueid']]['queuecallerjoinAt']=utils[_0x15b0('0x16')]();queues[_0x57edb3[_0x15b0('0x49')]][_0x15b0('0x1b')]=utils[_0x15b0('0x16')]();queues[_0x57edb3[_0x15b0('0x49')]][_0x15b0('0x3a')]=0x0;queues[_0x57edb3['transfereeuniqueid']][_0x15b0('0x5a')]=0x0;utils[_0x15b0('0x3')](util['format'](_0x15b0('0x5b'),_0x57edb3[_0x15b0('0x51')],queues[_0x57edb3[_0x15b0('0x49')]]['name'],queues[_0x57edb3['transfereeuniqueid']][_0x15b0('0x8')],queues[_0x57edb3[_0x15b0('0x49')]][_0x15b0('0x59')]));}else{utils[_0x15b0('0x3')](util[_0x15b0('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x57edb3['origtransfereruniqueid'],queues[_0x57edb3[_0x15b0('0x52')]][_0x15b0('0x23')],_0x57edb3[_0x15b0('0x54')]));queues[_0x57edb3['origtransfererlinkedid']][_0x15b0('0x10')]=_0x57edb3[_0x15b0('0x54')];}}}else if(_0x57edb3['secondtransfereruniqueid']==_0x57edb3[_0x15b0('0x54')]){if(!_[_0x15b0('0x18')](queues[_0x57edb3[_0x15b0('0x52')]])){utils[_0x15b0('0x3')](util[_0x15b0('0x4')](_0x15b0('0x5c'),_0x57edb3[_0x15b0('0x51')],queues[_0x57edb3['origtransfererlinkedid']][_0x15b0('0x23')],_0x57edb3[_0x15b0('0x5d')],_0x57edb3[_0x15b0('0x5e')]));queues[_0x57edb3[_0x15b0('0x52')]][_0x15b0('0x45')]=!![];queues[_0x57edb3[_0x15b0('0x52')]][_0x15b0('0x4a')]=_0x15b0('0x55');queues[_0x57edb3['origtransfererlinkedid']][_0x15b0('0x56')]=_0x57edb3[_0x15b0('0x5e')];queues[_0x57edb3[_0x15b0('0x52')]]['transferuniqueid']=_0x57edb3[_0x15b0('0x5d')];queues[_0x57edb3[_0x15b0('0x52')]][_0x15b0('0xa')]=_0x15b0('0x5f');}if(!_[_0x15b0('0x18')](queues[_0x57edb3[_0x15b0('0x54')]])){if(_0x57edb3[_0x15b0('0x60')]&&queues[_0x57edb3['transfertargetlinkedid']]){queues[_0x57edb3[_0x15b0('0x60')]][_0x15b0('0x24')]=0x1;queues[_0x57edb3[_0x15b0('0x61')]]=_[_0x15b0('0x62')](queues[_0x57edb3['transfertargetlinkedid']]);queues[_0x57edb3[_0x15b0('0x61')]]['transfereduniqueid']=_0x57edb3[_0x15b0('0x61')];queues[_0x57edb3[_0x15b0('0x61')]][_0x15b0('0x24')]=0x2;queues[_0x57edb3[_0x15b0('0x61')]][_0x15b0('0x8')]=queues[_0x57edb3[_0x15b0('0x52')]][_0x15b0('0x8')];queues[_0x57edb3[_0x15b0('0x61')]][_0x15b0('0x59')]=queues[_0x57edb3['origtransfererlinkedid']][_0x15b0('0x59')];queues[_0x57edb3['transfertargetuniqueid']][_0x15b0('0x3b')]=utils['now']();queues[_0x57edb3[_0x15b0('0x61')]][_0x15b0('0x1b')]=utils['now']();queues[_0x57edb3[_0x15b0('0x61')]]['holdtime']=0x0;queues[_0x57edb3[_0x15b0('0x61')]][_0x15b0('0x5a')]=0x0;utils[_0x15b0('0x3')](util[_0x15b0('0x4')](_0x15b0('0x63'),_0x57edb3[_0x15b0('0x51')],queues[_0x57edb3['transfertargetuniqueid']]['name'],queues[_0x57edb3[_0x15b0('0x61')]][_0x15b0('0x10')],queues[_0x57edb3[_0x15b0('0x61')]]['calleridnum'],queues[_0x57edb3[_0x15b0('0x61')]]['calleridname']));}else{utils[_0x15b0('0x3')](util[_0x15b0('0x4')](_0x15b0('0x64'),_0x57edb3['origtransfereruniqueid'],queues[_0x57edb3[_0x15b0('0x54')]][_0x15b0('0x23')],_0x57edb3[_0x15b0('0x52')]));queues[_0x57edb3[_0x15b0('0x54')]][_0x15b0('0x10')]=_0x57edb3[_0x15b0('0x52')];}}}}catch(_0x592372){utils[_0x15b0('0x17')](util[_0x15b0('0x4')](_0x15b0('0x50'),_0x57edb3[_0x15b0('0x51')]),_0x592372);}};exports[_0x15b0('0x65')]=function(_0x523256){try{if(!_[_0x15b0('0x18')](queues[_0x523256[_0x15b0('0x6')]])){utils[_0x15b0('0x19')](util[_0x15b0('0x4')](_0x15b0('0x66'),_0x523256['uniqueid']),_0x523256);queues[_0x523256[_0x15b0('0x6')]][_0x15b0('0x67')]=utils[_0x15b0('0x16')]();utils['info'](util[_0x15b0('0x4')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x523256[_0x15b0('0x6')],queues[_0x523256['uniqueid']][_0x15b0('0x23')],queues[_0x523256[_0x15b0('0x6')]][_0x15b0('0x67')]));}}catch(_0x276930){utils[_0x15b0('0x17')](util[_0x15b0('0x4')]('[%s][queues][musiconholdstart]',_0x523256['uniqueid']),_0x276930);}};exports[_0x15b0('0x68')]=function(_0x2d16eb){try{if(!_[_0x15b0('0x18')](queues[_0x2d16eb[_0x15b0('0x6')]])){if(!_[_0x15b0('0x18')](queues[_0x2d16eb['uniqueid']][_0x15b0('0x67')])){utils[_0x15b0('0x19')](util['format'](_0x15b0('0x69'),_0x2d16eb[_0x15b0('0x6')]),_0x2d16eb);queues[_0x2d16eb[_0x15b0('0x6')]]['mohtime']+=utils[_0x15b0('0x6a')](utils['now'](),queues[_0x2d16eb[_0x15b0('0x6')]][_0x15b0('0x67')]);utils[_0x15b0('0x3')](util[_0x15b0('0x4')](_0x15b0('0x6b'),_0x2d16eb[_0x15b0('0x6')],queues[_0x2d16eb[_0x15b0('0x6')]][_0x15b0('0x23')],queues[_0x2d16eb['uniqueid']][_0x15b0('0x5a')]));delete queues[_0x2d16eb[_0x15b0('0x6')]]['musiconholdstartAt'];}}}catch(_0x2886cd){utils[_0x15b0('0x17')](util['format'](_0x15b0('0x69'),_0x2d16eb[_0x15b0('0x6')]),_0x2886cd);}}; \ No newline at end of file +var _0x0286=['name','queuecallerenterreason','[%s][queues][hangup]','varset','[%s][queues][varset]','variable','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','queuecallerleave','queuecallerleaveAt','holdtime','queuecallerjoinAt','count','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','accountcode','lastAssignedTo','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDED','transferuniqueid','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','debug','format','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','[%s][queues][queuecallerjoin]','hangup','isNil','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT'];(function(_0x4202b1,_0x453465){var _0x56a13a=function(_0x1418a9){while(--_0x1418a9){_0x4202b1['push'](_0x4202b1['shift']());}};_0x56a13a(++_0x453465);}(_0x0286,0x1e4));var _0x6028=function(_0xf12f34,_0x455923){_0xf12f34=_0xf12f34-0x0;var _0x437ce2=_0x0286[_0xf12f34];return _0x437ce2;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var queues={};function writeDB(_0x17e8d3){utils[_0x6028('0x0')](util['format'](_0x6028('0x1'),_0x17e8d3['uniqueid'],_0x17e8d3[_0x6028('0x2')],_0x17e8d3[_0x6028('0x3')],_0x17e8d3['lastAssignedTo'],_0x17e8d3['calleridnum'],_0x17e8d3['accountcode'],_0x17e8d3['queuecallerexitreason']));if(_0x17e8d3[_0x6028('0x3')]){utils[_0x6028('0x4')](_0x17e8d3[_0x6028('0x3')])['then'](function(_0x5f3c05){if(_0x5f3c05){_0x17e8d3[_0x6028('0x5')]=_0x5f3c05[_0x6028('0x5')];}utils[_0x6028('0x6')](_0x6028('0x7'),_0x17e8d3);});}else{utils[_0x6028('0x6')](_0x6028('0x7'),_0x17e8d3);}if(_0x17e8d3['transfereduniqueid']){delete queues[_0x17e8d3[_0x6028('0x8')]];}else{delete queues[_0x17e8d3[_0x6028('0x9')]];}}exports['queuecallerjoin']=function(_0x2720f6){try{utils[_0x6028('0xa')](util[_0x6028('0xb')]('[%s][queues][queuecallerjoin]',_0x2720f6['uniqueid']),_0x2720f6);utils[_0x6028('0x0')](util[_0x6028('0xb')](_0x6028('0xc'),_0x2720f6['uniqueid'],_0x2720f6[_0x6028('0x3')],_0x2720f6[_0x6028('0xd')]));queues[_0x2720f6[_0x6028('0x9')]]=_[_0x6028('0xe')](_0x2720f6,{'originalposition':_0x2720f6[_0x6028('0xd')],'queuecallerjoinAt':utils[_0x6028('0xf')](),'mohtime':0x0});}catch(_0xf6a65a){utils[_0x6028('0x10')](util[_0x6028('0xb')](_0x6028('0x11'),_0x2720f6[_0x6028('0x9')]),_0xf6a65a);}};exports[_0x6028('0x12')]=function(_0x2cf40d){try{if(!_[_0x6028('0x13')](queues[_0x2cf40d[_0x6028('0x9')]])){utils[_0x6028('0xa')](util[_0x6028('0xb')]('[%s][queues][hangup]',_0x2cf40d['uniqueid']),_0x2cf40d);if(queues[_0x2cf40d[_0x6028('0x9')]]['queuecallerleaveAt']){if(!queues[_0x2cf40d[_0x6028('0x9')]][_0x6028('0x14')]&&!queues[_0x2cf40d[_0x6028('0x9')]][_0x6028('0x15')]){queues[_0x2cf40d[_0x6028('0x9')]][_0x6028('0x16')]=!![];queues[_0x2cf40d[_0x6028('0x9')]][_0x6028('0x17')]=utils['now']();queues[_0x2cf40d[_0x6028('0x9')]][_0x6028('0x18')]=_0x6028('0x19');}utils[_0x6028('0x0')](util[_0x6028('0xb')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x2cf40d[_0x6028('0x9')],queues[_0x2cf40d[_0x6028('0x9')]][_0x6028('0x1a')],queues[_0x2cf40d[_0x6028('0x9')]]['queuecallerexitreason']));writeDB(queues[_0x2cf40d[_0x6028('0x9')]]);}else if(queues[_0x2cf40d[_0x6028('0x9')]]['transfereduniqueid']){utils[_0x6028('0x0')](util['format']('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x2cf40d[_0x6028('0x9')],queues[_0x2cf40d[_0x6028('0x9')]][_0x6028('0x1a')],queues[_0x2cf40d['uniqueid']][_0x6028('0x8')]));queues[queues[_0x2cf40d[_0x6028('0x9')]][_0x6028('0x8')]]=queues[_0x2cf40d['uniqueid']];queues[queues[_0x2cf40d[_0x6028('0x9')]][_0x6028('0x8')]][_0x6028('0x1b')]=0x2;delete queues[_0x2cf40d['uniqueid']];}}}catch(_0x95c712){utils[_0x6028('0x10')](util['format'](_0x6028('0x1c'),_0x2cf40d[_0x6028('0x9')]),_0x95c712);}};exports[_0x6028('0x1d')]=function(_0x49d662){try{utils[_0x6028('0xa')](util['format'](_0x6028('0x1e'),_0x49d662[_0x6028('0x9')]),_0x49d662);if(!_[_0x6028('0x13')](_0x49d662[_0x6028('0x1f')]['queuestatus'])&&_0x49d662[_0x6028('0x20')][_0x6028('0x21')]()!==_0x6028('0x22')){if(!_[_0x6028('0x13')](queues[_0x49d662[_0x6028('0x9')]])){queues[_0x49d662['uniqueid']][_0x6028('0x14')]=![];queues[_0x49d662[_0x6028('0x9')]][_0x6028('0x23')]=null;queues[_0x49d662[_0x6028('0x9')]][_0x6028('0x15')]=!![];queues[_0x49d662[_0x6028('0x9')]][_0x6028('0x24')]=utils[_0x6028('0xf')]();queues[_0x49d662[_0x6028('0x9')]][_0x6028('0x18')]=_0x49d662[_0x6028('0x20')][_0x6028('0x21')]();utils[_0x6028('0x0')](util[_0x6028('0xb')](_0x6028('0x25'),_0x49d662[_0x6028('0x9')],queues[_0x49d662[_0x6028('0x9')]][_0x6028('0x1a')],_0x49d662['value'],queues[_0x49d662['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x49d662[_0x6028('0x9')]]);}}else if(!_[_0x6028('0x13')](_0x49d662[_0x6028('0x1f')][_0x6028('0x26')])){if(!_['isNil'](queues[_0x49d662['uniqueid']])&&!queues[_0x49d662['uniqueid']]['queuecallerabandon']){queues[_0x49d662['uniqueid']]['queuecallerabandon']=![];queues[_0x49d662[_0x6028('0x9')]][_0x6028('0x23')]=null;queues[_0x49d662[_0x6028('0x9')]][_0x6028('0x15')]=!![];queues[_0x49d662['uniqueid']][_0x6028('0x24')]=utils[_0x6028('0xf')]();queues[_0x49d662['uniqueid']][_0x6028('0x18')]=_0x6028('0x27');utils[_0x6028('0x0')](util[_0x6028('0xb')](_0x6028('0x28'),_0x49d662[_0x6028('0x9')],queues[_0x49d662['uniqueid']][_0x6028('0x1a')],_0x49d662[_0x6028('0x20')],queues[_0x49d662[_0x6028('0x9')]][_0x6028('0x18')]));}}}catch(_0x480241){utils[_0x6028('0x10')](util['format'](_0x6028('0x1e'),_0x49d662[_0x6028('0x9')]),_0x480241);}};exports[_0x6028('0x14')]=function(_0x206db3){try{if(!_[_0x6028('0x13')](queues[_0x206db3[_0x6028('0x9')]])){utils['debug'](util[_0x6028('0xb')](_0x6028('0x29'),_0x206db3[_0x6028('0x9')]),_0x206db3);queues[_0x206db3[_0x6028('0x9')]][_0x6028('0x15')]=![];queues[_0x206db3['uniqueid']][_0x6028('0x24')]=null;queues[_0x206db3[_0x6028('0x9')]][_0x6028('0x14')]=!![];queues[_0x206db3[_0x6028('0x9')]][_0x6028('0x23')]=utils['now']();queues[_0x206db3[_0x6028('0x9')]][_0x6028('0x18')]=_0x6028('0x2a');utils[_0x6028('0x0')](util[_0x6028('0xb')](_0x6028('0x2b'),_0x206db3[_0x6028('0x9')],queues[_0x206db3['uniqueid']][_0x6028('0x1a')],queues[_0x206db3[_0x6028('0x9')]][_0x6028('0x18')]));}}catch(_0x2d90b2){utils[_0x6028('0x10')](util['format'](_0x6028('0x29'),_0x206db3[_0x6028('0x9')]),_0x2d90b2);}};exports['queuecallerleave']=function(_0x1ca70e){try{if(!_['isNil'](queues[_0x1ca70e[_0x6028('0x9')]])){utils[_0x6028('0xa')](util[_0x6028('0xb')]('[%s][queues][queuecallerleave]',_0x1ca70e[_0x6028('0x9')]),_0x1ca70e);utils['info'](util[_0x6028('0xb')](_0x6028('0x2c'),_0x1ca70e[_0x6028('0x9')],queues[_0x1ca70e['uniqueid']][_0x6028('0x1a')],_0x1ca70e[_0x6028('0x2d')],_0x1ca70e['connectedlinename']));queues[_0x1ca70e['uniqueid']][_0x6028('0x2e')]=!![];queues[_0x1ca70e[_0x6028('0x9')]][_0x6028('0x2f')]=utils[_0x6028('0xf')]();queues[_0x1ca70e[_0x6028('0x9')]][_0x6028('0x30')]=utils['diffTime'](queues[_0x1ca70e['uniqueid']]['queuecallerleaveAt'],queues[_0x1ca70e['uniqueid']][_0x6028('0x31')]);queues[_0x1ca70e[_0x6028('0x9')]][_0x6028('0xd')]=_0x1ca70e['position'];queues[_0x1ca70e[_0x6028('0x9')]][_0x6028('0x32')]=_0x1ca70e['count'];queues[_0x1ca70e[_0x6028('0x9')]]['connectedlinenum']=_0x1ca70e[_0x6028('0x2d')];queues[_0x1ca70e[_0x6028('0x9')]]['connectedlinename']=_0x1ca70e['connectedlinename'];}}catch(_0x356c82){utils[_0x6028('0x10')](util['format'](_0x6028('0x33'),_0x1ca70e['uniqueid']),_0x356c82);}};exports[_0x6028('0x34')]=function(_0x4fe52d){try{if(!_['isNil'](queues[_0x4fe52d['uniqueid']])){utils[_0x6028('0xa')](util[_0x6028('0xb')]('[%s][queues][agentconnect]',_0x4fe52d[_0x6028('0x9')]),_0x4fe52d);utils[_0x6028('0x0')](util[_0x6028('0xb')](_0x6028('0x35'),_0x4fe52d[_0x6028('0x9')],queues[_0x4fe52d[_0x6028('0x9')]][_0x6028('0x1a')],_0x4fe52d[_0x6028('0x36')],_0x4fe52d[_0x6028('0x37')]));queues[_0x4fe52d[_0x6028('0x9')]][_0x6028('0x14')]=![];queues[_0x4fe52d['uniqueid']]['queuecallerabandon']=![];queues[_0x4fe52d['uniqueid']][_0x6028('0x23')]=null;queues[_0x4fe52d['uniqueid']][_0x6028('0x15')]=![];queues[_0x4fe52d[_0x6028('0x9')]][_0x6028('0x18')]=null;queues[_0x4fe52d[_0x6028('0x9')]][_0x6028('0x24')]=null;queues[_0x4fe52d[_0x6028('0x9')]][_0x6028('0x38')]=!![];queues[_0x4fe52d[_0x6028('0x9')]][_0x6028('0x39')]=_0x4fe52d['destaccountcode'];queues[_0x4fe52d[_0x6028('0x9')]][_0x6028('0x3a')]=_0x4fe52d[_0x6028('0x36')];}}catch(_0x4ef21a){utils[_0x6028('0x10')](util[_0x6028('0xb')](_0x6028('0x3b'),_0x4fe52d[_0x6028('0x9')]),_0x4ef21a);}};exports[_0x6028('0x3c')]=function(_0x3c7f0c){try{if(!_['isNil'](queues[_0x3c7f0c[_0x6028('0x9')]])){if(queues[_0x3c7f0c[_0x6028('0x9')]][_0x6028('0x2f')]){utils['debug'](util['format'](_0x6028('0x3d'),_0x3c7f0c[_0x6028('0x9')]),_0x3c7f0c);queues[_0x3c7f0c[_0x6028('0x9')]][_0x6028('0x14')]=![];queues[_0x3c7f0c[_0x6028('0x9')]]['queuecallerabandon']=![];queues[_0x3c7f0c['uniqueid']][_0x6028('0x23')]=null;queues[_0x3c7f0c[_0x6028('0x9')]][_0x6028('0x15')]=![];queues[_0x3c7f0c[_0x6028('0x9')]][_0x6028('0x24')]=null;queues[_0x3c7f0c[_0x6028('0x9')]][_0x6028('0x38')]=!![];queues[_0x3c7f0c[_0x6028('0x9')]][_0x6028('0x3a')]=_0x3c7f0c['membername'];queues[_0x3c7f0c[_0x6028('0x9')]][_0x6028('0x16')]=!![];queues[_0x3c7f0c['uniqueid']]['queuecallercompleteAt']=utils['now']();if(_0x3c7f0c[_0x6028('0x3e')]==_0x6028('0x3f')){if(!queues[_0x3c7f0c[_0x6028('0x9')]][_0x6028('0x3f')]){queues[_0x3c7f0c['uniqueid']][_0x6028('0x18')]='TRANSFER';}}else{queues[_0x3c7f0c[_0x6028('0x9')]][_0x6028('0x18')]=_0x6028('0x40')+_0x3c7f0c[_0x6028('0x3e')][_0x6028('0x21')]();}utils[_0x6028('0x0')](util['format']('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x3c7f0c['uniqueid'],queues[_0x3c7f0c[_0x6028('0x9')]][_0x6028('0x1a')],_0x3c7f0c[_0x6028('0x36')],queues[_0x3c7f0c[_0x6028('0x9')]][_0x6028('0x18')]));writeDB(queues[_0x3c7f0c[_0x6028('0x9')]]);}}}catch(_0x860546){utils[_0x6028('0x10')](util[_0x6028('0xb')](_0x6028('0x3d'),_0x3c7f0c[_0x6028('0x9')]),_0x860546);}};exports[_0x6028('0x41')]=function(_0x15f962){try{if(!_[_0x6028('0x13')](queues[_0x15f962[_0x6028('0x42')]])){utils[_0x6028('0xa')](util[_0x6028('0xb')]('[%s][queues][blindtransfer]',_0x15f962['uniqueid']),_0x15f962);queues[_0x15f962[_0x6028('0x42')]]['transfer']=!![];queues[_0x15f962[_0x6028('0x42')]][_0x6028('0x43')]=_0x6028('0x44');queues[_0x15f962[_0x6028('0x42')]][_0x6028('0x45')]=_0x15f962[_0x6028('0x46')];queues[_0x15f962['transfereeuniqueid']]['transferuniqueid']=_0x15f962[_0x6028('0x42')];queues[_0x15f962['transfereeuniqueid']][_0x6028('0x18')]=_0x6028('0x47');utils[_0x6028('0x0')](util[_0x6028('0xb')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x15f962[_0x6028('0x9')],queues[_0x15f962[_0x6028('0x42')]][_0x6028('0x1a')],_0x15f962[_0x6028('0x42')],_0x15f962[_0x6028('0x46')]));}}catch(_0x4197da){utils[_0x6028('0x10')](util['format'](_0x6028('0x48'),_0x15f962[_0x6028('0x9')]),_0x4197da);}};exports['attendedtransfer']=function(_0x3be384){try{utils[_0x6028('0xa')](util[_0x6028('0xb')](_0x6028('0x49'),_0x3be384[_0x6028('0x4a')]),_0x3be384);if(_0x3be384[_0x6028('0x4a')]==_0x3be384[_0x6028('0x4b')]){if(!_[_0x6028('0x13')](queues[_0x3be384[_0x6028('0x4c')]])){utils[_0x6028('0x0')](util['format'](_0x6028('0x4d'),_0x3be384[_0x6028('0x4a')],queues[_0x3be384[_0x6028('0x4c')]]['name'],_0x3be384[_0x6028('0x4e')]));queues[_0x3be384[_0x6028('0x4c')]]['transfer']=!![];queues[_0x3be384['secondtransfererlinkedid']][_0x6028('0x43')]='ATTENDED';queues[_0x3be384[_0x6028('0x4c')]][_0x6028('0x45')]=_0x3be384['origtransfererexten'];queues[_0x3be384[_0x6028('0x4c')]]['transferuniqueid']=_0x3be384[_0x6028('0x4a')];queues[_0x3be384['secondtransfererlinkedid']][_0x6028('0x18')]=_0x6028('0x4f');}if(!_[_0x6028('0x13')](queues[_0x3be384[_0x6028('0x4b')]])){if(_0x3be384[_0x6028('0x50')]&&queues[_0x3be384[_0x6028('0x50')]]){queues[_0x3be384[_0x6028('0x50')]][_0x6028('0x1b')]=0x1;queues[_0x3be384[_0x6028('0x42')]]=_['clone'](queues[_0x3be384[_0x6028('0x50')]]);queues[_0x3be384[_0x6028('0x42')]]['transfereduniqueid']=_0x3be384[_0x6028('0x51')];queues[_0x3be384[_0x6028('0x42')]]['queuecallerenterreason']=0x2;queues[_0x3be384[_0x6028('0x42')]][_0x6028('0x52')]=queues[_0x3be384[_0x6028('0x4c')]]['calleridnum'];queues[_0x3be384[_0x6028('0x42')]]['calleridname']=queues[_0x3be384[_0x6028('0x4c')]][_0x6028('0x53')];queues[_0x3be384[_0x6028('0x42')]]['queuecallerjoinAt']=utils[_0x6028('0xf')]();queues[_0x3be384['transfereeuniqueid']][_0x6028('0x2f')]=utils[_0x6028('0xf')]();queues[_0x3be384[_0x6028('0x42')]][_0x6028('0x30')]=0x0;queues[_0x3be384['transfereeuniqueid']][_0x6028('0x54')]=0x0;utils[_0x6028('0x0')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x3be384[_0x6028('0x4a')],queues[_0x3be384[_0x6028('0x42')]]['name'],queues[_0x3be384[_0x6028('0x42')]][_0x6028('0x52')],queues[_0x3be384[_0x6028('0x42')]][_0x6028('0x53')]));}else{utils[_0x6028('0x0')](util[_0x6028('0xb')](_0x6028('0x55'),_0x3be384[_0x6028('0x4a')],queues[_0x3be384[_0x6028('0x4b')]][_0x6028('0x1a')],_0x3be384['secondtransfererlinkedid']));queues[_0x3be384[_0x6028('0x4b')]]['transfereduniqueid']=_0x3be384[_0x6028('0x4c')];}}}else if(_0x3be384[_0x6028('0x56')]==_0x3be384['secondtransfererlinkedid']){if(!_[_0x6028('0x13')](queues[_0x3be384[_0x6028('0x4b')]])){utils[_0x6028('0x0')](util[_0x6028('0xb')](_0x6028('0x57'),_0x3be384['origtransfereruniqueid'],queues[_0x3be384['origtransfererlinkedid']][_0x6028('0x1a')],_0x3be384['secondtransfereruniqueid'],_0x3be384[_0x6028('0x58')]));queues[_0x3be384['origtransfererlinkedid']][_0x6028('0x3f')]=!![];queues[_0x3be384['origtransfererlinkedid']]['transfertype']=_0x6028('0x59');queues[_0x3be384[_0x6028('0x4b')]][_0x6028('0x45')]=_0x3be384[_0x6028('0x58')];queues[_0x3be384[_0x6028('0x4b')]][_0x6028('0x5a')]=_0x3be384[_0x6028('0x56')];queues[_0x3be384[_0x6028('0x4b')]][_0x6028('0x18')]=_0x6028('0x4f');}if(!_[_0x6028('0x13')](queues[_0x3be384['secondtransfererlinkedid']])){if(_0x3be384[_0x6028('0x5b')]&&queues[_0x3be384[_0x6028('0x5b')]]){queues[_0x3be384['transfertargetlinkedid']][_0x6028('0x1b')]=0x1;queues[_0x3be384[_0x6028('0x51')]]=_[_0x6028('0x5c')](queues[_0x3be384['transfertargetlinkedid']]);queues[_0x3be384['transfertargetuniqueid']][_0x6028('0x8')]=_0x3be384[_0x6028('0x51')];queues[_0x3be384[_0x6028('0x51')]][_0x6028('0x1b')]=0x2;queues[_0x3be384['transfertargetuniqueid']][_0x6028('0x52')]=queues[_0x3be384[_0x6028('0x4b')]][_0x6028('0x52')];queues[_0x3be384[_0x6028('0x51')]][_0x6028('0x53')]=queues[_0x3be384['origtransfererlinkedid']][_0x6028('0x53')];queues[_0x3be384[_0x6028('0x51')]][_0x6028('0x31')]=utils[_0x6028('0xf')]();queues[_0x3be384[_0x6028('0x51')]][_0x6028('0x2f')]=utils[_0x6028('0xf')]();queues[_0x3be384[_0x6028('0x51')]]['holdtime']=0x0;queues[_0x3be384[_0x6028('0x51')]]['mohtime']=0x0;utils[_0x6028('0x0')](util[_0x6028('0xb')](_0x6028('0x5d'),_0x3be384[_0x6028('0x4a')],queues[_0x3be384[_0x6028('0x51')]][_0x6028('0x1a')],queues[_0x3be384['transfertargetuniqueid']][_0x6028('0x8')],queues[_0x3be384[_0x6028('0x51')]][_0x6028('0x52')],queues[_0x3be384['transfertargetuniqueid']][_0x6028('0x53')]));}else{utils['info'](util[_0x6028('0xb')](_0x6028('0x55'),_0x3be384['origtransfereruniqueid'],queues[_0x3be384[_0x6028('0x4c')]][_0x6028('0x1a')],_0x3be384[_0x6028('0x4b')]));queues[_0x3be384[_0x6028('0x4c')]][_0x6028('0x8')]=_0x3be384[_0x6028('0x4b')];}}}}catch(_0x30801){utils[_0x6028('0x10')](util[_0x6028('0xb')](_0x6028('0x49'),_0x3be384['origtransfereruniqueid']),_0x30801);}};exports[_0x6028('0x5e')]=function(_0x67f0e1){try{if(!_[_0x6028('0x13')](queues[_0x67f0e1['uniqueid']])){utils['debug'](util['format']('[%s][queues][musiconholdstart]',_0x67f0e1[_0x6028('0x9')]),_0x67f0e1);queues[_0x67f0e1[_0x6028('0x9')]][_0x6028('0x5f')]=utils[_0x6028('0xf')]();utils['info'](util[_0x6028('0xb')](_0x6028('0x60'),_0x67f0e1[_0x6028('0x9')],queues[_0x67f0e1['uniqueid']][_0x6028('0x1a')],queues[_0x67f0e1['uniqueid']][_0x6028('0x5f')]));}}catch(_0x5110aa){utils[_0x6028('0x10')](util[_0x6028('0xb')](_0x6028('0x61'),_0x67f0e1['uniqueid']),_0x5110aa);}};exports[_0x6028('0x62')]=function(_0x12e45c){try{if(!_['isNil'](queues[_0x12e45c[_0x6028('0x9')]])){if(!_[_0x6028('0x13')](queues[_0x12e45c[_0x6028('0x9')]]['musiconholdstartAt'])){utils['debug'](util['format'](_0x6028('0x63'),_0x12e45c[_0x6028('0x9')]),_0x12e45c);queues[_0x12e45c[_0x6028('0x9')]][_0x6028('0x54')]+=utils[_0x6028('0x64')](utils[_0x6028('0xf')](),queues[_0x12e45c[_0x6028('0x9')]][_0x6028('0x5f')]);utils[_0x6028('0x0')](util[_0x6028('0xb')](_0x6028('0x65'),_0x12e45c[_0x6028('0x9')],queues[_0x12e45c['uniqueid']][_0x6028('0x1a')],queues[_0x12e45c[_0x6028('0x9')]][_0x6028('0x54')]));delete queues[_0x12e45c[_0x6028('0x9')]][_0x6028('0x5f')];}}}catch(_0xd4ae1a){utils['error'](util[_0x6028('0xb')](_0x6028('0x63'),_0x12e45c[_0x6028('0x9')]),_0xd4ae1a);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index d4de2d8..dd314ab 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 _0x0728=['channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','.WAV','find','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','cdr','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','blindtransfer','transferercalleridnum','transferercalleridname','transfereecalleridname','transfereruniqueid','recording','[%s][recordings][blindtransfer]','lodash','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil'];(function(_0x27d8bc,_0x19e010){var _0x4b04cb=function(_0x524568){while(--_0x524568){_0x27d8bc['push'](_0x27d8bc['shift']());}};_0x4b04cb(++_0x19e010);}(_0x0728,0x100));var _0x8072=function(_0x299acc,_0x56ee4d){_0x299acc=_0x299acc-0x0;var _0x9e3d56=_0x0728[_0x299acc];return _0x9e3d56;};'use strict';var _=require(_0x8072('0x0'));var util=require('util');var utils=require('./utils');var transfers=require(_0x8072('0x1'));var recordings={};function writeDB(_0x136578){var _0x58f414;utils[_0x8072('0x2')](util[_0x8072('0x3')](_0x8072('0x4'),_0x136578[_0x8072('0x5')]));if(transfers[_0x8072('0x6')][_0x136578[_0x8072('0x5')]]){_0x58f414=_0x136578['uniqueid'];_0x136578['uniqueid']=transfers[_0x8072('0x6')][_0x136578[_0x8072('0x5')]][_0x8072('0x7')];}if(_0x136578[_0x8072('0x8')]){utils[_0x8072('0x9')](_0x136578['accountcode'])[_0x8072('0xa')](function(_0x5daca0){if(_0x5daca0){_0x136578[_0x8072('0xb')]=_0x5daca0[_0x8072('0xc')];_0x136578[_0x8072('0xd')]=_0x5daca0['id'];}utils[_0x8072('0xe')](_0x8072('0xf'),_0x136578);});}else{utils[_0x8072('0xe')](_0x8072('0xf'),_0x136578);}if(_0x58f414)delete transfers[_0x8072('0x6')][_0x58f414];}exports[_0x8072('0x10')]=function(_0x48fd5e){try{utils[_0x8072('0x11')](util[_0x8072('0x3')](_0x8072('0x12'),_0x48fd5e['uniqueid']),_0x48fd5e);if(_0x48fd5e[_0x8072('0x5')]==_0x48fd5e[_0x8072('0x13')]){utils['info'](util[_0x8072('0x3')](_0x8072('0x14'),_0x48fd5e[_0x8072('0x5')],_0x48fd5e[_0x8072('0x15')],_0x48fd5e[_0x8072('0x16')]));recordings[_0x48fd5e[_0x8072('0x5')]]={'uniqueid':_0x48fd5e['uniqueid'],'accountcode':_0x48fd5e['accountcode'],'exten':_0x48fd5e['exten'],'context':_0x48fd5e['context'],'channel':_0x48fd5e[_0x8072('0x17')],'monitors':[]};}}catch(_0x48688f){utils[_0x8072('0x18')](util[_0x8072('0x3')](_0x8072('0x12'),_0x48fd5e[_0x8072('0x5')]),_0x48688f);}};exports[_0x8072('0x19')]=function(_0x30137d){try{utils[_0x8072('0x11')](util[_0x8072('0x3')](_0x8072('0x1a'),_0x30137d[_0x8072('0x5')]),_0x30137d);if(!_[_0x8072('0x1b')](recordings[_0x30137d[_0x8072('0x5')]])&&_0x30137d[_0x8072('0x1c')]==0x6){utils[_0x8072('0x2')](util['format'](_0x8072('0x1d'),_0x30137d[_0x8072('0x5')],_0x30137d[_0x8072('0x15')],_0x30137d[_0x8072('0x17')]));}else if(!_[_0x8072('0x1b')](recordings[_0x30137d[_0x8072('0x13')]])&&_0x30137d[_0x8072('0x1c')]==0x6&&_0x30137d[_0x8072('0x15')]!=_0x8072('0x1e')){utils[_0x8072('0x2')](util[_0x8072('0x3')](_0x8072('0x1f'),_0x30137d[_0x8072('0x5')],_0x30137d[_0x8072('0x13')],_0x30137d['context'],_0x30137d['channel']));recordings[_0x30137d[_0x8072('0x13')]][_0x8072('0x8')]=_0x30137d['accountcode'];}}catch(_0x7a1594){utils[_0x8072('0x18')](util[_0x8072('0x3')]('[%s][recordings][newstate]',_0x30137d[_0x8072('0x5')]),_0x7a1594);}};exports['varset']=function(_0x4c69f7){try{if(!_['isNil'](_0x4c69f7[_0x8072('0x20')])&&!_[_0x8072('0x1b')](_0x4c69f7['variable'][_0x8072('0x21')])){utils[_0x8072('0x11')](util[_0x8072('0x3')](_0x8072('0x22'),_0x4c69f7['uniqueid']),_0x4c69f7);utils[_0x8072('0x2')](util[_0x8072('0x3')](_0x8072('0x23'),_0x4c69f7[_0x8072('0x5')],_0x4c69f7[_0x8072('0x20')],_0x4c69f7[_0x8072('0x24')]));if(_['endsWith'](_0x4c69f7[_0x8072('0x24')],_0x8072('0x25'))){_0x4c69f7[_0x8072('0x24')]=_0x4c69f7[_0x8072('0x24')][_0x8072('0x26')](_0x8072('0x25'),_0x8072('0x27'));}if(recordings[_0x4c69f7[_0x8072('0x13')]]){var _0x5782b0=_[_0x8072('0x28')](recordings[_0x4c69f7['linkedid']]['monitors'],{'value':_0x4c69f7[_0x8072('0x24')]});if(_[_0x8072('0x1b')](_0x5782b0)){recordings[_0x4c69f7['linkedid']]['monitors'][_0x8072('0x29')]({'value':_0x4c69f7[_0x8072('0x24')]});}}}}catch(_0x482a46){utils[_0x8072('0x18')](util['format'](_0x8072('0x22'),_0x4c69f7[_0x8072('0x5')]),_0x482a46);}};exports[_0x8072('0x2a')]=function(_0x54b2ff){try{if(!_['isNil'](recordings[_0x54b2ff[_0x8072('0x5')]])){utils[_0x8072('0x11')](util[_0x8072('0x3')](_0x8072('0x2b'),_0x54b2ff[_0x8072('0x5')]),_0x54b2ff);utils['info'](util[_0x8072('0x3')](_0x8072('0x2c'),_0x54b2ff[_0x8072('0x5')],_0x54b2ff[_0x8072('0x2d')],_0x54b2ff[_0x8072('0x2e')],_0x54b2ff['cause-txt']));recordings[_0x54b2ff[_0x8072('0x5')]][_0x8072('0x2d')]=_0x54b2ff[_0x8072('0x2d')];recordings[_0x54b2ff[_0x8072('0x5')]][_0x8072('0x2e')]=_0x54b2ff[_0x8072('0x2e')];recordings[_0x54b2ff[_0x8072('0x5')]][_0x8072('0x2f')]=_0x54b2ff['connectedlinenum'];recordings[_0x54b2ff[_0x8072('0x5')]][_0x8072('0x30')]=_0x54b2ff[_0x8072('0x30')];if(recordings[_0x54b2ff['uniqueid']][_0x8072('0x31')]==_0x8072('0x32')&&recordings[_0x54b2ff[_0x8072('0x5')]]['accountcode']){recordings[_0x54b2ff['uniqueid']][_0x8072('0x2f')]=recordings[_0x54b2ff[_0x8072('0x5')]][_0x8072('0x8')];recordings[_0x54b2ff['uniqueid']]['connectedlinename']='';}recordings[_0x54b2ff['uniqueid']]['monitors'][_0x8072('0x33')](function(_0x2145c0){var _0x17daef=_[_0x8072('0x34')](recordings[_0x54b2ff[_0x8072('0x5')]]);_0x17daef['value']=_0x2145c0['value'];writeDB(_0x17daef);});delete recordings[_0x54b2ff[_0x8072('0x5')]];}}catch(_0x2f55af){utils[_0x8072('0x18')](util[_0x8072('0x3')](_0x8072('0x2b'),_0x54b2ff['uniqueid']),_0x2f55af);}};exports['newexten']=function(_0x4ecef4){try{if(!_[_0x8072('0x1b')](recordings[_0x4ecef4[_0x8072('0x5')]])){utils['debug'](util[_0x8072('0x3')](_0x8072('0x35'),_0x4ecef4['uniqueid']),_0x4ecef4);utils['info'](util[_0x8072('0x3')](_0x8072('0x36'),_0x4ecef4[_0x8072('0x5')],_0x4ecef4['application'],_0x4ecef4[_0x8072('0x37')]));if(_0x4ecef4[_0x8072('0x38')][_0x8072('0x39')]()==_0x8072('0x3a')&&_['startsWith'](_0x4ecef4['appdata'][_0x8072('0x39')](),_0x8072('0x3b'))){var _0x21ecfc=_0x4ecef4['appdata']['split']('=');var _0xb69b8=_0x21ecfc[0x0]['substring'](_0x21ecfc[0x0]['lastIndexOf']('(')+0x1,_0x21ecfc[0x0][_0x8072('0x3c')](')'));var _0x1b43e3=_0x21ecfc[0x1];recordings[_0x4ecef4['uniqueid']][_0xb69b8]=_0x1b43e3;}}}catch(_0x1974e2){utils['error'](util[_0x8072('0x3')](_0x8072('0x35'),_0x4ecef4[_0x8072('0x5')]),_0x1974e2);}};exports[_0x8072('0x3d')]=function(_0xaad12b){try{if(!_[_0x8072('0x1b')](recordings[_0xaad12b['uniqueid']])){utils[_0x8072('0x11')](util['format'](_0x8072('0x3e'),_0xaad12b[_0x8072('0x5')]),_0xaad12b);utils[_0x8072('0x2')](util['format']('[%s][recordings][queuecallerjoin]\x20queue:%s',_0xaad12b[_0x8072('0x5')],_0xaad12b[_0x8072('0x3f')]));recordings[_0xaad12b[_0x8072('0x5')]][_0x8072('0x3f')]=_0xaad12b['queue'];}}catch(_0x1eb54d){utils['error'](util[_0x8072('0x3')](_0x8072('0x3e'),_0xaad12b[_0x8072('0x5')]),_0x1eb54d);}};exports[_0x8072('0x40')]=function(_0x4149c1){try{utils[_0x8072('0x11')](util[_0x8072('0x3')]('[%s][recordings][blindtransfer]',_0x4149c1[_0x8072('0x5')]),_0x4149c1);utils[_0x8072('0x2')](util[_0x8072('0x3')]('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x4149c1[_0x8072('0x5')],_0x4149c1[_0x8072('0x41')],_0x4149c1[_0x8072('0x42')],_0x4149c1['transfereecalleridnum'],_0x4149c1[_0x8072('0x43')]));if(recordings[_0x4149c1[_0x8072('0x44')]]&&transfers[_0x8072('0x6')][_0x4149c1['transfereruniqueid']]){transfers['blinds'][_0x4149c1[_0x8072('0x44')]][_0x8072('0x45')]=!![];}}catch(_0x7e45c0){utils[_0x8072('0x18')](util[_0x8072('0x3')](_0x8072('0x46'),_0x4149c1[_0x8072('0x5')]),_0x7e45c0);}}; \ No newline at end of file +var _0xcc53=['accountcode','then','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','info','context','exten','newstate','[%s][recordings][newstate]','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','linkedid','channelstate','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','channel','error','variable','value','endsWith','.wav49','replace','.WAV','find','monitors','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','cause-txt','calleridnum','calleridname','connectedlinenum','connectedlinename','type','forEach','[%s][recordings][hangup]','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereruniqueid','recording','lodash','./utils','./transfers.controller','format','uniqueid','blinds','transfereeuniqueid','getUserByInternal'];(function(_0x582210,_0x184c36){var _0x18cf58=function(_0x3257b5){while(--_0x3257b5){_0x582210['push'](_0x582210['shift']());}};_0x18cf58(++_0x184c36);}(_0xcc53,0x1e9));var _0x3cc5=function(_0xbff813,_0x1da624){_0xbff813=_0xbff813-0x0;var _0x16e08b=_0xcc53[_0xbff813];return _0x16e08b;};'use strict';var _=require(_0x3cc5('0x0'));var util=require('util');var utils=require(_0x3cc5('0x1'));var transfers=require(_0x3cc5('0x2'));var recordings={};function writeDB(_0x28b733){var _0x1b1eda;utils['info'](util[_0x3cc5('0x3')]('[%s][recordings][writeDB]',_0x28b733[_0x3cc5('0x4')]));if(transfers[_0x3cc5('0x5')][_0x28b733[_0x3cc5('0x4')]]){_0x1b1eda=_0x28b733[_0x3cc5('0x4')];_0x28b733[_0x3cc5('0x4')]=transfers[_0x3cc5('0x5')][_0x28b733[_0x3cc5('0x4')]][_0x3cc5('0x6')];}if(_0x28b733['accountcode']){utils[_0x3cc5('0x7')](_0x28b733[_0x3cc5('0x8')])[_0x3cc5('0x9')](function(_0x42faaa){if(_0x42faaa){_0x28b733['membername']=_0x42faaa[_0x3cc5('0xa')];_0x28b733[_0x3cc5('0xb')]=_0x42faaa['id'];}utils[_0x3cc5('0xc')](_0x3cc5('0xd'),_0x28b733);});}else{utils[_0x3cc5('0xc')](_0x3cc5('0xd'),_0x28b733);}if(_0x1b1eda)delete transfers['blinds'][_0x1b1eda];}exports[_0x3cc5('0xe')]=function(_0x1fa67d){try{utils[_0x3cc5('0xf')](util['format'](_0x3cc5('0x10'),_0x1fa67d[_0x3cc5('0x4')]),_0x1fa67d);if(_0x1fa67d[_0x3cc5('0x4')]==_0x1fa67d['linkedid']){utils[_0x3cc5('0x11')](util[_0x3cc5('0x3')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x1fa67d[_0x3cc5('0x4')],_0x1fa67d[_0x3cc5('0x12')],_0x1fa67d[_0x3cc5('0x13')]));recordings[_0x1fa67d['uniqueid']]={'uniqueid':_0x1fa67d[_0x3cc5('0x4')],'accountcode':_0x1fa67d[_0x3cc5('0x8')],'exten':_0x1fa67d['exten'],'context':_0x1fa67d['context'],'channel':_0x1fa67d['channel'],'monitors':[]};}}catch(_0x3d0f4b){utils['error'](util[_0x3cc5('0x3')](_0x3cc5('0x10'),_0x1fa67d['uniqueid']),_0x3d0f4b);}};exports[_0x3cc5('0x14')]=function(_0x2a1f2d){try{utils['debug'](util['format'](_0x3cc5('0x15'),_0x2a1f2d[_0x3cc5('0x4')]),_0x2a1f2d);if(!_['isNil'](recordings[_0x2a1f2d[_0x3cc5('0x4')]])&&_0x2a1f2d['channelstate']==0x6){utils[_0x3cc5('0x11')](util[_0x3cc5('0x3')](_0x3cc5('0x16'),_0x2a1f2d[_0x3cc5('0x4')],_0x2a1f2d['context'],_0x2a1f2d['channel']));}else if(!_[_0x3cc5('0x17')](recordings[_0x2a1f2d[_0x3cc5('0x18')]])&&_0x2a1f2d[_0x3cc5('0x19')]==0x6&&_0x2a1f2d['context']!='transfer'){utils['info'](util[_0x3cc5('0x3')](_0x3cc5('0x1a'),_0x2a1f2d[_0x3cc5('0x4')],_0x2a1f2d[_0x3cc5('0x18')],_0x2a1f2d[_0x3cc5('0x12')],_0x2a1f2d[_0x3cc5('0x1b')]));recordings[_0x2a1f2d[_0x3cc5('0x18')]]['accountcode']=_0x2a1f2d[_0x3cc5('0x8')];}}catch(_0x5e5972){utils[_0x3cc5('0x1c')](util[_0x3cc5('0x3')](_0x3cc5('0x15'),_0x2a1f2d['uniqueid']),_0x5e5972);}};exports['varset']=function(_0x56cd43){try{if(!_[_0x3cc5('0x17')](_0x56cd43[_0x3cc5('0x1d')])&&!_[_0x3cc5('0x17')](_0x56cd43[_0x3cc5('0x1d')]['mixmonitor_filename'])){utils[_0x3cc5('0xf')](util[_0x3cc5('0x3')]('[%s][recordings][varset]',_0x56cd43[_0x3cc5('0x4')]),_0x56cd43);utils[_0x3cc5('0x11')](util['format']('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x56cd43[_0x3cc5('0x4')],_0x56cd43[_0x3cc5('0x1d')],_0x56cd43[_0x3cc5('0x1e')]));if(_[_0x3cc5('0x1f')](_0x56cd43[_0x3cc5('0x1e')],_0x3cc5('0x20'))){_0x56cd43[_0x3cc5('0x1e')]=_0x56cd43[_0x3cc5('0x1e')][_0x3cc5('0x21')]('.wav49',_0x3cc5('0x22'));}if(recordings[_0x56cd43[_0x3cc5('0x18')]]){var _0x2d839a=_[_0x3cc5('0x23')](recordings[_0x56cd43[_0x3cc5('0x18')]][_0x3cc5('0x24')],{'value':_0x56cd43[_0x3cc5('0x1e')]});if(_[_0x3cc5('0x17')](_0x2d839a)){recordings[_0x56cd43[_0x3cc5('0x18')]][_0x3cc5('0x24')][_0x3cc5('0x25')]({'value':_0x56cd43[_0x3cc5('0x1e')]});}}}}catch(_0x5b9a14){utils['error'](util[_0x3cc5('0x3')](_0x3cc5('0x26'),_0x56cd43[_0x3cc5('0x4')]),_0x5b9a14);}};exports[_0x3cc5('0x27')]=function(_0x22b5e6){try{if(!_[_0x3cc5('0x17')](recordings[_0x22b5e6[_0x3cc5('0x4')]])){utils[_0x3cc5('0xf')](util[_0x3cc5('0x3')]('[%s][recordings][hangup]',_0x22b5e6[_0x3cc5('0x4')]),_0x22b5e6);utils['info'](util['format'](_0x3cc5('0x28'),_0x22b5e6['uniqueid'],_0x22b5e6['calleridnum'],_0x22b5e6['calleridname'],_0x22b5e6[_0x3cc5('0x29')]));recordings[_0x22b5e6[_0x3cc5('0x4')]][_0x3cc5('0x2a')]=_0x22b5e6[_0x3cc5('0x2a')];recordings[_0x22b5e6[_0x3cc5('0x4')]][_0x3cc5('0x2b')]=_0x22b5e6[_0x3cc5('0x2b')];recordings[_0x22b5e6[_0x3cc5('0x4')]][_0x3cc5('0x2c')]=_0x22b5e6[_0x3cc5('0x2c')];recordings[_0x22b5e6[_0x3cc5('0x4')]][_0x3cc5('0x2d')]=_0x22b5e6['connectedlinename'];if(recordings[_0x22b5e6[_0x3cc5('0x4')]][_0x3cc5('0x2e')]=='outbound'&&recordings[_0x22b5e6['uniqueid']][_0x3cc5('0x8')]){recordings[_0x22b5e6['uniqueid']][_0x3cc5('0x2c')]=recordings[_0x22b5e6[_0x3cc5('0x4')]][_0x3cc5('0x8')];recordings[_0x22b5e6['uniqueid']][_0x3cc5('0x2d')]='';}recordings[_0x22b5e6[_0x3cc5('0x4')]]['monitors'][_0x3cc5('0x2f')](function(_0x4e0a4a){var _0x13165d=_['clone'](recordings[_0x22b5e6[_0x3cc5('0x4')]]);_0x13165d[_0x3cc5('0x1e')]=_0x4e0a4a['value'];writeDB(_0x13165d);});delete recordings[_0x22b5e6[_0x3cc5('0x4')]];}}catch(_0x2628a3){utils[_0x3cc5('0x1c')](util[_0x3cc5('0x3')](_0x3cc5('0x30'),_0x22b5e6[_0x3cc5('0x4')]),_0x2628a3);}};exports['newexten']=function(_0x56873c){try{if(!_[_0x3cc5('0x17')](recordings[_0x56873c[_0x3cc5('0x4')]])){utils['debug'](util['format'](_0x3cc5('0x31'),_0x56873c[_0x3cc5('0x4')]),_0x56873c);utils[_0x3cc5('0x11')](util[_0x3cc5('0x3')](_0x3cc5('0x32'),_0x56873c[_0x3cc5('0x4')],_0x56873c[_0x3cc5('0x33')],_0x56873c[_0x3cc5('0x34')]));if(_0x56873c['application'][_0x3cc5('0x35')]()==_0x3cc5('0x36')&&_[_0x3cc5('0x37')](_0x56873c['appdata'][_0x3cc5('0x35')](),_0x3cc5('0x38'))){var _0x82f132=_0x56873c[_0x3cc5('0x34')][_0x3cc5('0x39')]('=');var _0x20b93e=_0x82f132[0x0][_0x3cc5('0x3a')](_0x82f132[0x0][_0x3cc5('0x3b')]('(')+0x1,_0x82f132[0x0][_0x3cc5('0x3b')](')'));var _0x2674e3=_0x82f132[0x1];recordings[_0x56873c[_0x3cc5('0x4')]][_0x20b93e]=_0x2674e3;}}}catch(_0x19b27f){utils[_0x3cc5('0x1c')](util[_0x3cc5('0x3')](_0x3cc5('0x31'),_0x56873c[_0x3cc5('0x4')]),_0x19b27f);}};exports[_0x3cc5('0x3c')]=function(_0x4ff51e){try{if(!_['isNil'](recordings[_0x4ff51e['uniqueid']])){utils[_0x3cc5('0xf')](util['format'](_0x3cc5('0x3d'),_0x4ff51e[_0x3cc5('0x4')]),_0x4ff51e);utils['info'](util[_0x3cc5('0x3')](_0x3cc5('0x3e'),_0x4ff51e[_0x3cc5('0x4')],_0x4ff51e[_0x3cc5('0x3f')]));recordings[_0x4ff51e[_0x3cc5('0x4')]]['queue']=_0x4ff51e[_0x3cc5('0x3f')];}}catch(_0x47e8d6){utils[_0x3cc5('0x1c')](util[_0x3cc5('0x3')](_0x3cc5('0x3d'),_0x4ff51e[_0x3cc5('0x4')]),_0x47e8d6);}};exports[_0x3cc5('0x40')]=function(_0x2702d1){try{utils[_0x3cc5('0xf')](util[_0x3cc5('0x3')](_0x3cc5('0x41'),_0x2702d1[_0x3cc5('0x4')]),_0x2702d1);utils[_0x3cc5('0x11')](util['format'](_0x3cc5('0x42'),_0x2702d1[_0x3cc5('0x4')],_0x2702d1[_0x3cc5('0x43')],_0x2702d1[_0x3cc5('0x44')],_0x2702d1['transfereecalleridnum'],_0x2702d1['transfereecalleridname']));if(recordings[_0x2702d1[_0x3cc5('0x45')]]&&transfers[_0x3cc5('0x5')][_0x2702d1[_0x3cc5('0x45')]]){transfers[_0x3cc5('0x5')][_0x2702d1[_0x3cc5('0x45')]][_0x3cc5('0x46')]=!![];}}catch(_0x278caf){utils['error'](util[_0x3cc5('0x3')](_0x3cc5('0x41'),_0x2702d1[_0x3cc5('0x4')]),_0x278caf);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 05d65aa..91afcdc 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 _0x96c8=['transfertargetlinkedid','lodash','util','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransferercontext','origtransfererlinkedid','origtransferercontext','attended','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten'];(function(_0x4cda77,_0x445c20){var _0x4ab877=function(_0x47e1b4){while(--_0x47e1b4){_0x4cda77['push'](_0x4cda77['shift']());}};_0x4ab877(++_0x445c20);}(_0x96c8,0x82));var _0x896c=function(_0x100a43,_0x1643a3){_0x100a43=_0x100a43-0x0;var _0x4de497=_0x96c8[_0x100a43];return _0x4de497;};'use strict';var _=require(_0x896c('0x0'));var util=require(_0x896c('0x1'));var utils=require(_0x896c('0x2'));function writeDB(_0x47480f){utils['info'](util[_0x896c('0x3')](_0x896c('0x4'),_0x47480f[_0x896c('0x5')]==='attended'?_0x47480f[_0x896c('0x6')]:_0x47480f[_0x896c('0x7')],_0x47480f['type']));utils[_0x896c('0x8')](_0x896c('0x9'),_0x47480f);}exports[_0x896c('0xa')]={};exports[_0x896c('0xb')]=function(_0x4d6c5e){try{utils[_0x896c('0xc')](util['format'](_0x896c('0xd'),_0x4d6c5e[_0x896c('0x7')]),_0x4d6c5e);utils[_0x896c('0xe')](util[_0x896c('0x3')](_0x896c('0xf'),_0x4d6c5e['uniqueid'],_0x4d6c5e[_0x896c('0x10')],_0x4d6c5e['transferercalleridname'],_0x4d6c5e[_0x896c('0x11')],_0x4d6c5e[_0x896c('0x12')]));_0x4d6c5e[_0x896c('0x5')]=_0x896c('0x13');exports[_0x896c('0xa')][_0x4d6c5e['transfereruniqueid']]=_0x4d6c5e;writeDB(_0x4d6c5e);}catch(_0xa4a83){utils[_0x896c('0x14')](util['format'](_0x896c('0xd'),_0x4d6c5e['uniqueid']),_0xa4a83);}};exports[_0x896c('0x15')]=function(_0xf1b8fb){try{utils[_0x896c('0xc')](util[_0x896c('0x3')](_0x896c('0x16'),_0xf1b8fb[_0x896c('0x6')]),_0xf1b8fb);utils[_0x896c('0xe')](util[_0x896c('0x3')](_0x896c('0x17'),_0xf1b8fb[_0x896c('0x6')],_0xf1b8fb[_0x896c('0x18')],_0xf1b8fb[_0x896c('0x19')],_0xf1b8fb[_0x896c('0x1a')],_0xf1b8fb[_0x896c('0x1b')]));_0xf1b8fb=_[_0x896c('0x1c')](_0xf1b8fb,{'transfererchannel':_0xf1b8fb[_0x896c('0x1d')],'transferercalleridnum':_0xf1b8fb[_0x896c('0x18')],'transferercalleridname':_0xf1b8fb['origtransferercalleridname'],'transfererconnectedlinenum':_0xf1b8fb['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0xf1b8fb['secondtransfererconnectedlinename'],'transfereraccountcode':_0xf1b8fb['origtransfereraccountcode'],'transferercontext':_0xf1b8fb[_0x896c('0x1e')],'transfererexten':_0xf1b8fb['secondtransfererexten'],'transfererlinkedid':_0xf1b8fb[_0x896c('0x1f')],'context':_0xf1b8fb[_0x896c('0x20')],'extension':_0xf1b8fb['origtransfererexten'],'type':_0x896c('0x21')});if(_[_0x896c('0x22')](_0xf1b8fb[_0x896c('0x23')])){_0xf1b8fb=_[_0x896c('0x1c')](_0xf1b8fb,{'transfereechannel':_0xf1b8fb[_0x896c('0x24')],'transfereecalleridnum':_0xf1b8fb['transfertargetcalleridnum'],'transfereecalleridname':_0xf1b8fb[_0x896c('0x1b')],'transfereeconnectedlinenum':_0xf1b8fb[_0x896c('0x25')],'transfereeconnectedlinename':_0xf1b8fb[_0x896c('0x26')],'transfereeaccountcode':_0xf1b8fb[_0x896c('0x27')],'transfereecontext':_0xf1b8fb[_0x896c('0x28')],'transfereeexten':_0xf1b8fb[_0x896c('0x29')],'transfereelinkedid':_0xf1b8fb[_0x896c('0x2a')]});}writeDB(_0xf1b8fb);}catch(_0x99791d){utils[_0x896c('0x14')](util['format']('[%s][transfers][attendedtransfer]',_0xf1b8fb[_0x896c('0x6')]),_0x99791d);}}; \ No newline at end of file +var _0x4c8b=['origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransfererexten','isNil','transfereechannel','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','lodash','util','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','blindtransfer','debug','[%s][transfers][blindtransfer]','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','blind','error','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname'];(function(_0x40c77d,_0x1345ab){var _0x571ef5=function(_0x39e0bc){while(--_0x39e0bc){_0x40c77d['push'](_0x40c77d['shift']());}};_0x571ef5(++_0x1345ab);}(_0x4c8b,0x1f1));var _0xb4c8=function(_0x32f3bb,_0x7fd1f0){_0x32f3bb=_0x32f3bb-0x0;var _0x53eb31=_0x4c8b[_0x32f3bb];return _0x53eb31;};'use strict';var _=require(_0xb4c8('0x0'));var util=require(_0xb4c8('0x1'));var utils=require('./utils');function writeDB(_0x3597ed){utils['info'](util[_0xb4c8('0x2')](_0xb4c8('0x3'),_0x3597ed[_0xb4c8('0x4')]===_0xb4c8('0x5')?_0x3597ed[_0xb4c8('0x6')]:_0x3597ed[_0xb4c8('0x7')],_0x3597ed[_0xb4c8('0x4')]));utils[_0xb4c8('0x8')]('CreateVoiceTransferReport',_0x3597ed);}exports['blinds']={};exports[_0xb4c8('0x9')]=function(_0x53f796){try{utils[_0xb4c8('0xa')](util[_0xb4c8('0x2')](_0xb4c8('0xb'),_0x53f796[_0xb4c8('0x7')]),_0x53f796);utils[_0xb4c8('0xc')](util[_0xb4c8('0x2')](_0xb4c8('0xd'),_0x53f796[_0xb4c8('0x7')],_0x53f796[_0xb4c8('0xe')],_0x53f796['transferercalleridname'],_0x53f796[_0xb4c8('0xf')],_0x53f796[_0xb4c8('0x10')]));_0x53f796[_0xb4c8('0x4')]=_0xb4c8('0x11');exports['blinds'][_0x53f796['transfereruniqueid']]=_0x53f796;writeDB(_0x53f796);}catch(_0x54c79a){utils[_0xb4c8('0x12')](util[_0xb4c8('0x2')](_0xb4c8('0xb'),_0x53f796[_0xb4c8('0x7')]),_0x54c79a);}};exports['attendedtransfer']=function(_0x3d967e){try{utils['debug'](util[_0xb4c8('0x2')]('[%s][transfers][attendedtransfer]',_0x3d967e[_0xb4c8('0x6')]),_0x3d967e);utils[_0xb4c8('0xc')](util['format'](_0xb4c8('0x13'),_0x3d967e[_0xb4c8('0x6')],_0x3d967e['origtransferercalleridnum'],_0x3d967e[_0xb4c8('0x14')],_0x3d967e[_0xb4c8('0x15')],_0x3d967e[_0xb4c8('0x16')]));_0x3d967e=_['assign'](_0x3d967e,{'transfererchannel':_0x3d967e[_0xb4c8('0x17')],'transferercalleridnum':_0x3d967e[_0xb4c8('0x18')],'transferercalleridname':_0x3d967e['origtransferercalleridname'],'transfererconnectedlinenum':_0x3d967e[_0xb4c8('0x19')],'transfererconnectedlinename':_0x3d967e[_0xb4c8('0x1a')],'transfereraccountcode':_0x3d967e[_0xb4c8('0x1b')],'transferercontext':_0x3d967e[_0xb4c8('0x1c')],'transfererexten':_0x3d967e[_0xb4c8('0x1d')],'transfererlinkedid':_0x3d967e[_0xb4c8('0x1e')],'context':_0x3d967e['origtransferercontext'],'extension':_0x3d967e[_0xb4c8('0x1f')],'type':'attended'});if(_[_0xb4c8('0x20')](_0x3d967e[_0xb4c8('0x21')])){_0x3d967e=_[_0xb4c8('0x22')](_0x3d967e,{'transfereechannel':_0x3d967e[_0xb4c8('0x23')],'transfereecalleridnum':_0x3d967e[_0xb4c8('0x15')],'transfereecalleridname':_0x3d967e['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x3d967e[_0xb4c8('0x24')],'transfereeconnectedlinename':_0x3d967e[_0xb4c8('0x25')],'transfereeaccountcode':_0x3d967e[_0xb4c8('0x26')],'transfereecontext':_0x3d967e['transfertargetcontext'],'transfereeexten':_0x3d967e[_0xb4c8('0x27')],'transfereelinkedid':_0x3d967e['transfertargetlinkedid']});}writeDB(_0x3d967e);}catch(_0x268de3){utils[_0xb4c8('0x12')](util['format']('[%s][transfers][attendedtransfer]',_0x3d967e[_0xb4c8('0x6')]),_0x268de3);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 0948638..6143a8e 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 _0xa945=['add','format','subtractTime','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','isAfter','isBefore','bluebird','jayson/promise','moment','http','xdr','info','inspect','debug','error','request','catch','[utils][request]\x20name:%s','internal','interface','then','[utils][getUser]\x20where:%s','stringify','result','length','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','name','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa945,0x118));var _0x5a94=function(_0x439ce1,_0x978302){_0x439ce1=_0x439ce1-0x0;var _0x1164d6=_0xa945[_0x439ce1];return _0x1164d6;};'use strict';var BPromise=require(_0x5a94('0x0'));var jayson=require(_0x5a94('0x1'));var moment=require(_0x5a94('0x2'));var util=require('util');var client=jayson['client'][_0x5a94('0x3')]({'port':0x2329});var logger=require('../../config/logger')(_0x5a94('0x4'));exports['info']=function(_0x27c3db,_0x4b5341){logger[_0x5a94('0x5')](_0x27c3db,_0x4b5341?util[_0x5a94('0x6')](_0x4b5341,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x36fe63,_0x14fa1a){logger[_0x5a94('0x7')](_0x36fe63,_0x14fa1a?util[_0x5a94('0x6')](_0x14fa1a,{'showHidden':![],'depth':null}):'');};exports[_0x5a94('0x8')]=function(_0x2f795f,_0xae329){logger['error'](_0x2f795f,_0xae329?util['inspect'](_0xae329,{'showHidden':![],'depth':null}):'');};exports[_0x5a94('0x9')]=function(_0x46ca0b,_0x199c8b){return client[_0x5a94('0x9')](_0x46ca0b,{'body':_0x199c8b})['then'](function(_0x1134c9){logger[_0x5a94('0x7')]('[utils][request]\x20name:%s',_0x46ca0b,_0x1134c9?util[_0x5a94('0x6')](_0x1134c9,{'showHidden':![],'depth':null}):'');})[_0x5a94('0xa')](function(_0x19d545){logger[_0x5a94('0x8')](_0x5a94('0xb'),_0x46ca0b,_0x19d545?util[_0x5a94('0x6')](_0x19d545,{'showHidden':![],'depth':null}):'');});};function getUser(_0x260d6f){return client['request']('GetUser',{'options':{'raw':!![],'attributes':['id',_0x5a94('0xc'),'name',_0x5a94('0xd')],'where':_0x260d6f,'limit':0x1}})[_0x5a94('0xe')](function(_0x3f66c0){logger[_0x5a94('0x7')](_0x5a94('0xf'),JSON[_0x5a94('0x10')](_0x260d6f),_0x3f66c0?util[_0x5a94('0x6')](_0x3f66c0,{'showHidden':![],'depth':null}):'');return _0x3f66c0[_0x5a94('0x11')][_0x5a94('0x12')]?_0x3f66c0[_0x5a94('0x11')][0x0]:null;});}exports['getUserByInternal']=function(_0x180844){return new BPromise(function(_0x14bb6f,_0x2bb579){if(_0x180844){return getUser({'internal':_0x180844})[_0x5a94('0xe')](function(_0x153ec0){logger[_0x5a94('0x5')](_0x5a94('0x13'),_0x180844,_0x153ec0?'found':_0x5a94('0x14'));return _0x14bb6f(_0x153ec0);})[_0x5a94('0xa')](function(_0x1997a4){logger[_0x5a94('0x8')]('[utils][getUserByInternal]',_0x1997a4?util['inspect'](_0x1997a4,{'showHidden':![],'depth':null}):'');return _0x14bb6f(null);});}return _0x14bb6f(null);});};exports[_0x5a94('0x15')]=function(_0x2a12ca){return new BPromise(function(_0x10d6de,_0x5785be){if(_0x2a12ca){return getUser({'interface':_0x2a12ca})['then'](function(_0x3acfe5){logger[_0x5a94('0x5')](_0x5a94('0x16'),_0x2a12ca,_0x3acfe5?_0x5a94('0x17'):_0x5a94('0x14'));return _0x10d6de(_0x3acfe5);})['catch'](function(_0x9cdff5){logger[_0x5a94('0x8')](_0x5a94('0x18'),_0x9cdff5?util[_0x5a94('0x6')](_0x9cdff5,{'showHidden':![],'depth':null}):'');return _0x10d6de(null);});}return _0x10d6de(null);});};exports[_0x5a94('0x19')]=function(_0x1ca07d){return new BPromise(function(_0x5cb23b,_0x2b2735){if(_0x1ca07d){return getUser({'name':_0x1ca07d})[_0x5a94('0xe')](function(_0x365461){logger[_0x5a94('0x5')](_0x5a94('0x1a'),_0x1ca07d,_0x365461?_0x5a94('0x17'):_0x5a94('0x14'));return _0x5cb23b(_0x365461);})['catch'](function(_0x39e661){logger['error'](_0x5a94('0x1b'),_0x39e661?util[_0x5a94('0x6')](_0x39e661,{'showHidden':![],'depth':null}):'');return _0x5cb23b(null);});}return _0x5cb23b(null);});};exports[_0x5a94('0x1c')]=function(_0xfb92cd){return new BPromise(function(_0x5f4d33,_0x21a038){if(_0xfb92cd){return client[_0x5a94('0x9')](_0x5a94('0x1d'),{'options':{'raw':!![],'attributes':['id',_0x5a94('0x1e'),'type',_0x5a94('0x1f'),_0x5a94('0x20')],'where':{'name':_0xfb92cd},'limit':0x1}})[_0x5a94('0xe')](function(_0x4d613c){logger[_0x5a94('0x7')]('[utils][getVoiceQueueByName]\x20name:%s',_0xfb92cd,_0x4d613c?util[_0x5a94('0x6')](_0x4d613c,{'showHidden':![],'depth':null}):'');logger[_0x5a94('0x5')](_0x5a94('0x21'),_0xfb92cd,_0x4d613c?_0x5a94('0x17'):_0x5a94('0x14'));return _0x5f4d33(_0x4d613c['result']['length']?_0x4d613c[_0x5a94('0x11')][0x0]:null);})['catch'](function(_0x57c355){logger[_0x5a94('0x8')]('[utils][getVoiceQueueByName]',_0x57c355?util[_0x5a94('0x6')](_0x57c355,{'showHidden':![],'depth':null}):'');return _0x5f4d33(null);});}return _0x5f4d33(null);});};exports[_0x5a94('0x22')]=function(_0xe5d890,_0x33860f){return moment(_0xe5d890)[_0x5a94('0x23')](_0x33860f,'seconds')[_0x5a94('0x24')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x5a94('0x25')]=function(_0x775704,_0x510e33){return moment(_0x775704)[_0x5a94('0x26')](_0x510e33,_0x5a94('0x27'))[_0x5a94('0x24')](_0x5a94('0x28'));};exports[_0x5a94('0x29')]=function(_0xf457f0,_0x306464){return moment(_0xf457f0)[_0x5a94('0x2a')](moment(_0x306464),_0x5a94('0x27'));};exports['sumTime']=function(_0x5d539f,_0x2b5f13){return parseInt(_0x5d539f,0xa)+parseInt(_0x2b5f13,0xa);};exports['now']=function(){return moment()[_0x5a94('0x24')](_0x5a94('0x28'));};exports[_0x5a94('0x2b')]=function(_0x36c757,_0x488be3){if(_0x488be3){return moment(_0x36c757)[_0x5a94('0x2b')](_0x488be3);}return!![];};exports['isBefore']=function(_0x435927,_0x355db5){if(_0x355db5){return moment(_0x435927)[_0x5a94('0x2c')](_0x355db5);}else if(_0x435927){return!![];}return![];}; \ No newline at end of file +var _0x3551=['catch','internal','[utils][getUser]\x20where:%s','stringify','result','length','found','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','name','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','diffTime','sumTime','now','isAfter','isBefore','jayson/promise','moment','client','http','xdr','info','debug','error','inspect','request','then','[utils][request]\x20name:%s'];(function(_0x1bc013,_0x7771c6){var _0x55df36=function(_0x1c02e0){while(--_0x1c02e0){_0x1bc013['push'](_0x1bc013['shift']());}};_0x55df36(++_0x7771c6);}(_0x3551,0x1b7));var _0x1355=function(_0x4edce7,_0x4a6d8d){_0x4edce7=_0x4edce7-0x0;var _0x4aa038=_0x3551[_0x4edce7];return _0x4aa038;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x1355('0x0'));var moment=require(_0x1355('0x1'));var util=require('util');var client=jayson[_0x1355('0x2')][_0x1355('0x3')]({'port':0x2329});var logger=require('../../config/logger')(_0x1355('0x4'));exports['info']=function(_0x6753b8,_0x2654ed){logger[_0x1355('0x5')](_0x6753b8,_0x2654ed?util['inspect'](_0x2654ed,{'showHidden':![],'depth':null}):'');};exports[_0x1355('0x6')]=function(_0x25475f,_0x1737cb){logger[_0x1355('0x6')](_0x25475f,_0x1737cb?util['inspect'](_0x1737cb,{'showHidden':![],'depth':null}):'');};exports[_0x1355('0x7')]=function(_0x58f93e,_0x2cc956){logger[_0x1355('0x7')](_0x58f93e,_0x2cc956?util[_0x1355('0x8')](_0x2cc956,{'showHidden':![],'depth':null}):'');};exports[_0x1355('0x9')]=function(_0x5836cb,_0x4401e3){return client[_0x1355('0x9')](_0x5836cb,{'body':_0x4401e3})[_0x1355('0xa')](function(_0x35010e){logger[_0x1355('0x6')](_0x1355('0xb'),_0x5836cb,_0x35010e?util[_0x1355('0x8')](_0x35010e,{'showHidden':![],'depth':null}):'');})[_0x1355('0xc')](function(_0x464b26){logger[_0x1355('0x7')](_0x1355('0xb'),_0x5836cb,_0x464b26?util[_0x1355('0x8')](_0x464b26,{'showHidden':![],'depth':null}):'');});};function getUser(_0x5e1785){return client[_0x1355('0x9')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x1355('0xd'),'name','interface'],'where':_0x5e1785,'limit':0x1}})[_0x1355('0xa')](function(_0x246ef7){logger[_0x1355('0x6')](_0x1355('0xe'),JSON[_0x1355('0xf')](_0x5e1785),_0x246ef7?util['inspect'](_0x246ef7,{'showHidden':![],'depth':null}):'');return _0x246ef7[_0x1355('0x10')][_0x1355('0x11')]?_0x246ef7[_0x1355('0x10')][0x0]:null;});}exports['getUserByInternal']=function(_0xe4b373){return new BPromise(function(_0x4324a2,_0x3ea46e){if(_0xe4b373){return getUser({'internal':_0xe4b373})[_0x1355('0xa')](function(_0x24598){logger[_0x1355('0x5')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0xe4b373,_0x24598?_0x1355('0x12'):_0x1355('0x13'));return _0x4324a2(_0x24598);})[_0x1355('0xc')](function(_0x1f17d7){logger['error'](_0x1355('0x14'),_0x1f17d7?util[_0x1355('0x8')](_0x1f17d7,{'showHidden':![],'depth':null}):'');return _0x4324a2(null);});}return _0x4324a2(null);});};exports['getUserByInterface']=function(_0x3e0f8c){return new BPromise(function(_0x57a289,_0x8eb162){if(_0x3e0f8c){return getUser({'interface':_0x3e0f8c})['then'](function(_0x5b5f2f){logger[_0x1355('0x5')](_0x1355('0x15'),_0x3e0f8c,_0x5b5f2f?'found':'notfound');return _0x57a289(_0x5b5f2f);})['catch'](function(_0x62cdea){logger['error']('[utils][getUserByInterface]',_0x62cdea?util[_0x1355('0x8')](_0x62cdea,{'showHidden':![],'depth':null}):'');return _0x57a289(null);});}return _0x57a289(null);});};exports['getUserByName']=function(_0x3d1917){return new BPromise(function(_0x58a785,_0x4772b2){if(_0x3d1917){return getUser({'name':_0x3d1917})[_0x1355('0xa')](function(_0x2e1aba){logger['info'](_0x1355('0x16'),_0x3d1917,_0x2e1aba?_0x1355('0x12'):'notfound');return _0x58a785(_0x2e1aba);})[_0x1355('0xc')](function(_0x551022){logger[_0x1355('0x7')](_0x1355('0x17'),_0x551022?util[_0x1355('0x8')](_0x551022,{'showHidden':![],'depth':null}):'');return _0x58a785(null);});}return _0x58a785(null);});};exports[_0x1355('0x18')]=function(_0x449826){return new BPromise(function(_0x537204,_0x5df489){if(_0x449826){return client[_0x1355('0x9')](_0x1355('0x19'),{'options':{'raw':!![],'attributes':['id',_0x1355('0x1a'),_0x1355('0x1b'),'acw',_0x1355('0x1c')],'where':{'name':_0x449826},'limit':0x1}})[_0x1355('0xa')](function(_0x47fe1d){logger[_0x1355('0x6')](_0x1355('0x1d'),_0x449826,_0x47fe1d?util['inspect'](_0x47fe1d,{'showHidden':![],'depth':null}):'');logger['info'](_0x1355('0x1e'),_0x449826,_0x47fe1d?'found':_0x1355('0x13'));return _0x537204(_0x47fe1d['result'][_0x1355('0x11')]?_0x47fe1d['result'][0x0]:null);})[_0x1355('0xc')](function(_0x2df5e3){logger['error'](_0x1355('0x1f'),_0x2df5e3?util[_0x1355('0x8')](_0x2df5e3,{'showHidden':![],'depth':null}):'');return _0x537204(null);});}return _0x537204(null);});};exports['addTime']=function(_0x5cb200,_0x5051c7){return moment(_0x5cb200)[_0x1355('0x20')](_0x5051c7,_0x1355('0x21'))[_0x1355('0x22')](_0x1355('0x23'));};exports['subtractTime']=function(_0x1e133f,_0x30b012){return moment(_0x1e133f)['subtract'](_0x30b012,_0x1355('0x21'))['format'](_0x1355('0x23'));};exports[_0x1355('0x24')]=function(_0x45d926,_0x2bb148){return moment(_0x45d926)['diff'](moment(_0x2bb148),_0x1355('0x21'));};exports[_0x1355('0x25')]=function(_0x565d3c,_0x3dac40){return parseInt(_0x565d3c,0xa)+parseInt(_0x3dac40,0xa);};exports[_0x1355('0x26')]=function(){return moment()[_0x1355('0x22')](_0x1355('0x23'));};exports[_0x1355('0x27')]=function(_0x16ee1b,_0x19bbc9){if(_0x19bbc9){return moment(_0x16ee1b)[_0x1355('0x27')](_0x19bbc9);}return!![];};exports[_0x1355('0x28')]=function(_0x315f32,_0xd5f38f){if(_0xd5f38f){return moment(_0x315f32)[_0x1355('0x28')](_0xd5f38f);}else if(_0x315f32){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 5d3795b..aac4a47 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 _0xd883=['format','method','headers','x-forwarded-for','connection','remoteAddress','responseTime','role','inspect','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','device','url','statusCode','other','agent_id','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','fileLogger','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','name','client','catch','user','then','no-user','data','timestamp','error','set','client-side-logger','isEmpty','\x20body=%s'];(function(_0xf285c1,_0x420382){var _0x1598a0=function(_0x3e96df){while(--_0x3e96df){_0xf285c1['push'](_0xf285c1['shift']());}};_0x1598a0(++_0x420382);}(_0xd883,0x1b3));var _0x3d88=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xd883[_0x5d6456];return _0x4d66c1;};var fs=require(_0x3d88('0x0'));var _=require(_0x3d88('0x1'));var ewinston=require(_0x3d88('0x2'));var path=require(_0x3d88('0x3'));var util=require('util');var fileLogger=require('./loggers')[_0x3d88('0x4')];var safeTemplate=require('./safe-template')[_0x3d88('0x5')];var maskSensitiveData=require(_0x3d88('0x6'))[_0x3d88('0x7')];function ClientSideLogger(){function _0xa1bd56(_0x4f597f){var _0x54b6f0=path[_0x3d88('0x8')](_0x3d88('0x9'),_0x3d88('0xa'),_0x3d88('0xb'));var _0x374cf0=path['join']('client',_0x4f597f['role']+'-'+_0x4f597f[_0x3d88('0xc')]);return fs['ensureDir'](path[_0x3d88('0x8')](_0x54b6f0,_0x374cf0))['then'](function(){var _0x5cddbc=fileLogger(_0x3d88('0xd'),path[_0x3d88('0x8')](_0x54b6f0,_0x374cf0));return _0x5cddbc;})[_0x3d88('0xe')](function(_0xfc0226){throw _0xfc0226;});}this[_0x3d88('0xa')]=function(_0x106a80,_0x4aefe0,_0x588335,_0x1114b2){return _0xa1bd56(_0x106a80[_0x3d88('0xf')])[_0x3d88('0x10')](function(_0x4bf468){var _0x279f69=_0x4bf468[_0x4aefe0];return _0x279f69;})[_0x3d88('0x10')](function(_0x562012){var _0x27f057=_0x106a80[_0x3d88('0xf')]?_0x106a80[_0x3d88('0xf')]['id']:_0x3d88('0x11');var _0x434583=_0x1114b2[_0x3d88('0x12')];var _0x415d19=_0x1114b2[_0x3d88('0x13')];var _0x2f4b38=new Date(Number(_0x415d19));return _0x562012(_0x27f057,_0x2f4b38,_0x588335,_0x434583);})[_0x3d88('0xe')](function(_0x238d5c){fileLogger(_0x3d88('0xd'))[_0x3d88('0x14')](_0x238d5c);});};}function setupLoggers(_0x2e2989){return new Promise(function(_0x533435){var _0x58df2c=new ClientSideLogger();var _0x3e8101=fileLogger('api');var _0x5051b2=fileLogger('auth');_0x2e2989[_0x3d88('0x15')](_0x3d88('0x16'),_0x58df2c);_0x2e2989['use'](ewinston['logger']({'winstonInstance':_0x3e8101,'meta':![],'statusLevels':!![],'msg':function(_0x5b4049,_0x93ff5a){var _0x28fcc0='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x3d88('0x17')](_0x5b4049['body'])){_0x28fcc0+=_0x3d88('0x18');var _0x4df841=_0x5b4049['body'];maskSensitiveData(_0x4df841);}return safeTemplate(util[_0x3d88('0x19')](_0x28fcc0,_0x5b4049[_0x3d88('0x1a')],_0x5b4049[_0x3d88('0x1b')]['x-forwarded-for']?_0x5b4049[_0x3d88('0x1b')][_0x3d88('0x1c')]:_0x5b4049[_0x3d88('0x1d')][_0x3d88('0x1e')]||_0x5b4049['ip'],_0x5b4049['url'],_0x93ff5a['statusCode'],_0x93ff5a[_0x3d88('0x1f')],_0x5b4049['user']?_0x5b4049[_0x3d88('0xf')]['id']:null,_0x5b4049[_0x3d88('0xf')]?_0x5b4049['user'][_0x3d88('0xc')]:null,_0x5b4049['user']?_0x5b4049[_0x3d88('0xf')][_0x3d88('0x20')]:null,_0x4df841?util[_0x3d88('0x21')](_0x4df841,![],null):''));}}));_0x2e2989[_0x3d88('0x22')](ewinston[_0x3d88('0x23')]({'winstonInstance':_0x5051b2,'meta':![],'statusLevels':!![],'msg':function(_0x14f6d6,_0x1c8b31){var _0x527af9=_0x3d88('0x24');if(_0x14f6d6['body']&&_0x14f6d6[_0x3d88('0x25')][_0x3d88('0x26')]&&_0x14f6d6[_0x3d88('0x25')]['agent_id']){_0x527af9='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x3d88('0x19')](_0x527af9,_0x14f6d6[_0x3d88('0x1a')],_0x14f6d6['headers']['x-forwarded-for']?_0x14f6d6[_0x3d88('0x1b')][_0x3d88('0x1c')]:_0x14f6d6[_0x3d88('0x1d')]['remoteAddress']||_0x14f6d6['ip'],_0x14f6d6[_0x3d88('0x27')],_0x1c8b31[_0x3d88('0x28')],_0x1c8b31[_0x3d88('0x1f')],_0x14f6d6[_0x3d88('0xf')]?_0x14f6d6['user']['id']:null,_0x14f6d6[_0x3d88('0xf')]?_0x14f6d6[_0x3d88('0xf')]['name']:null,_0x14f6d6[_0x3d88('0xf')]?_0x14f6d6[_0x3d88('0xf')]['role']:null,_0x14f6d6['body']&&_0x14f6d6[_0x3d88('0x25')]['device']?_0x14f6d6[_0x3d88('0x25')][_0x3d88('0x26')]:_0x3d88('0x29'),_0x14f6d6[_0x3d88('0x25')]&&_0x14f6d6['body'][_0x3d88('0x2a')]?_0x14f6d6[_0x3d88('0x25')][_0x3d88('0x2a')]:'',_0x14f6d6[_0x3d88('0x25')]&&_0x14f6d6[_0x3d88('0x25')][_0x3d88('0x2b')]?_0x14f6d6['body'][_0x3d88('0x2b')]:'');},'ignoreRoute':function(_0x5baf80){var _0x40d233=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x40d233[_0x3d88('0x2c')](_0x5baf80['url']);}}));return _0x533435();});}exports[_0x3d88('0x2d')]=setupLoggers; \ No newline at end of file +var _0xbfb9=['%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','device','other','agent_name','test','setupLoggers','lodash','path','./loggers','./mask-sensitive-data','maskSensitiveData','/var','log','xcally','join','client','role','name','ensureDir','then','catch','user','no-user','data','timestamp','error','api','auth','set','client-side-logger','use','logger','body','\x20body=%s','format','method','x-forwarded-for','headers','connection','remoteAddress','url','statusCode','responseTime','inspect'];(function(_0xb86aba,_0x190b3c){var _0x27925c=function(_0x4bb0b6){while(--_0x4bb0b6){_0xb86aba['push'](_0xb86aba['shift']());}};_0x27925c(++_0x190b3c);}(_0xbfb9,0x92));var _0x9bfb=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xbfb9[_0x21a9d9];return _0x46adce;};var fs=require('fs-extra');var _=require(_0x9bfb('0x0'));var ewinston=require('express-winston');var path=require(_0x9bfb('0x1'));var util=require('util');var fileLogger=require(_0x9bfb('0x2'))['fileLogger'];var safeTemplate=require('./safe-template')['safeTemplate'];var maskSensitiveData=require(_0x9bfb('0x3'))[_0x9bfb('0x4')];function ClientSideLogger(){function _0x4f6fb6(_0x485c57){var _0x29b16a=path['join'](_0x9bfb('0x5'),_0x9bfb('0x6'),_0x9bfb('0x7'));var _0x54bf1a=path[_0x9bfb('0x8')](_0x9bfb('0x9'),_0x485c57[_0x9bfb('0xa')]+'-'+_0x485c57[_0x9bfb('0xb')]);return fs[_0x9bfb('0xc')](path[_0x9bfb('0x8')](_0x29b16a,_0x54bf1a))[_0x9bfb('0xd')](function(){var _0x135b46=fileLogger(_0x9bfb('0x9'),path['join'](_0x29b16a,_0x54bf1a));return _0x135b46;})[_0x9bfb('0xe')](function(_0x163bbf){throw _0x163bbf;});}this[_0x9bfb('0x6')]=function(_0x16bf64,_0x152725,_0x1756b5,_0x360d8c){return _0x4f6fb6(_0x16bf64[_0x9bfb('0xf')])[_0x9bfb('0xd')](function(_0x1b98a2){var _0x11d4d5=_0x1b98a2[_0x152725];return _0x11d4d5;})['then'](function(_0x134dbf){var _0x218ece=_0x16bf64[_0x9bfb('0xf')]?_0x16bf64[_0x9bfb('0xf')]['id']:_0x9bfb('0x10');var _0x396be8=_0x360d8c[_0x9bfb('0x11')];var _0x3d30d9=_0x360d8c[_0x9bfb('0x12')];var _0x1d234e=new Date(Number(_0x3d30d9));return _0x134dbf(_0x218ece,_0x1d234e,_0x1756b5,_0x396be8);})[_0x9bfb('0xe')](function(_0x5d3c07){fileLogger('client')[_0x9bfb('0x13')](_0x5d3c07);});};}function setupLoggers(_0x5eecb){return new Promise(function(_0xc1f0b7){var _0x32d6f6=new ClientSideLogger();var _0x45aee2=fileLogger(_0x9bfb('0x14'));var _0xf237b7=fileLogger(_0x9bfb('0x15'));_0x5eecb[_0x9bfb('0x16')](_0x9bfb('0x17'),_0x32d6f6);_0x5eecb[_0x9bfb('0x18')](ewinston[_0x9bfb('0x19')]({'winstonInstance':_0x45aee2,'meta':![],'statusLevels':!![],'msg':function(_0x51c116,_0x26c420){var _0x16afca='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_['isEmpty'](_0x51c116[_0x9bfb('0x1a')])){_0x16afca+=_0x9bfb('0x1b');var _0x49ee23=_0x51c116[_0x9bfb('0x1a')];maskSensitiveData(_0x49ee23);}return safeTemplate(util[_0x9bfb('0x1c')](_0x16afca,_0x51c116[_0x9bfb('0x1d')],_0x51c116['headers'][_0x9bfb('0x1e')]?_0x51c116[_0x9bfb('0x1f')][_0x9bfb('0x1e')]:_0x51c116[_0x9bfb('0x20')][_0x9bfb('0x21')]||_0x51c116['ip'],_0x51c116[_0x9bfb('0x22')],_0x26c420[_0x9bfb('0x23')],_0x26c420[_0x9bfb('0x24')],_0x51c116[_0x9bfb('0xf')]?_0x51c116[_0x9bfb('0xf')]['id']:null,_0x51c116[_0x9bfb('0xf')]?_0x51c116[_0x9bfb('0xf')]['name']:null,_0x51c116[_0x9bfb('0xf')]?_0x51c116['user']['role']:null,_0x49ee23?util[_0x9bfb('0x25')](_0x49ee23,![],null):''));}}));_0x5eecb[_0x9bfb('0x18')](ewinston[_0x9bfb('0x19')]({'winstonInstance':_0xf237b7,'meta':![],'statusLevels':!![],'msg':function(_0x251e0f,_0x2e29ce){var _0x468c89=_0x9bfb('0x26');if(_0x251e0f[_0x9bfb('0x1a')]&&_0x251e0f[_0x9bfb('0x1a')]['device']&&_0x251e0f[_0x9bfb('0x1a')][_0x9bfb('0x27')]){_0x468c89=_0x9bfb('0x28');}return util['format'](_0x468c89,_0x251e0f['method'],_0x251e0f[_0x9bfb('0x1f')]['x-forwarded-for']?_0x251e0f['headers']['x-forwarded-for']:_0x251e0f[_0x9bfb('0x20')]['remoteAddress']||_0x251e0f['ip'],_0x251e0f[_0x9bfb('0x22')],_0x2e29ce[_0x9bfb('0x23')],_0x2e29ce[_0x9bfb('0x24')],_0x251e0f[_0x9bfb('0xf')]?_0x251e0f[_0x9bfb('0xf')]['id']:null,_0x251e0f[_0x9bfb('0xf')]?_0x251e0f['user']['name']:null,_0x251e0f['user']?_0x251e0f['user'][_0x9bfb('0xa')]:null,_0x251e0f[_0x9bfb('0x1a')]&&_0x251e0f[_0x9bfb('0x1a')][_0x9bfb('0x29')]?_0x251e0f[_0x9bfb('0x1a')]['device']:_0x9bfb('0x2a'),_0x251e0f[_0x9bfb('0x1a')]&&_0x251e0f[_0x9bfb('0x1a')][_0x9bfb('0x27')]?_0x251e0f[_0x9bfb('0x1a')][_0x9bfb('0x27')]:'',_0x251e0f['body']&&_0x251e0f['body']['agent_name']?_0x251e0f['body'][_0x9bfb('0x2b')]:'');},'ignoreRoute':function(_0x1e76d5){var _0x50d5b1=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x50d5b1[_0x9bfb('0x2c')](_0x1e76d5['url']);}}));return _0xc1f0b7();});}exports[_0x9bfb('0x2d')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index eab0ae2..70e2b82 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f0e=['message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','level','Logger','Console','warn','transports','File','%s-%s','error','fileLogger','path','util','moment','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','white','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','format'];(function(_0xf064e9,_0x1bda3e){var _0xb4beab=function(_0x282411){while(--_0x282411){_0xf064e9['push'](_0xf064e9['shift']());}};_0xb4beab(++_0x1bda3e);}(_0x4f0e,0x187));var _0xe4f0=function(_0x4cefc3,_0x23f291){_0x4cefc3=_0x4cefc3-0x0;var _0x1cc779=_0x4f0e[_0x4cefc3];return _0x1cc779;};'use strict';var path=require(_0xe4f0('0x0'));var util=require(_0xe4f0('0x1'));var moment=require(_0xe4f0('0x2'));var winston=require('winston');var config=require(_0xe4f0('0x3'));var debugLevel=config[_0xe4f0('0x4')]?config[_0xe4f0('0x4')][_0xe4f0('0x5')]():_0xe4f0('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':_0xe4f0('0x7'),'error':_0xe4f0('0x8'),'warn':'bold\x20yellow','info':_0xe4f0('0x9'),'print':'bold\x20white','success':'bold\x20green','http':_0xe4f0('0xa'),'verbose':_0xe4f0('0xb'),'debug':_0xe4f0('0xc'),'silly':_0xe4f0('0xd')};winston[_0xe4f0('0xe')](XC_LOG_COLORS);function getLogFileName(_0x20b3a3,_0x441484,_0x467268){var _0x270e66=_0x20b3a3||'/var/log/xcally';return path['join'](_0x270e66,util[_0xe4f0('0xf')]('%s-%s.log',_0x441484,_0x467268));}function formatter(_0x2fca98,_0x845cad){_0x845cad[_0xe4f0('0x10')]=_0x845cad[_0xe4f0('0x10')][_0xe4f0('0x11')](/@@{/g,_0xe4f0('0x12'))['replace'](/}@@/g,_0xe4f0('0x13'))[_0xe4f0('0x11')](/@{/g,'{{')[_0xe4f0('0x11')](/}@/g,'}}');return util[_0xe4f0('0xf')](_0xe4f0('0x14'),moment()[_0xe4f0('0xf')](_0xe4f0('0x15')),_0x845cad['level'][_0xe4f0('0x16')](),_0x2fca98,_0x845cad[_0xe4f0('0x10')]);}function fileFormat(_0x34594c,_0x4e690f){_0x4e690f[_0xe4f0('0x10')]=_0x4e690f['message']['replace'](/@@{/g,_0xe4f0('0x12'))['replace'](/}@@/g,_0xe4f0('0x13'))[_0xe4f0('0x11')](/@{/g,'{{')[_0xe4f0('0x11')](/}@/g,'}}');var _0x3a76e2=_0x4e690f[_0xe4f0('0x17')]&&Object[_0xe4f0('0x18')](_0x4e690f[_0xe4f0('0x17')])[_0xe4f0('0x19')]?'\x0a\x09'+JSON[_0xe4f0('0x1a')](_0x4e690f['meta']):'';return util[_0xe4f0('0xf')](_0xe4f0('0x1b'),moment()[_0xe4f0('0xf')](_0xe4f0('0x15')),_0x4e690f[_0xe4f0('0x1c')][_0xe4f0('0x16')](),_0x34594c,_0x4e690f['message'],_0x3a76e2);}function consoleLogger(){var _0xf50069=new winston[(_0xe4f0('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xe4f0('0x1e'))]({'level':_0xe4f0('0x1f'),'json':![],'formatter':function(_0x10eead){return formatter('',_0x10eead);}})]});return _0xf50069;}function fileLogger(_0xaebfb8,_0x474b15){var _0x346f96=new winston[(_0xe4f0('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xe4f0('0x20'))][(_0xe4f0('0x21'))]({'name':util[_0xe4f0('0xf')](_0xe4f0('0x22'),_0xaebfb8,_0xe4f0('0x23')),'filename':getLogFileName(_0x474b15,_0xaebfb8,_0xe4f0('0x23')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x591101){return fileFormat(_0xaebfb8,_0x591101);}}),new winston['transports'][(_0xe4f0('0x21'))]({'name':util['format'](_0xe4f0('0x22'),_0xaebfb8,debugLevel),'filename':getLogFileName(_0x474b15,_0xaebfb8,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2d3f28){return fileFormat(_0xaebfb8,_0x2d3f28);}}),new winston[(_0xe4f0('0x20'))]['Console']({'level':_0xe4f0('0x1f'),'json':![],'formatter':function(_0x44c0d1){return fileFormat(_0xaebfb8,_0x44c0d1);}})]});return _0x346f96;}exports['consoleLogger']=consoleLogger;exports[_0xe4f0('0x24')]=fileLogger; \ No newline at end of file +var _0x7c99=['Logger','transports','%s-%s','error','consoleLogger','fileLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','redBG\x20white','red','bold\x20yellow','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','format','%s-%s.log','message','}}}','replace','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','{{{','meta','keys','length','Console','warn'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x7c99,0x15c));var _0x97c9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7c99[_0xa464c9];return _0x3d73c4;};'use strict';var path=require(_0x97c9('0x0'));var util=require(_0x97c9('0x1'));var moment=require(_0x97c9('0x2'));var winston=require(_0x97c9('0x3'));var config=require(_0x97c9('0x4'));var debugLevel=config[_0x97c9('0x5')]?config[_0x97c9('0x5')][_0x97c9('0x6')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x97c9('0x7'),'error':_0x97c9('0x8'),'warn':_0x97c9('0x9'),'info':'white','print':_0x97c9('0xa'),'success':_0x97c9('0xb'),'http':_0x97c9('0xc'),'verbose':_0x97c9('0xd'),'debug':_0x97c9('0xe'),'silly':_0x97c9('0xf')};winston[_0x97c9('0x10')](XC_LOG_COLORS);function getLogFileName(_0xed5e30,_0x5b78a9,_0x19183a){var _0x3f258b=_0xed5e30||_0x97c9('0x11');return path['join'](_0x3f258b,util[_0x97c9('0x12')](_0x97c9('0x13'),_0x5b78a9,_0x19183a));}function formatter(_0xc30941,_0x395abb){_0x395abb['message']=_0x395abb[_0x97c9('0x14')]['replace'](/@@{/g,'{{{')['replace'](/}@@/g,_0x97c9('0x15'))[_0x97c9('0x16')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x97c9('0x12')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x97c9('0x12')](_0x97c9('0x17')),_0x395abb[_0x97c9('0x18')][_0x97c9('0x19')](),_0xc30941,_0x395abb[_0x97c9('0x14')]);}function fileFormat(_0x3e7168,_0x40abae){_0x40abae[_0x97c9('0x14')]=_0x40abae[_0x97c9('0x14')][_0x97c9('0x16')](/@@{/g,_0x97c9('0x1a'))[_0x97c9('0x16')](/}@@/g,_0x97c9('0x15'))['replace'](/@{/g,'{{')[_0x97c9('0x16')](/}@/g,'}}');var _0x12b620=_0x40abae[_0x97c9('0x1b')]&&Object[_0x97c9('0x1c')](_0x40abae[_0x97c9('0x1b')])[_0x97c9('0x1d')]?'\x0a\x09'+JSON['stringify'](_0x40abae[_0x97c9('0x1b')]):'';return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()['format'](_0x97c9('0x17')),_0x40abae['level']['toUpperCase'](),_0x3e7168,_0x40abae['message'],_0x12b620);}function consoleLogger(){var _0x41caa5=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x97c9('0x1e'))]({'level':_0x97c9('0x1f'),'json':![],'formatter':function(_0x554edc){return formatter('',_0x554edc);}})]});return _0x41caa5;}function fileLogger(_0x41a4ad,_0x53f3fc){var _0x45cd71=new winston[(_0x97c9('0x20'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x97c9('0x21'))]['File']({'name':util[_0x97c9('0x12')](_0x97c9('0x22'),_0x41a4ad,'error'),'filename':getLogFileName(_0x53f3fc,_0x41a4ad,_0x97c9('0x23')),'level':_0x97c9('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xcd37ab){return fileFormat(_0x41a4ad,_0xcd37ab);}}),new winston[(_0x97c9('0x21'))]['File']({'name':util[_0x97c9('0x12')]('%s-%s',_0x41a4ad,debugLevel),'filename':getLogFileName(_0x53f3fc,_0x41a4ad,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x18b13a){return fileFormat(_0x41a4ad,_0x18b13a);}}),new winston[(_0x97c9('0x21'))][(_0x97c9('0x1e'))]({'level':_0x97c9('0x1f'),'json':![],'formatter':function(_0x3ec384){return fileFormat(_0x41a4ad,_0x3ec384);}})]});return _0x45cd71;}exports[_0x97c9('0x24')]=consoleLogger;exports[_0x97c9('0x25')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index a8ff27e..a978092 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 _0x5f2f=['tenantId','token','channelSecret','accessTokenSecret','authToken','consumerKey','membername','exten','vidaooApiKey','privateKey','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','exports','lodash','username','password','newPassword','apiKey','firstName','lastName','street','fax','email','clientId','clientSecret','securityToken','code'];(function(_0x176e3f,_0x1b3553){var _0x5107b6=function(_0x10e01d){while(--_0x10e01d){_0x176e3f['push'](_0x176e3f['shift']());}};_0x5107b6(++_0x1b3553);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3723c7,_0x54fede){_0x3723c7=_0x3723c7-0x0;var _0x414b4d=_0x5f2f[_0x3723c7];return _0x414b4d;};var _=require(_0xf5f2('0x0'));var sensitiveFields=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3'),_0xf5f2('0x4'),_0xf5f2('0x5'),_0xf5f2('0x6'),_0xf5f2('0x7'),'phone','mobile',_0xf5f2('0x8'),_0xf5f2('0x9'),_0xf5f2('0xa'),_0xf5f2('0xb'),_0xf5f2('0xc'),_0xf5f2('0xd'),'accessKey',_0xf5f2('0xe'),_0xf5f2('0xf'),_0xf5f2('0x10'),'accessToken',_0xf5f2('0x11'),_0xf5f2('0x12'),_0xf5f2('0x13'),'consumerSecret',_0xf5f2('0x14'),'calleridname','calleridnum',_0xf5f2('0x15'),_0xf5f2('0x16'),'clientEmail',_0xf5f2('0x17'),_0xf5f2('0x18'),_0xf5f2('0x19'),_0xf5f2('0x1a'),_0xf5f2('0x1b'),_0xf5f2('0x1c'),'accountSid',_0xf5f2('0x1d'),_0xf5f2('0x1e'),_0xf5f2('0x1f'),_0xf5f2('0x20'),_0xf5f2('0x21')];function maskSensitiveData(_0x4d97fc){const _0xafe430=/(?!^)[\s\S](?!$)/g;if(_[_0xf5f2('0x22')](_0x4d97fc)){for(const _0x17d656 in _0x4d97fc){if(_[_0xf5f2('0x23')](_0x4d97fc[_0x17d656])){for(let _0x23e23a=0x0;_0x23e23a<_0x4d97fc[_0x17d656][_0xf5f2('0x24')];_0x23e23a++){maskSensitiveData(_0x4d97fc[_0x17d656][_0x23e23a]);}}else if(_[_0xf5f2('0x22')](_0x4d97fc[_0x17d656])){maskSensitiveData(_0x4d97fc[_0x17d656]);}else if(_[_0xf5f2('0x25')](_0x4d97fc[_0x17d656])){_0x4d97fc[_0x17d656]=_0x4d97fc[_0x17d656][_0xf5f2('0x26')](/{{{/g,_0xf5f2('0x27'))[_0xf5f2('0x26')](/}}}/g,_0xf5f2('0x28'))[_0xf5f2('0x26')](/{{/g,'@{')[_0xf5f2('0x26')](/}}/g,'}@');if(_[_0xf5f2('0x29')](sensitiveFields,_0x17d656)){_0x4d97fc[_0x17d656]=_0x4d97fc[_0x17d656][_0xf5f2('0x26')](_0xafe430,'*');}}}}}module[_0xf5f2('0x2a')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x5f2f=['tenantId','token','channelSecret','accessTokenSecret','authToken','consumerKey','membername','exten','vidaooApiKey','privateKey','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','exports','lodash','username','password','newPassword','apiKey','firstName','lastName','street','fax','email','clientId','clientSecret','securityToken','code'];(function(_0x5e3ac2,_0x225614){var _0x29a007=function(_0x14545e){while(--_0x14545e){_0x5e3ac2['push'](_0x5e3ac2['shift']());}};_0x29a007(++_0x225614);}(_0x5f2f,0x73));var _0xf5f2=function(_0x290eeb,_0x650eef){_0x290eeb=_0x290eeb-0x0;var _0x506247=_0x5f2f[_0x290eeb];return _0x506247;};var _=require(_0xf5f2('0x0'));var sensitiveFields=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3'),_0xf5f2('0x4'),_0xf5f2('0x5'),_0xf5f2('0x6'),_0xf5f2('0x7'),'phone','mobile',_0xf5f2('0x8'),_0xf5f2('0x9'),_0xf5f2('0xa'),_0xf5f2('0xb'),_0xf5f2('0xc'),_0xf5f2('0xd'),'accessKey',_0xf5f2('0xe'),_0xf5f2('0xf'),_0xf5f2('0x10'),'accessToken',_0xf5f2('0x11'),_0xf5f2('0x12'),_0xf5f2('0x13'),'consumerSecret',_0xf5f2('0x14'),'calleridname','calleridnum',_0xf5f2('0x15'),_0xf5f2('0x16'),'clientEmail',_0xf5f2('0x17'),_0xf5f2('0x18'),_0xf5f2('0x19'),_0xf5f2('0x1a'),_0xf5f2('0x1b'),_0xf5f2('0x1c'),'accountSid',_0xf5f2('0x1d'),_0xf5f2('0x1e'),_0xf5f2('0x1f'),_0xf5f2('0x20'),_0xf5f2('0x21')];function maskSensitiveData(_0x4d97fc){const _0xafe430=/(?!^)[\s\S](?!$)/g;if(_[_0xf5f2('0x22')](_0x4d97fc)){for(const _0x17d656 in _0x4d97fc){if(_[_0xf5f2('0x23')](_0x4d97fc[_0x17d656])){for(let _0x23e23a=0x0;_0x23e23a<_0x4d97fc[_0x17d656][_0xf5f2('0x24')];_0x23e23a++){maskSensitiveData(_0x4d97fc[_0x17d656][_0x23e23a]);}}else if(_[_0xf5f2('0x22')](_0x4d97fc[_0x17d656])){maskSensitiveData(_0x4d97fc[_0x17d656]);}else if(_[_0xf5f2('0x25')](_0x4d97fc[_0x17d656])){_0x4d97fc[_0x17d656]=_0x4d97fc[_0x17d656][_0xf5f2('0x26')](/{{{/g,_0xf5f2('0x27'))[_0xf5f2('0x26')](/}}}/g,_0xf5f2('0x28'))[_0xf5f2('0x26')](/{{/g,'@{')[_0xf5f2('0x26')](/}}/g,'}@');if(_[_0xf5f2('0x29')](sensitiveFields,_0x17d656)){_0x4d97fc[_0x17d656]=_0x4d97fc[_0x17d656][_0xf5f2('0x26')](_0xafe430,'*');}}}}}module[_0xf5f2('0x2a')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 565dc5b..baa07e4 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 _0x3266=['\x20}\x20}','string','replace','isArray','keys','reduce','exports','lodash','{\x20{\x20'];(function(_0x2fecd9,_0x35ab80){var _0x458b0c=function(_0x5173b1){while(--_0x5173b1){_0x2fecd9['push'](_0x2fecd9['shift']());}};_0x458b0c(++_0x35ab80);}(_0x3266,0x6a));var _0x6326=function(_0x5519a9,_0x1c5147){_0x5519a9=_0x5519a9-0x0;var _0x32f2cc=_0x3266[_0x5519a9];return _0x32f2cc;};var _=require(_0x6326('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2b328d){return _0x2b328d==='{{'?_0x6326('0x1'):_0x6326('0x2');}function safeTemplate(_0x545df7){var _0x6b67c0=_0x545df7;if(typeof _0x545df7===_0x6326('0x3')){_0x6b67c0=_0x545df7[_0x6326('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x6326('0x5')](_0x545df7)){_0x6b67c0=_0x545df7['map'](function(_0x30b22e){return safeTemplate(_0x30b22e);});}else if(_['isPlainObject'](_0x545df7)){_0x6b67c0=Object[_0x6326('0x6')](_0x545df7)[_0x6326('0x7')](function(_0x14208e,_0x5402e5){_0x14208e[_0x5402e5]=safeTemplate(_0x545df7[_0x5402e5]);return _0x14208e;},{});}return _0x6b67c0;}module[_0x6326('0x8')]['safeTemplate']=safeTemplate; \ No newline at end of file +var _0xe605=['isArray','map','isPlainObject','keys','reduce','exports','lodash','\x20}\x20}','string','replace'];(function(_0x30663a,_0x59c8f9){var _0x5a3973=function(_0x105a0b){while(--_0x105a0b){_0x30663a['push'](_0x30663a['shift']());}};_0x5a3973(++_0x59c8f9);}(_0xe605,0x92));var _0x5e60=function(_0x55fb1d,_0x3a940f){_0x55fb1d=_0x55fb1d-0x0;var _0x3dc257=_0xe605[_0x55fb1d];return _0x3dc257;};var _=require(_0x5e60('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x455628){return _0x455628==='{{'?'{\x20{\x20':_0x5e60('0x1');}function safeTemplate(_0x455efd){var _0x342132=_0x455efd;if(typeof _0x455efd===_0x5e60('0x2')){_0x342132=_0x455efd[_0x5e60('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x5e60('0x4')](_0x455efd)){_0x342132=_0x455efd[_0x5e60('0x5')](function(_0x30d8fb){return safeTemplate(_0x30d8fb);});}else if(_[_0x5e60('0x6')](_0x455efd)){_0x342132=Object[_0x5e60('0x7')](_0x455efd)[_0x5e60('0x8')](function(_0x168a14,_0x4e3501){_0x168a14[_0x4e3501]=safeTemplate(_0x455efd[_0x4e3501]);return _0x168a14;},{});}return _0x342132;}module[_0x5e60('0x9')]['safeTemplate']=safeTemplate; \ No newline at end of file -- 1.7.1